From: support Date: Wed, 2 Nov 2022 06:26:35 +0000 (+0000) Subject: Built motion from commit 8f498182.|2.6.21 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=5293cb1ac0cb57389526ce54cf67ebd4bbbc857a;p=motion2.git Built motion from commit 8f498182.|2.6.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4709cdc..41a55dd 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-02T06:05:17.961Z", + "time": "2022-11-02T06:17:57.605Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f5125fe..e11e618 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-02T06:05:17.961Z", + "time": "2022-11-02T06:17:57.605Z", "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 8568387..42d5b32 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 _0xdb60=['urlForward[body]','sequelize','VIRTUAL','getDataValue','contactManager','integration','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]','TEXT'];(function(_0x56b2c9,_0x38d9e6){var _0x1624bb=function(_0x4d1872){while(--_0x4d1872){_0x56b2c9['push'](_0x56b2c9['shift']());}};_0x1624bb(++_0x38d9e6);}(_0xdb60,0xd3));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0db6('0x0'));module['exports']={'name':{'type':Sequelize[_0x0db6('0x1')],'get':function(_0x423982){return this[_0x0db6('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0db6('0x3'),_0x0db6('0x4'),'motionbar',_0x0db6('0x5'),_0x0db6('0x6'),_0x0db6('0x7'),_0x0db6('0x8'),'script']],'msg':_0x0db6('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0db6('0xa')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x0db6('0xa')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x0db6('0xa')](0x1000),'comment':_0x0db6('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x0db6('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x0db6('0xd')],'comments':_0x0db6('0xe')}}; \ No newline at end of file +var _0x4a9c=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x14c0fd,_0x1bab5f){var _0x11b618=function(_0x5bcb4b){while(--_0x5bcb4b){_0x14c0fd['push'](_0x14c0fd['shift']());}};_0x11b618(++_0x1bab5f);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x375406,_0x4285d1){_0x375406=_0x375406-0x0;var _0x115d36=_0x4a9c[_0x375406];return _0x115d36;};'use strict';var Sequelize=require(_0xc4a9('0x0'));module[_0xc4a9('0x1')]={'name':{'type':Sequelize[_0xc4a9('0x2')],'get':function(_0xb74796){return this[_0xc4a9('0x3')](_0xc4a9('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xc4a9('0x5'),_0xc4a9('0x6'),_0xc4a9('0x7'),'jscripty','urlForward',_0xc4a9('0x8'),_0xc4a9('0x9'),_0xc4a9('0xa')]],'msg':_0xc4a9('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xc4a9('0xc')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xc4a9('0xd')},'data3':{'type':Sequelize[_0xc4a9('0xc')](0x1000),'comment':_0xc4a9('0xe')},'data4':{'type':Sequelize[_0xc4a9('0xc')](0x1000),'comments':_0xc4a9('0xf')},'data5':{'type':Sequelize[_0xc4a9('0xc')](0x1000),'comments':_0xc4a9('0x10')},'data6':{'type':Sequelize[_0xc4a9('0xc')],'comments':_0xc4a9('0x11')},'data7':{'type':Sequelize[_0xc4a9('0x12')],'comments':_0xc4a9('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 561f7fa..e0e2da7 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 _0x2a85=['desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../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','Action','find','params','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xca8554,_0x5255c5){var _0x4a4185=function(_0x33e052){while(--_0x33e052){_0xca8554['push'](_0xca8554['shift']());}};_0x4a4185(++_0x5255c5);}(_0x2a85,0x171));var _0x52a8=function(_0x676c61,_0x5f5b08){_0x676c61=_0x676c61-0x0;var _0x1c000d=_0x2a85[_0x676c61];return _0x1c000d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52a8('0x1'));var rp=require(_0x52a8('0x2'));var moment=require(_0x52a8('0x3'));var BPromise=require(_0x52a8('0x4'));var Mustache=require(_0x52a8('0x5'));var util=require(_0x52a8('0x6'));var path=require(_0x52a8('0x7'));var sox=require(_0x52a8('0x8'));var csv=require(_0x52a8('0x9'));var ejs=require(_0x52a8('0xa'));var fs=require('fs');var fs_extra=require(_0x52a8('0xb'));var _=require(_0x52a8('0xc'));var squel=require(_0x52a8('0xd'));var crypto=require('crypto');var jsforce=require(_0x52a8('0xe'));var deskjs=require(_0x52a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52a8('0x10'));var Papa=require(_0x52a8('0x11'));var Redis=require('ioredis');var authService=require(_0x52a8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x52a8('0x13'))('api');var utils=require(_0x52a8('0x14'));var config=require(_0x52a8('0x15'));var licenseUtil=require(_0x52a8('0x16'));var db=require(_0x52a8('0x17'))['db'];function respondWithStatusCode(_0x25c7be,_0x5d7eb2){_0x5d7eb2=_0x5d7eb2||0xcc;return function(_0x212a08){if(_0x212a08){return _0x25c7be[_0x52a8('0x18')](_0x5d7eb2);}return _0x25c7be[_0x52a8('0x19')](_0x5d7eb2)[_0x52a8('0x1a')]();};}function respondWithResult(_0x255eaa,_0x4200c2){_0x4200c2=_0x4200c2||0xc8;return function(_0x2e5f86){if(_0x2e5f86){return _0x255eaa[_0x52a8('0x19')](_0x4200c2)[_0x52a8('0x1b')](_0x2e5f86);}};}function respondWithFilteredResult(_0x3305d2,_0x10a7f3){return function(_0xcf4c84){if(_0xcf4c84){var _0x37d4c4=typeof _0x10a7f3[_0x52a8('0x1c')]===_0x52a8('0x1d')&&typeof _0x10a7f3['limit']==='undefined';var _0x340548=_0xcf4c84[_0x52a8('0x1e')];var _0x44f660=_0x37d4c4?0x0:_0x10a7f3[_0x52a8('0x1c')];var _0x1bc9df=_0x37d4c4?_0xcf4c84['count']:_0x10a7f3[_0x52a8('0x1c')]+_0x10a7f3[_0x52a8('0x1f')];var _0x20ddc0;if(_0x1bc9df>=_0x340548){_0x1bc9df=_0x340548;_0x20ddc0=0xc8;}else{_0x20ddc0=0xce;}_0x3305d2[_0x52a8('0x19')](_0x20ddc0);return _0x3305d2[_0x52a8('0x20')](_0x52a8('0x21'),_0x44f660+'-'+_0x1bc9df+'/'+_0x340548)[_0x52a8('0x1b')](_0xcf4c84);}return null;};}function patchUpdates(_0x750b11){return function(_0x3d71a5){try{jsonpatch['apply'](_0x3d71a5,_0x750b11,!![]);}catch(_0x117c91){return BPromise[_0x52a8('0x22')](_0x117c91);}return _0x3d71a5[_0x52a8('0x23')]();};}function saveUpdates(_0x3bff08,_0x29306d){return function(_0x5814f9){if(_0x5814f9){return _0x5814f9[_0x52a8('0x24')](_0x3bff08)[_0x52a8('0x25')](function(_0x10e1d1){return _0x10e1d1;});}return null;};}function removeEntity(_0x3a1b68,_0x14cefe){return function(_0x5b59f2){if(_0x5b59f2){return _0x5b59f2[_0x52a8('0x26')]()[_0x52a8('0x25')](function(){_0x3a1b68['status'](0xcc)[_0x52a8('0x1a')]();});}};}function handleEntityNotFound(_0x4264a8,_0x36e5d7){return function(_0x46c859){if(!_0x46c859){_0x4264a8[_0x52a8('0x18')](0x194);}return _0x46c859;};}function handleError(_0x3962b4,_0x2c2c21){_0x2c2c21=_0x2c2c21||0x1f4;return function(_0x428291){logger[_0x52a8('0x27')](_0x428291[_0x52a8('0x28')]);if(_0x428291[_0x52a8('0x29')]){delete _0x428291['name'];}_0x3962b4[_0x52a8('0x19')](_0x2c2c21)[_0x52a8('0x2a')](_0x428291);};}exports[_0x52a8('0x24')]=function(_0x249b12,_0x550f32){if(_0x249b12[_0x52a8('0x2b')]['id']){delete _0x249b12[_0x52a8('0x2b')]['id'];}return db['Action']['find']({'where':{'id':_0x249b12['params']['id']}})[_0x52a8('0x25')](handleEntityNotFound(_0x550f32,null))[_0x52a8('0x25')](saveUpdates(_0x249b12['body'],null))['then'](respondWithResult(_0x550f32,null))['catch'](handleError(_0x550f32,null));};exports[_0x52a8('0x26')]=function(_0x3f6d70,_0x326d8a){return db[_0x52a8('0x2c')][_0x52a8('0x2d')]({'where':{'id':_0x3f6d70[_0x52a8('0x2e')]['id']}})[_0x52a8('0x25')](handleEntityNotFound(_0x326d8a,null))[_0x52a8('0x25')](removeEntity(_0x326d8a,null))[_0x52a8('0x2f')](handleError(_0x326d8a,null));}; \ No newline at end of file +var _0x3d09=['crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','end','error','stack','name','body','find','params','catch','Action','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0xd2d21a,_0x335c5f){var _0x26014d=function(_0x2f9e29){while(--_0x2f9e29){_0xd2d21a['push'](_0xd2d21a['shift']());}};_0x26014d(++_0x335c5f);}(_0x3d09,0xd4));var _0x93d0=function(_0x3d3014,_0x5edef3){_0x3d3014=_0x3d3014-0x0;var _0x48d626=_0x3d09[_0x3d3014];return _0x48d626;};'use strict';var emlformat=require(_0x93d0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x93d0('0x1'));var rp=require(_0x93d0('0x2'));var moment=require(_0x93d0('0x3'));var BPromise=require(_0x93d0('0x4'));var Mustache=require(_0x93d0('0x5'));var util=require(_0x93d0('0x6'));var path=require(_0x93d0('0x7'));var sox=require(_0x93d0('0x8'));var csv=require(_0x93d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93d0('0xa'));var _=require(_0x93d0('0xb'));var squel=require(_0x93d0('0xc'));var crypto=require(_0x93d0('0xd'));var jsforce=require(_0x93d0('0xe'));var deskjs=require(_0x93d0('0xf'));var toCsv=require(_0x93d0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x93d0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x93d0('0x11'));var as=require(_0x93d0('0x12'));var hardwareService=require(_0x93d0('0x13'));var logger=require(_0x93d0('0x14'))(_0x93d0('0x15'));var utils=require('../../config/utils');var config=require(_0x93d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x93d0('0x17'))['db'];function respondWithStatusCode(_0x2aadfa,_0x3f320e){_0x3f320e=_0x3f320e||0xcc;return function(_0x49e239){if(_0x49e239){return _0x2aadfa[_0x93d0('0x18')](_0x3f320e);}return _0x2aadfa[_0x93d0('0x19')](_0x3f320e)['end']();};}function respondWithResult(_0x4ae381,_0x421db0){_0x421db0=_0x421db0||0xc8;return function(_0x3d320f){if(_0x3d320f){return _0x4ae381['status'](_0x421db0)[_0x93d0('0x1a')](_0x3d320f);}};}function respondWithFilteredResult(_0x196807,_0x412c50){return function(_0x1bfa14){if(_0x1bfa14){var _0x31cb9b=typeof _0x412c50[_0x93d0('0x1b')]===_0x93d0('0x1c')&&typeof _0x412c50['limit']===_0x93d0('0x1c');var _0x35f086=_0x1bfa14[_0x93d0('0x1d')];var _0xacd607=_0x31cb9b?0x0:_0x412c50['offset'];var _0x5d5d11=_0x31cb9b?_0x1bfa14[_0x93d0('0x1d')]:_0x412c50[_0x93d0('0x1b')]+_0x412c50[_0x93d0('0x1e')];var _0x1167cc;if(_0x5d5d11>=_0x35f086){_0x5d5d11=_0x35f086;_0x1167cc=0xc8;}else{_0x1167cc=0xce;}_0x196807[_0x93d0('0x19')](_0x1167cc);return _0x196807['set'](_0x93d0('0x1f'),_0xacd607+'-'+_0x5d5d11+'/'+_0x35f086)[_0x93d0('0x1a')](_0x1bfa14);}return null;};}function patchUpdates(_0x30d1a8){return function(_0x3fd225){try{jsonpatch['apply'](_0x3fd225,_0x30d1a8,!![]);}catch(_0x9955f9){return BPromise[_0x93d0('0x20')](_0x9955f9);}return _0x3fd225['save']();};}function saveUpdates(_0x58a89d,_0x2e6633){return function(_0x5c25d2){if(_0x5c25d2){return _0x5c25d2[_0x93d0('0x21')](_0x58a89d)[_0x93d0('0x22')](function(_0x11076c){return _0x11076c;});}return null;};}function removeEntity(_0x25dd86,_0x418e83){return function(_0x2eb1e4){if(_0x2eb1e4){return _0x2eb1e4[_0x93d0('0x23')]()[_0x93d0('0x22')](function(){_0x25dd86[_0x93d0('0x19')](0xcc)[_0x93d0('0x24')]();});}};}function handleEntityNotFound(_0x40c511,_0x1e7f87){return function(_0x1b342b){if(!_0x1b342b){_0x40c511[_0x93d0('0x18')](0x194);}return _0x1b342b;};}function handleError(_0x2722d4,_0x365cb5){_0x365cb5=_0x365cb5||0x1f4;return function(_0x325ff2){logger[_0x93d0('0x25')](_0x325ff2[_0x93d0('0x26')]);if(_0x325ff2[_0x93d0('0x27')]){delete _0x325ff2[_0x93d0('0x27')];}_0x2722d4[_0x93d0('0x19')](_0x365cb5)['send'](_0x325ff2);};}exports[_0x93d0('0x21')]=function(_0x397c97,_0x2a84d2){if(_0x397c97[_0x93d0('0x28')]['id']){delete _0x397c97[_0x93d0('0x28')]['id'];}return db['Action'][_0x93d0('0x29')]({'where':{'id':_0x397c97[_0x93d0('0x2a')]['id']}})[_0x93d0('0x22')](handleEntityNotFound(_0x2a84d2,null))['then'](saveUpdates(_0x397c97[_0x93d0('0x28')],null))[_0x93d0('0x22')](respondWithResult(_0x2a84d2,null))[_0x93d0('0x2b')](handleError(_0x2a84d2,null));};exports[_0x93d0('0x23')]=function(_0x52e2d7,_0x2ff787){return db[_0x93d0('0x2c')][_0x93d0('0x29')]({'where':{'id':_0x52e2d7[_0x93d0('0x2a')]['id']}})[_0x93d0('0x22')](handleEntityNotFound(_0x2ff787,null))[_0x93d0('0x22')](removeEntity(_0x2ff787,null))['catch'](handleError(_0x2ff787,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 38c2029..d91d0e8 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 _0x0d5a=['exports','Action','util','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes'];(function(_0x92651e,_0x2c5afe){var _0x45cf22=function(_0x91bcc3){while(--_0x91bcc3){_0x92651e['push'](_0x92651e['shift']());}};_0x45cf22(++_0x2c5afe);}(_0x0d5a,0xe8));var _0xa0d5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0d5a[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xa0d5('0x0'));var logger=require('../../config/logger')(_0xa0d5('0x1'));var moment=require(_0xa0d5('0x2'));var BPromise=require(_0xa0d5('0x3'));var rp=require(_0xa0d5('0x4'));var fs=require('fs');var path=require(_0xa0d5('0x5'));var rimraf=require('rimraf');var config=require(_0xa0d5('0x6'));var attributes=require(_0xa0d5('0x7'));module[_0xa0d5('0x8')]=function(_0x39184c,_0x4015b4){return _0x39184c['define'](_0xa0d5('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe916=['tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','./action.attributes','exports','define','Action'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xe916,0x91));var _0x6e91=function(_0x548016,_0x2e5c2d){_0x548016=_0x548016-0x0;var _0xc7500e=_0xe916[_0x548016];return _0xc7500e;};'use strict';var _=require(_0x6e91('0x0'));var util=require(_0x6e91('0x1'));var logger=require(_0x6e91('0x2'))(_0x6e91('0x3'));var moment=require(_0x6e91('0x4'));var BPromise=require('bluebird');var rp=require(_0x6e91('0x5'));var fs=require('fs');var path=require(_0x6e91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e91('0x7'));module[_0x6e91('0x8')]=function(_0x260e8e,_0x8b3759){return _0x260e8e[_0x6e91('0x9')](_0x6e91('0xa'),attributes,{'tableName':_0x6e91('0xb'),'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 731894c..3ce8ab1 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1691e0,_0x290625){var _0x52b537=function(_0x40026a){while(--_0x40026a){_0x1691e0['push'](_0x1691e0['shift']());}};_0x52b537(++_0x290625);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x381f7f,_0x1321a9){_0x381f7f=_0x381f7f-0x0;var _0xd2ae6d=_0x7fbe[_0x381f7f];return _0xd2ae6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xf494,0x1c6));var _0x4f49=function(_0x4ff431,_0x520261){_0x4ff431=_0x4ff431-0x0;var _0x42c52b=_0xf494[_0x4ff431];return _0x42c52b;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f04a07f..3549b24 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 _0x7b99=['./action.controller','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x6596e,_0xa89aa3){var _0x5596ce=function(_0x5acf59){while(--_0x5acf59){_0x6596e['push'](_0x6596e['shift']());}};_0x5596ce(++_0xa89aa3);}(_0x7b99,0xa2));var _0x97b9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7b99[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x97b9('0x0'));var path=require(_0x97b9('0x1'));var timeout=require(_0x97b9('0x2'));var express=require('express');var router=express[_0x97b9('0x3')]();var fs_extra=require(_0x97b9('0x4'));var auth=require(_0x97b9('0x5'));var interaction=require(_0x97b9('0x6'));var config=require('../../config/environment');var controller=require(_0x97b9('0x7'));router[_0x97b9('0x8')](_0x97b9('0x9'),auth['isAuthenticated'](),controller[_0x97b9('0xa')]);router[_0x97b9('0xb')](_0x97b9('0x9'),auth['isAuthenticated'](),controller[_0x97b9('0xc')]);module['exports']=router; \ No newline at end of file +var _0x2bab=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util'];(function(_0x329d59,_0xae2550){var _0x2ff3bb=function(_0x2f9019){while(--_0x2f9019){_0x329d59['push'](_0x329d59['shift']());}};_0x2ff3bb(++_0xae2550);}(_0x2bab,0xb3));var _0xb2ba=function(_0x1e540a,_0x3477d7){_0x1e540a=_0x1e540a-0x0;var _0x3d7787=_0x2bab[_0x1e540a];return _0x3d7787;};'use strict';var multer=require('multer');var util=require(_0xb2ba('0x0'));var path=require(_0xb2ba('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2ba('0x2'));var router=express[_0xb2ba('0x3')]();var fs_extra=require(_0xb2ba('0x4'));var auth=require(_0xb2ba('0x5'));var interaction=require(_0xb2ba('0x6'));var config=require(_0xb2ba('0x7'));var controller=require(_0xb2ba('0x8'));router['put'](_0xb2ba('0x9'),auth[_0xb2ba('0xa')](),controller[_0xb2ba('0xb')]);router[_0xb2ba('0xc')]('/:id',auth[_0xb2ba('0xa')](),controller[_0xb2ba('0xd')]);module[_0xb2ba('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ec0b0fc..a51275d 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xfdbd[_0x2e5f9c];return _0x538b44;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0x038b=['exports','STRING','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x038b,0x114));var _0xb038=function(_0x55cdaf,_0x16ab76){_0x55cdaf=_0x55cdaf-0x0;var _0x1a9535=_0x038b[_0x55cdaf];return _0x1a9535;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a1506c7..4e85389 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 _0x9d7b=['COUNT(DISTINCT\x20%s)','MAX(%s)','AnalyticMetric','select','MetricId','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','SELECT','run','SUM(%s)','AVG(%s)','%s.%s\x20=\x20%s.%s','debug','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','limit','undefined','count','json','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','table','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes'];(function(_0x2df2c4,_0x3b183b){var _0x3244d3=function(_0x26e5b2){while(--_0x26e5b2){_0x2df2c4['push'](_0x2df2c4['shift']());}};_0x3244d3(++_0x3b183b);}(_0x9d7b,0xc5));var _0xb9d7=function(_0x105b1a,_0x52d2de){_0x105b1a=_0x105b1a-0x0;var _0x5c95a0=_0x9d7b[_0x105b1a];return _0x5c95a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb9d7('0x2'));var Mustache=require(_0xb9d7('0x3'));var util=require(_0xb9d7('0x4'));var path=require(_0xb9d7('0x5'));var sox=require('sox');var csv=require(_0xb9d7('0x6'));var ejs=require(_0xb9d7('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d7('0x8'));var _=require(_0xb9d7('0x9'));var squel=require(_0xb9d7('0xa'));var crypto=require(_0xb9d7('0xb'));var jsforce=require(_0xb9d7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb9d7('0x6'));var querystring=require(_0xb9d7('0xd'));var Papa=require(_0xb9d7('0xe'));var Redis=require(_0xb9d7('0xf'));var authService=require(_0xb9d7('0x10'));var qs=require(_0xb9d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9d7('0x12'))(_0xb9d7('0x13'));var utils=require(_0xb9d7('0x14'));var config=require(_0xb9d7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9d7('0x16'))['db'];var dbH=require(_0xb9d7('0x16'))[_0xb9d7('0x17')];function respondWithStatusCode(_0x307e8c,_0x44dd52){_0x44dd52=_0x44dd52||0xcc;return function(_0x52d010){if(_0x52d010){return _0x307e8c['sendStatus'](_0x44dd52);}return _0x307e8c[_0xb9d7('0x18')](_0x44dd52)[_0xb9d7('0x19')]();};}function respondWithResult(_0xb0cd94,_0x5707ae){_0x5707ae=_0x5707ae||0xc8;return function(_0x4b9975){if(_0x4b9975){return _0xb0cd94[_0xb9d7('0x18')](_0x5707ae)['json'](_0x4b9975);}};}function respondWithFilteredResult(_0x4e7ec1,_0x24576a){return function(_0x30caf8){if(_0x30caf8){var _0xc9c27b=typeof _0x24576a[_0xb9d7('0x1a')]==='undefined'&&typeof _0x24576a[_0xb9d7('0x1b')]===_0xb9d7('0x1c');var _0x5f027b=_0x30caf8[_0xb9d7('0x1d')];var _0x1c78ba=_0xc9c27b?0x0:_0x24576a[_0xb9d7('0x1a')];var _0x3de446=_0xc9c27b?_0x30caf8[_0xb9d7('0x1d')]:_0x24576a[_0xb9d7('0x1a')]+_0x24576a['limit'];var _0x5c69d0;if(_0x3de446>=_0x5f027b){_0x3de446=_0x5f027b;_0x5c69d0=0xc8;}else{_0x5c69d0=0xce;}_0x4e7ec1['status'](_0x5c69d0);return _0x4e7ec1['set']('Content-Range',_0x1c78ba+'-'+_0x3de446+'/'+_0x5f027b)[_0xb9d7('0x1e')](_0x30caf8);}return null;};}function patchUpdates(_0x41e36c){return function(_0x481ce6){try{jsonpatch[_0xb9d7('0x1f')](_0x481ce6,_0x41e36c,!![]);}catch(_0xb10fed){return BPromise[_0xb9d7('0x20')](_0xb10fed);}return _0x481ce6[_0xb9d7('0x21')]();};}function saveUpdates(_0xca16fc,_0x2002ef){return function(_0x1fce49){if(_0x1fce49){return _0x1fce49['update'](_0xca16fc)[_0xb9d7('0x22')](function(_0xfd747f){return _0xfd747f;});}return null;};}function removeEntity(_0x5e4e66,_0x5d7a5f){return function(_0x5f1fdf){if(_0x5f1fdf){return _0x5f1fdf[_0xb9d7('0x23')]()[_0xb9d7('0x22')](function(){var _0x178087=_0x5f1fdf[_0xb9d7('0x24')]({'plain':!![]});var _0x983ae7=_0xb9d7('0x25');return db[_0xb9d7('0x26')][_0xb9d7('0x23')]({'where':{'type':_0x983ae7,'resourceId':_0x178087['id']}})[_0xb9d7('0x22')](function(){return _0x5f1fdf;});})[_0xb9d7('0x22')](function(){_0x5e4e66[_0xb9d7('0x18')](0xcc)[_0xb9d7('0x19')]();});}};}function handleEntityNotFound(_0x19faea,_0x4b80ab){return function(_0x2ee9e6){if(!_0x2ee9e6){_0x19faea[_0xb9d7('0x27')](0x194);}return _0x2ee9e6;};}function handleError(_0x41b1c0,_0x15b540){_0x15b540=_0x15b540||0x1f4;return function(_0x4e030e){logger[_0xb9d7('0x28')](_0x4e030e[_0xb9d7('0x29')]);if(_0x4e030e[_0xb9d7('0x2a')]){delete _0x4e030e[_0xb9d7('0x2a')];}_0x41b1c0[_0xb9d7('0x18')](_0x15b540)[_0xb9d7('0x2b')](_0x4e030e);};}exports[_0xb9d7('0x2c')]=function(_0x17a259,_0x3944d5){var _0x4a94f3={},_0x1e039b={},_0x4cd2c6={'count':0x0,'rows':[]};var _0x19fb12=_[_0xb9d7('0x2d')](db['AnalyticCustomReport']['rawAttributes'],function(_0x3e369f){return{'name':_0x3e369f['fieldName'],'type':_0x3e369f[_0xb9d7('0x2e')][_0xb9d7('0x2f')]};});_0x1e039b['model']=_[_0xb9d7('0x2d')](_0x19fb12,'name');_0x1e039b[_0xb9d7('0x30')]=_['keys'](_0x17a259[_0xb9d7('0x30')]);_0x1e039b[_0xb9d7('0x31')]=_[_0xb9d7('0x32')](_0x1e039b[_0xb9d7('0x33')],_0x1e039b[_0xb9d7('0x30')]);_0x4a94f3[_0xb9d7('0x34')]=_[_0xb9d7('0x32')](_0x1e039b['model'],qs['fields'](_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x35')]));_0x4a94f3[_0xb9d7('0x34')]=_0x4a94f3[_0xb9d7('0x34')][_0xb9d7('0x36')]?_0x4a94f3[_0xb9d7('0x34')]:_0x1e039b[_0xb9d7('0x33')];if(!_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x37')](_0xb9d7('0x38'))){_0x4a94f3[_0xb9d7('0x1b')]=qs[_0xb9d7('0x1b')](_0x17a259[_0xb9d7('0x30')]['limit']);_0x4a94f3[_0xb9d7('0x1a')]=qs['offset'](_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x1a')]);}_0x4a94f3[_0xb9d7('0x39')]=qs['sort'](_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x3a')]);_0x4a94f3['where']=qs[_0xb9d7('0x31')](_[_0xb9d7('0x3b')](_0x17a259[_0xb9d7('0x30')],_0x1e039b['filters']),_0x19fb12);if(_0x17a259[_0xb9d7('0x30')]['filter']){_0x4a94f3['where']=_['merge'](_0x4a94f3[_0xb9d7('0x3c')],{'$or':_[_0xb9d7('0x2d')](_0x19fb12,function(_0x294463){if(_0x294463[_0xb9d7('0x2e')]!==_0xb9d7('0x3d')){var _0x4893f8={};_0x4893f8[_0x294463[_0xb9d7('0x2a')]]={'$like':'%'+_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x3e')]+'%'};return _0x4893f8;}})});}_0x4a94f3=_['merge']({},_0x4a94f3,_0x17a259[_0xb9d7('0x3f')]);var _0xd0f581={'where':_0x4a94f3[_0xb9d7('0x3c')]};return db[_0xb9d7('0x40')][_0xb9d7('0x1d')](_0xd0f581)[_0xb9d7('0x22')](function(_0x412772){_0x4cd2c6[_0xb9d7('0x1d')]=_0x412772;if(_0x17a259[_0xb9d7('0x30')][_0xb9d7('0x41')]){_0x4a94f3[_0xb9d7('0x42')]=[{'all':!![]}];}return db[_0xb9d7('0x40')][_0xb9d7('0x43')](_0x4a94f3);})['then'](function(_0x20ceeb){_0x4cd2c6['rows']=_0x20ceeb;return _0x4cd2c6;})['then'](respondWithFilteredResult(_0x3944d5,_0x4a94f3))[_0xb9d7('0x44')](handleError(_0x3944d5,null));};exports[_0xb9d7('0x45')]=function(_0x5d0f5d,_0x1f6b4a){var _0x6c9e4a={'raw':![],'where':{'id':_0x5d0f5d[_0xb9d7('0x46')]['id']}},_0x5e1830={};_0x5e1830[_0xb9d7('0x33')]=_[_0xb9d7('0x47')](db[_0xb9d7('0x40')][_0xb9d7('0x48')]);_0x5e1830[_0xb9d7('0x30')]=_[_0xb9d7('0x47')](_0x5d0f5d['query']);_0x5e1830['filters']=_[_0xb9d7('0x32')](_0x5e1830[_0xb9d7('0x33')],_0x5e1830[_0xb9d7('0x30')]);_0x6c9e4a['attributes']=_[_0xb9d7('0x32')](_0x5e1830[_0xb9d7('0x33')],qs[_0xb9d7('0x35')](_0x5d0f5d[_0xb9d7('0x30')][_0xb9d7('0x35')]));_0x6c9e4a[_0xb9d7('0x34')]=_0x6c9e4a[_0xb9d7('0x34')][_0xb9d7('0x36')]?_0x6c9e4a[_0xb9d7('0x34')]:_0x5e1830[_0xb9d7('0x33')];if(_0x5d0f5d[_0xb9d7('0x30')][_0xb9d7('0x41')]){_0x6c9e4a[_0xb9d7('0x42')]=[{'all':!![]}];}_0x6c9e4a=_['merge']({},_0x6c9e4a,_0x5d0f5d[_0xb9d7('0x3f')]);return db[_0xb9d7('0x40')]['find'](_0x6c9e4a)[_0xb9d7('0x22')](handleEntityNotFound(_0x1f6b4a,null))['then'](respondWithResult(_0x1f6b4a,null))['catch'](handleError(_0x1f6b4a,null));};exports[_0xb9d7('0x49')]=function(_0x163f6b,_0x5e31b7){return db['AnalyticCustomReport'][_0xb9d7('0x49')](_0x163f6b[_0xb9d7('0x4a')],{})[_0xb9d7('0x22')](function(_0x40b626){var _0x4e06c2=_0x163f6b[_0xb9d7('0x4b')]['get']({'plain':!![]});if(!_0x4e06c2)throw new Error(_0xb9d7('0x4c'));if(_0x4e06c2[_0xb9d7('0x4d')]===_0xb9d7('0x4b')){var _0x6d9f7=_0x40b626[_0xb9d7('0x24')]({'plain':!![]});var _0x595c45=_0xb9d7('0x4e');return db[_0xb9d7('0x4f')][_0xb9d7('0x50')]({'where':{'name':_0x595c45,'userProfileId':_0x4e06c2[_0xb9d7('0x51')]},'raw':!![]})[_0xb9d7('0x22')](function(_0x2fb391){if(_0x2fb391&&_0x2fb391[_0xb9d7('0x52')]===0x0){return db[_0xb9d7('0x26')][_0xb9d7('0x49')]({'name':_0x6d9f7[_0xb9d7('0x2a')],'resourceId':_0x6d9f7['id'],'type':'CustomReports','sectionId':_0x2fb391['id']},{})[_0xb9d7('0x22')](function(){return _0x40b626;});}else{return _0x40b626;}})[_0xb9d7('0x44')](function(_0x1cf33f){logger[_0xb9d7('0x28')](_0xb9d7('0x53'),_0x1cf33f);throw _0x1cf33f;});}return _0x40b626;})['then'](respondWithResult(_0x5e31b7,0xc9))[_0xb9d7('0x44')](handleError(_0x5e31b7,null));};exports[_0xb9d7('0x54')]=function(_0xdad3bd,_0x372315){if(_0xdad3bd[_0xb9d7('0x4a')]['id']){delete _0xdad3bd[_0xb9d7('0x4a')]['id'];}return db[_0xb9d7('0x40')][_0xb9d7('0x50')]({'where':{'id':_0xdad3bd[_0xb9d7('0x46')]['id']}})[_0xb9d7('0x22')](handleEntityNotFound(_0x372315,null))[_0xb9d7('0x22')](saveUpdates(_0xdad3bd[_0xb9d7('0x4a')],null))[_0xb9d7('0x22')](respondWithResult(_0x372315,null))[_0xb9d7('0x44')](handleError(_0x372315,null));};exports['destroy']=function(_0x185a9c,_0x3fa5fa){return db[_0xb9d7('0x40')]['find']({'where':{'id':_0x185a9c['params']['id']}})[_0xb9d7('0x22')](handleEntityNotFound(_0x3fa5fa,null))['then'](removeEntity(_0x3fa5fa,null))[_0xb9d7('0x44')](handleError(_0x3fa5fa,null));};exports[_0xb9d7('0x55')]=function(_0x3cccb7,_0x4390a1){var _0x12be2a=0xa;var _0x3b6396=[_0xb9d7('0x56'),_0xb9d7('0x57'),_0xb9d7('0x58'),_0xb9d7('0x59')];var _0x4370c8={'SUM':'SUM(%s)','COUNT':_0xb9d7('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb9d7('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb9d7('0x5c'),'GROUP_CONCAT ASC':_0xb9d7('0x5d'),'GROUP_CONCAT DESC':_0xb9d7('0x5e')};var _0x5a24c3={'SEC_TO_TIME':_0xb9d7('0x5f'),'DATE':_0xb9d7('0x60'),'HOUR':_0xb9d7('0x61'),'ROUND':_0xb9d7('0x62'),'UNIX_TIMESTAMP':_0xb9d7('0x63')};var _0x3ca0bd=function(_0x5e54cc){return!_[_0xb9d7('0x64')](['IS\x20NULL',_0xb9d7('0x65'),_0xb9d7('0x66'),_0xb9d7('0x67')],_0x5e54cc);};var _0x3055ec=function(_0x13c61b){if(!_0x13c61b||!_0x13c61b[_0xb9d7('0x68')][_0xb9d7('0x36')]){return'';}for(var _0x183b5a='(',_0x1137be=0x0;_0x1137be<_0x13c61b['rules'][_0xb9d7('0x36')];_0x1137be+=0x1){_0x1137be>0x0&&(_0x183b5a+='\x20'+_0x13c61b[_0xb9d7('0x69')]+'\x20');_0x183b5a+=_0x13c61b[_0xb9d7('0x68')][_0x1137be][_0xb9d7('0x6a')]?_0x3055ec(_0x13c61b[_0xb9d7('0x68')][_0x1137be][_0xb9d7('0x6a')]):_0x13c61b[_0xb9d7('0x68')][_0x1137be][_0xb9d7('0x6b')]+'\x20'+_0x13c61b['rules'][_0x1137be][_0xb9d7('0x6c')]+(_0x3ca0bd(_0x13c61b[_0xb9d7('0x68')][_0x1137be][_0xb9d7('0x6c')])?'\x20'+_0x13c61b['rules'][_0x1137be][_0xb9d7('0x6d')]:'');}return _0x183b5a+')';};var _0x272d16={'where':{'id':_0x3cccb7[_0xb9d7('0x46')]['id']}},_0xd6fedf,_0x12155d,_0xa22ddf,_0x24f0bd,_0x13acd2;_0x272d16=_[_0xb9d7('0x6e')]({},_0x272d16,_0x3cccb7['options']);return db[_0xb9d7('0x40')][_0xb9d7('0x50')](_0x272d16)[_0xb9d7('0x22')](function(_0x4283fb){if(_0x4283fb){_0xd6fedf=_0x4283fb;return _0x4283fb[_0xb9d7('0x6f')]();}return null;})[_0xb9d7('0x22')](function(_0x314788){if(_0x314788){if(!_0x314788[_0xb9d7('0x36')]){throw new db[(_0xb9d7('0x70'))][(_0xb9d7('0x71'))](_0xb9d7('0x72'),0x193);}_0x12155d=_0x314788;return db['AnalyticMetric'][_0xb9d7('0x43')]({'raw':!![]});}return null;})[_0xb9d7('0x22')](function(_0x19ddc0){if(_0x19ddc0){_0xa22ddf=_['keyBy'](_0x19ddc0,'id');var _0x206cda;var _0x557b95=squel['select']();_0x557b95[_0xb9d7('0x73')](_0xd6fedf['table']);for(var _0x1bf43b=0x0;_0x1bf43b<_0x12155d[_0xb9d7('0x36')];_0x1bf43b+=0x1){_0x206cda=_0x12155d[_0x1bf43b]['MetricId']?_0xa22ddf[_0x12155d[_0x1bf43b]['MetricId']][_0xb9d7('0x74')]:_0x12155d[_0x1bf43b]['field'];_0x206cda=_0x12155d[_0x1bf43b][_0xb9d7('0x75')]?_[_0xb9d7('0x76')](_0x4370c8[_0x12155d[_0x1bf43b]['function']],'%s',_0x206cda):_0x206cda;_0x206cda=_0x12155d[_0x1bf43b][_0xb9d7('0x77')]?_[_0xb9d7('0x76')](_0x5a24c3[_0x12155d[_0x1bf43b][_0xb9d7('0x77')]],'%s',_0x206cda):_0x206cda;if(_0x12155d[_0x1bf43b][_0xb9d7('0x78')]){_0x557b95[_0xb9d7('0x6a')](_0x206cda);}_0x12155d[_0x1bf43b][_0xb9d7('0x79')]&&_0x557b95[_0xb9d7('0x39')](_0x206cda,_0x12155d[_0x1bf43b][_0xb9d7('0x79')]===_0xb9d7('0x7a')?![]:!![]);_0x557b95[_0xb9d7('0x6b')](_0x206cda,_0x12155d[_0x1bf43b]['alias']||_0x206cda);}if(_0xd6fedf[_0xb9d7('0x7b')]){_0xd6fedf['joins']=JSON[_0xb9d7('0x7c')](_0xd6fedf['joins']);for(var _0x302e71=0x0;_0x302e71<_0xd6fedf['joins'][_0xb9d7('0x36')];_0x302e71+=0x1){if(_0xd6fedf[_0xb9d7('0x7b')][_0x302e71][_0xb9d7('0x2e')]&&_[_0xb9d7('0x64')](_0x3b6396,_0xd6fedf[_0xb9d7('0x7b')][_0x302e71][_0xb9d7('0x2e')])&&_0xd6fedf[_0xb9d7('0x7b')][_0x302e71][_0xb9d7('0x7d')]&&_0xd6fedf['joins'][_0x302e71][_0xb9d7('0x7e')]&&_0xd6fedf['joins'][_0x302e71][_0xb9d7('0x7f')]){_0x557b95[_0xd6fedf[_0xb9d7('0x7b')][_0x302e71][_0xb9d7('0x2e')]](_0xd6fedf[_0xb9d7('0x7b')][_0x302e71]['foreignTable'],null,util[_0xb9d7('0x77')]('%s.%s\x20=\x20%s.%s',_0xd6fedf[_0xb9d7('0x80')],_0xd6fedf[_0xb9d7('0x7b')][_0x302e71][_0xb9d7('0x7d')],_0xd6fedf['joins'][_0x302e71][_0xb9d7('0x7e')],_0xd6fedf[_0xb9d7('0x7b')][_0x302e71]['foreignKey']));}}}if(_0xd6fedf[_0xb9d7('0x81')]){_0xd6fedf[_0xb9d7('0x81')]=JSON[_0xb9d7('0x7c')](_0xd6fedf['conditions']);_0x557b95[_0xb9d7('0x3c')](_0x3055ec(_0xd6fedf['conditions'][_0xb9d7('0x6a')]));}_0x13acd2=_0x557b95[_0xb9d7('0x82')]();_0x557b95['limit'](_0x12be2a);_0x557b95[_0xb9d7('0x1a')](0x0);logger['debug'](_0xb9d7('0x83'),_0x557b95['toString']());return dbH[_0xb9d7('0x84')][_0xb9d7('0x30')](_0x557b95[_0xb9d7('0x85')](),{'type':dbH[_0xb9d7('0x84')][_0xb9d7('0x86')]['SELECT']});}})[_0xb9d7('0x22')](respondWithResult(_0x4390a1,null))[_0xb9d7('0x44')](handleError(_0x4390a1,null));};function runReport(_0x4e65dc,_0x4a3333,_0x39c1e8){var _0x20c0ea=_0x4a3333[_0xb9d7('0x2a')];var _0x45841c=0xa;var _0x164c12=['join',_0xb9d7('0x57'),_0xb9d7('0x58'),_0xb9d7('0x59')];var _0x3798ec={'SUM':'SUM(%s)','COUNT':_0xb9d7('0x5a'),'COUNT DISTINCT':_0xb9d7('0x87'),'MAX':_0xb9d7('0x88'),'MIN':_0xb9d7('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb9d7('0x5d'),'GROUP_CONCAT DESC':_0xb9d7('0x5e')};var _0xc594aa={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb9d7('0x60'),'HOUR':_0xb9d7('0x61'),'ROUND':_0xb9d7('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2d66cc=function(_0x2df12c){return!_['includes'](['IS\x20NULL',_0xb9d7('0x65'),_0xb9d7('0x66'),_0xb9d7('0x67')],_0x2df12c);};var _0x560ee9=function(_0x5abfb3){if(!_0x5abfb3||!_0x5abfb3[_0xb9d7('0x68')]['length']){return'';}for(var _0x43c359='(',_0x1e4659=0x0;_0x1e4659<_0x5abfb3['rules'][_0xb9d7('0x36')];_0x1e4659+=0x1){_0x1e4659>0x0&&(_0x43c359+='\x20'+_0x5abfb3[_0xb9d7('0x69')]+'\x20');_0x43c359+=_0x5abfb3[_0xb9d7('0x68')][_0x1e4659][_0xb9d7('0x6a')]?_0x560ee9(_0x5abfb3[_0xb9d7('0x68')][_0x1e4659][_0xb9d7('0x6a')]):_0x5abfb3[_0xb9d7('0x68')][_0x1e4659][_0xb9d7('0x6b')]+'\x20'+_0x5abfb3['rules'][_0x1e4659][_0xb9d7('0x6c')]+(_0x2d66cc(_0x5abfb3[_0xb9d7('0x68')][_0x1e4659][_0xb9d7('0x6c')])?'\x20'+_0x5abfb3[_0xb9d7('0x68')][_0x1e4659][_0xb9d7('0x6d')]:'');}return _0x43c359+')';};var _0x49c036={'where':{'id':_0x4e65dc['id']}},_0xddcc93,_0x1194ed,_0x101a6d,_0x3013f5,_0x3ec83a;_0x49c036=_[_0xb9d7('0x6e')]({},_0x49c036,_0x39c1e8);return db[_0xb9d7('0x40')]['find'](_0x49c036)[_0xb9d7('0x22')](function(_0x4719dc){if(_0x4719dc){_0xddcc93=_0x4719dc;return _0x4719dc['getFields']();}return null;})[_0xb9d7('0x22')](function(_0x49df1e){if(_0x49df1e){if(!_0x49df1e['length']){throw new db[(_0xb9d7('0x70'))][(_0xb9d7('0x71'))](_0xb9d7('0x72'),0x193);}_0x1194ed=_0x49df1e;return db[_0xb9d7('0x89')][_0xb9d7('0x43')]({'raw':!![]});}return null;})[_0xb9d7('0x22')](function(_0x297a18){if(_0x297a18){_0x101a6d=_['keyBy'](_0x297a18,'id');var _0x4256da;var _0x491313=squel[_0xb9d7('0x8a')]();_0x491313['from'](_0xddcc93[_0xb9d7('0x80')]);for(var _0x576d61=0x0;_0x576d61<_0x1194ed[_0xb9d7('0x36')];_0x576d61+=0x1){_0x4256da=_0x1194ed[_0x576d61]['MetricId']?_0x101a6d[_0x1194ed[_0x576d61][_0xb9d7('0x8b')]][_0xb9d7('0x74')]:_0x1194ed[_0x576d61][_0xb9d7('0x6b')];_0x4256da=_0x1194ed[_0x576d61][_0xb9d7('0x75')]?_['replace'](_0x3798ec[_0x1194ed[_0x576d61][_0xb9d7('0x75')]],'%s',_0x4256da):_0x4256da;_0x4256da=_0x1194ed[_0x576d61]['format']?_[_0xb9d7('0x76')](_0xc594aa[_0x1194ed[_0x576d61][_0xb9d7('0x77')]],'%s',_0x4256da):_0x4256da;if(_0x1194ed[_0x576d61]['groupBy']){_0x491313[_0xb9d7('0x6a')](_0x4256da);}_0x1194ed[_0x576d61][_0xb9d7('0x79')]&&_0x491313[_0xb9d7('0x39')](_0x4256da,_0x1194ed[_0x576d61][_0xb9d7('0x79')]===_0xb9d7('0x7a')?![]:!![]);_0x491313[_0xb9d7('0x6b')](_0x4256da,_0x1194ed[_0x576d61][_0xb9d7('0x8c')]||_0x4256da);}if(_0xddcc93['joins']){_0xddcc93[_0xb9d7('0x7b')]=JSON[_0xb9d7('0x7c')](_0xddcc93[_0xb9d7('0x7b')]);for(var _0x2d52bc=0x0;_0x2d52bc<_0xddcc93[_0xb9d7('0x7b')][_0xb9d7('0x36')];_0x2d52bc+=0x1){if(_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x2e')]&&_[_0xb9d7('0x64')](_0x164c12,_0xddcc93['joins'][_0x2d52bc]['type'])&&_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc]['parentKey']&&_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x7e')]&&_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x7f')]){_0x491313[_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x2e')]](_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x7e')],null,util[_0xb9d7('0x77')]('%s.%s\x20=\x20%s.%s',_0xddcc93[_0xb9d7('0x80')],_0xddcc93['joins'][_0x2d52bc][_0xb9d7('0x7d')],_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc][_0xb9d7('0x7e')],_0xddcc93[_0xb9d7('0x7b')][_0x2d52bc]['foreignKey']));}}}if(_0xddcc93[_0xb9d7('0x81')]){_0xddcc93[_0xb9d7('0x81')]=JSON[_0xb9d7('0x7c')](_0xddcc93[_0xb9d7('0x81')]);_0x491313['where'](_0x560ee9(_0xddcc93[_0xb9d7('0x81')][_0xb9d7('0x6a')]));}_0x3ec83a=_0x491313[_0xb9d7('0x82')]();_0x491313[_0xb9d7('0x1b')](_0x45841c);_0x491313[_0xb9d7('0x1a')](0x0);return;}})[_0xb9d7('0x22')](function(){if(_0x4a3333[_0xb9d7('0x8d')]===_0xb9d7('0x8e')){return null;}var _0x25939c=_[_0xb9d7('0x6e')](_0x4a3333,{'name':_0x4a3333[_0xb9d7('0x8f')]||_0x4a3333[_0xb9d7('0x2a')]||_0xddcc93['name'],'basename':_0x20c0ea,'savename':util[_0xb9d7('0x77')](_0xb9d7('0x90'),_0x4a3333[_0xb9d7('0x2a')]||_0xddcc93[_0xb9d7('0x2a')],require(_0xb9d7('0x91'))[_0xb9d7('0x92')](0x4),_0x4a3333[_0xb9d7('0x8d')]||_0xb9d7('0x93')),'reportId':_0xddcc93['id'],'reportType':_0xb9d7('0x94')});return db[_0xb9d7('0x95')][_0xb9d7('0x49')](_0x25939c,{'raw':!![]});})['then'](function(_0x48a975){if(_0xddcc93[_0xb9d7('0x80')]===_0xb9d7('0x96')){_0x3ec83a[_0xb9d7('0x3c')](_0xddcc93['table']+_0xb9d7('0x97'),_0x4a3333[_0xb9d7('0x98')],_0x4a3333[_0xb9d7('0x99')]);}else{_0x3ec83a[_0xb9d7('0x3c')](_0xddcc93[_0xb9d7('0x80')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4a3333[_0xb9d7('0x98')],_0x4a3333[_0xb9d7('0x99')]);}if(_0x48a975){logger[_0xb9d7('0x9a')]('Run\x20Query:',_0x3ec83a[_0xb9d7('0x85')]());require(_0xb9d7('0x9b'))['fork'](path[_0xb9d7('0x56')](__dirname,_0xb9d7('0x9c'),_0x48a975[_0xb9d7('0x8d')]),[_0x48a975['id'],_0x3ec83a[_0xb9d7('0x85')](),path[_0xb9d7('0x56')](__dirname,_0xb9d7('0x9d'),_0x48a975[_0xb9d7('0x9e')]),_0x20c0ea]);return _0x48a975;}else{var _0x39317a=squel[_0xb9d7('0x8a')]();_0x39317a['from']('('+_0x3ec83a[_0xb9d7('0x85')]()+')','countTable');_0x39317a[_0xb9d7('0x6b')](_0xb9d7('0x9f'),_0xb9d7('0x1d'));_0x3ec83a['limit'](_0x4a3333[_0xb9d7('0x1b')]||_0x45841c);_0x3ec83a[_0xb9d7('0x1a')](_0x4a3333[_0xb9d7('0x1a')]||0x0);return dbH[_0xb9d7('0x84')][_0xb9d7('0x30')](_0x39317a['toString'](),{'type':dbH[_0xb9d7('0x84')][_0xb9d7('0x86')][_0xb9d7('0xa0')]})[_0xb9d7('0x22')](function(_0x12ca40){if(!_0x12ca40[_0xb9d7('0x36')]){_0x3013f5=0x0;}else{_0x3013f5=_0x12ca40[0x0][_0xb9d7('0x1d')]||0x0;}return dbH[_0xb9d7('0x84')]['query'](_0x3ec83a[_0xb9d7('0x85')](),{'type':dbH[_0xb9d7('0x84')][_0xb9d7('0x86')][_0xb9d7('0xa0')]});})['then'](function(_0xb11b15){return{'rows':_0xb11b15||[],'count':_0x3013f5};});}});}exports[_0xb9d7('0xa1')]=function(_0x31962b,_0x3ac274){return runReport(_0x31962b['params'],_0x31962b[_0xb9d7('0x30')],_0x31962b[_0xb9d7('0x3f')])[_0xb9d7('0x22')](respondWithResult(_0x3ac274,null))['catch'](handleError(_0x3ac274,null));};exports['runReport']=runReport;exports[_0xb9d7('0x30')]=function(_0x384b8f,_0xab44ac){var _0x1e56aa=0xa;var _0x292c87=[_0xb9d7('0x56'),_0xb9d7('0x57'),_0xb9d7('0x58'),'cross_join'];var _0x2dca97={'SUM':_0xb9d7('0xa2'),'COUNT':_0xb9d7('0x5a'),'COUNT DISTINCT':_0xb9d7('0x87'),'MAX':_0xb9d7('0x88'),'MIN':_0xb9d7('0x5b'),'AVG':_0xb9d7('0xa3'),'GROUP_CONCAT':_0xb9d7('0x5c'),'GROUP_CONCAT ASC':_0xb9d7('0x5d'),'GROUP_CONCAT DESC':_0xb9d7('0x5e')};var _0x184621={'SEC_TO_TIME':_0xb9d7('0x5f'),'DATE':_0xb9d7('0x60'),'HOUR':_0xb9d7('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb9d7('0x63')};var _0x71afaa=function(_0x4ba1b6){return!_[_0xb9d7('0x64')](['IS\x20NULL',_0xb9d7('0x65'),_0xb9d7('0x66'),_0xb9d7('0x67')],_0x4ba1b6);};var _0x2c1c1b=function(_0x5ecb7f){if(!_0x5ecb7f||!_0x5ecb7f[_0xb9d7('0x68')][_0xb9d7('0x36')]){return'';}for(var _0x4c829d='(',_0x4873a5=0x0;_0x4873a5<_0x5ecb7f[_0xb9d7('0x68')][_0xb9d7('0x36')];_0x4873a5+=0x1){_0x4873a5>0x0&&(_0x4c829d+='\x20'+_0x5ecb7f[_0xb9d7('0x69')]+'\x20');_0x4c829d+=_0x5ecb7f['rules'][_0x4873a5][_0xb9d7('0x6a')]?_0x2c1c1b(_0x5ecb7f['rules'][_0x4873a5][_0xb9d7('0x6a')]):_0x5ecb7f['rules'][_0x4873a5][_0xb9d7('0x6b')]+'\x20'+_0x5ecb7f['rules'][_0x4873a5][_0xb9d7('0x6c')]+(_0x71afaa(_0x5ecb7f[_0xb9d7('0x68')][_0x4873a5][_0xb9d7('0x6c')])?'\x20'+_0x5ecb7f[_0xb9d7('0x68')][_0x4873a5][_0xb9d7('0x6d')]:'');}return _0x4c829d+')';};var _0xcf1c76={'where':{'id':_0x384b8f[_0xb9d7('0x46')]['id']}},_0x11d091,_0x27989c,_0x443a31,_0x40e26b,_0x218bd5;_0xcf1c76=_['merge']({},_0xcf1c76,_0x384b8f[_0xb9d7('0x3f')]);return db['AnalyticCustomReport']['find'](_0xcf1c76)[_0xb9d7('0x22')](function(_0x9b2aae){if(_0x9b2aae){_0x11d091=_0x9b2aae;return _0x9b2aae[_0xb9d7('0x6f')]();}return null;})[_0xb9d7('0x22')](function(_0x5efa02){if(_0x5efa02){if(!_0x5efa02['length']){throw new db[(_0xb9d7('0x70'))][(_0xb9d7('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27989c=_0x5efa02;return db[_0xb9d7('0x89')][_0xb9d7('0x43')]({'raw':!![]});}return null;})['then'](function(_0x598b59){if(_0x598b59){_0x443a31=_['keyBy'](_0x598b59,'id');var _0x19cc3e;var _0x519d40=squel[_0xb9d7('0x8a')]();_0x519d40[_0xb9d7('0x73')](_0x11d091[_0xb9d7('0x80')]);for(var _0x5f00c3=0x0;_0x5f00c3<_0x27989c[_0xb9d7('0x36')];_0x5f00c3+=0x1){_0x19cc3e=_0x27989c[_0x5f00c3][_0xb9d7('0x8b')]?_0x443a31[_0x27989c[_0x5f00c3][_0xb9d7('0x8b')]][_0xb9d7('0x74')]:_0x27989c[_0x5f00c3][_0xb9d7('0x6b')];_0x19cc3e=_0x27989c[_0x5f00c3][_0xb9d7('0x75')]?_[_0xb9d7('0x76')](_0x2dca97[_0x27989c[_0x5f00c3][_0xb9d7('0x75')]],'%s',_0x19cc3e):_0x19cc3e;_0x19cc3e=_0x27989c[_0x5f00c3][_0xb9d7('0x77')]?_['replace'](_0x184621[_0x27989c[_0x5f00c3][_0xb9d7('0x77')]],'%s',_0x19cc3e):_0x19cc3e;if(_0x27989c[_0x5f00c3][_0xb9d7('0x78')]){_0x519d40[_0xb9d7('0x6a')](_0x19cc3e);}_0x27989c[_0x5f00c3][_0xb9d7('0x79')]&&_0x519d40['order'](_0x19cc3e,_0x27989c[_0x5f00c3][_0xb9d7('0x79')]==='DESC'?![]:!![]);_0x519d40[_0xb9d7('0x6b')](_0x19cc3e,_0x27989c[_0x5f00c3][_0xb9d7('0x8c')]||_0x19cc3e);}if(_0x11d091['joins']){_0x11d091[_0xb9d7('0x7b')]=JSON[_0xb9d7('0x7c')](_0x11d091[_0xb9d7('0x7b')]);for(var _0x2cfc67=0x0;_0x2cfc67<_0x11d091[_0xb9d7('0x7b')]['length'];_0x2cfc67+=0x1){if(_0x11d091[_0xb9d7('0x7b')][_0x2cfc67]['type']&&_['includes'](_0x292c87,_0x11d091[_0xb9d7('0x7b')][_0x2cfc67][_0xb9d7('0x2e')])&&_0x11d091[_0xb9d7('0x7b')][_0x2cfc67][_0xb9d7('0x7d')]&&_0x11d091['joins'][_0x2cfc67][_0xb9d7('0x7e')]&&_0x11d091[_0xb9d7('0x7b')][_0x2cfc67][_0xb9d7('0x7f')]){_0x519d40[_0x11d091[_0xb9d7('0x7b')][_0x2cfc67][_0xb9d7('0x2e')]](_0x11d091[_0xb9d7('0x7b')][_0x2cfc67]['foreignTable'],null,util[_0xb9d7('0x77')](_0xb9d7('0xa4'),_0x11d091[_0xb9d7('0x80')],_0x11d091['joins'][_0x2cfc67][_0xb9d7('0x7d')],_0x11d091['joins'][_0x2cfc67][_0xb9d7('0x7e')],_0x11d091[_0xb9d7('0x7b')][_0x2cfc67][_0xb9d7('0x7f')]));}}}if(_0x11d091[_0xb9d7('0x81')]){_0x11d091[_0xb9d7('0x81')]=JSON[_0xb9d7('0x7c')](_0x11d091[_0xb9d7('0x81')]);_0x519d40[_0xb9d7('0x3c')](_0x2c1c1b(_0x11d091[_0xb9d7('0x81')][_0xb9d7('0x6a')]));}_0x218bd5=_0x519d40[_0xb9d7('0x82')]();_0x519d40['limit'](_0x1e56aa);_0x519d40[_0xb9d7('0x1a')](0x0);logger[_0xb9d7('0xa5')](_0xb9d7('0x83'),_0x519d40[_0xb9d7('0x85')]());return dbH[_0xb9d7('0x84')][_0xb9d7('0x30')](_0x519d40[_0xb9d7('0x85')](),{'type':dbH['sequelize'][_0xb9d7('0x86')][_0xb9d7('0xa0')]});}})[_0xb9d7('0x22')](function(){return{'sql':_0x218bd5[_0xb9d7('0x85')]()};})[_0xb9d7('0x22')](respondWithResult(_0xab44ac,null))[_0xb9d7('0x44')](handleError(_0xab44ac,null));}; \ No newline at end of file +var _0x9749=['fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','parse','output','fullPath','%s-%s.%s','randomstring','generate','custom','cdr','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','keyBy','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs'];(function(_0x122e37,_0x25bb79){var _0x4fde96=function(_0x27793b){while(--_0x27793b){_0x122e37['push'](_0x122e37['shift']());}};_0x4fde96(++_0x25bb79);}(_0x9749,0x1e4));var _0x9974=function(_0x67505a,_0x24620e){_0x67505a=_0x67505a-0x0;var _0x27378e=_0x9749[_0x67505a];return _0x27378e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9974('0x0'));var zipdir=require(_0x9974('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9974('0x2'));var moment=require(_0x9974('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9974('0x4'));var path=require('path');var sox=require(_0x9974('0x5'));var csv=require(_0x9974('0x6'));var ejs=require(_0x9974('0x7'));var fs=require('fs');var fs_extra=require(_0x9974('0x8'));var _=require(_0x9974('0x9'));var squel=require(_0x9974('0xa'));var crypto=require('crypto');var jsforce=require(_0x9974('0xb'));var deskjs=require(_0x9974('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9974('0xd'));var Papa=require('papaparse');var Redis=require(_0x9974('0xe'));var authService=require(_0x9974('0xf'));var qs=require(_0x9974('0x10'));var as=require(_0x9974('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9974('0x12'))('api');var utils=require(_0x9974('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9974('0x14'))['db'];var dbH=require('../../mysqldb')[_0x9974('0x15')];function respondWithStatusCode(_0x59455f,_0x493030){_0x493030=_0x493030||0xcc;return function(_0x1d7749){if(_0x1d7749){return _0x59455f['sendStatus'](_0x493030);}return _0x59455f[_0x9974('0x16')](_0x493030)['end']();};}function respondWithResult(_0xde7754,_0x242757){_0x242757=_0x242757||0xc8;return function(_0xaec946){if(_0xaec946){return _0xde7754[_0x9974('0x16')](_0x242757)[_0x9974('0x17')](_0xaec946);}};}function respondWithFilteredResult(_0x27b3f8,_0x469afa){return function(_0x492262){if(_0x492262){var _0x509ecf=typeof _0x469afa[_0x9974('0x18')]===_0x9974('0x19')&&typeof _0x469afa['limit']===_0x9974('0x19');var _0x563773=_0x492262['count'];var _0xf56f3=_0x509ecf?0x0:_0x469afa[_0x9974('0x18')];var _0x558b60=_0x509ecf?_0x492262[_0x9974('0x1a')]:_0x469afa[_0x9974('0x18')]+_0x469afa[_0x9974('0x1b')];var _0x255f16;if(_0x558b60>=_0x563773){_0x558b60=_0x563773;_0x255f16=0xc8;}else{_0x255f16=0xce;}_0x27b3f8[_0x9974('0x16')](_0x255f16);return _0x27b3f8[_0x9974('0x1c')](_0x9974('0x1d'),_0xf56f3+'-'+_0x558b60+'/'+_0x563773)[_0x9974('0x17')](_0x492262);}return null;};}function patchUpdates(_0x3229e1){return function(_0x4f3a7c){try{jsonpatch[_0x9974('0x1e')](_0x4f3a7c,_0x3229e1,!![]);}catch(_0x4d67aa){return BPromise[_0x9974('0x1f')](_0x4d67aa);}return _0x4f3a7c[_0x9974('0x20')]();};}function saveUpdates(_0x148ab3,_0x16943e){return function(_0x4a0a31){if(_0x4a0a31){return _0x4a0a31[_0x9974('0x21')](_0x148ab3)[_0x9974('0x22')](function(_0x45fd3a){return _0x45fd3a;});}return null;};}function removeEntity(_0x36d2e0,_0x328026){return function(_0x4db5e8){if(_0x4db5e8){return _0x4db5e8[_0x9974('0x23')]()[_0x9974('0x22')](function(){var _0x323f97=_0x4db5e8[_0x9974('0x24')]({'plain':!![]});var _0x464e4a=_0x9974('0x25');return db[_0x9974('0x26')][_0x9974('0x23')]({'where':{'type':_0x464e4a,'resourceId':_0x323f97['id']}})[_0x9974('0x22')](function(){return _0x4db5e8;});})[_0x9974('0x22')](function(){_0x36d2e0[_0x9974('0x16')](0xcc)[_0x9974('0x27')]();});}};}function handleEntityNotFound(_0x97c47,_0x2dce50){return function(_0x29568c){if(!_0x29568c){_0x97c47[_0x9974('0x28')](0x194);}return _0x29568c;};}function handleError(_0x31690c,_0x52f101){_0x52f101=_0x52f101||0x1f4;return function(_0x19b6d3){logger[_0x9974('0x29')](_0x19b6d3[_0x9974('0x2a')]);if(_0x19b6d3[_0x9974('0x2b')]){delete _0x19b6d3[_0x9974('0x2b')];}_0x31690c[_0x9974('0x16')](_0x52f101)[_0x9974('0x2c')](_0x19b6d3);};}exports[_0x9974('0x2d')]=function(_0x59ad5d,_0x2e677e){var _0x34cb32={},_0x5e5203={},_0x3a72a7={'count':0x0,'rows':[]};var _0x530c8f=_[_0x9974('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x33a04f){return{'name':_0x33a04f[_0x9974('0x2f')],'type':_0x33a04f[_0x9974('0x30')][_0x9974('0x31')]};});_0x5e5203[_0x9974('0x32')]=_[_0x9974('0x2e')](_0x530c8f,'name');_0x5e5203[_0x9974('0x33')]=_[_0x9974('0x34')](_0x59ad5d['query']);_0x5e5203[_0x9974('0x35')]=_[_0x9974('0x36')](_0x5e5203[_0x9974('0x32')],_0x5e5203[_0x9974('0x33')]);_0x34cb32[_0x9974('0x37')]=_['intersection'](_0x5e5203['model'],qs['fields'](_0x59ad5d[_0x9974('0x33')][_0x9974('0x38')]));_0x34cb32['attributes']=_0x34cb32['attributes'][_0x9974('0x39')]?_0x34cb32['attributes']:_0x5e5203['model'];if(!_0x59ad5d[_0x9974('0x33')][_0x9974('0x3a')](_0x9974('0x3b'))){_0x34cb32[_0x9974('0x1b')]=qs['limit'](_0x59ad5d[_0x9974('0x33')]['limit']);_0x34cb32['offset']=qs[_0x9974('0x18')](_0x59ad5d[_0x9974('0x33')][_0x9974('0x18')]);}_0x34cb32[_0x9974('0x3c')]=qs[_0x9974('0x3d')](_0x59ad5d['query'][_0x9974('0x3d')]);_0x34cb32['where']=qs[_0x9974('0x35')](_[_0x9974('0x3e')](_0x59ad5d['query'],_0x5e5203[_0x9974('0x35')]),_0x530c8f);if(_0x59ad5d[_0x9974('0x33')][_0x9974('0x3f')]){_0x34cb32['where']=_['merge'](_0x34cb32[_0x9974('0x40')],{'$or':_[_0x9974('0x2e')](_0x530c8f,function(_0x1dc1a8){if(_0x1dc1a8[_0x9974('0x30')]!==_0x9974('0x41')){var _0x5205dd={};_0x5205dd[_0x1dc1a8[_0x9974('0x2b')]]={'$like':'%'+_0x59ad5d[_0x9974('0x33')][_0x9974('0x3f')]+'%'};return _0x5205dd;}})});}_0x34cb32=_[_0x9974('0x42')]({},_0x34cb32,_0x59ad5d[_0x9974('0x43')]);var _0x270ac2={'where':_0x34cb32[_0x9974('0x40')]};return db[_0x9974('0x44')][_0x9974('0x1a')](_0x270ac2)[_0x9974('0x22')](function(_0x44d0d6){_0x3a72a7[_0x9974('0x1a')]=_0x44d0d6;if(_0x59ad5d[_0x9974('0x33')][_0x9974('0x45')]){_0x34cb32[_0x9974('0x46')]=[{'all':!![]}];}return db[_0x9974('0x44')][_0x9974('0x47')](_0x34cb32);})[_0x9974('0x22')](function(_0x9c8be7){_0x3a72a7[_0x9974('0x48')]=_0x9c8be7;return _0x3a72a7;})[_0x9974('0x22')](respondWithFilteredResult(_0x2e677e,_0x34cb32))[_0x9974('0x49')](handleError(_0x2e677e,null));};exports[_0x9974('0x4a')]=function(_0x404864,_0x1ac6f3){var _0x1c9f38={'raw':![],'where':{'id':_0x404864[_0x9974('0x4b')]['id']}},_0x104cb7={};_0x104cb7['model']=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x104cb7[_0x9974('0x33')]=_[_0x9974('0x34')](_0x404864[_0x9974('0x33')]);_0x104cb7[_0x9974('0x35')]=_[_0x9974('0x36')](_0x104cb7[_0x9974('0x32')],_0x104cb7['query']);_0x1c9f38[_0x9974('0x37')]=_[_0x9974('0x36')](_0x104cb7[_0x9974('0x32')],qs[_0x9974('0x38')](_0x404864[_0x9974('0x33')][_0x9974('0x38')]));_0x1c9f38[_0x9974('0x37')]=_0x1c9f38[_0x9974('0x37')][_0x9974('0x39')]?_0x1c9f38[_0x9974('0x37')]:_0x104cb7[_0x9974('0x32')];if(_0x404864[_0x9974('0x33')]['includeAll']){_0x1c9f38['include']=[{'all':!![]}];}_0x1c9f38=_['merge']({},_0x1c9f38,_0x404864[_0x9974('0x43')]);return db[_0x9974('0x44')][_0x9974('0x4c')](_0x1c9f38)['then'](handleEntityNotFound(_0x1ac6f3,null))[_0x9974('0x22')](respondWithResult(_0x1ac6f3,null))[_0x9974('0x49')](handleError(_0x1ac6f3,null));};exports[_0x9974('0x4d')]=function(_0xb3b44a,_0xbd772b){return db[_0x9974('0x44')][_0x9974('0x4d')](_0xb3b44a[_0x9974('0x4e')],{})[_0x9974('0x22')](function(_0x2fd551){var _0x52ef66=_0xb3b44a[_0x9974('0x4f')]['get']({'plain':!![]});if(!_0x52ef66)throw new Error(_0x9974('0x50'));if(_0x52ef66[_0x9974('0x51')]===_0x9974('0x4f')){var _0x47d2cf=_0x2fd551[_0x9974('0x24')]({'plain':!![]});var _0x4eaea7=_0x9974('0x52');return db[_0x9974('0x53')][_0x9974('0x4c')]({'where':{'name':_0x4eaea7,'userProfileId':_0x52ef66[_0x9974('0x54')]},'raw':!![]})[_0x9974('0x22')](function(_0x1e68fc){if(_0x1e68fc&&_0x1e68fc[_0x9974('0x55')]===0x0){return db['UserProfileResource'][_0x9974('0x4d')]({'name':_0x47d2cf['name'],'resourceId':_0x47d2cf['id'],'type':_0x9974('0x25'),'sectionId':_0x1e68fc['id']},{})[_0x9974('0x22')](function(){return _0x2fd551;});}else{return _0x2fd551;}})[_0x9974('0x49')](function(_0x47559f){logger[_0x9974('0x29')](_0x9974('0x56'),_0x47559f);throw _0x47559f;});}return _0x2fd551;})[_0x9974('0x22')](respondWithResult(_0xbd772b,0xc9))[_0x9974('0x49')](handleError(_0xbd772b,null));};exports['update']=function(_0x5ed80d,_0x3105af){if(_0x5ed80d[_0x9974('0x4e')]['id']){delete _0x5ed80d['body']['id'];}return db['AnalyticCustomReport'][_0x9974('0x4c')]({'where':{'id':_0x5ed80d[_0x9974('0x4b')]['id']}})[_0x9974('0x22')](handleEntityNotFound(_0x3105af,null))[_0x9974('0x22')](saveUpdates(_0x5ed80d[_0x9974('0x4e')],null))['then'](respondWithResult(_0x3105af,null))[_0x9974('0x49')](handleError(_0x3105af,null));};exports[_0x9974('0x23')]=function(_0x3ae18e,_0x325e84){return db[_0x9974('0x44')][_0x9974('0x4c')]({'where':{'id':_0x3ae18e[_0x9974('0x4b')]['id']}})[_0x9974('0x22')](handleEntityNotFound(_0x325e84,null))[_0x9974('0x22')](removeEntity(_0x325e84,null))[_0x9974('0x49')](handleError(_0x325e84,null));};exports['preview']=function(_0x4b92c6,_0x5ca087){var _0x1f625f=0xa;var _0x3ba342=[_0x9974('0x57'),_0x9974('0x58'),'right_join',_0x9974('0x59')];var _0x39335d={'SUM':_0x9974('0x5a'),'COUNT':_0x9974('0x5b'),'COUNT DISTINCT':_0x9974('0x5c'),'MAX':_0x9974('0x5d'),'MIN':_0x9974('0x5e'),'AVG':_0x9974('0x5f'),'GROUP_CONCAT':_0x9974('0x60'),'GROUP_CONCAT ASC':_0x9974('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x399874={'SEC_TO_TIME':_0x9974('0x62'),'DATE':_0x9974('0x63'),'HOUR':_0x9974('0x64'),'ROUND':_0x9974('0x65'),'UNIX_TIMESTAMP':_0x9974('0x66')};var _0x50969e=function(_0x4407f7){return!_[_0x9974('0x67')]([_0x9974('0x68'),_0x9974('0x69'),_0x9974('0x6a'),_0x9974('0x6b')],_0x4407f7);};var _0x225a99=function(_0x1294e0){if(!_0x1294e0||!_0x1294e0['rules'][_0x9974('0x39')]){return'';}for(var _0x4653da='(',_0x558255=0x0;_0x558255<_0x1294e0[_0x9974('0x6c')][_0x9974('0x39')];_0x558255+=0x1){_0x558255>0x0&&(_0x4653da+='\x20'+_0x1294e0[_0x9974('0x6d')]+'\x20');_0x4653da+=_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x6e')]?_0x225a99(_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x6e')]):_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x6f')]+'\x20'+_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x70')]+(_0x50969e(_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x70')])?'\x20'+_0x1294e0[_0x9974('0x6c')][_0x558255][_0x9974('0x71')]:'');}return _0x4653da+')';};var _0x1d43f5={'where':{'id':_0x4b92c6[_0x9974('0x4b')]['id']}},_0x476e23,_0x2d757a,_0x466642,_0x381eab,_0x37154d;_0x1d43f5=_[_0x9974('0x42')]({},_0x1d43f5,_0x4b92c6['options']);return db[_0x9974('0x44')][_0x9974('0x4c')](_0x1d43f5)[_0x9974('0x22')](function(_0x279cc5){if(_0x279cc5){_0x476e23=_0x279cc5;return _0x279cc5[_0x9974('0x72')]();}return null;})[_0x9974('0x22')](function(_0x4c1591){if(_0x4c1591){if(!_0x4c1591['length']){throw new db[(_0x9974('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d757a=_0x4c1591;return db[_0x9974('0x74')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x23b5a8){if(_0x23b5a8){_0x466642=_['keyBy'](_0x23b5a8,'id');var _0x24ce7d;var _0x144a6d=squel[_0x9974('0x75')]();_0x144a6d[_0x9974('0x76')](_0x476e23[_0x9974('0x77')]);for(var _0x198572=0x0;_0x198572<_0x2d757a[_0x9974('0x39')];_0x198572+=0x1){_0x24ce7d=_0x2d757a[_0x198572][_0x9974('0x78')]?_0x466642[_0x2d757a[_0x198572][_0x9974('0x78')]]['metric']:_0x2d757a[_0x198572][_0x9974('0x6f')];_0x24ce7d=_0x2d757a[_0x198572]['function']?_[_0x9974('0x79')](_0x39335d[_0x2d757a[_0x198572][_0x9974('0x7a')]],'%s',_0x24ce7d):_0x24ce7d;_0x24ce7d=_0x2d757a[_0x198572][_0x9974('0x7b')]?_[_0x9974('0x79')](_0x399874[_0x2d757a[_0x198572][_0x9974('0x7b')]],'%s',_0x24ce7d):_0x24ce7d;if(_0x2d757a[_0x198572][_0x9974('0x7c')]){_0x144a6d[_0x9974('0x6e')](_0x24ce7d);}_0x2d757a[_0x198572]['orderBy']&&_0x144a6d['order'](_0x24ce7d,_0x2d757a[_0x198572][_0x9974('0x7d')]===_0x9974('0x7e')?![]:!![]);_0x144a6d[_0x9974('0x6f')](_0x24ce7d,_0x2d757a[_0x198572][_0x9974('0x7f')]||_0x24ce7d);}if(_0x476e23['joins']){_0x476e23[_0x9974('0x80')]=JSON['parse'](_0x476e23['joins']);for(var _0x53e131=0x0;_0x53e131<_0x476e23[_0x9974('0x80')][_0x9974('0x39')];_0x53e131+=0x1){if(_0x476e23['joins'][_0x53e131][_0x9974('0x30')]&&_[_0x9974('0x67')](_0x3ba342,_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x30')])&&_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x81')]&&_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x82')]&&_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x83')]){_0x144a6d[_0x476e23['joins'][_0x53e131][_0x9974('0x30')]](_0x476e23[_0x9974('0x80')][_0x53e131]['foreignTable'],null,util['format'](_0x9974('0x84'),_0x476e23['table'],_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x81')],_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x82')],_0x476e23[_0x9974('0x80')][_0x53e131][_0x9974('0x83')]));}}}if(_0x476e23['conditions']){_0x476e23[_0x9974('0x85')]=JSON['parse'](_0x476e23['conditions']);_0x144a6d['where'](_0x225a99(_0x476e23['conditions'][_0x9974('0x6e')]));}_0x37154d=_0x144a6d[_0x9974('0x86')]();_0x144a6d['limit'](_0x1f625f);_0x144a6d[_0x9974('0x18')](0x0);logger[_0x9974('0x87')](_0x9974('0x88'),_0x144a6d[_0x9974('0x89')]());return dbH['sequelize'][_0x9974('0x33')](_0x144a6d[_0x9974('0x89')](),{'type':dbH[_0x9974('0x8a')][_0x9974('0x8b')][_0x9974('0x8c')]});}})['then'](respondWithResult(_0x5ca087,null))[_0x9974('0x49')](handleError(_0x5ca087,null));};function runReport(_0x8680e3,_0x991835,_0x5762a3){var _0x1bc2f9=_0x991835[_0x9974('0x2b')];var _0x28cdcf=0xa;var _0x23e2ce=['join','left_join',_0x9974('0x8d'),'cross_join'];var _0x3a2056={'SUM':'SUM(%s)','COUNT':_0x9974('0x5b'),'COUNT DISTINCT':_0x9974('0x5c'),'MAX':_0x9974('0x5d'),'MIN':_0x9974('0x5e'),'AVG':_0x9974('0x5f'),'GROUP_CONCAT':_0x9974('0x60'),'GROUP_CONCAT ASC':_0x9974('0x61'),'GROUP_CONCAT DESC':_0x9974('0x8e')};var _0x4b2c01={'SEC_TO_TIME':_0x9974('0x62'),'DATE':_0x9974('0x63'),'HOUR':_0x9974('0x64'),'ROUND':_0x9974('0x65'),'UNIX_TIMESTAMP':_0x9974('0x66')};var _0x103f67=function(_0x3ae2ab){return!_[_0x9974('0x67')]([_0x9974('0x68'),_0x9974('0x69'),_0x9974('0x6a'),_0x9974('0x6b')],_0x3ae2ab);};var _0x13d378=function(_0x5ea14c){if(!_0x5ea14c||!_0x5ea14c[_0x9974('0x6c')][_0x9974('0x39')]){return'';}for(var _0x4a7a8b='(',_0x37894f=0x0;_0x37894f<_0x5ea14c['rules'][_0x9974('0x39')];_0x37894f+=0x1){_0x37894f>0x0&&(_0x4a7a8b+='\x20'+_0x5ea14c[_0x9974('0x6d')]+'\x20');_0x4a7a8b+=_0x5ea14c[_0x9974('0x6c')][_0x37894f][_0x9974('0x6e')]?_0x13d378(_0x5ea14c[_0x9974('0x6c')][_0x37894f]['group']):_0x5ea14c[_0x9974('0x6c')][_0x37894f][_0x9974('0x6f')]+'\x20'+_0x5ea14c['rules'][_0x37894f][_0x9974('0x70')]+(_0x103f67(_0x5ea14c['rules'][_0x37894f][_0x9974('0x70')])?'\x20'+_0x5ea14c[_0x9974('0x6c')][_0x37894f][_0x9974('0x71')]:'');}return _0x4a7a8b+')';};var _0x42d73b={'where':{'id':_0x8680e3['id']}},_0x251e5e,_0x480151,_0x328ab0,_0x51707a,_0x219c94;_0x42d73b=_['merge']({},_0x42d73b,_0x5762a3);return db[_0x9974('0x44')][_0x9974('0x4c')](_0x42d73b)['then'](function(_0x40779e){if(_0x40779e){_0x251e5e=_0x40779e;return _0x40779e['getFields']();}return null;})[_0x9974('0x22')](function(_0x4ea323){if(_0x4ea323){if(!_0x4ea323[_0x9974('0x39')]){throw new db['Sequelize'][(_0x9974('0x8f'))](_0x9974('0x90'),0x193);}_0x480151=_0x4ea323;return db[_0x9974('0x74')][_0x9974('0x47')]({'raw':!![]});}return null;})['then'](function(_0x5b2be7){if(_0x5b2be7){_0x328ab0=_['keyBy'](_0x5b2be7,'id');var _0x1a6c45;var _0x1098ae=squel[_0x9974('0x75')]();_0x1098ae['from'](_0x251e5e['table']);for(var _0x88502e=0x0;_0x88502e<_0x480151['length'];_0x88502e+=0x1){_0x1a6c45=_0x480151[_0x88502e][_0x9974('0x78')]?_0x328ab0[_0x480151[_0x88502e][_0x9974('0x78')]]['metric']:_0x480151[_0x88502e][_0x9974('0x6f')];_0x1a6c45=_0x480151[_0x88502e][_0x9974('0x7a')]?_['replace'](_0x3a2056[_0x480151[_0x88502e][_0x9974('0x7a')]],'%s',_0x1a6c45):_0x1a6c45;_0x1a6c45=_0x480151[_0x88502e][_0x9974('0x7b')]?_[_0x9974('0x79')](_0x4b2c01[_0x480151[_0x88502e][_0x9974('0x7b')]],'%s',_0x1a6c45):_0x1a6c45;if(_0x480151[_0x88502e][_0x9974('0x7c')]){_0x1098ae['group'](_0x1a6c45);}_0x480151[_0x88502e]['orderBy']&&_0x1098ae[_0x9974('0x3c')](_0x1a6c45,_0x480151[_0x88502e][_0x9974('0x7d')]===_0x9974('0x7e')?![]:!![]);_0x1098ae[_0x9974('0x6f')](_0x1a6c45,_0x480151[_0x88502e][_0x9974('0x7f')]||_0x1a6c45);}if(_0x251e5e[_0x9974('0x80')]){_0x251e5e['joins']=JSON[_0x9974('0x91')](_0x251e5e[_0x9974('0x80')]);for(var _0x53c2f4=0x0;_0x53c2f4<_0x251e5e[_0x9974('0x80')][_0x9974('0x39')];_0x53c2f4+=0x1){if(_0x251e5e['joins'][_0x53c2f4][_0x9974('0x30')]&&_['includes'](_0x23e2ce,_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x30')])&&_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x81')]&&_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x82')]&&_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x83')]){_0x1098ae[_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x30')]](_0x251e5e['joins'][_0x53c2f4][_0x9974('0x82')],null,util[_0x9974('0x7b')](_0x9974('0x84'),_0x251e5e['table'],_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x81')],_0x251e5e[_0x9974('0x80')][_0x53c2f4]['foreignTable'],_0x251e5e[_0x9974('0x80')][_0x53c2f4][_0x9974('0x83')]));}}}if(_0x251e5e[_0x9974('0x85')]){_0x251e5e['conditions']=JSON[_0x9974('0x91')](_0x251e5e[_0x9974('0x85')]);_0x1098ae[_0x9974('0x40')](_0x13d378(_0x251e5e[_0x9974('0x85')]['group']));}_0x219c94=_0x1098ae[_0x9974('0x86')]();_0x1098ae[_0x9974('0x1b')](_0x28cdcf);_0x1098ae[_0x9974('0x18')](0x0);return;}})[_0x9974('0x22')](function(){if(_0x991835[_0x9974('0x92')]==='web'){return null;}var _0x564bd9=_['merge'](_0x991835,{'name':_0x991835[_0x9974('0x93')]||_0x991835[_0x9974('0x2b')]||_0x251e5e[_0x9974('0x2b')],'basename':_0x1bc2f9,'savename':util[_0x9974('0x7b')](_0x9974('0x94'),_0x991835['name']||_0x251e5e[_0x9974('0x2b')],require(_0x9974('0x95'))[_0x9974('0x96')](0x4),_0x991835[_0x9974('0x92')]||'csv'),'reportId':_0x251e5e['id'],'reportType':_0x9974('0x97')});return db['AnalyticExtractedReport'][_0x9974('0x4d')](_0x564bd9,{'raw':!![]});})[_0x9974('0x22')](function(_0x2fffca){if(_0x251e5e[_0x9974('0x77')]===_0x9974('0x98')){_0x219c94[_0x9974('0x40')](_0x251e5e['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x991835['startDate'],_0x991835[_0x9974('0x99')]);}else{_0x219c94['where'](_0x251e5e[_0x9974('0x77')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x991835['startDate'],_0x991835[_0x9974('0x99')]);}if(_0x2fffca){logger[_0x9974('0x9a')](_0x9974('0x9b'),_0x219c94[_0x9974('0x89')]());require('child_process')[_0x9974('0x9c')](path[_0x9974('0x57')](__dirname,_0x9974('0x9d'),_0x2fffca[_0x9974('0x92')]),[_0x2fffca['id'],_0x219c94[_0x9974('0x89')](),path['join'](__dirname,_0x9974('0x9e'),_0x2fffca[_0x9974('0x9f')]),_0x1bc2f9]);return _0x2fffca;}else{var _0x5b324d=squel[_0x9974('0x75')]();_0x5b324d['from']('('+_0x219c94[_0x9974('0x89')]()+')','countTable');_0x5b324d[_0x9974('0x6f')](_0x9974('0xa0'),'count');_0x219c94['limit'](_0x991835['limit']||_0x28cdcf);_0x219c94[_0x9974('0x18')](_0x991835[_0x9974('0x18')]||0x0);return dbH[_0x9974('0x8a')][_0x9974('0x33')](_0x5b324d[_0x9974('0x89')](),{'type':dbH[_0x9974('0x8a')][_0x9974('0x8b')][_0x9974('0x8c')]})[_0x9974('0x22')](function(_0x6eb2fa){if(!_0x6eb2fa[_0x9974('0x39')]){_0x51707a=0x0;}else{_0x51707a=_0x6eb2fa[0x0][_0x9974('0x1a')]||0x0;}return dbH['sequelize'][_0x9974('0x33')](_0x219c94['toString'](),{'type':dbH[_0x9974('0x8a')][_0x9974('0x8b')]['SELECT']});})[_0x9974('0x22')](function(_0x577fa9){return{'rows':_0x577fa9||[],'count':_0x51707a};});}});}exports[_0x9974('0xa1')]=function(_0x283c41,_0x3f1887){return runReport(_0x283c41['params'],_0x283c41[_0x9974('0x33')],_0x283c41[_0x9974('0x43')])[_0x9974('0x22')](respondWithResult(_0x3f1887,null))[_0x9974('0x49')](handleError(_0x3f1887,null));};exports[_0x9974('0xa2')]=runReport;exports['query']=function(_0x175258,_0x245f3f){var _0x594d9c=0xa;var _0x3ee833=[_0x9974('0x57'),_0x9974('0x58'),_0x9974('0x8d'),'cross_join'];var _0x318f47={'SUM':_0x9974('0x5a'),'COUNT':_0x9974('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9974('0x5d'),'MIN':_0x9974('0x5e'),'AVG':_0x9974('0x5f'),'GROUP_CONCAT':_0x9974('0x60'),'GROUP_CONCAT ASC':_0x9974('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c4fda={'SEC_TO_TIME':_0x9974('0x62'),'DATE':_0x9974('0x63'),'HOUR':_0x9974('0x64'),'ROUND':_0x9974('0x65'),'UNIX_TIMESTAMP':_0x9974('0x66')};var _0x4749f9=function(_0x4b418d){return!_[_0x9974('0x67')](['IS\x20NULL',_0x9974('0x69'),'IS\x20EMPTY',_0x9974('0x6b')],_0x4b418d);};var _0x57bc4a=function(_0x3eb858){if(!_0x3eb858||!_0x3eb858[_0x9974('0x6c')][_0x9974('0x39')]){return'';}for(var _0x2b5a15='(',_0x1cd5fd=0x0;_0x1cd5fd<_0x3eb858[_0x9974('0x6c')][_0x9974('0x39')];_0x1cd5fd+=0x1){_0x1cd5fd>0x0&&(_0x2b5a15+='\x20'+_0x3eb858[_0x9974('0x6d')]+'\x20');_0x2b5a15+=_0x3eb858[_0x9974('0x6c')][_0x1cd5fd][_0x9974('0x6e')]?_0x57bc4a(_0x3eb858[_0x9974('0x6c')][_0x1cd5fd]['group']):_0x3eb858[_0x9974('0x6c')][_0x1cd5fd][_0x9974('0x6f')]+'\x20'+_0x3eb858[_0x9974('0x6c')][_0x1cd5fd][_0x9974('0x70')]+(_0x4749f9(_0x3eb858['rules'][_0x1cd5fd][_0x9974('0x70')])?'\x20'+_0x3eb858[_0x9974('0x6c')][_0x1cd5fd][_0x9974('0x71')]:'');}return _0x2b5a15+')';};var _0x14070f={'where':{'id':_0x175258[_0x9974('0x4b')]['id']}},_0x3579ba,_0xd138f2,_0x16296c,_0x39418b,_0x6c64cf;_0x14070f=_[_0x9974('0x42')]({},_0x14070f,_0x175258[_0x9974('0x43')]);return db[_0x9974('0x44')][_0x9974('0x4c')](_0x14070f)[_0x9974('0x22')](function(_0x12d497){if(_0x12d497){_0x3579ba=_0x12d497;return _0x12d497[_0x9974('0x72')]();}return null;})['then'](function(_0x4954d6){if(_0x4954d6){if(!_0x4954d6['length']){throw new db[(_0x9974('0x73'))][(_0x9974('0x8f'))](_0x9974('0x90'),0x193);}_0xd138f2=_0x4954d6;return db[_0x9974('0x74')][_0x9974('0x47')]({'raw':!![]});}return null;})[_0x9974('0x22')](function(_0x45ee14){if(_0x45ee14){_0x16296c=_[_0x9974('0xa3')](_0x45ee14,'id');var _0x27c824;var _0x1d75b6=squel[_0x9974('0x75')]();_0x1d75b6['from'](_0x3579ba[_0x9974('0x77')]);for(var _0x4ab740=0x0;_0x4ab740<_0xd138f2['length'];_0x4ab740+=0x1){_0x27c824=_0xd138f2[_0x4ab740][_0x9974('0x78')]?_0x16296c[_0xd138f2[_0x4ab740]['MetricId']]['metric']:_0xd138f2[_0x4ab740][_0x9974('0x6f')];_0x27c824=_0xd138f2[_0x4ab740][_0x9974('0x7a')]?_['replace'](_0x318f47[_0xd138f2[_0x4ab740][_0x9974('0x7a')]],'%s',_0x27c824):_0x27c824;_0x27c824=_0xd138f2[_0x4ab740][_0x9974('0x7b')]?_['replace'](_0x5c4fda[_0xd138f2[_0x4ab740][_0x9974('0x7b')]],'%s',_0x27c824):_0x27c824;if(_0xd138f2[_0x4ab740][_0x9974('0x7c')]){_0x1d75b6['group'](_0x27c824);}_0xd138f2[_0x4ab740][_0x9974('0x7d')]&&_0x1d75b6[_0x9974('0x3c')](_0x27c824,_0xd138f2[_0x4ab740][_0x9974('0x7d')]===_0x9974('0x7e')?![]:!![]);_0x1d75b6[_0x9974('0x6f')](_0x27c824,_0xd138f2[_0x4ab740]['alias']||_0x27c824);}if(_0x3579ba[_0x9974('0x80')]){_0x3579ba['joins']=JSON['parse'](_0x3579ba[_0x9974('0x80')]);for(var _0x4f1b90=0x0;_0x4f1b90<_0x3579ba[_0x9974('0x80')][_0x9974('0x39')];_0x4f1b90+=0x1){if(_0x3579ba[_0x9974('0x80')][_0x4f1b90][_0x9974('0x30')]&&_['includes'](_0x3ee833,_0x3579ba['joins'][_0x4f1b90][_0x9974('0x30')])&&_0x3579ba[_0x9974('0x80')][_0x4f1b90]['parentKey']&&_0x3579ba['joins'][_0x4f1b90][_0x9974('0x82')]&&_0x3579ba['joins'][_0x4f1b90][_0x9974('0x83')]){_0x1d75b6[_0x3579ba[_0x9974('0x80')][_0x4f1b90][_0x9974('0x30')]](_0x3579ba[_0x9974('0x80')][_0x4f1b90][_0x9974('0x82')],null,util['format'](_0x9974('0x84'),_0x3579ba['table'],_0x3579ba[_0x9974('0x80')][_0x4f1b90][_0x9974('0x81')],_0x3579ba[_0x9974('0x80')][_0x4f1b90][_0x9974('0x82')],_0x3579ba[_0x9974('0x80')][_0x4f1b90]['foreignKey']));}}}if(_0x3579ba[_0x9974('0x85')]){_0x3579ba[_0x9974('0x85')]=JSON['parse'](_0x3579ba[_0x9974('0x85')]);_0x1d75b6[_0x9974('0x40')](_0x57bc4a(_0x3579ba[_0x9974('0x85')]['group']));}_0x6c64cf=_0x1d75b6[_0x9974('0x86')]();_0x1d75b6['limit'](_0x594d9c);_0x1d75b6[_0x9974('0x18')](0x0);logger[_0x9974('0x87')]('Limited\x20Query:',_0x1d75b6[_0x9974('0x89')]());return dbH[_0x9974('0x8a')][_0x9974('0x33')](_0x1d75b6[_0x9974('0x89')](),{'type':dbH['sequelize']['QueryTypes'][_0x9974('0x8c')]});}})[_0x9974('0x22')](function(){return{'sql':_0x6c64cf[_0x9974('0x89')]()};})[_0x9974('0x22')](respondWithResult(_0x245f3f,null))[_0x9974('0x49')](handleError(_0x245f3f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6473817..1f3c4ec 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 _0x1a0b=['bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','api','moment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x1a0b,0xd4));var _0xb1a0=function(_0xade054,_0x3cddfa){_0xade054=_0xade054-0x0;var _0x37a229=_0x1a0b[_0xade054];return _0x37a229;};'use strict';var _=require(_0xb1a0('0x0'));var util=require('util');var logger=require(_0xb1a0('0x1'))(_0xb1a0('0x2'));var moment=require(_0xb1a0('0x3'));var BPromise=require(_0xb1a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1a0('0x5'));var rimraf=require(_0xb1a0('0x6'));var config=require(_0xb1a0('0x7'));var attributes=require(_0xb1a0('0x8'));module[_0xb1a0('0x9')]=function(_0x184343,_0x57cbc3){return _0x184343[_0xb1a0('0xa')](_0xb1a0('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19c7=['../../config/environment','exports','define','analytics_custom_reports','lodash','bluebird','request-promise','rimraf'];(function(_0x242968,_0x40b60a){var _0x2f2126=function(_0x122038){while(--_0x122038){_0x242968['push'](_0x242968['shift']());}};_0x2f2126(++_0x40b60a);}(_0x19c7,0x19c));var _0x719c=function(_0x35010e,_0x3847f8){_0x35010e=_0x35010e-0x0;var _0x17525e=_0x19c7[_0x35010e];return _0x17525e;};'use strict';var _=require(_0x719c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x719c('0x1'));var rp=require(_0x719c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x719c('0x3'));var config=require(_0x719c('0x4'));var attributes=require('./analyticCustomReport.attributes');module[_0x719c('0x5')]=function(_0x4f957c,_0x311c6f){return _0x4f957c[_0x719c('0x6')]('AnalyticCustomReport',attributes,{'tableName':_0x719c('0x7'),'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 e75ef2c..ea707c2 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 _0xdeee=['../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeee,0x179));var _0xedee=function(_0x2971bf,_0x47b60b){_0x2971bf=_0x2971bf-0x0;var _0x1191f0=_0xdeee[_0x2971bf];return _0x1191f0;};'use strict';var _=require(_0xedee('0x0'));var util=require(_0xedee('0x1'));var moment=require(_0xedee('0x2'));var BPromise=require(_0xedee('0x3'));var rs=require(_0xedee('0x4'));var fs=require('fs');var Redis=require(_0xedee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xedee('0x6'));var logger=require(_0xedee('0x7'))('rpc');var config=require(_0xedee('0x8'));var jayson=require(_0xedee('0x9'));var client=jayson['client'][_0xedee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5774,_0x99b75d,_0x326383){return new BPromise(function(_0x255302,_0x4df791){return client[_0xedee('0xb')](_0x5c5774,_0x326383)[_0xedee('0xc')](function(_0x557929){logger['info'](_0xedee('0xd'),_0x99b75d,_0xedee('0xe'));logger[_0xedee('0xf')](_0xedee('0x10'),_0x99b75d,'request\x20sent',JSON[_0xedee('0x11')](_0x557929));if(_0x557929['error']){if(_0x557929[_0xedee('0x12')][_0xedee('0x13')]===0x1f4){logger['error'](_0xedee('0xd'),_0x99b75d,_0x557929[_0xedee('0x12')]['message']);return _0x4df791(_0x557929[_0xedee('0x12')][_0xedee('0x14')]);}logger[_0xedee('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x99b75d,_0x557929[_0xedee('0x12')][_0xedee('0x14')]);return _0x255302(_0x557929[_0xedee('0x12')]['message']);}else{logger[_0xedee('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x99b75d,'request\x20sent');_0x255302(_0x557929[_0xedee('0x16')][_0xedee('0x14')]);}})[_0xedee('0x17')](function(_0x105131){logger[_0xedee('0x12')](_0xedee('0xd'),_0x99b75d,_0x105131);_0x4df791(_0x105131);});});} \ No newline at end of file +var _0xdead=['request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3696e1,_0x47e3ec){var _0x54843b=function(_0x47e8a2){while(--_0x47e8a2){_0x3696e1['push'](_0x3696e1['shift']());}};_0x54843b(++_0x47e3ec);}(_0xdead,0x17c));var _0xddea=function(_0x2ad477,_0x323d3a){_0x2ad477=_0x2ad477-0x0;var _0x3083da=_0xdead[_0x2ad477];return _0x3083da;};'use strict';var _=require(_0xddea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xddea('0x1'));var rs=require(_0xddea('0x2'));var fs=require('fs');var Redis=require(_0xddea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xddea('0x4'));var logger=require(_0xddea('0x5'))(_0xddea('0x6'));var config=require(_0xddea('0x7'));var jayson=require(_0xddea('0x8'));var client=jayson[_0xddea('0x9')][_0xddea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x266ace,_0x3fbd4e,_0x473d8e){return new BPromise(function(_0x2871f2,_0x71297a){return client[_0xddea('0xb')](_0x266ace,_0x473d8e)['then'](function(_0x39fad9){logger[_0xddea('0xc')](_0xddea('0xd'),_0x3fbd4e,_0xddea('0xe'));logger[_0xddea('0xf')](_0xddea('0x10'),_0x3fbd4e,_0xddea('0xe'),JSON[_0xddea('0x11')](_0x39fad9));if(_0x39fad9[_0xddea('0x12')]){if(_0x39fad9['error'][_0xddea('0x13')]===0x1f4){logger[_0xddea('0x12')](_0xddea('0xd'),_0x3fbd4e,_0x39fad9[_0xddea('0x12')]['message']);return _0x71297a(_0x39fad9['error'][_0xddea('0x14')]);}logger[_0xddea('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3fbd4e,_0x39fad9[_0xddea('0x12')][_0xddea('0x14')]);return _0x2871f2(_0x39fad9[_0xddea('0x12')][_0xddea('0x14')]);}else{logger[_0xddea('0xc')](_0xddea('0xd'),_0x3fbd4e,'request\x20sent');_0x2871f2(_0x39fad9[_0xddea('0x15')][_0xddea('0x14')]);}})[_0xddea('0x16')](function(_0x3d9cde){logger[_0xddea('0x12')](_0xddea('0xd'),_0x3fbd4e,_0x3d9cde);_0x71297a(_0x3d9cde);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0135db1..af49afa 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 _0x9afb=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','preview','/:id/run','post'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x9afb,0x10e));var _0xb9af=function(_0x1d3a4d,_0x7a4edb){_0x1d3a4d=_0x1d3a4d-0x0;var _0x122e3d=_0x9afb[_0x1d3a4d];return _0x122e3d;};'use strict';var multer=require(_0xb9af('0x0'));var util=require(_0xb9af('0x1'));var path=require(_0xb9af('0x2'));var timeout=require(_0xb9af('0x3'));var express=require(_0xb9af('0x4'));var router=express[_0xb9af('0x5')]();var fs_extra=require(_0xb9af('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb9af('0x7'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xb9af('0x8')](),controller[_0xb9af('0x9')]);router[_0xb9af('0xa')](_0xb9af('0xb'),auth[_0xb9af('0x8')](),controller['show']);router[_0xb9af('0xa')]('/:id/preview',auth[_0xb9af('0x8')](),controller[_0xb9af('0xc')]);router['get'](_0xb9af('0xd'),auth[_0xb9af('0x8')](),controller['run']);router[_0xb9af('0xa')]('/:id/query',auth[_0xb9af('0x8')](),controller['query']);router[_0xb9af('0xe')]('/',auth[_0xb9af('0x8')](),controller[_0xb9af('0xf')]);router[_0xb9af('0x10')]('/:id',auth[_0xb9af('0x8')](),controller[_0xb9af('0x11')]);router['delete']('/:id',auth[_0xb9af('0x8')](),controller[_0xb9af('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe38b=['create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','preview','run','/:id/query','query','post'];(function(_0x4419b7,_0x46f23c){var _0x35a626=function(_0x2bdb0a){while(--_0x2bdb0a){_0x4419b7['push'](_0x4419b7['shift']());}};_0x35a626(++_0x46f23c);}(_0xe38b,0xf9));var _0xbe38=function(_0xeb5265,_0x325ac5){_0xeb5265=_0xeb5265-0x0;var _0x3e1f93=_0xe38b[_0xeb5265];return _0x3e1f93;};'use strict';var multer=require(_0xbe38('0x0'));var util=require('util');var path=require(_0xbe38('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe38('0x2'));var router=express['Router']();var fs_extra=require(_0xbe38('0x3'));var auth=require(_0xbe38('0x4'));var interaction=require(_0xbe38('0x5'));var config=require(_0xbe38('0x6'));var controller=require(_0xbe38('0x7'));router[_0xbe38('0x8')]('/',auth[_0xbe38('0x9')](),controller['index']);router[_0xbe38('0x8')]('/:id',auth[_0xbe38('0x9')](),controller['show']);router[_0xbe38('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0xbe38('0xa')]);router[_0xbe38('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xbe38('0xb')]);router[_0xbe38('0x8')](_0xbe38('0xc'),auth[_0xbe38('0x9')](),controller[_0xbe38('0xd')]);router[_0xbe38('0xe')]('/',auth[_0xbe38('0x9')](),controller[_0xbe38('0xf')]);router[_0xbe38('0x10')](_0xbe38('0x11'),auth[_0xbe38('0x9')](),controller[_0xbe38('0x12')]);router[_0xbe38('0x13')]('/:id',auth[_0xbe38('0x9')](),controller[_0xbe38('0x14')]);module[_0xbe38('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 2f2db5c..89af11e 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0x5075,0x73));var _0x5507=function(_0x41c49e,_0x4e9e2c){_0x41c49e=_0x41c49e-0x0;var _0x648a67=_0x5075[_0x41c49e];return _0x648a67;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x498f63,_0x43bae0){var _0x1582db=function(_0x7020c0){while(--_0x7020c0){_0x498f63['push'](_0x498f63['shift']());}};_0x1582db(++_0x43bae0);}(_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 352fb04..74d955a 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x313d54,_0x42f9e8){var _0x1cd633=function(_0x820bde){while(--_0x820bde){_0x313d54['push'](_0x313d54['shift']());}};_0x1cd633(++_0x42f9e8);}(_0x4975,0x86));var _0x5497=function(_0x38c9b5,_0x46dfee){_0x38c9b5=_0x38c9b5-0x0;var _0x54aed1=_0x4975[_0x38c9b5];return _0x54aed1;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x4e4fe7,_0x524d37){var _0x5d8f02=function(_0x19b16f){while(--_0x19b16f){_0x4e4fe7['push'](_0x4e4fe7['shift']());}};_0x5d8f02(++_0x524d37);}(_0x31f0,0xb7));var _0x031f=function(_0x8adae,_0x5877a4){_0x8adae=_0x8adae-0x0;var _0x294b86=_0x31f0[_0x8adae];return _0x294b86;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 268d4d2..9633659 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 _0xc8a1=['request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','lodash','../../config/logger','api','moment'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xc8a1,0x8c));var _0x1c8a=function(_0x32ec2e,_0x3d423f){_0x32ec2e=_0x32ec2e-0x0;var _0x28e955=_0xc8a1[_0x32ec2e];return _0x28e955;};'use strict';var _=require(_0x1c8a('0x0'));var util=require('util');var logger=require(_0x1c8a('0x1'))(_0x1c8a('0x2'));var moment=require(_0x1c8a('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c8a('0x4'));var fs=require('fs');var path=require(_0x1c8a('0x5'));var rimraf=require('rimraf');var config=require(_0x1c8a('0x6'));var attributes=require(_0x1c8a('0x7'));module[_0x1c8a('0x8')]=function(_0x405b73,_0x161ed4){return _0x405b73['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c90=['bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4c160b,_0x1af746){var _0x5336b3=function(_0x726df){while(--_0x726df){_0x4c160b['push'](_0x4c160b['shift']());}};_0x5336b3(++_0x1af746);}(_0x5c90,0x133));var _0x05c9=function(_0x5626ed,_0x5a674e){_0x5626ed=_0x5626ed-0x0;var _0x4c4110=_0x5c90[_0x5626ed];return _0x4c4110;};'use strict';var _=require(_0x05c9('0x0'));var util=require(_0x05c9('0x1'));var logger=require(_0x05c9('0x2'))(_0x05c9('0x3'));var moment=require(_0x05c9('0x4'));var BPromise=require(_0x05c9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05c9('0x6'));var rimraf=require(_0x05c9('0x7'));var config=require(_0x05c9('0x8'));var attributes=require(_0x05c9('0x9'));module[_0x05c9('0xa')]=function(_0x376bc2,_0x12b9b6){return _0x376bc2['define']('AnalyticDefaultReport',attributes,{'tableName':_0x05c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 95e4179..3d5035e 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 _0xbd53=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0xbd53,0x93));var _0x3bd5=function(_0x19c6d7,_0x243cf6){_0x19c6d7=_0x19c6d7-0x0;var _0x5d3fac=_0xbd53[_0x19c6d7];return _0x5d3fac;};'use strict';var _=require(_0x3bd5('0x0'));var util=require(_0x3bd5('0x1'));var moment=require(_0x3bd5('0x2'));var BPromise=require(_0x3bd5('0x3'));var rs=require(_0x3bd5('0x4'));var fs=require('fs');var Redis=require(_0x3bd5('0x5'));var db=require(_0x3bd5('0x6'))['db'];var utils=require(_0x3bd5('0x7'));var logger=require('../../config/logger')(_0x3bd5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc11c08,_0x282cb7,_0x1d4cf5){return new BPromise(function(_0x45ce90,_0x59c4e7){return client[_0x3bd5('0xa')](_0xc11c08,_0x1d4cf5)[_0x3bd5('0xb')](function(_0x2ebe4a){logger[_0x3bd5('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x282cb7,_0x3bd5('0xd'));logger[_0x3bd5('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x282cb7,_0x3bd5('0xd'),JSON[_0x3bd5('0xf')](_0x2ebe4a));if(_0x2ebe4a[_0x3bd5('0x10')]){if(_0x2ebe4a[_0x3bd5('0x10')][_0x3bd5('0x11')]===0x1f4){logger[_0x3bd5('0x10')](_0x3bd5('0x12'),_0x282cb7,_0x2ebe4a[_0x3bd5('0x10')][_0x3bd5('0x13')]);return _0x59c4e7(_0x2ebe4a['error'][_0x3bd5('0x13')]);}logger[_0x3bd5('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x282cb7,_0x2ebe4a[_0x3bd5('0x10')][_0x3bd5('0x13')]);return _0x45ce90(_0x2ebe4a['error']['message']);}else{logger['info'](_0x3bd5('0x12'),_0x282cb7,'request\x20sent');_0x45ce90(_0x2ebe4a['result'][_0x3bd5('0x13')]);}})[_0x3bd5('0x14')](function(_0x25f18f){logger[_0x3bd5('0x10')](_0x3bd5('0x12'),_0x282cb7,_0x25f18f);_0x59c4e7(_0x25f18f);});});} \ No newline at end of file +var _0xb21c=['client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xee69d5,_0x1192df){var _0x5783f6=function(_0x4fdfc9){while(--_0x4fdfc9){_0xee69d5['push'](_0xee69d5['shift']());}};_0x5783f6(++_0x1192df);}(_0xb21c,0x100));var _0xcb21=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0xb21c[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require(_0xcb21('0x0'));var util=require('util');var moment=require(_0xcb21('0x1'));var BPromise=require(_0xcb21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb21('0x3'));var db=require(_0xcb21('0x4'))['db'];var utils=require(_0xcb21('0x5'));var logger=require(_0xcb21('0x6'))(_0xcb21('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb21('0x8')][_0xcb21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6eb3,_0x9923bc,_0x110db5){return new BPromise(function(_0xab4116,_0x5c00f0){return client[_0xcb21('0xa')](_0x2f6eb3,_0x110db5)[_0xcb21('0xb')](function(_0x3dd40a){logger[_0xcb21('0xc')](_0xcb21('0xd'),_0x9923bc,'request\x20sent');logger[_0xcb21('0xe')](_0xcb21('0xf'),_0x9923bc,_0xcb21('0x10'),JSON[_0xcb21('0x11')](_0x3dd40a));if(_0x3dd40a[_0xcb21('0x12')]){if(_0x3dd40a[_0xcb21('0x12')][_0xcb21('0x13')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x9923bc,_0x3dd40a['error'][_0xcb21('0x14')]);return _0x5c00f0(_0x3dd40a[_0xcb21('0x12')][_0xcb21('0x14')]);}logger[_0xcb21('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x9923bc,_0x3dd40a['error'][_0xcb21('0x14')]);return _0xab4116(_0x3dd40a[_0xcb21('0x12')]['message']);}else{logger[_0xcb21('0xc')](_0xcb21('0xd'),_0x9923bc,_0xcb21('0x10'));_0xab4116(_0x3dd40a['result'][_0xcb21('0x14')]);}})[_0xcb21('0x15')](function(_0x584e75){logger['error'](_0xcb21('0xd'),_0x9923bc,_0x584e75);_0x5c00f0(_0x584e75);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 92ec258..c899512 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 _0x33a7=['/:id/run','run','/:id/query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/preview'];(function(_0x41be9f,_0x123958){var _0x459a7b=function(_0x49170f){while(--_0x49170f){_0x41be9f['push'](_0x41be9f['shift']());}};_0x459a7b(++_0x123958);}(_0x33a7,0x77));var _0x733a=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0x33a7[_0x1df473];return _0x1bdd49;};'use strict';var multer=require(_0x733a('0x0'));var util=require(_0x733a('0x1'));var path=require('path');var timeout=require(_0x733a('0x2'));var express=require(_0x733a('0x3'));var router=express[_0x733a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x733a('0x5'));var config=require(_0x733a('0x6'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x733a('0x7')](),controller[_0x733a('0x8')]);router['get'](_0x733a('0x9'),auth[_0x733a('0x7')](),controller[_0x733a('0xa')]);router[_0x733a('0xb')](_0x733a('0xc'),auth[_0x733a('0x7')](),controller['preview']);router[_0x733a('0xb')](_0x733a('0xd'),auth['isAuthenticated'](),controller[_0x733a('0xe')]);router['get'](_0x733a('0xf'),auth[_0x733a('0x7')](),controller['query']);router[_0x733a('0x10')]('/',auth[_0x733a('0x7')](),controller[_0x733a('0x11')]);router[_0x733a('0x12')](_0x733a('0x9'),auth[_0x733a('0x7')](),controller[_0x733a('0x13')]);router['delete'](_0x733a('0x9'),auth[_0x733a('0x7')](),controller[_0x733a('0x14')]);module[_0x733a('0x15')]=router; \ No newline at end of file +var _0xdcef=['post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','run','query'];(function(_0xdb7a20,_0x289435){var _0x59dfa9=function(_0x10d20d){while(--_0x10d20d){_0xdb7a20['push'](_0xdb7a20['shift']());}};_0x59dfa9(++_0x289435);}(_0xdcef,0x1a7));var _0xfdce=function(_0x3bd273,_0x199f34){_0x3bd273=_0x3bd273-0x0;var _0x3c19cd=_0xdcef[_0x3bd273];return _0x3c19cd;};'use strict';var multer=require(_0xfdce('0x0'));var util=require(_0xfdce('0x1'));var path=require(_0xfdce('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdce('0x3'));var router=express[_0xfdce('0x4')]();var fs_extra=require(_0xfdce('0x5'));var auth=require(_0xfdce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfdce('0x7'));var controller=require(_0xfdce('0x8'));router[_0xfdce('0x9')]('/',auth[_0xfdce('0xa')](),controller[_0xfdce('0xb')]);router[_0xfdce('0x9')](_0xfdce('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfdce('0x9')](_0xfdce('0xd'),auth['isAuthenticated'](),controller[_0xfdce('0xe')]);router[_0xfdce('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xfdce('0xf')]);router[_0xfdce('0x9')]('/:id/query',auth[_0xfdce('0xa')](),controller[_0xfdce('0x10')]);router[_0xfdce('0x11')]('/',auth[_0xfdce('0xa')](),controller['create']);router[_0xfdce('0x12')](_0xfdce('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfdce('0x13')](_0xfdce('0xc'),auth[_0xfdce('0xa')](),controller[_0xfdce('0x14')]);module[_0xfdce('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f7846ae..854182a 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 _0x5cdc=['sequelize','moment','STRING','ENUM','csv','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED'];(function(_0x48c583,_0x30a7b8){var _0x357851=function(_0x4e573d){while(--_0x4e573d){_0x48c583['push'](_0x48c583['shift']());}};_0x357851(++_0x30a7b8);}(_0x5cdc,0x1d9));var _0xc5cd=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0x5cdc[_0x197065];return _0x3d9404;};'use strict';var Sequelize=require(_0xc5cd('0x0'));var moment=require(_0xc5cd('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc5cd('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xc5cd('0x3')](_0xc5cd('0x4'),'pdf',_0xc5cd('0x5')),'allowNull':![],'defaultValue':_0xc5cd('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc5cd('0x6')]},'endDate':{'type':Sequelize[_0xc5cd('0x6')]},'status':{'type':Sequelize[_0xc5cd('0x2')],'defaultValue':_0xc5cd('0x7')},'type':{'type':Sequelize[_0xc5cd('0x3')](_0xc5cd('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0xc5cd('0x8')},'reportId':{'type':Sequelize[_0xc5cd('0x9')](0xb)[_0xc5cd('0xa')]},'reportType':{'type':Sequelize[_0xc5cd('0x2')]}}; \ No newline at end of file +var _0x9d2a=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED'];(function(_0x34d6cb,_0x1ae55c){var _0x4372cb=function(_0x1a073a){while(--_0x1a073a){_0x34d6cb['push'](_0x34d6cb['shift']());}};_0x4372cb(++_0x1ae55c);}(_0x9d2a,0x179));var _0xa9d2=function(_0x3a4d38,_0x15ca44){_0x3a4d38=_0x3a4d38-0x0;var _0x2fbc17=_0x9d2a[_0x3a4d38];return _0x2fbc17;};'use strict';var Sequelize=require(_0xa9d2('0x0'));var moment=require(_0xa9d2('0x1'));module[_0xa9d2('0x2')]={'name':{'type':Sequelize[_0xa9d2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xa9d2('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa9d2('0x4')](_0xa9d2('0x5'),_0xa9d2('0x6'),_0xa9d2('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa9d2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa9d2('0x8')]},'endDate':{'type':Sequelize[_0xa9d2('0x8')]},'status':{'type':Sequelize[_0xa9d2('0x3')],'defaultValue':_0xa9d2('0x9')},'type':{'type':Sequelize[_0xa9d2('0x4')](_0xa9d2('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xa9d2('0xa')},'reportId':{'type':Sequelize[_0xa9d2('0xb')](0xb)[_0xa9d2('0xc')]},'reportType':{'type':Sequelize[_0xa9d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8c3012d..f1e716e 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 _0xb0f0=['json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','ExtractedReports','destroy','stack','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','format','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end'];(function(_0x162722,_0x37e4e3){var _0x35e975=function(_0x5e3114){while(--_0x5e3114){_0x162722['push'](_0x162722['shift']());}};_0x35e975(++_0x37e4e3);}(_0xb0f0,0xa1));var _0x0b0f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb0f0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0b0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b0f('0x1'));var jsonpatch=require(_0x0b0f('0x2'));var rp=require(_0x0b0f('0x3'));var moment=require(_0x0b0f('0x4'));var BPromise=require(_0x0b0f('0x5'));var Mustache=require(_0x0b0f('0x6'));var util=require(_0x0b0f('0x7'));var path=require('path');var sox=require(_0x0b0f('0x8'));var csv=require(_0x0b0f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b0f('0xa'));var squel=require(_0x0b0f('0xb'));var crypto=require(_0x0b0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b0f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0b0f('0xe'));var Papa=require(_0x0b0f('0xf'));var Redis=require(_0x0b0f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b0f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0f('0x12'));var logger=require(_0x0b0f('0x13'))(_0x0b0f('0x14'));var utils=require('../../config/utils');var config=require(_0x0b0f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2596c4,_0x5df073){_0x5df073=_0x5df073||0xcc;return function(_0x5a06bc){if(_0x5a06bc){return _0x2596c4[_0x0b0f('0x16')](_0x5df073);}return _0x2596c4[_0x0b0f('0x17')](_0x5df073)[_0x0b0f('0x18')]();};}function respondWithResult(_0x4a7b6c,_0x59c1cb){_0x59c1cb=_0x59c1cb||0xc8;return function(_0x3b2b5b){if(_0x3b2b5b){return _0x4a7b6c[_0x0b0f('0x17')](_0x59c1cb)[_0x0b0f('0x19')](_0x3b2b5b);}};}function respondWithFilteredResult(_0x3dc31d,_0x27e4a4){return function(_0x399e15){if(_0x399e15){var _0x5c7f82=typeof _0x27e4a4[_0x0b0f('0x1a')]==='undefined'&&typeof _0x27e4a4['limit']===_0x0b0f('0x1b');var _0x4bf3db=_0x399e15[_0x0b0f('0x1c')];var _0x3325aa=_0x5c7f82?0x0:_0x27e4a4['offset'];var _0x528c7f=_0x5c7f82?_0x399e15[_0x0b0f('0x1c')]:_0x27e4a4[_0x0b0f('0x1a')]+_0x27e4a4[_0x0b0f('0x1d')];var _0x543178;if(_0x528c7f>=_0x4bf3db){_0x528c7f=_0x4bf3db;_0x543178=0xc8;}else{_0x543178=0xce;}_0x3dc31d[_0x0b0f('0x17')](_0x543178);return _0x3dc31d[_0x0b0f('0x1e')](_0x0b0f('0x1f'),_0x3325aa+'-'+_0x528c7f+'/'+_0x4bf3db)['json'](_0x399e15);}return null;};}function patchUpdates(_0x5cfddd){return function(_0x42b16a){try{jsonpatch[_0x0b0f('0x20')](_0x42b16a,_0x5cfddd,!![]);}catch(_0x24c8c1){return BPromise['reject'](_0x24c8c1);}return _0x42b16a[_0x0b0f('0x21')]();};}function saveUpdates(_0x3b6e3d,_0x2e4bf4){return function(_0x28a41e){if(_0x28a41e){return _0x28a41e[_0x0b0f('0x22')](_0x3b6e3d)[_0x0b0f('0x23')](function(_0x412b2a){return _0x412b2a;});}return null;};}function removeEntity(_0x38bf11,_0xbb0b1b){return function(_0x5cd30c){if(_0x5cd30c){return _0x5cd30c['destroy']()[_0x0b0f('0x23')](function(){var _0x80ed25=_0x5cd30c[_0x0b0f('0x24')]({'plain':!![]});var _0x2d9ad5=_0x0b0f('0x25');return db['UserProfileResource'][_0x0b0f('0x26')]({'where':{'type':_0x2d9ad5,'resourceId':_0x80ed25['id']}})['then'](function(){return _0x5cd30c;});})['then'](function(){_0x38bf11[_0x0b0f('0x17')](0xcc)[_0x0b0f('0x18')]();});}};}function handleEntityNotFound(_0x54d1fe,_0x3214b4){return function(_0x2982b8){if(!_0x2982b8){_0x54d1fe[_0x0b0f('0x16')](0x194);}return _0x2982b8;};}function handleError(_0x499a02,_0x10ffb7){_0x10ffb7=_0x10ffb7||0x1f4;return function(_0x1e4158){logger['error'](_0x1e4158[_0x0b0f('0x27')]);if(_0x1e4158[_0x0b0f('0x28')]){delete _0x1e4158[_0x0b0f('0x28')];}_0x499a02[_0x0b0f('0x17')](_0x10ffb7)['send'](_0x1e4158);};}exports[_0x0b0f('0x29')]=function(_0x59b674,_0x377987){var _0x3aa65f={},_0x3e689f={},_0x801624={'count':0x0,'rows':[]};var _0x47b60d=_['map'](db[_0x0b0f('0x2a')][_0x0b0f('0x2b')],function(_0x685894){return{'name':_0x685894[_0x0b0f('0x2c')],'type':_0x685894[_0x0b0f('0x2d')][_0x0b0f('0x2e')]};});_0x3e689f[_0x0b0f('0x2f')]=_[_0x0b0f('0x30')](_0x47b60d,_0x0b0f('0x28'));_0x3e689f[_0x0b0f('0x31')]=_[_0x0b0f('0x32')](_0x59b674[_0x0b0f('0x31')]);_0x3e689f[_0x0b0f('0x33')]=_[_0x0b0f('0x34')](_0x3e689f[_0x0b0f('0x2f')],_0x3e689f['query']);_0x3aa65f[_0x0b0f('0x35')]=_[_0x0b0f('0x34')](_0x3e689f[_0x0b0f('0x2f')],qs['fields'](_0x59b674[_0x0b0f('0x31')][_0x0b0f('0x36')]));_0x3aa65f[_0x0b0f('0x35')]=_0x3aa65f['attributes'][_0x0b0f('0x37')]?_0x3aa65f[_0x0b0f('0x35')]:_0x3e689f[_0x0b0f('0x2f')];if(!_0x59b674[_0x0b0f('0x31')][_0x0b0f('0x38')](_0x0b0f('0x39'))){_0x3aa65f[_0x0b0f('0x1d')]=qs['limit'](_0x59b674['query'][_0x0b0f('0x1d')]);_0x3aa65f[_0x0b0f('0x1a')]=qs[_0x0b0f('0x1a')](_0x59b674[_0x0b0f('0x31')]['offset']);}_0x3aa65f[_0x0b0f('0x3a')]=qs['sort'](_0x59b674['query'][_0x0b0f('0x3b')]);_0x3aa65f[_0x0b0f('0x3c')]=qs[_0x0b0f('0x33')](_['pick'](_0x59b674['query'],_0x3e689f[_0x0b0f('0x33')]),_0x47b60d);if(_0x59b674[_0x0b0f('0x31')][_0x0b0f('0x3d')]){_0x3aa65f[_0x0b0f('0x3c')]=_['merge'](_0x3aa65f[_0x0b0f('0x3c')],{'$or':_['map'](_0x47b60d,function(_0xcf122f){if(_0xcf122f[_0x0b0f('0x2d')]!=='VIRTUAL'){var _0x5d7624={};_0x5d7624[_0xcf122f[_0x0b0f('0x28')]]={'$like':'%'+_0x59b674[_0x0b0f('0x31')]['filter']+'%'};return _0x5d7624;}})});}_0x3aa65f=_[_0x0b0f('0x3e')]({},_0x3aa65f,_0x59b674['options']);var _0x32e74f={'where':_0x3aa65f[_0x0b0f('0x3c')]};return db['AnalyticExtractedReport']['count'](_0x32e74f)[_0x0b0f('0x23')](function(_0x4f3f42){_0x801624[_0x0b0f('0x1c')]=_0x4f3f42;if(_0x59b674[_0x0b0f('0x31')][_0x0b0f('0x3f')]){_0x3aa65f[_0x0b0f('0x40')]=[{'all':!![]}];}return db[_0x0b0f('0x2a')][_0x0b0f('0x41')](_0x3aa65f);})['then'](function(_0x53fb8e){_0x801624[_0x0b0f('0x42')]=_0x53fb8e;return _0x801624;})[_0x0b0f('0x23')](respondWithFilteredResult(_0x377987,_0x3aa65f))[_0x0b0f('0x43')](handleError(_0x377987,null));};exports[_0x0b0f('0x44')]=function(_0x8e69d0,_0x471dfd){var _0x4756af={'raw':!![],'where':{'id':_0x8e69d0[_0x0b0f('0x45')]['id']}},_0x2d7320={};_0x2d7320['model']=_[_0x0b0f('0x32')](db['AnalyticExtractedReport'][_0x0b0f('0x2b')]);_0x2d7320[_0x0b0f('0x31')]=_[_0x0b0f('0x32')](_0x8e69d0['query']);_0x2d7320[_0x0b0f('0x33')]=_[_0x0b0f('0x34')](_0x2d7320[_0x0b0f('0x2f')],_0x2d7320[_0x0b0f('0x31')]);_0x4756af['attributes']=_['intersection'](_0x2d7320[_0x0b0f('0x2f')],qs[_0x0b0f('0x36')](_0x8e69d0['query'][_0x0b0f('0x36')]));_0x4756af[_0x0b0f('0x35')]=_0x4756af['attributes']['length']?_0x4756af[_0x0b0f('0x35')]:_0x2d7320['model'];if(_0x8e69d0[_0x0b0f('0x31')]['includeAll']){_0x4756af[_0x0b0f('0x40')]=[{'all':!![]}];}_0x4756af=_[_0x0b0f('0x3e')]({},_0x4756af,_0x8e69d0[_0x0b0f('0x46')]);return db['AnalyticExtractedReport']['find'](_0x4756af)[_0x0b0f('0x23')](handleEntityNotFound(_0x471dfd,null))['then'](respondWithResult(_0x471dfd,null))['catch'](handleError(_0x471dfd,null));};exports[_0x0b0f('0x47')]=function(_0x4efd9f,_0x41e31a){return db[_0x0b0f('0x2a')][_0x0b0f('0x47')](_0x4efd9f[_0x0b0f('0x48')],{})[_0x0b0f('0x23')](function(_0x1d8012){var _0x304573=_0x4efd9f[_0x0b0f('0x49')]['get']({'plain':!![]});if(!_0x304573)throw new Error(_0x0b0f('0x4a'));if(_0x304573[_0x0b0f('0x4b')]===_0x0b0f('0x49')){var _0x4a7a6d=_0x1d8012['get']({'plain':!![]});var _0x20b85b=_0x0b0f('0x25');return db[_0x0b0f('0x4c')][_0x0b0f('0x4d')]({'where':{'name':_0x20b85b,'userProfileId':_0x304573[_0x0b0f('0x4e')]},'raw':!![]})['then'](function(_0x473600){if(_0x473600&&_0x473600['autoAssociation']===0x0){return db[_0x0b0f('0x4f')][_0x0b0f('0x47')]({'name':_0x4a7a6d[_0x0b0f('0x28')],'resourceId':_0x4a7a6d['id'],'type':_0x473600[_0x0b0f('0x28')],'sectionId':_0x473600['id']},{})[_0x0b0f('0x23')](function(){return _0x1d8012;});}else{return _0x1d8012;}})[_0x0b0f('0x43')](function(_0x21a187){logger['error'](_0x0b0f('0x50'),_0x21a187);throw _0x21a187;});}return _0x1d8012;})[_0x0b0f('0x23')](respondWithResult(_0x41e31a,0xc9))[_0x0b0f('0x43')](handleError(_0x41e31a,null));};exports['update']=function(_0x3f2e1c,_0x328c67){if(_0x3f2e1c[_0x0b0f('0x48')]['id']){delete _0x3f2e1c['body']['id'];}return db[_0x0b0f('0x2a')][_0x0b0f('0x4d')]({'where':{'id':_0x3f2e1c[_0x0b0f('0x45')]['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x328c67,null))[_0x0b0f('0x23')](saveUpdates(_0x3f2e1c['body'],null))[_0x0b0f('0x23')](respondWithResult(_0x328c67,null))['catch'](handleError(_0x328c67,null));};exports[_0x0b0f('0x26')]=function(_0xe208e,_0x4de368){return db[_0x0b0f('0x2a')][_0x0b0f('0x4d')]({'where':{'id':_0xe208e['params']['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x4de368,null))['then'](removeEntity(_0x4de368,null))[_0x0b0f('0x43')](handleError(_0x4de368,null));};exports[_0x0b0f('0x51')]=function(_0x22c273,_0x20dee4,_0x4c101b){return db[_0x0b0f('0x2a')][_0x0b0f('0x4d')]({'where':{'id':_0x22c273[_0x0b0f('0x45')]['id']},'attributes':[_0x0b0f('0x28'),_0x0b0f('0x52'),'savename',_0x0b0f('0x53')],'raw':!![]})[_0x0b0f('0x23')](handleEntityNotFound(_0x20dee4,null))[_0x0b0f('0x23')](function(_0x427d1b){if(_0x427d1b){if(!fs[_0x0b0f('0x54')](path[_0x0b0f('0x55')](config[_0x0b0f('0x56')],_0x0b0f('0x57'),_0x427d1b[_0x0b0f('0x58')]))){throw new db['Sequelize'][(_0x0b0f('0x59'))](_0x0b0f('0x5a'));}if(_0x22c273[_0x0b0f('0x31')]['exists']){return _0x20dee4['sendStatus'](0xc8);}return _0x20dee4[_0x0b0f('0x51')](path[_0x0b0f('0x55')](config[_0x0b0f('0x56')],_0x0b0f('0x57'),_0x427d1b[_0x0b0f('0x58')]),util[_0x0b0f('0x5b')]('%s.%s',_0x427d1b['basename']||_0x427d1b[_0x0b0f('0x28')],_0x427d1b['output'][_0x0b0f('0x5c')]()));}})['catch'](handleError(_0x20dee4,null));}; \ No newline at end of file +var _0x1332=['type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filter','VIRTUAL','merge','AnalyticExtractedReport','include','rows','catch','show','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','output','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','reject','save','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','rawAttributes','fieldName'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0x1332,0x154));var _0x2133=function(_0x277664,_0x20fe27){_0x277664=_0x277664-0x0;var _0x5dcdac=_0x1332[_0x277664];return _0x5dcdac;};'use strict';var emlformat=require(_0x2133('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2133('0x1'));var jsonpatch=require(_0x2133('0x2'));var rp=require(_0x2133('0x3'));var moment=require('moment');var BPromise=require(_0x2133('0x4'));var Mustache=require(_0x2133('0x5'));var util=require('util');var path=require(_0x2133('0x6'));var sox=require(_0x2133('0x7'));var csv=require(_0x2133('0x8'));var ejs=require(_0x2133('0x9'));var fs=require('fs');var fs_extra=require(_0x2133('0xa'));var _=require(_0x2133('0xb'));var squel=require(_0x2133('0xc'));var crypto=require('crypto');var jsforce=require(_0x2133('0xd'));var deskjs=require(_0x2133('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2133('0xf'));var Papa=require(_0x2133('0x10'));var Redis=require(_0x2133('0x11'));var authService=require(_0x2133('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2133('0x13'));var hardwareService=require(_0x2133('0x14'));var logger=require(_0x2133('0x15'))(_0x2133('0x16'));var utils=require(_0x2133('0x17'));var config=require(_0x2133('0x18'));var licenseUtil=require(_0x2133('0x19'));var db=require(_0x2133('0x1a'))['db'];function respondWithStatusCode(_0x344f20,_0x25f864){_0x25f864=_0x25f864||0xcc;return function(_0x43150f){if(_0x43150f){return _0x344f20[_0x2133('0x1b')](_0x25f864);}return _0x344f20[_0x2133('0x1c')](_0x25f864)[_0x2133('0x1d')]();};}function respondWithResult(_0x323761,_0x10952c){_0x10952c=_0x10952c||0xc8;return function(_0x3c7ab5){if(_0x3c7ab5){return _0x323761[_0x2133('0x1c')](_0x10952c)[_0x2133('0x1e')](_0x3c7ab5);}};}function respondWithFilteredResult(_0x42aa2f,_0x174f3c){return function(_0x5a0a09){if(_0x5a0a09){var _0x35ee4d=typeof _0x174f3c['offset']===_0x2133('0x1f')&&typeof _0x174f3c['limit']===_0x2133('0x1f');var _0x1b6d14=_0x5a0a09[_0x2133('0x20')];var _0x7d5a0=_0x35ee4d?0x0:_0x174f3c['offset'];var _0x5a0411=_0x35ee4d?_0x5a0a09[_0x2133('0x20')]:_0x174f3c['offset']+_0x174f3c[_0x2133('0x21')];var _0x2dffb8;if(_0x5a0411>=_0x1b6d14){_0x5a0411=_0x1b6d14;_0x2dffb8=0xc8;}else{_0x2dffb8=0xce;}_0x42aa2f[_0x2133('0x1c')](_0x2dffb8);return _0x42aa2f[_0x2133('0x22')]('Content-Range',_0x7d5a0+'-'+_0x5a0411+'/'+_0x1b6d14)[_0x2133('0x1e')](_0x5a0a09);}return null;};}function patchUpdates(_0x580ee5){return function(_0x48dc39){try{jsonpatch['apply'](_0x48dc39,_0x580ee5,!![]);}catch(_0x5c6ea8){return BPromise[_0x2133('0x23')](_0x5c6ea8);}return _0x48dc39[_0x2133('0x24')]();};}function saveUpdates(_0x255537,_0x23afe0){return function(_0xf9c5f9){if(_0xf9c5f9){return _0xf9c5f9['update'](_0x255537)['then'](function(_0x10fc96){return _0x10fc96;});}return null;};}function removeEntity(_0x53a30a,_0xb3b45c){return function(_0x53ed4a){if(_0x53ed4a){return _0x53ed4a[_0x2133('0x25')]()[_0x2133('0x26')](function(){var _0x228015=_0x53ed4a[_0x2133('0x27')]({'plain':!![]});var _0x421cd4=_0x2133('0x28');return db[_0x2133('0x29')][_0x2133('0x25')]({'where':{'type':_0x421cd4,'resourceId':_0x228015['id']}})[_0x2133('0x26')](function(){return _0x53ed4a;});})[_0x2133('0x26')](function(){_0x53a30a['status'](0xcc)[_0x2133('0x1d')]();});}};}function handleEntityNotFound(_0x4dcd57,_0x198786){return function(_0x5decda){if(!_0x5decda){_0x4dcd57['sendStatus'](0x194);}return _0x5decda;};}function handleError(_0x2432b3,_0xe241f7){_0xe241f7=_0xe241f7||0x1f4;return function(_0x1c1a2f){logger[_0x2133('0x2a')](_0x1c1a2f[_0x2133('0x2b')]);if(_0x1c1a2f[_0x2133('0x2c')]){delete _0x1c1a2f[_0x2133('0x2c')];}_0x2432b3[_0x2133('0x1c')](_0xe241f7)[_0x2133('0x2d')](_0x1c1a2f);};}exports['index']=function(_0x763062,_0x4e12f4){var _0x40eaeb={},_0x2190eb={},_0x2fb319={'count':0x0,'rows':[]};var _0x40f707=_['map'](db['AnalyticExtractedReport'][_0x2133('0x2e')],function(_0x2bf204){return{'name':_0x2bf204[_0x2133('0x2f')],'type':_0x2bf204[_0x2133('0x30')][_0x2133('0x31')]};});_0x2190eb[_0x2133('0x32')]=_[_0x2133('0x33')](_0x40f707,'name');_0x2190eb[_0x2133('0x34')]=_[_0x2133('0x35')](_0x763062['query']);_0x2190eb[_0x2133('0x36')]=_[_0x2133('0x37')](_0x2190eb[_0x2133('0x32')],_0x2190eb[_0x2133('0x34')]);_0x40eaeb[_0x2133('0x38')]=_[_0x2133('0x37')](_0x2190eb[_0x2133('0x32')],qs['fields'](_0x763062[_0x2133('0x34')]['fields']));_0x40eaeb[_0x2133('0x38')]=_0x40eaeb[_0x2133('0x38')][_0x2133('0x39')]?_0x40eaeb[_0x2133('0x38')]:_0x2190eb['model'];if(!_0x763062[_0x2133('0x34')][_0x2133('0x3a')](_0x2133('0x3b'))){_0x40eaeb['limit']=qs[_0x2133('0x21')](_0x763062[_0x2133('0x34')]['limit']);_0x40eaeb[_0x2133('0x3c')]=qs[_0x2133('0x3c')](_0x763062[_0x2133('0x34')]['offset']);}_0x40eaeb['order']=qs[_0x2133('0x3d')](_0x763062[_0x2133('0x34')][_0x2133('0x3d')]);_0x40eaeb[_0x2133('0x3e')]=qs[_0x2133('0x36')](_['pick'](_0x763062[_0x2133('0x34')],_0x2190eb[_0x2133('0x36')]),_0x40f707);if(_0x763062['query'][_0x2133('0x3f')]){_0x40eaeb[_0x2133('0x3e')]=_['merge'](_0x40eaeb[_0x2133('0x3e')],{'$or':_[_0x2133('0x33')](_0x40f707,function(_0x10eb33){if(_0x10eb33[_0x2133('0x30')]!==_0x2133('0x40')){var _0x22c55f={};_0x22c55f[_0x10eb33[_0x2133('0x2c')]]={'$like':'%'+_0x763062[_0x2133('0x34')][_0x2133('0x3f')]+'%'};return _0x22c55f;}})});}_0x40eaeb=_[_0x2133('0x41')]({},_0x40eaeb,_0x763062['options']);var _0x56f23b={'where':_0x40eaeb[_0x2133('0x3e')]};return db[_0x2133('0x42')][_0x2133('0x20')](_0x56f23b)['then'](function(_0x4fd0c9){_0x2fb319[_0x2133('0x20')]=_0x4fd0c9;if(_0x763062['query']['includeAll']){_0x40eaeb[_0x2133('0x43')]=[{'all':!![]}];}return db[_0x2133('0x42')]['findAll'](_0x40eaeb);})[_0x2133('0x26')](function(_0x5c221a){_0x2fb319[_0x2133('0x44')]=_0x5c221a;return _0x2fb319;})[_0x2133('0x26')](respondWithFilteredResult(_0x4e12f4,_0x40eaeb))[_0x2133('0x45')](handleError(_0x4e12f4,null));};exports[_0x2133('0x46')]=function(_0x189a01,_0xdea5ee){var _0x48dfdb={'raw':!![],'where':{'id':_0x189a01[_0x2133('0x47')]['id']}},_0x258156={};_0x258156['model']=_[_0x2133('0x35')](db['AnalyticExtractedReport'][_0x2133('0x2e')]);_0x258156['query']=_['keys'](_0x189a01[_0x2133('0x34')]);_0x258156[_0x2133('0x36')]=_['intersection'](_0x258156[_0x2133('0x32')],_0x258156[_0x2133('0x34')]);_0x48dfdb['attributes']=_['intersection'](_0x258156[_0x2133('0x32')],qs[_0x2133('0x48')](_0x189a01[_0x2133('0x34')][_0x2133('0x48')]));_0x48dfdb[_0x2133('0x38')]=_0x48dfdb[_0x2133('0x38')][_0x2133('0x39')]?_0x48dfdb[_0x2133('0x38')]:_0x258156[_0x2133('0x32')];if(_0x189a01[_0x2133('0x34')][_0x2133('0x49')]){_0x48dfdb['include']=[{'all':!![]}];}_0x48dfdb=_[_0x2133('0x41')]({},_0x48dfdb,_0x189a01['options']);return db[_0x2133('0x42')][_0x2133('0x4a')](_0x48dfdb)[_0x2133('0x26')](handleEntityNotFound(_0xdea5ee,null))[_0x2133('0x26')](respondWithResult(_0xdea5ee,null))[_0x2133('0x45')](handleError(_0xdea5ee,null));};exports[_0x2133('0x4b')]=function(_0x396932,_0x428789){return db[_0x2133('0x42')][_0x2133('0x4b')](_0x396932[_0x2133('0x4c')],{})[_0x2133('0x26')](function(_0x50876f){var _0x3f7b58=_0x396932[_0x2133('0x4d')][_0x2133('0x27')]({'plain':!![]});if(!_0x3f7b58)throw new Error(_0x2133('0x4e'));if(_0x3f7b58[_0x2133('0x4f')]==='user'){var _0x34d007=_0x50876f[_0x2133('0x27')]({'plain':!![]});var _0x4381a0='ExtractedReports';return db['UserProfileSection'][_0x2133('0x4a')]({'where':{'name':_0x4381a0,'userProfileId':_0x3f7b58['userProfileId']},'raw':!![]})['then'](function(_0x31de36){if(_0x31de36&&_0x31de36[_0x2133('0x50')]===0x0){return db[_0x2133('0x29')][_0x2133('0x4b')]({'name':_0x34d007[_0x2133('0x2c')],'resourceId':_0x34d007['id'],'type':_0x31de36[_0x2133('0x2c')],'sectionId':_0x31de36['id']},{})[_0x2133('0x26')](function(){return _0x50876f;});}else{return _0x50876f;}})[_0x2133('0x45')](function(_0x416ab6){logger[_0x2133('0x2a')](_0x2133('0x51'),_0x416ab6);throw _0x416ab6;});}return _0x50876f;})[_0x2133('0x26')](respondWithResult(_0x428789,0xc9))[_0x2133('0x45')](handleError(_0x428789,null));};exports[_0x2133('0x52')]=function(_0xa31081,_0x12e42a){if(_0xa31081['body']['id']){delete _0xa31081[_0x2133('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x2133('0x4a')]({'where':{'id':_0xa31081[_0x2133('0x47')]['id']}})[_0x2133('0x26')](handleEntityNotFound(_0x12e42a,null))[_0x2133('0x26')](saveUpdates(_0xa31081[_0x2133('0x4c')],null))['then'](respondWithResult(_0x12e42a,null))['catch'](handleError(_0x12e42a,null));};exports['destroy']=function(_0x4d0f67,_0x5601c0){return db[_0x2133('0x42')][_0x2133('0x4a')]({'where':{'id':_0x4d0f67[_0x2133('0x47')]['id']}})[_0x2133('0x26')](handleEntityNotFound(_0x5601c0,null))[_0x2133('0x26')](removeEntity(_0x5601c0,null))['catch'](handleError(_0x5601c0,null));};exports['download']=function(_0x5e1e73,_0x5ecd02,_0x85f10c){return db['AnalyticExtractedReport'][_0x2133('0x4a')]({'where':{'id':_0x5e1e73[_0x2133('0x47')]['id']},'attributes':[_0x2133('0x2c'),_0x2133('0x53'),_0x2133('0x54'),'output'],'raw':!![]})[_0x2133('0x26')](handleEntityNotFound(_0x5ecd02,null))[_0x2133('0x26')](function(_0x3b9e75){if(_0x3b9e75){if(!fs[_0x2133('0x55')](path[_0x2133('0x56')](config[_0x2133('0x57')],_0x2133('0x58'),_0x3b9e75[_0x2133('0x54')]))){throw new db[(_0x2133('0x59'))][(_0x2133('0x5a'))](_0x2133('0x5b'));}if(_0x5e1e73['query'][_0x2133('0x5c')]){return _0x5ecd02[_0x2133('0x1b')](0xc8);}return _0x5ecd02[_0x2133('0x5d')](path[_0x2133('0x56')](config['root'],_0x2133('0x58'),_0x3b9e75[_0x2133('0x54')]),util[_0x2133('0x5e')](_0x2133('0x5f'),_0x3b9e75['basename']||_0x3b9e75['name'],_0x3b9e75[_0x2133('0x60')]['toLowerCase']()));}})[_0x2133('0x45')](handleError(_0x5ecd02,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b1f5dcf..b26d4cc 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 _0x8d95=['bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment'];(function(_0x53cdd0,_0x295197){var _0x1c9e2a=function(_0x3c01c8){while(--_0x3c01c8){_0x53cdd0['push'](_0x53cdd0['shift']());}};_0x1c9e2a(++_0x295197);}(_0x8d95,0x125));var _0x58d9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d95[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x58d9('0x0'));var util=require(_0x58d9('0x1'));var logger=require('../../config/logger')(_0x58d9('0x2'));var moment=require(_0x58d9('0x3'));var BPromise=require(_0x58d9('0x4'));var rp=require(_0x58d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58d9('0x6'));var config=require(_0x58d9('0x7'));var attributes=require(_0x58d9('0x8'));module['exports']=function(_0x5ed8e3,_0x2f03ad){return _0x5ed8e3['define'](_0x58d9('0x9'),attributes,{'tableName':_0x58d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9c=['request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','util','../../config/logger','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfe9c,0xed));var _0xcfe9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfe9c[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xcfe9('0x0'));var logger=require(_0xcfe9('0x1'))('api');var moment=require(_0xcfe9('0x2'));var BPromise=require('bluebird');var rp=require(_0xcfe9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfe9('0x4'));var config=require(_0xcfe9('0x5'));var attributes=require(_0xcfe9('0x6'));module[_0xcfe9('0x7')]=function(_0x32d2ea,_0x11f559){return _0x32d2ea[_0xcfe9('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xcfe9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 60b5b21..1223492 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 _0x1aab=['AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x1aab,0x122));var _0xb1aa=function(_0x353144,_0x2d83ed){_0x353144=_0x353144-0x0;var _0x44e823=_0x1aab[_0x353144];return _0x44e823;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var moment=require(_0xb1aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1aa('0x4'))['db'];var utils=require(_0xb1aa('0x5'));var logger=require(_0xb1aa('0x6'))(_0xb1aa('0x7'));var config=require(_0xb1aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277448,_0x13a350,_0x283ad6){return new BPromise(function(_0x3415f7,_0x405387){return client[_0xb1aa('0xa')](_0x277448,_0x283ad6)['then'](function(_0x12067d){logger[_0xb1aa('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x13a350,_0xb1aa('0xc'));logger[_0xb1aa('0xd')](_0xb1aa('0xe'),_0x13a350,_0xb1aa('0xc'),JSON[_0xb1aa('0xf')](_0x12067d));if(_0x12067d[_0xb1aa('0x10')]){if(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x11')]===0x1f4){logger[_0xb1aa('0x10')](_0xb1aa('0x12'),_0x13a350,_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);return _0x405387(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);}logger[_0xb1aa('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x13a350,_0x12067d['error'][_0xb1aa('0x13')]);return _0x3415f7(_0x12067d['error'][_0xb1aa('0x13')]);}else{logger['info'](_0xb1aa('0x12'),_0x13a350,'request\x20sent');_0x3415f7(_0x12067d[_0xb1aa('0x14')]['message']);}})[_0xb1aa('0x15')](function(_0x408bf8){logger['error'](_0xb1aa('0x12'),_0x13a350,_0x408bf8);_0x405387(_0x408bf8);});});} \ No newline at end of file +var _0x9daf=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird'];(function(_0x3eced4,_0x332120){var _0x2d98f9=function(_0x553b93){while(--_0x553b93){_0x3eced4['push'](_0x3eced4['shift']());}};_0x2d98f9(++_0x332120);}(_0x9daf,0x16d));var _0xf9da=function(_0x10a77f,_0x8575b0){_0x10a77f=_0x10a77f-0x0;var _0x40e612=_0x9daf[_0x10a77f];return _0x40e612;};'use strict';var _=require(_0xf9da('0x0'));var util=require(_0xf9da('0x1'));var moment=require('moment');var BPromise=require(_0xf9da('0x2'));var rs=require(_0xf9da('0x3'));var fs=require('fs');var Redis=require(_0xf9da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9da('0x5'));var logger=require(_0xf9da('0x6'))(_0xf9da('0x7'));var config=require(_0xf9da('0x8'));var jayson=require(_0xf9da('0x9'));var client=jayson[_0xf9da('0xa')][_0xf9da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398894,_0x1354e4,_0x11b24f){return new BPromise(function(_0x220f25,_0x213a32){return client[_0xf9da('0xc')](_0x398894,_0x11b24f)[_0xf9da('0xd')](function(_0x26e9ba){logger[_0xf9da('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1354e4,'request\x20sent');logger[_0xf9da('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1354e4,_0xf9da('0x10'),JSON[_0xf9da('0x11')](_0x26e9ba));if(_0x26e9ba[_0xf9da('0x12')]){if(_0x26e9ba['error']['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1354e4,_0x26e9ba[_0xf9da('0x12')][_0xf9da('0x13')]);return _0x213a32(_0x26e9ba[_0xf9da('0x12')]['message']);}logger[_0xf9da('0x12')](_0xf9da('0x14'),_0x1354e4,_0x26e9ba[_0xf9da('0x12')][_0xf9da('0x13')]);return _0x220f25(_0x26e9ba[_0xf9da('0x12')]['message']);}else{logger[_0xf9da('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1354e4,_0xf9da('0x10'));_0x220f25(_0x26e9ba[_0xf9da('0x15')][_0xf9da('0x13')]);}})[_0xf9da('0x16')](function(_0x3460a1){logger['error'](_0xf9da('0x14'),_0x1354e4,_0x3460a1);_0x213a32(_0x3460a1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a6ce12e..6f2c1b1 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 _0x152d=['exports','multer','util','connect-timeout','express','Router','fs-extra','./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','put','/:id','delete','destroy'];(function(_0x5018e1,_0xa4a296){var _0x33f310=function(_0x4f1d8a){while(--_0x4f1d8a){_0x5018e1['push'](_0x5018e1['shift']());}};_0x33f310(++_0xa4a296);}(_0x152d,0xde));var _0xd152=function(_0x47a246,_0xd07a63){_0x47a246=_0x47a246-0x0;var _0xc87538=_0x152d[_0x47a246];return _0xc87538;};'use strict';var multer=require(_0xd152('0x0'));var util=require(_0xd152('0x1'));var path=require('path');var timeout=require(_0xd152('0x2'));var express=require(_0xd152('0x3'));var router=express[_0xd152('0x4')]();var fs_extra=require(_0xd152('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd152('0x6'));router[_0xd152('0x7')]('/',auth[_0xd152('0x8')](),controller[_0xd152('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd152('0xa')]);router[_0xd152('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xd152('0xb')]);router['post']('/',auth[_0xd152('0x8')](),controller['create']);router[_0xd152('0xc')](_0xd152('0xd'),auth[_0xd152('0x8')](),controller['update']);router[_0xd152('0xe')]('/:id',auth[_0xd152('0x8')](),controller[_0xd152('0xf')]);module[_0xd152('0x10')]=router; \ No newline at end of file +var _0x32cf=['path','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x32cf,0x1ce));var _0xf32c=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x32cf[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf32c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf32c('0x1'));var config=require(_0xf32c('0x2'));var controller=require(_0xf32c('0x3'));router[_0xf32c('0x4')]('/',auth[_0xf32c('0x5')](),controller[_0xf32c('0x6')]);router['get'](_0xf32c('0x7'),auth[_0xf32c('0x5')](),controller[_0xf32c('0x8')]);router[_0xf32c('0x4')]('/:id/download',auth[_0xf32c('0x5')](),controller['download']);router[_0xf32c('0x9')]('/',auth[_0xf32c('0x5')](),controller[_0xf32c('0xa')]);router[_0xf32c('0xb')](_0xf32c('0x7'),auth[_0xf32c('0x5')](),controller['update']);router[_0xf32c('0xc')]('/:id',auth[_0xf32c('0x5')](),controller[_0xf32c('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 65389d8..3d86df0 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 _0x4c3d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4470c0,_0x5b9cd1){var _0x2c079a=function(_0x1a91c5){while(--_0x1a91c5){_0x4470c0['push'](_0x4470c0['shift']());}};_0x2c079a(++_0x5b9cd1);}(_0x4c3d,0x9f));var _0xd4c3=function(_0x1a2868,_0x2e0567){_0x1a2868=_0x1a2868-0x0;var _0x1778d4=_0x4c3d[_0x1a2868];return _0x1778d4;};'use strict';var Sequelize=require(_0xd4c3('0x0'));module[_0xd4c3('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd4c3('0x2')]},'function':{'type':Sequelize[_0xd4c3('0x2')]},'format':{'type':Sequelize[_0xd4c3('0x2')]},'groupBy':{'type':Sequelize[_0xd4c3('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xd4c3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x998d=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x597dc4,_0xad486c){var _0xa840d0=function(_0x2bdab1){while(--_0x2bdab1){_0x597dc4['push'](_0x597dc4['shift']());}};_0xa840d0(++_0xad486c);}(_0x998d,0x141));var _0xd998=function(_0x1e439b,_0x5b0474){_0x1e439b=_0x1e439b-0x0;var _0x520ab4=_0x998d[_0x1e439b];return _0x520ab4;};'use strict';var Sequelize=require(_0xd998('0x0'));module['exports']={'field':{'type':Sequelize[_0xd998('0x1')]},'alias':{'type':Sequelize[_0xd998('0x2')]},'function':{'type':Sequelize[_0xd998('0x2')]},'format':{'type':Sequelize[_0xd998('0x2')]},'groupBy':{'type':Sequelize[_0xd998('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xd998('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index eb086e4..afa2afd 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 _0x65dc=['map','AnalyticFieldReport','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index'];(function(_0x39551a,_0x116007){var _0x4b0b62=function(_0x3d8a12){while(--_0x3d8a12){_0x39551a['push'](_0x39551a['shift']());}};_0x4b0b62(++_0x116007);}(_0x65dc,0x7b));var _0xc65d=function(_0x3c0713,_0x118272){_0x3c0713=_0x3c0713-0x0;var _0xda81d3=_0x65dc[_0x3c0713];return _0xda81d3;};'use strict';var emlformat=require(_0xc65d('0x0'));var rimraf=require(_0xc65d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc65d('0x2'));var rp=require(_0xc65d('0x3'));var moment=require(_0xc65d('0x4'));var BPromise=require(_0xc65d('0x5'));var Mustache=require(_0xc65d('0x6'));var util=require(_0xc65d('0x7'));var path=require(_0xc65d('0x8'));var sox=require(_0xc65d('0x9'));var csv=require(_0xc65d('0xa'));var ejs=require(_0xc65d('0xb'));var fs=require('fs');var fs_extra=require(_0xc65d('0xc'));var _=require(_0xc65d('0xd'));var squel=require(_0xc65d('0xe'));var crypto=require('crypto');var jsforce=require(_0xc65d('0xf'));var deskjs=require(_0xc65d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc65d('0x11'));var Papa=require('papaparse');var Redis=require(_0xc65d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc65d('0x13'));var as=require(_0xc65d('0x14'));var hardwareService=require(_0xc65d('0x15'));var logger=require(_0xc65d('0x16'))(_0xc65d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc65d('0x18'))['db'];function respondWithStatusCode(_0x45cb88,_0x1e69c4){_0x1e69c4=_0x1e69c4||0xcc;return function(_0x42ff3c){if(_0x42ff3c){return _0x45cb88[_0xc65d('0x19')](_0x1e69c4);}return _0x45cb88[_0xc65d('0x1a')](_0x1e69c4)['end']();};}function respondWithResult(_0x56eb71,_0x2538e2){_0x2538e2=_0x2538e2||0xc8;return function(_0x3797cb){if(_0x3797cb){return _0x56eb71[_0xc65d('0x1a')](_0x2538e2)[_0xc65d('0x1b')](_0x3797cb);}};}function respondWithFilteredResult(_0x269513,_0x490203){return function(_0x29c950){if(_0x29c950){var _0x27e221=typeof _0x490203[_0xc65d('0x1c')]==='undefined'&&typeof _0x490203[_0xc65d('0x1d')]==='undefined';var _0x3eafd8=_0x29c950[_0xc65d('0x1e')];var _0x21cc66=_0x27e221?0x0:_0x490203['offset'];var _0x2cdc7f=_0x27e221?_0x29c950[_0xc65d('0x1e')]:_0x490203[_0xc65d('0x1c')]+_0x490203[_0xc65d('0x1d')];var _0x4545a8;if(_0x2cdc7f>=_0x3eafd8){_0x2cdc7f=_0x3eafd8;_0x4545a8=0xc8;}else{_0x4545a8=0xce;}_0x269513[_0xc65d('0x1a')](_0x4545a8);return _0x269513[_0xc65d('0x1f')](_0xc65d('0x20'),_0x21cc66+'-'+_0x2cdc7f+'/'+_0x3eafd8)['json'](_0x29c950);}return null;};}function patchUpdates(_0x3e3d88){return function(_0x4c7cb9){try{jsonpatch[_0xc65d('0x21')](_0x4c7cb9,_0x3e3d88,!![]);}catch(_0x21b3e9){return BPromise[_0xc65d('0x22')](_0x21b3e9);}return _0x4c7cb9[_0xc65d('0x23')]();};}function saveUpdates(_0x1953e5,_0x250895){return function(_0x17c33d){if(_0x17c33d){return _0x17c33d[_0xc65d('0x24')](_0x1953e5)[_0xc65d('0x25')](function(_0x1b6fb2){return _0x1b6fb2;});}return null;};}function removeEntity(_0x34d43e,_0x26a7e9){return function(_0x559d9a){if(_0x559d9a){return _0x559d9a[_0xc65d('0x26')]()[_0xc65d('0x25')](function(){_0x34d43e[_0xc65d('0x1a')](0xcc)[_0xc65d('0x27')]();});}};}function handleEntityNotFound(_0x22617e,_0x139d1f){return function(_0x520c9e){if(!_0x520c9e){_0x22617e[_0xc65d('0x19')](0x194);}return _0x520c9e;};}function handleError(_0x28f51c,_0x964a93){_0x964a93=_0x964a93||0x1f4;return function(_0x3cd14f){logger[_0xc65d('0x28')](_0x3cd14f[_0xc65d('0x29')]);if(_0x3cd14f[_0xc65d('0x2a')]){delete _0x3cd14f[_0xc65d('0x2a')];}_0x28f51c[_0xc65d('0x1a')](_0x964a93)[_0xc65d('0x2b')](_0x3cd14f);};}exports[_0xc65d('0x2c')]=function(_0x58c26a,_0x22ed18){var _0x2d3c61={},_0x26e6b2={},_0x5e95d5={'count':0x0,'rows':[]};var _0x158c31=_[_0xc65d('0x2d')](db[_0xc65d('0x2e')]['rawAttributes'],function(_0x10f6b5){return{'name':_0x10f6b5['fieldName'],'type':_0x10f6b5[_0xc65d('0x2f')][_0xc65d('0x30')]};});_0x26e6b2[_0xc65d('0x31')]=_[_0xc65d('0x2d')](_0x158c31,_0xc65d('0x2a'));_0x26e6b2[_0xc65d('0x32')]=_['keys'](_0x58c26a['query']);_0x26e6b2[_0xc65d('0x33')]=_['intersection'](_0x26e6b2[_0xc65d('0x31')],_0x26e6b2['query']);_0x2d3c61[_0xc65d('0x34')]=_[_0xc65d('0x35')](_0x26e6b2[_0xc65d('0x31')],qs[_0xc65d('0x36')](_0x58c26a[_0xc65d('0x32')]['fields']));_0x2d3c61[_0xc65d('0x34')]=_0x2d3c61[_0xc65d('0x34')][_0xc65d('0x37')]?_0x2d3c61[_0xc65d('0x34')]:_0x26e6b2[_0xc65d('0x31')];if(!_0x58c26a[_0xc65d('0x32')][_0xc65d('0x38')](_0xc65d('0x39'))){_0x2d3c61[_0xc65d('0x1d')]=qs[_0xc65d('0x1d')](_0x58c26a[_0xc65d('0x32')][_0xc65d('0x1d')]);_0x2d3c61['offset']=qs[_0xc65d('0x1c')](_0x58c26a[_0xc65d('0x32')][_0xc65d('0x1c')]);}_0x2d3c61['order']=qs[_0xc65d('0x3a')](_0x58c26a[_0xc65d('0x32')][_0xc65d('0x3a')]);_0x2d3c61[_0xc65d('0x3b')]=qs[_0xc65d('0x33')](_['pick'](_0x58c26a[_0xc65d('0x32')],_0x26e6b2[_0xc65d('0x33')]),_0x158c31);if(_0x58c26a['query'][_0xc65d('0x3c')]){_0x2d3c61['where']=_[_0xc65d('0x3d')](_0x2d3c61['where'],{'$or':_[_0xc65d('0x2d')](_0x158c31,function(_0x2157d0){if(_0x2157d0[_0xc65d('0x2f')]!==_0xc65d('0x3e')){var _0x141693={};_0x141693[_0x2157d0[_0xc65d('0x2a')]]={'$like':'%'+_0x58c26a[_0xc65d('0x32')][_0xc65d('0x3c')]+'%'};return _0x141693;}})});}_0x2d3c61=_[_0xc65d('0x3d')]({},_0x2d3c61,_0x58c26a[_0xc65d('0x3f')]);var _0x1c8ba9={'where':_0x2d3c61[_0xc65d('0x3b')]};return db[_0xc65d('0x2e')][_0xc65d('0x1e')](_0x1c8ba9)[_0xc65d('0x25')](function(_0x2fa22a){_0x5e95d5['count']=_0x2fa22a;if(_0x58c26a[_0xc65d('0x32')][_0xc65d('0x40')]){_0x2d3c61['include']=[{'all':!![]}];}return db[_0xc65d('0x2e')][_0xc65d('0x41')](_0x2d3c61);})[_0xc65d('0x25')](function(_0x951134){_0x5e95d5[_0xc65d('0x42')]=_0x951134;return _0x5e95d5;})[_0xc65d('0x25')](respondWithFilteredResult(_0x22ed18,_0x2d3c61))[_0xc65d('0x43')](handleError(_0x22ed18,null));};exports[_0xc65d('0x44')]=function(_0x464453,_0x3fd539){var _0x4af250={'raw':![],'where':{'id':_0x464453['params']['id']}},_0x343bf2={};_0x343bf2['model']=_[_0xc65d('0x45')](db[_0xc65d('0x2e')][_0xc65d('0x46')]);_0x343bf2['query']=_['keys'](_0x464453[_0xc65d('0x32')]);_0x343bf2[_0xc65d('0x33')]=_[_0xc65d('0x35')](_0x343bf2['model'],_0x343bf2[_0xc65d('0x32')]);_0x4af250[_0xc65d('0x34')]=_[_0xc65d('0x35')](_0x343bf2[_0xc65d('0x31')],qs[_0xc65d('0x36')](_0x464453['query'][_0xc65d('0x36')]));_0x4af250['attributes']=_0x4af250[_0xc65d('0x34')][_0xc65d('0x37')]?_0x4af250[_0xc65d('0x34')]:_0x343bf2[_0xc65d('0x31')];if(_0x464453[_0xc65d('0x32')][_0xc65d('0x40')]){_0x4af250[_0xc65d('0x47')]=[{'all':!![]}];}_0x4af250=_[_0xc65d('0x3d')]({},_0x4af250,_0x464453[_0xc65d('0x3f')]);return db[_0xc65d('0x2e')][_0xc65d('0x48')](_0x4af250)[_0xc65d('0x25')](handleEntityNotFound(_0x3fd539,null))[_0xc65d('0x25')](respondWithResult(_0x3fd539,null))['catch'](handleError(_0x3fd539,null));};exports[_0xc65d('0x49')]=function(_0x112991,_0x8b6243){return db['AnalyticFieldReport'][_0xc65d('0x49')](_0x112991[_0xc65d('0x4a')],{})['then'](respondWithResult(_0x8b6243,0xc9))['catch'](handleError(_0x8b6243,null));};exports['bulkCreate']=function(_0x5a2e14,_0x361514){return db['AnalyticFieldReport']['bulkCreate'](_0x5a2e14['body'],{'raw':![],'individualHooks':!![]})[_0xc65d('0x25')](respondWithResult(_0x361514,0xc9))[_0xc65d('0x43')](handleError(_0x361514,null));};exports[_0xc65d('0x24')]=function(_0x2f23a5,_0x4aea8c){if(_0x2f23a5[_0xc65d('0x4a')]['id']){delete _0x2f23a5[_0xc65d('0x4a')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x2f23a5[_0xc65d('0x4b')]['id']}})[_0xc65d('0x25')](handleEntityNotFound(_0x4aea8c,null))['then'](saveUpdates(_0x2f23a5[_0xc65d('0x4a')],null))[_0xc65d('0x25')](respondWithResult(_0x4aea8c,null))[_0xc65d('0x43')](handleError(_0x4aea8c,null));};exports[_0xc65d('0x26')]=function(_0x4c0b92,_0x599516){return db[_0xc65d('0x2e')]['find']({'where':{'id':_0x4c0b92[_0xc65d('0x4b')]['id']}})[_0xc65d('0x25')](handleEntityNotFound(_0x599516,null))[_0xc65d('0x25')](removeEntity(_0x599516,null))['catch'](handleError(_0x599516,null));};exports[_0xc65d('0x4c')]=function(_0x10c363,_0x43226f){return db[_0xc65d('0x2e')][_0xc65d('0x26')]({'where':{'id':_0x10c363[_0xc65d('0x32')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xc65d('0x25')](respondWithResult(_0x43226f,0xcc))[_0xc65d('0x43')](handleError(_0x43226f,null));};exports[_0xc65d('0x4d')]=function(_0x4fbded,_0x1ce544,_0x35e9ad){return db[_0xc65d('0x4e')][_0xc65d('0x4f')]({'where':{'id':_0x4fbded[_0xc65d('0x4b')]['id']}})[_0xc65d('0x25')](handleEntityNotFound(_0x1ce544,null))['then'](function(_0x451eb6){if(_0x451eb6){return db[_0xc65d('0x50')][_0xc65d('0x51')](function(_0x417725){return db[_0xc65d('0x2e')]['destroy']({'where':{'CustomReportId':_0x4fbded[_0xc65d('0x4b')]['id']},'transaction':_0x417725})['then'](function(_0x522426){var _0x28ff68=_['map'](_0x4fbded[_0xc65d('0x4a')],function(_0x732f99){delete _0x732f99['id'];_0x732f99[_0xc65d('0x52')]=_0x4fbded[_0xc65d('0x4b')]['id'];return _0x732f99;});return db[_0xc65d('0x2e')][_0xc65d('0x53')](_0x28ff68,{'transaction':_0x417725});});})[_0xc65d('0x25')](function(){return db[_0xc65d('0x2e')][_0xc65d('0x41')]({'where':{'CustomReportId':_0x4fbded['params']['id']}});});}})[_0xc65d('0x25')](respondWithResult(_0x1ce544,null))[_0xc65d('0x43')](handleError(_0x1ce544,null));}; \ No newline at end of file +var _0xcde2=['findAll','rows','catch','show','params','keys','length','includeAll','include','create','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0xcde2,0xfa));var _0x2cde=function(_0x356f7c,_0x5aea08){_0x356f7c=_0x356f7c-0x0;var _0x47049d=_0xcde2[_0x356f7c];return _0x47049d;};'use strict';var emlformat=require(_0x2cde('0x0'));var rimraf=require(_0x2cde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cde('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2cde('0x3'));var Mustache=require(_0x2cde('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2cde('0x5'));var csv=require(_0x2cde('0x6'));var ejs=require(_0x2cde('0x7'));var fs=require('fs');var fs_extra=require(_0x2cde('0x8'));var _=require(_0x2cde('0x9'));var squel=require(_0x2cde('0xa'));var crypto=require(_0x2cde('0xb'));var jsforce=require(_0x2cde('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2cde('0x6'));var querystring=require(_0x2cde('0xd'));var Papa=require(_0x2cde('0xe'));var Redis=require('ioredis');var authService=require(_0x2cde('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cde('0x10'))(_0x2cde('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cde('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2fec,_0x41833d){_0x41833d=_0x41833d||0xcc;return function(_0xce2f83){if(_0xce2f83){return _0x4c2fec[_0x2cde('0x13')](_0x41833d);}return _0x4c2fec['status'](_0x41833d)[_0x2cde('0x14')]();};}function respondWithResult(_0x629f46,_0x4a5488){_0x4a5488=_0x4a5488||0xc8;return function(_0x1028d4){if(_0x1028d4){return _0x629f46['status'](_0x4a5488)['json'](_0x1028d4);}};}function respondWithFilteredResult(_0x144c04,_0x30cbae){return function(_0x47f154){if(_0x47f154){var _0xce713f=typeof _0x30cbae[_0x2cde('0x15')]===_0x2cde('0x16')&&typeof _0x30cbae[_0x2cde('0x17')]===_0x2cde('0x16');var _0x251012=_0x47f154['count'];var _0x521e34=_0xce713f?0x0:_0x30cbae[_0x2cde('0x15')];var _0x5c70a9=_0xce713f?_0x47f154[_0x2cde('0x18')]:_0x30cbae[_0x2cde('0x15')]+_0x30cbae[_0x2cde('0x17')];var _0x256ce0;if(_0x5c70a9>=_0x251012){_0x5c70a9=_0x251012;_0x256ce0=0xc8;}else{_0x256ce0=0xce;}_0x144c04[_0x2cde('0x19')](_0x256ce0);return _0x144c04['set'](_0x2cde('0x1a'),_0x521e34+'-'+_0x5c70a9+'/'+_0x251012)[_0x2cde('0x1b')](_0x47f154);}return null;};}function patchUpdates(_0x8bd0bd){return function(_0x4b3be4){try{jsonpatch['apply'](_0x4b3be4,_0x8bd0bd,!![]);}catch(_0x33661a){return BPromise[_0x2cde('0x1c')](_0x33661a);}return _0x4b3be4[_0x2cde('0x1d')]();};}function saveUpdates(_0x5425c4,_0x319ad5){return function(_0x2a81d7){if(_0x2a81d7){return _0x2a81d7[_0x2cde('0x1e')](_0x5425c4)['then'](function(_0x1a19de){return _0x1a19de;});}return null;};}function removeEntity(_0x42e419,_0x19063c){return function(_0x2e7574){if(_0x2e7574){return _0x2e7574[_0x2cde('0x1f')]()[_0x2cde('0x20')](function(){_0x42e419[_0x2cde('0x19')](0xcc)[_0x2cde('0x14')]();});}};}function handleEntityNotFound(_0xc5749d,_0x1a9efd){return function(_0x1602e5){if(!_0x1602e5){_0xc5749d['sendStatus'](0x194);}return _0x1602e5;};}function handleError(_0x2b715c,_0x285c6e){_0x285c6e=_0x285c6e||0x1f4;return function(_0x3ebe9c){logger[_0x2cde('0x21')](_0x3ebe9c[_0x2cde('0x22')]);if(_0x3ebe9c[_0x2cde('0x23')]){delete _0x3ebe9c[_0x2cde('0x23')];}_0x2b715c[_0x2cde('0x19')](_0x285c6e)[_0x2cde('0x24')](_0x3ebe9c);};}exports['index']=function(_0x4c0042,_0x6e85e1){var _0x2b1c9e={},_0x5eb9c1={},_0x446dd4={'count':0x0,'rows':[]};var _0x3a94f4=_[_0x2cde('0x25')](db[_0x2cde('0x26')][_0x2cde('0x27')],function(_0x1ba24d){return{'name':_0x1ba24d[_0x2cde('0x28')],'type':_0x1ba24d[_0x2cde('0x29')][_0x2cde('0x2a')]};});_0x5eb9c1[_0x2cde('0x2b')]=_[_0x2cde('0x25')](_0x3a94f4,_0x2cde('0x23'));_0x5eb9c1[_0x2cde('0x2c')]=_['keys'](_0x4c0042[_0x2cde('0x2c')]);_0x5eb9c1[_0x2cde('0x2d')]=_[_0x2cde('0x2e')](_0x5eb9c1[_0x2cde('0x2b')],_0x5eb9c1['query']);_0x2b1c9e['attributes']=_['intersection'](_0x5eb9c1['model'],qs['fields'](_0x4c0042[_0x2cde('0x2c')][_0x2cde('0x2f')]));_0x2b1c9e['attributes']=_0x2b1c9e[_0x2cde('0x30')]['length']?_0x2b1c9e['attributes']:_0x5eb9c1[_0x2cde('0x2b')];if(!_0x4c0042[_0x2cde('0x2c')][_0x2cde('0x31')]('nolimit')){_0x2b1c9e[_0x2cde('0x17')]=qs[_0x2cde('0x17')](_0x4c0042[_0x2cde('0x2c')][_0x2cde('0x17')]);_0x2b1c9e[_0x2cde('0x15')]=qs[_0x2cde('0x15')](_0x4c0042['query'][_0x2cde('0x15')]);}_0x2b1c9e[_0x2cde('0x32')]=qs[_0x2cde('0x33')](_0x4c0042[_0x2cde('0x2c')][_0x2cde('0x33')]);_0x2b1c9e['where']=qs['filters'](_[_0x2cde('0x34')](_0x4c0042['query'],_0x5eb9c1[_0x2cde('0x2d')]),_0x3a94f4);if(_0x4c0042[_0x2cde('0x2c')][_0x2cde('0x35')]){_0x2b1c9e[_0x2cde('0x36')]=_[_0x2cde('0x37')](_0x2b1c9e[_0x2cde('0x36')],{'$or':_[_0x2cde('0x25')](_0x3a94f4,function(_0x9b6b17){if(_0x9b6b17[_0x2cde('0x29')]!==_0x2cde('0x38')){var _0xcafaca={};_0xcafaca[_0x9b6b17[_0x2cde('0x23')]]={'$like':'%'+_0x4c0042[_0x2cde('0x2c')]['filter']+'%'};return _0xcafaca;}})});}_0x2b1c9e=_[_0x2cde('0x37')]({},_0x2b1c9e,_0x4c0042[_0x2cde('0x39')]);var _0x52a29a={'where':_0x2b1c9e['where']};return db[_0x2cde('0x26')][_0x2cde('0x18')](_0x52a29a)['then'](function(_0x92bcf6){_0x446dd4['count']=_0x92bcf6;if(_0x4c0042[_0x2cde('0x2c')]['includeAll']){_0x2b1c9e['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x2cde('0x3a')](_0x2b1c9e);})[_0x2cde('0x20')](function(_0x536ddb){_0x446dd4[_0x2cde('0x3b')]=_0x536ddb;return _0x446dd4;})[_0x2cde('0x20')](respondWithFilteredResult(_0x6e85e1,_0x2b1c9e))[_0x2cde('0x3c')](handleError(_0x6e85e1,null));};exports[_0x2cde('0x3d')]=function(_0x12d0af,_0x46df0d){var _0x5d4f6b={'raw':![],'where':{'id':_0x12d0af[_0x2cde('0x3e')]['id']}},_0x2ff2e={};_0x2ff2e[_0x2cde('0x2b')]=_[_0x2cde('0x3f')](db['AnalyticFieldReport'][_0x2cde('0x27')]);_0x2ff2e[_0x2cde('0x2c')]=_[_0x2cde('0x3f')](_0x12d0af[_0x2cde('0x2c')]);_0x2ff2e[_0x2cde('0x2d')]=_[_0x2cde('0x2e')](_0x2ff2e[_0x2cde('0x2b')],_0x2ff2e[_0x2cde('0x2c')]);_0x5d4f6b[_0x2cde('0x30')]=_[_0x2cde('0x2e')](_0x2ff2e[_0x2cde('0x2b')],qs[_0x2cde('0x2f')](_0x12d0af['query'][_0x2cde('0x2f')]));_0x5d4f6b[_0x2cde('0x30')]=_0x5d4f6b[_0x2cde('0x30')][_0x2cde('0x40')]?_0x5d4f6b[_0x2cde('0x30')]:_0x2ff2e[_0x2cde('0x2b')];if(_0x12d0af[_0x2cde('0x2c')][_0x2cde('0x41')]){_0x5d4f6b[_0x2cde('0x42')]=[{'all':!![]}];}_0x5d4f6b=_[_0x2cde('0x37')]({},_0x5d4f6b,_0x12d0af['options']);return db[_0x2cde('0x26')]['find'](_0x5d4f6b)['then'](handleEntityNotFound(_0x46df0d,null))['then'](respondWithResult(_0x46df0d,null))[_0x2cde('0x3c')](handleError(_0x46df0d,null));};exports[_0x2cde('0x43')]=function(_0x1cece9,_0x1e62d5){return db[_0x2cde('0x26')][_0x2cde('0x43')](_0x1cece9[_0x2cde('0x44')],{})['then'](respondWithResult(_0x1e62d5,0xc9))[_0x2cde('0x3c')](handleError(_0x1e62d5,null));};exports[_0x2cde('0x45')]=function(_0x58020a,_0x57a1d7){return db[_0x2cde('0x26')][_0x2cde('0x45')](_0x58020a[_0x2cde('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x57a1d7,0xc9))['catch'](handleError(_0x57a1d7,null));};exports[_0x2cde('0x1e')]=function(_0x8c8ec8,_0x54c587){if(_0x8c8ec8[_0x2cde('0x44')]['id']){delete _0x8c8ec8[_0x2cde('0x44')]['id'];}return db[_0x2cde('0x26')]['find']({'where':{'id':_0x8c8ec8[_0x2cde('0x3e')]['id']}})[_0x2cde('0x20')](handleEntityNotFound(_0x54c587,null))[_0x2cde('0x20')](saveUpdates(_0x8c8ec8[_0x2cde('0x44')],null))[_0x2cde('0x20')](respondWithResult(_0x54c587,null))[_0x2cde('0x3c')](handleError(_0x54c587,null));};exports[_0x2cde('0x1f')]=function(_0x4797c0,_0x24dfe4){return db['AnalyticFieldReport'][_0x2cde('0x46')]({'where':{'id':_0x4797c0[_0x2cde('0x3e')]['id']}})[_0x2cde('0x20')](handleEntityNotFound(_0x24dfe4,null))[_0x2cde('0x20')](removeEntity(_0x24dfe4,null))[_0x2cde('0x3c')](handleError(_0x24dfe4,null));};exports[_0x2cde('0x47')]=function(_0x943f3a,_0x4af3ee){return db[_0x2cde('0x26')][_0x2cde('0x1f')]({'where':{'id':_0x943f3a['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x2cde('0x20')](respondWithResult(_0x4af3ee,0xcc))[_0x2cde('0x3c')](handleError(_0x4af3ee,null));};exports[_0x2cde('0x48')]=function(_0xd1364d,_0x37ca40,_0x13eb61){return db[_0x2cde('0x49')][_0x2cde('0x4a')]({'where':{'id':_0xd1364d[_0x2cde('0x3e')]['id']}})[_0x2cde('0x20')](handleEntityNotFound(_0x37ca40,null))[_0x2cde('0x20')](function(_0x3c454b){if(_0x3c454b){return db[_0x2cde('0x4b')]['transaction'](function(_0x26c7f3){return db[_0x2cde('0x26')][_0x2cde('0x1f')]({'where':{'CustomReportId':_0xd1364d['params']['id']},'transaction':_0x26c7f3})[_0x2cde('0x20')](function(_0x370d67){var _0x2d1dd6=_[_0x2cde('0x25')](_0xd1364d[_0x2cde('0x44')],function(_0xabe860){delete _0xabe860['id'];_0xabe860[_0x2cde('0x4c')]=_0xd1364d[_0x2cde('0x3e')]['id'];return _0xabe860;});return db[_0x2cde('0x26')][_0x2cde('0x45')](_0x2d1dd6,{'transaction':_0x26c7f3});});})[_0x2cde('0x20')](function(){return db[_0x2cde('0x26')][_0x2cde('0x3a')]({'where':{'CustomReportId':_0xd1364d['params']['id']}});});}})['then'](respondWithResult(_0x37ca40,null))['catch'](handleError(_0x37ca40,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 31b9371..c85f25b 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 _0x512c=['./analyticFieldReport.attributes','define','analytics_report_fields','../../config/logger','api','moment','bluebird','path'];(function(_0x4a5ba6,_0x103eb9){var _0x23831=function(_0x19dffc){while(--_0x19dffc){_0x4a5ba6['push'](_0x4a5ba6['shift']());}};_0x23831(++_0x103eb9);}(_0x512c,0x13b));var _0xc512=function(_0x176c29,_0x31b30a){_0x176c29=_0x176c29-0x0;var _0x553834=_0x512c[_0x176c29];return _0x553834;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc512('0x0'))(_0xc512('0x1'));var moment=require(_0xc512('0x2'));var BPromise=require(_0xc512('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc512('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc512('0x5'));module['exports']=function(_0xb4f59d,_0x46c5b6){return _0xb4f59d[_0xc512('0x6')]('AnalyticFieldReport',attributes,{'tableName':_0xc512('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4854=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0xfd8fef,_0x1a6a1b){var _0x3a7b60=function(_0x40560b){while(--_0x40560b){_0xfd8fef['push'](_0xfd8fef['shift']());}};_0x3a7b60(++_0x1a6a1b);}(_0x4854,0x87));var _0x4485=function(_0x2272c3,_0x4e81bc){_0x2272c3=_0x2272c3-0x0;var _0x43645f=_0x4854[_0x2272c3];return _0x43645f;};'use strict';var _=require(_0x4485('0x0'));var util=require(_0x4485('0x1'));var logger=require(_0x4485('0x2'))(_0x4485('0x3'));var moment=require(_0x4485('0x4'));var BPromise=require(_0x4485('0x5'));var rp=require(_0x4485('0x6'));var fs=require('fs');var path=require(_0x4485('0x7'));var rimraf=require(_0x4485('0x8'));var config=require(_0x4485('0x9'));var attributes=require(_0x4485('0xa'));module[_0x4485('0xb')]=function(_0x42422a,_0x4a35a0){return _0x42422a['define'](_0x4485('0xc'),attributes,{'tableName':_0x4485('0xd'),'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 c35ac59..2bf3851 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 _0xfdc5=['code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23db04,_0x16800f){var _0x80db9d=function(_0x11562d){while(--_0x11562d){_0x23db04['push'](_0x23db04['shift']());}};_0x80db9d(++_0x16800f);}(_0xfdc5,0xb5));var _0x5fdc=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xfdc5[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x5fdc('0x0'));var util=require(_0x5fdc('0x1'));var moment=require('moment');var BPromise=require(_0x5fdc('0x2'));var rs=require(_0x5fdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fdc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fdc('0x5'))(_0x5fdc('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fdc('0x7'));var client=jayson[_0x5fdc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e395e,_0xd11245,_0x233c92){return new BPromise(function(_0xb20af8,_0x3b4aa1){return client[_0x5fdc('0x9')](_0x3e395e,_0x233c92)[_0x5fdc('0xa')](function(_0x4b868d){logger['info'](_0x5fdc('0xb'),_0xd11245,_0x5fdc('0xc'));logger[_0x5fdc('0xd')](_0x5fdc('0xe'),_0xd11245,_0x5fdc('0xc'),JSON[_0x5fdc('0xf')](_0x4b868d));if(_0x4b868d[_0x5fdc('0x10')]){if(_0x4b868d[_0x5fdc('0x10')][_0x5fdc('0x11')]===0x1f4){logger['error'](_0x5fdc('0xb'),_0xd11245,_0x4b868d[_0x5fdc('0x10')][_0x5fdc('0x12')]);return _0x3b4aa1(_0x4b868d[_0x5fdc('0x10')]['message']);}logger[_0x5fdc('0x10')](_0x5fdc('0xb'),_0xd11245,_0x4b868d['error']['message']);return _0xb20af8(_0x4b868d['error'][_0x5fdc('0x12')]);}else{logger[_0x5fdc('0x13')](_0x5fdc('0xb'),_0xd11245,'request\x20sent');_0xb20af8(_0x4b868d[_0x5fdc('0x14')][_0x5fdc('0x12')]);}})[_0x5fdc('0x15')](function(_0xccede4){logger[_0x5fdc('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd11245,_0xccede4);_0x3b4aa1(_0xccede4);});});} \ No newline at end of file +var _0x08af=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1a68ec,_0xaae337){var _0x2314d1=function(_0x2521db){while(--_0x2521db){_0x1a68ec['push'](_0x1a68ec['shift']());}};_0x2314d1(++_0xaae337);}(_0x08af,0xee));var _0xf08a=function(_0x45fc9c,_0x70f2cb){_0x45fc9c=_0x45fc9c-0x0;var _0x984946=_0x08af[_0x45fc9c];return _0x984946;};'use strict';var _=require(_0xf08a('0x0'));var util=require(_0xf08a('0x1'));var moment=require(_0xf08a('0x2'));var BPromise=require(_0xf08a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf08a('0x4'))['db'];var utils=require(_0xf08a('0x5'));var logger=require(_0xf08a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf08a('0x7'));var client=jayson[_0xf08a('0x8')][_0xf08a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373bed,_0x1cd9cb,_0x48daa0){return new BPromise(function(_0x13c644,_0x16a5c1){return client[_0xf08a('0xa')](_0x373bed,_0x48daa0)[_0xf08a('0xb')](function(_0x248cf7){logger[_0xf08a('0xc')](_0xf08a('0xd'),_0x1cd9cb,_0xf08a('0xe'));logger[_0xf08a('0xf')](_0xf08a('0x10'),_0x1cd9cb,_0xf08a('0xe'),JSON[_0xf08a('0x11')](_0x248cf7));if(_0x248cf7[_0xf08a('0x12')]){if(_0x248cf7[_0xf08a('0x12')][_0xf08a('0x13')]===0x1f4){logger[_0xf08a('0x12')](_0xf08a('0xd'),_0x1cd9cb,_0x248cf7['error'][_0xf08a('0x14')]);return _0x16a5c1(_0x248cf7[_0xf08a('0x12')][_0xf08a('0x14')]);}logger[_0xf08a('0x12')](_0xf08a('0xd'),_0x1cd9cb,_0x248cf7[_0xf08a('0x12')]['message']);return _0x13c644(_0x248cf7[_0xf08a('0x12')][_0xf08a('0x14')]);}else{logger[_0xf08a('0xc')](_0xf08a('0xd'),_0x1cd9cb,_0xf08a('0xe'));_0x13c644(_0x248cf7[_0xf08a('0x15')][_0xf08a('0x14')]);}})[_0xf08a('0x16')](function(_0x294e6a){logger[_0xf08a('0x12')](_0xf08a('0xd'),_0x1cd9cb,_0x294e6a);_0x16a5c1(_0x294e6a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f7b5a39..2fa9403 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(_0x32f20e,_0x5b7a1e){var _0x457e79=function(_0x34f608){while(--_0x34f608){_0x32f20e['push'](_0x32f20e['shift']());}};_0x457e79(++_0x5b7a1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0xe9fca1,_0x5ba251){var _0x55ae32=function(_0x553090){while(--_0x553090){_0xe9fca1['push'](_0xe9fca1['shift']());}};_0x55ae32(++_0x5ba251);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 21b8e3e..bddf39f 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 _0x0caf=['name','STRING','TEXT'];(function(_0x44ba8a,_0x19c5ea){var _0x2ac7fb=function(_0x225dd4){while(--_0x225dd4){_0x44ba8a['push'](_0x44ba8a['shift']());}};_0x2ac7fb(++_0x19c5ea);}(_0x0caf,0x9f));var _0xf0ca=function(_0x5e9f37,_0xfcd535){_0x5e9f37=_0x5e9f37-0x0;var _0xe1304f=_0x0caf[_0x5e9f37];return _0xe1304f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf0ca('0x0')},'table':{'type':Sequelize[_0xf0ca('0x1')]},'metric':{'type':Sequelize[_0xf0ca('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4dd3=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dd3,0xf5));var _0x34dd=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x4dd3[_0x553a87];return _0x12d1e6;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'name':{'type':Sequelize[_0x34dd('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x34dd('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a0bcf5a..957d54b 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x2b8aa1,_0x29699b){var _0x170363=function(_0x471bd2){while(--_0x471bd2){_0x2b8aa1['push'](_0x2b8aa1['shift']());}};_0x170363(++_0x29699b);}(_0x9a19,0x114));var _0x99a1=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x9a19[_0x1f7413];return _0x2d2775;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x1fdcf5,_0x2f416d){var _0x45fdfa=function(_0x1d6d7f){while(--_0x1d6d7f){_0x1fdcf5['push'](_0x1fdcf5['shift']());}};_0x45fdfa(++_0x2f416d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x24ca[_0x531d15];return _0x271a18;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ccf12a7..cf3d5a8 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 _0x0d91=['analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x6caff4,_0x480025){var _0x358739=function(_0x2839ef){while(--_0x2839ef){_0x6caff4['push'](_0x6caff4['shift']());}};_0x358739(++_0x480025);}(_0x0d91,0x76));var _0x10d9=function(_0x57746e,_0x45093f){_0x57746e=_0x57746e-0x0;var _0x5caeaa=_0x0d91[_0x57746e];return _0x5caeaa;};'use strict';var _=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var logger=require(_0x10d9('0x2'))(_0x10d9('0x3'));var moment=require('moment');var BPromise=require(_0x10d9('0x4'));var rp=require(_0x10d9('0x5'));var fs=require('fs');var path=require(_0x10d9('0x6'));var rimraf=require('rimraf');var config=require(_0x10d9('0x7'));var attributes=require(_0x10d9('0x8'));module[_0x10d9('0x9')]=function(_0x4d89f0,_0x3cc578){return _0x4d89f0[_0x10d9('0xa')](_0x10d9('0xb'),attributes,{'tableName':_0x10d9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x647c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x44e333,_0x586055){var _0x4c8d19=function(_0x3e9a6b){while(--_0x3e9a6b){_0x44e333['push'](_0x44e333['shift']());}};_0x4c8d19(++_0x586055);}(_0x647c,0x1d3));var _0xc647=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x647c[_0x25d4e5];return _0x44d116;};'use strict';var _=require(_0xc647('0x0'));var util=require('util');var logger=require(_0xc647('0x1'))(_0xc647('0x2'));var moment=require('moment');var BPromise=require(_0xc647('0x3'));var rp=require(_0xc647('0x4'));var fs=require('fs');var path=require(_0xc647('0x5'));var rimraf=require(_0xc647('0x6'));var config=require(_0xc647('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xc647('0x8')]=function(_0x202fea,_0x19bfae){return _0x202fea[_0xc647('0x9')](_0xc647('0xa'),attributes,{'tableName':_0xc647('0xb'),'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 b7b87a4..eb35673 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 _0x9486=['result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9486,0xd2));var _0x6948=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9486[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var moment=require(_0x6948('0x2'));var BPromise=require(_0x6948('0x3'));var rs=require(_0x6948('0x4'));var fs=require('fs');var Redis=require(_0x6948('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6948('0x6'));var logger=require('../../config/logger')(_0x6948('0x7'));var config=require(_0x6948('0x8'));var jayson=require(_0x6948('0x9'));var client=jayson[_0x6948('0xa')][_0x6948('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x803c27,_0x16b95c,_0x322192){return new BPromise(function(_0x54c0bf,_0xc3fce6){return client['request'](_0x803c27,_0x322192)[_0x6948('0xc')](function(_0x38d599){logger[_0x6948('0xd')](_0x6948('0xe'),_0x16b95c,_0x6948('0xf'));logger[_0x6948('0x10')](_0x6948('0x11'),_0x16b95c,_0x6948('0xf'),JSON['stringify'](_0x38d599));if(_0x38d599[_0x6948('0x12')]){if(_0x38d599['error'][_0x6948('0x13')]===0x1f4){logger['error'](_0x6948('0xe'),_0x16b95c,_0x38d599[_0x6948('0x12')]['message']);return _0xc3fce6(_0x38d599[_0x6948('0x12')]['message']);}logger[_0x6948('0x12')](_0x6948('0xe'),_0x16b95c,_0x38d599[_0x6948('0x12')]['message']);return _0x54c0bf(_0x38d599['error']['message']);}else{logger[_0x6948('0xd')](_0x6948('0xe'),_0x16b95c,_0x6948('0xf'));_0x54c0bf(_0x38d599[_0x6948('0x14')][_0x6948('0x15')]);}})[_0x6948('0x16')](function(_0x14f224){logger['error'](_0x6948('0xe'),_0x16b95c,_0x14f224);_0xc3fce6(_0x14f224);});});} \ No newline at end of file +var _0xb93c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','moment'];(function(_0x23648b,_0x51a25f){var _0x2b5a63=function(_0x227cfe){while(--_0x227cfe){_0x23648b['push'](_0x23648b['shift']());}};_0x2b5a63(++_0x51a25f);}(_0xb93c,0x116));var _0xcb93=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb93c[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0xcb93('0x0'));var util=require('util');var moment=require(_0xcb93('0x1'));var BPromise=require(_0xcb93('0x2'));var rs=require(_0xcb93('0x3'));var fs=require('fs');var Redis=require(_0xcb93('0x4'));var db=require(_0xcb93('0x5'))['db'];var utils=require(_0xcb93('0x6'));var logger=require(_0xcb93('0x7'))(_0xcb93('0x8'));var config=require('../../config/environment');var jayson=require(_0xcb93('0x9'));var client=jayson[_0xcb93('0xa')][_0xcb93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be87e,_0x48ae5b,_0x446f86){return new BPromise(function(_0x43f616,_0x4b970d){return client['request'](_0x1be87e,_0x446f86)[_0xcb93('0xc')](function(_0x2c9294){logger[_0xcb93('0xd')](_0xcb93('0xe'),_0x48ae5b,_0xcb93('0xf'));logger[_0xcb93('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x48ae5b,_0xcb93('0xf'),JSON['stringify'](_0x2c9294));if(_0x2c9294[_0xcb93('0x11')]){if(_0x2c9294['error']['code']===0x1f4){logger['error'](_0xcb93('0xe'),_0x48ae5b,_0x2c9294[_0xcb93('0x11')]['message']);return _0x4b970d(_0x2c9294[_0xcb93('0x11')][_0xcb93('0x12')]);}logger[_0xcb93('0x11')](_0xcb93('0xe'),_0x48ae5b,_0x2c9294['error'][_0xcb93('0x12')]);return _0x43f616(_0x2c9294[_0xcb93('0x11')][_0xcb93('0x12')]);}else{logger[_0xcb93('0xd')](_0xcb93('0xe'),_0x48ae5b,_0xcb93('0xf'));_0x43f616(_0x2c9294[_0xcb93('0x13')][_0xcb93('0x12')]);}})['catch'](function(_0x5cffdf){logger[_0xcb93('0x11')](_0xcb93('0xe'),_0x48ae5b,_0x5cffdf);_0x4b970d(_0x5cffdf);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f8f05bf..7a4f334 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 _0xd7c3=['./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa5da3f,_0x5b2b0a){var _0x3b4916=function(_0x86ba90){while(--_0x86ba90){_0xa5da3f['push'](_0xa5da3f['shift']());}};_0x3b4916(++_0x5b2b0a);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x4dcf88,_0x220d82){_0x4dcf88=_0x4dcf88-0x0;var _0x64f0dc=_0xd7c3[_0x4dcf88];return _0x64f0dc;};'use strict';var multer=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var path=require(_0x3d7c('0x2'));var timeout=require(_0x3d7c('0x3'));var express=require(_0x3d7c('0x4'));var router=express[_0x3d7c('0x5')]();var fs_extra=require(_0x3d7c('0x6'));var auth=require(_0x3d7c('0x7'));var interaction=require(_0x3d7c('0x8'));var config=require('../../config/environment');var controller=require(_0x3d7c('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d7c('0xa')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0xd')]);router[_0x3d7c('0xe')]('/',auth[_0x3d7c('0xc')](),controller[_0x3d7c('0xf')]);router[_0x3d7c('0x10')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0x11')]);router[_0x3d7c('0x12')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0x13')]);module[_0x3d7c('0x14')]=router; \ No newline at end of file +var _0xafa5=['./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d44b8,_0x38229f){var _0x1f3f9f=function(_0x15f640){while(--_0x15f640){_0x2d44b8['push'](_0x2d44b8['shift']());}};_0x1f3f9f(++_0x38229f);}(_0xafa5,0x1af));var _0x5afa=function(_0x55e6d3,_0x332873){_0x55e6d3=_0x55e6d3-0x0;var _0x115545=_0xafa5[_0x55e6d3];return _0x115545;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xf')]('/',auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router[_0x5afa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5afa('0x12')]);router[_0x5afa('0x13')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x14')]);module[_0x5afa('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c38e50f..b42d93b 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 _0x6f28=['TEXT','sequelize','exports'];(function(_0xd059e9,_0x30db2a){var _0x8ec878=function(_0x2feb66){while(--_0x2feb66){_0xd059e9['push'](_0xd059e9['shift']());}};_0x8ec878(++_0x30db2a);}(_0x6f28,0x130));var _0x86f2=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x6f28[_0x152678];return _0x311a9;};'use strict';var Sequelize=require(_0x86f2('0x0'));module[_0x86f2('0x1')]={'tree':{'type':Sequelize[_0x86f2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x52ad=['sequelize','TEXT'];(function(_0x16e01a,_0x5f3f80){var _0x36c1c2=function(_0xb8a806){while(--_0xb8a806){_0x16e01a['push'](_0x16e01a['shift']());}};_0x36c1c2(++_0x5f3f80);}(_0x52ad,0x17e));var _0xd52a=function(_0x1ba2b1,_0x2471d6){_0x1ba2b1=_0x1ba2b1-0x0;var _0x42d0d2=_0x52ad[_0x1ba2b1];return _0x42d0d2;};'use strict';var Sequelize=require(_0xd52a('0x0'));module['exports']={'tree':{'type':Sequelize[_0xd52a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 66b6c0f..c683d28 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 _0xeaf7=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x28600d,_0x1cce36){var _0x439f97=function(_0x32d000){while(--_0x32d000){_0x28600d['push'](_0x28600d['shift']());}};_0x439f97(++_0x1cce36);}(_0xeaf7,0x173));var _0x7eaf=function(_0x23f8d8,_0x3da4c7){_0x23f8d8=_0x23f8d8-0x0;var _0x43e485=_0xeaf7[_0x23f8d8];return _0x43e485;};'use strict';var emlformat=require(_0x7eaf('0x0'));var rimraf=require(_0x7eaf('0x1'));var zipdir=require(_0x7eaf('0x2'));var jsonpatch=require(_0x7eaf('0x3'));var rp=require(_0x7eaf('0x4'));var moment=require(_0x7eaf('0x5'));var BPromise=require(_0x7eaf('0x6'));var Mustache=require(_0x7eaf('0x7'));var util=require(_0x7eaf('0x8'));var path=require(_0x7eaf('0x9'));var sox=require(_0x7eaf('0xa'));var csv=require(_0x7eaf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eaf('0xc'));var _=require('lodash');var squel=require(_0x7eaf('0xd'));var crypto=require(_0x7eaf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7eaf('0xf'));var toCsv=require(_0x7eaf('0xb'));var querystring=require(_0x7eaf('0x10'));var Papa=require(_0x7eaf('0x11'));var Redis=require(_0x7eaf('0x12'));var authService=require(_0x7eaf('0x13'));var qs=require(_0x7eaf('0x14'));var as=require(_0x7eaf('0x15'));var hardwareService=require(_0x7eaf('0x16'));var logger=require(_0x7eaf('0x17'))('api');var utils=require(_0x7eaf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7eaf('0x19'));var db=require(_0x7eaf('0x1a'))['db'];function respondWithStatusCode(_0x583cd7,_0x152851){_0x152851=_0x152851||0xcc;return function(_0x134049){if(_0x134049){return _0x583cd7[_0x7eaf('0x1b')](_0x152851);}return _0x583cd7[_0x7eaf('0x1c')](_0x152851)['end']();};}function respondWithResult(_0x422acc,_0x383022){_0x383022=_0x383022||0xc8;return function(_0x197260){if(_0x197260){return _0x422acc[_0x7eaf('0x1c')](_0x383022)[_0x7eaf('0x1d')](_0x197260);}};}function respondWithFilteredResult(_0xa5f8da,_0x50b226){return function(_0x1a6efe){if(_0x1a6efe){var _0x37d9b8=typeof _0x50b226[_0x7eaf('0x1e')]===_0x7eaf('0x1f')&&typeof _0x50b226[_0x7eaf('0x20')]===_0x7eaf('0x1f');var _0xc1c1ca=_0x1a6efe[_0x7eaf('0x21')];var _0x4b77d5=_0x37d9b8?0x0:_0x50b226['offset'];var _0x3239e2=_0x37d9b8?_0x1a6efe[_0x7eaf('0x21')]:_0x50b226['offset']+_0x50b226['limit'];var _0x151f9d;if(_0x3239e2>=_0xc1c1ca){_0x3239e2=_0xc1c1ca;_0x151f9d=0xc8;}else{_0x151f9d=0xce;}_0xa5f8da['status'](_0x151f9d);return _0xa5f8da[_0x7eaf('0x22')](_0x7eaf('0x23'),_0x4b77d5+'-'+_0x3239e2+'/'+_0xc1c1ca)[_0x7eaf('0x1d')](_0x1a6efe);}return null;};}function patchUpdates(_0x57890b){return function(_0x51fcbf){try{jsonpatch['apply'](_0x51fcbf,_0x57890b,!![]);}catch(_0x15fbad){return BPromise[_0x7eaf('0x24')](_0x15fbad);}return _0x51fcbf[_0x7eaf('0x25')]();};}function saveUpdates(_0x4fd9cf,_0x42b3c8){return function(_0xa677aa){if(_0xa677aa){return _0xa677aa[_0x7eaf('0x26')](_0x4fd9cf)[_0x7eaf('0x27')](function(_0x2e8f5e){return _0x2e8f5e;});}return null;};}function removeEntity(_0x185e67,_0x38cfcc){return function(_0xf7071f){if(_0xf7071f){return _0xf7071f[_0x7eaf('0x28')]()[_0x7eaf('0x27')](function(){_0x185e67[_0x7eaf('0x1c')](0xcc)[_0x7eaf('0x29')]();});}};}function handleEntityNotFound(_0x41b45b,_0x146b0b){return function(_0x26ee8a){if(!_0x26ee8a){_0x41b45b[_0x7eaf('0x1b')](0x194);}return _0x26ee8a;};}function handleError(_0x4f9fbf,_0x3b0480){_0x3b0480=_0x3b0480||0x1f4;return function(_0x5eafa9){logger[_0x7eaf('0x2a')](_0x5eafa9['stack']);if(_0x5eafa9[_0x7eaf('0x2b')]){delete _0x5eafa9[_0x7eaf('0x2b')];}_0x4f9fbf[_0x7eaf('0x1c')](_0x3b0480)[_0x7eaf('0x2c')](_0x5eafa9);};}exports[_0x7eaf('0x2d')]=function(_0x548792,_0x2623d0){var _0x5ba9ff={},_0x28ae02={},_0x29446c={'count':0x0,'rows':[]};var _0x3fec26=_[_0x7eaf('0x2e')](db[_0x7eaf('0x2f')][_0x7eaf('0x30')],function(_0x32a95d){return{'name':_0x32a95d[_0x7eaf('0x31')],'type':_0x32a95d['type'][_0x7eaf('0x32')]};});_0x28ae02[_0x7eaf('0x33')]=_[_0x7eaf('0x2e')](_0x3fec26,_0x7eaf('0x2b'));_0x28ae02[_0x7eaf('0x34')]=_['keys'](_0x548792[_0x7eaf('0x34')]);_0x28ae02[_0x7eaf('0x35')]=_[_0x7eaf('0x36')](_0x28ae02[_0x7eaf('0x33')],_0x28ae02[_0x7eaf('0x34')]);_0x5ba9ff[_0x7eaf('0x37')]=_['intersection'](_0x28ae02[_0x7eaf('0x33')],qs[_0x7eaf('0x38')](_0x548792[_0x7eaf('0x34')]['fields']));_0x5ba9ff['attributes']=_0x5ba9ff['attributes'][_0x7eaf('0x39')]?_0x5ba9ff[_0x7eaf('0x37')]:_0x28ae02[_0x7eaf('0x33')];if(!_0x548792[_0x7eaf('0x34')][_0x7eaf('0x3a')](_0x7eaf('0x3b'))){_0x5ba9ff[_0x7eaf('0x20')]=qs['limit'](_0x548792[_0x7eaf('0x34')][_0x7eaf('0x20')]);_0x5ba9ff[_0x7eaf('0x1e')]=qs[_0x7eaf('0x1e')](_0x548792[_0x7eaf('0x34')][_0x7eaf('0x1e')]);}_0x5ba9ff[_0x7eaf('0x3c')]=qs[_0x7eaf('0x3d')](_0x548792[_0x7eaf('0x34')][_0x7eaf('0x3d')]);_0x5ba9ff[_0x7eaf('0x3e')]=qs[_0x7eaf('0x35')](_[_0x7eaf('0x3f')](_0x548792[_0x7eaf('0x34')],_0x28ae02[_0x7eaf('0x35')]),_0x3fec26);if(_0x548792['query'][_0x7eaf('0x40')]){_0x5ba9ff['where']=_[_0x7eaf('0x41')](_0x5ba9ff['where'],{'$or':_['map'](_0x3fec26,function(_0x5dd6f5){if(_0x5dd6f5[_0x7eaf('0x42')]!==_0x7eaf('0x43')){var _0x20578c={};_0x20578c[_0x5dd6f5[_0x7eaf('0x2b')]]={'$like':'%'+_0x548792['query'][_0x7eaf('0x40')]+'%'};return _0x20578c;}})});}_0x5ba9ff=_[_0x7eaf('0x41')]({},_0x5ba9ff,_0x548792[_0x7eaf('0x44')]);var _0x3d63ab={'where':_0x5ba9ff[_0x7eaf('0x3e')]};return db[_0x7eaf('0x2f')][_0x7eaf('0x21')](_0x3d63ab)[_0x7eaf('0x27')](function(_0x1b29cc){_0x29446c[_0x7eaf('0x21')]=_0x1b29cc;if(_0x548792[_0x7eaf('0x34')]['includeAll']){_0x5ba9ff[_0x7eaf('0x45')]=[{'all':!![]}];}return db[_0x7eaf('0x2f')][_0x7eaf('0x46')](_0x5ba9ff);})[_0x7eaf('0x27')](function(_0x158b94){_0x29446c[_0x7eaf('0x47')]=_0x158b94;return _0x29446c;})[_0x7eaf('0x27')](respondWithFilteredResult(_0x2623d0,_0x5ba9ff))['catch'](handleError(_0x2623d0,null));};exports[_0x7eaf('0x48')]=function(_0x53ae2f,_0x355205){var _0x3063bf={'raw':!![],'where':{'id':_0x53ae2f[_0x7eaf('0x49')]['id']}},_0x5b3843={};_0x5b3843[_0x7eaf('0x33')]=_[_0x7eaf('0x4a')](db['AnalyticTreeReport'][_0x7eaf('0x30')]);_0x5b3843[_0x7eaf('0x34')]=_['keys'](_0x53ae2f[_0x7eaf('0x34')]);_0x5b3843[_0x7eaf('0x35')]=_[_0x7eaf('0x36')](_0x5b3843[_0x7eaf('0x33')],_0x5b3843[_0x7eaf('0x34')]);_0x3063bf['attributes']=_[_0x7eaf('0x36')](_0x5b3843[_0x7eaf('0x33')],qs[_0x7eaf('0x38')](_0x53ae2f[_0x7eaf('0x34')][_0x7eaf('0x38')]));_0x3063bf['attributes']=_0x3063bf[_0x7eaf('0x37')][_0x7eaf('0x39')]?_0x3063bf[_0x7eaf('0x37')]:_0x5b3843[_0x7eaf('0x33')];if(_0x53ae2f[_0x7eaf('0x34')][_0x7eaf('0x4b')]){_0x3063bf[_0x7eaf('0x45')]=[{'all':!![]}];}_0x3063bf=_[_0x7eaf('0x41')]({},_0x3063bf,_0x53ae2f[_0x7eaf('0x44')]);return db[_0x7eaf('0x2f')][_0x7eaf('0x4c')](_0x3063bf)[_0x7eaf('0x27')](handleEntityNotFound(_0x355205,null))[_0x7eaf('0x27')](respondWithResult(_0x355205,null))[_0x7eaf('0x4d')](handleError(_0x355205,null));};exports[_0x7eaf('0x4e')]=function(_0x179576,_0x3d8288){return db[_0x7eaf('0x2f')][_0x7eaf('0x4e')](_0x179576[_0x7eaf('0x4f')],{})[_0x7eaf('0x27')](respondWithResult(_0x3d8288,0xc9))['catch'](handleError(_0x3d8288,null));};exports[_0x7eaf('0x26')]=function(_0x5969b6,_0x10d63b){if(_0x5969b6[_0x7eaf('0x4f')]['id']){delete _0x5969b6[_0x7eaf('0x4f')]['id'];}return db[_0x7eaf('0x2f')][_0x7eaf('0x4c')]({'where':{'id':_0x5969b6[_0x7eaf('0x49')]['id']}})[_0x7eaf('0x27')](handleEntityNotFound(_0x10d63b,null))['then'](saveUpdates(_0x5969b6['body'],null))[_0x7eaf('0x27')](respondWithResult(_0x10d63b,null))[_0x7eaf('0x4d')](handleError(_0x10d63b,null));};exports[_0x7eaf('0x28')]=function(_0x2e86b1,_0x121bab){return db[_0x7eaf('0x2f')][_0x7eaf('0x4c')]({'where':{'id':_0x2e86b1[_0x7eaf('0x49')]['id']}})[_0x7eaf('0x27')](handleEntityNotFound(_0x121bab,null))['then'](removeEntity(_0x121bab,null))[_0x7eaf('0x4d')](handleError(_0x121bab,null));}; \ No newline at end of file +var _0xbb1b=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','AnalyticTreeReport','findAll','rows','show','keys','includeAll','include','options','find','catch','create','body','params','destroy','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x195a2d,_0x24fde6){var _0xd08ca8=function(_0x4bf6d4){while(--_0x4bf6d4){_0x195a2d['push'](_0x195a2d['shift']());}};_0xd08ca8(++_0x24fde6);}(_0xbb1b,0x8a));var _0xbbb1=function(_0x379171,_0x4d69a6){_0x379171=_0x379171-0x0;var _0x3b9f9f=_0xbb1b[_0x379171];return _0x3b9f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbb1('0x0'));var zipdir=require(_0xbbb1('0x1'));var jsonpatch=require(_0xbbb1('0x2'));var rp=require(_0xbbb1('0x3'));var moment=require(_0xbbb1('0x4'));var BPromise=require(_0xbbb1('0x5'));var Mustache=require(_0xbbb1('0x6'));var util=require(_0xbbb1('0x7'));var path=require(_0xbbb1('0x8'));var sox=require('sox');var csv=require(_0xbbb1('0x9'));var ejs=require(_0xbbb1('0xa'));var fs=require('fs');var fs_extra=require(_0xbbb1('0xb'));var _=require(_0xbbb1('0xc'));var squel=require('squel');var crypto=require(_0xbbb1('0xd'));var jsforce=require(_0xbbb1('0xe'));var deskjs=require(_0xbbb1('0xf'));var toCsv=require(_0xbbb1('0x9'));var querystring=require(_0xbbb1('0x10'));var Papa=require(_0xbbb1('0x11'));var Redis=require(_0xbbb1('0x12'));var authService=require(_0xbbb1('0x13'));var qs=require(_0xbbb1('0x14'));var as=require(_0xbbb1('0x15'));var hardwareService=require(_0xbbb1('0x16'));var logger=require(_0xbbb1('0x17'))('api');var utils=require(_0xbbb1('0x18'));var config=require(_0xbbb1('0x19'));var licenseUtil=require(_0xbbb1('0x1a'));var db=require(_0xbbb1('0x1b'))['db'];function respondWithStatusCode(_0x28b495,_0x12522f){_0x12522f=_0x12522f||0xcc;return function(_0x2286a9){if(_0x2286a9){return _0x28b495['sendStatus'](_0x12522f);}return _0x28b495[_0xbbb1('0x1c')](_0x12522f)[_0xbbb1('0x1d')]();};}function respondWithResult(_0x200b5a,_0x3f9e92){_0x3f9e92=_0x3f9e92||0xc8;return function(_0x15095f){if(_0x15095f){return _0x200b5a[_0xbbb1('0x1c')](_0x3f9e92)[_0xbbb1('0x1e')](_0x15095f);}};}function respondWithFilteredResult(_0x27eb05,_0x464709){return function(_0x17364c){if(_0x17364c){var _0xaf6371=typeof _0x464709[_0xbbb1('0x1f')]===_0xbbb1('0x20')&&typeof _0x464709[_0xbbb1('0x21')]===_0xbbb1('0x20');var _0x136ff8=_0x17364c[_0xbbb1('0x22')];var _0x548d6f=_0xaf6371?0x0:_0x464709[_0xbbb1('0x1f')];var _0x59b19e=_0xaf6371?_0x17364c['count']:_0x464709[_0xbbb1('0x1f')]+_0x464709[_0xbbb1('0x21')];var _0x2b0091;if(_0x59b19e>=_0x136ff8){_0x59b19e=_0x136ff8;_0x2b0091=0xc8;}else{_0x2b0091=0xce;}_0x27eb05[_0xbbb1('0x1c')](_0x2b0091);return _0x27eb05[_0xbbb1('0x23')](_0xbbb1('0x24'),_0x548d6f+'-'+_0x59b19e+'/'+_0x136ff8)[_0xbbb1('0x1e')](_0x17364c);}return null;};}function patchUpdates(_0x2ca4c4){return function(_0x46857f){try{jsonpatch[_0xbbb1('0x25')](_0x46857f,_0x2ca4c4,!![]);}catch(_0x5807f5){return BPromise[_0xbbb1('0x26')](_0x5807f5);}return _0x46857f[_0xbbb1('0x27')]();};}function saveUpdates(_0xd443b7,_0x28c7af){return function(_0x33e31e){if(_0x33e31e){return _0x33e31e[_0xbbb1('0x28')](_0xd443b7)[_0xbbb1('0x29')](function(_0x41aa5a){return _0x41aa5a;});}return null;};}function removeEntity(_0x311f15,_0x136650){return function(_0x38ece3){if(_0x38ece3){return _0x38ece3['destroy']()[_0xbbb1('0x29')](function(){_0x311f15[_0xbbb1('0x1c')](0xcc)[_0xbbb1('0x1d')]();});}};}function handleEntityNotFound(_0x3a1277,_0x3dc4a7){return function(_0x5e10ac){if(!_0x5e10ac){_0x3a1277[_0xbbb1('0x2a')](0x194);}return _0x5e10ac;};}function handleError(_0x2a024d,_0xc1e25a){_0xc1e25a=_0xc1e25a||0x1f4;return function(_0x26da59){logger[_0xbbb1('0x2b')](_0x26da59[_0xbbb1('0x2c')]);if(_0x26da59[_0xbbb1('0x2d')]){delete _0x26da59[_0xbbb1('0x2d')];}_0x2a024d[_0xbbb1('0x1c')](_0xc1e25a)[_0xbbb1('0x2e')](_0x26da59);};}exports['index']=function(_0x2f53d8,_0x1556ef){var _0x3c9500={},_0x31de8f={},_0x1f0815={'count':0x0,'rows':[]};var _0x506042=_[_0xbbb1('0x2f')](db['AnalyticTreeReport'][_0xbbb1('0x30')],function(_0x1d696d){return{'name':_0x1d696d[_0xbbb1('0x31')],'type':_0x1d696d['type'][_0xbbb1('0x32')]};});_0x31de8f[_0xbbb1('0x33')]=_[_0xbbb1('0x2f')](_0x506042,'name');_0x31de8f[_0xbbb1('0x34')]=_['keys'](_0x2f53d8[_0xbbb1('0x34')]);_0x31de8f[_0xbbb1('0x35')]=_[_0xbbb1('0x36')](_0x31de8f[_0xbbb1('0x33')],_0x31de8f[_0xbbb1('0x34')]);_0x3c9500[_0xbbb1('0x37')]=_[_0xbbb1('0x36')](_0x31de8f[_0xbbb1('0x33')],qs[_0xbbb1('0x38')](_0x2f53d8[_0xbbb1('0x34')][_0xbbb1('0x38')]));_0x3c9500[_0xbbb1('0x37')]=_0x3c9500[_0xbbb1('0x37')][_0xbbb1('0x39')]?_0x3c9500[_0xbbb1('0x37')]:_0x31de8f[_0xbbb1('0x33')];if(!_0x2f53d8[_0xbbb1('0x34')][_0xbbb1('0x3a')](_0xbbb1('0x3b'))){_0x3c9500[_0xbbb1('0x21')]=qs[_0xbbb1('0x21')](_0x2f53d8['query']['limit']);_0x3c9500['offset']=qs[_0xbbb1('0x1f')](_0x2f53d8['query'][_0xbbb1('0x1f')]);}_0x3c9500[_0xbbb1('0x3c')]=qs[_0xbbb1('0x3d')](_0x2f53d8['query'][_0xbbb1('0x3d')]);_0x3c9500[_0xbbb1('0x3e')]=qs[_0xbbb1('0x35')](_[_0xbbb1('0x3f')](_0x2f53d8[_0xbbb1('0x34')],_0x31de8f['filters']),_0x506042);if(_0x2f53d8['query'][_0xbbb1('0x40')]){_0x3c9500[_0xbbb1('0x3e')]=_['merge'](_0x3c9500[_0xbbb1('0x3e')],{'$or':_[_0xbbb1('0x2f')](_0x506042,function(_0x457e93){if(_0x457e93[_0xbbb1('0x41')]!==_0xbbb1('0x42')){var _0x110feb={};_0x110feb[_0x457e93[_0xbbb1('0x2d')]]={'$like':'%'+_0x2f53d8[_0xbbb1('0x34')][_0xbbb1('0x40')]+'%'};return _0x110feb;}})});}_0x3c9500=_[_0xbbb1('0x43')]({},_0x3c9500,_0x2f53d8['options']);var _0x5ef354={'where':_0x3c9500[_0xbbb1('0x3e')]};return db[_0xbbb1('0x44')][_0xbbb1('0x22')](_0x5ef354)[_0xbbb1('0x29')](function(_0x4fe5c3){_0x1f0815['count']=_0x4fe5c3;if(_0x2f53d8[_0xbbb1('0x34')]['includeAll']){_0x3c9500['include']=[{'all':!![]}];}return db[_0xbbb1('0x44')][_0xbbb1('0x45')](_0x3c9500);})[_0xbbb1('0x29')](function(_0xc7a5ed){_0x1f0815[_0xbbb1('0x46')]=_0xc7a5ed;return _0x1f0815;})[_0xbbb1('0x29')](respondWithFilteredResult(_0x1556ef,_0x3c9500))['catch'](handleError(_0x1556ef,null));};exports[_0xbbb1('0x47')]=function(_0xb3c339,_0x433987){var _0x47006b={'raw':!![],'where':{'id':_0xb3c339['params']['id']}},_0x592696={};_0x592696[_0xbbb1('0x33')]=_['keys'](db['AnalyticTreeReport'][_0xbbb1('0x30')]);_0x592696['query']=_[_0xbbb1('0x48')](_0xb3c339['query']);_0x592696[_0xbbb1('0x35')]=_[_0xbbb1('0x36')](_0x592696[_0xbbb1('0x33')],_0x592696['query']);_0x47006b[_0xbbb1('0x37')]=_['intersection'](_0x592696[_0xbbb1('0x33')],qs['fields'](_0xb3c339[_0xbbb1('0x34')][_0xbbb1('0x38')]));_0x47006b[_0xbbb1('0x37')]=_0x47006b[_0xbbb1('0x37')][_0xbbb1('0x39')]?_0x47006b[_0xbbb1('0x37')]:_0x592696[_0xbbb1('0x33')];if(_0xb3c339[_0xbbb1('0x34')][_0xbbb1('0x49')]){_0x47006b[_0xbbb1('0x4a')]=[{'all':!![]}];}_0x47006b=_[_0xbbb1('0x43')]({},_0x47006b,_0xb3c339[_0xbbb1('0x4b')]);return db['AnalyticTreeReport'][_0xbbb1('0x4c')](_0x47006b)[_0xbbb1('0x29')](handleEntityNotFound(_0x433987,null))[_0xbbb1('0x29')](respondWithResult(_0x433987,null))[_0xbbb1('0x4d')](handleError(_0x433987,null));};exports[_0xbbb1('0x4e')]=function(_0x2858cc,_0x531c3b){return db['AnalyticTreeReport'][_0xbbb1('0x4e')](_0x2858cc['body'],{})[_0xbbb1('0x29')](respondWithResult(_0x531c3b,0xc9))['catch'](handleError(_0x531c3b,null));};exports[_0xbbb1('0x28')]=function(_0x5db049,_0x1ae339){if(_0x5db049[_0xbbb1('0x4f')]['id']){delete _0x5db049['body']['id'];}return db[_0xbbb1('0x44')]['find']({'where':{'id':_0x5db049[_0xbbb1('0x50')]['id']}})[_0xbbb1('0x29')](handleEntityNotFound(_0x1ae339,null))['then'](saveUpdates(_0x5db049['body'],null))[_0xbbb1('0x29')](respondWithResult(_0x1ae339,null))['catch'](handleError(_0x1ae339,null));};exports[_0xbbb1('0x51')]=function(_0x20e076,_0x3f746d){return db[_0xbbb1('0x44')][_0xbbb1('0x4c')]({'where':{'id':_0x20e076[_0xbbb1('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f746d,null))[_0xbbb1('0x29')](removeEntity(_0x3f746d,null))[_0xbbb1('0x4d')](handleError(_0x3f746d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 79ed49f..baad1fa 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 _0xd0e7=['bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x512f86,_0x10d5cf){var _0xf8c104=function(_0x57e005){while(--_0x57e005){_0x512f86['push'](_0x512f86['shift']());}};_0xf8c104(++_0x10d5cf);}(_0xd0e7,0xef));var _0x7d0e=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xd0e7[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0x7d0e('0x0'));var util=require(_0x7d0e('0x1'));var logger=require(_0x7d0e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d0e('0x3'));var rp=require(_0x7d0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d0e('0x5'));var config=require(_0x7d0e('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x7d0e('0x7')]=function(_0x54dcaa,_0x1d3a79){return _0x54dcaa[_0x7d0e('0x8')](_0x7d0e('0x9'),attributes,{'tableName':_0x7d0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeab6=['../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x357633,_0x254610){var _0x261faf=function(_0x18b745){while(--_0x18b745){_0x357633['push'](_0x357633['shift']());}};_0x261faf(++_0x254610);}(_0xeab6,0x1e6));var _0x6eab=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0xeab6[_0x1a3243];return _0x33f2ca;};'use strict';var _=require(_0x6eab('0x0'));var util=require(_0x6eab('0x1'));var logger=require(_0x6eab('0x2'))(_0x6eab('0x3'));var moment=require(_0x6eab('0x4'));var BPromise=require(_0x6eab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6eab('0x6'));var rimraf=require(_0x6eab('0x7'));var config=require(_0x6eab('0x8'));var attributes=require(_0x6eab('0x9'));module[_0x6eab('0xa')]=function(_0x55796b,_0x380ec6){return _0x55796b[_0x6eab('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x6eab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index efd8758..8e11ab9 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x40cbba,_0x4208e5){var _0x4dc247=function(_0x27f763){while(--_0x27f763){_0x40cbba['push'](_0x40cbba['shift']());}};_0x4dc247(++_0x4208e5);}(_0xdb28,0x106));var _0x8db2=function(_0x1d6d89,_0x256025){_0x1d6d89=_0x1d6d89-0x0;var _0x9f9416=_0xdb28[_0x1d6d89];return _0x9f9416;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0xccaac9,_0x4862ef){var _0x1cb496=function(_0x3b8384){while(--_0x3b8384){_0xccaac9['push'](_0xccaac9['shift']());}};_0x1cb496(++_0x4862ef);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0486d28..d77eb2a 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 _0x0ecc=['show','post','update','destroy','util','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x461bd4,_0x1e283b){var _0x23cae7=function(_0x4ed63d){while(--_0x4ed63d){_0x461bd4['push'](_0x461bd4['shift']());}};_0x23cae7(++_0x1e283b);}(_0x0ecc,0x100));var _0xc0ec=function(_0x5d3da8,_0x2f264f){_0x5d3da8=_0x5d3da8-0x0;var _0x54c5b6=_0x0ecc[_0x5d3da8];return _0x54c5b6;};'use strict';var multer=require('multer');var util=require(_0xc0ec('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc0ec('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc0ec('0x2'));var config=require(_0xc0ec('0x3'));var controller=require('./analyticTreeReport.controller');router[_0xc0ec('0x4')]('/',auth['isAuthenticated'](),controller[_0xc0ec('0x5')]);router[_0xc0ec('0x4')](_0xc0ec('0x6'),auth[_0xc0ec('0x7')](),controller[_0xc0ec('0x8')]);router[_0xc0ec('0x9')]('/',auth[_0xc0ec('0x7')](),controller['create']);router['put'](_0xc0ec('0x6'),auth[_0xc0ec('0x7')](),controller[_0xc0ec('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc0ec('0xb')]);module['exports']=router; \ No newline at end of file +var _0x86c6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','put','delete','destroy','exports','multer','path'];(function(_0x4dda8e,_0xe91ab7){var _0x1563c7=function(_0x552266){while(--_0x552266){_0x4dda8e['push'](_0x4dda8e['shift']());}};_0x1563c7(++_0xe91ab7);}(_0x86c6,0x1da));var _0x686c=function(_0xed8653,_0x1b3f77){_0xed8653=_0xed8653-0x0;var _0x21afbd=_0x86c6[_0xed8653];return _0x21afbd;};'use strict';var multer=require(_0x686c('0x0'));var util=require('util');var path=require(_0x686c('0x1'));var timeout=require('connect-timeout');var express=require(_0x686c('0x2'));var router=express[_0x686c('0x3')]();var fs_extra=require(_0x686c('0x4'));var auth=require(_0x686c('0x5'));var interaction=require(_0x686c('0x6'));var config=require(_0x686c('0x7'));var controller=require(_0x686c('0x8'));router[_0x686c('0x9')]('/',auth[_0x686c('0xa')](),controller['index']);router[_0x686c('0x9')](_0x686c('0xb'),auth[_0x686c('0xa')](),controller['show']);router[_0x686c('0xc')]('/',auth[_0x686c('0xa')](),controller['create']);router[_0x686c('0xd')](_0x686c('0xb'),auth[_0x686c('0xa')](),controller['update']);router[_0x686c('0xe')](_0x686c('0xb'),auth['isAuthenticated'](),controller[_0x686c('0xf')]);module[_0x686c('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6438b59..d227cf8 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 _0x6183=['STRING','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6183,0x19b));var _0x3618=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x6183[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0x3618('0x0')]={'name':{'type':Sequelize[_0x3618('0x1')]},'basename':{'type':Sequelize[_0x3618('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2bc6=['STRING','sequelize','exports'];(function(_0x101ad7,_0x5e6ee2){var _0x3ecead=function(_0x5a56c2){while(--_0x5a56c2){_0x101ad7['push'](_0x101ad7['shift']());}};_0x3ecead(++_0x5e6ee2);}(_0x2bc6,0x163));var _0x62bc=function(_0x12719d,_0x3f4a21){_0x12719d=_0x12719d-0x0;var _0x1e7a39=_0x2bc6[_0x12719d];return _0x1e7a39;};'use strict';var Sequelize=require(_0x62bc('0x0'));module[_0x62bc('0x1')]={'name':{'type':Sequelize[_0x62bc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a0a2856..42ca77e 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 _0xb19a=['clone','includeAll','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','mimetype','download','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','Attachment','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','rawAttributes','include','options','find'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xb19a,0xc4));var _0xab19=function(_0x1dee09,_0x396388){_0x1dee09=_0x1dee09-0x0;var _0x67231e=_0xb19a[_0x1dee09];return _0x67231e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab19('0x0'));var zipdir=require(_0xab19('0x1'));var jsonpatch=require(_0xab19('0x2'));var rp=require(_0xab19('0x3'));var moment=require('moment');var BPromise=require(_0xab19('0x4'));var Mustache=require(_0xab19('0x5'));var util=require(_0xab19('0x6'));var path=require('path');var sox=require(_0xab19('0x7'));var csv=require('to-csv');var ejs=require(_0xab19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab19('0x9'));var squel=require(_0xab19('0xa'));var crypto=require(_0xab19('0xb'));var jsforce=require(_0xab19('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab19('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab19('0xe'));var qs=require(_0xab19('0xf'));var as=require(_0xab19('0x10'));var hardwareService=require(_0xab19('0x11'));var logger=require(_0xab19('0x12'))('api');var utils=require(_0xab19('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xab19('0x14'));var db=require(_0xab19('0x15'))['db'];function respondWithStatusCode(_0x3090cb,_0x5d83a5){_0x5d83a5=_0x5d83a5||0xcc;return function(_0x1bf557){if(_0x1bf557){return _0x3090cb[_0xab19('0x16')](_0x5d83a5);}return _0x3090cb[_0xab19('0x17')](_0x5d83a5)[_0xab19('0x18')]();};}function respondWithResult(_0x2cd579,_0x194396){_0x194396=_0x194396||0xc8;return function(_0x2ae465){if(_0x2ae465){return _0x2cd579[_0xab19('0x17')](_0x194396)[_0xab19('0x19')](_0x2ae465);}};}function respondWithFilteredResult(_0x4217bb,_0x50d517){return function(_0x51bd5b){if(_0x51bd5b){var _0x48af00=typeof _0x50d517[_0xab19('0x1a')]==='undefined'&&typeof _0x50d517[_0xab19('0x1b')]===_0xab19('0x1c');var _0x58944c=_0x51bd5b['count'];var _0x291105=_0x48af00?0x0:_0x50d517[_0xab19('0x1a')];var _0x30cb92=_0x48af00?_0x51bd5b[_0xab19('0x1d')]:_0x50d517['offset']+_0x50d517['limit'];var _0x45f6b5;if(_0x30cb92>=_0x58944c){_0x30cb92=_0x58944c;_0x45f6b5=0xc8;}else{_0x45f6b5=0xce;}_0x4217bb[_0xab19('0x17')](_0x45f6b5);return _0x4217bb[_0xab19('0x1e')](_0xab19('0x1f'),_0x291105+'-'+_0x30cb92+'/'+_0x58944c)[_0xab19('0x19')](_0x51bd5b);}return null;};}function patchUpdates(_0x20034f){return function(_0x2e4595){try{jsonpatch[_0xab19('0x20')](_0x2e4595,_0x20034f,!![]);}catch(_0x378024){return BPromise[_0xab19('0x21')](_0x378024);}return _0x2e4595['save']();};}function saveUpdates(_0x6807e0,_0x96ab80){return function(_0x2dd24a){if(_0x2dd24a){return _0x2dd24a[_0xab19('0x22')](_0x6807e0)[_0xab19('0x23')](function(_0x38e0a9){return _0x38e0a9;});}return null;};}function removeEntity(_0x32203d,_0x40060e){return function(_0x12dc24){if(_0x12dc24){return _0x12dc24[_0xab19('0x24')]()[_0xab19('0x23')](function(){_0x32203d[_0xab19('0x17')](0xcc)[_0xab19('0x18')]();});}};}function handleEntityNotFound(_0x21ab58,_0x1dd803){return function(_0x62923){if(!_0x62923){_0x21ab58[_0xab19('0x16')](0x194);}return _0x62923;};}function handleError(_0x3e04c9,_0x3677c1){_0x3677c1=_0x3677c1||0x1f4;return function(_0x47dc06){logger[_0xab19('0x25')](_0x47dc06[_0xab19('0x26')]);if(_0x47dc06[_0xab19('0x27')]){delete _0x47dc06[_0xab19('0x27')];}_0x3e04c9['status'](_0x3677c1)[_0xab19('0x28')](_0x47dc06);};}exports[_0xab19('0x29')]=function(_0x3cc92d,_0x2491df){var _0x35832c={},_0x21b78c={},_0x2443ce={'count':0x0,'rows':[]};var _0x1656ea=_['map'](db[_0xab19('0x2a')]['rawAttributes'],function(_0x3a095c){return{'name':_0x3a095c[_0xab19('0x2b')],'type':_0x3a095c[_0xab19('0x2c')][_0xab19('0x2d')]};});_0x21b78c[_0xab19('0x2e')]=_[_0xab19('0x2f')](_0x1656ea,_0xab19('0x27'));_0x21b78c['query']=_[_0xab19('0x30')](_0x3cc92d['query']);_0x21b78c[_0xab19('0x31')]=_[_0xab19('0x32')](_0x21b78c[_0xab19('0x2e')],_0x21b78c[_0xab19('0x33')]);_0x35832c[_0xab19('0x34')]=_[_0xab19('0x32')](_0x21b78c[_0xab19('0x2e')],qs[_0xab19('0x35')](_0x3cc92d[_0xab19('0x33')]['fields']));_0x35832c[_0xab19('0x34')]=_0x35832c[_0xab19('0x34')][_0xab19('0x36')]?_0x35832c[_0xab19('0x34')]:_0x21b78c['model'];if(!_0x3cc92d[_0xab19('0x33')][_0xab19('0x37')]('nolimit')){_0x35832c[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x3cc92d[_0xab19('0x33')][_0xab19('0x1b')]);_0x35832c[_0xab19('0x1a')]=qs[_0xab19('0x1a')](_0x3cc92d[_0xab19('0x33')]['offset']);}_0x35832c[_0xab19('0x38')]=qs['sort'](_0x3cc92d[_0xab19('0x33')][_0xab19('0x39')]);_0x35832c[_0xab19('0x3a')]=qs[_0xab19('0x31')](_[_0xab19('0x3b')](_0x3cc92d[_0xab19('0x33')],_0x21b78c[_0xab19('0x31')]),_0x1656ea);if(_0x3cc92d['query'][_0xab19('0x3c')]){_0x35832c['where']=_[_0xab19('0x3d')](_0x35832c[_0xab19('0x3a')],{'$or':_[_0xab19('0x2f')](_0x1656ea,function(_0xea1121){if(_0xea1121[_0xab19('0x2c')]!==_0xab19('0x3e')){var _0x5ebe61={};_0x5ebe61[_0xea1121[_0xab19('0x27')]]={'$like':'%'+_0x3cc92d[_0xab19('0x33')][_0xab19('0x3c')]+'%'};return _0x5ebe61;}})});}_0x35832c=_[_0xab19('0x3d')]({},_0x35832c,_0x3cc92d['options']);var _0x10db71={'where':_0x35832c[_0xab19('0x3a')]};return db['Attachment']['count'](_0x10db71)['then'](function(_0x10842a){_0x2443ce[_0xab19('0x1d')]=_0x10842a;if(_0x3cc92d[_0xab19('0x33')]['includeAll']){_0x35832c['include']=[{'all':!![]}];}return db['Attachment'][_0xab19('0x3f')](_0x35832c);})['then'](function(_0x3d2e8b){_0x2443ce['rows']=_0x3d2e8b;return _0x2443ce;})[_0xab19('0x23')](respondWithFilteredResult(_0x2491df,_0x35832c))[_0xab19('0x40')](handleError(_0x2491df,null));};exports[_0xab19('0x41')]=function(_0x1966da,_0x1b3e19){var _0x341ad4={'raw':!![],'where':{'id':_0x1966da[_0xab19('0x42')]['id']}},_0x57e40d={};_0x57e40d['model']=_[_0xab19('0x30')](db[_0xab19('0x2a')][_0xab19('0x43')]);_0x57e40d[_0xab19('0x33')]=_[_0xab19('0x30')](_0x1966da[_0xab19('0x33')]);_0x57e40d[_0xab19('0x31')]=_['intersection'](_0x57e40d[_0xab19('0x2e')],_0x57e40d[_0xab19('0x33')]);_0x341ad4[_0xab19('0x34')]=_[_0xab19('0x32')](_0x57e40d[_0xab19('0x2e')],qs[_0xab19('0x35')](_0x1966da[_0xab19('0x33')][_0xab19('0x35')]));_0x341ad4[_0xab19('0x34')]=_0x341ad4[_0xab19('0x34')][_0xab19('0x36')]?_0x341ad4['attributes']:_0x57e40d[_0xab19('0x2e')];if(_0x1966da['query']['includeAll']){_0x341ad4[_0xab19('0x44')]=[{'all':!![]}];}_0x341ad4=_[_0xab19('0x3d')]({},_0x341ad4,_0x1966da[_0xab19('0x45')]);return db[_0xab19('0x2a')][_0xab19('0x46')](_0x341ad4)[_0xab19('0x23')](handleEntityNotFound(_0x1b3e19,null))[_0xab19('0x23')](respondWithResult(_0x1b3e19,null))[_0xab19('0x40')](handleError(_0x1b3e19,null));};exports[_0xab19('0x47')]=function(_0xbbf984,_0x4a3ffb){var _0x5bfec4={'where':{'id':_0xbbf984['params']['id']}},_0x13f549={};_0x13f549[_0xab19('0x2e')]=_[_0xab19('0x30')](db[_0xab19('0x2a')][_0xab19('0x43')]);_0x5bfec4[_0xab19('0x34')]=_[_0xab19('0x32')](_0x13f549['model'],qs['fields'](_0xbbf984[_0xab19('0x33')][_0xab19('0x35')]));_0x5bfec4['attributes']=_0x5bfec4[_0xab19('0x34')][_0xab19('0x36')]?_0x5bfec4[_0xab19('0x34')]:_0x13f549[_0xab19('0x2e')];if(_0xbbf984['query'][_0xab19('0x48')]){_0x5bfec4[_0xab19('0x44')]=[{'all':!![]}];}_0x5bfec4=_['merge']({},_0x5bfec4,_0xbbf984['options']);return db[_0xab19('0x2a')][_0xab19('0x46')](_0x5bfec4)['then'](handleEntityNotFound(_0x4a3ffb,null))[_0xab19('0x23')](function(_0x1cc8fe){if(_0x1cc8fe){var _0x182d71=_0x1cc8fe[_0xab19('0x49')]({'plain':!![]});_0x182d71=qs[_0xab19('0x4a')](_0x182d71,['id',_0xab19('0x4b'),_0xab19('0x4c')]);_0xbbf984[_0xab19('0x4d')]=_[_0xab19('0x4a')](_0xbbf984[_0xab19('0x4d')],['id',_0xab19('0x4b'),'updatedAt']);return db[_0xab19('0x2a')][_0xab19('0x4e')](_[_0xab19('0x3d')](_0x182d71,_0xbbf984['body']),{'include':_0xbbf984[_0xab19('0x33')][_0xab19('0x48')]?[{'all':!![]}]:undefined});}})[_0xab19('0x23')](respondWithResult(_0x4a3ffb,0xc9))[_0xab19('0x40')](handleError(_0x4a3ffb,null));};exports[_0xab19('0x22')]=function(_0xc3d2a3,_0x306266){if(_0xc3d2a3[_0xab19('0x4d')]['id']){delete _0xc3d2a3[_0xab19('0x4d')]['id'];}return db[_0xab19('0x2a')][_0xab19('0x46')]({'where':{'id':_0xc3d2a3[_0xab19('0x42')]['id']}})[_0xab19('0x23')](handleEntityNotFound(_0x306266,null))['then'](saveUpdates(_0xc3d2a3['body'],null))[_0xab19('0x23')](respondWithResult(_0x306266,null))[_0xab19('0x40')](handleError(_0x306266,null));};exports[_0xab19('0x24')]=function(_0x2d77ae,_0x294c78){return db['Attachment'][_0xab19('0x46')]({'where':{'id':_0x2d77ae[_0xab19('0x42')]['id']}})[_0xab19('0x23')](handleEntityNotFound(_0x294c78,null))[_0xab19('0x23')](removeEntity(_0x294c78,null))['catch'](handleError(_0x294c78,null));};exports[_0xab19('0x4e')]=function(_0x122314,_0x16925e,_0x3c501a){_0x122314[_0xab19('0x4d')][_0xab19('0x27')]=_0x122314['file'][_0xab19('0x4f')];_0x122314[_0xab19('0x4d')][_0xab19('0x50')]=_0x122314[_0xab19('0x51')]['filename'];_0x122314[_0xab19('0x4d')][_0xab19('0x2c')]=_0x122314['file'][_0xab19('0x52')];return db[_0xab19('0x2a')]['create'](_0x122314[_0xab19('0x4d')])[_0xab19('0x23')](respondWithResult(_0x16925e,0xc9))['catch'](handleError(_0x16925e,null));};exports[_0xab19('0x53')]=function(_0x4b8178,_0x13b5c4,_0x4573db){return db[_0xab19('0x2a')]['findOne']({'where':{'id':_0x4b8178['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x13b5c4,null))[_0xab19('0x23')](function(_0x973243){if(_0x973243){var _0x4f063a=_0x973243[_0xab19('0x54')]!==null;var _0x25b844=path['join'](config[_0xab19('0x55')],_0xab19('0x56'));if(_0x4f063a){_0x25b844=path[_0xab19('0x57')](_0x25b844,_0xab19('0x58'));}var _0x35e7bf=path[_0xab19('0x57')](_0x25b844,_0x973243[_0xab19('0x50')]);return _0x13b5c4[_0xab19('0x53')](_0x35e7bf);}})['catch'](handleError(_0x13b5c4,null));}; \ No newline at end of file +var _0x4e8b=['create','destroy','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','Content-Range','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','get','omit','createdAt','updatedAt','body'];(function(_0x2645c0,_0x4c3208){var _0x40a7a1=function(_0x4157d7){while(--_0x4157d7){_0x2645c0['push'](_0x2645c0['shift']());}};_0x40a7a1(++_0x4c3208);}(_0x4e8b,0xbb));var _0xb4e8=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x4e8b[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require(_0xb4e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4e8('0x1'));var jsonpatch=require(_0xb4e8('0x2'));var rp=require('request-promise');var moment=require(_0xb4e8('0x3'));var BPromise=require(_0xb4e8('0x4'));var Mustache=require('mustache');var util=require(_0xb4e8('0x5'));var path=require(_0xb4e8('0x6'));var sox=require(_0xb4e8('0x7'));var csv=require(_0xb4e8('0x8'));var ejs=require(_0xb4e8('0x9'));var fs=require('fs');var fs_extra=require(_0xb4e8('0xa'));var _=require(_0xb4e8('0xb'));var squel=require(_0xb4e8('0xc'));var crypto=require(_0xb4e8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb4e8('0x8'));var querystring=require(_0xb4e8('0xe'));var Papa=require(_0xb4e8('0xf'));var Redis=require('ioredis');var authService=require(_0xb4e8('0x10'));var qs=require(_0xb4e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4e8('0x12'))('api');var utils=require(_0xb4e8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb4e8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c28d0,_0x1127fa){_0x1127fa=_0x1127fa||0xcc;return function(_0x49236a){if(_0x49236a){return _0x2c28d0[_0xb4e8('0x15')](_0x1127fa);}return _0x2c28d0[_0xb4e8('0x16')](_0x1127fa)['end']();};}function respondWithResult(_0x88c6a3,_0x44977e){_0x44977e=_0x44977e||0xc8;return function(_0x4f682d){if(_0x4f682d){return _0x88c6a3[_0xb4e8('0x16')](_0x44977e)[_0xb4e8('0x17')](_0x4f682d);}};}function respondWithFilteredResult(_0x576030,_0x1df436){return function(_0x4d1c08){if(_0x4d1c08){var _0x2f1349=typeof _0x1df436['offset']===_0xb4e8('0x18')&&typeof _0x1df436['limit']===_0xb4e8('0x18');var _0x5e28da=_0x4d1c08[_0xb4e8('0x19')];var _0x1868c7=_0x2f1349?0x0:_0x1df436[_0xb4e8('0x1a')];var _0xd9c595=_0x2f1349?_0x4d1c08[_0xb4e8('0x19')]:_0x1df436['offset']+_0x1df436['limit'];var _0x16f052;if(_0xd9c595>=_0x5e28da){_0xd9c595=_0x5e28da;_0x16f052=0xc8;}else{_0x16f052=0xce;}_0x576030[_0xb4e8('0x16')](_0x16f052);return _0x576030['set'](_0xb4e8('0x1b'),_0x1868c7+'-'+_0xd9c595+'/'+_0x5e28da)[_0xb4e8('0x17')](_0x4d1c08);}return null;};}function patchUpdates(_0x589771){return function(_0x493e72){try{jsonpatch['apply'](_0x493e72,_0x589771,!![]);}catch(_0x384f79){return BPromise[_0xb4e8('0x1c')](_0x384f79);}return _0x493e72['save']();};}function saveUpdates(_0x711a42,_0x2bf300){return function(_0x2434a9){if(_0x2434a9){return _0x2434a9[_0xb4e8('0x1d')](_0x711a42)[_0xb4e8('0x1e')](function(_0x3c5fa8){return _0x3c5fa8;});}return null;};}function removeEntity(_0x1eedd1,_0x273af8){return function(_0x475652){if(_0x475652){return _0x475652['destroy']()[_0xb4e8('0x1e')](function(){_0x1eedd1['status'](0xcc)[_0xb4e8('0x1f')]();});}};}function handleEntityNotFound(_0x3103ab,_0x482ec3){return function(_0x6c4957){if(!_0x6c4957){_0x3103ab['sendStatus'](0x194);}return _0x6c4957;};}function handleError(_0x4931d,_0x5719a3){_0x5719a3=_0x5719a3||0x1f4;return function(_0x313684){logger[_0xb4e8('0x20')](_0x313684[_0xb4e8('0x21')]);if(_0x313684[_0xb4e8('0x22')]){delete _0x313684['name'];}_0x4931d[_0xb4e8('0x16')](_0x5719a3)[_0xb4e8('0x23')](_0x313684);};}exports['index']=function(_0x2f9540,_0x514763){var _0xe5aa0f={},_0x4d9ace={},_0x518b3d={'count':0x0,'rows':[]};var _0x115d4d=_[_0xb4e8('0x24')](db['Attachment'][_0xb4e8('0x25')],function(_0x3b4f60){return{'name':_0x3b4f60[_0xb4e8('0x26')],'type':_0x3b4f60[_0xb4e8('0x27')][_0xb4e8('0x28')]};});_0x4d9ace['model']=_[_0xb4e8('0x24')](_0x115d4d,'name');_0x4d9ace[_0xb4e8('0x29')]=_[_0xb4e8('0x2a')](_0x2f9540[_0xb4e8('0x29')]);_0x4d9ace[_0xb4e8('0x2b')]=_['intersection'](_0x4d9ace[_0xb4e8('0x2c')],_0x4d9ace[_0xb4e8('0x29')]);_0xe5aa0f[_0xb4e8('0x2d')]=_['intersection'](_0x4d9ace['model'],qs['fields'](_0x2f9540[_0xb4e8('0x29')][_0xb4e8('0x2e')]));_0xe5aa0f[_0xb4e8('0x2d')]=_0xe5aa0f[_0xb4e8('0x2d')]['length']?_0xe5aa0f['attributes']:_0x4d9ace[_0xb4e8('0x2c')];if(!_0x2f9540[_0xb4e8('0x29')][_0xb4e8('0x2f')](_0xb4e8('0x30'))){_0xe5aa0f[_0xb4e8('0x31')]=qs[_0xb4e8('0x31')](_0x2f9540[_0xb4e8('0x29')]['limit']);_0xe5aa0f[_0xb4e8('0x1a')]=qs[_0xb4e8('0x1a')](_0x2f9540[_0xb4e8('0x29')]['offset']);}_0xe5aa0f[_0xb4e8('0x32')]=qs['sort'](_0x2f9540[_0xb4e8('0x29')][_0xb4e8('0x33')]);_0xe5aa0f[_0xb4e8('0x34')]=qs[_0xb4e8('0x2b')](_[_0xb4e8('0x35')](_0x2f9540['query'],_0x4d9ace['filters']),_0x115d4d);if(_0x2f9540[_0xb4e8('0x29')][_0xb4e8('0x36')]){_0xe5aa0f[_0xb4e8('0x34')]=_[_0xb4e8('0x37')](_0xe5aa0f[_0xb4e8('0x34')],{'$or':_['map'](_0x115d4d,function(_0x3aa83a){if(_0x3aa83a[_0xb4e8('0x27')]!==_0xb4e8('0x38')){var _0x6e421={};_0x6e421[_0x3aa83a[_0xb4e8('0x22')]]={'$like':'%'+_0x2f9540[_0xb4e8('0x29')][_0xb4e8('0x36')]+'%'};return _0x6e421;}})});}_0xe5aa0f=_['merge']({},_0xe5aa0f,_0x2f9540[_0xb4e8('0x39')]);var _0x13e6b8={'where':_0xe5aa0f[_0xb4e8('0x34')]};return db[_0xb4e8('0x3a')][_0xb4e8('0x19')](_0x13e6b8)[_0xb4e8('0x1e')](function(_0x101b39){_0x518b3d['count']=_0x101b39;if(_0x2f9540['query'][_0xb4e8('0x3b')]){_0xe5aa0f[_0xb4e8('0x3c')]=[{'all':!![]}];}return db['Attachment'][_0xb4e8('0x3d')](_0xe5aa0f);})['then'](function(_0x9096b6){_0x518b3d[_0xb4e8('0x3e')]=_0x9096b6;return _0x518b3d;})['then'](respondWithFilteredResult(_0x514763,_0xe5aa0f))[_0xb4e8('0x3f')](handleError(_0x514763,null));};exports[_0xb4e8('0x40')]=function(_0x3a8990,_0x2d6513){var _0x408f32={'raw':!![],'where':{'id':_0x3a8990[_0xb4e8('0x41')]['id']}},_0x48ad1b={};_0x48ad1b[_0xb4e8('0x2c')]=_[_0xb4e8('0x2a')](db[_0xb4e8('0x3a')][_0xb4e8('0x25')]);_0x48ad1b[_0xb4e8('0x29')]=_[_0xb4e8('0x2a')](_0x3a8990[_0xb4e8('0x29')]);_0x48ad1b[_0xb4e8('0x2b')]=_[_0xb4e8('0x42')](_0x48ad1b[_0xb4e8('0x2c')],_0x48ad1b[_0xb4e8('0x29')]);_0x408f32['attributes']=_['intersection'](_0x48ad1b[_0xb4e8('0x2c')],qs[_0xb4e8('0x2e')](_0x3a8990[_0xb4e8('0x29')]['fields']));_0x408f32[_0xb4e8('0x2d')]=_0x408f32[_0xb4e8('0x2d')][_0xb4e8('0x43')]?_0x408f32[_0xb4e8('0x2d')]:_0x48ad1b[_0xb4e8('0x2c')];if(_0x3a8990[_0xb4e8('0x29')]['includeAll']){_0x408f32[_0xb4e8('0x3c')]=[{'all':!![]}];}_0x408f32=_['merge']({},_0x408f32,_0x3a8990[_0xb4e8('0x39')]);return db['Attachment']['find'](_0x408f32)[_0xb4e8('0x1e')](handleEntityNotFound(_0x2d6513,null))['then'](respondWithResult(_0x2d6513,null))[_0xb4e8('0x3f')](handleError(_0x2d6513,null));};exports['clone']=function(_0x304fed,_0x5426b0){var _0x331e48={'where':{'id':_0x304fed[_0xb4e8('0x41')]['id']}},_0x32ad8b={};_0x32ad8b[_0xb4e8('0x2c')]=_['keys'](db[_0xb4e8('0x3a')]['rawAttributes']);_0x331e48[_0xb4e8('0x2d')]=_[_0xb4e8('0x42')](_0x32ad8b[_0xb4e8('0x2c')],qs[_0xb4e8('0x2e')](_0x304fed[_0xb4e8('0x29')][_0xb4e8('0x2e')]));_0x331e48['attributes']=_0x331e48[_0xb4e8('0x2d')][_0xb4e8('0x43')]?_0x331e48[_0xb4e8('0x2d')]:_0x32ad8b[_0xb4e8('0x2c')];if(_0x304fed[_0xb4e8('0x29')]['includeAll']){_0x331e48[_0xb4e8('0x3c')]=[{'all':!![]}];}_0x331e48=_[_0xb4e8('0x37')]({},_0x331e48,_0x304fed[_0xb4e8('0x39')]);return db['Attachment'][_0xb4e8('0x44')](_0x331e48)[_0xb4e8('0x1e')](handleEntityNotFound(_0x5426b0,null))[_0xb4e8('0x1e')](function(_0x41ba25){if(_0x41ba25){var _0x5304c6=_0x41ba25[_0xb4e8('0x45')]({'plain':!![]});_0x5304c6=qs[_0xb4e8('0x46')](_0x5304c6,['id',_0xb4e8('0x47'),_0xb4e8('0x48')]);_0x304fed[_0xb4e8('0x49')]=_['omit'](_0x304fed['body'],['id','createdAt',_0xb4e8('0x48')]);return db['Attachment'][_0xb4e8('0x4a')](_[_0xb4e8('0x37')](_0x5304c6,_0x304fed[_0xb4e8('0x49')]),{'include':_0x304fed[_0xb4e8('0x29')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xb4e8('0x1e')](respondWithResult(_0x5426b0,0xc9))[_0xb4e8('0x3f')](handleError(_0x5426b0,null));};exports[_0xb4e8('0x1d')]=function(_0x5e47d8,_0x36ef9d){if(_0x5e47d8['body']['id']){delete _0x5e47d8['body']['id'];}return db['Attachment'][_0xb4e8('0x44')]({'where':{'id':_0x5e47d8['params']['id']}})['then'](handleEntityNotFound(_0x36ef9d,null))['then'](saveUpdates(_0x5e47d8[_0xb4e8('0x49')],null))[_0xb4e8('0x1e')](respondWithResult(_0x36ef9d,null))[_0xb4e8('0x3f')](handleError(_0x36ef9d,null));};exports[_0xb4e8('0x4b')]=function(_0xad26d9,_0x5b7bc4){return db[_0xb4e8('0x3a')][_0xb4e8('0x44')]({'where':{'id':_0xad26d9[_0xb4e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b7bc4,null))[_0xb4e8('0x1e')](removeEntity(_0x5b7bc4,null))[_0xb4e8('0x3f')](handleError(_0x5b7bc4,null));};exports[_0xb4e8('0x4a')]=function(_0x24da10,_0x4edd65,_0x177edf){_0x24da10['body']['name']=_0x24da10[_0xb4e8('0x4c')][_0xb4e8('0x4d')];_0x24da10[_0xb4e8('0x49')][_0xb4e8('0x4e')]=_0x24da10[_0xb4e8('0x4c')][_0xb4e8('0x4f')];_0x24da10[_0xb4e8('0x49')][_0xb4e8('0x27')]=_0x24da10[_0xb4e8('0x4c')][_0xb4e8('0x50')];return db[_0xb4e8('0x3a')][_0xb4e8('0x4a')](_0x24da10[_0xb4e8('0x49')])['then'](respondWithResult(_0x4edd65,0xc9))[_0xb4e8('0x3f')](handleError(_0x4edd65,null));};exports['download']=function(_0x2cea1b,_0x493509,_0x307f4e){return db[_0xb4e8('0x3a')]['findOne']({'where':{'id':_0x2cea1b[_0xb4e8('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x493509,null))[_0xb4e8('0x1e')](function(_0x46e80c){if(_0x46e80c){var _0x1fa70d=_0x46e80c[_0xb4e8('0x51')]!==null;var _0x1c0f9d=path[_0xb4e8('0x52')](config[_0xb4e8('0x53')],_0xb4e8('0x54'));if(_0x1fa70d){_0x1c0f9d=path[_0xb4e8('0x52')](_0x1c0f9d,_0xb4e8('0x55'));}var _0x34d793=path[_0xb4e8('0x52')](_0x1c0f9d,_0x46e80c[_0xb4e8('0x4e')]);return _0x493509[_0xb4e8('0x56')](_0x34d793);}})[_0xb4e8('0x3f')](handleError(_0x493509,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7f2ffc4..3a814b3 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 _0xffea=['rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','api','moment','bluebird','request-promise','path'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xffea,0x13f));var _0xaffe=function(_0x831608,_0x20a30e){_0x831608=_0x831608-0x0;var _0x1e8ea0=_0xffea[_0x831608];return _0x1e8ea0;};'use strict';var _=require(_0xaffe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaffe('0x1'));var moment=require(_0xaffe('0x2'));var BPromise=require(_0xaffe('0x3'));var rp=require(_0xaffe('0x4'));var fs=require('fs');var path=require(_0xaffe('0x5'));var rimraf=require(_0xaffe('0x6'));var config=require(_0xaffe('0x7'));var attributes=require(_0xaffe('0x8'));module[_0xaffe('0x9')]=function(_0x165094,_0xd63dbb){return _0x165094[_0xaffe('0xa')](_0xaffe('0xb'),attributes,{'tableName':_0xaffe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6b=['exports','define','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes'];(function(_0x1e806a,_0x5cceb){var _0x328522=function(_0x3a272d){while(--_0x3a272d){_0x1e806a['push'](_0x1e806a['shift']());}};_0x328522(++_0x5cceb);}(_0x3a6b,0x12f));var _0xb3a6=function(_0x5aab1f,_0xc02bfa){_0x5aab1f=_0x5aab1f-0x0;var _0x264a66=_0x3a6b[_0x5aab1f];return _0x264a66;};'use strict';var _=require(_0xb3a6('0x0'));var util=require(_0xb3a6('0x1'));var logger=require(_0xb3a6('0x2'))(_0xb3a6('0x3'));var moment=require('moment');var BPromise=require(_0xb3a6('0x4'));var rp=require(_0xb3a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3a6('0x6'));var config=require(_0xb3a6('0x7'));var attributes=require(_0xb3a6('0x8'));module[_0xb3a6('0x9')]=function(_0x1c895a,_0x3860d9){return _0x1c895a[_0xb3a6('0xa')]('Attachment',attributes,{'tableName':_0xb3a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 1d23720..04ee153 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 _0x31c2=['CreateAttachment','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','Attachment','create','body','options','raw'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x31c2,0x98));var _0x231c=function(_0x42c1a4,_0x4669f1){_0x42c1a4=_0x42c1a4-0x0;var _0x1ab6db=_0x31c2[_0x42c1a4];return _0x1ab6db;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x231c('0x1'));var rs=require(_0x231c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x231c('0x3'))['db'];var utils=require(_0x231c('0x4'));var logger=require(_0x231c('0x5'))(_0x231c('0x6'));var config=require(_0x231c('0x7'));var jayson=require(_0x231c('0x8'));var client=jayson[_0x231c('0x9')][_0x231c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5afc76,_0x1e3997,_0x4fd8b8){return new BPromise(function(_0x3dfccb,_0x396da8){return client[_0x231c('0xb')](_0x5afc76,_0x4fd8b8)[_0x231c('0xc')](function(_0x4cd3b8){logger[_0x231c('0xd')](_0x231c('0xe'),_0x1e3997,_0x231c('0xf'));logger[_0x231c('0x10')](_0x231c('0x11'),_0x1e3997,_0x231c('0xf'),JSON['stringify'](_0x4cd3b8));if(_0x4cd3b8['error']){if(_0x4cd3b8['error'][_0x231c('0x12')]===0x1f4){logger[_0x231c('0x13')](_0x231c('0xe'),_0x1e3997,_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);return _0x396da8(_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);}logger[_0x231c('0x13')](_0x231c('0xe'),_0x1e3997,_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);return _0x3dfccb(_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);}else{logger[_0x231c('0xd')]('Attachment,\x20%s,\x20%s',_0x1e3997,_0x231c('0xf'));_0x3dfccb(_0x4cd3b8[_0x231c('0x15')][_0x231c('0x14')]);}})[_0x231c('0x16')](function(_0x40f4f6){logger['error'](_0x231c('0xe'),_0x1e3997,_0x40f4f6);_0x396da8(_0x40f4f6);});});}exports['CreateAttachment']=function(_0x1d48e3){var _0x59282c=this;return new Promise(function(_0x286148,_0x34f391){return db[_0x231c('0x17')][_0x231c('0x18')](_0x1d48e3[_0x231c('0x19')],{'raw':_0x1d48e3[_0x231c('0x1a')]?_0x1d48e3[_0x231c('0x1a')][_0x231c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x29a94){logger[_0x231c('0xd')](_0x231c('0x1c'),_0x1d48e3);logger['debug']('CreateAttachment',_0x1d48e3,JSON[_0x231c('0x1d')](_0x29a94));_0x286148(_0x29a94);})[_0x231c('0x16')](function(_0x3bd9ed){logger['error'](_0x231c('0x1c'),_0x3bd9ed['message'],_0x1d48e3);_0x34f391(_0x59282c[_0x231c('0x13')](0x1f4,_0x3bd9ed[_0x231c('0x14')]));});});}; \ No newline at end of file +var _0x3a25=['jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x500780,_0x32ad84){var _0x293cd7=function(_0x189aba){while(--_0x189aba){_0x500780['push'](_0x500780['shift']());}};_0x293cd7(++_0x32ad84);}(_0x3a25,0x15d));var _0x53a2=function(_0xf8c8a7,_0x52f163){_0xf8c8a7=_0xf8c8a7-0x0;var _0x131a92=_0x3a25[_0xf8c8a7];return _0x131a92;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});}exports[_0x53a2('0x1a')]=function(_0x446b71){var _0x443c6e=this;return new Promise(function(_0x104fb6,_0x1d23f2){return db[_0x53a2('0x1b')]['create'](_0x446b71['body'],{'raw':_0x446b71[_0x53a2('0x1c')]?_0x446b71[_0x53a2('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x53a2('0xf')](function(_0x3fb15b){logger[_0x53a2('0x10')](_0x53a2('0x1a'),_0x446b71);logger['debug'](_0x53a2('0x1a'),_0x446b71,JSON[_0x53a2('0x1d')](_0x3fb15b));_0x104fb6(_0x3fb15b);})[_0x53a2('0x19')](function(_0x2cda68){logger[_0x53a2('0x15')](_0x53a2('0x1a'),_0x2cda68[_0x53a2('0x17')],_0x446b71);_0x1d23f2(_0x443c6e[_0x53a2('0x15')](0x1f4,_0x2cda68['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7dfea74..ab0d427 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x49f856,_0x287a28){var _0x43a6fb=function(_0x25ab53){while(--_0x25ab53){_0x49f856['push'](_0x49f856['shift']());}};_0x43a6fb(++_0x287a28);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b07ce,_0x1efc2f){_0x3b07ce=_0x3b07ce-0x0;var _0x8e9a57=_0x5f2f[_0x3b07ce];return _0x8e9a57;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 8d55f02..f6e31b6 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 _0xa55f=['getLicense','catch','status','send','message','login','ad-login','signToken','use','User','passport','passport-local','Strategy','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blocked','blockedAt','online','admin','user','agent','name','blockDuration','minutes','clearBlockUser'];(function(_0x48f8ba,_0x3adddd){var _0x2867da=function(_0x39abd1){while(--_0x39abd1){_0x48f8ba['push'](_0x48f8ba['shift']());}};_0x2867da(++_0x3adddd);}(_0xa55f,0x172));var _0xfa55=function(_0x350c87,_0x2b44ef){_0x350c87=_0x350c87-0x0;var _0x163800=_0xa55f[_0x350c87];return _0x163800;};'use strict';var passport=require(_0xfa55('0x0'));var LocalStrategy=require(_0xfa55('0x1'))[_0xfa55('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xfa55('0x3'));var BPromise=require('bluebird');var util=require(_0xfa55('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xfa55('0x5'));var utils=require(_0xfa55('0x6'));var config=require('../../config/environment');var logger=require(_0xfa55('0x7'))(_0xfa55('0x8'));function isActiveDirectoryConfigured(_0x329eba){var _0x50307a=![];if(typeof _0x329eba[_0xfa55('0x9')]!==_0xfa55('0xa')){_0x50307a=_0x329eba['activedirectory']['baseDN']&&_0x329eba[_0xfa55('0x9')]['url']&&_0x329eba['activedirectory'][_0xfa55('0xb')];}return _0x50307a;}function adAuthenticate(_0x4ad3ce,_0x2a6d02,_0x28b94e){return new BPromise(function(_0x4c61a6,_0x430f89){try{var _0x476faa=new ActiveDirectory(_0x4ad3ce);_0x476faa[_0xfa55('0xc')](_0x2a6d02,_0x28b94e,function(_0x34b3ec,_0x2f8fcb){if(_0x34b3ec){logger[_0xfa55('0xd')](_0xfa55('0xe'),_0x2a6d02,util['inspect'](_0x34b3ec,{'showHidden':![],'depth':null}));_0x430f89(_0xfa55('0xf'));}else if(!_0x2f8fcb){logger[_0xfa55('0xd')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2a6d02);_0x430f89(_0xfa55('0xf'));}else{_0x4c61a6(_0x2f8fcb);}});}catch(_0x24b614){_0x430f89(_0x24b614);}});}function ActiveDirectoryAuthenticate(_0x5811eb,_0x4e58ac,_0x567090,_0x7a2bbd){var _0x209d0c,_0x1a39ca;if(!isActiveDirectoryConfigured(config)){logger[_0xfa55('0xd')](_0xfa55('0x10'),_0x4e58ac);return _0x7a2bbd(null,![],{'message':_0xfa55('0xf')});}return db[_0xfa55('0x11')][_0xfa55('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xfa55('0x13')](function(_0x27d661){_0x209d0c=_0x27d661;if(!_0x209d0c[_0xfa55('0x14')]){logger[_0xfa55('0xd')](_0xfa55('0x15'),_0x4e58ac);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x5811eb[_0xfa55('0x12')]({'attributes':['id','name',_0xfa55('0x16'),'salt',_0xfa55('0x17'),_0xfa55('0x18'),_0xfa55('0x19'),_0xfa55('0x1a'),_0xfa55('0x1b')],'where':{'name':_0x4e58ac,'role':{'$or':[_0xfa55('0x1c'),_0xfa55('0x1d'),_0xfa55('0x1e')]},'adSsoEnabled':!![]}});})[_0xfa55('0x13')](function(_0x24c36d){if(!_0x24c36d||_0x24c36d&&_0x24c36d[_0xfa55('0x1f')]!==_0x4e58ac){throw new Error(_0xfa55('0xf'));}_0x1a39ca=_0x24c36d;var _0x88a6a7=_0x1a39ca[_0xfa55('0x1f')]+'@'+config[_0xfa55('0x9')][_0xfa55('0xb')];return adAuthenticate(config[_0xfa55('0x9')],_0x88a6a7,_0x567090);})[_0xfa55('0x13')](function(_0x4dec3b){if(_0x1a39ca[_0xfa55('0x18')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x209d0c[_0xfa55('0x20')]>0x0){if(_0x1a39ca[_0xfa55('0x19')]){if(moment(_0x1a39ca[_0xfa55('0x1a')])['add'](_0x209d0c['blockDuration'],_0xfa55('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xfa55('0x22')](_0x1a39ca,0x0,![],null)['then'](function(){return utils[_0xfa55('0x23')](_0x1a39ca);})[_0xfa55('0x13')](function(){return _0x7a2bbd(null,_0x1a39ca);});}else{return utils[_0xfa55('0x23')](_0x1a39ca)[_0xfa55('0x13')](function(){return _0x7a2bbd(null,_0x1a39ca);});}}else{return utils[_0xfa55('0x23')](_0x1a39ca)[_0xfa55('0x13')](function(){return _0x7a2bbd(null,_0x1a39ca);});}})[_0xfa55('0x24')](function(_0x5ae914){return _0x7a2bbd(null,![],_0x5ae914);});}function handleError(_0x29f76e,_0x5af8f6,_0x2c14d6){return _0x29f76e[_0xfa55('0x25')](_0x5af8f6||0x1f4)[_0xfa55('0x26')]({'message':_0x2c14d6?_0x2c14d6[_0xfa55('0x27')]||_0x2c14d6:''});}exports[_0xfa55('0x28')]=function(_0x1a7b3a,_0x18459a,_0x17b68a){passport[_0xfa55('0xc')](_0xfa55('0x29'),function(_0x18cebe,_0x4c61ae,_0x50e615){var _0xa2c581=_0x18cebe||_0x50e615;if(_0xa2c581){return handleError(_0x18459a,0x191,_0xa2c581);}if(!_0x4c61ae){return handleError(_0x18459a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x509eba={'payload':{'id':_0x4c61ae['id'],'role':_0x4c61ae[_0xfa55('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0xfa55('0x2a')](_0x509eba)[_0xfa55('0x13')](function(_0x588c25){_0x18459a['json']({'id':_0x4c61ae['id'],'token':_0x588c25,'statusCall':'','isAlreadyLogged':_0x4c61ae[_0xfa55('0x1b')]});});}})(_0x1a7b3a,_0x18459a,_0x17b68a);};passport[_0xfa55('0x2b')](_0xfa55('0x29'),new LocalStrategy({'usernameField':_0xfa55('0x1f'),'passwordField':_0xfa55('0x16')},function(_0xa932ee,_0x380625,_0x178fc8){return ActiveDirectoryAuthenticate(db[_0xfa55('0x2c')],_0xa932ee,_0x380625,_0x178fc8);})); \ No newline at end of file +var _0x2c06=['admin','user','agent','name','add','minutes','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','password','User','passport','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','blocked','blockedAt','online'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2c06,0x1dc));var _0x62c0=function(_0x3f47cd,_0x25356f){_0x3f47cd=_0x3f47cd-0x0;var _0x520d17=_0x2c06[_0x3f47cd];return _0x520d17;};'use strict';var passport=require(_0x62c0('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x62c0('0x1'));var ActiveDirectory=require(_0x62c0('0x2'));var BPromise=require('bluebird');var util=require(_0x62c0('0x3'));var db=require(_0x62c0('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x62c0('0x5'));var config=require(_0x62c0('0x6'));var logger=require(_0x62c0('0x7'))(_0x62c0('0x8'));function isActiveDirectoryConfigured(_0x2d02c9){var _0x1b4cec=![];if(typeof _0x2d02c9[_0x62c0('0x9')]!==_0x62c0('0xa')){_0x1b4cec=_0x2d02c9[_0x62c0('0x9')][_0x62c0('0xb')]&&_0x2d02c9[_0x62c0('0x9')]['url']&&_0x2d02c9['activedirectory'][_0x62c0('0xc')];}return _0x1b4cec;}function adAuthenticate(_0x688a53,_0x1e1d86,_0x222a49){return new BPromise(function(_0x5331d7,_0x5b81cb){try{var _0x3e833e=new ActiveDirectory(_0x688a53);_0x3e833e[_0x62c0('0xd')](_0x1e1d86,_0x222a49,function(_0x67b45e,_0x315240){if(_0x67b45e){logger[_0x62c0('0xe')](_0x62c0('0xf'),_0x1e1d86,util['inspect'](_0x67b45e,{'showHidden':![],'depth':null}));_0x5b81cb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x315240){logger['error'](_0x62c0('0x10'),_0x1e1d86);_0x5b81cb(_0x62c0('0x11'));}else{_0x5331d7(_0x315240);}});}catch(_0x221cf8){_0x5b81cb(_0x221cf8);}});}function ActiveDirectoryAuthenticate(_0x4ec1b7,_0xf32835,_0xf1bf3a,_0x93beb){var _0x1c6fd8,_0x3daf30;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x62c0('0x12'),_0xf32835);return _0x93beb(null,![],{'message':_0x62c0('0x11')});}return db[_0x62c0('0x13')][_0x62c0('0x14')]({'where':{'id':0x1},'attributes':[_0x62c0('0x15'),_0x62c0('0x16')],'raw':!![]})[_0x62c0('0x17')](function(_0x23bc57){_0x1c6fd8=_0x23bc57;if(!_0x1c6fd8['adSsoEnabled']){logger[_0x62c0('0xe')](_0x62c0('0x18'),_0xf32835);throw new Error(_0x62c0('0x11'));}return _0x4ec1b7[_0x62c0('0x14')]({'attributes':['id','name','password',_0x62c0('0x19'),_0x62c0('0x1a'),'disabled',_0x62c0('0x1b'),_0x62c0('0x1c'),_0x62c0('0x1d')],'where':{'name':_0xf32835,'role':{'$or':[_0x62c0('0x1e'),_0x62c0('0x1f'),_0x62c0('0x20')]},'adSsoEnabled':!![]}});})[_0x62c0('0x17')](function(_0x1047b7){if(!_0x1047b7||_0x1047b7&&_0x1047b7[_0x62c0('0x21')]!==_0xf32835){throw new Error(_0x62c0('0x11'));}_0x3daf30=_0x1047b7;var _0x14a645=_0x3daf30['name']+'@'+config[_0x62c0('0x9')][_0x62c0('0xc')];return adAuthenticate(config[_0x62c0('0x9')],_0x14a645,_0xf1bf3a);})[_0x62c0('0x17')](function(_0x555c0b){if(_0x3daf30['disabled']){throw new Error(_0x62c0('0x11'));}if(_0x1c6fd8[_0x62c0('0x16')]>0x0){if(_0x3daf30['blocked']){if(moment(_0x3daf30[_0x62c0('0x1c')])[_0x62c0('0x22')](_0x1c6fd8[_0x62c0('0x16')],_0x62c0('0x23'))>moment()){throw new Error(_0x62c0('0x11'));}return utils['clearBlockUser'](_0x3daf30,0x0,![],null)[_0x62c0('0x17')](function(){return utils[_0x62c0('0x24')](_0x3daf30);})['then'](function(){return _0x93beb(null,_0x3daf30);});}else{return utils[_0x62c0('0x24')](_0x3daf30)[_0x62c0('0x17')](function(){return _0x93beb(null,_0x3daf30);});}}else{return utils[_0x62c0('0x24')](_0x3daf30)['then'](function(){return _0x93beb(null,_0x3daf30);});}})['catch'](function(_0x28731e){return _0x93beb(null,![],_0x28731e);});}function handleError(_0x412257,_0x1e30b9,_0x4bc0f4){return _0x412257[_0x62c0('0x25')](_0x1e30b9||0x1f4)[_0x62c0('0x26')]({'message':_0x4bc0f4?_0x4bc0f4[_0x62c0('0x27')]||_0x4bc0f4:''});}exports[_0x62c0('0x28')]=function(_0x310104,_0x5c9551,_0x35c7ca){passport[_0x62c0('0xd')](_0x62c0('0x29'),function(_0x303e4d,_0x2cb80a,_0x1bbc8f){var _0x2d9243=_0x303e4d||_0x1bbc8f;if(_0x2d9243){return handleError(_0x5c9551,0x191,_0x2d9243);}if(!_0x2cb80a){return handleError(_0x5c9551,0x194,{'message':_0x62c0('0x2a')});}else{var _0x316369={'payload':{'id':_0x2cb80a['id'],'role':_0x2cb80a['role']},'options':{'expiresIn':0x15180}};return authService[_0x62c0('0x2b')](_0x316369)[_0x62c0('0x17')](function(_0xda041c){_0x5c9551['json']({'id':_0x2cb80a['id'],'token':_0xda041c,'statusCall':'','isAlreadyLogged':_0x2cb80a[_0x62c0('0x1d')]});});}})(_0x310104,_0x5c9551,_0x35c7ca);};passport['use'](_0x62c0('0x29'),new LocalStrategy({'usernameField':_0x62c0('0x21'),'passwordField':_0x62c0('0x2c')},function(_0x37e1d7,_0x35f822,_0x2a5aaf){return ActiveDirectoryAuthenticate(db[_0x62c0('0x2d')],_0x37e1d7,_0x35f822,_0x2a5aaf);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f0291b1..a3cbb10 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 _0x9bb0=['login','Router','./authActiveDirectory.controller'];(function(_0x39d0e4,_0x13ae06){var _0x36ead2=function(_0x351268){while(--_0x351268){_0x39d0e4['push'](_0x39d0e4['shift']());}};_0x36ead2(++_0x13ae06);}(_0x9bb0,0x64));var _0x09bb=function(_0x11e001,_0xb3367b){_0x11e001=_0x11e001-0x0;var _0x417419=_0x9bb0[_0x11e001];return _0x417419;};'use strict';var express=require('express');var router=express[_0x09bb('0x0')]();var controller=require(_0x09bb('0x1'));router['post']('/',controller[_0x09bb('0x2')]);module['exports']=router; \ No newline at end of file +var _0x25d0=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x25d0,0xe1));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x025d('0x0'));var router=express[_0x025d('0x1')]();var controller=require(_0x025d('0x2'));router[_0x025d('0x3')]('/',controller[_0x025d('0x4')]);module[_0x025d('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 459c9cb..b63926b 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(_0x29d95d,_0x4396e7){var _0x5860c3=function(_0x3ffd61){while(--_0x3ffd61){_0x29d95d['push'](_0x29d95d['shift']());}};_0x5860c3(++_0x4396e7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 _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(_0x5cb790,_0x3f2b5d){var _0x276009=function(_0x13dbe9){while(--_0x13dbe9){_0x5cb790['push'](_0x5cb790['shift']());}};_0x276009(++_0x3f2b5d);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9700905..9ae92a6 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 _0x5a26=['../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','express','passport','./authGoogle.controller'];(function(_0x1ccb48,_0x561988){var _0x4f5396=function(_0x3f5bc2){while(--_0x3f5bc2){_0x1ccb48['push'](_0x1ccb48['shift']());}};_0x4f5396(++_0x561988);}(_0x5a26,0x165));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x65a2('0x0'));var passport=require(_0x65a2('0x1'));var router=express['Router']();var controller=require(_0x65a2('0x2'));var userController=require(_0x65a2('0x3'));var authService=require(_0x65a2('0x4'));router['get']('/',controller['login']);router[_0x65a2('0x5')](_0x65a2('0x6'),controller[_0x65a2('0x7')],authService[_0x65a2('0x8')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xd46c=['passport','get','/callback','isMiddleware','login','setTokenCookie','exports','express'];(function(_0x47b3a7,_0x4b3b1c){var _0x4d5757=function(_0x387bc9){while(--_0x387bc9){_0x47b3a7['push'](_0x47b3a7['shift']());}};_0x4d5757(++_0x4b3b1c);}(_0xd46c,0x1a7));var _0xcd46=function(_0x2d4ad9,_0x434725){_0x2d4ad9=_0x2d4ad9-0x0;var _0x274252=_0xd46c[_0x2d4ad9];return _0x274252;};'use strict';var express=require(_0xcd46('0x0'));var passport=require(_0xcd46('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0xcd46('0x2')](_0xcd46('0x3'),controller['callback'],authService[_0xcd46('0x4')],userController[_0xcd46('0x5')],authService[_0xcd46('0x6')]);module[_0xcd46('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1db3500..e24b810 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 _0x5d3b=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','send','Reset\x20Email\x20sent!','reset','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','password','resetPasswordExpires','save','Password\x20reset!','util','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','http','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blockedAt','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','error','message','stringify','status','login','local-login','online','forgot','body','generate','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x484945,_0x44c47d){var _0x5de501=function(_0xc3ac8e){while(--_0xc3ac8e){_0x484945['push'](_0x484945['shift']());}};_0x5de501(++_0x44c47d);}(_0x5d3b,0x1d3));var _0xb5d3=function(_0x3b18ec,_0x17bc5a){_0x3b18ec=_0x3b18ec-0x0;var _0x34b5c1=_0x5d3b[_0x3b18ec];return _0x34b5c1;};'use strict';var util=require(_0xb5d3('0x0'));var passport=require('passport');var LocalStrategy=require(_0xb5d3('0x1'))[_0xb5d3('0x2')];var jayson=require(_0xb5d3('0x3'));var _=require('lodash');var rs=require(_0xb5d3('0x4'));var moment=require(_0xb5d3('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xb5d3('0x6'));var utils=require('../../config/utils');var client=jayson['client'][_0xb5d3('0x7')]({'port':0x232b});function localAuthenticate(_0x55dd1a,_0x2e825a,_0x5bf12a,_0x4b5076){var _0x3378d0,_0x107bb9;return db['Setting'][_0xb5d3('0x8')]({'where':{'id':0x1},'attributes':[_0xb5d3('0x9'),_0xb5d3('0xa')],'raw':!![]})[_0xb5d3('0xb')](function(_0x517047){_0x3378d0=_0x517047;return _0x55dd1a['findOne']({'attributes':['id',_0xb5d3('0xc'),'password','salt',_0xb5d3('0xd'),_0xb5d3('0xe'),'blocked',_0xb5d3('0xf'),'loginAttempts'],'where':{'name':_0x2e825a,'role':{'$or':[_0xb5d3('0x10'),_0xb5d3('0x11'),_0xb5d3('0x12')]}}});})[_0xb5d3('0xb')](function(_0x110507){if(!_0x110507||_0x110507&&_0x110507[_0xb5d3('0xc')]!==_0x2e825a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x107bb9=_0x110507;return _0x107bb9;}})[_0xb5d3('0xb')](function(){_0x107bb9[_0xb5d3('0x13')](_0x5bf12a,function(_0x203066,_0xb4fc2){var _0x51b0f6=_0x107bb9['loginAttempts']+0x1;if(_0x203066){return _0x4b5076(_0x203066);}else if(!_0xb4fc2){if(_0x107bb9[_0xb5d3('0xe')]){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}else if(_0x3378d0[_0xb5d3('0x9')]>0x0){if(_0x107bb9[_0xb5d3('0x15')]){if(_0x3378d0['blockDuration']>0x0){if(moment(_0x107bb9[_0xb5d3('0xf')])[_0xb5d3('0x16')](_0x3378d0[_0xb5d3('0xa')],'minutes')>moment()){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}else{return utils[_0xb5d3('0x17')](_0x107bb9,_0x51b0f6,![],null)[_0xb5d3('0xb')](function(){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});});}}else{return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}}else{if(_0x51b0f6>=_0x3378d0[_0xb5d3('0x9')]){return utils[_0xb5d3('0x17')](_0x107bb9,0x0,!![],moment())[_0xb5d3('0xb')](function(){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});});}else{return utils[_0xb5d3('0x17')](_0x107bb9,_0x51b0f6,![],null)[_0xb5d3('0xb')](function(){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});});}}}else{return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}}else{if(_0x107bb9[_0xb5d3('0xe')]){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}else if(_0x3378d0[_0xb5d3('0x9')]>0x0){if(_0x107bb9['blocked']){if(_0x3378d0[_0xb5d3('0xa')]>0x0){if(moment(_0x107bb9[_0xb5d3('0xf')])[_0xb5d3('0x16')](_0x3378d0['blockDuration'],_0xb5d3('0x18'))>moment()){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}else{return utils[_0xb5d3('0x17')](_0x107bb9,0x0,![],null)[_0xb5d3('0xb')](function(){return utils[_0xb5d3('0x19')](_0x107bb9);})[_0xb5d3('0xb')](function(){return _0x4b5076(null,_0x107bb9);});}}else{return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}}else{return utils['clearBlockUser'](_0x107bb9,0x0,![],null)[_0xb5d3('0xb')](function(){return utils['getLicense'](_0x107bb9);})[_0xb5d3('0xb')](function(){return _0x4b5076(null,_0x107bb9);})[_0xb5d3('0x1a')](function(_0x1d8d9d){return _0x4b5076(null,![],_0x1d8d9d);});}}else{if(_0x107bb9[_0xb5d3('0x15')]){return _0x4b5076(null,![],{'message':_0xb5d3('0x14')});}else{return utils[_0xb5d3('0x19')](_0x107bb9)[_0xb5d3('0xb')](function(){return _0x4b5076(null,_0x107bb9);});}}}});})[_0xb5d3('0x1a')](function(_0x18ecf0){return _0x4b5076(null,![],_0x18ecf0);});}function sendServiceMail(_0x344a84){return db[_0xb5d3('0x1b')][_0xb5d3('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xb5d3('0xc'),'email'],'include':[{'model':db[_0xb5d3('0x1d')],'as':'Smtp','include':[{'model':db[_0xb5d3('0x1e')],'as':_0xb5d3('0x1e')}]}]})[_0xb5d3('0xb')](function(_0x1ca3f4){if(!_0x1ca3f4){throw new Error(_0xb5d3('0x1f'));}var _0x1fc95a=_0x1ca3f4['getSmtpOptions']();var _0x2190d3={'account':_0x1fc95a,'message':_[_0xb5d3('0x20')]({'from':util[_0xb5d3('0x21')](_0xb5d3('0x22'),_0x1ca3f4[_0xb5d3('0xc')],_0x1ca3f4[_0xb5d3('0x23')]||_0x1ca3f4['Smtp'][_0xb5d3('0x11')])},_0x344a84)};return client[_0xb5d3('0x24')]('SendMail',_0x2190d3);})[_0xb5d3('0xb')](function(_0x4cd2de){if(_0x4cd2de[_0xb5d3('0x25')]){throw new Error(util[_0xb5d3('0x21')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4cd2de[_0xb5d3('0x25')][_0xb5d3('0x26')]||JSON[_0xb5d3('0x27')](_0x4cd2de[_0xb5d3('0x25')])));}return!![];});}function handleError(_0x443920,_0x2edd5f,_0x1c85a2){return _0x443920[_0xb5d3('0x28')](_0x2edd5f||0x1f4)['send']({'message':_0x1c85a2?_0x1c85a2[_0xb5d3('0x26')]||_0x1c85a2:''});}exports[_0xb5d3('0x29')]=function(_0x4dcc26,_0x18e0ae,_0x3fe347){passport[_0xb5d3('0x13')](_0xb5d3('0x2a'),function(_0x256c95,_0x26dea0,_0x320536){var _0x2a02b3=_0x256c95||_0x320536;if(_0x2a02b3){return handleError(_0x18e0ae,0x191,_0x2a02b3);}if(!_0x26dea0){return handleError(_0x18e0ae,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x31edba={'payload':{'id':_0x26dea0['id'],'role':_0x26dea0['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x31edba)[_0xb5d3('0xb')](function(_0x34b0d1){_0x18e0ae['json']({'id':_0x26dea0['id'],'token':_0x34b0d1,'statusCall':'','isAlreadyLogged':_0x26dea0[_0xb5d3('0x2b')]});});}})(_0x4dcc26,_0x18e0ae,_0x3fe347);};exports[_0xb5d3('0x2c')]=function(_0x32d5a5,_0x4299bf){if(!_0x32d5a5[_0xb5d3('0x2d')][_0xb5d3('0x23')]){return handleError(_0x4299bf,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x171619=rs[_0xb5d3('0x2e')]();_0x32d5a5[_0xb5d3('0x2d')][_0xb5d3('0x23')]=_0x32d5a5[_0xb5d3('0x2d')]['email']['trim']()['toLowerCase']();var _0xa00dd7;return db[_0xb5d3('0x2f')]['findOne']({'where':{'id':0x1},'attributes':[_0xb5d3('0x9'),_0xb5d3('0xa')],'raw':!![]})[_0xb5d3('0xb')](function(_0x270cd8){_0xa00dd7=_0x270cd8;return db[_0xb5d3('0x30')]['find']({'where':{'email':_0x32d5a5[_0xb5d3('0x2d')][_0xb5d3('0x23')]}});})[_0xb5d3('0xb')](function(_0x288821){if(!_0x288821){throw new Error(_0xb5d3('0x31'));}if(_0x288821['disabled']){throw new Error(_0xb5d3('0x32'));}if(_0x288821[_0xb5d3('0x15')]){if(moment(_0x288821[_0xb5d3('0xf')])[_0xb5d3('0x16')](_0xa00dd7[_0xb5d3('0xa')],'minutes')>moment()){throw new Error(_0xb5d3('0x33'));}else{_0x288821['blocked']=![];_0x288821[_0xb5d3('0xf')]=null;}}_0x288821[_0xb5d3('0x34')]=_0x171619;_0x288821['resetPasswordExpires']=Date[_0xb5d3('0x35')]()+0x36ee80;return _0x288821['save']();})[_0xb5d3('0xb')](function(){return sendServiceMail({'to':_0x32d5a5[_0xb5d3('0x2d')][_0xb5d3('0x23')],'subject':_0xb5d3('0x36'),'text':_0xb5d3('0x37')+_0xb5d3('0x38')+_0xb5d3('0x39')+_0x32d5a5[_0xb5d3('0x3a')][_0xb5d3('0x3b')]+_0xb5d3('0x3c')+_0x171619+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x4299bf[_0xb5d3('0x28')](0xc8)[_0xb5d3('0x3d')]({'message':_0xb5d3('0x3e')});})[_0xb5d3('0x1a')](function(_0x1dc65d){return handleError(_0x4299bf,0x1f4,_0x1dc65d);});};exports[_0xb5d3('0x3f')]=function(_0x5aa16c,_0x2b32b3){return db[_0xb5d3('0x30')]['find']({'where':{'resetPasswordToken':_0x5aa16c['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x4323bd){if(!_0x4323bd){throw new Error(_0xb5d3('0x40'));}return db[_0xb5d3('0x2f')]['findOne']({'attributes':['id',_0xb5d3('0x41'),_0xb5d3('0x42'),_0xb5d3('0x43')]})[_0xb5d3('0xb')](function(_0x54899c){if(_0x54899c[_0xb5d3('0x41')])authService['validatePasswordPattern'](_0x5aa16c[_0xb5d3('0x2d')]['password']);if(!_0x54899c[_0xb5d3('0x42')]||!_0x4323bd[_0xb5d3('0x44')])return _0x4323bd;authService[_0xb5d3('0x45')](_0x5aa16c[_0xb5d3('0x2d')][_0xb5d3('0x46')],_0x4323bd['previousPasswords'],_0x54899c[_0xb5d3('0x43')]);return _0x4323bd;})['then'](function(){_0x4323bd['password']=_0x5aa16c[_0xb5d3('0x2d')][_0xb5d3('0x46')];_0x4323bd['resetPasswordToken']=null;_0x4323bd[_0xb5d3('0x47')]=null;return _0x4323bd[_0xb5d3('0x48')]();});})[_0xb5d3('0xb')](function(){_0x2b32b3[_0xb5d3('0x28')](0xc8)['send']({'message':_0xb5d3('0x49')});})['catch'](function(_0x226967){return handleError(_0x2b32b3,0x1f4,_0x226967);});};passport['use'](_0xb5d3('0x2a'),new LocalStrategy({'usernameField':_0xb5d3('0xc'),'passwordField':'password'},function(_0xa8a1a2,_0x1071de,_0x5e942a){return localAuthenticate(db[_0xb5d3('0x30')],_0xa8a1a2,_0x1071de,_0x5e942a);})); \ No newline at end of file +var _0x2771=['moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blockedAt','admin','user','authenticate','disabled','blocked','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','CloudProvider','merge','format','\x22%s\x22\x20<%s>','Smtp','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','generate','trim','toLowerCase','body','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','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://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordToken','util','passport','Strategy','jayson/promise','lodash','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2771,0x132));var _0x1277=function(_0x1fbb77,_0x1363c1){_0x1fbb77=_0x1fbb77-0x0;var _0x20ca6e=_0x2771[_0x1fbb77];return _0x20ca6e;};'use strict';var util=require(_0x1277('0x0'));var passport=require(_0x1277('0x1'));var LocalStrategy=require('passport-local')[_0x1277('0x2')];var jayson=require(_0x1277('0x3'));var _=require(_0x1277('0x4'));var rs=require(_0x1277('0x5'));var moment=require(_0x1277('0x6'));var db=require(_0x1277('0x7'))['db'];var authService=require(_0x1277('0x8'));var utils=require(_0x1277('0x9'));var client=jayson['client'][_0x1277('0xa')]({'port':0x232b});function localAuthenticate(_0x36a2a7,_0xa9e403,_0x4cf328,_0x47a799){var _0x4c926f,_0x3d8abf;return db[_0x1277('0xb')][_0x1277('0xc')]({'where':{'id':0x1},'attributes':[_0x1277('0xd'),_0x1277('0xe')],'raw':!![]})[_0x1277('0xf')](function(_0xc7ecf9){_0x4c926f=_0xc7ecf9;return _0x36a2a7[_0x1277('0xc')]({'attributes':['id',_0x1277('0x10'),_0x1277('0x11'),'salt',_0x1277('0x12'),'disabled','blocked',_0x1277('0x13'),'loginAttempts'],'where':{'name':_0xa9e403,'role':{'$or':[_0x1277('0x14'),_0x1277('0x15'),'agent']}}});})[_0x1277('0xf')](function(_0x1366aa){if(!_0x1366aa||_0x1366aa&&_0x1366aa[_0x1277('0x10')]!==_0xa9e403){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3d8abf=_0x1366aa;return _0x3d8abf;}})['then'](function(){_0x3d8abf[_0x1277('0x16')](_0x4cf328,function(_0xb8588a,_0x2a1b75){var _0x16c6d3=_0x3d8abf['loginAttempts']+0x1;if(_0xb8588a){return _0x47a799(_0xb8588a);}else if(!_0x2a1b75){if(_0x3d8abf[_0x1277('0x17')]){return _0x47a799(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4c926f['allowedLoginAttempts']>0x0){if(_0x3d8abf[_0x1277('0x18')]){if(_0x4c926f[_0x1277('0xe')]>0x0){if(moment(_0x3d8abf[_0x1277('0x13')])[_0x1277('0x19')](_0x4c926f['blockDuration'],'minutes')>moment()){return _0x47a799(null,![],{'message':_0x1277('0x1a')});}else{return utils['clearBlockUser'](_0x3d8abf,_0x16c6d3,![],null)[_0x1277('0xf')](function(){return _0x47a799(null,![],{'message':_0x1277('0x1a')});});}}else{return _0x47a799(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x16c6d3>=_0x4c926f[_0x1277('0xd')]){return utils[_0x1277('0x1b')](_0x3d8abf,0x0,!![],moment())['then'](function(){return _0x47a799(null,![],{'message':_0x1277('0x1a')});});}else{return utils[_0x1277('0x1b')](_0x3d8abf,_0x16c6d3,![],null)[_0x1277('0xf')](function(){return _0x47a799(null,![],{'message':_0x1277('0x1a')});});}}}else{return _0x47a799(null,![],{'message':_0x1277('0x1a')});}}else{if(_0x3d8abf[_0x1277('0x17')]){return _0x47a799(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4c926f[_0x1277('0xd')]>0x0){if(_0x3d8abf[_0x1277('0x18')]){if(_0x4c926f[_0x1277('0xe')]>0x0){if(moment(_0x3d8abf[_0x1277('0x13')])[_0x1277('0x19')](_0x4c926f['blockDuration'],_0x1277('0x1c'))>moment()){return _0x47a799(null,![],{'message':_0x1277('0x1a')});}else{return utils['clearBlockUser'](_0x3d8abf,0x0,![],null)[_0x1277('0xf')](function(){return utils[_0x1277('0x1d')](_0x3d8abf);})[_0x1277('0xf')](function(){return _0x47a799(null,_0x3d8abf);});}}else{return _0x47a799(null,![],{'message':_0x1277('0x1a')});}}else{return utils[_0x1277('0x1b')](_0x3d8abf,0x0,![],null)[_0x1277('0xf')](function(){return utils[_0x1277('0x1d')](_0x3d8abf);})[_0x1277('0xf')](function(){return _0x47a799(null,_0x3d8abf);})[_0x1277('0x1e')](function(_0x3935d3){return _0x47a799(null,![],_0x3935d3);});}}else{if(_0x3d8abf['blocked']){return _0x47a799(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x3d8abf)[_0x1277('0xf')](function(){return _0x47a799(null,_0x3d8abf);});}}}});})[_0x1277('0x1e')](function(_0xfe39d1){return _0x47a799(null,![],_0xfe39d1);});}function sendServiceMail(_0x24d941){return db[_0x1277('0x1f')][_0x1277('0x20')]({'where':{'service':!![]},'attributes':['id',_0x1277('0x10'),_0x1277('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x1277('0x22')}]}]})[_0x1277('0xf')](function(_0xbd71e2){if(!_0xbd71e2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1ca3e1=_0xbd71e2['getSmtpOptions']();var _0x490cbc={'account':_0x1ca3e1,'message':_[_0x1277('0x23')]({'from':util[_0x1277('0x24')](_0x1277('0x25'),_0xbd71e2[_0x1277('0x10')],_0xbd71e2[_0x1277('0x21')]||_0xbd71e2[_0x1277('0x26')][_0x1277('0x15')])},_0x24d941)};return client['request'](_0x1277('0x27'),_0x490cbc);})[_0x1277('0xf')](function(_0x3c15f7){if(_0x3c15f7['error']){throw new Error(util[_0x1277('0x24')](_0x1277('0x28'),_0x3c15f7[_0x1277('0x29')][_0x1277('0x2a')]||JSON[_0x1277('0x2b')](_0x3c15f7[_0x1277('0x29')])));}return!![];});}function handleError(_0x3da877,_0x45e523,_0x46e4e5){return _0x3da877[_0x1277('0x2c')](_0x45e523||0x1f4)[_0x1277('0x2d')]({'message':_0x46e4e5?_0x46e4e5[_0x1277('0x2a')]||_0x46e4e5:''});}exports[_0x1277('0x2e')]=function(_0x8b5662,_0x36d338,_0x24750b){passport[_0x1277('0x16')](_0x1277('0x2f'),function(_0x408fbb,_0x1beaed,_0x104cb5){var _0x24fbf4=_0x408fbb||_0x104cb5;if(_0x24fbf4){return handleError(_0x36d338,0x191,_0x24fbf4);}if(!_0x1beaed){return handleError(_0x36d338,0x194,{'message':_0x1277('0x30')});}else{var _0x4b171c={'payload':{'id':_0x1beaed['id'],'role':_0x1beaed[_0x1277('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4b171c)[_0x1277('0xf')](function(_0x39f91c){_0x36d338[_0x1277('0x31')]({'id':_0x1beaed['id'],'token':_0x39f91c,'statusCall':'','isAlreadyLogged':_0x1beaed[_0x1277('0x32')]});});}})(_0x8b5662,_0x36d338,_0x24750b);};exports[_0x1277('0x33')]=function(_0x28fe9d,_0x512ca5){if(!_0x28fe9d['body']['email']){return handleError(_0x512ca5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x37052f=rs[_0x1277('0x34')]();_0x28fe9d['body'][_0x1277('0x21')]=_0x28fe9d['body'][_0x1277('0x21')][_0x1277('0x35')]()[_0x1277('0x36')]();var _0x2599e7;return db[_0x1277('0xb')][_0x1277('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1277('0xe')],'raw':!![]})[_0x1277('0xf')](function(_0x285029){_0x2599e7=_0x285029;return db['User'][_0x1277('0x20')]({'where':{'email':_0x28fe9d[_0x1277('0x37')]['email']}});})[_0x1277('0xf')](function(_0x448d68){if(!_0x448d68){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x448d68[_0x1277('0x17')]){throw new Error(_0x1277('0x38'));}if(_0x448d68[_0x1277('0x18')]){if(moment(_0x448d68[_0x1277('0x13')])[_0x1277('0x19')](_0x2599e7['blockDuration'],_0x1277('0x1c'))>moment()){throw new Error(_0x1277('0x39'));}else{_0x448d68[_0x1277('0x18')]=![];_0x448d68[_0x1277('0x13')]=null;}}_0x448d68['resetPasswordToken']=_0x37052f;_0x448d68[_0x1277('0x3a')]=Date['now']()+0x36ee80;return _0x448d68[_0x1277('0x3b')]();})[_0x1277('0xf')](function(){return sendServiceMail({'to':_0x28fe9d[_0x1277('0x37')][_0x1277('0x21')],'subject':_0x1277('0x3c'),'text':_0x1277('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x1277('0x3e')+_0x28fe9d[_0x1277('0x3f')][_0x1277('0x40')]+_0x1277('0x41')+_0x37052f+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x512ca5[_0x1277('0x2c')](0xc8)[_0x1277('0x2d')]({'message':_0x1277('0x42')});})['catch'](function(_0x1bbd5a){return handleError(_0x512ca5,0x1f4,_0x1bbd5a);});};exports[_0x1277('0x43')]=function(_0x5c5fb0,_0x5b47e3){return db[_0x1277('0x44')][_0x1277('0x20')]({'where':{'resetPasswordToken':_0x5c5fb0[_0x1277('0x45')][_0x1277('0x46')],'resetPasswordExpires':{'$gt':Date[_0x1277('0x47')]()}}})[_0x1277('0xf')](function(_0x400f4e){if(!_0x400f4e){throw new Error(_0x1277('0x48'));}return db['Setting']['findOne']({'attributes':['id',_0x1277('0x49'),_0x1277('0x4a'),_0x1277('0x4b')]})['then'](function(_0x3efe68){if(_0x3efe68[_0x1277('0x49')])authService['validatePasswordPattern'](_0x5c5fb0[_0x1277('0x37')][_0x1277('0x11')]);if(!_0x3efe68[_0x1277('0x4a')]||!_0x400f4e[_0x1277('0x4c')])return _0x400f4e;authService['validatePasswordHistory'](_0x5c5fb0['body'][_0x1277('0x11')],_0x400f4e['previousPasswords'],_0x3efe68[_0x1277('0x4b')]);return _0x400f4e;})[_0x1277('0xf')](function(){_0x400f4e[_0x1277('0x11')]=_0x5c5fb0[_0x1277('0x37')][_0x1277('0x11')];_0x400f4e[_0x1277('0x4d')]=null;_0x400f4e[_0x1277('0x3a')]=null;return _0x400f4e['save']();});})[_0x1277('0xf')](function(){_0x5b47e3[_0x1277('0x2c')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x1277('0x1e')](function(_0x2675c1){return handleError(_0x5b47e3,0x1f4,_0x2675c1);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0x1277('0x10'),'passwordField':_0x1277('0x11')},function(_0x1bc1f0,_0x35a27b,_0x38f614){return localAuthenticate(db[_0x1277('0x44')],_0x1bc1f0,_0x35a27b,_0x38f614);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2af4a80..f8da806 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 _0x3b01=['forgot','post','/reset/:token','reset','express','./authLocal.controller','login','/forgot'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x3b01,0x94));var _0x13b0=function(_0x5e4e37,_0x57e4ad){_0x5e4e37=_0x5e4e37-0x0;var _0xea325=_0x3b01[_0x5e4e37];return _0xea325;};'use strict';var express=require(_0x13b0('0x0'));var router=express['Router']();var controller=require(_0x13b0('0x1'));router['post']('/',controller[_0x13b0('0x2')]);router['post'](_0x13b0('0x3'),controller[_0x13b0('0x4')]);router[_0x13b0('0x5')](_0x13b0('0x6'),controller[_0x13b0('0x7')]);module['exports']=router; \ No newline at end of file +var _0xcd00=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xcd00,0x117));var _0x0cd0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcd00[_0x4b055c];return _0x4b62bb;};'use strict';var express=require(_0x0cd0('0x0'));var router=express['Router']();var controller=require(_0x0cd0('0x1'));router[_0x0cd0('0x2')]('/',controller['login']);router[_0x0cd0('0x2')](_0x0cd0('0x3'),controller[_0x0cd0('0x4')]);router[_0x0cd0('0x2')](_0x0cd0('0x5'),controller[_0x0cd0('0x6')]);module[_0x0cd0('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 791ca97..6afca5a 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 _0x04be=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x3067f3,_0x55914e){var _0xcecdf4=function(_0x2a5929){while(--_0x2a5929){_0x3067f3['push'](_0x3067f3['shift']());}};_0xcecdf4(++_0x55914e);}(_0x04be,0x162));var _0xe04b=function(_0x3169a3,_0x48f18b){_0x3169a3=_0x3169a3-0x0;var _0x4f34de=_0x04be[_0x3169a3];return _0x4f34de;};'use strict';var Sequelize=require('sequelize');module[_0xe04b('0x0')]={'name':{'type':Sequelize[_0xe04b('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe04b('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6ab1=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x32350f,_0x399d7b){var _0x5ee1df=function(_0x245da3){while(--_0x245da3){_0x32350f['push'](_0x32350f['shift']());}};_0x5ee1df(++_0x399d7b);}(_0x6ab1,0xa3));var _0x16ab=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x6ab1[_0x273f77];return _0x71e147;};'use strict';var Sequelize=require(_0x16ab('0x0'));module[_0x16ab('0x1')]={'name':{'type':Sequelize[_0x16ab('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x16ab('0x2')]},'description':{'type':Sequelize[_0x16ab('0x2')]},'status':{'type':Sequelize[_0x16ab('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x16ab('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index bf2e6b8..ca62724 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 _0x78b3=['where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','Condition','addConditions','ids','getConditions','findOne','sort','pick','addActions','Action','omit','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','map','Automation','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x41eb8b,_0x8e630f){var _0x57f6be=function(_0x552d87){while(--_0x552d87){_0x41eb8b['push'](_0x41eb8b['shift']());}};_0x57f6be(++_0x8e630f);}(_0x78b3,0x6d));var _0x378b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78b3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x378b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x378b('0x1'));var jsonpatch=require(_0x378b('0x2'));var rp=require(_0x378b('0x3'));var moment=require(_0x378b('0x4'));var BPromise=require(_0x378b('0x5'));var Mustache=require(_0x378b('0x6'));var util=require(_0x378b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x378b('0x8'));var ejs=require(_0x378b('0x9'));var fs=require('fs');var fs_extra=require(_0x378b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x378b('0xb'));var toCsv=require(_0x378b('0x8'));var querystring=require(_0x378b('0xc'));var Papa=require(_0x378b('0xd'));var Redis=require(_0x378b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x378b('0xf'));var as=require(_0x378b('0x10'));var hardwareService=require(_0x378b('0x11'));var logger=require(_0x378b('0x12'))(_0x378b('0x13'));var utils=require('../../config/utils');var config=require(_0x378b('0x14'));var licenseUtil=require(_0x378b('0x15'));var db=require(_0x378b('0x16'))['db'];function respondWithStatusCode(_0x521e73,_0x39d4c4){_0x39d4c4=_0x39d4c4||0xcc;return function(_0x35f0c5){if(_0x35f0c5){return _0x521e73['sendStatus'](_0x39d4c4);}return _0x521e73['status'](_0x39d4c4)[_0x378b('0x17')]();};}function respondWithResult(_0x3d7099,_0x38ba6e){_0x38ba6e=_0x38ba6e||0xc8;return function(_0x23cb4b){if(_0x23cb4b){return _0x3d7099[_0x378b('0x18')](_0x38ba6e)['json'](_0x23cb4b);}};}function respondWithFilteredResult(_0x91ae63,_0xf12f97){return function(_0x59ad27){if(_0x59ad27){var _0x4931e2=typeof _0xf12f97[_0x378b('0x19')]===_0x378b('0x1a')&&typeof _0xf12f97['limit']===_0x378b('0x1a');var _0xf754fa=_0x59ad27[_0x378b('0x1b')];var _0x1c0666=_0x4931e2?0x0:_0xf12f97[_0x378b('0x19')];var _0x470ab4=_0x4931e2?_0x59ad27[_0x378b('0x1b')]:_0xf12f97[_0x378b('0x19')]+_0xf12f97[_0x378b('0x1c')];var _0x4f4ea0;if(_0x470ab4>=_0xf754fa){_0x470ab4=_0xf754fa;_0x4f4ea0=0xc8;}else{_0x4f4ea0=0xce;}_0x91ae63[_0x378b('0x18')](_0x4f4ea0);return _0x91ae63['set'](_0x378b('0x1d'),_0x1c0666+'-'+_0x470ab4+'/'+_0xf754fa)['json'](_0x59ad27);}return null;};}function patchUpdates(_0x24398b){return function(_0x3497e8){try{jsonpatch[_0x378b('0x1e')](_0x3497e8,_0x24398b,!![]);}catch(_0x23e196){return BPromise[_0x378b('0x1f')](_0x23e196);}return _0x3497e8['save']();};}function saveUpdates(_0x4d9e07,_0x4f1ac8){return function(_0x5a3830){if(_0x5a3830){return _0x5a3830[_0x378b('0x20')](_0x4d9e07)[_0x378b('0x21')](function(_0x246286){return _0x246286;});}return null;};}function removeEntity(_0x58920d,_0x56c357){return function(_0x1dc970){if(_0x1dc970){return _0x1dc970['destroy']()['then'](function(){_0x58920d[_0x378b('0x18')](0xcc)[_0x378b('0x17')]();});}};}function handleEntityNotFound(_0x55719e,_0x3845a1){return function(_0x43c525){if(!_0x43c525){_0x55719e[_0x378b('0x22')](0x194);}return _0x43c525;};}function handleError(_0x29667d,_0x22afef){_0x22afef=_0x22afef||0x1f4;return function(_0x5b76d1){logger[_0x378b('0x23')](_0x5b76d1[_0x378b('0x24')]);if(_0x5b76d1[_0x378b('0x25')]){delete _0x5b76d1[_0x378b('0x25')];}_0x29667d[_0x378b('0x18')](_0x22afef)[_0x378b('0x26')](_0x5b76d1);};}exports['index']=function(_0x15801b,_0x248700){var _0x3c301b={},_0x4efddc={},_0x2691da={'count':0x0,'rows':[]};var _0x45b8cd=_[_0x378b('0x27')](db[_0x378b('0x28')]['rawAttributes'],function(_0x24af94){return{'name':_0x24af94[_0x378b('0x29')],'type':_0x24af94[_0x378b('0x2a')]['key']};});_0x4efddc[_0x378b('0x2b')]=_[_0x378b('0x27')](_0x45b8cd,_0x378b('0x25'));_0x4efddc[_0x378b('0x2c')]=_['keys'](_0x15801b['query']);_0x4efddc[_0x378b('0x2d')]=_[_0x378b('0x2e')](_0x4efddc[_0x378b('0x2b')],_0x4efddc['query']);_0x3c301b[_0x378b('0x2f')]=_['intersection'](_0x4efddc[_0x378b('0x2b')],qs[_0x378b('0x30')](_0x15801b[_0x378b('0x2c')][_0x378b('0x30')]));_0x3c301b[_0x378b('0x2f')]=_0x3c301b[_0x378b('0x2f')][_0x378b('0x31')]?_0x3c301b[_0x378b('0x2f')]:_0x4efddc[_0x378b('0x2b')];if(!_0x15801b[_0x378b('0x2c')][_0x378b('0x32')](_0x378b('0x33'))){_0x3c301b[_0x378b('0x1c')]=qs[_0x378b('0x1c')](_0x15801b[_0x378b('0x2c')]['limit']);_0x3c301b[_0x378b('0x19')]=qs['offset'](_0x15801b['query'][_0x378b('0x19')]);}_0x3c301b[_0x378b('0x34')]=qs['sort'](_0x15801b[_0x378b('0x2c')]['sort']);_0x3c301b[_0x378b('0x35')]=qs['filters'](_['pick'](_0x15801b[_0x378b('0x2c')],_0x4efddc[_0x378b('0x2d')]),_0x45b8cd);if(_0x15801b[_0x378b('0x2c')]['filter']){_0x3c301b[_0x378b('0x35')]=_['merge'](_0x3c301b['where'],{'$or':_[_0x378b('0x27')](_0x45b8cd,function(_0x2a7bd3){if(_0x2a7bd3[_0x378b('0x2a')]!=='VIRTUAL'){var _0x40a777={};_0x40a777[_0x2a7bd3[_0x378b('0x25')]]={'$like':'%'+_0x15801b[_0x378b('0x2c')][_0x378b('0x36')]+'%'};return _0x40a777;}})});}_0x3c301b=_[_0x378b('0x37')]({},_0x3c301b,_0x15801b[_0x378b('0x38')]);var _0x5ba8b8={'where':_0x3c301b[_0x378b('0x35')]};return db[_0x378b('0x28')][_0x378b('0x1b')](_0x5ba8b8)[_0x378b('0x21')](function(_0x38bd7d){_0x2691da[_0x378b('0x1b')]=_0x38bd7d;if(_0x15801b[_0x378b('0x2c')][_0x378b('0x39')]){_0x3c301b[_0x378b('0x3a')]=[{'all':!![]}];}return db[_0x378b('0x28')][_0x378b('0x3b')](_0x3c301b);})[_0x378b('0x21')](function(_0x7db198){_0x2691da[_0x378b('0x3c')]=_0x7db198;return _0x2691da;})[_0x378b('0x21')](respondWithFilteredResult(_0x248700,_0x3c301b))[_0x378b('0x3d')](handleError(_0x248700,null));};exports[_0x378b('0x3e')]=function(_0x2dd0eb,_0x19134d){var _0x117051={'raw':![],'where':{'id':_0x2dd0eb[_0x378b('0x3f')]['id']}},_0x4ba266={};_0x4ba266[_0x378b('0x2b')]=_[_0x378b('0x40')](db[_0x378b('0x28')][_0x378b('0x41')]);_0x4ba266[_0x378b('0x2c')]=_[_0x378b('0x40')](_0x2dd0eb['query']);_0x4ba266[_0x378b('0x2d')]=_[_0x378b('0x2e')](_0x4ba266[_0x378b('0x2b')],_0x4ba266[_0x378b('0x2c')]);_0x117051[_0x378b('0x2f')]=_[_0x378b('0x2e')](_0x4ba266[_0x378b('0x2b')],qs[_0x378b('0x30')](_0x2dd0eb[_0x378b('0x2c')][_0x378b('0x30')]));_0x117051[_0x378b('0x2f')]=_0x117051[_0x378b('0x2f')]['length']?_0x117051['attributes']:_0x4ba266[_0x378b('0x2b')];if(_0x2dd0eb['query'][_0x378b('0x39')]){_0x117051[_0x378b('0x3a')]=[{'all':!![]}];}_0x117051=_[_0x378b('0x37')]({},_0x117051,_0x2dd0eb['options']);return db[_0x378b('0x28')][_0x378b('0x42')](_0x117051)[_0x378b('0x21')](handleEntityNotFound(_0x19134d,null))[_0x378b('0x21')](respondWithResult(_0x19134d,null))[_0x378b('0x3d')](handleError(_0x19134d,null));};exports[_0x378b('0x43')]=function(_0x359acc,_0x17c1d2){return db[_0x378b('0x28')][_0x378b('0x43')](_0x359acc[_0x378b('0x44')],{})[_0x378b('0x21')](respondWithResult(_0x17c1d2,0xc9))['catch'](handleError(_0x17c1d2,null));};exports[_0x378b('0x20')]=function(_0x100fb9,_0x2ebaec){if(_0x100fb9[_0x378b('0x44')]['id']){delete _0x100fb9[_0x378b('0x44')]['id'];}return db[_0x378b('0x28')][_0x378b('0x42')]({'where':{'id':_0x100fb9['params']['id']}})['then'](handleEntityNotFound(_0x2ebaec,null))[_0x378b('0x21')](saveUpdates(_0x100fb9['body'],null))[_0x378b('0x21')](respondWithResult(_0x2ebaec,null))[_0x378b('0x3d')](handleError(_0x2ebaec,null));};exports[_0x378b('0x45')]=function(_0x33b281,_0x2f2bcb){return db['Automation']['find']({'where':{'id':_0x33b281['params']['id']}})[_0x378b('0x21')](handleEntityNotFound(_0x2f2bcb,null))[_0x378b('0x21')](removeEntity(_0x2f2bcb,null))[_0x378b('0x3d')](handleError(_0x2f2bcb,null));};exports['addConditions']=function(_0x4c55b8,_0x59c859,_0x286380){return db[_0x378b('0x46')][_0x378b('0x42')]({'where':{'id':_0x4c55b8['params']['id']}})['then'](handleEntityNotFound(_0x59c859,null))[_0x378b('0x21')](function(_0x2381d4){if(_0x2381d4){return _0x2381d4[_0x378b('0x47')](_0x4c55b8['body'][_0x378b('0x48')],_['omit'](_0x4c55b8['body'],['ids','id'])||{});}})[_0x378b('0x21')](respondWithResult(_0x59c859,null))[_0x378b('0x3d')](handleError(_0x59c859,null));};exports[_0x378b('0x49')]=function(_0xd46175,_0x4e09f3,_0x5af232){var _0x5d79a2={};var _0x16181b={};var _0xdcc7c5;var _0x8279f6;return db['Automation'][_0x378b('0x4a')]({'where':{'id':_0xd46175[_0x378b('0x3f')]['id']}})[_0x378b('0x21')](handleEntityNotFound(_0x4e09f3,null))[_0x378b('0x21')](function(_0x516d10){if(_0x516d10){_0xdcc7c5=_0x516d10;_0x16181b[_0x378b('0x2b')]=_[_0x378b('0x40')](db[_0x378b('0x46')]['rawAttributes']);_0x16181b[_0x378b('0x2c')]=_[_0x378b('0x40')](_0xd46175[_0x378b('0x2c')]);_0x16181b[_0x378b('0x2d')]=_[_0x378b('0x2e')](_0x16181b[_0x378b('0x2b')],_0x16181b['query']);_0x5d79a2[_0x378b('0x2f')]=_['intersection'](_0x16181b[_0x378b('0x2b')],qs['fields'](_0xd46175[_0x378b('0x2c')][_0x378b('0x30')]));_0x5d79a2[_0x378b('0x2f')]=_0x5d79a2[_0x378b('0x2f')]['length']?_0x5d79a2[_0x378b('0x2f')]:_0x16181b[_0x378b('0x2b')];_0x5d79a2[_0x378b('0x34')]=qs['sort'](_0xd46175['query'][_0x378b('0x4b')]);_0x5d79a2[_0x378b('0x35')]=qs[_0x378b('0x2d')](_[_0x378b('0x4c')](_0xd46175['query'],_0x16181b[_0x378b('0x2d')]));if(_0xd46175[_0x378b('0x2c')][_0x378b('0x36')]){_0x5d79a2[_0x378b('0x35')]=_['merge'](_0x5d79a2[_0x378b('0x35')],{'$or':_[_0x378b('0x27')](_0x5d79a2[_0x378b('0x2f')],function(_0x4e69c5){var _0x363e99={};_0x363e99[_0x4e69c5]={'$like':'%'+_0xd46175[_0x378b('0x2c')][_0x378b('0x36')]+'%'};return _0x363e99;})});}_0x5d79a2=_[_0x378b('0x37')]({},_0x5d79a2,_0xd46175[_0x378b('0x38')]);return _0xdcc7c5[_0x378b('0x49')](_0x5d79a2);}})[_0x378b('0x21')](function(_0x2950f9){if(_0x2950f9){_0x8279f6=_0x2950f9[_0x378b('0x31')];if(!_0xd46175[_0x378b('0x2c')][_0x378b('0x32')]('nolimit')){_0x5d79a2[_0x378b('0x1c')]=qs[_0x378b('0x1c')](_0xd46175[_0x378b('0x2c')]['limit']);_0x5d79a2[_0x378b('0x19')]=qs['offset'](_0xd46175[_0x378b('0x2c')][_0x378b('0x19')]);}return _0xdcc7c5[_0x378b('0x49')](_0x5d79a2);}})['then'](function(_0xa4972){if(_0xa4972){return _0xa4972?{'count':_0x8279f6,'rows':_0xa4972}:null;}})['then'](respondWithResult(_0x4e09f3,null))['catch'](handleError(_0x4e09f3,null));};exports[_0x378b('0x4d')]=function(_0x2319cb,_0x47b6d1,_0x510ce7){return db[_0x378b('0x4e')]['find']({'where':{'id':_0x2319cb['params']['id']}})[_0x378b('0x21')](handleEntityNotFound(_0x47b6d1,null))['then'](function(_0x5bcb62){if(_0x5bcb62){return _0x5bcb62[_0x378b('0x4d')](_0x2319cb[_0x378b('0x44')][_0x378b('0x48')],_[_0x378b('0x4f')](_0x2319cb[_0x378b('0x44')],[_0x378b('0x48'),'id'])||{});}})[_0x378b('0x21')](respondWithResult(_0x47b6d1,null))[_0x378b('0x3d')](handleError(_0x47b6d1,null));};exports[_0x378b('0x50')]=function(_0x2bb98f,_0x1de7e2,_0x39d782){var _0xe6445={};var _0x4306f7={};var _0x40468f;var _0x506b35;return db['Automation'][_0x378b('0x4a')]({'where':{'id':_0x2bb98f[_0x378b('0x3f')]['id']}})[_0x378b('0x21')](handleEntityNotFound(_0x1de7e2,null))['then'](function(_0x431fa2){if(_0x431fa2){_0x40468f=_0x431fa2;_0x4306f7[_0x378b('0x2b')]=_[_0x378b('0x40')](db[_0x378b('0x4e')][_0x378b('0x41')]);_0x4306f7[_0x378b('0x2c')]=_['keys'](_0x2bb98f[_0x378b('0x2c')]);_0x4306f7[_0x378b('0x2d')]=_[_0x378b('0x2e')](_0x4306f7[_0x378b('0x2b')],_0x4306f7[_0x378b('0x2c')]);_0xe6445[_0x378b('0x2f')]=_[_0x378b('0x2e')](_0x4306f7['model'],qs[_0x378b('0x30')](_0x2bb98f[_0x378b('0x2c')][_0x378b('0x30')]));_0xe6445['attributes']=_0xe6445[_0x378b('0x2f')][_0x378b('0x31')]?_0xe6445[_0x378b('0x2f')]:_0x4306f7[_0x378b('0x2b')];_0xe6445[_0x378b('0x34')]=qs[_0x378b('0x4b')](_0x2bb98f[_0x378b('0x2c')][_0x378b('0x4b')]);_0xe6445[_0x378b('0x35')]=qs['filters'](_['pick'](_0x2bb98f[_0x378b('0x2c')],_0x4306f7['filters']));if(_0x2bb98f[_0x378b('0x2c')][_0x378b('0x36')]){_0xe6445[_0x378b('0x35')]=_[_0x378b('0x37')](_0xe6445[_0x378b('0x35')],{'$or':_['map'](_0xe6445[_0x378b('0x2f')],function(_0xd1cc7a){var _0x5c6547={};_0x5c6547[_0xd1cc7a]={'$like':'%'+_0x2bb98f[_0x378b('0x2c')][_0x378b('0x36')]+'%'};return _0x5c6547;})});}_0xe6445=_[_0x378b('0x37')]({},_0xe6445,_0x2bb98f[_0x378b('0x38')]);return _0x40468f[_0x378b('0x50')](_0xe6445);}})[_0x378b('0x21')](function(_0x208883){if(_0x208883){_0x506b35=_0x208883['length'];if(!_0x2bb98f[_0x378b('0x2c')][_0x378b('0x32')]('nolimit')){_0xe6445[_0x378b('0x1c')]=qs[_0x378b('0x1c')](_0x2bb98f[_0x378b('0x2c')]['limit']);_0xe6445[_0x378b('0x19')]=qs[_0x378b('0x19')](_0x2bb98f['query'][_0x378b('0x19')]);}return _0x40468f[_0x378b('0x50')](_0xe6445);}})['then'](function(_0x1003ad){if(_0x1003ad){return _0x1003ad?{'count':_0x506b35,'rows':_0x1003ad}:null;}})[_0x378b('0x21')](respondWithResult(_0x1de7e2,null))[_0x378b('0x3d')](handleError(_0x1de7e2,null));}; \ No newline at end of file +var _0x81b2=['addActions','Action','getActions','findOne','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','name','filter','options','count','includeAll','include','findAll','rows','catch','create','body','find','params','addConditions','Condition','ids','omit','order','getConditions','nolimit'];(function(_0x1ecdc3,_0x24bef0){var _0x505882=function(_0x571b66){while(--_0x571b66){_0x1ecdc3['push'](_0x1ecdc3['shift']());}};_0x505882(++_0x24bef0);}(_0x81b2,0x1a8));var _0x281b=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x81b2[_0x2442b9];return _0x31b571;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x281b('0x0'));var rp=require(_0x281b('0x1'));var moment=require(_0x281b('0x2'));var BPromise=require(_0x281b('0x3'));var Mustache=require(_0x281b('0x4'));var util=require(_0x281b('0x5'));var path=require(_0x281b('0x6'));var sox=require(_0x281b('0x7'));var csv=require(_0x281b('0x8'));var ejs=require(_0x281b('0x9'));var fs=require('fs');var fs_extra=require(_0x281b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x281b('0xb'));var jsforce=require(_0x281b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x281b('0x8'));var querystring=require(_0x281b('0xd'));var Papa=require(_0x281b('0xe'));var Redis=require(_0x281b('0xf'));var authService=require(_0x281b('0x10'));var qs=require(_0x281b('0x11'));var as=require(_0x281b('0x12'));var hardwareService=require(_0x281b('0x13'));var logger=require(_0x281b('0x14'))(_0x281b('0x15'));var utils=require(_0x281b('0x16'));var config=require(_0x281b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x281b('0x18'))['db'];function respondWithStatusCode(_0x18687b,_0x83acff){_0x83acff=_0x83acff||0xcc;return function(_0x28a273){if(_0x28a273){return _0x18687b['sendStatus'](_0x83acff);}return _0x18687b[_0x281b('0x19')](_0x83acff)[_0x281b('0x1a')]();};}function respondWithResult(_0x47f9bd,_0x2ef59e){_0x2ef59e=_0x2ef59e||0xc8;return function(_0x3e5cf9){if(_0x3e5cf9){return _0x47f9bd['status'](_0x2ef59e)[_0x281b('0x1b')](_0x3e5cf9);}};}function respondWithFilteredResult(_0x18666c,_0x1e7899){return function(_0x5087de){if(_0x5087de){var _0x25e5fa=typeof _0x1e7899[_0x281b('0x1c')]==='undefined'&&typeof _0x1e7899[_0x281b('0x1d')]==='undefined';var _0x21d1df=_0x5087de['count'];var _0x2d9817=_0x25e5fa?0x0:_0x1e7899[_0x281b('0x1c')];var _0x4ec1f3=_0x25e5fa?_0x5087de['count']:_0x1e7899[_0x281b('0x1c')]+_0x1e7899[_0x281b('0x1d')];var _0x31cf9e;if(_0x4ec1f3>=_0x21d1df){_0x4ec1f3=_0x21d1df;_0x31cf9e=0xc8;}else{_0x31cf9e=0xce;}_0x18666c[_0x281b('0x19')](_0x31cf9e);return _0x18666c[_0x281b('0x1e')]('Content-Range',_0x2d9817+'-'+_0x4ec1f3+'/'+_0x21d1df)[_0x281b('0x1b')](_0x5087de);}return null;};}function patchUpdates(_0x139ef5){return function(_0x584514){try{jsonpatch[_0x281b('0x1f')](_0x584514,_0x139ef5,!![]);}catch(_0x43b1b6){return BPromise[_0x281b('0x20')](_0x43b1b6);}return _0x584514[_0x281b('0x21')]();};}function saveUpdates(_0x3ee8da,_0x4f0584){return function(_0x552c95){if(_0x552c95){return _0x552c95[_0x281b('0x22')](_0x3ee8da)['then'](function(_0x47d42f){return _0x47d42f;});}return null;};}function removeEntity(_0x4dbdc7,_0x4acd9d){return function(_0x58925){if(_0x58925){return _0x58925[_0x281b('0x23')]()[_0x281b('0x24')](function(){_0x4dbdc7[_0x281b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x544336,_0x3b679a){return function(_0x15b3c4){if(!_0x15b3c4){_0x544336['sendStatus'](0x194);}return _0x15b3c4;};}function handleError(_0x34044b,_0x5e2afd){_0x5e2afd=_0x5e2afd||0x1f4;return function(_0x15c8d9){logger[_0x281b('0x25')](_0x15c8d9[_0x281b('0x26')]);if(_0x15c8d9['name']){delete _0x15c8d9['name'];}_0x34044b[_0x281b('0x19')](_0x5e2afd)[_0x281b('0x27')](_0x15c8d9);};}exports[_0x281b('0x28')]=function(_0x6b84b7,_0x309f69){var _0x54b12c={},_0x1e8f31={},_0xc3f4d6={'count':0x0,'rows':[]};var _0x4417f4=_[_0x281b('0x29')](db[_0x281b('0x2a')][_0x281b('0x2b')],function(_0x2ec470){return{'name':_0x2ec470[_0x281b('0x2c')],'type':_0x2ec470['type'][_0x281b('0x2d')]};});_0x1e8f31[_0x281b('0x2e')]=_[_0x281b('0x29')](_0x4417f4,'name');_0x1e8f31[_0x281b('0x2f')]=_[_0x281b('0x30')](_0x6b84b7[_0x281b('0x2f')]);_0x1e8f31[_0x281b('0x31')]=_['intersection'](_0x1e8f31['model'],_0x1e8f31[_0x281b('0x2f')]);_0x54b12c[_0x281b('0x32')]=_[_0x281b('0x33')](_0x1e8f31[_0x281b('0x2e')],qs['fields'](_0x6b84b7[_0x281b('0x2f')][_0x281b('0x34')]));_0x54b12c['attributes']=_0x54b12c[_0x281b('0x32')][_0x281b('0x35')]?_0x54b12c[_0x281b('0x32')]:_0x1e8f31[_0x281b('0x2e')];if(!_0x6b84b7[_0x281b('0x2f')][_0x281b('0x36')]('nolimit')){_0x54b12c[_0x281b('0x1d')]=qs[_0x281b('0x1d')](_0x6b84b7[_0x281b('0x2f')][_0x281b('0x1d')]);_0x54b12c[_0x281b('0x1c')]=qs[_0x281b('0x1c')](_0x6b84b7[_0x281b('0x2f')][_0x281b('0x1c')]);}_0x54b12c['order']=qs[_0x281b('0x37')](_0x6b84b7['query'][_0x281b('0x37')]);_0x54b12c[_0x281b('0x38')]=qs['filters'](_[_0x281b('0x39')](_0x6b84b7['query'],_0x1e8f31[_0x281b('0x31')]),_0x4417f4);if(_0x6b84b7[_0x281b('0x2f')]['filter']){_0x54b12c['where']=_[_0x281b('0x3a')](_0x54b12c[_0x281b('0x38')],{'$or':_['map'](_0x4417f4,function(_0x975df9){if(_0x975df9['type']!==_0x281b('0x3b')){var _0x18cbce={};_0x18cbce[_0x975df9[_0x281b('0x3c')]]={'$like':'%'+_0x6b84b7[_0x281b('0x2f')][_0x281b('0x3d')]+'%'};return _0x18cbce;}})});}_0x54b12c=_[_0x281b('0x3a')]({},_0x54b12c,_0x6b84b7[_0x281b('0x3e')]);var _0x499955={'where':_0x54b12c[_0x281b('0x38')]};return db['Automation'][_0x281b('0x3f')](_0x499955)['then'](function(_0x15d3b9){_0xc3f4d6[_0x281b('0x3f')]=_0x15d3b9;if(_0x6b84b7[_0x281b('0x2f')][_0x281b('0x40')]){_0x54b12c[_0x281b('0x41')]=[{'all':!![]}];}return db[_0x281b('0x2a')][_0x281b('0x42')](_0x54b12c);})[_0x281b('0x24')](function(_0x41f121){_0xc3f4d6[_0x281b('0x43')]=_0x41f121;return _0xc3f4d6;})['then'](respondWithFilteredResult(_0x309f69,_0x54b12c))['catch'](handleError(_0x309f69,null));};exports['show']=function(_0x201cd2,_0x5e87cb){var _0x3cc280={'raw':![],'where':{'id':_0x201cd2['params']['id']}},_0x26f497={};_0x26f497['model']=_[_0x281b('0x30')](db[_0x281b('0x2a')][_0x281b('0x2b')]);_0x26f497['query']=_[_0x281b('0x30')](_0x201cd2['query']);_0x26f497[_0x281b('0x31')]=_[_0x281b('0x33')](_0x26f497['model'],_0x26f497[_0x281b('0x2f')]);_0x3cc280[_0x281b('0x32')]=_[_0x281b('0x33')](_0x26f497[_0x281b('0x2e')],qs[_0x281b('0x34')](_0x201cd2[_0x281b('0x2f')][_0x281b('0x34')]));_0x3cc280[_0x281b('0x32')]=_0x3cc280['attributes'][_0x281b('0x35')]?_0x3cc280[_0x281b('0x32')]:_0x26f497[_0x281b('0x2e')];if(_0x201cd2[_0x281b('0x2f')][_0x281b('0x40')]){_0x3cc280[_0x281b('0x41')]=[{'all':!![]}];}_0x3cc280=_[_0x281b('0x3a')]({},_0x3cc280,_0x201cd2[_0x281b('0x3e')]);return db['Automation']['find'](_0x3cc280)[_0x281b('0x24')](handleEntityNotFound(_0x5e87cb,null))['then'](respondWithResult(_0x5e87cb,null))[_0x281b('0x44')](handleError(_0x5e87cb,null));};exports['create']=function(_0x282ecf,_0x4f2202){return db[_0x281b('0x2a')][_0x281b('0x45')](_0x282ecf['body'],{})['then'](respondWithResult(_0x4f2202,0xc9))[_0x281b('0x44')](handleError(_0x4f2202,null));};exports['update']=function(_0x113565,_0x57da26){if(_0x113565[_0x281b('0x46')]['id']){delete _0x113565['body']['id'];}return db[_0x281b('0x2a')][_0x281b('0x47')]({'where':{'id':_0x113565['params']['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x57da26,null))[_0x281b('0x24')](saveUpdates(_0x113565['body'],null))['then'](respondWithResult(_0x57da26,null))['catch'](handleError(_0x57da26,null));};exports['destroy']=function(_0x3abd37,_0x525b12){return db[_0x281b('0x2a')][_0x281b('0x47')]({'where':{'id':_0x3abd37[_0x281b('0x48')]['id']}})['then'](handleEntityNotFound(_0x525b12,null))[_0x281b('0x24')](removeEntity(_0x525b12,null))[_0x281b('0x44')](handleError(_0x525b12,null));};exports[_0x281b('0x49')]=function(_0x55e756,_0x355fce,_0x2e2786){return db[_0x281b('0x4a')][_0x281b('0x47')]({'where':{'id':_0x55e756[_0x281b('0x48')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x355fce,null))['then'](function(_0x501cc7){if(_0x501cc7){return _0x501cc7[_0x281b('0x49')](_0x55e756[_0x281b('0x46')][_0x281b('0x4b')],_[_0x281b('0x4c')](_0x55e756[_0x281b('0x46')],[_0x281b('0x4b'),'id'])||{});}})[_0x281b('0x24')](respondWithResult(_0x355fce,null))[_0x281b('0x44')](handleError(_0x355fce,null));};exports['getConditions']=function(_0x236250,_0xcecc45,_0x19d959){var _0xc90800={};var _0x39d995={};var _0x2e0880;var _0x4f6edd;return db['Automation']['findOne']({'where':{'id':_0x236250[_0x281b('0x48')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0xcecc45,null))[_0x281b('0x24')](function(_0xd80d7c){if(_0xd80d7c){_0x2e0880=_0xd80d7c;_0x39d995[_0x281b('0x2e')]=_[_0x281b('0x30')](db[_0x281b('0x4a')]['rawAttributes']);_0x39d995[_0x281b('0x2f')]=_[_0x281b('0x30')](_0x236250[_0x281b('0x2f')]);_0x39d995[_0x281b('0x31')]=_['intersection'](_0x39d995['model'],_0x39d995[_0x281b('0x2f')]);_0xc90800['attributes']=_['intersection'](_0x39d995['model'],qs[_0x281b('0x34')](_0x236250[_0x281b('0x2f')][_0x281b('0x34')]));_0xc90800[_0x281b('0x32')]=_0xc90800[_0x281b('0x32')][_0x281b('0x35')]?_0xc90800[_0x281b('0x32')]:_0x39d995[_0x281b('0x2e')];_0xc90800[_0x281b('0x4d')]=qs['sort'](_0x236250[_0x281b('0x2f')]['sort']);_0xc90800[_0x281b('0x38')]=qs[_0x281b('0x31')](_[_0x281b('0x39')](_0x236250['query'],_0x39d995[_0x281b('0x31')]));if(_0x236250[_0x281b('0x2f')][_0x281b('0x3d')]){_0xc90800[_0x281b('0x38')]=_[_0x281b('0x3a')](_0xc90800[_0x281b('0x38')],{'$or':_[_0x281b('0x29')](_0xc90800[_0x281b('0x32')],function(_0x259c11){var _0x2c2b5b={};_0x2c2b5b[_0x259c11]={'$like':'%'+_0x236250['query']['filter']+'%'};return _0x2c2b5b;})});}_0xc90800=_[_0x281b('0x3a')]({},_0xc90800,_0x236250[_0x281b('0x3e')]);return _0x2e0880[_0x281b('0x4e')](_0xc90800);}})[_0x281b('0x24')](function(_0x1a5896){if(_0x1a5896){_0x4f6edd=_0x1a5896[_0x281b('0x35')];if(!_0x236250[_0x281b('0x2f')]['hasOwnProperty'](_0x281b('0x4f'))){_0xc90800['limit']=qs[_0x281b('0x1d')](_0x236250['query'][_0x281b('0x1d')]);_0xc90800[_0x281b('0x1c')]=qs[_0x281b('0x1c')](_0x236250['query'][_0x281b('0x1c')]);}return _0x2e0880['getConditions'](_0xc90800);}})[_0x281b('0x24')](function(_0x3ab6c5){if(_0x3ab6c5){return _0x3ab6c5?{'count':_0x4f6edd,'rows':_0x3ab6c5}:null;}})[_0x281b('0x24')](respondWithResult(_0xcecc45,null))[_0x281b('0x44')](handleError(_0xcecc45,null));};exports[_0x281b('0x50')]=function(_0x268855,_0x2bb8f5,_0x1e59a9){return db[_0x281b('0x51')][_0x281b('0x47')]({'where':{'id':_0x268855[_0x281b('0x48')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x2bb8f5,null))[_0x281b('0x24')](function(_0x1c68e3){if(_0x1c68e3){return _0x1c68e3[_0x281b('0x50')](_0x268855[_0x281b('0x46')][_0x281b('0x4b')],_[_0x281b('0x4c')](_0x268855[_0x281b('0x46')],[_0x281b('0x4b'),'id'])||{});}})[_0x281b('0x24')](respondWithResult(_0x2bb8f5,null))['catch'](handleError(_0x2bb8f5,null));};exports[_0x281b('0x52')]=function(_0x50e7dd,_0x522a1c,_0x31642c){var _0x3b8853={};var _0x18bffe={};var _0x438eaa;var _0x4f23d4;return db[_0x281b('0x2a')][_0x281b('0x53')]({'where':{'id':_0x50e7dd[_0x281b('0x48')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x522a1c,null))[_0x281b('0x24')](function(_0x482df0){if(_0x482df0){_0x438eaa=_0x482df0;_0x18bffe[_0x281b('0x2e')]=_[_0x281b('0x30')](db[_0x281b('0x51')][_0x281b('0x2b')]);_0x18bffe[_0x281b('0x2f')]=_[_0x281b('0x30')](_0x50e7dd[_0x281b('0x2f')]);_0x18bffe[_0x281b('0x31')]=_[_0x281b('0x33')](_0x18bffe[_0x281b('0x2e')],_0x18bffe['query']);_0x3b8853[_0x281b('0x32')]=_[_0x281b('0x33')](_0x18bffe[_0x281b('0x2e')],qs[_0x281b('0x34')](_0x50e7dd[_0x281b('0x2f')][_0x281b('0x34')]));_0x3b8853[_0x281b('0x32')]=_0x3b8853[_0x281b('0x32')][_0x281b('0x35')]?_0x3b8853[_0x281b('0x32')]:_0x18bffe[_0x281b('0x2e')];_0x3b8853[_0x281b('0x4d')]=qs[_0x281b('0x37')](_0x50e7dd['query'][_0x281b('0x37')]);_0x3b8853['where']=qs['filters'](_[_0x281b('0x39')](_0x50e7dd['query'],_0x18bffe[_0x281b('0x31')]));if(_0x50e7dd[_0x281b('0x2f')][_0x281b('0x3d')]){_0x3b8853[_0x281b('0x38')]=_[_0x281b('0x3a')](_0x3b8853['where'],{'$or':_[_0x281b('0x29')](_0x3b8853[_0x281b('0x32')],function(_0x2382b8){var _0x16a0bf={};_0x16a0bf[_0x2382b8]={'$like':'%'+_0x50e7dd[_0x281b('0x2f')][_0x281b('0x3d')]+'%'};return _0x16a0bf;})});}_0x3b8853=_[_0x281b('0x3a')]({},_0x3b8853,_0x50e7dd[_0x281b('0x3e')]);return _0x438eaa[_0x281b('0x52')](_0x3b8853);}})[_0x281b('0x24')](function(_0x5f00fc){if(_0x5f00fc){_0x4f23d4=_0x5f00fc[_0x281b('0x35')];if(!_0x50e7dd[_0x281b('0x2f')][_0x281b('0x36')](_0x281b('0x4f'))){_0x3b8853[_0x281b('0x1d')]=qs[_0x281b('0x1d')](_0x50e7dd[_0x281b('0x2f')][_0x281b('0x1d')]);_0x3b8853[_0x281b('0x1c')]=qs[_0x281b('0x1c')](_0x50e7dd[_0x281b('0x2f')][_0x281b('0x1c')]);}return _0x438eaa['getActions'](_0x3b8853);}})[_0x281b('0x24')](function(_0x21d042){if(_0x21d042){return _0x21d042?{'count':_0x4f23d4,'rows':_0x21d042}:null;}})['then'](respondWithResult(_0x522a1c,null))[_0x281b('0x44')](handleError(_0x522a1c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 73b54ee..89e350c 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 _0xf38b=['request-promise','path','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','moment','bluebird'];(function(_0x47a41f,_0x48d92b){var _0x2411f5=function(_0x3f5b72){while(--_0x3f5b72){_0x47a41f['push'](_0x47a41f['shift']());}};_0x2411f5(++_0x48d92b);}(_0xf38b,0x10a));var _0xbf38=function(_0x2417f5,_0x15553f){_0x2417f5=_0x2417f5-0x0;var _0x181eec=_0xf38b[_0x2417f5];return _0x181eec;};'use strict';var _=require(_0xbf38('0x0'));var util=require(_0xbf38('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbf38('0x2'));var BPromise=require(_0xbf38('0x3'));var rp=require(_0xbf38('0x4'));var fs=require('fs');var path=require(_0xbf38('0x5'));var rimraf=require('rimraf');var config=require(_0xbf38('0x6'));var attributes=require(_0xbf38('0x7'));module['exports']=function(_0x1450a4,_0x15da51){return _0x1450a4['define'](_0xbf38('0x8'),attributes,{'tableName':_0xbf38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e16=['api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0e16,0x17e));var _0x60e1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0e16[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x60e1('0x0'));var logger=require(_0x60e1('0x1'))(_0x60e1('0x2'));var moment=require(_0x60e1('0x3'));var BPromise=require(_0x60e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60e1('0x5'));var config=require(_0x60e1('0x6'));var attributes=require(_0x60e1('0x7'));module[_0x60e1('0x8')]=function(_0x5a04af,_0x38d81f){return _0x5a04af[_0x60e1('0x9')](_0x60e1('0xa'),attributes,{'tableName':_0x60e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 4cdd8c4..c41356b 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 _0x1410=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1410,0x130));var _0x0141=function(_0xd6bcdb,_0x44853c){_0xd6bcdb=_0xd6bcdb-0x0;var _0x199a86=_0x1410[_0xd6bcdb];return _0x199a86;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file +var _0x508a=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require('util');var moment=require(_0xa508('0x1'));var BPromise=require(_0xa508('0x2'));var rs=require(_0xa508('0x3'));var fs=require('fs');var Redis=require(_0xa508('0x4'));var db=require(_0xa508('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa508('0x6'))(_0xa508('0x7'));var config=require(_0xa508('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa508('0x9')][_0xa508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406df0,_0x4ddfec,_0x284fb1){return new BPromise(function(_0x6f201c,_0x4f6c23){return client[_0xa508('0xb')](_0x406df0,_0x284fb1)[_0xa508('0xc')](function(_0x577617){logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,_0xa508('0xf'));logger[_0xa508('0x10')](_0xa508('0x11'),_0x4ddfec,'request\x20sent',JSON[_0xa508('0x12')](_0x577617));if(_0x577617[_0xa508('0x13')]){if(_0x577617['error'][_0xa508('0x14')]===0x1f4){logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617['error'][_0xa508('0x15')]);return _0x4f6c23(_0x577617['error'][_0xa508('0x15')]);}logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617[_0xa508('0x13')]['message']);return _0x6f201c(_0x577617[_0xa508('0x13')][_0xa508('0x15')]);}else{logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,'request\x20sent');_0x6f201c(_0x577617[_0xa508('0x16')][_0xa508('0x15')]);}})[_0xa508('0x17')](function(_0xb76bf){logger['error'](_0xa508('0xe'),_0x4ddfec,_0xb76bf);_0x4f6c23(_0xb76bf);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 178ce76..5f74fbe 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 _0xcd3a=['show','/:id/conditions','getConditions','post','create','addConditions','addActions','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id'];(function(_0xa5f5ab,_0x251aa3){var _0xc25c1b=function(_0x10af38){while(--_0x10af38){_0xa5f5ab['push'](_0xa5f5ab['shift']());}};_0xc25c1b(++_0x251aa3);}(_0xcd3a,0xcf));var _0xacd3=function(_0x3e27a5,_0x1b0bb0){_0x3e27a5=_0x3e27a5-0x0;var _0x2b666e=_0xcd3a[_0x3e27a5];return _0x2b666e;};'use strict';var multer=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var path=require(_0xacd3('0x2'));var timeout=require(_0xacd3('0x3'));var express=require(_0xacd3('0x4'));var router=express[_0xacd3('0x5')]();var fs_extra=require(_0xacd3('0x6'));var auth=require(_0xacd3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xacd3('0x8'));var controller=require(_0xacd3('0x9'));router[_0xacd3('0xa')]('/',auth[_0xacd3('0xb')](),controller['index']);router['get'](_0xacd3('0xc'),auth[_0xacd3('0xb')](),controller[_0xacd3('0xd')]);router['get'](_0xacd3('0xe'),auth[_0xacd3('0xb')](),controller[_0xacd3('0xf')]);router[_0xacd3('0xa')]('/:id/actions',auth[_0xacd3('0xb')](),controller['getActions']);router[_0xacd3('0x10')]('/',auth[_0xacd3('0xb')](),controller[_0xacd3('0x11')]);router[_0xacd3('0x10')]('/:id/conditions',auth[_0xacd3('0xb')](),controller[_0xacd3('0x12')]);router[_0xacd3('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0xacd3('0x13')]);router[_0xacd3('0x14')]('/:id',auth[_0xacd3('0xb')](),controller['update']);router['delete'](_0xacd3('0xc'),auth[_0xacd3('0xb')](),controller['destroy']);module[_0xacd3('0x15')]=router; \ No newline at end of file +var _0x3f2b=['path','connect-timeout','express','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','/:id','delete','destroy','exports','multer'];(function(_0x22d1b4,_0x337045){var _0x1a0ab4=function(_0x1318bf){while(--_0x1318bf){_0x22d1b4['push'](_0x22d1b4['shift']());}};_0x1a0ab4(++_0x337045);}(_0x3f2b,0x72));var _0xb3f2=function(_0x1acc29,_0x151db2){_0x1acc29=_0x1acc29-0x0;var _0x5b91ef=_0x3f2b[_0x1acc29];return _0x5b91ef;};'use strict';var multer=require(_0xb3f2('0x0'));var util=require('util');var path=require(_0xb3f2('0x1'));var timeout=require(_0xb3f2('0x2'));var express=require(_0xb3f2('0x3'));var router=express['Router']();var fs_extra=require(_0xb3f2('0x4'));var auth=require(_0xb3f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3f2('0x6'));router[_0xb3f2('0x7')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x9')]);router['get']('/:id',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xa')]);router[_0xb3f2('0x7')](_0xb3f2('0xb'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xc')]);router[_0xb3f2('0x7')](_0xb3f2('0xd'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xe')]);router[_0xb3f2('0xf')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x10')]);router[_0xb3f2('0xf')](_0xb3f2('0xb'),auth['isAuthenticated'](),controller[_0xb3f2('0x11')]);router['post'](_0xb3f2('0xd'),auth[_0xb3f2('0x8')](),controller['addActions']);router[_0xb3f2('0x12')](_0xb3f2('0x13'),auth[_0xb3f2('0x8')](),controller['update']);router[_0xb3f2('0x14')](_0xb3f2('0x13'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x15')]);module[_0xb3f2('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0892552..576a56e 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 _0x7a1a=['always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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)'];(function(_0x3d1825,_0x319490){var _0x4098f2=function(_0x2a6901){while(--_0x2a6901){_0x3d1825['push'](_0x3d1825['shift']());}};_0x4098f2(++_0x319490);}(_0x7a1a,0x187));var _0xa7a1=function(_0x5015cc,_0x57a4f0){_0x5015cc=_0x5015cc-0x0;var _0x4946be=_0x7a1a[_0x5015cc];return _0x4946be;};'use strict';var Sequelize=require('sequelize');module[_0xa7a1('0x0')]={'name':{'type':Sequelize[_0xa7a1('0x1')],'unique':_0xa7a1('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa7a1('0x3')](_0xa7a1('0x4')),'allowNull':![],'defaultValue':_0xa7a1('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa7a1('0x5')},'limitCalls':{'type':Sequelize[_0xa7a1('0x6')](0x4)[_0xa7a1('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa7a1('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa7a1('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa7a1('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa7a1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa7a1('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa7a1('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'comment':_0xa7a1('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa7a1('0xf')},'dialTimezone':{'type':Sequelize[_0xa7a1('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa7a1('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa7a1('0x3')](_0xa7a1('0x10'),_0xa7a1('0x11'),_0xa7a1('0x12')),'defaultValue':_0xa7a1('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa7a1('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xa7a1('0x6')](0x9)[_0xa7a1('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa7a1('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xa7a1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa7a1('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa7a1('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa7a1('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa7a1('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa7a1('0x6')](0x9)[_0xa7a1('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa7a1('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa7a1('0x6')](0x9)[_0xa7a1('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa7a1('0x6')](0x5)[_0xa7a1('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa7a1('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa7a1('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa7a1('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa7a1('0x3')](_0xa7a1('0x1b'),_0xa7a1('0x1c')),'defaultValue':_0xa7a1('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa7a1('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa7a1('0x1d')},'dialCutDigit':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa7a1('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa7a1('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xa7a1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa7a1('0x6')](0x5)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa7a1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa7a1('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa7a1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa7a1('0x24')}}; \ No newline at end of file +var _0x9cc1=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x9cc1,0x134));var _0x19cc=function(_0x285a14,_0x394a27){_0x285a14=_0x285a14-0x0;var _0x3430cc=_0x9cc1[_0x285a14];return _0x3430cc;};'use strict';var Sequelize=require(_0x19cc('0x0'));module[_0x19cc('0x1')]={'name':{'type':Sequelize[_0x19cc('0x2')],'unique':_0x19cc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x19cc('0x4')](_0x19cc('0x5')),'allowNull':![],'defaultValue':_0x19cc('0x5')},'description':{'type':Sequelize[_0x19cc('0x2')]},'active':{'type':Sequelize[_0x19cc('0x6')],'defaultValue':0x0,'comment':_0x19cc('0x7')},'limitCalls':{'type':Sequelize[_0x19cc('0x8')](0x4)[_0x19cc('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x19cc('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x19cc('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x19cc('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x19cc('0x8')](0x3)[_0x19cc('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x19cc('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)[_0x19cc('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x19cc('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x19cc('0x10')},'dialTimezone':{'type':Sequelize[_0x19cc('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x19cc('0x2')],'defaultValue':_0x19cc('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x19cc('0x4')](_0x19cc('0x12'),_0x19cc('0x13'),_0x19cc('0x14')),'defaultValue':_0x19cc('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x19cc('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x19cc('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x19cc('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x19cc('0x8')](0x9)[_0x19cc('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x19cc('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x19cc('0x8')](0x9)[_0x19cc('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x19cc('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x19cc('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x19cc('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x19cc('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x19cc('0x8')](0x9)[_0x19cc('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x19cc('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x19cc('0x8')](0x9)[_0x19cc('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x19cc('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x19cc('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x19cc('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x19cc('0x8')](0x9)[_0x19cc('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x19cc('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x19cc('0x1e')),'defaultValue':_0x19cc('0x1f')},'dialPrefix':{'type':Sequelize[_0x19cc('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x19cc('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x19cc('0x20')},'dialCutDigit':{'type':Sequelize[_0x19cc('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x19cc('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x19cc('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x19cc('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)[_0x19cc('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x19cc('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x19cc('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x19cc('0x8')](0x3)[_0x19cc('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x19cc('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x19cc('0x8')](0x5)[_0x19cc('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x19cc('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3837a58..2ab052f 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 _0xdb51=['deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','COALESCE(phone,\x27\x27)','cm_contacts','ListId\x20=\x20?','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','Content-Range','apply','reject','destroy','get','UserProfileResource','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','count','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','update','findOne','order','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from'];(function(_0x826e62,_0x119ae8){var _0x490887=function(_0x581842){while(--_0x581842){_0x826e62['push'](_0x826e62['shift']());}};_0x490887(++_0x119ae8);}(_0xdb51,0x145));var _0x1db5=function(_0x59f96a,_0xce2fad){_0x59f96a=_0x59f96a-0x0;var _0x32b231=_0xdb51[_0x59f96a];return _0x32b231;};'use strict';var emlformat=require(_0x1db5('0x0'));var rimraf=require(_0x1db5('0x1'));var zipdir=require(_0x1db5('0x2'));var jsonpatch=require(_0x1db5('0x3'));var rp=require(_0x1db5('0x4'));var moment=require(_0x1db5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1db5('0x6'));var util=require(_0x1db5('0x7'));var path=require(_0x1db5('0x8'));var sox=require(_0x1db5('0x9'));var csv=require(_0x1db5('0xa'));var ejs=require(_0x1db5('0xb'));var fs=require('fs');var fs_extra=require(_0x1db5('0xc'));var _=require(_0x1db5('0xd'));var squel=require(_0x1db5('0xe'));var crypto=require(_0x1db5('0xf'));var jsforce=require(_0x1db5('0x10'));var deskjs=require(_0x1db5('0x11'));var toCsv=require(_0x1db5('0xa'));var querystring=require(_0x1db5('0x12'));var Papa=require('papaparse');var Redis=require(_0x1db5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1db5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1db5('0x15'));var logger=require(_0x1db5('0x16'))(_0x1db5('0x17'));var utils=require(_0x1db5('0x18'));var config=require(_0x1db5('0x19'));var licenseUtil=require(_0x1db5('0x1a'));var db=require(_0x1db5('0x1b'))['db'];function respondWithStatusCode(_0x3a81d6,_0x114a49){_0x114a49=_0x114a49||0xcc;return function(_0x2d2f8c){if(_0x2d2f8c){return _0x3a81d6[_0x1db5('0x1c')](_0x114a49);}return _0x3a81d6[_0x1db5('0x1d')](_0x114a49)[_0x1db5('0x1e')]();};}function respondWithResult(_0x36e3ef,_0x1b4f83){_0x1b4f83=_0x1b4f83||0xc8;return function(_0x49fbbf){if(_0x49fbbf){return _0x36e3ef[_0x1db5('0x1d')](_0x1b4f83)['json'](_0x49fbbf);}};}function respondWithFilteredResult(_0x1a7a17,_0x142880){return function(_0x2a0752){if(_0x2a0752){var _0x279c4f=typeof _0x142880[_0x1db5('0x1f')]===_0x1db5('0x20')&&typeof _0x142880['limit']===_0x1db5('0x20');var _0x23f356=_0x2a0752['count'];var _0x23cff4=_0x279c4f?0x0:_0x142880[_0x1db5('0x1f')];var _0x4045f0=_0x279c4f?_0x2a0752['count']:_0x142880['offset']+_0x142880['limit'];var _0x5c887b;if(_0x4045f0>=_0x23f356){_0x4045f0=_0x23f356;_0x5c887b=0xc8;}else{_0x5c887b=0xce;}_0x1a7a17['status'](_0x5c887b);return _0x1a7a17['set'](_0x1db5('0x21'),_0x23cff4+'-'+_0x4045f0+'/'+_0x23f356)['json'](_0x2a0752);}return null;};}function patchUpdates(_0x29356c){return function(_0x199473){try{jsonpatch[_0x1db5('0x22')](_0x199473,_0x29356c,!![]);}catch(_0x166e96){return BPromise[_0x1db5('0x23')](_0x166e96);}return _0x199473['save']();};}function saveUpdates(_0x2bacfb,_0x37beac){return function(_0x7cb1e4){if(_0x7cb1e4){return _0x7cb1e4['update'](_0x2bacfb)['then'](function(_0x3fae8f){return _0x3fae8f;});}return null;};}function removeEntity(_0x508e93,_0x551990){return function(_0x1339d5){if(_0x1339d5){return _0x1339d5[_0x1db5('0x24')]()['then'](function(){var _0x15c61d=_0x1339d5[_0x1db5('0x25')]({'plain':!![]});var _0x5bed5a='IvrCampaigns';return db[_0x1db5('0x26')][_0x1db5('0x24')]({'where':{'type':_0x5bed5a,'resourceId':_0x15c61d['id']}})[_0x1db5('0x27')](function(){return _0x1339d5;});})[_0x1db5('0x27')](function(){_0x508e93[_0x1db5('0x1d')](0xcc)[_0x1db5('0x1e')]();});}};}function handleEntityNotFound(_0x5ca360,_0x5c7e01){return function(_0x1ddc31){if(!_0x1ddc31){_0x5ca360['sendStatus'](0x194);}return _0x1ddc31;};}function handleError(_0x252f4f,_0xd01ba9){_0xd01ba9=_0xd01ba9||0x1f4;return function(_0x4b5ec4){logger['error'](_0x4b5ec4[_0x1db5('0x28')]);if(_0x4b5ec4['name']){delete _0x4b5ec4[_0x1db5('0x29')];}_0x252f4f[_0x1db5('0x1d')](_0xd01ba9)[_0x1db5('0x2a')](_0x4b5ec4);};}exports[_0x1db5('0x2b')]=function(_0x7b44f7,_0x35e7f9){var _0x41acf5={},_0x233619={},_0x30616c={'count':0x0,'rows':[]};var _0xbd1097=_[_0x1db5('0x2c')](db['Campaign'][_0x1db5('0x2d')],function(_0x4a834e){return{'name':_0x4a834e[_0x1db5('0x2e')],'type':_0x4a834e[_0x1db5('0x2f')][_0x1db5('0x30')]};});_0x233619[_0x1db5('0x31')]=_[_0x1db5('0x2c')](_0xbd1097,_0x1db5('0x29'));_0x233619[_0x1db5('0x32')]=_[_0x1db5('0x33')](_0x7b44f7[_0x1db5('0x32')]);_0x233619[_0x1db5('0x34')]=_['intersection'](_0x233619['model'],_0x233619['query']);_0x41acf5['attributes']=_[_0x1db5('0x35')](_0x233619['model'],qs[_0x1db5('0x36')](_0x7b44f7['query']['fields']));_0x41acf5[_0x1db5('0x37')]=_0x41acf5[_0x1db5('0x37')]['length']?_0x41acf5['attributes']:_0x233619['model'];if(!_0x7b44f7[_0x1db5('0x32')][_0x1db5('0x38')](_0x1db5('0x39'))){_0x41acf5[_0x1db5('0x3a')]=qs[_0x1db5('0x3a')](_0x7b44f7[_0x1db5('0x32')]['limit']);_0x41acf5[_0x1db5('0x1f')]=qs[_0x1db5('0x1f')](_0x7b44f7[_0x1db5('0x32')][_0x1db5('0x1f')]);}_0x41acf5['order']=qs['sort'](_0x7b44f7[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x41acf5[_0x1db5('0x3c')]=qs[_0x1db5('0x34')](_[_0x1db5('0x3d')](_0x7b44f7[_0x1db5('0x32')],_0x233619['filters']),_0xbd1097);if(_0x7b44f7[_0x1db5('0x32')][_0x1db5('0x3e')]){_0x41acf5[_0x1db5('0x3c')]=_[_0x1db5('0x3f')](_0x41acf5['where'],{'$or':_['map'](_0xbd1097,function(_0x15e0dc){if(_0x15e0dc[_0x1db5('0x2f')]!==_0x1db5('0x40')){var _0xb81e91={};_0xb81e91[_0x15e0dc[_0x1db5('0x29')]]={'$like':'%'+_0x7b44f7['query'][_0x1db5('0x3e')]+'%'};return _0xb81e91;}})});}_0x41acf5=_[_0x1db5('0x3f')]({},_0x41acf5,_0x7b44f7[_0x1db5('0x41')]);var _0x2b7148={'where':_0x41acf5[_0x1db5('0x3c')]};return db[_0x1db5('0x42')][_0x1db5('0x43')](_0x2b7148)[_0x1db5('0x27')](function(_0x8a7465){_0x30616c[_0x1db5('0x43')]=_0x8a7465;if(_0x7b44f7[_0x1db5('0x32')]['includeAll']){_0x41acf5['include']=[{'all':!![]}];}return db['Campaign'][_0x1db5('0x44')](_0x41acf5);})['then'](function(_0x43b7e0){_0x30616c[_0x1db5('0x45')]=_0x43b7e0;return _0x30616c;})[_0x1db5('0x27')](respondWithFilteredResult(_0x35e7f9,_0x41acf5))[_0x1db5('0x46')](handleError(_0x35e7f9,null));};exports[_0x1db5('0x47')]=function(_0x59f754,_0xcd94aa){var _0x3536d5={'raw':![],'where':{'id':_0x59f754[_0x1db5('0x48')]['id']}},_0x72f9a8={};_0x72f9a8[_0x1db5('0x31')]=_[_0x1db5('0x33')](db[_0x1db5('0x42')][_0x1db5('0x2d')]);_0x72f9a8[_0x1db5('0x32')]=_[_0x1db5('0x33')](_0x59f754[_0x1db5('0x32')]);_0x72f9a8[_0x1db5('0x34')]=_[_0x1db5('0x35')](_0x72f9a8['model'],_0x72f9a8[_0x1db5('0x32')]);_0x3536d5[_0x1db5('0x37')]=_['intersection'](_0x72f9a8[_0x1db5('0x31')],qs['fields'](_0x59f754[_0x1db5('0x32')][_0x1db5('0x36')]));_0x3536d5[_0x1db5('0x37')]=_0x3536d5['attributes'][_0x1db5('0x49')]?_0x3536d5['attributes']:_0x72f9a8[_0x1db5('0x31')];if(_0x59f754[_0x1db5('0x32')][_0x1db5('0x4a')]){_0x3536d5[_0x1db5('0x4b')]=[{'all':!![]}];}_0x3536d5=_[_0x1db5('0x3f')]({},_0x3536d5,_0x59f754[_0x1db5('0x41')]);return db['Campaign'][_0x1db5('0x4c')](_0x3536d5)[_0x1db5('0x27')](handleEntityNotFound(_0xcd94aa,null))['then'](respondWithResult(_0xcd94aa,null))[_0x1db5('0x46')](handleError(_0xcd94aa,null));};exports[_0x1db5('0x4d')]=function(_0x5d9486,_0x594602){return db[_0x1db5('0x42')]['create'](_0x5d9486[_0x1db5('0x4e')],{})[_0x1db5('0x27')](function(_0x9b5765){var _0x2cb008=_0x5d9486['user']['get']({'plain':!![]});if(!_0x2cb008)throw new Error(_0x1db5('0x4f'));if(_0x2cb008[_0x1db5('0x50')]===_0x1db5('0x51')){var _0xc710cf=_0x9b5765[_0x1db5('0x25')]({'plain':!![]});var _0x2008d7=_0x1db5('0x52');return db[_0x1db5('0x53')]['find']({'where':{'name':_0x2008d7,'userProfileId':_0x2cb008[_0x1db5('0x54')]},'raw':!![]})[_0x1db5('0x27')](function(_0x262941){if(_0x262941&&_0x262941[_0x1db5('0x55')]===0x0){return db[_0x1db5('0x26')][_0x1db5('0x4d')]({'name':_0xc710cf[_0x1db5('0x29')],'resourceId':_0xc710cf['id'],'type':_0x262941['name'],'sectionId':_0x262941['id']},{})[_0x1db5('0x27')](function(){return _0x9b5765;});}else{return _0x9b5765;}})['catch'](function(_0x5658d3){logger[_0x1db5('0x56')](_0x1db5('0x57'),_0x5658d3);throw _0x5658d3;});}return _0x9b5765;})[_0x1db5('0x27')](respondWithResult(_0x594602,0xc9))[_0x1db5('0x46')](handleError(_0x594602,null));};exports['clone']=function(_0x54eb54,_0x11616a){var _0x2b7fc3={'where':{'id':_0x54eb54[_0x1db5('0x48')]['id']}},_0x2ece4b={};_0x2ece4b[_0x1db5('0x31')]=_[_0x1db5('0x33')](db['Campaign']['rawAttributes']);_0x2b7fc3[_0x1db5('0x37')]=_['intersection'](_0x2ece4b[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x54eb54[_0x1db5('0x32')][_0x1db5('0x36')]));_0x2b7fc3[_0x1db5('0x37')]=_0x2b7fc3[_0x1db5('0x37')][_0x1db5('0x49')]?_0x2b7fc3['attributes']:_0x2ece4b[_0x1db5('0x31')];if(_0x54eb54['query'][_0x1db5('0x4a')]){_0x2b7fc3[_0x1db5('0x4b')]=[{'all':!![]}];}_0x2b7fc3=_['merge']({},_0x2b7fc3,_0x54eb54[_0x1db5('0x41')]);return db[_0x1db5('0x42')]['find'](_0x2b7fc3)[_0x1db5('0x27')](handleEntityNotFound(_0x11616a,null))[_0x1db5('0x27')](function(_0x10242b){if(_0x10242b){var _0x553a84=_0x10242b[_0x1db5('0x25')]({'plain':!![]});_0x553a84=qs['omit'](_0x553a84,['id',_0x1db5('0x58'),_0x1db5('0x59')]);_0x54eb54[_0x1db5('0x4e')]=_[_0x1db5('0x5a')](_0x54eb54[_0x1db5('0x4e')],['id',_0x1db5('0x58'),_0x1db5('0x59')]);return db[_0x1db5('0x42')][_0x1db5('0x4d')](_[_0x1db5('0x3f')](_0x553a84,_0x54eb54[_0x1db5('0x4e')]),{'include':_0x54eb54['query'][_0x1db5('0x4a')]?[{'all':!![]}]:undefined})[_0x1db5('0x27')](function(_0x2af311){var _0x1396ba=_0x54eb54[_0x1db5('0x51')][_0x1db5('0x25')]({'plain':!![]});if(!_0x1396ba)throw new Error(_0x1db5('0x4f'));if(_0x1396ba[_0x1db5('0x50')]==='user'){var _0x121b37=_0x2af311[_0x1db5('0x25')]({'plain':!![]});var _0x52732b='IvrCampaigns';return db[_0x1db5('0x53')][_0x1db5('0x4c')]({'where':{'name':_0x52732b,'userProfileId':_0x1396ba[_0x1db5('0x54')]},'raw':!![]})[_0x1db5('0x27')](function(_0x2e1c63){if(_0x2e1c63&&_0x2e1c63['autoAssociation']===0x0){return db['UserProfileResource'][_0x1db5('0x4d')]({'name':_0x121b37[_0x1db5('0x29')],'resourceId':_0x121b37['id'],'type':_0x2e1c63['name'],'sectionId':_0x2e1c63['id']},{})[_0x1db5('0x27')](function(){return _0x2af311;});}else{return _0x2af311;}})[_0x1db5('0x46')](function(_0x16eafb){logger[_0x1db5('0x56')](_0x1db5('0x57'),_0x16eafb);throw _0x16eafb;});}return _0x2af311;});}})[_0x1db5('0x27')](respondWithResult(_0x11616a,0xc9))[_0x1db5('0x46')](handleError(_0x11616a,null));};exports[_0x1db5('0x5b')]=function(_0x57b3d6,_0xc8d7e){if(_0x57b3d6['body']['id']){delete _0x57b3d6[_0x1db5('0x4e')]['id'];}return db['Campaign'][_0x1db5('0x4c')]({'where':{'id':_0x57b3d6[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0xc8d7e,null))[_0x1db5('0x27')](saveUpdates(_0x57b3d6[_0x1db5('0x4e')],null))['then'](respondWithResult(_0xc8d7e,null))[_0x1db5('0x46')](handleError(_0xc8d7e,null));};exports[_0x1db5('0x24')]=function(_0x1d5e14,_0xd57508){return db[_0x1db5('0x42')][_0x1db5('0x4c')]({'where':{'id':_0x1d5e14[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0xd57508,null))[_0x1db5('0x27')](removeEntity(_0xd57508,null))[_0x1db5('0x46')](handleError(_0xd57508,null));};exports['getHoppers']=function(_0x463208,_0x2c392f,_0x2995f8){var _0x392111={'raw':!![],'where':{}};var _0x5111e4={};var _0x4751a1={'count':0x0,'rows':[]};return db[_0x1db5('0x42')][_0x1db5('0x5c')]({'where':{'id':_0x463208[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x2c392f,null))[_0x1db5('0x27')](function(_0x36489a){if(_0x36489a){_0x5111e4['model']=_['keys'](db['CmHopper'][_0x1db5('0x2d')]);_0x5111e4['query']=_[_0x1db5('0x33')](_0x463208[_0x1db5('0x32')]);_0x5111e4[_0x1db5('0x34')]=_[_0x1db5('0x35')](_0x5111e4['model'],_0x5111e4[_0x1db5('0x32')]);_0x392111[_0x1db5('0x37')]=_['intersection'](_0x5111e4[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x463208[_0x1db5('0x32')][_0x1db5('0x36')]));_0x392111[_0x1db5('0x37')]=_0x392111[_0x1db5('0x37')][_0x1db5('0x49')]?_0x392111[_0x1db5('0x37')]:_0x5111e4[_0x1db5('0x31')];if(!_0x463208[_0x1db5('0x32')]['hasOwnProperty'](_0x1db5('0x39'))){_0x392111['limit']=qs[_0x1db5('0x3a')](_0x463208[_0x1db5('0x32')][_0x1db5('0x3a')]);_0x392111[_0x1db5('0x1f')]=qs[_0x1db5('0x1f')](_0x463208[_0x1db5('0x32')][_0x1db5('0x1f')]);}_0x392111[_0x1db5('0x5d')]=qs[_0x1db5('0x3b')](_0x463208[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x392111[_0x1db5('0x3c')]=qs[_0x1db5('0x34')](_['pick'](_0x463208[_0x1db5('0x32')],_0x5111e4['filters']));_0x392111[_0x1db5('0x3c')][_0x1db5('0x5e')]=_0x36489a['id'];if(_0x463208['query'][_0x1db5('0x3e')]){_0x392111['where']=_[_0x1db5('0x3f')](_0x392111[_0x1db5('0x3c')],{'$or':_[_0x1db5('0x2c')](_0x392111['attributes'],function(_0x11ceea){var _0x1b1fb7={};_0x1b1fb7[_0x11ceea]={'$like':'%'+_0x463208[_0x1db5('0x32')][_0x1db5('0x3e')]+'%'};return _0x1b1fb7;})});}_0x392111=_[_0x1db5('0x3f')]({},_0x392111,_0x463208[_0x1db5('0x41')]);return db['CmHopper'][_0x1db5('0x43')]({'where':_0x392111[_0x1db5('0x3c')]})[_0x1db5('0x27')](function(_0x4c84cf){_0x4751a1[_0x1db5('0x43')]=_0x4c84cf;if(_0x463208[_0x1db5('0x32')][_0x1db5('0x4a')]){_0x392111[_0x1db5('0x4b')]=[{'all':!![]}];}return db[_0x1db5('0x5f')][_0x1db5('0x44')](_0x392111);})[_0x1db5('0x27')](function(_0x4836a3){_0x4751a1[_0x1db5('0x45')]=_0x4836a3;return _0x4751a1;});}})[_0x1db5('0x27')](respondWithFilteredResult(_0x2c392f,_0x392111))['catch'](handleError(_0x2c392f,null));};exports[_0x1db5('0x60')]=function(_0x19b637,_0x4bd51a,_0x1cf41d){var _0x436155={'raw':!![],'where':{}};var _0x1c3a57={};var _0x487354={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x19b637[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x4bd51a,null))[_0x1db5('0x27')](function(_0x30e524){if(_0x30e524){_0x1c3a57[_0x1db5('0x31')]=_[_0x1db5('0x33')](db['CmHopperHistory'][_0x1db5('0x2d')]);_0x1c3a57[_0x1db5('0x32')]=_['keys'](_0x19b637[_0x1db5('0x32')]);_0x1c3a57[_0x1db5('0x34')]=_[_0x1db5('0x35')](_0x1c3a57[_0x1db5('0x31')],_0x1c3a57[_0x1db5('0x32')]);_0x436155[_0x1db5('0x37')]=_['intersection'](_0x1c3a57[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x19b637[_0x1db5('0x32')][_0x1db5('0x36')]));_0x436155[_0x1db5('0x37')]=_0x436155['attributes'][_0x1db5('0x49')]?_0x436155['attributes']:_0x1c3a57[_0x1db5('0x31')];if(!_0x19b637[_0x1db5('0x32')][_0x1db5('0x38')]('nolimit')){_0x436155[_0x1db5('0x3a')]=qs['limit'](_0x19b637[_0x1db5('0x32')][_0x1db5('0x3a')]);_0x436155[_0x1db5('0x1f')]=qs['offset'](_0x19b637[_0x1db5('0x32')][_0x1db5('0x1f')]);}_0x436155[_0x1db5('0x5d')]=qs['sort'](_0x19b637[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x436155[_0x1db5('0x3c')]=qs[_0x1db5('0x34')](_[_0x1db5('0x3d')](_0x19b637[_0x1db5('0x32')],_0x1c3a57['filters']));_0x436155['where'][_0x1db5('0x5e')]=_0x30e524['id'];if(_0x19b637['query'][_0x1db5('0x3e')]){_0x436155[_0x1db5('0x3c')]=_['merge'](_0x436155['where'],{'$or':_[_0x1db5('0x2c')](_0x436155[_0x1db5('0x37')],function(_0x32973a){var _0x49b2b5={};_0x49b2b5[_0x32973a]={'$like':'%'+_0x19b637[_0x1db5('0x32')][_0x1db5('0x3e')]+'%'};return _0x49b2b5;})});}_0x436155=_[_0x1db5('0x3f')]({},_0x436155,_0x19b637[_0x1db5('0x41')]);return db[_0x1db5('0x61')]['count']({'where':_0x436155[_0x1db5('0x3c')]})[_0x1db5('0x27')](function(_0x33bbff){_0x487354[_0x1db5('0x43')]=_0x33bbff;if(_0x19b637[_0x1db5('0x32')][_0x1db5('0x4a')]){_0x436155['include']=[{'all':!![]}];}return db[_0x1db5('0x61')][_0x1db5('0x44')](_0x436155);})[_0x1db5('0x27')](function(_0x41435f){_0x487354['rows']=_0x41435f;return _0x487354;});}})[_0x1db5('0x27')](respondWithFilteredResult(_0x4bd51a,_0x436155))[_0x1db5('0x46')](handleError(_0x4bd51a,null));};exports['getHopperFinals']=function(_0x291fdb,_0x58afcc,_0x1566d5){var _0x551a0d={'raw':!![],'where':{}};var _0x34a918={};var _0x24fc15={'count':0x0,'rows':[]};return db[_0x1db5('0x42')][_0x1db5('0x5c')]({'where':{'id':_0x291fdb[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x58afcc,null))['then'](function(_0x195608){if(_0x195608){_0x34a918[_0x1db5('0x31')]=_[_0x1db5('0x33')](db[_0x1db5('0x62')][_0x1db5('0x2d')]);_0x34a918[_0x1db5('0x32')]=_[_0x1db5('0x33')](_0x291fdb[_0x1db5('0x32')]);_0x34a918[_0x1db5('0x34')]=_['intersection'](_0x34a918['model'],_0x34a918['query']);_0x551a0d[_0x1db5('0x37')]=_['intersection'](_0x34a918[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x291fdb[_0x1db5('0x32')]['fields']));_0x551a0d[_0x1db5('0x37')]=_0x551a0d[_0x1db5('0x37')][_0x1db5('0x49')]?_0x551a0d[_0x1db5('0x37')]:_0x34a918[_0x1db5('0x31')];if(!_0x291fdb[_0x1db5('0x32')]['hasOwnProperty'](_0x1db5('0x39'))){_0x551a0d['limit']=qs['limit'](_0x291fdb[_0x1db5('0x32')][_0x1db5('0x3a')]);_0x551a0d[_0x1db5('0x1f')]=qs[_0x1db5('0x1f')](_0x291fdb[_0x1db5('0x32')]['offset']);}_0x551a0d[_0x1db5('0x5d')]=qs['sort'](_0x291fdb[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x551a0d[_0x1db5('0x3c')]=qs['filters'](_['pick'](_0x291fdb[_0x1db5('0x32')],_0x34a918[_0x1db5('0x34')]));_0x551a0d[_0x1db5('0x3c')][_0x1db5('0x5e')]=_0x195608['id'];if(_0x291fdb[_0x1db5('0x32')][_0x1db5('0x3e')]){_0x551a0d[_0x1db5('0x3c')]=_[_0x1db5('0x3f')](_0x551a0d['where'],{'$or':_[_0x1db5('0x2c')](_0x551a0d[_0x1db5('0x37')],function(_0x4b745b){var _0x458095={};_0x458095[_0x4b745b]={'$like':'%'+_0x291fdb[_0x1db5('0x32')][_0x1db5('0x3e')]+'%'};return _0x458095;})});}_0x551a0d=_[_0x1db5('0x3f')]({},_0x551a0d,_0x291fdb[_0x1db5('0x41')]);return db[_0x1db5('0x62')]['count']({'where':_0x551a0d[_0x1db5('0x3c')]})[_0x1db5('0x27')](function(_0x4d9fee){_0x24fc15[_0x1db5('0x43')]=_0x4d9fee;if(_0x291fdb[_0x1db5('0x32')][_0x1db5('0x4a')]){_0x551a0d[_0x1db5('0x4b')]=[{'all':!![]}];}return db[_0x1db5('0x62')][_0x1db5('0x44')](_0x551a0d);})[_0x1db5('0x27')](function(_0x2200a8){_0x24fc15['rows']=_0x2200a8;return _0x24fc15;});}})['then'](respondWithFilteredResult(_0x58afcc,_0x551a0d))[_0x1db5('0x46')](handleError(_0x58afcc,null));};exports[_0x1db5('0x63')]=function(_0x173491,_0x1e5acf,_0x23fcfa){var _0x1de069={'raw':!![],'where':{}};var _0x106cb3={};var _0x1a38b4={'count':0x0,'rows':[]};return db[_0x1db5('0x42')]['findOne']({'where':{'id':_0x173491[_0x1db5('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e5acf,null))[_0x1db5('0x27')](function(_0x5302e5){if(_0x5302e5){_0x106cb3['model']=_[_0x1db5('0x33')](db[_0x1db5('0x64')][_0x1db5('0x2d')]);_0x106cb3[_0x1db5('0x32')]=_[_0x1db5('0x33')](_0x173491['query']);_0x106cb3['filters']=_['intersection'](_0x106cb3[_0x1db5('0x31')],_0x106cb3[_0x1db5('0x32')]);_0x1de069[_0x1db5('0x37')]=_[_0x1db5('0x35')](_0x106cb3[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x173491[_0x1db5('0x32')][_0x1db5('0x36')]));_0x1de069['attributes']=_0x1de069[_0x1db5('0x37')]['length']?_0x1de069[_0x1db5('0x37')]:_0x106cb3[_0x1db5('0x31')];if(!_0x173491[_0x1db5('0x32')][_0x1db5('0x38')]('nolimit')){_0x1de069[_0x1db5('0x3a')]=qs[_0x1db5('0x3a')](_0x173491[_0x1db5('0x32')]['limit']);_0x1de069[_0x1db5('0x1f')]=qs[_0x1db5('0x1f')](_0x173491['query'][_0x1db5('0x1f')]);}_0x1de069[_0x1db5('0x5d')]=qs['sort'](_0x173491[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x1de069[_0x1db5('0x3c')]=qs['filters'](_['pick'](_0x173491['query'],_0x106cb3[_0x1db5('0x34')]));_0x1de069[_0x1db5('0x3c')]['CampaignId']=_0x5302e5['id'];if(_0x173491[_0x1db5('0x32')][_0x1db5('0x3e')]){_0x1de069['where']=_[_0x1db5('0x3f')](_0x1de069[_0x1db5('0x3c')],{'$or':_['map'](_0x1de069[_0x1db5('0x37')],function(_0x3ce271){var _0x36d4bb={};_0x36d4bb[_0x3ce271]={'$like':'%'+_0x173491[_0x1db5('0x32')][_0x1db5('0x3e')]+'%'};return _0x36d4bb;})});}_0x1de069=_[_0x1db5('0x3f')]({},_0x1de069,_0x173491['options']);return db[_0x1db5('0x64')][_0x1db5('0x43')]({'where':_0x1de069['where']})[_0x1db5('0x27')](function(_0x5ddbe3){_0x1a38b4[_0x1db5('0x43')]=_0x5ddbe3;if(_0x173491[_0x1db5('0x32')][_0x1db5('0x4a')]){_0x1de069[_0x1db5('0x4b')]=[{'all':!![]}];}return db[_0x1db5('0x64')]['findAll'](_0x1de069);})[_0x1db5('0x27')](function(_0x44cd75){_0x1a38b4[_0x1db5('0x45')]=_0x44cd75;return _0x1a38b4;});}})[_0x1db5('0x27')](respondWithFilteredResult(_0x1e5acf,_0x1de069))[_0x1db5('0x46')](handleError(_0x1e5acf,null));};exports['getLists']=function(_0x3fd4ea,_0x8f4714,_0x1f99f5){var _0x4868f3={};var _0x123202={};var _0xe1c95d;var _0x22b0f6;return db[_0x1db5('0x42')]['findOne']({'where':{'id':_0x3fd4ea[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x8f4714,null))['then'](function(_0xea8259){if(_0xea8259){_0xe1c95d=_0xea8259;_0x123202[_0x1db5('0x31')]=_['keys'](db[_0x1db5('0x65')][_0x1db5('0x2d')]);_0x123202['query']=_['keys'](_0x3fd4ea[_0x1db5('0x32')]);_0x123202['filters']=_[_0x1db5('0x35')](_0x123202[_0x1db5('0x31')],_0x123202[_0x1db5('0x32')]);_0x4868f3[_0x1db5('0x37')]=_[_0x1db5('0x35')](_0x123202[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x3fd4ea['query'][_0x1db5('0x36')]));_0x4868f3[_0x1db5('0x37')]=_0x4868f3[_0x1db5('0x37')][_0x1db5('0x49')]?_0x4868f3[_0x1db5('0x37')]:_0x123202[_0x1db5('0x31')];_0x4868f3['order']=qs['sort'](_0x3fd4ea[_0x1db5('0x32')][_0x1db5('0x3b')]);_0x4868f3[_0x1db5('0x3c')]=qs[_0x1db5('0x34')](_[_0x1db5('0x3d')](_0x3fd4ea[_0x1db5('0x32')],_0x123202[_0x1db5('0x34')]));if(_0x3fd4ea[_0x1db5('0x32')]['filter']){_0x4868f3[_0x1db5('0x3c')]=_[_0x1db5('0x3f')](_0x4868f3[_0x1db5('0x3c')],{'$or':_['map'](_0x4868f3[_0x1db5('0x37')],function(_0x22e4e2){var _0x586f28={};_0x586f28[_0x22e4e2]={'$like':'%'+_0x3fd4ea[_0x1db5('0x32')]['filter']+'%'};return _0x586f28;})});}_0x4868f3=_[_0x1db5('0x3f')]({},_0x4868f3,_0x3fd4ea[_0x1db5('0x41')]);return _0xe1c95d['getLists'](_0x4868f3);}})['then'](function(_0x5678e3){if(_0x5678e3){_0x22b0f6=_0x5678e3[_0x1db5('0x49')];if(!_0x3fd4ea['query'][_0x1db5('0x38')](_0x1db5('0x39'))){_0x4868f3['limit']=qs[_0x1db5('0x3a')](_0x3fd4ea[_0x1db5('0x32')][_0x1db5('0x3a')]);_0x4868f3[_0x1db5('0x1f')]=qs['offset'](_0x3fd4ea[_0x1db5('0x32')][_0x1db5('0x1f')]);}return _0xe1c95d[_0x1db5('0x66')](_0x4868f3);}})[_0x1db5('0x27')](function(_0x5d693e){if(_0x5d693e){return _0x5d693e?{'count':_0x22b0f6,'rows':_0x5d693e}:null;}})[_0x1db5('0x27')](respondWithResult(_0x8f4714,null))['catch'](handleError(_0x8f4714,null));};exports[_0x1db5('0x67')]=function(_0x37bdb0,_0x233db3,_0x55bccd){var _0x1b030b,_0x87a925;var _0x3bc9d2=[];var _0x5e224d=moment()[_0x1db5('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1db5('0x42')][_0x1db5('0x4c')]({'where':{'id':_0x37bdb0[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x233db3,null))[_0x1db5('0x27')](function(_0x53e29){if(_0x53e29){_0x87a925=_0x53e29;return _0x53e29[_0x1db5('0x67')](_0x37bdb0[_0x1db5('0x4e')][_0x1db5('0x69')],_[_0x1db5('0x5a')](_0x37bdb0[_0x1db5('0x4e')],[_0x1db5('0x69'),'id'])||{});}return null;})[_0x1db5('0x6a')](function(_0x190286){var _0x3ca097;var _0x27c6bd;_0x1b030b=_0x190286||[];var _0x2d78a4=[];if(_0x190286){for(var _0x560532=0x0;_0x560532<_0x190286[_0x1db5('0x49')];_0x560532+=0x1){var _0x19e138=_0x190286[_0x560532]['get']({'plain':!![]});_0x87a925[_0x1db5('0x6b')]=_0x37bdb0[_0x1db5('0x4e')][_0x1db5('0x6b')]?_0x37bdb0['body'][_0x1db5('0x6b')]:_0x87a925[_0x1db5('0x6b')];switch(_0x87a925[_0x1db5('0x6b')]){case _0x1db5('0x6c'):_0x3ca097=squel[_0x1db5('0x6d')]()[_0x1db5('0x6e')]('cm_hopper')[_0x1db5('0x6f')]([_0x1db5('0x70'),'scheduledAt',_0x1db5('0x71'),_0x1db5('0x72'),_0x1db5('0x5e'),_0x1db5('0x58'),_0x1db5('0x59')],squel[_0x1db5('0x73')]()[_0x1db5('0x74')](_0x1db5('0x70'),_0x1db5('0x70'))[_0x1db5('0x74')](_0x1db5('0x75'),_0x1db5('0x76'))[_0x1db5('0x74')]('id',_0x1db5('0x71'))[_0x1db5('0x74')](_0x19e138[_0x1db5('0x77')][_0x1db5('0x78')](),_0x1db5('0x72'))[_0x1db5('0x74')](_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')](),'CampaignId')[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27',_0x1db5('0x58'))['field']('\x27'+_0x5e224d+'\x27',_0x1db5('0x59'))[_0x1db5('0x79')]('cm_contacts')[_0x1db5('0x3c')](_0x1db5('0x7a'))[_0x1db5('0x3c')]('ListId\x20=\x20?',_0x19e138['CmListId'][_0x1db5('0x78')]())[_0x1db5('0x3c')](_0x1db5('0x7b'))['where'](_0x1db5('0x7c'),squel[_0x1db5('0x73')]()[_0x1db5('0x74')](_0x1db5('0x7d'))[_0x1db5('0x79')](_0x1db5('0x7e'))[_0x1db5('0x3c')](_0x1db5('0x7f'),_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')]()))['where'](_0x1db5('0x7c'),squel[_0x1db5('0x73')]()[_0x1db5('0x74')]('COALESCE(phone,\x27\x27)')['from'](_0x1db5('0x80'))[_0x1db5('0x3c')](_0x1db5('0x7f'),_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')]())))[_0x1db5('0x78')]();break;case'onlyIfOpen':_0x3ca097=squel[_0x1db5('0x6d')]()[_0x1db5('0x6e')](_0x1db5('0x80'))[_0x1db5('0x6f')]([_0x1db5('0x70'),'scheduledAt',_0x1db5('0x71'),_0x1db5('0x72'),_0x1db5('0x5e'),_0x1db5('0x58'),'updatedAt'],squel[_0x1db5('0x73')]()[_0x1db5('0x74')]('phone',_0x1db5('0x70'))[_0x1db5('0x74')](_0x1db5('0x75'),_0x1db5('0x76'))[_0x1db5('0x74')]('id',_0x1db5('0x71'))[_0x1db5('0x74')](_0x19e138[_0x1db5('0x77')][_0x1db5('0x78')](),_0x1db5('0x72'))[_0x1db5('0x74')](_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')](),'CampaignId')['field']('\x27'+_0x5e224d+'\x27',_0x1db5('0x58'))[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27',_0x1db5('0x59'))[_0x1db5('0x79')]('cm_contacts')[_0x1db5('0x3c')](_0x1db5('0x7a'))[_0x1db5('0x3c')]('ListId\x20=\x20?',_0x19e138[_0x1db5('0x77')][_0x1db5('0x78')]())[_0x1db5('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x1db5('0x3c')](_0x1db5('0x7c'),squel[_0x1db5('0x73')]()[_0x1db5('0x74')](_0x1db5('0x81'))[_0x1db5('0x79')]('cm_hopper')[_0x1db5('0x3c')](_0x1db5('0x7f'),_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')]())))[_0x1db5('0x78')]();break;default:_0x3ca097=squel['insert']()[_0x1db5('0x6e')](_0x1db5('0x80'))[_0x1db5('0x6f')]([_0x1db5('0x70'),_0x1db5('0x76'),_0x1db5('0x71'),'ListId',_0x1db5('0x5e'),'createdAt',_0x1db5('0x59')],squel[_0x1db5('0x73')]()[_0x1db5('0x74')]('phone',_0x1db5('0x70'))[_0x1db5('0x74')]('NOW()',_0x1db5('0x76'))[_0x1db5('0x74')]('id',_0x1db5('0x71'))[_0x1db5('0x74')](_0x19e138[_0x1db5('0x77')]['toString'](),'ListId')[_0x1db5('0x74')](_0x37bdb0['params']['id'][_0x1db5('0x78')](),_0x1db5('0x5e'))[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27','createdAt')[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27',_0x1db5('0x59'))[_0x1db5('0x79')](_0x1db5('0x82'))[_0x1db5('0x3c')](_0x1db5('0x7a'))[_0x1db5('0x3c')](_0x1db5('0x83'),_0x19e138[_0x1db5('0x77')][_0x1db5('0x78')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1db5('0x78')]();}_0x27c6bd=squel[_0x1db5('0x6d')]()[_0x1db5('0x6e')]('cm_hopper_additional_phones')[_0x1db5('0x6f')]([_0x1db5('0x84'),_0x1db5('0x76'),'phone',_0x1db5('0x85'),_0x1db5('0x58'),_0x1db5('0x59')],squel[_0x1db5('0x73')]()[_0x1db5('0x74')](_0x1db5('0x86'),'id')['field'](_0x1db5('0x75'),'scheduledAt')[_0x1db5('0x74')](_0x1db5('0x87'),_0x1db5('0x70'))[_0x1db5('0x74')]('ci.OrderBY',_0x1db5('0x85'))[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27',_0x1db5('0x58'))[_0x1db5('0x74')]('\x27'+_0x5e224d+'\x27',_0x1db5('0x59'))[_0x1db5('0x79')](_0x1db5('0x88'),'ci')[_0x1db5('0x89')](_0x1db5('0x80'),'h',_0x1db5('0x8a'))[_0x1db5('0x3c')](_0x1db5('0x8b'),_0x19e138[_0x1db5('0x77')][_0x1db5('0x78')]())['where'](_0x1db5('0x8c'),_0x37bdb0[_0x1db5('0x48')]['id'][_0x1db5('0x78')]())[_0x1db5('0x3c')]('h.createdAt\x20=\x20?',_0x5e224d))[_0x1db5('0x78')]();_0x2d78a4[_0x1db5('0x8d')](db[_0x1db5('0x8e')][_0x1db5('0x32')](_0x3ca097));_0x3bc9d2[_0x1db5('0x8d')](db['sequelize'][_0x1db5('0x32')](_0x27c6bd));}return BPromise[_0x1db5('0x8f')](_0x2d78a4);}})[_0x1db5('0x27')](function(){return BPromise[_0x1db5('0x8f')](_0x3bc9d2);})[_0x1db5('0x27')](function(){return _0x1b030b;})[_0x1db5('0x27')](respondWithResult(_0x233db3,null))[_0x1db5('0x46')](handleError(_0x233db3,null));};exports[_0x1db5('0x90')]=function(_0x2521b0,_0x2fc645,_0x4e96b8){return db[_0x1db5('0x42')][_0x1db5('0x4c')]({'where':{'id':_0x2521b0[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x2fc645,null))['then'](function(_0x4afe7a){if(_0x4afe7a){return _0x4afe7a[_0x1db5('0x90')](_0x2521b0[_0x1db5('0x32')][_0x1db5('0x69')]);}})['then'](function(_0x407ec6){if(_0x407ec6){return db[_0x1db5('0x5f')][_0x1db5('0x24')]({'where':{'ListId':_0x2521b0[_0x1db5('0x32')][_0x1db5('0x69')],'CampaignId':_0x2521b0[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](function(){return _0x407ec6;});}})['then'](respondWithStatusCode(_0x2fc645,null))[_0x1db5('0x46')](handleError(_0x2fc645,null));};exports[_0x1db5('0x91')]=function(_0x5136d4,_0x518fdc,_0x5d134e){var _0x132ed1={};var _0x104256={};var _0x3845a6;var _0x297abc;return db[_0x1db5('0x42')][_0x1db5('0x5c')]({'where':{'id':_0x5136d4[_0x1db5('0x48')]['id']}})['then'](handleEntityNotFound(_0x518fdc,null))[_0x1db5('0x27')](function(_0x3d9f61){if(_0x3d9f61){_0x3845a6=_0x3d9f61;_0x104256['model']=_[_0x1db5('0x33')](db[_0x1db5('0x65')][_0x1db5('0x2d')]);_0x104256[_0x1db5('0x32')]=_[_0x1db5('0x33')](_0x5136d4['query']);_0x104256[_0x1db5('0x34')]=_[_0x1db5('0x35')](_0x104256['model'],_0x104256[_0x1db5('0x32')]);_0x132ed1['attributes']=_['intersection'](_0x104256[_0x1db5('0x31')],qs[_0x1db5('0x36')](_0x5136d4['query']['fields']));_0x132ed1[_0x1db5('0x37')]=_0x132ed1[_0x1db5('0x37')]['length']?_0x132ed1[_0x1db5('0x37')]:_0x104256[_0x1db5('0x31')];_0x132ed1[_0x1db5('0x5d')]=qs['sort'](_0x5136d4['query'][_0x1db5('0x3b')]);_0x132ed1[_0x1db5('0x3c')]=qs[_0x1db5('0x34')](_[_0x1db5('0x3d')](_0x5136d4[_0x1db5('0x32')],_0x104256['filters']));if(_0x5136d4[_0x1db5('0x32')][_0x1db5('0x3e')]){_0x132ed1[_0x1db5('0x3c')]=_[_0x1db5('0x3f')](_0x132ed1[_0x1db5('0x3c')],{'$or':_[_0x1db5('0x2c')](_0x132ed1[_0x1db5('0x37')],function(_0x39a629){var _0x280af9={};_0x280af9[_0x39a629]={'$like':'%'+_0x5136d4[_0x1db5('0x32')]['filter']+'%'};return _0x280af9;})});}_0x132ed1=_[_0x1db5('0x3f')]({},_0x132ed1,_0x5136d4[_0x1db5('0x41')]);return _0x3845a6[_0x1db5('0x91')](_0x132ed1);}})[_0x1db5('0x27')](function(_0x2fd5b8){if(_0x2fd5b8){_0x297abc=_0x2fd5b8[_0x1db5('0x49')];if(!_0x5136d4[_0x1db5('0x32')][_0x1db5('0x38')](_0x1db5('0x39'))){_0x132ed1[_0x1db5('0x3a')]=qs['limit'](_0x5136d4[_0x1db5('0x32')][_0x1db5('0x3a')]);_0x132ed1[_0x1db5('0x1f')]=qs[_0x1db5('0x1f')](_0x5136d4['query'][_0x1db5('0x1f')]);}return _0x3845a6[_0x1db5('0x91')](_0x132ed1);}})[_0x1db5('0x27')](function(_0x1e9a39){if(_0x1e9a39){return _0x1e9a39?{'count':_0x297abc,'rows':_0x1e9a39}:null;}})[_0x1db5('0x27')](respondWithResult(_0x518fdc,null))[_0x1db5('0x46')](handleError(_0x518fdc,null));};exports[_0x1db5('0x92')]=function(_0x209096,_0x3f4833,_0x252c17){var _0x5b45fa,_0x3c9cb1;var _0x260a59=[];var _0x29b3f5=moment()[_0x1db5('0x68')](_0x1db5('0x93'));return db[_0x1db5('0x42')][_0x1db5('0x4c')]({'where':{'id':_0x209096[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x3f4833,null))[_0x1db5('0x27')](function(_0x46e35a){if(_0x46e35a){_0x3c9cb1=_0x46e35a;return _0x46e35a['addBlackLists'](_0x209096[_0x1db5('0x4e')][_0x1db5('0x69')],_['omit'](_0x209096[_0x1db5('0x4e')],[_0x1db5('0x69'),'id'])||{});}return null;})[_0x1db5('0x6a')](function(_0x246206){var _0x5e17a0;var _0x58dde2;_0x5b45fa=_0x246206||[];var _0x54634d=[];if(_0x246206){for(var _0x3a15f1=0x0;_0x3a15f1<_0x246206[_0x1db5('0x49')];_0x3a15f1+=0x1){var _0x19cce9=_0x246206[_0x3a15f1][_0x1db5('0x25')]({'plain':!![]});_0x5e17a0=squel[_0x1db5('0x6d')]()[_0x1db5('0x6e')](_0x1db5('0x94'))[_0x1db5('0x6f')]([_0x1db5('0x70'),'ContactId',_0x1db5('0x72'),_0x1db5('0x5e'),_0x1db5('0x58'),_0x1db5('0x59')],squel[_0x1db5('0x73')]()['field'](_0x1db5('0x70'),_0x1db5('0x70'))[_0x1db5('0x74')]('id','ContactId')[_0x1db5('0x74')](_0x19cce9[_0x1db5('0x77')][_0x1db5('0x78')](),_0x1db5('0x72'))[_0x1db5('0x74')](_0x209096['params']['id']['toString'](),_0x1db5('0x5e'))[_0x1db5('0x74')](_0x1db5('0x75'),_0x1db5('0x58'))[_0x1db5('0x74')](_0x1db5('0x75'),_0x1db5('0x59'))[_0x1db5('0x79')]('cm_contacts')[_0x1db5('0x3c')]('deletedAt\x20IS\x20NULL')[_0x1db5('0x3c')](_0x1db5('0x83'),_0x19cce9[_0x1db5('0x77')][_0x1db5('0x78')]())[_0x1db5('0x3c')](_0x1db5('0x7b')))[_0x1db5('0x78')]();_0x54634d['push'](db['sequelize']['query'](_0x5e17a0));}return BPromise[_0x1db5('0x8f')](_0x54634d);}})['then'](function(){return _0x5b45fa;})['then'](respondWithResult(_0x3f4833,null))[_0x1db5('0x46')](handleError(_0x3f4833,null));};exports['removeBlackLists']=function(_0x5d8a52,_0x1d49ae,_0x2c6e1c){return db['Campaign'][_0x1db5('0x4c')]({'where':{'id':_0x5d8a52[_0x1db5('0x48')]['id']}})[_0x1db5('0x27')](handleEntityNotFound(_0x1d49ae,null))[_0x1db5('0x27')](function(_0x5d8977){if(_0x5d8977){return _0x5d8977['removeBlackLists'](_0x5d8a52[_0x1db5('0x32')][_0x1db5('0x69')]);}})[_0x1db5('0x27')](function(_0x4264e7){if(_0x4264e7){return db[_0x1db5('0x64')]['destroy']({'where':{'ListId':_0x5d8a52[_0x1db5('0x32')][_0x1db5('0x69')],'CampaignId':_0x5d8a52['params']['id']}})['then'](function(){return _0x4264e7;});}})['then'](respondWithStatusCode(_0x1d49ae,null))[_0x1db5('0x46')](handleError(_0x1d49ae,null));}; \ No newline at end of file +var _0xd8d7=['phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_hopper_additional_phones','OrderBy','h.id','NOW()','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','get','IvrCampaigns','UserProfileResource','then','error','name','index','map','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','Campaign','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','updatedAt','omit','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CampaignId','CmHopper','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?'];(function(_0x4ff514,_0x200884){var _0x3f47d6=function(_0x555d1e){while(--_0x555d1e){_0x4ff514['push'](_0x4ff514['shift']());}};_0x3f47d6(++_0x200884);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0xd8d7[_0x349a9e];return _0x24c207;};'use strict';var emlformat=require(_0x7d8d('0x0'));var rimraf=require(_0x7d8d('0x1'));var zipdir=require(_0x7d8d('0x2'));var jsonpatch=require(_0x7d8d('0x3'));var rp=require(_0x7d8d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7d8d('0x5'));var sox=require('sox');var csv=require(_0x7d8d('0x6'));var ejs=require(_0x7d8d('0x7'));var fs=require('fs');var fs_extra=require(_0x7d8d('0x8'));var _=require(_0x7d8d('0x9'));var squel=require(_0x7d8d('0xa'));var crypto=require(_0x7d8d('0xb'));var jsforce=require(_0x7d8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7d8d('0x6'));var querystring=require(_0x7d8d('0xd'));var Papa=require(_0x7d8d('0xe'));var Redis=require(_0x7d8d('0xf'));var authService=require(_0x7d8d('0x10'));var qs=require(_0x7d8d('0x11'));var as=require(_0x7d8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d8d('0x13'))(_0x7d8d('0x14'));var utils=require(_0x7d8d('0x15'));var config=require(_0x7d8d('0x16'));var licenseUtil=require(_0x7d8d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba2b9,_0x444898){_0x444898=_0x444898||0xcc;return function(_0x343421){if(_0x343421){return _0x1ba2b9[_0x7d8d('0x18')](_0x444898);}return _0x1ba2b9[_0x7d8d('0x19')](_0x444898)[_0x7d8d('0x1a')]();};}function respondWithResult(_0x56d307,_0x36cb1d){_0x36cb1d=_0x36cb1d||0xc8;return function(_0x97b603){if(_0x97b603){return _0x56d307[_0x7d8d('0x19')](_0x36cb1d)[_0x7d8d('0x1b')](_0x97b603);}};}function respondWithFilteredResult(_0x486f68,_0x5f443e){return function(_0x349c01){if(_0x349c01){var _0x5dfb62=typeof _0x5f443e[_0x7d8d('0x1c')]==='undefined'&&typeof _0x5f443e[_0x7d8d('0x1d')]===_0x7d8d('0x1e');var _0x2f6b94=_0x349c01[_0x7d8d('0x1f')];var _0x1c00a3=_0x5dfb62?0x0:_0x5f443e[_0x7d8d('0x1c')];var _0x36dfbe=_0x5dfb62?_0x349c01[_0x7d8d('0x1f')]:_0x5f443e['offset']+_0x5f443e[_0x7d8d('0x1d')];var _0x3b3c2a;if(_0x36dfbe>=_0x2f6b94){_0x36dfbe=_0x2f6b94;_0x3b3c2a=0xc8;}else{_0x3b3c2a=0xce;}_0x486f68[_0x7d8d('0x19')](_0x3b3c2a);return _0x486f68[_0x7d8d('0x20')](_0x7d8d('0x21'),_0x1c00a3+'-'+_0x36dfbe+'/'+_0x2f6b94)[_0x7d8d('0x1b')](_0x349c01);}return null;};}function patchUpdates(_0x3b32d3){return function(_0x2b819b){try{jsonpatch[_0x7d8d('0x22')](_0x2b819b,_0x3b32d3,!![]);}catch(_0x910594){return BPromise[_0x7d8d('0x23')](_0x910594);}return _0x2b819b[_0x7d8d('0x24')]();};}function saveUpdates(_0x1d822a,_0x166104){return function(_0x505825){if(_0x505825){return _0x505825['update'](_0x1d822a)['then'](function(_0xb4361d){return _0xb4361d;});}return null;};}function removeEntity(_0xf40f41,_0x2ab3b8){return function(_0x1fe5e5){if(_0x1fe5e5){return _0x1fe5e5[_0x7d8d('0x25')]()['then'](function(){var _0x4fdcb7=_0x1fe5e5[_0x7d8d('0x26')]({'plain':!![]});var _0x459e88=_0x7d8d('0x27');return db[_0x7d8d('0x28')][_0x7d8d('0x25')]({'where':{'type':_0x459e88,'resourceId':_0x4fdcb7['id']}})[_0x7d8d('0x29')](function(){return _0x1fe5e5;});})['then'](function(){_0xf40f41[_0x7d8d('0x19')](0xcc)[_0x7d8d('0x1a')]();});}};}function handleEntityNotFound(_0x23afc4,_0x80ea6c){return function(_0xedad25){if(!_0xedad25){_0x23afc4['sendStatus'](0x194);}return _0xedad25;};}function handleError(_0x5aa8c3,_0x372c00){_0x372c00=_0x372c00||0x1f4;return function(_0x198f21){logger[_0x7d8d('0x2a')](_0x198f21['stack']);if(_0x198f21[_0x7d8d('0x2b')]){delete _0x198f21[_0x7d8d('0x2b')];}_0x5aa8c3[_0x7d8d('0x19')](_0x372c00)['send'](_0x198f21);};}exports[_0x7d8d('0x2c')]=function(_0x180db1,_0x531fd3){var _0x1a918c={},_0x46319a={},_0x3c1fb2={'count':0x0,'rows':[]};var _0x308383=_[_0x7d8d('0x2d')](db['Campaign']['rawAttributes'],function(_0x123b34){return{'name':_0x123b34[_0x7d8d('0x2e')],'type':_0x123b34['type'][_0x7d8d('0x2f')]};});_0x46319a['model']=_[_0x7d8d('0x2d')](_0x308383,_0x7d8d('0x2b'));_0x46319a['query']=_[_0x7d8d('0x30')](_0x180db1[_0x7d8d('0x31')]);_0x46319a[_0x7d8d('0x32')]=_[_0x7d8d('0x33')](_0x46319a['model'],_0x46319a[_0x7d8d('0x31')]);_0x1a918c['attributes']=_[_0x7d8d('0x33')](_0x46319a[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0x180db1[_0x7d8d('0x31')]['fields']));_0x1a918c[_0x7d8d('0x36')]=_0x1a918c[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x1a918c[_0x7d8d('0x36')]:_0x46319a[_0x7d8d('0x34')];if(!_0x180db1[_0x7d8d('0x31')][_0x7d8d('0x38')](_0x7d8d('0x39'))){_0x1a918c['limit']=qs[_0x7d8d('0x1d')](_0x180db1[_0x7d8d('0x31')][_0x7d8d('0x1d')]);_0x1a918c['offset']=qs['offset'](_0x180db1['query'][_0x7d8d('0x1c')]);}_0x1a918c[_0x7d8d('0x3a')]=qs[_0x7d8d('0x3b')](_0x180db1[_0x7d8d('0x31')][_0x7d8d('0x3b')]);_0x1a918c['where']=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0x180db1['query'],_0x46319a[_0x7d8d('0x32')]),_0x308383);if(_0x180db1[_0x7d8d('0x31')][_0x7d8d('0x3d')]){_0x1a918c[_0x7d8d('0x3e')]=_[_0x7d8d('0x3f')](_0x1a918c[_0x7d8d('0x3e')],{'$or':_[_0x7d8d('0x2d')](_0x308383,function(_0x393bbb){if(_0x393bbb[_0x7d8d('0x40')]!==_0x7d8d('0x41')){var _0x4c4aa1={};_0x4c4aa1[_0x393bbb['name']]={'$like':'%'+_0x180db1[_0x7d8d('0x31')]['filter']+'%'};return _0x4c4aa1;}})});}_0x1a918c=_[_0x7d8d('0x3f')]({},_0x1a918c,_0x180db1[_0x7d8d('0x42')]);var _0x4c1273={'where':_0x1a918c[_0x7d8d('0x3e')]};return db['Campaign'][_0x7d8d('0x1f')](_0x4c1273)['then'](function(_0x3e2720){_0x3c1fb2[_0x7d8d('0x1f')]=_0x3e2720;if(_0x180db1[_0x7d8d('0x31')][_0x7d8d('0x43')]){_0x1a918c[_0x7d8d('0x44')]=[{'all':!![]}];}return db[_0x7d8d('0x45')][_0x7d8d('0x46')](_0x1a918c);})[_0x7d8d('0x29')](function(_0x214de3){_0x3c1fb2[_0x7d8d('0x47')]=_0x214de3;return _0x3c1fb2;})[_0x7d8d('0x29')](respondWithFilteredResult(_0x531fd3,_0x1a918c))[_0x7d8d('0x48')](handleError(_0x531fd3,null));};exports[_0x7d8d('0x49')]=function(_0x47831e,_0x3b7b27){var _0x2a3b29={'raw':![],'where':{'id':_0x47831e[_0x7d8d('0x4a')]['id']}},_0x348825={};_0x348825[_0x7d8d('0x34')]=_[_0x7d8d('0x30')](db[_0x7d8d('0x45')][_0x7d8d('0x4b')]);_0x348825[_0x7d8d('0x31')]=_['keys'](_0x47831e[_0x7d8d('0x31')]);_0x348825[_0x7d8d('0x32')]=_[_0x7d8d('0x33')](_0x348825[_0x7d8d('0x34')],_0x348825['query']);_0x2a3b29[_0x7d8d('0x36')]=_[_0x7d8d('0x33')](_0x348825['model'],qs[_0x7d8d('0x35')](_0x47831e[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x2a3b29[_0x7d8d('0x36')]=_0x2a3b29[_0x7d8d('0x36')]['length']?_0x2a3b29[_0x7d8d('0x36')]:_0x348825[_0x7d8d('0x34')];if(_0x47831e[_0x7d8d('0x31')][_0x7d8d('0x43')]){_0x2a3b29[_0x7d8d('0x44')]=[{'all':!![]}];}_0x2a3b29=_['merge']({},_0x2a3b29,_0x47831e[_0x7d8d('0x42')]);return db['Campaign'][_0x7d8d('0x4c')](_0x2a3b29)[_0x7d8d('0x29')](handleEntityNotFound(_0x3b7b27,null))[_0x7d8d('0x29')](respondWithResult(_0x3b7b27,null))[_0x7d8d('0x48')](handleError(_0x3b7b27,null));};exports[_0x7d8d('0x4d')]=function(_0x3ddc1b,_0x2f2679){return db[_0x7d8d('0x45')][_0x7d8d('0x4d')](_0x3ddc1b[_0x7d8d('0x4e')],{})[_0x7d8d('0x29')](function(_0x42ed27){var _0x492350=_0x3ddc1b[_0x7d8d('0x4f')]['get']({'plain':!![]});if(!_0x492350)throw new Error(_0x7d8d('0x50'));if(_0x492350[_0x7d8d('0x51')]===_0x7d8d('0x4f')){var _0x18e9fa=_0x42ed27['get']({'plain':!![]});var _0x45fdec='IvrCampaigns';return db[_0x7d8d('0x52')][_0x7d8d('0x4c')]({'where':{'name':_0x45fdec,'userProfileId':_0x492350[_0x7d8d('0x53')]},'raw':!![]})[_0x7d8d('0x29')](function(_0x3a6325){if(_0x3a6325&&_0x3a6325[_0x7d8d('0x54')]===0x0){return db[_0x7d8d('0x28')][_0x7d8d('0x4d')]({'name':_0x18e9fa[_0x7d8d('0x2b')],'resourceId':_0x18e9fa['id'],'type':_0x3a6325['name'],'sectionId':_0x3a6325['id']},{})[_0x7d8d('0x29')](function(){return _0x42ed27;});}else{return _0x42ed27;}})[_0x7d8d('0x48')](function(_0x31df6a){logger[_0x7d8d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31df6a);throw _0x31df6a;});}return _0x42ed27;})[_0x7d8d('0x29')](respondWithResult(_0x2f2679,0xc9))[_0x7d8d('0x48')](handleError(_0x2f2679,null));};exports[_0x7d8d('0x55')]=function(_0x2ce84e,_0x595993){var _0x2dd80e={'where':{'id':_0x2ce84e[_0x7d8d('0x4a')]['id']}},_0xa2c0b8={};_0xa2c0b8[_0x7d8d('0x34')]=_[_0x7d8d('0x30')](db[_0x7d8d('0x45')][_0x7d8d('0x4b')]);_0x2dd80e['attributes']=_[_0x7d8d('0x33')](_0xa2c0b8[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0x2ce84e[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x2dd80e['attributes']=_0x2dd80e[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x2dd80e[_0x7d8d('0x36')]:_0xa2c0b8[_0x7d8d('0x34')];if(_0x2ce84e[_0x7d8d('0x31')][_0x7d8d('0x43')]){_0x2dd80e[_0x7d8d('0x44')]=[{'all':!![]}];}_0x2dd80e=_['merge']({},_0x2dd80e,_0x2ce84e[_0x7d8d('0x42')]);return db['Campaign'][_0x7d8d('0x4c')](_0x2dd80e)[_0x7d8d('0x29')](handleEntityNotFound(_0x595993,null))['then'](function(_0x15ba2a){if(_0x15ba2a){var _0x25f91e=_0x15ba2a[_0x7d8d('0x26')]({'plain':!![]});_0x25f91e=qs['omit'](_0x25f91e,['id','createdAt',_0x7d8d('0x56')]);_0x2ce84e[_0x7d8d('0x4e')]=_[_0x7d8d('0x57')](_0x2ce84e[_0x7d8d('0x4e')],['id',_0x7d8d('0x58'),_0x7d8d('0x56')]);return db[_0x7d8d('0x45')][_0x7d8d('0x4d')](_[_0x7d8d('0x3f')](_0x25f91e,_0x2ce84e['body']),{'include':_0x2ce84e[_0x7d8d('0x31')][_0x7d8d('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x368ed2){var _0x252fb7=_0x2ce84e['user'][_0x7d8d('0x26')]({'plain':!![]});if(!_0x252fb7)throw new Error(_0x7d8d('0x50'));if(_0x252fb7['role']===_0x7d8d('0x4f')){var _0x294fc9=_0x368ed2['get']({'plain':!![]});var _0x5cd31d=_0x7d8d('0x27');return db[_0x7d8d('0x52')]['find']({'where':{'name':_0x5cd31d,'userProfileId':_0x252fb7[_0x7d8d('0x53')]},'raw':!![]})[_0x7d8d('0x29')](function(_0x28e752){if(_0x28e752&&_0x28e752[_0x7d8d('0x54')]===0x0){return db[_0x7d8d('0x28')]['create']({'name':_0x294fc9[_0x7d8d('0x2b')],'resourceId':_0x294fc9['id'],'type':_0x28e752[_0x7d8d('0x2b')],'sectionId':_0x28e752['id']},{})[_0x7d8d('0x29')](function(){return _0x368ed2;});}else{return _0x368ed2;}})[_0x7d8d('0x48')](function(_0x508784){logger[_0x7d8d('0x2a')](_0x7d8d('0x59'),_0x508784);throw _0x508784;});}return _0x368ed2;});}})[_0x7d8d('0x29')](respondWithResult(_0x595993,0xc9))[_0x7d8d('0x48')](handleError(_0x595993,null));};exports['update']=function(_0x28e789,_0x4176ba){if(_0x28e789['body']['id']){delete _0x28e789[_0x7d8d('0x4e')]['id'];}return db[_0x7d8d('0x45')][_0x7d8d('0x4c')]({'where':{'id':_0x28e789[_0x7d8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4176ba,null))[_0x7d8d('0x29')](saveUpdates(_0x28e789[_0x7d8d('0x4e')],null))[_0x7d8d('0x29')](respondWithResult(_0x4176ba,null))[_0x7d8d('0x48')](handleError(_0x4176ba,null));};exports[_0x7d8d('0x25')]=function(_0x35999d,_0x400ce3){return db[_0x7d8d('0x45')][_0x7d8d('0x4c')]({'where':{'id':_0x35999d[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x400ce3,null))[_0x7d8d('0x29')](removeEntity(_0x400ce3,null))[_0x7d8d('0x48')](handleError(_0x400ce3,null));};exports[_0x7d8d('0x5a')]=function(_0x5e2838,_0x3c4975,_0x3f5e87){var _0x40d351={'raw':!![],'where':{}};var _0x34a0cb={};var _0x2f8be1={'count':0x0,'rows':[]};return db[_0x7d8d('0x45')][_0x7d8d('0x5b')]({'where':{'id':_0x5e2838[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x3c4975,null))['then'](function(_0x41b994){if(_0x41b994){_0x34a0cb['model']=_[_0x7d8d('0x30')](db['CmHopper'][_0x7d8d('0x4b')]);_0x34a0cb[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0x5e2838['query']);_0x34a0cb[_0x7d8d('0x32')]=_[_0x7d8d('0x33')](_0x34a0cb['model'],_0x34a0cb['query']);_0x40d351['attributes']=_[_0x7d8d('0x33')](_0x34a0cb[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0x5e2838[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x40d351[_0x7d8d('0x36')]=_0x40d351[_0x7d8d('0x36')]['length']?_0x40d351['attributes']:_0x34a0cb['model'];if(!_0x5e2838[_0x7d8d('0x31')][_0x7d8d('0x38')](_0x7d8d('0x39'))){_0x40d351[_0x7d8d('0x1d')]=qs[_0x7d8d('0x1d')](_0x5e2838[_0x7d8d('0x31')][_0x7d8d('0x1d')]);_0x40d351['offset']=qs[_0x7d8d('0x1c')](_0x5e2838[_0x7d8d('0x31')][_0x7d8d('0x1c')]);}_0x40d351[_0x7d8d('0x3a')]=qs[_0x7d8d('0x3b')](_0x5e2838['query'][_0x7d8d('0x3b')]);_0x40d351[_0x7d8d('0x3e')]=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0x5e2838[_0x7d8d('0x31')],_0x34a0cb[_0x7d8d('0x32')]));_0x40d351[_0x7d8d('0x3e')][_0x7d8d('0x5c')]=_0x41b994['id'];if(_0x5e2838[_0x7d8d('0x31')][_0x7d8d('0x3d')]){_0x40d351['where']=_[_0x7d8d('0x3f')](_0x40d351[_0x7d8d('0x3e')],{'$or':_[_0x7d8d('0x2d')](_0x40d351['attributes'],function(_0x196db7){var _0x16f2e7={};_0x16f2e7[_0x196db7]={'$like':'%'+_0x5e2838[_0x7d8d('0x31')]['filter']+'%'};return _0x16f2e7;})});}_0x40d351=_['merge']({},_0x40d351,_0x5e2838[_0x7d8d('0x42')]);return db[_0x7d8d('0x5d')]['count']({'where':_0x40d351['where']})[_0x7d8d('0x29')](function(_0x2f8331){_0x2f8be1[_0x7d8d('0x1f')]=_0x2f8331;if(_0x5e2838[_0x7d8d('0x31')]['includeAll']){_0x40d351[_0x7d8d('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x7d8d('0x46')](_0x40d351);})['then'](function(_0x437bb3){_0x2f8be1['rows']=_0x437bb3;return _0x2f8be1;});}})[_0x7d8d('0x29')](respondWithFilteredResult(_0x3c4975,_0x40d351))[_0x7d8d('0x48')](handleError(_0x3c4975,null));};exports['getHopperHistories']=function(_0x3950b4,_0x539873,_0x17fd1c){var _0x4210fe={'raw':!![],'where':{}};var _0x18db39={};var _0x5e1909={'count':0x0,'rows':[]};return db[_0x7d8d('0x45')]['findOne']({'where':{'id':_0x3950b4[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x539873,null))[_0x7d8d('0x29')](function(_0x586bd8){if(_0x586bd8){_0x18db39[_0x7d8d('0x34')]=_[_0x7d8d('0x30')](db[_0x7d8d('0x5e')]['rawAttributes']);_0x18db39[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0x3950b4[_0x7d8d('0x31')]);_0x18db39[_0x7d8d('0x32')]=_[_0x7d8d('0x33')](_0x18db39[_0x7d8d('0x34')],_0x18db39[_0x7d8d('0x31')]);_0x4210fe[_0x7d8d('0x36')]=_[_0x7d8d('0x33')](_0x18db39[_0x7d8d('0x34')],qs['fields'](_0x3950b4[_0x7d8d('0x31')]['fields']));_0x4210fe[_0x7d8d('0x36')]=_0x4210fe[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x4210fe[_0x7d8d('0x36')]:_0x18db39[_0x7d8d('0x34')];if(!_0x3950b4[_0x7d8d('0x31')][_0x7d8d('0x38')](_0x7d8d('0x39'))){_0x4210fe['limit']=qs[_0x7d8d('0x1d')](_0x3950b4['query'][_0x7d8d('0x1d')]);_0x4210fe['offset']=qs[_0x7d8d('0x1c')](_0x3950b4['query'][_0x7d8d('0x1c')]);}_0x4210fe[_0x7d8d('0x3a')]=qs[_0x7d8d('0x3b')](_0x3950b4[_0x7d8d('0x31')]['sort']);_0x4210fe['where']=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0x3950b4[_0x7d8d('0x31')],_0x18db39[_0x7d8d('0x32')]));_0x4210fe['where'][_0x7d8d('0x5c')]=_0x586bd8['id'];if(_0x3950b4[_0x7d8d('0x31')][_0x7d8d('0x3d')]){_0x4210fe[_0x7d8d('0x3e')]=_['merge'](_0x4210fe[_0x7d8d('0x3e')],{'$or':_[_0x7d8d('0x2d')](_0x4210fe[_0x7d8d('0x36')],function(_0x355768){var _0x1b5791={};_0x1b5791[_0x355768]={'$like':'%'+_0x3950b4[_0x7d8d('0x31')][_0x7d8d('0x3d')]+'%'};return _0x1b5791;})});}_0x4210fe=_[_0x7d8d('0x3f')]({},_0x4210fe,_0x3950b4[_0x7d8d('0x42')]);return db[_0x7d8d('0x5e')][_0x7d8d('0x1f')]({'where':_0x4210fe[_0x7d8d('0x3e')]})[_0x7d8d('0x29')](function(_0x48e206){_0x5e1909[_0x7d8d('0x1f')]=_0x48e206;if(_0x3950b4['query'][_0x7d8d('0x43')]){_0x4210fe[_0x7d8d('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7d8d('0x46')](_0x4210fe);})['then'](function(_0x52306b){_0x5e1909[_0x7d8d('0x47')]=_0x52306b;return _0x5e1909;});}})[_0x7d8d('0x29')](respondWithFilteredResult(_0x539873,_0x4210fe))[_0x7d8d('0x48')](handleError(_0x539873,null));};exports['getHopperFinals']=function(_0xd2a1a4,_0x49c4e9,_0x285514){var _0x3600e4={'raw':!![],'where':{}};var _0x407a13={};var _0x33024f={'count':0x0,'rows':[]};return db['Campaign'][_0x7d8d('0x5b')]({'where':{'id':_0xd2a1a4[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x49c4e9,null))[_0x7d8d('0x29')](function(_0x1eb5f2){if(_0x1eb5f2){_0x407a13[_0x7d8d('0x34')]=_[_0x7d8d('0x30')](db[_0x7d8d('0x5f')]['rawAttributes']);_0x407a13[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0xd2a1a4[_0x7d8d('0x31')]);_0x407a13[_0x7d8d('0x32')]=_['intersection'](_0x407a13[_0x7d8d('0x34')],_0x407a13[_0x7d8d('0x31')]);_0x3600e4['attributes']=_[_0x7d8d('0x33')](_0x407a13[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0xd2a1a4[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x3600e4[_0x7d8d('0x36')]=_0x3600e4[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x3600e4[_0x7d8d('0x36')]:_0x407a13[_0x7d8d('0x34')];if(!_0xd2a1a4['query']['hasOwnProperty'](_0x7d8d('0x39'))){_0x3600e4['limit']=qs[_0x7d8d('0x1d')](_0xd2a1a4[_0x7d8d('0x31')][_0x7d8d('0x1d')]);_0x3600e4['offset']=qs[_0x7d8d('0x1c')](_0xd2a1a4[_0x7d8d('0x31')][_0x7d8d('0x1c')]);}_0x3600e4[_0x7d8d('0x3a')]=qs['sort'](_0xd2a1a4[_0x7d8d('0x31')]['sort']);_0x3600e4[_0x7d8d('0x3e')]=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0xd2a1a4[_0x7d8d('0x31')],_0x407a13[_0x7d8d('0x32')]));_0x3600e4[_0x7d8d('0x3e')][_0x7d8d('0x5c')]=_0x1eb5f2['id'];if(_0xd2a1a4[_0x7d8d('0x31')][_0x7d8d('0x3d')]){_0x3600e4[_0x7d8d('0x3e')]=_[_0x7d8d('0x3f')](_0x3600e4['where'],{'$or':_['map'](_0x3600e4[_0x7d8d('0x36')],function(_0x44b6c2){var _0x480f5b={};_0x480f5b[_0x44b6c2]={'$like':'%'+_0xd2a1a4[_0x7d8d('0x31')][_0x7d8d('0x3d')]+'%'};return _0x480f5b;})});}_0x3600e4=_[_0x7d8d('0x3f')]({},_0x3600e4,_0xd2a1a4[_0x7d8d('0x42')]);return db['CmHopperFinal'][_0x7d8d('0x1f')]({'where':_0x3600e4[_0x7d8d('0x3e')]})['then'](function(_0x4d709d){_0x33024f[_0x7d8d('0x1f')]=_0x4d709d;if(_0xd2a1a4[_0x7d8d('0x31')]['includeAll']){_0x3600e4[_0x7d8d('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7d8d('0x46')](_0x3600e4);})[_0x7d8d('0x29')](function(_0x4a0ddd){_0x33024f[_0x7d8d('0x47')]=_0x4a0ddd;return _0x33024f;});}})[_0x7d8d('0x29')](respondWithFilteredResult(_0x49c4e9,_0x3600e4))[_0x7d8d('0x48')](handleError(_0x49c4e9,null));};exports[_0x7d8d('0x60')]=function(_0x38b119,_0x9030e2,_0x1fe0d0){var _0x154657={'raw':!![],'where':{}};var _0x3b4a96={};var _0x293619={'count':0x0,'rows':[]};return db[_0x7d8d('0x45')][_0x7d8d('0x5b')]({'where':{'id':_0x38b119[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x9030e2,null))[_0x7d8d('0x29')](function(_0x10e07d){if(_0x10e07d){_0x3b4a96['model']=_['keys'](db[_0x7d8d('0x61')][_0x7d8d('0x4b')]);_0x3b4a96[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0x38b119[_0x7d8d('0x31')]);_0x3b4a96[_0x7d8d('0x32')]=_['intersection'](_0x3b4a96['model'],_0x3b4a96[_0x7d8d('0x31')]);_0x154657[_0x7d8d('0x36')]=_[_0x7d8d('0x33')](_0x3b4a96[_0x7d8d('0x34')],qs['fields'](_0x38b119[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x154657[_0x7d8d('0x36')]=_0x154657[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x154657[_0x7d8d('0x36')]:_0x3b4a96[_0x7d8d('0x34')];if(!_0x38b119['query'][_0x7d8d('0x38')](_0x7d8d('0x39'))){_0x154657[_0x7d8d('0x1d')]=qs[_0x7d8d('0x1d')](_0x38b119[_0x7d8d('0x31')][_0x7d8d('0x1d')]);_0x154657[_0x7d8d('0x1c')]=qs[_0x7d8d('0x1c')](_0x38b119[_0x7d8d('0x31')][_0x7d8d('0x1c')]);}_0x154657['order']=qs[_0x7d8d('0x3b')](_0x38b119[_0x7d8d('0x31')][_0x7d8d('0x3b')]);_0x154657[_0x7d8d('0x3e')]=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0x38b119[_0x7d8d('0x31')],_0x3b4a96[_0x7d8d('0x32')]));_0x154657['where'][_0x7d8d('0x5c')]=_0x10e07d['id'];if(_0x38b119[_0x7d8d('0x31')]['filter']){_0x154657[_0x7d8d('0x3e')]=_[_0x7d8d('0x3f')](_0x154657['where'],{'$or':_[_0x7d8d('0x2d')](_0x154657['attributes'],function(_0xe70b92){var _0x3b2ea7={};_0x3b2ea7[_0xe70b92]={'$like':'%'+_0x38b119[_0x7d8d('0x31')]['filter']+'%'};return _0x3b2ea7;})});}_0x154657=_[_0x7d8d('0x3f')]({},_0x154657,_0x38b119[_0x7d8d('0x42')]);return db[_0x7d8d('0x61')]['count']({'where':_0x154657[_0x7d8d('0x3e')]})['then'](function(_0x7bca81){_0x293619['count']=_0x7bca81;if(_0x38b119['query'][_0x7d8d('0x43')]){_0x154657[_0x7d8d('0x44')]=[{'all':!![]}];}return db[_0x7d8d('0x61')]['findAll'](_0x154657);})[_0x7d8d('0x29')](function(_0x1b13b5){_0x293619[_0x7d8d('0x47')]=_0x1b13b5;return _0x293619;});}})['then'](respondWithFilteredResult(_0x9030e2,_0x154657))[_0x7d8d('0x48')](handleError(_0x9030e2,null));};exports[_0x7d8d('0x62')]=function(_0x22ded7,_0x5bc060,_0x23f530){var _0x19c59b={};var _0x42bb78={};var _0x39a2ae;var _0x5a0f3b;return db['Campaign']['findOne']({'where':{'id':_0x22ded7[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x5bc060,null))[_0x7d8d('0x29')](function(_0x88ea7f){if(_0x88ea7f){_0x39a2ae=_0x88ea7f;_0x42bb78['model']=_[_0x7d8d('0x30')](db['CmList'][_0x7d8d('0x4b')]);_0x42bb78[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0x22ded7[_0x7d8d('0x31')]);_0x42bb78[_0x7d8d('0x32')]=_['intersection'](_0x42bb78[_0x7d8d('0x34')],_0x42bb78['query']);_0x19c59b[_0x7d8d('0x36')]=_[_0x7d8d('0x33')](_0x42bb78[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0x22ded7[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x19c59b[_0x7d8d('0x36')]=_0x19c59b[_0x7d8d('0x36')]['length']?_0x19c59b[_0x7d8d('0x36')]:_0x42bb78[_0x7d8d('0x34')];_0x19c59b['order']=qs[_0x7d8d('0x3b')](_0x22ded7[_0x7d8d('0x31')][_0x7d8d('0x3b')]);_0x19c59b[_0x7d8d('0x3e')]=qs['filters'](_['pick'](_0x22ded7[_0x7d8d('0x31')],_0x42bb78[_0x7d8d('0x32')]));if(_0x22ded7[_0x7d8d('0x31')][_0x7d8d('0x3d')]){_0x19c59b['where']=_[_0x7d8d('0x3f')](_0x19c59b['where'],{'$or':_[_0x7d8d('0x2d')](_0x19c59b[_0x7d8d('0x36')],function(_0x45bc4e){var _0x4a6d3c={};_0x4a6d3c[_0x45bc4e]={'$like':'%'+_0x22ded7['query'][_0x7d8d('0x3d')]+'%'};return _0x4a6d3c;})});}_0x19c59b=_[_0x7d8d('0x3f')]({},_0x19c59b,_0x22ded7[_0x7d8d('0x42')]);return _0x39a2ae[_0x7d8d('0x62')](_0x19c59b);}})[_0x7d8d('0x29')](function(_0x4de9da){if(_0x4de9da){_0x5a0f3b=_0x4de9da['length'];if(!_0x22ded7[_0x7d8d('0x31')]['hasOwnProperty'](_0x7d8d('0x39'))){_0x19c59b['limit']=qs[_0x7d8d('0x1d')](_0x22ded7[_0x7d8d('0x31')]['limit']);_0x19c59b[_0x7d8d('0x1c')]=qs[_0x7d8d('0x1c')](_0x22ded7[_0x7d8d('0x31')][_0x7d8d('0x1c')]);}return _0x39a2ae[_0x7d8d('0x62')](_0x19c59b);}})[_0x7d8d('0x29')](function(_0x2498f3){if(_0x2498f3){return _0x2498f3?{'count':_0x5a0f3b,'rows':_0x2498f3}:null;}})[_0x7d8d('0x29')](respondWithResult(_0x5bc060,null))[_0x7d8d('0x48')](handleError(_0x5bc060,null));};exports['addLists']=function(_0x126519,_0xaae289,_0x41eab0){var _0xf4b1ba,_0x57a8bd;var _0x34b427=[];var _0x179e54=moment()[_0x7d8d('0x63')](_0x7d8d('0x64'));return db[_0x7d8d('0x45')][_0x7d8d('0x4c')]({'where':{'id':_0x126519[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0xaae289,null))[_0x7d8d('0x29')](function(_0x1ef7dd){if(_0x1ef7dd){_0x57a8bd=_0x1ef7dd;return _0x1ef7dd[_0x7d8d('0x65')](_0x126519[_0x7d8d('0x4e')][_0x7d8d('0x66')],_['omit'](_0x126519[_0x7d8d('0x4e')],[_0x7d8d('0x66'),'id'])||{});}return null;})[_0x7d8d('0x67')](function(_0x132178){var _0x26461e;var _0x1e9ff5;_0xf4b1ba=_0x132178||[];var _0x2f7c32=[];if(_0x132178){for(var _0x3345d7=0x0;_0x3345d7<_0x132178['length'];_0x3345d7+=0x1){var _0x5e8f40=_0x132178[_0x3345d7]['get']({'plain':!![]});_0x57a8bd[_0x7d8d('0x68')]=_0x126519[_0x7d8d('0x4e')][_0x7d8d('0x68')]?_0x126519['body']['dialCheckDuplicateType']:_0x57a8bd[_0x7d8d('0x68')];switch(_0x57a8bd['dialCheckDuplicateType']){case _0x7d8d('0x69'):_0x26461e=squel[_0x7d8d('0x6a')]()['into'](_0x7d8d('0x6b'))[_0x7d8d('0x6c')](['phone',_0x7d8d('0x6d'),_0x7d8d('0x6e'),_0x7d8d('0x6f'),_0x7d8d('0x5c'),'createdAt',_0x7d8d('0x56')],squel[_0x7d8d('0x70')]()[_0x7d8d('0x71')](_0x7d8d('0x72'),'phone')['field']('NOW()',_0x7d8d('0x6d'))[_0x7d8d('0x71')]('id','ContactId')[_0x7d8d('0x71')](_0x5e8f40[_0x7d8d('0x73')][_0x7d8d('0x74')](),_0x7d8d('0x6f'))[_0x7d8d('0x71')](_0x126519[_0x7d8d('0x4a')]['id']['toString'](),'CampaignId')[_0x7d8d('0x71')]('\x27'+_0x179e54+'\x27',_0x7d8d('0x58'))[_0x7d8d('0x71')]('\x27'+_0x179e54+'\x27',_0x7d8d('0x56'))['from'](_0x7d8d('0x75'))[_0x7d8d('0x3e')](_0x7d8d('0x76'))[_0x7d8d('0x3e')](_0x7d8d('0x77'),_0x5e8f40[_0x7d8d('0x73')]['toString']())['where'](_0x7d8d('0x78'))[_0x7d8d('0x3e')](_0x7d8d('0x79'),squel[_0x7d8d('0x70')]()[_0x7d8d('0x71')](_0x7d8d('0x7a'))[_0x7d8d('0x7b')](_0x7d8d('0x7c'))[_0x7d8d('0x3e')](_0x7d8d('0x7d'),_0x126519[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')]()))[_0x7d8d('0x3e')](_0x7d8d('0x79'),squel[_0x7d8d('0x70')]()[_0x7d8d('0x71')](_0x7d8d('0x7e'))[_0x7d8d('0x7b')]('cm_hopper')[_0x7d8d('0x3e')](_0x7d8d('0x7d'),_0x126519[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')]())))[_0x7d8d('0x74')]();break;case _0x7d8d('0x7f'):_0x26461e=squel[_0x7d8d('0x6a')]()[_0x7d8d('0x80')](_0x7d8d('0x6b'))[_0x7d8d('0x6c')](['phone',_0x7d8d('0x6d'),'ContactId',_0x7d8d('0x6f'),'CampaignId','createdAt',_0x7d8d('0x56')],squel['select']()[_0x7d8d('0x71')](_0x7d8d('0x72'),_0x7d8d('0x72'))[_0x7d8d('0x71')]('NOW()',_0x7d8d('0x6d'))[_0x7d8d('0x71')]('id',_0x7d8d('0x6e'))[_0x7d8d('0x71')](_0x5e8f40['CmListId']['toString'](),_0x7d8d('0x6f'))[_0x7d8d('0x71')](_0x126519[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')](),_0x7d8d('0x5c'))['field']('\x27'+_0x179e54+'\x27','createdAt')['field']('\x27'+_0x179e54+'\x27',_0x7d8d('0x56'))[_0x7d8d('0x7b')](_0x7d8d('0x75'))['where'](_0x7d8d('0x76'))['where'](_0x7d8d('0x77'),_0x5e8f40[_0x7d8d('0x73')]['toString']())['where'](_0x7d8d('0x78'))[_0x7d8d('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x7d8d('0x7e'))[_0x7d8d('0x7b')](_0x7d8d('0x6b'))[_0x7d8d('0x3e')](_0x7d8d('0x7d'),_0x126519[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')]())))['toString']();break;default:_0x26461e=squel['insert']()['into'](_0x7d8d('0x6b'))[_0x7d8d('0x6c')](['phone',_0x7d8d('0x6d'),_0x7d8d('0x6e'),'ListId','CampaignId',_0x7d8d('0x58'),'updatedAt'],squel[_0x7d8d('0x70')]()['field'](_0x7d8d('0x72'),'phone')[_0x7d8d('0x71')]('NOW()',_0x7d8d('0x6d'))[_0x7d8d('0x71')]('id','ContactId')[_0x7d8d('0x71')](_0x5e8f40[_0x7d8d('0x73')][_0x7d8d('0x74')](),_0x7d8d('0x6f'))[_0x7d8d('0x71')](_0x126519['params']['id']['toString'](),'CampaignId')[_0x7d8d('0x71')]('\x27'+_0x179e54+'\x27',_0x7d8d('0x58'))[_0x7d8d('0x71')]('\x27'+_0x179e54+'\x27',_0x7d8d('0x56'))[_0x7d8d('0x7b')](_0x7d8d('0x75'))['where'](_0x7d8d('0x76'))[_0x7d8d('0x3e')](_0x7d8d('0x77'),_0x5e8f40[_0x7d8d('0x73')][_0x7d8d('0x74')]())[_0x7d8d('0x3e')](_0x7d8d('0x78')))[_0x7d8d('0x74')]();}_0x1e9ff5=squel[_0x7d8d('0x6a')]()['into'](_0x7d8d('0x81'))[_0x7d8d('0x6c')](['cmHopperId','scheduledAt','phone',_0x7d8d('0x82'),_0x7d8d('0x58'),'updatedAt'],squel['select']()['field'](_0x7d8d('0x83'),'id')[_0x7d8d('0x71')](_0x7d8d('0x84'),_0x7d8d('0x6d'))[_0x7d8d('0x71')]('ci.item',_0x7d8d('0x72'))[_0x7d8d('0x71')]('ci.OrderBY',_0x7d8d('0x82'))[_0x7d8d('0x71')]('\x27'+_0x179e54+'\x27',_0x7d8d('0x58'))['field']('\x27'+_0x179e54+'\x27',_0x7d8d('0x56'))[_0x7d8d('0x7b')](_0x7d8d('0x85'),'ci')[_0x7d8d('0x86')](_0x7d8d('0x6b'),'h',_0x7d8d('0x87'))[_0x7d8d('0x3e')](_0x7d8d('0x88'),_0x5e8f40[_0x7d8d('0x73')][_0x7d8d('0x74')]())[_0x7d8d('0x3e')](_0x7d8d('0x89'),_0x126519[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')]())[_0x7d8d('0x3e')](_0x7d8d('0x8a'),_0x179e54))[_0x7d8d('0x74')]();_0x2f7c32[_0x7d8d('0x8b')](db['sequelize'][_0x7d8d('0x31')](_0x26461e));_0x34b427[_0x7d8d('0x8b')](db[_0x7d8d('0x8c')][_0x7d8d('0x31')](_0x1e9ff5));}return BPromise[_0x7d8d('0x8d')](_0x2f7c32);}})['then'](function(){return BPromise['all'](_0x34b427);})[_0x7d8d('0x29')](function(){return _0xf4b1ba;})[_0x7d8d('0x29')](respondWithResult(_0xaae289,null))[_0x7d8d('0x48')](handleError(_0xaae289,null));};exports[_0x7d8d('0x8e')]=function(_0x45f9ac,_0x3a8200,_0x2d0eca){return db[_0x7d8d('0x45')][_0x7d8d('0x4c')]({'where':{'id':_0x45f9ac[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x3a8200,null))[_0x7d8d('0x29')](function(_0x470214){if(_0x470214){return _0x470214[_0x7d8d('0x8e')](_0x45f9ac[_0x7d8d('0x31')]['ids']);}})[_0x7d8d('0x29')](function(_0x50be06){if(_0x50be06){return db[_0x7d8d('0x5d')][_0x7d8d('0x25')]({'where':{'ListId':_0x45f9ac[_0x7d8d('0x31')][_0x7d8d('0x66')],'CampaignId':_0x45f9ac['params']['id']}})[_0x7d8d('0x29')](function(){return _0x50be06;});}})['then'](respondWithStatusCode(_0x3a8200,null))[_0x7d8d('0x48')](handleError(_0x3a8200,null));};exports[_0x7d8d('0x8f')]=function(_0x29ceb5,_0x397210,_0x39aab8){var _0x1c091d={};var _0x4d2260={};var _0x4ce309;var _0x18b841;return db['Campaign']['findOne']({'where':{'id':_0x29ceb5['params']['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x397210,null))[_0x7d8d('0x29')](function(_0x4ad530){if(_0x4ad530){_0x4ce309=_0x4ad530;_0x4d2260[_0x7d8d('0x34')]=_[_0x7d8d('0x30')](db['CmList'][_0x7d8d('0x4b')]);_0x4d2260[_0x7d8d('0x31')]=_[_0x7d8d('0x30')](_0x29ceb5[_0x7d8d('0x31')]);_0x4d2260['filters']=_[_0x7d8d('0x33')](_0x4d2260[_0x7d8d('0x34')],_0x4d2260[_0x7d8d('0x31')]);_0x1c091d[_0x7d8d('0x36')]=_['intersection'](_0x4d2260[_0x7d8d('0x34')],qs[_0x7d8d('0x35')](_0x29ceb5[_0x7d8d('0x31')][_0x7d8d('0x35')]));_0x1c091d[_0x7d8d('0x36')]=_0x1c091d[_0x7d8d('0x36')][_0x7d8d('0x37')]?_0x1c091d['attributes']:_0x4d2260[_0x7d8d('0x34')];_0x1c091d['order']=qs[_0x7d8d('0x3b')](_0x29ceb5[_0x7d8d('0x31')][_0x7d8d('0x3b')]);_0x1c091d['where']=qs[_0x7d8d('0x32')](_[_0x7d8d('0x3c')](_0x29ceb5[_0x7d8d('0x31')],_0x4d2260[_0x7d8d('0x32')]));if(_0x29ceb5['query'][_0x7d8d('0x3d')]){_0x1c091d[_0x7d8d('0x3e')]=_[_0x7d8d('0x3f')](_0x1c091d[_0x7d8d('0x3e')],{'$or':_[_0x7d8d('0x2d')](_0x1c091d['attributes'],function(_0xb48472){var _0x572dc4={};_0x572dc4[_0xb48472]={'$like':'%'+_0x29ceb5['query'][_0x7d8d('0x3d')]+'%'};return _0x572dc4;})});}_0x1c091d=_['merge']({},_0x1c091d,_0x29ceb5['options']);return _0x4ce309[_0x7d8d('0x8f')](_0x1c091d);}})[_0x7d8d('0x29')](function(_0x19633a){if(_0x19633a){_0x18b841=_0x19633a['length'];if(!_0x29ceb5[_0x7d8d('0x31')][_0x7d8d('0x38')](_0x7d8d('0x39'))){_0x1c091d['limit']=qs[_0x7d8d('0x1d')](_0x29ceb5[_0x7d8d('0x31')][_0x7d8d('0x1d')]);_0x1c091d[_0x7d8d('0x1c')]=qs['offset'](_0x29ceb5['query'][_0x7d8d('0x1c')]);}return _0x4ce309[_0x7d8d('0x8f')](_0x1c091d);}})['then'](function(_0x3dd61c){if(_0x3dd61c){return _0x3dd61c?{'count':_0x18b841,'rows':_0x3dd61c}:null;}})['then'](respondWithResult(_0x397210,null))['catch'](handleError(_0x397210,null));};exports[_0x7d8d('0x90')]=function(_0x56c1f6,_0xf95020,_0x1d72f4){var _0x563722,_0x548085;var _0x5b3c47=[];var _0x31ff81=moment()[_0x7d8d('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x56c1f6[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0xf95020,null))[_0x7d8d('0x29')](function(_0x435dc3){if(_0x435dc3){_0x548085=_0x435dc3;return _0x435dc3[_0x7d8d('0x90')](_0x56c1f6[_0x7d8d('0x4e')]['ids'],_[_0x7d8d('0x57')](_0x56c1f6[_0x7d8d('0x4e')],['ids','id'])||{});}return null;})['spread'](function(_0x3cf4ac){var _0x2716d2;var _0x24d10b;_0x563722=_0x3cf4ac||[];var _0x5da833=[];if(_0x3cf4ac){for(var _0x16e02c=0x0;_0x16e02c<_0x3cf4ac['length'];_0x16e02c+=0x1){var _0x45c8f6=_0x3cf4ac[_0x16e02c][_0x7d8d('0x26')]({'plain':!![]});_0x2716d2=squel[_0x7d8d('0x6a')]()[_0x7d8d('0x80')](_0x7d8d('0x91'))[_0x7d8d('0x6c')](['phone','ContactId',_0x7d8d('0x6f'),_0x7d8d('0x5c'),_0x7d8d('0x58'),_0x7d8d('0x56')],squel[_0x7d8d('0x70')]()[_0x7d8d('0x71')](_0x7d8d('0x72'),_0x7d8d('0x72'))['field']('id',_0x7d8d('0x6e'))['field'](_0x45c8f6[_0x7d8d('0x73')][_0x7d8d('0x74')](),_0x7d8d('0x6f'))[_0x7d8d('0x71')](_0x56c1f6[_0x7d8d('0x4a')]['id'][_0x7d8d('0x74')](),'CampaignId')[_0x7d8d('0x71')](_0x7d8d('0x84'),_0x7d8d('0x58'))[_0x7d8d('0x71')](_0x7d8d('0x84'),_0x7d8d('0x56'))[_0x7d8d('0x7b')]('cm_contacts')['where'](_0x7d8d('0x76'))[_0x7d8d('0x3e')](_0x7d8d('0x77'),_0x45c8f6[_0x7d8d('0x73')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7d8d('0x74')]();_0x5da833[_0x7d8d('0x8b')](db[_0x7d8d('0x8c')][_0x7d8d('0x31')](_0x2716d2));}return BPromise['all'](_0x5da833);}})[_0x7d8d('0x29')](function(){return _0x563722;})[_0x7d8d('0x29')](respondWithResult(_0xf95020,null))['catch'](handleError(_0xf95020,null));};exports[_0x7d8d('0x92')]=function(_0x3c372d,_0x4ab199,_0xf03039){return db[_0x7d8d('0x45')][_0x7d8d('0x4c')]({'where':{'id':_0x3c372d['params']['id']}})[_0x7d8d('0x29')](handleEntityNotFound(_0x4ab199,null))[_0x7d8d('0x29')](function(_0x3f4a1a){if(_0x3f4a1a){return _0x3f4a1a[_0x7d8d('0x92')](_0x3c372d[_0x7d8d('0x31')][_0x7d8d('0x66')]);}})[_0x7d8d('0x29')](function(_0x45af20){if(_0x45af20){return db[_0x7d8d('0x61')][_0x7d8d('0x25')]({'where':{'ListId':_0x3c372d[_0x7d8d('0x31')]['ids'],'CampaignId':_0x3c372d[_0x7d8d('0x4a')]['id']}})['then'](function(){return _0x45af20;});}})[_0x7d8d('0x29')](respondWithStatusCode(_0x4ab199,null))[_0x7d8d('0x48')](handleError(_0x4ab199,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d808de3..a1dd53c 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x332e43,_0x252844){var _0x13bee3=function(_0x28c39a){while(--_0x28c39a){_0x332e43['push'](_0x332e43['shift']());}};_0x13bee3(++_0x252844);}(_0x7a54,0x106));var _0x47a5=function(_0x533a99,_0x6c29c4){_0x533a99=_0x533a99-0x0;var _0x29eb5c=_0x7a54[_0x533a99];return _0x29eb5c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2880bb,_0x37ccf5){var _0x357881=function(_0x50e47a){while(--_0x50e47a){_0x2880bb['push'](_0x2880bb['shift']());}};_0x357881(++_0x37ccf5);}(_0x7a54,0x106));var _0x47a5=function(_0xddca0c,_0x1f239d){_0xddca0c=_0xddca0c-0x0;var _0x333b2f=_0x7a54[_0xddca0c];return _0x333b2f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c6691ec..8a73335 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 _0x4a3d=['jayson/promise','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Campaign','findAll','options','raw','attributes','include','map','model','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x315d14,_0x38a4a0){var _0x4952c4=function(_0x9f2719){while(--_0x9f2719){_0x315d14['push'](_0x315d14['shift']());}};_0x4952c4(++_0x38a4a0);}(_0x4a3d,0x79));var _0xd4a3=function(_0x1fde90,_0x1a79d0){_0x1fde90=_0x1fde90-0x0;var _0x449f15=_0x4a3d[_0x1fde90];return _0x449f15;};'use strict';var _=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var moment=require(_0xd4a3('0x2'));var BPromise=require(_0xd4a3('0x3'));var rs=require(_0xd4a3('0x4'));var fs=require('fs');var Redis=require(_0xd4a3('0x5'));var db=require(_0xd4a3('0x6'))['db'];var utils=require(_0xd4a3('0x7'));var logger=require(_0xd4a3('0x8'))(_0xd4a3('0x9'));var config=require(_0xd4a3('0xa'));var jayson=require(_0xd4a3('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2449da,_0x45baf1,_0x5910aa){return new BPromise(function(_0x490bc1,_0x33c34b){return client[_0xd4a3('0xc')](_0x2449da,_0x5910aa)[_0xd4a3('0xd')](function(_0x128d6c){logger[_0xd4a3('0xe')](_0xd4a3('0xf'),_0x45baf1,_0xd4a3('0x10'));logger[_0xd4a3('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x45baf1,_0xd4a3('0x10'),JSON[_0xd4a3('0x12')](_0x128d6c));if(_0x128d6c[_0xd4a3('0x13')]){if(_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x14')]===0x1f4){logger[_0xd4a3('0x13')](_0xd4a3('0xf'),_0x45baf1,_0x128d6c['error'][_0xd4a3('0x15')]);return _0x33c34b(_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x15')]);}logger[_0xd4a3('0x13')](_0xd4a3('0xf'),_0x45baf1,_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x15')]);return _0x490bc1(_0x128d6c[_0xd4a3('0x13')]['message']);}else{logger['info'](_0xd4a3('0xf'),_0x45baf1,_0xd4a3('0x10'));_0x490bc1(_0x128d6c[_0xd4a3('0x16')][_0xd4a3('0x15')]);}})[_0xd4a3('0x17')](function(_0x454361){logger['error'](_0xd4a3('0xf'),_0x45baf1,_0x454361);_0x33c34b(_0x454361);});});}exports['GetCampaign']=function(_0xf9fc3c){var _0x592077=this;return new Promise(function(_0x21fa36,_0x4b8850){return db[_0xd4a3('0x18')][_0xd4a3('0x19')]({'raw':_0xf9fc3c['options']?_0xf9fc3c[_0xd4a3('0x1a')][_0xd4a3('0x1b')]===undefined?!![]:![]:!![],'where':_0xf9fc3c[_0xd4a3('0x1a')]?_0xf9fc3c['options']['where']||null:null,'attributes':_0xf9fc3c[_0xd4a3('0x1a')]?_0xf9fc3c['options'][_0xd4a3('0x1c')]||null:null,'limit':_0xf9fc3c[_0xd4a3('0x1a')]?_0xf9fc3c['options']['limit']||null:null,'include':_0xf9fc3c['options']?_0xf9fc3c[_0xd4a3('0x1a')][_0xd4a3('0x1d')]?_[_0xd4a3('0x1e')](_0xf9fc3c['options'][_0xd4a3('0x1d')],function(_0x137bba){return{'model':db[_0x137bba[_0xd4a3('0x1f')]],'as':_0x137bba['as'],'attributes':_0x137bba[_0xd4a3('0x1c')],'include':_0x137bba[_0xd4a3('0x1d')]?_[_0xd4a3('0x1e')](_0x137bba['include'],function(_0x35a871){return{'model':db[_0x35a871[_0xd4a3('0x1f')]],'as':_0x35a871['as'],'attributes':_0x35a871['attributes'],'include':_0x35a871[_0xd4a3('0x1d')]?_[_0xd4a3('0x1e')](_0x35a871[_0xd4a3('0x1d')],function(_0x4ce98a){return{'model':db[_0x4ce98a[_0xd4a3('0x1f')]],'as':_0x4ce98a['as'],'attributes':_0x4ce98a[_0xd4a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4a3('0xd')](function(_0x586cd8){logger[_0xd4a3('0xe')]('GetCampaign',_0xf9fc3c);logger[_0xd4a3('0x11')]('GetCampaign',_0xf9fc3c,JSON[_0xd4a3('0x12')](_0x586cd8));_0x21fa36(_0x586cd8);})['catch'](function(_0x2769b7){logger['error'](_0xd4a3('0x20'),_0x2769b7['message'],_0xf9fc3c);_0x4b8850(_0x592077[_0xd4a3('0x13')](0x1f4,_0x2769b7[_0xd4a3('0x15')]));});});}; \ No newline at end of file +var _0x280f=['error','code','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x280f,0xe2));var _0xf280=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x280f[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0xf280('0x0'));var util=require('util');var moment=require(_0xf280('0x1'));var BPromise=require(_0xf280('0x2'));var rs=require(_0xf280('0x3'));var fs=require('fs');var Redis=require(_0xf280('0x4'));var db=require(_0xf280('0x5'))['db'];var utils=require(_0xf280('0x6'));var logger=require(_0xf280('0x7'))('rpc');var config=require(_0xf280('0x8'));var jayson=require(_0xf280('0x9'));var client=jayson[_0xf280('0xa')][_0xf280('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3454e8,_0x49d0df,_0x3de766){return new BPromise(function(_0x4392c5,_0x1a090d){return client[_0xf280('0xc')](_0x3454e8,_0x3de766)[_0xf280('0xd')](function(_0x370566){logger['info'](_0xf280('0xe'),_0x49d0df,_0xf280('0xf'));logger[_0xf280('0x10')](_0xf280('0x11'),_0x49d0df,_0xf280('0xf'),JSON[_0xf280('0x12')](_0x370566));if(_0x370566[_0xf280('0x13')]){if(_0x370566[_0xf280('0x13')][_0xf280('0x14')]===0x1f4){logger[_0xf280('0x13')](_0xf280('0xe'),_0x49d0df,_0x370566['error'][_0xf280('0x15')]);return _0x1a090d(_0x370566[_0xf280('0x13')][_0xf280('0x15')]);}logger[_0xf280('0x13')](_0xf280('0xe'),_0x49d0df,_0x370566[_0xf280('0x13')]['message']);return _0x4392c5(_0x370566[_0xf280('0x13')][_0xf280('0x15')]);}else{logger[_0xf280('0x16')](_0xf280('0xe'),_0x49d0df,_0xf280('0xf'));_0x4392c5(_0x370566[_0xf280('0x17')][_0xf280('0x15')]);}})['catch'](function(_0x487efc){logger['error'](_0xf280('0xe'),_0x49d0df,_0x487efc);_0x1a090d(_0x487efc);});});}exports['GetCampaign']=function(_0x11c2b0){var _0x57cd66=this;return new Promise(function(_0x2a19e7,_0x464a5f){return db['Campaign'][_0xf280('0x18')]({'raw':_0x11c2b0['options']?_0x11c2b0[_0xf280('0x19')][_0xf280('0x1a')]===undefined?!![]:![]:!![],'where':_0x11c2b0[_0xf280('0x19')]?_0x11c2b0[_0xf280('0x19')][_0xf280('0x1b')]||null:null,'attributes':_0x11c2b0[_0xf280('0x19')]?_0x11c2b0[_0xf280('0x19')][_0xf280('0x1c')]||null:null,'limit':_0x11c2b0[_0xf280('0x19')]?_0x11c2b0['options'][_0xf280('0x1d')]||null:null,'include':_0x11c2b0[_0xf280('0x19')]?_0x11c2b0[_0xf280('0x19')][_0xf280('0x1e')]?_[_0xf280('0x1f')](_0x11c2b0[_0xf280('0x19')][_0xf280('0x1e')],function(_0x42020c){return{'model':db[_0x42020c['model']],'as':_0x42020c['as'],'attributes':_0x42020c[_0xf280('0x1c')],'include':_0x42020c[_0xf280('0x1e')]?_[_0xf280('0x1f')](_0x42020c[_0xf280('0x1e')],function(_0x35cd2d){return{'model':db[_0x35cd2d[_0xf280('0x20')]],'as':_0x35cd2d['as'],'attributes':_0x35cd2d[_0xf280('0x1c')],'include':_0x35cd2d[_0xf280('0x1e')]?_['map'](_0x35cd2d[_0xf280('0x1e')],function(_0x1b21fb){return{'model':db[_0x1b21fb[_0xf280('0x20')]],'as':_0x1b21fb['as'],'attributes':_0x1b21fb[_0xf280('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5433c2){logger['info']('GetCampaign',_0x11c2b0);logger['debug'](_0xf280('0x21'),_0x11c2b0,JSON[_0xf280('0x12')](_0x5433c2));_0x2a19e7(_0x5433c2);})[_0xf280('0x22')](function(_0x34edaf){logger['error'](_0xf280('0x21'),_0x34edaf['message'],_0x11c2b0);_0x464a5f(_0x57cd66[_0xf280('0x13')](0x1f4,_0x34edaf[_0xf280('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f1d3718..9799ed4 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 _0xef60=['index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','put','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xef60,0xa0));var _0x0ef6=function(_0x2286a8,_0x5d1dbb){_0x2286a8=_0x2286a8-0x0;var _0x82a3ba=_0xef60[_0x2286a8];return _0x82a3ba;};'use strict';var multer=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var path=require(_0x0ef6('0x2'));var timeout=require(_0x0ef6('0x3'));var express=require(_0x0ef6('0x4'));var router=express[_0x0ef6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0ef6('0x6'));var interaction=require(_0x0ef6('0x7'));var config=require('../../config/environment');var controller=require(_0x0ef6('0x8'));router[_0x0ef6('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ef6('0xa')]);router[_0x0ef6('0x9')](_0x0ef6('0xb'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0xd')]);router[_0x0ef6('0x9')](_0x0ef6('0xe'),auth['isAuthenticated'](),controller[_0x0ef6('0xf')]);router[_0x0ef6('0x9')](_0x0ef6('0x10'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x11')]);router[_0x0ef6('0x9')]('/:id/hopper_finals',auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x12')]);router[_0x0ef6('0x9')]('/:id/hopper_black',auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x13')]);router[_0x0ef6('0x9')](_0x0ef6('0x14'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x15')]);router[_0x0ef6('0x9')]('/:id/blacklists',auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x16')]);router['post']('/',auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x17')]);router[_0x0ef6('0x18')](_0x0ef6('0x19'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x1a')]);router[_0x0ef6('0x18')](_0x0ef6('0x14'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x1b')]);router[_0x0ef6('0x18')](_0x0ef6('0x1c'),auth[_0x0ef6('0xc')](),controller['addBlackLists']);router[_0x0ef6('0x1d')](_0x0ef6('0xb'),auth[_0x0ef6('0xc')](),controller['update']);router[_0x0ef6('0x1e')](_0x0ef6('0xb'),auth['isAuthenticated'](),controller[_0x0ef6('0x1f')]);router[_0x0ef6('0x1e')](_0x0ef6('0x14'),auth[_0x0ef6('0xc')](),controller['removeLists']);router[_0x0ef6('0x1e')](_0x0ef6('0x1c'),auth[_0x0ef6('0xc')](),controller[_0x0ef6('0x20')]);module[_0x0ef6('0x21')]=router; \ No newline at end of file +var _0x9f7e=['isAuthenticated','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','util','express','fs-extra','../../components/auth/service','get'];(function(_0x62cfe,_0x894025){var _0x3ecfda=function(_0x3169d0){while(--_0x3169d0){_0x62cfe['push'](_0x62cfe['shift']());}};_0x3ecfda(++_0x894025);}(_0x9f7e,0x19f));var _0xe9f7=function(_0x33e155,_0x393294){_0x33e155=_0x33e155-0x0;var _0x4b74f6=_0x9f7e[_0x33e155];return _0x4b74f6;};'use strict';var multer=require('multer');var util=require(_0xe9f7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe9f7('0x1'));var router=express['Router']();var fs_extra=require(_0xe9f7('0x2'));var auth=require(_0xe9f7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xe9f7('0x4')]('/',auth[_0xe9f7('0x5')](),controller['index']);router['get'](_0xe9f7('0x6'),auth[_0xe9f7('0x5')](),controller['show']);router[_0xe9f7('0x4')](_0xe9f7('0x7'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0x8')]);router[_0xe9f7('0x4')](_0xe9f7('0x9'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0xa')]);router[_0xe9f7('0x4')](_0xe9f7('0xb'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0xc')]);router['get'](_0xe9f7('0xd'),auth['isAuthenticated'](),controller[_0xe9f7('0xe')]);router[_0xe9f7('0x4')](_0xe9f7('0xf'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0x10')]);router[_0xe9f7('0x4')](_0xe9f7('0x11'),auth[_0xe9f7('0x5')](),controller['getBlackLists']);router[_0xe9f7('0x12')]('/',auth['isAuthenticated'](),controller[_0xe9f7('0x13')]);router[_0xe9f7('0x12')](_0xe9f7('0x14'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0x15')]);router[_0xe9f7('0x12')](_0xe9f7('0xf'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0x16')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe9f7('0x17')]);router[_0xe9f7('0x18')](_0xe9f7('0x6'),auth[_0xe9f7('0x5')](),controller[_0xe9f7('0x19')]);router[_0xe9f7('0x1a')](_0xe9f7('0x6'),auth['isAuthenticated'](),controller[_0xe9f7('0x1b')]);router[_0xe9f7('0x1a')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0xe9f7('0x1a')](_0xe9f7('0x11'),auth['isAuthenticated'](),controller[_0xe9f7('0x1c')]);module[_0xe9f7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6b9f246..f7f08da 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 _0x9c50=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x2f8fa6,_0x259848){var _0x4a4cf8=function(_0x4ed910){while(--_0x4ed910){_0x2f8fa6['push'](_0x2f8fa6['shift']());}};_0x4a4cf8(++_0x259848);}(_0x9c50,0xf5));var _0x09c5=function(_0xb27b00,_0x3c854b){_0xb27b00=_0xb27b00-0x0;var _0xd139f0=_0x9c50[_0xb27b00];return _0xd139f0;};'use strict';var Sequelize=require(_0x09c5('0x0'));module['exports']={'key':{'type':Sequelize[_0x09c5('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x09c5('0x1')]},'name':{'type':Sequelize[_0x09c5('0x2')],'get':function(){return this[_0x09c5('0x3')]('key');}}}; \ No newline at end of file +var _0x728d=['STRING','medium','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x1dcda8,_0x17428a){var _0x4070f8=function(_0x1e904c){while(--_0x1e904c){_0x1dcda8['push'](_0x1dcda8['shift']());}};_0x4070f8(++_0x17428a);}(_0x728d,0x124));var _0xd728=function(_0x5185c6,_0x4e7c65){_0x5185c6=_0x5185c6-0x0;var _0x1a9c19=_0x728d[_0x5185c6];return _0x1a9c19;};'use strict';var Sequelize=require(_0xd728('0x0'));module[_0xd728('0x1')]={'key':{'type':Sequelize[_0xd728('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xd728('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd728('0x4')],'get':function(){return this[_0xd728('0x5')](_0xd728('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5d9eb6f..f689500 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 _0xf3fc=['fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','show','params','includeAll','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','model','query','keys','intersection','attributes'];(function(_0x75cc31,_0x21bdbe){var _0x3eefa7=function(_0x125e39){while(--_0x125e39){_0x75cc31['push'](_0x75cc31['shift']());}};_0x3eefa7(++_0x21bdbe);}(_0xf3fc,0x128));var _0xcf3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf3fc[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xcf3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf3f('0x1'));var jsonpatch=require(_0xcf3f('0x2'));var rp=require(_0xcf3f('0x3'));var moment=require(_0xcf3f('0x4'));var BPromise=require(_0xcf3f('0x5'));var Mustache=require(_0xcf3f('0x6'));var util=require(_0xcf3f('0x7'));var path=require('path');var sox=require(_0xcf3f('0x8'));var csv=require(_0xcf3f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf3f('0xa'));var _=require(_0xcf3f('0xb'));var squel=require('squel');var crypto=require(_0xcf3f('0xc'));var jsforce=require(_0xcf3f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf3f('0xe'));var Redis=require(_0xcf3f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcf3f('0x10'));var as=require(_0xcf3f('0x11'));var hardwareService=require(_0xcf3f('0x12'));var logger=require(_0xcf3f('0x13'))(_0xcf3f('0x14'));var utils=require('../../config/utils');var config=require(_0xcf3f('0x15'));var licenseUtil=require(_0xcf3f('0x16'));var db=require(_0xcf3f('0x17'))['db'];function respondWithStatusCode(_0x4baf2c,_0x3c0dc8){_0x3c0dc8=_0x3c0dc8||0xcc;return function(_0x1b4bb0){if(_0x1b4bb0){return _0x4baf2c[_0xcf3f('0x18')](_0x3c0dc8);}return _0x4baf2c[_0xcf3f('0x19')](_0x3c0dc8)[_0xcf3f('0x1a')]();};}function respondWithResult(_0x9f69a0,_0xde5fbf){_0xde5fbf=_0xde5fbf||0xc8;return function(_0x16216c){if(_0x16216c){return _0x9f69a0[_0xcf3f('0x19')](_0xde5fbf)[_0xcf3f('0x1b')](_0x16216c);}};}function respondWithFilteredResult(_0x59a0e1,_0x320275){return function(_0x5a8f36){if(_0x5a8f36){var _0x213fd8=typeof _0x320275[_0xcf3f('0x1c')]===_0xcf3f('0x1d')&&typeof _0x320275[_0xcf3f('0x1e')]===_0xcf3f('0x1d');var _0x4d5ed4=_0x5a8f36['count'];var _0x59c2d6=_0x213fd8?0x0:_0x320275[_0xcf3f('0x1c')];var _0x48733a=_0x213fd8?_0x5a8f36[_0xcf3f('0x1f')]:_0x320275[_0xcf3f('0x1c')]+_0x320275[_0xcf3f('0x1e')];var _0x430c18;if(_0x48733a>=_0x4d5ed4){_0x48733a=_0x4d5ed4;_0x430c18=0xc8;}else{_0x430c18=0xce;}_0x59a0e1[_0xcf3f('0x19')](_0x430c18);return _0x59a0e1[_0xcf3f('0x20')](_0xcf3f('0x21'),_0x59c2d6+'-'+_0x48733a+'/'+_0x4d5ed4)[_0xcf3f('0x1b')](_0x5a8f36);}return null;};}function patchUpdates(_0xab4fb1){return function(_0x36b117){try{jsonpatch[_0xcf3f('0x22')](_0x36b117,_0xab4fb1,!![]);}catch(_0xa8bb41){return BPromise[_0xcf3f('0x23')](_0xa8bb41);}return _0x36b117['save']();};}function saveUpdates(_0x453ff2,_0x474daf){return function(_0xf52d2e){if(_0xf52d2e){return _0xf52d2e['update'](_0x453ff2)[_0xcf3f('0x24')](function(_0x498c9b){return _0x498c9b;});}return null;};}function removeEntity(_0x2787f1,_0x58c567){return function(_0x12fbd2){if(_0x12fbd2){return _0x12fbd2[_0xcf3f('0x25')]()['then'](function(){var _0xb4fa94=_0x12fbd2['get']({'plain':!![]});var _0x1306d8='CannedAnswers';return db[_0xcf3f('0x26')][_0xcf3f('0x25')]({'where':{'type':_0x1306d8,'resourceId':_0xb4fa94['id']}})[_0xcf3f('0x24')](function(){return _0x12fbd2;});})[_0xcf3f('0x24')](function(){_0x2787f1[_0xcf3f('0x19')](0xcc)[_0xcf3f('0x1a')]();});}};}function handleEntityNotFound(_0x42adeb,_0x2e51e7){return function(_0x3d5f27){if(!_0x3d5f27){_0x42adeb[_0xcf3f('0x18')](0x194);}return _0x3d5f27;};}function handleError(_0x2807b9,_0x338ea6){_0x338ea6=_0x338ea6||0x1f4;return function(_0x1f26ff){logger[_0xcf3f('0x27')](_0x1f26ff[_0xcf3f('0x28')]);if(_0x1f26ff[_0xcf3f('0x29')]){delete _0x1f26ff[_0xcf3f('0x29')];}_0x2807b9[_0xcf3f('0x19')](_0x338ea6)[_0xcf3f('0x2a')](_0x1f26ff);};}exports[_0xcf3f('0x2b')]=function(_0x49c043,_0x4e3bae){var _0x359baa={},_0x46b26f={},_0x5b2ec6={'count':0x0,'rows':[]};var _0xa2a9b=_[_0xcf3f('0x2c')](db[_0xcf3f('0x2d')][_0xcf3f('0x2e')],function(_0x322cea){return{'name':_0x322cea['fieldName'],'type':_0x322cea['type']['key']};});_0x46b26f[_0xcf3f('0x2f')]=_['map'](_0xa2a9b,'name');_0x46b26f[_0xcf3f('0x30')]=_[_0xcf3f('0x31')](_0x49c043[_0xcf3f('0x30')]);_0x46b26f['filters']=_[_0xcf3f('0x32')](_0x46b26f['model'],_0x46b26f[_0xcf3f('0x30')]);_0x359baa[_0xcf3f('0x33')]=_[_0xcf3f('0x32')](_0x46b26f[_0xcf3f('0x2f')],qs[_0xcf3f('0x34')](_0x49c043['query'][_0xcf3f('0x34')]));_0x359baa[_0xcf3f('0x33')]=_0x359baa[_0xcf3f('0x33')]['length']?_0x359baa[_0xcf3f('0x33')]:_0x46b26f[_0xcf3f('0x2f')];if(!_0x49c043['query'][_0xcf3f('0x35')](_0xcf3f('0x36'))){_0x359baa[_0xcf3f('0x1e')]=qs[_0xcf3f('0x1e')](_0x49c043[_0xcf3f('0x30')][_0xcf3f('0x1e')]);_0x359baa[_0xcf3f('0x1c')]=qs[_0xcf3f('0x1c')](_0x49c043[_0xcf3f('0x30')][_0xcf3f('0x1c')]);}_0x359baa[_0xcf3f('0x37')]=qs[_0xcf3f('0x38')](_0x49c043[_0xcf3f('0x30')][_0xcf3f('0x38')]);_0x359baa[_0xcf3f('0x39')]=qs[_0xcf3f('0x3a')](_[_0xcf3f('0x3b')](_0x49c043[_0xcf3f('0x30')],_0x46b26f[_0xcf3f('0x3a')]),_0xa2a9b);if(_0x49c043[_0xcf3f('0x30')][_0xcf3f('0x3c')]){_0x359baa[_0xcf3f('0x39')]=_[_0xcf3f('0x3d')](_0x359baa['where'],{'$or':[{'key':{'$like':'%'+_0x49c043['query'][_0xcf3f('0x3c')]+'%'}},{'value':{'$like':'%'+_0x49c043[_0xcf3f('0x30')][_0xcf3f('0x3c')]+'%'}}]});}_0x359baa=_[_0xcf3f('0x3d')]({},_0x359baa,_0x49c043[_0xcf3f('0x3e')]);var _0x1d57aa={'where':_0x359baa[_0xcf3f('0x39')]};return db[_0xcf3f('0x2d')][_0xcf3f('0x1f')](_0x1d57aa)['then'](function(_0x5b44b7){_0x5b2ec6[_0xcf3f('0x1f')]=_0x5b44b7;if(_0x49c043[_0xcf3f('0x30')]['includeAll']){_0x359baa[_0xcf3f('0x3f')]=[{'all':!![]}];}return db[_0xcf3f('0x2d')][_0xcf3f('0x40')](_0x359baa);})[_0xcf3f('0x24')](function(_0x2a5ce8){_0x5b2ec6['rows']=_0x2a5ce8;return _0x5b2ec6;})[_0xcf3f('0x24')](respondWithFilteredResult(_0x4e3bae,_0x359baa))['catch'](handleError(_0x4e3bae,null));};exports[_0xcf3f('0x41')]=function(_0x522015,_0x479dad){var _0x202bd8={'raw':!![],'where':{'id':_0x522015[_0xcf3f('0x42')]['id']}},_0x2e3ce8={};_0x2e3ce8[_0xcf3f('0x2f')]=_['keys'](db[_0xcf3f('0x2d')]['rawAttributes']);_0x2e3ce8['query']=_[_0xcf3f('0x31')](_0x522015['query']);_0x2e3ce8[_0xcf3f('0x3a')]=_[_0xcf3f('0x32')](_0x2e3ce8[_0xcf3f('0x2f')],_0x2e3ce8['query']);_0x202bd8[_0xcf3f('0x33')]=_[_0xcf3f('0x32')](_0x2e3ce8[_0xcf3f('0x2f')],qs[_0xcf3f('0x34')](_0x522015[_0xcf3f('0x30')][_0xcf3f('0x34')]));_0x202bd8[_0xcf3f('0x33')]=_0x202bd8['attributes']['length']?_0x202bd8['attributes']:_0x2e3ce8[_0xcf3f('0x2f')];if(_0x522015[_0xcf3f('0x30')][_0xcf3f('0x43')]){_0x202bd8['include']=[{'all':!![]}];}_0x202bd8=_['merge']({},_0x202bd8,_0x522015[_0xcf3f('0x3e')]);return db[_0xcf3f('0x2d')][_0xcf3f('0x44')](_0x202bd8)[_0xcf3f('0x24')](handleEntityNotFound(_0x479dad,null))[_0xcf3f('0x24')](respondWithResult(_0x479dad,null))[_0xcf3f('0x45')](handleError(_0x479dad,null));};exports[_0xcf3f('0x46')]=function(_0x12901d,_0x1dc922){if(_0x12901d[_0xcf3f('0x47')]['id']){delete _0x12901d[_0xcf3f('0x47')]['id'];}return db['CannedAnswer'][_0xcf3f('0x44')]({'where':{'id':_0x12901d[_0xcf3f('0x42')]['id']}})[_0xcf3f('0x24')](handleEntityNotFound(_0x1dc922,null))[_0xcf3f('0x24')](saveUpdates(_0x12901d[_0xcf3f('0x47')],null))['then'](respondWithResult(_0x1dc922,null))['catch'](handleError(_0x1dc922,null));};exports[_0xcf3f('0x25')]=function(_0x12fbdb,_0x3effd5){return db[_0xcf3f('0x2d')]['find']({'where':{'id':_0x12fbdb['params']['id']}})['then'](handleEntityNotFound(_0x3effd5,null))['then'](removeEntity(_0x3effd5,null))[_0xcf3f('0x45')](handleError(_0x3effd5,null));};exports[_0xcf3f('0x48')]=function(_0x50c420,_0x27dc3c){var _0x4bd04d={'key':_0x50c420[_0xcf3f('0x47')][_0xcf3f('0x49')]};if(_0x50c420[_0xcf3f('0x47')]['MailAccountId']){_0x4bd04d[_0xcf3f('0x4a')]=_0x50c420['body'][_0xcf3f('0x4a')];}else if(_0x50c420[_0xcf3f('0x47')]['SmsAccountId']){_0x4bd04d[_0xcf3f('0x4b')]=_0x50c420[_0xcf3f('0x47')][_0xcf3f('0x4b')];}else if(_0x50c420[_0xcf3f('0x47')][_0xcf3f('0x4c')]){_0x4bd04d[_0xcf3f('0x4c')]=_0x50c420[_0xcf3f('0x47')][_0xcf3f('0x4c')];}else if(_0x50c420['body']['ChatWebsiteId']){_0x4bd04d[_0xcf3f('0x4d')]=_0x50c420['body'][_0xcf3f('0x4d')];}return db[_0xcf3f('0x2d')]['find']({'where':_0x4bd04d})['then'](function(_0x1566cc){if(_0x1566cc){throw new db['Sequelize'][(_0xcf3f('0x4e'))](_0xcf3f('0x4f'));}return db[_0xcf3f('0x2d')][_0xcf3f('0x48')](_0x50c420['body']);})[_0xcf3f('0x24')](function(_0x526032){var _0x501932=_0x50c420[_0xcf3f('0x50')][_0xcf3f('0x51')]({'plain':!![]});if(!_0x501932)throw new Error(_0xcf3f('0x52'));if(_0x501932[_0xcf3f('0x53')]==='user'){var _0x101e4c=_0x526032['get']({'plain':!![]});return db[_0xcf3f('0x54')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x501932[_0xcf3f('0x55')]},'raw':!![]})[_0xcf3f('0x24')](function(_0x22f850){if(_0x22f850&&_0x22f850[_0xcf3f('0x56')]===0x0){return db[_0xcf3f('0x26')]['create']({'name':_0x101e4c[_0xcf3f('0x29')],'resourceId':_0x101e4c['id'],'type':_0x22f850[_0xcf3f('0x29')],'sectionId':_0x22f850['id']},{})[_0xcf3f('0x24')](function(){return _0x526032;});}else{return _0x526032;}})[_0xcf3f('0x45')](function(_0x8f2dc2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8f2dc2);throw _0x8f2dc2;});}return _0x526032;})[_0xcf3f('0x24')](respondWithResult(_0x27dc3c,0xc9))[_0xcf3f('0x45')](handleError(_0x27dc3c,null));}; \ No newline at end of file +var _0x4f4c=['count','set','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','keys','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x31f29c,_0x188af2){var _0x4b6325=function(_0x55a175){while(--_0x55a175){_0x31f29c['push'](_0x31f29c['shift']());}};_0x4b6325(++_0x188af2);}(_0x4f4c,0x187));var _0xc4f4=function(_0x4d27a5,_0x66274c){_0x4d27a5=_0x4d27a5-0x0;var _0x1a97dd=_0x4f4c[_0x4d27a5];return _0x1a97dd;};'use strict';var emlformat=require(_0xc4f4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc4f4('0x1'));var rp=require('request-promise');var moment=require(_0xc4f4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc4f4('0x3'));var util=require('util');var path=require(_0xc4f4('0x4'));var sox=require(_0xc4f4('0x5'));var csv=require(_0xc4f4('0x6'));var ejs=require(_0xc4f4('0x7'));var fs=require('fs');var fs_extra=require(_0xc4f4('0x8'));var _=require('lodash');var squel=require(_0xc4f4('0x9'));var crypto=require(_0xc4f4('0xa'));var jsforce=require(_0xc4f4('0xb'));var deskjs=require(_0xc4f4('0xc'));var toCsv=require(_0xc4f4('0x6'));var querystring=require('querystring');var Papa=require(_0xc4f4('0xd'));var Redis=require('ioredis');var authService=require(_0xc4f4('0xe'));var qs=require(_0xc4f4('0xf'));var as=require(_0xc4f4('0x10'));var hardwareService=require(_0xc4f4('0x11'));var logger=require(_0xc4f4('0x12'))(_0xc4f4('0x13'));var utils=require(_0xc4f4('0x14'));var config=require(_0xc4f4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4f4('0x16'))['db'];function respondWithStatusCode(_0x160fa4,_0x2d9cea){_0x2d9cea=_0x2d9cea||0xcc;return function(_0x32e962){if(_0x32e962){return _0x160fa4[_0xc4f4('0x17')](_0x2d9cea);}return _0x160fa4[_0xc4f4('0x18')](_0x2d9cea)['end']();};}function respondWithResult(_0x53bd54,_0x4b7020){_0x4b7020=_0x4b7020||0xc8;return function(_0x16a23f){if(_0x16a23f){return _0x53bd54[_0xc4f4('0x18')](_0x4b7020)[_0xc4f4('0x19')](_0x16a23f);}};}function respondWithFilteredResult(_0x30df9b,_0x3dbce0){return function(_0x166564){if(_0x166564){var _0x55766a=typeof _0x3dbce0[_0xc4f4('0x1a')]===_0xc4f4('0x1b')&&typeof _0x3dbce0[_0xc4f4('0x1c')]===_0xc4f4('0x1b');var _0x3713be=_0x166564['count'];var _0x4288c1=_0x55766a?0x0:_0x3dbce0['offset'];var _0x3da694=_0x55766a?_0x166564[_0xc4f4('0x1d')]:_0x3dbce0['offset']+_0x3dbce0[_0xc4f4('0x1c')];var _0x1a7ebd;if(_0x3da694>=_0x3713be){_0x3da694=_0x3713be;_0x1a7ebd=0xc8;}else{_0x1a7ebd=0xce;}_0x30df9b[_0xc4f4('0x18')](_0x1a7ebd);return _0x30df9b[_0xc4f4('0x1e')]('Content-Range',_0x4288c1+'-'+_0x3da694+'/'+_0x3713be)['json'](_0x166564);}return null;};}function patchUpdates(_0x52f56e){return function(_0x1451f2){try{jsonpatch[_0xc4f4('0x1f')](_0x1451f2,_0x52f56e,!![]);}catch(_0x17dbf0){return BPromise[_0xc4f4('0x20')](_0x17dbf0);}return _0x1451f2['save']();};}function saveUpdates(_0x443fbe,_0x5833fd){return function(_0x5367ae){if(_0x5367ae){return _0x5367ae[_0xc4f4('0x21')](_0x443fbe)[_0xc4f4('0x22')](function(_0x42fa8c){return _0x42fa8c;});}return null;};}function removeEntity(_0xdde817,_0x423db3){return function(_0x35a302){if(_0x35a302){return _0x35a302[_0xc4f4('0x23')]()[_0xc4f4('0x22')](function(){var _0x2e9684=_0x35a302[_0xc4f4('0x24')]({'plain':!![]});var _0xa49e58=_0xc4f4('0x25');return db[_0xc4f4('0x26')][_0xc4f4('0x23')]({'where':{'type':_0xa49e58,'resourceId':_0x2e9684['id']}})['then'](function(){return _0x35a302;});})['then'](function(){_0xdde817[_0xc4f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x72bc37,_0x685501){return function(_0x167fc1){if(!_0x167fc1){_0x72bc37['sendStatus'](0x194);}return _0x167fc1;};}function handleError(_0x38f8f0,_0xcfd066){_0xcfd066=_0xcfd066||0x1f4;return function(_0x1a4bd1){logger['error'](_0x1a4bd1['stack']);if(_0x1a4bd1['name']){delete _0x1a4bd1[_0xc4f4('0x27')];}_0x38f8f0[_0xc4f4('0x18')](_0xcfd066)[_0xc4f4('0x28')](_0x1a4bd1);};}exports['index']=function(_0x38a6b1,_0x3c2dae){var _0x580707={},_0x1fc15b={},_0x412d39={'count':0x0,'rows':[]};var _0x4bc4ac=_[_0xc4f4('0x29')](db[_0xc4f4('0x2a')][_0xc4f4('0x2b')],function(_0x35a7bc){return{'name':_0x35a7bc[_0xc4f4('0x2c')],'type':_0x35a7bc[_0xc4f4('0x2d')][_0xc4f4('0x2e')]};});_0x1fc15b[_0xc4f4('0x2f')]=_[_0xc4f4('0x29')](_0x4bc4ac,_0xc4f4('0x27'));_0x1fc15b[_0xc4f4('0x30')]=_['keys'](_0x38a6b1[_0xc4f4('0x30')]);_0x1fc15b[_0xc4f4('0x31')]=_['intersection'](_0x1fc15b['model'],_0x1fc15b['query']);_0x580707['attributes']=_[_0xc4f4('0x32')](_0x1fc15b[_0xc4f4('0x2f')],qs[_0xc4f4('0x33')](_0x38a6b1[_0xc4f4('0x30')]['fields']));_0x580707[_0xc4f4('0x34')]=_0x580707['attributes'][_0xc4f4('0x35')]?_0x580707[_0xc4f4('0x34')]:_0x1fc15b[_0xc4f4('0x2f')];if(!_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x36')](_0xc4f4('0x37'))){_0x580707['limit']=qs['limit'](_0x38a6b1['query'][_0xc4f4('0x1c')]);_0x580707[_0xc4f4('0x1a')]=qs[_0xc4f4('0x1a')](_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x1a')]);}_0x580707[_0xc4f4('0x38')]=qs['sort'](_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x39')]);_0x580707[_0xc4f4('0x3a')]=qs['filters'](_[_0xc4f4('0x3b')](_0x38a6b1[_0xc4f4('0x30')],_0x1fc15b['filters']),_0x4bc4ac);if(_0x38a6b1['query'][_0xc4f4('0x3c')]){_0x580707[_0xc4f4('0x3a')]=_['merge'](_0x580707['where'],{'$or':[{'key':{'$like':'%'+_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x3c')]+'%'}},{'value':{'$like':'%'+_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x3c')]+'%'}}]});}_0x580707=_[_0xc4f4('0x3d')]({},_0x580707,_0x38a6b1['options']);var _0xea494e={'where':_0x580707[_0xc4f4('0x3a')]};return db['CannedAnswer']['count'](_0xea494e)[_0xc4f4('0x22')](function(_0x262976){_0x412d39[_0xc4f4('0x1d')]=_0x262976;if(_0x38a6b1[_0xc4f4('0x30')][_0xc4f4('0x3e')]){_0x580707[_0xc4f4('0x3f')]=[{'all':!![]}];}return db[_0xc4f4('0x2a')]['findAll'](_0x580707);})[_0xc4f4('0x22')](function(_0x4fb50c){_0x412d39[_0xc4f4('0x40')]=_0x4fb50c;return _0x412d39;})['then'](respondWithFilteredResult(_0x3c2dae,_0x580707))[_0xc4f4('0x41')](handleError(_0x3c2dae,null));};exports['show']=function(_0x2f2344,_0x1425aa){var _0x35f358={'raw':!![],'where':{'id':_0x2f2344['params']['id']}},_0x1f53ac={};_0x1f53ac[_0xc4f4('0x2f')]=_[_0xc4f4('0x42')](db[_0xc4f4('0x2a')][_0xc4f4('0x2b')]);_0x1f53ac[_0xc4f4('0x30')]=_[_0xc4f4('0x42')](_0x2f2344[_0xc4f4('0x30')]);_0x1f53ac[_0xc4f4('0x31')]=_[_0xc4f4('0x32')](_0x1f53ac[_0xc4f4('0x2f')],_0x1f53ac[_0xc4f4('0x30')]);_0x35f358[_0xc4f4('0x34')]=_[_0xc4f4('0x32')](_0x1f53ac[_0xc4f4('0x2f')],qs[_0xc4f4('0x33')](_0x2f2344[_0xc4f4('0x30')][_0xc4f4('0x33')]));_0x35f358['attributes']=_0x35f358[_0xc4f4('0x34')][_0xc4f4('0x35')]?_0x35f358[_0xc4f4('0x34')]:_0x1f53ac[_0xc4f4('0x2f')];if(_0x2f2344[_0xc4f4('0x30')]['includeAll']){_0x35f358['include']=[{'all':!![]}];}_0x35f358=_[_0xc4f4('0x3d')]({},_0x35f358,_0x2f2344['options']);return db[_0xc4f4('0x2a')]['find'](_0x35f358)[_0xc4f4('0x22')](handleEntityNotFound(_0x1425aa,null))['then'](respondWithResult(_0x1425aa,null))['catch'](handleError(_0x1425aa,null));};exports[_0xc4f4('0x21')]=function(_0x190325,_0x29af59){if(_0x190325[_0xc4f4('0x43')]['id']){delete _0x190325[_0xc4f4('0x43')]['id'];}return db[_0xc4f4('0x2a')][_0xc4f4('0x44')]({'where':{'id':_0x190325[_0xc4f4('0x45')]['id']}})[_0xc4f4('0x22')](handleEntityNotFound(_0x29af59,null))[_0xc4f4('0x22')](saveUpdates(_0x190325[_0xc4f4('0x43')],null))[_0xc4f4('0x22')](respondWithResult(_0x29af59,null))[_0xc4f4('0x41')](handleError(_0x29af59,null));};exports[_0xc4f4('0x23')]=function(_0x239a44,_0x166de0){return db['CannedAnswer'][_0xc4f4('0x44')]({'where':{'id':_0x239a44[_0xc4f4('0x45')]['id']}})[_0xc4f4('0x22')](handleEntityNotFound(_0x166de0,null))['then'](removeEntity(_0x166de0,null))[_0xc4f4('0x41')](handleError(_0x166de0,null));};exports[_0xc4f4('0x46')]=function(_0x1ed4f3,_0x4a55d7){var _0x19f558={'key':_0x1ed4f3[_0xc4f4('0x43')][_0xc4f4('0x2e')]};if(_0x1ed4f3['body'][_0xc4f4('0x47')]){_0x19f558['MailAccountId']=_0x1ed4f3['body'][_0xc4f4('0x47')];}else if(_0x1ed4f3['body'][_0xc4f4('0x48')]){_0x19f558[_0xc4f4('0x48')]=_0x1ed4f3[_0xc4f4('0x43')][_0xc4f4('0x48')];}else if(_0x1ed4f3['body'][_0xc4f4('0x49')]){_0x19f558[_0xc4f4('0x49')]=_0x1ed4f3[_0xc4f4('0x43')][_0xc4f4('0x49')];}else if(_0x1ed4f3['body'][_0xc4f4('0x4a')]){_0x19f558['ChatWebsiteId']=_0x1ed4f3[_0xc4f4('0x43')][_0xc4f4('0x4a')];}return db['CannedAnswer']['find']({'where':_0x19f558})['then'](function(_0x736665){if(_0x736665){throw new db[(_0xc4f4('0x4b'))][(_0xc4f4('0x4c'))](_0xc4f4('0x4d'));}return db['CannedAnswer'][_0xc4f4('0x46')](_0x1ed4f3['body']);})[_0xc4f4('0x22')](function(_0x438ed0){var _0x1f6b62=_0x1ed4f3[_0xc4f4('0x4e')][_0xc4f4('0x24')]({'plain':!![]});if(!_0x1f6b62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f6b62[_0xc4f4('0x4f')]===_0xc4f4('0x4e')){var _0x5e5fec=_0x438ed0['get']({'plain':!![]});return db[_0xc4f4('0x50')][_0xc4f4('0x44')]({'where':{'name':_0xc4f4('0x25'),'userProfileId':_0x1f6b62['userProfileId']},'raw':!![]})[_0xc4f4('0x22')](function(_0x2487b4){if(_0x2487b4&&_0x2487b4[_0xc4f4('0x51')]===0x0){return db['UserProfileResource'][_0xc4f4('0x46')]({'name':_0x5e5fec['name'],'resourceId':_0x5e5fec['id'],'type':_0x2487b4[_0xc4f4('0x27')],'sectionId':_0x2487b4['id']},{})[_0xc4f4('0x22')](function(){return _0x438ed0;});}else{return _0x438ed0;}})[_0xc4f4('0x41')](function(_0x2cb6f0){logger[_0xc4f4('0x52')](_0xc4f4('0x53'),_0x2cb6f0);throw _0x2cb6f0;});}return _0x438ed0;})[_0xc4f4('0x22')](respondWithResult(_0x4a55d7,0xc9))[_0xc4f4('0x41')](handleError(_0x4a55d7,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9f014f8..daeca1d 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 _0x4e16=['CannedAnswer','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x28e919,_0x145939){var _0x692b7e=function(_0x1514ae){while(--_0x1514ae){_0x28e919['push'](_0x28e919['shift']());}};_0x692b7e(++_0x145939);}(_0x4e16,0x1ee));var _0x64e1=function(_0x1af572,_0x1d11c5){_0x1af572=_0x1af572-0x0;var _0x2cf6bf=_0x4e16[_0x1af572];return _0x2cf6bf;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var logger=require(_0x64e1('0x2'))(_0x64e1('0x3'));var moment=require(_0x64e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x64e1('0x5'));var fs=require('fs');var path=require(_0x64e1('0x6'));var rimraf=require(_0x64e1('0x7'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x64e1('0x8')]=function(_0x58dad6,_0x4f05ae){return _0x58dad6[_0x64e1('0x9')](_0x64e1('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x64e1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5142=['lodash','util','../../config/logger','api','request-promise','path','rimraf','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci'];(function(_0x5c8585,_0x210330){var _0x58151b=function(_0x3fa250){while(--_0x3fa250){_0x5c8585['push'](_0x5c8585['shift']());}};_0x58151b(++_0x210330);}(_0x5142,0xbb));var _0x2514=function(_0xb6d785,_0x32bfc8){_0xb6d785=_0xb6d785-0x0;var _0x37649f=_0x5142[_0xb6d785];return _0x37649f;};'use strict';var _=require(_0x2514('0x0'));var util=require(_0x2514('0x1'));var logger=require(_0x2514('0x2'))(_0x2514('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2514('0x4'));var fs=require('fs');var path=require(_0x2514('0x5'));var rimraf=require(_0x2514('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x14b573,_0x174b16){return _0x14b573[_0x2514('0x7')](_0x2514('0x8'),attributes,{'tableName':_0x2514('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2514('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 725cc74..a2def19 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(_0x2fe6a5,_0x259962){var _0x3af016=function(_0x63b950){while(--_0x63b950){_0x2fe6a5['push'](_0x2fe6a5['shift']());}};_0x3af016(++_0x259962);}(_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 +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(_0x20fb40,_0x5b2a02){var _0x3db40f=function(_0x5e6b7e){while(--_0x5e6b7e){_0x20fb40['push'](_0x20fb40['shift']());}};_0x3db40f(++_0x5b2a02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 76726e3..f416172 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 _0x3e26=['show','post','create','isAuthenticated','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x1e48d9,_0x5df5d8){var _0x20255c=function(_0x4d20a2){while(--_0x4d20a2){_0x1e48d9['push'](_0x1e48d9['shift']());}};_0x20255c(++_0x5df5d8);}(_0x3e26,0x13a));var _0x63e2=function(_0xc0737c,_0xee6126){_0xc0737c=_0xc0737c-0x0;var _0x541d26=_0x3e26[_0xc0737c];return _0x541d26;};'use strict';var multer=require(_0x63e2('0x0'));var util=require('util');var path=require(_0x63e2('0x1'));var timeout=require(_0x63e2('0x2'));var express=require(_0x63e2('0x3'));var router=express[_0x63e2('0x4')]();var fs_extra=require(_0x63e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x63e2('0x6'));var config=require(_0x63e2('0x7'));var controller=require(_0x63e2('0x8'));router[_0x63e2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x63e2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x63e2('0xa')]);router[_0x63e2('0xb')]('/',auth['isAuthenticated'](),controller[_0x63e2('0xc')]);router['put']('/:id',auth[_0x63e2('0xd')](),controller[_0x63e2('0xe')]);router[_0x63e2('0xf')](_0x63e2('0x10'),auth['isAuthenticated'](),controller[_0x63e2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x091a=['put','update','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x091a,0x73));var _0xa091=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x091a[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xa091('0x0'));var util=require(_0xa091('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa091('0x2'));var router=express['Router']();var fs_extra=require(_0xa091('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa091('0x4'));var config=require(_0xa091('0x5'));var controller=require(_0xa091('0x6'));router['get']('/',auth[_0xa091('0x7')](),controller[_0xa091('0x8')]);router[_0xa091('0x9')](_0xa091('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa091('0xb')]('/',auth[_0xa091('0x7')](),controller[_0xa091('0xc')]);router[_0xa091('0xd')](_0xa091('0xa'),auth[_0xa091('0x7')](),controller[_0xa091('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa091('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7b7feb0..8430109 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 _0x0194=['INTEGER','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x2634a7,_0x118508){var _0xa52e2c=function(_0x400f75){while(--_0x400f75){_0x2634a7['push'](_0x2634a7['shift']());}};_0xa52e2c(++_0x118508);}(_0x0194,0xf1));var _0x4019=function(_0x26a8e9,_0x2013a1){_0x26a8e9=_0x26a8e9-0x0;var _0x17333a=_0x0194[_0x26a8e9];return _0x17333a;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x4019('0x0')],'allowNull':![],'defaultValue':_0x4019('0x1')},'clid':{'type':Sequelize[_0x4019('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4019('0x2')]},'dcontext':{'type':Sequelize[_0x4019('0x2')]},'channel':{'type':Sequelize[_0x4019('0x2')]},'dstchannel':{'type':Sequelize[_0x4019('0x2')]},'lastapp':{'type':Sequelize[_0x4019('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4019('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4019('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4019('0x2')]},'amaflags':{'type':Sequelize[_0x4019('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4019('0x2')]},'uniqueid':{'type':Sequelize[_0x4019('0x2')]},'linkedid':{'type':Sequelize[_0x4019('0x2')]},'sequence':{'type':Sequelize[_0x4019('0x2')]},'peeraccount':{'type':Sequelize[_0x4019('0x2')]},'type':{'type':Sequelize[_0x4019('0x2')]},'tag':{'type':Sequelize[_0x4019('0x2')]}}; \ No newline at end of file +var _0xde9f=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x400001,_0x4b768f){var _0x343fbe=function(_0x199f05){while(--_0x199f05){_0x400001['push'](_0x400001['shift']());}};_0x343fbe(++_0x4b768f);}(_0xde9f,0x16d));var _0xfde9=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0xde9f[_0x44c768];return _0x55daf5;};'use strict';var Sequelize=require(_0xfde9('0x0'));module[_0xfde9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xfde9('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xfde9('0x3')]},'dst':{'type':Sequelize[_0xfde9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfde9('0x3')]},'dstchannel':{'type':Sequelize[_0xfde9('0x3')]},'lastapp':{'type':Sequelize[_0xfde9('0x3')]},'lastdata':{'type':Sequelize[_0xfde9('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfde9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfde9('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfde9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xfde9('0x3')]},'peeraccount':{'type':Sequelize[_0xfde9('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xfde9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 996626d..088c1a5 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 _0xc492=['findAll','rows','catch','params','includeAll','find','body','describe','eml-format','rimraf','zip-dir','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include'];(function(_0x5da9e1,_0xc580f8){var _0x21a139=function(_0x35b0cd){while(--_0x35b0cd){_0x5da9e1['push'](_0x5da9e1['shift']());}};_0x21a139(++_0xc580f8);}(_0xc492,0xd7));var _0x2c49=function(_0x38d465,_0x5ba8f2){_0x38d465=_0x38d465-0x0;var _0x3056d1=_0xc492[_0x38d465];return _0x3056d1;};'use strict';var emlformat=require(_0x2c49('0x0'));var rimraf=require(_0x2c49('0x1'));var zipdir=require(_0x2c49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c49('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c49('0x4'));var path=require(_0x2c49('0x5'));var sox=require('sox');var csv=require(_0x2c49('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c49('0x7'));var _=require(_0x2c49('0x8'));var squel=require('squel');var crypto=require(_0x2c49('0x9'));var jsforce=require(_0x2c49('0xa'));var deskjs=require(_0x2c49('0xb'));var toCsv=require(_0x2c49('0x6'));var querystring=require(_0x2c49('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c49('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c49('0xe'))('api');var utils=require(_0x2c49('0xf'));var config=require(_0x2c49('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c49('0x11'))['db'];function respondWithStatusCode(_0x1cc78b,_0x19f7d9){_0x19f7d9=_0x19f7d9||0xcc;return function(_0x1e2210){if(_0x1e2210){return _0x1cc78b[_0x2c49('0x12')](_0x19f7d9);}return _0x1cc78b[_0x2c49('0x13')](_0x19f7d9)['end']();};}function respondWithResult(_0x2006cf,_0x5af5e7){_0x5af5e7=_0x5af5e7||0xc8;return function(_0x2eeb10){if(_0x2eeb10){return _0x2006cf[_0x2c49('0x13')](_0x5af5e7)[_0x2c49('0x14')](_0x2eeb10);}};}function respondWithFilteredResult(_0x561d83,_0x19f59b){return function(_0x385724){if(_0x385724){var _0x30da01=typeof _0x19f59b[_0x2c49('0x15')]===_0x2c49('0x16')&&typeof _0x19f59b[_0x2c49('0x17')]===_0x2c49('0x16');var _0x2e2e07=_0x385724[_0x2c49('0x18')];var _0x89bcb=_0x30da01?0x0:_0x19f59b['offset'];var _0x3001af=_0x30da01?_0x385724[_0x2c49('0x18')]:_0x19f59b[_0x2c49('0x15')]+_0x19f59b[_0x2c49('0x17')];var _0x4793d5;if(_0x3001af>=_0x2e2e07){_0x3001af=_0x2e2e07;_0x4793d5=0xc8;}else{_0x4793d5=0xce;}_0x561d83[_0x2c49('0x13')](_0x4793d5);return _0x561d83['set'](_0x2c49('0x19'),_0x89bcb+'-'+_0x3001af+'/'+_0x2e2e07)[_0x2c49('0x14')](_0x385724);}return null;};}function patchUpdates(_0x573157){return function(_0x4b8f61){try{jsonpatch[_0x2c49('0x1a')](_0x4b8f61,_0x573157,!![]);}catch(_0x3bda90){return BPromise[_0x2c49('0x1b')](_0x3bda90);}return _0x4b8f61[_0x2c49('0x1c')]();};}function saveUpdates(_0x202205,_0x294c70){return function(_0x33c09f){if(_0x33c09f){return _0x33c09f[_0x2c49('0x1d')](_0x202205)[_0x2c49('0x1e')](function(_0x54fe21){return _0x54fe21;});}return null;};}function removeEntity(_0x14ca06,_0x20f3bf){return function(_0x4037b0){if(_0x4037b0){return _0x4037b0[_0x2c49('0x1f')]()['then'](function(){_0x14ca06[_0x2c49('0x13')](0xcc)[_0x2c49('0x20')]();});}};}function handleEntityNotFound(_0x3a35b4,_0x2a9109){return function(_0x59c061){if(!_0x59c061){_0x3a35b4[_0x2c49('0x12')](0x194);}return _0x59c061;};}function handleError(_0x18a41e,_0x25bf3d){_0x25bf3d=_0x25bf3d||0x1f4;return function(_0x50da06){logger[_0x2c49('0x21')](_0x50da06[_0x2c49('0x22')]);if(_0x50da06['name']){delete _0x50da06[_0x2c49('0x23')];}_0x18a41e['status'](_0x25bf3d)['send'](_0x50da06);};}exports[_0x2c49('0x24')]=function(_0x4d2564,_0x5c4fb1){var _0x4d9334={},_0x433503={},_0x7b8d75={'count':0x0,'rows':[]};var _0x2b2dd5=_[_0x2c49('0x25')](db[_0x2c49('0x26')][_0x2c49('0x27')],function(_0x131c06){return{'name':_0x131c06[_0x2c49('0x28')],'type':_0x131c06[_0x2c49('0x29')][_0x2c49('0x2a')]};});_0x433503['model']=_[_0x2c49('0x25')](_0x2b2dd5,'name');_0x433503[_0x2c49('0x2b')]=_[_0x2c49('0x2c')](_0x4d2564[_0x2c49('0x2b')]);_0x433503[_0x2c49('0x2d')]=_[_0x2c49('0x2e')](_0x433503[_0x2c49('0x2f')],_0x433503[_0x2c49('0x2b')]);_0x4d9334[_0x2c49('0x30')]=_[_0x2c49('0x2e')](_0x433503[_0x2c49('0x2f')],qs[_0x2c49('0x31')](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x31')]));_0x4d9334[_0x2c49('0x30')]=_0x4d9334['attributes']['length']?_0x4d9334[_0x2c49('0x30')]:_0x433503[_0x2c49('0x2f')];if(!_0x4d2564['query'][_0x2c49('0x32')](_0x2c49('0x33'))){_0x4d9334[_0x2c49('0x17')]=qs[_0x2c49('0x17')](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x17')]);_0x4d9334[_0x2c49('0x15')]=qs[_0x2c49('0x15')](_0x4d2564['query'][_0x2c49('0x15')]);}_0x4d9334[_0x2c49('0x34')]=qs['sort'](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x35')]);_0x4d9334[_0x2c49('0x36')]=qs['filters'](_[_0x2c49('0x37')](_0x4d2564[_0x2c49('0x2b')],_0x433503[_0x2c49('0x2d')]),_0x2b2dd5);if(_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x38')]){_0x4d9334[_0x2c49('0x36')]=_['merge'](_0x4d9334[_0x2c49('0x36')],{'$or':_[_0x2c49('0x25')](_0x2b2dd5,function(_0x4cbfe4){if(_0x4cbfe4[_0x2c49('0x29')]!==_0x2c49('0x39')){var _0x52f123={};_0x52f123[_0x4cbfe4[_0x2c49('0x23')]]={'$like':'%'+_0x4d2564['query'][_0x2c49('0x38')]+'%'};return _0x52f123;}})});}_0x4d9334=_[_0x2c49('0x3a')]({},_0x4d9334,_0x4d2564[_0x2c49('0x3b')]);var _0x5a6822={'where':_0x4d9334[_0x2c49('0x36')]};return db['Cdr'][_0x2c49('0x18')](_0x5a6822)[_0x2c49('0x1e')](function(_0x24e53a){_0x7b8d75[_0x2c49('0x18')]=_0x24e53a;if(_0x4d2564[_0x2c49('0x2b')]['includeAll']){_0x4d9334[_0x2c49('0x3c')]=[{'all':!![]}];}return db[_0x2c49('0x26')][_0x2c49('0x3d')](_0x4d9334);})[_0x2c49('0x1e')](function(_0x251c8d){_0x7b8d75[_0x2c49('0x3e')]=_0x251c8d;return _0x7b8d75;})[_0x2c49('0x1e')](respondWithFilteredResult(_0x5c4fb1,_0x4d9334))[_0x2c49('0x3f')](handleError(_0x5c4fb1,null));};exports['show']=function(_0xa912b8,_0x30e892){var _0x5b1ee0={'raw':!![],'where':{'id':_0xa912b8[_0x2c49('0x40')]['id']}},_0x2a21b9={};_0x2a21b9['model']=_[_0x2c49('0x2c')](db['Cdr']['rawAttributes']);_0x2a21b9['query']=_['keys'](_0xa912b8[_0x2c49('0x2b')]);_0x2a21b9[_0x2c49('0x2d')]=_[_0x2c49('0x2e')](_0x2a21b9[_0x2c49('0x2f')],_0x2a21b9[_0x2c49('0x2b')]);_0x5b1ee0['attributes']=_['intersection'](_0x2a21b9['model'],qs['fields'](_0xa912b8[_0x2c49('0x2b')]['fields']));_0x5b1ee0[_0x2c49('0x30')]=_0x5b1ee0['attributes']['length']?_0x5b1ee0['attributes']:_0x2a21b9[_0x2c49('0x2f')];if(_0xa912b8['query'][_0x2c49('0x41')]){_0x5b1ee0[_0x2c49('0x3c')]=[{'all':!![]}];}_0x5b1ee0=_['merge']({},_0x5b1ee0,_0xa912b8['options']);return db[_0x2c49('0x26')][_0x2c49('0x42')](_0x5b1ee0)[_0x2c49('0x1e')](handleEntityNotFound(_0x30e892,null))[_0x2c49('0x1e')](respondWithResult(_0x30e892,null))[_0x2c49('0x3f')](handleError(_0x30e892,null));};exports['create']=function(_0x50dce4,_0x426c8a){return db[_0x2c49('0x26')]['create'](_0x50dce4['body'],{})['then'](respondWithResult(_0x426c8a,0xc9))[_0x2c49('0x3f')](handleError(_0x426c8a,null));};exports[_0x2c49('0x1d')]=function(_0x98fc90,_0x55e4cd){if(_0x98fc90[_0x2c49('0x43')]['id']){delete _0x98fc90[_0x2c49('0x43')]['id'];}return db[_0x2c49('0x26')][_0x2c49('0x42')]({'where':{'id':_0x98fc90[_0x2c49('0x40')]['id']}})[_0x2c49('0x1e')](handleEntityNotFound(_0x55e4cd,null))[_0x2c49('0x1e')](saveUpdates(_0x98fc90['body'],null))['then'](respondWithResult(_0x55e4cd,null))['catch'](handleError(_0x55e4cd,null));};exports[_0x2c49('0x1f')]=function(_0x1aa034,_0x5385e5){return db[_0x2c49('0x26')][_0x2c49('0x42')]({'where':{'id':_0x1aa034[_0x2c49('0x40')]['id']}})[_0x2c49('0x1e')](handleEntityNotFound(_0x5385e5,null))[_0x2c49('0x1e')](removeEntity(_0x5385e5,null))[_0x2c49('0x3f')](handleError(_0x5385e5,null));};exports[_0x2c49('0x44')]=function(_0x11878d,_0x331519){return db[_0x2c49('0x26')]['describe']()[_0x2c49('0x1e')](respondWithResult(_0x331519,null))[_0x2c49('0x3f')](handleError(_0x331519,null));}; \ No newline at end of file +var _0x446c=['name','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x446c,0x156));var _0xc446=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x446c[_0x258fb0];return _0x4d1afe;};'use strict';var emlformat=require(_0xc446('0x0'));var rimraf=require(_0xc446('0x1'));var zipdir=require(_0xc446('0x2'));var jsonpatch=require(_0xc446('0x3'));var rp=require('request-promise');var moment=require(_0xc446('0x4'));var BPromise=require(_0xc446('0x5'));var Mustache=require(_0xc446('0x6'));var util=require('util');var path=require(_0xc446('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc446('0x8'));var fs=require('fs');var fs_extra=require(_0xc446('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc446('0xa'));var jsforce=require(_0xc446('0xb'));var deskjs=require(_0xc446('0xc'));var toCsv=require(_0xc446('0xd'));var querystring=require(_0xc446('0xe'));var Papa=require('papaparse');var Redis=require(_0xc446('0xf'));var authService=require(_0xc446('0x10'));var qs=require(_0xc446('0x11'));var as=require(_0xc446('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc446('0x13'))(_0xc446('0x14'));var utils=require(_0xc446('0x15'));var config=require(_0xc446('0x16'));var licenseUtil=require(_0xc446('0x17'));var db=require(_0xc446('0x18'))['db'];function respondWithStatusCode(_0x1a2099,_0x19083f){_0x19083f=_0x19083f||0xcc;return function(_0x22a70e){if(_0x22a70e){return _0x1a2099[_0xc446('0x19')](_0x19083f);}return _0x1a2099[_0xc446('0x1a')](_0x19083f)[_0xc446('0x1b')]();};}function respondWithResult(_0x1cfc0a,_0x72faac){_0x72faac=_0x72faac||0xc8;return function(_0x21d8e4){if(_0x21d8e4){return _0x1cfc0a[_0xc446('0x1a')](_0x72faac)[_0xc446('0x1c')](_0x21d8e4);}};}function respondWithFilteredResult(_0x20e51b,_0x2b09db){return function(_0x5d2701){if(_0x5d2701){var _0x3ba115=typeof _0x2b09db[_0xc446('0x1d')]===_0xc446('0x1e')&&typeof _0x2b09db[_0xc446('0x1f')]===_0xc446('0x1e');var _0x274040=_0x5d2701[_0xc446('0x20')];var _0x30038f=_0x3ba115?0x0:_0x2b09db[_0xc446('0x1d')];var _0x606af1=_0x3ba115?_0x5d2701['count']:_0x2b09db[_0xc446('0x1d')]+_0x2b09db[_0xc446('0x1f')];var _0x5cd0c1;if(_0x606af1>=_0x274040){_0x606af1=_0x274040;_0x5cd0c1=0xc8;}else{_0x5cd0c1=0xce;}_0x20e51b[_0xc446('0x1a')](_0x5cd0c1);return _0x20e51b[_0xc446('0x21')](_0xc446('0x22'),_0x30038f+'-'+_0x606af1+'/'+_0x274040)[_0xc446('0x1c')](_0x5d2701);}return null;};}function patchUpdates(_0x409a8e){return function(_0x37108c){try{jsonpatch[_0xc446('0x23')](_0x37108c,_0x409a8e,!![]);}catch(_0xc18765){return BPromise[_0xc446('0x24')](_0xc18765);}return _0x37108c[_0xc446('0x25')]();};}function saveUpdates(_0x5ce5f7,_0x35aedc){return function(_0x1ea08b){if(_0x1ea08b){return _0x1ea08b[_0xc446('0x26')](_0x5ce5f7)[_0xc446('0x27')](function(_0x3596f4){return _0x3596f4;});}return null;};}function removeEntity(_0xb696e,_0x36a6f5){return function(_0x1b785a){if(_0x1b785a){return _0x1b785a[_0xc446('0x28')]()[_0xc446('0x27')](function(){_0xb696e[_0xc446('0x1a')](0xcc)[_0xc446('0x1b')]();});}};}function handleEntityNotFound(_0x25f58d,_0x438410){return function(_0x16133b){if(!_0x16133b){_0x25f58d[_0xc446('0x19')](0x194);}return _0x16133b;};}function handleError(_0x465e18,_0x51933d){_0x51933d=_0x51933d||0x1f4;return function(_0xb3ab06){logger[_0xc446('0x29')](_0xb3ab06[_0xc446('0x2a')]);if(_0xb3ab06[_0xc446('0x2b')]){delete _0xb3ab06[_0xc446('0x2b')];}_0x465e18[_0xc446('0x1a')](_0x51933d)['send'](_0xb3ab06);};}exports['index']=function(_0x37532c,_0x1b2dc8){var _0x19f57f={},_0x865c07={},_0x4ea05e={'count':0x0,'rows':[]};var _0x420fcb=_[_0xc446('0x2c')](db[_0xc446('0x2d')][_0xc446('0x2e')],function(_0x1bd4e6){return{'name':_0x1bd4e6[_0xc446('0x2f')],'type':_0x1bd4e6[_0xc446('0x30')][_0xc446('0x31')]};});_0x865c07[_0xc446('0x32')]=_[_0xc446('0x2c')](_0x420fcb,'name');_0x865c07['query']=_['keys'](_0x37532c[_0xc446('0x33')]);_0x865c07[_0xc446('0x34')]=_[_0xc446('0x35')](_0x865c07[_0xc446('0x32')],_0x865c07[_0xc446('0x33')]);_0x19f57f[_0xc446('0x36')]=_[_0xc446('0x35')](_0x865c07['model'],qs[_0xc446('0x37')](_0x37532c[_0xc446('0x33')][_0xc446('0x37')]));_0x19f57f[_0xc446('0x36')]=_0x19f57f[_0xc446('0x36')]['length']?_0x19f57f[_0xc446('0x36')]:_0x865c07[_0xc446('0x32')];if(!_0x37532c[_0xc446('0x33')][_0xc446('0x38')](_0xc446('0x39'))){_0x19f57f[_0xc446('0x1f')]=qs[_0xc446('0x1f')](_0x37532c[_0xc446('0x33')]['limit']);_0x19f57f['offset']=qs[_0xc446('0x1d')](_0x37532c[_0xc446('0x33')][_0xc446('0x1d')]);}_0x19f57f['order']=qs[_0xc446('0x3a')](_0x37532c[_0xc446('0x33')][_0xc446('0x3a')]);_0x19f57f['where']=qs['filters'](_['pick'](_0x37532c[_0xc446('0x33')],_0x865c07['filters']),_0x420fcb);if(_0x37532c[_0xc446('0x33')][_0xc446('0x3b')]){_0x19f57f['where']=_[_0xc446('0x3c')](_0x19f57f[_0xc446('0x3d')],{'$or':_[_0xc446('0x2c')](_0x420fcb,function(_0x2beba1){if(_0x2beba1['type']!==_0xc446('0x3e')){var _0xb9c7e6={};_0xb9c7e6[_0x2beba1['name']]={'$like':'%'+_0x37532c[_0xc446('0x33')][_0xc446('0x3b')]+'%'};return _0xb9c7e6;}})});}_0x19f57f=_[_0xc446('0x3c')]({},_0x19f57f,_0x37532c[_0xc446('0x3f')]);var _0xf3400e={'where':_0x19f57f['where']};return db[_0xc446('0x2d')][_0xc446('0x20')](_0xf3400e)[_0xc446('0x27')](function(_0xf8c80c){_0x4ea05e[_0xc446('0x20')]=_0xf8c80c;if(_0x37532c['query'][_0xc446('0x40')]){_0x19f57f[_0xc446('0x41')]=[{'all':!![]}];}return db[_0xc446('0x2d')][_0xc446('0x42')](_0x19f57f);})[_0xc446('0x27')](function(_0x5e65d5){_0x4ea05e[_0xc446('0x43')]=_0x5e65d5;return _0x4ea05e;})['then'](respondWithFilteredResult(_0x1b2dc8,_0x19f57f))[_0xc446('0x44')](handleError(_0x1b2dc8,null));};exports[_0xc446('0x45')]=function(_0x520ffd,_0x3287ce){var _0x5e250b={'raw':!![],'where':{'id':_0x520ffd[_0xc446('0x46')]['id']}},_0x29f36f={};_0x29f36f[_0xc446('0x32')]=_[_0xc446('0x47')](db['Cdr'][_0xc446('0x2e')]);_0x29f36f[_0xc446('0x33')]=_[_0xc446('0x47')](_0x520ffd['query']);_0x29f36f[_0xc446('0x34')]=_[_0xc446('0x35')](_0x29f36f[_0xc446('0x32')],_0x29f36f[_0xc446('0x33')]);_0x5e250b[_0xc446('0x36')]=_[_0xc446('0x35')](_0x29f36f[_0xc446('0x32')],qs[_0xc446('0x37')](_0x520ffd[_0xc446('0x33')][_0xc446('0x37')]));_0x5e250b[_0xc446('0x36')]=_0x5e250b[_0xc446('0x36')][_0xc446('0x48')]?_0x5e250b[_0xc446('0x36')]:_0x29f36f[_0xc446('0x32')];if(_0x520ffd['query']['includeAll']){_0x5e250b[_0xc446('0x41')]=[{'all':!![]}];}_0x5e250b=_[_0xc446('0x3c')]({},_0x5e250b,_0x520ffd['options']);return db['Cdr']['find'](_0x5e250b)['then'](handleEntityNotFound(_0x3287ce,null))[_0xc446('0x27')](respondWithResult(_0x3287ce,null))[_0xc446('0x44')](handleError(_0x3287ce,null));};exports[_0xc446('0x49')]=function(_0x2fc1bf,_0x19ca3d){return db[_0xc446('0x2d')][_0xc446('0x49')](_0x2fc1bf[_0xc446('0x4a')],{})[_0xc446('0x27')](respondWithResult(_0x19ca3d,0xc9))[_0xc446('0x44')](handleError(_0x19ca3d,null));};exports['update']=function(_0x40aa4f,_0x317559){if(_0x40aa4f[_0xc446('0x4a')]['id']){delete _0x40aa4f['body']['id'];}return db[_0xc446('0x2d')]['find']({'where':{'id':_0x40aa4f[_0xc446('0x46')]['id']}})[_0xc446('0x27')](handleEntityNotFound(_0x317559,null))[_0xc446('0x27')](saveUpdates(_0x40aa4f[_0xc446('0x4a')],null))[_0xc446('0x27')](respondWithResult(_0x317559,null))['catch'](handleError(_0x317559,null));};exports[_0xc446('0x28')]=function(_0x5415e5,_0x26ec5f){return db['Cdr'][_0xc446('0x4b')]({'where':{'id':_0x5415e5['params']['id']}})[_0xc446('0x27')](handleEntityNotFound(_0x26ec5f,null))[_0xc446('0x27')](removeEntity(_0x26ec5f,null))['catch'](handleError(_0x26ec5f,null));};exports['describe']=function(_0x1a66fd,_0x5759af){return db[_0xc446('0x2d')][_0xc446('0x4c')]()[_0xc446('0x27')](respondWithResult(_0x5759af,null))[_0xc446('0x44')](handleError(_0x5759af,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0bc5f16..3d4d8ca 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x9fbc99,_0x4a758f){var _0x15b10e=function(_0x2a1203){while(--_0x2a1203){_0x9fbc99['push'](_0x9fbc99['shift']());}};_0x15b10e(++_0x4a758f);}(_0x7a54,0x106));var _0x47a5=function(_0x462f99,_0xf86909){_0x462f99=_0x462f99-0x0;var _0x40977e=_0x7a54[_0x462f99];return _0x40977e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x371503,_0x1997d4){var _0x17a2dc=function(_0x4acb8a){while(--_0x4acb8a){_0x371503['push'](_0x371503['shift']());}};_0x17a2dc(++_0x1997d4);}(_0x7a54,0x106));var _0x47a5=function(_0x54a94c,_0x441550){_0x54a94c=_0x54a94c-0x0;var _0x1a1d05=_0x7a54[_0x54a94c];return _0x1a1d05;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c1b4a01..3ec20c7 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 _0x24ed=['rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/logger'];(function(_0x445819,_0x11b666){var _0x160c43=function(_0x22e9fa){while(--_0x22e9fa){_0x445819['push'](_0x445819['shift']());}};_0x160c43(++_0x11b666);}(_0x24ed,0x19d));var _0xd24e=function(_0x2127c7,_0x1d65c1){_0x2127c7=_0x2127c7-0x0;var _0x57f014=_0x24ed[_0x2127c7];return _0x57f014;};'use strict';var _=require(_0xd24e('0x0'));var util=require(_0xd24e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd24e('0x2'));var fs=require('fs');var Redis=require(_0xd24e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd24e('0x4'))(_0xd24e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd24e('0x6')][_0xd24e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x350315,_0x2b77da,_0x35a09f){return new BPromise(function(_0x14b35b,_0x333eca){return client[_0xd24e('0x8')](_0x350315,_0x35a09f)[_0xd24e('0x9')](function(_0x1f8a7a){logger[_0xd24e('0xa')](_0xd24e('0xb'),_0x2b77da,_0xd24e('0xc'));logger[_0xd24e('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2b77da,_0xd24e('0xc'),JSON[_0xd24e('0xe')](_0x1f8a7a));if(_0x1f8a7a[_0xd24e('0xf')]){if(_0x1f8a7a[_0xd24e('0xf')][_0xd24e('0x10')]===0x1f4){logger[_0xd24e('0xf')](_0xd24e('0xb'),_0x2b77da,_0x1f8a7a[_0xd24e('0xf')][_0xd24e('0x11')]);return _0x333eca(_0x1f8a7a[_0xd24e('0xf')][_0xd24e('0x11')]);}logger['error'](_0xd24e('0xb'),_0x2b77da,_0x1f8a7a[_0xd24e('0xf')]['message']);return _0x14b35b(_0x1f8a7a[_0xd24e('0xf')][_0xd24e('0x11')]);}else{logger['info'](_0xd24e('0xb'),_0x2b77da,_0xd24e('0xc'));_0x14b35b(_0x1f8a7a[_0xd24e('0x12')][_0xd24e('0x11')]);}})['catch'](function(_0x38d987){logger[_0xd24e('0xf')]('Cdr,\x20%s,\x20%s',_0x2b77da,_0x38d987);_0x333eca(_0x38d987);});});} \ No newline at end of file +var _0x3f8e=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1565bc,_0x4a53aa){var _0x363f7b=function(_0x3074eb){while(--_0x3074eb){_0x1565bc['push'](_0x1565bc['shift']());}};_0x363f7b(++_0x4a53aa);}(_0x3f8e,0x127));var _0xe3f8=function(_0x3afc32,_0x4881cb){_0x3afc32=_0x3afc32-0x0;var _0x445ea6=_0x3f8e[_0x3afc32];return _0x445ea6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3f8('0x0'));var fs=require('fs');var Redis=require(_0xe3f8('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe3f8('0x2'))(_0xe3f8('0x3'));var config=require(_0xe3f8('0x4'));var jayson=require(_0xe3f8('0x5'));var client=jayson['client'][_0xe3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x331d4f,_0x29e34a,_0x41ad35){return new BPromise(function(_0x3b9b52,_0x43b0c9){return client[_0xe3f8('0x7')](_0x331d4f,_0x41ad35)[_0xe3f8('0x8')](function(_0x3010fc){logger[_0xe3f8('0x9')](_0xe3f8('0xa'),_0x29e34a,_0xe3f8('0xb'));logger[_0xe3f8('0xc')](_0xe3f8('0xd'),_0x29e34a,_0xe3f8('0xb'),JSON[_0xe3f8('0xe')](_0x3010fc));if(_0x3010fc[_0xe3f8('0xf')]){if(_0x3010fc[_0xe3f8('0xf')]['code']===0x1f4){logger[_0xe3f8('0xf')](_0xe3f8('0xa'),_0x29e34a,_0x3010fc[_0xe3f8('0xf')][_0xe3f8('0x10')]);return _0x43b0c9(_0x3010fc['error'][_0xe3f8('0x10')]);}logger[_0xe3f8('0xf')](_0xe3f8('0xa'),_0x29e34a,_0x3010fc['error'][_0xe3f8('0x10')]);return _0x3b9b52(_0x3010fc[_0xe3f8('0xf')][_0xe3f8('0x10')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x29e34a,_0xe3f8('0xb'));_0x3b9b52(_0x3010fc[_0xe3f8('0x11')]['message']);}})[_0xe3f8('0x12')](function(_0x109184){logger[_0xe3f8('0xf')](_0xe3f8('0xa'),_0x29e34a,_0x109184);_0x43b0c9(_0x109184);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 53e8b8b..0c182a2 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(_0x14bf66,_0x3e1066){var _0xaf4bf7=function(_0x3d9c3f){while(--_0x3d9c3f){_0x14bf66['push'](_0x14bf66['shift']());}};_0xaf4bf7(++_0x3e1066);}(_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(_0x1fd55b,_0x18ee5f){var _0x4cefd8=function(_0xe3153d){while(--_0xe3153d){_0x1fd55b['push'](_0x1fd55b['shift']());}};_0x4cefd8(++_0x18ee5f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bccbf,_0x547e42){_0x5bccbf=_0x5bccbf-0x0;var _0x2158c6=_0xb10b[_0x5bccbf];return _0x2158c6;};'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 47ac788..024913a 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 _0xfe16=['exports','STRING','noop','TEXT','sequelize'];(function(_0x1efb7e,_0x50cfa0){var _0x27aa56=function(_0x53fb85){while(--_0x53fb85){_0x1efb7e['push'](_0x1efb7e['shift']());}};_0x27aa56(++_0x50cfa0);}(_0xfe16,0x1bc));var _0x6fe1=function(_0x272786,_0x1e2aec){_0x272786=_0x272786-0x0;var _0x42bb92=_0xfe16[_0x272786];return _0x42bb92;};'use strict';var Sequelize=require(_0x6fe1('0x0'));module[_0x6fe1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6fe1('0x2')],'allowNull':![],'defaultValue':_0x6fe1('0x3')},'appdata':{'type':Sequelize[_0x6fe1('0x4')]()},'description':{'type':Sequelize[_0x6fe1('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x771a=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x771a,0x1d2));var _0xa771=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x771a[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0xa771('0x0'));module[_0xa771('0x1')]={'priority':{'type':Sequelize[_0xa771('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa771('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa771('0x4')]},'interval':{'type':Sequelize[_0xa771('0x4')],'defaultValue':_0xa771('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ec9704a..2519b26 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 _0x30fe=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','includeAll','merge','options','find','catch','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x30fe,0x149));var _0xe30f=function(_0x86e191,_0x585a70){_0x86e191=_0x86e191-0x0;var _0x286b0b=_0x30fe[_0x86e191];return _0x286b0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30f('0x1'));var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require('papaparse');var Redis=require(_0xe30f('0x10'));var authService=require(_0xe30f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe30f('0x12'));var hardwareService=require(_0xe30f('0x13'));var logger=require(_0xe30f('0x14'))(_0xe30f('0x15'));var utils=require('../../config/utils');var config=require(_0xe30f('0x16'));var licenseUtil=require(_0xe30f('0x17'));var db=require(_0xe30f('0x18'))['db'];function respondWithStatusCode(_0x583eb9,_0x3859df){_0x3859df=_0x3859df||0xcc;return function(_0x19970e){if(_0x19970e){return _0x583eb9[_0xe30f('0x19')](_0x3859df);}return _0x583eb9['status'](_0x3859df)[_0xe30f('0x1a')]();};}function respondWithResult(_0x460e07,_0x122e2a){_0x122e2a=_0x122e2a||0xc8;return function(_0x7d684c){if(_0x7d684c){return _0x460e07['status'](_0x122e2a)['json'](_0x7d684c);}};}function respondWithFilteredResult(_0x5ac4b2,_0x3c9680){return function(_0x494ad3){if(_0x494ad3){var _0x2b6a9b=typeof _0x3c9680[_0xe30f('0x1b')]==='undefined'&&typeof _0x3c9680[_0xe30f('0x1c')]==='undefined';var _0x2dbb2b=_0x494ad3[_0xe30f('0x1d')];var _0x406c98=_0x2b6a9b?0x0:_0x3c9680[_0xe30f('0x1b')];var _0x17024a=_0x2b6a9b?_0x494ad3['count']:_0x3c9680['offset']+_0x3c9680[_0xe30f('0x1c')];var _0x535873;if(_0x17024a>=_0x2dbb2b){_0x17024a=_0x2dbb2b;_0x535873=0xc8;}else{_0x535873=0xce;}_0x5ac4b2[_0xe30f('0x1e')](_0x535873);return _0x5ac4b2['set'](_0xe30f('0x1f'),_0x406c98+'-'+_0x17024a+'/'+_0x2dbb2b)[_0xe30f('0x20')](_0x494ad3);}return null;};}function patchUpdates(_0x2c4d1f){return function(_0x2a0432){try{jsonpatch[_0xe30f('0x21')](_0x2a0432,_0x2c4d1f,!![]);}catch(_0x5b33fa){return BPromise[_0xe30f('0x22')](_0x5b33fa);}return _0x2a0432['save']();};}function saveUpdates(_0xf66c5a,_0x5af7b5){return function(_0x322ee0){if(_0x322ee0){return _0x322ee0[_0xe30f('0x23')](_0xf66c5a)[_0xe30f('0x24')](function(_0x42833a){return _0x42833a;});}return null;};}function removeEntity(_0x7f7b1f,_0x378d6f){return function(_0x50bca4){if(_0x50bca4){return _0x50bca4[_0xe30f('0x25')]()['then'](function(){_0x7f7b1f[_0xe30f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4fbe,_0x4fc220){return function(_0x11a539){if(!_0x11a539){_0x4d4fbe['sendStatus'](0x194);}return _0x11a539;};}function handleError(_0x412015,_0x25e3cf){_0x25e3cf=_0x25e3cf||0x1f4;return function(_0x37c716){logger[_0xe30f('0x26')](_0x37c716[_0xe30f('0x27')]);if(_0x37c716[_0xe30f('0x28')]){delete _0x37c716['name'];}_0x412015[_0xe30f('0x1e')](_0x25e3cf)[_0xe30f('0x29')](_0x37c716);};}exports['show']=function(_0x15a217,_0x2d67d4){var _0x5a6cc3={'raw':!![],'where':{'id':_0x15a217['params']['id']}},_0x500626={};_0x500626[_0xe30f('0x2a')]=_[_0xe30f('0x2b')](db[_0xe30f('0x2c')][_0xe30f('0x2d')]);_0x500626[_0xe30f('0x2e')]=_[_0xe30f('0x2b')](_0x15a217['query']);_0x500626[_0xe30f('0x2f')]=_['intersection'](_0x500626[_0xe30f('0x2a')],_0x500626[_0xe30f('0x2e')]);_0x5a6cc3[_0xe30f('0x30')]=_[_0xe30f('0x31')](_0x500626['model'],qs[_0xe30f('0x32')](_0x15a217[_0xe30f('0x2e')][_0xe30f('0x32')]));_0x5a6cc3['attributes']=_0x5a6cc3[_0xe30f('0x30')]['length']?_0x5a6cc3[_0xe30f('0x30')]:_0x500626[_0xe30f('0x2a')];if(_0x15a217[_0xe30f('0x2e')][_0xe30f('0x33')]){_0x5a6cc3['include']=[{'all':!![]}];}_0x5a6cc3=_[_0xe30f('0x34')]({},_0x5a6cc3,_0x15a217[_0xe30f('0x35')]);return db[_0xe30f('0x2c')][_0xe30f('0x36')](_0x5a6cc3)[_0xe30f('0x24')](handleEntityNotFound(_0x2d67d4,null))[_0xe30f('0x24')](respondWithResult(_0x2d67d4,null))[_0xe30f('0x37')](handleError(_0x2d67d4,null));};exports['update']=function(_0x139915,_0xcc659c){if(_0x139915[_0xe30f('0x38')]['id']){delete _0x139915['body']['id'];}return db[_0xe30f('0x2c')][_0xe30f('0x36')]({'where':{'id':_0x139915['params']['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0xcc659c,null))['then'](saveUpdates(_0x139915[_0xe30f('0x38')],null))['then'](respondWithResult(_0xcc659c,null))['catch'](handleError(_0xcc659c,null));};exports['destroy']=function(_0xf09327,_0x86fbbc){return db['ChatApplication'][_0xe30f('0x36')]({'where':{'id':_0xf09327['params']['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0x86fbbc,null))[_0xe30f('0x24')](removeEntity(_0x86fbbc,null))[_0xe30f('0x37')](handleError(_0x86fbbc,null));}; \ No newline at end of file +var _0x3f8c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','show','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','body','params','destroy','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x12d034,_0x430f51){var _0x39d6e5=function(_0x579248){while(--_0x579248){_0x12d034['push'](_0x12d034['shift']());}};_0x39d6e5(++_0x430f51);}(_0x3f8c,0x104));var _0xc3f8=function(_0x3c42d6,_0xd54da0){_0x3c42d6=_0x3c42d6-0x0;var _0x164662=_0x3f8c[_0x3c42d6];return _0x164662;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4569c2,_0x327b2d){return function(_0x2d237e){if(!_0x2d237e){_0x4569c2[_0xc3f8('0x16')](0x194);}return _0x2d237e;};}function handleError(_0x25088f,_0x9d43b4){_0x9d43b4=_0x9d43b4||0x1f4;return function(_0xf1d460){logger[_0xc3f8('0x22')](_0xf1d460[_0xc3f8('0x23')]);if(_0xf1d460[_0xc3f8('0x24')]){delete _0xf1d460[_0xc3f8('0x24')];}_0x25088f[_0xc3f8('0x17')](_0x9d43b4)[_0xc3f8('0x25')](_0xf1d460);};}exports[_0xc3f8('0x26')]=function(_0x59e4dd,_0x58b303){var _0x2909f8={'raw':!![],'where':{'id':_0x59e4dd['params']['id']}},_0x218029={};_0x218029[_0xc3f8('0x27')]=_['keys'](db[_0xc3f8('0x28')][_0xc3f8('0x29')]);_0x218029['query']=_['keys'](_0x59e4dd[_0xc3f8('0x2a')]);_0x218029[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x218029[_0xc3f8('0x27')],_0x218029[_0xc3f8('0x2a')]);_0x2909f8[_0xc3f8('0x2d')]=_[_0xc3f8('0x2c')](_0x218029[_0xc3f8('0x27')],qs[_0xc3f8('0x2e')](_0x59e4dd[_0xc3f8('0x2a')]['fields']));_0x2909f8[_0xc3f8('0x2d')]=_0x2909f8[_0xc3f8('0x2d')][_0xc3f8('0x2f')]?_0x2909f8[_0xc3f8('0x2d')]:_0x218029[_0xc3f8('0x27')];if(_0x59e4dd['query']['includeAll']){_0x2909f8[_0xc3f8('0x30')]=[{'all':!![]}];}_0x2909f8=_[_0xc3f8('0x31')]({},_0x2909f8,_0x59e4dd[_0xc3f8('0x32')]);return db[_0xc3f8('0x28')][_0xc3f8('0x33')](_0x2909f8)['then'](handleEntityNotFound(_0x58b303,null))[_0xc3f8('0x21')](respondWithResult(_0x58b303,null))[_0xc3f8('0x34')](handleError(_0x58b303,null));};exports[_0xc3f8('0x20')]=function(_0x5a72c1,_0x213c00){if(_0x5a72c1[_0xc3f8('0x35')]['id']){delete _0x5a72c1[_0xc3f8('0x35')]['id'];}return db['ChatApplication'][_0xc3f8('0x33')]({'where':{'id':_0x5a72c1[_0xc3f8('0x36')]['id']}})['then'](handleEntityNotFound(_0x213c00,null))[_0xc3f8('0x21')](saveUpdates(_0x5a72c1[_0xc3f8('0x35')],null))[_0xc3f8('0x21')](respondWithResult(_0x213c00,null))[_0xc3f8('0x34')](handleError(_0x213c00,null));};exports[_0xc3f8('0x37')]=function(_0x1fddc7,_0x48bc0e){return db[_0xc3f8('0x28')][_0xc3f8('0x33')]({'where':{'id':_0x1fddc7[_0xc3f8('0x36')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x48bc0e,null))[_0xc3f8('0x21')](removeEntity(_0x48bc0e,null))['catch'](handleError(_0x48bc0e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 36003f2..f55f1c4 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 _0x8e18=['ChatApplication','utf8mb4','util','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x5f0e72,_0x25c3c4){var _0x239cd6=function(_0x40b044){while(--_0x40b044){_0x5f0e72['push'](_0x5f0e72['shift']());}};_0x239cd6(++_0x25c3c4);}(_0x8e18,0x1ba));var _0x88e1=function(_0x1350d2,_0x3d09c){_0x1350d2=_0x1350d2-0x0;var _0x1c8f51=_0x8e18[_0x1350d2];return _0x1c8f51;};'use strict';var _=require('lodash');var util=require(_0x88e1('0x0'));var logger=require('../../config/logger')(_0x88e1('0x1'));var moment=require(_0x88e1('0x2'));var BPromise=require(_0x88e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88e1('0x4'));var config=require(_0x88e1('0x5'));var attributes=require(_0x88e1('0x6'));module[_0x88e1('0x7')]=function(_0xf4e5e6,_0x146671){return _0xf4e5e6[_0x88e1('0x8')](_0x88e1('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88e1('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x76ff=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4'];(function(_0x186868,_0x2954e2){var _0x3676dc=function(_0x22d738){while(--_0x22d738){_0x186868['push'](_0x186868['shift']());}};_0x3676dc(++_0x2954e2);}(_0x76ff,0xa8));var _0xf76f=function(_0x11e255,_0x5f606c){_0x11e255=_0x11e255-0x0;var _0x1fde54=_0x76ff[_0x11e255];return _0x1fde54;};'use strict';var _=require(_0xf76f('0x0'));var util=require(_0xf76f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf76f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf76f('0x3'));var fs=require('fs');var path=require(_0xf76f('0x4'));var rimraf=require(_0xf76f('0x5'));var config=require(_0xf76f('0x6'));var attributes=require(_0xf76f('0x7'));module[_0xf76f('0x8')]=function(_0x1aa763,_0x47f244){return _0x1aa763[_0xf76f('0x9')](_0xf76f('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf76f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9cf7651..7444bd4 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 _0xf8bc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2f6c38,_0x4b067a){var _0x66279f=function(_0x13c4b5){while(--_0x13c4b5){_0x2f6c38['push'](_0x2f6c38['shift']());}};_0x66279f(++_0x4b067a);}(_0xf8bc,0x165));var _0xcf8b=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xf8bc[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0xcf8b('0x0'));var util=require(_0xcf8b('0x1'));var moment=require(_0xcf8b('0x2'));var BPromise=require(_0xcf8b('0x3'));var rs=require(_0xcf8b('0x4'));var fs=require('fs');var Redis=require(_0xcf8b('0x5'));var db=require(_0xcf8b('0x6'))['db'];var utils=require(_0xcf8b('0x7'));var logger=require('../../config/logger')(_0xcf8b('0x8'));var config=require(_0xcf8b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcf8b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183078,_0x23d532,_0x454cf6){return new BPromise(function(_0x2cbe74,_0x667e2f){return client[_0xcf8b('0xb')](_0x183078,_0x454cf6)['then'](function(_0x19063e){logger[_0xcf8b('0xc')](_0xcf8b('0xd'),_0x23d532,_0xcf8b('0xe'));logger[_0xcf8b('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x23d532,_0xcf8b('0xe'),JSON[_0xcf8b('0x10')](_0x19063e));if(_0x19063e[_0xcf8b('0x11')]){if(_0x19063e['error'][_0xcf8b('0x12')]===0x1f4){logger['error'](_0xcf8b('0xd'),_0x23d532,_0x19063e[_0xcf8b('0x11')][_0xcf8b('0x13')]);return _0x667e2f(_0x19063e[_0xcf8b('0x11')][_0xcf8b('0x13')]);}logger[_0xcf8b('0x11')](_0xcf8b('0xd'),_0x23d532,_0x19063e[_0xcf8b('0x11')][_0xcf8b('0x13')]);return _0x2cbe74(_0x19063e['error'][_0xcf8b('0x13')]);}else{logger[_0xcf8b('0xc')](_0xcf8b('0xd'),_0x23d532,'request\x20sent');_0x2cbe74(_0x19063e[_0xcf8b('0x14')][_0xcf8b('0x13')]);}})['catch'](function(_0x1f6a31){logger[_0xcf8b('0x11')](_0xcf8b('0xd'),_0x23d532,_0x1f6a31);_0x667e2f(_0x1f6a31);});});} \ No newline at end of file +var _0xf266=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x10c49e,_0x2c0456){var _0x517792=function(_0x44e538){while(--_0x44e538){_0x10c49e['push'](_0x10c49e['shift']());}};_0x517792(++_0x2c0456);}(_0xf266,0x6a));var _0x6f26=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xf266[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x6f26('0x0'));var util=require('util');var moment=require(_0x6f26('0x1'));var BPromise=require(_0x6f26('0x2'));var rs=require(_0x6f26('0x3'));var fs=require('fs');var Redis=require(_0x6f26('0x4'));var db=require(_0x6f26('0x5'))['db'];var utils=require(_0x6f26('0x6'));var logger=require('../../config/logger')(_0x6f26('0x7'));var config=require(_0x6f26('0x8'));var jayson=require(_0x6f26('0x9'));var client=jayson[_0x6f26('0xa')][_0x6f26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4402f7,_0x2444fb,_0x2edee8){return new BPromise(function(_0x102320,_0x4f5286){return client[_0x6f26('0xc')](_0x4402f7,_0x2edee8)[_0x6f26('0xd')](function(_0x5dc8bb){logger['info'](_0x6f26('0xe'),_0x2444fb,_0x6f26('0xf'));logger['debug'](_0x6f26('0x10'),_0x2444fb,'request\x20sent',JSON['stringify'](_0x5dc8bb));if(_0x5dc8bb[_0x6f26('0x11')]){if(_0x5dc8bb[_0x6f26('0x11')][_0x6f26('0x12')]===0x1f4){logger[_0x6f26('0x11')](_0x6f26('0xe'),_0x2444fb,_0x5dc8bb[_0x6f26('0x11')][_0x6f26('0x13')]);return _0x4f5286(_0x5dc8bb[_0x6f26('0x11')][_0x6f26('0x13')]);}logger['error'](_0x6f26('0xe'),_0x2444fb,_0x5dc8bb['error'][_0x6f26('0x13')]);return _0x102320(_0x5dc8bb[_0x6f26('0x11')][_0x6f26('0x13')]);}else{logger['info'](_0x6f26('0xe'),_0x2444fb,_0x6f26('0xf'));_0x102320(_0x5dc8bb[_0x6f26('0x14')][_0x6f26('0x13')]);}})[_0x6f26('0x15')](function(_0x4f5f8a){logger[_0x6f26('0x11')](_0x6f26('0xe'),_0x2444fb,_0x4f5f8a);_0x4f5286(_0x4f5f8a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f9f1e0c..de59380 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 _0x7631=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','isAuthenticated','put','delete','/:id','destroy'];(function(_0x535596,_0x15c174){var _0x5751dd=function(_0x2b3a50){while(--_0x2b3a50){_0x535596['push'](_0x535596['shift']());}};_0x5751dd(++_0x15c174);}(_0x7631,0x108));var _0x1763=function(_0x43730d,_0x20829c){_0x43730d=_0x43730d-0x0;var _0x53353d=_0x7631[_0x43730d];return _0x53353d;};'use strict';var multer=require(_0x1763('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1763('0x1'));var express=require('express');var router=express[_0x1763('0x2')]();var fs_extra=require(_0x1763('0x3'));var auth=require(_0x1763('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1763('0x5'));var controller=require(_0x1763('0x6'));router['get']('/:id',auth[_0x1763('0x7')](),controller['show']);router[_0x1763('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1763('0x9')](_0x1763('0xa'),auth[_0x1763('0x7')](),controller[_0x1763('0xb')]);module['exports']=router; \ No newline at end of file +var _0xce50=['update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0xce50,0x197));var _0x0ce5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xce50[_0x525c7b];return _0x27b33e;};'use strict';var multer=require('multer');var util=require(_0x0ce5('0x0'));var path=require(_0x0ce5('0x1'));var timeout=require(_0x0ce5('0x2'));var express=require(_0x0ce5('0x3'));var router=express[_0x0ce5('0x4')]();var fs_extra=require(_0x0ce5('0x5'));var auth=require(_0x0ce5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ce5('0x7'));var controller=require(_0x0ce5('0x8'));router[_0x0ce5('0x9')](_0x0ce5('0xa'),auth[_0x0ce5('0xb')](),controller[_0x0ce5('0xc')]);router['put']('/:id',auth[_0x0ce5('0xb')](),controller[_0x0ce5('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e1ace08..18443b8 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 _0x2fb7=['exports','STRING','BOOLEAN'];(function(_0xd43aed,_0x556f54){var _0x4aa694=function(_0x56817d){while(--_0x56817d){_0xd43aed['push'](_0xd43aed['shift']());}};_0x4aa694(++_0x556f54);}(_0x2fb7,0x90));var _0x72fb=function(_0x2ca538,_0x123635){_0x2ca538=_0x2ca538-0x0;var _0x13fd09=_0x2fb7[_0x2ca538];return _0x13fd09;};'use strict';var Sequelize=require('sequelize');module[_0x72fb('0x0')]={'name':{'type':Sequelize[_0x72fb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x72fb('0x1')]},'write':{'type':Sequelize[_0x72fb('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd089=['sequelize','STRING','BOOLEAN'];(function(_0x2a6f45,_0x171b52){var _0x451b3a=function(_0x35b1b9){while(--_0x35b1b9){_0x2a6f45['push'](_0x2a6f45['shift']());}};_0x451b3a(++_0x171b52);}(_0xd089,0x156));var _0x9d08=function(_0x15e60b,_0x115701){_0x15e60b=_0x15e60b-0x0;var _0x1c6f97=_0xd089[_0x15e60b];return _0x1c6f97;};'use strict';var Sequelize=require(_0x9d08('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d08('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9d08('0x1')]},'write':{'type':Sequelize[_0x9d08('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 69b21c3..8044f3b 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 _0x114c=['json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','limit','order','filters','filter','where','merge','map','options','includeAll','include','rows','catch','show','params','length','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','find','ids','getMembers','findOne','User','sort','pick','nolimit','removeMembers','ChatGroupId','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','status','end','undefined','count','offset','Content-Range'];(function(_0x154f66,_0x116f85){var _0x3f947a=function(_0x1f671e){while(--_0x1f671e){_0x154f66['push'](_0x154f66['shift']());}};_0x3f947a(++_0x116f85);}(_0x114c,0x1bd));var _0xc114=function(_0x17cfbb,_0x1e6943){_0x17cfbb=_0x17cfbb-0x0;var _0xd149a6=_0x114c[_0x17cfbb];return _0xd149a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc114('0x0'));var zipdir=require(_0xc114('0x1'));var jsonpatch=require(_0xc114('0x2'));var rp=require('request-promise');var moment=require(_0xc114('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc114('0x4'));var util=require(_0xc114('0x5'));var path=require(_0xc114('0x6'));var sox=require(_0xc114('0x7'));var csv=require(_0xc114('0x8'));var ejs=require(_0xc114('0x9'));var fs=require('fs');var fs_extra=require(_0xc114('0xa'));var _=require(_0xc114('0xb'));var squel=require(_0xc114('0xc'));var crypto=require(_0xc114('0xd'));var jsforce=require(_0xc114('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc114('0x8'));var querystring=require(_0xc114('0xf'));var Papa=require(_0xc114('0x10'));var Redis=require(_0xc114('0x11'));var authService=require(_0xc114('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc114('0x13'));var utils=require(_0xc114('0x14'));var config=require(_0xc114('0x15'));var licenseUtil=require(_0xc114('0x16'));var db=require(_0xc114('0x17'))['db'];config[_0xc114('0x18')]=_[_0xc114('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc114('0x1a'))(new Redis(config[_0xc114('0x18')]));require(_0xc114('0x1b'))[_0xc114('0x1c')](socket);function respondWithStatusCode(_0x4c91cd,_0x13ece9){_0x13ece9=_0x13ece9||0xcc;return function(_0x2a7973){if(_0x2a7973){return _0x4c91cd['sendStatus'](_0x13ece9);}return _0x4c91cd[_0xc114('0x1d')](_0x13ece9)[_0xc114('0x1e')]();};}function respondWithResult(_0x48f1b2,_0x1d5240){_0x1d5240=_0x1d5240||0xc8;return function(_0x49a963){if(_0x49a963){return _0x48f1b2[_0xc114('0x1d')](_0x1d5240)['json'](_0x49a963);}};}function respondWithFilteredResult(_0x117411,_0x56535c){return function(_0x3302f4){if(_0x3302f4){var _0x5b1a5e=typeof _0x56535c['offset']===_0xc114('0x1f')&&typeof _0x56535c['limit']===_0xc114('0x1f');var _0x3cb540=_0x3302f4['count'];var _0xd632d3=_0x5b1a5e?0x0:_0x56535c['offset'];var _0x553412=_0x5b1a5e?_0x3302f4[_0xc114('0x20')]:_0x56535c[_0xc114('0x21')]+_0x56535c['limit'];var _0x45d7a1;if(_0x553412>=_0x3cb540){_0x553412=_0x3cb540;_0x45d7a1=0xc8;}else{_0x45d7a1=0xce;}_0x117411[_0xc114('0x1d')](_0x45d7a1);return _0x117411['set'](_0xc114('0x22'),_0xd632d3+'-'+_0x553412+'/'+_0x3cb540)[_0xc114('0x23')](_0x3302f4);}return null;};}function patchUpdates(_0x2a8eba){return function(_0x34e724){try{jsonpatch[_0xc114('0x24')](_0x34e724,_0x2a8eba,!![]);}catch(_0x12f1e4){return BPromise[_0xc114('0x25')](_0x12f1e4);}return _0x34e724['save']();};}function saveUpdates(_0x33a890,_0x27ed6f){return function(_0x41d4c7){if(_0x41d4c7){return _0x41d4c7[_0xc114('0x26')](_0x33a890)[_0xc114('0x27')](function(_0x4f2bea){return _0x4f2bea;});}return null;};}function removeEntity(_0x3a472a,_0x57b2ba){return function(_0x3fb031){if(_0x3fb031){return _0x3fb031[_0xc114('0x28')]()[_0xc114('0x27')](function(){_0x3a472a['status'](0xcc)[_0xc114('0x1e')]();});}};}function handleEntityNotFound(_0x560b86,_0x2d52c6){return function(_0x594dd4){if(!_0x594dd4){_0x560b86[_0xc114('0x29')](0x194);}return _0x594dd4;};}function handleError(_0x12ab5d,_0x42c6fd){_0x42c6fd=_0x42c6fd||0x1f4;return function(_0x27d3b4){logger[_0xc114('0x2a')](_0x27d3b4[_0xc114('0x2b')]);if(_0x27d3b4['name']){delete _0x27d3b4[_0xc114('0x2c')];}_0x12ab5d[_0xc114('0x1d')](_0x42c6fd)[_0xc114('0x2d')](_0x27d3b4);};}exports[_0xc114('0x2e')]=function(_0x56bff9,_0x20ae0e){var _0x5cdf90={},_0x37b065={},_0x3c0aa9={'count':0x0,'rows':[]};var _0x5f4283=_['map'](db[_0xc114('0x2f')][_0xc114('0x30')],function(_0x3f7d61){return{'name':_0x3f7d61[_0xc114('0x31')],'type':_0x3f7d61[_0xc114('0x32')][_0xc114('0x33')]};});_0x37b065['model']=_['map'](_0x5f4283,_0xc114('0x2c'));_0x37b065[_0xc114('0x34')]=_[_0xc114('0x35')](_0x56bff9[_0xc114('0x34')]);_0x37b065['filters']=_[_0xc114('0x36')](_0x37b065['model'],_0x37b065['query']);_0x5cdf90['attributes']=_[_0xc114('0x36')](_0x37b065[_0xc114('0x37')],qs[_0xc114('0x38')](_0x56bff9[_0xc114('0x34')][_0xc114('0x38')]));_0x5cdf90[_0xc114('0x39')]=_0x5cdf90['attributes']['length']?_0x5cdf90['attributes']:_0x37b065['model'];if(!_0x56bff9['query']['hasOwnProperty']('nolimit')){_0x5cdf90[_0xc114('0x3a')]=qs[_0xc114('0x3a')](_0x56bff9[_0xc114('0x34')]['limit']);_0x5cdf90[_0xc114('0x21')]=qs[_0xc114('0x21')](_0x56bff9[_0xc114('0x34')][_0xc114('0x21')]);}_0x5cdf90[_0xc114('0x3b')]=qs['sort'](_0x56bff9['query']['sort']);_0x5cdf90['where']=qs['filters'](_['pick'](_0x56bff9[_0xc114('0x34')],_0x37b065[_0xc114('0x3c')]),_0x5f4283);if(_0x56bff9[_0xc114('0x34')][_0xc114('0x3d')]){_0x5cdf90[_0xc114('0x3e')]=_[_0xc114('0x3f')](_0x5cdf90[_0xc114('0x3e')],{'$or':_[_0xc114('0x40')](_0x5f4283,function(_0x435be2){if(_0x435be2[_0xc114('0x32')]!=='VIRTUAL'){var _0x24536d={};_0x24536d[_0x435be2[_0xc114('0x2c')]]={'$like':'%'+_0x56bff9[_0xc114('0x34')]['filter']+'%'};return _0x24536d;}})});}_0x5cdf90=_[_0xc114('0x3f')]({},_0x5cdf90,_0x56bff9[_0xc114('0x41')]);var _0xacd3e8={'where':_0x5cdf90[_0xc114('0x3e')]};return db[_0xc114('0x2f')][_0xc114('0x20')](_0xacd3e8)[_0xc114('0x27')](function(_0x5617a6){_0x3c0aa9[_0xc114('0x20')]=_0x5617a6;if(_0x56bff9[_0xc114('0x34')][_0xc114('0x42')]){_0x5cdf90[_0xc114('0x43')]=[{'all':!![]}];}return db[_0xc114('0x2f')]['findAll'](_0x5cdf90);})[_0xc114('0x27')](function(_0x18ffd0){_0x3c0aa9[_0xc114('0x44')]=_0x18ffd0;return _0x3c0aa9;})[_0xc114('0x27')](respondWithFilteredResult(_0x20ae0e,_0x5cdf90))[_0xc114('0x45')](handleError(_0x20ae0e,null));};exports[_0xc114('0x46')]=function(_0x5bdb6a,_0x2c4da2){var _0x52438e={'raw':!![],'where':{'id':_0x5bdb6a[_0xc114('0x47')]['id']}},_0x284e9c={};_0x284e9c[_0xc114('0x37')]=_[_0xc114('0x35')](db[_0xc114('0x2f')]['rawAttributes']);_0x284e9c['query']=_[_0xc114('0x35')](_0x5bdb6a[_0xc114('0x34')]);_0x284e9c[_0xc114('0x3c')]=_[_0xc114('0x36')](_0x284e9c['model'],_0x284e9c[_0xc114('0x34')]);_0x52438e[_0xc114('0x39')]=_[_0xc114('0x36')](_0x284e9c[_0xc114('0x37')],qs[_0xc114('0x38')](_0x5bdb6a[_0xc114('0x34')][_0xc114('0x38')]));_0x52438e['attributes']=_0x52438e[_0xc114('0x39')][_0xc114('0x48')]?_0x52438e[_0xc114('0x39')]:_0x284e9c['model'];if(_0x5bdb6a[_0xc114('0x34')]['includeAll']){_0x52438e[_0xc114('0x43')]=[{'all':!![]}];}_0x52438e=_['merge']({},_0x52438e,_0x5bdb6a[_0xc114('0x41')]);return db[_0xc114('0x2f')]['find'](_0x52438e)['then'](handleEntityNotFound(_0x2c4da2,null))['then'](respondWithResult(_0x2c4da2,null))['catch'](handleError(_0x2c4da2,null));};exports[_0xc114('0x49')]=function(_0xca0d4b,_0x1d9d1d){return db[_0xc114('0x2f')][_0xc114('0x49')](_0xca0d4b['body'],{})[_0xc114('0x27')](respondWithResult(_0x1d9d1d,0xc9))[_0xc114('0x45')](handleError(_0x1d9d1d,null));};exports[_0xc114('0x26')]=function(_0xee4437,_0xc24b0c){if(_0xee4437[_0xc114('0x4a')]['id']){delete _0xee4437[_0xc114('0x4a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0xee4437[_0xc114('0x47')]['id']}})['then'](handleEntityNotFound(_0xc24b0c,null))[_0xc114('0x27')](saveUpdates(_0xee4437[_0xc114('0x4a')],null))[_0xc114('0x27')](respondWithResult(_0xc24b0c,null))[_0xc114('0x45')](handleError(_0xc24b0c,null));};exports[_0xc114('0x28')]=function(_0x17f2da,_0x495cec){return db[_0xc114('0x2f')]['find']({'where':{'id':_0x17f2da[_0xc114('0x47')]['id']}})[_0xc114('0x27')](handleEntityNotFound(_0x495cec,null))[_0xc114('0x27')](removeEntity(_0x495cec,null))[_0xc114('0x45')](handleError(_0x495cec,null));};exports[_0xc114('0x4b')]=function(_0x1d5b55,_0x1fb325){return db[_0xc114('0x2f')][_0xc114('0x4b')]()[_0xc114('0x27')](respondWithResult(_0x1fb325,null))[_0xc114('0x45')](handleError(_0x1fb325,null));};exports[_0xc114('0x4c')]=function(_0x2ed926,_0x3e9fd9,_0x5b5999){return db[_0xc114('0x4d')]['count']({'where':{'ChatGroupId':_0x2ed926[_0xc114('0x47')]['id'],'ToId':_0x2ed926[_0xc114('0x4e')]['id'],'read':![]}})['then'](function(_0x5ce09a){return{'id':_[_0xc114('0x4f')](_0x2ed926['params']['id']),'count':_0x5ce09a};})[_0xc114('0x27')](respondWithResult(_0x3e9fd9,null))[_0xc114('0x45')](handleError(_0x3e9fd9,null));};exports[_0xc114('0x50')]=function(_0x5b54ac,_0x15ed68,_0x5676f7){return db[_0xc114('0x2f')][_0xc114('0x51')]({'where':{'id':_0x5b54ac[_0xc114('0x47')]['id']}})[_0xc114('0x27')](handleEntityNotFound(_0x15ed68,null))['then'](function(_0x365084){if(_0x365084){return _0x365084['addMembers'](_0x5b54ac[_0xc114('0x4a')][_0xc114('0x52')],_['omit'](_0x5b54ac[_0xc114('0x4a')],['ids','id'])||{});}})[_0xc114('0x27')](respondWithResult(_0x15ed68,null))[_0xc114('0x45')](handleError(_0x15ed68,null));};exports[_0xc114('0x53')]=function(_0x2ccdfc,_0x4f4814,_0x243517){var _0x147fed={};var _0x585506={};var _0x4b8d98;var _0x135a9c;return db[_0xc114('0x2f')][_0xc114('0x54')]({'where':{'id':_0x2ccdfc[_0xc114('0x47')]['id']}})[_0xc114('0x27')](handleEntityNotFound(_0x4f4814,null))['then'](function(_0x2d8d6c){if(_0x2d8d6c){_0x4b8d98=_0x2d8d6c;_0x585506[_0xc114('0x37')]=_['keys'](db[_0xc114('0x55')][_0xc114('0x30')]);_0x585506[_0xc114('0x34')]=_[_0xc114('0x35')](_0x2ccdfc['query']);_0x585506[_0xc114('0x3c')]=_[_0xc114('0x36')](_0x585506[_0xc114('0x37')],_0x585506[_0xc114('0x34')]);_0x147fed[_0xc114('0x39')]=_[_0xc114('0x36')](_0x585506[_0xc114('0x37')],qs[_0xc114('0x38')](_0x2ccdfc['query'][_0xc114('0x38')]));_0x147fed[_0xc114('0x39')]=_0x147fed[_0xc114('0x39')][_0xc114('0x48')]?_0x147fed['attributes']:_0x585506[_0xc114('0x37')];_0x147fed['order']=qs[_0xc114('0x56')](_0x2ccdfc[_0xc114('0x34')][_0xc114('0x56')]);_0x147fed[_0xc114('0x3e')]=qs[_0xc114('0x3c')](_[_0xc114('0x57')](_0x2ccdfc['query'],_0x585506[_0xc114('0x3c')]));if(_0x2ccdfc[_0xc114('0x34')][_0xc114('0x3d')]){_0x147fed['where']=_[_0xc114('0x3f')](_0x147fed[_0xc114('0x3e')],{'$or':_['map'](_0x147fed[_0xc114('0x39')],function(_0x6cd687){var _0x46db73={};_0x46db73[_0x6cd687]={'$like':'%'+_0x2ccdfc[_0xc114('0x34')][_0xc114('0x3d')]+'%'};return _0x46db73;})});}_0x147fed=_['merge']({},_0x147fed,_0x2ccdfc[_0xc114('0x41')]);return _0x4b8d98[_0xc114('0x53')](_0x147fed);}})[_0xc114('0x27')](function(_0x49c0c7){if(_0x49c0c7){_0x135a9c=_0x49c0c7[_0xc114('0x48')];if(!_0x2ccdfc[_0xc114('0x34')]['hasOwnProperty'](_0xc114('0x58'))){_0x147fed[_0xc114('0x3a')]=qs['limit'](_0x2ccdfc[_0xc114('0x34')][_0xc114('0x3a')]);_0x147fed[_0xc114('0x21')]=qs[_0xc114('0x21')](_0x2ccdfc['query'][_0xc114('0x21')]);}return _0x4b8d98[_0xc114('0x53')](_0x147fed);}})['then'](function(_0x30d401){if(_0x30d401){return _0x30d401?{'count':_0x135a9c,'rows':_0x30d401}:null;}})['then'](respondWithResult(_0x4f4814,null))[_0xc114('0x45')](handleError(_0x4f4814,null));};exports[_0xc114('0x59')]=function(_0x2692dd,_0x43638e,_0x1c8742){return db[_0xc114('0x2f')]['find']({'where':{'id':_0x2692dd['params']['id']}})['then'](handleEntityNotFound(_0x43638e,null))['then'](function(_0xdff876){if(_0xdff876){return _0xdff876[_0xc114('0x59')](_0x2692dd[_0xc114('0x34')][_0xc114('0x52')]);}})[_0xc114('0x27')](respondWithStatusCode(_0x43638e,null))[_0xc114('0x45')](handleError(_0x43638e,null));};exports['addMessage']=function(_0x64b466,_0x1016bf,_0x31376e){if(_0x64b466[_0xc114('0x4a')]['id']){delete _0x64b466['body']['id'];}return db[_0xc114('0x2f')][_0xc114('0x51')]({'where':{'id':_0x64b466[_0xc114('0x47')]['id']}})['then'](handleEntityNotFound(_0x1016bf,null))[_0xc114('0x27')](function(_0x4430c6){if(_0x4430c6){_0x64b466['body'][_0xc114('0x5a')]=_0x4430c6['id'];return db[_0xc114('0x4d')][_0xc114('0x49')](_0x64b466['body']);}})['then'](respondWithResult(_0x1016bf,null))['catch'](handleError(_0x1016bf,null));};exports[_0xc114('0x5b')]=function(_0x51234f,_0xa31a04,_0xce5758){var _0x1aa9e7={};var _0x383b1d={};var _0x138bd1;var _0x87ff4;return db[_0xc114('0x2f')][_0xc114('0x54')]({'where':{'id':_0x51234f['params']['id']}})[_0xc114('0x27')](handleEntityNotFound(_0xa31a04,null))[_0xc114('0x27')](function(_0x215170){if(_0x215170){_0x138bd1=_0x215170;_0x383b1d[_0xc114('0x37')]=_['keys'](db[_0xc114('0x4d')][_0xc114('0x30')]);_0x383b1d['query']=_['keys'](_0x51234f[_0xc114('0x34')]);_0x383b1d[_0xc114('0x3c')]=_[_0xc114('0x36')](_0x383b1d[_0xc114('0x37')],_0x383b1d[_0xc114('0x34')]);_0x1aa9e7[_0xc114('0x39')]=_[_0xc114('0x36')](_0x383b1d['model'],qs[_0xc114('0x38')](_0x51234f[_0xc114('0x34')]['fields']));_0x1aa9e7[_0xc114('0x39')]=_0x1aa9e7[_0xc114('0x39')][_0xc114('0x48')]?_0x1aa9e7[_0xc114('0x39')]:_0x383b1d[_0xc114('0x37')];_0x1aa9e7['order']=qs[_0xc114('0x56')](_0x51234f[_0xc114('0x34')][_0xc114('0x56')]);_0x1aa9e7['where']=qs[_0xc114('0x3c')](_[_0xc114('0x57')](_0x51234f[_0xc114('0x34')],_0x383b1d['filters']));if(_0x51234f[_0xc114('0x34')]['filter']){_0x1aa9e7[_0xc114('0x3e')]=_['merge'](_0x1aa9e7[_0xc114('0x3e')],{'$or':_[_0xc114('0x40')](_0x1aa9e7['attributes'],function(_0xe12985){var _0x5cbc71={};_0x5cbc71[_0xe12985]={'$like':'%'+_0x51234f['query']['filter']+'%'};return _0x5cbc71;})});}if(_0x51234f[_0xc114('0x34')]['$gte']){var _0x45cdbe=_0x51234f[_0xc114('0x34')]['$gte'][_0xc114('0x5c')](',');var _0x504d5e={};_0x504d5e[_0x45cdbe[0x0]]={'$gte':moment(_0x45cdbe[0x1])[_0xc114('0x5d')](_0xc114('0x5e'))};_0x1aa9e7[_0xc114('0x3e')]=_[_0xc114('0x3f')](_0x1aa9e7[_0xc114('0x3e')],_0x504d5e);}_0x1aa9e7=_['merge']({},_0x1aa9e7,_0x51234f['options']);return _0x138bd1['getMessages'](_0x1aa9e7);}})['then'](function(_0x5a445d){if(_0x5a445d){_0x87ff4=_0x5a445d[_0xc114('0x48')];if(!_0x51234f['query'][_0xc114('0x5f')](_0xc114('0x58'))){_0x1aa9e7[_0xc114('0x3a')]=qs[_0xc114('0x3a')](_0x51234f[_0xc114('0x34')]['limit']);_0x1aa9e7['offset']=qs[_0xc114('0x21')](_0x51234f[_0xc114('0x34')][_0xc114('0x21')]);}return _0x138bd1['getMessages'](_0x1aa9e7);}})[_0xc114('0x27')](function(_0x5b5b4b){if(_0x5b5b4b){return _0x5b5b4b?{'count':_0x87ff4,'rows':_0x5b5b4b}:null;}})[_0xc114('0x27')](respondWithResult(_0xa31a04,null))['catch'](handleError(_0xa31a04,null));}; \ No newline at end of file +var _0xad4e=['split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','name','index','map','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','ChatGroup','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','omit','ids','getMembers','findOne','removeMembers','addMessage','getMessages','ChatInternalMessage','$gte'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xad4e,0x193));var _0xead4=function(_0x58c2b6,_0x4e1367){_0x58c2b6=_0x58c2b6-0x0;var _0x263278=_0xad4e[_0x58c2b6];return _0x263278;};'use strict';var emlformat=require(_0xead4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xead4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xead4('0x2'));var moment=require(_0xead4('0x3'));var BPromise=require(_0xead4('0x4'));var Mustache=require(_0xead4('0x5'));var util=require(_0xead4('0x6'));var path=require(_0xead4('0x7'));var sox=require(_0xead4('0x8'));var csv=require('to-csv');var ejs=require(_0xead4('0x9'));var fs=require('fs');var fs_extra=require(_0xead4('0xa'));var _=require(_0xead4('0xb'));var squel=require(_0xead4('0xc'));var crypto=require(_0xead4('0xd'));var jsforce=require(_0xead4('0xe'));var deskjs=require(_0xead4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xead4('0x10'));var Papa=require(_0xead4('0x11'));var Redis=require(_0xead4('0x12'));var authService=require(_0xead4('0x13'));var qs=require(_0xead4('0x14'));var as=require(_0xead4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xead4('0x16'))(_0xead4('0x17'));var utils=require(_0xead4('0x18'));var config=require(_0xead4('0x19'));var licenseUtil=require(_0xead4('0x1a'));var db=require(_0xead4('0x1b'))['db'];config[_0xead4('0x1c')]=_[_0xead4('0x1d')](config[_0xead4('0x1c')],{'host':_0xead4('0x1e'),'port':0x18eb});var socket=require(_0xead4('0x1f'))(new Redis(config['redis']));require(_0xead4('0x20'))[_0xead4('0x21')](socket);function respondWithStatusCode(_0x25dd41,_0x127a65){_0x127a65=_0x127a65||0xcc;return function(_0x2f8c9d){if(_0x2f8c9d){return _0x25dd41['sendStatus'](_0x127a65);}return _0x25dd41[_0xead4('0x22')](_0x127a65)[_0xead4('0x23')]();};}function respondWithResult(_0x162882,_0x4e5b5c){_0x4e5b5c=_0x4e5b5c||0xc8;return function(_0x173c75){if(_0x173c75){return _0x162882[_0xead4('0x22')](_0x4e5b5c)[_0xead4('0x24')](_0x173c75);}};}function respondWithFilteredResult(_0x38f094,_0x4c5365){return function(_0x587749){if(_0x587749){var _0x2f5f5b=typeof _0x4c5365[_0xead4('0x25')]===_0xead4('0x26')&&typeof _0x4c5365['limit']===_0xead4('0x26');var _0x4b6da9=_0x587749[_0xead4('0x27')];var _0x3360e8=_0x2f5f5b?0x0:_0x4c5365[_0xead4('0x25')];var _0x5db500=_0x2f5f5b?_0x587749['count']:_0x4c5365[_0xead4('0x25')]+_0x4c5365[_0xead4('0x28')];var _0x2888f6;if(_0x5db500>=_0x4b6da9){_0x5db500=_0x4b6da9;_0x2888f6=0xc8;}else{_0x2888f6=0xce;}_0x38f094[_0xead4('0x22')](_0x2888f6);return _0x38f094[_0xead4('0x29')](_0xead4('0x2a'),_0x3360e8+'-'+_0x5db500+'/'+_0x4b6da9)[_0xead4('0x24')](_0x587749);}return null;};}function patchUpdates(_0x530c72){return function(_0x4dc6f1){try{jsonpatch[_0xead4('0x2b')](_0x4dc6f1,_0x530c72,!![]);}catch(_0x21064f){return BPromise['reject'](_0x21064f);}return _0x4dc6f1[_0xead4('0x2c')]();};}function saveUpdates(_0x92b0b4,_0x24a9b7){return function(_0x149044){if(_0x149044){return _0x149044[_0xead4('0x2d')](_0x92b0b4)[_0xead4('0x2e')](function(_0x42f468){return _0x42f468;});}return null;};}function removeEntity(_0x5be9c2,_0x1f5a9a){return function(_0x3ca4b8){if(_0x3ca4b8){return _0x3ca4b8['destroy']()[_0xead4('0x2e')](function(){_0x5be9c2['status'](0xcc)[_0xead4('0x23')]();});}};}function handleEntityNotFound(_0x1d2b69,_0x18a0d2){return function(_0x4cc199){if(!_0x4cc199){_0x1d2b69[_0xead4('0x2f')](0x194);}return _0x4cc199;};}function handleError(_0x3b852b,_0x5d2808){_0x5d2808=_0x5d2808||0x1f4;return function(_0x25d060){logger[_0xead4('0x30')](_0x25d060['stack']);if(_0x25d060[_0xead4('0x31')]){delete _0x25d060[_0xead4('0x31')];}_0x3b852b[_0xead4('0x22')](_0x5d2808)['send'](_0x25d060);};}exports[_0xead4('0x32')]=function(_0x46842c,_0x1f1562){var _0x576abf={},_0x6ad12d={},_0x2b6592={'count':0x0,'rows':[]};var _0x371053=_[_0xead4('0x33')](db['ChatGroup']['rawAttributes'],function(_0x505a51){return{'name':_0x505a51['fieldName'],'type':_0x505a51[_0xead4('0x34')]['key']};});_0x6ad12d['model']=_[_0xead4('0x33')](_0x371053,'name');_0x6ad12d[_0xead4('0x35')]=_[_0xead4('0x36')](_0x46842c[_0xead4('0x35')]);_0x6ad12d[_0xead4('0x37')]=_[_0xead4('0x38')](_0x6ad12d['model'],_0x6ad12d[_0xead4('0x35')]);_0x576abf['attributes']=_[_0xead4('0x38')](_0x6ad12d[_0xead4('0x39')],qs[_0xead4('0x3a')](_0x46842c['query'][_0xead4('0x3a')]));_0x576abf[_0xead4('0x3b')]=_0x576abf[_0xead4('0x3b')][_0xead4('0x3c')]?_0x576abf[_0xead4('0x3b')]:_0x6ad12d[_0xead4('0x39')];if(!_0x46842c[_0xead4('0x35')][_0xead4('0x3d')](_0xead4('0x3e'))){_0x576abf['limit']=qs['limit'](_0x46842c[_0xead4('0x35')][_0xead4('0x28')]);_0x576abf['offset']=qs[_0xead4('0x25')](_0x46842c[_0xead4('0x35')]['offset']);}_0x576abf[_0xead4('0x3f')]=qs[_0xead4('0x40')](_0x46842c[_0xead4('0x35')]['sort']);_0x576abf[_0xead4('0x41')]=qs[_0xead4('0x37')](_[_0xead4('0x42')](_0x46842c[_0xead4('0x35')],_0x6ad12d[_0xead4('0x37')]),_0x371053);if(_0x46842c[_0xead4('0x35')]['filter']){_0x576abf[_0xead4('0x41')]=_[_0xead4('0x43')](_0x576abf[_0xead4('0x41')],{'$or':_[_0xead4('0x33')](_0x371053,function(_0x5023af){if(_0x5023af[_0xead4('0x34')]!=='VIRTUAL'){var _0x4a0782={};_0x4a0782[_0x5023af[_0xead4('0x31')]]={'$like':'%'+_0x46842c[_0xead4('0x35')][_0xead4('0x44')]+'%'};return _0x4a0782;}})});}_0x576abf=_['merge']({},_0x576abf,_0x46842c[_0xead4('0x45')]);var _0x24e04f={'where':_0x576abf[_0xead4('0x41')]};return db[_0xead4('0x46')][_0xead4('0x27')](_0x24e04f)[_0xead4('0x2e')](function(_0x138f33){_0x2b6592['count']=_0x138f33;if(_0x46842c['query'][_0xead4('0x47')]){_0x576abf[_0xead4('0x48')]=[{'all':!![]}];}return db[_0xead4('0x46')][_0xead4('0x49')](_0x576abf);})['then'](function(_0x2331f5){_0x2b6592[_0xead4('0x4a')]=_0x2331f5;return _0x2b6592;})['then'](respondWithFilteredResult(_0x1f1562,_0x576abf))[_0xead4('0x4b')](handleError(_0x1f1562,null));};exports[_0xead4('0x4c')]=function(_0x1742ab,_0x1a6408){var _0x2ea64e={'raw':!![],'where':{'id':_0x1742ab[_0xead4('0x4d')]['id']}},_0x29173e={};_0x29173e[_0xead4('0x39')]=_[_0xead4('0x36')](db[_0xead4('0x46')][_0xead4('0x4e')]);_0x29173e[_0xead4('0x35')]=_[_0xead4('0x36')](_0x1742ab[_0xead4('0x35')]);_0x29173e[_0xead4('0x37')]=_[_0xead4('0x38')](_0x29173e[_0xead4('0x39')],_0x29173e[_0xead4('0x35')]);_0x2ea64e['attributes']=_[_0xead4('0x38')](_0x29173e['model'],qs[_0xead4('0x3a')](_0x1742ab[_0xead4('0x35')]['fields']));_0x2ea64e[_0xead4('0x3b')]=_0x2ea64e[_0xead4('0x3b')][_0xead4('0x3c')]?_0x2ea64e[_0xead4('0x3b')]:_0x29173e['model'];if(_0x1742ab['query'][_0xead4('0x47')]){_0x2ea64e[_0xead4('0x48')]=[{'all':!![]}];}_0x2ea64e=_[_0xead4('0x43')]({},_0x2ea64e,_0x1742ab[_0xead4('0x45')]);return db['ChatGroup'][_0xead4('0x4f')](_0x2ea64e)[_0xead4('0x2e')](handleEntityNotFound(_0x1a6408,null))[_0xead4('0x2e')](respondWithResult(_0x1a6408,null))['catch'](handleError(_0x1a6408,null));};exports[_0xead4('0x50')]=function(_0xdc8bb8,_0x4a92dc){return db[_0xead4('0x46')][_0xead4('0x50')](_0xdc8bb8[_0xead4('0x51')],{})[_0xead4('0x2e')](respondWithResult(_0x4a92dc,0xc9))['catch'](handleError(_0x4a92dc,null));};exports[_0xead4('0x2d')]=function(_0x245cc3,_0xdf02c7){if(_0x245cc3[_0xead4('0x51')]['id']){delete _0x245cc3['body']['id'];}return db[_0xead4('0x46')][_0xead4('0x4f')]({'where':{'id':_0x245cc3[_0xead4('0x4d')]['id']}})[_0xead4('0x2e')](handleEntityNotFound(_0xdf02c7,null))['then'](saveUpdates(_0x245cc3['body'],null))['then'](respondWithResult(_0xdf02c7,null))[_0xead4('0x4b')](handleError(_0xdf02c7,null));};exports[_0xead4('0x52')]=function(_0x19044f,_0x23c03f){return db[_0xead4('0x46')][_0xead4('0x4f')]({'where':{'id':_0x19044f[_0xead4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23c03f,null))['then'](removeEntity(_0x23c03f,null))[_0xead4('0x4b')](handleError(_0x23c03f,null));};exports[_0xead4('0x53')]=function(_0x5f324d,_0x2ce19b){return db[_0xead4('0x46')]['describe']()['then'](respondWithResult(_0x2ce19b,null))[_0xead4('0x4b')](handleError(_0x2ce19b,null));};exports[_0xead4('0x54')]=function(_0x3e1dca,_0x3d19c0,_0x3b6ab1){return db['ChatInternalMessage'][_0xead4('0x27')]({'where':{'ChatGroupId':_0x3e1dca[_0xead4('0x4d')]['id'],'ToId':_0x3e1dca[_0xead4('0x55')]['id'],'read':![]}})[_0xead4('0x2e')](function(_0xb8f5a){return{'id':_[_0xead4('0x56')](_0x3e1dca['params']['id']),'count':_0xb8f5a};})[_0xead4('0x2e')](respondWithResult(_0x3d19c0,null))['catch'](handleError(_0x3d19c0,null));};exports[_0xead4('0x57')]=function(_0x348661,_0x439099,_0x3c3ec6){return db[_0xead4('0x46')][_0xead4('0x4f')]({'where':{'id':_0x348661[_0xead4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x439099,null))[_0xead4('0x2e')](function(_0xc0c90c){if(_0xc0c90c){return _0xc0c90c['addMembers'](_0x348661[_0xead4('0x51')]['ids'],_[_0xead4('0x58')](_0x348661[_0xead4('0x51')],[_0xead4('0x59'),'id'])||{});}})[_0xead4('0x2e')](respondWithResult(_0x439099,null))['catch'](handleError(_0x439099,null));};exports[_0xead4('0x5a')]=function(_0x2b0516,_0x9008c5,_0x3e1fc5){var _0x24355e={};var _0x16cfe={};var _0x49417f;var _0xbdf9b0;return db['ChatGroup'][_0xead4('0x5b')]({'where':{'id':_0x2b0516['params']['id']}})['then'](handleEntityNotFound(_0x9008c5,null))[_0xead4('0x2e')](function(_0x42e9c9){if(_0x42e9c9){_0x49417f=_0x42e9c9;_0x16cfe[_0xead4('0x39')]=_[_0xead4('0x36')](db['User'][_0xead4('0x4e')]);_0x16cfe['query']=_[_0xead4('0x36')](_0x2b0516[_0xead4('0x35')]);_0x16cfe[_0xead4('0x37')]=_[_0xead4('0x38')](_0x16cfe['model'],_0x16cfe['query']);_0x24355e[_0xead4('0x3b')]=_[_0xead4('0x38')](_0x16cfe[_0xead4('0x39')],qs['fields'](_0x2b0516['query'][_0xead4('0x3a')]));_0x24355e[_0xead4('0x3b')]=_0x24355e[_0xead4('0x3b')][_0xead4('0x3c')]?_0x24355e['attributes']:_0x16cfe['model'];_0x24355e[_0xead4('0x3f')]=qs[_0xead4('0x40')](_0x2b0516[_0xead4('0x35')][_0xead4('0x40')]);_0x24355e[_0xead4('0x41')]=qs[_0xead4('0x37')](_[_0xead4('0x42')](_0x2b0516[_0xead4('0x35')],_0x16cfe['filters']));if(_0x2b0516[_0xead4('0x35')][_0xead4('0x44')]){_0x24355e[_0xead4('0x41')]=_[_0xead4('0x43')](_0x24355e[_0xead4('0x41')],{'$or':_[_0xead4('0x33')](_0x24355e[_0xead4('0x3b')],function(_0x766df1){var _0x93129d={};_0x93129d[_0x766df1]={'$like':'%'+_0x2b0516[_0xead4('0x35')][_0xead4('0x44')]+'%'};return _0x93129d;})});}_0x24355e=_[_0xead4('0x43')]({},_0x24355e,_0x2b0516[_0xead4('0x45')]);return _0x49417f['getMembers'](_0x24355e);}})[_0xead4('0x2e')](function(_0x434e64){if(_0x434e64){_0xbdf9b0=_0x434e64[_0xead4('0x3c')];if(!_0x2b0516['query'][_0xead4('0x3d')](_0xead4('0x3e'))){_0x24355e[_0xead4('0x28')]=qs['limit'](_0x2b0516[_0xead4('0x35')]['limit']);_0x24355e[_0xead4('0x25')]=qs[_0xead4('0x25')](_0x2b0516[_0xead4('0x35')][_0xead4('0x25')]);}return _0x49417f[_0xead4('0x5a')](_0x24355e);}})[_0xead4('0x2e')](function(_0x22d821){if(_0x22d821){return _0x22d821?{'count':_0xbdf9b0,'rows':_0x22d821}:null;}})['then'](respondWithResult(_0x9008c5,null))['catch'](handleError(_0x9008c5,null));};exports[_0xead4('0x5c')]=function(_0x3684e6,_0xafe5c9,_0x44ea75){return db[_0xead4('0x46')][_0xead4('0x4f')]({'where':{'id':_0x3684e6[_0xead4('0x4d')]['id']}})[_0xead4('0x2e')](handleEntityNotFound(_0xafe5c9,null))[_0xead4('0x2e')](function(_0xb2f592){if(_0xb2f592){return _0xb2f592[_0xead4('0x5c')](_0x3684e6[_0xead4('0x35')][_0xead4('0x59')]);}})[_0xead4('0x2e')](respondWithStatusCode(_0xafe5c9,null))['catch'](handleError(_0xafe5c9,null));};exports[_0xead4('0x5d')]=function(_0x56ce39,_0x7614e0,_0x115768){if(_0x56ce39['body']['id']){delete _0x56ce39[_0xead4('0x51')]['id'];}return db[_0xead4('0x46')][_0xead4('0x4f')]({'where':{'id':_0x56ce39[_0xead4('0x4d')]['id']}})[_0xead4('0x2e')](handleEntityNotFound(_0x7614e0,null))[_0xead4('0x2e')](function(_0x48252c){if(_0x48252c){_0x56ce39[_0xead4('0x51')]['ChatGroupId']=_0x48252c['id'];return db['ChatInternalMessage'][_0xead4('0x50')](_0x56ce39[_0xead4('0x51')]);}})[_0xead4('0x2e')](respondWithResult(_0x7614e0,null))[_0xead4('0x4b')](handleError(_0x7614e0,null));};exports[_0xead4('0x5e')]=function(_0x1d82d9,_0x1decdd,_0x4cdeba){var _0x5c2d85={};var _0x399ff2={};var _0x1fedb4;var _0x5cfdb9;return db[_0xead4('0x46')][_0xead4('0x5b')]({'where':{'id':_0x1d82d9['params']['id']}})['then'](handleEntityNotFound(_0x1decdd,null))[_0xead4('0x2e')](function(_0xdb1ca2){if(_0xdb1ca2){_0x1fedb4=_0xdb1ca2;_0x399ff2[_0xead4('0x39')]=_[_0xead4('0x36')](db[_0xead4('0x5f')][_0xead4('0x4e')]);_0x399ff2[_0xead4('0x35')]=_[_0xead4('0x36')](_0x1d82d9[_0xead4('0x35')]);_0x399ff2['filters']=_[_0xead4('0x38')](_0x399ff2['model'],_0x399ff2['query']);_0x5c2d85['attributes']=_[_0xead4('0x38')](_0x399ff2[_0xead4('0x39')],qs[_0xead4('0x3a')](_0x1d82d9[_0xead4('0x35')]['fields']));_0x5c2d85[_0xead4('0x3b')]=_0x5c2d85['attributes']['length']?_0x5c2d85[_0xead4('0x3b')]:_0x399ff2[_0xead4('0x39')];_0x5c2d85[_0xead4('0x3f')]=qs[_0xead4('0x40')](_0x1d82d9[_0xead4('0x35')][_0xead4('0x40')]);_0x5c2d85[_0xead4('0x41')]=qs['filters'](_[_0xead4('0x42')](_0x1d82d9[_0xead4('0x35')],_0x399ff2['filters']));if(_0x1d82d9[_0xead4('0x35')][_0xead4('0x44')]){_0x5c2d85[_0xead4('0x41')]=_[_0xead4('0x43')](_0x5c2d85[_0xead4('0x41')],{'$or':_['map'](_0x5c2d85[_0xead4('0x3b')],function(_0x4ef430){var _0xdb3907={};_0xdb3907[_0x4ef430]={'$like':'%'+_0x1d82d9[_0xead4('0x35')][_0xead4('0x44')]+'%'};return _0xdb3907;})});}if(_0x1d82d9[_0xead4('0x35')][_0xead4('0x60')]){var _0x47d6fb=_0x1d82d9[_0xead4('0x35')]['$gte'][_0xead4('0x61')](',');var _0x55c2ea={};_0x55c2ea[_0x47d6fb[0x0]]={'$gte':moment(_0x47d6fb[0x1])[_0xead4('0x62')](_0xead4('0x63'))};_0x5c2d85[_0xead4('0x41')]=_[_0xead4('0x43')](_0x5c2d85[_0xead4('0x41')],_0x55c2ea);}_0x5c2d85=_['merge']({},_0x5c2d85,_0x1d82d9[_0xead4('0x45')]);return _0x1fedb4[_0xead4('0x5e')](_0x5c2d85);}})[_0xead4('0x2e')](function(_0x1dee00){if(_0x1dee00){_0x5cfdb9=_0x1dee00['length'];if(!_0x1d82d9[_0xead4('0x35')][_0xead4('0x3d')]('nolimit')){_0x5c2d85[_0xead4('0x28')]=qs['limit'](_0x1d82d9[_0xead4('0x35')]['limit']);_0x5c2d85[_0xead4('0x25')]=qs['offset'](_0x1d82d9[_0xead4('0x35')]['offset']);}return _0x1fedb4['getMessages'](_0x5c2d85);}})['then'](function(_0x3cbabe){if(_0x3cbabe){return _0x3cbabe?{'count':_0x5cfdb9,'rows':_0x3cbabe}:null;}})[_0xead4('0x2e')](respondWithResult(_0x1decdd,null))[_0xead4('0x4b')](handleError(_0x1decdd,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6f4f43e..487d6ae 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 _0x7c71=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x295b80,_0x3bf87d){var _0xfc29b6=function(_0x4d0e5f){while(--_0x4d0e5f){_0x295b80['push'](_0x295b80['shift']());}};_0xfc29b6(++_0x3bf87d);}(_0x7c71,0x177));var _0x17c7=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x7c71[_0x2f1762];return _0x8ab21;};'use strict';var EventEmitter=require(_0x17c7('0x0'));var ChatGroup=require(_0x17c7('0x1'))['db'][_0x17c7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x17c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17c7('0x4'),'afterDestroy':_0x17c7('0x5')};function emitEvent(_0x3f9105){return function(_0x5a4923,_0x4fed29,_0xa4e319){ChatGroupEvents[_0x17c7('0x6')](_0x3f9105+':'+_0x5a4923['id'],_0x5a4923);ChatGroupEvents[_0x17c7('0x6')](_0x3f9105,_0x5a4923);_0xa4e319(null);};}for(var e in events){if(events[_0x17c7('0x7')](e)){var event=events[e];ChatGroup[_0x17c7('0x8')](e,emitEvent(event));}}module[_0x17c7('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x667c=['events','setMaxListeners','save','update','remove','emit','exports'];(function(_0x1b0855,_0x291173){var _0x10a7d7=function(_0x54d0f5){while(--_0x54d0f5){_0x1b0855['push'](_0x1b0855['shift']());}};_0x10a7d7(++_0x291173);}(_0x667c,0xcb));var _0xc667=function(_0x211191,_0x4528cc){_0x211191=_0x211191-0x0;var _0x4cb3bc=_0x667c[_0x211191];return _0x4cb3bc;};'use strict';var EventEmitter=require(_0xc667('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc667('0x1')](0x0);var events={'afterCreate':_0xc667('0x2'),'afterUpdate':_0xc667('0x3'),'afterDestroy':_0xc667('0x4')};function emitEvent(_0x4db372){return function(_0x523274,_0x341efd,_0x3dd155){ChatGroupEvents[_0xc667('0x5')](_0x4db372+':'+_0x523274['id'],_0x523274);ChatGroupEvents[_0xc667('0x5')](_0x4db372,_0x523274);_0x3dd155(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xc667('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3ab90d2..959ae9d 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 _0x9e45=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5b119c,_0x49403e){var _0x1af35b=function(_0x563175){while(--_0x563175){_0x5b119c['push'](_0x5b119c['shift']());}};_0x1af35b(++_0x49403e);}(_0x9e45,0x1e8));var _0x59e4=function(_0xccd4d3,_0xec2028){_0xccd4d3=_0xccd4d3-0x0;var _0xca752=_0x9e45[_0xccd4d3];return _0xca752;};'use strict';var _=require(_0x59e4('0x0'));var util=require(_0x59e4('0x1'));var logger=require('../../config/logger')(_0x59e4('0x2'));var moment=require(_0x59e4('0x3'));var BPromise=require(_0x59e4('0x4'));var rp=require(_0x59e4('0x5'));var fs=require('fs');var path=require(_0x59e4('0x6'));var rimraf=require(_0x59e4('0x7'));var config=require('../../config/environment');var attributes=require(_0x59e4('0x8'));module[_0x59e4('0x9')]=function(_0x1ca339,_0x4235a9){return _0x1ca339[_0x59e4('0xa')](_0x59e4('0xb'),attributes,{'tableName':_0x59e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd0=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1a8038,_0x328e14){var _0x2217a3=function(_0x506663){while(--_0x506663){_0x1a8038['push'](_0x1a8038['shift']());}};_0x2217a3(++_0x328e14);}(_0x0fd0,0xa1));var _0x00fd=function(_0x1661ac,_0x193baa){_0x1661ac=_0x1661ac-0x0;var _0x32a4cf=_0x0fd0[_0x1661ac];return _0x32a4cf;};'use strict';var _=require(_0x00fd('0x0'));var util=require(_0x00fd('0x1'));var logger=require(_0x00fd('0x2'))(_0x00fd('0x3'));var moment=require(_0x00fd('0x4'));var BPromise=require(_0x00fd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00fd('0x6'));var rimraf=require(_0x00fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x00fd('0x8'));module[_0x00fd('0x9')]=function(_0x1f06bd,_0x5cd4f6){return _0x1f06bd[_0x00fd('0xa')](_0x00fd('0xb'),attributes,{'tableName':_0x00fd('0xc'),'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 c42e804..d06fd0e 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 _0xba2d=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatGroup.socket','register','info'];(function(_0x283e62,_0x327cbb){var _0x409c32=function(_0x42c1cf){while(--_0x42c1cf){_0x283e62['push'](_0x283e62['shift']());}};_0x409c32(++_0x327cbb);}(_0xba2d,0xa3));var _0xdba2=function(_0x54f8a7,_0x59b843){_0x54f8a7=_0x54f8a7-0x0;var _0x1275d2=_0xba2d[_0x54f8a7];return _0x1275d2;};'use strict';var _=require('lodash');var util=require(_0xdba2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdba2('0x1'));var logger=require(_0xdba2('0x2'))(_0xdba2('0x3'));var config=require(_0xdba2('0x4'));var jayson=require(_0xdba2('0x5'));var client=jayson[_0xdba2('0x6')][_0xdba2('0x7')]({'port':0x232a});config[_0xdba2('0x8')]=_['defaults'](config[_0xdba2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xdba2('0x9'))(new Redis(config[_0xdba2('0x8')]));require(_0xdba2('0xa'))[_0xdba2('0xb')](socket);function respondWithRpcPromise(_0x28324a,_0x3aea25,_0x4ee95c){return new BPromise(function(_0x2f50a9,_0x49ab14){return client['request'](_0x28324a,_0x4ee95c)['then'](function(_0x16aa87){logger[_0xdba2('0xc')](_0xdba2('0xd'),_0x3aea25,_0xdba2('0xe'));logger[_0xdba2('0xf')](_0xdba2('0x10'),_0x3aea25,_0xdba2('0xe'),JSON[_0xdba2('0x11')](_0x16aa87));if(_0x16aa87[_0xdba2('0x12')]){if(_0x16aa87[_0xdba2('0x12')][_0xdba2('0x13')]===0x1f4){logger[_0xdba2('0x12')](_0xdba2('0xd'),_0x3aea25,_0x16aa87[_0xdba2('0x12')][_0xdba2('0x14')]);return _0x49ab14(_0x16aa87[_0xdba2('0x12')]['message']);}logger['error'](_0xdba2('0xd'),_0x3aea25,_0x16aa87['error'][_0xdba2('0x14')]);return _0x2f50a9(_0x16aa87[_0xdba2('0x12')]['message']);}else{logger[_0xdba2('0xc')]('ChatGroup,\x20%s,\x20%s',_0x3aea25,_0xdba2('0xe'));_0x2f50a9(_0x16aa87['result'][_0xdba2('0x14')]);}})[_0xdba2('0x15')](function(_0x1b67ec){logger[_0xdba2('0x12')](_0xdba2('0xd'),_0x3aea25,_0x1b67ec);_0x49ab14(_0x1b67ec);});});} \ No newline at end of file +var _0x96a2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch'];(function(_0x14ce08,_0x33d98a){var _0x4c41ce=function(_0x33d662){while(--_0x33d662){_0x14ce08['push'](_0x14ce08['shift']());}};_0x4c41ce(++_0x33d98a);}(_0x96a2,0x96));var _0x296a=function(_0x89eff6,_0x1138e2){_0x89eff6=_0x89eff6-0x0;var _0x128b93=_0x96a2[_0x89eff6];return _0x128b93;};'use strict';var _=require(_0x296a('0x0'));var util=require('util');var moment=require(_0x296a('0x1'));var BPromise=require(_0x296a('0x2'));var rs=require(_0x296a('0x3'));var fs=require('fs');var Redis=require(_0x296a('0x4'));var db=require(_0x296a('0x5'))['db'];var utils=require(_0x296a('0x6'));var logger=require(_0x296a('0x7'))(_0x296a('0x8'));var config=require(_0x296a('0x9'));var jayson=require(_0x296a('0xa'));var client=jayson[_0x296a('0xb')][_0x296a('0xc')]({'port':0x232a});config[_0x296a('0xd')]=_[_0x296a('0xe')](config[_0x296a('0xd')],{'host':_0x296a('0xf'),'port':0x18eb});var socket=require(_0x296a('0x10'))(new Redis(config[_0x296a('0xd')]));require('./chatGroup.socket')[_0x296a('0x11')](socket);function respondWithRpcPromise(_0x250b74,_0x5e95dd,_0x625a2){return new BPromise(function(_0x1d1896,_0xc31eec){return client[_0x296a('0x12')](_0x250b74,_0x625a2)[_0x296a('0x13')](function(_0x323e6a){logger[_0x296a('0x14')]('ChatGroup,\x20%s,\x20%s',_0x5e95dd,_0x296a('0x15'));logger[_0x296a('0x16')](_0x296a('0x17'),_0x5e95dd,_0x296a('0x15'),JSON[_0x296a('0x18')](_0x323e6a));if(_0x323e6a['error']){if(_0x323e6a[_0x296a('0x19')][_0x296a('0x1a')]===0x1f4){logger['error'](_0x296a('0x1b'),_0x5e95dd,_0x323e6a[_0x296a('0x19')][_0x296a('0x1c')]);return _0xc31eec(_0x323e6a[_0x296a('0x19')][_0x296a('0x1c')]);}logger[_0x296a('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5e95dd,_0x323e6a[_0x296a('0x19')]['message']);return _0x1d1896(_0x323e6a['error']['message']);}else{logger[_0x296a('0x14')](_0x296a('0x1b'),_0x5e95dd,_0x296a('0x15'));_0x1d1896(_0x323e6a['result']['message']);}})[_0x296a('0x1d')](function(_0x566ce2){logger[_0x296a('0x19')](_0x296a('0x1b'),_0x5e95dd,_0x566ce2);_0xc31eec(_0x566ce2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0cb1c6d..ce18aed 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 _0xa39a=['chatGroup:','./chatGroup.events','save','remove','update','removeListener','register','length'];(function(_0xdcbbb,_0x39b964){var _0x19bb4e=function(_0x4952b7){while(--_0x4952b7){_0xdcbbb['push'](_0xdcbbb['shift']());}};_0x19bb4e(++_0x39b964);}(_0xa39a,0x121));var _0xaa39=function(_0x5aa68d,_0x3515b5){_0x5aa68d=_0x5aa68d-0x0;var _0x55e204=_0xa39a[_0x5aa68d];return _0x55e204;};'use strict';var ChatGroupEvents=require(_0xaa39('0x0'));var events=[_0xaa39('0x1'),_0xaa39('0x2'),_0xaa39('0x3')];function createListener(_0xf6f2df,_0x33d207){return function(_0x1f5db1){_0x33d207['emit'](_0xf6f2df,_0x1f5db1);};}function removeListener(_0x4a67c0,_0x4d67ea){return function(){ChatGroupEvents[_0xaa39('0x4')](_0x4a67c0,_0x4d67ea);};}exports[_0xaa39('0x5')]=function(_0x5d0bfb){for(var _0x505d48=0x0,_0x5dd364=events[_0xaa39('0x6')];_0x505d48<_0x5dd364;_0x505d48++){var _0x4bc2de=events[_0x505d48];var _0x4cfcf3=createListener(_0xaa39('0x7')+_0x4bc2de,_0x5d0bfb);ChatGroupEvents['on'](_0x4bc2de,_0x4cfcf3);}}; \ No newline at end of file +var _0xbe76=['remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe76,0x1df));var _0x6be7=function(_0x11ead2,_0x70de8a){_0x11ead2=_0x11ead2-0x0;var _0x3cac96=_0xbe76[_0x11ead2];return _0x3cac96;};'use strict';var ChatGroupEvents=require(_0x6be7('0x0'));var events=['save',_0x6be7('0x1'),_0x6be7('0x2')];function createListener(_0x2f8fdd,_0xb9eaec){return function(_0x49fbaa){_0xb9eaec[_0x6be7('0x3')](_0x2f8fdd,_0x49fbaa);};}function removeListener(_0x5f0dda,_0x15f2b3){return function(){ChatGroupEvents[_0x6be7('0x4')](_0x5f0dda,_0x15f2b3);};}exports[_0x6be7('0x5')]=function(_0xefb56e){for(var _0x1c0a1c=0x0,_0x4d2fcb=events[_0x6be7('0x6')];_0x1c0a1c<_0x4d2fcb;_0x1c0a1c++){var _0x1593fd=events[_0x1c0a1c];var _0x227e0c=createListener(_0x6be7('0x7')+_0x1593fd,_0xefb56e);ChatGroupEvents['on'](_0x1593fd,_0x227e0c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 82e4e5e..2835dc8 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 _0xff6f=['multer','connect-timeout','Router','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create','put','update','destroy','delete','/:id/members','removeMembers','exports'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xff6f,0x108));var _0xfff6=function(_0x3adc9f,_0x5d49d5){_0x3adc9f=_0x3adc9f-0x0;var _0x432a40=_0xff6f[_0x3adc9f];return _0x432a40;};'use strict';var multer=require(_0xfff6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfff6('0x1'));var express=require('express');var router=express[_0xfff6('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfff6('0x3'));var config=require('../../config/environment');var controller=require(_0xfff6('0x4'));router[_0xfff6('0x5')]('/',auth[_0xfff6('0x6')](),controller[_0xfff6('0x7')]);router[_0xfff6('0x5')](_0xfff6('0x8'),auth[_0xfff6('0x6')](),controller['describe']);router[_0xfff6('0x5')](_0xfff6('0x9'),auth[_0xfff6('0x6')](),controller[_0xfff6('0xa')]);router[_0xfff6('0x5')]('/:id/unread',auth[_0xfff6('0x6')](),controller[_0xfff6('0xb')]);router[_0xfff6('0x5')]('/:id/members',auth[_0xfff6('0x6')](),controller[_0xfff6('0xc')]);router[_0xfff6('0x5')](_0xfff6('0xd'),auth['isAuthenticated'](),controller[_0xfff6('0xe')]);router[_0xfff6('0xf')]('/',auth['isAuthenticated'](),controller[_0xfff6('0x10')]);router[_0xfff6('0xf')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router['post'](_0xfff6('0xd'),auth[_0xfff6('0x6')](),controller['addMessage']);router[_0xfff6('0x11')](_0xfff6('0x9'),auth[_0xfff6('0x6')](),controller[_0xfff6('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfff6('0x13')]);router[_0xfff6('0x14')](_0xfff6('0x15'),auth[_0xfff6('0x6')](),controller[_0xfff6('0x16')]);module[_0xfff6('0x17')]=router; \ No newline at end of file +var _0xf097=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','update','destroy','delete','removeMembers','path'];(function(_0x2a8985,_0x16c79b){var _0xbaeeb0=function(_0x5bdfb2){while(--_0x5bdfb2){_0x2a8985['push'](_0x2a8985['shift']());}};_0xbaeeb0(++_0x16c79b);}(_0xf097,0x15b));var _0x7f09=function(_0x1a0eec,_0x393f49){_0x1a0eec=_0x1a0eec-0x0;var _0xc546dd=_0xf097[_0x1a0eec];return _0xc546dd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f09('0x0'));var timeout=require(_0x7f09('0x1'));var express=require('express');var router=express[_0x7f09('0x2')]();var fs_extra=require(_0x7f09('0x3'));var auth=require(_0x7f09('0x4'));var interaction=require(_0x7f09('0x5'));var config=require(_0x7f09('0x6'));var controller=require(_0x7f09('0x7'));router['get']('/',auth[_0x7f09('0x8')](),controller[_0x7f09('0x9')]);router['get'](_0x7f09('0xa'),auth[_0x7f09('0x8')](),controller[_0x7f09('0xb')]);router[_0x7f09('0xc')](_0x7f09('0xd'),auth['isAuthenticated'](),controller[_0x7f09('0xe')]);router[_0x7f09('0xc')](_0x7f09('0xf'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xc')](_0x7f09('0x11'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x12')]);router[_0x7f09('0xc')](_0x7f09('0x13'),auth['isAuthenticated'](),controller[_0x7f09('0x14')]);router['post']('/',auth[_0x7f09('0x8')](),controller[_0x7f09('0x15')]);router[_0x7f09('0x16')](_0x7f09('0x11'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x17')]);router[_0x7f09('0x16')](_0x7f09('0x13'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x18')]);router['put'](_0x7f09('0xd'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x19')]);router['delete'](_0x7f09('0xd'),auth[_0x7f09('0x8')](),controller[_0x7f09('0x1a')]);router[_0x7f09('0x1b')](_0x7f09('0x11'),auth['isAuthenticated'](),controller[_0x7f09('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f1ca5b8..338215d 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 _0x1614=['sequelize','exports','ENUM','star','thumb','TEXT','STRING','DATE','long','out','BOOLEAN','INTEGER'];(function(_0x2aa30f,_0x3d58d0){var _0x2b8376=function(_0x4c0548){while(--_0x4c0548){_0x2aa30f['push'](_0x2aa30f['shift']());}};_0x2b8376(++_0x3d58d0);}(_0x1614,0xa8));var _0x4161=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x1614[_0xb833b1];return _0x1ab87a;};'use strict';var Sequelize=require(_0x4161('0x0'));module[_0x4161('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x4161('0x2')](_0x4161('0x3'),_0x4161('0x4')),'defaultValue':_0x4161('0x3')},'ratingMessage':{'type':Sequelize[_0x4161('0x5')]},'pathTranscript':{'type':Sequelize[_0x4161('0x5')]},'mailTranscript':{'type':Sequelize[_0x4161('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4161('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4161('0x6')]},'thirdDisposition':{'type':Sequelize[_0x4161('0x6')]},'note':{'type':Sequelize[_0x4161('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4161('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x4161('0x6')]},'deviceModel':{'type':Sequelize[_0x4161('0x6')]},'deviceVendor':{'type':Sequelize[_0x4161('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x4161('0x5')]},'customerIp':{'type':Sequelize[_0x4161('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x4161('0x8'))},'read1stAt':{'type':Sequelize[_0x4161('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4161('0x2')]('in',_0x4161('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4161('0x6')]},'customerPort':{'type':Sequelize[_0x4161('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x4161('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x4161('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4161('0xb')]}}; \ No newline at end of file +var _0x1453=['long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE'];(function(_0x1fb8c9,_0x34438a){var _0x2f900d=function(_0x240718){while(--_0x240718){_0x1fb8c9['push'](_0x1fb8c9['shift']());}};_0x2f900d(++_0x34438a);}(_0x1453,0xa1));var _0x3145=function(_0x53f539,_0x4b348a){_0x53f539=_0x53f539-0x0;var _0x5114ce=_0x1453[_0x53f539];return _0x5114ce;};'use strict';var Sequelize=require(_0x3145('0x0'));module[_0x3145('0x1')]={'closed':{'type':Sequelize[_0x3145('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3145('0x3')]},'ratingType':{'type':Sequelize[_0x3145('0x4')](_0x3145('0x5'),'thumb'),'defaultValue':_0x3145('0x5')},'ratingMessage':{'type':Sequelize[_0x3145('0x6')]},'pathTranscript':{'type':Sequelize[_0x3145('0x6')]},'mailTranscript':{'type':Sequelize[_0x3145('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3145('0x8')]},'disposition':{'type':Sequelize[_0x3145('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3145('0x7')]},'note':{'type':Sequelize[_0x3145('0x7')]},'browserName':{'type':Sequelize[_0x3145('0x7')]},'browserVersion':{'type':Sequelize[_0x3145('0x7')]},'osName':{'type':Sequelize[_0x3145('0x7')]},'osVersion':{'type':Sequelize[_0x3145('0x7')]},'deviceModel':{'type':Sequelize[_0x3145('0x7')]},'deviceVendor':{'type':Sequelize[_0x3145('0x7')]},'deviceType':{'type':Sequelize[_0x3145('0x7')]},'referer':{'type':Sequelize[_0x3145('0x6')]},'customerIp':{'type':Sequelize[_0x3145('0x7')]},'formData':{'type':Sequelize[_0x3145('0x6')](_0x3145('0x9'))},'read1stAt':{'type':Sequelize[_0x3145('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3145('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3145('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3145('0x7')]},'customerPort':{'type':Sequelize[_0x3145('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3145('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3145('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5477d0f..73519a1 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 _0x22c9=['Messages','User','ChatWebsiteId','ContactId','length','%s%d','agentAlias','customer','Visitor','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','filter','split','rows','getMyMessages','ChatInteractionId','push','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','osName','customerIp','customerPort','tail','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','mustache','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now'];(function(_0x120f6d,_0x543071){var _0x1498dd=function(_0x350147){while(--_0x350147){_0x120f6d['push'](_0x120f6d['shift']());}};_0x1498dd(++_0x543071);}(_0x22c9,0x1cf));var _0x922c=function(_0x524bb0,_0x326327){_0x524bb0=_0x524bb0-0x0;var _0x2fb947=_0x22c9[_0x524bb0];return _0x2fb947;};'use strict';var rimraf=require(_0x922c('0x0'));var zipdir=require(_0x922c('0x1'));var rp=require(_0x922c('0x2'));var moment=require(_0x922c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x922c('0x4'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x922c('0x5'));var Redis=require('ioredis');var interaction=require(_0x922c('0x6'));var qs=require(_0x922c('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x922c('0x8'))('api');var config=require(_0x922c('0x9'));var db=require('../../mysqldb')['db'];config[_0x922c('0xa')]=_[_0x922c('0xb')](config[_0x922c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x922c('0xc'))(new Redis(config[_0x922c('0xa')]));require(_0x922c('0xd'))[_0x922c('0xe')](socket);var jayson=require(_0x922c('0xf'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x922c('0x10')]['http']({'port':0x232c});function respondWithRpcPromise(_0x42088a,_0x4d9075,_0x4b4b6b,_0xa5676c){return new BPromise(function(_0x29005e,_0x4092a5){var _0x160522=_0xa5676c||client;return _0x160522[_0x922c('0x11')](_0x42088a,_0x4b4b6b)['then'](function(_0x10a1ae){logger[_0x922c('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4d9075,_0x922c('0x13'));logger[_0x922c('0x14')](_0x922c('0x15'),_0x4d9075,_0x922c('0x13'),JSON[_0x922c('0x16')](_0x10a1ae));if(_0x10a1ae[_0x922c('0x17')]){if(_0x10a1ae[_0x922c('0x17')]['code']===0x1f4){logger['error'](_0x922c('0x18'),_0x4d9075,_0x10a1ae['error'][_0x922c('0x19')]);return _0x4092a5(_0x10a1ae['error'][_0x922c('0x19')]);}logger[_0x922c('0x17')](_0x922c('0x18'),_0x4d9075,_0x10a1ae[_0x922c('0x17')][_0x922c('0x19')]);return _0x29005e(_0x10a1ae[_0x922c('0x17')][_0x922c('0x19')]);}else{logger[_0x922c('0x12')](_0x922c('0x18'),_0x4d9075,_0x922c('0x13'));_0x29005e(_0x10a1ae['result']['message']);}})[_0x922c('0x1a')](function(_0x3ec5e6){logger[_0x922c('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4d9075,_0x3ec5e6);_0x4092a5(_0x3ec5e6);});});}function respondWithStatusCode(_0x5618e9,_0x5a4f5b){_0x5a4f5b=_0x5a4f5b||0xcc;return function(_0x2343e3){if(_0x2343e3){return _0x5618e9[_0x922c('0x1b')](_0x5a4f5b);}return _0x5618e9[_0x922c('0x1c')](_0x5a4f5b)[_0x922c('0x1d')]();};}function respondWithResult(_0x154b65,_0x52596c){_0x52596c=_0x52596c||0xc8;return function(_0x34a5f7){if(_0x34a5f7){return _0x154b65[_0x922c('0x1c')](_0x52596c)[_0x922c('0x1e')](_0x34a5f7);}};}function respondWithFilteredResult(_0x64aa91,_0x40220c){return function(_0x2e5f95){if(_0x2e5f95){var _0x2c4a5a=typeof _0x40220c[_0x922c('0x1f')]===_0x922c('0x20')&&typeof _0x40220c['limit']===_0x922c('0x20');var _0x5273f1=_0x2e5f95[_0x922c('0x21')];var _0x54f8b9=_0x2c4a5a?0x0:_0x40220c[_0x922c('0x1f')];var _0x26cc1a=_0x2c4a5a?_0x2e5f95[_0x922c('0x21')]:_0x40220c[_0x922c('0x1f')]+_0x40220c[_0x922c('0x22')];var _0x32b499;if(_0x26cc1a>=_0x5273f1){_0x26cc1a=_0x5273f1;_0x32b499=0xc8;}else{_0x32b499=0xce;}_0x64aa91['status'](_0x32b499);return _0x64aa91[_0x922c('0x23')](_0x922c('0x24'),_0x54f8b9+'-'+_0x26cc1a+'/'+_0x5273f1)[_0x922c('0x1e')](_0x2e5f95);}return null;};}function saveUpdates(_0x1e79ce){return function(_0x5b5ee6){if(_0x5b5ee6){return _0x5b5ee6[_0x922c('0x25')](_0x1e79ce)[_0x922c('0x26')](function(_0x1914b9){return _0x1914b9;});}return null;};}function removeEntity(_0x8fcf59){return function(_0x210113){if(_0x210113){return _0x210113[_0x922c('0x27')]()[_0x922c('0x26')](function(){_0x8fcf59['status'](0xcc)[_0x922c('0x1d')]();});}};}function handleEntityNotFound(_0x44dddd){return function(_0x1f6af2){if(!_0x1f6af2){_0x44dddd[_0x922c('0x1b')](0x194);}return _0x1f6af2;};}function handleError(_0x5103a4,_0x13221e){_0x13221e=_0x13221e||0x1f4;return function(_0x1fc26c){logger[_0x922c('0x17')](_0x1fc26c[_0x922c('0x28')]);if(_0x1fc26c['name']){delete _0x1fc26c[_0x922c('0x29')];}_0x5103a4[_0x922c('0x1c')](_0x13221e)[_0x922c('0x2a')](_0x1fc26c);};}function getMustacheRender(_0x560d65,_0x3c0d55){return Mustache[_0x922c('0x2b')](_0x560d65,_[_0x922c('0x2c')](_0x3c0d55[_0x922c('0x2d')],{'contact':_0x3c0d55[_0x922c('0x2e')],'message':_0x3c0d55[_0x922c('0x19')],'agent':_0x3c0d55[_0x922c('0x2f')],'interaction':_0x3c0d55[_0x922c('0x30')],'account':_0x3c0d55[_0x922c('0x31')]}))||'';}exports['index']=function(_0x36ecd9,_0x26fec6){var _0x111a5a={};var _0x53a0b0=_[_0x922c('0x32')](db[_0x922c('0x33')][_0x922c('0x34')],function(_0x4bc671){return{'name':_0x4bc671['fieldName'],'type':_0x4bc671[_0x922c('0x35')][_0x922c('0x36')]};});_0x111a5a=qs[_0x922c('0x37')](_0x53a0b0,_0x36ecd9);return interaction[_0x922c('0x38')](_0x922c('0x39'),_0x36ecd9[_0x922c('0x3a')],_0x36ecd9[_0x922c('0x3b')],_0x111a5a,_0x53a0b0)['then'](respondWithFilteredResult(_0x26fec6,_0x111a5a))['catch'](handleError(_0x26fec6,null));};exports[_0x922c('0x3c')]=function(_0x42418d,_0x40e142){var _0x25a71d={'raw':![],'where':{'id':_0x42418d[_0x922c('0x3d')]['id']}},_0x4beff6={};_0x4beff6[_0x922c('0x3e')]=_[_0x922c('0x3f')](db[_0x922c('0x33')][_0x922c('0x34')]);_0x4beff6['query']=_[_0x922c('0x3f')](_0x42418d[_0x922c('0x3a')]);_0x4beff6[_0x922c('0x40')]=_[_0x922c('0x41')](_0x4beff6[_0x922c('0x3e')],_0x4beff6['query']);_0x25a71d[_0x922c('0x42')]=_['intersection'](_0x4beff6[_0x922c('0x3e')],qs[_0x922c('0x43')](_0x42418d['query'][_0x922c('0x43')]));_0x25a71d[_0x922c('0x42')]=_0x25a71d[_0x922c('0x42')]['length']?_0x25a71d[_0x922c('0x42')]:_0x4beff6['model'];if(_0x42418d[_0x922c('0x3a')][_0x922c('0x44')]){_0x25a71d[_0x922c('0x45')]=[{'all':!![]}];}_0x25a71d=_[_0x922c('0x2c')]({},_0x25a71d,_0x42418d[_0x922c('0x46')]);return db['ChatInteraction']['find'](_0x25a71d)['then'](handleEntityNotFound(_0x40e142,null))[_0x922c('0x26')](respondWithResult(_0x40e142,null))[_0x922c('0x1a')](handleError(_0x40e142,null));};exports[_0x922c('0x47')]=function(_0x46195e,_0x43ce1f){return db[_0x922c('0x33')][_0x922c('0x47')](_0x46195e[_0x922c('0x2d')],{})[_0x922c('0x26')](respondWithResult(_0x43ce1f,0xc9))[_0x922c('0x1a')](handleError(_0x43ce1f,null));};exports[_0x922c('0x25')]=function(_0x3ca96d,_0x48d3bf){if(_0x3ca96d[_0x922c('0x2d')]['id']){delete _0x3ca96d[_0x922c('0x2d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3ca96d[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x48d3bf,null))[_0x922c('0x26')](saveUpdates(_0x3ca96d['body'],null))[_0x922c('0x26')](respondWithResult(_0x48d3bf,null))['catch'](handleError(_0x48d3bf,null));};exports['destroy']=function(_0x1c9022,_0x11eddb){return db[_0x922c('0x33')][_0x922c('0x48')]({'where':{'id':_0x1c9022[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x11eddb,null))[_0x922c('0x26')](removeEntity(_0x11eddb,null))[_0x922c('0x1a')](handleError(_0x11eddb,null));};exports[_0x922c('0x49')]=function(_0x295d00,_0x26e89c){return db['ChatInteraction'][_0x922c('0x49')]()[_0x922c('0x26')](respondWithResult(_0x26e89c,null))[_0x922c('0x1a')](handleError(_0x26e89c,null));};exports[_0x922c('0x4a')]=function(_0x4a6a1b,_0xd8a884){var _0x143b02=_0x4a6a1b['params']['id'];var _0x1cea44;var _0x11d0d1;var _0x5736a0;return db[_0x922c('0x33')][_0x922c('0x4b')]({'where':{'id':_0x143b02}})['then'](function(_0x3be5b2){_0x1cea44=_0x3be5b2;return db[_0x922c('0x4c')][_0x922c('0x4b')]({'where':{'id':_0x3be5b2['ChatWebsiteId']},'attributes':['id',_0x922c('0x4d'),_0x922c('0x4e'),_0x922c('0x4f'),_0x922c('0x50'),_0x922c('0x51')],'raw':!![]});})['then'](function(_0x4d804a){if(_0x4d804a&&_0x4d804a['vidaooApiKey']&&_0x4d804a[_0x922c('0x4e')]){_0x11d0d1=_0x4d804a;var _0x2ad2f3={'interaction':{'id':_0x143b02},'agent':{'id':_0x4a6a1b[_0x922c('0x3b')]['id'],'name':_0x4a6a1b['user']['name'],'fullname':_0x4a6a1b[_0x922c('0x3b')][_0x922c('0x52')],'email':_0x4a6a1b[_0x922c('0x3b')][_0x922c('0x53')]},'contact':_0x4a6a1b[_0x922c('0x2d')]['contact'],'account':_0x4a6a1b[_0x922c('0x2d')][_0x922c('0x31')]};var _0x217719={'rejectUnauthorized':![],'method':_0x922c('0x54'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x4d804a[_0x922c('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4a6a1b[_0x922c('0x3b')][_0x922c('0x53')]],'buttons':null,'topic':_0x11d0d1['vidaooTopic'],'note':_[_0x922c('0x55')](_0x11d0d1[_0x922c('0x50')])?null:getMustacheRender(_0x11d0d1[_0x922c('0x50')],_0x2ad2f3),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x11d0d1[_0x922c('0x51')])){var _0x8a2794=getMustacheRender(_0x11d0d1['vidaooMetadata'],_0x2ad2f3);var _0x22cc44=JSON[_0x922c('0x56')](_0x8a2794);_0x217719[_0x922c('0x2d')][_0x922c('0x57')]=_0x22cc44;}}catch(_0x3e18cf){throw new db[(_0x922c('0x58'))][(_0x922c('0x59'))](_0x922c('0x5a'));}return rp(_0x217719);}else{throw new db['Sequelize'][(_0x922c('0x59'))](_0x922c('0x5b'));}})['then'](function(_0x4d98de){_0x5736a0=_0x4d98de;if(_0x5736a0['id']){var _0x13e74b={'body':_0x5736a0[_0x922c('0x5c')],'ChatWebsiteId':_0x11d0d1['id'],'ChatInteractionId':_0x1cea44['id'],'direction':_0x922c('0x5d'),'UserId':_0x4a6a1b[_0x922c('0x3b')]['id']};return db[_0x922c('0x5e')][_0x922c('0x47')](_0x13e74b,{});}else{throw new db[(_0x922c('0x58'))][(_0x922c('0x59'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x922c('0x26')](function(){return _0x1cea44[_0x922c('0x5f')]({'vidaooSessionId':_0x5736a0['id']});})[_0x922c('0x26')](respondWithResult(_0xd8a884,null))[_0x922c('0x1a')](handleError(_0xd8a884,null));};exports[_0x922c('0x60')]=function(_0x4bc9e1,_0x587129){if(_0x4bc9e1[_0x922c('0x2d')]['id']){delete _0x4bc9e1['body']['id'];}return db[_0x922c('0x33')]['find']({'where':{'id':_0x4bc9e1[_0x922c('0x3d')]['id']},'include':[{'model':db[_0x922c('0x61')],'as':_0x922c('0x62')}]})[_0x922c('0x26')](handleEntityNotFound(_0x587129,null))[_0x922c('0x26')](saveUpdates(_0x4bc9e1[_0x922c('0x2d')],null))[_0x922c('0x26')](respondWithResult(_0x587129,null))[_0x922c('0x1a')](handleError(_0x587129,null));};exports[_0x922c('0x63')]=function(_0x517de8,_0x57a2d4){if(_0x517de8[_0x922c('0x2d')]['id']){delete _0x517de8[_0x922c('0x2d')]['id'];}return db[_0x922c('0x33')][_0x922c('0x48')]({'where':{'id':_0x517de8[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](function(_0x40924c){if(!_0x40924c){logger[_0x922c('0x17')](_0x922c('0x64'),_0x922c('0x63'),0x194,_0x922c('0x65'));_0x57a2d4['sendStatus'](0x194);}else{if(_0x40924c[_0x922c('0x66')]){throw new db[(_0x922c('0x58'))][(_0x922c('0x59'))](_0x922c('0x67'));}}return _0x40924c;})[_0x922c('0x26')](function(_0x363e52){if(_0x363e52){return _0x363e52['update']({'closed':_0x517de8[_0x922c('0x2d')][_0x922c('0x68')],'disposition':_0x517de8[_0x922c('0x2d')][_0x922c('0x69')]})['then'](function(_0x105aff){return _0x105aff;});}})[_0x922c('0x26')](function(){return respondWithRpcPromise(_0x922c('0x6a'),_0x922c('0x63'),_0x517de8['body'],client9004);})[_0x922c('0x26')](respondWithResult(_0x57a2d4,null))[_0x922c('0x1a')](handleError(_0x57a2d4,null));};exports['attachmentUpload']=function(_0x2710de,_0x34f6a4){_0x2710de['body'][_0x922c('0x29')]=_0x2710de[_0x922c('0x6b')]['originalname'];_0x2710de[_0x922c('0x2d')][_0x922c('0x6c')]=_0x2710de[_0x922c('0x6b')][_0x922c('0x6d')];_0x2710de[_0x922c('0x2d')][_0x922c('0x35')]=_0x2710de[_0x922c('0x6b')][_0x922c('0x6e')];return db[_0x922c('0x6f')][_0x922c('0x47')](_0x2710de[_0x922c('0x2d')])[_0x922c('0x26')](respondWithResult(_0x34f6a4,0xc9))[_0x922c('0x1a')](handleError(_0x34f6a4,null));};exports['attachmentDownload']=function(_0x59f65b,_0x571443){return db[_0x922c('0x33')][_0x922c('0x4b')]({'where':{'id':_0x59f65b[_0x922c('0x3d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x571443,null))['then'](function(_0x6bf263){if(_0x6bf263){if(_0x6bf263[_0x922c('0x68')]){return _0x571443[_0x922c('0x1c')](0x193)[_0x922c('0x1e')]({'status':0x193,'message':_0x922c('0x70')});}return db[_0x922c('0x6f')]['findOne']({'where':{'id':_0x59f65b[_0x922c('0x3a')][_0x922c('0x71')]},'raw':!![]})[_0x922c('0x26')](handleEntityNotFound(_0x571443,null));}})[_0x922c('0x26')](function(_0x5cb8a0){if(_0x5cb8a0){var _0x5d6f66=_0x5cb8a0['ChatOfflineMessageId']!==null;var _0x537d63=path[_0x922c('0x72')](config[_0x922c('0x73')],_0x922c('0x74'));if(_0x5d6f66){_0x537d63=path['join'](_0x537d63,_0x922c('0x75'));}var _0x12f2f4=path[_0x922c('0x72')](_0x537d63,_0x5cb8a0['basename']);return _0x571443[_0x922c('0x76')](_0x12f2f4);}})[_0x922c('0x1a')](handleError(_0x571443,null));};exports[_0x922c('0x77')]=function(_0x1657f8,_0x33ad10){var _0x2d7719=null;var _0x3bfba7=null;var _0x196f69=null;if(_0x1657f8[_0x922c('0x2d')]['id']){delete _0x1657f8[_0x922c('0x2d')]['id'];}if(_0x1657f8[_0x922c('0x2d')][_0x922c('0x78')]){_0x196f69=path[_0x922c('0x72')](config[_0x922c('0x73')],_0x922c('0x79'),util[_0x922c('0x7a')](_0x922c('0x7b'),Date[_0x922c('0x7c')]()));_0x1657f8['body']['pathTranscript']=_0x196f69;}return db[_0x922c('0x33')]['find']({'where':{'id':_0x1657f8['params']['id']},'include':[{'model':db[_0x922c('0x5e')],'as':_0x922c('0x7d'),'include':[{'model':db['User'],'as':_0x922c('0x7e')}]}]})['then'](handleEntityNotFound(_0x33ad10,null))[_0x922c('0x26')](saveUpdates(_0x1657f8[_0x922c('0x2d')],null))['then'](function(_0x50b5cb){if(_0x50b5cb){_0x2d7719=_0x50b5cb;return db['ChatWebsite'][_0x922c('0x48')]({'where':{'id':_0x2d7719[_0x922c('0x7f')]}});}})['then'](function(_0x5cddbb){if(_0x5cddbb){_0x3bfba7=_0x5cddbb;return db[_0x922c('0x61')][_0x922c('0x48')]({'where':{'id':_0x2d7719[_0x922c('0x80')]}});}})['then'](function(_0x348655){if(_0x348655){if(_0x196f69){var _0x561aca=null;for(var _0x2737a2=0x1;_0x2737a2<_0x2d7719[_0x922c('0x7d')][_0x922c('0x81')];++_0x2737a2){_0x561aca=_0x2d7719[_0x922c('0x7d')][_0x2737a2];var _0x3eb06d=_0x561aca[_0x922c('0x66')]?util[_0x922c('0x7a')](_0x922c('0x82'),_0x3bfba7[_0x922c('0x83')],_0x561aca[_0x922c('0x66')]):'System';var _0xd27d02=_0x1657f8['body'][_0x922c('0x84')]||util['format'](_0x922c('0x82'),_0x922c('0x85'),_0x561aca['ContactId']);switch(_0x3bfba7['agentIdentifier']){case'website_alias':_0x3eb06d=_0x561aca[_0x922c('0x66')]?util['format'](_0x922c('0x82'),_0x3bfba7['agentAlias'],_0x561aca['UserId']):_0x922c('0x86');break;case'agent_alias':_0x3eb06d=_0x561aca[_0x922c('0x66')]?_0x561aca[_0x922c('0x7e')][_0x922c('0x87')]||_0x561aca[_0x922c('0x7e')][_0x922c('0x52')]:_0x922c('0x86');break;case _0x922c('0x88'):_0x3eb06d=_0x561aca[_0x922c('0x66')]?_0x561aca[_0x922c('0x7e')]['fullname']:_0x922c('0x86');break;default:_0x3eb06d=_0x561aca[_0x922c('0x66')]?util[_0x922c('0x7a')](_0x922c('0x82'),_0x3bfba7[_0x922c('0x83')],_0x561aca[_0x922c('0x66')]):'System';}var _0x725a1=util['format'](_0x922c('0x89'),moment(_0x561aca[_0x922c('0x8a')])['format'](_0x922c('0x8b')),_0x561aca[_0x922c('0x8c')]==='in'?_0xd27d02:_0x3eb06d,_0x561aca[_0x922c('0x2d')]);if(!_0x561aca[_0x922c('0x8d')]){fs['appendFileSync'](_0x196f69,_0x725a1);}}return db['MailAccount'][_0x922c('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x922c('0x8e')],'as':_0x922c('0x8f'),'raw':!![],'include':[{'model':db[_0x922c('0x90')],'as':_0x922c('0x90'),'raw':!![]}]}]});}}})[_0x922c('0x26')](function(_0x5b7cbe){if(!_0x5b7cbe||!_0x5b7cbe[_0x922c('0x8f')]||!_0x1657f8[_0x922c('0x2d')])return _0x2d7719;var _0x180d60=_0x5b7cbe[_0x922c('0x91')]();return respondWithRpcPromise(_0x922c('0x92'),'sendMail',{'account':_0x180d60,'message':{'from':util[_0x922c('0x7a')](_0x922c('0x93'),_0x5b7cbe[_0x922c('0x29')],_0x5b7cbe[_0x922c('0x53')]||_0x5b7cbe[_0x922c('0x8f')][_0x922c('0x3b')]),'to':_0x1657f8[_0x922c('0x2d')][_0x922c('0x78')],'subject':'Mail\x20Transcript','text':util['format'](_0x922c('0x94'),_0x1657f8['body'][_0x922c('0x78')]),'attachments':[{'path':_0x196f69}]}})[_0x922c('0x26')](function(){return _0x2d7719;})[_0x922c('0x1a')](function(_0x305f7f){logger[_0x922c('0x17')](_0x305f7f);});})[_0x922c('0x26')](respondWithStatusCode(_0x33ad10,0xc8))[_0x922c('0x1a')](handleError(_0x33ad10,null));};exports[_0x922c('0x95')]=function(_0x5e4417,_0x5c044f){return db[_0x922c('0x5e')]['find']({'where':{'id':_0x5e4417[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x5c044f,null))[_0x922c('0x26')](function(_0x1d583b){if(_0x1d583b){return _0x1d583b[_0x922c('0x95')](_0x5e4417[_0x922c('0x2d')][_0x922c('0x96')],_[_0x922c('0x97')](_0x5e4417[_0x922c('0x2d')],[_0x922c('0x96'),'id'])||{});}})[_0x922c('0x26')](respondWithResult(_0x5c044f,null))[_0x922c('0x1a')](handleError(_0x5c044f,null));};exports['getMessages']=function(_0x34a96d,_0x68257a){var _0x3beb16={'raw':![],'where':{}};var _0x55abc8={};var _0x29eb3b={'count':0x0,'rows':[]};return db[_0x922c('0x33')][_0x922c('0x4b')]({'where':{'id':_0x34a96d[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x68257a,null))[_0x922c('0x26')](function(_0xb1de28){if(_0xb1de28){_0x55abc8[_0x922c('0x3e')]=_[_0x922c('0x3f')](db[_0x922c('0x5e')]['rawAttributes']);_0x55abc8[_0x922c('0x3a')]=_['keys'](_0x34a96d[_0x922c('0x3a')]);_0x55abc8[_0x922c('0x40')]=_['intersection'](_0x55abc8[_0x922c('0x3e')],_0x55abc8['query']);_0x3beb16[_0x922c('0x42')]=_[_0x922c('0x41')](_0x55abc8[_0x922c('0x3e')],qs[_0x922c('0x43')](_0x34a96d['query'][_0x922c('0x43')]));_0x3beb16[_0x922c('0x42')]=_0x3beb16[_0x922c('0x42')][_0x922c('0x81')]?_0x3beb16[_0x922c('0x42')]:_0x55abc8[_0x922c('0x3e')];if(!_0x34a96d['query'][_0x922c('0x98')](_0x922c('0x99'))){_0x3beb16[_0x922c('0x22')]=qs['limit'](_0x34a96d[_0x922c('0x3a')]['limit']);_0x3beb16[_0x922c('0x1f')]=qs[_0x922c('0x1f')](_0x34a96d['query'][_0x922c('0x1f')]);}_0x3beb16[_0x922c('0x9a')]=qs[_0x922c('0x9b')](_0x34a96d['query'][_0x922c('0x9b')]);_0x3beb16[_0x922c('0x9c')]=qs['filters'](_[_0x922c('0x9d')](_0x34a96d[_0x922c('0x3a')],_0x55abc8['filters']));_0x3beb16['where']['ChatInteractionId']=_0xb1de28['id'];if(_0x34a96d[_0x922c('0x3a')][_0x922c('0x9e')]){_0x3beb16['where']=_[_0x922c('0x2c')](_0x3beb16[_0x922c('0x9c')],{'$or':_[_0x922c('0x32')](_0x3beb16['attributes'],function(_0x48ef62){var _0x3e4113={};_0x3e4113[_0x48ef62]={'$like':'%'+_0x34a96d[_0x922c('0x3a')][_0x922c('0x9e')]+'%'};return _0x3e4113;})});}if(_0x34a96d[_0x922c('0x3a')]['$gte']){var _0xc11ab7=_0x34a96d[_0x922c('0x3a')]['$gte'][_0x922c('0x9f')](',');var _0x44797e={};_0x44797e[_0xc11ab7[0x0]]={'$gte':moment(_0xc11ab7[0x1])[_0x922c('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3beb16[_0x922c('0x9c')]=_[_0x922c('0x2c')](_0x3beb16[_0x922c('0x9c')],_0x44797e);}_0x3beb16=_['merge']({},_0x3beb16,_0x34a96d[_0x922c('0x46')]);return db[_0x922c('0x5e')]['count']({'where':_0x3beb16[_0x922c('0x9c')]})[_0x922c('0x26')](function(_0x1b60b5){_0x29eb3b[_0x922c('0x21')]=_0x1b60b5;if(_0x34a96d[_0x922c('0x3a')][_0x922c('0x44')]){_0x3beb16['include']=[{'all':!![]}];}return db[_0x922c('0x5e')][_0x922c('0x38')](_0x3beb16);})[_0x922c('0x26')](function(_0x4f3f1a){_0x29eb3b[_0x922c('0xa0')]=_0x4f3f1a;return _0x29eb3b;});}})[_0x922c('0x26')](respondWithFilteredResult(_0x68257a,_0x3beb16))[_0x922c('0x1a')](handleError(_0x68257a,null));};exports[_0x922c('0xa1')]=function(_0x54e5ea,_0x40d71c){var _0x24e4db={'where':{}},_0xe2576f={},_0x107659={'count':0x0,'rows':[]};return db[_0x922c('0x33')][_0x922c('0x4b')]({'where':{'id':_0x54e5ea[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x40d71c,null))['then'](function(_0x5b0062){if(_0x5b0062){_0xe2576f['model']=_[_0x922c('0x3f')](db[_0x922c('0x5e')][_0x922c('0x34')]);_0xe2576f[_0x922c('0x3a')]=_[_0x922c('0x3f')](_0x54e5ea[_0x922c('0x3a')]);_0xe2576f[_0x922c('0x40')]=_[_0x922c('0x41')](_0xe2576f['model'],_0xe2576f[_0x922c('0x3a')]);_0x24e4db[_0x922c('0x42')]=_[_0x922c('0x41')](_0xe2576f['model'],qs[_0x922c('0x43')](_0x54e5ea[_0x922c('0x3a')][_0x922c('0x43')]));_0x24e4db['attributes']=_0x24e4db['attributes'][_0x922c('0x81')]?_0x24e4db[_0x922c('0x42')]:_0xe2576f[_0x922c('0x3e')];if(!_0x54e5ea['query'][_0x922c('0x98')](_0x922c('0x99'))){_0x24e4db[_0x922c('0x22')]=qs[_0x922c('0x22')](_0x54e5ea[_0x922c('0x3a')][_0x922c('0x22')]);_0x24e4db['offset']=qs[_0x922c('0x1f')](_0x54e5ea['query'][_0x922c('0x1f')]);}_0x24e4db['order']=qs[_0x922c('0x9b')](_0x54e5ea[_0x922c('0x3a')][_0x922c('0x9b')]);_0x24e4db[_0x922c('0x9c')]=qs[_0x922c('0x40')](_[_0x922c('0x9d')](_0x54e5ea['query'],_0xe2576f[_0x922c('0x40')]));_0x24e4db[_0x922c('0x9c')][_0x922c('0xa2')]=_0x5b0062['id'];if(_0x54e5ea[_0x922c('0x3a')][_0x922c('0x9e')]){_0x24e4db[_0x922c('0x9c')]=_[_0x922c('0x2c')](_0x24e4db[_0x922c('0x9c')],{'$or':_[_0x922c('0x32')](_0x24e4db[_0x922c('0x42')],function(_0x43ea50){var _0x5d895e={};_0x5d895e[_0x43ea50]={'$like':'%'+_0x54e5ea[_0x922c('0x3a')][_0x922c('0x9e')]+'%'};return _0x5d895e;})});}_0x24e4db['where'][_0x922c('0x8d')]=![];if(_0x54e5ea['query']['id']){_0x24e4db[_0x922c('0x9c')]['id']={'$gt':_0x54e5ea[_0x922c('0x3a')]['id']};}_0x24e4db=_[_0x922c('0x2c')]({},_0x24e4db,_0x54e5ea[_0x922c('0x46')]);return db[_0x922c('0x5e')][_0x922c('0x21')]({'where':_0x24e4db['where']})['then'](function(_0x3b55a0){_0x107659[_0x922c('0x21')]=_0x3b55a0;_0x24e4db[_0x922c('0x45')]=[];if(_0x54e5ea[_0x922c('0x3a')]['includeAgent']){_0x24e4db['include'][_0x922c('0xa3')]({'model':db['User'],'as':'User','attributes':['id',_0x922c('0x52'),'alias']});}if(_0x54e5ea[_0x922c('0x3a')][_0x922c('0x44')]){_0x24e4db[_0x922c('0x45')]=[{'all':!![]}];}return db[_0x922c('0x5e')][_0x922c('0x38')](_0x24e4db);})[_0x922c('0x26')](function(_0x3061ca){_0x107659[_0x922c('0xa0')]=_0x3061ca;return _0x107659;});}})[_0x922c('0x26')](respondWithFilteredResult(_0x40d71c,_0x24e4db))[_0x922c('0x1a')](handleError(_0x40d71c,null));};exports[_0x922c('0xa4')]=function(_0x47f9c4,_0x5768e1){return db[_0x922c('0x33')][_0x922c('0x48')]({'where':{'id':_0x47f9c4[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x5768e1,null))[_0x922c('0x26')](function(_0x3f7f97){if(_0x3f7f97){return _0x3f7f97[_0x922c('0xa5')](_0x47f9c4[_0x922c('0x2d')][_0x922c('0x96')],_[_0x922c('0x97')](_0x47f9c4[_0x922c('0x2d')],[_0x922c('0x96'),'id'])||{})[_0x922c('0xa6')](function(){return db[_0x922c('0xa7')][_0x922c('0x38')]({'attributes':['id',_0x922c('0x29'),_0x922c('0xa8')],'where':{'id':_0x47f9c4['body']['ids']}});})[_0x922c('0x26')](function(_0x48d45e){socket['emit'](_0x922c('0xa9'),{'id':Number(_0x47f9c4[_0x922c('0x3d')]['id']),'tags':_0x48d45e||[]});return{'id':Number(_0x47f9c4[_0x922c('0x3d')]['id']),'tags':_0x48d45e||[]};});}})[_0x922c('0x26')](respondWithResult(_0x5768e1,null))[_0x922c('0x1a')](handleError(_0x5768e1,null));};exports[_0x922c('0xaa')]=function(_0x4a080a,_0x54da9b){return db[_0x922c('0x33')]['find']({'where':{'id':_0x4a080a[_0x922c('0x3d')]['id']}})[_0x922c('0x26')](handleEntityNotFound(_0x54da9b,null))['then'](function(_0xd23953){if(_0xd23953){return _0xd23953[_0x922c('0xaa')](_0x4a080a['query'][_0x922c('0x96')]);}})[_0x922c('0x26')](respondWithStatusCode(_0x54da9b,null))['catch'](handleError(_0x54da9b,null));};exports[_0x922c('0x76')]=function(_0x31037,_0x2d9529){var _0x3413df=moment()['unix']()['toString']();var _0x471566=path[_0x922c('0x72')](config['root'],_0x922c('0xab'),_0x922c('0xac'),_0x922c('0xad'));var _0x2066e5=path[_0x922c('0x72')](config['root'],_0x922c('0xab'),_0x922c('0xac'),_0x922c('0xae'));var _0x8a770=path[_0x922c('0x72')](_0x471566,_0x3413df);var _0x57b32d=util[_0x922c('0x7a')](_0x922c('0xaf'),_0x31037[_0x922c('0x3d')]['id'],_0x3413df);var _0xb04275=path['join'](_0x471566,_0x57b32d);var _0x497595=[];_0x497595[_0x922c('0xa3')]({'model':db[_0x922c('0x7e')],'as':'User','attributes':['id',_0x922c('0x52')],'raw':!![]});_0x497595[_0x922c('0xa3')]({'model':db['CmContact'],'as':_0x922c('0x62'),'attributes':['id',_0x922c('0xb0'),_0x922c('0xb1')],'raw':!![]});if(_0x31037['query'][_0x922c('0xae')]){_0x497595[_0x922c('0xa3')]({'model':db[_0x922c('0x6f')],'as':_0x922c('0x6f'),'raw':!![]});}var _0x26cb92=[{'model':db[_0x922c('0x5e')],'as':_0x922c('0x7d'),'attributes':['id',_0x922c('0x2d'),_0x922c('0x8a'),_0x922c('0x8c'),_0x922c('0x8d'),'read'],'include':_0x497595}];_0x26cb92[_0x922c('0xa3')]({'model':db[_0x922c('0x4c')],'as':_0x922c('0xb2'),'attributes':['id',_0x922c('0x29')]});_0x26cb92[_0x922c('0xa3')]({'model':db[_0x922c('0x7e')],'as':'Owner','attributes':['id',_0x922c('0x52')]});return db[_0x922c('0x33')][_0x922c('0x48')]({'where':{'id':_0x31037['params']['id']},'include':_0x26cb92})[_0x922c('0x26')](handleEntityNotFound(_0x2d9529,null))[_0x922c('0x26')](function(_0x27deb7){if(_0x27deb7){var _0x343f88=_0x27deb7[_0x922c('0xb3')]({'plain':!![]});fs[_0x922c('0xb4')](_0x8a770);var _0x396a03={'channel':_0x922c('0xb5'),'account':_0x343f88['Account'][_0x922c('0x29')],'agent':_0x343f88[_0x922c('0xb6')]?_0x343f88['Owner'][_0x922c('0x52')]:_0x922c('0xb7'),'createdAt':moment(_0x343f88['createdAt'])[_0x922c('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x343f88[_0x922c('0x68')]?moment(_0x343f88[_0x922c('0xb8')])['format'](_0x922c('0xb9'))[_0x922c('0xba')]():'','disposition':_0x343f88[_0x922c('0x69')],'chatInfo':{'browser':_0x343f88['browserName'],'os':_0x343f88[_0x922c('0xbb')],'referer':_0x343f88['referer'],'customerIp':_0x343f88[_0x922c('0xbc')],'customerPort':_0x343f88[_0x922c('0xbd')]?_0x343f88[_0x922c('0xbd')]:'N.A.'},'messages':_(_0x343f88[_0x922c('0x7d')])[_0x922c('0xbe')]()[_0x922c('0x9e')]({'secret':![]})[_0x922c('0x32')](function(_0x4ee643){if(_0x4ee643['Attachment']){var _0x11d914=path['join'](_0x2066e5,_0x4ee643[_0x922c('0x6f')][_0x922c('0x6c')]);if(fs['existsSync'](_0x11d914)){fs['createReadStream'](_0x11d914)['pipe'](fs['createWriteStream'](path[_0x922c('0x72')](_0x8a770,_0x4ee643[_0x922c('0x6f')]['basename'])));}}return{'date':moment(_0x4ee643['createdAt'])['format'](_0x922c('0xb9'))[_0x922c('0xba')](),'sender':_0x4ee643[_0x922c('0x8c')]===_0x922c('0x5d')?_0x4ee643[_0x922c('0x7e')]?_0x4ee643[_0x922c('0x7e')]['fullname']:'System':_0x4ee643[_0x922c('0x62')][_0x922c('0xb0')]+(_0x4ee643[_0x922c('0x62')][_0x922c('0xb1')]?'\x20'+_0x4ee643['Contact']['lastName']:''),'body':_0x4ee643[_0x922c('0x6f')]?_0x4ee643['Attachment']['basename']:_0x4ee643[_0x922c('0x2d')],'direction':_0x4ee643[_0x922c('0x8c')]===_0x922c('0x5d')?'A':'C','secret':_0x4ee643[_0x922c('0x8d')],'read':_0x4ee643['read'],'attachment':_0x4ee643[_0x922c('0x6f')]};})[_0x922c('0xbf')]()};return ejs[_0x922c('0xc0')](path[_0x922c('0x72')](config[_0x922c('0x73')],_0x922c('0xab'),_0x922c('0xc1'),_0x922c('0xc2')),{'interaction':_0x396a03})[_0x922c('0x26')](function(_0x9e417){var _0x3b8d7c=path[_0x922c('0x72')](_0x8a770,'transcript-'+_0x343f88['id']+'-'+_0x3413df+'.pdf');var _0x462156={'path':_0x3b8d7c,'channel':_0x922c('0xb5'),'interactionId':_0x343f88['id']};return pdf[_0x922c('0xc3')](_0x9e417,_0x462156);})[_0x922c('0x26')](function(){return new Promise(function(_0xf3ff5f,_0x5aaf2a){zipdir(_0x8a770,{'saveTo':_0xb04275},function(_0x35881f,_0x5a648a){if(_0x35881f)return _0x5aaf2a(_0x35881f);return _0xf3ff5f(_0x5a648a);});})[_0x922c('0x26')](function(){return new BPromise(function(_0x1f7f45,_0x4623ff){rimraf(_0x8a770,function(_0x139250){if(_0x139250)_0x4623ff(_0x139250);return _0x1f7f45();});});})[_0x922c('0x26')](function(){return _0x2d9529[_0x922c('0x76')](_0xb04275,_0x57b32d,function(_0x3ddb88){if(_0x3ddb88){logger[_0x922c('0x17')]('err',_0x3ddb88);}else{fs['unlinkSync'](_0xb04275);}});});});}else{return _0x2d9529[_0x922c('0x1b')](0xc8);}})[_0x922c('0x1a')](handleError(_0x2d9529,null));}; \ No newline at end of file +var _0x342d=['user','params','model','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','join_url','out','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','format','pathTranscript','ChatMessage','Messages','User','ChatWebsiteId','ContactId','length','UserId','%s%d','System','customer','Visitor','website_alias','agent_alias','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','keys','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','ChatInteractionId','includeAgent','push','alias','addTags','setTags','Tag','color','chatInteractionTags:save','removeTags','download','unix','toString','root','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','closedAt','osName','referer','customerPort','N.A.','tail','map','existsSync','pipe','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','request-promise','mustache','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','limit','count','offset','set','Content-Range','update','destroy','end','stack','name','send','body','contact','agent','account','index','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x342d,0x15b));var _0xd342=function(_0x5428cb,_0x310d7d){_0x5428cb=_0x5428cb-0x0;var _0x5da7b5=_0x342d[_0x5428cb];return _0x5da7b5;};'use strict';var rimraf=require(_0xd342('0x0'));var zipdir=require(_0xd342('0x1'));var rp=require(_0xd342('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd342('0x3'));var util=require(_0xd342('0x4'));var path=require(_0xd342('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xd342('0x6'));var interaction=require(_0xd342('0x7'));var qs=require(_0xd342('0x8'));var pdf=require(_0xd342('0x9'));var logger=require(_0xd342('0xa'))('api');var config=require('../../config/environment');var db=require(_0xd342('0xb'))['db'];config[_0xd342('0xc')]=_[_0xd342('0xd')](config[_0xd342('0xc')],{'host':_0xd342('0xe'),'port':0x18eb});var socket=require(_0xd342('0xf'))(new Redis(config[_0xd342('0xc')]));require('./chatInteraction.socket')[_0xd342('0x10')](socket);var jayson=require(_0xd342('0x11'));var client=jayson[_0xd342('0x12')][_0xd342('0x13')]({'port':0x232b});var client9004=jayson[_0xd342('0x12')][_0xd342('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x4625e5,_0x2ea26d,_0x37f4b0,_0x418df4){return new BPromise(function(_0x5ab2af,_0x152856){var _0x617f6e=_0x418df4||client;return _0x617f6e[_0xd342('0x14')](_0x4625e5,_0x37f4b0)[_0xd342('0x15')](function(_0x2b6129){logger[_0xd342('0x16')](_0xd342('0x17'),_0x2ea26d,_0xd342('0x18'));logger[_0xd342('0x19')](_0xd342('0x1a'),_0x2ea26d,_0xd342('0x18'),JSON[_0xd342('0x1b')](_0x2b6129));if(_0x2b6129[_0xd342('0x1c')]){if(_0x2b6129[_0xd342('0x1c')][_0xd342('0x1d')]===0x1f4){logger[_0xd342('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2ea26d,_0x2b6129['error'][_0xd342('0x1e')]);return _0x152856(_0x2b6129[_0xd342('0x1c')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2ea26d,_0x2b6129[_0xd342('0x1c')]['message']);return _0x5ab2af(_0x2b6129[_0xd342('0x1c')][_0xd342('0x1e')]);}else{logger[_0xd342('0x16')](_0xd342('0x17'),_0x2ea26d,_0xd342('0x18'));_0x5ab2af(_0x2b6129['result'][_0xd342('0x1e')]);}})[_0xd342('0x1f')](function(_0x429af8){logger['error'](_0xd342('0x17'),_0x2ea26d,_0x429af8);_0x152856(_0x429af8);});});}function respondWithStatusCode(_0xb03808,_0x3f0f36){_0x3f0f36=_0x3f0f36||0xcc;return function(_0x1cbb7a){if(_0x1cbb7a){return _0xb03808[_0xd342('0x20')](_0x3f0f36);}return _0xb03808[_0xd342('0x21')](_0x3f0f36)['end']();};}function respondWithResult(_0x34acf3,_0x2e3ffd){_0x2e3ffd=_0x2e3ffd||0xc8;return function(_0x417851){if(_0x417851){return _0x34acf3[_0xd342('0x21')](_0x2e3ffd)[_0xd342('0x22')](_0x417851);}};}function respondWithFilteredResult(_0x2dae7d,_0xfc414d){return function(_0x43c4ed){if(_0x43c4ed){var _0x3e6732=typeof _0xfc414d['offset']==='undefined'&&typeof _0xfc414d[_0xd342('0x23')]==='undefined';var _0x38b25e=_0x43c4ed[_0xd342('0x24')];var _0x4b9560=_0x3e6732?0x0:_0xfc414d[_0xd342('0x25')];var _0x36271c=_0x3e6732?_0x43c4ed[_0xd342('0x24')]:_0xfc414d[_0xd342('0x25')]+_0xfc414d[_0xd342('0x23')];var _0xbd061b;if(_0x36271c>=_0x38b25e){_0x36271c=_0x38b25e;_0xbd061b=0xc8;}else{_0xbd061b=0xce;}_0x2dae7d[_0xd342('0x21')](_0xbd061b);return _0x2dae7d[_0xd342('0x26')](_0xd342('0x27'),_0x4b9560+'-'+_0x36271c+'/'+_0x38b25e)[_0xd342('0x22')](_0x43c4ed);}return null;};}function saveUpdates(_0x7b192){return function(_0x1fb303){if(_0x1fb303){return _0x1fb303[_0xd342('0x28')](_0x7b192)['then'](function(_0x4686c3){return _0x4686c3;});}return null;};}function removeEntity(_0x9271a1){return function(_0x51cd34){if(_0x51cd34){return _0x51cd34[_0xd342('0x29')]()[_0xd342('0x15')](function(){_0x9271a1['status'](0xcc)[_0xd342('0x2a')]();});}};}function handleEntityNotFound(_0x4f90a7){return function(_0x11d146){if(!_0x11d146){_0x4f90a7[_0xd342('0x20')](0x194);}return _0x11d146;};}function handleError(_0x26f66d,_0x1f0877){_0x1f0877=_0x1f0877||0x1f4;return function(_0x3b9d64){logger[_0xd342('0x1c')](_0x3b9d64[_0xd342('0x2b')]);if(_0x3b9d64['name']){delete _0x3b9d64[_0xd342('0x2c')];}_0x26f66d[_0xd342('0x21')](_0x1f0877)[_0xd342('0x2d')](_0x3b9d64);};}function getMustacheRender(_0x25ea38,_0x1c7da0){return Mustache['render'](_0x25ea38,_['merge'](_0x1c7da0[_0xd342('0x2e')],{'contact':_0x1c7da0[_0xd342('0x2f')],'message':_0x1c7da0[_0xd342('0x1e')],'agent':_0x1c7da0[_0xd342('0x30')],'interaction':_0x1c7da0['interaction'],'account':_0x1c7da0[_0xd342('0x31')]}))||'';}exports[_0xd342('0x32')]=function(_0x1e4de5,_0x178ade){var _0x20b98e={};var _0x575718=_['map'](db[_0xd342('0x33')][_0xd342('0x34')],function(_0x5e9986){return{'name':_0x5e9986[_0xd342('0x35')],'type':_0x5e9986[_0xd342('0x36')]['key']};});_0x20b98e=qs[_0xd342('0x37')](_0x575718,_0x1e4de5);return interaction[_0xd342('0x38')](_0xd342('0x39'),_0x1e4de5[_0xd342('0x3a')],_0x1e4de5[_0xd342('0x3b')],_0x20b98e,_0x575718)['then'](respondWithFilteredResult(_0x178ade,_0x20b98e))[_0xd342('0x1f')](handleError(_0x178ade,null));};exports['show']=function(_0x49ce3e,_0x49d14a){var _0x1ac39b={'raw':![],'where':{'id':_0x49ce3e[_0xd342('0x3c')]['id']}},_0x3d528a={};_0x3d528a[_0xd342('0x3d')]=_['keys'](db[_0xd342('0x33')][_0xd342('0x34')]);_0x3d528a[_0xd342('0x3a')]=_['keys'](_0x49ce3e[_0xd342('0x3a')]);_0x3d528a[_0xd342('0x3e')]=_[_0xd342('0x3f')](_0x3d528a[_0xd342('0x3d')],_0x3d528a[_0xd342('0x3a')]);_0x1ac39b[_0xd342('0x40')]=_[_0xd342('0x3f')](_0x3d528a[_0xd342('0x3d')],qs[_0xd342('0x41')](_0x49ce3e[_0xd342('0x3a')][_0xd342('0x41')]));_0x1ac39b[_0xd342('0x40')]=_0x1ac39b['attributes']['length']?_0x1ac39b[_0xd342('0x40')]:_0x3d528a[_0xd342('0x3d')];if(_0x49ce3e[_0xd342('0x3a')][_0xd342('0x42')]){_0x1ac39b[_0xd342('0x43')]=[{'all':!![]}];}_0x1ac39b=_[_0xd342('0x44')]({},_0x1ac39b,_0x49ce3e[_0xd342('0x45')]);return db[_0xd342('0x33')][_0xd342('0x46')](_0x1ac39b)[_0xd342('0x15')](handleEntityNotFound(_0x49d14a,null))[_0xd342('0x15')](respondWithResult(_0x49d14a,null))[_0xd342('0x1f')](handleError(_0x49d14a,null));};exports[_0xd342('0x47')]=function(_0x575060,_0x433797){return db['ChatInteraction'][_0xd342('0x47')](_0x575060[_0xd342('0x2e')],{})[_0xd342('0x15')](respondWithResult(_0x433797,0xc9))[_0xd342('0x1f')](handleError(_0x433797,null));};exports[_0xd342('0x28')]=function(_0x495b01,_0x93f170){if(_0x495b01[_0xd342('0x2e')]['id']){delete _0x495b01[_0xd342('0x2e')]['id'];}return db[_0xd342('0x33')][_0xd342('0x46')]({'where':{'id':_0x495b01[_0xd342('0x3c')]['id']}})[_0xd342('0x15')](handleEntityNotFound(_0x93f170,null))[_0xd342('0x15')](saveUpdates(_0x495b01[_0xd342('0x2e')],null))['then'](respondWithResult(_0x93f170,null))[_0xd342('0x1f')](handleError(_0x93f170,null));};exports[_0xd342('0x29')]=function(_0x5e71e0,_0x54d64c){return db[_0xd342('0x33')]['find']({'where':{'id':_0x5e71e0[_0xd342('0x3c')]['id']}})['then'](handleEntityNotFound(_0x54d64c,null))['then'](removeEntity(_0x54d64c,null))[_0xd342('0x1f')](handleError(_0x54d64c,null));};exports[_0xd342('0x48')]=function(_0x104bf5,_0x38c335){return db['ChatInteraction'][_0xd342('0x48')]()[_0xd342('0x15')](respondWithResult(_0x38c335,null))['catch'](handleError(_0x38c335,null));};exports[_0xd342('0x49')]=function(_0x1ff50d,_0x30bc25){var _0x64be92=_0x1ff50d[_0xd342('0x3c')]['id'];var _0x313d8d;var _0x2b42e2;var _0x331b82;return db[_0xd342('0x33')][_0xd342('0x4a')]({'where':{'id':_0x64be92}})[_0xd342('0x15')](function(_0x47bb86){_0x313d8d=_0x47bb86;return db[_0xd342('0x4b')][_0xd342('0x4a')]({'where':{'id':_0x47bb86['ChatWebsiteId']},'attributes':['id',_0xd342('0x4c'),_0xd342('0x4d'),_0xd342('0x4e'),_0xd342('0x4f'),_0xd342('0x50')],'raw':!![]});})['then'](function(_0x5e1db2){if(_0x5e1db2&&_0x5e1db2[_0xd342('0x4c')]&&_0x5e1db2[_0xd342('0x4d')]){_0x2b42e2=_0x5e1db2;var _0x51a019={'interaction':{'id':_0x64be92},'agent':{'id':_0x1ff50d[_0xd342('0x3b')]['id'],'name':_0x1ff50d[_0xd342('0x3b')][_0xd342('0x2c')],'fullname':_0x1ff50d[_0xd342('0x3b')][_0xd342('0x51')],'email':_0x1ff50d[_0xd342('0x3b')][_0xd342('0x52')]},'contact':_0x1ff50d[_0xd342('0x2e')][_0xd342('0x2f')],'account':_0x1ff50d['body'][_0xd342('0x31')]};var _0x20b403={'rejectUnauthorized':![],'method':_0xd342('0x53'),'url':_0xd342('0x54'),'headers':{'X-APIKEY':_0x5e1db2[_0xd342('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ff50d[_0xd342('0x3b')][_0xd342('0x52')]],'buttons':null,'topic':_0x2b42e2['vidaooTopic'],'note':_[_0xd342('0x55')](_0x2b42e2['vidaooNote'])?null:getMustacheRender(_0x2b42e2[_0xd342('0x4f')],_0x51a019),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xd342('0x55')](_0x2b42e2[_0xd342('0x50')])){var _0xe22df4=getMustacheRender(_0x2b42e2['vidaooMetadata'],_0x51a019);var _0x1335d5=JSON[_0xd342('0x56')](_0xe22df4);_0x20b403[_0xd342('0x2e')][_0xd342('0x57')]=_0x1335d5;}}catch(_0x477f87){throw new db['Sequelize'][(_0xd342('0x58'))](_0xd342('0x59'));}return rp(_0x20b403);}else{throw new db[(_0xd342('0x5a'))][(_0xd342('0x58'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x2256a0){_0x331b82=_0x2256a0;if(_0x331b82['id']){var _0x5024d8={'body':_0x331b82[_0xd342('0x5b')],'ChatWebsiteId':_0x2b42e2['id'],'ChatInteractionId':_0x313d8d['id'],'direction':_0xd342('0x5c'),'UserId':_0x1ff50d['user']['id']};return db['ChatMessage'][_0xd342('0x47')](_0x5024d8,{});}else{throw new db['Sequelize'][(_0xd342('0x58'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd342('0x15')](function(){return _0x313d8d[_0xd342('0x5d')]({'vidaooSessionId':_0x331b82['id']});})[_0xd342('0x15')](respondWithResult(_0x30bc25,null))['catch'](handleError(_0x30bc25,null));};exports[_0xd342('0x5e')]=function(_0x1e2c5b,_0x25e5c4){if(_0x1e2c5b['body']['id']){delete _0x1e2c5b[_0xd342('0x2e')]['id'];}return db[_0xd342('0x33')][_0xd342('0x46')]({'where':{'id':_0x1e2c5b[_0xd342('0x3c')]['id']},'include':[{'model':db[_0xd342('0x5f')],'as':_0xd342('0x60')}]})[_0xd342('0x15')](handleEntityNotFound(_0x25e5c4,null))['then'](saveUpdates(_0x1e2c5b[_0xd342('0x2e')],null))[_0xd342('0x15')](respondWithResult(_0x25e5c4,null))[_0xd342('0x1f')](handleError(_0x25e5c4,null));};exports[_0xd342('0x61')]=function(_0x5506ec,_0x65ecb6){if(_0x5506ec[_0xd342('0x2e')]['id']){delete _0x5506ec[_0xd342('0x2e')]['id'];}return db[_0xd342('0x33')][_0xd342('0x46')]({'where':{'id':_0x5506ec[_0xd342('0x3c')]['id']}})[_0xd342('0x15')](function(_0x657345){if(!_0x657345){logger['error'](_0xd342('0x62'),'abandon',0x194,_0xd342('0x63'));_0x65ecb6[_0xd342('0x20')](0x194);}else{if(_0x657345['UserId']){throw new db[(_0xd342('0x5a'))]['ValidationError'](_0xd342('0x64'));}}return _0x657345;})[_0xd342('0x15')](function(_0x1a6851){if(_0x1a6851){return _0x1a6851['update']({'closed':_0x5506ec[_0xd342('0x2e')][_0xd342('0x65')],'disposition':_0x5506ec[_0xd342('0x2e')][_0xd342('0x66')]})[_0xd342('0x15')](function(_0x28c5ce){return _0x28c5ce;});}})[_0xd342('0x15')](function(){return respondWithRpcPromise(_0xd342('0x67'),'abandon',_0x5506ec[_0xd342('0x2e')],client9004);})[_0xd342('0x15')](respondWithResult(_0x65ecb6,null))[_0xd342('0x1f')](handleError(_0x65ecb6,null));};exports['attachmentUpload']=function(_0x3461c0,_0x90ec18){_0x3461c0['body'][_0xd342('0x2c')]=_0x3461c0[_0xd342('0x68')][_0xd342('0x69')];_0x3461c0[_0xd342('0x2e')][_0xd342('0x6a')]=_0x3461c0[_0xd342('0x68')][_0xd342('0x6b')];_0x3461c0[_0xd342('0x2e')][_0xd342('0x36')]=_0x3461c0[_0xd342('0x68')]['mimetype'];return db[_0xd342('0x6c')][_0xd342('0x47')](_0x3461c0['body'])['then'](respondWithResult(_0x90ec18,0xc9))[_0xd342('0x1f')](handleError(_0x90ec18,null));};exports['attachmentDownload']=function(_0x5aeaff,_0x9e219f){return db[_0xd342('0x33')][_0xd342('0x4a')]({'where':{'id':_0x5aeaff[_0xd342('0x3c')]['id']},'raw':!![]})[_0xd342('0x15')](handleEntityNotFound(_0x9e219f,null))[_0xd342('0x15')](function(_0x1a7069){if(_0x1a7069){if(_0x1a7069[_0xd342('0x65')]){return _0x9e219f[_0xd342('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xd342('0x6c')][_0xd342('0x4a')]({'where':{'id':_0x5aeaff[_0xd342('0x3a')][_0xd342('0x6d')]},'raw':!![]})[_0xd342('0x15')](handleEntityNotFound(_0x9e219f,null));}})[_0xd342('0x15')](function(_0x5381bd){if(_0x5381bd){var _0x2a765b=_0x5381bd[_0xd342('0x6e')]!==null;var _0x5af749=path[_0xd342('0x6f')](config['root'],_0xd342('0x70'));if(_0x2a765b){_0x5af749=path['join'](_0x5af749,_0xd342('0x71'));}var _0x1b41db=path[_0xd342('0x6f')](_0x5af749,_0x5381bd['basename']);return _0x9e219f['download'](_0x1b41db);}})[_0xd342('0x1f')](handleError(_0x9e219f,null));};exports[_0xd342('0x72')]=function(_0x39760f,_0xe5aae0){var _0x3bc148=null;var _0x5af3b6=null;var _0x384065=null;if(_0x39760f[_0xd342('0x2e')]['id']){delete _0x39760f[_0xd342('0x2e')]['id'];}if(_0x39760f[_0xd342('0x2e')][_0xd342('0x73')]){_0x384065=path[_0xd342('0x6f')](config['root'],'server/files/chat/upload/',util[_0xd342('0x74')]('transcript-%s.txt',Date['now']()));_0x39760f['body'][_0xd342('0x75')]=_0x384065;}return db[_0xd342('0x33')][_0xd342('0x46')]({'where':{'id':_0x39760f['params']['id']},'include':[{'model':db[_0xd342('0x76')],'as':_0xd342('0x77'),'include':[{'model':db[_0xd342('0x78')],'as':'User'}]}]})['then'](handleEntityNotFound(_0xe5aae0,null))['then'](saveUpdates(_0x39760f[_0xd342('0x2e')],null))[_0xd342('0x15')](function(_0x1a717f){if(_0x1a717f){_0x3bc148=_0x1a717f;return db[_0xd342('0x4b')][_0xd342('0x46')]({'where':{'id':_0x3bc148[_0xd342('0x79')]}});}})[_0xd342('0x15')](function(_0xad41a1){if(_0xad41a1){_0x5af3b6=_0xad41a1;return db[_0xd342('0x5f')][_0xd342('0x46')]({'where':{'id':_0x3bc148[_0xd342('0x7a')]}});}})[_0xd342('0x15')](function(_0x24049c){if(_0x24049c){if(_0x384065){var _0x268b7a=null;for(var _0xe315ce=0x1;_0xe315ce<_0x3bc148[_0xd342('0x77')][_0xd342('0x7b')];++_0xe315ce){_0x268b7a=_0x3bc148[_0xd342('0x77')][_0xe315ce];var _0x1daaa1=_0x268b7a[_0xd342('0x7c')]?util[_0xd342('0x74')](_0xd342('0x7d'),_0x5af3b6['agentAlias'],_0x268b7a[_0xd342('0x7c')]):_0xd342('0x7e');var _0x1dbe57=_0x39760f[_0xd342('0x2e')][_0xd342('0x7f')]||util[_0xd342('0x74')]('%s%d',_0xd342('0x80'),_0x268b7a[_0xd342('0x7a')]);switch(_0x5af3b6['agentIdentifier']){case _0xd342('0x81'):_0x1daaa1=_0x268b7a['UserId']?util[_0xd342('0x74')](_0xd342('0x7d'),_0x5af3b6['agentAlias'],_0x268b7a[_0xd342('0x7c')]):_0xd342('0x7e');break;case _0xd342('0x82'):_0x1daaa1=_0x268b7a[_0xd342('0x7c')]?_0x268b7a[_0xd342('0x78')]['alias']||_0x268b7a[_0xd342('0x78')][_0xd342('0x51')]:_0xd342('0x7e');break;case'agent_fullname':_0x1daaa1=_0x268b7a[_0xd342('0x7c')]?_0x268b7a[_0xd342('0x78')][_0xd342('0x51')]:_0xd342('0x7e');break;default:_0x1daaa1=_0x268b7a[_0xd342('0x7c')]?util[_0xd342('0x74')]('%s%d',_0x5af3b6[_0xd342('0x83')],_0x268b7a['UserId']):_0xd342('0x7e');}var _0x43a61a=util[_0xd342('0x74')](_0xd342('0x84'),moment(_0x268b7a[_0xd342('0x85')])['format'](_0xd342('0x86')),_0x268b7a[_0xd342('0x87')]==='in'?_0x1dbe57:_0x1daaa1,_0x268b7a[_0xd342('0x2e')]);if(!_0x268b7a[_0xd342('0x88')]){fs['appendFileSync'](_0x384065,_0x43a61a);}}return db[_0xd342('0x89')][_0xd342('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd342('0x8a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd342('0x8b'),'raw':!![]}]}]});}}})[_0xd342('0x15')](function(_0x1c8b31){if(!_0x1c8b31||!_0x1c8b31[_0xd342('0x8a')]||!_0x39760f[_0xd342('0x2e')])return _0x3bc148;var _0x442151=_0x1c8b31[_0xd342('0x8c')]();return respondWithRpcPromise(_0xd342('0x8d'),_0xd342('0x8e'),{'account':_0x442151,'message':{'from':util[_0xd342('0x74')]('\x22%s\x22\x20<%s>',_0x1c8b31['name'],_0x1c8b31['email']||_0x1c8b31['Smtp'][_0xd342('0x3b')]),'to':_0x39760f[_0xd342('0x2e')][_0xd342('0x73')],'subject':'Mail\x20Transcript','text':util['format'](_0xd342('0x8f'),_0x39760f['body']['mailTranscript']),'attachments':[{'path':_0x384065}]}})[_0xd342('0x15')](function(){return _0x3bc148;})[_0xd342('0x1f')](function(_0x5bc3e4){logger['error'](_0x5bc3e4);});})[_0xd342('0x15')](respondWithStatusCode(_0xe5aae0,0xc8))[_0xd342('0x1f')](handleError(_0xe5aae0,null));};exports[_0xd342('0x90')]=function(_0x3e5a79,_0xfe7cd2){return db[_0xd342('0x76')]['find']({'where':{'id':_0x3e5a79['params']['id']}})[_0xd342('0x15')](handleEntityNotFound(_0xfe7cd2,null))[_0xd342('0x15')](function(_0x5d6346){if(_0x5d6346){return _0x5d6346[_0xd342('0x90')](_0x3e5a79[_0xd342('0x2e')]['ids'],_[_0xd342('0x91')](_0x3e5a79['body'],[_0xd342('0x92'),'id'])||{});}})[_0xd342('0x15')](respondWithResult(_0xfe7cd2,null))[_0xd342('0x1f')](handleError(_0xfe7cd2,null));};exports['getMessages']=function(_0x29ea17,_0x1a4d02){var _0x3713fb={'raw':![],'where':{}};var _0x43d2b7={};var _0x4774e7={'count':0x0,'rows':[]};return db[_0xd342('0x33')]['findOne']({'where':{'id':_0x29ea17[_0xd342('0x3c')]['id']}})[_0xd342('0x15')](handleEntityNotFound(_0x1a4d02,null))[_0xd342('0x15')](function(_0x3443fa){if(_0x3443fa){_0x43d2b7[_0xd342('0x3d')]=_[_0xd342('0x93')](db[_0xd342('0x76')][_0xd342('0x34')]);_0x43d2b7['query']=_[_0xd342('0x93')](_0x29ea17[_0xd342('0x3a')]);_0x43d2b7['filters']=_[_0xd342('0x3f')](_0x43d2b7[_0xd342('0x3d')],_0x43d2b7[_0xd342('0x3a')]);_0x3713fb[_0xd342('0x40')]=_['intersection'](_0x43d2b7[_0xd342('0x3d')],qs['fields'](_0x29ea17[_0xd342('0x3a')][_0xd342('0x41')]));_0x3713fb['attributes']=_0x3713fb[_0xd342('0x40')][_0xd342('0x7b')]?_0x3713fb[_0xd342('0x40')]:_0x43d2b7['model'];if(!_0x29ea17[_0xd342('0x3a')][_0xd342('0x94')](_0xd342('0x95'))){_0x3713fb['limit']=qs[_0xd342('0x23')](_0x29ea17[_0xd342('0x3a')][_0xd342('0x23')]);_0x3713fb['offset']=qs[_0xd342('0x25')](_0x29ea17['query']['offset']);}_0x3713fb[_0xd342('0x96')]=qs['sort'](_0x29ea17[_0xd342('0x3a')][_0xd342('0x97')]);_0x3713fb['where']=qs[_0xd342('0x3e')](_[_0xd342('0x98')](_0x29ea17[_0xd342('0x3a')],_0x43d2b7['filters']));_0x3713fb[_0xd342('0x99')]['ChatInteractionId']=_0x3443fa['id'];if(_0x29ea17['query'][_0xd342('0x9a')]){_0x3713fb[_0xd342('0x99')]=_['merge'](_0x3713fb[_0xd342('0x99')],{'$or':_['map'](_0x3713fb[_0xd342('0x40')],function(_0x244fc9){var _0x1c599e={};_0x1c599e[_0x244fc9]={'$like':'%'+_0x29ea17[_0xd342('0x3a')][_0xd342('0x9a')]+'%'};return _0x1c599e;})});}if(_0x29ea17[_0xd342('0x3a')]['$gte']){var _0x38f624=_0x29ea17[_0xd342('0x3a')][_0xd342('0x9b')][_0xd342('0x9c')](',');var _0x3d2106={};_0x3d2106[_0x38f624[0x0]]={'$gte':moment(_0x38f624[0x1])[_0xd342('0x74')](_0xd342('0x9d'))};_0x3713fb[_0xd342('0x99')]=_[_0xd342('0x44')](_0x3713fb[_0xd342('0x99')],_0x3d2106);}_0x3713fb=_[_0xd342('0x44')]({},_0x3713fb,_0x29ea17[_0xd342('0x45')]);return db['ChatMessage'][_0xd342('0x24')]({'where':_0x3713fb[_0xd342('0x99')]})[_0xd342('0x15')](function(_0x33d39c){_0x4774e7[_0xd342('0x24')]=_0x33d39c;if(_0x29ea17[_0xd342('0x3a')]['includeAll']){_0x3713fb[_0xd342('0x43')]=[{'all':!![]}];}return db[_0xd342('0x76')][_0xd342('0x38')](_0x3713fb);})[_0xd342('0x15')](function(_0x2e01b5){_0x4774e7[_0xd342('0x9e')]=_0x2e01b5;return _0x4774e7;});}})[_0xd342('0x15')](respondWithFilteredResult(_0x1a4d02,_0x3713fb))['catch'](handleError(_0x1a4d02,null));};exports[_0xd342('0x9f')]=function(_0x1c2249,_0x2a2499){var _0x3fc25e={'where':{}},_0x34afe5={},_0x128c82={'count':0x0,'rows':[]};return db[_0xd342('0x33')][_0xd342('0x4a')]({'where':{'id':_0x1c2249[_0xd342('0x3c')]['id']}})[_0xd342('0x15')](handleEntityNotFound(_0x2a2499,null))['then'](function(_0x5ba894){if(_0x5ba894){_0x34afe5[_0xd342('0x3d')]=_[_0xd342('0x93')](db[_0xd342('0x76')][_0xd342('0x34')]);_0x34afe5[_0xd342('0x3a')]=_[_0xd342('0x93')](_0x1c2249[_0xd342('0x3a')]);_0x34afe5['filters']=_[_0xd342('0x3f')](_0x34afe5[_0xd342('0x3d')],_0x34afe5[_0xd342('0x3a')]);_0x3fc25e[_0xd342('0x40')]=_[_0xd342('0x3f')](_0x34afe5[_0xd342('0x3d')],qs[_0xd342('0x41')](_0x1c2249[_0xd342('0x3a')][_0xd342('0x41')]));_0x3fc25e[_0xd342('0x40')]=_0x3fc25e[_0xd342('0x40')]['length']?_0x3fc25e[_0xd342('0x40')]:_0x34afe5[_0xd342('0x3d')];if(!_0x1c2249[_0xd342('0x3a')][_0xd342('0x94')](_0xd342('0x95'))){_0x3fc25e[_0xd342('0x23')]=qs[_0xd342('0x23')](_0x1c2249[_0xd342('0x3a')][_0xd342('0x23')]);_0x3fc25e['offset']=qs[_0xd342('0x25')](_0x1c2249[_0xd342('0x3a')][_0xd342('0x25')]);}_0x3fc25e[_0xd342('0x96')]=qs[_0xd342('0x97')](_0x1c2249[_0xd342('0x3a')][_0xd342('0x97')]);_0x3fc25e[_0xd342('0x99')]=qs[_0xd342('0x3e')](_['pick'](_0x1c2249[_0xd342('0x3a')],_0x34afe5[_0xd342('0x3e')]));_0x3fc25e[_0xd342('0x99')][_0xd342('0xa0')]=_0x5ba894['id'];if(_0x1c2249[_0xd342('0x3a')][_0xd342('0x9a')]){_0x3fc25e[_0xd342('0x99')]=_[_0xd342('0x44')](_0x3fc25e[_0xd342('0x99')],{'$or':_['map'](_0x3fc25e['attributes'],function(_0x2d4721){var _0x10d79c={};_0x10d79c[_0x2d4721]={'$like':'%'+_0x1c2249[_0xd342('0x3a')][_0xd342('0x9a')]+'%'};return _0x10d79c;})});}_0x3fc25e[_0xd342('0x99')]['secret']=![];if(_0x1c2249[_0xd342('0x3a')]['id']){_0x3fc25e[_0xd342('0x99')]['id']={'$gt':_0x1c2249[_0xd342('0x3a')]['id']};}_0x3fc25e=_[_0xd342('0x44')]({},_0x3fc25e,_0x1c2249[_0xd342('0x45')]);return db[_0xd342('0x76')][_0xd342('0x24')]({'where':_0x3fc25e['where']})['then'](function(_0x54235e){_0x128c82[_0xd342('0x24')]=_0x54235e;_0x3fc25e['include']=[];if(_0x1c2249[_0xd342('0x3a')][_0xd342('0xa1')]){_0x3fc25e['include'][_0xd342('0xa2')]({'model':db[_0xd342('0x78')],'as':_0xd342('0x78'),'attributes':['id',_0xd342('0x51'),_0xd342('0xa3')]});}if(_0x1c2249[_0xd342('0x3a')][_0xd342('0x42')]){_0x3fc25e['include']=[{'all':!![]}];}return db[_0xd342('0x76')][_0xd342('0x38')](_0x3fc25e);})[_0xd342('0x15')](function(_0x4d9be9){_0x128c82[_0xd342('0x9e')]=_0x4d9be9;return _0x128c82;});}})[_0xd342('0x15')](respondWithFilteredResult(_0x2a2499,_0x3fc25e))[_0xd342('0x1f')](handleError(_0x2a2499,null));};exports[_0xd342('0xa4')]=function(_0x115ce9,_0x477dba){return db['ChatInteraction'][_0xd342('0x46')]({'where':{'id':_0x115ce9[_0xd342('0x3c')]['id']}})[_0xd342('0x15')](handleEntityNotFound(_0x477dba,null))['then'](function(_0xb682ba){if(_0xb682ba){return _0xb682ba[_0xd342('0xa5')](_0x115ce9[_0xd342('0x2e')][_0xd342('0x92')],_[_0xd342('0x91')](_0x115ce9[_0xd342('0x2e')],[_0xd342('0x92'),'id'])||{})['spread'](function(){return db[_0xd342('0xa6')]['findAll']({'attributes':['id',_0xd342('0x2c'),_0xd342('0xa7')],'where':{'id':_0x115ce9[_0xd342('0x2e')][_0xd342('0x92')]}});})[_0xd342('0x15')](function(_0x30454c){socket['emit'](_0xd342('0xa8'),{'id':Number(_0x115ce9[_0xd342('0x3c')]['id']),'tags':_0x30454c||[]});return{'id':Number(_0x115ce9[_0xd342('0x3c')]['id']),'tags':_0x30454c||[]};});}})[_0xd342('0x15')](respondWithResult(_0x477dba,null))[_0xd342('0x1f')](handleError(_0x477dba,null));};exports[_0xd342('0xa9')]=function(_0x13086a,_0x36f266){return db[_0xd342('0x33')][_0xd342('0x46')]({'where':{'id':_0x13086a['params']['id']}})[_0xd342('0x15')](handleEntityNotFound(_0x36f266,null))[_0xd342('0x15')](function(_0xa294b9){if(_0xa294b9){return _0xa294b9[_0xd342('0xa9')](_0x13086a[_0xd342('0x3a')][_0xd342('0x92')]);}})[_0xd342('0x15')](respondWithStatusCode(_0x36f266,null))[_0xd342('0x1f')](handleError(_0x36f266,null));};exports[_0xd342('0xaa')]=function(_0x23e923,_0x5d3b27){var _0x73bf4b=moment()[_0xd342('0xab')]()[_0xd342('0xac')]();var _0x3636e4=path['join'](config[_0xd342('0xad')],_0xd342('0xae'),'files',_0xd342('0xaf'));var _0x1a6ebd=path[_0xd342('0x6f')](config[_0xd342('0xad')],_0xd342('0xae'),_0xd342('0xb0'),_0xd342('0xb1'));var _0x3474a0=path['join'](_0x3636e4,_0x73bf4b);var _0x2c7e2b=util[_0xd342('0x74')]('transcript-%d-%s.zip',_0x23e923[_0xd342('0x3c')]['id'],_0x73bf4b);var _0x5c6b8c=path[_0xd342('0x6f')](_0x3636e4,_0x2c7e2b);var _0x332658=[];_0x332658[_0xd342('0xa2')]({'model':db[_0xd342('0x78')],'as':_0xd342('0x78'),'attributes':['id','fullname'],'raw':!![]});_0x332658[_0xd342('0xa2')]({'model':db[_0xd342('0x5f')],'as':_0xd342('0x60'),'attributes':['id',_0xd342('0xb2'),_0xd342('0xb3')],'raw':!![]});if(_0x23e923[_0xd342('0x3a')][_0xd342('0xb1')]){_0x332658['push']({'model':db[_0xd342('0x6c')],'as':_0xd342('0x6c'),'raw':!![]});}var _0x3fa383=[{'model':db[_0xd342('0x76')],'as':'Messages','attributes':['id',_0xd342('0x2e'),_0xd342('0x85'),_0xd342('0x87'),_0xd342('0x88'),'read'],'include':_0x332658}];_0x3fa383[_0xd342('0xa2')]({'model':db[_0xd342('0x4b')],'as':_0xd342('0xb4'),'attributes':['id',_0xd342('0x2c')]});_0x3fa383['push']({'model':db[_0xd342('0x78')],'as':_0xd342('0xb5'),'attributes':['id',_0xd342('0x51')]});return db[_0xd342('0x33')]['find']({'where':{'id':_0x23e923[_0xd342('0x3c')]['id']},'include':_0x3fa383})['then'](handleEntityNotFound(_0x5d3b27,null))[_0xd342('0x15')](function(_0x3fa38d){if(_0x3fa38d){var _0x166666=_0x3fa38d[_0xd342('0xb6')]({'plain':!![]});fs[_0xd342('0xb7')](_0x3474a0);var _0x255cd4={'channel':_0xd342('0xb8'),'account':_0x166666['Account'][_0xd342('0x2c')],'agent':_0x166666[_0xd342('0xb5')]?_0x166666[_0xd342('0xb5')][_0xd342('0x51')]:'N.A.','createdAt':moment(_0x166666[_0xd342('0x85')])[_0xd342('0x74')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd342('0xac')](),'closedAt':_0x166666['closed']?moment(_0x166666[_0xd342('0xb9')])[_0xd342('0x74')](_0xd342('0x9d'))['toString']():'','disposition':_0x166666['disposition'],'chatInfo':{'browser':_0x166666['browserName'],'os':_0x166666[_0xd342('0xba')],'referer':_0x166666[_0xd342('0xbb')],'customerIp':_0x166666['customerIp'],'customerPort':_0x166666[_0xd342('0xbc')]?_0x166666[_0xd342('0xbc')]:_0xd342('0xbd')},'messages':_(_0x166666[_0xd342('0x77')])[_0xd342('0xbe')]()['filter']({'secret':![]})[_0xd342('0xbf')](function(_0x363207){if(_0x363207[_0xd342('0x6c')]){var _0x308f33=path['join'](_0x1a6ebd,_0x363207[_0xd342('0x6c')][_0xd342('0x6a')]);if(fs[_0xd342('0xc0')](_0x308f33)){fs['createReadStream'](_0x308f33)[_0xd342('0xc1')](fs[_0xd342('0xc2')](path[_0xd342('0x6f')](_0x3474a0,_0x363207[_0xd342('0x6c')][_0xd342('0x6a')])));}}return{'date':moment(_0x363207[_0xd342('0x85')])[_0xd342('0x74')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd342('0xac')](),'sender':_0x363207['direction']===_0xd342('0x5c')?_0x363207[_0xd342('0x78')]?_0x363207[_0xd342('0x78')][_0xd342('0x51')]:'System':_0x363207['Contact'][_0xd342('0xb2')]+(_0x363207[_0xd342('0x60')][_0xd342('0xb3')]?'\x20'+_0x363207[_0xd342('0x60')][_0xd342('0xb3')]:''),'body':_0x363207['Attachment']?_0x363207[_0xd342('0x6c')]['basename']:_0x363207['body'],'direction':_0x363207[_0xd342('0x87')]===_0xd342('0x5c')?'A':'C','secret':_0x363207[_0xd342('0x88')],'read':_0x363207[_0xd342('0xc3')],'attachment':_0x363207[_0xd342('0x6c')]};})[_0xd342('0xc4')]()};return ejs[_0xd342('0xc5')](path['join'](config[_0xd342('0xad')],_0xd342('0xae'),_0xd342('0xc6'),_0xd342('0xc7')),{'interaction':_0x255cd4})['then'](function(_0x222c06){var _0x3f8fd9=path[_0xd342('0x6f')](_0x3474a0,_0xd342('0xc8')+_0x166666['id']+'-'+_0x73bf4b+_0xd342('0xc9'));var _0x1e09a2={'path':_0x3f8fd9,'channel':'Chat','interactionId':_0x166666['id']};return pdf['createPdfFromHTML'](_0x222c06,_0x1e09a2);})[_0xd342('0x15')](function(){return new Promise(function(_0x3b11db,_0x2f75f4){zipdir(_0x3474a0,{'saveTo':_0x5c6b8c},function(_0x427d42,_0x157a4f){if(_0x427d42)return _0x2f75f4(_0x427d42);return _0x3b11db(_0x157a4f);});})[_0xd342('0x15')](function(){return new BPromise(function(_0xbe79b1,_0xb0d730){rimraf(_0x3474a0,function(_0x3b4862){if(_0x3b4862)_0xb0d730(_0x3b4862);return _0xbe79b1();});});})[_0xd342('0x15')](function(){return _0x5d3b27[_0xd342('0xaa')](_0x5c6b8c,_0x2c7e2b,function(_0x284840){if(_0x284840){logger['error']('err',_0x284840);}else{fs[_0xd342('0xca')](_0x5c6b8c);}});});});}else{return _0x5d3b27[_0xd342('0x20')](0xc8);}})[_0xd342('0x1f')](handleError(_0x5d3b27,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 4391334..503fe9a 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 _0xb9fe=['hook','exports','events','../../mysqldb','ChatInteraction','save','update','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4ccf86,_0x4f71e5){var _0x2e1688=function(_0x17c013){while(--_0x17c013){_0x4ccf86['push'](_0x4ccf86['shift']());}};_0x2e1688(++_0x4f71e5);}(_0xb9fe,0x7a));var _0xeb9f=function(_0x17b169,_0x5e3f15){_0x17b169=_0x17b169-0x0;var _0x2b4ad4=_0xb9fe[_0x17b169];return _0x2b4ad4;};'use strict';var EventEmitter=require(_0xeb9f('0x0'));var ChatInteraction=require(_0xeb9f('0x1'))['db'][_0xeb9f('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb9f('0x3'),'afterUpdate':_0xeb9f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x82cffa){return function(_0x170eb0,_0x50dbb7,_0x4ff700){_0x170eb0['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb9f('0x5')](function(_0x28087e){_0x170eb0[_0xeb9f('0x6')]('Users',_0x28087e['map'](function(_0x2b6b3f){return{'id':_0x2b6b3f['id']};}));return ChatMessage[_0xeb9f('0x7')]({'where':{'ChatInteractionId':_0x170eb0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e89d2){_0x170eb0[_0xeb9f('0x6')](_0xeb9f('0x8'),_0x2e89d2[_0xeb9f('0x9')]);ChatInteractionEvents[_0xeb9f('0xa')](_0x82cffa+':'+_0x170eb0['id'],_0x170eb0);ChatInteractionEvents[_0xeb9f('0xa')](_0x82cffa,_0x170eb0);_0x4ff700(null);})[_0xeb9f('0xb')](_0x4ff700(null));};}for(var e in events){if(events[_0xeb9f('0xc')](e)){var event=events[e];ChatInteraction[_0xeb9f('0xd')](e,emitEvent(event));}}module[_0xeb9f('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xa9d4=['setDataValue','map','findAll','unreadMessages','length','emit','hook','events','ChatInteraction','setMaxListeners','save','update','remove','then'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xa9d4,0xe7));var _0x4a9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9d4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4a9d('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4a9d('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4a9d('0x2')](0x0);var events={'afterCreate':_0x4a9d('0x3'),'afterUpdate':_0x4a9d('0x4'),'afterDestroy':_0x4a9d('0x5')};function emitEvent(_0x33c5f1){return function(_0x3add02,_0x432e1d,_0x64b152){_0x3add02['getUsers']({'attributes':['id'],'raw':!![]})[_0x4a9d('0x6')](function(_0x2e9ff5){_0x3add02[_0x4a9d('0x7')]('Users',_0x2e9ff5[_0x4a9d('0x8')](function(_0x251a65){return{'id':_0x251a65['id']};}));return ChatMessage[_0x4a9d('0x9')]({'where':{'ChatInteractionId':_0x3add02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4a9d('0x6')](function(_0x561a3f){_0x3add02[_0x4a9d('0x7')](_0x4a9d('0xa'),_0x561a3f[_0x4a9d('0xb')]);ChatInteractionEvents[_0x4a9d('0xc')](_0x33c5f1+':'+_0x3add02['id'],_0x3add02);ChatInteractionEvents[_0x4a9d('0xc')](_0x33c5f1,_0x3add02);_0x64b152(null);})['catch'](_0x64b152(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4a9d('0xd')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 62069e7..f451821 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 _0x8155=['define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0x8155,0x198));var _0x5815=function(_0x4ebffa,_0x1ab8db){_0x4ebffa=_0x4ebffa-0x0;var _0x4aec5f=_0x8155[_0x4ebffa];return _0x4aec5f;};'use strict';var _=require(_0x5815('0x0'));var util=require(_0x5815('0x1'));var logger=require(_0x5815('0x2'))(_0x5815('0x3'));var moment=require(_0x5815('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5815('0x5'));var rimraf=require('rimraf');var config=require(_0x5815('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x5815('0x7')]=function(_0x3ba965,_0x1b484e){return _0x3ba965[_0x5815('0x8')](_0x5815('0x9'),attributes,{'tableName':_0x5815('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1df755,_0x2256c5,_0x4fc851){if(_0x1df755[_0x5815('0xb')](_0x5815('0xc'))){_0x1df755[_0x5815('0xd')]=moment()[_0x5815('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4fc851(null,_0x1df755);}},'charset':'utf8mb4','collate':_0x5815('0xf')});}; \ No newline at end of file +var _0x32e0=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_interactions','changed','closed'];(function(_0x4e7df0,_0x46d7a1){var _0x21147f=function(_0x5ce962){while(--_0x5ce962){_0x4e7df0['push'](_0x4e7df0['shift']());}};_0x21147f(++_0x46d7a1);}(_0x32e0,0x1c2));var _0x032e=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0x32e0[_0x589248];return _0x486750;};'use strict';var _=require(_0x032e('0x0'));var util=require(_0x032e('0x1'));var logger=require(_0x032e('0x2'))('api');var moment=require(_0x032e('0x3'));var BPromise=require(_0x032e('0x4'));var rp=require(_0x032e('0x5'));var fs=require('fs');var path=require(_0x032e('0x6'));var rimraf=require(_0x032e('0x7'));var config=require(_0x032e('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x032e('0x9')]=function(_0x647d8d,_0x45e6cb){return _0x647d8d[_0x032e('0xa')]('ChatInteraction',attributes,{'tableName':_0x032e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53e1bf,_0x548439,_0x1da5ae){if(_0x53e1bf[_0x032e('0xc')](_0x032e('0xd'))){_0x53e1bf['closedAt']=moment()[_0x032e('0xe')](_0x032e('0xf'));}_0x1da5ae(null,_0x53e1bf);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ec6121d..8cda53c 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 _0xf0f0=['AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','debug','AddTagsToChatInteraction','find','where','ids','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0f0,0x1c4));var _0x0f0f=function(_0x3bc9a9,_0x4daccb){_0x3bc9a9=_0x3bc9a9-0x0;var _0x29923b=_0xf0f0[_0x3bc9a9];return _0x29923b;};'use strict';var _=require(_0x0f0f('0x0'));var util=require(_0x0f0f('0x1'));var moment=require(_0x0f0f('0x2'));var BPromise=require(_0x0f0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f0f('0x4'));var db=require(_0x0f0f('0x5'))['db'];var utils=require(_0x0f0f('0x6'));var logger=require(_0x0f0f('0x7'))(_0x0f0f('0x8'));var config=require(_0x0f0f('0x9'));var jayson=require(_0x0f0f('0xa'));var client=jayson[_0x0f0f('0xb')][_0x0f0f('0xc')]({'port':0x232a});config[_0x0f0f('0xd')]=_[_0x0f0f('0xe')](config[_0x0f0f('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f0f('0xd')]));require(_0x0f0f('0xf'))['register'](socket);function respondWithRpcPromise(_0x30b8e6,_0xed9ed5,_0x2f0301){return new BPromise(function(_0x5e6878,_0x371465){return client[_0x0f0f('0x10')](_0x30b8e6,_0x2f0301)[_0x0f0f('0x11')](function(_0x44b2be){logger[_0x0f0f('0x12')](_0x0f0f('0x13'),_0xed9ed5,'request\x20sent');logger['debug'](_0x0f0f('0x14'),_0xed9ed5,_0x0f0f('0x15'),JSON[_0x0f0f('0x16')](_0x44b2be));if(_0x44b2be[_0x0f0f('0x17')]){if(_0x44b2be['error'][_0x0f0f('0x18')]===0x1f4){logger[_0x0f0f('0x17')](_0x0f0f('0x13'),_0xed9ed5,_0x44b2be[_0x0f0f('0x17')][_0x0f0f('0x19')]);return _0x371465(_0x44b2be[_0x0f0f('0x17')][_0x0f0f('0x19')]);}logger[_0x0f0f('0x17')](_0x0f0f('0x13'),_0xed9ed5,_0x44b2be[_0x0f0f('0x17')][_0x0f0f('0x19')]);return _0x5e6878(_0x44b2be[_0x0f0f('0x17')][_0x0f0f('0x19')]);}else{logger[_0x0f0f('0x12')](_0x0f0f('0x13'),_0xed9ed5,_0x0f0f('0x15'));_0x5e6878(_0x44b2be[_0x0f0f('0x1a')][_0x0f0f('0x19')]);}})[_0x0f0f('0x1b')](function(_0x84fb6d){logger[_0x0f0f('0x17')](_0x0f0f('0x13'),_0xed9ed5,_0x84fb6d);_0x371465(_0x84fb6d);});});}exports[_0x0f0f('0x1c')]=function(_0x3604ad){var _0x21ef0a=this;return new Promise(function(_0xcb35a8,_0x506f23){return db[_0x0f0f('0x1d')][_0x0f0f('0x1e')](_0x3604ad[_0x0f0f('0x1f')],{'raw':_0x3604ad['options']?_0x3604ad['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3604ad[_0x0f0f('0x20')]?_0x3604ad[_0x0f0f('0x20')]['where']||null:null,'attributes':_0x3604ad['options']?_0x3604ad['options'][_0x0f0f('0x21')]||null:null,'limit':_0x3604ad[_0x0f0f('0x20')]?_0x3604ad[_0x0f0f('0x20')]['limit']||null:null})[_0x0f0f('0x11')](function(_0x53c545){logger[_0x0f0f('0x12')]('UpdateChatInteraction',_0x3604ad);logger[_0x0f0f('0x22')](_0x0f0f('0x1c'),_0x3604ad,JSON[_0x0f0f('0x16')](_0x53c545));_0xcb35a8(_0x53c545);})['catch'](function(_0x5e37c2){logger[_0x0f0f('0x17')](_0x0f0f('0x1c'),_0x5e37c2['message'],_0x3604ad);_0x506f23(_0x21ef0a[_0x0f0f('0x17')](0x1f4,_0x5e37c2[_0x0f0f('0x19')]));});});};exports[_0x0f0f('0x23')]=function(_0x2bef08){return new Promise(function(_0x10b2d8,_0x26a378){return db['ChatInteraction'][_0x0f0f('0x24')]({'where':_0x2bef08[_0x0f0f('0x20')]?_0x2bef08[_0x0f0f('0x20')][_0x0f0f('0x25')]||null:null})[_0x0f0f('0x11')](function(_0x460549){if(_0x460549){return _0x460549['addTags'](_0x2bef08[_0x0f0f('0x1f')][_0x0f0f('0x26')],_[_0x0f0f('0x27')](_0x2bef08[_0x0f0f('0x1f')],[_0x0f0f('0x26'),'id'])||{});}})['spread'](function(_0x4f2df0){logger[_0x0f0f('0x12')](_0x0f0f('0x28'),_0x2bef08);logger[_0x0f0f('0x22')](_0x0f0f('0x28'),_0x2bef08,JSON[_0x0f0f('0x16')](_0x4f2df0));_0x10b2d8(_0x4f2df0);})[_0x0f0f('0x1b')](function(_0x42ea63){logger[_0x0f0f('0x17')](_0x0f0f('0x28'),_0x42ea63[_0x0f0f('0x19')],_0x2bef08);_0x26a378(_this[_0x0f0f('0x17')](0x1f4,_0x42ea63[_0x0f0f('0x19')]));});});}; \ No newline at end of file +var _0x2f25=['defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','raw','options','where','attributes','limit','ChatInteraction','find','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x576517,_0x9e3a86){var _0x10d62a=function(_0x4e3c8d){while(--_0x4e3c8d){_0x576517['push'](_0x576517['shift']());}};_0x10d62a(++_0x9e3a86);}(_0x2f25,0xeb));var _0x52f2=function(_0x419a9e,_0x283d06){_0x419a9e=_0x419a9e-0x0;var _0x18105d=_0x2f25[_0x419a9e];return _0x18105d;};'use strict';var _=require('lodash');var util=require(_0x52f2('0x0'));var moment=require(_0x52f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x52f2('0x2'));var fs=require('fs');var Redis=require(_0x52f2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52f2('0x4'));var logger=require('../../config/logger')(_0x52f2('0x5'));var config=require(_0x52f2('0x6'));var jayson=require(_0x52f2('0x7'));var client=jayson[_0x52f2('0x8')][_0x52f2('0x9')]({'port':0x232a});config[_0x52f2('0xa')]=_[_0x52f2('0xb')](config[_0x52f2('0xa')],{'host':_0x52f2('0xc'),'port':0x18eb});var socket=require(_0x52f2('0xd'))(new Redis(config[_0x52f2('0xa')]));require('./chatInteraction.socket')[_0x52f2('0xe')](socket);function respondWithRpcPromise(_0x27b32d,_0x53c1c9,_0x44b080){return new BPromise(function(_0x1de7e0,_0x4091ac){return client[_0x52f2('0xf')](_0x27b32d,_0x44b080)[_0x52f2('0x10')](function(_0x5e2c5e){logger[_0x52f2('0x11')](_0x52f2('0x12'),_0x53c1c9,'request\x20sent');logger[_0x52f2('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x53c1c9,_0x52f2('0x14'),JSON[_0x52f2('0x15')](_0x5e2c5e));if(_0x5e2c5e['error']){if(_0x5e2c5e[_0x52f2('0x16')][_0x52f2('0x17')]===0x1f4){logger[_0x52f2('0x16')](_0x52f2('0x12'),_0x53c1c9,_0x5e2c5e[_0x52f2('0x16')][_0x52f2('0x18')]);return _0x4091ac(_0x5e2c5e[_0x52f2('0x16')][_0x52f2('0x18')]);}logger[_0x52f2('0x16')](_0x52f2('0x12'),_0x53c1c9,_0x5e2c5e['error'][_0x52f2('0x18')]);return _0x1de7e0(_0x5e2c5e['error'][_0x52f2('0x18')]);}else{logger[_0x52f2('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x53c1c9,'request\x20sent');_0x1de7e0(_0x5e2c5e[_0x52f2('0x19')][_0x52f2('0x18')]);}})[_0x52f2('0x1a')](function(_0x5862e1){logger[_0x52f2('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x53c1c9,_0x5862e1);_0x4091ac(_0x5862e1);});});}exports[_0x52f2('0x1b')]=function(_0x1880d6){var _0x3693c1=this;return new Promise(function(_0xe41664,_0x188de1){return db['ChatInteraction'][_0x52f2('0x1c')](_0x1880d6[_0x52f2('0x1d')],{'raw':_0x1880d6['options']?_0x1880d6['options'][_0x52f2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1880d6[_0x52f2('0x1f')]?_0x1880d6['options'][_0x52f2('0x20')]||null:null,'attributes':_0x1880d6[_0x52f2('0x1f')]?_0x1880d6[_0x52f2('0x1f')][_0x52f2('0x21')]||null:null,'limit':_0x1880d6[_0x52f2('0x1f')]?_0x1880d6[_0x52f2('0x1f')][_0x52f2('0x22')]||null:null})[_0x52f2('0x10')](function(_0x42b0c5){logger[_0x52f2('0x11')](_0x52f2('0x1b'),_0x1880d6);logger[_0x52f2('0x13')]('UpdateChatInteraction',_0x1880d6,JSON[_0x52f2('0x15')](_0x42b0c5));_0xe41664(_0x42b0c5);})[_0x52f2('0x1a')](function(_0x14e91c){logger[_0x52f2('0x16')](_0x52f2('0x1b'),_0x14e91c['message'],_0x1880d6);_0x188de1(_0x3693c1['error'](0x1f4,_0x14e91c[_0x52f2('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x55e688){return new Promise(function(_0x221fa5,_0x458071){return db[_0x52f2('0x23')][_0x52f2('0x24')]({'where':_0x55e688[_0x52f2('0x1f')]?_0x55e688[_0x52f2('0x1f')][_0x52f2('0x20')]||null:null})[_0x52f2('0x10')](function(_0x420074){if(_0x420074){return _0x420074[_0x52f2('0x25')](_0x55e688[_0x52f2('0x1d')][_0x52f2('0x26')],_['omit'](_0x55e688[_0x52f2('0x1d')],['ids','id'])||{});}})[_0x52f2('0x27')](function(_0x5a327f){logger['info']('AddTags',_0x55e688);logger[_0x52f2('0x13')](_0x52f2('0x28'),_0x55e688,JSON['stringify'](_0x5a327f));_0x221fa5(_0x5a327f);})[_0x52f2('0x1a')](function(_0x3a75b9){logger[_0x52f2('0x16')](_0x52f2('0x28'),_0x3a75b9[_0x52f2('0x18')],_0x55e688);_0x458071(_this[_0x52f2('0x16')](0x1f4,_0x3a75b9[_0x52f2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0a61383..ce35f0c 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 _0x5489=['removeListener','register','./chatInteraction.events','save','remove','update'];(function(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0x5489,0x10a));var _0x9548=function(_0xeda869,_0x101e27){_0xeda869=_0xeda869-0x0;var _0x4a6e8f=_0x5489[_0xeda869];return _0x4a6e8f;};'use strict';var ChatInteractionEvents=require(_0x9548('0x0'));var events=[_0x9548('0x1'),_0x9548('0x2'),_0x9548('0x3')];function createListener(_0x164d0d,_0x36fdc9){return function(_0x155746){_0x36fdc9['emit'](_0x164d0d,_0x155746);};}function removeListener(_0xb06c04,_0x1969dc){return function(){ChatInteractionEvents[_0x9548('0x4')](_0xb06c04,_0x1969dc);};}exports[_0x9548('0x5')]=function(_0x2e8c5c){for(var _0x138c5a=0x0,_0x115571=events['length'];_0x138c5a<_0x115571;_0x138c5a++){var _0x497fd0=events[_0x138c5a];var _0x278a5e=createListener('chatInteraction:'+_0x497fd0,_0x2e8c5c);ChatInteractionEvents['on'](_0x497fd0,_0x278a5e);}}; \ No newline at end of file +var _0xc92c=['removeListener','register','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0x527140,_0x51c24d){var _0x3b8efd=function(_0xe8ab42){while(--_0xe8ab42){_0x527140['push'](_0x527140['shift']());}};_0x3b8efd(++_0x51c24d);}(_0xc92c,0x176));var _0xcc92=function(_0x23a3c9,_0x5dada2){_0x23a3c9=_0x23a3c9-0x0;var _0x1f533a=_0xc92c[_0x23a3c9];return _0x1f533a;};'use strict';var ChatInteractionEvents=require(_0xcc92('0x0'));var events=[_0xcc92('0x1'),_0xcc92('0x2'),'update'];function createListener(_0x3d233a,_0xb4cb3b){return function(_0x502e19){_0xb4cb3b[_0xcc92('0x3')](_0x3d233a,_0x502e19);};}function removeListener(_0x371c1e,_0x353503){return function(){ChatInteractionEvents[_0xcc92('0x4')](_0x371c1e,_0x353503);};}exports[_0xcc92('0x5')]=function(_0x1fbefa){for(var _0x598bfb=0x0,_0x20aab7=events['length'];_0x598bfb<_0x20aab7;_0x598bfb++){var _0x3c4ddb=events[_0x598bfb];var _0x16a898=createListener(_0xcc92('0x6')+_0x3c4ddb,_0x1fbefa);ChatInteractionEvents['on'](_0x3c4ddb,_0x16a898);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ff18ffb..bb8f7da 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 _0xb954=['format','%s-%s','now','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/'];(function(_0x1bab70,_0x399ccf){var _0x44a639=function(_0x36c682){while(--_0x36c682){_0x1bab70['push'](_0x1bab70['shift']());}};_0x44a639(++_0x399ccf);}(_0xb954,0x151));var _0x4b95=function(_0x3c6f79,_0x3ed502){_0x3c6f79=_0x3c6f79-0x0;var _0x311855=_0xb954[_0x3c6f79];return _0x311855;};'use strict';var multer=require(_0x4b95('0x0'));var util=require('util');var path=require(_0x4b95('0x1'));var timeout=require(_0x4b95('0x2'));var express=require(_0x4b95('0x3'));var router=express[_0x4b95('0x4')]();var fs_extra=require(_0x4b95('0x5'));var auth=require(_0x4b95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b95('0x7'));var controller=require('./chatInteraction.controller');router[_0x4b95('0x8')]('/',auth[_0x4b95('0x9')](),controller['index']);router[_0x4b95('0x8')](_0x4b95('0xa'),auth[_0x4b95('0x9')](),controller['describe']);router[_0x4b95('0x8')]('/:id',auth[_0x4b95('0xb')](),controller[_0x4b95('0xc')]);router[_0x4b95('0x8')]('/:id/attachment_download',auth[_0x4b95('0xb')](),controller[_0x4b95('0xd')]);router['get'](_0x4b95('0xe'),auth[_0x4b95('0x9')](),controller[_0x4b95('0xf')]);router[_0x4b95('0x8')](_0x4b95('0x10'),auth[_0x4b95('0xb')](),controller[_0x4b95('0x11')]);router[_0x4b95('0x8')](_0x4b95('0x12'),auth[_0x4b95('0x9')](),controller[_0x4b95('0x13')]);router['post']('/',auth[_0x4b95('0x9')](),controller[_0x4b95('0x14')]);router[_0x4b95('0x15')](_0x4b95('0x16'),auth[_0x4b95('0x9')](),controller[_0x4b95('0x17')]);var upload=multer({'storage':multer[_0x4b95('0x18')]({'destination':function(_0x3c51ef,_0x267e12,_0x4f27ca){_0x4f27ca(null,path['join'](config[_0x4b95('0x19')],_0x4b95('0x1a')));},'filename':function(_0x3aaa73,_0x412ad5,_0x4acd7f){_0x4acd7f(null,util[_0x4b95('0x1b')](_0x4b95('0x1c'),Date[_0x4b95('0x1d')](),_0x412ad5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4b95('0x15')](_0x4b95('0x1e'),upload[_0x4b95('0x1f')](_0x4b95('0x20')),controller[_0x4b95('0x21')]);router[_0x4b95('0x15')](_0x4b95('0xe'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x4b95('0x22'),auth[_0x4b95('0x9')](),interaction[_0x4b95('0x23')](_0x4b95('0x24'),_0x4b95('0x25')),controller[_0x4b95('0x26')]);router[_0x4b95('0x27')](_0x4b95('0x28'),auth[_0x4b95('0x9')](),interaction[_0x4b95('0x23')](_0x4b95('0x24'),'chatinteraction:update'),controller[_0x4b95('0x29')]);router[_0x4b95('0x27')](_0x4b95('0x2a'),controller[_0x4b95('0x2b')]);router[_0x4b95('0x27')](_0x4b95('0x2c'),auth[_0x4b95('0xb')](),controller[_0x4b95('0x2d')]);router['put'](_0x4b95('0x2e'),controller[_0x4b95('0x2f')]);router[_0x4b95('0x30')](_0x4b95('0x28'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x4b95('0x31')),controller[_0x4b95('0x32')]);router['delete'](_0x4b95('0x22'),auth['isAuthenticated'](),controller[_0x4b95('0x33')]);module['exports']=router; \ No newline at end of file +var _0xd101=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x4e98ba,_0x230c24){var _0x34cbaa=function(_0x1dfce2){while(--_0x1dfce2){_0x4e98ba['push'](_0x4e98ba['shift']());}};_0x34cbaa(++_0x230c24);}(_0xd101,0x19a));var _0x1d10=function(_0x3da498,_0x3d6aed){_0x3da498=_0x3da498-0x0;var _0x28f042=_0xd101[_0x3da498];return _0x28f042;};'use strict';var multer=require(_0x1d10('0x0'));var util=require(_0x1d10('0x1'));var path=require('path');var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1d10('0x7'));router['get']('/',auth[_0x1d10('0x8')](),controller[_0x1d10('0x9')]);router[_0x1d10('0xa')](_0x1d10('0xb'),auth[_0x1d10('0x8')](),controller[_0x1d10('0xc')]);router[_0x1d10('0xa')](_0x1d10('0xd'),auth[_0x1d10('0xe')](),controller['show']);router[_0x1d10('0xa')]('/:id/attachment_download',auth[_0x1d10('0xe')](),controller[_0x1d10('0xf')]);router[_0x1d10('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1d10('0x10')]);router[_0x1d10('0xa')](_0x1d10('0x11'),auth[_0x1d10('0xe')](),controller[_0x1d10('0x12')]);router[_0x1d10('0xa')](_0x1d10('0x13'),auth['isAuthenticated'](),controller[_0x1d10('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d10('0x15')]);router[_0x1d10('0x16')](_0x1d10('0x17'),auth[_0x1d10('0x8')](),controller[_0x1d10('0x18')]);var upload=multer({'storage':multer[_0x1d10('0x19')]({'destination':function(_0x499fe2,_0xc17668,_0x182ff3){_0x182ff3(null,path[_0x1d10('0x1a')](config[_0x1d10('0x1b')],_0x1d10('0x1c')));},'filename':function(_0x3dc5f8,_0x2f8de5,_0x1118ab){_0x1118ab(null,util[_0x1d10('0x1d')](_0x1d10('0x1e'),Date[_0x1d10('0x1f')](),_0x2f8de5[_0x1d10('0x20')][_0x1d10('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1d10('0x16')](_0x1d10('0x22'),upload[_0x1d10('0x23')](_0x1d10('0x24')),controller[_0x1d10('0x25')]);router[_0x1d10('0x16')](_0x1d10('0x26'),auth[_0x1d10('0xe')](),controller[_0x1d10('0x27')]);router[_0x1d10('0x16')](_0x1d10('0x28'),auth[_0x1d10('0x8')](),interaction[_0x1d10('0x29')](_0x1d10('0x2a'),_0x1d10('0x2b')),controller[_0x1d10('0x2c')]);router[_0x1d10('0x2d')](_0x1d10('0xd'),auth['isAuthenticated'](),interaction[_0x1d10('0x29')](_0x1d10('0x2a'),_0x1d10('0x2e')),controller[_0x1d10('0x2f')]);router[_0x1d10('0x2d')](_0x1d10('0x30'),controller[_0x1d10('0x31')]);router[_0x1d10('0x2d')](_0x1d10('0x32'),auth[_0x1d10('0xe')](),controller[_0x1d10('0x33')]);router[_0x1d10('0x2d')]('/:id/close',controller[_0x1d10('0x34')]);router[_0x1d10('0x35')](_0x1d10('0xd'),auth[_0x1d10('0x8')](),interaction[_0x1d10('0x29')](_0x1d10('0x2a'),_0x1d10('0x36')),controller[_0x1d10('0x37')]);router[_0x1d10('0x35')](_0x1d10('0x28'),auth[_0x1d10('0x8')](),controller[_0x1d10('0x38')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 631a415..cb0f8d9 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 _0x46ea=['sequelize','TEXT','medium','BOOLEAN'];(function(_0x20b18d,_0x9aed5){var _0x5391d0=function(_0x38b157){while(--_0x38b157){_0x20b18d['push'](_0x20b18d['shift']());}};_0x5391d0(++_0x9aed5);}(_0x46ea,0x148));var _0xa46e=function(_0x34e1e1,_0x43a5b5){_0x34e1e1=_0x34e1e1-0x0;var _0x4a1f4d=_0x46ea[_0x34e1e1];return _0x4a1f4d;};'use strict';var Sequelize=require(_0xa46e('0x0'));module['exports']={'body':{'type':Sequelize[_0xa46e('0x1')](_0xa46e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa46e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd0aa=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x3b9cbe,_0x14936e){var _0x4bc66a=function(_0x49b208){while(--_0x49b208){_0x3b9cbe['push'](_0x3b9cbe['shift']());}};_0x4bc66a(++_0x14936e);}(_0xd0aa,0x7b));var _0xad0a=function(_0x1f6b84,_0x1e31b1){_0x1f6b84=_0x1f6b84-0x0;var _0x4d3ae3=_0xd0aa[_0x1f6b84];return _0x4d3ae3;};'use strict';var Sequelize=require(_0xad0a('0x0'));module[_0xad0a('0x1')]={'body':{'type':Sequelize[_0xad0a('0x2')](_0xad0a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad0a('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xad0a('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8f63726..2c7e882 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 _0x0052=['redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','params','keys','find','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','read','-createdAt','all','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x14dcc5,_0x163ab7){var _0x35d6cc=function(_0x2de1ae){while(--_0x2de1ae){_0x14dcc5['push'](_0x14dcc5['shift']());}};_0x35d6cc(++_0x163ab7);}(_0x0052,0x128));var _0x2005=function(_0x365c0a,_0x26dcb7){_0x365c0a=_0x365c0a-0x0;var _0x19e3e7=_0x0052[_0x365c0a];return _0x19e3e7;};'use strict';var emlformat=require(_0x2005('0x0'));var rimraf=require(_0x2005('0x1'));var zipdir=require(_0x2005('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2005('0x3'));var BPromise=require(_0x2005('0x4'));var Mustache=require('mustache');var util=require(_0x2005('0x5'));var path=require(_0x2005('0x6'));var sox=require(_0x2005('0x7'));var csv=require('to-csv');var ejs=require(_0x2005('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2005('0x9'));var squel=require(_0x2005('0xa'));var crypto=require('crypto');var jsforce=require(_0x2005('0xb'));var deskjs=require(_0x2005('0xc'));var toCsv=require(_0x2005('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2005('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2005('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2005('0x10'))(_0x2005('0x11'));var utils=require(_0x2005('0x12'));var config=require(_0x2005('0x13'));var licenseUtil=require(_0x2005('0x14'));var db=require(_0x2005('0x15'))['db'];config[_0x2005('0x16')]=_[_0x2005('0x17')](config['redis'],{'host':_0x2005('0x18'),'port':0x18eb});var socket=require(_0x2005('0x19'))(new Redis(config[_0x2005('0x16')]));require('./chatInternalMessage.socket')[_0x2005('0x1a')](socket);function respondWithStatusCode(_0x30e178,_0x13f934){_0x13f934=_0x13f934||0xcc;return function(_0x202cec){if(_0x202cec){return _0x30e178['sendStatus'](_0x13f934);}return _0x30e178[_0x2005('0x1b')](_0x13f934)['end']();};}function respondWithResult(_0x3ee93f,_0x1d07d2){_0x1d07d2=_0x1d07d2||0xc8;return function(_0x4dbcaa){if(_0x4dbcaa){return _0x3ee93f[_0x2005('0x1b')](_0x1d07d2)['json'](_0x4dbcaa);}};}function respondWithFilteredResult(_0x543bc1,_0x484a87){return function(_0x1a0810){if(_0x1a0810){var _0x1647e8=typeof _0x484a87[_0x2005('0x1c')]===_0x2005('0x1d')&&typeof _0x484a87[_0x2005('0x1e')]==='undefined';var _0x16e2ff=_0x1a0810['count'];var _0x1427c3=_0x1647e8?0x0:_0x484a87['offset'];var _0x22c725=_0x1647e8?_0x1a0810[_0x2005('0x1f')]:_0x484a87[_0x2005('0x1c')]+_0x484a87[_0x2005('0x1e')];var _0x1ac740;if(_0x22c725>=_0x16e2ff){_0x22c725=_0x16e2ff;_0x1ac740=0xc8;}else{_0x1ac740=0xce;}_0x543bc1[_0x2005('0x1b')](_0x1ac740);return _0x543bc1[_0x2005('0x20')](_0x2005('0x21'),_0x1427c3+'-'+_0x22c725+'/'+_0x16e2ff)[_0x2005('0x22')](_0x1a0810);}return null;};}function patchUpdates(_0x15d9cd){return function(_0x5c8e78){try{jsonpatch[_0x2005('0x23')](_0x5c8e78,_0x15d9cd,!![]);}catch(_0x451f75){return BPromise[_0x2005('0x24')](_0x451f75);}return _0x5c8e78['save']();};}function saveUpdates(_0x3d7d22,_0x598392){return function(_0x1fd1c3){if(_0x1fd1c3){return _0x1fd1c3[_0x2005('0x25')](_0x3d7d22)['then'](function(_0xe805a3){return _0xe805a3;});}return null;};}function removeEntity(_0x3501a8,_0x3d3649){return function(_0x3ec891){if(_0x3ec891){return _0x3ec891['destroy']()[_0x2005('0x26')](function(){_0x3501a8[_0x2005('0x1b')](0xcc)[_0x2005('0x27')]();});}};}function handleEntityNotFound(_0x3d4a22,_0x512448){return function(_0x4e3b58){if(!_0x4e3b58){_0x3d4a22['sendStatus'](0x194);}return _0x4e3b58;};}function handleError(_0x514168,_0x2d12e7){_0x2d12e7=_0x2d12e7||0x1f4;return function(_0x424435){logger['error'](_0x424435['stack']);if(_0x424435[_0x2005('0x28')]){delete _0x424435['name'];}_0x514168[_0x2005('0x1b')](_0x2d12e7)[_0x2005('0x29')](_0x424435);};}exports[_0x2005('0x2a')]=function(_0x27924f,_0x264257){var _0x1fafea={},_0x21af35={},_0x3a7e29={'count':0x0,'rows':[]};var _0x4408d1=_[_0x2005('0x2b')](db[_0x2005('0x2c')][_0x2005('0x2d')],function(_0xcec449){return{'name':_0xcec449[_0x2005('0x2e')],'type':_0xcec449[_0x2005('0x2f')]['key']};});_0x21af35[_0x2005('0x30')]=_[_0x2005('0x2b')](_0x4408d1,_0x2005('0x28'));_0x21af35['query']=_['keys'](_0x27924f[_0x2005('0x31')]);_0x21af35[_0x2005('0x32')]=_[_0x2005('0x33')](_0x21af35[_0x2005('0x30')],_0x21af35['query']);_0x1fafea[_0x2005('0x34')]=_['intersection'](_0x21af35[_0x2005('0x30')],qs[_0x2005('0x35')](_0x27924f[_0x2005('0x31')]['fields']));_0x1fafea[_0x2005('0x34')]=_0x1fafea[_0x2005('0x34')][_0x2005('0x36')]?_0x1fafea[_0x2005('0x34')]:_0x21af35[_0x2005('0x30')];if(!_0x27924f[_0x2005('0x31')]['hasOwnProperty'](_0x2005('0x37'))){_0x1fafea['limit']=qs['limit'](_0x27924f[_0x2005('0x31')][_0x2005('0x1e')]);_0x1fafea['offset']=qs[_0x2005('0x1c')](_0x27924f[_0x2005('0x31')][_0x2005('0x1c')]);}_0x1fafea[_0x2005('0x38')]=qs[_0x2005('0x39')](_0x27924f[_0x2005('0x31')][_0x2005('0x39')]);_0x1fafea[_0x2005('0x3a')]=qs[_0x2005('0x32')](_['pick'](_0x27924f[_0x2005('0x31')],_0x21af35[_0x2005('0x32')]),_0x4408d1);if(_0x27924f[_0x2005('0x31')][_0x2005('0x3b')]){_0x1fafea[_0x2005('0x3a')]=_[_0x2005('0x3c')](_0x1fafea[_0x2005('0x3a')],{'$or':_[_0x2005('0x2b')](_0x4408d1,function(_0xd51378){if(_0xd51378['type']!==_0x2005('0x3d')){var _0x3a0334={};_0x3a0334[_0xd51378[_0x2005('0x28')]]={'$like':'%'+_0x27924f[_0x2005('0x31')][_0x2005('0x3b')]+'%'};return _0x3a0334;}})});}_0x1fafea=_[_0x2005('0x3c')]({},_0x1fafea,_0x27924f[_0x2005('0x3e')]);var _0x5e1855={'where':_0x1fafea['where']};return db[_0x2005('0x2c')]['count'](_0x5e1855)[_0x2005('0x26')](function(_0x3b3eac){_0x3a7e29[_0x2005('0x1f')]=_0x3b3eac;if(_0x27924f['query']['includeAll']){_0x1fafea[_0x2005('0x3f')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x2005('0x40')](_0x1fafea);})[_0x2005('0x26')](function(_0x19bfc7){_0x3a7e29['rows']=_0x19bfc7;return _0x3a7e29;})[_0x2005('0x26')](respondWithFilteredResult(_0x264257,_0x1fafea))['catch'](handleError(_0x264257,null));};exports['show']=function(_0x232278,_0x1d009e){var _0x266b65={'raw':!![],'where':{'id':_0x232278[_0x2005('0x41')]['id']}},_0x206798={};_0x206798[_0x2005('0x30')]=_[_0x2005('0x42')](db[_0x2005('0x2c')][_0x2005('0x2d')]);_0x206798[_0x2005('0x31')]=_[_0x2005('0x42')](_0x232278['query']);_0x206798[_0x2005('0x32')]=_[_0x2005('0x33')](_0x206798[_0x2005('0x30')],_0x206798[_0x2005('0x31')]);_0x266b65['attributes']=_['intersection'](_0x206798['model'],qs[_0x2005('0x35')](_0x232278[_0x2005('0x31')][_0x2005('0x35')]));_0x266b65['attributes']=_0x266b65[_0x2005('0x34')][_0x2005('0x36')]?_0x266b65['attributes']:_0x206798[_0x2005('0x30')];if(_0x232278[_0x2005('0x31')]['includeAll']){_0x266b65[_0x2005('0x3f')]=[{'all':!![]}];}_0x266b65=_['merge']({},_0x266b65,_0x232278[_0x2005('0x3e')]);return db[_0x2005('0x2c')][_0x2005('0x43')](_0x266b65)['then'](handleEntityNotFound(_0x1d009e,null))[_0x2005('0x26')](respondWithResult(_0x1d009e,null))[_0x2005('0x44')](handleError(_0x1d009e,null));};exports[_0x2005('0x45')]=function(_0xc96105,_0x1b556f){return db[_0x2005('0x2c')][_0x2005('0x45')](_0xc96105[_0x2005('0x46')],{})['then'](respondWithResult(_0x1b556f,0xc9))[_0x2005('0x44')](handleError(_0x1b556f,null));};exports[_0x2005('0x25')]=function(_0x423e0a,_0x3e926c){if(_0x423e0a[_0x2005('0x46')]['id']){delete _0x423e0a[_0x2005('0x46')]['id'];}return db['ChatInternalMessage'][_0x2005('0x43')]({'where':{'id':_0x423e0a[_0x2005('0x41')]['id']}})[_0x2005('0x26')](handleEntityNotFound(_0x3e926c,null))[_0x2005('0x26')](saveUpdates(_0x423e0a[_0x2005('0x46')],null))[_0x2005('0x26')](respondWithResult(_0x3e926c,null))[_0x2005('0x44')](handleError(_0x3e926c,null));};exports[_0x2005('0x47')]=function(_0x54eff2,_0x2b34c3){return db[_0x2005('0x2c')][_0x2005('0x43')]({'where':{'id':_0x54eff2[_0x2005('0x41')]['id']}})[_0x2005('0x26')](handleEntityNotFound(_0x2b34c3,null))[_0x2005('0x26')](removeEntity(_0x2b34c3,null))[_0x2005('0x44')](handleError(_0x2b34c3,null));};exports[_0x2005('0x48')]=function(_0x833b58,_0x59fdfb){return db['ChatInternalMessage'][_0x2005('0x48')]()[_0x2005('0x26')](respondWithResult(_0x59fdfb,null))[_0x2005('0x44')](handleError(_0x59fdfb,null));};function wrapUser(_0x10a470){return function(_0x51577b){var _0x17dcbf=_0x10a470[_0x2005('0x49')]({'plain':!![]});_0x17dcbf[_0x2005('0x4a')]=[];if(_0x51577b){_0x17dcbf[_0x2005('0x4b')]=_0x51577b[_0x2005('0x4c')];_0x17dcbf[_0x2005('0x4d')]=_0x51577b;}else{_0x17dcbf['lastMessageAt']=moment(0x0)[_0x2005('0x4e')](_0x2005('0x4f'));_0x17dcbf[_0x2005('0x4d')]={};}return _0x17dcbf;};}exports[_0x2005('0x50')]=function(_0x3e7d4e,_0x48f070,_0x14e768){var _0x26116e=[];return db[_0x2005('0x51')][_0x2005('0x40')]({'where':{'role':[_0x2005('0x52'),_0x2005('0x53'),_0x2005('0x54')]},'attributes':['id',_0x2005('0x55'),'name',_0x2005('0x56'),_0x2005('0x57'),'internal','online',_0x2005('0x58'),_0x2005('0x59'),_0x2005('0x5a')],'order':qs[_0x2005('0x39')](_0x2005('0x5b')),'include':[{'model':db[_0x2005('0x5c')],'as':_0x2005('0x5d'),'attributes':['id',_0x2005('0x28'),_0x2005('0x2f')],'through':{'attributes':[]}}]})[_0x2005('0x26')](function(_0x1e365e){if(_0x1e365e){var _0x43d983=_0x3e7d4e[_0x2005('0x54')]['get']({'plain':!![]});if(!_0x43d983)throw new Error(_0x2005('0x5e'));if(_0x43d983['role']===_0x2005('0x54')){return db[_0x2005('0x5f')][_0x2005('0x43')]({'where':{'name':_0x2005('0x60'),'userProfileId':_0x43d983[_0x2005('0x61')]},'raw':!![]})['then'](function(_0x3c41ae){if(_0x3c41ae){if(_0x3c41ae[_0x2005('0x62')]===0x0){return db[_0x2005('0x63')][_0x2005('0x40')]({'where':{'sectionId':_0x3c41ae['id']},'raw':!![]})['then'](function(_0x2f507e){var _0x43f8ac=[];if(_[_0x2005('0x64')](_0x2f507e)){_0x43f8ac=_['filter'](_0x1e365e,function(_0x30991a){if(_0x30991a[_0x2005('0x56')]!=='agent'){return _0x30991a;}});return _0x43f8ac;}else{for(var _0x4e4d37=0x0;_0x4e4d37<_0x1e365e[_0x2005('0x36')];_0x4e4d37++){var _0x12b7d2=_0x1e365e[_0x4e4d37];if(_0x12b7d2[_0x2005('0x56')]===_0x2005('0x52')){var _0x34aa89=_['find'](_0x2f507e,function(_0x1f52d4){return _0x1f52d4[_0x2005('0x65')]===_0x12b7d2['id'];});if(_0x34aa89)_0x43f8ac[_0x2005('0x66')](_0x12b7d2);}else{_0x43f8ac[_0x2005('0x66')](_0x12b7d2);}}return _0x43f8ac;}});}else{return _0x1e365e;}}else{var _0x5627b3=_[_0x2005('0x3b')](_0x1e365e,function(_0x4b2453){if(_0x4b2453[_0x2005('0x56')]!==_0x2005('0x52')){return _0x4b2453;}});return _0x5627b3;}});}else{return _0x1e365e;}}})[_0x2005('0x26')](function(_0x4c9b5f){var _0x4ea91a=[];if(_0x4c9b5f){_0x26116e=_0x4c9b5f;for(var _0x449548=0x0;_0x449548<_0x4c9b5f[_0x2005('0x36')];_0x449548+=0x1){_0x26116e[_0x449548]['messages']=[];_0x4ea91a[_0x2005('0x66')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x3e7d4e['user']['id'],_0x4c9b5f[_0x449548]['id']],'ToId':[_0x3e7d4e[_0x2005('0x54')]['id'],_0x4c9b5f[_0x449548]['id']],'ChatGroupId':null},'attributes':['id',_0x2005('0x4c'),'FromId','ToId',_0x2005('0x67'),_0x2005('0x46')],'order':qs[_0x2005('0x39')](_0x2005('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2005('0x26')](wrapUser(_0x4c9b5f[_0x449548])));}return BPromise[_0x2005('0x69')](_0x4ea91a);}return[];})[_0x2005('0x26')](function(_0x472059){return{'rows':_0x472059,'count':_0x472059[_0x2005('0x36')]};})['then'](respondWithResult(_0x48f070,null))[_0x2005('0x44')](handleError(_0x48f070,null));}; \ No newline at end of file +var _0xd02b=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','body','find','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','role','agent','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','pick','filter'];(function(_0x36aaae,_0x4f3119){var _0x4bf3fc=function(_0x4596f4){while(--_0x4596f4){_0x36aaae['push'](_0x36aaae['shift']());}};_0x4bf3fc(++_0x4f3119);}(_0xd02b,0x188));var _0xbd02=function(_0x3610a9,_0x858a67){_0x3610a9=_0x3610a9-0x0;var _0x1c9b85=_0xd02b[_0x3610a9];return _0x1c9b85;};'use strict';var emlformat=require(_0xbd02('0x0'));var rimraf=require(_0xbd02('0x1'));var zipdir=require(_0xbd02('0x2'));var jsonpatch=require(_0xbd02('0x3'));var rp=require(_0xbd02('0x4'));var moment=require(_0xbd02('0x5'));var BPromise=require(_0xbd02('0x6'));var Mustache=require(_0xbd02('0x7'));var util=require(_0xbd02('0x8'));var path=require(_0xbd02('0x9'));var sox=require(_0xbd02('0xa'));var csv=require(_0xbd02('0xb'));var ejs=require(_0xbd02('0xc'));var fs=require('fs');var fs_extra=require(_0xbd02('0xd'));var _=require(_0xbd02('0xe'));var squel=require(_0xbd02('0xf'));var crypto=require(_0xbd02('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd02('0xb'));var querystring=require(_0xbd02('0x11'));var Papa=require('papaparse');var Redis=require(_0xbd02('0x12'));var authService=require(_0xbd02('0x13'));var qs=require(_0xbd02('0x14'));var as=require(_0xbd02('0x15'));var hardwareService=require(_0xbd02('0x16'));var logger=require(_0xbd02('0x17'))(_0xbd02('0x18'));var utils=require(_0xbd02('0x19'));var config=require(_0xbd02('0x1a'));var licenseUtil=require(_0xbd02('0x1b'));var db=require('../../mysqldb')['db'];config[_0xbd02('0x1c')]=_['defaults'](config[_0xbd02('0x1c')],{'host':_0xbd02('0x1d'),'port':0x18eb});var socket=require(_0xbd02('0x1e'))(new Redis(config[_0xbd02('0x1c')]));require(_0xbd02('0x1f'))[_0xbd02('0x20')](socket);function respondWithStatusCode(_0x2a1cd4,_0x3c1d7f){_0x3c1d7f=_0x3c1d7f||0xcc;return function(_0x5cb0f3){if(_0x5cb0f3){return _0x2a1cd4[_0xbd02('0x21')](_0x3c1d7f);}return _0x2a1cd4[_0xbd02('0x22')](_0x3c1d7f)['end']();};}function respondWithResult(_0x3bcbcf,_0x32c871){_0x32c871=_0x32c871||0xc8;return function(_0x852fb6){if(_0x852fb6){return _0x3bcbcf['status'](_0x32c871)[_0xbd02('0x23')](_0x852fb6);}};}function respondWithFilteredResult(_0x1f1f1c,_0x10d604){return function(_0x10bb03){if(_0x10bb03){var _0x44f2ca=typeof _0x10d604[_0xbd02('0x24')]===_0xbd02('0x25')&&typeof _0x10d604['limit']===_0xbd02('0x25');var _0x52d22b=_0x10bb03[_0xbd02('0x26')];var _0x2d81ea=_0x44f2ca?0x0:_0x10d604['offset'];var _0x49a121=_0x44f2ca?_0x10bb03[_0xbd02('0x26')]:_0x10d604[_0xbd02('0x24')]+_0x10d604[_0xbd02('0x27')];var _0x133082;if(_0x49a121>=_0x52d22b){_0x49a121=_0x52d22b;_0x133082=0xc8;}else{_0x133082=0xce;}_0x1f1f1c[_0xbd02('0x22')](_0x133082);return _0x1f1f1c['set'](_0xbd02('0x28'),_0x2d81ea+'-'+_0x49a121+'/'+_0x52d22b)[_0xbd02('0x23')](_0x10bb03);}return null;};}function patchUpdates(_0x4c441e){return function(_0x51b968){try{jsonpatch['apply'](_0x51b968,_0x4c441e,!![]);}catch(_0x53cc33){return BPromise[_0xbd02('0x29')](_0x53cc33);}return _0x51b968[_0xbd02('0x2a')]();};}function saveUpdates(_0x36188b,_0x24a07a){return function(_0x211f9d){if(_0x211f9d){return _0x211f9d[_0xbd02('0x2b')](_0x36188b)[_0xbd02('0x2c')](function(_0x4dca46){return _0x4dca46;});}return null;};}function removeEntity(_0x2f1852,_0x28c379){return function(_0x49df0a){if(_0x49df0a){return _0x49df0a[_0xbd02('0x2d')]()['then'](function(){_0x2f1852[_0xbd02('0x22')](0xcc)[_0xbd02('0x2e')]();});}};}function handleEntityNotFound(_0x563941,_0x303195){return function(_0x48cb6c){if(!_0x48cb6c){_0x563941[_0xbd02('0x21')](0x194);}return _0x48cb6c;};}function handleError(_0x121332,_0x5b9eaf){_0x5b9eaf=_0x5b9eaf||0x1f4;return function(_0x7bdb52){logger[_0xbd02('0x2f')](_0x7bdb52[_0xbd02('0x30')]);if(_0x7bdb52[_0xbd02('0x31')]){delete _0x7bdb52['name'];}_0x121332[_0xbd02('0x22')](_0x5b9eaf)[_0xbd02('0x32')](_0x7bdb52);};}exports[_0xbd02('0x33')]=function(_0x186fa5,_0x2a2fca){var _0x15f8cf={},_0x352bf5={},_0x1cb1d6={'count':0x0,'rows':[]};var _0x1f7131=_[_0xbd02('0x34')](db[_0xbd02('0x35')]['rawAttributes'],function(_0x1638ae){return{'name':_0x1638ae[_0xbd02('0x36')],'type':_0x1638ae[_0xbd02('0x37')]['key']};});_0x352bf5[_0xbd02('0x38')]=_['map'](_0x1f7131,'name');_0x352bf5[_0xbd02('0x39')]=_[_0xbd02('0x3a')](_0x186fa5[_0xbd02('0x39')]);_0x352bf5[_0xbd02('0x3b')]=_['intersection'](_0x352bf5[_0xbd02('0x38')],_0x352bf5['query']);_0x15f8cf[_0xbd02('0x3c')]=_[_0xbd02('0x3d')](_0x352bf5[_0xbd02('0x38')],qs['fields'](_0x186fa5['query']['fields']));_0x15f8cf[_0xbd02('0x3c')]=_0x15f8cf[_0xbd02('0x3c')]['length']?_0x15f8cf[_0xbd02('0x3c')]:_0x352bf5[_0xbd02('0x38')];if(!_0x186fa5[_0xbd02('0x39')]['hasOwnProperty'](_0xbd02('0x3e'))){_0x15f8cf[_0xbd02('0x27')]=qs[_0xbd02('0x27')](_0x186fa5['query']['limit']);_0x15f8cf['offset']=qs['offset'](_0x186fa5[_0xbd02('0x39')][_0xbd02('0x24')]);}_0x15f8cf[_0xbd02('0x3f')]=qs[_0xbd02('0x40')](_0x186fa5[_0xbd02('0x39')][_0xbd02('0x40')]);_0x15f8cf[_0xbd02('0x41')]=qs[_0xbd02('0x3b')](_[_0xbd02('0x42')](_0x186fa5[_0xbd02('0x39')],_0x352bf5[_0xbd02('0x3b')]),_0x1f7131);if(_0x186fa5[_0xbd02('0x39')][_0xbd02('0x43')]){_0x15f8cf[_0xbd02('0x41')]=_[_0xbd02('0x44')](_0x15f8cf[_0xbd02('0x41')],{'$or':_[_0xbd02('0x34')](_0x1f7131,function(_0x16c4bd){if(_0x16c4bd['type']!==_0xbd02('0x45')){var _0x19002c={};_0x19002c[_0x16c4bd[_0xbd02('0x31')]]={'$like':'%'+_0x186fa5['query'][_0xbd02('0x43')]+'%'};return _0x19002c;}})});}_0x15f8cf=_[_0xbd02('0x44')]({},_0x15f8cf,_0x186fa5[_0xbd02('0x46')]);var _0x14d7ce={'where':_0x15f8cf['where']};return db[_0xbd02('0x35')]['count'](_0x14d7ce)['then'](function(_0x2148cf){_0x1cb1d6[_0xbd02('0x26')]=_0x2148cf;if(_0x186fa5['query'][_0xbd02('0x47')]){_0x15f8cf[_0xbd02('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xbd02('0x49')](_0x15f8cf);})[_0xbd02('0x2c')](function(_0x4beaef){_0x1cb1d6[_0xbd02('0x4a')]=_0x4beaef;return _0x1cb1d6;})['then'](respondWithFilteredResult(_0x2a2fca,_0x15f8cf))[_0xbd02('0x4b')](handleError(_0x2a2fca,null));};exports[_0xbd02('0x4c')]=function(_0x589ff4,_0x5f4f3f){var _0x3c3ac3={'raw':!![],'where':{'id':_0x589ff4[_0xbd02('0x4d')]['id']}},_0x5c0759={};_0x5c0759['model']=_[_0xbd02('0x3a')](db[_0xbd02('0x35')][_0xbd02('0x4e')]);_0x5c0759['query']=_[_0xbd02('0x3a')](_0x589ff4[_0xbd02('0x39')]);_0x5c0759['filters']=_[_0xbd02('0x3d')](_0x5c0759[_0xbd02('0x38')],_0x5c0759[_0xbd02('0x39')]);_0x3c3ac3['attributes']=_['intersection'](_0x5c0759[_0xbd02('0x38')],qs[_0xbd02('0x4f')](_0x589ff4[_0xbd02('0x39')][_0xbd02('0x4f')]));_0x3c3ac3[_0xbd02('0x3c')]=_0x3c3ac3['attributes'][_0xbd02('0x50')]?_0x3c3ac3['attributes']:_0x5c0759[_0xbd02('0x38')];if(_0x589ff4[_0xbd02('0x39')]['includeAll']){_0x3c3ac3['include']=[{'all':!![]}];}_0x3c3ac3=_[_0xbd02('0x44')]({},_0x3c3ac3,_0x589ff4[_0xbd02('0x46')]);return db['ChatInternalMessage']['find'](_0x3c3ac3)[_0xbd02('0x2c')](handleEntityNotFound(_0x5f4f3f,null))[_0xbd02('0x2c')](respondWithResult(_0x5f4f3f,null))[_0xbd02('0x4b')](handleError(_0x5f4f3f,null));};exports['create']=function(_0x23e647,_0x414e06){return db[_0xbd02('0x35')]['create'](_0x23e647[_0xbd02('0x51')],{})[_0xbd02('0x2c')](respondWithResult(_0x414e06,0xc9))[_0xbd02('0x4b')](handleError(_0x414e06,null));};exports[_0xbd02('0x2b')]=function(_0xcbe56d,_0x5d9b63){if(_0xcbe56d[_0xbd02('0x51')]['id']){delete _0xcbe56d[_0xbd02('0x51')]['id'];}return db[_0xbd02('0x35')]['find']({'where':{'id':_0xcbe56d[_0xbd02('0x4d')]['id']}})[_0xbd02('0x2c')](handleEntityNotFound(_0x5d9b63,null))['then'](saveUpdates(_0xcbe56d['body'],null))[_0xbd02('0x2c')](respondWithResult(_0x5d9b63,null))[_0xbd02('0x4b')](handleError(_0x5d9b63,null));};exports[_0xbd02('0x2d')]=function(_0x5aea94,_0x540699){return db[_0xbd02('0x35')][_0xbd02('0x52')]({'where':{'id':_0x5aea94['params']['id']}})[_0xbd02('0x2c')](handleEntityNotFound(_0x540699,null))[_0xbd02('0x2c')](removeEntity(_0x540699,null))[_0xbd02('0x4b')](handleError(_0x540699,null));};exports[_0xbd02('0x53')]=function(_0xfc1b85,_0x5e9084){return db['ChatInternalMessage']['describe']()[_0xbd02('0x2c')](respondWithResult(_0x5e9084,null))[_0xbd02('0x4b')](handleError(_0x5e9084,null));};function wrapUser(_0x25bedf){return function(_0x5f12f8){var _0x336770=_0x25bedf[_0xbd02('0x54')]({'plain':!![]});_0x336770[_0xbd02('0x55')]=[];if(_0x5f12f8){_0x336770[_0xbd02('0x56')]=_0x5f12f8[_0xbd02('0x57')];_0x336770['lastMessage']=_0x5f12f8;}else{_0x336770[_0xbd02('0x56')]=moment(0x0)[_0xbd02('0x58')](_0xbd02('0x59'));_0x336770['lastMessage']={};}return _0x336770;};}exports[_0xbd02('0x5a')]=function(_0x4beef9,_0x2e02d0,_0x2f5499){var _0x4ae483=[];return db['User'][_0xbd02('0x49')]({'where':{'role':['agent',_0xbd02('0x5b'),_0xbd02('0x5c')]},'attributes':['id',_0xbd02('0x5d'),_0xbd02('0x31'),'role',_0xbd02('0x5e'),_0xbd02('0x5f'),_0xbd02('0x60'),_0xbd02('0x61'),_0xbd02('0x62'),_0xbd02('0x63')],'order':qs['sort'](_0xbd02('0x64')),'include':[{'model':db[_0xbd02('0x65')],'as':_0xbd02('0x66'),'attributes':['id',_0xbd02('0x31'),_0xbd02('0x37')],'through':{'attributes':[]}}]})[_0xbd02('0x2c')](function(_0x5c6cda){if(_0x5c6cda){var _0x155378=_0x4beef9[_0xbd02('0x5c')][_0xbd02('0x54')]({'plain':!![]});if(!_0x155378)throw new Error(_0xbd02('0x67'));if(_0x155378['role']===_0xbd02('0x5c')){return db['UserProfileSection'][_0xbd02('0x52')]({'where':{'name':_0xbd02('0x68'),'userProfileId':_0x155378[_0xbd02('0x69')]},'raw':!![]})[_0xbd02('0x2c')](function(_0x5e5e92){if(_0x5e5e92){if(_0x5e5e92[_0xbd02('0x6a')]===0x0){return db['UserProfileResource'][_0xbd02('0x49')]({'where':{'sectionId':_0x5e5e92['id']},'raw':!![]})[_0xbd02('0x2c')](function(_0x2b5e85){var _0xf03341=[];if(_[_0xbd02('0x6b')](_0x2b5e85)){_0xf03341=_['filter'](_0x5c6cda,function(_0x44af87){if(_0x44af87[_0xbd02('0x6c')]!==_0xbd02('0x6d')){return _0x44af87;}});return _0xf03341;}else{for(var _0x20d0dc=0x0;_0x20d0dc<_0x5c6cda[_0xbd02('0x50')];_0x20d0dc++){var _0x18a0e1=_0x5c6cda[_0x20d0dc];if(_0x18a0e1[_0xbd02('0x6c')]===_0xbd02('0x6d')){var _0x4ed82c=_['find'](_0x2b5e85,function(_0x65b69d){return _0x65b69d['resourceId']===_0x18a0e1['id'];});if(_0x4ed82c)_0xf03341[_0xbd02('0x6e')](_0x18a0e1);}else{_0xf03341[_0xbd02('0x6e')](_0x18a0e1);}}return _0xf03341;}});}else{return _0x5c6cda;}}else{var _0x3390f0=_[_0xbd02('0x43')](_0x5c6cda,function(_0x35060f){if(_0x35060f[_0xbd02('0x6c')]!==_0xbd02('0x6d')){return _0x35060f;}});return _0x3390f0;}});}else{return _0x5c6cda;}}})[_0xbd02('0x2c')](function(_0x401966){var _0x3f9ead=[];if(_0x401966){_0x4ae483=_0x401966;for(var _0x45c7d1=0x0;_0x45c7d1<_0x401966['length'];_0x45c7d1+=0x1){_0x4ae483[_0x45c7d1][_0xbd02('0x55')]=[];_0x3f9ead[_0xbd02('0x6e')](db[_0xbd02('0x35')][_0xbd02('0x52')]({'where':{'FromId':[_0x4beef9[_0xbd02('0x5c')]['id'],_0x401966[_0x45c7d1]['id']],'ToId':[_0x4beef9[_0xbd02('0x5c')]['id'],_0x401966[_0x45c7d1]['id']],'ChatGroupId':null},'attributes':['id',_0xbd02('0x57'),_0xbd02('0x6f'),_0xbd02('0x70'),_0xbd02('0x71'),_0xbd02('0x51')],'order':qs[_0xbd02('0x40')](_0xbd02('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbd02('0x2c')](wrapUser(_0x401966[_0x45c7d1])));}return BPromise['all'](_0x3f9ead);}return[];})[_0xbd02('0x2c')](function(_0x1d0947){return{'rows':_0x1d0947,'count':_0x1d0947['length']};})[_0xbd02('0x2c')](respondWithResult(_0x2e02d0,null))['catch'](handleError(_0x2e02d0,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9206086..122aa2d 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 _0x6370=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4fff8b,_0x413fd4){var _0x8fd07e=function(_0x367f03){while(--_0x367f03){_0x4fff8b['push'](_0x4fff8b['shift']());}};_0x8fd07e(++_0x413fd4);}(_0x6370,0x99));var _0x0637=function(_0x58c513,_0x15deec){_0x58c513=_0x58c513-0x0;var _0x4da4c4=_0x6370[_0x58c513];return _0x4da4c4;};'use strict';var EventEmitter=require(_0x0637('0x0'));var ChatInternalMessage=require(_0x0637('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0637('0x2')](0x0);var events={'afterCreate':_0x0637('0x3'),'afterUpdate':_0x0637('0x4'),'afterDestroy':'remove'};function emitEvent(_0x11b4ea){return function(_0x1e54b7,_0x3c9c73,_0x1a0239){ChatInternalMessageEvents[_0x0637('0x5')](_0x11b4ea+':'+_0x1e54b7['id'],_0x1e54b7);ChatInternalMessageEvents[_0x0637('0x5')](_0x11b4ea,_0x1e54b7);_0x1a0239(null);};}for(var e in events){if(events[_0x0637('0x6')](e)){var event=events[e];ChatInternalMessage[_0x0637('0x7')](e,emitEvent(event));}}module[_0x0637('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8398=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x289f9a,_0x4edb48){var _0x4b6b1b=function(_0x4c028d){while(--_0x4c028d){_0x289f9a['push'](_0x289f9a['shift']());}};_0x4b6b1b(++_0x4edb48);}(_0x8398,0x170));var _0x8839=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x8398[_0x2aec52];return _0x3b8835;};'use strict';var EventEmitter=require(_0x8839('0x0'));var ChatInternalMessage=require(_0x8839('0x1'))['db'][_0x8839('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8839('0x3')](0x0);var events={'afterCreate':_0x8839('0x4'),'afterUpdate':'update','afterDestroy':_0x8839('0x5')};function emitEvent(_0x428eb5){return function(_0x390480,_0x3130c5,_0x471214){ChatInternalMessageEvents[_0x8839('0x6')](_0x428eb5+':'+_0x390480['id'],_0x390480);ChatInternalMessageEvents[_0x8839('0x6')](_0x428eb5,_0x390480);_0x471214(null);};}for(var e in events){if(events[_0x8839('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x8839('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 94e90be..e800d4a 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 _0xa7ac=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2007e9,_0x29df16){var _0x435c09=function(_0x2cf569){while(--_0x2cf569){_0x2007e9['push'](_0x2007e9['shift']());}};_0x435c09(++_0x29df16);}(_0xa7ac,0xb6));var _0xca7a=function(_0x2cbfe5,_0x1fb99b){_0x2cbfe5=_0x2cbfe5-0x0;var _0x3f69ad=_0xa7ac[_0x2cbfe5];return _0x3f69ad;};'use strict';var _=require(_0xca7a('0x0'));var util=require(_0xca7a('0x1'));var logger=require(_0xca7a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca7a('0x3'));var fs=require('fs');var path=require(_0xca7a('0x4'));var rimraf=require(_0xca7a('0x5'));var config=require(_0xca7a('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0xca7a('0x7')]=function(_0x47dc7b,_0x4ca145){return _0x47dc7b[_0xca7a('0x8')](_0xca7a('0x9'),attributes,{'tableName':_0xca7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca7a('0xb'),'collate':_0xca7a('0xc')});}; \ No newline at end of file +var _0x3548=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','chat_internal_messages'];(function(_0x2f53a3,_0x39a6a9){var _0x35b206=function(_0x3152d7){while(--_0x3152d7){_0x2f53a3['push'](_0x2f53a3['shift']());}};_0x35b206(++_0x39a6a9);}(_0x3548,0x1a4));var _0x8354=function(_0x5d4dd7,_0x38229c){_0x5d4dd7=_0x5d4dd7-0x0;var _0x2ce0ad=_0x3548[_0x5d4dd7];return _0x2ce0ad;};'use strict';var _=require(_0x8354('0x0'));var util=require(_0x8354('0x1'));var logger=require(_0x8354('0x2'))(_0x8354('0x3'));var moment=require(_0x8354('0x4'));var BPromise=require(_0x8354('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8354('0x6'));var rimraf=require(_0x8354('0x7'));var config=require(_0x8354('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x8354('0x9')]=function(_0x1af13b,_0x2a5cb0){return _0x1af13b[_0x8354('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x8354('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 17deb3f..1f082c2 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 _0x1a6b=['register','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','localhost','./chatInternalMessage.socket'];(function(_0x126797,_0x586e0a){var _0xe2afa7=function(_0x1e4a21){while(--_0x1e4a21){_0x126797['push'](_0x126797['shift']());}};_0xe2afa7(++_0x586e0a);}(_0x1a6b,0x94));var _0xb1a6=function(_0x1d15a9,_0x223eab){_0x1d15a9=_0x1d15a9-0x0;var _0x53ae6d=_0x1a6b[_0x1d15a9];return _0x53ae6d;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var moment=require(_0xb1a6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1a6('0x3'));var fs=require('fs');var Redis=require(_0xb1a6('0x4'));var db=require(_0xb1a6('0x5'))['db'];var utils=require(_0xb1a6('0x6'));var logger=require('../../config/logger')(_0xb1a6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1a6('0x8'));var client=jayson[_0xb1a6('0x9')]['http']({'port':0x232a});config[_0xb1a6('0xa')]=_['defaults'](config[_0xb1a6('0xa')],{'host':_0xb1a6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1a6('0xa')]));require(_0xb1a6('0xc'))[_0xb1a6('0xd')](socket);function respondWithRpcPromise(_0x2dc37d,_0x4e585e,_0x41cde3){return new BPromise(function(_0x211cdd,_0x19fd96){return client['request'](_0x2dc37d,_0x41cde3)['then'](function(_0x4bffda){logger['info'](_0xb1a6('0xe'),_0x4e585e,_0xb1a6('0xf'));logger['debug'](_0xb1a6('0x10'),_0x4e585e,'request\x20sent',JSON['stringify'](_0x4bffda));if(_0x4bffda[_0xb1a6('0x11')]){if(_0x4bffda['error'][_0xb1a6('0x12')]===0x1f4){logger['error'](_0xb1a6('0xe'),_0x4e585e,_0x4bffda[_0xb1a6('0x11')][_0xb1a6('0x13')]);return _0x19fd96(_0x4bffda['error'][_0xb1a6('0x13')]);}logger['error'](_0xb1a6('0xe'),_0x4e585e,_0x4bffda['error'][_0xb1a6('0x13')]);return _0x211cdd(_0x4bffda['error'][_0xb1a6('0x13')]);}else{logger[_0xb1a6('0x14')](_0xb1a6('0xe'),_0x4e585e,_0xb1a6('0xf'));_0x211cdd(_0x4bffda[_0xb1a6('0x15')][_0xb1a6('0x13')]);}})[_0xb1a6('0x16')](function(_0x5e42ca){logger[_0xb1a6('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4e585e,_0x5e42ca);_0x19fd96(_0x5e42ca);});});} \ No newline at end of file +var _0xa234=['then','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatInternalMessage.socket','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa234,0x15c));var _0x4a23=function(_0x41a1ff,_0x3f87ac){_0x41a1ff=_0x41a1ff-0x0;var _0x10ec66=_0xa234[_0x41a1ff];return _0x10ec66;};'use strict';var _=require(_0x4a23('0x0'));var util=require(_0x4a23('0x1'));var moment=require(_0x4a23('0x2'));var BPromise=require(_0x4a23('0x3'));var rs=require(_0x4a23('0x4'));var fs=require('fs');var Redis=require(_0x4a23('0x5'));var db=require(_0x4a23('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4a23('0x7'));var jayson=require(_0x4a23('0x8'));var client=jayson[_0x4a23('0x9')][_0x4a23('0xa')]({'port':0x232a});config['redis']=_[_0x4a23('0xb')](config[_0x4a23('0xc')],{'host':_0x4a23('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a23('0xc')]));require(_0x4a23('0xe'))[_0x4a23('0xf')](socket);function respondWithRpcPromise(_0x36991c,_0x294ef8,_0x44804f){return new BPromise(function(_0x506cdc,_0x329df2){return client['request'](_0x36991c,_0x44804f)[_0x4a23('0x10')](function(_0x24e7a8){logger['info'](_0x4a23('0x11'),_0x294ef8,'request\x20sent');logger['debug'](_0x4a23('0x12'),_0x294ef8,_0x4a23('0x13'),JSON[_0x4a23('0x14')](_0x24e7a8));if(_0x24e7a8[_0x4a23('0x15')]){if(_0x24e7a8[_0x4a23('0x15')][_0x4a23('0x16')]===0x1f4){logger['error'](_0x4a23('0x11'),_0x294ef8,_0x24e7a8[_0x4a23('0x15')]['message']);return _0x329df2(_0x24e7a8[_0x4a23('0x15')][_0x4a23('0x17')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x294ef8,_0x24e7a8['error'][_0x4a23('0x17')]);return _0x506cdc(_0x24e7a8[_0x4a23('0x15')][_0x4a23('0x17')]);}else{logger[_0x4a23('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x294ef8,_0x4a23('0x13'));_0x506cdc(_0x24e7a8[_0x4a23('0x19')][_0x4a23('0x17')]);}})['catch'](function(_0x528c32){logger['error'](_0x4a23('0x11'),_0x294ef8,_0x528c32);_0x329df2(_0x528c32);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index dbfdb48..47afe19 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 _0xc0f5=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','register'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0xc0f5,0x11a));var _0x5c0f=function(_0x508c7e,_0x9ac41e){_0x508c7e=_0x508c7e-0x0;var _0x4476e3=_0xc0f5[_0x508c7e];return _0x4476e3;};'use strict';var ChatInternalMessageEvents=require(_0x5c0f('0x0'));var events=[_0x5c0f('0x1'),_0x5c0f('0x2'),_0x5c0f('0x3')];function createListener(_0x3e6abb,_0x3d0c9f){return function(_0x12c8a3){_0x3d0c9f[_0x5c0f('0x4')](_0x3e6abb,_0x12c8a3);};}function removeListener(_0x1048d9,_0x105281){return function(){ChatInternalMessageEvents['removeListener'](_0x1048d9,_0x105281);};}exports[_0x5c0f('0x5')]=function(_0x34c0e9){for(var _0xd437c6=0x0,_0x116db2=events[_0x5c0f('0x6')];_0xd437c6<_0x116db2;_0xd437c6++){var _0x44a9d3=events[_0xd437c6];var _0x2e96c3=createListener(_0x5c0f('0x7')+_0x44a9d3,_0x34c0e9);ChatInternalMessageEvents['on'](_0x44a9d3,_0x2e96c3);}}; \ No newline at end of file +var _0xf82a=['removeListener','register','length','save','update','emit'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0xf82a,0xcf));var _0xaf82=function(_0x33fe61,_0x348d4f){_0x33fe61=_0x33fe61-0x0;var _0x2d079d=_0xf82a[_0x33fe61];return _0x2d079d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xaf82('0x0'),'remove',_0xaf82('0x1')];function createListener(_0x1eb1a6,_0x4beffc){return function(_0x296d17){_0x4beffc[_0xaf82('0x2')](_0x1eb1a6,_0x296d17);};}function removeListener(_0x12f630,_0x395627){return function(){ChatInternalMessageEvents[_0xaf82('0x3')](_0x12f630,_0x395627);};}exports[_0xaf82('0x4')]=function(_0x22867a){for(var _0x651920=0x0,_0x5b40d6=events[_0xaf82('0x5')];_0x651920<_0x5b40d6;_0x651920++){var _0x510ac3=events[_0x651920];var _0x5b6537=createListener('chatInternalMessage:'+_0x510ac3,_0x22867a);ChatInternalMessageEvents['on'](_0x510ac3,_0x5b6537);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 22377de..e8dc2b4 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 _0x5c04=['connect-timeout','fs-extra','../../components/auth/service','get','/describe','isAuthenticated','/users','getUsers','show','create','/:id','update','exports','multer','util'];(function(_0x5b360e,_0x494136){var _0x1bf752=function(_0x6df32e){while(--_0x6df32e){_0x5b360e['push'](_0x5b360e['shift']());}};_0x1bf752(++_0x494136);}(_0x5c04,0x139));var _0x45c0=function(_0x43695d,_0x34bc11){_0x43695d=_0x43695d-0x0;var _0x2c004d=_0x5c04[_0x43695d];return _0x2c004d;};'use strict';var multer=require(_0x45c0('0x0'));var util=require(_0x45c0('0x1'));var path=require('path');var timeout=require(_0x45c0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x45c0('0x3'));var auth=require(_0x45c0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x45c0('0x5')](_0x45c0('0x6'),auth[_0x45c0('0x7')](),controller['describe']);router[_0x45c0('0x5')](_0x45c0('0x8'),auth[_0x45c0('0x7')](),controller[_0x45c0('0x9')]);router['get']('/:id',auth[_0x45c0('0x7')](),controller[_0x45c0('0xa')]);router['post']('/',auth[_0x45c0('0x7')](),controller[_0x45c0('0xb')]);router['put'](_0x45c0('0xc'),controller[_0x45c0('0xd')]);router['delete'](_0x45c0('0xc'),auth[_0x45c0('0x7')](),controller['destroy']);module[_0x45c0('0xe')]=router; \ No newline at end of file +var _0xdad3=['put','update','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create'];(function(_0x584f11,_0x144004){var _0x39ae4e=function(_0x92c653){while(--_0x92c653){_0x584f11['push'](_0x584f11['shift']());}};_0x39ae4e(++_0x144004);}(_0xdad3,0xdf));var _0x3dad=function(_0x2b5af0,_0x1863b7){_0x2b5af0=_0x2b5af0-0x0;var _0x3d05c8=_0xdad3[_0x2b5af0];return _0x3d05c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3dad('0x0'));var timeout=require(_0x3dad('0x1'));var express=require(_0x3dad('0x2'));var router=express['Router']();var fs_extra=require(_0x3dad('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3dad('0x4'));var config=require(_0x3dad('0x5'));var controller=require(_0x3dad('0x6'));router[_0x3dad('0x7')]('/',auth[_0x3dad('0x8')](),controller['index']);router[_0x3dad('0x7')](_0x3dad('0x9'),auth['isAuthenticated'](),controller[_0x3dad('0xa')]);router[_0x3dad('0x7')](_0x3dad('0xb'),auth[_0x3dad('0x8')](),controller[_0x3dad('0xc')]);router[_0x3dad('0x7')](_0x3dad('0xd'),auth[_0x3dad('0x8')](),controller[_0x3dad('0xe')]);router[_0x3dad('0xf')]('/',auth[_0x3dad('0x8')](),controller[_0x3dad('0x10')]);router[_0x3dad('0x11')](_0x3dad('0xd'),controller[_0x3dad('0x12')]);router['delete'](_0x3dad('0xd'),auth[_0x3dad('0x8')](),controller['destroy']);module[_0x3dad('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ab2ea94..6749fdd 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 _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x117c,0x71));var _0xc117=function(_0xb72cc8,_0x3b7aa3){_0xb72cc8=_0xb72cc8-0x0;var _0x75cfb3=_0x117c[_0xb72cc8];return _0x75cfb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file +var _0x8eba=['exports','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x4d0ff3,_0x3ed516){var _0x1dea50=function(_0x4c6e49){while(--_0x4c6e49){_0x4d0ff3['push'](_0x4d0ff3['shift']());}};_0x1dea50(++_0x3ed516);}(_0x8eba,0xc3));var _0xa8eb=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8eba[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8eb('0x3')]('in',_0xa8eb('0x4')),'defaultValue':_0xa8eb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8eb('0x5')]},'providerResponse':{'type':Sequelize[_0xa8eb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e8b5d11..766d721 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 _0xfdb4=['include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','destroy','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','chat-interactions','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','parse','formData','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatMessage,\x20%s,\x20%s','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ChatMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xfdb4,0x14f));var _0x4fdb=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xfdb4[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require(_0x4fdb('0x0'));var rimraf=require(_0x4fdb('0x1'));var zipdir=require(_0x4fdb('0x2'));var jsonpatch=require(_0x4fdb('0x3'));var rp=require('request-promise');var moment=require(_0x4fdb('0x4'));var BPromise=require(_0x4fdb('0x5'));var Mustache=require(_0x4fdb('0x6'));var util=require('util');var path=require(_0x4fdb('0x7'));var sox=require(_0x4fdb('0x8'));var csv=require('to-csv');var ejs=require(_0x4fdb('0x9'));var fs=require('fs');var fs_extra=require(_0x4fdb('0xa'));var _=require(_0x4fdb('0xb'));var squel=require(_0x4fdb('0xc'));var crypto=require(_0x4fdb('0xd'));var jsforce=require(_0x4fdb('0xe'));var deskjs=require(_0x4fdb('0xf'));var toCsv=require(_0x4fdb('0x10'));var querystring=require(_0x4fdb('0x11'));var Papa=require(_0x4fdb('0x12'));var Redis=require(_0x4fdb('0x13'));var authService=require(_0x4fdb('0x14'));var qs=require(_0x4fdb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fdb('0x16'));var logger=require(_0x4fdb('0x17'))('api');var utils=require(_0x4fdb('0x18'));var config=require(_0x4fdb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fdb('0x1a'))['db'];config[_0x4fdb('0x1b')]=_[_0x4fdb('0x1c')](config[_0x4fdb('0x1b')],{'host':_0x4fdb('0x1d'),'port':0x18eb});var socket=require(_0x4fdb('0x1e'))(new Redis(config[_0x4fdb('0x1b')]));require(_0x4fdb('0x1f'))[_0x4fdb('0x20')](socket);var jayson=require(_0x4fdb('0x21'));var client=jayson[_0x4fdb('0x22')][_0x4fdb('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x4fdb('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3094da,_0x3df724,_0x2c35cb,_0x879d8d){return new BPromise(function(_0x5061d9,_0x22a95f){var _0x576991=_0x879d8d||client;return _0x576991[_0x4fdb('0x24')](_0x3094da,_0x2c35cb)[_0x4fdb('0x25')](function(_0x1fcd0c){logger[_0x4fdb('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3df724,_0x4fdb('0x27'));logger[_0x4fdb('0x28')](_0x4fdb('0x29'),_0x3df724,_0x4fdb('0x27'),JSON[_0x4fdb('0x2a')](_0x1fcd0c));if(_0x1fcd0c[_0x4fdb('0x2b')]){if(_0x1fcd0c[_0x4fdb('0x2b')]['code']===0x1f4){logger[_0x4fdb('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x3df724,_0x1fcd0c['error'][_0x4fdb('0x2c')]);return _0x22a95f(_0x1fcd0c['error']['message']);}logger[_0x4fdb('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x3df724,_0x1fcd0c[_0x4fdb('0x2b')]['message']);return _0x5061d9(_0x1fcd0c[_0x4fdb('0x2b')][_0x4fdb('0x2c')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3df724,_0x4fdb('0x27'));_0x5061d9(_0x1fcd0c['result'][_0x4fdb('0x2c')]);}})['catch'](function(_0xaf8252){logger[_0x4fdb('0x2b')](_0x4fdb('0x2d'),_0x3df724,_0xaf8252);_0x22a95f(_0xaf8252);});});}function respondWithStatusCode(_0x129201,_0x344a17){_0x344a17=_0x344a17||0xcc;return function(_0x37f881){if(_0x37f881){return _0x129201[_0x4fdb('0x2e')](_0x344a17);}return _0x129201['status'](_0x344a17)[_0x4fdb('0x2f')]();};}function respondWithResult(_0x1f00b8,_0x1dac64){_0x1dac64=_0x1dac64||0xc8;return function(_0x1f31dc){if(_0x1f31dc){return _0x1f00b8['status'](_0x1dac64)[_0x4fdb('0x30')](_0x1f31dc);}};}function respondWithFilteredResult(_0x1943d2,_0x4f106e){return function(_0x471ed2){if(_0x471ed2){var _0x50a285=typeof _0x4f106e[_0x4fdb('0x31')]===_0x4fdb('0x32')&&typeof _0x4f106e['limit']==='undefined';var _0x44fc09=_0x471ed2[_0x4fdb('0x33')];var _0x43f0b6=_0x50a285?0x0:_0x4f106e['offset'];var _0xf192e9=_0x50a285?_0x471ed2[_0x4fdb('0x33')]:_0x4f106e[_0x4fdb('0x31')]+_0x4f106e[_0x4fdb('0x34')];var _0xc035e4;if(_0xf192e9>=_0x44fc09){_0xf192e9=_0x44fc09;_0xc035e4=0xc8;}else{_0xc035e4=0xce;}_0x1943d2[_0x4fdb('0x35')](_0xc035e4);return _0x1943d2[_0x4fdb('0x36')](_0x4fdb('0x37'),_0x43f0b6+'-'+_0xf192e9+'/'+_0x44fc09)[_0x4fdb('0x30')](_0x471ed2);}return null;};}function patchUpdates(_0x4becd7){return function(_0x5d4ba4){try{jsonpatch[_0x4fdb('0x38')](_0x5d4ba4,_0x4becd7,!![]);}catch(_0x557408){return BPromise[_0x4fdb('0x39')](_0x557408);}return _0x5d4ba4[_0x4fdb('0x3a')]();};}function saveUpdates(_0x47f9a1,_0x6095a2){return function(_0x3940e2){if(_0x3940e2){return _0x3940e2[_0x4fdb('0x3b')](_0x47f9a1)[_0x4fdb('0x25')](function(_0x1852ba){return _0x1852ba;});}return null;};}function removeEntity(_0x550924,_0x351da2){return function(_0x187478){if(_0x187478){return _0x187478['destroy']()[_0x4fdb('0x25')](function(){_0x550924[_0x4fdb('0x35')](0xcc)[_0x4fdb('0x2f')]();});}};}function handleEntityNotFound(_0x347846,_0x16d5b0){return function(_0xc59042){if(!_0xc59042){_0x347846[_0x4fdb('0x2e')](0x194);}return _0xc59042;};}function handleError(_0x1d1aee,_0x8d1dd8){_0x8d1dd8=_0x8d1dd8||0x1f4;return function(_0x606e7a){logger[_0x4fdb('0x2b')](_0x606e7a[_0x4fdb('0x3c')]);if(_0x606e7a[_0x4fdb('0x3d')]){delete _0x606e7a['name'];}_0x1d1aee['status'](_0x8d1dd8)[_0x4fdb('0x3e')](_0x606e7a);};}exports[_0x4fdb('0x3f')]=function(_0x45a13d,_0x1db2e9){var _0x392a9c={},_0x117632={},_0x405567={'count':0x0,'rows':[]};var _0x3695dc=_[_0x4fdb('0x40')](db[_0x4fdb('0x41')][_0x4fdb('0x42')],function(_0x46e610){return{'name':_0x46e610['fieldName'],'type':_0x46e610[_0x4fdb('0x43')]['key']};});_0x117632[_0x4fdb('0x44')]=_[_0x4fdb('0x40')](_0x3695dc,_0x4fdb('0x3d'));_0x117632['query']=_['keys'](_0x45a13d[_0x4fdb('0x45')]);_0x117632[_0x4fdb('0x46')]=_[_0x4fdb('0x47')](_0x117632[_0x4fdb('0x44')],_0x117632[_0x4fdb('0x45')]);_0x392a9c[_0x4fdb('0x48')]=_['intersection'](_0x117632[_0x4fdb('0x44')],qs[_0x4fdb('0x49')](_0x45a13d['query'][_0x4fdb('0x49')]));_0x392a9c[_0x4fdb('0x48')]=_0x392a9c[_0x4fdb('0x48')][_0x4fdb('0x4a')]?_0x392a9c[_0x4fdb('0x48')]:_0x117632[_0x4fdb('0x44')];if(!_0x45a13d[_0x4fdb('0x45')][_0x4fdb('0x4b')](_0x4fdb('0x4c'))){_0x392a9c[_0x4fdb('0x34')]=qs[_0x4fdb('0x34')](_0x45a13d[_0x4fdb('0x45')][_0x4fdb('0x34')]);_0x392a9c[_0x4fdb('0x31')]=qs[_0x4fdb('0x31')](_0x45a13d[_0x4fdb('0x45')][_0x4fdb('0x31')]);}_0x392a9c[_0x4fdb('0x4d')]=qs[_0x4fdb('0x4e')](_0x45a13d['query'][_0x4fdb('0x4e')]);_0x392a9c[_0x4fdb('0x4f')]=qs[_0x4fdb('0x46')](_[_0x4fdb('0x50')](_0x45a13d[_0x4fdb('0x45')],_0x117632[_0x4fdb('0x46')]),_0x3695dc);if(_0x45a13d[_0x4fdb('0x45')][_0x4fdb('0x51')]){_0x392a9c[_0x4fdb('0x4f')]=_[_0x4fdb('0x52')](_0x392a9c[_0x4fdb('0x4f')],{'$or':_[_0x4fdb('0x40')](_0x3695dc,function(_0x2e4731){if(_0x2e4731['type']!==_0x4fdb('0x53')){var _0x4630f9={};_0x4630f9[_0x2e4731['name']]={'$like':'%'+_0x45a13d[_0x4fdb('0x45')][_0x4fdb('0x51')]+'%'};return _0x4630f9;}})});}_0x392a9c=_[_0x4fdb('0x52')]({},_0x392a9c,_0x45a13d[_0x4fdb('0x54')]);var _0x5cc9ad={'where':_0x392a9c[_0x4fdb('0x4f')]};return db['ChatMessage'][_0x4fdb('0x33')](_0x5cc9ad)[_0x4fdb('0x25')](function(_0xdae31a){_0x405567['count']=_0xdae31a;if(_0x45a13d[_0x4fdb('0x45')]['includeAll']){_0x392a9c[_0x4fdb('0x55')]=[{'all':!![]}];}return db[_0x4fdb('0x41')][_0x4fdb('0x56')](_0x392a9c);})[_0x4fdb('0x25')](function(_0x3f21eb){_0x405567[_0x4fdb('0x57')]=_0x3f21eb;return _0x405567;})['then'](respondWithFilteredResult(_0x1db2e9,_0x392a9c))['catch'](handleError(_0x1db2e9,null));};exports[_0x4fdb('0x58')]=function(_0x49cf3d,_0x2f0061){var _0xc3f155={'raw':!![],'where':{'id':_0x49cf3d[_0x4fdb('0x59')]['id']}},_0x1be582={};_0x1be582[_0x4fdb('0x44')]=_[_0x4fdb('0x5a')](db[_0x4fdb('0x41')][_0x4fdb('0x42')]);_0x1be582[_0x4fdb('0x45')]=_[_0x4fdb('0x5a')](_0x49cf3d[_0x4fdb('0x45')]);_0x1be582[_0x4fdb('0x46')]=_[_0x4fdb('0x47')](_0x1be582[_0x4fdb('0x44')],_0x1be582[_0x4fdb('0x45')]);_0xc3f155['attributes']=_[_0x4fdb('0x47')](_0x1be582['model'],qs[_0x4fdb('0x49')](_0x49cf3d[_0x4fdb('0x45')][_0x4fdb('0x49')]));_0xc3f155[_0x4fdb('0x48')]=_0xc3f155['attributes']['length']?_0xc3f155[_0x4fdb('0x48')]:_0x1be582[_0x4fdb('0x44')];if(_0x49cf3d[_0x4fdb('0x45')][_0x4fdb('0x5b')]){_0xc3f155['include']=[{'all':!![]}];}_0xc3f155=_[_0x4fdb('0x52')]({},_0xc3f155,_0x49cf3d[_0x4fdb('0x54')]);return db[_0x4fdb('0x41')]['find'](_0xc3f155)['then'](handleEntityNotFound(_0x2f0061,null))[_0x4fdb('0x25')](respondWithResult(_0x2f0061,null))[_0x4fdb('0x5c')](handleError(_0x2f0061,null));};exports[_0x4fdb('0x5d')]=function(_0x5b783f,_0x21088e){return db[_0x4fdb('0x41')][_0x4fdb('0x5d')](_0x5b783f[_0x4fdb('0x5e')],{})[_0x4fdb('0x25')](respondWithResult(_0x21088e,0xc9))['catch'](handleError(_0x21088e,null));};exports[_0x4fdb('0x3b')]=function(_0x5ee5cc,_0x1d0dce){if(_0x5ee5cc[_0x4fdb('0x5e')]['id']){delete _0x5ee5cc[_0x4fdb('0x5e')]['id'];}return db[_0x4fdb('0x41')][_0x4fdb('0x5f')]({'where':{'id':_0x5ee5cc['params']['id']}})[_0x4fdb('0x25')](handleEntityNotFound(_0x1d0dce,null))[_0x4fdb('0x25')](saveUpdates(_0x5ee5cc[_0x4fdb('0x5e')],null))[_0x4fdb('0x25')](respondWithResult(_0x1d0dce,null))['catch'](handleError(_0x1d0dce,null));};exports[_0x4fdb('0x60')]=function(_0x4b8a31,_0x51ab16){return db[_0x4fdb('0x41')][_0x4fdb('0x5f')]({'where':{'id':_0x4b8a31['params']['id']}})[_0x4fdb('0x25')](handleEntityNotFound(_0x51ab16,null))['then'](removeEntity(_0x51ab16,null))[_0x4fdb('0x5c')](handleError(_0x51ab16,null));};exports[_0x4fdb('0x61')]=function(_0xf5e66,_0x1d21ba){return db[_0x4fdb('0x41')][_0x4fdb('0x61')]()[_0x4fdb('0x25')](respondWithResult(_0x1d21ba,null))[_0x4fdb('0x5c')](handleError(_0x1d21ba,null));};var interaction_log=require(_0x4fdb('0x17'))('chat-interactions');exports[_0x4fdb('0x62')]=function(_0x2b95cf,_0xa89b8c,_0x11be65){var _0x5bb2e6={'agent':{},'channel':'chat'};if(_0x2b95cf[_0x4fdb('0x5e')]['id']){delete _0x2b95cf[_0x4fdb('0x5e')]['id'];}_0x2b95cf[_0x4fdb('0x5e')][_0x4fdb('0x63')]=!![];_0x2b95cf[_0x4fdb('0x5e')][_0x4fdb('0x64')]=moment()[_0x4fdb('0x65')](_0x4fdb('0x66'));_0x2b95cf['body'][_0x4fdb('0x67')]=_0x2b95cf[_0x4fdb('0x5e')]['UserId']||_0x2b95cf[_0x4fdb('0x68')]['id'];_0x5bb2e6[_0x4fdb('0x69')]['id']=_0x2b95cf[_0x4fdb('0x5e')][_0x4fdb('0x67')];return db[_0x4fdb('0x41')][_0x4fdb('0x5f')]({'where':{'id':_0x2b95cf[_0x4fdb('0x59')]['id'],'UserId':null}})[_0x4fdb('0x25')](handleEntityNotFound(_0xa89b8c,null))['then'](saveUpdates(_0x2b95cf['body'],null))[_0x4fdb('0x25')](function(_0x352923){if(_0x352923){_0x5bb2e6['message']=_0x352923[_0x4fdb('0x6a')]({'plain':!![]});return db[_0x4fdb('0x6b')]['find']({'where':{'id':_0x352923[_0x4fdb('0x6c')]}});}return null;})[_0x4fdb('0x25')](handleEntityNotFound(_0xa89b8c,null))[_0x4fdb('0x25')](function(_0x65be3){if(_0x65be3){return _0x65be3[_0x4fdb('0x3b')]({'UserId':_0x2b95cf[_0x4fdb('0x5e')][_0x4fdb('0x67')],'read1stAt':_[_0x4fdb('0x6d')](_0x65be3[_0x4fdb('0x6e')])?moment()[_0x4fdb('0x65')](_0x4fdb('0x66')):undefined});}return null;})[_0x4fdb('0x25')](function(_0x46f2f2){if(_0x46f2f2){_0x5bb2e6[_0x4fdb('0x6f')]=_0x46f2f2['get']({'plain':!![]});interaction_log[_0x4fdb('0x26')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b95cf['user']['id'],_0x2b95cf['user'][_0x4fdb('0x3d')],_0x2b95cf[_0x4fdb('0x68')]['role'],_0x5bb2e6[_0x4fdb('0x6f')]['id'],_0x2b95cf[_0x4fdb('0x5e')]?JSON[_0x4fdb('0x2a')](_0x2b95cf['body']):'null');return respondWithRpcPromise(_0x4fdb('0x70'),_0x4fdb('0x71'),_0x5bb2e6);}return null;})['then'](function(_0x4b6c2c){var _0x52506c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b6c2c[_0x4fdb('0x2c')][_0x4fdb('0x72')];return db[_0x4fdb('0x73')][_0x4fdb('0x45')](_0x52506c,{'type':db[_0x4fdb('0x74')][_0x4fdb('0x75')][_0x4fdb('0x76')],'raw':!![]})[_0x4fdb('0x25')](function(_0x510a9b){return _0x510a9b;});})[_0x4fdb('0x25')](function(_0x7ed6e4){if(_0x7ed6e4){_0x5bb2e6['message'][_0x4fdb('0x77')]=_0x7ed6e4[0x0];if(!_0x2b95cf['body'][_0x4fdb('0x67')])return;return db[_0x4fdb('0x78')]['find']({'where':{'id':_0x2b95cf['body'][_0x4fdb('0x67')],'role':_0x4fdb('0x69')},'attributes':['id',_0x4fdb('0x3d'),_0x4fdb('0x79'),_0x4fdb('0x7a'),_0x4fdb('0x7b')],'raw':!![]});}return null;})[_0x4fdb('0x25')](function(_0x547fa){if(!_0x547fa)return null;_0x5bb2e6[_0x4fdb('0x2c')][_0x4fdb('0x69')]=_0x547fa;return _0x5bb2e6;})[_0x4fdb('0x25')](function(_0x3b83c6){if(_0x3b83c6){if(_0x2b95cf[_0x4fdb('0x5e')][_0x4fdb('0x7c')]){_0x5bb2e6[_0x4fdb('0x2c')][_0x4fdb('0x7d')]=util[_0x4fdb('0x65')](_0x4fdb('0x7e'),_0x2b95cf[_0x4fdb('0x68')][_0x4fdb('0x3d')]);_0x5bb2e6[_0x4fdb('0x2c')][_0x4fdb('0x7f')]=_0x5bb2e6['channel'];_0x5bb2e6[_0x4fdb('0x2c')][_0x4fdb('0x80')]=_0x5bb2e6[_0x4fdb('0x7f')];_0x5bb2e6[_0x4fdb('0x2c')]['event']=_0x4fdb('0x62');return respondWithRpcPromise(_0x4fdb('0x81'),_0x4fdb('0x81'),{'event':_0x4fdb('0x82'),'message':_[_0x4fdb('0x52')](_0x5bb2e6['message'],JSON['parse'](_0x5bb2e6[_0x4fdb('0x6f')]['formData']))},client9002)[_0x4fdb('0x25')](function(){return _0x5bb2e6;});}return _0x5bb2e6;}return null;})[_0x4fdb('0x25')](respondWithResult(_0xa89b8c,null))[_0x4fdb('0x5c')](handleError(_0xa89b8c,null));};var interaction_log=require(_0x4fdb('0x17'))(_0x4fdb('0x83'));exports[_0x4fdb('0x39')]=function(_0x14884b,_0x1ebaf0,_0x2935a7){var _0x50a62a={'agent':{},'channel':'chat'};if(_0x14884b[_0x4fdb('0x5e')]['id']){delete _0x14884b[_0x4fdb('0x5e')]['id'];}_0x14884b[_0x4fdb('0x5e')]['UserId']=_0x14884b[_0x4fdb('0x5e')][_0x4fdb('0x67')]||_0x14884b['user']['id'];_0x50a62a[_0x4fdb('0x69')]['id']=_0x14884b[_0x4fdb('0x5e')][_0x4fdb('0x67')];return db['ChatMessage'][_0x4fdb('0x5f')]({'where':{'id':_0x14884b[_0x4fdb('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ebaf0,null))[_0x4fdb('0x25')](function(_0x576afe){if(_0x576afe){_0x50a62a['message']=_0x576afe[_0x4fdb('0x6a')]({'plain':!![]});return db[_0x4fdb('0x6b')][_0x4fdb('0x5f')]({'where':{'id':_0x576afe[_0x4fdb('0x6c')]}});}return null;})[_0x4fdb('0x25')](handleEntityNotFound(_0x1ebaf0,null))['then'](function(_0x5e021d){if(_0x5e021d){_0x50a62a[_0x4fdb('0x6f')]=_0x5e021d[_0x4fdb('0x6a')]({'plain':!![]});interaction_log[_0x4fdb('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14884b[_0x4fdb('0x68')]['id'],_0x14884b[_0x4fdb('0x68')][_0x4fdb('0x3d')],_0x14884b[_0x4fdb('0x68')][_0x4fdb('0x84')],_0x50a62a['interaction']['id'],_0x14884b[_0x4fdb('0x5e')]?JSON['stringify'](_0x14884b[_0x4fdb('0x5e')]):_0x4fdb('0x85'));return respondWithRpcPromise('RejectMessage',_0x4fdb('0x86'),_0x50a62a);}return null;})[_0x4fdb('0x25')](function(_0x58856d){var _0x4e3946=_0x4fdb('0x87')+_0x58856d[_0x4fdb('0x2c')][_0x4fdb('0x72')];return db[_0x4fdb('0x73')]['query'](_0x4e3946,{'type':db[_0x4fdb('0x74')][_0x4fdb('0x75')][_0x4fdb('0x76')],'raw':!![]})[_0x4fdb('0x25')](function(_0x1f43d5){return _0x1f43d5;});})[_0x4fdb('0x25')](function(_0x53ece0){if(_0x53ece0){_0x50a62a['message'][_0x4fdb('0x77')]=_0x53ece0[0x0];if(!_0x14884b[_0x4fdb('0x5e')][_0x4fdb('0x67')])return;return db[_0x4fdb('0x78')][_0x4fdb('0x5f')]({'where':{'id':_0x14884b[_0x4fdb('0x5e')]['UserId'],'role':'agent'},'attributes':['id',_0x4fdb('0x3d'),_0x4fdb('0x79'),'email',_0x4fdb('0x7b')],'raw':!![]});}return null;})[_0x4fdb('0x25')](function(_0x458a59){if(!_0x458a59)return null;_0x50a62a[_0x4fdb('0x2c')]['agent']=_0x458a59;return _0x50a62a;})[_0x4fdb('0x25')](function(_0x38cf0d){if(_0x38cf0d){_0x38cf0d['message'][_0x4fdb('0x7d')]=util[_0x4fdb('0x65')](_0x4fdb('0x7e'),_0x14884b[_0x4fdb('0x68')][_0x4fdb('0x3d')]);_0x38cf0d['message'][_0x4fdb('0x7f')]=_0x50a62a[_0x4fdb('0x7f')];_0x38cf0d[_0x4fdb('0x2c')][_0x4fdb('0x80')]=_0x50a62a[_0x4fdb('0x7f')];_0x38cf0d['message'][_0x4fdb('0x88')]='reject';respondWithRpcPromise(_0x4fdb('0x81'),_0x4fdb('0x81'),{'event':_0x4fdb('0x89'),'message':_[_0x4fdb('0x52')](_0x50a62a[_0x4fdb('0x2c')],JSON[_0x4fdb('0x8a')](_0x50a62a['interaction'][_0x4fdb('0x8b')]))},client9002);return _0x50a62a;}return null;})[_0x4fdb('0x25')](respondWithResult(_0x1ebaf0,null))[_0x4fdb('0x5c')](handleError(_0x1ebaf0,null));}; \ No newline at end of file +var _0x5dd7=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','rejectmessage','merge','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','stack','index','map','ChatMessage','rawAttributes','fieldName','type','key','name','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','../../config/logger','chat-interactions','chat','read','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil'];(function(_0x23b454,_0x37cf29){var _0x662fa6=function(_0xe208d6){while(--_0xe208d6){_0x23b454['push'](_0x23b454['shift']());}};_0x662fa6(++_0x37cf29);}(_0x5dd7,0x134));var _0x75dd=function(_0x215346,_0x1ef5ae){_0x215346=_0x215346-0x0;var _0x7c5bc6=_0x5dd7[_0x215346];return _0x7c5bc6;};'use strict';var emlformat=require(_0x75dd('0x0'));var rimraf=require(_0x75dd('0x1'));var zipdir=require(_0x75dd('0x2'));var jsonpatch=require(_0x75dd('0x3'));var rp=require(_0x75dd('0x4'));var moment=require(_0x75dd('0x5'));var BPromise=require(_0x75dd('0x6'));var Mustache=require(_0x75dd('0x7'));var util=require(_0x75dd('0x8'));var path=require(_0x75dd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75dd('0xa'));var _=require(_0x75dd('0xb'));var squel=require('squel');var crypto=require(_0x75dd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75dd('0xd'));var querystring=require(_0x75dd('0xe'));var Papa=require('papaparse');var Redis=require(_0x75dd('0xf'));var authService=require(_0x75dd('0x10'));var qs=require(_0x75dd('0x11'));var as=require(_0x75dd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x75dd('0x13'));var config=require(_0x75dd('0x14'));var licenseUtil=require(_0x75dd('0x15'));var db=require('../../mysqldb')['db'];config[_0x75dd('0x16')]=_[_0x75dd('0x17')](config[_0x75dd('0x16')],{'host':_0x75dd('0x18'),'port':0x18eb});var socket=require(_0x75dd('0x19'))(new Redis(config[_0x75dd('0x16')]));require(_0x75dd('0x1a'))[_0x75dd('0x1b')](socket);var jayson=require(_0x75dd('0x1c'));var client=jayson[_0x75dd('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x75dd('0x1d')][_0x75dd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43b391,_0x1acef7,_0x22b4ef,_0x3be535){return new BPromise(function(_0x5487c1,_0x47d884){var _0x161ca3=_0x3be535||client;return _0x161ca3[_0x75dd('0x1f')](_0x43b391,_0x22b4ef)[_0x75dd('0x20')](function(_0x1da1ca){logger[_0x75dd('0x21')](_0x75dd('0x22'),_0x1acef7,_0x75dd('0x23'));logger[_0x75dd('0x24')](_0x75dd('0x25'),_0x1acef7,_0x75dd('0x23'),JSON[_0x75dd('0x26')](_0x1da1ca));if(_0x1da1ca[_0x75dd('0x27')]){if(_0x1da1ca[_0x75dd('0x27')][_0x75dd('0x28')]===0x1f4){logger[_0x75dd('0x27')](_0x75dd('0x22'),_0x1acef7,_0x1da1ca[_0x75dd('0x27')][_0x75dd('0x29')]);return _0x47d884(_0x1da1ca[_0x75dd('0x27')][_0x75dd('0x29')]);}logger[_0x75dd('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1acef7,_0x1da1ca['error'][_0x75dd('0x29')]);return _0x5487c1(_0x1da1ca['error']['message']);}else{logger[_0x75dd('0x21')](_0x75dd('0x22'),_0x1acef7,_0x75dd('0x23'));_0x5487c1(_0x1da1ca[_0x75dd('0x2a')][_0x75dd('0x29')]);}})[_0x75dd('0x2b')](function(_0x55c8d6){logger[_0x75dd('0x27')](_0x75dd('0x22'),_0x1acef7,_0x55c8d6);_0x47d884(_0x55c8d6);});});}function respondWithStatusCode(_0x488ac7,_0x254a61){_0x254a61=_0x254a61||0xcc;return function(_0x2d4ea6){if(_0x2d4ea6){return _0x488ac7[_0x75dd('0x2c')](_0x254a61);}return _0x488ac7[_0x75dd('0x2d')](_0x254a61)[_0x75dd('0x2e')]();};}function respondWithResult(_0x3f73c2,_0x13a469){_0x13a469=_0x13a469||0xc8;return function(_0x603189){if(_0x603189){return _0x3f73c2[_0x75dd('0x2d')](_0x13a469)[_0x75dd('0x2f')](_0x603189);}};}function respondWithFilteredResult(_0x27cf2b,_0x33a342){return function(_0x57a2a0){if(_0x57a2a0){var _0x25dbc8=typeof _0x33a342[_0x75dd('0x30')]===_0x75dd('0x31')&&typeof _0x33a342[_0x75dd('0x32')]===_0x75dd('0x31');var _0x3ca222=_0x57a2a0['count'];var _0x5803c6=_0x25dbc8?0x0:_0x33a342[_0x75dd('0x30')];var _0x4befb8=_0x25dbc8?_0x57a2a0[_0x75dd('0x33')]:_0x33a342['offset']+_0x33a342[_0x75dd('0x32')];var _0x59adbf;if(_0x4befb8>=_0x3ca222){_0x4befb8=_0x3ca222;_0x59adbf=0xc8;}else{_0x59adbf=0xce;}_0x27cf2b[_0x75dd('0x2d')](_0x59adbf);return _0x27cf2b['set'](_0x75dd('0x34'),_0x5803c6+'-'+_0x4befb8+'/'+_0x3ca222)[_0x75dd('0x2f')](_0x57a2a0);}return null;};}function patchUpdates(_0x2de975){return function(_0x59eb5){try{jsonpatch[_0x75dd('0x35')](_0x59eb5,_0x2de975,!![]);}catch(_0x118d5e){return BPromise[_0x75dd('0x36')](_0x118d5e);}return _0x59eb5[_0x75dd('0x37')]();};}function saveUpdates(_0x314e1d,_0x25bbeb){return function(_0x16961a){if(_0x16961a){return _0x16961a[_0x75dd('0x38')](_0x314e1d)[_0x75dd('0x20')](function(_0x32ea4d){return _0x32ea4d;});}return null;};}function removeEntity(_0x1ccd42,_0x16fb4b){return function(_0x4718cc){if(_0x4718cc){return _0x4718cc['destroy']()[_0x75dd('0x20')](function(){_0x1ccd42[_0x75dd('0x2d')](0xcc)[_0x75dd('0x2e')]();});}};}function handleEntityNotFound(_0xed8df2,_0x5119e1){return function(_0x31f494){if(!_0x31f494){_0xed8df2[_0x75dd('0x2c')](0x194);}return _0x31f494;};}function handleError(_0x1e31be,_0x3c6596){_0x3c6596=_0x3c6596||0x1f4;return function(_0x2fc1b8){logger[_0x75dd('0x27')](_0x2fc1b8[_0x75dd('0x39')]);if(_0x2fc1b8['name']){delete _0x2fc1b8['name'];}_0x1e31be['status'](_0x3c6596)['send'](_0x2fc1b8);};}exports[_0x75dd('0x3a')]=function(_0x1acfaa,_0x3e9443){var _0x97db22={},_0x37001f={},_0x31f232={'count':0x0,'rows':[]};var _0xc83e77=_[_0x75dd('0x3b')](db[_0x75dd('0x3c')][_0x75dd('0x3d')],function(_0x371d8b){return{'name':_0x371d8b[_0x75dd('0x3e')],'type':_0x371d8b[_0x75dd('0x3f')][_0x75dd('0x40')]};});_0x37001f['model']=_['map'](_0xc83e77,_0x75dd('0x41'));_0x37001f[_0x75dd('0x42')]=_[_0x75dd('0x43')](_0x1acfaa[_0x75dd('0x42')]);_0x37001f['filters']=_[_0x75dd('0x44')](_0x37001f['model'],_0x37001f[_0x75dd('0x42')]);_0x97db22[_0x75dd('0x45')]=_[_0x75dd('0x44')](_0x37001f['model'],qs[_0x75dd('0x46')](_0x1acfaa[_0x75dd('0x42')][_0x75dd('0x46')]));_0x97db22[_0x75dd('0x45')]=_0x97db22[_0x75dd('0x45')][_0x75dd('0x47')]?_0x97db22[_0x75dd('0x45')]:_0x37001f[_0x75dd('0x48')];if(!_0x1acfaa[_0x75dd('0x42')][_0x75dd('0x49')](_0x75dd('0x4a'))){_0x97db22[_0x75dd('0x32')]=qs[_0x75dd('0x32')](_0x1acfaa['query'][_0x75dd('0x32')]);_0x97db22[_0x75dd('0x30')]=qs[_0x75dd('0x30')](_0x1acfaa['query'][_0x75dd('0x30')]);}_0x97db22[_0x75dd('0x4b')]=qs['sort'](_0x1acfaa[_0x75dd('0x42')][_0x75dd('0x4c')]);_0x97db22[_0x75dd('0x4d')]=qs[_0x75dd('0x4e')](_[_0x75dd('0x4f')](_0x1acfaa[_0x75dd('0x42')],_0x37001f['filters']),_0xc83e77);if(_0x1acfaa[_0x75dd('0x42')]['filter']){_0x97db22['where']=_['merge'](_0x97db22['where'],{'$or':_[_0x75dd('0x3b')](_0xc83e77,function(_0x446a8b){if(_0x446a8b[_0x75dd('0x3f')]!==_0x75dd('0x50')){var _0x4c0101={};_0x4c0101[_0x446a8b[_0x75dd('0x41')]]={'$like':'%'+_0x1acfaa[_0x75dd('0x42')][_0x75dd('0x51')]+'%'};return _0x4c0101;}})});}_0x97db22=_['merge']({},_0x97db22,_0x1acfaa[_0x75dd('0x52')]);var _0x5d95b5={'where':_0x97db22[_0x75dd('0x4d')]};return db[_0x75dd('0x3c')]['count'](_0x5d95b5)['then'](function(_0x435d8b){_0x31f232['count']=_0x435d8b;if(_0x1acfaa['query'][_0x75dd('0x53')]){_0x97db22[_0x75dd('0x54')]=[{'all':!![]}];}return db['ChatMessage'][_0x75dd('0x55')](_0x97db22);})[_0x75dd('0x20')](function(_0x246b1e){_0x31f232[_0x75dd('0x56')]=_0x246b1e;return _0x31f232;})['then'](respondWithFilteredResult(_0x3e9443,_0x97db22))[_0x75dd('0x2b')](handleError(_0x3e9443,null));};exports[_0x75dd('0x57')]=function(_0x12df2f,_0x11f3c2){var _0x19729c={'raw':!![],'where':{'id':_0x12df2f[_0x75dd('0x58')]['id']}},_0x4f1404={};_0x4f1404[_0x75dd('0x48')]=_[_0x75dd('0x43')](db[_0x75dd('0x3c')][_0x75dd('0x3d')]);_0x4f1404[_0x75dd('0x42')]=_['keys'](_0x12df2f['query']);_0x4f1404[_0x75dd('0x4e')]=_[_0x75dd('0x44')](_0x4f1404[_0x75dd('0x48')],_0x4f1404[_0x75dd('0x42')]);_0x19729c['attributes']=_[_0x75dd('0x44')](_0x4f1404[_0x75dd('0x48')],qs['fields'](_0x12df2f[_0x75dd('0x42')][_0x75dd('0x46')]));_0x19729c[_0x75dd('0x45')]=_0x19729c[_0x75dd('0x45')]['length']?_0x19729c[_0x75dd('0x45')]:_0x4f1404[_0x75dd('0x48')];if(_0x12df2f[_0x75dd('0x42')][_0x75dd('0x53')]){_0x19729c[_0x75dd('0x54')]=[{'all':!![]}];}_0x19729c=_['merge']({},_0x19729c,_0x12df2f[_0x75dd('0x52')]);return db[_0x75dd('0x3c')][_0x75dd('0x59')](_0x19729c)[_0x75dd('0x20')](handleEntityNotFound(_0x11f3c2,null))[_0x75dd('0x20')](respondWithResult(_0x11f3c2,null))[_0x75dd('0x2b')](handleError(_0x11f3c2,null));};exports[_0x75dd('0x5a')]=function(_0x147122,_0x1b60db){return db['ChatMessage'][_0x75dd('0x5a')](_0x147122[_0x75dd('0x5b')],{})['then'](respondWithResult(_0x1b60db,0xc9))[_0x75dd('0x2b')](handleError(_0x1b60db,null));};exports[_0x75dd('0x38')]=function(_0x35ad23,_0x15e773){if(_0x35ad23[_0x75dd('0x5b')]['id']){delete _0x35ad23[_0x75dd('0x5b')]['id'];}return db[_0x75dd('0x3c')][_0x75dd('0x59')]({'where':{'id':_0x35ad23[_0x75dd('0x58')]['id']}})[_0x75dd('0x20')](handleEntityNotFound(_0x15e773,null))['then'](saveUpdates(_0x35ad23[_0x75dd('0x5b')],null))[_0x75dd('0x20')](respondWithResult(_0x15e773,null))[_0x75dd('0x2b')](handleError(_0x15e773,null));};exports[_0x75dd('0x5c')]=function(_0x4f680a,_0x105ef3){return db[_0x75dd('0x3c')][_0x75dd('0x59')]({'where':{'id':_0x4f680a[_0x75dd('0x58')]['id']}})[_0x75dd('0x20')](handleEntityNotFound(_0x105ef3,null))[_0x75dd('0x20')](removeEntity(_0x105ef3,null))[_0x75dd('0x2b')](handleError(_0x105ef3,null));};exports['describe']=function(_0x3422fa,_0x1133c9){return db[_0x75dd('0x3c')][_0x75dd('0x5d')]()['then'](respondWithResult(_0x1133c9,null))[_0x75dd('0x2b')](handleError(_0x1133c9,null));};var interaction_log=require(_0x75dd('0x5e'))(_0x75dd('0x5f'));exports['accept']=function(_0x3081f6,_0x14d467,_0x346bc7){var _0x115443={'agent':{},'channel':_0x75dd('0x60')};if(_0x3081f6[_0x75dd('0x5b')]['id']){delete _0x3081f6[_0x75dd('0x5b')]['id'];}_0x3081f6['body'][_0x75dd('0x61')]=!![];_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x63')]=_0x3081f6['body'][_0x75dd('0x63')]||_0x3081f6[_0x75dd('0x64')]['id'];_0x115443[_0x75dd('0x65')]['id']=_0x3081f6[_0x75dd('0x5b')]['UserId'];return db[_0x75dd('0x3c')]['find']({'where':{'id':_0x3081f6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14d467,null))['then'](saveUpdates(_0x3081f6['body'],null))['then'](function(_0x45c10a){if(_0x45c10a){_0x115443[_0x75dd('0x29')]=_0x45c10a[_0x75dd('0x66')]({'plain':!![]});return db[_0x75dd('0x67')]['find']({'where':{'id':_0x45c10a[_0x75dd('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x14d467,null))['then'](function(_0x4898cd){if(_0x4898cd){return _0x4898cd['update']({'UserId':_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x63')],'read1stAt':_[_0x75dd('0x69')](_0x4898cd['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x75dd('0x20')](function(_0x409f39){if(_0x409f39){_0x115443[_0x75dd('0x6a')]=_0x409f39['get']({'plain':!![]});interaction_log[_0x75dd('0x21')](_0x75dd('0x6b'),_0x3081f6['user']['id'],_0x3081f6[_0x75dd('0x64')][_0x75dd('0x41')],_0x3081f6[_0x75dd('0x64')][_0x75dd('0x6c')],_0x115443['interaction']['id'],_0x3081f6['body']?JSON[_0x75dd('0x26')](_0x3081f6['body']):_0x75dd('0x6d'));return respondWithRpcPromise(_0x75dd('0x6e'),_0x75dd('0x6f'),_0x115443);}return null;})[_0x75dd('0x20')](function(_0x19d9d8){var _0x3b4093=_0x75dd('0x70')+_0x19d9d8['message'][_0x75dd('0x71')];return db['sequelize'][_0x75dd('0x42')](_0x3b4093,{'type':db[_0x75dd('0x72')][_0x75dd('0x73')][_0x75dd('0x74')],'raw':!![]})[_0x75dd('0x20')](function(_0x5c16f6){return _0x5c16f6;});})[_0x75dd('0x20')](function(_0x185b59){if(_0x185b59){_0x115443['message']['contact']=_0x185b59[0x0];if(!_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x63')])return;return db[_0x75dd('0x75')]['find']({'where':{'id':_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x63')],'role':_0x75dd('0x65')},'attributes':['id',_0x75dd('0x41'),_0x75dd('0x76'),'email',_0x75dd('0x77')],'raw':!![]});}return null;})[_0x75dd('0x20')](function(_0x517a47){if(!_0x517a47)return null;_0x115443[_0x75dd('0x29')][_0x75dd('0x65')]=_0x517a47;return _0x115443;})['then'](function(_0x969dec){if(_0x969dec){if(_0x3081f6[_0x75dd('0x5b')][_0x75dd('0x78')]){_0x115443[_0x75dd('0x29')][_0x75dd('0x79')]=util[_0x75dd('0x7a')](_0x75dd('0x7b'),_0x3081f6[_0x75dd('0x64')]['name']);_0x115443[_0x75dd('0x29')][_0x75dd('0x7c')]=_0x115443['channel'];_0x115443[_0x75dd('0x29')][_0x75dd('0x7d')]=_0x115443[_0x75dd('0x7c')];_0x115443[_0x75dd('0x29')][_0x75dd('0x7e')]=_0x75dd('0x7f');return respondWithRpcPromise(_0x75dd('0x80'),_0x75dd('0x80'),{'event':_0x75dd('0x81'),'message':_['merge'](_0x115443[_0x75dd('0x29')],JSON[_0x75dd('0x82')](_0x115443[_0x75dd('0x6a')]['formData']))},client9002)[_0x75dd('0x20')](function(){return _0x115443;});}return _0x115443;}return null;})[_0x75dd('0x20')](respondWithResult(_0x14d467,null))[_0x75dd('0x2b')](handleError(_0x14d467,null));};var interaction_log=require('../../config/logger')(_0x75dd('0x5f'));exports[_0x75dd('0x36')]=function(_0x432b40,_0x147dd3,_0x65a5c2){var _0x3bb325={'agent':{},'channel':_0x75dd('0x60')};if(_0x432b40[_0x75dd('0x5b')]['id']){delete _0x432b40[_0x75dd('0x5b')]['id'];}_0x432b40[_0x75dd('0x5b')][_0x75dd('0x63')]=_0x432b40[_0x75dd('0x5b')][_0x75dd('0x63')]||_0x432b40[_0x75dd('0x64')]['id'];_0x3bb325[_0x75dd('0x65')]['id']=_0x432b40[_0x75dd('0x5b')]['UserId'];return db[_0x75dd('0x3c')][_0x75dd('0x59')]({'where':{'id':_0x432b40['params']['id'],'UserId':null}})[_0x75dd('0x20')](handleEntityNotFound(_0x147dd3,null))[_0x75dd('0x20')](function(_0x4ef520){if(_0x4ef520){_0x3bb325[_0x75dd('0x29')]=_0x4ef520[_0x75dd('0x66')]({'plain':!![]});return db[_0x75dd('0x67')][_0x75dd('0x59')]({'where':{'id':_0x4ef520['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x147dd3,null))['then'](function(_0x42d677){if(_0x42d677){_0x3bb325['interaction']=_0x42d677[_0x75dd('0x66')]({'plain':!![]});interaction_log[_0x75dd('0x21')](_0x75dd('0x83'),_0x432b40['user']['id'],_0x432b40['user'][_0x75dd('0x41')],_0x432b40[_0x75dd('0x64')][_0x75dd('0x6c')],_0x3bb325[_0x75dd('0x6a')]['id'],_0x432b40['body']?JSON['stringify'](_0x432b40['body']):'null');return respondWithRpcPromise(_0x75dd('0x84'),_0x75dd('0x85'),_0x3bb325);}return null;})[_0x75dd('0x20')](function(_0x5a0ba2){var _0x279c2a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a0ba2[_0x75dd('0x29')][_0x75dd('0x71')];return db[_0x75dd('0x86')][_0x75dd('0x42')](_0x279c2a,{'type':db[_0x75dd('0x72')]['QueryTypes'][_0x75dd('0x74')],'raw':!![]})[_0x75dd('0x20')](function(_0x1bc4f8){return _0x1bc4f8;});})['then'](function(_0x1f107f){if(_0x1f107f){_0x3bb325[_0x75dd('0x29')]['contact']=_0x1f107f[0x0];if(!_0x432b40[_0x75dd('0x5b')][_0x75dd('0x63')])return;return db[_0x75dd('0x75')]['find']({'where':{'id':_0x432b40[_0x75dd('0x5b')]['UserId'],'role':_0x75dd('0x65')},'attributes':['id',_0x75dd('0x41'),_0x75dd('0x76'),'email',_0x75dd('0x77')],'raw':!![]});}return null;})[_0x75dd('0x20')](function(_0x4e9603){if(!_0x4e9603)return null;_0x3bb325[_0x75dd('0x29')][_0x75dd('0x65')]=_0x4e9603;return _0x3bb325;})[_0x75dd('0x20')](function(_0x547e88){if(_0x547e88){_0x547e88['message']['interface']=util[_0x75dd('0x7a')]('SIP/%s',_0x432b40[_0x75dd('0x64')]['name']);_0x547e88['message'][_0x75dd('0x7c')]=_0x3bb325[_0x75dd('0x7c')];_0x547e88['message'][_0x75dd('0x7d')]=_0x3bb325['channel'];_0x547e88[_0x75dd('0x29')][_0x75dd('0x7e')]=_0x75dd('0x36');respondWithRpcPromise(_0x75dd('0x80'),_0x75dd('0x80'),{'event':_0x75dd('0x87'),'message':_[_0x75dd('0x88')](_0x3bb325[_0x75dd('0x29')],JSON[_0x75dd('0x82')](_0x3bb325[_0x75dd('0x6a')][_0x75dd('0x89')]))},client9002);return _0x3bb325;}return null;})[_0x75dd('0x20')](respondWithResult(_0x147dd3,null))['catch'](handleError(_0x147dd3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 56ccb51..25efdfc 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 _0x5382=['ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x26ee9a,_0x1917d7){var _0x1e8a0f=function(_0x472cbf){while(--_0x472cbf){_0x26ee9a['push'](_0x26ee9a['shift']());}};_0x1e8a0f(++_0x1917d7);}(_0x5382,0x76));var _0x2538=function(_0x5adf7a,_0x3cc807){_0x5adf7a=_0x5adf7a-0x0;var _0x32b5be=_0x5382[_0x5adf7a];return _0x32b5be;};'use strict';var EventEmitter=require(_0x2538('0x0'));var ChatMessage=require(_0x2538('0x1'))['db'][_0x2538('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2538('0x3')](0x0);var events={'afterCreate':_0x2538('0x4'),'afterUpdate':_0x2538('0x5'),'afterDestroy':'remove'};function emitEvent(_0x549e80){return function(_0x42bbb0,_0x124140,_0x57745b){ChatMessageEvents[_0x2538('0x6')](_0x549e80+':'+_0x42bbb0['id'],_0x42bbb0);ChatMessageEvents[_0x2538('0x6')](_0x549e80,_0x42bbb0);_0x57745b(null);};}for(var e in events){if(events[_0x2538('0x7')](e)){var event=events[e];ChatMessage[_0x2538('0x8')](e,emitEvent(event));}}module[_0x2538('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x99ff=['hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0x99ff,0x18d));var _0xf99f=function(_0xe593fe,_0x587956){_0xe593fe=_0xe593fe-0x0;var _0x49fe42=_0x99ff[_0xe593fe];return _0x49fe42;};'use strict';var EventEmitter=require(_0xf99f('0x0'));var ChatMessage=require(_0xf99f('0x1'))['db'][_0xf99f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf99f('0x3')](0x0);var events={'afterCreate':_0xf99f('0x4'),'afterUpdate':_0xf99f('0x5'),'afterDestroy':_0xf99f('0x6')};function emitEvent(_0x1e4eec){return function(_0x2e9c01,_0x14ca9a,_0x204a15){ChatMessageEvents[_0xf99f('0x7')](_0x1e4eec+':'+_0x2e9c01['id'],_0x2e9c01);ChatMessageEvents[_0xf99f('0x7')](_0x1e4eec,_0x2e9c01);_0x204a15(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf99f('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6831076..bcddd53 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 _0x765e=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out'];(function(_0x152341,_0x8f0c56){var _0x440e1b=function(_0x33918f){while(--_0x33918f){_0x152341['push'](_0x152341['shift']());}};_0x440e1b(++_0x8f0c56);}(_0x765e,0x1bf));var _0xe765=function(_0x3ef029,_0x302589){_0x3ef029=_0x3ef029-0x0;var _0x1147b8=_0x765e[_0x3ef029];return _0x1147b8;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var logger=require(_0xe765('0x2'))(_0xe765('0x3'));var moment=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var rp=require(_0xe765('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe765('0x7'));var config=require(_0xe765('0x8'));var attributes=require('./chatMessage.attributes');module[_0xe765('0x9')]=function(_0x1ae7a2,_0x3ff2f5){return _0x1ae7a2[_0xe765('0xa')]('ChatMessage',attributes,{'tableName':_0xe765('0xb'),'paranoid':![],'indexes':[{'name':_0xe765('0xc'),'fields':[_0xe765('0xd')],'type':_0xe765('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4459ab,_0x224b0f,_0x540379){var _0x59f097=_0x1ae7a2['models'];var _0x11fb96=_0x4459ab['get']({'plain':!![]});if(_0x11fb96[_0xe765('0xf')][_0xe765('0x10')]()==='in'||_0x11fb96[_0xe765('0xf')][_0xe765('0x10')]()===_0xe765('0x11')&&!_0x11fb96[_0xe765('0x12')]&&!_[_0xe765('0x13')](_0x11fb96[_0xe765('0x14')])){_0x59f097[_0xe765('0x15')][_0xe765('0x16')]({'where':{'id':_0x11fb96[_0xe765('0x17')]}})[_0xe765('0x18')](function(_0x235270){if(_0x235270){_0x235270[_0xe765('0x19')]({'lastMsgAt':_0x11fb96[_0xe765('0x1a')],'lastMsgDirection':_0x11fb96['direction'][_0xe765('0x10')]()});}})[_0xe765('0x1b')](function(_0x1cd5dc){console[_0xe765('0x1c')](_0x1cd5dc);});}_0x540379();}},'charset':_0xe765('0x1d'),'collate':_0xe765('0x1e')});}; \ No newline at end of file +var _0xfe72=['direction','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','get','toLowerCase'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xfe72,0x1a3));var _0x2fe7=function(_0xbe3c8f,_0x3c1b35){_0xbe3c8f=_0xbe3c8f-0x0;var _0x27dabe=_0xfe72[_0xbe3c8f];return _0x27dabe;};'use strict';var _=require(_0x2fe7('0x0'));var util=require(_0x2fe7('0x1'));var logger=require(_0x2fe7('0x2'))(_0x2fe7('0x3'));var moment=require(_0x2fe7('0x4'));var BPromise=require(_0x2fe7('0x5'));var rp=require(_0x2fe7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2fe7('0x7'));module[_0x2fe7('0x8')]=function(_0x4bb752,_0xcc087c){return _0x4bb752[_0x2fe7('0x9')](_0x2fe7('0xa'),attributes,{'tableName':_0x2fe7('0xb'),'paranoid':![],'indexes':[{'name':_0x2fe7('0xc'),'fields':[_0x2fe7('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c437b,_0x2a5e0d,_0x257679){var _0x1300fe=_0x4bb752['models'];var _0x277b98=_0x4c437b[_0x2fe7('0xe')]({'plain':!![]});if(_0x277b98['direction'][_0x2fe7('0xf')]()==='in'||_0x277b98[_0x2fe7('0x10')][_0x2fe7('0xf')]()===_0x2fe7('0x11')&&!_0x277b98[_0x2fe7('0x12')]&&!_[_0x2fe7('0x13')](_0x277b98['UserId'])){_0x1300fe[_0x2fe7('0x14')][_0x2fe7('0x15')]({'where':{'id':_0x277b98[_0x2fe7('0x16')]}})[_0x2fe7('0x17')](function(_0xe2b26b){if(_0xe2b26b){_0xe2b26b[_0x2fe7('0x18')]({'lastMsgAt':_0x277b98[_0x2fe7('0x19')],'lastMsgDirection':_0x277b98[_0x2fe7('0x10')][_0x2fe7('0xf')]()});}})[_0x2fe7('0x1a')](function(_0x237923){console[_0x2fe7('0x1b')](_0x237923);});}_0x257679();}},'charset':'utf8mb4','collate':_0x2fe7('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a3cf292..a84c685 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 _0x442e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','util','bluebird','randomstring'];(function(_0x605d3,_0x3dcd80){var _0xbf0f70=function(_0x305c63){while(--_0x305c63){_0x605d3['push'](_0x605d3['shift']());}};_0xbf0f70(++_0x3dcd80);}(_0x442e,0x133));var _0xe442=function(_0x568f9f,_0x209067){_0x568f9f=_0x568f9f-0x0;var _0x46d6f9=_0x442e[_0x568f9f];return _0x46d6f9;};'use strict';var _=require('lodash');var util=require(_0xe442('0x0'));var moment=require('moment');var BPromise=require(_0xe442('0x1'));var rs=require(_0xe442('0x2'));var fs=require('fs');var Redis=require(_0xe442('0x3'));var db=require(_0xe442('0x4'))['db'];var utils=require(_0xe442('0x5'));var logger=require(_0xe442('0x6'))('rpc');var config=require(_0xe442('0x7'));var jayson=require(_0xe442('0x8'));var client=jayson[_0xe442('0x9')][_0xe442('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe442('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe442('0xc'))(new Redis(config['redis']));require(_0xe442('0xd'))['register'](socket);function respondWithRpcPromise(_0x1ac8a8,_0x2f9b2a,_0x34839e){return new BPromise(function(_0x48dd4e,_0x4a221e){return client[_0xe442('0xe')](_0x1ac8a8,_0x34839e)[_0xe442('0xf')](function(_0x9b83aa){logger[_0xe442('0x10')](_0xe442('0x11'),_0x2f9b2a,'request\x20sent');logger[_0xe442('0x12')](_0xe442('0x13'),_0x2f9b2a,_0xe442('0x14'),JSON[_0xe442('0x15')](_0x9b83aa));if(_0x9b83aa[_0xe442('0x16')]){if(_0x9b83aa[_0xe442('0x16')]['code']===0x1f4){logger[_0xe442('0x16')](_0xe442('0x11'),_0x2f9b2a,_0x9b83aa[_0xe442('0x16')][_0xe442('0x17')]);return _0x4a221e(_0x9b83aa[_0xe442('0x16')]['message']);}logger['error'](_0xe442('0x11'),_0x2f9b2a,_0x9b83aa['error'][_0xe442('0x17')]);return _0x48dd4e(_0x9b83aa[_0xe442('0x16')][_0xe442('0x17')]);}else{logger['info'](_0xe442('0x11'),_0x2f9b2a,_0xe442('0x14'));_0x48dd4e(_0x9b83aa[_0xe442('0x18')][_0xe442('0x17')]);}})[_0xe442('0x19')](function(_0x5c0112){logger[_0xe442('0x16')](_0xe442('0x11'),_0x2f9b2a,_0x5c0112);_0x4a221e(_0x5c0112);});});}exports[_0xe442('0x1a')]=function(_0x48b03c){var _0x3ec087=this;return new Promise(function(_0x7e1037,_0x21557f){return db['ChatMessage'][_0xe442('0x1b')](_0x48b03c[_0xe442('0x1c')],{'raw':_0x48b03c['options']?_0x48b03c[_0xe442('0x1d')][_0xe442('0x1e')]===undefined?!![]:![]:!![]})[_0xe442('0xf')](function(_0x1adcc5){logger[_0xe442('0x10')](_0xe442('0x1a'),_0x48b03c);logger[_0xe442('0x12')](_0xe442('0x1a'),_0x48b03c,JSON[_0xe442('0x15')](_0x1adcc5));_0x7e1037(_0x1adcc5);})[_0xe442('0x19')](function(_0x44aa65){logger[_0xe442('0x16')]('CreateChatMessage',_0x44aa65[_0xe442('0x17')],_0x48b03c);_0x21557f(_0x3ec087[_0xe442('0x16')](0x1f4,_0x44aa65['message']));});});}; \ No newline at end of file +var _0x2b7e=['redis','localhost','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20e40d,_0x2a9f0f){var _0x558350=function(_0x1cb908){while(--_0x1cb908){_0x20e40d['push'](_0x20e40d['shift']());}};_0x558350(++_0x2a9f0f);}(_0x2b7e,0x1b4));var _0xe2b7=function(_0x3a8937,_0xd506fd){_0x3a8937=_0x3a8937-0x0;var _0x1e27e5=_0x2b7e[_0x3a8937];return _0x1e27e5;};'use strict';var _=require(_0xe2b7('0x0'));var util=require(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var BPromise=require(_0xe2b7('0x3'));var rs=require(_0xe2b7('0x4'));var fs=require('fs');var Redis=require(_0xe2b7('0x5'));var db=require(_0xe2b7('0x6'))['db'];var utils=require(_0xe2b7('0x7'));var logger=require(_0xe2b7('0x8'))('rpc');var config=require(_0xe2b7('0x9'));var jayson=require(_0xe2b7('0xa'));var client=jayson[_0xe2b7('0xb')]['http']({'port':0x232a});config[_0xe2b7('0xc')]=_['defaults'](config['redis'],{'host':_0xe2b7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2b7('0xc')]));require('./chatMessage.socket')[_0xe2b7('0xe')](socket);function respondWithRpcPromise(_0x35f946,_0x1b1872,_0xceca7d){return new BPromise(function(_0x160194,_0x5052ca){return client[_0xe2b7('0xf')](_0x35f946,_0xceca7d)['then'](function(_0x4171cc){logger[_0xe2b7('0x10')](_0xe2b7('0x11'),_0x1b1872,_0xe2b7('0x12'));logger[_0xe2b7('0x13')](_0xe2b7('0x14'),_0x1b1872,_0xe2b7('0x12'),JSON[_0xe2b7('0x15')](_0x4171cc));if(_0x4171cc[_0xe2b7('0x16')]){if(_0x4171cc[_0xe2b7('0x16')][_0xe2b7('0x17')]===0x1f4){logger[_0xe2b7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x1b1872,_0x4171cc[_0xe2b7('0x16')][_0xe2b7('0x18')]);return _0x5052ca(_0x4171cc[_0xe2b7('0x16')][_0xe2b7('0x18')]);}logger['error'](_0xe2b7('0x11'),_0x1b1872,_0x4171cc[_0xe2b7('0x16')][_0xe2b7('0x18')]);return _0x160194(_0x4171cc[_0xe2b7('0x16')][_0xe2b7('0x18')]);}else{logger[_0xe2b7('0x10')](_0xe2b7('0x11'),_0x1b1872,_0xe2b7('0x12'));_0x160194(_0x4171cc['result'][_0xe2b7('0x18')]);}})[_0xe2b7('0x19')](function(_0x386f54){logger['error'](_0xe2b7('0x11'),_0x1b1872,_0x386f54);_0x5052ca(_0x386f54);});});}exports[_0xe2b7('0x1a')]=function(_0x156480){var _0x4834c7=this;return new Promise(function(_0xbca3f9,_0x296a0f){return db['ChatMessage'][_0xe2b7('0x1b')](_0x156480[_0xe2b7('0x1c')],{'raw':_0x156480['options']?_0x156480[_0xe2b7('0x1d')][_0xe2b7('0x1e')]===undefined?!![]:![]:!![]})[_0xe2b7('0x1f')](function(_0x3b01d8){logger[_0xe2b7('0x10')](_0xe2b7('0x1a'),_0x156480);logger[_0xe2b7('0x13')](_0xe2b7('0x1a'),_0x156480,JSON[_0xe2b7('0x15')](_0x3b01d8));_0xbca3f9(_0x3b01d8);})[_0xe2b7('0x19')](function(_0x3378ac){logger[_0xe2b7('0x16')](_0xe2b7('0x1a'),_0x3378ac[_0xe2b7('0x18')],_0x156480);_0x296a0f(_0x4834c7[_0xe2b7('0x16')](0x1f4,_0x3378ac[_0xe2b7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6ac7c46..970c69f 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 _0xf0ba=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x555fef,_0x538c8e){var _0x352754=function(_0xbcd509){while(--_0xbcd509){_0x555fef['push'](_0x555fef['shift']());}};_0x352754(++_0x538c8e);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=require(_0xaf0b('0x0'));var events=[_0xaf0b('0x1'),_0xaf0b('0x2'),_0xaf0b('0x3')];function createListener(_0xea88b2,_0x555620){return function(_0x277920){_0x555620[_0xaf0b('0x4')](_0xea88b2,_0x277920);};}function removeListener(_0x4cffa5,_0xcd565f){return function(){ChatMessageEvents['removeListener'](_0x4cffa5,_0xcd565f);};}exports[_0xaf0b('0x5')]=function(_0x4b3b85){for(var _0x4d1479=0x0,_0x53b32d=events[_0xaf0b('0x6')];_0x4d1479<_0x53b32d;_0x4d1479++){var _0x17b6d5=events[_0x4d1479];var _0x3439d5=createListener(_0xaf0b('0x7')+_0x17b6d5,_0x4b3b85);ChatMessageEvents['on'](_0x17b6d5,_0x3439d5);}}; \ No newline at end of file +var _0x5455=['remove','update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x1d08d6,_0x4f995e){var _0x1d710d=function(_0x224d64){while(--_0x224d64){_0x1d08d6['push'](_0x1d08d6['shift']());}};_0x1d710d(++_0x4f995e);}(_0x5455,0x197));var _0x5545=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5455[_0x4b055c];return _0x4b62bb;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5545('0x0'),_0x5545('0x1'),_0x5545('0x2')];function createListener(_0x414d1c,_0xba68b3){return function(_0x38b608){_0xba68b3[_0x5545('0x3')](_0x414d1c,_0x38b608);};}function removeListener(_0x4cd466,_0x48fce5){return function(){ChatMessageEvents[_0x5545('0x4')](_0x4cd466,_0x48fce5);};}exports[_0x5545('0x5')]=function(_0x5c22f1){for(var _0x5a6ac7=0x0,_0x2ea57f=events[_0x5545('0x6')];_0x5a6ac7<_0x2ea57f;_0x5a6ac7++){var _0x5c2476=events[_0x5a6ac7];var _0x9cbb0d=createListener(_0x5545('0x7')+_0x5c2476,_0x5c22f1);ChatMessageEvents['on'](_0x5c2476,_0x9cbb0d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d27e4bf..7cdb923 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 _0x3aec=['reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','chat','chatmessage:create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aec,0x1b3));var _0xc3ae=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x3aec[_0x2e3107];return _0x833d69;};'use strict';var multer=require(_0xc3ae('0x0'));var util=require(_0xc3ae('0x1'));var path=require(_0xc3ae('0x2'));var timeout=require(_0xc3ae('0x3'));var express=require(_0xc3ae('0x4'));var router=express[_0xc3ae('0x5')]();var fs_extra=require(_0xc3ae('0x6'));var auth=require(_0xc3ae('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ae('0x8'));var controller=require(_0xc3ae('0x9'));router[_0xc3ae('0xa')]('/',auth[_0xc3ae('0xb')](),controller[_0xc3ae('0xc')]);router['get'](_0xc3ae('0xd'),auth[_0xc3ae('0xb')](),controller[_0xc3ae('0xe')]);router[_0xc3ae('0xa')]('/:id',auth[_0xc3ae('0xb')](),controller[_0xc3ae('0xf')]);router['post']('/',auth[_0xc3ae('0xb')](),interaction[_0xc3ae('0x10')](_0xc3ae('0x11'),_0xc3ae('0x12')),controller['create']);router['put']('/:id',controller[_0xc3ae('0x13')]);router[_0xc3ae('0x14')](_0xc3ae('0x15'),auth[_0xc3ae('0xb')](),controller[_0xc3ae('0x16')]);router[_0xc3ae('0x14')](_0xc3ae('0x17'),auth[_0xc3ae('0xb')](),controller[_0xc3ae('0x18')]);router['delete']('/:id',auth[_0xc3ae('0xb')](),controller[_0xc3ae('0x19')]);module[_0xc3ae('0x1a')]=router; \ No newline at end of file +var _0x3c9f=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c9f,0x17d));var _0xf3c9=function(_0x126f9c,_0x3f69a9){_0x126f9c=_0x126f9c-0x0;var _0x246e4a=_0x3c9f[_0x126f9c];return _0x246e4a;};'use strict';var multer=require(_0xf3c9('0x0'));var util=require(_0xf3c9('0x1'));var path=require(_0xf3c9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3c9('0x3'));var router=express['Router']();var fs_extra=require(_0xf3c9('0x4'));var auth=require(_0xf3c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf3c9('0x6'));var controller=require(_0xf3c9('0x7'));router[_0xf3c9('0x8')]('/',auth[_0xf3c9('0x9')](),controller[_0xf3c9('0xa')]);router[_0xf3c9('0x8')](_0xf3c9('0xb'),auth[_0xf3c9('0x9')](),controller[_0xf3c9('0xc')]);router[_0xf3c9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf3c9('0xd')]);router['post']('/',auth[_0xf3c9('0x9')](),interaction[_0xf3c9('0xe')](_0xf3c9('0xf'),_0xf3c9('0x10')),controller[_0xf3c9('0x11')]);router[_0xf3c9('0x12')](_0xf3c9('0x13'),controller[_0xf3c9('0x14')]);router[_0xf3c9('0x12')](_0xf3c9('0x15'),auth[_0xf3c9('0x9')](),controller['accept']);router[_0xf3c9('0x12')](_0xf3c9('0x16'),auth[_0xf3c9('0x9')](),controller[_0xf3c9('0x17')]);router[_0xf3c9('0x18')](_0xf3c9('0x13'),auth[_0xf3c9('0x9')](),controller[_0xf3c9('0x19')]);module[_0xf3c9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 16f5a84..97d3303 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 _0x757a=['exports','TEXT'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x757a,0xde));var _0xa757=function(_0x51b98b,_0x3b9b68){_0x51b98b=_0x51b98b-0x0;var _0x569c22=_0x757a[_0x51b98b];return _0x569c22;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x0b0e[_0x41b0a8];return _0x3a83d4;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index ecbfe54..5e6c60a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7a54,0x106));var _0x47a5=function(_0x595835,_0x243d02){_0x595835=_0x595835-0x0;var _0x38a203=_0x7a54[_0x595835];return _0x38a203;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x16c682,_0xadf76){var _0x45f70d=function(_0xfaf79d){while(--_0xfaf79d){_0x16c682['push'](_0x16c682['shift']());}};_0x45f70d(++_0xadf76);}(_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){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 a5f1f6c..a8a852c 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 _0x8d0a=['exports','events','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x54861c,_0x8756fc){var _0x4786d6=function(_0x2c151b){while(--_0x2c151b){_0x54861c['push'](_0x54861c['shift']());}};_0x4786d6(++_0x8756fc);}(_0x8d0a,0x65));var _0xa8d0=function(_0x156797,_0xc2f92f){_0x156797=_0x156797-0x0;var _0x576f6d=_0x8d0a[_0x156797];return _0x576f6d;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xa8d0('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa8d0('0x2')](0x0);var events={'afterCreate':_0xa8d0('0x3'),'afterUpdate':_0xa8d0('0x4'),'afterDestroy':_0xa8d0('0x5')};function emitEvent(_0x477190){return function(_0x528287,_0x202833,_0x34f130){ChatOfflineMessageEvents['emit'](_0x477190+':'+_0x528287['id'],_0x528287);ChatOfflineMessageEvents[_0xa8d0('0x6')](_0x477190,_0x528287);_0x34f130(null);};}for(var e in events){if(events[_0xa8d0('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xa8d0('0x8')](e,emitEvent(event));}}module[_0xa8d0('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xacd0=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','remove','emit'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xacd0,0xc9));var _0x0acd=function(_0x28da10,_0x29470c){_0x28da10=_0x28da10-0x0;var _0x298372=_0xacd0[_0x28da10];return _0x298372;};'use strict';var EventEmitter=require(_0x0acd('0x0'));var ChatOfflineMessage=require(_0x0acd('0x1'))['db'][_0x0acd('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0acd('0x3'),'afterUpdate':'update','afterDestroy':_0x0acd('0x4')};function emitEvent(_0x569f93){return function(_0x147d6d,_0x586d60,_0xde7f0e){ChatOfflineMessageEvents[_0x0acd('0x5')](_0x569f93+':'+_0x147d6d['id'],_0x147d6d);ChatOfflineMessageEvents[_0x0acd('0x5')](_0x569f93,_0x147d6d);_0xde7f0e(null);};}for(var e in events){if(events[_0x0acd('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x0acd('0x7')](e,emitEvent(event));}}module[_0x0acd('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 509f799..5c3a4ec 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 _0x62c5=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x4451e6,_0x4cfaab){var _0x4dbf17=function(_0x54e6ee){while(--_0x54e6ee){_0x4451e6['push'](_0x4451e6['shift']());}};_0x4dbf17(++_0x4cfaab);}(_0x62c5,0x112));var _0x562c=function(_0x91ed5c,_0xdb6b34){_0x91ed5c=_0x91ed5c-0x0;var _0x2387d8=_0x62c5[_0x91ed5c];return _0x2387d8;};'use strict';var attributes=require(_0x562c('0x0'));module[_0x562c('0x1')]=function(_0x183b1e){return _0x183b1e['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x562c('0x2'),'collate':_0x562c('0x3')});}; \ No newline at end of file +var _0x4ef9=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x4ef9,0x172));var _0x94ef=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x4ef9[_0x308213];return _0x2e1619;};'use strict';var attributes=require(_0x94ef('0x0'));module[_0x94ef('0x1')]=function(_0x4a2611){return _0x4a2611['define'](_0x94ef('0x2'),attributes,{'tableName':_0x94ef('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x94ef('0x4'),'collate':_0x94ef('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3cd677d..bfbc137 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 _0x4e3d=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','then'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x4e3d,0x14b));var _0xd4e3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4e3d[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xd4e3('0x0'));var moment=require('moment');var BPromise=require(_0xd4e3('0x1'));var rs=require(_0xd4e3('0x2'));var fs=require('fs');var Redis=require(_0xd4e3('0x3'));var db=require(_0xd4e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd4e3('0x5'));var jayson=require(_0xd4e3('0x6'));var client=jayson[_0xd4e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2095,_0x172965,_0x38c887){return new BPromise(function(_0x17ed8d,_0x24fbb5){return client['request'](_0x1d2095,_0x38c887)[_0xd4e3('0x8')](function(_0x49f22b){logger[_0xd4e3('0x9')](_0xd4e3('0xa'),_0x172965,_0xd4e3('0xb'));logger[_0xd4e3('0xc')](_0xd4e3('0xd'),_0x172965,'request\x20sent',JSON['stringify'](_0x49f22b));if(_0x49f22b[_0xd4e3('0xe')]){if(_0x49f22b[_0xd4e3('0xe')]['code']===0x1f4){logger['error'](_0xd4e3('0xa'),_0x172965,_0x49f22b[_0xd4e3('0xe')][_0xd4e3('0xf')]);return _0x24fbb5(_0x49f22b['error'][_0xd4e3('0xf')]);}logger[_0xd4e3('0xe')](_0xd4e3('0xa'),_0x172965,_0x49f22b[_0xd4e3('0xe')]['message']);return _0x17ed8d(_0x49f22b[_0xd4e3('0xe')][_0xd4e3('0xf')]);}else{logger['info'](_0xd4e3('0xa'),_0x172965,_0xd4e3('0xb'));_0x17ed8d(_0x49f22b['result']['message']);}})[_0xd4e3('0x10')](function(_0xc4d165){logger['error'](_0xd4e3('0xa'),_0x172965,_0xc4d165);_0x24fbb5(_0xc4d165);});});} \ No newline at end of file +var _0x102b=['error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','stringify'];(function(_0x236f94,_0x5b762b){var _0x12e162=function(_0x50bf1c){while(--_0x50bf1c){_0x236f94['push'](_0x236f94['shift']());}};_0x12e162(++_0x5b762b);}(_0x102b,0x1be));var _0xb102=function(_0x18f243,_0x2f3090){_0x18f243=_0x18f243-0x0;var _0x17c6d0=_0x102b[_0x18f243];return _0x17c6d0;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd131eb,_0x256052,_0x1ee0c0){return new BPromise(function(_0x5879bb,_0x338e0f){return client['request'](_0xd131eb,_0x1ee0c0)['then'](function(_0xee2164){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x256052,_0xb102('0xb'));logger[_0xb102('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x256052,_0xb102('0xb'),JSON[_0xb102('0xd')](_0xee2164));if(_0xee2164[_0xb102('0xe')]){if(_0xee2164[_0xb102('0xe')][_0xb102('0xf')]===0x1f4){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0xee2164['error'][_0xb102('0x11')]);return _0x338e0f(_0xee2164['error'][_0xb102('0x11')]);}logger[_0xb102('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x256052,_0xee2164[_0xb102('0xe')][_0xb102('0x11')]);return _0x5879bb(_0xee2164['error'][_0xb102('0x11')]);}else{logger[_0xb102('0x12')](_0xb102('0x10'),_0x256052,'request\x20sent');_0x5879bb(_0xee2164['result']['message']);}})[_0xb102('0x13')](function(_0x7f3487){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0x7f3487);_0x338e0f(_0x7f3487);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e4b2b18..d249aa9 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 _0xea32=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5e709f,_0x49c4a1){var _0x45445f=function(_0x3d116f){while(--_0x3d116f){_0x5e709f['push'](_0x5e709f['shift']());}};_0x45445f(++_0x49c4a1);}(_0xea32,0x131));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x2ea3('0x0'));var path=require(_0x2ea3('0x1'));var timeout=require(_0x2ea3('0x2'));var express=require(_0x2ea3('0x3'));var router=express[_0x2ea3('0x4')]();var fs_extra=require(_0x2ea3('0x5'));var auth=require(_0x2ea3('0x6'));var interaction=require(_0x2ea3('0x7'));var config=require(_0x2ea3('0x8'));var controller=require(_0x2ea3('0x9'));router[_0x2ea3('0xa')]('/',auth[_0x2ea3('0xb')](),controller[_0x2ea3('0xc')]);router[_0x2ea3('0xa')](_0x2ea3('0xd'),auth[_0x2ea3('0xb')](),controller[_0x2ea3('0xe')]);router[_0x2ea3('0xa')](_0x2ea3('0xf'),auth[_0x2ea3('0xb')](),controller['show']);router['post']('/',auth[_0x2ea3('0xb')](),controller[_0x2ea3('0x10')]);router[_0x2ea3('0x11')](_0x2ea3('0xf'),auth[_0x2ea3('0xb')](),controller[_0x2ea3('0x12')]);router[_0x2ea3('0x13')](_0x2ea3('0xf'),auth[_0x2ea3('0xb')](),controller[_0x2ea3('0x14')]);module[_0x2ea3('0x15')]=router; \ No newline at end of file +var _0x883d=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','put','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x883d,0x135));var _0xd883=function(_0x10f966,_0x165741){_0x10f966=_0x10f966-0x0;var _0x5e02da=_0x883d[_0x10f966];return _0x5e02da;};'use strict';var multer=require(_0xd883('0x0'));var util=require(_0xd883('0x1'));var path=require(_0xd883('0x2'));var timeout=require('connect-timeout');var express=require(_0xd883('0x3'));var router=express[_0xd883('0x4')]();var fs_extra=require(_0xd883('0x5'));var auth=require(_0xd883('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd883('0x7'));var controller=require(_0xd883('0x8'));router['get']('/',auth[_0xd883('0x9')](),controller['index']);router[_0xd883('0xa')](_0xd883('0xb'),auth[_0xd883('0x9')](),controller[_0xd883('0xc')]);router[_0xd883('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd883('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd883('0xe')]);router[_0xd883('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd883('0x10')]);module[_0xd883('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 50d8c79..217ed6c 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 _0x89ea=['sequelize','STRING','ENUM','mouseOver','INTEGER'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x89ea,0xdc));var _0xa89e=function(_0x3744c4,_0x4bdca9){_0x3744c4=_0x3744c4-0x0;var _0x167b7f=_0x89ea[_0x3744c4];return _0x167b7f;};'use strict';var Sequelize=require(_0xa89e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa89e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa89e('0x2')](_0xa89e('0x3'),'timeout'),'defaultValue':_0xa89e('0x3')},'selector':{'type':Sequelize[_0xa89e('0x1')]},'timeout':{'type':Sequelize[_0xa89e('0x4')]}}; \ No newline at end of file +var _0xfc84=['mouseOver','timeout','exports','STRING','ENUM'];(function(_0x177f71,_0x514ab9){var _0x57b964=function(_0x2e5008){while(--_0x2e5008){_0x177f71['push'](_0x177f71['shift']());}};_0x57b964(++_0x514ab9);}(_0xfc84,0x151));var _0x4fc8=function(_0x53b031,_0x4ec94a){_0x53b031=_0x53b031-0x0;var _0x208528=_0xfc84[_0x53b031];return _0x208528;};'use strict';var Sequelize=require('sequelize');module[_0x4fc8('0x0')]={'name':{'type':Sequelize[_0x4fc8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4fc8('0x2')](_0x4fc8('0x3'),_0x4fc8('0x4')),'defaultValue':_0x4fc8('0x3')},'selector':{'type':Sequelize[_0x4fc8('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fb636f3..4de12a6 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 _0xf9d5=['catch','create','body','update','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','error','stack','name','show','params','model','keys','ChatProactiveAction','query','intersection','fields','attributes','includeAll','merge','options'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xf9d5,0x122));var _0x5f9d=function(_0x19093e,_0x2b5387){_0x19093e=_0x19093e-0x0;var _0x2e3e83=_0xf9d5[_0x19093e];return _0x2e3e83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];function respondWithStatusCode(_0x10f5b1,_0x257910){_0x257910=_0x257910||0xcc;return function(_0x23a39f){if(_0x23a39f){return _0x10f5b1['sendStatus'](_0x257910);}return _0x10f5b1[_0x5f9d('0x18')](_0x257910)[_0x5f9d('0x19')]();};}function respondWithResult(_0x234902,_0x5aacdc){_0x5aacdc=_0x5aacdc||0xc8;return function(_0x8e2381){if(_0x8e2381){return _0x234902[_0x5f9d('0x18')](_0x5aacdc)['json'](_0x8e2381);}};}function respondWithFilteredResult(_0x4fd1cb,_0x2f0154){return function(_0x334cea){if(_0x334cea){var _0x3d4a1c=typeof _0x2f0154[_0x5f9d('0x1a')]===_0x5f9d('0x1b')&&typeof _0x2f0154['limit']==='undefined';var _0x54bd00=_0x334cea[_0x5f9d('0x1c')];var _0x4fb9a5=_0x3d4a1c?0x0:_0x2f0154[_0x5f9d('0x1a')];var _0x48448e=_0x3d4a1c?_0x334cea[_0x5f9d('0x1c')]:_0x2f0154[_0x5f9d('0x1a')]+_0x2f0154[_0x5f9d('0x1d')];var _0x55a31c;if(_0x48448e>=_0x54bd00){_0x48448e=_0x54bd00;_0x55a31c=0xc8;}else{_0x55a31c=0xce;}_0x4fd1cb[_0x5f9d('0x18')](_0x55a31c);return _0x4fd1cb[_0x5f9d('0x1e')](_0x5f9d('0x1f'),_0x4fb9a5+'-'+_0x48448e+'/'+_0x54bd00)[_0x5f9d('0x20')](_0x334cea);}return null;};}function patchUpdates(_0x320182){return function(_0xa62826){try{jsonpatch[_0x5f9d('0x21')](_0xa62826,_0x320182,!![]);}catch(_0x2563d5){return BPromise[_0x5f9d('0x22')](_0x2563d5);}return _0xa62826['save']();};}function saveUpdates(_0x4a2eeb,_0x5465b1){return function(_0x1bc76b){if(_0x1bc76b){return _0x1bc76b['update'](_0x4a2eeb)[_0x5f9d('0x23')](function(_0x5a3472){return _0x5a3472;});}return null;};}function removeEntity(_0x9d86ce,_0x564886){return function(_0x4875c5){if(_0x4875c5){return _0x4875c5['destroy']()[_0x5f9d('0x23')](function(){_0x9d86ce[_0x5f9d('0x18')](0xcc)[_0x5f9d('0x19')]();});}};}function handleEntityNotFound(_0x234511,_0x542bbc){return function(_0x379d2d){if(!_0x379d2d){_0x234511[_0x5f9d('0x24')](0x194);}return _0x379d2d;};}function handleError(_0x190402,_0x74f212){_0x74f212=_0x74f212||0x1f4;return function(_0x2d097f){logger[_0x5f9d('0x25')](_0x2d097f[_0x5f9d('0x26')]);if(_0x2d097f[_0x5f9d('0x27')]){delete _0x2d097f[_0x5f9d('0x27')];}_0x190402[_0x5f9d('0x18')](_0x74f212)['send'](_0x2d097f);};}exports[_0x5f9d('0x28')]=function(_0x1b9054,_0x1496c0){var _0x13cc7c={'raw':!![],'where':{'id':_0x1b9054[_0x5f9d('0x29')]['id']}},_0x10e542={};_0x10e542[_0x5f9d('0x2a')]=_[_0x5f9d('0x2b')](db[_0x5f9d('0x2c')]['rawAttributes']);_0x10e542['query']=_['keys'](_0x1b9054[_0x5f9d('0x2d')]);_0x10e542['filters']=_[_0x5f9d('0x2e')](_0x10e542['model'],_0x10e542[_0x5f9d('0x2d')]);_0x13cc7c['attributes']=_[_0x5f9d('0x2e')](_0x10e542[_0x5f9d('0x2a')],qs[_0x5f9d('0x2f')](_0x1b9054[_0x5f9d('0x2d')][_0x5f9d('0x2f')]));_0x13cc7c['attributes']=_0x13cc7c[_0x5f9d('0x30')]['length']?_0x13cc7c[_0x5f9d('0x30')]:_0x10e542['model'];if(_0x1b9054[_0x5f9d('0x2d')][_0x5f9d('0x31')]){_0x13cc7c['include']=[{'all':!![]}];}_0x13cc7c=_[_0x5f9d('0x32')]({},_0x13cc7c,_0x1b9054[_0x5f9d('0x33')]);return db[_0x5f9d('0x2c')]['find'](_0x13cc7c)[_0x5f9d('0x23')](handleEntityNotFound(_0x1496c0,null))[_0x5f9d('0x23')](respondWithResult(_0x1496c0,null))[_0x5f9d('0x34')](handleError(_0x1496c0,null));};exports[_0x5f9d('0x35')]=function(_0x3377af,_0x506869){return db[_0x5f9d('0x2c')][_0x5f9d('0x35')](_0x3377af[_0x5f9d('0x36')],{})[_0x5f9d('0x23')](respondWithResult(_0x506869,0xc9))[_0x5f9d('0x34')](handleError(_0x506869,null));};exports[_0x5f9d('0x37')]=function(_0x48a8e8,_0x1692c0){if(_0x48a8e8[_0x5f9d('0x36')]['id']){delete _0x48a8e8[_0x5f9d('0x36')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x48a8e8[_0x5f9d('0x29')]['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x1692c0,null))[_0x5f9d('0x23')](saveUpdates(_0x48a8e8[_0x5f9d('0x36')],null))[_0x5f9d('0x23')](respondWithResult(_0x1692c0,null))['catch'](handleError(_0x1692c0,null));};exports['destroy']=function(_0x43b7b9,_0x3c5737){return db['ChatProactiveAction'][_0x5f9d('0x38')]({'where':{'id':_0x43b7b9['params']['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x3c5737,null))[_0x5f9d('0x23')](removeEntity(_0x3c5737,null))['catch'](handleError(_0x3c5737,null));}; \ No newline at end of file +var _0x4abf=['fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','error','stack','name','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','create','body','find','params','destroy','eml-format','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4abf,0xac));var _0xf4ab=function(_0x1e8ac9,_0x1bd0fe){_0x1e8ac9=_0x1e8ac9-0x0;var _0x4c895c=_0x4abf[_0x1e8ac9];return _0x4c895c;};'use strict';var emlformat=require(_0xf4ab('0x0'));var rimraf=require(_0xf4ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf4ab('0x3'));var util=require(_0xf4ab('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf4ab('0x5'));var ejs=require(_0xf4ab('0x6'));var fs=require('fs');var fs_extra=require(_0xf4ab('0x7'));var _=require(_0xf4ab('0x8'));var squel=require('squel');var crypto=require(_0xf4ab('0x9'));var jsforce=require(_0xf4ab('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ab('0x5'));var querystring=require('querystring');var Papa=require(_0xf4ab('0xb'));var Redis=require(_0xf4ab('0xc'));var authService=require(_0xf4ab('0xd'));var qs=require(_0xf4ab('0xe'));var as=require(_0xf4ab('0xf'));var hardwareService=require(_0xf4ab('0x10'));var logger=require(_0xf4ab('0x11'))(_0xf4ab('0x12'));var utils=require(_0xf4ab('0x13'));var config=require(_0xf4ab('0x14'));var licenseUtil=require(_0xf4ab('0x15'));var db=require(_0xf4ab('0x16'))['db'];function respondWithStatusCode(_0x1968f6,_0x552268){_0x552268=_0x552268||0xcc;return function(_0x52ab9e){if(_0x52ab9e){return _0x1968f6[_0xf4ab('0x17')](_0x552268);}return _0x1968f6[_0xf4ab('0x18')](_0x552268)[_0xf4ab('0x19')]();};}function respondWithResult(_0x1b7453,_0x141d64){_0x141d64=_0x141d64||0xc8;return function(_0x23c03d){if(_0x23c03d){return _0x1b7453[_0xf4ab('0x18')](_0x141d64)[_0xf4ab('0x1a')](_0x23c03d);}};}function respondWithFilteredResult(_0x47abb8,_0x2e7b69){return function(_0x1c5202){if(_0x1c5202){var _0xc26111=typeof _0x2e7b69['offset']===_0xf4ab('0x1b')&&typeof _0x2e7b69[_0xf4ab('0x1c')]==='undefined';var _0x196ea7=_0x1c5202[_0xf4ab('0x1d')];var _0x2e1cf2=_0xc26111?0x0:_0x2e7b69[_0xf4ab('0x1e')];var _0x2d0d4d=_0xc26111?_0x1c5202[_0xf4ab('0x1d')]:_0x2e7b69[_0xf4ab('0x1e')]+_0x2e7b69['limit'];var _0x4d8753;if(_0x2d0d4d>=_0x196ea7){_0x2d0d4d=_0x196ea7;_0x4d8753=0xc8;}else{_0x4d8753=0xce;}_0x47abb8[_0xf4ab('0x18')](_0x4d8753);return _0x47abb8['set'](_0xf4ab('0x1f'),_0x2e1cf2+'-'+_0x2d0d4d+'/'+_0x196ea7)[_0xf4ab('0x1a')](_0x1c5202);}return null;};}function patchUpdates(_0x3c1394){return function(_0x4b8632){try{jsonpatch[_0xf4ab('0x20')](_0x4b8632,_0x3c1394,!![]);}catch(_0x2fb02d){return BPromise[_0xf4ab('0x21')](_0x2fb02d);}return _0x4b8632[_0xf4ab('0x22')]();};}function saveUpdates(_0xcd9799,_0x52ba53){return function(_0xf1998f){if(_0xf1998f){return _0xf1998f[_0xf4ab('0x23')](_0xcd9799)[_0xf4ab('0x24')](function(_0x248d13){return _0x248d13;});}return null;};}function removeEntity(_0x152d48,_0xb5c618){return function(_0x2cb4bc){if(_0x2cb4bc){return _0x2cb4bc['destroy']()[_0xf4ab('0x24')](function(){_0x152d48['status'](0xcc)[_0xf4ab('0x19')]();});}};}function handleEntityNotFound(_0x550e29,_0x561ba5){return function(_0x55388d){if(!_0x55388d){_0x550e29['sendStatus'](0x194);}return _0x55388d;};}function handleError(_0x5781da,_0x5641b8){_0x5641b8=_0x5641b8||0x1f4;return function(_0x5f5af2){logger[_0xf4ab('0x25')](_0x5f5af2[_0xf4ab('0x26')]);if(_0x5f5af2[_0xf4ab('0x27')]){delete _0x5f5af2[_0xf4ab('0x27')];}_0x5781da[_0xf4ab('0x18')](_0x5641b8)['send'](_0x5f5af2);};}exports['show']=function(_0x325b38,_0x3cf5b1){var _0x52f419={'raw':!![],'where':{'id':_0x325b38['params']['id']}},_0x46877c={};_0x46877c[_0xf4ab('0x28')]=_[_0xf4ab('0x29')](db[_0xf4ab('0x2a')][_0xf4ab('0x2b')]);_0x46877c[_0xf4ab('0x2c')]=_[_0xf4ab('0x29')](_0x325b38[_0xf4ab('0x2c')]);_0x46877c[_0xf4ab('0x2d')]=_[_0xf4ab('0x2e')](_0x46877c[_0xf4ab('0x28')],_0x46877c[_0xf4ab('0x2c')]);_0x52f419['attributes']=_[_0xf4ab('0x2e')](_0x46877c['model'],qs[_0xf4ab('0x2f')](_0x325b38[_0xf4ab('0x2c')]['fields']));_0x52f419['attributes']=_0x52f419[_0xf4ab('0x30')][_0xf4ab('0x31')]?_0x52f419[_0xf4ab('0x30')]:_0x46877c[_0xf4ab('0x28')];if(_0x325b38[_0xf4ab('0x2c')]['includeAll']){_0x52f419['include']=[{'all':!![]}];}_0x52f419=_[_0xf4ab('0x32')]({},_0x52f419,_0x325b38[_0xf4ab('0x33')]);return db[_0xf4ab('0x2a')]['find'](_0x52f419)[_0xf4ab('0x24')](handleEntityNotFound(_0x3cf5b1,null))[_0xf4ab('0x24')](respondWithResult(_0x3cf5b1,null))[_0xf4ab('0x34')](handleError(_0x3cf5b1,null));};exports[_0xf4ab('0x35')]=function(_0x37c30b,_0x105d75){return db[_0xf4ab('0x2a')][_0xf4ab('0x35')](_0x37c30b[_0xf4ab('0x36')],{})[_0xf4ab('0x24')](respondWithResult(_0x105d75,0xc9))[_0xf4ab('0x34')](handleError(_0x105d75,null));};exports[_0xf4ab('0x23')]=function(_0x5f1722,_0x7dd642){if(_0x5f1722[_0xf4ab('0x36')]['id']){delete _0x5f1722[_0xf4ab('0x36')]['id'];}return db[_0xf4ab('0x2a')][_0xf4ab('0x37')]({'where':{'id':_0x5f1722[_0xf4ab('0x38')]['id']}})[_0xf4ab('0x24')](handleEntityNotFound(_0x7dd642,null))[_0xf4ab('0x24')](saveUpdates(_0x5f1722[_0xf4ab('0x36')],null))[_0xf4ab('0x24')](respondWithResult(_0x7dd642,null))[_0xf4ab('0x34')](handleError(_0x7dd642,null));};exports[_0xf4ab('0x39')]=function(_0x19f9eb,_0x39e19e){return db['ChatProactiveAction'][_0xf4ab('0x37')]({'where':{'id':_0x19f9eb[_0xf4ab('0x38')]['id']}})[_0xf4ab('0x24')](handleEntityNotFound(_0x39e19e,null))[_0xf4ab('0x24')](removeEntity(_0x39e19e,null))['catch'](handleError(_0x39e19e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7c96efd..7a4b531 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 _0xb1b6=['request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','lodash','../../config/logger','api','moment','bluebird'];(function(_0x128c2,_0x24f64d){var _0xec6cad=function(_0x592865){while(--_0x592865){_0x128c2['push'](_0x128c2['shift']());}};_0xec6cad(++_0x24f64d);}(_0xb1b6,0x1f3));var _0x6b1b=function(_0x53cbcc,_0x252b41){_0x53cbcc=_0x53cbcc-0x0;var _0x26c68c=_0xb1b6[_0x53cbcc];return _0x26c68c;};'use strict';var _=require(_0x6b1b('0x0'));var util=require('util');var logger=require(_0x6b1b('0x1'))(_0x6b1b('0x2'));var moment=require(_0x6b1b('0x3'));var BPromise=require(_0x6b1b('0x4'));var rp=require(_0x6b1b('0x5'));var fs=require('fs');var path=require(_0x6b1b('0x6'));var rimraf=require(_0x6b1b('0x7'));var config=require(_0x6b1b('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x6b1b('0x9')]=function(_0x24c12b,_0x3ed5d4){return _0x24c12b[_0x6b1b('0xa')](_0x6b1b('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1634=['request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2499dc,_0x237995){var _0x47f07=function(_0x9a1853){while(--_0x9a1853){_0x2499dc['push'](_0x2499dc['shift']());}};_0x47f07(++_0x237995);}(_0x1634,0x159));var _0x4163=function(_0x248055,_0x582bfe){_0x248055=_0x248055-0x0;var _0x18ce16=_0x1634[_0x248055];return _0x18ce16;};'use strict';var _=require(_0x4163('0x0'));var util=require(_0x4163('0x1'));var logger=require(_0x4163('0x2'))(_0x4163('0x3'));var moment=require(_0x4163('0x4'));var BPromise=require(_0x4163('0x5'));var rp=require(_0x4163('0x6'));var fs=require('fs');var path=require(_0x4163('0x7'));var rimraf=require(_0x4163('0x8'));var config=require(_0x4163('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0x4163('0xa')]=function(_0x152f24,_0x6243fb){return _0x152f24['define'](_0x4163('0xb'),attributes,{'tableName':_0x4163('0xc'),'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 ce1de0a..9e5b64a 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 _0x6688=['info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x49a84b,_0x17c1be){var _0x171650=function(_0x1cc9cf){while(--_0x1cc9cf){_0x49a84b['push'](_0x49a84b['shift']());}};_0x171650(++_0x17c1be);}(_0x6688,0x13d));var _0x8668=function(_0x5d4b7d,_0x2a54f8){_0x5d4b7d=_0x5d4b7d-0x0;var _0x5d1eaf=_0x6688[_0x5d4b7d];return _0x5d1eaf;};'use strict';var _=require('lodash');var util=require(_0x8668('0x0'));var moment=require(_0x8668('0x1'));var BPromise=require(_0x8668('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8668('0x3'));var db=require(_0x8668('0x4'))['db'];var utils=require(_0x8668('0x5'));var logger=require(_0x8668('0x6'))(_0x8668('0x7'));var config=require(_0x8668('0x8'));var jayson=require(_0x8668('0x9'));var client=jayson[_0x8668('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389de5,_0x493efe,_0x2964bf){return new BPromise(function(_0x51b317,_0x5cf43a){return client[_0x8668('0xb')](_0x389de5,_0x2964bf)[_0x8668('0xc')](function(_0x800ab7){logger[_0x8668('0xd')](_0x8668('0xe'),_0x493efe,_0x8668('0xf'));logger['debug'](_0x8668('0x10'),_0x493efe,_0x8668('0xf'),JSON[_0x8668('0x11')](_0x800ab7));if(_0x800ab7[_0x8668('0x12')]){if(_0x800ab7[_0x8668('0x12')][_0x8668('0x13')]===0x1f4){logger[_0x8668('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x493efe,_0x800ab7['error'][_0x8668('0x14')]);return _0x5cf43a(_0x800ab7[_0x8668('0x12')]['message']);}logger['error'](_0x8668('0xe'),_0x493efe,_0x800ab7[_0x8668('0x12')][_0x8668('0x14')]);return _0x51b317(_0x800ab7[_0x8668('0x12')][_0x8668('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x493efe,_0x8668('0xf'));_0x51b317(_0x800ab7['result'][_0x8668('0x14')]);}})[_0x8668('0x15')](function(_0x3316a3){logger[_0x8668('0x12')](_0x8668('0xe'),_0x493efe,_0x3316a3);_0x5cf43a(_0x3316a3);});});} \ No newline at end of file +var _0xd893=['ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x4d18cd,_0x287bb0){var _0x28ced9=function(_0x3fd506){while(--_0x3fd506){_0x4d18cd['push'](_0x4d18cd['shift']());}};_0x28ced9(++_0x287bb0);}(_0xd893,0xb9));var _0x3d89=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd893[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3d89('0x0'));var util=require(_0x3d89('0x1'));var moment=require(_0x3d89('0x2'));var BPromise=require(_0x3d89('0x3'));var rs=require(_0x3d89('0x4'));var fs=require('fs');var Redis=require(_0x3d89('0x5'));var db=require(_0x3d89('0x6'))['db'];var utils=require(_0x3d89('0x7'));var logger=require(_0x3d89('0x8'))(_0x3d89('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d89('0xa'));var client=jayson['client'][_0x3d89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x315dc2,_0x19263c,_0x4304d4){return new BPromise(function(_0x400983,_0x57a3e3){return client[_0x3d89('0xc')](_0x315dc2,_0x4304d4)[_0x3d89('0xd')](function(_0x4b18b3){logger[_0x3d89('0xe')](_0x3d89('0xf'),_0x19263c,'request\x20sent');logger[_0x3d89('0x10')](_0x3d89('0x11'),_0x19263c,'request\x20sent',JSON[_0x3d89('0x12')](_0x4b18b3));if(_0x4b18b3[_0x3d89('0x13')]){if(_0x4b18b3[_0x3d89('0x13')][_0x3d89('0x14')]===0x1f4){logger[_0x3d89('0x13')](_0x3d89('0xf'),_0x19263c,_0x4b18b3[_0x3d89('0x13')][_0x3d89('0x15')]);return _0x57a3e3(_0x4b18b3[_0x3d89('0x13')][_0x3d89('0x15')]);}logger[_0x3d89('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x19263c,_0x4b18b3[_0x3d89('0x13')]['message']);return _0x400983(_0x4b18b3['error']['message']);}else{logger[_0x3d89('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x19263c,_0x3d89('0x16'));_0x400983(_0x4b18b3[_0x3d89('0x17')][_0x3d89('0x15')]);}})[_0x3d89('0x18')](function(_0x25fe86){logger[_0x3d89('0x13')](_0x3d89('0xf'),_0x19263c,_0x25fe86);_0x57a3e3(_0x25fe86);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ca244c4..bf7cbee 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x46b98,_0x202301){var _0x550fed=function(_0x5b2634){while(--_0x5b2634){_0x46b98['push'](_0x46b98['shift']());}};_0x550fed(++_0x202301);}(_0xf494,0x1c6));var _0x4f49=function(_0x109864,_0x2339ec){_0x109864=_0x109864-0x0;var _0x1523a1=_0xf494[_0x109864];return _0x1523a1;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xabce,0x103));var _0xeabc=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xabce[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 96d5bba..a19c719 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 _0x1659=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2035b1,_0x240790){var _0x2a3f32=function(_0x3f65e9){while(--_0x3f65e9){_0x2035b1['push'](_0x2035b1['shift']());}};_0x2a3f32(++_0x240790);}(_0x1659,0x1a1));var _0x9165=function(_0x7af1ed,_0x150d56){_0x7af1ed=_0x7af1ed-0x0;var _0x7dcac9=_0x1659[_0x7af1ed];return _0x7dcac9;};'use strict';var Sequelize=require(_0x9165('0x0'));module[_0x9165('0x1')]={'name':{'type':Sequelize[_0x9165('0x2')],'unique':_0x9165('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9165('0x2')]},'timeout':{'type':Sequelize[_0x9165('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9165('0x5')](_0x9165('0x6'),'beepall',_0x9165('0x7'))}}; \ No newline at end of file +var _0x286b=['sequelize','exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x176da0,_0x36d8d4){var _0x16d310=function(_0xac02f0){while(--_0xac02f0){_0x176da0['push'](_0x176da0['shift']());}};_0x16d310(++_0x36d8d4);}(_0x286b,0x134));var _0xb286=function(_0x2ef98e,_0x171eb2){_0x2ef98e=_0x2ef98e-0x0;var _0x467c65=_0x286b[_0x2ef98e];return _0x467c65;};'use strict';var Sequelize=require(_0xb286('0x0'));module[_0xb286('0x1')]={'name':{'type':Sequelize[_0xb286('0x2')],'unique':_0xb286('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb286('0x4')](_0xb286('0x5'),'beepall',_0xb286('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 944167d..314be81 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 _0xdf87=['index','map','ChatQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','Agents','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','hasOwnProperty','bluebird','util','squel','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','ChatQueues','UserProfileResource','error','stack','name'];(function(_0x2794e4,_0x11bcf6){var _0xf860d4=function(_0x1ef56e){while(--_0x1ef56e){_0x2794e4['push'](_0x2794e4['shift']());}};_0xf860d4(++_0x11bcf6);}(_0xdf87,0x14a));var _0x7df8=function(_0x15c0dd,_0x5dcc24){_0x15c0dd=_0x15c0dd-0x0;var _0x4a0d6d=_0xdf87[_0x15c0dd];return _0x4a0d6d;};'use strict';var BPromise=require(_0x7df8('0x0'));var util=require(_0x7df8('0x1'));var _=require('lodash');var squel=require(_0x7df8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7df8('0x3'))('api');var config=require(_0x7df8('0x4'));var db=require('../../mysqldb')['db'];config[_0x7df8('0x5')]=_[_0x7df8('0x6')](config[_0x7df8('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x7df8('0x7'))(new Redis(config[_0x7df8('0x5')]));require(_0x7df8('0x8'))[_0x7df8('0x9')](socket);function respondWithStatusCode(_0x41c3d9,_0x4bcad8){_0x4bcad8=_0x4bcad8||0xcc;return function(_0x14a38c){if(_0x14a38c){return _0x41c3d9['sendStatus'](_0x4bcad8);}return _0x41c3d9[_0x7df8('0xa')](_0x4bcad8)[_0x7df8('0xb')]();};}function respondWithResult(_0x136119,_0x3f2154){_0x3f2154=_0x3f2154||0xc8;return function(_0x41eeec){if(_0x41eeec){return _0x136119[_0x7df8('0xa')](_0x3f2154)[_0x7df8('0xc')](_0x41eeec);}};}function respondWithFilteredResult(_0x814a7,_0x2494db){return function(_0x116cb9){if(_0x116cb9){var _0x57cd20=typeof _0x2494db[_0x7df8('0xd')]===_0x7df8('0xe')&&typeof _0x2494db[_0x7df8('0xf')]===_0x7df8('0xe');var _0x43d424=_0x116cb9[_0x7df8('0x10')];var _0xfaac8b=_0x57cd20?0x0:_0x2494db['offset'];var _0x3b7b80=_0x57cd20?_0x116cb9['count']:_0x2494db[_0x7df8('0xd')]+_0x2494db[_0x7df8('0xf')];var _0x3b76bb;if(_0x3b7b80>=_0x43d424){_0x3b7b80=_0x43d424;_0x3b76bb=0xc8;}else{_0x3b76bb=0xce;}_0x814a7[_0x7df8('0xa')](_0x3b76bb);return _0x814a7[_0x7df8('0x11')](_0x7df8('0x12'),_0xfaac8b+'-'+_0x3b7b80+'/'+_0x43d424)['json'](_0x116cb9);}return null;};}function saveUpdates(_0x26ff58){return function(_0x1cf5ec){if(_0x1cf5ec){return _0x1cf5ec[_0x7df8('0x13')](_0x26ff58)[_0x7df8('0x14')](function(_0x25235e){return _0x25235e;});}return null;};}function removeEntity(_0x20a61c){return function(_0x13503f){if(_0x13503f){return _0x13503f[_0x7df8('0x15')]()[_0x7df8('0x14')](function(){var _0x23a45b=_0x13503f['get']({'plain':!![]});var _0x215042=_0x7df8('0x16');return db[_0x7df8('0x17')][_0x7df8('0x15')]({'where':{'type':_0x215042,'resourceId':_0x23a45b['id']}})[_0x7df8('0x14')](function(){return _0x13503f;});})['then'](function(){_0x20a61c['status'](0xcc)[_0x7df8('0xb')]();});}};}function handleEntityNotFound(_0x3c2da9){return function(_0xb6d3f0){if(!_0xb6d3f0){_0x3c2da9['sendStatus'](0x194);}return _0xb6d3f0;};}function handleError(_0x11ed17,_0x351135){_0x351135=_0x351135||0x1f4;return function(_0x59d95b){logger[_0x7df8('0x18')](_0x59d95b[_0x7df8('0x19')]);if(_0x59d95b[_0x7df8('0x1a')]){delete _0x59d95b['name'];}_0x11ed17['status'](_0x351135)['send'](_0x59d95b);};}exports[_0x7df8('0x1b')]=function(_0x4fb9f5,_0x309f34){var _0x46adbd={};var _0x5c2600={'count':0x0,'rows':[]};var _0x4af6d3=_[_0x7df8('0x1c')](db[_0x7df8('0x1d')][_0x7df8('0x1e')],function(_0x583739){return{'name':_0x583739[_0x7df8('0x1f')],'type':_0x583739[_0x7df8('0x20')][_0x7df8('0x21')]};});_0x46adbd=qs['getOptions'](_0x4af6d3,_0x4fb9f5);var _0x1b6f90={'where':_0x46adbd[_0x7df8('0x22')]};return db[_0x7df8('0x1d')][_0x7df8('0x10')](_0x1b6f90)[_0x7df8('0x14')](function(_0x15a6b0){_0x5c2600[_0x7df8('0x10')]=_0x15a6b0;_0x46adbd[_0x7df8('0x23')]=qs[_0x7df8('0x23')](_0x4fb9f5[_0x7df8('0x24')]);return db[_0x7df8('0x1d')][_0x7df8('0x25')](_0x46adbd);})[_0x7df8('0x14')](function(_0x2653db){_0x5c2600['rows']=_0x2653db;return _0x5c2600;})[_0x7df8('0x14')](respondWithFilteredResult(_0x309f34,_0x46adbd))['catch'](handleError(_0x309f34,null));};exports['show']=function(_0x2cf751,_0x5d6a2e){var _0x22f9d1={'raw':!![],'where':{'id':_0x2cf751[_0x7df8('0x26')]['id']}},_0xa6e745={};_0xa6e745[_0x7df8('0x27')]=_[_0x7df8('0x28')](db['ChatQueue'][_0x7df8('0x1e')]);_0xa6e745[_0x7df8('0x24')]=_[_0x7df8('0x28')](_0x2cf751[_0x7df8('0x24')]);_0xa6e745[_0x7df8('0x29')]=_[_0x7df8('0x2a')](_0xa6e745['model'],_0xa6e745[_0x7df8('0x24')]);_0x22f9d1['attributes']=_[_0x7df8('0x2a')](_0xa6e745['model'],qs[_0x7df8('0x2b')](_0x2cf751[_0x7df8('0x24')][_0x7df8('0x2b')]));_0x22f9d1['attributes']=_0x22f9d1[_0x7df8('0x2c')][_0x7df8('0x2d')]?_0x22f9d1[_0x7df8('0x2c')]:_0xa6e745['model'];if(_0x2cf751['query'][_0x7df8('0x2e')]){_0x22f9d1[_0x7df8('0x23')]=[{'all':!![]}];}_0x22f9d1=_[_0x7df8('0x2f')]({},_0x22f9d1,_0x2cf751[_0x7df8('0x30')]);return db[_0x7df8('0x1d')][_0x7df8('0x31')](_0x22f9d1)[_0x7df8('0x14')](handleEntityNotFound(_0x5d6a2e,null))[_0x7df8('0x14')](respondWithResult(_0x5d6a2e,null))[_0x7df8('0x32')](handleError(_0x5d6a2e,null));};exports[_0x7df8('0x33')]=function(_0x2e0fc9,_0x591239){return db[_0x7df8('0x1d')]['create'](_0x2e0fc9[_0x7df8('0x34')],{})[_0x7df8('0x14')](function(_0x31f646){var _0x187a06=_0x2e0fc9[_0x7df8('0x35')][_0x7df8('0x36')]({'plain':!![]});if(!_0x187a06)throw new Error(_0x7df8('0x37'));if(_0x187a06['role']===_0x7df8('0x35')){var _0x3a64c4=_0x31f646[_0x7df8('0x36')]({'plain':!![]});var _0x5219f6=_0x7df8('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x5219f6,'userProfileId':_0x187a06[_0x7df8('0x38')]},'raw':!![]})['then'](function(_0x3ebef1){if(_0x3ebef1&&_0x3ebef1[_0x7df8('0x39')]===0x0){return db[_0x7df8('0x17')][_0x7df8('0x33')]({'name':_0x3a64c4['name'],'resourceId':_0x3a64c4['id'],'type':_0x3ebef1[_0x7df8('0x1a')],'sectionId':_0x3ebef1['id']},{})[_0x7df8('0x14')](function(){return _0x31f646;});}else{return _0x31f646;}})[_0x7df8('0x32')](function(_0x112b61){logger[_0x7df8('0x18')](_0x7df8('0x3a'),_0x112b61);throw _0x112b61;});}return _0x31f646;})[_0x7df8('0x14')](respondWithResult(_0x591239,0xc9))[_0x7df8('0x32')](handleError(_0x591239,null));};exports[_0x7df8('0x13')]=function(_0xda559f,_0x2c33e7){if(_0xda559f['body']['id']){delete _0xda559f[_0x7df8('0x34')]['id'];}return db['ChatQueue'][_0x7df8('0x31')]({'where':{'id':_0xda559f['params']['id']}})['then'](handleEntityNotFound(_0x2c33e7,null))[_0x7df8('0x14')](saveUpdates(_0xda559f['body'],null))['then'](respondWithResult(_0x2c33e7,null))[_0x7df8('0x32')](handleError(_0x2c33e7,null));};exports['destroy']=function(_0x210191,_0x416555){return db['ChatQueue'][_0x7df8('0x31')]({'where':{'id':_0x210191[_0x7df8('0x26')]['id']}})[_0x7df8('0x14')](handleEntityNotFound(_0x416555,null))['then'](removeEntity(_0x416555,null))[_0x7df8('0x32')](handleError(_0x416555,null));};exports[_0x7df8('0x3b')]=function(_0x1ac2e0,_0x78f40f){return db[_0x7df8('0x1d')][_0x7df8('0x3b')]()[_0x7df8('0x14')](respondWithResult(_0x78f40f,null))['catch'](handleError(_0x78f40f,null));};exports[_0x7df8('0x3c')]=function(_0x4a474f,_0x31f8e7){var _0x4ff4b4={'raw':!![],'where':{}},_0x1f3552={},_0x46bb4e;return db[_0x7df8('0x1d')][_0x7df8('0x3d')]({'where':{'id':_0x4a474f[_0x7df8('0x26')]['id']}})['then'](handleEntityNotFound(_0x31f8e7,null))[_0x7df8('0x14')](function(_0x1b9537){if(_0x1b9537){_0x46bb4e=_0x1b9537['get']({'plain':!![]});_0x1f3552['model']=_[_0x7df8('0x28')](db[_0x7df8('0x3e')][_0x7df8('0x1e')]);_0x1f3552[_0x7df8('0x24')]=_['keys'](_0x4a474f[_0x7df8('0x24')]);_0x1f3552[_0x7df8('0x29')]=_[_0x7df8('0x2a')](_0x1f3552[_0x7df8('0x27')],_0x1f3552[_0x7df8('0x24')]);_0x4ff4b4[_0x7df8('0x2c')]=_[_0x7df8('0x2a')](_0x1f3552[_0x7df8('0x27')],qs['fields'](_0x4a474f['query']['fields']));_0x4ff4b4['attributes']=_0x4ff4b4[_0x7df8('0x2c')][_0x7df8('0x2d')]?_0x4ff4b4[_0x7df8('0x2c')]:_0x1f3552['model'];if(!_0x4a474f[_0x7df8('0x24')]['hasOwnProperty'](_0x7df8('0x3f'))){_0x4ff4b4[_0x7df8('0xf')]=qs[_0x7df8('0xf')](_0x4a474f[_0x7df8('0x24')][_0x7df8('0xf')]);_0x4ff4b4['offset']=qs[_0x7df8('0xd')](_0x4a474f[_0x7df8('0x24')][_0x7df8('0xd')]);}_0x4ff4b4[_0x7df8('0x40')]=qs[_0x7df8('0x41')](_0x4a474f[_0x7df8('0x24')][_0x7df8('0x41')]);_0x4ff4b4[_0x7df8('0x22')]=qs['filters'](_[_0x7df8('0x42')](_0x4a474f[_0x7df8('0x24')],_0x1f3552['filters']));_0x4ff4b4[_0x7df8('0x22')][_0x7df8('0x43')]=_0x1b9537['id'];if(_0x4a474f[_0x7df8('0x24')]['filter']){_0x4ff4b4['where']=_['merge'](_0x4ff4b4[_0x7df8('0x22')],{'$or':_[_0x7df8('0x1c')](_0x4ff4b4[_0x7df8('0x2c')],function(_0x34e9df){var _0x57548f={};_0x57548f[_0x34e9df]={'$like':'%'+_0x4a474f[_0x7df8('0x24')][_0x7df8('0x44')]+'%'};return _0x57548f;})});}_0x4ff4b4=_[_0x7df8('0x2f')]({},_0x4ff4b4,_0x4a474f['options']);return db['UserChatQueue']['findAll'](_0x4ff4b4);}})[_0x7df8('0x14')](function(_0x920684){if(_0x920684){return db[_0x7df8('0x45')][_0x7df8('0x46')]({'where':{'id':_[_0x7df8('0x1c')](_0x920684,_0x7df8('0x47')),'role':_0x7df8('0x48')},'attributes':['id','name',_0x7df8('0x49'),_0x7df8('0x4a'),_0x7df8('0x4b')]});}})['then'](function(_0x1ed50e){if(_0x1ed50e){return{'count':_0x1ed50e['count'],'rows':_[_0x7df8('0x1c')](_0x1ed50e[_0x7df8('0x4c')],function(_0x11817f){return{'membername':_0x11817f['name'],'UserId':_0x11817f['id'],'queue_name':_0x46bb4e[_0x7df8('0x1a')],'ChatQueueId':_0x46bb4e['id'],'interface':util[_0x7df8('0x4d')](_0x7df8('0x4e'),_0x7df8('0x4f'),_0x11817f['name']),'penalty':0x0,'paused':_0x11817f[_0x7df8('0x49')],'createdAt':_0x11817f[_0x7df8('0x4b')],'updatedAt':_0x11817f[_0x7df8('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x31f8e7,_0x4ff4b4))[_0x7df8('0x32')](handleError(_0x31f8e7,null));};exports[_0x7df8('0x50')]=function(_0x43c0a2,_0x59ea15){var _0x14b7c4={};var _0x5c7cde={};var _0x27d30a;var _0x1b0167;return db[_0x7df8('0x1d')]['findOne']({'where':{'id':_0x43c0a2['params']['id']}})[_0x7df8('0x14')](handleEntityNotFound(_0x59ea15,null))['then'](function(_0x1af887){if(_0x1af887){_0x27d30a=_0x1af887;_0x5c7cde[_0x7df8('0x27')]=_[_0x7df8('0x28')](db[_0x7df8('0x51')][_0x7df8('0x1e')]);_0x5c7cde[_0x7df8('0x24')]=_[_0x7df8('0x28')](_0x43c0a2[_0x7df8('0x24')]);_0x5c7cde[_0x7df8('0x29')]=_[_0x7df8('0x2a')](_0x5c7cde[_0x7df8('0x27')],_0x5c7cde['query']);_0x14b7c4['attributes']=_[_0x7df8('0x2a')](_0x5c7cde[_0x7df8('0x27')],qs[_0x7df8('0x2b')](_0x43c0a2[_0x7df8('0x24')][_0x7df8('0x2b')]));_0x14b7c4['attributes']=_0x14b7c4[_0x7df8('0x2c')][_0x7df8('0x2d')]?_0x14b7c4[_0x7df8('0x2c')]:_0x5c7cde['model'];_0x14b7c4[_0x7df8('0x40')]=qs[_0x7df8('0x41')](_0x43c0a2[_0x7df8('0x24')][_0x7df8('0x41')]);_0x14b7c4[_0x7df8('0x22')]=qs[_0x7df8('0x29')](_[_0x7df8('0x42')](_0x43c0a2[_0x7df8('0x24')],_0x5c7cde[_0x7df8('0x29')]));if(_0x43c0a2[_0x7df8('0x24')][_0x7df8('0x44')]){_0x14b7c4[_0x7df8('0x22')]=_[_0x7df8('0x2f')](_0x14b7c4[_0x7df8('0x22')],{'$or':_[_0x7df8('0x1c')](_0x14b7c4[_0x7df8('0x2c')],function(_0x5a2b39){var _0x263229={};_0x263229[_0x5a2b39]={'$like':'%'+_0x43c0a2['query'][_0x7df8('0x44')]+'%'};return _0x263229;})});}_0x14b7c4=_[_0x7df8('0x2f')]({},_0x14b7c4,_0x43c0a2[_0x7df8('0x30')]);return _0x27d30a[_0x7df8('0x50')](_0x14b7c4);}})[_0x7df8('0x14')](function(_0x4d9cbb){if(_0x4d9cbb){_0x1b0167=_0x4d9cbb[_0x7df8('0x2d')];if(!_0x43c0a2['query']['hasOwnProperty'](_0x7df8('0x3f'))){_0x14b7c4[_0x7df8('0xf')]=qs['limit'](_0x43c0a2['query']['limit']);_0x14b7c4[_0x7df8('0xd')]=qs[_0x7df8('0xd')](_0x43c0a2['query']['offset']);}return _0x27d30a[_0x7df8('0x50')](_0x14b7c4);}})[_0x7df8('0x14')](function(_0x1cda61){if(_0x1cda61){return _0x1cda61?{'count':_0x1b0167,'rows':_0x1cda61}:null;}})['then'](respondWithResult(_0x59ea15,null))[_0x7df8('0x32')](handleError(_0x59ea15,null));};exports[_0x7df8('0x52')]=function(_0x55925d,_0x1258cd){var _0x4eb59f=_0x55925d[_0x7df8('0x34')][_0x7df8('0x53')];return db[_0x7df8('0x51')][_0x7df8('0x25')]({'where':{'id':_0x4eb59f},'attributes':['id'],'include':[{'model':db[_0x7df8('0x45')],'as':'Agents','attributes':['id',_0x7df8('0x1a'),_0x7df8('0x54'),_0x7df8('0x55'),'interface'],'raw':!![]}]})[_0x7df8('0x14')](function(_0x42ce0b){if(_0x42ce0b){var _0xa2c350=_['flatMap'](_0x42ce0b,function(_0x1bfa3c){var _0x321538=_0x1bfa3c[_0x7df8('0x36')]({'plain':!![]});return _0x321538[_0x7df8('0x56')];});return db['ChatQueue']['find']({'where':{'id':_0x55925d['params']['id']}})[_0x7df8('0x14')](function(_0x430293){return db['sequelize'][_0x7df8('0x57')](function(_0x38a856){return _0x430293[_0x7df8('0x52')](_0x4eb59f,{'transaction':_0x38a856})['then'](function(){return BPromise['each'](_0xa2c350,function(_0xe528d){return db[_0x7df8('0x3e')][_0x7df8('0x58')]({'where':{'UserId':_0xe528d['id'],'ChatQueueId':_0x55925d[_0x7df8('0x26')]['id']},'transaction':_0x38a856});});})[_0x7df8('0x14')](function(){_0xa2c350[_0x7df8('0x59')](function(_0x3627f2){socket[_0x7df8('0x5a')](_0x7df8('0x5b'),{'UserId':_0x3627f2['id'],'ChatQueueId':_0x430293['id']});});});});});}})[_0x7df8('0x14')](respondWithStatusCode(_0x1258cd,null))[_0x7df8('0x32')](handleError(_0x1258cd,null));};exports[_0x7df8('0x5c')]=function(_0x357cc2,_0x34a8d3){return db[_0x7df8('0x51')][_0x7df8('0x25')]({'where':{'id':_0x357cc2[_0x7df8('0x24')][_0x7df8('0x53')]},'attributes':['id'],'include':[{'model':db[_0x7df8('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7df8('0x14')](handleEntityNotFound(_0x34a8d3,null))[_0x7df8('0x14')](function(_0xd65835){var _0x3fc871=_['map'](_0xd65835,'id');var _0x3742ed=[];var _0x47bfdb=[];var _0x4accc5=squel[_0x7df8('0x5d')]();_0x4accc5[_0x7df8('0x5e')](_0x7df8('0x5f'))[_0x7df8('0x60')](_0x7df8('0x61'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7df8('0x22')](_0x7df8('0x62'),_0x357cc2[_0x7df8('0x26')]['id']);for(var _0x11f13f=0x0;_0x11f13f<_0xd65835[_0x7df8('0x2d')];_0x11f13f+=0x1){let _0x5270a8=_0xd65835[_0x11f13f];for(var _0x1667d9=0x0;_0x1667d9<_0x5270a8[_0x7df8('0x56')][_0x7df8('0x2d')];_0x1667d9+=0x1){let _0xd6dc75=_0x5270a8[_0x7df8('0x56')][_0x1667d9];var _0x55bca0=_0x4accc5[_0x7df8('0x63')]();_0x55bca0[_0x7df8('0x22')](_0x7df8('0x64'),_0xd6dc75['id']);_0x47bfdb[_0x7df8('0x65')](db[_0x7df8('0x66')][_0x7df8('0x24')](_0x55bca0['toString'](),{'type':db[_0x7df8('0x66')][_0x7df8('0x67')][_0x7df8('0x68')]})[_0x7df8('0x14')](function(_0x518a6c){if(_0x518a6c['length']===0x1){return _0xd6dc75['id'];}else{var _0x2a8a51=_['every'](_[_0x7df8('0x1c')](_0x518a6c,_0x7df8('0x69')),function(_0x8cddbb){return _[_0x7df8('0x6a')](_0x3fc871,_0x8cddbb);});if(_0x2a8a51){return _0xd6dc75['id'];}}}));}}return BPromise['all'](_0x47bfdb)[_0x7df8('0x14')](function(_0x1480db){_0x3742ed=_(_0x3742ed)[_0x7df8('0x6b')](_0x1480db)[_0x7df8('0x6c')]()[_0x7df8('0x6d')]();return db[_0x7df8('0x1d')][_0x7df8('0x31')]({'where':{'id':_0x357cc2[_0x7df8('0x26')]['id']}})['then'](function(_0x29d406){return db[_0x7df8('0x66')]['transaction'](function(_0x15d3c7){return _0x29d406['removeTeams'](_0x357cc2[_0x7df8('0x24')][_0x7df8('0x53')],{'transaction':_0x15d3c7})[_0x7df8('0x14')](function(){if(!_[_0x7df8('0x6e')](_0x3742ed)){return _0x29d406['removeAgents'](_0x3742ed,{'transaction':_0x15d3c7});}})[_0x7df8('0x14')](function(){_0x3742ed[_0x7df8('0x59')](function(_0x2f5e29){socket[_0x7df8('0x5a')](_0x7df8('0x6f'),{'UserId':_0x2f5e29,'ChatQueueId':_0x29d406['id']});});});});});});})[_0x7df8('0x14')](respondWithStatusCode(_0x34a8d3,null))['catch'](handleError(_0x34a8d3,null));};exports[_0x7df8('0x70')]=function(_0x2fe050,_0x3c422){return db[_0x7df8('0x1d')][_0x7df8('0x31')]({'where':{'id':_0x2fe050[_0x7df8('0x26')]['id']}})[_0x7df8('0x14')](handleEntityNotFound(_0x3c422,null))['then'](function(_0x26da58){if(_0x26da58){return _0x26da58[_0x7df8('0x70')](_0x2fe050['body']['ids'],_[_0x7df8('0x71')](_0x2fe050[_0x7df8('0x34')],[_0x7df8('0x53'),'id'])||{})[_0x7df8('0x72')](function(_0x1420ec){for(var _0x28d831=0x0;_0x28d831<_0x2fe050['body']['ids']['length'];_0x28d831+=0x1){socket[_0x7df8('0x5a')]('userChatQueue:save',{'UserId':Number(_0x2fe050[_0x7df8('0x34')][_0x7df8('0x53')][_0x28d831]),'ChatQueueId':Number(_0x2fe050[_0x7df8('0x26')]['id'])});}return _0x1420ec;});}})[_0x7df8('0x14')](respondWithResult(_0x3c422,null))[_0x7df8('0x32')](handleError(_0x3c422,null));};exports[_0x7df8('0x73')]=function(_0x293998,_0x1e2375){return db[_0x7df8('0x1d')]['find']({'where':{'id':_0x293998[_0x7df8('0x26')]['id']}})[_0x7df8('0x14')](handleEntityNotFound(_0x1e2375,null))[_0x7df8('0x14')](function(_0x423dc4){if(_0x423dc4){return _0x423dc4[_0x7df8('0x73')](_0x293998[_0x7df8('0x24')][_0x7df8('0x53')])[_0x7df8('0x14')](function(){if(_[_0x7df8('0x74')](_0x293998[_0x7df8('0x24')][_0x7df8('0x53')])){for(var _0x1127ae=0x0;_0x1127ae<_0x293998[_0x7df8('0x24')][_0x7df8('0x53')][_0x7df8('0x2d')];_0x1127ae+=0x1){socket[_0x7df8('0x5a')]('userChatQueue:remove',{'UserId':Number(_0x293998[_0x7df8('0x24')][_0x7df8('0x53')][_0x1127ae]),'ChatQueueId':Number(_0x293998[_0x7df8('0x26')]['id'])});}}else{socket[_0x7df8('0x5a')](_0x7df8('0x6f'),{'UserId':Number(_0x293998[_0x7df8('0x24')][_0x7df8('0x53')]),'ChatQueueId':Number(_0x293998['params']['id'])});}});}})[_0x7df8('0x14')](respondWithStatusCode(_0x1e2375,null))['catch'](handleError(_0x1e2375,null));};exports[_0x7df8('0x75')]=function(_0xd3a60f,_0xd826de){var _0x3292ba={};var _0xba95={};var _0x505904;var _0x13e8a6;return db[_0x7df8('0x1d')][_0x7df8('0x3d')]({'where':{'id':_0xd3a60f[_0x7df8('0x26')]['id']}})[_0x7df8('0x14')](handleEntityNotFound(_0xd826de,null))[_0x7df8('0x14')](function(_0x247615){if(_0x247615){_0x505904=_0x247615;_0xba95[_0x7df8('0x27')]=_[_0x7df8('0x28')](db[_0x7df8('0x45')][_0x7df8('0x1e')]);_0xba95[_0x7df8('0x24')]=_[_0x7df8('0x28')](_0xd3a60f['query']);_0xba95['filters']=_[_0x7df8('0x2a')](_0xba95[_0x7df8('0x27')],_0xba95[_0x7df8('0x24')]);_0x3292ba[_0x7df8('0x2c')]=_[_0x7df8('0x2a')](_0xba95[_0x7df8('0x27')],qs[_0x7df8('0x2b')](_0xd3a60f[_0x7df8('0x24')][_0x7df8('0x2b')]));_0x3292ba[_0x7df8('0x2c')]=_0x3292ba[_0x7df8('0x2c')][_0x7df8('0x2d')]?_0x3292ba[_0x7df8('0x2c')]:_0xba95['model'];_0x3292ba['order']=qs['sort'](_0xd3a60f[_0x7df8('0x24')][_0x7df8('0x41')]);_0x3292ba[_0x7df8('0x22')]=qs[_0x7df8('0x29')](_[_0x7df8('0x42')](_0xd3a60f[_0x7df8('0x24')],_0xba95['filters']));if(_0xd3a60f[_0x7df8('0x24')][_0x7df8('0x44')]){_0x3292ba[_0x7df8('0x22')]=_['merge'](_0x3292ba[_0x7df8('0x22')],{'$or':_[_0x7df8('0x1c')](_0x3292ba[_0x7df8('0x2c')],function(_0x51efbe){var _0x4be41a={};_0x4be41a[_0x51efbe]={'$like':'%'+_0xd3a60f[_0x7df8('0x24')][_0x7df8('0x44')]+'%'};return _0x4be41a;})});}_0x3292ba=_[_0x7df8('0x2f')]({},_0x3292ba,_0xd3a60f[_0x7df8('0x30')]);return _0x505904[_0x7df8('0x75')](_0x3292ba);}})['then'](function(_0x363357){if(_0x363357){_0x13e8a6=_0x363357[_0x7df8('0x2d')];if(!_0xd3a60f['query'][_0x7df8('0x76')](_0x7df8('0x3f'))){_0x3292ba['limit']=qs[_0x7df8('0xf')](_0xd3a60f['query'][_0x7df8('0xf')]);_0x3292ba[_0x7df8('0xd')]=qs[_0x7df8('0xd')](_0xd3a60f[_0x7df8('0x24')][_0x7df8('0xd')]);}return _0x505904[_0x7df8('0x75')](_0x3292ba);}})[_0x7df8('0x14')](function(_0x1144e3){if(_0x1144e3){return _0x1144e3?{'count':_0x13e8a6,'rows':_0x1144e3}:null;}})['then'](respondWithResult(_0xd826de,null))['catch'](handleError(_0xd826de,null));}; \ No newline at end of file +var _0x33a2=['omit','spread','userChatQueue:save','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','update','destroy','get','ChatQueues','then','stack','name','send','index','ChatQueue','rawAttributes','type','key','getOptions','include','findAll','catch','params','model','keys','query','attributes','intersection','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','filters','length','nolimit','order','sort','where','ChatQueueId','filter','map','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','hasOwnProperty','addTeams','Agents','online','voicePause','interface','sequelize','each','forEach','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','all','union','compact','transaction','ids','removeAgents','userChatQueue:remove','addAgents'];(function(_0x43ef4b,_0x569b0a){var _0x28ae23=function(_0x251c53){while(--_0x251c53){_0x43ef4b['push'](_0x43ef4b['shift']());}};_0x28ae23(++_0x569b0a);}(_0x33a2,0x173));var _0x233a=function(_0x3a082e,_0x3765a2){_0x3a082e=_0x3a082e-0x0;var _0x3534bf=_0x33a2[_0x3a082e];return _0x3534bf;};'use strict';var BPromise=require(_0x233a('0x0'));var util=require('util');var _=require(_0x233a('0x1'));var squel=require(_0x233a('0x2'));var Redis=require(_0x233a('0x3'));var qs=require(_0x233a('0x4'));var logger=require(_0x233a('0x5'))('api');var config=require('../../config/environment');var db=require(_0x233a('0x6'))['db'];config[_0x233a('0x7')]=_[_0x233a('0x8')](config['redis'],{'host':_0x233a('0x9'),'port':0x18eb});var socket=require(_0x233a('0xa'))(new Redis(config[_0x233a('0x7')]));require(_0x233a('0xb'))[_0x233a('0xc')](socket);function respondWithStatusCode(_0x2f92d5,_0x396241){_0x396241=_0x396241||0xcc;return function(_0x3cb13c){if(_0x3cb13c){return _0x2f92d5[_0x233a('0xd')](_0x396241);}return _0x2f92d5['status'](_0x396241)[_0x233a('0xe')]();};}function respondWithResult(_0x3ee3a7,_0x1e9073){_0x1e9073=_0x1e9073||0xc8;return function(_0xf8832d){if(_0xf8832d){return _0x3ee3a7[_0x233a('0xf')](_0x1e9073)[_0x233a('0x10')](_0xf8832d);}};}function respondWithFilteredResult(_0x566ec4,_0x40daec){return function(_0x2b5e4c){if(_0x2b5e4c){var _0x41a578=typeof _0x40daec[_0x233a('0x11')]==='undefined'&&typeof _0x40daec[_0x233a('0x12')]==='undefined';var _0x441b5c=_0x2b5e4c[_0x233a('0x13')];var _0x4f3de2=_0x41a578?0x0:_0x40daec[_0x233a('0x11')];var _0x22e129=_0x41a578?_0x2b5e4c['count']:_0x40daec[_0x233a('0x11')]+_0x40daec['limit'];var _0x58a0c7;if(_0x22e129>=_0x441b5c){_0x22e129=_0x441b5c;_0x58a0c7=0xc8;}else{_0x58a0c7=0xce;}_0x566ec4[_0x233a('0xf')](_0x58a0c7);return _0x566ec4[_0x233a('0x14')](_0x233a('0x15'),_0x4f3de2+'-'+_0x22e129+'/'+_0x441b5c)[_0x233a('0x10')](_0x2b5e4c);}return null;};}function saveUpdates(_0x342f8e){return function(_0x254997){if(_0x254997){return _0x254997[_0x233a('0x16')](_0x342f8e)['then'](function(_0x32ebbc){return _0x32ebbc;});}return null;};}function removeEntity(_0x52a58b){return function(_0x1ce55f){if(_0x1ce55f){return _0x1ce55f[_0x233a('0x17')]()['then'](function(){var _0x13b34a=_0x1ce55f[_0x233a('0x18')]({'plain':!![]});var _0x335e5c=_0x233a('0x19');return db['UserProfileResource'][_0x233a('0x17')]({'where':{'type':_0x335e5c,'resourceId':_0x13b34a['id']}})[_0x233a('0x1a')](function(){return _0x1ce55f;});})[_0x233a('0x1a')](function(){_0x52a58b['status'](0xcc)[_0x233a('0xe')]();});}};}function handleEntityNotFound(_0x1412d2){return function(_0x4b0b7e){if(!_0x4b0b7e){_0x1412d2[_0x233a('0xd')](0x194);}return _0x4b0b7e;};}function handleError(_0x4b0487,_0x155592){_0x155592=_0x155592||0x1f4;return function(_0x34c5fe){logger['error'](_0x34c5fe[_0x233a('0x1b')]);if(_0x34c5fe[_0x233a('0x1c')]){delete _0x34c5fe['name'];}_0x4b0487[_0x233a('0xf')](_0x155592)[_0x233a('0x1d')](_0x34c5fe);};}exports[_0x233a('0x1e')]=function(_0x23b0b5,_0x522b78){var _0x1e0c93={};var _0x2cad85={'count':0x0,'rows':[]};var _0x68f489=_['map'](db[_0x233a('0x1f')][_0x233a('0x20')],function(_0x390501){return{'name':_0x390501['fieldName'],'type':_0x390501[_0x233a('0x21')][_0x233a('0x22')]};});_0x1e0c93=qs[_0x233a('0x23')](_0x68f489,_0x23b0b5);var _0x40178d={'where':_0x1e0c93['where']};return db['ChatQueue'][_0x233a('0x13')](_0x40178d)[_0x233a('0x1a')](function(_0x4d55e4){_0x2cad85[_0x233a('0x13')]=_0x4d55e4;_0x1e0c93[_0x233a('0x24')]=qs['include'](_0x23b0b5['query']);return db[_0x233a('0x1f')][_0x233a('0x25')](_0x1e0c93);})[_0x233a('0x1a')](function(_0x2aefa3){_0x2cad85['rows']=_0x2aefa3;return _0x2cad85;})[_0x233a('0x1a')](respondWithFilteredResult(_0x522b78,_0x1e0c93))[_0x233a('0x26')](handleError(_0x522b78,null));};exports['show']=function(_0x5a41d1,_0x16ee18){var _0xf2d68f={'raw':!![],'where':{'id':_0x5a41d1[_0x233a('0x27')]['id']}},_0x356d2f={};_0x356d2f[_0x233a('0x28')]=_['keys'](db[_0x233a('0x1f')]['rawAttributes']);_0x356d2f['query']=_[_0x233a('0x29')](_0x5a41d1['query']);_0x356d2f['filters']=_['intersection'](_0x356d2f['model'],_0x356d2f[_0x233a('0x2a')]);_0xf2d68f[_0x233a('0x2b')]=_[_0x233a('0x2c')](_0x356d2f[_0x233a('0x28')],qs[_0x233a('0x2d')](_0x5a41d1[_0x233a('0x2a')]['fields']));_0xf2d68f[_0x233a('0x2b')]=_0xf2d68f['attributes']['length']?_0xf2d68f[_0x233a('0x2b')]:_0x356d2f[_0x233a('0x28')];if(_0x5a41d1[_0x233a('0x2a')][_0x233a('0x2e')]){_0xf2d68f['include']=[{'all':!![]}];}_0xf2d68f=_['merge']({},_0xf2d68f,_0x5a41d1[_0x233a('0x2f')]);return db[_0x233a('0x1f')]['find'](_0xf2d68f)[_0x233a('0x1a')](handleEntityNotFound(_0x16ee18,null))[_0x233a('0x1a')](respondWithResult(_0x16ee18,null))[_0x233a('0x26')](handleError(_0x16ee18,null));};exports[_0x233a('0x30')]=function(_0x1ebc8f,_0x17bd0e){return db[_0x233a('0x1f')][_0x233a('0x30')](_0x1ebc8f[_0x233a('0x31')],{})[_0x233a('0x1a')](function(_0x78f957){var _0x3f407f=_0x1ebc8f[_0x233a('0x32')][_0x233a('0x18')]({'plain':!![]});if(!_0x3f407f)throw new Error(_0x233a('0x33'));if(_0x3f407f[_0x233a('0x34')]===_0x233a('0x32')){var _0x1b79d7=_0x78f957[_0x233a('0x18')]({'plain':!![]});var _0x34130a=_0x233a('0x19');return db[_0x233a('0x35')][_0x233a('0x36')]({'where':{'name':_0x34130a,'userProfileId':_0x3f407f['userProfileId']},'raw':!![]})[_0x233a('0x1a')](function(_0x2e21d8){if(_0x2e21d8&&_0x2e21d8[_0x233a('0x37')]===0x0){return db[_0x233a('0x38')][_0x233a('0x30')]({'name':_0x1b79d7[_0x233a('0x1c')],'resourceId':_0x1b79d7['id'],'type':_0x2e21d8[_0x233a('0x1c')],'sectionId':_0x2e21d8['id']},{})[_0x233a('0x1a')](function(){return _0x78f957;});}else{return _0x78f957;}})[_0x233a('0x26')](function(_0x113a4c){logger[_0x233a('0x39')](_0x233a('0x3a'),_0x113a4c);throw _0x113a4c;});}return _0x78f957;})['then'](respondWithResult(_0x17bd0e,0xc9))[_0x233a('0x26')](handleError(_0x17bd0e,null));};exports[_0x233a('0x16')]=function(_0x508dba,_0x344dbd){if(_0x508dba[_0x233a('0x31')]['id']){delete _0x508dba[_0x233a('0x31')]['id'];}return db['ChatQueue'][_0x233a('0x36')]({'where':{'id':_0x508dba[_0x233a('0x27')]['id']}})['then'](handleEntityNotFound(_0x344dbd,null))[_0x233a('0x1a')](saveUpdates(_0x508dba[_0x233a('0x31')],null))[_0x233a('0x1a')](respondWithResult(_0x344dbd,null))[_0x233a('0x26')](handleError(_0x344dbd,null));};exports[_0x233a('0x17')]=function(_0x3f1526,_0x2d918e){return db[_0x233a('0x1f')][_0x233a('0x36')]({'where':{'id':_0x3f1526[_0x233a('0x27')]['id']}})[_0x233a('0x1a')](handleEntityNotFound(_0x2d918e,null))[_0x233a('0x1a')](removeEntity(_0x2d918e,null))[_0x233a('0x26')](handleError(_0x2d918e,null));};exports[_0x233a('0x3b')]=function(_0x25e3a3,_0xd00a0a){return db['ChatQueue'][_0x233a('0x3b')]()[_0x233a('0x1a')](respondWithResult(_0xd00a0a,null))[_0x233a('0x26')](handleError(_0xd00a0a,null));};exports[_0x233a('0x3c')]=function(_0x130229,_0x11f547){var _0x4914ea={'raw':!![],'where':{}},_0x5233ab={},_0xaa15f0;return db[_0x233a('0x1f')][_0x233a('0x3d')]({'where':{'id':_0x130229['params']['id']}})['then'](handleEntityNotFound(_0x11f547,null))[_0x233a('0x1a')](function(_0x59085f){if(_0x59085f){_0xaa15f0=_0x59085f[_0x233a('0x18')]({'plain':!![]});_0x5233ab['model']=_['keys'](db[_0x233a('0x3e')]['rawAttributes']);_0x5233ab[_0x233a('0x2a')]=_[_0x233a('0x29')](_0x130229[_0x233a('0x2a')]);_0x5233ab[_0x233a('0x3f')]=_['intersection'](_0x5233ab[_0x233a('0x28')],_0x5233ab[_0x233a('0x2a')]);_0x4914ea[_0x233a('0x2b')]=_['intersection'](_0x5233ab['model'],qs[_0x233a('0x2d')](_0x130229['query'][_0x233a('0x2d')]));_0x4914ea[_0x233a('0x2b')]=_0x4914ea[_0x233a('0x2b')][_0x233a('0x40')]?_0x4914ea[_0x233a('0x2b')]:_0x5233ab[_0x233a('0x28')];if(!_0x130229[_0x233a('0x2a')]['hasOwnProperty'](_0x233a('0x41'))){_0x4914ea[_0x233a('0x12')]=qs[_0x233a('0x12')](_0x130229[_0x233a('0x2a')][_0x233a('0x12')]);_0x4914ea['offset']=qs[_0x233a('0x11')](_0x130229['query']['offset']);}_0x4914ea[_0x233a('0x42')]=qs[_0x233a('0x43')](_0x130229[_0x233a('0x2a')][_0x233a('0x43')]);_0x4914ea[_0x233a('0x44')]=qs['filters'](_['pick'](_0x130229[_0x233a('0x2a')],_0x5233ab[_0x233a('0x3f')]));_0x4914ea[_0x233a('0x44')][_0x233a('0x45')]=_0x59085f['id'];if(_0x130229[_0x233a('0x2a')][_0x233a('0x46')]){_0x4914ea['where']=_['merge'](_0x4914ea['where'],{'$or':_[_0x233a('0x47')](_0x4914ea[_0x233a('0x2b')],function(_0x213b81){var _0x34e275={};_0x34e275[_0x213b81]={'$like':'%'+_0x130229[_0x233a('0x2a')][_0x233a('0x46')]+'%'};return _0x34e275;})});}_0x4914ea=_[_0x233a('0x48')]({},_0x4914ea,_0x130229[_0x233a('0x2f')]);return db['UserChatQueue'][_0x233a('0x25')](_0x4914ea);}})[_0x233a('0x1a')](function(_0x38e170){if(_0x38e170){return db[_0x233a('0x49')][_0x233a('0x4a')]({'where':{'id':_[_0x233a('0x47')](_0x38e170,_0x233a('0x4b')),'role':_0x233a('0x4c')},'attributes':['id',_0x233a('0x1c'),_0x233a('0x4d'),_0x233a('0x4e'),_0x233a('0x4f')]});}})[_0x233a('0x1a')](function(_0x29b3d7){if(_0x29b3d7){return{'count':_0x29b3d7[_0x233a('0x13')],'rows':_[_0x233a('0x47')](_0x29b3d7[_0x233a('0x50')],function(_0x562503){return{'membername':_0x562503['name'],'UserId':_0x562503['id'],'queue_name':_0xaa15f0['name'],'ChatQueueId':_0xaa15f0['id'],'interface':util[_0x233a('0x51')](_0x233a('0x52'),_0x233a('0x53'),_0x562503[_0x233a('0x1c')]),'penalty':0x0,'paused':_0x562503[_0x233a('0x4d')],'createdAt':_0x562503[_0x233a('0x4f')],'updatedAt':_0x562503[_0x233a('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x233a('0x1a')](respondWithFilteredResult(_0x11f547,_0x4914ea))['catch'](handleError(_0x11f547,null));};exports[_0x233a('0x54')]=function(_0x49a642,_0x494690){var _0x43606a={};var _0x75af54={};var _0xd466ba;var _0x5ab8dd;return db[_0x233a('0x1f')][_0x233a('0x3d')]({'where':{'id':_0x49a642[_0x233a('0x27')]['id']}})[_0x233a('0x1a')](handleEntityNotFound(_0x494690,null))[_0x233a('0x1a')](function(_0x6c9cc8){if(_0x6c9cc8){_0xd466ba=_0x6c9cc8;_0x75af54[_0x233a('0x28')]=_['keys'](db[_0x233a('0x55')][_0x233a('0x20')]);_0x75af54[_0x233a('0x2a')]=_[_0x233a('0x29')](_0x49a642[_0x233a('0x2a')]);_0x75af54['filters']=_[_0x233a('0x2c')](_0x75af54[_0x233a('0x28')],_0x75af54[_0x233a('0x2a')]);_0x43606a[_0x233a('0x2b')]=_[_0x233a('0x2c')](_0x75af54['model'],qs[_0x233a('0x2d')](_0x49a642[_0x233a('0x2a')][_0x233a('0x2d')]));_0x43606a['attributes']=_0x43606a['attributes'][_0x233a('0x40')]?_0x43606a['attributes']:_0x75af54[_0x233a('0x28')];_0x43606a[_0x233a('0x42')]=qs['sort'](_0x49a642[_0x233a('0x2a')][_0x233a('0x43')]);_0x43606a[_0x233a('0x44')]=qs[_0x233a('0x3f')](_[_0x233a('0x56')](_0x49a642[_0x233a('0x2a')],_0x75af54['filters']));if(_0x49a642[_0x233a('0x2a')]['filter']){_0x43606a[_0x233a('0x44')]=_[_0x233a('0x48')](_0x43606a[_0x233a('0x44')],{'$or':_[_0x233a('0x47')](_0x43606a[_0x233a('0x2b')],function(_0x3af35f){var _0xeb4563={};_0xeb4563[_0x3af35f]={'$like':'%'+_0x49a642['query'][_0x233a('0x46')]+'%'};return _0xeb4563;})});}_0x43606a=_[_0x233a('0x48')]({},_0x43606a,_0x49a642['options']);return _0xd466ba['getTeams'](_0x43606a);}})[_0x233a('0x1a')](function(_0x2e90bf){if(_0x2e90bf){_0x5ab8dd=_0x2e90bf[_0x233a('0x40')];if(!_0x49a642[_0x233a('0x2a')][_0x233a('0x57')]('nolimit')){_0x43606a['limit']=qs[_0x233a('0x12')](_0x49a642[_0x233a('0x2a')][_0x233a('0x12')]);_0x43606a[_0x233a('0x11')]=qs[_0x233a('0x11')](_0x49a642[_0x233a('0x2a')]['offset']);}return _0xd466ba['getTeams'](_0x43606a);}})[_0x233a('0x1a')](function(_0x1e1485){if(_0x1e1485){return _0x1e1485?{'count':_0x5ab8dd,'rows':_0x1e1485}:null;}})['then'](respondWithResult(_0x494690,null))[_0x233a('0x26')](handleError(_0x494690,null));};exports[_0x233a('0x58')]=function(_0x3f8a27,_0x1eb986){var _0x49aac4=_0x3f8a27[_0x233a('0x31')]['ids'];return db['Team'][_0x233a('0x25')]({'where':{'id':_0x49aac4},'attributes':['id'],'include':[{'model':db[_0x233a('0x49')],'as':_0x233a('0x59'),'attributes':['id','name',_0x233a('0x5a'),_0x233a('0x5b'),_0x233a('0x5c')],'raw':!![]}]})[_0x233a('0x1a')](function(_0x4c9f26){if(_0x4c9f26){var _0x64bf07=_['flatMap'](_0x4c9f26,function(_0x2a1175){var _0x519fcc=_0x2a1175[_0x233a('0x18')]({'plain':!![]});return _0x519fcc[_0x233a('0x59')];});return db[_0x233a('0x1f')][_0x233a('0x36')]({'where':{'id':_0x3f8a27[_0x233a('0x27')]['id']}})[_0x233a('0x1a')](function(_0x5c8712){return db[_0x233a('0x5d')]['transaction'](function(_0x43c4ae){return _0x5c8712['addTeams'](_0x49aac4,{'transaction':_0x43c4ae})['then'](function(){return BPromise[_0x233a('0x5e')](_0x64bf07,function(_0x3168f8){return db[_0x233a('0x3e')]['findOrCreate']({'where':{'UserId':_0x3168f8['id'],'ChatQueueId':_0x3f8a27[_0x233a('0x27')]['id']},'transaction':_0x43c4ae});});})['then'](function(){_0x64bf07[_0x233a('0x5f')](function(_0x979550){socket[_0x233a('0x60')]('userChatQueue:save',{'UserId':_0x979550['id'],'ChatQueueId':_0x5c8712['id']});});});});});}})[_0x233a('0x1a')](respondWithStatusCode(_0x1eb986,null))[_0x233a('0x26')](handleError(_0x1eb986,null));};exports[_0x233a('0x61')]=function(_0x1362af,_0x2f89cb){return db['Team']['findAll']({'where':{'id':_0x1362af[_0x233a('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x233a('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x233a('0x1a')](handleEntityNotFound(_0x2f89cb,null))[_0x233a('0x1a')](function(_0x2ce352){var _0x5f2795=_[_0x233a('0x47')](_0x2ce352,'id');var _0xfbf044=[];var _0x142619=[];var _0x125c27=squel[_0x233a('0x62')]();_0x125c27['field'](_0x233a('0x63'))['from'](_0x233a('0x64'),'tq')['join'](_0x233a('0x65'),'ut',_0x233a('0x66'))['where'](_0x233a('0x67'),_0x1362af['params']['id']);for(var _0xa87266=0x0;_0xa87266<_0x2ce352[_0x233a('0x40')];_0xa87266+=0x1){let _0x237e63=_0x2ce352[_0xa87266];for(var _0x1b9577=0x0;_0x1b9577<_0x237e63[_0x233a('0x59')][_0x233a('0x40')];_0x1b9577+=0x1){let _0x5336dc=_0x237e63[_0x233a('0x59')][_0x1b9577];var _0x57f6d0=_0x125c27['clone']();_0x57f6d0[_0x233a('0x44')](_0x233a('0x68'),_0x5336dc['id']);_0x142619[_0x233a('0x69')](db['sequelize']['query'](_0x57f6d0[_0x233a('0x6a')](),{'type':db[_0x233a('0x5d')][_0x233a('0x6b')][_0x233a('0x6c')]})['then'](function(_0xc8b2c6){if(_0xc8b2c6['length']===0x1){return _0x5336dc['id'];}else{var _0x1809ff=_['every'](_[_0x233a('0x47')](_0xc8b2c6,'TeamId'),function(_0x1c490d){return _['includes'](_0x5f2795,_0x1c490d);});if(_0x1809ff){return _0x5336dc['id'];}}}));}}return BPromise[_0x233a('0x6d')](_0x142619)[_0x233a('0x1a')](function(_0x5928a1){_0xfbf044=_(_0xfbf044)[_0x233a('0x6e')](_0x5928a1)[_0x233a('0x6f')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x1362af[_0x233a('0x27')]['id']}})[_0x233a('0x1a')](function(_0x1c8c4f){return db['sequelize'][_0x233a('0x70')](function(_0x2c43d7){return _0x1c8c4f[_0x233a('0x61')](_0x1362af[_0x233a('0x2a')][_0x233a('0x71')],{'transaction':_0x2c43d7})[_0x233a('0x1a')](function(){if(!_['isEmpty'](_0xfbf044)){return _0x1c8c4f[_0x233a('0x72')](_0xfbf044,{'transaction':_0x2c43d7});}})[_0x233a('0x1a')](function(){_0xfbf044[_0x233a('0x5f')](function(_0x1b424f){socket[_0x233a('0x60')](_0x233a('0x73'),{'UserId':_0x1b424f,'ChatQueueId':_0x1c8c4f['id']});});});});});});})[_0x233a('0x1a')](respondWithStatusCode(_0x2f89cb,null))[_0x233a('0x26')](handleError(_0x2f89cb,null));};exports[_0x233a('0x74')]=function(_0x363569,_0x5299f0){return db[_0x233a('0x1f')]['find']({'where':{'id':_0x363569[_0x233a('0x27')]['id']}})['then'](handleEntityNotFound(_0x5299f0,null))[_0x233a('0x1a')](function(_0x1ba1e4){if(_0x1ba1e4){return _0x1ba1e4[_0x233a('0x74')](_0x363569[_0x233a('0x31')][_0x233a('0x71')],_[_0x233a('0x75')](_0x363569['body'],[_0x233a('0x71'),'id'])||{})[_0x233a('0x76')](function(_0x40cd01){for(var _0x296afc=0x0;_0x296afc<_0x363569['body'][_0x233a('0x71')][_0x233a('0x40')];_0x296afc+=0x1){socket['emit'](_0x233a('0x77'),{'UserId':Number(_0x363569[_0x233a('0x31')][_0x233a('0x71')][_0x296afc]),'ChatQueueId':Number(_0x363569[_0x233a('0x27')]['id'])});}return _0x40cd01;});}})[_0x233a('0x1a')](respondWithResult(_0x5299f0,null))['catch'](handleError(_0x5299f0,null));};exports[_0x233a('0x72')]=function(_0x373e00,_0x4232e5){return db['ChatQueue'][_0x233a('0x36')]({'where':{'id':_0x373e00['params']['id']}})[_0x233a('0x1a')](handleEntityNotFound(_0x4232e5,null))[_0x233a('0x1a')](function(_0x4dae1d){if(_0x4dae1d){return _0x4dae1d[_0x233a('0x72')](_0x373e00[_0x233a('0x2a')]['ids'])[_0x233a('0x1a')](function(){if(_[_0x233a('0x78')](_0x373e00[_0x233a('0x2a')][_0x233a('0x71')])){for(var _0x30d9c7=0x0;_0x30d9c7<_0x373e00['query'][_0x233a('0x71')]['length'];_0x30d9c7+=0x1){socket[_0x233a('0x60')](_0x233a('0x73'),{'UserId':Number(_0x373e00[_0x233a('0x2a')][_0x233a('0x71')][_0x30d9c7]),'ChatQueueId':Number(_0x373e00[_0x233a('0x27')]['id'])});}}else{socket[_0x233a('0x60')]('userChatQueue:remove',{'UserId':Number(_0x373e00[_0x233a('0x2a')]['ids']),'ChatQueueId':Number(_0x373e00['params']['id'])});}});}})[_0x233a('0x1a')](respondWithStatusCode(_0x4232e5,null))[_0x233a('0x26')](handleError(_0x4232e5,null));};exports['getAgents']=function(_0x4ef7d7,_0x3f1f52){var _0x1319fc={};var _0x3a566e={};var _0x802c3d;var _0x3cf310;return db[_0x233a('0x1f')][_0x233a('0x3d')]({'where':{'id':_0x4ef7d7[_0x233a('0x27')]['id']}})[_0x233a('0x1a')](handleEntityNotFound(_0x3f1f52,null))[_0x233a('0x1a')](function(_0x4e94f0){if(_0x4e94f0){_0x802c3d=_0x4e94f0;_0x3a566e[_0x233a('0x28')]=_['keys'](db[_0x233a('0x49')][_0x233a('0x20')]);_0x3a566e[_0x233a('0x2a')]=_[_0x233a('0x29')](_0x4ef7d7[_0x233a('0x2a')]);_0x3a566e['filters']=_[_0x233a('0x2c')](_0x3a566e[_0x233a('0x28')],_0x3a566e[_0x233a('0x2a')]);_0x1319fc['attributes']=_[_0x233a('0x2c')](_0x3a566e[_0x233a('0x28')],qs[_0x233a('0x2d')](_0x4ef7d7[_0x233a('0x2a')][_0x233a('0x2d')]));_0x1319fc['attributes']=_0x1319fc['attributes'][_0x233a('0x40')]?_0x1319fc['attributes']:_0x3a566e[_0x233a('0x28')];_0x1319fc['order']=qs[_0x233a('0x43')](_0x4ef7d7[_0x233a('0x2a')]['sort']);_0x1319fc[_0x233a('0x44')]=qs[_0x233a('0x3f')](_['pick'](_0x4ef7d7[_0x233a('0x2a')],_0x3a566e['filters']));if(_0x4ef7d7[_0x233a('0x2a')][_0x233a('0x46')]){_0x1319fc[_0x233a('0x44')]=_[_0x233a('0x48')](_0x1319fc[_0x233a('0x44')],{'$or':_[_0x233a('0x47')](_0x1319fc['attributes'],function(_0x135ede){var _0x319316={};_0x319316[_0x135ede]={'$like':'%'+_0x4ef7d7[_0x233a('0x2a')][_0x233a('0x46')]+'%'};return _0x319316;})});}_0x1319fc=_['merge']({},_0x1319fc,_0x4ef7d7[_0x233a('0x2f')]);return _0x802c3d[_0x233a('0x79')](_0x1319fc);}})['then'](function(_0x4ebeac){if(_0x4ebeac){_0x3cf310=_0x4ebeac[_0x233a('0x40')];if(!_0x4ef7d7[_0x233a('0x2a')][_0x233a('0x57')](_0x233a('0x41'))){_0x1319fc[_0x233a('0x12')]=qs[_0x233a('0x12')](_0x4ef7d7[_0x233a('0x2a')]['limit']);_0x1319fc[_0x233a('0x11')]=qs[_0x233a('0x11')](_0x4ef7d7['query'][_0x233a('0x11')]);}return _0x802c3d[_0x233a('0x79')](_0x1319fc);}})[_0x233a('0x1a')](function(_0x5ed767){if(_0x5ed767){return _0x5ed767?{'count':_0x3cf310,'rows':_0x5ed767}:null;}})[_0x233a('0x1a')](respondWithResult(_0x3f1f52,null))[_0x233a('0x26')](handleError(_0x3f1f52,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index afe1065..73fe276 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 _0xde84=['setMaxListeners','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x4427c9,_0xb06e1c){var _0x1efc85=function(_0x462fd0){while(--_0x462fd0){_0x4427c9['push'](_0x4427c9['shift']());}};_0x1efc85(++_0xb06e1c);}(_0xde84,0x84));var _0x4de8=function(_0x7162ba,_0x44d30f){_0x7162ba=_0x7162ba-0x0;var _0x6526a0=_0xde84[_0x7162ba];return _0x6526a0;};'use strict';var EventEmitter=require(_0x4de8('0x0'));var ChatQueue=require(_0x4de8('0x1'))['db'][_0x4de8('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4de8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4de8('0x4'),'afterDestroy':_0x4de8('0x5')};function emitEvent(_0x39edc0){return function(_0x1fb457,_0x400e18,_0x1de6cf){ChatQueueEvents['emit'](_0x39edc0+':'+_0x1fb457['id'],_0x1fb457);ChatQueueEvents['emit'](_0x39edc0,_0x1fb457);_0x1de6cf(null);};}for(var e in events){if(events[_0x4de8('0x6')](e)){var event=events[e];ChatQueue[_0x4de8('0x7')](e,emitEvent(event));}}module[_0x4de8('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x1f39=['ChatQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','events'];(function(_0x87fb9d,_0x2ba366){var _0x30dcf6=function(_0x21c9f9){while(--_0x21c9f9){_0x87fb9d['push'](_0x87fb9d['shift']());}};_0x30dcf6(++_0x2ba366);}(_0x1f39,0x1bf));var _0x91f3=function(_0x3186bc,_0x48adff){_0x3186bc=_0x3186bc-0x0;var _0x2c8114=_0x1f39[_0x3186bc];return _0x2c8114;};'use strict';var EventEmitter=require(_0x91f3('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x91f3('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x91f3('0x2')](0x0);var events={'afterCreate':_0x91f3('0x3'),'afterUpdate':_0x91f3('0x4'),'afterDestroy':_0x91f3('0x5')};function emitEvent(_0x59e5d9){return function(_0x1f1969,_0x7e7141,_0x49e6c0){ChatQueueEvents['emit'](_0x59e5d9+':'+_0x1f1969['id'],_0x1f1969);ChatQueueEvents['emit'](_0x59e5d9,_0x1f1969);_0x49e6c0(null);};}for(var e in events){if(events[_0x91f3('0x6')](e)){var event=events[e];ChatQueue[_0x91f3('0x7')](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 99b48cc..0e99fa5 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 _0xe98a=['exports','define','ChatQueue','chat_queues','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xe98a,0xb8));var _0xae98=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe98a[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0xae98('0x0'));var logger=require(_0xae98('0x1'))(_0xae98('0x2'));var moment=require('moment');var BPromise=require(_0xae98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae98('0x4'));var rimraf=require(_0xae98('0x5'));var config=require(_0xae98('0x6'));var attributes=require(_0xae98('0x7'));module[_0xae98('0x8')]=function(_0x54cd18,_0x2f2a07){return _0x54cd18[_0xae98('0x9')](_0xae98('0xa'),attributes,{'tableName':_0xae98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11fe=['moment','request-promise','path','rimraf','../../config/environment','define','lodash','../../config/logger','api'];(function(_0xbef031,_0x1426f6){var _0x1fc073=function(_0x3edeb1){while(--_0x3edeb1){_0xbef031['push'](_0xbef031['shift']());}};_0x1fc073(++_0x1426f6);}(_0x11fe,0x12f));var _0xe11f=function(_0x1c850d,_0x432c51){_0x1c850d=_0x1c850d-0x0;var _0x195dfe=_0x11fe[_0x1c850d];return _0x195dfe;};'use strict';var _=require(_0xe11f('0x0'));var util=require('util');var logger=require(_0xe11f('0x1'))(_0xe11f('0x2'));var moment=require(_0xe11f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe11f('0x4'));var fs=require('fs');var path=require(_0xe11f('0x5'));var rimraf=require(_0xe11f('0x6'));var config=require(_0xe11f('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x32797a,_0x317ebe){return _0x32797a[_0xe11f('0x8')]('ChatQueue',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 4abb097..23aafcd 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 _0x21f8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetChatQueue','findAll','options','where','attributes','model','include','map','ChatQueue','find','ShowChatQueue','lodash'];(function(_0x139485,_0x2d0aac){var _0x221cb9=function(_0x38b8de){while(--_0x38b8de){_0x139485['push'](_0x139485['shift']());}};_0x221cb9(++_0x2d0aac);}(_0x21f8,0x71));var _0x821f=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x21f8[_0x401d67];return _0x25076b;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var moment=require(_0x821f('0x2'));var BPromise=require(_0x821f('0x3'));var rs=require(_0x821f('0x4'));var fs=require('fs');var Redis=require(_0x821f('0x5'));var db=require(_0x821f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x821f('0x7'));var jayson=require(_0x821f('0x8'));var client=jayson[_0x821f('0x9')][_0x821f('0xa')]({'port':0x232a});config[_0x821f('0xb')]=_[_0x821f('0xc')](config[_0x821f('0xb')],{'host':_0x821f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x821f('0xe'))[_0x821f('0xf')](socket);function respondWithRpcPromise(_0x81e2f4,_0x53ce42,_0x387056){return new BPromise(function(_0x44e3f3,_0x101ae7){return client[_0x821f('0x10')](_0x81e2f4,_0x387056)[_0x821f('0x11')](function(_0x4590da){logger[_0x821f('0x12')](_0x821f('0x13'),_0x53ce42,_0x821f('0x14'));logger[_0x821f('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x53ce42,'request\x20sent',JSON[_0x821f('0x16')](_0x4590da));if(_0x4590da[_0x821f('0x17')]){if(_0x4590da[_0x821f('0x17')][_0x821f('0x18')]===0x1f4){logger[_0x821f('0x17')](_0x821f('0x13'),_0x53ce42,_0x4590da[_0x821f('0x17')][_0x821f('0x19')]);return _0x101ae7(_0x4590da[_0x821f('0x17')][_0x821f('0x19')]);}logger['error'](_0x821f('0x13'),_0x53ce42,_0x4590da['error'][_0x821f('0x19')]);return _0x44e3f3(_0x4590da['error'][_0x821f('0x19')]);}else{logger[_0x821f('0x12')](_0x821f('0x13'),_0x53ce42,_0x821f('0x14'));_0x44e3f3(_0x4590da['result'][_0x821f('0x19')]);}})[_0x821f('0x1a')](function(_0x499483){logger[_0x821f('0x17')]('ChatQueue,\x20%s,\x20%s',_0x53ce42,_0x499483);_0x101ae7(_0x499483);});});}exports[_0x821f('0x1b')]=function(_0x5cdfc7){var _0x3104e4=this;return new Promise(function(_0x2e7b8a,_0x4fbcf2){return db['ChatQueue'][_0x821f('0x1c')]({'raw':_0x5cdfc7[_0x821f('0x1d')]?_0x5cdfc7[_0x821f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5cdfc7[_0x821f('0x1d')]?_0x5cdfc7[_0x821f('0x1d')][_0x821f('0x1e')]||null:null,'attributes':_0x5cdfc7['options']?_0x5cdfc7[_0x821f('0x1d')][_0x821f('0x1f')]||null:null,'limit':_0x5cdfc7['options']?_0x5cdfc7['options']['limit']||null:null,'include':_0x5cdfc7['options']?_0x5cdfc7[_0x821f('0x1d')]['include']?_['map'](_0x5cdfc7[_0x821f('0x1d')]['include'],function(_0x57f5a2){return{'model':db[_0x57f5a2[_0x821f('0x20')]],'as':_0x57f5a2['as'],'attributes':_0x57f5a2[_0x821f('0x1f')],'include':_0x57f5a2[_0x821f('0x21')]?_[_0x821f('0x22')](_0x57f5a2['include'],function(_0xf6d94a){return{'model':db[_0xf6d94a[_0x821f('0x20')]],'as':_0xf6d94a['as'],'attributes':_0xf6d94a[_0x821f('0x1f')],'include':_0xf6d94a[_0x821f('0x21')]?_['map'](_0xf6d94a[_0x821f('0x21')],function(_0xac9ab1){return{'model':db[_0xac9ab1[_0x821f('0x20')]],'as':_0xac9ab1['as'],'attributes':_0xac9ab1[_0x821f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xceb073){logger['info']('GetChatQueue',_0x5cdfc7);logger[_0x821f('0x15')](_0x821f('0x1b'),_0x5cdfc7,JSON[_0x821f('0x16')](_0xceb073));_0x2e7b8a(_0xceb073);})[_0x821f('0x1a')](function(_0x122e56){logger['error'](_0x821f('0x1b'),_0x122e56[_0x821f('0x19')],_0x5cdfc7);_0x4fbcf2(_0x3104e4[_0x821f('0x17')](0x1f4,_0x122e56[_0x821f('0x19')]));});});};exports['ShowChatQueue']=function(_0x1eae9c){var _0x386faf=this;return new Promise(function(_0x163ed3,_0x15891b){return db[_0x821f('0x23')][_0x821f('0x24')]({'raw':_0x1eae9c['options']?_0x1eae9c[_0x821f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1eae9c[_0x821f('0x1d')]?_0x1eae9c[_0x821f('0x1d')]['where']||null:null,'attributes':_0x1eae9c['options']?_0x1eae9c[_0x821f('0x1d')][_0x821f('0x1f')]||null:null,'include':_0x1eae9c[_0x821f('0x1d')]?_0x1eae9c[_0x821f('0x1d')][_0x821f('0x21')]?_['map'](_0x1eae9c['options'][_0x821f('0x21')],function(_0x34f607){return{'model':db[_0x34f607[_0x821f('0x20')]],'as':_0x34f607['as'],'attributes':_0x34f607['attributes'],'include':_0x34f607[_0x821f('0x21')]?_[_0x821f('0x22')](_0x34f607[_0x821f('0x21')],function(_0x34bd2c){return{'model':db[_0x34bd2c[_0x821f('0x20')]],'as':_0x34bd2c['as'],'attributes':_0x34bd2c[_0x821f('0x1f')],'include':_0x34bd2c[_0x821f('0x21')]?_['map'](_0x34bd2c['include'],function(_0x432952){return{'model':db[_0x432952[_0x821f('0x20')]],'as':_0x432952['as'],'attributes':_0x432952[_0x821f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x821f('0x11')](function(_0x355d38){logger['info']('ShowChatQueue',_0x1eae9c);logger[_0x821f('0x15')](_0x821f('0x25'),_0x1eae9c,JSON[_0x821f('0x16')](_0x355d38));_0x163ed3(_0x355d38);})['catch'](function(_0x46bc50){logger[_0x821f('0x17')](_0x821f('0x25'),_0x46bc50['message'],_0x1eae9c);_0x15891b(_0x386faf[_0x821f('0x17')](0x1f4,_0x46bc50[_0x821f('0x19')]));});});}; \ No newline at end of file +var _0xc997=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','debug','ShowChatQueue','lodash'];(function(_0x582a91,_0x23707f){var _0x2a0466=function(_0x4d7614){while(--_0x4d7614){_0x582a91['push'](_0x582a91['shift']());}};_0x2a0466(++_0x23707f);}(_0xc997,0x1a1));var _0x7c99=function(_0x367a5a,_0x397554){_0x367a5a=_0x367a5a-0x0;var _0x300d7c=_0xc997[_0x367a5a];return _0x300d7c;};'use strict';var _=require(_0x7c99('0x0'));var util=require(_0x7c99('0x1'));var moment=require('moment');var BPromise=require(_0x7c99('0x2'));var rs=require(_0x7c99('0x3'));var fs=require('fs');var Redis=require(_0x7c99('0x4'));var db=require(_0x7c99('0x5'))['db'];var utils=require(_0x7c99('0x6'));var logger=require('../../config/logger')(_0x7c99('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c99('0x8'));var client=jayson['client'][_0x7c99('0x9')]({'port':0x232a});config[_0x7c99('0xa')]=_[_0x7c99('0xb')](config[_0x7c99('0xa')],{'host':_0x7c99('0xc'),'port':0x18eb});var socket=require(_0x7c99('0xd'))(new Redis(config[_0x7c99('0xa')]));require(_0x7c99('0xe'))[_0x7c99('0xf')](socket);function respondWithRpcPromise(_0x1abc9c,_0x2f471c,_0x188694){return new BPromise(function(_0x2de436,_0x22197c){return client[_0x7c99('0x10')](_0x1abc9c,_0x188694)[_0x7c99('0x11')](function(_0x107fb2){logger[_0x7c99('0x12')](_0x7c99('0x13'),_0x2f471c,_0x7c99('0x14'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2f471c,'request\x20sent',JSON[_0x7c99('0x15')](_0x107fb2));if(_0x107fb2['error']){if(_0x107fb2[_0x7c99('0x16')][_0x7c99('0x17')]===0x1f4){logger[_0x7c99('0x16')]('ChatQueue,\x20%s,\x20%s',_0x2f471c,_0x107fb2[_0x7c99('0x16')][_0x7c99('0x18')]);return _0x22197c(_0x107fb2['error'][_0x7c99('0x18')]);}logger[_0x7c99('0x16')](_0x7c99('0x13'),_0x2f471c,_0x107fb2[_0x7c99('0x16')][_0x7c99('0x18')]);return _0x2de436(_0x107fb2[_0x7c99('0x16')][_0x7c99('0x18')]);}else{logger[_0x7c99('0x12')](_0x7c99('0x13'),_0x2f471c,_0x7c99('0x14'));_0x2de436(_0x107fb2['result'][_0x7c99('0x18')]);}})[_0x7c99('0x19')](function(_0x234f5b){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2f471c,_0x234f5b);_0x22197c(_0x234f5b);});});}exports[_0x7c99('0x1a')]=function(_0x2a94f9){var _0xb14871=this;return new Promise(function(_0x445807,_0x45dc7e){return db[_0x7c99('0x1b')][_0x7c99('0x1c')]({'raw':_0x2a94f9['options']?_0x2a94f9[_0x7c99('0x1d')][_0x7c99('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a94f9['options']?_0x2a94f9[_0x7c99('0x1d')][_0x7c99('0x1f')]||null:null,'attributes':_0x2a94f9[_0x7c99('0x1d')]?_0x2a94f9[_0x7c99('0x1d')][_0x7c99('0x20')]||null:null,'limit':_0x2a94f9[_0x7c99('0x1d')]?_0x2a94f9[_0x7c99('0x1d')]['limit']||null:null,'include':_0x2a94f9[_0x7c99('0x1d')]?_0x2a94f9[_0x7c99('0x1d')][_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x2a94f9[_0x7c99('0x1d')][_0x7c99('0x21')],function(_0x1679ed){return{'model':db[_0x1679ed[_0x7c99('0x23')]],'as':_0x1679ed['as'],'attributes':_0x1679ed[_0x7c99('0x20')],'include':_0x1679ed[_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x1679ed[_0x7c99('0x21')],function(_0x5d6621){return{'model':db[_0x5d6621[_0x7c99('0x23')]],'as':_0x5d6621['as'],'attributes':_0x5d6621[_0x7c99('0x20')],'include':_0x5d6621[_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x5d6621['include'],function(_0x33b6da){return{'model':db[_0x33b6da[_0x7c99('0x23')]],'as':_0x33b6da['as'],'attributes':_0x33b6da[_0x7c99('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c99('0x11')](function(_0x5ed849){logger[_0x7c99('0x12')](_0x7c99('0x1a'),_0x2a94f9);logger[_0x7c99('0x24')](_0x7c99('0x1a'),_0x2a94f9,JSON[_0x7c99('0x15')](_0x5ed849));_0x445807(_0x5ed849);})[_0x7c99('0x19')](function(_0x5a9631){logger[_0x7c99('0x16')](_0x7c99('0x1a'),_0x5a9631['message'],_0x2a94f9);_0x45dc7e(_0xb14871[_0x7c99('0x16')](0x1f4,_0x5a9631[_0x7c99('0x18')]));});});};exports[_0x7c99('0x25')]=function(_0x2321ab){var _0xb38139=this;return new Promise(function(_0x2cd9b1,_0x5833ff){return db[_0x7c99('0x1b')]['find']({'raw':_0x2321ab[_0x7c99('0x1d')]?_0x2321ab[_0x7c99('0x1d')][_0x7c99('0x1e')]===undefined?!![]:![]:!![],'where':_0x2321ab['options']?_0x2321ab[_0x7c99('0x1d')]['where']||null:null,'attributes':_0x2321ab[_0x7c99('0x1d')]?_0x2321ab[_0x7c99('0x1d')][_0x7c99('0x20')]||null:null,'include':_0x2321ab[_0x7c99('0x1d')]?_0x2321ab[_0x7c99('0x1d')][_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x2321ab['options']['include'],function(_0x22e181){return{'model':db[_0x22e181[_0x7c99('0x23')]],'as':_0x22e181['as'],'attributes':_0x22e181['attributes'],'include':_0x22e181[_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x22e181[_0x7c99('0x21')],function(_0x2ba1dc){return{'model':db[_0x2ba1dc[_0x7c99('0x23')]],'as':_0x2ba1dc['as'],'attributes':_0x2ba1dc[_0x7c99('0x20')],'include':_0x2ba1dc[_0x7c99('0x21')]?_[_0x7c99('0x22')](_0x2ba1dc[_0x7c99('0x21')],function(_0x1250ce){return{'model':db[_0x1250ce[_0x7c99('0x23')]],'as':_0x1250ce['as'],'attributes':_0x1250ce[_0x7c99('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c99('0x11')](function(_0x4cd789){logger[_0x7c99('0x12')](_0x7c99('0x25'),_0x2321ab);logger[_0x7c99('0x24')](_0x7c99('0x25'),_0x2321ab,JSON[_0x7c99('0x15')](_0x4cd789));_0x2cd9b1(_0x4cd789);})[_0x7c99('0x19')](function(_0x215e89){logger[_0x7c99('0x16')]('ShowChatQueue',_0x215e89[_0x7c99('0x18')],_0x2321ab);_0x5833ff(_0xb38139['error'](0x1f4,_0x215e89[_0x7c99('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 83f21b8..4fe7f34 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 _0xb66c=['chatQueue:','./chatQueue.events','remove','removeListener','register','length'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xb66c,0x175));var _0xcb66=function(_0x2d198d,_0x4790ed){_0x2d198d=_0x2d198d-0x0;var _0x3674d4=_0xb66c[_0x2d198d];return _0x3674d4;};'use strict';var ChatQueueEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){ChatQueueEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);ChatQueueEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file +var _0xd13e=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xd13e,0x193));var _0xed13=function(_0x2933e4,_0x2957ce){_0x2933e4=_0x2933e4-0x0;var _0x42d77a=_0xd13e[_0x2933e4];return _0x42d77a;};'use strict';var ChatQueueEvents=require(_0xed13('0x0'));var events=[_0xed13('0x1'),_0xed13('0x2'),_0xed13('0x3')];function createListener(_0x50b476,_0x1a064e){return function(_0x5cdb65){_0x1a064e[_0xed13('0x4')](_0x50b476,_0x5cdb65);};}function removeListener(_0x59d4db,_0x46158d){return function(){ChatQueueEvents[_0xed13('0x5')](_0x59d4db,_0x46158d);};}exports['register']=function(_0x50de44){for(var _0x5142bd=0x0,_0x95ff4c=events[_0xed13('0x6')];_0x5142bd<_0x95ff4c;_0x5142bd++){var _0xab0fff=events[_0x5142bd];var _0x3b3984=createListener(_0xed13('0x7')+_0xab0fff,_0x50de44);ChatQueueEvents['on'](_0xab0fff,_0x3b3984);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2c1e11e..5669bde 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x21733f,_0x38b1f8){var _0x2e2952=function(_0x7c62a1){while(--_0x7c62a1){_0x21733f['push'](_0x21733f['shift']());}};_0x2e2952(++_0x38b1f8);}(_0x814b,0x1a2));var _0xb814=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x814b[_0x35c5a8];return _0x34782c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x65190,_0x3608){var _0x3e9e82=function(_0x1479cc){while(--_0x1479cc){_0x65190['push'](_0x65190['shift']());}};_0x3e9e82(++_0x3608);}(_0x55ca,0x126));var _0xa55c=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x55ca[_0x55257d];return _0x4d296d;};'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('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3ec0e66..3cb7fb0 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 _0x059d=['DATE','moment','sequelize','exports','STRING'];(function(_0x270817,_0x48a86a){var _0x58135e=function(_0x3df2c1){while(--_0x3df2c1){_0x270817['push'](_0x270817['shift']());}};_0x58135e(++_0x48a86a);}(_0x059d,0x1b9));var _0xd059=function(_0x5e1b94,_0x4764f9){_0x5e1b94=_0x5e1b94-0x0;var _0x42aa36=_0x059d[_0x5e1b94];return _0x42aa36;};'use strict';var moment=require(_0xd059('0x0'));var Sequelize=require(_0xd059('0x1'));module[_0xd059('0x2')]={'uniqueid':{'type':Sequelize[_0xd059('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd059('0x3')]},'joinAt':{'type':Sequelize[_0xd059('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd059('0x4')]},'exitAt':{'type':Sequelize[_0xd059('0x4')]},'reason':{'type':Sequelize[_0xd059('0x3')]}}; \ No newline at end of file +var _0x19ff=['exports','STRING','DATE','moment','sequelize'];(function(_0x3e834d,_0x57ea65){var _0x1ce3cc=function(_0x4a7a8c){while(--_0x4a7a8c){_0x3e834d['push'](_0x3e834d['shift']());}};_0x1ce3cc(++_0x57ea65);}(_0x19ff,0xbc));var _0xf19f=function(_0x538452,_0x3f0c4d){_0x538452=_0x538452-0x0;var _0x2f51e6=_0x19ff[_0x538452];return _0x2f51e6;};'use strict';var moment=require(_0xf19f('0x0'));var Sequelize=require(_0xf19f('0x1'));module[_0xf19f('0x2')]={'uniqueid':{'type':Sequelize[_0xf19f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf19f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf19f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf19f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e37a1fc..6062c80 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 _0xf811=['error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf811,0x6f));var _0x1f81=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf811[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0x1f81('0x0'));var rimraf=require(_0x1f81('0x1'));var zipdir=require(_0x1f81('0x2'));var jsonpatch=require(_0x1f81('0x3'));var rp=require(_0x1f81('0x4'));var moment=require(_0x1f81('0x5'));var BPromise=require(_0x1f81('0x6'));var Mustache=require(_0x1f81('0x7'));var util=require(_0x1f81('0x8'));var path=require(_0x1f81('0x9'));var sox=require(_0x1f81('0xa'));var csv=require(_0x1f81('0xb'));var ejs=require(_0x1f81('0xc'));var fs=require('fs');var fs_extra=require(_0x1f81('0xd'));var _=require('lodash');var squel=require(_0x1f81('0xe'));var crypto=require(_0x1f81('0xf'));var jsforce=require(_0x1f81('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1f81('0xb'));var querystring=require(_0x1f81('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1f81('0x13'));var as=require(_0x1f81('0x14'));var hardwareService=require(_0x1f81('0x15'));var logger=require(_0x1f81('0x16'))(_0x1f81('0x17'));var utils=require(_0x1f81('0x18'));var config=require(_0x1f81('0x19'));var licenseUtil=require(_0x1f81('0x1a'));var db=require(_0x1f81('0x1b'))['db'];function respondWithStatusCode(_0x111c85,_0x14851a){_0x14851a=_0x14851a||0xcc;return function(_0x1d9ef5){if(_0x1d9ef5){return _0x111c85[_0x1f81('0x1c')](_0x14851a);}return _0x111c85[_0x1f81('0x1d')](_0x14851a)[_0x1f81('0x1e')]();};}function respondWithResult(_0x247b10,_0x5a4992){_0x5a4992=_0x5a4992||0xc8;return function(_0x29941f){if(_0x29941f){return _0x247b10[_0x1f81('0x1d')](_0x5a4992)['json'](_0x29941f);}};}function respondWithFilteredResult(_0x5e1036,_0x20cea6){return function(_0x1a781d){if(_0x1a781d){var _0x5da9d1=typeof _0x20cea6[_0x1f81('0x1f')]===_0x1f81('0x20')&&typeof _0x20cea6[_0x1f81('0x21')]===_0x1f81('0x20');var _0x4bdba8=_0x1a781d['count'];var _0x13bf61=_0x5da9d1?0x0:_0x20cea6[_0x1f81('0x1f')];var _0x579638=_0x5da9d1?_0x1a781d[_0x1f81('0x22')]:_0x20cea6['offset']+_0x20cea6[_0x1f81('0x21')];var _0x1f9813;if(_0x579638>=_0x4bdba8){_0x579638=_0x4bdba8;_0x1f9813=0xc8;}else{_0x1f9813=0xce;}_0x5e1036[_0x1f81('0x1d')](_0x1f9813);return _0x5e1036['set'](_0x1f81('0x23'),_0x13bf61+'-'+_0x579638+'/'+_0x4bdba8)[_0x1f81('0x24')](_0x1a781d);}return null;};}function patchUpdates(_0x2d9b8d){return function(_0x3d35bd){try{jsonpatch[_0x1f81('0x25')](_0x3d35bd,_0x2d9b8d,!![]);}catch(_0x20e351){return BPromise['reject'](_0x20e351);}return _0x3d35bd[_0x1f81('0x26')]();};}function saveUpdates(_0x37b6ff,_0x3751d4){return function(_0x4ecfa9){if(_0x4ecfa9){return _0x4ecfa9['update'](_0x37b6ff)[_0x1f81('0x27')](function(_0x4aaf6e){return _0x4aaf6e;});}return null;};}function removeEntity(_0x13e8c5,_0x4f714a){return function(_0x59c93a){if(_0x59c93a){return _0x59c93a[_0x1f81('0x28')]()['then'](function(){_0x13e8c5[_0x1f81('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21caa5,_0xe95e9c){return function(_0x147695){if(!_0x147695){_0x21caa5[_0x1f81('0x1c')](0x194);}return _0x147695;};}function handleError(_0x19dab0,_0x3d9e7a){_0x3d9e7a=_0x3d9e7a||0x1f4;return function(_0x2ff623){logger[_0x1f81('0x29')](_0x2ff623[_0x1f81('0x2a')]);if(_0x2ff623[_0x1f81('0x2b')]){delete _0x2ff623['name'];}_0x19dab0[_0x1f81('0x1d')](_0x3d9e7a)['send'](_0x2ff623);};}exports[_0x1f81('0x2c')]=function(_0x197da5,_0x537166){var _0x3d547b={},_0x186e42={},_0x218040={'count':0x0,'rows':[]};var _0x232750=_[_0x1f81('0x2d')](db[_0x1f81('0x2e')][_0x1f81('0x2f')],function(_0x381b5c){return{'name':_0x381b5c['fieldName'],'type':_0x381b5c[_0x1f81('0x30')][_0x1f81('0x31')]};});_0x186e42[_0x1f81('0x32')]=_[_0x1f81('0x2d')](_0x232750,_0x1f81('0x2b'));_0x186e42[_0x1f81('0x33')]=_[_0x1f81('0x34')](_0x197da5[_0x1f81('0x33')]);_0x186e42[_0x1f81('0x35')]=_[_0x1f81('0x36')](_0x186e42[_0x1f81('0x32')],_0x186e42['query']);_0x3d547b[_0x1f81('0x37')]=_[_0x1f81('0x36')](_0x186e42[_0x1f81('0x32')],qs[_0x1f81('0x38')](_0x197da5['query'][_0x1f81('0x38')]));_0x3d547b[_0x1f81('0x37')]=_0x3d547b[_0x1f81('0x37')]['length']?_0x3d547b['attributes']:_0x186e42[_0x1f81('0x32')];if(!_0x197da5['query'][_0x1f81('0x39')]('nolimit')){_0x3d547b[_0x1f81('0x21')]=qs[_0x1f81('0x21')](_0x197da5[_0x1f81('0x33')][_0x1f81('0x21')]);_0x3d547b[_0x1f81('0x1f')]=qs[_0x1f81('0x1f')](_0x197da5[_0x1f81('0x33')]['offset']);}_0x3d547b[_0x1f81('0x3a')]=qs['sort'](_0x197da5[_0x1f81('0x33')][_0x1f81('0x3b')]);_0x3d547b['where']=qs[_0x1f81('0x35')](_[_0x1f81('0x3c')](_0x197da5[_0x1f81('0x33')],_0x186e42['filters']),_0x232750);if(_0x197da5[_0x1f81('0x33')][_0x1f81('0x3d')]){_0x3d547b[_0x1f81('0x3e')]=_[_0x1f81('0x3f')](_0x3d547b[_0x1f81('0x3e')],{'$or':_['map'](_0x232750,function(_0x1823ee){if(_0x1823ee[_0x1f81('0x30')]!=='VIRTUAL'){var _0x5a57d1={};_0x5a57d1[_0x1823ee['name']]={'$like':'%'+_0x197da5[_0x1f81('0x33')][_0x1f81('0x3d')]+'%'};return _0x5a57d1;}})});}_0x3d547b=_['merge']({},_0x3d547b,_0x197da5['options']);var _0x4ec05c={'where':_0x3d547b[_0x1f81('0x3e')]};return db[_0x1f81('0x2e')]['count'](_0x4ec05c)[_0x1f81('0x27')](function(_0x29b54f){_0x218040[_0x1f81('0x22')]=_0x29b54f;if(_0x197da5['query'][_0x1f81('0x40')]){_0x3d547b[_0x1f81('0x41')]=[{'all':!![]}];}return db[_0x1f81('0x2e')][_0x1f81('0x42')](_0x3d547b);})[_0x1f81('0x27')](function(_0xb0d536){_0x218040['rows']=_0xb0d536;return _0x218040;})[_0x1f81('0x27')](respondWithFilteredResult(_0x537166,_0x3d547b))[_0x1f81('0x43')](handleError(_0x537166,null));};exports[_0x1f81('0x44')]=function(_0x176884,_0x5a22a4){var _0x2c9c48={'raw':!![],'where':{'id':_0x176884['params']['id']}},_0x15c1b9={};_0x15c1b9[_0x1f81('0x32')]=_['keys'](db[_0x1f81('0x2e')]['rawAttributes']);_0x15c1b9[_0x1f81('0x33')]=_['keys'](_0x176884[_0x1f81('0x33')]);_0x15c1b9[_0x1f81('0x35')]=_[_0x1f81('0x36')](_0x15c1b9['model'],_0x15c1b9[_0x1f81('0x33')]);_0x2c9c48[_0x1f81('0x37')]=_['intersection'](_0x15c1b9[_0x1f81('0x32')],qs[_0x1f81('0x38')](_0x176884[_0x1f81('0x33')][_0x1f81('0x38')]));_0x2c9c48[_0x1f81('0x37')]=_0x2c9c48[_0x1f81('0x37')][_0x1f81('0x45')]?_0x2c9c48['attributes']:_0x15c1b9[_0x1f81('0x32')];if(_0x176884[_0x1f81('0x33')]['includeAll']){_0x2c9c48[_0x1f81('0x41')]=[{'all':!![]}];}_0x2c9c48=_[_0x1f81('0x3f')]({},_0x2c9c48,_0x176884[_0x1f81('0x46')]);return db['ChatQueueReport'][_0x1f81('0x47')](_0x2c9c48)[_0x1f81('0x27')](handleEntityNotFound(_0x5a22a4,null))['then'](respondWithResult(_0x5a22a4,null))[_0x1f81('0x43')](handleError(_0x5a22a4,null));};exports['create']=function(_0x51bd8d,_0x19f10d){return db[_0x1f81('0x2e')][_0x1f81('0x48')](_0x51bd8d['body'],{})['then'](respondWithResult(_0x19f10d,0xc9))[_0x1f81('0x43')](handleError(_0x19f10d,null));};exports['update']=function(_0x9a7ddb,_0x388936){if(_0x9a7ddb[_0x1f81('0x49')]['id']){delete _0x9a7ddb[_0x1f81('0x49')]['id'];}return db[_0x1f81('0x2e')]['find']({'where':{'id':_0x9a7ddb[_0x1f81('0x4a')]['id']}})[_0x1f81('0x27')](handleEntityNotFound(_0x388936,null))[_0x1f81('0x27')](saveUpdates(_0x9a7ddb[_0x1f81('0x49')],null))['then'](respondWithResult(_0x388936,null))['catch'](handleError(_0x388936,null));};exports[_0x1f81('0x28')]=function(_0x271570,_0x56beff){return db[_0x1f81('0x2e')]['find']({'where':{'id':_0x271570[_0x1f81('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56beff,null))[_0x1f81('0x27')](removeEntity(_0x56beff,null))['catch'](handleError(_0x56beff,null));};exports[_0x1f81('0x4b')]=function(_0x53a454,_0x45729c){return db[_0x1f81('0x2e')][_0x1f81('0x4b')]()['then'](respondWithResult(_0x45729c,null))[_0x1f81('0x43')](handleError(_0x45729c,null));}; \ No newline at end of file +var _0x644f=['../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','then','destroy','error','name','index','ChatQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','create','body','update','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0x644f,0xc2));var _0xf644=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x644f[_0x4c9380];return _0x49a523;};'use strict';var emlformat=require(_0xf644('0x0'));var rimraf=require(_0xf644('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf644('0x2'));var moment=require(_0xf644('0x3'));var BPromise=require(_0xf644('0x4'));var Mustache=require(_0xf644('0x5'));var util=require(_0xf644('0x6'));var path=require(_0xf644('0x7'));var sox=require(_0xf644('0x8'));var csv=require(_0xf644('0x9'));var ejs=require(_0xf644('0xa'));var fs=require('fs');var fs_extra=require(_0xf644('0xb'));var _=require(_0xf644('0xc'));var squel=require(_0xf644('0xd'));var crypto=require('crypto');var jsforce=require(_0xf644('0xe'));var deskjs=require(_0xf644('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf644('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf644('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf644('0x12'));var hardwareService=require(_0xf644('0x13'));var logger=require('../../config/logger')(_0xf644('0x14'));var utils=require(_0xf644('0x15'));var config=require(_0xf644('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf644('0x17'))['db'];function respondWithStatusCode(_0x301425,_0x516f19){_0x516f19=_0x516f19||0xcc;return function(_0x3678c9){if(_0x3678c9){return _0x301425[_0xf644('0x18')](_0x516f19);}return _0x301425['status'](_0x516f19)[_0xf644('0x19')]();};}function respondWithResult(_0x53497c,_0x228cf7){_0x228cf7=_0x228cf7||0xc8;return function(_0x14d787){if(_0x14d787){return _0x53497c['status'](_0x228cf7)[_0xf644('0x1a')](_0x14d787);}};}function respondWithFilteredResult(_0xc0182,_0x52f74a){return function(_0x5b0b81){if(_0x5b0b81){var _0x4c197b=typeof _0x52f74a['offset']===_0xf644('0x1b')&&typeof _0x52f74a[_0xf644('0x1c')]===_0xf644('0x1b');var _0x329bb9=_0x5b0b81['count'];var _0x5bd03c=_0x4c197b?0x0:_0x52f74a[_0xf644('0x1d')];var _0x4650b5=_0x4c197b?_0x5b0b81[_0xf644('0x1e')]:_0x52f74a[_0xf644('0x1d')]+_0x52f74a['limit'];var _0x4beeb0;if(_0x4650b5>=_0x329bb9){_0x4650b5=_0x329bb9;_0x4beeb0=0xc8;}else{_0x4beeb0=0xce;}_0xc0182[_0xf644('0x1f')](_0x4beeb0);return _0xc0182[_0xf644('0x20')](_0xf644('0x21'),_0x5bd03c+'-'+_0x4650b5+'/'+_0x329bb9)[_0xf644('0x1a')](_0x5b0b81);}return null;};}function patchUpdates(_0x29f81a){return function(_0x2bc954){try{jsonpatch[_0xf644('0x22')](_0x2bc954,_0x29f81a,!![]);}catch(_0x20c0fb){return BPromise['reject'](_0x20c0fb);}return _0x2bc954[_0xf644('0x23')]();};}function saveUpdates(_0x1c36b4,_0x2180c6){return function(_0x9f426c){if(_0x9f426c){return _0x9f426c['update'](_0x1c36b4)[_0xf644('0x24')](function(_0x3b863f){return _0x3b863f;});}return null;};}function removeEntity(_0x42b88b,_0x17b2c6){return function(_0xc2a8fc){if(_0xc2a8fc){return _0xc2a8fc[_0xf644('0x25')]()[_0xf644('0x24')](function(){_0x42b88b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22febe,_0x41b6a1){return function(_0xaeb4b){if(!_0xaeb4b){_0x22febe[_0xf644('0x18')](0x194);}return _0xaeb4b;};}function handleError(_0x329a02,_0x20d683){_0x20d683=_0x20d683||0x1f4;return function(_0x2b2882){logger[_0xf644('0x26')](_0x2b2882['stack']);if(_0x2b2882[_0xf644('0x27')]){delete _0x2b2882[_0xf644('0x27')];}_0x329a02['status'](_0x20d683)['send'](_0x2b2882);};}exports[_0xf644('0x28')]=function(_0x31343f,_0x16c745){var _0x3881e3={},_0x2bcb20={},_0x1ef501={'count':0x0,'rows':[]};var _0x2b9413=_['map'](db[_0xf644('0x29')][_0xf644('0x2a')],function(_0x4ad5ac){return{'name':_0x4ad5ac['fieldName'],'type':_0x4ad5ac[_0xf644('0x2b')][_0xf644('0x2c')]};});_0x2bcb20[_0xf644('0x2d')]=_[_0xf644('0x2e')](_0x2b9413,_0xf644('0x27'));_0x2bcb20[_0xf644('0x2f')]=_[_0xf644('0x30')](_0x31343f[_0xf644('0x2f')]);_0x2bcb20[_0xf644('0x31')]=_[_0xf644('0x32')](_0x2bcb20['model'],_0x2bcb20['query']);_0x3881e3[_0xf644('0x33')]=_[_0xf644('0x32')](_0x2bcb20[_0xf644('0x2d')],qs[_0xf644('0x34')](_0x31343f[_0xf644('0x2f')][_0xf644('0x34')]));_0x3881e3[_0xf644('0x33')]=_0x3881e3['attributes'][_0xf644('0x35')]?_0x3881e3['attributes']:_0x2bcb20['model'];if(!_0x31343f[_0xf644('0x2f')][_0xf644('0x36')](_0xf644('0x37'))){_0x3881e3['limit']=qs['limit'](_0x31343f[_0xf644('0x2f')][_0xf644('0x1c')]);_0x3881e3[_0xf644('0x1d')]=qs['offset'](_0x31343f[_0xf644('0x2f')][_0xf644('0x1d')]);}_0x3881e3['order']=qs[_0xf644('0x38')](_0x31343f[_0xf644('0x2f')][_0xf644('0x38')]);_0x3881e3[_0xf644('0x39')]=qs[_0xf644('0x31')](_[_0xf644('0x3a')](_0x31343f['query'],_0x2bcb20[_0xf644('0x31')]),_0x2b9413);if(_0x31343f['query'][_0xf644('0x3b')]){_0x3881e3[_0xf644('0x39')]=_[_0xf644('0x3c')](_0x3881e3[_0xf644('0x39')],{'$or':_[_0xf644('0x2e')](_0x2b9413,function(_0x60bec){if(_0x60bec['type']!==_0xf644('0x3d')){var _0x2b8781={};_0x2b8781[_0x60bec[_0xf644('0x27')]]={'$like':'%'+_0x31343f['query']['filter']+'%'};return _0x2b8781;}})});}_0x3881e3=_[_0xf644('0x3c')]({},_0x3881e3,_0x31343f[_0xf644('0x3e')]);var _0x11d879={'where':_0x3881e3[_0xf644('0x39')]};return db['ChatQueueReport'][_0xf644('0x1e')](_0x11d879)['then'](function(_0x10b861){_0x1ef501['count']=_0x10b861;if(_0x31343f[_0xf644('0x2f')][_0xf644('0x3f')]){_0x3881e3[_0xf644('0x40')]=[{'all':!![]}];}return db[_0xf644('0x29')]['findAll'](_0x3881e3);})[_0xf644('0x24')](function(_0x266bf4){_0x1ef501['rows']=_0x266bf4;return _0x1ef501;})[_0xf644('0x24')](respondWithFilteredResult(_0x16c745,_0x3881e3))[_0xf644('0x41')](handleError(_0x16c745,null));};exports['show']=function(_0x101f71,_0x5c2187){var _0x3f73c7={'raw':!![],'where':{'id':_0x101f71[_0xf644('0x42')]['id']}},_0x322f84={};_0x322f84[_0xf644('0x2d')]=_[_0xf644('0x30')](db['ChatQueueReport'][_0xf644('0x2a')]);_0x322f84[_0xf644('0x2f')]=_[_0xf644('0x30')](_0x101f71[_0xf644('0x2f')]);_0x322f84[_0xf644('0x31')]=_['intersection'](_0x322f84[_0xf644('0x2d')],_0x322f84[_0xf644('0x2f')]);_0x3f73c7[_0xf644('0x33')]=_['intersection'](_0x322f84[_0xf644('0x2d')],qs[_0xf644('0x34')](_0x101f71[_0xf644('0x2f')][_0xf644('0x34')]));_0x3f73c7['attributes']=_0x3f73c7['attributes'][_0xf644('0x35')]?_0x3f73c7[_0xf644('0x33')]:_0x322f84[_0xf644('0x2d')];if(_0x101f71[_0xf644('0x2f')]['includeAll']){_0x3f73c7['include']=[{'all':!![]}];}_0x3f73c7=_[_0xf644('0x3c')]({},_0x3f73c7,_0x101f71[_0xf644('0x3e')]);return db[_0xf644('0x29')]['find'](_0x3f73c7)[_0xf644('0x24')](handleEntityNotFound(_0x5c2187,null))[_0xf644('0x24')](respondWithResult(_0x5c2187,null))[_0xf644('0x41')](handleError(_0x5c2187,null));};exports[_0xf644('0x43')]=function(_0x184f30,_0x3a224b){return db[_0xf644('0x29')][_0xf644('0x43')](_0x184f30[_0xf644('0x44')],{})['then'](respondWithResult(_0x3a224b,0xc9))[_0xf644('0x41')](handleError(_0x3a224b,null));};exports[_0xf644('0x45')]=function(_0x1756bc,_0x212a99){if(_0x1756bc[_0xf644('0x44')]['id']){delete _0x1756bc[_0xf644('0x44')]['id'];}return db[_0xf644('0x29')]['find']({'where':{'id':_0x1756bc[_0xf644('0x42')]['id']}})[_0xf644('0x24')](handleEntityNotFound(_0x212a99,null))['then'](saveUpdates(_0x1756bc['body'],null))['then'](respondWithResult(_0x212a99,null))[_0xf644('0x41')](handleError(_0x212a99,null));};exports['destroy']=function(_0x3f1a46,_0x3df93f){return db['ChatQueueReport'][_0xf644('0x46')]({'where':{'id':_0x3f1a46[_0xf644('0x42')]['id']}})[_0xf644('0x24')](handleEntityNotFound(_0x3df93f,null))[_0xf644('0x24')](removeEntity(_0x3df93f,null))[_0xf644('0x41')](handleError(_0x3df93f,null));};exports[_0xf644('0x47')]=function(_0x40910c,_0x3d0915){return db['ChatQueueReport'][_0xf644('0x47')]()[_0xf644('0x24')](respondWithResult(_0x3d0915,null))[_0xf644('0x41')](handleError(_0x3d0915,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2b1e392..fef1524 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x4e00e4,_0x58fd04){var _0x421c55=function(_0xcd71c5){while(--_0xcd71c5){_0x4e00e4['push'](_0x4e00e4['shift']());}};_0x421c55(++_0x58fd04);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x1afde3,_0xc1f075){var _0x54a07c=function(_0x6c6a21){while(--_0x6c6a21){_0x1afde3['push'](_0x1afde3['shift']());}};_0x54a07c(++_0xc1f075);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'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 b753082..b188278 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 _0x6685=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CreateChatQueueReport','body','raw','options','where','attributes','limit','UpdateChatQueueReport','util','moment','bluebird'];(function(_0x484783,_0x5adb3b){var _0x583af8=function(_0x46d5f2){while(--_0x46d5f2){_0x484783['push'](_0x484783['shift']());}};_0x583af8(++_0x5adb3b);}(_0x6685,0xfd));var _0x5668=function(_0x10826b,_0x4449df){_0x10826b=_0x10826b-0x0;var _0x9e8258=_0x6685[_0x10826b];return _0x9e8258;};'use strict';var _=require('lodash');var util=require(_0x5668('0x0'));var moment=require(_0x5668('0x1'));var BPromise=require(_0x5668('0x2'));var rs=require(_0x5668('0x3'));var fs=require('fs');var Redis=require(_0x5668('0x4'));var db=require(_0x5668('0x5'))['db'];var utils=require(_0x5668('0x6'));var logger=require('../../config/logger')(_0x5668('0x7'));var config=require(_0x5668('0x8'));var jayson=require(_0x5668('0x9'));var client=jayson[_0x5668('0xa')][_0x5668('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a4434,_0x472ae2,_0x47792f){return new BPromise(function(_0x1e50f1,_0x1840ac){return client[_0x5668('0xc')](_0x9a4434,_0x47792f)[_0x5668('0xd')](function(_0x1c5306){logger[_0x5668('0xe')](_0x5668('0xf'),_0x472ae2,'request\x20sent');logger[_0x5668('0x10')](_0x5668('0x11'),_0x472ae2,_0x5668('0x12'),JSON[_0x5668('0x13')](_0x1c5306));if(_0x1c5306['error']){if(_0x1c5306['error'][_0x5668('0x14')]===0x1f4){logger[_0x5668('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x472ae2,_0x1c5306[_0x5668('0x15')][_0x5668('0x16')]);return _0x1840ac(_0x1c5306[_0x5668('0x15')][_0x5668('0x16')]);}logger[_0x5668('0x15')](_0x5668('0xf'),_0x472ae2,_0x1c5306[_0x5668('0x15')][_0x5668('0x16')]);return _0x1e50f1(_0x1c5306[_0x5668('0x15')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x472ae2,_0x5668('0x12'));_0x1e50f1(_0x1c5306['result']['message']);}})[_0x5668('0x17')](function(_0x2dfa0d){logger['error'](_0x5668('0xf'),_0x472ae2,_0x2dfa0d);_0x1840ac(_0x2dfa0d);});});}exports[_0x5668('0x18')]=function(_0x2df44e){var _0x3bd764=this;return new Promise(function(_0x1572d8,_0xe72742){return db['ChatQueueReport']['create'](_0x2df44e[_0x5668('0x19')],{'raw':_0x2df44e['options']?_0x2df44e['options'][_0x5668('0x1a')]===undefined?!![]:![]:!![]})[_0x5668('0xd')](function(_0x4876fe){logger[_0x5668('0xe')](_0x5668('0x18'),_0x2df44e);logger['debug'](_0x5668('0x18'),_0x2df44e,JSON[_0x5668('0x13')](_0x4876fe));_0x1572d8(_0x4876fe);})['catch'](function(_0x411d38){logger[_0x5668('0x15')]('CreateChatQueueReport',_0x411d38['message'],_0x2df44e);_0xe72742(_0x3bd764[_0x5668('0x15')](0x1f4,_0x411d38[_0x5668('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x374d80){var _0x1a8d3d=this;return new Promise(function(_0x51e398,_0x383268){return db['ChatQueueReport']['update'](_0x374d80[_0x5668('0x19')],{'raw':_0x374d80[_0x5668('0x1b')]?_0x374d80[_0x5668('0x1b')][_0x5668('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374d80[_0x5668('0x1b')]?_0x374d80[_0x5668('0x1b')][_0x5668('0x1c')]||null:null,'attributes':_0x374d80['options']?_0x374d80[_0x5668('0x1b')][_0x5668('0x1d')]||null:null,'limit':_0x374d80['options']?_0x374d80[_0x5668('0x1b')][_0x5668('0x1e')]||null:null})[_0x5668('0xd')](function(_0x127874){logger[_0x5668('0xe')](_0x5668('0x1f'),_0x374d80);logger[_0x5668('0x10')](_0x5668('0x1f'),_0x374d80,JSON[_0x5668('0x13')](_0x127874));_0x51e398(_0x127874);})[_0x5668('0x17')](function(_0x5e7e98){logger[_0x5668('0x15')](_0x5668('0x1f'),_0x5e7e98[_0x5668('0x16')],_0x374d80);_0x383268(_0x1a8d3d[_0x5668('0x15')](0x1f4,_0x5e7e98['message']));});});}; \ No newline at end of file +var _0x5493=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','create','options','raw','ChatQueueReport','update','body','where','attributes','limit','UpdateChatQueueReport','catch','util','randomstring','ioredis'];(function(_0x37f8f9,_0x428e38){var _0x59960d=function(_0x52208f){while(--_0x52208f){_0x37f8f9['push'](_0x37f8f9['shift']());}};_0x59960d(++_0x428e38);}(_0x5493,0x1cb));var _0x3549=function(_0x22511a,_0x42f9ea){_0x22511a=_0x22511a-0x0;var _0x58c8c9=_0x5493[_0x22511a];return _0x58c8c9;};'use strict';var _=require('lodash');var util=require(_0x3549('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3549('0x1'));var fs=require('fs');var Redis=require(_0x3549('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3549('0x3'));var logger=require(_0x3549('0x4'))(_0x3549('0x5'));var config=require(_0x3549('0x6'));var jayson=require(_0x3549('0x7'));var client=jayson[_0x3549('0x8')][_0x3549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553b2d,_0x5335ab,_0x302a19){return new BPromise(function(_0x420652,_0x4f91b7){return client['request'](_0x553b2d,_0x302a19)[_0x3549('0xa')](function(_0x4a6a7c){logger[_0x3549('0xb')](_0x3549('0xc'),_0x5335ab,_0x3549('0xd'));logger[_0x3549('0xe')](_0x3549('0xf'),_0x5335ab,_0x3549('0xd'),JSON[_0x3549('0x10')](_0x4a6a7c));if(_0x4a6a7c[_0x3549('0x11')]){if(_0x4a6a7c[_0x3549('0x11')][_0x3549('0x12')]===0x1f4){logger['error'](_0x3549('0xc'),_0x5335ab,_0x4a6a7c[_0x3549('0x11')][_0x3549('0x13')]);return _0x4f91b7(_0x4a6a7c[_0x3549('0x11')][_0x3549('0x13')]);}logger[_0x3549('0x11')](_0x3549('0xc'),_0x5335ab,_0x4a6a7c[_0x3549('0x11')][_0x3549('0x13')]);return _0x420652(_0x4a6a7c['error'][_0x3549('0x13')]);}else{logger['info'](_0x3549('0xc'),_0x5335ab,_0x3549('0xd'));_0x420652(_0x4a6a7c[_0x3549('0x14')][_0x3549('0x13')]);}})['catch'](function(_0x3d5a23){logger[_0x3549('0x11')](_0x3549('0xc'),_0x5335ab,_0x3d5a23);_0x4f91b7(_0x3d5a23);});});}exports[_0x3549('0x15')]=function(_0x4b167f){var _0x496780=this;return new Promise(function(_0x45eafe,_0x2dcb87){return db['ChatQueueReport'][_0x3549('0x16')](_0x4b167f['body'],{'raw':_0x4b167f[_0x3549('0x17')]?_0x4b167f[_0x3549('0x17')][_0x3549('0x18')]===undefined?!![]:![]:!![]})[_0x3549('0xa')](function(_0x1f0d3e){logger['info']('CreateChatQueueReport',_0x4b167f);logger[_0x3549('0xe')]('CreateChatQueueReport',_0x4b167f,JSON[_0x3549('0x10')](_0x1f0d3e));_0x45eafe(_0x1f0d3e);})['catch'](function(_0x38e8ff){logger[_0x3549('0x11')](_0x3549('0x15'),_0x38e8ff['message'],_0x4b167f);_0x2dcb87(_0x496780[_0x3549('0x11')](0x1f4,_0x38e8ff[_0x3549('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0xdbb7e7){var _0xeacfb9=this;return new Promise(function(_0x3deb0f,_0x3fd0a7){return db[_0x3549('0x19')][_0x3549('0x1a')](_0xdbb7e7[_0x3549('0x1b')],{'raw':_0xdbb7e7['options']?_0xdbb7e7[_0x3549('0x17')][_0x3549('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdbb7e7[_0x3549('0x17')]?_0xdbb7e7[_0x3549('0x17')][_0x3549('0x1c')]||null:null,'attributes':_0xdbb7e7[_0x3549('0x17')]?_0xdbb7e7[_0x3549('0x17')][_0x3549('0x1d')]||null:null,'limit':_0xdbb7e7[_0x3549('0x17')]?_0xdbb7e7['options'][_0x3549('0x1e')]||null:null})['then'](function(_0x495e4d){logger['info'](_0x3549('0x1f'),_0xdbb7e7);logger[_0x3549('0xe')](_0x3549('0x1f'),_0xdbb7e7,JSON[_0x3549('0x10')](_0x495e4d));_0x3deb0f(_0x495e4d);})[_0x3549('0x20')](function(_0x13184c){logger[_0x3549('0x11')](_0x3549('0x1f'),_0x13184c[_0x3549('0x13')],_0xdbb7e7);_0x3fd0a7(_0xeacfb9[_0x3549('0x11')](0x1f4,_0x13184c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6047c69..74b1c2c 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 _0xd76d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','destroy','exports'];(function(_0x1469f6,_0x1811c5){var _0x1a43cf=function(_0x2e810e){while(--_0x2e810e){_0x1469f6['push'](_0x1469f6['shift']());}};_0x1a43cf(++_0x1811c5);}(_0xd76d,0xe4));var _0xdd76=function(_0xf845cc,_0x7bce78){_0xf845cc=_0xf845cc-0x0;var _0x24da94=_0xd76d[_0xf845cc];return _0x24da94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd76('0x0'));var timeout=require(_0xdd76('0x1'));var express=require(_0xdd76('0x2'));var router=express[_0xdd76('0x3')]();var fs_extra=require(_0xdd76('0x4'));var auth=require(_0xdd76('0x5'));var interaction=require(_0xdd76('0x6'));var config=require(_0xdd76('0x7'));var controller=require(_0xdd76('0x8'));router['get']('/',auth[_0xdd76('0x9')](),controller[_0xdd76('0xa')]);router[_0xdd76('0xb')](_0xdd76('0xc'),auth[_0xdd76('0x9')](),controller[_0xdd76('0xd')]);router[_0xdd76('0xb')](_0xdd76('0xe'),auth[_0xdd76('0x9')](),controller['show']);router['post']('/',auth[_0xdd76('0x9')](),controller[_0xdd76('0xf')]);router[_0xdd76('0x10')]('/:id',auth[_0xdd76('0x9')](),controller['update']);router['delete'](_0xdd76('0xe'),auth[_0xdd76('0x9')](),controller[_0xdd76('0x11')]);module[_0xdd76('0x12')]=router; \ No newline at end of file +var _0x7334=['index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x1f9c6c,_0x5307ea){var _0x3a0c7f=function(_0x78bfa9){while(--_0x78bfa9){_0x1f9c6c['push'](_0x1f9c6c['shift']());}};_0x3a0c7f(++_0x5307ea);}(_0x7334,0x130));var _0x4733=function(_0x405d1f,_0x165e77){_0x405d1f=_0x405d1f-0x0;var _0x356d6d=_0x7334[_0x405d1f];return _0x356d6d;};'use strict';var multer=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var path=require(_0x4733('0x2'));var timeout=require('connect-timeout');var express=require(_0x4733('0x3'));var router=express[_0x4733('0x4')]();var fs_extra=require(_0x4733('0x5'));var auth=require(_0x4733('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4733('0x7'));var controller=require(_0x4733('0x8'));router[_0x4733('0x9')]('/',auth[_0x4733('0xa')](),controller[_0x4733('0xb')]);router['get']('/describe',auth[_0x4733('0xa')](),controller[_0x4733('0xc')]);router[_0x4733('0x9')](_0x4733('0xd'),auth[_0x4733('0xa')](),controller[_0x4733('0xe')]);router[_0x4733('0xf')]('/',auth[_0x4733('0xa')](),controller[_0x4733('0x10')]);router[_0x4733('0x11')](_0x4733('0xd'),auth[_0x4733('0xa')](),controller[_0x4733('0x12')]);router[_0x4733('0x13')](_0x4733('0xd'),auth[_0x4733('0xa')](),controller['destroy']);module[_0x4733('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dc740e0..b8e1720 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x524862,_0x51a6ff){var _0x5e225d=function(_0x3aedbd){while(--_0x3aedbd){_0x524862['push'](_0x524862['shift']());}};_0x5e225d(++_0x51a6ff);}(_0xedd9,0xfc));var _0x9edd=function(_0x2aa2e9,_0x4b05c7){_0x2aa2e9=_0x2aa2e9-0x0;var _0x2dbc4d=_0xedd9[_0x2aa2e9];return _0x2dbc4d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x9bde,0xe1));var _0xe9bd=function(_0xbde51f,_0x20b4bb){_0xbde51f=_0xbde51f-0x0;var _0x5d24ba=_0x9bde[_0xbde51f];return _0x5d24ba;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 854dd27..11a1cf2 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 _0xf0a8=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf'];(function(_0x4f6703,_0x35ef58){var _0x311437=function(_0x585600){while(--_0x585600){_0x4f6703['push'](_0x4f6703['shift']());}};_0x311437(++_0x35ef58);}(_0xf0a8,0x12f));var _0x8f0a=function(_0x45606e,_0x22c5b0){_0x45606e=_0x45606e-0x0;var _0x788a25=_0xf0a8[_0x45606e];return _0x788a25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f0a('0x0'));var zipdir=require(_0x8f0a('0x1'));var jsonpatch=require(_0x8f0a('0x2'));var rp=require(_0x8f0a('0x3'));var moment=require(_0x8f0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f0a('0x5'));var util=require(_0x8f0a('0x6'));var path=require(_0x8f0a('0x7'));var sox=require(_0x8f0a('0x8'));var csv=require(_0x8f0a('0x9'));var ejs=require(_0x8f0a('0xa'));var fs=require('fs');var fs_extra=require(_0x8f0a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f0a('0xc'));var jsforce=require(_0x8f0a('0xd'));var deskjs=require(_0x8f0a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f0a('0x10'));var logger=require(_0x8f0a('0x11'))(_0x8f0a('0x12'));var utils=require(_0x8f0a('0x13'));var config=require(_0x8f0a('0x14'));var licenseUtil=require(_0x8f0a('0x15'));var db=require(_0x8f0a('0x16'))['db'];function respondWithStatusCode(_0x4d9980,_0x481d15){_0x481d15=_0x481d15||0xcc;return function(_0x221184){if(_0x221184){return _0x4d9980[_0x8f0a('0x17')](_0x481d15);}return _0x4d9980[_0x8f0a('0x18')](_0x481d15)[_0x8f0a('0x19')]();};}function respondWithResult(_0x11b49a,_0x4fb84){_0x4fb84=_0x4fb84||0xc8;return function(_0x44a730){if(_0x44a730){return _0x11b49a[_0x8f0a('0x18')](_0x4fb84)[_0x8f0a('0x1a')](_0x44a730);}};}function respondWithFilteredResult(_0x3ed2a0,_0x59d439){return function(_0x3223d8){if(_0x3223d8){var _0x1c4d48=typeof _0x59d439[_0x8f0a('0x1b')]===_0x8f0a('0x1c')&&typeof _0x59d439[_0x8f0a('0x1d')]===_0x8f0a('0x1c');var _0x22315b=_0x3223d8['count'];var _0x13d1a3=_0x1c4d48?0x0:_0x59d439[_0x8f0a('0x1b')];var _0x1ae136=_0x1c4d48?_0x3223d8[_0x8f0a('0x1e')]:_0x59d439[_0x8f0a('0x1b')]+_0x59d439['limit'];var _0xa3c6e3;if(_0x1ae136>=_0x22315b){_0x1ae136=_0x22315b;_0xa3c6e3=0xc8;}else{_0xa3c6e3=0xce;}_0x3ed2a0[_0x8f0a('0x18')](_0xa3c6e3);return _0x3ed2a0[_0x8f0a('0x1f')](_0x8f0a('0x20'),_0x13d1a3+'-'+_0x1ae136+'/'+_0x22315b)[_0x8f0a('0x1a')](_0x3223d8);}return null;};}function patchUpdates(_0x4c20b5){return function(_0x5a787c){try{jsonpatch[_0x8f0a('0x21')](_0x5a787c,_0x4c20b5,!![]);}catch(_0x37a8d1){return BPromise['reject'](_0x37a8d1);}return _0x5a787c[_0x8f0a('0x22')]();};}function saveUpdates(_0x578a21,_0x80d487){return function(_0x583f79){if(_0x583f79){return _0x583f79[_0x8f0a('0x23')](_0x578a21)[_0x8f0a('0x24')](function(_0x2bf852){return _0x2bf852;});}return null;};}function removeEntity(_0x2a3282,_0x41a21b){return function(_0x326407){if(_0x326407){return _0x326407[_0x8f0a('0x25')]()['then'](function(){_0x2a3282[_0x8f0a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35897f,_0x4baa5d){return function(_0x1f00cc){if(!_0x1f00cc){_0x35897f[_0x8f0a('0x17')](0x194);}return _0x1f00cc;};}function handleError(_0x24d8cd,_0x376ded){_0x376ded=_0x376ded||0x1f4;return function(_0x573721){logger[_0x8f0a('0x26')](_0x573721[_0x8f0a('0x27')]);if(_0x573721['name']){delete _0x573721[_0x8f0a('0x28')];}_0x24d8cd[_0x8f0a('0x18')](_0x376ded)[_0x8f0a('0x29')](_0x573721);};}exports[_0x8f0a('0x2a')]=function(_0x2f92e3,_0x2204a8){var _0x360acd={},_0x3ef5e3={},_0x317db5={'count':0x0,'rows':[]};var _0x4fa061=_[_0x8f0a('0x2b')](db[_0x8f0a('0x2c')][_0x8f0a('0x2d')],function(_0x38ebb6){return{'name':_0x38ebb6[_0x8f0a('0x2e')],'type':_0x38ebb6['type'][_0x8f0a('0x2f')]};});_0x3ef5e3['model']=_[_0x8f0a('0x2b')](_0x4fa061,'name');_0x3ef5e3['query']=_['keys'](_0x2f92e3['query']);_0x3ef5e3[_0x8f0a('0x30')]=_[_0x8f0a('0x31')](_0x3ef5e3[_0x8f0a('0x32')],_0x3ef5e3[_0x8f0a('0x33')]);_0x360acd[_0x8f0a('0x34')]=_[_0x8f0a('0x31')](_0x3ef5e3['model'],qs[_0x8f0a('0x35')](_0x2f92e3['query'][_0x8f0a('0x35')]));_0x360acd['attributes']=_0x360acd['attributes'][_0x8f0a('0x36')]?_0x360acd[_0x8f0a('0x34')]:_0x3ef5e3[_0x8f0a('0x32')];if(!_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x37')]('nolimit')){_0x360acd[_0x8f0a('0x1d')]=qs['limit'](_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x1d')]);_0x360acd[_0x8f0a('0x1b')]=qs[_0x8f0a('0x1b')](_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x1b')]);}_0x360acd[_0x8f0a('0x38')]=qs[_0x8f0a('0x39')](_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x39')]);_0x360acd[_0x8f0a('0x3a')]=qs[_0x8f0a('0x30')](_[_0x8f0a('0x3b')](_0x2f92e3['query'],_0x3ef5e3[_0x8f0a('0x30')]),_0x4fa061);if(_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x3c')]){_0x360acd['where']=_[_0x8f0a('0x3d')](_0x360acd[_0x8f0a('0x3a')],{'$or':_[_0x8f0a('0x2b')](_0x4fa061,function(_0x589db5){if(_0x589db5[_0x8f0a('0x3e')]!==_0x8f0a('0x3f')){var _0x52c2c6={};_0x52c2c6[_0x589db5[_0x8f0a('0x28')]]={'$like':'%'+_0x2f92e3[_0x8f0a('0x33')]['filter']+'%'};return _0x52c2c6;}})});}_0x360acd=_[_0x8f0a('0x3d')]({},_0x360acd,_0x2f92e3['options']);var _0x8f1fcb={'where':_0x360acd[_0x8f0a('0x3a')]};return db[_0x8f0a('0x2c')][_0x8f0a('0x1e')](_0x8f1fcb)[_0x8f0a('0x24')](function(_0x381510){_0x317db5['count']=_0x381510;if(_0x2f92e3[_0x8f0a('0x33')][_0x8f0a('0x40')]){_0x360acd[_0x8f0a('0x41')]=[{'all':!![]}];}return db[_0x8f0a('0x2c')][_0x8f0a('0x42')](_0x360acd);})[_0x8f0a('0x24')](function(_0x55224f){_0x317db5[_0x8f0a('0x43')]=_0x55224f;return _0x317db5;})[_0x8f0a('0x24')](respondWithFilteredResult(_0x2204a8,_0x360acd))[_0x8f0a('0x44')](handleError(_0x2204a8,null));};exports[_0x8f0a('0x45')]=function(_0x16949f,_0x29d16f){var _0x4188cd={'raw':!![],'where':{'id':_0x16949f[_0x8f0a('0x46')]['id']}},_0x458210={};_0x458210['model']=_[_0x8f0a('0x47')](db[_0x8f0a('0x2c')][_0x8f0a('0x2d')]);_0x458210[_0x8f0a('0x33')]=_[_0x8f0a('0x47')](_0x16949f[_0x8f0a('0x33')]);_0x458210[_0x8f0a('0x30')]=_['intersection'](_0x458210[_0x8f0a('0x32')],_0x458210[_0x8f0a('0x33')]);_0x4188cd[_0x8f0a('0x34')]=_[_0x8f0a('0x31')](_0x458210[_0x8f0a('0x32')],qs[_0x8f0a('0x35')](_0x16949f[_0x8f0a('0x33')][_0x8f0a('0x35')]));_0x4188cd[_0x8f0a('0x34')]=_0x4188cd[_0x8f0a('0x34')][_0x8f0a('0x36')]?_0x4188cd[_0x8f0a('0x34')]:_0x458210['model'];if(_0x16949f[_0x8f0a('0x33')][_0x8f0a('0x40')]){_0x4188cd['include']=[{'all':!![]}];}_0x4188cd=_['merge']({},_0x4188cd,_0x16949f['options']);return db[_0x8f0a('0x2c')][_0x8f0a('0x48')](_0x4188cd)[_0x8f0a('0x24')](handleEntityNotFound(_0x29d16f,null))[_0x8f0a('0x24')](respondWithResult(_0x29d16f,null))[_0x8f0a('0x44')](handleError(_0x29d16f,null));};exports[_0x8f0a('0x49')]=function(_0xfb5b47,_0x8335c){return db[_0x8f0a('0x2c')][_0x8f0a('0x49')](_0xfb5b47['body'],{})[_0x8f0a('0x24')](respondWithResult(_0x8335c,0xc9))['catch'](handleError(_0x8335c,null));};exports[_0x8f0a('0x23')]=function(_0x40334d,_0x5a1b7d){if(_0x40334d[_0x8f0a('0x4a')]['id']){delete _0x40334d[_0x8f0a('0x4a')]['id'];}return db[_0x8f0a('0x2c')][_0x8f0a('0x48')]({'where':{'id':_0x40334d['params']['id']}})[_0x8f0a('0x24')](handleEntityNotFound(_0x5a1b7d,null))[_0x8f0a('0x24')](saveUpdates(_0x40334d[_0x8f0a('0x4a')],null))[_0x8f0a('0x24')](respondWithResult(_0x5a1b7d,null))[_0x8f0a('0x44')](handleError(_0x5a1b7d,null));};exports[_0x8f0a('0x25')]=function(_0x19e4be,_0x523da3){return db[_0x8f0a('0x2c')][_0x8f0a('0x48')]({'where':{'id':_0x19e4be[_0x8f0a('0x46')]['id']}})[_0x8f0a('0x24')](handleEntityNotFound(_0x523da3,null))[_0x8f0a('0x24')](removeEntity(_0x523da3,null))['catch'](handleError(_0x523da3,null));};exports[_0x8f0a('0x4b')]=function(_0x2175f0,_0x11f4c0){return db['ChatTransferReport'][_0x8f0a('0x4b')]()[_0x8f0a('0x24')](respondWithResult(_0x11f4c0,null))[_0x8f0a('0x44')](handleError(_0x11f4c0,null));}; \ No newline at end of file +var _0x2b4a=['count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','fieldName','key','model','map','query','filters','intersection','fields','attributes','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','ChatTransferReport','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x2b4a,0x1ae));var _0xa2b4=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x2b4a[_0x1e3671];return _0x48d5f5;};'use strict';var emlformat=require(_0xa2b4('0x0'));var rimraf=require(_0xa2b4('0x1'));var zipdir=require(_0xa2b4('0x2'));var jsonpatch=require(_0xa2b4('0x3'));var rp=require('request-promise');var moment=require(_0xa2b4('0x4'));var BPromise=require(_0xa2b4('0x5'));var Mustache=require(_0xa2b4('0x6'));var util=require(_0xa2b4('0x7'));var path=require(_0xa2b4('0x8'));var sox=require('sox');var csv=require(_0xa2b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2b4('0xa'));var _=require(_0xa2b4('0xb'));var squel=require(_0xa2b4('0xc'));var crypto=require(_0xa2b4('0xd'));var jsforce=require(_0xa2b4('0xe'));var deskjs=require(_0xa2b4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa2b4('0x10'));var Papa=require('papaparse');var Redis=require(_0xa2b4('0x11'));var authService=require(_0xa2b4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2b4('0x13'));var logger=require(_0xa2b4('0x14'))(_0xa2b4('0x15'));var utils=require(_0xa2b4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa2b4('0x17'));var db=require(_0xa2b4('0x18'))['db'];function respondWithStatusCode(_0x2052cf,_0x5bd61d){_0x5bd61d=_0x5bd61d||0xcc;return function(_0x39c80b){if(_0x39c80b){return _0x2052cf[_0xa2b4('0x19')](_0x5bd61d);}return _0x2052cf[_0xa2b4('0x1a')](_0x5bd61d)[_0xa2b4('0x1b')]();};}function respondWithResult(_0x18f5d8,_0x345373){_0x345373=_0x345373||0xc8;return function(_0x473444){if(_0x473444){return _0x18f5d8[_0xa2b4('0x1a')](_0x345373)[_0xa2b4('0x1c')](_0x473444);}};}function respondWithFilteredResult(_0x1778ea,_0x57756e){return function(_0x483fb6){if(_0x483fb6){var _0x4c245c=typeof _0x57756e[_0xa2b4('0x1d')]==='undefined'&&typeof _0x57756e[_0xa2b4('0x1e')]===_0xa2b4('0x1f');var _0x1d8a67=_0x483fb6['count'];var _0x1ba253=_0x4c245c?0x0:_0x57756e['offset'];var _0x1fb501=_0x4c245c?_0x483fb6[_0xa2b4('0x20')]:_0x57756e[_0xa2b4('0x1d')]+_0x57756e[_0xa2b4('0x1e')];var _0x498c0c;if(_0x1fb501>=_0x1d8a67){_0x1fb501=_0x1d8a67;_0x498c0c=0xc8;}else{_0x498c0c=0xce;}_0x1778ea[_0xa2b4('0x1a')](_0x498c0c);return _0x1778ea[_0xa2b4('0x21')](_0xa2b4('0x22'),_0x1ba253+'-'+_0x1fb501+'/'+_0x1d8a67)['json'](_0x483fb6);}return null;};}function patchUpdates(_0x5b5a7d){return function(_0xe79e77){try{jsonpatch[_0xa2b4('0x23')](_0xe79e77,_0x5b5a7d,!![]);}catch(_0xcc9082){return BPromise[_0xa2b4('0x24')](_0xcc9082);}return _0xe79e77[_0xa2b4('0x25')]();};}function saveUpdates(_0x9f9e8b,_0x2dc1af){return function(_0x4ad01f){if(_0x4ad01f){return _0x4ad01f[_0xa2b4('0x26')](_0x9f9e8b)[_0xa2b4('0x27')](function(_0x3f742f){return _0x3f742f;});}return null;};}function removeEntity(_0x21c144,_0x3b363a){return function(_0x23294b){if(_0x23294b){return _0x23294b[_0xa2b4('0x28')]()[_0xa2b4('0x27')](function(){_0x21c144[_0xa2b4('0x1a')](0xcc)[_0xa2b4('0x1b')]();});}};}function handleEntityNotFound(_0xbe5d41,_0x22485a){return function(_0x49db53){if(!_0x49db53){_0xbe5d41[_0xa2b4('0x19')](0x194);}return _0x49db53;};}function handleError(_0x431454,_0x3e8b26){_0x3e8b26=_0x3e8b26||0x1f4;return function(_0x1c5668){logger['error'](_0x1c5668['stack']);if(_0x1c5668[_0xa2b4('0x29')]){delete _0x1c5668[_0xa2b4('0x29')];}_0x431454[_0xa2b4('0x1a')](_0x3e8b26)[_0xa2b4('0x2a')](_0x1c5668);};}exports[_0xa2b4('0x2b')]=function(_0x29b6c3,_0x3f52d1){var _0x138dd5={},_0x494933={},_0x476d00={'count':0x0,'rows':[]};var _0x55b442=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x4dfc1c){return{'name':_0x4dfc1c[_0xa2b4('0x2c')],'type':_0x4dfc1c['type'][_0xa2b4('0x2d')]};});_0x494933[_0xa2b4('0x2e')]=_[_0xa2b4('0x2f')](_0x55b442,_0xa2b4('0x29'));_0x494933[_0xa2b4('0x30')]=_['keys'](_0x29b6c3[_0xa2b4('0x30')]);_0x494933[_0xa2b4('0x31')]=_['intersection'](_0x494933[_0xa2b4('0x2e')],_0x494933[_0xa2b4('0x30')]);_0x138dd5['attributes']=_[_0xa2b4('0x32')](_0x494933[_0xa2b4('0x2e')],qs[_0xa2b4('0x33')](_0x29b6c3[_0xa2b4('0x30')][_0xa2b4('0x33')]));_0x138dd5[_0xa2b4('0x34')]=_0x138dd5['attributes']['length']?_0x138dd5[_0xa2b4('0x34')]:_0x494933[_0xa2b4('0x2e')];if(!_0x29b6c3[_0xa2b4('0x30')]['hasOwnProperty'](_0xa2b4('0x35'))){_0x138dd5[_0xa2b4('0x1e')]=qs[_0xa2b4('0x1e')](_0x29b6c3['query']['limit']);_0x138dd5[_0xa2b4('0x1d')]=qs[_0xa2b4('0x1d')](_0x29b6c3[_0xa2b4('0x30')][_0xa2b4('0x1d')]);}_0x138dd5[_0xa2b4('0x36')]=qs['sort'](_0x29b6c3[_0xa2b4('0x30')]['sort']);_0x138dd5[_0xa2b4('0x37')]=qs['filters'](_[_0xa2b4('0x38')](_0x29b6c3[_0xa2b4('0x30')],_0x494933['filters']),_0x55b442);if(_0x29b6c3[_0xa2b4('0x30')][_0xa2b4('0x39')]){_0x138dd5[_0xa2b4('0x37')]=_[_0xa2b4('0x3a')](_0x138dd5[_0xa2b4('0x37')],{'$or':_[_0xa2b4('0x2f')](_0x55b442,function(_0x54fdce){if(_0x54fdce[_0xa2b4('0x3b')]!==_0xa2b4('0x3c')){var _0x5a8b81={};_0x5a8b81[_0x54fdce[_0xa2b4('0x29')]]={'$like':'%'+_0x29b6c3[_0xa2b4('0x30')]['filter']+'%'};return _0x5a8b81;}})});}_0x138dd5=_[_0xa2b4('0x3a')]({},_0x138dd5,_0x29b6c3[_0xa2b4('0x3d')]);var _0x3956de={'where':_0x138dd5[_0xa2b4('0x37')]};return db[_0xa2b4('0x3e')][_0xa2b4('0x20')](_0x3956de)[_0xa2b4('0x27')](function(_0xd288e6){_0x476d00[_0xa2b4('0x20')]=_0xd288e6;if(_0x29b6c3[_0xa2b4('0x30')]['includeAll']){_0x138dd5['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xa2b4('0x3f')](_0x138dd5);})[_0xa2b4('0x27')](function(_0x2a216d){_0x476d00[_0xa2b4('0x40')]=_0x2a216d;return _0x476d00;})[_0xa2b4('0x27')](respondWithFilteredResult(_0x3f52d1,_0x138dd5))[_0xa2b4('0x41')](handleError(_0x3f52d1,null));};exports[_0xa2b4('0x42')]=function(_0x1e1a76,_0x2d310c){var _0xf4966c={'raw':!![],'where':{'id':_0x1e1a76[_0xa2b4('0x43')]['id']}},_0x15f922={};_0x15f922[_0xa2b4('0x2e')]=_[_0xa2b4('0x44')](db[_0xa2b4('0x3e')][_0xa2b4('0x45')]);_0x15f922[_0xa2b4('0x30')]=_[_0xa2b4('0x44')](_0x1e1a76[_0xa2b4('0x30')]);_0x15f922['filters']=_[_0xa2b4('0x32')](_0x15f922['model'],_0x15f922['query']);_0xf4966c[_0xa2b4('0x34')]=_[_0xa2b4('0x32')](_0x15f922['model'],qs[_0xa2b4('0x33')](_0x1e1a76['query'][_0xa2b4('0x33')]));_0xf4966c[_0xa2b4('0x34')]=_0xf4966c[_0xa2b4('0x34')][_0xa2b4('0x46')]?_0xf4966c[_0xa2b4('0x34')]:_0x15f922[_0xa2b4('0x2e')];if(_0x1e1a76['query'][_0xa2b4('0x47')]){_0xf4966c[_0xa2b4('0x48')]=[{'all':!![]}];}_0xf4966c=_[_0xa2b4('0x3a')]({},_0xf4966c,_0x1e1a76[_0xa2b4('0x3d')]);return db['ChatTransferReport'][_0xa2b4('0x49')](_0xf4966c)[_0xa2b4('0x27')](handleEntityNotFound(_0x2d310c,null))[_0xa2b4('0x27')](respondWithResult(_0x2d310c,null))[_0xa2b4('0x41')](handleError(_0x2d310c,null));};exports[_0xa2b4('0x4a')]=function(_0x1f79a8,_0xa4f82b){return db[_0xa2b4('0x3e')][_0xa2b4('0x4a')](_0x1f79a8[_0xa2b4('0x4b')],{})[_0xa2b4('0x27')](respondWithResult(_0xa4f82b,0xc9))['catch'](handleError(_0xa4f82b,null));};exports[_0xa2b4('0x26')]=function(_0x59b363,_0x5a7c02){if(_0x59b363[_0xa2b4('0x4b')]['id']){delete _0x59b363['body']['id'];}return db[_0xa2b4('0x3e')][_0xa2b4('0x49')]({'where':{'id':_0x59b363['params']['id']}})[_0xa2b4('0x27')](handleEntityNotFound(_0x5a7c02,null))[_0xa2b4('0x27')](saveUpdates(_0x59b363[_0xa2b4('0x4b')],null))['then'](respondWithResult(_0x5a7c02,null))[_0xa2b4('0x41')](handleError(_0x5a7c02,null));};exports[_0xa2b4('0x28')]=function(_0x1c9565,_0x2ed5e7){return db[_0xa2b4('0x3e')][_0xa2b4('0x49')]({'where':{'id':_0x1c9565[_0xa2b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ed5e7,null))['then'](removeEntity(_0x2ed5e7,null))[_0xa2b4('0x41')](handleError(_0x2ed5e7,null));};exports[_0xa2b4('0x4c')]=function(_0x3c48c8,_0x2f13d1){return db['ChatTransferReport'][_0xa2b4('0x4c')]()['then'](respondWithResult(_0x2f13d1,null))[_0xa2b4('0x41')](handleError(_0x2f13d1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8fe0b16..942be89 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 _0x1dbc=['request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2940a6,_0x3a84ac){var _0x1461cc=function(_0x19598f){while(--_0x19598f){_0x2940a6['push'](_0x2940a6['shift']());}};_0x1461cc(++_0x3a84ac);}(_0x1dbc,0xe8));var _0xc1db=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x1dbc[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0xc1db('0x0'));var util=require(_0xc1db('0x1'));var logger=require(_0xc1db('0x2'))(_0xc1db('0x3'));var moment=require(_0xc1db('0x4'));var BPromise=require(_0xc1db('0x5'));var rp=require(_0xc1db('0x6'));var fs=require('fs');var path=require(_0xc1db('0x7'));var rimraf=require('rimraf');var config=require(_0xc1db('0x8'));var attributes=require(_0xc1db('0x9'));module[_0xc1db('0xa')]=function(_0x2e068c,_0x2f56f6){return _0x2e068c[_0xc1db('0xb')](_0xc1db('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc1db('0xd'),'fields':[_0xc1db('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6db3=['path','../../config/environment','./chatTransferReport.attributes','define','report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf5832e,_0x539dc4){var _0x57ad7f=function(_0x36166f){while(--_0x36166f){_0xf5832e['push'](_0xf5832e['shift']());}};_0x57ad7f(++_0x539dc4);}(_0x6db3,0xad));var _0x36db=function(_0x39fd35,_0x3d42de){_0x39fd35=_0x39fd35-0x0;var _0x247711=_0x6db3[_0x39fd35];return _0x247711;};'use strict';var _=require(_0x36db('0x0'));var util=require(_0x36db('0x1'));var logger=require(_0x36db('0x2'))(_0x36db('0x3'));var moment=require(_0x36db('0x4'));var BPromise=require(_0x36db('0x5'));var rp=require(_0x36db('0x6'));var fs=require('fs');var path=require(_0x36db('0x7'));var rimraf=require('rimraf');var config=require(_0x36db('0x8'));var attributes=require(_0x36db('0x9'));module['exports']=function(_0x1b4aa8,_0x1172fe){return _0x1b4aa8[_0x36db('0xa')]('ChatTransferReport',attributes,{'tableName':_0x36db('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5bf3c48..246fd93 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 _0xa7cf=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa7cf,0xf1));var _0xfa7c=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0xa7cf[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require(_0xfa7c('0x0'));var util=require(_0xfa7c('0x1'));var moment=require(_0xfa7c('0x2'));var BPromise=require(_0xfa7c('0x3'));var rs=require(_0xfa7c('0x4'));var fs=require('fs');var Redis=require(_0xfa7c('0x5'));var db=require(_0xfa7c('0x6'))['db'];var utils=require(_0xfa7c('0x7'));var logger=require(_0xfa7c('0x8'))(_0xfa7c('0x9'));var config=require(_0xfa7c('0xa'));var jayson=require(_0xfa7c('0xb'));var client=jayson[_0xfa7c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fcc11,_0x213497,_0x107826){return new BPromise(function(_0x3250b5,_0x4483fd){return client['request'](_0x1fcc11,_0x107826)[_0xfa7c('0xd')](function(_0x5d5bb1){logger[_0xfa7c('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x213497,'request\x20sent');logger[_0xfa7c('0xf')](_0xfa7c('0x10'),_0x213497,'request\x20sent',JSON[_0xfa7c('0x11')](_0x5d5bb1));if(_0x5d5bb1[_0xfa7c('0x12')]){if(_0x5d5bb1['error'][_0xfa7c('0x13')]===0x1f4){logger['error'](_0xfa7c('0x14'),_0x213497,_0x5d5bb1[_0xfa7c('0x12')][_0xfa7c('0x15')]);return _0x4483fd(_0x5d5bb1[_0xfa7c('0x12')][_0xfa7c('0x15')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x213497,_0x5d5bb1[_0xfa7c('0x12')][_0xfa7c('0x15')]);return _0x3250b5(_0x5d5bb1[_0xfa7c('0x12')][_0xfa7c('0x15')]);}else{logger[_0xfa7c('0xe')](_0xfa7c('0x14'),_0x213497,_0xfa7c('0x16'));_0x3250b5(_0x5d5bb1[_0xfa7c('0x17')][_0xfa7c('0x15')]);}})['catch'](function(_0x19ec52){logger[_0xfa7c('0x12')](_0xfa7c('0x14'),_0x213497,_0x19ec52);_0x4483fd(_0x19ec52);});});} \ No newline at end of file +var _0xfd48=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1176ca,_0x5e7eb4){var _0x273488=function(_0x4fd4c9){while(--_0x4fd4c9){_0x1176ca['push'](_0x1176ca['shift']());}};_0x273488(++_0x5e7eb4);}(_0xfd48,0x15f));var _0x8fd4=function(_0x53e643,_0x418871){_0x53e643=_0x53e643-0x0;var _0xd5f80b=_0xfd48[_0x53e643];return _0xd5f80b;};'use strict';var _=require(_0x8fd4('0x0'));var util=require(_0x8fd4('0x1'));var moment=require(_0x8fd4('0x2'));var BPromise=require(_0x8fd4('0x3'));var rs=require(_0x8fd4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd4('0x5'))['db'];var utils=require(_0x8fd4('0x6'));var logger=require(_0x8fd4('0x7'))(_0x8fd4('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fd4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38e20d,_0x592cc1,_0x522d74){return new BPromise(function(_0x209c05,_0x3c057b){return client[_0x8fd4('0xa')](_0x38e20d,_0x522d74)[_0x8fd4('0xb')](function(_0x3d8fe3){logger['info'](_0x8fd4('0xc'),_0x592cc1,_0x8fd4('0xd'));logger[_0x8fd4('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x592cc1,'request\x20sent',JSON[_0x8fd4('0xf')](_0x3d8fe3));if(_0x3d8fe3[_0x8fd4('0x10')]){if(_0x3d8fe3['error'][_0x8fd4('0x11')]===0x1f4){logger[_0x8fd4('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x592cc1,_0x3d8fe3['error'][_0x8fd4('0x12')]);return _0x3c057b(_0x3d8fe3[_0x8fd4('0x10')]['message']);}logger[_0x8fd4('0x10')](_0x8fd4('0xc'),_0x592cc1,_0x3d8fe3[_0x8fd4('0x10')]['message']);return _0x209c05(_0x3d8fe3['error'][_0x8fd4('0x12')]);}else{logger[_0x8fd4('0x13')](_0x8fd4('0xc'),_0x592cc1,_0x8fd4('0xd'));_0x209c05(_0x3d8fe3[_0x8fd4('0x14')][_0x8fd4('0x12')]);}})[_0x8fd4('0x15')](function(_0x708bc2){logger[_0x8fd4('0x10')](_0x8fd4('0xc'),_0x592cc1,_0x708bc2);_0x3c057b(_0x708bc2);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2da1433..b13903c 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 _0x9cfb=['connect-timeout','fs-extra','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x9cfb,0xa8));var _0xb9cf=function(_0xf2ad49,_0xfc0721){_0xf2ad49=_0xf2ad49-0x0;var _0x388626=_0x9cfb[_0xf2ad49];return _0x388626;};'use strict';var multer=require(_0xb9cf('0x0'));var util=require(_0xb9cf('0x1'));var path=require('path');var timeout=require(_0xb9cf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb9cf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb9cf('0x4'));var controller=require(_0xb9cf('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb9cf('0x6')](_0xb9cf('0x7'),auth[_0xb9cf('0x8')](),controller[_0xb9cf('0x9')]);router[_0xb9cf('0x6')](_0xb9cf('0xa'),auth['isAuthenticated'](),controller[_0xb9cf('0xb')]);router[_0xb9cf('0xc')]('/',auth[_0xb9cf('0x8')](),controller[_0xb9cf('0xd')]);router[_0xb9cf('0xe')](_0xb9cf('0xa'),auth[_0xb9cf('0x8')](),controller[_0xb9cf('0xf')]);router['delete']('/:id',auth[_0xb9cf('0x8')](),controller['destroy']);module[_0xb9cf('0x10')]=router; \ No newline at end of file +var _0x9c95=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x1a2883,_0x2a23eb){var _0x47a8cf=function(_0x21188){while(--_0x21188){_0x1a2883['push'](_0x1a2883['shift']());}};_0x47a8cf(++_0x2a23eb);}(_0x9c95,0x1a0));var _0x59c9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9c95[_0x476bf4];return _0x788ffe;};'use strict';var multer=require(_0x59c9('0x0'));var util=require('util');var path=require(_0x59c9('0x1'));var timeout=require(_0x59c9('0x2'));var express=require(_0x59c9('0x3'));var router=express[_0x59c9('0x4')]();var fs_extra=require(_0x59c9('0x5'));var auth=require(_0x59c9('0x6'));var interaction=require(_0x59c9('0x7'));var config=require('../../config/environment');var controller=require(_0x59c9('0x8'));router[_0x59c9('0x9')]('/',auth[_0x59c9('0xa')](),controller['index']);router[_0x59c9('0x9')](_0x59c9('0xb'),auth['isAuthenticated'](),controller[_0x59c9('0xc')]);router[_0x59c9('0x9')](_0x59c9('0xd'),auth[_0x59c9('0xa')](),controller[_0x59c9('0xe')]);router[_0x59c9('0xf')]('/',auth[_0x59c9('0xa')](),controller[_0x59c9('0x10')]);router[_0x59c9('0x11')](_0x59c9('0xd'),auth[_0x59c9('0xa')](),controller[_0x59c9('0x12')]);router[_0x59c9('0x13')](_0x59c9('0xd'),auth[_0x59c9('0xa')](),controller['destroy']);module[_0x59c9('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 96b8e21..ded4da5 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 _0xb628=['exports','STRING','email','#011F6A','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring'];(function(_0x595fea,_0x1f7e6f){var _0x20ce9b=function(_0xc167d1){while(--_0xc167d1){_0x595fea['push'](_0x595fea['shift']());}};_0x20ce9b(++_0x1f7e6f);}(_0xb628,0xf3));var _0x8b62=function(_0x1e42f2,_0x1fece5){_0x1e42f2=_0x1e42f2-0x0;var _0x262489=_0xb628[_0x1e42f2];return _0x262489;};'use strict';var Sequelize=require(_0x8b62('0x0'));var rs=require(_0x8b62('0x1'));module[_0x8b62('0x2')]={'name':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8b62('0x3')]},'mapKey':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':_0x8b62('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':_0x8b62('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':_0x8b62('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8b62('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8b62('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8b62('0x8')](_0x8b62('0x9'),'squared'),'defaultValue':_0x8b62('0x9')},'header_online':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0xa')},'start_chat_button':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x8b62('0xc')},'download_transcript':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8b62('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8b62('0xe')]},'closingQuestion':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x10')},'closingMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x11')},'closingMessageButton':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0xb')},'skipMessageButton':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x13')},'ratingType':{'type':Sequelize[_0x8b62('0x8')](_0x8b62('0x14'),_0x8b62('0x15')),'defaultValue':_0x8b62('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8b62('0xe')],'defaultValue':function(){return JSON[_0x8b62('0x16')]({'items':[{'type':_0x8b62('0x17'),'variable':null,'config':{'placeholder':_0x8b62('0x18'),'type':_0x8b62('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8b62('0x1a')](_0x8b62('0x1b'))?JSON[_0x8b62('0x1c')](this[_0x8b62('0x1a')](_0x8b62('0x1b'))):{};},'set':function(_0x31afe8){return this['setDataValue'](_0x8b62('0x1b'),JSON[_0x8b62('0x16')](_0x31afe8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8b62('0x16')]({'items':[{'type':_0x8b62('0x17'),'props':{'title':_0x8b62('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8b62('0x4'),'type':_0x8b62('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x8b62('0x1d'),'helpText':_0x8b62('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x8b62('0x1a')]('offlineForm')?JSON['parse'](this[_0x8b62('0x1a')](_0x8b62('0x1f'))):{};},'set':function(_0x158e24){return this[_0x8b62('0x20')](_0x8b62('0x1f'),JSON[_0x8b62('0x16')](_0x158e24));}},'token':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':function(){return rs[_0x8b62('0x21')]();}},'autoclose':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8b62('0x3')]},'forwardOffline':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x22')},'waitingMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x8b62('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x26')},'skipUnmanaged':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x12')},'sendUnmanaged':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8b62('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8b62('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8b62('0xe')],'defaultValue':function(){return _0x8b62('0x27');}},'notificationSound':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b62('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8b62('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x29')},'verticalAlignment':{'type':Sequelize[_0x8b62('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x2a')},'messagesAlignment':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x2b')},'defaultTitle':{'type':Sequelize[_0x8b62('0x3')]},'customerAvatar':{'type':Sequelize[_0x8b62('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':_0x8b62('0x2c')},'systemAvatar':{'type':Sequelize[_0x8b62('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b62('0x7')],'comment':_0x8b62('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![],'comment':_0x8b62('0x2e'),'set':function(_0x35b2e3){if(!_0x35b2e3)this[_0x8b62('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x35b2e3);}},'vidaooEscalation':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x8b62('0x3')],'allowNull':![],'defaultValue':_0x8b62('0x2f')},'vidaooNote':{'type':Sequelize[_0x8b62('0x3')],'defaultValue':function(){return _0x8b62('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x8b62('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8b62('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8b62('0xe')]}}; \ No newline at end of file +var _0xa50b=['parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','stringify','name','input','getDataValue','onlineForm'];(function(_0xe56790,_0x5f304d){var _0x145cf7=function(_0x49aeb1){while(--_0x49aeb1){_0xe56790['push'](_0xe56790['shift']());}};_0x145cf7(++_0x5f304d);}(_0xa50b,0x1a4));var _0xba50=function(_0x6e8f24,_0x58e420){_0x6e8f24=_0x6e8f24-0x0;var _0x4e0c79=_0xa50b[_0x6e8f24];return _0x4e0c79;};'use strict';var Sequelize=require(_0xba50('0x0'));var rs=require(_0xba50('0x1'));module['exports']={'name':{'type':Sequelize[_0xba50('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xba50('0x2')],'allowNull':![],'unique':_0xba50('0x3')},'description':{'type':Sequelize[_0xba50('0x2')]},'mapKey':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x4')},'mapKeyOffline':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x4')},'key':{'type':Sequelize[_0xba50('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x5')},'customerAlias':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xba50('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba50('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xba50('0x2')],'allowNull':![],'defaultValue':_0xba50('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba50('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xba50('0x2')]},'animation':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xba50('0x9'),_0xba50('0xa')),'defaultValue':_0xba50('0x9')},'header_online':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xb')},'start_chat_button':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xc')},'offline_chat_button':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xd')},'header_offline':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xba50('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xba50('0x10')]},'closingQuestion':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x12')},'noteTitle':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x13')},'closingMessage':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x14')},'closingMessageButton':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xd')},'skipMessageButton':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x15')},'conditionAgreement':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x16')},'ratingType':{'type':Sequelize[_0xba50('0x17')](_0xba50('0x18'),'thumb'),'defaultValue':_0xba50('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xba50('0x10')],'defaultValue':function(){return JSON[_0xba50('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xba50('0x1a'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xba50('0x1b'),'props':{'title':_0xba50('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xba50('0x4'),'type':_0xba50('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xba50('0x1c')](_0xba50('0x1d'))?JSON[_0xba50('0x1e')](this[_0xba50('0x1c')](_0xba50('0x1d'))):{};},'set':function(_0x31736f){return this['setDataValue'](_0xba50('0x1d'),JSON[_0xba50('0x19')](_0x31736f));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xba50('0x1b'),'props':{'title':_0xba50('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xba50('0x4'),'type':_0xba50('0x4')},'variable':null},{'type':_0xba50('0x1f'),'config':{'placeholder':_0xba50('0x20')},'props':{'title':_0xba50('0x20'),'helpText':_0xba50('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xba50('0x22'))?JSON[_0xba50('0x1e')](this['getDataValue'](_0xba50('0x22'))):{};},'set':function(_0x28b591){return this[_0xba50('0x23')](_0xba50('0x22'),JSON[_0xba50('0x19')](_0x28b591));}},'token':{'type':Sequelize[_0xba50('0x2')],'defaultValue':function(){return rs[_0xba50('0x24')]();}},'autoclose':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xba50('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xba50('0x2')]},'waitingTitle':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xba50('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x26')},'skipUnmanaged':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x15')},'sendUnmanaged':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xba50('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xba50('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xba50('0x27');}},'notificationSound':{'type':Sequelize[_0xba50('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xba50('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xba50('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xba50('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xba50('0x2')],'defaultValue':_0xba50('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xba50('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xba50('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xba50('0x2')],'allowNull':![],'defaultValue':_0xba50('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba50('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba50('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xba50('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xba50('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba50('0xe')],'comment':_0xba50('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![],'comment':_0xba50('0x2d'),'set':function(_0x243fd6){if(!_0x243fd6)this[_0xba50('0x23')](_0xba50('0x2e'),null);this[_0xba50('0x23')](_0xba50('0x2f'),_0x243fd6);}},'vidaooEscalation':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xba50('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba50('0x30')},'vidaooNote':{'type':Sequelize[_0xba50('0x2')],'defaultValue':function(){return _0xba50('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xba50('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xba50('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3ad1ea9..99dfa4a 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 _0x5cc1=['server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','chat','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','ChatApplication','Applications','spread','list','priority','asc','account','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','push','close','unmanaged','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','EventManager','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','email','MailAccountId','originalname','toPairsIn','mapValues','lastName','offlineMessageSubject','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','hasOwnProperty','Contact','User','Owner','fullname','Tag','Tags','tag','getProactiveActions','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','color','labelText','textColor','textButtonColor','color_button','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','getFields','online','offlineForm','onlineForm','items','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','path','fs-extra','lodash','querystring','ioredis','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','defaults','redis','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','ChatWebsites','UserProfileResource','stack','name','send','getSnippet','format','iftime\x20%s,%s','interval','timezone','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Interval','Intervals','get','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','x-forwarded-for','first','split','firstName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','index','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','Pause','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','body','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','order','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','sitepic','addAvatar','agentAvatar','file','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','join','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x5cc1,0x1c1));var _0x15cc=function(_0x5f026e,_0x224df5){_0x5f026e=_0x5f026e-0x0;var _0x2f74a1=_0x5cc1[_0x5f026e];return _0x2f74a1;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require(_0x15cc('0x0'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15cc('0x1'));var _=require(_0x15cc('0x2'));var querystring=require(_0x15cc('0x3'));var htmlToText=require('html-to-text');var Redis=require(_0x15cc('0x4'));var jayson=require(_0x15cc('0x5'));var url=require('url');var qs=require('../../components/parsers/qs');var logger=require(_0x15cc('0x6'))(_0x15cc('0x7'));var config=require(_0x15cc('0x8'));var APIOutOfIntervalError=require(_0x15cc('0x9'))[_0x15cc('0xa')];var APINotFoundError=require(_0x15cc('0x9'))[_0x15cc('0xb')];var APIHandleError=require(_0x15cc('0x9'))['handleError'];var db=require(_0x15cc('0xc'))['db'];config['redis']=_[_0x15cc('0xd')](config[_0x15cc('0xe')],{'host':_0x15cc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x15cc('0x10'))[_0x15cc('0x11')](socket);var client=jayson[_0x15cc('0x12')]['http']({'port':0x232c});var client9002=jayson[_0x15cc('0x12')][_0x15cc('0x13')]({'port':0x232a});var client9003=jayson[_0x15cc('0x12')]['http']({'port':0x232b});var client9001=jayson['client'][_0x15cc('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x155800,_0x59f052,_0x236f46,_0x1f6704){return new Promise(function(_0x5e0767,_0x18687d){var _0x293f23=_0x1f6704||client;return _0x293f23[_0x15cc('0x14')](_0x155800,_0x236f46)[_0x15cc('0x15')](function(_0x1e1c79){logger[_0x15cc('0x16')](_0x15cc('0x17'),_0x59f052,'request\x20sent');logger[_0x15cc('0x18')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x59f052,_0x15cc('0x19'),JSON[_0x15cc('0x1a')](_0x1e1c79));if(_0x1e1c79['error']){if(_0x1e1c79['error'][_0x15cc('0x1b')]===0x1f4){logger[_0x15cc('0x1c')](_0x15cc('0x17'),_0x59f052,_0x1e1c79[_0x15cc('0x1c')][_0x15cc('0x1d')]);return _0x18687d(_0x1e1c79[_0x15cc('0x1c')][_0x15cc('0x1d')]);}logger[_0x15cc('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x59f052,_0x1e1c79[_0x15cc('0x1c')][_0x15cc('0x1d')]);return _0x5e0767(_0x1e1c79['error'][_0x15cc('0x1d')]);}else{logger['info'](_0x15cc('0x17'),_0x59f052,_0x15cc('0x19'));_0x5e0767(_0x1e1c79[_0x15cc('0x1e')][_0x15cc('0x1d')]);}})['catch'](function(_0xbf12c3){logger['error'](_0x15cc('0x17'),_0x59f052,_0xbf12c3);_0x18687d(_0xbf12c3);});});}function respondWithStatusCode(_0x593c5f,_0x1b24e4){_0x1b24e4=_0x1b24e4||0xcc;return function(_0x2b6b18){if(_0x2b6b18){return _0x593c5f[_0x15cc('0x1f')](_0x1b24e4);}return _0x593c5f[_0x15cc('0x20')](_0x1b24e4)[_0x15cc('0x21')]();};}function respondWithResult(_0x56eb5b,_0x19a27e){_0x19a27e=_0x19a27e||0xc8;return function(_0x1d12af){if(_0x1d12af){return _0x56eb5b['status'](_0x19a27e)[_0x15cc('0x22')](_0x1d12af);}};}function respondWithFilteredResult(_0x4d66b0,_0x46b6e6){return function(_0x42b00e){if(_0x42b00e){var _0x131bc2=typeof _0x46b6e6[_0x15cc('0x23')]==='undefined'&&typeof _0x46b6e6[_0x15cc('0x24')]===_0x15cc('0x25');var _0x31f8b1=_0x42b00e[_0x15cc('0x26')];var _0xc41dc0=_0x131bc2?0x0:_0x46b6e6[_0x15cc('0x23')];var _0x730b6a=_0x131bc2?_0x42b00e['count']:_0x46b6e6[_0x15cc('0x23')]+_0x46b6e6[_0x15cc('0x24')];var _0x2502bf;if(_0x730b6a>=_0x31f8b1){_0x730b6a=_0x31f8b1;_0x2502bf=0xc8;}else{_0x2502bf=0xce;}_0x4d66b0[_0x15cc('0x20')](_0x2502bf);return _0x4d66b0[_0x15cc('0x27')](_0x15cc('0x28'),_0xc41dc0+'-'+_0x730b6a+'/'+_0x31f8b1)[_0x15cc('0x22')](_0x42b00e);}return null;};}function saveUpdates(_0x5a6bec){return function(_0x4e70d7){if(_0x4e70d7){return _0x4e70d7[_0x15cc('0x29')](_0x5a6bec)[_0x15cc('0x15')](function(_0x3af015){return _0x3af015;});}return null;};}function removeEntity(_0x3d6c22){return function(_0x17f002){if(_0x17f002){return _0x17f002[_0x15cc('0x2a')]()['then'](function(){var _0x32ac02=_0x17f002['get']({'plain':!![]});var _0x2f9511=_0x15cc('0x2b');return db[_0x15cc('0x2c')][_0x15cc('0x2a')]({'where':{'type':_0x2f9511,'resourceId':_0x32ac02['id']}})[_0x15cc('0x15')](function(){return _0x17f002;});})[_0x15cc('0x15')](function(){_0x3d6c22['status'](0xcc)[_0x15cc('0x21')]();});}};}function handleEntityNotFound(_0x1dcb1f){return function(_0x2815e3){if(!_0x2815e3){_0x1dcb1f[_0x15cc('0x1f')](0x194);}return _0x2815e3;};}function handleError(_0x31994a,_0x3d94b0){_0x3d94b0=_0x3d94b0||0x1f4;return function(_0x1c865e){logger[_0x15cc('0x1c')](_0x1c865e[_0x15cc('0x2d')]);if(_0x1c865e[_0x15cc('0x2e')]){delete _0x1c865e[_0x15cc('0x2e')];}_0x31994a[_0x15cc('0x20')](_0x3d94b0)[_0x15cc('0x2f')](_0x1c865e);};}function iftimePromise(_0x43e528,_0x4a4400){return respondWithRpcPromise('Command',_0x15cc('0x30'),{'command':_0x4a4400['timezone']?util[_0x15cc('0x31')](_0x15cc('0x32'),_0x43e528[_0x15cc('0x33')],_0x4a4400[_0x15cc('0x34')]):util[_0x15cc('0x31')]('iftime\x20%s',_0x43e528[_0x15cc('0x33')])},client9002)['then'](function(_0xb9ac88){var _0x481e68=_0xb9ac88&&_0xb9ac88[_0x15cc('0x35')](_0x15cc('0x36'))>=0x0?!![]:![];logger[_0x15cc('0x16')](_0x15cc('0x37'),_0x4a4400['id'],_0x43e528['id'],_0x43e528[_0x15cc('0x33')],_0x481e68?_0x15cc('0x38'):_0x15cc('0x39'),_0x4a4400[_0x15cc('0x34')]?_0x4a4400[_0x15cc('0x34')]:_0x15cc('0x3a'));return _0x481e68;})['catch'](function(_0x188bbf){logger[_0x15cc('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4a4400['id'],_0x43e528['id'],_0x43e528[_0x15cc('0x33')],util[_0x15cc('0x3b')](_0x188bbf,{'showHidden':![],'depth':null}),_0x4a4400[_0x15cc('0x34')]?_0x4a4400[_0x15cc('0x34')]:_0x15cc('0x3a'));return![];});}function checkWebsiteIntervals(_0x405dcf){var _0x18374d=_[_0x15cc('0x3c')](_0x405dcf[_0x15cc('0x3d')][_0x15cc('0x3e')],function(_0x45510d){var _0x1ca62b=_0x45510d[_0x15cc('0x3f')]({'plain':!![]});return iftimePromise(_0x1ca62b,_0x405dcf);});return Promise[_0x15cc('0x40')](_0x18374d)[_0x15cc('0x15')](function(_0x312acb){return _[_0x15cc('0x41')](_0x312acb);});}function createInteractionObject(_0x420bdc,_0xa6fb49,_0x5310dd,_0x33e79b){var _0x28ab58=require(_0x15cc('0x42'));var _0x110acb=new _0x28ab58();var _0x1aae42=_0x110acb[_0x15cc('0x43')](_0x5310dd[_0x15cc('0x44')])[_0x15cc('0x45')]();var _0x13bbef=_0xa6fb49[_0x15cc('0x46')];if(_0x5310dd['cf-connecting-ip']){_0x13bbef=_0x5310dd['cf-connecting-ip'];}else if(_0x5310dd[_0x15cc('0x47')]){_0x13bbef=_[_0x15cc('0x48')](_0x5310dd[_0x15cc('0x47')][_0x15cc('0x49')](','));}return{'ContactId':_0x33e79b['id'],'ChatWebsiteId':_0x420bdc,'from':(_0x33e79b[_0x15cc('0x4a')]||'')+'\x20'+(_0x33e79b['lastName']||''),'customerIp':_0x13bbef,'customerPort':_0x5310dd[_0x15cc('0x4b')]?_0x5310dd['x-real-port']:null,'referer':_0xa6fb49['referer'],'browserName':_0x1aae42[_0x15cc('0x4c')][_0x15cc('0x2e')]&&_0x1aae42[_0x15cc('0x4c')][_0x15cc('0x4d')]?util[_0x15cc('0x31')](_0x15cc('0x4e'),_0x1aae42[_0x15cc('0x4c')][_0x15cc('0x2e')],_0x1aae42[_0x15cc('0x4c')][_0x15cc('0x4d')]):_0x15cc('0x4f'),'browserVersion':_0x1aae42[_0x15cc('0x4c')]['version']||_0x15cc('0x4f'),'osName':util[_0x15cc('0x31')](_0x15cc('0x4e'),_0x1aae42['os'][_0x15cc('0x2e')],_0x1aae42['os'][_0x15cc('0x4d')]),'osVersion':_0x1aae42['os'][_0x15cc('0x4d')],'deviceModel':_0x1aae42[_0x15cc('0x50')]['model']&&_0x1aae42[_0x15cc('0x50')][_0x15cc('0x51')]?util[_0x15cc('0x31')](_0x15cc('0x52'),_0x1aae42[_0x15cc('0x50')][_0x15cc('0x53')],_0x1aae42['device'][_0x15cc('0x51')],_0x1aae42[_0x15cc('0x50')]['type']):null,'deviceVendor':_0x1aae42['device']['vendor'],'deviceType':_0x1aae42[_0x15cc('0x50')]['type'],'formData':JSON[_0x15cc('0x1a')](_0xa6fb49)};}exports[_0x15cc('0x54')]=function(_0x1da8aa,_0x3f262b){var _0x139909={'include':[{'model':db['Pause'],'as':_0x15cc('0x55')}]},_0x4b7ed7={},_0x1088d7={'count':0x0,'rows':[]};var _0x264cd2=_[_0x15cc('0x3c')](db[_0x15cc('0x56')]['rawAttributes'],function(_0x36541b){return{'name':_0x36541b[_0x15cc('0x57')],'type':_0x36541b[_0x15cc('0x58')][_0x15cc('0x59')]};});_0x4b7ed7[_0x15cc('0x53')]=_[_0x15cc('0x3c')](_0x264cd2,_0x15cc('0x2e'));_0x4b7ed7[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x1da8aa[_0x15cc('0x5a')]);_0x4b7ed7[_0x15cc('0x5c')]=_[_0x15cc('0x5d')](_0x4b7ed7['model'],_0x4b7ed7['query']);_0x139909['attributes']=_[_0x15cc('0x5d')](_0x4b7ed7['model'],qs['fields'](_0x1da8aa['query'][_0x15cc('0x5e')]));_0x139909[_0x15cc('0x5f')]=_0x139909[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x139909['attributes']:_0x4b7ed7['model'];if(!_0x1da8aa[_0x15cc('0x5a')]['hasOwnProperty'](_0x15cc('0x61'))){_0x139909[_0x15cc('0x24')]=qs['limit'](_0x1da8aa['query']['limit']);_0x139909[_0x15cc('0x23')]=qs['offset'](_0x1da8aa[_0x15cc('0x5a')][_0x15cc('0x23')]);}_0x139909['order']=qs[_0x15cc('0x62')](_0x1da8aa[_0x15cc('0x5a')][_0x15cc('0x62')]);_0x139909[_0x15cc('0x63')]=qs['filters'](_[_0x15cc('0x64')](_0x1da8aa[_0x15cc('0x5a')],_0x4b7ed7['filters']),_0x264cd2);if(_0x1da8aa[_0x15cc('0x5a')][_0x15cc('0x65')]){_0x139909[_0x15cc('0x63')]=_[_0x15cc('0x66')](_0x139909['where'],{'$or':_['map'](_0x264cd2,function(_0x440396){if(_0x440396[_0x15cc('0x58')]!==_0x15cc('0x67')){var _0x578a2e={};_0x578a2e[_0x440396['name']]={'$like':'%'+_0x1da8aa['query'][_0x15cc('0x65')]+'%'};return _0x578a2e;}})});}_0x139909=_[_0x15cc('0x66')]({},_0x139909,_0x1da8aa[_0x15cc('0x68')]);var _0x17814d={'where':_0x139909[_0x15cc('0x63')]};return db[_0x15cc('0x56')][_0x15cc('0x26')](_0x17814d)[_0x15cc('0x15')](function(_0x413e9f){_0x1088d7[_0x15cc('0x26')]=_0x413e9f;if(_0x1da8aa[_0x15cc('0x5a')][_0x15cc('0x69')]){_0x139909[_0x15cc('0x6a')]=[{'all':!![]}];}return db[_0x15cc('0x56')][_0x15cc('0x6b')](_0x139909);})[_0x15cc('0x15')](function(_0x41aed7){_0x1088d7[_0x15cc('0x6c')]=_0x41aed7;return _0x1088d7;})[_0x15cc('0x15')](respondWithFilteredResult(_0x3f262b,_0x139909))[_0x15cc('0x6d')](handleError(_0x3f262b,null));};exports[_0x15cc('0x6e')]=function(_0x54690c,_0x353eff){var _0x55ca97={'raw':![],'where':{'id':_0x54690c['params']['id']},'include':[{'model':db[_0x15cc('0x6f')],'as':'mandatoryDispositionPause'}]},_0x568579={};_0x568579[_0x15cc('0x53')]=_['keys'](db[_0x15cc('0x56')][_0x15cc('0x70')]);_0x568579[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x54690c[_0x15cc('0x5a')]);_0x568579[_0x15cc('0x5c')]=_[_0x15cc('0x5d')](_0x568579[_0x15cc('0x53')],_0x568579[_0x15cc('0x5a')]);_0x55ca97['attributes']=_[_0x15cc('0x5d')](_0x568579[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x54690c[_0x15cc('0x5a')][_0x15cc('0x5e')]));_0x55ca97['attributes']=_0x55ca97[_0x15cc('0x5f')]['length']?_0x55ca97[_0x15cc('0x5f')]:_0x568579['model'];if(_0x54690c[_0x15cc('0x5a')][_0x15cc('0x69')]){_0x55ca97[_0x15cc('0x6a')]=[{'all':!![]}];}_0x55ca97=_['merge']({},_0x55ca97,_0x54690c['options']);return db[_0x15cc('0x56')]['find'](_0x55ca97)['then'](handleEntityNotFound(_0x353eff,null))['then'](respondWithResult(_0x353eff,null))[_0x15cc('0x6d')](handleError(_0x353eff,null));};exports[_0x15cc('0x71')]=function(_0x4212b4,_0x1b1ef5){return db[_0x15cc('0x56')][_0x15cc('0x71')](_0x4212b4['body'],{})[_0x15cc('0x15')](function(_0xa91862){var _0x52f52f=_0x4212b4[_0x15cc('0x72')][_0x15cc('0x3f')]({'plain':!![]});if(!_0x52f52f)throw new Error(_0x15cc('0x73'));if(_0x52f52f[_0x15cc('0x74')]==='user'){var _0x4b5005=_0xa91862[_0x15cc('0x3f')]({'plain':!![]});var _0x5ca81b='ChatWebsites';return db[_0x15cc('0x75')][_0x15cc('0x76')]({'where':{'name':_0x5ca81b,'userProfileId':_0x52f52f[_0x15cc('0x77')]},'raw':!![]})[_0x15cc('0x15')](function(_0x17bbb5){if(_0x17bbb5&&_0x17bbb5[_0x15cc('0x78')]===0x0){return db[_0x15cc('0x2c')][_0x15cc('0x71')]({'name':_0x4b5005[_0x15cc('0x2e')],'resourceId':_0x4b5005['id'],'type':_0x17bbb5['name'],'sectionId':_0x17bbb5['id']},{})['then'](function(){return _0xa91862;});}else{return _0xa91862;}})[_0x15cc('0x6d')](function(_0x3ed324){logger[_0x15cc('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ed324);throw _0x3ed324;});}return _0xa91862;})['then'](respondWithResult(_0x1b1ef5,0xc9))[_0x15cc('0x6d')](handleError(_0x1b1ef5,null));};exports[_0x15cc('0x29')]=function(_0x1ec51a,_0x205c5c){if(_0x1ec51a['body']['id']){delete _0x1ec51a['body']['id'];}return db['ChatWebsite'][_0x15cc('0x76')]({'where':{'id':_0x1ec51a[_0x15cc('0x79')]['id']},'include':[{'model':db[_0x15cc('0x6f')],'as':_0x15cc('0x55')}]})[_0x15cc('0x15')](handleEntityNotFound(_0x205c5c,null))[_0x15cc('0x15')](saveUpdates(_0x1ec51a[_0x15cc('0x7a')],null))[_0x15cc('0x15')](respondWithResult(_0x205c5c,null))[_0x15cc('0x6d')](handleError(_0x205c5c,null));};exports[_0x15cc('0x2a')]=function(_0x9f61c,_0x11d21a){return db[_0x15cc('0x56')]['find']({'where':{'id':_0x9f61c['params']['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x11d21a,null))[_0x15cc('0x15')](removeEntity(_0x11d21a,null))[_0x15cc('0x6d')](handleError(_0x11d21a,null));};exports[_0x15cc('0x7b')]=function(_0xb337e4,_0x2ec7d2){return db[_0x15cc('0x56')][_0x15cc('0x7b')]()[_0x15cc('0x15')](respondWithResult(_0x2ec7d2,null))[_0x15cc('0x6d')](handleError(_0x2ec7d2,null));};exports[_0x15cc('0x7c')]=function(_0xd536ce,_0x590f53){if(_0xd536ce[_0x15cc('0x7a')]['id']){delete _0xd536ce[_0x15cc('0x7a')]['id'];}return db['ChatWebsite'][_0x15cc('0x76')]({'where':{'id':_0xd536ce[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x590f53,null))[_0x15cc('0x15')](function(_0x19ab9c){if(_0x19ab9c){_0xd536ce[_0x15cc('0x7a')][_0x15cc('0x7d')]=_0x19ab9c['id'];return db['Disposition'][_0x15cc('0x71')](_0xd536ce[_0x15cc('0x7a')]);}})['then'](respondWithResult(_0x590f53,null))[_0x15cc('0x6d')](handleError(_0x590f53,null));};exports[_0x15cc('0x7e')]=function(_0x524cb6,_0x6c51bb){var _0x29407d={'raw':![],'where':{}};var _0x2dcd1c={};var _0x58f802={'count':0x0,'rows':[]};return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x524cb6[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x6c51bb,null))[_0x15cc('0x15')](function(_0x17a3ee){if(_0x17a3ee){_0x2dcd1c['model']=_[_0x15cc('0x5b')](db['Disposition'][_0x15cc('0x70')]);_0x2dcd1c[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x524cb6['query']);_0x2dcd1c[_0x15cc('0x5c')]=_[_0x15cc('0x5d')](_0x2dcd1c[_0x15cc('0x53')],_0x2dcd1c[_0x15cc('0x5a')]);_0x29407d[_0x15cc('0x5f')]=_['intersection'](_0x2dcd1c[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x524cb6[_0x15cc('0x5a')][_0x15cc('0x5e')]));_0x29407d['attributes']=_0x29407d[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x29407d[_0x15cc('0x5f')]:_0x2dcd1c[_0x15cc('0x53')];if(!_0x524cb6['query']['hasOwnProperty']('nolimit')){_0x29407d[_0x15cc('0x24')]=qs['limit'](_0x524cb6['query'][_0x15cc('0x24')]);_0x29407d[_0x15cc('0x23')]=qs[_0x15cc('0x23')](_0x524cb6[_0x15cc('0x5a')]['offset']);}_0x29407d[_0x15cc('0x80')]=qs[_0x15cc('0x62')](_0x524cb6[_0x15cc('0x5a')][_0x15cc('0x62')]);_0x29407d[_0x15cc('0x63')]=qs[_0x15cc('0x5c')](_[_0x15cc('0x64')](_0x524cb6[_0x15cc('0x5a')],_0x2dcd1c[_0x15cc('0x5c')]));_0x29407d[_0x15cc('0x63')][_0x15cc('0x7d')]=_0x17a3ee['id'];if(_0x524cb6[_0x15cc('0x5a')]['filter']){_0x29407d[_0x15cc('0x63')]=_[_0x15cc('0x66')](_0x29407d['where'],{'$or':_['map'](_0x29407d[_0x15cc('0x5f')],function(_0x568ceb){var _0x92d298={};_0x92d298[_0x568ceb]={'$like':'%'+_0x524cb6['query']['filter']+'%'};return _0x92d298;})});}_0x29407d=_[_0x15cc('0x66')]({},_0x29407d,_0x524cb6[_0x15cc('0x68')]);return db[_0x15cc('0x81')][_0x15cc('0x26')]({'where':_0x29407d[_0x15cc('0x63')]})[_0x15cc('0x15')](function(_0x24f521){_0x58f802[_0x15cc('0x26')]=_0x24f521;if(_0x524cb6[_0x15cc('0x5a')][_0x15cc('0x69')]){_0x29407d[_0x15cc('0x6a')]=[{'all':!![]}];}return db[_0x15cc('0x81')]['findAll'](_0x29407d);})[_0x15cc('0x15')](function(_0x47ffe4){_0x58f802[_0x15cc('0x6c')]=_0x47ffe4;return _0x58f802;});}})[_0x15cc('0x15')](respondWithFilteredResult(_0x6c51bb,_0x29407d))[_0x15cc('0x6d')](handleError(_0x6c51bb,null));};exports['removeDispositions']=function(_0x1e6651,_0x2f2861){return db['ChatWebsite']['find']({'where':{'id':_0x1e6651[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0x2f2861,null))[_0x15cc('0x15')](function(_0x3241e3){if(_0x3241e3){return _0x3241e3[_0x15cc('0x82')](_0x1e6651['query'][_0x15cc('0x83')]);}})[_0x15cc('0x15')](respondWithStatusCode(_0x2f2861,null))[_0x15cc('0x6d')](handleError(_0x2f2861,null));};exports['addAnswer']=function(_0x4957b2,_0x57b566){if(_0x4957b2[_0x15cc('0x7a')]['id']){delete _0x4957b2[_0x15cc('0x7a')]['id'];}return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x4957b2[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0x57b566,null))[_0x15cc('0x15')](function(_0x451861){if(_0x451861){_0x4957b2[_0x15cc('0x7a')][_0x15cc('0x7d')]=_0x451861['id'];return db['CannedAnswer'][_0x15cc('0x71')](_0x4957b2[_0x15cc('0x7a')]);}})[_0x15cc('0x15')](respondWithResult(_0x57b566,null))[_0x15cc('0x6d')](handleError(_0x57b566,null));};exports[_0x15cc('0x84')]=function(_0x1ca630,_0x26b8ca){var _0x56a307={'raw':![],'where':{}};var _0x2f9b2a={};var _0x2b1e51={'count':0x0,'rows':[]};return db[_0x15cc('0x56')]['findOne']({'where':{'id':_0x1ca630[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x26b8ca,null))[_0x15cc('0x15')](function(_0x49619f){if(_0x49619f){_0x2f9b2a[_0x15cc('0x53')]=_[_0x15cc('0x5b')](db[_0x15cc('0x85')][_0x15cc('0x70')]);_0x2f9b2a[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x1ca630[_0x15cc('0x5a')]);_0x2f9b2a[_0x15cc('0x5c')]=_[_0x15cc('0x5d')](_0x2f9b2a[_0x15cc('0x53')],_0x2f9b2a['query']);_0x56a307[_0x15cc('0x5f')]=_['intersection'](_0x2f9b2a[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x1ca630[_0x15cc('0x5a')][_0x15cc('0x5e')]));_0x56a307[_0x15cc('0x5f')]=_0x56a307[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x56a307[_0x15cc('0x5f')]:_0x2f9b2a[_0x15cc('0x53')];if(!_0x1ca630[_0x15cc('0x5a')]['hasOwnProperty'](_0x15cc('0x61'))){_0x56a307['limit']=qs[_0x15cc('0x24')](_0x1ca630[_0x15cc('0x5a')][_0x15cc('0x24')]);_0x56a307[_0x15cc('0x23')]=qs[_0x15cc('0x23')](_0x1ca630[_0x15cc('0x5a')][_0x15cc('0x23')]);}_0x56a307[_0x15cc('0x80')]=qs[_0x15cc('0x62')](_0x1ca630[_0x15cc('0x5a')][_0x15cc('0x62')]);_0x56a307[_0x15cc('0x63')]=qs['filters'](_[_0x15cc('0x64')](_0x1ca630['query'],_0x2f9b2a[_0x15cc('0x5c')]));_0x56a307['where'][_0x15cc('0x7d')]=_0x49619f['id'];if(_0x1ca630[_0x15cc('0x5a')]['filter']){_0x56a307['where']=_['merge'](_0x56a307['where'],{'$or':_['map'](_0x56a307[_0x15cc('0x5f')],function(_0x5c7e9e){var _0xf382a6={};_0xf382a6[_0x5c7e9e]={'$like':'%'+_0x1ca630[_0x15cc('0x5a')][_0x15cc('0x65')]+'%'};return _0xf382a6;})});}_0x56a307=_[_0x15cc('0x66')]({},_0x56a307,_0x1ca630[_0x15cc('0x68')]);return db[_0x15cc('0x85')]['count']({'where':_0x56a307['where']})[_0x15cc('0x15')](function(_0x3506e5){_0x2b1e51['count']=_0x3506e5;if(_0x1ca630['query'][_0x15cc('0x69')]){_0x56a307[_0x15cc('0x6a')]=[{'all':!![]}];}return db[_0x15cc('0x85')][_0x15cc('0x6b')](_0x56a307);})[_0x15cc('0x15')](function(_0x5298b8){_0x2b1e51['rows']=_0x5298b8;return _0x2b1e51;});}})['then'](respondWithFilteredResult(_0x26b8ca,_0x56a307))[_0x15cc('0x6d')](handleError(_0x26b8ca,null));};exports['removeAnswers']=function(_0x293d08,_0x2b97a7){return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x293d08[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x2b97a7,null))[_0x15cc('0x15')](function(_0x5b3c99){if(_0x5b3c99){return _0x5b3c99['removeAnswers'](_0x293d08[_0x15cc('0x5a')][_0x15cc('0x83')]);}})['then'](respondWithStatusCode(_0x2b97a7,null))[_0x15cc('0x6d')](handleError(_0x2b97a7,null));};exports['addLogo']=function(_0x5103fe,_0x197aae){_0x5103fe[_0x15cc('0x7a')][_0x15cc('0x86')]=_0x5103fe['file']['filename'];return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x5103fe[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0x197aae,null))[_0x15cc('0x15')](saveUpdates(_0x5103fe['body'],null))[_0x15cc('0x15')](respondWithResult(_0x197aae,null))[_0x15cc('0x6d')](handleError(_0x197aae,null));};exports[_0x15cc('0x87')]=function(_0x103aaf,_0x1f9429){_0x103aaf[_0x15cc('0x7a')][_0x15cc('0x88')]=_0x103aaf[_0x15cc('0x89')]['filename'];return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x103aaf['params']['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x1f9429,null))[_0x15cc('0x15')](saveUpdates(_0x103aaf['body'],null))[_0x15cc('0x15')](respondWithResult(_0x1f9429,null))[_0x15cc('0x6d')](handleError(_0x1f9429,null));};exports['addCustomerAvatar']=function(_0x16781e,_0x1179a3){_0x16781e[_0x15cc('0x7a')][_0x15cc('0x8a')]=_0x16781e[_0x15cc('0x89')][_0x15cc('0x8b')];return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x16781e[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x1179a3,null))[_0x15cc('0x15')](saveUpdates(_0x16781e[_0x15cc('0x7a')],null))[_0x15cc('0x15')](respondWithResult(_0x1179a3,null))['catch'](handleError(_0x1179a3,null));};exports[_0x15cc('0x8c')]=function(_0x432ae5,_0x33c97d){_0x432ae5[_0x15cc('0x7a')][_0x15cc('0x8d')]=_0x432ae5[_0x15cc('0x89')][_0x15cc('0x8b')];return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x432ae5[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x33c97d,null))[_0x15cc('0x15')](saveUpdates(_0x432ae5[_0x15cc('0x7a')],null))[_0x15cc('0x15')](respondWithResult(_0x33c97d,null))['catch'](handleError(_0x33c97d,null));};exports[_0x15cc('0x8e')]=function(_0x2b4f6e,_0x532062){var _0x14e291=path['join'](config[_0x15cc('0x8f')],'server/files/images/logos/default_logo.svg');var _0x52b07f={'where':{'id':_0x2b4f6e[_0x15cc('0x79')]['id']},'attributes':['id',_0x15cc('0x86')],'raw':!![]};var _0x491fba=![];return require(_0x15cc('0x90'))[_0x15cc('0x91')]()['then'](function(_0x48d767){if(_0x48d767){_0x491fba=_0x48d767[_0x15cc('0x92')];}})['then'](function(){return db['ChatWebsite'][_0x15cc('0x76')](_0x52b07f);})[_0x15cc('0x15')](handleEntityNotFound(_0x532062,null))[_0x15cc('0x15')](function(_0x1bf191){if(_0x1bf191){if(!_[_0x15cc('0x93')](_0x1bf191[_0x15cc('0x86')])){if(fs[_0x15cc('0x94')](path['join'](config['root'],_0x15cc('0x95'),_0x1bf191[_0x15cc('0x86')]))&&_0x491fba){_0x14e291=path[_0x15cc('0x96')](config['root'],_0x15cc('0x95'),_0x1bf191[_0x15cc('0x86')]);}}return _0x532062[_0x15cc('0x97')](_0x14e291);}})[_0x15cc('0x6d')](handleError(_0x532062,null));};exports['getAvatar']=function(_0x35f904,_0x1dd4a8){var _0x415f0a=path[_0x15cc('0x96')](config[_0x15cc('0x8f')],_0x15cc('0x98'));var _0x210235={'where':{'id':_0x35f904['params']['id']},'attributes':['id',_0x15cc('0x88')],'raw':!![]};return db[_0x15cc('0x56')][_0x15cc('0x76')](_0x210235)['then'](handleEntityNotFound(_0x1dd4a8,null))[_0x15cc('0x15')](function(_0x5ec8e8){if(_0x5ec8e8){if(!_[_0x15cc('0x93')](_0x5ec8e8[_0x15cc('0x88')])){if(fs[_0x15cc('0x94')](path[_0x15cc('0x96')](config[_0x15cc('0x8f')],_0x15cc('0x99'),_0x5ec8e8[_0x15cc('0x88')]))){_0x415f0a=path['join'](config[_0x15cc('0x8f')],'server/files/images/avatars/',_0x5ec8e8['agentAvatar']);}}return _0x1dd4a8[_0x15cc('0x97')](_0x415f0a);}})['catch'](handleError(_0x1dd4a8,null));};exports[_0x15cc('0x9a')]=function(_0x22190b,_0x546224){var _0x4da79f=path[_0x15cc('0x96')](config[_0x15cc('0x8f')],_0x15cc('0x9b'));var _0x46ba58={'where':{'id':_0x22190b['params']['id']},'attributes':['id',_0x15cc('0x8a'),_0x15cc('0x9c')],'raw':!![]};return db['ChatWebsite'][_0x15cc('0x76')](_0x46ba58)[_0x15cc('0x15')](handleEntityNotFound(_0x546224,null))[_0x15cc('0x15')](function(_0x237f02){if(_0x237f02){if(!_[_0x15cc('0x93')](_0x237f02[_0x15cc('0x8a')])){if(fs['existsSync'](path[_0x15cc('0x96')](config[_0x15cc('0x8f')],_0x15cc('0x99'),_0x237f02[_0x15cc('0x8a')]))&&_0x237f02[_0x15cc('0x9c')]){_0x4da79f=path['join'](config[_0x15cc('0x8f')],'server/files/images/avatars/',_0x237f02[_0x15cc('0x8a')]);}}return _0x546224['download'](_0x4da79f);}})[_0x15cc('0x6d')](handleError(_0x546224,null));};exports[_0x15cc('0x9d')]=function(_0xc77efd,_0xbb74c5){var _0xc2fab3=path['join'](config[_0x15cc('0x8f')],_0x15cc('0x9e'));var _0x22eb9f={'where':{'id':_0xc77efd[_0x15cc('0x79')]['id']},'attributes':['id',_0x15cc('0x8d')],'raw':!![]};return db[_0x15cc('0x56')][_0x15cc('0x76')](_0x22eb9f)[_0x15cc('0x15')](handleEntityNotFound(_0xbb74c5,null))[_0x15cc('0x15')](function(_0x22c884){if(_0x22c884){if(!_[_0x15cc('0x93')](_0x22c884[_0x15cc('0x8d')])){if(fs[_0x15cc('0x94')](path[_0x15cc('0x96')](config[_0x15cc('0x8f')],'server/files/images/avatars/',_0x22c884[_0x15cc('0x8d')]))){_0xc2fab3=path['join'](config[_0x15cc('0x8f')],_0x15cc('0x99'),_0x22c884['systemAvatar']);}}return _0xbb74c5[_0x15cc('0x97')](_0xc2fab3);}})[_0x15cc('0x6d')](handleError(_0xbb74c5,null));};exports['notify']=function(_0x13826b,_0x245031){var _0x3235d3={'body':_0x13826b[_0x15cc('0x7a')],'channel':_0x15cc('0x9f')};var _0x11c6d5=[];var _0x5f249d=[];var _0x4db08c={};var _0x312ed0=![];return db[_0x15cc('0xa0')][_0x15cc('0x7b')]()['then'](function(_0x3ea2ae){if(!_0x3ea2ae){throw new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))]('no\x20available\x20attributes');}_0x11c6d5=_[_0x15cc('0xa3')](_[_0x15cc('0x5b')](_0x3ea2ae),['createdAt',_0x15cc('0xa4')]);_0x5f249d=_[_0x15cc('0xa3')](_['keys'](_0x3ea2ae),[_0x15cc('0xa5'),_0x15cc('0xa4'),_0x15cc('0xa6'),_0x15cc('0xa7')]);if(_0x13826b[_0x15cc('0x7a')]['id']){delete _0x13826b[_0x15cc('0x7a')]['id'];}if(_['isNil'](_0x13826b[_0x15cc('0x7a')][_0x15cc('0xa8')])){throw new db['Sequelize']['ValidationError'](_0x15cc('0xa9'));}if(_[_0x15cc('0x93')](_0x13826b[_0x15cc('0x7a')][_0x15cc('0x7a')])||_0x13826b[_0x15cc('0x7a')][_0x15cc('0x7a')]===''){throw new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x13826b['body'][_0x15cc('0xaa')])){throw new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))](_0x15cc('0xab')+_0x5f249d);}if(!_[_0x15cc('0xac')](_0x5f249d,_0x13826b[_0x15cc('0x7a')][_0x15cc('0xaa')])){throw new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))](_0x15cc('0xad')+_0x5f249d);}_0x4db08c[_0x13826b[_0x15cc('0x7a')][_0x15cc('0xaa')]]=_0x13826b['body'][_0x15cc('0xa8')];})[_0x15cc('0x15')](function(){return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x13826b[_0x15cc('0x79')]['id']},'include':[{'model':db['CmList'],'as':_0x15cc('0xae'),'include':[{'model':db[_0x15cc('0xa0')],'as':_0x15cc('0xaf'),'where':_0x4db08c,'limit':0x1,'order':[[_0x15cc('0xa4'),'DESC']]}]},{'model':db[_0x15cc('0xb0')],'as':_0x15cc('0xb1')},{'model':db[_0x15cc('0x3d')],'as':_0x15cc('0x3d'),'include':[{'model':db['Interval'],'as':_0x15cc('0x3e'),'attributes':['id',_0x15cc('0x33')],'raw':!![]}]}]});})['then'](function(_0x16f4cf){if(!_0x16f4cf)throw new APINotFoundError(util[_0x15cc('0x31')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x13826b[_0x15cc('0x79')]['id']));if(!_0x16f4cf[_0x15cc('0x3d')]||!_0x16f4cf[_0x15cc('0x3d')][_0x15cc('0x3e')])return[_0x16f4cf,!![]];return[_0x16f4cf,checkWebsiteIntervals(_0x16f4cf)];})[_0x15cc('0xb2')](function(_0x87455f,_0xd79fa1){if(!_0xd79fa1)throw new APIOutOfIntervalError();if(!_0x87455f[_0x15cc('0xae')])return;_0x3235d3['account']=_0x87455f;_0x3235d3[_0x15cc('0xb3')]=_0x87455f[_0x15cc('0xae')];_0x3235d3['applications']=_['orderBy'](_0x87455f['Applications'],[_0x15cc('0xb4')],[_0x15cc('0xb5')]);if(_0x3235d3[_0x15cc('0xb6')][_0x15cc('0xb1')]){delete _0x3235d3[_0x15cc('0xb6')]['Applications'];}if(_0x3235d3[_0x15cc('0xb6')][_0x15cc('0xae')]&&_0x3235d3['account'][_0x15cc('0xae')]['Contacts'][_0x15cc('0x60')]){return _0x3235d3[_0x15cc('0xb6')][_0x15cc('0xae')]['Contacts'][0x0];}var _0x16493f=_[_0x15cc('0xd')](_0x13826b[_0x15cc('0x7a')],{'firstName':_0x13826b[_0x15cc('0x7a')][_0x15cc('0xa8')],'ListId':_0x87455f[_0x15cc('0xa7')]});_0x16493f[_0x13826b[_0x15cc('0x7a')][_0x15cc('0xaa')]]=_0x13826b[_0x15cc('0x7a')][_0x15cc('0xa8')];return db[_0x15cc('0xa0')][_0x15cc('0x71')](_0x16493f,{'fields':_0x11c6d5,'raw':!![]});})['then'](function(_0x593fd0){_0x3235d3[_0x15cc('0xb7')]=_0x593fd0;var _0x3e4e99=createInteractionObject(_0x13826b[_0x15cc('0x79')]['id'],_0x13826b[_0x15cc('0x7a')],_0x13826b[_0x15cc('0xb8')],_0x593fd0);var _0x365c93={'ChatWebsiteId':_0x13826b['params']['id'],'closed':![]};if(_0x13826b['body'][_0x15cc('0xb9')]){_0x365c93[_0x15cc('0xb9')]=_0x13826b['body']['threadId'];return db[_0x15cc('0xba')][_0x15cc('0x76')]({'where':_0x365c93})[_0x15cc('0x15')](function(_0x3f7128){if(_0x3f7128){_0x312ed0=!![];return _0x3f7128;}_0x3e4e99['threadId']=_0x13826b[_0x15cc('0x7a')]['threadId'];_0x3e4e99[_0x15cc('0xbb')]=_0x13826b[_0x15cc('0x7a')][_0x15cc('0xbb')];return db[_0x15cc('0xba')]['create'](_0x3e4e99);});}_0x365c93[_0x15cc('0xbc')]=_0x593fd0['id'];if(_0x13826b['body'][_0x15cc('0xbd')]&&_0x13826b[_0x15cc('0x7a')][_0x15cc('0xbd')]['id']){_0x365c93['id']=_0x13826b[_0x15cc('0x7a')][_0x15cc('0xbd')]['id'];return db['ChatInteraction'][_0x15cc('0x76')]({'where':_0x365c93})[_0x15cc('0x15')](function(_0x404504){if(_0x404504){_0x312ed0=!![];return _0x404504;}return db['ChatInteraction']['create'](_0x3e4e99);});}return db[_0x15cc('0xba')][_0x15cc('0x71')](_0x3e4e99);})['then'](function(_0x56f7e7){if(!_0x312ed0)return _0x56f7e7;var _0xa3911d={'from':(_0x3235d3[_0x15cc('0xb7')][_0x15cc('0x4a')]||'')+'\x20'+(_0x3235d3[_0x15cc('0xb7')]['lastName']||'')};if(_0x13826b[_0x15cc('0x7a')][_0x15cc('0xb9')]&&_0x13826b[_0x15cc('0x7a')][_0x15cc('0xbe')]&&_0x13826b['body'][_0x15cc('0xb9')]!=_0x13826b[_0x15cc('0x7a')]['messageId']){_0xa3911d[_0x15cc('0xb9')]=_0x13826b[_0x15cc('0x7a')][_0x15cc('0xbe')];}return _0x56f7e7[_0x15cc('0x29')](_0xa3911d);})[_0x15cc('0x15')](function(_0x1c87c5){_0x3235d3['interaction']=_0x1c87c5[_0x15cc('0x3f')]({'plain':!![]});_0x3235d3[_0x15cc('0xbd')][_0x15cc('0xbf')]=!_0x312ed0;if(_0x3235d3[_0x15cc('0xbd')][_0x15cc('0xbf')]){if(_0x3235d3['account'][_0x15cc('0xc0')]){_0x3235d3[_0x15cc('0xc1')][_0x15cc('0xc2')]({'id':0x0,'priority':_0x3235d3[_0x15cc('0xc1')][_0x15cc('0x60')]+0x1,'app':_0x15cc('0xc3'),'appdata':_0x15cc('0xc4'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x15cc('0x71')]({'body':_0x13826b['body'][_0x15cc('0x7a')],'ChatWebsiteId':_0x13826b[_0x15cc('0x79')]['id'],'ChatInteractionId':_0x1c87c5['id'],'direction':'in','ContactId':_0x3235d3[_0x15cc('0xb7')]['id'],'AttachmentId':_0x13826b['body'][_0x15cc('0xc5')]});})['then'](function(_0x786939){_0x3235d3[_0x15cc('0x1d')]=_0x786939;if(!_0x3235d3['interaction'][_0x15cc('0xc6')]){return;}return db['User'][_0x15cc('0x76')]({'attributes':['id',_0x15cc('0x2e')],'where':{'id':_0x3235d3[_0x15cc('0xbd')][_0x15cc('0xc6')]}});})[_0x15cc('0x15')](function(_0x5ad585){if(_0x5ad585){_0x3235d3[_0x15cc('0xc1')][_0x15cc('0xc7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ad585[_0x15cc('0x2e')]+','+(_0x3235d3[_0x15cc('0xb6')][_0x15cc('0xc8')]||0xa),'interval':_0x15cc('0xc9')});_0x3235d3[_0x15cc('0xca')]=!![];}if(!_0x3235d3[_0x15cc('0xbd')][_0x15cc('0xcb')]){return;}return db[_0x15cc('0xcc')][_0x15cc('0x76')]({'attributes':['id',_0x15cc('0x2e')],'where':{'id':_0x3235d3[_0x15cc('0xbd')][_0x15cc('0xcb')]}});})[_0x15cc('0x15')](function(_0x2712bb){if(_0x2712bb){_0x3235d3[_0x15cc('0xc1')][_0x15cc('0xc7')]({'id':0x0,'priority':0x1,'app':_0x15cc('0xcd'),'appdata':_0x2712bb[_0x15cc('0x2e')]+','+(_0x3235d3[_0x15cc('0xb6')][_0x15cc('0xce')]||0x12c),'interval':_0x15cc('0xc9')});}return respondWithRpcPromise('Start','startRouting',_0x3235d3);})[_0x15cc('0x15')](function(_0x2ccb3d){respondWithRpcPromise('EventManager',_0x15cc('0xcf'),{'event':'notify','message':_0x2ccb3d},client9002);return _0x2ccb3d;})[_0x15cc('0x15')](respondWithResult(_0x245031,null))[_0x15cc('0x6d')](APIHandleError(_0x245031));};exports['offline']=function(_0x35fe34,_0x50e46e){var _0x3b1069,_0x5859da,_0x468fa7;var _0x4b2be5=[];var _0x119936={};var _0x59790a=_0x35fe34['files']||[];var _0x44cb8a=[];var _0x45c16c;return db[_0x15cc('0xa0')]['describe']()[_0x15cc('0x15')](function(_0x4ba358){if(!_0x4ba358){throw new db['Sequelize'][(_0x15cc('0xa2'))](_0x15cc('0xd0'));}_0x4b2be5=_[_0x15cc('0xa3')](_[_0x15cc('0x5b')](_0x4ba358),['createdAt',_0x15cc('0xa4'),_0x15cc('0xa6'),_0x15cc('0xa7')]);if(_0x35fe34[_0x15cc('0x7a')]['id']){delete _0x35fe34[_0x15cc('0x7a')]['id'];}if(_['isNil'](_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xa8')])){throw _0x50e46e['status'](0x1f4)[_0x15cc('0x2f')](new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))]('from\x20is\x20mandatory'));}if(_[_0x15cc('0x93')](_0x35fe34['body']['body'])||_0x35fe34[_0x15cc('0x7a')][_0x15cc('0x7a')]===''){throw _0x50e46e[_0x15cc('0x20')](0x1f4)[_0x15cc('0x2f')](new db[(_0x15cc('0xa1'))][(_0x15cc('0xa2'))](_0x15cc('0xd1')));}if(_[_0x15cc('0x93')](_0x35fe34[_0x15cc('0x7a')]['mapKeyOffline'])){throw _0x50e46e['status'](0x1f4)['send'](new db['Sequelize'][(_0x15cc('0xa2'))](_0x15cc('0xd2')+_0x4b2be5));}if(!_[_0x15cc('0xac')](_0x4b2be5,_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xd3')])){throw _0x50e46e[_0x15cc('0x20')](0x1f4)[_0x15cc('0x2f')](new db[(_0x15cc('0xa1'))]['ValidationError'](_0x15cc('0xd4')+_0x4b2be5));}_0x119936[_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xd3')]]=_0x35fe34['body'][_0x15cc('0xa8')];})[_0x15cc('0x15')](function(){return db[_0x15cc('0x56')]['find']({'where':{'id':_0x35fe34[_0x15cc('0x79')]['id']},'include':[{'model':db[_0x15cc('0xd5')],'as':_0x15cc('0xae')},{'model':db[_0x15cc('0xd6')],'as':'MailAccount'}]});})[_0x15cc('0x15')](handleEntityNotFound(_0x50e46e,null))[_0x15cc('0x15')](function(_0x375d47){if(_0x375d47&&_0x375d47[_0x15cc('0xae')]){_0x5859da=_0x375d47;var _0x32af71=_[_0x15cc('0xd')](_0x35fe34[_0x15cc('0x7a')],{'firstName':_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xa8')],'phone':_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xa8')],'ListId':_0x375d47['ListId']});_0x32af71[_0x35fe34[_0x15cc('0x7a')][_0x15cc('0xd3')]]=_0x35fe34['body'][_0x15cc('0xa8')];return db[_0x15cc('0xa0')][_0x15cc('0xd7')]({'where':_0x119936,'defaults':_0x32af71});}})[_0x15cc('0xb2')](function(_0x43bdce){if(_0x43bdce){_0x468fa7=_0x43bdce;var _0x16383b=fs[_0x15cc('0xd8')](path[_0x15cc('0x96')](config[_0x15cc('0x8f')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2e8967=ejs['render'](_0x16383b,{'body':_[_0x15cc('0xd9')](_0x35fe34[_0x15cc('0x7a')]['body']),'bodyTitle':_0x5859da[_0x15cc('0xda')]});return db[_0x15cc('0xdb')][_0x15cc('0x71')]({'body':_0x2e8967,'plainBody':htmlToText[_0x15cc('0xdc')](_0x2e8967),'ContactId':_0x43bdce['id'],'ChatWebsiteId':_0x5859da['id']});}})[_0x15cc('0x15')](function(_0xa85b4e){_0x45c16c=_0xa85b4e;if(_0x59790a[_0x15cc('0x60')]){var _0x139ca1=_0x59790a[_0x15cc('0x3c')](function(_0x287b7a){return{'name':_0x287b7a['originalname'],'basename':_0x287b7a[_0x15cc('0x8b')],'type':_0x287b7a[_0x15cc('0xdd')],'ChatOfflineMessageId':_0xa85b4e['id']};});_0x44cb8a=_0x139ca1['map'](_0x392251=>{var _0x2e4b9d={'filename':_0x392251['name'],'path':path[_0x15cc('0x96')](config[_0x15cc('0x8f')],'server',_0x15cc('0xde'),_0x15cc('0xdf'),_0x15cc('0xe0'),_0x392251[_0x15cc('0xe1')])};return _0x2e4b9d;});if(!_0x5859da[_0x15cc('0xe2')]){return db[_0x15cc('0xe3')][_0x15cc('0xe4')](function(_0x3509b6){return db['Attachment'][_0x15cc('0xe5')](_0x139ca1,{'transaction':_0x3509b6});});}}})[_0x15cc('0x15')](function(){if(_0x45c16c){_0x3b1069=_0x45c16c;return db[_0x15cc('0xd6')][_0x15cc('0x7f')]({'where':{'service':!![]},'include':[{'model':db[_0x15cc('0xe6')],'as':_0x15cc('0xe7'),'raw':!![],'include':[{'model':db[_0x15cc('0xe8')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x15cc('0x15')](function(_0x43b79b){if(_0x43b79b&&_0x43b79b[_0x15cc('0xe7')]&&_0x5859da['forwardOffline']&&_0x5859da[_0x15cc('0xe9')]){var _0x245dfa=_0x43b79b[_0x15cc('0xea')]();return respondWithRpcPromise('SendMail',_0x15cc('0xeb'),{'account':_0x245dfa,'message':{'from':util[_0x15cc('0x31')]('\x22%s\x22\x20<%s>',_0x43b79b[_0x15cc('0x2e')],_0x43b79b[_0x15cc('0xec')]||_0x43b79b['Smtp'][_0x15cc('0x72')]),'to':_0x5859da[_0x15cc('0xe9')],'subject':_0x5859da['offlineMessageSubject'],'html':_0x3b1069[_0x15cc('0x7a')],'attachments':_0x44cb8a}},client9003)[_0x15cc('0x15')](function(){return _0x3b1069;})['catch'](function(_0x3d6629){logger[_0x15cc('0x1c')](_0x3d6629);});}})['then'](function(){if(_0x5859da&&_0x5859da['openNewInteraction']&&_0x5859da[_0x15cc('0xed')]){var _0x3260d6=[];if(_0x59790a[_0x15cc('0x60')]){_0x3260d6=_0x59790a['map'](function(_0x5ea1c5){return{'name':_0x5ea1c5[_0x15cc('0xee')],'basename':_0x5ea1c5[_0x15cc('0x8b')],'type':_0x5ea1c5[_0x15cc('0xdd')],'ChatOfflineMessageId':_0x45c16c['id']};});}var _0x548025;if(!_[_0x15cc('0x93')](_0x5859da['subjectOffline'])){var _0x442634=_['map'](_0x35fe34[_0x15cc('0x7a')],function(_0x2c29ca){return _0x2c29ca;});var _0x5a4e14=_[_0x15cc('0xef')](_0x442634)[0x0];var _0x301754=_[_0x15cc('0xf0')](_0x5a4e14,function(_0x7dd60b){return _0x7dd60b;});_0x548025=_0x301754[0x1][_0x5859da['subjectOffline']];}var _0x1723fb={'from':_0x468fa7[_0x15cc('0xec')],'firstName':_0x468fa7['firstName'],'lastName':_0x468fa7[_0x15cc('0xf1')],'mapKey':_0x15cc('0xec'),'message':{'from':_0x468fa7[_0x15cc('0xec')],'to':_0x5859da[_0x15cc('0xd6')][_0x15cc('0xec')],'cc':'','subject':_['isNil'](_0x548025)?_0x5859da[_0x15cc('0xf2')]:_0x548025,'messageId':'','sentAt':new Date(),'attach':_0x3260d6['length'],'attachments':_0x3260d6,'originChannel':'Chat','ChatWebsiteId':_0x5859da['id'],'ChatOfflineMessageId':_0x3b1069['id'],'originTo':_0x5859da[_0x15cc('0xd6')][_0x15cc('0xec')]},'body':_0x3b1069[_0x15cc('0x7a')]};var _0x517b76={'account':{'id':_0x5859da[_0x15cc('0xed')]},'body':_0x1723fb,'log':_0x15cc('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0x15cc('0xf4'),_0x517b76,client9001)['then'](function(){return _0x3b1069;})[_0x15cc('0x6d')](function(_0x2513a3){logger['error'](_0x2513a3);});}return;})['then'](function(){if(_0x3b1069){return _0x3b1069;}})[_0x15cc('0x15')](respondWithResult(_0x50e46e,null))[_0x15cc('0x6d')](function(){for(var _0x45b8ec of _0x59790a){var _0x5b9ab1=path['join'](config['root'],_0x15cc('0xf5'),_0x15cc('0xde'),'attachments',_0x15cc('0xe0'),_0x45b8ec['filename']);fs_extra[_0x15cc('0xf6')](_0x5b9ab1)[_0x15cc('0x6d')](function(_0xaee966){logger[_0x15cc('0x1c')](_0x15cc('0xf7'),_0x5b9ab1,_0xaee966);});}});};exports[_0x15cc('0xf8')]=function(_0x51562e,_0x540a00){return db[_0x15cc('0xba')][_0x15cc('0x76')]({'where':{'id':_0x51562e[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0x540a00,null))['then'](function(_0x15706a){if(_0x15706a){return _0x15706a['addInteraction'](_0x51562e[_0x15cc('0x7a')][_0x15cc('0x83')],_[_0x15cc('0xf9')](_0x51562e['body'],[_0x15cc('0x83'),'id'])||{});}})[_0x15cc('0x15')](respondWithResult(_0x540a00,null))[_0x15cc('0x6d')](handleError(_0x540a00,null));};exports['getInteractions']=function(_0x16e37c,_0xb12c60){var _0x22d925={'raw':![],'where':{}};var _0x1529ae={};var _0xacdcea={'count':0x0,'rows':[]};return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x16e37c[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0xb12c60,null))[_0x15cc('0x15')](function(_0x58b2c3){if(_0x58b2c3){_0x1529ae[_0x15cc('0x53')]=_[_0x15cc('0x5b')](db[_0x15cc('0xba')][_0x15cc('0x70')]);_0x1529ae['query']=_[_0x15cc('0x5b')](_0x16e37c[_0x15cc('0x5a')]);_0x1529ae[_0x15cc('0x5c')]=_['intersection'](_0x1529ae['model'],_0x1529ae[_0x15cc('0x5a')]);_0x22d925[_0x15cc('0x5f')]=_['intersection'](_0x1529ae[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x16e37c['query'][_0x15cc('0x5e')]));_0x22d925['attributes']=_0x22d925[_0x15cc('0x5f')]['length']?_0x22d925[_0x15cc('0x5f')]:_0x1529ae[_0x15cc('0x53')];if(!_0x16e37c['query'][_0x15cc('0xfa')]('nolimit')){_0x22d925[_0x15cc('0x24')]=qs[_0x15cc('0x24')](_0x16e37c[_0x15cc('0x5a')][_0x15cc('0x24')]);_0x22d925['offset']=qs[_0x15cc('0x23')](_0x16e37c[_0x15cc('0x5a')][_0x15cc('0x23')]);}_0x22d925[_0x15cc('0x80')]=qs[_0x15cc('0x62')](_0x16e37c[_0x15cc('0x5a')]['sort']);_0x22d925[_0x15cc('0x63')]=qs[_0x15cc('0x5c')](_['pick'](_0x16e37c[_0x15cc('0x5a')],_0x1529ae['filters']));_0x22d925[_0x15cc('0x63')][_0x15cc('0x7d')]=_0x58b2c3['id'];if(_0x16e37c[_0x15cc('0x5a')][_0x15cc('0x65')]){_0x22d925[_0x15cc('0x63')]=_[_0x15cc('0x66')](_0x22d925['where'],{'$or':_[_0x15cc('0x3c')](_0x22d925[_0x15cc('0x5f')],function(_0x26f4a5){var _0x78c042={};_0x78c042[_0x26f4a5]={'$like':'%'+_0x16e37c['query'][_0x15cc('0x65')]+'%'};return _0x78c042;})});}_0x22d925=_[_0x15cc('0x66')]({},_0x22d925,_0x16e37c[_0x15cc('0x68')]);return db[_0x15cc('0xba')][_0x15cc('0x26')]({'where':_0x22d925[_0x15cc('0x63')]})[_0x15cc('0x15')](function(_0x44b259){_0xacdcea[_0x15cc('0x26')]=_0x44b259;if(_0x16e37c[_0x15cc('0x5a')]['includeAll']){_0x22d925[_0x15cc('0x6a')]=[{'model':db[_0x15cc('0xa0')],'as':_0x15cc('0xfb'),'required':![]},{'model':db[_0x15cc('0xfc')],'as':_0x15cc('0xfd'),'attributes':[_0x15cc('0x2e'),_0x15cc('0xfe'),'internal'],'required':![]},{'model':db[_0x15cc('0xff')],'as':_0x15cc('0x100'),'attributes':['id',_0x15cc('0x2e'),'color'],'where':_0x16e37c[_0x15cc('0x5a')][_0x15cc('0x101')]?{'id':_0x16e37c[_0x15cc('0x5a')]['tag']}:undefined,'required':_0x16e37c['query'][_0x15cc('0x101')]?!![]:![]}];}return db[_0x15cc('0xba')][_0x15cc('0x6b')](_0x22d925);})[_0x15cc('0x15')](function(_0x73fd4c){_0xacdcea[_0x15cc('0x6c')]=_0x73fd4c;return _0xacdcea;});}})[_0x15cc('0x15')](respondWithFilteredResult(_0xb12c60,_0x22d925))['catch'](handleError(_0xb12c60,null));};exports[_0x15cc('0x30')]=function(_0x442e64,_0x1b34e8){var _0xc5fc1f=0x0;var _0x3f54fd=0x0;var _0x128a3d=![];var _0x559c02;var _0xdc5ed5;return db[_0x15cc('0x56')]['find']({'where':{'id':_0x442e64[_0x15cc('0x79')]['id']},'include':[{'model':db[_0x15cc('0x3d')],'as':_0x15cc('0x3d'),'include':[{'model':db[_0x15cc('0x3d')],'as':'Intervals','attributes':['id',_0x15cc('0x33')]}]}]})[_0x15cc('0x15')](handleEntityNotFound(_0x1b34e8,null))[_0x15cc('0x15')](function(_0x29cb61){if(_0x29cb61){_0x559c02=_0x29cb61;return _0x29cb61[_0x15cc('0x102')]({'raw':!![]});}})[_0x15cc('0x15')](function(_0x3b9639){if(_0x559c02){if(_0x3b9639){_0xdc5ed5=_0x3b9639;}}return require(_0x15cc('0x90'))[_0x15cc('0x91')]();})[_0x15cc('0x15')](function(_0x5a6e1e){if(_0x5a6e1e){_0x3f54fd=_0x5a6e1e['virtual'];_0x128a3d=_0x5a6e1e[_0x15cc('0x92')];}})['then'](function(){return db[_0x15cc('0xba')][_0x15cc('0x26')]({'where':{'closed':![]}});})[_0x15cc('0x15')](function(_0x5b988b){_0xc5fc1f=_0x5b988b;if(_0x3f54fd&&_0x5b988b>_0x3f54fd){return db[_0x15cc('0x103')]['findOne']({'where':{'id':0x1}})[_0x15cc('0x15')](function(_0x1a6216){if(_0x1a6216){_0x1a6216[_0x15cc('0x104')](_0x15cc('0x105'));}});}})[_0x15cc('0x15')](function(){if(!_0x559c02[_0x15cc('0x3d')]||!_0x559c02[_0x15cc('0x3d')][_0x15cc('0x3e')])return!![];return checkWebsiteIntervals(_0x559c02);})[_0x15cc('0x15')](function(_0x31df6f){var _0x3d7719=fs['readFileSync'](path['join'](config[_0x15cc('0x8f')],_0x15cc('0x106')),_0x15cc('0x107'));var _0x1751a8=new url[(_0x15cc('0x108'))](_0x559c02[_0x15cc('0x109')])[_0x15cc('0x10a')];var _0x3e5b63=_0x15cc('0x10b');var _0x4e0496=![];var _0x213fd0={'chatVersion':_0x3e5b63,'chatWebsiteAddressOrigin':_0x1751a8,'remote':_0x559c02[_0x15cc('0x10c')],'query':querystring[_0x15cc('0x1a')](_['merge'](_0x559c02[_0x15cc('0x3f')]({'plain':!![]}),{'customerIp':_0x442e64[_0x15cc('0xb8')][_0x15cc('0x47')]||_0x442e64['headers'][_0x15cc('0x10d')]||_0x442e64[_0x15cc('0x10e')][_0x15cc('0x10f')]||_0x442e64['ip'],'referer':_0x442e64['headers'][_0x15cc('0x110')],'openedInteractions':_0xc5fc1f,'maxInteractions':_0x3f54fd,'virtual':_0x128a3d['virtual'],'online':_0x31df6f,'custom':_0x128a3d}))[_0x15cc('0x111')](/'/g,'\x5c\x27')};_0x1b34e8[_0x15cc('0x2f')](ejs['render'](Mustache[_0x15cc('0x112')](_0x3d7719,_0x213fd0),{'proactiveActions':_0xdc5ed5,'alignment':_0x559c02[_0x15cc('0x113')],'verticalAlignment':_0x559c02['verticalAlignment'],'div_color':_0x559c02[_0x15cc('0x114')],'labelText':_0x559c02[_0x15cc('0x115')],'text_color':_0x559c02[_0x15cc('0x116')],'text_button_color':_0x559c02[_0x15cc('0x117')],'button_color':_0x559c02[_0x15cc('0x118')],'background_color':_0x559c02['backgroundColor'],'hideWhenOffline':_0x559c02['hideWhenOffline'],'intervalId':_0x559c02[_0x15cc('0x119')],'isDevelopment':_0x4e0496,'chatVersion':_0x3e5b63}));})['catch'](handleError(_0x1b34e8,null));};exports[_0x15cc('0x11a')]=function(_0x3bb432,_0x4253e4){var _0x584462=_0x3bb432['params']['id'];var _0x2c830b=_0x3bb432['body'];var _0x70239d=0xc8;var _0x16b5a7=null;return db[_0x15cc('0xe3')][_0x15cc('0xe4')]({'isolationLevel':db['sequelize'][_0x15cc('0x11b')][_0x15cc('0x11c')][_0x15cc('0x11d')]},function(_0x5d3af6){return db['ChatWebsite'][_0x15cc('0x7f')]({'where':{'id':_0x584462},'transaction':_0x5d3af6})[_0x15cc('0x15')](function(_0x46b439){if(_0x46b439){return db[_0x15cc('0xb0')][_0x15cc('0x2a')]({'where':{'ChatWebsiteId':_0x584462},'transaction':_0x5d3af6})[_0x15cc('0x15')](function(){var _0x391653=_['map'](_0x2c830b,function(_0x46aae1){_0x46aae1['ChatWebsiteId']=_0x584462;return _0x46aae1;});return db['ChatApplication'][_0x15cc('0xe5')](_0x391653,{'transaction':_0x5d3af6});});}else{_0x70239d=0x194;_0x16b5a7=[];}});})[_0x15cc('0x15')](function(){if(_0x70239d!==0x194){return db[_0x15cc('0xb0')][_0x15cc('0x11e')]({'where':{'ChatWebsiteId':_0x584462},'order':_0x15cc('0xb4')})[_0x15cc('0x15')](function(_0xab7a4e){_0x16b5a7=_0xab7a4e;});}})[_0x15cc('0x6d')](function(_0x2057c2){_0x70239d=0x1f4;logger['error'](_0x2057c2[_0x15cc('0x2d')]);if(_0x2057c2[_0x15cc('0x2e')]){delete _0x2057c2[_0x15cc('0x2e')];}_0x16b5a7=_0x2057c2;})['finally'](function(){if(_0x16b5a7===null){_0x4253e4[_0x15cc('0x1f')](_0x70239d);}else{if(_0x70239d===0x1f4){_0x4253e4['status'](_0x70239d)[_0x15cc('0x2f')](_0x16b5a7);}else{_0x4253e4[_0x15cc('0x20')](_0x70239d)[_0x15cc('0x22')](_0x16b5a7);}}});};exports[_0x15cc('0x11f')]=function(_0x25b7ca,_0x304c3f){var _0x25a9f8={};var _0xb001ad={};var _0x126dc1;var _0x502abf;return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x25b7ca[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x304c3f,null))[_0x15cc('0x15')](function(_0x17594a){if(_0x17594a){_0x126dc1=_0x17594a;_0xb001ad['model']=_[_0x15cc('0x5b')](db['ChatApplication'][_0x15cc('0x70')]);_0xb001ad[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x25b7ca[_0x15cc('0x5a')]);_0xb001ad['filters']=_[_0x15cc('0x5d')](_0xb001ad[_0x15cc('0x53')],_0xb001ad[_0x15cc('0x5a')]);_0x25a9f8[_0x15cc('0x5f')]=_[_0x15cc('0x5d')](_0xb001ad[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x25b7ca[_0x15cc('0x5a')][_0x15cc('0x5e')]));_0x25a9f8['attributes']=_0x25a9f8[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x25a9f8[_0x15cc('0x5f')]:_0xb001ad[_0x15cc('0x53')];_0x25a9f8[_0x15cc('0x80')]=qs['sort'](_0x25b7ca[_0x15cc('0x5a')]['sort']);_0x25a9f8[_0x15cc('0x63')]=qs[_0x15cc('0x5c')](_['pick'](_0x25b7ca[_0x15cc('0x5a')],_0xb001ad['filters']));if(_0x25b7ca['query'][_0x15cc('0x65')]){_0x25a9f8['where']=_[_0x15cc('0x66')](_0x25a9f8[_0x15cc('0x63')],{'$or':_[_0x15cc('0x3c')](_0x25a9f8[_0x15cc('0x5f')],function(_0x5cc59c){var _0x36023d={};_0x36023d[_0x5cc59c]={'$like':'%'+_0x25b7ca[_0x15cc('0x5a')][_0x15cc('0x65')]+'%'};return _0x36023d;})});}_0x25a9f8=_[_0x15cc('0x66')]({},_0x25a9f8,_0x25b7ca[_0x15cc('0x68')]);return _0x126dc1[_0x15cc('0x11f')](_0x25a9f8);}})[_0x15cc('0x15')](function(_0x4e40ab){if(_0x4e40ab){_0x502abf=_0x4e40ab['length'];if(!_0x25b7ca[_0x15cc('0x5a')][_0x15cc('0xfa')](_0x15cc('0x61'))){_0x25a9f8[_0x15cc('0x24')]=qs['limit'](_0x25b7ca['query'][_0x15cc('0x24')]);_0x25a9f8[_0x15cc('0x23')]=qs[_0x15cc('0x23')](_0x25b7ca[_0x15cc('0x5a')]['offset']);}return _0x126dc1[_0x15cc('0x11f')](_0x25a9f8);}})[_0x15cc('0x15')](function(_0x5b027c){if(_0x5b027c){return _0x5b027c?{'count':_0x502abf,'rows':_0x5b027c}:null;}})['then'](respondWithResult(_0x304c3f,null))[_0x15cc('0x6d')](handleError(_0x304c3f,null));};exports[_0x15cc('0x120')]=function(_0xa33009,_0xc0df40){return db['chatProactiveAction'][_0x15cc('0x76')]({'where':{'id':_0xa33009[_0x15cc('0x79')]['id']}})['then'](handleEntityNotFound(_0xc0df40,null))['then'](function(_0x1a2b12){if(_0x1a2b12){return _0x1a2b12['addProactiveActions'](_0xa33009[_0x15cc('0x7a')]['ids'],_[_0x15cc('0xf9')](_0xa33009[_0x15cc('0x7a')],[_0x15cc('0x83'),'id'])||{});}})[_0x15cc('0x15')](respondWithResult(_0xc0df40,null))[_0x15cc('0x6d')](handleError(_0xc0df40,null));};exports[_0x15cc('0x102')]=function(_0x23a20e,_0x273873){var _0x1075ef={};var _0x869b2a={};var _0x1cd0ea;var _0x2b96ff;return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x23a20e['params']['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x273873,null))[_0x15cc('0x15')](function(_0x19a5b6){if(_0x19a5b6){_0x1cd0ea=_0x19a5b6;_0x869b2a[_0x15cc('0x53')]=_['keys'](db['ChatProactiveAction'][_0x15cc('0x70')]);_0x869b2a[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x23a20e[_0x15cc('0x5a')]);_0x869b2a['filters']=_[_0x15cc('0x5d')](_0x869b2a[_0x15cc('0x53')],_0x869b2a[_0x15cc('0x5a')]);_0x1075ef[_0x15cc('0x5f')]=_[_0x15cc('0x5d')](_0x869b2a[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x23a20e['query'][_0x15cc('0x5e')]));_0x1075ef[_0x15cc('0x5f')]=_0x1075ef[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x1075ef[_0x15cc('0x5f')]:_0x869b2a[_0x15cc('0x53')];_0x1075ef['order']=qs['sort'](_0x23a20e[_0x15cc('0x5a')]['sort']);_0x1075ef['where']=qs[_0x15cc('0x5c')](_[_0x15cc('0x64')](_0x23a20e[_0x15cc('0x5a')],_0x869b2a[_0x15cc('0x5c')]));if(_0x23a20e['query'][_0x15cc('0x65')]){_0x1075ef['where']=_['merge'](_0x1075ef['where'],{'$or':_[_0x15cc('0x3c')](_0x1075ef['attributes'],function(_0x19e65f){var _0x1314a2={};_0x1314a2[_0x19e65f]={'$like':'%'+_0x23a20e[_0x15cc('0x5a')][_0x15cc('0x65')]+'%'};return _0x1314a2;})});}_0x1075ef=_['merge']({},_0x1075ef,_0x23a20e[_0x15cc('0x68')]);return _0x1cd0ea['getProactiveActions'](_0x1075ef);}})['then'](function(_0x1b0a68){if(_0x1b0a68){_0x2b96ff=_0x1b0a68[_0x15cc('0x60')];if(!_0x23a20e['query'][_0x15cc('0xfa')]('nolimit')){_0x1075ef['limit']=qs['limit'](_0x23a20e[_0x15cc('0x5a')][_0x15cc('0x24')]);_0x1075ef[_0x15cc('0x23')]=qs[_0x15cc('0x23')](_0x23a20e['query']['offset']);}return _0x1cd0ea[_0x15cc('0x102')](_0x1075ef);}})[_0x15cc('0x15')](function(_0x4da513){if(_0x4da513){return _0x4da513?{'count':_0x2b96ff,'rows':_0x4da513}:null;}})['then'](respondWithResult(_0x273873,null))[_0x15cc('0x6d')](handleError(_0x273873,null));};exports[_0x15cc('0x121')]=function(_0x58fe15,_0x3b075e){var _0x5ce6bb=_0x58fe15[_0x15cc('0x5a')][_0x15cc('0x122')]==='false'?_0x15cc('0x123'):_0x15cc('0x124');return db['ChatWebsite']['find']({'attributes':['id',_0x5ce6bb],'where':{'id':_0x58fe15[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x3b075e,null))[_0x15cc('0x15')](function(_0x59dbe7){if(_0x59dbe7){var _0x5d90ac=_0x59dbe7[_0x5ce6bb];var _0x2fbf97=_0x5d90ac&&_0x5d90ac[_0x15cc('0x125')]?_0x5d90ac['items']:[];_0x3b075e['send']({'fromKey':_['isNil'](_0x5d90ac['fromKey'])?undefined:_0x5d90ac['fromKey'],'count':_0x2fbf97[_0x15cc('0x60')],'rows':_0x2fbf97});}})[_0x15cc('0x6d')](handleError(_0x3b075e,null));};exports['getOfflineMessages']=function(_0x31dad7,_0x502234){var _0x2debb7={'raw':![],'where':{}};var _0x280102={};var _0x468fdc={'count':0x0,'rows':[]};return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x31dad7['params']['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x502234,null))[_0x15cc('0x15')](function(_0x5d9fd2){if(_0x5d9fd2){_0x280102[_0x15cc('0x53')]=_[_0x15cc('0x5b')](db['ChatOfflineMessage'][_0x15cc('0x70')]);_0x280102[_0x15cc('0x5a')]=_[_0x15cc('0x5b')](_0x31dad7[_0x15cc('0x5a')]);_0x280102[_0x15cc('0x5c')]=_['intersection'](_0x280102[_0x15cc('0x53')],_0x280102['query']);_0x2debb7[_0x15cc('0x5f')]=_[_0x15cc('0x5d')](_0x280102[_0x15cc('0x53')],qs[_0x15cc('0x5e')](_0x31dad7[_0x15cc('0x5a')][_0x15cc('0x5e')]));_0x2debb7[_0x15cc('0x5f')]=_0x2debb7['attributes'][_0x15cc('0x60')]?_0x2debb7['attributes']:_0x280102[_0x15cc('0x53')];if(!_0x31dad7['query'][_0x15cc('0xfa')](_0x15cc('0x61'))){_0x2debb7['limit']=qs[_0x15cc('0x24')](_0x31dad7[_0x15cc('0x5a')][_0x15cc('0x24')]);_0x2debb7[_0x15cc('0x23')]=qs['offset'](_0x31dad7[_0x15cc('0x5a')]['offset']);}_0x2debb7[_0x15cc('0x80')]=qs['sort'](_0x31dad7[_0x15cc('0x5a')]['sort']);_0x2debb7['where']=qs['filters'](_[_0x15cc('0x64')](_0x31dad7[_0x15cc('0x5a')],_0x280102['filters']));_0x2debb7['where'][_0x15cc('0x7d')]=_0x5d9fd2['id'];if(_0x31dad7['query'][_0x15cc('0x65')]){_0x2debb7[_0x15cc('0x63')]=_['merge'](_0x2debb7[_0x15cc('0x63')],{'$or':_[_0x15cc('0x3c')](_0x2debb7[_0x15cc('0x5f')],function(_0x57caa9){var _0x442a47={};_0x442a47[_0x57caa9]={'$like':'%'+_0x31dad7[_0x15cc('0x5a')][_0x15cc('0x65')]+'%'};return _0x442a47;})});}_0x2debb7=_[_0x15cc('0x66')]({},_0x2debb7,_0x31dad7[_0x15cc('0x68')]);return db[_0x15cc('0xdb')][_0x15cc('0x26')]({'where':_0x2debb7[_0x15cc('0x63')]})[_0x15cc('0x15')](function(_0x4471a6){_0x468fdc[_0x15cc('0x26')]=_0x4471a6;if(_0x31dad7[_0x15cc('0x5a')]['includeAll']){_0x2debb7[_0x15cc('0x6a')]=[{'all':!![]}];}else{_0x2debb7[_0x15cc('0x6a')]=[{'model':db['CmContact'],'as':_0x15cc('0xfb'),'required':![]},{'model':db[_0x15cc('0x126')],'as':'Attachments','required':![]}];}return db[_0x15cc('0xdb')][_0x15cc('0x6b')](_0x2debb7);})[_0x15cc('0x15')](function(_0x19a4dd){_0x468fdc['rows']=_0x19a4dd;return _0x468fdc;});}})['then'](respondWithFilteredResult(_0x502234,_0x2debb7))[_0x15cc('0x6d')](handleError(_0x502234,null));};exports[_0x15cc('0x127')]=function(_0x328886,_0x407c6f){return db['ChatWebsite']['find']({'where':{'id':_0x328886['params']['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x407c6f,null))[_0x15cc('0x15')](function(_0x204365){if(_0x204365){return _0x204365[_0x15cc('0x127')](_0x328886['body'][_0x15cc('0x83')],_[_0x15cc('0xf9')](_0x328886['body'],[_0x15cc('0x83'),'id'])||{})[_0x15cc('0xb2')](function(_0x150ccb){for(var _0x3682cb=0x0;_0x3682cb<_0x328886['body'][_0x15cc('0x83')][_0x15cc('0x60')];_0x3682cb+=0x1){socket[_0x15cc('0x128')](_0x15cc('0x129'),{'UserId':Number(_0x328886[_0x15cc('0x7a')]['ids'][_0x3682cb]),'ChatWebsiteId':Number(_0x328886[_0x15cc('0x79')]['id'])});}return _0x150ccb;});}})[_0x15cc('0x15')](respondWithResult(_0x407c6f,null))[_0x15cc('0x6d')](handleError(_0x407c6f,null));};exports[_0x15cc('0x12a')]=function(_0x1313ae,_0x1d4959){return db[_0x15cc('0x56')][_0x15cc('0x76')]({'where':{'id':_0x1313ae[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x1d4959,null))['then'](function(_0x382a7e){if(_0x382a7e){return _0x382a7e['removeAgents'](_0x1313ae['query'][_0x15cc('0x83')])['then'](function(){if(_[_0x15cc('0x12b')](_0x1313ae[_0x15cc('0x5a')][_0x15cc('0x83')])){for(var _0x689cc4=0x0;_0x689cc4<_0x1313ae[_0x15cc('0x5a')]['ids']['length'];_0x689cc4+=0x1){socket[_0x15cc('0x128')](_0x15cc('0x12c'),{'UserId':Number(_0x1313ae['query'][_0x15cc('0x83')][_0x689cc4]),'ChatWebsiteId':Number(_0x1313ae['params']['id'])});}}else{socket[_0x15cc('0x128')](_0x15cc('0x12c'),{'UserId':Number(_0x1313ae[_0x15cc('0x5a')][_0x15cc('0x83')]),'ChatWebsiteId':Number(_0x1313ae[_0x15cc('0x79')]['id'])});}});}})[_0x15cc('0x15')](respondWithStatusCode(_0x1d4959,null))[_0x15cc('0x6d')](handleError(_0x1d4959,null));};exports['getAgents']=function(_0x1acaba,_0x33edf6){var _0x19a150={};var _0x3ff2b7={};var _0x17f733;var _0x32024f;return db[_0x15cc('0x56')][_0x15cc('0x7f')]({'where':{'id':_0x1acaba[_0x15cc('0x79')]['id']}})[_0x15cc('0x15')](handleEntityNotFound(_0x33edf6,null))[_0x15cc('0x15')](function(_0x3bf826){if(_0x3bf826){_0x17f733=_0x3bf826;_0x3ff2b7[_0x15cc('0x53')]=_['keys'](db[_0x15cc('0xfc')][_0x15cc('0x70')]);_0x3ff2b7['query']=_['keys'](_0x1acaba[_0x15cc('0x5a')]);_0x3ff2b7['filters']=_[_0x15cc('0x5d')](_0x3ff2b7[_0x15cc('0x53')],_0x3ff2b7['query']);_0x19a150['attributes']=_['intersection'](_0x3ff2b7['model'],qs['fields'](_0x1acaba[_0x15cc('0x5a')]['fields']));_0x19a150[_0x15cc('0x5f')]=_0x19a150[_0x15cc('0x5f')][_0x15cc('0x60')]?_0x19a150[_0x15cc('0x5f')]:_0x3ff2b7[_0x15cc('0x53')];_0x19a150[_0x15cc('0x80')]=qs[_0x15cc('0x62')](_0x1acaba[_0x15cc('0x5a')][_0x15cc('0x62')]);_0x19a150[_0x15cc('0x63')]=qs[_0x15cc('0x5c')](_[_0x15cc('0x64')](_0x1acaba[_0x15cc('0x5a')],_0x3ff2b7[_0x15cc('0x5c')]));if(_0x1acaba[_0x15cc('0x5a')][_0x15cc('0x65')]){_0x19a150['where']=_[_0x15cc('0x66')](_0x19a150[_0x15cc('0x63')],{'$or':_[_0x15cc('0x3c')](_0x19a150[_0x15cc('0x5f')],function(_0x30a727){var _0x136dec={};_0x136dec[_0x30a727]={'$like':'%'+_0x1acaba[_0x15cc('0x5a')][_0x15cc('0x65')]+'%'};return _0x136dec;})});}_0x19a150=_[_0x15cc('0x66')]({},_0x19a150,_0x1acaba['options']);return _0x17f733['getAgents'](_0x19a150);}})[_0x15cc('0x15')](function(_0x428c5d){if(_0x428c5d){_0x32024f=_0x428c5d['length'];if(!_0x1acaba[_0x15cc('0x5a')][_0x15cc('0xfa')](_0x15cc('0x61'))){_0x19a150[_0x15cc('0x24')]=qs[_0x15cc('0x24')](_0x1acaba[_0x15cc('0x5a')][_0x15cc('0x24')]);_0x19a150[_0x15cc('0x23')]=qs['offset'](_0x1acaba['query'][_0x15cc('0x23')]);}return _0x17f733[_0x15cc('0x12d')](_0x19a150);}})[_0x15cc('0x15')](function(_0x1e75a5){if(_0x1e75a5){return _0x1e75a5?{'count':_0x32024f,'rows':_0x1e75a5}:null;}})[_0x15cc('0x15')](respondWithResult(_0x33edf6,null))['catch'](handleError(_0x33edf6,null));}; \ No newline at end of file +var _0x2a28=['all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','name','version','unknown','device','model','vendor','type','index','Pause','map','ChatWebsite','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','options','removeDispositions','addAnswer','CannedAnswer','rawAttributes','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','download','getAvatar','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','mapKey','CmList','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','orderBy','priority','asc','account','Contacts','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','contact','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','fullname','Tag','color','tag','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','headers','remoteAddress','virtual','replace','render','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','ChatOfflineMessage','Contact','Attachments','addAgents','emit','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','client','http','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','catch','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','update','then','get','ChatWebsites','UserProfileResource','destroy','send','getSnippet','timezone','interval','format','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','Interval','Intervals'];(function(_0x51c2e5,_0x4f912f){var _0x49dd1c=function(_0x390b3d){while(--_0x390b3d){_0x51c2e5['push'](_0x51c2e5['shift']());}};_0x49dd1c(++_0x4f912f);}(_0x2a28,0xef));var _0x82a2=function(_0x25ff67,_0x1bfac5){_0x25ff67=_0x25ff67-0x0;var _0x2667ef=_0x2a28[_0x25ff67];return _0x2667ef;};'use strict';var Mustache=require(_0x82a2('0x0'));var util=require('util');var path=require(_0x82a2('0x1'));var ejs=require(_0x82a2('0x2'));var fs=require('fs');var fs_extra=require(_0x82a2('0x3'));var _=require(_0x82a2('0x4'));var querystring=require(_0x82a2('0x5'));var htmlToText=require('html-to-text');var Redis=require(_0x82a2('0x6'));var jayson=require(_0x82a2('0x7'));var url=require('url');var qs=require(_0x82a2('0x8'));var logger=require(_0x82a2('0x9'))(_0x82a2('0xa'));var config=require(_0x82a2('0xb'));var APIOutOfIntervalError=require(_0x82a2('0xc'))[_0x82a2('0xd')];var APINotFoundError=require(_0x82a2('0xc'))[_0x82a2('0xe')];var APIHandleError=require(_0x82a2('0xc'))[_0x82a2('0xf')];var db=require(_0x82a2('0x10'))['db'];config['redis']=_[_0x82a2('0x11')](config['redis'],{'host':_0x82a2('0x12'),'port':0x18eb});var socket=require(_0x82a2('0x13'))(new Redis(config[_0x82a2('0x14')]));require(_0x82a2('0x15'))[_0x82a2('0x16')](socket);var client=jayson[_0x82a2('0x17')]['http']({'port':0x232c});var client9002=jayson['client'][_0x82a2('0x18')]({'port':0x232a});var client9003=jayson[_0x82a2('0x17')][_0x82a2('0x18')]({'port':0x232b});var client9001=jayson[_0x82a2('0x17')]['http']({'port':0x2329});function respondWithRpcPromise(_0x4b4131,_0x119888,_0x27d2ee,_0x3e9fce){return new Promise(function(_0xab8606,_0x369569){var _0x1f02da=_0x3e9fce||client;return _0x1f02da['request'](_0x4b4131,_0x27d2ee)['then'](function(_0xe3b699){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x119888,_0x82a2('0x19'));logger['debug'](_0x82a2('0x1a'),_0x119888,_0x82a2('0x19'),JSON[_0x82a2('0x1b')](_0xe3b699));if(_0xe3b699[_0x82a2('0x1c')]){if(_0xe3b699[_0x82a2('0x1c')][_0x82a2('0x1d')]===0x1f4){logger[_0x82a2('0x1c')](_0x82a2('0x1e'),_0x119888,_0xe3b699[_0x82a2('0x1c')][_0x82a2('0x1f')]);return _0x369569(_0xe3b699['error'][_0x82a2('0x1f')]);}logger['error'](_0x82a2('0x1e'),_0x119888,_0xe3b699[_0x82a2('0x1c')][_0x82a2('0x1f')]);return _0xab8606(_0xe3b699[_0x82a2('0x1c')]['message']);}else{logger[_0x82a2('0x20')](_0x82a2('0x1e'),_0x119888,_0x82a2('0x19'));_0xab8606(_0xe3b699['result'][_0x82a2('0x1f')]);}})[_0x82a2('0x21')](function(_0xe0d2c6){logger['error'](_0x82a2('0x1e'),_0x119888,_0xe0d2c6);_0x369569(_0xe0d2c6);});});}function respondWithStatusCode(_0xe1db4d,_0x14bf2b){_0x14bf2b=_0x14bf2b||0xcc;return function(_0x50ca7d){if(_0x50ca7d){return _0xe1db4d[_0x82a2('0x22')](_0x14bf2b);}return _0xe1db4d['status'](_0x14bf2b)[_0x82a2('0x23')]();};}function respondWithResult(_0x1d542b,_0x5aef35){_0x5aef35=_0x5aef35||0xc8;return function(_0x99810f){if(_0x99810f){return _0x1d542b['status'](_0x5aef35)[_0x82a2('0x24')](_0x99810f);}};}function respondWithFilteredResult(_0x477f58,_0x35d3ec){return function(_0x2edd73){if(_0x2edd73){var _0x2b6887=typeof _0x35d3ec[_0x82a2('0x25')]==='undefined'&&typeof _0x35d3ec[_0x82a2('0x26')]===_0x82a2('0x27');var _0x3c161e=_0x2edd73[_0x82a2('0x28')];var _0x4648a3=_0x2b6887?0x0:_0x35d3ec['offset'];var _0x47403b=_0x2b6887?_0x2edd73['count']:_0x35d3ec['offset']+_0x35d3ec[_0x82a2('0x26')];var _0x3c0ed6;if(_0x47403b>=_0x3c161e){_0x47403b=_0x3c161e;_0x3c0ed6=0xc8;}else{_0x3c0ed6=0xce;}_0x477f58[_0x82a2('0x29')](_0x3c0ed6);return _0x477f58[_0x82a2('0x2a')](_0x82a2('0x2b'),_0x4648a3+'-'+_0x47403b+'/'+_0x3c161e)[_0x82a2('0x24')](_0x2edd73);}return null;};}function saveUpdates(_0xede7cc){return function(_0xb0f447){if(_0xb0f447){return _0xb0f447[_0x82a2('0x2c')](_0xede7cc)[_0x82a2('0x2d')](function(_0x33d5bf){return _0x33d5bf;});}return null;};}function removeEntity(_0x148d32){return function(_0x1b5967){if(_0x1b5967){return _0x1b5967['destroy']()['then'](function(){var _0x353cff=_0x1b5967[_0x82a2('0x2e')]({'plain':!![]});var _0x3dd6bb=_0x82a2('0x2f');return db[_0x82a2('0x30')][_0x82a2('0x31')]({'where':{'type':_0x3dd6bb,'resourceId':_0x353cff['id']}})['then'](function(){return _0x1b5967;});})[_0x82a2('0x2d')](function(){_0x148d32['status'](0xcc)[_0x82a2('0x23')]();});}};}function handleEntityNotFound(_0x66e689){return function(_0x3dd69d){if(!_0x3dd69d){_0x66e689[_0x82a2('0x22')](0x194);}return _0x3dd69d;};}function handleError(_0x854a52,_0x39a659){_0x39a659=_0x39a659||0x1f4;return function(_0x231735){logger[_0x82a2('0x1c')](_0x231735['stack']);if(_0x231735['name']){delete _0x231735['name'];}_0x854a52[_0x82a2('0x29')](_0x39a659)[_0x82a2('0x32')](_0x231735);};}function iftimePromise(_0x231238,_0x245248){return respondWithRpcPromise('Command',_0x82a2('0x33'),{'command':_0x245248[_0x82a2('0x34')]?util['format']('iftime\x20%s,%s',_0x231238[_0x82a2('0x35')],_0x245248[_0x82a2('0x34')]):util[_0x82a2('0x36')](_0x82a2('0x37'),_0x231238['interval'])},client9002)[_0x82a2('0x2d')](function(_0x1c56b2){var _0x4a22a7=_0x1c56b2&&_0x1c56b2[_0x82a2('0x38')](_0x82a2('0x39'))>=0x0?!![]:![];logger[_0x82a2('0x20')](_0x82a2('0x3a'),_0x245248['id'],_0x231238['id'],_0x231238[_0x82a2('0x35')],_0x4a22a7?'ONLINE':'OFFLINE',_0x245248['timezone']?_0x245248[_0x82a2('0x34')]:_0x82a2('0x3b'));return _0x4a22a7;})[_0x82a2('0x21')](function(_0x15ec3e){logger[_0x82a2('0x1c')](_0x82a2('0x3a'),_0x245248['id'],_0x231238['id'],_0x231238[_0x82a2('0x35')],util['inspect'](_0x15ec3e,{'showHidden':![],'depth':null}),_0x245248[_0x82a2('0x34')]?_0x245248[_0x82a2('0x34')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x75060f){var _0x45d5ef=_['map'](_0x75060f[_0x82a2('0x3c')][_0x82a2('0x3d')],function(_0xb7deeb){var _0x15bfe7=_0xb7deeb[_0x82a2('0x2e')]({'plain':!![]});return iftimePromise(_0x15bfe7,_0x75060f);});return Promise[_0x82a2('0x3e')](_0x45d5ef)['then'](function(_0x48ecf1){return _[_0x82a2('0x3f')](_0x48ecf1);});}function createInteractionObject(_0x492dc9,_0x867a5,_0x49c43a,_0x35cf7e){var _0x53f0d1=require(_0x82a2('0x40'));var _0x30e201=new _0x53f0d1();var _0x2f6445=_0x30e201[_0x82a2('0x41')](_0x49c43a[_0x82a2('0x42')])[_0x82a2('0x43')]();var _0x35bbed=_0x867a5[_0x82a2('0x44')];if(_0x49c43a[_0x82a2('0x45')]){_0x35bbed=_0x49c43a['cf-connecting-ip'];}else if(_0x49c43a[_0x82a2('0x46')]){_0x35bbed=_[_0x82a2('0x47')](_0x49c43a['x-forwarded-for'][_0x82a2('0x48')](','));}return{'ContactId':_0x35cf7e['id'],'ChatWebsiteId':_0x492dc9,'from':(_0x35cf7e[_0x82a2('0x49')]||'')+'\x20'+(_0x35cf7e[_0x82a2('0x4a')]||''),'customerIp':_0x35bbed,'customerPort':_0x49c43a['x-real-port']?_0x49c43a[_0x82a2('0x4b')]:null,'referer':_0x867a5[_0x82a2('0x4c')],'browserName':_0x2f6445[_0x82a2('0x4d')][_0x82a2('0x4e')]&&_0x2f6445[_0x82a2('0x4d')][_0x82a2('0x4f')]?util['format']('%s\x20%s',_0x2f6445[_0x82a2('0x4d')]['name'],_0x2f6445[_0x82a2('0x4d')]['version']):_0x82a2('0x50'),'browserVersion':_0x2f6445[_0x82a2('0x4d')][_0x82a2('0x4f')]||_0x82a2('0x50'),'osName':util[_0x82a2('0x36')]('%s\x20%s',_0x2f6445['os'][_0x82a2('0x4e')],_0x2f6445['os']['version']),'osVersion':_0x2f6445['os'][_0x82a2('0x4f')],'deviceModel':_0x2f6445[_0x82a2('0x51')][_0x82a2('0x52')]&&_0x2f6445[_0x82a2('0x51')][_0x82a2('0x53')]?util[_0x82a2('0x36')]('%s\x20%s\x20%s',_0x2f6445[_0x82a2('0x51')][_0x82a2('0x52')],_0x2f6445['device'][_0x82a2('0x53')],_0x2f6445[_0x82a2('0x51')][_0x82a2('0x54')]):null,'deviceVendor':_0x2f6445[_0x82a2('0x51')][_0x82a2('0x53')],'deviceType':_0x2f6445[_0x82a2('0x51')][_0x82a2('0x54')],'formData':JSON[_0x82a2('0x1b')](_0x867a5)};}exports[_0x82a2('0x55')]=function(_0x388f4f,_0x511a8b){var _0x94c90a={'include':[{'model':db[_0x82a2('0x56')],'as':'mandatoryDispositionPause'}]},_0x85b0dc={},_0x374fdf={'count':0x0,'rows':[]};var _0x57f26a=_[_0x82a2('0x57')](db[_0x82a2('0x58')]['rawAttributes'],function(_0x34832d){return{'name':_0x34832d['fieldName'],'type':_0x34832d['type'][_0x82a2('0x59')]};});_0x85b0dc[_0x82a2('0x52')]=_[_0x82a2('0x57')](_0x57f26a,_0x82a2('0x4e'));_0x85b0dc[_0x82a2('0x5a')]=_[_0x82a2('0x5b')](_0x388f4f[_0x82a2('0x5a')]);_0x85b0dc[_0x82a2('0x5c')]=_[_0x82a2('0x5d')](_0x85b0dc[_0x82a2('0x52')],_0x85b0dc[_0x82a2('0x5a')]);_0x94c90a[_0x82a2('0x5e')]=_['intersection'](_0x85b0dc['model'],qs[_0x82a2('0x5f')](_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x94c90a[_0x82a2('0x5e')]=_0x94c90a[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x94c90a[_0x82a2('0x5e')]:_0x85b0dc['model'];if(!_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x61')]('nolimit')){_0x94c90a['limit']=qs['limit'](_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x26')]);_0x94c90a[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x388f4f['query'][_0x82a2('0x25')]);}_0x94c90a[_0x82a2('0x62')]=qs['sort'](_0x388f4f['query'][_0x82a2('0x63')]);_0x94c90a[_0x82a2('0x64')]=qs['filters'](_[_0x82a2('0x65')](_0x388f4f[_0x82a2('0x5a')],_0x85b0dc[_0x82a2('0x5c')]),_0x57f26a);if(_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x66')]){_0x94c90a[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0x94c90a[_0x82a2('0x64')],{'$or':_['map'](_0x57f26a,function(_0x2e743c){if(_0x2e743c[_0x82a2('0x54')]!==_0x82a2('0x68')){var _0x4f1d89={};_0x4f1d89[_0x2e743c[_0x82a2('0x4e')]]={'$like':'%'+_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x66')]+'%'};return _0x4f1d89;}})});}_0x94c90a=_[_0x82a2('0x67')]({},_0x94c90a,_0x388f4f['options']);var _0x30d426={'where':_0x94c90a[_0x82a2('0x64')]};return db[_0x82a2('0x58')][_0x82a2('0x28')](_0x30d426)['then'](function(_0x2b555b){_0x374fdf['count']=_0x2b555b;if(_0x388f4f[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x94c90a[_0x82a2('0x6a')]=[{'all':!![]}];}return db[_0x82a2('0x58')][_0x82a2('0x6b')](_0x94c90a);})['then'](function(_0x1285bf){_0x374fdf[_0x82a2('0x6c')]=_0x1285bf;return _0x374fdf;})[_0x82a2('0x2d')](respondWithFilteredResult(_0x511a8b,_0x94c90a))[_0x82a2('0x21')](handleError(_0x511a8b,null));};exports[_0x82a2('0x6d')]=function(_0x475578,_0x54fd6e){var _0x48969a={'raw':![],'where':{'id':_0x475578[_0x82a2('0x6e')]['id']},'include':[{'model':db[_0x82a2('0x56')],'as':_0x82a2('0x6f')}]},_0x2f1763={};_0x2f1763[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0x58')]['rawAttributes']);_0x2f1763[_0x82a2('0x5a')]=_['keys'](_0x475578['query']);_0x2f1763[_0x82a2('0x5c')]=_[_0x82a2('0x5d')](_0x2f1763['model'],_0x2f1763[_0x82a2('0x5a')]);_0x48969a[_0x82a2('0x5e')]=_[_0x82a2('0x5d')](_0x2f1763['model'],qs[_0x82a2('0x5f')](_0x475578[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x48969a[_0x82a2('0x5e')]=_0x48969a[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x48969a[_0x82a2('0x5e')]:_0x2f1763[_0x82a2('0x52')];if(_0x475578[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x48969a[_0x82a2('0x6a')]=[{'all':!![]}];}_0x48969a=_['merge']({},_0x48969a,_0x475578['options']);return db['ChatWebsite'][_0x82a2('0x70')](_0x48969a)[_0x82a2('0x2d')](handleEntityNotFound(_0x54fd6e,null))[_0x82a2('0x2d')](respondWithResult(_0x54fd6e,null))[_0x82a2('0x21')](handleError(_0x54fd6e,null));};exports[_0x82a2('0x71')]=function(_0x1c7a2a,_0x2c5feb){return db[_0x82a2('0x58')][_0x82a2('0x71')](_0x1c7a2a[_0x82a2('0x72')],{})[_0x82a2('0x2d')](function(_0x4ea071){var _0xfd98d=_0x1c7a2a[_0x82a2('0x73')][_0x82a2('0x2e')]({'plain':!![]});if(!_0xfd98d)throw new Error(_0x82a2('0x74'));if(_0xfd98d[_0x82a2('0x75')]===_0x82a2('0x73')){var _0x626ae5=_0x4ea071[_0x82a2('0x2e')]({'plain':!![]});var _0x5d99b4=_0x82a2('0x2f');return db['UserProfileSection'][_0x82a2('0x70')]({'where':{'name':_0x5d99b4,'userProfileId':_0xfd98d[_0x82a2('0x76')]},'raw':!![]})['then'](function(_0x38048d){if(_0x38048d&&_0x38048d[_0x82a2('0x77')]===0x0){return db['UserProfileResource']['create']({'name':_0x626ae5[_0x82a2('0x4e')],'resourceId':_0x626ae5['id'],'type':_0x38048d[_0x82a2('0x4e')],'sectionId':_0x38048d['id']},{})[_0x82a2('0x2d')](function(){return _0x4ea071;});}else{return _0x4ea071;}})[_0x82a2('0x21')](function(_0x3c09dc){logger[_0x82a2('0x1c')](_0x82a2('0x78'),_0x3c09dc);throw _0x3c09dc;});}return _0x4ea071;})['then'](respondWithResult(_0x2c5feb,0xc9))[_0x82a2('0x21')](handleError(_0x2c5feb,null));};exports[_0x82a2('0x2c')]=function(_0x4aa053,_0x4222a4){if(_0x4aa053[_0x82a2('0x72')]['id']){delete _0x4aa053['body']['id'];}return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x4aa053[_0x82a2('0x6e')]['id']},'include':[{'model':db[_0x82a2('0x56')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4222a4,null))[_0x82a2('0x2d')](saveUpdates(_0x4aa053[_0x82a2('0x72')],null))[_0x82a2('0x2d')](respondWithResult(_0x4222a4,null))[_0x82a2('0x21')](handleError(_0x4222a4,null));};exports['destroy']=function(_0x1ca555,_0x2e2cb3){return db['ChatWebsite'][_0x82a2('0x70')]({'where':{'id':_0x1ca555[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x2e2cb3,null))['then'](removeEntity(_0x2e2cb3,null))[_0x82a2('0x21')](handleError(_0x2e2cb3,null));};exports[_0x82a2('0x79')]=function(_0x6cbbc0,_0x1da8aa){return db[_0x82a2('0x58')]['describe']()[_0x82a2('0x2d')](respondWithResult(_0x1da8aa,null))[_0x82a2('0x21')](handleError(_0x1da8aa,null));};exports[_0x82a2('0x7a')]=function(_0x4a5d29,_0xa2c7fd){if(_0x4a5d29[_0x82a2('0x72')]['id']){delete _0x4a5d29['body']['id'];}return db['ChatWebsite'][_0x82a2('0x70')]({'where':{'id':_0x4a5d29[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0xa2c7fd,null))[_0x82a2('0x2d')](function(_0x750c88){if(_0x750c88){_0x4a5d29[_0x82a2('0x72')][_0x82a2('0x7b')]=_0x750c88['id'];return db[_0x82a2('0x7c')]['create'](_0x4a5d29['body']);}})['then'](respondWithResult(_0xa2c7fd,null))[_0x82a2('0x21')](handleError(_0xa2c7fd,null));};exports[_0x82a2('0x7d')]=function(_0x2d5b5f,_0x23133a){var _0x4f2f12={'raw':![],'where':{}};var _0x2e774f={};var _0xa87a36={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x82a2('0x7e')]({'where':{'id':_0x2d5b5f[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x23133a,null))[_0x82a2('0x2d')](function(_0x508632){if(_0x508632){_0x2e774f[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0x7c')]['rawAttributes']);_0x2e774f[_0x82a2('0x5a')]=_[_0x82a2('0x5b')](_0x2d5b5f['query']);_0x2e774f[_0x82a2('0x5c')]=_[_0x82a2('0x5d')](_0x2e774f['model'],_0x2e774f[_0x82a2('0x5a')]);_0x4f2f12[_0x82a2('0x5e')]=_[_0x82a2('0x5d')](_0x2e774f[_0x82a2('0x52')],qs['fields'](_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x4f2f12[_0x82a2('0x5e')]=_0x4f2f12[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x4f2f12[_0x82a2('0x5e')]:_0x2e774f[_0x82a2('0x52')];if(!_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x61')](_0x82a2('0x7f'))){_0x4f2f12['limit']=qs[_0x82a2('0x26')](_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x26')]);_0x4f2f12[_0x82a2('0x25')]=qs['offset'](_0x2d5b5f[_0x82a2('0x5a')]['offset']);}_0x4f2f12['order']=qs[_0x82a2('0x63')](_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x63')]);_0x4f2f12[_0x82a2('0x64')]=qs[_0x82a2('0x5c')](_['pick'](_0x2d5b5f[_0x82a2('0x5a')],_0x2e774f[_0x82a2('0x5c')]));_0x4f2f12[_0x82a2('0x64')][_0x82a2('0x7b')]=_0x508632['id'];if(_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x66')]){_0x4f2f12[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0x4f2f12['where'],{'$or':_[_0x82a2('0x57')](_0x4f2f12[_0x82a2('0x5e')],function(_0x2fded3){var _0x8ab190={};_0x8ab190[_0x2fded3]={'$like':'%'+_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x66')]+'%'};return _0x8ab190;})});}_0x4f2f12=_[_0x82a2('0x67')]({},_0x4f2f12,_0x2d5b5f[_0x82a2('0x80')]);return db[_0x82a2('0x7c')]['count']({'where':_0x4f2f12[_0x82a2('0x64')]})[_0x82a2('0x2d')](function(_0x2a86eb){_0xa87a36[_0x82a2('0x28')]=_0x2a86eb;if(_0x2d5b5f[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x4f2f12['include']=[{'all':!![]}];}return db[_0x82a2('0x7c')][_0x82a2('0x6b')](_0x4f2f12);})[_0x82a2('0x2d')](function(_0x3daacd){_0xa87a36[_0x82a2('0x6c')]=_0x3daacd;return _0xa87a36;});}})[_0x82a2('0x2d')](respondWithFilteredResult(_0x23133a,_0x4f2f12))['catch'](handleError(_0x23133a,null));};exports['removeDispositions']=function(_0x299e7b,_0x229053){return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x299e7b[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x229053,null))[_0x82a2('0x2d')](function(_0x527005){if(_0x527005){return _0x527005[_0x82a2('0x81')](_0x299e7b[_0x82a2('0x5a')]['ids']);}})[_0x82a2('0x2d')](respondWithStatusCode(_0x229053,null))[_0x82a2('0x21')](handleError(_0x229053,null));};exports[_0x82a2('0x82')]=function(_0x3f14d6,_0x4f8774){if(_0x3f14d6[_0x82a2('0x72')]['id']){delete _0x3f14d6['body']['id'];}return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x3f14d6[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x4f8774,null))[_0x82a2('0x2d')](function(_0x479828){if(_0x479828){_0x3f14d6[_0x82a2('0x72')][_0x82a2('0x7b')]=_0x479828['id'];return db[_0x82a2('0x83')][_0x82a2('0x71')](_0x3f14d6[_0x82a2('0x72')]);}})[_0x82a2('0x2d')](respondWithResult(_0x4f8774,null))['catch'](handleError(_0x4f8774,null));};exports['getAnswers']=function(_0x31eef5,_0x374548){var _0x371bed={'raw':![],'where':{}};var _0x240d31={};var _0x31326c={'count':0x0,'rows':[]};return db[_0x82a2('0x58')][_0x82a2('0x7e')]({'where':{'id':_0x31eef5[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x374548,null))[_0x82a2('0x2d')](function(_0x36acaf){if(_0x36acaf){_0x240d31[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0x83')][_0x82a2('0x84')]);_0x240d31[_0x82a2('0x5a')]=_['keys'](_0x31eef5[_0x82a2('0x5a')]);_0x240d31[_0x82a2('0x5c')]=_['intersection'](_0x240d31[_0x82a2('0x52')],_0x240d31[_0x82a2('0x5a')]);_0x371bed[_0x82a2('0x5e')]=_['intersection'](_0x240d31[_0x82a2('0x52')],qs[_0x82a2('0x5f')](_0x31eef5[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x371bed['attributes']=_0x371bed[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x371bed['attributes']:_0x240d31[_0x82a2('0x52')];if(!_0x31eef5[_0x82a2('0x5a')]['hasOwnProperty']('nolimit')){_0x371bed[_0x82a2('0x26')]=qs[_0x82a2('0x26')](_0x31eef5['query']['limit']);_0x371bed[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x31eef5[_0x82a2('0x5a')][_0x82a2('0x25')]);}_0x371bed[_0x82a2('0x62')]=qs['sort'](_0x31eef5[_0x82a2('0x5a')][_0x82a2('0x63')]);_0x371bed[_0x82a2('0x64')]=qs[_0x82a2('0x5c')](_[_0x82a2('0x65')](_0x31eef5[_0x82a2('0x5a')],_0x240d31[_0x82a2('0x5c')]));_0x371bed[_0x82a2('0x64')][_0x82a2('0x7b')]=_0x36acaf['id'];if(_0x31eef5[_0x82a2('0x5a')][_0x82a2('0x66')]){_0x371bed['where']=_['merge'](_0x371bed[_0x82a2('0x64')],{'$or':_[_0x82a2('0x57')](_0x371bed[_0x82a2('0x5e')],function(_0xdfc09e){var _0x8fe9e5={};_0x8fe9e5[_0xdfc09e]={'$like':'%'+_0x31eef5['query'][_0x82a2('0x66')]+'%'};return _0x8fe9e5;})});}_0x371bed=_['merge']({},_0x371bed,_0x31eef5[_0x82a2('0x80')]);return db['CannedAnswer'][_0x82a2('0x28')]({'where':_0x371bed['where']})[_0x82a2('0x2d')](function(_0x4b0ae9){_0x31326c[_0x82a2('0x28')]=_0x4b0ae9;if(_0x31eef5[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x371bed['include']=[{'all':!![]}];}return db[_0x82a2('0x83')]['findAll'](_0x371bed);})['then'](function(_0x126b12){_0x31326c[_0x82a2('0x6c')]=_0x126b12;return _0x31326c;});}})[_0x82a2('0x2d')](respondWithFilteredResult(_0x374548,_0x371bed))['catch'](handleError(_0x374548,null));};exports[_0x82a2('0x85')]=function(_0x3a3bf1,_0x4bd6fb){return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x3a3bf1[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x4bd6fb,null))[_0x82a2('0x2d')](function(_0x5c7e81){if(_0x5c7e81){return _0x5c7e81[_0x82a2('0x85')](_0x3a3bf1[_0x82a2('0x5a')]['ids']);}})[_0x82a2('0x2d')](respondWithStatusCode(_0x4bd6fb,null))[_0x82a2('0x21')](handleError(_0x4bd6fb,null));};exports[_0x82a2('0x86')]=function(_0x156f5f,_0x573619){_0x156f5f[_0x82a2('0x72')][_0x82a2('0x87')]=_0x156f5f[_0x82a2('0x88')][_0x82a2('0x89')];return db[_0x82a2('0x58')]['find']({'where':{'id':_0x156f5f[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x573619,null))[_0x82a2('0x2d')](saveUpdates(_0x156f5f[_0x82a2('0x72')],null))[_0x82a2('0x2d')](respondWithResult(_0x573619,null))['catch'](handleError(_0x573619,null));};exports['addAvatar']=function(_0xa8d78c,_0x259f8f){_0xa8d78c[_0x82a2('0x72')][_0x82a2('0x8a')]=_0xa8d78c[_0x82a2('0x88')]['filename'];return db['ChatWebsite'][_0x82a2('0x70')]({'where':{'id':_0xa8d78c[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x259f8f,null))[_0x82a2('0x2d')](saveUpdates(_0xa8d78c[_0x82a2('0x72')],null))[_0x82a2('0x2d')](respondWithResult(_0x259f8f,null))['catch'](handleError(_0x259f8f,null));};exports[_0x82a2('0x8b')]=function(_0x28c0ca,_0x2a5a56){_0x28c0ca[_0x82a2('0x72')][_0x82a2('0x8c')]=_0x28c0ca[_0x82a2('0x88')][_0x82a2('0x89')];return db['ChatWebsite'][_0x82a2('0x70')]({'where':{'id':_0x28c0ca[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x2a5a56,null))[_0x82a2('0x2d')](saveUpdates(_0x28c0ca[_0x82a2('0x72')],null))['then'](respondWithResult(_0x2a5a56,null))[_0x82a2('0x21')](handleError(_0x2a5a56,null));};exports[_0x82a2('0x8d')]=function(_0x2415b2,_0x1f3f24){_0x2415b2[_0x82a2('0x72')][_0x82a2('0x8e')]=_0x2415b2[_0x82a2('0x88')][_0x82a2('0x89')];return db['ChatWebsite']['find']({'where':{'id':_0x2415b2['params']['id']}})['then'](handleEntityNotFound(_0x1f3f24,null))[_0x82a2('0x2d')](saveUpdates(_0x2415b2['body'],null))[_0x82a2('0x2d')](respondWithResult(_0x1f3f24,null))['catch'](handleError(_0x1f3f24,null));};exports[_0x82a2('0x8f')]=function(_0x5824ac,_0x8992a3){var _0x490ac2=path[_0x82a2('0x90')](config[_0x82a2('0x91')],_0x82a2('0x92'));var _0x3e4986={'where':{'id':_0x5824ac[_0x82a2('0x6e')]['id']},'attributes':['id',_0x82a2('0x87')],'raw':!![]};var _0x43b983=![];return require(_0x82a2('0x93'))[_0x82a2('0x94')]()[_0x82a2('0x2d')](function(_0x4684e2){if(_0x4684e2){_0x43b983=_0x4684e2[_0x82a2('0x95')];}})[_0x82a2('0x2d')](function(){return db[_0x82a2('0x58')][_0x82a2('0x70')](_0x3e4986);})['then'](handleEntityNotFound(_0x8992a3,null))[_0x82a2('0x2d')](function(_0x25bf93){if(_0x25bf93){if(!_[_0x82a2('0x96')](_0x25bf93[_0x82a2('0x87')])){if(fs['existsSync'](path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server/files/images/logos/',_0x25bf93[_0x82a2('0x87')]))&&_0x43b983){_0x490ac2=path[_0x82a2('0x90')](config['root'],'server/files/images/logos/',_0x25bf93[_0x82a2('0x87')]);}}return _0x8992a3[_0x82a2('0x97')](_0x490ac2);}})[_0x82a2('0x21')](handleError(_0x8992a3,null));};exports[_0x82a2('0x98')]=function(_0x16bb57,_0x27be67){var _0x3ad642=path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server/files/images/avatars/default_avatar.png');var _0x4b39bd={'where':{'id':_0x16bb57[_0x82a2('0x6e')]['id']},'attributes':['id',_0x82a2('0x8a')],'raw':!![]};return db['ChatWebsite'][_0x82a2('0x70')](_0x4b39bd)[_0x82a2('0x2d')](handleEntityNotFound(_0x27be67,null))[_0x82a2('0x2d')](function(_0x3e117a){if(_0x3e117a){if(!_[_0x82a2('0x96')](_0x3e117a[_0x82a2('0x8a')])){if(fs[_0x82a2('0x99')](path['join'](config[_0x82a2('0x91')],'server/files/images/avatars/',_0x3e117a[_0x82a2('0x8a')]))){_0x3ad642=path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server/files/images/avatars/',_0x3e117a[_0x82a2('0x8a')]);}}return _0x27be67[_0x82a2('0x97')](_0x3ad642);}})['catch'](handleError(_0x27be67,null));};exports[_0x82a2('0x9a')]=function(_0x103532,_0x3dc4f9){var _0x405b95=path['join'](config[_0x82a2('0x91')],_0x82a2('0x9b'));var _0x432f8b={'where':{'id':_0x103532['params']['id']},'attributes':['id',_0x82a2('0x8c'),_0x82a2('0x9c')],'raw':!![]};return db[_0x82a2('0x58')][_0x82a2('0x70')](_0x432f8b)[_0x82a2('0x2d')](handleEntityNotFound(_0x3dc4f9,null))[_0x82a2('0x2d')](function(_0x5cda85){if(_0x5cda85){if(!_[_0x82a2('0x96')](_0x5cda85[_0x82a2('0x8c')])){if(fs['existsSync'](path['join'](config['root'],_0x82a2('0x9d'),_0x5cda85['customerAvatar']))&&_0x5cda85['showCustomerAvatar']){_0x405b95=path[_0x82a2('0x90')](config[_0x82a2('0x91')],_0x82a2('0x9d'),_0x5cda85['customerAvatar']);}}return _0x3dc4f9[_0x82a2('0x97')](_0x405b95);}})['catch'](handleError(_0x3dc4f9,null));};exports['getSystemAvatar']=function(_0xea6b04,_0xffb126){var _0xfd18b1=path[_0x82a2('0x90')](config[_0x82a2('0x91')],_0x82a2('0x9e'));var _0x319175={'where':{'id':_0xea6b04[_0x82a2('0x6e')]['id']},'attributes':['id',_0x82a2('0x8e')],'raw':!![]};return db[_0x82a2('0x58')]['find'](_0x319175)[_0x82a2('0x2d')](handleEntityNotFound(_0xffb126,null))['then'](function(_0x26003f){if(_0x26003f){if(!_[_0x82a2('0x96')](_0x26003f[_0x82a2('0x8e')])){if(fs[_0x82a2('0x99')](path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server/files/images/avatars/',_0x26003f['systemAvatar']))){_0xfd18b1=path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server/files/images/avatars/',_0x26003f[_0x82a2('0x8e')]);}}return _0xffb126['download'](_0xfd18b1);}})[_0x82a2('0x21')](handleError(_0xffb126,null));};exports[_0x82a2('0x9f')]=function(_0x1ec7ae,_0x2f7119){var _0x5f21f5={'body':_0x1ec7ae[_0x82a2('0x72')],'channel':_0x82a2('0xa0')};var _0x21ec70=[];var _0x4bafcc=[];var _0x4b39a5={};var _0x5b9445=![];return db[_0x82a2('0xa1')][_0x82a2('0x79')]()[_0x82a2('0x2d')](function(_0x11a7c6){if(!_0x11a7c6){throw new db['Sequelize'][(_0x82a2('0xa2'))](_0x82a2('0xa3'));}_0x21ec70=_[_0x82a2('0xa4')](_['keys'](_0x11a7c6),[_0x82a2('0xa5'),_0x82a2('0xa6')]);_0x4bafcc=_[_0x82a2('0xa4')](_[_0x82a2('0x5b')](_0x11a7c6),[_0x82a2('0xa5'),_0x82a2('0xa6'),_0x82a2('0xa7'),_0x82a2('0xa8')]);if(_0x1ec7ae['body']['id']){delete _0x1ec7ae['body']['id'];}if(_[_0x82a2('0x96')](_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xa9')])){throw new db[(_0x82a2('0xaa'))][(_0x82a2('0xa2'))](_0x82a2('0xab'));}if(_['isNil'](_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0x72')])||_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0x72')]===''){throw new db['Sequelize'][(_0x82a2('0xa2'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x82a2('0x96')](_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xac')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bafcc);}if(!_['includes'](_0x4bafcc,_0x1ec7ae['body'][_0x82a2('0xac')])){throw new db[(_0x82a2('0xaa'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bafcc);}_0x4b39a5[_0x1ec7ae[_0x82a2('0x72')]['mapKey']]=_0x1ec7ae['body'][_0x82a2('0xa9')];})[_0x82a2('0x2d')](function(){return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x1ec7ae[_0x82a2('0x6e')]['id']},'include':[{'model':db[_0x82a2('0xad')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4b39a5,'limit':0x1,'order':[['updatedAt',_0x82a2('0xae')]]}]},{'model':db[_0x82a2('0xaf')],'as':_0x82a2('0xb0')},{'model':db[_0x82a2('0x3c')],'as':_0x82a2('0x3c'),'include':[{'model':db['Interval'],'as':_0x82a2('0x3d'),'attributes':['id',_0x82a2('0x35')],'raw':!![]}]}]});})[_0x82a2('0x2d')](function(_0x4d763b){if(!_0x4d763b)throw new APINotFoundError(util[_0x82a2('0x36')](_0x82a2('0xb1'),_0x1ec7ae[_0x82a2('0x6e')]['id']));if(!_0x4d763b[_0x82a2('0x3c')]||!_0x4d763b[_0x82a2('0x3c')][_0x82a2('0x3d')])return[_0x4d763b,!![]];return[_0x4d763b,checkWebsiteIntervals(_0x4d763b)];})[_0x82a2('0xb2')](function(_0xd7cd86,_0x49f848){if(!_0x49f848)throw new APIOutOfIntervalError();if(!_0xd7cd86[_0x82a2('0xb3')])return;_0x5f21f5['account']=_0xd7cd86;_0x5f21f5['list']=_0xd7cd86['List'];_0x5f21f5['applications']=_[_0x82a2('0xb4')](_0xd7cd86['Applications'],[_0x82a2('0xb5')],[_0x82a2('0xb6')]);if(_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xb0')]){delete _0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xb0')];}if(_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xb3')]&&_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xb3')][_0x82a2('0xb8')]['length']){return _0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xb3')]['Contacts'][0x0];}var _0x573591=_['defaults'](_0x1ec7ae[_0x82a2('0x72')],{'firstName':_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xa9')],'ListId':_0xd7cd86['ListId']});_0x573591[_0x1ec7ae['body']['mapKey']]=_0x1ec7ae['body']['from'];return db['CmContact']['create'](_0x573591,{'fields':_0x21ec70,'raw':!![]});})[_0x82a2('0x2d')](function(_0x5474c8){_0x5f21f5['contact']=_0x5474c8;var _0x32b347=createInteractionObject(_0x1ec7ae[_0x82a2('0x6e')]['id'],_0x1ec7ae[_0x82a2('0x72')],_0x1ec7ae['headers'],_0x5474c8);var _0x2b35d2={'ChatWebsiteId':_0x1ec7ae['params']['id'],'closed':![]};if(_0x1ec7ae[_0x82a2('0x72')]['threadId']){_0x2b35d2[_0x82a2('0xb9')]=_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xb9')];return db[_0x82a2('0xba')][_0x82a2('0x70')]({'where':_0x2b35d2})[_0x82a2('0x2d')](function(_0x59f599){if(_0x59f599){_0x5b9445=!![];return _0x59f599;}_0x32b347['threadId']=_0x1ec7ae[_0x82a2('0x72')]['threadId'];_0x32b347[_0x82a2('0xbb')]=_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xbb')];return db[_0x82a2('0xba')][_0x82a2('0x71')](_0x32b347);});}_0x2b35d2[_0x82a2('0xbc')]=_0x5474c8['id'];if(_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xbd')]&&_0x1ec7ae['body'][_0x82a2('0xbd')]['id']){_0x2b35d2['id']=_0x1ec7ae['body']['interaction']['id'];return db[_0x82a2('0xba')][_0x82a2('0x70')]({'where':_0x2b35d2})['then'](function(_0x1602ba){if(_0x1602ba){_0x5b9445=!![];return _0x1602ba;}return db[_0x82a2('0xba')][_0x82a2('0x71')](_0x32b347);});}return db[_0x82a2('0xba')][_0x82a2('0x71')](_0x32b347);})[_0x82a2('0x2d')](function(_0x62df95){if(!_0x5b9445)return _0x62df95;var _0xa1928d={'from':(_0x5f21f5['contact'][_0x82a2('0x49')]||'')+'\x20'+(_0x5f21f5['contact'][_0x82a2('0x4a')]||'')};if(_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xb9')]&&_0x1ec7ae[_0x82a2('0x72')]['messageId']&&_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xb9')]!=_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xbe')]){_0xa1928d[_0x82a2('0xb9')]=_0x1ec7ae['body']['messageId'];}return _0x62df95[_0x82a2('0x2c')](_0xa1928d);})[_0x82a2('0x2d')](function(_0x3419d2){_0x5f21f5[_0x82a2('0xbd')]=_0x3419d2['get']({'plain':!![]});_0x5f21f5['interaction']['created']=!_0x5b9445;if(_0x5f21f5[_0x82a2('0xbd')][_0x82a2('0xbf')]){if(_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xc0')]){_0x5f21f5[_0x82a2('0xc1')][_0x82a2('0xc2')]({'id':0x0,'priority':_0x5f21f5[_0x82a2('0xc1')]['length']+0x1,'app':_0x82a2('0xc3'),'appdata':_0x82a2('0xc4'),'interval':_0x82a2('0xc5')});}}return db['ChatMessage']['create']({'body':_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0x72')],'ChatWebsiteId':_0x1ec7ae[_0x82a2('0x6e')]['id'],'ChatInteractionId':_0x3419d2['id'],'direction':'in','ContactId':_0x5f21f5[_0x82a2('0xc6')]['id'],'AttachmentId':_0x1ec7ae[_0x82a2('0x72')][_0x82a2('0xc7')]});})[_0x82a2('0x2d')](function(_0x16b266){_0x5f21f5[_0x82a2('0x1f')]=_0x16b266;if(!_0x5f21f5[_0x82a2('0xbd')][_0x82a2('0xc8')]){return;}return db[_0x82a2('0xc9')][_0x82a2('0x70')]({'attributes':['id',_0x82a2('0x4e')],'where':{'id':_0x5f21f5['interaction'][_0x82a2('0xc8')]}});})['then'](function(_0x14030c){if(_0x14030c){_0x5f21f5[_0x82a2('0xc1')][_0x82a2('0xca')]({'id':0x0,'priority':0x0,'app':_0x82a2('0xcb'),'appdata':_0x14030c['name']+','+(_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xcc')]||0xa),'interval':'*,*,*,*'});_0x5f21f5[_0x82a2('0xcd')]=!![];}if(!_0x5f21f5['interaction']['queueId']){return;}return db[_0x82a2('0xce')]['find']({'attributes':['id',_0x82a2('0x4e')],'where':{'id':_0x5f21f5[_0x82a2('0xbd')][_0x82a2('0xcf')]}});})[_0x82a2('0x2d')](function(_0x37bec6){if(_0x37bec6){_0x5f21f5['applications'][_0x82a2('0xca')]({'id':0x0,'priority':0x1,'app':_0x82a2('0xd0'),'appdata':_0x37bec6[_0x82a2('0x4e')]+','+(_0x5f21f5[_0x82a2('0xb7')][_0x82a2('0xd1')]||0x12c),'interval':_0x82a2('0xc5')});}return respondWithRpcPromise(_0x82a2('0xd2'),_0x82a2('0xd3'),_0x5f21f5);})['then'](function(_0x87f8f0){respondWithRpcPromise(_0x82a2('0xd4'),_0x82a2('0xd4'),{'event':_0x82a2('0x9f'),'message':_0x87f8f0},client9002);return _0x87f8f0;})[_0x82a2('0x2d')](respondWithResult(_0x2f7119,null))['catch'](APIHandleError(_0x2f7119));};exports['offline']=function(_0x2457db,_0x35670f){var _0x6fb706,_0x31a4cc,_0x5168f1;var _0x28fa5d=[];var _0x448c64={};var _0x5e85f0=_0x2457db[_0x82a2('0xd5')]||[];var _0x410e99=[];var _0x1df5e2;return db[_0x82a2('0xa1')][_0x82a2('0x79')]()['then'](function(_0x1d9b86){if(!_0x1d9b86){throw new db[(_0x82a2('0xaa'))]['ValidationError'](_0x82a2('0xa3'));}_0x28fa5d=_[_0x82a2('0xa4')](_[_0x82a2('0x5b')](_0x1d9b86),[_0x82a2('0xa5'),_0x82a2('0xa6'),'CompanyId',_0x82a2('0xa8')]);if(_0x2457db[_0x82a2('0x72')]['id']){delete _0x2457db['body']['id'];}if(_['isNil'](_0x2457db[_0x82a2('0x72')]['from'])){throw _0x35670f[_0x82a2('0x29')](0x1f4)['send'](new db['Sequelize'][(_0x82a2('0xa2'))](_0x82a2('0xab')));}if(_['isNil'](_0x2457db[_0x82a2('0x72')][_0x82a2('0x72')])||_0x2457db[_0x82a2('0x72')]['body']===''){throw _0x35670f[_0x82a2('0x29')](0x1f4)['send'](new db[(_0x82a2('0xaa'))][(_0x82a2('0xa2'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x82a2('0x96')](_0x2457db['body'][_0x82a2('0xd6')])){throw _0x35670f[_0x82a2('0x29')](0x1f4)[_0x82a2('0x32')](new db[(_0x82a2('0xaa'))]['ValidationError'](_0x82a2('0xd7')+_0x28fa5d));}if(!_[_0x82a2('0xd8')](_0x28fa5d,_0x2457db[_0x82a2('0x72')][_0x82a2('0xd6')])){throw _0x35670f['status'](0x1f4)[_0x82a2('0x32')](new db['Sequelize'][(_0x82a2('0xa2'))](_0x82a2('0xd9')+_0x28fa5d));}_0x448c64[_0x2457db[_0x82a2('0x72')][_0x82a2('0xd6')]]=_0x2457db['body'][_0x82a2('0xa9')];})[_0x82a2('0x2d')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2457db[_0x82a2('0x6e')]['id']},'include':[{'model':db[_0x82a2('0xad')],'as':_0x82a2('0xb3')},{'model':db[_0x82a2('0xda')],'as':_0x82a2('0xda')}]});})[_0x82a2('0x2d')](handleEntityNotFound(_0x35670f,null))[_0x82a2('0x2d')](function(_0x2c69cb){if(_0x2c69cb&&_0x2c69cb['List']){_0x31a4cc=_0x2c69cb;var _0x468623=_[_0x82a2('0x11')](_0x2457db[_0x82a2('0x72')],{'firstName':_0x2457db[_0x82a2('0x72')][_0x82a2('0xa9')],'phone':_0x2457db['body'][_0x82a2('0xa9')],'ListId':_0x2c69cb[_0x82a2('0xa8')]});_0x468623[_0x2457db['body'][_0x82a2('0xd6')]]=_0x2457db[_0x82a2('0x72')][_0x82a2('0xa9')];return db['CmContact']['findOrCreate']({'where':_0x448c64,'defaults':_0x468623});}})['spread'](function(_0x35e502){if(_0x35e502){_0x5168f1=_0x35e502;var _0x1895a4=fs['readFileSync'](path[_0x82a2('0x90')](config[_0x82a2('0x91')],_0x82a2('0xdb')),_0x82a2('0xdc'));var _0x84ae5a=ejs['render'](_0x1895a4,{'body':_[_0x82a2('0xdd')](_0x2457db[_0x82a2('0x72')][_0x82a2('0x72')]),'bodyTitle':_0x31a4cc['offlineMessageBody']});return db['ChatOfflineMessage'][_0x82a2('0x71')]({'body':_0x84ae5a,'plainBody':htmlToText['fromString'](_0x84ae5a),'ContactId':_0x35e502['id'],'ChatWebsiteId':_0x31a4cc['id']});}})['then'](function(_0x5c5c24){_0x1df5e2=_0x5c5c24;if(_0x5e85f0[_0x82a2('0x60')]){var _0x139fa0=_0x5e85f0[_0x82a2('0x57')](function(_0x16d121){return{'name':_0x16d121[_0x82a2('0xde')],'basename':_0x16d121['filename'],'type':_0x16d121[_0x82a2('0xdf')],'ChatOfflineMessageId':_0x5c5c24['id']};});_0x410e99=_0x139fa0[_0x82a2('0x57')](_0x121cd9=>{var _0x4f7bf9={'filename':_0x121cd9['name'],'path':path[_0x82a2('0x90')](config[_0x82a2('0x91')],_0x82a2('0xe0'),_0x82a2('0xd5'),_0x82a2('0xe1'),_0x82a2('0xe2'),_0x121cd9[_0x82a2('0xe3')])};return _0x4f7bf9;});if(!_0x31a4cc[_0x82a2('0xe4')]){return db[_0x82a2('0xe5')][_0x82a2('0xe6')](function(_0x64fda8){return db[_0x82a2('0xe7')][_0x82a2('0xe8')](_0x139fa0,{'transaction':_0x64fda8});});}}})['then'](function(){if(_0x1df5e2){_0x6fb706=_0x1df5e2;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x82a2('0xe9')],'as':_0x82a2('0xe9'),'raw':!![]}]}]});}})['then'](function(_0x3449e7){if(_0x3449e7&&_0x3449e7[_0x82a2('0xea')]&&_0x31a4cc[_0x82a2('0xeb')]&&_0x31a4cc[_0x82a2('0xec')]){var _0x15c245=_0x3449e7[_0x82a2('0xed')]();return respondWithRpcPromise(_0x82a2('0xee'),_0x82a2('0xef'),{'account':_0x15c245,'message':{'from':util[_0x82a2('0x36')](_0x82a2('0xf0'),_0x3449e7[_0x82a2('0x4e')],_0x3449e7[_0x82a2('0xf1')]||_0x3449e7[_0x82a2('0xea')][_0x82a2('0x73')]),'to':_0x31a4cc[_0x82a2('0xec')],'subject':_0x31a4cc[_0x82a2('0xf2')],'html':_0x6fb706[_0x82a2('0x72')],'attachments':_0x410e99}},client9003)['then'](function(){return _0x6fb706;})[_0x82a2('0x21')](function(_0x1c30ac){logger[_0x82a2('0x1c')](_0x1c30ac);});}})[_0x82a2('0x2d')](function(){if(_0x31a4cc&&_0x31a4cc[_0x82a2('0xe4')]&&_0x31a4cc[_0x82a2('0xf3')]){var _0x5b823a=[];if(_0x5e85f0['length']){_0x5b823a=_0x5e85f0['map'](function(_0x1567fe){return{'name':_0x1567fe['originalname'],'basename':_0x1567fe[_0x82a2('0x89')],'type':_0x1567fe['mimetype'],'ChatOfflineMessageId':_0x1df5e2['id']};});}var _0x201052;if(!_['isNil'](_0x31a4cc[_0x82a2('0xf4')])){var _0x4f3ca8=_[_0x82a2('0x57')](_0x2457db[_0x82a2('0x72')],function(_0x346476){return _0x346476;});var _0x1369bd=_[_0x82a2('0xf5')](_0x4f3ca8)[0x0];var _0x5d243d=_['mapValues'](_0x1369bd,function(_0xe465c9){return _0xe465c9;});_0x201052=_0x5d243d[0x1][_0x31a4cc[_0x82a2('0xf4')]];}var _0x3a0bd0={'from':_0x5168f1[_0x82a2('0xf1')],'firstName':_0x5168f1[_0x82a2('0x49')],'lastName':_0x5168f1[_0x82a2('0x4a')],'mapKey':_0x82a2('0xf1'),'message':{'from':_0x5168f1[_0x82a2('0xf1')],'to':_0x31a4cc[_0x82a2('0xda')][_0x82a2('0xf1')],'cc':'','subject':_['isNil'](_0x201052)?_0x31a4cc['offlineMessageSubject']:_0x201052,'messageId':'','sentAt':new Date(),'attach':_0x5b823a[_0x82a2('0x60')],'attachments':_0x5b823a,'originChannel':'Chat','ChatWebsiteId':_0x31a4cc['id'],'ChatOfflineMessageId':_0x6fb706['id'],'originTo':_0x31a4cc[_0x82a2('0xda')][_0x82a2('0xf1')]},'body':_0x6fb706[_0x82a2('0x72')]};var _0x487540={'account':{'id':_0x31a4cc['MailAccountId']},'body':_0x3a0bd0,'log':_0x82a2('0xf6')};return respondWithRpcPromise(_0x82a2('0xf6'),_0x82a2('0xf7'),_0x487540,client9001)['then'](function(){return _0x6fb706;})[_0x82a2('0x21')](function(_0xa2b53d){logger[_0x82a2('0x1c')](_0xa2b53d);});}return;})[_0x82a2('0x2d')](function(){if(_0x6fb706){return _0x6fb706;}})[_0x82a2('0x2d')](respondWithResult(_0x35670f,null))[_0x82a2('0x21')](function(){for(var _0x32d8d9 of _0x5e85f0){var _0x5574e5=path[_0x82a2('0x90')](config[_0x82a2('0x91')],'server','files',_0x82a2('0xe1'),_0x82a2('0xe2'),_0x32d8d9[_0x82a2('0x89')]);fs_extra[_0x82a2('0xf8')](_0x5574e5)[_0x82a2('0x21')](function(_0x18e8d6){logger[_0x82a2('0x1c')](_0x82a2('0xf9'),_0x5574e5,_0x18e8d6);});}});};exports[_0x82a2('0xfa')]=function(_0x497b2a,_0x3c1f37){return db[_0x82a2('0xba')][_0x82a2('0x70')]({'where':{'id':_0x497b2a[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x3c1f37,null))[_0x82a2('0x2d')](function(_0x35d7c7){if(_0x35d7c7){return _0x35d7c7['addInteraction'](_0x497b2a['body'][_0x82a2('0xfb')],_[_0x82a2('0xfc')](_0x497b2a[_0x82a2('0x72')],[_0x82a2('0xfb'),'id'])||{});}})[_0x82a2('0x2d')](respondWithResult(_0x3c1f37,null))['catch'](handleError(_0x3c1f37,null));};exports[_0x82a2('0xfd')]=function(_0x3d09fe,_0x40ce97){var _0x3cb185={'raw':![],'where':{}};var _0x5e3b4f={};var _0x3d3f5c={'count':0x0,'rows':[]};return db[_0x82a2('0x58')][_0x82a2('0x7e')]({'where':{'id':_0x3d09fe[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x40ce97,null))[_0x82a2('0x2d')](function(_0xa8ef5d){if(_0xa8ef5d){_0x5e3b4f[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0xba')][_0x82a2('0x84')]);_0x5e3b4f[_0x82a2('0x5a')]=_[_0x82a2('0x5b')](_0x3d09fe[_0x82a2('0x5a')]);_0x5e3b4f['filters']=_[_0x82a2('0x5d')](_0x5e3b4f[_0x82a2('0x52')],_0x5e3b4f[_0x82a2('0x5a')]);_0x3cb185[_0x82a2('0x5e')]=_['intersection'](_0x5e3b4f['model'],qs['fields'](_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x3cb185[_0x82a2('0x5e')]=_0x3cb185[_0x82a2('0x5e')]['length']?_0x3cb185[_0x82a2('0x5e')]:_0x5e3b4f[_0x82a2('0x52')];if(!_0x3d09fe[_0x82a2('0x5a')]['hasOwnProperty'](_0x82a2('0x7f'))){_0x3cb185[_0x82a2('0x26')]=qs[_0x82a2('0x26')](_0x3d09fe['query'][_0x82a2('0x26')]);_0x3cb185[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x25')]);}_0x3cb185[_0x82a2('0x62')]=qs['sort'](_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x63')]);_0x3cb185[_0x82a2('0x64')]=qs[_0x82a2('0x5c')](_[_0x82a2('0x65')](_0x3d09fe[_0x82a2('0x5a')],_0x5e3b4f[_0x82a2('0x5c')]));_0x3cb185[_0x82a2('0x64')][_0x82a2('0x7b')]=_0xa8ef5d['id'];if(_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x66')]){_0x3cb185['where']=_['merge'](_0x3cb185[_0x82a2('0x64')],{'$or':_[_0x82a2('0x57')](_0x3cb185[_0x82a2('0x5e')],function(_0x11e907){var _0x18cd29={};_0x18cd29[_0x11e907]={'$like':'%'+_0x3d09fe['query'][_0x82a2('0x66')]+'%'};return _0x18cd29;})});}_0x3cb185=_['merge']({},_0x3cb185,_0x3d09fe[_0x82a2('0x80')]);return db[_0x82a2('0xba')][_0x82a2('0x28')]({'where':_0x3cb185[_0x82a2('0x64')]})[_0x82a2('0x2d')](function(_0x466df5){_0x3d3f5c['count']=_0x466df5;if(_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x3cb185[_0x82a2('0x6a')]=[{'model':db[_0x82a2('0xa1')],'as':'Contact','required':![]},{'model':db[_0x82a2('0xc9')],'as':'Owner','attributes':[_0x82a2('0x4e'),_0x82a2('0xfe'),'internal'],'required':![]},{'model':db[_0x82a2('0xff')],'as':'Tags','attributes':['id',_0x82a2('0x4e'),_0x82a2('0x100')],'where':_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x101')]?{'id':_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x101')]}:undefined,'required':_0x3d09fe[_0x82a2('0x5a')][_0x82a2('0x101')]?!![]:![]}];}return db[_0x82a2('0xba')][_0x82a2('0x6b')](_0x3cb185);})[_0x82a2('0x2d')](function(_0x561ff1){_0x3d3f5c[_0x82a2('0x6c')]=_0x561ff1;return _0x3d3f5c;});}})['then'](respondWithFilteredResult(_0x40ce97,_0x3cb185))[_0x82a2('0x21')](handleError(_0x40ce97,null));};exports['getSnippet']=function(_0x28dbde,_0x355b7f){var _0x67d950=0x0;var _0x297d94=0x0;var _0xda958c=![];var _0x591773;var _0x584127;return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x28dbde['params']['id']},'include':[{'model':db[_0x82a2('0x3c')],'as':'Interval','include':[{'model':db[_0x82a2('0x3c')],'as':_0x82a2('0x3d'),'attributes':['id',_0x82a2('0x35')]}]}]})['then'](handleEntityNotFound(_0x355b7f,null))[_0x82a2('0x2d')](function(_0x2682d3){if(_0x2682d3){_0x591773=_0x2682d3;return _0x2682d3['getProactiveActions']({'raw':!![]});}})[_0x82a2('0x2d')](function(_0x313049){if(_0x591773){if(_0x313049){_0x584127=_0x313049;}}return require(_0x82a2('0x93'))['getLicense']();})[_0x82a2('0x2d')](function(_0x2b7912){if(_0x2b7912){_0x297d94=_0x2b7912['virtual'];_0xda958c=_0x2b7912[_0x82a2('0x95')];}})[_0x82a2('0x2d')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x82a2('0x2d')](function(_0x1e43db){_0x67d950=_0x1e43db;if(_0x297d94&&_0x1e43db>_0x297d94){return db['License']['findOne']({'where':{'id':0x1}})[_0x82a2('0x2d')](function(_0x19e198){if(_0x19e198){_0x19e198[_0x82a2('0x102')](_0x82a2('0x103'));}});}})[_0x82a2('0x2d')](function(){if(!_0x591773['Interval']||!_0x591773[_0x82a2('0x3c')][_0x82a2('0x3d')])return!![];return checkWebsiteIntervals(_0x591773);})['then'](function(_0x5612ba){var _0x4fa3ff=fs[_0x82a2('0x104')](path['join'](config['root'],_0x82a2('0x105')),'utf8');var _0x1836ca=new url[(_0x82a2('0x106'))](_0x591773[_0x82a2('0x107')])[_0x82a2('0x108')];var _0x1257a5=_0x82a2('0x109');var _0x28e9a5=![];var _0x149bc7={'chatVersion':_0x1257a5,'chatWebsiteAddressOrigin':_0x1836ca,'remote':_0x591773['remote'],'query':querystring['stringify'](_[_0x82a2('0x67')](_0x591773[_0x82a2('0x2e')]({'plain':!![]}),{'customerIp':_0x28dbde[_0x82a2('0x10a')][_0x82a2('0x46')]||_0x28dbde[_0x82a2('0x10a')]['x-real-ip']||_0x28dbde['connection'][_0x82a2('0x10b')]||_0x28dbde['ip'],'referer':_0x28dbde[_0x82a2('0x10a')][_0x82a2('0x4c')],'openedInteractions':_0x67d950,'maxInteractions':_0x297d94,'virtual':_0xda958c[_0x82a2('0x10c')],'online':_0x5612ba,'custom':_0xda958c}))[_0x82a2('0x10d')](/'/g,'\x5c\x27')};_0x355b7f[_0x82a2('0x32')](ejs[_0x82a2('0x10e')](Mustache['render'](_0x4fa3ff,_0x149bc7),{'proactiveActions':_0x584127,'alignment':_0x591773['alignment'],'verticalAlignment':_0x591773['verticalAlignment'],'div_color':_0x591773['color'],'labelText':_0x591773[_0x82a2('0x10f')],'text_color':_0x591773[_0x82a2('0x110')],'text_button_color':_0x591773[_0x82a2('0x111')],'button_color':_0x591773[_0x82a2('0x112')],'background_color':_0x591773[_0x82a2('0x113')],'hideWhenOffline':_0x591773['hideWhenOffline'],'intervalId':_0x591773[_0x82a2('0x114')],'isDevelopment':_0x28e9a5,'chatVersion':_0x1257a5}));})['catch'](handleError(_0x355b7f,null));};exports[_0x82a2('0x115')]=function(_0x1a20e2,_0x304c70){var _0x29cd3d=_0x1a20e2['params']['id'];var _0x31dc56=_0x1a20e2[_0x82a2('0x72')];var _0x3f579e=0xc8;var _0x13c18c=null;return db[_0x82a2('0xe5')]['transaction']({'isolationLevel':db[_0x82a2('0xe5')][_0x82a2('0x116')][_0x82a2('0x117')][_0x82a2('0x118')]},function(_0x9a6ff1){return db[_0x82a2('0x58')]['findOne']({'where':{'id':_0x29cd3d},'transaction':_0x9a6ff1})[_0x82a2('0x2d')](function(_0x462d0b){if(_0x462d0b){return db[_0x82a2('0xaf')][_0x82a2('0x31')]({'where':{'ChatWebsiteId':_0x29cd3d},'transaction':_0x9a6ff1})[_0x82a2('0x2d')](function(){var _0x527fcd=_[_0x82a2('0x57')](_0x31dc56,function(_0x1b1538){_0x1b1538[_0x82a2('0x7b')]=_0x29cd3d;return _0x1b1538;});return db[_0x82a2('0xaf')]['bulkCreate'](_0x527fcd,{'transaction':_0x9a6ff1});});}else{_0x3f579e=0x194;_0x13c18c=[];}});})['then'](function(){if(_0x3f579e!==0x194){return db[_0x82a2('0xaf')][_0x82a2('0x119')]({'where':{'ChatWebsiteId':_0x29cd3d},'order':'priority'})[_0x82a2('0x2d')](function(_0x182af0){_0x13c18c=_0x182af0;});}})[_0x82a2('0x21')](function(_0x2750d4){_0x3f579e=0x1f4;logger[_0x82a2('0x1c')](_0x2750d4[_0x82a2('0x11a')]);if(_0x2750d4[_0x82a2('0x4e')]){delete _0x2750d4[_0x82a2('0x4e')];}_0x13c18c=_0x2750d4;})[_0x82a2('0x11b')](function(){if(_0x13c18c===null){_0x304c70[_0x82a2('0x22')](_0x3f579e);}else{if(_0x3f579e===0x1f4){_0x304c70['status'](_0x3f579e)['send'](_0x13c18c);}else{_0x304c70[_0x82a2('0x29')](_0x3f579e)['json'](_0x13c18c);}}});};exports[_0x82a2('0x11c')]=function(_0x4a0441,_0x1a2450){var _0x2dd558={};var _0x2c8058={};var _0x7698b1;var _0x1fd1d6;return db[_0x82a2('0x58')]['findOne']({'where':{'id':_0x4a0441[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x1a2450,null))['then'](function(_0x5e1fc3){if(_0x5e1fc3){_0x7698b1=_0x5e1fc3;_0x2c8058[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0xaf')]['rawAttributes']);_0x2c8058[_0x82a2('0x5a')]=_[_0x82a2('0x5b')](_0x4a0441[_0x82a2('0x5a')]);_0x2c8058['filters']=_[_0x82a2('0x5d')](_0x2c8058[_0x82a2('0x52')],_0x2c8058['query']);_0x2dd558[_0x82a2('0x5e')]=_[_0x82a2('0x5d')](_0x2c8058['model'],qs[_0x82a2('0x5f')](_0x4a0441[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x2dd558[_0x82a2('0x5e')]=_0x2dd558['attributes'][_0x82a2('0x60')]?_0x2dd558[_0x82a2('0x5e')]:_0x2c8058[_0x82a2('0x52')];_0x2dd558[_0x82a2('0x62')]=qs[_0x82a2('0x63')](_0x4a0441[_0x82a2('0x5a')][_0x82a2('0x63')]);_0x2dd558[_0x82a2('0x64')]=qs['filters'](_['pick'](_0x4a0441[_0x82a2('0x5a')],_0x2c8058['filters']));if(_0x4a0441[_0x82a2('0x5a')]['filter']){_0x2dd558[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0x2dd558[_0x82a2('0x64')],{'$or':_['map'](_0x2dd558['attributes'],function(_0x43c713){var _0x20f6b2={};_0x20f6b2[_0x43c713]={'$like':'%'+_0x4a0441[_0x82a2('0x5a')][_0x82a2('0x66')]+'%'};return _0x20f6b2;})});}_0x2dd558=_[_0x82a2('0x67')]({},_0x2dd558,_0x4a0441[_0x82a2('0x80')]);return _0x7698b1[_0x82a2('0x11c')](_0x2dd558);}})['then'](function(_0x498ae3){if(_0x498ae3){_0x1fd1d6=_0x498ae3['length'];if(!_0x4a0441[_0x82a2('0x5a')][_0x82a2('0x61')](_0x82a2('0x7f'))){_0x2dd558[_0x82a2('0x26')]=qs[_0x82a2('0x26')](_0x4a0441[_0x82a2('0x5a')][_0x82a2('0x26')]);_0x2dd558[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x4a0441['query'][_0x82a2('0x25')]);}return _0x7698b1[_0x82a2('0x11c')](_0x2dd558);}})[_0x82a2('0x2d')](function(_0x5c1cf9){if(_0x5c1cf9){return _0x5c1cf9?{'count':_0x1fd1d6,'rows':_0x5c1cf9}:null;}})[_0x82a2('0x2d')](respondWithResult(_0x1a2450,null))[_0x82a2('0x21')](handleError(_0x1a2450,null));};exports[_0x82a2('0x11d')]=function(_0x378331,_0x274a17){return db[_0x82a2('0x11e')][_0x82a2('0x70')]({'where':{'id':_0x378331['params']['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x274a17,null))[_0x82a2('0x2d')](function(_0x42848a){if(_0x42848a){return _0x42848a[_0x82a2('0x11d')](_0x378331[_0x82a2('0x72')][_0x82a2('0xfb')],_[_0x82a2('0xfc')](_0x378331['body'],[_0x82a2('0xfb'),'id'])||{});}})[_0x82a2('0x2d')](respondWithResult(_0x274a17,null))[_0x82a2('0x21')](handleError(_0x274a17,null));};exports[_0x82a2('0x11f')]=function(_0x43e0df,_0x23864c){var _0x566dab={};var _0x4cf003={};var _0x124cc7;var _0x3d042e;return db[_0x82a2('0x58')][_0x82a2('0x7e')]({'where':{'id':_0x43e0df[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x23864c,null))['then'](function(_0x55d76a){if(_0x55d76a){_0x124cc7=_0x55d76a;_0x4cf003[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db[_0x82a2('0x120')][_0x82a2('0x84')]);_0x4cf003[_0x82a2('0x5a')]=_['keys'](_0x43e0df[_0x82a2('0x5a')]);_0x4cf003[_0x82a2('0x5c')]=_[_0x82a2('0x5d')](_0x4cf003[_0x82a2('0x52')],_0x4cf003['query']);_0x566dab['attributes']=_[_0x82a2('0x5d')](_0x4cf003[_0x82a2('0x52')],qs['fields'](_0x43e0df[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x566dab['attributes']=_0x566dab[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x566dab[_0x82a2('0x5e')]:_0x4cf003[_0x82a2('0x52')];_0x566dab[_0x82a2('0x62')]=qs[_0x82a2('0x63')](_0x43e0df[_0x82a2('0x5a')]['sort']);_0x566dab[_0x82a2('0x64')]=qs[_0x82a2('0x5c')](_[_0x82a2('0x65')](_0x43e0df[_0x82a2('0x5a')],_0x4cf003['filters']));if(_0x43e0df[_0x82a2('0x5a')][_0x82a2('0x66')]){_0x566dab[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0x566dab[_0x82a2('0x64')],{'$or':_['map'](_0x566dab[_0x82a2('0x5e')],function(_0x503d4e){var _0x237092={};_0x237092[_0x503d4e]={'$like':'%'+_0x43e0df[_0x82a2('0x5a')]['filter']+'%'};return _0x237092;})});}_0x566dab=_['merge']({},_0x566dab,_0x43e0df['options']);return _0x124cc7[_0x82a2('0x11f')](_0x566dab);}})[_0x82a2('0x2d')](function(_0x50e39d){if(_0x50e39d){_0x3d042e=_0x50e39d[_0x82a2('0x60')];if(!_0x43e0df['query']['hasOwnProperty'](_0x82a2('0x7f'))){_0x566dab['limit']=qs[_0x82a2('0x26')](_0x43e0df[_0x82a2('0x5a')]['limit']);_0x566dab[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x43e0df[_0x82a2('0x5a')]['offset']);}return _0x124cc7[_0x82a2('0x11f')](_0x566dab);}})[_0x82a2('0x2d')](function(_0x355f38){if(_0x355f38){return _0x355f38?{'count':_0x3d042e,'rows':_0x355f38}:null;}})[_0x82a2('0x2d')](respondWithResult(_0x23864c,null))[_0x82a2('0x21')](handleError(_0x23864c,null));};exports[_0x82a2('0x121')]=function(_0xce45b3,_0x10c6ec){var _0x1d9d94=_0xce45b3[_0x82a2('0x5a')][_0x82a2('0x122')]===_0x82a2('0x123')?'offlineForm':_0x82a2('0x124');return db[_0x82a2('0x58')]['find']({'attributes':['id',_0x1d9d94],'where':{'id':_0xce45b3['params']['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x10c6ec,null))['then'](function(_0x19a214){if(_0x19a214){var _0x49ee82=_0x19a214[_0x1d9d94];var _0x518028=_0x49ee82&&_0x49ee82['items']?_0x49ee82['items']:[];_0x10c6ec['send']({'fromKey':_[_0x82a2('0x96')](_0x49ee82['fromKey'])?undefined:_0x49ee82['fromKey'],'count':_0x518028[_0x82a2('0x60')],'rows':_0x518028});}})[_0x82a2('0x21')](handleError(_0x10c6ec,null));};exports['getOfflineMessages']=function(_0x39d916,_0x2fea79){var _0x146550={'raw':![],'where':{}};var _0x50b751={};var _0x220a6e={'count':0x0,'rows':[]};return db[_0x82a2('0x58')][_0x82a2('0x7e')]({'where':{'id':_0x39d916[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x2fea79,null))[_0x82a2('0x2d')](function(_0x536519){if(_0x536519){_0x50b751['model']=_[_0x82a2('0x5b')](db['ChatOfflineMessage'][_0x82a2('0x84')]);_0x50b751['query']=_[_0x82a2('0x5b')](_0x39d916[_0x82a2('0x5a')]);_0x50b751[_0x82a2('0x5c')]=_[_0x82a2('0x5d')](_0x50b751[_0x82a2('0x52')],_0x50b751[_0x82a2('0x5a')]);_0x146550[_0x82a2('0x5e')]=_[_0x82a2('0x5d')](_0x50b751[_0x82a2('0x52')],qs[_0x82a2('0x5f')](_0x39d916[_0x82a2('0x5a')][_0x82a2('0x5f')]));_0x146550[_0x82a2('0x5e')]=_0x146550[_0x82a2('0x5e')][_0x82a2('0x60')]?_0x146550[_0x82a2('0x5e')]:_0x50b751[_0x82a2('0x52')];if(!_0x39d916[_0x82a2('0x5a')][_0x82a2('0x61')](_0x82a2('0x7f'))){_0x146550[_0x82a2('0x26')]=qs[_0x82a2('0x26')](_0x39d916['query'][_0x82a2('0x26')]);_0x146550[_0x82a2('0x25')]=qs['offset'](_0x39d916['query']['offset']);}_0x146550[_0x82a2('0x62')]=qs['sort'](_0x39d916[_0x82a2('0x5a')][_0x82a2('0x63')]);_0x146550[_0x82a2('0x64')]=qs[_0x82a2('0x5c')](_[_0x82a2('0x65')](_0x39d916[_0x82a2('0x5a')],_0x50b751[_0x82a2('0x5c')]));_0x146550[_0x82a2('0x64')][_0x82a2('0x7b')]=_0x536519['id'];if(_0x39d916[_0x82a2('0x5a')]['filter']){_0x146550[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0x146550[_0x82a2('0x64')],{'$or':_[_0x82a2('0x57')](_0x146550[_0x82a2('0x5e')],function(_0x4cc8fa){var _0x133fce={};_0x133fce[_0x4cc8fa]={'$like':'%'+_0x39d916[_0x82a2('0x5a')][_0x82a2('0x66')]+'%'};return _0x133fce;})});}_0x146550=_[_0x82a2('0x67')]({},_0x146550,_0x39d916[_0x82a2('0x80')]);return db[_0x82a2('0x125')][_0x82a2('0x28')]({'where':_0x146550[_0x82a2('0x64')]})[_0x82a2('0x2d')](function(_0x9c05ab){_0x220a6e[_0x82a2('0x28')]=_0x9c05ab;if(_0x39d916[_0x82a2('0x5a')][_0x82a2('0x69')]){_0x146550[_0x82a2('0x6a')]=[{'all':!![]}];}else{_0x146550[_0x82a2('0x6a')]=[{'model':db['CmContact'],'as':_0x82a2('0x126'),'required':![]},{'model':db['Attachment'],'as':_0x82a2('0x127'),'required':![]}];}return db[_0x82a2('0x125')][_0x82a2('0x6b')](_0x146550);})['then'](function(_0x312f85){_0x220a6e[_0x82a2('0x6c')]=_0x312f85;return _0x220a6e;});}})[_0x82a2('0x2d')](respondWithFilteredResult(_0x2fea79,_0x146550))[_0x82a2('0x21')](handleError(_0x2fea79,null));};exports[_0x82a2('0x128')]=function(_0x2dc0c6,_0x25b22a){return db[_0x82a2('0x58')][_0x82a2('0x70')]({'where':{'id':_0x2dc0c6[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x25b22a,null))[_0x82a2('0x2d')](function(_0x45148b){if(_0x45148b){return _0x45148b[_0x82a2('0x128')](_0x2dc0c6[_0x82a2('0x72')][_0x82a2('0xfb')],_[_0x82a2('0xfc')](_0x2dc0c6[_0x82a2('0x72')],[_0x82a2('0xfb'),'id'])||{})[_0x82a2('0xb2')](function(_0x1d9b24){for(var _0x50e704=0x0;_0x50e704<_0x2dc0c6[_0x82a2('0x72')][_0x82a2('0xfb')][_0x82a2('0x60')];_0x50e704+=0x1){socket[_0x82a2('0x129')]('userChatWebsite:save',{'UserId':Number(_0x2dc0c6[_0x82a2('0x72')][_0x82a2('0xfb')][_0x50e704]),'ChatWebsiteId':Number(_0x2dc0c6['params']['id'])});}return _0x1d9b24;});}})[_0x82a2('0x2d')](respondWithResult(_0x25b22a,null))[_0x82a2('0x21')](handleError(_0x25b22a,null));};exports['removeAgents']=function(_0x58eec5,_0x4fe314){return db['ChatWebsite'][_0x82a2('0x70')]({'where':{'id':_0x58eec5[_0x82a2('0x6e')]['id']}})[_0x82a2('0x2d')](handleEntityNotFound(_0x4fe314,null))[_0x82a2('0x2d')](function(_0xc05fb5){if(_0xc05fb5){return _0xc05fb5['removeAgents'](_0x58eec5[_0x82a2('0x5a')][_0x82a2('0xfb')])[_0x82a2('0x2d')](function(){if(_[_0x82a2('0x12a')](_0x58eec5[_0x82a2('0x5a')][_0x82a2('0xfb')])){for(var _0x3e5841=0x0;_0x3e5841<_0x58eec5['query']['ids'][_0x82a2('0x60')];_0x3e5841+=0x1){socket[_0x82a2('0x129')](_0x82a2('0x12b'),{'UserId':Number(_0x58eec5[_0x82a2('0x5a')][_0x82a2('0xfb')][_0x3e5841]),'ChatWebsiteId':Number(_0x58eec5['params']['id'])});}}else{socket[_0x82a2('0x129')](_0x82a2('0x12b'),{'UserId':Number(_0x58eec5[_0x82a2('0x5a')][_0x82a2('0xfb')]),'ChatWebsiteId':Number(_0x58eec5[_0x82a2('0x6e')]['id'])});}});}})[_0x82a2('0x2d')](respondWithStatusCode(_0x4fe314,null))[_0x82a2('0x21')](handleError(_0x4fe314,null));};exports['getAgents']=function(_0x17a872,_0x3638c5){var _0xb79ab9={};var _0x3d27bf={};var _0x1198a4;var _0x175785;return db[_0x82a2('0x58')][_0x82a2('0x7e')]({'where':{'id':_0x17a872[_0x82a2('0x6e')]['id']}})['then'](handleEntityNotFound(_0x3638c5,null))[_0x82a2('0x2d')](function(_0x45ec8b){if(_0x45ec8b){_0x1198a4=_0x45ec8b;_0x3d27bf[_0x82a2('0x52')]=_[_0x82a2('0x5b')](db['User']['rawAttributes']);_0x3d27bf[_0x82a2('0x5a')]=_[_0x82a2('0x5b')](_0x17a872[_0x82a2('0x5a')]);_0x3d27bf['filters']=_[_0x82a2('0x5d')](_0x3d27bf[_0x82a2('0x52')],_0x3d27bf[_0x82a2('0x5a')]);_0xb79ab9[_0x82a2('0x5e')]=_[_0x82a2('0x5d')](_0x3d27bf[_0x82a2('0x52')],qs[_0x82a2('0x5f')](_0x17a872['query'][_0x82a2('0x5f')]));_0xb79ab9[_0x82a2('0x5e')]=_0xb79ab9[_0x82a2('0x5e')]['length']?_0xb79ab9[_0x82a2('0x5e')]:_0x3d27bf[_0x82a2('0x52')];_0xb79ab9[_0x82a2('0x62')]=qs[_0x82a2('0x63')](_0x17a872[_0x82a2('0x5a')][_0x82a2('0x63')]);_0xb79ab9['where']=qs['filters'](_[_0x82a2('0x65')](_0x17a872['query'],_0x3d27bf[_0x82a2('0x5c')]));if(_0x17a872[_0x82a2('0x5a')][_0x82a2('0x66')]){_0xb79ab9[_0x82a2('0x64')]=_[_0x82a2('0x67')](_0xb79ab9[_0x82a2('0x64')],{'$or':_[_0x82a2('0x57')](_0xb79ab9['attributes'],function(_0x13d98b){var _0x3e70d5={};_0x3e70d5[_0x13d98b]={'$like':'%'+_0x17a872[_0x82a2('0x5a')][_0x82a2('0x66')]+'%'};return _0x3e70d5;})});}_0xb79ab9=_[_0x82a2('0x67')]({},_0xb79ab9,_0x17a872['options']);return _0x1198a4[_0x82a2('0x12c')](_0xb79ab9);}})['then'](function(_0x3e673a){if(_0x3e673a){_0x175785=_0x3e673a[_0x82a2('0x60')];if(!_0x17a872[_0x82a2('0x5a')]['hasOwnProperty'](_0x82a2('0x7f'))){_0xb79ab9[_0x82a2('0x26')]=qs[_0x82a2('0x26')](_0x17a872['query'][_0x82a2('0x26')]);_0xb79ab9[_0x82a2('0x25')]=qs[_0x82a2('0x25')](_0x17a872[_0x82a2('0x5a')][_0x82a2('0x25')]);}return _0x1198a4[_0x82a2('0x12c')](_0xb79ab9);}})['then'](function(_0x433693){if(_0x433693){return _0x433693?{'count':_0x175785,'rows':_0x433693}:null;}})[_0x82a2('0x2d')](respondWithResult(_0x3638c5,null))[_0x82a2('0x21')](handleError(_0x3638c5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 768ee95..f52424b 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 _0x1280=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x14bcaa,_0x1f775d){var _0x211587=function(_0x55e7a2){while(--_0x55e7a2){_0x14bcaa['push'](_0x14bcaa['shift']());}};_0x211587(++_0x1f775d);}(_0x1280,0xba));var _0x0128=function(_0x3889ae,_0x4770c3){_0x3889ae=_0x3889ae-0x0;var _0x6533dd=_0x1280[_0x3889ae];return _0x6533dd;};'use strict';var EventEmitter=require(_0x0128('0x0'));var ChatWebsite=require(_0x0128('0x1'))['db'][_0x0128('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0128('0x3')](0x0);var events={'afterCreate':_0x0128('0x4'),'afterUpdate':_0x0128('0x5'),'afterDestroy':_0x0128('0x6')};function emitEvent(_0x3a3112){return function(_0x403dd9,_0x551461,_0x2c8eee){ChatWebsiteEvents[_0x0128('0x7')](_0x3a3112+':'+_0x403dd9['id'],_0x403dd9);ChatWebsiteEvents['emit'](_0x3a3112,_0x403dd9);_0x2c8eee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0128('0x8')](e,emitEvent(event));}}module[_0x0128('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb4e6=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hook','exports'];(function(_0x14b665,_0xe86799){var _0x5b305a=function(_0x366e68){while(--_0x366e68){_0x14b665['push'](_0x14b665['shift']());}};_0x5b305a(++_0xe86799);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0xb4e6[_0x12e073];return _0x267748;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var ChatWebsite=require(_0x6b4e('0x1'))['db'][_0x6b4e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6b4e('0x3')](0x0);var events={'afterCreate':_0x6b4e('0x4'),'afterUpdate':_0x6b4e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f36b2){return function(_0x55df8c,_0x1f75ee,_0x154d36){ChatWebsiteEvents[_0x6b4e('0x6')](_0x3f36b2+':'+_0x55df8c['id'],_0x55df8c);ChatWebsiteEvents[_0x6b4e('0x6')](_0x3f36b2,_0x55df8c);_0x154d36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6b4e('0x7')](e,emitEvent(event));}}module[_0x6b4e('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 15aa3c8..a1b2191 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 _0xf84f=['api','moment','bluebird','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x2688f2,_0x513c10){var _0x465009=function(_0x702ede){while(--_0x702ede){_0x2688f2['push'](_0x2688f2['shift']());}};_0x465009(++_0x513c10);}(_0xf84f,0x11d));var _0xff84=function(_0xc7ae13,_0x1b887b){_0xc7ae13=_0xc7ae13-0x0;var _0x327671=_0xf84f[_0xc7ae13];return _0x327671;};'use strict';var _=require(_0xff84('0x0'));var util=require(_0xff84('0x1'));var logger=require(_0xff84('0x2'))(_0xff84('0x3'));var moment=require(_0xff84('0x4'));var BPromise=require(_0xff84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff84('0x6'));var attributes=require(_0xff84('0x7'));module[_0xff84('0x8')]=function(_0x30c1e6,_0x1584ee){return _0x30c1e6[_0xff84('0x9')](_0xff84('0xa'),attributes,{'tableName':_0xff84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4754=['api','moment','bluebird','path','./chatWebsite.attributes','define','ChatWebsite','lodash','../../config/logger'];(function(_0x5640f2,_0x1af50b){var _0x20dbc0=function(_0x18b79d){while(--_0x18b79d){_0x5640f2['push'](_0x5640f2['shift']());}};_0x20dbc0(++_0x1af50b);}(_0x4754,0x1c9));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require('util');var logger=require(_0x4475('0x1'))(_0x4475('0x2'));var moment=require(_0x4475('0x3'));var BPromise=require(_0x4475('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4475('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4475('0x6'));module['exports']=function(_0x32ceb9,_0x5de5ed){return _0x32ceb9[_0x4475('0x7')](_0x4475('0x8'),attributes,{'tableName':'chat_websites','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 dab2af0..cf3a905 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 _0x1f8a=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b5d45,_0x1e3534){var _0x2c9fc5=function(_0x44f309){while(--_0x44f309){_0x3b5d45['push'](_0x3b5d45['shift']());}};_0x2c9fc5(++_0x1e3534);}(_0x1f8a,0xaf));var _0xa1f8=function(_0x47ba52,_0x409f2c){_0x47ba52=_0x47ba52-0x0;var _0x21d870=_0x1f8a[_0x47ba52];return _0x21d870;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa1f8('0x0'));var BPromise=require(_0xa1f8('0x1'));var rs=require(_0xa1f8('0x2'));var fs=require('fs');var Redis=require(_0xa1f8('0x3'));var db=require(_0xa1f8('0x4'))['db'];var utils=require(_0xa1f8('0x5'));var logger=require(_0xa1f8('0x6'))('rpc');var config=require(_0xa1f8('0x7'));var jayson=require(_0xa1f8('0x8'));var client=jayson[_0xa1f8('0x9')][_0xa1f8('0xa')]({'port':0x232a});config['redis']=_[_0xa1f8('0xb')](config[_0xa1f8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1f8('0xd'))(new Redis(config['redis']));require(_0xa1f8('0xe'))['register'](socket);function respondWithRpcPromise(_0x44d34f,_0x37934f,_0x207ab2){return new BPromise(function(_0xbfec6c,_0x3057bb){return client[_0xa1f8('0xf')](_0x44d34f,_0x207ab2)[_0xa1f8('0x10')](function(_0x5ba78d){logger[_0xa1f8('0x11')](_0xa1f8('0x12'),_0x37934f,'request\x20sent');logger['debug'](_0xa1f8('0x13'),_0x37934f,_0xa1f8('0x14'),JSON[_0xa1f8('0x15')](_0x5ba78d));if(_0x5ba78d[_0xa1f8('0x16')]){if(_0x5ba78d[_0xa1f8('0x16')]['code']===0x1f4){logger['error'](_0xa1f8('0x12'),_0x37934f,_0x5ba78d[_0xa1f8('0x16')][_0xa1f8('0x17')]);return _0x3057bb(_0x5ba78d['error'][_0xa1f8('0x17')]);}logger[_0xa1f8('0x16')](_0xa1f8('0x12'),_0x37934f,_0x5ba78d[_0xa1f8('0x16')][_0xa1f8('0x17')]);return _0xbfec6c(_0x5ba78d['error'][_0xa1f8('0x17')]);}else{logger[_0xa1f8('0x11')](_0xa1f8('0x12'),_0x37934f,'request\x20sent');_0xbfec6c(_0x5ba78d[_0xa1f8('0x18')]['message']);}})[_0xa1f8('0x19')](function(_0x349768){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x37934f,_0x349768);_0x3057bb(_0x349768);});});} \ No newline at end of file +var _0xabaf=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x229552,_0x4f8658){var _0x53a916=function(_0x458ea4){while(--_0x458ea4){_0x229552['push'](_0x229552['shift']());}};_0x53a916(++_0x4f8658);}(_0xabaf,0x132));var _0xfaba=function(_0xb8d6ec,_0x46c31d){_0xb8d6ec=_0xb8d6ec-0x0;var _0x513565=_0xabaf[_0xb8d6ec];return _0x513565;};'use strict';var _=require('lodash');var util=require(_0xfaba('0x0'));var moment=require(_0xfaba('0x1'));var BPromise=require(_0xfaba('0x2'));var rs=require(_0xfaba('0x3'));var fs=require('fs');var Redis=require(_0xfaba('0x4'));var db=require(_0xfaba('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaba('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaba('0x7')][_0xfaba('0x8')]({'port':0x232a});config[_0xfaba('0x9')]=_['defaults'](config['redis'],{'host':_0xfaba('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaba('0x9')]));require(_0xfaba('0xb'))[_0xfaba('0xc')](socket);function respondWithRpcPromise(_0x2d9e9b,_0x331c54,_0x42bb7e){return new BPromise(function(_0x4a953d,_0x437c26){return client[_0xfaba('0xd')](_0x2d9e9b,_0x42bb7e)[_0xfaba('0xe')](function(_0x58f742){logger[_0xfaba('0xf')](_0xfaba('0x10'),_0x331c54,_0xfaba('0x11'));logger[_0xfaba('0x12')](_0xfaba('0x13'),_0x331c54,_0xfaba('0x11'),JSON[_0xfaba('0x14')](_0x58f742));if(_0x58f742[_0xfaba('0x15')]){if(_0x58f742['error'][_0xfaba('0x16')]===0x1f4){logger['error'](_0xfaba('0x10'),_0x331c54,_0x58f742[_0xfaba('0x15')][_0xfaba('0x17')]);return _0x437c26(_0x58f742['error']['message']);}logger[_0xfaba('0x15')](_0xfaba('0x10'),_0x331c54,_0x58f742[_0xfaba('0x15')]['message']);return _0x4a953d(_0x58f742[_0xfaba('0x15')][_0xfaba('0x17')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x331c54,_0xfaba('0x11'));_0x4a953d(_0x58f742['result'][_0xfaba('0x17')]);}})[_0xfaba('0x18')](function(_0x48a37a){logger[_0xfaba('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x331c54,_0x48a37a);_0x437c26(_0x48a37a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index fb57dbf..0a8cc89 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 _0xd57d=['length','chatWebsite:','save','update','emit','register'];(function(_0x2fe35b,_0x22af28){var _0x198bf0=function(_0x543319){while(--_0x543319){_0x2fe35b['push'](_0x2fe35b['shift']());}};_0x198bf0(++_0x22af28);}(_0xd57d,0x1ee));var _0xdd57=function(_0x39097c,_0x23d4a9){_0x39097c=_0x39097c-0x0;var _0x2762cf=_0xd57d[_0x39097c];return _0x2762cf;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xdd57('0x0'),'remove',_0xdd57('0x1')];function createListener(_0x1cc8a3,_0x370cd9){return function(_0x59078a){_0x370cd9[_0xdd57('0x2')](_0x1cc8a3,_0x59078a);};}function removeListener(_0x1b9c2d,_0x22fb92){return function(){ChatWebsiteEvents['removeListener'](_0x1b9c2d,_0x22fb92);};}exports[_0xdd57('0x3')]=function(_0x413aaf){for(var _0x6814cc=0x0,_0xc5a076=events[_0xdd57('0x4')];_0x6814cc<_0xc5a076;_0x6814cc++){var _0x2e1e2e=events[_0x6814cc];var _0xb8236a=createListener(_0xdd57('0x5')+_0x2e1e2e,_0x413aaf);ChatWebsiteEvents['on'](_0x2e1e2e,_0xb8236a);}}; \ No newline at end of file +var _0xe4a2=['length','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x1f2abe,_0x907ab1){var _0x29ce77=function(_0x1517ff){while(--_0x1517ff){_0x1f2abe['push'](_0x1f2abe['shift']());}};_0x29ce77(++_0x907ab1);}(_0xe4a2,0x1e1));var _0x2e4a=function(_0x27265c,_0x256320){_0x27265c=_0x27265c-0x0;var _0x5b1bdf=_0xe4a2[_0x27265c];return _0x5b1bdf;};'use strict';var ChatWebsiteEvents=require(_0x2e4a('0x0'));var events=[_0x2e4a('0x1'),_0x2e4a('0x2'),_0x2e4a('0x3')];function createListener(_0x2b6410,_0x3fdeb5){return function(_0x12416e){_0x3fdeb5[_0x2e4a('0x4')](_0x2b6410,_0x12416e);};}function removeListener(_0x15f25a,_0x1506dc){return function(){ChatWebsiteEvents[_0x2e4a('0x5')](_0x15f25a,_0x1506dc);};}exports[_0x2e4a('0x6')]=function(_0x500763){for(var _0x227b37=0x0,_0x1f371a=events[_0x2e4a('0x7')];_0x227b37<_0x1f371a;_0x227b37++){var _0x13c1c7=events[_0x227b37];var _0xcf94d5=createListener('chatWebsite:'+_0x13c1c7,_0x500763);ChatWebsiteEvents['on'](_0x13c1c7,_0xcf94d5);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a08924d..1d6032b 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 _0x8766=['./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','addAvatar','server/files/images/avatars/','originalname','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5b8dec,_0xad257e){var _0x126230=function(_0x3bde7c){while(--_0x3bde7c){_0x5b8dec['push'](_0x5b8dec['shift']());}};_0x126230(++_0xad257e);}(_0x8766,0x18d));var _0x6876=function(_0x388066,_0x29a913){_0x388066=_0x388066-0x0;var _0x3a0f16=_0x8766[_0x388066];return _0x3a0f16;};'use strict';var multer=require('multer');var util=require(_0x6876('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6876('0x1'));var router=express['Router']();var fs_extra=require(_0x6876('0x2'));var auth=require(_0x6876('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6876('0x4'));var controller=require(_0x6876('0x5'));router[_0x6876('0x6')]('/',auth[_0x6876('0x7')](),controller[_0x6876('0x8')]);router[_0x6876('0x6')](_0x6876('0x9'),auth['isAuthenticated'](),controller[_0x6876('0xa')]);router[_0x6876('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6876('0x6')](_0x6876('0xb'),auth[_0x6876('0x7')](),controller[_0x6876('0xc')]);router[_0x6876('0x6')](_0x6876('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x6876('0xe')]);router[_0x6876('0x6')](_0x6876('0xf'),controller['getAvatar']);router['get'](_0x6876('0x10'),controller[_0x6876('0x11')]);router[_0x6876('0x6')](_0x6876('0x12'),controller[_0x6876('0x13')]);router[_0x6876('0x6')](_0x6876('0x14'),auth[_0x6876('0x7')](),controller[_0x6876('0x15')]);router[_0x6876('0x6')]('/:id/snippet',controller[_0x6876('0x16')]);router[_0x6876('0x6')]('/:id/applications',auth[_0x6876('0x7')](),controller[_0x6876('0x17')]);router[_0x6876('0x6')](_0x6876('0x18'),auth[_0x6876('0x7')](),controller[_0x6876('0x19')]);router[_0x6876('0x6')]('/:id/fields',controller[_0x6876('0x1a')]);router[_0x6876('0x6')]('/:id/offline_messages',auth[_0x6876('0x7')](),controller['getOfflineMessages']);router[_0x6876('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x6876('0x1b')]);router[_0x6876('0x1c')]('/',auth['isAuthenticated'](),controller[_0x6876('0x1d')]);router[_0x6876('0x1c')](_0x6876('0xb'),auth[_0x6876('0x7')](),controller['addDisposition']);router['post'](_0x6876('0xd'),auth['isAuthenticated'](),controller[_0x6876('0x1e')]);var upload=multer({'storage':multer[_0x6876('0x1f')]({'destination':function(_0x467af6,_0x47a358,_0x148619){_0x148619(null,path[_0x6876('0x20')](config[_0x6876('0x21')],_0x6876('0x22')));},'filename':function(_0x5070d5,_0x186e2c,_0x5616f7){_0x5616f7(null,util[_0x6876('0x23')](_0x6876('0x24'),Date[_0x6876('0x25')](),_0x186e2c['originalname']));}})});router[_0x6876('0x1c')]('/:id/logo',upload[_0x6876('0x26')](_0x6876('0x27')),controller[_0x6876('0x28')]);var upload=multer({'storage':multer[_0x6876('0x1f')]({'destination':function(_0x54a57f,_0x55ad4c,_0x34ed48){_0x34ed48(null,path[_0x6876('0x20')](config[_0x6876('0x21')],'server/files/images/avatars/'));},'filename':function(_0x2deaa5,_0x33ada0,_0x4f2f3c){_0x4f2f3c(null,util[_0x6876('0x23')](_0x6876('0x24'),Date[_0x6876('0x25')](),_0x33ada0['originalname']));}})});router[_0x6876('0x1c')](_0x6876('0xf'),upload[_0x6876('0x26')](_0x6876('0x27')),controller[_0x6876('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeec09a,_0x59ca08,_0x5de722){_0x5de722(null,path[_0x6876('0x20')](config[_0x6876('0x21')],_0x6876('0x2a')));},'filename':function(_0x4820e5,_0x262f8e,_0x385251){_0x385251(null,util[_0x6876('0x23')](_0x6876('0x24'),Date['now'](),_0x262f8e[_0x6876('0x2b')]));}})});router[_0x6876('0x1c')](_0x6876('0x10'),upload[_0x6876('0x26')](_0x6876('0x27')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x6876('0x1f')]({'destination':function(_0x2869a9,_0x69eeec,_0x206a6c){_0x206a6c(null,path[_0x6876('0x20')](config[_0x6876('0x21')],_0x6876('0x2a')));},'filename':function(_0x12182a,_0x278920,_0x12510c){_0x12510c(null,util[_0x6876('0x23')](_0x6876('0x24'),Date[_0x6876('0x25')](),_0x278920['originalname']));}})});router[_0x6876('0x1c')](_0x6876('0x12'),upload[_0x6876('0x26')](_0x6876('0x27')),controller[_0x6876('0x2c')]);router['post'](_0x6876('0x2d'),controller[_0x6876('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0x6876('0x1f')]({'destination':function(_0x4f7ed3,_0x2679b5,_0x2a7c61){const _0x6bfdf9=path[_0x6876('0x20')](config[_0x6876('0x21')],'server/files',_0x6876('0x2f'),_0x6876('0x30'));fs_extra[_0x6876('0x31')](_0x6bfdf9,function(){_0x2a7c61(null,_0x6bfdf9);});},'filename':function(_0x12af02,_0x4cbe58,_0x6ba979){const _0x18f34f=_0x4cbe58[_0x6876('0x2b')][_0x6876('0x32')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15d175=path[_0x6876('0x33')](_0x18f34f);const _0x8fb588=Date[_0x6876('0x25')]()+'-'+_0x18f34f[_0x6876('0x32')](_0x15d175,'')+_0x15d175;_0x6ba979(null,_0x8fb588);}})});router['post'](_0x6876('0x34'),offlineUploadMulter[_0x6876('0x35')](),controller[_0x6876('0x36')]);router['post'](_0x6876('0x14'),auth[_0x6876('0x7')](),controller['addInteraction']);router[_0x6876('0x1c')]('/:id/applications',auth[_0x6876('0x7')](),controller[_0x6876('0x37')]);router[_0x6876('0x1c')](_0x6876('0x18'),auth[_0x6876('0x7')](),controller[_0x6876('0x38')]);router['post'](_0x6876('0x39'),auth[_0x6876('0x7')](),controller[_0x6876('0x3a')]);router[_0x6876('0x3b')](_0x6876('0x3c'),auth[_0x6876('0x7')](),controller[_0x6876('0x3d')]);router[_0x6876('0x3e')](_0x6876('0x3c'),auth['isAuthenticated'](),controller['destroy']);router[_0x6876('0x3e')](_0x6876('0xb'),auth[_0x6876('0x7')](),controller[_0x6876('0x3f')]);router[_0x6876('0x3e')]('/:id/canned_answers',auth[_0x6876('0x7')](),controller[_0x6876('0x40')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x6876('0x41')]);module[_0x6876('0x42')]=router; \ No newline at end of file +var _0x9f94=['getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','now','single','file','addLogo','diskStorage','server/files/images/avatars/','format','%s-%s','originalname','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications'];(function(_0x421ad8,_0x508f49){var _0x53f73a=function(_0x18a2e4){while(--_0x18a2e4){_0x421ad8['push'](_0x421ad8['shift']());}};_0x53f73a(++_0x508f49);}(_0x9f94,0x1c2));var _0x49f9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9f94[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x49f9('0x0'));var util=require('util');var path=require(_0x49f9('0x1'));var timeout=require(_0x49f9('0x2'));var express=require(_0x49f9('0x3'));var router=express[_0x49f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49f9('0x5'));var interaction=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var controller=require(_0x49f9('0x8'));router[_0x49f9('0x9')]('/',auth[_0x49f9('0xa')](),controller[_0x49f9('0xb')]);router[_0x49f9('0x9')](_0x49f9('0xc'),auth[_0x49f9('0xa')](),controller[_0x49f9('0xd')]);router[_0x49f9('0x9')](_0x49f9('0xe'),auth[_0x49f9('0xa')](),controller[_0x49f9('0xf')]);router[_0x49f9('0x9')]('/:id/dispositions',auth[_0x49f9('0xa')](),controller['getDispositions']);router[_0x49f9('0x9')]('/:id/canned_answers',auth[_0x49f9('0xa')](),controller['getAnswers']);router[_0x49f9('0x9')](_0x49f9('0x10'),controller[_0x49f9('0x11')]);router[_0x49f9('0x9')](_0x49f9('0x12'),controller['getAvatar']);router[_0x49f9('0x9')]('/:id/customer_avatar',controller[_0x49f9('0x13')]);router[_0x49f9('0x9')]('/:id/system_avatar',controller[_0x49f9('0x14')]);router['get'](_0x49f9('0x15'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x16')]);router['get'](_0x49f9('0x17'),controller[_0x49f9('0x18')]);router[_0x49f9('0x9')](_0x49f9('0x19'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x1a')]);router['get'](_0x49f9('0x1b'),auth['isAuthenticated'](),controller[_0x49f9('0x1c')]);router[_0x49f9('0x9')]('/:id/fields',controller[_0x49f9('0x1d')]);router[_0x49f9('0x9')](_0x49f9('0x1e'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x1f')]);router['get'](_0x49f9('0x20'),auth[_0x49f9('0xa')](),controller['getAgents']);router[_0x49f9('0x21')]('/',auth[_0x49f9('0xa')](),controller[_0x49f9('0x22')]);router[_0x49f9('0x21')](_0x49f9('0x23'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x24')]);router[_0x49f9('0x21')](_0x49f9('0x25'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f6736,_0x104714,_0x1a7033){_0x1a7033(null,path[_0x49f9('0x27')](config[_0x49f9('0x28')],_0x49f9('0x29')));},'filename':function(_0x22f96f,_0x434eb7,_0x391191){_0x391191(null,util['format']('%s-%s',Date[_0x49f9('0x2a')](),_0x434eb7['originalname']));}})});router[_0x49f9('0x21')](_0x49f9('0x10'),upload[_0x49f9('0x2b')](_0x49f9('0x2c')),controller[_0x49f9('0x2d')]);var upload=multer({'storage':multer[_0x49f9('0x2e')]({'destination':function(_0x1206f6,_0x41413c,_0x1770ef){_0x1770ef(null,path[_0x49f9('0x27')](config[_0x49f9('0x28')],_0x49f9('0x2f')));},'filename':function(_0x2cd1db,_0x58bd78,_0x2a2dfa){_0x2a2dfa(null,util[_0x49f9('0x30')](_0x49f9('0x31'),Date['now'](),_0x58bd78[_0x49f9('0x32')]));}})});router[_0x49f9('0x21')](_0x49f9('0x12'),upload[_0x49f9('0x2b')](_0x49f9('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x49f9('0x2e')]({'destination':function(_0x5e9a85,_0x4a0872,_0xaa8235){_0xaa8235(null,path['join'](config[_0x49f9('0x28')],_0x49f9('0x2f')));},'filename':function(_0x5cc38e,_0x5e7492,_0x24978f){_0x24978f(null,util['format']('%s-%s',Date[_0x49f9('0x2a')](),_0x5e7492[_0x49f9('0x32')]));}})});router[_0x49f9('0x21')]('/:id/customer_avatar',upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x49f9('0x2e')]({'destination':function(_0x19fc8f,_0x4beed6,_0x3d303c){_0x3d303c(null,path[_0x49f9('0x27')](config[_0x49f9('0x28')],_0x49f9('0x2f')));},'filename':function(_0x48664e,_0x228510,_0x459098){_0x459098(null,util[_0x49f9('0x30')](_0x49f9('0x31'),Date[_0x49f9('0x2a')](),_0x228510[_0x49f9('0x32')]));}})});router['post']('/:id/system_avatar',upload[_0x49f9('0x2b')]('file'),controller[_0x49f9('0x33')]);router[_0x49f9('0x21')]('/:id/notify',controller[_0x49f9('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2be5e9,_0x36270a,_0x1a93ae){const _0x450fe0=path[_0x49f9('0x27')](config[_0x49f9('0x28')],'server/files',_0x49f9('0x35'),_0x49f9('0x36'));fs_extra[_0x49f9('0x37')](_0x450fe0,function(){_0x1a93ae(null,_0x450fe0);});},'filename':function(_0x5cf496,_0xa67a62,_0x34d271){const _0x1fdbbe=_0xa67a62[_0x49f9('0x32')][_0x49f9('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x6acb6a=path[_0x49f9('0x39')](_0x1fdbbe);const _0x521e5d=Date[_0x49f9('0x2a')]()+'-'+_0x1fdbbe['replace'](_0x6acb6a,'')+_0x6acb6a;_0x34d271(null,_0x521e5d);}})});router[_0x49f9('0x21')](_0x49f9('0x3a'),offlineUploadMulter['any'](),controller['offline']);router[_0x49f9('0x21')]('/:id/interactions',auth[_0x49f9('0xa')](),controller[_0x49f9('0x3b')]);router[_0x49f9('0x21')]('/:id/applications',auth[_0x49f9('0xa')](),controller[_0x49f9('0x3c')]);router[_0x49f9('0x21')](_0x49f9('0x1b'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x3d')]);router[_0x49f9('0x21')](_0x49f9('0x20'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x3e')]);router[_0x49f9('0x3f')](_0x49f9('0xe'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x40')]);router[_0x49f9('0x41')](_0x49f9('0xe'),auth[_0x49f9('0xa')](),controller['destroy']);router[_0x49f9('0x41')](_0x49f9('0x23'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x42')]);router[_0x49f9('0x41')](_0x49f9('0x25'),auth['isAuthenticated'](),controller[_0x49f9('0x43')]);router[_0x49f9('0x41')](_0x49f9('0x20'),auth[_0x49f9('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c14d633..f698c9d 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 _0x1894=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','exports','beaver-logger/server','../config/environment','Router'];(function(_0x39b30e,_0x59c69d){var _0x5bd14d=function(_0x358281){while(--_0x358281){_0x39b30e['push'](_0x39b30e['shift']());}};_0x5bd14d(++_0x59c69d);}(_0x1894,0x126));var _0x4189=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x1894[_0x3cae69];return _0x3128eb;};var beaverLogger=require(_0x4189('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x4189('0x1'));var router=express[_0x4189('0x2')]();var isProduction=config['env']===_0x4189('0x3')||![];function clientSideLogs(_0x28542a,_0x5306f6,_0x593352){var _0x49334e=_0x28542a[_0x4189('0x4')][_0x4189('0x5')](_0x4189('0x6'));if(!_0x49334e){throw new Error(_0x4189('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x4189('0x8'),'logger':_0x49334e,'enableCors':!isProduction})(_0x28542a,_0x5306f6,_0x593352);}router[_0x4189('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x4189('0xa')]=router; \ No newline at end of file +var _0x8741=['env','production','get','client-side-logger','expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8741,0xff));var _0x1874=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8741[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0x1874('0x0'));var express=require(_0x1874('0x1'));var auth=require(_0x1874('0x2'));var config=require(_0x1874('0x3'));var router=express[_0x1874('0x4')]();var isProduction=config[_0x1874('0x5')]===_0x1874('0x6')||![];function clientSideLogs(_0x3f93f6,_0x2dd1ac,_0x5ca68d){var _0x5462d2=_0x3f93f6['app'][_0x1874('0x7')](_0x1874('0x8'));if(!_0x5462d2){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x1874('0x9')]({'uri':_0x1874('0xa'),'logger':_0x5462d2,'enableCors':!isProduction})(_0x3f93f6,_0x2dd1ac,_0x5ca68d);}router[_0x1874('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x1874('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f9e5eeb..a2af2f2 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 _0x4804=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4804,0x92));var _0x4480=function(_0x8679fc,_0x37834a){_0x8679fc=_0x8679fc-0x0;var _0x4c3a4e=_0x4804[_0x8679fc];return _0x4c3a4e;};'use strict';var Sequelize=require(_0x4480('0x0'));module[_0x4480('0x1')]={'name':{'type':Sequelize[_0x4480('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4480('0x3')](_0x4480('0x4'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4480('0x3')]('Outlook365',_0x4480('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x4480('0x6')},'data2':{'type':Sequelize[_0x4480('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x4480('0x7')},'data4':{'type':Sequelize[_0x4480('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x4480('0x8')},'data6':{'type':Sequelize[_0x4480('0x9')],'comment':_0x4480('0xa')},'data7':{'type':Sequelize['TEXT'],'comment':_0x4480('0xb')}}; \ No newline at end of file +var _0xcfad=['ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','AmazonAWS','Google','MicrosoftAzure'];(function(_0x29e144,_0x140c41){var _0x1fdf01=function(_0x3f432b){while(--_0x3f432b){_0x29e144['push'](_0x29e144['shift']());}};_0x1fdf01(++_0x140c41);}(_0xcfad,0xdb));var _0xdcfa=function(_0x1ff2a4,_0x49ce2f){_0x1ff2a4=_0x1ff2a4-0x0;var _0xa1df80=_0xcfad[_0x1ff2a4];return _0xa1df80;};'use strict';var Sequelize=require(_0xdcfa('0x0'));module['exports']={'name':{'type':Sequelize[_0xdcfa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xdcfa('0x2'),_0xdcfa('0x3'),_0xdcfa('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdcfa('0x5')](_0xdcfa('0x6'),_0xdcfa('0x7'))},'data1':{'type':Sequelize[_0xdcfa('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdcfa('0x1')],'comment':_0xdcfa('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xdcfa('0x9')},'data4':{'type':Sequelize[_0xdcfa('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xdcfa('0xa')},'data6':{'type':Sequelize[_0xdcfa('0xb')],'comment':_0xdcfa('0xc')},'data7':{'type':Sequelize[_0xdcfa('0xb')],'comment':_0xdcfa('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0516a0a..5f521d7 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 _0x07fb=['send','padEnd','slice','index','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CloudProvider','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','find','body','Name\x20parameter\x20not\x20specified','includes','join','create','update','params','encryptString','oauth2MicrosoftAuthorize','sendStatus','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','status','json','offset','undefined','count','limit','Content-Range','then','destroy','error','stack','name'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x07fb,0x14b));var _0xb07f=function(_0x1f69a2,_0x5ebeb8){_0x1f69a2=_0x1f69a2-0x0;var _0x899ef4=_0x07fb[_0x1f69a2];return _0x899ef4;};'use strict';var _=require(_0xb07f('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0xb07f('0x1'));var logger=require(_0xb07f('0x2'))(_0xb07f('0x3'));var db=require(_0xb07f('0x4'))['db'];var oauth=require(_0xb07f('0x5'));config['redis']=_['defaults'](config[_0xb07f('0x6')],{'host':_0xb07f('0x7'),'port':0x18eb});var socket=require(_0xb07f('0x8'))(new Redis(config[_0xb07f('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x2d8fed,_0x307156){_0x307156=_0x307156||0xcc;return function(_0x2bc193){if(_0x2bc193){return _0x2d8fed['sendStatus'](_0x307156);}return _0x2d8fed[_0xb07f('0x9')](_0x307156)['end']();};}function respondWithResult(_0x437fd4,_0x1fe4ce){_0x1fe4ce=_0x1fe4ce||0xc8;return function(_0x223671){if(_0x223671){return _0x437fd4[_0xb07f('0x9')](_0x1fe4ce)[_0xb07f('0xa')](_0x223671);}};}function respondWithFilteredResult(_0x2f0b63,_0x2e6b94){return function(_0x48dc1b){if(_0x48dc1b){var _0x1a8cbf=typeof _0x2e6b94[_0xb07f('0xb')]==='undefined'&&typeof _0x2e6b94['limit']===_0xb07f('0xc');var _0x161527=_0x48dc1b[_0xb07f('0xd')];var _0x3d08ca=_0x1a8cbf?0x0:_0x2e6b94[_0xb07f('0xb')];var _0x16c631=_0x1a8cbf?_0x48dc1b[_0xb07f('0xd')]:_0x2e6b94[_0xb07f('0xb')]+_0x2e6b94[_0xb07f('0xe')];var _0x4a0c80;if(_0x16c631>=_0x161527){_0x16c631=_0x161527;_0x4a0c80=0xc8;}else{_0x4a0c80=0xce;}_0x2f0b63[_0xb07f('0x9')](_0x4a0c80);return _0x2f0b63['set'](_0xb07f('0xf'),_0x3d08ca+'-'+_0x16c631+'/'+_0x161527)['json'](_0x48dc1b);}return null;};}function saveUpdates(_0x101173){return function(_0x4be27d){if(_0x4be27d){return _0x4be27d['update'](_0x101173)[_0xb07f('0x10')](function(_0x13ff66){return _0x13ff66;});}return null;};}function removeEntity(_0x3340c3){return function(_0x691d9f){if(_0x691d9f){return _0x691d9f[_0xb07f('0x11')]()['then'](function(){_0x3340c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fc5b8){return function(_0x23e403){if(!_0x23e403){_0x7fc5b8['sendStatus'](0x194);}return _0x23e403;};}function handleError(_0x2731ae,_0x2a0e5c){_0x2a0e5c=_0x2a0e5c||0x1f4;return function(_0x41ff50){logger[_0xb07f('0x12')](_0x41ff50[_0xb07f('0x13')]);if(_0x41ff50[_0xb07f('0x14')]){delete _0x41ff50[_0xb07f('0x14')];}_0x2731ae[_0xb07f('0x9')](_0x2a0e5c)[_0xb07f('0x15')](_0x41ff50);};}function maskClientSecret(_0x4c8b57){return _[_0xb07f('0x16')](_0x4c8b57[_0xb07f('0x17')](0x0,0x3),0x14,'*');}exports[_0xb07f('0x18')]=function(_0x38578d,_0x151ef2){var _0x368372={},_0x4f0a87={},_0x2a4ec0={'count':0x0,'rows':[]};var _0x7e4382=_[_0xb07f('0x19')](db['CloudProvider'][_0xb07f('0x1a')],function(_0x4778d8){return{'name':_0x4778d8['fieldName'],'type':_0x4778d8['type']['key']};});_0x4f0a87[_0xb07f('0x1b')]=_[_0xb07f('0x19')](_0x7e4382,_0xb07f('0x14'));_0x4f0a87['query']=_[_0xb07f('0x1c')](_0x38578d[_0xb07f('0x1d')]);_0x4f0a87[_0xb07f('0x1e')]=_[_0xb07f('0x1f')](_0x4f0a87[_0xb07f('0x1b')],_0x4f0a87[_0xb07f('0x1d')]);_0x368372[_0xb07f('0x20')]=_[_0xb07f('0x1f')](_0x4f0a87[_0xb07f('0x1b')],qs['fields'](_0x38578d[_0xb07f('0x1d')][_0xb07f('0x21')]));_0x368372[_0xb07f('0x20')]=_0x368372[_0xb07f('0x20')][_0xb07f('0x22')]?_0x368372[_0xb07f('0x20')]:_0x4f0a87['model'];if(!_0x38578d[_0xb07f('0x1d')][_0xb07f('0x23')]('nolimit')){_0x368372[_0xb07f('0xe')]=qs[_0xb07f('0xe')](_0x38578d[_0xb07f('0x1d')][_0xb07f('0xe')]);_0x368372[_0xb07f('0xb')]=qs[_0xb07f('0xb')](_0x38578d[_0xb07f('0x1d')][_0xb07f('0xb')]);}_0x368372[_0xb07f('0x24')]=qs[_0xb07f('0x25')](_0x38578d[_0xb07f('0x1d')][_0xb07f('0x25')]);_0x368372[_0xb07f('0x26')]=qs[_0xb07f('0x1e')](_[_0xb07f('0x27')](_0x38578d[_0xb07f('0x1d')],_0x4f0a87[_0xb07f('0x1e')]),_0x7e4382);if(_0x38578d[_0xb07f('0x1d')][_0xb07f('0x28')]){_0x368372[_0xb07f('0x26')]=_[_0xb07f('0x29')](_0x368372[_0xb07f('0x26')],{'$or':_[_0xb07f('0x19')](_0x7e4382,function(_0x2bff83){if(_0x2bff83[_0xb07f('0x2a')]!==_0xb07f('0x2b')){var _0x504e69={};_0x504e69[_0x2bff83[_0xb07f('0x14')]]={'$like':'%'+_0x38578d[_0xb07f('0x1d')][_0xb07f('0x28')]+'%'};return _0x504e69;}})});}_0x368372=_[_0xb07f('0x29')]({},_0x368372,_0x38578d[_0xb07f('0x2c')]);var _0x300afc={'where':_0x368372['where']};return db[_0xb07f('0x2d')]['count'](_0x300afc)[_0xb07f('0x10')](function(_0x48ebb5){_0x2a4ec0[_0xb07f('0xd')]=_0x48ebb5;if(_0x38578d[_0xb07f('0x1d')][_0xb07f('0x2e')]){_0x368372[_0xb07f('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0xb07f('0x30')](_0x368372);})[_0xb07f('0x10')](function(_0x5a0ff8){_0x2a4ec0['rows']=_[_0xb07f('0x19')](_0x5a0ff8,function(_0x225c68){if(_0x225c68[_0xb07f('0x31')]===_0xb07f('0x32')){var _0x23cde4=encryptor[_0xb07f('0x33')](_0x225c68[_0xb07f('0x34')]);_0x225c68[_0xb07f('0x34')]=maskClientSecret(_0x23cde4);}return _0x225c68;});return _0x2a4ec0;})[_0xb07f('0x10')](respondWithFilteredResult(_0x151ef2,_0x368372))[_0xb07f('0x35')](handleError(_0x151ef2,null));};exports['show']=function(_0x29ec82,_0x5a6f40){var _0x4384f1={'raw':!![],'where':{'id':_0x29ec82['params']['id']}},_0x51487d={};_0x51487d['model']=_[_0xb07f('0x1c')](db[_0xb07f('0x2d')][_0xb07f('0x1a')]);_0x51487d['query']=_[_0xb07f('0x1c')](_0x29ec82['query']);_0x51487d['filters']=_[_0xb07f('0x1f')](_0x51487d[_0xb07f('0x1b')],_0x51487d[_0xb07f('0x1d')]);_0x4384f1['attributes']=_['intersection'](_0x51487d[_0xb07f('0x1b')],qs[_0xb07f('0x21')](_0x29ec82[_0xb07f('0x1d')][_0xb07f('0x21')]));_0x4384f1[_0xb07f('0x20')]=_0x4384f1[_0xb07f('0x20')][_0xb07f('0x22')]?_0x4384f1['attributes']:_0x51487d[_0xb07f('0x1b')];if(_0x29ec82[_0xb07f('0x1d')]['includeAll']){_0x4384f1[_0xb07f('0x2f')]=[{'all':!![]}];}_0x4384f1=_[_0xb07f('0x29')]({},_0x4384f1,_0x29ec82[_0xb07f('0x2c')]);return db[_0xb07f('0x2d')][_0xb07f('0x36')](_0x4384f1)['then'](handleEntityNotFound(_0x5a6f40,null))[_0xb07f('0x10')](function(_0x5b0383){if(_0x5b0383[_0xb07f('0x31')]===_0xb07f('0x32')){var _0xb6cf09=encryptor['decryptString'](_0x5b0383[_0xb07f('0x34')]);_0x5b0383[_0xb07f('0x34')]=maskClientSecret(_0xb6cf09);}return _0x5b0383;})['then'](respondWithResult(_0x5a6f40,null))[_0xb07f('0x35')](handleError(_0x5a6f40,null));};exports['create']=function(_0x12c437,_0x4a1490){if(!_0x12c437[_0xb07f('0x37')][_0xb07f('0x14')])throw new Error(_0xb07f('0x38'));if(!_0x12c437[_0xb07f('0x37')][_0xb07f('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5baa15=db[_0xb07f('0x2d')][_0xb07f('0x1a')]['service']['values'];if(!_0x5baa15[_0xb07f('0x39')](_0x12c437['body'][_0xb07f('0x31')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x5baa15[_0xb07f('0x3a')](',\x20'));if(_0x12c437[_0xb07f('0x37')][_0xb07f('0x31')]===_0xb07f('0x32')&&_0x12c437[_0xb07f('0x37')][_0xb07f('0x34')]){_0x12c437[_0xb07f('0x37')]['data3']=encryptor['encryptString'](_0x12c437[_0xb07f('0x37')][_0xb07f('0x34')]);}return db[_0xb07f('0x2d')][_0xb07f('0x3b')](_0x12c437[_0xb07f('0x37')],{})[_0xb07f('0x10')](respondWithResult(_0x4a1490,0xc9))[_0xb07f('0x35')](handleError(_0x4a1490,null));};exports[_0xb07f('0x3c')]=function(_0xc79e9b,_0x22504d){if(_0xc79e9b['body']['id']){delete _0xc79e9b[_0xb07f('0x37')]['id'];}return db[_0xb07f('0x2d')]['find']({'where':{'id':_0xc79e9b[_0xb07f('0x3d')]['id']}})[_0xb07f('0x10')](handleEntityNotFound(_0x22504d,null))['then'](function(_0xfc6548){if(_0xfc6548[_0xb07f('0x31')]===_0xb07f('0x32')&&_0xc79e9b[_0xb07f('0x37')]['data3']){_0xc79e9b['body'][_0xb07f('0x34')]=encryptor[_0xb07f('0x3e')](_0xc79e9b['body'][_0xb07f('0x34')]);}return _0xfc6548;})[_0xb07f('0x10')](saveUpdates(_0xc79e9b[_0xb07f('0x37')],null))[_0xb07f('0x10')](respondWithResult(_0x22504d,null))[_0xb07f('0x35')](handleError(_0x22504d,null));};exports[_0xb07f('0x11')]=function(_0x29f14e,_0xbbc551){return db[_0xb07f('0x2d')][_0xb07f('0x36')]({'where':{'id':_0x29f14e[_0xb07f('0x3d')]['id']}})[_0xb07f('0x10')](handleEntityNotFound(_0xbbc551,null))[_0xb07f('0x10')](removeEntity(_0xbbc551,null))['catch'](handleError(_0xbbc551,null));};exports[_0xb07f('0x3f')]=function(_0x48a78e,_0x2ffcbd){return db[_0xb07f('0x2d')]['findOne']({'where':{'id':_0x48a78e[_0xb07f('0x3d')]['id']},'raw':!![]})[_0xb07f('0x10')](function(_0x4be573){if(!_0x4be573)return _0x2ffcbd[_0xb07f('0x40')](0x194);return{'url':oauth[_0xb07f('0x41')](_0x4be573,_0x48a78e['user']['id'])};})[_0xb07f('0x10')](respondWithResult(_0x2ffcbd,null))['catch'](handleError(_0x2ffcbd,null));};exports[_0xb07f('0x42')]=function(_0x3f2186,_0x3c800a){var _0x14a2cb=_0x3f2186['body'];var _0x1f2ae6;var _0x50532f;if(_0x14a2cb[_0xb07f('0x12')])throw _0x14a2cb;redis['get'](_0x14a2cb[_0xb07f('0x43')])[_0xb07f('0x10')](function(_0x5d2065){if(!_0x5d2065)throw new Error('Invalid\x20state\x20parameter');_0x1f2ae6=JSON[_0xb07f('0x44')](_0x5d2065);var _0x24e76f=Buffer[_0xb07f('0x45')](_0x14a2cb[_0xb07f('0x43')],_0xb07f('0x46'))['toString'](_0xb07f('0x47'));_0x50532f=JSON['parse'](_0x24e76f);if(!oauth[_0xb07f('0x48')](_0x14a2cb[_0xb07f('0x49')],_0x1f2ae6[_0xb07f('0x4a')]))throw new Error(_0xb07f('0x4b'));redis[_0xb07f('0x4c')](_0x14a2cb[_0xb07f('0x43')]);return oauth['getOauth2MicrosoftAccessToken'](_0x14a2cb[_0xb07f('0x4d')],_0x1f2ae6);})[_0xb07f('0x10')](function(_0x1a9def){_0x1f2ae6[_0xb07f('0x4e')]=_0x1a9def[_0xb07f('0x4f')];_0x1f2ae6[_0xb07f('0x50')]=_0x1a9def['refresh_token'];return db[_0xb07f('0x2d')][_0xb07f('0x3c')]({'data5':_0x1f2ae6[_0xb07f('0x4e')],'data6':_0x1f2ae6['data6']},{'where':{'id':_0x1f2ae6['id']}});})['then'](function(){oauth[_0xb07f('0x51')](_0x1f2ae6);socket[_0xb07f('0x52')]('microsoftAuthorization:success',{'id':_0x50532f['id']});return;})[_0xb07f('0x10')](respondWithStatusCode(_0x3c800a,null))[_0xb07f('0x35')](function(_0x15df1a){if(_0x50532f){socket[_0xb07f('0x52')](_0xb07f('0x53'),{'id':_0x50532f['id']});}if(!_0x1f2ae6){logger['error'](_0xb07f('0x54'),_0x15df1a);return _0x3c800a[_0xb07f('0x9')](0x1f4)[_0xb07f('0x15')](_0x15df1a[_0xb07f('0x55')]);}logger['error'](_0xb07f('0x56'),_0x1f2ae6['id'],JSON[_0xb07f('0x57')](_0x15df1a));});}; \ No newline at end of file +var _0x545e=['key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','show','params','find','decryptString','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','catch','destroy','oauth2MicrosoftAuthorize','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','count','offset','set','Content-Range','json','update','then','sendStatus','error','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type'];(function(_0x1c1ecf,_0x392c6b){var _0x5ae5d8=function(_0x41b21c){while(--_0x41b21c){_0x1c1ecf['push'](_0x1c1ecf['shift']());}};_0x5ae5d8(++_0x392c6b);}(_0x545e,0x101));var _0xe545=function(_0x4b4aae,_0x3205ce){_0x4b4aae=_0x4b4aae-0x0;var _0x28dbcc=_0x545e[_0x4b4aae];return _0x28dbcc;};'use strict';var _=require(_0xe545('0x0'));var Redis=require(_0xe545('0x1'));var qs=require(_0xe545('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xe545('0x3'));var logger=require(_0xe545('0x4'))(_0xe545('0x5'));var db=require(_0xe545('0x6'))['db'];var oauth=require(_0xe545('0x7'));config[_0xe545('0x8')]=_[_0xe545('0x9')](config['redis'],{'host':_0xe545('0xa'),'port':0x18eb});var socket=require(_0xe545('0xb'))(new Redis(config[_0xe545('0x8')]));var redis=new Redis(config[_0xe545('0x8')]);function respondWithStatusCode(_0x15aed2,_0x102681){_0x102681=_0x102681||0xcc;return function(_0x2386df){if(_0x2386df){return _0x15aed2['sendStatus'](_0x102681);}return _0x15aed2[_0xe545('0xc')](_0x102681)[_0xe545('0xd')]();};}function respondWithResult(_0x32c20d,_0x2e860c){_0x2e860c=_0x2e860c||0xc8;return function(_0x3eba32){if(_0x3eba32){return _0x32c20d['status'](_0x2e860c)['json'](_0x3eba32);}};}function respondWithFilteredResult(_0x2e24cb,_0x1d4d7b){return function(_0x16526d){if(_0x16526d){var _0x27000a=typeof _0x1d4d7b['offset']==='undefined'&&typeof _0x1d4d7b['limit']==='undefined';var _0x46795c=_0x16526d[_0xe545('0xe')];var _0x2ed523=_0x27000a?0x0:_0x1d4d7b['offset'];var _0x54c169=_0x27000a?_0x16526d[_0xe545('0xe')]:_0x1d4d7b[_0xe545('0xf')]+_0x1d4d7b['limit'];var _0x14909b;if(_0x54c169>=_0x46795c){_0x54c169=_0x46795c;_0x14909b=0xc8;}else{_0x14909b=0xce;}_0x2e24cb['status'](_0x14909b);return _0x2e24cb[_0xe545('0x10')](_0xe545('0x11'),_0x2ed523+'-'+_0x54c169+'/'+_0x46795c)[_0xe545('0x12')](_0x16526d);}return null;};}function saveUpdates(_0x595fc2){return function(_0x1865b5){if(_0x1865b5){return _0x1865b5[_0xe545('0x13')](_0x595fc2)['then'](function(_0x3a7345){return _0x3a7345;});}return null;};}function removeEntity(_0x1b603a){return function(_0xd47812){if(_0xd47812){return _0xd47812['destroy']()[_0xe545('0x14')](function(){_0x1b603a['status'](0xcc)[_0xe545('0xd')]();});}};}function handleEntityNotFound(_0x19d93f){return function(_0x5a477e){if(!_0x5a477e){_0x19d93f[_0xe545('0x15')](0x194);}return _0x5a477e;};}function handleError(_0x3ce7e7,_0x1b4013){_0x1b4013=_0x1b4013||0x1f4;return function(_0x5dadc2){logger[_0xe545('0x16')](_0x5dadc2['stack']);if(_0x5dadc2[_0xe545('0x17')]){delete _0x5dadc2[_0xe545('0x17')];}_0x3ce7e7['status'](_0x1b4013)[_0xe545('0x18')](_0x5dadc2);};}function maskClientSecret(_0x2272fc){return _[_0xe545('0x19')](_0x2272fc['slice'](0x0,0x3),0x14,'*');}exports[_0xe545('0x1a')]=function(_0x3919c2,_0x321545){var _0x5470c1={},_0xc04217={},_0x33dfcb={'count':0x0,'rows':[]};var _0x12814a=_['map'](db[_0xe545('0x1b')][_0xe545('0x1c')],function(_0x400d88){return{'name':_0x400d88[_0xe545('0x1d')],'type':_0x400d88[_0xe545('0x1e')][_0xe545('0x1f')]};});_0xc04217['model']=_[_0xe545('0x20')](_0x12814a,_0xe545('0x17'));_0xc04217[_0xe545('0x21')]=_[_0xe545('0x22')](_0x3919c2[_0xe545('0x21')]);_0xc04217[_0xe545('0x23')]=_[_0xe545('0x24')](_0xc04217[_0xe545('0x25')],_0xc04217[_0xe545('0x21')]);_0x5470c1['attributes']=_[_0xe545('0x24')](_0xc04217[_0xe545('0x25')],qs['fields'](_0x3919c2[_0xe545('0x21')][_0xe545('0x26')]));_0x5470c1['attributes']=_0x5470c1[_0xe545('0x27')][_0xe545('0x28')]?_0x5470c1['attributes']:_0xc04217[_0xe545('0x25')];if(!_0x3919c2[_0xe545('0x21')][_0xe545('0x29')]('nolimit')){_0x5470c1[_0xe545('0x2a')]=qs[_0xe545('0x2a')](_0x3919c2[_0xe545('0x21')][_0xe545('0x2a')]);_0x5470c1['offset']=qs[_0xe545('0xf')](_0x3919c2[_0xe545('0x21')]['offset']);}_0x5470c1['order']=qs[_0xe545('0x2b')](_0x3919c2[_0xe545('0x21')]['sort']);_0x5470c1[_0xe545('0x2c')]=qs[_0xe545('0x23')](_[_0xe545('0x2d')](_0x3919c2['query'],_0xc04217[_0xe545('0x23')]),_0x12814a);if(_0x3919c2['query'][_0xe545('0x2e')]){_0x5470c1[_0xe545('0x2c')]=_['merge'](_0x5470c1[_0xe545('0x2c')],{'$or':_[_0xe545('0x20')](_0x12814a,function(_0x53b4ba){if(_0x53b4ba['type']!==_0xe545('0x2f')){var _0x158f4f={};_0x158f4f[_0x53b4ba['name']]={'$like':'%'+_0x3919c2[_0xe545('0x21')][_0xe545('0x2e')]+'%'};return _0x158f4f;}})});}_0x5470c1=_[_0xe545('0x30')]({},_0x5470c1,_0x3919c2[_0xe545('0x31')]);var _0x2c7ca5={'where':_0x5470c1[_0xe545('0x2c')]};return db['CloudProvider'][_0xe545('0xe')](_0x2c7ca5)[_0xe545('0x14')](function(_0x3315e5){_0x33dfcb[_0xe545('0xe')]=_0x3315e5;if(_0x3919c2[_0xe545('0x21')][_0xe545('0x32')]){_0x5470c1[_0xe545('0x33')]=[{'all':!![]}];}return db[_0xe545('0x1b')][_0xe545('0x34')](_0x5470c1);})[_0xe545('0x14')](function(_0x562784){_0x33dfcb[_0xe545('0x35')]=_['map'](_0x562784,function(_0xeebf54){if(_0xeebf54[_0xe545('0x36')]===_0xe545('0x37')){var _0x2ca9a1=encryptor['decryptString'](_0xeebf54['data3']);_0xeebf54['data3']=maskClientSecret(_0x2ca9a1);}return _0xeebf54;});return _0x33dfcb;})[_0xe545('0x14')](respondWithFilteredResult(_0x321545,_0x5470c1))['catch'](handleError(_0x321545,null));};exports[_0xe545('0x38')]=function(_0x5e8f09,_0x3b37e7){var _0x11de2d={'raw':!![],'where':{'id':_0x5e8f09[_0xe545('0x39')]['id']}},_0x142ff4={};_0x142ff4[_0xe545('0x25')]=_['keys'](db['CloudProvider'][_0xe545('0x1c')]);_0x142ff4[_0xe545('0x21')]=_['keys'](_0x5e8f09[_0xe545('0x21')]);_0x142ff4[_0xe545('0x23')]=_[_0xe545('0x24')](_0x142ff4['model'],_0x142ff4[_0xe545('0x21')]);_0x11de2d[_0xe545('0x27')]=_[_0xe545('0x24')](_0x142ff4[_0xe545('0x25')],qs[_0xe545('0x26')](_0x5e8f09['query'][_0xe545('0x26')]));_0x11de2d[_0xe545('0x27')]=_0x11de2d[_0xe545('0x27')][_0xe545('0x28')]?_0x11de2d['attributes']:_0x142ff4[_0xe545('0x25')];if(_0x5e8f09[_0xe545('0x21')]['includeAll']){_0x11de2d[_0xe545('0x33')]=[{'all':!![]}];}_0x11de2d=_[_0xe545('0x30')]({},_0x11de2d,_0x5e8f09[_0xe545('0x31')]);return db[_0xe545('0x1b')][_0xe545('0x3a')](_0x11de2d)[_0xe545('0x14')](handleEntityNotFound(_0x3b37e7,null))[_0xe545('0x14')](function(_0x4f327a){if(_0x4f327a[_0xe545('0x36')]==='MicrosoftAzure'){var _0x49e52a=encryptor[_0xe545('0x3b')](_0x4f327a[_0xe545('0x3c')]);_0x4f327a['data3']=maskClientSecret(_0x49e52a);}return _0x4f327a;})[_0xe545('0x14')](respondWithResult(_0x3b37e7,null))['catch'](handleError(_0x3b37e7,null));};exports[_0xe545('0x3d')]=function(_0x278e8d,_0x284fa3){if(!_0x278e8d[_0xe545('0x3e')][_0xe545('0x17')])throw new Error(_0xe545('0x3f'));if(!_0x278e8d[_0xe545('0x3e')][_0xe545('0x36')])throw new Error(_0xe545('0x40'));var _0x378cb6=db[_0xe545('0x1b')][_0xe545('0x1c')][_0xe545('0x36')][_0xe545('0x41')];if(!_0x378cb6[_0xe545('0x42')](_0x278e8d[_0xe545('0x3e')][_0xe545('0x36')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x378cb6[_0xe545('0x43')](',\x20'));if(_0x278e8d[_0xe545('0x3e')][_0xe545('0x36')]===_0xe545('0x37')&&_0x278e8d[_0xe545('0x3e')][_0xe545('0x3c')]){_0x278e8d[_0xe545('0x3e')][_0xe545('0x3c')]=encryptor['encryptString'](_0x278e8d[_0xe545('0x3e')][_0xe545('0x3c')]);}return db[_0xe545('0x1b')]['create'](_0x278e8d['body'],{})[_0xe545('0x14')](respondWithResult(_0x284fa3,0xc9))[_0xe545('0x44')](handleError(_0x284fa3,null));};exports[_0xe545('0x13')]=function(_0x2b76cb,_0x5154de){if(_0x2b76cb[_0xe545('0x3e')]['id']){delete _0x2b76cb[_0xe545('0x3e')]['id'];}return db[_0xe545('0x1b')][_0xe545('0x3a')]({'where':{'id':_0x2b76cb['params']['id']}})[_0xe545('0x14')](handleEntityNotFound(_0x5154de,null))[_0xe545('0x14')](function(_0x262aab){if(_0x262aab['service']==='MicrosoftAzure'&&_0x2b76cb[_0xe545('0x3e')][_0xe545('0x3c')]){_0x2b76cb[_0xe545('0x3e')][_0xe545('0x3c')]=encryptor['encryptString'](_0x2b76cb['body'][_0xe545('0x3c')]);}return _0x262aab;})[_0xe545('0x14')](saveUpdates(_0x2b76cb[_0xe545('0x3e')],null))[_0xe545('0x14')](respondWithResult(_0x5154de,null))[_0xe545('0x44')](handleError(_0x5154de,null));};exports[_0xe545('0x45')]=function(_0x3dd41b,_0x416720){return db[_0xe545('0x1b')]['find']({'where':{'id':_0x3dd41b[_0xe545('0x39')]['id']}})['then'](handleEntityNotFound(_0x416720,null))[_0xe545('0x14')](removeEntity(_0x416720,null))[_0xe545('0x44')](handleError(_0x416720,null));};exports[_0xe545('0x46')]=function(_0x538e7a,_0x4d30d4){return db[_0xe545('0x1b')]['findOne']({'where':{'id':_0x538e7a[_0xe545('0x39')]['id']},'raw':!![]})[_0xe545('0x14')](function(_0xe8be8e){if(!_0xe8be8e)return _0x4d30d4[_0xe545('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xe8be8e,_0x538e7a[_0xe545('0x47')]['id'])};})['then'](respondWithResult(_0x4d30d4,null))['catch'](handleError(_0x4d30d4,null));};exports['oauth2MicrosoftCallback']=function(_0x7e9d3c,_0x18cb2e){var _0x5e9514=_0x7e9d3c[_0xe545('0x3e')];var _0x4e2eed;var _0x568dde;if(_0x5e9514[_0xe545('0x16')])throw _0x5e9514;redis[_0xe545('0x48')](_0x5e9514[_0xe545('0x49')])[_0xe545('0x14')](function(_0x32578f){if(!_0x32578f)throw new Error(_0xe545('0x4a'));_0x4e2eed=JSON[_0xe545('0x4b')](_0x32578f);var _0x14c069=Buffer[_0xe545('0x4c')](_0x5e9514[_0xe545('0x49')],_0xe545('0x4d'))['toString'](_0xe545('0x4e'));_0x568dde=JSON[_0xe545('0x4b')](_0x14c069);if(!oauth[_0xe545('0x4f')](_0x5e9514[_0xe545('0x50')],_0x4e2eed[_0xe545('0x51')]))throw new Error(_0xe545('0x52'));redis['del'](_0x5e9514[_0xe545('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x5e9514[_0xe545('0x53')],_0x4e2eed);})['then'](function(_0xa18711){_0x4e2eed[_0xe545('0x54')]=_0xa18711[_0xe545('0x55')];_0x4e2eed[_0xe545('0x56')]=_0xa18711[_0xe545('0x57')];return db[_0xe545('0x1b')][_0xe545('0x13')]({'data5':_0x4e2eed[_0xe545('0x54')],'data6':_0x4e2eed[_0xe545('0x56')]},{'where':{'id':_0x4e2eed['id']}});})[_0xe545('0x14')](function(){oauth[_0xe545('0x58')](_0x4e2eed);socket[_0xe545('0x59')](_0xe545('0x5a'),{'id':_0x568dde['id']});return;})['then'](respondWithStatusCode(_0x18cb2e,null))[_0xe545('0x44')](function(_0x326c5f){if(_0x568dde){socket[_0xe545('0x59')](_0xe545('0x5b'),{'id':_0x568dde['id']});}if(!_0x4e2eed){logger[_0xe545('0x16')](_0xe545('0x5c'),_0x326c5f);return _0x18cb2e[_0xe545('0xc')](0x1f4)[_0xe545('0x18')](_0x326c5f[_0xe545('0x5d')]);}logger['error'](_0xe545('0x5e'),_0x4e2eed['id'],JSON[_0xe545('0x5f')](_0x326c5f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3aee912..bf0df74 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 _0x1825=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x25cd10,_0x193910){var _0x99a9f9=function(_0x555314){while(--_0x555314){_0x25cd10['push'](_0x25cd10['shift']());}};_0x99a9f9(++_0x193910);}(_0x1825,0x7e));var _0x5182=function(_0x37ced0,_0x29518c){_0x37ced0=_0x37ced0-0x0;var _0x59ecfb=_0x1825[_0x37ced0];return _0x59ecfb;};'use strict';var _=require(_0x5182('0x0'));var util=require(_0x5182('0x1'));var logger=require(_0x5182('0x2'))(_0x5182('0x3'));var moment=require(_0x5182('0x4'));var BPromise=require(_0x5182('0x5'));var rp=require(_0x5182('0x6'));var fs=require('fs');var path=require(_0x5182('0x7'));var rimraf=require(_0x5182('0x8'));var config=require(_0x5182('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x5182('0xa')]=function(_0x203711,_0x49434b){return _0x203711[_0x5182('0xb')](_0x5182('0xc'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6720=['CloudProvider','cloud_providers','lodash','util','moment','bluebird','request-promise','path','define'];(function(_0x2c187e,_0x2a292f){var _0x39f4e7=function(_0x1be31f){while(--_0x1be31f){_0x2c187e['push'](_0x2c187e['shift']());}};_0x39f4e7(++_0x2a292f);}(_0x6720,0x16a));var _0x0672=function(_0x8ddda1,_0x501145){_0x8ddda1=_0x8ddda1-0x0;var _0x4db41e=_0x6720[_0x8ddda1];return _0x4db41e;};'use strict';var _=require(_0x0672('0x0'));var util=require(_0x0672('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0672('0x2'));var BPromise=require(_0x0672('0x3'));var rp=require(_0x0672('0x4'));var fs=require('fs');var path=require(_0x0672('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x3e4859,_0x358dac){return _0x3e4859[_0x0672('0x6')](_0x0672('0x7'),attributes,{'tableName':_0x0672('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index ca7d610..8f38d33 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 _0xa6fc=['key','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','audience','isAfter','exp','resolve','then','CloudProvider','refresh_token','data6','data4','decryptString','data3','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','localhost','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','data2','code','id_token','from','stringify','toString','hex','client_id','data1','response_mode','form_post','state','nonce','prompt','login'];(function(_0x30a36b,_0xa9e29b){var _0x4ea420=function(_0x442a14){while(--_0x442a14){_0x30a36b['push'](_0x30a36b['shift']());}};_0x4ea420(++_0xa9e29b);}(_0xa6fc,0x70));var _0xca6f=function(_0x5e332f,_0x5b706f){_0x5e332f=_0x5e332f-0x0;var _0x6df24f=_0xa6fc[_0x5e332f];return _0x6df24f;};'use strict';var _=require(_0xca6f('0x0'));var crypto=require(_0xca6f('0x1'));var jwt=require(_0xca6f('0x2'));var moment=require(_0xca6f('0x3'));var Redis=require(_0xca6f('0x4'));var rp=require(_0xca6f('0x5'));var util=require(_0xca6f('0x6'));var encryptor=require(_0xca6f('0x7'));var config=require('../../config/environment');var logger=require(_0xca6f('0x8'))(_0xca6f('0x9'));var schedule=require(_0xca6f('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xca6f('0xb')](config[_0xca6f('0xc')],{'host':_0xca6f('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xca6f('0xe'),'email',_0xca6f('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xca6f('0x10'),_0xca6f('0x11')],'Dynamics365':[_0xca6f('0x12'),_0xca6f('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0xca6f('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xca6f('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x301e3d){var _0x298220=_[_0xca6f('0x15')](AZURE_AUTH_SCOPES[_0x301e3d['type']]);if(_0x301e3d[_0xca6f('0x16')]===_0xca6f('0x17'))_0x298220[_0xca6f('0x18')](_0x301e3d[_0xca6f('0x19')]+_0xca6f('0x1a'));return _0x298220[_0xca6f('0x1b')]('\x20');}function getAccessTokenScope(_0x1f58bf){if(_0x1f58bf[_0xca6f('0x16')]===_0xca6f('0x1c'))return _0xca6f('0x1d');if(_0x1f58bf[_0xca6f('0x16')]===_0xca6f('0x17'))return _0x1f58bf[_0xca6f('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2613b5,_0x38672a){var _0x510ce0=MICROSOFT_AUTH_URL['replace'](_0xca6f('0x1e'),_0x2613b5[_0xca6f('0x1f')]);var _0x53fd74=[_0xca6f('0x20'),_0xca6f('0x21')];var _0xd83320=Buffer[_0xca6f('0x22')](JSON[_0xca6f('0x23')]({'id':_0x38672a}))[_0xca6f('0x24')]('base64');var _0x237cdb=crypto['randomBytes'](0x10)[_0xca6f('0x24')](_0xca6f('0x25'));var _0x18c03e=getAuthorizationScopes(_0x2613b5);var _0x2941e4=[{'key':_0xca6f('0x26'),'value':_0x2613b5[_0xca6f('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x53fd74[_0xca6f('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x2613b5['data4']},{'key':_0xca6f('0x28'),'value':_0xca6f('0x29')},{'key':'scope','value':encodeURIComponent(_0x18c03e)},{'key':_0xca6f('0x2a'),'value':_0xd83320},{'key':_0xca6f('0x2b'),'value':_0x237cdb},{'key':_0xca6f('0x2c'),'value':_0xca6f('0x2d')}];var _0x141f21=_0x510ce0+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xca6f('0x15')](_0x2941e4,function(_0x4e05df){return _0x4e05df[_0xca6f('0x2e')]+'='+_0x4e05df[_0xca6f('0x2f')];})[_0xca6f('0x1b')]('&');_0x2613b5[_0xca6f('0x30')]={'issuer':_0x510ce0[_0xca6f('0x31')](_0xca6f('0x32'),''),'audience':_0x2613b5[_0xca6f('0x27')],'state':_0xd83320,'nonce':_0x237cdb};redis[_0xca6f('0x33')](_0xd83320,JSON['stringify'](_0x2613b5));return _0x141f21;}function isValidIdToken(_0x392eaa,_0x415751){try{var _0x308ce9=jwt[_0xca6f('0x34')](_0x392eaa,{'complete':!![]});var _0x2bfcca=_0x308ce9[_0xca6f('0x35')];if(_0x2bfcca[_0xca6f('0x36')]!==_0x415751['issuer'])return![];if(_0x2bfcca['aud']!==_0x415751[_0xca6f('0x37')])return![];if(_0x2bfcca['nonce']!==_0x415751['nonce'])return![];if(moment()[_0xca6f('0x38')](moment['unix'](_0x2bfcca[_0xca6f('0x39')])))return![];return!![];}catch(_0x3c59e9){throw _0x3c59e9;}}function refreshOauth2MicrosoftAccessToken(_0x5091fe){return Promise[_0xca6f('0x3a')]()[_0xca6f('0x3b')](function(){if(_0x5091fe['data3'])return _0x5091fe;return db[_0xca6f('0x3c')]['findOne']({'where':{'id':_0x5091fe['id']},'raw':!![]});})[_0xca6f('0x3b')](function(_0x1e6281){var _0x4208a2={'grant_type':_0xca6f('0x3d'),'refresh_token':_0x1e6281[_0xca6f('0x3e')],'scope':getAccessTokenScope(_0x1e6281),'redirect_uri':_0x1e6281[_0xca6f('0x3f')],'client_id':_0x1e6281[_0xca6f('0x27')],'client_secret':encryptor[_0xca6f('0x40')](_0x1e6281[_0xca6f('0x41')])};var _0x2e8f6b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xca6f('0x31')](_0xca6f('0x1e'),_0x1e6281['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4208a2,'json':!![]};return rp(_0x2e8f6b);})[_0xca6f('0x3b')](function(_0x1bd65a){_0x5091fe['data5']=_0x1bd65a[_0xca6f('0x42')];_0x5091fe[_0xca6f('0x3e')]=_0x1bd65a[_0xca6f('0x3d')];return db[_0xca6f('0x3c')][_0xca6f('0x43')]({'data5':_0x5091fe['data5'],'data6':_0x5091fe[_0xca6f('0x3e')]},{'where':{'id':_0x5091fe['id']}});})[_0xca6f('0x3b')](function(){return _0x5091fe;})[_0xca6f('0x44')](function(_0x447ddc){logger['error'](_0xca6f('0x45'),_0x5091fe['id'],_0x447ddc);});}function getOauth2MicrosoftAccessToken(_0x5b6b85,_0x39029b){var _0x288dd1={'grant_type':_0xca6f('0x46'),'code':_0x5b6b85,'scope':getAccessTokenScope(_0x39029b),'redirect_uri':_0x39029b[_0xca6f('0x3f')],'client_id':_0x39029b[_0xca6f('0x27')],'client_secret':encryptor['decryptString'](_0x39029b['data3'])};var _0x244994={'method':_0xca6f('0x47'),'uri':MICROSOFT_AUTH_URL[_0xca6f('0x31')](_0xca6f('0x1e'),_0x39029b['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x288dd1,'json':!![]};return rp(_0x244994);}function startRefreshInterval(_0x478173){var _0x29faed=schedule[_0xca6f('0x48')];if(_0x29faed[_0x478173['id']])clearInterval(_0x29faed[_0x478173['id']]);_0x29faed[_0x478173['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xca6f('0x49')](this,{'id':_0x478173['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xca6f('0x48')]=_0x29faed;}function startAllRefreshIntervals(){return db[_0xca6f('0x3c')][_0xca6f('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xca6f('0x3b')](function(_0x36815b){var _0x51417a=_0x36815b['map'](function(_0x2539c0){return refreshOauth2MicrosoftAccessToken(_0x2539c0)[_0xca6f('0x3b')](function(_0x3e933d){startRefreshInterval(_0x3e933d);});});return Promise[_0xca6f('0x4b')](_0x51417a);})['catch'](function(_0x166a75){var _0x5dcee1=_0x166a75?util['inspect'](_0x166a75,{'showHidden':![],'depth':null}):'';logger[_0xca6f('0x4c')](_0xca6f('0x4d'),_0x5dcee1);});}module[_0xca6f('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb23f=['data6','decryptString','{TENANT_ID}','update','data5','authorization_code','POST','bind','intervals','findAll','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','push','data7','/.default','join','replace','data2','code','id_token','from','stringify','toString','randomBytes','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','decode','iss','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb23f,0x1e3));var _0xfb23=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb23f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfb23('0x0'));var crypto=require(_0xfb23('0x1'));var jwt=require(_0xfb23('0x2'));var moment=require(_0xfb23('0x3'));var Redis=require(_0xfb23('0x4'));var rp=require(_0xfb23('0x5'));var util=require('util');var encryptor=require(_0xfb23('0x6'));var config=require(_0xfb23('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0xfb23('0x8'));var db=require(_0xfb23('0x9'))['db'];config[_0xfb23('0xa')]=_[_0xfb23('0xb')](config['redis'],{'host':_0xfb23('0xc'),'port':0x18eb});var redis=new Redis(config[_0xfb23('0xa')]);var MICROSOFT_AUTH_URL=_0xfb23('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xfb23('0xe'),_0xfb23('0xf'),'offline_access',_0xfb23('0x10'),_0xfb23('0x11'),_0xfb23('0x12')],'Dynamics365':[_0xfb23('0x13'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xfb23('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xfb23('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x54f082){var _0x15bc27=_[_0xfb23('0x16')](AZURE_AUTH_SCOPES[_0x54f082[_0xfb23('0x17')]]);if(_0x54f082[_0xfb23('0x17')]==='Dynamics365')_0x15bc27[_0xfb23('0x18')](_0x54f082[_0xfb23('0x19')]+_0xfb23('0x1a'));return _0x15bc27[_0xfb23('0x1b')]('\x20');}function getAccessTokenScope(_0xc95715){if(_0xc95715[_0xfb23('0x17')]==='Outlook365')return _0xfb23('0x10');if(_0xc95715[_0xfb23('0x17')]==='Dynamics365')return _0xc95715[_0xfb23('0x19')]+_0xfb23('0x1a');}function generateMicrosoftAuthorizationUrl(_0x5bfe7e,_0x11107e){var _0x107b01=MICROSOFT_AUTH_URL[_0xfb23('0x1c')]('{TENANT_ID}',_0x5bfe7e[_0xfb23('0x1d')]);var _0x1b4c88=[_0xfb23('0x1e'),_0xfb23('0x1f')];var _0x57b4e0=Buffer[_0xfb23('0x20')](JSON[_0xfb23('0x21')]({'id':_0x11107e}))[_0xfb23('0x22')]('base64');var _0xd2e779=crypto[_0xfb23('0x23')](0x10)[_0xfb23('0x22')]('hex');var _0x2211ed=getAuthorizationScopes(_0x5bfe7e);var _0x3cc60b=[{'key':'client_id','value':_0x5bfe7e[_0xfb23('0x24')]},{'key':_0xfb23('0x25'),'value':encodeURIComponent(_0x1b4c88['join']('\x20'))},{'key':_0xfb23('0x26'),'value':_0x5bfe7e[_0xfb23('0x27')]},{'key':_0xfb23('0x28'),'value':_0xfb23('0x29')},{'key':_0xfb23('0x2a'),'value':encodeURIComponent(_0x2211ed)},{'key':_0xfb23('0x2b'),'value':_0x57b4e0},{'key':_0xfb23('0x2c'),'value':_0xd2e779},{'key':_0xfb23('0x2d'),'value':_0xfb23('0x2e')}];var _0x5292f2=_0x107b01+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xfb23('0x16')](_0x3cc60b,function(_0x91ee13){return _0x91ee13[_0xfb23('0x2f')]+'='+_0x91ee13[_0xfb23('0x30')];})[_0xfb23('0x1b')]('&');_0x5bfe7e[_0xfb23('0x31')]={'issuer':_0x107b01['replace']('oauth2/',''),'audience':_0x5bfe7e['data1'],'state':_0x57b4e0,'nonce':_0xd2e779};redis['set'](_0x57b4e0,JSON['stringify'](_0x5bfe7e));return _0x5292f2;}function isValidIdToken(_0x4faf79,_0x4626a2){try{var _0x4f0d90=jwt[_0xfb23('0x32')](_0x4faf79,{'complete':!![]});var _0x1c46f3=_0x4f0d90['payload'];if(_0x1c46f3[_0xfb23('0x33')]!==_0x4626a2['issuer'])return![];if(_0x1c46f3[_0xfb23('0x34')]!==_0x4626a2[_0xfb23('0x35')])return![];if(_0x1c46f3['nonce']!==_0x4626a2[_0xfb23('0x2c')])return![];if(moment()[_0xfb23('0x36')](moment[_0xfb23('0x37')](_0x1c46f3[_0xfb23('0x38')])))return![];return!![];}catch(_0x5b262c){throw _0x5b262c;}}function refreshOauth2MicrosoftAccessToken(_0x1a7409){return Promise[_0xfb23('0x39')]()[_0xfb23('0x3a')](function(){if(_0x1a7409[_0xfb23('0x3b')])return _0x1a7409;return db[_0xfb23('0x3c')][_0xfb23('0x3d')]({'where':{'id':_0x1a7409['id']},'raw':!![]});})[_0xfb23('0x3a')](function(_0x39aa79){var _0x1de693={'grant_type':_0xfb23('0x3e'),'refresh_token':_0x39aa79[_0xfb23('0x3f')],'scope':getAccessTokenScope(_0x39aa79),'redirect_uri':_0x39aa79[_0xfb23('0x27')],'client_id':_0x39aa79[_0xfb23('0x24')],'client_secret':encryptor[_0xfb23('0x40')](_0x39aa79['data3'])};var _0x12b5fa={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xfb23('0x1c')](_0xfb23('0x41'),_0x39aa79['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1de693,'json':!![]};return rp(_0x12b5fa);})[_0xfb23('0x3a')](function(_0x5c611a){_0x1a7409['data5']=_0x5c611a['access_token'];_0x1a7409[_0xfb23('0x3f')]=_0x5c611a[_0xfb23('0x3e')];return db['CloudProvider'][_0xfb23('0x42')]({'data5':_0x1a7409[_0xfb23('0x43')],'data6':_0x1a7409['data6']},{'where':{'id':_0x1a7409['id']}});})[_0xfb23('0x3a')](function(){return _0x1a7409;})['catch'](function(_0x121f1b){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x1a7409['id'],_0x121f1b);});}function getOauth2MicrosoftAccessToken(_0x4163b8,_0x41c7bc){var _0xf8b689={'grant_type':_0xfb23('0x44'),'code':_0x4163b8,'scope':getAccessTokenScope(_0x41c7bc),'redirect_uri':_0x41c7bc[_0xfb23('0x27')],'client_id':_0x41c7bc[_0xfb23('0x24')],'client_secret':encryptor[_0xfb23('0x40')](_0x41c7bc[_0xfb23('0x3b')])};var _0x5470f5={'method':_0xfb23('0x45'),'uri':MICROSOFT_AUTH_URL[_0xfb23('0x1c')]('{TENANT_ID}',_0x41c7bc[_0xfb23('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf8b689,'json':!![]};return rp(_0x5470f5);}function startRefreshInterval(_0x8ad406){var _0x489d26=schedule['intervals'];if(_0x489d26[_0x8ad406['id']])clearInterval(_0x489d26[_0x8ad406['id']]);_0x489d26[_0x8ad406['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xfb23('0x46')](this,{'id':_0x8ad406['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xfb23('0x47')]=_0x489d26;}function startAllRefreshIntervals(){return db[_0xfb23('0x3c')][_0xfb23('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x17c3e9){var _0x4dffa7=_0x17c3e9['map'](function(_0x550030){return refreshOauth2MicrosoftAccessToken(_0x550030)[_0xfb23('0x3a')](function(_0x1e7332){startRefreshInterval(_0x1e7332);});});return Promise['all'](_0x4dffa7);})[_0xfb23('0x49')](function(_0x2c1b76){var _0x5d4d44=_0x2c1b76?util[_0xfb23('0x4a')](_0x2c1b76,{'showHidden':![],'depth':null}):'';logger[_0xfb23('0x4b')](_0xfb23('0x4c'),_0x5d4d44);});}module[_0xfb23('0x4d')]={'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 f139e68..a5f2e4b 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 _0x3d2f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x2d1da8,_0x5606b9){_0x2d1da8=_0x2d1da8-0x0;var _0x53ae73=_0x3d2f[_0x2d1da8];return _0x53ae73;};'use strict';var _=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var moment=require('moment');var BPromise=require(_0xf3d2('0x2'));var rs=require(_0xf3d2('0x3'));var fs=require('fs');var Redis=require(_0xf3d2('0x4'));var db=require(_0xf3d2('0x5'))['db'];var utils=require(_0xf3d2('0x6'));var logger=require(_0xf3d2('0x7'))(_0xf3d2('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3d2('0x9'));var client=jayson[_0xf3d2('0xa')][_0xf3d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf9a0c9,_0x23edba,_0x57f94b){return new BPromise(function(_0x26f330,_0x3f86f6){return client['request'](_0xf9a0c9,_0x57f94b)[_0xf3d2('0xc')](function(_0x4ef134){logger[_0xf3d2('0xd')](_0xf3d2('0xe'),_0x23edba,_0xf3d2('0xf'));logger[_0xf3d2('0x10')](_0xf3d2('0x11'),_0x23edba,_0xf3d2('0xf'),JSON['stringify'](_0x4ef134));if(_0x4ef134[_0xf3d2('0x12')]){if(_0x4ef134[_0xf3d2('0x12')]['code']===0x1f4){logger[_0xf3d2('0x12')]('CloudProvider,\x20%s,\x20%s',_0x23edba,_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);return _0x3f86f6(_0x4ef134[_0xf3d2('0x12')]['message']);}logger[_0xf3d2('0x12')](_0xf3d2('0xe'),_0x23edba,_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);return _0x26f330(_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);}else{logger['info'](_0xf3d2('0xe'),_0x23edba,_0xf3d2('0xf'));_0x26f330(_0x4ef134[_0xf3d2('0x14')][_0xf3d2('0x13')]);}})[_0xf3d2('0x15')](function(_0x3daaaf){logger[_0xf3d2('0x12')](_0xf3d2('0xe'),_0x23edba,_0x3daaaf);_0x3f86f6(_0x3daaaf);});});} \ No newline at end of file +var _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x252b30,_0x54f581){var _0x3225ce=function(_0x4f1cdf){while(--_0x4f1cdf){_0x252b30['push'](_0x252b30['shift']());}};_0x3225ce(++_0x54f581);}(_0x3609,0x101));var _0x9360=function(_0x21d288,_0x20989a){_0x21d288=_0x21d288-0x0;var _0x137e1b=_0x3609[_0x21d288];return _0x137e1b;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index dc2c671..5f6ee4c 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x1ba00d,_0x28ec4b){var _0x199e87=function(_0x22daa7){while(--_0x22daa7){_0x1ba00d['push'](_0x1ba00d['shift']());}};_0x199e87(++_0x28ec4b);}(_0xdb28,0x106));var _0x8db2=function(_0x473ffe,_0x3844f8){_0x473ffe=_0x473ffe-0x0;var _0x10423f=_0xdb28[_0x473ffe];return _0x10423f;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x1261,0x144));var _0x1126=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x1261[_0xa5d9f9];return _0x40e9f6;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 54e67af..c5da131 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 _0x217a=['name','sequelize','STRING'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x217a,0x130));var _0xa217=function(_0x4a9f03,_0xda7a8a){_0x4a9f03=_0x4a9f03-0x0;var _0x5db5a3=_0x217a[_0x4a9f03];return _0x5db5a3;};'use strict';var Sequelize=require(_0xa217('0x0'));module['exports']={'name':{'type':Sequelize[_0xa217('0x1')],'unique':_0xa217('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa217('0x1')]},'companyId':{'type':Sequelize[_0xa217('0x1')]},'website':{'type':Sequelize[_0xa217('0x1')]},'phone':{'type':Sequelize[_0xa217('0x1')]},'fax':{'type':Sequelize[_0xa217('0x1')]},'type':{'type':Sequelize[_0xa217('0x1')]},'street':{'type':Sequelize[_0xa217('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa217('0x1')]},'country':{'type':Sequelize[_0xa217('0x1')]},'email':{'type':Sequelize[_0xa217('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa217('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xa217('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa217('0x1')]}}; \ No newline at end of file +var _0xe458=['sequelize','exports','name','STRING'];(function(_0x455583,_0xa3562f){var _0x16983e=function(_0x281f65){while(--_0x281f65){_0x455583['push'](_0x455583['shift']());}};_0x16983e(++_0xa3562f);}(_0xe458,0x6c));var _0x8e45=function(_0x50df96,_0x5684e7){_0x50df96=_0x50df96-0x0;var _0x306acb=_0xe458[_0x50df96];return _0x306acb;};'use strict';var Sequelize=require(_0x8e45('0x0'));module[_0x8e45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8e45('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8e45('0x3')]},'website':{'type':Sequelize[_0x8e45('0x3')]},'phone':{'type':Sequelize[_0x8e45('0x3')]},'fax':{'type':Sequelize[_0x8e45('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8e45('0x3')]},'country':{'type':Sequelize[_0x8e45('0x3')]},'email':{'type':Sequelize[_0x8e45('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8e45('0x3')]},'sCity':{'type':Sequelize[_0x8e45('0x3')]},'sCountry':{'type':Sequelize[_0x8e45('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 54a3bdc..e23afa8 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 _0x27e4=['attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','filter','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','params','ids','omit','findOne','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','index','CmCompany','describe','model','query','keys','intersection','fields'];(function(_0x34063f,_0x55bb48){var _0x509b9e=function(_0x32f598){while(--_0x32f598){_0x34063f['push'](_0x34063f['shift']());}};_0x509b9e(++_0x55bb48);}(_0x27e4,0x18c));var _0x427e=function(_0x566a23,_0x5f3e1d){_0x566a23=_0x566a23-0x0;var _0x3d033a=_0x27e4[_0x566a23];return _0x3d033a;};'use strict';var emlformat=require(_0x427e('0x0'));var rimraf=require(_0x427e('0x1'));var zipdir=require(_0x427e('0x2'));var jsonpatch=require(_0x427e('0x3'));var rp=require(_0x427e('0x4'));var moment=require(_0x427e('0x5'));var BPromise=require(_0x427e('0x6'));var Mustache=require(_0x427e('0x7'));var util=require(_0x427e('0x8'));var path=require('path');var sox=require(_0x427e('0x9'));var csv=require(_0x427e('0xa'));var ejs=require(_0x427e('0xb'));var fs=require('fs');var fs_extra=require(_0x427e('0xc'));var _=require('lodash');var squel=require(_0x427e('0xd'));var crypto=require('crypto');var jsforce=require(_0x427e('0xe'));var deskjs=require(_0x427e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x427e('0x10'));var Papa=require('papaparse');var Redis=require(_0x427e('0x11'));var authService=require(_0x427e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x427e('0x13'));var hardwareService=require(_0x427e('0x14'));var logger=require(_0x427e('0x15'))(_0x427e('0x16'));var utils=require(_0x427e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x427e('0x18'));var db=require(_0x427e('0x19'))['db'];function respondWithStatusCode(_0x5764b7,_0x183228){_0x183228=_0x183228||0xcc;return function(_0x6522b7){if(_0x6522b7){return _0x5764b7[_0x427e('0x1a')](_0x183228);}return _0x5764b7[_0x427e('0x1b')](_0x183228)[_0x427e('0x1c')]();};}function respondWithResult(_0x1127a1,_0x4e2446){_0x4e2446=_0x4e2446||0xc8;return function(_0xfc052d){if(_0xfc052d){return _0x1127a1['status'](_0x4e2446)['json'](_0xfc052d);}};}function respondWithFilteredResult(_0x290868,_0x5062de){return function(_0x1c7379){if(_0x1c7379){var _0x23a35a=typeof _0x5062de['offset']===_0x427e('0x1d')&&typeof _0x5062de[_0x427e('0x1e')]===_0x427e('0x1d');var _0x3fd9c3=_0x1c7379['count'];var _0x57ea9d=_0x23a35a?0x0:_0x5062de[_0x427e('0x1f')];var _0x512a38=_0x23a35a?_0x1c7379[_0x427e('0x20')]:_0x5062de[_0x427e('0x1f')]+_0x5062de[_0x427e('0x1e')];var _0x44722d;if(_0x512a38>=_0x3fd9c3){_0x512a38=_0x3fd9c3;_0x44722d=0xc8;}else{_0x44722d=0xce;}_0x290868['status'](_0x44722d);return _0x290868[_0x427e('0x21')](_0x427e('0x22'),_0x57ea9d+'-'+_0x512a38+'/'+_0x3fd9c3)[_0x427e('0x23')](_0x1c7379);}return null;};}function patchUpdates(_0xb2b594){return function(_0x1a3c14){try{jsonpatch[_0x427e('0x24')](_0x1a3c14,_0xb2b594,!![]);}catch(_0x6616bb){return BPromise[_0x427e('0x25')](_0x6616bb);}return _0x1a3c14[_0x427e('0x26')]();};}function saveUpdates(_0x2343cd,_0x83ac2e){return function(_0x34ff00){if(_0x34ff00){return _0x34ff00[_0x427e('0x27')](_0x2343cd)['then'](function(_0x52848a){return _0x52848a;});}return null;};}function removeEntity(_0x1e15d6,_0x3f3d19){return function(_0x33306e){if(_0x33306e){return _0x33306e[_0x427e('0x28')]()[_0x427e('0x29')](function(){var _0x2a1ef2=_0x33306e['get']({'plain':!![]});var _0x38dae2='Companies';return db[_0x427e('0x2a')]['destroy']({'where':{'type':_0x38dae2,'resourceId':_0x2a1ef2['id']}})['then'](function(){return _0x33306e;});})[_0x427e('0x29')](function(){_0x1e15d6[_0x427e('0x1b')](0xcc)[_0x427e('0x1c')]();});}};}function handleEntityNotFound(_0x414617,_0x2df916){return function(_0x3be449){if(!_0x3be449){_0x414617['sendStatus'](0x194);}return _0x3be449;};}function handleError(_0x506004,_0x38f082){_0x38f082=_0x38f082||0x1f4;return function(_0x229eda){logger[_0x427e('0x2b')](_0x229eda[_0x427e('0x2c')]);if(_0x229eda[_0x427e('0x2d')]){delete _0x229eda[_0x427e('0x2d')];}_0x506004['status'](_0x38f082)['send'](_0x229eda);};}exports[_0x427e('0x2e')]=function(_0x472359,_0x1835b4){var _0x2da28c={},_0x314c53={},_0x26b477={'count':0x0,'rows':[]};return db[_0x427e('0x2f')][_0x427e('0x30')]()[_0x427e('0x29')](function(_0x1c14e1){_0x314c53[_0x427e('0x31')]=_['keys'](_0x1c14e1);_0x314c53[_0x427e('0x32')]=_[_0x427e('0x33')](_0x472359[_0x427e('0x32')]);_0x314c53['filters']=_[_0x427e('0x34')](_0x314c53['model'],_0x314c53[_0x427e('0x32')]);_0x2da28c['attributes']=_[_0x427e('0x34')](_0x314c53[_0x427e('0x31')],qs[_0x427e('0x35')](_0x472359[_0x427e('0x32')][_0x427e('0x35')]));_0x2da28c[_0x427e('0x36')]=_0x2da28c[_0x427e('0x36')][_0x427e('0x37')]?_0x2da28c[_0x427e('0x36')]:_0x314c53[_0x427e('0x31')];if(!_0x472359['query'][_0x427e('0x38')]('nolimit')){_0x2da28c[_0x427e('0x1e')]=qs['limit'](_0x472359[_0x427e('0x32')][_0x427e('0x1e')]);_0x2da28c[_0x427e('0x1f')]=qs[_0x427e('0x1f')](_0x472359[_0x427e('0x32')][_0x427e('0x1f')]);}_0x2da28c[_0x427e('0x39')]=qs[_0x427e('0x3a')](_0x472359[_0x427e('0x32')][_0x427e('0x3a')]);_0x2da28c[_0x427e('0x3b')]=qs['filters'](_[_0x427e('0x3c')](_0x472359[_0x427e('0x32')],_0x314c53[_0x427e('0x3d')]),_0x1c14e1);if(_0x472359['query']['filter']){_0x2da28c[_0x427e('0x3b')]=_[_0x427e('0x3e')](_0x2da28c[_0x427e('0x3b')],{'$or':_[_0x427e('0x3f')](_0x2da28c[_0x427e('0x36')],function(_0x5f44cf){var _0x247621={};_0x247621[_0x5f44cf]={'$like':'%'+_0x472359[_0x427e('0x32')][_0x427e('0x40')]+'%'};return _0x247621;})});}_0x2da28c=_[_0x427e('0x3e')]({},_0x2da28c,_0x472359['options']);var _0x165728={'where':_0x2da28c[_0x427e('0x3b')]};return db[_0x427e('0x2f')][_0x427e('0x20')](_0x165728)['then'](function(_0xb96c19){_0x26b477['count']=_0xb96c19;if(_0x472359[_0x427e('0x32')][_0x427e('0x41')]){_0x2da28c[_0x427e('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0x427e('0x43')](_0x2da28c);})['then'](function(_0x4058e7){_0x26b477[_0x427e('0x44')]=_0x4058e7;return _0x26b477;})['then'](respondWithFilteredResult(_0x1835b4,_0x2da28c))['catch'](handleError(_0x1835b4,null));})['catch'](handleError(_0x1835b4,null));};exports[_0x427e('0x45')]=function(_0x51c388,_0x3818e6){var _0x3ac8ea={'raw':![],'where':{'id':_0x51c388['params']['id']}},_0x315d05={};_0x315d05[_0x427e('0x31')]=_[_0x427e('0x33')](db['CmCompany'][_0x427e('0x46')]);_0x315d05[_0x427e('0x32')]=_['keys'](_0x51c388[_0x427e('0x32')]);_0x315d05['filters']=_[_0x427e('0x34')](_0x315d05[_0x427e('0x31')],_0x315d05[_0x427e('0x32')]);_0x3ac8ea[_0x427e('0x36')]=_['intersection'](_0x315d05[_0x427e('0x31')],qs['fields'](_0x51c388[_0x427e('0x32')]['fields']));_0x3ac8ea[_0x427e('0x36')]=_0x3ac8ea[_0x427e('0x36')][_0x427e('0x37')]?_0x3ac8ea[_0x427e('0x36')]:_0x315d05[_0x427e('0x31')];if(_0x51c388['query']['includeAll']){_0x3ac8ea[_0x427e('0x42')]=[{'all':!![]}];}_0x3ac8ea=_[_0x427e('0x3e')]({},_0x3ac8ea,_0x51c388[_0x427e('0x47')]);return db[_0x427e('0x2f')]['find'](_0x3ac8ea)['then'](handleEntityNotFound(_0x3818e6,null))['then'](respondWithResult(_0x3818e6,null))[_0x427e('0x48')](handleError(_0x3818e6,null));};exports[_0x427e('0x49')]=function(_0x5b6795,_0x52d2d8){return db['CmCompany']['create'](_0x5b6795[_0x427e('0x4a')],{})[_0x427e('0x29')](function(_0x3f0be9){var _0x1b0a3a=_0x5b6795[_0x427e('0x4b')][_0x427e('0x4c')]({'plain':!![]});if(!_0x1b0a3a)throw new Error(_0x427e('0x4d'));if(_0x1b0a3a[_0x427e('0x4e')]===_0x427e('0x4b')){var _0x2cf7f9=_0x3f0be9[_0x427e('0x4c')]({'plain':!![]});var _0xbeb2b5='Companies';return db['UserProfileSection'][_0x427e('0x4f')]({'where':{'name':_0xbeb2b5,'userProfileId':_0x1b0a3a[_0x427e('0x50')]},'raw':!![]})[_0x427e('0x29')](function(_0x1cb591){if(_0x1cb591&&_0x1cb591[_0x427e('0x51')]===0x0){return db[_0x427e('0x2a')][_0x427e('0x49')]({'name':_0x2cf7f9[_0x427e('0x2d')],'resourceId':_0x2cf7f9['id'],'type':_0x1cb591[_0x427e('0x2d')],'sectionId':_0x1cb591['id']},{})[_0x427e('0x29')](function(){return _0x3f0be9;});}else{return _0x3f0be9;}})[_0x427e('0x48')](function(_0x183e71){logger[_0x427e('0x2b')](_0x427e('0x52'),_0x183e71);throw _0x183e71;});}return _0x3f0be9;})[_0x427e('0x29')](respondWithResult(_0x52d2d8,0xc9))[_0x427e('0x48')](handleError(_0x52d2d8,null));};exports[_0x427e('0x27')]=function(_0x20558d,_0x2b1dba){if(_0x20558d[_0x427e('0x4a')]['id']){delete _0x20558d[_0x427e('0x4a')]['id'];}return db[_0x427e('0x2f')][_0x427e('0x4f')]({'where':{'id':_0x20558d['params']['id']}})[_0x427e('0x29')](handleEntityNotFound(_0x2b1dba,null))[_0x427e('0x29')](saveUpdates(_0x20558d['body'],null))[_0x427e('0x29')](respondWithResult(_0x2b1dba,null))[_0x427e('0x48')](handleError(_0x2b1dba,null));};exports[_0x427e('0x28')]=function(_0x42e4f4,_0x2cc59d){return db[_0x427e('0x2f')][_0x427e('0x4f')]({'where':{'id':_0x42e4f4['params']['id']}})[_0x427e('0x29')](handleEntityNotFound(_0x2cc59d,null))[_0x427e('0x29')](removeEntity(_0x2cc59d,null))[_0x427e('0x48')](handleError(_0x2cc59d,null));};exports['describe']=function(_0x9c17e0,_0x3148a3){return db[_0x427e('0x2f')][_0x427e('0x30')]()[_0x427e('0x29')](respondWithResult(_0x3148a3,null))['catch'](handleError(_0x3148a3,null));};exports[_0x427e('0x53')]=function(_0xe1e07d,_0x57a92f,_0x36f8de){return db[_0x427e('0x54')][_0x427e('0x4f')]({'where':{'id':_0xe1e07d[_0x427e('0x55')]['id']}})[_0x427e('0x29')](handleEntityNotFound(_0x57a92f,null))[_0x427e('0x29')](function(_0x4bc0de){if(_0x4bc0de){return _0x4bc0de['addContacts'](_0xe1e07d[_0x427e('0x4a')][_0x427e('0x56')],_[_0x427e('0x57')](_0xe1e07d[_0x427e('0x4a')],[_0x427e('0x56'),'id'])||{});}})[_0x427e('0x29')](respondWithResult(_0x57a92f,null))[_0x427e('0x48')](handleError(_0x57a92f,null));};exports['getContacts']=function(_0x41a7eb,_0x55df5e,_0x12abfd){var _0x321c45={};var _0x4332df={};var _0x2ef444;var _0x43fb76;return db[_0x427e('0x2f')][_0x427e('0x58')]({'where':{'id':_0x41a7eb[_0x427e('0x55')]['id']}})[_0x427e('0x29')](handleEntityNotFound(_0x55df5e,null))[_0x427e('0x29')](function(_0x374305){if(_0x374305){_0x2ef444=_0x374305;_0x4332df[_0x427e('0x31')]=_[_0x427e('0x33')](db['CmContact'][_0x427e('0x46')]);_0x4332df[_0x427e('0x32')]=_[_0x427e('0x33')](_0x41a7eb[_0x427e('0x32')]);_0x4332df['filters']=_[_0x427e('0x34')](_0x4332df[_0x427e('0x31')],_0x4332df[_0x427e('0x32')]);_0x321c45[_0x427e('0x36')]=_['intersection'](_0x4332df['model'],qs['fields'](_0x41a7eb[_0x427e('0x32')][_0x427e('0x35')]));_0x321c45['attributes']=_0x321c45['attributes'][_0x427e('0x37')]?_0x321c45[_0x427e('0x36')]:_0x4332df['model'];_0x321c45[_0x427e('0x39')]=qs[_0x427e('0x3a')](_0x41a7eb[_0x427e('0x32')][_0x427e('0x3a')]);_0x321c45[_0x427e('0x3b')]=qs[_0x427e('0x3d')](_['pick'](_0x41a7eb[_0x427e('0x32')],_0x4332df[_0x427e('0x3d')]));if(_0x41a7eb['query']['filter']){_0x321c45[_0x427e('0x3b')]=_[_0x427e('0x3e')](_0x321c45[_0x427e('0x3b')],{'$or':_['map'](_0x321c45['attributes'],function(_0x308d00){var _0x3a697e={};_0x3a697e[_0x308d00]={'$like':'%'+_0x41a7eb[_0x427e('0x32')]['filter']+'%'};return _0x3a697e;})});}_0x321c45=_[_0x427e('0x3e')]({},_0x321c45,_0x41a7eb[_0x427e('0x47')]);return _0x2ef444[_0x427e('0x59')](_0x321c45);}})[_0x427e('0x29')](function(_0x76d48e){if(_0x76d48e){_0x43fb76=_0x76d48e[_0x427e('0x37')];if(!_0x41a7eb[_0x427e('0x32')][_0x427e('0x38')]('nolimit')){_0x321c45[_0x427e('0x1e')]=qs['limit'](_0x41a7eb['query']['limit']);_0x321c45[_0x427e('0x1f')]=qs['offset'](_0x41a7eb[_0x427e('0x32')][_0x427e('0x1f')]);}return _0x2ef444['getContacts'](_0x321c45);}})[_0x427e('0x29')](function(_0x46ce85){if(_0x46ce85){return _0x46ce85?{'count':_0x43fb76,'rows':_0x46ce85}:null;}})[_0x427e('0x29')](respondWithResult(_0x55df5e,null))[_0x427e('0x48')](handleError(_0x55df5e,null));}; \ No newline at end of file +var _0x9ac9=['../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xfc80b2,_0x1a7f7e){var _0x359f36=function(_0x116742){while(--_0x116742){_0xfc80b2['push'](_0xfc80b2['shift']());}};_0x359f36(++_0x1a7f7e);}(_0x9ac9,0x1f3));var _0x99ac=function(_0x2903ec,_0x4adec2){_0x2903ec=_0x2903ec-0x0;var _0x50251f=_0x9ac9[_0x2903ec];return _0x50251f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ac('0x0'));var zipdir=require(_0x99ac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x99ac('0x3'));var path=require('path');var sox=require(_0x99ac('0x4'));var csv=require(_0x99ac('0x5'));var ejs=require(_0x99ac('0x6'));var fs=require('fs');var fs_extra=require(_0x99ac('0x7'));var _=require(_0x99ac('0x8'));var squel=require(_0x99ac('0x9'));var crypto=require(_0x99ac('0xa'));var jsforce=require(_0x99ac('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x99ac('0x5'));var querystring=require('querystring');var Papa=require(_0x99ac('0xc'));var Redis=require(_0x99ac('0xd'));var authService=require(_0x99ac('0xe'));var qs=require(_0x99ac('0xf'));var as=require(_0x99ac('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ac('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x99ac('0x12'));var licenseUtil=require(_0x99ac('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd773,_0x176eb4){_0x176eb4=_0x176eb4||0xcc;return function(_0x1f3784){if(_0x1f3784){return _0x3bd773[_0x99ac('0x14')](_0x176eb4);}return _0x3bd773[_0x99ac('0x15')](_0x176eb4)[_0x99ac('0x16')]();};}function respondWithResult(_0x3f01a5,_0x1f8532){_0x1f8532=_0x1f8532||0xc8;return function(_0x5d4739){if(_0x5d4739){return _0x3f01a5[_0x99ac('0x15')](_0x1f8532)[_0x99ac('0x17')](_0x5d4739);}};}function respondWithFilteredResult(_0x34e405,_0x3a58c4){return function(_0x209b91){if(_0x209b91){var _0x248fd5=typeof _0x3a58c4[_0x99ac('0x18')]===_0x99ac('0x19')&&typeof _0x3a58c4[_0x99ac('0x1a')]===_0x99ac('0x19');var _0x451665=_0x209b91['count'];var _0x10c944=_0x248fd5?0x0:_0x3a58c4[_0x99ac('0x18')];var _0x42a28b=_0x248fd5?_0x209b91[_0x99ac('0x1b')]:_0x3a58c4[_0x99ac('0x18')]+_0x3a58c4[_0x99ac('0x1a')];var _0x2fe86d;if(_0x42a28b>=_0x451665){_0x42a28b=_0x451665;_0x2fe86d=0xc8;}else{_0x2fe86d=0xce;}_0x34e405['status'](_0x2fe86d);return _0x34e405[_0x99ac('0x1c')](_0x99ac('0x1d'),_0x10c944+'-'+_0x42a28b+'/'+_0x451665)[_0x99ac('0x17')](_0x209b91);}return null;};}function patchUpdates(_0xa08962){return function(_0x327bd1){try{jsonpatch[_0x99ac('0x1e')](_0x327bd1,_0xa08962,!![]);}catch(_0x39eddf){return BPromise['reject'](_0x39eddf);}return _0x327bd1[_0x99ac('0x1f')]();};}function saveUpdates(_0x28245d,_0x27e28f){return function(_0x30fc8a){if(_0x30fc8a){return _0x30fc8a[_0x99ac('0x20')](_0x28245d)[_0x99ac('0x21')](function(_0x344385){return _0x344385;});}return null;};}function removeEntity(_0x16b7d8,_0xd1311a){return function(_0x480827){if(_0x480827){return _0x480827[_0x99ac('0x22')]()[_0x99ac('0x21')](function(){var _0x193bae=_0x480827[_0x99ac('0x23')]({'plain':!![]});var _0x2ead61=_0x99ac('0x24');return db[_0x99ac('0x25')]['destroy']({'where':{'type':_0x2ead61,'resourceId':_0x193bae['id']}})[_0x99ac('0x21')](function(){return _0x480827;});})[_0x99ac('0x21')](function(){_0x16b7d8[_0x99ac('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11ad25,_0x264979){return function(_0x4f06f6){if(!_0x4f06f6){_0x11ad25[_0x99ac('0x14')](0x194);}return _0x4f06f6;};}function handleError(_0x3547b9,_0x200d2e){_0x200d2e=_0x200d2e||0x1f4;return function(_0x304385){logger[_0x99ac('0x26')](_0x304385[_0x99ac('0x27')]);if(_0x304385[_0x99ac('0x28')]){delete _0x304385[_0x99ac('0x28')];}_0x3547b9['status'](_0x200d2e)[_0x99ac('0x29')](_0x304385);};}exports['index']=function(_0x3c409,_0x3a18f){var _0x6632fc={},_0x3615f7={},_0x3c3461={'count':0x0,'rows':[]};return db[_0x99ac('0x2a')][_0x99ac('0x2b')]()['then'](function(_0x1973e2){_0x3615f7['model']=_['keys'](_0x1973e2);_0x3615f7['query']=_[_0x99ac('0x2c')](_0x3c409[_0x99ac('0x2d')]);_0x3615f7[_0x99ac('0x2e')]=_['intersection'](_0x3615f7[_0x99ac('0x2f')],_0x3615f7[_0x99ac('0x2d')]);_0x6632fc['attributes']=_['intersection'](_0x3615f7[_0x99ac('0x2f')],qs[_0x99ac('0x30')](_0x3c409[_0x99ac('0x2d')][_0x99ac('0x30')]));_0x6632fc[_0x99ac('0x31')]=_0x6632fc[_0x99ac('0x31')]['length']?_0x6632fc[_0x99ac('0x31')]:_0x3615f7[_0x99ac('0x2f')];if(!_0x3c409[_0x99ac('0x2d')][_0x99ac('0x32')](_0x99ac('0x33'))){_0x6632fc[_0x99ac('0x1a')]=qs[_0x99ac('0x1a')](_0x3c409['query'][_0x99ac('0x1a')]);_0x6632fc[_0x99ac('0x18')]=qs[_0x99ac('0x18')](_0x3c409[_0x99ac('0x2d')][_0x99ac('0x18')]);}_0x6632fc[_0x99ac('0x34')]=qs['sort'](_0x3c409[_0x99ac('0x2d')][_0x99ac('0x35')]);_0x6632fc['where']=qs['filters'](_['pick'](_0x3c409['query'],_0x3615f7[_0x99ac('0x2e')]),_0x1973e2);if(_0x3c409[_0x99ac('0x2d')]['filter']){_0x6632fc[_0x99ac('0x36')]=_[_0x99ac('0x37')](_0x6632fc[_0x99ac('0x36')],{'$or':_[_0x99ac('0x38')](_0x6632fc[_0x99ac('0x31')],function(_0x1ef8d1){var _0x4a6451={};_0x4a6451[_0x1ef8d1]={'$like':'%'+_0x3c409[_0x99ac('0x2d')][_0x99ac('0x39')]+'%'};return _0x4a6451;})});}_0x6632fc=_[_0x99ac('0x37')]({},_0x6632fc,_0x3c409[_0x99ac('0x3a')]);var _0x42514b={'where':_0x6632fc[_0x99ac('0x36')]};return db[_0x99ac('0x2a')][_0x99ac('0x1b')](_0x42514b)[_0x99ac('0x21')](function(_0x26f47d){_0x3c3461['count']=_0x26f47d;if(_0x3c409['query']['includeAll']){_0x6632fc[_0x99ac('0x3b')]=[{'all':!![]}];}return db[_0x99ac('0x2a')][_0x99ac('0x3c')](_0x6632fc);})['then'](function(_0x5cbbcb){_0x3c3461[_0x99ac('0x3d')]=_0x5cbbcb;return _0x3c3461;})[_0x99ac('0x21')](respondWithFilteredResult(_0x3a18f,_0x6632fc))['catch'](handleError(_0x3a18f,null));})[_0x99ac('0x3e')](handleError(_0x3a18f,null));};exports[_0x99ac('0x3f')]=function(_0xcbcaa1,_0x100c18){var _0x15c04a={'raw':![],'where':{'id':_0xcbcaa1[_0x99ac('0x40')]['id']}},_0x1569b8={};_0x1569b8[_0x99ac('0x2f')]=_['keys'](db[_0x99ac('0x2a')][_0x99ac('0x41')]);_0x1569b8[_0x99ac('0x2d')]=_[_0x99ac('0x2c')](_0xcbcaa1[_0x99ac('0x2d')]);_0x1569b8[_0x99ac('0x2e')]=_['intersection'](_0x1569b8[_0x99ac('0x2f')],_0x1569b8['query']);_0x15c04a[_0x99ac('0x31')]=_[_0x99ac('0x42')](_0x1569b8[_0x99ac('0x2f')],qs[_0x99ac('0x30')](_0xcbcaa1[_0x99ac('0x2d')]['fields']));_0x15c04a[_0x99ac('0x31')]=_0x15c04a['attributes'][_0x99ac('0x43')]?_0x15c04a[_0x99ac('0x31')]:_0x1569b8[_0x99ac('0x2f')];if(_0xcbcaa1['query'][_0x99ac('0x44')]){_0x15c04a['include']=[{'all':!![]}];}_0x15c04a=_[_0x99ac('0x37')]({},_0x15c04a,_0xcbcaa1[_0x99ac('0x3a')]);return db[_0x99ac('0x2a')][_0x99ac('0x45')](_0x15c04a)['then'](handleEntityNotFound(_0x100c18,null))[_0x99ac('0x21')](respondWithResult(_0x100c18,null))[_0x99ac('0x3e')](handleError(_0x100c18,null));};exports[_0x99ac('0x46')]=function(_0x3ff29e,_0x4c079e){return db[_0x99ac('0x2a')][_0x99ac('0x46')](_0x3ff29e[_0x99ac('0x47')],{})[_0x99ac('0x21')](function(_0x2375ba){var _0x1c780b=_0x3ff29e[_0x99ac('0x48')][_0x99ac('0x23')]({'plain':!![]});if(!_0x1c780b)throw new Error(_0x99ac('0x49'));if(_0x1c780b[_0x99ac('0x4a')]===_0x99ac('0x48')){var _0x1386ee=_0x2375ba[_0x99ac('0x23')]({'plain':!![]});var _0x56e710=_0x99ac('0x24');return db[_0x99ac('0x4b')]['find']({'where':{'name':_0x56e710,'userProfileId':_0x1c780b[_0x99ac('0x4c')]},'raw':!![]})[_0x99ac('0x21')](function(_0x3c08e7){if(_0x3c08e7&&_0x3c08e7[_0x99ac('0x4d')]===0x0){return db['UserProfileResource'][_0x99ac('0x46')]({'name':_0x1386ee['name'],'resourceId':_0x1386ee['id'],'type':_0x3c08e7[_0x99ac('0x28')],'sectionId':_0x3c08e7['id']},{})['then'](function(){return _0x2375ba;});}else{return _0x2375ba;}})['catch'](function(_0x140f2c){logger[_0x99ac('0x26')](_0x99ac('0x4e'),_0x140f2c);throw _0x140f2c;});}return _0x2375ba;})[_0x99ac('0x21')](respondWithResult(_0x4c079e,0xc9))[_0x99ac('0x3e')](handleError(_0x4c079e,null));};exports['update']=function(_0x7c9ec8,_0x53391c){if(_0x7c9ec8[_0x99ac('0x47')]['id']){delete _0x7c9ec8['body']['id'];}return db[_0x99ac('0x2a')][_0x99ac('0x45')]({'where':{'id':_0x7c9ec8['params']['id']}})[_0x99ac('0x21')](handleEntityNotFound(_0x53391c,null))[_0x99ac('0x21')](saveUpdates(_0x7c9ec8['body'],null))[_0x99ac('0x21')](respondWithResult(_0x53391c,null))[_0x99ac('0x3e')](handleError(_0x53391c,null));};exports[_0x99ac('0x22')]=function(_0xcb7b22,_0x45cb42){return db['CmCompany'][_0x99ac('0x45')]({'where':{'id':_0xcb7b22[_0x99ac('0x40')]['id']}})[_0x99ac('0x21')](handleEntityNotFound(_0x45cb42,null))[_0x99ac('0x21')](removeEntity(_0x45cb42,null))[_0x99ac('0x3e')](handleError(_0x45cb42,null));};exports['describe']=function(_0x386745,_0x1f9316){return db[_0x99ac('0x2a')][_0x99ac('0x2b')]()[_0x99ac('0x21')](respondWithResult(_0x1f9316,null))[_0x99ac('0x3e')](handleError(_0x1f9316,null));};exports[_0x99ac('0x4f')]=function(_0x51356b,_0x4c164f,_0x1546d9){return db['CmContact'][_0x99ac('0x45')]({'where':{'id':_0x51356b[_0x99ac('0x40')]['id']}})[_0x99ac('0x21')](handleEntityNotFound(_0x4c164f,null))[_0x99ac('0x21')](function(_0xc29f3c){if(_0xc29f3c){return _0xc29f3c[_0x99ac('0x4f')](_0x51356b[_0x99ac('0x47')][_0x99ac('0x50')],_[_0x99ac('0x51')](_0x51356b[_0x99ac('0x47')],[_0x99ac('0x50'),'id'])||{});}})[_0x99ac('0x21')](respondWithResult(_0x4c164f,null))['catch'](handleError(_0x4c164f,null));};exports[_0x99ac('0x52')]=function(_0x561bb5,_0xa6c51a,_0xc8761f){var _0x64cd6f={};var _0x3e53b5={};var _0x12a961;var _0x4a7945;return db[_0x99ac('0x2a')][_0x99ac('0x53')]({'where':{'id':_0x561bb5[_0x99ac('0x40')]['id']}})[_0x99ac('0x21')](handleEntityNotFound(_0xa6c51a,null))[_0x99ac('0x21')](function(_0x2973b6){if(_0x2973b6){_0x12a961=_0x2973b6;_0x3e53b5[_0x99ac('0x2f')]=_['keys'](db[_0x99ac('0x54')]['rawAttributes']);_0x3e53b5['query']=_[_0x99ac('0x2c')](_0x561bb5[_0x99ac('0x2d')]);_0x3e53b5[_0x99ac('0x2e')]=_[_0x99ac('0x42')](_0x3e53b5[_0x99ac('0x2f')],_0x3e53b5[_0x99ac('0x2d')]);_0x64cd6f[_0x99ac('0x31')]=_[_0x99ac('0x42')](_0x3e53b5[_0x99ac('0x2f')],qs[_0x99ac('0x30')](_0x561bb5[_0x99ac('0x2d')]['fields']));_0x64cd6f['attributes']=_0x64cd6f[_0x99ac('0x31')][_0x99ac('0x43')]?_0x64cd6f['attributes']:_0x3e53b5[_0x99ac('0x2f')];_0x64cd6f[_0x99ac('0x34')]=qs[_0x99ac('0x35')](_0x561bb5[_0x99ac('0x2d')][_0x99ac('0x35')]);_0x64cd6f['where']=qs[_0x99ac('0x2e')](_[_0x99ac('0x55')](_0x561bb5[_0x99ac('0x2d')],_0x3e53b5[_0x99ac('0x2e')]));if(_0x561bb5['query'][_0x99ac('0x39')]){_0x64cd6f[_0x99ac('0x36')]=_[_0x99ac('0x37')](_0x64cd6f[_0x99ac('0x36')],{'$or':_[_0x99ac('0x38')](_0x64cd6f['attributes'],function(_0x21e924){var _0x5c8d2a={};_0x5c8d2a[_0x21e924]={'$like':'%'+_0x561bb5[_0x99ac('0x2d')][_0x99ac('0x39')]+'%'};return _0x5c8d2a;})});}_0x64cd6f=_[_0x99ac('0x37')]({},_0x64cd6f,_0x561bb5[_0x99ac('0x3a')]);return _0x12a961['getContacts'](_0x64cd6f);}})[_0x99ac('0x21')](function(_0x4b7999){if(_0x4b7999){_0x4a7945=_0x4b7999[_0x99ac('0x43')];if(!_0x561bb5[_0x99ac('0x2d')]['hasOwnProperty'](_0x99ac('0x33'))){_0x64cd6f[_0x99ac('0x1a')]=qs['limit'](_0x561bb5[_0x99ac('0x2d')][_0x99ac('0x1a')]);_0x64cd6f[_0x99ac('0x18')]=qs[_0x99ac('0x18')](_0x561bb5[_0x99ac('0x2d')][_0x99ac('0x18')]);}return _0x12a961[_0x99ac('0x52')](_0x64cd6f);}})[_0x99ac('0x21')](function(_0xb4ee0c){if(_0xb4ee0c){return _0xb4ee0c?{'count':_0x4a7945,'rows':_0xb4ee0c}:null;}})[_0x99ac('0x21')](respondWithResult(_0xa6c51a,null))[_0x99ac('0x3e')](handleError(_0xa6c51a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6e13cd7..cff3552 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 _0x623f=['./cmCompany.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x8bf685,_0x1cb3c7){var _0xd13234=function(_0x343121){while(--_0x343121){_0x8bf685['push'](_0x8bf685['shift']());}};_0xd13234(++_0x1cb3c7);}(_0x623f,0x19a));var _0xf623=function(_0x4cc053,_0x2a65b0){_0x4cc053=_0x4cc053-0x0;var _0x10ddf6=_0x623f[_0x4cc053];return _0x10ddf6;};'use strict';var _=require(_0xf623('0x0'));var util=require(_0xf623('0x1'));var logger=require(_0xf623('0x2'))('api');var moment=require(_0xf623('0x3'));var BPromise=require(_0xf623('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf623('0x5'));var rimraf=require(_0xf623('0x6'));var config=require(_0xf623('0x7'));var attributes=require(_0xf623('0x8'));module[_0xf623('0x9')]=function(_0x2b9260,_0x374b0d){return _0x2b9260[_0xf623('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x515d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x515d,0x178));var _0xd515=function(_0xb0af6,_0x2c0849){_0xb0af6=_0xb0af6-0x0;var _0x28105d=_0x515d[_0xb0af6];return _0x28105d;};'use strict';var _=require(_0xd515('0x0'));var util=require(_0xd515('0x1'));var logger=require(_0xd515('0x2'))(_0xd515('0x3'));var moment=require(_0xd515('0x4'));var BPromise=require('bluebird');var rp=require(_0xd515('0x5'));var fs=require('fs');var path=require(_0xd515('0x6'));var rimraf=require(_0xd515('0x7'));var config=require(_0xd515('0x8'));var attributes=require(_0xd515('0x9'));module[_0xd515('0xa')]=function(_0x439097,_0x49b672){return _0x439097[_0xd515('0xb')](_0xd515('0xc'),attributes,{'tableName':_0xd515('0xd'),'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 49e6c9a..f29ce41 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 _0x44c4=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5a612c,_0x33e310){var _0x4a8e51=function(_0x21f180){while(--_0x21f180){_0x5a612c['push'](_0x5a612c['shift']());}};_0x4a8e51(++_0x33e310);}(_0x44c4,0x13d));var _0x444c=function(_0x176e46,_0x298091){_0x176e46=_0x176e46-0x0;var _0x546a76=_0x44c4[_0x176e46];return _0x546a76;};'use strict';var _=require('lodash');var util=require(_0x444c('0x0'));var moment=require(_0x444c('0x1'));var BPromise=require(_0x444c('0x2'));var rs=require(_0x444c('0x3'));var fs=require('fs');var Redis=require(_0x444c('0x4'));var db=require(_0x444c('0x5'))['db'];var utils=require(_0x444c('0x6'));var logger=require('../../config/logger')(_0x444c('0x7'));var config=require(_0x444c('0x8'));var jayson=require(_0x444c('0x9'));var client=jayson[_0x444c('0xa')][_0x444c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4445ec,_0x4c83b2,_0xc679d0){return new BPromise(function(_0x5c8fc4,_0x5d0f99){return client['request'](_0x4445ec,_0xc679d0)[_0x444c('0xc')](function(_0x2fc491){logger[_0x444c('0xd')](_0x444c('0xe'),_0x4c83b2,_0x444c('0xf'));logger[_0x444c('0x10')](_0x444c('0x11'),_0x4c83b2,_0x444c('0xf'),JSON['stringify'](_0x2fc491));if(_0x2fc491[_0x444c('0x12')]){if(_0x2fc491[_0x444c('0x12')][_0x444c('0x13')]===0x1f4){logger[_0x444c('0x12')](_0x444c('0xe'),_0x4c83b2,_0x2fc491[_0x444c('0x12')][_0x444c('0x14')]);return _0x5d0f99(_0x2fc491['error'][_0x444c('0x14')]);}logger[_0x444c('0x12')](_0x444c('0xe'),_0x4c83b2,_0x2fc491[_0x444c('0x12')][_0x444c('0x14')]);return _0x5c8fc4(_0x2fc491[_0x444c('0x12')][_0x444c('0x14')]);}else{logger['info'](_0x444c('0xe'),_0x4c83b2,_0x444c('0xf'));_0x5c8fc4(_0x2fc491['result'][_0x444c('0x14')]);}})[_0x444c('0x15')](function(_0x5422f5){logger['error'](_0x444c('0xe'),_0x4c83b2,_0x5422f5);_0x5d0f99(_0x5422f5);});});} \ No newline at end of file +var _0xae2a=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','CmCompany,\x20%s,\x20%s'];(function(_0x5a760e,_0x5e4025){var _0x38654f=function(_0x31a143){while(--_0x31a143){_0x5a760e['push'](_0x5a760e['shift']());}};_0x38654f(++_0x5e4025);}(_0xae2a,0x1d0));var _0xaae2=function(_0x5ef31a,_0x4ef026){_0x5ef31a=_0x5ef31a-0x0;var _0x39877a=_0xae2a[_0x5ef31a];return _0x39877a;};'use strict';var _=require(_0xaae2('0x0'));var util=require(_0xaae2('0x1'));var moment=require(_0xaae2('0x2'));var BPromise=require(_0xaae2('0x3'));var rs=require(_0xaae2('0x4'));var fs=require('fs');var Redis=require(_0xaae2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaae2('0x6'));var logger=require(_0xaae2('0x7'))(_0xaae2('0x8'));var config=require(_0xaae2('0x9'));var jayson=require(_0xaae2('0xa'));var client=jayson[_0xaae2('0xb')][_0xaae2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14496e,_0x30a3f6,_0x954a93){return new BPromise(function(_0x25ae4a,_0x4f25dd){return client[_0xaae2('0xd')](_0x14496e,_0x954a93)[_0xaae2('0xe')](function(_0x2b8482){logger[_0xaae2('0xf')]('CmCompany,\x20%s,\x20%s',_0x30a3f6,'request\x20sent');logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x30a3f6,_0xaae2('0x10'),JSON[_0xaae2('0x11')](_0x2b8482));if(_0x2b8482[_0xaae2('0x12')]){if(_0x2b8482[_0xaae2('0x12')]['code']===0x1f4){logger[_0xaae2('0x12')](_0xaae2('0x13'),_0x30a3f6,_0x2b8482[_0xaae2('0x12')]['message']);return _0x4f25dd(_0x2b8482[_0xaae2('0x12')][_0xaae2('0x14')]);}logger['error'](_0xaae2('0x13'),_0x30a3f6,_0x2b8482[_0xaae2('0x12')]['message']);return _0x25ae4a(_0x2b8482[_0xaae2('0x12')][_0xaae2('0x14')]);}else{logger[_0xaae2('0xf')]('CmCompany,\x20%s,\x20%s',_0x30a3f6,_0xaae2('0x10'));_0x25ae4a(_0x2b8482['result'][_0xaae2('0x14')]);}})[_0xaae2('0x15')](function(_0x281c0a){logger[_0xaae2('0x12')](_0xaae2('0x13'),_0x30a3f6,_0x281c0a);_0x4f25dd(_0x281c0a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index da99dbd..bfd4dcc 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 _0xe485=['index','show','/:id/contacts','getContacts','post','create','addContacts','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x1a7cd1,_0x22824d){var _0x5553f6=function(_0x4537a6){while(--_0x4537a6){_0x1a7cd1['push'](_0x1a7cd1['shift']());}};_0x5553f6(++_0x22824d);}(_0xe485,0x114));var _0x5e48=function(_0x2e8651,_0x3da688){_0x2e8651=_0x2e8651-0x0;var _0x58949f=_0xe485[_0x2e8651];return _0x58949f;};'use strict';var multer=require(_0x5e48('0x0'));var util=require('util');var path=require(_0x5e48('0x1'));var timeout=require(_0x5e48('0x2'));var express=require(_0x5e48('0x3'));var router=express['Router']();var fs_extra=require(_0x5e48('0x4'));var auth=require(_0x5e48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e48('0x6'));var controller=require(_0x5e48('0x7'));router[_0x5e48('0x8')]('/',auth[_0x5e48('0x9')](),controller[_0x5e48('0xa')]);router['get']('/describe',auth[_0x5e48('0x9')](),controller['describe']);router[_0x5e48('0x8')]('/:id',auth[_0x5e48('0x9')](),controller[_0x5e48('0xb')]);router['get'](_0x5e48('0xc'),auth[_0x5e48('0x9')](),controller[_0x5e48('0xd')]);router[_0x5e48('0xe')]('/',auth[_0x5e48('0x9')](),controller[_0x5e48('0xf')]);router[_0x5e48('0xe')](_0x5e48('0xc'),auth[_0x5e48('0x9')](),controller[_0x5e48('0x10')]);router['put'](_0x5e48('0x11'),auth['isAuthenticated'](),controller[_0x5e48('0x12')]);router[_0x5e48('0x13')](_0x5e48('0x11'),auth[_0x5e48('0x9')](),controller[_0x5e48('0x14')]);module[_0x5e48('0x15')]=router; \ No newline at end of file +var _0x9870=['index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated'];(function(_0x4f53a6,_0x582ff5){var _0x30e4b7=function(_0x1aaf04){while(--_0x1aaf04){_0x4f53a6['push'](_0x4f53a6['shift']());}};_0x30e4b7(++_0x582ff5);}(_0x9870,0x16e));var _0x0987=function(_0x5a1a61,_0x44f3c0){_0x5a1a61=_0x5a1a61-0x0;var _0x4d6df0=_0x9870[_0x5a1a61];return _0x4d6df0;};'use strict';var multer=require(_0x0987('0x0'));var util=require(_0x0987('0x1'));var path=require(_0x0987('0x2'));var timeout=require(_0x0987('0x3'));var express=require(_0x0987('0x4'));var router=express[_0x0987('0x5')]();var fs_extra=require(_0x0987('0x6'));var auth=require(_0x0987('0x7'));var interaction=require(_0x0987('0x8'));var config=require('../../config/environment');var controller=require(_0x0987('0x9'));router[_0x0987('0xa')]('/',auth[_0x0987('0xb')](),controller[_0x0987('0xc')]);router[_0x0987('0xa')](_0x0987('0xd'),auth['isAuthenticated'](),controller[_0x0987('0xe')]);router[_0x0987('0xa')](_0x0987('0xf'),auth[_0x0987('0xb')](),controller[_0x0987('0x10')]);router[_0x0987('0xa')](_0x0987('0x11'),auth[_0x0987('0xb')](),controller[_0x0987('0x12')]);router[_0x0987('0x13')]('/',auth[_0x0987('0xb')](),controller[_0x0987('0x14')]);router['post']('/:id/contacts',auth[_0x0987('0xb')](),controller[_0x0987('0x15')]);router[_0x0987('0x16')]('/:id',auth[_0x0987('0xb')](),controller[_0x0987('0x17')]);router[_0x0987('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x0987('0x19')]);module[_0x0987('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cfa4a50..e8f52f9 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 _0xf4c5=['NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x18bc72,_0x1b2062){var _0x3db2c0=function(_0x2c6256){while(--_0x2c6256){_0x18bc72['push'](_0x18bc72['shift']());}};_0x3db2c0(++_0x1b2062);}(_0xf4c5,0x1a9));var _0x5f4c=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0xf4c5[_0x1e393b];return _0x3d0bfe;};'use strict';var _=require(_0x5f4c('0x0'));var Sequelize=require(_0x5f4c('0x1'));module[_0x5f4c('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5f4c('0x3')]},'street':{'type':Sequelize[_0x5f4c('0x3')]},'postalCode':{'type':Sequelize[_0x5f4c('0x3')]},'city':{'type':Sequelize[_0x5f4c('0x3')]},'country':{'type':Sequelize[_0x5f4c('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5f4c('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5f4c('0x3')]},'fax':{'type':Sequelize[_0x5f4c('0x3')]},'email':{'type':Sequelize[_0x5f4c('0x3')]},'url':{'type':Sequelize[_0x5f4c('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x5f4c('0x3')]},'twitter':{'type':Sequelize[_0x5f4c('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x5f4c('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5f4c('0x3')]},'telegram':{'type':Sequelize[_0x5f4c('0x3')]},'UserId':{'type':Sequelize[_0x5f4c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x5f4c('0x3')]},'priority':{'type':Sequelize[_0x5f4c('0x4')](0x2)[_0x5f4c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5f4c('0x6')],'defaultValue':Sequelize[_0x5f4c('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaeba=['DATE','NOW','INTEGER','lodash','exports','STRING','UNSIGNED'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xaeba,0x1a0));var _0xaaeb=function(_0x1553a2,_0x21b20a){_0x1553a2=_0x1553a2-0x0;var _0x1347bb=_0xaeba[_0x1553a2];return _0x1347bb;};'use strict';var _=require(_0xaaeb('0x0'));var Sequelize=require('sequelize');module[_0xaaeb('0x1')]={'firstName':{'type':Sequelize[_0xaaeb('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xaaeb('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xaaeb('0x2')]},'country':{'type':Sequelize[_0xaaeb('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xaaeb('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xaaeb('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xaaeb('0x2')]},'skype':{'type':Sequelize[_0xaaeb('0x2')]},'teams':{'type':Sequelize[_0xaaeb('0x2')]},'viber':{'type':Sequelize[_0xaaeb('0x2')]},'line':{'type':Sequelize[_0xaaeb('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xaaeb('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xaaeb('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xaaeb('0x4')],'defaultValue':Sequelize[_0xaaeb('0x5')]},'dialTimezone':{'type':Sequelize[_0xaaeb('0x2')]},'utcOffset':{'type':Sequelize[_0xaaeb('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2ebf5f7..37e3f9a 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 _0x3584=['error\x20child\x20process','binding','../../components/import/cm/csvUpdates','chat','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','callerid','starttime','endtime','duration','userSecondDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','Website','closedAt','note','disposition','secondDisposition','thirdDisposition','Account','Owner','color','customerIp','customerPort','deviceModel','osName','ratingType','subject','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','moment','bluebird','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','limit','undefined','count','set','update','then','destroy','status','sendStatus','error','stack','name','send','index','findAll','query','catch','CmContact','find','params','describe','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','alias','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','hasOwnProperty','contact','all','show','Tag','Tags','tag','Phones','ContactItemType','ItemType','sequelize','literal','$and','CmCustomField','omit','map','format','cf_%d','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','options','getTags','nolimit','setTags','findOne','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','pick','ContactId','include','rows','getHopperHistories','includeAll','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','child_process','File\x20uploaded\x20correctly!','pid','upload','parse','import','User','agent','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit'];(function(_0x5bd1b8,_0x120c0a){var _0x1e0a4a=function(_0x28340a){while(--_0x28340a){_0x5bd1b8['push'](_0x5bd1b8['shift']());}};_0x1e0a4a(++_0x120c0a);}(_0x3584,0x132));var _0x4358=function(_0x34e750,_0x2a812a){_0x34e750=_0x34e750-0x0;var _0x5cd8cd=_0x3584[_0x34e750];return _0x5cd8cd;};'use strict';var moment=require(_0x4358('0x0'));var BPromise=require(_0x4358('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x4358('0x2'));var Papa=require('papaparse');var Redis=require(_0x4358('0x3'));var contacts=require(_0x4358('0x4'));var qs=require(_0x4358('0x5'));var logger=require(_0x4358('0x6'))(_0x4358('0x7'));var config=require(_0x4358('0x8'));var shared=require(_0x4358('0x9'));var db=require(_0x4358('0xa'))['db'];config[_0x4358('0xb')]=_['defaults'](config[_0x4358('0xb')],{'host':_0x4358('0xc'),'port':0x18eb});var socket=require(_0x4358('0xd'))(new Redis(config['redis']));require(_0x4358('0xe'))[_0x4358('0xf')](socket);function respondWithResult(_0x78528f,_0x5f0a5f){_0x5f0a5f=_0x5f0a5f||0xc8;return function(_0x56f4a2){if(_0x56f4a2){return _0x78528f['status'](_0x5f0a5f)[_0x4358('0x10')](_0x56f4a2);}};}function respondWithFilteredResult(_0x3bc64e,_0x17d730){return function(_0x824892){if(_0x824892){var _0x110e40=typeof _0x17d730[_0x4358('0x11')]==='undefined'&&typeof _0x17d730[_0x4358('0x12')]===_0x4358('0x13');var _0x584d61=_0x824892[_0x4358('0x14')];var _0xe3e3c=_0x110e40?0x0:_0x17d730[_0x4358('0x11')];var _0x1e846f=_0x110e40?_0x824892['count']:_0x17d730[_0x4358('0x11')]+_0x17d730[_0x4358('0x12')];var _0x332069;if(_0x1e846f>=_0x584d61){_0x1e846f=_0x584d61;_0x332069=0xc8;}else{_0x332069=0xce;}_0x3bc64e['status'](_0x332069);return _0x3bc64e[_0x4358('0x15')]('Content-Range',_0xe3e3c+'-'+_0x1e846f+'/'+_0x584d61)[_0x4358('0x10')](_0x824892);}return null;};}function saveUpdates(_0x48c77c){return function(_0x374275){if(_0x374275){return _0x374275[_0x4358('0x16')](_0x48c77c)[_0x4358('0x17')](function(_0x129813){return _0x129813;});}return null;};}function removeEntity(_0x426e62){return function(_0x2c316e){if(_0x2c316e){return _0x2c316e[_0x4358('0x18')]()['then'](function(){_0x426e62[_0x4358('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7e5d){return function(_0x12a011){if(!_0x12a011){_0x1a7e5d[_0x4358('0x1a')](0x194);}return _0x12a011;};}function handleError(_0x8ec77b,_0x4fc848){_0x4fc848=_0x4fc848||0x1f4;return function(_0x23fbee){logger[_0x4358('0x1b')](_0x23fbee[_0x4358('0x1c')]);if(_0x23fbee[_0x4358('0x1d')]){delete _0x23fbee[_0x4358('0x1d')];}_0x8ec77b[_0x4358('0x19')](_0x4fc848)[_0x4358('0x1e')](_0x23fbee);};}exports[_0x4358('0x1f')]=function(_0x2d54d7,_0x30ca65){var _0x5831c5={};return contacts['describe']()['then'](function(_0xf6dc7d){_0x5831c5=qs['getOptions'](_0xf6dc7d,_0x2d54d7);return contacts[_0x4358('0x20')](_0x2d54d7[_0x4358('0x21')],_0x2d54d7['user'],_0x5831c5,_0xf6dc7d);})[_0x4358('0x17')](respondWithFilteredResult(_0x30ca65,_0x5831c5))[_0x4358('0x22')](handleError(_0x30ca65,null));};exports['destroy']=function(_0x480067,_0xa201ff){return db[_0x4358('0x23')][_0x4358('0x24')]({'where':{'id':_0x480067[_0x4358('0x25')]['id']}})['then'](handleEntityNotFound(_0xa201ff,null))['then'](removeEntity(_0xa201ff,null))[_0x4358('0x22')](handleError(_0xa201ff,null));};exports[_0x4358('0x26')]=function(_0x22ceb5,_0x46a6b7){return db[_0x4358('0x23')][_0x4358('0x26')]()[_0x4358('0x17')](function(_0xf9109b){delete _0xf9109b[_0x4358('0x27')];for(var _0xf52f98=0x0;_0xf52f980x0){return new Promise(function(_0x2ddb69){var _0x450d88=[];for(var _0xf8550f=0x0;_0xf8550f<_0x382c11['length'];_0xf8550f++){_0x450d88[_0x4358('0x5e')](insertAdditionalPhones(_0x382c11[_0xf8550f][_0x4358('0x62')],_0x382c11[_0xf8550f][_0x4358('0x58')]));}Promise[_0x4358('0x63')](_0x450d88)[_0x4358('0x17')](function(){_0x2ddb69(0x1);});})[_0x4358('0x17')](function(){return{'success':_0x2becd8,'failure':_0x120f74,'duplicates':_0xdde551};});}else{return{'success':_0x2becd8,'failure':_0x120f74,'duplicates':_0xdde551};}}})[_0x4358('0x17')](respondWithResult(_0x1eb661,0xc9))[_0x4358('0x22')](handleError(_0x1eb661,null));};exports[_0x4358('0x64')]=function(_0x27e2f9,_0x3e0478){var _0x17efe6;return db[_0x4358('0x23')][_0x4358('0x26')]()['then'](function(_0x1346bb){return db[_0x4358('0x23')][_0x4358('0x24')]({'where':{'id':_0x27e2f9['params']['id']},'include':[{'model':db[_0x4358('0x65')],'as':_0x4358('0x66'),'attributes':['id','name','color'],'required':_0x27e2f9[_0x4358('0x21')][_0x4358('0x67')]?!![]:![]},{'model':db[_0x4358('0x47')],'as':_0x4358('0x68'),'where':{'CmContactId':_0x27e2f9[_0x4358('0x25')]['id']},'required':![],'include':[{'model':db[_0x4358('0x69')],'as':_0x4358('0x6a')}]}],'order':[db[_0x4358('0x6b')][_0x4358('0x6c')]('Phones.OrderBy')],'attributes':_[_0x4358('0x28')](_0x1346bb)});})['then'](function(_0x2fe463){if(!_['isNil'](_0x2fe463)){_0x17efe6=_0x2fe463[_0x4358('0x36')]({'plain':!![]});var _0x3d269a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2fe463&&_0x2fe463[_0x4358('0x5f')]){if(_0x2fe463[_0x4358('0x5f')]){_0x3d269a['where'][_0x4358('0x6d')][_0x4358('0x5e')]({'ListId':{'$ne':_0x2fe463['ListId']}});}}return db[_0x4358('0x6e')][_0x4358('0x20')](_0x3d269a);}})[_0x4358('0x17')](function(_0x3442c9){if(!_[_0x4358('0x54')](_0x3442c9)){return _[_0x4358('0x6f')](_0x17efe6,_[_0x4358('0x70')](_0x3442c9,function(_0x29492d){return util[_0x4358('0x71')](_0x4358('0x72'),_0x29492d['id']);}));}})[_0x4358('0x17')](handleEntityNotFound(_0x3e0478,null))['then'](respondWithResult(_0x3e0478,null))[_0x4358('0x22')](handleError(_0x3e0478,null));};exports[_0x4358('0x16')]=function(_0x186be6,_0x54bd1c){var _0x16d0ef;if(_0x186be6[_0x4358('0x34')]['id']){delete _0x186be6[_0x4358('0x34')]['id'];}if(!_[_0x4358('0x54')](_0x186be6[_0x4358('0x34')]['dialTimezone'])){var _0x439f9a=_0x186be6[_0x4358('0x34')][_0x4358('0x55')];if(!_[_0x4358('0x54')](shared[_0x4358('0x56')][_0x439f9a]))_0x186be6[_0x4358('0x34')][_0x4358('0x57')]=shared['timezones'][_0x439f9a]['utcOffset'];}return db[_0x4358('0x23')][_0x4358('0x24')]({'where':{'id':_0x186be6[_0x4358('0x25')]['id']}})[_0x4358('0x17')](handleEntityNotFound(_0x54bd1c,null))[_0x4358('0x17')](saveUpdates(_0x186be6['body'],null))[_0x4358('0x17')](function(_0x49e454){_0x16d0ef=_0x49e454;var _0xfa3016={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x49e454&&_0x49e454['ListId']){if(_0x49e454[_0x4358('0x5f')]){_0xfa3016[_0x4358('0x5c')]['$and'][_0x4358('0x5e')]({'ListId':{'$ne':_0x49e454[_0x4358('0x5f')]}});}}return db[_0x4358('0x6e')][_0x4358('0x20')](_0xfa3016);})[_0x4358('0x17')](function(_0x3d4b87){if(_0x3d4b87){return _['omit'](_[_0x4358('0x73')](_0x186be6[_0x4358('0x34')],function(_0x39e2b1,_0x9c173f){return _[_0x4358('0x2a')](_0x9c173f,'cf_');}),_[_0x4358('0x70')](_0x3d4b87,function(_0x2e802f){return util[_0x4358('0x71')](_0x4358('0x72'),_0x2e802f['id']);}));}})['then'](function(_0x5e2f6){if(_0x5e2f6&&!_['isEmpty'](_0x5e2f6)){var _0x57ec1f=squel[_0x4358('0x16')]()[_0x4358('0x74')](_0x4358('0x75'))[_0x4358('0x76')](_0x5e2f6)['where'](_0x4358('0x77'),_0x186be6[_0x4358('0x25')]['id'])[_0x4358('0x78')]();return db['sequelize'][_0x4358('0x21')](_0x57ec1f[_0x4358('0x79')],{'replacements':_0x57ec1f[_0x4358('0x30')]});}})[_0x4358('0x17')](function(){if(_0x186be6[_0x4358('0x34')]['phone']&&_0x16d0ef){return db[_0x4358('0x3c')][_0x4358('0x16')]({'phone':_0x186be6['body'][_0x4358('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x16d0ef['id']}});}})[_0x4358('0x17')](function(){return _0x16d0ef;})['then'](respondWithResult(_0x54bd1c,null))[_0x4358('0x22')](handleError(_0x54bd1c,null));};exports['getTags']=function(_0x34e2b2,_0x23427c){var _0x4a5225={};var _0xcdf81a={};var _0x396a0f;var _0x3e8a8a;return db[_0x4358('0x23')]['findOne']({'where':{'id':_0x34e2b2['params']['id']}})[_0x4358('0x17')](handleEntityNotFound(_0x23427c,null))[_0x4358('0x17')](function(_0x299ae2){if(_0x299ae2){_0x396a0f=_0x299ae2;_0xcdf81a[_0x4358('0x7b')]=_[_0x4358('0x28')](db[_0x4358('0x65')][_0x4358('0x7c')]);_0xcdf81a[_0x4358('0x21')]=_['keys'](_0x34e2b2[_0x4358('0x21')]);_0xcdf81a[_0x4358('0x7d')]=_[_0x4358('0x7e')](_0xcdf81a[_0x4358('0x7b')],_0xcdf81a[_0x4358('0x21')]);_0x4a5225[_0x4358('0x7f')]=_['intersection'](_0xcdf81a[_0x4358('0x7b')],qs['fields'](_0x34e2b2['query'][_0x4358('0x80')]));_0x4a5225[_0x4358('0x7f')]=_0x4a5225[_0x4358('0x7f')][_0x4358('0x29')]?_0x4a5225['attributes']:_0xcdf81a[_0x4358('0x7b')];_0x4a5225[_0x4358('0x81')]=qs[_0x4358('0x82')](_0x34e2b2['query'][_0x4358('0x82')]);_0x4a5225['where']=qs[_0x4358('0x7d')](_['pick'](_0x34e2b2['query'],_0xcdf81a[_0x4358('0x7d')]));if(_0x34e2b2[_0x4358('0x21')][_0x4358('0x83')]){_0x4a5225['where']=_[_0x4358('0x33')](_0x4a5225[_0x4358('0x5c')],{'$or':_[_0x4358('0x70')](_0x4a5225[_0x4358('0x7f')],function(_0x29f1df){var _0xa9ed3d={};_0xa9ed3d[_0x29f1df]={'$like':'%'+_0x34e2b2['query']['filter']+'%'};return _0xa9ed3d;})});}_0x4a5225=_['merge']({},_0x4a5225,_0x34e2b2[_0x4358('0x84')]);return _0x396a0f[_0x4358('0x85')](_0x4a5225);}})[_0x4358('0x17')](function(_0x2ba9db){if(_0x2ba9db){_0x3e8a8a=_0x2ba9db[_0x4358('0x29')];if(!_0x34e2b2[_0x4358('0x21')][_0x4358('0x61')](_0x4358('0x86'))){_0x4a5225['limit']=qs['limit'](_0x34e2b2[_0x4358('0x21')][_0x4358('0x12')]);_0x4a5225[_0x4358('0x11')]=qs[_0x4358('0x11')](_0x34e2b2[_0x4358('0x21')][_0x4358('0x11')]);}return _0x396a0f[_0x4358('0x85')](_0x4a5225);}})[_0x4358('0x17')](function(_0x1259a4){if(_0x1259a4){return _0x1259a4?{'count':_0x3e8a8a,'rows':_0x1259a4}:null;}})[_0x4358('0x17')](respondWithResult(_0x23427c,null))[_0x4358('0x22')](handleError(_0x23427c,null));};exports[_0x4358('0x87')]=function(_0x3410cb,_0x1df056){if(_0x3410cb[_0x4358('0x34')]['id']){delete _0x3410cb[_0x4358('0x34')]['id'];}return db[_0x4358('0x23')][_0x4358('0x88')]({'where':{'id':_0x3410cb['params']['id']}})['then'](handleEntityNotFound(_0x1df056,null))[_0x4358('0x17')](function(_0x3aeec0){if(_0x3aeec0){return _0x3aeec0['setTags'](_0x3410cb[_0x4358('0x34')][_0x4358('0x89')]||[]);}return null;})[_0x4358('0x17')](respondWithResult(_0x1df056,null))[_0x4358('0x22')](handleError(_0x1df056,null));};exports['setAdditionalPhones']=function(_0x4194f6,_0x4e6a7b){var _0x3bc719=[];_0x3bc719[_0x4358('0x5e')](addAdditionalPhones(_0x4194f6[_0x4358('0x34')]));Promise['all'](_0x3bc719)[_0x4358('0x17')](function(){_0x3bc719=[];_0x3bc719[_0x4358('0x5e')](deleteCmHopperPhones(_0x4194f6['body']['id']));_0x3bc719['push'](addCmHopperPhones(_0x4194f6[_0x4358('0x34')]['id']));Promise[_0x4358('0x63')](_0x3bc719)['then'](function(){return[0x1];})[_0x4358('0x17')](respondWithResult(_0x4e6a7b,null));});};function addAdditionalPhones(_0x2f8f49){var _0x36ac04;return new Promise(function(_0x7eea50){return db[_0x4358('0x47')]['destroy']({'where':{'CmContactId':_0x2f8f49['id']}})['then'](function(){db[_0x4358('0x69')][_0x4358('0x20')]({'raw':!![],'attributes':['id',_0x4358('0x8a')]})[_0x4358('0x17')](function(_0xfcdc34){var _0x251e42=[];for(var _0x113174=0x0;_0x113174<_0x2f8f49[_0x4358('0x8b')][_0x4358('0x29')];_0x113174++){var _0x1cedc0=_0x2f8f49[_0x4358('0x8c')]?_[_0x4358('0x54')](_0x2f8f49[_0x4358('0x8c')][_0x113174])?'':_0x2f8f49[_0x4358('0x8c')][_0x113174]:_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x8d')]?_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x8d')]:'';var _0x107f53=_[_0x4358('0x54')](_0x2f8f49['items'][_0x113174][_0x4358('0x8e')])?'':_0x2f8f49[_0x4358('0x8b')][_0x113174]['description'];var _0x279735=_0x1cedc0+':'+_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x7a')]+'§'+_0x107f53;if(_[_0x4358('0x54')](_0x36ac04))_0x36ac04=_0x279735;else _0x36ac04+=';'+_0x279735;var _0x2220d2=null;var _0x427b6e=null;if(_0x2f8f49[_0x4358('0x8c')]){if(!_[_0x4358('0x54')](_0x2f8f49[_0x4358('0x8c')][_0x113174])){_0x427b6e=_['find'](_0xfcdc34,function(_0x538318){return _0x538318['id']===_0x2f8f49[_0x4358('0x8c')][_0x113174];});if(!_[_0x4358('0x54')](_0x427b6e)){_0x2220d2=_0x427b6e[_0x4358('0x8a')];}}}else{if(!_[_0x4358('0x54')](_0x2f8f49[_0x4358('0x8b')][_0x113174])){_0x427b6e=_['find'](_0xfcdc34,function(_0x3b0bab){return _0x3b0bab['id']===_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x8d')];});if(!_[_0x4358('0x54')](_0x427b6e)){_0x2220d2=_0x113174;}}}if(_[_0x4358('0x54')](_0x2220d2)){_0x2220d2=0x64;}_0x251e42[_0x4358('0x5e')](addAdditionalPhone(_0x2f8f49['id'],_0x2f8f49[_0x4358('0x8b')][_0x113174]['phone'],_0x2f8f49[_0x4358('0x8c')]?_[_0x4358('0x54')](_0x2f8f49['item_types'][_0x113174])?null:_0x2f8f49[_0x4358('0x8c')][_0x113174]:_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x8d')]?_0x2f8f49[_0x4358('0x8b')][_0x113174][_0x4358('0x8d')]:null,_0x2220d2,_0x107f53));}Promise[_0x4358('0x63')](_0x251e42)[_0x4358('0x17')](function(){db[_0x4358('0x23')][_0x4358('0x16')]({'AdditionalPhones':_0x36ac04},{'where':{'id':_0x2f8f49['id']}})[_0x4358('0x17')](function(){_0x7eea50(0x1);});});});});});}function addAdditionalPhone(_0x519c69,_0x572b5a,_0x6651bd,_0x148816,_0xb8ca02){return db['CmContactHasItem'][_0x4358('0x24')]({'where':{'CmContactId':_0x519c69,'item':_0x572b5a}})[_0x4358('0x17')](function(_0x43d8ad){if(_0x43d8ad)logger['info'](_0x4358('0x8f'),_0x43d8ad);else{db[_0x4358('0x47')]['create']({'CmContactId':_0x519c69,'item':_0x572b5a,'ItemTypeId':_0x6651bd,'OrderBy':_0x148816,'ItemClass':_0x4358('0x90'),'description':_0xb8ca02});}});}function deleteCmHopperPhones(_0x2de197){return new Promise(function(_0x26eb79){return db[_0x4358('0x3c')][_0x4358('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2de197}})[_0x4358('0x17')](function(_0x19b337){db[_0x4358('0x91')][_0x4358('0x18')]({'where':{'CmHopperId':{'$in':_['map'](_0x19b337,'id')}}});})['then'](function(){_0x26eb79(0x1);});});}function addCmHopperPhones(_0x56c813){return new Promise(function(_0x4fb05a){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x56c813}})[_0x4358('0x17')](function(_0x36a57c){var _0x36b80d=[];_[_0x4358('0x70')](_0x36a57c,function(_0xaefd06){_0x36b80d[_0x4358('0x5e')](createCmHopperPhone(_0x56c813,_0xaefd06['id']));});Promise[_0x4358('0x63')](_0x36b80d)[_0x4358('0x17')](function(){_0x4fb05a(0x1);});});});}function createCmHopperPhone(_0x3ec725,_0x380817){return new Promise(function(_0x5017e9){db[_0x4358('0x47')][_0x4358('0x20')]({'raw':!![],'attributes':[_0x4358('0x92'),'OrderBy'],'where':{'CmContactId':_0x3ec725,'ItemClass':_0x4358('0x90')},'include':[{'model':db[_0x4358('0x69')],'attributes':[_0x4358('0x8a')],'as':'ItemType'}],'order':[_0x4358('0x8a'),db[_0x4358('0x6b')][_0x4358('0x6c')]('`ItemType`.OrderBy')]})['then'](function(_0x3c0535){var _0x25971e=0x1;var _0x454164=_[_0x4358('0x70')](_0x3c0535,function(_0x5040db){_0x5040db['CmHopperId']=_0x380817;_0x5040db[_0x4358('0x7a')]=_0x5040db[_0x4358('0x92')];_0x5040db[_0x4358('0x8a')]=_0x25971e;delete _0x5040db[_0x4358('0x93')];_0x25971e=_0x25971e+0x1;return _0x5040db;});return db[_0x4358('0x91')][_0x4358('0x59')](_0x454164,{});})['then'](function(){_0x5017e9(0x1);});});}function insertAdditionalPhones(_0x4511c4,_0x10d942){return new Promise(function(_0x1229ac){var _0x428528=[];for(var _0xdd3937=0x0;_0xdd3937<_0x10d942[_0x4358('0x29')];_0xdd3937++){var _0x5a4681=_0x10d942[_0xdd3937];_0x428528[_0x4358('0x5e')](parseContactItemType(_0x5a4681));}Promise[_0x4358('0x63')](_0x428528)[_0x4358('0x17')](function(){var _0x4c24ca={'id':_0x4511c4['id'],'items':_0x10d942};return addAdditionalPhones(_0x4c24ca)[_0x4358('0x17')](function(){return addCmHopperPhones(_0x4511c4['id']);});})['then'](function(){_0x1229ac(_0x4511c4);});});}function parseContactItemType(_0x527227){return new Promise(function(_0x2fbb98){if(_0x527227['hasOwnProperty']('ItemTypeId')){_0x2fbb98(_0x527227);}else{return db[_0x4358('0x69')][_0x4358('0x24')]({'where':{'name':_0x527227['ItemType']}})[_0x4358('0x17')](function(_0x42afcf){if(_[_0x4358('0x54')](_0x42afcf))_0x527227['ItemTypeId']=null;else _0x527227[_0x4358('0x8d')]=_0x42afcf['id'];_0x2fbb98(_0x527227);});}});}exports[_0x4358('0x94')]=function(_0x591f5e,_0x5b854c){return db['CmContactHasItem'][_0x4358('0x20')]({'raw':!![],'where':{'CmContactId':_0x591f5e['params']['id'],'ItemClass':_0x4358('0x90')},'include':[{'model':db[_0x4358('0x69')],'as':_0x4358('0x6a')}],'order':[[_0x4358('0x8a')],[db['sequelize']['literal']('`ItemType`.OrderBy')]]})['then'](function(_0x720b7d){return _0x720b7d;})[_0x4358('0x17')](respondWithResult(_0x5b854c,null))[_0x4358('0x22')](handleError(_0x5b854c,null));};exports[_0x4358('0x95')]=function(_0x561182,_0x124222){return db[_0x4358('0x47')]['findAll']({'raw':!![],'where':{'CmContactId':_0x561182[_0x4358('0x34')][_0x4358('0x96')]}})['then'](function(_0x3d0134){var _0x3dac52=_[_0x4358('0x70')](_0x3d0134,function(_0x3cf786){_0x3cf786[_0x4358('0x97')]=_0x561182[_0x4358('0x34')][_0x4358('0x98')];return _0x3cf786;});return db[_0x4358('0x47')][_0x4358('0x59')](_0x3dac52,{});})[_0x4358('0x17')](function(){return addCmHopperPhones(_0x561182[_0x4358('0x34')]['toContactId']);})[_0x4358('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x124222,null))[_0x4358('0x22')](handleError(_0x124222,null));};exports[_0x4358('0x99')]=function(_0x593abf,_0x2d6317){var _0x177f1a=[];_0x177f1a['push'](createCmHopperPhone(_0x593abf[_0x4358('0x34')]['id'],_0x593abf['body']['hopperId']));Promise[_0x4358('0x63')](_0x177f1a)[_0x4358('0x17')](function(){return[0x1];})[_0x4358('0x17')](respondWithResult(_0x2d6317,null));};exports['getHoppers']=function(_0xa13a21,_0xdeb380){var _0x38c581={'raw':![],'where':{}};var _0x57a8ec={};var _0x415158={'count':0x0,'rows':[]};return db[_0x4358('0x23')][_0x4358('0x88')]({'where':{'id':_0xa13a21[_0x4358('0x25')]['id']}})[_0x4358('0x17')](handleEntityNotFound(_0xdeb380,null))[_0x4358('0x17')](function(_0x27f612){if(_0x27f612){_0x57a8ec[_0x4358('0x7b')]=_[_0x4358('0x28')](db[_0x4358('0x3c')]['rawAttributes']);_0x57a8ec[_0x4358('0x21')]=_[_0x4358('0x28')](_0xa13a21[_0x4358('0x21')]);_0x57a8ec[_0x4358('0x7d')]=_[_0x4358('0x7e')](_0x57a8ec['model'],_0x57a8ec[_0x4358('0x21')]);_0x38c581['attributes']=_['intersection'](_0x57a8ec['model'],qs[_0x4358('0x80')](_0xa13a21[_0x4358('0x21')]['fields']));_0x38c581[_0x4358('0x7f')]=_0x38c581[_0x4358('0x7f')]['length']?_0x38c581[_0x4358('0x7f')]:_0x57a8ec['model'];if(!_0xa13a21[_0x4358('0x21')][_0x4358('0x61')](_0x4358('0x86'))){_0x38c581[_0x4358('0x12')]=qs[_0x4358('0x12')](_0xa13a21['query'][_0x4358('0x12')]);_0x38c581[_0x4358('0x11')]=qs[_0x4358('0x11')](_0xa13a21['query'][_0x4358('0x11')]);}_0x38c581[_0x4358('0x81')]=qs['sort'](_0xa13a21[_0x4358('0x21')]['sort']);_0x38c581['where']=qs[_0x4358('0x7d')](_[_0x4358('0x9a')](_0xa13a21[_0x4358('0x21')],_0x57a8ec[_0x4358('0x7d')]));_0x38c581[_0x4358('0x5c')][_0x4358('0x9b')]=_0x27f612['id'];if(_0xa13a21['query'][_0x4358('0x83')]){_0x38c581['where']=_[_0x4358('0x33')](_0x38c581['where'],{'$or':_[_0x4358('0x70')](_0x38c581[_0x4358('0x7f')],function(_0x7874b5){var _0x3b2702={};_0x3b2702[_0x7874b5]={'$like':'%'+_0xa13a21[_0x4358('0x21')][_0x4358('0x83')]+'%'};return _0x3b2702;})});}_0x38c581=_[_0x4358('0x33')]({},_0x38c581,_0xa13a21[_0x4358('0x84')]);return db[_0x4358('0x3c')]['count']({'where':_0x38c581['where']})['then'](function(_0x57d278){_0x415158['count']=_0x57d278;if(_0xa13a21['query']['includeAll']){_0x38c581[_0x4358('0x9c')]=[{'all':!![]}];}return db[_0x4358('0x3c')]['findAll'](_0x38c581);})[_0x4358('0x17')](function(_0x452ab3){_0x415158[_0x4358('0x9d')]=_0x452ab3;return _0x415158;});}})[_0x4358('0x17')](respondWithFilteredResult(_0xdeb380,_0x38c581))['catch'](handleError(_0xdeb380,null));};exports[_0x4358('0x9e')]=function(_0x1dd795,_0xb1a618){var _0x330b09={'raw':!![],'where':{}};var _0x2c127b={};var _0x38e9d8={'count':0x0,'rows':[]};return db[_0x4358('0x23')]['findOne']({'where':{'id':_0x1dd795['params']['id']}})[_0x4358('0x17')](handleEntityNotFound(_0xb1a618,null))[_0x4358('0x17')](function(_0x4d40a9){if(_0x4d40a9){_0x2c127b[_0x4358('0x7b')]=_['keys'](db[_0x4358('0x49')]['rawAttributes']);_0x2c127b[_0x4358('0x21')]=_[_0x4358('0x28')](_0x1dd795[_0x4358('0x21')]);_0x2c127b[_0x4358('0x7d')]=_[_0x4358('0x7e')](_0x2c127b['model'],_0x2c127b[_0x4358('0x21')]);_0x330b09[_0x4358('0x7f')]=_[_0x4358('0x7e')](_0x2c127b['model'],qs['fields'](_0x1dd795[_0x4358('0x21')][_0x4358('0x80')]));_0x330b09[_0x4358('0x7f')]=_0x330b09[_0x4358('0x7f')]['length']?_0x330b09['attributes']:_0x2c127b['model'];if(!_0x1dd795[_0x4358('0x21')]['hasOwnProperty']('nolimit')){_0x330b09['limit']=qs[_0x4358('0x12')](_0x1dd795[_0x4358('0x21')][_0x4358('0x12')]);_0x330b09['offset']=qs[_0x4358('0x11')](_0x1dd795[_0x4358('0x21')][_0x4358('0x11')]);}_0x330b09[_0x4358('0x81')]=qs[_0x4358('0x82')](_0x1dd795['query'][_0x4358('0x82')]);_0x330b09[_0x4358('0x5c')]=qs[_0x4358('0x7d')](_[_0x4358('0x9a')](_0x1dd795[_0x4358('0x21')],_0x2c127b[_0x4358('0x7d')]));_0x330b09[_0x4358('0x5c')][_0x4358('0x9b')]=_0x4d40a9['id'];if(_0x1dd795[_0x4358('0x21')][_0x4358('0x83')]){_0x330b09['where']=_['merge'](_0x330b09[_0x4358('0x5c')],{'$or':_[_0x4358('0x70')](_0x330b09[_0x4358('0x7f')],function(_0x290562){var _0x2bb73a={};_0x2bb73a[_0x290562]={'$like':'%'+_0x1dd795[_0x4358('0x21')][_0x4358('0x83')]+'%'};return _0x2bb73a;})});}_0x330b09=_[_0x4358('0x33')]({},_0x330b09,_0x1dd795[_0x4358('0x84')]);return db['CmHopperHistory'][_0x4358('0x14')]({'where':_0x330b09['where']})[_0x4358('0x17')](function(_0xf982eb){_0x38e9d8['count']=_0xf982eb;if(_0x1dd795[_0x4358('0x21')][_0x4358('0x9f')]){_0x330b09[_0x4358('0x9c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4358('0x20')](_0x330b09);})[_0x4358('0x17')](function(_0x3aaff1){_0x38e9d8[_0x4358('0x9d')]=_0x3aaff1;return _0x38e9d8;});}})['then'](respondWithFilteredResult(_0xb1a618,_0x330b09))[_0x4358('0x22')](handleError(_0xb1a618,null));};exports['getHopperFinals']=function(_0x52c309,_0x58629c){var _0x26074c={'raw':!![],'where':{}};var _0x513da2={};var _0xa16b2d={'count':0x0,'rows':[]};return db[_0x4358('0x23')][_0x4358('0x88')]({'where':{'id':_0x52c309[_0x4358('0x25')]['id']}})[_0x4358('0x17')](handleEntityNotFound(_0x58629c,null))[_0x4358('0x17')](function(_0x43dc2b){if(_0x43dc2b){_0x513da2[_0x4358('0x7b')]=_[_0x4358('0x28')](db[_0x4358('0x48')]['rawAttributes']);_0x513da2[_0x4358('0x21')]=_[_0x4358('0x28')](_0x52c309['query']);_0x513da2['filters']=_[_0x4358('0x7e')](_0x513da2['model'],_0x513da2[_0x4358('0x21')]);_0x26074c['attributes']=_['intersection'](_0x513da2['model'],qs[_0x4358('0x80')](_0x52c309['query'][_0x4358('0x80')]));_0x26074c[_0x4358('0x7f')]=_0x26074c[_0x4358('0x7f')][_0x4358('0x29')]?_0x26074c[_0x4358('0x7f')]:_0x513da2[_0x4358('0x7b')];if(!_0x52c309[_0x4358('0x21')][_0x4358('0x61')](_0x4358('0x86'))){_0x26074c[_0x4358('0x12')]=qs[_0x4358('0x12')](_0x52c309[_0x4358('0x21')][_0x4358('0x12')]);_0x26074c['offset']=qs['offset'](_0x52c309['query']['offset']);}_0x26074c[_0x4358('0x81')]=qs[_0x4358('0x82')](_0x52c309[_0x4358('0x21')]['sort']);_0x26074c[_0x4358('0x5c')]=qs['filters'](_[_0x4358('0x9a')](_0x52c309[_0x4358('0x21')],_0x513da2['filters']));_0x26074c[_0x4358('0x5c')][_0x4358('0x9b')]=_0x43dc2b['id'];if(_0x52c309[_0x4358('0x21')][_0x4358('0x83')]){_0x26074c['where']=_[_0x4358('0x33')](_0x26074c[_0x4358('0x5c')],{'$or':_['map'](_0x26074c[_0x4358('0x7f')],function(_0x5bc1b3){var _0x3443ab={};_0x3443ab[_0x5bc1b3]={'$like':'%'+_0x52c309['query']['filter']+'%'};return _0x3443ab;})});}_0x26074c=_[_0x4358('0x33')]({},_0x26074c,_0x52c309[_0x4358('0x84')]);return db[_0x4358('0x48')][_0x4358('0x14')]({'where':_0x26074c[_0x4358('0x5c')]})[_0x4358('0x17')](function(_0x5e3466){_0xa16b2d[_0x4358('0x14')]=_0x5e3466;if(_0x52c309['query'][_0x4358('0x9f')]){_0x26074c[_0x4358('0x9c')]=[{'all':!![]}];}return db[_0x4358('0x48')]['findAll'](_0x26074c);})[_0x4358('0x17')](function(_0x13ecf7){_0xa16b2d[_0x4358('0x9d')]=_0x13ecf7;return _0xa16b2d;});}})[_0x4358('0x17')](respondWithFilteredResult(_0x58629c,_0x26074c))[_0x4358('0x22')](handleError(_0x58629c,null));};exports[_0x4358('0xa0')]=function(_0x3bee47,_0x1641a3){var _0x445017={'raw':!![],'where':{}};var _0x56079e={};var _0x5ece34={'count':0x0,'rows':[]};return db[_0x4358('0x23')][_0x4358('0x88')]({'where':{'id':_0x3bee47[_0x4358('0x25')]['id']}})[_0x4358('0x17')](handleEntityNotFound(_0x1641a3,null))[_0x4358('0x17')](function(_0x5d857e){if(_0x5d857e){_0x56079e['model']=_[_0x4358('0x28')](db[_0x4358('0x50')][_0x4358('0x7c')]);_0x56079e['query']=_[_0x4358('0x28')](_0x3bee47['query']);_0x56079e[_0x4358('0x7d')]=_[_0x4358('0x7e')](_0x56079e[_0x4358('0x7b')],_0x56079e['query']);_0x445017[_0x4358('0x7f')]=_[_0x4358('0x7e')](_0x56079e['model'],qs[_0x4358('0x80')](_0x3bee47['query']['fields']));_0x445017[_0x4358('0x7f')]=_0x445017['attributes'][_0x4358('0x29')]?_0x445017[_0x4358('0x7f')]:_0x56079e['model'];if(!_0x3bee47['query']['hasOwnProperty'](_0x4358('0x86'))){_0x445017[_0x4358('0x12')]=qs[_0x4358('0x12')](_0x3bee47[_0x4358('0x21')]['limit']);_0x445017[_0x4358('0x11')]=qs[_0x4358('0x11')](_0x3bee47[_0x4358('0x21')][_0x4358('0x11')]);}_0x445017['order']=qs[_0x4358('0x82')](_0x3bee47[_0x4358('0x21')][_0x4358('0x82')]);_0x445017['where']=qs[_0x4358('0x7d')](_[_0x4358('0x9a')](_0x3bee47[_0x4358('0x21')],_0x56079e['filters']));_0x445017[_0x4358('0x5c')][_0x4358('0x9b')]=_0x5d857e['id'];if(_0x3bee47['query']['filter']){_0x445017['where']=_[_0x4358('0x33')](_0x445017[_0x4358('0x5c')],{'$or':_[_0x4358('0x70')](_0x445017['attributes'],function(_0x4b56d0){var _0x188c4a={};_0x188c4a[_0x4b56d0]={'$like':'%'+_0x3bee47[_0x4358('0x21')][_0x4358('0x83')]+'%'};return _0x188c4a;})});}_0x445017=_['merge']({},_0x445017,_0x3bee47[_0x4358('0x84')]);return db[_0x4358('0x50')][_0x4358('0x14')]({'where':_0x445017['where']})[_0x4358('0x17')](function(_0x12392b){_0x5ece34[_0x4358('0x14')]=_0x12392b;if(_0x3bee47['query'][_0x4358('0x9f')]){_0x445017[_0x4358('0x9c')]=[{'all':!![]}];}return db[_0x4358('0x50')]['findAll'](_0x445017);})['then'](function(_0x14de5e){_0x5ece34[_0x4358('0x9d')]=_0x14de5e;return _0x5ece34;});}})[_0x4358('0x17')](respondWithFilteredResult(_0x1641a3,_0x445017))[_0x4358('0x22')](handleError(_0x1641a3,null));};exports['uploadCsv']=function(_0x5474e6,_0x444e61){try{if(!_0x5474e6[_0x4358('0x34')]['ListId']){throw new Error(_0x4358('0xa1'));}if(!_0x5474e6['body'][_0x4358('0xa2')]){throw new Error(_0x4358('0xa3'));}if(!_0x5474e6['body'][_0x4358('0xa4')]){throw new Error(_0x4358('0xa5'));}if(!_0x5474e6['body'][_0x4358('0xa6')]){throw new Error(_0x4358('0xa7'));}var _0x31b0ca=_0x5474e6['body'][_0x4358('0xa2')][_0x4358('0xa8')](',');var _0x3f358c=_0x5474e6[_0x4358('0x34')]['binding_values'][_0x4358('0xa8')](',');if(!_0x31b0ca[_0x4358('0x29')]||!_0x3f358c[_0x4358('0x29')]||_0x31b0ca[_0x4358('0x29')]!==_0x3f358c[_0x4358('0x29')]){throw new Error(_0x4358('0xa9'));}_0x5474e6[_0x4358('0x34')][_0x4358('0x80')]=_[_0x4358('0xaa')](_0x31b0ca,_0x3f358c);if(!_0x5474e6[_0x4358('0x34')][_0x4358('0x80')][_0x4358('0x7a')]){throw new Error(_0x4358('0xab'));}if(!_0x5474e6['body'][_0x4358('0x80')][_0x4358('0xac')]){throw new Error(_0x4358('0xad'));}var _0x4b3742=path[_0x4358('0x39')](config[_0x4358('0xae')],'server/files/tmp',_0x5474e6[_0x4358('0xaf')][_0x4358('0xb0')]);fs[_0x4358('0xb1')](_0x4b3742,parseInt('0777',0x8));var _0x1c73ec=require(_0x4358('0xb2'))['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x4b3742,_0x5474e6[_0x4358('0x34')]['binding_keys'],_0x5474e6[_0x4358('0x34')]['binding_values'],_0x5474e6['body'][_0x4358('0x5f')],_0x5474e6['body']['CompanyId'],_0x5474e6[_0x4358('0x34')][_0x4358('0x5b')],_0x5474e6['body']['socket_timestamp']]);return _0x444e61['status'](0xc8)[_0x4358('0x10')]({'message':_0x4358('0xb3'),'pid':_0x1c73ec[_0x4358('0xb4')]});}catch(_0x1cea87){return _0x444e61[_0x4358('0x19')](0x1f4)[_0x4358('0x1e')](_0x1cea87);}};exports[_0x4358('0xb5')]=function(_0x58afb3,_0xa43f13){var _0x70120d=fs['createReadStream'](_0x58afb3['file']['path']);Papa[_0x4358('0xb6')](_0x70120d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xff8b7){return _0xa43f13[_0x4358('0x19')](0xc8)[_0x4358('0x10')]({'file':_0x58afb3[_0x4358('0xaf')],'fields':_0xff8b7['meta'][_0x4358('0x80')]});}});};exports[_0x4358('0xb7')]=function(_0x57655f,_0x4c2da){return db[_0x4358('0xb8')][_0x4358('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x4358('0xb9')}})[_0x4358('0x17')](function(_0x56ba90){var _0x48f3b5=![];if(!_0x57655f['body']['ListId']){throw new Error(_0x4358('0xa1'));}if(!_0x57655f[_0x4358('0x34')]['binding'][_0x4358('0x7a')]){throw new Error(_0x4358('0xab'));}if(!_0x57655f[_0x4358('0x34')]['binding'][_0x4358('0xac')]){throw new Error(_0x4358('0xad'));}if(!_0x57655f[_0x4358('0x34')][_0x4358('0xa6')]){throw new Error(_0x4358('0xa7'));}var _0x87db5=require(_0x4358('0xb2'))[_0x4358('0xba')](path[_0x4358('0x39')](__dirname,_0x4358('0xbb')),[_0x57655f[_0x4358('0x25')]['id'],JSON[_0x4358('0xbc')](_0x57655f[_0x4358('0x34')]),JSON['stringify'](_0x56ba90)]);_0x87db5['on'](_0x4358('0xbd'),function(){_0x48f3b5=!![];return _0x4c2da[_0x4358('0x19')](0xc8)['json']({'message':_0x4358('0xbe'),'pid':_0x87db5[_0x4358('0xb4')]});});_0x87db5['on'](_0x4358('0xbf'),function(_0x168836){if(_0x168836&&!_0x48f3b5){return _0x4c2da['status'](0x1f4)['json']({'message':_0x4358('0xc0'),'pid':_0x87db5['pid']});}});})[_0x4358('0x22')](handleError(_0x4c2da,null));};exports['importUpdates']=function(_0x3c3289,_0x35935c){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x4358('0x17')](function(_0x411e5a){var _0x4e6f54=![];if(!_0x3c3289[_0x4358('0x34')][_0x4358('0x5f')]){throw new Error(_0x4358('0xa1'));}if(!_0x3c3289[_0x4358('0x34')][_0x4358('0xc1')][_0x4358('0x7a')]){throw new Error(_0x4358('0xab'));}if(!_0x3c3289[_0x4358('0x34')][_0x4358('0xc1')][_0x4358('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x3c3289[_0x4358('0x34')][_0x4358('0xa6')]){throw new Error(_0x4358('0xa7'));}var _0x1221fa=require(_0x4358('0xb2'))[_0x4358('0xba')](path[_0x4358('0x39')](__dirname,_0x4358('0xc2')),[_0x3c3289[_0x4358('0x25')]['id'],JSON[_0x4358('0xbc')](_0x3c3289['body']),JSON[_0x4358('0xbc')](_0x411e5a)]);_0x1221fa['on'](_0x4358('0xbd'),function(){_0x4e6f54=!![];return _0x35935c[_0x4358('0x19')](0xc8)[_0x4358('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1221fa[_0x4358('0xb4')]});});_0x1221fa['on'](_0x4358('0xbf'),function(_0x3f2807){if(_0x3f2807&&!_0x4e6f54){return _0x35935c[_0x4358('0x19')](0x1f4)['json']({'message':_0x4358('0xc0'),'pid':_0x1221fa['pid']});}});})[_0x4358('0x22')](handleError(_0x35935c,null));};exports['getJourney']=function(_0x3b8699,_0x268111){var _0x156f4f=['mail',_0x4358('0xc3'),'sms',_0x4358('0xc4'),_0x4358('0xc5'),_0x4358('0xc6'),_0x4358('0xc7')];var _0x42925d={'offset':0x0,'order':qs[_0x4358('0x82')](_0x4358('0xc8'))},_0x3a5c10={'count':0x0,'rows':[]};Promise[_0x4358('0xc9')]()[_0x4358('0x17')](function(){if(_0x3b8699[_0x4358('0x21')][_0x4358('0xca')]){if(!_[_0x4358('0xcb')](_0x156f4f,_0x3b8699[_0x4358('0x21')][_0x4358('0xca')][_0x4358('0xcc')]())){throw new Error(_0x4358('0xcd'));}_0x156f4f=[_0x3b8699[_0x4358('0x21')][_0x4358('0xca')][_0x4358('0xcc')]()];}if(_0x3b8699[_0x4358('0x21')][_0x4358('0xce')]){try{var _0x2b8f50=JSON[_0x4358('0xb6')](_0x3b8699[_0x4358('0x21')][_0x4358('0xce')]);if(!moment(_0x2b8f50[_0x4358('0x35')])[_0x4358('0xcf')]()){throw new Error(_0x4358('0xd0'));}if(!moment(_0x2b8f50['to'])['isValid']()){throw new Error(_0x4358('0xd1'));}}catch(_0x522f55){throw new Error(_0x4358('0xd2'));}}if(!_0x3b8699[_0x4358('0x21')][_0x4358('0x61')]('nolimit')){_0x42925d[_0x4358('0x12')]=qs[_0x4358('0x12')](_0x3b8699[_0x4358('0x21')][_0x4358('0x12')]||0xa);_0x42925d['offset']=qs[_0x4358('0x11')](_0x3b8699['query'][_0x4358('0x11')]);}var _0x2f72e4=_0x156f4f[_0x4358('0x70')](function(_0x3b6751){if(_0x3b6751===_0x4358('0xc7')){var _0x16e740={'attributes':['id',_0x4358('0xd3'),_0x4358('0xd4'),_0x4358('0xd5'),_0x4358('0xd6'),_0x4358('0xd7'),_0x4358('0xd8'),_0x4358('0xd9'),_0x4358('0xda'),'note','createdAt','userDisposition',_0x4358('0xdb'),_0x4358('0xdc'),_0x4358('0xdd')],'where':{'ContactId':_0x3b8699[_0x4358('0x25')]['id']},'include':[{'model':db[_0x4358('0xb8')],'as':_0x4358('0xb8'),'attributes':['id',_0x4358('0x1d'),'fullname','alias']}],'order':[[_0x4358('0xde'),_0x4358('0xdf')]]};if(_0x3b8699[_0x4358('0x21')]['range']){_0x16e740[_0x4358('0x5c')]['createdAt']={'$gte':_0x2b8f50[_0x4358('0x35')],'$lte':_0x2b8f50['to']};}return db['VoiceCallReport'][_0x4358('0xe0')](_0x16e740)['then'](function(_0x106b7f){_0x3a5c10[_0x4358('0x14')]+=_0x106b7f[_0x4358('0x14')];return _[_0x4358('0x70')](_0x106b7f[_0x4358('0x9d')],function(_0x2f70f3){var _0x508f79=_0x2f70f3[_0x4358('0x36')]({'plain':!![]});_0x508f79[_0x4358('0xca')]=_0x3b6751;if(_0x508f79[_0x4358('0xb8')]){_0x508f79[_0x4358('0xb8')]={'id':_0x508f79['User']['id'],'name':_0x508f79[_0x4358('0xb8')]['name'],'fullname':_0x508f79[_0x4358('0xb8')][_0x4358('0xe1')],'alias':_0x508f79[_0x4358('0xb8')]['alias']};}return _0x508f79;});});}else{var _0x33edca=_['startCase'](_0x3b6751)+(_0x3b6751===_0x4358('0xc3')?_0x4358('0xe2'):'Account');var _0x401147={'attributes':['id','closed',_0x4358('0xe3'),_0x4358('0xde'),_0x4358('0xe4'),_0x4358('0xe5'),_0x4358('0xe6'),_0x4358('0xe7'),_0x4358('0xdd'),_0x33edca+'Id'],'where':{'ContactId':_0x3b8699[_0x4358('0x25')]['id']},'include':[{'model':db[_0x33edca],'as':_0x4358('0xe8'),'attributes':['id','name','key']},{'model':db['User'],'as':_0x4358('0xe9'),'attributes':['id','name',_0x4358('0xe1')]},{'model':db[_0x4358('0x65')],'as':_0x4358('0x66'),'attributes':['id',_0x4358('0x1d'),_0x4358('0xea')],'through':{'attributes':[]}}],'order':[[_0x4358('0xde'),_0x4358('0xdf')]]};if(_0x3b8699[_0x4358('0x21')][_0x4358('0xce')]){_0x401147['where'][_0x4358('0xde')]={'$gte':_0x2b8f50[_0x4358('0x35')],'$lte':_0x2b8f50['to']};}switch(_0x3b6751){case _0x4358('0xc3'):_0x401147[_0x4358('0x7f')]['push']('browserName',_0x4358('0xeb'),_0x4358('0xec'),_0x4358('0xed'),_0x4358('0xee'),'ratingMessage',_0x4358('0xef'),'ratingValue','referer');break;case'mail':_0x401147[_0x4358('0x7f')]['push'](_0x4358('0xf0'),_0x4358('0xf1'));break;case _0x4358('0xc4'):_0x401147[_0x4358('0x7f')][_0x4358('0x5e')](_0x4358('0xf2'),_0x4358('0xf3'));break;}return db[_[_0x4358('0xf4')](_0x3b6751)+_0x4358('0xf5')][_0x4358('0xe0')](_0x401147)[_0x4358('0x17')](function(_0x44a4b1){_0x3a5c10[_0x4358('0x14')]+=_0x44a4b1['count'];return _[_0x4358('0x70')](_0x44a4b1['rows'],function(_0x55ef4f){var _0x48993f=_0x55ef4f[_0x4358('0x36')]({'plain':!![]});_0x48993f[_0x4358('0xca')]=_0x3b6751;if(_0x48993f[_0x4358('0xe9')]){_0x48993f[_0x4358('0xe9')]={'id':_0x48993f[_0x4358('0xe9')]['id'],'name':_0x48993f[_0x4358('0xe9')]['name'],'fullname':_0x48993f['Owner'][_0x4358('0xe1')]};}return _0x48993f;});});}});return Promise[_0x4358('0x63')](_0x2f72e4);})[_0x4358('0x17')](function(_0x5409cb){return _(_0x5409cb)[_0x4358('0xf6')]()[_0x4358('0xf7')](_0x4358('0xde'))[_0x4358('0xf8')]()['value']();})['then'](function(_0x2ed6a0){_0x3a5c10[_0x4358('0x9d')]=_0x42925d[_0x4358('0x12')]?_0x2ed6a0['slice'](_0x42925d[_0x4358('0x11')],_0x42925d[_0x4358('0x11')]+_0x42925d[_0x4358('0x12')]):_0x2ed6a0;return _0x3a5c10;})['then'](respondWithFilteredResult(_0x268111,_0x42925d))[_0x4358('0x22')](handleError(_0x268111,null));}; \ No newline at end of file +var _0x980e=['body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','params','Tag','Tags','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','omit','map','format','cf_%d','cm_contacts','setFields','toParam','text','phone','getTags','model','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','filters','ContactId','includeAll','include','rows','CmHopperHistory','rawAttributes','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','path','file','meta','import','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','User','start\x20child\x20process\x20correctly!','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','findAndCountAll','startCase','Account','closedAt','disposition','thirdDisposition','Owner','fullname','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','substatus','externalUrl','Interaction','flatten','reverse','value','slice','moment','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','set','json','update','then','end','error','stack','name','send','index','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','tags','length','keys','startsWith','cf_','columnName','displayName','analytics','CmCustomField','custom','type','values','info','forEach','hasOwnProperty','merge'];(function(_0x2a3e7c,_0x43d6a4){var _0x1318a7=function(_0x48829d){while(--_0x48829d){_0x2a3e7c['push'](_0x2a3e7c['shift']());}};_0x1318a7(++_0x43d6a4);}(_0x980e,0x1bf));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xe980('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe980('0x1'));var squel=require(_0xe980('0x2'));var Papa=require(_0xe980('0x3'));var Redis=require(_0xe980('0x4'));var contacts=require(_0xe980('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xe980('0x6'))(_0xe980('0x7'));var config=require(_0xe980('0x8'));var shared=require(_0xe980('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe980('0xa')](config[_0xe980('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe980('0xc'))(new Redis(config[_0xe980('0xb')]));require(_0xe980('0xd'))[_0xe980('0xe')](socket);function respondWithResult(_0x1a39d5,_0x3a37de){_0x3a37de=_0x3a37de||0xc8;return function(_0xab10e9){if(_0xab10e9){return _0x1a39d5[_0xe980('0xf')](_0x3a37de)['json'](_0xab10e9);}};}function respondWithFilteredResult(_0x156a6a,_0x266b16){return function(_0x2db687){if(_0x2db687){var _0x51e09e=typeof _0x266b16[_0xe980('0x10')]===_0xe980('0x11')&&typeof _0x266b16[_0xe980('0x12')]===_0xe980('0x11');var _0xc646c5=_0x2db687[_0xe980('0x13')];var _0x374b66=_0x51e09e?0x0:_0x266b16[_0xe980('0x10')];var _0x470cf7=_0x51e09e?_0x2db687['count']:_0x266b16[_0xe980('0x10')]+_0x266b16[_0xe980('0x12')];var _0x3c67b5;if(_0x470cf7>=_0xc646c5){_0x470cf7=_0xc646c5;_0x3c67b5=0xc8;}else{_0x3c67b5=0xce;}_0x156a6a[_0xe980('0xf')](_0x3c67b5);return _0x156a6a[_0xe980('0x14')]('Content-Range',_0x374b66+'-'+_0x470cf7+'/'+_0xc646c5)[_0xe980('0x15')](_0x2db687);}return null;};}function saveUpdates(_0xc9abe3){return function(_0x509d38){if(_0x509d38){return _0x509d38[_0xe980('0x16')](_0xc9abe3)['then'](function(_0x53e28f){return _0x53e28f;});}return null;};}function removeEntity(_0x2ebf91){return function(_0x140277){if(_0x140277){return _0x140277['destroy']()[_0xe980('0x17')](function(){_0x2ebf91[_0xe980('0xf')](0xcc)[_0xe980('0x18')]();});}};}function handleEntityNotFound(_0x30657a){return function(_0x1abad6){if(!_0x1abad6){_0x30657a['sendStatus'](0x194);}return _0x1abad6;};}function handleError(_0x113d74,_0xc5a610){_0xc5a610=_0xc5a610||0x1f4;return function(_0x1f9f2d){logger[_0xe980('0x19')](_0x1f9f2d[_0xe980('0x1a')]);if(_0x1f9f2d['name']){delete _0x1f9f2d[_0xe980('0x1b')];}_0x113d74[_0xe980('0xf')](_0xc5a610)[_0xe980('0x1c')](_0x1f9f2d);};}exports[_0xe980('0x1d')]=function(_0x1bb302,_0x2ac130){var _0x47f116={};return contacts[_0xe980('0x1e')]()[_0xe980('0x17')](function(_0x465085){_0x47f116=qs[_0xe980('0x1f')](_0x465085,_0x1bb302);return contacts[_0xe980('0x20')](_0x1bb302[_0xe980('0x21')],_0x1bb302[_0xe980('0x22')],_0x47f116,_0x465085);})[_0xe980('0x17')](respondWithFilteredResult(_0x2ac130,_0x47f116))[_0xe980('0x23')](handleError(_0x2ac130,null));};exports[_0xe980('0x24')]=function(_0xf306f3,_0x450f42){return db[_0xe980('0x25')][_0xe980('0x26')]({'where':{'id':_0xf306f3['params']['id']}})['then'](handleEntityNotFound(_0x450f42,null))[_0xe980('0x17')](removeEntity(_0x450f42,null))[_0xe980('0x23')](handleError(_0x450f42,null));};exports[_0xe980('0x1e')]=function(_0x4e3441,_0x352c43){return db['CmContact']['describe']()[_0xe980('0x17')](function(_0xf1a751){delete _0xf1a751[_0xe980('0x27')];for(var _0x2ddf91=0x0;_0x2ddf910x0){return new Promise(function(_0x2bdc1d){var _0x2fb464=[];for(var _0x7daa0d=0x0;_0x7daa0d<_0x1a8da2[_0xe980('0x28')];_0x7daa0d++){_0x2fb464[_0xe980('0x5e')](insertAdditionalPhones(_0x1a8da2[_0x7daa0d][_0xe980('0x62')],_0x1a8da2[_0x7daa0d][_0xe980('0x58')]));}Promise[_0xe980('0x63')](_0x2fb464)[_0xe980('0x17')](function(){_0x2bdc1d(0x1);});})[_0xe980('0x17')](function(){return{'success':_0x399b13,'failure':_0x3ddeab,'duplicates':_0x3bf16a};});}else{return{'success':_0x399b13,'failure':_0x3ddeab,'duplicates':_0x3bf16a};}}})[_0xe980('0x17')](respondWithResult(_0x1ab0bb,0xc9))['catch'](handleError(_0x1ab0bb,null));};exports[_0xe980('0x64')]=function(_0x7d06c8,_0x1be77f){var _0x414148;return db[_0xe980('0x25')][_0xe980('0x1e')]()['then'](function(_0x4540f2){return db[_0xe980('0x25')]['find']({'where':{'id':_0x7d06c8[_0xe980('0x65')]['id']},'include':[{'model':db[_0xe980('0x66')],'as':_0xe980('0x67'),'attributes':['id',_0xe980('0x1b'),'color'],'required':_0x7d06c8[_0xe980('0x21')][_0xe980('0x68')]?!![]:![]},{'model':db[_0xe980('0x4b')],'as':'Phones','where':{'CmContactId':_0x7d06c8[_0xe980('0x65')]['id']},'required':![],'include':[{'model':db[_0xe980('0x69')],'as':_0xe980('0x6a')}]}],'order':[db[_0xe980('0x6b')][_0xe980('0x6c')](_0xe980('0x6d'))],'attributes':_[_0xe980('0x29')](_0x4540f2)});})[_0xe980('0x17')](function(_0x9dbea8){if(!_[_0xe980('0x54')](_0x9dbea8)){_0x414148=_0x9dbea8[_0xe980('0x39')]({'plain':!![]});var _0x114499={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x9dbea8&&_0x9dbea8['ListId']){if(_0x9dbea8[_0xe980('0x5f')]){_0x114499['where']['$and'][_0xe980('0x5e')]({'ListId':{'$ne':_0x9dbea8[_0xe980('0x5f')]}});}}return db[_0xe980('0x2f')][_0xe980('0x20')](_0x114499);}})[_0xe980('0x17')](function(_0x3e6137){if(!_['isNil'](_0x3e6137)){return _[_0xe980('0x6e')](_0x414148,_[_0xe980('0x6f')](_0x3e6137,function(_0x5a4d55){return util[_0xe980('0x70')](_0xe980('0x71'),_0x5a4d55['id']);}));}})[_0xe980('0x17')](handleEntityNotFound(_0x1be77f,null))[_0xe980('0x17')](respondWithResult(_0x1be77f,null))[_0xe980('0x23')](handleError(_0x1be77f,null));};exports[_0xe980('0x16')]=function(_0x22b81c,_0x4eab50){var _0x2c4658;if(_0x22b81c[_0xe980('0x37')]['id']){delete _0x22b81c[_0xe980('0x37')]['id'];}if(!_['isNil'](_0x22b81c[_0xe980('0x37')]['dialTimezone'])){var _0x20dc6d=_0x22b81c[_0xe980('0x37')][_0xe980('0x55')];if(!_[_0xe980('0x54')](shared['timezones'][_0x20dc6d]))_0x22b81c[_0xe980('0x37')][_0xe980('0x57')]=shared[_0xe980('0x56')][_0x20dc6d][_0xe980('0x57')];}return db[_0xe980('0x25')][_0xe980('0x26')]({'where':{'id':_0x22b81c['params']['id']}})['then'](handleEntityNotFound(_0x4eab50,null))[_0xe980('0x17')](saveUpdates(_0x22b81c[_0xe980('0x37')],null))[_0xe980('0x17')](function(_0x4fb8a3){_0x2c4658=_0x4fb8a3;var _0x22319c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4fb8a3&&_0x4fb8a3[_0xe980('0x5f')]){if(_0x4fb8a3['ListId']){_0x22319c[_0xe980('0x5c')]['$and'][_0xe980('0x5e')]({'ListId':{'$ne':_0x4fb8a3[_0xe980('0x5f')]}});}}return db[_0xe980('0x2f')][_0xe980('0x20')](_0x22319c);})[_0xe980('0x17')](function(_0x3b4b2d){if(_0x3b4b2d){return _[_0xe980('0x6e')](_['pickBy'](_0x22b81c[_0xe980('0x37')],function(_0x39f448,_0x59a2dd){return _[_0xe980('0x2a')](_0x59a2dd,'cf_');}),_[_0xe980('0x6f')](_0x3b4b2d,function(_0x48bd4f){return util[_0xe980('0x70')](_0xe980('0x71'),_0x48bd4f['id']);}));}})[_0xe980('0x17')](function(_0x449d04){if(_0x449d04&&!_['isEmpty'](_0x449d04)){var _0x545a1e=squel[_0xe980('0x16')]()['table'](_0xe980('0x72'))[_0xe980('0x73')](_0x449d04)['where']('id\x20=\x20?',_0x22b81c['params']['id'])[_0xe980('0x74')]();return db[_0xe980('0x6b')][_0xe980('0x21')](_0x545a1e[_0xe980('0x75')],{'replacements':_0x545a1e['values']});}})[_0xe980('0x17')](function(){if(_0x22b81c[_0xe980('0x37')][_0xe980('0x76')]&&_0x2c4658){return db[_0xe980('0x3e')][_0xe980('0x16')]({'phone':_0x22b81c[_0xe980('0x37')][_0xe980('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x2c4658['id']}});}})[_0xe980('0x17')](function(){return _0x2c4658;})[_0xe980('0x17')](respondWithResult(_0x4eab50,null))[_0xe980('0x23')](handleError(_0x4eab50,null));};exports[_0xe980('0x77')]=function(_0x59f828,_0x77b055){var _0x3c33d5={};var _0x2323c7={};var _0x24d409;var _0x1e0836;return db[_0xe980('0x25')]['findOne']({'where':{'id':_0x59f828[_0xe980('0x65')]['id']}})[_0xe980('0x17')](handleEntityNotFound(_0x77b055,null))[_0xe980('0x17')](function(_0x28b0c2){if(_0x28b0c2){_0x24d409=_0x28b0c2;_0x2323c7[_0xe980('0x78')]=_['keys'](db[_0xe980('0x66')]['rawAttributes']);_0x2323c7[_0xe980('0x21')]=_['keys'](_0x59f828[_0xe980('0x21')]);_0x2323c7['filters']=_[_0xe980('0x79')](_0x2323c7['model'],_0x2323c7[_0xe980('0x21')]);_0x3c33d5[_0xe980('0x7a')]=_[_0xe980('0x79')](_0x2323c7[_0xe980('0x78')],qs[_0xe980('0x7b')](_0x59f828['query'][_0xe980('0x7b')]));_0x3c33d5['attributes']=_0x3c33d5[_0xe980('0x7a')][_0xe980('0x28')]?_0x3c33d5[_0xe980('0x7a')]:_0x2323c7[_0xe980('0x78')];_0x3c33d5[_0xe980('0x7c')]=qs[_0xe980('0x7d')](_0x59f828[_0xe980('0x21')][_0xe980('0x7d')]);_0x3c33d5['where']=qs['filters'](_[_0xe980('0x7e')](_0x59f828['query'],_0x2323c7['filters']));if(_0x59f828[_0xe980('0x21')][_0xe980('0x7f')]){_0x3c33d5[_0xe980('0x5c')]=_[_0xe980('0x36')](_0x3c33d5[_0xe980('0x5c')],{'$or':_[_0xe980('0x6f')](_0x3c33d5[_0xe980('0x7a')],function(_0x537686){var _0x315fe0={};_0x315fe0[_0x537686]={'$like':'%'+_0x59f828[_0xe980('0x21')][_0xe980('0x7f')]+'%'};return _0x315fe0;})});}_0x3c33d5=_['merge']({},_0x3c33d5,_0x59f828[_0xe980('0x80')]);return _0x24d409['getTags'](_0x3c33d5);}})['then'](function(_0x35d296){if(_0x35d296){_0x1e0836=_0x35d296[_0xe980('0x28')];if(!_0x59f828['query'][_0xe980('0x35')](_0xe980('0x81'))){_0x3c33d5['limit']=qs[_0xe980('0x12')](_0x59f828[_0xe980('0x21')][_0xe980('0x12')]);_0x3c33d5['offset']=qs[_0xe980('0x10')](_0x59f828[_0xe980('0x21')]['offset']);}return _0x24d409[_0xe980('0x77')](_0x3c33d5);}})['then'](function(_0x10069d){if(_0x10069d){return _0x10069d?{'count':_0x1e0836,'rows':_0x10069d}:null;}})[_0xe980('0x17')](respondWithResult(_0x77b055,null))['catch'](handleError(_0x77b055,null));};exports['setTags']=function(_0x14a36e,_0x30d7f3){if(_0x14a36e['body']['id']){delete _0x14a36e['body']['id'];}return db[_0xe980('0x25')][_0xe980('0x82')]({'where':{'id':_0x14a36e[_0xe980('0x65')]['id']}})[_0xe980('0x17')](handleEntityNotFound(_0x30d7f3,null))['then'](function(_0x4853e8){if(_0x4853e8){return _0x4853e8['setTags'](_0x14a36e[_0xe980('0x37')][_0xe980('0x83')]||[]);}return null;})[_0xe980('0x17')](respondWithResult(_0x30d7f3,null))['catch'](handleError(_0x30d7f3,null));};exports[_0xe980('0x84')]=function(_0x90b1ff,_0xeefc98){var _0x5f3a23=[];_0x5f3a23[_0xe980('0x5e')](addAdditionalPhones(_0x90b1ff[_0xe980('0x37')]));Promise[_0xe980('0x63')](_0x5f3a23)[_0xe980('0x17')](function(){_0x5f3a23=[];_0x5f3a23[_0xe980('0x5e')](deleteCmHopperPhones(_0x90b1ff[_0xe980('0x37')]['id']));_0x5f3a23[_0xe980('0x5e')](addCmHopperPhones(_0x90b1ff[_0xe980('0x37')]['id']));Promise['all'](_0x5f3a23)[_0xe980('0x17')](function(){return[0x1];})['then'](respondWithResult(_0xeefc98,null));});};function addAdditionalPhones(_0x2f86c1){var _0x203c98;return new Promise(function(_0x256bb7){return db[_0xe980('0x4b')]['destroy']({'where':{'CmContactId':_0x2f86c1['id']}})[_0xe980('0x17')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xe980('0x85')]})['then'](function(_0x5270b4){var _0x3fa642=[];for(var _0x3ccbc2=0x0;_0x3ccbc2<_0x2f86c1[_0xe980('0x86')]['length'];_0x3ccbc2++){var _0xf04d77=_0x2f86c1['item_types']?_[_0xe980('0x54')](_0x2f86c1[_0xe980('0x87')][_0x3ccbc2])?'':_0x2f86c1[_0xe980('0x87')][_0x3ccbc2]:_0x2f86c1[_0xe980('0x86')][_0x3ccbc2][_0xe980('0x88')]?_0x2f86c1[_0xe980('0x86')][_0x3ccbc2]['ItemTypeId']:'';var _0x2e290f=_['isNil'](_0x2f86c1['items'][_0x3ccbc2][_0xe980('0x89')])?'':_0x2f86c1[_0xe980('0x86')][_0x3ccbc2][_0xe980('0x89')];var _0x3c81ae=_0xf04d77+':'+_0x2f86c1['items'][_0x3ccbc2]['phone']+'§'+_0x2e290f;if(_['isNil'](_0x203c98))_0x203c98=_0x3c81ae;else _0x203c98+=';'+_0x3c81ae;var _0x22883e=null;var _0x9b2c83=null;if(_0x2f86c1[_0xe980('0x87')]){if(!_[_0xe980('0x54')](_0x2f86c1['item_types'][_0x3ccbc2])){_0x9b2c83=_[_0xe980('0x26')](_0x5270b4,function(_0x4663b0){return _0x4663b0['id']===_0x2f86c1[_0xe980('0x87')][_0x3ccbc2];});if(!_['isNil'](_0x9b2c83)){_0x22883e=_0x9b2c83[_0xe980('0x85')];}}}else{if(!_[_0xe980('0x54')](_0x2f86c1[_0xe980('0x86')][_0x3ccbc2])){_0x9b2c83=_[_0xe980('0x26')](_0x5270b4,function(_0x905d4b){return _0x905d4b['id']===_0x2f86c1['items'][_0x3ccbc2][_0xe980('0x88')];});if(!_[_0xe980('0x54')](_0x9b2c83)){_0x22883e=_0x3ccbc2;}}}if(_['isNil'](_0x22883e)){_0x22883e=0x64;}_0x3fa642[_0xe980('0x5e')](addAdditionalPhone(_0x2f86c1['id'],_0x2f86c1[_0xe980('0x86')][_0x3ccbc2]['phone'],_0x2f86c1[_0xe980('0x87')]?_[_0xe980('0x54')](_0x2f86c1['item_types'][_0x3ccbc2])?null:_0x2f86c1[_0xe980('0x87')][_0x3ccbc2]:_0x2f86c1[_0xe980('0x86')][_0x3ccbc2][_0xe980('0x88')]?_0x2f86c1['items'][_0x3ccbc2][_0xe980('0x88')]:null,_0x22883e,_0x2e290f));}Promise[_0xe980('0x63')](_0x3fa642)[_0xe980('0x17')](function(){db[_0xe980('0x25')][_0xe980('0x16')]({'AdditionalPhones':_0x203c98},{'where':{'id':_0x2f86c1['id']}})['then'](function(){_0x256bb7(0x1);});});});});});}function addAdditionalPhone(_0x20d21f,_0x4c64ce,_0x2fe0bd,_0x32009a,_0x2d273a){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x20d21f,'item':_0x4c64ce}})[_0xe980('0x17')](function(_0x458ab2){if(_0x458ab2)logger[_0xe980('0x33')]('contact\x20phone\x20exists',_0x458ab2);else{db[_0xe980('0x4b')][_0xe980('0x53')]({'CmContactId':_0x20d21f,'item':_0x4c64ce,'ItemTypeId':_0x2fe0bd,'OrderBy':_0x32009a,'ItemClass':_0xe980('0x8a'),'description':_0x2d273a});}});}function deleteCmHopperPhones(_0x1874c6){return new Promise(function(_0x28ee8b){return db[_0xe980('0x3e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1874c6}})['then'](function(_0x312722){db[_0xe980('0x8b')][_0xe980('0x24')]({'where':{'CmHopperId':{'$in':_[_0xe980('0x6f')](_0x312722,'id')}}});})[_0xe980('0x17')](function(){_0x28ee8b(0x1);});});}function addCmHopperPhones(_0x5c8669){return new Promise(function(_0x46e3bd){return db[_0xe980('0x3e')][_0xe980('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c8669}})[_0xe980('0x17')](function(_0x10c82b){var _0xf62e3f=[];_[_0xe980('0x6f')](_0x10c82b,function(_0xbcb2e6){_0xf62e3f['push'](createCmHopperPhone(_0x5c8669,_0xbcb2e6['id']));});Promise[_0xe980('0x63')](_0xf62e3f)[_0xe980('0x17')](function(){_0x46e3bd(0x1);});});});}function createCmHopperPhone(_0x5286f3,_0x32c836){return new Promise(function(_0x3e41fa){db[_0xe980('0x4b')]['findAll']({'raw':!![],'attributes':[_0xe980('0x8c'),'OrderBy'],'where':{'CmContactId':_0x5286f3,'ItemClass':_0xe980('0x8a')},'include':[{'model':db['ContactItemType'],'attributes':[_0xe980('0x85')],'as':_0xe980('0x6a')}],'order':[_0xe980('0x85'),db[_0xe980('0x6b')][_0xe980('0x6c')](_0xe980('0x8d'))]})[_0xe980('0x17')](function(_0x1a8948){var _0x52134b=0x1;var _0x6799a=_[_0xe980('0x6f')](_0x1a8948,function(_0x280e7a){_0x280e7a[_0xe980('0x8e')]=_0x32c836;_0x280e7a[_0xe980('0x76')]=_0x280e7a[_0xe980('0x8c')];_0x280e7a['OrderBy']=_0x52134b;delete _0x280e7a['ItemType.OrderBy'];_0x52134b=_0x52134b+0x1;return _0x280e7a;});return db['CmHopperAdditionalPhone'][_0xe980('0x59')](_0x6799a,{});})['then'](function(){_0x3e41fa(0x1);});});}function insertAdditionalPhones(_0x433e24,_0x554928){return new Promise(function(_0x4a364a){var _0x248b45=[];for(var _0x36363d=0x0;_0x36363d<_0x554928[_0xe980('0x28')];_0x36363d++){var _0x37d8b2=_0x554928[_0x36363d];_0x248b45[_0xe980('0x5e')](parseContactItemType(_0x37d8b2));}Promise[_0xe980('0x63')](_0x248b45)[_0xe980('0x17')](function(){var _0x3eac8e={'id':_0x433e24['id'],'items':_0x554928};return addAdditionalPhones(_0x3eac8e)[_0xe980('0x17')](function(){return addCmHopperPhones(_0x433e24['id']);});})[_0xe980('0x17')](function(){_0x4a364a(_0x433e24);});});}function parseContactItemType(_0x5e9856){return new Promise(function(_0x21ed42){if(_0x5e9856[_0xe980('0x35')](_0xe980('0x88'))){_0x21ed42(_0x5e9856);}else{return db['ContactItemType'][_0xe980('0x26')]({'where':{'name':_0x5e9856[_0xe980('0x6a')]}})['then'](function(_0x193c19){if(_[_0xe980('0x54')](_0x193c19))_0x5e9856[_0xe980('0x88')]=null;else _0x5e9856['ItemTypeId']=_0x193c19['id'];_0x21ed42(_0x5e9856);});}});}exports[_0xe980('0x8f')]=function(_0x2eb19d,_0x5f1190){return db[_0xe980('0x4b')][_0xe980('0x20')]({'raw':!![],'where':{'CmContactId':_0x2eb19d[_0xe980('0x65')]['id'],'ItemClass':_0xe980('0x8a')},'include':[{'model':db['ContactItemType'],'as':_0xe980('0x6a')}],'order':[[_0xe980('0x85')],[db[_0xe980('0x6b')][_0xe980('0x6c')](_0xe980('0x8d'))]]})[_0xe980('0x17')](function(_0x4f039c){return _0x4f039c;})[_0xe980('0x17')](respondWithResult(_0x5f1190,null))[_0xe980('0x23')](handleError(_0x5f1190,null));};exports[_0xe980('0x90')]=function(_0x92cac6,_0x5bc214){return db[_0xe980('0x4b')][_0xe980('0x20')]({'raw':!![],'where':{'CmContactId':_0x92cac6[_0xe980('0x37')][_0xe980('0x91')]}})[_0xe980('0x17')](function(_0x42da47){var _0x40bae5=_[_0xe980('0x6f')](_0x42da47,function(_0x34e530){_0x34e530[_0xe980('0x92')]=_0x92cac6['body'][_0xe980('0x93')];return _0x34e530;});return db['CmContactHasItem']['bulkCreate'](_0x40bae5,{});})[_0xe980('0x17')](function(){return addCmHopperPhones(_0x92cac6[_0xe980('0x37')]['toContactId']);})['then'](function(){return['ok'];})[_0xe980('0x17')](respondWithResult(_0x5bc214,null))['catch'](handleError(_0x5bc214,null));};exports[_0xe980('0x94')]=function(_0x1a0028,_0x345eca){var _0x498d2d=[];_0x498d2d['push'](createCmHopperPhone(_0x1a0028[_0xe980('0x37')]['id'],_0x1a0028[_0xe980('0x37')]['hopperId']));Promise[_0xe980('0x63')](_0x498d2d)['then'](function(){return[0x1];})['then'](respondWithResult(_0x345eca,null));};exports[_0xe980('0x95')]=function(_0x25f768,_0x43d99a){var _0x593a03={'raw':![],'where':{}};var _0x1a2303={};var _0x186958={'count':0x0,'rows':[]};return db[_0xe980('0x25')][_0xe980('0x82')]({'where':{'id':_0x25f768[_0xe980('0x65')]['id']}})['then'](handleEntityNotFound(_0x43d99a,null))[_0xe980('0x17')](function(_0x473cd7){if(_0x473cd7){_0x1a2303['model']=_['keys'](db[_0xe980('0x3e')]['rawAttributes']);_0x1a2303[_0xe980('0x21')]=_[_0xe980('0x29')](_0x25f768[_0xe980('0x21')]);_0x1a2303[_0xe980('0x96')]=_['intersection'](_0x1a2303[_0xe980('0x78')],_0x1a2303[_0xe980('0x21')]);_0x593a03[_0xe980('0x7a')]=_[_0xe980('0x79')](_0x1a2303['model'],qs[_0xe980('0x7b')](_0x25f768['query']['fields']));_0x593a03[_0xe980('0x7a')]=_0x593a03[_0xe980('0x7a')][_0xe980('0x28')]?_0x593a03[_0xe980('0x7a')]:_0x1a2303[_0xe980('0x78')];if(!_0x25f768[_0xe980('0x21')][_0xe980('0x35')]('nolimit')){_0x593a03[_0xe980('0x12')]=qs[_0xe980('0x12')](_0x25f768['query'][_0xe980('0x12')]);_0x593a03[_0xe980('0x10')]=qs['offset'](_0x25f768[_0xe980('0x21')][_0xe980('0x10')]);}_0x593a03[_0xe980('0x7c')]=qs[_0xe980('0x7d')](_0x25f768[_0xe980('0x21')][_0xe980('0x7d')]);_0x593a03[_0xe980('0x5c')]=qs[_0xe980('0x96')](_[_0xe980('0x7e')](_0x25f768[_0xe980('0x21')],_0x1a2303[_0xe980('0x96')]));_0x593a03['where'][_0xe980('0x97')]=_0x473cd7['id'];if(_0x25f768[_0xe980('0x21')][_0xe980('0x7f')]){_0x593a03[_0xe980('0x5c')]=_[_0xe980('0x36')](_0x593a03[_0xe980('0x5c')],{'$or':_[_0xe980('0x6f')](_0x593a03[_0xe980('0x7a')],function(_0x342f57){var _0x195a03={};_0x195a03[_0x342f57]={'$like':'%'+_0x25f768['query'][_0xe980('0x7f')]+'%'};return _0x195a03;})});}_0x593a03=_['merge']({},_0x593a03,_0x25f768[_0xe980('0x80')]);return db[_0xe980('0x3e')][_0xe980('0x13')]({'where':_0x593a03[_0xe980('0x5c')]})[_0xe980('0x17')](function(_0x35d14c){_0x186958['count']=_0x35d14c;if(_0x25f768[_0xe980('0x21')][_0xe980('0x98')]){_0x593a03[_0xe980('0x99')]=[{'all':!![]}];}return db[_0xe980('0x3e')][_0xe980('0x20')](_0x593a03);})['then'](function(_0x26f3f4){_0x186958[_0xe980('0x9a')]=_0x26f3f4;return _0x186958;});}})[_0xe980('0x17')](respondWithFilteredResult(_0x43d99a,_0x593a03))[_0xe980('0x23')](handleError(_0x43d99a,null));};exports['getHopperHistories']=function(_0x46f5eb,_0x2ea210){var _0x331b7d={'raw':!![],'where':{}};var _0x4d7070={};var _0x3aa919={'count':0x0,'rows':[]};return db[_0xe980('0x25')]['findOne']({'where':{'id':_0x46f5eb[_0xe980('0x65')]['id']}})[_0xe980('0x17')](handleEntityNotFound(_0x2ea210,null))[_0xe980('0x17')](function(_0x37b4dc){if(_0x37b4dc){_0x4d7070[_0xe980('0x78')]=_['keys'](db[_0xe980('0x9b')][_0xe980('0x9c')]);_0x4d7070['query']=_['keys'](_0x46f5eb[_0xe980('0x21')]);_0x4d7070['filters']=_[_0xe980('0x79')](_0x4d7070['model'],_0x4d7070['query']);_0x331b7d[_0xe980('0x7a')]=_['intersection'](_0x4d7070['model'],qs['fields'](_0x46f5eb[_0xe980('0x21')][_0xe980('0x7b')]));_0x331b7d[_0xe980('0x7a')]=_0x331b7d[_0xe980('0x7a')][_0xe980('0x28')]?_0x331b7d['attributes']:_0x4d7070[_0xe980('0x78')];if(!_0x46f5eb[_0xe980('0x21')]['hasOwnProperty'](_0xe980('0x81'))){_0x331b7d['limit']=qs['limit'](_0x46f5eb[_0xe980('0x21')][_0xe980('0x12')]);_0x331b7d[_0xe980('0x10')]=qs[_0xe980('0x10')](_0x46f5eb[_0xe980('0x21')][_0xe980('0x10')]);}_0x331b7d[_0xe980('0x7c')]=qs['sort'](_0x46f5eb[_0xe980('0x21')][_0xe980('0x7d')]);_0x331b7d[_0xe980('0x5c')]=qs[_0xe980('0x96')](_[_0xe980('0x7e')](_0x46f5eb['query'],_0x4d7070[_0xe980('0x96')]));_0x331b7d[_0xe980('0x5c')][_0xe980('0x97')]=_0x37b4dc['id'];if(_0x46f5eb[_0xe980('0x21')][_0xe980('0x7f')]){_0x331b7d[_0xe980('0x5c')]=_[_0xe980('0x36')](_0x331b7d[_0xe980('0x5c')],{'$or':_[_0xe980('0x6f')](_0x331b7d[_0xe980('0x7a')],function(_0x1a29f5){var _0x23ed8e={};_0x23ed8e[_0x1a29f5]={'$like':'%'+_0x46f5eb[_0xe980('0x21')][_0xe980('0x7f')]+'%'};return _0x23ed8e;})});}_0x331b7d=_[_0xe980('0x36')]({},_0x331b7d,_0x46f5eb[_0xe980('0x80')]);return db['CmHopperHistory']['count']({'where':_0x331b7d[_0xe980('0x5c')]})[_0xe980('0x17')](function(_0x2333f8){_0x3aa919[_0xe980('0x13')]=_0x2333f8;if(_0x46f5eb[_0xe980('0x21')][_0xe980('0x98')]){_0x331b7d[_0xe980('0x99')]=[{'all':!![]}];}return db[_0xe980('0x9b')][_0xe980('0x20')](_0x331b7d);})[_0xe980('0x17')](function(_0x3ba969){_0x3aa919[_0xe980('0x9a')]=_0x3ba969;return _0x3aa919;});}})[_0xe980('0x17')](respondWithFilteredResult(_0x2ea210,_0x331b7d))[_0xe980('0x23')](handleError(_0x2ea210,null));};exports[_0xe980('0x9d')]=function(_0x301786,_0x178b93){var _0x143fc3={'raw':!![],'where':{}};var _0x39b1a5={};var _0xa6e322={'count':0x0,'rows':[]};return db[_0xe980('0x25')][_0xe980('0x82')]({'where':{'id':_0x301786[_0xe980('0x65')]['id']}})[_0xe980('0x17')](handleEntityNotFound(_0x178b93,null))['then'](function(_0x210ace){if(_0x210ace){_0x39b1a5[_0xe980('0x78')]=_[_0xe980('0x29')](db[_0xe980('0x4c')][_0xe980('0x9c')]);_0x39b1a5[_0xe980('0x21')]=_[_0xe980('0x29')](_0x301786[_0xe980('0x21')]);_0x39b1a5[_0xe980('0x96')]=_[_0xe980('0x79')](_0x39b1a5['model'],_0x39b1a5['query']);_0x143fc3[_0xe980('0x7a')]=_[_0xe980('0x79')](_0x39b1a5[_0xe980('0x78')],qs[_0xe980('0x7b')](_0x301786[_0xe980('0x21')]['fields']));_0x143fc3['attributes']=_0x143fc3[_0xe980('0x7a')]['length']?_0x143fc3[_0xe980('0x7a')]:_0x39b1a5[_0xe980('0x78')];if(!_0x301786[_0xe980('0x21')][_0xe980('0x35')](_0xe980('0x81'))){_0x143fc3[_0xe980('0x12')]=qs[_0xe980('0x12')](_0x301786['query']['limit']);_0x143fc3['offset']=qs[_0xe980('0x10')](_0x301786[_0xe980('0x21')][_0xe980('0x10')]);}_0x143fc3[_0xe980('0x7c')]=qs[_0xe980('0x7d')](_0x301786[_0xe980('0x21')][_0xe980('0x7d')]);_0x143fc3[_0xe980('0x5c')]=qs['filters'](_['pick'](_0x301786[_0xe980('0x21')],_0x39b1a5[_0xe980('0x96')]));_0x143fc3[_0xe980('0x5c')]['ContactId']=_0x210ace['id'];if(_0x301786[_0xe980('0x21')][_0xe980('0x7f')]){_0x143fc3[_0xe980('0x5c')]=_[_0xe980('0x36')](_0x143fc3[_0xe980('0x5c')],{'$or':_[_0xe980('0x6f')](_0x143fc3[_0xe980('0x7a')],function(_0x46e25b){var _0x4aa761={};_0x4aa761[_0x46e25b]={'$like':'%'+_0x301786['query'][_0xe980('0x7f')]+'%'};return _0x4aa761;})});}_0x143fc3=_[_0xe980('0x36')]({},_0x143fc3,_0x301786['options']);return db[_0xe980('0x4c')][_0xe980('0x13')]({'where':_0x143fc3[_0xe980('0x5c')]})[_0xe980('0x17')](function(_0x924496){_0xa6e322['count']=_0x924496;if(_0x301786[_0xe980('0x21')]['includeAll']){_0x143fc3[_0xe980('0x99')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe980('0x20')](_0x143fc3);})['then'](function(_0x4a7de7){_0xa6e322[_0xe980('0x9a')]=_0x4a7de7;return _0xa6e322;});}})[_0xe980('0x17')](respondWithFilteredResult(_0x178b93,_0x143fc3))['catch'](handleError(_0x178b93,null));};exports[_0xe980('0x9e')]=function(_0x5c156f,_0x3ee4e3){var _0x45d86e={'raw':!![],'where':{}};var _0x52638c={};var _0x20cbee={'count':0x0,'rows':[]};return db[_0xe980('0x25')]['findOne']({'where':{'id':_0x5c156f[_0xe980('0x65')]['id']}})[_0xe980('0x17')](handleEntityNotFound(_0x3ee4e3,null))[_0xe980('0x17')](function(_0xba97eb){if(_0xba97eb){_0x52638c[_0xe980('0x78')]=_['keys'](db[_0xe980('0x9f')][_0xe980('0x9c')]);_0x52638c['query']=_['keys'](_0x5c156f[_0xe980('0x21')]);_0x52638c['filters']=_['intersection'](_0x52638c['model'],_0x52638c['query']);_0x45d86e[_0xe980('0x7a')]=_[_0xe980('0x79')](_0x52638c[_0xe980('0x78')],qs['fields'](_0x5c156f[_0xe980('0x21')]['fields']));_0x45d86e['attributes']=_0x45d86e[_0xe980('0x7a')]['length']?_0x45d86e[_0xe980('0x7a')]:_0x52638c['model'];if(!_0x5c156f[_0xe980('0x21')][_0xe980('0x35')]('nolimit')){_0x45d86e[_0xe980('0x12')]=qs[_0xe980('0x12')](_0x5c156f['query']['limit']);_0x45d86e[_0xe980('0x10')]=qs[_0xe980('0x10')](_0x5c156f['query'][_0xe980('0x10')]);}_0x45d86e['order']=qs[_0xe980('0x7d')](_0x5c156f[_0xe980('0x21')][_0xe980('0x7d')]);_0x45d86e['where']=qs[_0xe980('0x96')](_[_0xe980('0x7e')](_0x5c156f[_0xe980('0x21')],_0x52638c[_0xe980('0x96')]));_0x45d86e[_0xe980('0x5c')]['ContactId']=_0xba97eb['id'];if(_0x5c156f[_0xe980('0x21')]['filter']){_0x45d86e[_0xe980('0x5c')]=_[_0xe980('0x36')](_0x45d86e['where'],{'$or':_[_0xe980('0x6f')](_0x45d86e['attributes'],function(_0x36a7b5){var _0x394646={};_0x394646[_0x36a7b5]={'$like':'%'+_0x5c156f[_0xe980('0x21')]['filter']+'%'};return _0x394646;})});}_0x45d86e=_[_0xe980('0x36')]({},_0x45d86e,_0x5c156f['options']);return db[_0xe980('0x9f')][_0xe980('0x13')]({'where':_0x45d86e[_0xe980('0x5c')]})['then'](function(_0x241485){_0x20cbee[_0xe980('0x13')]=_0x241485;if(_0x5c156f[_0xe980('0x21')][_0xe980('0x98')]){_0x45d86e[_0xe980('0x99')]=[{'all':!![]}];}return db[_0xe980('0x9f')][_0xe980('0x20')](_0x45d86e);})['then'](function(_0x4a24fa){_0x20cbee['rows']=_0x4a24fa;return _0x20cbee;});}})['then'](respondWithFilteredResult(_0x3ee4e3,_0x45d86e))[_0xe980('0x23')](handleError(_0x3ee4e3,null));};exports[_0xe980('0xa0')]=function(_0x1a02cd,_0x518c08){try{if(!_0x1a02cd[_0xe980('0x37')][_0xe980('0x5f')]){throw new Error(_0xe980('0xa1'));}if(!_0x1a02cd[_0xe980('0x37')][_0xe980('0xa2')]){throw new Error(_0xe980('0xa3'));}if(!_0x1a02cd['body'][_0xe980('0xa4')]){throw new Error(_0xe980('0xa5'));}if(!_0x1a02cd[_0xe980('0x37')][_0xe980('0xa6')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x28c640=_0x1a02cd[_0xe980('0x37')]['binding_keys'][_0xe980('0xa7')](',');var _0x19e5ef=_0x1a02cd[_0xe980('0x37')][_0xe980('0xa4')][_0xe980('0xa7')](',');if(!_0x28c640[_0xe980('0x28')]||!_0x19e5ef[_0xe980('0x28')]||_0x28c640['length']!==_0x19e5ef['length']){throw new Error(_0xe980('0xa8'));}_0x1a02cd[_0xe980('0x37')][_0xe980('0x7b')]=_[_0xe980('0xa9')](_0x28c640,_0x19e5ef);if(!_0x1a02cd[_0xe980('0x37')][_0xe980('0x7b')][_0xe980('0x76')]){throw new Error(_0xe980('0xaa'));}if(!_0x1a02cd['body'][_0xe980('0x7b')][_0xe980('0xab')]){throw new Error(_0xe980('0xac'));}var _0x5215c5=path['join'](config[_0xe980('0xad')],_0xe980('0xae'),_0x1a02cd['file'][_0xe980('0xaf')]);fs[_0xe980('0xb0')](_0x5215c5,parseInt(_0xe980('0xb1'),0x8));var _0x1ad5a3=require(_0xe980('0xb2'))[_0xe980('0xb3')](path[_0xe980('0x3c')](__dirname,_0xe980('0xb4')),[_0x5215c5,_0x1a02cd['body'][_0xe980('0xa2')],_0x1a02cd['body'][_0xe980('0xa4')],_0x1a02cd[_0xe980('0x37')][_0xe980('0x5f')],_0x1a02cd['body'][_0xe980('0xb5')],_0x1a02cd['body'][_0xe980('0x5b')],_0x1a02cd[_0xe980('0x37')][_0xe980('0xa6')]]);return _0x518c08[_0xe980('0xf')](0xc8)[_0xe980('0x15')]({'message':_0xe980('0xb6'),'pid':_0x1ad5a3['pid']});}catch(_0x171a14){return _0x518c08['status'](0x1f4)['send'](_0x171a14);}};exports[_0xe980('0xb7')]=function(_0x20e7a3,_0x54c8de){var _0x695c23=fs['createReadStream'](_0x20e7a3['file'][_0xe980('0xb8')]);Papa['parse'](_0x695c23,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x763d29){return _0x54c8de[_0xe980('0xf')](0xc8)[_0xe980('0x15')]({'file':_0x20e7a3[_0xe980('0xb9')],'fields':_0x763d29[_0xe980('0xba')]['fields']});}});};exports[_0xe980('0xbb')]=function(_0x41d84a,_0x3d175e){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xe980('0xbc')}})[_0xe980('0x17')](function(_0x4765f5){var _0x446b1a=![];if(!_0x41d84a['body'][_0xe980('0x5f')]){throw new Error(_0xe980('0xa1'));}if(!_0x41d84a[_0xe980('0x37')][_0xe980('0xbd')][_0xe980('0x76')]){throw new Error(_0xe980('0xaa'));}if(!_0x41d84a[_0xe980('0x37')][_0xe980('0xbd')]['firstName']){throw new Error(_0xe980('0xac'));}if(!_0x41d84a[_0xe980('0x37')][_0xe980('0xa6')]){throw new Error(_0xe980('0xbe'));}var _0x246e4e=require('child_process')[_0xe980('0xb3')](path[_0xe980('0x3c')](__dirname,_0xe980('0xbf')),[_0x41d84a[_0xe980('0x65')]['id'],JSON['stringify'](_0x41d84a[_0xe980('0x37')]),JSON[_0xe980('0xc0')](_0x4765f5)]);_0x246e4e['on'](_0xe980('0xc1'),function(){_0x446b1a=!![];return _0x3d175e[_0xe980('0xf')](0xc8)[_0xe980('0x15')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x246e4e[_0xe980('0xc2')]});});_0x246e4e['on'](_0xe980('0xc3'),function(_0x47a10e){if(_0x47a10e&&!_0x446b1a){return _0x3d175e[_0xe980('0xf')](0x1f4)[_0xe980('0x15')]({'message':_0xe980('0xc4'),'pid':_0x246e4e[_0xe980('0xc2')]});}});})[_0xe980('0x23')](handleError(_0x3d175e,null));};exports['importUpdates']=function(_0x5c13cd,_0x55638e){return db[_0xe980('0xc5')][_0xe980('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe980('0xbc')}})[_0xe980('0x17')](function(_0x1aa0af){var _0x1d3196=![];if(!_0x5c13cd['body']['ListId']){throw new Error(_0xe980('0xa1'));}if(!_0x5c13cd['body']['binding'][_0xe980('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5c13cd[_0xe980('0x37')][_0xe980('0xbd')][_0xe980('0xab')]){throw new Error(_0xe980('0xac'));}if(!_0x5c13cd[_0xe980('0x37')][_0xe980('0xa6')]){throw new Error(_0xe980('0xbe'));}var _0x28bc13=require(_0xe980('0xb2'))[_0xe980('0xb3')](path[_0xe980('0x3c')](__dirname,'../../components/import/cm/csvUpdates'),[_0x5c13cd[_0xe980('0x65')]['id'],JSON[_0xe980('0xc0')](_0x5c13cd['body']),JSON[_0xe980('0xc0')](_0x1aa0af)]);_0x28bc13['on']('message',function(){_0x1d3196=!![];return _0x55638e['status'](0xc8)[_0xe980('0x15')]({'message':_0xe980('0xc6'),'pid':_0x28bc13[_0xe980('0xc2')]});});_0x28bc13['on']('exit',function(_0x22c671){if(_0x22c671&&!_0x1d3196){return _0x55638e[_0xe980('0xf')](0x1f4)['json']({'message':_0xe980('0xc4'),'pid':_0x28bc13[_0xe980('0xc2')]});}});})['catch'](handleError(_0x55638e,null));};exports['getJourney']=function(_0x36090a,_0x39a5f2){var _0xd64e2d=[_0xe980('0xc7'),'chat',_0xe980('0xc8'),_0xe980('0xc9'),_0xe980('0xca'),_0xe980('0xcb'),_0xe980('0xcc')];var _0x1d280f={'offset':0x0,'order':qs[_0xe980('0x7d')](_0xe980('0xcd'))},_0x590fce={'count':0x0,'rows':[]};Promise[_0xe980('0xce')]()['then'](function(){if(_0x36090a[_0xe980('0x21')][_0xe980('0xcf')]){if(!_['includes'](_0xd64e2d,_0x36090a[_0xe980('0x21')][_0xe980('0xcf')][_0xe980('0xd0')]())){throw new Error(_0xe980('0xd1'));}_0xd64e2d=[_0x36090a[_0xe980('0x21')]['channel']['toLowerCase']()];}if(_0x36090a[_0xe980('0x21')][_0xe980('0xd2')]){try{var _0x385f7a=JSON['parse'](_0x36090a['query'][_0xe980('0xd2')]);if(!moment(_0x385f7a[_0xe980('0x38')])['isValid']()){throw new Error(_0xe980('0xd3'));}if(!moment(_0x385f7a['to'])[_0xe980('0xd4')]()){throw new Error(_0xe980('0xd5'));}}catch(_0x42a16d){throw new Error(_0xe980('0xd6'));}}if(!_0x36090a[_0xe980('0x21')]['hasOwnProperty'](_0xe980('0x81'))){_0x1d280f[_0xe980('0x12')]=qs[_0xe980('0x12')](_0x36090a[_0xe980('0x21')]['limit']||0xa);_0x1d280f[_0xe980('0x10')]=qs[_0xe980('0x10')](_0x36090a[_0xe980('0x21')][_0xe980('0x10')]);}var _0x1c5a56=_0xd64e2d['map'](function(_0x1c79ab){if(_0x1c79ab===_0xe980('0xcc')){var _0x48e7df={'attributes':['id','uniqueid',_0xe980('0x31'),_0xe980('0xd7'),'destination',_0xe980('0xd8'),_0xe980('0xd9'),_0xe980('0xda'),'duration',_0xe980('0xdb'),_0xe980('0xdc'),_0xe980('0xdd'),_0xe980('0xde'),_0xe980('0xdf'),_0xe980('0xe0')],'where':{'ContactId':_0x36090a[_0xe980('0x65')]['id']},'include':[{'model':db[_0xe980('0xc5')],'as':_0xe980('0xc5'),'attributes':['id','name','fullname',_0xe980('0xe1')]}],'order':[['createdAt',_0xe980('0xe2')]]};if(_0x36090a[_0xe980('0x21')][_0xe980('0xd2')]){_0x48e7df['where'][_0xe980('0xdc')]={'$gte':_0x385f7a[_0xe980('0x38')],'$lte':_0x385f7a['to']};}return db['VoiceCallReport'][_0xe980('0xe3')](_0x48e7df)[_0xe980('0x17')](function(_0x47549e){_0x590fce[_0xe980('0x13')]+=_0x47549e[_0xe980('0x13')];return _[_0xe980('0x6f')](_0x47549e[_0xe980('0x9a')],function(_0x5504bf){var _0x3d39f4=_0x5504bf[_0xe980('0x39')]({'plain':!![]});_0x3d39f4[_0xe980('0xcf')]=_0x1c79ab;if(_0x3d39f4[_0xe980('0xc5')]){_0x3d39f4[_0xe980('0xc5')]={'id':_0x3d39f4['User']['id'],'name':_0x3d39f4['User'][_0xe980('0x1b')],'fullname':_0x3d39f4[_0xe980('0xc5')]['fullname'],'alias':_0x3d39f4[_0xe980('0xc5')][_0xe980('0xe1')]};}return _0x3d39f4;});});}else{var _0x3b7abd=_[_0xe980('0xe4')](_0x1c79ab)+(_0x1c79ab==='chat'?'Website':_0xe980('0xe5'));var _0x5ca176={'attributes':['id','closed',_0xe980('0xe6'),_0xe980('0xdc'),_0xe980('0xdb'),_0xe980('0xe7'),'secondDisposition',_0xe980('0xe8'),_0xe980('0xe0'),_0x3b7abd+'Id'],'where':{'ContactId':_0x36090a[_0xe980('0x65')]['id']},'include':[{'model':db[_0x3b7abd],'as':_0xe980('0xe5'),'attributes':['id',_0xe980('0x1b'),'key']},{'model':db[_0xe980('0xc5')],'as':_0xe980('0xe9'),'attributes':['id',_0xe980('0x1b'),_0xe980('0xea')]},{'model':db[_0xe980('0x66')],'as':_0xe980('0x67'),'attributes':['id',_0xe980('0x1b'),_0xe980('0xeb')],'through':{'attributes':[]}}],'order':[[_0xe980('0xdc'),_0xe980('0xe2')]]};if(_0x36090a['query'][_0xe980('0xd2')]){_0x5ca176[_0xe980('0x5c')][_0xe980('0xdc')]={'$gte':_0x385f7a[_0xe980('0x38')],'$lte':_0x385f7a['to']};}switch(_0x1c79ab){case'chat':_0x5ca176[_0xe980('0x7a')][_0xe980('0x5e')](_0xe980('0xec'),_0xe980('0xed'),_0xe980('0xee'),_0xe980('0xef'),'osName',_0xe980('0xf0'),_0xe980('0xf1'),_0xe980('0xf2'),_0xe980('0xf3'));break;case _0xe980('0xc7'):_0x5ca176[_0xe980('0x7a')][_0xe980('0x5e')]('subject',_0xe980('0xf4'));break;case _0xe980('0xc9'):_0x5ca176['attributes'][_0xe980('0x5e')](_0xe980('0xf5'),'threadId');break;}return db[_['startCase'](_0x1c79ab)+_0xe980('0xf6')][_0xe980('0xe3')](_0x5ca176)[_0xe980('0x17')](function(_0x2d8348){_0x590fce[_0xe980('0x13')]+=_0x2d8348[_0xe980('0x13')];return _['map'](_0x2d8348['rows'],function(_0x2a820f){var _0x1cc5fd=_0x2a820f[_0xe980('0x39')]({'plain':!![]});_0x1cc5fd[_0xe980('0xcf')]=_0x1c79ab;if(_0x1cc5fd[_0xe980('0xe9')]){_0x1cc5fd[_0xe980('0xe9')]={'id':_0x1cc5fd[_0xe980('0xe9')]['id'],'name':_0x1cc5fd['Owner']['name'],'fullname':_0x1cc5fd['Owner']['fullname']};}return _0x1cc5fd;});});}});return Promise[_0xe980('0x63')](_0x1c5a56);})[_0xe980('0x17')](function(_0x500a39){return _(_0x500a39)[_0xe980('0xf7')]()['sortBy']('createdAt')[_0xe980('0xf8')]()[_0xe980('0xf9')]();})['then'](function(_0x47abca){_0x590fce[_0xe980('0x9a')]=_0x1d280f['limit']?_0x47abca[_0xe980('0xfa')](_0x1d280f[_0xe980('0x10')],_0x1d280f[_0xe980('0x10')]+_0x1d280f[_0xe980('0x12')]):_0x47abca;return _0x590fce;})[_0xe980('0x17')](respondWithFilteredResult(_0x39a5f2,_0x1d280f))[_0xe980('0x23')](handleError(_0x39a5f2,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2262ccb..81f7d0b 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 _0x1ccb=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x1ccb,0x172));var _0xb1cc=function(_0x477e83,_0x4c0ad9){_0x477e83=_0x477e83-0x0;var _0x5d9557=_0x1ccb[_0x477e83];return _0x5d9557;};'use strict';var EventEmitter=require(_0xb1cc('0x0'));var CmContact=require(_0xb1cc('0x1'))['db'][_0xb1cc('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb1cc('0x3')](0x0);var events={'afterCreate':_0xb1cc('0x4'),'afterUpdate':_0xb1cc('0x5'),'afterDestroy':_0xb1cc('0x6')};function emitEvent(_0x16c17f){return function(_0x10f35b,_0x144abb,_0x7e3658){CmContactEvents[_0xb1cc('0x7')](_0x16c17f+':'+_0x10f35b['id'],_0x10f35b);CmContactEvents[_0xb1cc('0x7')](_0x16c17f,_0x10f35b);_0x7e3658(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xb1cc('0x8')]=CmContactEvents; \ No newline at end of file +var _0xd6ae=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd6ae,0x1ab));var _0xed6a=function(_0x306cf6,_0x4d5aad){_0x306cf6=_0x306cf6-0x0;var _0x5327e9=_0xd6ae[_0x306cf6];return _0x5327e9;};'use strict';var EventEmitter=require(_0xed6a('0x0'));var CmContact=require(_0xed6a('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xed6a('0x2')](0x0);var events={'afterCreate':_0xed6a('0x3'),'afterUpdate':_0xed6a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a77aa){return function(_0x1068b3,_0xce66b5,_0x2294c7){CmContactEvents[_0xed6a('0x5')](_0x3a77aa+':'+_0x1068b3['id'],_0x1068b3);CmContactEvents[_0xed6a('0x5')](_0x3a77aa,_0x1068b3);_0x2294c7(null);};}for(var e in events){if(events[_0xed6a('0x6')](e)){var event=events[e];CmContact[_0xed6a('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 1340abc..eadbe17 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 _0xc73e=['error','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','then','dialTimezone','timezones','utcOffset','scheduledat','add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','afterCreate','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','BlackLists','List\x20not\x20found','isEmpty','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment/shared','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get'];(function(_0x253f0e,_0x3d2fe7){var _0x5d231a=function(_0x1f7f33){while(--_0x1f7f33){_0x253f0e['push'](_0x253f0e['shift']());}};_0x5d231a(++_0x3d2fe7);}(_0xc73e,0x1db));var _0xec73=function(_0x2d0c53,_0x15252c){_0x2d0c53=_0x2d0c53-0x0;var _0x50fc98=_0xc73e[_0x2d0c53];return _0x50fc98;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require(_0xec73('0x2'))('api');var moment=require('moment');var BPromise=require(_0xec73('0x3'));var rp=require(_0xec73('0x4'));var fs=require('fs');var path=require(_0xec73('0x5'));var rimraf=require(_0xec73('0x6'));var config=require('../../config/environment');var shared=require(_0xec73('0x7'));var attributes=require('./cmContact.attributes');module[_0xec73('0x8')]=function(_0x20b195,_0x1c7069){return _0x20b195[_0xec73('0x9')]('CmContact',attributes,{'tableName':_0xec73('0xa'),'paranoid':!![],'indexes':[{'name':_0xec73('0xb'),'fields':['phone']},{'name':_0xec73('0xc'),'fields':[_0xec73('0xd'),_0xec73('0xe'),_0xec73('0xb'),_0xec73('0xf'),_0xec73('0x10'),_0xec73('0x11')],'type':_0xec73('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xec73('0x13'),'hooks':{'afterCreate':function(_0x276ee6,_0x205b9f,_0x30ace8){var _0x270af3=_0x20b195[_0xec73('0x14')];var _0x4911b0=_0x276ee6[_0xec73('0x15')]({'plain':!![]});function _0x257cbc(){return function(_0x52e125){logger[_0xec73('0x16')]('cmContact','afterCreate',util['inspect'](_0x52e125,{'showHidden':![],'depth':null}));};}function _0x41a455(_0x203ab4,_0x273b35){var _0x5e0aee=_0x273b35['scheduledat']?_0x273b35['scheduledat']:moment()[_0xec73('0x17')](_0xec73('0x18'));return new BPromise(function(_0x4918b3,_0x572366){if(_[_0xec73('0x19')](_0x273b35['dialTimezone'])){_0x4918b3({'ret':_0x5e0aee});}else{_0x270af3[_0xec73('0x1a')]['findOne']({'where':{'id':_0x203ab4['id']}})[_0xec73('0x1b')](function(_0x212a00){if(!_['isNil'](_0x212a00)){var _0x388bbc=_0x212a00[_0xec73('0x1c')];if(!_[_0xec73('0x19')](_0x388bbc)){var _0x5ab99c=shared[_0xec73('0x1d')];var _0xc83d03=_0x5ab99c[_0x388bbc];var _0x350628=_0x5ab99c[_0x273b35['dialTimezone']];if(!_[_0xec73('0x19')](_0xc83d03)&&!_['isNil'](_0x350628)){var _0x3c9c78=_0xc83d03[_0xec73('0x1e')]-_0x350628[_0xec73('0x1e')];_0x5e0aee=_0x273b35[_0xec73('0x1f')]?_0x273b35[_0xec73('0x1f')]:moment();var _0x4c8d8e=moment(_0x5e0aee)[_0xec73('0x20')](_0x3c9c78,_0xec73('0x21'));_0x4918b3({'ret':_0x4c8d8e[_0xec73('0x17')](_0xec73('0x18'))});}else _0x4918b3({'ret':_0x5e0aee});}else _0x4918b3({'ret':_0x5e0aee});}else{_0x4918b3({'ret':_0x5e0aee});}});}});return 0xa;}var _0x16ebc9=function(_0x417d0e){return new BPromise(function(_0x4c3cd0,_0x26f2df){_0x41a455(_0x417d0e,_0x4911b0)['then'](function(_0xaafc9c){_0x4911b0[_0xec73('0x1f')]=_0xaafc9c[_0xec73('0x22')];_0x270af3[_0xec73('0x23')]['findOne']({'where':{'phone':_0x4911b0[_0xec73('0xb')],'VoiceQueueId':_0x417d0e['id']}})[_0xec73('0x1b')](function(_0x4a2d4b){if(!_[_0xec73('0x19')](_0x4a2d4b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4911b0[_0xec73('0xb')]+_0xec73('0x24')+_0x417d0e['id']);}return _0x270af3[_0xec73('0x23')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'priority':_0x4911b0[_0xec73('0x27')]?_0x4911b0[_0xec73('0x27')]:0x2,'scheduledat':_0x4911b0[_0xec73('0x1f')]?_0x4911b0[_0xec73('0x1f')]:moment()[_0xec73('0x17')](_0xec73('0x18')),'callback':_0x4911b0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0[_0xec73('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x417d0e['id']});})[_0xec73('0x29')](function(_0x691421){_0x26f2df(_0x691421);});});});};var _0x3d965d=function(_0x57ea90){return new BPromise(function(_0x5a57da,_0x2aacee){_0x41a455(_0x57ea90,_0x4911b0)[_0xec73('0x1b')](function(_0x3ed53c){_0x4911b0['scheduledat']=_0x3ed53c[_0xec73('0x22')];_0x270af3[_0xec73('0x23')][_0xec73('0x2a')]({'where':{'phone':_0x4911b0['phone'],'VoiceQueueId':_0x57ea90['id']}})[_0xec73('0x1b')](function(_0x151b57){if(!_[_0xec73('0x19')](_0x151b57)){throw new Error(_0xec73('0x2b')+_0x4911b0[_0xec73('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x57ea90['id']);}return _0x270af3[_0xec73('0x2c')][_0xec73('0x2a')]({'where':{'calleridnum':_0x4911b0['phone'],'VoiceQueueId':_0x57ea90['id']}});})[_0xec73('0x1b')](function(_0xa7c9a9){if(!_[_0xec73('0x19')](_0xa7c9a9)){throw new Error(_0xec73('0x2d')+_0x4911b0[_0xec73('0xb')]+_0xec73('0x2e')+_0x57ea90['id']);}return _0x270af3[_0xec73('0x23')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'priority':_0x4911b0['priority']?_0x4911b0['priority']:0x2,'scheduledat':_0x4911b0['scheduledat']?_0x4911b0[_0xec73('0x1f')]:moment()['format'](_0xec73('0x18')),'callback':_0x4911b0[_0xec73('0x28')]?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0[_0xec73('0x28')]?moment()['format'](_0xec73('0x18')):undefined,'VoiceQueueId':_0x57ea90['id']});})[_0xec73('0x29')](function(_0x2b09e7){_0x2aacee(_0x2b09e7);});});});};function _0x3a6c70(){return function(_0xed06e3){logger[_0xec73('0x16')](_0xec73('0x2f'),_0xec73('0x30'),util[_0xec73('0x31')](_0xed06e3,{'showHidden':![],'depth':null}));};}function _0x15bce5(_0x12274d,_0x23cb72){var _0x18d8b3=_0x23cb72[_0xec73('0x1f')]?_0x23cb72[_0xec73('0x1f')]:moment()[_0xec73('0x17')](_0xec73('0x18'));return new BPromise(function(_0x3aaa84,_0x38f263){if(_[_0xec73('0x19')](_0x23cb72[_0xec73('0x1c')])){_0x3aaa84({'ret':_0x18d8b3});}else{_0x270af3[_0xec73('0x32')]['findOne']({'where':{'id':_0x12274d['id']}})[_0xec73('0x1b')](function(_0x38955d){if(!_['isNil'](_0x38955d)){var _0x23e7b8=_0x38955d[_0xec73('0x1c')];if(!_[_0xec73('0x19')](_0x23e7b8)){var _0x2987f8=shared[_0xec73('0x1d')];var _0x17f25f=_0x2987f8[_0x23e7b8];var _0x53193e=_0x2987f8[_0x23cb72[_0xec73('0x1c')]];if(!_[_0xec73('0x19')](_0x17f25f)&&!_[_0xec73('0x19')](_0x53193e)){var _0x5cac6d=_0x17f25f['utcOffset']-_0x53193e[_0xec73('0x1e')];_0x18d8b3=_0x23cb72['scheduledat']?_0x23cb72[_0xec73('0x1f')]:moment();var _0x1a19ae=moment(_0x18d8b3)['add'](_0x5cac6d,_0xec73('0x21'));_0x3aaa84({'ret':_0x1a19ae[_0xec73('0x17')](_0xec73('0x18'))});}else _0x3aaa84({'ret':_0x18d8b3});}else _0x3aaa84({'ret':_0x18d8b3});}else{_0x3aaa84({'ret':_0x18d8b3});}});}});return 0xa;}var _0x4a48a4=function(_0x4f144a){return new BPromise(function(_0x7d53b0,_0x1c267f){_0x15bce5(_0x4f144a,_0x4911b0)['then'](function(_0x2b851a){_0x4911b0[_0xec73('0x1f')]=_0x2b851a[_0xec73('0x22')];_0x270af3[_0xec73('0x23')][_0xec73('0x2a')]({'where':{'phone':_0x4911b0['phone'],'CampaignId':_0x4f144a['id']}})[_0xec73('0x1b')](function(_0x55d11c){if(!_[_0xec73('0x19')](_0x55d11c)){throw new Error(_0xec73('0x2b')+_0x4911b0[_0xec73('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x4f144a['id']);}return _0x270af3[_0xec73('0x23')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0['ListId'],'priority':_0x4911b0['priority']?_0x4911b0[_0xec73('0x27')]:0x2,'scheduledat':_0x4911b0[_0xec73('0x1f')]?_0x4911b0['scheduledat']:moment()[_0xec73('0x17')](_0xec73('0x18')),'callback':_0x4911b0[_0xec73('0x28')]?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0[_0xec73('0x28')]?moment()[_0xec73('0x17')](_0xec73('0x18')):undefined,'CampaignId':_0x4f144a['id']});})[_0xec73('0x29')](function(_0x455de0){_0x1c267f(_0x455de0);});});});};var _0x507747=function(_0x3eba92){return new BPromise(function(_0x2f7e0c,_0x1f27ac){_0x15bce5(_0x3eba92,_0x4911b0)[_0xec73('0x1b')](function(_0x302845){_0x4911b0[_0xec73('0x1f')]=_0x302845[_0xec73('0x22')];_0x270af3['CmHopper'][_0xec73('0x2a')]({'where':{'phone':_0x4911b0[_0xec73('0xb')],'CampaignId':_0x3eba92['id']}})['then'](function(_0x2ce860){if(!_[_0xec73('0x19')](_0x2ce860)){throw new Error(_0xec73('0x2b')+_0x4911b0['phone']+_0xec73('0x33')+_0x3eba92['id']);}return _0x270af3[_0xec73('0x2c')][_0xec73('0x2a')]({'where':{'calleridnum':_0x4911b0[_0xec73('0xb')],'CampaignId':_0x3eba92['id']}});})[_0xec73('0x1b')](function(_0x2344bf){if(!_[_0xec73('0x19')](_0x2344bf)){throw new Error(_0xec73('0x2d')+_0x4911b0[_0xec73('0xb')]+_0xec73('0x34')+_0x3eba92['id']);}return _0x270af3[_0xec73('0x23')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'priority':_0x4911b0[_0xec73('0x27')]?_0x4911b0[_0xec73('0x27')]:0x2,'scheduledat':_0x4911b0[_0xec73('0x1f')]?_0x4911b0[_0xec73('0x1f')]:moment()[_0xec73('0x17')](_0xec73('0x18')),'callback':_0x4911b0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0[_0xec73('0x28')]?moment()[_0xec73('0x17')](_0xec73('0x18')):undefined,'CampaignId':_0x3eba92['id']});})[_0xec73('0x29')](function(_0x865952){_0x1f27ac(_0x865952);});});});};if(_0x4911b0['ListId']){_0x270af3[_0xec73('0x1a')][_0xec73('0x35')]({'where':{'type':_0xec73('0x36')},'attributes':['id',_0xec73('0x37'),_0xec73('0x1c')],'include':[{'model':_0x270af3['CmList'],'as':_0xec73('0x38'),'where':{'id':_0x4911b0[_0xec73('0x26')]}}]})[_0xec73('0x1b')](function(_0x5bc018){if(_0x5bc018){var _0x4ca594=[];for(var _0x232bbc=0x0,_0x4e718b;_0x232bbc<_0x5bc018[_0xec73('0x39')];_0x232bbc+=0x1){_0x4e718b=_0x5bc018[_0x232bbc]['get']({'plain':!![]});switch(_0x4e718b[_0xec73('0x37')]){case _0xec73('0x3a'):_0x3d965d(_0x4e718b)[_0xec73('0x29')](_0x257cbc());break;case _0xec73('0x3b'):_0x16ebc9(_0x4e718b)['catch'](_0x257cbc());break;default:_0x15bce5(_0x4e718b,_0x4911b0)['then'](function(_0x408682){_0x4911b0[_0xec73('0x1f')]=_0x408682[_0xec73('0x22')];_0x270af3[_0xec73('0x23')]['create']({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'scheduledat':_0x4911b0['scheduledat']?_0x4911b0[_0xec73('0x1f')]:moment()[_0xec73('0x17')](_0xec73('0x18')),'priority':_0x4911b0['priority']?_0x4911b0[_0xec73('0x27')]:0x2,'callback':_0x4911b0[_0xec73('0x28')]?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0['callbackUniqueid']?moment()[_0xec73('0x17')](_0xec73('0x18')):undefined,'VoiceQueueId':_0x4e718b['id']})[_0xec73('0x29')](_0x257cbc());});}}}})[_0xec73('0x1b')](function(){return _0x270af3[_0xec73('0x1a')]['findAll']({'where':{'type':_0xec73('0x36')},'attributes':['id'],'include':[{'model':_0x270af3[_0xec73('0x3c')],'as':'BlackLists','where':{'id':_0x4911b0['ListId']}}]})['then'](function(_0x3e13fa){if(_0x3e13fa){var _0x394055=[];for(var _0x59096d=0x0,_0x5b0e59;_0x59096d<_0x3e13fa[_0xec73('0x39')];_0x59096d+=0x1){_0x5b0e59=_0x3e13fa[_0x59096d][_0xec73('0x15')]({'plain':!![]});_0x270af3[_0xec73('0x3d')][_0xec73('0x25')]({'phone':_0x4911b0['phone'],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'VoiceQueueId':_0x5b0e59['id']})[_0xec73('0x29')](function(_0x18f8ae){logger[_0xec73('0x16')](_0xec73('0x3e'),_0xec73('0x30'),_0x18f8ae[_0xec73('0x3f')]);});}}});})[_0xec73('0x1b')](function(){return _0x270af3[_0xec73('0x32')][_0xec73('0x35')]({'attributes':['id',_0xec73('0x37'),_0xec73('0x1c')],'include':[{'model':_0x270af3['CmList'],'as':_0xec73('0x38'),'where':{'id':_0x4911b0[_0xec73('0x26')]}}]})[_0xec73('0x1b')](function(_0xd1ec06){if(_0xd1ec06){var _0x3b34e9=[];for(var _0x5de585=0x0,_0x270838;_0x5de585<_0xd1ec06[_0xec73('0x39')];_0x5de585+=0x1){_0x270838=_0xd1ec06[_0x5de585][_0xec73('0x15')]({'plain':!![]});switch(_0x270838[_0xec73('0x37')]){case _0xec73('0x3a'):_0x507747(_0x270838)[_0xec73('0x29')](_0x3a6c70());break;case'onlyIfOpen':_0x4a48a4(_0x270838)[_0xec73('0x29')](_0x3a6c70());break;default:_0x270af3[_0xec73('0x23')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'scheduledat':_0x4911b0[_0xec73('0x1f')]?_0x4911b0[_0xec73('0x1f')]:moment()[_0xec73('0x17')](_0xec73('0x18')),'priority':_0x4911b0[_0xec73('0x27')]?_0x4911b0[_0xec73('0x27')]:0x2,'callback':_0x4911b0[_0xec73('0x28')]?!![]:![],'callbackuniqueid':_0x4911b0[_0xec73('0x28')]?_0x4911b0[_0xec73('0x28')]:undefined,'callbackat':_0x4911b0[_0xec73('0x28')]?moment()[_0xec73('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x270838['id']})[_0xec73('0x29')](_0x3a6c70());}}}});})['then'](function(){return _0x270af3[_0xec73('0x32')][_0xec73('0x35')]({'attributes':['id'],'include':[{'model':_0x270af3['CmList'],'as':_0xec73('0x40'),'where':{'id':_0x4911b0[_0xec73('0x26')]}}]})['then'](function(_0x3214f4){if(_0x3214f4){var _0x5f2eab=[];for(var _0x597cfb=0x0,_0x68b744;_0x597cfb<_0x3214f4[_0xec73('0x39')];_0x597cfb+=0x1){_0x68b744=_0x3214f4[_0x597cfb][_0xec73('0x15')]({'plain':!![]});_0x270af3[_0xec73('0x3d')][_0xec73('0x25')]({'phone':_0x4911b0[_0xec73('0xb')],'ContactId':_0x4911b0['id'],'ListId':_0x4911b0[_0xec73('0x26')],'CampaignId':_0x68b744['id']})[_0xec73('0x29')](function(_0x33af0c){logger[_0xec73('0x16')](_0xec73('0x3e'),_0xec73('0x30'),_0x33af0c[_0xec73('0x3f')]);});}}});})[_0xec73('0x1b')](function(){_0x30ace8();})[_0xec73('0x29')](function(_0x57f045){logger[_0xec73('0x16')](_0xec73('0x3e'),'afterCreate',_0x57f045[_0xec73('0x3f')]);_0x30ace8(_0x57f045);});}else{_0x30ace8(new Error(_0xec73('0x41')));}},'afterDestroy':function(_0x15db54,_0x379628,_0x2c6408){var _0x3a252f=_0x20b195[_0xec73('0x14')];var _0x1fe814=_0x15db54[_0xec73('0x15')]({'plain':!![]});return _0x3a252f[_0xec73('0x23')][_0xec73('0x35')]({'raw':!![],'where':{'ListId':_0x1fe814[_0xec73('0x26')],'ContactId':_0x1fe814['id']}})[_0xec73('0x1b')](function(_0x90c27e){if(!_[_0xec73('0x42')](_0x90c27e)){var _0x55553b=[];for(var _0x1e85e5=0x0;_0x1e85e5<_0x90c27e[_0xec73('0x39')];_0x1e85e5+=0x1){var _0x5aefef=_0x3a252f['CmHopper']['destroy']({'where':{'ListId':_0x90c27e[_0x1e85e5][_0xec73('0x26')],'ContactId':_0x90c27e[_0x1e85e5]['ContactId'],'VoiceQueueId':_0x90c27e[_0x1e85e5][_0xec73('0x43')],'CampaignId':_0x90c27e[_0x1e85e5][_0xec73('0x44')]}});_0x55553b['push'](_0x5aefef);}return BPromise[_0xec73('0x45')](_0x55553b);}})[_0xec73('0x1b')](function(_0xdcc0e0){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xec73('0x31')](_0xdcc0e0,{'showHidden':![],'depth':null}));_0x2c6408();})[_0xec73('0x29')](function(_0x1a5837){logger['error'](_0xec73('0x46'),util['inspect'](_0x1a5837,{'showHidden':![],'depth':null}));_0x2c6408(_0x1a5837);});}}});}; \ No newline at end of file +var _0xef6c=['api','moment','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','inspect','scheduledat','format','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','lodash','util'];(function(_0x1eaf2b,_0x312483){var _0x188b2e=function(_0x42405d){while(--_0x42405d){_0x1eaf2b['push'](_0x1eaf2b['shift']());}};_0x188b2e(++_0x312483);}(_0xef6c,0x175));var _0xcef6=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0xef6c[_0x51cc1d];return _0x2eb9f2;};'use strict';var _=require(_0xcef6('0x0'));var util=require(_0xcef6('0x1'));var logger=require('../../config/logger')(_0xcef6('0x2'));var moment=require(_0xcef6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcef6('0x4'));var fs=require('fs');var path=require(_0xcef6('0x5'));var rimraf=require(_0xcef6('0x6'));var config=require('../../config/environment');var shared=require(_0xcef6('0x7'));var attributes=require(_0xcef6('0x8'));module[_0xcef6('0x9')]=function(_0xba34a8,_0x326624){return _0xba34a8[_0xcef6('0xa')](_0xcef6('0xb'),attributes,{'tableName':_0xcef6('0xc'),'paranoid':!![],'indexes':[{'name':_0xcef6('0xd'),'fields':[_0xcef6('0xd')]},{'name':_0xcef6('0xe'),'fields':[_0xcef6('0xf'),'lastName',_0xcef6('0xd'),_0xcef6('0x10'),_0xcef6('0x11'),'email'],'type':_0xcef6('0x12')}],'timestamps':!![],'charset':_0xcef6('0x13'),'collate':_0xcef6('0x14'),'hooks':{'afterCreate':function(_0x476ffb,_0x2d3e17,_0x17eb47){var _0x304cb1=_0xba34a8[_0xcef6('0x15')];var _0x5aa381=_0x476ffb[_0xcef6('0x16')]({'plain':!![]});function _0x74f1d8(){return function(_0x1f005d){logger['error'](_0xcef6('0x17'),_0xcef6('0x18'),util[_0xcef6('0x19')](_0x1f005d,{'showHidden':![],'depth':null}));};}function _0x25a9a8(_0x53273c,_0x42cd15){var _0x5769bf=_0x42cd15[_0xcef6('0x1a')]?_0x42cd15[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4029be,_0x1ce8a4){if(_['isNil'](_0x42cd15[_0xcef6('0x1c')])){_0x4029be({'ret':_0x5769bf});}else{_0x304cb1[_0xcef6('0x1d')][_0xcef6('0x1e')]({'where':{'id':_0x53273c['id']}})[_0xcef6('0x1f')](function(_0x50b285){if(!_[_0xcef6('0x20')](_0x50b285)){var _0x269724=_0x50b285[_0xcef6('0x1c')];if(!_[_0xcef6('0x20')](_0x269724)){var _0x4ad99f=shared[_0xcef6('0x21')];var _0x3f24fb=_0x4ad99f[_0x269724];var _0x4e189b=_0x4ad99f[_0x42cd15[_0xcef6('0x1c')]];if(!_[_0xcef6('0x20')](_0x3f24fb)&&!_[_0xcef6('0x20')](_0x4e189b)){var _0x1eb5ca=_0x3f24fb[_0xcef6('0x22')]-_0x4e189b[_0xcef6('0x22')];_0x5769bf=_0x42cd15[_0xcef6('0x1a')]?_0x42cd15[_0xcef6('0x1a')]:moment();var _0x5c51e8=moment(_0x5769bf)[_0xcef6('0x23')](_0x1eb5ca,_0xcef6('0x24'));_0x4029be({'ret':_0x5c51e8['format'](_0xcef6('0x25'))});}else _0x4029be({'ret':_0x5769bf});}else _0x4029be({'ret':_0x5769bf});}else{_0x4029be({'ret':_0x5769bf});}});}});return 0xa;}var _0x267e66=function(_0x2a45e0){return new BPromise(function(_0x3b35c9,_0x17fa72){_0x25a9a8(_0x2a45e0,_0x5aa381)['then'](function(_0x4b8bdf){_0x5aa381[_0xcef6('0x1a')]=_0x4b8bdf[_0xcef6('0x26')];_0x304cb1[_0xcef6('0x27')][_0xcef6('0x1e')]({'where':{'phone':_0x5aa381['phone'],'VoiceQueueId':_0x2a45e0['id']}})['then'](function(_0x44d0f4){if(!_[_0xcef6('0x20')](_0x44d0f4)){throw new Error(_0xcef6('0x28')+_0x5aa381[_0xcef6('0xd')]+_0xcef6('0x29')+_0x2a45e0['id']);}return _0x304cb1['CmHopper'][_0xcef6('0x2a')]({'phone':_0x5aa381[_0xcef6('0xd')],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'priority':_0x5aa381[_0xcef6('0x2c')]?_0x5aa381[_0xcef6('0x2c')]:0x2,'scheduledat':_0x5aa381['scheduledat']?_0x5aa381['scheduledat']:moment()['format'](_0xcef6('0x25')),'callback':_0x5aa381[_0xcef6('0x2d')]?!![]:![],'callbackuniqueid':_0x5aa381[_0xcef6('0x2d')]?_0x5aa381[_0xcef6('0x2d')]:undefined,'callbackat':_0x5aa381['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2a45e0['id']});})['catch'](function(_0x5defc6){_0x17fa72(_0x5defc6);});});});};var _0x31e1c4=function(_0x386505){return new BPromise(function(_0x222011,_0x1dd521){_0x25a9a8(_0x386505,_0x5aa381)[_0xcef6('0x1f')](function(_0x8d59f1){_0x5aa381[_0xcef6('0x1a')]=_0x8d59f1[_0xcef6('0x26')];_0x304cb1[_0xcef6('0x27')][_0xcef6('0x1e')]({'where':{'phone':_0x5aa381[_0xcef6('0xd')],'VoiceQueueId':_0x386505['id']}})[_0xcef6('0x1f')](function(_0x158c0b){if(!_[_0xcef6('0x20')](_0x158c0b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5aa381[_0xcef6('0xd')]+_0xcef6('0x2e')+_0x386505['id']);}return _0x304cb1['CmHopperFinal'][_0xcef6('0x1e')]({'where':{'calleridnum':_0x5aa381[_0xcef6('0xd')],'VoiceQueueId':_0x386505['id']}});})[_0xcef6('0x1f')](function(_0x5e7a5a){if(!_[_0xcef6('0x20')](_0x5e7a5a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5aa381[_0xcef6('0xd')]+_0xcef6('0x2f')+_0x386505['id']);}return _0x304cb1[_0xcef6('0x27')][_0xcef6('0x2a')]({'phone':_0x5aa381['phone'],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'priority':_0x5aa381[_0xcef6('0x2c')]?_0x5aa381[_0xcef6('0x2c')]:0x2,'scheduledat':_0x5aa381[_0xcef6('0x1a')]?_0x5aa381[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5aa381[_0xcef6('0x2d')]?!![]:![],'callbackuniqueid':_0x5aa381['callbackUniqueid']?_0x5aa381[_0xcef6('0x2d')]:undefined,'callbackat':_0x5aa381[_0xcef6('0x2d')]?moment()[_0xcef6('0x1b')](_0xcef6('0x25')):undefined,'VoiceQueueId':_0x386505['id']});})[_0xcef6('0x30')](function(_0x28d37f){_0x1dd521(_0x28d37f);});});});};function _0x1e44b6(){return function(_0x1f16f0){logger[_0xcef6('0x31')]('cmContact','afterCreate',util['inspect'](_0x1f16f0,{'showHidden':![],'depth':null}));};}function _0x1aa7bb(_0x17bfcf,_0x56a1e4){var _0x42dba1=_0x56a1e4[_0xcef6('0x1a')]?_0x56a1e4[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')](_0xcef6('0x25'));return new BPromise(function(_0x71bb8c,_0x53a5bf){if(_[_0xcef6('0x20')](_0x56a1e4[_0xcef6('0x1c')])){_0x71bb8c({'ret':_0x42dba1});}else{_0x304cb1[_0xcef6('0x32')][_0xcef6('0x1e')]({'where':{'id':_0x17bfcf['id']}})['then'](function(_0x2aeeb2){if(!_[_0xcef6('0x20')](_0x2aeeb2)){var _0x428256=_0x2aeeb2[_0xcef6('0x1c')];if(!_[_0xcef6('0x20')](_0x428256)){var _0x172a00=shared[_0xcef6('0x21')];var _0xe96595=_0x172a00[_0x428256];var _0x24089d=_0x172a00[_0x56a1e4[_0xcef6('0x1c')]];if(!_[_0xcef6('0x20')](_0xe96595)&&!_['isNil'](_0x24089d)){var _0x2d50ce=_0xe96595[_0xcef6('0x22')]-_0x24089d['utcOffset'];_0x42dba1=_0x56a1e4[_0xcef6('0x1a')]?_0x56a1e4['scheduledat']:moment();var _0x2991bf=moment(_0x42dba1)[_0xcef6('0x23')](_0x2d50ce,'minutes');_0x71bb8c({'ret':_0x2991bf[_0xcef6('0x1b')](_0xcef6('0x25'))});}else _0x71bb8c({'ret':_0x42dba1});}else _0x71bb8c({'ret':_0x42dba1});}else{_0x71bb8c({'ret':_0x42dba1});}});}});return 0xa;}var _0x405831=function(_0x1120f8){return new BPromise(function(_0x589a52,_0x1d937f){_0x1aa7bb(_0x1120f8,_0x5aa381)['then'](function(_0x73df73){_0x5aa381[_0xcef6('0x1a')]=_0x73df73[_0xcef6('0x26')];_0x304cb1[_0xcef6('0x27')][_0xcef6('0x1e')]({'where':{'phone':_0x5aa381[_0xcef6('0xd')],'CampaignId':_0x1120f8['id']}})[_0xcef6('0x1f')](function(_0x2cd82b){if(!_['isNil'](_0x2cd82b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5aa381['phone']+_0xcef6('0x33')+_0x1120f8['id']);}return _0x304cb1['CmHopper']['create']({'phone':_0x5aa381['phone'],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'priority':_0x5aa381[_0xcef6('0x2c')]?_0x5aa381[_0xcef6('0x2c')]:0x2,'scheduledat':_0x5aa381[_0xcef6('0x1a')]?_0x5aa381[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5aa381[_0xcef6('0x2d')]?!![]:![],'callbackuniqueid':_0x5aa381[_0xcef6('0x2d')]?_0x5aa381['callbackUniqueid']:undefined,'callbackat':_0x5aa381['callbackUniqueid']?moment()[_0xcef6('0x1b')](_0xcef6('0x25')):undefined,'CampaignId':_0x1120f8['id']});})[_0xcef6('0x30')](function(_0x3efdb1){_0x1d937f(_0x3efdb1);});});});};var _0x1c7173=function(_0x4ed6c1){return new BPromise(function(_0x24fb2b,_0x24d6e4){_0x1aa7bb(_0x4ed6c1,_0x5aa381)[_0xcef6('0x1f')](function(_0xcb39a9){_0x5aa381[_0xcef6('0x1a')]=_0xcb39a9[_0xcef6('0x26')];_0x304cb1[_0xcef6('0x27')][_0xcef6('0x1e')]({'where':{'phone':_0x5aa381[_0xcef6('0xd')],'CampaignId':_0x4ed6c1['id']}})[_0xcef6('0x1f')](function(_0x31a2c1){if(!_[_0xcef6('0x20')](_0x31a2c1)){throw new Error(_0xcef6('0x28')+_0x5aa381['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x4ed6c1['id']);}return _0x304cb1[_0xcef6('0x34')][_0xcef6('0x1e')]({'where':{'calleridnum':_0x5aa381['phone'],'CampaignId':_0x4ed6c1['id']}});})['then'](function(_0x77f31){if(!_['isNil'](_0x77f31)){throw new Error(_0xcef6('0x35')+_0x5aa381[_0xcef6('0xd')]+_0xcef6('0x36')+_0x4ed6c1['id']);}return _0x304cb1[_0xcef6('0x27')][_0xcef6('0x2a')]({'phone':_0x5aa381[_0xcef6('0xd')],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'priority':_0x5aa381[_0xcef6('0x2c')]?_0x5aa381[_0xcef6('0x2c')]:0x2,'scheduledat':_0x5aa381[_0xcef6('0x1a')]?_0x5aa381[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')](_0xcef6('0x25')),'callback':_0x5aa381[_0xcef6('0x2d')]?!![]:![],'callbackuniqueid':_0x5aa381['callbackUniqueid']?_0x5aa381[_0xcef6('0x2d')]:undefined,'callbackat':_0x5aa381['callbackUniqueid']?moment()[_0xcef6('0x1b')](_0xcef6('0x25')):undefined,'CampaignId':_0x4ed6c1['id']});})['catch'](function(_0x5aa5e3){_0x24d6e4(_0x5aa5e3);});});});};if(_0x5aa381[_0xcef6('0x2b')]){_0x304cb1[_0xcef6('0x1d')]['findAll']({'where':{'type':_0xcef6('0x37')},'attributes':['id',_0xcef6('0x38'),'dialTimezone'],'include':[{'model':_0x304cb1[_0xcef6('0x39')],'as':'Lists','where':{'id':_0x5aa381[_0xcef6('0x2b')]}}]})[_0xcef6('0x1f')](function(_0x2c2ca6){if(_0x2c2ca6){var _0x4fcf40=[];for(var _0x5704c3=0x0,_0x2dae29;_0x5704c3<_0x2c2ca6[_0xcef6('0x3a')];_0x5704c3+=0x1){_0x2dae29=_0x2c2ca6[_0x5704c3][_0xcef6('0x16')]({'plain':!![]});switch(_0x2dae29[_0xcef6('0x38')]){case _0xcef6('0x3b'):_0x31e1c4(_0x2dae29)[_0xcef6('0x30')](_0x74f1d8());break;case _0xcef6('0x3c'):_0x267e66(_0x2dae29)['catch'](_0x74f1d8());break;default:_0x1aa7bb(_0x2dae29,_0x5aa381)[_0xcef6('0x1f')](function(_0x1b6433){_0x5aa381[_0xcef6('0x1a')]=_0x1b6433[_0xcef6('0x26')];_0x304cb1[_0xcef6('0x27')][_0xcef6('0x2a')]({'phone':_0x5aa381[_0xcef6('0xd')],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381['ListId'],'scheduledat':_0x5aa381[_0xcef6('0x1a')]?_0x5aa381['scheduledat']:moment()[_0xcef6('0x1b')](_0xcef6('0x25')),'priority':_0x5aa381[_0xcef6('0x2c')]?_0x5aa381[_0xcef6('0x2c')]:0x2,'callback':_0x5aa381['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5aa381[_0xcef6('0x2d')]?_0x5aa381[_0xcef6('0x2d')]:undefined,'callbackat':_0x5aa381[_0xcef6('0x2d')]?moment()[_0xcef6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2dae29['id']})[_0xcef6('0x30')](_0x74f1d8());});}}}})[_0xcef6('0x1f')](function(){return _0x304cb1['VoiceQueue'][_0xcef6('0x3d')]({'where':{'type':_0xcef6('0x37')},'attributes':['id'],'include':[{'model':_0x304cb1[_0xcef6('0x39')],'as':_0xcef6('0x3e'),'where':{'id':_0x5aa381[_0xcef6('0x2b')]}}]})[_0xcef6('0x1f')](function(_0x45f6de){if(_0x45f6de){var _0x2809f8=[];for(var _0x1a2634=0x0,_0x42873a;_0x1a2634<_0x45f6de[_0xcef6('0x3a')];_0x1a2634+=0x1){_0x42873a=_0x45f6de[_0x1a2634][_0xcef6('0x16')]({'plain':!![]});_0x304cb1[_0xcef6('0x3f')][_0xcef6('0x2a')]({'phone':_0x5aa381[_0xcef6('0xd')],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'VoiceQueueId':_0x42873a['id']})['catch'](function(_0x1f9aaf){logger[_0xcef6('0x31')](_0xcef6('0x40'),_0xcef6('0x18'),_0x1f9aaf[_0xcef6('0x41')]);});}}});})[_0xcef6('0x1f')](function(){return _0x304cb1[_0xcef6('0x32')][_0xcef6('0x3d')]({'attributes':['id',_0xcef6('0x38'),'dialTimezone'],'include':[{'model':_0x304cb1['CmList'],'as':_0xcef6('0x42'),'where':{'id':_0x5aa381[_0xcef6('0x2b')]}}]})[_0xcef6('0x1f')](function(_0x439a6f){if(_0x439a6f){var _0x572f38=[];for(var _0x402972=0x0,_0x1a7f67;_0x402972<_0x439a6f['length'];_0x402972+=0x1){_0x1a7f67=_0x439a6f[_0x402972][_0xcef6('0x16')]({'plain':!![]});switch(_0x1a7f67[_0xcef6('0x38')]){case _0xcef6('0x3b'):_0x1c7173(_0x1a7f67)[_0xcef6('0x30')](_0x1e44b6());break;case _0xcef6('0x3c'):_0x405831(_0x1a7f67)[_0xcef6('0x30')](_0x1e44b6());break;default:_0x304cb1[_0xcef6('0x27')][_0xcef6('0x2a')]({'phone':_0x5aa381['phone'],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'scheduledat':_0x5aa381[_0xcef6('0x1a')]?_0x5aa381[_0xcef6('0x1a')]:moment()[_0xcef6('0x1b')](_0xcef6('0x25')),'priority':_0x5aa381['priority']?_0x5aa381['priority']:0x2,'callback':_0x5aa381[_0xcef6('0x2d')]?!![]:![],'callbackuniqueid':_0x5aa381[_0xcef6('0x2d')]?_0x5aa381[_0xcef6('0x2d')]:undefined,'callbackat':_0x5aa381[_0xcef6('0x2d')]?moment()['format'](_0xcef6('0x25')):undefined,'CampaignId':_0x1a7f67['id']})[_0xcef6('0x30')](_0x1e44b6());}}}});})[_0xcef6('0x1f')](function(){return _0x304cb1[_0xcef6('0x32')]['findAll']({'attributes':['id'],'include':[{'model':_0x304cb1[_0xcef6('0x39')],'as':_0xcef6('0x3e'),'where':{'id':_0x5aa381[_0xcef6('0x2b')]}}]})[_0xcef6('0x1f')](function(_0x36b98e){if(_0x36b98e){var _0x506770=[];for(var _0x23e17a=0x0,_0x410701;_0x23e17a<_0x36b98e[_0xcef6('0x3a')];_0x23e17a+=0x1){_0x410701=_0x36b98e[_0x23e17a][_0xcef6('0x16')]({'plain':!![]});_0x304cb1[_0xcef6('0x3f')]['create']({'phone':_0x5aa381['phone'],'ContactId':_0x5aa381['id'],'ListId':_0x5aa381[_0xcef6('0x2b')],'CampaignId':_0x410701['id']})[_0xcef6('0x30')](function(_0x37b2ad){logger['error'](_0xcef6('0x40'),_0xcef6('0x18'),_0x37b2ad['message']);});}}});})[_0xcef6('0x1f')](function(){_0x17eb47();})[_0xcef6('0x30')](function(_0x16875b){logger[_0xcef6('0x31')](_0xcef6('0x40'),_0xcef6('0x18'),_0x16875b[_0xcef6('0x41')]);_0x17eb47(_0x16875b);});}else{_0x17eb47(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x239beb,_0x311c6b,_0x273ad3){var _0x223c72=_0xba34a8[_0xcef6('0x15')];var _0x134362=_0x239beb[_0xcef6('0x16')]({'plain':!![]});return _0x223c72[_0xcef6('0x27')][_0xcef6('0x3d')]({'raw':!![],'where':{'ListId':_0x134362[_0xcef6('0x2b')],'ContactId':_0x134362['id']}})['then'](function(_0x148bbe){if(!_[_0xcef6('0x43')](_0x148bbe)){var _0x11dd38=[];for(var _0x1ceb68=0x0;_0x1ceb68<_0x148bbe[_0xcef6('0x3a')];_0x1ceb68+=0x1){var _0x4e23c5=_0x223c72[_0xcef6('0x27')][_0xcef6('0x44')]({'where':{'ListId':_0x148bbe[_0x1ceb68][_0xcef6('0x2b')],'ContactId':_0x148bbe[_0x1ceb68][_0xcef6('0x45')],'VoiceQueueId':_0x148bbe[_0x1ceb68][_0xcef6('0x46')],'CampaignId':_0x148bbe[_0x1ceb68][_0xcef6('0x47')]}});_0x11dd38[_0xcef6('0x48')](_0x4e23c5);}return BPromise[_0xcef6('0x49')](_0x11dd38);}})[_0xcef6('0x1f')](function(_0x2dd8d3){logger['info'](_0xcef6('0x4a'),util[_0xcef6('0x19')](_0x2dd8d3,{'showHidden':![],'depth':null}));_0x273ad3();})[_0xcef6('0x30')](function(_0x3f9c03){logger[_0xcef6('0x31')]('[CmContact][afterDestroy][Error]',util[_0xcef6('0x19')](_0x3f9c03,{'showHidden':![],'depth':null}));_0x273ad3(_0x3f9c03);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d8a0a27..f7419dd 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x56e4dc,_0x3361dd){var _0x5606c4=function(_0x4d9e4c){while(--_0x4d9e4c){_0x56e4dc['push'](_0x56e4dc['shift']());}};_0x5606c4(++_0x3361dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 ece6bd9..6362475 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 _0xd82a=['STRING','sequelize','exports','INTEGER'];(function(_0x49e02c,_0x88247){var _0xa40e64=function(_0x5c202a){while(--_0x5c202a){_0x49e02c['push'](_0x49e02c['shift']());}};_0xa40e64(++_0x88247);}(_0xd82a,0xbd));var _0xad82=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xd82a[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0xad82('0x0'));module[_0xad82('0x1')]={'CmContactId':{'type':Sequelize[_0xad82('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xad82('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xad82('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xad82('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xad82('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x86fd=['exports','INTEGER','STRING','sequelize'];(function(_0x82e33c,_0x22d691){var _0x37d87e=function(_0x565ac2){while(--_0x565ac2){_0x82e33c['push'](_0x82e33c['shift']());}};_0x37d87e(++_0x22d691);}(_0x86fd,0xa7));var _0xd86f=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x86fd[_0x424501];return _0xb719af;};'use strict';var Sequelize=require(_0xd86f('0x0'));module[_0xd86f('0x1')]={'CmContactId':{'type':Sequelize[_0xd86f('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd86f('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd86f('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xd86f('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xd86f('0x3')],'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 e48b2ae..502db35 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 _0x8abb=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','name','send','index','CmContactHasItem','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x4a26a9,_0x109438){var _0x3ff10f=function(_0x540033){while(--_0x540033){_0x4a26a9['push'](_0x4a26a9['shift']());}};_0x3ff10f(++_0x109438);}(_0x8abb,0x1ef));var _0xb8ab=function(_0x33ace0,_0x484301){_0x33ace0=_0x33ace0-0x0;var _0xcd0e6a=_0x8abb[_0x33ace0];return _0xcd0e6a;};'use strict';var emlformat=require(_0xb8ab('0x0'));var rimraf=require(_0xb8ab('0x1'));var zipdir=require(_0xb8ab('0x2'));var jsonpatch=require(_0xb8ab('0x3'));var rp=require(_0xb8ab('0x4'));var moment=require(_0xb8ab('0x5'));var BPromise=require(_0xb8ab('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb8ab('0x7'));var sox=require(_0xb8ab('0x8'));var csv=require(_0xb8ab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8ab('0xa'));var squel=require(_0xb8ab('0xb'));var crypto=require(_0xb8ab('0xc'));var jsforce=require(_0xb8ab('0xd'));var deskjs=require(_0xb8ab('0xe'));var toCsv=require(_0xb8ab('0x9'));var querystring=require(_0xb8ab('0xf'));var Papa=require(_0xb8ab('0x10'));var Redis=require(_0xb8ab('0x11'));var authService=require(_0xb8ab('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb8ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8ab('0x14'))(_0xb8ab('0x15'));var utils=require(_0xb8ab('0x16'));var config=require(_0xb8ab('0x17'));var licenseUtil=require(_0xb8ab('0x18'));var db=require(_0xb8ab('0x19'))['db'];function respondWithStatusCode(_0x321c62,_0x3d69cd){_0x3d69cd=_0x3d69cd||0xcc;return function(_0x1952fe){if(_0x1952fe){return _0x321c62['sendStatus'](_0x3d69cd);}return _0x321c62['status'](_0x3d69cd)[_0xb8ab('0x1a')]();};}function respondWithResult(_0x2505ce,_0x5a57b5){_0x5a57b5=_0x5a57b5||0xc8;return function(_0x10b876){if(_0x10b876){return _0x2505ce[_0xb8ab('0x1b')](_0x5a57b5)[_0xb8ab('0x1c')](_0x10b876);}};}function respondWithFilteredResult(_0x4fd554,_0x1588fb){return function(_0x27c27a){if(_0x27c27a){var _0x35cea=typeof _0x1588fb[_0xb8ab('0x1d')]==='undefined'&&typeof _0x1588fb[_0xb8ab('0x1e')]==='undefined';var _0x19b6fb=_0x27c27a[_0xb8ab('0x1f')];var _0x579c2a=_0x35cea?0x0:_0x1588fb['offset'];var _0x10aedc=_0x35cea?_0x27c27a[_0xb8ab('0x1f')]:_0x1588fb[_0xb8ab('0x1d')]+_0x1588fb[_0xb8ab('0x1e')];var _0x177058;if(_0x10aedc>=_0x19b6fb){_0x10aedc=_0x19b6fb;_0x177058=0xc8;}else{_0x177058=0xce;}_0x4fd554[_0xb8ab('0x1b')](_0x177058);return _0x4fd554['set'](_0xb8ab('0x20'),_0x579c2a+'-'+_0x10aedc+'/'+_0x19b6fb)[_0xb8ab('0x1c')](_0x27c27a);}return null;};}function patchUpdates(_0x4d7574){return function(_0x36a1fa){try{jsonpatch[_0xb8ab('0x21')](_0x36a1fa,_0x4d7574,!![]);}catch(_0x578a5a){return BPromise[_0xb8ab('0x22')](_0x578a5a);}return _0x36a1fa[_0xb8ab('0x23')]();};}function saveUpdates(_0x4d591a,_0x331a37){return function(_0x514d36){if(_0x514d36){return _0x514d36['update'](_0x4d591a)[_0xb8ab('0x24')](function(_0x42e24e){return _0x42e24e;});}return null;};}function removeEntity(_0x4d661d,_0x2941f5){return function(_0x3c4afd){if(_0x3c4afd){return _0x3c4afd[_0xb8ab('0x25')]()[_0xb8ab('0x24')](function(){var _0x40e02d=_0x3c4afd[_0xb8ab('0x26')]({'plain':!![]});var _0x1e2d8f=_0xb8ab('0x27');return db[_0xb8ab('0x28')]['destroy']({'where':{'type':_0x1e2d8f,'resourceId':_0x40e02d['id']}})['then'](function(){return _0x3c4afd;});})['then'](function(){_0x4d661d[_0xb8ab('0x1b')](0xcc)[_0xb8ab('0x1a')]();});}};}function handleEntityNotFound(_0x5bd009,_0x1a3ff0){return function(_0x58187d){if(!_0x58187d){_0x5bd009['sendStatus'](0x194);}return _0x58187d;};}function handleError(_0x549d0f,_0x539893){_0x539893=_0x539893||0x1f4;return function(_0x32e881){logger[_0xb8ab('0x29')](_0x32e881['stack']);if(_0x32e881['name']){delete _0x32e881[_0xb8ab('0x2a')];}_0x549d0f[_0xb8ab('0x1b')](_0x539893)[_0xb8ab('0x2b')](_0x32e881);};}exports[_0xb8ab('0x2c')]=function(_0x33f6b3,_0x5641fa){var _0x13ad1d={},_0x5aa838={},_0xda26b3={'count':0x0,'rows':[]};var _0x2e0d50=_['map'](db[_0xb8ab('0x2d')]['rawAttributes'],function(_0x55a5e8){return{'name':_0x55a5e8[_0xb8ab('0x2e')],'type':_0x55a5e8[_0xb8ab('0x2f')][_0xb8ab('0x30')]};});_0x5aa838[_0xb8ab('0x31')]=_[_0xb8ab('0x32')](_0x2e0d50,'name');_0x5aa838[_0xb8ab('0x33')]=_[_0xb8ab('0x34')](_0x33f6b3['query']);_0x5aa838['filters']=_['intersection'](_0x5aa838[_0xb8ab('0x31')],_0x5aa838[_0xb8ab('0x33')]);_0x13ad1d[_0xb8ab('0x35')]=_[_0xb8ab('0x36')](_0x5aa838[_0xb8ab('0x31')],qs['fields'](_0x33f6b3[_0xb8ab('0x33')][_0xb8ab('0x37')]));_0x13ad1d[_0xb8ab('0x35')]=_0x13ad1d[_0xb8ab('0x35')][_0xb8ab('0x38')]?_0x13ad1d['attributes']:_0x5aa838[_0xb8ab('0x31')];if(!_0x33f6b3[_0xb8ab('0x33')][_0xb8ab('0x39')](_0xb8ab('0x3a'))){_0x13ad1d[_0xb8ab('0x1e')]=qs[_0xb8ab('0x1e')](_0x33f6b3[_0xb8ab('0x33')][_0xb8ab('0x1e')]);_0x13ad1d['offset']=qs['offset'](_0x33f6b3[_0xb8ab('0x33')][_0xb8ab('0x1d')]);}_0x13ad1d[_0xb8ab('0x3b')]=qs[_0xb8ab('0x3c')](_0x33f6b3['query'][_0xb8ab('0x3c')]);_0x13ad1d[_0xb8ab('0x3d')]=qs['filters'](_[_0xb8ab('0x3e')](_0x33f6b3[_0xb8ab('0x33')],_0x5aa838[_0xb8ab('0x3f')]),_0x2e0d50);if(_0x33f6b3[_0xb8ab('0x33')]['filter']){_0x13ad1d['where']=_[_0xb8ab('0x40')](_0x13ad1d[_0xb8ab('0x3d')],{'$or':_[_0xb8ab('0x32')](_0x2e0d50,function(_0x96c5cd){if(_0x96c5cd['type']!==_0xb8ab('0x41')){var _0x2eb7ab={};_0x2eb7ab[_0x96c5cd[_0xb8ab('0x2a')]]={'$like':'%'+_0x33f6b3['query'][_0xb8ab('0x42')]+'%'};return _0x2eb7ab;}})});}_0x13ad1d=_[_0xb8ab('0x40')]({},_0x13ad1d,_0x33f6b3[_0xb8ab('0x43')]);var _0x8a4309={'where':_0x13ad1d[_0xb8ab('0x3d')]};return db[_0xb8ab('0x2d')]['count'](_0x8a4309)[_0xb8ab('0x24')](function(_0x42ba24){_0xda26b3[_0xb8ab('0x1f')]=_0x42ba24;if(_0x33f6b3[_0xb8ab('0x33')][_0xb8ab('0x44')]){_0x13ad1d[_0xb8ab('0x45')]=[{'all':!![]}];}return db[_0xb8ab('0x2d')][_0xb8ab('0x46')](_0x13ad1d);})['then'](function(_0x14db96){_0xda26b3[_0xb8ab('0x47')]=_0x14db96;return _0xda26b3;})[_0xb8ab('0x24')](respondWithFilteredResult(_0x5641fa,_0x13ad1d))['catch'](handleError(_0x5641fa,null));};exports[_0xb8ab('0x48')]=function(_0x3d4cab,_0x2300b0){var _0x150e68={'raw':!![],'where':{'id':_0x3d4cab[_0xb8ab('0x49')]['id']}},_0x1bbc5a={};_0x1bbc5a[_0xb8ab('0x31')]=_[_0xb8ab('0x34')](db[_0xb8ab('0x2d')][_0xb8ab('0x4a')]);_0x1bbc5a[_0xb8ab('0x33')]=_['keys'](_0x3d4cab[_0xb8ab('0x33')]);_0x1bbc5a[_0xb8ab('0x3f')]=_[_0xb8ab('0x36')](_0x1bbc5a[_0xb8ab('0x31')],_0x1bbc5a[_0xb8ab('0x33')]);_0x150e68[_0xb8ab('0x35')]=_[_0xb8ab('0x36')](_0x1bbc5a[_0xb8ab('0x31')],qs[_0xb8ab('0x37')](_0x3d4cab[_0xb8ab('0x33')][_0xb8ab('0x37')]));_0x150e68['attributes']=_0x150e68[_0xb8ab('0x35')][_0xb8ab('0x38')]?_0x150e68[_0xb8ab('0x35')]:_0x1bbc5a['model'];if(_0x3d4cab[_0xb8ab('0x33')][_0xb8ab('0x44')]){_0x150e68[_0xb8ab('0x45')]=[{'all':!![]}];}_0x150e68=_[_0xb8ab('0x40')]({},_0x150e68,_0x3d4cab[_0xb8ab('0x43')]);return db[_0xb8ab('0x2d')]['find'](_0x150e68)[_0xb8ab('0x24')](handleEntityNotFound(_0x2300b0,null))['then'](respondWithResult(_0x2300b0,null))[_0xb8ab('0x4b')](handleError(_0x2300b0,null));};exports['create']=function(_0x257d77,_0x12b47e){return db[_0xb8ab('0x2d')][_0xb8ab('0x4c')](_0x257d77[_0xb8ab('0x4d')],{})['then'](function(_0x5315e4){var _0xc35a31=_0x257d77['user'][_0xb8ab('0x26')]({'plain':!![]});if(!_0xc35a31)throw new Error(_0xb8ab('0x4e'));if(_0xc35a31['role']===_0xb8ab('0x4f')){var _0xc0c0f1=_0x5315e4[_0xb8ab('0x26')]({'plain':!![]});var _0x5200a8=_0xb8ab('0x27');return db[_0xb8ab('0x50')][_0xb8ab('0x51')]({'where':{'name':_0x5200a8,'userProfileId':_0xc35a31[_0xb8ab('0x52')]},'raw':!![]})[_0xb8ab('0x24')](function(_0x552d12){if(_0x552d12&&_0x552d12['autoAssociation']===0x0){return db[_0xb8ab('0x28')][_0xb8ab('0x4c')]({'name':_0xc0c0f1[_0xb8ab('0x2a')],'resourceId':_0xc0c0f1['id'],'type':_0x552d12[_0xb8ab('0x2a')],'sectionId':_0x552d12['id']},{})[_0xb8ab('0x24')](function(){return _0x5315e4;});}else{return _0x5315e4;}})[_0xb8ab('0x4b')](function(_0x11bbf2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11bbf2);throw _0x11bbf2;});}return _0x5315e4;})['then'](respondWithResult(_0x12b47e,0xc9))[_0xb8ab('0x4b')](handleError(_0x12b47e,null));};exports[_0xb8ab('0x53')]=function(_0x29f046,_0x5f3be9){if(_0x29f046['body']['id']){delete _0x29f046[_0xb8ab('0x4d')]['id'];}return db[_0xb8ab('0x2d')][_0xb8ab('0x51')]({'where':{'id':_0x29f046['params']['id']}})[_0xb8ab('0x24')](handleEntityNotFound(_0x5f3be9,null))['then'](saveUpdates(_0x29f046[_0xb8ab('0x4d')],null))[_0xb8ab('0x24')](respondWithResult(_0x5f3be9,null))[_0xb8ab('0x4b')](handleError(_0x5f3be9,null));};exports[_0xb8ab('0x25')]=function(_0x1e6b06,_0x49e098){return db[_0xb8ab('0x2d')][_0xb8ab('0x51')]({'where':{'id':_0x1e6b06[_0xb8ab('0x49')]['id']}})[_0xb8ab('0x24')](handleEntityNotFound(_0x49e098,null))[_0xb8ab('0x24')](removeEntity(_0x49e098,null))[_0xb8ab('0x4b')](handleError(_0x49e098,null));}; \ No newline at end of file +var _0x409d=['set','json','apply','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','name','index','map','CmContactHasItem','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','include','rows','catch','params','rawAttributes','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','offset','undefined','limit','count'];(function(_0x492e3d,_0x1cdf2d){var _0x325396=function(_0x3afc8d){while(--_0x3afc8d){_0x492e3d['push'](_0x492e3d['shift']());}};_0x325396(++_0x1cdf2d);}(_0x409d,0x7c));var _0xd409=function(_0x4e6825,_0x5a7bbd){_0x4e6825=_0x4e6825-0x0;var _0x356808=_0x409d[_0x4e6825];return _0x356808;};'use strict';var emlformat=require(_0xd409('0x0'));var rimraf=require(_0xd409('0x1'));var zipdir=require(_0xd409('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd409('0x3'));var moment=require(_0xd409('0x4'));var BPromise=require(_0xd409('0x5'));var Mustache=require(_0xd409('0x6'));var util=require(_0xd409('0x7'));var path=require(_0xd409('0x8'));var sox=require('sox');var csv=require(_0xd409('0x9'));var ejs=require(_0xd409('0xa'));var fs=require('fs');var fs_extra=require(_0xd409('0xb'));var _=require(_0xd409('0xc'));var squel=require(_0xd409('0xd'));var crypto=require(_0xd409('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd409('0xf'));var toCsv=require(_0xd409('0x9'));var querystring=require(_0xd409('0x10'));var Papa=require(_0xd409('0x11'));var Redis=require(_0xd409('0x12'));var authService=require(_0xd409('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd409('0x14'));var logger=require(_0xd409('0x15'))(_0xd409('0x16'));var utils=require('../../config/utils');var config=require(_0xd409('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348e43,_0x383565){_0x383565=_0x383565||0xcc;return function(_0x1420a7){if(_0x1420a7){return _0x348e43['sendStatus'](_0x383565);}return _0x348e43[_0xd409('0x18')](_0x383565)[_0xd409('0x19')]();};}function respondWithResult(_0x4735c2,_0x3d5c50){_0x3d5c50=_0x3d5c50||0xc8;return function(_0x509eb8){if(_0x509eb8){return _0x4735c2[_0xd409('0x18')](_0x3d5c50)['json'](_0x509eb8);}};}function respondWithFilteredResult(_0x13f955,_0x53c755){return function(_0x21683a){if(_0x21683a){var _0x10bae2=typeof _0x53c755[_0xd409('0x1a')]===_0xd409('0x1b')&&typeof _0x53c755[_0xd409('0x1c')]===_0xd409('0x1b');var _0x578c80=_0x21683a[_0xd409('0x1d')];var _0x5342fd=_0x10bae2?0x0:_0x53c755[_0xd409('0x1a')];var _0x61c562=_0x10bae2?_0x21683a[_0xd409('0x1d')]:_0x53c755[_0xd409('0x1a')]+_0x53c755[_0xd409('0x1c')];var _0x7832dc;if(_0x61c562>=_0x578c80){_0x61c562=_0x578c80;_0x7832dc=0xc8;}else{_0x7832dc=0xce;}_0x13f955[_0xd409('0x18')](_0x7832dc);return _0x13f955[_0xd409('0x1e')]('Content-Range',_0x5342fd+'-'+_0x61c562+'/'+_0x578c80)[_0xd409('0x1f')](_0x21683a);}return null;};}function patchUpdates(_0x3e5b31){return function(_0x47b45c){try{jsonpatch[_0xd409('0x20')](_0x47b45c,_0x3e5b31,!![]);}catch(_0x507f5c){return BPromise['reject'](_0x507f5c);}return _0x47b45c['save']();};}function saveUpdates(_0x5ec38a,_0x58a345){return function(_0x3c3a57){if(_0x3c3a57){return _0x3c3a57[_0xd409('0x21')](_0x5ec38a)[_0xd409('0x22')](function(_0x9e9882){return _0x9e9882;});}return null;};}function removeEntity(_0x51b844,_0x9aa953){return function(_0x12bdcd){if(_0x12bdcd){return _0x12bdcd[_0xd409('0x23')]()[_0xd409('0x22')](function(){var _0x406208=_0x12bdcd[_0xd409('0x24')]({'plain':!![]});var _0x214b4d=_0xd409('0x25');return db[_0xd409('0x26')][_0xd409('0x23')]({'where':{'type':_0x214b4d,'resourceId':_0x406208['id']}})['then'](function(){return _0x12bdcd;});})[_0xd409('0x22')](function(){_0x51b844['status'](0xcc)[_0xd409('0x19')]();});}};}function handleEntityNotFound(_0x496ea6,_0x5199a0){return function(_0x3e0642){if(!_0x3e0642){_0x496ea6[_0xd409('0x27')](0x194);}return _0x3e0642;};}function handleError(_0x121669,_0x13c2bc){_0x13c2bc=_0x13c2bc||0x1f4;return function(_0x3b6af8){logger['error'](_0x3b6af8['stack']);if(_0x3b6af8[_0xd409('0x28')]){delete _0x3b6af8['name'];}_0x121669['status'](_0x13c2bc)['send'](_0x3b6af8);};}exports[_0xd409('0x29')]=function(_0x29b7cf,_0x582918){var _0x98cfea={},_0x5153c9={},_0x49aeb3={'count':0x0,'rows':[]};var _0x337dab=_[_0xd409('0x2a')](db[_0xd409('0x2b')]['rawAttributes'],function(_0x380036){return{'name':_0x380036[_0xd409('0x2c')],'type':_0x380036[_0xd409('0x2d')][_0xd409('0x2e')]};});_0x5153c9[_0xd409('0x2f')]=_['map'](_0x337dab,'name');_0x5153c9[_0xd409('0x30')]=_['keys'](_0x29b7cf[_0xd409('0x30')]);_0x5153c9[_0xd409('0x31')]=_[_0xd409('0x32')](_0x5153c9[_0xd409('0x2f')],_0x5153c9['query']);_0x98cfea[_0xd409('0x33')]=_['intersection'](_0x5153c9[_0xd409('0x2f')],qs[_0xd409('0x34')](_0x29b7cf['query'][_0xd409('0x34')]));_0x98cfea['attributes']=_0x98cfea[_0xd409('0x33')][_0xd409('0x35')]?_0x98cfea['attributes']:_0x5153c9[_0xd409('0x2f')];if(!_0x29b7cf['query'][_0xd409('0x36')](_0xd409('0x37'))){_0x98cfea[_0xd409('0x1c')]=qs['limit'](_0x29b7cf['query'][_0xd409('0x1c')]);_0x98cfea[_0xd409('0x1a')]=qs['offset'](_0x29b7cf[_0xd409('0x30')][_0xd409('0x1a')]);}_0x98cfea['order']=qs['sort'](_0x29b7cf[_0xd409('0x30')][_0xd409('0x38')]);_0x98cfea['where']=qs['filters'](_[_0xd409('0x39')](_0x29b7cf[_0xd409('0x30')],_0x5153c9[_0xd409('0x31')]),_0x337dab);if(_0x29b7cf[_0xd409('0x30')][_0xd409('0x3a')]){_0x98cfea[_0xd409('0x3b')]=_[_0xd409('0x3c')](_0x98cfea[_0xd409('0x3b')],{'$or':_[_0xd409('0x2a')](_0x337dab,function(_0xdc1fc4){if(_0xdc1fc4[_0xd409('0x2d')]!=='VIRTUAL'){var _0x598b99={};_0x598b99[_0xdc1fc4[_0xd409('0x28')]]={'$like':'%'+_0x29b7cf[_0xd409('0x30')]['filter']+'%'};return _0x598b99;}})});}_0x98cfea=_['merge']({},_0x98cfea,_0x29b7cf['options']);var _0x5bdbf8={'where':_0x98cfea['where']};return db[_0xd409('0x2b')][_0xd409('0x1d')](_0x5bdbf8)[_0xd409('0x22')](function(_0x93de6b){_0x49aeb3['count']=_0x93de6b;if(_0x29b7cf[_0xd409('0x30')][_0xd409('0x3d')]){_0x98cfea[_0xd409('0x3e')]=[{'all':!![]}];}return db[_0xd409('0x2b')]['findAll'](_0x98cfea);})[_0xd409('0x22')](function(_0x1527a7){_0x49aeb3[_0xd409('0x3f')]=_0x1527a7;return _0x49aeb3;})['then'](respondWithFilteredResult(_0x582918,_0x98cfea))[_0xd409('0x40')](handleError(_0x582918,null));};exports['show']=function(_0x373007,_0x3a4033){var _0x200f6e={'raw':!![],'where':{'id':_0x373007[_0xd409('0x41')]['id']}},_0x33a337={};_0x33a337[_0xd409('0x2f')]=_['keys'](db[_0xd409('0x2b')][_0xd409('0x42')]);_0x33a337[_0xd409('0x30')]=_[_0xd409('0x43')](_0x373007['query']);_0x33a337['filters']=_['intersection'](_0x33a337[_0xd409('0x2f')],_0x33a337[_0xd409('0x30')]);_0x200f6e[_0xd409('0x33')]=_[_0xd409('0x32')](_0x33a337[_0xd409('0x2f')],qs[_0xd409('0x34')](_0x373007[_0xd409('0x30')][_0xd409('0x34')]));_0x200f6e[_0xd409('0x33')]=_0x200f6e[_0xd409('0x33')][_0xd409('0x35')]?_0x200f6e[_0xd409('0x33')]:_0x33a337[_0xd409('0x2f')];if(_0x373007[_0xd409('0x30')][_0xd409('0x3d')]){_0x200f6e[_0xd409('0x3e')]=[{'all':!![]}];}_0x200f6e=_['merge']({},_0x200f6e,_0x373007['options']);return db[_0xd409('0x2b')]['find'](_0x200f6e)[_0xd409('0x22')](handleEntityNotFound(_0x3a4033,null))[_0xd409('0x22')](respondWithResult(_0x3a4033,null))['catch'](handleError(_0x3a4033,null));};exports['create']=function(_0x3574e7,_0x3c29b7){return db[_0xd409('0x2b')][_0xd409('0x44')](_0x3574e7[_0xd409('0x45')],{})[_0xd409('0x22')](function(_0x121681){var _0x32e87f=_0x3574e7[_0xd409('0x46')][_0xd409('0x24')]({'plain':!![]});if(!_0x32e87f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32e87f[_0xd409('0x47')]==='user'){var _0x38f1f0=_0x121681['get']({'plain':!![]});var _0x107850=_0xd409('0x25');return db[_0xd409('0x48')][_0xd409('0x49')]({'where':{'name':_0x107850,'userProfileId':_0x32e87f[_0xd409('0x4a')]},'raw':!![]})[_0xd409('0x22')](function(_0x14ed57){if(_0x14ed57&&_0x14ed57[_0xd409('0x4b')]===0x0){return db[_0xd409('0x26')][_0xd409('0x44')]({'name':_0x38f1f0[_0xd409('0x28')],'resourceId':_0x38f1f0['id'],'type':_0x14ed57[_0xd409('0x28')],'sectionId':_0x14ed57['id']},{})[_0xd409('0x22')](function(){return _0x121681;});}else{return _0x121681;}})[_0xd409('0x40')](function(_0x4dfed8){logger[_0xd409('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dfed8);throw _0x4dfed8;});}return _0x121681;})[_0xd409('0x22')](respondWithResult(_0x3c29b7,0xc9))['catch'](handleError(_0x3c29b7,null));};exports['update']=function(_0x24c607,_0x581808){if(_0x24c607[_0xd409('0x45')]['id']){delete _0x24c607[_0xd409('0x45')]['id'];}return db[_0xd409('0x2b')][_0xd409('0x49')]({'where':{'id':_0x24c607[_0xd409('0x41')]['id']}})[_0xd409('0x22')](handleEntityNotFound(_0x581808,null))['then'](saveUpdates(_0x24c607[_0xd409('0x45')],null))[_0xd409('0x22')](respondWithResult(_0x581808,null))[_0xd409('0x40')](handleError(_0x581808,null));};exports['destroy']=function(_0x57a06f,_0x30f855){return db[_0xd409('0x2b')][_0xd409('0x49')]({'where':{'id':_0x57a06f[_0xd409('0x41')]['id']}})['then'](handleEntityNotFound(_0x30f855,null))['then'](removeEntity(_0x30f855,null))['catch'](handleError(_0x30f855,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index b387a3d..dfae62c 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 _0x9c0b=['exports','CmContactHasItem','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9c0b,0xb2));var _0xb9c0=function(_0x340907,_0x4a9781){_0x340907=_0x340907-0x0;var _0x1cd555=_0x9c0b[_0x340907];return _0x1cd555;};'use strict';var _=require(_0xb9c0('0x0'));var util=require('util');var logger=require(_0xb9c0('0x1'))(_0xb9c0('0x2'));var moment=require('moment');var BPromise=require(_0xb9c0('0x3'));var rp=require(_0xb9c0('0x4'));var fs=require('fs');var path=require(_0xb9c0('0x5'));var rimraf=require(_0xb9c0('0x6'));var config=require(_0xb9c0('0x7'));var attributes=require(_0xb9c0('0x8'));module[_0xb9c0('0x9')]=function(_0x4601fa,_0x573cf1){return _0x4601fa['define'](_0xb9c0('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x870d=['rimraf','./cmContactHasItem.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x3de9a0,_0xfdd36c){var _0x298944=function(_0x4c425d){while(--_0x4c425d){_0x3de9a0['push'](_0x3de9a0['shift']());}};_0x298944(++_0xfdd36c);}(_0x870d,0x124));var _0xd870=function(_0x4c49f2,_0x22e0df){_0x4c49f2=_0x4c49f2-0x0;var _0x56a1d4=_0x870d[_0x4c49f2];return _0x56a1d4;};'use strict';var _=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var logger=require(_0xd870('0x2'))(_0xd870('0x3'));var moment=require('moment');var BPromise=require(_0xd870('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd870('0x5'));var config=require('../../config/environment');var attributes=require(_0xd870('0x6'));module[_0xd870('0x7')]=function(_0x5bd1d4,_0x30e2f0){return _0x5bd1d4[_0xd870('0x8')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9c77d5f..f0a0e4d 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 _0x0495=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x529190,_0x1e19d6){var _0x228147=function(_0x495a11){while(--_0x495a11){_0x529190['push'](_0x529190['shift']());}};_0x228147(++_0x1e19d6);}(_0x0495,0xc1));var _0x5049=function(_0x33b643,_0x29efb1){_0x33b643=_0x33b643-0x0;var _0x5f4ede=_0x0495[_0x33b643];return _0x5f4ede;};'use strict';var _=require(_0x5049('0x0'));var util=require(_0x5049('0x1'));var moment=require(_0x5049('0x2'));var BPromise=require(_0x5049('0x3'));var rs=require(_0x5049('0x4'));var fs=require('fs');var Redis=require(_0x5049('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5049('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5049('0x7'));var jayson=require(_0x5049('0x8'));var client=jayson[_0x5049('0x9')][_0x5049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4939,_0x2a8f8e,_0x32301e){return new BPromise(function(_0x247f13,_0x43ed5f){return client[_0x5049('0xb')](_0x5a4939,_0x32301e)['then'](function(_0x24d847){logger[_0x5049('0xc')](_0x5049('0xd'),_0x2a8f8e,'request\x20sent');logger[_0x5049('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2a8f8e,_0x5049('0xf'),JSON[_0x5049('0x10')](_0x24d847));if(_0x24d847[_0x5049('0x11')]){if(_0x24d847[_0x5049('0x11')][_0x5049('0x12')]===0x1f4){logger['error'](_0x5049('0xd'),_0x2a8f8e,_0x24d847[_0x5049('0x11')][_0x5049('0x13')]);return _0x43ed5f(_0x24d847['error'][_0x5049('0x13')]);}logger[_0x5049('0x11')](_0x5049('0xd'),_0x2a8f8e,_0x24d847[_0x5049('0x11')][_0x5049('0x13')]);return _0x247f13(_0x24d847[_0x5049('0x11')]['message']);}else{logger[_0x5049('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x2a8f8e,_0x5049('0xf'));_0x247f13(_0x24d847['result'][_0x5049('0x13')]);}})[_0x5049('0x14')](function(_0x54f448){logger[_0x5049('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x2a8f8e,_0x54f448);_0x43ed5f(_0x54f448);});});} \ No newline at end of file +var _0x61e3=['message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17be03,_0x9993a){var _0x4a3869=function(_0x382a03){while(--_0x382a03){_0x17be03['push'](_0x17be03['shift']());}};_0x4a3869(++_0x9993a);}(_0x61e3,0x1bc));var _0x361e=function(_0x543195,_0x58cc7b){_0x543195=_0x543195-0x0;var _0x427d16=_0x61e3[_0x543195];return _0x427d16;};'use strict';var _=require(_0x361e('0x0'));var util=require(_0x361e('0x1'));var moment=require(_0x361e('0x2'));var BPromise=require(_0x361e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x361e('0x4'));var db=require(_0x361e('0x5'))['db'];var utils=require(_0x361e('0x6'));var logger=require(_0x361e('0x7'))('rpc');var config=require(_0x361e('0x8'));var jayson=require(_0x361e('0x9'));var client=jayson[_0x361e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x73d2c8,_0x5d3b17,_0x4f3bd2){return new BPromise(function(_0x121bf2,_0x4bd294){return client['request'](_0x73d2c8,_0x4f3bd2)[_0x361e('0xb')](function(_0x250e4f){logger['info'](_0x361e('0xc'),_0x5d3b17,_0x361e('0xd'));logger[_0x361e('0xe')](_0x361e('0xf'),_0x5d3b17,_0x361e('0xd'),JSON['stringify'](_0x250e4f));if(_0x250e4f[_0x361e('0x10')]){if(_0x250e4f['error'][_0x361e('0x11')]===0x1f4){logger[_0x361e('0x10')](_0x361e('0xc'),_0x5d3b17,_0x250e4f['error'][_0x361e('0x12')]);return _0x4bd294(_0x250e4f[_0x361e('0x10')][_0x361e('0x12')]);}logger[_0x361e('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x5d3b17,_0x250e4f[_0x361e('0x10')][_0x361e('0x12')]);return _0x121bf2(_0x250e4f[_0x361e('0x10')][_0x361e('0x12')]);}else{logger[_0x361e('0x13')](_0x361e('0xc'),_0x5d3b17,'request\x20sent');_0x121bf2(_0x250e4f[_0x361e('0x14')][_0x361e('0x12')]);}})['catch'](function(_0x34d554){logger[_0x361e('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x5d3b17,_0x34d554);_0x4bd294(_0x34d554);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 062261a..91fcd7a 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 _0x98f5=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show'];(function(_0x4a248b,_0x29e290){var _0x565f8c=function(_0x3944b1){while(--_0x3944b1){_0x4a248b['push'](_0x4a248b['shift']());}};_0x565f8c(++_0x29e290);}(_0x98f5,0x1ad));var _0x598f=function(_0x1462c2,_0x12a9da){_0x1462c2=_0x1462c2-0x0;var _0x143e0a=_0x98f5[_0x1462c2];return _0x143e0a;};'use strict';var multer=require(_0x598f('0x0'));var util=require(_0x598f('0x1'));var path=require(_0x598f('0x2'));var timeout=require(_0x598f('0x3'));var express=require(_0x598f('0x4'));var router=express[_0x598f('0x5')]();var fs_extra=require(_0x598f('0x6'));var auth=require(_0x598f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x598f('0x8')]('/',auth[_0x598f('0x9')](),controller[_0x598f('0xa')]);router[_0x598f('0x8')](_0x598f('0xb'),auth[_0x598f('0x9')](),controller[_0x598f('0xc')]);router['post']('/',auth[_0x598f('0x9')](),controller[_0x598f('0xd')]);router[_0x598f('0xe')](_0x598f('0xb'),auth[_0x598f('0x9')](),controller[_0x598f('0xf')]);router[_0x598f('0x10')](_0x598f('0xb'),auth[_0x598f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0662=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x0662,0x106));var _0x2066=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0662[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x2066('0x0'));var path=require(_0x2066('0x1'));var timeout=require('connect-timeout');var express=require(_0x2066('0x2'));var router=express['Router']();var fs_extra=require(_0x2066('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2066('0x4'));var config=require(_0x2066('0x5'));var controller=require(_0x2066('0x6'));router[_0x2066('0x7')]('/',auth[_0x2066('0x8')](),controller[_0x2066('0x9')]);router[_0x2066('0x7')](_0x2066('0xa'),auth[_0x2066('0x8')](),controller[_0x2066('0xb')]);router[_0x2066('0xc')]('/',auth[_0x2066('0x8')](),controller[_0x2066('0xd')]);router['put']('/:id',auth[_0x2066('0x8')](),controller[_0x2066('0xe')]);router[_0x2066('0xf')]('/:id',auth[_0x2066('0x8')](),controller[_0x2066('0x10')]);module[_0x2066('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index cbeb065..78d2ecd 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 _0x10f7=['getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10f7,0x1b1));var _0x710f=function(_0x43d65d,_0x54d57c){_0x43d65d=_0x43d65d-0x0;var _0x2a5f77=_0x10f7[_0x43d65d];return _0x2a5f77;};'use strict';var Sequelize=require(_0x710f('0x0'));var _=require(_0x710f('0x1'));module[_0x710f('0x2')]={'name':{'type':Sequelize[_0x710f('0x3')],'get':function(_0x23615b){return this[_0x710f('0x4')]('alias');}},'alias':{'type':Sequelize[_0x710f('0x5')],'allowNull':![],'set':function(_0x26b5a6){this[_0x710f('0x6')](_0x710f('0x7'),_0x26b5a6?_0x26b5a6:this[_0x710f('0x4')](_0x710f('0x8')));}},'type':{'type':Sequelize[_0x710f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x710f('0x9')](_0x710f('0xa')),'get':function(){if(this[_0x710f('0x4')](_0x710f('0xb'))===_0x710f('0xc')){return JSON[_0x710f('0xd')](this[_0x710f('0x4')](_0x710f('0xe')));}else{return this[_0x710f('0x4')]('values');}},'set':function(_0x2e2154){if(Array[_0x710f('0xf')](_0x2e2154)){this[_0x710f('0x6')](_0x710f('0xe'),JSON[_0x710f('0x10')](_0x2e2154));}else{this[_0x710f('0x6')]('values',_0x2e2154);}}},'required':{'type':Sequelize[_0x710f('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x710f('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x710f('0x12')]('voice')}}; \ No newline at end of file +var _0xc690=['lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','long','type','select','values','isArray','stringify','BOOLEAN','voice'];(function(_0x3cb10b,_0x7ce7a){var _0x2dfba5=function(_0x2011fc){while(--_0x2011fc){_0x3cb10b['push'](_0x3cb10b['shift']());}};_0x2dfba5(++_0x7ce7a);}(_0xc690,0xc3));var _0x0c69=function(_0x45494a,_0x518b29){_0x45494a=_0x45494a-0x0;var _0x8c7dda=_0xc690[_0x45494a];return _0x8c7dda;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0c69('0x0'));module[_0x0c69('0x1')]={'name':{'type':Sequelize[_0x0c69('0x2')],'get':function(_0x1e207b){return this[_0x0c69('0x3')](_0x0c69('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x36edfe){this[_0x0c69('0x5')](_0x0c69('0x4'),_0x36edfe?_0x36edfe:this[_0x0c69('0x3')](_0x0c69('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x0c69('0x7')),'get':function(){if(this[_0x0c69('0x3')](_0x0c69('0x8'))===_0x0c69('0x9')){return JSON['parse'](this['getDataValue'](_0x0c69('0xa')));}else{return this[_0x0c69('0x3')](_0x0c69('0xa'));}},'set':function(_0x189118){if(Array[_0x0c69('0xb')](_0x189118)){this[_0x0c69('0x5')](_0x0c69('0xa'),JSON[_0x0c69('0xc')](_0x189118));}else{this[_0x0c69('0x5')](_0x0c69('0xa'),_0x189118);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0c69('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x0c69('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 888d8f9..8f33100 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 _0x2217=['name','send','map','CmCustomField','fieldName','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','rawAttributes','find','update','params','create','transaction','Sequelize','body','type','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack'];(function(_0x3d1a62,_0x140c4b){var _0x5b3e36=function(_0x3a2449){while(--_0x3a2449){_0x3d1a62['push'](_0x3d1a62['shift']());}};_0x5b3e36(++_0x140c4b);}(_0x2217,0x133));var _0x7221=function(_0x2f19ce,_0x57589e){_0x2f19ce=_0x2f19ce-0x0;var _0x585d22=_0x2217[_0x2f19ce];return _0x585d22;};'use strict';var emlformat=require(_0x7221('0x0'));var rimraf=require(_0x7221('0x1'));var zipdir=require(_0x7221('0x2'));var jsonpatch=require(_0x7221('0x3'));var rp=require(_0x7221('0x4'));var moment=require(_0x7221('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7221('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7221('0x7'));var fs=require('fs');var fs_extra=require(_0x7221('0x8'));var _=require('lodash');var squel=require(_0x7221('0x9'));var crypto=require(_0x7221('0xa'));var jsforce=require(_0x7221('0xb'));var deskjs=require(_0x7221('0xc'));var toCsv=require(_0x7221('0xd'));var querystring=require(_0x7221('0xe'));var Papa=require(_0x7221('0xf'));var Redis=require(_0x7221('0x10'));var authService=require(_0x7221('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7221('0x12'));var logger=require(_0x7221('0x13'))(_0x7221('0x14'));var utils=require(_0x7221('0x15'));var config=require(_0x7221('0x16'));var licenseUtil=require(_0x7221('0x17'));var db=require(_0x7221('0x18'))['db'];function respondWithStatusCode(_0x36bf08,_0x488918){_0x488918=_0x488918||0xcc;return function(_0x37ba29){if(_0x37ba29){return _0x36bf08[_0x7221('0x19')](_0x488918);}return _0x36bf08[_0x7221('0x1a')](_0x488918)[_0x7221('0x1b')]();};}function respondWithResult(_0x16ced1,_0x3eaacb){_0x3eaacb=_0x3eaacb||0xc8;return function(_0x5661da){if(_0x5661da){return _0x16ced1[_0x7221('0x1a')](_0x3eaacb)['json'](_0x5661da);}};}function respondWithFilteredResult(_0x4f7ce5,_0x3296ac){return function(_0x4f7459){if(_0x4f7459){var _0x350dee=typeof _0x3296ac[_0x7221('0x1c')]===_0x7221('0x1d')&&typeof _0x3296ac[_0x7221('0x1e')]===_0x7221('0x1d');var _0x43a063=_0x4f7459[_0x7221('0x1f')];var _0x32ab17=_0x350dee?0x0:_0x3296ac[_0x7221('0x1c')];var _0x1203ea=_0x350dee?_0x4f7459[_0x7221('0x1f')]:_0x3296ac[_0x7221('0x1c')]+_0x3296ac[_0x7221('0x1e')];var _0x4f9eaa;if(_0x1203ea>=_0x43a063){_0x1203ea=_0x43a063;_0x4f9eaa=0xc8;}else{_0x4f9eaa=0xce;}_0x4f7ce5[_0x7221('0x1a')](_0x4f9eaa);return _0x4f7ce5[_0x7221('0x20')](_0x7221('0x21'),_0x32ab17+'-'+_0x1203ea+'/'+_0x43a063)['json'](_0x4f7459);}return null;};}function patchUpdates(_0x2da9d3){return function(_0x4040d1){try{jsonpatch[_0x7221('0x22')](_0x4040d1,_0x2da9d3,!![]);}catch(_0x966652){return BPromise[_0x7221('0x23')](_0x966652);}return _0x4040d1[_0x7221('0x24')]();};}function saveUpdates(_0x1eaa91,_0x223ab8){return function(_0x388ee0){if(_0x388ee0){return _0x388ee0['update'](_0x1eaa91)['then'](function(_0x10c99d){return _0x10c99d;});}return null;};}function removeEntity(_0x1395e9,_0x4d807e){return function(_0xecce39){if(_0xecce39){return _0xecce39[_0x7221('0x25')]()[_0x7221('0x26')](function(){_0x1395e9[_0x7221('0x1a')](0xcc)[_0x7221('0x1b')]();});}};}function handleEntityNotFound(_0x583fb8,_0x16d0c0){return function(_0x1c0469){if(!_0x1c0469){_0x583fb8[_0x7221('0x19')](0x194);}return _0x1c0469;};}function handleError(_0x44ddd4,_0x505174){_0x505174=_0x505174||0x1f4;return function(_0x1b04ba){logger[_0x7221('0x27')](_0x1b04ba[_0x7221('0x28')]);if(_0x1b04ba['name']){delete _0x1b04ba[_0x7221('0x29')];}_0x44ddd4['status'](_0x505174)[_0x7221('0x2a')](_0x1b04ba);};}exports['index']=function(_0x15ac86,_0x487875){var _0xe11584={},_0x10f0c8={},_0x3fd4c7={'count':0x0,'rows':[]};var _0x12827b=_[_0x7221('0x2b')](db[_0x7221('0x2c')]['rawAttributes'],function(_0x482b96){return{'name':_0x482b96[_0x7221('0x2d')],'type':_0x482b96['type'][_0x7221('0x2e')]};});_0x10f0c8[_0x7221('0x2f')]=_[_0x7221('0x30')](_[_0x7221('0x2b')](_0x12827b,_0x7221('0x29')),['name']);_0x10f0c8[_0x7221('0x31')]=_[_0x7221('0x32')](_0x15ac86['query']);_0x10f0c8[_0x7221('0x33')]=_['intersection'](_0x10f0c8[_0x7221('0x2f')],_0x10f0c8[_0x7221('0x31')]);_0xe11584[_0x7221('0x34')]=_[_0x7221('0x35')](_0x10f0c8[_0x7221('0x2f')],qs[_0x7221('0x36')](_0x15ac86[_0x7221('0x31')][_0x7221('0x36')]));_0xe11584['attributes']=_0xe11584['attributes'][_0x7221('0x37')]?_0xe11584['attributes']:_0x10f0c8[_0x7221('0x2f')];if(!_0x15ac86[_0x7221('0x31')]['hasOwnProperty']('nolimit')){_0xe11584['limit']=qs['limit'](_0x15ac86[_0x7221('0x31')][_0x7221('0x1e')]);_0xe11584[_0x7221('0x1c')]=qs[_0x7221('0x1c')](_0x15ac86[_0x7221('0x31')][_0x7221('0x1c')]);}_0xe11584[_0x7221('0x38')]=qs[_0x7221('0x39')](_0x15ac86[_0x7221('0x31')][_0x7221('0x39')]);_0xe11584[_0x7221('0x3a')]=qs[_0x7221('0x33')](_[_0x7221('0x3b')](_0x15ac86['query'],_0x10f0c8[_0x7221('0x33')]),_0x12827b);if(_0x15ac86['query'][_0x7221('0x3c')]){_0xe11584[_0x7221('0x3a')]=_[_0x7221('0x3d')](_0xe11584['where'],{'$or':_[_0x7221('0x2b')](_0x12827b,function(_0xd31635){if(_0xd31635['type']!==_0x7221('0x3e')){var _0x29c31e={};_0x29c31e[_0xd31635['name']]={'$like':'%'+_0x15ac86[_0x7221('0x31')][_0x7221('0x3c')]+'%'};return _0x29c31e;}})});}_0xe11584=_['merge']({},_0xe11584,_0x15ac86['options']);var _0x2a1774={'where':_0xe11584['where']};return db[_0x7221('0x2c')][_0x7221('0x1f')](_0x2a1774)['then'](function(_0x79fa2){_0x3fd4c7[_0x7221('0x1f')]=_0x79fa2;if(_0x15ac86[_0x7221('0x31')][_0x7221('0x3f')]){_0xe11584[_0x7221('0x40')]=[{'all':!![]}];}return db[_0x7221('0x2c')]['findAll'](_0xe11584);})[_0x7221('0x26')](function(_0x11f3c9){_0x3fd4c7['rows']=_0x11f3c9;return _0x3fd4c7;})['then'](respondWithFilteredResult(_0x487875,_0xe11584))[_0x7221('0x41')](handleError(_0x487875,null));};exports[_0x7221('0x42')]=function(_0x25dff3,_0x1f05c8){var _0x2466fe={'raw':!![],'where':{'id':_0x25dff3['params']['id']}},_0x1b09e6={};_0x1b09e6[_0x7221('0x2f')]=_[_0x7221('0x32')](db[_0x7221('0x2c')][_0x7221('0x43')]);_0x1b09e6['query']=_['keys'](_0x25dff3['query']);_0x1b09e6[_0x7221('0x33')]=_['intersection'](_0x1b09e6[_0x7221('0x2f')],_0x1b09e6[_0x7221('0x31')]);_0x2466fe[_0x7221('0x34')]=_['intersection'](_0x1b09e6['model'],qs['fields'](_0x25dff3[_0x7221('0x31')][_0x7221('0x36')]));_0x2466fe[_0x7221('0x34')]=_0x2466fe[_0x7221('0x34')][_0x7221('0x37')]?_0x2466fe[_0x7221('0x34')]:_0x1b09e6['model'];if(_0x25dff3[_0x7221('0x31')]['includeAll']){_0x2466fe[_0x7221('0x40')]=[{'all':!![]}];}_0x2466fe=_[_0x7221('0x3d')]({},_0x2466fe,_0x25dff3['options']);return db[_0x7221('0x2c')][_0x7221('0x44')](_0x2466fe)[_0x7221('0x26')](handleEntityNotFound(_0x1f05c8,null))[_0x7221('0x26')](respondWithResult(_0x1f05c8,null))[_0x7221('0x41')](handleError(_0x1f05c8,null));};exports[_0x7221('0x45')]=function(_0x482449,_0x17ab2b){if(_0x482449['body']['id']){delete _0x482449['body']['id'];}return db[_0x7221('0x2c')][_0x7221('0x44')]({'where':{'id':_0x482449[_0x7221('0x46')]['id']}})['then'](handleEntityNotFound(_0x17ab2b,null))[_0x7221('0x26')](saveUpdates(_0x482449['body'],null))['then'](respondWithResult(_0x17ab2b,null))[_0x7221('0x41')](handleError(_0x17ab2b,null));};exports[_0x7221('0x25')]=function(_0xdc6636,_0x40bb40){return db[_0x7221('0x2c')]['find']({'where':{'id':_0xdc6636[_0x7221('0x46')]['id']}})[_0x7221('0x26')](handleEntityNotFound(_0x40bb40,null))['then'](removeEntity(_0x40bb40,null))[_0x7221('0x41')](handleError(_0x40bb40,null));};exports[_0x7221('0x47')]=function(_0x37306c,_0x1c3435){var _0x4abb7d;return db['sequelize'][_0x7221('0x48')](function(_0x44e32b){return db[_0x7221('0x2c')]['create'](_0x37306c['body'],{'transaction':_0x44e32b})['then'](function(_0x23c823){_0x4abb7d=_0x23c823;var _0x9d6750={'type':db[_0x7221('0x49')]['TEXT'],'transaction':_0x44e32b};switch(_0x37306c[_0x7221('0x4a')][_0x7221('0x4b')]){case _0x7221('0x4c'):_0x9d6750[_0x7221('0x4b')]=db[_0x7221('0x49')][_0x7221('0x4d')];break;case'number':_0x9d6750['type']=db[_0x7221('0x49')][_0x7221('0x4e')];break;case _0x7221('0x4f'):_0x9d6750[_0x7221('0x4b')]=db[_0x7221('0x49')][_0x7221('0x50')];_0x9d6750[_0x7221('0x51')]=![];break;default:}return db[_0x7221('0x52')][_0x7221('0x53')][_0x7221('0x54')]('cm_contacts',util[_0x7221('0x55')](_0x7221('0x56'),_0x4abb7d['id']),_0x9d6750);})[_0x7221('0x26')](function(){return _0x4abb7d;});})[_0x7221('0x26')](respondWithResult(_0x1c3435,0xc9))['catch'](handleError(_0x1c3435,null));}; \ No newline at end of file +var _0x764d=['body','find','params','create','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','name','send','CmCustomField','fieldName','type','model','differenceBy','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','rawAttributes'];(function(_0x281170,_0x323e48){var _0x101b5a=function(_0x27adc7){while(--_0x27adc7){_0x281170['push'](_0x281170['shift']());}};_0x101b5a(++_0x323e48);}(_0x764d,0x16d));var _0xd764=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0x764d[_0x29d6e6];return _0xc75ff0;};'use strict';var emlformat=require(_0xd764('0x0'));var rimraf=require(_0xd764('0x1'));var zipdir=require(_0xd764('0x2'));var jsonpatch=require(_0xd764('0x3'));var rp=require(_0xd764('0x4'));var moment=require(_0xd764('0x5'));var BPromise=require(_0xd764('0x6'));var Mustache=require(_0xd764('0x7'));var util=require(_0xd764('0x8'));var path=require('path');var sox=require(_0xd764('0x9'));var csv=require(_0xd764('0xa'));var ejs=require(_0xd764('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd764('0xc'));var crypto=require(_0xd764('0xd'));var jsforce=require(_0xd764('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd764('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd764('0xf'));var authService=require(_0xd764('0x10'));var qs=require(_0xd764('0x11'));var as=require(_0xd764('0x12'));var hardwareService=require(_0xd764('0x13'));var logger=require(_0xd764('0x14'))(_0xd764('0x15'));var utils=require(_0xd764('0x16'));var config=require(_0xd764('0x17'));var licenseUtil=require(_0xd764('0x18'));var db=require(_0xd764('0x19'))['db'];function respondWithStatusCode(_0x512e75,_0x2a1944){_0x2a1944=_0x2a1944||0xcc;return function(_0x57188f){if(_0x57188f){return _0x512e75[_0xd764('0x1a')](_0x2a1944);}return _0x512e75[_0xd764('0x1b')](_0x2a1944)['end']();};}function respondWithResult(_0x5b5d06,_0x1e648d){_0x1e648d=_0x1e648d||0xc8;return function(_0x3c2f8b){if(_0x3c2f8b){return _0x5b5d06[_0xd764('0x1b')](_0x1e648d)[_0xd764('0x1c')](_0x3c2f8b);}};}function respondWithFilteredResult(_0x363b11,_0xb4ef07){return function(_0x277a07){if(_0x277a07){var _0x5082c4=typeof _0xb4ef07[_0xd764('0x1d')]===_0xd764('0x1e')&&typeof _0xb4ef07[_0xd764('0x1f')]===_0xd764('0x1e');var _0x2fa5c4=_0x277a07[_0xd764('0x20')];var _0x3db7fc=_0x5082c4?0x0:_0xb4ef07[_0xd764('0x1d')];var _0x404f63=_0x5082c4?_0x277a07[_0xd764('0x20')]:_0xb4ef07[_0xd764('0x1d')]+_0xb4ef07[_0xd764('0x1f')];var _0x26ca9d;if(_0x404f63>=_0x2fa5c4){_0x404f63=_0x2fa5c4;_0x26ca9d=0xc8;}else{_0x26ca9d=0xce;}_0x363b11[_0xd764('0x1b')](_0x26ca9d);return _0x363b11[_0xd764('0x21')]('Content-Range',_0x3db7fc+'-'+_0x404f63+'/'+_0x2fa5c4)[_0xd764('0x1c')](_0x277a07);}return null;};}function patchUpdates(_0x582d6c){return function(_0x17a10a){try{jsonpatch[_0xd764('0x22')](_0x17a10a,_0x582d6c,!![]);}catch(_0x2b5dac){return BPromise[_0xd764('0x23')](_0x2b5dac);}return _0x17a10a[_0xd764('0x24')]();};}function saveUpdates(_0x1e7648,_0x152323){return function(_0x1a9619){if(_0x1a9619){return _0x1a9619[_0xd764('0x25')](_0x1e7648)[_0xd764('0x26')](function(_0x44afbd){return _0x44afbd;});}return null;};}function removeEntity(_0x6c19c8,_0xe70e8a){return function(_0x33ed0b){if(_0x33ed0b){return _0x33ed0b[_0xd764('0x27')]()['then'](function(){_0x6c19c8[_0xd764('0x1b')](0xcc)[_0xd764('0x28')]();});}};}function handleEntityNotFound(_0x3d8b13,_0x238054){return function(_0xfb18ad){if(!_0xfb18ad){_0x3d8b13[_0xd764('0x1a')](0x194);}return _0xfb18ad;};}function handleError(_0x3fea2d,_0x150b29){_0x150b29=_0x150b29||0x1f4;return function(_0x430525){logger['error'](_0x430525['stack']);if(_0x430525[_0xd764('0x29')]){delete _0x430525[_0xd764('0x29')];}_0x3fea2d['status'](_0x150b29)[_0xd764('0x2a')](_0x430525);};}exports['index']=function(_0xb3d81e,_0x43a0d4){var _0x40d6d1={},_0xd7eeb3={},_0x2dbd89={'count':0x0,'rows':[]};var _0x41337b=_['map'](db[_0xd764('0x2b')]['rawAttributes'],function(_0x32c53){return{'name':_0x32c53[_0xd764('0x2c')],'type':_0x32c53[_0xd764('0x2d')]['key']};});_0xd7eeb3[_0xd764('0x2e')]=_[_0xd764('0x2f')](_[_0xd764('0x30')](_0x41337b,'name'),['name']);_0xd7eeb3[_0xd764('0x31')]=_[_0xd764('0x32')](_0xb3d81e[_0xd764('0x31')]);_0xd7eeb3['filters']=_[_0xd764('0x33')](_0xd7eeb3[_0xd764('0x2e')],_0xd7eeb3[_0xd764('0x31')]);_0x40d6d1['attributes']=_[_0xd764('0x33')](_0xd7eeb3['model'],qs[_0xd764('0x34')](_0xb3d81e['query'][_0xd764('0x34')]));_0x40d6d1[_0xd764('0x35')]=_0x40d6d1[_0xd764('0x35')][_0xd764('0x36')]?_0x40d6d1['attributes']:_0xd7eeb3['model'];if(!_0xb3d81e[_0xd764('0x31')][_0xd764('0x37')]('nolimit')){_0x40d6d1['limit']=qs['limit'](_0xb3d81e[_0xd764('0x31')][_0xd764('0x1f')]);_0x40d6d1[_0xd764('0x1d')]=qs['offset'](_0xb3d81e[_0xd764('0x31')][_0xd764('0x1d')]);}_0x40d6d1[_0xd764('0x38')]=qs[_0xd764('0x39')](_0xb3d81e[_0xd764('0x31')][_0xd764('0x39')]);_0x40d6d1['where']=qs[_0xd764('0x3a')](_[_0xd764('0x3b')](_0xb3d81e[_0xd764('0x31')],_0xd7eeb3[_0xd764('0x3a')]),_0x41337b);if(_0xb3d81e['query']['filter']){_0x40d6d1[_0xd764('0x3c')]=_[_0xd764('0x3d')](_0x40d6d1[_0xd764('0x3c')],{'$or':_[_0xd764('0x30')](_0x41337b,function(_0x4d2259){if(_0x4d2259[_0xd764('0x2d')]!==_0xd764('0x3e')){var _0x408012={};_0x408012[_0x4d2259[_0xd764('0x29')]]={'$like':'%'+_0xb3d81e[_0xd764('0x31')][_0xd764('0x3f')]+'%'};return _0x408012;}})});}_0x40d6d1=_[_0xd764('0x3d')]({},_0x40d6d1,_0xb3d81e[_0xd764('0x40')]);var _0x55c5b4={'where':_0x40d6d1[_0xd764('0x3c')]};return db[_0xd764('0x2b')][_0xd764('0x20')](_0x55c5b4)[_0xd764('0x26')](function(_0x242610){_0x2dbd89['count']=_0x242610;if(_0xb3d81e['query'][_0xd764('0x41')]){_0x40d6d1[_0xd764('0x42')]=[{'all':!![]}];}return db[_0xd764('0x2b')]['findAll'](_0x40d6d1);})[_0xd764('0x26')](function(_0x50a72b){_0x2dbd89['rows']=_0x50a72b;return _0x2dbd89;})[_0xd764('0x26')](respondWithFilteredResult(_0x43a0d4,_0x40d6d1))[_0xd764('0x43')](handleError(_0x43a0d4,null));};exports[_0xd764('0x44')]=function(_0x54d1da,_0x4c3df1){var _0x21d017={'raw':!![],'where':{'id':_0x54d1da['params']['id']}},_0x1aea29={};_0x1aea29[_0xd764('0x2e')]=_[_0xd764('0x32')](db[_0xd764('0x2b')][_0xd764('0x45')]);_0x1aea29[_0xd764('0x31')]=_['keys'](_0x54d1da[_0xd764('0x31')]);_0x1aea29[_0xd764('0x3a')]=_[_0xd764('0x33')](_0x1aea29[_0xd764('0x2e')],_0x1aea29[_0xd764('0x31')]);_0x21d017[_0xd764('0x35')]=_[_0xd764('0x33')](_0x1aea29[_0xd764('0x2e')],qs['fields'](_0x54d1da[_0xd764('0x31')]['fields']));_0x21d017['attributes']=_0x21d017['attributes'][_0xd764('0x36')]?_0x21d017[_0xd764('0x35')]:_0x1aea29[_0xd764('0x2e')];if(_0x54d1da[_0xd764('0x31')][_0xd764('0x41')]){_0x21d017[_0xd764('0x42')]=[{'all':!![]}];}_0x21d017=_['merge']({},_0x21d017,_0x54d1da[_0xd764('0x40')]);return db[_0xd764('0x2b')]['find'](_0x21d017)['then'](handleEntityNotFound(_0x4c3df1,null))[_0xd764('0x26')](respondWithResult(_0x4c3df1,null))[_0xd764('0x43')](handleError(_0x4c3df1,null));};exports[_0xd764('0x25')]=function(_0x1cf8da,_0x29fa6b){if(_0x1cf8da[_0xd764('0x46')]['id']){delete _0x1cf8da[_0xd764('0x46')]['id'];}return db[_0xd764('0x2b')][_0xd764('0x47')]({'where':{'id':_0x1cf8da[_0xd764('0x48')]['id']}})[_0xd764('0x26')](handleEntityNotFound(_0x29fa6b,null))['then'](saveUpdates(_0x1cf8da[_0xd764('0x46')],null))[_0xd764('0x26')](respondWithResult(_0x29fa6b,null))[_0xd764('0x43')](handleError(_0x29fa6b,null));};exports[_0xd764('0x27')]=function(_0x5556ea,_0x18ed95){return db[_0xd764('0x2b')][_0xd764('0x47')]({'where':{'id':_0x5556ea['params']['id']}})['then'](handleEntityNotFound(_0x18ed95,null))[_0xd764('0x26')](removeEntity(_0x18ed95,null))[_0xd764('0x43')](handleError(_0x18ed95,null));};exports[_0xd764('0x49')]=function(_0x146ce9,_0x4bb24f){var _0x4f2c57;return db[_0xd764('0x4a')][_0xd764('0x4b')](function(_0x2537a8){return db[_0xd764('0x2b')][_0xd764('0x49')](_0x146ce9[_0xd764('0x46')],{'transaction':_0x2537a8})[_0xd764('0x26')](function(_0x5b5bc8){_0x4f2c57=_0x5b5bc8;var _0x59cd27={'type':db['Sequelize']['TEXT'],'transaction':_0x2537a8};switch(_0x146ce9[_0xd764('0x46')]['type']){case _0xd764('0x4c'):_0x59cd27[_0xd764('0x2d')]=db[_0xd764('0x4d')][_0xd764('0x4e')];break;case _0xd764('0x4f'):_0x59cd27[_0xd764('0x2d')]=db[_0xd764('0x4d')][_0xd764('0x50')];break;case _0xd764('0x51'):_0x59cd27[_0xd764('0x2d')]=db[_0xd764('0x4d')][_0xd764('0x52')];_0x59cd27['defaultValue']=![];break;default:}return db[_0xd764('0x4a')][_0xd764('0x53')][_0xd764('0x54')](_0xd764('0x55'),util['format'](_0xd764('0x56'),_0x4f2c57['id']),_0x59cd27);})[_0xd764('0x26')](function(){return _0x4f2c57;});})[_0xd764('0x26')](respondWithResult(_0x4bb24f,0xc9))[_0xd764('0x43')](handleError(_0x4bb24f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 07e23f2..9d50d69 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 _0x2864=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x5772d4,_0x5dafe2){var _0x29fda7=function(_0x382483){while(--_0x382483){_0x5772d4['push'](_0x5772d4['shift']());}};_0x29fda7(++_0x5dafe2);}(_0x2864,0x13f));var _0x4286=function(_0x3af76b,_0x3ff964){_0x3af76b=_0x3af76b-0x0;var _0x441064=_0x2864[_0x3af76b];return _0x441064;};'use strict';var _=require(_0x4286('0x0'));var util=require(_0x4286('0x1'));var logger=require(_0x4286('0x2'))('api');var moment=require(_0x4286('0x3'));var BPromise=require(_0x4286('0x4'));var rp=require(_0x4286('0x5'));var fs=require('fs');var path=require(_0x4286('0x6'));var rimraf=require(_0x4286('0x7'));var config=require(_0x4286('0x8'));var attributes=require(_0x4286('0x9'));module[_0x4286('0xa')]=function(_0x3247a,_0x2fb71a){return _0x3247a[_0x4286('0xb')](_0x4286('0xc'),attributes,{'tableName':_0x4286('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb4=['rimraf','./cmCustomField.attributes','exports','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb2a50a,_0x5ca83f){var _0x39b65b=function(_0x4180d3){while(--_0x4180d3){_0xb2a50a['push'](_0xb2a50a['shift']());}};_0x39b65b(++_0x5ca83f);}(_0x7bb4,0xf6));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x47bb('0x0'));var logger=require(_0x47bb('0x1'))(_0x47bb('0x2'));var moment=require(_0x47bb('0x3'));var BPromise=require(_0x47bb('0x4'));var rp=require(_0x47bb('0x5'));var fs=require('fs');var path=require(_0x47bb('0x6'));var rimraf=require(_0x47bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x47bb('0x8'));module[_0x47bb('0x9')]=function(_0x15f564,_0x232f7a){return _0x15f564['define']('CmCustomField',attributes,{'tableName':_0x47bb('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0ab81d3..912385a 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 _0x6816=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x6816,0x1cb));var _0x6681=function(_0x1d6ada,_0x38b03b){_0x1d6ada=_0x1d6ada-0x0;var _0x311337=_0x6816[_0x1d6ada];return _0x311337;};'use strict';var _=require(_0x6681('0x0'));var util=require('util');var moment=require(_0x6681('0x1'));var BPromise=require('bluebird');var rs=require(_0x6681('0x2'));var fs=require('fs');var Redis=require(_0x6681('0x3'));var db=require(_0x6681('0x4'))['db'];var utils=require(_0x6681('0x5'));var logger=require('../../config/logger')(_0x6681('0x6'));var config=require(_0x6681('0x7'));var jayson=require(_0x6681('0x8'));var client=jayson['client'][_0x6681('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x113488,_0x15e7c9,_0x2950ca){return new BPromise(function(_0x9d3a03,_0x192d6f){return client[_0x6681('0xa')](_0x113488,_0x2950ca)[_0x6681('0xb')](function(_0xec358f){logger[_0x6681('0xc')]('CmCustomField,\x20%s,\x20%s',_0x15e7c9,_0x6681('0xd'));logger[_0x6681('0xe')](_0x6681('0xf'),_0x15e7c9,_0x6681('0xd'),JSON[_0x6681('0x10')](_0xec358f));if(_0xec358f['error']){if(_0xec358f[_0x6681('0x11')][_0x6681('0x12')]===0x1f4){logger['error'](_0x6681('0x13'),_0x15e7c9,_0xec358f[_0x6681('0x11')][_0x6681('0x14')]);return _0x192d6f(_0xec358f[_0x6681('0x11')][_0x6681('0x14')]);}logger[_0x6681('0x11')](_0x6681('0x13'),_0x15e7c9,_0xec358f['error'][_0x6681('0x14')]);return _0x9d3a03(_0xec358f['error'][_0x6681('0x14')]);}else{logger[_0x6681('0xc')](_0x6681('0x13'),_0x15e7c9,_0x6681('0xd'));_0x9d3a03(_0xec358f[_0x6681('0x15')]['message']);}})[_0x6681('0x16')](function(_0x5b240d){logger['error'](_0x6681('0x13'),_0x15e7c9,_0x5b240d);_0x192d6f(_0x5b240d);});});} \ No newline at end of file +var _0x3844=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error'];(function(_0x253201,_0x55488a){var _0x4a479a=function(_0x219cda){while(--_0x219cda){_0x253201['push'](_0x253201['shift']());}};_0x4a479a(++_0x55488a);}(_0x3844,0xd2));var _0x4384=function(_0x34eb18,_0x325745){_0x34eb18=_0x34eb18-0x0;var _0x2cdfaa=_0x3844[_0x34eb18];return _0x2cdfaa;};'use strict';var _=require(_0x4384('0x0'));var util=require(_0x4384('0x1'));var moment=require(_0x4384('0x2'));var BPromise=require(_0x4384('0x3'));var rs=require(_0x4384('0x4'));var fs=require('fs');var Redis=require(_0x4384('0x5'));var db=require(_0x4384('0x6'))['db'];var utils=require(_0x4384('0x7'));var logger=require('../../config/logger')(_0x4384('0x8'));var config=require('../../config/environment');var jayson=require(_0x4384('0x9'));var client=jayson[_0x4384('0xa')][_0x4384('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x375140,_0x45c376,_0x355a81){return new BPromise(function(_0x474aa9,_0x5dab5e){return client[_0x4384('0xc')](_0x375140,_0x355a81)[_0x4384('0xd')](function(_0x9b0c05){logger[_0x4384('0xe')](_0x4384('0xf'),_0x45c376,_0x4384('0x10'));logger[_0x4384('0x11')](_0x4384('0x12'),_0x45c376,_0x4384('0x10'),JSON['stringify'](_0x9b0c05));if(_0x9b0c05[_0x4384('0x13')]){if(_0x9b0c05[_0x4384('0x13')][_0x4384('0x14')]===0x1f4){logger[_0x4384('0x13')](_0x4384('0xf'),_0x45c376,_0x9b0c05[_0x4384('0x13')][_0x4384('0x15')]);return _0x5dab5e(_0x9b0c05[_0x4384('0x13')][_0x4384('0x15')]);}logger[_0x4384('0x13')](_0x4384('0xf'),_0x45c376,_0x9b0c05['error'][_0x4384('0x15')]);return _0x474aa9(_0x9b0c05[_0x4384('0x13')][_0x4384('0x15')]);}else{logger[_0x4384('0xe')]('CmCustomField,\x20%s,\x20%s',_0x45c376,_0x4384('0x10'));_0x474aa9(_0x9b0c05[_0x4384('0x16')][_0x4384('0x15')]);}})['catch'](function(_0x5744ff){logger[_0x4384('0x13')]('CmCustomField,\x20%s,\x20%s',_0x45c376,_0x5744ff);_0x5dab5e(_0x5744ff);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 72c8474..517d5c7 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 _0xa9b1=['index','/:id','show','post','create','put','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x4efe66,_0x4f2b98){var _0x4d5b98=function(_0x1ca83c){while(--_0x1ca83c){_0x4efe66['push'](_0x4efe66['shift']());}};_0x4d5b98(++_0x4f2b98);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0xb')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')](_0x1a9b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1a9b('0xe')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x56a4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x56a4,0x11b));var _0x456a=function(_0x3cb9bc,_0x1c95f5){_0x3cb9bc=_0x3cb9bc-0x0;var _0x5d13ec=_0x56a4[_0x3cb9bc];return _0x5d13ec;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/:id',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0xc')]('/',auth['isAuthenticated'](),controller[_0x456a('0xd')]);router['put'](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0xf')]);router[_0x456a('0x10')](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0x11')]);module[_0x456a('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 78acd6d..bc15f40 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 _0xb004=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x3cef2a,_0x48bc9d){var _0x4a303b=function(_0x4a270e){while(--_0x4a270e){_0x3cef2a['push'](_0x3cef2a['shift']());}};_0x4a303b(++_0x48bc9d);}(_0xb004,0x18d));var _0x4b00=function(_0x32b20b,_0xcdf322){_0x32b20b=_0x32b20b-0x0;var _0x3dd4bd=_0xb004[_0x32b20b];return _0x3dd4bd;};'use strict';var moment=require(_0x4b00('0x0'));var Sequelize=require(_0x4b00('0x1'));module[_0x4b00('0x2')]={'phone':{'type':Sequelize[_0x4b00('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4b00('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4b00('0x5')],'defaultValue':moment()[_0x4b00('0x6')](_0x4b00('0x7'))},'countbusyretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4b00('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4b00('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4b00('0x5')]},'priority':{'type':Sequelize[_0x4b00('0x8')](0x2)[_0x4b00('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4b00('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4b00('0x8')],'unique':_0x4b00('0xa')},'ListId':{'type':Sequelize[_0x4b00('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4b00('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x4b00('0x8')],'unique':_0x4b00('0xa')},'CampaignId':{'type':Sequelize[_0x4b00('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4b00('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4b00('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xfa58=['INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfa58,0x16b));var _0x8fa5=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0xfa58[_0x3a175b];return _0x9b84fa;};'use strict';var moment=require(_0x8fa5('0x0'));var Sequelize=require(_0x8fa5('0x1'));module[_0x8fa5('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8fa5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8fa5('0x4')],'defaultValue':moment()[_0x8fa5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8fa5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8fa5('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8fa5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8fa5('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8fa5('0x4')]},'priority':{'type':Sequelize[_0x8fa5('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x8fa5('0x8')},'ListId':{'type':Sequelize[_0x8fa5('0x6')],'unique':_0x8fa5('0x8')},'UserId':{'type':Sequelize[_0x8fa5('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8fa5('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x8fa5('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x8fa5('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8fa5('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8fa5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8fa5('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8fa5('0x4')],'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 d33d7d7..06b027c 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 _0xf2cb=['transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','CmCompany','getOpenContacts','format','isNil','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','../../config/environment','json','offset','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','statedesc','deleted','campaign','user','deletedat','campaigntype','queue','ivr','CmContact','ContactId','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2cb,0x130));var _0xbf2c=function(_0x4d2c94,_0x402f82){_0x4d2c94=_0x4d2c94-0x0;var _0x3781bd=_0xf2cb[_0x4d2c94];return _0x3781bd;};'use strict';var moment=require('moment');var _=require(_0xbf2c('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbf2c('0x1'))('api');var shared=require(_0xbf2c('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1ecb79,_0x41c649){_0x41c649=_0x41c649||0xc8;return function(_0x5abeb3){if(_0x5abeb3){return _0x1ecb79['status'](_0x41c649)[_0xbf2c('0x3')](_0x5abeb3);}};}function respondWithFilteredResult(_0x46d282,_0x1fc371){return function(_0xaacd25){if(_0xaacd25){var _0x516715=typeof _0x1fc371[_0xbf2c('0x4')]==='undefined'&&typeof _0x1fc371[_0xbf2c('0x5')]==='undefined';var _0x5f25ea=_0xaacd25[_0xbf2c('0x6')];var _0x16c303=_0x516715?0x0:_0x1fc371[_0xbf2c('0x4')];var _0x5e10f4=_0x516715?_0xaacd25[_0xbf2c('0x6')]:_0x1fc371[_0xbf2c('0x4')]+_0x1fc371[_0xbf2c('0x5')];var _0x27be1c;if(_0x5e10f4>=_0x5f25ea){_0x5e10f4=_0x5f25ea;_0x27be1c=0xc8;}else{_0x27be1c=0xce;}_0x46d282[_0xbf2c('0x7')](_0x27be1c);return _0x46d282[_0xbf2c('0x8')](_0xbf2c('0x9'),_0x16c303+'-'+_0x5e10f4+'/'+_0x5f25ea)[_0xbf2c('0x3')](_0xaacd25);}return null;};}function saveUpdates(_0x52983d,_0x149235){return function(_0x294d0d){if(_0x294d0d){return _0x294d0d[_0xbf2c('0xa')](_0x52983d)[_0xbf2c('0xb')](function(_0x5220e2){return _0x5220e2;});}return null;};}function handleEntityNotFound(_0x7665b1,_0x5a160b){return function(_0x557740){if(!_0x557740){_0x7665b1[_0xbf2c('0xc')](0x194);}return _0x557740;};}function handleError(_0x4f58c7,_0x47df49){_0x47df49=_0x47df49||0x1f4;return function(_0x3ed1c3){logger[_0xbf2c('0xd')](_0x3ed1c3[_0xbf2c('0xe')]);if(_0x3ed1c3[_0xbf2c('0xf')]){delete _0x3ed1c3[_0xbf2c('0xf')];}_0x4f58c7['status'](_0x47df49)[_0xbf2c('0x10')](_0x3ed1c3);};}exports['index']=function(_0x4ced7f,_0x1df2ab){var _0x298329={},_0x32a44d={},_0x266035={'count':0x0,'rows':[]};var _0x57e01a=_[_0xbf2c('0x11')](db[_0xbf2c('0x12')][_0xbf2c('0x13')],function(_0x5353e7){return{'name':_0x5353e7[_0xbf2c('0x14')],'type':_0x5353e7[_0xbf2c('0x15')][_0xbf2c('0x16')]};});_0x32a44d['model']=_[_0xbf2c('0x11')](_0x57e01a,_0xbf2c('0xf'));_0x32a44d[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x4ced7f['query']);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x32a44d['model'],_0x32a44d[_0xbf2c('0x17')]);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1b')](_0x32a44d['filters'],['$and',_0xbf2c('0x1c'),_0xbf2c('0x1d'),_0xbf2c('0x1e'),_0xbf2c('0x1f'),_0xbf2c('0x20'),_0xbf2c('0x21'),_0xbf2c('0x22'),'$not','$between',_0xbf2c('0x23'),_0xbf2c('0x24'),_0xbf2c('0x25'),_0xbf2c('0x26'),_0xbf2c('0x27'),_0xbf2c('0x28'),_0xbf2c('0x29'),_0xbf2c('0x26'),_0xbf2c('0x2a'),'$contains',_0xbf2c('0x2b'),'$any']);_0x298329[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x32a44d[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x4ced7f[_0xbf2c('0x17')]['fields']));_0x298329[_0xbf2c('0x2c')]=_0x298329[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x298329[_0xbf2c('0x2c')]:_0x32a44d[_0xbf2c('0x2d')];if(!_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x30')](_0xbf2c('0x31'))){_0x298329['limit']=qs[_0xbf2c('0x5')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x5')]);_0x298329['offset']=qs['offset'](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x4')]);}_0x298329[_0xbf2c('0x32')]=qs[_0xbf2c('0x33')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x33')]);_0x298329[_0xbf2c('0x34')]=qs[_0xbf2c('0x19')](_[_0xbf2c('0x35')](_0x4ced7f['query'],_0x32a44d[_0xbf2c('0x19')]),_0x57e01a);if(_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x36')]){_0x298329[_0xbf2c('0x34')]=_[_0xbf2c('0x37')](_0x298329[_0xbf2c('0x34')],{'$or':_[_0xbf2c('0x11')](_0x57e01a,function(_0x4722b3){if(_0x4722b3['type']!==_0xbf2c('0x38')){var _0x475594={};_0x475594[_0x4722b3[_0xbf2c('0xf')]]={'$like':'%'+_0x4ced7f['query'][_0xbf2c('0x36')]+'%'};return _0x475594;}})});}_0x298329=_[_0xbf2c('0x37')]({},_0x298329,_0x4ced7f[_0xbf2c('0x39')]);var _0x5402ff={'where':_0x298329[_0xbf2c('0x34')]};return db[_0xbf2c('0x12')]['count'](_0x5402ff)['then'](function(_0x47ab9a){_0x266035['count']=_0x47ab9a;if(_0x4ced7f['query'][_0xbf2c('0x3a')]){_0x298329[_0xbf2c('0x3b')]=[{'all':!![]}];}return db[_0xbf2c('0x12')][_0xbf2c('0x3c')](_0x298329);})[_0xbf2c('0xb')](function(_0x16fbd5){_0x266035[_0xbf2c('0x3d')]=_0x16fbd5;return _0x266035;})[_0xbf2c('0xb')](respondWithFilteredResult(_0x1df2ab,_0x298329))[_0xbf2c('0x3e')](handleError(_0x1df2ab,null));};exports[_0xbf2c('0x3f')]=function(_0x245eaf,_0x99abc8){var _0x3fbf90={'raw':!![],'where':{'id':_0x245eaf[_0xbf2c('0x40')]['id']}},_0x1eac50={};_0x1eac50[_0xbf2c('0x2d')]=_['keys'](db[_0xbf2c('0x12')][_0xbf2c('0x13')]);_0x1eac50[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x245eaf[_0xbf2c('0x17')]);_0x1eac50[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],_0x1eac50['query']);_0x3fbf90[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x245eaf['query'][_0xbf2c('0x2e')]));_0x3fbf90['attributes']=_0x3fbf90[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x3fbf90[_0xbf2c('0x2c')]:_0x1eac50[_0xbf2c('0x2d')];if(_0x245eaf[_0xbf2c('0x17')][_0xbf2c('0x3a')]){_0x3fbf90['include']=[{'all':!![]}];}_0x3fbf90=_[_0xbf2c('0x37')]({},_0x3fbf90,_0x245eaf['options']);return db['CmHopper'][_0xbf2c('0x41')](_0x3fbf90)['then'](handleEntityNotFound(_0x99abc8,null))['then'](respondWithResult(_0x99abc8,null))[_0xbf2c('0x3e')](handleError(_0x99abc8,null));};exports[_0xbf2c('0x42')]=function(_0x56fc01,_0x403568){return db['CmHopper'][_0xbf2c('0x42')](_0x56fc01['body'],{})[_0xbf2c('0xb')](respondWithResult(_0x403568,0xc9))[_0xbf2c('0x3e')](handleError(_0x403568,null));};exports[_0xbf2c('0xa')]=function(_0x343255,_0x222721){if(_0x343255[_0xbf2c('0x43')]['id']){delete _0x343255['body']['id'];}return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x343255[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x222721,null))[_0xbf2c('0xb')](saveUpdates(_0x343255['body'],null))['then'](respondWithResult(_0x222721,null))[_0xbf2c('0x3e')](handleError(_0x222721,null));};exports['describe']=function(_0xa08482,_0x1c64e0){return db[_0xbf2c('0x12')][_0xbf2c('0x44')]()[_0xbf2c('0xb')](respondWithResult(_0x1c64e0,null))[_0xbf2c('0x3e')](handleError(_0x1c64e0,null));};exports[_0xbf2c('0x45')]=function(_0x1c3b78,_0x128e97){var _0x23912d;var _0x31791b=_0x1c3b78['params']['id'];return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x1c3b78[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x128e97,null))['then'](function(_0x4edca4){if(_0x4edca4){return _0x4edca4['destroy']()[_0xbf2c('0xb')](function(_0x2451ba){return _0x2451ba;});}})['then'](function(_0x5a0c37){_0x23912d=_0x5a0c37;if(_0x5a0c37){if(_0x5a0c37['VoiceQueueId']||_0x5a0c37[_0xbf2c('0x46')]){return db[_0x5a0c37[_0xbf2c('0x47')]?_0xbf2c('0x48'):_0xbf2c('0x49')][_0xbf2c('0x41')]({'where':{'id':_0x5a0c37[_0xbf2c('0x47')]?_0x5a0c37['VoiceQueueId']:_0x5a0c37[_0xbf2c('0x46')]},'attributes':['id',_0xbf2c('0xf')],'raw':!![]});}}})[_0xbf2c('0xb')](function(_0x3fa07e){var _0x36d1ec={};if(_0x3fa07e){_[_0xbf2c('0x37')](_0x36d1ec,_[_0xbf2c('0x4a')](_0x23912d[_0xbf2c('0x4b')],['createdAt','updatedAt','id']));_0x36d1ec['state']=0x15;_0x36d1ec[_0xbf2c('0x4c')]=_0xbf2c('0x4d');_0x36d1ec[_0xbf2c('0x4e')]=_0x3fa07e[_0xbf2c('0xf')];_0x36d1ec['membername']=_0x1c3b78[_0xbf2c('0x4f')][_0xbf2c('0xf')];_0x36d1ec['UserId']=_0x1c3b78[_0xbf2c('0x4f')]['id'];_0x36d1ec[_0xbf2c('0x4d')]=!![];_0x36d1ec[_0xbf2c('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36d1ec['calleridnum']=_0x23912d['phone'];_0x36d1ec[_0xbf2c('0x51')]=_0x23912d[_0xbf2c('0x47')]?_0xbf2c('0x52'):_0xbf2c('0x53');return db[_0xbf2c('0x54')]['find']({'where':{'id':_0x36d1ec[_0xbf2c('0x55')]},'attributes':[_0xbf2c('0x56'),'lastName']})[_0xbf2c('0xb')](function(_0x3f0129){if(!_['isNil'](_0x128e97)&&!_['isNil'](_0x3f0129['firstName'])){_0x36d1ec[_0xbf2c('0x57')]=_0x3f0129['firstName'];if(!_['isNil'](_0x3f0129[_0xbf2c('0x58')])){_0x36d1ec[_0xbf2c('0x57')]+='\x20'+_0x3f0129[_0xbf2c('0x58')];}}})[_0xbf2c('0x59')](function(){return db['CmHopperFinal']['create'](_0x36d1ec);});}})[_0xbf2c('0xb')](function(_0xc0b6ff){return db[_0xbf2c('0x5a')][_0xbf2c('0x45')]({'where':{'CmHopperId':_0x31791b}});})[_0xbf2c('0xb')](function(){return _0x128e97['status'](0xcc)['end']();})[_0xbf2c('0x3e')](handleError(_0x128e97,null));};exports[_0xbf2c('0x5b')]=function(_0x40f93e,_0x45b91c){var _0x1f984e=[];return db[_0xbf2c('0x54')]['describe']()['then'](function(_0x47b287){_0x1f984e=_[_0xbf2c('0x18')](_0x47b287);return _0x40f93e[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id',_0xbf2c('0x5f'),_0xbf2c('0x60')],'raw':!![]});})[_0xbf2c('0xb')](function(_0x50d44d){if(_0x50d44d&&_0x50d44d['length']){return db[_0xbf2c('0x61')][_0xbf2c('0x62')](function(_0x38ce66){var _0x42f789={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x50d44d,'id')},'$or':[{'UserId':null},{'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']}]};var _0x4ed155={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d44d)[_0xbf2c('0x36')]([_0xbf2c('0x60'),0x0])[_0xbf2c('0x11')]('id')[_0xbf2c('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x40f93e['user']['id']}]};var _0x3e9448={'$or':[_0x42f789,_0x4ed155]};var _0x12bee7=[];if(_0x40f93e[_0xbf2c('0x43')]['direction']&&_0x40f93e['body'][_0xbf2c('0x65')]==='prev'){if(!_['isEmpty'](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$in':_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),'ASC'],['scheduledAt',_0x50d44d[0x0][_0xbf2c('0x5f')]===_0xbf2c('0x68')?'DESC':_0xbf2c('0x68')],db[_0xbf2c('0x61')]['literal'](_0xbf2c('0x69')),['id','DESC']];}else{if(!_[_0xbf2c('0x6a')](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$notIn':_0x40f93e['body'][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),_0xbf2c('0x6b')],[_0xbf2c('0x6c'),_0x50d44d[0x0][_0xbf2c('0x5f')]],db[_0xbf2c('0x61')][_0xbf2c('0x6d')](_0xbf2c('0x6e')),['id',_0xbf2c('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbf2c('0x6f'),_0xbf2c('0x70'),_0xbf2c('0x71')],'where':_0x3e9448,'order':_0x12bee7,'transaction':_0x38ce66,'lock':_0x38ce66[_0xbf2c('0x72')][_0xbf2c('0x73')],'include':[{'model':db[_0xbf2c('0x54')],'as':_0xbf2c('0x74'),'attributes':_0x1f984e,'include':[{'model':db['CmCompany'],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':_0xbf2c('0x77'),'attributes':['id',_0xbf2c('0xf')]},{'model':db['VoiceQueue'],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x4e7b32){if(_0x4e7b32){return _0x4e7b32[_0xbf2c('0xa')]({'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']},{'transaction':_0x38ce66});}});});}})[_0xbf2c('0xb')](handleEntityNotFound(_0x45b91c,null))[_0xbf2c('0xb')](respondWithResult(_0x45b91c,null))[_0xbf2c('0x3e')](handleError(_0x45b91c,null));};exports[_0xbf2c('0x7a')]=function(_0x2029f7,_0x290f8c,_0x51617d){var _0x79cc7=[];var _0x5440a8=_0x2029f7[_0xbf2c('0x40')]['id'];var _0x12b821=_0x2029f7[_0xbf2c('0x4f')]['id'];return db['CmContact'][_0xbf2c('0x44')]()[_0xbf2c('0xb')](function(_0x4ff5c3){_0x79cc7=_[_0xbf2c('0x18')](_0x4ff5c3);return db['sequelize'][_0xbf2c('0x62')](function(_0x357989){const _0x307e46={'id':_0x5440a8};return db[_0xbf2c('0x12')]['findOne']({'attributes':['id','scheduledat',_0xbf2c('0x71')],'where':_0x307e46,'transaction':_0x357989,'lock':_0x357989[_0xbf2c('0x72')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbf2c('0x74'),'attributes':_0x79cc7,'include':[{'model':db[_0xbf2c('0x7b')],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':'List','attributes':['id',_0xbf2c('0xf')]},{'model':db[_0xbf2c('0x48')],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x26fdee){if(_0x26fdee){return _0x26fdee[_0xbf2c('0xa')]({'UserId':_0x12b821},{'transaction':_0x357989});}});});})[_0xbf2c('0xb')](handleEntityNotFound(_0x290f8c,null))[_0xbf2c('0xb')](respondWithResult(_0x290f8c,null))[_0xbf2c('0x3e')](handleError(_0x290f8c,null));};exports[_0xbf2c('0x7c')]=function(_0x5ecd37,_0x3ab5ac){return _0x5ecd37[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id'],'raw':!![]})[_0xbf2c('0xb')](function(_0x545447){if(_0x545447&&_0x545447[_0xbf2c('0x2f')]){return db[_0xbf2c('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbf2c('0x7d')](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x545447,'id')},'$or':[{'UserId':null},{'UserId':_0x5ecd37[_0xbf2c('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x2c7cf7){if(!_[_0xbf2c('0x7e')](_0x2c7cf7)&&_['isNumber'](_0x2c7cf7)){return _0x3ab5ac[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'contacts':_0x2c7cf7});}else{logger[_0xbf2c('0xd')](_0xbf2c('0x7f'),_0xbf2c('0x7c'),0x194,_0xbf2c('0x80'));_0x3ab5ac['sendStatus'](0x194);}})[_0xbf2c('0x3e')](handleError(_0x3ab5ac,null));};exports[_0xbf2c('0x81')]=function(_0x1377c1,_0x4fa011){var _0x2aa3c3=shared[_0xbf2c('0x82')];var _0x40681f=[];_[_0xbf2c('0x11')](_0x2aa3c3,function(_0x5f4f90){_0x40681f[_0xbf2c('0x83')]({'id':_0x5f4f90[_0xbf2c('0xf')],'name':_0x5f4f90[_0xbf2c('0xf')],'utcOffset':_0x5f4f90[_0xbf2c('0x84')]});});return _0x4fa011[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'tz':_0x40681f});};exports[_0xbf2c('0x85')]=function(_0x31d6f,_0x2fcb0a){var _0x391208=shared[_0xbf2c('0x82')];var _0x560da4={};if(!_[_0xbf2c('0x7e')](_0x391208[_0x31d6f['body']['id']]))_0x560da4=_0x391208[_0x31d6f[_0xbf2c('0x43')]['id']];return _0x2fcb0a[_0xbf2c('0x7')](0xc8)['json'](_0x560da4);}; \ No newline at end of file +var _0xca9e=['isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','recallme','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','sendStatus','name','send','index','CmHopper','fieldName','key','model','query','intersection','concat','filters','$or','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','length','nolimit','order','where','pick','merge','map','type','VIRTUAL','filter','options','then','include','findAll','catch','params','keys','rawAttributes','fields','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xca9e,0x136));var _0xeca9=function(_0x2462e0,_0x315133){_0x2462e0=_0x2462e0-0x0;var _0x28b761=_0xca9e[_0x2462e0];return _0x28b761;};'use strict';var moment=require(_0xeca9('0x0'));var _=require(_0xeca9('0x1'));var qs=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var shared=require(_0xeca9('0x5'));var db=require(_0xeca9('0x6'))['db'];function respondWithResult(_0x2c6185,_0x1b2864){_0x1b2864=_0x1b2864||0xc8;return function(_0x1e0a18){if(_0x1e0a18){return _0x2c6185[_0xeca9('0x7')](_0x1b2864)[_0xeca9('0x8')](_0x1e0a18);}};}function respondWithFilteredResult(_0x186a47,_0x305dc5){return function(_0x483e41){if(_0x483e41){var _0x369f5e=typeof _0x305dc5[_0xeca9('0x9')]==='undefined'&&typeof _0x305dc5['limit']===_0xeca9('0xa');var _0x239e92=_0x483e41[_0xeca9('0xb')];var _0x5305ce=_0x369f5e?0x0:_0x305dc5[_0xeca9('0x9')];var _0x364eb2=_0x369f5e?_0x483e41[_0xeca9('0xb')]:_0x305dc5[_0xeca9('0x9')]+_0x305dc5[_0xeca9('0xc')];var _0x3d06fe;if(_0x364eb2>=_0x239e92){_0x364eb2=_0x239e92;_0x3d06fe=0xc8;}else{_0x3d06fe=0xce;}_0x186a47['status'](_0x3d06fe);return _0x186a47[_0xeca9('0xd')](_0xeca9('0xe'),_0x5305ce+'-'+_0x364eb2+'/'+_0x239e92)['json'](_0x483e41);}return null;};}function saveUpdates(_0x27ca6f,_0x4b2ae1){return function(_0x3c6cc7){if(_0x3c6cc7){return _0x3c6cc7[_0xeca9('0xf')](_0x27ca6f)['then'](function(_0x3e9377){return _0x3e9377;});}return null;};}function handleEntityNotFound(_0x384ae2,_0x1ba9e9){return function(_0x4d65ee){if(!_0x4d65ee){_0x384ae2[_0xeca9('0x10')](0x194);}return _0x4d65ee;};}function handleError(_0x4422a6,_0x910814){_0x910814=_0x910814||0x1f4;return function(_0x6e9fd4){logger['error'](_0x6e9fd4['stack']);if(_0x6e9fd4[_0xeca9('0x11')]){delete _0x6e9fd4[_0xeca9('0x11')];}_0x4422a6['status'](_0x910814)[_0xeca9('0x12')](_0x6e9fd4);};}exports[_0xeca9('0x13')]=function(_0x4fbe8a,_0x517060){var _0x579421={},_0x132008={},_0x304f8f={'count':0x0,'rows':[]};var _0x3525ee=_['map'](db[_0xeca9('0x14')]['rawAttributes'],function(_0x5bbdce){return{'name':_0x5bbdce[_0xeca9('0x15')],'type':_0x5bbdce['type'][_0xeca9('0x16')]};});_0x132008[_0xeca9('0x17')]=_['map'](_0x3525ee,_0xeca9('0x11'));_0x132008[_0xeca9('0x18')]=_['keys'](_0x4fbe8a[_0xeca9('0x18')]);_0x132008['filters']=_[_0xeca9('0x19')](_0x132008[_0xeca9('0x17')],_0x132008[_0xeca9('0x18')]);_0x132008['filters']=_[_0xeca9('0x1a')](_0x132008[_0xeca9('0x1b')],['$and',_0xeca9('0x1c'),_0xeca9('0x1d'),_0xeca9('0x1e'),_0xeca9('0x1f'),'$lte',_0xeca9('0x20'),'$eq',_0xeca9('0x21'),_0xeca9('0x22'),_0xeca9('0x23'),_0xeca9('0x24'),_0xeca9('0x25'),_0xeca9('0x26'),_0xeca9('0x27'),_0xeca9('0x28'),_0xeca9('0x29'),_0xeca9('0x26'),_0xeca9('0x2a'),_0xeca9('0x2b'),_0xeca9('0x2c'),_0xeca9('0x2d')]);_0x579421[_0xeca9('0x2e')]=_['intersection'](_0x132008['model'],qs['fields'](_0x4fbe8a[_0xeca9('0x18')]['fields']));_0x579421[_0xeca9('0x2e')]=_0x579421[_0xeca9('0x2e')][_0xeca9('0x2f')]?_0x579421[_0xeca9('0x2e')]:_0x132008[_0xeca9('0x17')];if(!_0x4fbe8a[_0xeca9('0x18')]['hasOwnProperty'](_0xeca9('0x30'))){_0x579421['limit']=qs[_0xeca9('0xc')](_0x4fbe8a[_0xeca9('0x18')][_0xeca9('0xc')]);_0x579421['offset']=qs[_0xeca9('0x9')](_0x4fbe8a[_0xeca9('0x18')][_0xeca9('0x9')]);}_0x579421[_0xeca9('0x31')]=qs['sort'](_0x4fbe8a[_0xeca9('0x18')]['sort']);_0x579421[_0xeca9('0x32')]=qs[_0xeca9('0x1b')](_[_0xeca9('0x33')](_0x4fbe8a[_0xeca9('0x18')],_0x132008[_0xeca9('0x1b')]),_0x3525ee);if(_0x4fbe8a[_0xeca9('0x18')]['filter']){_0x579421[_0xeca9('0x32')]=_[_0xeca9('0x34')](_0x579421[_0xeca9('0x32')],{'$or':_[_0xeca9('0x35')](_0x3525ee,function(_0x1b318e){if(_0x1b318e[_0xeca9('0x36')]!==_0xeca9('0x37')){var _0x54d9cf={};_0x54d9cf[_0x1b318e[_0xeca9('0x11')]]={'$like':'%'+_0x4fbe8a[_0xeca9('0x18')][_0xeca9('0x38')]+'%'};return _0x54d9cf;}})});}_0x579421=_[_0xeca9('0x34')]({},_0x579421,_0x4fbe8a[_0xeca9('0x39')]);var _0x1eeb0a={'where':_0x579421['where']};return db[_0xeca9('0x14')]['count'](_0x1eeb0a)[_0xeca9('0x3a')](function(_0x4f7f25){_0x304f8f[_0xeca9('0xb')]=_0x4f7f25;if(_0x4fbe8a[_0xeca9('0x18')]['includeAll']){_0x579421[_0xeca9('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0xeca9('0x3c')](_0x579421);})['then'](function(_0x3c11fa){_0x304f8f['rows']=_0x3c11fa;return _0x304f8f;})[_0xeca9('0x3a')](respondWithFilteredResult(_0x517060,_0x579421))[_0xeca9('0x3d')](handleError(_0x517060,null));};exports['show']=function(_0x3572a1,_0xe8a1a2){var _0x4e8080={'raw':!![],'where':{'id':_0x3572a1[_0xeca9('0x3e')]['id']}},_0x2e2496={};_0x2e2496[_0xeca9('0x17')]=_[_0xeca9('0x3f')](db[_0xeca9('0x14')][_0xeca9('0x40')]);_0x2e2496[_0xeca9('0x18')]=_[_0xeca9('0x3f')](_0x3572a1[_0xeca9('0x18')]);_0x2e2496['filters']=_[_0xeca9('0x19')](_0x2e2496[_0xeca9('0x17')],_0x2e2496[_0xeca9('0x18')]);_0x4e8080[_0xeca9('0x2e')]=_[_0xeca9('0x19')](_0x2e2496[_0xeca9('0x17')],qs[_0xeca9('0x41')](_0x3572a1['query'][_0xeca9('0x41')]));_0x4e8080[_0xeca9('0x2e')]=_0x4e8080[_0xeca9('0x2e')][_0xeca9('0x2f')]?_0x4e8080[_0xeca9('0x2e')]:_0x2e2496['model'];if(_0x3572a1[_0xeca9('0x18')][_0xeca9('0x42')]){_0x4e8080[_0xeca9('0x3b')]=[{'all':!![]}];}_0x4e8080=_[_0xeca9('0x34')]({},_0x4e8080,_0x3572a1['options']);return db[_0xeca9('0x14')][_0xeca9('0x43')](_0x4e8080)['then'](handleEntityNotFound(_0xe8a1a2,null))[_0xeca9('0x3a')](respondWithResult(_0xe8a1a2,null))[_0xeca9('0x3d')](handleError(_0xe8a1a2,null));};exports[_0xeca9('0x44')]=function(_0x11c0fe,_0x1643cd){return db[_0xeca9('0x14')][_0xeca9('0x44')](_0x11c0fe[_0xeca9('0x45')],{})[_0xeca9('0x3a')](respondWithResult(_0x1643cd,0xc9))[_0xeca9('0x3d')](handleError(_0x1643cd,null));};exports[_0xeca9('0xf')]=function(_0x22599e,_0x14ba18){if(_0x22599e[_0xeca9('0x45')]['id']){delete _0x22599e[_0xeca9('0x45')]['id'];}return db['CmHopper'][_0xeca9('0x43')]({'where':{'id':_0x22599e[_0xeca9('0x3e')]['id']}})[_0xeca9('0x3a')](handleEntityNotFound(_0x14ba18,null))[_0xeca9('0x3a')](saveUpdates(_0x22599e['body'],null))[_0xeca9('0x3a')](respondWithResult(_0x14ba18,null))[_0xeca9('0x3d')](handleError(_0x14ba18,null));};exports['describe']=function(_0x5e6dc2,_0x3edca5){return db[_0xeca9('0x14')][_0xeca9('0x46')]()[_0xeca9('0x3a')](respondWithResult(_0x3edca5,null))['catch'](handleError(_0x3edca5,null));};exports[_0xeca9('0x47')]=function(_0xa4faf9,_0x346c62){var _0x454837;var _0x2b024b=_0xa4faf9[_0xeca9('0x3e')]['id'];return db[_0xeca9('0x14')][_0xeca9('0x43')]({'where':{'id':_0xa4faf9[_0xeca9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x346c62,null))['then'](function(_0x305ba4){if(_0x305ba4){return _0x305ba4[_0xeca9('0x47')]()['then'](function(_0x283d2d){return _0x283d2d;});}})[_0xeca9('0x3a')](function(_0x2ed3c0){_0x454837=_0x2ed3c0;if(_0x2ed3c0){if(_0x2ed3c0[_0xeca9('0x48')]||_0x2ed3c0[_0xeca9('0x49')]){return db[_0x2ed3c0[_0xeca9('0x48')]?_0xeca9('0x4a'):_0xeca9('0x4b')][_0xeca9('0x43')]({'where':{'id':_0x2ed3c0['VoiceQueueId']?_0x2ed3c0['VoiceQueueId']:_0x2ed3c0['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xeca9('0x3a')](function(_0x5cc6de){var _0x940aaf={};if(_0x5cc6de){_[_0xeca9('0x34')](_0x940aaf,_['omit'](_0x454837[_0xeca9('0x4c')],[_0xeca9('0x4d'),_0xeca9('0x4e'),'id']));_0x940aaf['state']=0x15;_0x940aaf['statedesc']=_0xeca9('0x4f');_0x940aaf[_0xeca9('0x50')]=_0x5cc6de[_0xeca9('0x11')];_0x940aaf[_0xeca9('0x51')]=_0xa4faf9['user'][_0xeca9('0x11')];_0x940aaf[_0xeca9('0x52')]=_0xa4faf9[_0xeca9('0x53')]['id'];_0x940aaf[_0xeca9('0x4f')]=!![];_0x940aaf[_0xeca9('0x54')]=moment()[_0xeca9('0x55')](_0xeca9('0x56'));_0x940aaf[_0xeca9('0x57')]=_0x454837[_0xeca9('0x58')];_0x940aaf[_0xeca9('0x59')]=_0x454837[_0xeca9('0x48')]?_0xeca9('0x5a'):_0xeca9('0x5b');return db[_0xeca9('0x5c')][_0xeca9('0x43')]({'where':{'id':_0x940aaf[_0xeca9('0x5d')]},'attributes':['firstName',_0xeca9('0x5e')]})[_0xeca9('0x3a')](function(_0x2e1ff1){if(!_[_0xeca9('0x5f')](_0x346c62)&&!_['isNil'](_0x2e1ff1[_0xeca9('0x60')])){_0x940aaf[_0xeca9('0x61')]=_0x2e1ff1['firstName'];if(!_[_0xeca9('0x5f')](_0x2e1ff1[_0xeca9('0x5e')])){_0x940aaf[_0xeca9('0x61')]+='\x20'+_0x2e1ff1[_0xeca9('0x5e')];}}})[_0xeca9('0x62')](function(){return db['CmHopperFinal'][_0xeca9('0x44')](_0x940aaf);});}})[_0xeca9('0x3a')](function(_0x5b8222){return db[_0xeca9('0x63')][_0xeca9('0x47')]({'where':{'CmHopperId':_0x2b024b}});})[_0xeca9('0x3a')](function(){return _0x346c62[_0xeca9('0x7')](0xcc)[_0xeca9('0x64')]();})[_0xeca9('0x3d')](handleError(_0x346c62,null));};exports[_0xeca9('0x65')]=function(_0x2ade57,_0x51bdab){var _0x4cd314=[];return db['CmContact'][_0xeca9('0x46')]()[_0xeca9('0x3a')](function(_0xce6cfd){_0x4cd314=_['keys'](_0xce6cfd);return _0x2ade57[_0xeca9('0x53')][_0xeca9('0x66')]({'where':{'type':_0xeca9('0x67'),'dialActive':!![],'dialMethod':_0xeca9('0x68')},'attributes':['id',_0xeca9('0x69'),_0xeca9('0x6a')],'raw':!![]});})[_0xeca9('0x3a')](function(_0x502f33){if(_0x502f33&&_0x502f33['length']){return db['sequelize'][_0xeca9('0x6b')](function(_0xd7ccc8){var _0x5be034={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeca9('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xeca9('0x35')](_0x502f33,'id')},'$or':[{'UserId':null},{'UserId':_0x2ade57[_0xeca9('0x53')]['id']}]};var _0x475af3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x502f33)[_0xeca9('0x38')]([_0xeca9('0x6a'),0x0])['map']('id')[_0xeca9('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x2ade57[_0xeca9('0x53')]['id']}]};var _0x20bc02={'$or':[_0x5be034,_0x475af3]};var _0x1cd614=[];if(_0x2ade57[_0xeca9('0x45')][_0xeca9('0x6d')]&&_0x2ade57[_0xeca9('0x45')][_0xeca9('0x6d')]==='prev'){if(!_[_0xeca9('0x6e')](_0x2ade57['body'][_0xeca9('0x6f')])){_0x20bc02['id']={'$in':_0x2ade57[_0xeca9('0x45')][_0xeca9('0x6f')]};}_0x1cd614=[[_0xeca9('0x70'),_0xeca9('0x71')],[_0xeca9('0x72'),_0x502f33[0x0]['dialOrderByScheduledAt']===_0xeca9('0x71')?_0xeca9('0x73'):_0xeca9('0x71')],db['sequelize'][_0xeca9('0x74')](_0xeca9('0x75')),['id',_0xeca9('0x73')]];}else{if(!_[_0xeca9('0x6e')](_0x2ade57[_0xeca9('0x45')][_0xeca9('0x6f')])){_0x20bc02['id']={'$notIn':_0x2ade57[_0xeca9('0x45')][_0xeca9('0x6f')]};}_0x1cd614=[['priority',_0xeca9('0x73')],[_0xeca9('0x72'),_0x502f33[0x0][_0xeca9('0x69')]],db[_0xeca9('0x76')][_0xeca9('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xeca9('0x14')][_0xeca9('0x77')]({'attributes':['id',_0xeca9('0x78'),_0xeca9('0x58'),'recallme'],'where':_0x20bc02,'order':_0x1cd614,'transaction':_0xd7ccc8,'lock':_0xd7ccc8[_0xeca9('0x79')][_0xeca9('0x7a')],'include':[{'model':db[_0xeca9('0x5c')],'as':_0xeca9('0x7b'),'attributes':_0x4cd314,'include':[{'model':db[_0xeca9('0x7c')],'as':_0xeca9('0x7d'),'attributes':['id',_0xeca9('0x11')]}]},{'model':db[_0xeca9('0x7e')],'as':_0xeca9('0x7f'),'attributes':['id',_0xeca9('0x11')]},{'model':db['VoiceQueue'],'as':_0xeca9('0x80'),'attributes':['id',_0xeca9('0x11'),_0xeca9('0x81')]}]})['then'](function(_0x4d7070){if(_0x4d7070){return _0x4d7070['update']({'UserId':_0x2ade57[_0xeca9('0x53')]['id']},{'transaction':_0xd7ccc8});}});});}})[_0xeca9('0x3a')](handleEntityNotFound(_0x51bdab,null))['then'](respondWithResult(_0x51bdab,null))[_0xeca9('0x3d')](handleError(_0x51bdab,null));};exports[_0xeca9('0x82')]=function(_0x28675e,_0x3bf823,_0x53aceb){var _0x17e50d=[];var _0xfb9250=_0x28675e['params']['id'];var _0x494bfb=_0x28675e['user']['id'];return db[_0xeca9('0x5c')][_0xeca9('0x46')]()[_0xeca9('0x3a')](function(_0x4b5029){_0x17e50d=_[_0xeca9('0x3f')](_0x4b5029);return db['sequelize'][_0xeca9('0x6b')](function(_0xbc11b7){const _0x3bd3d9={'id':_0xfb9250};return db[_0xeca9('0x14')][_0xeca9('0x77')]({'attributes':['id','scheduledat',_0xeca9('0x83')],'where':_0x3bd3d9,'transaction':_0xbc11b7,'lock':_0xbc11b7['LOCK'][_0xeca9('0x7a')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x17e50d,'include':[{'model':db['CmCompany'],'as':_0xeca9('0x7d'),'attributes':['id','name']}]},{'model':db[_0xeca9('0x7e')],'as':_0xeca9('0x7f'),'attributes':['id',_0xeca9('0x11')]},{'model':db[_0xeca9('0x4a')],'as':_0xeca9('0x80'),'attributes':['id',_0xeca9('0x11'),'dialActive']}]})[_0xeca9('0x3a')](function(_0xd0c575){if(_0xd0c575){return _0xd0c575[_0xeca9('0xf')]({'UserId':_0x494bfb},{'transaction':_0xbc11b7});}});});})[_0xeca9('0x3a')](handleEntityNotFound(_0x3bf823,null))[_0xeca9('0x3a')](respondWithResult(_0x3bf823,null))[_0xeca9('0x3d')](handleError(_0x3bf823,null));};exports[_0xeca9('0x84')]=function(_0x368128,_0x5f14df){return _0x368128[_0xeca9('0x53')][_0xeca9('0x66')]({'where':{'type':_0xeca9('0x67'),'dialActive':!![],'dialMethod':_0xeca9('0x68')},'attributes':['id'],'raw':!![]})[_0xeca9('0x3a')](function(_0x53d8a5){if(_0x53d8a5&&_0x53d8a5[_0xeca9('0x2f')]){return db[_0xeca9('0x14')][_0xeca9('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeca9('0x55')](_0xeca9('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x53d8a5,'id')},'$or':[{'UserId':null},{'UserId':_0x368128[_0xeca9('0x53')]['id']}]}});}return 0x0;})[_0xeca9('0x3a')](function(_0x275845){if(!_[_0xeca9('0x5f')](_0x275845)&&_[_0xeca9('0x85')](_0x275845)){return _0x5f14df[_0xeca9('0x7')](0xc8)[_0xeca9('0x8')]({'contacts':_0x275845});}else{logger['error'](_0xeca9('0x86'),_0xeca9('0x84'),0x194,_0xeca9('0x87'));_0x5f14df[_0xeca9('0x10')](0x194);}})[_0xeca9('0x3d')](handleError(_0x5f14df,null));};exports[_0xeca9('0x88')]=function(_0x271f09,_0x3c4c5f){var _0x563230=shared[_0xeca9('0x89')];var _0x54f9aa=[];_[_0xeca9('0x35')](_0x563230,function(_0x3cb07b){_0x54f9aa[_0xeca9('0x8a')]({'id':_0x3cb07b[_0xeca9('0x11')],'name':_0x3cb07b['name'],'utcOffset':_0x3cb07b['utcOffset']});});return _0x3c4c5f['status'](0xc8)[_0xeca9('0x8')]({'tz':_0x54f9aa});};exports[_0xeca9('0x8b')]=function(_0x473fa6,_0x77cbec){var _0x470b03=shared[_0xeca9('0x89')];var _0xb4c392={};if(!_['isNil'](_0x470b03[_0x473fa6[_0xeca9('0x45')]['id']]))_0xb4c392=_0x470b03[_0x473fa6[_0xeca9('0x45')]['id']];return _0x77cbec['status'](0xc8)[_0xeca9('0x8')](_0xb4c392);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index dd6dc9b..542ab05 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 _0xeda8=['exports','define','cm_hopper','scheduledat','phone','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x5192d7,_0x3dc1ae){var _0x3d79f4=function(_0x5b0a94){while(--_0x5b0a94){_0x5192d7['push'](_0x5192d7['shift']());}};_0x3d79f4(++_0x3dc1ae);}(_0xeda8,0x104));var _0x8eda=function(_0x2657a8,_0x1befe3){_0x2657a8=_0x2657a8-0x0;var _0x3cb723=_0xeda8[_0x2657a8];return _0x3cb723;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('CmHopper',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 96b786b..70a2e25 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 _0x0f3e=['model','attributes','then','debug','catch','error','message','CmHopper','find','ShowCmHopper','CreateCmHopper','create','body','info','stringify','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','keys','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','options','raw','where','limit','include','map'];(function(_0x5505b7,_0x1dcacb){var _0x43e926=function(_0x1fd00e){while(--_0x1fd00e){_0x5505b7['push'](_0x5505b7['shift']());}};_0x43e926(++_0x1dcacb);}(_0x0f3e,0x92));var _0xe0f3=function(_0x472810,_0x14c7e2){_0x472810=_0x472810-0x0;var _0x3e9835=_0x0f3e[_0x472810];return _0x3e9835;};'use strict';var _=require('lodash');var util=require(_0xe0f3('0x0'));var moment=require(_0xe0f3('0x1'));var BPromise=require(_0xe0f3('0x2'));var db=require(_0xe0f3('0x3'))['db'];var logger=require('../../config/logger')(_0xe0f3('0x4'));exports[_0xe0f3('0x5')]=function(_0xf16457){var _0x34ca0c=this;return new Promise(function(_0x249fcd,_0x1747ca){return db['CmHopper']['findAll']({'raw':_0xf16457[_0xe0f3('0x6')]?_0xf16457[_0xe0f3('0x6')][_0xe0f3('0x7')]===undefined?!![]:![]:!![],'where':_0xf16457[_0xe0f3('0x6')]?_0xf16457[_0xe0f3('0x6')][_0xe0f3('0x8')]||null:null,'attributes':_0xf16457['options']?_0xf16457[_0xe0f3('0x6')]['attributes']||null:null,'limit':_0xf16457[_0xe0f3('0x6')]?_0xf16457[_0xe0f3('0x6')][_0xe0f3('0x9')]||null:null,'include':_0xf16457[_0xe0f3('0x6')]?_0xf16457[_0xe0f3('0x6')][_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0xf16457[_0xe0f3('0x6')]['include'],function(_0x510ff3){return{'model':db[_0x510ff3[_0xe0f3('0xc')]],'as':_0x510ff3['as'],'attributes':_0x510ff3[_0xe0f3('0xd')],'include':_0x510ff3[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0x510ff3['include'],function(_0x37016c){return{'model':db[_0x37016c[_0xe0f3('0xc')]],'as':_0x37016c['as'],'attributes':_0x37016c['attributes'],'include':_0x37016c[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0x37016c[_0xe0f3('0xa')],function(_0x4ae611){return{'model':db[_0x4ae611[_0xe0f3('0xc')]],'as':_0x4ae611['as'],'attributes':_0x4ae611['attributes']};}):[]};}):[]};}):[]:[]})[_0xe0f3('0xe')](function(_0x18b938){logger['info'](_0xe0f3('0x5'),_0xf16457);logger[_0xe0f3('0xf')](_0xe0f3('0x5'),_0xf16457,JSON['stringify'](_0x18b938));_0x249fcd(_0x18b938);})[_0xe0f3('0x10')](function(_0x5104d0){logger[_0xe0f3('0x11')](_0xe0f3('0x5'),_0x5104d0[_0xe0f3('0x12')],_0xf16457);_0x1747ca(_0x34ca0c[_0xe0f3('0x11')](0x1f4,_0x5104d0[_0xe0f3('0x12')]));});});};exports['ShowCmHopper']=function(_0x17dffa){var _0x48270a=this;return new Promise(function(_0x59e794,_0x6bcdcc){return db[_0xe0f3('0x13')][_0xe0f3('0x14')]({'raw':_0x17dffa[_0xe0f3('0x6')]?_0x17dffa[_0xe0f3('0x6')][_0xe0f3('0x7')]===undefined?!![]:![]:!![],'where':_0x17dffa[_0xe0f3('0x6')]?_0x17dffa[_0xe0f3('0x6')]['where']||null:null,'attributes':_0x17dffa[_0xe0f3('0x6')]?_0x17dffa['options'][_0xe0f3('0xd')]||null:null,'include':_0x17dffa[_0xe0f3('0x6')]?_0x17dffa[_0xe0f3('0x6')][_0xe0f3('0xa')]?_['map'](_0x17dffa[_0xe0f3('0x6')][_0xe0f3('0xa')],function(_0x409f48){return{'model':db[_0x409f48[_0xe0f3('0xc')]],'as':_0x409f48['as'],'attributes':_0x409f48['attributes'],'include':_0x409f48[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0x409f48['include'],function(_0x2699c6){return{'model':db[_0x2699c6[_0xe0f3('0xc')]],'as':_0x2699c6['as'],'attributes':_0x2699c6['attributes'],'include':_0x2699c6['include']?_[_0xe0f3('0xb')](_0x2699c6[_0xe0f3('0xa')],function(_0xb3e95){return{'model':db[_0xb3e95[_0xe0f3('0xc')]],'as':_0xb3e95['as'],'attributes':_0xb3e95[_0xe0f3('0xd')]};}):[]};}):[]};}):[]:[]})[_0xe0f3('0xe')](function(_0x2adbc7){logger['info'](_0xe0f3('0x15'),_0x17dffa);logger[_0xe0f3('0xf')](_0xe0f3('0x15'),_0x17dffa,JSON['stringify'](_0x2adbc7));_0x59e794(_0x2adbc7);})[_0xe0f3('0x10')](function(_0x4ba83d){logger[_0xe0f3('0x11')](_0xe0f3('0x15'),_0x4ba83d[_0xe0f3('0x12')],_0x17dffa);_0x6bcdcc(_0x48270a[_0xe0f3('0x11')](0x1f4,_0x4ba83d[_0xe0f3('0x12')]));});});};exports[_0xe0f3('0x16')]=function(_0x8eeb6a){var _0x3df9ba=this;return new Promise(function(_0x44d407,_0x2b9e54){return db[_0xe0f3('0x13')][_0xe0f3('0x17')](_0x8eeb6a[_0xe0f3('0x18')],{'raw':_0x8eeb6a[_0xe0f3('0x6')]?_0x8eeb6a[_0xe0f3('0x6')][_0xe0f3('0x7')]===undefined?!![]:![]:!![]})[_0xe0f3('0xe')](function(_0x198a5d){logger[_0xe0f3('0x19')](_0xe0f3('0x16'),_0x8eeb6a);logger[_0xe0f3('0xf')](_0xe0f3('0x16'),_0x8eeb6a,JSON[_0xe0f3('0x1a')](_0x198a5d));_0x44d407(_0x198a5d);})['catch'](function(_0x20eda5){logger[_0xe0f3('0x11')](_0xe0f3('0x16'),_0x20eda5[_0xe0f3('0x12')],_0x8eeb6a);_0x2b9e54(_0x3df9ba[_0xe0f3('0x11')](0x1f4,_0x20eda5[_0xe0f3('0x12')]));});});};exports[_0xe0f3('0x1b')]=function(_0x99e73a){var _0x4db9b9=this;return new Promise(function(_0x50df37,_0x4cef29){return db['CmHopper'][_0xe0f3('0x1c')](_0x99e73a[_0xe0f3('0x18')],{'raw':_0x99e73a[_0xe0f3('0x6')]?_0x99e73a[_0xe0f3('0x6')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99e73a['options']?_0x99e73a['options'][_0xe0f3('0x8')]||null:null,'attributes':_0x99e73a[_0xe0f3('0x6')]?_0x99e73a[_0xe0f3('0x6')][_0xe0f3('0xd')]||null:null,'limit':_0x99e73a[_0xe0f3('0x6')]?_0x99e73a['options'][_0xe0f3('0x9')]||null:null})[_0xe0f3('0xe')](function(_0x57931c){logger[_0xe0f3('0x19')](_0xe0f3('0x1b'),_0x99e73a);logger[_0xe0f3('0x19')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x99e73a[_0xe0f3('0x6')][_0xe0f3('0x8')]),_0x99e73a[_0xe0f3('0x18')][_0xe0f3('0x1d')]);logger['debug']('UpdateCmHopper',_0x99e73a,JSON[_0xe0f3('0x1a')](_0x57931c));_0x50df37(_0x57931c);})[_0xe0f3('0x10')](function(_0x2c3ba2){logger[_0xe0f3('0x11')](_0xe0f3('0x1b'),_0x2c3ba2['message'],_0x99e73a);_0x4cef29(_0x4db9b9[_0xe0f3('0x11')](0x1f4,_0x2c3ba2[_0xe0f3('0x12')]));});});};exports[_0xe0f3('0x1e')]=function(_0x3c4dc0){var _0x4b1077=this;return new Promise(function(_0x2d64a9,_0x22f772){return db[_0xe0f3('0x13')][_0xe0f3('0x1f')]({'where':_0x3c4dc0[_0xe0f3('0x6')]?_0x3c4dc0['options'][_0xe0f3('0x8')]||null:null})[_0xe0f3('0xe')](function(_0x38b8be){logger[_0xe0f3('0x19')](_0xe0f3('0x1e'),_0x3c4dc0);logger[_0xe0f3('0xf')]('DestroyCmHopper',_0x3c4dc0,JSON[_0xe0f3('0x1a')](_0x38b8be));_0x2d64a9(_0x38b8be);})[_0xe0f3('0x10')](function(_0xa69956){logger[_0xe0f3('0x11')]('DestroyCmHopper',_0xa69956['message'],_0x3c4dc0);_0x22f772(_0x4b1077[_0xe0f3('0x11')](0x1f4,_0xa69956[_0xe0f3('0x12')]));});});};exports[_0xe0f3('0x20')]=function(_0xa12a0a){var _0x3df8a7=this;return new Promise(function(_0x55e219,_0x5bd42b){return db[_0xe0f3('0x21')][_0xe0f3('0x22')]()[_0xe0f3('0xe')](function(_0xe057c6){return db['sequelize'][_0xe0f3('0x23')](function(_0x1b7b43){return db[_0xe0f3('0x13')]['findAll']({'where':_0xa12a0a['options']?_0xa12a0a['options'][_0xe0f3('0x8')]||null:null,'attributes':_0xa12a0a['options']?_0xa12a0a[_0xe0f3('0x6')][_0xe0f3('0xd')]||null:null,'limit':_0xa12a0a[_0xe0f3('0x6')]?_0xa12a0a[_0xe0f3('0x6')][_0xe0f3('0x9')]||null:null,'order':_0xa12a0a[_0xe0f3('0x6')]?_0xa12a0a[_0xe0f3('0x6')][_0xe0f3('0x24')]||null:null,'transaction':_0x1b7b43,'lock':_0x1b7b43[_0xe0f3('0x25')][_0xe0f3('0x26')],'include':[{'model':db[_0xe0f3('0x21')],'as':_0xe0f3('0x27'),'attributes':_['keys'](_0xe057c6)},{'model':db[_0xe0f3('0x28')],'as':_0xe0f3('0x29'),'attributes':['id',_0xe0f3('0x2a'),_0xe0f3('0x2b')]}]})['then'](function(_0x366f45){var _0x4d19e1=[];var _0x508ead=[];for(var _0xd3d04c=0x0;_0xd3d04c<_0x366f45[_0xe0f3('0x2c')];_0xd3d04c+=0x1){var _0x509fc5=_0x366f45[_0xd3d04c][_0xe0f3('0x2d')];if(_0x509fc5===null){_0x4d19e1[_0xe0f3('0x2e')](_0x366f45[_0xd3d04c]['update'](_0xa12a0a[_0xe0f3('0x18')],{'transaction':_0x1b7b43}));}else if(!_0x508ead[_0xe0f3('0x2f')](_0x509fc5)){_0x508ead['push'](_0x509fc5);_0x4d19e1[_0xe0f3('0x2e')](_0x366f45[_0xd3d04c][_0xe0f3('0x1c')](_0xa12a0a[_0xe0f3('0x18')],{'transaction':_0x1b7b43}));}}return BPromise[_0xe0f3('0x30')](_0x4d19e1);});})['then'](function(_0x3764ca){logger[_0xe0f3('0x19')](_0xe0f3('0x20'),_0xa12a0a);if(_0x3764ca['length']>0x0){logger['info'](_0xe0f3('0x31'),_0x3764ca[0x0][_0xe0f3('0x32')]['id'],_0x3764ca[0x0][_0xe0f3('0x32')]['ContactId'],_0x3764ca[0x0][_0xe0f3('0x32')]['active']);}logger[_0xe0f3('0xf')](_0xe0f3('0x20'),_0xa12a0a,JSON[_0xe0f3('0x1a')](_0x3764ca));_0x55e219(_0x3764ca);})[_0xe0f3('0x10')](function(_0x582bac){logger[_0xe0f3('0x11')](_0xe0f3('0x20'),_0x582bac[_0xe0f3('0x12')],_0xa12a0a);_0x5bd42b(_0x3df8a7[_0xe0f3('0x11')](0x1f4,_0x582bac[_0xe0f3('0x12')]));});});});};exports[_0xe0f3('0x33')]=function(_0x343ea1){var _0x321e28=this;return new Promise(function(_0x502447,_0x3cddb6){return db[_0xe0f3('0x34')][_0xe0f3('0x23')](function(_0x292b84){return db[_0xe0f3('0x35')][_0xe0f3('0x17')](_0x343ea1['body'],{'raw':_0x343ea1[_0xe0f3('0x6')]?_0x343ea1['options'][_0xe0f3('0x7')]===undefined?!![]:![]:!![],'transaction':_0x292b84})[_0xe0f3('0xe')](function(){logger['info'](_0xe0f3('0x36'),JSON[_0xe0f3('0x1a')](_0x343ea1[_0xe0f3('0x6')]['where']),_0x343ea1[_0xe0f3('0x6')]['where']['active']);return db['CmHopper'][_0xe0f3('0x1f')]({'where':_0x343ea1[_0xe0f3('0x6')]?_0x343ea1[_0xe0f3('0x6')][_0xe0f3('0x8')]||null:null,'transaction':_0x292b84});});})[_0xe0f3('0xe')](function(_0xbbc2b0){logger[_0xe0f3('0x19')](_0xe0f3('0x33'),_0x343ea1);logger[_0xe0f3('0xf')](_0xe0f3('0x33'),_0x343ea1,JSON['stringify'](_0xbbc2b0));_0x502447(_0xbbc2b0);})['catch'](function(_0x1c07d8){logger['error']('MoveContactManagedDialer',_0x1c07d8[_0xe0f3('0x12')],_0x343ea1);_0x3cddb6(_0x321e28[_0xe0f3('0x11')](0x1f4,_0x1c07d8[_0xe0f3('0x12')]));});});};exports[_0xe0f3('0x37')]=function(_0x1ffd31){var _0x57ff6b=this;return new Promise(function(_0x44591a,_0x5a7906){return db['CmHopper'][_0xe0f3('0x38')]({'raw':_0x1ffd31[_0xe0f3('0x6')]?_0x1ffd31[_0xe0f3('0x6')][_0xe0f3('0x7')]===undefined?!![]:![]:!![],'where':_0x1ffd31[_0xe0f3('0x6')]?_0x1ffd31[_0xe0f3('0x6')][_0xe0f3('0x8')]||null:null,'attributes':[[db[_0xe0f3('0x34')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe0f3('0x34')][_0xe0f3('0x39')](_0xe0f3('0x3a')+util[_0xe0f3('0x3b')]('\x22%s\x22',moment()[_0xe0f3('0x3b')](_0xe0f3('0x3c')))+_0xe0f3('0x3d')))),_0xe0f3('0x3e')]]})[_0xe0f3('0xe')](function(_0x44e115){logger['info'](_0xe0f3('0x37'),_0x1ffd31);logger[_0xe0f3('0xf')](_0xe0f3('0x37'),_0x1ffd31,JSON[_0xe0f3('0x1a')](_0x44e115));_0x44591a(_0x44e115);})[_0xe0f3('0x10')](function(_0x2606bb){logger[_0xe0f3('0x11')]('CountReScheduled',_0x2606bb[_0xe0f3('0x12')],_0x1ffd31);_0x5a7906(_0x57ff6b[_0xe0f3('0x11')](0x1f4,_0x2606bb['message']));});});};exports[_0xe0f3('0x3f')]=function(_0x547360){var _0x10ecfc=this;return new Promise(function(_0x16cfa7,_0x55cbb6){return db[_0xe0f3('0x21')][_0xe0f3('0x22')]()[_0xe0f3('0xe')](function(){return db['sequelize']['transaction'](function(_0x4f8dbf){return db[_0xe0f3('0x13')][_0xe0f3('0x38')]({'where':_0x547360[_0xe0f3('0x6')]?_0x547360['options'][_0xe0f3('0x8')]||null:null,'attributes':_0x547360[_0xe0f3('0x6')]?_0x547360['options'][_0xe0f3('0xd')]||null:null,'limit':0x1,'order':_0x547360['options']?_0x547360[_0xe0f3('0x6')][_0xe0f3('0x24')]||null:null,'group':db['CmHopper'][_0xe0f3('0x2d')],'transaction':_0x4f8dbf,'lock':_0x4f8dbf[_0xe0f3('0x25')][_0xe0f3('0x26')],'include':_0x547360[_0xe0f3('0x6')]?_0x547360[_0xe0f3('0x6')]['include']?_['map'](_0x547360[_0xe0f3('0x6')][_0xe0f3('0xa')],function(_0x58fd9f){return{'model':db[_0x58fd9f[_0xe0f3('0xc')]],'as':_0x58fd9f['as'],'attributes':_0x58fd9f[_0xe0f3('0xd')],'include':_0x58fd9f[_0xe0f3('0xa')]?_['map'](_0x58fd9f[_0xe0f3('0xa')],function(_0xb5eec){return{'model':db[_0xb5eec['model']],'as':_0xb5eec['as'],'attributes':_0xb5eec[_0xe0f3('0xd')],'include':_0xb5eec[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0xb5eec[_0xe0f3('0xa')],function(_0x4c121c){return{'model':db[_0x4c121c[_0xe0f3('0xc')]],'as':_0x4c121c['as'],'attributes':_0x4c121c[_0xe0f3('0xd')]};}):[]};}):[]};}):[]:[]})[_0xe0f3('0xe')](function(_0x402411){var _0x1d2640=[];for(var _0x53f55e=0x0;_0x53f55e<_0x402411['length'];_0x53f55e+=0x1){_0x1d2640['push'](_0x402411[_0x53f55e][_0xe0f3('0x1c')](_0x547360['body'],{'transaction':_0x4f8dbf}));}return BPromise[_0xe0f3('0x30')](_0x1d2640);});})[_0xe0f3('0xe')](function(_0xf1c986){logger[_0xe0f3('0x19')](_0xe0f3('0x3f'),_0x547360);logger[_0xe0f3('0xf')](_0xe0f3('0x3f'),_0x547360,JSON[_0xe0f3('0x1a')](_0xf1c986));_0x16cfa7(_0xf1c986);})[_0xe0f3('0x10')](function(_0x1c3b84){logger[_0xe0f3('0x11')](_0xe0f3('0x3f'),_0x1c3b84[_0xe0f3('0x12')],_0x547360);_0x55cbb6(_0x10ecfc[_0xe0f3('0x11')](0x1f4,_0x1c3b84[_0xe0f3('0x12')]));});});});};exports[_0xe0f3('0x40')]=function(_0x55698d){var _0x94c0bd=this;return new Promise(function(_0x431c95,_0x2f1528){db['CmContact']['describe']()['then'](function(_0x2112a3){return db['CmHopper']['findAll']({'raw':_0x55698d[_0xe0f3('0x6')]?_0x55698d[_0xe0f3('0x6')][_0xe0f3('0x7')]===undefined?!![]:![]:!![],'where':_0x55698d[_0xe0f3('0x6')]?_0x55698d[_0xe0f3('0x6')]['where']||null:null,'attributes':_0x55698d['options']?_0x55698d[_0xe0f3('0x6')][_0xe0f3('0xd')]||null:null,'limit':_0x55698d[_0xe0f3('0x6')]?_0x55698d[_0xe0f3('0x6')]['limit']||null:null,'include':_0x55698d[_0xe0f3('0x6')]?_0x55698d[_0xe0f3('0x6')][_0xe0f3('0xa')]?_['map'](_0x55698d[_0xe0f3('0x6')]['include'],function(_0x173e99){return{'model':db[_0x173e99[_0xe0f3('0xc')]],'as':_0x173e99['as'],'attributes':_0x173e99['as']===_0xe0f3('0x27')?_[_0xe0f3('0x41')](_0x2112a3):_0x173e99[_0xe0f3('0xd')],'include':_0x173e99[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0x173e99[_0xe0f3('0xa')],function(_0x43a510){return{'model':db[_0x43a510[_0xe0f3('0xc')]],'as':_0x43a510['as'],'attributes':_0x43a510[_0xe0f3('0xd')],'include':_0x43a510[_0xe0f3('0xa')]?_[_0xe0f3('0xb')](_0x43a510[_0xe0f3('0xa')],function(_0x35572f){return{'model':db[_0x35572f[_0xe0f3('0xc')]],'as':_0x35572f['as'],'attributes':_0x35572f[_0xe0f3('0xd')]};}):[]};}):[]};}):[]:[]})[_0xe0f3('0xe')](function(_0x4b7b72){logger[_0xe0f3('0x19')](_0xe0f3('0x5'),_0x55698d);logger['debug'](_0xe0f3('0x5'),_0x55698d,JSON[_0xe0f3('0x1a')](_0x4b7b72));_0x431c95(_0x4b7b72);})[_0xe0f3('0x10')](function(_0x1a567c){logger['error'](_0xe0f3('0x5'),_0x1a567c[_0xe0f3('0x12')],_0x55698d);_0x2f1528(_0x94c0bd[_0xe0f3('0x11')](0x1f4,_0x1a567c[_0xe0f3('0x12')]));});});});};exports['GetContactByPhone']=function(_0x48ca0a){var _0x384b6b=this;return new Promise(function(_0x539130,_0x28bab9){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x48ca0a[_0xe0f3('0x6')][_0xe0f3('0x8')][_0xe0f3('0x42')]},'attributes':['id','dialTimezone'],'order':[['id',_0xe0f3('0x43')]]})['then'](function(_0x509161){logger[_0xe0f3('0x19')]('getContactByPhone',_0x48ca0a);logger[_0xe0f3('0xf')](_0xe0f3('0x44'),_0x48ca0a,JSON[_0xe0f3('0x1a')](_0x509161));_0x539130(_0x509161);})[_0xe0f3('0x10')](function(_0x1889c5){logger[_0xe0f3('0x11')](_0xe0f3('0x44'),_0x1889c5[_0xe0f3('0x12')],_0x48ca0a);_0x28bab9(_0x384b6b[_0xe0f3('0x11')](0x1f4,_0x1889c5[_0xe0f3('0x12')]));});});};exports['ResetActiveCalls']=function(_0x498a1f){var _0x57d7b2=this;return new Promise(function(_0x52a7e0,_0x2e4118){return db[_0xe0f3('0x34')]['transaction'](function(_0x21cfe0){var _0x49f4c7=_0x498a1f['options']&&_0x498a1f['options'][_0xe0f3('0x8')]?_0x498a1f[_0xe0f3('0x6')]['where']:{};return db[_0xe0f3('0x13')]['update'](_0x498a1f[_0xe0f3('0x18')],{'where':_0x49f4c7,'transaction':_0x21cfe0})['then'](function(_0x1889b0){logger['info'](_0xe0f3('0x45'),_0x498a1f);logger['debug'](_0xe0f3('0x45'),_0x498a1f,JSON[_0xe0f3('0x1a')](_0x1889b0));_0x52a7e0(_0x1889b0);})['catch'](function(_0x26ed12){logger[_0xe0f3('0x11')](_0xe0f3('0x45'),_0x26ed12[_0xe0f3('0x12')],_0x498a1f);_0x2e4118(_0x57d7b2[_0xe0f3('0x11')](0x1f4,_0x26ed12[_0xe0f3('0x12')]));});});});};exports[_0xe0f3('0x46')]=function(_0xe6d384){var _0x1fef64=this;var _0x5ab5ab=_0xe6d384[_0xe0f3('0x18')][_0xe0f3('0x8')][_0xe0f3('0x47')];var _0x293e72=_0xe6d384['body']['where'][_0xe0f3('0x48')];var _0x3bb65e=_0xe6d384[_0xe0f3('0x18')][_0xe0f3('0x8')][_0xe0f3('0x49')];return new Promise(function(_0xc7314,_0x41d5de){return db[_0xe0f3('0x13')][_0xe0f3('0x38')]({'where':{'voiceQueueId':{'$in':_0x5ab5ab},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe0f3('0x34')]['literal'](_0xe0f3('0x4a')+_0x293e72+_0xe0f3('0x4b')),'$gt':db['sequelize'][_0xe0f3('0x39')](_0xe0f3('0x4c'))}},'UserId':{'$in':_0x3bb65e}},'include':[{'model':db[_0xe0f3('0x21')],'as':_0xe0f3('0x27')},{'model':db[_0xe0f3('0x28')],'as':_0xe0f3('0x29'),'attributes':['id',_0xe0f3('0x2a'),'voicePause']},{'model':db[_0xe0f3('0x4d')],'as':_0xe0f3('0x4e')}]})[_0xe0f3('0xe')](function(_0x3b28d9){if(_0x3b28d9[_0xe0f3('0x2c')]>0x0){return db[_0xe0f3('0x34')]['transaction'](function(_0x2e2a2b){return db[_0xe0f3('0x13')]['update']({'recallmeNotifiedDate':db[_0xe0f3('0x34')][_0xe0f3('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0xe0f3('0xb')](_0x3b28d9,'id')}},'transaction':_0x2e2a2b})[_0xe0f3('0xe')](function(){_0xc7314(_0x3b28d9);})[_0xe0f3('0x10')](function(_0x2e43ff){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x2e43ff[_0xe0f3('0x12')],_0xe6d384);_0x41d5de(_0x1fef64[_0xe0f3('0x11')](0x1f4,_0x2e43ff[_0xe0f3('0x12')]));});})['catch'](function(_0x55daf4){logger[_0xe0f3('0x11')](_0xe0f3('0x46'),_0x55daf4[_0xe0f3('0x12')],_0xe6d384);_0x41d5de(_0x1fef64[_0xe0f3('0x11')](0x1f4,_0x55daf4[_0xe0f3('0x12')]));});}else{_0xc7314(_0x3b28d9);}});});}; \ No newline at end of file +var _0xb6ff=['MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','keys','GetContactByPhone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','\x20MINUTE','NOW()','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','rpc','CmHopper','options','raw','where','limit','include','map','model','attributes','then','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','info','CreateCmHopper','create','UpdateCmHopper','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','UPDATE','Contact','Agent','name','length','UserId','push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId'];(function(_0x58649a,_0x2bea20){var _0x2c6f7f=function(_0x2e60ae){while(--_0x2e60ae){_0x58649a['push'](_0x58649a['shift']());}};_0x2c6f7f(++_0x2bea20);}(_0xb6ff,0x106));var _0xfb6f=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0xb6ff[_0x4c6cf0];return _0x108145;};'use strict';var _=require(_0xfb6f('0x0'));var util=require(_0xfb6f('0x1'));var moment=require(_0xfb6f('0x2'));var BPromise=require(_0xfb6f('0x3'));var db=require(_0xfb6f('0x4'))['db'];var logger=require('../../config/logger')(_0xfb6f('0x5'));exports['GetCmHopper']=function(_0x25323a){var _0xc47cad=this;return new Promise(function(_0x5c1656,_0x2ff61f){return db[_0xfb6f('0x6')]['findAll']({'raw':_0x25323a['options']?_0x25323a[_0xfb6f('0x7')][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'where':_0x25323a['options']?_0x25323a['options'][_0xfb6f('0x9')]||null:null,'attributes':_0x25323a[_0xfb6f('0x7')]?_0x25323a[_0xfb6f('0x7')]['attributes']||null:null,'limit':_0x25323a[_0xfb6f('0x7')]?_0x25323a[_0xfb6f('0x7')][_0xfb6f('0xa')]||null:null,'include':_0x25323a[_0xfb6f('0x7')]?_0x25323a[_0xfb6f('0x7')][_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x25323a[_0xfb6f('0x7')][_0xfb6f('0xb')],function(_0x333948){return{'model':db[_0x333948[_0xfb6f('0xd')]],'as':_0x333948['as'],'attributes':_0x333948[_0xfb6f('0xe')],'include':_0x333948[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x333948[_0xfb6f('0xb')],function(_0x34227a){return{'model':db[_0x34227a[_0xfb6f('0xd')]],'as':_0x34227a['as'],'attributes':_0x34227a[_0xfb6f('0xe')],'include':_0x34227a[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x34227a[_0xfb6f('0xb')],function(_0x438e63){return{'model':db[_0x438e63[_0xfb6f('0xd')]],'as':_0x438e63['as'],'attributes':_0x438e63[_0xfb6f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xfb6f('0xf')](function(_0x5691ba){logger['info'](_0xfb6f('0x10'),_0x25323a);logger[_0xfb6f('0x11')](_0xfb6f('0x10'),_0x25323a,JSON[_0xfb6f('0x12')](_0x5691ba));_0x5c1656(_0x5691ba);})[_0xfb6f('0x13')](function(_0x55b679){logger['error'](_0xfb6f('0x10'),_0x55b679['message'],_0x25323a);_0x2ff61f(_0xc47cad[_0xfb6f('0x14')](0x1f4,_0x55b679[_0xfb6f('0x15')]));});});};exports[_0xfb6f('0x16')]=function(_0x41f816){var _0x4fb931=this;return new Promise(function(_0x1c7831,_0x1bf78a){return db[_0xfb6f('0x6')][_0xfb6f('0x17')]({'raw':_0x41f816['options']?_0x41f816['options'][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'where':_0x41f816[_0xfb6f('0x7')]?_0x41f816[_0xfb6f('0x7')][_0xfb6f('0x9')]||null:null,'attributes':_0x41f816[_0xfb6f('0x7')]?_0x41f816['options'][_0xfb6f('0xe')]||null:null,'include':_0x41f816[_0xfb6f('0x7')]?_0x41f816[_0xfb6f('0x7')][_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x41f816[_0xfb6f('0x7')][_0xfb6f('0xb')],function(_0x205ba8){return{'model':db[_0x205ba8[_0xfb6f('0xd')]],'as':_0x205ba8['as'],'attributes':_0x205ba8[_0xfb6f('0xe')],'include':_0x205ba8[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x205ba8[_0xfb6f('0xb')],function(_0x2c670f){return{'model':db[_0x2c670f['model']],'as':_0x2c670f['as'],'attributes':_0x2c670f[_0xfb6f('0xe')],'include':_0x2c670f[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x2c670f[_0xfb6f('0xb')],function(_0x201121){return{'model':db[_0x201121[_0xfb6f('0xd')]],'as':_0x201121['as'],'attributes':_0x201121['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb6f('0xf')](function(_0xe824fe){logger[_0xfb6f('0x18')](_0xfb6f('0x16'),_0x41f816);logger[_0xfb6f('0x11')](_0xfb6f('0x16'),_0x41f816,JSON[_0xfb6f('0x12')](_0xe824fe));_0x1c7831(_0xe824fe);})[_0xfb6f('0x13')](function(_0x31928e){logger[_0xfb6f('0x14')](_0xfb6f('0x16'),_0x31928e['message'],_0x41f816);_0x1bf78a(_0x4fb931[_0xfb6f('0x14')](0x1f4,_0x31928e[_0xfb6f('0x15')]));});});};exports[_0xfb6f('0x19')]=function(_0x36112a){var _0x484ea9=this;return new Promise(function(_0xff261a,_0x19a535){return db[_0xfb6f('0x6')][_0xfb6f('0x1a')](_0x36112a['body'],{'raw':_0x36112a['options']?_0x36112a[_0xfb6f('0x7')][_0xfb6f('0x8')]===undefined?!![]:![]:!![]})[_0xfb6f('0xf')](function(_0x14bfb2){logger[_0xfb6f('0x18')]('CreateCmHopper',_0x36112a);logger[_0xfb6f('0x11')]('CreateCmHopper',_0x36112a,JSON[_0xfb6f('0x12')](_0x14bfb2));_0xff261a(_0x14bfb2);})['catch'](function(_0x24e259){logger[_0xfb6f('0x14')](_0xfb6f('0x19'),_0x24e259[_0xfb6f('0x15')],_0x36112a);_0x19a535(_0x484ea9[_0xfb6f('0x14')](0x1f4,_0x24e259[_0xfb6f('0x15')]));});});};exports[_0xfb6f('0x1b')]=function(_0x331252){var _0x41382c=this;return new Promise(function(_0x266864,_0x2b5314){return db[_0xfb6f('0x6')]['update'](_0x331252[_0xfb6f('0x1c')],{'raw':_0x331252['options']?_0x331252[_0xfb6f('0x7')][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331252[_0xfb6f('0x7')]?_0x331252[_0xfb6f('0x7')][_0xfb6f('0x9')]||null:null,'attributes':_0x331252[_0xfb6f('0x7')]?_0x331252[_0xfb6f('0x7')][_0xfb6f('0xe')]||null:null,'limit':_0x331252[_0xfb6f('0x7')]?_0x331252[_0xfb6f('0x7')]['limit']||null:null})[_0xfb6f('0xf')](function(_0x528e39){logger[_0xfb6f('0x18')](_0xfb6f('0x1b'),_0x331252);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xfb6f('0x12')](_0x331252['options']['where']),_0x331252[_0xfb6f('0x1c')][_0xfb6f('0x1d')]);logger[_0xfb6f('0x11')](_0xfb6f('0x1b'),_0x331252,JSON[_0xfb6f('0x12')](_0x528e39));_0x266864(_0x528e39);})[_0xfb6f('0x13')](function(_0x49c282){logger[_0xfb6f('0x14')](_0xfb6f('0x1b'),_0x49c282[_0xfb6f('0x15')],_0x331252);_0x2b5314(_0x41382c['error'](0x1f4,_0x49c282[_0xfb6f('0x15')]));});});};exports[_0xfb6f('0x1e')]=function(_0x4b236b){var _0x41156e=this;return new Promise(function(_0x45a340,_0x3bfd37){return db['CmHopper'][_0xfb6f('0x1f')]({'where':_0x4b236b[_0xfb6f('0x7')]?_0x4b236b[_0xfb6f('0x7')]['where']||null:null})[_0xfb6f('0xf')](function(_0x27d651){logger[_0xfb6f('0x18')]('DestroyCmHopper',_0x4b236b);logger[_0xfb6f('0x11')](_0xfb6f('0x1e'),_0x4b236b,JSON['stringify'](_0x27d651));_0x45a340(_0x27d651);})[_0xfb6f('0x13')](function(_0x1fc9ba){logger['error']('DestroyCmHopper',_0x1fc9ba['message'],_0x4b236b);_0x3bfd37(_0x41156e[_0xfb6f('0x14')](0x1f4,_0x1fc9ba[_0xfb6f('0x15')]));});});};exports[_0xfb6f('0x20')]=function(_0x29d190){var _0x446337=this;return new Promise(function(_0x2356cd,_0x15629c){return db[_0xfb6f('0x21')][_0xfb6f('0x22')]()['then'](function(_0x39149e){return db[_0xfb6f('0x23')][_0xfb6f('0x24')](function(_0x4a0b75){return db[_0xfb6f('0x6')][_0xfb6f('0x25')]({'where':_0x29d190['options']?_0x29d190['options'][_0xfb6f('0x9')]||null:null,'attributes':_0x29d190[_0xfb6f('0x7')]?_0x29d190['options'][_0xfb6f('0xe')]||null:null,'limit':_0x29d190['options']?_0x29d190[_0xfb6f('0x7')]['limit']||null:null,'order':_0x29d190['options']?_0x29d190[_0xfb6f('0x7')]['order']||null:null,'transaction':_0x4a0b75,'lock':_0x4a0b75['LOCK'][_0xfb6f('0x26')],'include':[{'model':db[_0xfb6f('0x21')],'as':_0xfb6f('0x27'),'attributes':_['keys'](_0x39149e)},{'model':db['User'],'as':_0xfb6f('0x28'),'attributes':['id',_0xfb6f('0x29'),'voicePause']}]})[_0xfb6f('0xf')](function(_0xe44df0){var _0x13f5b5=[];var _0x2e67f0=[];for(var _0xa82b3d=0x0;_0xa82b3d<_0xe44df0[_0xfb6f('0x2a')];_0xa82b3d+=0x1){var _0x5235c2=_0xe44df0[_0xa82b3d][_0xfb6f('0x2b')];if(_0x5235c2===null){_0x13f5b5['push'](_0xe44df0[_0xa82b3d]['update'](_0x29d190[_0xfb6f('0x1c')],{'transaction':_0x4a0b75}));}else if(!_0x2e67f0['includes'](_0x5235c2)){_0x2e67f0[_0xfb6f('0x2c')](_0x5235c2);_0x13f5b5['push'](_0xe44df0[_0xa82b3d][_0xfb6f('0x2d')](_0x29d190[_0xfb6f('0x1c')],{'transaction':_0x4a0b75}));}}return BPromise[_0xfb6f('0x2e')](_0x13f5b5);});})['then'](function(_0x129818){logger[_0xfb6f('0x18')](_0xfb6f('0x20'),_0x29d190);if(_0x129818['length']>0x0){logger[_0xfb6f('0x18')](_0xfb6f('0x2f'),_0x129818[0x0][_0xfb6f('0x30')]['id'],_0x129818[0x0][_0xfb6f('0x30')][_0xfb6f('0x31')],_0x129818[0x0]['dataValues']['active']);}logger[_0xfb6f('0x11')](_0xfb6f('0x20'),_0x29d190,JSON[_0xfb6f('0x12')](_0x129818));_0x2356cd(_0x129818);})[_0xfb6f('0x13')](function(_0x364501){logger[_0xfb6f('0x14')](_0xfb6f('0x20'),_0x364501['message'],_0x29d190);_0x15629c(_0x446337['error'](0x1f4,_0x364501['message']));});});});};exports['MoveContactManagedDialer']=function(_0x33397f){var _0x10267d=this;return new Promise(function(_0x449854,_0x3cdfc9){return db[_0xfb6f('0x23')][_0xfb6f('0x24')](function(_0x2ee6e5){return db['CmHopperFinal'][_0xfb6f('0x1a')](_0x33397f['body'],{'raw':_0x33397f[_0xfb6f('0x7')]?_0x33397f[_0xfb6f('0x7')][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x2ee6e5})['then'](function(){logger[_0xfb6f('0x18')](_0xfb6f('0x32'),JSON[_0xfb6f('0x12')](_0x33397f['options'][_0xfb6f('0x9')]),_0x33397f['options'][_0xfb6f('0x9')][_0xfb6f('0x1d')]);return db[_0xfb6f('0x6')]['destroy']({'where':_0x33397f['options']?_0x33397f[_0xfb6f('0x7')][_0xfb6f('0x9')]||null:null,'transaction':_0x2ee6e5});});})[_0xfb6f('0xf')](function(_0x66e970){logger[_0xfb6f('0x18')](_0xfb6f('0x33'),_0x33397f);logger[_0xfb6f('0x11')](_0xfb6f('0x33'),_0x33397f,JSON[_0xfb6f('0x12')](_0x66e970));_0x449854(_0x66e970);})[_0xfb6f('0x13')](function(_0x83d6cf){logger['error']('MoveContactManagedDialer',_0x83d6cf['message'],_0x33397f);_0x3cdfc9(_0x10267d['error'](0x1f4,_0x83d6cf['message']));});});};exports[_0xfb6f('0x34')]=function(_0x4d0022){var _0x4aee76=this;return new Promise(function(_0x1655c6,_0x2db652){return db[_0xfb6f('0x6')][_0xfb6f('0x25')]({'raw':_0x4d0022[_0xfb6f('0x7')]?_0x4d0022['options'][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'where':_0x4d0022[_0xfb6f('0x7')]?_0x4d0022['options'][_0xfb6f('0x9')]||null:null,'attributes':[[db[_0xfb6f('0x23')]['fn'](_0xfb6f('0x35'),db['sequelize']['fn']('IF',db[_0xfb6f('0x23')][_0xfb6f('0x36')](_0xfb6f('0x37')+util['format'](_0xfb6f('0x38'),moment()[_0xfb6f('0x39')](_0xfb6f('0x3a')))+_0xfb6f('0x3b')))),_0xfb6f('0x3c')]]})[_0xfb6f('0xf')](function(_0x2fd3db){logger['info'](_0xfb6f('0x34'),_0x4d0022);logger[_0xfb6f('0x11')](_0xfb6f('0x34'),_0x4d0022,JSON[_0xfb6f('0x12')](_0x2fd3db));_0x1655c6(_0x2fd3db);})[_0xfb6f('0x13')](function(_0x40b237){logger['error'](_0xfb6f('0x34'),_0x40b237[_0xfb6f('0x15')],_0x4d0022);_0x2db652(_0x4aee76[_0xfb6f('0x14')](0x1f4,_0x40b237['message']));});});};exports[_0xfb6f('0x3d')]=function(_0x263ad3){var _0xd6663f=this;return new Promise(function(_0x5184ba,_0x3631e2){return db['CmContact'][_0xfb6f('0x22')]()['then'](function(){return db[_0xfb6f('0x23')][_0xfb6f('0x24')](function(_0x44ae6a){return db[_0xfb6f('0x6')][_0xfb6f('0x25')]({'where':_0x263ad3['options']?_0x263ad3[_0xfb6f('0x7')]['where']||null:null,'attributes':_0x263ad3[_0xfb6f('0x7')]?_0x263ad3['options'][_0xfb6f('0xe')]||null:null,'limit':0x1,'order':_0x263ad3[_0xfb6f('0x7')]?_0x263ad3[_0xfb6f('0x7')][_0xfb6f('0x3e')]||null:null,'group':db[_0xfb6f('0x6')][_0xfb6f('0x2b')],'transaction':_0x44ae6a,'lock':_0x44ae6a[_0xfb6f('0x3f')][_0xfb6f('0x26')],'include':_0x263ad3['options']?_0x263ad3[_0xfb6f('0x7')][_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x263ad3['options'][_0xfb6f('0xb')],function(_0x5c77c0){return{'model':db[_0x5c77c0['model']],'as':_0x5c77c0['as'],'attributes':_0x5c77c0[_0xfb6f('0xe')],'include':_0x5c77c0[_0xfb6f('0xb')]?_['map'](_0x5c77c0['include'],function(_0x3575a3){return{'model':db[_0x3575a3[_0xfb6f('0xd')]],'as':_0x3575a3['as'],'attributes':_0x3575a3[_0xfb6f('0xe')],'include':_0x3575a3['include']?_[_0xfb6f('0xc')](_0x3575a3[_0xfb6f('0xb')],function(_0x40ba3b){return{'model':db[_0x40ba3b[_0xfb6f('0xd')]],'as':_0x40ba3b['as'],'attributes':_0x40ba3b[_0xfb6f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xfb6f('0xf')](function(_0x43bf09){var _0x206c35=[];for(var _0x10dd4c=0x0;_0x10dd4c<_0x43bf09[_0xfb6f('0x2a')];_0x10dd4c+=0x1){_0x206c35['push'](_0x43bf09[_0x10dd4c][_0xfb6f('0x2d')](_0x263ad3['body'],{'transaction':_0x44ae6a}));}return BPromise['all'](_0x206c35);});})[_0xfb6f('0xf')](function(_0x37ab44){logger['info'](_0xfb6f('0x3d'),_0x263ad3);logger[_0xfb6f('0x11')](_0xfb6f('0x3d'),_0x263ad3,JSON['stringify'](_0x37ab44));_0x5184ba(_0x37ab44);})[_0xfb6f('0x13')](function(_0x305f0a){logger[_0xfb6f('0x14')]('GetContactRecallMe',_0x305f0a[_0xfb6f('0x15')],_0x263ad3);_0x3631e2(_0xd6663f[_0xfb6f('0x14')](0x1f4,_0x305f0a['message']));});});});};exports[_0xfb6f('0x40')]=function(_0x52a0d9){var _0x1c2a1c=this;return new Promise(function(_0x12292b,_0x1c5f99){db['CmContact'][_0xfb6f('0x22')]()[_0xfb6f('0xf')](function(_0x532d3d){return db[_0xfb6f('0x6')]['findAll']({'raw':_0x52a0d9['options']?_0x52a0d9[_0xfb6f('0x7')][_0xfb6f('0x8')]===undefined?!![]:![]:!![],'where':_0x52a0d9[_0xfb6f('0x7')]?_0x52a0d9[_0xfb6f('0x7')][_0xfb6f('0x9')]||null:null,'attributes':_0x52a0d9[_0xfb6f('0x7')]?_0x52a0d9[_0xfb6f('0x7')][_0xfb6f('0xe')]||null:null,'limit':_0x52a0d9['options']?_0x52a0d9[_0xfb6f('0x7')][_0xfb6f('0xa')]||null:null,'include':_0x52a0d9[_0xfb6f('0x7')]?_0x52a0d9[_0xfb6f('0x7')]['include']?_['map'](_0x52a0d9[_0xfb6f('0x7')]['include'],function(_0x46f62c){return{'model':db[_0x46f62c[_0xfb6f('0xd')]],'as':_0x46f62c['as'],'attributes':_0x46f62c['as']===_0xfb6f('0x27')?_[_0xfb6f('0x41')](_0x532d3d):_0x46f62c['attributes'],'include':_0x46f62c[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x46f62c[_0xfb6f('0xb')],function(_0x3fe22c){return{'model':db[_0x3fe22c[_0xfb6f('0xd')]],'as':_0x3fe22c['as'],'attributes':_0x3fe22c['attributes'],'include':_0x3fe22c[_0xfb6f('0xb')]?_[_0xfb6f('0xc')](_0x3fe22c[_0xfb6f('0xb')],function(_0x17921e){return{'model':db[_0x17921e[_0xfb6f('0xd')]],'as':_0x17921e['as'],'attributes':_0x17921e[_0xfb6f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xfb6f('0xf')](function(_0x304665){logger[_0xfb6f('0x18')](_0xfb6f('0x10'),_0x52a0d9);logger['debug'](_0xfb6f('0x10'),_0x52a0d9,JSON['stringify'](_0x304665));_0x12292b(_0x304665);})[_0xfb6f('0x13')](function(_0x70a9d3){logger[_0xfb6f('0x14')](_0xfb6f('0x10'),_0x70a9d3['message'],_0x52a0d9);_0x1c5f99(_0x1c2a1c[_0xfb6f('0x14')](0x1f4,_0x70a9d3[_0xfb6f('0x15')]));});});});};exports[_0xfb6f('0x42')]=function(_0x584999){var _0xbd8c13=this;return new Promise(function(_0xd17f73,_0x1b291e){return db[_0xfb6f('0x21')]['findOne']({'raw':!![],'where':{'phone':_0x584999[_0xfb6f('0x7')]['where']['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0xfb6f('0x43')]]})[_0xfb6f('0xf')](function(_0x1ed401){logger['info'](_0xfb6f('0x44'),_0x584999);logger[_0xfb6f('0x11')](_0xfb6f('0x44'),_0x584999,JSON[_0xfb6f('0x12')](_0x1ed401));_0xd17f73(_0x1ed401);})[_0xfb6f('0x13')](function(_0x11ef23){logger['error'](_0xfb6f('0x44'),_0x11ef23[_0xfb6f('0x15')],_0x584999);_0x1b291e(_0xbd8c13['error'](0x1f4,_0x11ef23['message']));});});};exports[_0xfb6f('0x45')]=function(_0x5b5130){var _0x4c7530=this;return new Promise(function(_0x4981ec,_0x7243bc){return db[_0xfb6f('0x23')][_0xfb6f('0x24')](function(_0x1d6fe3){var _0x2ad802=_0x5b5130[_0xfb6f('0x7')]&&_0x5b5130['options'][_0xfb6f('0x9')]?_0x5b5130[_0xfb6f('0x7')][_0xfb6f('0x9')]:{};return db[_0xfb6f('0x6')][_0xfb6f('0x2d')](_0x5b5130[_0xfb6f('0x1c')],{'where':_0x2ad802,'transaction':_0x1d6fe3})[_0xfb6f('0xf')](function(_0x42198d){logger[_0xfb6f('0x18')](_0xfb6f('0x45'),_0x5b5130);logger[_0xfb6f('0x11')](_0xfb6f('0x45'),_0x5b5130,JSON[_0xfb6f('0x12')](_0x42198d));_0x4981ec(_0x42198d);})[_0xfb6f('0x13')](function(_0x53ffaa){logger[_0xfb6f('0x14')](_0xfb6f('0x45'),_0x53ffaa['message'],_0x5b5130);_0x7243bc(_0x4c7530[_0xfb6f('0x14')](0x1f4,_0x53ffaa[_0xfb6f('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x56a487){var _0x46f030=this;var _0x32edad=_0x56a487[_0xfb6f('0x1c')]['where']['voiceQueueIds'];var _0x53305a=_0x56a487[_0xfb6f('0x1c')]['where'][_0xfb6f('0x46')];var _0x45dd10=_0x56a487['body'][_0xfb6f('0x9')][_0xfb6f('0x47')];return new Promise(function(_0x198c4a,_0x595995){return db[_0xfb6f('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x32edad},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfb6f('0x23')][_0xfb6f('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x53305a+_0xfb6f('0x48')),'$gt':db[_0xfb6f('0x23')]['literal'](_0xfb6f('0x49'))}},'UserId':{'$in':_0x45dd10}},'include':[{'model':db[_0xfb6f('0x21')],'as':_0xfb6f('0x27')},{'model':db['User'],'as':'Agent','attributes':['id',_0xfb6f('0x29'),_0xfb6f('0x4a')]},{'model':db[_0xfb6f('0x4b')],'as':_0xfb6f('0x4c')}]})[_0xfb6f('0xf')](function(_0x1d9863){if(_0x1d9863[_0xfb6f('0x2a')]>0x0){return db[_0xfb6f('0x23')]['transaction'](function(_0x416a64){return db[_0xfb6f('0x6')][_0xfb6f('0x2d')]({'recallmeNotifiedDate':db[_0xfb6f('0x23')][_0xfb6f('0x36')](_0xfb6f('0x49'))},{'where':{'id':{'$in':_[_0xfb6f('0xc')](_0x1d9863,'id')}},'transaction':_0x416a64})[_0xfb6f('0xf')](function(){_0x198c4a(_0x1d9863);})[_0xfb6f('0x13')](function(_0x2cd139){logger['error'](_0xfb6f('0x4d'),_0x2cd139[_0xfb6f('0x15')],_0x56a487);_0x595995(_0x46f030[_0xfb6f('0x14')](0x1f4,_0x2cd139['message']));});})[_0xfb6f('0x13')](function(_0x32e354){logger['error'](_0xfb6f('0x4d'),_0x32e354[_0xfb6f('0x15')],_0x56a487);_0x595995(_0x46f030[_0xfb6f('0x14')](0x1f4,_0x32e354['message']));});}else{_0x198c4a(_0x1d9863);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1f07488..96431f9 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 _0x7b0b=['get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id','getPreviewRecall','post','getPreview','/timezone','update','delete','express','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x2c1456,_0x2506c6){var _0x3bf6b8=function(_0x31087b){while(--_0x31087b){_0x2c1456['push'](_0x2c1456['shift']());}};_0x3bf6b8(++_0x2506c6);}(_0x7b0b,0x94));var _0xb7b0=function(_0x542579,_0x36de29){_0x542579=_0x542579-0x0;var _0x15e5ee=_0x7b0b[_0x542579];return _0x15e5ee;};'use strict';var express=require(_0xb7b0('0x0'));var router=express[_0xb7b0('0x1')]();var auth=require(_0xb7b0('0x2'));var controller=require(_0xb7b0('0x3'));router[_0xb7b0('0x4')]('/',auth[_0xb7b0('0x5')](),controller[_0xb7b0('0x6')]);router[_0xb7b0('0x4')](_0xb7b0('0x7'),auth[_0xb7b0('0x5')](),controller[_0xb7b0('0x8')]);router['get'](_0xb7b0('0x9'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xb7b0('0x4')](_0xb7b0('0xa'),auth[_0xb7b0('0x5')](),controller[_0xb7b0('0xb')]);router[_0xb7b0('0x4')](_0xb7b0('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/previewrecall',auth[_0xb7b0('0x5')](),controller[_0xb7b0('0xd')]);router[_0xb7b0('0xe')]('/',auth[_0xb7b0('0x5')](),controller['create']);router['post']('/preview',auth['isAuthenticated'](),controller[_0xb7b0('0xf')]);router[_0xb7b0('0xe')](_0xb7b0('0x10'),auth[_0xb7b0('0x5')](),controller['getTimezone']);router['put'](_0xb7b0('0xc'),auth[_0xb7b0('0x5')](),controller[_0xb7b0('0x11')]);router[_0xb7b0('0x12')](_0xb7b0('0xc'),auth[_0xb7b0('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f84=['create','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/opencontacts','getOpenContacts','/timezones','getTimezones','show'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x4f84,0xfc));var _0x44f8=function(_0x187e24,_0x393e15){_0x187e24=_0x187e24-0x0;var _0x39b658=_0x4f84[_0x187e24];return _0x39b658;};'use strict';var express=require(_0x44f8('0x0'));var router=express[_0x44f8('0x1')]();var auth=require(_0x44f8('0x2'));var controller=require(_0x44f8('0x3'));router['get']('/',auth[_0x44f8('0x4')](),controller[_0x44f8('0x5')]);router[_0x44f8('0x6')]('/describe',auth[_0x44f8('0x4')](),controller['describe']);router[_0x44f8('0x6')](_0x44f8('0x7'),auth[_0x44f8('0x4')](),controller[_0x44f8('0x8')]);router[_0x44f8('0x6')](_0x44f8('0x9'),auth['isAuthenticated'](),controller[_0x44f8('0xa')]);router[_0x44f8('0x6')]('/:id',auth[_0x44f8('0x4')](),controller[_0x44f8('0xb')]);router[_0x44f8('0x6')]('/:id/previewrecall',auth[_0x44f8('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0x44f8('0x4')](),controller[_0x44f8('0xc')]);router[_0x44f8('0xd')](_0x44f8('0xe'),auth[_0x44f8('0x4')](),controller[_0x44f8('0xf')]);router[_0x44f8('0xd')](_0x44f8('0x10'),auth[_0x44f8('0x4')](),controller[_0x44f8('0x11')]);router[_0x44f8('0x12')](_0x44f8('0x13'),auth[_0x44f8('0x4')](),controller[_0x44f8('0x14')]);router[_0x44f8('0x15')](_0x44f8('0x13'),auth[_0x44f8('0x4')](),controller[_0x44f8('0x16')]);module[_0x44f8('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 63c0297..0352a8b 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 _0x0c06=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x0c06,0xe5));var _0x60c0=function(_0x1c77ca,_0x4b5694){_0x1c77ca=_0x1c77ca-0x0;var _0x2a32a0=_0x0c06[_0x1c77ca];return _0x2a32a0;};'use strict';var moment=require(_0x60c0('0x0'));var Sequelize=require(_0x60c0('0x1'));module[_0x60c0('0x2')]={'CmHopperId':{'type':Sequelize[_0x60c0('0x3')]},'phone':{'type':Sequelize[_0x60c0('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x60c0('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x60c0('0x5')],'defaultValue':moment()[_0x60c0('0x6')](_0x60c0('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x60c0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x60c0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x60c0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x60c0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x858c=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x1ac20d,_0x14914b){var _0x599e6a=function(_0x578160){while(--_0x578160){_0x1ac20d['push'](_0x1ac20d['shift']());}};_0x599e6a(++_0x14914b);}(_0x858c,0x1f0));var _0xc858=function(_0x2e77e6,_0x34e20e){_0x2e77e6=_0x2e77e6-0x0;var _0x523388=_0x858c[_0x2e77e6];return _0x523388;};'use strict';var moment=require('moment');var Sequelize=require(_0xc858('0x0'));module[_0xc858('0x1')]={'CmHopperId':{'type':Sequelize[_0xc858('0x2')]},'phone':{'type':Sequelize[_0xc858('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc858('0x4')],'defaultValue':moment()[_0xc858('0x5')](_0xc858('0x6'))},'countbusyretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc858('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 10c0d57..cc5f812 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 _0xdfff=['model','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xdfff,0x171));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdff('0x0'));var zipdir=require(_0xfdff('0x1'));var jsonpatch=require(_0xfdff('0x2'));var rp=require('request-promise');var moment=require(_0xfdff('0x3'));var BPromise=require(_0xfdff('0x4'));var Mustache=require('mustache');var util=require(_0xfdff('0x5'));var path=require(_0xfdff('0x6'));var sox=require(_0xfdff('0x7'));var csv=require(_0xfdff('0x8'));var ejs=require(_0xfdff('0x9'));var fs=require('fs');var fs_extra=require(_0xfdff('0xa'));var _=require(_0xfdff('0xb'));var squel=require(_0xfdff('0xc'));var crypto=require(_0xfdff('0xd'));var jsforce=require(_0xfdff('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfdff('0xf'));var Papa=require(_0xfdff('0x10'));var Redis=require(_0xfdff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdff('0x12'));var as=require(_0xfdff('0x13'));var hardwareService=require(_0xfdff('0x14'));var logger=require(_0xfdff('0x15'))(_0xfdff('0x16'));var utils=require(_0xfdff('0x17'));var config=require(_0xfdff('0x18'));var licenseUtil=require(_0xfdff('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265138,_0x1f9ffb){_0x1f9ffb=_0x1f9ffb||0xcc;return function(_0x28228a){if(_0x28228a){return _0x265138[_0xfdff('0x1a')](_0x1f9ffb);}return _0x265138[_0xfdff('0x1b')](_0x1f9ffb)[_0xfdff('0x1c')]();};}function respondWithResult(_0x4671df,_0xfa6065){_0xfa6065=_0xfa6065||0xc8;return function(_0x50e32d){if(_0x50e32d){return _0x4671df[_0xfdff('0x1b')](_0xfa6065)[_0xfdff('0x1d')](_0x50e32d);}};}function respondWithFilteredResult(_0x270606,_0x544d02){return function(_0x297445){if(_0x297445){var _0x3d94fb=typeof _0x544d02[_0xfdff('0x1e')]===_0xfdff('0x1f')&&typeof _0x544d02[_0xfdff('0x20')]===_0xfdff('0x1f');var _0x5f152e=_0x297445['count'];var _0x56c01b=_0x3d94fb?0x0:_0x544d02[_0xfdff('0x1e')];var _0x42dce8=_0x3d94fb?_0x297445[_0xfdff('0x21')]:_0x544d02[_0xfdff('0x1e')]+_0x544d02[_0xfdff('0x20')];var _0x7418fa;if(_0x42dce8>=_0x5f152e){_0x42dce8=_0x5f152e;_0x7418fa=0xc8;}else{_0x7418fa=0xce;}_0x270606[_0xfdff('0x1b')](_0x7418fa);return _0x270606[_0xfdff('0x22')]('Content-Range',_0x56c01b+'-'+_0x42dce8+'/'+_0x5f152e)[_0xfdff('0x1d')](_0x297445);}return null;};}function patchUpdates(_0xaf4acd){return function(_0x4792d2){try{jsonpatch[_0xfdff('0x23')](_0x4792d2,_0xaf4acd,!![]);}catch(_0x30e0c0){return BPromise[_0xfdff('0x24')](_0x30e0c0);}return _0x4792d2[_0xfdff('0x25')]();};}function saveUpdates(_0x555f5d,_0x4c5c62){return function(_0x54d5d0){if(_0x54d5d0){return _0x54d5d0[_0xfdff('0x26')](_0x555f5d)[_0xfdff('0x27')](function(_0x3a57eb){return _0x3a57eb;});}return null;};}function removeEntity(_0x57f27d,_0x1670c2){return function(_0x1fe65b){if(_0x1fe65b){return _0x1fe65b[_0xfdff('0x28')]()[_0xfdff('0x27')](function(){var _0x1d3656=_0x1fe65b[_0xfdff('0x29')]({'plain':!![]});var _0x1d23bf='CmHopperAdditionalPhones';return db[_0xfdff('0x2a')][_0xfdff('0x28')]({'where':{'type':_0x1d23bf,'resourceId':_0x1d3656['id']}})['then'](function(){return _0x1fe65b;});})[_0xfdff('0x27')](function(){_0x57f27d[_0xfdff('0x1b')](0xcc)[_0xfdff('0x1c')]();});}};}function handleEntityNotFound(_0x41bae0,_0x1afb66){return function(_0x4f58e7){if(!_0x4f58e7){_0x41bae0['sendStatus'](0x194);}return _0x4f58e7;};}function handleError(_0x1385ec,_0xb89f4f){_0xb89f4f=_0xb89f4f||0x1f4;return function(_0x2bbc9b){logger[_0xfdff('0x2b')](_0x2bbc9b[_0xfdff('0x2c')]);if(_0x2bbc9b['name']){delete _0x2bbc9b[_0xfdff('0x2d')];}_0x1385ec[_0xfdff('0x1b')](_0xb89f4f)[_0xfdff('0x2e')](_0x2bbc9b);};}exports['index']=function(_0x36758e,_0x8a839){var _0x6e084f={},_0x48034b={},_0x4ed074={'count':0x0,'rows':[]};var _0x3bd6e4=_[_0xfdff('0x2f')](db[_0xfdff('0x30')][_0xfdff('0x31')],function(_0xb142a6){return{'name':_0xb142a6[_0xfdff('0x32')],'type':_0xb142a6['type'][_0xfdff('0x33')]};});_0x48034b['model']=_[_0xfdff('0x2f')](_0x3bd6e4,_0xfdff('0x2d'));_0x48034b[_0xfdff('0x34')]=_[_0xfdff('0x35')](_0x36758e[_0xfdff('0x34')]);_0x48034b[_0xfdff('0x36')]=_[_0xfdff('0x37')](_0x48034b['model'],_0x48034b[_0xfdff('0x34')]);_0x6e084f['attributes']=_[_0xfdff('0x37')](_0x48034b[_0xfdff('0x38')],qs['fields'](_0x36758e['query'][_0xfdff('0x39')]));_0x6e084f['attributes']=_0x6e084f[_0xfdff('0x3a')]['length']?_0x6e084f[_0xfdff('0x3a')]:_0x48034b[_0xfdff('0x38')];if(!_0x36758e['query'][_0xfdff('0x3b')]('nolimit')){_0x6e084f['limit']=qs['limit'](_0x36758e[_0xfdff('0x34')]['limit']);_0x6e084f[_0xfdff('0x1e')]=qs['offset'](_0x36758e['query'][_0xfdff('0x1e')]);}_0x6e084f['order']=qs[_0xfdff('0x3c')](_0x36758e[_0xfdff('0x34')][_0xfdff('0x3c')]);_0x6e084f[_0xfdff('0x3d')]=qs[_0xfdff('0x36')](_['pick'](_0x36758e[_0xfdff('0x34')],_0x48034b[_0xfdff('0x36')]),_0x3bd6e4);if(_0x36758e[_0xfdff('0x34')][_0xfdff('0x3e')]){_0x6e084f[_0xfdff('0x3d')]=_[_0xfdff('0x3f')](_0x6e084f['where'],{'$or':_[_0xfdff('0x2f')](_0x3bd6e4,function(_0x5774a3){if(_0x5774a3['type']!==_0xfdff('0x40')){var _0x9cc3db={};_0x9cc3db[_0x5774a3[_0xfdff('0x2d')]]={'$like':'%'+_0x36758e[_0xfdff('0x34')]['filter']+'%'};return _0x9cc3db;}})});}_0x6e084f=_[_0xfdff('0x3f')]({},_0x6e084f,_0x36758e['options']);var _0x21494e={'where':_0x6e084f[_0xfdff('0x3d')]};return db['CmHopperAdditionalPhone'][_0xfdff('0x21')](_0x21494e)['then'](function(_0x1fef8b){_0x4ed074[_0xfdff('0x21')]=_0x1fef8b;if(_0x36758e[_0xfdff('0x34')][_0xfdff('0x41')]){_0x6e084f[_0xfdff('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xfdff('0x43')](_0x6e084f);})[_0xfdff('0x27')](function(_0x428965){_0x4ed074[_0xfdff('0x44')]=_0x428965;return _0x4ed074;})[_0xfdff('0x27')](respondWithFilteredResult(_0x8a839,_0x6e084f))[_0xfdff('0x45')](handleError(_0x8a839,null));};exports[_0xfdff('0x46')]=function(_0x193972,_0x3362a3){var _0x30d01a={'raw':!![],'where':{'id':_0x193972[_0xfdff('0x47')]['id']}},_0x5b6498={};_0x5b6498['model']=_['keys'](db[_0xfdff('0x30')]['rawAttributes']);_0x5b6498['query']=_[_0xfdff('0x35')](_0x193972['query']);_0x5b6498[_0xfdff('0x36')]=_['intersection'](_0x5b6498[_0xfdff('0x38')],_0x5b6498[_0xfdff('0x34')]);_0x30d01a[_0xfdff('0x3a')]=_['intersection'](_0x5b6498[_0xfdff('0x38')],qs['fields'](_0x193972[_0xfdff('0x34')][_0xfdff('0x39')]));_0x30d01a['attributes']=_0x30d01a['attributes'][_0xfdff('0x48')]?_0x30d01a['attributes']:_0x5b6498['model'];if(_0x193972[_0xfdff('0x34')][_0xfdff('0x41')]){_0x30d01a[_0xfdff('0x42')]=[{'all':!![]}];}_0x30d01a=_[_0xfdff('0x3f')]({},_0x30d01a,_0x193972[_0xfdff('0x49')]);return db[_0xfdff('0x30')]['find'](_0x30d01a)[_0xfdff('0x27')](handleEntityNotFound(_0x3362a3,null))[_0xfdff('0x27')](respondWithResult(_0x3362a3,null))[_0xfdff('0x45')](handleError(_0x3362a3,null));};exports[_0xfdff('0x4a')]=function(_0x55a1e9,_0x33b438){return db[_0xfdff('0x30')][_0xfdff('0x4a')](_0x55a1e9[_0xfdff('0x4b')],{})['then'](function(_0x1cc587){var _0x3ecdd9=_0x55a1e9[_0xfdff('0x4c')]['get']({'plain':!![]});if(!_0x3ecdd9)throw new Error(_0xfdff('0x4d'));if(_0x3ecdd9[_0xfdff('0x4e')]===_0xfdff('0x4c')){var _0x9eff6e=_0x1cc587[_0xfdff('0x29')]({'plain':!![]});var _0x4c5720=_0xfdff('0x4f');return db[_0xfdff('0x50')][_0xfdff('0x51')]({'where':{'name':_0x4c5720,'userProfileId':_0x3ecdd9[_0xfdff('0x52')]},'raw':!![]})['then'](function(_0x2981f9){if(_0x2981f9&&_0x2981f9[_0xfdff('0x53')]===0x0){return db[_0xfdff('0x2a')][_0xfdff('0x4a')]({'name':_0x9eff6e[_0xfdff('0x2d')],'resourceId':_0x9eff6e['id'],'type':_0x2981f9[_0xfdff('0x2d')],'sectionId':_0x2981f9['id']},{})[_0xfdff('0x27')](function(){return _0x1cc587;});}else{return _0x1cc587;}})[_0xfdff('0x45')](function(_0x3e336f){logger[_0xfdff('0x2b')](_0xfdff('0x54'),_0x3e336f);throw _0x3e336f;});}return _0x1cc587;})[_0xfdff('0x27')](respondWithResult(_0x33b438,0xc9))[_0xfdff('0x45')](handleError(_0x33b438,null));};exports[_0xfdff('0x26')]=function(_0x486f08,_0x55fae7){if(_0x486f08['body']['id']){delete _0x486f08['body']['id'];}return db[_0xfdff('0x30')][_0xfdff('0x51')]({'where':{'id':_0x486f08[_0xfdff('0x47')]['id']}})[_0xfdff('0x27')](handleEntityNotFound(_0x55fae7,null))[_0xfdff('0x27')](saveUpdates(_0x486f08[_0xfdff('0x4b')],null))['then'](respondWithResult(_0x55fae7,null))[_0xfdff('0x45')](handleError(_0x55fae7,null));};exports[_0xfdff('0x28')]=function(_0x4211c6,_0x5f48d9){return db[_0xfdff('0x30')]['find']({'where':{'id':_0x4211c6[_0xfdff('0x47')]['id']}})[_0xfdff('0x27')](handleEntityNotFound(_0x5f48d9,null))[_0xfdff('0x27')](removeEntity(_0x5f48d9,null))[_0xfdff('0x45')](handleError(_0x5f48d9,null));}; \ No newline at end of file +var _0xc2fb=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','CmHopperAdditionalPhones','UserProfileResource','status','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','count','findAll','catch','show','params','includeAll','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0xeecc03,_0x3f216d){var _0x325d0a=function(_0x2e7b19){while(--_0x2e7b19){_0xeecc03['push'](_0xeecc03['shift']());}};_0x325d0a(++_0x3f216d);}(_0xc2fb,0x131));var _0xbc2f=function(_0x54a332,_0x1a079d){_0x54a332=_0x54a332-0x0;var _0x400a5f=_0xc2fb[_0x54a332];return _0x400a5f;};'use strict';var emlformat=require(_0xbc2f('0x0'));var rimraf=require(_0xbc2f('0x1'));var zipdir=require(_0xbc2f('0x2'));var jsonpatch=require(_0xbc2f('0x3'));var rp=require('request-promise');var moment=require(_0xbc2f('0x4'));var BPromise=require(_0xbc2f('0x5'));var Mustache=require(_0xbc2f('0x6'));var util=require('util');var path=require(_0xbc2f('0x7'));var sox=require(_0xbc2f('0x8'));var csv=require(_0xbc2f('0x9'));var ejs=require(_0xbc2f('0xa'));var fs=require('fs');var fs_extra=require(_0xbc2f('0xb'));var _=require(_0xbc2f('0xc'));var squel=require('squel');var crypto=require(_0xbc2f('0xd'));var jsforce=require(_0xbc2f('0xe'));var deskjs=require(_0xbc2f('0xf'));var toCsv=require(_0xbc2f('0x9'));var querystring=require('querystring');var Papa=require(_0xbc2f('0x10'));var Redis=require(_0xbc2f('0x11'));var authService=require(_0xbc2f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc2f('0x13'));var logger=require(_0xbc2f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbc2f('0x15'));var licenseUtil=require(_0xbc2f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbfe673,_0x5fd1c9){_0x5fd1c9=_0x5fd1c9||0xcc;return function(_0x542201){if(_0x542201){return _0xbfe673['sendStatus'](_0x5fd1c9);}return _0xbfe673['status'](_0x5fd1c9)[_0xbc2f('0x17')]();};}function respondWithResult(_0x4faf99,_0x1c98fe){_0x1c98fe=_0x1c98fe||0xc8;return function(_0x3828f8){if(_0x3828f8){return _0x4faf99['status'](_0x1c98fe)[_0xbc2f('0x18')](_0x3828f8);}};}function respondWithFilteredResult(_0x2f1402,_0xaf42bb){return function(_0x1b2a89){if(_0x1b2a89){var _0x598cba=typeof _0xaf42bb[_0xbc2f('0x19')]===_0xbc2f('0x1a')&&typeof _0xaf42bb[_0xbc2f('0x1b')]==='undefined';var _0x958b7f=_0x1b2a89['count'];var _0x23dcb4=_0x598cba?0x0:_0xaf42bb[_0xbc2f('0x19')];var _0x54034f=_0x598cba?_0x1b2a89['count']:_0xaf42bb[_0xbc2f('0x19')]+_0xaf42bb[_0xbc2f('0x1b')];var _0x3af6b1;if(_0x54034f>=_0x958b7f){_0x54034f=_0x958b7f;_0x3af6b1=0xc8;}else{_0x3af6b1=0xce;}_0x2f1402['status'](_0x3af6b1);return _0x2f1402[_0xbc2f('0x1c')](_0xbc2f('0x1d'),_0x23dcb4+'-'+_0x54034f+'/'+_0x958b7f)[_0xbc2f('0x18')](_0x1b2a89);}return null;};}function patchUpdates(_0x2d1f98){return function(_0x3facf8){try{jsonpatch[_0xbc2f('0x1e')](_0x3facf8,_0x2d1f98,!![]);}catch(_0x37e721){return BPromise[_0xbc2f('0x1f')](_0x37e721);}return _0x3facf8[_0xbc2f('0x20')]();};}function saveUpdates(_0x2aeaaa,_0x29b7fe){return function(_0x1e1c19){if(_0x1e1c19){return _0x1e1c19[_0xbc2f('0x21')](_0x2aeaaa)[_0xbc2f('0x22')](function(_0x3ce31f){return _0x3ce31f;});}return null;};}function removeEntity(_0x3723a5,_0x51b029){return function(_0xf1b7d4){if(_0xf1b7d4){return _0xf1b7d4['destroy']()[_0xbc2f('0x22')](function(){var _0x5b0ece=_0xf1b7d4['get']({'plain':!![]});var _0x36bd19=_0xbc2f('0x23');return db[_0xbc2f('0x24')]['destroy']({'where':{'type':_0x36bd19,'resourceId':_0x5b0ece['id']}})['then'](function(){return _0xf1b7d4;});})[_0xbc2f('0x22')](function(){_0x3723a5[_0xbc2f('0x25')](0xcc)[_0xbc2f('0x17')]();});}};}function handleEntityNotFound(_0x2ebba8,_0x499cfb){return function(_0x4a9561){if(!_0x4a9561){_0x2ebba8['sendStatus'](0x194);}return _0x4a9561;};}function handleError(_0x12d067,_0x4f1ab9){_0x4f1ab9=_0x4f1ab9||0x1f4;return function(_0x1bd47c){logger[_0xbc2f('0x26')](_0x1bd47c[_0xbc2f('0x27')]);if(_0x1bd47c[_0xbc2f('0x28')]){delete _0x1bd47c[_0xbc2f('0x28')];}_0x12d067[_0xbc2f('0x25')](_0x4f1ab9)[_0xbc2f('0x29')](_0x1bd47c);};}exports[_0xbc2f('0x2a')]=function(_0x4f5663,_0x3ba350){var _0x49ff8b={},_0x321939={},_0x34ebd6={'count':0x0,'rows':[]};var _0x2834fa=_[_0xbc2f('0x2b')](db[_0xbc2f('0x2c')][_0xbc2f('0x2d')],function(_0x1a00bf){return{'name':_0x1a00bf[_0xbc2f('0x2e')],'type':_0x1a00bf[_0xbc2f('0x2f')]['key']};});_0x321939['model']=_[_0xbc2f('0x2b')](_0x2834fa,_0xbc2f('0x28'));_0x321939[_0xbc2f('0x30')]=_[_0xbc2f('0x31')](_0x4f5663[_0xbc2f('0x30')]);_0x321939[_0xbc2f('0x32')]=_[_0xbc2f('0x33')](_0x321939[_0xbc2f('0x34')],_0x321939[_0xbc2f('0x30')]);_0x49ff8b['attributes']=_[_0xbc2f('0x33')](_0x321939['model'],qs[_0xbc2f('0x35')](_0x4f5663[_0xbc2f('0x30')][_0xbc2f('0x35')]));_0x49ff8b['attributes']=_0x49ff8b[_0xbc2f('0x36')]['length']?_0x49ff8b[_0xbc2f('0x36')]:_0x321939['model'];if(!_0x4f5663[_0xbc2f('0x30')][_0xbc2f('0x37')]('nolimit')){_0x49ff8b['limit']=qs['limit'](_0x4f5663['query'][_0xbc2f('0x1b')]);_0x49ff8b[_0xbc2f('0x19')]=qs[_0xbc2f('0x19')](_0x4f5663[_0xbc2f('0x30')][_0xbc2f('0x19')]);}_0x49ff8b['order']=qs[_0xbc2f('0x38')](_0x4f5663[_0xbc2f('0x30')][_0xbc2f('0x38')]);_0x49ff8b[_0xbc2f('0x39')]=qs[_0xbc2f('0x32')](_['pick'](_0x4f5663[_0xbc2f('0x30')],_0x321939[_0xbc2f('0x32')]),_0x2834fa);if(_0x4f5663[_0xbc2f('0x30')]['filter']){_0x49ff8b[_0xbc2f('0x39')]=_['merge'](_0x49ff8b['where'],{'$or':_[_0xbc2f('0x2b')](_0x2834fa,function(_0x1b0339){if(_0x1b0339[_0xbc2f('0x2f')]!==_0xbc2f('0x3a')){var _0x26ae3f={};_0x26ae3f[_0x1b0339[_0xbc2f('0x28')]]={'$like':'%'+_0x4f5663[_0xbc2f('0x30')][_0xbc2f('0x3b')]+'%'};return _0x26ae3f;}})});}_0x49ff8b=_[_0xbc2f('0x3c')]({},_0x49ff8b,_0x4f5663[_0xbc2f('0x3d')]);var _0x33f842={'where':_0x49ff8b[_0xbc2f('0x39')]};return db[_0xbc2f('0x2c')]['count'](_0x33f842)[_0xbc2f('0x22')](function(_0x15fe2f){_0x34ebd6[_0xbc2f('0x3e')]=_0x15fe2f;if(_0x4f5663[_0xbc2f('0x30')]['includeAll']){_0x49ff8b['include']=[{'all':!![]}];}return db[_0xbc2f('0x2c')][_0xbc2f('0x3f')](_0x49ff8b);})[_0xbc2f('0x22')](function(_0x4ab1aa){_0x34ebd6['rows']=_0x4ab1aa;return _0x34ebd6;})[_0xbc2f('0x22')](respondWithFilteredResult(_0x3ba350,_0x49ff8b))[_0xbc2f('0x40')](handleError(_0x3ba350,null));};exports[_0xbc2f('0x41')]=function(_0x18ac9c,_0x47e96f){var _0x7569c5={'raw':!![],'where':{'id':_0x18ac9c[_0xbc2f('0x42')]['id']}},_0xa56a88={};_0xa56a88['model']=_[_0xbc2f('0x31')](db['CmHopperAdditionalPhone']['rawAttributes']);_0xa56a88[_0xbc2f('0x30')]=_[_0xbc2f('0x31')](_0x18ac9c[_0xbc2f('0x30')]);_0xa56a88[_0xbc2f('0x32')]=_[_0xbc2f('0x33')](_0xa56a88[_0xbc2f('0x34')],_0xa56a88['query']);_0x7569c5[_0xbc2f('0x36')]=_['intersection'](_0xa56a88['model'],qs['fields'](_0x18ac9c[_0xbc2f('0x30')]['fields']));_0x7569c5[_0xbc2f('0x36')]=_0x7569c5['attributes']['length']?_0x7569c5['attributes']:_0xa56a88['model'];if(_0x18ac9c[_0xbc2f('0x30')][_0xbc2f('0x43')]){_0x7569c5[_0xbc2f('0x44')]=[{'all':!![]}];}_0x7569c5=_[_0xbc2f('0x3c')]({},_0x7569c5,_0x18ac9c[_0xbc2f('0x3d')]);return db[_0xbc2f('0x2c')][_0xbc2f('0x45')](_0x7569c5)[_0xbc2f('0x22')](handleEntityNotFound(_0x47e96f,null))[_0xbc2f('0x22')](respondWithResult(_0x47e96f,null))[_0xbc2f('0x40')](handleError(_0x47e96f,null));};exports[_0xbc2f('0x46')]=function(_0x37702e,_0x43b6a3){return db[_0xbc2f('0x2c')]['create'](_0x37702e[_0xbc2f('0x47')],{})[_0xbc2f('0x22')](function(_0xdca826){var _0x5638c7=_0x37702e['user'][_0xbc2f('0x48')]({'plain':!![]});if(!_0x5638c7)throw new Error(_0xbc2f('0x49'));if(_0x5638c7[_0xbc2f('0x4a')]===_0xbc2f('0x4b')){var _0xa131a6=_0xdca826[_0xbc2f('0x48')]({'plain':!![]});var _0x4c6c29=_0xbc2f('0x23');return db[_0xbc2f('0x4c')][_0xbc2f('0x45')]({'where':{'name':_0x4c6c29,'userProfileId':_0x5638c7[_0xbc2f('0x4d')]},'raw':!![]})[_0xbc2f('0x22')](function(_0x447040){if(_0x447040&&_0x447040[_0xbc2f('0x4e')]===0x0){return db[_0xbc2f('0x24')]['create']({'name':_0xa131a6[_0xbc2f('0x28')],'resourceId':_0xa131a6['id'],'type':_0x447040[_0xbc2f('0x28')],'sectionId':_0x447040['id']},{})[_0xbc2f('0x22')](function(){return _0xdca826;});}else{return _0xdca826;}})[_0xbc2f('0x40')](function(_0x17f231){logger[_0xbc2f('0x26')](_0xbc2f('0x4f'),_0x17f231);throw _0x17f231;});}return _0xdca826;})['then'](respondWithResult(_0x43b6a3,0xc9))[_0xbc2f('0x40')](handleError(_0x43b6a3,null));};exports['update']=function(_0x257dca,_0x2c2e04){if(_0x257dca[_0xbc2f('0x47')]['id']){delete _0x257dca[_0xbc2f('0x47')]['id'];}return db[_0xbc2f('0x2c')][_0xbc2f('0x45')]({'where':{'id':_0x257dca[_0xbc2f('0x42')]['id']}})[_0xbc2f('0x22')](handleEntityNotFound(_0x2c2e04,null))['then'](saveUpdates(_0x257dca['body'],null))[_0xbc2f('0x22')](respondWithResult(_0x2c2e04,null))[_0xbc2f('0x40')](handleError(_0x2c2e04,null));};exports['destroy']=function(_0x46536f,_0x4e995a){return db[_0xbc2f('0x2c')][_0xbc2f('0x45')]({'where':{'id':_0x46536f[_0xbc2f('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e995a,null))[_0xbc2f('0x22')](removeEntity(_0x4e995a,null))['catch'](handleError(_0x4e995a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5b7d245..16b4332 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 _0xc457=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2cd6c9,_0xe6598){var _0x11ad0f=function(_0x1adf72){while(--_0x1adf72){_0x2cd6c9['push'](_0x2cd6c9['shift']());}};_0x11ad0f(++_0xe6598);}(_0xc457,0x190));var _0x7c45=function(_0x37796c,_0x1d45cd){_0x37796c=_0x37796c-0x0;var _0x524160=_0xc457[_0x37796c];return _0x524160;};'use strict';var _=require(_0x7c45('0x0'));var util=require(_0x7c45('0x1'));var logger=require(_0x7c45('0x2'))(_0x7c45('0x3'));var moment=require('moment');var BPromise=require(_0x7c45('0x4'));var rp=require(_0x7c45('0x5'));var fs=require('fs');var path=require(_0x7c45('0x6'));var rimraf=require(_0x7c45('0x7'));var config=require(_0x7c45('0x8'));var attributes=require(_0x7c45('0x9'));module[_0x7c45('0xa')]=function(_0x3b9519,_0x6f5f01){return _0x3b9519['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x7c45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9be9=['moment','bluebird','request-promise','rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0xfb6c4a,_0x57139a){var _0x215efe=function(_0x3ce17a){while(--_0x3ce17a){_0xfb6c4a['push'](_0xfb6c4a['shift']());}};_0x215efe(++_0x57139a);}(_0x9be9,0x98));var _0x99be=function(_0x2112f6,_0x19abfa){_0x2112f6=_0x2112f6-0x0;var _0x5a1ddd=_0x9be9[_0x2112f6];return _0x5a1ddd;};'use strict';var _=require(_0x99be('0x0'));var util=require(_0x99be('0x1'));var logger=require(_0x99be('0x2'))(_0x99be('0x3'));var moment=require(_0x99be('0x4'));var BPromise=require(_0x99be('0x5'));var rp=require(_0x99be('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99be('0x7'));var config=require('../../config/environment');var attributes=require(_0x99be('0x8'));module['exports']=function(_0x41dd7b,_0x370167){return _0x41dd7b[_0x99be('0x9')](_0x99be('0xa'),attributes,{'tableName':_0x99be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 10b0997..db2295f 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 _0x9e26=['result','VerifyAdditionalPhones','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x33aaef,_0x5ca365){var _0x41f560=function(_0x224da7){while(--_0x224da7){_0x33aaef['push'](_0x33aaef['shift']());}};_0x41f560(++_0x5ca365);}(_0x9e26,0x104));var _0x69e2=function(_0x76deaf,_0x158d6f){_0x76deaf=_0x76deaf-0x0;var _0x12ce60=_0x9e26[_0x76deaf];return _0x12ce60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x69e2('0x0'));var BPromise=require('bluebird');var rs=require(_0x69e2('0x1'));var fs=require('fs');var Redis=require(_0x69e2('0x2'));var db=require(_0x69e2('0x3'))['db'];var utils=require(_0x69e2('0x4'));var logger=require('../../config/logger')(_0x69e2('0x5'));var config=require(_0x69e2('0x6'));var jayson=require(_0x69e2('0x7'));var client=jayson['client'][_0x69e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d1183,_0x1e78fa,_0x2f9124){return new BPromise(function(_0x2f0d2d,_0x376baf){return client[_0x69e2('0x9')](_0x1d1183,_0x2f9124)[_0x69e2('0xa')](function(_0x434bc5){logger[_0x69e2('0xb')](_0x69e2('0xc'),_0x1e78fa,_0x69e2('0xd'));logger[_0x69e2('0xe')](_0x69e2('0xf'),_0x1e78fa,_0x69e2('0xd'),JSON[_0x69e2('0x10')](_0x434bc5));if(_0x434bc5[_0x69e2('0x11')]){if(_0x434bc5['error'][_0x69e2('0x12')]===0x1f4){logger[_0x69e2('0x11')](_0x69e2('0xc'),_0x1e78fa,_0x434bc5[_0x69e2('0x11')][_0x69e2('0x13')]);return _0x376baf(_0x434bc5['error'][_0x69e2('0x13')]);}logger[_0x69e2('0x11')](_0x69e2('0xc'),_0x1e78fa,_0x434bc5['error'][_0x69e2('0x13')]);return _0x2f0d2d(_0x434bc5[_0x69e2('0x11')][_0x69e2('0x13')]);}else{logger['info'](_0x69e2('0xc'),_0x1e78fa,_0x69e2('0xd'));_0x2f0d2d(_0x434bc5[_0x69e2('0x14')][_0x69e2('0x13')]);}})['catch'](function(_0x4e3159){logger['error'](_0x69e2('0xc'),_0x1e78fa,_0x4e3159);_0x376baf(_0x4e3159);});});}exports[_0x69e2('0x15')]=function(_0x5ce852){var _0x559158=this;return new Promise(function(_0x4de6d7,_0x37b609){return db[_0x69e2('0x16')][_0x69e2('0x17')]({'raw':!![],'where':{'ContactId':_0x5ce852['body'][_0x69e2('0x18')],'ListId':_0x5ce852['body'][_0x69e2('0x19')],'VoiceQueueId':_0x5ce852[_0x69e2('0x1a')][_0x69e2('0x1b')]===undefined?null:_0x5ce852[_0x69e2('0x1a')]['VoiceQueueId'],'CampaignId':_0x5ce852[_0x69e2('0x1a')][_0x69e2('0x1c')]===undefined?null:_0x5ce852[_0x69e2('0x1a')][_0x69e2('0x1c')]}})[_0x69e2('0xa')](function(_0x48466f){if(_0x48466f!=null){return db[_0x69e2('0x1d')][_0x69e2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x48466f['id'],'OrderBy':{'$gt':_0x48466f['OrderBy']}},'order':[[_0x69e2('0x1e'),_0x69e2('0x1f')]]})[_0x69e2('0xa')](function(_0x45dce0){var _0x1ea7fd=0x0;if(_0x45dce0){if(_0x45dce0[_0x69e2('0x20')]+_0x45dce0[_0x69e2('0x21')]+_0x45dce0[_0x69e2('0x22')]+_0x45dce0[_0x69e2('0x23')]+_0x45dce0[_0x69e2('0x24')]+_0x45dce0[_0x69e2('0x25')]+_0x45dce0[_0x69e2('0x26')]+_0x45dce0[_0x69e2('0x27')]<_0x5ce852[_0x69e2('0x28')][_0x69e2('0x29')])_0x1ea7fd=0x1;_0x4de6d7({'additional':_0x1ea7fd});}else{return db[_0x69e2('0x1d')][_0x69e2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x48466f['id']},'order':[[_0x69e2('0x1e'),'ASC']]})[_0x69e2('0xa')](function(_0x198b41){var _0x10f808=0x0;if(_0x198b41){if(_0x198b41[_0x69e2('0x20')]+_0x198b41[_0x69e2('0x21')]+_0x198b41['countnoanswerretry']+_0x198b41[_0x69e2('0x23')]+_0x198b41[_0x69e2('0x24')]+_0x198b41[_0x69e2('0x25')]+_0x198b41['countmachineretry']+_0x198b41[_0x69e2('0x27')]<_0x5ce852['entity'][_0x69e2('0x29')])_0x10f808=0x1;_0x4de6d7({'additional':_0x10f808});}else{_0x4de6d7({'additional':0x0});}})['catch'](function(_0x2ea4bc){logger[_0x69e2('0x11')](_0x69e2('0x15'),_0x2ea4bc[_0x69e2('0x13')]);_0x37b609(_0x559158['error'](0x1f4,_0x2ea4bc[_0x69e2('0x13')]));});}})[_0x69e2('0x2a')](function(_0x4ae11a){logger['error'](_0x69e2('0x15'),_0x4ae11a[_0x69e2('0x13')]);_0x37b609(_0x559158['error'](0x1f4,_0x4ae11a['message']));});}else _0x4de6d7({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x566e59){var _0xb59848=this;return new Promise(function(_0x3a93f2,_0x5a04dd){return db[_0x69e2('0x16')][_0x69e2('0x17')]({'raw':!![],'where':{'ContactId':_0x566e59['body'][_0x69e2('0x18')],'ListId':_0x566e59[_0x69e2('0x1a')][_0x69e2('0x19')],'VoiceQueueId':_0x566e59['body'][_0x69e2('0x1b')]===undefined?null:_0x566e59[_0x69e2('0x1a')][_0x69e2('0x1b')],'CampaignId':_0x566e59[_0x69e2('0x1a')][_0x69e2('0x1c')]===undefined?null:_0x566e59[_0x69e2('0x1a')]['CampaignId']}})[_0x69e2('0xa')](function(_0x387aea){if(_0x387aea!=null){return db[_0x69e2('0x1d')][_0x69e2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x387aea['id'],'OrderBy':{'$gte':_0x387aea[_0x69e2('0x1e')]}},'order':[[_0x69e2('0x1e'),_0x69e2('0x1f')]]})[_0x69e2('0xa')](function(_0x219da8){if(_0x219da8)return activateAdditionalPhone(_0x387aea,_0x566e59[_0x69e2('0x1a')],_0x219da8,_0x566e59[_0x69e2('0x2b')],_0x566e59['waitTime'])[_0x69e2('0xa')](function(_0x18f465){_0x3a93f2(_0x18f465);});else{return db['CmHopperAdditionalPhone'][_0x69e2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x387aea['id']},'order':[['OrderBy',_0x69e2('0x1f')]]})[_0x69e2('0xa')](function(_0x214ad7){if(_0x214ad7)return activateAdditionalPhone(_0x387aea,_0x566e59[_0x69e2('0x1a')],_0x214ad7,_0x566e59[_0x69e2('0x2b')],_0x566e59[_0x69e2('0x2c')])[_0x69e2('0xa')](function(_0x4449d1){_0x3a93f2(_0x4449d1);});else{_0x3a93f2({'id':_0x387aea['id'],'phone':''});}})[_0x69e2('0x2a')](function(_0xadb0dd){logger['error']('VerifyAdditionalPhones',_0xadb0dd['message']);_0x5a04dd(_0xb59848[_0x69e2('0x11')](0x1f4,_0xadb0dd['message']));});}})['catch'](function(_0x2c5a9d){logger[_0x69e2('0x11')](_0x69e2('0x15'),_0x2c5a9d[_0x69e2('0x13')]);_0x5a04dd(_0xb59848[_0x69e2('0x11')](0x1f4,_0x2c5a9d[_0x69e2('0x13')]));});}else _0x3a93f2(0x1);});});};function activateAdditionalPhone(_0x548395,_0x5a836c,_0xf99303,_0x3c88ef,_0x25854b){return new Promise(function(_0x42a42d,_0x22dc6e){var _0x1af261;if(_[_0x69e2('0x2d')](_0xf99303[_0x69e2('0x2e')])){_0xf99303[_0x69e2('0x2e')]=moment();}if(moment()>moment(_0xf99303['scheduledat'])){_0x1af261=moment()[_0x69e2('0x2f')](_0x25854b||0x3,_0x69e2('0x30'));}else{if(_0xf99303[_0x69e2('0x1e')]==0x0){_0x1af261=moment(_0xf99303[_0x69e2('0x2e')]);}else{_0x1af261=moment()['add'](_0x25854b||0x3,_0x69e2('0x30'));}}if(_[_0x69e2('0x2d')](_0x1af261)){_0x1af261=moment()[_0x69e2('0x2f')](_0x25854b||0x3,_0x69e2('0x30'));}var _0x5ed1a1={'phone':_0x548395[_0x69e2('0x31')],'active':0x0,'OrderBy':_[_0x69e2('0x2d')](_0x548395['OrderBy'])?0x0:_0x548395[_0x69e2('0x1e')],'scheduledat':moment()[_0x69e2('0x2f')](_0x3c88ef||0x1,_0x69e2('0x30')),'countbusyretry':_0x5a836c[_0x69e2('0x20')],'countcongestionretry':_0x5a836c[_0x69e2('0x21')],'countnoanswerretry':_0x5a836c[_0x69e2('0x22')],'countnosuchnumberretry':_0x5a836c[_0x69e2('0x23')],'countdropretry':_0x5a836c[_0x69e2('0x24')],'countabandonedretry':_0x5a836c[_0x69e2('0x25')],'countmachineretry':_0x5a836c[_0x69e2('0x26')],'countagentrejectretry':_0x5a836c[_0x69e2('0x27')],'createdAt':_0x5a836c['createdAt'],'updatedAt':_0x5a836c['updatedAt']};var _0x1f2816={'CmHopperId':_0x548395['id'],'phone':_0xf99303[_0x69e2('0x31')],'active':0x0,'OrderBy':_['isNil'](_0xf99303[_0x69e2('0x1e')])?0x0:_0xf99303[_0x69e2('0x1e')],'scheduledat':_0x1af261,'countbusyretry':_0xf99303[_0x69e2('0x20')],'countcongestionretry':_0xf99303[_0x69e2('0x21')],'countnoanswerretry':_0xf99303['countnoanswerretry'],'countnosuchnumberretry':_0xf99303[_0x69e2('0x23')],'countdropretry':_0xf99303['countdropretry'],'countabandonedretry':_0xf99303[_0x69e2('0x25')],'countmachineretry':_0xf99303['countmachineretry'],'countagentrejectretry':_0xf99303[_0x69e2('0x27')],'createdAt':_0xf99303[_0x69e2('0x32')],'updatedAt':_0xf99303['updatedAt']};return db[_0x69e2('0x33')]['transaction'](function(_0x3f796e){return db[_0x69e2('0x1d')][_0x69e2('0x34')](_0x5ed1a1,{'where':{'id':_0xf99303['id']}},{'transaction':_0x3f796e})['then'](function(){return db[_0x69e2('0x16')]['update'](_0x1f2816,{'where':{'id':_0x548395['id']}},{'transaction':_0x3f796e});});})[_0x69e2('0xa')](function(_0x4673bb){_0x42a42d({'id':_0x548395['id'],'phone':_0xf99303[_0x69e2('0x31')]});})[_0x69e2('0x2a')](function(_0x3f97ee){logger[_0x69e2('0x11')](_0x69e2('0x35'),_0x3f97ee[_0x69e2('0x13')]);_0x22dc6e({'error':_0x3f97ee[_0x69e2('0x13')]});});});}exports[_0x69e2('0x36')]=function(_0x40bc00){var _0x513505=this;return new Promise(function(_0x143a6d,_0x126d8b){return db[_0x69e2('0x16')][_0x69e2('0x34')](_0x40bc00[_0x69e2('0x1a')][_0x69e2('0x37')],{'where':{'id':_0x40bc00[_0x69e2('0x1a')]['id']}})[_0x69e2('0xa')](function(_0x9fc761){_0x143a6d(_0x9fc761);})[_0x69e2('0x2a')](function(_0x1b6687){logger[_0x69e2('0x11')](_0x69e2('0x36'),_0x1b6687[_0x69e2('0x13')]);_0x126d8b(_0x513505[_0x69e2('0x11')](0x1f4,_0x1b6687['message']));});});}; \ No newline at end of file +var _0x79cc=['error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countdropretry','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79cc,0xd3));var _0xc79c=function(_0x4a3648,_0x2a3dc1){_0x4a3648=_0x4a3648-0x0;var _0x1fcd69=_0x79cc[_0x4a3648];return _0x1fcd69;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var moment=require(_0xc79c('0x2'));var BPromise=require(_0xc79c('0x3'));var rs=require(_0xc79c('0x4'));var fs=require('fs');var Redis=require(_0xc79c('0x5'));var db=require(_0xc79c('0x6'))['db'];var utils=require(_0xc79c('0x7'));var logger=require(_0xc79c('0x8'))(_0xc79c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc79c('0xa')][_0xc79c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a4e6f,_0x18bdd8,_0x18fba3){return new BPromise(function(_0x2c90b0,_0x3eb08e){return client[_0xc79c('0xc')](_0x2a4e6f,_0x18fba3)[_0xc79c('0xd')](function(_0x5b03ad){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x18bdd8,_0xc79c('0xe'));logger['debug'](_0xc79c('0xf'),_0x18bdd8,_0xc79c('0xe'),JSON[_0xc79c('0x10')](_0x5b03ad));if(_0x5b03ad['error']){if(_0x5b03ad[_0xc79c('0x11')]['code']===0x1f4){logger[_0xc79c('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x18bdd8,_0x5b03ad[_0xc79c('0x11')]['message']);return _0x3eb08e(_0x5b03ad[_0xc79c('0x11')]['message']);}logger[_0xc79c('0x11')](_0xc79c('0x12'),_0x18bdd8,_0x5b03ad[_0xc79c('0x11')][_0xc79c('0x13')]);return _0x2c90b0(_0x5b03ad[_0xc79c('0x11')]['message']);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x18bdd8,_0xc79c('0xe'));_0x2c90b0(_0x5b03ad['result']['message']);}})[_0xc79c('0x14')](function(_0x3dcdf3){logger['error'](_0xc79c('0x12'),_0x18bdd8,_0x3dcdf3);_0x3eb08e(_0x3dcdf3);});});}exports[_0xc79c('0x15')]=function(_0x3ebb7e){var _0x54cf3b=this;return new Promise(function(_0x39215f,_0x43ff09){return db[_0xc79c('0x16')][_0xc79c('0x17')]({'raw':!![],'where':{'ContactId':_0x3ebb7e[_0xc79c('0x18')][_0xc79c('0x19')],'ListId':_0x3ebb7e[_0xc79c('0x18')]['ListId'],'VoiceQueueId':_0x3ebb7e[_0xc79c('0x18')][_0xc79c('0x1a')]===undefined?null:_0x3ebb7e[_0xc79c('0x18')][_0xc79c('0x1a')],'CampaignId':_0x3ebb7e[_0xc79c('0x18')][_0xc79c('0x1b')]===undefined?null:_0x3ebb7e['body'][_0xc79c('0x1b')]}})[_0xc79c('0xd')](function(_0x2d1265){if(_0x2d1265!=null){return db['CmHopperAdditionalPhone'][_0xc79c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2d1265['id'],'OrderBy':{'$gt':_0x2d1265[_0xc79c('0x1c')]}},'order':[[_0xc79c('0x1c'),_0xc79c('0x1d')]]})['then'](function(_0x501e41){var _0x5b1c99=0x0;if(_0x501e41){if(_0x501e41[_0xc79c('0x1e')]+_0x501e41[_0xc79c('0x1f')]+_0x501e41['countnoanswerretry']+_0x501e41[_0xc79c('0x20')]+_0x501e41['countdropretry']+_0x501e41[_0xc79c('0x21')]+_0x501e41[_0xc79c('0x22')]+_0x501e41[_0xc79c('0x23')]<_0x3ebb7e[_0xc79c('0x24')][_0xc79c('0x25')])_0x5b1c99=0x1;_0x39215f({'additional':_0x5b1c99});}else{return db['CmHopperAdditionalPhone'][_0xc79c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2d1265['id']},'order':[[_0xc79c('0x1c'),_0xc79c('0x1d')]]})[_0xc79c('0xd')](function(_0x11baa2){var _0x2e2ea7=0x0;if(_0x11baa2){if(_0x11baa2[_0xc79c('0x1e')]+_0x11baa2[_0xc79c('0x1f')]+_0x11baa2[_0xc79c('0x26')]+_0x11baa2[_0xc79c('0x20')]+_0x11baa2[_0xc79c('0x27')]+_0x11baa2[_0xc79c('0x21')]+_0x11baa2['countmachineretry']+_0x11baa2['countagentrejectretry']<_0x3ebb7e[_0xc79c('0x24')][_0xc79c('0x25')])_0x2e2ea7=0x1;_0x39215f({'additional':_0x2e2ea7});}else{_0x39215f({'additional':0x0});}})['catch'](function(_0x386359){logger[_0xc79c('0x11')](_0xc79c('0x15'),_0x386359[_0xc79c('0x13')]);_0x43ff09(_0x54cf3b[_0xc79c('0x11')](0x1f4,_0x386359[_0xc79c('0x13')]));});}})[_0xc79c('0x14')](function(_0x13da7){logger['error'](_0xc79c('0x15'),_0x13da7[_0xc79c('0x13')]);_0x43ff09(_0x54cf3b[_0xc79c('0x11')](0x1f4,_0x13da7['message']));});}else _0x39215f({'additional':0x0});});});};exports[_0xc79c('0x28')]=function(_0x3fad6d){var _0x16442b=this;return new Promise(function(_0x347683,_0x196a74){return db[_0xc79c('0x16')][_0xc79c('0x17')]({'raw':!![],'where':{'ContactId':_0x3fad6d[_0xc79c('0x18')][_0xc79c('0x19')],'ListId':_0x3fad6d['body']['ListId'],'VoiceQueueId':_0x3fad6d[_0xc79c('0x18')][_0xc79c('0x1a')]===undefined?null:_0x3fad6d[_0xc79c('0x18')][_0xc79c('0x1a')],'CampaignId':_0x3fad6d[_0xc79c('0x18')][_0xc79c('0x1b')]===undefined?null:_0x3fad6d[_0xc79c('0x18')][_0xc79c('0x1b')]}})[_0xc79c('0xd')](function(_0x35762a){if(_0x35762a!=null){return db[_0xc79c('0x29')][_0xc79c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x35762a['id'],'OrderBy':{'$gte':_0x35762a['OrderBy']}},'order':[['OrderBy',_0xc79c('0x1d')]]})[_0xc79c('0xd')](function(_0xf40f1d){if(_0xf40f1d)return activateAdditionalPhone(_0x35762a,_0x3fad6d[_0xc79c('0x18')],_0xf40f1d,_0x3fad6d[_0xc79c('0x2a')],_0x3fad6d['waitTime'])[_0xc79c('0xd')](function(_0x1e73dd){_0x347683(_0x1e73dd);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x35762a['id']},'order':[['OrderBy',_0xc79c('0x1d')]]})[_0xc79c('0xd')](function(_0x128c99){if(_0x128c99)return activateAdditionalPhone(_0x35762a,_0x3fad6d[_0xc79c('0x18')],_0x128c99,_0x3fad6d[_0xc79c('0x2a')],_0x3fad6d[_0xc79c('0x2b')])[_0xc79c('0xd')](function(_0x122000){_0x347683(_0x122000);});else{_0x347683({'id':_0x35762a['id'],'phone':''});}})[_0xc79c('0x14')](function(_0x1c169d){logger['error'](_0xc79c('0x15'),_0x1c169d[_0xc79c('0x13')]);_0x196a74(_0x16442b[_0xc79c('0x11')](0x1f4,_0x1c169d[_0xc79c('0x13')]));});}})[_0xc79c('0x14')](function(_0x53e3cb){logger[_0xc79c('0x11')](_0xc79c('0x15'),_0x53e3cb['message']);_0x196a74(_0x16442b[_0xc79c('0x11')](0x1f4,_0x53e3cb[_0xc79c('0x13')]));});}else _0x347683(0x1);});});};function activateAdditionalPhone(_0xcc6378,_0x8f2af9,_0x4c8b27,_0x110ab1,_0x16891a){return new Promise(function(_0x26c4cf,_0x59cc99){var _0x38e724;if(_[_0xc79c('0x2c')](_0x4c8b27[_0xc79c('0x2d')])){_0x4c8b27['scheduledat']=moment();}if(moment()>moment(_0x4c8b27[_0xc79c('0x2d')])){_0x38e724=moment()['add'](_0x16891a||0x3,'minutes');}else{if(_0x4c8b27[_0xc79c('0x1c')]==0x0){_0x38e724=moment(_0x4c8b27[_0xc79c('0x2d')]);}else{_0x38e724=moment()[_0xc79c('0x2e')](_0x16891a||0x3,_0xc79c('0x2f'));}}if(_[_0xc79c('0x2c')](_0x38e724)){_0x38e724=moment()[_0xc79c('0x2e')](_0x16891a||0x3,_0xc79c('0x2f'));}var _0x4ae46a={'phone':_0xcc6378[_0xc79c('0x30')],'active':0x0,'OrderBy':_[_0xc79c('0x2c')](_0xcc6378['OrderBy'])?0x0:_0xcc6378[_0xc79c('0x1c')],'scheduledat':moment()[_0xc79c('0x2e')](_0x110ab1||0x1,_0xc79c('0x2f')),'countbusyretry':_0x8f2af9['countbusyretry'],'countcongestionretry':_0x8f2af9[_0xc79c('0x1f')],'countnoanswerretry':_0x8f2af9[_0xc79c('0x26')],'countnosuchnumberretry':_0x8f2af9[_0xc79c('0x20')],'countdropretry':_0x8f2af9[_0xc79c('0x27')],'countabandonedretry':_0x8f2af9[_0xc79c('0x21')],'countmachineretry':_0x8f2af9[_0xc79c('0x22')],'countagentrejectretry':_0x8f2af9[_0xc79c('0x23')],'createdAt':_0x8f2af9[_0xc79c('0x31')],'updatedAt':_0x8f2af9['updatedAt']};var _0x5b34d0={'CmHopperId':_0xcc6378['id'],'phone':_0x4c8b27[_0xc79c('0x30')],'active':0x0,'OrderBy':_[_0xc79c('0x2c')](_0x4c8b27['OrderBy'])?0x0:_0x4c8b27[_0xc79c('0x1c')],'scheduledat':_0x38e724,'countbusyretry':_0x4c8b27['countbusyretry'],'countcongestionretry':_0x4c8b27[_0xc79c('0x1f')],'countnoanswerretry':_0x4c8b27['countnoanswerretry'],'countnosuchnumberretry':_0x4c8b27[_0xc79c('0x20')],'countdropretry':_0x4c8b27[_0xc79c('0x27')],'countabandonedretry':_0x4c8b27[_0xc79c('0x21')],'countmachineretry':_0x4c8b27['countmachineretry'],'countagentrejectretry':_0x4c8b27[_0xc79c('0x23')],'createdAt':_0x4c8b27['createdAt'],'updatedAt':_0x4c8b27[_0xc79c('0x32')]};return db[_0xc79c('0x33')][_0xc79c('0x34')](function(_0x238d55){return db[_0xc79c('0x29')][_0xc79c('0x35')](_0x4ae46a,{'where':{'id':_0x4c8b27['id']}},{'transaction':_0x238d55})[_0xc79c('0xd')](function(){return db[_0xc79c('0x16')][_0xc79c('0x35')](_0x5b34d0,{'where':{'id':_0xcc6378['id']}},{'transaction':_0x238d55});});})[_0xc79c('0xd')](function(_0x1e6683){_0x26c4cf({'id':_0xcc6378['id'],'phone':_0x4c8b27['phone']});})[_0xc79c('0x14')](function(_0x18dc14){logger['error'](_0xc79c('0x36'),_0x18dc14[_0xc79c('0x13')]);_0x59cc99({'error':_0x18dc14[_0xc79c('0x13')]});});});}exports[_0xc79c('0x37')]=function(_0x146c1f){var _0x12ffa5=this;return new Promise(function(_0x8f326d,_0x380095){return db[_0xc79c('0x16')][_0xc79c('0x35')](_0x146c1f['body'][_0xc79c('0x38')],{'where':{'id':_0x146c1f[_0xc79c('0x18')]['id']}})[_0xc79c('0xd')](function(_0x4c0157){_0x8f326d(_0x4c0157);})['catch'](function(_0x435679){logger['error']('IncrementPreviewCounters',_0x435679[_0xc79c('0x13')]);_0x380095(_0x12ffa5[_0xc79c('0x11')](0x1f4,_0x435679['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7d00d9e..5492f9f 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 _0x09e1=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x22a126,_0x5dd1fb){var _0xade95b=function(_0x3b1737){while(--_0x3b1737){_0x22a126['push'](_0x22a126['shift']());}};_0xade95b(++_0x5dd1fb);}(_0x09e1,0x9d));var _0x109e=function(_0x9c1cb1,_0x14fb83){_0x9c1cb1=_0x9c1cb1-0x0;var _0x1755c8=_0x09e1[_0x9c1cb1];return _0x1755c8;};'use strict';var multer=require(_0x109e('0x0'));var util=require('util');var path=require(_0x109e('0x1'));var timeout=require(_0x109e('0x2'));var express=require(_0x109e('0x3'));var router=express[_0x109e('0x4')]();var fs_extra=require(_0x109e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x109e('0x6'));var config=require(_0x109e('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x109e('0x8')]('/',auth['isAuthenticated'](),controller[_0x109e('0x9')]);router[_0x109e('0x8')](_0x109e('0xa'),auth[_0x109e('0xb')](),controller[_0x109e('0xc')]);router[_0x109e('0xd')]('/',auth[_0x109e('0xb')](),controller[_0x109e('0xe')]);router[_0x109e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x109e('0x10')]);router[_0x109e('0x11')](_0x109e('0xa'),auth[_0x109e('0xb')](),controller[_0x109e('0x12')]);module[_0x109e('0x13')]=router; \ No newline at end of file +var _0xbb05=['put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','/:id','show','post','isAuthenticated','create'];(function(_0x495f5e,_0x18dc41){var _0x3aa23f=function(_0x197e75){while(--_0x197e75){_0x495f5e['push'](_0x495f5e['shift']());}};_0x3aa23f(++_0x18dc41);}(_0xbb05,0xa5));var _0x5bb0=function(_0xb051ed,_0x5ce32f){_0xb051ed=_0xb051ed-0x0;var _0x4f57df=_0xbb05[_0xb051ed];return _0x4f57df;};'use strict';var multer=require('multer');var util=require(_0x5bb0('0x0'));var path=require(_0x5bb0('0x1'));var timeout=require(_0x5bb0('0x2'));var express=require('express');var router=express[_0x5bb0('0x3')]();var fs_extra=require(_0x5bb0('0x4'));var auth=require(_0x5bb0('0x5'));var interaction=require(_0x5bb0('0x6'));var config=require(_0x5bb0('0x7'));var controller=require(_0x5bb0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5bb0('0x9')]);router['get'](_0x5bb0('0xa'),auth['isAuthenticated'](),controller[_0x5bb0('0xb')]);router[_0x5bb0('0xc')]('/',auth[_0x5bb0('0xd')](),controller[_0x5bb0('0xe')]);router[_0x5bb0('0xf')](_0x5bb0('0xa'),auth[_0x5bb0('0xd')](),controller[_0x5bb0('0x10')]);router['delete'](_0x5bb0('0xa'),auth[_0x5bb0('0xd')](),controller['destroy']);module[_0x5bb0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3af435b..33c7a20 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 _0xb9a7=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x28482c,_0x4f454f){var _0x3e0953=function(_0x2ebf2a){while(--_0x2ebf2a){_0x28482c['push'](_0x28482c['shift']());}};_0x3e0953(++_0x4f454f);}(_0xb9a7,0x172));var _0x7b9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb9a7[_0x36c5b0];return _0xf19333;};'use strict';var moment=require(_0x7b9a('0x0'));var Sequelize=require('sequelize');module[_0x7b9a('0x1')]={'phone':{'type':Sequelize[_0x7b9a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7b9a('0x3')],'unique':_0x7b9a('0x4')},'ListId':{'type':Sequelize[_0x7b9a('0x3')],'unique':_0x7b9a('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7b9a('0x3')],'unique':_0x7b9a('0x4')}}; \ No newline at end of file +var _0xa428=['contactListQueue','moment','exports','STRING','INTEGER'];(function(_0x408f8a,_0x56e30c){var _0x462f88=function(_0x3e92ce){while(--_0x3e92ce){_0x408f8a['push'](_0x408f8a['shift']());}};_0x462f88(++_0x56e30c);}(_0xa428,0xd8));var _0x8a42=function(_0x527ef1,_0x1f90c0){_0x527ef1=_0x527ef1-0x0;var _0x3c7cb4=_0xa428[_0x527ef1];return _0x3c7cb4;};'use strict';var moment=require(_0x8a42('0x0'));var Sequelize=require('sequelize');module[_0x8a42('0x1')]={'phone':{'type':Sequelize[_0x8a42('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8a42('0x3')],'unique':_0x8a42('0x4')},'ListId':{'type':Sequelize[_0x8a42('0x3')],'unique':_0x8a42('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8a42('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 706c438..39d9aeb 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 _0xe5f0=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','name','query','filters','intersection'];(function(_0x46b131,_0x5d67ad){var _0x41b942=function(_0x46acf8){while(--_0x46acf8){_0x46b131['push'](_0x46b131['shift']());}};_0x41b942(++_0x5d67ad);}(_0xe5f0,0x69));var _0x0e5f=function(_0x49b89a,_0x3fdbdb){_0x49b89a=_0x49b89a-0x0;var _0x5f3630=_0xe5f0[_0x49b89a];return _0x5f3630;};'use strict';var emlformat=require(_0x0e5f('0x0'));var rimraf=require(_0x0e5f('0x1'));var zipdir=require(_0x0e5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e5f('0x3'));var moment=require(_0x0e5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e5f('0x5'));var util=require(_0x0e5f('0x6'));var path=require(_0x0e5f('0x7'));var sox=require(_0x0e5f('0x8'));var csv=require(_0x0e5f('0x9'));var ejs=require(_0x0e5f('0xa'));var fs=require('fs');var fs_extra=require(_0x0e5f('0xb'));var _=require('lodash');var squel=require(_0x0e5f('0xc'));var crypto=require(_0x0e5f('0xd'));var jsforce=require(_0x0e5f('0xe'));var deskjs=require(_0x0e5f('0xf'));var toCsv=require(_0x0e5f('0x9'));var querystring=require(_0x0e5f('0x10'));var Papa=require(_0x0e5f('0x11'));var Redis=require(_0x0e5f('0x12'));var authService=require(_0x0e5f('0x13'));var qs=require(_0x0e5f('0x14'));var as=require(_0x0e5f('0x15'));var hardwareService=require(_0x0e5f('0x16'));var logger=require(_0x0e5f('0x17'))(_0x0e5f('0x18'));var utils=require('../../config/utils');var config=require(_0x0e5f('0x19'));var licenseUtil=require(_0x0e5f('0x1a'));var db=require(_0x0e5f('0x1b'))['db'];function respondWithStatusCode(_0x4e15c5,_0x1c12b2){_0x1c12b2=_0x1c12b2||0xcc;return function(_0x43a44d){if(_0x43a44d){return _0x4e15c5[_0x0e5f('0x1c')](_0x1c12b2);}return _0x4e15c5[_0x0e5f('0x1d')](_0x1c12b2)['end']();};}function respondWithResult(_0x21f76a,_0x38bd87){_0x38bd87=_0x38bd87||0xc8;return function(_0xe5eb85){if(_0xe5eb85){return _0x21f76a[_0x0e5f('0x1d')](_0x38bd87)[_0x0e5f('0x1e')](_0xe5eb85);}};}function respondWithFilteredResult(_0x20d1f6,_0x424554){return function(_0x4c73df){if(_0x4c73df){var _0x2a821b=typeof _0x424554['offset']===_0x0e5f('0x1f')&&typeof _0x424554[_0x0e5f('0x20')]===_0x0e5f('0x1f');var _0x417c14=_0x4c73df['count'];var _0x3a06e4=_0x2a821b?0x0:_0x424554[_0x0e5f('0x21')];var _0xb88104=_0x2a821b?_0x4c73df[_0x0e5f('0x22')]:_0x424554['offset']+_0x424554[_0x0e5f('0x20')];var _0x569321;if(_0xb88104>=_0x417c14){_0xb88104=_0x417c14;_0x569321=0xc8;}else{_0x569321=0xce;}_0x20d1f6[_0x0e5f('0x1d')](_0x569321);return _0x20d1f6[_0x0e5f('0x23')](_0x0e5f('0x24'),_0x3a06e4+'-'+_0xb88104+'/'+_0x417c14)['json'](_0x4c73df);}return null;};}function patchUpdates(_0x4e4747){return function(_0x47dbf2){try{jsonpatch[_0x0e5f('0x25')](_0x47dbf2,_0x4e4747,!![]);}catch(_0x2c48a0){return BPromise[_0x0e5f('0x26')](_0x2c48a0);}return _0x47dbf2[_0x0e5f('0x27')]();};}function saveUpdates(_0x42ad87,_0x2acb89){return function(_0xa63b98){if(_0xa63b98){return _0xa63b98[_0x0e5f('0x28')](_0x42ad87)[_0x0e5f('0x29')](function(_0x107185){return _0x107185;});}return null;};}function removeEntity(_0x199a84,_0x53a99e){return function(_0x5df6fa){if(_0x5df6fa){return _0x5df6fa[_0x0e5f('0x2a')]()['then'](function(){_0x199a84[_0x0e5f('0x1d')](0xcc)[_0x0e5f('0x2b')]();});}};}function handleEntityNotFound(_0x1a078d,_0x58207e){return function(_0x129f3e){if(!_0x129f3e){_0x1a078d[_0x0e5f('0x1c')](0x194);}return _0x129f3e;};}function handleError(_0x4bab19,_0x15794b){_0x15794b=_0x15794b||0x1f4;return function(_0x4ef3f6){logger[_0x0e5f('0x2c')](_0x4ef3f6[_0x0e5f('0x2d')]);if(_0x4ef3f6['name']){delete _0x4ef3f6['name'];}_0x4bab19[_0x0e5f('0x1d')](_0x15794b)[_0x0e5f('0x2e')](_0x4ef3f6);};}exports[_0x0e5f('0x2f')]=function(_0x36b35b,_0x2d16ed){var _0x4178c4={},_0x343d3f={},_0x25702c={'count':0x0,'rows':[]};var _0x596910=_[_0x0e5f('0x30')](db[_0x0e5f('0x31')][_0x0e5f('0x32')],function(_0x2ac18a){return{'name':_0x2ac18a[_0x0e5f('0x33')],'type':_0x2ac18a[_0x0e5f('0x34')][_0x0e5f('0x35')]};});_0x343d3f[_0x0e5f('0x36')]=_[_0x0e5f('0x30')](_0x596910,_0x0e5f('0x37'));_0x343d3f[_0x0e5f('0x38')]=_['keys'](_0x36b35b[_0x0e5f('0x38')]);_0x343d3f[_0x0e5f('0x39')]=_[_0x0e5f('0x3a')](_0x343d3f[_0x0e5f('0x36')],_0x343d3f['query']);_0x4178c4[_0x0e5f('0x3b')]=_['intersection'](_0x343d3f[_0x0e5f('0x36')],qs[_0x0e5f('0x3c')](_0x36b35b['query']['fields']));_0x4178c4[_0x0e5f('0x3b')]=_0x4178c4[_0x0e5f('0x3b')][_0x0e5f('0x3d')]?_0x4178c4['attributes']:_0x343d3f['model'];if(!_0x36b35b[_0x0e5f('0x38')][_0x0e5f('0x3e')](_0x0e5f('0x3f'))){_0x4178c4[_0x0e5f('0x20')]=qs[_0x0e5f('0x20')](_0x36b35b[_0x0e5f('0x38')][_0x0e5f('0x20')]);_0x4178c4[_0x0e5f('0x21')]=qs['offset'](_0x36b35b[_0x0e5f('0x38')]['offset']);}_0x4178c4[_0x0e5f('0x40')]=qs[_0x0e5f('0x41')](_0x36b35b[_0x0e5f('0x38')]['sort']);_0x4178c4[_0x0e5f('0x42')]=qs[_0x0e5f('0x39')](_[_0x0e5f('0x43')](_0x36b35b[_0x0e5f('0x38')],_0x343d3f[_0x0e5f('0x39')]),_0x596910);if(_0x36b35b[_0x0e5f('0x38')]['filter']){_0x4178c4['where']=_[_0x0e5f('0x44')](_0x4178c4[_0x0e5f('0x42')],{'$or':_[_0x0e5f('0x30')](_0x596910,function(_0x4e998b){if(_0x4e998b[_0x0e5f('0x34')]!=='VIRTUAL'){var _0x4b18ca={};_0x4b18ca[_0x4e998b[_0x0e5f('0x37')]]={'$like':'%'+_0x36b35b[_0x0e5f('0x38')][_0x0e5f('0x45')]+'%'};return _0x4b18ca;}})});}_0x4178c4=_['merge']({},_0x4178c4,_0x36b35b['options']);var _0x4ecef0={'where':_0x4178c4[_0x0e5f('0x42')]};return db[_0x0e5f('0x31')][_0x0e5f('0x22')](_0x4ecef0)[_0x0e5f('0x29')](function(_0x3d2573){_0x25702c['count']=_0x3d2573;if(_0x36b35b[_0x0e5f('0x38')][_0x0e5f('0x46')]){_0x4178c4[_0x0e5f('0x47')]=[{'all':!![]}];}return db[_0x0e5f('0x31')][_0x0e5f('0x48')](_0x4178c4);})[_0x0e5f('0x29')](function(_0x4d66e8){_0x25702c[_0x0e5f('0x49')]=_0x4d66e8;return _0x25702c;})['then'](respondWithFilteredResult(_0x2d16ed,_0x4178c4))[_0x0e5f('0x4a')](handleError(_0x2d16ed,null));};exports[_0x0e5f('0x4b')]=function(_0x495211,_0xd99a3b){var _0x5ca812={'raw':!![],'where':{'id':_0x495211[_0x0e5f('0x4c')]['id']}},_0x297cb2={};_0x297cb2[_0x0e5f('0x36')]=_[_0x0e5f('0x4d')](db['CmHopperBlack'][_0x0e5f('0x32')]);_0x297cb2[_0x0e5f('0x38')]=_[_0x0e5f('0x4d')](_0x495211[_0x0e5f('0x38')]);_0x297cb2['filters']=_[_0x0e5f('0x3a')](_0x297cb2['model'],_0x297cb2[_0x0e5f('0x38')]);_0x5ca812['attributes']=_[_0x0e5f('0x3a')](_0x297cb2[_0x0e5f('0x36')],qs[_0x0e5f('0x3c')](_0x495211[_0x0e5f('0x38')]['fields']));_0x5ca812['attributes']=_0x5ca812[_0x0e5f('0x3b')][_0x0e5f('0x3d')]?_0x5ca812[_0x0e5f('0x3b')]:_0x297cb2[_0x0e5f('0x36')];if(_0x495211[_0x0e5f('0x38')][_0x0e5f('0x46')]){_0x5ca812[_0x0e5f('0x47')]=[{'all':!![]}];}_0x5ca812=_['merge']({},_0x5ca812,_0x495211[_0x0e5f('0x4e')]);return db['CmHopperBlack'][_0x0e5f('0x4f')](_0x5ca812)['then'](handleEntityNotFound(_0xd99a3b,null))[_0x0e5f('0x29')](respondWithResult(_0xd99a3b,null))['catch'](handleError(_0xd99a3b,null));};exports[_0x0e5f('0x28')]=function(_0x5974e6,_0x410410){if(_0x5974e6[_0x0e5f('0x50')]['id']){delete _0x5974e6[_0x0e5f('0x50')]['id'];}return db[_0x0e5f('0x31')][_0x0e5f('0x4f')]({'where':{'id':_0x5974e6[_0x0e5f('0x4c')]['id']}})[_0x0e5f('0x29')](handleEntityNotFound(_0x410410,null))['then'](saveUpdates(_0x5974e6['body'],null))[_0x0e5f('0x29')](respondWithResult(_0x410410,null))[_0x0e5f('0x4a')](handleError(_0x410410,null));};exports[_0x0e5f('0x2a')]=function(_0x4e5a4e,_0x13498f){return db[_0x0e5f('0x31')][_0x0e5f('0x4f')]({'where':{'id':_0x4e5a4e[_0x0e5f('0x4c')]['id']}})[_0x0e5f('0x29')](handleEntityNotFound(_0x13498f,null))[_0x0e5f('0x29')](removeEntity(_0x13498f,null))[_0x0e5f('0x4a')](handleError(_0x13498f,null));};exports[_0x0e5f('0x51')]=function(_0x502f2e,_0x506357){return db[_0x0e5f('0x31')][_0x0e5f('0x51')]()[_0x0e5f('0x29')](respondWithResult(_0x506357,null))['catch'](handleError(_0x506357,null));}; \ No newline at end of file +var _0xa4b8=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set'];(function(_0x1b9438,_0x5081c6){var _0x132e53=function(_0xf906ef){while(--_0xf906ef){_0x1b9438['push'](_0x1b9438['shift']());}};_0x132e53(++_0x5081c6);}(_0xa4b8,0x104));var _0x8a4b=function(_0x4a464e,_0x250abf){_0x4a464e=_0x4a464e-0x0;var _0x54d070=_0xa4b8[_0x4a464e];return _0x54d070;};'use strict';var emlformat=require(_0x8a4b('0x0'));var rimraf=require(_0x8a4b('0x1'));var zipdir=require(_0x8a4b('0x2'));var jsonpatch=require(_0x8a4b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a4b('0x4'));var Mustache=require(_0x8a4b('0x5'));var util=require(_0x8a4b('0x6'));var path=require(_0x8a4b('0x7'));var sox=require('sox');var csv=require(_0x8a4b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a4b('0x9'));var _=require(_0x8a4b('0xa'));var squel=require(_0x8a4b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a4b('0xc'));var toCsv=require(_0x8a4b('0x8'));var querystring=require('querystring');var Papa=require(_0x8a4b('0xd'));var Redis=require(_0x8a4b('0xe'));var authService=require(_0x8a4b('0xf'));var qs=require(_0x8a4b('0x10'));var as=require(_0x8a4b('0x11'));var hardwareService=require(_0x8a4b('0x12'));var logger=require('../../config/logger')(_0x8a4b('0x13'));var utils=require(_0x8a4b('0x14'));var config=require(_0x8a4b('0x15'));var licenseUtil=require(_0x8a4b('0x16'));var db=require(_0x8a4b('0x17'))['db'];function respondWithStatusCode(_0xfd63ac,_0x4cb88d){_0x4cb88d=_0x4cb88d||0xcc;return function(_0x35a07e){if(_0x35a07e){return _0xfd63ac[_0x8a4b('0x18')](_0x4cb88d);}return _0xfd63ac['status'](_0x4cb88d)[_0x8a4b('0x19')]();};}function respondWithResult(_0x4838be,_0x3e76ae){_0x3e76ae=_0x3e76ae||0xc8;return function(_0x1d482f){if(_0x1d482f){return _0x4838be[_0x8a4b('0x1a')](_0x3e76ae)['json'](_0x1d482f);}};}function respondWithFilteredResult(_0xdfb47e,_0x2ef77c){return function(_0x2f85fd){if(_0x2f85fd){var _0x4027ea=typeof _0x2ef77c[_0x8a4b('0x1b')]===_0x8a4b('0x1c')&&typeof _0x2ef77c[_0x8a4b('0x1d')]===_0x8a4b('0x1c');var _0x45ae13=_0x2f85fd[_0x8a4b('0x1e')];var _0x49334a=_0x4027ea?0x0:_0x2ef77c[_0x8a4b('0x1b')];var _0x5b8762=_0x4027ea?_0x2f85fd[_0x8a4b('0x1e')]:_0x2ef77c[_0x8a4b('0x1b')]+_0x2ef77c[_0x8a4b('0x1d')];var _0x1e2be0;if(_0x5b8762>=_0x45ae13){_0x5b8762=_0x45ae13;_0x1e2be0=0xc8;}else{_0x1e2be0=0xce;}_0xdfb47e[_0x8a4b('0x1a')](_0x1e2be0);return _0xdfb47e[_0x8a4b('0x1f')](_0x8a4b('0x20'),_0x49334a+'-'+_0x5b8762+'/'+_0x45ae13)['json'](_0x2f85fd);}return null;};}function patchUpdates(_0x125042){return function(_0x451aba){try{jsonpatch[_0x8a4b('0x21')](_0x451aba,_0x125042,!![]);}catch(_0x5390c3){return BPromise[_0x8a4b('0x22')](_0x5390c3);}return _0x451aba[_0x8a4b('0x23')]();};}function saveUpdates(_0x1ebe4d,_0x4f85ed){return function(_0x14e2f0){if(_0x14e2f0){return _0x14e2f0[_0x8a4b('0x24')](_0x1ebe4d)['then'](function(_0x55401a){return _0x55401a;});}return null;};}function removeEntity(_0xfcb9fb,_0x33ca37){return function(_0x1a630b){if(_0x1a630b){return _0x1a630b[_0x8a4b('0x25')]()[_0x8a4b('0x26')](function(){_0xfcb9fb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb114f0,_0x2bfad3){return function(_0x326492){if(!_0x326492){_0xb114f0[_0x8a4b('0x18')](0x194);}return _0x326492;};}function handleError(_0x4e6b22,_0x27c0e6){_0x27c0e6=_0x27c0e6||0x1f4;return function(_0x5db22b){logger[_0x8a4b('0x27')](_0x5db22b[_0x8a4b('0x28')]);if(_0x5db22b[_0x8a4b('0x29')]){delete _0x5db22b['name'];}_0x4e6b22['status'](_0x27c0e6)['send'](_0x5db22b);};}exports[_0x8a4b('0x2a')]=function(_0x383e5e,_0x4ded6a){var _0x1ed632={},_0x22519f={},_0x170396={'count':0x0,'rows':[]};var _0x36bc48=_['map'](db[_0x8a4b('0x2b')][_0x8a4b('0x2c')],function(_0x4b7922){return{'name':_0x4b7922[_0x8a4b('0x2d')],'type':_0x4b7922[_0x8a4b('0x2e')][_0x8a4b('0x2f')]};});_0x22519f[_0x8a4b('0x30')]=_[_0x8a4b('0x31')](_0x36bc48,'name');_0x22519f[_0x8a4b('0x32')]=_[_0x8a4b('0x33')](_0x383e5e[_0x8a4b('0x32')]);_0x22519f[_0x8a4b('0x34')]=_[_0x8a4b('0x35')](_0x22519f[_0x8a4b('0x30')],_0x22519f[_0x8a4b('0x32')]);_0x1ed632[_0x8a4b('0x36')]=_['intersection'](_0x22519f[_0x8a4b('0x30')],qs['fields'](_0x383e5e['query'][_0x8a4b('0x37')]));_0x1ed632[_0x8a4b('0x36')]=_0x1ed632['attributes']['length']?_0x1ed632['attributes']:_0x22519f['model'];if(!_0x383e5e[_0x8a4b('0x32')]['hasOwnProperty']('nolimit')){_0x1ed632[_0x8a4b('0x1d')]=qs[_0x8a4b('0x1d')](_0x383e5e[_0x8a4b('0x32')]['limit']);_0x1ed632[_0x8a4b('0x1b')]=qs['offset'](_0x383e5e[_0x8a4b('0x32')][_0x8a4b('0x1b')]);}_0x1ed632[_0x8a4b('0x38')]=qs[_0x8a4b('0x39')](_0x383e5e['query'][_0x8a4b('0x39')]);_0x1ed632[_0x8a4b('0x3a')]=qs['filters'](_[_0x8a4b('0x3b')](_0x383e5e[_0x8a4b('0x32')],_0x22519f[_0x8a4b('0x34')]),_0x36bc48);if(_0x383e5e[_0x8a4b('0x32')][_0x8a4b('0x3c')]){_0x1ed632[_0x8a4b('0x3a')]=_[_0x8a4b('0x3d')](_0x1ed632[_0x8a4b('0x3a')],{'$or':_['map'](_0x36bc48,function(_0x135ecc){if(_0x135ecc[_0x8a4b('0x2e')]!=='VIRTUAL'){var _0x212303={};_0x212303[_0x135ecc[_0x8a4b('0x29')]]={'$like':'%'+_0x383e5e['query']['filter']+'%'};return _0x212303;}})});}_0x1ed632=_[_0x8a4b('0x3d')]({},_0x1ed632,_0x383e5e[_0x8a4b('0x3e')]);var _0x518666={'where':_0x1ed632[_0x8a4b('0x3a')]};return db['CmHopperBlack'][_0x8a4b('0x1e')](_0x518666)[_0x8a4b('0x26')](function(_0x32002a){_0x170396[_0x8a4b('0x1e')]=_0x32002a;if(_0x383e5e[_0x8a4b('0x32')]['includeAll']){_0x1ed632[_0x8a4b('0x3f')]=[{'all':!![]}];}return db[_0x8a4b('0x2b')][_0x8a4b('0x40')](_0x1ed632);})[_0x8a4b('0x26')](function(_0x56cb58){_0x170396[_0x8a4b('0x41')]=_0x56cb58;return _0x170396;})['then'](respondWithFilteredResult(_0x4ded6a,_0x1ed632))[_0x8a4b('0x42')](handleError(_0x4ded6a,null));};exports[_0x8a4b('0x43')]=function(_0x4a942a,_0x5dee3f){var _0x12ba31={'raw':!![],'where':{'id':_0x4a942a[_0x8a4b('0x44')]['id']}},_0x59778f={};_0x59778f[_0x8a4b('0x30')]=_['keys'](db[_0x8a4b('0x2b')][_0x8a4b('0x2c')]);_0x59778f[_0x8a4b('0x32')]=_[_0x8a4b('0x33')](_0x4a942a[_0x8a4b('0x32')]);_0x59778f[_0x8a4b('0x34')]=_[_0x8a4b('0x35')](_0x59778f[_0x8a4b('0x30')],_0x59778f[_0x8a4b('0x32')]);_0x12ba31['attributes']=_[_0x8a4b('0x35')](_0x59778f[_0x8a4b('0x30')],qs[_0x8a4b('0x37')](_0x4a942a[_0x8a4b('0x32')][_0x8a4b('0x37')]));_0x12ba31[_0x8a4b('0x36')]=_0x12ba31[_0x8a4b('0x36')]['length']?_0x12ba31[_0x8a4b('0x36')]:_0x59778f[_0x8a4b('0x30')];if(_0x4a942a[_0x8a4b('0x32')][_0x8a4b('0x45')]){_0x12ba31[_0x8a4b('0x3f')]=[{'all':!![]}];}_0x12ba31=_[_0x8a4b('0x3d')]({},_0x12ba31,_0x4a942a[_0x8a4b('0x3e')]);return db[_0x8a4b('0x2b')][_0x8a4b('0x46')](_0x12ba31)[_0x8a4b('0x26')](handleEntityNotFound(_0x5dee3f,null))[_0x8a4b('0x26')](respondWithResult(_0x5dee3f,null))[_0x8a4b('0x42')](handleError(_0x5dee3f,null));};exports[_0x8a4b('0x24')]=function(_0xc64420,_0x25d242){if(_0xc64420[_0x8a4b('0x47')]['id']){delete _0xc64420[_0x8a4b('0x47')]['id'];}return db[_0x8a4b('0x2b')][_0x8a4b('0x46')]({'where':{'id':_0xc64420['params']['id']}})['then'](handleEntityNotFound(_0x25d242,null))['then'](saveUpdates(_0xc64420['body'],null))[_0x8a4b('0x26')](respondWithResult(_0x25d242,null))[_0x8a4b('0x42')](handleError(_0x25d242,null));};exports[_0x8a4b('0x25')]=function(_0x3a86da,_0x3b75f8){return db[_0x8a4b('0x2b')]['find']({'where':{'id':_0x3a86da['params']['id']}})[_0x8a4b('0x26')](handleEntityNotFound(_0x3b75f8,null))[_0x8a4b('0x26')](removeEntity(_0x3b75f8,null))[_0x8a4b('0x42')](handleError(_0x3b75f8,null));};exports['describe']=function(_0x1a03d,_0x6c98f8){return db[_0x8a4b('0x2b')][_0x8a4b('0x48')]()[_0x8a4b('0x26')](respondWithResult(_0x6c98f8,null))[_0x8a4b('0x42')](handleError(_0x6c98f8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1270ea7..28d21dd 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 _0x9664=['bluebird','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api'];(function(_0x1b881d,_0xded95d){var _0x3b718e=function(_0x4f63e0){while(--_0x4f63e0){_0x1b881d['push'](_0x1b881d['shift']());}};_0x3b718e(++_0xded95d);}(_0x9664,0x13d));var _0x4966=function(_0x460a5d,_0x3e0529){_0x460a5d=_0x460a5d-0x0;var _0x55c0ac=_0x9664[_0x460a5d];return _0x55c0ac;};'use strict';var _=require('lodash');var util=require(_0x4966('0x0'));var logger=require(_0x4966('0x1'))(_0x4966('0x2'));var moment=require('moment');var BPromise=require(_0x4966('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4966('0x4'));var rimraf=require(_0x4966('0x5'));var config=require('../../config/environment');var attributes=require(_0x4966('0x6'));module['exports']=function(_0x501a9f,_0x4c10fb){return _0x501a9f[_0x4966('0x7')](_0x4966('0x8'),attributes,{'tableName':_0x4966('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c31=['define','util','../../config/logger','api','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3c31,0x1cc));var _0x13c3=function(_0x2bbe00,_0x4d2ab4){_0x2bbe00=_0x2bbe00-0x0;var _0x12d35a=_0x3c31[_0x2bbe00];return _0x12d35a;};'use strict';var _=require('lodash');var util=require(_0x13c3('0x0'));var logger=require(_0x13c3('0x1'))(_0x13c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x13c3('0x3'));var fs=require('fs');var path=require(_0x13c3('0x4'));var rimraf=require('rimraf');var config=require(_0x13c3('0x5'));var attributes=require(_0x13c3('0x6'));module[_0x13c3('0x7')]=function(_0x4f7e2c,_0x267449){return _0x4f7e2c[_0x13c3('0x8')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 30ae87e..16250e9 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 _0x4f75=['message','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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'];(function(_0x397f2d,_0x16863e){var _0x2b2eb=function(_0x2bd841){while(--_0x2bd841){_0x397f2d['push'](_0x397f2d['shift']());}};_0x2b2eb(++_0x16863e);}(_0x4f75,0x166));var _0x54f7=function(_0x38cf75,_0x59fe8d){_0x38cf75=_0x38cf75-0x0;var _0x4cf87a=_0x4f75[_0x38cf75];return _0x4cf87a;};'use strict';var _=require('lodash');var util=require(_0x54f7('0x0'));var moment=require(_0x54f7('0x1'));var BPromise=require(_0x54f7('0x2'));var rs=require(_0x54f7('0x3'));var fs=require('fs');var Redis=require(_0x54f7('0x4'));var db=require(_0x54f7('0x5'))['db'];var utils=require(_0x54f7('0x6'));var logger=require(_0x54f7('0x7'))(_0x54f7('0x8'));var config=require('../../config/environment');var jayson=require(_0x54f7('0x9'));var client=jayson[_0x54f7('0xa')][_0x54f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be359,_0x527a68,_0x1cb82f){return new BPromise(function(_0x1b0652,_0x46c873){return client[_0x54f7('0xc')](_0x3be359,_0x1cb82f)[_0x54f7('0xd')](function(_0x2ccd2a){logger[_0x54f7('0xe')](_0x54f7('0xf'),_0x527a68,_0x54f7('0x10'));logger[_0x54f7('0x11')](_0x54f7('0x12'),_0x527a68,'request\x20sent',JSON[_0x54f7('0x13')](_0x2ccd2a));if(_0x2ccd2a['error']){if(_0x2ccd2a[_0x54f7('0x14')][_0x54f7('0x15')]===0x1f4){logger[_0x54f7('0x14')](_0x54f7('0xf'),_0x527a68,_0x2ccd2a[_0x54f7('0x14')]['message']);return _0x46c873(_0x2ccd2a[_0x54f7('0x14')][_0x54f7('0x16')]);}logger[_0x54f7('0x14')](_0x54f7('0xf'),_0x527a68,_0x2ccd2a['error'][_0x54f7('0x16')]);return _0x1b0652(_0x2ccd2a[_0x54f7('0x14')][_0x54f7('0x16')]);}else{logger[_0x54f7('0xe')](_0x54f7('0xf'),_0x527a68,_0x54f7('0x10'));_0x1b0652(_0x2ccd2a['result']['message']);}})['catch'](function(_0x2af9de){logger[_0x54f7('0x14')](_0x54f7('0xf'),_0x527a68,_0x2af9de);_0x46c873(_0x2af9de);});});}exports[_0x54f7('0x17')]=function(_0x35b9f3){var _0x2aef87=this;return new Promise(function(_0x152b22,_0x1ea4af){return db[_0x54f7('0x18')]['findAll']({'raw':_0x35b9f3[_0x54f7('0x19')]?_0x35b9f3[_0x54f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35b9f3['options']?_0x35b9f3[_0x54f7('0x19')][_0x54f7('0x1a')]||null:null,'attributes':_0x35b9f3[_0x54f7('0x19')]?_0x35b9f3[_0x54f7('0x19')][_0x54f7('0x1b')]||null:null,'limit':_0x35b9f3[_0x54f7('0x19')]?_0x35b9f3['options'][_0x54f7('0x1c')]||null:null,'include':_0x35b9f3[_0x54f7('0x19')]?_0x35b9f3['options'][_0x54f7('0x1d')]?_[_0x54f7('0x1e')](_0x35b9f3[_0x54f7('0x19')][_0x54f7('0x1d')],function(_0x42dfbe){return{'model':db[_0x42dfbe['model']],'as':_0x42dfbe['as'],'attributes':_0x42dfbe[_0x54f7('0x1b')],'include':_0x42dfbe['include']?_[_0x54f7('0x1e')](_0x42dfbe[_0x54f7('0x1d')],function(_0x3a819c){return{'model':db[_0x3a819c[_0x54f7('0x1f')]],'as':_0x3a819c['as'],'attributes':_0x3a819c['attributes'],'include':_0x3a819c[_0x54f7('0x1d')]?_['map'](_0x3a819c[_0x54f7('0x1d')],function(_0x559321){return{'model':db[_0x559321[_0x54f7('0x1f')]],'as':_0x559321['as'],'attributes':_0x559321[_0x54f7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x54f7('0xd')](function(_0x508a1c){logger[_0x54f7('0xe')](_0x54f7('0x17'),_0x35b9f3);logger['debug'](_0x54f7('0x17'),_0x35b9f3,JSON[_0x54f7('0x13')](_0x508a1c));_0x152b22(_0x508a1c);})[_0x54f7('0x20')](function(_0x393fbe){logger['error'](_0x54f7('0x17'),_0x393fbe[_0x54f7('0x16')],_0x35b9f3);_0x1ea4af(_0x2aef87['error'](0x1f4,_0x393fbe[_0x54f7('0x16')]));});});};exports[_0x54f7('0x21')]=function(_0x40f157){var _0x8ecb0e=this;return new Promise(function(_0x4a0cb0,_0x55a9a9){return db['CmHopperBlack'][_0x54f7('0x22')](_0x40f157['body'],{'raw':_0x40f157[_0x54f7('0x19')]?_0x40f157[_0x54f7('0x19')][_0x54f7('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40f157['options']?_0x40f157[_0x54f7('0x19')]['where']||null:null,'attributes':_0x40f157['options']?_0x40f157[_0x54f7('0x19')][_0x54f7('0x1b')]||null:null,'limit':_0x40f157[_0x54f7('0x19')]?_0x40f157[_0x54f7('0x19')][_0x54f7('0x1c')]||null:null})[_0x54f7('0xd')](function(_0x323a75){logger[_0x54f7('0xe')](_0x54f7('0x21'),_0x40f157);logger[_0x54f7('0x11')](_0x54f7('0x21'),_0x40f157,JSON[_0x54f7('0x13')](_0x323a75));_0x4a0cb0(_0x323a75);})[_0x54f7('0x20')](function(_0x529d7c){logger[_0x54f7('0x14')]('UpdateCmHopperBlack',_0x529d7c['message'],_0x40f157);_0x55a9a9(_0x8ecb0e[_0x54f7('0x14')](0x1f4,_0x529d7c[_0x54f7('0x16')]));});});};exports[_0x54f7('0x24')]=function(_0x11d33e){var _0x11a28b=this;return new Promise(function(_0x23d044,_0x3e9d68){return db[_0x54f7('0x18')][_0x54f7('0x25')]({'where':_0x11d33e['options']?_0x11d33e[_0x54f7('0x19')][_0x54f7('0x1a')]||null:null})[_0x54f7('0xd')](function(_0x5821c4){logger[_0x54f7('0xe')]('DestroyCmHopperBlack',_0x11d33e);logger[_0x54f7('0x11')]('DestroyCmHopperBlack',_0x11d33e,JSON['stringify'](_0x5821c4));_0x23d044(_0x5821c4);})[_0x54f7('0x20')](function(_0xef22e7){logger['error']('DestroyCmHopperBlack',_0xef22e7[_0x54f7('0x16')],_0x11d33e);_0x3e9d68(_0x11a28b[_0x54f7('0x14')](0x1f4,_0xef22e7['message']));});});}; \ No newline at end of file +var _0xea40=['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','findAll','options','where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x3dc14c,_0x45643e){var _0x5deccc=function(_0x4bc693){while(--_0x4bc693){_0x3dc14c['push'](_0x3dc14c['shift']());}};_0x5deccc(++_0x45643e);}(_0xea40,0x117));var _0x0ea4=function(_0x64954c,_0x3ebec3){_0x64954c=_0x64954c-0x0;var _0x47c88b=_0xea40[_0x64954c];return _0x47c88b;};'use strict';var _=require('lodash');var util=require(_0x0ea4('0x0'));var moment=require('moment');var BPromise=require(_0x0ea4('0x1'));var rs=require(_0x0ea4('0x2'));var fs=require('fs');var Redis=require(_0x0ea4('0x3'));var db=require(_0x0ea4('0x4'))['db'];var utils=require(_0x0ea4('0x5'));var logger=require(_0x0ea4('0x6'))(_0x0ea4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0ea4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7610e3,_0x17b27e,_0x170a54){return new BPromise(function(_0x3a0a5e,_0x483f14){return client[_0x0ea4('0x9')](_0x7610e3,_0x170a54)[_0x0ea4('0xa')](function(_0x24195f){logger[_0x0ea4('0xb')](_0x0ea4('0xc'),_0x17b27e,_0x0ea4('0xd'));logger[_0x0ea4('0xe')](_0x0ea4('0xf'),_0x17b27e,_0x0ea4('0xd'),JSON[_0x0ea4('0x10')](_0x24195f));if(_0x24195f[_0x0ea4('0x11')]){if(_0x24195f[_0x0ea4('0x11')][_0x0ea4('0x12')]===0x1f4){logger[_0x0ea4('0x11')](_0x0ea4('0xc'),_0x17b27e,_0x24195f[_0x0ea4('0x11')][_0x0ea4('0x13')]);return _0x483f14(_0x24195f[_0x0ea4('0x11')][_0x0ea4('0x13')]);}logger[_0x0ea4('0x11')](_0x0ea4('0xc'),_0x17b27e,_0x24195f[_0x0ea4('0x11')][_0x0ea4('0x13')]);return _0x3a0a5e(_0x24195f[_0x0ea4('0x11')][_0x0ea4('0x13')]);}else{logger[_0x0ea4('0xb')](_0x0ea4('0xc'),_0x17b27e,_0x0ea4('0xd'));_0x3a0a5e(_0x24195f[_0x0ea4('0x14')]['message']);}})[_0x0ea4('0x15')](function(_0x2da03d){logger[_0x0ea4('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x17b27e,_0x2da03d);_0x483f14(_0x2da03d);});});}exports['GetCmHopperBlack']=function(_0x172ec9){var _0x383c81=this;return new Promise(function(_0x2b76e7,_0x1151e9){return db[_0x0ea4('0x16')][_0x0ea4('0x17')]({'raw':_0x172ec9[_0x0ea4('0x18')]?_0x172ec9[_0x0ea4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x172ec9[_0x0ea4('0x18')]?_0x172ec9[_0x0ea4('0x18')][_0x0ea4('0x19')]||null:null,'attributes':_0x172ec9[_0x0ea4('0x18')]?_0x172ec9[_0x0ea4('0x18')][_0x0ea4('0x1a')]||null:null,'limit':_0x172ec9[_0x0ea4('0x18')]?_0x172ec9[_0x0ea4('0x18')]['limit']||null:null,'include':_0x172ec9[_0x0ea4('0x18')]?_0x172ec9[_0x0ea4('0x18')][_0x0ea4('0x1b')]?_['map'](_0x172ec9['options']['include'],function(_0x20f719){return{'model':db[_0x20f719['model']],'as':_0x20f719['as'],'attributes':_0x20f719[_0x0ea4('0x1a')],'include':_0x20f719[_0x0ea4('0x1b')]?_[_0x0ea4('0x1c')](_0x20f719['include'],function(_0x22a89b){return{'model':db[_0x22a89b[_0x0ea4('0x1d')]],'as':_0x22a89b['as'],'attributes':_0x22a89b[_0x0ea4('0x1a')],'include':_0x22a89b[_0x0ea4('0x1b')]?_['map'](_0x22a89b[_0x0ea4('0x1b')],function(_0x772861){return{'model':db[_0x772861['model']],'as':_0x772861['as'],'attributes':_0x772861[_0x0ea4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0ea4('0xa')](function(_0x2f4e0b){logger[_0x0ea4('0xb')](_0x0ea4('0x1e'),_0x172ec9);logger[_0x0ea4('0xe')](_0x0ea4('0x1e'),_0x172ec9,JSON[_0x0ea4('0x10')](_0x2f4e0b));_0x2b76e7(_0x2f4e0b);})[_0x0ea4('0x15')](function(_0x1d9624){logger[_0x0ea4('0x11')](_0x0ea4('0x1e'),_0x1d9624['message'],_0x172ec9);_0x1151e9(_0x383c81['error'](0x1f4,_0x1d9624['message']));});});};exports[_0x0ea4('0x1f')]=function(_0x5becf7){var _0x4cef03=this;return new Promise(function(_0xd985e7,_0x4194a1){return db[_0x0ea4('0x16')][_0x0ea4('0x20')](_0x5becf7[_0x0ea4('0x21')],{'raw':_0x5becf7[_0x0ea4('0x18')]?_0x5becf7[_0x0ea4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5becf7[_0x0ea4('0x18')]?_0x5becf7[_0x0ea4('0x18')][_0x0ea4('0x19')]||null:null,'attributes':_0x5becf7['options']?_0x5becf7[_0x0ea4('0x18')]['attributes']||null:null,'limit':_0x5becf7[_0x0ea4('0x18')]?_0x5becf7[_0x0ea4('0x18')][_0x0ea4('0x22')]||null:null})['then'](function(_0x1ab214){logger[_0x0ea4('0xb')](_0x0ea4('0x1f'),_0x5becf7);logger[_0x0ea4('0xe')]('UpdateCmHopperBlack',_0x5becf7,JSON[_0x0ea4('0x10')](_0x1ab214));_0xd985e7(_0x1ab214);})[_0x0ea4('0x15')](function(_0x4a5d5c){logger[_0x0ea4('0x11')]('UpdateCmHopperBlack',_0x4a5d5c['message'],_0x5becf7);_0x4194a1(_0x4cef03[_0x0ea4('0x11')](0x1f4,_0x4a5d5c['message']));});});};exports['DestroyCmHopperBlack']=function(_0x2d76ad){var _0x57f5ef=this;return new Promise(function(_0x26b025,_0x2d7696){return db['CmHopperBlack']['destroy']({'where':_0x2d76ad['options']?_0x2d76ad['options'][_0x0ea4('0x19')]||null:null})[_0x0ea4('0xa')](function(_0x4f9f48){logger[_0x0ea4('0xb')](_0x0ea4('0x23'),_0x2d76ad);logger[_0x0ea4('0xe')](_0x0ea4('0x23'),_0x2d76ad,JSON[_0x0ea4('0x10')](_0x4f9f48));_0x26b025(_0x4f9f48);})[_0x0ea4('0x15')](function(_0x2d260c){logger[_0x0ea4('0x11')](_0x0ea4('0x23'),_0x2d260c[_0x0ea4('0x13')],_0x2d76ad);_0x2d7696(_0x57f5ef[_0x0ea4('0x11')](0x1f4,_0x2d260c[_0x0ea4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4a68ea6..88dec57 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 _0xeff8=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','update','exports','multer'];(function(_0x55a79d,_0x5ec923){var _0x2ca054=function(_0x1670c7){while(--_0x1670c7){_0x55a79d['push'](_0x55a79d['shift']());}};_0x2ca054(++_0x5ec923);}(_0xeff8,0x186));var _0x8eff=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xeff8[_0x2ec461];return _0x28603d;};'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['put'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller[_0x8eff('0xf')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['destroy']);module[_0x8eff('0x10')]=router; \ No newline at end of file +var _0x4975=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x4975,0x86));var _0x5497=function(_0xb73539,_0x3ff5c6){_0xb73539=_0xb73539-0x0;var _0x5de3b3=_0x4975[_0xb73539];return _0x5de3b3;};'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')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 07bf87f..4b9ba90 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 _0x1055=['INTEGER','DATE','getDataValue','endtime','setDataValue','diff','BOOLEAN','moment','exports','STRING'];(function(_0x1487a2,_0x30a40f){var _0x440c63=function(_0x44e3a0){while(--_0x44e3a0){_0x1487a2['push'](_0x1487a2['shift']());}};_0x440c63(++_0x30a40f);}(_0x1055,0x89));var _0x5105=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x1055[_0x36cff7];return _0x21c697;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5105('0x0'));module[_0x5105('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5105('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5105('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5105('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5105('0x2')]},'starttime':{'type':Sequelize[_0x5105('0x4')]},'responsetime':{'type':Sequelize[_0x5105('0x4')]},'answertime':{'type':Sequelize[_0x5105('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5105('0x4')]},'ringtime':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5105('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5105('0x2')]},'membername':{'type':Sequelize[_0x5105('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5105('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5105('0x2')]},'dispositionat':{'type':Sequelize[_0x5105('0x4')],'set':function(_0x15f01a){var _0x5485ba=this[_0x5105('0x5')](_0x5105('0x6'));if(_0x5485ba&&_0x15f01a){this[_0x5105('0x7')]('followuptime',moment(_0x15f01a)[_0x5105('0x8')](moment(_0x5485ba),'seconds'));}}},'amd':{'type':Sequelize[_0x5105('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5105('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5105('0x4')]},'callback':{'type':Sequelize[_0x5105('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5105('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5105('0x4')]},'recallme':{'type':Sequelize[_0x5105('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5105('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5105('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5046=['STRING','getDataValue','endtime','diff','seconds','BOOLEAN','moment','exports','INTEGER','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5046,0x182));var _0x6504=function(_0x630b5c,_0x402577){_0x630b5c=_0x630b5c-0x0;var _0x35ce73=_0x5046[_0x630b5c];return _0x35ce73;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6504('0x0'));module[_0x6504('0x1')]={'state':{'type':Sequelize[_0x6504('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6504('0x3')]},'countbusyretry':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6504('0x4')]},'calleridnum':{'type':Sequelize[_0x6504('0x4')]},'calleridname':{'type':Sequelize[_0x6504('0x4')]},'starttime':{'type':Sequelize[_0x6504('0x3')]},'responsetime':{'type':Sequelize[_0x6504('0x3')]},'answertime':{'type':Sequelize[_0x6504('0x3')]},'droptime':{'type':Sequelize[_0x6504('0x3')]},'endtime':{'type':Sequelize[_0x6504('0x3')]},'ringtime':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6504('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6504('0x4')]},'reason':{'type':Sequelize[_0x6504('0x4')]},'disposition':{'type':Sequelize[_0x6504('0x4')]},'secondDisposition':{'type':Sequelize[_0x6504('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6504('0x3')],'set':function(_0x4f3190){var _0x42b272=this[_0x6504('0x5')](_0x6504('0x6'));if(_0x42b272&&_0x4f3190){this['setDataValue']('followuptime',moment(_0x4f3190)[_0x6504('0x7')](moment(_0x42b272),_0x6504('0x8')));}}},'amd':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6504('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6504('0x3')]},'deleted':{'type':Sequelize[_0x6504('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6504('0x3')]},'recallme':{'type':Sequelize[_0x6504('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6504('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6504('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6504('0x2')],'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 be77d0b..f62730c 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 _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x4283c8,_0x10f507){var _0x5baece=function(_0x48045d){while(--_0x48045d){_0x4283c8['push'](_0x4283c8['shift']());}};_0x5baece(++_0x10f507);}(_0x430c,0x1a1));var _0xc430=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x430c[_0x2afb44];return _0x15ccc2;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','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(_0x1a116a,_0x33e430){var _0x8abae1=function(_0x27301a){while(--_0x27301a){_0x1a116a['push'](_0x1a116a['shift']());}};_0x8abae1(++_0x33e430);}(_0x1623,0xab));var _0x3162=function(_0x181c1f,_0x3701a4){_0x181c1f=_0x181c1f-0x0;var _0x2f5aac=_0x1623[_0x181c1f];return _0x2f5aac;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6968192..ec038ec 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 _0x8ea6=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8ea6,0x10f));var _0x68ea=function(_0x392ca7,_0x3bada9){_0x392ca7=_0x392ca7-0x0;var _0x2add14=_0x8ea6[_0x392ca7];return _0x2add14;};'use strict';var _=require('lodash');var util=require(_0x68ea('0x0'));var logger=require(_0x68ea('0x1'))(_0x68ea('0x2'));var moment=require(_0x68ea('0x3'));var BPromise=require(_0x68ea('0x4'));var rp=require(_0x68ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x68ea('0x6'));var attributes=require(_0x68ea('0x7'));module[_0x68ea('0x8')]=function(_0x93e0c1,_0x2d12fd){return _0x93e0c1[_0x68ea('0x9')](_0x68ea('0xa'),attributes,{'tableName':_0x68ea('0xb'),'paranoid':![],'indexes':[{'name':_0x68ea('0xc'),'fields':[_0x68ea('0xc')]},{'name':_0x68ea('0xd'),'fields':[_0x68ea('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x924e=['request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa1acdf,_0x474f2c){var _0x45b883=function(_0x15b12d){while(--_0x15b12d){_0xa1acdf['push'](_0xa1acdf['shift']());}};_0x45b883(++_0x474f2c);}(_0x924e,0x6a));var _0xe924=function(_0x5ecb10,_0x38c15f){_0x5ecb10=_0x5ecb10-0x0;var _0x3e30fd=_0x924e[_0x5ecb10];return _0x3e30fd;};'use strict';var _=require(_0xe924('0x0'));var util=require(_0xe924('0x1'));var logger=require(_0xe924('0x2'))(_0xe924('0x3'));var moment=require(_0xe924('0x4'));var BPromise=require(_0xe924('0x5'));var rp=require(_0xe924('0x6'));var fs=require('fs');var path=require(_0xe924('0x7'));var rimraf=require(_0xe924('0x8'));var config=require('../../config/environment');var attributes=require(_0xe924('0x9'));module[_0xe924('0xa')]=function(_0x164a2f,_0x1225d9){return _0x164a2f[_0xe924('0xb')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xe924('0xc')]},{'name':_0xe924('0xd'),'fields':[_0xe924('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4ea38c9..896312a 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(_0xca89e3,_0x2926da){var _0x1f00c2=function(_0x53a608){while(--_0x53a608){_0xca89e3['push'](_0xca89e3['shift']());}};_0x1f00c2(++_0x2926da);}(_0x7a54,0x106));var _0x47a5=function(_0x3be70f,_0x52bbfc){_0x3be70f=_0x3be70f-0x0;var _0x5b6e68=_0x7a54[_0x3be70f];return _0x5b6e68;};'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(_0x39a626,_0x3acc19){var _0x50ef67=function(_0xaa386f){while(--_0xaa386f){_0x39a626['push'](_0x39a626['shift']());}};_0x50ef67(++_0x3acc19);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b0aa3,_0x198647){_0x4b0aa3=_0x4b0aa3-0x0;var _0x126ad5=_0xb10b[_0x4b0aa3];return _0x126ad5;};'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 53fff56..edb363a 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 _0xc5c6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','util','path'];(function(_0x40e7b3,_0x23a8e7){var _0x2cfb20=function(_0x4cb603){while(--_0x4cb603){_0x40e7b3['push'](_0x40e7b3['shift']());}};_0x2cfb20(++_0x23a8e7);}(_0xc5c6,0x184));var _0x6c5c=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xc5c6[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require('multer');var util=require(_0x6c5c('0x0'));var path=require(_0x6c5c('0x1'));var timeout=require(_0x6c5c('0x2'));var express=require(_0x6c5c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6c5c('0x4'));var interaction=require(_0x6c5c('0x5'));var config=require(_0x6c5c('0x6'));var controller=require(_0x6c5c('0x7'));router['get']('/',auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x9')]);router[_0x6c5c('0xa')]('/describe',auth[_0x6c5c('0x8')](),controller[_0x6c5c('0xb')]);router[_0x6c5c('0xa')](_0x6c5c('0xc'),auth['isAuthenticated'](),controller[_0x6c5c('0xd')]);router['get'](_0x6c5c('0xe'),auth[_0x6c5c('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x6c5c('0xf'),auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x10')]);router[_0x6c5c('0x11')](_0x6c5c('0x12'),auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x13')]);router[_0x6c5c('0x11')](_0x6c5c('0x14'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x6c5c('0x11')](_0x6c5c('0x15'),auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x16')]);router[_0x6c5c('0x17')](_0x6c5c('0xc'),auth['isAuthenticated'](),controller[_0x6c5c('0x18')]);module[_0x6c5c('0x19')]=router; \ No newline at end of file +var _0x6caf=['/checkContactHopper','checkContactHopper','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x5e6a2f,_0x325627){var _0x2c89e4=function(_0x154286){while(--_0x154286){_0x5e6a2f['push'](_0x5e6a2f['shift']());}};_0x2c89e4(++_0x325627);}(_0x6caf,0x90));var _0xf6ca=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x6caf[_0xd7b0a4];return _0x184e9e;};'use strict';var multer=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var path=require(_0xf6ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6ca('0x3'));var router=express[_0xf6ca('0x4')]();var fs_extra=require(_0xf6ca('0x5'));var auth=require(_0xf6ca('0x6'));var interaction=require(_0xf6ca('0x7'));var config=require(_0xf6ca('0x8'));var controller=require(_0xf6ca('0x9'));router['get']('/',auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xb')]);router['get']('/describe',auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xc')]);router[_0xf6ca('0xd')](_0xf6ca('0xe'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xf')]);router[_0xf6ca('0xd')](_0xf6ca('0x10'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0x11')]);router[_0xf6ca('0xd')](_0xf6ca('0x12'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0x13')]);router[_0xf6ca('0x14')](_0xf6ca('0x15'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xf6ca('0x14')](_0xf6ca('0x16'),auth['isAuthenticated'](),controller[_0xf6ca('0x17')]);router[_0xf6ca('0x14')](_0xf6ca('0x18'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0x19')]);router[_0xf6ca('0x1a')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xf6ca('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index eb317c7..7b875db 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 _0xf132=['sequelize','INTEGER','DATE','STRING','BOOLEAN'];(function(_0xa29e2b,_0x5c83a2){var _0x494035=function(_0x3b351b){while(--_0x3b351b){_0xa29e2b['push'](_0xa29e2b['shift']());}};_0x494035(++_0x5c83a2);}(_0xf132,0xaa));var _0x2f13=function(_0x4f0923,_0x118831){_0x4f0923=_0x4f0923-0x0;var _0x184380=_0xf132[_0x4f0923];return _0x184380;};'use strict';var Sequelize=require(_0x2f13('0x0'));module['exports']={'state':{'type':Sequelize[_0x2f13('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2f13('0x2')]},'countbusyretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2f13('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2f13('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2f13('0x2')]},'responsetime':{'type':Sequelize[_0x2f13('0x2')]},'answertime':{'type':Sequelize[_0x2f13('0x2')]},'droptime':{'type':Sequelize[_0x2f13('0x2')]},'endtime':{'type':Sequelize[_0x2f13('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2f13('0x3')]},'campaign':{'type':Sequelize[_0x2f13('0x3')]},'campaigntype':{'type':Sequelize[_0x2f13('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x2f13('0x3')]},'amd':{'type':Sequelize[_0x2f13('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2f13('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2f13('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2f13('0x2')]},'edited':{'type':Sequelize[_0x2f13('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2f13('0x3')]}}; \ No newline at end of file +var _0x5d10=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5d10,0x85));var _0x05d1=function(_0x5f0432,_0x2b29c8){_0x5f0432=_0x5f0432-0x0;var _0x48eb08=_0x5d10[_0x5f0432];return _0x48eb08;};'use strict';var Sequelize=require(_0x05d1('0x0'));module[_0x05d1('0x1')]={'state':{'type':Sequelize[_0x05d1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x05d1('0x3')]},'scheduledat':{'type':Sequelize[_0x05d1('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x05d1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x05d1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x05d1('0x3')]},'calleridnum':{'type':Sequelize[_0x05d1('0x3')]},'calleridname':{'type':Sequelize[_0x05d1('0x3')]},'starttime':{'type':Sequelize[_0x05d1('0x4')]},'responsetime':{'type':Sequelize[_0x05d1('0x4')]},'answertime':{'type':Sequelize[_0x05d1('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x05d1('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x05d1('0x3')]},'campaign':{'type':Sequelize[_0x05d1('0x3')]},'campaigntype':{'type':Sequelize[_0x05d1('0x3')]},'membername':{'type':Sequelize[_0x05d1('0x3')]},'reason':{'type':Sequelize[_0x05d1('0x3')]},'amd':{'type':Sequelize[_0x05d1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x05d1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x05d1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x05d1('0x4')]},'recallme':{'type':Sequelize[_0x05d1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x05d1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x05d1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9a8f986..6869fc8 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 _0x3e8c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x3e8c,0x17b));var _0xc3e8=function(_0x2300a6,_0x1d6ab7){_0x2300a6=_0x2300a6-0x0;var _0x6d76e3=_0x3e8c[_0x2300a6];return _0x6d76e3;};'use strict';var emlformat=require(_0xc3e8('0x0'));var rimraf=require(_0xc3e8('0x1'));var zipdir=require(_0xc3e8('0x2'));var jsonpatch=require(_0xc3e8('0x3'));var rp=require(_0xc3e8('0x4'));var moment=require(_0xc3e8('0x5'));var BPromise=require(_0xc3e8('0x6'));var Mustache=require(_0xc3e8('0x7'));var util=require(_0xc3e8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc3e8('0x9'));var ejs=require(_0xc3e8('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e8('0xb'));var _=require(_0xc3e8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc3e8('0xd'));var deskjs=require(_0xc3e8('0xe'));var toCsv=require(_0xc3e8('0x9'));var querystring=require(_0xc3e8('0xf'));var Papa=require('papaparse');var Redis=require(_0xc3e8('0x10'));var authService=require(_0xc3e8('0x11'));var qs=require(_0xc3e8('0x12'));var as=require(_0xc3e8('0x13'));var hardwareService=require(_0xc3e8('0x14'));var logger=require(_0xc3e8('0x15'))(_0xc3e8('0x16'));var utils=require('../../config/utils');var config=require(_0xc3e8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3e8('0x18'))['db'];function respondWithStatusCode(_0x2dfc67,_0x5a0377){_0x5a0377=_0x5a0377||0xcc;return function(_0x2aa273){if(_0x2aa273){return _0x2dfc67[_0xc3e8('0x19')](_0x5a0377);}return _0x2dfc67[_0xc3e8('0x1a')](_0x5a0377)[_0xc3e8('0x1b')]();};}function respondWithResult(_0x4e198a,_0x226d4c){_0x226d4c=_0x226d4c||0xc8;return function(_0x1e4bb4){if(_0x1e4bb4){return _0x4e198a[_0xc3e8('0x1a')](_0x226d4c)[_0xc3e8('0x1c')](_0x1e4bb4);}};}function respondWithFilteredResult(_0x4b7703,_0xbd3ef5){return function(_0x292bde){if(_0x292bde){var _0x39e568=typeof _0xbd3ef5['offset']===_0xc3e8('0x1d')&&typeof _0xbd3ef5[_0xc3e8('0x1e')]==='undefined';var _0x21fd7f=_0x292bde[_0xc3e8('0x1f')];var _0x4eb9ee=_0x39e568?0x0:_0xbd3ef5[_0xc3e8('0x20')];var _0x511330=_0x39e568?_0x292bde[_0xc3e8('0x1f')]:_0xbd3ef5[_0xc3e8('0x20')]+_0xbd3ef5['limit'];var _0x238f77;if(_0x511330>=_0x21fd7f){_0x511330=_0x21fd7f;_0x238f77=0xc8;}else{_0x238f77=0xce;}_0x4b7703[_0xc3e8('0x1a')](_0x238f77);return _0x4b7703['set'](_0xc3e8('0x21'),_0x4eb9ee+'-'+_0x511330+'/'+_0x21fd7f)['json'](_0x292bde);}return null;};}function patchUpdates(_0x3a7cdc){return function(_0x4c7362){try{jsonpatch[_0xc3e8('0x22')](_0x4c7362,_0x3a7cdc,!![]);}catch(_0x579326){return BPromise[_0xc3e8('0x23')](_0x579326);}return _0x4c7362['save']();};}function saveUpdates(_0x31454b,_0x3f4df8){return function(_0x45d2aa){if(_0x45d2aa){return _0x45d2aa[_0xc3e8('0x24')](_0x31454b)[_0xc3e8('0x25')](function(_0x42f107){return _0x42f107;});}return null;};}function removeEntity(_0x5af930,_0x5bf036){return function(_0x551309){if(_0x551309){return _0x551309[_0xc3e8('0x26')]()[_0xc3e8('0x25')](function(){_0x5af930[_0xc3e8('0x1a')](0xcc)[_0xc3e8('0x1b')]();});}};}function handleEntityNotFound(_0x15f104,_0x81c960){return function(_0x514779){if(!_0x514779){_0x15f104[_0xc3e8('0x19')](0x194);}return _0x514779;};}function handleError(_0x468c58,_0x2e307f){_0x2e307f=_0x2e307f||0x1f4;return function(_0x339cac){logger['error'](_0x339cac['stack']);if(_0x339cac[_0xc3e8('0x27')]){delete _0x339cac['name'];}_0x468c58[_0xc3e8('0x1a')](_0x2e307f)['send'](_0x339cac);};}exports[_0xc3e8('0x28')]=function(_0x3e2a3f,_0x141614){var _0x26679f={},_0x3ded09={},_0x397ed7={'count':0x0,'rows':[]};var _0x56895c=_[_0xc3e8('0x29')](db[_0xc3e8('0x2a')][_0xc3e8('0x2b')],function(_0x474432){return{'name':_0x474432[_0xc3e8('0x2c')],'type':_0x474432[_0xc3e8('0x2d')][_0xc3e8('0x2e')]};});_0x3ded09[_0xc3e8('0x2f')]=_['map'](_0x56895c,_0xc3e8('0x27'));_0x3ded09[_0xc3e8('0x30')]=_[_0xc3e8('0x31')](_0x3e2a3f[_0xc3e8('0x30')]);_0x3ded09[_0xc3e8('0x32')]=_['intersection'](_0x3ded09[_0xc3e8('0x2f')],_0x3ded09[_0xc3e8('0x30')]);_0x26679f[_0xc3e8('0x33')]=_[_0xc3e8('0x34')](_0x3ded09['model'],qs[_0xc3e8('0x35')](_0x3e2a3f[_0xc3e8('0x30')][_0xc3e8('0x35')]));_0x26679f[_0xc3e8('0x33')]=_0x26679f[_0xc3e8('0x33')][_0xc3e8('0x36')]?_0x26679f[_0xc3e8('0x33')]:_0x3ded09[_0xc3e8('0x2f')];if(!_0x3e2a3f[_0xc3e8('0x30')][_0xc3e8('0x37')]('nolimit')){_0x26679f[_0xc3e8('0x1e')]=qs[_0xc3e8('0x1e')](_0x3e2a3f['query'][_0xc3e8('0x1e')]);_0x26679f[_0xc3e8('0x20')]=qs['offset'](_0x3e2a3f[_0xc3e8('0x30')]['offset']);}_0x26679f[_0xc3e8('0x38')]=qs[_0xc3e8('0x39')](_0x3e2a3f[_0xc3e8('0x30')][_0xc3e8('0x39')]);_0x26679f['where']=qs['filters'](_[_0xc3e8('0x3a')](_0x3e2a3f[_0xc3e8('0x30')],_0x3ded09[_0xc3e8('0x32')]),_0x56895c);if(_0x3e2a3f['query'][_0xc3e8('0x3b')]){_0x26679f[_0xc3e8('0x3c')]=_[_0xc3e8('0x3d')](_0x26679f[_0xc3e8('0x3c')],{'$or':_[_0xc3e8('0x29')](_0x56895c,function(_0x23ec8d){if(_0x23ec8d[_0xc3e8('0x2d')]!==_0xc3e8('0x3e')){var _0xda4d84={};_0xda4d84[_0x23ec8d[_0xc3e8('0x27')]]={'$like':'%'+_0x3e2a3f['query'][_0xc3e8('0x3b')]+'%'};return _0xda4d84;}})});}_0x26679f=_['merge']({},_0x26679f,_0x3e2a3f[_0xc3e8('0x3f')]);var _0x2d573c={'where':_0x26679f[_0xc3e8('0x3c')]};return db['CmHopperHistory']['count'](_0x2d573c)[_0xc3e8('0x25')](function(_0x208a4d){_0x397ed7['count']=_0x208a4d;if(_0x3e2a3f[_0xc3e8('0x30')][_0xc3e8('0x40')]){_0x26679f[_0xc3e8('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc3e8('0x42')](_0x26679f);})['then'](function(_0x5311f9){_0x397ed7[_0xc3e8('0x43')]=_0x5311f9;return _0x397ed7;})['then'](respondWithFilteredResult(_0x141614,_0x26679f))[_0xc3e8('0x44')](handleError(_0x141614,null));};exports[_0xc3e8('0x45')]=function(_0x3c6712,_0x5bab03){var _0x4d14eb={'raw':!![],'where':{'id':_0x3c6712[_0xc3e8('0x46')]['id']}},_0x30d58c={};_0x30d58c[_0xc3e8('0x2f')]=_[_0xc3e8('0x31')](db[_0xc3e8('0x2a')][_0xc3e8('0x2b')]);_0x30d58c[_0xc3e8('0x30')]=_[_0xc3e8('0x31')](_0x3c6712[_0xc3e8('0x30')]);_0x30d58c[_0xc3e8('0x32')]=_['intersection'](_0x30d58c[_0xc3e8('0x2f')],_0x30d58c[_0xc3e8('0x30')]);_0x4d14eb['attributes']=_[_0xc3e8('0x34')](_0x30d58c[_0xc3e8('0x2f')],qs['fields'](_0x3c6712['query'][_0xc3e8('0x35')]));_0x4d14eb['attributes']=_0x4d14eb[_0xc3e8('0x33')][_0xc3e8('0x36')]?_0x4d14eb[_0xc3e8('0x33')]:_0x30d58c[_0xc3e8('0x2f')];if(_0x3c6712[_0xc3e8('0x30')]['includeAll']){_0x4d14eb[_0xc3e8('0x41')]=[{'all':!![]}];}_0x4d14eb=_[_0xc3e8('0x3d')]({},_0x4d14eb,_0x3c6712[_0xc3e8('0x3f')]);return db[_0xc3e8('0x2a')][_0xc3e8('0x47')](_0x4d14eb)[_0xc3e8('0x25')](handleEntityNotFound(_0x5bab03,null))[_0xc3e8('0x25')](respondWithResult(_0x5bab03,null))[_0xc3e8('0x44')](handleError(_0x5bab03,null));};exports['create']=function(_0x31970a,_0x64270a){return db[_0xc3e8('0x2a')][_0xc3e8('0x48')](_0x31970a[_0xc3e8('0x49')],{})['then'](respondWithResult(_0x64270a,0xc9))[_0xc3e8('0x44')](handleError(_0x64270a,null));};exports['describe']=function(_0x47082a,_0x2a8b3b){return db[_0xc3e8('0x2a')][_0xc3e8('0x4a')]()[_0xc3e8('0x25')](respondWithResult(_0x2a8b3b,null))['catch'](handleError(_0x2a8b3b,null));};exports['update']=function(_0x7f586e,_0x5dc36f){if(_0x7f586e[_0xc3e8('0x49')][_0xc3e8('0x4b')]){delete _0x7f586e['body'][_0xc3e8('0x4b')];}return db[_0xc3e8('0x2a')][_0xc3e8('0x47')]({'where':{'uniqueid':_0x7f586e['params']['id']}})[_0xc3e8('0x25')](handleEntityNotFound(_0x5dc36f,null))['then'](saveUpdates(_0x7f586e[_0xc3e8('0x49')],null))[_0xc3e8('0x25')](respondWithResult(_0x5dc36f,null))[_0xc3e8('0x44')](handleError(_0x5dc36f,null));}; \ No newline at end of file +var _0x225b=['then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','filter','type','VIRTUAL','merge','options','findAll','catch','show','rawAttributes','includeAll','include','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x2faaba,_0x3f2b50){var _0x7099d9=function(_0xffe9fb){while(--_0xffe9fb){_0x2faaba['push'](_0x2faaba['shift']());}};_0x7099d9(++_0x3f2b50);}(_0x225b,0x19a));var _0xb225=function(_0x5aaf3c,_0x5278c0){_0x5aaf3c=_0x5aaf3c-0x0;var _0x3f945c=_0x225b[_0x5aaf3c];return _0x3f945c;};'use strict';var emlformat=require(_0xb225('0x0'));var rimraf=require(_0xb225('0x1'));var zipdir=require(_0xb225('0x2'));var jsonpatch=require(_0xb225('0x3'));var rp=require(_0xb225('0x4'));var moment=require(_0xb225('0x5'));var BPromise=require(_0xb225('0x6'));var Mustache=require(_0xb225('0x7'));var util=require(_0xb225('0x8'));var path=require(_0xb225('0x9'));var sox=require(_0xb225('0xa'));var csv=require(_0xb225('0xb'));var ejs=require(_0xb225('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb225('0xd'));var squel=require(_0xb225('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb225('0xf'));var toCsv=require(_0xb225('0xb'));var querystring=require('querystring');var Papa=require(_0xb225('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb225('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb225('0x12'))(_0xb225('0x13'));var utils=require(_0xb225('0x14'));var config=require(_0xb225('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb225('0x16'))['db'];function respondWithStatusCode(_0x5f1692,_0x2e1a){_0x2e1a=_0x2e1a||0xcc;return function(_0x37f1aa){if(_0x37f1aa){return _0x5f1692[_0xb225('0x17')](_0x2e1a);}return _0x5f1692[_0xb225('0x18')](_0x2e1a)['end']();};}function respondWithResult(_0x5bc75a,_0x3c1f8d){_0x3c1f8d=_0x3c1f8d||0xc8;return function(_0x16e021){if(_0x16e021){return _0x5bc75a[_0xb225('0x18')](_0x3c1f8d)[_0xb225('0x19')](_0x16e021);}};}function respondWithFilteredResult(_0x142ffa,_0x5c19e1){return function(_0x1d398e){if(_0x1d398e){var _0x3a554e=typeof _0x5c19e1['offset']===_0xb225('0x1a')&&typeof _0x5c19e1[_0xb225('0x1b')]===_0xb225('0x1a');var _0x13ac2a=_0x1d398e[_0xb225('0x1c')];var _0x121342=_0x3a554e?0x0:_0x5c19e1['offset'];var _0x1c1c8b=_0x3a554e?_0x1d398e['count']:_0x5c19e1['offset']+_0x5c19e1['limit'];var _0x35360d;if(_0x1c1c8b>=_0x13ac2a){_0x1c1c8b=_0x13ac2a;_0x35360d=0xc8;}else{_0x35360d=0xce;}_0x142ffa['status'](_0x35360d);return _0x142ffa['set'](_0xb225('0x1d'),_0x121342+'-'+_0x1c1c8b+'/'+_0x13ac2a)[_0xb225('0x19')](_0x1d398e);}return null;};}function patchUpdates(_0x20ae1e){return function(_0x2efa7a){try{jsonpatch[_0xb225('0x1e')](_0x2efa7a,_0x20ae1e,!![]);}catch(_0x2a0b55){return BPromise[_0xb225('0x1f')](_0x2a0b55);}return _0x2efa7a[_0xb225('0x20')]();};}function saveUpdates(_0x252736,_0x5419a2){return function(_0x2c47a6){if(_0x2c47a6){return _0x2c47a6[_0xb225('0x21')](_0x252736)[_0xb225('0x22')](function(_0x592301){return _0x592301;});}return null;};}function removeEntity(_0x58a659,_0xb2da98){return function(_0x548ab7){if(_0x548ab7){return _0x548ab7[_0xb225('0x23')]()[_0xb225('0x22')](function(){_0x58a659[_0xb225('0x18')](0xcc)[_0xb225('0x24')]();});}};}function handleEntityNotFound(_0x4c2671,_0x234abc){return function(_0x33074f){if(!_0x33074f){_0x4c2671['sendStatus'](0x194);}return _0x33074f;};}function handleError(_0x36a6c6,_0x29b196){_0x29b196=_0x29b196||0x1f4;return function(_0x434c18){logger[_0xb225('0x25')](_0x434c18[_0xb225('0x26')]);if(_0x434c18[_0xb225('0x27')]){delete _0x434c18[_0xb225('0x27')];}_0x36a6c6['status'](_0x29b196)[_0xb225('0x28')](_0x434c18);};}exports[_0xb225('0x29')]=function(_0x557a6f,_0x8e9b23){var _0x32ca8b={},_0x3df266={},_0x5d4d8d={'count':0x0,'rows':[]};var _0x4ae1c3=_[_0xb225('0x2a')](db[_0xb225('0x2b')]['rawAttributes'],function(_0x2f3e53){return{'name':_0x2f3e53['fieldName'],'type':_0x2f3e53['type']['key']};});_0x3df266['model']=_[_0xb225('0x2a')](_0x4ae1c3,_0xb225('0x27'));_0x3df266['query']=_[_0xb225('0x2c')](_0x557a6f[_0xb225('0x2d')]);_0x3df266['filters']=_[_0xb225('0x2e')](_0x3df266[_0xb225('0x2f')],_0x3df266[_0xb225('0x2d')]);_0x32ca8b[_0xb225('0x30')]=_[_0xb225('0x2e')](_0x3df266[_0xb225('0x2f')],qs[_0xb225('0x31')](_0x557a6f['query'][_0xb225('0x31')]));_0x32ca8b[_0xb225('0x30')]=_0x32ca8b[_0xb225('0x30')][_0xb225('0x32')]?_0x32ca8b[_0xb225('0x30')]:_0x3df266[_0xb225('0x2f')];if(!_0x557a6f[_0xb225('0x2d')][_0xb225('0x33')](_0xb225('0x34'))){_0x32ca8b[_0xb225('0x1b')]=qs[_0xb225('0x1b')](_0x557a6f[_0xb225('0x2d')][_0xb225('0x1b')]);_0x32ca8b['offset']=qs[_0xb225('0x35')](_0x557a6f[_0xb225('0x2d')][_0xb225('0x35')]);}_0x32ca8b['order']=qs[_0xb225('0x36')](_0x557a6f[_0xb225('0x2d')][_0xb225('0x36')]);_0x32ca8b[_0xb225('0x37')]=qs[_0xb225('0x38')](_['pick'](_0x557a6f['query'],_0x3df266[_0xb225('0x38')]),_0x4ae1c3);if(_0x557a6f[_0xb225('0x2d')][_0xb225('0x39')]){_0x32ca8b['where']=_['merge'](_0x32ca8b[_0xb225('0x37')],{'$or':_[_0xb225('0x2a')](_0x4ae1c3,function(_0x1e14b6){if(_0x1e14b6[_0xb225('0x3a')]!==_0xb225('0x3b')){var _0xc3fc3f={};_0xc3fc3f[_0x1e14b6[_0xb225('0x27')]]={'$like':'%'+_0x557a6f[_0xb225('0x2d')][_0xb225('0x39')]+'%'};return _0xc3fc3f;}})});}_0x32ca8b=_[_0xb225('0x3c')]({},_0x32ca8b,_0x557a6f[_0xb225('0x3d')]);var _0xdc055d={'where':_0x32ca8b[_0xb225('0x37')]};return db[_0xb225('0x2b')][_0xb225('0x1c')](_0xdc055d)[_0xb225('0x22')](function(_0x2d7e6f){_0x5d4d8d[_0xb225('0x1c')]=_0x2d7e6f;if(_0x557a6f[_0xb225('0x2d')]['includeAll']){_0x32ca8b['include']=[{'all':!![]}];}return db[_0xb225('0x2b')][_0xb225('0x3e')](_0x32ca8b);})[_0xb225('0x22')](function(_0x2139eb){_0x5d4d8d['rows']=_0x2139eb;return _0x5d4d8d;})['then'](respondWithFilteredResult(_0x8e9b23,_0x32ca8b))[_0xb225('0x3f')](handleError(_0x8e9b23,null));};exports[_0xb225('0x40')]=function(_0x342ece,_0x5322e9){var _0x257d8f={'raw':!![],'where':{'id':_0x342ece['params']['id']}},_0x3bcd96={};_0x3bcd96[_0xb225('0x2f')]=_['keys'](db[_0xb225('0x2b')][_0xb225('0x41')]);_0x3bcd96[_0xb225('0x2d')]=_[_0xb225('0x2c')](_0x342ece[_0xb225('0x2d')]);_0x3bcd96[_0xb225('0x38')]=_['intersection'](_0x3bcd96[_0xb225('0x2f')],_0x3bcd96['query']);_0x257d8f[_0xb225('0x30')]=_[_0xb225('0x2e')](_0x3bcd96[_0xb225('0x2f')],qs[_0xb225('0x31')](_0x342ece[_0xb225('0x2d')][_0xb225('0x31')]));_0x257d8f[_0xb225('0x30')]=_0x257d8f['attributes'][_0xb225('0x32')]?_0x257d8f[_0xb225('0x30')]:_0x3bcd96[_0xb225('0x2f')];if(_0x342ece['query'][_0xb225('0x42')]){_0x257d8f[_0xb225('0x43')]=[{'all':!![]}];}_0x257d8f=_[_0xb225('0x3c')]({},_0x257d8f,_0x342ece[_0xb225('0x3d')]);return db[_0xb225('0x2b')][_0xb225('0x44')](_0x257d8f)[_0xb225('0x22')](handleEntityNotFound(_0x5322e9,null))[_0xb225('0x22')](respondWithResult(_0x5322e9,null))[_0xb225('0x3f')](handleError(_0x5322e9,null));};exports[_0xb225('0x45')]=function(_0x557a2c,_0x27aef3){return db['CmHopperHistory']['create'](_0x557a2c[_0xb225('0x46')],{})['then'](respondWithResult(_0x27aef3,0xc9))[_0xb225('0x3f')](handleError(_0x27aef3,null));};exports[_0xb225('0x47')]=function(_0x2ed8cc,_0x4b4788){return db[_0xb225('0x2b')][_0xb225('0x47')]()[_0xb225('0x22')](respondWithResult(_0x4b4788,null))[_0xb225('0x3f')](handleError(_0x4b4788,null));};exports[_0xb225('0x21')]=function(_0x41aced,_0xadd6fe){if(_0x41aced[_0xb225('0x46')]['uniqueid']){delete _0x41aced[_0xb225('0x46')][_0xb225('0x48')];}return db[_0xb225('0x2b')][_0xb225('0x44')]({'where':{'uniqueid':_0x41aced[_0xb225('0x49')]['id']}})['then'](handleEntityNotFound(_0xadd6fe,null))[_0xb225('0x22')](saveUpdates(_0x41aced[_0xb225('0x46')],null))[_0xb225('0x22')](respondWithResult(_0xadd6fe,null))[_0xb225('0x3f')](handleError(_0xadd6fe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 536cf15..d1ffe82 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 _0x81b7=['../../config/environment','./cmHopperHistory.attributes','exports','define','endtime','uniqueid','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x548ccb,_0x1fab15){var _0x2f7701=function(_0x92da09){while(--_0x92da09){_0x548ccb['push'](_0x548ccb['shift']());}};_0x2f7701(++_0x1fab15);}(_0x81b7,0x1f2));var _0x781b=function(_0xe449bb,_0x515c55){_0xe449bb=_0xe449bb-0x0;var _0x3272d1=_0x81b7[_0xe449bb];return _0x3272d1;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var logger=require(_0x781b('0x1'))(_0x781b('0x2'));var moment=require(_0x781b('0x3'));var BPromise=require('bluebird');var rp=require(_0x781b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var attributes=require(_0x781b('0x7'));module[_0x781b('0x8')]=function(_0x5eed8e,_0x3d9d36){return _0x5eed8e[_0x781b('0x9')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x781b('0xa'),'fields':[_0x781b('0xa')]},{'name':_0x781b('0xb'),'fields':[_0x781b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d62=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5011f5,_0x92181b){var _0x2b0e3f=function(_0x47393c){while(--_0x47393c){_0x5011f5['push'](_0x5011f5['shift']());}};_0x2b0e3f(++_0x92181b);}(_0x8d62,0xf8));var _0x28d6=function(_0x1c3b66,_0xc7befd){_0x1c3b66=_0x1c3b66-0x0;var _0x45c792=_0x8d62[_0x1c3b66];return _0x45c792;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var logger=require(_0x28d6('0x1'))(_0x28d6('0x2'));var moment=require(_0x28d6('0x3'));var BPromise=require(_0x28d6('0x4'));var rp=require(_0x28d6('0x5'));var fs=require('fs');var path=require(_0x28d6('0x6'));var rimraf=require(_0x28d6('0x7'));var config=require(_0x28d6('0x8'));var attributes=require(_0x28d6('0x9'));module[_0x28d6('0xa')]=function(_0x4385ba,_0x3c827b){return _0x4385ba[_0x28d6('0xb')]('CmHopperHistory',attributes,{'tableName':_0x28d6('0xc'),'paranoid':![],'indexes':[{'name':_0x28d6('0xd'),'fields':[_0x28d6('0xd')]},{'name':'uniqueid','fields':[_0x28d6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index beb9711..f8c511b 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 _0x8029=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateCmHopperHistory','body','options','raw','debug','CmHopperHistory','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','where','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','campaign','GetCampaignHopperHistory','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay'];(function(_0x5d5ea3,_0x3d2c62){var _0x564782=function(_0x21e2a7){while(--_0x21e2a7){_0x5d5ea3['push'](_0x5d5ea3['shift']());}};_0x564782(++_0x3d2c62);}(_0x8029,0xf8));var _0x9802=function(_0x201539,_0x4d357f){_0x201539=_0x201539-0x0;var _0x1976a2=_0x8029[_0x201539];return _0x1976a2;};'use strict';var _=require(_0x9802('0x0'));var util=require(_0x9802('0x1'));var moment=require('moment');var BPromise=require(_0x9802('0x2'));var rs=require(_0x9802('0x3'));var fs=require('fs');var Redis=require(_0x9802('0x4'));var db=require(_0x9802('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9802('0x6'));var config=require(_0x9802('0x7'));var jayson=require(_0x9802('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52f9a0,_0x39f748,_0xa50d40){return new BPromise(function(_0x1d1405,_0x331bb1){return client['request'](_0x52f9a0,_0xa50d40)[_0x9802('0x9')](function(_0x2930eb){logger['info'](_0x9802('0xa'),_0x39f748,_0x9802('0xb'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x39f748,'request\x20sent',JSON[_0x9802('0xc')](_0x2930eb));if(_0x2930eb[_0x9802('0xd')]){if(_0x2930eb[_0x9802('0xd')][_0x9802('0xe')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x39f748,_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);return _0x331bb1(_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);}logger[_0x9802('0xd')](_0x9802('0xa'),_0x39f748,_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);return _0x1d1405(_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);}else{logger[_0x9802('0x10')](_0x9802('0xa'),_0x39f748,_0x9802('0xb'));_0x1d1405(_0x2930eb['result']['message']);}})[_0x9802('0x11')](function(_0x440c8d){logger[_0x9802('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x39f748,_0x440c8d);_0x331bb1(_0x440c8d);});});}exports[_0x9802('0x12')]=function(_0x1fd296){var _0x1b43f2=this;return new Promise(function(_0xa753e,_0x181a84){return db['CmHopperHistory']['create'](_0x1fd296[_0x9802('0x13')],{'raw':_0x1fd296[_0x9802('0x14')]?_0x1fd296[_0x9802('0x14')][_0x9802('0x15')]===undefined?!![]:![]:!![]})[_0x9802('0x9')](function(_0x567eed){logger[_0x9802('0x10')](_0x9802('0x12'),_0x1fd296);logger[_0x9802('0x16')](_0x9802('0x12'),_0x1fd296,JSON[_0x9802('0xc')](_0x567eed));_0xa753e(_0x567eed);})[_0x9802('0x11')](function(_0x36830d){logger[_0x9802('0xd')](_0x9802('0x12'),_0x36830d[_0x9802('0xf')],_0x1fd296);_0x181a84(_0x1b43f2[_0x9802('0xd')](0x1f4,_0x36830d['message']));});});};exports['AvgHandleTime']=function(_0x1163d6){var _0x5a695d=this;return new Promise(function(_0x43d624,_0x489a9d){return db[_0x9802('0x17')]['findAll']({'raw':_0x1163d6[_0x9802('0x14')]?_0x1163d6[_0x9802('0x14')][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x1163d6[_0x9802('0x14')]?_0x1163d6[_0x9802('0x14')]['where']||null:null,'attributes':[[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize'][_0x9802('0x1a')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x9802('0x18')]['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x1c')))),_0x9802('0x1d')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x1e')))),_0x9802('0x1f')],[db[_0x9802('0x18')]['fn'](_0x9802('0x20'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x9802('0x18')]['fn']('AVG',db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x21')))),'predictiveIntervalAvgTalktime']]})[_0x9802('0x9')](function(_0x47ad87){logger['info']('AvgHandleTime',_0x1163d6);logger[_0x9802('0x16')]('AvgHandleTime',_0x1163d6,JSON[_0x9802('0xc')](_0x47ad87));_0x43d624(_0x47ad87);})[_0x9802('0x11')](function(_0x172a3a){logger['error'](_0x9802('0x22'),_0x172a3a['message'],_0x1163d6);_0x489a9d(_0x5a695d[_0x9802('0xd')](0x1f4,_0x172a3a[_0x9802('0xf')]));});});};exports[_0x9802('0x23')]=function(_0x31ff13){var _0x1460e7=this;return new Promise(function(_0x49f6bd,_0x5423e1){return db['CmHopperHistory'][_0x9802('0x24')]({'raw':_0x31ff13[_0x9802('0x14')]?_0x31ff13['options'][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x31ff13[_0x9802('0x14')]?_0x31ff13[_0x9802('0x14')][_0x9802('0x25')]||null:null,'attributes':[['campaign','name'],[db[_0x9802('0x18')]['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x26')))),_0x9802('0x27')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x28')))),'outboundNoAnswerCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9802('0x29')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x9802('0x2a')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')]['literal'](_0x9802('0x2b')))),_0x9802('0x2c')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x2d')))),_0x9802('0x2e')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x2f')))),_0x9802('0x30')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x31')))),_0x9802('0x32')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x33')))),_0x9802('0x34')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x35')))),_0x9802('0x36')],[db[_0x9802('0x18')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x37')))),_0x9802('0x38')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x9802('0x39')]],'group':[_0x9802('0x3a')]})['then'](function(_0x178fdc){logger['info'](_0x9802('0x23'),_0x31ff13);logger[_0x9802('0x16')](_0x9802('0x23'),_0x31ff13,JSON[_0x9802('0xc')](_0x178fdc));_0x49f6bd(_0x178fdc);})[_0x9802('0x11')](function(_0x2e7571){logger[_0x9802('0xd')](_0x9802('0x23'),_0x2e7571['message'],_0x31ff13);_0x5423e1(_0x1460e7['error'](0x1f4,_0x2e7571[_0x9802('0xf')]));});});};exports[_0x9802('0x3b')]=function(_0x29c076){var _0x1a04dc=this;return new Promise(function(_0x2b0e9f,_0x5aa639){return db[_0x9802('0x17')][_0x9802('0x24')]({'raw':_0x29c076[_0x9802('0x14')]?_0x29c076['options'][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x29c076[_0x9802('0x14')]?_0x29c076[_0x9802('0x14')]['where']||null:null,'attributes':[[_0x9802('0x3a'),'name'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')][_0x9802('0x1a')]('id')),'ivrTotalCallsDays'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x3c')))),_0x9802('0x3d')]],'group':['campaign']})[_0x9802('0x9')](function(_0x2f6b26){logger[_0x9802('0x10')]('GetCampaignHopperHistory',_0x29c076);logger[_0x9802('0x16')](_0x9802('0x3b'),_0x29c076,JSON[_0x9802('0xc')](_0x2f6b26));_0x2b0e9f(_0x2f6b26);})[_0x9802('0x11')](function(_0x5e1fc3){logger[_0x9802('0xd')]('GetCampaignHopperHistory',_0x5e1fc3[_0x9802('0xf')],_0x29c076);_0x5aa639(_0x1a04dc[_0x9802('0xd')](0x1f4,_0x5e1fc3[_0x9802('0xf')]));});});}; \ No newline at end of file +var _0x8b30=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x8b30,0x1c7));var _0x08b3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8b30[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var moment=require(_0x08b3('0x2'));var BPromise=require(_0x08b3('0x3'));var rs=require(_0x08b3('0x4'));var fs=require('fs');var Redis=require(_0x08b3('0x5'));var db=require(_0x08b3('0x6'))['db'];var utils=require(_0x08b3('0x7'));var logger=require(_0x08b3('0x8'))(_0x08b3('0x9'));var config=require(_0x08b3('0xa'));var jayson=require(_0x08b3('0xb'));var client=jayson[_0x08b3('0xc')][_0x08b3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x58a962,_0x45e804,_0x25dc48){return new BPromise(function(_0x143c87,_0x36bb16){return client['request'](_0x58a962,_0x25dc48)['then'](function(_0x112936){logger[_0x08b3('0xe')](_0x08b3('0xf'),_0x45e804,_0x08b3('0x10'));logger[_0x08b3('0x11')](_0x08b3('0x12'),_0x45e804,_0x08b3('0x10'),JSON['stringify'](_0x112936));if(_0x112936[_0x08b3('0x13')]){if(_0x112936[_0x08b3('0x13')][_0x08b3('0x14')]===0x1f4){logger['error'](_0x08b3('0xf'),_0x45e804,_0x112936[_0x08b3('0x13')][_0x08b3('0x15')]);return _0x36bb16(_0x112936[_0x08b3('0x13')][_0x08b3('0x15')]);}logger[_0x08b3('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x45e804,_0x112936[_0x08b3('0x13')][_0x08b3('0x15')]);return _0x143c87(_0x112936[_0x08b3('0x13')][_0x08b3('0x15')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x45e804,_0x08b3('0x10'));_0x143c87(_0x112936[_0x08b3('0x16')][_0x08b3('0x15')]);}})[_0x08b3('0x17')](function(_0x24c8af){logger[_0x08b3('0x13')](_0x08b3('0xf'),_0x45e804,_0x24c8af);_0x36bb16(_0x24c8af);});});}exports[_0x08b3('0x18')]=function(_0x533ff0){var _0x2e7a56=this;return new Promise(function(_0x3e4b4c,_0x2824db){return db[_0x08b3('0x19')][_0x08b3('0x1a')](_0x533ff0[_0x08b3('0x1b')],{'raw':_0x533ff0[_0x08b3('0x1c')]?_0x533ff0[_0x08b3('0x1c')][_0x08b3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x10b0f2){logger['info']('CreateCmHopperHistory',_0x533ff0);logger[_0x08b3('0x11')](_0x08b3('0x18'),_0x533ff0,JSON['stringify'](_0x10b0f2));_0x3e4b4c(_0x10b0f2);})['catch'](function(_0x4fb865){logger[_0x08b3('0x13')](_0x08b3('0x18'),_0x4fb865[_0x08b3('0x15')],_0x533ff0);_0x2824db(_0x2e7a56[_0x08b3('0x13')](0x1f4,_0x4fb865[_0x08b3('0x15')]));});});};exports[_0x08b3('0x1e')]=function(_0x155fd7){var _0x15e584=this;return new Promise(function(_0x33e94d,_0x633d29){return db[_0x08b3('0x19')][_0x08b3('0x1f')]({'raw':_0x155fd7[_0x08b3('0x1c')]?_0x155fd7[_0x08b3('0x1c')][_0x08b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x155fd7[_0x08b3('0x1c')]?_0x155fd7[_0x08b3('0x1c')][_0x08b3('0x20')]||null:null,'attributes':[[db[_0x08b3('0x21')]['fn']('COUNT',db[_0x08b3('0x21')][_0x08b3('0x22')]('id')),_0x08b3('0x23')],[db['sequelize']['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x08b3('0x26')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db['sequelize'][_0x08b3('0x25')](_0x08b3('0x27')))),_0x08b3('0x28')],[db['sequelize']['fn']('COUNT',db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),_0x08b3('0x29')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x2a'),db['sequelize']['fn']('IF',db[_0x08b3('0x21')]['literal'](_0x08b3('0x2b')))),_0x08b3('0x2c')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x2a'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x2d')))),_0x08b3('0x2e')]]})['then'](function(_0x5efa63){logger[_0x08b3('0xe')](_0x08b3('0x1e'),_0x155fd7);logger[_0x08b3('0x11')](_0x08b3('0x1e'),_0x155fd7,JSON[_0x08b3('0x2f')](_0x5efa63));_0x33e94d(_0x5efa63);})[_0x08b3('0x17')](function(_0x28e55e){logger['error'](_0x08b3('0x1e'),_0x28e55e[_0x08b3('0x15')],_0x155fd7);_0x633d29(_0x15e584[_0x08b3('0x13')](0x1f4,_0x28e55e[_0x08b3('0x15')]));});});};exports[_0x08b3('0x30')]=function(_0x268d6e){var _0x163315=this;return new Promise(function(_0x2fdcaa,_0x4e9a28){return db[_0x08b3('0x19')][_0x08b3('0x1f')]({'raw':_0x268d6e['options']?_0x268d6e[_0x08b3('0x1c')][_0x08b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x268d6e['options']?_0x268d6e[_0x08b3('0x1c')][_0x08b3('0x20')]||null:null,'attributes':[[_0x08b3('0x31'),_0x08b3('0x32')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')]['literal'](_0x08b3('0x33')))),_0x08b3('0x34')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x35')))),_0x08b3('0x36')],[db[_0x08b3('0x21')]['fn']('COUNT',db[_0x08b3('0x21')]['fn']('IF',db['sequelize'][_0x08b3('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x37')))),_0x08b3('0x38')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')]['literal'](_0x08b3('0x39')))),_0x08b3('0x3a')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x3b')))),_0x08b3('0x3c')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x3d')))),_0x08b3('0x3e')],[db['sequelize']['fn']('COUNT',db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),_0x08b3('0x3f')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x40')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x08b3('0x41')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x42')))),_0x08b3('0x43')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db['sequelize']['fn']('IF',db[_0x08b3('0x21')]['literal'](_0x08b3('0x44')))),_0x08b3('0x45')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')]['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x08b3('0x43')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db['sequelize']['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')](_0x08b3('0x46')))),_0x08b3('0x47')]],'group':[_0x08b3('0x31')]})[_0x08b3('0x48')](function(_0x54044d){logger[_0x08b3('0xe')](_0x08b3('0x30'),_0x268d6e);logger[_0x08b3('0x11')](_0x08b3('0x30'),_0x268d6e,JSON[_0x08b3('0x2f')](_0x54044d));_0x2fdcaa(_0x54044d);})['catch'](function(_0x309558){logger[_0x08b3('0x13')](_0x08b3('0x30'),_0x309558[_0x08b3('0x15')],_0x268d6e);_0x4e9a28(_0x163315[_0x08b3('0x13')](0x1f4,_0x309558[_0x08b3('0x15')]));});});};exports[_0x08b3('0x49')]=function(_0x4582a9){var _0x1e0929=this;return new Promise(function(_0x584028,_0x4cedf1){return db[_0x08b3('0x19')][_0x08b3('0x1f')]({'raw':_0x4582a9[_0x08b3('0x1c')]?_0x4582a9[_0x08b3('0x1c')][_0x08b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x4582a9[_0x08b3('0x1c')]?_0x4582a9[_0x08b3('0x1c')][_0x08b3('0x20')]||null:null,'attributes':[[_0x08b3('0x31'),_0x08b3('0x32')],[db['sequelize']['fn'](_0x08b3('0x24'),db[_0x08b3('0x21')][_0x08b3('0x22')]('id')),_0x08b3('0x4a')],[db[_0x08b3('0x21')]['fn'](_0x08b3('0x24'),db['sequelize']['fn']('IF',db[_0x08b3('0x21')][_0x08b3('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x08b3('0x4b')]],'group':['campaign']})[_0x08b3('0x48')](function(_0x34458b){logger[_0x08b3('0xe')]('GetCampaignHopperHistory',_0x4582a9);logger[_0x08b3('0x11')](_0x08b3('0x49'),_0x4582a9,JSON[_0x08b3('0x2f')](_0x34458b));_0x584028(_0x34458b);})[_0x08b3('0x17')](function(_0x55fad1){logger[_0x08b3('0x13')](_0x08b3('0x49'),_0x55fad1[_0x08b3('0x15')],_0x4582a9);_0x4cedf1(_0x1e0929[_0x08b3('0x13')](0x1f4,_0x55fad1[_0x08b3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index cf44915..581b26d 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 _0x1348=['describe','/:id','post','isAuthenticated','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe'];(function(_0x52e9e3,_0x24d28f){var _0x22ee01=function(_0x4771a6){while(--_0x4771a6){_0x52e9e3['push'](_0x52e9e3['shift']());}};_0x22ee01(++_0x24d28f);}(_0x1348,0x183));var _0x8134=function(_0x3a6f48,_0x11f57d){_0x3a6f48=_0x3a6f48-0x0;var _0x3110a8=_0x1348[_0x3a6f48];return _0x3110a8;};'use strict';var multer=require(_0x8134('0x0'));var util=require(_0x8134('0x1'));var path=require(_0x8134('0x2'));var timeout=require(_0x8134('0x3'));var express=require(_0x8134('0x4'));var router=express[_0x8134('0x5')]();var fs_extra=require(_0x8134('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8134('0x7'));var config=require(_0x8134('0x8'));var controller=require(_0x8134('0x9'));router[_0x8134('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8134('0xa')](_0x8134('0xb'),auth['isAuthenticated'](),controller[_0x8134('0xc')]);router[_0x8134('0xa')](_0x8134('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8134('0xe')]('/',auth[_0x8134('0xf')](),controller[_0x8134('0x10')]);router[_0x8134('0x11')](_0x8134('0xd'),auth[_0x8134('0xf')](),controller[_0x8134('0x12')]);module['exports']=router; \ No newline at end of file +var _0xac53=['index','/describe','describe','/:id','post','create','put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x39097c,_0x481098){var _0x15cc0f=function(_0x4f3ef2){while(--_0x4f3ef2){_0x39097c['push'](_0x39097c['shift']());}};_0x15cc0f(++_0x481098);}(_0xac53,0x7a));var _0x3ac5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac53[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3ac5('0x0'));var util=require(_0x3ac5('0x1'));var path=require('path');var timeout=require(_0x3ac5('0x2'));var express=require('express');var router=express[_0x3ac5('0x3')]();var fs_extra=require(_0x3ac5('0x4'));var auth=require(_0x3ac5('0x5'));var interaction=require(_0x3ac5('0x6'));var config=require(_0x3ac5('0x7'));var controller=require(_0x3ac5('0x8'));router[_0x3ac5('0x9')]('/',auth[_0x3ac5('0xa')](),controller[_0x3ac5('0xb')]);router['get'](_0x3ac5('0xc'),auth['isAuthenticated'](),controller[_0x3ac5('0xd')]);router['get'](_0x3ac5('0xe'),auth[_0x3ac5('0xa')](),controller['show']);router[_0x3ac5('0xf')]('/',auth['isAuthenticated'](),controller[_0x3ac5('0x10')]);router[_0x3ac5('0x11')](_0x3ac5('0xe'),auth[_0x3ac5('0xa')](),controller['update']);module[_0x3ac5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index db2bb3e..a4dc69a 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 _0xb13b=['STRING','name','sequelize','exports'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xb13b,0x1de));var _0xbb13=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb13b[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0xbb13('0x0'));module[_0xbb13('0x1')]={'name':{'type':Sequelize[_0xbb13('0x2')],'unique':_0xbb13('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb13('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa8eb=['STRING','sequelize'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xa8eb,0x179));var _0xba8e=function(_0x5b6634,_0x36b678){_0x5b6634=_0x5b6634-0x0;var _0x1c8b3f=_0xa8eb[_0x5b6634];return _0x1c8b3f;};'use strict';var Sequelize=require(_0xba8e('0x0'));module['exports']={'name':{'type':Sequelize[_0xba8e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xba8e('0x1')]},'dialPrefix':{'type':Sequelize[_0xba8e('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index af69dfb..0e63b86 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 _0xd1ec=['getAgents','User','info','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','CmList','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','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','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','pick','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove'];(function(_0x115841,_0x401e20){var _0x29063c=function(_0x2988e9){while(--_0x2988e9){_0x115841['push'](_0x115841['shift']());}};_0x29063c(++_0x401e20);}(_0xd1ec,0x157));var _0xcd1e=function(_0x421510,_0x256346){_0x421510=_0x421510-0x0;var _0x12909d=_0xd1ec[_0x421510];return _0x12909d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd1e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd1e('0x1'));var moment=require(_0xcd1e('0x2'));var BPromise=require(_0xcd1e('0x3'));var Mustache=require(_0xcd1e('0x4'));var util=require(_0xcd1e('0x5'));var path=require(_0xcd1e('0x6'));var sox=require(_0xcd1e('0x7'));var csv=require('to-csv');var ejs=require(_0xcd1e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd1e('0x9'));var squel=require(_0xcd1e('0xa'));var crypto=require(_0xcd1e('0xb'));var jsforce=require(_0xcd1e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcd1e('0xd'));var Papa=require(_0xcd1e('0xe'));var Redis=require(_0xcd1e('0xf'));var authService=require(_0xcd1e('0x10'));var qs=require(_0xcd1e('0x11'));var as=require(_0xcd1e('0x12'));var hardwareService=require(_0xcd1e('0x13'));var logger=require(_0xcd1e('0x14'))(_0xcd1e('0x15'));var utils=require(_0xcd1e('0x16'));var config=require(_0xcd1e('0x17'));var licenseUtil=require(_0xcd1e('0x18'));var db=require(_0xcd1e('0x19'))['db'];var csv_results;config['redis']=_[_0xcd1e('0x1a')](config[_0xcd1e('0x1b')],{'host':_0xcd1e('0x1c'),'port':0x18eb});var socket=require(_0xcd1e('0x1d'))(new Redis(config[_0xcd1e('0x1b')]));require(_0xcd1e('0x1e'))['register'](socket);function respondWithStatusCode(_0x262f49,_0x2e9cc3){_0x2e9cc3=_0x2e9cc3||0xcc;return function(_0x53f878){if(_0x53f878){return _0x262f49[_0xcd1e('0x1f')](_0x2e9cc3);}return _0x262f49[_0xcd1e('0x20')](_0x2e9cc3)[_0xcd1e('0x21')]();};}function respondWithResult(_0x222014,_0x2ee5c4){_0x2ee5c4=_0x2ee5c4||0xc8;return function(_0x5e9174){if(_0x5e9174){return _0x222014[_0xcd1e('0x20')](_0x2ee5c4)['json'](_0x5e9174);}};}function respondWithFilteredResult(_0x5f5003,_0x7dfc3e){return function(_0x17223f){if(_0x17223f){var _0x52ec9a=typeof _0x7dfc3e[_0xcd1e('0x22')]===_0xcd1e('0x23')&&typeof _0x7dfc3e['limit']===_0xcd1e('0x23');var _0x15ba44=_0x17223f[_0xcd1e('0x24')];var _0x8212ac=_0x52ec9a?0x0:_0x7dfc3e[_0xcd1e('0x22')];var _0x581b6f=_0x52ec9a?_0x17223f['count']:_0x7dfc3e[_0xcd1e('0x22')]+_0x7dfc3e['limit'];var _0x37c0a5;if(_0x581b6f>=_0x15ba44){_0x581b6f=_0x15ba44;_0x37c0a5=0xc8;}else{_0x37c0a5=0xce;}_0x5f5003[_0xcd1e('0x20')](_0x37c0a5);return _0x5f5003[_0xcd1e('0x25')](_0xcd1e('0x26'),_0x8212ac+'-'+_0x581b6f+'/'+_0x15ba44)[_0xcd1e('0x27')](_0x17223f);}return null;};}function patchUpdates(_0x4b127e){return function(_0x45473d){try{jsonpatch[_0xcd1e('0x28')](_0x45473d,_0x4b127e,!![]);}catch(_0x42737a){return BPromise[_0xcd1e('0x29')](_0x42737a);}return _0x45473d['save']();};}function saveUpdates(_0x147920,_0x3366a8){return function(_0x339bed){if(_0x339bed){return _0x339bed[_0xcd1e('0x2a')](_0x147920)[_0xcd1e('0x2b')](function(_0x4950a8){return _0x4950a8;});}return null;};}function removeEntity(_0x360f43,_0x5a06cc){return function(_0x13dfc1){if(_0x13dfc1){return _0x13dfc1['destroy']()[_0xcd1e('0x2b')](function(){var _0x3edd52=_0x13dfc1['get']({'plain':!![]});var _0xb7b21e=_0xcd1e('0x2c');return db[_0xcd1e('0x2d')][_0xcd1e('0x2e')]({'where':{'type':_0xb7b21e,'resourceId':_0x3edd52['id']}})[_0xcd1e('0x2b')](function(){return _0x13dfc1;});})[_0xcd1e('0x2b')](function(){_0x360f43[_0xcd1e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34197c,_0x385ec0){return function(_0x40b745){if(!_0x40b745){_0x34197c[_0xcd1e('0x1f')](0x194);}return _0x40b745;};}function handleError(_0x5ee504,_0x4473a0){_0x4473a0=_0x4473a0||0x1f4;return function(_0x4b6479){logger[_0xcd1e('0x2f')](_0x4b6479[_0xcd1e('0x30')]);if(_0x4b6479[_0xcd1e('0x31')]){delete _0x4b6479[_0xcd1e('0x31')];}_0x5ee504[_0xcd1e('0x20')](_0x4473a0)[_0xcd1e('0x32')](_0x4b6479);};}exports[_0xcd1e('0x33')]=function(_0x2ebb0f,_0x3eb757){var _0x144789={},_0xfdf2a6={},_0x484bd2={'count':0x0,'rows':[]};var _0x400175=_[_0xcd1e('0x34')](db[_0xcd1e('0x35')]['rawAttributes'],function(_0xa77546){return{'name':_0xa77546['fieldName'],'type':_0xa77546[_0xcd1e('0x36')][_0xcd1e('0x37')]};});_0xfdf2a6[_0xcd1e('0x38')]=_[_0xcd1e('0x34')](_0x400175,_0xcd1e('0x31'));_0xfdf2a6['query']=_['keys'](_0x2ebb0f[_0xcd1e('0x39')]);_0xfdf2a6[_0xcd1e('0x3a')]=_[_0xcd1e('0x3b')](_0xfdf2a6[_0xcd1e('0x38')],_0xfdf2a6['query']);_0x144789[_0xcd1e('0x3c')]=_[_0xcd1e('0x3b')](_0xfdf2a6[_0xcd1e('0x38')],qs[_0xcd1e('0x3d')](_0x2ebb0f[_0xcd1e('0x39')][_0xcd1e('0x3d')]));_0x144789['attributes']=_0x144789[_0xcd1e('0x3c')][_0xcd1e('0x3e')]?_0x144789[_0xcd1e('0x3c')]:_0xfdf2a6[_0xcd1e('0x38')];if(!_0x2ebb0f['query'][_0xcd1e('0x3f')](_0xcd1e('0x40'))){_0x144789[_0xcd1e('0x41')]=qs[_0xcd1e('0x41')](_0x2ebb0f[_0xcd1e('0x39')][_0xcd1e('0x41')]);_0x144789[_0xcd1e('0x22')]=qs[_0xcd1e('0x22')](_0x2ebb0f[_0xcd1e('0x39')]['offset']);}_0x144789[_0xcd1e('0x42')]=qs[_0xcd1e('0x43')](_0x2ebb0f[_0xcd1e('0x39')]['sort']);_0x144789[_0xcd1e('0x44')]=qs['filters'](_['pick'](_0x2ebb0f[_0xcd1e('0x39')],_0xfdf2a6[_0xcd1e('0x3a')]),_0x400175);if(_0x2ebb0f[_0xcd1e('0x39')][_0xcd1e('0x45')]){_0x144789[_0xcd1e('0x44')]=_[_0xcd1e('0x46')](_0x144789['where'],{'$or':_[_0xcd1e('0x34')](_0x400175,function(_0x3afd8e){if(_0x3afd8e['type']!==_0xcd1e('0x47')){var _0x2dbd17={};_0x2dbd17[_0x3afd8e[_0xcd1e('0x31')]]={'$like':'%'+_0x2ebb0f[_0xcd1e('0x39')][_0xcd1e('0x45')]+'%'};return _0x2dbd17;}})});}_0x144789=_[_0xcd1e('0x46')]({},_0x144789,_0x2ebb0f[_0xcd1e('0x48')]);var _0x22cb23={'where':_0x144789[_0xcd1e('0x44')]};return db['CmList'][_0xcd1e('0x24')](_0x22cb23)['then'](function(_0x1fdf8f){_0x484bd2[_0xcd1e('0x24')]=_0x1fdf8f;if(_0x2ebb0f[_0xcd1e('0x39')][_0xcd1e('0x49')]){_0x144789['include']=[{'all':!![]}];}return db['CmList'][_0xcd1e('0x4a')](_0x144789);})[_0xcd1e('0x2b')](function(_0x3dc47e){_0x484bd2[_0xcd1e('0x4b')]=_0x3dc47e;return _0x484bd2;})[_0xcd1e('0x2b')](respondWithFilteredResult(_0x3eb757,_0x144789))[_0xcd1e('0x4c')](handleError(_0x3eb757,null));};exports[_0xcd1e('0x4d')]=function(_0x2b10e3,_0x17c444){var _0x1e13d5={'raw':![],'where':{'id':_0x2b10e3[_0xcd1e('0x4e')]['id']}},_0x39c389={};_0x39c389[_0xcd1e('0x38')]=_[_0xcd1e('0x4f')](db[_0xcd1e('0x35')]['rawAttributes']);_0x39c389['query']=_[_0xcd1e('0x4f')](_0x2b10e3['query']);_0x39c389['filters']=_[_0xcd1e('0x3b')](_0x39c389['model'],_0x39c389[_0xcd1e('0x39')]);_0x1e13d5[_0xcd1e('0x3c')]=_[_0xcd1e('0x3b')](_0x39c389[_0xcd1e('0x38')],qs[_0xcd1e('0x3d')](_0x2b10e3[_0xcd1e('0x39')][_0xcd1e('0x3d')]));_0x1e13d5[_0xcd1e('0x3c')]=_0x1e13d5[_0xcd1e('0x3c')][_0xcd1e('0x3e')]?_0x1e13d5['attributes']:_0x39c389[_0xcd1e('0x38')];if(_0x2b10e3[_0xcd1e('0x39')][_0xcd1e('0x49')]){_0x1e13d5[_0xcd1e('0x50')]=[{'all':!![]}];}_0x1e13d5=_[_0xcd1e('0x46')]({},_0x1e13d5,_0x2b10e3['options']);return db[_0xcd1e('0x35')][_0xcd1e('0x51')](_0x1e13d5)[_0xcd1e('0x2b')](handleEntityNotFound(_0x17c444,null))[_0xcd1e('0x2b')](respondWithResult(_0x17c444,null))[_0xcd1e('0x4c')](handleError(_0x17c444,null));};exports[_0xcd1e('0x52')]=function(_0x4fa36b,_0x4934fc){return db[_0xcd1e('0x35')]['create'](_0x4fa36b[_0xcd1e('0x53')],{})['then'](function(_0x86ab7a){var _0x53a11a=_0x4fa36b[_0xcd1e('0x54')][_0xcd1e('0x55')]({'plain':!![]});if(!_0x53a11a)throw new Error(_0xcd1e('0x56'));if(_0x53a11a['role']===_0xcd1e('0x54')){var _0x428548=_0x86ab7a[_0xcd1e('0x55')]({'plain':!![]});var _0x355a8e='Lists';return db[_0xcd1e('0x57')][_0xcd1e('0x51')]({'where':{'name':_0x355a8e,'userProfileId':_0x53a11a[_0xcd1e('0x58')]},'raw':!![]})[_0xcd1e('0x2b')](function(_0x381193){if(_0x381193&&_0x381193[_0xcd1e('0x59')]===0x0){return db['UserProfileResource'][_0xcd1e('0x52')]({'name':_0x428548[_0xcd1e('0x31')],'resourceId':_0x428548['id'],'type':_0x381193[_0xcd1e('0x31')],'sectionId':_0x381193['id']},{})['then'](function(){return _0x86ab7a;});}else{return _0x86ab7a;}})[_0xcd1e('0x4c')](function(_0x3284cf){logger[_0xcd1e('0x2f')](_0xcd1e('0x5a'),_0x3284cf);throw _0x3284cf;});}return _0x86ab7a;})['then'](respondWithResult(_0x4934fc,0xc9))[_0xcd1e('0x4c')](handleError(_0x4934fc,null));};exports['update']=function(_0x5c42cd,_0xc9ba3d){if(_0x5c42cd[_0xcd1e('0x53')]['id']){delete _0x5c42cd[_0xcd1e('0x53')]['id'];}return db[_0xcd1e('0x35')][_0xcd1e('0x51')]({'where':{'id':_0x5c42cd[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0xc9ba3d,null))[_0xcd1e('0x2b')](saveUpdates(_0x5c42cd['body'],null))[_0xcd1e('0x2b')](respondWithResult(_0xc9ba3d,null))['catch'](handleError(_0xc9ba3d,null));};exports[_0xcd1e('0x2e')]=function(_0x1a0c61,_0x37bf36){return db['CmList'][_0xcd1e('0x51')]({'where':{'id':_0x1a0c61[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x37bf36,null))['then'](removeEntity(_0x37bf36,null))[_0xcd1e('0x4c')](handleError(_0x37bf36,null));};exports[_0xcd1e('0x5b')]=function(_0x18d2b1,_0x13b873){return db[_0xcd1e('0x35')][_0xcd1e('0x5b')]()[_0xcd1e('0x2b')](respondWithResult(_0x13b873,null))[_0xcd1e('0x4c')](handleError(_0x13b873,null));};exports[_0xcd1e('0x5c')]=function(_0xa8419d,_0x1e862e,_0x59d73d){if(_0xa8419d[_0xcd1e('0x53')]['id']){delete _0xa8419d[_0xcd1e('0x53')]['id'];}return db[_0xcd1e('0x35')]['find']({'where':{'id':_0xa8419d[_0xcd1e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e862e,null))[_0xcd1e('0x2b')](function(_0x557260){if(_0x557260){_0xa8419d[_0xcd1e('0x53')][_0xcd1e('0x5d')]=_0x557260['id'];return db[_0xcd1e('0x5e')][_0xcd1e('0x52')](_0xa8419d[_0xcd1e('0x53')]);}})['then'](respondWithResult(_0x1e862e,null))[_0xcd1e('0x4c')](handleError(_0x1e862e,null));};exports[_0xcd1e('0x5f')]=function(_0x22ca3d,_0x4ba122,_0x457390){var _0x59fe10={'raw':![],'where':{}};var _0x456504={};var _0x5f42d9={'count':0x0,'rows':[]};return db[_0xcd1e('0x35')][_0xcd1e('0x60')]({'where':{'id':_0x22ca3d[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x4ba122,null))[_0xcd1e('0x2b')](function(_0x4654fc){if(_0x4654fc){_0x456504[_0xcd1e('0x38')]=_[_0xcd1e('0x4f')](db[_0xcd1e('0x5e')][_0xcd1e('0x61')]);_0x456504[_0xcd1e('0x39')]=_[_0xcd1e('0x4f')](_0x22ca3d[_0xcd1e('0x39')]);_0x456504['filters']=_[_0xcd1e('0x3b')](_0x456504[_0xcd1e('0x38')],_0x456504[_0xcd1e('0x39')]);_0x59fe10[_0xcd1e('0x3c')]=_[_0xcd1e('0x3b')](_0x456504[_0xcd1e('0x38')],qs[_0xcd1e('0x3d')](_0x22ca3d[_0xcd1e('0x39')][_0xcd1e('0x3d')]));_0x59fe10[_0xcd1e('0x3c')]=_0x59fe10[_0xcd1e('0x3c')][_0xcd1e('0x3e')]?_0x59fe10['attributes']:_0x456504[_0xcd1e('0x38')];if(!_0x22ca3d['query'][_0xcd1e('0x3f')](_0xcd1e('0x40'))){_0x59fe10[_0xcd1e('0x41')]=qs[_0xcd1e('0x41')](_0x22ca3d[_0xcd1e('0x39')][_0xcd1e('0x41')]);_0x59fe10[_0xcd1e('0x22')]=qs[_0xcd1e('0x22')](_0x22ca3d[_0xcd1e('0x39')][_0xcd1e('0x22')]);}_0x59fe10[_0xcd1e('0x42')]=qs['sort'](_0x22ca3d[_0xcd1e('0x39')][_0xcd1e('0x43')]);_0x59fe10[_0xcd1e('0x44')]=qs[_0xcd1e('0x3a')](_['pick'](_0x22ca3d[_0xcd1e('0x39')],_0x456504['filters']));_0x59fe10[_0xcd1e('0x44')][_0xcd1e('0x5d')]=_0x4654fc['id'];if(_0x22ca3d['query'][_0xcd1e('0x45')]){_0x59fe10[_0xcd1e('0x44')]=_[_0xcd1e('0x46')](_0x59fe10[_0xcd1e('0x44')],{'$or':_[_0xcd1e('0x34')](_0x59fe10[_0xcd1e('0x3c')],function(_0xc7174f){var _0x55bb25={};_0x55bb25[_0xc7174f]={'$like':'%'+_0x22ca3d[_0xcd1e('0x39')]['filter']+'%'};return _0x55bb25;})});}_0x59fe10=_[_0xcd1e('0x46')]({},_0x59fe10,_0x22ca3d['options']);return db[_0xcd1e('0x5e')][_0xcd1e('0x24')]({'where':_0x59fe10[_0xcd1e('0x44')]})[_0xcd1e('0x2b')](function(_0x22b57d){_0x5f42d9[_0xcd1e('0x24')]=_0x22b57d;if(_0x22ca3d['query']['includeAll']){_0x59fe10['include']=[{'all':!![]}];}return db[_0xcd1e('0x5e')]['findAll'](_0x59fe10);})['then'](function(_0x4b8bb9){_0x5f42d9['rows']=_0x4b8bb9;return _0x5f42d9;});}})[_0xcd1e('0x2b')](respondWithFilteredResult(_0x4ba122,_0x59fe10))[_0xcd1e('0x4c')](handleError(_0x4ba122,null));};exports[_0xcd1e('0x62')]=function(_0x412f88,_0x2c33fb,_0x3f871e){return db[_0xcd1e('0x35')][_0xcd1e('0x51')]({'where':{'id':_0x412f88['params']['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x2c33fb,null))[_0xcd1e('0x2b')](function(_0x102a4d){if(_0x102a4d){return _0x102a4d['removeDispositions'](_0x412f88[_0xcd1e('0x39')][_0xcd1e('0x63')]);}})['then'](respondWithStatusCode(_0x2c33fb,null))[_0xcd1e('0x4c')](handleError(_0x2c33fb,null));};exports[_0xcd1e('0x64')]=function(_0x3c027f,_0x2f4857,_0xd4f787){return db[_0xcd1e('0x35')]['find']({'where':{'id':_0x3c027f[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x2f4857,null))['then'](function(_0x1927cd){if(_0x1927cd){var _0x311976=[];var _0x4097be={'success':[],'errors':[]};return db[_0xcd1e('0x65')][_0xcd1e('0x5b')]()[_0xcd1e('0x2b')](function(_0x2a13f2){if(_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x66')]&&_[_0xcd1e('0x67')](_0x3c027f[_0xcd1e('0x53')]['tags'])){if(_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x66')]['length']){_0x3c027f[_0xcd1e('0x53')]['tags']=_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x66')][_0xcd1e('0x68')](';')+';';}else{_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x66')]=null;}}else{_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x66')]=null;}if(_0x3c027f[_0xcd1e('0x53')]&&_[_0xcd1e('0x67')](_0x3c027f[_0xcd1e('0x53')])){for(var _0x17a6ba=0x0;_0x17a6ba<_0x3c027f[_0xcd1e('0x53')][_0xcd1e('0x3e')];_0x17a6ba+=0x1){_0x3c027f[_0xcd1e('0x53')][_0x17a6ba]['ListId']=_0x3c027f['params']['id'];_0x311976[_0xcd1e('0x69')](_0x3c027f[_0xcd1e('0x53')][_0x17a6ba]);}return BPromise[_0xcd1e('0x6a')](_0x311976,function(_0x21764b){return db['CmContact']['create'](_[_0xcd1e('0x6b')](_0x21764b,[_0xcd1e('0x63'),'id'])||{},{'fields':_[_0xcd1e('0x4f')](_0x2a13f2),'raw':!![]})[_0xcd1e('0x2b')](function(_0x39cc68){_0x4097be[_0xcd1e('0x6c')]['push'](_0x39cc68[_0xcd1e('0x6d')]);})[_0xcd1e('0x4c')](function(_0x16fddf){_0x4097be[_0xcd1e('0x6e')]['push']({'data':_0x21764b,'error':_0x16fddf['message']});});})[_0xcd1e('0x2b')](function(_0x5186df){return _0x4097be;})['catch'](function(_0x3a02ab){return _0x3a02ab;});}else{_0x2f4857[_0xcd1e('0x20')](0x190)[_0xcd1e('0x27')]({'message':_0xcd1e('0x6f')});}});}})['then'](respondWithResult(_0x2f4857,null))[_0xcd1e('0x4c')](handleError(_0x2f4857,null));};exports[_0xcd1e('0x70')]=function(_0x2586a7,_0x552f2f,_0x56b9b7){var _0x375e6a;return db[_0xcd1e('0x35')]['find']({'where':{'id':_0x2586a7[_0xcd1e('0x4e')]['id']},'include':[{'model':db[_0xcd1e('0x71')],'as':_0xcd1e('0x72')}]})[_0xcd1e('0x2b')](handleEntityNotFound(_0x552f2f,null))[_0xcd1e('0x2b')](function(_0x14211d){if(_0x14211d){_0x375e6a=_0x14211d;return db[_0xcd1e('0x65')][_0xcd1e('0x61')];}})[_0xcd1e('0x2b')](function(_0x5f4d4f){if(_0x5f4d4f){var _0x2e6e91={};var _0x4c86c7={};_0x4c86c7[_0xcd1e('0x38')]=_[_0xcd1e('0x73')](_[_0xcd1e('0x4f')](_0x5f4d4f),_[_0xcd1e('0x34')](_0x375e6a[_0xcd1e('0x72')],function(_0x44698e){return util[_0xcd1e('0x74')](_0xcd1e('0x75'),_0x44698e['id']);}));_0x4c86c7[_0xcd1e('0x39')]=_[_0xcd1e('0x4f')](_0x2586a7[_0xcd1e('0x39')]);_0x4c86c7[_0xcd1e('0x3a')]=_[_0xcd1e('0x3b')](_0x4c86c7[_0xcd1e('0x38')],_0x4c86c7['query']);_0x2e6e91[_0xcd1e('0x3c')]=_[_0xcd1e('0x3b')](_0x4c86c7[_0xcd1e('0x38')],qs['fields'](_0x2586a7[_0xcd1e('0x39')][_0xcd1e('0x3d')]));_0x2e6e91['attributes']=_0x2e6e91[_0xcd1e('0x3c')][_0xcd1e('0x3e')]?_0x2e6e91[_0xcd1e('0x3c')]:_0x4c86c7[_0xcd1e('0x38')];if(!_0x2586a7[_0xcd1e('0x39')]['hasOwnProperty'](_0xcd1e('0x40'))){_0x2e6e91[_0xcd1e('0x41')]=qs[_0xcd1e('0x41')](_0x2586a7[_0xcd1e('0x39')][_0xcd1e('0x41')]);_0x2e6e91['offset']=qs['offset'](_0x2586a7[_0xcd1e('0x39')][_0xcd1e('0x22')]);}_0x2e6e91['order']=qs[_0xcd1e('0x43')](_0x2586a7[_0xcd1e('0x39')]['sort']);_0x2e6e91['where']=qs[_0xcd1e('0x3a')](_[_0xcd1e('0x76')](_0x2586a7[_0xcd1e('0x39')],_0x4c86c7['filters']));_0x2e6e91[_0xcd1e('0x77')]=!![];if(_0x2586a7[_0xcd1e('0x39')]['filter']){_0x2e6e91['where']=_['merge'](_0x2e6e91[_0xcd1e('0x44')],{'$or':_['map'](_0x2e6e91[_0xcd1e('0x3c')],function(_0x1db287){var _0x1419f5={};_0x1419f5[_0x1db287]={'$like':'%'+_0x2586a7[_0xcd1e('0x39')][_0xcd1e('0x45')]+'%'};return _0x1419f5;})});}_0x2e6e91=_['merge']({},_0x2e6e91,_0x2586a7[_0xcd1e('0x48')]);return _0x375e6a['getContacts'](_0x2e6e91);}})['then'](respondWithResult(_0x552f2f,null))[_0xcd1e('0x4c')](handleError(_0x552f2f,null));};exports[_0xcd1e('0x78')]=function(_0x126640,_0x13c83e,_0x1a3cd0){var _0x403406;var _0x4edf0c;var _0x1f00ff;var _0x3a0348=_0x126640['params']['id'];csv_results=[];return db[_0xcd1e('0x79')][_0xcd1e('0x4a')]({'attributes':['id',_0xcd1e('0x31')],'raw':!![],'order':[_0xcd1e('0x7a')]})[_0xcd1e('0x2b')](function(_0x47f290){_0x403406=_0x47f290;var _0x344c04=_[_0xcd1e('0x4f')](db[_0xcd1e('0x65')]['rawAttributes']);return db[_0xcd1e('0x71')]['findAll']({'raw':!![],'attributes':['id',_0xcd1e('0x7b')]})['then'](function(_0x145901){_0x4edf0c=_0x145901;var _0x213145=squel[_0xcd1e('0x7c')]()[_0xcd1e('0x3d')](_0x344c04)['from'](_0xcd1e('0x7d'),'c')[_0xcd1e('0x44')](_0xcd1e('0x7e'),_0x3a0348)[_0xcd1e('0x44')](_0xcd1e('0x7f'))['distinct']();for(var _0x1d6ad5=0x0;_0x1d6ad5<_0x4edf0c[_0xcd1e('0x3e')];_0x1d6ad5++){_0x213145[_0xcd1e('0x80')](_0xcd1e('0x81')+_0x4edf0c[_0x1d6ad5]['id'],_0xcd1e('0x82')+_0x4edf0c[_0x1d6ad5][_0xcd1e('0x7b')]);}for(var _0x1d6ad5=0x0;_0x1d6ad5<_0x403406[_0xcd1e('0x3e')];_0x1d6ad5++){_0x213145[_0xcd1e('0x80')](squel['select']()[_0xcd1e('0x80')](_0xcd1e('0x83'))[_0xcd1e('0x84')](_0xcd1e('0x85'))['where'](_0xcd1e('0x86'),_0x403406[_0x1d6ad5]['id'])[_0xcd1e('0x44')](_0xcd1e('0x87')),_0xcd1e('0x88')+_0x403406[_0x1d6ad5][_0xcd1e('0x31')]);_0x213145[_0xcd1e('0x80')](squel[_0xcd1e('0x7c')]()[_0xcd1e('0x80')](_0xcd1e('0x89'))[_0xcd1e('0x84')](_0xcd1e('0x85'))[_0xcd1e('0x44')](_0xcd1e('0x86'),_0x403406[_0x1d6ad5]['id'])['where'](_0xcd1e('0x87')),'description_additionalPhone_'+_0x403406[_0x1d6ad5][_0xcd1e('0x31')]);}var _0x5c25b1=[];_0x5c25b1['push'](_0x213145[_0xcd1e('0x8a')]());BPromise['each'](_0x5c25b1,handleQuery)[_0xcd1e('0x2b')](function(_0x1252aa){handleQuery(_0x213145['toString']());var _0x15d6cc=csv_results[0x0];if(!_[_0xcd1e('0x8b')](_0x15d6cc)){var _0x2cb630=toCsv(_0x15d6cc);var _0x598ec0=Date['now']();fs[_0xcd1e('0x8c')](util[_0xcd1e('0x74')](_0xcd1e('0x8d'),_0x3a0348,_0x598ec0),_0x2cb630);_0x13c83e['setHeader'](_0xcd1e('0x8e'),_0xcd1e('0x8f')+util[_0xcd1e('0x74')]('list_%d_%s.csv',_0x3a0348,_0x598ec0));_0x13c83e[_0xcd1e('0x90')]('Content-type','text/csv');return _0x13c83e[_0xcd1e('0x91')](util[_0xcd1e('0x74')](_0xcd1e('0x8d'),_0x3a0348,_0x598ec0));}else{return _0x13c83e[_0xcd1e('0x1f')](0xcc);}});});});};exports[_0xcd1e('0x92')]=function(_0x234405,_0x137543,_0x54651e){var _0x5bb040;delete _0x234405[_0xcd1e('0x53')]['id'];return db[_0xcd1e('0x35')][_0xcd1e('0x60')]({'where':{'id':_0x234405[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x137543,null))[_0xcd1e('0x2b')](function(_0x12af83){if(_0x12af83){return db[_0xcd1e('0x93')][_0xcd1e('0x94')](function(_0x48f368){return db[_0xcd1e('0x71')][_0xcd1e('0x52')](_0x234405[_0xcd1e('0x53')],{'transaction':_0x48f368})['then'](function(_0x191e86){_0x5bb040=_0x191e86;return _0x12af83[_0xcd1e('0x95')](_0x191e86,{'transaction':_0x48f368});})['then'](function(){var _0x226589={'type':db[_0xcd1e('0x96')]['TEXT'],'transaction':_0x48f368};switch(_0x234405[_0xcd1e('0x53')][_0xcd1e('0x36')]){case'text':_0x226589['type']=db['Sequelize'][_0xcd1e('0x97')];break;case _0xcd1e('0x98'):_0x226589[_0xcd1e('0x36')]=db[_0xcd1e('0x96')][_0xcd1e('0x99')];break;case _0xcd1e('0x9a'):_0x226589[_0xcd1e('0x36')]=db['Sequelize'][_0xcd1e('0x9b')];_0x226589[_0xcd1e('0x9c')]=![];break;default:}return db[_0xcd1e('0x93')][_0xcd1e('0x9d')]['addColumn'](_0xcd1e('0x7d'),util[_0xcd1e('0x74')](_0xcd1e('0x9e'),_0x5bb040['id']),_0x226589);})[_0xcd1e('0x2b')](function(){return _0x5bb040;});});}})['then'](respondWithResult(_0x137543,null))['catch'](handleError(_0x137543,null));};exports['getCustomFields']=function(_0x4940db,_0x219ec6,_0x2c5031){var _0x35abaa={};var _0x376cc2={};var _0x19fbc9;var _0x44c49c;return db['CmList'][_0xcd1e('0x60')]({'where':{'id':_0x4940db[_0xcd1e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x219ec6,null))[_0xcd1e('0x2b')](function(_0x5b0559){if(_0x5b0559){_0x19fbc9=_0x5b0559;_0x376cc2['model']=_[_0xcd1e('0x4f')](db[_0xcd1e('0x71')][_0xcd1e('0x61')]);_0x376cc2[_0xcd1e('0x39')]=_[_0xcd1e('0x4f')](_0x4940db['query']);_0x376cc2[_0xcd1e('0x3a')]=_['intersection'](_0x376cc2[_0xcd1e('0x38')],_0x376cc2[_0xcd1e('0x39')]);_0x35abaa[_0xcd1e('0x3c')]=_[_0xcd1e('0x3b')](_0x376cc2[_0xcd1e('0x38')],qs[_0xcd1e('0x3d')](_0x4940db[_0xcd1e('0x39')]['fields']));_0x35abaa[_0xcd1e('0x3c')]=_0x35abaa[_0xcd1e('0x3c')]['length']?_0x35abaa[_0xcd1e('0x3c')]:_0x376cc2[_0xcd1e('0x38')];_0x35abaa[_0xcd1e('0x42')]=qs[_0xcd1e('0x43')](_0x4940db['query'][_0xcd1e('0x43')]);_0x35abaa[_0xcd1e('0x44')]=qs[_0xcd1e('0x3a')](_[_0xcd1e('0x76')](_0x4940db[_0xcd1e('0x39')],_0x376cc2['filters']));_0x35abaa['where']=_[_0xcd1e('0x46')](_0x35abaa['where'],{'$or':[{'ListId':_0x5b0559['id']},{'ListId':null}]});if(_0x4940db[_0xcd1e('0x39')][_0xcd1e('0x45')]){_0x35abaa[_0xcd1e('0x44')]=_[_0xcd1e('0x46')](_0x35abaa[_0xcd1e('0x44')],{'$or':_[_0xcd1e('0x34')](_0x35abaa[_0xcd1e('0x3c')],function(_0x8aa7c3){var _0x44eaf7={};_0x44eaf7[_0x8aa7c3]={'$like':'%'+_0x4940db['query'][_0xcd1e('0x45')]+'%'};return _0x44eaf7;})});}_0x35abaa=_[_0xcd1e('0x46')]({},_0x35abaa,_0x4940db[_0xcd1e('0x48')]);return db[_0xcd1e('0x71')][_0xcd1e('0x9f')](_0x35abaa);}})[_0xcd1e('0x2b')](respondWithResult(_0x219ec6,null))[_0xcd1e('0x4c')](handleError(_0x219ec6,null));};exports[_0xcd1e('0xa0')]=function(_0x5760af,_0x911f6){return db[_0xcd1e('0x71')][_0xcd1e('0x9f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x911f6,null))[_0xcd1e('0x2b')](function(_0x1b9e48){return _0x1b9e48;})['then'](respondWithResult(_0x911f6,null))[_0xcd1e('0x4c')](handleError(_0x911f6,null));};exports[_0xcd1e('0xa1')]=function(_0x4eac23,_0x56d53d,_0x484988){return db['CmList'][_0xcd1e('0x51')]({'where':{'id':_0x4eac23[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x56d53d,null))[_0xcd1e('0x2b')](function(_0x5628c1){if(_0x5628c1){return _0x5628c1[_0xcd1e('0xa1')](_0x4eac23[_0xcd1e('0x53')][_0xcd1e('0x63')],_[_0xcd1e('0x6b')](_0x4eac23[_0xcd1e('0x53')],[_0xcd1e('0x63'),'id'])||{})[_0xcd1e('0xa2')](function(_0x3e6248){for(var _0x43fb04=0x0;_0x43fb04<_0x4eac23[_0xcd1e('0x53')][_0xcd1e('0x63')]['length'];_0x43fb04+=0x1){socket[_0xcd1e('0xa3')](_0xcd1e('0xa4'),{'UserId':Number(_0x4eac23[_0xcd1e('0x53')][_0xcd1e('0x63')][_0x43fb04]),'CmListId':Number(_0x4eac23[_0xcd1e('0x4e')]['id'])});}return _0x3e6248;});}})['then'](respondWithResult(_0x56d53d,null))[_0xcd1e('0x4c')](handleError(_0x56d53d,null));};exports[_0xcd1e('0xa5')]=function(_0x11c2ab,_0x2f9fdf,_0xe10f66){return db[_0xcd1e('0x35')][_0xcd1e('0x51')]({'where':{'id':_0x11c2ab['params']['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x2f9fdf,null))[_0xcd1e('0x2b')](function(_0x5bbca1){if(_0x5bbca1){return _0x5bbca1['removeAgents'](_0x11c2ab[_0xcd1e('0x39')]['ids'])[_0xcd1e('0x2b')](function(){if(_[_0xcd1e('0x67')](_0x11c2ab[_0xcd1e('0x39')][_0xcd1e('0x63')])){for(var _0x8cc7ff=0x0;_0x8cc7ff<_0x11c2ab[_0xcd1e('0x39')][_0xcd1e('0x63')]['length'];_0x8cc7ff+=0x1){socket[_0xcd1e('0xa3')]('userCmList:remove',{'UserId':Number(_0x11c2ab['query'][_0xcd1e('0x63')][_0x8cc7ff]),'CmListId':Number(_0x11c2ab['params']['id'])});}}else{socket[_0xcd1e('0xa3')](_0xcd1e('0xa6'),{'UserId':Number(_0x11c2ab[_0xcd1e('0x39')][_0xcd1e('0x63')]),'CmListId':Number(_0x11c2ab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2f9fdf,null))['catch'](handleError(_0x2f9fdf,null));};exports[_0xcd1e('0xa7')]=function(_0x1fa806,_0x288683,_0x1bc0a5){var _0x463094={};var _0x47dd00={};var _0x4311e2;var _0x4fde51;return db[_0xcd1e('0x35')][_0xcd1e('0x60')]({'where':{'id':_0x1fa806[_0xcd1e('0x4e')]['id']}})[_0xcd1e('0x2b')](handleEntityNotFound(_0x288683,null))[_0xcd1e('0x2b')](function(_0x58bedd){if(_0x58bedd){_0x4311e2=_0x58bedd;_0x47dd00[_0xcd1e('0x38')]=_[_0xcd1e('0x4f')](db[_0xcd1e('0xa8')][_0xcd1e('0x61')]);_0x47dd00['query']=_[_0xcd1e('0x4f')](_0x1fa806[_0xcd1e('0x39')]);_0x47dd00[_0xcd1e('0x3a')]=_[_0xcd1e('0x3b')](_0x47dd00['model'],_0x47dd00[_0xcd1e('0x39')]);_0x463094['attributes']=_[_0xcd1e('0x3b')](_0x47dd00['model'],qs['fields'](_0x1fa806[_0xcd1e('0x39')]['fields']));_0x463094['attributes']=_0x463094[_0xcd1e('0x3c')]['length']?_0x463094[_0xcd1e('0x3c')]:_0x47dd00['model'];_0x463094[_0xcd1e('0x42')]=qs[_0xcd1e('0x43')](_0x1fa806[_0xcd1e('0x39')][_0xcd1e('0x43')]);_0x463094[_0xcd1e('0x44')]=qs['filters'](_[_0xcd1e('0x76')](_0x1fa806[_0xcd1e('0x39')],_0x47dd00['filters']));if(_0x1fa806[_0xcd1e('0x39')]['filter']){_0x463094[_0xcd1e('0x44')]=_[_0xcd1e('0x46')](_0x463094[_0xcd1e('0x44')],{'$or':_[_0xcd1e('0x34')](_0x463094['attributes'],function(_0xd11c82){var _0x50f05a={};_0x50f05a[_0xd11c82]={'$like':'%'+_0x1fa806[_0xcd1e('0x39')][_0xcd1e('0x45')]+'%'};return _0x50f05a;})});}_0x463094=_[_0xcd1e('0x46')]({},_0x463094,_0x1fa806[_0xcd1e('0x48')]);return _0x4311e2[_0xcd1e('0xa7')](_0x463094);}})[_0xcd1e('0x2b')](function(_0x460aa4){if(_0x460aa4){_0x4fde51=_0x460aa4[_0xcd1e('0x3e')];if(!_0x1fa806[_0xcd1e('0x39')]['hasOwnProperty'](_0xcd1e('0x40'))){_0x463094[_0xcd1e('0x41')]=qs[_0xcd1e('0x41')](_0x1fa806[_0xcd1e('0x39')][_0xcd1e('0x41')]);_0x463094[_0xcd1e('0x22')]=qs['offset'](_0x1fa806[_0xcd1e('0x39')][_0xcd1e('0x22')]);}return _0x4311e2[_0xcd1e('0xa7')](_0x463094);}})[_0xcd1e('0x2b')](function(_0x48b358){if(_0x48b358){return _0x48b358?{'count':_0x4fde51,'rows':_0x48b358}:null;}})[_0xcd1e('0x2b')](respondWithResult(_0x288683,null))[_0xcd1e('0x4c')](handleError(_0x288683,null));};function handleQuery(_0x34222e){logger[_0xcd1e('0xa9')](_0x34222e);return db[_0xcd1e('0x93')][_0xcd1e('0x39')](_0x34222e)['spread'](function(_0x47bc36){csv_results[_0xcd1e('0x69')](_0x47bc36);})[_0xcd1e('0x4c')](function(_0x1039a9){logger[_0xcd1e('0x2f')](_0x1039a9['message']);});} \ No newline at end of file +var _0xfc94=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','nolimit','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','raw','getContacts','getContactsCsv','findAll','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','spread','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','keys','rawAttributes','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfc94,0xf2));var _0x4fc9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xfc94[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0x4fc9('0x0'));var rimraf=require(_0x4fc9('0x1'));var zipdir=require(_0x4fc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fc9('0x3'));var moment=require(_0x4fc9('0x4'));var BPromise=require(_0x4fc9('0x5'));var Mustache=require('mustache');var util=require(_0x4fc9('0x6'));var path=require('path');var sox=require(_0x4fc9('0x7'));var csv=require(_0x4fc9('0x8'));var ejs=require(_0x4fc9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fc9('0xa'));var _=require(_0x4fc9('0xb'));var squel=require(_0x4fc9('0xc'));var crypto=require(_0x4fc9('0xd'));var jsforce=require(_0x4fc9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4fc9('0xf'));var Papa=require(_0x4fc9('0x10'));var Redis=require(_0x4fc9('0x11'));var authService=require(_0x4fc9('0x12'));var qs=require(_0x4fc9('0x13'));var as=require(_0x4fc9('0x14'));var hardwareService=require(_0x4fc9('0x15'));var logger=require(_0x4fc9('0x16'))(_0x4fc9('0x17'));var utils=require('../../config/utils');var config=require(_0x4fc9('0x18'));var licenseUtil=require(_0x4fc9('0x19'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x4fc9('0x1a')]=_[_0x4fc9('0x1b')](config[_0x4fc9('0x1a')],{'host':_0x4fc9('0x1c'),'port':0x18eb});var socket=require(_0x4fc9('0x1d'))(new Redis(config[_0x4fc9('0x1a')]));require(_0x4fc9('0x1e'))[_0x4fc9('0x1f')](socket);function respondWithStatusCode(_0x29d4c7,_0x506454){_0x506454=_0x506454||0xcc;return function(_0x56c5d0){if(_0x56c5d0){return _0x29d4c7['sendStatus'](_0x506454);}return _0x29d4c7[_0x4fc9('0x20')](_0x506454)[_0x4fc9('0x21')]();};}function respondWithResult(_0x2e0e8b,_0x10d08c){_0x10d08c=_0x10d08c||0xc8;return function(_0x4c14f5){if(_0x4c14f5){return _0x2e0e8b['status'](_0x10d08c)['json'](_0x4c14f5);}};}function respondWithFilteredResult(_0x50a46b,_0x4b10fa){return function(_0x185cdf){if(_0x185cdf){var _0xa98dbc=typeof _0x4b10fa[_0x4fc9('0x22')]===_0x4fc9('0x23')&&typeof _0x4b10fa[_0x4fc9('0x24')]===_0x4fc9('0x23');var _0x18f246=_0x185cdf[_0x4fc9('0x25')];var _0x3d8b8d=_0xa98dbc?0x0:_0x4b10fa['offset'];var _0x11f88d=_0xa98dbc?_0x185cdf['count']:_0x4b10fa[_0x4fc9('0x22')]+_0x4b10fa['limit'];var _0x3e8a19;if(_0x11f88d>=_0x18f246){_0x11f88d=_0x18f246;_0x3e8a19=0xc8;}else{_0x3e8a19=0xce;}_0x50a46b['status'](_0x3e8a19);return _0x50a46b['set'](_0x4fc9('0x26'),_0x3d8b8d+'-'+_0x11f88d+'/'+_0x18f246)[_0x4fc9('0x27')](_0x185cdf);}return null;};}function patchUpdates(_0x5f4ac5){return function(_0x42eefb){try{jsonpatch['apply'](_0x42eefb,_0x5f4ac5,!![]);}catch(_0x4a621e){return BPromise['reject'](_0x4a621e);}return _0x42eefb[_0x4fc9('0x28')]();};}function saveUpdates(_0x4ece9c,_0x1acdd3){return function(_0x479461){if(_0x479461){return _0x479461[_0x4fc9('0x29')](_0x4ece9c)[_0x4fc9('0x2a')](function(_0x27a359){return _0x27a359;});}return null;};}function removeEntity(_0x168cc2,_0x318a87){return function(_0x3920b4){if(_0x3920b4){return _0x3920b4[_0x4fc9('0x2b')]()[_0x4fc9('0x2a')](function(){var _0x57cf8c=_0x3920b4[_0x4fc9('0x2c')]({'plain':!![]});var _0x118220=_0x4fc9('0x2d');return db[_0x4fc9('0x2e')][_0x4fc9('0x2b')]({'where':{'type':_0x118220,'resourceId':_0x57cf8c['id']}})[_0x4fc9('0x2a')](function(){return _0x3920b4;});})[_0x4fc9('0x2a')](function(){_0x168cc2[_0x4fc9('0x20')](0xcc)[_0x4fc9('0x21')]();});}};}function handleEntityNotFound(_0x4cfdd8,_0x2739b3){return function(_0x1b7ac0){if(!_0x1b7ac0){_0x4cfdd8['sendStatus'](0x194);}return _0x1b7ac0;};}function handleError(_0x4a8ba1,_0x4547ba){_0x4547ba=_0x4547ba||0x1f4;return function(_0x2561db){logger['error'](_0x2561db[_0x4fc9('0x2f')]);if(_0x2561db[_0x4fc9('0x30')]){delete _0x2561db[_0x4fc9('0x30')];}_0x4a8ba1[_0x4fc9('0x20')](_0x4547ba)[_0x4fc9('0x31')](_0x2561db);};}exports[_0x4fc9('0x32')]=function(_0x5f02c9,_0x421ee3){var _0x18de50={},_0xe00154={},_0xca60b7={'count':0x0,'rows':[]};var _0x5b4ee5=_[_0x4fc9('0x33')](db[_0x4fc9('0x34')]['rawAttributes'],function(_0x5aac1a){return{'name':_0x5aac1a[_0x4fc9('0x35')],'type':_0x5aac1a[_0x4fc9('0x36')][_0x4fc9('0x37')]};});_0xe00154['model']=_[_0x4fc9('0x33')](_0x5b4ee5,_0x4fc9('0x30'));_0xe00154[_0x4fc9('0x38')]=_['keys'](_0x5f02c9[_0x4fc9('0x38')]);_0xe00154[_0x4fc9('0x39')]=_[_0x4fc9('0x3a')](_0xe00154[_0x4fc9('0x3b')],_0xe00154[_0x4fc9('0x38')]);_0x18de50[_0x4fc9('0x3c')]=_[_0x4fc9('0x3a')](_0xe00154['model'],qs[_0x4fc9('0x3d')](_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x3d')]));_0x18de50['attributes']=_0x18de50[_0x4fc9('0x3c')][_0x4fc9('0x3e')]?_0x18de50[_0x4fc9('0x3c')]:_0xe00154[_0x4fc9('0x3b')];if(!_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x3f')]('nolimit')){_0x18de50[_0x4fc9('0x24')]=qs[_0x4fc9('0x24')](_0x5f02c9['query'][_0x4fc9('0x24')]);_0x18de50['offset']=qs['offset'](_0x5f02c9[_0x4fc9('0x38')]['offset']);}_0x18de50[_0x4fc9('0x40')]=qs[_0x4fc9('0x41')](_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x41')]);_0x18de50['where']=qs[_0x4fc9('0x39')](_[_0x4fc9('0x42')](_0x5f02c9[_0x4fc9('0x38')],_0xe00154['filters']),_0x5b4ee5);if(_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x43')]){_0x18de50[_0x4fc9('0x44')]=_['merge'](_0x18de50[_0x4fc9('0x44')],{'$or':_[_0x4fc9('0x33')](_0x5b4ee5,function(_0x238475){if(_0x238475[_0x4fc9('0x36')]!==_0x4fc9('0x45')){var _0x3219b0={};_0x3219b0[_0x238475[_0x4fc9('0x30')]]={'$like':'%'+_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x43')]+'%'};return _0x3219b0;}})});}_0x18de50=_['merge']({},_0x18de50,_0x5f02c9[_0x4fc9('0x46')]);var _0x31b137={'where':_0x18de50[_0x4fc9('0x44')]};return db[_0x4fc9('0x34')][_0x4fc9('0x25')](_0x31b137)[_0x4fc9('0x2a')](function(_0x1f4487){_0xca60b7[_0x4fc9('0x25')]=_0x1f4487;if(_0x5f02c9[_0x4fc9('0x38')][_0x4fc9('0x47')]){_0x18de50[_0x4fc9('0x48')]=[{'all':!![]}];}return db[_0x4fc9('0x34')]['findAll'](_0x18de50);})['then'](function(_0x31ed5a){_0xca60b7[_0x4fc9('0x49')]=_0x31ed5a;return _0xca60b7;})['then'](respondWithFilteredResult(_0x421ee3,_0x18de50))['catch'](handleError(_0x421ee3,null));};exports[_0x4fc9('0x4a')]=function(_0x47d537,_0x37ad63){var _0x2e9a24={'raw':![],'where':{'id':_0x47d537['params']['id']}},_0x7d1247={};_0x7d1247[_0x4fc9('0x3b')]=_[_0x4fc9('0x4b')](db[_0x4fc9('0x34')][_0x4fc9('0x4c')]);_0x7d1247['query']=_[_0x4fc9('0x4b')](_0x47d537[_0x4fc9('0x38')]);_0x7d1247['filters']=_['intersection'](_0x7d1247[_0x4fc9('0x3b')],_0x7d1247[_0x4fc9('0x38')]);_0x2e9a24[_0x4fc9('0x3c')]=_[_0x4fc9('0x3a')](_0x7d1247[_0x4fc9('0x3b')],qs[_0x4fc9('0x3d')](_0x47d537[_0x4fc9('0x38')][_0x4fc9('0x3d')]));_0x2e9a24[_0x4fc9('0x3c')]=_0x2e9a24[_0x4fc9('0x3c')][_0x4fc9('0x3e')]?_0x2e9a24['attributes']:_0x7d1247['model'];if(_0x47d537[_0x4fc9('0x38')][_0x4fc9('0x47')]){_0x2e9a24[_0x4fc9('0x48')]=[{'all':!![]}];}_0x2e9a24=_[_0x4fc9('0x4d')]({},_0x2e9a24,_0x47d537[_0x4fc9('0x46')]);return db[_0x4fc9('0x34')][_0x4fc9('0x4e')](_0x2e9a24)[_0x4fc9('0x2a')](handleEntityNotFound(_0x37ad63,null))[_0x4fc9('0x2a')](respondWithResult(_0x37ad63,null))[_0x4fc9('0x4f')](handleError(_0x37ad63,null));};exports[_0x4fc9('0x50')]=function(_0x3baccf,_0xdd2667){return db[_0x4fc9('0x34')]['create'](_0x3baccf[_0x4fc9('0x51')],{})[_0x4fc9('0x2a')](function(_0x2a0fa1){var _0x3d0d00=_0x3baccf[_0x4fc9('0x52')][_0x4fc9('0x2c')]({'plain':!![]});if(!_0x3d0d00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d0d00[_0x4fc9('0x53')]===_0x4fc9('0x52')){var _0x4203e7=_0x2a0fa1[_0x4fc9('0x2c')]({'plain':!![]});var _0x53002e=_0x4fc9('0x2d');return db[_0x4fc9('0x54')][_0x4fc9('0x4e')]({'where':{'name':_0x53002e,'userProfileId':_0x3d0d00[_0x4fc9('0x55')]},'raw':!![]})['then'](function(_0x1eb973){if(_0x1eb973&&_0x1eb973[_0x4fc9('0x56')]===0x0){return db[_0x4fc9('0x2e')]['create']({'name':_0x4203e7[_0x4fc9('0x30')],'resourceId':_0x4203e7['id'],'type':_0x1eb973[_0x4fc9('0x30')],'sectionId':_0x1eb973['id']},{})['then'](function(){return _0x2a0fa1;});}else{return _0x2a0fa1;}})[_0x4fc9('0x4f')](function(_0x1d03df){logger[_0x4fc9('0x57')](_0x4fc9('0x58'),_0x1d03df);throw _0x1d03df;});}return _0x2a0fa1;})['then'](respondWithResult(_0xdd2667,0xc9))[_0x4fc9('0x4f')](handleError(_0xdd2667,null));};exports[_0x4fc9('0x29')]=function(_0x59c959,_0x195b42){if(_0x59c959['body']['id']){delete _0x59c959[_0x4fc9('0x51')]['id'];}return db['CmList'][_0x4fc9('0x4e')]({'where':{'id':_0x59c959['params']['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x195b42,null))[_0x4fc9('0x2a')](saveUpdates(_0x59c959[_0x4fc9('0x51')],null))[_0x4fc9('0x2a')](respondWithResult(_0x195b42,null))[_0x4fc9('0x4f')](handleError(_0x195b42,null));};exports[_0x4fc9('0x2b')]=function(_0x4d22fb,_0x1ee598){return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0x4d22fb[_0x4fc9('0x59')]['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x1ee598,null))[_0x4fc9('0x2a')](removeEntity(_0x1ee598,null))[_0x4fc9('0x4f')](handleError(_0x1ee598,null));};exports[_0x4fc9('0x5a')]=function(_0x4e8798,_0x106702){return db[_0x4fc9('0x34')][_0x4fc9('0x5a')]()[_0x4fc9('0x2a')](respondWithResult(_0x106702,null))[_0x4fc9('0x4f')](handleError(_0x106702,null));};exports[_0x4fc9('0x5b')]=function(_0xe0c935,_0x258066,_0x157810){if(_0xe0c935['body']['id']){delete _0xe0c935['body']['id'];}return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0xe0c935[_0x4fc9('0x59')]['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x258066,null))[_0x4fc9('0x2a')](function(_0x4c75b1){if(_0x4c75b1){_0xe0c935[_0x4fc9('0x51')]['ListId']=_0x4c75b1['id'];return db[_0x4fc9('0x5c')][_0x4fc9('0x50')](_0xe0c935[_0x4fc9('0x51')]);}})[_0x4fc9('0x2a')](respondWithResult(_0x258066,null))[_0x4fc9('0x4f')](handleError(_0x258066,null));};exports[_0x4fc9('0x5d')]=function(_0x5b5a02,_0x3d6c97,_0xff46f0){var _0x1ddbd8={'raw':![],'where':{}};var _0x2af65a={};var _0x24699a={'count':0x0,'rows':[]};return db[_0x4fc9('0x34')]['findOne']({'where':{'id':_0x5b5a02['params']['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x3d6c97,null))[_0x4fc9('0x2a')](function(_0x53a4da){if(_0x53a4da){_0x2af65a[_0x4fc9('0x3b')]=_[_0x4fc9('0x4b')](db['Disposition'][_0x4fc9('0x4c')]);_0x2af65a[_0x4fc9('0x38')]=_['keys'](_0x5b5a02[_0x4fc9('0x38')]);_0x2af65a[_0x4fc9('0x39')]=_[_0x4fc9('0x3a')](_0x2af65a[_0x4fc9('0x3b')],_0x2af65a['query']);_0x1ddbd8[_0x4fc9('0x3c')]=_['intersection'](_0x2af65a[_0x4fc9('0x3b')],qs[_0x4fc9('0x3d')](_0x5b5a02[_0x4fc9('0x38')][_0x4fc9('0x3d')]));_0x1ddbd8[_0x4fc9('0x3c')]=_0x1ddbd8[_0x4fc9('0x3c')][_0x4fc9('0x3e')]?_0x1ddbd8[_0x4fc9('0x3c')]:_0x2af65a[_0x4fc9('0x3b')];if(!_0x5b5a02[_0x4fc9('0x38')][_0x4fc9('0x3f')](_0x4fc9('0x5e'))){_0x1ddbd8[_0x4fc9('0x24')]=qs['limit'](_0x5b5a02[_0x4fc9('0x38')][_0x4fc9('0x24')]);_0x1ddbd8['offset']=qs[_0x4fc9('0x22')](_0x5b5a02['query']['offset']);}_0x1ddbd8[_0x4fc9('0x40')]=qs[_0x4fc9('0x41')](_0x5b5a02['query'][_0x4fc9('0x41')]);_0x1ddbd8[_0x4fc9('0x44')]=qs[_0x4fc9('0x39')](_[_0x4fc9('0x42')](_0x5b5a02['query'],_0x2af65a[_0x4fc9('0x39')]));_0x1ddbd8[_0x4fc9('0x44')][_0x4fc9('0x5f')]=_0x53a4da['id'];if(_0x5b5a02['query']['filter']){_0x1ddbd8[_0x4fc9('0x44')]=_[_0x4fc9('0x4d')](_0x1ddbd8[_0x4fc9('0x44')],{'$or':_['map'](_0x1ddbd8[_0x4fc9('0x3c')],function(_0x1352e1){var _0x21eb9c={};_0x21eb9c[_0x1352e1]={'$like':'%'+_0x5b5a02[_0x4fc9('0x38')][_0x4fc9('0x43')]+'%'};return _0x21eb9c;})});}_0x1ddbd8=_[_0x4fc9('0x4d')]({},_0x1ddbd8,_0x5b5a02['options']);return db[_0x4fc9('0x5c')][_0x4fc9('0x25')]({'where':_0x1ddbd8[_0x4fc9('0x44')]})[_0x4fc9('0x2a')](function(_0x1e2178){_0x24699a['count']=_0x1e2178;if(_0x5b5a02['query'][_0x4fc9('0x47')]){_0x1ddbd8[_0x4fc9('0x48')]=[{'all':!![]}];}return db[_0x4fc9('0x5c')]['findAll'](_0x1ddbd8);})[_0x4fc9('0x2a')](function(_0x4b007f){_0x24699a['rows']=_0x4b007f;return _0x24699a;});}})['then'](respondWithFilteredResult(_0x3d6c97,_0x1ddbd8))[_0x4fc9('0x4f')](handleError(_0x3d6c97,null));};exports['removeDispositions']=function(_0x1fc765,_0x4bcd62,_0x4d61e3){return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0x1fc765[_0x4fc9('0x59')]['id']}})['then'](handleEntityNotFound(_0x4bcd62,null))['then'](function(_0x1dc2f0){if(_0x1dc2f0){return _0x1dc2f0[_0x4fc9('0x60')](_0x1fc765[_0x4fc9('0x38')][_0x4fc9('0x61')]);}})[_0x4fc9('0x2a')](respondWithStatusCode(_0x4bcd62,null))[_0x4fc9('0x4f')](handleError(_0x4bcd62,null));};exports[_0x4fc9('0x62')]=function(_0x1ec0c7,_0x582875,_0xd7491d){return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0x1ec0c7['params']['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x582875,null))[_0x4fc9('0x2a')](function(_0x467b83){if(_0x467b83){var _0xb446bc=[];var _0x4faa97={'success':[],'errors':[]};return db[_0x4fc9('0x63')][_0x4fc9('0x5a')]()[_0x4fc9('0x2a')](function(_0x59c538){if(_0x1ec0c7[_0x4fc9('0x51')][_0x4fc9('0x64')]&&_[_0x4fc9('0x65')](_0x1ec0c7[_0x4fc9('0x51')][_0x4fc9('0x64')])){if(_0x1ec0c7['body'][_0x4fc9('0x64')][_0x4fc9('0x3e')]){_0x1ec0c7[_0x4fc9('0x51')]['tags']=_0x1ec0c7['body'][_0x4fc9('0x64')][_0x4fc9('0x66')](';')+';';}else{_0x1ec0c7[_0x4fc9('0x51')][_0x4fc9('0x64')]=null;}}else{_0x1ec0c7[_0x4fc9('0x51')][_0x4fc9('0x64')]=null;}if(_0x1ec0c7[_0x4fc9('0x51')]&&_[_0x4fc9('0x65')](_0x1ec0c7[_0x4fc9('0x51')])){for(var _0x37eae5=0x0;_0x37eae5<_0x1ec0c7[_0x4fc9('0x51')][_0x4fc9('0x3e')];_0x37eae5+=0x1){_0x1ec0c7[_0x4fc9('0x51')][_0x37eae5][_0x4fc9('0x5f')]=_0x1ec0c7['params']['id'];_0xb446bc['push'](_0x1ec0c7[_0x4fc9('0x51')][_0x37eae5]);}return BPromise[_0x4fc9('0x67')](_0xb446bc,function(_0x52c395){return db[_0x4fc9('0x63')][_0x4fc9('0x50')](_[_0x4fc9('0x68')](_0x52c395,[_0x4fc9('0x61'),'id'])||{},{'fields':_['keys'](_0x59c538),'raw':!![]})[_0x4fc9('0x2a')](function(_0x108b7c){_0x4faa97[_0x4fc9('0x69')][_0x4fc9('0x6a')](_0x108b7c[_0x4fc9('0x6b')]);})[_0x4fc9('0x4f')](function(_0x3ccadb){_0x4faa97['errors'][_0x4fc9('0x6a')]({'data':_0x52c395,'error':_0x3ccadb[_0x4fc9('0x6c')]});});})[_0x4fc9('0x2a')](function(_0x4d851c){return _0x4faa97;})[_0x4fc9('0x4f')](function(_0x43e1ae){return _0x43e1ae;});}else{_0x582875[_0x4fc9('0x20')](0x190)[_0x4fc9('0x27')]({'message':_0x4fc9('0x6d')});}});}})[_0x4fc9('0x2a')](respondWithResult(_0x582875,null))[_0x4fc9('0x4f')](handleError(_0x582875,null));};exports['getContacts']=function(_0x3158da,_0x1dcaa4,_0x13b3c6){var _0x2bec73;return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0x3158da[_0x4fc9('0x59')]['id']},'include':[{'model':db[_0x4fc9('0x6e')],'as':_0x4fc9('0x6f')}]})[_0x4fc9('0x2a')](handleEntityNotFound(_0x1dcaa4,null))[_0x4fc9('0x2a')](function(_0x5b9c5d){if(_0x5b9c5d){_0x2bec73=_0x5b9c5d;return db['CmContact'][_0x4fc9('0x4c')];}})[_0x4fc9('0x2a')](function(_0x1f7944){if(_0x1f7944){var _0x5671b7={};var _0x201065={};_0x201065['model']=_[_0x4fc9('0x70')](_['keys'](_0x1f7944),_[_0x4fc9('0x33')](_0x2bec73['CustomFields'],function(_0x381986){return util[_0x4fc9('0x71')]('cf_%d',_0x381986['id']);}));_0x201065[_0x4fc9('0x38')]=_[_0x4fc9('0x4b')](_0x3158da[_0x4fc9('0x38')]);_0x201065[_0x4fc9('0x39')]=_[_0x4fc9('0x3a')](_0x201065[_0x4fc9('0x3b')],_0x201065[_0x4fc9('0x38')]);_0x5671b7[_0x4fc9('0x3c')]=_[_0x4fc9('0x3a')](_0x201065[_0x4fc9('0x3b')],qs[_0x4fc9('0x3d')](_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x3d')]));_0x5671b7['attributes']=_0x5671b7[_0x4fc9('0x3c')]['length']?_0x5671b7[_0x4fc9('0x3c')]:_0x201065['model'];if(!_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x3f')]('nolimit')){_0x5671b7['limit']=qs[_0x4fc9('0x24')](_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x24')]);_0x5671b7[_0x4fc9('0x22')]=qs[_0x4fc9('0x22')](_0x3158da['query'][_0x4fc9('0x22')]);}_0x5671b7['order']=qs['sort'](_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x41')]);_0x5671b7[_0x4fc9('0x44')]=qs[_0x4fc9('0x39')](_['pick'](_0x3158da[_0x4fc9('0x38')],_0x201065['filters']));_0x5671b7[_0x4fc9('0x72')]=!![];if(_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x43')]){_0x5671b7[_0x4fc9('0x44')]=_[_0x4fc9('0x4d')](_0x5671b7['where'],{'$or':_['map'](_0x5671b7[_0x4fc9('0x3c')],function(_0x5435d2){var _0x3a4d70={};_0x3a4d70[_0x5435d2]={'$like':'%'+_0x3158da[_0x4fc9('0x38')][_0x4fc9('0x43')]+'%'};return _0x3a4d70;})});}_0x5671b7=_[_0x4fc9('0x4d')]({},_0x5671b7,_0x3158da['options']);return _0x2bec73[_0x4fc9('0x73')](_0x5671b7);}})[_0x4fc9('0x2a')](respondWithResult(_0x1dcaa4,null))['catch'](handleError(_0x1dcaa4,null));};exports[_0x4fc9('0x74')]=function(_0x2aede0,_0x5587fc,_0x37474c){var _0x5138c5;var _0x5a85be;var _0x20a53e;var _0x5ee8c5=_0x2aede0[_0x4fc9('0x59')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x4fc9('0x30')],'raw':!![],'order':['OrderBy']})[_0x4fc9('0x2a')](function(_0x48939f){_0x5138c5=_0x48939f;var _0x42a92a=_['keys'](db['CmContact']['rawAttributes']);return db[_0x4fc9('0x6e')][_0x4fc9('0x75')]({'raw':!![],'attributes':['id',_0x4fc9('0x76')]})[_0x4fc9('0x2a')](function(_0x16d1a0){_0x5a85be=_0x16d1a0;var _0x5ed719=squel[_0x4fc9('0x77')]()[_0x4fc9('0x3d')](_0x42a92a)['from'](_0x4fc9('0x78'),'c')[_0x4fc9('0x44')](_0x4fc9('0x79'),_0x5ee8c5)[_0x4fc9('0x44')](_0x4fc9('0x7a'))[_0x4fc9('0x7b')]();for(var _0x101a41=0x0;_0x101a41<_0x5a85be['length'];_0x101a41++){_0x5ed719[_0x4fc9('0x7c')](_0x4fc9('0x7d')+_0x5a85be[_0x101a41]['id'],_0x4fc9('0x7e')+_0x5a85be[_0x101a41][_0x4fc9('0x76')]);}for(var _0x101a41=0x0;_0x101a41<_0x5138c5[_0x4fc9('0x3e')];_0x101a41++){_0x5ed719[_0x4fc9('0x7c')](squel['select']()['field']('item')[_0x4fc9('0x7f')]('cm_contact_has_items')[_0x4fc9('0x44')](_0x4fc9('0x80'),_0x5138c5[_0x101a41]['id'])['where'](_0x4fc9('0x81')),_0x4fc9('0x82')+_0x5138c5[_0x101a41][_0x4fc9('0x30')]);_0x5ed719[_0x4fc9('0x7c')](squel[_0x4fc9('0x77')]()['field'](_0x4fc9('0x83'))['from']('cm_contact_has_items')[_0x4fc9('0x44')](_0x4fc9('0x80'),_0x5138c5[_0x101a41]['id'])['where'](_0x4fc9('0x81')),'description_additionalPhone_'+_0x5138c5[_0x101a41]['name']);}var _0x495cd7=[];_0x495cd7['push'](_0x5ed719[_0x4fc9('0x84')]());BPromise['each'](_0x495cd7,handleQuery)[_0x4fc9('0x2a')](function(_0x519ac2){handleQuery(_0x5ed719[_0x4fc9('0x84')]());var _0x4b9592=csv_results[0x0];if(!_[_0x4fc9('0x85')](_0x4b9592)){var _0xaf7891=toCsv(_0x4b9592);var _0xdad1d0=Date[_0x4fc9('0x86')]();fs[_0x4fc9('0x87')](util[_0x4fc9('0x71')]('/tmp/list_%d_%s.csv',_0x5ee8c5,_0xdad1d0),_0xaf7891);_0x5587fc['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x4fc9('0x71')](_0x4fc9('0x88'),_0x5ee8c5,_0xdad1d0));_0x5587fc['setHeader'](_0x4fc9('0x89'),_0x4fc9('0x8a'));return _0x5587fc[_0x4fc9('0x8b')](util[_0x4fc9('0x71')](_0x4fc9('0x8c'),_0x5ee8c5,_0xdad1d0));}else{return _0x5587fc[_0x4fc9('0x8d')](0xcc);}});});});};exports[_0x4fc9('0x8e')]=function(_0x108354,_0x311f10,_0x3ccab9){var _0x29b18f;delete _0x108354['body']['id'];return db[_0x4fc9('0x34')][_0x4fc9('0x8f')]({'where':{'id':_0x108354[_0x4fc9('0x59')]['id']}})['then'](handleEntityNotFound(_0x311f10,null))[_0x4fc9('0x2a')](function(_0x235a53){if(_0x235a53){return db[_0x4fc9('0x90')][_0x4fc9('0x91')](function(_0x36ad9a){return db['CmCustomField']['create'](_0x108354[_0x4fc9('0x51')],{'transaction':_0x36ad9a})['then'](function(_0x46990d){_0x29b18f=_0x46990d;return _0x235a53[_0x4fc9('0x92')](_0x46990d,{'transaction':_0x36ad9a});})[_0x4fc9('0x2a')](function(){var _0xd16a5a={'type':db[_0x4fc9('0x93')][_0x4fc9('0x94')],'transaction':_0x36ad9a};switch(_0x108354['body'][_0x4fc9('0x36')]){case _0x4fc9('0x95'):_0xd16a5a[_0x4fc9('0x36')]=db[_0x4fc9('0x93')][_0x4fc9('0x94')];break;case'number':_0xd16a5a[_0x4fc9('0x36')]=db['Sequelize'][_0x4fc9('0x96')];break;case'switch':_0xd16a5a[_0x4fc9('0x36')]=db[_0x4fc9('0x93')][_0x4fc9('0x97')];_0xd16a5a[_0x4fc9('0x98')]=![];break;default:}return db[_0x4fc9('0x90')][_0x4fc9('0x99')][_0x4fc9('0x9a')](_0x4fc9('0x78'),util[_0x4fc9('0x71')]('cf_%s',_0x29b18f['id']),_0xd16a5a);})[_0x4fc9('0x2a')](function(){return _0x29b18f;});});}})['then'](respondWithResult(_0x311f10,null))[_0x4fc9('0x4f')](handleError(_0x311f10,null));};exports['getCustomFields']=function(_0x41bd52,_0x27ce34,_0x244589){var _0x1fdf1e={};var _0x28c254={};var _0x59295d;var _0x42d4fa;return db[_0x4fc9('0x34')][_0x4fc9('0x8f')]({'where':{'id':_0x41bd52[_0x4fc9('0x59')]['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x27ce34,null))['then'](function(_0x2fe6bb){if(_0x2fe6bb){_0x59295d=_0x2fe6bb;_0x28c254[_0x4fc9('0x3b')]=_['keys'](db[_0x4fc9('0x6e')]['rawAttributes']);_0x28c254[_0x4fc9('0x38')]=_[_0x4fc9('0x4b')](_0x41bd52[_0x4fc9('0x38')]);_0x28c254[_0x4fc9('0x39')]=_[_0x4fc9('0x3a')](_0x28c254[_0x4fc9('0x3b')],_0x28c254['query']);_0x1fdf1e[_0x4fc9('0x3c')]=_[_0x4fc9('0x3a')](_0x28c254[_0x4fc9('0x3b')],qs[_0x4fc9('0x3d')](_0x41bd52[_0x4fc9('0x38')]['fields']));_0x1fdf1e[_0x4fc9('0x3c')]=_0x1fdf1e[_0x4fc9('0x3c')][_0x4fc9('0x3e')]?_0x1fdf1e[_0x4fc9('0x3c')]:_0x28c254[_0x4fc9('0x3b')];_0x1fdf1e['order']=qs[_0x4fc9('0x41')](_0x41bd52[_0x4fc9('0x38')][_0x4fc9('0x41')]);_0x1fdf1e[_0x4fc9('0x44')]=qs['filters'](_[_0x4fc9('0x42')](_0x41bd52[_0x4fc9('0x38')],_0x28c254[_0x4fc9('0x39')]));_0x1fdf1e[_0x4fc9('0x44')]=_[_0x4fc9('0x4d')](_0x1fdf1e['where'],{'$or':[{'ListId':_0x2fe6bb['id']},{'ListId':null}]});if(_0x41bd52[_0x4fc9('0x38')]['filter']){_0x1fdf1e['where']=_[_0x4fc9('0x4d')](_0x1fdf1e[_0x4fc9('0x44')],{'$or':_[_0x4fc9('0x33')](_0x1fdf1e[_0x4fc9('0x3c')],function(_0x43b404){var _0x56615a={};_0x56615a[_0x43b404]={'$like':'%'+_0x41bd52[_0x4fc9('0x38')][_0x4fc9('0x43')]+'%'};return _0x56615a;})});}_0x1fdf1e=_[_0x4fc9('0x4d')]({},_0x1fdf1e,_0x41bd52[_0x4fc9('0x46')]);return db['CmCustomField']['findAndCountAll'](_0x1fdf1e);}})[_0x4fc9('0x2a')](respondWithResult(_0x27ce34,null))[_0x4fc9('0x4f')](handleError(_0x27ce34,null));};exports['getGlobalCustomFields']=function(_0x160fe7,_0x469b70){return db[_0x4fc9('0x6e')][_0x4fc9('0x9b')]({'where':{'ListId':null}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x469b70,null))[_0x4fc9('0x2a')](function(_0x10165f){return _0x10165f;})['then'](respondWithResult(_0x469b70,null))['catch'](handleError(_0x469b70,null));};exports[_0x4fc9('0x9c')]=function(_0x51a96c,_0x457da1,_0x59d0e7){return db[_0x4fc9('0x34')][_0x4fc9('0x4e')]({'where':{'id':_0x51a96c[_0x4fc9('0x59')]['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x457da1,null))[_0x4fc9('0x2a')](function(_0x49febc){if(_0x49febc){return _0x49febc[_0x4fc9('0x9c')](_0x51a96c[_0x4fc9('0x51')][_0x4fc9('0x61')],_[_0x4fc9('0x68')](_0x51a96c['body'],['ids','id'])||{})['spread'](function(_0x47cf7e){for(var _0x412d3f=0x0;_0x412d3f<_0x51a96c[_0x4fc9('0x51')][_0x4fc9('0x61')][_0x4fc9('0x3e')];_0x412d3f+=0x1){socket['emit'](_0x4fc9('0x9d'),{'UserId':Number(_0x51a96c[_0x4fc9('0x51')][_0x4fc9('0x61')][_0x412d3f]),'CmListId':Number(_0x51a96c[_0x4fc9('0x59')]['id'])});}return _0x47cf7e;});}})[_0x4fc9('0x2a')](respondWithResult(_0x457da1,null))[_0x4fc9('0x4f')](handleError(_0x457da1,null));};exports[_0x4fc9('0x9e')]=function(_0x3e5f3a,_0x400e7f,_0x405447){return db[_0x4fc9('0x34')]['find']({'where':{'id':_0x3e5f3a['params']['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x400e7f,null))[_0x4fc9('0x2a')](function(_0x1327ea){if(_0x1327ea){return _0x1327ea[_0x4fc9('0x9e')](_0x3e5f3a[_0x4fc9('0x38')][_0x4fc9('0x61')])[_0x4fc9('0x2a')](function(){if(_[_0x4fc9('0x65')](_0x3e5f3a[_0x4fc9('0x38')]['ids'])){for(var _0x293c4e=0x0;_0x293c4e<_0x3e5f3a[_0x4fc9('0x38')]['ids'][_0x4fc9('0x3e')];_0x293c4e+=0x1){socket[_0x4fc9('0x9f')]('userCmList:remove',{'UserId':Number(_0x3e5f3a['query'][_0x4fc9('0x61')][_0x293c4e]),'CmListId':Number(_0x3e5f3a['params']['id'])});}}else{socket[_0x4fc9('0x9f')](_0x4fc9('0xa0'),{'UserId':Number(_0x3e5f3a[_0x4fc9('0x38')]['ids']),'CmListId':Number(_0x3e5f3a[_0x4fc9('0x59')]['id'])});}});}})[_0x4fc9('0x2a')](respondWithStatusCode(_0x400e7f,null))[_0x4fc9('0x4f')](handleError(_0x400e7f,null));};exports[_0x4fc9('0xa1')]=function(_0x5121a3,_0x478a36,_0x2e054d){var _0x269a67={};var _0x4b9938={};var _0x55d8e8;var _0x378425;return db['CmList'][_0x4fc9('0x8f')]({'where':{'id':_0x5121a3['params']['id']}})[_0x4fc9('0x2a')](handleEntityNotFound(_0x478a36,null))[_0x4fc9('0x2a')](function(_0x19a067){if(_0x19a067){_0x55d8e8=_0x19a067;_0x4b9938['model']=_['keys'](db[_0x4fc9('0xa2')][_0x4fc9('0x4c')]);_0x4b9938[_0x4fc9('0x38')]=_[_0x4fc9('0x4b')](_0x5121a3[_0x4fc9('0x38')]);_0x4b9938[_0x4fc9('0x39')]=_['intersection'](_0x4b9938[_0x4fc9('0x3b')],_0x4b9938[_0x4fc9('0x38')]);_0x269a67[_0x4fc9('0x3c')]=_[_0x4fc9('0x3a')](_0x4b9938[_0x4fc9('0x3b')],qs['fields'](_0x5121a3['query'][_0x4fc9('0x3d')]));_0x269a67[_0x4fc9('0x3c')]=_0x269a67[_0x4fc9('0x3c')][_0x4fc9('0x3e')]?_0x269a67[_0x4fc9('0x3c')]:_0x4b9938[_0x4fc9('0x3b')];_0x269a67[_0x4fc9('0x40')]=qs[_0x4fc9('0x41')](_0x5121a3[_0x4fc9('0x38')][_0x4fc9('0x41')]);_0x269a67[_0x4fc9('0x44')]=qs['filters'](_[_0x4fc9('0x42')](_0x5121a3[_0x4fc9('0x38')],_0x4b9938[_0x4fc9('0x39')]));if(_0x5121a3[_0x4fc9('0x38')][_0x4fc9('0x43')]){_0x269a67[_0x4fc9('0x44')]=_['merge'](_0x269a67[_0x4fc9('0x44')],{'$or':_[_0x4fc9('0x33')](_0x269a67['attributes'],function(_0x4a8cb1){var _0x2f7ae0={};_0x2f7ae0[_0x4a8cb1]={'$like':'%'+_0x5121a3[_0x4fc9('0x38')][_0x4fc9('0x43')]+'%'};return _0x2f7ae0;})});}_0x269a67=_[_0x4fc9('0x4d')]({},_0x269a67,_0x5121a3[_0x4fc9('0x46')]);return _0x55d8e8[_0x4fc9('0xa1')](_0x269a67);}})[_0x4fc9('0x2a')](function(_0x1e4981){if(_0x1e4981){_0x378425=_0x1e4981[_0x4fc9('0x3e')];if(!_0x5121a3[_0x4fc9('0x38')]['hasOwnProperty']('nolimit')){_0x269a67[_0x4fc9('0x24')]=qs['limit'](_0x5121a3[_0x4fc9('0x38')]['limit']);_0x269a67[_0x4fc9('0x22')]=qs[_0x4fc9('0x22')](_0x5121a3[_0x4fc9('0x38')][_0x4fc9('0x22')]);}return _0x55d8e8[_0x4fc9('0xa1')](_0x269a67);}})[_0x4fc9('0x2a')](function(_0x3a6b5b){if(_0x3a6b5b){return _0x3a6b5b?{'count':_0x378425,'rows':_0x3a6b5b}:null;}})[_0x4fc9('0x2a')](respondWithResult(_0x478a36,null))[_0x4fc9('0x4f')](handleError(_0x478a36,null));};function handleQuery(_0x4ca593){logger[_0x4fc9('0xa3')](_0x4ca593);return db[_0x4fc9('0x90')]['query'](_0x4ca593)[_0x4fc9('0xa4')](function(_0x3ff106){csv_results['push'](_0x3ff106);})[_0x4fc9('0x4f')](function(_0x218cd8){logger[_0x4fc9('0x57')](_0x218cd8[_0x4fc9('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1754c3e..c080ee7 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x33fb76,_0x450ed3){var _0x41033e=function(_0x14ed5e){while(--_0x14ed5e){_0x33fb76['push'](_0x33fb76['shift']());}};_0x41033e(++_0x450ed3);}(_0x814b,0x1a2));var _0xb814=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x814b[_0x37ffea];return _0x2e2615;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x190690,_0x2885ea){var _0x362375=function(_0x2469c0){while(--_0x2469c0){_0x190690['push'](_0x190690['shift']());}};_0x362375(++_0x2885ea);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f36bcdc..654b9d3 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 _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x556d81,_0x3c42ab){var _0x3eca5b=function(_0x167de2){while(--_0x167de2){_0x556d81['push'](_0x556d81['shift']());}};_0x3eca5b(++_0x3c42ab);}(_0xbec5,0xe5));var _0x5bec=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xbec5[_0x879e31];return _0x3467e8;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x227cf3,_0x495c82){var _0x6280b3=function(_0x2e24cb){while(--_0x2e24cb){_0x227cf3['push'](_0x227cf3['shift']());}};_0x6280b3(++_0x495c82);}(_0x750a,0x140));var _0xa750=function(_0x343a51,_0x3d9017){_0x343a51=_0x343a51-0x0;var _0xdfb7e0=_0x750a[_0x343a51];return _0xdfb7e0;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 29e2ece..94ac654 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 _0xd717=['http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x581a18,_0x16c0c0){var _0x9b0c59=function(_0x3c03bb){while(--_0x3c03bb){_0x581a18['push'](_0x581a18['shift']());}};_0x9b0c59(++_0x16c0c0);}(_0xd717,0x146));var _0x7d71=function(_0x1b131e,_0x2e4f4c){_0x1b131e=_0x1b131e-0x0;var _0x3937a3=_0xd717[_0x1b131e];return _0x3937a3;};'use strict';var _=require(_0x7d71('0x0'));var util=require(_0x7d71('0x1'));var moment=require(_0x7d71('0x2'));var BPromise=require(_0x7d71('0x3'));var rs=require(_0x7d71('0x4'));var fs=require('fs');var Redis=require(_0x7d71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d71('0x6'));var logger=require(_0x7d71('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7d71('0x8'));var client=jayson[_0x7d71('0x9')][_0x7d71('0xa')]({'port':0x232a});config[_0x7d71('0xb')]=_[_0x7d71('0xc')](config[_0x7d71('0xb')],{'host':_0x7d71('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d71('0xe'))[_0x7d71('0xf')](socket);function respondWithRpcPromise(_0x31395c,_0x20b679,_0x230d98){return new BPromise(function(_0x4eb0fc,_0xed751){return client[_0x7d71('0x10')](_0x31395c,_0x230d98)[_0x7d71('0x11')](function(_0x2a8edd){logger[_0x7d71('0x12')](_0x7d71('0x13'),_0x20b679,'request\x20sent');logger['debug'](_0x7d71('0x14'),_0x20b679,_0x7d71('0x15'),JSON[_0x7d71('0x16')](_0x2a8edd));if(_0x2a8edd[_0x7d71('0x17')]){if(_0x2a8edd[_0x7d71('0x17')][_0x7d71('0x18')]===0x1f4){logger[_0x7d71('0x17')]('CmList,\x20%s,\x20%s',_0x20b679,_0x2a8edd[_0x7d71('0x17')]['message']);return _0xed751(_0x2a8edd['error'][_0x7d71('0x19')]);}logger[_0x7d71('0x17')]('CmList,\x20%s,\x20%s',_0x20b679,_0x2a8edd['error'][_0x7d71('0x19')]);return _0x4eb0fc(_0x2a8edd[_0x7d71('0x17')][_0x7d71('0x19')]);}else{logger[_0x7d71('0x12')](_0x7d71('0x13'),_0x20b679,_0x7d71('0x15'));_0x4eb0fc(_0x2a8edd[_0x7d71('0x1a')]['message']);}})[_0x7d71('0x1b')](function(_0x505b26){logger[_0x7d71('0x17')](_0x7d71('0x13'),_0x20b679,_0x505b26);_0xed751(_0x505b26);});});} \ No newline at end of file +var _0x6eb2=['result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5d120e,_0x3c5423){var _0x30df35=function(_0x4d695e){while(--_0x4d695e){_0x5d120e['push'](_0x5d120e['shift']());}};_0x30df35(++_0x3c5423);}(_0x6eb2,0x98));var _0x26eb=function(_0x53e26e,_0x4a5f9c){_0x53e26e=_0x53e26e-0x0;var _0xf87fd2=_0x6eb2[_0x53e26e];return _0xf87fd2;};'use strict';var _=require(_0x26eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x26eb('0x1'));var rs=require(_0x26eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x26eb('0x3'));var logger=require(_0x26eb('0x4'))(_0x26eb('0x5'));var config=require('../../config/environment');var jayson=require(_0x26eb('0x6'));var client=jayson[_0x26eb('0x7')][_0x26eb('0x8')]({'port':0x232a});config[_0x26eb('0x9')]=_[_0x26eb('0xa')](config[_0x26eb('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x26eb('0xb'))(new Redis(config[_0x26eb('0x9')]));require(_0x26eb('0xc'))[_0x26eb('0xd')](socket);function respondWithRpcPromise(_0x2c2a70,_0xc674b0,_0x27396a){return new BPromise(function(_0x3c2644,_0x21e434){return client[_0x26eb('0xe')](_0x2c2a70,_0x27396a)[_0x26eb('0xf')](function(_0x2008ae){logger[_0x26eb('0x10')](_0x26eb('0x11'),_0xc674b0,_0x26eb('0x12'));logger[_0x26eb('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0xc674b0,'request\x20sent',JSON['stringify'](_0x2008ae));if(_0x2008ae[_0x26eb('0x14')]){if(_0x2008ae[_0x26eb('0x14')][_0x26eb('0x15')]===0x1f4){logger[_0x26eb('0x14')](_0x26eb('0x11'),_0xc674b0,_0x2008ae[_0x26eb('0x14')][_0x26eb('0x16')]);return _0x21e434(_0x2008ae[_0x26eb('0x14')][_0x26eb('0x16')]);}logger['error'](_0x26eb('0x11'),_0xc674b0,_0x2008ae['error']['message']);return _0x3c2644(_0x2008ae[_0x26eb('0x14')][_0x26eb('0x16')]);}else{logger[_0x26eb('0x10')]('CmList,\x20%s,\x20%s',_0xc674b0,_0x26eb('0x12'));_0x3c2644(_0x2008ae[_0x26eb('0x17')][_0x26eb('0x16')]);}})[_0x26eb('0x18')](function(_0x34b99b){logger['error']('CmList,\x20%s,\x20%s',_0xc674b0,_0x34b99b);_0x21e434(_0x34b99b);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 47a2b36..049922d 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 _0x39b5=['length','cmList:','remove','removeListener'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x39b5,0x1ba));var _0x539b=function(_0x890b53,_0x2b6c6f){_0x890b53=_0x890b53-0x0;var _0x207430=_0x39b5[_0x890b53];return _0x207430;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x539b('0x0'),'update'];function createListener(_0x4595f0,_0x1a6434){return function(_0x55979d){_0x1a6434['emit'](_0x4595f0,_0x55979d);};}function removeListener(_0x222da1,_0x516169){return function(){CmListEvents[_0x539b('0x1')](_0x222da1,_0x516169);};}exports['register']=function(_0x3e2164){for(var _0x11a8e8=0x0,_0x31de19=events[_0x539b('0x2')];_0x11a8e8<_0x31de19;_0x11a8e8++){var _0x280b62=events[_0x11a8e8];var _0x102307=createListener(_0x539b('0x3')+_0x280b62,_0x3e2164);CmListEvents['on'](_0x280b62,_0x102307);}}; \ No newline at end of file +var _0x568a=['remove','update','removeListener','length'];(function(_0x2296d9,_0x35a418){var _0x468fae=function(_0x18bd1b){while(--_0x18bd1b){_0x2296d9['push'](_0x2296d9['shift']());}};_0x468fae(++_0x35a418);}(_0x568a,0x1dc));var _0xa568=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x568a[_0x243b2f];return _0xcb3c2d;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xa568('0x0'),_0xa568('0x1')];function createListener(_0x5731d1,_0x59ee98){return function(_0x554798){_0x59ee98['emit'](_0x5731d1,_0x554798);};}function removeListener(_0xc05677,_0x550498){return function(){CmListEvents[_0xa568('0x2')](_0xc05677,_0x550498);};}exports['register']=function(_0x346c91){for(var _0x3b9f02=0x0,_0x3b641b=events[_0xa568('0x3')];_0x3b9f02<_0x3b641b;_0x3b9f02++){var _0x17f43e=events[_0x3b9f02];var _0x56d626=createListener('cmList:'+_0x17f43e,_0x346c91);CmListEvents['on'](_0x17f43e,_0x56d626);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cf40a8c..811ce01 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 _0x3ee8=['post','addContacts','put','/:id','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe','describe','getGlobalCustomFields','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents'];(function(_0x3791a5,_0x3e9d44){var _0x495f05=function(_0x2a2e0c){while(--_0x2a2e0c){_0x3791a5['push'](_0x3791a5['shift']());}};_0x495f05(++_0x3e9d44);}(_0x3ee8,0x136));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x83ee('0x0'));var util=require(_0x83ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x83ee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x83ee('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x83ee('0x4'));var controller=require(_0x83ee('0x5'));router['get']('/',auth[_0x83ee('0x6')](),controller['index']);router[_0x83ee('0x7')](_0x83ee('0x8'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x9')]);router[_0x83ee('0x7')]('/global_fields',auth[_0x83ee('0x6')](),controller[_0x83ee('0xa')]);router[_0x83ee('0x7')]('/:id',auth[_0x83ee('0x6')](),controller['show']);router['get'](_0x83ee('0xb'),auth['isAuthenticated'](),controller[_0x83ee('0xc')]);router[_0x83ee('0x7')](_0x83ee('0xd'),auth[_0x83ee('0x6')](),controller[_0x83ee('0xe')]);router[_0x83ee('0x7')](_0x83ee('0xf'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x10')]);router[_0x83ee('0x7')](_0x83ee('0x11'),auth[_0x83ee('0x6')](),controller['getCustomFields']);router[_0x83ee('0x7')](_0x83ee('0x12'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x13')]);router['post']('/',auth[_0x83ee('0x6')](),controller['create']);router[_0x83ee('0x14')](_0x83ee('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x83ee('0xd'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x15')]);router[_0x83ee('0x14')](_0x83ee('0x11'),auth[_0x83ee('0x6')](),controller['addCustomField']);router[_0x83ee('0x14')]('/:id/users',auth[_0x83ee('0x6')](),controller['addAgents']);router[_0x83ee('0x16')](_0x83ee('0x17'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x18')]);router['delete'](_0x83ee('0x17'),auth[_0x83ee('0x6')](),controller[_0x83ee('0x19')]);router[_0x83ee('0x1a')]('/:id/dispositions',auth[_0x83ee('0x6')](),controller[_0x83ee('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x83ee('0x1c')]);module[_0x83ee('0x1d')]=router; \ No newline at end of file +var _0xfa52=['getGlobalCustomFields','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','util','path','fs-extra','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x750d2,_0x8e4c98){var _0xc13c6=function(_0x31c90a){while(--_0x31c90a){_0x750d2['push'](_0x750d2['shift']());}};_0xc13c6(++_0x8e4c98);}(_0xfa52,0xb6));var _0x2fa5=function(_0x2454d1,_0x9005e8){_0x2454d1=_0x2454d1-0x0;var _0x3723a7=_0xfa52[_0x2454d1];return _0x3723a7;};'use strict';var multer=require('multer');var util=require(_0x2fa5('0x0'));var path=require(_0x2fa5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2fa5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2fa5('0x3'));var config=require('../../config/environment');var controller=require(_0x2fa5('0x4'));router[_0x2fa5('0x5')]('/',auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x7')]);router['get'](_0x2fa5('0x8'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x9')]);router['get']('/global_fields',auth[_0x2fa5('0x6')](),controller[_0x2fa5('0xa')]);router[_0x2fa5('0x5')]('/:id',auth[_0x2fa5('0x6')](),controller[_0x2fa5('0xb')]);router[_0x2fa5('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2fa5('0xc')]);router[_0x2fa5('0x5')](_0x2fa5('0xd'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0xe')]);router[_0x2fa5('0x5')](_0x2fa5('0xf'),auth['isAuthenticated'](),controller[_0x2fa5('0x10')]);router['get'](_0x2fa5('0x11'),auth[_0x2fa5('0x6')](),controller['getCustomFields']);router[_0x2fa5('0x5')](_0x2fa5('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2fa5('0x13')]('/',auth[_0x2fa5('0x6')](),controller['create']);router[_0x2fa5('0x13')](_0x2fa5('0x14'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x15')]);router[_0x2fa5('0x13')](_0x2fa5('0xd'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x16')]);router[_0x2fa5('0x13')]('/:id/fields',auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x17')]);router[_0x2fa5('0x13')](_0x2fa5('0x12'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x18')]);router[_0x2fa5('0x19')](_0x2fa5('0x1a'),auth[_0x2fa5('0x6')](),controller['update']);router[_0x2fa5('0x1b')](_0x2fa5('0x1a'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x1c')]);router[_0x2fa5('0x1b')](_0x2fa5('0x14'),auth['isAuthenticated'](),controller[_0x2fa5('0x1d')]);router[_0x2fa5('0x1b')](_0x2fa5('0x12'),auth[_0x2fa5('0x6')](),controller[_0x2fa5('0x1e')]);module[_0x2fa5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index ab22dae..abde357 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 _0xe155=['getDataValue','field','STRING','sequelize','exports'];(function(_0x2afb08,_0x324211){var _0x38cc5a=function(_0x5ac471){while(--_0x5ac471){_0x2afb08['push'](_0x2afb08['shift']());}};_0x38cc5a(++_0x324211);}(_0xe155,0x120));var _0x5e15=function(_0x287ce9,_0x11efc0){_0x287ce9=_0x287ce9-0x0;var _0x5bd8e6=_0xe155[_0x287ce9];return _0x5bd8e6;};'use strict';var Sequelize=require(_0x5e15('0x0'));module[_0x5e15('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x7db512){return this[_0x5e15('0x2')](_0x5e15('0x3'));}},'field':{'type':Sequelize[_0x5e15('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x5e15('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x119a=['VIRTUAL','getDataValue','STRING','exports'];(function(_0x1e3c2a,_0x33acf3){var _0x10fa0c=function(_0x798e09){while(--_0x798e09){_0x1e3c2a['push'](_0x1e3c2a['shift']());}};_0x10fa0c(++_0x33acf3);}(_0x119a,0x19b));var _0xa119=function(_0x3d9733,_0x46eb2b){_0x3d9733=_0x3d9733-0x0;var _0xdea94d=_0x119a[_0x3d9733];return _0xdea94d;};'use strict';var Sequelize=require('sequelize');module[_0xa119('0x0')]={'name':{'type':Sequelize[_0xa119('0x1')],'get':function(_0x2e4911){return this[_0xa119('0x2')]('field');}},'field':{'type':Sequelize[_0xa119('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa119('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xa119('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 9d7c236..4e5b84d 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4e3ab0,_0x4c9bd3){var _0x4b03b9=function(_0x5c7bd5){while(--_0x5c7bd5){_0x4e3ab0['push'](_0x4e3ab0['shift']());}};_0x4b03b9(++_0x4c9bd3);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x59b155,_0xfd7de8){var _0x276e5d=function(_0x221558){while(--_0x221558){_0x59b155['push'](_0x59b155['shift']());}};_0x276e5d(++_0xfd7de8);}(_0x7a54,0x106));var _0x47a5=function(_0x1d4421,_0x4a33e8){_0x1d4421=_0x1d4421-0x0;var _0x2fe9ee=_0x7a54[_0x1d4421];return _0x2fe9ee;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 22efdcd..f097677 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 _0xa2df=['request-promise','path','rimraf','./condition.attributes','define','tools_conditions','util','../../config/logger','api','moment'];(function(_0x3861e2,_0x2a08fa){var _0xce1fda=function(_0x492a76){while(--_0x492a76){_0x3861e2['push'](_0x3861e2['shift']());}};_0xce1fda(++_0x2a08fa);}(_0xa2df,0x182));var _0xfa2d=function(_0x44051f,_0x5e4815){_0x44051f=_0x44051f-0x0;var _0x51bc4b=_0xa2df[_0x44051f];return _0x51bc4b;};'use strict';var _=require('lodash');var util=require(_0xfa2d('0x0'));var logger=require(_0xfa2d('0x1'))(_0xfa2d('0x2'));var moment=require(_0xfa2d('0x3'));var BPromise=require('bluebird');var rp=require(_0xfa2d('0x4'));var fs=require('fs');var path=require(_0xfa2d('0x5'));var rimraf=require(_0xfa2d('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa2d('0x7'));module['exports']=function(_0x16bca6,_0x3d7c9c){return _0x16bca6[_0xfa2d('0x8')]('Condition',attributes,{'tableName':_0xfa2d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99ea=['exports','Condition','tools_conditions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x11c361,_0x4f5b42){var _0x1f5355=function(_0x259200){while(--_0x259200){_0x11c361['push'](_0x11c361['shift']());}};_0x1f5355(++_0x4f5b42);}(_0x99ea,0x93));var _0xa99e=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x99ea[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0xa99e('0x0'));var util=require(_0xa99e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa99e('0x2'));var BPromise=require(_0xa99e('0x3'));var rp=require(_0xa99e('0x4'));var fs=require('fs');var path=require(_0xa99e('0x5'));var rimraf=require(_0xa99e('0x6'));var config=require(_0xa99e('0x7'));var attributes=require(_0xa99e('0x8'));module[_0xa99e('0x9')]=function(_0x64d963,_0x3b9ab2){return _0x64d963['define'](_0xa99e('0xa'),attributes,{'tableName':_0xa99e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 56b7bbc..f522058 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 _0xf72b=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x25ad94,_0x103f0e){var _0x5dacb9=function(_0xde0b74){while(--_0xde0b74){_0x25ad94['push'](_0x25ad94['shift']());}};_0x5dacb9(++_0x103f0e);}(_0xf72b,0xa9));var _0xbf72=function(_0x1d4acf,_0x39faa2){_0x1d4acf=_0x1d4acf-0x0;var _0x157e7f=_0xf72b[_0x1d4acf];return _0x157e7f;};'use strict';var _=require(_0xbf72('0x0'));var util=require(_0xbf72('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf72('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf72('0x4'))('rpc');var config=require(_0xbf72('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbf72('0x6')][_0xbf72('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53c658,_0xf33b1b,_0x817685){return new BPromise(function(_0x5d2c4d,_0x23099c){return client['request'](_0x53c658,_0x817685)[_0xbf72('0x8')](function(_0x360b6d){logger[_0xbf72('0x9')]('Condition,\x20%s,\x20%s',_0xf33b1b,_0xbf72('0xa'));logger[_0xbf72('0xb')](_0xbf72('0xc'),_0xf33b1b,'request\x20sent',JSON[_0xbf72('0xd')](_0x360b6d));if(_0x360b6d['error']){if(_0x360b6d[_0xbf72('0xe')][_0xbf72('0xf')]===0x1f4){logger[_0xbf72('0xe')]('Condition,\x20%s,\x20%s',_0xf33b1b,_0x360b6d[_0xbf72('0xe')]['message']);return _0x23099c(_0x360b6d[_0xbf72('0xe')][_0xbf72('0x10')]);}logger[_0xbf72('0xe')](_0xbf72('0x11'),_0xf33b1b,_0x360b6d[_0xbf72('0xe')][_0xbf72('0x10')]);return _0x5d2c4d(_0x360b6d[_0xbf72('0xe')][_0xbf72('0x10')]);}else{logger[_0xbf72('0x9')]('Condition,\x20%s,\x20%s',_0xf33b1b,_0xbf72('0xa'));_0x5d2c4d(_0x360b6d[_0xbf72('0x12')][_0xbf72('0x10')]);}})[_0xbf72('0x13')](function(_0x31b4fd){logger['error'](_0xbf72('0x11'),_0xf33b1b,_0x31b4fd);_0x23099c(_0x31b4fd);});});} \ No newline at end of file +var _0xb200=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x106c6e,_0x1877fb){var _0x8e7769=function(_0x58cf96){while(--_0x58cf96){_0x106c6e['push'](_0x106c6e['shift']());}};_0x8e7769(++_0x1877fb);}(_0xb200,0x129));var _0x0b20=function(_0x194618,_0x2b8535){_0x194618=_0x194618-0x0;var _0x3a6638=_0xb200[_0x194618];return _0x3a6638;};'use strict';var _=require(_0x0b20('0x0'));var util=require(_0x0b20('0x1'));var moment=require(_0x0b20('0x2'));var BPromise=require(_0x0b20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b20('0x4'));var db=require(_0x0b20('0x5'))['db'];var utils=require(_0x0b20('0x6'));var logger=require(_0x0b20('0x7'))(_0x0b20('0x8'));var config=require(_0x0b20('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0b20('0xa')][_0x0b20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43ef6d,_0x5a1213,_0x598fc3){return new BPromise(function(_0x500b50,_0x116af4){return client['request'](_0x43ef6d,_0x598fc3)[_0x0b20('0xc')](function(_0x4f9508){logger['info'](_0x0b20('0xd'),_0x5a1213,_0x0b20('0xe'));logger[_0x0b20('0xf')](_0x0b20('0x10'),_0x5a1213,'request\x20sent',JSON[_0x0b20('0x11')](_0x4f9508));if(_0x4f9508['error']){if(_0x4f9508['error'][_0x0b20('0x12')]===0x1f4){logger[_0x0b20('0x13')](_0x0b20('0xd'),_0x5a1213,_0x4f9508[_0x0b20('0x13')]['message']);return _0x116af4(_0x4f9508['error'][_0x0b20('0x14')]);}logger['error'](_0x0b20('0xd'),_0x5a1213,_0x4f9508['error'][_0x0b20('0x14')]);return _0x500b50(_0x4f9508[_0x0b20('0x13')][_0x0b20('0x14')]);}else{logger[_0x0b20('0x15')]('Condition,\x20%s,\x20%s',_0x5a1213,_0x0b20('0xe'));_0x500b50(_0x4f9508[_0x0b20('0x16')][_0x0b20('0x14')]);}})[_0x0b20('0x17')](function(_0x8cf22a){logger[_0x0b20('0x13')](_0x0b20('0xd'),_0x5a1213,_0x8cf22a);_0x116af4(_0x8cf22a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 79e220c..b0ebc74 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 _0xcf36=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','delete','/:id','destroy','exports','multer','util'];(function(_0x3312d9,_0x3dd03a){var _0x88c719=function(_0x2a324b){while(--_0x2a324b){_0x3312d9['push'](_0x3312d9['shift']());}};_0x88c719(++_0x3dd03a);}(_0xcf36,0xdf));var _0x6cf3=function(_0x247a4e,_0x6f85f8){_0x247a4e=_0x247a4e-0x0;var _0x2feec7=_0xcf36[_0x247a4e];return _0x2feec7;};'use strict';var multer=require(_0x6cf3('0x0'));var util=require(_0x6cf3('0x1'));var path=require(_0x6cf3('0x2'));var timeout=require(_0x6cf3('0x3'));var express=require('express');var router=express[_0x6cf3('0x4')]();var fs_extra=require(_0x6cf3('0x5'));var auth=require(_0x6cf3('0x6'));var interaction=require(_0x6cf3('0x7'));var config=require(_0x6cf3('0x8'));var controller=require(_0x6cf3('0x9'));router['put']('/:id',auth[_0x6cf3('0xa')](),controller['update']);router[_0x6cf3('0xb')](_0x6cf3('0xc'),auth[_0x6cf3('0xa')](),controller[_0x6cf3('0xd')]);module[_0x6cf3('0xe')]=router; \ No newline at end of file +var _0x09b9=['./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x09b9,0x17d));var _0x909b=function(_0x49517a,_0x5a3d14){_0x49517a=_0x49517a-0x0;var _0x31f183=_0x09b9[_0x49517a];return _0x31f183;};'use strict';var multer=require(_0x909b('0x0'));var util=require(_0x909b('0x1'));var path=require(_0x909b('0x2'));var timeout=require(_0x909b('0x3'));var express=require(_0x909b('0x4'));var router=express[_0x909b('0x5')]();var fs_extra=require(_0x909b('0x6'));var auth=require(_0x909b('0x7'));var interaction=require(_0x909b('0x8'));var config=require(_0x909b('0x9'));var controller=require(_0x909b('0xa'));router[_0x909b('0xb')](_0x909b('0xc'),auth[_0x909b('0xd')](),controller['update']);router[_0x909b('0xe')](_0x909b('0xc'),auth[_0x909b('0xd')](),controller[_0x909b('0xf')]);module[_0x909b('0x10')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c8f905e..59341b5 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 _0x0399=['exports','STRING','name','INTEGER','sequelize'];(function(_0x3311de,_0x20651d){var _0x5c04e6=function(_0x4cf48a){while(--_0x4cf48a){_0x3311de['push'](_0x3311de['shift']());}};_0x5c04e6(++_0x20651d);}(_0x0399,0x180));var _0x9039=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0399[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x9039('0x0'));module[_0x9039('0x1')]={'name':{'type':Sequelize[_0x9039('0x2')],'allowNull':![],'unique':_0x9039('0x3')},'OrderBy':{'type':Sequelize[_0x9039('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9039('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3ec1=['STRING','name','INTEGER','sequelize','exports'];(function(_0x1e3073,_0x233a09){var _0x1dd6f8=function(_0x60e687){while(--_0x60e687){_0x1e3073['push'](_0x1e3073['shift']());}};_0x1dd6f8(++_0x233a09);}(_0x3ec1,0xad));var _0x13ec=function(_0x521f44,_0x178b58){_0x521f44=_0x521f44-0x0;var _0x645635=_0x3ec1[_0x521f44];return _0x645635;};'use strict';var Sequelize=require(_0x13ec('0x0'));module[_0x13ec('0x1')]={'name':{'type':Sequelize[_0x13ec('0x2')],'allowNull':![],'unique':_0x13ec('0x3')},'OrderBy':{'type':Sequelize[_0x13ec('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x13ec('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 695788e..50f031c 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 _0xeb3b=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0xeb3b[_0x18546c];return _0x46ef43;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){var _0x2bc188=_0x278fe4[_0xbeb3('0x25')]({'plain':!![]});var _0x84921a=_0xbeb3('0x26');return db[_0xbeb3('0x27')]['destroy']({'where':{'type':_0x84921a,'resourceId':_0x2bc188['id']}})['then'](function(){return _0x278fe4;});})[_0xbeb3('0x23')](function(){_0x55a59d['status'](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0xda808c,_0x138adf){return function(_0x400f65){if(!_0x400f65){_0xda808c['sendStatus'](0x194);}return _0x400f65;};}function handleError(_0x2fe7ec,_0x5bc3e1){_0x5bc3e1=_0x5bc3e1||0x1f4;return function(_0x26cd8f){logger[_0xbeb3('0x28')](_0x26cd8f['stack']);if(_0x26cd8f['name']){delete _0x26cd8f[_0xbeb3('0x29')];}_0x2fe7ec['status'](_0x5bc3e1)['send'](_0x26cd8f);};}exports['index']=function(_0x5bfef7,_0xf5dbaf){var _0x4e9a04={},_0x3767cc={},_0x3dff2d={'count':0x0,'rows':[]};var _0x1b4c2e=_[_0xbeb3('0x2a')](db[_0xbeb3('0x2b')][_0xbeb3('0x2c')],function(_0x411cd3){return{'name':_0x411cd3[_0xbeb3('0x2d')],'type':_0x411cd3[_0xbeb3('0x2e')][_0xbeb3('0x2f')]};});_0x3767cc['model']=_[_0xbeb3('0x2a')](_0x1b4c2e,_0xbeb3('0x29'));_0x3767cc['query']=_[_0xbeb3('0x30')](_0x5bfef7[_0xbeb3('0x31')]);_0x3767cc[_0xbeb3('0x32')]=_[_0xbeb3('0x33')](_0x3767cc['model'],_0x3767cc[_0xbeb3('0x31')]);_0x4e9a04[_0xbeb3('0x34')]=_[_0xbeb3('0x33')](_0x3767cc[_0xbeb3('0x35')],qs[_0xbeb3('0x36')](_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x36')]));_0x4e9a04[_0xbeb3('0x34')]=_0x4e9a04[_0xbeb3('0x34')]['length']?_0x4e9a04[_0xbeb3('0x34')]:_0x3767cc['model'];if(!_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x37')](_0xbeb3('0x38'))){_0x4e9a04[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x1f')]);_0x4e9a04[_0xbeb3('0x1e')]=qs['offset'](_0x5bfef7[_0xbeb3('0x31')]['offset']);}_0x4e9a04['order']=qs['sort'](_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x39')]);_0x4e9a04[_0xbeb3('0x3a')]=qs[_0xbeb3('0x32')](_[_0xbeb3('0x3b')](_0x5bfef7[_0xbeb3('0x31')],_0x3767cc['filters']),_0x1b4c2e);if(_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x3c')]){_0x4e9a04[_0xbeb3('0x3a')]=_['merge'](_0x4e9a04['where'],{'$or':_['map'](_0x1b4c2e,function(_0x46f570){if(_0x46f570[_0xbeb3('0x2e')]!==_0xbeb3('0x3d')){var _0x5d5225={};_0x5d5225[_0x46f570[_0xbeb3('0x29')]]={'$like':'%'+_0x5bfef7['query'][_0xbeb3('0x3c')]+'%'};return _0x5d5225;}})});}_0x4e9a04=_[_0xbeb3('0x3e')]({},_0x4e9a04,_0x5bfef7[_0xbeb3('0x3f')]);var _0x44632a={'where':_0x4e9a04['where']};return db['ContactItemType'][_0xbeb3('0x1d')](_0x44632a)[_0xbeb3('0x23')](function(_0x3d4262){_0x3dff2d[_0xbeb3('0x1d')]=_0x3d4262;if(_0x5bfef7[_0xbeb3('0x31')][_0xbeb3('0x40')]){_0x4e9a04[_0xbeb3('0x41')]=[{'all':!![]}];}return db[_0xbeb3('0x2b')]['findAll'](_0x4e9a04);})[_0xbeb3('0x23')](function(_0x39f2d2){_0x3dff2d[_0xbeb3('0x42')]=_0x39f2d2;return _0x3dff2d;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xf5dbaf,_0x4e9a04))[_0xbeb3('0x43')](handleError(_0xf5dbaf,null));};exports[_0xbeb3('0x44')]=function(_0x1ef1cd,_0x5234bc){var _0x284616={'raw':!![],'where':{'id':_0x1ef1cd[_0xbeb3('0x45')]['id']}},_0xd0403f={};_0xd0403f[_0xbeb3('0x35')]=_[_0xbeb3('0x30')](db[_0xbeb3('0x2b')][_0xbeb3('0x2c')]);_0xd0403f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x1ef1cd[_0xbeb3('0x31')]);_0xd0403f[_0xbeb3('0x32')]=_[_0xbeb3('0x33')](_0xd0403f[_0xbeb3('0x35')],_0xd0403f['query']);_0x284616[_0xbeb3('0x34')]=_[_0xbeb3('0x33')](_0xd0403f[_0xbeb3('0x35')],qs['fields'](_0x1ef1cd['query'][_0xbeb3('0x36')]));_0x284616[_0xbeb3('0x34')]=_0x284616[_0xbeb3('0x34')][_0xbeb3('0x46')]?_0x284616['attributes']:_0xd0403f[_0xbeb3('0x35')];if(_0x1ef1cd['query']['includeAll']){_0x284616[_0xbeb3('0x41')]=[{'all':!![]}];}_0x284616=_[_0xbeb3('0x3e')]({},_0x284616,_0x1ef1cd[_0xbeb3('0x3f')]);return db[_0xbeb3('0x2b')]['find'](_0x284616)[_0xbeb3('0x23')](handleEntityNotFound(_0x5234bc,null))[_0xbeb3('0x23')](respondWithResult(_0x5234bc,null))[_0xbeb3('0x43')](handleError(_0x5234bc,null));};exports['create']=function(_0x3f93ab,_0x58c49f){return db['ContactItemType'][_0xbeb3('0x47')](_0x3f93ab[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](function(_0x55e546){var _0x23d63c=_0x3f93ab[_0xbeb3('0x49')][_0xbeb3('0x25')]({'plain':!![]});if(!_0x23d63c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23d63c[_0xbeb3('0x4a')]==='user'){var _0x39605b=_0x55e546['get']({'plain':!![]});var _0x111d0d=_0xbeb3('0x26');return db[_0xbeb3('0x4b')][_0xbeb3('0x4c')]({'where':{'name':_0x111d0d,'userProfileId':_0x23d63c[_0xbeb3('0x4d')]},'raw':!![]})[_0xbeb3('0x23')](function(_0x135ca0){if(_0x135ca0&&_0x135ca0[_0xbeb3('0x4e')]===0x0){return db['UserProfileResource'][_0xbeb3('0x47')]({'name':_0x39605b[_0xbeb3('0x29')],'resourceId':_0x39605b['id'],'type':_0x135ca0[_0xbeb3('0x29')],'sectionId':_0x135ca0['id']},{})[_0xbeb3('0x23')](function(){return _0x55e546;});}else{return _0x55e546;}})['catch'](function(_0x2771e3){logger[_0xbeb3('0x28')](_0xbeb3('0x4f'),_0x2771e3);throw _0x2771e3;});}return _0x55e546;})[_0xbeb3('0x23')](respondWithResult(_0x58c49f,0xc9))['catch'](handleError(_0x58c49f,null));};exports[_0xbeb3('0x50')]=function(_0x5e094f,_0x15d828){if(_0x5e094f[_0xbeb3('0x48')]['id']){delete _0x5e094f[_0xbeb3('0x48')]['id'];}return db['ContactItemType'][_0xbeb3('0x4c')]({'where':{'id':_0x5e094f[_0xbeb3('0x45')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x15d828,null))[_0xbeb3('0x23')](saveUpdates(_0x5e094f[_0xbeb3('0x48')],null))[_0xbeb3('0x23')](respondWithResult(_0x15d828,null))[_0xbeb3('0x43')](handleError(_0x15d828,null));};exports[_0xbeb3('0x24')]=function(_0x27024e,_0x39fead){return db['ContactItemType'][_0xbeb3('0x4c')]({'where':{'id':_0x27024e[_0xbeb3('0x45')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x39fead,null))[_0xbeb3('0x23')](db[_0xbeb3('0x51')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x27024e['params']['id']}}))[_0xbeb3('0x23')](removeEntity(_0x39fead,null))[_0xbeb3('0x43')](handleError(_0x39fead,null));}; \ No newline at end of file +var _0x896e=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','end','error','stack','map','ContactItemType','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x896e,0x1e9));var _0xe896=function(_0x3c8966,_0x286c90){_0x3c8966=_0x3c8966-0x0;var _0x1d4117=_0x896e[_0x3c8966];return _0x1d4117;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){var _0x4d9f03=_0x1e952a[_0xe896('0x28')]({'plain':!![]});var _0x4b71cc=_0xe896('0x29');return db[_0xe896('0x2a')][_0xe896('0x26')]({'where':{'type':_0x4b71cc,'resourceId':_0x4d9f03['id']}})['then'](function(){return _0x1e952a;});})[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x2b')]();});}};}function handleEntityNotFound(_0xe93aa0,_0x2d8a7b){return function(_0x3f8ceb){if(!_0x3f8ceb){_0xe93aa0['sendStatus'](0x194);}return _0x3f8ceb;};}function handleError(_0x10adad,_0x34ccfd){_0x34ccfd=_0x34ccfd||0x1f4;return function(_0x201653){logger[_0xe896('0x2c')](_0x201653[_0xe896('0x2d')]);if(_0x201653['name']){delete _0x201653['name'];}_0x10adad['status'](_0x34ccfd)['send'](_0x201653);};}exports['index']=function(_0x291290,_0x29a18e){var _0x10fd26={},_0x76c781={},_0x3cd88e={'count':0x0,'rows':[]};var _0x1a6090=_[_0xe896('0x2e')](db[_0xe896('0x2f')]['rawAttributes'],function(_0x4ce052){return{'name':_0x4ce052[_0xe896('0x30')],'type':_0x4ce052[_0xe896('0x31')][_0xe896('0x32')]};});_0x76c781[_0xe896('0x33')]=_['map'](_0x1a6090,_0xe896('0x34'));_0x76c781['query']=_['keys'](_0x291290[_0xe896('0x35')]);_0x76c781[_0xe896('0x36')]=_[_0xe896('0x37')](_0x76c781['model'],_0x76c781['query']);_0x10fd26['attributes']=_[_0xe896('0x37')](_0x76c781[_0xe896('0x33')],qs[_0xe896('0x38')](_0x291290[_0xe896('0x35')][_0xe896('0x38')]));_0x10fd26['attributes']=_0x10fd26[_0xe896('0x39')][_0xe896('0x3a')]?_0x10fd26[_0xe896('0x39')]:_0x76c781[_0xe896('0x33')];if(!_0x291290[_0xe896('0x35')][_0xe896('0x3b')](_0xe896('0x3c'))){_0x10fd26[_0xe896('0x1f')]=qs['limit'](_0x291290[_0xe896('0x35')][_0xe896('0x1f')]);_0x10fd26['offset']=qs[_0xe896('0x1c')](_0x291290['query'][_0xe896('0x1c')]);}_0x10fd26['order']=qs[_0xe896('0x3d')](_0x291290['query'][_0xe896('0x3d')]);_0x10fd26[_0xe896('0x3e')]=qs[_0xe896('0x36')](_[_0xe896('0x3f')](_0x291290[_0xe896('0x35')],_0x76c781['filters']),_0x1a6090);if(_0x291290['query'][_0xe896('0x40')]){_0x10fd26[_0xe896('0x3e')]=_[_0xe896('0x41')](_0x10fd26[_0xe896('0x3e')],{'$or':_[_0xe896('0x2e')](_0x1a6090,function(_0x4c0ef0){if(_0x4c0ef0['type']!==_0xe896('0x42')){var _0x29d1ee={};_0x29d1ee[_0x4c0ef0['name']]={'$like':'%'+_0x291290['query'][_0xe896('0x40')]+'%'};return _0x29d1ee;}})});}_0x10fd26=_[_0xe896('0x41')]({},_0x10fd26,_0x291290[_0xe896('0x43')]);var _0x2ab0ac={'where':_0x10fd26[_0xe896('0x3e')]};return db[_0xe896('0x2f')][_0xe896('0x1e')](_0x2ab0ac)[_0xe896('0x27')](function(_0x372c71){_0x3cd88e[_0xe896('0x1e')]=_0x372c71;if(_0x291290[_0xe896('0x35')][_0xe896('0x44')]){_0x10fd26['include']=[{'all':!![]}];}return db[_0xe896('0x2f')][_0xe896('0x45')](_0x10fd26);})['then'](function(_0x57366b){_0x3cd88e['rows']=_0x57366b;return _0x3cd88e;})[_0xe896('0x27')](respondWithFilteredResult(_0x29a18e,_0x10fd26))[_0xe896('0x46')](handleError(_0x29a18e,null));};exports[_0xe896('0x47')]=function(_0x5d1a19,_0x431323){var _0x22189c={'raw':!![],'where':{'id':_0x5d1a19['params']['id']}},_0x55a8ba={};_0x55a8ba['model']=_[_0xe896('0x48')](db[_0xe896('0x2f')][_0xe896('0x49')]);_0x55a8ba[_0xe896('0x35')]=_[_0xe896('0x48')](_0x5d1a19[_0xe896('0x35')]);_0x55a8ba['filters']=_[_0xe896('0x37')](_0x55a8ba[_0xe896('0x33')],_0x55a8ba['query']);_0x22189c[_0xe896('0x39')]=_[_0xe896('0x37')](_0x55a8ba[_0xe896('0x33')],qs[_0xe896('0x38')](_0x5d1a19['query'][_0xe896('0x38')]));_0x22189c[_0xe896('0x39')]=_0x22189c[_0xe896('0x39')][_0xe896('0x3a')]?_0x22189c[_0xe896('0x39')]:_0x55a8ba[_0xe896('0x33')];if(_0x5d1a19['query'][_0xe896('0x44')]){_0x22189c['include']=[{'all':!![]}];}_0x22189c=_[_0xe896('0x41')]({},_0x22189c,_0x5d1a19[_0xe896('0x43')]);return db[_0xe896('0x2f')][_0xe896('0x4a')](_0x22189c)[_0xe896('0x27')](handleEntityNotFound(_0x431323,null))[_0xe896('0x27')](respondWithResult(_0x431323,null))['catch'](handleError(_0x431323,null));};exports[_0xe896('0x4b')]=function(_0x206ad3,_0x4818cd){return db[_0xe896('0x2f')][_0xe896('0x4b')](_0x206ad3['body'],{})[_0xe896('0x27')](function(_0x4b3420){var _0x404967=_0x206ad3[_0xe896('0x4c')][_0xe896('0x28')]({'plain':!![]});if(!_0x404967)throw new Error(_0xe896('0x4d'));if(_0x404967[_0xe896('0x4e')]==='user'){var _0x1fa3fd=_0x4b3420[_0xe896('0x28')]({'plain':!![]});var _0x379bf2='ContactItemTypes';return db[_0xe896('0x4f')]['find']({'where':{'name':_0x379bf2,'userProfileId':_0x404967['userProfileId']},'raw':!![]})[_0xe896('0x27')](function(_0x20fe4f){if(_0x20fe4f&&_0x20fe4f['autoAssociation']===0x0){return db[_0xe896('0x2a')][_0xe896('0x4b')]({'name':_0x1fa3fd['name'],'resourceId':_0x1fa3fd['id'],'type':_0x20fe4f['name'],'sectionId':_0x20fe4f['id']},{})[_0xe896('0x27')](function(){return _0x4b3420;});}else{return _0x4b3420;}})[_0xe896('0x46')](function(_0x5b8719){logger[_0xe896('0x2c')](_0xe896('0x50'),_0x5b8719);throw _0x5b8719;});}return _0x4b3420;})[_0xe896('0x27')](respondWithResult(_0x4818cd,0xc9))[_0xe896('0x46')](handleError(_0x4818cd,null));};exports[_0xe896('0x25')]=function(_0x38ee7b,_0xaf35a4){if(_0x38ee7b[_0xe896('0x51')]['id']){delete _0x38ee7b[_0xe896('0x51')]['id'];}return db[_0xe896('0x2f')][_0xe896('0x4a')]({'where':{'id':_0x38ee7b['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0xaf35a4,null))[_0xe896('0x27')](saveUpdates(_0x38ee7b[_0xe896('0x51')],null))[_0xe896('0x27')](respondWithResult(_0xaf35a4,null))[_0xe896('0x46')](handleError(_0xaf35a4,null));};exports[_0xe896('0x26')]=function(_0x157946,_0x3714b2){return db[_0xe896('0x2f')][_0xe896('0x4a')]({'where':{'id':_0x157946[_0xe896('0x52')]['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x3714b2,null))['then'](db[_0xe896('0x53')][_0xe896('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x157946[_0xe896('0x52')]['id']}}))['then'](removeEntity(_0x3714b2,null))['catch'](handleError(_0x3714b2,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index db7668b..0d4e167 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 _0x137c=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','../../config/logger','moment'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x137c,0x12a));var _0xc137=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x137c[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc137('0x0'))('api');var moment=require(_0xc137('0x1'));var BPromise=require('bluebird');var rp=require(_0xc137('0x2'));var fs=require('fs');var path=require(_0xc137('0x3'));var rimraf=require(_0xc137('0x4'));var config=require(_0xc137('0x5'));var attributes=require(_0xc137('0x6'));module[_0xc137('0x7')]=function(_0x51181e,_0x24e83b){return _0x51181e[_0xc137('0x8')]('ContactItemType',attributes,{'tableName':_0xc137('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7d5=['moment','bluebird','request-promise','rimraf','./contactItemType.attributes','define','lodash','util','../../config/logger','api'];(function(_0x349ac1,_0x443243){var _0x77840a=function(_0x3e6a60){while(--_0x3e6a60){_0x349ac1['push'](_0x349ac1['shift']());}};_0x77840a(++_0x443243);}(_0xb7d5,0x88));var _0x5b7d=function(_0x3fc96d,_0x69d395){_0x3fc96d=_0x3fc96d-0x0;var _0x2d8b73=_0xb7d5[_0x3fc96d];return _0x2d8b73;};'use strict';var _=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var logger=require(_0x5b7d('0x2'))(_0x5b7d('0x3'));var moment=require(_0x5b7d('0x4'));var BPromise=require(_0x5b7d('0x5'));var rp=require(_0x5b7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b7d('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b7d('0x8'));module['exports']=function(_0x16017f,_0x2fc1ff){return _0x16017f[_0x5b7d('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index dbfae28..61632f4 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 _0x223e=['../../config/logger','rpc','client','http','request','then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4536cf,_0x442c06){var _0x2f7b30=function(_0x2ca7ab){while(--_0x2ca7ab){_0x4536cf['push'](_0x4536cf['shift']());}};_0x2f7b30(++_0x442c06);}(_0x223e,0x1b1));var _0xe223=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x223e[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0xe223('0x0'));var util=require(_0xe223('0x1'));var moment=require(_0xe223('0x2'));var BPromise=require('bluebird');var rs=require(_0xe223('0x3'));var fs=require('fs');var Redis=require(_0xe223('0x4'));var db=require(_0xe223('0x5'))['db'];var utils=require(_0xe223('0x6'));var logger=require(_0xe223('0x7'))(_0xe223('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe223('0x9')][_0xe223('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8891,_0x24fdd9,_0x366d9b){return new BPromise(function(_0x4cffbb,_0x4370e1){return client[_0xe223('0xb')](_0x4a8891,_0x366d9b)[_0xe223('0xc')](function(_0x42d99a){logger[_0xe223('0xd')]('ContactItemType,\x20%s,\x20%s',_0x24fdd9,_0xe223('0xe'));logger['debug'](_0xe223('0xf'),_0x24fdd9,_0xe223('0xe'),JSON[_0xe223('0x10')](_0x42d99a));if(_0x42d99a[_0xe223('0x11')]){if(_0x42d99a[_0xe223('0x11')]['code']===0x1f4){logger[_0xe223('0x11')](_0xe223('0x12'),_0x24fdd9,_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);return _0x4370e1(_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);}logger[_0xe223('0x11')]('ContactItemType,\x20%s,\x20%s',_0x24fdd9,_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);return _0x4cffbb(_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x24fdd9,_0xe223('0xe'));_0x4cffbb(_0x42d99a['result'][_0xe223('0x13')]);}})['catch'](function(_0x746d36){logger['error']('ContactItemType,\x20%s,\x20%s',_0x24fdd9,_0x746d36);_0x4370e1(_0x746d36);});});} \ No newline at end of file +var _0x6b35=['result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x573dad,_0x548a2d){var _0x48d60=function(_0x56a32b){while(--_0x56a32b){_0x573dad['push'](_0x573dad['shift']());}};_0x48d60(++_0x548a2d);}(_0x6b35,0x6e));var _0x56b3=function(_0x2537dd,_0x4d2ac9){_0x2537dd=_0x2537dd-0x0;var _0x51c78e=_0x6b35[_0x2537dd];return _0x51c78e;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var moment=require(_0x56b3('0x1'));var BPromise=require(_0x56b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56b3('0x3'))['db'];var utils=require(_0x56b3('0x4'));var logger=require(_0x56b3('0x5'))(_0x56b3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a33a5,_0x3486b9,_0xabf2d7){return new BPromise(function(_0x1ca183,_0x48a098){return client[_0x56b3('0x7')](_0x1a33a5,_0xabf2d7)[_0x56b3('0x8')](function(_0x3d6f0d){logger[_0x56b3('0x9')](_0x56b3('0xa'),_0x3486b9,_0x56b3('0xb'));logger[_0x56b3('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3486b9,'request\x20sent',JSON['stringify'](_0x3d6f0d));if(_0x3d6f0d['error']){if(_0x3d6f0d['error'][_0x56b3('0xd')]===0x1f4){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x48a098(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x1ca183(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}else{logger[_0x56b3('0x9')]('ContactItemType,\x20%s,\x20%s',_0x3486b9,_0x56b3('0xb'));_0x1ca183(_0x3d6f0d[_0x56b3('0x10')][_0x56b3('0xf')]);}})[_0x56b3('0x11')](function(_0x3ab6cc){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3ab6cc);_0x48a098(_0x3ab6cc);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6690f34..eb220b2 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 _0xfffa=['create','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xfffa,0x7c));var _0xafff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfffa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xafff('0x0'));var router=express[_0xafff('0x1')]();var fs_extra=require(_0xafff('0x2'));var auth=require(_0xafff('0x3'));var interaction=require(_0xafff('0x4'));var config=require(_0xafff('0x5'));var controller=require(_0xafff('0x6'));router[_0xafff('0x7')]('/',auth[_0xafff('0x8')](),controller['index']);router[_0xafff('0x7')](_0xafff('0x9'),auth['isAuthenticated'](),controller[_0xafff('0xa')]);router[_0xafff('0xb')]('/',auth[_0xafff('0x8')](),controller[_0xafff('0xc')]);router['put']('/:id',auth[_0xafff('0x8')](),controller[_0xafff('0xd')]);router[_0xafff('0xe')](_0xafff('0x9'),auth['isAuthenticated'](),controller[_0xafff('0xf')]);module[_0xafff('0x10')]=router; \ No newline at end of file +var _0x1702=['post','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1702,0xc5));var _0x2170=function(_0xb77998,_0x1d47e8){_0xb77998=_0xb77998-0x0;var _0x3e111b=_0x1702[_0xb77998];return _0x3e111b;};'use strict';var multer=require(_0x2170('0x0'));var util=require(_0x2170('0x1'));var path=require(_0x2170('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2170('0x3')]();var fs_extra=require(_0x2170('0x4'));var auth=require(_0x2170('0x5'));var interaction=require(_0x2170('0x6'));var config=require(_0x2170('0x7'));var controller=require(_0x2170('0x8'));router[_0x2170('0x9')]('/',auth[_0x2170('0xa')](),controller['index']);router['get'](_0x2170('0xb'),auth[_0x2170('0xa')](),controller[_0x2170('0xc')]);router[_0x2170('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2170('0xb'),auth[_0x2170('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2170('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 3c4582f..398c02c 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(_0x4468d2,_0x6e095c){var _0x45f1bf=function(_0x138d36){while(--_0x138d36){_0x4468d2['push'](_0x4468d2['shift']());}};_0x45f1bf(++_0x6e095c);}(_0x757a,0xde));var _0xa757=function(_0x453184,_0x3ffc68){_0x453184=_0x453184-0x0;var _0x5a0121=_0x757a[_0x453184];return _0x5a0121;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 24b84f4..8133ad6 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 _0x3000=['get','role','user','UserProfileSection','userProfileId','autoAssociation','error','catch','params','createdAt','updatedAt','omit','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboard.socket','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','sendStatus','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','keys','options','find','create','body'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x3000,0x12f));var _0x0300=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3000[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0300('0x0'));var rimraf=require(_0x0300('0x1'));var zipdir=require(_0x0300('0x2'));var jsonpatch=require(_0x0300('0x3'));var rp=require(_0x0300('0x4'));var moment=require(_0x0300('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0300('0x6'));var path=require(_0x0300('0x7'));var sox=require(_0x0300('0x8'));var csv=require(_0x0300('0x9'));var ejs=require(_0x0300('0xa'));var fs=require('fs');var fs_extra=require(_0x0300('0xb'));var _=require(_0x0300('0xc'));var squel=require(_0x0300('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0300('0x9'));var querystring=require('querystring');var Papa=require(_0x0300('0xe'));var Redis=require('ioredis');var authService=require(_0x0300('0xf'));var qs=require(_0x0300('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0300('0x11'));var logger=require(_0x0300('0x12'))(_0x0300('0x13'));var utils=require(_0x0300('0x14'));var config=require(_0x0300('0x15'));var licenseUtil=require(_0x0300('0x16'));var db=require(_0x0300('0x17'))['db'];config['redis']=_[_0x0300('0x18')](config[_0x0300('0x19')],{'host':_0x0300('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0300('0x19')]));require(_0x0300('0x1b'))['register'](socket);function respondWithStatusCode(_0x4999d9,_0x380728){_0x380728=_0x380728||0xcc;return function(_0x223723){if(_0x223723){return _0x4999d9['sendStatus'](_0x380728);}return _0x4999d9['status'](_0x380728)[_0x0300('0x1c')]();};}function respondWithResult(_0x4c3862,_0x14379b){_0x14379b=_0x14379b||0xc8;return function(_0x468d04){if(_0x468d04){return _0x4c3862[_0x0300('0x1d')](_0x14379b)['json'](_0x468d04);}};}function respondWithFilteredResult(_0x5cbf76,_0x298a8a){return function(_0x4a4ca7){if(_0x4a4ca7){var _0xa998ba=typeof _0x298a8a[_0x0300('0x1e')]==='undefined'&&typeof _0x298a8a['limit']===_0x0300('0x1f');var _0x4a8723=_0x4a4ca7[_0x0300('0x20')];var _0x39257d=_0xa998ba?0x0:_0x298a8a[_0x0300('0x1e')];var _0x17391a=_0xa998ba?_0x4a4ca7[_0x0300('0x20')]:_0x298a8a[_0x0300('0x1e')]+_0x298a8a[_0x0300('0x21')];var _0x4044e5;if(_0x17391a>=_0x4a8723){_0x17391a=_0x4a8723;_0x4044e5=0xc8;}else{_0x4044e5=0xce;}_0x5cbf76['status'](_0x4044e5);return _0x5cbf76['set'](_0x0300('0x22'),_0x39257d+'-'+_0x17391a+'/'+_0x4a8723)[_0x0300('0x23')](_0x4a4ca7);}return null;};}function patchUpdates(_0x589198){return function(_0x1a91dc){try{jsonpatch[_0x0300('0x24')](_0x1a91dc,_0x589198,!![]);}catch(_0x33c2ba){return BPromise[_0x0300('0x25')](_0x33c2ba);}return _0x1a91dc[_0x0300('0x26')]();};}function saveUpdates(_0xe3b908,_0x3155df){return function(_0x146b04){if(_0x146b04){return _0x146b04[_0x0300('0x27')](_0xe3b908)[_0x0300('0x28')](function(_0x127f36){return _0x127f36;});}return null;};}function removeEntity(_0xc8bd11,_0x179f6e){return function(_0x5cec60){if(_0x5cec60){return _0x5cec60['destroy']()[_0x0300('0x28')](function(){var _0x53a292=_0x5cec60['get']({'plain':!![]});var _0x4e78ae=_0x0300('0x29');return db[_0x0300('0x2a')][_0x0300('0x2b')]({'where':{'type':_0x4e78ae,'resourceId':_0x53a292['id']}})[_0x0300('0x28')](function(){return _0x5cec60;});})[_0x0300('0x28')](function(){_0xc8bd11['status'](0xcc)[_0x0300('0x1c')]();});}};}function handleEntityNotFound(_0x1affcb,_0x5a1c25){return function(_0x3a83c0){if(!_0x3a83c0){_0x1affcb[_0x0300('0x2c')](0x194);}return _0x3a83c0;};}function handleError(_0x4645cb,_0x38c2f1){_0x38c2f1=_0x38c2f1||0x1f4;return function(_0x5aa5c1){logger['error'](_0x5aa5c1[_0x0300('0x2d')]);if(_0x5aa5c1[_0x0300('0x2e')]){delete _0x5aa5c1[_0x0300('0x2e')];}_0x4645cb['status'](_0x38c2f1)['send'](_0x5aa5c1);};}exports[_0x0300('0x2f')]=function(_0x52f41a,_0x6f42f3){var _0x4ce274={},_0x214ae0={},_0x4c2d82={'count':0x0,'rows':[]};var _0x309c4e=_[_0x0300('0x30')](db[_0x0300('0x31')][_0x0300('0x32')],function(_0x1eccaf){return{'name':_0x1eccaf[_0x0300('0x33')],'type':_0x1eccaf[_0x0300('0x34')][_0x0300('0x35')]};});_0x214ae0[_0x0300('0x36')]=_['map'](_0x309c4e,_0x0300('0x2e'));_0x214ae0[_0x0300('0x37')]=_['keys'](_0x52f41a[_0x0300('0x37')]);_0x214ae0[_0x0300('0x38')]=_[_0x0300('0x39')](_0x214ae0['model'],_0x214ae0[_0x0300('0x37')]);_0x4ce274[_0x0300('0x3a')]=_['intersection'](_0x214ae0['model'],qs[_0x0300('0x3b')](_0x52f41a['query'][_0x0300('0x3b')]));_0x4ce274['attributes']=_0x4ce274[_0x0300('0x3a')][_0x0300('0x3c')]?_0x4ce274['attributes']:_0x214ae0[_0x0300('0x36')];if(!_0x52f41a[_0x0300('0x37')]['hasOwnProperty'](_0x0300('0x3d'))){_0x4ce274[_0x0300('0x21')]=qs[_0x0300('0x21')](_0x52f41a['query'][_0x0300('0x21')]);_0x4ce274['offset']=qs['offset'](_0x52f41a[_0x0300('0x37')][_0x0300('0x1e')]);}_0x4ce274[_0x0300('0x3e')]=qs[_0x0300('0x3f')](_0x52f41a[_0x0300('0x37')]['sort']);_0x4ce274[_0x0300('0x40')]=qs[_0x0300('0x38')](_[_0x0300('0x41')](_0x52f41a[_0x0300('0x37')],_0x214ae0[_0x0300('0x38')]),_0x309c4e);if(_0x52f41a[_0x0300('0x37')][_0x0300('0x42')]){_0x4ce274[_0x0300('0x40')]=_[_0x0300('0x43')](_0x4ce274[_0x0300('0x40')],{'$or':_[_0x0300('0x30')](_0x309c4e,function(_0xf9195d){if(_0xf9195d[_0x0300('0x34')]!==_0x0300('0x44')){var _0x5a2fe4={};_0x5a2fe4[_0xf9195d[_0x0300('0x2e')]]={'$like':'%'+_0x52f41a[_0x0300('0x37')][_0x0300('0x42')]+'%'};return _0x5a2fe4;}})});}_0x4ce274=_['merge']({},_0x4ce274,_0x52f41a['options']);var _0x28bf72={'where':_0x4ce274[_0x0300('0x40')]};return db[_0x0300('0x31')][_0x0300('0x20')](_0x28bf72)[_0x0300('0x28')](function(_0x894e3d){_0x4c2d82[_0x0300('0x20')]=_0x894e3d;if(_0x52f41a[_0x0300('0x37')][_0x0300('0x45')]){_0x4ce274[_0x0300('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0x0300('0x47')](_0x4ce274);})[_0x0300('0x28')](function(_0x3471c4){_0x4c2d82[_0x0300('0x48')]=_0x3471c4;return _0x4c2d82;})[_0x0300('0x28')](respondWithFilteredResult(_0x6f42f3,_0x4ce274))['catch'](handleError(_0x6f42f3,null));};exports['show']=function(_0x231d13,_0x35e729){var _0x46a4e3={'raw':![],'where':{'id':_0x231d13['params']['id']}},_0x57dad6={};_0x57dad6[_0x0300('0x36')]=_[_0x0300('0x49')](db[_0x0300('0x31')][_0x0300('0x32')]);_0x57dad6[_0x0300('0x37')]=_[_0x0300('0x49')](_0x231d13[_0x0300('0x37')]);_0x57dad6['filters']=_[_0x0300('0x39')](_0x57dad6[_0x0300('0x36')],_0x57dad6[_0x0300('0x37')]);_0x46a4e3[_0x0300('0x3a')]=_[_0x0300('0x39')](_0x57dad6[_0x0300('0x36')],qs['fields'](_0x231d13['query'][_0x0300('0x3b')]));_0x46a4e3[_0x0300('0x3a')]=_0x46a4e3[_0x0300('0x3a')][_0x0300('0x3c')]?_0x46a4e3[_0x0300('0x3a')]:_0x57dad6[_0x0300('0x36')];if(_0x231d13[_0x0300('0x37')]['includeAll']){_0x46a4e3[_0x0300('0x46')]=[{'all':!![]}];}_0x46a4e3=_[_0x0300('0x43')]({},_0x46a4e3,_0x231d13[_0x0300('0x4a')]);return db['Dashboard'][_0x0300('0x4b')](_0x46a4e3)[_0x0300('0x28')](handleEntityNotFound(_0x35e729,null))[_0x0300('0x28')](respondWithResult(_0x35e729,null))['catch'](handleError(_0x35e729,null));};exports[_0x0300('0x4c')]=function(_0x592c8a,_0x5ab10b){return db[_0x0300('0x31')][_0x0300('0x4c')](_0x592c8a[_0x0300('0x4d')],{})[_0x0300('0x28')](function(_0x42704d){var _0x31bd29=_0x592c8a['user'][_0x0300('0x4e')]({'plain':!![]});if(!_0x31bd29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31bd29[_0x0300('0x4f')]===_0x0300('0x50')){var _0x730321=_0x42704d[_0x0300('0x4e')]({'plain':!![]});var _0x48fab7=_0x0300('0x29');return db[_0x0300('0x51')]['find']({'where':{'name':_0x48fab7,'userProfileId':_0x31bd29[_0x0300('0x52')]},'raw':!![]})[_0x0300('0x28')](function(_0x24e3c3){if(_0x24e3c3&&_0x24e3c3[_0x0300('0x53')]===0x0){return db[_0x0300('0x2a')][_0x0300('0x4c')]({'name':_0x730321['name'],'resourceId':_0x730321['id'],'type':_0x24e3c3['name'],'sectionId':_0x24e3c3['id']},{})[_0x0300('0x28')](function(){return _0x42704d;});}else{return _0x42704d;}})['catch'](function(_0x3cf6d5){logger[_0x0300('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cf6d5);throw _0x3cf6d5;});}return _0x42704d;})[_0x0300('0x28')](respondWithResult(_0x5ab10b,0xc9))[_0x0300('0x55')](handleError(_0x5ab10b,null));};exports['clone']=function(_0x4b0868,_0x55f677){var _0x4d57b8={'where':{'id':_0x4b0868[_0x0300('0x56')]['id']}},_0x1a5a76={};_0x1a5a76[_0x0300('0x36')]=_[_0x0300('0x49')](db[_0x0300('0x31')][_0x0300('0x32')]);_0x4d57b8[_0x0300('0x3a')]=_[_0x0300('0x39')](_0x1a5a76[_0x0300('0x36')],qs[_0x0300('0x3b')](_0x4b0868[_0x0300('0x37')]['fields']));_0x4d57b8[_0x0300('0x3a')]=_0x4d57b8[_0x0300('0x3a')][_0x0300('0x3c')]?_0x4d57b8[_0x0300('0x3a')]:_0x1a5a76[_0x0300('0x36')];if(_0x4b0868['query'][_0x0300('0x45')]){_0x4d57b8[_0x0300('0x46')]=[{'all':!![]}];}_0x4d57b8=_['merge']({},_0x4d57b8,_0x4b0868[_0x0300('0x4a')]);return db[_0x0300('0x31')][_0x0300('0x4b')](_0x4d57b8)[_0x0300('0x28')](handleEntityNotFound(_0x55f677,null))[_0x0300('0x28')](function(_0x55a7f7){if(_0x55a7f7){var _0x391154=_0x55a7f7[_0x0300('0x4e')]({'plain':!![]});_0x391154=qs['omit'](_0x391154,['id',_0x0300('0x57'),_0x0300('0x58')]);_0x4b0868[_0x0300('0x4d')]=_[_0x0300('0x59')](_0x4b0868['body'],['id',_0x0300('0x57'),_0x0300('0x58')]);return db['Dashboard'][_0x0300('0x4c')](_[_0x0300('0x43')](_0x391154,_0x4b0868['body']),{'include':_0x4b0868[_0x0300('0x37')][_0x0300('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0xf173b0){var _0x5782df=_0x4b0868[_0x0300('0x50')][_0x0300('0x4e')]({'plain':!![]});if(!_0x5782df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5782df[_0x0300('0x4f')]===_0x0300('0x50')){var _0x184160=_0xf173b0[_0x0300('0x4e')]({'plain':!![]});var _0x17a8bb=_0x0300('0x29');return db[_0x0300('0x51')]['find']({'where':{'name':_0x17a8bb,'userProfileId':_0x5782df[_0x0300('0x52')]},'raw':!![]})[_0x0300('0x28')](function(_0x2f919c){if(_0x2f919c&&_0x2f919c[_0x0300('0x53')]===0x0){return db[_0x0300('0x2a')][_0x0300('0x4c')]({'name':_0x184160['name'],'resourceId':_0x184160['id'],'type':_0x2f919c[_0x0300('0x2e')],'sectionId':_0x2f919c['id']},{})[_0x0300('0x28')](function(){return _0xf173b0;});}else{return _0xf173b0;}})[_0x0300('0x55')](function(_0x347d4a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347d4a);throw _0x347d4a;});}return _0xf173b0;});}})[_0x0300('0x28')](respondWithResult(_0x55f677,0xc9))['catch'](handleError(_0x55f677,null));};exports[_0x0300('0x27')]=function(_0x29fab4,_0x6b4e85){if(_0x29fab4[_0x0300('0x4d')]['id']){delete _0x29fab4[_0x0300('0x4d')]['id'];}return db[_0x0300('0x31')][_0x0300('0x4b')]({'where':{'id':_0x29fab4[_0x0300('0x56')]['id']}})[_0x0300('0x28')](handleEntityNotFound(_0x6b4e85,null))['then'](saveUpdates(_0x29fab4['body'],null))[_0x0300('0x28')](respondWithResult(_0x6b4e85,null))[_0x0300('0x55')](handleError(_0x6b4e85,null));};exports[_0x0300('0x2b')]=function(_0x422cba,_0x189291){return db[_0x0300('0x31')]['find']({'where':{'id':_0x422cba[_0x0300('0x56')]['id']}})[_0x0300('0x28')](handleEntityNotFound(_0x189291,null))[_0x0300('0x28')](removeEntity(_0x189291,null))[_0x0300('0x55')](handleError(_0x189291,null));};function widgetAttributes(_0x1a3efe){try{switch(_0x1a3efe['type']){case'iframe':return[{'name':_0x0300('0x5a'),'value':_0x1a3efe[_0x0300('0x5a')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe['attrs'][0x0]?_0x1a3efe[_0x0300('0x5b')][0x0][_0x0300('0x5c')]:undefined)||_0x0300('0x5d')}];case _0x0300('0x5e'):return[{'name':_0x0300('0x5f'),'value':_0x1a3efe[_0x0300('0x5f')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe[_0x0300('0x5b')][0x0][_0x0300('0x5c')]:undefined)||''}];case _0x0300('0x60'):return[{'name':_0x0300('0x61'),'value':_0x1a3efe[_0x0300('0x61')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe[_0x0300('0x5b')][0x0][_0x0300('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x0300('0x62'),'value':_0x1a3efe['attrTimezone']||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x1]?_0x1a3efe['attrs'][0x1][_0x0300('0x5c')]:undefined)||_0x0300('0x63')},{'name':'attrFontSize','value':_0x1a3efe[_0x0300('0x64')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x2]?_0x1a3efe[_0x0300('0x5b')][0x2]['value']:undefined)||0xc}];case _0x0300('0x65'):return[{'name':_0x0300('0x66'),'value':_0x1a3efe[_0x0300('0x66')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe[_0x0300('0x5b')][0x0]['value']:undefined)||_0x0300('0x67')},{'name':_0x0300('0x68'),'value':_0x1a3efe[_0x0300('0x68')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x1]?_0x1a3efe[_0x0300('0x5b')][0x1][_0x0300('0x5c')]:undefined)||[]},{'name':_0x0300('0x64'),'value':_0x1a3efe[_0x0300('0x64')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x2]?_0x1a3efe[_0x0300('0x5b')][0x2][_0x0300('0x5c')]:undefined)||0x14},{'name':_0x0300('0x69'),'value':_0x1a3efe[_0x0300('0x69')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x3]?_0x1a3efe[_0x0300('0x5b')][0x3][_0x0300('0x5c')]:undefined)||_0x0300('0x6a')},{'name':'attrEmailAccounts','value':_0x1a3efe['attrEmailAccounts']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x4]?_0x1a3efe[_0x0300('0x5b')][0x4][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6b'),'value':_0x1a3efe[_0x0300('0x6b')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x5]?_0x1a3efe['attrs'][0x5][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6c'),'value':_0x1a3efe['attrSmsAccounts']||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x6]?_0x1a3efe[_0x0300('0x5b')][0x6]['value']:undefined)||''},{'name':_0x0300('0x6d'),'value':_0x1a3efe['attrOpenchannelAccounts']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x7]?_0x1a3efe['attrs'][0x7][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6e'),'value':_0x1a3efe[_0x0300('0x6e')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x8]?_0x1a3efe[_0x0300('0x5b')][0x8][_0x0300('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1a3efe[_0x0300('0x6f')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x9]?_0x1a3efe['attrs'][0x9][_0x0300('0x5c')]:undefined)||''}];case _0x0300('0x70'):case _0x0300('0x71'):return[{'name':_0x0300('0x72'),'value':_0x1a3efe[_0x0300('0x72')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe['attrs'][0x0][_0x0300('0x5c')]:undefined)||_0x0300('0x67')},{'name':_0x0300('0x73'),'value':_0x1a3efe[_0x0300('0x73')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x1]?_0x1a3efe[_0x0300('0x5b')][0x1][_0x0300('0x5c')]:undefined)||null},{'name':_0x0300('0x74'),'value':_0x1a3efe['attrSerie3']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe['attrs'][0x2]?_0x1a3efe[_0x0300('0x5b')][0x2][_0x0300('0x5c')]:undefined)||null},{'name':_0x0300('0x68'),'value':_0x1a3efe[_0x0300('0x68')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe['attrs'][0x3]?_0x1a3efe[_0x0300('0x5b')][0x3][_0x0300('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x1a3efe['attrChannel']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x4]?_0x1a3efe[_0x0300('0x5b')][0x4][_0x0300('0x5c')]:undefined)||_0x0300('0x6a')},{'name':_0x0300('0x75'),'value':_0x1a3efe[_0x0300('0x75')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x5]?_0x1a3efe[_0x0300('0x5b')][0x5][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6b'),'value':_0x1a3efe[_0x0300('0x6b')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x6]?_0x1a3efe[_0x0300('0x5b')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1a3efe['attrSmsAccounts']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe['attrs'][0x7]?_0x1a3efe[_0x0300('0x5b')][0x7][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6d'),'value':_0x1a3efe[_0x0300('0x6d')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe['attrs'][0x8]?_0x1a3efe['attrs'][0x8][_0x0300('0x5c')]:undefined)||''},{'name':_0x0300('0x6e'),'value':_0x1a3efe['attrWhatsappAccounts']||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x9]?_0x1a3efe['attrs'][0x9]['value']:undefined)||''},{'name':_0x0300('0x6f'),'value':_0x1a3efe[_0x0300('0x6f')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0xa]?_0x1a3efe[_0x0300('0x5b')][0xa][_0x0300('0x5c')]:undefined)||''}];case _0x0300('0x76'):return[{'name':'attrReport','type':_0x1a3efe[_0x0300('0x77')]||(_0x1a3efe[_0x0300('0x5b')]&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe['attrs'][0x0][_0x0300('0x34')]:undefined)||null,'value':_0x1a3efe[_0x0300('0x78')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x0]?_0x1a3efe[_0x0300('0x5b')][0x0][_0x0300('0x5c')]:undefined)||null},{'name':_0x0300('0x79'),'value':_0x1a3efe[_0x0300('0x79')]||(_0x1a3efe['attrs']&&_0x1a3efe[_0x0300('0x5b')][0x1]?_0x1a3efe[_0x0300('0x5b')][0x1][_0x0300('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x51d883){logger[_0x0300('0x54')](_0x0300('0x7a'),JSON['stringify'](_0x51d883));return[];}}exports[_0x0300('0x7b')]=function(_0x87c405,_0x5a8884,_0x34fbed){if(_0x87c405['body']['id']){delete _0x87c405[_0x0300('0x4d')]['id'];}return db['Dashboard'][_0x0300('0x4b')]({'where':{'id':_0x87c405['params']['id']}})['then'](handleEntityNotFound(_0x5a8884,null))[_0x0300('0x28')](function(_0x1872b5){if(_0x1872b5){_0x87c405[_0x0300('0x4d')]['DashboardId']=_0x1872b5['id'];_0x87c405[_0x0300('0x4d')][_0x0300('0x5b')]=widgetAttributes(_0x87c405[_0x0300('0x4d')]);return db[_0x0300('0x7c')][_0x0300('0x4c')](_0x87c405[_0x0300('0x4d')]);}})[_0x0300('0x28')](respondWithResult(_0x5a8884,null))[_0x0300('0x55')](handleError(_0x5a8884,null));};exports[_0x0300('0x7d')]=function(_0x25c443,_0x4bcffa,_0x5e2f2b){var _0x526cb9={};var _0x1a25ac={};var _0x400df6;var _0x1e3096;return db[_0x0300('0x31')][_0x0300('0x7e')]({'where':{'id':_0x25c443[_0x0300('0x56')]['id']}})[_0x0300('0x28')](handleEntityNotFound(_0x4bcffa,null))[_0x0300('0x28')](function(_0x4a0911){if(_0x4a0911){_0x400df6=_0x4a0911;_0x1a25ac[_0x0300('0x36')]=_[_0x0300('0x49')](db['DashboardItem'][_0x0300('0x32')]);_0x1a25ac[_0x0300('0x37')]=_[_0x0300('0x49')](_0x25c443['query']);_0x1a25ac[_0x0300('0x38')]=_['intersection'](_0x1a25ac[_0x0300('0x36')],_0x1a25ac[_0x0300('0x37')]);_0x526cb9[_0x0300('0x3a')]=_[_0x0300('0x39')](_0x1a25ac[_0x0300('0x36')],qs[_0x0300('0x3b')](_0x25c443[_0x0300('0x37')][_0x0300('0x3b')]));_0x526cb9['attributes']=_0x526cb9[_0x0300('0x3a')][_0x0300('0x3c')]?_0x526cb9[_0x0300('0x3a')]:_0x1a25ac[_0x0300('0x36')];_0x526cb9['order']=qs[_0x0300('0x3f')](_0x25c443[_0x0300('0x37')][_0x0300('0x3f')]);_0x526cb9[_0x0300('0x40')]=qs[_0x0300('0x38')](_[_0x0300('0x41')](_0x25c443[_0x0300('0x37')],_0x1a25ac[_0x0300('0x38')]));if(_0x25c443[_0x0300('0x37')][_0x0300('0x42')]){_0x526cb9[_0x0300('0x40')]=_[_0x0300('0x43')](_0x526cb9['where'],{'$or':_[_0x0300('0x30')](_0x526cb9['attributes'],function(_0x3adb80){var _0x58e39a={};_0x58e39a[_0x3adb80]={'$like':'%'+_0x25c443[_0x0300('0x37')]['filter']+'%'};return _0x58e39a;})});}_0x526cb9=_[_0x0300('0x43')]({},_0x526cb9,_0x25c443[_0x0300('0x4a')]);return _0x400df6['getItems'](_0x526cb9);}})[_0x0300('0x28')](function(_0x1f688e){if(_0x1f688e){_0x1e3096=_0x1f688e['length'];if(!_0x25c443[_0x0300('0x37')]['hasOwnProperty'](_0x0300('0x3d'))){_0x526cb9[_0x0300('0x21')]=qs[_0x0300('0x21')](_0x25c443[_0x0300('0x37')][_0x0300('0x21')]);_0x526cb9[_0x0300('0x1e')]=qs[_0x0300('0x1e')](_0x25c443[_0x0300('0x37')][_0x0300('0x1e')]);}return _0x400df6['getItems'](_0x526cb9);}})['then'](function(_0x458c7a){if(_0x458c7a){return _0x458c7a?{'count':_0x1e3096,'rows':_0x458c7a}:null;}})['then'](respondWithResult(_0x4bcffa,null))['catch'](handleError(_0x4bcffa,null));}; \ No newline at end of file +var _0x5261=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','findOne','DashboardItem','pick','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','body','user','role','CustomDashboards','UserProfileSection','find','autoAssociation','create','clone','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x430289,_0x584208){var _0x22e42a=function(_0x46aef8){while(--_0x46aef8){_0x430289['push'](_0x430289['shift']());}};_0x22e42a(++_0x584208);}(_0x5261,0x197));var _0x1526=function(_0x5b5f31,_0x50afdd){_0x5b5f31=_0x5b5f31-0x0;var _0x14d116=_0x5261[_0x5b5f31];return _0x14d116;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1526('0x0'));var zipdir=require(_0x1526('0x1'));var jsonpatch=require(_0x1526('0x2'));var rp=require(_0x1526('0x3'));var moment=require(_0x1526('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1526('0x5'));var path=require(_0x1526('0x6'));var sox=require('sox');var csv=require(_0x1526('0x7'));var ejs=require(_0x1526('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1526('0x9'));var squel=require(_0x1526('0xa'));var crypto=require(_0x1526('0xb'));var jsforce=require(_0x1526('0xc'));var deskjs=require(_0x1526('0xd'));var toCsv=require(_0x1526('0x7'));var querystring=require(_0x1526('0xe'));var Papa=require(_0x1526('0xf'));var Redis=require(_0x1526('0x10'));var authService=require(_0x1526('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1526('0x12'));var logger=require('../../config/logger')(_0x1526('0x13'));var utils=require(_0x1526('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1526('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1526('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1526('0x16')]));require(_0x1526('0x17'))[_0x1526('0x18')](socket);function respondWithStatusCode(_0x399589,_0xee7de2){_0xee7de2=_0xee7de2||0xcc;return function(_0x543c4b){if(_0x543c4b){return _0x399589[_0x1526('0x19')](_0xee7de2);}return _0x399589[_0x1526('0x1a')](_0xee7de2)[_0x1526('0x1b')]();};}function respondWithResult(_0x80743c,_0x3d37aa){_0x3d37aa=_0x3d37aa||0xc8;return function(_0x38333a){if(_0x38333a){return _0x80743c[_0x1526('0x1a')](_0x3d37aa)['json'](_0x38333a);}};}function respondWithFilteredResult(_0x39823e,_0x224d21){return function(_0x137898){if(_0x137898){var _0x554b24=typeof _0x224d21[_0x1526('0x1c')]===_0x1526('0x1d')&&typeof _0x224d21['limit']===_0x1526('0x1d');var _0x46f0bf=_0x137898['count'];var _0x2037bb=_0x554b24?0x0:_0x224d21[_0x1526('0x1c')];var _0x10e10c=_0x554b24?_0x137898[_0x1526('0x1e')]:_0x224d21[_0x1526('0x1c')]+_0x224d21[_0x1526('0x1f')];var _0x212969;if(_0x10e10c>=_0x46f0bf){_0x10e10c=_0x46f0bf;_0x212969=0xc8;}else{_0x212969=0xce;}_0x39823e[_0x1526('0x1a')](_0x212969);return _0x39823e[_0x1526('0x20')](_0x1526('0x21'),_0x2037bb+'-'+_0x10e10c+'/'+_0x46f0bf)['json'](_0x137898);}return null;};}function patchUpdates(_0x4c1c07){return function(_0x253604){try{jsonpatch[_0x1526('0x22')](_0x253604,_0x4c1c07,!![]);}catch(_0x3d021e){return BPromise[_0x1526('0x23')](_0x3d021e);}return _0x253604[_0x1526('0x24')]();};}function saveUpdates(_0x2af820,_0x4c517e){return function(_0x581815){if(_0x581815){return _0x581815[_0x1526('0x25')](_0x2af820)[_0x1526('0x26')](function(_0x2dbbf2){return _0x2dbbf2;});}return null;};}function removeEntity(_0x4714a1,_0xa42d81){return function(_0x3ef995){if(_0x3ef995){return _0x3ef995[_0x1526('0x27')]()[_0x1526('0x26')](function(){var _0x501340=_0x3ef995[_0x1526('0x28')]({'plain':!![]});var _0x231f19='CustomDashboards';return db[_0x1526('0x29')][_0x1526('0x27')]({'where':{'type':_0x231f19,'resourceId':_0x501340['id']}})[_0x1526('0x26')](function(){return _0x3ef995;});})[_0x1526('0x26')](function(){_0x4714a1[_0x1526('0x1a')](0xcc)[_0x1526('0x1b')]();});}};}function handleEntityNotFound(_0x4a964c,_0x287ab6){return function(_0xe46d3d){if(!_0xe46d3d){_0x4a964c[_0x1526('0x19')](0x194);}return _0xe46d3d;};}function handleError(_0x1924f3,_0x41d0dd){_0x41d0dd=_0x41d0dd||0x1f4;return function(_0x4cc3d9){logger[_0x1526('0x2a')](_0x4cc3d9[_0x1526('0x2b')]);if(_0x4cc3d9[_0x1526('0x2c')]){delete _0x4cc3d9[_0x1526('0x2c')];}_0x1924f3[_0x1526('0x1a')](_0x41d0dd)[_0x1526('0x2d')](_0x4cc3d9);};}exports[_0x1526('0x2e')]=function(_0xa84cb9,_0x1a18fb){var _0x3788da={},_0x1bc138={},_0x1de8f4={'count':0x0,'rows':[]};var _0x25a058=_['map'](db[_0x1526('0x2f')][_0x1526('0x30')],function(_0x19f661){return{'name':_0x19f661[_0x1526('0x31')],'type':_0x19f661[_0x1526('0x32')][_0x1526('0x33')]};});_0x1bc138[_0x1526('0x34')]=_[_0x1526('0x35')](_0x25a058,_0x1526('0x2c'));_0x1bc138[_0x1526('0x36')]=_[_0x1526('0x37')](_0xa84cb9[_0x1526('0x36')]);_0x1bc138[_0x1526('0x38')]=_[_0x1526('0x39')](_0x1bc138[_0x1526('0x34')],_0x1bc138['query']);_0x3788da[_0x1526('0x3a')]=_[_0x1526('0x39')](_0x1bc138['model'],qs[_0x1526('0x3b')](_0xa84cb9[_0x1526('0x36')][_0x1526('0x3b')]));_0x3788da['attributes']=_0x3788da[_0x1526('0x3a')]['length']?_0x3788da[_0x1526('0x3a')]:_0x1bc138[_0x1526('0x34')];if(!_0xa84cb9[_0x1526('0x36')][_0x1526('0x3c')]('nolimit')){_0x3788da[_0x1526('0x1f')]=qs[_0x1526('0x1f')](_0xa84cb9[_0x1526('0x36')][_0x1526('0x1f')]);_0x3788da[_0x1526('0x1c')]=qs['offset'](_0xa84cb9[_0x1526('0x36')]['offset']);}_0x3788da[_0x1526('0x3d')]=qs[_0x1526('0x3e')](_0xa84cb9['query']['sort']);_0x3788da['where']=qs['filters'](_['pick'](_0xa84cb9[_0x1526('0x36')],_0x1bc138[_0x1526('0x38')]),_0x25a058);if(_0xa84cb9[_0x1526('0x36')][_0x1526('0x3f')]){_0x3788da[_0x1526('0x40')]=_['merge'](_0x3788da['where'],{'$or':_[_0x1526('0x35')](_0x25a058,function(_0x124308){if(_0x124308[_0x1526('0x32')]!==_0x1526('0x41')){var _0x5081b3={};_0x5081b3[_0x124308['name']]={'$like':'%'+_0xa84cb9[_0x1526('0x36')][_0x1526('0x3f')]+'%'};return _0x5081b3;}})});}_0x3788da=_['merge']({},_0x3788da,_0xa84cb9[_0x1526('0x42')]);var _0x16ae34={'where':_0x3788da[_0x1526('0x40')]};return db['Dashboard']['count'](_0x16ae34)[_0x1526('0x26')](function(_0x994562){_0x1de8f4[_0x1526('0x1e')]=_0x994562;if(_0xa84cb9[_0x1526('0x36')][_0x1526('0x43')]){_0x3788da[_0x1526('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0x1526('0x45')](_0x3788da);})[_0x1526('0x26')](function(_0x27060c){_0x1de8f4[_0x1526('0x46')]=_0x27060c;return _0x1de8f4;})['then'](respondWithFilteredResult(_0x1a18fb,_0x3788da))[_0x1526('0x47')](handleError(_0x1a18fb,null));};exports[_0x1526('0x48')]=function(_0x16f6cd,_0x85884a){var _0x35dd2e={'raw':![],'where':{'id':_0x16f6cd[_0x1526('0x49')]['id']}},_0x2e75fb={};_0x2e75fb[_0x1526('0x34')]=_[_0x1526('0x37')](db[_0x1526('0x2f')][_0x1526('0x30')]);_0x2e75fb[_0x1526('0x36')]=_[_0x1526('0x37')](_0x16f6cd['query']);_0x2e75fb[_0x1526('0x38')]=_[_0x1526('0x39')](_0x2e75fb[_0x1526('0x34')],_0x2e75fb[_0x1526('0x36')]);_0x35dd2e[_0x1526('0x3a')]=_[_0x1526('0x39')](_0x2e75fb[_0x1526('0x34')],qs[_0x1526('0x3b')](_0x16f6cd[_0x1526('0x36')][_0x1526('0x3b')]));_0x35dd2e[_0x1526('0x3a')]=_0x35dd2e[_0x1526('0x3a')][_0x1526('0x4a')]?_0x35dd2e[_0x1526('0x3a')]:_0x2e75fb['model'];if(_0x16f6cd[_0x1526('0x36')][_0x1526('0x43')]){_0x35dd2e[_0x1526('0x44')]=[{'all':!![]}];}_0x35dd2e=_[_0x1526('0x4b')]({},_0x35dd2e,_0x16f6cd[_0x1526('0x42')]);return db['Dashboard']['find'](_0x35dd2e)[_0x1526('0x26')](handleEntityNotFound(_0x85884a,null))[_0x1526('0x26')](respondWithResult(_0x85884a,null))[_0x1526('0x47')](handleError(_0x85884a,null));};exports['create']=function(_0x5a9189,_0x3db29b){return db[_0x1526('0x2f')]['create'](_0x5a9189[_0x1526('0x4c')],{})[_0x1526('0x26')](function(_0x2ffa1f){var _0x1ad634=_0x5a9189[_0x1526('0x4d')][_0x1526('0x28')]({'plain':!![]});if(!_0x1ad634)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ad634[_0x1526('0x4e')]===_0x1526('0x4d')){var _0x561420=_0x2ffa1f[_0x1526('0x28')]({'plain':!![]});var _0x1df0a4=_0x1526('0x4f');return db[_0x1526('0x50')][_0x1526('0x51')]({'where':{'name':_0x1df0a4,'userProfileId':_0x1ad634['userProfileId']},'raw':!![]})[_0x1526('0x26')](function(_0x3dd7fd){if(_0x3dd7fd&&_0x3dd7fd[_0x1526('0x52')]===0x0){return db[_0x1526('0x29')][_0x1526('0x53')]({'name':_0x561420[_0x1526('0x2c')],'resourceId':_0x561420['id'],'type':_0x3dd7fd[_0x1526('0x2c')],'sectionId':_0x3dd7fd['id']},{})[_0x1526('0x26')](function(){return _0x2ffa1f;});}else{return _0x2ffa1f;}})[_0x1526('0x47')](function(_0x4072fc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4072fc);throw _0x4072fc;});}return _0x2ffa1f;})[_0x1526('0x26')](respondWithResult(_0x3db29b,0xc9))['catch'](handleError(_0x3db29b,null));};exports[_0x1526('0x54')]=function(_0x32abd4,_0x22f299){var _0x5f1e78={'where':{'id':_0x32abd4[_0x1526('0x49')]['id']}},_0x1967b7={};_0x1967b7[_0x1526('0x34')]=_[_0x1526('0x37')](db['Dashboard'][_0x1526('0x30')]);_0x5f1e78[_0x1526('0x3a')]=_[_0x1526('0x39')](_0x1967b7[_0x1526('0x34')],qs[_0x1526('0x3b')](_0x32abd4[_0x1526('0x36')][_0x1526('0x3b')]));_0x5f1e78[_0x1526('0x3a')]=_0x5f1e78[_0x1526('0x3a')][_0x1526('0x4a')]?_0x5f1e78[_0x1526('0x3a')]:_0x1967b7[_0x1526('0x34')];if(_0x32abd4[_0x1526('0x36')][_0x1526('0x43')]){_0x5f1e78[_0x1526('0x44')]=[{'all':!![]}];}_0x5f1e78=_['merge']({},_0x5f1e78,_0x32abd4[_0x1526('0x42')]);return db[_0x1526('0x2f')][_0x1526('0x51')](_0x5f1e78)[_0x1526('0x26')](handleEntityNotFound(_0x22f299,null))['then'](function(_0xcef25){if(_0xcef25){var _0x5d6210=_0xcef25[_0x1526('0x28')]({'plain':!![]});_0x5d6210=qs['omit'](_0x5d6210,['id','createdAt','updatedAt']);_0x32abd4[_0x1526('0x4c')]=_[_0x1526('0x55')](_0x32abd4[_0x1526('0x4c')],['id',_0x1526('0x56'),'updatedAt']);return db[_0x1526('0x2f')]['create'](_[_0x1526('0x4b')](_0x5d6210,_0x32abd4['body']),{'include':_0x32abd4['query'][_0x1526('0x43')]?[{'all':!![]}]:undefined})[_0x1526('0x26')](function(_0x49b686){var _0x543215=_0x32abd4[_0x1526('0x4d')][_0x1526('0x28')]({'plain':!![]});if(!_0x543215)throw new Error(_0x1526('0x57'));if(_0x543215['role']===_0x1526('0x4d')){var _0x1ac3f2=_0x49b686[_0x1526('0x28')]({'plain':!![]});var _0xe699fd=_0x1526('0x4f');return db[_0x1526('0x50')][_0x1526('0x51')]({'where':{'name':_0xe699fd,'userProfileId':_0x543215['userProfileId']},'raw':!![]})[_0x1526('0x26')](function(_0xe4dcf5){if(_0xe4dcf5&&_0xe4dcf5['autoAssociation']===0x0){return db[_0x1526('0x29')][_0x1526('0x53')]({'name':_0x1ac3f2[_0x1526('0x2c')],'resourceId':_0x1ac3f2['id'],'type':_0xe4dcf5[_0x1526('0x2c')],'sectionId':_0xe4dcf5['id']},{})['then'](function(){return _0x49b686;});}else{return _0x49b686;}})['catch'](function(_0x54d4cb){logger[_0x1526('0x2a')](_0x1526('0x58'),_0x54d4cb);throw _0x54d4cb;});}return _0x49b686;});}})['then'](respondWithResult(_0x22f299,0xc9))[_0x1526('0x47')](handleError(_0x22f299,null));};exports['update']=function(_0x463b01,_0x1b1b7e){if(_0x463b01[_0x1526('0x4c')]['id']){delete _0x463b01['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x463b01[_0x1526('0x49')]['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x1b1b7e,null))['then'](saveUpdates(_0x463b01[_0x1526('0x4c')],null))[_0x1526('0x26')](respondWithResult(_0x1b1b7e,null))[_0x1526('0x47')](handleError(_0x1b1b7e,null));};exports[_0x1526('0x27')]=function(_0x56dc0d,_0x4fb1b5){return db['Dashboard'][_0x1526('0x51')]({'where':{'id':_0x56dc0d[_0x1526('0x49')]['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x4fb1b5,null))['then'](removeEntity(_0x4fb1b5,null))['catch'](handleError(_0x4fb1b5,null));};function widgetAttributes(_0x4fc22e){try{switch(_0x4fc22e[_0x1526('0x32')]){case'iframe':return[{'name':_0x1526('0x59'),'value':_0x4fc22e[_0x1526('0x59')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x0]?_0x4fc22e['attrs'][0x0][_0x1526('0x5b')]:undefined)||_0x1526('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x4fc22e[_0x1526('0x5d')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x0]?_0x4fc22e[_0x1526('0x5a')][0x0][_0x1526('0x5b')]:undefined)||''}];case _0x1526('0x5e'):return[{'name':_0x1526('0x5f'),'value':_0x4fc22e[_0x1526('0x5f')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x0]?_0x4fc22e[_0x1526('0x5a')][0x0][_0x1526('0x5b')]:undefined)||_0x1526('0x60')},{'name':'attrTimezone','value':_0x4fc22e[_0x1526('0x61')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x1]?_0x4fc22e[_0x1526('0x5a')][0x1][_0x1526('0x5b')]:undefined)||_0x1526('0x62')},{'name':_0x1526('0x63'),'value':_0x4fc22e[_0x1526('0x63')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x2]?_0x4fc22e[_0x1526('0x5a')][0x2][_0x1526('0x5b')]:undefined)||0xc}];case _0x1526('0x64'):return[{'name':_0x1526('0x65'),'value':_0x4fc22e['attrMetric']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e['attrs'][0x0]?_0x4fc22e[_0x1526('0x5a')][0x0][_0x1526('0x5b')]:undefined)||_0x1526('0x66')},{'name':_0x1526('0x67'),'value':_0x4fc22e[_0x1526('0x67')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x1]?_0x4fc22e[_0x1526('0x5a')][0x1][_0x1526('0x5b')]:undefined)||[]},{'name':'attrFontSize','value':_0x4fc22e['attrFontSize']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x2]?_0x4fc22e[_0x1526('0x5a')][0x2]['value']:undefined)||0x14},{'name':_0x1526('0x68'),'value':_0x4fc22e['attrChannel']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x3]?_0x4fc22e['attrs'][0x3][_0x1526('0x5b')]:undefined)||_0x1526('0x69')},{'name':'attrEmailAccounts','value':_0x4fc22e[_0x1526('0x6a')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x4]?_0x4fc22e[_0x1526('0x5a')][0x4]['value']:undefined)||''},{'name':_0x1526('0x6b'),'value':_0x4fc22e[_0x1526('0x6b')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x5]?_0x4fc22e[_0x1526('0x5a')][0x5][_0x1526('0x5b')]:undefined)||''},{'name':_0x1526('0x6c'),'value':_0x4fc22e[_0x1526('0x6c')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e['attrs'][0x6]?_0x4fc22e[_0x1526('0x5a')][0x6][_0x1526('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4fc22e[_0x1526('0x6d')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x7]?_0x4fc22e[_0x1526('0x5a')][0x7]['value']:undefined)||''},{'name':_0x1526('0x6e'),'value':_0x4fc22e[_0x1526('0x6e')]||(_0x4fc22e['attrs']&&_0x4fc22e['attrs'][0x8]?_0x4fc22e[_0x1526('0x5a')][0x8]['value']:undefined)||''},{'name':_0x1526('0x6f'),'value':_0x4fc22e['attrChatWebsites']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x9]?_0x4fc22e[_0x1526('0x5a')][0x9]['value']:undefined)||''}];case _0x1526('0x70'):case _0x1526('0x71'):return[{'name':_0x1526('0x72'),'value':_0x4fc22e[_0x1526('0x72')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e['attrs'][0x0]?_0x4fc22e['attrs'][0x0]['value']:undefined)||_0x1526('0x66')},{'name':_0x1526('0x73'),'value':_0x4fc22e[_0x1526('0x73')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x1]?_0x4fc22e[_0x1526('0x5a')][0x1][_0x1526('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x4fc22e[_0x1526('0x74')]||(_0x4fc22e['attrs']&&_0x4fc22e[_0x1526('0x5a')][0x2]?_0x4fc22e[_0x1526('0x5a')][0x2]['value']:undefined)||null},{'name':_0x1526('0x67'),'value':_0x4fc22e[_0x1526('0x67')]||(_0x4fc22e['attrs']&&_0x4fc22e['attrs'][0x3]?_0x4fc22e['attrs'][0x3][_0x1526('0x5b')]:undefined)||[]},{'name':_0x1526('0x68'),'value':_0x4fc22e[_0x1526('0x68')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x4]?_0x4fc22e['attrs'][0x4][_0x1526('0x5b')]:undefined)||'voice'},{'name':_0x1526('0x6a'),'value':_0x4fc22e[_0x1526('0x6a')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x5]?_0x4fc22e[_0x1526('0x5a')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x4fc22e[_0x1526('0x6b')]||(_0x4fc22e['attrs']&&_0x4fc22e['attrs'][0x6]?_0x4fc22e[_0x1526('0x5a')][0x6][_0x1526('0x5b')]:undefined)||''},{'name':_0x1526('0x6c'),'value':_0x4fc22e['attrSmsAccounts']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x7]?_0x4fc22e[_0x1526('0x5a')][0x7][_0x1526('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4fc22e[_0x1526('0x6d')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x8]?_0x4fc22e[_0x1526('0x5a')][0x8][_0x1526('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4fc22e['attrWhatsappAccounts']||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x9]?_0x4fc22e[_0x1526('0x5a')][0x9][_0x1526('0x5b')]:undefined)||''},{'name':_0x1526('0x6f'),'value':_0x4fc22e[_0x1526('0x6f')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0xa]?_0x4fc22e[_0x1526('0x5a')][0xa][_0x1526('0x5b')]:undefined)||''}];case _0x1526('0x75'):return[{'name':_0x1526('0x76'),'type':_0x4fc22e[_0x1526('0x77')]||(_0x4fc22e['attrs']&&_0x4fc22e['attrs'][0x0]?_0x4fc22e[_0x1526('0x5a')][0x0]['type']:undefined)||null,'value':_0x4fc22e[_0x1526('0x76')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x0]?_0x4fc22e[_0x1526('0x5a')][0x0][_0x1526('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x4fc22e[_0x1526('0x78')]||(_0x4fc22e[_0x1526('0x5a')]&&_0x4fc22e[_0x1526('0x5a')][0x1]?_0x4fc22e['attrs'][0x1][_0x1526('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x20062e){logger[_0x1526('0x2a')](_0x1526('0x79'),JSON['stringify'](_0x20062e));return[];}}exports[_0x1526('0x7a')]=function(_0xf03ab,_0x4dc032,_0x225f1f){if(_0xf03ab[_0x1526('0x4c')]['id']){delete _0xf03ab[_0x1526('0x4c')]['id'];}return db['Dashboard'][_0x1526('0x51')]({'where':{'id':_0xf03ab['params']['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x4dc032,null))[_0x1526('0x26')](function(_0x25f9aa){if(_0x25f9aa){_0xf03ab[_0x1526('0x4c')][_0x1526('0x7b')]=_0x25f9aa['id'];_0xf03ab[_0x1526('0x4c')]['attrs']=widgetAttributes(_0xf03ab[_0x1526('0x4c')]);return db['DashboardItem']['create'](_0xf03ab[_0x1526('0x4c')]);}})[_0x1526('0x26')](respondWithResult(_0x4dc032,null))['catch'](handleError(_0x4dc032,null));};exports[_0x1526('0x7c')]=function(_0x10aa41,_0x26a075,_0x23ea1c){var _0x129c71={};var _0x11136c={};var _0x5aa2a9;var _0x5e2555;return db['Dashboard'][_0x1526('0x7d')]({'where':{'id':_0x10aa41[_0x1526('0x49')]['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x26a075,null))[_0x1526('0x26')](function(_0x4e3538){if(_0x4e3538){_0x5aa2a9=_0x4e3538;_0x11136c[_0x1526('0x34')]=_[_0x1526('0x37')](db[_0x1526('0x7e')][_0x1526('0x30')]);_0x11136c[_0x1526('0x36')]=_[_0x1526('0x37')](_0x10aa41[_0x1526('0x36')]);_0x11136c[_0x1526('0x38')]=_['intersection'](_0x11136c[_0x1526('0x34')],_0x11136c['query']);_0x129c71['attributes']=_['intersection'](_0x11136c[_0x1526('0x34')],qs['fields'](_0x10aa41[_0x1526('0x36')][_0x1526('0x3b')]));_0x129c71[_0x1526('0x3a')]=_0x129c71['attributes'][_0x1526('0x4a')]?_0x129c71[_0x1526('0x3a')]:_0x11136c['model'];_0x129c71[_0x1526('0x3d')]=qs[_0x1526('0x3e')](_0x10aa41[_0x1526('0x36')][_0x1526('0x3e')]);_0x129c71['where']=qs[_0x1526('0x38')](_[_0x1526('0x7f')](_0x10aa41[_0x1526('0x36')],_0x11136c[_0x1526('0x38')]));if(_0x10aa41[_0x1526('0x36')][_0x1526('0x3f')]){_0x129c71[_0x1526('0x40')]=_[_0x1526('0x4b')](_0x129c71['where'],{'$or':_[_0x1526('0x35')](_0x129c71[_0x1526('0x3a')],function(_0x4e539a){var _0x29249b={};_0x29249b[_0x4e539a]={'$like':'%'+_0x10aa41['query'][_0x1526('0x3f')]+'%'};return _0x29249b;})});}_0x129c71=_[_0x1526('0x4b')]({},_0x129c71,_0x10aa41['options']);return _0x5aa2a9[_0x1526('0x7c')](_0x129c71);}})[_0x1526('0x26')](function(_0x3df925){if(_0x3df925){_0x5e2555=_0x3df925['length'];if(!_0x10aa41[_0x1526('0x36')]['hasOwnProperty'](_0x1526('0x80'))){_0x129c71[_0x1526('0x1f')]=qs[_0x1526('0x1f')](_0x10aa41[_0x1526('0x36')][_0x1526('0x1f')]);_0x129c71['offset']=qs[_0x1526('0x1c')](_0x10aa41[_0x1526('0x36')]['offset']);}return _0x5aa2a9[_0x1526('0x7c')](_0x129c71);}})[_0x1526('0x26')](function(_0x1d988e){if(_0x1d988e){return _0x1d988e?{'count':_0x5e2555,'rows':_0x1d988e}:null;}})[_0x1526('0x26')](respondWithResult(_0x26a075,null))[_0x1526('0x47')](handleError(_0x26a075,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6afac38..80b34be 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 _0x7cc4=['save','update','remove','hasOwnProperty','hook','setMaxListeners'];(function(_0x158f93,_0x85a1eb){var _0x3f0186=function(_0x14d4ad){while(--_0x14d4ad){_0x158f93['push'](_0x158f93['shift']());}};_0x3f0186(++_0x85a1eb);}(_0x7cc4,0x155));var _0x47cc=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x7cc4[_0x98db33];return _0x5ae63a;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x47cc('0x0')](0x0);var events={'afterCreate':_0x47cc('0x1'),'afterUpdate':_0x47cc('0x2'),'afterDestroy':_0x47cc('0x3')};function emitEvent(_0x353486){return function(_0x202709,_0x17f328,_0x5e1e2e){DashboardEvents['emit'](_0x353486+':'+_0x202709['id'],_0x202709);DashboardEvents['emit'](_0x353486,_0x202709);_0x5e1e2e(null);};}for(var e in events){if(events[_0x47cc('0x4')](e)){var event=events[e];Dashboard[_0x47cc('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x2384=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save'];(function(_0xb8d9af,_0x4543b9){var _0x3526bc=function(_0x124d25){while(--_0x124d25){_0xb8d9af['push'](_0xb8d9af['shift']());}};_0x3526bc(++_0x4543b9);}(_0x2384,0x1aa));var _0x4238=function(_0x2854dc,_0x2e2f89){_0x2854dc=_0x2854dc-0x0;var _0x585e9b=_0x2384[_0x2854dc];return _0x585e9b;};'use strict';var EventEmitter=require(_0x4238('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x4238('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4238('0x2')](0x0);var events={'afterCreate':_0x4238('0x3'),'afterUpdate':_0x4238('0x4'),'afterDestroy':_0x4238('0x5')};function emitEvent(_0x568c26){return function(_0x3a6835,_0x5560f3,_0x2a8c5c){DashboardEvents[_0x4238('0x6')](_0x568c26+':'+_0x3a6835['id'],_0x3a6835);DashboardEvents[_0x4238('0x6')](_0x568c26,_0x3a6835);_0x2a8c5c(null);};}for(var e in events){if(events[_0x4238('0x7')](e)){var event=events[e];Dashboard[_0x4238('0x8')](e,emitEvent(event));}}module[_0x4238('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 610f331..cb8e14f 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 _0xae4e=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5208fa,_0x2e0115){var _0x340255=function(_0x243db1){while(--_0x243db1){_0x5208fa['push'](_0x5208fa['shift']());}};_0x340255(++_0x2e0115);}(_0xae4e,0x14b));var _0xeae4=function(_0x16b7d7,_0x8fc0f8){_0x16b7d7=_0x16b7d7-0x0;var _0x5e8328=_0xae4e[_0x16b7d7];return _0x5e8328;};'use strict';var _=require(_0xeae4('0x0'));var util=require(_0xeae4('0x1'));var logger=require(_0xeae4('0x2'))(_0xeae4('0x3'));var moment=require(_0xeae4('0x4'));var BPromise=require(_0xeae4('0x5'));var rp=require(_0xeae4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeae4('0x7'));var config=require(_0xeae4('0x8'));var attributes=require(_0xeae4('0x9'));module[_0xeae4('0xa')]=function(_0x48127b,_0x3359c7){return _0x48127b[_0xeae4('0xb')](_0xeae4('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ae=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1a0cea,_0x399967){var _0x5e34b1=function(_0x35d842){while(--_0x35d842){_0x1a0cea['push'](_0x1a0cea['shift']());}};_0x5e34b1(++_0x399967);}(_0x46ae,0x190));var _0xe46a=function(_0x13f3f0,_0x151e5a){_0x13f3f0=_0x13f3f0-0x0;var _0x350c87=_0x46ae[_0x13f3f0];return _0x350c87;};'use strict';var _=require(_0xe46a('0x0'));var util=require(_0xe46a('0x1'));var logger=require(_0xe46a('0x2'))(_0xe46a('0x3'));var moment=require(_0xe46a('0x4'));var BPromise=require(_0xe46a('0x5'));var rp=require(_0xe46a('0x6'));var fs=require('fs');var path=require(_0xe46a('0x7'));var rimraf=require('rimraf');var config=require(_0xe46a('0x8'));var attributes=require(_0xe46a('0x9'));module[_0xe46a('0xa')]=function(_0x4cb092,_0x599d12){return _0x4cb092[_0xe46a('0xb')](_0xe46a('0xc'),attributes,{'tableName':_0xe46a('0xd'),'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 302e4bf..ae10f47 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 _0x6212=['defaults','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6212,0xad));var _0x2621=function(_0x1ce62c,_0x46b942){_0x1ce62c=_0x1ce62c-0x0;var _0x3c6476=_0x6212[_0x1ce62c];return _0x3c6476;};'use strict';var _=require(_0x2621('0x0'));var util=require(_0x2621('0x1'));var moment=require('moment');var BPromise=require(_0x2621('0x2'));var rs=require(_0x2621('0x3'));var fs=require('fs');var Redis=require(_0x2621('0x4'));var db=require(_0x2621('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2621('0x6'));var config=require('../../config/environment');var jayson=require(_0x2621('0x7'));var client=jayson['client'][_0x2621('0x8')]({'port':0x232a});config['redis']=_[_0x2621('0x9')](config[_0x2621('0xa')],{'host':_0x2621('0xb'),'port':0x18eb});var socket=require(_0x2621('0xc'))(new Redis(config[_0x2621('0xa')]));require(_0x2621('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a6f31,_0x53c427,_0x4ac890){return new BPromise(function(_0x23c319,_0x5da51f){return client[_0x2621('0xe')](_0x5a6f31,_0x4ac890)[_0x2621('0xf')](function(_0x15b843){logger[_0x2621('0x10')](_0x2621('0x11'),_0x53c427,'request\x20sent');logger['debug'](_0x2621('0x12'),_0x53c427,_0x2621('0x13'),JSON[_0x2621('0x14')](_0x15b843));if(_0x15b843[_0x2621('0x15')]){if(_0x15b843[_0x2621('0x15')][_0x2621('0x16')]===0x1f4){logger[_0x2621('0x15')](_0x2621('0x11'),_0x53c427,_0x15b843[_0x2621('0x15')][_0x2621('0x17')]);return _0x5da51f(_0x15b843[_0x2621('0x15')]['message']);}logger[_0x2621('0x15')](_0x2621('0x11'),_0x53c427,_0x15b843[_0x2621('0x15')][_0x2621('0x17')]);return _0x23c319(_0x15b843[_0x2621('0x15')][_0x2621('0x17')]);}else{logger['info'](_0x2621('0x11'),_0x53c427,_0x2621('0x13'));_0x23c319(_0x15b843[_0x2621('0x18')][_0x2621('0x17')]);}})[_0x2621('0x19')](function(_0x1b4626){logger['error'](_0x2621('0x11'),_0x53c427,_0x1b4626);_0x5da51f(_0x1b4626);});});} \ No newline at end of file +var _0x8545=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x239583,_0x11b852){var _0x3b7a88=function(_0xc92ed2){while(--_0xc92ed2){_0x239583['push'](_0x239583['shift']());}};_0x3b7a88(++_0x11b852);}(_0x8545,0x70));var _0x5854=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8545[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5854('0x0'));var util=require(_0x5854('0x1'));var moment=require(_0x5854('0x2'));var BPromise=require('bluebird');var rs=require(_0x5854('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5854('0x4'))['db'];var utils=require(_0x5854('0x5'));var logger=require(_0x5854('0x6'))(_0x5854('0x7'));var config=require(_0x5854('0x8'));var jayson=require(_0x5854('0x9'));var client=jayson[_0x5854('0xa')][_0x5854('0xb')]({'port':0x232a});config[_0x5854('0xc')]=_[_0x5854('0xd')](config[_0x5854('0xc')],{'host':_0x5854('0xe'),'port':0x18eb});var socket=require(_0x5854('0xf'))(new Redis(config[_0x5854('0xc')]));require(_0x5854('0x10'))['register'](socket);function respondWithRpcPromise(_0x421851,_0xf35223,_0x24a152){return new BPromise(function(_0x5e483a,_0x52febc){return client[_0x5854('0x11')](_0x421851,_0x24a152)[_0x5854('0x12')](function(_0x56c992){logger['info']('Dashboard,\x20%s,\x20%s',_0xf35223,_0x5854('0x13'));logger[_0x5854('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xf35223,'request\x20sent',JSON[_0x5854('0x15')](_0x56c992));if(_0x56c992[_0x5854('0x16')]){if(_0x56c992[_0x5854('0x16')][_0x5854('0x17')]===0x1f4){logger[_0x5854('0x16')](_0x5854('0x18'),_0xf35223,_0x56c992[_0x5854('0x16')]['message']);return _0x52febc(_0x56c992[_0x5854('0x16')]['message']);}logger[_0x5854('0x16')](_0x5854('0x18'),_0xf35223,_0x56c992[_0x5854('0x16')][_0x5854('0x19')]);return _0x5e483a(_0x56c992[_0x5854('0x16')][_0x5854('0x19')]);}else{logger[_0x5854('0x1a')](_0x5854('0x18'),_0xf35223,_0x5854('0x13'));_0x5e483a(_0x56c992[_0x5854('0x1b')][_0x5854('0x19')]);}})[_0x5854('0x1c')](function(_0x2d0d36){logger['error'](_0x5854('0x18'),_0xf35223,_0x2d0d36);_0x52febc(_0x2d0d36);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4331365..ca68fc1 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 _0xdca9=['dashboard:','./dashboard.events','remove','update','emit','register','length'];(function(_0x41a0c7,_0x3e657b){var _0x325531=function(_0x4e2060){while(--_0x4e2060){_0x41a0c7['push'](_0x41a0c7['shift']());}};_0x325531(++_0x3e657b);}(_0xdca9,0x189));var _0x9dca=function(_0x4bb762,_0x17a0ee){_0x4bb762=_0x4bb762-0x0;var _0x4ef7e5=_0xdca9[_0x4bb762];return _0x4ef7e5;};'use strict';var DashboardEvents=require(_0x9dca('0x0'));var events=['save',_0x9dca('0x1'),_0x9dca('0x2')];function createListener(_0x2ede43,_0x495ca2){return function(_0x239f4c){_0x495ca2[_0x9dca('0x3')](_0x2ede43,_0x239f4c);};}function removeListener(_0x16e070,_0x4c0111){return function(){DashboardEvents['removeListener'](_0x16e070,_0x4c0111);};}exports[_0x9dca('0x4')]=function(_0x392a12){for(var _0x445897=0x0,_0x5a267f=events[_0x9dca('0x5')];_0x445897<_0x5a267f;_0x445897++){var _0x108ef5=events[_0x445897];var _0x4cb07a=createListener(_0x9dca('0x6')+_0x108ef5,_0x392a12);DashboardEvents['on'](_0x108ef5,_0x4cb07a);}}; \ No newline at end of file +var _0x78c5=['save','emit','register','length','dashboard:','./dashboard.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x78c5,0xa7));var _0x578c=function(_0x41d67e,_0x336a28){_0x41d67e=_0x41d67e-0x0;var _0x100cb2=_0x78c5[_0x41d67e];return _0x100cb2;};'use strict';var DashboardEvents=require(_0x578c('0x0'));var events=[_0x578c('0x1'),'remove','update'];function createListener(_0x39be71,_0x145c64){return function(_0x211474){_0x145c64[_0x578c('0x2')](_0x39be71,_0x211474);};}function removeListener(_0x4c29e4,_0x43dd3c){return function(){DashboardEvents['removeListener'](_0x4c29e4,_0x43dd3c);};}exports[_0x578c('0x3')]=function(_0x561c16){for(var _0x1bccd3=0x0,_0x18176f=events[_0x578c('0x4')];_0x1bccd3<_0x18176f;_0x1bccd3++){var _0x589ba3=events[_0x1bccd3];var _0x12bdf7=createListener(_0x578c('0x5')+_0x589ba3,_0x561c16);DashboardEvents['on'](_0x589ba3,_0x12bdf7);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4b08e3c..6f0c937 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 _0x9b61=['post','/:id/clone','/:id/items','addItem','update','delete','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id'];(function(_0x4c8646,_0x23ee27){var _0x3b86aa=function(_0x20d2a7){while(--_0x20d2a7){_0x4c8646['push'](_0x4c8646['shift']());}};_0x3b86aa(++_0x23ee27);}(_0x9b61,0x128));var _0x19b6=function(_0x37bad0,_0x1950b9){_0x37bad0=_0x37bad0-0x0;var _0x1154e2=_0x9b61[_0x37bad0];return _0x1154e2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x19b6('0x0'));var express=require('express');var router=express[_0x19b6('0x1')]();var fs_extra=require(_0x19b6('0x2'));var auth=require(_0x19b6('0x3'));var interaction=require(_0x19b6('0x4'));var config=require(_0x19b6('0x5'));var controller=require(_0x19b6('0x6'));router[_0x19b6('0x7')]('/',auth[_0x19b6('0x8')](),controller['index']);router[_0x19b6('0x7')](_0x19b6('0x9'),auth[_0x19b6('0x8')](),controller['show']);router[_0x19b6('0x7')]('/:id/items',auth[_0x19b6('0x8')](),controller['getItems']);router[_0x19b6('0xa')]('/',auth[_0x19b6('0x8')](),controller['create']);router['post'](_0x19b6('0xb'),auth[_0x19b6('0x8')](),controller['clone']);router[_0x19b6('0xa')](_0x19b6('0xc'),auth['isAuthenticated'](),controller[_0x19b6('0xd')]);router['put']('/:id',auth[_0x19b6('0x8')](),controller[_0x19b6('0xe')]);router[_0x19b6('0xf')](_0x19b6('0x9'),auth[_0x19b6('0x8')](),controller[_0x19b6('0x10')]);module[_0x19b6('0x11')]=router; \ No newline at end of file +var _0x03fa=['isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete','destroy','exports','multer','path','express','Router','../../config/environment','./dashboard.controller','get'];(function(_0x23510c,_0x57c298){var _0x1e7347=function(_0x54bb18){while(--_0x54bb18){_0x23510c['push'](_0x23510c['shift']());}};_0x1e7347(++_0x57c298);}(_0x03fa,0x1f3));var _0xa03f=function(_0x1096a7,_0xb2b574){_0x1096a7=_0x1096a7-0x0;var _0x107bff=_0x03fa[_0x1096a7];return _0x107bff;};'use strict';var multer=require(_0xa03f('0x0'));var util=require('util');var path=require(_0xa03f('0x1'));var timeout=require('connect-timeout');var express=require(_0xa03f('0x2'));var router=express[_0xa03f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa03f('0x4'));var controller=require(_0xa03f('0x5'));router[_0xa03f('0x6')]('/',auth[_0xa03f('0x7')](),controller[_0xa03f('0x8')]);router['get'](_0xa03f('0x9'),auth['isAuthenticated'](),controller[_0xa03f('0xa')]);router[_0xa03f('0x6')](_0xa03f('0xb'),auth[_0xa03f('0x7')](),controller[_0xa03f('0xc')]);router[_0xa03f('0xd')]('/',auth['isAuthenticated'](),controller[_0xa03f('0xe')]);router['post'](_0xa03f('0xf'),auth['isAuthenticated'](),controller[_0xa03f('0x10')]);router['post'](_0xa03f('0xb'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x11')]);router['put'](_0xa03f('0x9'),auth['isAuthenticated'](),controller[_0xa03f('0x12')]);router[_0xa03f('0x13')]('/:id',auth[_0xa03f('0x7')](),controller[_0xa03f('0x14')]);module[_0xa03f('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 26b8124..7c2a4b0 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 _0x187d=['stringify','INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0x52ba20,_0x1fd488){var _0x2e82c3=function(_0x52057b){while(--_0x52057b){_0x52ba20['push'](_0x52ba20['shift']());}};_0x2e82c3(++_0x1fd488);}(_0x187d,0x93));var _0xd187=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x187d[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xd187('0x0'));var squel=require('squel');var _=require(_0xd187('0x1'));module[_0xd187('0x2')]={'title':{'type':Sequelize[_0xd187('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd187('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){try{return JSON['parse'](this[_0xd187('0x6')](_0xd187('0x7')));}catch(_0x4ebc8d){return[];}},'set':function(_0x1d2533){try{this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')](_0x1d2533));}catch(_0x28ce2f){this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd187('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd187('0xa')]},'col':{'type':Sequelize[_0xd187('0xa')]},'background':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':_0xd187('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd187('0x3')]},'titleFontSize':{'type':Sequelize[_0xd187('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xf494=['squel','lodash','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf494,0x1c6));var _0x4f49=function(_0x17947f,_0x2b0bbc){_0x17947f=_0x17947f-0x0;var _0x5c2669=_0xf494[_0x17947f];return _0x5c2669;};'use strict';var Sequelize=require(_0x4f49('0x0'));var squel=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));module['exports']={'title':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4f49('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5')),'get':function(){try{return JSON[_0x4f49('0x6')](this[_0x4f49('0x7')](_0x4f49('0x8')));}catch(_0x790e8b){return[];}},'set':function(_0xc5e778){try{this[_0x4f49('0x9')](_0x4f49('0x8'),JSON['stringify'](_0xc5e778));}catch(_0x58e9a0){this[_0x4f49('0x9')](_0x4f49('0x8'),JSON[_0x4f49('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4f49('0xb')]},'col':{'type':Sequelize[_0x4f49('0xb')]},'background':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':_0x4f49('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x4f49('0xb')],'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 84befa3..b186c90 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 _0xf9d5=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','status','end','undefined','limit','count','offset','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','model','DashboardItem','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','type','iframe','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','rimraf'];(function(_0x34b97d,_0x103be0){var _0x43c004=function(_0x31854a){while(--_0x31854a){_0x34b97d['push'](_0x34b97d['shift']());}};_0x43c004(++_0x103be0);}(_0xf9d5,0x122));var _0x5f9d=function(_0x2a162d,_0x56fb94){_0x2a162d=_0x2a162d-0x0;var _0x4e82a7=_0xf9d5[_0x2a162d];return _0x4e82a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];config[_0x5f9d('0x18')]=_[_0x5f9d('0x19')](config[_0x5f9d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f9d('0x1a'))(new Redis(config[_0x5f9d('0x18')]));require(_0x5f9d('0x1b'))['register'](socket);function respondWithStatusCode(_0x8e2381,_0x3ae401){_0x3ae401=_0x3ae401||0xcc;return function(_0x57cb1a){if(_0x57cb1a){return _0x8e2381['sendStatus'](_0x3ae401);}return _0x8e2381[_0x5f9d('0x1c')](_0x3ae401)[_0x5f9d('0x1d')]();};}function respondWithResult(_0x3d4a1c,_0x26a76a){_0x26a76a=_0x26a76a||0xc8;return function(_0x3ffb29){if(_0x3ffb29){return _0x3d4a1c['status'](_0x26a76a)['json'](_0x3ffb29);}};}function respondWithFilteredResult(_0x54bd00,_0x3d8370){return function(_0x4fb9a5){if(_0x4fb9a5){var _0x432f1a=typeof _0x3d8370['offset']===_0x5f9d('0x1e')&&typeof _0x3d8370[_0x5f9d('0x1f')]===_0x5f9d('0x1e');var _0x55a31c=_0x4fb9a5[_0x5f9d('0x20')];var _0x16de94=_0x432f1a?0x0:_0x3d8370[_0x5f9d('0x21')];var _0x1e51d7=_0x432f1a?_0x4fb9a5[_0x5f9d('0x20')]:_0x3d8370[_0x5f9d('0x21')]+_0x3d8370[_0x5f9d('0x1f')];var _0x2563d5;if(_0x1e51d7>=_0x55a31c){_0x1e51d7=_0x55a31c;_0x2563d5=0xc8;}else{_0x2563d5=0xce;}_0x54bd00[_0x5f9d('0x1c')](_0x2563d5);return _0x54bd00['set']('Content-Range',_0x16de94+'-'+_0x1e51d7+'/'+_0x55a31c)['json'](_0x4fb9a5);}return null;};}function patchUpdates(_0x1bc76b){return function(_0x4bd98f){try{jsonpatch[_0x5f9d('0x22')](_0x4bd98f,_0x1bc76b,!![]);}catch(_0x5a3472){return BPromise[_0x5f9d('0x23')](_0x5a3472);}return _0x4bd98f['save']();};}function saveUpdates(_0x4875c5,_0x5086da){return function(_0x1f4c7b){if(_0x1f4c7b){return _0x1f4c7b[_0x5f9d('0x24')](_0x4875c5)[_0x5f9d('0x25')](function(_0x234511){return _0x234511;});}return null;};}function removeEntity(_0x542bbc,_0x379d2d){return function(_0x272b93){if(_0x272b93){return _0x272b93[_0x5f9d('0x26')]()[_0x5f9d('0x25')](function(){_0x542bbc[_0x5f9d('0x1c')](0xcc)[_0x5f9d('0x1d')]();});}};}function handleEntityNotFound(_0x2d66cc,_0x21cc63){return function(_0x3b1efc){if(!_0x3b1efc){_0x2d66cc[_0x5f9d('0x27')](0x194);}return _0x3b1efc;};}function handleError(_0x5e1f52,_0x154a98){_0x154a98=_0x154a98||0x1f4;return function(_0x1b9054){logger[_0x5f9d('0x28')](_0x1b9054[_0x5f9d('0x29')]);if(_0x1b9054[_0x5f9d('0x2a')]){delete _0x1b9054[_0x5f9d('0x2a')];}_0x5e1f52[_0x5f9d('0x1c')](_0x154a98)[_0x5f9d('0x2b')](_0x1b9054);};}exports[_0x5f9d('0x2c')]=function(_0x4f43b2,_0x4ed27d){var _0x4ba714={'raw':![],'where':{'id':_0x4f43b2['params']['id']}},_0x118f77={};_0x118f77[_0x5f9d('0x2d')]=_['keys'](db[_0x5f9d('0x2e')]['rawAttributes']);_0x118f77[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x4f43b2[_0x5f9d('0x2f')]);_0x118f77[_0x5f9d('0x31')]=_[_0x5f9d('0x32')](_0x118f77['model'],_0x118f77[_0x5f9d('0x2f')]);_0x4ba714['attributes']=_[_0x5f9d('0x32')](_0x118f77['model'],qs[_0x5f9d('0x33')](_0x4f43b2[_0x5f9d('0x2f')]['fields']));_0x4ba714[_0x5f9d('0x34')]=_0x4ba714[_0x5f9d('0x34')][_0x5f9d('0x35')]?_0x4ba714['attributes']:_0x118f77[_0x5f9d('0x2d')];if(_0x4f43b2[_0x5f9d('0x2f')][_0x5f9d('0x36')]){_0x4ba714[_0x5f9d('0x37')]=[{'all':!![]}];}_0x4ba714=_[_0x5f9d('0x38')]({},_0x4ba714,_0x4f43b2['options']);return db[_0x5f9d('0x2e')][_0x5f9d('0x39')](_0x4ba714)[_0x5f9d('0x25')](handleEntityNotFound(_0x4ed27d,null))[_0x5f9d('0x25')](respondWithResult(_0x4ed27d,null))[_0x5f9d('0x3a')](handleError(_0x4ed27d,null));};exports[_0x5f9d('0x26')]=function(_0x48a8e8,_0x1692c0){return db[_0x5f9d('0x2e')][_0x5f9d('0x39')]({'where':{'id':_0x48a8e8['params']['id']}})['then'](handleEntityNotFound(_0x1692c0,null))[_0x5f9d('0x25')](removeEntity(_0x1692c0,null))[_0x5f9d('0x3a')](handleError(_0x1692c0,null));};function widgetAttributes(_0x16a667){try{switch(_0x16a667[_0x5f9d('0x3b')]){case _0x5f9d('0x3c'):return[{'name':'attrUrl','value':_0x16a667['attrUrl']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667['attrs'][0x0][_0x5f9d('0x3e')]:undefined)||'https://'}];case _0x5f9d('0x3f'):return[{'name':_0x5f9d('0x40'),'value':_0x16a667['attrPath']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0]['value']:undefined)||''}];case _0x5f9d('0x41'):return[{'name':_0x5f9d('0x42'),'value':_0x16a667[_0x5f9d('0x42')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x43')},{'name':_0x5f9d('0x44'),'value':_0x16a667[_0x5f9d('0x44')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x45')},{'name':_0x5f9d('0x46'),'value':_0x16a667[_0x5f9d('0x46')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x2]?_0x16a667[_0x5f9d('0x3d')][0x2][_0x5f9d('0x3e')]:undefined)||0xc}];case _0x5f9d('0x47'):return[{'name':_0x5f9d('0x48'),'value':_0x16a667[_0x5f9d('0x48')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x49')},{'name':_0x5f9d('0x4a'),'value':_0x16a667['attrVoiceQueues']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||[]},{'name':_0x5f9d('0x46'),'value':_0x16a667[_0x5f9d('0x46')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x2]?_0x16a667[_0x5f9d('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0x5f9d('0x4b'),'value':_0x16a667[_0x5f9d('0x4b')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x3]?_0x16a667[_0x5f9d('0x3d')][0x3]['value']:undefined)||_0x5f9d('0x4c')},{'name':_0x5f9d('0x4d'),'value':_0x16a667[_0x5f9d('0x4d')]||(_0x16a667['attrs']&&_0x16a667['attrs'][0x4]?_0x16a667[_0x5f9d('0x3d')][0x4][_0x5f9d('0x3e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x16a667[_0x5f9d('0x4e')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x5]?_0x16a667[_0x5f9d('0x3d')][0x5][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x4f'),'value':_0x16a667[_0x5f9d('0x4f')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x6]?_0x16a667[_0x5f9d('0x3d')][0x6][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x50'),'value':_0x16a667['attrOpenchannelAccounts']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x7]?_0x16a667['attrs'][0x7][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x51'),'value':_0x16a667[_0x5f9d('0x51')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x8]?_0x16a667[_0x5f9d('0x3d')][0x8][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x52'),'value':_0x16a667['attrChatWebsites']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x9]?_0x16a667[_0x5f9d('0x3d')][0x9][_0x5f9d('0x3e')]:undefined)||''}];case _0x5f9d('0x53'):case _0x5f9d('0x54'):return[{'name':_0x5f9d('0x55'),'value':_0x16a667[_0x5f9d('0x55')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667['attrs'][0x0]['value']:undefined)||_0x5f9d('0x49')},{'name':_0x5f9d('0x56'),'value':_0x16a667[_0x5f9d('0x56')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x57'),'value':_0x16a667[_0x5f9d('0x57')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x2]?_0x16a667['attrs'][0x2][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x4a'),'value':_0x16a667[_0x5f9d('0x4a')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x3]?_0x16a667['attrs'][0x3][_0x5f9d('0x3e')]:undefined)||[]},{'name':'attrChannel','value':_0x16a667['attrChannel']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x4]?_0x16a667[_0x5f9d('0x3d')][0x4][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x4c')},{'name':_0x5f9d('0x4d'),'value':_0x16a667[_0x5f9d('0x4d')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x5]?_0x16a667[_0x5f9d('0x3d')][0x5]['value']:undefined)||''},{'name':_0x5f9d('0x4e'),'value':_0x16a667['attrFaxAccounts']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x6]?_0x16a667[_0x5f9d('0x3d')][0x6][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x4f'),'value':_0x16a667['attrSmsAccounts']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x7]?_0x16a667[_0x5f9d('0x3d')][0x7][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x50'),'value':_0x16a667[_0x5f9d('0x50')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x8]?_0x16a667['attrs'][0x8][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x51'),'value':_0x16a667[_0x5f9d('0x51')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x9]?_0x16a667[_0x5f9d('0x3d')][0x9][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x52'),'value':_0x16a667[_0x5f9d('0x52')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0xa]?_0x16a667[_0x5f9d('0x3d')][0xa][_0x5f9d('0x3e')]:undefined)||''}];case _0x5f9d('0x58'):return[{'name':_0x5f9d('0x59'),'type':_0x16a667[_0x5f9d('0x5a')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3b')]:undefined)||null,'value':_0x16a667[_0x5f9d('0x59')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x5b'),'value':_0x16a667[_0x5f9d('0x5b')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3e19ba){logger[_0x5f9d('0x28')](_0x5f9d('0x5c'),JSON[_0x5f9d('0x5d')](_0x3e19ba));return[];}}exports[_0x5f9d('0x5e')]=function(_0x53072a,_0x2a8d82){if(_0x53072a[_0x5f9d('0x5f')]){_0x53072a[_0x5f9d('0x5f')][_0x5f9d('0x3d')]=widgetAttributes(_0x53072a[_0x5f9d('0x5f')]);}return db['DashboardItem'][_0x5f9d('0x5e')](_0x53072a[_0x5f9d('0x5f')],{})[_0x5f9d('0x25')](respondWithResult(_0x2a8d82,0xc9))[_0x5f9d('0x3a')](handleError(_0x2a8d82,null));};exports[_0x5f9d('0x24')]=function(_0x27a83a,_0x2d5958){if(_0x27a83a[_0x5f9d('0x5f')]['id']){delete _0x27a83a['body']['id'];}_0x27a83a[_0x5f9d('0x5f')]['attrs']=widgetAttributes(_0x27a83a['body']);return db[_0x5f9d('0x2e')][_0x5f9d('0x39')]({'where':{'id':_0x27a83a[_0x5f9d('0x60')]['id']}})[_0x5f9d('0x25')](handleEntityNotFound(_0x2d5958,null))[_0x5f9d('0x25')](saveUpdates(_0x27a83a['body'],null))[_0x5f9d('0x25')](respondWithResult(_0x2d5958,null))[_0x5f9d('0x3a')](handleError(_0x2d5958,null));}; \ No newline at end of file +var _0x5d95=['counter','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize'];(function(_0x347ea8,_0x2ac098){var _0x2e83f4=function(_0x430d5f){while(--_0x430d5f){_0x347ea8['push'](_0x347ea8['shift']());}};_0x2e83f4(++_0x2ac098);}(_0x5d95,0x77));var _0x55d9=function(_0x50d458,_0x3eab1c){_0x50d458=_0x50d458-0x0;var _0x2d47ed=_0x5d95[_0x50d458];return _0x2d47ed;};'use strict';var emlformat=require(_0x55d9('0x0'));var rimraf=require(_0x55d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d9('0x2'));var rp=require(_0x55d9('0x3'));var moment=require(_0x55d9('0x4'));var BPromise=require(_0x55d9('0x5'));var Mustache=require(_0x55d9('0x6'));var util=require('util');var path=require(_0x55d9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x55d9('0x8'));var fs=require('fs');var fs_extra=require(_0x55d9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x55d9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x55d9('0xb'));var authService=require(_0x55d9('0xc'));var qs=require(_0x55d9('0xd'));var as=require(_0x55d9('0xe'));var hardwareService=require(_0x55d9('0xf'));var logger=require(_0x55d9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x55d9('0x11'));var licenseUtil=require(_0x55d9('0x12'));var db=require(_0x55d9('0x13'))['db'];config[_0x55d9('0x14')]=_[_0x55d9('0x15')](config[_0x55d9('0x14')],{'host':_0x55d9('0x16'),'port':0x18eb});var socket=require(_0x55d9('0x17'))(new Redis(config[_0x55d9('0x14')]));require('./dashboardItem.socket')[_0x55d9('0x18')](socket);function respondWithStatusCode(_0x39967c,_0x12a15c){_0x12a15c=_0x12a15c||0xcc;return function(_0xf68641){if(_0xf68641){return _0x39967c[_0x55d9('0x19')](_0x12a15c);}return _0x39967c[_0x55d9('0x1a')](_0x12a15c)[_0x55d9('0x1b')]();};}function respondWithResult(_0x5c66e2,_0xe3e5a9){_0xe3e5a9=_0xe3e5a9||0xc8;return function(_0x374fa7){if(_0x374fa7){return _0x5c66e2[_0x55d9('0x1a')](_0xe3e5a9)[_0x55d9('0x1c')](_0x374fa7);}};}function respondWithFilteredResult(_0x45a0cc,_0x43ee2c){return function(_0x50faa6){if(_0x50faa6){var _0xce6a36=typeof _0x43ee2c[_0x55d9('0x1d')]==='undefined'&&typeof _0x43ee2c['limit']==='undefined';var _0xed70ef=_0x50faa6[_0x55d9('0x1e')];var _0x191c3e=_0xce6a36?0x0:_0x43ee2c[_0x55d9('0x1d')];var _0x535ad9=_0xce6a36?_0x50faa6[_0x55d9('0x1e')]:_0x43ee2c[_0x55d9('0x1d')]+_0x43ee2c[_0x55d9('0x1f')];var _0x556d6f;if(_0x535ad9>=_0xed70ef){_0x535ad9=_0xed70ef;_0x556d6f=0xc8;}else{_0x556d6f=0xce;}_0x45a0cc[_0x55d9('0x1a')](_0x556d6f);return _0x45a0cc[_0x55d9('0x20')](_0x55d9('0x21'),_0x191c3e+'-'+_0x535ad9+'/'+_0xed70ef)[_0x55d9('0x1c')](_0x50faa6);}return null;};}function patchUpdates(_0x54c648){return function(_0x53e684){try{jsonpatch[_0x55d9('0x22')](_0x53e684,_0x54c648,!![]);}catch(_0x416cc6){return BPromise[_0x55d9('0x23')](_0x416cc6);}return _0x53e684[_0x55d9('0x24')]();};}function saveUpdates(_0x334a6b,_0x36d8ab){return function(_0x10be56){if(_0x10be56){return _0x10be56[_0x55d9('0x25')](_0x334a6b)[_0x55d9('0x26')](function(_0x4bd725){return _0x4bd725;});}return null;};}function removeEntity(_0x2686d7,_0x2c5d21){return function(_0x4cca69){if(_0x4cca69){return _0x4cca69[_0x55d9('0x27')]()['then'](function(){_0x2686d7[_0x55d9('0x1a')](0xcc)[_0x55d9('0x1b')]();});}};}function handleEntityNotFound(_0x28d332,_0x6daac1){return function(_0x22218f){if(!_0x22218f){_0x28d332['sendStatus'](0x194);}return _0x22218f;};}function handleError(_0x2c640c,_0x4a6806){_0x4a6806=_0x4a6806||0x1f4;return function(_0x4c1bbe){logger[_0x55d9('0x28')](_0x4c1bbe[_0x55d9('0x29')]);if(_0x4c1bbe[_0x55d9('0x2a')]){delete _0x4c1bbe['name'];}_0x2c640c[_0x55d9('0x1a')](_0x4a6806)[_0x55d9('0x2b')](_0x4c1bbe);};}exports[_0x55d9('0x2c')]=function(_0xccae56,_0x1c89cd){var _0x8464a3={'raw':![],'where':{'id':_0xccae56[_0x55d9('0x2d')]['id']}},_0x19ca6a={};_0x19ca6a[_0x55d9('0x2e')]=_[_0x55d9('0x2f')](db[_0x55d9('0x30')][_0x55d9('0x31')]);_0x19ca6a[_0x55d9('0x32')]=_[_0x55d9('0x2f')](_0xccae56[_0x55d9('0x32')]);_0x19ca6a[_0x55d9('0x33')]=_[_0x55d9('0x34')](_0x19ca6a[_0x55d9('0x2e')],_0x19ca6a[_0x55d9('0x32')]);_0x8464a3[_0x55d9('0x35')]=_[_0x55d9('0x34')](_0x19ca6a[_0x55d9('0x2e')],qs[_0x55d9('0x36')](_0xccae56[_0x55d9('0x32')]['fields']));_0x8464a3['attributes']=_0x8464a3[_0x55d9('0x35')][_0x55d9('0x37')]?_0x8464a3[_0x55d9('0x35')]:_0x19ca6a[_0x55d9('0x2e')];if(_0xccae56[_0x55d9('0x32')][_0x55d9('0x38')]){_0x8464a3[_0x55d9('0x39')]=[{'all':!![]}];}_0x8464a3=_[_0x55d9('0x3a')]({},_0x8464a3,_0xccae56['options']);return db[_0x55d9('0x30')][_0x55d9('0x3b')](_0x8464a3)[_0x55d9('0x26')](handleEntityNotFound(_0x1c89cd,null))[_0x55d9('0x26')](respondWithResult(_0x1c89cd,null))[_0x55d9('0x3c')](handleError(_0x1c89cd,null));};exports['destroy']=function(_0x9dbc6e,_0xe0f35c){return db[_0x55d9('0x30')][_0x55d9('0x3b')]({'where':{'id':_0x9dbc6e[_0x55d9('0x2d')]['id']}})[_0x55d9('0x26')](handleEntityNotFound(_0xe0f35c,null))[_0x55d9('0x26')](removeEntity(_0xe0f35c,null))[_0x55d9('0x3c')](handleError(_0xe0f35c,null));};function widgetAttributes(_0x189de2){try{switch(_0x189de2[_0x55d9('0x3d')]){case _0x55d9('0x3e'):return[{'name':_0x55d9('0x3f'),'value':_0x189de2[_0x55d9('0x3f')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x0]?_0x189de2[_0x55d9('0x40')][0x0][_0x55d9('0x41')]:undefined)||'https://'}];case _0x55d9('0x42'):return[{'name':'attrPath','value':_0x189de2[_0x55d9('0x43')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x0]?_0x189de2[_0x55d9('0x40')][0x0]['value']:undefined)||''}];case _0x55d9('0x44'):return[{'name':_0x55d9('0x45'),'value':_0x189de2[_0x55d9('0x45')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2['attrs'][0x0]?_0x189de2['attrs'][0x0][_0x55d9('0x41')]:undefined)||_0x55d9('0x46')},{'name':'attrTimezone','value':_0x189de2['attrTimezone']||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x1]?_0x189de2[_0x55d9('0x40')][0x1][_0x55d9('0x41')]:undefined)||_0x55d9('0x47')},{'name':_0x55d9('0x48'),'value':_0x189de2['attrFontSize']||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x2]?_0x189de2[_0x55d9('0x40')][0x2][_0x55d9('0x41')]:undefined)||0xc}];case _0x55d9('0x49'):return[{'name':'attrMetric','value':_0x189de2['attrMetric']||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x0]?_0x189de2[_0x55d9('0x40')][0x0][_0x55d9('0x41')]:undefined)||_0x55d9('0x4a')},{'name':_0x55d9('0x4b'),'value':_0x189de2[_0x55d9('0x4b')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x1]?_0x189de2[_0x55d9('0x40')][0x1][_0x55d9('0x41')]:undefined)||[]},{'name':_0x55d9('0x48'),'value':_0x189de2[_0x55d9('0x48')]||(_0x189de2['attrs']&&_0x189de2['attrs'][0x2]?_0x189de2[_0x55d9('0x40')][0x2]['value']:undefined)||0x14},{'name':_0x55d9('0x4c'),'value':_0x189de2['attrChannel']||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x3]?_0x189de2[_0x55d9('0x40')][0x3][_0x55d9('0x41')]:undefined)||'voice'},{'name':_0x55d9('0x4d'),'value':_0x189de2['attrEmailAccounts']||(_0x189de2['attrs']&&_0x189de2['attrs'][0x4]?_0x189de2[_0x55d9('0x40')][0x4][_0x55d9('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x189de2[_0x55d9('0x4e')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x5]?_0x189de2[_0x55d9('0x40')][0x5][_0x55d9('0x41')]:undefined)||''},{'name':_0x55d9('0x4f'),'value':_0x189de2[_0x55d9('0x4f')]||(_0x189de2['attrs']&&_0x189de2['attrs'][0x6]?_0x189de2[_0x55d9('0x40')][0x6][_0x55d9('0x41')]:undefined)||''},{'name':_0x55d9('0x50'),'value':_0x189de2[_0x55d9('0x50')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2['attrs'][0x7]?_0x189de2[_0x55d9('0x40')][0x7][_0x55d9('0x41')]:undefined)||''},{'name':_0x55d9('0x51'),'value':_0x189de2[_0x55d9('0x51')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x8]?_0x189de2[_0x55d9('0x40')][0x8]['value']:undefined)||''},{'name':_0x55d9('0x52'),'value':_0x189de2[_0x55d9('0x52')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x9]?_0x189de2[_0x55d9('0x40')][0x9]['value']:undefined)||''}];case _0x55d9('0x53'):case _0x55d9('0x54'):return[{'name':_0x55d9('0x55'),'value':_0x189de2[_0x55d9('0x55')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x0]?_0x189de2[_0x55d9('0x40')][0x0][_0x55d9('0x41')]:undefined)||_0x55d9('0x4a')},{'name':_0x55d9('0x56'),'value':_0x189de2[_0x55d9('0x56')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x1]?_0x189de2[_0x55d9('0x40')][0x1]['value']:undefined)||null},{'name':_0x55d9('0x57'),'value':_0x189de2[_0x55d9('0x57')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x2]?_0x189de2[_0x55d9('0x40')][0x2][_0x55d9('0x41')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x189de2['attrVoiceQueues']||(_0x189de2[_0x55d9('0x40')]&&_0x189de2['attrs'][0x3]?_0x189de2[_0x55d9('0x40')][0x3][_0x55d9('0x41')]:undefined)||[]},{'name':_0x55d9('0x4c'),'value':_0x189de2[_0x55d9('0x4c')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x4]?_0x189de2['attrs'][0x4][_0x55d9('0x41')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x189de2[_0x55d9('0x4d')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x5]?_0x189de2[_0x55d9('0x40')][0x5][_0x55d9('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x189de2[_0x55d9('0x4e')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x6]?_0x189de2[_0x55d9('0x40')][0x6][_0x55d9('0x41')]:undefined)||''},{'name':_0x55d9('0x4f'),'value':_0x189de2[_0x55d9('0x4f')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2['attrs'][0x7]?_0x189de2[_0x55d9('0x40')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x189de2[_0x55d9('0x50')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x8]?_0x189de2[_0x55d9('0x40')][0x8]['value']:undefined)||''},{'name':_0x55d9('0x51'),'value':_0x189de2[_0x55d9('0x51')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x9]?_0x189de2[_0x55d9('0x40')][0x9][_0x55d9('0x41')]:undefined)||''},{'name':_0x55d9('0x52'),'value':_0x189de2[_0x55d9('0x52')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0xa]?_0x189de2[_0x55d9('0x40')][0xa][_0x55d9('0x41')]:undefined)||''}];case _0x55d9('0x58'):return[{'name':_0x55d9('0x59'),'type':_0x189de2[_0x55d9('0x5a')]||(_0x189de2['attrs']&&_0x189de2[_0x55d9('0x40')][0x0]?_0x189de2['attrs'][0x0][_0x55d9('0x3d')]:undefined)||null,'value':_0x189de2[_0x55d9('0x59')]||(_0x189de2['attrs']&&_0x189de2['attrs'][0x0]?_0x189de2['attrs'][0x0][_0x55d9('0x41')]:undefined)||null},{'name':_0x55d9('0x5b'),'value':_0x189de2[_0x55d9('0x5b')]||(_0x189de2[_0x55d9('0x40')]&&_0x189de2[_0x55d9('0x40')][0x1]?_0x189de2['attrs'][0x1][_0x55d9('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1b246f){logger[_0x55d9('0x28')](_0x55d9('0x5c'),JSON[_0x55d9('0x5d')](_0x1b246f));return[];}}exports[_0x55d9('0x5e')]=function(_0x1ddf8a,_0x14d93b){if(_0x1ddf8a[_0x55d9('0x5f')]){_0x1ddf8a['body'][_0x55d9('0x40')]=widgetAttributes(_0x1ddf8a[_0x55d9('0x5f')]);}return db['DashboardItem']['create'](_0x1ddf8a[_0x55d9('0x5f')],{})[_0x55d9('0x26')](respondWithResult(_0x14d93b,0xc9))[_0x55d9('0x3c')](handleError(_0x14d93b,null));};exports[_0x55d9('0x25')]=function(_0x27aa20,_0xe68a5){if(_0x27aa20[_0x55d9('0x5f')]['id']){delete _0x27aa20[_0x55d9('0x5f')]['id'];}_0x27aa20[_0x55d9('0x5f')]['attrs']=widgetAttributes(_0x27aa20['body']);return db[_0x55d9('0x30')][_0x55d9('0x3b')]({'where':{'id':_0x27aa20[_0x55d9('0x2d')]['id']}})[_0x55d9('0x26')](handleEntityNotFound(_0xe68a5,null))[_0x55d9('0x26')](saveUpdates(_0x27aa20['body'],null))[_0x55d9('0x26')](respondWithResult(_0xe68a5,null))[_0x55d9('0x3c')](handleError(_0xe68a5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 24eaa45..72c852c 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 _0xfdca=['emit','hasOwnProperty','events','../../mysqldb','DashboardItem','save','update','remove'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xfdca,0x152));var _0xafdc=function(_0x3ee897,_0x524b0d){_0x3ee897=_0x3ee897-0x0;var _0xd2ce58=_0xfdca[_0x3ee897];return _0xd2ce58;};'use strict';var EventEmitter=require(_0xafdc('0x0'));var DashboardItem=require(_0xafdc('0x1'))['db'][_0xafdc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xafdc('0x3'),'afterUpdate':_0xafdc('0x4'),'afterDestroy':_0xafdc('0x5')};function emitEvent(_0x5bb350){return function(_0x38d49b,_0x183454,_0x1952de){DashboardItemEvents[_0xafdc('0x6')](_0x5bb350+':'+_0x38d49b['id'],_0x38d49b);DashboardItemEvents['emit'](_0x5bb350,_0x38d49b);_0x1952de(null);};}for(var e in events){if(events[_0xafdc('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xefe6=['update','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xefe6,0x14c));var _0x6efe=function(_0x5f4f52,_0xbc3a5a){_0x5f4f52=_0x5f4f52-0x0;var _0xe2338a=_0xefe6[_0x5f4f52];return _0xe2338a;};'use strict';var EventEmitter=require(_0x6efe('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x6efe('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6efe('0x2')](0x0);var events={'afterCreate':_0x6efe('0x3'),'afterUpdate':_0x6efe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15ec8a){return function(_0x2a313b,_0x3cd8b1,_0x4b4111){DashboardItemEvents[_0x6efe('0x5')](_0x15ec8a+':'+_0x2a313b['id'],_0x2a313b);DashboardItemEvents['emit'](_0x15ec8a,_0x2a313b);_0x4b4111(null);};}for(var e in events){if(events[_0x6efe('0x6')](e)){var event=events[e];DashboardItem[_0x6efe('0x7')](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 956b086..69bac69 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 _0x406c=['DashboardItem','dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x57a940,_0x4d9071){var _0x39bdb6=function(_0x5be6f2){while(--_0x5be6f2){_0x57a940['push'](_0x57a940['shift']());}};_0x39bdb6(++_0x4d9071);}(_0x406c,0xda));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc406('0x0'));var util=require('util');var logger=require(_0xc406('0x1'))(_0xc406('0x2'));var moment=require('moment');var BPromise=require(_0xc406('0x3'));var rp=require(_0xc406('0x4'));var fs=require('fs');var path=require(_0xc406('0x5'));var rimraf=require(_0xc406('0x6'));var config=require('../../config/environment');var attributes=require(_0xc406('0x7'));module[_0xc406('0x8')]=function(_0x1eb62c,_0x3067d5){return _0x1eb62c[_0xc406('0x9')](_0xc406('0xa'),attributes,{'tableName':_0xc406('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x5bb7,0xc2));var _0x75bb=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x5bb7[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x75bb('0x0'));var util=require(_0x75bb('0x1'));var logger=require(_0x75bb('0x2'))(_0x75bb('0x3'));var moment=require(_0x75bb('0x4'));var BPromise=require(_0x75bb('0x5'));var rp=require(_0x75bb('0x6'));var fs=require('fs');var path=require(_0x75bb('0x7'));var rimraf=require(_0x75bb('0x8'));var config=require(_0x75bb('0x9'));var attributes=require(_0x75bb('0xa'));module[_0x75bb('0xb')]=function(_0x3062bc,_0x2211c6){return _0x3062bc['define'](_0x75bb('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 9db2655..7faa2da 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 _0xe03a=['defaults','./dashboardItem.socket','register','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','redis'];(function(_0x7d891d,_0x200e32){var _0x331111=function(_0x2e1b3a){while(--_0x2e1b3a){_0x7d891d['push'](_0x7d891d['shift']());}};_0x331111(++_0x200e32);}(_0xe03a,0x92));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xae03('0x0'));var rs=require(_0xae03('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae03('0x2'))['db'];var utils=require(_0xae03('0x3'));var logger=require(_0xae03('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xae03('0x5')]({'port':0x232a});config[_0xae03('0x6')]=_[_0xae03('0x7')](config[_0xae03('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae03('0x6')]));require(_0xae03('0x8'))[_0xae03('0x9')](socket);function respondWithRpcPromise(_0x40a63f,_0x17eb06,_0x367d1e){return new BPromise(function(_0x56c791,_0x36231b){return client['request'](_0x40a63f,_0x367d1e)['then'](function(_0x108747){logger['info'](_0xae03('0xa'),_0x17eb06,_0xae03('0xb'));logger['debug'](_0xae03('0xc'),_0x17eb06,_0xae03('0xb'),JSON['stringify'](_0x108747));if(_0x108747[_0xae03('0xd')]){if(_0x108747[_0xae03('0xd')][_0xae03('0xe')]===0x1f4){logger[_0xae03('0xd')](_0xae03('0xa'),_0x17eb06,_0x108747['error'][_0xae03('0xf')]);return _0x36231b(_0x108747[_0xae03('0xd')][_0xae03('0xf')]);}logger[_0xae03('0xd')](_0xae03('0xa'),_0x17eb06,_0x108747[_0xae03('0xd')][_0xae03('0xf')]);return _0x56c791(_0x108747[_0xae03('0xd')][_0xae03('0xf')]);}else{logger['info'](_0xae03('0xa'),_0x17eb06,_0xae03('0xb'));_0x56c791(_0x108747[_0xae03('0x10')][_0xae03('0xf')]);}})['catch'](function(_0x1ea346){logger[_0xae03('0xd')](_0xae03('0xa'),_0x17eb06,_0x1ea346);_0x36231b(_0x1ea346);});});} \ No newline at end of file +var _0x4430=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0x4430,0x9e));var _0x0443=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x4430[_0x585ee5];return _0x470808;};'use strict';var _=require(_0x0443('0x0'));var util=require(_0x0443('0x1'));var moment=require(_0x0443('0x2'));var BPromise=require(_0x0443('0x3'));var rs=require(_0x0443('0x4'));var fs=require('fs');var Redis=require(_0x0443('0x5'));var db=require(_0x0443('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0443('0x7'));var config=require('../../config/environment');var jayson=require(_0x0443('0x8'));var client=jayson[_0x0443('0x9')][_0x0443('0xa')]({'port':0x232a});config[_0x0443('0xb')]=_[_0x0443('0xc')](config['redis'],{'host':_0x0443('0xd'),'port':0x18eb});var socket=require(_0x0443('0xe'))(new Redis(config[_0x0443('0xb')]));require('./dashboardItem.socket')[_0x0443('0xf')](socket);function respondWithRpcPromise(_0x523065,_0x3233ff,_0x38b651){return new BPromise(function(_0x1bd21e,_0x54ba72){return client['request'](_0x523065,_0x38b651)[_0x0443('0x10')](function(_0x4e1f58){logger[_0x0443('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3233ff,_0x0443('0x12'));logger[_0x0443('0x13')](_0x0443('0x14'),_0x3233ff,'request\x20sent',JSON['stringify'](_0x4e1f58));if(_0x4e1f58[_0x0443('0x15')]){if(_0x4e1f58[_0x0443('0x15')][_0x0443('0x16')]===0x1f4){logger[_0x0443('0x15')](_0x0443('0x17'),_0x3233ff,_0x4e1f58['error'][_0x0443('0x18')]);return _0x54ba72(_0x4e1f58[_0x0443('0x15')][_0x0443('0x18')]);}logger[_0x0443('0x15')](_0x0443('0x17'),_0x3233ff,_0x4e1f58['error']['message']);return _0x1bd21e(_0x4e1f58['error'][_0x0443('0x18')]);}else{logger[_0x0443('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3233ff,_0x0443('0x12'));_0x1bd21e(_0x4e1f58['result']['message']);}})[_0x0443('0x19')](function(_0xf087d){logger[_0x0443('0x15')](_0x0443('0x17'),_0x3233ff,_0xf087d);_0x54ba72(_0xf087d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5912e62..e529cbc 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 _0xddef=['update','emit','register','dashboardItem:','./dashboardItem.events'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xddef,0x1c1));var _0xfdde=function(_0x2fc44f,_0x378dc5){_0x2fc44f=_0x2fc44f-0x0;var _0x13984c=_0xddef[_0x2fc44f];return _0x13984c;};'use strict';var DashboardItemEvents=require(_0xfdde('0x0'));var events=['save','remove',_0xfdde('0x1')];function createListener(_0x10180e,_0x2e4cbf){return function(_0x49c123){_0x2e4cbf[_0xfdde('0x2')](_0x10180e,_0x49c123);};}function removeListener(_0xbea272,_0xedd2a){return function(){DashboardItemEvents['removeListener'](_0xbea272,_0xedd2a);};}exports[_0xfdde('0x3')]=function(_0x342a35){for(var _0x166d7c=0x0,_0x176cd6=events['length'];_0x166d7c<_0x176cd6;_0x166d7c++){var _0xe58bfe=events[_0x166d7c];var _0x5c53b7=createListener(_0xfdde('0x4')+_0xe58bfe,_0x342a35);DashboardItemEvents['on'](_0xe58bfe,_0x5c53b7);}}; \ No newline at end of file +var _0x8ad6=['length','save','remove','register'];(function(_0x43e893,_0x5613e2){var _0x38f8fe=function(_0x10b47b){while(--_0x10b47b){_0x43e893['push'](_0x43e893['shift']());}};_0x38f8fe(++_0x5613e2);}(_0x8ad6,0xc9));var _0x68ad=function(_0x3f1ef5,_0x466e3e){_0x3f1ef5=_0x3f1ef5-0x0;var _0xd0bbbf=_0x8ad6[_0x3f1ef5];return _0xd0bbbf;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x68ad('0x0'),_0x68ad('0x1'),'update'];function createListener(_0x1a60d9,_0x1b0ef0){return function(_0x45fc81){_0x1b0ef0['emit'](_0x1a60d9,_0x45fc81);};}function removeListener(_0x1d87ed,_0x10a2c){return function(){DashboardItemEvents['removeListener'](_0x1d87ed,_0x10a2c);};}exports[_0x68ad('0x2')]=function(_0x491a4c){for(var _0x1c19a3=0x0,_0x12ea7f=events[_0x68ad('0x3')];_0x1c19a3<_0x12ea7f;_0x1c19a3++){var _0x31a9d3=events[_0x1c19a3];var _0x4d75ad=createListener('dashboardItem:'+_0x31a9d3,_0x491a4c);DashboardItemEvents['on'](_0x31a9d3,_0x4d75ad);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0a8c433..6e7014a 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 _0xea5d=['isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','post'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0xea5d,0xd2));var _0xdea5=function(_0x1eac5f,_0x3d3111){_0x1eac5f=_0x1eac5f-0x0;var _0x5b624b=_0xea5d[_0x1eac5f];return _0x5b624b;};'use strict';var multer=require('multer');var util=require(_0xdea5('0x0'));var path=require(_0xdea5('0x1'));var timeout=require(_0xdea5('0x2'));var express=require(_0xdea5('0x3'));var router=express['Router']();var fs_extra=require(_0xdea5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdea5('0x5'));var config=require(_0xdea5('0x6'));var controller=require('./dashboardItem.controller');router[_0xdea5('0x7')](_0xdea5('0x8'),auth['isAuthenticated'](),controller[_0xdea5('0x9')]);router[_0xdea5('0xa')]('/',auth[_0xdea5('0xb')](),controller['create']);router[_0xdea5('0xc')](_0xdea5('0x8'),auth[_0xdea5('0xb')](),controller[_0xdea5('0xd')]);router[_0xdea5('0xe')](_0xdea5('0x8'),auth[_0xdea5('0xb')](),controller[_0xdea5('0xf')]);module[_0xdea5('0x10')]=router; \ No newline at end of file +var _0x6494=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer'];(function(_0xa822a0,_0x38e2cc){var _0xaf7e66=function(_0x349fce){while(--_0x349fce){_0xa822a0['push'](_0xa822a0['shift']());}};_0xaf7e66(++_0x38e2cc);}(_0x6494,0xa1));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4649('0x0'));var util=require(_0x4649('0x1'));var path=require(_0x4649('0x2'));var timeout=require(_0x4649('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4649('0x4'));var auth=require(_0x4649('0x5'));var interaction=require(_0x4649('0x6'));var config=require(_0x4649('0x7'));var controller=require(_0x4649('0x8'));router[_0x4649('0x9')](_0x4649('0xa'),auth[_0x4649('0xb')](),controller[_0x4649('0xc')]);router[_0x4649('0xd')]('/',auth[_0x4649('0xb')](),controller['create']);router[_0x4649('0xe')](_0x4649('0xa'),auth[_0x4649('0xb')](),controller[_0x4649('0xf')]);router[_0x4649('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4649('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b7dad38..7feeef7 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 _0x6c5b=['first','STRING','sequelize','exports','ENUM','third'];(function(_0x2af239,_0x412e98){var _0x26dd65=function(_0x4300f9){while(--_0x4300f9){_0x2af239['push'](_0x2af239['shift']());}};_0x26dd65(++_0x412e98);}(_0x6c5b,0x1d6));var _0xb6c5=function(_0x66de12,_0x4f6401){_0x66de12=_0x66de12-0x0;var _0x3e2ab5=_0x6c5b[_0x66de12];return _0x3e2ab5;};'use strict';var Sequelize=require(_0xb6c5('0x0'));module[_0xb6c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xb6c5('0x2')]('first','second',_0xb6c5('0x3')),'allowNull':![],'defaultValue':_0xb6c5('0x4')},'description':{'type':Sequelize[_0xb6c5('0x5')]}}; \ No newline at end of file +var _0x7a26=['STRING','ENUM','second','third','sequelize','exports'];(function(_0x378aa6,_0x5f3718){var _0x523a80=function(_0x3723bf){while(--_0x3723bf){_0x378aa6['push'](_0x378aa6['shift']());}};_0x523a80(++_0x5f3718);}(_0x7a26,0xe2));var _0x67a2=function(_0x2a19c5,_0x2b90f8){_0x2a19c5=_0x2a19c5-0x0;var _0x39acb6=_0x7a26[_0x2a19c5];return _0x39acb6;};'use strict';var Sequelize=require(_0x67a2('0x0'));module[_0x67a2('0x1')]={'name':{'type':Sequelize[_0x67a2('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x67a2('0x3')]('first',_0x67a2('0x4'),_0x67a2('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1361459..bf29e89 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 _0xa54c=['send','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','userProfileId','catch','find','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name'];(function(_0x24289c,_0x388286){var _0x334fa5=function(_0x5c92e9){while(--_0x5c92e9){_0x24289c['push'](_0x24289c['shift']());}};_0x334fa5(++_0x388286);}(_0xa54c,0xcf));var _0xca54=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xa54c[_0x286726];return _0xcd4fe9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca54('0x0'));var jsonpatch=require(_0xca54('0x1'));var rp=require('request-promise');var moment=require(_0xca54('0x2'));var BPromise=require(_0xca54('0x3'));var Mustache=require('mustache');var util=require(_0xca54('0x4'));var path=require(_0xca54('0x5'));var sox=require(_0xca54('0x6'));var csv=require(_0xca54('0x7'));var ejs=require(_0xca54('0x8'));var fs=require('fs');var fs_extra=require(_0xca54('0x9'));var _=require('lodash');var squel=require(_0xca54('0xa'));var crypto=require(_0xca54('0xb'));var jsforce=require(_0xca54('0xc'));var deskjs=require(_0xca54('0xd'));var toCsv=require(_0xca54('0x7'));var querystring=require('querystring');var Papa=require(_0xca54('0xe'));var Redis=require('ioredis');var authService=require(_0xca54('0xf'));var qs=require(_0xca54('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca54('0x11'));var logger=require(_0xca54('0x12'))(_0xca54('0x13'));var utils=require(_0xca54('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xca54('0x15'));var db=require(_0xca54('0x16'))['db'];function respondWithStatusCode(_0xb0bc92,_0x3c017c){_0x3c017c=_0x3c017c||0xcc;return function(_0x1bb552){if(_0x1bb552){return _0xb0bc92[_0xca54('0x17')](_0x3c017c);}return _0xb0bc92[_0xca54('0x18')](_0x3c017c)[_0xca54('0x19')]();};}function respondWithResult(_0x51afc2,_0x5097ef){_0x5097ef=_0x5097ef||0xc8;return function(_0x3bf69c){if(_0x3bf69c){return _0x51afc2[_0xca54('0x18')](_0x5097ef)[_0xca54('0x1a')](_0x3bf69c);}};}function respondWithFilteredResult(_0x36fa4c,_0x3f9e05){return function(_0x335fa0){if(_0x335fa0){var _0x5bf530=typeof _0x3f9e05[_0xca54('0x1b')]===_0xca54('0x1c')&&typeof _0x3f9e05[_0xca54('0x1d')]===_0xca54('0x1c');var _0x45125c=_0x335fa0[_0xca54('0x1e')];var _0x430417=_0x5bf530?0x0:_0x3f9e05[_0xca54('0x1b')];var _0x39b15f=_0x5bf530?_0x335fa0['count']:_0x3f9e05[_0xca54('0x1b')]+_0x3f9e05['limit'];var _0x266026;if(_0x39b15f>=_0x45125c){_0x39b15f=_0x45125c;_0x266026=0xc8;}else{_0x266026=0xce;}_0x36fa4c['status'](_0x266026);return _0x36fa4c[_0xca54('0x1f')](_0xca54('0x20'),_0x430417+'-'+_0x39b15f+'/'+_0x45125c)[_0xca54('0x1a')](_0x335fa0);}return null;};}function patchUpdates(_0x544019){return function(_0x57c781){try{jsonpatch[_0xca54('0x21')](_0x57c781,_0x544019,!![]);}catch(_0x33d0b1){return BPromise['reject'](_0x33d0b1);}return _0x57c781[_0xca54('0x22')]();};}function saveUpdates(_0x506613,_0x493a3f){return function(_0x34e042){if(_0x34e042){return _0x34e042[_0xca54('0x23')](_0x506613)[_0xca54('0x24')](function(_0x344062){return _0x344062;});}return null;};}function removeEntity(_0x22c9d7,_0x3873e4){return function(_0x475ca6){if(_0x475ca6){return _0x475ca6[_0xca54('0x25')]()['then'](function(){var _0x10cd7e=_0x475ca6['get']({'plain':!![]});var _0x36cf0a='Dispositions';return db[_0xca54('0x26')][_0xca54('0x25')]({'where':{'type':_0x36cf0a,'resourceId':_0x10cd7e['id']}})[_0xca54('0x24')](function(){return _0x475ca6;});})[_0xca54('0x24')](function(){_0x22c9d7[_0xca54('0x18')](0xcc)[_0xca54('0x19')]();});}};}function handleEntityNotFound(_0x25794a,_0x5ddfc1){return function(_0x4bfe17){if(!_0x4bfe17){_0x25794a[_0xca54('0x17')](0x194);}return _0x4bfe17;};}function handleError(_0x267681,_0x41377b){_0x41377b=_0x41377b||0x1f4;return function(_0x5ccf80){logger[_0xca54('0x27')](_0x5ccf80[_0xca54('0x28')]);if(_0x5ccf80['name']){delete _0x5ccf80[_0xca54('0x29')];}_0x267681[_0xca54('0x18')](_0x41377b)[_0xca54('0x2a')](_0x5ccf80);};}exports[_0xca54('0x2b')]=function(_0x90ea71,_0x37144f){var _0x485860={},_0x4da97a={},_0x4c2180={'count':0x0,'rows':[]};var _0x3f4b7f=_[_0xca54('0x2c')](db[_0xca54('0x2d')]['rawAttributes'],function(_0x356afa){return{'name':_0x356afa[_0xca54('0x2e')],'type':_0x356afa[_0xca54('0x2f')][_0xca54('0x30')]};});_0x4da97a[_0xca54('0x31')]=_[_0xca54('0x2c')](_0x3f4b7f,'name');_0x4da97a[_0xca54('0x32')]=_[_0xca54('0x33')](_0x90ea71[_0xca54('0x32')]);_0x4da97a[_0xca54('0x34')]=_[_0xca54('0x35')](_0x4da97a['model'],_0x4da97a['query']);_0x485860[_0xca54('0x36')]=_[_0xca54('0x35')](_0x4da97a['model'],qs[_0xca54('0x37')](_0x90ea71[_0xca54('0x32')][_0xca54('0x37')]));_0x485860[_0xca54('0x36')]=_0x485860[_0xca54('0x36')][_0xca54('0x38')]?_0x485860[_0xca54('0x36')]:_0x4da97a['model'];if(!_0x90ea71[_0xca54('0x32')][_0xca54('0x39')](_0xca54('0x3a'))){_0x485860['limit']=qs[_0xca54('0x1d')](_0x90ea71[_0xca54('0x32')][_0xca54('0x1d')]);_0x485860[_0xca54('0x1b')]=qs['offset'](_0x90ea71['query'][_0xca54('0x1b')]);}_0x485860[_0xca54('0x3b')]=qs[_0xca54('0x3c')](_0x90ea71['query'][_0xca54('0x3c')]);_0x485860[_0xca54('0x3d')]=qs['filters'](_[_0xca54('0x3e')](_0x90ea71[_0xca54('0x32')],_0x4da97a['filters']),_0x3f4b7f);if(_0x90ea71[_0xca54('0x32')][_0xca54('0x3f')]){_0x485860[_0xca54('0x3d')]=_[_0xca54('0x40')](_0x485860['where'],{'$or':_[_0xca54('0x2c')](_0x3f4b7f,function(_0x35c72f){if(_0x35c72f['type']!==_0xca54('0x41')){var _0x18cccb={};_0x18cccb[_0x35c72f['name']]={'$like':'%'+_0x90ea71[_0xca54('0x32')]['filter']+'%'};return _0x18cccb;}})});}_0x485860=_['merge']({},_0x485860,_0x90ea71[_0xca54('0x42')]);var _0x4a7766={'where':_0x485860[_0xca54('0x3d')]};return db[_0xca54('0x2d')][_0xca54('0x1e')](_0x4a7766)[_0xca54('0x24')](function(_0x4c527c){_0x4c2180['count']=_0x4c527c;if(_0x90ea71[_0xca54('0x32')][_0xca54('0x43')]){_0x485860['include']=[{'all':!![]}];}return db['Disposition'][_0xca54('0x44')](_0x485860);})['then'](function(_0x1f213c){_0x4c2180[_0xca54('0x45')]=_0x1f213c;return _0x4c2180;})['then'](respondWithFilteredResult(_0x37144f,_0x485860))['catch'](handleError(_0x37144f,null));};exports['show']=function(_0x591691,_0x1877ae){var _0x3fa53d={'raw':!![],'where':{'id':_0x591691[_0xca54('0x46')]['id']}},_0x4e44fc={};_0x4e44fc[_0xca54('0x31')]=_[_0xca54('0x33')](db[_0xca54('0x2d')][_0xca54('0x47')]);_0x4e44fc[_0xca54('0x32')]=_[_0xca54('0x33')](_0x591691['query']);_0x4e44fc[_0xca54('0x34')]=_['intersection'](_0x4e44fc[_0xca54('0x31')],_0x4e44fc[_0xca54('0x32')]);_0x3fa53d[_0xca54('0x36')]=_['intersection'](_0x4e44fc[_0xca54('0x31')],qs[_0xca54('0x37')](_0x591691[_0xca54('0x32')][_0xca54('0x37')]));_0x3fa53d[_0xca54('0x36')]=_0x3fa53d['attributes'][_0xca54('0x38')]?_0x3fa53d[_0xca54('0x36')]:_0x4e44fc[_0xca54('0x31')];if(_0x591691['query'][_0xca54('0x43')]){_0x3fa53d[_0xca54('0x48')]=[{'all':!![]}];}_0x3fa53d=_[_0xca54('0x40')]({},_0x3fa53d,_0x591691[_0xca54('0x42')]);return db['Disposition']['find'](_0x3fa53d)[_0xca54('0x24')](handleEntityNotFound(_0x1877ae,null))[_0xca54('0x24')](respondWithResult(_0x1877ae,null))['catch'](handleError(_0x1877ae,null));};exports[_0xca54('0x49')]=function(_0x45077d,_0x35a6a5){return db[_0xca54('0x2d')][_0xca54('0x49')](_0x45077d[_0xca54('0x4a')],{})[_0xca54('0x24')](function(_0x243504){var _0x401382=_0x45077d[_0xca54('0x4b')][_0xca54('0x4c')]({'plain':!![]});if(!_0x401382)throw new Error(_0xca54('0x4d'));if(_0x401382[_0xca54('0x4e')]==='user'){var _0x68ca33=_0x243504[_0xca54('0x4c')]({'plain':!![]});var _0x575d9c=_0xca54('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x575d9c,'userProfileId':_0x401382[_0xca54('0x50')]},'raw':!![]})[_0xca54('0x24')](function(_0x37f579){if(_0x37f579&&_0x37f579['autoAssociation']===0x0){return db[_0xca54('0x26')][_0xca54('0x49')]({'name':_0x68ca33['name'],'resourceId':_0x68ca33['id'],'type':_0x37f579['name'],'sectionId':_0x37f579['id']},{})[_0xca54('0x24')](function(){return _0x243504;});}else{return _0x243504;}})['catch'](function(_0x56de7e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56de7e);throw _0x56de7e;});}return _0x243504;})['then'](respondWithResult(_0x35a6a5,0xc9))[_0xca54('0x51')](handleError(_0x35a6a5,null));};exports[_0xca54('0x23')]=function(_0x1172a2,_0x46a3f9){if(_0x1172a2['body']['id']){delete _0x1172a2['body']['id'];}return db['Disposition'][_0xca54('0x52')]({'where':{'id':_0x1172a2['params']['id']}})[_0xca54('0x24')](handleEntityNotFound(_0x46a3f9,null))[_0xca54('0x24')](saveUpdates(_0x1172a2[_0xca54('0x4a')],null))[_0xca54('0x24')](respondWithResult(_0x46a3f9,null))['catch'](handleError(_0x46a3f9,null));};exports['destroy']=function(_0x257186,_0x5cf5dd){return db['Disposition'][_0xca54('0x52')]({'where':{'id':_0x257186[_0xca54('0x46')]['id']}})[_0xca54('0x24')](handleEntityNotFound(_0x5cf5dd,null))[_0xca54('0x24')](removeEntity(_0x5cf5dd,null))[_0xca54('0x51')](handleError(_0x5cf5dd,null));}; \ No newline at end of file +var _0x1be5=['../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1be5,0x91));var _0x51be=function(_0x3738ac,_0xbd08ae){_0x3738ac=_0x3738ac-0x0;var _0x427d84=_0x1be5[_0x3738ac];return _0x427d84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51be('0x0'));var zipdir=require(_0x51be('0x1'));var jsonpatch=require(_0x51be('0x2'));var rp=require(_0x51be('0x3'));var moment=require(_0x51be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51be('0x5'));var util=require(_0x51be('0x6'));var path=require(_0x51be('0x7'));var sox=require('sox');var csv=require(_0x51be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51be('0x9'));var _=require(_0x51be('0xa'));var squel=require('squel');var crypto=require(_0x51be('0xb'));var jsforce=require(_0x51be('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51be('0xd'));var Redis=require(_0x51be('0xe'));var authService=require(_0x51be('0xf'));var qs=require(_0x51be('0x10'));var as=require(_0x51be('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51be('0x12'))(_0x51be('0x13'));var utils=require(_0x51be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x51be('0x15'));var db=require(_0x51be('0x16'))['db'];function respondWithStatusCode(_0x323273,_0x54260c){_0x54260c=_0x54260c||0xcc;return function(_0x576b9){if(_0x576b9){return _0x323273[_0x51be('0x17')](_0x54260c);}return _0x323273['status'](_0x54260c)[_0x51be('0x18')]();};}function respondWithResult(_0x40b876,_0x1d3946){_0x1d3946=_0x1d3946||0xc8;return function(_0x429c04){if(_0x429c04){return _0x40b876['status'](_0x1d3946)['json'](_0x429c04);}};}function respondWithFilteredResult(_0x2db114,_0x21d6b0){return function(_0x573fc5){if(_0x573fc5){var _0xe5debf=typeof _0x21d6b0[_0x51be('0x19')]===_0x51be('0x1a')&&typeof _0x21d6b0[_0x51be('0x1b')]===_0x51be('0x1a');var _0x164ba9=_0x573fc5[_0x51be('0x1c')];var _0x31b2cd=_0xe5debf?0x0:_0x21d6b0['offset'];var _0x3c6f4f=_0xe5debf?_0x573fc5[_0x51be('0x1c')]:_0x21d6b0[_0x51be('0x19')]+_0x21d6b0['limit'];var _0x5861fb;if(_0x3c6f4f>=_0x164ba9){_0x3c6f4f=_0x164ba9;_0x5861fb=0xc8;}else{_0x5861fb=0xce;}_0x2db114[_0x51be('0x1d')](_0x5861fb);return _0x2db114[_0x51be('0x1e')](_0x51be('0x1f'),_0x31b2cd+'-'+_0x3c6f4f+'/'+_0x164ba9)['json'](_0x573fc5);}return null;};}function patchUpdates(_0x15fdc4){return function(_0x1606fc){try{jsonpatch[_0x51be('0x20')](_0x1606fc,_0x15fdc4,!![]);}catch(_0x5e5458){return BPromise[_0x51be('0x21')](_0x5e5458);}return _0x1606fc[_0x51be('0x22')]();};}function saveUpdates(_0x848039,_0x48f5e2){return function(_0xc25fa8){if(_0xc25fa8){return _0xc25fa8[_0x51be('0x23')](_0x848039)[_0x51be('0x24')](function(_0x2ff2af){return _0x2ff2af;});}return null;};}function removeEntity(_0x11a069,_0x2bf27f){return function(_0x29fb81){if(_0x29fb81){return _0x29fb81[_0x51be('0x25')]()[_0x51be('0x24')](function(){var _0x142f6e=_0x29fb81[_0x51be('0x26')]({'plain':!![]});var _0x216d82='Dispositions';return db[_0x51be('0x27')][_0x51be('0x25')]({'where':{'type':_0x216d82,'resourceId':_0x142f6e['id']}})[_0x51be('0x24')](function(){return _0x29fb81;});})[_0x51be('0x24')](function(){_0x11a069['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a282,_0x534e84){return function(_0x1441dd){if(!_0x1441dd){_0x33a282[_0x51be('0x17')](0x194);}return _0x1441dd;};}function handleError(_0x160190,_0x144cb5){_0x144cb5=_0x144cb5||0x1f4;return function(_0x5ed9b1){logger[_0x51be('0x28')](_0x5ed9b1[_0x51be('0x29')]);if(_0x5ed9b1[_0x51be('0x2a')]){delete _0x5ed9b1[_0x51be('0x2a')];}_0x160190[_0x51be('0x1d')](_0x144cb5)[_0x51be('0x2b')](_0x5ed9b1);};}exports[_0x51be('0x2c')]=function(_0xe79b15,_0x29a7ae){var _0x4e8f45={},_0x25f909={},_0xbee9fe={'count':0x0,'rows':[]};var _0x25fd43=_[_0x51be('0x2d')](db[_0x51be('0x2e')][_0x51be('0x2f')],function(_0x2b75f){return{'name':_0x2b75f[_0x51be('0x30')],'type':_0x2b75f[_0x51be('0x31')][_0x51be('0x32')]};});_0x25f909[_0x51be('0x33')]=_[_0x51be('0x2d')](_0x25fd43,'name');_0x25f909['query']=_[_0x51be('0x34')](_0xe79b15['query']);_0x25f909[_0x51be('0x35')]=_[_0x51be('0x36')](_0x25f909[_0x51be('0x33')],_0x25f909['query']);_0x4e8f45[_0x51be('0x37')]=_['intersection'](_0x25f909[_0x51be('0x33')],qs['fields'](_0xe79b15[_0x51be('0x38')]['fields']));_0x4e8f45[_0x51be('0x37')]=_0x4e8f45[_0x51be('0x37')]['length']?_0x4e8f45[_0x51be('0x37')]:_0x25f909[_0x51be('0x33')];if(!_0xe79b15['query'][_0x51be('0x39')](_0x51be('0x3a'))){_0x4e8f45['limit']=qs[_0x51be('0x1b')](_0xe79b15[_0x51be('0x38')][_0x51be('0x1b')]);_0x4e8f45['offset']=qs[_0x51be('0x19')](_0xe79b15[_0x51be('0x38')]['offset']);}_0x4e8f45[_0x51be('0x3b')]=qs[_0x51be('0x3c')](_0xe79b15[_0x51be('0x38')][_0x51be('0x3c')]);_0x4e8f45[_0x51be('0x3d')]=qs[_0x51be('0x35')](_['pick'](_0xe79b15[_0x51be('0x38')],_0x25f909['filters']),_0x25fd43);if(_0xe79b15['query'][_0x51be('0x3e')]){_0x4e8f45[_0x51be('0x3d')]=_[_0x51be('0x3f')](_0x4e8f45['where'],{'$or':_[_0x51be('0x2d')](_0x25fd43,function(_0x223358){if(_0x223358[_0x51be('0x31')]!==_0x51be('0x40')){var _0x15fd43={};_0x15fd43[_0x223358[_0x51be('0x2a')]]={'$like':'%'+_0xe79b15['query'][_0x51be('0x3e')]+'%'};return _0x15fd43;}})});}_0x4e8f45=_['merge']({},_0x4e8f45,_0xe79b15[_0x51be('0x41')]);var _0xd1ff90={'where':_0x4e8f45[_0x51be('0x3d')]};return db[_0x51be('0x2e')][_0x51be('0x1c')](_0xd1ff90)['then'](function(_0x4a742d){_0xbee9fe[_0x51be('0x1c')]=_0x4a742d;if(_0xe79b15['query'][_0x51be('0x42')]){_0x4e8f45[_0x51be('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x51be('0x44')](_0x4e8f45);})['then'](function(_0x5dae46){_0xbee9fe[_0x51be('0x45')]=_0x5dae46;return _0xbee9fe;})[_0x51be('0x24')](respondWithFilteredResult(_0x29a7ae,_0x4e8f45))[_0x51be('0x46')](handleError(_0x29a7ae,null));};exports[_0x51be('0x47')]=function(_0xfd7296,_0x7724f9){var _0xa4dfe3={'raw':!![],'where':{'id':_0xfd7296[_0x51be('0x48')]['id']}},_0x577f83={};_0x577f83[_0x51be('0x33')]=_[_0x51be('0x34')](db['Disposition'][_0x51be('0x2f')]);_0x577f83[_0x51be('0x38')]=_[_0x51be('0x34')](_0xfd7296['query']);_0x577f83[_0x51be('0x35')]=_[_0x51be('0x36')](_0x577f83['model'],_0x577f83[_0x51be('0x38')]);_0xa4dfe3[_0x51be('0x37')]=_[_0x51be('0x36')](_0x577f83[_0x51be('0x33')],qs['fields'](_0xfd7296[_0x51be('0x38')][_0x51be('0x49')]));_0xa4dfe3[_0x51be('0x37')]=_0xa4dfe3[_0x51be('0x37')]['length']?_0xa4dfe3[_0x51be('0x37')]:_0x577f83[_0x51be('0x33')];if(_0xfd7296[_0x51be('0x38')][_0x51be('0x42')]){_0xa4dfe3[_0x51be('0x43')]=[{'all':!![]}];}_0xa4dfe3=_[_0x51be('0x3f')]({},_0xa4dfe3,_0xfd7296[_0x51be('0x41')]);return db[_0x51be('0x2e')]['find'](_0xa4dfe3)['then'](handleEntityNotFound(_0x7724f9,null))[_0x51be('0x24')](respondWithResult(_0x7724f9,null))[_0x51be('0x46')](handleError(_0x7724f9,null));};exports[_0x51be('0x4a')]=function(_0xbfb3ac,_0x448cde){return db['Disposition'][_0x51be('0x4a')](_0xbfb3ac[_0x51be('0x4b')],{})[_0x51be('0x24')](function(_0x23ad0d){var _0x3fdc11=_0xbfb3ac['user'][_0x51be('0x26')]({'plain':!![]});if(!_0x3fdc11)throw new Error(_0x51be('0x4c'));if(_0x3fdc11[_0x51be('0x4d')]===_0x51be('0x4e')){var _0x1af19f=_0x23ad0d[_0x51be('0x26')]({'plain':!![]});var _0x5c122d=_0x51be('0x4f');return db['UserProfileSection'][_0x51be('0x50')]({'where':{'name':_0x5c122d,'userProfileId':_0x3fdc11[_0x51be('0x51')]},'raw':!![]})[_0x51be('0x24')](function(_0x3adb04){if(_0x3adb04&&_0x3adb04['autoAssociation']===0x0){return db[_0x51be('0x27')]['create']({'name':_0x1af19f[_0x51be('0x2a')],'resourceId':_0x1af19f['id'],'type':_0x3adb04['name'],'sectionId':_0x3adb04['id']},{})['then'](function(){return _0x23ad0d;});}else{return _0x23ad0d;}})[_0x51be('0x46')](function(_0x49bd51){logger[_0x51be('0x28')](_0x51be('0x52'),_0x49bd51);throw _0x49bd51;});}return _0x23ad0d;})['then'](respondWithResult(_0x448cde,0xc9))[_0x51be('0x46')](handleError(_0x448cde,null));};exports[_0x51be('0x23')]=function(_0x506546,_0xd7242e){if(_0x506546[_0x51be('0x4b')]['id']){delete _0x506546['body']['id'];}return db['Disposition'][_0x51be('0x50')]({'where':{'id':_0x506546[_0x51be('0x48')]['id']}})[_0x51be('0x24')](handleEntityNotFound(_0xd7242e,null))['then'](saveUpdates(_0x506546[_0x51be('0x4b')],null))[_0x51be('0x24')](respondWithResult(_0xd7242e,null))[_0x51be('0x46')](handleError(_0xd7242e,null));};exports[_0x51be('0x25')]=function(_0x2212d7,_0x401c97){return db[_0x51be('0x2e')]['find']({'where':{'id':_0x2212d7['params']['id']}})[_0x51be('0x24')](handleEntityNotFound(_0x401c97,null))['then'](removeEntity(_0x401c97,null))['catch'](handleError(_0x401c97,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5ac8ebf..f10e7ff 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 _0x9c26=['name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','moment','bluebird','rimraf','./disposition.attributes','define','tools_dispositions'];(function(_0x5eacf6,_0x174135){var _0x1f68a1=function(_0x5277bb){while(--_0x5277bb){_0x5eacf6['push'](_0x5eacf6['shift']());}};_0x1f68a1(++_0x174135);}(_0x9c26,0x111));var _0x69c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69c2('0x0'))('api');var moment=require(_0x69c2('0x1'));var BPromise=require(_0x69c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69c2('0x3'));var config=require('../../config/environment');var attributes=require(_0x69c2('0x4'));module['exports']=function(_0x428f42,_0x5bb3ff){return _0x428f42[_0x69c2('0x5')]('Disposition',attributes,{'tableName':_0x69c2('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x69c2('0x7'),'fields':[_0x69c2('0x8'),'ListId']},{'unique':!![],'name':_0x69c2('0x9'),'fields':[_0x69c2('0x8'),_0x69c2('0xa')]},{'unique':!![],'name':_0x69c2('0xb'),'fields':[_0x69c2('0x8'),'MailAccountId']},{'unique':!![],'name':_0x69c2('0xc'),'fields':[_0x69c2('0x8'),_0x69c2('0xd')]},{'unique':!![],'name':_0x69c2('0xe'),'fields':['name',_0x69c2('0xf')]},{'unique':!![],'name':_0x69c2('0x10'),'fields':[_0x69c2('0x8'),_0x69c2('0x11')]},{'unique':!![],'name':_0x69c2('0x12'),'fields':[_0x69c2('0x8'),_0x69c2('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94f4=['Disposition','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf','./disposition.attributes','define'];(function(_0x16b9e0,_0x5ad182){var _0x57c056=function(_0x37d4e9){while(--_0x37d4e9){_0x16b9e0['push'](_0x16b9e0['shift']());}};_0x57c056(++_0x5ad182);}(_0x94f4,0x12b));var _0x494f=function(_0x1f15f7,_0x42b0e7){_0x1f15f7=_0x1f15f7-0x0;var _0x4ea299=_0x94f4[_0x1f15f7];return _0x4ea299;};'use strict';var _=require(_0x494f('0x0'));var util=require(_0x494f('0x1'));var logger=require('../../config/logger')(_0x494f('0x2'));var moment=require(_0x494f('0x3'));var BPromise=require(_0x494f('0x4'));var rp=require(_0x494f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x494f('0x6'));var config=require('../../config/environment');var attributes=require(_0x494f('0x7'));module['exports']=function(_0x409ac6,_0x255e9b){return _0x409ac6[_0x494f('0x8')](_0x494f('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x494f('0xa'),_0x494f('0xb')]},{'unique':!![],'name':_0x494f('0xc'),'fields':[_0x494f('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x494f('0xd'),'fields':[_0x494f('0xa'),_0x494f('0xe')]},{'unique':!![],'name':_0x494f('0xf'),'fields':['name',_0x494f('0x10')]},{'unique':!![],'name':_0x494f('0x11'),'fields':[_0x494f('0xa'),_0x494f('0x12')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x494f('0x13')]},{'unique':!![],'name':_0x494f('0x14'),'fields':[_0x494f('0xa'),_0x494f('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ad5b6b5..7d9e5cf 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(_0xfdb4e5,_0x20f58f){var _0x107fb5=function(_0x252788){while(--_0x252788){_0xfdb4e5['push'](_0xfdb4e5['shift']());}};_0x107fb5(++_0x20f58f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x5c79c9,_0x12b4f2){var _0x5b4986=function(_0x3f891b){while(--_0x3f891b){_0x5c79c9['push'](_0x5c79c9['shift']());}};_0x5b4986(++_0x12b4f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 7ab3ce2..bf1b4e0 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 _0x07a2=['./disposition.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1696b9,_0x2e3ee4){var _0x1e9de8=function(_0x4c06a3){while(--_0x4c06a3){_0x1696b9['push'](_0x1696b9['shift']());}};_0x1e9de8(++_0x2e3ee4);}(_0x07a2,0xac));var _0x207a=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x07a2[_0x14e9f0];return _0xa63f7e;};'use strict';var multer=require('multer');var util=require(_0x207a('0x0'));var path=require(_0x207a('0x1'));var timeout=require('connect-timeout');var express=require(_0x207a('0x2'));var router=express[_0x207a('0x3')]();var fs_extra=require(_0x207a('0x4'));var auth=require(_0x207a('0x5'));var interaction=require(_0x207a('0x6'));var config=require(_0x207a('0x7'));var controller=require(_0x207a('0x8'));router[_0x207a('0x9')]('/',auth[_0x207a('0xa')](),controller['index']);router[_0x207a('0x9')](_0x207a('0xb'),auth[_0x207a('0xa')](),controller['show']);router[_0x207a('0xc')]('/',auth[_0x207a('0xa')](),controller[_0x207a('0xd')]);router[_0x207a('0xe')](_0x207a('0xb'),auth[_0x207a('0xa')](),controller[_0x207a('0xf')]);router['delete'](_0x207a('0xb'),auth[_0x207a('0xa')](),controller[_0x207a('0x10')]);module[_0x207a('0x11')]=router; \ No newline at end of file +var _0x0c73=['exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x2eedf6,_0x300207){var _0x414e5c=function(_0xa35c71){while(--_0xa35c71){_0x2eedf6['push'](_0x2eedf6['shift']());}};_0x414e5c(++_0x300207);}(_0x0c73,0x1b1));var _0x30c7=function(_0x46ebb8,_0xc96aa1){_0x46ebb8=_0x46ebb8-0x0;var _0x126fd1=_0x0c73[_0x46ebb8];return _0x126fd1;};'use strict';var multer=require('multer');var util=require(_0x30c7('0x0'));var path=require('path');var timeout=require(_0x30c7('0x1'));var express=require(_0x30c7('0x2'));var router=express[_0x30c7('0x3')]();var fs_extra=require(_0x30c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30c7('0x5'));var config=require(_0x30c7('0x6'));var controller=require('./disposition.controller');router[_0x30c7('0x7')]('/',auth[_0x30c7('0x8')](),controller[_0x30c7('0x9')]);router[_0x30c7('0x7')](_0x30c7('0xa'),auth['isAuthenticated'](),controller[_0x30c7('0xb')]);router[_0x30c7('0xc')]('/',auth[_0x30c7('0x8')](),controller['create']);router[_0x30c7('0xd')]('/:id',auth[_0x30c7('0x8')](),controller[_0x30c7('0xe')]);router[_0x30c7('0xf')](_0x30c7('0xa'),auth[_0x30c7('0x8')](),controller[_0x30c7('0x10')]);module[_0x30c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 022326e..a2081a2 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 _0x71ab=['SIP','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','DADHI','KHOMP'];(function(_0x1fe503,_0x6e1361){var _0x13740c=function(_0x32f783){while(--_0x32f783){_0x1fe503['push'](_0x1fe503['shift']());}};_0x13740c(++_0x6e1361);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb71a('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xb71a('0x2'),'no'),'defaultValue':_0xb71a('0x2')},'headerinfo':{'type':Sequelize[_0xb71a('0x1')],'defaultValue':_0xb71a('0x3')},'localstationid':{'type':Sequelize[_0xb71a('0x1')],'unique':_0xb71a('0x4')},'minrate':{'type':Sequelize[_0xb71a('0x5')](_0xb71a('0x6'),_0xb71a('0x7'),_0xb71a('0x8'),_0xb71a('0x9'),_0xb71a('0xa'),_0xb71a('0xb')),'defaultValue':_0xb71a('0x7')},'maxrate':{'type':Sequelize[_0xb71a('0x5')](_0xb71a('0x6'),_0xb71a('0x7'),_0xb71a('0x8'),'9600',_0xb71a('0xa'),'14400'),'defaultValue':_0xb71a('0xb')},'modem':{'type':Sequelize[_0xb71a('0x1')],'defaultValue':_0xb71a('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb71a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb71a('0x5')]('SIP','IAX',_0xb71a('0xd'),_0xb71a('0xe')),'defaultValue':_0xb71a('0xf')},'key':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb71a('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb71a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb71a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb71a('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb71a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb71a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb71a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb71a('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0xb71a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb71a('0x13'),'set':function(_0x2d6369){if(!_0x2d6369)this[_0xb71a('0x14')](_0xb71a('0x15'),null);this[_0xb71a('0x14')](_0xb71a('0x16'),_0x2d6369);}}}; \ No newline at end of file +var _0xc359=['INTEGER','IAX','DADHI','KHOMP','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','12000','14400','4800','2400','9600','v17,v27,v29'];(function(_0x2798e1,_0x48c03c){var _0x5264c2=function(_0x1e5780){while(--_0x1e5780){_0x2798e1['push'](_0x2798e1['shift']());}};_0x5264c2(++_0x48c03c);}(_0xc359,0x1d9));var _0x9c35=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xc359[_0x58a4fe];return _0x697de2;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c35('0x1')]},'ecm':{'type':Sequelize[_0x9c35('0x2')](_0x9c35('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x9c35('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x9c35('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x9c35('0x2')]('2400','4800','7200','9600',_0x9c35('0x4'),_0x9c35('0x5')),'defaultValue':_0x9c35('0x6')},'maxrate':{'type':Sequelize[_0x9c35('0x2')](_0x9c35('0x7'),_0x9c35('0x6'),'7200',_0x9c35('0x8'),_0x9c35('0x4'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x9c35('0x9')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9c35('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c35('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c35('0x2')]('SIP',_0x9c35('0xb'),_0x9c35('0xc'),_0x9c35('0xd')),'defaultValue':_0x9c35('0xe')},'key':{'type':Sequelize[_0x9c35('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9c35('0xf');}},'notificationSound':{'type':Sequelize[_0x9c35('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c35('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c35('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c35('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c35('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c35('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c35('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c35('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c35('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x9c35('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x9c35('0x10')],'defaultValue':![],'comment':_0x9c35('0x12'),'set':function(_0x911bba){if(!_0x911bba)this[_0x9c35('0x13')]('mandatoryDispositionPauseId',null);this[_0x9c35('0x13')](_0x9c35('0x14'),_0x911bba);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1ae3098..09d4c71 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 _0x9d1a=['basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','out','ContactId','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','FaxAccount','findAll','rows','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','keys','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','exten','localstationid','app','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','minrate','modem','t38timeout','FAXOPT(','/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','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','join','root','server/files/attachments'];(function(_0x31ba5f,_0x3c9e8f){var _0x1d58de=function(_0x240699){while(--_0x240699){_0x31ba5f['push'](_0x31ba5f['shift']());}};_0x1d58de(++_0x3c9e8f);}(_0x9d1a,0x1a3));var _0xa9d1=function(_0x169c76,_0x5a315a){_0x169c76=_0x169c76-0x0;var _0x458949=_0x9d1a[_0x169c76];return _0x458949;};'use strict';var emlformat=require(_0xa9d1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9d1('0x1'));var rp=require(_0xa9d1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa9d1('0x3'));var util=require('util');var path=require(_0xa9d1('0x4'));var sox=require('sox');var csv=require(_0xa9d1('0x5'));var ejs=require(_0xa9d1('0x6'));var fs=require('fs');var fs_extra=require(_0xa9d1('0x7'));var _=require(_0xa9d1('0x8'));var squel=require(_0xa9d1('0x9'));var crypto=require(_0xa9d1('0xa'));var jsforce=require(_0xa9d1('0xb'));var deskjs=require(_0xa9d1('0xc'));var toCsv=require(_0xa9d1('0x5'));var querystring=require(_0xa9d1('0xd'));var Papa=require(_0xa9d1('0xe'));var Redis=require(_0xa9d1('0xf'));var authService=require(_0xa9d1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9d1('0x11'));var logger=require(_0xa9d1('0x12'))(_0xa9d1('0x13'));var utils=require(_0xa9d1('0x14'));var config=require(_0xa9d1('0x15'));var licenseUtil=require(_0xa9d1('0x16'));var db=require('../../mysqldb')['db'];config[_0xa9d1('0x17')]=_[_0xa9d1('0x18')](config[_0xa9d1('0x17')],{'host':_0xa9d1('0x19'),'port':0x18eb});var socket=require(_0xa9d1('0x1a'))(new Redis(config[_0xa9d1('0x17')]));require('./faxAccount.socket')[_0xa9d1('0x1b')](socket);var jayson=require(_0xa9d1('0x1c'));var client=jayson[_0xa9d1('0x1d')][_0xa9d1('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa04e53,_0x59a6ac,_0x517c39,_0x3c3706){return new BPromise(function(_0x14de85,_0x539c86){var _0x2225c7=_0x3c3706||client;return _0x2225c7[_0xa9d1('0x1f')](_0xa04e53,_0x517c39)[_0xa9d1('0x20')](function(_0x1cfa3a){logger[_0xa9d1('0x21')](_0xa9d1('0x22'),_0x59a6ac,_0xa9d1('0x23'));logger[_0xa9d1('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x59a6ac,'request\x20sent',JSON[_0xa9d1('0x25')](_0x1cfa3a));if(_0x1cfa3a[_0xa9d1('0x26')]){if(_0x1cfa3a[_0xa9d1('0x26')][_0xa9d1('0x27')]===0x1f4){logger[_0xa9d1('0x26')](_0xa9d1('0x22'),_0x59a6ac,_0x1cfa3a[_0xa9d1('0x26')][_0xa9d1('0x28')]);return _0x539c86(_0x1cfa3a[_0xa9d1('0x26')][_0xa9d1('0x28')]);}logger[_0xa9d1('0x26')](_0xa9d1('0x22'),_0x59a6ac,_0x1cfa3a[_0xa9d1('0x26')]['message']);return _0x14de85(_0x1cfa3a[_0xa9d1('0x26')][_0xa9d1('0x28')]);}else{logger[_0xa9d1('0x21')](_0xa9d1('0x22'),_0x59a6ac,_0xa9d1('0x23'));_0x14de85(_0x1cfa3a[_0xa9d1('0x29')]['message']);}})[_0xa9d1('0x2a')](function(_0x3e4e78){logger['error'](_0xa9d1('0x22'),_0x59a6ac,_0x3e4e78);_0x539c86(_0x3e4e78);});});}function respondWithStatusCode(_0x25f50c,_0x5b468e){_0x5b468e=_0x5b468e||0xcc;return function(_0x1e0d85){if(_0x1e0d85){return _0x25f50c[_0xa9d1('0x2b')](_0x5b468e);}return _0x25f50c[_0xa9d1('0x2c')](_0x5b468e)[_0xa9d1('0x2d')]();};}function respondWithResult(_0x4387ef,_0x27942c){_0x27942c=_0x27942c||0xc8;return function(_0x2a87c6){if(_0x2a87c6){return _0x4387ef[_0xa9d1('0x2c')](_0x27942c)[_0xa9d1('0x2e')](_0x2a87c6);}};}function respondWithFilteredResult(_0x583d70,_0x2e2726){return function(_0x1e5301){if(_0x1e5301){var _0x36fa41=typeof _0x2e2726[_0xa9d1('0x2f')]==='undefined'&&typeof _0x2e2726[_0xa9d1('0x30')]===_0xa9d1('0x31');var _0x4dc49f=_0x1e5301['count'];var _0x4a68d8=_0x36fa41?0x0:_0x2e2726[_0xa9d1('0x2f')];var _0x221f72=_0x36fa41?_0x1e5301[_0xa9d1('0x32')]:_0x2e2726['offset']+_0x2e2726[_0xa9d1('0x30')];var _0x327e92;if(_0x221f72>=_0x4dc49f){_0x221f72=_0x4dc49f;_0x327e92=0xc8;}else{_0x327e92=0xce;}_0x583d70[_0xa9d1('0x2c')](_0x327e92);return _0x583d70[_0xa9d1('0x33')](_0xa9d1('0x34'),_0x4a68d8+'-'+_0x221f72+'/'+_0x4dc49f)[_0xa9d1('0x2e')](_0x1e5301);}return null;};}function patchUpdates(_0x4b69f4){return function(_0x5ea281){try{jsonpatch[_0xa9d1('0x35')](_0x5ea281,_0x4b69f4,!![]);}catch(_0x5450ed){return BPromise[_0xa9d1('0x36')](_0x5450ed);}return _0x5ea281[_0xa9d1('0x37')]();};}function saveUpdates(_0x4a8926,_0x2a143e){return function(_0x448d5e){if(_0x448d5e){return _0x448d5e[_0xa9d1('0x38')](_0x4a8926)[_0xa9d1('0x20')](function(_0x3655c0){return _0x3655c0;});}return null;};}function removeEntity(_0x2cb444,_0x5b8aa9){return function(_0x326625){if(_0x326625){return _0x326625[_0xa9d1('0x39')]()[_0xa9d1('0x20')](function(){var _0x7dfc44=_0x326625['get']({'plain':!![]});var _0x4ef61c=_0xa9d1('0x3a');return db[_0xa9d1('0x3b')][_0xa9d1('0x39')]({'where':{'type':_0x4ef61c,'resourceId':_0x7dfc44['id']}})[_0xa9d1('0x20')](function(){return _0x326625;});})['then'](function(){_0x2cb444[_0xa9d1('0x2c')](0xcc)[_0xa9d1('0x2d')]();});}};}function handleEntityNotFound(_0x457f7a,_0x3bfa4d){return function(_0x20b3ad){if(!_0x20b3ad){_0x457f7a[_0xa9d1('0x2b')](0x194);}return _0x20b3ad;};}function handleError(_0xb16dbe,_0x3f3cd6){_0x3f3cd6=_0x3f3cd6||0x1f4;return function(_0x4adca1){logger['error'](_0x4adca1[_0xa9d1('0x3c')]);if(_0x4adca1['name']){delete _0x4adca1['name'];}_0xb16dbe['status'](_0x3f3cd6)['send'](_0x4adca1);};}exports[_0xa9d1('0x3d')]=function(_0x27c213,_0x2085b4){var _0x210878={'include':[{'model':db[_0xa9d1('0x3e')],'as':_0xa9d1('0x3f')}]},_0x50d3fc={},_0x5e8e99={'count':0x0,'rows':[]};var _0x2a0b3f=_[_0xa9d1('0x40')](db['FaxAccount'][_0xa9d1('0x41')],function(_0x384bbf){return{'name':_0x384bbf[_0xa9d1('0x42')],'type':_0x384bbf[_0xa9d1('0x43')][_0xa9d1('0x44')]};});_0x50d3fc['model']=_[_0xa9d1('0x40')](_0x2a0b3f,_0xa9d1('0x45'));_0x50d3fc[_0xa9d1('0x46')]=_['keys'](_0x27c213[_0xa9d1('0x46')]);_0x50d3fc['filters']=_[_0xa9d1('0x47')](_0x50d3fc[_0xa9d1('0x48')],_0x50d3fc[_0xa9d1('0x46')]);_0x210878[_0xa9d1('0x49')]=_[_0xa9d1('0x47')](_0x50d3fc['model'],qs[_0xa9d1('0x4a')](_0x27c213[_0xa9d1('0x46')]['fields']));_0x210878[_0xa9d1('0x49')]=_0x210878[_0xa9d1('0x49')][_0xa9d1('0x4b')]?_0x210878[_0xa9d1('0x49')]:_0x50d3fc[_0xa9d1('0x48')];if(!_0x27c213[_0xa9d1('0x46')][_0xa9d1('0x4c')](_0xa9d1('0x4d'))){_0x210878[_0xa9d1('0x30')]=qs['limit'](_0x27c213[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x210878[_0xa9d1('0x2f')]=qs[_0xa9d1('0x2f')](_0x27c213['query'][_0xa9d1('0x2f')]);}_0x210878[_0xa9d1('0x4e')]=qs[_0xa9d1('0x4f')](_0x27c213[_0xa9d1('0x46')]['sort']);_0x210878['where']=qs[_0xa9d1('0x50')](_[_0xa9d1('0x51')](_0x27c213['query'],_0x50d3fc[_0xa9d1('0x50')]),_0x2a0b3f);if(_0x27c213[_0xa9d1('0x46')][_0xa9d1('0x52')]){_0x210878[_0xa9d1('0x53')]=_[_0xa9d1('0x54')](_0x210878['where'],{'$or':_[_0xa9d1('0x40')](_0x2a0b3f,function(_0x4d872b){if(_0x4d872b[_0xa9d1('0x43')]!==_0xa9d1('0x55')){var _0x3e4ab6={};_0x3e4ab6[_0x4d872b[_0xa9d1('0x45')]]={'$like':'%'+_0x27c213[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x3e4ab6;}})});}_0x210878=_[_0xa9d1('0x54')]({},_0x210878,_0x27c213[_0xa9d1('0x56')]);var _0x3900a8={'where':_0x210878[_0xa9d1('0x53')]};return db['FaxAccount'][_0xa9d1('0x32')](_0x3900a8)['then'](function(_0x4ff481){_0x5e8e99['count']=_0x4ff481;if(_0x27c213[_0xa9d1('0x46')][_0xa9d1('0x57')]){_0x210878[_0xa9d1('0x58')]=[{'all':!![]}];}return db[_0xa9d1('0x59')][_0xa9d1('0x5a')](_0x210878);})[_0xa9d1('0x20')](function(_0x21f9bd){_0x5e8e99[_0xa9d1('0x5b')]=_0x21f9bd;return _0x5e8e99;})[_0xa9d1('0x20')](respondWithFilteredResult(_0x2085b4,_0x210878))['catch'](handleError(_0x2085b4,null));};exports[_0xa9d1('0x5c')]=function(_0x52e8eb,_0x15fe4e){var _0x3dae04={'raw':![],'where':{'id':_0x52e8eb[_0xa9d1('0x5d')]['id']},'include':[{'model':db[_0xa9d1('0x3e')],'as':_0xa9d1('0x3f')}]},_0x43869b={};_0x43869b['model']=_['keys'](db[_0xa9d1('0x59')][_0xa9d1('0x41')]);_0x43869b[_0xa9d1('0x46')]=_['keys'](_0x52e8eb[_0xa9d1('0x46')]);_0x43869b[_0xa9d1('0x50')]=_[_0xa9d1('0x47')](_0x43869b[_0xa9d1('0x48')],_0x43869b[_0xa9d1('0x46')]);_0x3dae04[_0xa9d1('0x49')]=_['intersection'](_0x43869b[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0x52e8eb[_0xa9d1('0x46')][_0xa9d1('0x4a')]));_0x3dae04[_0xa9d1('0x49')]=_0x3dae04[_0xa9d1('0x49')]['length']?_0x3dae04['attributes']:_0x43869b[_0xa9d1('0x48')];if(_0x52e8eb[_0xa9d1('0x46')]['includeAll']){_0x3dae04[_0xa9d1('0x58')]=[{'all':!![]}];}_0x3dae04=_['merge']({},_0x3dae04,_0x52e8eb[_0xa9d1('0x56')]);return db[_0xa9d1('0x59')]['find'](_0x3dae04)[_0xa9d1('0x20')](handleEntityNotFound(_0x15fe4e,null))['then'](respondWithResult(_0x15fe4e,null))[_0xa9d1('0x2a')](handleError(_0x15fe4e,null));};exports[_0xa9d1('0x5e')]=function(_0x4f9f7a,_0x5435d3){return db[_0xa9d1('0x59')][_0xa9d1('0x5e')](_0x4f9f7a['body'],{})['then'](function(_0x5011f4){var _0x2d60b5=_0x4f9f7a[_0xa9d1('0x5f')][_0xa9d1('0x60')]({'plain':!![]});if(!_0x2d60b5)throw new Error(_0xa9d1('0x61'));if(_0x2d60b5['role']===_0xa9d1('0x5f')){var _0x55c096=_0x5011f4[_0xa9d1('0x60')]({'plain':!![]});var _0x23f380=_0xa9d1('0x3a');return db[_0xa9d1('0x62')]['find']({'where':{'name':_0x23f380,'userProfileId':_0x2d60b5[_0xa9d1('0x63')]},'raw':!![]})[_0xa9d1('0x20')](function(_0x43276c){if(_0x43276c&&_0x43276c['autoAssociation']===0x0){return db[_0xa9d1('0x3b')]['create']({'name':_0x55c096['name'],'resourceId':_0x55c096['id'],'type':_0x43276c[_0xa9d1('0x45')],'sectionId':_0x43276c['id']},{})[_0xa9d1('0x20')](function(){return _0x5011f4;});}else{return _0x5011f4;}})[_0xa9d1('0x2a')](function(_0x2ac34e){logger[_0xa9d1('0x26')](_0xa9d1('0x64'),_0x2ac34e);throw _0x2ac34e;});}return _0x5011f4;})[_0xa9d1('0x20')](respondWithResult(_0x5435d3,0xc9))[_0xa9d1('0x2a')](handleError(_0x5435d3,null));};exports[_0xa9d1('0x38')]=function(_0x51d78f,_0x3238b8){if(_0x51d78f[_0xa9d1('0x65')]['id']){delete _0x51d78f[_0xa9d1('0x65')]['id'];}return db[_0xa9d1('0x59')][_0xa9d1('0x66')]({'where':{'id':_0x51d78f[_0xa9d1('0x5d')]['id']},'include':[{'model':db[_0xa9d1('0x3e')],'as':_0xa9d1('0x3f')}]})['then'](handleEntityNotFound(_0x3238b8,null))[_0xa9d1('0x20')](saveUpdates(_0x51d78f[_0xa9d1('0x65')],null))[_0xa9d1('0x20')](respondWithResult(_0x3238b8,null))['catch'](handleError(_0x3238b8,null));};exports[_0xa9d1('0x39')]=function(_0x1ae4f5,_0x4c9219){return db[_0xa9d1('0x59')][_0xa9d1('0x66')]({'where':{'id':_0x1ae4f5[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x4c9219,null))['then'](removeEntity(_0x4c9219,null))[_0xa9d1('0x2a')](handleError(_0x4c9219,null));};exports[_0xa9d1('0x67')]=function(_0x1552d4,_0x24b447){return db[_0xa9d1('0x59')]['describe']()[_0xa9d1('0x20')](respondWithResult(_0x24b447,null))['catch'](handleError(_0x24b447,null));};exports[_0xa9d1('0x68')]=function(_0x544f1a,_0x51a2ac,_0x36d4f0){if(_0x544f1a[_0xa9d1('0x65')]['id']){delete _0x544f1a['body']['id'];}return db[_0xa9d1('0x59')]['find']({'where':{'id':_0x544f1a['params']['id']}})['then'](handleEntityNotFound(_0x51a2ac,null))[_0xa9d1('0x20')](function(_0x50aae6){if(_0x50aae6){_0x544f1a[_0xa9d1('0x65')][_0xa9d1('0x69')]=_0x50aae6['id'];return db[_0xa9d1('0x6a')]['create'](_0x544f1a[_0xa9d1('0x65')]);}})[_0xa9d1('0x20')](respondWithResult(_0x51a2ac,null))[_0xa9d1('0x2a')](handleError(_0x51a2ac,null));};exports[_0xa9d1('0x6b')]=function(_0x67b7b1,_0xe4a480,_0x271e02){var _0x39c885={'raw':![],'where':{}};var _0x461f16={};var _0xf0264f={'count':0x0,'rows':[]};return db[_0xa9d1('0x59')][_0xa9d1('0x6c')]({'where':{'id':_0x67b7b1['params']['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0xe4a480,null))[_0xa9d1('0x20')](function(_0x5a11c3){if(_0x5a11c3){_0x461f16[_0xa9d1('0x48')]=_[_0xa9d1('0x6d')](db[_0xa9d1('0x6a')][_0xa9d1('0x41')]);_0x461f16[_0xa9d1('0x46')]=_[_0xa9d1('0x6d')](_0x67b7b1['query']);_0x461f16['filters']=_[_0xa9d1('0x47')](_0x461f16['model'],_0x461f16[_0xa9d1('0x46')]);_0x39c885[_0xa9d1('0x49')]=_[_0xa9d1('0x47')](_0x461f16[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0x67b7b1['query'][_0xa9d1('0x4a')]));_0x39c885[_0xa9d1('0x49')]=_0x39c885[_0xa9d1('0x49')]['length']?_0x39c885[_0xa9d1('0x49')]:_0x461f16[_0xa9d1('0x48')];if(!_0x67b7b1[_0xa9d1('0x46')]['hasOwnProperty'](_0xa9d1('0x4d'))){_0x39c885[_0xa9d1('0x30')]=qs[_0xa9d1('0x30')](_0x67b7b1['query'][_0xa9d1('0x30')]);_0x39c885[_0xa9d1('0x2f')]=qs['offset'](_0x67b7b1['query']['offset']);}_0x39c885[_0xa9d1('0x4e')]=qs[_0xa9d1('0x4f')](_0x67b7b1[_0xa9d1('0x46')]['sort']);_0x39c885[_0xa9d1('0x53')]=qs[_0xa9d1('0x50')](_[_0xa9d1('0x51')](_0x67b7b1[_0xa9d1('0x46')],_0x461f16['filters']));_0x39c885[_0xa9d1('0x53')][_0xa9d1('0x69')]=_0x5a11c3['id'];if(_0x67b7b1[_0xa9d1('0x46')][_0xa9d1('0x52')]){_0x39c885['where']=_[_0xa9d1('0x54')](_0x39c885['where'],{'$or':_['map'](_0x39c885[_0xa9d1('0x49')],function(_0x12fe1c){var _0x38463d={};_0x38463d[_0x12fe1c]={'$like':'%'+_0x67b7b1[_0xa9d1('0x46')]['filter']+'%'};return _0x38463d;})});}_0x39c885=_[_0xa9d1('0x54')]({},_0x39c885,_0x67b7b1[_0xa9d1('0x56')]);return db[_0xa9d1('0x6a')]['count']({'where':_0x39c885['where']})[_0xa9d1('0x20')](function(_0x3e145d){_0xf0264f[_0xa9d1('0x32')]=_0x3e145d;if(_0x67b7b1[_0xa9d1('0x46')][_0xa9d1('0x57')]){_0x39c885[_0xa9d1('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x39c885);})['then'](function(_0x438173){_0xf0264f[_0xa9d1('0x5b')]=_0x438173;return _0xf0264f;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0xe4a480,_0x39c885))[_0xa9d1('0x2a')](handleError(_0xe4a480,null));};exports['removeDispositions']=function(_0x5912af,_0x1d0335,_0x9cea7f){return db['FaxAccount'][_0xa9d1('0x66')]({'where':{'id':_0x5912af[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x1d0335,null))['then'](function(_0x3bf3c4){if(_0x3bf3c4){return _0x3bf3c4[_0xa9d1('0x6e')](_0x5912af[_0xa9d1('0x46')][_0xa9d1('0x6f')]);}})[_0xa9d1('0x20')](respondWithStatusCode(_0x1d0335,null))['catch'](handleError(_0x1d0335,null));};exports[_0xa9d1('0x70')]=function(_0x562d8e,_0x5dc60e,_0x3b70f3){if(_0x562d8e['body']['id']){delete _0x562d8e['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x562d8e[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x5dc60e,null))[_0xa9d1('0x20')](function(_0x339c9b){if(_0x339c9b){_0x562d8e['body'][_0xa9d1('0x69')]=_0x339c9b['id'];return db['CannedAnswer']['create'](_0x562d8e['body']);}})['then'](respondWithResult(_0x5dc60e,null))[_0xa9d1('0x2a')](handleError(_0x5dc60e,null));};exports['getAnswers']=function(_0x255aab,_0x4cf6af,_0x2e714d){var _0x3cd63e={'raw':![],'where':{}};var _0x38b973={};var _0x19ff8d={'count':0x0,'rows':[]};return db[_0xa9d1('0x59')][_0xa9d1('0x6c')]({'where':{'id':_0x255aab[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x4cf6af,null))['then'](function(_0x5ac087){if(_0x5ac087){_0x38b973[_0xa9d1('0x48')]=_['keys'](db[_0xa9d1('0x71')][_0xa9d1('0x41')]);_0x38b973[_0xa9d1('0x46')]=_['keys'](_0x255aab[_0xa9d1('0x46')]);_0x38b973[_0xa9d1('0x50')]=_['intersection'](_0x38b973[_0xa9d1('0x48')],_0x38b973[_0xa9d1('0x46')]);_0x3cd63e[_0xa9d1('0x49')]=_[_0xa9d1('0x47')](_0x38b973[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x4a')]));_0x3cd63e[_0xa9d1('0x49')]=_0x3cd63e[_0xa9d1('0x49')][_0xa9d1('0x4b')]?_0x3cd63e['attributes']:_0x38b973['model'];if(!_0x255aab['query']['hasOwnProperty'](_0xa9d1('0x4d'))){_0x3cd63e['limit']=qs[_0xa9d1('0x30')](_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x3cd63e['offset']=qs['offset'](_0x255aab[_0xa9d1('0x46')]['offset']);}_0x3cd63e['order']=qs[_0xa9d1('0x4f')](_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x4f')]);_0x3cd63e['where']=qs[_0xa9d1('0x50')](_[_0xa9d1('0x51')](_0x255aab['query'],_0x38b973[_0xa9d1('0x50')]));_0x3cd63e[_0xa9d1('0x53')][_0xa9d1('0x69')]=_0x5ac087['id'];if(_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x52')]){_0x3cd63e[_0xa9d1('0x53')]=_['merge'](_0x3cd63e[_0xa9d1('0x53')],{'$or':_[_0xa9d1('0x40')](_0x3cd63e[_0xa9d1('0x49')],function(_0x1ab1ce){var _0x14eda0={};_0x14eda0[_0x1ab1ce]={'$like':'%'+_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x14eda0;})});}_0x3cd63e=_['merge']({},_0x3cd63e,_0x255aab['options']);return db['CannedAnswer']['count']({'where':_0x3cd63e['where']})[_0xa9d1('0x20')](function(_0x34681a){_0x19ff8d['count']=_0x34681a;if(_0x255aab[_0xa9d1('0x46')][_0xa9d1('0x57')]){_0x3cd63e[_0xa9d1('0x58')]=[{'all':!![]}];}return db[_0xa9d1('0x71')][_0xa9d1('0x5a')](_0x3cd63e);})[_0xa9d1('0x20')](function(_0x18448c){_0x19ff8d[_0xa9d1('0x5b')]=_0x18448c;return _0x19ff8d;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x4cf6af,_0x3cd63e))['catch'](handleError(_0x4cf6af,null));};exports['removeAnswers']=function(_0x3136a1,_0x3a1943,_0x414fd5){return db[_0xa9d1('0x59')]['find']({'where':{'id':_0x3136a1[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x3a1943,null))[_0xa9d1('0x20')](function(_0x2c88f0){if(_0x2c88f0){return _0x2c88f0[_0xa9d1('0x72')](_0x3136a1[_0xa9d1('0x46')][_0xa9d1('0x6f')]);}})[_0xa9d1('0x20')](respondWithStatusCode(_0x3a1943,null))[_0xa9d1('0x2a')](handleError(_0x3a1943,null));};exports[_0xa9d1('0x73')]=function(_0x1db0f5,_0x4dadd7,_0xf88832){return db['FaxInteraction']['find']({'where':{'id':_0x1db0f5[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x4dadd7,null))[_0xa9d1('0x20')](function(_0x4092ac){if(_0x4092ac){return _0x4092ac[_0xa9d1('0x73')](_0x1db0f5[_0xa9d1('0x65')][_0xa9d1('0x6f')],_[_0xa9d1('0x74')](_0x1db0f5[_0xa9d1('0x65')],[_0xa9d1('0x6f'),'id'])||{});}})[_0xa9d1('0x20')](respondWithResult(_0x4dadd7,null))[_0xa9d1('0x2a')](handleError(_0x4dadd7,null));};exports[_0xa9d1('0x75')]=function(_0xfb4c67,_0x1ac05c,_0x34dae2){var _0x1e95ce={'raw':![],'where':{}};var _0x2333d9={};var _0x21a131={'count':0x0,'rows':[]};return db[_0xa9d1('0x59')][_0xa9d1('0x6c')]({'where':{'id':_0xfb4c67[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x1ac05c,null))['then'](function(_0x551c91){if(_0x551c91){_0x2333d9[_0xa9d1('0x48')]=_[_0xa9d1('0x6d')](db[_0xa9d1('0x76')][_0xa9d1('0x41')]);_0x2333d9['query']=_[_0xa9d1('0x6d')](_0xfb4c67[_0xa9d1('0x46')]);_0x2333d9[_0xa9d1('0x50')]=_['intersection'](_0x2333d9[_0xa9d1('0x48')],_0x2333d9[_0xa9d1('0x46')]);_0x1e95ce[_0xa9d1('0x49')]=_['intersection'](_0x2333d9[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0xfb4c67['query']['fields']));_0x1e95ce['attributes']=_0x1e95ce[_0xa9d1('0x49')][_0xa9d1('0x4b')]?_0x1e95ce['attributes']:_0x2333d9[_0xa9d1('0x48')];if(!_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x4c')]('nolimit')){_0x1e95ce[_0xa9d1('0x30')]=qs['limit'](_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x1e95ce['offset']=qs['offset'](_0xfb4c67['query'][_0xa9d1('0x2f')]);}_0x1e95ce[_0xa9d1('0x4e')]=qs[_0xa9d1('0x4f')](_0xfb4c67['query'][_0xa9d1('0x4f')]);_0x1e95ce[_0xa9d1('0x53')]=qs['filters'](_['pick'](_0xfb4c67['query'],_0x2333d9[_0xa9d1('0x50')]));_0x1e95ce[_0xa9d1('0x53')][_0xa9d1('0x69')]=_0x551c91['id'];if(_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x52')]){_0x1e95ce[_0xa9d1('0x53')]=_['merge'](_0x1e95ce[_0xa9d1('0x53')],{'$or':_[_0xa9d1('0x40')](_0x1e95ce[_0xa9d1('0x49')],function(_0x53d536){var _0x15fa72={};_0x15fa72[_0x53d536]={'$like':'%'+_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x15fa72;})});}_0x1e95ce=_[_0xa9d1('0x54')]({},_0x1e95ce,_0xfb4c67[_0xa9d1('0x56')]);return db[_0xa9d1('0x76')][_0xa9d1('0x32')]({'where':_0x1e95ce[_0xa9d1('0x53')]})[_0xa9d1('0x20')](function(_0x33d8e1){_0x21a131[_0xa9d1('0x32')]=_0x33d8e1;if(_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x57')]){_0x1e95ce['include']=[{'model':db[_0xa9d1('0x77')],'as':_0xa9d1('0x78'),'required':![]},{'model':db[_0xa9d1('0x79')],'as':'Owner','attributes':['name',_0xa9d1('0x7a'),_0xa9d1('0x7b')],'required':![]},{'model':db[_0xa9d1('0x7c')],'as':'Tags','attributes':['id',_0xa9d1('0x45'),_0xa9d1('0x7d')],'where':_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x7e')]?{'id':_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x7e')]}:undefined,'required':_0xfb4c67[_0xa9d1('0x46')][_0xa9d1('0x7e')]?!![]:![]}];}return db['FaxInteraction'][_0xa9d1('0x5a')](_0x1e95ce);})['then'](function(_0x194371){_0x21a131[_0xa9d1('0x5b')]=_0x194371;return _0x21a131;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x1ac05c,_0x1e95ce))['catch'](handleError(_0x1ac05c,null));};exports[_0xa9d1('0x7f')]=function(_0x25755e,_0x36c242){var _0x1d84fe=_0x25755e[_0xa9d1('0x5d')]['id'];var _0xd52412=_0x25755e[_0xa9d1('0x65')];var _0x146ed6=0xc8;var _0x8e98d7=null;return db['sequelize'][_0xa9d1('0x80')]({'isolationLevel':db[_0xa9d1('0x81')][_0xa9d1('0x82')][_0xa9d1('0x83')][_0xa9d1('0x84')]},function(_0x139b16){return db[_0xa9d1('0x59')]['findOne']({'where':{'id':_0x1d84fe},'transaction':_0x139b16})[_0xa9d1('0x20')](function(_0x33b4c3){if(_0x33b4c3){return db[_0xa9d1('0x85')][_0xa9d1('0x39')]({'where':{'FaxAccountId':_0x1d84fe},'transaction':_0x139b16})[_0xa9d1('0x20')](function(){var _0x36aa88=_[_0xa9d1('0x40')](_0xd52412,function(_0x1341e9){_0x1341e9['FaxAccountId']=_0x1d84fe;return _0x1341e9;});return db[_0xa9d1('0x85')][_0xa9d1('0x86')](_0x36aa88,{'transaction':_0x139b16});});}else{_0x146ed6=0x194;_0x8e98d7=[];}});})[_0xa9d1('0x20')](function(){if(_0x146ed6!==0x194){return db[_0xa9d1('0x85')][_0xa9d1('0x87')]({'where':{'FaxAccountId':_0x1d84fe},'order':_0xa9d1('0x88')})[_0xa9d1('0x20')](function(_0x213599){_0x8e98d7=_0x213599;});}})[_0xa9d1('0x2a')](function(_0x4df33c){_0x146ed6=0x1f4;logger[_0xa9d1('0x26')](_0x4df33c['stack']);if(_0x4df33c[_0xa9d1('0x45')]){delete _0x4df33c[_0xa9d1('0x45')];}_0x8e98d7=_0x4df33c;})[_0xa9d1('0x89')](function(){if(_0x8e98d7===null){_0x36c242['sendStatus'](_0x146ed6);}else{if(_0x146ed6===0x1f4){_0x36c242['status'](_0x146ed6)[_0xa9d1('0x8a')](_0x8e98d7);}else{_0x36c242[_0xa9d1('0x2c')](_0x146ed6)[_0xa9d1('0x2e')](_0x8e98d7);}}});};exports[_0xa9d1('0x8b')]=function(_0x4c8738,_0x505414,_0x4c0336){var _0x44e18b={};var _0x4a0608={};var _0x55c73d;var _0x424480;return db[_0xa9d1('0x59')]['findOne']({'where':{'id':_0x4c8738[_0xa9d1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x505414,null))[_0xa9d1('0x20')](function(_0x3fb2c6){if(_0x3fb2c6){_0x55c73d=_0x3fb2c6;_0x4a0608[_0xa9d1('0x48')]=_[_0xa9d1('0x6d')](db[_0xa9d1('0x85')][_0xa9d1('0x41')]);_0x4a0608[_0xa9d1('0x46')]=_['keys'](_0x4c8738[_0xa9d1('0x46')]);_0x4a0608[_0xa9d1('0x50')]=_[_0xa9d1('0x47')](_0x4a0608[_0xa9d1('0x48')],_0x4a0608[_0xa9d1('0x46')]);_0x44e18b[_0xa9d1('0x49')]=_[_0xa9d1('0x47')](_0x4a0608[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x4a')]));_0x44e18b[_0xa9d1('0x49')]=_0x44e18b['attributes'][_0xa9d1('0x4b')]?_0x44e18b[_0xa9d1('0x49')]:_0x4a0608[_0xa9d1('0x48')];_0x44e18b[_0xa9d1('0x4e')]=qs['sort'](_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x4f')]);_0x44e18b['where']=qs['filters'](_['pick'](_0x4c8738[_0xa9d1('0x46')],_0x4a0608[_0xa9d1('0x50')]));if(_0x4c8738['query']['filter']){_0x44e18b[_0xa9d1('0x53')]=_[_0xa9d1('0x54')](_0x44e18b['where'],{'$or':_[_0xa9d1('0x40')](_0x44e18b[_0xa9d1('0x49')],function(_0x324aa7){var _0x59c99a={};_0x59c99a[_0x324aa7]={'$like':'%'+_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x59c99a;})});}_0x44e18b=_['merge']({},_0x44e18b,_0x4c8738[_0xa9d1('0x56')]);return _0x55c73d[_0xa9d1('0x8b')](_0x44e18b);}})[_0xa9d1('0x20')](function(_0x5a649c){if(_0x5a649c){_0x424480=_0x5a649c['length'];if(!_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x4c')](_0xa9d1('0x4d'))){_0x44e18b[_0xa9d1('0x30')]=qs['limit'](_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x44e18b['offset']=qs['offset'](_0x4c8738[_0xa9d1('0x46')][_0xa9d1('0x2f')]);}return _0x55c73d['getApplications'](_0x44e18b);}})[_0xa9d1('0x20')](function(_0x47c4e1){if(_0x47c4e1){return _0x47c4e1?{'count':_0x424480,'rows':_0x47c4e1}:null;}})[_0xa9d1('0x20')](respondWithResult(_0x505414,null))[_0xa9d1('0x2a')](handleError(_0x505414,null));};function Extension(_0x400cb9,_0x1d9a63,_0x28119b,_0x2fd9d9){this[_0xa9d1('0x8c')]='from-voip-provider';this[_0xa9d1('0x8d')]=_0x400cb9[_0xa9d1('0x8e')];this[_0xa9d1('0x8f')]=_0x2fd9d9;this['type']='system';this['description']=_0xa9d1('0x90');this[_0xa9d1('0x69')]=_0x400cb9['id'];this[_0xa9d1('0x88')]=_0x1d9a63;this[_0xa9d1('0x91')]=_0x28119b;}function createExtensionsReciveFax(_0x3f6335){var _0xd6d5aa=0x1;var _0x2b74fa=[];_0x2b74fa[_0xa9d1('0x92')](new Extension(_0x3f6335,_0xd6d5aa,'',_0xa9d1('0x93')));_0xd6d5aa+=0x1;_0x2b74fa[_0xa9d1('0x92')](new Extension(_0x3f6335,_0xd6d5aa,_0xa9d1('0x94'),_0xa9d1('0x95')));_0xd6d5aa+=0x1;for(var _0x57cdcf in _0x3f6335){if(_0x3f6335['hasOwnProperty'](_0x57cdcf)&&(_0x57cdcf===_0xa9d1('0x96')||_0x57cdcf==='localstationid'||_0x57cdcf===_0xa9d1('0x97')||_0x57cdcf===_0xa9d1('0x98')||_0x57cdcf==='headerinfo'||_0x57cdcf==='maxrate'||_0x57cdcf===_0xa9d1('0x99')||_0x57cdcf===_0xa9d1('0x9a')||_0x57cdcf===_0xa9d1('0x9b'))){_0x2b74fa[_0xa9d1('0x92')](new Extension(_0x3f6335,_0xd6d5aa,_0xa9d1('0x9c')+_0x57cdcf+')='+_0x3f6335[_0x57cdcf],_0xa9d1('0x95')));_0xd6d5aa+=0x1;}}_0x2b74fa[_0xa9d1('0x92')](new Extension(_0x3f6335,_0xd6d5aa,'6','Wait'));_0xd6d5aa+=0x1;_0x2b74fa[_0xa9d1('0x92')](new Extension(_0x3f6335,_0xd6d5aa,_0xa9d1('0x9d'),'ReceiveFax'));_0xd6d5aa=0x0;return _0x2b74fa;}exports['addAccountApplications']=function(_0x109623,_0xb6efc8,_0x2e4f73){var _0x35bcc8;return db['sequelize'][_0xa9d1('0x80')](function(_0x49794e){return db[_0xa9d1('0x59')][_0xa9d1('0x5e')](_0x109623['body'],{'transaction':_0x49794e})[_0xa9d1('0x20')](function(_0x2fa5b5){_0x35bcc8=_0x2fa5b5['get']({'plain':!![]});return db[_0xa9d1('0x9e')][_0xa9d1('0x86')](createExtensionsReciveFax(_0x35bcc8),{'transaction':_0x49794e});});})[_0xa9d1('0x20')](function(){return _0x35bcc8;})['then'](respondWithResult(_0xb6efc8,null))['catch'](handleError(_0xb6efc8,null));};exports[_0xa9d1('0x9f')]=function(_0x41046e,_0x5a75e4,_0x520fff){var _0x3e72ce;return db['sequelize'][_0xa9d1('0x80')](function(_0x4f2b5c){return db['FaxAccount'][_0xa9d1('0x38')](_0x41046e[_0xa9d1('0x65')],{'where':{'id':_0x41046e[_0xa9d1('0x65')]['id']},'transaction':_0x4f2b5c})['then'](function(_0x6dfe07){return db[_0xa9d1('0x9e')][_0xa9d1('0x39')]({'where':{'FaxAccountId':_0x41046e[_0xa9d1('0x65')]['id']},'transaction':_0x4f2b5c})['then'](function(_0x1ce9cc){return db[_0xa9d1('0x9e')][_0xa9d1('0x86')](createExtensionsReciveFax(_[_0xa9d1('0x74')](_0x41046e[_0xa9d1('0x65')],[_0xa9d1('0xa0'),_0xa9d1('0x44'),'createdAt',_0xa9d1('0xa1'),_0xa9d1('0xa2'),_0xa9d1('0xa3')])),{'transaction':_0x4f2b5c});});});})[_0xa9d1('0x20')](function(){return db[_0xa9d1('0x59')][_0xa9d1('0xa4')](_0x41046e[_0xa9d1('0x65')]['id']);})[_0xa9d1('0x20')](respondWithResult(_0x5a75e4,null))[_0xa9d1('0x2a')](handleError(_0x5a75e4,null));};exports[_0xa9d1('0xa5')]=function(_0x4f46c2,_0x2d7594,_0x76500){var _0x5e642e={'raw':!![],'where':{}};var _0x4b884e={};var _0x48911f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9d1('0x6c')]({'where':{'id':_0x4f46c2['params']['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x2d7594,null))[_0xa9d1('0x20')](function(_0xa210d0){if(_0xa210d0){_0x4b884e[_0xa9d1('0x48')]=_[_0xa9d1('0x6d')](db[_0xa9d1('0xa6')][_0xa9d1('0x41')]);_0x4b884e['query']=_['keys'](_0x4f46c2[_0xa9d1('0x46')]);_0x4b884e['filters']=_[_0xa9d1('0x47')](_0x4b884e[_0xa9d1('0x48')],_0x4b884e[_0xa9d1('0x46')]);_0x5e642e[_0xa9d1('0x49')]=_['intersection'](_0x4b884e[_0xa9d1('0x48')],qs[_0xa9d1('0x4a')](_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x4a')]));_0x5e642e[_0xa9d1('0x49')]=_0x5e642e[_0xa9d1('0x49')]['length']?_0x5e642e[_0xa9d1('0x49')]:_0x4b884e[_0xa9d1('0x48')];if(!_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x4c')](_0xa9d1('0x4d'))){_0x5e642e[_0xa9d1('0x30')]=qs['limit'](_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x5e642e[_0xa9d1('0x2f')]=qs[_0xa9d1('0x2f')](_0x4f46c2[_0xa9d1('0x46')]['offset']);}_0x5e642e[_0xa9d1('0x4e')]=qs[_0xa9d1('0x4f')](_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x4f')]);_0x5e642e[_0xa9d1('0x53')]=qs[_0xa9d1('0x50')](_[_0xa9d1('0x51')](_0x4f46c2['query'],_0x4b884e[_0xa9d1('0x50')]));_0x5e642e[_0xa9d1('0x53')][_0xa9d1('0x69')]=_0xa210d0['id'];if(_0x4f46c2['query']['filter']){_0x5e642e[_0xa9d1('0x53')]=_[_0xa9d1('0x54')](_0x5e642e['where'],{'$or':_[_0xa9d1('0x40')](_0x5e642e[_0xa9d1('0x49')],function(_0x4b3c65){var _0x2af54e={};_0x2af54e[_0x4b3c65]={'$like':'%'+_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x2af54e;})});}if(_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0xa7')]){var _0x2177d1=_0x4f46c2['query'][_0xa9d1('0xa7')]['split'](',');var _0x28efa8={};_0x28efa8[_0x2177d1[0x0]]={'$gte':moment(_0x2177d1[0x1])['format'](_0xa9d1('0xa8'))};_0x5e642e[_0xa9d1('0x53')]=_[_0xa9d1('0x54')](_0x5e642e[_0xa9d1('0x53')],_0x28efa8);}_0x5e642e=_['merge']({},_0x5e642e,_0x4f46c2[_0xa9d1('0x56')]);return db['FaxMessage'][_0xa9d1('0x32')]({'where':_0x5e642e['where']})[_0xa9d1('0x20')](function(_0x2439b0){_0x48911f[_0xa9d1('0x32')]=_0x2439b0;if(_0x4f46c2[_0xa9d1('0x46')][_0xa9d1('0x57')]){_0x5e642e['include']=[{'all':!![]}];}return db[_0xa9d1('0xa6')][_0xa9d1('0x5a')](_0x5e642e);})['then'](function(_0x380656){_0x48911f[_0xa9d1('0x5b')]=_0x380656;return _0x48911f;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x2d7594,_0x5e642e))[_0xa9d1('0x2a')](handleError(_0x2d7594,null));};exports[_0xa9d1('0x8a')]=function(_0x9a359c,_0x499f67,_0x97035){var _0x3db9fb,_0x195e35={},_0x110917;if(_0x9a359c['body']['to']){_0x110917=_0x9a359c[_0xa9d1('0x65')]['to'][0x0];}return db[_0xa9d1('0x59')][_0xa9d1('0x66')]({'where':{'id':_0x9a359c[_0xa9d1('0x5d')]['id']},'include':[{'model':db[_0xa9d1('0xa9')],'as':'List','include':[{'model':db[_0xa9d1('0x77')],'as':'Contacts','where':{'fax':_0x110917},'limit':0x1,'order':[[_0xa9d1('0xa1'),_0xa9d1('0xaa')]]}]}]})[_0xa9d1('0x20')](handleEntityNotFound(_0x499f67,null))[_0xa9d1('0x20')](function(_0x5e782f){_0x3db9fb=_0x5e782f;if(_0x9a359c['body'][_0xa9d1('0xab')]&&_0x9a359c[_0xa9d1('0x65')]['attachments']['length']){for(var _0x479138=0x0;_0x479138<_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][_0xa9d1('0x4b')];_0x479138+=0x1){_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][_0x479138]={'filename':_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][_0x479138][_0xa9d1('0x45')],'id':_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][_0x479138]['id'],'path':path[_0xa9d1('0xac')](config[_0xa9d1('0xad')],_0xa9d1('0xae'),_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][_0x479138][_0xa9d1('0xaf')])};}}return respondWithRpcPromise(_0xa9d1('0xb0'),_0xa9d1('0xb0'),{'FaxAccountId':_[_0xa9d1('0xb1')](_0x9a359c[_0xa9d1('0x5d')]['id'])?undefined:_0x9a359c['params']['id'],'path':_[_0xa9d1('0xb1')](_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][0x0]['path'])?undefined:_0x9a359c[_0xa9d1('0x65')]['attachments'][0x0]['path'],'fax':_[_0xa9d1('0xb1')](_0x9a359c[_0xa9d1('0x65')]['to'][0x0])?undefined:_0x9a359c[_0xa9d1('0x65')]['to'][0x0]},client9002);})['then'](function(){if(_0x3db9fb){if(_[_0xa9d1('0xb1')](_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xb2')])){_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xb2')]=util['format'](_0xa9d1('0xb3'),_0x3db9fb[_0xa9d1('0x45')],_0x3db9fb['fax']);}if(_0x3db9fb[_0xa9d1('0xb4')]){if(_0x3db9fb[_0xa9d1('0xb4')][_0xa9d1('0xb5')][_0xa9d1('0x4b')]){return _0x3db9fb[_0xa9d1('0xb4')][_0xa9d1('0xb5')][0x0];}else{return db[_0xa9d1('0x77')][_0xa9d1('0x5e')](_[_0xa9d1('0x18')](_0x9a359c[_0xa9d1('0x65')],{'firstName':_0x9a359c[_0xa9d1('0x65')]['to'][0x0],'phone':_0x9a359c[_0xa9d1('0x65')]['to'][0x0],'fax':_0x9a359c[_0xa9d1('0x65')]['to'][0x0],'ListId':_0x3db9fb[_0xa9d1('0xa3')]}));}}else{throw new Error(_0xa9d1('0xb6'));}}else{throw new Error(_0xa9d1('0xb7'));}})['then'](function(_0x4e2ec5){if(_0x4e2ec5){return db[_0xa9d1('0x76')][_0xa9d1('0x66')]({'where':{'ContactId':_0x4e2ec5['id'],'closed':![],'FaxAccountId':_0x3db9fb['id']}})[_0xa9d1('0x20')](function(_0x39ab0f){if(_0x39ab0f){return[_0x39ab0f,![]];}return db[_0xa9d1('0x76')][_0xa9d1('0x5e')]({'UserId':_0x9a359c[_0xa9d1('0x5f')]['id'],'ContactId':_0x4e2ec5['id'],'FaxAccountId':_0x3db9fb['id'],'fax':_0x9a359c['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa9d1('0x54')](_0x9a359c[_0xa9d1('0x65')],{'read':![],'body':_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][0x0][_0xa9d1('0xb8')],'FaxAccountId':_0x3db9fb['id'],'UserId':_0x9a359c[_0xa9d1('0x5f')]['id'],'ContactId':_0x4e2ec5['id'],'AttachmentId':_0x9a359c['body'][_0xa9d1('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xa9d1('0xb9')}]})[_0xa9d1('0x20')](function(_0x36431d){return[_0x36431d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x1b5f9c,_0x3dd81f){if(_0x3dd81f){return _0x1b5f9c;}return db[_0xa9d1('0xa6')]['create']({'direction':_0xa9d1('0xba'),'read':![],'body':_0x9a359c[_0xa9d1('0x65')]['attachments'][0x0]['filename'],'FaxAccountId':_0x3db9fb['id'],'FaxInteractionId':_0x1b5f9c['id'],'UserId':_0x9a359c[_0xa9d1('0x5f')]['id'],'ContactId':_0x1b5f9c[_0xa9d1('0xbb')],'AttachmentId':_0x9a359c[_0xa9d1('0x65')]['attachments'][0x0]['id']})[_0xa9d1('0x20')](function(_0x4ff96c){_0x1b5f9c[_0xa9d1('0xbc')]['Messages']=[];_0x1b5f9c['dataValues']['Messages'][_0xa9d1('0x92')](_0x4ff96c[_0xa9d1('0xbc')]);return _0x1b5f9c;});})[_0xa9d1('0x20')](function(_0x48b19f){respondWithRpcPromise(_0xa9d1('0xbd'),_0xa9d1('0xbd'),{'FaxAccountId':_['isNil'](_0x9a359c[_0xa9d1('0x5d')]['id'])?undefined:_0x9a359c[_0xa9d1('0x5d')]['id'],'path':_[_0xa9d1('0xb1')](_0x9a359c['body']['attachments'][0x0]['path'])?undefined:_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][0x0][_0xa9d1('0x4')],'fax':_['isNil'](_0x9a359c['body']['to'][0x0])?undefined:_0x9a359c['body']['to'][0x0],'AttachmentId':_0x9a359c[_0xa9d1('0x65')][_0xa9d1('0xab')][0x0]['id']},client9002)[_0xa9d1('0x20')](function(_0x453563){logger['info']('SendFaxRpc,\x20%s',_0x453563);})[_0xa9d1('0x2a')](function(_0x16f131){logger[_0xa9d1('0x21')]('SendFaxRpc,\x20%s',_0x16f131);});return _0x48b19f;})['then'](respondWithResult(_0x499f67,null))[_0xa9d1('0x2a')](handleError(_0x499f67,null));};exports[_0xa9d1('0xbe')]=function(_0x4374db,_0x48895f,_0x1be907){return db[_0xa9d1('0x59')][_0xa9d1('0x66')]({'where':{'id':_0x4374db[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x48895f,null))['then'](function(_0xd488e8){if(_0xd488e8){return _0xd488e8['addAgents'](_0x4374db[_0xa9d1('0x65')][_0xa9d1('0x6f')],_[_0xa9d1('0x74')](_0x4374db[_0xa9d1('0x65')],[_0xa9d1('0x6f'),'id'])||{})[_0xa9d1('0xbf')](function(_0x58bd27){for(var _0x39c8a7=0x0;_0x39c8a7<_0x4374db[_0xa9d1('0x65')][_0xa9d1('0x6f')][_0xa9d1('0x4b')];_0x39c8a7+=0x1){socket[_0xa9d1('0xc0')](_0xa9d1('0xc1'),{'UserId':Number(_0x4374db[_0xa9d1('0x65')][_0xa9d1('0x6f')][_0x39c8a7]),'FaxAccountId':Number(_0x4374db[_0xa9d1('0x5d')]['id'])});}return _0x58bd27;});}})['then'](respondWithResult(_0x48895f,null))['catch'](handleError(_0x48895f,null));};exports[_0xa9d1('0xc2')]=function(_0x421df8,_0xbde608,_0x1c586b){return db[_0xa9d1('0x59')][_0xa9d1('0x66')]({'where':{'id':_0x421df8[_0xa9d1('0x5d')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0xbde608,null))[_0xa9d1('0x20')](function(_0x35e1ae){if(_0x35e1ae){return _0x35e1ae['removeAgents'](_0x421df8[_0xa9d1('0x46')][_0xa9d1('0x6f')])[_0xa9d1('0x20')](function(){if(_[_0xa9d1('0xc3')](_0x421df8[_0xa9d1('0x46')]['ids'])){for(var _0x42b21d=0x0;_0x42b21d<_0x421df8[_0xa9d1('0x46')][_0xa9d1('0x6f')][_0xa9d1('0x4b')];_0x42b21d+=0x1){socket[_0xa9d1('0xc0')](_0xa9d1('0xc4'),{'UserId':Number(_0x421df8[_0xa9d1('0x46')][_0xa9d1('0x6f')][_0x42b21d]),'FaxAccountId':Number(_0x421df8[_0xa9d1('0x5d')]['id'])});}}else{socket[_0xa9d1('0xc0')](_0xa9d1('0xc4'),{'UserId':Number(_0x421df8[_0xa9d1('0x46')][_0xa9d1('0x6f')]),'FaxAccountId':Number(_0x421df8['params']['id'])});}});}})[_0xa9d1('0x20')](respondWithStatusCode(_0xbde608,null))[_0xa9d1('0x2a')](handleError(_0xbde608,null));};exports[_0xa9d1('0xc5')]=function(_0xcaff75,_0x32dfc0,_0x392253){var _0x423502={};var _0x33d414={};var _0x28ed56;var _0x938419;return db[_0xa9d1('0x59')][_0xa9d1('0x6c')]({'where':{'id':_0xcaff75[_0xa9d1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x32dfc0,null))[_0xa9d1('0x20')](function(_0x31fc48){if(_0x31fc48){_0x28ed56=_0x31fc48;_0x33d414[_0xa9d1('0x48')]=_[_0xa9d1('0x6d')](db[_0xa9d1('0x79')][_0xa9d1('0x41')]);_0x33d414[_0xa9d1('0x46')]=_[_0xa9d1('0x6d')](_0xcaff75[_0xa9d1('0x46')]);_0x33d414['filters']=_[_0xa9d1('0x47')](_0x33d414['model'],_0x33d414[_0xa9d1('0x46')]);_0x423502['attributes']=_[_0xa9d1('0x47')](_0x33d414['model'],qs['fields'](_0xcaff75[_0xa9d1('0x46')]['fields']));_0x423502[_0xa9d1('0x49')]=_0x423502[_0xa9d1('0x49')]['length']?_0x423502[_0xa9d1('0x49')]:_0x33d414['model'];_0x423502[_0xa9d1('0x4e')]=qs[_0xa9d1('0x4f')](_0xcaff75[_0xa9d1('0x46')][_0xa9d1('0x4f')]);_0x423502[_0xa9d1('0x53')]=qs[_0xa9d1('0x50')](_['pick'](_0xcaff75[_0xa9d1('0x46')],_0x33d414['filters']));if(_0xcaff75[_0xa9d1('0x46')][_0xa9d1('0x52')]){_0x423502[_0xa9d1('0x53')]=_[_0xa9d1('0x54')](_0x423502['where'],{'$or':_[_0xa9d1('0x40')](_0x423502[_0xa9d1('0x49')],function(_0x531421){var _0x2eb824={};_0x2eb824[_0x531421]={'$like':'%'+_0xcaff75[_0xa9d1('0x46')][_0xa9d1('0x52')]+'%'};return _0x2eb824;})});}_0x423502=_['merge']({},_0x423502,_0xcaff75[_0xa9d1('0x56')]);return _0x28ed56[_0xa9d1('0xc5')](_0x423502);}})[_0xa9d1('0x20')](function(_0x28efa6){if(_0x28efa6){_0x938419=_0x28efa6['length'];if(!_0xcaff75['query'][_0xa9d1('0x4c')](_0xa9d1('0x4d'))){_0x423502[_0xa9d1('0x30')]=qs['limit'](_0xcaff75[_0xa9d1('0x46')][_0xa9d1('0x30')]);_0x423502[_0xa9d1('0x2f')]=qs[_0xa9d1('0x2f')](_0xcaff75[_0xa9d1('0x46')]['offset']);}return _0x28ed56[_0xa9d1('0xc5')](_0x423502);}})[_0xa9d1('0x20')](function(_0x582d18){if(_0x582d18){return _0x582d18?{'count':_0x938419,'rows':_0x582d18}:null;}})[_0xa9d1('0x20')](respondWithResult(_0x32dfc0,null))[_0xa9d1('0x2a')](handleError(_0x32dfc0,null));}; \ No newline at end of file +var _0xd16c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','FaxAccount','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1a5574,_0x1fbd39){var _0x553ed9=function(_0x51bbab){while(--_0x51bbab){_0x1a5574['push'](_0x1a5574['shift']());}};_0x553ed9(++_0x1fbd39);}(_0xd16c,0xbf));var _0xcd16=function(_0x10e3ad,_0x27b815){_0x10e3ad=_0x10e3ad-0x0;var _0x3a7d6c=_0xd16c[_0x10e3ad];return _0x3a7d6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd16('0x0'));var zipdir=require(_0xcd16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd16('0x2'));var moment=require('moment');var BPromise=require(_0xcd16('0x3'));var Mustache=require(_0xcd16('0x4'));var util=require(_0xcd16('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcd16('0x6'));var ejs=require(_0xcd16('0x7'));var fs=require('fs');var fs_extra=require(_0xcd16('0x8'));var _=require(_0xcd16('0x9'));var squel=require(_0xcd16('0xa'));var crypto=require(_0xcd16('0xb'));var jsforce=require(_0xcd16('0xc'));var deskjs=require(_0xcd16('0xd'));var toCsv=require(_0xcd16('0x6'));var querystring=require(_0xcd16('0xe'));var Papa=require(_0xcd16('0xf'));var Redis=require(_0xcd16('0x10'));var authService=require(_0xcd16('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd16('0x12'));var logger=require(_0xcd16('0x13'))('api');var utils=require(_0xcd16('0x14'));var config=require(_0xcd16('0x15'));var licenseUtil=require(_0xcd16('0x16'));var db=require(_0xcd16('0x17'))['db'];config[_0xcd16('0x18')]=_['defaults'](config['redis'],{'host':_0xcd16('0x19'),'port':0x18eb});var socket=require(_0xcd16('0x1a'))(new Redis(config[_0xcd16('0x18')]));require(_0xcd16('0x1b'))[_0xcd16('0x1c')](socket);var jayson=require(_0xcd16('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xcd16('0x1e')][_0xcd16('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x32fb53,_0x29428a,_0x50dc79,_0x3f99a0){return new BPromise(function(_0x2a47c9,_0x17712c){var _0x9f1316=_0x3f99a0||client;return _0x9f1316[_0xcd16('0x20')](_0x32fb53,_0x50dc79)[_0xcd16('0x21')](function(_0x530d16){logger[_0xcd16('0x22')](_0xcd16('0x23'),_0x29428a,_0xcd16('0x24'));logger[_0xcd16('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x29428a,_0xcd16('0x24'),JSON[_0xcd16('0x26')](_0x530d16));if(_0x530d16['error']){if(_0x530d16[_0xcd16('0x27')][_0xcd16('0x28')]===0x1f4){logger[_0xcd16('0x27')]('FaxAccount,\x20%s,\x20%s',_0x29428a,_0x530d16[_0xcd16('0x27')][_0xcd16('0x29')]);return _0x17712c(_0x530d16[_0xcd16('0x27')][_0xcd16('0x29')]);}logger['error'](_0xcd16('0x23'),_0x29428a,_0x530d16[_0xcd16('0x27')]['message']);return _0x2a47c9(_0x530d16[_0xcd16('0x27')]['message']);}else{logger[_0xcd16('0x22')](_0xcd16('0x23'),_0x29428a,'request\x20sent');_0x2a47c9(_0x530d16['result'][_0xcd16('0x29')]);}})[_0xcd16('0x2a')](function(_0x24a13f){logger['error']('FaxAccount,\x20%s,\x20%s',_0x29428a,_0x24a13f);_0x17712c(_0x24a13f);});});}function respondWithStatusCode(_0x37d941,_0x2a383a){_0x2a383a=_0x2a383a||0xcc;return function(_0x5cbfea){if(_0x5cbfea){return _0x37d941['sendStatus'](_0x2a383a);}return _0x37d941['status'](_0x2a383a)[_0xcd16('0x2b')]();};}function respondWithResult(_0x3fea01,_0x3ea327){_0x3ea327=_0x3ea327||0xc8;return function(_0x2d8891){if(_0x2d8891){return _0x3fea01[_0xcd16('0x2c')](_0x3ea327)[_0xcd16('0x2d')](_0x2d8891);}};}function respondWithFilteredResult(_0x2d69e5,_0x5c2b79){return function(_0x2c92f4){if(_0x2c92f4){var _0x510cd3=typeof _0x5c2b79[_0xcd16('0x2e')]==='undefined'&&typeof _0x5c2b79[_0xcd16('0x2f')]===_0xcd16('0x30');var _0x17caac=_0x2c92f4[_0xcd16('0x31')];var _0x256e6e=_0x510cd3?0x0:_0x5c2b79[_0xcd16('0x2e')];var _0x299d1c=_0x510cd3?_0x2c92f4[_0xcd16('0x31')]:_0x5c2b79[_0xcd16('0x2e')]+_0x5c2b79[_0xcd16('0x2f')];var _0xe7316e;if(_0x299d1c>=_0x17caac){_0x299d1c=_0x17caac;_0xe7316e=0xc8;}else{_0xe7316e=0xce;}_0x2d69e5[_0xcd16('0x2c')](_0xe7316e);return _0x2d69e5[_0xcd16('0x32')](_0xcd16('0x33'),_0x256e6e+'-'+_0x299d1c+'/'+_0x17caac)[_0xcd16('0x2d')](_0x2c92f4);}return null;};}function patchUpdates(_0x505f0b){return function(_0x5bc40e){try{jsonpatch[_0xcd16('0x34')](_0x5bc40e,_0x505f0b,!![]);}catch(_0x4d7def){return BPromise[_0xcd16('0x35')](_0x4d7def);}return _0x5bc40e[_0xcd16('0x36')]();};}function saveUpdates(_0x9736e5,_0x28f49f){return function(_0x175e79){if(_0x175e79){return _0x175e79[_0xcd16('0x37')](_0x9736e5)[_0xcd16('0x21')](function(_0x4466ad){return _0x4466ad;});}return null;};}function removeEntity(_0x23d12e,_0x155de8){return function(_0x38e0af){if(_0x38e0af){return _0x38e0af[_0xcd16('0x38')]()[_0xcd16('0x21')](function(){var _0x227f8f=_0x38e0af['get']({'plain':!![]});var _0x27076f=_0xcd16('0x39');return db[_0xcd16('0x3a')][_0xcd16('0x38')]({'where':{'type':_0x27076f,'resourceId':_0x227f8f['id']}})[_0xcd16('0x21')](function(){return _0x38e0af;});})[_0xcd16('0x21')](function(){_0x23d12e[_0xcd16('0x2c')](0xcc)[_0xcd16('0x2b')]();});}};}function handleEntityNotFound(_0x21be7a,_0x21c538){return function(_0x564fef){if(!_0x564fef){_0x21be7a[_0xcd16('0x3b')](0x194);}return _0x564fef;};}function handleError(_0x58fbae,_0x5de372){_0x5de372=_0x5de372||0x1f4;return function(_0x1bcf95){logger[_0xcd16('0x27')](_0x1bcf95[_0xcd16('0x3c')]);if(_0x1bcf95[_0xcd16('0x3d')]){delete _0x1bcf95[_0xcd16('0x3d')];}_0x58fbae[_0xcd16('0x2c')](_0x5de372)[_0xcd16('0x3e')](_0x1bcf95);};}exports[_0xcd16('0x3f')]=function(_0x14f9ae,_0x4a937a){var _0x5dcaf5={'include':[{'model':db[_0xcd16('0x40')],'as':'mandatoryDispositionPause'}]},_0x94c6c9={},_0x37e675={'count':0x0,'rows':[]};var _0x2ac0df=_['map'](db['FaxAccount'][_0xcd16('0x41')],function(_0x38fd31){return{'name':_0x38fd31['fieldName'],'type':_0x38fd31[_0xcd16('0x42')][_0xcd16('0x43')]};});_0x94c6c9[_0xcd16('0x44')]=_[_0xcd16('0x45')](_0x2ac0df,_0xcd16('0x3d'));_0x94c6c9[_0xcd16('0x46')]=_[_0xcd16('0x47')](_0x14f9ae[_0xcd16('0x46')]);_0x94c6c9[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x94c6c9[_0xcd16('0x44')],_0x94c6c9[_0xcd16('0x46')]);_0x5dcaf5[_0xcd16('0x4a')]=_[_0xcd16('0x49')](_0x94c6c9['model'],qs[_0xcd16('0x4b')](_0x14f9ae[_0xcd16('0x46')]['fields']));_0x5dcaf5[_0xcd16('0x4a')]=_0x5dcaf5[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0x5dcaf5['attributes']:_0x94c6c9[_0xcd16('0x44')];if(!_0x14f9ae[_0xcd16('0x46')][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0x5dcaf5[_0xcd16('0x2f')]=qs[_0xcd16('0x2f')](_0x14f9ae[_0xcd16('0x46')][_0xcd16('0x2f')]);_0x5dcaf5['offset']=qs[_0xcd16('0x2e')](_0x14f9ae['query'][_0xcd16('0x2e')]);}_0x5dcaf5[_0xcd16('0x4f')]=qs['sort'](_0x14f9ae['query']['sort']);_0x5dcaf5[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_[_0xcd16('0x51')](_0x14f9ae['query'],_0x94c6c9[_0xcd16('0x48')]),_0x2ac0df);if(_0x14f9ae[_0xcd16('0x46')][_0xcd16('0x52')]){_0x5dcaf5['where']=_[_0xcd16('0x53')](_0x5dcaf5[_0xcd16('0x50')],{'$or':_['map'](_0x2ac0df,function(_0x475189){if(_0x475189[_0xcd16('0x42')]!=='VIRTUAL'){var _0x23de66={};_0x23de66[_0x475189[_0xcd16('0x3d')]]={'$like':'%'+_0x14f9ae[_0xcd16('0x46')][_0xcd16('0x52')]+'%'};return _0x23de66;}})});}_0x5dcaf5=_['merge']({},_0x5dcaf5,_0x14f9ae[_0xcd16('0x54')]);var _0x67a072={'where':_0x5dcaf5[_0xcd16('0x50')]};return db['FaxAccount'][_0xcd16('0x31')](_0x67a072)[_0xcd16('0x21')](function(_0x28f2e9){_0x37e675['count']=_0x28f2e9;if(_0x14f9ae['query'][_0xcd16('0x55')]){_0x5dcaf5[_0xcd16('0x56')]=[{'all':!![]}];}return db['FaxAccount'][_0xcd16('0x57')](_0x5dcaf5);})[_0xcd16('0x21')](function(_0x4a21eb){_0x37e675[_0xcd16('0x58')]=_0x4a21eb;return _0x37e675;})[_0xcd16('0x21')](respondWithFilteredResult(_0x4a937a,_0x5dcaf5))['catch'](handleError(_0x4a937a,null));};exports[_0xcd16('0x59')]=function(_0x31db42,_0xc3e964){var _0x4c870c={'raw':![],'where':{'id':_0x31db42[_0xcd16('0x5a')]['id']},'include':[{'model':db[_0xcd16('0x40')],'as':'mandatoryDispositionPause'}]},_0x2904db={};_0x2904db['model']=_['keys'](db[_0xcd16('0x5b')][_0xcd16('0x41')]);_0x2904db[_0xcd16('0x46')]=_[_0xcd16('0x47')](_0x31db42[_0xcd16('0x46')]);_0x2904db[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x2904db[_0xcd16('0x44')],_0x2904db[_0xcd16('0x46')]);_0x4c870c[_0xcd16('0x4a')]=_['intersection'](_0x2904db[_0xcd16('0x44')],qs['fields'](_0x31db42[_0xcd16('0x46')][_0xcd16('0x4b')]));_0x4c870c[_0xcd16('0x4a')]=_0x4c870c[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0x4c870c[_0xcd16('0x4a')]:_0x2904db['model'];if(_0x31db42[_0xcd16('0x46')][_0xcd16('0x55')]){_0x4c870c[_0xcd16('0x56')]=[{'all':!![]}];}_0x4c870c=_[_0xcd16('0x53')]({},_0x4c870c,_0x31db42[_0xcd16('0x54')]);return db['FaxAccount']['find'](_0x4c870c)[_0xcd16('0x21')](handleEntityNotFound(_0xc3e964,null))[_0xcd16('0x21')](respondWithResult(_0xc3e964,null))[_0xcd16('0x2a')](handleError(_0xc3e964,null));};exports['create']=function(_0x16cb8c,_0x547b7f){return db[_0xcd16('0x5b')][_0xcd16('0x5c')](_0x16cb8c['body'],{})[_0xcd16('0x21')](function(_0x42efc8){var _0xe764c7=_0x16cb8c[_0xcd16('0x5d')][_0xcd16('0x5e')]({'plain':!![]});if(!_0xe764c7)throw new Error(_0xcd16('0x5f'));if(_0xe764c7[_0xcd16('0x60')]===_0xcd16('0x5d')){var _0x31d484=_0x42efc8[_0xcd16('0x5e')]({'plain':!![]});var _0x46dde9=_0xcd16('0x39');return db[_0xcd16('0x61')][_0xcd16('0x62')]({'where':{'name':_0x46dde9,'userProfileId':_0xe764c7[_0xcd16('0x63')]},'raw':!![]})[_0xcd16('0x21')](function(_0x164432){if(_0x164432&&_0x164432[_0xcd16('0x64')]===0x0){return db[_0xcd16('0x3a')]['create']({'name':_0x31d484[_0xcd16('0x3d')],'resourceId':_0x31d484['id'],'type':_0x164432[_0xcd16('0x3d')],'sectionId':_0x164432['id']},{})[_0xcd16('0x21')](function(){return _0x42efc8;});}else{return _0x42efc8;}})[_0xcd16('0x2a')](function(_0x4a4f84){logger[_0xcd16('0x27')](_0xcd16('0x65'),_0x4a4f84);throw _0x4a4f84;});}return _0x42efc8;})[_0xcd16('0x21')](respondWithResult(_0x547b7f,0xc9))[_0xcd16('0x2a')](handleError(_0x547b7f,null));};exports[_0xcd16('0x37')]=function(_0x333b73,_0x1cbdb9){if(_0x333b73[_0xcd16('0x66')]['id']){delete _0x333b73[_0xcd16('0x66')]['id'];}return db[_0xcd16('0x5b')][_0xcd16('0x62')]({'where':{'id':_0x333b73[_0xcd16('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1cbdb9,null))[_0xcd16('0x21')](saveUpdates(_0x333b73['body'],null))['then'](respondWithResult(_0x1cbdb9,null))[_0xcd16('0x2a')](handleError(_0x1cbdb9,null));};exports[_0xcd16('0x38')]=function(_0x556582,_0x376247){return db[_0xcd16('0x5b')]['find']({'where':{'id':_0x556582[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x376247,null))[_0xcd16('0x21')](removeEntity(_0x376247,null))[_0xcd16('0x2a')](handleError(_0x376247,null));};exports[_0xcd16('0x67')]=function(_0xa8b3b8,_0x2919fb){return db['FaxAccount'][_0xcd16('0x67')]()[_0xcd16('0x21')](respondWithResult(_0x2919fb,null))[_0xcd16('0x2a')](handleError(_0x2919fb,null));};exports[_0xcd16('0x68')]=function(_0x4b773c,_0x48f700,_0x5cfcc0){if(_0x4b773c[_0xcd16('0x66')]['id']){delete _0x4b773c[_0xcd16('0x66')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4b773c['params']['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x48f700,null))[_0xcd16('0x21')](function(_0x350441){if(_0x350441){_0x4b773c[_0xcd16('0x66')][_0xcd16('0x69')]=_0x350441['id'];return db['Disposition']['create'](_0x4b773c['body']);}})['then'](respondWithResult(_0x48f700,null))['catch'](handleError(_0x48f700,null));};exports[_0xcd16('0x6a')]=function(_0x3a820c,_0x13a538,_0x284cd8){var _0x2e48d0={'raw':![],'where':{}};var _0x11e247={};var _0x2551af={'count':0x0,'rows':[]};return db['FaxAccount'][_0xcd16('0x6b')]({'where':{'id':_0x3a820c[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x13a538,null))['then'](function(_0x43eae2){if(_0x43eae2){_0x11e247[_0xcd16('0x44')]=_[_0xcd16('0x47')](db[_0xcd16('0x6c')][_0xcd16('0x41')]);_0x11e247[_0xcd16('0x46')]=_[_0xcd16('0x47')](_0x3a820c[_0xcd16('0x46')]);_0x11e247['filters']=_[_0xcd16('0x49')](_0x11e247[_0xcd16('0x44')],_0x11e247['query']);_0x2e48d0[_0xcd16('0x4a')]=_[_0xcd16('0x49')](_0x11e247[_0xcd16('0x44')],qs[_0xcd16('0x4b')](_0x3a820c[_0xcd16('0x46')]['fields']));_0x2e48d0[_0xcd16('0x4a')]=_0x2e48d0[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0x2e48d0[_0xcd16('0x4a')]:_0x11e247[_0xcd16('0x44')];if(!_0x3a820c['query'][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0x2e48d0[_0xcd16('0x2f')]=qs[_0xcd16('0x2f')](_0x3a820c[_0xcd16('0x46')][_0xcd16('0x2f')]);_0x2e48d0['offset']=qs[_0xcd16('0x2e')](_0x3a820c[_0xcd16('0x46')]['offset']);}_0x2e48d0['order']=qs[_0xcd16('0x6d')](_0x3a820c[_0xcd16('0x46')][_0xcd16('0x6d')]);_0x2e48d0[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_[_0xcd16('0x51')](_0x3a820c[_0xcd16('0x46')],_0x11e247[_0xcd16('0x48')]));_0x2e48d0[_0xcd16('0x50')][_0xcd16('0x69')]=_0x43eae2['id'];if(_0x3a820c[_0xcd16('0x46')][_0xcd16('0x52')]){_0x2e48d0[_0xcd16('0x50')]=_[_0xcd16('0x53')](_0x2e48d0['where'],{'$or':_[_0xcd16('0x45')](_0x2e48d0[_0xcd16('0x4a')],function(_0x160ef2){var _0x1d0678={};_0x1d0678[_0x160ef2]={'$like':'%'+_0x3a820c['query'][_0xcd16('0x52')]+'%'};return _0x1d0678;})});}_0x2e48d0=_[_0xcd16('0x53')]({},_0x2e48d0,_0x3a820c[_0xcd16('0x54')]);return db[_0xcd16('0x6c')][_0xcd16('0x31')]({'where':_0x2e48d0[_0xcd16('0x50')]})[_0xcd16('0x21')](function(_0x5e5c7a){_0x2551af[_0xcd16('0x31')]=_0x5e5c7a;if(_0x3a820c[_0xcd16('0x46')][_0xcd16('0x55')]){_0x2e48d0[_0xcd16('0x56')]=[{'all':!![]}];}return db[_0xcd16('0x6c')][_0xcd16('0x57')](_0x2e48d0);})[_0xcd16('0x21')](function(_0x29f53f){_0x2551af['rows']=_0x29f53f;return _0x2551af;});}})['then'](respondWithFilteredResult(_0x13a538,_0x2e48d0))['catch'](handleError(_0x13a538,null));};exports[_0xcd16('0x6e')]=function(_0x106e47,_0x168a21,_0x13e0eb){return db['FaxAccount'][_0xcd16('0x62')]({'where':{'id':_0x106e47[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x168a21,null))[_0xcd16('0x21')](function(_0x1d0aed){if(_0x1d0aed){return _0x1d0aed[_0xcd16('0x6e')](_0x106e47[_0xcd16('0x46')][_0xcd16('0x6f')]);}})[_0xcd16('0x21')](respondWithStatusCode(_0x168a21,null))['catch'](handleError(_0x168a21,null));};exports[_0xcd16('0x70')]=function(_0x2a4761,_0x395c23,_0x27c445){if(_0x2a4761[_0xcd16('0x66')]['id']){delete _0x2a4761[_0xcd16('0x66')]['id'];}return db[_0xcd16('0x5b')]['find']({'where':{'id':_0x2a4761[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x395c23,null))[_0xcd16('0x21')](function(_0x12fa03){if(_0x12fa03){_0x2a4761[_0xcd16('0x66')][_0xcd16('0x69')]=_0x12fa03['id'];return db[_0xcd16('0x71')][_0xcd16('0x5c')](_0x2a4761['body']);}})[_0xcd16('0x21')](respondWithResult(_0x395c23,null))[_0xcd16('0x2a')](handleError(_0x395c23,null));};exports['getAnswers']=function(_0x535f96,_0x1bb112,_0x3680fc){var _0x44fd4a={'raw':![],'where':{}};var _0x520211={};var _0x1875e7={'count':0x0,'rows':[]};return db['FaxAccount'][_0xcd16('0x6b')]({'where':{'id':_0x535f96['params']['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x1bb112,null))['then'](function(_0x2becd0){if(_0x2becd0){_0x520211[_0xcd16('0x44')]=_[_0xcd16('0x47')](db[_0xcd16('0x71')]['rawAttributes']);_0x520211['query']=_[_0xcd16('0x47')](_0x535f96[_0xcd16('0x46')]);_0x520211[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x520211[_0xcd16('0x44')],_0x520211['query']);_0x44fd4a[_0xcd16('0x4a')]=_[_0xcd16('0x49')](_0x520211[_0xcd16('0x44')],qs['fields'](_0x535f96[_0xcd16('0x46')][_0xcd16('0x4b')]));_0x44fd4a['attributes']=_0x44fd4a[_0xcd16('0x4a')]['length']?_0x44fd4a[_0xcd16('0x4a')]:_0x520211[_0xcd16('0x44')];if(!_0x535f96[_0xcd16('0x46')][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0x44fd4a[_0xcd16('0x2f')]=qs[_0xcd16('0x2f')](_0x535f96[_0xcd16('0x46')]['limit']);_0x44fd4a['offset']=qs[_0xcd16('0x2e')](_0x535f96[_0xcd16('0x46')]['offset']);}_0x44fd4a['order']=qs[_0xcd16('0x6d')](_0x535f96[_0xcd16('0x46')]['sort']);_0x44fd4a[_0xcd16('0x50')]=qs['filters'](_['pick'](_0x535f96[_0xcd16('0x46')],_0x520211[_0xcd16('0x48')]));_0x44fd4a[_0xcd16('0x50')][_0xcd16('0x69')]=_0x2becd0['id'];if(_0x535f96[_0xcd16('0x46')][_0xcd16('0x52')]){_0x44fd4a[_0xcd16('0x50')]=_[_0xcd16('0x53')](_0x44fd4a[_0xcd16('0x50')],{'$or':_[_0xcd16('0x45')](_0x44fd4a[_0xcd16('0x4a')],function(_0x75990e){var _0x53cc28={};_0x53cc28[_0x75990e]={'$like':'%'+_0x535f96[_0xcd16('0x46')][_0xcd16('0x52')]+'%'};return _0x53cc28;})});}_0x44fd4a=_[_0xcd16('0x53')]({},_0x44fd4a,_0x535f96[_0xcd16('0x54')]);return db[_0xcd16('0x71')][_0xcd16('0x31')]({'where':_0x44fd4a['where']})['then'](function(_0x4ea107){_0x1875e7['count']=_0x4ea107;if(_0x535f96['query'][_0xcd16('0x55')]){_0x44fd4a[_0xcd16('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcd16('0x57')](_0x44fd4a);})['then'](function(_0x2075ee){_0x1875e7[_0xcd16('0x58')]=_0x2075ee;return _0x1875e7;});}})[_0xcd16('0x21')](respondWithFilteredResult(_0x1bb112,_0x44fd4a))['catch'](handleError(_0x1bb112,null));};exports[_0xcd16('0x72')]=function(_0x34e2ea,_0x15efe7,_0xb2fa62){return db[_0xcd16('0x5b')][_0xcd16('0x62')]({'where':{'id':_0x34e2ea[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x15efe7,null))['then'](function(_0x1e66d6){if(_0x1e66d6){return _0x1e66d6[_0xcd16('0x72')](_0x34e2ea[_0xcd16('0x46')][_0xcd16('0x6f')]);}})['then'](respondWithStatusCode(_0x15efe7,null))[_0xcd16('0x2a')](handleError(_0x15efe7,null));};exports['addInteraction']=function(_0x13d391,_0x51ec84,_0x69c548){return db[_0xcd16('0x73')][_0xcd16('0x62')]({'where':{'id':_0x13d391[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x51ec84,null))[_0xcd16('0x21')](function(_0x3ae369){if(_0x3ae369){return _0x3ae369[_0xcd16('0x74')](_0x13d391['body'][_0xcd16('0x6f')],_['omit'](_0x13d391[_0xcd16('0x66')],['ids','id'])||{});}})[_0xcd16('0x21')](respondWithResult(_0x51ec84,null))['catch'](handleError(_0x51ec84,null));};exports[_0xcd16('0x75')]=function(_0x4e3fc5,_0x2acdee,_0x3144e4){var _0x437db9={'raw':![],'where':{}};var _0x31c173={};var _0x369aea={'count':0x0,'rows':[]};return db['FaxAccount'][_0xcd16('0x6b')]({'where':{'id':_0x4e3fc5['params']['id']}})['then'](handleEntityNotFound(_0x2acdee,null))[_0xcd16('0x21')](function(_0x13c6b7){if(_0x13c6b7){_0x31c173[_0xcd16('0x44')]=_[_0xcd16('0x47')](db[_0xcd16('0x73')][_0xcd16('0x41')]);_0x31c173[_0xcd16('0x46')]=_[_0xcd16('0x47')](_0x4e3fc5[_0xcd16('0x46')]);_0x31c173[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x31c173[_0xcd16('0x44')],_0x31c173[_0xcd16('0x46')]);_0x437db9[_0xcd16('0x4a')]=_['intersection'](_0x31c173[_0xcd16('0x44')],qs[_0xcd16('0x4b')](_0x4e3fc5[_0xcd16('0x46')]['fields']));_0x437db9[_0xcd16('0x4a')]=_0x437db9[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0x437db9[_0xcd16('0x4a')]:_0x31c173[_0xcd16('0x44')];if(!_0x4e3fc5['query'][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0x437db9[_0xcd16('0x2f')]=qs[_0xcd16('0x2f')](_0x4e3fc5[_0xcd16('0x46')]['limit']);_0x437db9['offset']=qs[_0xcd16('0x2e')](_0x4e3fc5['query']['offset']);}_0x437db9[_0xcd16('0x4f')]=qs['sort'](_0x4e3fc5[_0xcd16('0x46')]['sort']);_0x437db9[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_['pick'](_0x4e3fc5[_0xcd16('0x46')],_0x31c173[_0xcd16('0x48')]));_0x437db9['where'][_0xcd16('0x69')]=_0x13c6b7['id'];if(_0x4e3fc5[_0xcd16('0x46')][_0xcd16('0x52')]){_0x437db9[_0xcd16('0x50')]=_[_0xcd16('0x53')](_0x437db9[_0xcd16('0x50')],{'$or':_['map'](_0x437db9['attributes'],function(_0x870f83){var _0x39f279={};_0x39f279[_0x870f83]={'$like':'%'+_0x4e3fc5['query'][_0xcd16('0x52')]+'%'};return _0x39f279;})});}_0x437db9=_[_0xcd16('0x53')]({},_0x437db9,_0x4e3fc5['options']);return db['FaxInteraction'][_0xcd16('0x31')]({'where':_0x437db9['where']})['then'](function(_0x21a8bf){_0x369aea[_0xcd16('0x31')]=_0x21a8bf;if(_0x4e3fc5[_0xcd16('0x46')][_0xcd16('0x55')]){_0x437db9[_0xcd16('0x56')]=[{'model':db[_0xcd16('0x76')],'as':_0xcd16('0x77'),'required':![]},{'model':db[_0xcd16('0x78')],'as':_0xcd16('0x79'),'attributes':[_0xcd16('0x3d'),'fullname',_0xcd16('0x7a')],'required':![]},{'model':db['Tag'],'as':_0xcd16('0x7b'),'attributes':['id',_0xcd16('0x3d'),_0xcd16('0x7c')],'where':_0x4e3fc5['query'][_0xcd16('0x7d')]?{'id':_0x4e3fc5[_0xcd16('0x46')][_0xcd16('0x7d')]}:undefined,'required':_0x4e3fc5[_0xcd16('0x46')][_0xcd16('0x7d')]?!![]:![]}];}return db['FaxInteraction'][_0xcd16('0x57')](_0x437db9);})['then'](function(_0x5eeb90){_0x369aea[_0xcd16('0x58')]=_0x5eeb90;return _0x369aea;});}})[_0xcd16('0x21')](respondWithFilteredResult(_0x2acdee,_0x437db9))[_0xcd16('0x2a')](handleError(_0x2acdee,null));};exports['addApplications']=function(_0x2fabe4,_0x5c12d){var _0xf3e0c9=_0x2fabe4[_0xcd16('0x5a')]['id'];var _0x2f6955=_0x2fabe4[_0xcd16('0x66')];var _0x23e6fc=0xc8;var _0x4e81f0=null;return db[_0xcd16('0x7e')][_0xcd16('0x7f')]({'isolationLevel':db['sequelize'][_0xcd16('0x80')][_0xcd16('0x81')]['READ_COMMITTED']},function(_0x20b728){return db[_0xcd16('0x5b')][_0xcd16('0x6b')]({'where':{'id':_0xf3e0c9},'transaction':_0x20b728})[_0xcd16('0x21')](function(_0x35f8bb){if(_0x35f8bb){return db[_0xcd16('0x82')][_0xcd16('0x38')]({'where':{'FaxAccountId':_0xf3e0c9},'transaction':_0x20b728})[_0xcd16('0x21')](function(){var _0x7fecf3=_['map'](_0x2f6955,function(_0xa44d86){_0xa44d86['FaxAccountId']=_0xf3e0c9;return _0xa44d86;});return db[_0xcd16('0x82')][_0xcd16('0x83')](_0x7fecf3,{'transaction':_0x20b728});});}else{_0x23e6fc=0x194;_0x4e81f0=[];}});})[_0xcd16('0x21')](function(){if(_0x23e6fc!==0x194){return db[_0xcd16('0x82')][_0xcd16('0x84')]({'where':{'FaxAccountId':_0xf3e0c9},'order':_0xcd16('0x85')})[_0xcd16('0x21')](function(_0x3e3954){_0x4e81f0=_0x3e3954;});}})[_0xcd16('0x2a')](function(_0x550afd){_0x23e6fc=0x1f4;logger[_0xcd16('0x27')](_0x550afd[_0xcd16('0x3c')]);if(_0x550afd[_0xcd16('0x3d')]){delete _0x550afd[_0xcd16('0x3d')];}_0x4e81f0=_0x550afd;})[_0xcd16('0x86')](function(){if(_0x4e81f0===null){_0x5c12d[_0xcd16('0x3b')](_0x23e6fc);}else{if(_0x23e6fc===0x1f4){_0x5c12d[_0xcd16('0x2c')](_0x23e6fc)['send'](_0x4e81f0);}else{_0x5c12d[_0xcd16('0x2c')](_0x23e6fc)[_0xcd16('0x2d')](_0x4e81f0);}}});};exports[_0xcd16('0x87')]=function(_0x25f5db,_0xfdcdba,_0x554cdc){var _0x2eebf5={};var _0xd6abd5={};var _0x40f39d;var _0x3b8261;return db['FaxAccount'][_0xcd16('0x6b')]({'where':{'id':_0x25f5db['params']['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0xfdcdba,null))[_0xcd16('0x21')](function(_0x52e177){if(_0x52e177){_0x40f39d=_0x52e177;_0xd6abd5[_0xcd16('0x44')]=_['keys'](db[_0xcd16('0x82')][_0xcd16('0x41')]);_0xd6abd5[_0xcd16('0x46')]=_['keys'](_0x25f5db[_0xcd16('0x46')]);_0xd6abd5[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0xd6abd5[_0xcd16('0x44')],_0xd6abd5[_0xcd16('0x46')]);_0x2eebf5[_0xcd16('0x4a')]=_['intersection'](_0xd6abd5[_0xcd16('0x44')],qs[_0xcd16('0x4b')](_0x25f5db[_0xcd16('0x46')][_0xcd16('0x4b')]));_0x2eebf5[_0xcd16('0x4a')]=_0x2eebf5[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0x2eebf5[_0xcd16('0x4a')]:_0xd6abd5[_0xcd16('0x44')];_0x2eebf5['order']=qs[_0xcd16('0x6d')](_0x25f5db[_0xcd16('0x46')]['sort']);_0x2eebf5[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_['pick'](_0x25f5db[_0xcd16('0x46')],_0xd6abd5[_0xcd16('0x48')]));if(_0x25f5db[_0xcd16('0x46')]['filter']){_0x2eebf5[_0xcd16('0x50')]=_['merge'](_0x2eebf5[_0xcd16('0x50')],{'$or':_['map'](_0x2eebf5[_0xcd16('0x4a')],function(_0x5d7444){var _0x440919={};_0x440919[_0x5d7444]={'$like':'%'+_0x25f5db[_0xcd16('0x46')][_0xcd16('0x52')]+'%'};return _0x440919;})});}_0x2eebf5=_[_0xcd16('0x53')]({},_0x2eebf5,_0x25f5db[_0xcd16('0x54')]);return _0x40f39d[_0xcd16('0x87')](_0x2eebf5);}})['then'](function(_0x5462fe){if(_0x5462fe){_0x3b8261=_0x5462fe[_0xcd16('0x4c')];if(!_0x25f5db['query']['hasOwnProperty'](_0xcd16('0x4e'))){_0x2eebf5[_0xcd16('0x2f')]=qs[_0xcd16('0x2f')](_0x25f5db[_0xcd16('0x46')][_0xcd16('0x2f')]);_0x2eebf5[_0xcd16('0x2e')]=qs[_0xcd16('0x2e')](_0x25f5db[_0xcd16('0x46')][_0xcd16('0x2e')]);}return _0x40f39d[_0xcd16('0x87')](_0x2eebf5);}})['then'](function(_0x5ce98d){if(_0x5ce98d){return _0x5ce98d?{'count':_0x3b8261,'rows':_0x5ce98d}:null;}})[_0xcd16('0x21')](respondWithResult(_0xfdcdba,null))[_0xcd16('0x2a')](handleError(_0xfdcdba,null));};function Extension(_0x1644b8,_0x7a3c7,_0x36e71e,_0x34a8f5){this['context']=_0xcd16('0x88');this[_0xcd16('0x89')]=_0x1644b8[_0xcd16('0x8a')];this[_0xcd16('0x8b')]=_0x34a8f5;this['type']=_0xcd16('0x8c');this[_0xcd16('0x8d')]=_0xcd16('0x8e');this[_0xcd16('0x69')]=_0x1644b8['id'];this[_0xcd16('0x85')]=_0x7a3c7;this[_0xcd16('0x8f')]=_0x36e71e;}function createExtensionsReciveFax(_0x24e610){var _0x2dcc0f=0x1;var _0x2dd76f=[];_0x2dd76f[_0xcd16('0x90')](new Extension(_0x24e610,_0x2dcc0f,'',_0xcd16('0x91')));_0x2dcc0f+=0x1;_0x2dd76f['push'](new Extension(_0x24e610,_0x2dcc0f,_0xcd16('0x92'),'Set'));_0x2dcc0f+=0x1;for(var _0x16cea9 in _0x24e610){if(_0x24e610['hasOwnProperty'](_0x16cea9)&&(_0x16cea9===_0xcd16('0x93')||_0x16cea9===_0xcd16('0x8a')||_0x16cea9==='gateway'||_0x16cea9===_0xcd16('0x94')||_0x16cea9==='headerinfo'||_0x16cea9===_0xcd16('0x95')||_0x16cea9===_0xcd16('0x96')||_0x16cea9===_0xcd16('0x97')||_0x16cea9===_0xcd16('0x98'))){_0x2dd76f[_0xcd16('0x90')](new Extension(_0x24e610,_0x2dcc0f,_0xcd16('0x99')+_0x16cea9+')='+_0x24e610[_0x16cea9],_0xcd16('0x9a')));_0x2dcc0f+=0x1;}}_0x2dd76f[_0xcd16('0x90')](new Extension(_0x24e610,_0x2dcc0f,'6',_0xcd16('0x9b')));_0x2dcc0f+=0x1;_0x2dd76f[_0xcd16('0x90')](new Extension(_0x24e610,_0x2dcc0f,'/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',_0xcd16('0x9c')));_0x2dcc0f=0x0;return _0x2dd76f;}exports[_0xcd16('0x9d')]=function(_0x5e72a8,_0x4b27e8,_0x5a3df6){var _0x3b8d2f;return db[_0xcd16('0x7e')][_0xcd16('0x7f')](function(_0x4b0f3c){return db[_0xcd16('0x5b')]['create'](_0x5e72a8['body'],{'transaction':_0x4b0f3c})[_0xcd16('0x21')](function(_0x3609dc){_0x3b8d2f=_0x3609dc['get']({'plain':!![]});return db[_0xcd16('0x9e')][_0xcd16('0x83')](createExtensionsReciveFax(_0x3b8d2f),{'transaction':_0x4b0f3c});});})['then'](function(){return _0x3b8d2f;})[_0xcd16('0x21')](respondWithResult(_0x4b27e8,null))[_0xcd16('0x2a')](handleError(_0x4b27e8,null));};exports[_0xcd16('0x9f')]=function(_0x2c022a,_0x1f55fc,_0x2cd3ef){var _0x5e04ca;return db[_0xcd16('0x7e')][_0xcd16('0x7f')](function(_0x989ae6){return db[_0xcd16('0x5b')]['update'](_0x2c022a['body'],{'where':{'id':_0x2c022a[_0xcd16('0x66')]['id']},'transaction':_0x989ae6})[_0xcd16('0x21')](function(_0x59b37b){return db[_0xcd16('0x9e')]['destroy']({'where':{'FaxAccountId':_0x2c022a['body']['id']},'transaction':_0x989ae6})['then'](function(_0x3d9128){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xcd16('0xa0')](_0x2c022a[_0xcd16('0x66')],[_0xcd16('0xa1'),'key',_0xcd16('0xa2'),_0xcd16('0xa3'),'TrunkId',_0xcd16('0xa4')])),{'transaction':_0x989ae6});});});})['then'](function(){return db[_0xcd16('0x5b')][_0xcd16('0xa5')](_0x2c022a['body']['id']);})[_0xcd16('0x21')](respondWithResult(_0x1f55fc,null))[_0xcd16('0x2a')](handleError(_0x1f55fc,null));};exports[_0xcd16('0xa6')]=function(_0x52ecfe,_0x4fa4e0,_0x441a30){var _0xb921eb={'raw':!![],'where':{}};var _0x41d55e={};var _0x1312ec={'count':0x0,'rows':[]};return db[_0xcd16('0x5b')]['findOne']({'where':{'id':_0x52ecfe[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x4fa4e0,null))['then'](function(_0xa0d281){if(_0xa0d281){_0x41d55e[_0xcd16('0x44')]=_['keys'](db[_0xcd16('0xa7')][_0xcd16('0x41')]);_0x41d55e[_0xcd16('0x46')]=_[_0xcd16('0x47')](_0x52ecfe[_0xcd16('0x46')]);_0x41d55e[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x41d55e['model'],_0x41d55e[_0xcd16('0x46')]);_0xb921eb[_0xcd16('0x4a')]=_[_0xcd16('0x49')](_0x41d55e[_0xcd16('0x44')],qs[_0xcd16('0x4b')](_0x52ecfe['query'][_0xcd16('0x4b')]));_0xb921eb[_0xcd16('0x4a')]=_0xb921eb[_0xcd16('0x4a')][_0xcd16('0x4c')]?_0xb921eb['attributes']:_0x41d55e[_0xcd16('0x44')];if(!_0x52ecfe[_0xcd16('0x46')][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0xb921eb[_0xcd16('0x2f')]=qs['limit'](_0x52ecfe['query'][_0xcd16('0x2f')]);_0xb921eb[_0xcd16('0x2e')]=qs[_0xcd16('0x2e')](_0x52ecfe[_0xcd16('0x46')][_0xcd16('0x2e')]);}_0xb921eb[_0xcd16('0x4f')]=qs[_0xcd16('0x6d')](_0x52ecfe['query'][_0xcd16('0x6d')]);_0xb921eb[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_[_0xcd16('0x51')](_0x52ecfe[_0xcd16('0x46')],_0x41d55e[_0xcd16('0x48')]));_0xb921eb[_0xcd16('0x50')][_0xcd16('0x69')]=_0xa0d281['id'];if(_0x52ecfe['query']['filter']){_0xb921eb[_0xcd16('0x50')]=_[_0xcd16('0x53')](_0xb921eb[_0xcd16('0x50')],{'$or':_['map'](_0xb921eb[_0xcd16('0x4a')],function(_0x5501d5){var _0xa9f962={};_0xa9f962[_0x5501d5]={'$like':'%'+_0x52ecfe[_0xcd16('0x46')][_0xcd16('0x52')]+'%'};return _0xa9f962;})});}if(_0x52ecfe[_0xcd16('0x46')]['$gte']){var _0xf8cdf3=_0x52ecfe['query'][_0xcd16('0xa8')]['split'](',');var _0x51ed6c={};_0x51ed6c[_0xf8cdf3[0x0]]={'$gte':moment(_0xf8cdf3[0x1])[_0xcd16('0xa9')](_0xcd16('0xaa'))};_0xb921eb['where']=_[_0xcd16('0x53')](_0xb921eb[_0xcd16('0x50')],_0x51ed6c);}_0xb921eb=_['merge']({},_0xb921eb,_0x52ecfe['options']);return db['FaxMessage']['count']({'where':_0xb921eb['where']})[_0xcd16('0x21')](function(_0x980655){_0x1312ec[_0xcd16('0x31')]=_0x980655;if(_0x52ecfe['query'][_0xcd16('0x55')]){_0xb921eb[_0xcd16('0x56')]=[{'all':!![]}];}return db['FaxMessage'][_0xcd16('0x57')](_0xb921eb);})[_0xcd16('0x21')](function(_0x35f57b){_0x1312ec[_0xcd16('0x58')]=_0x35f57b;return _0x1312ec;});}})[_0xcd16('0x21')](respondWithFilteredResult(_0x4fa4e0,_0xb921eb))[_0xcd16('0x2a')](handleError(_0x4fa4e0,null));};exports[_0xcd16('0x3e')]=function(_0x39c468,_0x22f02f,_0x12cc16){var _0x4fff3f,_0x2e73d7={},_0x7c80a7;if(_0x39c468[_0xcd16('0x66')]['to']){_0x7c80a7=_0x39c468[_0xcd16('0x66')]['to'][0x0];}return db[_0xcd16('0x5b')]['find']({'where':{'id':_0x39c468[_0xcd16('0x5a')]['id']},'include':[{'model':db[_0xcd16('0xab')],'as':_0xcd16('0xac'),'include':[{'model':db[_0xcd16('0x76')],'as':_0xcd16('0xad'),'where':{'fax':_0x7c80a7},'limit':0x1,'order':[[_0xcd16('0xa3'),_0xcd16('0xae')]]}]}]})[_0xcd16('0x21')](handleEntityNotFound(_0x22f02f,null))[_0xcd16('0x21')](function(_0x5202d7){_0x4fff3f=_0x5202d7;if(_0x39c468[_0xcd16('0x66')]['attachments']&&_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][_0xcd16('0x4c')]){for(var _0xa85179=0x0;_0xa85179<_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][_0xcd16('0x4c')];_0xa85179+=0x1){_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][_0xa85179]={'filename':_0x39c468['body'][_0xcd16('0xaf')][_0xa85179]['name'],'id':_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][_0xa85179]['id'],'path':path[_0xcd16('0xb0')](config[_0xcd16('0xb1')],_0xcd16('0xb2'),_0x39c468[_0xcd16('0x66')]['attachments'][_0xa85179][_0xcd16('0xb3')])};}}return respondWithRpcPromise(_0xcd16('0xb4'),_0xcd16('0xb4'),{'FaxAccountId':_['isNil'](_0x39c468[_0xcd16('0x5a')]['id'])?undefined:_0x39c468['params']['id'],'path':_[_0xcd16('0xb5')](_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][0x0][_0xcd16('0xb6')])?undefined:_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][0x0][_0xcd16('0xb6')],'fax':_[_0xcd16('0xb5')](_0x39c468[_0xcd16('0x66')]['to'][0x0])?undefined:_0x39c468[_0xcd16('0x66')]['to'][0x0]},client9002);})[_0xcd16('0x21')](function(){if(_0x4fff3f){if(_[_0xcd16('0xb5')](_0x39c468['body']['from'])){_0x39c468['body']['from']=util[_0xcd16('0xa9')](_0xcd16('0xb7'),_0x4fff3f[_0xcd16('0x3d')],_0x4fff3f[_0xcd16('0xb8')]);}if(_0x4fff3f[_0xcd16('0xac')]){if(_0x4fff3f[_0xcd16('0xac')]['Contacts'][_0xcd16('0x4c')]){return _0x4fff3f[_0xcd16('0xac')][_0xcd16('0xad')][0x0];}else{return db['CmContact'][_0xcd16('0x5c')](_[_0xcd16('0xb9')](_0x39c468['body'],{'firstName':_0x39c468[_0xcd16('0x66')]['to'][0x0],'phone':_0x39c468['body']['to'][0x0],'fax':_0x39c468[_0xcd16('0x66')]['to'][0x0],'ListId':_0x4fff3f[_0xcd16('0xa4')]}));}}else{throw new Error(_0xcd16('0xba'));}}else{throw new Error(_0xcd16('0xbb'));}})[_0xcd16('0x21')](function(_0x2fc6e2){if(_0x2fc6e2){return db[_0xcd16('0x73')][_0xcd16('0x62')]({'where':{'ContactId':_0x2fc6e2['id'],'closed':![],'FaxAccountId':_0x4fff3f['id']}})[_0xcd16('0x21')](function(_0x5115c1){if(_0x5115c1){return[_0x5115c1,![]];}return db[_0xcd16('0x73')]['create']({'UserId':_0x39c468[_0xcd16('0x5d')]['id'],'ContactId':_0x2fc6e2['id'],'FaxAccountId':_0x4fff3f['id'],'fax':_0x39c468[_0xcd16('0x66')]['to'][0x0],'firstMsgDirection':_0xcd16('0xbc'),'Messages':[_['merge'](_0x39c468[_0xcd16('0x66')],{'read':![],'body':_0x39c468[_0xcd16('0x66')]['attachments'][0x0][_0xcd16('0xbd')],'FaxAccountId':_0x4fff3f['id'],'UserId':_0x39c468[_0xcd16('0x5d')]['id'],'ContactId':_0x2fc6e2['id'],'AttachmentId':_0x39c468['body'][_0xcd16('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0xcd16('0xa7')],'as':_0xcd16('0xbe')}]})[_0xcd16('0x21')](function(_0x5da82c){return[_0x5da82c,!![]];});});}else{throw new Error(_0xcd16('0xbf'));}})[_0xcd16('0xc0')](function(_0x31e524,_0x36eea1){if(_0x36eea1){return _0x31e524;}return db[_0xcd16('0xa7')][_0xcd16('0x5c')]({'direction':_0xcd16('0xbc'),'read':![],'body':_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][0x0][_0xcd16('0xbd')],'FaxAccountId':_0x4fff3f['id'],'FaxInteractionId':_0x31e524['id'],'UserId':_0x39c468[_0xcd16('0x5d')]['id'],'ContactId':_0x31e524['ContactId'],'AttachmentId':_0x39c468[_0xcd16('0x66')]['attachments'][0x0]['id']})['then'](function(_0xf6ee02){_0x31e524[_0xcd16('0xc1')][_0xcd16('0xbe')]=[];_0x31e524[_0xcd16('0xc1')][_0xcd16('0xbe')][_0xcd16('0x90')](_0xf6ee02[_0xcd16('0xc1')]);return _0x31e524;});})[_0xcd16('0x21')](function(_0x16ac6e){respondWithRpcPromise(_0xcd16('0xc2'),_0xcd16('0xc2'),{'FaxAccountId':_[_0xcd16('0xb5')](_0x39c468['params']['id'])?undefined:_0x39c468[_0xcd16('0x5a')]['id'],'path':_[_0xcd16('0xb5')](_0x39c468[_0xcd16('0x66')][_0xcd16('0xaf')][0x0][_0xcd16('0xb6')])?undefined:_0x39c468[_0xcd16('0x66')]['attachments'][0x0][_0xcd16('0xb6')],'fax':_[_0xcd16('0xb5')](_0x39c468[_0xcd16('0x66')]['to'][0x0])?undefined:_0x39c468['body']['to'][0x0],'AttachmentId':_0x39c468['body'][_0xcd16('0xaf')][0x0]['id']},client9002)[_0xcd16('0x21')](function(_0xcc7c1b){logger[_0xcd16('0x22')]('SendFaxRpc,\x20%s',_0xcc7c1b);})['catch'](function(_0x58bd5b){logger[_0xcd16('0x22')](_0xcd16('0xc3'),_0x58bd5b);});return _0x16ac6e;})[_0xcd16('0x21')](respondWithResult(_0x22f02f,null))[_0xcd16('0x2a')](handleError(_0x22f02f,null));};exports['addAgents']=function(_0x351f43,_0x18ad44,_0x433329){return db['FaxAccount'][_0xcd16('0x62')]({'where':{'id':_0x351f43[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x18ad44,null))[_0xcd16('0x21')](function(_0x4f57fe){if(_0x4f57fe){return _0x4f57fe[_0xcd16('0xc4')](_0x351f43[_0xcd16('0x66')][_0xcd16('0x6f')],_[_0xcd16('0xa0')](_0x351f43[_0xcd16('0x66')],[_0xcd16('0x6f'),'id'])||{})[_0xcd16('0xc0')](function(_0x128d5a){for(var _0x1def7a=0x0;_0x1def7a<_0x351f43['body'][_0xcd16('0x6f')]['length'];_0x1def7a+=0x1){socket[_0xcd16('0xc5')](_0xcd16('0xc6'),{'UserId':Number(_0x351f43['body'][_0xcd16('0x6f')][_0x1def7a]),'FaxAccountId':Number(_0x351f43[_0xcd16('0x5a')]['id'])});}return _0x128d5a;});}})[_0xcd16('0x21')](respondWithResult(_0x18ad44,null))[_0xcd16('0x2a')](handleError(_0x18ad44,null));};exports[_0xcd16('0xc7')]=function(_0x222c66,_0x282c8a,_0x376696){return db[_0xcd16('0x5b')][_0xcd16('0x62')]({'where':{'id':_0x222c66['params']['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x282c8a,null))['then'](function(_0x518627){if(_0x518627){return _0x518627[_0xcd16('0xc7')](_0x222c66[_0xcd16('0x46')][_0xcd16('0x6f')])[_0xcd16('0x21')](function(){if(_[_0xcd16('0xc8')](_0x222c66[_0xcd16('0x46')][_0xcd16('0x6f')])){for(var _0x1f54a4=0x0;_0x1f54a4<_0x222c66['query']['ids'][_0xcd16('0x4c')];_0x1f54a4+=0x1){socket[_0xcd16('0xc5')](_0xcd16('0xc9'),{'UserId':Number(_0x222c66[_0xcd16('0x46')][_0xcd16('0x6f')][_0x1f54a4]),'FaxAccountId':Number(_0x222c66['params']['id'])});}}else{socket[_0xcd16('0xc5')](_0xcd16('0xc9'),{'UserId':Number(_0x222c66['query']['ids']),'FaxAccountId':Number(_0x222c66[_0xcd16('0x5a')]['id'])});}});}})[_0xcd16('0x21')](respondWithStatusCode(_0x282c8a,null))[_0xcd16('0x2a')](handleError(_0x282c8a,null));};exports[_0xcd16('0xca')]=function(_0x584160,_0x3ec88d,_0x43753f){var _0x5e9b11={};var _0x4575d4={};var _0x308e85;var _0x3083d6;return db[_0xcd16('0x5b')][_0xcd16('0x6b')]({'where':{'id':_0x584160[_0xcd16('0x5a')]['id']}})[_0xcd16('0x21')](handleEntityNotFound(_0x3ec88d,null))[_0xcd16('0x21')](function(_0x84205e){if(_0x84205e){_0x308e85=_0x84205e;_0x4575d4[_0xcd16('0x44')]=_[_0xcd16('0x47')](db[_0xcd16('0x78')][_0xcd16('0x41')]);_0x4575d4['query']=_[_0xcd16('0x47')](_0x584160[_0xcd16('0x46')]);_0x4575d4[_0xcd16('0x48')]=_[_0xcd16('0x49')](_0x4575d4[_0xcd16('0x44')],_0x4575d4[_0xcd16('0x46')]);_0x5e9b11['attributes']=_['intersection'](_0x4575d4[_0xcd16('0x44')],qs[_0xcd16('0x4b')](_0x584160['query'][_0xcd16('0x4b')]));_0x5e9b11['attributes']=_0x5e9b11[_0xcd16('0x4a')]['length']?_0x5e9b11[_0xcd16('0x4a')]:_0x4575d4['model'];_0x5e9b11[_0xcd16('0x4f')]=qs[_0xcd16('0x6d')](_0x584160['query'][_0xcd16('0x6d')]);_0x5e9b11[_0xcd16('0x50')]=qs[_0xcd16('0x48')](_[_0xcd16('0x51')](_0x584160['query'],_0x4575d4[_0xcd16('0x48')]));if(_0x584160[_0xcd16('0x46')][_0xcd16('0x52')]){_0x5e9b11[_0xcd16('0x50')]=_[_0xcd16('0x53')](_0x5e9b11['where'],{'$or':_[_0xcd16('0x45')](_0x5e9b11[_0xcd16('0x4a')],function(_0x304b76){var _0x49966d={};_0x49966d[_0x304b76]={'$like':'%'+_0x584160[_0xcd16('0x46')][_0xcd16('0x52')]+'%'};return _0x49966d;})});}_0x5e9b11=_['merge']({},_0x5e9b11,_0x584160['options']);return _0x308e85[_0xcd16('0xca')](_0x5e9b11);}})[_0xcd16('0x21')](function(_0x5113b1){if(_0x5113b1){_0x3083d6=_0x5113b1[_0xcd16('0x4c')];if(!_0x584160['query'][_0xcd16('0x4d')](_0xcd16('0x4e'))){_0x5e9b11['limit']=qs['limit'](_0x584160['query']['limit']);_0x5e9b11[_0xcd16('0x2e')]=qs[_0xcd16('0x2e')](_0x584160[_0xcd16('0x46')][_0xcd16('0x2e')]);}return _0x308e85[_0xcd16('0xca')](_0x5e9b11);}})[_0xcd16('0x21')](function(_0x13cb95){if(_0x13cb95){return _0x13cb95?{'count':_0x3083d6,'rows':_0x13cb95}:null;}})[_0xcd16('0x21')](respondWithResult(_0x3ec88d,null))[_0xcd16('0x2a')](handleError(_0x3ec88d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 56897c6..59ef373 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 _0x926f=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x44dc2e,_0x8f8cfa){var _0x44e700=function(_0x59be17){while(--_0x59be17){_0x44dc2e['push'](_0x44dc2e['shift']());}};_0x44e700(++_0x8f8cfa);}(_0x926f,0xb6));var _0xf926=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x926f[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xf926('0x0'));var FaxAccount=require(_0xf926('0x1'))['db'][_0xf926('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf926('0x3')](0x0);var events={'afterCreate':_0xf926('0x4'),'afterUpdate':_0xf926('0x5'),'afterDestroy':_0xf926('0x6')};function emitEvent(_0x579719){return function(_0x2b459c,_0x3a463b,_0x2cd78b){FaxAccountEvents[_0xf926('0x7')](_0x579719+':'+_0x2b459c['id'],_0x2b459c);FaxAccountEvents[_0xf926('0x7')](_0x579719,_0x2b459c);_0x2cd78b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xf926('0x8')](e,emitEvent(event));}}module[_0xf926('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x29ca=['events','../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5b1b43,_0x8a4b23){var _0x201845=function(_0x2c1923){while(--_0x2c1923){_0x5b1b43['push'](_0x5b1b43['shift']());}};_0x201845(++_0x8a4b23);}(_0x29ca,0x122));var _0xa29c=function(_0x1817bd,_0x4a5667){_0x1817bd=_0x1817bd-0x0;var _0x5f52f9=_0x29ca[_0x1817bd];return _0x5f52f9;};'use strict';var EventEmitter=require(_0xa29c('0x0'));var FaxAccount=require(_0xa29c('0x1'))['db'][_0xa29c('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa29c('0x3')](0x0);var events={'afterCreate':_0xa29c('0x4'),'afterUpdate':_0xa29c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2bba7d){return function(_0x1c7e82,_0x3e8045,_0x22b0a4){FaxAccountEvents['emit'](_0x2bba7d+':'+_0x1c7e82['id'],_0x1c7e82);FaxAccountEvents[_0xa29c('0x6')](_0x2bba7d,_0x1c7e82);_0x22b0a4(null);};}for(var e in events){if(events[_0xa29c('0x7')](e)){var event=events[e];FaxAccount[_0xa29c('0x8')](e,emitEvent(event));}}module[_0xa29c('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a9bf8b6..54fbef1 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 _0x9067=['exports','define','FaxAccount','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x1a286f,_0x374d52){var _0x33e8b0=function(_0xc49f77){while(--_0xc49f77){_0x1a286f['push'](_0x1a286f['shift']());}};_0x33e8b0(++_0x374d52);}(_0x9067,0x12f));var _0x7906=function(_0x302fa4,_0x23c359){_0x302fa4=_0x302fa4-0x0;var _0x3491c1=_0x9067[_0x302fa4];return _0x3491c1;};'use strict';var _=require(_0x7906('0x0'));var util=require(_0x7906('0x1'));var logger=require(_0x7906('0x2'))('api');var moment=require(_0x7906('0x3'));var BPromise=require(_0x7906('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7906('0x5'));var rimraf=require('rimraf');var config=require(_0x7906('0x6'));var attributes=require('./faxAccount.attributes');module[_0x7906('0x7')]=function(_0x3e7d80,_0x59b484){return _0x3e7d80[_0x7906('0x8')](_0x7906('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd319=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','api','moment','bluebird','request-promise'];(function(_0x3c3360,_0x110cbc){var _0x43d7cf=function(_0x2aa635){while(--_0x2aa635){_0x3c3360['push'](_0x3c3360['shift']());}};_0x43d7cf(++_0x110cbc);}(_0xd319,0x163));var _0x9d31=function(_0x3968b9,_0x140a9a){_0x3968b9=_0x3968b9-0x0;var _0x22ca19=_0xd319[_0x3968b9];return _0x22ca19;};'use strict';var _=require('lodash');var util=require(_0x9d31('0x0'));var logger=require('../../config/logger')(_0x9d31('0x1'));var moment=require(_0x9d31('0x2'));var BPromise=require(_0x9d31('0x3'));var rp=require(_0x9d31('0x4'));var fs=require('fs');var path=require(_0x9d31('0x5'));var rimraf=require(_0x9d31('0x6'));var config=require(_0x9d31('0x7'));var attributes=require(_0x9d31('0x8'));module[_0x9d31('0x9')]=function(_0x16e87d,_0x1400bf){return _0x16e87d['define'](_0x9d31('0xa'),attributes,{'tableName':_0x9d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index eca8824..035cf73 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 _0xb602=['waitForTheAssignedAgent','*,*,*,*','FaxQueue','name','queueId','unshift','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','limit','map','include','attributes','model','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','applications','priority','asc','length','create','FaxInteraction','find','Contact\x20not\x20found','spread','push','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','agent'];(function(_0x23f7c9,_0x4db646){var _0x2e6814=function(_0x44d5dc){while(--_0x44d5dc){_0x23f7c9['push'](_0x23f7c9['shift']());}};_0x2e6814(++_0x4db646);}(_0xb602,0xbf));var _0x2b60=function(_0xc54c54,_0x59053b){_0xc54c54=_0xc54c54-0x0;var _0x476786=_0xb602[_0xc54c54];return _0x476786;};'use strict';var _=require(_0x2b60('0x0'));var util=require('util');var moment=require(_0x2b60('0x1'));var BPromise=require(_0x2b60('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b60('0x3'));var db=require(_0x2b60('0x4'))['db'];var utils=require(_0x2b60('0x5'));var logger=require('../../config/logger')(_0x2b60('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b60('0x7')][_0x2b60('0x8')]({'port':0x232c});config[_0x2b60('0x9')]=_[_0x2b60('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b60('0xb'))(new Redis(config[_0x2b60('0x9')]));require(_0x2b60('0xc'))[_0x2b60('0xd')](socket);function respondWithRpcPromise(_0x256977,_0x1b09ee,_0x40d736){return new BPromise(function(_0x125efb,_0x21e423){return client[_0x2b60('0xe')](_0x256977,_0x40d736)[_0x2b60('0xf')](function(_0x18bf2e){logger[_0x2b60('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1b09ee,_0x2b60('0x11'));logger[_0x2b60('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b09ee,_0x2b60('0x11'),JSON[_0x2b60('0x13')](_0x18bf2e));if(_0x18bf2e[_0x2b60('0x14')]){if(_0x18bf2e['error'][_0x2b60('0x15')]===0x1f4){logger[_0x2b60('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1b09ee,_0x18bf2e[_0x2b60('0x14')][_0x2b60('0x16')]);return _0x21e423(_0x18bf2e[_0x2b60('0x14')][_0x2b60('0x16')]);}logger[_0x2b60('0x14')](_0x2b60('0x17'),_0x1b09ee,_0x18bf2e[_0x2b60('0x14')][_0x2b60('0x16')]);return _0x125efb(_0x18bf2e[_0x2b60('0x14')][_0x2b60('0x16')]);}else{logger[_0x2b60('0x10')](_0x2b60('0x17'),_0x1b09ee,_0x2b60('0x11'));_0x125efb(_0x18bf2e[_0x2b60('0x18')]['message']);}})[_0x2b60('0x19')](function(_0x274a8c){logger[_0x2b60('0x14')](_0x2b60('0x17'),_0x1b09ee,_0x274a8c);_0x21e423(_0x274a8c);});});}exports[_0x2b60('0x1a')]=function(_0x5439d3){var _0x4fae10=this;return new Promise(function(_0x551f3d,_0x42964c){return db[_0x2b60('0x1b')][_0x2b60('0x1c')]({'raw':_0x5439d3['options']?_0x5439d3[_0x2b60('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5439d3[_0x2b60('0x1d')]?_0x5439d3[_0x2b60('0x1d')][_0x2b60('0x1e')]||null:null,'attributes':_0x5439d3[_0x2b60('0x1d')]?_0x5439d3[_0x2b60('0x1d')]['attributes']||null:null,'limit':_0x5439d3[_0x2b60('0x1d')]?_0x5439d3[_0x2b60('0x1d')][_0x2b60('0x1f')]||null:null,'include':_0x5439d3[_0x2b60('0x1d')]?_0x5439d3['options']['include']?_[_0x2b60('0x20')](_0x5439d3['options'][_0x2b60('0x21')],function(_0xcbfd42){return{'model':db[_0xcbfd42['model']],'as':_0xcbfd42['as'],'attributes':_0xcbfd42[_0x2b60('0x22')],'include':_0xcbfd42['include']?_[_0x2b60('0x20')](_0xcbfd42[_0x2b60('0x21')],function(_0x10bb78){return{'model':db[_0x10bb78[_0x2b60('0x23')]],'as':_0x10bb78['as'],'attributes':_0x10bb78['attributes'],'include':_0x10bb78[_0x2b60('0x21')]?_[_0x2b60('0x20')](_0x10bb78[_0x2b60('0x21')],function(_0x3b7fa5){return{'model':db[_0x3b7fa5[_0x2b60('0x23')]],'as':_0x3b7fa5['as'],'attributes':_0x3b7fa5[_0x2b60('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2b60('0xf')](function(_0x5db23d){logger[_0x2b60('0x10')]('GetFaxAccount',_0x5439d3);logger[_0x2b60('0x12')](_0x2b60('0x1a'),_0x5439d3,JSON[_0x2b60('0x13')](_0x5db23d));_0x551f3d(_0x5db23d);})['catch'](function(_0x3a200e){logger['error'](_0x2b60('0x1a'),_0x3a200e[_0x2b60('0x16')],_0x5439d3);_0x42964c(_0x4fae10[_0x2b60('0x14')](0x1f4,_0x3a200e[_0x2b60('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x33b6f3,_0x463ddc,_0xf40ecb){var _0xab4bf7=this;return new Promise(function(_0xa0a371,_0x5ab8b4){var _0x5aa192={'body':_0x33b6f3[_0x2b60('0x24')],'channel':_0x2b60('0x25')};var _0x5312a8=[];var _0x39687a=[];var _0x1a5295={};return db[_0x2b60('0x26')][_0x2b60('0x27')]()[_0x2b60('0xf')](function(_0x38ee57){if(!_0x38ee57){throw new db[(_0x2b60('0x28'))][(_0x2b60('0x29'))](_0x2b60('0x2a'));}_0x5312a8=_[_0x2b60('0x2b')](_[_0x2b60('0x2c')](_0x38ee57),[_0x2b60('0x2d'),'updatedAt']);_0x39687a=_[_0x2b60('0x2b')](_[_0x2b60('0x2c')](_0x38ee57),[_0x2b60('0x2d'),'updatedAt','CompanyId',_0x2b60('0x2e')]);if(_0x33b6f3['body']['id']){delete _0x33b6f3['body']['id'];}if(_['isNil'](_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x2f')])){throw new db['Sequelize'][(_0x2b60('0x29'))](_0x2b60('0x30'));}if(_[_0x2b60('0x31')](_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x24')])||_0x33b6f3[_0x2b60('0x24')]['body']===''){throw new db[(_0x2b60('0x28'))]['ValidationError'](_0x2b60('0x32'));}if(_[_0x2b60('0x31')](_0x33b6f3['body'][_0x2b60('0x33')])){throw new db[(_0x2b60('0x28'))][(_0x2b60('0x29'))](_0x2b60('0x34')+_0x39687a);}if(!_[_0x2b60('0x35')](_0x39687a,_0x33b6f3[_0x2b60('0x24')]['mapKey'])){throw new db[(_0x2b60('0x28'))][(_0x2b60('0x29'))](_0x2b60('0x36')+_0x39687a);}_0x1a5295[_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x33')]]=_0x33b6f3['body']['from'];})[_0x2b60('0xf')](function(){return db['FaxAccount']['find']({'where':{'id':_0x33b6f3[_0x2b60('0x37')]['id']},'include':[{'model':db[_0x2b60('0x38')],'as':_0x2b60('0x39'),'include':[{'model':db[_0x2b60('0x26')],'as':_0x2b60('0x3a'),'where':_0x1a5295,'limit':0x1,'order':[[_0x2b60('0x3b'),_0x2b60('0x3c')]]}]},{'model':db[_0x2b60('0x3d')],'as':_0x2b60('0x3e')}]});})[_0x2b60('0xf')](function(_0x3d6cf6){if(_0x3d6cf6&&_0x3d6cf6[_0x2b60('0x39')]){var _0xa35b2b=_0x3d6cf6[_0x2b60('0x3f')]({'plain':!![]});_0x5aa192['account']=_0xa35b2b;_0x5aa192[_0x2b60('0x40')]=_0xa35b2b[_0x2b60('0x3e')];_0x5aa192['list']=_0xa35b2b[_0x2b60('0x39')];_0x5aa192[_0x2b60('0x40')]=_['orderBy'](_0x5aa192[_0x2b60('0x40')],[_0x2b60('0x41')],[_0x2b60('0x42')]);if(_0x5aa192[_0x2b60('0x37')]['Applications']){delete _0x5aa192['account']['Applications'];}if(_0x5aa192['account'][_0x2b60('0x39')]&&_0x5aa192[_0x2b60('0x37')][_0x2b60('0x39')]['Contacts'][_0x2b60('0x43')]){return _0x5aa192[_0x2b60('0x37')][_0x2b60('0x39')][_0x2b60('0x3a')][0x0];}var _0x280d31=_[_0x2b60('0xa')](_0x33b6f3[_0x2b60('0x24')],{'firstName':_0x33b6f3['body'][_0x2b60('0x2f')],'ListId':_0xa35b2b[_0x2b60('0x2e')]});_0x280d31[_0x33b6f3['body'][_0x2b60('0x33')]]=_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x2f')];return db['CmContact'][_0x2b60('0x44')](_0x280d31,{'fields':_0x5312a8,'raw':!![]});}})[_0x2b60('0xf')](function(_0x26a4d9){_0x5aa192['contact']=_0x26a4d9;if(_0x26a4d9){var _0xcf4ccb={'ContactId':_0x26a4d9['id'],'FaxAccountId':_0x33b6f3['account']['id'],'fax':_0x26a4d9['fax']};return db[_0x2b60('0x45')][_0x2b60('0x46')]({'where':{'ContactId':_0x26a4d9['id'],'closed':![],'FaxAccountId':_0x33b6f3[_0x2b60('0x37')]['id']}})['then'](function(_0x1f9c79){if(_0x1f9c79){return[_0x1f9c79,![]];}return db['FaxInteraction'][_0x2b60('0x44')](_0xcf4ccb)[_0x2b60('0xf')](function(_0x3c6fad){return[_0x3c6fad,!![]];});});}else{throw new Error(_0x2b60('0x47'));}})[_0x2b60('0x48')](function(_0x3a471f,_0x12411a){var _0x2ec0bf=_0x3a471f['get']({'plain':!![]});if(_0x12411a){if(_0x5aa192[_0x2b60('0x37')]['autoclose']){_0x5aa192[_0x2b60('0x40')][_0x2b60('0x49')]({'id':0x0,'priority':_0x5aa192['applications'][_0x2b60('0x43')]+0x1,'app':'close','appdata':_0x2b60('0x4a'),'interval':'*,*,*,*'});}_0x2ec0bf['created']=!![];}else{_0x2ec0bf[_0x2b60('0x4b')]=![];}_0x5aa192[_0x2b60('0x4c')]=_0x2ec0bf;return db[_0x2b60('0x4d')][_0x2b60('0x44')]({'body':_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x24')],'FaxAccountId':_0x33b6f3[_0x2b60('0x37')]['id'],'FaxInteractionId':_0x3a471f['id'],'direction':'in','ContactId':_0x3a471f['ContactId'],'AttachmentId':_0x33b6f3[_0x2b60('0x24')][_0x2b60('0x4e')]});})[_0x2b60('0xf')](function(_0x55b3be){_0x5aa192[_0x2b60('0x16')]=_0x55b3be;if(!_0x5aa192[_0x2b60('0x4c')][_0x2b60('0x4f')])return;return db[_0x2b60('0x50')][_0x2b60('0x46')]({'attributes':['id','name'],'where':{'id':_0x5aa192[_0x2b60('0x4c')]['UserId']}});})[_0x2b60('0xf')](function(_0x439f85){if(_0x439f85){_0x5aa192['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2b60('0x51'),'appdata':_0x439f85['name']+','+(_0x5aa192[_0x2b60('0x37')][_0x2b60('0x52')]||0xa),'interval':_0x2b60('0x53')});}if(!_0x5aa192[_0x2b60('0x4c')]['queueId'])return;return db[_0x2b60('0x54')]['find']({'attributes':['id',_0x2b60('0x55')],'where':{'id':_0x5aa192[_0x2b60('0x4c')][_0x2b60('0x56')]}});})[_0x2b60('0xf')](function(_0x2743f2){if(_0x2743f2){_0x5aa192['applications'][_0x2b60('0x57')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2743f2[_0x2b60('0x55')]+','+(_0x5aa192[_0x2b60('0x37')][_0x2b60('0x58')]||0x12c),'interval':_0x2b60('0x53')});}return respondWithRpcPromise(_0x2b60('0x59'),_0x2b60('0x5a'),_0x5aa192);})['then'](function(_0x40b975){_0xa0a371(_0x40b975);})[_0x2b60('0x19')](function(_0x3f97eb){_0x5ab8b4(_0xab4bf7[_0x2b60('0x14')](0x1f4,_0x3f97eb[_0x2b60('0x16')]));});});}; \ No newline at end of file +var _0x729a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','CmContact','Contacts','DESC','List','get','applications','list','orderBy','asc','Applications','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x729a,0x1d1));var _0xa729=function(_0x5f311a,_0x4b3248){_0x5f311a=_0x5f311a-0x0;var _0x8fa17=_0x729a[_0x5f311a];return _0x8fa17;};'use strict';var _=require('lodash');var util=require(_0xa729('0x0'));var moment=require(_0xa729('0x1'));var BPromise=require(_0xa729('0x2'));var rs=require(_0xa729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa729('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa729('0x5'))(_0xa729('0x6'));var config=require(_0xa729('0x7'));var jayson=require(_0xa729('0x8'));var client=jayson[_0xa729('0x9')]['http']({'port':0x232c});config[_0xa729('0xa')]=_[_0xa729('0xb')](config[_0xa729('0xa')],{'host':_0xa729('0xc'),'port':0x18eb});var socket=require(_0xa729('0xd'))(new Redis(config[_0xa729('0xa')]));require(_0xa729('0xe'))[_0xa729('0xf')](socket);function respondWithRpcPromise(_0x2b28d1,_0x5950ec,_0x4410d2){return new BPromise(function(_0x42e2b9,_0x510edf){return client[_0xa729('0x10')](_0x2b28d1,_0x4410d2)['then'](function(_0x535f2b){logger[_0xa729('0x11')](_0xa729('0x12'),_0x5950ec,_0xa729('0x13'));logger[_0xa729('0x14')](_0xa729('0x15'),_0x5950ec,_0xa729('0x13'),JSON['stringify'](_0x535f2b));if(_0x535f2b[_0xa729('0x16')]){if(_0x535f2b['error'][_0xa729('0x17')]===0x1f4){logger[_0xa729('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5950ec,_0x535f2b[_0xa729('0x16')][_0xa729('0x18')]);return _0x510edf(_0x535f2b[_0xa729('0x16')]['message']);}logger[_0xa729('0x16')](_0xa729('0x12'),_0x5950ec,_0x535f2b[_0xa729('0x16')][_0xa729('0x18')]);return _0x42e2b9(_0x535f2b[_0xa729('0x16')]['message']);}else{logger[_0xa729('0x11')]('FaxAccount,\x20%s,\x20%s',_0x5950ec,'request\x20sent');_0x42e2b9(_0x535f2b[_0xa729('0x19')][_0xa729('0x18')]);}})['catch'](function(_0x1af1e9){logger[_0xa729('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5950ec,_0x1af1e9);_0x510edf(_0x1af1e9);});});}exports[_0xa729('0x1a')]=function(_0x493b40){var _0xaea05=this;return new Promise(function(_0x2486ab,_0x59fbcd){return db[_0xa729('0x1b')][_0xa729('0x1c')]({'raw':_0x493b40['options']?_0x493b40[_0xa729('0x1d')][_0xa729('0x1e')]===undefined?!![]:![]:!![],'where':_0x493b40['options']?_0x493b40[_0xa729('0x1d')][_0xa729('0x1f')]||null:null,'attributes':_0x493b40[_0xa729('0x1d')]?_0x493b40[_0xa729('0x1d')][_0xa729('0x20')]||null:null,'limit':_0x493b40[_0xa729('0x1d')]?_0x493b40[_0xa729('0x1d')][_0xa729('0x21')]||null:null,'include':_0x493b40[_0xa729('0x1d')]?_0x493b40[_0xa729('0x1d')][_0xa729('0x22')]?_[_0xa729('0x23')](_0x493b40[_0xa729('0x1d')][_0xa729('0x22')],function(_0x15767a){return{'model':db[_0x15767a[_0xa729('0x24')]],'as':_0x15767a['as'],'attributes':_0x15767a[_0xa729('0x20')],'include':_0x15767a[_0xa729('0x22')]?_[_0xa729('0x23')](_0x15767a['include'],function(_0x54825a){return{'model':db[_0x54825a['model']],'as':_0x54825a['as'],'attributes':_0x54825a[_0xa729('0x20')],'include':_0x54825a[_0xa729('0x22')]?_[_0xa729('0x23')](_0x54825a['include'],function(_0x23185b){return{'model':db[_0x23185b['model']],'as':_0x23185b['as'],'attributes':_0x23185b['attributes']};}):[]};}):[]};}):[]:[]})[_0xa729('0x25')](function(_0x5ebd13){logger[_0xa729('0x11')](_0xa729('0x1a'),_0x493b40);logger[_0xa729('0x14')](_0xa729('0x1a'),_0x493b40,JSON[_0xa729('0x26')](_0x5ebd13));_0x2486ab(_0x5ebd13);})['catch'](function(_0x444143){logger['error'](_0xa729('0x1a'),_0x444143[_0xa729('0x18')],_0x493b40);_0x59fbcd(_0xaea05[_0xa729('0x16')](0x1f4,_0x444143[_0xa729('0x18')]));});});};exports[_0xa729('0x27')]=function(_0x4b4f49,_0x4a68b3,_0x188dba){var _0x342028=this;return new Promise(function(_0xc1fcfc,_0x2e040c){var _0x2a485b={'body':_0x4b4f49[_0xa729('0x28')],'channel':'fax'};var _0xbdb1f4=[];var _0x2c4776=[];var _0xdcc5a={};return db['CmContact'][_0xa729('0x29')]()[_0xa729('0x25')](function(_0x8fe91b){if(!_0x8fe91b){throw new db[(_0xa729('0x2a'))][(_0xa729('0x2b'))](_0xa729('0x2c'));}_0xbdb1f4=_[_0xa729('0x2d')](_['keys'](_0x8fe91b),[_0xa729('0x2e'),_0xa729('0x2f')]);_0x2c4776=_[_0xa729('0x2d')](_[_0xa729('0x30')](_0x8fe91b),[_0xa729('0x2e'),_0xa729('0x2f'),'CompanyId',_0xa729('0x31')]);if(_0x4b4f49[_0xa729('0x28')]['id']){delete _0x4b4f49['body']['id'];}if(_['isNil'](_0x4b4f49[_0xa729('0x28')]['from'])){throw new db[(_0xa729('0x2a'))][(_0xa729('0x2b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4b4f49['body'][_0xa729('0x28')])||_0x4b4f49['body'][_0xa729('0x28')]===''){throw new db[(_0xa729('0x2a'))][(_0xa729('0x2b'))](_0xa729('0x32'));}if(_['isNil'](_0x4b4f49[_0xa729('0x28')][_0xa729('0x33')])){throw new db[(_0xa729('0x2a'))]['ValidationError'](_0xa729('0x34')+_0x2c4776);}if(!_[_0xa729('0x35')](_0x2c4776,_0x4b4f49[_0xa729('0x28')][_0xa729('0x33')])){throw new db[(_0xa729('0x2a'))][(_0xa729('0x2b'))](_0xa729('0x36')+_0x2c4776);}_0xdcc5a[_0x4b4f49[_0xa729('0x28')][_0xa729('0x33')]]=_0x4b4f49[_0xa729('0x28')][_0xa729('0x37')];})[_0xa729('0x25')](function(){return db[_0xa729('0x1b')][_0xa729('0x38')]({'where':{'id':_0x4b4f49[_0xa729('0x39')]['id']},'include':[{'model':db[_0xa729('0x3a')],'as':'List','include':[{'model':db[_0xa729('0x3b')],'as':_0xa729('0x3c'),'where':_0xdcc5a,'limit':0x1,'order':[[_0xa729('0x2f'),_0xa729('0x3d')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xa729('0x25')](function(_0x5e24e9){if(_0x5e24e9&&_0x5e24e9[_0xa729('0x3e')]){var _0x4bd5c1=_0x5e24e9[_0xa729('0x3f')]({'plain':!![]});_0x2a485b[_0xa729('0x39')]=_0x4bd5c1;_0x2a485b[_0xa729('0x40')]=_0x4bd5c1['Applications'];_0x2a485b[_0xa729('0x41')]=_0x4bd5c1[_0xa729('0x3e')];_0x2a485b[_0xa729('0x40')]=_[_0xa729('0x42')](_0x2a485b[_0xa729('0x40')],['priority'],[_0xa729('0x43')]);if(_0x2a485b[_0xa729('0x39')][_0xa729('0x44')]){delete _0x2a485b[_0xa729('0x39')][_0xa729('0x44')];}if(_0x2a485b[_0xa729('0x39')]['List']&&_0x2a485b[_0xa729('0x39')]['List'][_0xa729('0x3c')][_0xa729('0x45')]){return _0x2a485b[_0xa729('0x39')][_0xa729('0x3e')][_0xa729('0x3c')][0x0];}var _0x55364c=_[_0xa729('0xb')](_0x4b4f49['body'],{'firstName':_0x4b4f49['body'][_0xa729('0x37')],'ListId':_0x4bd5c1[_0xa729('0x31')]});_0x55364c[_0x4b4f49[_0xa729('0x28')]['mapKey']]=_0x4b4f49[_0xa729('0x28')]['from'];return db[_0xa729('0x3b')][_0xa729('0x46')](_0x55364c,{'fields':_0xbdb1f4,'raw':!![]});}})[_0xa729('0x25')](function(_0x24f93e){_0x2a485b[_0xa729('0x47')]=_0x24f93e;if(_0x24f93e){var _0x3f2296={'ContactId':_0x24f93e['id'],'FaxAccountId':_0x4b4f49[_0xa729('0x39')]['id'],'fax':_0x24f93e[_0xa729('0x48')]};return db[_0xa729('0x49')][_0xa729('0x38')]({'where':{'ContactId':_0x24f93e['id'],'closed':![],'FaxAccountId':_0x4b4f49[_0xa729('0x39')]['id']}})[_0xa729('0x25')](function(_0x3d53c4){if(_0x3d53c4){return[_0x3d53c4,![]];}return db[_0xa729('0x49')][_0xa729('0x46')](_0x3f2296)[_0xa729('0x25')](function(_0x11cf37){return[_0x11cf37,!![]];});});}else{throw new Error(_0xa729('0x4a'));}})[_0xa729('0x4b')](function(_0x54cf7c,_0x140bb0){var _0x3ca391=_0x54cf7c[_0xa729('0x3f')]({'plain':!![]});if(_0x140bb0){if(_0x2a485b[_0xa729('0x39')]['autoclose']){_0x2a485b[_0xa729('0x40')][_0xa729('0x4c')]({'id':0x0,'priority':_0x2a485b[_0xa729('0x40')][_0xa729('0x45')]+0x1,'app':_0xa729('0x4d'),'appdata':_0xa729('0x4e'),'interval':_0xa729('0x4f')});}_0x3ca391[_0xa729('0x50')]=!![];}else{_0x3ca391['created']=![];}_0x2a485b[_0xa729('0x51')]=_0x3ca391;return db[_0xa729('0x52')][_0xa729('0x46')]({'body':_0x4b4f49[_0xa729('0x28')][_0xa729('0x28')],'FaxAccountId':_0x4b4f49['account']['id'],'FaxInteractionId':_0x54cf7c['id'],'direction':'in','ContactId':_0x54cf7c['ContactId'],'AttachmentId':_0x4b4f49[_0xa729('0x28')][_0xa729('0x53')]});})[_0xa729('0x25')](function(_0x54c5b7){_0x2a485b[_0xa729('0x18')]=_0x54c5b7;if(!_0x2a485b[_0xa729('0x51')][_0xa729('0x54')])return;return db['User'][_0xa729('0x38')]({'attributes':['id',_0xa729('0x55')],'where':{'id':_0x2a485b[_0xa729('0x51')]['UserId']}});})[_0xa729('0x25')](function(_0x43c497){if(_0x43c497){_0x2a485b[_0xa729('0x40')][_0xa729('0x56')]({'id':0x0,'priority':0x0,'app':_0xa729('0x57'),'appdata':_0x43c497[_0xa729('0x55')]+','+(_0x2a485b[_0xa729('0x39')][_0xa729('0x58')]||0xa),'interval':_0xa729('0x4f')});}if(!_0x2a485b[_0xa729('0x51')][_0xa729('0x59')])return;return db['FaxQueue'][_0xa729('0x38')]({'attributes':['id','name'],'where':{'id':_0x2a485b[_0xa729('0x51')][_0xa729('0x59')]}});})['then'](function(_0x2d5c0c){if(_0x2d5c0c){_0x2a485b[_0xa729('0x40')][_0xa729('0x56')]({'id':0x0,'priority':0x1,'app':_0xa729('0x5a'),'appdata':_0x2d5c0c[_0xa729('0x55')]+','+(_0x2a485b['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xa729('0x4f')});}return respondWithRpcPromise(_0xa729('0x5b'),_0xa729('0x5c'),_0x2a485b);})[_0xa729('0x25')](function(_0x212aa9){_0xc1fcfc(_0x212aa9);})[_0xa729('0x5d')](function(_0x211161){_0x2e040c(_0x342028[_0xa729('0x16')](0x1f4,_0x211161[_0xa729('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f42d772..dc8b31b 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 _0xf221=['length','faxAccount:','./faxAccount.events','save','remove','emit','register'];(function(_0x36c564,_0x4f73f3){var _0x288a9d=function(_0x90ba3){while(--_0x90ba3){_0x36c564['push'](_0x36c564['shift']());}};_0x288a9d(++_0x4f73f3);}(_0xf221,0xf7));var _0x1f22=function(_0x578ee0,_0x2c9593){_0x578ee0=_0x578ee0-0x0;var _0x507e92=_0xf221[_0x578ee0];return _0x507e92;};'use strict';var FaxAccountEvents=require(_0x1f22('0x0'));var events=[_0x1f22('0x1'),_0x1f22('0x2'),'update'];function createListener(_0x15e914,_0x3ec326){return function(_0x368af6){_0x3ec326[_0x1f22('0x3')](_0x15e914,_0x368af6);};}function removeListener(_0x1687f8,_0xe83cae){return function(){FaxAccountEvents['removeListener'](_0x1687f8,_0xe83cae);};}exports[_0x1f22('0x4')]=function(_0x1c8e08){for(var _0x57ce2f=0x0,_0x122a27=events[_0x1f22('0x5')];_0x57ce2f<_0x122a27;_0x57ce2f++){var _0x28e44d=events[_0x57ce2f];var _0x2fe6ef=createListener(_0x1f22('0x6')+_0x28e44d,_0x1c8e08);FaxAccountEvents['on'](_0x28e44d,_0x2fe6ef);}}; \ No newline at end of file +var _0x14d9=['removeListener','register','length','faxAccount:','./faxAccount.events','remove','update'];(function(_0x58d32a,_0x3a182e){var _0x2b344e=function(_0x766822){while(--_0x766822){_0x58d32a['push'](_0x58d32a['shift']());}};_0x2b344e(++_0x3a182e);}(_0x14d9,0x13f));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x914d('0x0'));var events=['save',_0x914d('0x1'),_0x914d('0x2')];function createListener(_0x273932,_0x324aa4){return function(_0x481756){_0x324aa4['emit'](_0x273932,_0x481756);};}function removeListener(_0x63709d,_0x513c06){return function(){FaxAccountEvents[_0x914d('0x3')](_0x63709d,_0x513c06);};}exports[_0x914d('0x4')]=function(_0x39de85){for(var _0x2dec40=0x0,_0x2635de=events[_0x914d('0x5')];_0x2dec40<_0x2635de;_0x2dec40++){var _0xa77cfc=events[_0x2dec40];var _0x165c5b=createListener(_0x914d('0x6')+_0xa77cfc,_0x39de85);FaxAccountEvents['on'](_0xa77cfc,_0x165c5b);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9427fd1..cd0b447 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 _0x4044=['./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','/:id/dispositions','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc6fb1d,_0x3857c4){var _0x5e903e=function(_0x6f1e84){while(--_0x6f1e84){_0xc6fb1d['push'](_0xc6fb1d['shift']());}};_0x5e903e(++_0x3857c4);}(_0x4044,0xf5));var _0x4404=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4044[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x4404('0x0'));var path=require('path');var timeout=require(_0x4404('0x1'));var express=require('express');var router=express[_0x4404('0x2')]();var fs_extra=require(_0x4404('0x3'));var auth=require(_0x4404('0x4'));var interaction=require(_0x4404('0x5'));var config=require(_0x4404('0x6'));var controller=require(_0x4404('0x7'));router[_0x4404('0x8')]('/',auth[_0x4404('0x9')](),controller[_0x4404('0xa')]);router[_0x4404('0x8')](_0x4404('0xb'),auth[_0x4404('0x9')](),controller['describe']);router[_0x4404('0x8')](_0x4404('0xc'),auth['isAuthenticated'](),controller[_0x4404('0xd')]);router[_0x4404('0x8')]('/:id/dispositions',auth[_0x4404('0x9')](),controller['getDispositions']);router[_0x4404('0x8')](_0x4404('0xe'),auth['isAuthenticated'](),controller[_0x4404('0xf')]);router[_0x4404('0x8')]('/:id/interactions',auth[_0x4404('0x9')](),controller[_0x4404('0x10')]);router[_0x4404('0x8')]('/:id/applications',auth[_0x4404('0x9')](),controller[_0x4404('0x11')]);router[_0x4404('0x8')](_0x4404('0x12'),auth[_0x4404('0x9')](),controller[_0x4404('0x13')]);router[_0x4404('0x8')](_0x4404('0x14'),auth[_0x4404('0x9')](),controller[_0x4404('0x15')]);router[_0x4404('0x16')]('/',auth[_0x4404('0x9')](),controller['create']);router[_0x4404('0x16')](_0x4404('0x17'),auth[_0x4404('0x9')](),controller['addDisposition']);router[_0x4404('0x16')](_0x4404('0xe'),auth[_0x4404('0x9')](),controller[_0x4404('0x18')]);router['post'](_0x4404('0x19'),auth[_0x4404('0x9')](),controller[_0x4404('0x1a')]);router[_0x4404('0x16')](_0x4404('0x1b'),auth['isAuthenticated'](),controller[_0x4404('0x1c')]);router[_0x4404('0x16')](_0x4404('0x1d'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x4404('0x16')](_0x4404('0x1e'),auth['isAuthenticated'](),controller[_0x4404('0x1f')]);router[_0x4404('0x16')](_0x4404('0x20'),auth[_0x4404('0x9')](),controller[_0x4404('0x21')]);router[_0x4404('0x16')](_0x4404('0x14'),auth[_0x4404('0x9')](),controller[_0x4404('0x22')]);router[_0x4404('0x23')](_0x4404('0xc'),auth[_0x4404('0x9')](),controller['update']);router[_0x4404('0x24')]('/:id',auth[_0x4404('0x9')](),controller[_0x4404('0x25')]);router['delete']('/:id/dispositions',auth[_0x4404('0x9')](),controller[_0x4404('0x26')]);router['delete'](_0x4404('0xe'),auth[_0x4404('0x9')](),controller[_0x4404('0x27')]);router[_0x4404('0x24')](_0x4404('0x14'),auth[_0x4404('0x9')](),controller[_0x4404('0x28')]);module[_0x4404('0x29')]=router; \ No newline at end of file +var _0xfe14=['multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','/:id/users','exports'];(function(_0x19039c,_0x14edfe){var _0xd7f1cb=function(_0x4556bf){while(--_0x4556bf){_0x19039c['push'](_0x19039c['shift']());}};_0xd7f1cb(++_0x14edfe);}(_0xfe14,0xf5));var _0x4fe1=function(_0x48f4c5,_0x56e4c3){_0x48f4c5=_0x48f4c5-0x0;var _0x40ab65=_0xfe14[_0x48f4c5];return _0x40ab65;};'use strict';var multer=require(_0x4fe1('0x0'));var util=require(_0x4fe1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4fe1('0x2'));var router=express[_0x4fe1('0x3')]();var fs_extra=require(_0x4fe1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4fe1('0x5'));var config=require(_0x4fe1('0x6'));var controller=require('./faxAccount.controller');router[_0x4fe1('0x7')]('/',auth[_0x4fe1('0x8')](),controller['index']);router[_0x4fe1('0x7')](_0x4fe1('0x9'),auth[_0x4fe1('0x8')](),controller[_0x4fe1('0xa')]);router[_0x4fe1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4fe1('0xb')]);router[_0x4fe1('0x7')](_0x4fe1('0xc'),auth[_0x4fe1('0x8')](),controller[_0x4fe1('0xd')]);router[_0x4fe1('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4fe1('0xe')]);router['get'](_0x4fe1('0xf'),auth[_0x4fe1('0x8')](),controller[_0x4fe1('0x10')]);router[_0x4fe1('0x7')](_0x4fe1('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0x4fe1('0x7')]('/:id/messages',auth[_0x4fe1('0x8')](),controller['getMessages']);router[_0x4fe1('0x7')]('/:id/users',auth[_0x4fe1('0x8')](),controller['getAgents']);router[_0x4fe1('0x12')]('/',auth['isAuthenticated'](),controller[_0x4fe1('0x13')]);router[_0x4fe1('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4fe1('0x14')]);router[_0x4fe1('0x12')](_0x4fe1('0x15'),auth[_0x4fe1('0x8')](),controller[_0x4fe1('0x16')]);router['post'](_0x4fe1('0xf'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x4fe1('0x12')]('/:id/applications',auth[_0x4fe1('0x8')](),controller['addApplications']);router[_0x4fe1('0x12')](_0x4fe1('0x17'),auth[_0x4fe1('0x8')](),controller[_0x4fe1('0x18')]);router[_0x4fe1('0x12')](_0x4fe1('0x19'),auth[_0x4fe1('0x8')](),controller['updateAccountApplications']);router[_0x4fe1('0x12')](_0x4fe1('0x1a'),auth['isAuthenticated'](),controller[_0x4fe1('0x1b')]);router[_0x4fe1('0x12')]('/:id/users',auth[_0x4fe1('0x8')](),controller[_0x4fe1('0x1c')]);router[_0x4fe1('0x1d')]('/:id',auth[_0x4fe1('0x8')](),controller[_0x4fe1('0x1e')]);router[_0x4fe1('0x1f')]('/:id',auth[_0x4fe1('0x8')](),controller['destroy']);router['delete'](_0x4fe1('0xc'),auth[_0x4fe1('0x8')](),controller['removeDispositions']);router['delete'](_0x4fe1('0x15'),auth['isAuthenticated'](),controller[_0x4fe1('0x20')]);router[_0x4fe1('0x1f')](_0x4fe1('0x21'),auth[_0x4fe1('0x8')](),controller['removeAgents']);module[_0x4fe1('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e2f4f80..134afe4 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 _0xb418=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x3d5eb1,_0x263e19){var _0x2403bb=function(_0x155048){while(--_0x155048){_0x3d5eb1['push'](_0x3d5eb1['shift']());}};_0x2403bb(++_0x263e19);}(_0xb418,0x14d));var _0x8b41=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb418[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0x8b41('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8b41('0x1')],'allowNull':![],'defaultValue':_0x8b41('0x2')},'appdata':{'type':Sequelize[_0x8b41('0x3')]()},'description':{'type':Sequelize[_0x8b41('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8b41('0x4')}}; \ No newline at end of file +var _0x0568=['STRING','noop','TEXT','sequelize','exports'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x0568,0xee));var _0x8056=function(_0x2ef95d,_0x5847ed){_0x2ef95d=_0x2ef95d-0x0;var _0x745497=_0x0568[_0x2ef95d];return _0x745497;};'use strict';var Sequelize=require(_0x8056('0x0'));module[_0x8056('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8056('0x2')],'allowNull':![],'defaultValue':_0x8056('0x3')},'appdata':{'type':Sequelize[_0x8056('0x4')]()},'description':{'type':Sequelize[_0x8056('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0e158f9..4a96163 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 _0x65ff=['reject','update','then','destroy','stack','name','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','merge','VIRTUAL','filter','options','FaxApplication','includeAll','findAll','catch','show','params','include','find','create','body','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x99b454,_0x328020){var _0x5e9b1d=function(_0x4e7ab2){while(--_0x4e7ab2){_0x99b454['push'](_0x99b454['shift']());}};_0x5e9b1d(++_0x328020);}(_0x65ff,0x1bd));var _0xf65f=function(_0x44881b,_0x541447){_0x44881b=_0x44881b-0x0;var _0x59b5cf=_0x65ff[_0x44881b];return _0x59b5cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf65f('0x0'));var jsonpatch=require(_0xf65f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf65f('0x2'));var Mustache=require('mustache');var util=require(_0xf65f('0x3'));var path=require(_0xf65f('0x4'));var sox=require(_0xf65f('0x5'));var csv=require(_0xf65f('0x6'));var ejs=require(_0xf65f('0x7'));var fs=require('fs');var fs_extra=require(_0xf65f('0x8'));var _=require('lodash');var squel=require(_0xf65f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf65f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf65f('0xb'));var Papa=require(_0xf65f('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf65f('0xd'));var as=require(_0xf65f('0xe'));var hardwareService=require(_0xf65f('0xf'));var logger=require(_0xf65f('0x10'))(_0xf65f('0x11'));var utils=require(_0xf65f('0x12'));var config=require(_0xf65f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6ab3f,_0x1050fe){_0x1050fe=_0x1050fe||0xcc;return function(_0x2f8d0f){if(_0x2f8d0f){return _0xa6ab3f[_0xf65f('0x14')](_0x1050fe);}return _0xa6ab3f[_0xf65f('0x15')](_0x1050fe)[_0xf65f('0x16')]();};}function respondWithResult(_0x1ce8e5,_0x45cef2){_0x45cef2=_0x45cef2||0xc8;return function(_0x211e41){if(_0x211e41){return _0x1ce8e5['status'](_0x45cef2)[_0xf65f('0x17')](_0x211e41);}};}function respondWithFilteredResult(_0x1c6632,_0x34ccdc){return function(_0x464e67){if(_0x464e67){var _0x14bf8d=typeof _0x34ccdc[_0xf65f('0x18')]===_0xf65f('0x19')&&typeof _0x34ccdc['limit']===_0xf65f('0x19');var _0x33f7ae=_0x464e67[_0xf65f('0x1a')];var _0x655874=_0x14bf8d?0x0:_0x34ccdc[_0xf65f('0x18')];var _0x38cf8c=_0x14bf8d?_0x464e67[_0xf65f('0x1a')]:_0x34ccdc[_0xf65f('0x18')]+_0x34ccdc[_0xf65f('0x1b')];var _0x5ed8cf;if(_0x38cf8c>=_0x33f7ae){_0x38cf8c=_0x33f7ae;_0x5ed8cf=0xc8;}else{_0x5ed8cf=0xce;}_0x1c6632['status'](_0x5ed8cf);return _0x1c6632[_0xf65f('0x1c')](_0xf65f('0x1d'),_0x655874+'-'+_0x38cf8c+'/'+_0x33f7ae)[_0xf65f('0x17')](_0x464e67);}return null;};}function patchUpdates(_0x22c2fa){return function(_0x1655ac){try{jsonpatch[_0xf65f('0x1e')](_0x1655ac,_0x22c2fa,!![]);}catch(_0x269736){return BPromise[_0xf65f('0x1f')](_0x269736);}return _0x1655ac['save']();};}function saveUpdates(_0x199dee,_0x2b3a4e){return function(_0x5804b2){if(_0x5804b2){return _0x5804b2[_0xf65f('0x20')](_0x199dee)[_0xf65f('0x21')](function(_0x53f1cb){return _0x53f1cb;});}return null;};}function removeEntity(_0x5d0e12,_0x14d462){return function(_0x5b29d1){if(_0x5b29d1){return _0x5b29d1[_0xf65f('0x22')]()[_0xf65f('0x21')](function(){_0x5d0e12[_0xf65f('0x15')](0xcc)[_0xf65f('0x16')]();});}};}function handleEntityNotFound(_0x2b7474,_0x3ce88a){return function(_0x41326e){if(!_0x41326e){_0x2b7474[_0xf65f('0x14')](0x194);}return _0x41326e;};}function handleError(_0x50fa08,_0x393ca8){_0x393ca8=_0x393ca8||0x1f4;return function(_0x54f693){logger['error'](_0x54f693[_0xf65f('0x23')]);if(_0x54f693[_0xf65f('0x24')]){delete _0x54f693[_0xf65f('0x24')];}_0x50fa08[_0xf65f('0x15')](_0x393ca8)['send'](_0x54f693);};}exports['index']=function(_0xf67fb0,_0x2bd81f){var _0x72974={},_0xdaaa7c={},_0x399794={'count':0x0,'rows':[]};var _0x555f23=_[_0xf65f('0x25')](db['FaxApplication'][_0xf65f('0x26')],function(_0x34c50d){return{'name':_0x34c50d['fieldName'],'type':_0x34c50d[_0xf65f('0x27')][_0xf65f('0x28')]};});_0xdaaa7c[_0xf65f('0x29')]=_[_0xf65f('0x25')](_0x555f23,_0xf65f('0x24'));_0xdaaa7c[_0xf65f('0x2a')]=_[_0xf65f('0x2b')](_0xf67fb0[_0xf65f('0x2a')]);_0xdaaa7c['filters']=_[_0xf65f('0x2c')](_0xdaaa7c[_0xf65f('0x29')],_0xdaaa7c[_0xf65f('0x2a')]);_0x72974['attributes']=_['intersection'](_0xdaaa7c[_0xf65f('0x29')],qs[_0xf65f('0x2d')](_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x2d')]));_0x72974[_0xf65f('0x2e')]=_0x72974[_0xf65f('0x2e')][_0xf65f('0x2f')]?_0x72974[_0xf65f('0x2e')]:_0xdaaa7c[_0xf65f('0x29')];if(!_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x30')](_0xf65f('0x31'))){_0x72974[_0xf65f('0x1b')]=qs['limit'](_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x1b')]);_0x72974['offset']=qs[_0xf65f('0x18')](_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x18')]);}_0x72974[_0xf65f('0x32')]=qs['sort'](_0xf67fb0[_0xf65f('0x2a')]['sort']);_0x72974[_0xf65f('0x33')]=qs['filters'](_[_0xf65f('0x34')](_0xf67fb0[_0xf65f('0x2a')],_0xdaaa7c[_0xf65f('0x35')]),_0x555f23);if(_0xf67fb0[_0xf65f('0x2a')]['filter']){_0x72974[_0xf65f('0x33')]=_[_0xf65f('0x36')](_0x72974[_0xf65f('0x33')],{'$or':_[_0xf65f('0x25')](_0x555f23,function(_0x279d02){if(_0x279d02[_0xf65f('0x27')]!==_0xf65f('0x37')){var _0x2d9e3b={};_0x2d9e3b[_0x279d02[_0xf65f('0x24')]]={'$like':'%'+_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x38')]+'%'};return _0x2d9e3b;}})});}_0x72974=_[_0xf65f('0x36')]({},_0x72974,_0xf67fb0[_0xf65f('0x39')]);var _0x241b22={'where':_0x72974[_0xf65f('0x33')]};return db[_0xf65f('0x3a')][_0xf65f('0x1a')](_0x241b22)['then'](function(_0x3c9f9f){_0x399794['count']=_0x3c9f9f;if(_0xf67fb0[_0xf65f('0x2a')][_0xf65f('0x3b')]){_0x72974['include']=[{'all':!![]}];}return db[_0xf65f('0x3a')][_0xf65f('0x3c')](_0x72974);})['then'](function(_0x998f58){_0x399794['rows']=_0x998f58;return _0x399794;})[_0xf65f('0x21')](respondWithFilteredResult(_0x2bd81f,_0x72974))[_0xf65f('0x3d')](handleError(_0x2bd81f,null));};exports[_0xf65f('0x3e')]=function(_0x6887e,_0x19bfe7){var _0x316500={'raw':!![],'where':{'id':_0x6887e[_0xf65f('0x3f')]['id']}},_0x38f439={};_0x38f439[_0xf65f('0x29')]=_['keys'](db[_0xf65f('0x3a')]['rawAttributes']);_0x38f439[_0xf65f('0x2a')]=_[_0xf65f('0x2b')](_0x6887e[_0xf65f('0x2a')]);_0x38f439[_0xf65f('0x35')]=_['intersection'](_0x38f439[_0xf65f('0x29')],_0x38f439[_0xf65f('0x2a')]);_0x316500['attributes']=_['intersection'](_0x38f439[_0xf65f('0x29')],qs[_0xf65f('0x2d')](_0x6887e[_0xf65f('0x2a')]['fields']));_0x316500['attributes']=_0x316500[_0xf65f('0x2e')][_0xf65f('0x2f')]?_0x316500[_0xf65f('0x2e')]:_0x38f439[_0xf65f('0x29')];if(_0x6887e[_0xf65f('0x2a')][_0xf65f('0x3b')]){_0x316500[_0xf65f('0x40')]=[{'all':!![]}];}_0x316500=_[_0xf65f('0x36')]({},_0x316500,_0x6887e[_0xf65f('0x39')]);return db[_0xf65f('0x3a')][_0xf65f('0x41')](_0x316500)[_0xf65f('0x21')](handleEntityNotFound(_0x19bfe7,null))['then'](respondWithResult(_0x19bfe7,null))[_0xf65f('0x3d')](handleError(_0x19bfe7,null));};exports[_0xf65f('0x42')]=function(_0x10d855,_0x3b4a7c){return db[_0xf65f('0x3a')]['create'](_0x10d855[_0xf65f('0x43')],{})[_0xf65f('0x21')](respondWithResult(_0x3b4a7c,0xc9))['catch'](handleError(_0x3b4a7c,null));};exports[_0xf65f('0x20')]=function(_0x162a44,_0x5358ec){if(_0x162a44['body']['id']){delete _0x162a44[_0xf65f('0x43')]['id'];}return db[_0xf65f('0x3a')][_0xf65f('0x41')]({'where':{'id':_0x162a44[_0xf65f('0x3f')]['id']}})[_0xf65f('0x21')](handleEntityNotFound(_0x5358ec,null))[_0xf65f('0x21')](saveUpdates(_0x162a44[_0xf65f('0x43')],null))[_0xf65f('0x21')](respondWithResult(_0x5358ec,null))['catch'](handleError(_0x5358ec,null));};exports[_0xf65f('0x22')]=function(_0x4ecbd0,_0x148836){return db[_0xf65f('0x3a')][_0xf65f('0x41')]({'where':{'id':_0x4ecbd0[_0xf65f('0x3f')]['id']}})[_0xf65f('0x21')](handleEntityNotFound(_0x148836,null))[_0xf65f('0x21')](removeEntity(_0x148836,null))[_0xf65f('0x3d')](handleError(_0x148836,null));}; \ No newline at end of file +var _0x1b05=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxApplication','then','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','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','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters'];(function(_0x5f2e4e,_0x30bf78){var _0x17689b=function(_0x416ebf){while(--_0x416ebf){_0x5f2e4e['push'](_0x5f2e4e['shift']());}};_0x17689b(++_0x30bf78);}(_0x1b05,0x1ca));var _0x51b0=function(_0x539f02,_0x2f7052){_0x539f02=_0x539f02-0x0;var _0x3520d9=_0x1b05[_0x539f02];return _0x3520d9;};'use strict';var emlformat=require(_0x51b0('0x0'));var rimraf=require(_0x51b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51b0('0x2'));var rp=require(_0x51b0('0x3'));var moment=require(_0x51b0('0x4'));var BPromise=require(_0x51b0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x51b0('0x6'));var csv=require(_0x51b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51b0('0x8'));var squel=require(_0x51b0('0x9'));var crypto=require(_0x51b0('0xa'));var jsforce=require(_0x51b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x51b0('0x7'));var querystring=require(_0x51b0('0xc'));var Papa=require(_0x51b0('0xd'));var Redis=require('ioredis');var authService=require(_0x51b0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x51b0('0xf'));var hardwareService=require(_0x51b0('0x10'));var logger=require(_0x51b0('0x11'))('api');var utils=require(_0x51b0('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x51b0('0x13'));var db=require(_0x51b0('0x14'))['db'];function respondWithStatusCode(_0x380d0b,_0x30f6e5){_0x30f6e5=_0x30f6e5||0xcc;return function(_0x57d479){if(_0x57d479){return _0x380d0b[_0x51b0('0x15')](_0x30f6e5);}return _0x380d0b[_0x51b0('0x16')](_0x30f6e5)[_0x51b0('0x17')]();};}function respondWithResult(_0x52b689,_0x712750){_0x712750=_0x712750||0xc8;return function(_0x4a1e95){if(_0x4a1e95){return _0x52b689[_0x51b0('0x16')](_0x712750)[_0x51b0('0x18')](_0x4a1e95);}};}function respondWithFilteredResult(_0x33f4a9,_0x4f5d0b){return function(_0x30f3f2){if(_0x30f3f2){var _0x2d8803=typeof _0x4f5d0b[_0x51b0('0x19')]===_0x51b0('0x1a')&&typeof _0x4f5d0b[_0x51b0('0x1b')]===_0x51b0('0x1a');var _0x8a224b=_0x30f3f2[_0x51b0('0x1c')];var _0x5148d8=_0x2d8803?0x0:_0x4f5d0b['offset'];var _0x5b6452=_0x2d8803?_0x30f3f2[_0x51b0('0x1c')]:_0x4f5d0b[_0x51b0('0x19')]+_0x4f5d0b[_0x51b0('0x1b')];var _0x133a26;if(_0x5b6452>=_0x8a224b){_0x5b6452=_0x8a224b;_0x133a26=0xc8;}else{_0x133a26=0xce;}_0x33f4a9['status'](_0x133a26);return _0x33f4a9[_0x51b0('0x1d')](_0x51b0('0x1e'),_0x5148d8+'-'+_0x5b6452+'/'+_0x8a224b)[_0x51b0('0x18')](_0x30f3f2);}return null;};}function patchUpdates(_0x2830d5){return function(_0x1bb99a){try{jsonpatch[_0x51b0('0x1f')](_0x1bb99a,_0x2830d5,!![]);}catch(_0x75fe72){return BPromise[_0x51b0('0x20')](_0x75fe72);}return _0x1bb99a['save']();};}function saveUpdates(_0x33199a,_0x2860c2){return function(_0xc8113f){if(_0xc8113f){return _0xc8113f[_0x51b0('0x21')](_0x33199a)['then'](function(_0x2bb730){return _0x2bb730;});}return null;};}function removeEntity(_0x571a57,_0x51de28){return function(_0x4a0564){if(_0x4a0564){return _0x4a0564[_0x51b0('0x22')]()['then'](function(){_0x571a57[_0x51b0('0x16')](0xcc)[_0x51b0('0x17')]();});}};}function handleEntityNotFound(_0x246041,_0x20580c){return function(_0x219a10){if(!_0x219a10){_0x246041['sendStatus'](0x194);}return _0x219a10;};}function handleError(_0x49f28d,_0x18dc00){_0x18dc00=_0x18dc00||0x1f4;return function(_0x52a483){logger[_0x51b0('0x23')](_0x52a483[_0x51b0('0x24')]);if(_0x52a483['name']){delete _0x52a483[_0x51b0('0x25')];}_0x49f28d['status'](_0x18dc00)[_0x51b0('0x26')](_0x52a483);};}exports[_0x51b0('0x27')]=function(_0x34ae66,_0x4179fe){var _0x5ee3c5={},_0x159981={},_0x4bd8ec={'count':0x0,'rows':[]};var _0x3f3a28=_[_0x51b0('0x28')](db['FaxApplication']['rawAttributes'],function(_0x4dc4c2){return{'name':_0x4dc4c2[_0x51b0('0x29')],'type':_0x4dc4c2[_0x51b0('0x2a')]['key']};});_0x159981['model']=_['map'](_0x3f3a28,_0x51b0('0x25'));_0x159981[_0x51b0('0x2b')]=_[_0x51b0('0x2c')](_0x34ae66[_0x51b0('0x2b')]);_0x159981[_0x51b0('0x2d')]=_[_0x51b0('0x2e')](_0x159981[_0x51b0('0x2f')],_0x159981[_0x51b0('0x2b')]);_0x5ee3c5[_0x51b0('0x30')]=_[_0x51b0('0x2e')](_0x159981[_0x51b0('0x2f')],qs[_0x51b0('0x31')](_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x31')]));_0x5ee3c5[_0x51b0('0x30')]=_0x5ee3c5['attributes'][_0x51b0('0x32')]?_0x5ee3c5['attributes']:_0x159981[_0x51b0('0x2f')];if(!_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x33')](_0x51b0('0x34'))){_0x5ee3c5[_0x51b0('0x1b')]=qs['limit'](_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x1b')]);_0x5ee3c5['offset']=qs[_0x51b0('0x19')](_0x34ae66[_0x51b0('0x2b')]['offset']);}_0x5ee3c5[_0x51b0('0x35')]=qs[_0x51b0('0x36')](_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x36')]);_0x5ee3c5[_0x51b0('0x37')]=qs[_0x51b0('0x2d')](_['pick'](_0x34ae66[_0x51b0('0x2b')],_0x159981['filters']),_0x3f3a28);if(_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x38')]){_0x5ee3c5[_0x51b0('0x37')]=_[_0x51b0('0x39')](_0x5ee3c5['where'],{'$or':_[_0x51b0('0x28')](_0x3f3a28,function(_0x8f4ba3){if(_0x8f4ba3[_0x51b0('0x2a')]!==_0x51b0('0x3a')){var _0x45e03d={};_0x45e03d[_0x8f4ba3[_0x51b0('0x25')]]={'$like':'%'+_0x34ae66[_0x51b0('0x2b')][_0x51b0('0x38')]+'%'};return _0x45e03d;}})});}_0x5ee3c5=_['merge']({},_0x5ee3c5,_0x34ae66[_0x51b0('0x3b')]);var _0x4077b2={'where':_0x5ee3c5['where']};return db[_0x51b0('0x3c')]['count'](_0x4077b2)['then'](function(_0x47a453){_0x4bd8ec[_0x51b0('0x1c')]=_0x47a453;if(_0x34ae66[_0x51b0('0x2b')]['includeAll']){_0x5ee3c5['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5ee3c5);})[_0x51b0('0x3d')](function(_0x5a1b22){_0x4bd8ec[_0x51b0('0x3e')]=_0x5a1b22;return _0x4bd8ec;})[_0x51b0('0x3d')](respondWithFilteredResult(_0x4179fe,_0x5ee3c5))[_0x51b0('0x3f')](handleError(_0x4179fe,null));};exports[_0x51b0('0x40')]=function(_0x2fb780,_0x540fab){var _0x55ae62={'raw':!![],'where':{'id':_0x2fb780[_0x51b0('0x41')]['id']}},_0x2b621e={};_0x2b621e[_0x51b0('0x2f')]=_[_0x51b0('0x2c')](db[_0x51b0('0x3c')][_0x51b0('0x42')]);_0x2b621e[_0x51b0('0x2b')]=_[_0x51b0('0x2c')](_0x2fb780[_0x51b0('0x2b')]);_0x2b621e[_0x51b0('0x2d')]=_[_0x51b0('0x2e')](_0x2b621e[_0x51b0('0x2f')],_0x2b621e['query']);_0x55ae62['attributes']=_['intersection'](_0x2b621e[_0x51b0('0x2f')],qs['fields'](_0x2fb780[_0x51b0('0x2b')]['fields']));_0x55ae62[_0x51b0('0x30')]=_0x55ae62[_0x51b0('0x30')][_0x51b0('0x32')]?_0x55ae62[_0x51b0('0x30')]:_0x2b621e[_0x51b0('0x2f')];if(_0x2fb780[_0x51b0('0x2b')][_0x51b0('0x43')]){_0x55ae62[_0x51b0('0x44')]=[{'all':!![]}];}_0x55ae62=_[_0x51b0('0x39')]({},_0x55ae62,_0x2fb780[_0x51b0('0x3b')]);return db[_0x51b0('0x3c')][_0x51b0('0x45')](_0x55ae62)['then'](handleEntityNotFound(_0x540fab,null))[_0x51b0('0x3d')](respondWithResult(_0x540fab,null))[_0x51b0('0x3f')](handleError(_0x540fab,null));};exports[_0x51b0('0x46')]=function(_0x34c07a,_0x19aaa7){return db[_0x51b0('0x3c')][_0x51b0('0x46')](_0x34c07a['body'],{})[_0x51b0('0x3d')](respondWithResult(_0x19aaa7,0xc9))['catch'](handleError(_0x19aaa7,null));};exports[_0x51b0('0x21')]=function(_0x2e7f23,_0x44613c){if(_0x2e7f23[_0x51b0('0x47')]['id']){delete _0x2e7f23[_0x51b0('0x47')]['id'];}return db[_0x51b0('0x3c')]['find']({'where':{'id':_0x2e7f23[_0x51b0('0x41')]['id']}})[_0x51b0('0x3d')](handleEntityNotFound(_0x44613c,null))['then'](saveUpdates(_0x2e7f23['body'],null))[_0x51b0('0x3d')](respondWithResult(_0x44613c,null))['catch'](handleError(_0x44613c,null));};exports[_0x51b0('0x22')]=function(_0x5dbec1,_0x355619){return db[_0x51b0('0x3c')][_0x51b0('0x45')]({'where':{'id':_0x5dbec1[_0x51b0('0x41')]['id']}})[_0x51b0('0x3d')](handleEntityNotFound(_0x355619,null))[_0x51b0('0x3d')](removeEntity(_0x355619,null))[_0x51b0('0x3f')](handleError(_0x355619,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 8c7c2cf..6668195 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 _0x533a=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','define','FaxApplication'];(function(_0x305374,_0x394533){var _0x599932=function(_0x5cd734){while(--_0x5cd734){_0x305374['push'](_0x305374['shift']());}};_0x599932(++_0x394533);}(_0x533a,0x18d));var _0xa533=function(_0x4aa285,_0x1fe00d){_0x4aa285=_0x4aa285-0x0;var _0x2777ee=_0x533a[_0x4aa285];return _0x2777ee;};'use strict';var _=require(_0xa533('0x0'));var util=require(_0xa533('0x1'));var logger=require(_0xa533('0x2'))(_0xa533('0x3'));var moment=require(_0xa533('0x4'));var BPromise=require(_0xa533('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa533('0x6'));var rimraf=require('rimraf');var config=require(_0xa533('0x7'));var attributes=require(_0xa533('0x8'));module['exports']=function(_0x5b8568,_0x4591ff){return _0x5b8568[_0xa533('0x9')](_0xa533('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa533('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xad1e=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x5be1d6,_0x52ab2a){var _0x5d9bd4=function(_0x4f05ba){while(--_0x4f05ba){_0x5be1d6['push'](_0x5be1d6['shift']());}};_0x5d9bd4(++_0x52ab2a);}(_0xad1e,0x1bc));var _0xead1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xad1e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xead1('0x0'));var util=require('util');var logger=require(_0xead1('0x1'))(_0xead1('0x2'));var moment=require(_0xead1('0x3'));var BPromise=require(_0xead1('0x4'));var rp=require(_0xead1('0x5'));var fs=require('fs');var path=require(_0xead1('0x6'));var rimraf=require(_0xead1('0x7'));var config=require(_0xead1('0x8'));var attributes=require(_0xead1('0x9'));module['exports']=function(_0x16fecf,_0x17e13e){return _0x16fecf[_0xead1('0xa')]('FaxApplication',attributes,{'tableName':_0xead1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xead1('0xc'),'collate':_0xead1('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f54ea6a..581e884 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 _0x5730=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','debug','lodash','randomstring','ioredis'];(function(_0x38605b,_0x590c0d){var _0x2ad9ad=function(_0x4589ef){while(--_0x4589ef){_0x38605b['push'](_0x38605b['shift']());}};_0x2ad9ad(++_0x590c0d);}(_0x5730,0xd5));var _0x0573=function(_0x21319f,_0x36cc4b){_0x21319f=_0x21319f-0x0;var _0x4c7b23=_0x5730[_0x21319f];return _0x4c7b23;};'use strict';var _=require(_0x0573('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0573('0x1'));var fs=require('fs');var Redis=require(_0x0573('0x2'));var db=require(_0x0573('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0573('0x4'));var config=require(_0x0573('0x5'));var jayson=require(_0x0573('0x6'));var client=jayson['client'][_0x0573('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55a0a4,_0x261054,_0x275ca9){return new BPromise(function(_0x41b0a6,_0x1aec3f){return client['request'](_0x55a0a4,_0x275ca9)[_0x0573('0x8')](function(_0x5c639f){logger[_0x0573('0x9')](_0x0573('0xa'),_0x261054,_0x0573('0xb'));logger['debug'](_0x0573('0xc'),_0x261054,_0x0573('0xb'),JSON[_0x0573('0xd')](_0x5c639f));if(_0x5c639f[_0x0573('0xe')]){if(_0x5c639f[_0x0573('0xe')][_0x0573('0xf')]===0x1f4){logger[_0x0573('0xe')](_0x0573('0xa'),_0x261054,_0x5c639f[_0x0573('0xe')][_0x0573('0x10')]);return _0x1aec3f(_0x5c639f['error']['message']);}logger[_0x0573('0xe')](_0x0573('0xa'),_0x261054,_0x5c639f[_0x0573('0xe')][_0x0573('0x10')]);return _0x41b0a6(_0x5c639f[_0x0573('0xe')][_0x0573('0x10')]);}else{logger[_0x0573('0x9')]('FaxApplication,\x20%s,\x20%s',_0x261054,_0x0573('0xb'));_0x41b0a6(_0x5c639f[_0x0573('0x11')][_0x0573('0x10')]);}})[_0x0573('0x12')](function(_0x547f64){logger['error'](_0x0573('0xa'),_0x261054,_0x547f64);_0x1aec3f(_0x547f64);});});}exports[_0x0573('0x13')]=function(_0x3aa207){var _0x46059c=this;return new Promise(function(_0x346f5b,_0x26fd74){return db[_0x0573('0x14')]['update'](_0x3aa207['body'],{'raw':_0x3aa207[_0x0573('0x15')]?_0x3aa207[_0x0573('0x15')][_0x0573('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa207[_0x0573('0x15')]?_0x3aa207[_0x0573('0x15')][_0x0573('0x17')]||null:null,'attributes':_0x3aa207[_0x0573('0x15')]?_0x3aa207[_0x0573('0x15')][_0x0573('0x18')]||null:null,'limit':_0x3aa207[_0x0573('0x15')]?_0x3aa207[_0x0573('0x15')][_0x0573('0x19')]||null:null})[_0x0573('0x8')](function(_0x4f0d8c){logger[_0x0573('0x9')](_0x0573('0x13'),_0x3aa207);logger[_0x0573('0x1a')]('UpdateFaxApplication',_0x3aa207,JSON[_0x0573('0xd')](_0x4f0d8c));_0x346f5b(_0x4f0d8c);})[_0x0573('0x12')](function(_0xfe0f02){logger[_0x0573('0xe')]('UpdateFaxApplication',_0xfe0f02['message'],_0x3aa207);_0x26fd74(_0x46059c[_0x0573('0xe')](0x1f4,_0xfe0f02[_0x0573('0x10')]));});});}; \ No newline at end of file +var _0x2678=['message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b1c92,_0x1cbbf7){var _0x2c0c4a=function(_0x4effbb){while(--_0x4effbb){_0x5b1c92['push'](_0x5b1c92['shift']());}};_0x2c0c4a(++_0x1cbbf7);}(_0x2678,0x11d));var _0x8267=function(_0x3600be,_0x249fd6){_0x3600be=_0x3600be-0x0;var _0x26044a=_0x2678[_0x3600be];return _0x26044a;};'use strict';var _=require(_0x8267('0x0'));var util=require('util');var moment=require(_0x8267('0x1'));var BPromise=require(_0x8267('0x2'));var rs=require(_0x8267('0x3'));var fs=require('fs');var Redis=require(_0x8267('0x4'));var db=require(_0x8267('0x5'))['db'];var utils=require(_0x8267('0x6'));var logger=require(_0x8267('0x7'))(_0x8267('0x8'));var config=require('../../config/environment');var jayson=require(_0x8267('0x9'));var client=jayson[_0x8267('0xa')][_0x8267('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d322a,_0x4b1cdf,_0x2594b2){return new BPromise(function(_0x5ed8b0,_0x59e7f0){return client[_0x8267('0xc')](_0x1d322a,_0x2594b2)['then'](function(_0x59e687){logger[_0x8267('0xd')](_0x8267('0xe'),_0x4b1cdf,_0x8267('0xf'));logger[_0x8267('0x10')](_0x8267('0x11'),_0x4b1cdf,_0x8267('0xf'),JSON[_0x8267('0x12')](_0x59e687));if(_0x59e687[_0x8267('0x13')]){if(_0x59e687[_0x8267('0x13')][_0x8267('0x14')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b1cdf,_0x59e687['error'][_0x8267('0x15')]);return _0x59e7f0(_0x59e687[_0x8267('0x13')][_0x8267('0x15')]);}logger[_0x8267('0x13')](_0x8267('0xe'),_0x4b1cdf,_0x59e687['error'][_0x8267('0x15')]);return _0x5ed8b0(_0x59e687[_0x8267('0x13')][_0x8267('0x15')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x4b1cdf,_0x8267('0xf'));_0x5ed8b0(_0x59e687[_0x8267('0x16')][_0x8267('0x15')]);}})[_0x8267('0x17')](function(_0x3e67e2){logger[_0x8267('0x13')]('FaxApplication,\x20%s,\x20%s',_0x4b1cdf,_0x3e67e2);_0x59e7f0(_0x3e67e2);});});}exports[_0x8267('0x18')]=function(_0x19ddcb){var _0x3d331c=this;return new Promise(function(_0x3c9477,_0xfa957b){return db[_0x8267('0x19')][_0x8267('0x1a')](_0x19ddcb[_0x8267('0x1b')],{'raw':_0x19ddcb[_0x8267('0x1c')]?_0x19ddcb[_0x8267('0x1c')][_0x8267('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ddcb[_0x8267('0x1c')]?_0x19ddcb[_0x8267('0x1c')][_0x8267('0x1e')]||null:null,'attributes':_0x19ddcb[_0x8267('0x1c')]?_0x19ddcb['options'][_0x8267('0x1f')]||null:null,'limit':_0x19ddcb['options']?_0x19ddcb[_0x8267('0x1c')][_0x8267('0x20')]||null:null})[_0x8267('0x21')](function(_0x3d0458){logger['info'](_0x8267('0x18'),_0x19ddcb);logger[_0x8267('0x10')](_0x8267('0x18'),_0x19ddcb,JSON['stringify'](_0x3d0458));_0x3c9477(_0x3d0458);})[_0x8267('0x17')](function(_0x313635){logger[_0x8267('0x13')](_0x8267('0x18'),_0x313635[_0x8267('0x15')],_0x19ddcb);_0xfa957b(_0x3d331c[_0x8267('0x13')](0x1f4,_0x313635[_0x8267('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d75bd81..2a219af 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x1c71ea,_0x54445c){var _0x4ccad6=function(_0x2ad7e7){while(--_0x2ad7e7){_0x1c71ea['push'](_0x1c71ea['shift']());}};_0x4ccad6(++_0x54445c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2dc9d9,_0x336142){_0x2dc9d9=_0x2dc9d9-0x0;var _0x1c1880=_0xdd4f[_0x2dc9d9];return _0x1c1880;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x492320,_0x5d9fe3){var _0x204e7b=function(_0x5ca5e2){while(--_0x5ca5e2){_0x492320['push'](_0x492320['shift']());}};_0x204e7b(++_0x5d9fe3);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 27a5717..9e0146b 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 _0xacf4=['ENUM','out','INTEGER','BOOLEAN','DATE','STRING'];(function(_0x5d09ff,_0x2e8eba){var _0x18c9cb=function(_0x3ab67c){while(--_0x3ab67c){_0x5d09ff['push'](_0x5d09ff['shift']());}};_0x18c9cb(++_0x2e8eba);}(_0xacf4,0xe7));var _0x4acf=function(_0x5bf033,_0xb66448){_0x5bf033=_0x5bf033-0x0;var _0x40a49a=_0xacf4[_0x5bf033];return _0x40a49a;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4acf('0x1')]},'disposition':{'type':Sequelize[_0x4acf('0x2')]},'secondDisposition':{'type':Sequelize[_0x4acf('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4acf('0x2')]},'note':{'type':Sequelize[_0x4acf('0x2')]},'read1stAt':{'type':Sequelize[_0x4acf('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4acf('0x3')]('in',_0x4acf('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4acf('0x3')]('in',_0x4acf('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4acf('0x5')]}}; \ No newline at end of file +var _0x5c3c=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x1d286f,_0x30de05){var _0x334026=function(_0x4f6ae6){while(--_0x4f6ae6){_0x1d286f['push'](_0x1d286f['shift']());}};_0x334026(++_0x30de05);}(_0x5c3c,0x132));var _0xc5c3=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x5c3c[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'closed':{'type':Sequelize[_0xc5c3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5c3('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc5c3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc5c3('0x4')]},'note':{'type':Sequelize[_0xc5c3('0x4')]},'read1stAt':{'type':Sequelize[_0xc5c3('0x3')]},'fax':{'type':Sequelize[_0xc5c3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc5c3('0x5')]('in',_0xc5c3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc5c3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc5c3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 79bd824..fea43db 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 _0x3fb8=['keys','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','filters','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','removeTags','download','unix','join','root','files','server','attachments','format','transcript-%d-%s.zip','push','Messages','createdAt','get','mkdirSync','Attachment','basename','existsSync','createWriteStream','resolve','log','err','unlinkSync','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','show','params','model'];(function(_0x5e07a7,_0x194f65){var _0x28dbed=function(_0xa1f18a){while(--_0xa1f18a){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x28dbed(++_0x194f65);}(_0x3fb8,0x161));var _0x83fb=function(_0x5f5399,_0x4928ca){_0x5f5399=_0x5f5399-0x0;var _0x5e5647=_0x3fb8[_0x5f5399];return _0x5e5647;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x83fb('0x0'));var util=require(_0x83fb('0x1'));var path=require(_0x83fb('0x2'));var fs=require('fs');var _=require(_0x83fb('0x3'));var Redis=require('ioredis');var interaction=require(_0x83fb('0x4'));var qs=require(_0x83fb('0x5'));var logger=require(_0x83fb('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x83fb('0x7')]=_[_0x83fb('0x8')](config[_0x83fb('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x83fb('0x9'))(new Redis(config[_0x83fb('0x7')]));require(_0x83fb('0xa'))[_0x83fb('0xb')](socket);function respondWithStatusCode(_0x2dd332,_0x36b065){_0x36b065=_0x36b065||0xcc;return function(_0xa346d1){if(_0xa346d1){return _0x2dd332[_0x83fb('0xc')](_0x36b065);}return _0x2dd332[_0x83fb('0xd')](_0x36b065)[_0x83fb('0xe')]();};}function respondWithResult(_0x3f2576,_0x18b5c9){_0x18b5c9=_0x18b5c9||0xc8;return function(_0x16e68d){if(_0x16e68d){return _0x3f2576['status'](_0x18b5c9)[_0x83fb('0xf')](_0x16e68d);}};}function respondWithFilteredResult(_0x1f3c60,_0xe3df3e){return function(_0x2f27e5){if(_0x2f27e5){var _0x33aa75=typeof _0xe3df3e[_0x83fb('0x10')]===_0x83fb('0x11')&&typeof _0xe3df3e[_0x83fb('0x12')]==='undefined';var _0x269afd=_0x2f27e5[_0x83fb('0x13')];var _0x44de28=_0x33aa75?0x0:_0xe3df3e[_0x83fb('0x10')];var _0x295d4d=_0x33aa75?_0x2f27e5[_0x83fb('0x13')]:_0xe3df3e[_0x83fb('0x10')]+_0xe3df3e[_0x83fb('0x12')];var _0x5d0689;if(_0x295d4d>=_0x269afd){_0x295d4d=_0x269afd;_0x5d0689=0xc8;}else{_0x5d0689=0xce;}_0x1f3c60['status'](_0x5d0689);return _0x1f3c60[_0x83fb('0x14')](_0x83fb('0x15'),_0x44de28+'-'+_0x295d4d+'/'+_0x269afd)[_0x83fb('0xf')](_0x2f27e5);}return null;};}function saveUpdates(_0x351ef0){return function(_0x5dca27){if(_0x5dca27){return _0x5dca27[_0x83fb('0x16')](_0x351ef0)['then'](function(_0x3e6f5d){return _0x3e6f5d;});}return null;};}function removeEntity(_0x256748){return function(_0x36abca){if(_0x36abca){return _0x36abca[_0x83fb('0x17')]()[_0x83fb('0x18')](function(){_0x256748['status'](0xcc)[_0x83fb('0xe')]();});}};}function handleEntityNotFound(_0xe5069e){return function(_0x38a6f5){if(!_0x38a6f5){_0xe5069e[_0x83fb('0xc')](0x194);}return _0x38a6f5;};}function handleError(_0x4418bd,_0x3fed7b){_0x3fed7b=_0x3fed7b||0x1f4;return function(_0x1b5adb){logger['error'](_0x1b5adb[_0x83fb('0x19')]);if(_0x1b5adb[_0x83fb('0x1a')]){delete _0x1b5adb[_0x83fb('0x1a')];}_0x4418bd['status'](_0x3fed7b)[_0x83fb('0x1b')](_0x1b5adb);};}exports[_0x83fb('0x1c')]=function(_0x2800ad,_0x251bf6){var _0x8bcb7b={};var _0xc62581=_[_0x83fb('0x1d')](db[_0x83fb('0x1e')][_0x83fb('0x1f')],function(_0x4e6ecd){return{'name':_0x4e6ecd['fieldName'],'type':_0x4e6ecd[_0x83fb('0x20')][_0x83fb('0x21')]};});_0x8bcb7b=qs[_0x83fb('0x22')](_0xc62581,_0x2800ad);return interaction[_0x83fb('0x23')](_0x83fb('0x24'),_0x2800ad[_0x83fb('0x25')],_0x2800ad[_0x83fb('0x26')],_0x8bcb7b,_0xc62581)['then'](respondWithFilteredResult(_0x251bf6,_0x8bcb7b))[_0x83fb('0x27')](handleError(_0x251bf6,null));};exports[_0x83fb('0x28')]=function(_0x2ebfbf,_0x3207ce){var _0x5230d7={'raw':![],'where':{'id':_0x2ebfbf[_0x83fb('0x29')]['id']}},_0x58ff74={};_0x58ff74[_0x83fb('0x2a')]=_[_0x83fb('0x2b')](db[_0x83fb('0x1e')]['rawAttributes']);_0x58ff74[_0x83fb('0x25')]=_[_0x83fb('0x2b')](_0x2ebfbf[_0x83fb('0x25')]);_0x58ff74['filters']=_[_0x83fb('0x2c')](_0x58ff74[_0x83fb('0x2a')],_0x58ff74['query']);_0x5230d7[_0x83fb('0x2d')]=_[_0x83fb('0x2c')](_0x58ff74[_0x83fb('0x2a')],qs['fields'](_0x2ebfbf['query'][_0x83fb('0x2e')]));_0x5230d7[_0x83fb('0x2d')]=_0x5230d7['attributes'][_0x83fb('0x2f')]?_0x5230d7[_0x83fb('0x2d')]:_0x58ff74[_0x83fb('0x2a')];if(_0x2ebfbf[_0x83fb('0x25')][_0x83fb('0x30')]){_0x5230d7[_0x83fb('0x31')]=[{'all':!![]}];}_0x5230d7=_[_0x83fb('0x32')]({},_0x5230d7,_0x2ebfbf['options']);return db[_0x83fb('0x1e')][_0x83fb('0x33')](_0x5230d7)[_0x83fb('0x18')](handleEntityNotFound(_0x3207ce,null))[_0x83fb('0x18')](respondWithResult(_0x3207ce,null))[_0x83fb('0x27')](handleError(_0x3207ce,null));};exports['create']=function(_0x3faeac,_0x492094){return db['FaxInteraction'][_0x83fb('0x34')](_0x3faeac['body'],{})[_0x83fb('0x18')](respondWithResult(_0x492094,0xc9))[_0x83fb('0x27')](handleError(_0x492094,null));};exports['update']=function(_0x55e8e5,_0x275f81){if(_0x55e8e5[_0x83fb('0x35')]['id']){delete _0x55e8e5[_0x83fb('0x35')]['id'];}return db[_0x83fb('0x1e')][_0x83fb('0x33')]({'where':{'id':_0x55e8e5[_0x83fb('0x29')]['id']}})[_0x83fb('0x18')](handleEntityNotFound(_0x275f81,null))[_0x83fb('0x18')](saveUpdates(_0x55e8e5['body'],null))[_0x83fb('0x18')](respondWithResult(_0x275f81,null))['catch'](handleError(_0x275f81,null));};exports['destroy']=function(_0x118c94,_0x5871d8){return db[_0x83fb('0x1e')]['find']({'where':{'id':_0x118c94[_0x83fb('0x29')]['id']}})['then'](handleEntityNotFound(_0x5871d8,null))[_0x83fb('0x18')](removeEntity(_0x5871d8,null))['catch'](handleError(_0x5871d8,null));};exports[_0x83fb('0x36')]=function(_0x53e683,_0x29f220){return db[_0x83fb('0x1e')]['describe']()[_0x83fb('0x18')](respondWithResult(_0x29f220,null))['catch'](handleError(_0x29f220,null));};exports[_0x83fb('0x37')]=function(_0x4f0a95,_0x585d2b){return db['FaxMessage'][_0x83fb('0x33')]({'where':{'id':_0x4f0a95[_0x83fb('0x29')]['id']}})['then'](handleEntityNotFound(_0x585d2b,null))[_0x83fb('0x18')](function(_0x5a2b86){if(_0x5a2b86){return _0x5a2b86[_0x83fb('0x37')](_0x4f0a95['body'][_0x83fb('0x38')],_[_0x83fb('0x39')](_0x4f0a95[_0x83fb('0x35')],[_0x83fb('0x38'),'id'])||{});}})[_0x83fb('0x18')](respondWithResult(_0x585d2b,null))[_0x83fb('0x27')](handleError(_0x585d2b,null));};exports[_0x83fb('0x3a')]=function(_0xb27361,_0xbf34d9){var _0x284d72={'raw':![],'where':{}};var _0x1bfdbc={};var _0x4c2b19={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x83fb('0x3b')]({'where':{'id':_0xb27361[_0x83fb('0x29')]['id']}})[_0x83fb('0x18')](handleEntityNotFound(_0xbf34d9,null))[_0x83fb('0x18')](function(_0x5f2b7a){if(_0x5f2b7a){_0x1bfdbc[_0x83fb('0x2a')]=_['keys'](db[_0x83fb('0x3c')][_0x83fb('0x1f')]);_0x1bfdbc['query']=_[_0x83fb('0x2b')](_0xb27361[_0x83fb('0x25')]);_0x1bfdbc[_0x83fb('0x3d')]=_[_0x83fb('0x2c')](_0x1bfdbc[_0x83fb('0x2a')],_0x1bfdbc[_0x83fb('0x25')]);_0x284d72[_0x83fb('0x2d')]=_[_0x83fb('0x2c')](_0x1bfdbc[_0x83fb('0x2a')],qs[_0x83fb('0x2e')](_0xb27361[_0x83fb('0x25')][_0x83fb('0x2e')]));_0x284d72[_0x83fb('0x2d')]=_0x284d72['attributes'][_0x83fb('0x2f')]?_0x284d72[_0x83fb('0x2d')]:_0x1bfdbc[_0x83fb('0x2a')];if(!_0xb27361[_0x83fb('0x25')][_0x83fb('0x3e')]('nolimit')){_0x284d72[_0x83fb('0x12')]=qs[_0x83fb('0x12')](_0xb27361['query'][_0x83fb('0x12')]);_0x284d72[_0x83fb('0x10')]=qs[_0x83fb('0x10')](_0xb27361[_0x83fb('0x25')][_0x83fb('0x10')]);}_0x284d72[_0x83fb('0x3f')]=qs[_0x83fb('0x40')](_0xb27361[_0x83fb('0x25')]['sort']);_0x284d72[_0x83fb('0x41')]=qs[_0x83fb('0x3d')](_[_0x83fb('0x42')](_0xb27361[_0x83fb('0x25')],_0x1bfdbc[_0x83fb('0x3d')]));_0x284d72[_0x83fb('0x41')][_0x83fb('0x43')]=_0x5f2b7a['id'];if(_0xb27361[_0x83fb('0x25')]['filter']){_0x284d72[_0x83fb('0x41')]=_[_0x83fb('0x32')](_0x284d72[_0x83fb('0x41')],{'$or':_['map'](_0x284d72[_0x83fb('0x2d')],function(_0x2663ad){var _0x58d293={};_0x58d293[_0x2663ad]={'$like':'%'+_0xb27361[_0x83fb('0x25')][_0x83fb('0x44')]+'%'};return _0x58d293;})});}if(_0xb27361[_0x83fb('0x25')][_0x83fb('0x45')]){var _0x17b8a8=_0xb27361[_0x83fb('0x25')][_0x83fb('0x45')][_0x83fb('0x46')](',');var _0x45c4b5={};_0x45c4b5[_0x17b8a8[0x0]]={'$gte':moment(_0x17b8a8[0x1])['format'](_0x83fb('0x47'))};_0x284d72[_0x83fb('0x41')]=_[_0x83fb('0x32')](_0x284d72[_0x83fb('0x41')],_0x45c4b5);}_0x284d72=_[_0x83fb('0x32')]({},_0x284d72,_0xb27361['options']);return db[_0x83fb('0x3c')]['count']({'where':_0x284d72[_0x83fb('0x41')]})[_0x83fb('0x18')](function(_0x42d54a){_0x4c2b19[_0x83fb('0x13')]=_0x42d54a;if(_0xb27361[_0x83fb('0x25')]['includeAll']){_0x284d72[_0x83fb('0x31')]=[{'all':!![]}];}return db[_0x83fb('0x3c')][_0x83fb('0x23')](_0x284d72);})[_0x83fb('0x18')](function(_0x18156f){_0x4c2b19[_0x83fb('0x48')]=_0x18156f;return _0x4c2b19;});}})['then'](respondWithFilteredResult(_0xbf34d9,_0x284d72))[_0x83fb('0x27')](handleError(_0xbf34d9,null));};exports[_0x83fb('0x49')]=function(_0x5458f6,_0x2cecce){return db[_0x83fb('0x1e')]['find']({'where':{'id':_0x5458f6[_0x83fb('0x29')]['id']}})['then'](handleEntityNotFound(_0x2cecce,null))[_0x83fb('0x18')](function(_0x2652b7){if(_0x2652b7){return _0x2652b7['setTags'](_0x5458f6[_0x83fb('0x35')][_0x83fb('0x38')],_['omit'](_0x5458f6[_0x83fb('0x35')],[_0x83fb('0x38'),'id'])||{})[_0x83fb('0x4a')](function(){return db['Tag'][_0x83fb('0x23')]({'attributes':['id',_0x83fb('0x1a'),'color'],'where':{'id':_0x5458f6[_0x83fb('0x35')][_0x83fb('0x38')]}});})[_0x83fb('0x18')](function(_0x5ba46){socket[_0x83fb('0x4b')]('faxInteractionTags:save',{'id':Number(_0x5458f6[_0x83fb('0x29')]['id']),'tags':_0x5ba46||[]});return{'id':Number(_0x5458f6['params']['id']),'tags':_0x5ba46||[]};});}})[_0x83fb('0x18')](respondWithResult(_0x2cecce,null))['catch'](handleError(_0x2cecce,null));};exports['removeTags']=function(_0x16155f,_0x273916){return db[_0x83fb('0x1e')][_0x83fb('0x33')]({'where':{'id':_0x16155f[_0x83fb('0x29')]['id']}})[_0x83fb('0x18')](handleEntityNotFound(_0x273916,null))[_0x83fb('0x18')](function(_0x330495){if(_0x330495){return _0x330495[_0x83fb('0x4c')](_0x16155f['query'][_0x83fb('0x38')]);}})[_0x83fb('0x18')](respondWithStatusCode(_0x273916,null))[_0x83fb('0x27')](handleError(_0x273916,null));};exports[_0x83fb('0x4d')]=function(_0x1eab44,_0x4330ca){var _0x4be47a=moment()[_0x83fb('0x4e')]()['toString']();var _0x4a47aa=path[_0x83fb('0x4f')](config[_0x83fb('0x50')],'server',_0x83fb('0x51'),'tmp');var _0x376d92=path[_0x83fb('0x4f')](config[_0x83fb('0x50')],_0x83fb('0x52'),_0x83fb('0x51'),_0x83fb('0x53'));var _0x32f1f0=path[_0x83fb('0x4f')](_0x4a47aa,_0x4be47a);var _0x470ef4=util[_0x83fb('0x54')](_0x83fb('0x55'),_0x1eab44[_0x83fb('0x29')]['id'],_0x4be47a);var _0x2dd027=path[_0x83fb('0x4f')](_0x4a47aa,_0x470ef4);var _0xeeae92=[];_0xeeae92[_0x83fb('0x56')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x7b55f9=[{'model':db[_0x83fb('0x3c')],'as':_0x83fb('0x57'),'attributes':['id',_0x83fb('0x35'),_0x83fb('0x58')],'include':_0xeeae92}];return db[_0x83fb('0x1e')]['find']({'where':{'id':_0x1eab44[_0x83fb('0x29')]['id']},'include':_0x7b55f9})[_0x83fb('0x18')](handleEntityNotFound(_0x4330ca,null))['then'](function(_0x41ac7d){if(_0x41ac7d&&_0x41ac7d[_0x83fb('0x57')]){var _0x5307ab=_0x41ac7d[_0x83fb('0x59')]({'plain':!![]});fs[_0x83fb('0x5a')](_0x32f1f0);for(var _0x5b47b7=0x0;_0x5b47b7<_0x5307ab[_0x83fb('0x57')][_0x83fb('0x2f')];_0x5b47b7++){var _0x10bef9=_0x5307ab[_0x83fb('0x57')][_0x5b47b7][_0x83fb('0x5b')];if(_0x10bef9){var _0x357aa0=path[_0x83fb('0x4f')](_0x376d92,_0x10bef9[_0x83fb('0x5c')]);if(fs[_0x83fb('0x5d')](_0x357aa0)){fs['createReadStream'](_0x357aa0)['pipe'](fs[_0x83fb('0x5e')](path[_0x83fb('0x4f')](_0x32f1f0,_0x10bef9[_0x83fb('0x5c')])));}}}return BPromise[_0x83fb('0x5f')]()[_0x83fb('0x18')](function(){return new BPromise(function(_0x5f1b1d,_0x3ba541){zipdir(_0x32f1f0,{'saveTo':_0x2dd027},function(_0x444496,_0x164564){if(_0x444496)return _0x3ba541(_0x444496);return _0x5f1b1d(_0x164564);});})['then'](function(){return new BPromise(function(_0x24d4f2,_0x5808b8){rimraf(_0x32f1f0,function(_0x6a9d4){if(_0x6a9d4)_0x5808b8(_0x6a9d4);return _0x24d4f2();});});})[_0x83fb('0x18')](function(){return _0x4330ca[_0x83fb('0x4d')](_0x2dd027,_0x470ef4,function(_0x277fbe){if(_0x277fbe){console[_0x83fb('0x60')](_0x83fb('0x61'),_0x277fbe);}else{fs[_0x83fb('0x62')](_0x2dd027);}});});});}else{return _0x4330ca[_0x83fb('0xc')](0xc8);}})['catch'](handleError(_0x4330ca,null));}; \ No newline at end of file +var _0xef53=['fieldName','getOptions','findAll','fax','query','user','params','model','FaxInteraction','keys','filters','intersection','fields','length','includeAll','include','options','find','create','body','catch','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','attributes','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','format','rows','addTags','Tag','color','faxInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','get','mkdirSync','Messages','basename','pipe','createWriteStream','log','err','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','send','index','map','rawAttributes'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xef53,0x107));var _0x3ef5=function(_0x1ad659,_0x1ab26a){_0x1ad659=_0x1ad659-0x0;var _0x56d7e2=_0xef53[_0x1ad659];return _0x56d7e2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3ef5('0x0'));var moment=require('moment');var BPromise=require(_0x3ef5('0x1'));var util=require(_0x3ef5('0x2'));var path=require(_0x3ef5('0x3'));var fs=require('fs');var _=require(_0x3ef5('0x4'));var Redis=require(_0x3ef5('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x3ef5('0x6'));var logger=require(_0x3ef5('0x7'))(_0x3ef5('0x8'));var config=require('../../config/environment');var db=require(_0x3ef5('0x9'))['db'];config[_0x3ef5('0xa')]=_[_0x3ef5('0xb')](config[_0x3ef5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ef5('0xc'))(new Redis(config[_0x3ef5('0xa')]));require(_0x3ef5('0xd'))[_0x3ef5('0xe')](socket);function respondWithStatusCode(_0x713dd9,_0x146083){_0x146083=_0x146083||0xcc;return function(_0x53596e){if(_0x53596e){return _0x713dd9[_0x3ef5('0xf')](_0x146083);}return _0x713dd9[_0x3ef5('0x10')](_0x146083)[_0x3ef5('0x11')]();};}function respondWithResult(_0xeae05c,_0x1b7108){_0x1b7108=_0x1b7108||0xc8;return function(_0x11fb84){if(_0x11fb84){return _0xeae05c['status'](_0x1b7108)[_0x3ef5('0x12')](_0x11fb84);}};}function respondWithFilteredResult(_0x1d50d2,_0x246fb7){return function(_0x2471b5){if(_0x2471b5){var _0xac9718=typeof _0x246fb7[_0x3ef5('0x13')]===_0x3ef5('0x14')&&typeof _0x246fb7[_0x3ef5('0x15')]===_0x3ef5('0x14');var _0x11d7ef=_0x2471b5[_0x3ef5('0x16')];var _0x22f91a=_0xac9718?0x0:_0x246fb7[_0x3ef5('0x13')];var _0x37c4e5=_0xac9718?_0x2471b5[_0x3ef5('0x16')]:_0x246fb7['offset']+_0x246fb7[_0x3ef5('0x15')];var _0xb42e1a;if(_0x37c4e5>=_0x11d7ef){_0x37c4e5=_0x11d7ef;_0xb42e1a=0xc8;}else{_0xb42e1a=0xce;}_0x1d50d2[_0x3ef5('0x10')](_0xb42e1a);return _0x1d50d2[_0x3ef5('0x17')](_0x3ef5('0x18'),_0x22f91a+'-'+_0x37c4e5+'/'+_0x11d7ef)['json'](_0x2471b5);}return null;};}function saveUpdates(_0x10c9d3){return function(_0x311589){if(_0x311589){return _0x311589[_0x3ef5('0x19')](_0x10c9d3)['then'](function(_0x443f5c){return _0x443f5c;});}return null;};}function removeEntity(_0x47f73f){return function(_0x3236d1){if(_0x3236d1){return _0x3236d1[_0x3ef5('0x1a')]()[_0x3ef5('0x1b')](function(){_0x47f73f['status'](0xcc)[_0x3ef5('0x11')]();});}};}function handleEntityNotFound(_0x7c56ee){return function(_0x49f705){if(!_0x49f705){_0x7c56ee[_0x3ef5('0xf')](0x194);}return _0x49f705;};}function handleError(_0x1c5099,_0x164632){_0x164632=_0x164632||0x1f4;return function(_0x4a3500){logger[_0x3ef5('0x1c')](_0x4a3500['stack']);if(_0x4a3500[_0x3ef5('0x1d')]){delete _0x4a3500[_0x3ef5('0x1d')];}_0x1c5099[_0x3ef5('0x10')](_0x164632)[_0x3ef5('0x1e')](_0x4a3500);};}exports[_0x3ef5('0x1f')]=function(_0x4f5544,_0xb86601){var _0xe7150e={};var _0xe25d66=_[_0x3ef5('0x20')](db['FaxInteraction'][_0x3ef5('0x21')],function(_0x1c2ef8){return{'name':_0x1c2ef8[_0x3ef5('0x22')],'type':_0x1c2ef8['type']['key']};});_0xe7150e=qs[_0x3ef5('0x23')](_0xe25d66,_0x4f5544);return interaction[_0x3ef5('0x24')](_0x3ef5('0x25'),_0x4f5544[_0x3ef5('0x26')],_0x4f5544[_0x3ef5('0x27')],_0xe7150e,_0xe25d66)[_0x3ef5('0x1b')](respondWithFilteredResult(_0xb86601,_0xe7150e))['catch'](handleError(_0xb86601,null));};exports['show']=function(_0x2ca89b,_0x57c57f){var _0x166535={'raw':![],'where':{'id':_0x2ca89b[_0x3ef5('0x28')]['id']}},_0x38f664={};_0x38f664[_0x3ef5('0x29')]=_['keys'](db[_0x3ef5('0x2a')][_0x3ef5('0x21')]);_0x38f664[_0x3ef5('0x26')]=_[_0x3ef5('0x2b')](_0x2ca89b[_0x3ef5('0x26')]);_0x38f664[_0x3ef5('0x2c')]=_[_0x3ef5('0x2d')](_0x38f664[_0x3ef5('0x29')],_0x38f664[_0x3ef5('0x26')]);_0x166535['attributes']=_[_0x3ef5('0x2d')](_0x38f664[_0x3ef5('0x29')],qs[_0x3ef5('0x2e')](_0x2ca89b[_0x3ef5('0x26')][_0x3ef5('0x2e')]));_0x166535['attributes']=_0x166535['attributes'][_0x3ef5('0x2f')]?_0x166535['attributes']:_0x38f664['model'];if(_0x2ca89b[_0x3ef5('0x26')][_0x3ef5('0x30')]){_0x166535[_0x3ef5('0x31')]=[{'all':!![]}];}_0x166535=_['merge']({},_0x166535,_0x2ca89b[_0x3ef5('0x32')]);return db['FaxInteraction'][_0x3ef5('0x33')](_0x166535)['then'](handleEntityNotFound(_0x57c57f,null))['then'](respondWithResult(_0x57c57f,null))['catch'](handleError(_0x57c57f,null));};exports[_0x3ef5('0x34')]=function(_0x11d8b0,_0x20bd95){return db['FaxInteraction'][_0x3ef5('0x34')](_0x11d8b0[_0x3ef5('0x35')],{})[_0x3ef5('0x1b')](respondWithResult(_0x20bd95,0xc9))[_0x3ef5('0x36')](handleError(_0x20bd95,null));};exports[_0x3ef5('0x19')]=function(_0x3b9c6a,_0x437240){if(_0x3b9c6a[_0x3ef5('0x35')]['id']){delete _0x3b9c6a[_0x3ef5('0x35')]['id'];}return db[_0x3ef5('0x2a')]['find']({'where':{'id':_0x3b9c6a[_0x3ef5('0x28')]['id']}})[_0x3ef5('0x1b')](handleEntityNotFound(_0x437240,null))[_0x3ef5('0x1b')](saveUpdates(_0x3b9c6a[_0x3ef5('0x35')],null))['then'](respondWithResult(_0x437240,null))[_0x3ef5('0x36')](handleError(_0x437240,null));};exports[_0x3ef5('0x1a')]=function(_0x5cdc34,_0x48a73e){return db['FaxInteraction']['find']({'where':{'id':_0x5cdc34['params']['id']}})[_0x3ef5('0x1b')](handleEntityNotFound(_0x48a73e,null))[_0x3ef5('0x1b')](removeEntity(_0x48a73e,null))[_0x3ef5('0x36')](handleError(_0x48a73e,null));};exports[_0x3ef5('0x37')]=function(_0x50831b,_0x3386ad){return db[_0x3ef5('0x2a')][_0x3ef5('0x37')]()[_0x3ef5('0x1b')](respondWithResult(_0x3386ad,null))[_0x3ef5('0x36')](handleError(_0x3386ad,null));};exports[_0x3ef5('0x38')]=function(_0x573efa,_0x43903b){return db[_0x3ef5('0x39')][_0x3ef5('0x33')]({'where':{'id':_0x573efa[_0x3ef5('0x28')]['id']}})['then'](handleEntityNotFound(_0x43903b,null))[_0x3ef5('0x1b')](function(_0x4e670f){if(_0x4e670f){return _0x4e670f[_0x3ef5('0x38')](_0x573efa['body']['ids'],_[_0x3ef5('0x3a')](_0x573efa[_0x3ef5('0x35')],[_0x3ef5('0x3b'),'id'])||{});}})[_0x3ef5('0x1b')](respondWithResult(_0x43903b,null))[_0x3ef5('0x36')](handleError(_0x43903b,null));};exports[_0x3ef5('0x3c')]=function(_0x4480f1,_0x22f8af){var _0x57e784={'raw':![],'where':{}};var _0x56fd41={};var _0x51343f={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x3ef5('0x3d')]({'where':{'id':_0x4480f1[_0x3ef5('0x28')]['id']}})[_0x3ef5('0x1b')](handleEntityNotFound(_0x22f8af,null))[_0x3ef5('0x1b')](function(_0x42e6bd){if(_0x42e6bd){_0x56fd41[_0x3ef5('0x29')]=_[_0x3ef5('0x2b')](db['FaxMessage'][_0x3ef5('0x21')]);_0x56fd41['query']=_['keys'](_0x4480f1[_0x3ef5('0x26')]);_0x56fd41[_0x3ef5('0x2c')]=_[_0x3ef5('0x2d')](_0x56fd41[_0x3ef5('0x29')],_0x56fd41[_0x3ef5('0x26')]);_0x57e784[_0x3ef5('0x3e')]=_[_0x3ef5('0x2d')](_0x56fd41[_0x3ef5('0x29')],qs['fields'](_0x4480f1['query']['fields']));_0x57e784['attributes']=_0x57e784[_0x3ef5('0x3e')][_0x3ef5('0x2f')]?_0x57e784[_0x3ef5('0x3e')]:_0x56fd41[_0x3ef5('0x29')];if(!_0x4480f1[_0x3ef5('0x26')][_0x3ef5('0x3f')](_0x3ef5('0x40'))){_0x57e784[_0x3ef5('0x15')]=qs[_0x3ef5('0x15')](_0x4480f1[_0x3ef5('0x26')]['limit']);_0x57e784[_0x3ef5('0x13')]=qs['offset'](_0x4480f1['query'][_0x3ef5('0x13')]);}_0x57e784[_0x3ef5('0x41')]=qs[_0x3ef5('0x42')](_0x4480f1[_0x3ef5('0x26')][_0x3ef5('0x42')]);_0x57e784[_0x3ef5('0x43')]=qs[_0x3ef5('0x2c')](_[_0x3ef5('0x44')](_0x4480f1['query'],_0x56fd41['filters']));_0x57e784['where'][_0x3ef5('0x45')]=_0x42e6bd['id'];if(_0x4480f1[_0x3ef5('0x26')][_0x3ef5('0x46')]){_0x57e784[_0x3ef5('0x43')]=_[_0x3ef5('0x47')](_0x57e784['where'],{'$or':_[_0x3ef5('0x20')](_0x57e784[_0x3ef5('0x3e')],function(_0x1b787c){var _0x540885={};_0x540885[_0x1b787c]={'$like':'%'+_0x4480f1[_0x3ef5('0x26')]['filter']+'%'};return _0x540885;})});}if(_0x4480f1[_0x3ef5('0x26')]['$gte']){var _0x548229=_0x4480f1[_0x3ef5('0x26')][_0x3ef5('0x48')][_0x3ef5('0x49')](',');var _0x29ae9f={};_0x29ae9f[_0x548229[0x0]]={'$gte':moment(_0x548229[0x1])[_0x3ef5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57e784[_0x3ef5('0x43')]=_[_0x3ef5('0x47')](_0x57e784[_0x3ef5('0x43')],_0x29ae9f);}_0x57e784=_[_0x3ef5('0x47')]({},_0x57e784,_0x4480f1[_0x3ef5('0x32')]);return db[_0x3ef5('0x39')][_0x3ef5('0x16')]({'where':_0x57e784[_0x3ef5('0x43')]})[_0x3ef5('0x1b')](function(_0x489625){_0x51343f[_0x3ef5('0x16')]=_0x489625;if(_0x4480f1[_0x3ef5('0x26')][_0x3ef5('0x30')]){_0x57e784[_0x3ef5('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0x3ef5('0x24')](_0x57e784);})[_0x3ef5('0x1b')](function(_0x52cb6a){_0x51343f[_0x3ef5('0x4b')]=_0x52cb6a;return _0x51343f;});}})[_0x3ef5('0x1b')](respondWithFilteredResult(_0x22f8af,_0x57e784))[_0x3ef5('0x36')](handleError(_0x22f8af,null));};exports[_0x3ef5('0x4c')]=function(_0x317ae4,_0x1f3a99){return db['FaxInteraction'][_0x3ef5('0x33')]({'where':{'id':_0x317ae4[_0x3ef5('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f3a99,null))['then'](function(_0x4a7776){if(_0x4a7776){return _0x4a7776['setTags'](_0x317ae4[_0x3ef5('0x35')][_0x3ef5('0x3b')],_[_0x3ef5('0x3a')](_0x317ae4[_0x3ef5('0x35')],['ids','id'])||{})['spread'](function(){return db[_0x3ef5('0x4d')][_0x3ef5('0x24')]({'attributes':['id','name',_0x3ef5('0x4e')],'where':{'id':_0x317ae4['body'][_0x3ef5('0x3b')]}});})[_0x3ef5('0x1b')](function(_0x206fc5){socket['emit'](_0x3ef5('0x4f'),{'id':Number(_0x317ae4['params']['id']),'tags':_0x206fc5||[]});return{'id':Number(_0x317ae4[_0x3ef5('0x28')]['id']),'tags':_0x206fc5||[]};});}})[_0x3ef5('0x1b')](respondWithResult(_0x1f3a99,null))[_0x3ef5('0x36')](handleError(_0x1f3a99,null));};exports[_0x3ef5('0x50')]=function(_0x127586,_0x2f3507){return db['FaxInteraction'][_0x3ef5('0x33')]({'where':{'id':_0x127586['params']['id']}})['then'](handleEntityNotFound(_0x2f3507,null))[_0x3ef5('0x1b')](function(_0x41dea5){if(_0x41dea5){return _0x41dea5['removeTags'](_0x127586[_0x3ef5('0x26')][_0x3ef5('0x3b')]);}})[_0x3ef5('0x1b')](respondWithStatusCode(_0x2f3507,null))['catch'](handleError(_0x2f3507,null));};exports['download']=function(_0x2d1d9f,_0x502b56){var _0x9952a5=moment()[_0x3ef5('0x51')]()['toString']();var _0x58b323=path[_0x3ef5('0x52')](config[_0x3ef5('0x53')],'server',_0x3ef5('0x54'),_0x3ef5('0x55'));var _0x132413=path['join'](config[_0x3ef5('0x53')],_0x3ef5('0x56'),_0x3ef5('0x54'),_0x3ef5('0x57'));var _0xb16b99=path[_0x3ef5('0x52')](_0x58b323,_0x9952a5);var _0x3a25f1=util[_0x3ef5('0x4a')](_0x3ef5('0x58'),_0x2d1d9f['params']['id'],_0x9952a5);var _0x5d60ef=path[_0x3ef5('0x52')](_0x58b323,_0x3a25f1);var _0x3419ae=[];_0x3419ae[_0x3ef5('0x59')]({'model':db['Attachment'],'as':_0x3ef5('0x5a'),'raw':!![]});var _0x17b1d0=[{'model':db[_0x3ef5('0x39')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x3419ae}];return db[_0x3ef5('0x2a')][_0x3ef5('0x33')]({'where':{'id':_0x2d1d9f[_0x3ef5('0x28')]['id']},'include':_0x17b1d0})[_0x3ef5('0x1b')](handleEntityNotFound(_0x502b56,null))['then'](function(_0x3346f6){if(_0x3346f6&&_0x3346f6['Messages']){var _0x5c3a04=_0x3346f6[_0x3ef5('0x5b')]({'plain':!![]});fs[_0x3ef5('0x5c')](_0xb16b99);for(var _0x347d50=0x0;_0x347d50<_0x5c3a04[_0x3ef5('0x5d')][_0x3ef5('0x2f')];_0x347d50++){var _0x186064=_0x5c3a04[_0x3ef5('0x5d')][_0x347d50][_0x3ef5('0x5a')];if(_0x186064){var _0x4be036=path['join'](_0x132413,_0x186064[_0x3ef5('0x5e')]);if(fs['existsSync'](_0x4be036)){fs['createReadStream'](_0x4be036)[_0x3ef5('0x5f')](fs[_0x3ef5('0x60')](path[_0x3ef5('0x52')](_0xb16b99,_0x186064['basename'])));}}}return BPromise['resolve']()[_0x3ef5('0x1b')](function(){return new BPromise(function(_0x53307b,_0x102740){zipdir(_0xb16b99,{'saveTo':_0x5d60ef},function(_0x3c713a,_0x3da8c9){if(_0x3c713a)return _0x102740(_0x3c713a);return _0x53307b(_0x3da8c9);});})[_0x3ef5('0x1b')](function(){return new BPromise(function(_0x12e4d9,_0x1f394a){rimraf(_0xb16b99,function(_0x117166){if(_0x117166)_0x1f394a(_0x117166);return _0x12e4d9();});});})[_0x3ef5('0x1b')](function(){return _0x502b56['download'](_0x5d60ef,_0x3a25f1,function(_0x1576f7){if(_0x1576f7){console[_0x3ef5('0x61')](_0x3ef5('0x62'),_0x1576f7);}else{fs['unlinkSync'](_0x5d60ef);}});});});}else{return _0x502b56[_0x3ef5('0xf')](0xc8);}})['catch'](handleError(_0x502b56,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 057f9b9..4fd4cf0 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 _0x9101=['length','emit','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','map','findAll','setDataValue','unreadMessages'];(function(_0x1493f2,_0x18361d){var _0x1035f6=function(_0x371ffb){while(--_0x371ffb){_0x1493f2['push'](_0x1493f2['shift']());}};_0x1035f6(++_0x18361d);}(_0x9101,0x156));var _0x1910=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9101[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1910('0x0'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0x1910('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1910('0x2')](0x0);var events={'afterCreate':_0x1910('0x3'),'afterUpdate':_0x1910('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51a330){return function(_0x200cf6,_0x13146e,_0x3b9167){_0x200cf6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5dd128){_0x200cf6['setDataValue']('Users',_0x5dd128[_0x1910('0x5')](function(_0x125a98){return{'id':_0x125a98['id']};}));return FaxMessage[_0x1910('0x6')]({'where':{'FaxInteractionId':_0x200cf6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51b498){_0x200cf6[_0x1910('0x7')](_0x1910('0x8'),_0x51b498[_0x1910('0x9')]);FaxInteractionEvents[_0x1910('0xa')](_0x51a330+':'+_0x200cf6['id'],_0x200cf6);FaxInteractionEvents[_0x1910('0xa')](_0x51a330,_0x200cf6);_0x3b9167(null);})['catch'](_0x3b9167(null));};}for(var e in events){if(events[_0x1910('0xb')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1910('0xc')]=FaxInteractionEvents; \ No newline at end of file +var _0x2f40=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x2f40,0x1e6));var _0x02f4=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x2f40[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0x02f4('0x0'));var FaxInteraction=require(_0x02f4('0x1'))['db'][_0x02f4('0x2')];var FaxMessage=require(_0x02f4('0x1'))['db'][_0x02f4('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x02f4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x02f4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c8eaf){return function(_0x33a2c0,_0x248af5,_0x4242fa){_0x33a2c0[_0x02f4('0x6')]({'attributes':['id'],'raw':!![]})[_0x02f4('0x7')](function(_0x5ec2fc){_0x33a2c0[_0x02f4('0x8')](_0x02f4('0x9'),_0x5ec2fc[_0x02f4('0xa')](function(_0x3ef6a6){return{'id':_0x3ef6a6['id']};}));return FaxMessage[_0x02f4('0xb')]({'where':{'FaxInteractionId':_0x33a2c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x02f4('0x7')](function(_0x5086e2){_0x33a2c0[_0x02f4('0x8')](_0x02f4('0xc'),_0x5086e2[_0x02f4('0xd')]);FaxInteractionEvents['emit'](_0x1c8eaf+':'+_0x33a2c0['id'],_0x33a2c0);FaxInteractionEvents[_0x02f4('0xe')](_0x1c8eaf,_0x33a2c0);_0x4242fa(null);})['catch'](_0x4242fa(null));};}for(var e in events){if(events[_0x02f4('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x02f4('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6378367..e7dc6ed 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 _0x1131=['moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x3753bc,_0x28f6c7){var _0x5adcb8=function(_0x2fb031){while(--_0x2fb031){_0x3753bc['push'](_0x3753bc['shift']());}};_0x5adcb8(++_0x28f6c7);}(_0x1131,0x1c4));var _0x1113=function(_0x4093af,_0x49059c){_0x4093af=_0x4093af-0x0;var _0x477e35=_0x1131[_0x4093af];return _0x477e35;};'use strict';var _=require(_0x1113('0x0'));var util=require(_0x1113('0x1'));var logger=require(_0x1113('0x2'))(_0x1113('0x3'));var moment=require(_0x1113('0x4'));var BPromise=require('bluebird');var rp=require(_0x1113('0x5'));var fs=require('fs');var path=require(_0x1113('0x6'));var rimraf=require(_0x1113('0x7'));var config=require(_0x1113('0x8'));var attributes=require(_0x1113('0x9'));module[_0x1113('0xa')]=function(_0x3a070f,_0x1ebd98){return _0x3a070f[_0x1113('0xb')](_0x1113('0xc'),attributes,{'tableName':_0x1113('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f25b6,_0x34964e,_0xe05eca){if(_0x2f25b6[_0x1113('0xe')](_0x1113('0xf'))){_0x2f25b6[_0x1113('0x10')]=moment()[_0x1113('0x11')](_0x1113('0x12'));}_0xe05eca(null,_0x2f25b6);}}});}; \ No newline at end of file +var _0x649f=['./faxInteraction.attributes','exports','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x32c98a,_0x5e6eb0){var _0x1796d3=function(_0x560640){while(--_0x560640){_0x32c98a['push'](_0x32c98a['shift']());}};_0x1796d3(++_0x5e6eb0);}(_0x649f,0x93));var _0xf649=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x649f[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var logger=require(_0xf649('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf649('0x4'));var rimraf=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var attributes=require(_0xf649('0x7'));module[_0xf649('0x8')]=function(_0x3e2e46,_0x580748){return _0x3e2e46[_0xf649('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x144078,_0x14cd22,_0x3ab98d){if(_0x144078['changed'](_0xf649('0xa'))){_0x144078[_0xf649('0xb')]=moment()[_0xf649('0xc')](_0xf649('0xd'));}_0x3ab98d(null,_0x144078);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index ed0d215..8f17b5b 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 _0x2049=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','debug','AddTagsToFaxInteraction','addTags','omit'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x2049,0x7d));var _0x9204=function(_0x519495,_0x480270){_0x519495=_0x519495-0x0;var _0x4298ea=_0x2049[_0x519495];return _0x4298ea;};'use strict';var _=require(_0x9204('0x0'));var util=require(_0x9204('0x1'));var moment=require(_0x9204('0x2'));var BPromise=require(_0x9204('0x3'));var rs=require(_0x9204('0x4'));var fs=require('fs');var Redis=require(_0x9204('0x5'));var db=require(_0x9204('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9204('0x7'))(_0x9204('0x8'));var config=require(_0x9204('0x9'));var jayson=require(_0x9204('0xa'));var client=jayson[_0x9204('0xb')][_0x9204('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9204('0xd')],{'host':_0x9204('0xe'),'port':0x18eb});var socket=require(_0x9204('0xf'))(new Redis(config['redis']));require(_0x9204('0x10'))[_0x9204('0x11')](socket);function respondWithRpcPromise(_0x25f99b,_0x4615e3,_0x501b9a){return new BPromise(function(_0x19013b,_0x2678f4){return client['request'](_0x25f99b,_0x501b9a)[_0x9204('0x12')](function(_0x5a1d85){logger[_0x9204('0x13')](_0x9204('0x14'),_0x4615e3,_0x9204('0x15'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4615e3,_0x9204('0x15'),JSON[_0x9204('0x16')](_0x5a1d85));if(_0x5a1d85[_0x9204('0x17')]){if(_0x5a1d85[_0x9204('0x17')][_0x9204('0x18')]===0x1f4){logger[_0x9204('0x17')](_0x9204('0x14'),_0x4615e3,_0x5a1d85[_0x9204('0x17')][_0x9204('0x19')]);return _0x2678f4(_0x5a1d85[_0x9204('0x17')]['message']);}logger[_0x9204('0x17')](_0x9204('0x14'),_0x4615e3,_0x5a1d85[_0x9204('0x17')][_0x9204('0x19')]);return _0x19013b(_0x5a1d85[_0x9204('0x17')]['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4615e3,_0x9204('0x15'));_0x19013b(_0x5a1d85[_0x9204('0x1a')][_0x9204('0x19')]);}})[_0x9204('0x1b')](function(_0x5b5316){logger[_0x9204('0x17')](_0x9204('0x14'),_0x4615e3,_0x5b5316);_0x2678f4(_0x5b5316);});});}exports[_0x9204('0x1c')]=function(_0x4bfa8b){var _0x49698b=this;return new Promise(function(_0x18fc8a,_0x20c183){return db[_0x9204('0x1d')][_0x9204('0x1e')](_0x4bfa8b[_0x9204('0x1f')],{'raw':_0x4bfa8b[_0x9204('0x20')]?_0x4bfa8b[_0x9204('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bfa8b[_0x9204('0x20')]?_0x4bfa8b[_0x9204('0x20')]['where']||null:null,'attributes':_0x4bfa8b['options']?_0x4bfa8b[_0x9204('0x20')][_0x9204('0x21')]||null:null,'limit':_0x4bfa8b[_0x9204('0x20')]?_0x4bfa8b[_0x9204('0x20')][_0x9204('0x22')]||null:null})[_0x9204('0x12')](function(_0x53f69d){logger[_0x9204('0x13')](_0x9204('0x1c'),_0x4bfa8b);logger[_0x9204('0x23')](_0x9204('0x1c'),_0x4bfa8b,JSON[_0x9204('0x16')](_0x53f69d));_0x18fc8a(_0x53f69d);})[_0x9204('0x1b')](function(_0x90ff13){logger[_0x9204('0x17')](_0x9204('0x1c'),_0x90ff13[_0x9204('0x19')],_0x4bfa8b);_0x20c183(_0x49698b[_0x9204('0x17')](0x1f4,_0x90ff13[_0x9204('0x19')]));});});};exports[_0x9204('0x24')]=function(_0x4e6af5){return new Promise(function(_0x3b99ff,_0x2da57f){return db[_0x9204('0x1d')]['find']({'where':_0x4e6af5[_0x9204('0x20')]?_0x4e6af5[_0x9204('0x20')]['where']||null:null})[_0x9204('0x12')](function(_0x483219){if(_0x483219){return _0x483219[_0x9204('0x25')](_0x4e6af5[_0x9204('0x1f')]['ids'],_[_0x9204('0x26')](_0x4e6af5[_0x9204('0x1f')],['ids','id'])||{});}})[_0x9204('0x27')](function(_0xa4656){logger[_0x9204('0x13')](_0x9204('0x28'),_0x4e6af5);logger['debug'](_0x9204('0x28'),_0x4e6af5,JSON[_0x9204('0x16')](_0xa4656));_0x3b99ff(_0xa4656);})[_0x9204('0x1b')](function(_0x5b7572){logger[_0x9204('0x17')]('AddTags',_0x5b7572[_0x9204('0x19')],_0x4e6af5);_0x2da57f(_this[_0x9204('0x17')](0x1f4,_0x5b7572[_0x9204('0x19')]));});});}; \ No newline at end of file +var _0x5479=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then'];(function(_0x400e29,_0x14b1bb){var _0x2ab05f=function(_0x3e8d83){while(--_0x3e8d83){_0x400e29['push'](_0x400e29['shift']());}};_0x2ab05f(++_0x14b1bb);}(_0x5479,0x1c4));var _0x9547=function(_0xcfe9ed,_0xfcbc14){_0xcfe9ed=_0xcfe9ed-0x0;var _0x1e8ba1=_0x5479[_0xcfe9ed];return _0x1e8ba1;};'use strict';var _=require('lodash');var util=require(_0x9547('0x0'));var moment=require(_0x9547('0x1'));var BPromise=require(_0x9547('0x2'));var rs=require(_0x9547('0x3'));var fs=require('fs');var Redis=require(_0x9547('0x4'));var db=require(_0x9547('0x5'))['db'];var utils=require(_0x9547('0x6'));var logger=require('../../config/logger')(_0x9547('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9547('0x8')][_0x9547('0x9')]({'port':0x232a});config[_0x9547('0xa')]=_['defaults'](config[_0x9547('0xa')],{'host':_0x9547('0xb'),'port':0x18eb});var socket=require(_0x9547('0xc'))(new Redis(config[_0x9547('0xa')]));require(_0x9547('0xd'))[_0x9547('0xe')](socket);function respondWithRpcPromise(_0x44d02b,_0x38786f,_0x634bd){return new BPromise(function(_0x47c3eb,_0x4ee683){return client['request'](_0x44d02b,_0x634bd)[_0x9547('0xf')](function(_0x577235){logger[_0x9547('0x10')](_0x9547('0x11'),_0x38786f,_0x9547('0x12'));logger[_0x9547('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x38786f,'request\x20sent',JSON['stringify'](_0x577235));if(_0x577235[_0x9547('0x14')]){if(_0x577235[_0x9547('0x14')][_0x9547('0x15')]===0x1f4){logger['error'](_0x9547('0x11'),_0x38786f,_0x577235[_0x9547('0x14')][_0x9547('0x16')]);return _0x4ee683(_0x577235['error']['message']);}logger[_0x9547('0x14')](_0x9547('0x11'),_0x38786f,_0x577235[_0x9547('0x14')][_0x9547('0x16')]);return _0x47c3eb(_0x577235[_0x9547('0x14')]['message']);}else{logger[_0x9547('0x10')](_0x9547('0x11'),_0x38786f,_0x9547('0x12'));_0x47c3eb(_0x577235[_0x9547('0x17')]['message']);}})[_0x9547('0x18')](function(_0x1620f8){logger['error'](_0x9547('0x11'),_0x38786f,_0x1620f8);_0x4ee683(_0x1620f8);});});}exports[_0x9547('0x19')]=function(_0x486e24){var _0x443328=this;return new Promise(function(_0xde964e,_0x3d24f8){return db[_0x9547('0x1a')][_0x9547('0x1b')](_0x486e24[_0x9547('0x1c')],{'raw':_0x486e24[_0x9547('0x1d')]?_0x486e24[_0x9547('0x1d')][_0x9547('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x486e24['options']?_0x486e24[_0x9547('0x1d')][_0x9547('0x1f')]||null:null,'attributes':_0x486e24['options']?_0x486e24[_0x9547('0x1d')][_0x9547('0x20')]||null:null,'limit':_0x486e24[_0x9547('0x1d')]?_0x486e24[_0x9547('0x1d')][_0x9547('0x21')]||null:null})['then'](function(_0x4d132d){logger[_0x9547('0x10')](_0x9547('0x19'),_0x486e24);logger['debug'](_0x9547('0x19'),_0x486e24,JSON['stringify'](_0x4d132d));_0xde964e(_0x4d132d);})['catch'](function(_0x580b57){logger[_0x9547('0x14')]('UpdateFaxInteraction',_0x580b57['message'],_0x486e24);_0x3d24f8(_0x443328['error'](0x1f4,_0x580b57[_0x9547('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x211dfc){return new Promise(function(_0x17c1ec,_0xbc1c51){return db[_0x9547('0x1a')][_0x9547('0x22')]({'where':_0x211dfc[_0x9547('0x1d')]?_0x211dfc[_0x9547('0x1d')][_0x9547('0x1f')]||null:null})[_0x9547('0xf')](function(_0x46a9f8){if(_0x46a9f8){return _0x46a9f8[_0x9547('0x23')](_0x211dfc[_0x9547('0x1c')][_0x9547('0x24')],_[_0x9547('0x25')](_0x211dfc[_0x9547('0x1c')],[_0x9547('0x24'),'id'])||{});}})['spread'](function(_0x5c6d41){logger['info']('AddTags',_0x211dfc);logger[_0x9547('0x13')]('AddTags',_0x211dfc,JSON[_0x9547('0x26')](_0x5c6d41));_0x17c1ec(_0x5c6d41);})[_0x9547('0x18')](function(_0x3e5231){logger[_0x9547('0x14')]('AddTags',_0x3e5231[_0x9547('0x16')],_0x211dfc);_0xbc1c51(_this['error'](0x1f4,_0x3e5231[_0x9547('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0e09a07..eb95c3a 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 _0xa81e=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa81e,0x19e));var _0xea81=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xa81e[_0x21549c];return _0x426cbd;};'use strict';var FaxInteractionEvents=require(_0xea81('0x0'));var events=[_0xea81('0x1'),'remove',_0xea81('0x2')];function createListener(_0x421f65,_0x3c81a0){return function(_0x1fcaea){_0x3c81a0[_0xea81('0x3')](_0x421f65,_0x1fcaea);};}function removeListener(_0x379ba3,_0xde4107){return function(){FaxInteractionEvents[_0xea81('0x4')](_0x379ba3,_0xde4107);};}exports[_0xea81('0x5')]=function(_0x31e263){for(var _0x2546b2=0x0,_0xfcc11a=events[_0xea81('0x6')];_0x2546b2<_0xfcc11a;_0x2546b2++){var _0x5e4f97=events[_0x2546b2];var _0x50efd2=createListener(_0xea81('0x7')+_0x5e4f97,_0x31e263);FaxInteractionEvents['on'](_0x5e4f97,_0x50efd2);}}; \ No newline at end of file +var _0x8630=['length','faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register'];(function(_0x18b4f1,_0x35bc37){var _0x58ff54=function(_0x4bb63c){while(--_0x4bb63c){_0x18b4f1['push'](_0x18b4f1['shift']());}};_0x58ff54(++_0x35bc37);}(_0x8630,0x1f2));var _0x0863=function(_0x4e74dc,_0x50eb35){_0x4e74dc=_0x4e74dc-0x0;var _0x3d1b07=_0x8630[_0x4e74dc];return _0x3d1b07;};'use strict';var FaxInteractionEvents=require(_0x0863('0x0'));var events=[_0x0863('0x1'),'remove',_0x0863('0x2')];function createListener(_0x48ca5b,_0x203d62){return function(_0x4e0f4e){_0x203d62[_0x0863('0x3')](_0x48ca5b,_0x4e0f4e);};}function removeListener(_0x5688a8,_0x29b9b3){return function(){FaxInteractionEvents[_0x0863('0x4')](_0x5688a8,_0x29b9b3);};}exports[_0x0863('0x5')]=function(_0x231b98){for(var _0xd4e0f3=0x0,_0x45c83c=events[_0x0863('0x6')];_0xd4e0f3<_0x45c83c;_0xd4e0f3++){var _0x3c3946=events[_0xd4e0f3];var _0x47ec13=createListener(_0x0863('0x7')+_0x3c3946,_0x231b98);FaxInteractionEvents['on'](_0x3c3946,_0x47ec13);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8d1e34c..52c5454 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 _0x225d=['faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete'];(function(_0x14b7a3,_0x19daf){var _0x45e22b=function(_0x3f54b7){while(--_0x3f54b7){_0x14b7a3['push'](_0x14b7a3['shift']());}};_0x45e22b(++_0x19daf);}(_0x225d,0x16f));var _0xd225=function(_0x457c7a,_0x5dc52e){_0x457c7a=_0x457c7a-0x0;var _0x4472ef=_0x225d[_0x457c7a];return _0x4472ef;};'use strict';var multer=require(_0xd225('0x0'));var util=require('util');var path=require(_0xd225('0x1'));var timeout=require(_0xd225('0x2'));var express=require(_0xd225('0x3'));var router=express[_0xd225('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd225('0x5'));var controller=require(_0xd225('0x6'));router['get']('/',auth[_0xd225('0x7')](),controller[_0xd225('0x8')]);router[_0xd225('0x9')](_0xd225('0xa'),auth[_0xd225('0x7')](),controller[_0xd225('0xb')]);router[_0xd225('0x9')](_0xd225('0xc'),auth[_0xd225('0x7')](),controller[_0xd225('0xd')]);router[_0xd225('0x9')](_0xd225('0xe'),auth[_0xd225('0x7')](),controller[_0xd225('0xf')]);router['get'](_0xd225('0x10'),auth[_0xd225('0x7')](),controller[_0xd225('0x11')]);router[_0xd225('0x12')]('/',auth[_0xd225('0x7')](),controller[_0xd225('0x13')]);router[_0xd225('0x12')](_0xd225('0xe'),auth[_0xd225('0x7')](),controller[_0xd225('0x14')]);router[_0xd225('0x12')](_0xd225('0x15'),auth[_0xd225('0x7')](),interaction[_0xd225('0x16')](_0xd225('0x17'),_0xd225('0x18')),controller[_0xd225('0x19')]);router['put'](_0xd225('0xc'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xd225('0x1a')),controller[_0xd225('0x1b')]);router[_0xd225('0x1c')](_0xd225('0xc'),auth[_0xd225('0x7')](),interaction['tracked'](_0xd225('0x17'),_0xd225('0x1d')),controller[_0xd225('0x1e')]);router[_0xd225('0x1c')](_0xd225('0x15'),auth['isAuthenticated'](),controller[_0xd225('0x1f')]);module[_0xd225('0x20')]=router; \ No newline at end of file +var _0xc122=['tracked','fax','faxinteraction:update','update','delete','destroy','removeTags','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','/:id'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc122,0x1b9));var _0x2c12=function(_0x2fc6c0,_0x48d9b3){_0x2fc6c0=_0x2fc6c0-0x0;var _0x1fd062=_0xc122[_0x2fc6c0];return _0x1fd062;};'use strict';var multer=require('multer');var util=require(_0x2c12('0x0'));var path=require(_0x2c12('0x1'));var timeout=require(_0x2c12('0x2'));var express=require('express');var router=express[_0x2c12('0x3')]();var fs_extra=require(_0x2c12('0x4'));var auth=require(_0x2c12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c12('0x6'));var controller=require(_0x2c12('0x7'));router[_0x2c12('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c12('0x9')]);router[_0x2c12('0x8')](_0x2c12('0xa'),auth[_0x2c12('0xb')](),controller[_0x2c12('0xc')]);router[_0x2c12('0x8')]('/:id',auth[_0x2c12('0xb')](),controller[_0x2c12('0xd')]);router[_0x2c12('0x8')](_0x2c12('0xe'),auth[_0x2c12('0xb')](),controller['getMessages']);router['get'](_0x2c12('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x2c12('0x10')]);router[_0x2c12('0x11')](_0x2c12('0xe'),auth[_0x2c12('0xb')](),controller[_0x2c12('0x12')]);router['post'](_0x2c12('0x13'),auth[_0x2c12('0xb')](),interaction['tracked']('fax',_0x2c12('0x14')),controller[_0x2c12('0x15')]);router[_0x2c12('0x16')](_0x2c12('0x17'),auth['isAuthenticated'](),interaction[_0x2c12('0x18')](_0x2c12('0x19'),_0x2c12('0x1a')),controller[_0x2c12('0x1b')]);router[_0x2c12('0x1c')](_0x2c12('0x17'),auth[_0x2c12('0xb')](),interaction[_0x2c12('0x18')](_0x2c12('0x19'),'faxinteraction:destroy'),controller[_0x2c12('0x1d')]);router[_0x2c12('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2c12('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5bf8d82..ce2fc4e 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x644a=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3edc22,_0x243990){var _0x1ddf50=function(_0x6e175f){while(--_0x6e175f){_0x3edc22['push'](_0x3edc22['shift']());}};_0x1ddf50(++_0x243990);}(_0x644a,0xfd));var _0xa644=function(_0x23bf7f,_0x578f6c){_0x23bf7f=_0x23bf7f-0x0;var _0x64b00e=_0x644a[_0x23bf7f];return _0x64b00e;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xc73e,0x1e9));var _0xec73=function(_0x2af870,_0x263a14){_0x2af870=_0x2af870-0x0;var _0x5dd13e=_0xc73e[_0x2af870];return _0x5dd13e;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b782d51..6695115 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 _0x5d46=['accept','EventManager','acceptmessage','fax','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','QueryTypes','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','index','FaxMessage','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','body','find','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event'];(function(_0x3b8de3,_0x363e34){var _0x4ac1f4=function(_0x411eb7){while(--_0x411eb7){_0x3b8de3['push'](_0x3b8de3['shift']());}};_0x4ac1f4(++_0x363e34);}(_0x5d46,0x148));var _0x65d4=function(_0x428a37,_0x5ce5ee){_0x428a37=_0x428a37-0x0;var _0x5399bd=_0x5d46[_0x428a37];return _0x5399bd;};'use strict';var emlformat=require(_0x65d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65d4('0x1'));var jsonpatch=require(_0x65d4('0x2'));var rp=require(_0x65d4('0x3'));var moment=require(_0x65d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65d4('0x5'));var util=require(_0x65d4('0x6'));var path=require(_0x65d4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x65d4('0x8'));var fs=require('fs');var fs_extra=require(_0x65d4('0x9'));var _=require(_0x65d4('0xa'));var squel=require(_0x65d4('0xb'));var crypto=require('crypto');var jsforce=require(_0x65d4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x65d4('0xd'));var querystring=require(_0x65d4('0xe'));var Papa=require(_0x65d4('0xf'));var Redis=require(_0x65d4('0x10'));var authService=require(_0x65d4('0x11'));var qs=require(_0x65d4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d4('0x13'));var logger=require(_0x65d4('0x14'))(_0x65d4('0x15'));var utils=require(_0x65d4('0x16'));var config=require(_0x65d4('0x17'));var licenseUtil=require(_0x65d4('0x18'));var db=require(_0x65d4('0x19'))['db'];config[_0x65d4('0x1a')]=_[_0x65d4('0x1b')](config[_0x65d4('0x1a')],{'host':_0x65d4('0x1c'),'port':0x18eb});var socket=require(_0x65d4('0x1d'))(new Redis(config[_0x65d4('0x1a')]));require(_0x65d4('0x1e'))[_0x65d4('0x1f')](socket);var jayson=require(_0x65d4('0x20'));var client=jayson[_0x65d4('0x21')][_0x65d4('0x22')]({'port':0x232c});var client9002=jayson[_0x65d4('0x21')][_0x65d4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x406ce2,_0x325047,_0x1f8fed,_0x276a72){return new BPromise(function(_0x2264bf,_0xd3a69a){var _0x6a7871=_0x276a72||client;return _0x6a7871[_0x65d4('0x23')](_0x406ce2,_0x1f8fed)[_0x65d4('0x24')](function(_0x2aba09){logger['info']('FaxMessage,\x20%s,\x20%s',_0x325047,'request\x20sent');logger[_0x65d4('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x325047,'request\x20sent',JSON[_0x65d4('0x26')](_0x2aba09));if(_0x2aba09[_0x65d4('0x27')]){if(_0x2aba09[_0x65d4('0x27')][_0x65d4('0x28')]===0x1f4){logger[_0x65d4('0x27')](_0x65d4('0x29'),_0x325047,_0x2aba09[_0x65d4('0x27')][_0x65d4('0x2a')]);return _0xd3a69a(_0x2aba09['error'][_0x65d4('0x2a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x325047,_0x2aba09[_0x65d4('0x27')][_0x65d4('0x2a')]);return _0x2264bf(_0x2aba09[_0x65d4('0x27')][_0x65d4('0x2a')]);}else{logger[_0x65d4('0x2b')](_0x65d4('0x29'),_0x325047,_0x65d4('0x2c'));_0x2264bf(_0x2aba09[_0x65d4('0x2d')]['message']);}})[_0x65d4('0x2e')](function(_0x46998a){logger[_0x65d4('0x27')](_0x65d4('0x29'),_0x325047,_0x46998a);_0xd3a69a(_0x46998a);});});}function respondWithStatusCode(_0xb0dac4,_0x343ee5){_0x343ee5=_0x343ee5||0xcc;return function(_0x203c5e){if(_0x203c5e){return _0xb0dac4[_0x65d4('0x2f')](_0x343ee5);}return _0xb0dac4[_0x65d4('0x30')](_0x343ee5)[_0x65d4('0x31')]();};}function respondWithResult(_0x24641a,_0x308bcf){_0x308bcf=_0x308bcf||0xc8;return function(_0x430e47){if(_0x430e47){return _0x24641a[_0x65d4('0x30')](_0x308bcf)[_0x65d4('0x32')](_0x430e47);}};}function respondWithFilteredResult(_0x352df0,_0x506a2b){return function(_0x171332){if(_0x171332){var _0x1d66a2=typeof _0x506a2b[_0x65d4('0x33')]===_0x65d4('0x34')&&typeof _0x506a2b[_0x65d4('0x35')]===_0x65d4('0x34');var _0x2b63df=_0x171332[_0x65d4('0x36')];var _0xb8f0d4=_0x1d66a2?0x0:_0x506a2b[_0x65d4('0x33')];var _0xc4c149=_0x1d66a2?_0x171332[_0x65d4('0x36')]:_0x506a2b[_0x65d4('0x33')]+_0x506a2b[_0x65d4('0x35')];var _0x2d81b6;if(_0xc4c149>=_0x2b63df){_0xc4c149=_0x2b63df;_0x2d81b6=0xc8;}else{_0x2d81b6=0xce;}_0x352df0[_0x65d4('0x30')](_0x2d81b6);return _0x352df0['set'](_0x65d4('0x37'),_0xb8f0d4+'-'+_0xc4c149+'/'+_0x2b63df)[_0x65d4('0x32')](_0x171332);}return null;};}function patchUpdates(_0x4e0364){return function(_0x101345){try{jsonpatch[_0x65d4('0x38')](_0x101345,_0x4e0364,!![]);}catch(_0x5b90ba){return BPromise[_0x65d4('0x39')](_0x5b90ba);}return _0x101345[_0x65d4('0x3a')]();};}function saveUpdates(_0x2ca592,_0x4792d6){return function(_0x5d05ae){if(_0x5d05ae){return _0x5d05ae[_0x65d4('0x3b')](_0x2ca592)[_0x65d4('0x24')](function(_0x4a6901){return _0x4a6901;});}return null;};}function removeEntity(_0x4b586a,_0x8cb3db){return function(_0x4cc791){if(_0x4cc791){return _0x4cc791[_0x65d4('0x3c')]()[_0x65d4('0x24')](function(){_0x4b586a[_0x65d4('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d278d,_0x2114dd){return function(_0x346b1a){if(!_0x346b1a){_0x5d278d[_0x65d4('0x2f')](0x194);}return _0x346b1a;};}function handleError(_0x3449d0,_0x3bc5aa){_0x3bc5aa=_0x3bc5aa||0x1f4;return function(_0x294bbd){logger['error'](_0x294bbd[_0x65d4('0x3d')]);if(_0x294bbd[_0x65d4('0x3e')]){delete _0x294bbd['name'];}_0x3449d0['status'](_0x3bc5aa)['send'](_0x294bbd);};}exports[_0x65d4('0x3f')]=function(_0x496409,_0x3df655){var _0x40e336={},_0x10a124={},_0x2d0d4e={'count':0x0,'rows':[]};var _0x1593d2=_['map'](db[_0x65d4('0x40')]['rawAttributes'],function(_0x21dc34){return{'name':_0x21dc34['fieldName'],'type':_0x21dc34['type'][_0x65d4('0x41')]};});_0x10a124['model']=_[_0x65d4('0x42')](_0x1593d2,_0x65d4('0x3e'));_0x10a124[_0x65d4('0x43')]=_['keys'](_0x496409[_0x65d4('0x43')]);_0x10a124[_0x65d4('0x44')]=_[_0x65d4('0x45')](_0x10a124['model'],_0x10a124[_0x65d4('0x43')]);_0x40e336['attributes']=_[_0x65d4('0x45')](_0x10a124[_0x65d4('0x46')],qs[_0x65d4('0x47')](_0x496409[_0x65d4('0x43')][_0x65d4('0x47')]));_0x40e336['attributes']=_0x40e336[_0x65d4('0x48')][_0x65d4('0x49')]?_0x40e336[_0x65d4('0x48')]:_0x10a124['model'];if(!_0x496409[_0x65d4('0x43')]['hasOwnProperty'](_0x65d4('0x4a'))){_0x40e336[_0x65d4('0x35')]=qs[_0x65d4('0x35')](_0x496409[_0x65d4('0x43')]['limit']);_0x40e336['offset']=qs[_0x65d4('0x33')](_0x496409[_0x65d4('0x43')]['offset']);}_0x40e336[_0x65d4('0x4b')]=qs[_0x65d4('0x4c')](_0x496409[_0x65d4('0x43')][_0x65d4('0x4c')]);_0x40e336[_0x65d4('0x4d')]=qs[_0x65d4('0x44')](_['pick'](_0x496409[_0x65d4('0x43')],_0x10a124[_0x65d4('0x44')]),_0x1593d2);if(_0x496409['query']['filter']){_0x40e336['where']=_[_0x65d4('0x4e')](_0x40e336[_0x65d4('0x4d')],{'$or':_[_0x65d4('0x42')](_0x1593d2,function(_0x180049){if(_0x180049[_0x65d4('0x4f')]!==_0x65d4('0x50')){var _0xea10dc={};_0xea10dc[_0x180049[_0x65d4('0x3e')]]={'$like':'%'+_0x496409[_0x65d4('0x43')][_0x65d4('0x51')]+'%'};return _0xea10dc;}})});}_0x40e336=_['merge']({},_0x40e336,_0x496409[_0x65d4('0x52')]);var _0x147124={'where':_0x40e336[_0x65d4('0x4d')]};return db['FaxMessage'][_0x65d4('0x36')](_0x147124)[_0x65d4('0x24')](function(_0x925e2f){_0x2d0d4e[_0x65d4('0x36')]=_0x925e2f;if(_0x496409['query'][_0x65d4('0x53')]){_0x40e336[_0x65d4('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x65d4('0x55')](_0x40e336);})[_0x65d4('0x24')](function(_0x583d43){_0x2d0d4e[_0x65d4('0x56')]=_0x583d43;return _0x2d0d4e;})[_0x65d4('0x24')](respondWithFilteredResult(_0x3df655,_0x40e336))[_0x65d4('0x2e')](handleError(_0x3df655,null));};exports['show']=function(_0x2e069f,_0x2a6a4b){var _0x39a66b={'raw':!![],'where':{'id':_0x2e069f[_0x65d4('0x57')]['id']}},_0x45726b={};_0x45726b[_0x65d4('0x46')]=_[_0x65d4('0x58')](db[_0x65d4('0x40')]['rawAttributes']);_0x45726b[_0x65d4('0x43')]=_[_0x65d4('0x58')](_0x2e069f[_0x65d4('0x43')]);_0x45726b[_0x65d4('0x44')]=_[_0x65d4('0x45')](_0x45726b['model'],_0x45726b[_0x65d4('0x43')]);_0x39a66b[_0x65d4('0x48')]=_['intersection'](_0x45726b['model'],qs[_0x65d4('0x47')](_0x2e069f[_0x65d4('0x43')][_0x65d4('0x47')]));_0x39a66b[_0x65d4('0x48')]=_0x39a66b[_0x65d4('0x48')][_0x65d4('0x49')]?_0x39a66b[_0x65d4('0x48')]:_0x45726b['model'];if(_0x2e069f[_0x65d4('0x43')][_0x65d4('0x53')]){_0x39a66b[_0x65d4('0x54')]=[{'all':!![]}];}_0x39a66b=_['merge']({},_0x39a66b,_0x2e069f[_0x65d4('0x52')]);return db[_0x65d4('0x40')]['find'](_0x39a66b)[_0x65d4('0x24')](handleEntityNotFound(_0x2a6a4b,null))['then'](respondWithResult(_0x2a6a4b,null))[_0x65d4('0x2e')](handleError(_0x2a6a4b,null));};exports['update']=function(_0x5efe18,_0x4e574c){if(_0x5efe18['body']['id']){delete _0x5efe18[_0x65d4('0x59')]['id'];}return db[_0x65d4('0x40')]['find']({'where':{'id':_0x5efe18[_0x65d4('0x57')]['id']}})[_0x65d4('0x24')](handleEntityNotFound(_0x4e574c,null))[_0x65d4('0x24')](saveUpdates(_0x5efe18['body'],null))[_0x65d4('0x24')](respondWithResult(_0x4e574c,null))[_0x65d4('0x2e')](handleError(_0x4e574c,null));};exports[_0x65d4('0x3c')]=function(_0xe69af7,_0x133c13){return db['FaxMessage'][_0x65d4('0x5a')]({'where':{'id':_0xe69af7[_0x65d4('0x57')]['id']}})[_0x65d4('0x24')](handleEntityNotFound(_0x133c13,null))[_0x65d4('0x24')](removeEntity(_0x133c13,null))[_0x65d4('0x2e')](handleError(_0x133c13,null));};exports[_0x65d4('0x5b')]=function(_0x39f0f3,_0x3b1621){return db[_0x65d4('0x40')][_0x65d4('0x5b')]()[_0x65d4('0x24')](respondWithResult(_0x3b1621,null))[_0x65d4('0x2e')](handleError(_0x3b1621,null));};var interaction_log=require('../../config/logger')(_0x65d4('0x5c'));exports['accept']=function(_0x377468,_0x43faed,_0x5bf27e){var _0x102767={'agent':{},'channel':'fax'};if(_0x377468[_0x65d4('0x59')]['id']){delete _0x377468[_0x65d4('0x59')]['id'];}_0x377468[_0x65d4('0x59')][_0x65d4('0x5d')]=!![];_0x377468[_0x65d4('0x59')][_0x65d4('0x5e')]=moment()[_0x65d4('0x5f')](_0x65d4('0x60'));_0x377468[_0x65d4('0x59')][_0x65d4('0x61')]=_0x377468[_0x65d4('0x59')]['UserId']||_0x377468['user']['id'];_0x102767[_0x65d4('0x62')]['id']=_0x377468[_0x65d4('0x59')][_0x65d4('0x61')];return db[_0x65d4('0x40')][_0x65d4('0x5a')]({'where':{'id':_0x377468[_0x65d4('0x57')]['id'],'UserId':null}})[_0x65d4('0x24')](handleEntityNotFound(_0x43faed,null))[_0x65d4('0x24')](saveUpdates(_0x377468[_0x65d4('0x59')],null))[_0x65d4('0x24')](function(_0x142b11){if(_0x142b11){_0x102767['message']=_0x142b11['get']({'plain':!![]});return db[_0x65d4('0x63')][_0x65d4('0x5a')]({'where':{'id':_0x142b11[_0x65d4('0x64')]}});}return null;})[_0x65d4('0x24')](handleEntityNotFound(_0x43faed,null))[_0x65d4('0x24')](function(_0x4761e9){if(_0x4761e9){return _0x4761e9[_0x65d4('0x3b')]({'UserId':_0x377468[_0x65d4('0x59')][_0x65d4('0x61')],'read1stAt':_[_0x65d4('0x65')](_0x4761e9[_0x65d4('0x66')])?moment()[_0x65d4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3c0f49){if(_0x3c0f49){_0x102767[_0x65d4('0x67')]=_0x3c0f49['get']({'plain':!![]});interaction_log[_0x65d4('0x2b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x377468[_0x65d4('0x68')]['id'],_0x377468['user'][_0x65d4('0x3e')],_0x377468[_0x65d4('0x68')]['role'],_0x102767[_0x65d4('0x67')]['id'],_0x377468[_0x65d4('0x59')]?JSON[_0x65d4('0x26')](_0x377468[_0x65d4('0x59')]):_0x65d4('0x69'));return respondWithRpcPromise(_0x65d4('0x6a'),_0x65d4('0x6b'),_0x102767);}return null;})['then'](function(_0x502cd0){var _0x6a585f=_0x65d4('0x6c')+_0x502cd0[_0x65d4('0x2a')]['ContactId'];return db[_0x65d4('0x6d')]['query'](_0x6a585f,{'type':db[_0x65d4('0x6e')]['QueryTypes'][_0x65d4('0x6f')],'raw':!![]})[_0x65d4('0x24')](function(_0xbed23f){return _0xbed23f;});})[_0x65d4('0x24')](function(_0x5a95a6){if(_0x5a95a6){_0x102767[_0x65d4('0x2a')][_0x65d4('0x70')]=_0x5a95a6[0x0];if(!_0x377468[_0x65d4('0x59')][_0x65d4('0x61')])return;return db[_0x65d4('0x71')][_0x65d4('0x5a')]({'where':{'id':_0x377468[_0x65d4('0x59')][_0x65d4('0x61')],'role':_0x65d4('0x62')},'attributes':['id',_0x65d4('0x3e'),_0x65d4('0x72'),_0x65d4('0x73'),_0x65d4('0x74')],'raw':!![]});}return null;})[_0x65d4('0x24')](function(_0x3afa1a){if(!_0x3afa1a)return null;_0x102767[_0x65d4('0x2a')]['agent']=_0x3afa1a;return _0x102767;})[_0x65d4('0x24')](function(_0x237701){if(_0x237701){if(_0x377468[_0x65d4('0x59')][_0x65d4('0x75')]){_0x102767[_0x65d4('0x2a')][_0x65d4('0x76')]=util[_0x65d4('0x5f')](_0x65d4('0x77'),_0x377468[_0x65d4('0x68')][_0x65d4('0x3e')]);_0x102767[_0x65d4('0x2a')][_0x65d4('0x78')]=_0x102767[_0x65d4('0x78')];_0x102767[_0x65d4('0x2a')]['motionChannel']=_0x102767[_0x65d4('0x78')];_0x102767['message'][_0x65d4('0x79')]=_0x65d4('0x7a');return respondWithRpcPromise(_0x65d4('0x7b'),'EventManager',{'event':_0x65d4('0x7c'),'message':_0x102767[_0x65d4('0x2a')]},client9002)[_0x65d4('0x24')](function(){return _0x102767;});}return _0x102767;}return null;})[_0x65d4('0x24')](respondWithResult(_0x43faed,null))[_0x65d4('0x2e')](handleError(_0x43faed,null));};var interaction_log=require(_0x65d4('0x14'))(_0x65d4('0x5c'));exports[_0x65d4('0x39')]=function(_0x3d01e6,_0x31b592,_0x214cc4){var _0x560d16={'agent':{},'channel':_0x65d4('0x7d')};if(_0x3d01e6[_0x65d4('0x59')]['id']){delete _0x3d01e6[_0x65d4('0x59')]['id'];}_0x3d01e6[_0x65d4('0x59')][_0x65d4('0x61')]=_0x3d01e6[_0x65d4('0x59')][_0x65d4('0x61')]||_0x3d01e6[_0x65d4('0x68')]['id'];_0x560d16[_0x65d4('0x62')]['id']=_0x3d01e6[_0x65d4('0x59')]['UserId'];return db[_0x65d4('0x40')][_0x65d4('0x5a')]({'where':{'id':_0x3d01e6[_0x65d4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31b592,null))[_0x65d4('0x24')](function(_0x4e6551){if(_0x4e6551){_0x560d16[_0x65d4('0x2a')]=_0x4e6551[_0x65d4('0x7e')]({'plain':!![]});return db[_0x65d4('0x63')][_0x65d4('0x5a')]({'where':{'id':_0x4e6551[_0x65d4('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x31b592,null))[_0x65d4('0x24')](function(_0xf99b83){if(_0xf99b83){_0x560d16[_0x65d4('0x67')]=_0xf99b83[_0x65d4('0x7e')]({'plain':!![]});interaction_log[_0x65d4('0x2b')](_0x65d4('0x7f'),_0x3d01e6[_0x65d4('0x68')]['id'],_0x3d01e6[_0x65d4('0x68')][_0x65d4('0x3e')],_0x3d01e6[_0x65d4('0x68')][_0x65d4('0x80')],_0x560d16['interaction']['id'],_0x3d01e6[_0x65d4('0x59')]?JSON[_0x65d4('0x26')](_0x3d01e6[_0x65d4('0x59')]):_0x65d4('0x69'));return respondWithRpcPromise(_0x65d4('0x81'),_0x65d4('0x82'),_0x560d16);}return null;})['then'](function(_0x3ba7c9){var _0x2f2eca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ba7c9['message'][_0x65d4('0x83')];return db[_0x65d4('0x6d')][_0x65d4('0x43')](_0x2f2eca,{'type':db[_0x65d4('0x6e')][_0x65d4('0x84')]['SELECT'],'raw':!![]})['then'](function(_0x5a0372){return _0x5a0372;});})['then'](function(_0x451ecc){if(_0x451ecc){_0x560d16['message']['contact']=_0x451ecc[0x0];if(!_0x3d01e6[_0x65d4('0x59')]['UserId'])return;return db['User'][_0x65d4('0x5a')]({'where':{'id':_0x3d01e6[_0x65d4('0x59')][_0x65d4('0x61')],'role':'agent'},'attributes':['id',_0x65d4('0x3e'),_0x65d4('0x72'),_0x65d4('0x73'),'internal'],'raw':!![]});}return null;})[_0x65d4('0x24')](function(_0x3413e6){if(!_0x3413e6)return null;_0x560d16[_0x65d4('0x2a')]['agent']=_0x3413e6;return _0x560d16;})[_0x65d4('0x24')](function(_0xab88b7){if(_0xab88b7){_0xab88b7[_0x65d4('0x2a')][_0x65d4('0x76')]=util[_0x65d4('0x5f')]('SIP/%s',_0x3d01e6[_0x65d4('0x68')][_0x65d4('0x3e')]);_0xab88b7[_0x65d4('0x2a')][_0x65d4('0x78')]=_0x560d16[_0x65d4('0x78')];_0xab88b7[_0x65d4('0x2a')][_0x65d4('0x85')]=_0x560d16[_0x65d4('0x78')];_0xab88b7[_0x65d4('0x2a')][_0x65d4('0x79')]=_0x65d4('0x39');respondWithRpcPromise(_0x65d4('0x7b'),'EventManager',{'event':_0x65d4('0x86'),'message':_0xab88b7[_0x65d4('0x2a')]},client9002);return _0x560d16;}return null;})[_0x65d4('0x24')](respondWithResult(_0x31b592,null))[_0x65d4('0x2e')](handleError(_0x31b592,null));};exports[_0x65d4('0x87')]=function(_0x2cf33a,_0x2e851c){var _0x392e5e;return db[_0x65d4('0x40')][_0x65d4('0x87')](_0x2cf33a['body'],{})[_0x65d4('0x24')](function(_0x3791c8){_0x392e5e=_0x3791c8;return db[_0x65d4('0x88')][_0x65d4('0x89')]({'where':{'id':_0x392e5e['ContactId']}});})['then'](function(_0x58a747){if(_['isNil'](_0x58a747)){return;}else{_0x392e5e[_0x65d4('0x7d')]=_0x58a747[_0x65d4('0x7d')];return db[_0x65d4('0x8a')][_0x65d4('0x89')]({'where':{'id':_0x392e5e[_0x65d4('0x8b')]}});}})[_0x65d4('0x24')](function(_0x40a4b2){return respondWithRpcPromise(_0x65d4('0x8c'),_0x65d4('0x8c'),{'FaxAccountId':_[_0x65d4('0x65')](_0x2cf33a[_0x65d4('0x59')])?undefined:_0x2cf33a[_0x65d4('0x59')][_0x65d4('0x8d')],'path':_['isNil'](_0x40a4b2)?undefined:util[_0x65d4('0x5f')](_0x65d4('0x8e'),_0x40a4b2[_0x65d4('0x8f')]),'fax':_[_0x65d4('0x65')](_0x392e5e['fax'])?undefined:_0x392e5e['fax'],'AttachmentId':_0x392e5e[_0x65d4('0x8b')]},client9002);})[_0x65d4('0x24')](respondWithResult(_0x2e851c,0xc9))[_0x65d4('0x2e')](handleError(_0x2e851c,null));};exports[_0x65d4('0x90')]=function(_0x34297b,_0xbae71d){var _0x1981df=path['join'](config[_0x65d4('0x91')],_0x65d4('0x92'),_0x65d4('0x93'),_0x65d4('0x94'));return db[_0x65d4('0x40')]['find']({'where':{'id':_0x34297b['params']['id']},'include':[{'model':db[_0x65d4('0x8a')],'as':_0x65d4('0x8a')}]})[_0x65d4('0x24')](handleEntityNotFound(_0xbae71d,null))[_0x65d4('0x24')](function(_0x510c65){if(_0x510c65){return _0xbae71d[_0x65d4('0x90')](path[_0x65d4('0x95')](_0x1981df,_0x510c65['Attachment']['basename']));}})[_0x65d4('0x2e')](handleError(_0xbae71d,null));}; \ No newline at end of file +var _0x1ae8=['SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','internal','rejectmessage','create','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','join','Attachment','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','update','end','stack','name','map','FaxMessage','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x1ae8,0xb1));var _0x81ae=function(_0x5ccb33,_0xa4bcbe){_0x5ccb33=_0x5ccb33-0x0;var _0x4c1db8=_0x1ae8[_0x5ccb33];return _0x4c1db8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81ae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81ae('0x1'));var rp=require(_0x81ae('0x2'));var moment=require(_0x81ae('0x3'));var BPromise=require(_0x81ae('0x4'));var Mustache=require('mustache');var util=require(_0x81ae('0x5'));var path=require(_0x81ae('0x6'));var sox=require(_0x81ae('0x7'));var csv=require(_0x81ae('0x8'));var ejs=require(_0x81ae('0x9'));var fs=require('fs');var fs_extra=require(_0x81ae('0xa'));var _=require(_0x81ae('0xb'));var squel=require('squel');var crypto=require(_0x81ae('0xc'));var jsforce=require(_0x81ae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x81ae('0x8'));var querystring=require('querystring');var Papa=require(_0x81ae('0xe'));var Redis=require(_0x81ae('0xf'));var authService=require(_0x81ae('0x10'));var qs=require(_0x81ae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81ae('0x12'));var logger=require(_0x81ae('0x13'))(_0x81ae('0x14'));var utils=require(_0x81ae('0x15'));var config=require(_0x81ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x81ae('0x17'))['db'];config[_0x81ae('0x18')]=_['defaults'](config[_0x81ae('0x18')],{'host':_0x81ae('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81ae('0x18')]));require('./faxMessage.socket')[_0x81ae('0x1a')](socket);var jayson=require(_0x81ae('0x1b'));var client=jayson[_0x81ae('0x1c')][_0x81ae('0x1d')]({'port':0x232c});var client9002=jayson[_0x81ae('0x1c')][_0x81ae('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x210310,_0x13309c,_0x2009f4,_0x5c02d2){return new BPromise(function(_0x38fb21,_0x3e7821){var _0x31560c=_0x5c02d2||client;return _0x31560c[_0x81ae('0x1e')](_0x210310,_0x2009f4)[_0x81ae('0x1f')](function(_0x1c4529){logger[_0x81ae('0x20')](_0x81ae('0x21'),_0x13309c,_0x81ae('0x22'));logger[_0x81ae('0x23')](_0x81ae('0x24'),_0x13309c,_0x81ae('0x22'),JSON['stringify'](_0x1c4529));if(_0x1c4529['error']){if(_0x1c4529[_0x81ae('0x25')][_0x81ae('0x26')]===0x1f4){logger[_0x81ae('0x25')](_0x81ae('0x21'),_0x13309c,_0x1c4529[_0x81ae('0x25')]['message']);return _0x3e7821(_0x1c4529['error'][_0x81ae('0x27')]);}logger[_0x81ae('0x25')](_0x81ae('0x21'),_0x13309c,_0x1c4529[_0x81ae('0x25')][_0x81ae('0x27')]);return _0x38fb21(_0x1c4529[_0x81ae('0x25')][_0x81ae('0x27')]);}else{logger[_0x81ae('0x20')](_0x81ae('0x21'),_0x13309c,_0x81ae('0x22'));_0x38fb21(_0x1c4529[_0x81ae('0x28')][_0x81ae('0x27')]);}})[_0x81ae('0x29')](function(_0x52dda7){logger[_0x81ae('0x25')](_0x81ae('0x21'),_0x13309c,_0x52dda7);_0x3e7821(_0x52dda7);});});}function respondWithStatusCode(_0xbaa387,_0x4b9a60){_0x4b9a60=_0x4b9a60||0xcc;return function(_0x22b043){if(_0x22b043){return _0xbaa387[_0x81ae('0x2a')](_0x4b9a60);}return _0xbaa387[_0x81ae('0x2b')](_0x4b9a60)['end']();};}function respondWithResult(_0x3c498b,_0x5ba10c){_0x5ba10c=_0x5ba10c||0xc8;return function(_0x2f82ea){if(_0x2f82ea){return _0x3c498b[_0x81ae('0x2b')](_0x5ba10c)['json'](_0x2f82ea);}};}function respondWithFilteredResult(_0x48abfb,_0x49679b){return function(_0x24e1b5){if(_0x24e1b5){var _0x4b8c2b=typeof _0x49679b[_0x81ae('0x2c')]==='undefined'&&typeof _0x49679b[_0x81ae('0x2d')]===_0x81ae('0x2e');var _0x2e49d7=_0x24e1b5[_0x81ae('0x2f')];var _0x5873b6=_0x4b8c2b?0x0:_0x49679b['offset'];var _0x9c0964=_0x4b8c2b?_0x24e1b5['count']:_0x49679b['offset']+_0x49679b[_0x81ae('0x2d')];var _0x23862e;if(_0x9c0964>=_0x2e49d7){_0x9c0964=_0x2e49d7;_0x23862e=0xc8;}else{_0x23862e=0xce;}_0x48abfb['status'](_0x23862e);return _0x48abfb['set'](_0x81ae('0x30'),_0x5873b6+'-'+_0x9c0964+'/'+_0x2e49d7)['json'](_0x24e1b5);}return null;};}function patchUpdates(_0x53e95d){return function(_0x13994d){try{jsonpatch[_0x81ae('0x31')](_0x13994d,_0x53e95d,!![]);}catch(_0x3ad98f){return BPromise[_0x81ae('0x32')](_0x3ad98f);}return _0x13994d['save']();};}function saveUpdates(_0x4d66e2,_0x86379c){return function(_0xd64ea6){if(_0xd64ea6){return _0xd64ea6[_0x81ae('0x33')](_0x4d66e2)[_0x81ae('0x1f')](function(_0x35aa59){return _0x35aa59;});}return null;};}function removeEntity(_0x509832,_0x535ef1){return function(_0x3fb0a3){if(_0x3fb0a3){return _0x3fb0a3['destroy']()[_0x81ae('0x1f')](function(){_0x509832[_0x81ae('0x2b')](0xcc)[_0x81ae('0x34')]();});}};}function handleEntityNotFound(_0x31b9f8,_0x4d6794){return function(_0x3c6989){if(!_0x3c6989){_0x31b9f8[_0x81ae('0x2a')](0x194);}return _0x3c6989;};}function handleError(_0x1fea75,_0x59d85e){_0x59d85e=_0x59d85e||0x1f4;return function(_0x511681){logger[_0x81ae('0x25')](_0x511681[_0x81ae('0x35')]);if(_0x511681[_0x81ae('0x36')]){delete _0x511681[_0x81ae('0x36')];}_0x1fea75[_0x81ae('0x2b')](_0x59d85e)['send'](_0x511681);};}exports['index']=function(_0xe5d8a1,_0x440bfe){var _0x215fbd={},_0x2cf4c2={},_0x2a535b={'count':0x0,'rows':[]};var _0x4c79ba=_[_0x81ae('0x37')](db[_0x81ae('0x38')]['rawAttributes'],function(_0xcacce3){return{'name':_0xcacce3[_0x81ae('0x39')],'type':_0xcacce3[_0x81ae('0x3a')][_0x81ae('0x3b')]};});_0x2cf4c2[_0x81ae('0x3c')]=_[_0x81ae('0x37')](_0x4c79ba,_0x81ae('0x36'));_0x2cf4c2['query']=_[_0x81ae('0x3d')](_0xe5d8a1['query']);_0x2cf4c2[_0x81ae('0x3e')]=_[_0x81ae('0x3f')](_0x2cf4c2['model'],_0x2cf4c2[_0x81ae('0x40')]);_0x215fbd[_0x81ae('0x41')]=_[_0x81ae('0x3f')](_0x2cf4c2[_0x81ae('0x3c')],qs[_0x81ae('0x42')](_0xe5d8a1[_0x81ae('0x40')][_0x81ae('0x42')]));_0x215fbd[_0x81ae('0x41')]=_0x215fbd[_0x81ae('0x41')][_0x81ae('0x43')]?_0x215fbd[_0x81ae('0x41')]:_0x2cf4c2['model'];if(!_0xe5d8a1[_0x81ae('0x40')][_0x81ae('0x44')](_0x81ae('0x45'))){_0x215fbd[_0x81ae('0x2d')]=qs[_0x81ae('0x2d')](_0xe5d8a1['query'][_0x81ae('0x2d')]);_0x215fbd['offset']=qs[_0x81ae('0x2c')](_0xe5d8a1[_0x81ae('0x40')]['offset']);}_0x215fbd[_0x81ae('0x46')]=qs[_0x81ae('0x47')](_0xe5d8a1[_0x81ae('0x40')][_0x81ae('0x47')]);_0x215fbd[_0x81ae('0x48')]=qs[_0x81ae('0x3e')](_['pick'](_0xe5d8a1['query'],_0x2cf4c2[_0x81ae('0x3e')]),_0x4c79ba);if(_0xe5d8a1[_0x81ae('0x40')][_0x81ae('0x49')]){_0x215fbd[_0x81ae('0x48')]=_[_0x81ae('0x4a')](_0x215fbd[_0x81ae('0x48')],{'$or':_['map'](_0x4c79ba,function(_0x33cb19){if(_0x33cb19['type']!==_0x81ae('0x4b')){var _0x5d4ac4={};_0x5d4ac4[_0x33cb19[_0x81ae('0x36')]]={'$like':'%'+_0xe5d8a1['query'][_0x81ae('0x49')]+'%'};return _0x5d4ac4;}})});}_0x215fbd=_[_0x81ae('0x4a')]({},_0x215fbd,_0xe5d8a1[_0x81ae('0x4c')]);var _0x3c961f={'where':_0x215fbd[_0x81ae('0x48')]};return db['FaxMessage'][_0x81ae('0x2f')](_0x3c961f)[_0x81ae('0x1f')](function(_0x995c90){_0x2a535b[_0x81ae('0x2f')]=_0x995c90;if(_0xe5d8a1['query'][_0x81ae('0x4d')]){_0x215fbd['include']=[{'all':!![]}];}return db[_0x81ae('0x38')][_0x81ae('0x4e')](_0x215fbd);})[_0x81ae('0x1f')](function(_0x2fab28){_0x2a535b[_0x81ae('0x4f')]=_0x2fab28;return _0x2a535b;})[_0x81ae('0x1f')](respondWithFilteredResult(_0x440bfe,_0x215fbd))[_0x81ae('0x29')](handleError(_0x440bfe,null));};exports[_0x81ae('0x50')]=function(_0x586d3f,_0x551194){var _0x5f1ca7={'raw':!![],'where':{'id':_0x586d3f[_0x81ae('0x51')]['id']}},_0x41dcc3={};_0x41dcc3[_0x81ae('0x3c')]=_[_0x81ae('0x3d')](db['FaxMessage'][_0x81ae('0x52')]);_0x41dcc3[_0x81ae('0x40')]=_[_0x81ae('0x3d')](_0x586d3f[_0x81ae('0x40')]);_0x41dcc3[_0x81ae('0x3e')]=_['intersection'](_0x41dcc3['model'],_0x41dcc3[_0x81ae('0x40')]);_0x5f1ca7[_0x81ae('0x41')]=_[_0x81ae('0x3f')](_0x41dcc3['model'],qs['fields'](_0x586d3f['query'][_0x81ae('0x42')]));_0x5f1ca7[_0x81ae('0x41')]=_0x5f1ca7[_0x81ae('0x41')][_0x81ae('0x43')]?_0x5f1ca7[_0x81ae('0x41')]:_0x41dcc3['model'];if(_0x586d3f[_0x81ae('0x40')]['includeAll']){_0x5f1ca7[_0x81ae('0x53')]=[{'all':!![]}];}_0x5f1ca7=_[_0x81ae('0x4a')]({},_0x5f1ca7,_0x586d3f[_0x81ae('0x4c')]);return db[_0x81ae('0x38')][_0x81ae('0x54')](_0x5f1ca7)[_0x81ae('0x1f')](handleEntityNotFound(_0x551194,null))[_0x81ae('0x1f')](respondWithResult(_0x551194,null))[_0x81ae('0x29')](handleError(_0x551194,null));};exports[_0x81ae('0x33')]=function(_0x1ac614,_0x41e650){if(_0x1ac614['body']['id']){delete _0x1ac614[_0x81ae('0x55')]['id'];}return db['FaxMessage'][_0x81ae('0x54')]({'where':{'id':_0x1ac614[_0x81ae('0x51')]['id']}})[_0x81ae('0x1f')](handleEntityNotFound(_0x41e650,null))['then'](saveUpdates(_0x1ac614[_0x81ae('0x55')],null))['then'](respondWithResult(_0x41e650,null))[_0x81ae('0x29')](handleError(_0x41e650,null));};exports['destroy']=function(_0x17de1b,_0x3a375d){return db[_0x81ae('0x38')][_0x81ae('0x54')]({'where':{'id':_0x17de1b[_0x81ae('0x51')]['id']}})[_0x81ae('0x1f')](handleEntityNotFound(_0x3a375d,null))[_0x81ae('0x1f')](removeEntity(_0x3a375d,null))[_0x81ae('0x29')](handleError(_0x3a375d,null));};exports[_0x81ae('0x56')]=function(_0x549602,_0x25d96c){return db[_0x81ae('0x38')][_0x81ae('0x56')]()[_0x81ae('0x1f')](respondWithResult(_0x25d96c,null))[_0x81ae('0x29')](handleError(_0x25d96c,null));};var interaction_log=require(_0x81ae('0x13'))(_0x81ae('0x57'));exports[_0x81ae('0x58')]=function(_0x4f9a9f,_0x3ff490,_0x2671ef){var _0x1471d4={'agent':{},'channel':_0x81ae('0x59')};if(_0x4f9a9f[_0x81ae('0x55')]['id']){delete _0x4f9a9f[_0x81ae('0x55')]['id'];}_0x4f9a9f[_0x81ae('0x55')][_0x81ae('0x5a')]=!![];_0x4f9a9f['body'][_0x81ae('0x5b')]=moment()[_0x81ae('0x5c')](_0x81ae('0x5d'));_0x4f9a9f[_0x81ae('0x55')][_0x81ae('0x5e')]=_0x4f9a9f[_0x81ae('0x55')][_0x81ae('0x5e')]||_0x4f9a9f[_0x81ae('0x5f')]['id'];_0x1471d4[_0x81ae('0x60')]['id']=_0x4f9a9f['body'][_0x81ae('0x5e')];return db[_0x81ae('0x38')][_0x81ae('0x54')]({'where':{'id':_0x4f9a9f[_0x81ae('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ff490,null))[_0x81ae('0x1f')](saveUpdates(_0x4f9a9f[_0x81ae('0x55')],null))['then'](function(_0x109c7b){if(_0x109c7b){_0x1471d4[_0x81ae('0x27')]=_0x109c7b[_0x81ae('0x61')]({'plain':!![]});return db[_0x81ae('0x62')]['find']({'where':{'id':_0x109c7b[_0x81ae('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3ff490,null))[_0x81ae('0x1f')](function(_0x534f44){if(_0x534f44){return _0x534f44[_0x81ae('0x33')]({'UserId':_0x4f9a9f[_0x81ae('0x55')]['UserId'],'read1stAt':_[_0x81ae('0x64')](_0x534f44[_0x81ae('0x65')])?moment()[_0x81ae('0x5c')](_0x81ae('0x5d')):undefined});}return null;})[_0x81ae('0x1f')](function(_0x5b2cc3){if(_0x5b2cc3){_0x1471d4[_0x81ae('0x66')]=_0x5b2cc3['get']({'plain':!![]});interaction_log['info'](_0x81ae('0x67'),_0x4f9a9f['user']['id'],_0x4f9a9f['user'][_0x81ae('0x36')],_0x4f9a9f['user'][_0x81ae('0x68')],_0x1471d4[_0x81ae('0x66')]['id'],_0x4f9a9f[_0x81ae('0x55')]?JSON['stringify'](_0x4f9a9f[_0x81ae('0x55')]):_0x81ae('0x69'));return respondWithRpcPromise(_0x81ae('0x6a'),_0x81ae('0x6b'),_0x1471d4);}return null;})[_0x81ae('0x1f')](function(_0x4fb20d){var _0x18167b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fb20d[_0x81ae('0x27')][_0x81ae('0x6c')];return db['sequelize']['query'](_0x18167b,{'type':db[_0x81ae('0x6d')][_0x81ae('0x6e')][_0x81ae('0x6f')],'raw':!![]})[_0x81ae('0x1f')](function(_0x16f669){return _0x16f669;});})[_0x81ae('0x1f')](function(_0x4bc356){if(_0x4bc356){_0x1471d4[_0x81ae('0x27')][_0x81ae('0x70')]=_0x4bc356[0x0];if(!_0x4f9a9f[_0x81ae('0x55')][_0x81ae('0x5e')])return;return db[_0x81ae('0x71')][_0x81ae('0x54')]({'where':{'id':_0x4f9a9f['body'][_0x81ae('0x5e')],'role':_0x81ae('0x60')},'attributes':['id',_0x81ae('0x36'),_0x81ae('0x72'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x12a73a){if(!_0x12a73a)return null;_0x1471d4[_0x81ae('0x27')][_0x81ae('0x60')]=_0x12a73a;return _0x1471d4;})[_0x81ae('0x1f')](function(_0x48155e){if(_0x48155e){if(_0x4f9a9f[_0x81ae('0x55')][_0x81ae('0x73')]){_0x1471d4[_0x81ae('0x27')][_0x81ae('0x74')]=util[_0x81ae('0x5c')](_0x81ae('0x75'),_0x4f9a9f[_0x81ae('0x5f')]['name']);_0x1471d4[_0x81ae('0x27')][_0x81ae('0x76')]=_0x1471d4['channel'];_0x1471d4[_0x81ae('0x27')]['motionChannel']=_0x1471d4[_0x81ae('0x76')];_0x1471d4[_0x81ae('0x27')][_0x81ae('0x77')]=_0x81ae('0x58');return respondWithRpcPromise(_0x81ae('0x78'),'EventManager',{'event':_0x81ae('0x79'),'message':_0x1471d4[_0x81ae('0x27')]},client9002)[_0x81ae('0x1f')](function(){return _0x1471d4;});}return _0x1471d4;}return null;})[_0x81ae('0x1f')](respondWithResult(_0x3ff490,null))[_0x81ae('0x29')](handleError(_0x3ff490,null));};var interaction_log=require('../../config/logger')(_0x81ae('0x57'));exports['reject']=function(_0x5ec1ef,_0x618635,_0xfbf13d){var _0x5a4058={'agent':{},'channel':_0x81ae('0x59')};if(_0x5ec1ef['body']['id']){delete _0x5ec1ef['body']['id'];}_0x5ec1ef[_0x81ae('0x55')][_0x81ae('0x5e')]=_0x5ec1ef[_0x81ae('0x55')][_0x81ae('0x5e')]||_0x5ec1ef[_0x81ae('0x5f')]['id'];_0x5a4058[_0x81ae('0x60')]['id']=_0x5ec1ef[_0x81ae('0x55')][_0x81ae('0x5e')];return db[_0x81ae('0x38')][_0x81ae('0x54')]({'where':{'id':_0x5ec1ef[_0x81ae('0x51')]['id'],'UserId':null}})[_0x81ae('0x1f')](handleEntityNotFound(_0x618635,null))[_0x81ae('0x1f')](function(_0x56d14e){if(_0x56d14e){_0x5a4058[_0x81ae('0x27')]=_0x56d14e[_0x81ae('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x81ae('0x54')]({'where':{'id':_0x56d14e[_0x81ae('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x618635,null))[_0x81ae('0x1f')](function(_0xe35af6){if(_0xe35af6){_0x5a4058[_0x81ae('0x66')]=_0xe35af6[_0x81ae('0x61')]({'plain':!![]});interaction_log[_0x81ae('0x20')](_0x81ae('0x7a'),_0x5ec1ef['user']['id'],_0x5ec1ef[_0x81ae('0x5f')][_0x81ae('0x36')],_0x5ec1ef[_0x81ae('0x5f')][_0x81ae('0x68')],_0x5a4058[_0x81ae('0x66')]['id'],_0x5ec1ef[_0x81ae('0x55')]?JSON[_0x81ae('0x7b')](_0x5ec1ef['body']):_0x81ae('0x69'));return respondWithRpcPromise(_0x81ae('0x7c'),_0x81ae('0x7d'),_0x5a4058);}return null;})['then'](function(_0x1cab7e){var _0x586bff=_0x81ae('0x7e')+_0x1cab7e[_0x81ae('0x27')][_0x81ae('0x6c')];return db['sequelize'][_0x81ae('0x40')](_0x586bff,{'type':db['Sequelize'][_0x81ae('0x6e')][_0x81ae('0x6f')],'raw':!![]})[_0x81ae('0x1f')](function(_0x1ccd27){return _0x1ccd27;});})[_0x81ae('0x1f')](function(_0x4b503a){if(_0x4b503a){_0x5a4058[_0x81ae('0x27')]['contact']=_0x4b503a[0x0];if(!_0x5ec1ef[_0x81ae('0x55')]['UserId'])return;return db[_0x81ae('0x71')]['find']({'where':{'id':_0x5ec1ef[_0x81ae('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x81ae('0x36'),_0x81ae('0x72'),_0x81ae('0x7f'),_0x81ae('0x80')],'raw':!![]});}return null;})[_0x81ae('0x1f')](function(_0x2fc111){if(!_0x2fc111)return null;_0x5a4058[_0x81ae('0x27')][_0x81ae('0x60')]=_0x2fc111;return _0x5a4058;})[_0x81ae('0x1f')](function(_0x5f17a0){if(_0x5f17a0){_0x5f17a0[_0x81ae('0x27')][_0x81ae('0x74')]=util[_0x81ae('0x5c')]('SIP/%s',_0x5ec1ef[_0x81ae('0x5f')]['name']);_0x5f17a0[_0x81ae('0x27')][_0x81ae('0x76')]=_0x5a4058[_0x81ae('0x76')];_0x5f17a0[_0x81ae('0x27')]['motionChannel']=_0x5a4058[_0x81ae('0x76')];_0x5f17a0[_0x81ae('0x27')][_0x81ae('0x77')]='reject';respondWithRpcPromise('EventManager',_0x81ae('0x78'),{'event':_0x81ae('0x81'),'message':_0x5f17a0[_0x81ae('0x27')]},client9002);return _0x5a4058;}return null;})['then'](respondWithResult(_0x618635,null))[_0x81ae('0x29')](handleError(_0x618635,null));};exports[_0x81ae('0x82')]=function(_0x504ed2,_0x451cc9){var _0xade6c;return db[_0x81ae('0x38')]['create'](_0x504ed2['body'],{})[_0x81ae('0x1f')](function(_0xf6560e){_0xade6c=_0xf6560e;return db['CmContact']['findOne']({'where':{'id':_0xade6c[_0x81ae('0x6c')]}});})[_0x81ae('0x1f')](function(_0x2e0abe){if(_['isNil'](_0x2e0abe)){return;}else{_0xade6c[_0x81ae('0x59')]=_0x2e0abe[_0x81ae('0x59')];return db['Attachment'][_0x81ae('0x83')]({'where':{'id':_0xade6c['AttachmentId']}});}})[_0x81ae('0x1f')](function(_0x3cdece){return respondWithRpcPromise(_0x81ae('0x84'),'SendFax',{'FaxAccountId':_['isNil'](_0x504ed2[_0x81ae('0x55')])?undefined:_0x504ed2[_0x81ae('0x55')][_0x81ae('0x85')],'path':_['isNil'](_0x3cdece)?undefined:util[_0x81ae('0x5c')](_0x81ae('0x86'),_0x3cdece[_0x81ae('0x87')]),'fax':_[_0x81ae('0x64')](_0xade6c['fax'])?undefined:_0xade6c[_0x81ae('0x59')],'AttachmentId':_0xade6c[_0x81ae('0x88')]},client9002);})[_0x81ae('0x1f')](respondWithResult(_0x451cc9,0xc9))[_0x81ae('0x29')](handleError(_0x451cc9,null));};exports[_0x81ae('0x89')]=function(_0x153f33,_0x1f0402){var _0x598a52=path['join'](config[_0x81ae('0x8a')],_0x81ae('0x8b'),_0x81ae('0x8c'),_0x81ae('0x8d'));return db[_0x81ae('0x38')]['find']({'where':{'id':_0x153f33[_0x81ae('0x51')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x81ae('0x1f')](handleEntityNotFound(_0x1f0402,null))[_0x81ae('0x1f')](function(_0x516b39){if(_0x516b39){return _0x1f0402['download'](path[_0x81ae('0x8e')](_0x598a52,_0x516b39[_0x81ae('0x8f')]['basename']));}})[_0x81ae('0x29')](handleError(_0x1f0402,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 401349f..e47f71f 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 _0x8ce1=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3c1d98,_0x5e8a76){var _0x462c73=function(_0x402ddc){while(--_0x402ddc){_0x3c1d98['push'](_0x3c1d98['shift']());}};_0x462c73(++_0x5e8a76);}(_0x8ce1,0x152));var _0x18ce=function(_0x7b55f9,_0x3006e5){_0x7b55f9=_0x7b55f9-0x0;var _0x22aec1=_0x8ce1[_0x7b55f9];return _0x22aec1;};'use strict';var EventEmitter=require(_0x18ce('0x0'));var FaxMessage=require(_0x18ce('0x1'))['db'][_0x18ce('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x18ce('0x3')](0x0);var events={'afterCreate':_0x18ce('0x4'),'afterUpdate':_0x18ce('0x5'),'afterDestroy':_0x18ce('0x6')};function emitEvent(_0x5e10bb){return function(_0x194532,_0xcffe1d,_0x37947f){FaxMessageEvents[_0x18ce('0x7')](_0x5e10bb+':'+_0x194532['id'],_0x194532);FaxMessageEvents['emit'](_0x5e10bb,_0x194532);_0x37947f(null);};}for(var e in events){if(events[_0x18ce('0x8')](e)){var event=events[e];FaxMessage[_0x18ce('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x9ca0=['save','update','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x3b8611,_0x4ea3f5){var _0x128b1c=function(_0x579708){while(--_0x579708){_0x3b8611['push'](_0x3b8611['shift']());}};_0x128b1c(++_0x4ea3f5);}(_0x9ca0,0x65));var _0x09ca=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x9ca0[_0x186376];return _0x2dbdd9;};'use strict';var EventEmitter=require(_0x09ca('0x0'));var FaxMessage=require(_0x09ca('0x1'))['db'][_0x09ca('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x09ca('0x3'),'afterUpdate':_0x09ca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x138c57){return function(_0x97a39b,_0x5994c6,_0x26f052){FaxMessageEvents['emit'](_0x138c57+':'+_0x97a39b['id'],_0x97a39b);FaxMessageEvents['emit'](_0x138c57,_0x97a39b);_0x26f052(null);};}for(var e in events){if(events[_0x09ca('0x5')](e)){var event=events[e];FaxMessage[_0x09ca('0x6')](e,emitEvent(event));}}module[_0x09ca('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 9dc6786..59541b7 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 _0x2e8f=['request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','out','secret','isNil','FaxInteraction','FaxInteractionId','then','update','createdAt','direction','error','utf8mb4','lodash','../../config/logger','moment'];(function(_0x35b343,_0x402267){var _0x2e9166=function(_0x15f353){while(--_0x15f353){_0x35b343['push'](_0x35b343['shift']());}};_0x2e9166(++_0x402267);}(_0x2e8f,0x183));var _0xf2e8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2e8f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf2e8('0x0'));var util=require('util');var logger=require(_0xf2e8('0x1'))('api');var moment=require(_0xf2e8('0x2'));var BPromise=require('bluebird');var rp=require(_0xf2e8('0x3'));var fs=require('fs');var path=require(_0xf2e8('0x4'));var rimraf=require('rimraf');var config=require(_0xf2e8('0x5'));var attributes=require(_0xf2e8('0x6'));module[_0xf2e8('0x7')]=function(_0x539f5b,_0x3eacca){return _0x539f5b['define'](_0xf2e8('0x8'),attributes,{'tableName':_0xf2e8('0x9'),'paranoid':![],'indexes':[{'name':_0xf2e8('0xa'),'fields':[_0xf2e8('0xb')],'type':_0xf2e8('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47fc64,_0xda79f9,_0x249a35){var _0x571263=_0x539f5b[_0xf2e8('0xd')];var _0x5b5021=_0x47fc64['get']({'plain':!![]});if(_0x5b5021['direction'][_0xf2e8('0xe')]()==='in'||_0x5b5021['direction']['toLowerCase']()===_0xf2e8('0xf')&&!_0x5b5021[_0xf2e8('0x10')]&&!_[_0xf2e8('0x11')](_0x5b5021['UserId'])){_0x571263[_0xf2e8('0x12')]['findOne']({'where':{'id':_0x5b5021[_0xf2e8('0x13')]}})[_0xf2e8('0x14')](function(_0x46f605){if(_0x46f605){_0x46f605[_0xf2e8('0x15')]({'lastMsgAt':_0x5b5021[_0xf2e8('0x16')],'lastMsgDirection':_0x5b5021[_0xf2e8('0x17')][_0xf2e8('0xe')]()});}})['catch'](function(_0x42dfc0){console[_0xf2e8('0x18')](_0x42dfc0);});}_0x249a35();}},'charset':_0xf2e8('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8319=['define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8319,0x149));var _0x9831=function(_0x2624ff,_0xb8fd6c){_0x2624ff=_0x2624ff-0x0;var _0x358015=_0x8319[_0x2624ff];return _0x358015;};'use strict';var _=require(_0x9831('0x0'));var util=require(_0x9831('0x1'));var logger=require(_0x9831('0x2'))(_0x9831('0x3'));var moment=require('moment');var BPromise=require(_0x9831('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9831('0x5'));var config=require(_0x9831('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x509fe6,_0x42c1b4){return _0x509fe6[_0x9831('0x7')](_0x9831('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9831('0x9'),'fields':[_0x9831('0xa')],'type':_0x9831('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b84b4,_0x61de7f,_0x14180f){var _0x56676c=_0x509fe6[_0x9831('0xc')];var _0x57640b=_0x4b84b4[_0x9831('0xd')]({'plain':!![]});if(_0x57640b['direction']['toLowerCase']()==='in'||_0x57640b[_0x9831('0xe')][_0x9831('0xf')]()===_0x9831('0x10')&&!_0x57640b[_0x9831('0x11')]&&!_[_0x9831('0x12')](_0x57640b[_0x9831('0x13')])){_0x56676c[_0x9831('0x14')][_0x9831('0x15')]({'where':{'id':_0x57640b['FaxInteractionId']}})[_0x9831('0x16')](function(_0x382045){if(_0x382045){_0x382045[_0x9831('0x17')]({'lastMsgAt':_0x57640b['createdAt'],'lastMsgDirection':_0x57640b['direction'][_0x9831('0xf')]()});}})[_0x9831('0x18')](function(_0x198b6c){console[_0x9831('0x19')](_0x198b6c);});}_0x14180f();}},'charset':_0x9831('0x1a'),'collate':_0x9831('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f73c07a..f950808 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 _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x1fde89,_0x342ec0){var _0x112aa9=function(_0xdb83a0){while(--_0xdb83a0){_0x1fde89['push'](_0x1fde89['shift']());}};_0x112aa9(++_0x342ec0);}(_0x032e,0x124));var _0xe032=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x032e[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d884b,_0x3f9ba6){var _0x4c6d6b=function(_0x98a1f6){while(--_0x98a1f6){_0x4d884b['push'](_0x4d884b['shift']());}};_0x4c6d6b(++_0x3f9ba6);}(_0x54ef,0x112));var _0xf54e=function(_0x3d43c3,_0x54884e){_0x3d43c3=_0x3d43c3-0x0;var _0x4f2b53=_0x54ef[_0x3d43c3];return _0x4f2b53;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d1cf584..a91f4a1 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 _0xc36a=['length','faxMessage:','./faxMessage.events','save','remove','update','emit','register'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0xc36a,0x1a2));var _0xac36=function(_0x576451,_0x5b40ef){_0x576451=_0x576451-0x0;var _0x766481=_0xc36a[_0x576451];return _0x766481;};'use strict';var FaxMessageEvents=require(_0xac36('0x0'));var events=[_0xac36('0x1'),_0xac36('0x2'),_0xac36('0x3')];function createListener(_0xd4caf8,_0x4a55df){return function(_0x51c26d){_0x4a55df[_0xac36('0x4')](_0xd4caf8,_0x51c26d);};}function removeListener(_0x5cd4d7,_0x38ab77){return function(){FaxMessageEvents['removeListener'](_0x5cd4d7,_0x38ab77);};}exports[_0xac36('0x5')]=function(_0xb30315){for(var _0x5e19ce=0x0,_0x5e7ffa=events[_0xac36('0x6')];_0x5e19ce<_0x5e7ffa;_0x5e19ce++){var _0x50f02e=events[_0x5e19ce];var _0x1e0742=createListener(_0xac36('0x7')+_0x50f02e,_0xb30315);FaxMessageEvents['on'](_0x50f02e,_0x1e0742);}}; \ No newline at end of file +var _0x8eb0=['./faxMessage.events','save','remove','update','removeListener','register','length','faxMessage:'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8eb0,0x1d8));var _0x08eb=function(_0x2decf3,_0x22053f){_0x2decf3=_0x2decf3-0x0;var _0x5ae034=_0x8eb0[_0x2decf3];return _0x5ae034;};'use strict';var FaxMessageEvents=require(_0x08eb('0x0'));var events=[_0x08eb('0x1'),_0x08eb('0x2'),_0x08eb('0x3')];function createListener(_0x1e446a,_0x53cda0){return function(_0x4d16cd){_0x53cda0['emit'](_0x1e446a,_0x4d16cd);};}function removeListener(_0x1c8347,_0x39070d){return function(){FaxMessageEvents[_0x08eb('0x4')](_0x1c8347,_0x39070d);};}exports[_0x08eb('0x5')]=function(_0x1454d3){for(var _0x4be54e=0x0,_0x4f9d25=events[_0x08eb('0x6')];_0x4be54e<_0x4f9d25;_0x4be54e++){var _0x2f55f3=events[_0x4be54e];var _0x129b3c=createListener(_0x08eb('0x7')+_0x2f55f3,_0x1454d3);FaxMessageEvents['on'](_0x2f55f3,_0x129b3c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0ab36d4..611945a 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 _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x1e9287,_0x37f584){var _0x44342e=function(_0x2f559e){while(--_0x2f559e){_0x1e9287['push'](_0x1e9287['shift']());}};_0x44342e(++_0x37f584);}(_0xcea2,0x15a));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5e00c2,_0x1d0f51){var _0x13bd1c=function(_0x3f5957){while(--_0x3f5957){_0x5e00c2['push'](_0x5e00c2['shift']());}};_0x13bd1c(++_0x1d0f51);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x0fd9[_0x2a4095];return _0x52eeab;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 89f77c4..77f830a 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 _0x51a9=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1678f2,_0x2ecc97){var _0x418a84=function(_0x5a1a8e){while(--_0x5a1a8e){_0x1678f2['push'](_0x1678f2['shift']());}};_0x418a84(++_0x2ecc97);}(_0x51a9,0x86));var _0x951a=function(_0x3a373e,_0x2e9017){_0x3a373e=_0x3a373e-0x0;var _0x51339d=_0x51a9[_0x3a373e];return _0x51339d;};'use strict';var Sequelize=require(_0x951a('0x0'));module[_0x951a('0x1')]={'name':{'type':Sequelize[_0x951a('0x2')],'unique':_0x951a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x951a('0x2')]},'timeout':{'type':Sequelize[_0x951a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x951a('0x5'),_0x951a('0x6'),_0x951a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x951a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6233=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x4ff349,_0x5c1bd8){var _0x195934=function(_0x41a6d6){while(--_0x41a6d6){_0x4ff349['push'](_0x4ff349['shift']());}};_0x195934(++_0x5c1bd8);}(_0x6233,0xba));var _0x3623=function(_0x57cf6a,_0x512502){_0x57cf6a=_0x57cf6a-0x0;var _0x124932=_0x6233[_0x57cf6a];return _0x124932;};'use strict';var Sequelize=require(_0x3623('0x0'));module['exports']={'name':{'type':Sequelize[_0x3623('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3623('0x1')]},'timeout':{'type':Sequelize[_0x3623('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3623('0x3')](_0x3623('0x4'),_0x3623('0x5'),_0x3623('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3623('0x2')],'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 7420a60..652deea 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 _0x71ab=['Content-Range','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','merge','filter','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','getTeams','Team','pick','ids','findAll','User','Agents','online','voicePause','flatMap','sequelize','each','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','emit','isArray','getAgents','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','limit','undefined','count','offset','set'];(function(_0x246b9a,_0x6e236e){var _0x1e8150=function(_0x337f2e){while(--_0x337f2e){_0x246b9a['push'](_0x246b9a['shift']());}};_0x1e8150(++_0x6e236e);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var util=require(_0xb71a('0x0'));var _=require('lodash');var squel=require(_0xb71a('0x1'));var Redis=require('ioredis');var qs=require(_0xb71a('0x2'));var logger=require(_0xb71a('0x3'))(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var db=require(_0xb71a('0x6'))['db'];config[_0xb71a('0x7')]=_[_0xb71a('0x8')](config[_0xb71a('0x7')],{'host':_0xb71a('0x9'),'port':0x18eb});var socket=require(_0xb71a('0xa'))(new Redis(config[_0xb71a('0x7')]));require(_0xb71a('0xb'))[_0xb71a('0xc')](socket);function respondWithStatusCode(_0x471ab6,_0x18c7a6){_0x18c7a6=_0x18c7a6||0xcc;return function(_0xbfef18){if(_0xbfef18){return _0x471ab6[_0xb71a('0xd')](_0x18c7a6);}return _0x471ab6[_0xb71a('0xe')](_0x18c7a6)['end']();};}function respondWithResult(_0xfec897,_0x58956d){_0x58956d=_0x58956d||0xc8;return function(_0x3d7bd7){if(_0x3d7bd7){return _0xfec897[_0xb71a('0xe')](_0x58956d)[_0xb71a('0xf')](_0x3d7bd7);}};}function respondWithFilteredResult(_0x591311,_0x3909b4){return function(_0x4c167a){if(_0x4c167a){var _0x2a2d75=typeof _0x3909b4['offset']==='undefined'&&typeof _0x3909b4[_0xb71a('0x10')]===_0xb71a('0x11');var _0x315ca8=_0x4c167a[_0xb71a('0x12')];var _0x483d77=_0x2a2d75?0x0:_0x3909b4['offset'];var _0x5364e3=_0x2a2d75?_0x4c167a[_0xb71a('0x12')]:_0x3909b4[_0xb71a('0x13')]+_0x3909b4[_0xb71a('0x10')];var _0x42fc55;if(_0x5364e3>=_0x315ca8){_0x5364e3=_0x315ca8;_0x42fc55=0xc8;}else{_0x42fc55=0xce;}_0x591311[_0xb71a('0xe')](_0x42fc55);return _0x591311[_0xb71a('0x14')](_0xb71a('0x15'),_0x483d77+'-'+_0x5364e3+'/'+_0x315ca8)[_0xb71a('0xf')](_0x4c167a);}return null;};}function saveUpdates(_0x7710a8){return function(_0x5588cf){if(_0x5588cf){return _0x5588cf[_0xb71a('0x16')](_0x7710a8)[_0xb71a('0x17')](function(_0x374c8c){return _0x374c8c;});}return null;};}function removeEntity(_0x346524){return function(_0x2bdb61){if(_0x2bdb61){return _0x2bdb61[_0xb71a('0x18')]()[_0xb71a('0x17')](function(){var _0x7cd1f9=_0x2bdb61[_0xb71a('0x19')]({'plain':!![]});var _0x2eab08=_0xb71a('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2eab08,'resourceId':_0x7cd1f9['id']}})[_0xb71a('0x17')](function(){return _0x2bdb61;});})[_0xb71a('0x17')](function(){_0x346524['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfd1c){return function(_0x4fe4fb){if(!_0x4fe4fb){_0x1cfd1c[_0xb71a('0xd')](0x194);}return _0x4fe4fb;};}function handleError(_0x4227c7,_0x3ac77b){_0x3ac77b=_0x3ac77b||0x1f4;return function(_0x18fa8d){logger[_0xb71a('0x1b')](_0x18fa8d[_0xb71a('0x1c')]);if(_0x18fa8d[_0xb71a('0x1d')]){delete _0x18fa8d[_0xb71a('0x1d')];}_0x4227c7['status'](_0x3ac77b)[_0xb71a('0x1e')](_0x18fa8d);};}exports[_0xb71a('0x1f')]=function(_0x353930,_0xa0743a){var _0x3401f7={};var _0x1a010d={'count':0x0,'rows':[]};var _0x20ed75=_[_0xb71a('0x20')](db[_0xb71a('0x21')][_0xb71a('0x22')],function(_0x45b849){return{'name':_0x45b849[_0xb71a('0x23')],'type':_0x45b849[_0xb71a('0x24')]['key']};});_0x3401f7=qs[_0xb71a('0x25')](_0x20ed75,_0x353930);var _0x39d874={'where':_0x3401f7[_0xb71a('0x26')]};return db[_0xb71a('0x21')][_0xb71a('0x12')](_0x39d874)[_0xb71a('0x17')](function(_0x44826e){_0x1a010d[_0xb71a('0x12')]=_0x44826e;_0x3401f7[_0xb71a('0x27')]=qs[_0xb71a('0x27')](_0x353930[_0xb71a('0x28')]);return db['FaxQueue']['findAll'](_0x3401f7);})[_0xb71a('0x17')](function(_0x5c2a45){_0x1a010d[_0xb71a('0x29')]=_0x5c2a45;return _0x1a010d;})[_0xb71a('0x17')](respondWithFilteredResult(_0xa0743a,_0x3401f7))['catch'](handleError(_0xa0743a,null));};exports[_0xb71a('0x2a')]=function(_0xa42f25,_0x1fe058){var _0x251d82={'raw':!![],'where':{'id':_0xa42f25[_0xb71a('0x2b')]['id']}},_0x3d3d81={};_0x3d3d81['model']=_[_0xb71a('0x2c')](db[_0xb71a('0x21')][_0xb71a('0x22')]);_0x3d3d81[_0xb71a('0x28')]=_['keys'](_0xa42f25[_0xb71a('0x28')]);_0x3d3d81[_0xb71a('0x2d')]=_[_0xb71a('0x2e')](_0x3d3d81[_0xb71a('0x2f')],_0x3d3d81[_0xb71a('0x28')]);_0x251d82[_0xb71a('0x30')]=_[_0xb71a('0x2e')](_0x3d3d81[_0xb71a('0x2f')],qs[_0xb71a('0x31')](_0xa42f25[_0xb71a('0x28')]['fields']));_0x251d82['attributes']=_0x251d82[_0xb71a('0x30')][_0xb71a('0x32')]?_0x251d82[_0xb71a('0x30')]:_0x3d3d81[_0xb71a('0x2f')];if(_0xa42f25[_0xb71a('0x28')][_0xb71a('0x33')]){_0x251d82[_0xb71a('0x27')]=[{'all':!![]}];}_0x251d82=_['merge']({},_0x251d82,_0xa42f25[_0xb71a('0x34')]);return db['FaxQueue'][_0xb71a('0x35')](_0x251d82)[_0xb71a('0x17')](handleEntityNotFound(_0x1fe058,null))[_0xb71a('0x17')](respondWithResult(_0x1fe058,null))[_0xb71a('0x36')](handleError(_0x1fe058,null));};exports['create']=function(_0x39d12c,_0x3ff4ed){return db[_0xb71a('0x21')][_0xb71a('0x37')](_0x39d12c[_0xb71a('0x38')],{})[_0xb71a('0x17')](function(_0x4571c0){var _0x2756b9=_0x39d12c[_0xb71a('0x39')]['get']({'plain':!![]});if(!_0x2756b9)throw new Error(_0xb71a('0x3a'));if(_0x2756b9['role']===_0xb71a('0x39')){var _0x2ba298=_0x4571c0[_0xb71a('0x19')]({'plain':!![]});var _0x3cca63=_0xb71a('0x1a');return db[_0xb71a('0x3b')]['find']({'where':{'name':_0x3cca63,'userProfileId':_0x2756b9['userProfileId']},'raw':!![]})['then'](function(_0x35fea9){if(_0x35fea9&&_0x35fea9['autoAssociation']===0x0){return db[_0xb71a('0x3c')][_0xb71a('0x37')]({'name':_0x2ba298[_0xb71a('0x1d')],'resourceId':_0x2ba298['id'],'type':_0x35fea9[_0xb71a('0x1d')],'sectionId':_0x35fea9['id']},{})[_0xb71a('0x17')](function(){return _0x4571c0;});}else{return _0x4571c0;}})[_0xb71a('0x36')](function(_0x59530a){logger[_0xb71a('0x1b')](_0xb71a('0x3d'),_0x59530a);throw _0x59530a;});}return _0x4571c0;})[_0xb71a('0x17')](respondWithResult(_0x3ff4ed,0xc9))[_0xb71a('0x36')](handleError(_0x3ff4ed,null));};exports[_0xb71a('0x16')]=function(_0x2f08d2,_0x55cbca){if(_0x2f08d2[_0xb71a('0x38')]['id']){delete _0x2f08d2[_0xb71a('0x38')]['id'];}return db[_0xb71a('0x21')][_0xb71a('0x35')]({'where':{'id':_0x2f08d2[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x55cbca,null))[_0xb71a('0x17')](saveUpdates(_0x2f08d2['body'],null))['then'](respondWithResult(_0x55cbca,null))[_0xb71a('0x36')](handleError(_0x55cbca,null));};exports[_0xb71a('0x18')]=function(_0x2f6b72,_0x273964){return db['FaxQueue'][_0xb71a('0x35')]({'where':{'id':_0x2f6b72['params']['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x273964,null))[_0xb71a('0x17')](removeEntity(_0x273964,null))['catch'](handleError(_0x273964,null));};exports[_0xb71a('0x3e')]=function(_0x274a94,_0x1129ab){return db[_0xb71a('0x21')]['describe']()[_0xb71a('0x17')](respondWithResult(_0x1129ab,null))[_0xb71a('0x36')](handleError(_0x1129ab,null));};exports[_0xb71a('0x3f')]=function(_0x5516bd,_0x350c89){var _0x1cd434={'raw':!![],'where':{}},_0x29b0bd={},_0x5e9eea;return db[_0xb71a('0x21')][_0xb71a('0x40')]({'where':{'id':_0x5516bd[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x350c89,null))[_0xb71a('0x17')](function(_0x550a67){if(_0x550a67){_0x5e9eea=_0x550a67[_0xb71a('0x19')]({'plain':!![]});_0x29b0bd[_0xb71a('0x2f')]=_[_0xb71a('0x2c')](db[_0xb71a('0x41')]['rawAttributes']);_0x29b0bd['query']=_[_0xb71a('0x2c')](_0x5516bd[_0xb71a('0x28')]);_0x29b0bd[_0xb71a('0x2d')]=_[_0xb71a('0x2e')](_0x29b0bd[_0xb71a('0x2f')],_0x29b0bd[_0xb71a('0x28')]);_0x1cd434[_0xb71a('0x30')]=_[_0xb71a('0x2e')](_0x29b0bd[_0xb71a('0x2f')],qs[_0xb71a('0x31')](_0x5516bd['query'][_0xb71a('0x31')]));_0x1cd434[_0xb71a('0x30')]=_0x1cd434['attributes'][_0xb71a('0x32')]?_0x1cd434['attributes']:_0x29b0bd[_0xb71a('0x2f')];if(!_0x5516bd[_0xb71a('0x28')][_0xb71a('0x42')](_0xb71a('0x43'))){_0x1cd434[_0xb71a('0x10')]=qs['limit'](_0x5516bd[_0xb71a('0x28')]['limit']);_0x1cd434[_0xb71a('0x13')]=qs[_0xb71a('0x13')](_0x5516bd['query']['offset']);}_0x1cd434[_0xb71a('0x44')]=qs[_0xb71a('0x45')](_0x5516bd['query']['sort']);_0x1cd434['where']=qs[_0xb71a('0x2d')](_['pick'](_0x5516bd['query'],_0x29b0bd[_0xb71a('0x2d')]));_0x1cd434[_0xb71a('0x26')][_0xb71a('0x46')]=_0x550a67['id'];if(_0x5516bd[_0xb71a('0x28')]['filter']){_0x1cd434[_0xb71a('0x26')]=_[_0xb71a('0x47')](_0x1cd434[_0xb71a('0x26')],{'$or':_['map'](_0x1cd434[_0xb71a('0x30')],function(_0x7de9e6){var _0x4dee60={};_0x4dee60[_0x7de9e6]={'$like':'%'+_0x5516bd[_0xb71a('0x28')][_0xb71a('0x48')]+'%'};return _0x4dee60;})});}_0x1cd434=_[_0xb71a('0x47')]({},_0x1cd434,_0x5516bd['options']);return db[_0xb71a('0x41')]['findAll'](_0x1cd434);}})[_0xb71a('0x17')](function(_0x32c774){if(_0x32c774){return db['User'][_0xb71a('0x49')]({'where':{'id':_[_0xb71a('0x20')](_0x32c774,_0xb71a('0x4a')),'role':_0xb71a('0x4b')},'attributes':['id',_0xb71a('0x1d'),_0xb71a('0x4c'),_0xb71a('0x4d'),'createdAt']});}})['then'](function(_0x19c72d){if(_0x19c72d){return{'count':_0x19c72d[_0xb71a('0x12')],'rows':_[_0xb71a('0x20')](_0x19c72d[_0xb71a('0x29')],function(_0x4002fc){return{'membername':_0x4002fc['name'],'UserId':_0x4002fc['id'],'queue_name':_0x5e9eea['name'],'FaxQueueId':_0x5e9eea['id'],'interface':util[_0xb71a('0x4e')](_0xb71a('0x4f'),'SIP',_0x4002fc[_0xb71a('0x1d')]),'penalty':0x0,'paused':_0x4002fc[_0xb71a('0x4c')],'createdAt':_0x4002fc['createdAt'],'updatedAt':_0x4002fc[_0xb71a('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb71a('0x17')](respondWithFilteredResult(_0x350c89,_0x1cd434))[_0xb71a('0x36')](handleError(_0x350c89,null));};exports[_0xb71a('0x50')]=function(_0x59e2a0,_0x22146b){var _0x32e9e5={};var _0x4c80f8={};var _0x471c3c;var _0x73f725;return db[_0xb71a('0x21')][_0xb71a('0x40')]({'where':{'id':_0x59e2a0[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x22146b,null))[_0xb71a('0x17')](function(_0xac0cee){if(_0xac0cee){_0x471c3c=_0xac0cee;_0x4c80f8['model']=_[_0xb71a('0x2c')](db[_0xb71a('0x51')]['rawAttributes']);_0x4c80f8[_0xb71a('0x28')]=_[_0xb71a('0x2c')](_0x59e2a0['query']);_0x4c80f8[_0xb71a('0x2d')]=_[_0xb71a('0x2e')](_0x4c80f8[_0xb71a('0x2f')],_0x4c80f8[_0xb71a('0x28')]);_0x32e9e5[_0xb71a('0x30')]=_[_0xb71a('0x2e')](_0x4c80f8['model'],qs['fields'](_0x59e2a0[_0xb71a('0x28')][_0xb71a('0x31')]));_0x32e9e5[_0xb71a('0x30')]=_0x32e9e5['attributes'][_0xb71a('0x32')]?_0x32e9e5['attributes']:_0x4c80f8[_0xb71a('0x2f')];_0x32e9e5['order']=qs['sort'](_0x59e2a0[_0xb71a('0x28')][_0xb71a('0x45')]);_0x32e9e5[_0xb71a('0x26')]=qs[_0xb71a('0x2d')](_[_0xb71a('0x52')](_0x59e2a0['query'],_0x4c80f8[_0xb71a('0x2d')]));if(_0x59e2a0['query'][_0xb71a('0x48')]){_0x32e9e5[_0xb71a('0x26')]=_[_0xb71a('0x47')](_0x32e9e5['where'],{'$or':_['map'](_0x32e9e5[_0xb71a('0x30')],function(_0x39ee35){var _0x1a96fc={};_0x1a96fc[_0x39ee35]={'$like':'%'+_0x59e2a0[_0xb71a('0x28')][_0xb71a('0x48')]+'%'};return _0x1a96fc;})});}_0x32e9e5=_['merge']({},_0x32e9e5,_0x59e2a0[_0xb71a('0x34')]);return _0x471c3c[_0xb71a('0x50')](_0x32e9e5);}})[_0xb71a('0x17')](function(_0x2b32fc){if(_0x2b32fc){_0x73f725=_0x2b32fc[_0xb71a('0x32')];if(!_0x59e2a0['query']['hasOwnProperty'](_0xb71a('0x43'))){_0x32e9e5[_0xb71a('0x10')]=qs[_0xb71a('0x10')](_0x59e2a0[_0xb71a('0x28')][_0xb71a('0x10')]);_0x32e9e5[_0xb71a('0x13')]=qs[_0xb71a('0x13')](_0x59e2a0['query'][_0xb71a('0x13')]);}return _0x471c3c[_0xb71a('0x50')](_0x32e9e5);}})['then'](function(_0x3a21e2){if(_0x3a21e2){return _0x3a21e2?{'count':_0x73f725,'rows':_0x3a21e2}:null;}})[_0xb71a('0x17')](respondWithResult(_0x22146b,null))[_0xb71a('0x36')](handleError(_0x22146b,null));};exports['addTeams']=function(_0x6d255e,_0x1971ce){var _0x83cfaa=_0x6d255e['body'][_0xb71a('0x53')];return db[_0xb71a('0x51')][_0xb71a('0x54')]({'where':{'id':_0x83cfaa},'attributes':['id'],'include':[{'model':db[_0xb71a('0x55')],'as':_0xb71a('0x56'),'attributes':['id',_0xb71a('0x1d'),_0xb71a('0x57'),_0xb71a('0x58'),'interface'],'raw':!![]}]})[_0xb71a('0x17')](function(_0x507da4){if(_0x507da4){var _0x57896d=_[_0xb71a('0x59')](_0x507da4,function(_0x43e4b8){var _0x2cf441=_0x43e4b8[_0xb71a('0x19')]({'plain':!![]});return _0x2cf441['Agents'];});return db[_0xb71a('0x21')]['find']({'where':{'id':_0x6d255e[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](function(_0x5e9964){return db[_0xb71a('0x5a')]['transaction'](function(_0x15995f){return _0x5e9964['addTeams'](_0x83cfaa,{'transaction':_0x15995f})[_0xb71a('0x17')](function(){return BPromise[_0xb71a('0x5b')](_0x57896d,function(_0x208585){return db[_0xb71a('0x41')]['findOrCreate']({'where':{'UserId':_0x208585['id'],'FaxQueueId':_0x6d255e[_0xb71a('0x2b')]['id']},'transaction':_0x15995f});});})[_0xb71a('0x17')](function(){_0x57896d['forEach'](function(_0x2c7157){socket['emit']('userFaxQueue:save',{'UserId':_0x2c7157['id'],'FaxQueueId':_0x5e9964['id']});});});});});}})['then'](respondWithStatusCode(_0x1971ce,null))['catch'](handleError(_0x1971ce,null));};exports[_0xb71a('0x5c')]=function(_0x1e27ff,_0xdda01d){return db['Team'][_0xb71a('0x54')]({'where':{'id':_0x1e27ff[_0xb71a('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb71a('0x55')],'as':_0xb71a('0x56'),'attributes':['id'],'raw':!![]}]})[_0xb71a('0x17')](handleEntityNotFound(_0xdda01d,null))[_0xb71a('0x17')](function(_0x3209d3){var _0x16fbc1=_['map'](_0x3209d3,'id');var _0x456350=[];var _0x2772f8=[];var _0xf6a6ee=squel[_0xb71a('0x5d')]();_0xf6a6ee[_0xb71a('0x5e')](_0xb71a('0x5f'))['from'](_0xb71a('0x60'),'tq')[_0xb71a('0x61')]('user_has_teams','ut',_0xb71a('0x62'))[_0xb71a('0x26')](_0xb71a('0x63'),_0x1e27ff['params']['id']);for(var _0x3ab7f5=0x0;_0x3ab7f5<_0x3209d3[_0xb71a('0x32')];_0x3ab7f5+=0x1){let _0x28bc74=_0x3209d3[_0x3ab7f5];for(var _0x575a0a=0x0;_0x575a0a<_0x28bc74[_0xb71a('0x56')][_0xb71a('0x32')];_0x575a0a+=0x1){let _0x5c0fd6=_0x28bc74[_0xb71a('0x56')][_0x575a0a];var _0x3076c1=_0xf6a6ee[_0xb71a('0x64')]();_0x3076c1[_0xb71a('0x26')]('ut.UserId\x20=\x20?',_0x5c0fd6['id']);_0x2772f8[_0xb71a('0x65')](db[_0xb71a('0x5a')][_0xb71a('0x28')](_0x3076c1[_0xb71a('0x66')](),{'type':db['sequelize'][_0xb71a('0x67')][_0xb71a('0x68')]})['then'](function(_0x3c4d1b){if(_0x3c4d1b[_0xb71a('0x32')]===0x1){return _0x5c0fd6['id'];}else{var _0x5df234=_[_0xb71a('0x69')](_[_0xb71a('0x20')](_0x3c4d1b,_0xb71a('0x6a')),function(_0x572810){return _[_0xb71a('0x6b')](_0x16fbc1,_0x572810);});if(_0x5df234){return _0x5c0fd6['id'];}}}));}}return BPromise[_0xb71a('0x6c')](_0x2772f8)[_0xb71a('0x17')](function(_0xd5ff7b){_0x456350=_(_0x456350)[_0xb71a('0x6d')](_0xd5ff7b)[_0xb71a('0x6e')]()[_0xb71a('0x6f')]();return db[_0xb71a('0x21')][_0xb71a('0x35')]({'where':{'id':_0x1e27ff['params']['id']}})['then'](function(_0x36a75e){return db[_0xb71a('0x5a')][_0xb71a('0x70')](function(_0x1ee5d1){return _0x36a75e[_0xb71a('0x5c')](_0x1e27ff[_0xb71a('0x28')]['ids'],{'transaction':_0x1ee5d1})[_0xb71a('0x17')](function(){if(!_['isEmpty'](_0x456350)){return _0x36a75e[_0xb71a('0x71')](_0x456350,{'transaction':_0x1ee5d1});}})['then'](function(){_0x456350[_0xb71a('0x72')](function(_0x2b5ef8){socket['emit'](_0xb71a('0x73'),{'UserId':_0x2b5ef8,'FaxQueueId':_0x36a75e['id']});});});});});});})[_0xb71a('0x17')](respondWithStatusCode(_0xdda01d,null))[_0xb71a('0x36')](handleError(_0xdda01d,null));};exports[_0xb71a('0x74')]=function(_0x218517,_0x49146b){return db[_0xb71a('0x21')][_0xb71a('0x35')]({'where':{'id':_0x218517['params']['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x49146b,null))[_0xb71a('0x17')](function(_0x533316){if(_0x533316){return _0x533316[_0xb71a('0x74')](_0x218517[_0xb71a('0x38')][_0xb71a('0x53')],_['omit'](_0x218517[_0xb71a('0x38')],[_0xb71a('0x53'),'id'])||{})[_0xb71a('0x75')](function(_0x5f57da){for(var _0x13b3a8=0x0;_0x13b3a8<_0x218517[_0xb71a('0x38')][_0xb71a('0x53')][_0xb71a('0x32')];_0x13b3a8+=0x1){socket[_0xb71a('0x76')]('userFaxQueue:save',{'UserId':Number(_0x218517[_0xb71a('0x38')]['ids'][_0x13b3a8]),'FaxQueueId':Number(_0x218517[_0xb71a('0x2b')]['id'])});}return _0x5f57da;});}})[_0xb71a('0x17')](respondWithResult(_0x49146b,null))[_0xb71a('0x36')](handleError(_0x49146b,null));};exports['removeAgents']=function(_0x589618,_0x77dc7){return db[_0xb71a('0x21')][_0xb71a('0x35')]({'where':{'id':_0x589618[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x77dc7,null))[_0xb71a('0x17')](function(_0x38ffc1){if(_0x38ffc1){return _0x38ffc1[_0xb71a('0x71')](_0x589618[_0xb71a('0x28')][_0xb71a('0x53')])[_0xb71a('0x17')](function(){if(_[_0xb71a('0x77')](_0x589618[_0xb71a('0x28')][_0xb71a('0x53')])){for(var _0x464da5=0x0;_0x464da5<_0x589618['query'][_0xb71a('0x53')][_0xb71a('0x32')];_0x464da5+=0x1){socket[_0xb71a('0x76')]('userFaxQueue:remove',{'UserId':Number(_0x589618['query']['ids'][_0x464da5]),'FaxQueueId':Number(_0x589618[_0xb71a('0x2b')]['id'])});}}else{socket['emit'](_0xb71a('0x73'),{'UserId':Number(_0x589618[_0xb71a('0x28')]['ids']),'FaxQueueId':Number(_0x589618['params']['id'])});}});}})[_0xb71a('0x17')](respondWithStatusCode(_0x77dc7,null))[_0xb71a('0x36')](handleError(_0x77dc7,null));};exports[_0xb71a('0x78')]=function(_0x3d6d60,_0x3362be){var _0x86854b={};var _0x1afba9={};var _0x28d4cf;var _0x336d27;return db[_0xb71a('0x21')][_0xb71a('0x40')]({'where':{'id':_0x3d6d60[_0xb71a('0x2b')]['id']}})[_0xb71a('0x17')](handleEntityNotFound(_0x3362be,null))[_0xb71a('0x17')](function(_0x330ef2){if(_0x330ef2){_0x28d4cf=_0x330ef2;_0x1afba9[_0xb71a('0x2f')]=_[_0xb71a('0x2c')](db[_0xb71a('0x55')][_0xb71a('0x22')]);_0x1afba9[_0xb71a('0x28')]=_[_0xb71a('0x2c')](_0x3d6d60[_0xb71a('0x28')]);_0x1afba9['filters']=_[_0xb71a('0x2e')](_0x1afba9[_0xb71a('0x2f')],_0x1afba9[_0xb71a('0x28')]);_0x86854b[_0xb71a('0x30')]=_[_0xb71a('0x2e')](_0x1afba9[_0xb71a('0x2f')],qs[_0xb71a('0x31')](_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x31')]));_0x86854b[_0xb71a('0x30')]=_0x86854b[_0xb71a('0x30')][_0xb71a('0x32')]?_0x86854b[_0xb71a('0x30')]:_0x1afba9[_0xb71a('0x2f')];_0x86854b[_0xb71a('0x44')]=qs[_0xb71a('0x45')](_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x45')]);_0x86854b[_0xb71a('0x26')]=qs[_0xb71a('0x2d')](_['pick'](_0x3d6d60[_0xb71a('0x28')],_0x1afba9[_0xb71a('0x2d')]));if(_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x48')]){_0x86854b[_0xb71a('0x26')]=_[_0xb71a('0x47')](_0x86854b[_0xb71a('0x26')],{'$or':_[_0xb71a('0x20')](_0x86854b['attributes'],function(_0x5e899b){var _0x1e5e4c={};_0x1e5e4c[_0x5e899b]={'$like':'%'+_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x48')]+'%'};return _0x1e5e4c;})});}_0x86854b=_[_0xb71a('0x47')]({},_0x86854b,_0x3d6d60['options']);return _0x28d4cf[_0xb71a('0x78')](_0x86854b);}})[_0xb71a('0x17')](function(_0x46c2a1){if(_0x46c2a1){_0x336d27=_0x46c2a1[_0xb71a('0x32')];if(!_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x42')](_0xb71a('0x43'))){_0x86854b['limit']=qs[_0xb71a('0x10')](_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x10')]);_0x86854b['offset']=qs[_0xb71a('0x13')](_0x3d6d60[_0xb71a('0x28')][_0xb71a('0x13')]);}return _0x28d4cf['getAgents'](_0x86854b);}})[_0xb71a('0x17')](function(_0x398cda){if(_0x398cda){return _0x398cda?{'count':_0x336d27,'rows':_0x398cda}:null;}})[_0xb71a('0x17')](respondWithResult(_0x3362be,null))[_0xb71a('0x36')](handleError(_0x3362be,null));}; \ No newline at end of file +var _0x6d38=['FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','isEmpty','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','removeAgents','isArray','findOne','getAgents','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','stack','name','index','rawAttributes','type','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','keys','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','params','describe','getMembers','UserFaxQueue','filters','order','sort','pick','FaxQueueId','filter','map','User','findAndCountAll','faxPause','createdAt','format','SIP','updatedAt','getTeams','Team','hasOwnProperty','nolimit','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','emit','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x1c9b4d,_0x899840){var _0x750082=function(_0x1bcfe5){while(--_0x1bcfe5){_0x1c9b4d['push'](_0x1c9b4d['shift']());}};_0x750082(++_0x899840);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var BPromise=require('bluebird');var util=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));var squel=require(_0x86d3('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x86d3('0x3'))('api');var config=require(_0x86d3('0x4'));var db=require(_0x86d3('0x5'))['db'];config[_0x86d3('0x6')]=_['defaults'](config[_0x86d3('0x6')],{'host':_0x86d3('0x7'),'port':0x18eb});var socket=require(_0x86d3('0x8'))(new Redis(config[_0x86d3('0x6')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x2aea31,_0x3ab01e){_0x3ab01e=_0x3ab01e||0xcc;return function(_0xf273f5){if(_0xf273f5){return _0x2aea31['sendStatus'](_0x3ab01e);}return _0x2aea31['status'](_0x3ab01e)[_0x86d3('0x9')]();};}function respondWithResult(_0x555e6d,_0x49b436){_0x49b436=_0x49b436||0xc8;return function(_0x5606eb){if(_0x5606eb){return _0x555e6d[_0x86d3('0xa')](_0x49b436)[_0x86d3('0xb')](_0x5606eb);}};}function respondWithFilteredResult(_0x4f216c,_0x9fd6e8){return function(_0x5e9606){if(_0x5e9606){var _0x1a98e8=typeof _0x9fd6e8[_0x86d3('0xc')]===_0x86d3('0xd')&&typeof _0x9fd6e8[_0x86d3('0xe')]===_0x86d3('0xd');var _0x1b8d0a=_0x5e9606[_0x86d3('0xf')];var _0x12ef4a=_0x1a98e8?0x0:_0x9fd6e8['offset'];var _0x1c1ba8=_0x1a98e8?_0x5e9606[_0x86d3('0xf')]:_0x9fd6e8[_0x86d3('0xc')]+_0x9fd6e8[_0x86d3('0xe')];var _0x1ea535;if(_0x1c1ba8>=_0x1b8d0a){_0x1c1ba8=_0x1b8d0a;_0x1ea535=0xc8;}else{_0x1ea535=0xce;}_0x4f216c[_0x86d3('0xa')](_0x1ea535);return _0x4f216c[_0x86d3('0x10')](_0x86d3('0x11'),_0x12ef4a+'-'+_0x1c1ba8+'/'+_0x1b8d0a)['json'](_0x5e9606);}return null;};}function saveUpdates(_0x2d5ba9){return function(_0x281da0){if(_0x281da0){return _0x281da0[_0x86d3('0x12')](_0x2d5ba9)[_0x86d3('0x13')](function(_0x46feec){return _0x46feec;});}return null;};}function removeEntity(_0x120ef3){return function(_0x33e459){if(_0x33e459){return _0x33e459[_0x86d3('0x14')]()[_0x86d3('0x13')](function(){var _0x5e9ecc=_0x33e459[_0x86d3('0x15')]({'plain':!![]});var _0x57c340=_0x86d3('0x16');return db['UserProfileResource']['destroy']({'where':{'type':_0x57c340,'resourceId':_0x5e9ecc['id']}})[_0x86d3('0x13')](function(){return _0x33e459;});})[_0x86d3('0x13')](function(){_0x120ef3[_0x86d3('0xa')](0xcc)[_0x86d3('0x9')]();});}};}function handleEntityNotFound(_0x5654ab){return function(_0x2901de){if(!_0x2901de){_0x5654ab['sendStatus'](0x194);}return _0x2901de;};}function handleError(_0x36e0fa,_0x3fdf67){_0x3fdf67=_0x3fdf67||0x1f4;return function(_0x1ce849){logger['error'](_0x1ce849[_0x86d3('0x17')]);if(_0x1ce849[_0x86d3('0x18')]){delete _0x1ce849[_0x86d3('0x18')];}_0x36e0fa['status'](_0x3fdf67)['send'](_0x1ce849);};}exports[_0x86d3('0x19')]=function(_0x4d5668,_0x3c93d3){var _0x1bea5e={};var _0x3dfecd={'count':0x0,'rows':[]};var _0x3c5fe4=_['map'](db['FaxQueue'][_0x86d3('0x1a')],function(_0x611764){return{'name':_0x611764['fieldName'],'type':_0x611764[_0x86d3('0x1b')]['key']};});_0x1bea5e=qs[_0x86d3('0x1c')](_0x3c5fe4,_0x4d5668);var _0x41e2f0={'where':_0x1bea5e[_0x86d3('0x1d')]};return db[_0x86d3('0x1e')][_0x86d3('0xf')](_0x41e2f0)[_0x86d3('0x13')](function(_0x1f203e){_0x3dfecd[_0x86d3('0xf')]=_0x1f203e;_0x1bea5e[_0x86d3('0x1f')]=qs[_0x86d3('0x1f')](_0x4d5668[_0x86d3('0x20')]);return db[_0x86d3('0x1e')][_0x86d3('0x21')](_0x1bea5e);})[_0x86d3('0x13')](function(_0x5b09f6){_0x3dfecd[_0x86d3('0x22')]=_0x5b09f6;return _0x3dfecd;})[_0x86d3('0x13')](respondWithFilteredResult(_0x3c93d3,_0x1bea5e))[_0x86d3('0x23')](handleError(_0x3c93d3,null));};exports[_0x86d3('0x24')]=function(_0x7709f0,_0x245e39){var _0x4a5ff0={'raw':!![],'where':{'id':_0x7709f0['params']['id']}},_0xba2f49={};_0xba2f49['model']=_[_0x86d3('0x25')](db[_0x86d3('0x1e')][_0x86d3('0x1a')]);_0xba2f49['query']=_[_0x86d3('0x25')](_0x7709f0[_0x86d3('0x20')]);_0xba2f49['filters']=_[_0x86d3('0x26')](_0xba2f49[_0x86d3('0x27')],_0xba2f49[_0x86d3('0x20')]);_0x4a5ff0[_0x86d3('0x28')]=_[_0x86d3('0x26')](_0xba2f49[_0x86d3('0x27')],qs[_0x86d3('0x29')](_0x7709f0[_0x86d3('0x20')]['fields']));_0x4a5ff0['attributes']=_0x4a5ff0['attributes'][_0x86d3('0x2a')]?_0x4a5ff0['attributes']:_0xba2f49[_0x86d3('0x27')];if(_0x7709f0['query'][_0x86d3('0x2b')]){_0x4a5ff0[_0x86d3('0x1f')]=[{'all':!![]}];}_0x4a5ff0=_[_0x86d3('0x2c')]({},_0x4a5ff0,_0x7709f0[_0x86d3('0x2d')]);return db[_0x86d3('0x1e')][_0x86d3('0x2e')](_0x4a5ff0)[_0x86d3('0x13')](handleEntityNotFound(_0x245e39,null))['then'](respondWithResult(_0x245e39,null))[_0x86d3('0x23')](handleError(_0x245e39,null));};exports[_0x86d3('0x2f')]=function(_0x5e2519,_0x178fc6){return db[_0x86d3('0x1e')][_0x86d3('0x2f')](_0x5e2519[_0x86d3('0x30')],{})['then'](function(_0x2984cf){var _0x42ac0d=_0x5e2519[_0x86d3('0x31')]['get']({'plain':!![]});if(!_0x42ac0d)throw new Error(_0x86d3('0x32'));if(_0x42ac0d[_0x86d3('0x33')]===_0x86d3('0x31')){var _0x1be818=_0x2984cf[_0x86d3('0x15')]({'plain':!![]});var _0x3a159d=_0x86d3('0x16');return db[_0x86d3('0x34')]['find']({'where':{'name':_0x3a159d,'userProfileId':_0x42ac0d[_0x86d3('0x35')]},'raw':!![]})[_0x86d3('0x13')](function(_0x2bdc67){if(_0x2bdc67&&_0x2bdc67[_0x86d3('0x36')]===0x0){return db['UserProfileResource'][_0x86d3('0x2f')]({'name':_0x1be818[_0x86d3('0x18')],'resourceId':_0x1be818['id'],'type':_0x2bdc67[_0x86d3('0x18')],'sectionId':_0x2bdc67['id']},{})[_0x86d3('0x13')](function(){return _0x2984cf;});}else{return _0x2984cf;}})['catch'](function(_0x587747){logger[_0x86d3('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x587747);throw _0x587747;});}return _0x2984cf;})['then'](respondWithResult(_0x178fc6,0xc9))[_0x86d3('0x23')](handleError(_0x178fc6,null));};exports[_0x86d3('0x12')]=function(_0x43490a,_0x35d6fe){if(_0x43490a[_0x86d3('0x30')]['id']){delete _0x43490a['body']['id'];}return db[_0x86d3('0x1e')][_0x86d3('0x2e')]({'where':{'id':_0x43490a[_0x86d3('0x38')]['id']}})['then'](handleEntityNotFound(_0x35d6fe,null))[_0x86d3('0x13')](saveUpdates(_0x43490a[_0x86d3('0x30')],null))['then'](respondWithResult(_0x35d6fe,null))[_0x86d3('0x23')](handleError(_0x35d6fe,null));};exports[_0x86d3('0x14')]=function(_0x5d9c61,_0x56f496){return db['FaxQueue'][_0x86d3('0x2e')]({'where':{'id':_0x5d9c61[_0x86d3('0x38')]['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x56f496,null))[_0x86d3('0x13')](removeEntity(_0x56f496,null))[_0x86d3('0x23')](handleError(_0x56f496,null));};exports[_0x86d3('0x39')]=function(_0x56e7dc,_0x37ead6){return db[_0x86d3('0x1e')]['describe']()[_0x86d3('0x13')](respondWithResult(_0x37ead6,null))[_0x86d3('0x23')](handleError(_0x37ead6,null));};exports[_0x86d3('0x3a')]=function(_0xf3619,_0x45db98){var _0x25c253={'raw':!![],'where':{}},_0x4e2cf6={},_0x318e1a;return db[_0x86d3('0x1e')]['findOne']({'where':{'id':_0xf3619[_0x86d3('0x38')]['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x45db98,null))[_0x86d3('0x13')](function(_0x390f23){if(_0x390f23){_0x318e1a=_0x390f23[_0x86d3('0x15')]({'plain':!![]});_0x4e2cf6['model']=_[_0x86d3('0x25')](db[_0x86d3('0x3b')][_0x86d3('0x1a')]);_0x4e2cf6[_0x86d3('0x20')]=_[_0x86d3('0x25')](_0xf3619[_0x86d3('0x20')]);_0x4e2cf6[_0x86d3('0x3c')]=_[_0x86d3('0x26')](_0x4e2cf6[_0x86d3('0x27')],_0x4e2cf6[_0x86d3('0x20')]);_0x25c253[_0x86d3('0x28')]=_[_0x86d3('0x26')](_0x4e2cf6['model'],qs[_0x86d3('0x29')](_0xf3619[_0x86d3('0x20')]['fields']));_0x25c253[_0x86d3('0x28')]=_0x25c253[_0x86d3('0x28')][_0x86d3('0x2a')]?_0x25c253[_0x86d3('0x28')]:_0x4e2cf6[_0x86d3('0x27')];if(!_0xf3619[_0x86d3('0x20')]['hasOwnProperty']('nolimit')){_0x25c253['limit']=qs['limit'](_0xf3619[_0x86d3('0x20')][_0x86d3('0xe')]);_0x25c253[_0x86d3('0xc')]=qs[_0x86d3('0xc')](_0xf3619[_0x86d3('0x20')][_0x86d3('0xc')]);}_0x25c253[_0x86d3('0x3d')]=qs['sort'](_0xf3619[_0x86d3('0x20')][_0x86d3('0x3e')]);_0x25c253[_0x86d3('0x1d')]=qs[_0x86d3('0x3c')](_[_0x86d3('0x3f')](_0xf3619[_0x86d3('0x20')],_0x4e2cf6[_0x86d3('0x3c')]));_0x25c253['where'][_0x86d3('0x40')]=_0x390f23['id'];if(_0xf3619['query'][_0x86d3('0x41')]){_0x25c253[_0x86d3('0x1d')]=_[_0x86d3('0x2c')](_0x25c253[_0x86d3('0x1d')],{'$or':_[_0x86d3('0x42')](_0x25c253['attributes'],function(_0x1ba0bd){var _0x25b3d9={};_0x25b3d9[_0x1ba0bd]={'$like':'%'+_0xf3619[_0x86d3('0x20')]['filter']+'%'};return _0x25b3d9;})});}_0x25c253=_['merge']({},_0x25c253,_0xf3619['options']);return db[_0x86d3('0x3b')]['findAll'](_0x25c253);}})[_0x86d3('0x13')](function(_0x2c5ebf){if(_0x2c5ebf){return db[_0x86d3('0x43')][_0x86d3('0x44')]({'where':{'id':_['map'](_0x2c5ebf,'UserId'),'role':'agent'},'attributes':['id',_0x86d3('0x18'),_0x86d3('0x45'),'updatedAt',_0x86d3('0x46')]});}})[_0x86d3('0x13')](function(_0xa085b2){if(_0xa085b2){return{'count':_0xa085b2[_0x86d3('0xf')],'rows':_[_0x86d3('0x42')](_0xa085b2['rows'],function(_0x194d0a){return{'membername':_0x194d0a[_0x86d3('0x18')],'UserId':_0x194d0a['id'],'queue_name':_0x318e1a[_0x86d3('0x18')],'FaxQueueId':_0x318e1a['id'],'interface':util[_0x86d3('0x47')]('%s/%s',_0x86d3('0x48'),_0x194d0a[_0x86d3('0x18')]),'penalty':0x0,'paused':_0x194d0a['faxPause'],'createdAt':_0x194d0a[_0x86d3('0x46')],'updatedAt':_0x194d0a[_0x86d3('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x86d3('0x13')](respondWithFilteredResult(_0x45db98,_0x25c253))[_0x86d3('0x23')](handleError(_0x45db98,null));};exports[_0x86d3('0x4a')]=function(_0x4029a4,_0x37c5b5){var _0x5541a6={};var _0x52d0c8={};var _0x3876bd;var _0x51a9da;return db['FaxQueue']['findOne']({'where':{'id':_0x4029a4[_0x86d3('0x38')]['id']}})['then'](handleEntityNotFound(_0x37c5b5,null))[_0x86d3('0x13')](function(_0x5f2ed6){if(_0x5f2ed6){_0x3876bd=_0x5f2ed6;_0x52d0c8[_0x86d3('0x27')]=_[_0x86d3('0x25')](db[_0x86d3('0x4b')]['rawAttributes']);_0x52d0c8['query']=_[_0x86d3('0x25')](_0x4029a4[_0x86d3('0x20')]);_0x52d0c8[_0x86d3('0x3c')]=_[_0x86d3('0x26')](_0x52d0c8[_0x86d3('0x27')],_0x52d0c8[_0x86d3('0x20')]);_0x5541a6[_0x86d3('0x28')]=_[_0x86d3('0x26')](_0x52d0c8[_0x86d3('0x27')],qs[_0x86d3('0x29')](_0x4029a4[_0x86d3('0x20')][_0x86d3('0x29')]));_0x5541a6[_0x86d3('0x28')]=_0x5541a6[_0x86d3('0x28')][_0x86d3('0x2a')]?_0x5541a6[_0x86d3('0x28')]:_0x52d0c8[_0x86d3('0x27')];_0x5541a6[_0x86d3('0x3d')]=qs['sort'](_0x4029a4[_0x86d3('0x20')][_0x86d3('0x3e')]);_0x5541a6[_0x86d3('0x1d')]=qs['filters'](_[_0x86d3('0x3f')](_0x4029a4[_0x86d3('0x20')],_0x52d0c8[_0x86d3('0x3c')]));if(_0x4029a4[_0x86d3('0x20')]['filter']){_0x5541a6[_0x86d3('0x1d')]=_['merge'](_0x5541a6[_0x86d3('0x1d')],{'$or':_[_0x86d3('0x42')](_0x5541a6[_0x86d3('0x28')],function(_0x2d4bc1){var _0x2ac37b={};_0x2ac37b[_0x2d4bc1]={'$like':'%'+_0x4029a4['query'][_0x86d3('0x41')]+'%'};return _0x2ac37b;})});}_0x5541a6=_['merge']({},_0x5541a6,_0x4029a4[_0x86d3('0x2d')]);return _0x3876bd[_0x86d3('0x4a')](_0x5541a6);}})['then'](function(_0x2fdd03){if(_0x2fdd03){_0x51a9da=_0x2fdd03[_0x86d3('0x2a')];if(!_0x4029a4[_0x86d3('0x20')][_0x86d3('0x4c')](_0x86d3('0x4d'))){_0x5541a6[_0x86d3('0xe')]=qs[_0x86d3('0xe')](_0x4029a4['query'][_0x86d3('0xe')]);_0x5541a6[_0x86d3('0xc')]=qs[_0x86d3('0xc')](_0x4029a4[_0x86d3('0x20')][_0x86d3('0xc')]);}return _0x3876bd['getTeams'](_0x5541a6);}})[_0x86d3('0x13')](function(_0x9444e5){if(_0x9444e5){return _0x9444e5?{'count':_0x51a9da,'rows':_0x9444e5}:null;}})['then'](respondWithResult(_0x37c5b5,null))[_0x86d3('0x23')](handleError(_0x37c5b5,null));};exports[_0x86d3('0x4e')]=function(_0x97d16a,_0x7710d8){var _0x1d1921=_0x97d16a[_0x86d3('0x30')][_0x86d3('0x4f')];return db[_0x86d3('0x4b')][_0x86d3('0x21')]({'where':{'id':_0x1d1921},'attributes':['id'],'include':[{'model':db[_0x86d3('0x43')],'as':_0x86d3('0x50'),'attributes':['id',_0x86d3('0x18'),_0x86d3('0x51'),_0x86d3('0x52'),'interface'],'raw':!![]}]})[_0x86d3('0x13')](function(_0x3fa37c){if(_0x3fa37c){var _0xc14014=_[_0x86d3('0x53')](_0x3fa37c,function(_0x5645cc){var _0x37828b=_0x5645cc[_0x86d3('0x15')]({'plain':!![]});return _0x37828b[_0x86d3('0x50')];});return db[_0x86d3('0x1e')]['find']({'where':{'id':_0x97d16a['params']['id']}})[_0x86d3('0x13')](function(_0x5d09a2){return db[_0x86d3('0x54')]['transaction'](function(_0x4d280a){return _0x5d09a2[_0x86d3('0x4e')](_0x1d1921,{'transaction':_0x4d280a})[_0x86d3('0x13')](function(){return BPromise[_0x86d3('0x55')](_0xc14014,function(_0x357398){return db[_0x86d3('0x3b')]['findOrCreate']({'where':{'UserId':_0x357398['id'],'FaxQueueId':_0x97d16a[_0x86d3('0x38')]['id']},'transaction':_0x4d280a});});})[_0x86d3('0x13')](function(){_0xc14014['forEach'](function(_0x460158){socket[_0x86d3('0x56')]('userFaxQueue:save',{'UserId':_0x460158['id'],'FaxQueueId':_0x5d09a2['id']});});});});});}})[_0x86d3('0x13')](respondWithStatusCode(_0x7710d8,null))['catch'](handleError(_0x7710d8,null));};exports[_0x86d3('0x57')]=function(_0x5f584a,_0x5bb2e5){return db[_0x86d3('0x4b')]['findAll']({'where':{'id':_0x5f584a[_0x86d3('0x20')][_0x86d3('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x86d3('0x43')],'as':_0x86d3('0x50'),'attributes':['id'],'raw':!![]}]})[_0x86d3('0x13')](handleEntityNotFound(_0x5bb2e5,null))[_0x86d3('0x13')](function(_0x268c93){var _0x3b989c=_['map'](_0x268c93,'id');var _0x245b39=[];var _0x158f56=[];var _0xe0aa13=squel[_0x86d3('0x58')]();_0xe0aa13[_0x86d3('0x59')]('tq.TeamId')[_0x86d3('0x5a')](_0x86d3('0x5b'),'tq')[_0x86d3('0x5c')](_0x86d3('0x5d'),'ut',_0x86d3('0x5e'))[_0x86d3('0x1d')](_0x86d3('0x5f'),_0x5f584a['params']['id']);for(var _0x44ced5=0x0;_0x44ced5<_0x268c93['length'];_0x44ced5+=0x1){let _0xca2e0=_0x268c93[_0x44ced5];for(var _0x596b1d=0x0;_0x596b1d<_0xca2e0['Agents'][_0x86d3('0x2a')];_0x596b1d+=0x1){let _0x3e998f=_0xca2e0['Agents'][_0x596b1d];var _0x1b503a=_0xe0aa13[_0x86d3('0x60')]();_0x1b503a[_0x86d3('0x1d')](_0x86d3('0x61'),_0x3e998f['id']);_0x158f56[_0x86d3('0x62')](db[_0x86d3('0x54')][_0x86d3('0x20')](_0x1b503a['toString'](),{'type':db['sequelize'][_0x86d3('0x63')][_0x86d3('0x64')]})[_0x86d3('0x13')](function(_0x28d98e){if(_0x28d98e[_0x86d3('0x2a')]===0x1){return _0x3e998f['id'];}else{var _0x320165=_['every'](_[_0x86d3('0x42')](_0x28d98e,_0x86d3('0x65')),function(_0x3f6d90){return _[_0x86d3('0x66')](_0x3b989c,_0x3f6d90);});if(_0x320165){return _0x3e998f['id'];}}}));}}return BPromise[_0x86d3('0x67')](_0x158f56)[_0x86d3('0x13')](function(_0x3cbab3){_0x245b39=_(_0x245b39)[_0x86d3('0x68')](_0x3cbab3)[_0x86d3('0x69')]()['value']();return db[_0x86d3('0x1e')][_0x86d3('0x2e')]({'where':{'id':_0x5f584a['params']['id']}})['then'](function(_0x36ee46){return db[_0x86d3('0x54')][_0x86d3('0x6a')](function(_0x5004cd){return _0x36ee46[_0x86d3('0x57')](_0x5f584a[_0x86d3('0x20')][_0x86d3('0x4f')],{'transaction':_0x5004cd})[_0x86d3('0x13')](function(){if(!_[_0x86d3('0x6b')](_0x245b39)){return _0x36ee46['removeAgents'](_0x245b39,{'transaction':_0x5004cd});}})[_0x86d3('0x13')](function(){_0x245b39[_0x86d3('0x6c')](function(_0x47fa9d){socket[_0x86d3('0x56')](_0x86d3('0x6d'),{'UserId':_0x47fa9d,'FaxQueueId':_0x36ee46['id']});});});});});});})[_0x86d3('0x13')](respondWithStatusCode(_0x5bb2e5,null))[_0x86d3('0x23')](handleError(_0x5bb2e5,null));};exports['addAgents']=function(_0x4362e4,_0x2896e1){return db[_0x86d3('0x1e')][_0x86d3('0x2e')]({'where':{'id':_0x4362e4[_0x86d3('0x38')]['id']}})['then'](handleEntityNotFound(_0x2896e1,null))[_0x86d3('0x13')](function(_0x2fc26e){if(_0x2fc26e){return _0x2fc26e[_0x86d3('0x6e')](_0x4362e4[_0x86d3('0x30')][_0x86d3('0x4f')],_[_0x86d3('0x6f')](_0x4362e4[_0x86d3('0x30')],[_0x86d3('0x4f'),'id'])||{})[_0x86d3('0x70')](function(_0x3a5748){for(var _0x537e2c=0x0;_0x537e2c<_0x4362e4['body'][_0x86d3('0x4f')][_0x86d3('0x2a')];_0x537e2c+=0x1){socket['emit'](_0x86d3('0x71'),{'UserId':Number(_0x4362e4[_0x86d3('0x30')][_0x86d3('0x4f')][_0x537e2c]),'FaxQueueId':Number(_0x4362e4[_0x86d3('0x38')]['id'])});}return _0x3a5748;});}})[_0x86d3('0x13')](respondWithResult(_0x2896e1,null))[_0x86d3('0x23')](handleError(_0x2896e1,null));};exports[_0x86d3('0x72')]=function(_0x419240,_0x3d7e6f){return db['FaxQueue']['find']({'where':{'id':_0x419240['params']['id']}})['then'](handleEntityNotFound(_0x3d7e6f,null))[_0x86d3('0x13')](function(_0x2514c1){if(_0x2514c1){return _0x2514c1[_0x86d3('0x72')](_0x419240[_0x86d3('0x20')][_0x86d3('0x4f')])[_0x86d3('0x13')](function(){if(_[_0x86d3('0x73')](_0x419240['query'][_0x86d3('0x4f')])){for(var _0xcf1fc8=0x0;_0xcf1fc8<_0x419240[_0x86d3('0x20')][_0x86d3('0x4f')]['length'];_0xcf1fc8+=0x1){socket[_0x86d3('0x56')]('userFaxQueue:remove',{'UserId':Number(_0x419240[_0x86d3('0x20')][_0x86d3('0x4f')][_0xcf1fc8]),'FaxQueueId':Number(_0x419240[_0x86d3('0x38')]['id'])});}}else{socket[_0x86d3('0x56')](_0x86d3('0x6d'),{'UserId':Number(_0x419240['query']['ids']),'FaxQueueId':Number(_0x419240[_0x86d3('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d7e6f,null))[_0x86d3('0x23')](handleError(_0x3d7e6f,null));};exports['getAgents']=function(_0x17278a,_0x4b20c0){var _0x4c9067={};var _0x426c26={};var _0x3b7e15;var _0x426c46;return db[_0x86d3('0x1e')][_0x86d3('0x74')]({'where':{'id':_0x17278a[_0x86d3('0x38')]['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x4b20c0,null))[_0x86d3('0x13')](function(_0x3c6eca){if(_0x3c6eca){_0x3b7e15=_0x3c6eca;_0x426c26[_0x86d3('0x27')]=_[_0x86d3('0x25')](db[_0x86d3('0x43')][_0x86d3('0x1a')]);_0x426c26[_0x86d3('0x20')]=_[_0x86d3('0x25')](_0x17278a['query']);_0x426c26['filters']=_['intersection'](_0x426c26[_0x86d3('0x27')],_0x426c26[_0x86d3('0x20')]);_0x4c9067[_0x86d3('0x28')]=_[_0x86d3('0x26')](_0x426c26[_0x86d3('0x27')],qs[_0x86d3('0x29')](_0x17278a[_0x86d3('0x20')][_0x86d3('0x29')]));_0x4c9067[_0x86d3('0x28')]=_0x4c9067[_0x86d3('0x28')][_0x86d3('0x2a')]?_0x4c9067['attributes']:_0x426c26[_0x86d3('0x27')];_0x4c9067['order']=qs[_0x86d3('0x3e')](_0x17278a[_0x86d3('0x20')][_0x86d3('0x3e')]);_0x4c9067[_0x86d3('0x1d')]=qs['filters'](_[_0x86d3('0x3f')](_0x17278a[_0x86d3('0x20')],_0x426c26[_0x86d3('0x3c')]));if(_0x17278a[_0x86d3('0x20')][_0x86d3('0x41')]){_0x4c9067[_0x86d3('0x1d')]=_[_0x86d3('0x2c')](_0x4c9067[_0x86d3('0x1d')],{'$or':_[_0x86d3('0x42')](_0x4c9067[_0x86d3('0x28')],function(_0x44f26a){var _0xfa2fea={};_0xfa2fea[_0x44f26a]={'$like':'%'+_0x17278a[_0x86d3('0x20')][_0x86d3('0x41')]+'%'};return _0xfa2fea;})});}_0x4c9067=_[_0x86d3('0x2c')]({},_0x4c9067,_0x17278a[_0x86d3('0x2d')]);return _0x3b7e15[_0x86d3('0x75')](_0x4c9067);}})['then'](function(_0x461e28){if(_0x461e28){_0x426c46=_0x461e28[_0x86d3('0x2a')];if(!_0x17278a[_0x86d3('0x20')][_0x86d3('0x4c')]('nolimit')){_0x4c9067[_0x86d3('0xe')]=qs['limit'](_0x17278a['query'][_0x86d3('0xe')]);_0x4c9067[_0x86d3('0xc')]=qs[_0x86d3('0xc')](_0x17278a[_0x86d3('0x20')][_0x86d3('0xc')]);}return _0x3b7e15[_0x86d3('0x75')](_0x4c9067);}})[_0x86d3('0x13')](function(_0x4777f1){if(_0x4777f1){return _0x4777f1?{'count':_0x426c46,'rows':_0x4777f1}:null;}})['then'](respondWithResult(_0x4b20c0,null))['catch'](handleError(_0x4b20c0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 476569f..701e145 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 _0x1f10=['emit','hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x4dc070,_0x44a160){var _0x408110=function(_0x964afc){while(--_0x964afc){_0x4dc070['push'](_0x4dc070['shift']());}};_0x408110(++_0x44a160);}(_0x1f10,0x1a0));var _0x01f1=function(_0x3e14b6,_0x25920d){_0x3e14b6=_0x3e14b6-0x0;var _0x4965b4=_0x1f10[_0x3e14b6];return _0x4965b4;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x01f1('0x0'))['db'][_0x01f1('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x01f1('0x2')](0x0);var events={'afterCreate':_0x01f1('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3cfeec){return function(_0x4166e0,_0x368b44,_0x129ece){FaxQueueEvents['emit'](_0x3cfeec+':'+_0x4166e0['id'],_0x4166e0);FaxQueueEvents[_0x01f1('0x4')](_0x3cfeec,_0x4166e0);_0x129ece(null);};}for(var e in events){if(events[_0x01f1('0x5')](e)){var event=events[e];FaxQueue[_0x01f1('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x1af5=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','emit'];(function(_0x6e51f1,_0x11371a){var _0x141b4c=function(_0x2e85e7){while(--_0x2e85e7){_0x6e51f1['push'](_0x6e51f1['shift']());}};_0x141b4c(++_0x11371a);}(_0x1af5,0xb7));var _0x51af=function(_0x479188,_0x505a1c){_0x479188=_0x479188-0x0;var _0x466b0d=_0x1af5[_0x479188];return _0x466b0d;};'use strict';var EventEmitter=require(_0x51af('0x0'));var FaxQueue=require(_0x51af('0x1'))['db'][_0x51af('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x51af('0x3')](0x0);var events={'afterCreate':_0x51af('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3fb730){return function(_0x1cd0bf,_0x26513a,_0x504a39){FaxQueueEvents[_0x51af('0x5')](_0x3fb730+':'+_0x1cd0bf['id'],_0x1cd0bf);FaxQueueEvents[_0x51af('0x5')](_0x3fb730,_0x1cd0bf);_0x504a39(null);};}for(var e in events){if(events[_0x51af('0x6')](e)){var event=events[e];FaxQueue[_0x51af('0x7')](e,emitEvent(event));}}module[_0x51af('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d144f56..19252c3 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 _0x271c=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x52f3b6,_0x57f15f){var _0x160c35=function(_0x30aad7){while(--_0x30aad7){_0x52f3b6['push'](_0x52f3b6['shift']());}};_0x160c35(++_0x57f15f);}(_0x271c,0x1ab));var _0xc271=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x271c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc271('0x0'));var util=require(_0xc271('0x1'));var logger=require(_0xc271('0x2'))(_0xc271('0x3'));var moment=require(_0xc271('0x4'));var BPromise=require('bluebird');var rp=require(_0xc271('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc271('0x6'));var config=require(_0xc271('0x7'));var attributes=require(_0xc271('0x8'));module[_0xc271('0x9')]=function(_0x424fee,_0x3473c1){return _0x424fee[_0xc271('0xa')]('FaxQueue',attributes,{'tableName':_0xc271('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c49=['lodash','../../config/logger','api','moment','request-promise','rimraf','./faxQueue.attributes','FaxQueue','fax_queues'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7c49,0x1b9));var _0x97c4=function(_0x4623ae,_0x20a502){_0x4623ae=_0x4623ae-0x0;var _0x366ea3=_0x7c49[_0x4623ae];return _0x366ea3;};'use strict';var _=require(_0x97c4('0x0'));var util=require('util');var logger=require(_0x97c4('0x1'))(_0x97c4('0x2'));var moment=require(_0x97c4('0x3'));var BPromise=require('bluebird');var rp=require(_0x97c4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97c4('0x5'));var config=require('../../config/environment');var attributes=require(_0x97c4('0x6'));module['exports']=function(_0x1b4640,_0x40aa87){return _0x1b4640['define'](_0x97c4('0x7'),attributes,{'tableName':_0x97c4('0x8'),'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 0203a7e..1e7d43d 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 _0x5ca2=['register','request','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetFaxQueue','options','where','attributes','map','include','model','then','ShowFaxQueue','FaxQueue','raw','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket'];(function(_0x3c6da0,_0x32db08){var _0x1cb749=function(_0x113fa9){while(--_0x113fa9){_0x3c6da0['push'](_0x3c6da0['shift']());}};_0x1cb749(++_0x32db08);}(_0x5ca2,0xa6));var _0x25ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ca2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x25ca('0x0'));var moment=require('moment');var BPromise=require(_0x25ca('0x1'));var rs=require(_0x25ca('0x2'));var fs=require('fs');var Redis=require(_0x25ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x25ca('0x4'))(_0x25ca('0x5'));var config=require(_0x25ca('0x6'));var jayson=require(_0x25ca('0x7'));var client=jayson[_0x25ca('0x8')][_0x25ca('0x9')]({'port':0x232a});config[_0x25ca('0xa')]=_[_0x25ca('0xb')](config[_0x25ca('0xa')],{'host':_0x25ca('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25ca('0xa')]));require(_0x25ca('0xd'))[_0x25ca('0xe')](socket);function respondWithRpcPromise(_0x205021,_0xf9b6c,_0x1bbb04){return new BPromise(function(_0xf820a2,_0x478474){return client[_0x25ca('0xf')](_0x205021,_0x1bbb04)['then'](function(_0x5eed8f){logger[_0x25ca('0x10')](_0x25ca('0x11'),_0xf9b6c,'request\x20sent');logger['debug'](_0x25ca('0x12'),_0xf9b6c,'request\x20sent',JSON[_0x25ca('0x13')](_0x5eed8f));if(_0x5eed8f[_0x25ca('0x14')]){if(_0x5eed8f['error'][_0x25ca('0x15')]===0x1f4){logger[_0x25ca('0x14')](_0x25ca('0x11'),_0xf9b6c,_0x5eed8f[_0x25ca('0x14')]['message']);return _0x478474(_0x5eed8f[_0x25ca('0x14')][_0x25ca('0x16')]);}logger[_0x25ca('0x14')](_0x25ca('0x11'),_0xf9b6c,_0x5eed8f['error'][_0x25ca('0x16')]);return _0xf820a2(_0x5eed8f[_0x25ca('0x14')][_0x25ca('0x16')]);}else{logger['info'](_0x25ca('0x11'),_0xf9b6c,_0x25ca('0x17'));_0xf820a2(_0x5eed8f['result'][_0x25ca('0x16')]);}})['catch'](function(_0x1ed1b4){logger[_0x25ca('0x14')](_0x25ca('0x11'),_0xf9b6c,_0x1ed1b4);_0x478474(_0x1ed1b4);});});}exports[_0x25ca('0x18')]=function(_0x48f216){var _0xf61eca=this;return new Promise(function(_0x42ca1d,_0x5be915){return db['FaxQueue']['findAll']({'raw':_0x48f216['options']?_0x48f216['options']['raw']===undefined?!![]:![]:!![],'where':_0x48f216[_0x25ca('0x19')]?_0x48f216[_0x25ca('0x19')][_0x25ca('0x1a')]||null:null,'attributes':_0x48f216[_0x25ca('0x19')]?_0x48f216[_0x25ca('0x19')][_0x25ca('0x1b')]||null:null,'limit':_0x48f216[_0x25ca('0x19')]?_0x48f216['options']['limit']||null:null,'include':_0x48f216[_0x25ca('0x19')]?_0x48f216[_0x25ca('0x19')]['include']?_[_0x25ca('0x1c')](_0x48f216['options']['include'],function(_0x37ca68){return{'model':db[_0x37ca68['model']],'as':_0x37ca68['as'],'attributes':_0x37ca68[_0x25ca('0x1b')],'include':_0x37ca68[_0x25ca('0x1d')]?_['map'](_0x37ca68[_0x25ca('0x1d')],function(_0x554951){return{'model':db[_0x554951[_0x25ca('0x1e')]],'as':_0x554951['as'],'attributes':_0x554951[_0x25ca('0x1b')],'include':_0x554951[_0x25ca('0x1d')]?_[_0x25ca('0x1c')](_0x554951['include'],function(_0x17dbb9){return{'model':db[_0x17dbb9['model']],'as':_0x17dbb9['as'],'attributes':_0x17dbb9[_0x25ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x25ca('0x1f')](function(_0x16c68e){logger[_0x25ca('0x10')](_0x25ca('0x18'),_0x48f216);logger['debug'](_0x25ca('0x18'),_0x48f216,JSON[_0x25ca('0x13')](_0x16c68e));_0x42ca1d(_0x16c68e);})['catch'](function(_0x5ee10d){logger[_0x25ca('0x14')](_0x25ca('0x18'),_0x5ee10d[_0x25ca('0x16')],_0x48f216);_0x5be915(_0xf61eca[_0x25ca('0x14')](0x1f4,_0x5ee10d[_0x25ca('0x16')]));});});};exports[_0x25ca('0x20')]=function(_0x4d26f1){var _0x3d123e=this;return new Promise(function(_0x2f6ab5,_0x486c21){return db[_0x25ca('0x21')]['find']({'raw':_0x4d26f1[_0x25ca('0x19')]?_0x4d26f1[_0x25ca('0x19')][_0x25ca('0x22')]===undefined?!![]:![]:!![],'where':_0x4d26f1[_0x25ca('0x19')]?_0x4d26f1[_0x25ca('0x19')]['where']||null:null,'attributes':_0x4d26f1[_0x25ca('0x19')]?_0x4d26f1[_0x25ca('0x19')][_0x25ca('0x1b')]||null:null,'include':_0x4d26f1[_0x25ca('0x19')]?_0x4d26f1['options'][_0x25ca('0x1d')]?_[_0x25ca('0x1c')](_0x4d26f1['options'][_0x25ca('0x1d')],function(_0x3d397f){return{'model':db[_0x3d397f[_0x25ca('0x1e')]],'as':_0x3d397f['as'],'attributes':_0x3d397f[_0x25ca('0x1b')],'include':_0x3d397f[_0x25ca('0x1d')]?_[_0x25ca('0x1c')](_0x3d397f[_0x25ca('0x1d')],function(_0x1efd6c){return{'model':db[_0x1efd6c[_0x25ca('0x1e')]],'as':_0x1efd6c['as'],'attributes':_0x1efd6c['attributes'],'include':_0x1efd6c[_0x25ca('0x1d')]?_['map'](_0x1efd6c['include'],function(_0x111219){return{'model':db[_0x111219[_0x25ca('0x1e')]],'as':_0x111219['as'],'attributes':_0x111219[_0x25ca('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19d7d){logger[_0x25ca('0x10')]('ShowFaxQueue',_0x4d26f1);logger['debug'](_0x25ca('0x20'),_0x4d26f1,JSON['stringify'](_0x19d7d));_0x2f6ab5(_0x19d7d);})[_0x25ca('0x23')](function(_0x23949d){logger[_0x25ca('0x14')](_0x25ca('0x20'),_0x23949d[_0x25ca('0x16')],_0x4d26f1);_0x486c21(_0x3d123e['error'](0x1f4,_0x23949d[_0x25ca('0x16')]));});});}; \ No newline at end of file +var _0x6a25=['request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','model','map','stringify','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6a25,0xda));var _0x56a2=function(_0x31be93,_0x552610){_0x31be93=_0x31be93-0x0;var _0x13edc9=_0x6a25[_0x31be93];return _0x13edc9;};'use strict';var _=require(_0x56a2('0x0'));var util=require(_0x56a2('0x1'));var moment=require(_0x56a2('0x2'));var BPromise=require(_0x56a2('0x3'));var rs=require(_0x56a2('0x4'));var fs=require('fs');var Redis=require(_0x56a2('0x5'));var db=require(_0x56a2('0x6'))['db'];var utils=require(_0x56a2('0x7'));var logger=require('../../config/logger')(_0x56a2('0x8'));var config=require(_0x56a2('0x9'));var jayson=require(_0x56a2('0xa'));var client=jayson['client'][_0x56a2('0xb')]({'port':0x232a});config['redis']=_[_0x56a2('0xc')](config['redis'],{'host':_0x56a2('0xd'),'port':0x18eb});var socket=require(_0x56a2('0xe'))(new Redis(config['redis']));require(_0x56a2('0xf'))['register'](socket);function respondWithRpcPromise(_0x5f2051,_0x44121f,_0x507b44){return new BPromise(function(_0x194e85,_0x54cebc){return client[_0x56a2('0x10')](_0x5f2051,_0x507b44)[_0x56a2('0x11')](function(_0x593c80){logger[_0x56a2('0x12')](_0x56a2('0x13'),_0x44121f,_0x56a2('0x14'));logger[_0x56a2('0x15')](_0x56a2('0x16'),_0x44121f,'request\x20sent',JSON['stringify'](_0x593c80));if(_0x593c80[_0x56a2('0x17')]){if(_0x593c80[_0x56a2('0x17')]['code']===0x1f4){logger[_0x56a2('0x17')]('FaxQueue,\x20%s,\x20%s',_0x44121f,_0x593c80[_0x56a2('0x17')][_0x56a2('0x18')]);return _0x54cebc(_0x593c80['error'][_0x56a2('0x18')]);}logger[_0x56a2('0x17')]('FaxQueue,\x20%s,\x20%s',_0x44121f,_0x593c80[_0x56a2('0x17')][_0x56a2('0x18')]);return _0x194e85(_0x593c80[_0x56a2('0x17')][_0x56a2('0x18')]);}else{logger[_0x56a2('0x12')](_0x56a2('0x13'),_0x44121f,_0x56a2('0x14'));_0x194e85(_0x593c80['result'][_0x56a2('0x18')]);}})[_0x56a2('0x19')](function(_0x569499){logger[_0x56a2('0x17')](_0x56a2('0x13'),_0x44121f,_0x569499);_0x54cebc(_0x569499);});});}exports[_0x56a2('0x1a')]=function(_0x2a5c49){var _0x56c13e=this;return new Promise(function(_0x1ac1c1,_0x4179f6){return db[_0x56a2('0x1b')][_0x56a2('0x1c')]({'raw':_0x2a5c49[_0x56a2('0x1d')]?_0x2a5c49['options'][_0x56a2('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a5c49[_0x56a2('0x1d')]?_0x2a5c49[_0x56a2('0x1d')][_0x56a2('0x1f')]||null:null,'attributes':_0x2a5c49[_0x56a2('0x1d')]?_0x2a5c49[_0x56a2('0x1d')][_0x56a2('0x20')]||null:null,'limit':_0x2a5c49[_0x56a2('0x1d')]?_0x2a5c49[_0x56a2('0x1d')]['limit']||null:null,'include':_0x2a5c49[_0x56a2('0x1d')]?_0x2a5c49[_0x56a2('0x1d')][_0x56a2('0x21')]?_['map'](_0x2a5c49[_0x56a2('0x1d')][_0x56a2('0x21')],function(_0xb5893d){return{'model':db[_0xb5893d[_0x56a2('0x22')]],'as':_0xb5893d['as'],'attributes':_0xb5893d[_0x56a2('0x20')],'include':_0xb5893d[_0x56a2('0x21')]?_[_0x56a2('0x23')](_0xb5893d['include'],function(_0x1d0055){return{'model':db[_0x1d0055[_0x56a2('0x22')]],'as':_0x1d0055['as'],'attributes':_0x1d0055[_0x56a2('0x20')],'include':_0x1d0055[_0x56a2('0x21')]?_[_0x56a2('0x23')](_0x1d0055[_0x56a2('0x21')],function(_0x171a9c){return{'model':db[_0x171a9c[_0x56a2('0x22')]],'as':_0x171a9c['as'],'attributes':_0x171a9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x56a2('0x11')](function(_0x34e21d){logger[_0x56a2('0x12')](_0x56a2('0x1a'),_0x2a5c49);logger[_0x56a2('0x15')](_0x56a2('0x1a'),_0x2a5c49,JSON[_0x56a2('0x24')](_0x34e21d));_0x1ac1c1(_0x34e21d);})[_0x56a2('0x19')](function(_0x15a82a){logger[_0x56a2('0x17')](_0x56a2('0x1a'),_0x15a82a[_0x56a2('0x18')],_0x2a5c49);_0x4179f6(_0x56c13e['error'](0x1f4,_0x15a82a[_0x56a2('0x18')]));});});};exports[_0x56a2('0x25')]=function(_0x21c8af){var _0x53f71e=this;return new Promise(function(_0x31bd8d,_0x5dc834){return db[_0x56a2('0x1b')][_0x56a2('0x26')]({'raw':_0x21c8af[_0x56a2('0x1d')]?_0x21c8af[_0x56a2('0x1d')][_0x56a2('0x1e')]===undefined?!![]:![]:!![],'where':_0x21c8af[_0x56a2('0x1d')]?_0x21c8af[_0x56a2('0x1d')][_0x56a2('0x1f')]||null:null,'attributes':_0x21c8af[_0x56a2('0x1d')]?_0x21c8af['options'][_0x56a2('0x20')]||null:null,'include':_0x21c8af[_0x56a2('0x1d')]?_0x21c8af[_0x56a2('0x1d')][_0x56a2('0x21')]?_['map'](_0x21c8af['options']['include'],function(_0x52acb7){return{'model':db[_0x52acb7[_0x56a2('0x22')]],'as':_0x52acb7['as'],'attributes':_0x52acb7[_0x56a2('0x20')],'include':_0x52acb7[_0x56a2('0x21')]?_[_0x56a2('0x23')](_0x52acb7['include'],function(_0x5626e6){return{'model':db[_0x5626e6[_0x56a2('0x22')]],'as':_0x5626e6['as'],'attributes':_0x5626e6[_0x56a2('0x20')],'include':_0x5626e6['include']?_[_0x56a2('0x23')](_0x5626e6['include'],function(_0x550b25){return{'model':db[_0x550b25[_0x56a2('0x22')]],'as':_0x550b25['as'],'attributes':_0x550b25[_0x56a2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x56a2('0x11')](function(_0x3bf2ad){logger[_0x56a2('0x12')]('ShowFaxQueue',_0x21c8af);logger['debug'](_0x56a2('0x25'),_0x21c8af,JSON[_0x56a2('0x24')](_0x3bf2ad));_0x31bd8d(_0x3bf2ad);})['catch'](function(_0xceca86){logger[_0x56a2('0x17')]('ShowFaxQueue',_0xceca86[_0x56a2('0x18')],_0x21c8af);_0x5dc834(_0x53f71e[_0x56a2('0x17')](0x1f4,_0xceca86[_0x56a2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3163f36..756d2c9 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 _0xc387=['removeListener','register','length','./faxQueue.events','save','remove','emit'];(function(_0x1ffd62,_0x29a335){var _0x21ee6c=function(_0x5da8ec){while(--_0x5da8ec){_0x1ffd62['push'](_0x1ffd62['shift']());}};_0x21ee6c(++_0x29a335);}(_0xc387,0x168));var _0x7c38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc387[_0x14add3];return _0x4a174f;};'use strict';var FaxQueueEvents=require(_0x7c38('0x0'));var events=[_0x7c38('0x1'),_0x7c38('0x2'),'update'];function createListener(_0x310aa0,_0x14feee){return function(_0x299afe){_0x14feee[_0x7c38('0x3')](_0x310aa0,_0x299afe);};}function removeListener(_0x5c1d00,_0x4bd971){return function(){FaxQueueEvents[_0x7c38('0x4')](_0x5c1d00,_0x4bd971);};}exports[_0x7c38('0x5')]=function(_0x1b5151){for(var _0x1636a0=0x0,_0x5e32cd=events[_0x7c38('0x6')];_0x1636a0<_0x5e32cd;_0x1636a0++){var _0x2c5a0b=events[_0x1636a0];var _0x7a57e7=createListener('faxQueue:'+_0x2c5a0b,_0x1b5151);FaxQueueEvents['on'](_0x2c5a0b,_0x7a57e7);}}; \ No newline at end of file +var _0x54f1=['faxQueue:','update','removeListener','length'];(function(_0x5e3f7c,_0x28fc0c){var _0x1692da=function(_0x4f0fd0){while(--_0x4f0fd0){_0x5e3f7c['push'](_0x5e3f7c['shift']());}};_0x1692da(++_0x28fc0c);}(_0x54f1,0x159));var _0x154f=function(_0x28c96b,_0x1e4a83){_0x28c96b=_0x28c96b-0x0;var _0x42db87=_0x54f1[_0x28c96b];return _0x42db87;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x154f('0x0')];function createListener(_0x43cf47,_0xcd6c50){return function(_0x4b4460){_0xcd6c50['emit'](_0x43cf47,_0x4b4460);};}function removeListener(_0x7892d0,_0x3ce07a){return function(){FaxQueueEvents[_0x154f('0x1')](_0x7892d0,_0x3ce07a);};}exports['register']=function(_0x4ce639){for(var _0xd04021=0x0,_0x3b22dd=events[_0x154f('0x2')];_0xd04021<_0x3b22dd;_0xd04021++){var _0x4c5fef=events[_0xd04021];var _0x31273f=createListener(_0x154f('0x3')+_0x4c5fef,_0x4ce639);FaxQueueEvents['on'](_0x4c5fef,_0x31273f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 79e4349..f082cff 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 _0x524e=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents','update','removeTeams','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','describe','/:id'];(function(_0x4c5fa3,_0x5f48d8){var _0x3486cd=function(_0x2b2ea3){while(--_0x2b2ea3){_0x4c5fa3['push'](_0x4c5fa3['shift']());}};_0x3486cd(++_0x5f48d8);}(_0x524e,0x15e));var _0xe524=function(_0x7bff2f,_0x5b07be){_0x7bff2f=_0x7bff2f-0x0;var _0x12c445=_0x524e[_0x7bff2f];return _0x12c445;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['post']('/',auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);router[_0xe524('0x16')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller['addTeams']);router[_0xe524('0x16')]('/:id/users',auth[_0xe524('0xe')](),controller[_0xe524('0x17')]);router['put'](_0xe524('0xd'),auth['isAuthenticated'](),controller[_0xe524('0x18')]);router['delete'](_0xe524('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router[_0xe524('0x1a')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x1b')]=router; \ No newline at end of file +var _0x9206=['getTeams','/:id/users','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','/:id/teams'];(function(_0x23f19e,_0x4d583b){var _0x2a95d4=function(_0x5bb558){while(--_0x5bb558){_0x23f19e['push'](_0x23f19e['shift']());}};_0x2a95d4(++_0x4d583b);}(_0x9206,0x176));var _0x6920=function(_0x274c59,_0x3f5f8a){_0x274c59=_0x274c59-0x0;var _0x558a56=_0x9206[_0x274c59];return _0x558a56;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x6920('0x8')](),controller['index']);router[_0x6920('0x9')](_0x6920('0xa'),auth[_0x6920('0x8')](),controller[_0x6920('0xb')]);router['get']('/:id',auth[_0x6920('0x8')](),controller[_0x6920('0xc')]);router[_0x6920('0x9')](_0x6920('0xd'),auth[_0x6920('0x8')](),controller[_0x6920('0xe')]);router[_0x6920('0x9')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x10')]);router[_0x6920('0x9')](_0x6920('0x11'),auth[_0x6920('0x8')](),controller['getAgents']);router['post']('/',auth[_0x6920('0x8')](),controller[_0x6920('0x12')]);router['post'](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x13')]);router[_0x6920('0x14')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x15')]);router[_0x6920('0x16')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x18')]);router[_0x6920('0x19')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x1a')]);router[_0x6920('0x19')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x1b')]);router[_0x6920('0x19')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x1c')]);module[_0x6920('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 d17c0f1..2c71afc 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 _0x8077=['STRING','DATE','moment','sequelize','exports'];(function(_0x55a9c2,_0x126ee9){var _0x1fc7ad=function(_0x5dba9d){while(--_0x5dba9d){_0x55a9c2['push'](_0x55a9c2['shift']());}};_0x1fc7ad(++_0x126ee9);}(_0x8077,0x133));var _0x7807=function(_0x5de8cf,_0x11c0af){_0x5de8cf=_0x5de8cf-0x0;var _0x24ca2f=_0x8077[_0x5de8cf];return _0x24ca2f;};'use strict';var moment=require(_0x7807('0x0'));var Sequelize=require(_0x7807('0x1'));module[_0x7807('0x2')]={'uniqueid':{'type':Sequelize[_0x7807('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7807('0x3')]},'joinAt':{'type':Sequelize[_0x7807('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7807('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7807('0x3')]}}; \ No newline at end of file +var _0x6848=['STRING','DATE','moment','sequelize','exports'];(function(_0x1b07dd,_0x2bee78){var _0x16facc=function(_0x1b9789){while(--_0x1b9789){_0x1b07dd['push'](_0x1b07dd['shift']());}};_0x16facc(++_0x2bee78);}(_0x6848,0xe3));var _0x8684=function(_0x5b6e46,_0x1d6236){_0x5b6e46=_0x5b6e46-0x0;var _0x31f7a1=_0x6848[_0x5b6e46];return _0x31f7a1;};'use strict';var moment=require(_0x8684('0x0'));var Sequelize=require(_0x8684('0x1'));module[_0x8684('0x2')]={'uniqueid':{'type':Sequelize[_0x8684('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8684('0x3')]},'joinAt':{'type':Sequelize[_0x8684('0x4')]},'leaveAt':{'type':Sequelize[_0x8684('0x4')]},'acceptAt':{'type':Sequelize[_0x8684('0x4')]},'exitAt':{'type':Sequelize[_0x8684('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d6459cd..b0500c6 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 _0xb75c=['Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb75c,0x1ce));var _0xcb75=function(_0x551d54,_0x1db9e6){_0x551d54=_0x551d54-0x0;var _0x4a63e0=_0xb75c[_0x551d54];return _0x4a63e0;};'use strict';var emlformat=require(_0xcb75('0x0'));var rimraf=require(_0xcb75('0x1'));var zipdir=require(_0xcb75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb75('0x3'));var moment=require('moment');var BPromise=require(_0xcb75('0x4'));var Mustache=require(_0xcb75('0x5'));var util=require(_0xcb75('0x6'));var path=require('path');var sox=require(_0xcb75('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb75('0x8'));var _=require(_0xcb75('0x9'));var squel=require(_0xcb75('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb75('0xb'));var querystring=require(_0xcb75('0xc'));var Papa=require(_0xcb75('0xd'));var Redis=require('ioredis');var authService=require(_0xcb75('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcb75('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb75('0x10'))('api');var utils=require(_0xcb75('0x11'));var config=require(_0xcb75('0x12'));var licenseUtil=require(_0xcb75('0x13'));var db=require(_0xcb75('0x14'))['db'];function respondWithStatusCode(_0x526c03,_0x1e0bba){_0x1e0bba=_0x1e0bba||0xcc;return function(_0x13c953){if(_0x13c953){return _0x526c03[_0xcb75('0x15')](_0x1e0bba);}return _0x526c03[_0xcb75('0x16')](_0x1e0bba)[_0xcb75('0x17')]();};}function respondWithResult(_0x3ae629,_0x23c719){_0x23c719=_0x23c719||0xc8;return function(_0x2c14a1){if(_0x2c14a1){return _0x3ae629['status'](_0x23c719)['json'](_0x2c14a1);}};}function respondWithFilteredResult(_0xa0ce25,_0x1af8c1){return function(_0x589afc){if(_0x589afc){var _0x1b9765=typeof _0x1af8c1[_0xcb75('0x18')]==='undefined'&&typeof _0x1af8c1[_0xcb75('0x19')]===_0xcb75('0x1a');var _0x1a0413=_0x589afc[_0xcb75('0x1b')];var _0x57ad84=_0x1b9765?0x0:_0x1af8c1[_0xcb75('0x18')];var _0x32a66f=_0x1b9765?_0x589afc['count']:_0x1af8c1[_0xcb75('0x18')]+_0x1af8c1[_0xcb75('0x19')];var _0x6be8f0;if(_0x32a66f>=_0x1a0413){_0x32a66f=_0x1a0413;_0x6be8f0=0xc8;}else{_0x6be8f0=0xce;}_0xa0ce25[_0xcb75('0x16')](_0x6be8f0);return _0xa0ce25['set'](_0xcb75('0x1c'),_0x57ad84+'-'+_0x32a66f+'/'+_0x1a0413)[_0xcb75('0x1d')](_0x589afc);}return null;};}function patchUpdates(_0x14bba7){return function(_0x2489e9){try{jsonpatch[_0xcb75('0x1e')](_0x2489e9,_0x14bba7,!![]);}catch(_0x232c57){return BPromise['reject'](_0x232c57);}return _0x2489e9[_0xcb75('0x1f')]();};}function saveUpdates(_0x4ca28b,_0x265cf2){return function(_0x78e743){if(_0x78e743){return _0x78e743['update'](_0x4ca28b)[_0xcb75('0x20')](function(_0x1a7154){return _0x1a7154;});}return null;};}function removeEntity(_0x5b0874,_0x29a56e){return function(_0x338222){if(_0x338222){return _0x338222[_0xcb75('0x21')]()[_0xcb75('0x20')](function(){_0x5b0874[_0xcb75('0x16')](0xcc)[_0xcb75('0x17')]();});}};}function handleEntityNotFound(_0x1f6df6,_0x5a61dd){return function(_0x263d46){if(!_0x263d46){_0x1f6df6[_0xcb75('0x15')](0x194);}return _0x263d46;};}function handleError(_0x501dcf,_0x417342){_0x417342=_0x417342||0x1f4;return function(_0x37928b){logger[_0xcb75('0x22')](_0x37928b[_0xcb75('0x23')]);if(_0x37928b[_0xcb75('0x24')]){delete _0x37928b[_0xcb75('0x24')];}_0x501dcf[_0xcb75('0x16')](_0x417342)[_0xcb75('0x25')](_0x37928b);};}exports[_0xcb75('0x26')]=function(_0x54d718,_0x1bcf39){var _0x41e5fe={},_0x567087={},_0x153370={'count':0x0,'rows':[]};var _0x1b5c0d=_[_0xcb75('0x27')](db[_0xcb75('0x28')][_0xcb75('0x29')],function(_0x4bd240){return{'name':_0x4bd240['fieldName'],'type':_0x4bd240['type']['key']};});_0x567087[_0xcb75('0x2a')]=_['map'](_0x1b5c0d,_0xcb75('0x24'));_0x567087['query']=_[_0xcb75('0x2b')](_0x54d718[_0xcb75('0x2c')]);_0x567087[_0xcb75('0x2d')]=_['intersection'](_0x567087['model'],_0x567087[_0xcb75('0x2c')]);_0x41e5fe[_0xcb75('0x2e')]=_[_0xcb75('0x2f')](_0x567087[_0xcb75('0x2a')],qs[_0xcb75('0x30')](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x30')]));_0x41e5fe[_0xcb75('0x2e')]=_0x41e5fe[_0xcb75('0x2e')][_0xcb75('0x31')]?_0x41e5fe[_0xcb75('0x2e')]:_0x567087[_0xcb75('0x2a')];if(!_0x54d718['query'][_0xcb75('0x32')](_0xcb75('0x33'))){_0x41e5fe['limit']=qs[_0xcb75('0x19')](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x19')]);_0x41e5fe['offset']=qs['offset'](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x18')]);}_0x41e5fe['order']=qs[_0xcb75('0x34')](_0x54d718['query'][_0xcb75('0x34')]);_0x41e5fe[_0xcb75('0x35')]=qs[_0xcb75('0x2d')](_['pick'](_0x54d718[_0xcb75('0x2c')],_0x567087[_0xcb75('0x2d')]),_0x1b5c0d);if(_0x54d718[_0xcb75('0x2c')][_0xcb75('0x36')]){_0x41e5fe[_0xcb75('0x35')]=_[_0xcb75('0x37')](_0x41e5fe[_0xcb75('0x35')],{'$or':_[_0xcb75('0x27')](_0x1b5c0d,function(_0x117bbd){if(_0x117bbd[_0xcb75('0x38')]!==_0xcb75('0x39')){var _0x4b1dbb={};_0x4b1dbb[_0x117bbd['name']]={'$like':'%'+_0x54d718['query'][_0xcb75('0x36')]+'%'};return _0x4b1dbb;}})});}_0x41e5fe=_[_0xcb75('0x37')]({},_0x41e5fe,_0x54d718[_0xcb75('0x3a')]);var _0x409ac9={'where':_0x41e5fe['where']};return db[_0xcb75('0x28')][_0xcb75('0x1b')](_0x409ac9)[_0xcb75('0x20')](function(_0x401a61){_0x153370[_0xcb75('0x1b')]=_0x401a61;if(_0x54d718['query'][_0xcb75('0x3b')]){_0x41e5fe[_0xcb75('0x3c')]=[{'all':!![]}];}return db[_0xcb75('0x28')][_0xcb75('0x3d')](_0x41e5fe);})[_0xcb75('0x20')](function(_0x53db83){_0x153370[_0xcb75('0x3e')]=_0x53db83;return _0x153370;})[_0xcb75('0x20')](respondWithFilteredResult(_0x1bcf39,_0x41e5fe))['catch'](handleError(_0x1bcf39,null));};exports[_0xcb75('0x3f')]=function(_0x53a1d8,_0xba1470){var _0x3be469={'raw':!![],'where':{'id':_0x53a1d8[_0xcb75('0x40')]['id']}},_0x20996a={};_0x20996a[_0xcb75('0x2a')]=_[_0xcb75('0x2b')](db[_0xcb75('0x28')][_0xcb75('0x29')]);_0x20996a[_0xcb75('0x2c')]=_['keys'](_0x53a1d8[_0xcb75('0x2c')]);_0x20996a[_0xcb75('0x2d')]=_[_0xcb75('0x2f')](_0x20996a[_0xcb75('0x2a')],_0x20996a[_0xcb75('0x2c')]);_0x3be469[_0xcb75('0x2e')]=_[_0xcb75('0x2f')](_0x20996a[_0xcb75('0x2a')],qs[_0xcb75('0x30')](_0x53a1d8[_0xcb75('0x2c')][_0xcb75('0x30')]));_0x3be469[_0xcb75('0x2e')]=_0x3be469[_0xcb75('0x2e')][_0xcb75('0x31')]?_0x3be469[_0xcb75('0x2e')]:_0x20996a[_0xcb75('0x2a')];if(_0x53a1d8['query']['includeAll']){_0x3be469[_0xcb75('0x3c')]=[{'all':!![]}];}_0x3be469=_[_0xcb75('0x37')]({},_0x3be469,_0x53a1d8[_0xcb75('0x3a')]);return db[_0xcb75('0x28')]['find'](_0x3be469)[_0xcb75('0x20')](handleEntityNotFound(_0xba1470,null))[_0xcb75('0x20')](respondWithResult(_0xba1470,null))['catch'](handleError(_0xba1470,null));};exports[_0xcb75('0x41')]=function(_0x2bd64b,_0x44273a){return db[_0xcb75('0x28')][_0xcb75('0x41')](_0x2bd64b[_0xcb75('0x42')],{})[_0xcb75('0x20')](respondWithResult(_0x44273a,0xc9))[_0xcb75('0x43')](handleError(_0x44273a,null));};exports['update']=function(_0x1fb0a3,_0x122f3e){if(_0x1fb0a3['body']['id']){delete _0x1fb0a3[_0xcb75('0x42')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x1fb0a3[_0xcb75('0x40')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x122f3e,null))[_0xcb75('0x20')](saveUpdates(_0x1fb0a3[_0xcb75('0x42')],null))[_0xcb75('0x20')](respondWithResult(_0x122f3e,null))[_0xcb75('0x43')](handleError(_0x122f3e,null));};exports[_0xcb75('0x21')]=function(_0x12fa20,_0x19f174){return db[_0xcb75('0x28')][_0xcb75('0x44')]({'where':{'id':_0x12fa20[_0xcb75('0x40')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x19f174,null))[_0xcb75('0x20')](removeEntity(_0x19f174,null))[_0xcb75('0x43')](handleError(_0x19f174,null));};exports[_0xcb75('0x45')]=function(_0x48fc4a,_0x4e86d8){return db['FaxQueueReport'][_0xcb75('0x45')]()[_0xcb75('0x20')](respondWithResult(_0x4e86d8,null))[_0xcb75('0x43')](handleError(_0x4e86d8,null));}; \ No newline at end of file +var _0x37f8=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','FaxQueueReport','rawAttributes','fieldName','map','query','keys','filters','model','intersection','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','attributes','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','ejs'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x37f8,0xd2));var _0x837f=function(_0x34ae3f,_0x54fab4){_0x34ae3f=_0x34ae3f-0x0;var _0x3b5b75=_0x37f8[_0x34ae3f];return _0x3b5b75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837f('0x0'));var zipdir=require(_0x837f('0x1'));var jsonpatch=require(_0x837f('0x2'));var rp=require(_0x837f('0x3'));var moment=require('moment');var BPromise=require(_0x837f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x837f('0x5'));var fs=require('fs');var fs_extra=require(_0x837f('0x6'));var _=require(_0x837f('0x7'));var squel=require(_0x837f('0x8'));var crypto=require(_0x837f('0x9'));var jsforce=require(_0x837f('0xa'));var deskjs=require(_0x837f('0xb'));var toCsv=require(_0x837f('0xc'));var querystring=require(_0x837f('0xd'));var Papa=require(_0x837f('0xe'));var Redis=require(_0x837f('0xf'));var authService=require(_0x837f('0x10'));var qs=require(_0x837f('0x11'));var as=require(_0x837f('0x12'));var hardwareService=require(_0x837f('0x13'));var logger=require('../../config/logger')(_0x837f('0x14'));var utils=require(_0x837f('0x15'));var config=require(_0x837f('0x16'));var licenseUtil=require(_0x837f('0x17'));var db=require(_0x837f('0x18'))['db'];function respondWithStatusCode(_0x4a8c00,_0x53045e){_0x53045e=_0x53045e||0xcc;return function(_0x14ff6d){if(_0x14ff6d){return _0x4a8c00[_0x837f('0x19')](_0x53045e);}return _0x4a8c00[_0x837f('0x1a')](_0x53045e)[_0x837f('0x1b')]();};}function respondWithResult(_0x2b3cd6,_0x483267){_0x483267=_0x483267||0xc8;return function(_0x18d8aa){if(_0x18d8aa){return _0x2b3cd6[_0x837f('0x1a')](_0x483267)[_0x837f('0x1c')](_0x18d8aa);}};}function respondWithFilteredResult(_0x1664e7,_0x2e4257){return function(_0x29369d){if(_0x29369d){var _0x546352=typeof _0x2e4257[_0x837f('0x1d')]===_0x837f('0x1e')&&typeof _0x2e4257['limit']===_0x837f('0x1e');var _0x2745f6=_0x29369d[_0x837f('0x1f')];var _0x1d17b3=_0x546352?0x0:_0x2e4257['offset'];var _0x1d974f=_0x546352?_0x29369d[_0x837f('0x1f')]:_0x2e4257[_0x837f('0x1d')]+_0x2e4257[_0x837f('0x20')];var _0x14b3da;if(_0x1d974f>=_0x2745f6){_0x1d974f=_0x2745f6;_0x14b3da=0xc8;}else{_0x14b3da=0xce;}_0x1664e7['status'](_0x14b3da);return _0x1664e7[_0x837f('0x21')](_0x837f('0x22'),_0x1d17b3+'-'+_0x1d974f+'/'+_0x2745f6)[_0x837f('0x1c')](_0x29369d);}return null;};}function patchUpdates(_0x33c7cb){return function(_0x3540f3){try{jsonpatch['apply'](_0x3540f3,_0x33c7cb,!![]);}catch(_0x2e9603){return BPromise[_0x837f('0x23')](_0x2e9603);}return _0x3540f3[_0x837f('0x24')]();};}function saveUpdates(_0xe68eb1,_0xa0af78){return function(_0x237656){if(_0x237656){return _0x237656[_0x837f('0x25')](_0xe68eb1)[_0x837f('0x26')](function(_0x11a9b3){return _0x11a9b3;});}return null;};}function removeEntity(_0x168455,_0x3fa18e){return function(_0xfb4df0){if(_0xfb4df0){return _0xfb4df0[_0x837f('0x27')]()[_0x837f('0x26')](function(){_0x168455[_0x837f('0x1a')](0xcc)[_0x837f('0x1b')]();});}};}function handleEntityNotFound(_0x43ca7d,_0x38da9f){return function(_0x1a6f26){if(!_0x1a6f26){_0x43ca7d[_0x837f('0x19')](0x194);}return _0x1a6f26;};}function handleError(_0x2c6a90,_0x246637){_0x246637=_0x246637||0x1f4;return function(_0x21f826){logger['error'](_0x21f826[_0x837f('0x28')]);if(_0x21f826[_0x837f('0x29')]){delete _0x21f826[_0x837f('0x29')];}_0x2c6a90['status'](_0x246637)['send'](_0x21f826);};}exports[_0x837f('0x2a')]=function(_0x1ab2e4,_0x1435fd){var _0x4072a4={},_0x30a3d9={},_0x387533={'count':0x0,'rows':[]};var _0x323565=_['map'](db[_0x837f('0x2b')][_0x837f('0x2c')],function(_0x266871){return{'name':_0x266871[_0x837f('0x2d')],'type':_0x266871['type']['key']};});_0x30a3d9['model']=_[_0x837f('0x2e')](_0x323565,_0x837f('0x29'));_0x30a3d9[_0x837f('0x2f')]=_[_0x837f('0x30')](_0x1ab2e4['query']);_0x30a3d9[_0x837f('0x31')]=_['intersection'](_0x30a3d9[_0x837f('0x32')],_0x30a3d9['query']);_0x4072a4['attributes']=_[_0x837f('0x33')](_0x30a3d9[_0x837f('0x32')],qs[_0x837f('0x34')](_0x1ab2e4[_0x837f('0x2f')][_0x837f('0x34')]));_0x4072a4['attributes']=_0x4072a4['attributes'][_0x837f('0x35')]?_0x4072a4['attributes']:_0x30a3d9[_0x837f('0x32')];if(!_0x1ab2e4[_0x837f('0x2f')]['hasOwnProperty'](_0x837f('0x36'))){_0x4072a4[_0x837f('0x20')]=qs[_0x837f('0x20')](_0x1ab2e4[_0x837f('0x2f')][_0x837f('0x20')]);_0x4072a4['offset']=qs[_0x837f('0x1d')](_0x1ab2e4[_0x837f('0x2f')][_0x837f('0x1d')]);}_0x4072a4[_0x837f('0x37')]=qs[_0x837f('0x38')](_0x1ab2e4['query']['sort']);_0x4072a4[_0x837f('0x39')]=qs['filters'](_['pick'](_0x1ab2e4[_0x837f('0x2f')],_0x30a3d9[_0x837f('0x31')]),_0x323565);if(_0x1ab2e4['query']['filter']){_0x4072a4[_0x837f('0x39')]=_[_0x837f('0x3a')](_0x4072a4[_0x837f('0x39')],{'$or':_['map'](_0x323565,function(_0x26fb32){if(_0x26fb32[_0x837f('0x3b')]!==_0x837f('0x3c')){var _0x214e50={};_0x214e50[_0x26fb32[_0x837f('0x29')]]={'$like':'%'+_0x1ab2e4['query']['filter']+'%'};return _0x214e50;}})});}_0x4072a4=_[_0x837f('0x3a')]({},_0x4072a4,_0x1ab2e4[_0x837f('0x3d')]);var _0x2b859a={'where':_0x4072a4['where']};return db['FaxQueueReport'][_0x837f('0x1f')](_0x2b859a)[_0x837f('0x26')](function(_0x207bcb){_0x387533['count']=_0x207bcb;if(_0x1ab2e4[_0x837f('0x2f')][_0x837f('0x3e')]){_0x4072a4['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4072a4);})[_0x837f('0x26')](function(_0x3509b6){_0x387533[_0x837f('0x3f')]=_0x3509b6;return _0x387533;})[_0x837f('0x26')](respondWithFilteredResult(_0x1435fd,_0x4072a4))[_0x837f('0x40')](handleError(_0x1435fd,null));};exports[_0x837f('0x41')]=function(_0x199769,_0x4e6ec9){var _0xdbd892={'raw':!![],'where':{'id':_0x199769['params']['id']}},_0xb06317={};_0xb06317[_0x837f('0x32')]=_[_0x837f('0x30')](db['FaxQueueReport'][_0x837f('0x2c')]);_0xb06317[_0x837f('0x2f')]=_[_0x837f('0x30')](_0x199769[_0x837f('0x2f')]);_0xb06317[_0x837f('0x31')]=_[_0x837f('0x33')](_0xb06317['model'],_0xb06317[_0x837f('0x2f')]);_0xdbd892[_0x837f('0x42')]=_[_0x837f('0x33')](_0xb06317[_0x837f('0x32')],qs[_0x837f('0x34')](_0x199769[_0x837f('0x2f')][_0x837f('0x34')]));_0xdbd892[_0x837f('0x42')]=_0xdbd892['attributes'][_0x837f('0x35')]?_0xdbd892[_0x837f('0x42')]:_0xb06317['model'];if(_0x199769[_0x837f('0x2f')][_0x837f('0x3e')]){_0xdbd892['include']=[{'all':!![]}];}_0xdbd892=_[_0x837f('0x3a')]({},_0xdbd892,_0x199769[_0x837f('0x3d')]);return db[_0x837f('0x2b')][_0x837f('0x43')](_0xdbd892)[_0x837f('0x26')](handleEntityNotFound(_0x4e6ec9,null))[_0x837f('0x26')](respondWithResult(_0x4e6ec9,null))['catch'](handleError(_0x4e6ec9,null));};exports[_0x837f('0x44')]=function(_0x4819d4,_0x1146ef){return db[_0x837f('0x2b')][_0x837f('0x44')](_0x4819d4[_0x837f('0x45')],{})[_0x837f('0x26')](respondWithResult(_0x1146ef,0xc9))[_0x837f('0x40')](handleError(_0x1146ef,null));};exports['update']=function(_0x554f74,_0x5edfcc){if(_0x554f74[_0x837f('0x45')]['id']){delete _0x554f74[_0x837f('0x45')]['id'];}return db['FaxQueueReport'][_0x837f('0x43')]({'where':{'id':_0x554f74['params']['id']}})[_0x837f('0x26')](handleEntityNotFound(_0x5edfcc,null))[_0x837f('0x26')](saveUpdates(_0x554f74[_0x837f('0x45')],null))[_0x837f('0x26')](respondWithResult(_0x5edfcc,null))[_0x837f('0x40')](handleError(_0x5edfcc,null));};exports[_0x837f('0x27')]=function(_0x4d9156,_0x23406b){return db['FaxQueueReport'][_0x837f('0x43')]({'where':{'id':_0x4d9156[_0x837f('0x46')]['id']}})[_0x837f('0x26')](handleEntityNotFound(_0x23406b,null))['then'](removeEntity(_0x23406b,null))[_0x837f('0x40')](handleError(_0x23406b,null));};exports[_0x837f('0x47')]=function(_0x1021e8,_0x166e52){return db[_0x837f('0x2b')][_0x837f('0x47')]()['then'](respondWithResult(_0x166e52,null))[_0x837f('0x40')](handleError(_0x166e52,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 31afd9a..5dff959 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x240415,_0x37892d){var _0x4b56de=function(_0x9cb890){while(--_0x9cb890){_0x240415['push'](_0x240415['shift']());}};_0x4b56de(++_0x37892d);}(_0xabce,0x103));var _0xeabc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xabce[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x511a0,_0x4fb604){var _0x34baad=function(_0x5abef3){while(--_0x5abef3){_0x511a0['push'](_0x511a0['shift']());}};_0x34baad(++_0x4fb604);}(_0x1261,0x144));var _0x1126=function(_0x1b9cd5,_0x103dc4){_0x1b9cd5=_0x1b9cd5-0x0;var _0x4c74ca=_0x1261[_0x1b9cd5];return _0x4c74ca;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index fd82aa8..d1e7649 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 _0x4824=['CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','then'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4824,0x1d4));var _0x4482=function(_0x21a2f6,_0x247d98){_0x21a2f6=_0x21a2f6-0x0;var _0xfbf566=_0x4824[_0x21a2f6];return _0xfbf566;};'use strict';var _=require(_0x4482('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4482('0x1'));var rs=require(_0x4482('0x2'));var fs=require('fs');var Redis=require(_0x4482('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4482('0x4'));var logger=require(_0x4482('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4482('0x6'));var client=jayson[_0x4482('0x7')][_0x4482('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31fb16,_0x314381,_0x4db73a){return new BPromise(function(_0x2a0b98,_0xf789e0){return client[_0x4482('0x9')](_0x31fb16,_0x4db73a)['then'](function(_0x5cd2f2){logger[_0x4482('0xa')](_0x4482('0xb'),_0x314381,_0x4482('0xc'));logger[_0x4482('0xd')](_0x4482('0xe'),_0x314381,_0x4482('0xc'),JSON[_0x4482('0xf')](_0x5cd2f2));if(_0x5cd2f2[_0x4482('0x10')]){if(_0x5cd2f2[_0x4482('0x10')][_0x4482('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x314381,_0x5cd2f2[_0x4482('0x10')]['message']);return _0xf789e0(_0x5cd2f2[_0x4482('0x10')][_0x4482('0x12')]);}logger[_0x4482('0x10')](_0x4482('0xb'),_0x314381,_0x5cd2f2['error']['message']);return _0x2a0b98(_0x5cd2f2['error'][_0x4482('0x12')]);}else{logger[_0x4482('0xa')](_0x4482('0xb'),_0x314381,'request\x20sent');_0x2a0b98(_0x5cd2f2['result']['message']);}})[_0x4482('0x13')](function(_0xcaea85){logger[_0x4482('0x10')](_0x4482('0xb'),_0x314381,_0xcaea85);_0xf789e0(_0xcaea85);});});}exports['CreateFaxQueueReport']=function(_0x328787){var _0x2de754=this;return new Promise(function(_0x3ded3e,_0x42d10c){return db['FaxQueueReport'][_0x4482('0x14')](_0x328787[_0x4482('0x15')],{'raw':_0x328787[_0x4482('0x16')]?_0x328787[_0x4482('0x16')][_0x4482('0x17')]===undefined?!![]:![]:!![]})[_0x4482('0x18')](function(_0xceef4c){logger[_0x4482('0xa')](_0x4482('0x19'),_0x328787);logger[_0x4482('0xd')]('CreateFaxQueueReport',_0x328787,JSON[_0x4482('0xf')](_0xceef4c));_0x3ded3e(_0xceef4c);})[_0x4482('0x13')](function(_0x42af53){logger[_0x4482('0x10')](_0x4482('0x19'),_0x42af53['message'],_0x328787);_0x42d10c(_0x2de754['error'](0x1f4,_0x42af53[_0x4482('0x12')]));});});};exports[_0x4482('0x1a')]=function(_0xc20a21){var _0x1acd49=this;return new Promise(function(_0x3e72f3,_0x57f3c7){return db[_0x4482('0x1b')][_0x4482('0x1c')](_0xc20a21[_0x4482('0x15')],{'raw':_0xc20a21[_0x4482('0x16')]?_0xc20a21[_0x4482('0x16')][_0x4482('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc20a21['options']?_0xc20a21['options']['where']||null:null,'attributes':_0xc20a21[_0x4482('0x16')]?_0xc20a21[_0x4482('0x16')]['attributes']||null:null,'limit':_0xc20a21[_0x4482('0x16')]?_0xc20a21[_0x4482('0x16')]['limit']||null:null})[_0x4482('0x18')](function(_0x14513c){logger[_0x4482('0xa')](_0x4482('0x1a'),_0xc20a21);logger[_0x4482('0xd')](_0x4482('0x1a'),_0xc20a21,JSON[_0x4482('0xf')](_0x14513c));_0x3e72f3(_0x14513c);})[_0x4482('0x13')](function(_0x29b4c5){logger['error'](_0x4482('0x1a'),_0x29b4c5['message'],_0xc20a21);_0x57f3c7(_0x1acd49['error'](0x1f4,_0x29b4c5[_0x4482('0x12')]));});});}; \ No newline at end of file +var _0xcd4b=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxQueueReport','body','options','raw','then','CreateFaxQueueReport','UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x51c391,_0x45cf7e){var _0x37de6a=function(_0x5305de){while(--_0x5305de){_0x51c391['push'](_0x51c391['shift']());}};_0x37de6a(++_0x45cf7e);}(_0xcd4b,0x77));var _0xbcd4=function(_0x2a3b70,_0x137f86){_0x2a3b70=_0x2a3b70-0x0;var _0x376380=_0xcd4b[_0x2a3b70];return _0x376380;};'use strict';var _=require(_0xbcd4('0x0'));var util=require(_0xbcd4('0x1'));var moment=require(_0xbcd4('0x2'));var BPromise=require(_0xbcd4('0x3'));var rs=require(_0xbcd4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcd4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbcd4('0x6'));var config=require(_0xbcd4('0x7'));var jayson=require(_0xbcd4('0x8'));var client=jayson[_0xbcd4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e09c,_0x11d8d6,_0x268fba){return new BPromise(function(_0x6e28bb,_0x2274f0){return client['request'](_0x56e09c,_0x268fba)['then'](function(_0x28e558){logger[_0xbcd4('0xa')](_0xbcd4('0xb'),_0x11d8d6,_0xbcd4('0xc'));logger[_0xbcd4('0xd')](_0xbcd4('0xe'),_0x11d8d6,_0xbcd4('0xc'),JSON[_0xbcd4('0xf')](_0x28e558));if(_0x28e558['error']){if(_0x28e558[_0xbcd4('0x10')][_0xbcd4('0x11')]===0x1f4){logger[_0xbcd4('0x10')](_0xbcd4('0xb'),_0x11d8d6,_0x28e558['error'][_0xbcd4('0x12')]);return _0x2274f0(_0x28e558[_0xbcd4('0x10')][_0xbcd4('0x12')]);}logger[_0xbcd4('0x10')](_0xbcd4('0xb'),_0x11d8d6,_0x28e558['error'][_0xbcd4('0x12')]);return _0x6e28bb(_0x28e558[_0xbcd4('0x10')][_0xbcd4('0x12')]);}else{logger['info'](_0xbcd4('0xb'),_0x11d8d6,_0xbcd4('0xc'));_0x6e28bb(_0x28e558[_0xbcd4('0x13')][_0xbcd4('0x12')]);}})[_0xbcd4('0x14')](function(_0x23720c){logger[_0xbcd4('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x11d8d6,_0x23720c);_0x2274f0(_0x23720c);});});}exports['CreateFaxQueueReport']=function(_0x737784){var _0x14f8fa=this;return new Promise(function(_0xb51997,_0x189a47){return db[_0xbcd4('0x15')]['create'](_0x737784[_0xbcd4('0x16')],{'raw':_0x737784[_0xbcd4('0x17')]?_0x737784[_0xbcd4('0x17')][_0xbcd4('0x18')]===undefined?!![]:![]:!![]})[_0xbcd4('0x19')](function(_0x640c4f){logger['info']('CreateFaxQueueReport',_0x737784);logger[_0xbcd4('0xd')]('CreateFaxQueueReport',_0x737784,JSON[_0xbcd4('0xf')](_0x640c4f));_0xb51997(_0x640c4f);})[_0xbcd4('0x14')](function(_0x5928e4){logger[_0xbcd4('0x10')](_0xbcd4('0x1a'),_0x5928e4['message'],_0x737784);_0x189a47(_0x14f8fa[_0xbcd4('0x10')](0x1f4,_0x5928e4[_0xbcd4('0x12')]));});});};exports[_0xbcd4('0x1b')]=function(_0x44ba26){var _0x36b3cb=this;return new Promise(function(_0x1e95f2,_0x796ab){return db[_0xbcd4('0x15')]['update'](_0x44ba26[_0xbcd4('0x16')],{'raw':_0x44ba26[_0xbcd4('0x17')]?_0x44ba26[_0xbcd4('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ba26[_0xbcd4('0x17')]?_0x44ba26[_0xbcd4('0x17')][_0xbcd4('0x1c')]||null:null,'attributes':_0x44ba26['options']?_0x44ba26[_0xbcd4('0x17')][_0xbcd4('0x1d')]||null:null,'limit':_0x44ba26[_0xbcd4('0x17')]?_0x44ba26[_0xbcd4('0x17')][_0xbcd4('0x1e')]||null:null})[_0xbcd4('0x19')](function(_0x1b9f8d){logger[_0xbcd4('0xa')](_0xbcd4('0x1b'),_0x44ba26);logger[_0xbcd4('0xd')](_0xbcd4('0x1b'),_0x44ba26,JSON[_0xbcd4('0xf')](_0x1b9f8d));_0x1e95f2(_0x1b9f8d);})[_0xbcd4('0x14')](function(_0x2dfaa0){logger['error']('UpdateFaxQueueReport',_0x2dfaa0[_0xbcd4('0x12')],_0x44ba26);_0x796ab(_0x36b3cb['error'](0x1f4,_0x2dfaa0[_0xbcd4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e1b5c3e..961b738 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 _0x3bbb=['/:id','post','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x3bbb,0x1c0));var _0xb3bb=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x3bbb[_0xef4cf0];return _0x497ad2;};'use strict';var multer=require('multer');var util=require(_0xb3bb('0x0'));var path=require('path');var timeout=require(_0xb3bb('0x1'));var express=require(_0xb3bb('0x2'));var router=express[_0xb3bb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3bb('0x4'));var interaction=require(_0xb3bb('0x5'));var config=require(_0xb3bb('0x6'));var controller=require('./faxQueueReport.controller');router[_0xb3bb('0x7')]('/',auth[_0xb3bb('0x8')](),controller['index']);router[_0xb3bb('0x7')](_0xb3bb('0x9'),auth['isAuthenticated'](),controller[_0xb3bb('0xa')]);router[_0xb3bb('0x7')](_0xb3bb('0xb'),auth[_0xb3bb('0x8')](),controller['show']);router[_0xb3bb('0xc')]('/',auth[_0xb3bb('0x8')](),controller[_0xb3bb('0xd')]);router[_0xb3bb('0xe')]('/:id',auth[_0xb3bb('0x8')](),controller['update']);router[_0xb3bb('0xf')](_0xb3bb('0xb'),auth[_0xb3bb('0x8')](),controller['destroy']);module[_0xb3bb('0x10')]=router; \ No newline at end of file +var _0x834f=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x1cff29,_0x5c7710){var _0x2db618=function(_0x1a5e82){while(--_0x1a5e82){_0x1cff29['push'](_0x1cff29['shift']());}};_0x2db618(++_0x5c7710);}(_0x834f,0x7f));var _0xf834=function(_0x3bd97c,_0x16b69c){_0x3bd97c=_0x3bd97c-0x0;var _0x4bb346=_0x834f[_0x3bd97c];return _0x4bb346;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf834('0x0'));var express=require(_0xf834('0x1'));var router=express[_0xf834('0x2')]();var fs_extra=require(_0xf834('0x3'));var auth=require(_0xf834('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf834('0x5'));router['get']('/',auth[_0xf834('0x6')](),controller['index']);router[_0xf834('0x7')](_0xf834('0x8'),auth[_0xf834('0x6')](),controller[_0xf834('0x9')]);router[_0xf834('0x7')](_0xf834('0xa'),auth[_0xf834('0x6')](),controller[_0xf834('0xb')]);router[_0xf834('0xc')]('/',auth[_0xf834('0x6')](),controller[_0xf834('0xd')]);router[_0xf834('0xe')](_0xf834('0xa'),auth[_0xf834('0x6')](),controller['update']);router[_0xf834('0xf')](_0xf834('0xa'),auth[_0xf834('0x6')](),controller[_0xf834('0x10')]);module[_0xf834('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 591c9a0..4dd5b1b 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xd034c8,_0x4b5fbe){var _0x37c283=function(_0x1fc5c3){while(--_0x1fc5c3){_0xd034c8['push'](_0xd034c8['shift']());}};_0x37c283(++_0x4b5fbe);}(_0x34e8,0x12c));var _0x834e=function(_0xca972b,_0x29f0c0){_0xca972b=_0xca972b-0x0;var _0x1f196e=_0x34e8[_0xca972b];return _0x1f196e;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30aadc,_0x5cbec0){_0x30aadc=_0x30aadc-0x0;var _0x183315=_0xb43b[_0x30aadc];return _0x183315;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index dc3d0b1..6a05597 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 _0x89bd=['VIRTUAL','filter','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge'];(function(_0x4a226f,_0x3cb733){var _0x251cf2=function(_0x83a828){while(--_0x83a828){_0x4a226f['push'](_0x4a226f['shift']());}};_0x251cf2(++_0x3cb733);}(_0x89bd,0x1d8));var _0xd89b=function(_0x233ab8,_0xb0d3d1){_0x233ab8=_0x233ab8-0x0;var _0x3bbdee=_0x89bd[_0x233ab8];return _0x3bbdee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd89b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd89b('0x1'));var rp=require(_0xd89b('0x2'));var moment=require('moment');var BPromise=require(_0xd89b('0x3'));var Mustache=require('mustache');var util=require(_0xd89b('0x4'));var path=require(_0xd89b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd89b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd89b('0x7'));var crypto=require(_0xd89b('0x8'));var jsforce=require(_0xd89b('0x9'));var deskjs=require(_0xd89b('0xa'));var toCsv=require(_0xd89b('0xb'));var querystring=require('querystring');var Papa=require(_0xd89b('0xc'));var Redis=require(_0xd89b('0xd'));var authService=require(_0xd89b('0xe'));var qs=require(_0xd89b('0xf'));var as=require(_0xd89b('0x10'));var hardwareService=require(_0xd89b('0x11'));var logger=require(_0xd89b('0x12'))('api');var utils=require(_0xd89b('0x13'));var config=require(_0xd89b('0x14'));var licenseUtil=require(_0xd89b('0x15'));var db=require(_0xd89b('0x16'))['db'];function respondWithStatusCode(_0x56be30,_0x461a27){_0x461a27=_0x461a27||0xcc;return function(_0x10e136){if(_0x10e136){return _0x56be30[_0xd89b('0x17')](_0x461a27);}return _0x56be30[_0xd89b('0x18')](_0x461a27)[_0xd89b('0x19')]();};}function respondWithResult(_0x5c4857,_0x24ec52){_0x24ec52=_0x24ec52||0xc8;return function(_0x154498){if(_0x154498){return _0x5c4857['status'](_0x24ec52)[_0xd89b('0x1a')](_0x154498);}};}function respondWithFilteredResult(_0x1bc93a,_0x11da85){return function(_0x5eced0){if(_0x5eced0){var _0x4d9c19=typeof _0x11da85[_0xd89b('0x1b')]===_0xd89b('0x1c')&&typeof _0x11da85[_0xd89b('0x1d')]==='undefined';var _0x177ed9=_0x5eced0[_0xd89b('0x1e')];var _0x1d3d9c=_0x4d9c19?0x0:_0x11da85[_0xd89b('0x1b')];var _0x3703b7=_0x4d9c19?_0x5eced0[_0xd89b('0x1e')]:_0x11da85[_0xd89b('0x1b')]+_0x11da85['limit'];var _0x26df9a;if(_0x3703b7>=_0x177ed9){_0x3703b7=_0x177ed9;_0x26df9a=0xc8;}else{_0x26df9a=0xce;}_0x1bc93a[_0xd89b('0x18')](_0x26df9a);return _0x1bc93a['set'](_0xd89b('0x1f'),_0x1d3d9c+'-'+_0x3703b7+'/'+_0x177ed9)[_0xd89b('0x1a')](_0x5eced0);}return null;};}function patchUpdates(_0x3649cc){return function(_0x3cb1ef){try{jsonpatch[_0xd89b('0x20')](_0x3cb1ef,_0x3649cc,!![]);}catch(_0x52829f){return BPromise[_0xd89b('0x21')](_0x52829f);}return _0x3cb1ef[_0xd89b('0x22')]();};}function saveUpdates(_0x25c2a6,_0x46e996){return function(_0x364b37){if(_0x364b37){return _0x364b37['update'](_0x25c2a6)[_0xd89b('0x23')](function(_0x267e52){return _0x267e52;});}return null;};}function removeEntity(_0x42e331,_0x38a568){return function(_0x3d9a84){if(_0x3d9a84){return _0x3d9a84[_0xd89b('0x24')]()[_0xd89b('0x23')](function(){_0x42e331[_0xd89b('0x18')](0xcc)[_0xd89b('0x19')]();});}};}function handleEntityNotFound(_0x253590,_0x3e2169){return function(_0x29e0dd){if(!_0x29e0dd){_0x253590[_0xd89b('0x17')](0x194);}return _0x29e0dd;};}function handleError(_0x3ddaff,_0x31ea66){_0x31ea66=_0x31ea66||0x1f4;return function(_0x3f5ce3){logger['error'](_0x3f5ce3[_0xd89b('0x25')]);if(_0x3f5ce3[_0xd89b('0x26')]){delete _0x3f5ce3[_0xd89b('0x26')];}_0x3ddaff[_0xd89b('0x18')](_0x31ea66)[_0xd89b('0x27')](_0x3f5ce3);};}exports[_0xd89b('0x28')]=function(_0xdd987d,_0x392f0a){var _0x48e4ea={},_0x9000d4={},_0x31d889={'count':0x0,'rows':[]};var _0x31b0f4=_[_0xd89b('0x29')](db['FaxTransferReport'][_0xd89b('0x2a')],function(_0x4e07f0){return{'name':_0x4e07f0[_0xd89b('0x2b')],'type':_0x4e07f0[_0xd89b('0x2c')][_0xd89b('0x2d')]};});_0x9000d4['model']=_['map'](_0x31b0f4,_0xd89b('0x26'));_0x9000d4[_0xd89b('0x2e')]=_[_0xd89b('0x2f')](_0xdd987d['query']);_0x9000d4[_0xd89b('0x30')]=_[_0xd89b('0x31')](_0x9000d4['model'],_0x9000d4[_0xd89b('0x2e')]);_0x48e4ea['attributes']=_[_0xd89b('0x31')](_0x9000d4[_0xd89b('0x32')],qs[_0xd89b('0x33')](_0xdd987d[_0xd89b('0x2e')][_0xd89b('0x33')]));_0x48e4ea[_0xd89b('0x34')]=_0x48e4ea[_0xd89b('0x34')][_0xd89b('0x35')]?_0x48e4ea[_0xd89b('0x34')]:_0x9000d4['model'];if(!_0xdd987d[_0xd89b('0x2e')][_0xd89b('0x36')]('nolimit')){_0x48e4ea[_0xd89b('0x1d')]=qs[_0xd89b('0x1d')](_0xdd987d['query'][_0xd89b('0x1d')]);_0x48e4ea[_0xd89b('0x1b')]=qs[_0xd89b('0x1b')](_0xdd987d[_0xd89b('0x2e')][_0xd89b('0x1b')]);}_0x48e4ea[_0xd89b('0x37')]=qs[_0xd89b('0x38')](_0xdd987d['query']['sort']);_0x48e4ea[_0xd89b('0x39')]=qs[_0xd89b('0x30')](_[_0xd89b('0x3a')](_0xdd987d['query'],_0x9000d4[_0xd89b('0x30')]),_0x31b0f4);if(_0xdd987d[_0xd89b('0x2e')]['filter']){_0x48e4ea[_0xd89b('0x39')]=_[_0xd89b('0x3b')](_0x48e4ea[_0xd89b('0x39')],{'$or':_[_0xd89b('0x29')](_0x31b0f4,function(_0x2201b6){if(_0x2201b6['type']!==_0xd89b('0x3c')){var _0x5f550a={};_0x5f550a[_0x2201b6['name']]={'$like':'%'+_0xdd987d[_0xd89b('0x2e')][_0xd89b('0x3d')]+'%'};return _0x5f550a;}})});}_0x48e4ea=_[_0xd89b('0x3b')]({},_0x48e4ea,_0xdd987d[_0xd89b('0x3e')]);var _0x83ee26={'where':_0x48e4ea[_0xd89b('0x39')]};return db[_0xd89b('0x3f')][_0xd89b('0x1e')](_0x83ee26)[_0xd89b('0x23')](function(_0x120b25){_0x31d889[_0xd89b('0x1e')]=_0x120b25;if(_0xdd987d[_0xd89b('0x2e')][_0xd89b('0x40')]){_0x48e4ea[_0xd89b('0x41')]=[{'all':!![]}];}return db[_0xd89b('0x3f')][_0xd89b('0x42')](_0x48e4ea);})[_0xd89b('0x23')](function(_0x1c019a){_0x31d889[_0xd89b('0x43')]=_0x1c019a;return _0x31d889;})[_0xd89b('0x23')](respondWithFilteredResult(_0x392f0a,_0x48e4ea))[_0xd89b('0x44')](handleError(_0x392f0a,null));};exports[_0xd89b('0x45')]=function(_0x14e7fa,_0x1b5647){var _0x32315b={'raw':!![],'where':{'id':_0x14e7fa['params']['id']}},_0x2fc311={};_0x2fc311[_0xd89b('0x32')]=_[_0xd89b('0x2f')](db[_0xd89b('0x3f')][_0xd89b('0x2a')]);_0x2fc311[_0xd89b('0x2e')]=_[_0xd89b('0x2f')](_0x14e7fa[_0xd89b('0x2e')]);_0x2fc311[_0xd89b('0x30')]=_[_0xd89b('0x31')](_0x2fc311[_0xd89b('0x32')],_0x2fc311[_0xd89b('0x2e')]);_0x32315b[_0xd89b('0x34')]=_[_0xd89b('0x31')](_0x2fc311['model'],qs[_0xd89b('0x33')](_0x14e7fa[_0xd89b('0x2e')]['fields']));_0x32315b[_0xd89b('0x34')]=_0x32315b['attributes'][_0xd89b('0x35')]?_0x32315b[_0xd89b('0x34')]:_0x2fc311[_0xd89b('0x32')];if(_0x14e7fa[_0xd89b('0x2e')][_0xd89b('0x40')]){_0x32315b[_0xd89b('0x41')]=[{'all':!![]}];}_0x32315b=_['merge']({},_0x32315b,_0x14e7fa[_0xd89b('0x3e')]);return db[_0xd89b('0x3f')][_0xd89b('0x46')](_0x32315b)[_0xd89b('0x23')](handleEntityNotFound(_0x1b5647,null))['then'](respondWithResult(_0x1b5647,null))[_0xd89b('0x44')](handleError(_0x1b5647,null));};exports[_0xd89b('0x47')]=function(_0x101725,_0x1ba532){return db[_0xd89b('0x3f')][_0xd89b('0x47')](_0x101725['body'],{})[_0xd89b('0x23')](respondWithResult(_0x1ba532,0xc9))[_0xd89b('0x44')](handleError(_0x1ba532,null));};exports[_0xd89b('0x48')]=function(_0x2183c3,_0x402f88){if(_0x2183c3[_0xd89b('0x49')]['id']){delete _0x2183c3[_0xd89b('0x49')]['id'];}return db[_0xd89b('0x3f')][_0xd89b('0x46')]({'where':{'id':_0x2183c3[_0xd89b('0x4a')]['id']}})[_0xd89b('0x23')](handleEntityNotFound(_0x402f88,null))[_0xd89b('0x23')](saveUpdates(_0x2183c3[_0xd89b('0x49')],null))[_0xd89b('0x23')](respondWithResult(_0x402f88,null))[_0xd89b('0x44')](handleError(_0x402f88,null));};exports[_0xd89b('0x24')]=function(_0x33b21e,_0x281ff8){return db[_0xd89b('0x3f')][_0xd89b('0x46')]({'where':{'id':_0x33b21e[_0xd89b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x281ff8,null))[_0xd89b('0x23')](removeEntity(_0x281ff8,null))['catch'](handleError(_0x281ff8,null));};exports[_0xd89b('0x4b')]=function(_0x138075,_0x5c85e6){return db[_0xd89b('0x3f')][_0xd89b('0x4b')]()[_0xd89b('0x23')](respondWithResult(_0x5c85e6,null))[_0xd89b('0x44')](handleError(_0x5c85e6,null));}; \ No newline at end of file +var _0x9ef4=['options','includeAll','findAll','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x9ef4,0x1cd));var _0x49ef=function(_0x5e8b71,_0x39d00a){_0x5e8b71=_0x5e8b71-0x0;var _0x189134=_0x9ef4[_0x5e8b71];return _0x189134;};'use strict';var emlformat=require(_0x49ef('0x0'));var rimraf=require(_0x49ef('0x1'));var zipdir=require(_0x49ef('0x2'));var jsonpatch=require(_0x49ef('0x3'));var rp=require(_0x49ef('0x4'));var moment=require(_0x49ef('0x5'));var BPromise=require(_0x49ef('0x6'));var Mustache=require(_0x49ef('0x7'));var util=require(_0x49ef('0x8'));var path=require(_0x49ef('0x9'));var sox=require(_0x49ef('0xa'));var csv=require(_0x49ef('0xb'));var ejs=require(_0x49ef('0xc'));var fs=require('fs');var fs_extra=require(_0x49ef('0xd'));var _=require(_0x49ef('0xe'));var squel=require('squel');var crypto=require(_0x49ef('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x49ef('0x10'));var toCsv=require(_0x49ef('0xb'));var querystring=require(_0x49ef('0x11'));var Papa=require(_0x49ef('0x12'));var Redis=require('ioredis');var authService=require(_0x49ef('0x13'));var qs=require(_0x49ef('0x14'));var as=require(_0x49ef('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x49ef('0x16'));var config=require(_0x49ef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x49ef('0x18'))['db'];function respondWithStatusCode(_0x310187,_0x4eba65){_0x4eba65=_0x4eba65||0xcc;return function(_0x61c805){if(_0x61c805){return _0x310187[_0x49ef('0x19')](_0x4eba65);}return _0x310187[_0x49ef('0x1a')](_0x4eba65)[_0x49ef('0x1b')]();};}function respondWithResult(_0x4ecd8f,_0x543be3){_0x543be3=_0x543be3||0xc8;return function(_0x1a73a8){if(_0x1a73a8){return _0x4ecd8f['status'](_0x543be3)[_0x49ef('0x1c')](_0x1a73a8);}};}function respondWithFilteredResult(_0x25bb24,_0xc75893){return function(_0x5e71fb){if(_0x5e71fb){var _0x1f09b9=typeof _0xc75893[_0x49ef('0x1d')]===_0x49ef('0x1e')&&typeof _0xc75893[_0x49ef('0x1f')]==='undefined';var _0x41d684=_0x5e71fb[_0x49ef('0x20')];var _0x511d84=_0x1f09b9?0x0:_0xc75893[_0x49ef('0x1d')];var _0x5aeaea=_0x1f09b9?_0x5e71fb[_0x49ef('0x20')]:_0xc75893[_0x49ef('0x1d')]+_0xc75893[_0x49ef('0x1f')];var _0x1312e0;if(_0x5aeaea>=_0x41d684){_0x5aeaea=_0x41d684;_0x1312e0=0xc8;}else{_0x1312e0=0xce;}_0x25bb24['status'](_0x1312e0);return _0x25bb24[_0x49ef('0x21')](_0x49ef('0x22'),_0x511d84+'-'+_0x5aeaea+'/'+_0x41d684)['json'](_0x5e71fb);}return null;};}function patchUpdates(_0x2ba207){return function(_0x522caf){try{jsonpatch[_0x49ef('0x23')](_0x522caf,_0x2ba207,!![]);}catch(_0x542996){return BPromise[_0x49ef('0x24')](_0x542996);}return _0x522caf['save']();};}function saveUpdates(_0x1e041f,_0x40a45f){return function(_0x58bf3a){if(_0x58bf3a){return _0x58bf3a[_0x49ef('0x25')](_0x1e041f)[_0x49ef('0x26')](function(_0x29f25c){return _0x29f25c;});}return null;};}function removeEntity(_0x48d23b,_0x329eb4){return function(_0x41194b){if(_0x41194b){return _0x41194b[_0x49ef('0x27')]()[_0x49ef('0x26')](function(){_0x48d23b[_0x49ef('0x1a')](0xcc)[_0x49ef('0x1b')]();});}};}function handleEntityNotFound(_0x290f7e,_0x337146){return function(_0x1204ad){if(!_0x1204ad){_0x290f7e['sendStatus'](0x194);}return _0x1204ad;};}function handleError(_0x4f6454,_0x48ab1c){_0x48ab1c=_0x48ab1c||0x1f4;return function(_0x147314){logger['error'](_0x147314[_0x49ef('0x28')]);if(_0x147314[_0x49ef('0x29')]){delete _0x147314[_0x49ef('0x29')];}_0x4f6454[_0x49ef('0x1a')](_0x48ab1c)[_0x49ef('0x2a')](_0x147314);};}exports[_0x49ef('0x2b')]=function(_0x145df4,_0xfa8976){var _0x1937f5={},_0x26f2bb={},_0x3a5643={'count':0x0,'rows':[]};var _0x342c75=_['map'](db[_0x49ef('0x2c')][_0x49ef('0x2d')],function(_0x121f76){return{'name':_0x121f76[_0x49ef('0x2e')],'type':_0x121f76[_0x49ef('0x2f')][_0x49ef('0x30')]};});_0x26f2bb[_0x49ef('0x31')]=_[_0x49ef('0x32')](_0x342c75,'name');_0x26f2bb[_0x49ef('0x33')]=_[_0x49ef('0x34')](_0x145df4[_0x49ef('0x33')]);_0x26f2bb[_0x49ef('0x35')]=_[_0x49ef('0x36')](_0x26f2bb[_0x49ef('0x31')],_0x26f2bb[_0x49ef('0x33')]);_0x1937f5['attributes']=_['intersection'](_0x26f2bb['model'],qs['fields'](_0x145df4[_0x49ef('0x33')][_0x49ef('0x37')]));_0x1937f5[_0x49ef('0x38')]=_0x1937f5[_0x49ef('0x38')][_0x49ef('0x39')]?_0x1937f5['attributes']:_0x26f2bb[_0x49ef('0x31')];if(!_0x145df4[_0x49ef('0x33')]['hasOwnProperty']('nolimit')){_0x1937f5['limit']=qs[_0x49ef('0x1f')](_0x145df4[_0x49ef('0x33')][_0x49ef('0x1f')]);_0x1937f5[_0x49ef('0x1d')]=qs[_0x49ef('0x1d')](_0x145df4[_0x49ef('0x33')][_0x49ef('0x1d')]);}_0x1937f5['order']=qs[_0x49ef('0x3a')](_0x145df4[_0x49ef('0x33')][_0x49ef('0x3a')]);_0x1937f5[_0x49ef('0x3b')]=qs[_0x49ef('0x35')](_[_0x49ef('0x3c')](_0x145df4['query'],_0x26f2bb['filters']),_0x342c75);if(_0x145df4['query']['filter']){_0x1937f5['where']=_[_0x49ef('0x3d')](_0x1937f5[_0x49ef('0x3b')],{'$or':_['map'](_0x342c75,function(_0x45010e){if(_0x45010e[_0x49ef('0x2f')]!==_0x49ef('0x3e')){var _0x3660d9={};_0x3660d9[_0x45010e[_0x49ef('0x29')]]={'$like':'%'+_0x145df4[_0x49ef('0x33')][_0x49ef('0x3f')]+'%'};return _0x3660d9;}})});}_0x1937f5=_[_0x49ef('0x3d')]({},_0x1937f5,_0x145df4[_0x49ef('0x40')]);var _0x57c5a0={'where':_0x1937f5[_0x49ef('0x3b')]};return db[_0x49ef('0x2c')]['count'](_0x57c5a0)[_0x49ef('0x26')](function(_0x2b0dde){_0x3a5643[_0x49ef('0x20')]=_0x2b0dde;if(_0x145df4[_0x49ef('0x33')][_0x49ef('0x41')]){_0x1937f5['include']=[{'all':!![]}];}return db[_0x49ef('0x2c')][_0x49ef('0x42')](_0x1937f5);})[_0x49ef('0x26')](function(_0x573353){_0x3a5643['rows']=_0x573353;return _0x3a5643;})['then'](respondWithFilteredResult(_0xfa8976,_0x1937f5))[_0x49ef('0x43')](handleError(_0xfa8976,null));};exports[_0x49ef('0x44')]=function(_0x36db54,_0x4bf313){var _0x224088={'raw':!![],'where':{'id':_0x36db54[_0x49ef('0x45')]['id']}},_0x443c0b={};_0x443c0b[_0x49ef('0x31')]=_[_0x49ef('0x34')](db['FaxTransferReport'][_0x49ef('0x2d')]);_0x443c0b[_0x49ef('0x33')]=_[_0x49ef('0x34')](_0x36db54[_0x49ef('0x33')]);_0x443c0b[_0x49ef('0x35')]=_[_0x49ef('0x36')](_0x443c0b[_0x49ef('0x31')],_0x443c0b[_0x49ef('0x33')]);_0x224088['attributes']=_[_0x49ef('0x36')](_0x443c0b['model'],qs[_0x49ef('0x37')](_0x36db54['query'][_0x49ef('0x37')]));_0x224088[_0x49ef('0x38')]=_0x224088[_0x49ef('0x38')]['length']?_0x224088[_0x49ef('0x38')]:_0x443c0b[_0x49ef('0x31')];if(_0x36db54[_0x49ef('0x33')][_0x49ef('0x41')]){_0x224088[_0x49ef('0x46')]=[{'all':!![]}];}_0x224088=_['merge']({},_0x224088,_0x36db54[_0x49ef('0x40')]);return db['FaxTransferReport']['find'](_0x224088)[_0x49ef('0x26')](handleEntityNotFound(_0x4bf313,null))[_0x49ef('0x26')](respondWithResult(_0x4bf313,null))[_0x49ef('0x43')](handleError(_0x4bf313,null));};exports[_0x49ef('0x47')]=function(_0x2ea585,_0x423eb2){return db[_0x49ef('0x2c')][_0x49ef('0x47')](_0x2ea585[_0x49ef('0x48')],{})[_0x49ef('0x26')](respondWithResult(_0x423eb2,0xc9))[_0x49ef('0x43')](handleError(_0x423eb2,null));};exports['update']=function(_0x443f77,_0xf00339){if(_0x443f77[_0x49ef('0x48')]['id']){delete _0x443f77['body']['id'];}return db[_0x49ef('0x2c')][_0x49ef('0x49')]({'where':{'id':_0x443f77[_0x49ef('0x45')]['id']}})[_0x49ef('0x26')](handleEntityNotFound(_0xf00339,null))[_0x49ef('0x26')](saveUpdates(_0x443f77[_0x49ef('0x48')],null))[_0x49ef('0x26')](respondWithResult(_0xf00339,null))['catch'](handleError(_0xf00339,null));};exports[_0x49ef('0x27')]=function(_0x3e7c98,_0x5c34ec){return db[_0x49ef('0x2c')]['find']({'where':{'id':_0x3e7c98[_0x49ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c34ec,null))[_0x49ef('0x26')](removeEntity(_0x5c34ec,null))[_0x49ef('0x43')](handleError(_0x5c34ec,null));};exports[_0x49ef('0x4a')]=function(_0x51ec06,_0x531046){return db[_0x49ef('0x2c')]['describe']()[_0x49ef('0x26')](respondWithResult(_0x531046,null))[_0x49ef('0x43')](handleError(_0x531046,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bc51411..d386e2b 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 _0x213d=['../../config/environment','./faxTransferReport.attributes','report_fax_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x4a58cb,_0x2239a5){var _0x3bd47b=function(_0xf1b152){while(--_0xf1b152){_0x4a58cb['push'](_0x4a58cb['shift']());}};_0x3bd47b(++_0x2239a5);}(_0x213d,0x1bc));var _0xd213=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x213d[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xd213('0x0'));var util=require(_0xd213('0x1'));var logger=require(_0xd213('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd213('0x3'));var fs=require('fs');var path=require(_0xd213('0x4'));var rimraf=require(_0xd213('0x5'));var config=require(_0xd213('0x6'));var attributes=require(_0xd213('0x7'));module['exports']=function(_0x4ddf28,_0x44e619){return _0x4ddf28['define']('FaxTransferReport',attributes,{'tableName':_0xd213('0x8'),'paranoid':![],'indexes':[{'name':_0xd213('0x9'),'fields':[_0xd213('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0580=['bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x19978f,_0x368812){var _0x1abb9e=function(_0x337da3){while(--_0x337da3){_0x19978f['push'](_0x19978f['shift']());}};_0x1abb9e(++_0x368812);}(_0x0580,0x1d0));var _0x0058=function(_0x1872bc,_0x33853a){_0x1872bc=_0x1872bc-0x0;var _0x39a8df=_0x0580[_0x1872bc];return _0x39a8df;};'use strict';var _=require(_0x0058('0x0'));var util=require(_0x0058('0x1'));var logger=require(_0x0058('0x2'))('api');var moment=require(_0x0058('0x3'));var BPromise=require(_0x0058('0x4'));var rp=require(_0x0058('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0058('0x6'));var config=require(_0x0058('0x7'));var attributes=require(_0x0058('0x8'));module[_0x0058('0x9')]=function(_0x2a4dbc,_0xc3712a){return _0x2a4dbc[_0x0058('0xa')](_0x0058('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0058('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 972459e..21306cf 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 _0xee19=['jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2bfb35,_0x252eb1){var _0x3e66a6=function(_0x4bcd6c){while(--_0x4bcd6c){_0x2bfb35['push'](_0x2bfb35['shift']());}};_0x3e66a6(++_0x252eb1);}(_0xee19,0x1bf));var _0x9ee1=function(_0x12f26e,_0x1dfc0c){_0x12f26e=_0x12f26e-0x0;var _0xf27705=_0xee19[_0x12f26e];return _0xf27705;};'use strict';var _=require(_0x9ee1('0x0'));var util=require(_0x9ee1('0x1'));var moment=require(_0x9ee1('0x2'));var BPromise=require(_0x9ee1('0x3'));var rs=require(_0x9ee1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ee1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ee1('0x6'))(_0x9ee1('0x7'));var config=require(_0x9ee1('0x8'));var jayson=require(_0x9ee1('0x9'));var client=jayson[_0x9ee1('0xa')][_0x9ee1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585f94,_0x192f2f,_0x341949){return new BPromise(function(_0xd817a,_0x19ffc0){return client['request'](_0x585f94,_0x341949)[_0x9ee1('0xc')](function(_0x32d3e1){logger[_0x9ee1('0xd')](_0x9ee1('0xe'),_0x192f2f,'request\x20sent');logger[_0x9ee1('0xf')](_0x9ee1('0x10'),_0x192f2f,_0x9ee1('0x11'),JSON[_0x9ee1('0x12')](_0x32d3e1));if(_0x32d3e1[_0x9ee1('0x13')]){if(_0x32d3e1[_0x9ee1('0x13')][_0x9ee1('0x14')]===0x1f4){logger[_0x9ee1('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x192f2f,_0x32d3e1[_0x9ee1('0x13')][_0x9ee1('0x15')]);return _0x19ffc0(_0x32d3e1[_0x9ee1('0x13')][_0x9ee1('0x15')]);}logger[_0x9ee1('0x13')](_0x9ee1('0xe'),_0x192f2f,_0x32d3e1[_0x9ee1('0x13')][_0x9ee1('0x15')]);return _0xd817a(_0x32d3e1[_0x9ee1('0x13')][_0x9ee1('0x15')]);}else{logger[_0x9ee1('0xd')](_0x9ee1('0xe'),_0x192f2f,_0x9ee1('0x11'));_0xd817a(_0x32d3e1[_0x9ee1('0x16')][_0x9ee1('0x15')]);}})[_0x9ee1('0x17')](function(_0x19fe1b){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x192f2f,_0x19fe1b);_0x19ffc0(_0x19fe1b);});});} \ No newline at end of file +var _0xf7bf=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x57ee8,_0x129df7){var _0x8daa2=function(_0x482677){while(--_0x482677){_0x57ee8['push'](_0x57ee8['shift']());}};_0x8daa2(++_0x129df7);}(_0xf7bf,0x1b9));var _0xff7b=function(_0x12d573,_0x20ae28){_0x12d573=_0x12d573-0x0;var _0x5c7071=_0xf7bf[_0x12d573];return _0x5c7071;};'use strict';var _=require(_0xff7b('0x0'));var util=require(_0xff7b('0x1'));var moment=require(_0xff7b('0x2'));var BPromise=require('bluebird');var rs=require(_0xff7b('0x3'));var fs=require('fs');var Redis=require(_0xff7b('0x4'));var db=require(_0xff7b('0x5'))['db'];var utils=require(_0xff7b('0x6'));var logger=require('../../config/logger')(_0xff7b('0x7'));var config=require(_0xff7b('0x8'));var jayson=require(_0xff7b('0x9'));var client=jayson['client'][_0xff7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54830c,_0x3d9165,_0xa6ebf9){return new BPromise(function(_0x164a38,_0x5cba7c){return client[_0xff7b('0xb')](_0x54830c,_0xa6ebf9)[_0xff7b('0xc')](function(_0x14e9d6){logger['info'](_0xff7b('0xd'),_0x3d9165,_0xff7b('0xe'));logger[_0xff7b('0xf')](_0xff7b('0x10'),_0x3d9165,_0xff7b('0xe'),JSON['stringify'](_0x14e9d6));if(_0x14e9d6['error']){if(_0x14e9d6[_0xff7b('0x11')][_0xff7b('0x12')]===0x1f4){logger[_0xff7b('0x11')](_0xff7b('0xd'),_0x3d9165,_0x14e9d6[_0xff7b('0x11')][_0xff7b('0x13')]);return _0x5cba7c(_0x14e9d6[_0xff7b('0x11')][_0xff7b('0x13')]);}logger[_0xff7b('0x11')](_0xff7b('0xd'),_0x3d9165,_0x14e9d6[_0xff7b('0x11')][_0xff7b('0x13')]);return _0x164a38(_0x14e9d6['error'][_0xff7b('0x13')]);}else{logger[_0xff7b('0x14')](_0xff7b('0xd'),_0x3d9165,_0xff7b('0xe'));_0x164a38(_0x14e9d6[_0xff7b('0x15')][_0xff7b('0x13')]);}})['catch'](function(_0xa6adba){logger[_0xff7b('0x11')](_0xff7b('0xd'),_0x3d9165,_0xa6adba);_0x5cba7c(_0xa6adba);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index aaeebd3..35a88e1 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 _0x637d=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0xfbd40a,_0x3d6bf1){var _0x3ad856=function(_0x41e943){while(--_0x41e943){_0xfbd40a['push'](_0xfbd40a['shift']());}};_0x3ad856(++_0x3d6bf1);}(_0x637d,0x129));var _0xd637=function(_0xfa3795,_0x16b735){_0xfa3795=_0xfa3795-0x0;var _0x4e3a09=_0x637d[_0xfa3795];return _0x4e3a09;};'use strict';var multer=require(_0xd637('0x0'));var util=require(_0xd637('0x1'));var path=require(_0xd637('0x2'));var timeout=require(_0xd637('0x3'));var express=require(_0xd637('0x4'));var router=express[_0xd637('0x5')]();var fs_extra=require(_0xd637('0x6'));var auth=require(_0xd637('0x7'));var interaction=require(_0xd637('0x8'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xd637('0x9')]('/',auth[_0xd637('0xa')](),controller['index']);router['get'](_0xd637('0xb'),auth[_0xd637('0xa')](),controller[_0xd637('0xc')]);router[_0xd637('0x9')](_0xd637('0xd'),auth[_0xd637('0xa')](),controller[_0xd637('0xe')]);router[_0xd637('0xf')]('/',auth[_0xd637('0xa')](),controller[_0xd637('0x10')]);router[_0xd637('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd637('0x12')]);router[_0xd637('0x13')](_0xd637('0xd'),auth['isAuthenticated'](),controller[_0xd637('0x14')]);module[_0xd637('0x15')]=router; \ No newline at end of file +var _0xfd91=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer'];(function(_0x58b7bb,_0x481af6){var _0x58e6b6=function(_0x524c41){while(--_0x524c41){_0x58b7bb['push'](_0x58b7bb['shift']());}};_0x58e6b6(++_0x481af6);}(_0xfd91,0xbc));var _0x1fd9=function(_0x4be85c,_0x2520df){_0x4be85c=_0x4be85c-0x0;var _0x69a795=_0xfd91[_0x4be85c];return _0x69a795;};'use strict';var multer=require(_0x1fd9('0x0'));var util=require('util');var path=require(_0x1fd9('0x1'));var timeout=require(_0x1fd9('0x2'));var express=require(_0x1fd9('0x3'));var router=express[_0x1fd9('0x4')]();var fs_extra=require(_0x1fd9('0x5'));var auth=require(_0x1fd9('0x6'));var interaction=require(_0x1fd9('0x7'));var config=require(_0x1fd9('0x8'));var controller=require('./faxTransferReport.controller');router[_0x1fd9('0x9')]('/',auth[_0x1fd9('0xa')](),controller[_0x1fd9('0xb')]);router[_0x1fd9('0x9')](_0x1fd9('0xc'),auth['isAuthenticated'](),controller[_0x1fd9('0xd')]);router[_0x1fd9('0x9')](_0x1fd9('0xe'),auth['isAuthenticated'](),controller[_0x1fd9('0xf')]);router[_0x1fd9('0x10')]('/',auth[_0x1fd9('0xa')](),controller[_0x1fd9('0x11')]);router[_0x1fd9('0x12')](_0x1fd9('0xe'),auth[_0x1fd9('0xa')](),controller[_0x1fd9('0x13')]);router[_0x1fd9('0x14')](_0x1fd9('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 77fc50b..1cdaa61 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 _0xf7e4=['isAuthenticated','show','get','/:id/fields','getFields','post','/:id/configurations','addConfiguration','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7e4,0x1ef));var _0x4f7e=function(_0x7e57fd,_0x28d416){_0x7e57fd=_0x7e57fd-0x0;var _0x4b61f8=_0xf7e4[_0x7e57fd];return _0x4b61f8;};'use strict';var multer=require('multer');var util=require(_0x4f7e('0x0'));var path=require(_0x4f7e('0x1'));var timeout=require(_0x4f7e('0x2'));var express=require(_0x4f7e('0x3'));var router=express[_0x4f7e('0x4')]();var fs_extra=require(_0x4f7e('0x5'));var auth=require(_0x4f7e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f7e('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f7e('0x8')]);router['get']('/:id',auth[_0x4f7e('0x9')](),controller[_0x4f7e('0xa')]);router[_0x4f7e('0xb')]('/:id/configurations',auth[_0x4f7e('0x9')](),controller['getConfigurations']);router['get'](_0x4f7e('0xc'),auth[_0x4f7e('0x9')](),controller[_0x4f7e('0xd')]);router['post']('/',auth[_0x4f7e('0x9')](),controller['create']);router[_0x4f7e('0xe')](_0x4f7e('0xf'),auth[_0x4f7e('0x9')](),controller[_0x4f7e('0x10')]);router['put'](_0x4f7e('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x4f7e('0x12')](_0x4f7e('0x11'),auth[_0x4f7e('0x9')](),controller[_0x4f7e('0x13')]);module[_0x4f7e('0x14')]=router; \ No newline at end of file +var _0x8506=['show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id'];(function(_0x9468aa,_0x187417){var _0x5616ea=function(_0x507eb5){while(--_0x507eb5){_0x9468aa['push'](_0x9468aa['shift']());}};_0x5616ea(++_0x187417);}(_0x8506,0x1ba));var _0x6850=function(_0x20a0fe,_0x7f8b92){_0x20a0fe=_0x20a0fe-0x0;var _0x152da4=_0x8506[_0x20a0fe];return _0x152da4;};'use strict';var multer=require(_0x6850('0x0'));var util=require(_0x6850('0x1'));var path=require(_0x6850('0x2'));var timeout=require(_0x6850('0x3'));var express=require('express');var router=express[_0x6850('0x4')]();var fs_extra=require(_0x6850('0x5'));var auth=require(_0x6850('0x6'));var interaction=require(_0x6850('0x7'));var config=require(_0x6850('0x8'));var controller=require(_0x6850('0x9'));router['get']('/',auth[_0x6850('0xa')](),controller[_0x6850('0xb')]);router[_0x6850('0xc')](_0x6850('0xd'),auth[_0x6850('0xa')](),controller[_0x6850('0xe')]);router[_0x6850('0xc')]('/:id/configurations',auth[_0x6850('0xa')](),controller['getConfigurations']);router['get'](_0x6850('0xf'),auth[_0x6850('0xa')](),controller[_0x6850('0x10')]);router[_0x6850('0x11')]('/',auth[_0x6850('0xa')](),controller[_0x6850('0x12')]);router[_0x6850('0x11')](_0x6850('0x13'),auth[_0x6850('0xa')](),controller[_0x6850('0x14')]);router[_0x6850('0x15')](_0x6850('0xd'),auth[_0x6850('0xa')](),controller['update']);router['delete'](_0x6850('0xd'),auth[_0x6850('0xa')](),controller[_0x6850('0x16')]);module[_0x6850('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 32eedf4..09917ca 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 _0x8e1f=['ENUM','integrationTab','newTab','sequelize','STRING','basic'];(function(_0x2c763e,_0x4654de){var _0x53b5b8=function(_0x449c4b){while(--_0x449c4b){_0x2c763e['push'](_0x2c763e['shift']());}};_0x53b5b8(++_0x4654de);}(_0x8e1f,0xed));var _0xf8e1=function(_0x4d5cac,_0x5bf7bd){_0x4d5cac=_0x4d5cac-0x0;var _0x513307=_0x8e1f[_0x4d5cac];return _0x513307;};'use strict';var Sequelize=require(_0xf8e1('0x0'));module['exports']={'name':{'type':Sequelize[_0xf8e1('0x1')]},'description':{'type':Sequelize[_0xf8e1('0x1')]},'username':{'type':Sequelize[_0xf8e1('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xf8e1('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf8e1('0x1')]},'consumerKey':{'type':Sequelize[_0xf8e1('0x1')]},'consumerSecret':{'type':Sequelize[_0xf8e1('0x1')]},'token':{'type':Sequelize[_0xf8e1('0x1')]},'tokenSecret':{'type':Sequelize[_0xf8e1('0x1')]},'serverUrl':{'type':Sequelize[_0xf8e1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf8e1('0x3')](_0xf8e1('0x4'),_0xf8e1('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x82ba=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0xe7c3f1,_0x12326f){var _0x1a0934=function(_0x2c3300){while(--_0x2c3300){_0xe7c3f1['push'](_0xe7c3f1['shift']());}};_0x1a0934(++_0x12326f);}(_0x82ba,0x171));var _0xa82b=function(_0x5a3d0d,_0x37cb03){_0x5a3d0d=_0x5a3d0d-0x0;var _0x4e64de=_0x82ba[_0x5a3d0d];return _0x4e64de;};'use strict';var Sequelize=require(_0xa82b('0x0'));module[_0xa82b('0x1')]={'name':{'type':Sequelize[_0xa82b('0x2')]},'description':{'type':Sequelize[_0xa82b('0x2')]},'username':{'type':Sequelize[_0xa82b('0x2')]},'remoteUri':{'type':Sequelize[_0xa82b('0x2')]},'authType':{'type':Sequelize[_0xa82b('0x3')](_0xa82b('0x4')),'defaultValue':_0xa82b('0x4')},'password':{'type':Sequelize[_0xa82b('0x2')]},'consumerKey':{'type':Sequelize[_0xa82b('0x2')]},'consumerSecret':{'type':Sequelize[_0xa82b('0x2')]},'token':{'type':Sequelize[_0xa82b('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa82b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa82b('0x3')](_0xa82b('0x5'),'newTab'),'defaultValue':_0xa82b('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 54e215c..c99dab4 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 _0x8232=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','keys','DeskConfiguration','length','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','end','error','stack','name','index','map','DeskAccount','type','key','query','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters'];(function(_0x50b89e,_0x5c58e3){var _0x4dfc20=function(_0x20cdd4){while(--_0x20cdd4){_0x50b89e['push'](_0x50b89e['shift']());}};_0x4dfc20(++_0x5c58e3);}(_0x8232,0x126));var _0x2823=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8232[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x2823('0x0'));var rimraf=require(_0x2823('0x1'));var zipdir=require(_0x2823('0x2'));var jsonpatch=require(_0x2823('0x3'));var rp=require('request-promise');var moment=require(_0x2823('0x4'));var BPromise=require(_0x2823('0x5'));var Mustache=require(_0x2823('0x6'));var util=require(_0x2823('0x7'));var path=require(_0x2823('0x8'));var sox=require(_0x2823('0x9'));var csv=require(_0x2823('0xa'));var ejs=require(_0x2823('0xb'));var fs=require('fs');var fs_extra=require(_0x2823('0xc'));var _=require(_0x2823('0xd'));var squel=require(_0x2823('0xe'));var crypto=require(_0x2823('0xf'));var jsforce=require(_0x2823('0x10'));var deskjs=require(_0x2823('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2823('0x12'));var Redis=require(_0x2823('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2823('0x14'));var as=require(_0x2823('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2823('0x16'))('api');var utils=require(_0x2823('0x17'));var config=require(_0x2823('0x18'));var licenseUtil=require(_0x2823('0x19'));var db=require(_0x2823('0x1a'))['db'];var integrations=require(_0x2823('0x1b'));function respondWithStatusCode(_0x34c318,_0x3ef505){_0x3ef505=_0x3ef505||0xcc;return function(_0x3d318a){if(_0x3d318a){return _0x34c318[_0x2823('0x1c')](_0x3ef505);}return _0x34c318[_0x2823('0x1d')](_0x3ef505)['end']();};}function respondWithResult(_0xe115f5,_0x55c25d){_0x55c25d=_0x55c25d||0xc8;return function(_0x17b897){if(_0x17b897){return _0xe115f5['status'](_0x55c25d)['json'](_0x17b897);}};}function respondWithFilteredResult(_0x47872b,_0x1f5e44){return function(_0x39159f){if(_0x39159f){var _0x1bca48=typeof _0x1f5e44[_0x2823('0x1e')]===_0x2823('0x1f')&&typeof _0x1f5e44['limit']==='undefined';var _0x1b68f3=_0x39159f[_0x2823('0x20')];var _0x217d4a=_0x1bca48?0x0:_0x1f5e44[_0x2823('0x1e')];var _0x4ab168=_0x1bca48?_0x39159f[_0x2823('0x20')]:_0x1f5e44[_0x2823('0x1e')]+_0x1f5e44[_0x2823('0x21')];var _0x458b32;if(_0x4ab168>=_0x1b68f3){_0x4ab168=_0x1b68f3;_0x458b32=0xc8;}else{_0x458b32=0xce;}_0x47872b[_0x2823('0x1d')](_0x458b32);return _0x47872b[_0x2823('0x22')](_0x2823('0x23'),_0x217d4a+'-'+_0x4ab168+'/'+_0x1b68f3)[_0x2823('0x24')](_0x39159f);}return null;};}function patchUpdates(_0x95d580){return function(_0x1a6af8){try{jsonpatch['apply'](_0x1a6af8,_0x95d580,!![]);}catch(_0x4c961f){return BPromise['reject'](_0x4c961f);}return _0x1a6af8[_0x2823('0x25')]();};}function saveUpdates(_0x4c8ed2,_0x125ddc){return function(_0x58447c){if(_0x58447c){return _0x58447c[_0x2823('0x26')](_0x4c8ed2)[_0x2823('0x27')](function(_0x27cb70){return _0x27cb70;});}return null;};}function removeEntity(_0x1f92d3,_0x2e6546){return function(_0x423384){if(_0x423384){return _0x423384[_0x2823('0x28')]()[_0x2823('0x27')](function(){_0x1f92d3[_0x2823('0x1d')](0xcc)[_0x2823('0x29')]();});}};}function handleEntityNotFound(_0x1516c6,_0x1d1fc9){return function(_0x4be070){if(!_0x4be070){_0x1516c6['sendStatus'](0x194);}return _0x4be070;};}function handleError(_0x5dd117,_0x51c6ae){_0x51c6ae=_0x51c6ae||0x1f4;return function(_0x58eafb){logger[_0x2823('0x2a')](_0x58eafb[_0x2823('0x2b')]);if(_0x58eafb['name']){delete _0x58eafb[_0x2823('0x2c')];}_0x5dd117[_0x2823('0x1d')](_0x51c6ae)['send'](_0x58eafb);};}exports[_0x2823('0x2d')]=function(_0x165970,_0xd46c92){var _0x40c332={},_0x1cf49e={},_0xefa7a5={'count':0x0,'rows':[]};var _0x3f7c67=_[_0x2823('0x2e')](db[_0x2823('0x2f')]['rawAttributes'],function(_0xe9dc50){return{'name':_0xe9dc50['fieldName'],'type':_0xe9dc50[_0x2823('0x30')][_0x2823('0x31')]};});_0x1cf49e['model']=_[_0x2823('0x2e')](_0x3f7c67,'name');_0x1cf49e[_0x2823('0x32')]=_['keys'](_0x165970[_0x2823('0x32')]);_0x1cf49e['filters']=_['intersection'](_0x1cf49e[_0x2823('0x33')],_0x1cf49e[_0x2823('0x32')]);_0x40c332[_0x2823('0x34')]=_[_0x2823('0x35')](_0x1cf49e[_0x2823('0x33')],qs[_0x2823('0x36')](_0x165970[_0x2823('0x32')][_0x2823('0x36')]));_0x40c332[_0x2823('0x34')]=_0x40c332[_0x2823('0x34')]['length']?_0x40c332[_0x2823('0x34')]:_0x1cf49e[_0x2823('0x33')];if(!_0x165970[_0x2823('0x32')][_0x2823('0x37')]('nolimit')){_0x40c332[_0x2823('0x21')]=qs[_0x2823('0x21')](_0x165970[_0x2823('0x32')][_0x2823('0x21')]);_0x40c332[_0x2823('0x1e')]=qs[_0x2823('0x1e')](_0x165970[_0x2823('0x32')]['offset']);}_0x40c332[_0x2823('0x38')]=qs[_0x2823('0x39')](_0x165970[_0x2823('0x32')][_0x2823('0x39')]);_0x40c332[_0x2823('0x3a')]=qs[_0x2823('0x3b')](_[_0x2823('0x3c')](_0x165970[_0x2823('0x32')],_0x1cf49e[_0x2823('0x3b')]),_0x3f7c67);if(_0x165970[_0x2823('0x32')]['filter']){_0x40c332[_0x2823('0x3a')]=_[_0x2823('0x3d')](_0x40c332['where'],{'$or':_['map'](_0x3f7c67,function(_0x5629a6){if(_0x5629a6[_0x2823('0x30')]!==_0x2823('0x3e')){var _0x5ce5b8={};_0x5ce5b8[_0x5629a6[_0x2823('0x2c')]]={'$like':'%'+_0x165970[_0x2823('0x32')][_0x2823('0x3f')]+'%'};return _0x5ce5b8;}})});}_0x40c332=_[_0x2823('0x3d')]({},_0x40c332,_0x165970[_0x2823('0x40')]);var _0x51aa26={'where':_0x40c332[_0x2823('0x3a')]};return db[_0x2823('0x2f')][_0x2823('0x20')](_0x51aa26)[_0x2823('0x27')](function(_0x184c61){_0xefa7a5[_0x2823('0x20')]=_0x184c61;if(_0x165970[_0x2823('0x32')][_0x2823('0x41')]){_0x40c332[_0x2823('0x42')]=[{'all':!![]}];}return db['DeskAccount'][_0x2823('0x43')](_0x40c332);})[_0x2823('0x27')](function(_0x310528){_0xefa7a5[_0x2823('0x44')]=_0x310528;return _0xefa7a5;})[_0x2823('0x27')](respondWithFilteredResult(_0xd46c92,_0x40c332))[_0x2823('0x45')](handleError(_0xd46c92,null));};exports[_0x2823('0x46')]=function(_0x30c896,_0x3b6930){var _0x655555={'raw':![],'where':{'id':_0x30c896[_0x2823('0x47')]['id']}},_0x32a55d={};_0x32a55d['model']=_['keys'](db[_0x2823('0x2f')][_0x2823('0x48')]);_0x32a55d[_0x2823('0x32')]=_['keys'](_0x30c896['query']);_0x32a55d['filters']=_[_0x2823('0x35')](_0x32a55d[_0x2823('0x33')],_0x32a55d[_0x2823('0x32')]);_0x655555[_0x2823('0x34')]=_[_0x2823('0x35')](_0x32a55d[_0x2823('0x33')],qs[_0x2823('0x36')](_0x30c896[_0x2823('0x32')][_0x2823('0x36')]));_0x655555[_0x2823('0x34')]=_0x655555[_0x2823('0x34')]['length']?_0x655555[_0x2823('0x34')]:_0x32a55d['model'];if(_0x30c896['query']['includeAll']){_0x655555[_0x2823('0x42')]=[{'all':!![]}];}_0x655555=_[_0x2823('0x3d')]({},_0x655555,_0x30c896[_0x2823('0x40')]);return db[_0x2823('0x2f')][_0x2823('0x49')](_0x655555)[_0x2823('0x27')](handleEntityNotFound(_0x3b6930,null))[_0x2823('0x27')](respondWithResult(_0x3b6930,null))[_0x2823('0x45')](handleError(_0x3b6930,null));};exports[_0x2823('0x4a')]=function(_0x100a42,_0x57d634){return db['DeskAccount'][_0x2823('0x4a')](_0x100a42[_0x2823('0x4b')],{})[_0x2823('0x27')](respondWithResult(_0x57d634,0xc9))[_0x2823('0x45')](handleError(_0x57d634,null));};exports[_0x2823('0x26')]=function(_0x5078dd,_0x9d62c2){if(_0x5078dd[_0x2823('0x4b')]['id']){delete _0x5078dd[_0x2823('0x4b')]['id'];}return db[_0x2823('0x2f')]['find']({'where':{'id':_0x5078dd[_0x2823('0x47')]['id']}})[_0x2823('0x27')](handleEntityNotFound(_0x9d62c2,null))[_0x2823('0x27')](saveUpdates(_0x5078dd[_0x2823('0x4b')],null))[_0x2823('0x27')](respondWithResult(_0x9d62c2,null))[_0x2823('0x45')](handleError(_0x9d62c2,null));};exports[_0x2823('0x28')]=function(_0x291dd7,_0x262192){return db[_0x2823('0x2f')][_0x2823('0x49')]({'where':{'id':_0x291dd7[_0x2823('0x47')]['id']}})[_0x2823('0x27')](handleEntityNotFound(_0x262192,null))[_0x2823('0x27')](removeEntity(_0x262192,null))[_0x2823('0x45')](handleError(_0x262192,null));};exports['getConfigurations']=function(_0x5a5545,_0x35ee5b,_0x2bde2c){var _0x4ca91e={};var _0x384d5b={};var _0x33f4de;var _0x5c9d94;return db[_0x2823('0x2f')][_0x2823('0x4c')]({'where':{'id':_0x5a5545['params']['id']}})[_0x2823('0x27')](handleEntityNotFound(_0x35ee5b,null))[_0x2823('0x27')](function(_0x39b79b){if(_0x39b79b){_0x33f4de=_0x39b79b;_0x384d5b[_0x2823('0x33')]=_[_0x2823('0x4d')](db[_0x2823('0x4e')][_0x2823('0x48')]);_0x384d5b[_0x2823('0x32')]=_[_0x2823('0x4d')](_0x5a5545[_0x2823('0x32')]);_0x384d5b[_0x2823('0x3b')]=_[_0x2823('0x35')](_0x384d5b[_0x2823('0x33')],_0x384d5b['query']);_0x4ca91e[_0x2823('0x34')]=_[_0x2823('0x35')](_0x384d5b['model'],qs[_0x2823('0x36')](_0x5a5545[_0x2823('0x32')][_0x2823('0x36')]));_0x4ca91e['attributes']=_0x4ca91e[_0x2823('0x34')][_0x2823('0x4f')]?_0x4ca91e[_0x2823('0x34')]:_0x384d5b[_0x2823('0x33')];_0x4ca91e[_0x2823('0x38')]=qs[_0x2823('0x39')](_0x5a5545['query'][_0x2823('0x39')]);_0x4ca91e[_0x2823('0x3a')]=qs[_0x2823('0x3b')](_[_0x2823('0x3c')](_0x5a5545[_0x2823('0x32')],_0x384d5b['filters']));if(_0x5a5545[_0x2823('0x32')]['filter']){_0x4ca91e['where']=_[_0x2823('0x3d')](_0x4ca91e['where'],{'$or':_['map'](_0x4ca91e['attributes'],function(_0xadf114){var _0x4b1d37={};_0x4b1d37[_0xadf114]={'$like':'%'+_0x5a5545[_0x2823('0x32')][_0x2823('0x3f')]+'%'};return _0x4b1d37;})});}_0x4ca91e=_[_0x2823('0x3d')]({},_0x4ca91e,_0x5a5545['options']);return _0x33f4de[_0x2823('0x50')](_0x4ca91e);}})[_0x2823('0x27')](function(_0x5c1b58){if(_0x5c1b58){_0x5c9d94=_0x5c1b58[_0x2823('0x4f')];if(!_0x5a5545[_0x2823('0x32')][_0x2823('0x37')]('nolimit')){_0x4ca91e[_0x2823('0x21')]=qs[_0x2823('0x21')](_0x5a5545[_0x2823('0x32')][_0x2823('0x21')]);_0x4ca91e['offset']=qs['offset'](_0x5a5545[_0x2823('0x32')][_0x2823('0x1e')]);}return _0x33f4de[_0x2823('0x50')](_0x4ca91e);}})[_0x2823('0x27')](function(_0x4f8437){if(_0x4f8437){return _0x4f8437?{'count':_0x5c9d94,'rows':_0x4f8437}:null;}})[_0x2823('0x27')](respondWithResult(_0x35ee5b,null))[_0x2823('0x45')](handleError(_0x35ee5b,null));};exports[_0x2823('0x51')]=function(_0x15eeef,_0x35512b,_0x5ef59c){if(_0x15eeef[_0x2823('0x4b')]['id']){delete _0x15eeef[_0x2823('0x4b')]['id'];}return db[_0x2823('0x2f')]['findOne']({'where':{'id':_0x15eeef['params']['id']}})[_0x2823('0x27')](handleEntityNotFound(_0x35512b,null))[_0x2823('0x27')](function(_0x1e8eb2){if(_0x1e8eb2){_0x15eeef[_0x2823('0x4b')][_0x2823('0x52')]=_0x1e8eb2['id'];_0x15eeef[_0x2823('0x4b')]['Subjects']=integrations[_0x2823('0x53')](_0x15eeef[_0x2823('0x4b')][_0x2823('0x54')],_0x15eeef[_0x2823('0x4b')][_0x2823('0x30')]);_0x15eeef[_0x2823('0x4b')][_0x2823('0x55')]=integrations[_0x2823('0x56')](_0x15eeef[_0x2823('0x4b')][_0x2823('0x54')],_0x15eeef[_0x2823('0x4b')]['type']);return db[_0x2823('0x4e')][_0x2823('0x4a')](_0x15eeef[_0x2823('0x4b')],{'include':[{'model':db[_0x2823('0x57')],'as':'Subjects'},{'model':db[_0x2823('0x57')],'as':_0x2823('0x55')}]});}return null;})[_0x2823('0x27')](respondWithResult(_0x35512b,null))['catch'](handleError(_0x35512b,null));};exports['getFields']=function(_0x2e91a0,_0x1b31a3,_0x29ce07){var _0x59f521=[{'name':'priority','label':_0x2823('0x58'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x39426f='';return db[_0x2823('0x2f')][_0x2823('0x4c')]({'where':{'id':_0x2e91a0[_0x2823('0x47')]['id']},'attributes':['id','remoteUri',_0x2823('0x59'),_0x2823('0x5a'),'password',_0x2823('0x5b'),'consumerSecret',_0x2823('0x5c'),_0x2823('0x5d')]})['then'](handleEntityNotFound(_0x1b31a3,null))['then'](function(_0x50ac9b){if(_0x50ac9b){_0x39426f=_0x50ac9b['remoteUri'];var _0x2f5484=_0x39426f[_0x2823('0x5e')](-0x1);if(_0x2f5484==='/'){_0x39426f=_0x39426f[_0x2823('0x5f')](0x0,_0x39426f[_0x2823('0x60')](_0x2f5484));}var _0x153631={'method':_0x2823('0x61'),'uri':util[_0x2823('0x62')](_0x2823('0x63'),_0x39426f),'headers':{'Content-Type':_0x2823('0x64'),'Accept':_0x2823('0x64')},'json':!![]};if(_0x50ac9b[_0x2823('0x59')]===_0x2823('0x65')){_0x153631['headers'][_0x2823('0x66')]=util[_0x2823('0x62')](_0x2823('0x67'),new Buffer(util[_0x2823('0x62')](_0x2823('0x68'),_0x50ac9b[_0x2823('0x5a')],_0x50ac9b[_0x2823('0x69')]))[_0x2823('0x6a')](_0x2823('0x6b')));}return rp(_0x153631)[_0x2823('0x27')](function(_0x13137c){return _0x59f521[_0x2823('0x6c')](_[_0x2823('0x2e')](_0x13137c[_0x2823('0x6d')][_0x2823('0x6e')],function(_0x37f251){return{'id':_0x37f251['name'],'name':_0x37f251[_0x2823('0x2c')],'type':_0x37f251[_0x2823('0x30')],'active':_0x37f251[_0x2823('0x6f')],'label':_0x37f251[_0x2823('0x70')],'custom':!![]};}));});}})[_0x2823('0x27')](function(_0x5cb6b4){return{'count':_0x5cb6b4[_0x2823('0x4f')],'rows':_0x5cb6b4};})['then'](respondWithResult(_0x1b31a3,null))['catch'](function(_0x4d0258){var _0xdb95a4=_0x2e91a0[_0x2823('0x32')][_0x2823('0x71')]?0x1f4:_0x4d0258[_0x2823('0x72')]||0x1f4;logger[_0x2823('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xdb95a4,JSON[_0x2823('0x73')](_0x4d0258));delete _0x4d0258[_0x2823('0x2c')];if(_0xdb95a4===0x191){_0xdb95a4=0x190;}_0x1b31a3['status'](_0xdb95a4)[_0x2823('0x74')](_0x2e91a0[_0x2823('0x32')][_0x2823('0x71')]?{'message':_0x2823('0x75'),'statusCode':_0x4d0258[_0x2823('0x72')]}:_0x4d0258);});}; \ No newline at end of file +var _0x01e1=['Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','includeAll','include','options','find','create','body','params','getConfigurations','DeskConfiguration','hasOwnProperty','findOne','AccountId','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','format','application/json','basic'];(function(_0x1d1c54,_0x301f2e){var _0x1aeb59=function(_0x45e7d4){while(--_0x45e7d4){_0x1d1c54['push'](_0x1d1c54['shift']());}};_0x1aeb59(++_0x301f2e);}(_0x01e1,0x165));var _0x101e=function(_0x347b8e,_0x5d9c81){_0x347b8e=_0x347b8e-0x0;var _0x4498ac=_0x01e1[_0x347b8e];return _0x4498ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x101e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x101e('0x1'));var rp=require(_0x101e('0x2'));var moment=require(_0x101e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x101e('0x4'));var sox=require('sox');var csv=require(_0x101e('0x5'));var ejs=require(_0x101e('0x6'));var fs=require('fs');var fs_extra=require(_0x101e('0x7'));var _=require(_0x101e('0x8'));var squel=require(_0x101e('0x9'));var crypto=require(_0x101e('0xa'));var jsforce=require(_0x101e('0xb'));var deskjs=require(_0x101e('0xc'));var toCsv=require(_0x101e('0x5'));var querystring=require(_0x101e('0xd'));var Papa=require('papaparse');var Redis=require(_0x101e('0xe'));var authService=require(_0x101e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x101e('0x10'));var hardwareService=require(_0x101e('0x11'));var logger=require(_0x101e('0x12'))('api');var utils=require(_0x101e('0x13'));var config=require(_0x101e('0x14'));var licenseUtil=require(_0x101e('0x15'));var db=require(_0x101e('0x16'))['db'];var integrations=require(_0x101e('0x17'));function respondWithStatusCode(_0x34d2ed,_0x1748e2){_0x1748e2=_0x1748e2||0xcc;return function(_0x1bfebd){if(_0x1bfebd){return _0x34d2ed[_0x101e('0x18')](_0x1748e2);}return _0x34d2ed[_0x101e('0x19')](_0x1748e2)['end']();};}function respondWithResult(_0x4d76be,_0x104d36){_0x104d36=_0x104d36||0xc8;return function(_0x41749e){if(_0x41749e){return _0x4d76be[_0x101e('0x19')](_0x104d36)[_0x101e('0x1a')](_0x41749e);}};}function respondWithFilteredResult(_0x99d6bf,_0x21825e){return function(_0x3d80fa){if(_0x3d80fa){var _0x1cc0e4=typeof _0x21825e[_0x101e('0x1b')]===_0x101e('0x1c')&&typeof _0x21825e[_0x101e('0x1d')]==='undefined';var _0xa60949=_0x3d80fa['count'];var _0x276b21=_0x1cc0e4?0x0:_0x21825e['offset'];var _0x116962=_0x1cc0e4?_0x3d80fa[_0x101e('0x1e')]:_0x21825e['offset']+_0x21825e['limit'];var _0x52451f;if(_0x116962>=_0xa60949){_0x116962=_0xa60949;_0x52451f=0xc8;}else{_0x52451f=0xce;}_0x99d6bf[_0x101e('0x19')](_0x52451f);return _0x99d6bf['set'](_0x101e('0x1f'),_0x276b21+'-'+_0x116962+'/'+_0xa60949)[_0x101e('0x1a')](_0x3d80fa);}return null;};}function patchUpdates(_0x402535){return function(_0x161696){try{jsonpatch[_0x101e('0x20')](_0x161696,_0x402535,!![]);}catch(_0x50001e){return BPromise[_0x101e('0x21')](_0x50001e);}return _0x161696[_0x101e('0x22')]();};}function saveUpdates(_0x4820ee,_0x3a7bd7){return function(_0x1e1998){if(_0x1e1998){return _0x1e1998[_0x101e('0x23')](_0x4820ee)[_0x101e('0x24')](function(_0x20c65b){return _0x20c65b;});}return null;};}function removeEntity(_0x43680a,_0x20ea13){return function(_0x358930){if(_0x358930){return _0x358930[_0x101e('0x25')]()[_0x101e('0x24')](function(){_0x43680a[_0x101e('0x19')](0xcc)[_0x101e('0x26')]();});}};}function handleEntityNotFound(_0x3954f6,_0x328e95){return function(_0x51ac18){if(!_0x51ac18){_0x3954f6[_0x101e('0x18')](0x194);}return _0x51ac18;};}function handleError(_0xafec4a,_0x6ee046){_0x6ee046=_0x6ee046||0x1f4;return function(_0x21e9c8){logger['error'](_0x21e9c8['stack']);if(_0x21e9c8['name']){delete _0x21e9c8[_0x101e('0x27')];}_0xafec4a['status'](_0x6ee046)[_0x101e('0x28')](_0x21e9c8);};}exports[_0x101e('0x29')]=function(_0x24d85d,_0x2dcb82){var _0x55059a={},_0x101d1c={},_0x123194={'count':0x0,'rows':[]};var _0x40cbd5=_[_0x101e('0x2a')](db[_0x101e('0x2b')][_0x101e('0x2c')],function(_0x1a05ba){return{'name':_0x1a05ba[_0x101e('0x2d')],'type':_0x1a05ba[_0x101e('0x2e')][_0x101e('0x2f')]};});_0x101d1c[_0x101e('0x30')]=_[_0x101e('0x2a')](_0x40cbd5,_0x101e('0x27'));_0x101d1c[_0x101e('0x31')]=_[_0x101e('0x32')](_0x24d85d[_0x101e('0x31')]);_0x101d1c[_0x101e('0x33')]=_[_0x101e('0x34')](_0x101d1c[_0x101e('0x30')],_0x101d1c[_0x101e('0x31')]);_0x55059a[_0x101e('0x35')]=_[_0x101e('0x34')](_0x101d1c['model'],qs[_0x101e('0x36')](_0x24d85d[_0x101e('0x31')][_0x101e('0x36')]));_0x55059a[_0x101e('0x35')]=_0x55059a['attributes'][_0x101e('0x37')]?_0x55059a[_0x101e('0x35')]:_0x101d1c[_0x101e('0x30')];if(!_0x24d85d[_0x101e('0x31')]['hasOwnProperty'](_0x101e('0x38'))){_0x55059a[_0x101e('0x1d')]=qs[_0x101e('0x1d')](_0x24d85d[_0x101e('0x31')][_0x101e('0x1d')]);_0x55059a['offset']=qs[_0x101e('0x1b')](_0x24d85d[_0x101e('0x31')][_0x101e('0x1b')]);}_0x55059a[_0x101e('0x39')]=qs[_0x101e('0x3a')](_0x24d85d['query'][_0x101e('0x3a')]);_0x55059a[_0x101e('0x3b')]=qs[_0x101e('0x33')](_[_0x101e('0x3c')](_0x24d85d[_0x101e('0x31')],_0x101d1c[_0x101e('0x33')]),_0x40cbd5);if(_0x24d85d[_0x101e('0x31')][_0x101e('0x3d')]){_0x55059a[_0x101e('0x3b')]=_[_0x101e('0x3e')](_0x55059a[_0x101e('0x3b')],{'$or':_[_0x101e('0x2a')](_0x40cbd5,function(_0x51d0b5){if(_0x51d0b5['type']!==_0x101e('0x3f')){var _0x5de127={};_0x5de127[_0x51d0b5[_0x101e('0x27')]]={'$like':'%'+_0x24d85d[_0x101e('0x31')][_0x101e('0x3d')]+'%'};return _0x5de127;}})});}_0x55059a=_[_0x101e('0x3e')]({},_0x55059a,_0x24d85d['options']);var _0x439512={'where':_0x55059a['where']};return db[_0x101e('0x2b')][_0x101e('0x1e')](_0x439512)[_0x101e('0x24')](function(_0x12aea9){_0x123194[_0x101e('0x1e')]=_0x12aea9;if(_0x24d85d[_0x101e('0x31')]['includeAll']){_0x55059a['include']=[{'all':!![]}];}return db['DeskAccount'][_0x101e('0x40')](_0x55059a);})['then'](function(_0x3df2a7){_0x123194[_0x101e('0x41')]=_0x3df2a7;return _0x123194;})[_0x101e('0x24')](respondWithFilteredResult(_0x2dcb82,_0x55059a))[_0x101e('0x42')](handleError(_0x2dcb82,null));};exports[_0x101e('0x43')]=function(_0x5a9d42,_0x112465){var _0x256cc0={'raw':![],'where':{'id':_0x5a9d42['params']['id']}},_0x7d7d26={};_0x7d7d26[_0x101e('0x30')]=_[_0x101e('0x32')](db[_0x101e('0x2b')][_0x101e('0x2c')]);_0x7d7d26[_0x101e('0x31')]=_['keys'](_0x5a9d42['query']);_0x7d7d26[_0x101e('0x33')]=_[_0x101e('0x34')](_0x7d7d26['model'],_0x7d7d26[_0x101e('0x31')]);_0x256cc0['attributes']=_[_0x101e('0x34')](_0x7d7d26[_0x101e('0x30')],qs[_0x101e('0x36')](_0x5a9d42[_0x101e('0x31')]['fields']));_0x256cc0[_0x101e('0x35')]=_0x256cc0[_0x101e('0x35')][_0x101e('0x37')]?_0x256cc0[_0x101e('0x35')]:_0x7d7d26[_0x101e('0x30')];if(_0x5a9d42[_0x101e('0x31')][_0x101e('0x44')]){_0x256cc0[_0x101e('0x45')]=[{'all':!![]}];}_0x256cc0=_[_0x101e('0x3e')]({},_0x256cc0,_0x5a9d42[_0x101e('0x46')]);return db[_0x101e('0x2b')][_0x101e('0x47')](_0x256cc0)['then'](handleEntityNotFound(_0x112465,null))[_0x101e('0x24')](respondWithResult(_0x112465,null))['catch'](handleError(_0x112465,null));};exports[_0x101e('0x48')]=function(_0x55859d,_0x229540){return db['DeskAccount']['create'](_0x55859d[_0x101e('0x49')],{})['then'](respondWithResult(_0x229540,0xc9))[_0x101e('0x42')](handleError(_0x229540,null));};exports[_0x101e('0x23')]=function(_0x4acc2a,_0xa95c2d){if(_0x4acc2a[_0x101e('0x49')]['id']){delete _0x4acc2a[_0x101e('0x49')]['id'];}return db[_0x101e('0x2b')][_0x101e('0x47')]({'where':{'id':_0x4acc2a[_0x101e('0x4a')]['id']}})[_0x101e('0x24')](handleEntityNotFound(_0xa95c2d,null))[_0x101e('0x24')](saveUpdates(_0x4acc2a[_0x101e('0x49')],null))[_0x101e('0x24')](respondWithResult(_0xa95c2d,null))[_0x101e('0x42')](handleError(_0xa95c2d,null));};exports[_0x101e('0x25')]=function(_0x351de6,_0x3ed52a){return db[_0x101e('0x2b')]['find']({'where':{'id':_0x351de6[_0x101e('0x4a')]['id']}})[_0x101e('0x24')](handleEntityNotFound(_0x3ed52a,null))['then'](removeEntity(_0x3ed52a,null))[_0x101e('0x42')](handleError(_0x3ed52a,null));};exports[_0x101e('0x4b')]=function(_0x9ae7cc,_0x49b351,_0x381ff1){var _0x4270ab={};var _0x5c663a={};var _0x1c5d5a;var _0x3d9a77;return db[_0x101e('0x2b')]['findOne']({'where':{'id':_0x9ae7cc[_0x101e('0x4a')]['id']}})[_0x101e('0x24')](handleEntityNotFound(_0x49b351,null))['then'](function(_0x2609f9){if(_0x2609f9){_0x1c5d5a=_0x2609f9;_0x5c663a[_0x101e('0x30')]=_['keys'](db[_0x101e('0x4c')][_0x101e('0x2c')]);_0x5c663a['query']=_['keys'](_0x9ae7cc[_0x101e('0x31')]);_0x5c663a['filters']=_['intersection'](_0x5c663a[_0x101e('0x30')],_0x5c663a[_0x101e('0x31')]);_0x4270ab[_0x101e('0x35')]=_[_0x101e('0x34')](_0x5c663a['model'],qs[_0x101e('0x36')](_0x9ae7cc[_0x101e('0x31')][_0x101e('0x36')]));_0x4270ab['attributes']=_0x4270ab[_0x101e('0x35')]['length']?_0x4270ab[_0x101e('0x35')]:_0x5c663a[_0x101e('0x30')];_0x4270ab[_0x101e('0x39')]=qs['sort'](_0x9ae7cc['query'][_0x101e('0x3a')]);_0x4270ab[_0x101e('0x3b')]=qs[_0x101e('0x33')](_['pick'](_0x9ae7cc['query'],_0x5c663a[_0x101e('0x33')]));if(_0x9ae7cc[_0x101e('0x31')][_0x101e('0x3d')]){_0x4270ab[_0x101e('0x3b')]=_['merge'](_0x4270ab[_0x101e('0x3b')],{'$or':_[_0x101e('0x2a')](_0x4270ab[_0x101e('0x35')],function(_0xb7614c){var _0x383d1={};_0x383d1[_0xb7614c]={'$like':'%'+_0x9ae7cc[_0x101e('0x31')][_0x101e('0x3d')]+'%'};return _0x383d1;})});}_0x4270ab=_[_0x101e('0x3e')]({},_0x4270ab,_0x9ae7cc[_0x101e('0x46')]);return _0x1c5d5a[_0x101e('0x4b')](_0x4270ab);}})[_0x101e('0x24')](function(_0x5ae211){if(_0x5ae211){_0x3d9a77=_0x5ae211[_0x101e('0x37')];if(!_0x9ae7cc[_0x101e('0x31')][_0x101e('0x4d')](_0x101e('0x38'))){_0x4270ab['limit']=qs['limit'](_0x9ae7cc[_0x101e('0x31')][_0x101e('0x1d')]);_0x4270ab[_0x101e('0x1b')]=qs[_0x101e('0x1b')](_0x9ae7cc['query'][_0x101e('0x1b')]);}return _0x1c5d5a[_0x101e('0x4b')](_0x4270ab);}})[_0x101e('0x24')](function(_0x78c9aa){if(_0x78c9aa){return _0x78c9aa?{'count':_0x3d9a77,'rows':_0x78c9aa}:null;}})[_0x101e('0x24')](respondWithResult(_0x49b351,null))[_0x101e('0x42')](handleError(_0x49b351,null));};exports['addConfiguration']=function(_0x2fb1b5,_0x3ef5df,_0x3b5f97){if(_0x2fb1b5[_0x101e('0x49')]['id']){delete _0x2fb1b5[_0x101e('0x49')]['id'];}return db['DeskAccount'][_0x101e('0x4e')]({'where':{'id':_0x2fb1b5[_0x101e('0x4a')]['id']}})[_0x101e('0x24')](handleEntityNotFound(_0x3ef5df,null))[_0x101e('0x24')](function(_0xe590bb){if(_0xe590bb){_0x2fb1b5[_0x101e('0x49')][_0x101e('0x4f')]=_0xe590bb['id'];_0x2fb1b5['body'][_0x101e('0x50')]=integrations['getSubjects'](_0x2fb1b5['body'][_0x101e('0x51')],_0x2fb1b5['body'][_0x101e('0x2e')]);_0x2fb1b5['body']['Descriptions']=integrations[_0x101e('0x52')](_0x2fb1b5[_0x101e('0x49')][_0x101e('0x51')],_0x2fb1b5[_0x101e('0x49')][_0x101e('0x2e')]);return db[_0x101e('0x4c')]['create'](_0x2fb1b5[_0x101e('0x49')],{'include':[{'model':db[_0x101e('0x53')],'as':_0x101e('0x50')},{'model':db[_0x101e('0x53')],'as':_0x101e('0x54')}]});}return null;})[_0x101e('0x24')](respondWithResult(_0x3ef5df,null))['catch'](handleError(_0x3ef5df,null));};exports[_0x101e('0x55')]=function(_0x56ae72,_0x49df01,_0x504af7){var _0x41a5a0=[{'name':_0x101e('0x56'),'label':_0x101e('0x56'),'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 _0x132b1d='';return db[_0x101e('0x2b')][_0x101e('0x4e')]({'where':{'id':_0x56ae72[_0x101e('0x4a')]['id']},'attributes':['id',_0x101e('0x57'),_0x101e('0x58'),_0x101e('0x59'),'password',_0x101e('0x5a'),_0x101e('0x5b'),_0x101e('0x5c'),_0x101e('0x5d')]})[_0x101e('0x24')](handleEntityNotFound(_0x49df01,null))['then'](function(_0x497df8){if(_0x497df8){_0x132b1d=_0x497df8['remoteUri'];var _0x5b0ffb=_0x132b1d[_0x101e('0x5e')](-0x1);if(_0x5b0ffb==='/'){_0x132b1d=_0x132b1d[_0x101e('0x5f')](0x0,_0x132b1d['lastIndexOf'](_0x5b0ffb));}var _0x51d807={'method':'GET','uri':util[_0x101e('0x60')]('%s/custom_fields',_0x132b1d),'headers':{'Content-Type':_0x101e('0x61'),'Accept':_0x101e('0x61')},'json':!![]};if(_0x497df8['authType']===_0x101e('0x62')){_0x51d807['headers']['Authorization']=util[_0x101e('0x60')](_0x101e('0x63'),new Buffer(util[_0x101e('0x60')](_0x101e('0x64'),_0x497df8[_0x101e('0x59')],_0x497df8[_0x101e('0x65')]))[_0x101e('0x66')](_0x101e('0x67')));}return rp(_0x51d807)[_0x101e('0x24')](function(_0x24d58a){return _0x41a5a0[_0x101e('0x68')](_[_0x101e('0x2a')](_0x24d58a[_0x101e('0x69')][_0x101e('0x6a')],function(_0x4370fa){return{'id':_0x4370fa['name'],'name':_0x4370fa['name'],'type':_0x4370fa[_0x101e('0x2e')],'active':_0x4370fa['active'],'label':_0x4370fa[_0x101e('0x6b')],'custom':!![]};}));});}})[_0x101e('0x24')](function(_0x4dc4ce){return{'count':_0x4dc4ce[_0x101e('0x37')],'rows':_0x4dc4ce};})[_0x101e('0x24')](respondWithResult(_0x49df01,null))[_0x101e('0x42')](function(_0x408215){var _0xc19d97=_0x56ae72['query'][_0x101e('0x6c')]?0x1f4:_0x408215[_0x101e('0x6d')]||0x1f4;logger[_0x101e('0x6e')](_0x101e('0x6f'),'getFields',_0xc19d97,JSON[_0x101e('0x70')](_0x408215));delete _0x408215[_0x101e('0x27')];if(_0xc19d97===0x191){_0xc19d97=0x190;}_0x49df01['status'](_0xc19d97)[_0x101e('0x28')](_0x56ae72[_0x101e('0x31')][_0x101e('0x6c')]?{'message':_0x101e('0x71'),'statusCode':_0x408215[_0x101e('0x6d')]}:_0x408215);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c59883b..8cff321 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 _0xbd21=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x5afcaf,_0x129776){var _0x1b9f90=function(_0x5cee13){while(--_0x5cee13){_0x5afcaf['push'](_0x5afcaf['shift']());}};_0x1b9f90(++_0x129776);}(_0xbd21,0xed));var _0x1bd2=function(_0x5d92a1,_0x1039a5){_0x5d92a1=_0x5d92a1-0x0;var _0x53ee27=_0xbd21[_0x5d92a1];return _0x53ee27;};'use strict';var _=require(_0x1bd2('0x0'));var util=require(_0x1bd2('0x1'));var logger=require(_0x1bd2('0x2'))(_0x1bd2('0x3'));var moment=require(_0x1bd2('0x4'));var BPromise=require(_0x1bd2('0x5'));var rp=require(_0x1bd2('0x6'));var fs=require('fs');var path=require(_0x1bd2('0x7'));var rimraf=require(_0x1bd2('0x8'));var config=require(_0x1bd2('0x9'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x1bd2('0xa'));module['exports']=function(_0x5befdc,_0x405195){return _0x5befdc[_0x1bd2('0xb')](_0x1bd2('0xc'),attributes,{'tableName':_0x1bd2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2acf=['exports','DeskAccount','util','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes'];(function(_0x279c62,_0x519444){var _0x5c3b90=function(_0x5b864){while(--_0x5b864){_0x279c62['push'](_0x279c62['shift']());}};_0x5c3b90(++_0x519444);}(_0x2acf,0x15a));var _0xf2ac=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x2acf[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require('lodash');var util=require(_0xf2ac('0x0'));var logger=require('../../config/logger')(_0xf2ac('0x1'));var moment=require(_0xf2ac('0x2'));var BPromise=require('bluebird');var rp=require(_0xf2ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf2ac('0x4'));var attributes=require(_0xf2ac('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xf2ac('0x6')]=function(_0x1c10ce,_0x59706f){return _0x1c10ce['define'](_0xf2ac('0x7'),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 3848211..91a1700 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 _0x7849=['stringify','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3704aa,_0x3c6b14){var _0x127a94=function(_0x69db71){while(--_0x69db71){_0x3704aa['push'](_0x3704aa['shift']());}};_0x127a94(++_0x3c6b14);}(_0x7849,0x1b5));var _0x9784=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7849[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9784('0x0'));var util=require(_0x9784('0x1'));var moment=require(_0x9784('0x2'));var BPromise=require('bluebird');var rs=require(_0x9784('0x3'));var fs=require('fs');var Redis=require(_0x9784('0x4'));var db=require(_0x9784('0x5'))['db'];var utils=require(_0x9784('0x6'));var logger=require(_0x9784('0x7'))(_0x9784('0x8'));var config=require('../../config/environment');var jayson=require(_0x9784('0x9'));var client=jayson[_0x9784('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53df29,_0x53e0b4,_0x1e2cc6){return new BPromise(function(_0x441c63,_0x32530b){return client[_0x9784('0xb')](_0x53df29,_0x1e2cc6)[_0x9784('0xc')](function(_0x44a559){logger[_0x9784('0xd')](_0x9784('0xe'),_0x53e0b4,_0x9784('0xf'));logger[_0x9784('0x10')](_0x9784('0x11'),_0x53e0b4,_0x9784('0xf'),JSON[_0x9784('0x12')](_0x44a559));if(_0x44a559[_0x9784('0x13')]){if(_0x44a559[_0x9784('0x13')]['code']===0x1f4){logger[_0x9784('0x13')](_0x9784('0xe'),_0x53e0b4,_0x44a559[_0x9784('0x13')][_0x9784('0x14')]);return _0x32530b(_0x44a559[_0x9784('0x13')][_0x9784('0x14')]);}logger[_0x9784('0x13')](_0x9784('0xe'),_0x53e0b4,_0x44a559['error'][_0x9784('0x14')]);return _0x441c63(_0x44a559[_0x9784('0x13')][_0x9784('0x14')]);}else{logger[_0x9784('0xd')]('DeskAccount,\x20%s,\x20%s',_0x53e0b4,_0x9784('0xf'));_0x441c63(_0x44a559['result']['message']);}})[_0x9784('0x15')](function(_0x236575){logger[_0x9784('0x13')]('DeskAccount,\x20%s,\x20%s',_0x53e0b4,_0x236575);_0x32530b(_0x236575);});});}exports[_0x9784('0x16')]=function(_0x56e10d){var _0x4bd28c=this;return new Promise(function(_0x41deba,_0x3ae9d0){return db[_0x9784('0x17')][_0x9784('0x18')]({'raw':_0x56e10d[_0x9784('0x19')]?_0x56e10d[_0x9784('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56e10d['options']?_0x56e10d[_0x9784('0x19')][_0x9784('0x1a')]||null:null,'attributes':_0x56e10d[_0x9784('0x19')]?_0x56e10d[_0x9784('0x19')][_0x9784('0x1b')]||null:null,'limit':_0x56e10d[_0x9784('0x19')]?_0x56e10d['options'][_0x9784('0x1c')]||null:null,'include':_0x56e10d[_0x9784('0x19')]?_0x56e10d['options']['include']?_[_0x9784('0x1d')](_0x56e10d[_0x9784('0x19')]['include'],function(_0x4dddc2){return{'model':db[_0x4dddc2[_0x9784('0x1e')]],'as':_0x4dddc2['as'],'attributes':_0x4dddc2[_0x9784('0x1b')],'include':_0x4dddc2['include']?_[_0x9784('0x1d')](_0x4dddc2[_0x9784('0x1f')],function(_0x46229c){return{'model':db[_0x46229c[_0x9784('0x1e')]],'as':_0x46229c['as'],'attributes':_0x46229c[_0x9784('0x1b')],'include':_0x46229c['include']?_[_0x9784('0x1d')](_0x46229c['include'],function(_0xbcabbd){return{'model':db[_0xbcabbd[_0x9784('0x1e')]],'as':_0xbcabbd['as'],'attributes':_0xbcabbd[_0x9784('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9784('0xc')](function(_0x14ecbc){logger[_0x9784('0xd')](_0x9784('0x16'),_0x56e10d);logger[_0x9784('0x10')](_0x9784('0x16'),_0x56e10d,JSON[_0x9784('0x12')](_0x14ecbc));_0x41deba(_0x14ecbc);})['catch'](function(_0x4293fd){logger[_0x9784('0x13')]('GetDeskAccount',_0x4293fd[_0x9784('0x14')],_0x56e10d);_0x3ae9d0(_0x4bd28c[_0x9784('0x13')](0x1f4,_0x4293fd[_0x9784('0x14')]));});});};exports['ShowDeskAccount']=function(_0xd18c1a){var _0x33ce25=this;return new Promise(function(_0x590207,_0x233117){return db[_0x9784('0x17')][_0x9784('0x20')]({'raw':_0xd18c1a['options']?_0xd18c1a[_0x9784('0x19')][_0x9784('0x21')]===undefined?!![]:![]:!![],'where':_0xd18c1a[_0x9784('0x19')]?_0xd18c1a[_0x9784('0x19')][_0x9784('0x1a')]||null:null,'attributes':_0xd18c1a['options']?_0xd18c1a[_0x9784('0x19')][_0x9784('0x1b')]||null:null,'include':_0xd18c1a[_0x9784('0x19')]?_0xd18c1a['options'][_0x9784('0x1f')]?_['map'](_0xd18c1a['options'][_0x9784('0x1f')],function(_0x457388){return{'model':db[_0x457388[_0x9784('0x1e')]],'as':_0x457388['as'],'attributes':_0x457388['attributes'],'include':_0x457388[_0x9784('0x1f')]?_['map'](_0x457388[_0x9784('0x1f')],function(_0x1a3e9d){return{'model':db[_0x1a3e9d[_0x9784('0x1e')]],'as':_0x1a3e9d['as'],'attributes':_0x1a3e9d['attributes'],'include':_0x1a3e9d[_0x9784('0x1f')]?_['map'](_0x1a3e9d['include'],function(_0x7ee58b){return{'model':db[_0x7ee58b['model']],'as':_0x7ee58b['as'],'attributes':_0x7ee58b[_0x9784('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9784('0xc')](function(_0x217e97){logger[_0x9784('0xd')](_0x9784('0x22'),_0xd18c1a);logger[_0x9784('0x10')](_0x9784('0x22'),_0xd18c1a,JSON[_0x9784('0x12')](_0x217e97));_0x590207(_0x217e97);})[_0x9784('0x15')](function(_0x3227ef){logger[_0x9784('0x13')](_0x9784('0x22'),_0x3227ef[_0x9784('0x14')],_0xd18c1a);_0x233117(_0x33ce25[_0x9784('0x13')](0x1f4,_0x3227ef['message']));});});}; \ No newline at end of file +var _0xcfc3=['include','map','model','stringify','find','raw','ShowDeskAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit'];(function(_0x55cace,_0x4ba820){var _0x39b9c4=function(_0xe4be25){while(--_0xe4be25){_0x55cace['push'](_0x55cace['shift']());}};_0x39b9c4(++_0x4ba820);}(_0xcfc3,0x1e3));var _0x3cfc=function(_0x40f3ed,_0x30a518){_0x40f3ed=_0x40f3ed-0x0;var _0x30fd3b=_0xcfc3[_0x40f3ed];return _0x30fd3b;};'use strict';var _=require(_0x3cfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3cfc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cfc('0x2'));var db=require(_0x3cfc('0x3'))['db'];var utils=require(_0x3cfc('0x4'));var logger=require(_0x3cfc('0x5'))(_0x3cfc('0x6'));var config=require('../../config/environment');var jayson=require(_0x3cfc('0x7'));var client=jayson['client'][_0x3cfc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x212da7,_0x5499cf,_0x436550){return new BPromise(function(_0xbbd80e,_0x45dcd8){return client[_0x3cfc('0x9')](_0x212da7,_0x436550)[_0x3cfc('0xa')](function(_0x241950){logger[_0x3cfc('0xb')](_0x3cfc('0xc'),_0x5499cf,_0x3cfc('0xd'));logger[_0x3cfc('0xe')](_0x3cfc('0xf'),_0x5499cf,_0x3cfc('0xd'),JSON['stringify'](_0x241950));if(_0x241950[_0x3cfc('0x10')]){if(_0x241950['error'][_0x3cfc('0x11')]===0x1f4){logger[_0x3cfc('0x10')](_0x3cfc('0xc'),_0x5499cf,_0x241950['error'][_0x3cfc('0x12')]);return _0x45dcd8(_0x241950[_0x3cfc('0x10')][_0x3cfc('0x12')]);}logger[_0x3cfc('0x10')](_0x3cfc('0xc'),_0x5499cf,_0x241950[_0x3cfc('0x10')][_0x3cfc('0x12')]);return _0xbbd80e(_0x241950[_0x3cfc('0x10')][_0x3cfc('0x12')]);}else{logger[_0x3cfc('0xb')](_0x3cfc('0xc'),_0x5499cf,_0x3cfc('0xd'));_0xbbd80e(_0x241950[_0x3cfc('0x13')][_0x3cfc('0x12')]);}})['catch'](function(_0x36f74a){logger[_0x3cfc('0x10')](_0x3cfc('0xc'),_0x5499cf,_0x36f74a);_0x45dcd8(_0x36f74a);});});}exports[_0x3cfc('0x14')]=function(_0x4423e8){var _0x5002fc=this;return new Promise(function(_0x5bc532,_0x52f9c3){return db[_0x3cfc('0x15')][_0x3cfc('0x16')]({'raw':_0x4423e8[_0x3cfc('0x17')]?_0x4423e8[_0x3cfc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4423e8[_0x3cfc('0x17')]?_0x4423e8['options'][_0x3cfc('0x18')]||null:null,'attributes':_0x4423e8['options']?_0x4423e8[_0x3cfc('0x17')][_0x3cfc('0x19')]||null:null,'limit':_0x4423e8[_0x3cfc('0x17')]?_0x4423e8[_0x3cfc('0x17')][_0x3cfc('0x1a')]||null:null,'include':_0x4423e8[_0x3cfc('0x17')]?_0x4423e8[_0x3cfc('0x17')][_0x3cfc('0x1b')]?_[_0x3cfc('0x1c')](_0x4423e8[_0x3cfc('0x17')][_0x3cfc('0x1b')],function(_0x8d278c){return{'model':db[_0x8d278c[_0x3cfc('0x1d')]],'as':_0x8d278c['as'],'attributes':_0x8d278c[_0x3cfc('0x19')],'include':_0x8d278c[_0x3cfc('0x1b')]?_[_0x3cfc('0x1c')](_0x8d278c[_0x3cfc('0x1b')],function(_0x3770fb){return{'model':db[_0x3770fb[_0x3cfc('0x1d')]],'as':_0x3770fb['as'],'attributes':_0x3770fb[_0x3cfc('0x19')],'include':_0x3770fb[_0x3cfc('0x1b')]?_['map'](_0x3770fb['include'],function(_0x5798d0){return{'model':db[_0x5798d0['model']],'as':_0x5798d0['as'],'attributes':_0x5798d0[_0x3cfc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3cfc('0xa')](function(_0xce03bb){logger['info'](_0x3cfc('0x14'),_0x4423e8);logger[_0x3cfc('0xe')](_0x3cfc('0x14'),_0x4423e8,JSON[_0x3cfc('0x1e')](_0xce03bb));_0x5bc532(_0xce03bb);})['catch'](function(_0x35cd87){logger[_0x3cfc('0x10')]('GetDeskAccount',_0x35cd87[_0x3cfc('0x12')],_0x4423e8);_0x52f9c3(_0x5002fc[_0x3cfc('0x10')](0x1f4,_0x35cd87[_0x3cfc('0x12')]));});});};exports['ShowDeskAccount']=function(_0x2d317e){var _0x1845a7=this;return new Promise(function(_0xf63287,_0x37c54c){return db[_0x3cfc('0x15')][_0x3cfc('0x1f')]({'raw':_0x2d317e['options']?_0x2d317e[_0x3cfc('0x17')][_0x3cfc('0x20')]===undefined?!![]:![]:!![],'where':_0x2d317e['options']?_0x2d317e[_0x3cfc('0x17')]['where']||null:null,'attributes':_0x2d317e[_0x3cfc('0x17')]?_0x2d317e[_0x3cfc('0x17')][_0x3cfc('0x19')]||null:null,'include':_0x2d317e['options']?_0x2d317e['options'][_0x3cfc('0x1b')]?_['map'](_0x2d317e[_0x3cfc('0x17')][_0x3cfc('0x1b')],function(_0x3d7bee){return{'model':db[_0x3d7bee[_0x3cfc('0x1d')]],'as':_0x3d7bee['as'],'attributes':_0x3d7bee[_0x3cfc('0x19')],'include':_0x3d7bee[_0x3cfc('0x1b')]?_[_0x3cfc('0x1c')](_0x3d7bee['include'],function(_0xbd264a){return{'model':db[_0xbd264a['model']],'as':_0xbd264a['as'],'attributes':_0xbd264a['attributes'],'include':_0xbd264a['include']?_[_0x3cfc('0x1c')](_0xbd264a[_0x3cfc('0x1b')],function(_0x16ef45){return{'model':db[_0x16ef45[_0x3cfc('0x1d')]],'as':_0x16ef45['as'],'attributes':_0x16ef45[_0x3cfc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3cfc('0xa')](function(_0x46f6fe){logger[_0x3cfc('0xb')]('ShowDeskAccount',_0x2d317e);logger[_0x3cfc('0xe')](_0x3cfc('0x21'),_0x2d317e,JSON['stringify'](_0x46f6fe));_0xf63287(_0x46f6fe);})['catch'](function(_0x4b29a6){logger[_0x3cfc('0x10')](_0x3cfc('0x21'),_0x4b29a6[_0x3cfc('0x12')],_0x2d317e);_0x37c54c(_0x1845a7[_0x3cfc('0x10')](0x1f4,_0x4b29a6['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5cd6660..cce4f79 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x17b617,_0x2979b1){var _0x186663=function(_0x2f88b7){while(--_0x2f88b7){_0x17b617['push'](_0x17b617['shift']());}};_0x186663(++_0x2979b1);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x5f296f,_0x41e34d){var _0x4a517e=function(_0xcd0340){while(--_0xcd0340){_0x5f296f['push'](_0x5f296f['shift']());}};_0x4a517e(++_0x41e34d);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d4402ee..625b9b8 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 _0xfe73=['exports','STRING','sequelize'];(function(_0x5935eb,_0x82649b){var _0x34b049=function(_0xed1431){while(--_0xed1431){_0x5935eb['push'](_0x5935eb['shift']());}};_0x34b049(++_0x82649b);}(_0xfe73,0xf5));var _0x3fe7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xfe73[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x3fe7('0x0'));module[_0x3fe7('0x1')]={'name':{'type':Sequelize[_0x3fe7('0x2')]},'description':{'type':Sequelize[_0x3fe7('0x2')]}}; \ No newline at end of file +var _0xc64f=['exports','STRING','sequelize'];(function(_0x44a906,_0x1d5a9d){var _0x22cda0=function(_0x1c87e5){while(--_0x1c87e5){_0x44a906['push'](_0x44a906['shift']());}};_0x22cda0(++_0x1d5a9d);}(_0xc64f,0x1df));var _0xfc64=function(_0xad99aa,_0x287633){_0xad99aa=_0xad99aa-0x0;var _0x3f5563=_0xc64f[_0xad99aa];return _0x3f5563;};'use strict';var Sequelize=require(_0xfc64('0x0'));module[_0xfc64('0x1')]={'name':{'type':Sequelize[_0xfc64('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 23ecbad..00b56d2 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 _0x3d56=['ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','DeskConfiguration','include','findAll','catch','show','params','length','includeAll','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','options','getDescriptions','getTags','Tag','setTags'];(function(_0x3fd77c,_0x58405a){var _0x32f6ba=function(_0x1eca72){while(--_0x1eca72){_0x3fd77c['push'](_0x3fd77c['shift']());}};_0x32f6ba(++_0x58405a);}(_0x3d56,0x19b));var _0x63d5=function(_0x5ac605,_0x4ac11e){_0x5ac605=_0x5ac605-0x0;var _0x9a378b=_0x3d56[_0x5ac605];return _0x9a378b;};'use strict';var emlformat=require(_0x63d5('0x0'));var rimraf=require(_0x63d5('0x1'));var zipdir=require(_0x63d5('0x2'));var jsonpatch=require(_0x63d5('0x3'));var rp=require(_0x63d5('0x4'));var moment=require(_0x63d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x63d5('0x6'));var util=require('util');var path=require(_0x63d5('0x7'));var sox=require(_0x63d5('0x8'));var csv=require(_0x63d5('0x9'));var ejs=require(_0x63d5('0xa'));var fs=require('fs');var fs_extra=require(_0x63d5('0xb'));var _=require(_0x63d5('0xc'));var squel=require(_0x63d5('0xd'));var crypto=require(_0x63d5('0xe'));var jsforce=require(_0x63d5('0xf'));var deskjs=require(_0x63d5('0x10'));var toCsv=require(_0x63d5('0x9'));var querystring=require('querystring');var Papa=require(_0x63d5('0x11'));var Redis=require(_0x63d5('0x12'));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(_0x63d5('0x13'))(_0x63d5('0x14'));var utils=require(_0x63d5('0x15'));var config=require(_0x63d5('0x16'));var licenseUtil=require(_0x63d5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f8c5,_0x6bae2a){_0x6bae2a=_0x6bae2a||0xcc;return function(_0x2f49b7){if(_0x2f49b7){return _0x35f8c5[_0x63d5('0x18')](_0x6bae2a);}return _0x35f8c5[_0x63d5('0x19')](_0x6bae2a)[_0x63d5('0x1a')]();};}function respondWithResult(_0x2f60f4,_0x2c6c78){_0x2c6c78=_0x2c6c78||0xc8;return function(_0x207314){if(_0x207314){return _0x2f60f4['status'](_0x2c6c78)['json'](_0x207314);}};}function respondWithFilteredResult(_0x3b25c1,_0x117398){return function(_0x2c02c9){if(_0x2c02c9){var _0x2253ae=typeof _0x117398[_0x63d5('0x1b')]===_0x63d5('0x1c')&&typeof _0x117398[_0x63d5('0x1d')]===_0x63d5('0x1c');var _0x59f092=_0x2c02c9['count'];var _0x46fb69=_0x2253ae?0x0:_0x117398[_0x63d5('0x1b')];var _0xf20640=_0x2253ae?_0x2c02c9[_0x63d5('0x1e')]:_0x117398['offset']+_0x117398[_0x63d5('0x1d')];var _0x3a36aa;if(_0xf20640>=_0x59f092){_0xf20640=_0x59f092;_0x3a36aa=0xc8;}else{_0x3a36aa=0xce;}_0x3b25c1[_0x63d5('0x19')](_0x3a36aa);return _0x3b25c1['set'](_0x63d5('0x1f'),_0x46fb69+'-'+_0xf20640+'/'+_0x59f092)['json'](_0x2c02c9);}return null;};}function patchUpdates(_0x1e111a){return function(_0x1e3bbd){try{jsonpatch[_0x63d5('0x20')](_0x1e3bbd,_0x1e111a,!![]);}catch(_0x43c756){return BPromise['reject'](_0x43c756);}return _0x1e3bbd[_0x63d5('0x21')]();};}function saveUpdates(_0x2c74e6,_0x5ecffb){return function(_0x22a8db){if(_0x22a8db){return _0x22a8db[_0x63d5('0x22')](_0x2c74e6)[_0x63d5('0x23')](function(_0x5b5aa9){return _0x5b5aa9;});}return null;};}function removeEntity(_0x4e3a3d,_0x24bd8d){return function(_0x36491d){if(_0x36491d){return _0x36491d[_0x63d5('0x24')]()[_0x63d5('0x23')](function(){_0x4e3a3d['status'](0xcc)[_0x63d5('0x1a')]();});}};}function handleEntityNotFound(_0x2fa5b4,_0x407c75){return function(_0x71d8aa){if(!_0x71d8aa){_0x2fa5b4[_0x63d5('0x18')](0x194);}return _0x71d8aa;};}function handleError(_0x2e265f,_0x6db4f9){_0x6db4f9=_0x6db4f9||0x1f4;return function(_0x41e11a){logger[_0x63d5('0x25')](_0x41e11a[_0x63d5('0x26')]);if(_0x41e11a[_0x63d5('0x27')]){delete _0x41e11a[_0x63d5('0x27')];}_0x2e265f[_0x63d5('0x19')](_0x6db4f9)[_0x63d5('0x28')](_0x41e11a);};}exports['index']=function(_0x46c8e3,_0x2948fc){var _0x48ecb6={},_0x3a1916={},_0x3485af={'count':0x0,'rows':[]};var _0x285c45=_[_0x63d5('0x29')](db['DeskConfiguration'][_0x63d5('0x2a')],function(_0x3cb2de){return{'name':_0x3cb2de['fieldName'],'type':_0x3cb2de[_0x63d5('0x2b')][_0x63d5('0x2c')]};});_0x3a1916[_0x63d5('0x2d')]=_[_0x63d5('0x29')](_0x285c45,'name');_0x3a1916['query']=_[_0x63d5('0x2e')](_0x46c8e3[_0x63d5('0x2f')]);_0x3a1916['filters']=_[_0x63d5('0x30')](_0x3a1916['model'],_0x3a1916[_0x63d5('0x2f')]);_0x48ecb6[_0x63d5('0x31')]=_[_0x63d5('0x30')](_0x3a1916[_0x63d5('0x2d')],qs[_0x63d5('0x32')](_0x46c8e3['query']['fields']));_0x48ecb6[_0x63d5('0x31')]=_0x48ecb6[_0x63d5('0x31')]['length']?_0x48ecb6[_0x63d5('0x31')]:_0x3a1916[_0x63d5('0x2d')];if(!_0x46c8e3[_0x63d5('0x2f')][_0x63d5('0x33')]('nolimit')){_0x48ecb6[_0x63d5('0x1d')]=qs['limit'](_0x46c8e3['query'][_0x63d5('0x1d')]);_0x48ecb6[_0x63d5('0x1b')]=qs[_0x63d5('0x1b')](_0x46c8e3[_0x63d5('0x2f')][_0x63d5('0x1b')]);}_0x48ecb6[_0x63d5('0x34')]=qs[_0x63d5('0x35')](_0x46c8e3['query'][_0x63d5('0x35')]);_0x48ecb6[_0x63d5('0x36')]=qs['filters'](_[_0x63d5('0x37')](_0x46c8e3[_0x63d5('0x2f')],_0x3a1916[_0x63d5('0x38')]),_0x285c45);if(_0x46c8e3['query'][_0x63d5('0x39')]){_0x48ecb6[_0x63d5('0x36')]=_[_0x63d5('0x3a')](_0x48ecb6[_0x63d5('0x36')],{'$or':_[_0x63d5('0x29')](_0x285c45,function(_0x342366){if(_0x342366[_0x63d5('0x2b')]!==_0x63d5('0x3b')){var _0x3bd361={};_0x3bd361[_0x342366[_0x63d5('0x27')]]={'$like':'%'+_0x46c8e3[_0x63d5('0x2f')][_0x63d5('0x39')]+'%'};return _0x3bd361;}})});}_0x48ecb6=_[_0x63d5('0x3a')]({},_0x48ecb6,_0x46c8e3['options']);var _0x2b794b={'where':_0x48ecb6[_0x63d5('0x36')]};return db[_0x63d5('0x3c')][_0x63d5('0x1e')](_0x2b794b)[_0x63d5('0x23')](function(_0x14d5fb){_0x3485af[_0x63d5('0x1e')]=_0x14d5fb;if(_0x46c8e3['query']['includeAll']){_0x48ecb6[_0x63d5('0x3d')]=[{'all':!![]}];}return db[_0x63d5('0x3c')][_0x63d5('0x3e')](_0x48ecb6);})['then'](function(_0x3a376f){_0x3485af['rows']=_0x3a376f;return _0x3485af;})[_0x63d5('0x23')](respondWithFilteredResult(_0x2948fc,_0x48ecb6))[_0x63d5('0x3f')](handleError(_0x2948fc,null));};exports[_0x63d5('0x40')]=function(_0x136805,_0x253011){var _0x25998f={'raw':![],'where':{'id':_0x136805[_0x63d5('0x41')]['id']}},_0x228b9e={};_0x228b9e['model']=_[_0x63d5('0x2e')](db['DeskConfiguration'][_0x63d5('0x2a')]);_0x228b9e[_0x63d5('0x2f')]=_[_0x63d5('0x2e')](_0x136805['query']);_0x228b9e['filters']=_[_0x63d5('0x30')](_0x228b9e[_0x63d5('0x2d')],_0x228b9e[_0x63d5('0x2f')]);_0x25998f[_0x63d5('0x31')]=_['intersection'](_0x228b9e[_0x63d5('0x2d')],qs[_0x63d5('0x32')](_0x136805[_0x63d5('0x2f')][_0x63d5('0x32')]));_0x25998f[_0x63d5('0x31')]=_0x25998f[_0x63d5('0x31')][_0x63d5('0x42')]?_0x25998f[_0x63d5('0x31')]:_0x228b9e[_0x63d5('0x2d')];if(_0x136805[_0x63d5('0x2f')][_0x63d5('0x43')]){_0x25998f[_0x63d5('0x3d')]=[{'all':!![]}];}_0x25998f=_[_0x63d5('0x3a')]({},_0x25998f,_0x136805['options']);return db[_0x63d5('0x3c')][_0x63d5('0x44')](_0x25998f)['then'](handleEntityNotFound(_0x253011,null))['then'](respondWithResult(_0x253011,null))[_0x63d5('0x3f')](handleError(_0x253011,null));};exports[_0x63d5('0x45')]=function(_0x1f3088,_0x5c1240){return db['DeskConfiguration']['create'](_0x1f3088[_0x63d5('0x46')],{})[_0x63d5('0x23')](respondWithResult(_0x5c1240,0xc9))['catch'](handleError(_0x5c1240,null));};exports[_0x63d5('0x22')]=function(_0x5a1768,_0x4b2569){if(_0x5a1768[_0x63d5('0x46')]['id']){delete _0x5a1768[_0x63d5('0x46')]['id'];}return db[_0x63d5('0x3c')]['find']({'where':{'id':_0x5a1768[_0x63d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b2569,null))[_0x63d5('0x23')](saveUpdates(_0x5a1768[_0x63d5('0x46')],null))[_0x63d5('0x23')](respondWithResult(_0x4b2569,null))[_0x63d5('0x3f')](handleError(_0x4b2569,null));};exports['destroy']=function(_0x32284a,_0x5e825c){return db[_0x63d5('0x3c')][_0x63d5('0x44')]({'where':{'id':_0x32284a[_0x63d5('0x41')]['id']}})[_0x63d5('0x23')](handleEntityNotFound(_0x5e825c,null))[_0x63d5('0x23')](removeEntity(_0x5e825c,null))[_0x63d5('0x3f')](handleError(_0x5e825c,null));};exports[_0x63d5('0x47')]=function(_0x2e2866,_0x37841b,_0x50f91c){var _0xc1f561={};var _0x1544fd={};var _0x31628f;var _0xde0bf4;return db[_0x63d5('0x3c')][_0x63d5('0x48')]({'where':{'id':_0x2e2866[_0x63d5('0x41')]['id']}})[_0x63d5('0x23')](handleEntityNotFound(_0x37841b,null))[_0x63d5('0x23')](function(_0x3464be){if(_0x3464be){_0x31628f=_0x3464be;_0x1544fd[_0x63d5('0x2d')]=_[_0x63d5('0x2e')](db[_0x63d5('0x49')]['rawAttributes']);_0x1544fd[_0x63d5('0x2f')]=_[_0x63d5('0x2e')](_0x2e2866['query']);_0x1544fd[_0x63d5('0x38')]=_[_0x63d5('0x30')](_0x1544fd['model'],_0x1544fd[_0x63d5('0x2f')]);_0xc1f561[_0x63d5('0x31')]=_[_0x63d5('0x30')](_0x1544fd[_0x63d5('0x2d')],qs['fields'](_0x2e2866['query']['fields']));_0xc1f561['attributes']=_0xc1f561['attributes'][_0x63d5('0x42')]?_0xc1f561['attributes']:_0x1544fd[_0x63d5('0x2d')];_0xc1f561[_0x63d5('0x34')]=qs[_0x63d5('0x35')](_0x2e2866['query'][_0x63d5('0x35')]);_0xc1f561[_0x63d5('0x36')]=qs[_0x63d5('0x38')](_[_0x63d5('0x37')](_0x2e2866[_0x63d5('0x2f')],_0x1544fd['filters']));if(_0x2e2866[_0x63d5('0x2f')]['filter']){_0xc1f561[_0x63d5('0x36')]=_[_0x63d5('0x3a')](_0xc1f561[_0x63d5('0x36')],{'$or':_[_0x63d5('0x29')](_0xc1f561[_0x63d5('0x31')],function(_0x437641){var _0x58123b={};_0x58123b[_0x437641]={'$like':'%'+_0x2e2866['query'][_0x63d5('0x39')]+'%'};return _0x58123b;})});}_0xc1f561=_[_0x63d5('0x3a')]({},_0xc1f561,_0x2e2866['options']);return _0x31628f[_0x63d5('0x47')](_0xc1f561);}})[_0x63d5('0x23')](function(_0x161b8d){if(_0x161b8d){_0xde0bf4=_0x161b8d['length'];if(!_0x2e2866[_0x63d5('0x2f')]['hasOwnProperty'](_0x63d5('0x4a'))){_0xc1f561['limit']=qs[_0x63d5('0x1d')](_0x2e2866[_0x63d5('0x2f')][_0x63d5('0x1d')]);_0xc1f561[_0x63d5('0x1b')]=qs[_0x63d5('0x1b')](_0x2e2866['query'][_0x63d5('0x1b')]);}return _0x31628f['getFields'](_0xc1f561);}})[_0x63d5('0x23')](function(_0x5f0f83){if(_0x5f0f83){return _0x5f0f83?{'count':_0xde0bf4,'rows':_0x5f0f83}:null;}})['then'](respondWithResult(_0x37841b,null))[_0x63d5('0x3f')](handleError(_0x37841b,null));};exports[_0x63d5('0x4b')]=function(_0x48f9de,_0x12245d,_0x11bfdc){var _0x22e68b={};var _0xaac216={};var _0xa8dfc1;var _0x5b3b37;return db[_0x63d5('0x3c')]['findOne']({'where':{'id':_0x48f9de[_0x63d5('0x41')]['id']}})[_0x63d5('0x23')](handleEntityNotFound(_0x12245d,null))[_0x63d5('0x23')](function(_0x2fb265){if(_0x2fb265){_0xa8dfc1=_0x2fb265;_0xaac216['model']=_[_0x63d5('0x2e')](db[_0x63d5('0x49')][_0x63d5('0x2a')]);_0xaac216[_0x63d5('0x2f')]=_[_0x63d5('0x2e')](_0x48f9de[_0x63d5('0x2f')]);_0xaac216[_0x63d5('0x38')]=_[_0x63d5('0x30')](_0xaac216[_0x63d5('0x2d')],_0xaac216[_0x63d5('0x2f')]);_0x22e68b[_0x63d5('0x31')]=_[_0x63d5('0x30')](_0xaac216[_0x63d5('0x2d')],qs[_0x63d5('0x32')](_0x48f9de[_0x63d5('0x2f')][_0x63d5('0x32')]));_0x22e68b[_0x63d5('0x31')]=_0x22e68b[_0x63d5('0x31')]['length']?_0x22e68b[_0x63d5('0x31')]:_0xaac216['model'];_0x22e68b[_0x63d5('0x34')]=qs[_0x63d5('0x35')](_0x48f9de['query'][_0x63d5('0x35')]);_0x22e68b['where']=qs[_0x63d5('0x38')](_[_0x63d5('0x37')](_0x48f9de[_0x63d5('0x2f')],_0xaac216[_0x63d5('0x38')]));if(_0x48f9de[_0x63d5('0x2f')][_0x63d5('0x39')]){_0x22e68b['where']=_[_0x63d5('0x3a')](_0x22e68b[_0x63d5('0x36')],{'$or':_[_0x63d5('0x29')](_0x22e68b[_0x63d5('0x31')],function(_0x104c70){var _0x420217={};_0x420217[_0x104c70]={'$like':'%'+_0x48f9de['query'][_0x63d5('0x39')]+'%'};return _0x420217;})});}_0x22e68b=_[_0x63d5('0x3a')]({},_0x22e68b,_0x48f9de[_0x63d5('0x4c')]);return _0xa8dfc1['getSubjects'](_0x22e68b);}})[_0x63d5('0x23')](function(_0x11415b){if(_0x11415b){_0x5b3b37=_0x11415b[_0x63d5('0x42')];if(!_0x48f9de[_0x63d5('0x2f')][_0x63d5('0x33')](_0x63d5('0x4a'))){_0x22e68b['limit']=qs[_0x63d5('0x1d')](_0x48f9de[_0x63d5('0x2f')]['limit']);_0x22e68b[_0x63d5('0x1b')]=qs[_0x63d5('0x1b')](_0x48f9de['query'][_0x63d5('0x1b')]);}return _0xa8dfc1['getSubjects'](_0x22e68b);}})[_0x63d5('0x23')](function(_0x23282e){if(_0x23282e){return _0x23282e?{'count':_0x5b3b37,'rows':_0x23282e}:null;}})[_0x63d5('0x23')](respondWithResult(_0x12245d,null))['catch'](handleError(_0x12245d,null));};exports[_0x63d5('0x4d')]=function(_0x4484cb,_0x3d395c,_0x131b77){var _0x351f20={};var _0x7f3124={};var _0x46fe5b;var _0x3a413f;return db[_0x63d5('0x3c')][_0x63d5('0x48')]({'where':{'id':_0x4484cb[_0x63d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d395c,null))[_0x63d5('0x23')](function(_0x21288f){if(_0x21288f){_0x46fe5b=_0x21288f;_0x7f3124[_0x63d5('0x2d')]=_[_0x63d5('0x2e')](db[_0x63d5('0x49')][_0x63d5('0x2a')]);_0x7f3124[_0x63d5('0x2f')]=_['keys'](_0x4484cb['query']);_0x7f3124[_0x63d5('0x38')]=_[_0x63d5('0x30')](_0x7f3124[_0x63d5('0x2d')],_0x7f3124['query']);_0x351f20[_0x63d5('0x31')]=_[_0x63d5('0x30')](_0x7f3124['model'],qs['fields'](_0x4484cb['query']['fields']));_0x351f20['attributes']=_0x351f20[_0x63d5('0x31')][_0x63d5('0x42')]?_0x351f20[_0x63d5('0x31')]:_0x7f3124[_0x63d5('0x2d')];_0x351f20[_0x63d5('0x34')]=qs[_0x63d5('0x35')](_0x4484cb['query']['sort']);_0x351f20[_0x63d5('0x36')]=qs[_0x63d5('0x38')](_[_0x63d5('0x37')](_0x4484cb[_0x63d5('0x2f')],_0x7f3124[_0x63d5('0x38')]));if(_0x4484cb['query'][_0x63d5('0x39')]){_0x351f20[_0x63d5('0x36')]=_[_0x63d5('0x3a')](_0x351f20[_0x63d5('0x36')],{'$or':_[_0x63d5('0x29')](_0x351f20[_0x63d5('0x31')],function(_0x50c849){var _0xa2e631={};_0xa2e631[_0x50c849]={'$like':'%'+_0x4484cb['query'][_0x63d5('0x39')]+'%'};return _0xa2e631;})});}_0x351f20=_[_0x63d5('0x3a')]({},_0x351f20,_0x4484cb[_0x63d5('0x4c')]);return _0x46fe5b[_0x63d5('0x4d')](_0x351f20);}})[_0x63d5('0x23')](function(_0x530429){if(_0x530429){_0x3a413f=_0x530429[_0x63d5('0x42')];if(!_0x4484cb[_0x63d5('0x2f')][_0x63d5('0x33')](_0x63d5('0x4a'))){_0x351f20[_0x63d5('0x1d')]=qs['limit'](_0x4484cb[_0x63d5('0x2f')][_0x63d5('0x1d')]);_0x351f20[_0x63d5('0x1b')]=qs[_0x63d5('0x1b')](_0x4484cb[_0x63d5('0x2f')][_0x63d5('0x1b')]);}return _0x46fe5b[_0x63d5('0x4d')](_0x351f20);}})[_0x63d5('0x23')](function(_0x14b1df){if(_0x14b1df){return _0x14b1df?{'count':_0x3a413f,'rows':_0x14b1df}:null;}})[_0x63d5('0x23')](respondWithResult(_0x3d395c,null))[_0x63d5('0x3f')](handleError(_0x3d395c,null));};exports[_0x63d5('0x4e')]=function(_0x566b41,_0x17cf14,_0x534d2b){var _0x10ca09={};var _0x47c0db={};var _0x2228a1;var _0x12e5b3;return db[_0x63d5('0x3c')][_0x63d5('0x48')]({'where':{'id':_0x566b41[_0x63d5('0x41')]['id']}})[_0x63d5('0x23')](handleEntityNotFound(_0x17cf14,null))['then'](function(_0x5874aa){if(_0x5874aa){_0x2228a1=_0x5874aa;_0x47c0db['model']=_['keys'](db[_0x63d5('0x4f')][_0x63d5('0x2a')]);_0x47c0db[_0x63d5('0x2f')]=_[_0x63d5('0x2e')](_0x566b41[_0x63d5('0x2f')]);_0x47c0db[_0x63d5('0x38')]=_['intersection'](_0x47c0db[_0x63d5('0x2d')],_0x47c0db[_0x63d5('0x2f')]);_0x10ca09[_0x63d5('0x31')]=_[_0x63d5('0x30')](_0x47c0db['model'],qs[_0x63d5('0x32')](_0x566b41[_0x63d5('0x2f')]['fields']));_0x10ca09[_0x63d5('0x31')]=_0x10ca09[_0x63d5('0x31')]['length']?_0x10ca09['attributes']:_0x47c0db['model'];_0x10ca09['order']=qs['sort'](_0x566b41[_0x63d5('0x2f')]['sort']);_0x10ca09[_0x63d5('0x36')]=qs[_0x63d5('0x38')](_[_0x63d5('0x37')](_0x566b41[_0x63d5('0x2f')],_0x47c0db[_0x63d5('0x38')]));if(_0x566b41[_0x63d5('0x2f')][_0x63d5('0x39')]){_0x10ca09[_0x63d5('0x36')]=_[_0x63d5('0x3a')](_0x10ca09[_0x63d5('0x36')],{'$or':_['map'](_0x10ca09[_0x63d5('0x31')],function(_0x89c56c){var _0x372a0a={};_0x372a0a[_0x89c56c]={'$like':'%'+_0x566b41[_0x63d5('0x2f')][_0x63d5('0x39')]+'%'};return _0x372a0a;})});}_0x10ca09=_[_0x63d5('0x3a')]({},_0x10ca09,_0x566b41[_0x63d5('0x4c')]);return _0x2228a1[_0x63d5('0x4e')](_0x10ca09);}})[_0x63d5('0x23')](function(_0x358139){if(_0x358139){_0x12e5b3=_0x358139[_0x63d5('0x42')];if(!_0x566b41[_0x63d5('0x2f')][_0x63d5('0x33')](_0x63d5('0x4a'))){_0x10ca09['limit']=qs[_0x63d5('0x1d')](_0x566b41[_0x63d5('0x2f')]['limit']);_0x10ca09['offset']=qs['offset'](_0x566b41[_0x63d5('0x2f')][_0x63d5('0x1b')]);}return _0x2228a1['getTags'](_0x10ca09);}})[_0x63d5('0x23')](function(_0xdf9570){if(_0xdf9570){return _0xdf9570?{'count':_0x12e5b3,'rows':_0xdf9570}:null;}})['then'](respondWithResult(_0x17cf14,null))[_0x63d5('0x3f')](handleError(_0x17cf14,null));};exports[_0x63d5('0x50')]=function(_0x58dca,_0xd88481,_0x428429){if(_0x58dca['body']['id']){delete _0x58dca[_0x63d5('0x46')]['id'];}return db[_0x63d5('0x3c')][_0x63d5('0x48')]({'where':{'id':_0x58dca[_0x63d5('0x41')]['id']}})[_0x63d5('0x23')](handleEntityNotFound(_0xd88481,null))[_0x63d5('0x23')](function(_0x267cd3){if(_0x267cd3){return _0x267cd3[_0x63d5('0x50')](_0x58dca[_0x63d5('0x46')][_0x63d5('0x51')]||[]);}return null;})[_0x63d5('0x23')](respondWithResult(_0xd88481,null))[_0x63d5('0x3f')](handleError(_0xd88481,null));}; \ No newline at end of file +var _0xb4d3=['filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','show','find','create','body','catch','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb4d3,0x1ac));var _0x3b4d=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xb4d3[_0x54edc9];return _0x2ae7a9;};'use strict';var emlformat=require(_0x3b4d('0x0'));var rimraf=require(_0x3b4d('0x1'));var zipdir=require(_0x3b4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b4d('0x3'));var moment=require('moment');var BPromise=require(_0x3b4d('0x4'));var Mustache=require('mustache');var util=require(_0x3b4d('0x5'));var path=require(_0x3b4d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b4d('0x7'));var fs=require('fs');var fs_extra=require(_0x3b4d('0x8'));var _=require(_0x3b4d('0x9'));var squel=require(_0x3b4d('0xa'));var crypto=require(_0x3b4d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b4d('0xc'));var Papa=require(_0x3b4d('0xd'));var Redis=require(_0x3b4d('0xe'));var authService=require(_0x3b4d('0xf'));var qs=require(_0x3b4d('0x10'));var as=require(_0x3b4d('0x11'));var hardwareService=require(_0x3b4d('0x12'));var logger=require('../../config/logger')(_0x3b4d('0x13'));var utils=require('../../config/utils');var config=require(_0x3b4d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd20e93,_0x5aea32){_0x5aea32=_0x5aea32||0xcc;return function(_0x3f3a21){if(_0x3f3a21){return _0xd20e93['sendStatus'](_0x5aea32);}return _0xd20e93['status'](_0x5aea32)['end']();};}function respondWithResult(_0x43f685,_0x574a29){_0x574a29=_0x574a29||0xc8;return function(_0x2645ef){if(_0x2645ef){return _0x43f685[_0x3b4d('0x15')](_0x574a29)[_0x3b4d('0x16')](_0x2645ef);}};}function respondWithFilteredResult(_0x27e5c4,_0x43edad){return function(_0x1ce909){if(_0x1ce909){var _0xc72af4=typeof _0x43edad[_0x3b4d('0x17')]===_0x3b4d('0x18')&&typeof _0x43edad['limit']===_0x3b4d('0x18');var _0x7f9173=_0x1ce909[_0x3b4d('0x19')];var _0x4164d0=_0xc72af4?0x0:_0x43edad['offset'];var _0x22a487=_0xc72af4?_0x1ce909['count']:_0x43edad['offset']+_0x43edad['limit'];var _0x56c87c;if(_0x22a487>=_0x7f9173){_0x22a487=_0x7f9173;_0x56c87c=0xc8;}else{_0x56c87c=0xce;}_0x27e5c4['status'](_0x56c87c);return _0x27e5c4[_0x3b4d('0x1a')](_0x3b4d('0x1b'),_0x4164d0+'-'+_0x22a487+'/'+_0x7f9173)[_0x3b4d('0x16')](_0x1ce909);}return null;};}function patchUpdates(_0x4fb334){return function(_0x26f7d0){try{jsonpatch['apply'](_0x26f7d0,_0x4fb334,!![]);}catch(_0x5173d4){return BPromise['reject'](_0x5173d4);}return _0x26f7d0[_0x3b4d('0x1c')]();};}function saveUpdates(_0x29ee15,_0x59aab1){return function(_0x1e7e9b){if(_0x1e7e9b){return _0x1e7e9b[_0x3b4d('0x1d')](_0x29ee15)['then'](function(_0x524c12){return _0x524c12;});}return null;};}function removeEntity(_0x178821,_0x464c56){return function(_0x315458){if(_0x315458){return _0x315458[_0x3b4d('0x1e')]()[_0x3b4d('0x1f')](function(){_0x178821['status'](0xcc)[_0x3b4d('0x20')]();});}};}function handleEntityNotFound(_0xdfdef6,_0x41f80a){return function(_0x467a31){if(!_0x467a31){_0xdfdef6[_0x3b4d('0x21')](0x194);}return _0x467a31;};}function handleError(_0xd3e05a,_0x5a0546){_0x5a0546=_0x5a0546||0x1f4;return function(_0x4ac28b){logger[_0x3b4d('0x22')](_0x4ac28b[_0x3b4d('0x23')]);if(_0x4ac28b[_0x3b4d('0x24')]){delete _0x4ac28b['name'];}_0xd3e05a[_0x3b4d('0x15')](_0x5a0546)[_0x3b4d('0x25')](_0x4ac28b);};}exports[_0x3b4d('0x26')]=function(_0x11eff6,_0x4a4246){var _0x13d0db={},_0x5e7b63={},_0x58dd49={'count':0x0,'rows':[]};var _0x4ab057=_[_0x3b4d('0x27')](db['DeskConfiguration'][_0x3b4d('0x28')],function(_0x2374db){return{'name':_0x2374db['fieldName'],'type':_0x2374db[_0x3b4d('0x29')][_0x3b4d('0x2a')]};});_0x5e7b63[_0x3b4d('0x2b')]=_[_0x3b4d('0x27')](_0x4ab057,_0x3b4d('0x24'));_0x5e7b63[_0x3b4d('0x2c')]=_[_0x3b4d('0x2d')](_0x11eff6[_0x3b4d('0x2c')]);_0x5e7b63[_0x3b4d('0x2e')]=_[_0x3b4d('0x2f')](_0x5e7b63[_0x3b4d('0x2b')],_0x5e7b63['query']);_0x13d0db[_0x3b4d('0x30')]=_[_0x3b4d('0x2f')](_0x5e7b63[_0x3b4d('0x2b')],qs[_0x3b4d('0x31')](_0x11eff6[_0x3b4d('0x2c')]['fields']));_0x13d0db['attributes']=_0x13d0db[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x13d0db[_0x3b4d('0x30')]:_0x5e7b63[_0x3b4d('0x2b')];if(!_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x33')](_0x3b4d('0x34'))){_0x13d0db[_0x3b4d('0x35')]=qs[_0x3b4d('0x35')](_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x35')]);_0x13d0db[_0x3b4d('0x17')]=qs[_0x3b4d('0x17')](_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x17')]);}_0x13d0db[_0x3b4d('0x36')]=qs[_0x3b4d('0x37')](_0x11eff6[_0x3b4d('0x2c')]['sort']);_0x13d0db[_0x3b4d('0x38')]=qs[_0x3b4d('0x2e')](_[_0x3b4d('0x39')](_0x11eff6[_0x3b4d('0x2c')],_0x5e7b63[_0x3b4d('0x2e')]),_0x4ab057);if(_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x3a')]){_0x13d0db[_0x3b4d('0x38')]=_[_0x3b4d('0x3b')](_0x13d0db[_0x3b4d('0x38')],{'$or':_[_0x3b4d('0x27')](_0x4ab057,function(_0xb7bbe4){if(_0xb7bbe4['type']!==_0x3b4d('0x3c')){var _0x381f78={};_0x381f78[_0xb7bbe4[_0x3b4d('0x24')]]={'$like':'%'+_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x3a')]+'%'};return _0x381f78;}})});}_0x13d0db=_[_0x3b4d('0x3b')]({},_0x13d0db,_0x11eff6[_0x3b4d('0x3d')]);var _0x3b81e2={'where':_0x13d0db[_0x3b4d('0x38')]};return db[_0x3b4d('0x3e')][_0x3b4d('0x19')](_0x3b81e2)[_0x3b4d('0x1f')](function(_0x1b42ff){_0x58dd49['count']=_0x1b42ff;if(_0x11eff6[_0x3b4d('0x2c')][_0x3b4d('0x3f')]){_0x13d0db[_0x3b4d('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x3b4d('0x41')](_0x13d0db);})[_0x3b4d('0x1f')](function(_0x4e4dbc){_0x58dd49[_0x3b4d('0x42')]=_0x4e4dbc;return _0x58dd49;})[_0x3b4d('0x1f')](respondWithFilteredResult(_0x4a4246,_0x13d0db))['catch'](handleError(_0x4a4246,null));};exports[_0x3b4d('0x43')]=function(_0x410cef,_0x34752f){var _0x525b5d={'raw':![],'where':{'id':_0x410cef['params']['id']}},_0x2a122a={};_0x2a122a['model']=_[_0x3b4d('0x2d')](db[_0x3b4d('0x3e')][_0x3b4d('0x28')]);_0x2a122a['query']=_[_0x3b4d('0x2d')](_0x410cef[_0x3b4d('0x2c')]);_0x2a122a[_0x3b4d('0x2e')]=_[_0x3b4d('0x2f')](_0x2a122a[_0x3b4d('0x2b')],_0x2a122a[_0x3b4d('0x2c')]);_0x525b5d[_0x3b4d('0x30')]=_[_0x3b4d('0x2f')](_0x2a122a['model'],qs[_0x3b4d('0x31')](_0x410cef[_0x3b4d('0x2c')][_0x3b4d('0x31')]));_0x525b5d[_0x3b4d('0x30')]=_0x525b5d[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x525b5d[_0x3b4d('0x30')]:_0x2a122a[_0x3b4d('0x2b')];if(_0x410cef[_0x3b4d('0x2c')][_0x3b4d('0x3f')]){_0x525b5d[_0x3b4d('0x40')]=[{'all':!![]}];}_0x525b5d=_['merge']({},_0x525b5d,_0x410cef[_0x3b4d('0x3d')]);return db[_0x3b4d('0x3e')][_0x3b4d('0x44')](_0x525b5d)[_0x3b4d('0x1f')](handleEntityNotFound(_0x34752f,null))[_0x3b4d('0x1f')](respondWithResult(_0x34752f,null))['catch'](handleError(_0x34752f,null));};exports[_0x3b4d('0x45')]=function(_0x21efb0,_0x1dab99){return db[_0x3b4d('0x3e')]['create'](_0x21efb0[_0x3b4d('0x46')],{})['then'](respondWithResult(_0x1dab99,0xc9))[_0x3b4d('0x47')](handleError(_0x1dab99,null));};exports[_0x3b4d('0x1d')]=function(_0x583d52,_0xa46ea2){if(_0x583d52['body']['id']){delete _0x583d52[_0x3b4d('0x46')]['id'];}return db[_0x3b4d('0x3e')][_0x3b4d('0x44')]({'where':{'id':_0x583d52[_0x3b4d('0x48')]['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0xa46ea2,null))['then'](saveUpdates(_0x583d52['body'],null))[_0x3b4d('0x1f')](respondWithResult(_0xa46ea2,null))[_0x3b4d('0x47')](handleError(_0xa46ea2,null));};exports[_0x3b4d('0x1e')]=function(_0x1afba5,_0x2eea86){return db[_0x3b4d('0x3e')][_0x3b4d('0x44')]({'where':{'id':_0x1afba5['params']['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0x2eea86,null))[_0x3b4d('0x1f')](removeEntity(_0x2eea86,null))[_0x3b4d('0x47')](handleError(_0x2eea86,null));};exports[_0x3b4d('0x49')]=function(_0x405d8a,_0x12e679,_0x12d20a){var _0x4104fe={};var _0x5b45ff={};var _0x200ca3;var _0x3dcaed;return db['DeskConfiguration'][_0x3b4d('0x4a')]({'where':{'id':_0x405d8a[_0x3b4d('0x48')]['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0x12e679,null))[_0x3b4d('0x1f')](function(_0x4fe873){if(_0x4fe873){_0x200ca3=_0x4fe873;_0x5b45ff[_0x3b4d('0x2b')]=_[_0x3b4d('0x2d')](db[_0x3b4d('0x4b')][_0x3b4d('0x28')]);_0x5b45ff[_0x3b4d('0x2c')]=_[_0x3b4d('0x2d')](_0x405d8a[_0x3b4d('0x2c')]);_0x5b45ff['filters']=_[_0x3b4d('0x2f')](_0x5b45ff['model'],_0x5b45ff[_0x3b4d('0x2c')]);_0x4104fe[_0x3b4d('0x30')]=_[_0x3b4d('0x2f')](_0x5b45ff[_0x3b4d('0x2b')],qs[_0x3b4d('0x31')](_0x405d8a['query']['fields']));_0x4104fe['attributes']=_0x4104fe[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x4104fe[_0x3b4d('0x30')]:_0x5b45ff[_0x3b4d('0x2b')];_0x4104fe[_0x3b4d('0x36')]=qs[_0x3b4d('0x37')](_0x405d8a['query'][_0x3b4d('0x37')]);_0x4104fe['where']=qs[_0x3b4d('0x2e')](_[_0x3b4d('0x39')](_0x405d8a['query'],_0x5b45ff[_0x3b4d('0x2e')]));if(_0x405d8a[_0x3b4d('0x2c')]['filter']){_0x4104fe[_0x3b4d('0x38')]=_[_0x3b4d('0x3b')](_0x4104fe[_0x3b4d('0x38')],{'$or':_[_0x3b4d('0x27')](_0x4104fe[_0x3b4d('0x30')],function(_0x519b51){var _0x2f6ab1={};_0x2f6ab1[_0x519b51]={'$like':'%'+_0x405d8a['query'][_0x3b4d('0x3a')]+'%'};return _0x2f6ab1;})});}_0x4104fe=_[_0x3b4d('0x3b')]({},_0x4104fe,_0x405d8a[_0x3b4d('0x3d')]);return _0x200ca3[_0x3b4d('0x49')](_0x4104fe);}})[_0x3b4d('0x1f')](function(_0x11d982){if(_0x11d982){_0x3dcaed=_0x11d982[_0x3b4d('0x32')];if(!_0x405d8a['query'][_0x3b4d('0x33')](_0x3b4d('0x34'))){_0x4104fe[_0x3b4d('0x35')]=qs['limit'](_0x405d8a[_0x3b4d('0x2c')][_0x3b4d('0x35')]);_0x4104fe['offset']=qs[_0x3b4d('0x17')](_0x405d8a['query']['offset']);}return _0x200ca3[_0x3b4d('0x49')](_0x4104fe);}})['then'](function(_0x191360){if(_0x191360){return _0x191360?{'count':_0x3dcaed,'rows':_0x191360}:null;}})['then'](respondWithResult(_0x12e679,null))[_0x3b4d('0x47')](handleError(_0x12e679,null));};exports[_0x3b4d('0x4c')]=function(_0xc2d318,_0x1df352,_0x37db5f){var _0x14edb4={};var _0x4f0391={};var _0x3b234a;var _0x3200f7;return db[_0x3b4d('0x3e')]['findOne']({'where':{'id':_0xc2d318[_0x3b4d('0x48')]['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0x1df352,null))[_0x3b4d('0x1f')](function(_0x4708d8){if(_0x4708d8){_0x3b234a=_0x4708d8;_0x4f0391['model']=_[_0x3b4d('0x2d')](db[_0x3b4d('0x4b')]['rawAttributes']);_0x4f0391[_0x3b4d('0x2c')]=_[_0x3b4d('0x2d')](_0xc2d318[_0x3b4d('0x2c')]);_0x4f0391[_0x3b4d('0x2e')]=_[_0x3b4d('0x2f')](_0x4f0391[_0x3b4d('0x2b')],_0x4f0391['query']);_0x14edb4[_0x3b4d('0x30')]=_['intersection'](_0x4f0391[_0x3b4d('0x2b')],qs[_0x3b4d('0x31')](_0xc2d318['query']['fields']));_0x14edb4[_0x3b4d('0x30')]=_0x14edb4[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x14edb4[_0x3b4d('0x30')]:_0x4f0391['model'];_0x14edb4[_0x3b4d('0x36')]=qs[_0x3b4d('0x37')](_0xc2d318[_0x3b4d('0x2c')][_0x3b4d('0x37')]);_0x14edb4[_0x3b4d('0x38')]=qs[_0x3b4d('0x2e')](_['pick'](_0xc2d318[_0x3b4d('0x2c')],_0x4f0391[_0x3b4d('0x2e')]));if(_0xc2d318[_0x3b4d('0x2c')][_0x3b4d('0x3a')]){_0x14edb4[_0x3b4d('0x38')]=_[_0x3b4d('0x3b')](_0x14edb4[_0x3b4d('0x38')],{'$or':_['map'](_0x14edb4['attributes'],function(_0x631a27){var _0x5b3d11={};_0x5b3d11[_0x631a27]={'$like':'%'+_0xc2d318['query'][_0x3b4d('0x3a')]+'%'};return _0x5b3d11;})});}_0x14edb4=_[_0x3b4d('0x3b')]({},_0x14edb4,_0xc2d318[_0x3b4d('0x3d')]);return _0x3b234a[_0x3b4d('0x4c')](_0x14edb4);}})[_0x3b4d('0x1f')](function(_0xc9bae7){if(_0xc9bae7){_0x3200f7=_0xc9bae7['length'];if(!_0xc2d318['query'][_0x3b4d('0x33')]('nolimit')){_0x14edb4['limit']=qs[_0x3b4d('0x35')](_0xc2d318[_0x3b4d('0x2c')][_0x3b4d('0x35')]);_0x14edb4['offset']=qs['offset'](_0xc2d318[_0x3b4d('0x2c')][_0x3b4d('0x17')]);}return _0x3b234a['getSubjects'](_0x14edb4);}})[_0x3b4d('0x1f')](function(_0x23adbf){if(_0x23adbf){return _0x23adbf?{'count':_0x3200f7,'rows':_0x23adbf}:null;}})[_0x3b4d('0x1f')](respondWithResult(_0x1df352,null))[_0x3b4d('0x47')](handleError(_0x1df352,null));};exports[_0x3b4d('0x4d')]=function(_0x466273,_0x5f4132,_0x2cba83){var _0x350bc9={};var _0x138d82={};var _0x22c2f0;var _0x12de28;return db['DeskConfiguration'][_0x3b4d('0x4a')]({'where':{'id':_0x466273[_0x3b4d('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f4132,null))['then'](function(_0x2db41d){if(_0x2db41d){_0x22c2f0=_0x2db41d;_0x138d82[_0x3b4d('0x2b')]=_[_0x3b4d('0x2d')](db[_0x3b4d('0x4b')]['rawAttributes']);_0x138d82[_0x3b4d('0x2c')]=_[_0x3b4d('0x2d')](_0x466273[_0x3b4d('0x2c')]);_0x138d82['filters']=_['intersection'](_0x138d82[_0x3b4d('0x2b')],_0x138d82['query']);_0x350bc9[_0x3b4d('0x30')]=_[_0x3b4d('0x2f')](_0x138d82['model'],qs[_0x3b4d('0x31')](_0x466273[_0x3b4d('0x2c')][_0x3b4d('0x31')]));_0x350bc9['attributes']=_0x350bc9[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x350bc9['attributes']:_0x138d82['model'];_0x350bc9['order']=qs['sort'](_0x466273['query']['sort']);_0x350bc9[_0x3b4d('0x38')]=qs[_0x3b4d('0x2e')](_[_0x3b4d('0x39')](_0x466273[_0x3b4d('0x2c')],_0x138d82[_0x3b4d('0x2e')]));if(_0x466273['query']['filter']){_0x350bc9[_0x3b4d('0x38')]=_['merge'](_0x350bc9[_0x3b4d('0x38')],{'$or':_[_0x3b4d('0x27')](_0x350bc9[_0x3b4d('0x30')],function(_0x3b6124){var _0x3261fd={};_0x3261fd[_0x3b6124]={'$like':'%'+_0x466273[_0x3b4d('0x2c')][_0x3b4d('0x3a')]+'%'};return _0x3261fd;})});}_0x350bc9=_[_0x3b4d('0x3b')]({},_0x350bc9,_0x466273[_0x3b4d('0x3d')]);return _0x22c2f0['getDescriptions'](_0x350bc9);}})[_0x3b4d('0x1f')](function(_0x4dac1d){if(_0x4dac1d){_0x12de28=_0x4dac1d[_0x3b4d('0x32')];if(!_0x466273[_0x3b4d('0x2c')][_0x3b4d('0x33')](_0x3b4d('0x34'))){_0x350bc9[_0x3b4d('0x35')]=qs[_0x3b4d('0x35')](_0x466273[_0x3b4d('0x2c')][_0x3b4d('0x35')]);_0x350bc9[_0x3b4d('0x17')]=qs[_0x3b4d('0x17')](_0x466273[_0x3b4d('0x2c')][_0x3b4d('0x17')]);}return _0x22c2f0['getDescriptions'](_0x350bc9);}})['then'](function(_0x2ff19c){if(_0x2ff19c){return _0x2ff19c?{'count':_0x12de28,'rows':_0x2ff19c}:null;}})[_0x3b4d('0x1f')](respondWithResult(_0x5f4132,null))[_0x3b4d('0x47')](handleError(_0x5f4132,null));};exports[_0x3b4d('0x4e')]=function(_0x5ed475,_0x5b4a0b,_0x28ffde){var _0x29bd1f={};var _0x41f73f={};var _0x48166d;var _0x395443;return db[_0x3b4d('0x3e')][_0x3b4d('0x4a')]({'where':{'id':_0x5ed475[_0x3b4d('0x48')]['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0x5b4a0b,null))['then'](function(_0x3accf3){if(_0x3accf3){_0x48166d=_0x3accf3;_0x41f73f[_0x3b4d('0x2b')]=_[_0x3b4d('0x2d')](db[_0x3b4d('0x4f')][_0x3b4d('0x28')]);_0x41f73f[_0x3b4d('0x2c')]=_[_0x3b4d('0x2d')](_0x5ed475[_0x3b4d('0x2c')]);_0x41f73f[_0x3b4d('0x2e')]=_[_0x3b4d('0x2f')](_0x41f73f[_0x3b4d('0x2b')],_0x41f73f[_0x3b4d('0x2c')]);_0x29bd1f[_0x3b4d('0x30')]=_[_0x3b4d('0x2f')](_0x41f73f[_0x3b4d('0x2b')],qs[_0x3b4d('0x31')](_0x5ed475[_0x3b4d('0x2c')][_0x3b4d('0x31')]));_0x29bd1f[_0x3b4d('0x30')]=_0x29bd1f[_0x3b4d('0x30')][_0x3b4d('0x32')]?_0x29bd1f['attributes']:_0x41f73f[_0x3b4d('0x2b')];_0x29bd1f[_0x3b4d('0x36')]=qs['sort'](_0x5ed475['query'][_0x3b4d('0x37')]);_0x29bd1f[_0x3b4d('0x38')]=qs['filters'](_['pick'](_0x5ed475[_0x3b4d('0x2c')],_0x41f73f[_0x3b4d('0x2e')]));if(_0x5ed475[_0x3b4d('0x2c')][_0x3b4d('0x3a')]){_0x29bd1f[_0x3b4d('0x38')]=_[_0x3b4d('0x3b')](_0x29bd1f[_0x3b4d('0x38')],{'$or':_[_0x3b4d('0x27')](_0x29bd1f['attributes'],function(_0x15d1dc){var _0x5610cd={};_0x5610cd[_0x15d1dc]={'$like':'%'+_0x5ed475[_0x3b4d('0x2c')][_0x3b4d('0x3a')]+'%'};return _0x5610cd;})});}_0x29bd1f=_[_0x3b4d('0x3b')]({},_0x29bd1f,_0x5ed475[_0x3b4d('0x3d')]);return _0x48166d['getTags'](_0x29bd1f);}})[_0x3b4d('0x1f')](function(_0x46bb15){if(_0x46bb15){_0x395443=_0x46bb15[_0x3b4d('0x32')];if(!_0x5ed475[_0x3b4d('0x2c')]['hasOwnProperty'](_0x3b4d('0x34'))){_0x29bd1f[_0x3b4d('0x35')]=qs['limit'](_0x5ed475[_0x3b4d('0x2c')][_0x3b4d('0x35')]);_0x29bd1f[_0x3b4d('0x17')]=qs['offset'](_0x5ed475[_0x3b4d('0x2c')]['offset']);}return _0x48166d[_0x3b4d('0x4e')](_0x29bd1f);}})[_0x3b4d('0x1f')](function(_0x4808cc){if(_0x4808cc){return _0x4808cc?{'count':_0x395443,'rows':_0x4808cc}:null;}})[_0x3b4d('0x1f')](respondWithResult(_0x5b4a0b,null))[_0x3b4d('0x47')](handleError(_0x5b4a0b,null));};exports['setTags']=function(_0x37e719,_0x11f83f,_0x4c6aa9){if(_0x37e719[_0x3b4d('0x46')]['id']){delete _0x37e719[_0x3b4d('0x46')]['id'];}return db['DeskConfiguration'][_0x3b4d('0x4a')]({'where':{'id':_0x37e719[_0x3b4d('0x48')]['id']}})[_0x3b4d('0x1f')](handleEntityNotFound(_0x11f83f,null))[_0x3b4d('0x1f')](function(_0x14c5fd){if(_0x14c5fd){return _0x14c5fd['setTags'](_0x37e719[_0x3b4d('0x46')][_0x3b4d('0x50')]||[]);}return null;})[_0x3b4d('0x1f')](respondWithResult(_0x11f83f,null))[_0x3b4d('0x47')](handleError(_0x11f83f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ebad234..d07bc86 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 _0xaf00=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xaf00,0xf5));var _0x0af0=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xaf00[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0x0af0('0x0'));var util=require('util');var logger=require(_0x0af0('0x1'))(_0x0af0('0x2'));var moment=require(_0x0af0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0af0('0x4'));var rimraf=require(_0x0af0('0x5'));var config=require(_0x0af0('0x6'));var attributes=require(_0x0af0('0x7'));module[_0x0af0('0x8')]=function(_0x2329b3,_0x3a85f0){return _0x2329b3[_0x0af0('0x9')](_0x0af0('0xa'),attributes,{'tableName':_0x0af0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ec=['./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xa4ec,0x193));var _0xca4e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa4ec[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xca4e('0x0'));var util=require('util');var logger=require(_0xca4e('0x1'))(_0xca4e('0x2'));var moment=require(_0xca4e('0x3'));var BPromise=require(_0xca4e('0x4'));var rp=require(_0xca4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca4e('0x6'));var attributes=require(_0xca4e('0x7'));module[_0xca4e('0x8')]=function(_0x5887c7,_0x38a60c){return _0x5887c7['define']('DeskConfiguration',attributes,{'tableName':_0xca4e('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 254e795..4426d9e 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 _0x352e=['client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x352e,0x1a6));var _0xe352=function(_0x5ccb86,_0x23b679){_0x5ccb86=_0x5ccb86-0x0;var _0x5440d8=_0x352e[_0x5ccb86];return _0x5440d8;};'use strict';var _=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var moment=require(_0xe352('0x2'));var BPromise=require(_0xe352('0x3'));var rs=require(_0xe352('0x4'));var fs=require('fs');var Redis=require(_0xe352('0x5'));var db=require(_0xe352('0x6'))['db'];var utils=require(_0xe352('0x7'));var logger=require('../../config/logger')(_0xe352('0x8'));var config=require(_0xe352('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe352('0xa')][_0xe352('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d7c6,_0x6549bb,_0x5b9266){return new BPromise(function(_0x2bd5e5,_0x3cfd5b){return client[_0xe352('0xc')](_0x32d7c6,_0x5b9266)[_0xe352('0xd')](function(_0x5b1b22){logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));logger[_0xe352('0x11')](_0xe352('0x12'),_0x6549bb,_0xe352('0x10'),JSON['stringify'](_0x5b1b22));if(_0x5b1b22['error']){if(_0x5b1b22[_0xe352('0x13')][_0xe352('0x14')]===0x1f4){logger[_0xe352('0x13')](_0xe352('0xf'),_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x3cfd5b(_0x5b1b22['error'][_0xe352('0x15')]);}logger[_0xe352('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x2bd5e5(_0x5b1b22['error'][_0xe352('0x15')]);}else{logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));_0x2bd5e5(_0x5b1b22[_0xe352('0x16')][_0xe352('0x15')]);}})[_0xe352('0x17')](function(_0x1fede5){logger['error'](_0xe352('0xf'),_0x6549bb,_0x1fede5);_0x3cfd5b(_0x1fede5);});});} \ No newline at end of file +var _0xa0a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x1b9eb9,_0xab354){var _0x21211f=function(_0x2b6d5e){while(--_0x2b6d5e){_0x1b9eb9['push'](_0x1b9eb9['shift']());}};_0x21211f(++_0xab354);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x48a8d9,_0x468f23){_0x48a8d9=_0x48a8d9-0x0;var _0x4838cc=_0xa0a3[_0x48a8d9];return _0x4838cc;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4719d,_0x451873,_0x1766c1){return new BPromise(function(_0x5d98d3,_0x56ee1b){return client[_0x3a0a('0xc')](_0x4719d,_0x1766c1)[_0x3a0a('0xd')](function(_0x29207e){logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));logger[_0x3a0a('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x451873,'request\x20sent',JSON[_0x3a0a('0x12')](_0x29207e));if(_0x29207e[_0x3a0a('0x13')]){if(_0x29207e['error']['code']===0x1f4){logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e['error'][_0x3a0a('0x14')]);return _0x56ee1b(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);return _0x5d98d3(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}else{logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));_0x5d98d3(_0x29207e[_0x3a0a('0x15')][_0x3a0a('0x14')]);}})['catch'](function(_0x41a6b0){logger['error'](_0x3a0a('0xf'),_0x451873,_0x41a6b0);_0x56ee1b(_0x41a6b0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 1a4f13c..681aae9 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 _0x4a47=['get','isAuthenticated','index','post','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4a47,0x15e));var _0x74a4=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x4a47[_0x1d9163];return _0xb42197;};'use strict';var multer=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var path=require(_0x74a4('0x2'));var timeout=require(_0x74a4('0x3'));var express=require(_0x74a4('0x4'));var router=express[_0x74a4('0x5')]();var fs_extra=require(_0x74a4('0x6'));var auth=require(_0x74a4('0x7'));var interaction=require(_0x74a4('0x8'));var config=require(_0x74a4('0x9'));var controller=require('./intDeskField.controller');router[_0x74a4('0xa')]('/',auth[_0x74a4('0xb')](),controller[_0x74a4('0xc')]);router[_0x74a4('0xa')]('/:id',auth[_0x74a4('0xb')](),controller['show']);router[_0x74a4('0xd')]('/',auth[_0x74a4('0xb')](),controller['create']);router[_0x74a4('0xe')](_0x74a4('0xf'),auth['isAuthenticated'](),controller[_0x74a4('0x10')]);router['delete'](_0x74a4('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x74a4('0x11')]=router; \ No newline at end of file +var _0x0aaa=['isAuthenticated','get','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x0aaa,0x160));var _0xa0aa=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x0aaa[_0x5f6a8a];return _0x2cce4d;};'use strict';var multer=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0aa('0x2'));var router=express[_0xa0aa('0x3')]();var fs_extra=require(_0xa0aa('0x4'));var auth=require(_0xa0aa('0x5'));var interaction=require(_0xa0aa('0x6'));var config=require(_0xa0aa('0x7'));var controller=require(_0xa0aa('0x8'));router['get']('/',auth[_0xa0aa('0x9')](),controller['index']);router[_0xa0aa('0xa')]('/:id',auth[_0xa0aa('0x9')](),controller['show']);router[_0xa0aa('0xb')]('/',auth[_0xa0aa('0x9')](),controller[_0xa0aa('0xc')]);router[_0xa0aa('0xd')](_0xa0aa('0xe'),auth[_0xa0aa('0x9')](),controller[_0xa0aa('0xf')]);router[_0xa0aa('0x10')](_0xa0aa('0xe'),auth['isAuthenticated'](),controller[_0xa0aa('0x11')]);module[_0xa0aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f1c21d3..d89ff37 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 _0xf674=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x32df18,_0x36d040){var _0x42cd3b=function(_0x55b83d){while(--_0x55b83d){_0x32df18['push'](_0x32df18['shift']());}};_0x42cd3b(++_0x36d040);}(_0xf674,0x125));var _0x4f67=function(_0x476c6c,_0x434db8){_0x476c6c=_0x476c6c-0x0;var _0xbb94db=_0xf674[_0x476c6c];return _0xbb94db;};'use strict';var Sequelize=require('sequelize');module[_0x4f67('0x0')]={'type':{'type':Sequelize[_0x4f67('0x1')](_0x4f67('0x2'),_0x4f67('0x3'),_0x4f67('0x4'),_0x4f67('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4f67('0x6')]},'keyType':{'type':Sequelize[_0x4f67('0x1')](_0x4f67('0x2'),_0x4f67('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4f67('0x6')]},'idField':{'type':Sequelize[_0x4f67('0x6')]},'nameField':{'type':Sequelize[_0x4f67('0x6')]},'customField':{'type':Sequelize[_0x4f67('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f67('0x6')]}}; \ No newline at end of file +var _0x96f1=['sequelize','exports','ENUM','string','picklist','STRING','variable','customVariable','BOOLEAN'];(function(_0xc24576,_0x1a3e40){var _0x2b0f61=function(_0x522b28){while(--_0x522b28){_0xc24576['push'](_0xc24576['shift']());}};_0x2b0f61(++_0x1a3e40);}(_0x96f1,0x1ef));var _0x196f=function(_0x412a94,_0x4d87c5){_0x412a94=_0x412a94-0x0;var _0x231198=_0x96f1[_0x412a94];return _0x231198;};'use strict';var Sequelize=require(_0x196f('0x0'));module[_0x196f('0x1')]={'type':{'type':Sequelize[_0x196f('0x2')](_0x196f('0x3'),'variable','customVariable','keyValue',_0x196f('0x4')),'defaultValue':_0x196f('0x3')},'content':{'type':Sequelize[_0x196f('0x5')]},'key':{'type':Sequelize[_0x196f('0x5')]},'keyType':{'type':Sequelize[_0x196f('0x2')](_0x196f('0x3'),_0x196f('0x6'),_0x196f('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x196f('0x5')]},'nameField':{'type':Sequelize[_0x196f('0x5')]},'customField':{'type':Sequelize[_0x196f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x196f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c52fa5b..d77323f 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 _0xf06c=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','then','destroy','sendStatus','name','send','index','DeskField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','papaparse'];(function(_0x309269,_0xf0edf8){var _0x133f1c=function(_0x3b0218){while(--_0x3b0218){_0x309269['push'](_0x309269['shift']());}};_0x133f1c(++_0xf0edf8);}(_0xf06c,0xc7));var _0xcf06=function(_0x325be2,_0x4a3e19){_0x325be2=_0x325be2-0x0;var _0x54986c=_0xf06c[_0x325be2];return _0x54986c;};'use strict';var emlformat=require(_0xcf06('0x0'));var rimraf=require(_0xcf06('0x1'));var zipdir=require(_0xcf06('0x2'));var jsonpatch=require(_0xcf06('0x3'));var rp=require(_0xcf06('0x4'));var moment=require('moment');var BPromise=require(_0xcf06('0x5'));var Mustache=require(_0xcf06('0x6'));var util=require(_0xcf06('0x7'));var path=require('path');var sox=require(_0xcf06('0x8'));var csv=require(_0xcf06('0x9'));var ejs=require(_0xcf06('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf06('0xb'));var squel=require('squel');var crypto=require(_0xcf06('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf06('0xd'));var Redis=require(_0xcf06('0xe'));var authService=require(_0xcf06('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf06('0x10'));var logger=require('../../config/logger')(_0xcf06('0x11'));var utils=require('../../config/utils');var config=require(_0xcf06('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf06('0x13'))['db'];function respondWithStatusCode(_0x570965,_0x2aaa5f){_0x2aaa5f=_0x2aaa5f||0xcc;return function(_0x3dc669){if(_0x3dc669){return _0x570965['sendStatus'](_0x2aaa5f);}return _0x570965['status'](_0x2aaa5f)[_0xcf06('0x14')]();};}function respondWithResult(_0x45f66a,_0x2fd686){_0x2fd686=_0x2fd686||0xc8;return function(_0x157689){if(_0x157689){return _0x45f66a['status'](_0x2fd686)[_0xcf06('0x15')](_0x157689);}};}function respondWithFilteredResult(_0x4aa0d,_0x5db932){return function(_0x584d2c){if(_0x584d2c){var _0x15a795=typeof _0x5db932[_0xcf06('0x16')]===_0xcf06('0x17')&&typeof _0x5db932['limit']===_0xcf06('0x17');var _0x18cd3f=_0x584d2c[_0xcf06('0x18')];var _0x569bbf=_0x15a795?0x0:_0x5db932[_0xcf06('0x16')];var _0x2a5ef5=_0x15a795?_0x584d2c[_0xcf06('0x18')]:_0x5db932[_0xcf06('0x16')]+_0x5db932[_0xcf06('0x19')];var _0x48886d;if(_0x2a5ef5>=_0x18cd3f){_0x2a5ef5=_0x18cd3f;_0x48886d=0xc8;}else{_0x48886d=0xce;}_0x4aa0d[_0xcf06('0x1a')](_0x48886d);return _0x4aa0d[_0xcf06('0x1b')](_0xcf06('0x1c'),_0x569bbf+'-'+_0x2a5ef5+'/'+_0x18cd3f)['json'](_0x584d2c);}return null;};}function patchUpdates(_0x465eed){return function(_0x19305d){try{jsonpatch['apply'](_0x19305d,_0x465eed,!![]);}catch(_0x362fcc){return BPromise[_0xcf06('0x1d')](_0x362fcc);}return _0x19305d['save']();};}function saveUpdates(_0x2edadc,_0x132eaa){return function(_0x139b17){if(_0x139b17){return _0x139b17[_0xcf06('0x1e')](_0x2edadc)[_0xcf06('0x1f')](function(_0x13fa04){return _0x13fa04;});}return null;};}function removeEntity(_0xe3304a,_0x26a685){return function(_0xb039dd){if(_0xb039dd){return _0xb039dd[_0xcf06('0x20')]()[_0xcf06('0x1f')](function(){_0xe3304a[_0xcf06('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58840a,_0x87440){return function(_0x27beb7){if(!_0x27beb7){_0x58840a[_0xcf06('0x21')](0x194);}return _0x27beb7;};}function handleError(_0x27cbd9,_0x2e1617){_0x2e1617=_0x2e1617||0x1f4;return function(_0x6c3dcf){logger['error'](_0x6c3dcf['stack']);if(_0x6c3dcf[_0xcf06('0x22')]){delete _0x6c3dcf['name'];}_0x27cbd9[_0xcf06('0x1a')](_0x2e1617)[_0xcf06('0x23')](_0x6c3dcf);};}exports[_0xcf06('0x24')]=function(_0x474bfe,_0x120d0c){var _0x4651f4={},_0x303823={},_0x2b2508={'count':0x0,'rows':[]};var _0x2ec5b7=_['map'](db[_0xcf06('0x25')]['rawAttributes'],function(_0x92666b){return{'name':_0x92666b[_0xcf06('0x26')],'type':_0x92666b[_0xcf06('0x27')][_0xcf06('0x28')]};});_0x303823[_0xcf06('0x29')]=_[_0xcf06('0x2a')](_0x2ec5b7,'name');_0x303823[_0xcf06('0x2b')]=_[_0xcf06('0x2c')](_0x474bfe[_0xcf06('0x2b')]);_0x303823[_0xcf06('0x2d')]=_[_0xcf06('0x2e')](_0x303823[_0xcf06('0x29')],_0x303823[_0xcf06('0x2b')]);_0x4651f4[_0xcf06('0x2f')]=_[_0xcf06('0x2e')](_0x303823[_0xcf06('0x29')],qs['fields'](_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x30')]));_0x4651f4[_0xcf06('0x2f')]=_0x4651f4[_0xcf06('0x2f')][_0xcf06('0x31')]?_0x4651f4[_0xcf06('0x2f')]:_0x303823[_0xcf06('0x29')];if(!_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x32')](_0xcf06('0x33'))){_0x4651f4[_0xcf06('0x19')]=qs['limit'](_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x19')]);_0x4651f4['offset']=qs[_0xcf06('0x16')](_0x474bfe['query'][_0xcf06('0x16')]);}_0x4651f4[_0xcf06('0x34')]=qs[_0xcf06('0x35')](_0x474bfe[_0xcf06('0x2b')]['sort']);_0x4651f4[_0xcf06('0x36')]=qs[_0xcf06('0x2d')](_[_0xcf06('0x37')](_0x474bfe[_0xcf06('0x2b')],_0x303823[_0xcf06('0x2d')]),_0x2ec5b7);if(_0x474bfe['query'][_0xcf06('0x38')]){_0x4651f4[_0xcf06('0x36')]=_[_0xcf06('0x39')](_0x4651f4[_0xcf06('0x36')],{'$or':_[_0xcf06('0x2a')](_0x2ec5b7,function(_0x45ddbf){if(_0x45ddbf[_0xcf06('0x27')]!==_0xcf06('0x3a')){var _0x3e0b3f={};_0x3e0b3f[_0x45ddbf[_0xcf06('0x22')]]={'$like':'%'+_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x38')]+'%'};return _0x3e0b3f;}})});}_0x4651f4=_[_0xcf06('0x39')]({},_0x4651f4,_0x474bfe[_0xcf06('0x3b')]);var _0x446972={'where':_0x4651f4[_0xcf06('0x36')]};return db[_0xcf06('0x25')]['count'](_0x446972)[_0xcf06('0x1f')](function(_0x59b8ed){_0x2b2508[_0xcf06('0x18')]=_0x59b8ed;if(_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x3c')]){_0x4651f4['include']=[{'all':!![]}];}return db[_0xcf06('0x25')][_0xcf06('0x3d')](_0x4651f4);})[_0xcf06('0x1f')](function(_0x38c153){_0x2b2508[_0xcf06('0x3e')]=_0x38c153;return _0x2b2508;})['then'](respondWithFilteredResult(_0x120d0c,_0x4651f4))['catch'](handleError(_0x120d0c,null));};exports[_0xcf06('0x3f')]=function(_0x518c2f,_0x120dae){var _0x40735b={'raw':!![],'where':{'id':_0x518c2f[_0xcf06('0x40')]['id']}},_0x4342e0={};_0x4342e0['model']=_[_0xcf06('0x2c')](db[_0xcf06('0x25')][_0xcf06('0x41')]);_0x4342e0['query']=_[_0xcf06('0x2c')](_0x518c2f['query']);_0x4342e0[_0xcf06('0x2d')]=_['intersection'](_0x4342e0[_0xcf06('0x29')],_0x4342e0['query']);_0x40735b[_0xcf06('0x2f')]=_[_0xcf06('0x2e')](_0x4342e0[_0xcf06('0x29')],qs['fields'](_0x518c2f[_0xcf06('0x2b')][_0xcf06('0x30')]));_0x40735b[_0xcf06('0x2f')]=_0x40735b['attributes'][_0xcf06('0x31')]?_0x40735b['attributes']:_0x4342e0[_0xcf06('0x29')];if(_0x518c2f[_0xcf06('0x2b')][_0xcf06('0x3c')]){_0x40735b[_0xcf06('0x42')]=[{'all':!![]}];}_0x40735b=_['merge']({},_0x40735b,_0x518c2f[_0xcf06('0x3b')]);return db[_0xcf06('0x25')][_0xcf06('0x43')](_0x40735b)['then'](handleEntityNotFound(_0x120dae,null))[_0xcf06('0x1f')](respondWithResult(_0x120dae,null))[_0xcf06('0x44')](handleError(_0x120dae,null));};exports['create']=function(_0xc392e,_0x8a988f){return db[_0xcf06('0x25')][_0xcf06('0x45')](_0xc392e[_0xcf06('0x46')],{})['then'](respondWithResult(_0x8a988f,0xc9))[_0xcf06('0x44')](handleError(_0x8a988f,null));};exports[_0xcf06('0x1e')]=function(_0x453e6e,_0x319314){if(_0x453e6e[_0xcf06('0x46')]['id']){delete _0x453e6e['body']['id'];}return db[_0xcf06('0x25')]['find']({'where':{'id':_0x453e6e[_0xcf06('0x40')]['id']}})[_0xcf06('0x1f')](handleEntityNotFound(_0x319314,null))[_0xcf06('0x1f')](saveUpdates(_0x453e6e[_0xcf06('0x46')],null))[_0xcf06('0x1f')](respondWithResult(_0x319314,null))['catch'](handleError(_0x319314,null));};exports[_0xcf06('0x20')]=function(_0x4e45dd,_0xc32502){return db[_0xcf06('0x25')][_0xcf06('0x43')]({'where':{'id':_0x4e45dd[_0xcf06('0x40')]['id']}})[_0xcf06('0x1f')](handleEntityNotFound(_0xc32502,null))[_0xcf06('0x1f')](removeEntity(_0xc32502,null))['catch'](handleError(_0xc32502,null));}; \ No newline at end of file +var _0xaa3f=['apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','DeskField','include','rows','show','params','includeAll','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x2591ea,_0x456865){_0x2591ea=_0x2591ea-0x0;var _0x1e7abe=_0xaa3f[_0x2591ea];return _0x1e7abe;};'use strict';var emlformat=require(_0xfaa3('0x0'));var rimraf=require(_0xfaa3('0x1'));var zipdir=require(_0xfaa3('0x2'));var jsonpatch=require(_0xfaa3('0x3'));var rp=require(_0xfaa3('0x4'));var moment=require(_0xfaa3('0x5'));var BPromise=require(_0xfaa3('0x6'));var Mustache=require(_0xfaa3('0x7'));var util=require(_0xfaa3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfaa3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfaa3('0xa'));var _=require(_0xfaa3('0xb'));var squel=require(_0xfaa3('0xc'));var crypto=require(_0xfaa3('0xd'));var jsforce=require(_0xfaa3('0xe'));var deskjs=require(_0xfaa3('0xf'));var toCsv=require(_0xfaa3('0x9'));var querystring=require('querystring');var Papa=require(_0xfaa3('0x10'));var Redis=require(_0xfaa3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfaa3('0x12'));var hardwareService=require(_0xfaa3('0x13'));var logger=require(_0xfaa3('0x14'))(_0xfaa3('0x15'));var utils=require(_0xfaa3('0x16'));var config=require(_0xfaa3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaa3('0x18'))['db'];function respondWithStatusCode(_0x5be067,_0x1aa8e8){_0x1aa8e8=_0x1aa8e8||0xcc;return function(_0x2b8935){if(_0x2b8935){return _0x5be067[_0xfaa3('0x19')](_0x1aa8e8);}return _0x5be067['status'](_0x1aa8e8)[_0xfaa3('0x1a')]();};}function respondWithResult(_0x5f121b,_0xdf7551){_0xdf7551=_0xdf7551||0xc8;return function(_0x84b465){if(_0x84b465){return _0x5f121b[_0xfaa3('0x1b')](_0xdf7551)[_0xfaa3('0x1c')](_0x84b465);}};}function respondWithFilteredResult(_0x1243ed,_0x40831f){return function(_0x4da250){if(_0x4da250){var _0x5f47dd=typeof _0x40831f[_0xfaa3('0x1d')]===_0xfaa3('0x1e')&&typeof _0x40831f[_0xfaa3('0x1f')]===_0xfaa3('0x1e');var _0x4e54e4=_0x4da250['count'];var _0x50f121=_0x5f47dd?0x0:_0x40831f['offset'];var _0x499148=_0x5f47dd?_0x4da250[_0xfaa3('0x20')]:_0x40831f['offset']+_0x40831f[_0xfaa3('0x1f')];var _0x42846e;if(_0x499148>=_0x4e54e4){_0x499148=_0x4e54e4;_0x42846e=0xc8;}else{_0x42846e=0xce;}_0x1243ed[_0xfaa3('0x1b')](_0x42846e);return _0x1243ed[_0xfaa3('0x21')](_0xfaa3('0x22'),_0x50f121+'-'+_0x499148+'/'+_0x4e54e4)[_0xfaa3('0x1c')](_0x4da250);}return null;};}function patchUpdates(_0x1dd053){return function(_0x1ab9cc){try{jsonpatch[_0xfaa3('0x23')](_0x1ab9cc,_0x1dd053,!![]);}catch(_0x39e91e){return BPromise['reject'](_0x39e91e);}return _0x1ab9cc[_0xfaa3('0x24')]();};}function saveUpdates(_0x755038,_0x26d9ef){return function(_0x42b214){if(_0x42b214){return _0x42b214['update'](_0x755038)[_0xfaa3('0x25')](function(_0x2d4087){return _0x2d4087;});}return null;};}function removeEntity(_0x2f077c,_0x22156a){return function(_0x16a3e3){if(_0x16a3e3){return _0x16a3e3[_0xfaa3('0x26')]()[_0xfaa3('0x25')](function(){_0x2f077c[_0xfaa3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe075fc,_0x2a1ace){return function(_0x699e72){if(!_0x699e72){_0xe075fc[_0xfaa3('0x19')](0x194);}return _0x699e72;};}function handleError(_0x31c5cd,_0xf83bbe){_0xf83bbe=_0xf83bbe||0x1f4;return function(_0x2416fe){logger[_0xfaa3('0x27')](_0x2416fe[_0xfaa3('0x28')]);if(_0x2416fe[_0xfaa3('0x29')]){delete _0x2416fe[_0xfaa3('0x29')];}_0x31c5cd[_0xfaa3('0x1b')](_0xf83bbe)[_0xfaa3('0x2a')](_0x2416fe);};}exports[_0xfaa3('0x2b')]=function(_0x2d7c43,_0x5b84cd){var _0x230430={},_0x104343={},_0xc2e71={'count':0x0,'rows':[]};var _0x54bc09=_[_0xfaa3('0x2c')](db['DeskField'][_0xfaa3('0x2d')],function(_0x5d37bb){return{'name':_0x5d37bb[_0xfaa3('0x2e')],'type':_0x5d37bb[_0xfaa3('0x2f')][_0xfaa3('0x30')]};});_0x104343[_0xfaa3('0x31')]=_[_0xfaa3('0x2c')](_0x54bc09,_0xfaa3('0x29'));_0x104343[_0xfaa3('0x32')]=_[_0xfaa3('0x33')](_0x2d7c43['query']);_0x104343[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],_0x104343[_0xfaa3('0x32')]);_0x230430[_0xfaa3('0x36')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x230430[_0xfaa3('0x36')]=_0x230430[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x230430[_0xfaa3('0x36')]:_0x104343[_0xfaa3('0x31')];if(!_0x2d7c43[_0xfaa3('0x32')]['hasOwnProperty'](_0xfaa3('0x39'))){_0x230430[_0xfaa3('0x1f')]=qs[_0xfaa3('0x1f')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x1f')]);_0x230430[_0xfaa3('0x1d')]=qs[_0xfaa3('0x1d')](_0x2d7c43[_0xfaa3('0x32')]['offset']);}_0x230430[_0xfaa3('0x3a')]=qs[_0xfaa3('0x3b')](_0x2d7c43[_0xfaa3('0x32')]['sort']);_0x230430[_0xfaa3('0x3c')]=qs[_0xfaa3('0x34')](_['pick'](_0x2d7c43[_0xfaa3('0x32')],_0x104343[_0xfaa3('0x34')]),_0x54bc09);if(_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x3d')]){_0x230430[_0xfaa3('0x3c')]=_[_0xfaa3('0x3e')](_0x230430['where'],{'$or':_['map'](_0x54bc09,function(_0x41498d){if(_0x41498d[_0xfaa3('0x2f')]!=='VIRTUAL'){var _0x4ae1c3={};_0x4ae1c3[_0x41498d[_0xfaa3('0x29')]]={'$like':'%'+_0x2d7c43['query'][_0xfaa3('0x3d')]+'%'};return _0x4ae1c3;}})});}_0x230430=_[_0xfaa3('0x3e')]({},_0x230430,_0x2d7c43[_0xfaa3('0x3f')]);var _0x3fb71d={'where':_0x230430[_0xfaa3('0x3c')]};return db[_0xfaa3('0x40')][_0xfaa3('0x20')](_0x3fb71d)[_0xfaa3('0x25')](function(_0x551cd5){_0xc2e71['count']=_0x551cd5;if(_0x2d7c43['query']['includeAll']){_0x230430[_0xfaa3('0x41')]=[{'all':!![]}];}return db[_0xfaa3('0x40')]['findAll'](_0x230430);})[_0xfaa3('0x25')](function(_0xa83a03){_0xc2e71[_0xfaa3('0x42')]=_0xa83a03;return _0xc2e71;})['then'](respondWithFilteredResult(_0x5b84cd,_0x230430))['catch'](handleError(_0x5b84cd,null));};exports[_0xfaa3('0x43')]=function(_0x4c19fc,_0x1701bc){var _0x57b77c={'raw':!![],'where':{'id':_0x4c19fc[_0xfaa3('0x44')]['id']}},_0x59b4d7={};_0x59b4d7[_0xfaa3('0x31')]=_['keys'](db[_0xfaa3('0x40')]['rawAttributes']);_0x59b4d7[_0xfaa3('0x32')]=_['keys'](_0x4c19fc[_0xfaa3('0x32')]);_0x59b4d7[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x59b4d7['model'],_0x59b4d7[_0xfaa3('0x32')]);_0x57b77c[_0xfaa3('0x36')]=_['intersection'](_0x59b4d7[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x4c19fc[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x57b77c['attributes']=_0x57b77c[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x57b77c['attributes']:_0x59b4d7[_0xfaa3('0x31')];if(_0x4c19fc['query'][_0xfaa3('0x45')]){_0x57b77c[_0xfaa3('0x41')]=[{'all':!![]}];}_0x57b77c=_[_0xfaa3('0x3e')]({},_0x57b77c,_0x4c19fc['options']);return db[_0xfaa3('0x40')]['find'](_0x57b77c)['then'](handleEntityNotFound(_0x1701bc,null))[_0xfaa3('0x25')](respondWithResult(_0x1701bc,null))[_0xfaa3('0x46')](handleError(_0x1701bc,null));};exports[_0xfaa3('0x47')]=function(_0x27feb6,_0x1a4fa4){return db[_0xfaa3('0x40')][_0xfaa3('0x47')](_0x27feb6['body'],{})[_0xfaa3('0x25')](respondWithResult(_0x1a4fa4,0xc9))[_0xfaa3('0x46')](handleError(_0x1a4fa4,null));};exports[_0xfaa3('0x48')]=function(_0x72f502,_0x431725){if(_0x72f502[_0xfaa3('0x49')]['id']){delete _0x72f502[_0xfaa3('0x49')]['id'];}return db['DeskField']['find']({'where':{'id':_0x72f502['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x431725,null))[_0xfaa3('0x25')](saveUpdates(_0x72f502[_0xfaa3('0x49')],null))[_0xfaa3('0x25')](respondWithResult(_0x431725,null))['catch'](handleError(_0x431725,null));};exports[_0xfaa3('0x26')]=function(_0x50336d,_0x513d3e){return db['DeskField']['find']({'where':{'id':_0x50336d['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x513d3e,null))[_0xfaa3('0x25')](removeEntity(_0x513d3e,null))[_0xfaa3('0x46')](handleError(_0x513d3e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e70713c..100fd39 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 _0x4beb=['api','bluebird','request-promise','path','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','../../config/logger'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x4beb,0xbf));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4be('0x0'))(_0xb4be('0x1'));var moment=require('moment');var BPromise=require(_0xb4be('0x2'));var rp=require(_0xb4be('0x3'));var fs=require('fs');var path=require(_0xb4be('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4be('0x5'));module[_0xb4be('0x6')]=function(_0x91226e,_0x3c2ef1){return _0x91226e[_0xb4be('0x7')](_0xb4be('0x8'),attributes,{'tableName':_0xb4be('0x9'),'paranoid':![],'indexes':[{'name':_0xb4be('0xa'),'fields':['idField',_0xb4be('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd125=['define','DeskField','int_desk_fields','desk_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x1ce0c8,_0x1bf13a){var _0x194f0d=function(_0x275093){while(--_0x275093){_0x1ce0c8['push'](_0x1ce0c8['shift']());}};_0x194f0d(++_0x1bf13a);}(_0xd125,0xad));var _0x5d12=function(_0xe91569,_0x459734){_0xe91569=_0xe91569-0x0;var _0x2c17a7=_0xd125[_0xe91569];return _0x2c17a7;};'use strict';var _=require('lodash');var util=require(_0x5d12('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5d12('0x1'));var BPromise=require(_0x5d12('0x2'));var rp=require(_0x5d12('0x3'));var fs=require('fs');var path=require(_0x5d12('0x4'));var rimraf=require(_0x5d12('0x5'));var config=require(_0x5d12('0x6'));var attributes=require(_0x5d12('0x7'));module[_0x5d12('0x8')]=function(_0x2d8be1,_0x245fac){return _0x2d8be1[_0x5d12('0x9')](_0x5d12('0xa'),attributes,{'tableName':_0x5d12('0xb'),'paranoid':![],'indexes':[{'name':_0x5d12('0xc'),'fields':[_0x5d12('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 687ce16..cf5eeea 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 _0xb065=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xb065,0x10c));var _0x5b06=function(_0x1c6179,_0x22db86){_0x1c6179=_0x1c6179-0x0;var _0x19a57b=_0xb065[_0x1c6179];return _0x19a57b;};'use strict';var _=require(_0x5b06('0x0'));var util=require(_0x5b06('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b06('0x2'));var fs=require('fs');var Redis=require(_0x5b06('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b06('0x4'))(_0x5b06('0x5'));var config=require('../../config/environment');var jayson=require(_0x5b06('0x6'));var client=jayson[_0x5b06('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x391743,_0x3a6942,_0x2cb88f){return new BPromise(function(_0x234dac,_0x5e0e1e){return client[_0x5b06('0x8')](_0x391743,_0x2cb88f)[_0x5b06('0x9')](function(_0xfd3727){logger[_0x5b06('0xa')](_0x5b06('0xb'),_0x3a6942,_0x5b06('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x3a6942,_0x5b06('0xc'),JSON[_0x5b06('0xd')](_0xfd3727));if(_0xfd3727[_0x5b06('0xe')]){if(_0xfd3727[_0x5b06('0xe')][_0x5b06('0xf')]===0x1f4){logger[_0x5b06('0xe')](_0x5b06('0xb'),_0x3a6942,_0xfd3727[_0x5b06('0xe')][_0x5b06('0x10')]);return _0x5e0e1e(_0xfd3727[_0x5b06('0xe')]['message']);}logger['error'](_0x5b06('0xb'),_0x3a6942,_0xfd3727[_0x5b06('0xe')][_0x5b06('0x10')]);return _0x234dac(_0xfd3727[_0x5b06('0xe')][_0x5b06('0x10')]);}else{logger[_0x5b06('0xa')](_0x5b06('0xb'),_0x3a6942,_0x5b06('0xc'));_0x234dac(_0xfd3727['result'][_0x5b06('0x10')]);}})[_0x5b06('0x11')](function(_0x2cd6fd){logger[_0x5b06('0xe')](_0x5b06('0xb'),_0x3a6942,_0x2cd6fd);_0x5e0e1e(_0x2cd6fd);});});} \ No newline at end of file +var _0xd11d=['jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd11d,0x1c6));var _0xdd11=function(_0x5d5168,_0x4aa384){_0x5d5168=_0x5d5168-0x0;var _0x379644=_0xd11d[_0x5d5168];return _0x379644;};'use strict';var _=require(_0xdd11('0x0'));var util=require(_0xdd11('0x1'));var moment=require(_0xdd11('0x2'));var BPromise=require(_0xdd11('0x3'));var rs=require(_0xdd11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd11('0x5'));var logger=require(_0xdd11('0x6'))(_0xdd11('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd11('0x8'));var client=jayson[_0xdd11('0x9')][_0xdd11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ffeee,_0x28f4be,_0x5368ea){return new BPromise(function(_0x487a5f,_0x27a727){return client[_0xdd11('0xb')](_0x3ffeee,_0x5368ea)['then'](function(_0x4878b7){logger[_0xdd11('0xc')](_0xdd11('0xd'),_0x28f4be,_0xdd11('0xe'));logger[_0xdd11('0xf')](_0xdd11('0x10'),_0x28f4be,_0xdd11('0xe'),JSON[_0xdd11('0x11')](_0x4878b7));if(_0x4878b7[_0xdd11('0x12')]){if(_0x4878b7[_0xdd11('0x12')][_0xdd11('0x13')]===0x1f4){logger[_0xdd11('0x12')](_0xdd11('0xd'),_0x28f4be,_0x4878b7[_0xdd11('0x12')][_0xdd11('0x14')]);return _0x27a727(_0x4878b7['error']['message']);}logger[_0xdd11('0x12')]('DeskField,\x20%s,\x20%s',_0x28f4be,_0x4878b7[_0xdd11('0x12')][_0xdd11('0x14')]);return _0x487a5f(_0x4878b7[_0xdd11('0x12')]['message']);}else{logger[_0xdd11('0xc')](_0xdd11('0xd'),_0x28f4be,_0xdd11('0xe'));_0x487a5f(_0x4878b7[_0xdd11('0x15')]['message']);}})['catch'](function(_0x17f3ba){logger[_0xdd11('0x12')](_0xdd11('0xd'),_0x28f4be,_0x17f3ba);_0x27a727(_0x17f3ba);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8ffe05f..5d3559c 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 _0xa112=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete','destroy','multer'];(function(_0x1d8bd3,_0x4776bd){var _0x119c35=function(_0x3ea2e5){while(--_0x3ea2e5){_0x1d8bd3['push'](_0x1d8bd3['shift']());}};_0x119c35(++_0x4776bd);}(_0xa112,0x1e3));var _0x2a11=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xa112[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x2a11('0x0'));var util=require(_0x2a11('0x1'));var path=require(_0x2a11('0x2'));var timeout=require(_0x2a11('0x3'));var express=require(_0x2a11('0x4'));var router=express['Router']();var fs_extra=require(_0x2a11('0x5'));var auth=require(_0x2a11('0x6'));var interaction=require(_0x2a11('0x7'));var config=require(_0x2a11('0x8'));var controller=require(_0x2a11('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2a11('0xa')](_0x2a11('0xb'),auth[_0x2a11('0xc')](),controller['show']);router['get'](_0x2a11('0xd'),auth[_0x2a11('0xc')](),controller[_0x2a11('0xe')]);router[_0x2a11('0xa')](_0x2a11('0xf'),auth[_0x2a11('0xc')](),controller[_0x2a11('0x10')]);router['post']('/',auth[_0x2a11('0xc')](),controller['create']);router['post']('/:id/configurations',auth[_0x2a11('0xc')](),controller[_0x2a11('0x11')]);router[_0x2a11('0x12')](_0x2a11('0xb'),auth[_0x2a11('0xc')](),controller[_0x2a11('0x13')]);router[_0x2a11('0x14')](_0x2a11('0xb'),auth[_0x2a11('0xc')](),controller[_0x2a11('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0eca=['post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x231a72,_0x2f2a5d){var _0x3efa64=function(_0x3a4a85){while(--_0x3a4a85){_0x231a72['push'](_0x231a72['shift']());}};_0x3efa64(++_0x2f2a5d);}(_0x0eca,0x1c9));var _0xa0ec=function(_0x490d29,_0x5c227f){_0x490d29=_0x490d29-0x0;var _0x5cd549=_0x0eca[_0x490d29];return _0x5cd549;};'use strict';var multer=require(_0xa0ec('0x0'));var util=require(_0xa0ec('0x1'));var path=require(_0xa0ec('0x2'));var timeout=require(_0xa0ec('0x3'));var express=require(_0xa0ec('0x4'));var router=express[_0xa0ec('0x5')]();var fs_extra=require(_0xa0ec('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa0ec('0x7'));var config=require(_0xa0ec('0x8'));var controller=require(_0xa0ec('0x9'));router[_0xa0ec('0xa')]('/',auth[_0xa0ec('0xb')](),controller[_0xa0ec('0xc')]);router['get'](_0xa0ec('0xd'),auth[_0xa0ec('0xb')](),controller[_0xa0ec('0xe')]);router[_0xa0ec('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa0ec('0xf')]);router[_0xa0ec('0xa')](_0xa0ec('0x10'),auth[_0xa0ec('0xb')](),controller[_0xa0ec('0x11')]);router[_0xa0ec('0x12')]('/',auth[_0xa0ec('0xb')](),controller[_0xa0ec('0x13')]);router[_0xa0ec('0x12')]('/:id/configurations',auth[_0xa0ec('0xb')](),controller[_0xa0ec('0x14')]);router['put'](_0xa0ec('0xd'),auth[_0xa0ec('0xb')](),controller[_0xa0ec('0x15')]);router[_0xa0ec('0x16')](_0xa0ec('0xd'),auth[_0xa0ec('0xb')](),controller[_0xa0ec('0x17')]);module[_0xa0ec('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 03d6980..a9d5292 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 _0x04e7=['BOOLEAN','sequelize','exports','STRING'];(function(_0xd362e8,_0x1e097c){var _0x19dc42=function(_0x9a735c){while(--_0x9a735c){_0xd362e8['push'](_0xd362e8['shift']());}};_0x19dc42(++_0x1e097c);}(_0x04e7,0x121));var _0x704e=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x04e7[_0x155c64];return _0x1f154a;};'use strict';var Sequelize=require(_0x704e('0x0'));module[_0x704e('0x1')]={'name':{'type':Sequelize[_0x704e('0x2')]},'username':{'type':Sequelize[_0x704e('0x2')]},'password':{'type':Sequelize[_0x704e('0x2')]},'remoteUri':{'type':Sequelize[_0x704e('0x2')]},'tenantId':{'type':Sequelize[_0x704e('0x2')]},'clientId':{'type':Sequelize[_0x704e('0x2')]},'clientSecret':{'type':Sequelize[_0x704e('0x2')]},'serverUrl':{'type':Sequelize[_0x704e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x704e('0x2')]},'modernAuthentication':{'type':Sequelize[_0x704e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x29eb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0x29eb,0x1c5));var _0xb29e=function(_0x49e741,_0x5f5836){_0x49e741=_0x49e741-0x0;var _0x6c78c3=_0x29eb[_0x49e741];return _0x6c78c3;};'use strict';var Sequelize=require(_0xb29e('0x0'));module[_0xb29e('0x1')]={'name':{'type':Sequelize[_0xb29e('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb29e('0x2')]},'remoteUri':{'type':Sequelize[_0xb29e('0x2')]},'tenantId':{'type':Sequelize[_0xb29e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb29e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb29e('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb29e('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 f01b493..2540173 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 _0x1f8f=['clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','MetadataId','Bearer\x20','4.0','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId'];(function(_0x5d98f2,_0x56353d){var _0x109152=function(_0x31a34c){while(--_0x31a34c){_0x5d98f2['push'](_0x5d98f2['shift']());}};_0x109152(++_0x56353d);}(_0x1f8f,0x19c));var _0xf1f8=function(_0x558799,_0x2735b9){_0x558799=_0x558799-0x0;var _0x238ce6=_0x1f8f[_0x558799];return _0x238ce6;};'use strict';var rp=require(_0xf1f8('0x0'));var util=require(_0xf1f8('0x1'));var _=require('lodash');var qs=require(_0xf1f8('0x2'));var logger=require(_0xf1f8('0x3'))(_0xf1f8('0x4'));var db=require(_0xf1f8('0x5'))['db'];var integrations=require(_0xf1f8('0x6'));function respondWithResult(_0x2bc927,_0x5dda04){_0x5dda04=_0x5dda04||0xc8;return function(_0x2a7b94){if(_0x2a7b94){return _0x2bc927['status'](_0x5dda04)[_0xf1f8('0x7')](_0x2a7b94);}};}function respondWithFilteredResult(_0x112def,_0x4c96f6){return function(_0x494fce){if(_0x494fce){var _0xee2940=typeof _0x4c96f6[_0xf1f8('0x8')]===_0xf1f8('0x9')&&typeof _0x4c96f6[_0xf1f8('0xa')]===_0xf1f8('0x9');var _0x32bc61=_0x494fce[_0xf1f8('0xb')];var _0xb6f811=_0xee2940?0x0:_0x4c96f6[_0xf1f8('0x8')];var _0x4d7eba=_0xee2940?_0x494fce[_0xf1f8('0xb')]:_0x4c96f6[_0xf1f8('0x8')]+_0x4c96f6[_0xf1f8('0xa')];var _0x2fbdcf;if(_0x4d7eba>=_0x32bc61){_0x4d7eba=_0x32bc61;_0x2fbdcf=0xc8;}else{_0x2fbdcf=0xce;}_0x112def[_0xf1f8('0xc')](_0x2fbdcf);return _0x112def[_0xf1f8('0xd')](_0xf1f8('0xe'),_0xb6f811+'-'+_0x4d7eba+'/'+_0x32bc61)[_0xf1f8('0x7')](_0x494fce);}return null;};}function saveUpdates(_0x3ae1b2){return function(_0x37d42e){if(_0x37d42e){return _0x37d42e[_0xf1f8('0xf')](_0x3ae1b2)['then'](function(_0x347435){return _0x347435;});}return null;};}function removeEntity(_0x1d66f7){return function(_0x1a2d7f){if(_0x1a2d7f){return _0x1a2d7f[_0xf1f8('0x10')]()[_0xf1f8('0x11')](function(){_0x1d66f7[_0xf1f8('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a30d){return function(_0x4378da){if(!_0x4378da){_0x51a30d['sendStatus'](0x194);}return _0x4378da;};}function handleError(_0x10387f,_0x222155){_0x222155=_0x222155||0x1f4;return function(_0x4e5b9d){logger['error'](_0x4e5b9d[_0xf1f8('0x12')]);if(_0x4e5b9d['name']){delete _0x4e5b9d[_0xf1f8('0x13')];}_0x10387f[_0xf1f8('0xc')](_0x222155)[_0xf1f8('0x14')](_0x4e5b9d);};}exports['index']=function(_0xd8761c,_0x4cc6fe){var _0x2f44d4={},_0x16d13c={},_0x1609e8={'count':0x0,'rows':[]};var _0x439bd4=_[_0xf1f8('0x15')](db[_0xf1f8('0x16')][_0xf1f8('0x17')],function(_0x556b51){return{'name':_0x556b51[_0xf1f8('0x18')],'type':_0x556b51['type'][_0xf1f8('0x19')]};});_0x16d13c[_0xf1f8('0x1a')]=_[_0xf1f8('0x15')](_0x439bd4,_0xf1f8('0x13'));_0x16d13c[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0xd8761c['query']);_0x16d13c[_0xf1f8('0x1d')]=_['intersection'](_0x16d13c[_0xf1f8('0x1a')],_0x16d13c[_0xf1f8('0x1b')]);_0x2f44d4[_0xf1f8('0x1e')]=_[_0xf1f8('0x1f')](_0x16d13c[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x20')]));_0x2f44d4['attributes']=_0x2f44d4[_0xf1f8('0x1e')][_0xf1f8('0x21')]?_0x2f44d4[_0xf1f8('0x1e')]:_0x16d13c[_0xf1f8('0x1a')];if(!_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x22')](_0xf1f8('0x23'))){_0x2f44d4['limit']=qs[_0xf1f8('0xa')](_0xd8761c['query'][_0xf1f8('0xa')]);_0x2f44d4[_0xf1f8('0x8')]=qs[_0xf1f8('0x8')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x8')]);}_0x2f44d4[_0xf1f8('0x24')]=qs[_0xf1f8('0x25')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x25')]);_0x2f44d4['where']=qs[_0xf1f8('0x1d')](_[_0xf1f8('0x26')](_0xd8761c[_0xf1f8('0x1b')],_0x16d13c['filters']),_0x439bd4);if(_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x27')]){_0x2f44d4[_0xf1f8('0x28')]=_['merge'](_0x2f44d4[_0xf1f8('0x28')],{'$or':_[_0xf1f8('0x15')](_0x439bd4,function(_0x31b4de){if(_0x31b4de[_0xf1f8('0x29')]!==_0xf1f8('0x2a')){var _0x37a7dc={};_0x37a7dc[_0x31b4de[_0xf1f8('0x13')]]={'$like':'%'+_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x27')]+'%'};return _0x37a7dc;}})});}_0x2f44d4=_[_0xf1f8('0x2b')]({},_0x2f44d4,_0xd8761c['options']);var _0x1c4c32={'where':_0x2f44d4['where']};return db[_0xf1f8('0x16')][_0xf1f8('0xb')](_0x1c4c32)[_0xf1f8('0x11')](function(_0x13329f){_0x1609e8[_0xf1f8('0xb')]=_0x13329f;if(_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x2c')]){_0x2f44d4[_0xf1f8('0x2d')]=[{'all':!![]}];}return db[_0xf1f8('0x16')][_0xf1f8('0x2e')](_0x2f44d4);})['then'](function(_0x1982be){_0x1609e8[_0xf1f8('0x2f')]=_0x1982be;return _0x1609e8;})['then'](respondWithFilteredResult(_0x4cc6fe,_0x2f44d4))[_0xf1f8('0x30')](handleError(_0x4cc6fe,null));};exports['show']=function(_0x2f6499,_0x4d9256){var _0x5ee1bc={'raw':![],'where':{'id':_0x2f6499[_0xf1f8('0x31')]['id']}},_0x3845b6={};_0x3845b6['model']=_['keys'](db[_0xf1f8('0x16')][_0xf1f8('0x17')]);_0x3845b6[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0x2f6499[_0xf1f8('0x1b')]);_0x3845b6[_0xf1f8('0x1d')]=_[_0xf1f8('0x1f')](_0x3845b6[_0xf1f8('0x1a')],_0x3845b6[_0xf1f8('0x1b')]);_0x5ee1bc[_0xf1f8('0x1e')]=_[_0xf1f8('0x1f')](_0x3845b6[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0x2f6499[_0xf1f8('0x1b')]['fields']));_0x5ee1bc['attributes']=_0x5ee1bc[_0xf1f8('0x1e')][_0xf1f8('0x21')]?_0x5ee1bc[_0xf1f8('0x1e')]:_0x3845b6[_0xf1f8('0x1a')];if(_0x2f6499['query']['includeAll']){_0x5ee1bc[_0xf1f8('0x2d')]=[{'all':!![]}];}_0x5ee1bc=_[_0xf1f8('0x2b')]({},_0x5ee1bc,_0x2f6499[_0xf1f8('0x32')]);return db[_0xf1f8('0x16')][_0xf1f8('0x33')](_0x5ee1bc)[_0xf1f8('0x11')](handleEntityNotFound(_0x4d9256,null))[_0xf1f8('0x11')](respondWithResult(_0x4d9256,null))[_0xf1f8('0x30')](handleError(_0x4d9256,null));};exports[_0xf1f8('0x34')]=function(_0x26a033,_0x32e85c){return db[_0xf1f8('0x16')][_0xf1f8('0x34')](_0x26a033[_0xf1f8('0x35')],{})[_0xf1f8('0x11')](respondWithResult(_0x32e85c,0xc9))[_0xf1f8('0x30')](handleError(_0x32e85c,null));};exports['update']=function(_0x5f1ba7,_0x2a0380){if(_0x5f1ba7[_0xf1f8('0x35')]['id']){delete _0x5f1ba7['body']['id'];}return db['Dynamics365Account'][_0xf1f8('0x33')]({'where':{'id':_0x5f1ba7[_0xf1f8('0x31')]['id']}})['then'](handleEntityNotFound(_0x2a0380,null))['then'](saveUpdates(_0x5f1ba7[_0xf1f8('0x35')],null))['then'](respondWithResult(_0x2a0380,null))[_0xf1f8('0x30')](handleError(_0x2a0380,null));};exports['destroy']=function(_0x98b9ab,_0x50d5b6){return db['Dynamics365Account']['find']({'where':{'id':_0x98b9ab[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x50d5b6,null))['then'](removeEntity(_0x50d5b6,null))[_0xf1f8('0x30')](handleError(_0x50d5b6,null));};exports[_0xf1f8('0x36')]=function(_0x3ba07e,_0x3f7e54){var _0x26cef6={};var _0x445fc1={};var _0x2d4dc7;var _0x458f70;return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x3ba07e[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x3f7e54,null))[_0xf1f8('0x11')](function(_0x577f9e){if(_0x577f9e){_0x2d4dc7=_0x577f9e;_0x445fc1[_0xf1f8('0x1a')]=_['keys'](db[_0xf1f8('0x38')][_0xf1f8('0x17')]);_0x445fc1[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0x3ba07e[_0xf1f8('0x1b')]);_0x445fc1[_0xf1f8('0x1d')]=_[_0xf1f8('0x1f')](_0x445fc1[_0xf1f8('0x1a')],_0x445fc1[_0xf1f8('0x1b')]);_0x26cef6['attributes']=_[_0xf1f8('0x1f')](_0x445fc1[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0x3ba07e[_0xf1f8('0x1b')][_0xf1f8('0x20')]));_0x26cef6[_0xf1f8('0x1e')]=_0x26cef6[_0xf1f8('0x1e')]['length']?_0x26cef6[_0xf1f8('0x1e')]:_0x445fc1[_0xf1f8('0x1a')];_0x26cef6[_0xf1f8('0x24')]=qs[_0xf1f8('0x25')](_0x3ba07e['query'][_0xf1f8('0x25')]);_0x26cef6['where']=qs[_0xf1f8('0x1d')](_[_0xf1f8('0x26')](_0x3ba07e[_0xf1f8('0x1b')],_0x445fc1[_0xf1f8('0x1d')]));if(_0x3ba07e[_0xf1f8('0x1b')]['filter']){_0x26cef6[_0xf1f8('0x28')]=_[_0xf1f8('0x2b')](_0x26cef6[_0xf1f8('0x28')],{'$or':_['map'](_0x26cef6[_0xf1f8('0x1e')],function(_0x37eee7){var _0x226efd={};_0x226efd[_0x37eee7]={'$like':'%'+_0x3ba07e['query'][_0xf1f8('0x27')]+'%'};return _0x226efd;})});}_0x26cef6=_[_0xf1f8('0x2b')]({},_0x26cef6,_0x3ba07e['options']);return _0x2d4dc7['getConfigurations'](_0x26cef6);}})[_0xf1f8('0x11')](function(_0x19bec0){if(_0x19bec0){_0x458f70=_0x19bec0[_0xf1f8('0x21')];if(!_0x3ba07e['query'][_0xf1f8('0x22')](_0xf1f8('0x23'))){_0x26cef6[_0xf1f8('0xa')]=qs[_0xf1f8('0xa')](_0x3ba07e[_0xf1f8('0x1b')]['limit']);_0x26cef6[_0xf1f8('0x8')]=qs['offset'](_0x3ba07e[_0xf1f8('0x1b')][_0xf1f8('0x8')]);}return _0x2d4dc7[_0xf1f8('0x36')](_0x26cef6);}})[_0xf1f8('0x11')](function(_0x3313d5){if(_0x3313d5){return _0x3313d5?{'count':_0x458f70,'rows':_0x3313d5}:null;}})['then'](respondWithResult(_0x3f7e54,null))[_0xf1f8('0x30')](handleError(_0x3f7e54,null));};exports[_0xf1f8('0x39')]=function(_0x4fe2ae,_0x545598){if(_0x4fe2ae['body']['id']){delete _0x4fe2ae[_0xf1f8('0x35')]['id'];}return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x4fe2ae[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x545598,null))['then'](function(_0xebbd51){if(_0xebbd51){_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3a')]=_0xebbd51['id'];_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3b')]=integrations[_0xf1f8('0x3c')](_0x4fe2ae['body'][_0xf1f8('0x3d')],_0x4fe2ae[_0xf1f8('0x35')]['type']);_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3e')]=integrations[_0xf1f8('0x3f')](_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3d')],_0x4fe2ae['body'][_0xf1f8('0x29')]);return db[_0xf1f8('0x38')]['create'](_0x4fe2ae[_0xf1f8('0x35')],{'include':[{'model':db[_0xf1f8('0x40')],'as':_0xf1f8('0x3b')},{'model':db[_0xf1f8('0x40')],'as':_0xf1f8('0x3e')}]});}return null;})[_0xf1f8('0x11')](respondWithResult(_0x545598,null))[_0xf1f8('0x30')](handleError(_0x545598,null));};function sanitizeRemoteUri(_0x37d633){var _0x2378f1=_0x37d633['slice'](-0x1);if(_0x2378f1==='/')return _0x37d633['substring'](0x0,_0x37d633[_0xf1f8('0x41')](_0x2378f1));return _0x37d633;}function getWebApiUrl(_0x3c7fee){return util[_0xf1f8('0x42')](_0xf1f8('0x43'),_0x3c7fee);}exports['getFields']=function(_0x4048ae,_0xdd8eda){var _0x568379=_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0x44')];var _0xa492db=_0x568379===_0xf1f8('0x45')?_0xf1f8('0x46'):_0xf1f8('0x47');var _0x2206bb='';var _0x5d1a14='';var _0x2f521c='';var _0x3a052f='';var _0x58331d='';var _0x433dba='';var _0x2befb2='';var _0x5beea6='';var _0x4007fb=[_0xf1f8('0x48'),_0xf1f8('0x49'),'customerid','ownerid',_0xf1f8('0x4a'),_0xf1f8('0x4b'),_0xf1f8('0x4c'),'regardingobjectid',_0xf1f8('0x4d'),_0xf1f8('0x4e')];var _0x4821f1=[_0xf1f8('0x4f'),'accountidyominame',_0xf1f8('0x50'),'billedserviceunits',_0xf1f8('0x51'),_0xf1f8('0x52'),_0xf1f8('0x53'),'contractidname',_0xf1f8('0x54'),_0xf1f8('0x55'),_0xf1f8('0x56'),_0xf1f8('0x57'),_0xf1f8('0x58'),_0xf1f8('0x59'),_0xf1f8('0x5a'),'customeridname',_0xf1f8('0x5b'),_0xf1f8('0x5c'),'emailaddress',_0xf1f8('0x5d'),_0xf1f8('0x5e'),'entityimage_url','escalatedon',_0xf1f8('0x5f'),'firstresponsebykpiidname',_0xf1f8('0x60'),'importsequencenumber','influencescore',_0xf1f8('0x61'),_0xf1f8('0x62'),_0xf1f8('0x63'),_0xf1f8('0x64'),'modifiedbyexternalpartyyominame',_0xf1f8('0x65'),_0xf1f8('0x66'),_0xf1f8('0x67'),'modifiedonbehalfbyname',_0xf1f8('0x68'),_0xf1f8('0x69'),_0xf1f8('0x6a'),_0xf1f8('0x6b'),_0xf1f8('0x6c'),'overriddencreatedon',_0xf1f8('0x6d'),_0xf1f8('0x6e'),_0xf1f8('0x6f'),_0xf1f8('0x70'),_0xf1f8('0x71'),_0xf1f8('0x72'),'prioritycodename',_0xf1f8('0x73'),_0xf1f8('0x74'),_0xf1f8('0x75'),'resolvebykpiidname','responseby','responsiblecontactidname',_0xf1f8('0x76'),'sentimentvalue',_0xf1f8('0x77'),_0xf1f8('0x78'),'socialprofileidname',_0xf1f8('0x79'),_0xf1f8('0x7a'),'subjectidname',_0xf1f8('0x7b'),_0xf1f8('0x7c'),_0xf1f8('0x7d'),_0xf1f8('0x7e'),_0xf1f8('0x7f'),_0xf1f8('0x80')];var _0x4b74e2=_0x4007fb[_0xf1f8('0x81')](_0x4821f1);return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x4048ae['params']['id']},'attributes':['id',_0xf1f8('0x82'),_0xf1f8('0x83'),_0xf1f8('0x84'),'tenantId',_0xf1f8('0x85'),_0xf1f8('0x86'),_0xf1f8('0x87')],'include':[{'model':db[_0xf1f8('0x88')],'as':'CloudProvider','attributes':['id',_0xf1f8('0x89'),_0xf1f8('0x8a')]}]})['then'](handleEntityNotFound(_0xdd8eda,null))[_0xf1f8('0x11')](function(_0x42c5a1){if(_0x42c5a1){if(_0x42c5a1[_0xf1f8('0x87')]){_0x42c5a1[_0xf1f8('0x8b')]=_0x42c5a1[_0xf1f8('0x88')][_0xf1f8('0x89')];_0x5beea6=sanitizeRemoteUri(_0x42c5a1['CloudProvider'][_0xf1f8('0x8a')]);_0x2befb2=getWebApiUrl(_0x5beea6);return _0x42c5a1;}_0x5beea6=sanitizeRemoteUri(_0x42c5a1[_0xf1f8('0x84')]);_0x2befb2=getWebApiUrl(_0x5beea6);var _0x1ed9d0={'method':'POST','uri':_0xf1f8('0x8c')+_0x42c5a1[_0xf1f8('0x8d')]+_0xf1f8('0x8e'),'form':{'client_id':_0x42c5a1['clientId'],'resource':_0x5beea6,'username':_0x42c5a1[_0xf1f8('0x82')],'password':_0x42c5a1[_0xf1f8('0x83')],'grant_type':_0xf1f8('0x83'),'client_secret':_0x42c5a1['clientSecret']},'json':!![]};return rp(_0x1ed9d0);}})[_0xf1f8('0x11')](function(_0xcc839a){_0x433dba=_0xcc839a['access_token'];var _0x19a6b1={'method':_0xf1f8('0x8f'),'uri':encodeURI(_0x2befb2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xa492db+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x433dba,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x19a6b1);})[_0xf1f8('0x11')](function(_0x53de13){var _0x219e58=_0x53de13['value'][0x0];var _0x470cad=_0x219e58[_0xf1f8('0x90')];var _0x3ef764={'method':'GET','uri':_0x2befb2+'EntityDefinitions('+_0x470cad+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf1f8('0x91')+_0x433dba,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x3ef764);})['then'](function(_0x46e0c9){_0x2206bb=_0x46e0c9;_0x5d1a14=_0x2206bb['Attributes'];_0x5d1a14=_['remove'](_0x5d1a14,function(_0x29c61f){return!_0x4b74e2[_0xf1f8('0x93')](_0x29c61f['LogicalName']);});var _0x41fa06=[];var _0x6e9e3c=[];_0x5d1a14[_0xf1f8('0x94')](function(_0x4cbb74){if(_0x4cbb74['@odata.type']){var _0x51cb1d=_0x4cbb74[_0xf1f8('0x95')][_0xf1f8('0x96')](_0x4cbb74['@odata.type'][_0xf1f8('0x41')]('.')+0x1);if(_0x51cb1d===_0xf1f8('0x97')){_0x41fa06[_0xf1f8('0x98')](getSelectList(_0x2befb2,_0x568379,_0x6e9e3c,_0x2206bb['MetadataId'],_0x4cbb74[_0xf1f8('0x90')],_0x433dba));}}});return Promise[_0xf1f8('0x99')](_0x41fa06);})['then'](function(_0x4b54dc){_0x2f521c=_0x4b54dc[0x0];var _0x164da2=[];var _0x236cde=[];_0x5d1a14['forEach'](function(_0x30dd74){if(!_['isNil'](_0x30dd74[_0xf1f8('0x95')])){var _0xebdd6a=_0x30dd74['@odata.type'][_0xf1f8('0x96')](_0x30dd74[_0xf1f8('0x95')][_0xf1f8('0x41')]('.')+0x1);if(_0xebdd6a===_0xf1f8('0x9a')){_0x164da2[_0xf1f8('0x98')](getBooleanList(_0x2befb2,_0x568379,_0x236cde,_0x2206bb['MetadataId'],_0x30dd74[_0xf1f8('0x90')],_0x433dba));}}});return Promise['all'](_0x164da2);})[_0xf1f8('0x11')](function(_0x519f31){_0x3a052f=_0x519f31[0x0];var _0x349bac=[];var _0x4ef17d=[];_0x5d1a14[_0xf1f8('0x94')](function(_0x5b8744){if(_0x5b8744['@odata.type']){var _0x340ee7=_0x5b8744[_0xf1f8('0x95')][_0xf1f8('0x96')](_0x5b8744[_0xf1f8('0x95')][_0xf1f8('0x41')]('.')+0x1);if(_0x340ee7==='StringAttributeMetadata'||_0x340ee7===_0xf1f8('0x9b')||_0x340ee7==='BigIntAttributeMetadata'||_0x340ee7===_0xf1f8('0x9c')||_0x340ee7===_0xf1f8('0x9d')||_0x340ee7===_0xf1f8('0x9e')||_0x340ee7===_0xf1f8('0x9f')||_0x340ee7===_0xf1f8('0xa0')||_0x340ee7===_0xf1f8('0xa1')||_0x340ee7===_0xf1f8('0xa2')){_0x349bac['push'](getInputList(_0x2befb2,_0x568379,_0x340ee7,_0x4ef17d,_0x2206bb['MetadataId'],_0x5b8744[_0xf1f8('0x90')],_0x433dba));}}});return Promise[_0xf1f8('0x99')](_0x349bac);})[_0xf1f8('0x11')](function(_0x51c2c5){_0x58331d=_0x51c2c5[0x0];var _0x242877=_0x2f521c[_0xf1f8('0x81')](_0x3a052f)['concat'](_0x58331d);var _0x4e2c8c={'count':_0x242877[_0xf1f8('0x21')],'rows':_0x242877};return _0x4e2c8c;})['then'](respondWithResult(_0xdd8eda,null))[_0xf1f8('0x30')](function(_0xf5bcf7){var _0x2f00d4=_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0xa3')]?0x1f4:_0xf5bcf7[_0xf1f8('0xa4')]||0x1f4;logger[_0xf1f8('0xa5')](_0xf5bcf7[_0xf1f8('0x12')]);delete _0xf5bcf7[_0xf1f8('0x13')];if(_0x2f00d4===0x191){_0x2f00d4=0x190;}_0xdd8eda[_0xf1f8('0xc')](_0x2f00d4)[_0xf1f8('0x14')](_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0xa3')]?{'message':'Wrong\x20credentials','statusCode':_0xf5bcf7['statusCode']}:_0xf5bcf7);});};function getSelectList(_0x204b8d,_0xcb0d7a,_0x74467c,_0x293886,_0x3b18eb,_0x324b6e){var _0x149958={'method':'GET','uri':_0x204b8d+_0xf1f8('0xa6')+_0x293886+_0xf1f8('0xa7')+_0x3b18eb+_0xf1f8('0xa8')+_0xf1f8('0xa9'),'headers':{'Authorization':_0xf1f8('0x91')+_0x324b6e,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x149958)[_0xf1f8('0x11')](function(_0x474041){var _0x4acdd5=[];var _0x1209b=_0x474041[_0xf1f8('0xaa')]['Options'];_0x1209b[_0xf1f8('0x94')](function(_0x28b52e){_0x4acdd5[_0xf1f8('0x98')]({'name':_0x28b52e[_0xf1f8('0xab')][_0xf1f8('0xac')][_0xf1f8('0xab')],'value':String(_0x28b52e[_0xf1f8('0xad')])});});var _0x4bdf2c={'id':_0xcb0d7a+'_'+_0x474041['LogicalName'],'name':_0x474041[_0xf1f8('0xae')]['UserLocalizedLabel'][_0xf1f8('0xab')],'custom':![],'options':_0x4acdd5};_0x74467c['push'](_0x4bdf2c);return _0x74467c;});}function getBooleanList(_0x177f6e,_0x196763,_0x201c12,_0x25a9a8,_0x3a627f,_0x36454a){var _0x2e080c={'method':_0xf1f8('0x8f'),'uri':_0x177f6e+_0xf1f8('0xa6')+_0x25a9a8+_0xf1f8('0xa7')+_0x3a627f+_0xf1f8('0xaf'),'headers':{'Authorization':_0xf1f8('0x91')+_0x36454a,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x2e080c)[_0xf1f8('0x11')](function(_0x327231){var _0x18197d=[];_0x18197d['push']({'name':_0x327231[_0xf1f8('0xaa')][_0xf1f8('0xb0')][_0xf1f8('0xab')][_0xf1f8('0xac')]['Label'],'value':_0xf1f8('0xb1')},{'name':_0x327231[_0xf1f8('0xaa')][_0xf1f8('0xb2')][_0xf1f8('0xab')][_0xf1f8('0xac')][_0xf1f8('0xab')],'value':_0xf1f8('0xb3')});var _0x2d9a9e={'id':_0x196763+'_'+_0x327231[_0xf1f8('0xb4')],'name':_0x327231[_0xf1f8('0xae')][_0xf1f8('0xac')][_0xf1f8('0xab')],'custom':![],'options':_0x18197d};_0x201c12[_0xf1f8('0x98')](_0x2d9a9e);return _0x201c12;});}function getInputList(_0x4032ec,_0x4821da,_0x4a140d,_0x3c3445,_0x1334e9,_0x1820dc,_0x3636d1){var _0xc7e5bb={'method':_0xf1f8('0x8f'),'uri':_0x4032ec+'EntityDefinitions('+_0x1334e9+_0xf1f8('0xa7')+_0x1820dc+_0xf1f8('0xb5')+_0x4a140d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xf1f8('0x91')+_0x3636d1,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0xc7e5bb)[_0xf1f8('0x11')](function(_0x3dabf7){var _0x27e3f6={'id':_0x4821da+'_'+_0x3dabf7[_0xf1f8('0xb4')],'name':_0x3dabf7['DisplayName'][_0xf1f8('0xac')]?_0x3dabf7[_0xf1f8('0xae')]['UserLocalizedLabel'][_0xf1f8('0xab')]:_0x3dabf7[_0xf1f8('0xb4')],'custom':![],'options':[]};_0x3c3445[_0xf1f8('0x98')](_0x27e3f6);return _0x3c3445;});} \ No newline at end of file +var _0x7ff9=['incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','limit','undefined','offset','count','Content-Range','update','then','destroy','end','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','Dynamics365Configuration','filter','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7ff9,0x78));var _0x97ff=function(_0x50b074,_0x5d5267){_0x50b074=_0x50b074-0x0;var _0x3a2f18=_0x7ff9[_0x50b074];return _0x3a2f18;};'use strict';var rp=require(_0x97ff('0x0'));var util=require(_0x97ff('0x1'));var _=require(_0x97ff('0x2'));var qs=require(_0x97ff('0x3'));var logger=require(_0x97ff('0x4'))(_0x97ff('0x5'));var db=require(_0x97ff('0x6'))['db'];var integrations=require(_0x97ff('0x7'));function respondWithResult(_0x22ed64,_0x57f2f3){_0x57f2f3=_0x57f2f3||0xc8;return function(_0x3516b7){if(_0x3516b7){return _0x22ed64[_0x97ff('0x8')](_0x57f2f3)['json'](_0x3516b7);}};}function respondWithFilteredResult(_0x54c03f,_0x4bac93){return function(_0x1c249b){if(_0x1c249b){var _0xb4a738=typeof _0x4bac93['offset']==='undefined'&&typeof _0x4bac93[_0x97ff('0x9')]===_0x97ff('0xa');var _0x50130d=_0x1c249b['count'];var _0x5c5c08=_0xb4a738?0x0:_0x4bac93[_0x97ff('0xb')];var _0x2f35c3=_0xb4a738?_0x1c249b[_0x97ff('0xc')]:_0x4bac93[_0x97ff('0xb')]+_0x4bac93[_0x97ff('0x9')];var _0x4eb3e9;if(_0x2f35c3>=_0x50130d){_0x2f35c3=_0x50130d;_0x4eb3e9=0xc8;}else{_0x4eb3e9=0xce;}_0x54c03f[_0x97ff('0x8')](_0x4eb3e9);return _0x54c03f['set'](_0x97ff('0xd'),_0x5c5c08+'-'+_0x2f35c3+'/'+_0x50130d)['json'](_0x1c249b);}return null;};}function saveUpdates(_0x5c89a4){return function(_0x55801e){if(_0x55801e){return _0x55801e[_0x97ff('0xe')](_0x5c89a4)[_0x97ff('0xf')](function(_0x2530f7){return _0x2530f7;});}return null;};}function removeEntity(_0x4edf79){return function(_0x2f2359){if(_0x2f2359){return _0x2f2359[_0x97ff('0x10')]()['then'](function(){_0x4edf79[_0x97ff('0x8')](0xcc)[_0x97ff('0x11')]();});}};}function handleEntityNotFound(_0x2e0ee2){return function(_0x391c86){if(!_0x391c86){_0x2e0ee2['sendStatus'](0x194);}return _0x391c86;};}function handleError(_0x282102,_0x223a82){_0x223a82=_0x223a82||0x1f4;return function(_0x5707ed){logger['error'](_0x5707ed[_0x97ff('0x12')]);if(_0x5707ed[_0x97ff('0x13')]){delete _0x5707ed[_0x97ff('0x13')];}_0x282102[_0x97ff('0x8')](_0x223a82)[_0x97ff('0x14')](_0x5707ed);};}exports[_0x97ff('0x15')]=function(_0x31cce5,_0x30e0c6){var _0x807c88={},_0x320e97={},_0x1a9541={'count':0x0,'rows':[]};var _0x3be93a=_[_0x97ff('0x16')](db[_0x97ff('0x17')]['rawAttributes'],function(_0x101dcb){return{'name':_0x101dcb[_0x97ff('0x18')],'type':_0x101dcb[_0x97ff('0x19')][_0x97ff('0x1a')]};});_0x320e97['model']=_[_0x97ff('0x16')](_0x3be93a,_0x97ff('0x13'));_0x320e97[_0x97ff('0x1b')]=_[_0x97ff('0x1c')](_0x31cce5[_0x97ff('0x1b')]);_0x320e97['filters']=_[_0x97ff('0x1d')](_0x320e97[_0x97ff('0x1e')],_0x320e97[_0x97ff('0x1b')]);_0x807c88[_0x97ff('0x1f')]=_[_0x97ff('0x1d')](_0x320e97[_0x97ff('0x1e')],qs[_0x97ff('0x20')](_0x31cce5[_0x97ff('0x1b')][_0x97ff('0x20')]));_0x807c88[_0x97ff('0x1f')]=_0x807c88['attributes'][_0x97ff('0x21')]?_0x807c88[_0x97ff('0x1f')]:_0x320e97[_0x97ff('0x1e')];if(!_0x31cce5[_0x97ff('0x1b')][_0x97ff('0x22')](_0x97ff('0x23'))){_0x807c88[_0x97ff('0x9')]=qs[_0x97ff('0x9')](_0x31cce5[_0x97ff('0x1b')]['limit']);_0x807c88[_0x97ff('0xb')]=qs[_0x97ff('0xb')](_0x31cce5[_0x97ff('0x1b')][_0x97ff('0xb')]);}_0x807c88[_0x97ff('0x24')]=qs[_0x97ff('0x25')](_0x31cce5[_0x97ff('0x1b')]['sort']);_0x807c88[_0x97ff('0x26')]=qs[_0x97ff('0x27')](_['pick'](_0x31cce5[_0x97ff('0x1b')],_0x320e97[_0x97ff('0x27')]),_0x3be93a);if(_0x31cce5[_0x97ff('0x1b')]['filter']){_0x807c88['where']=_[_0x97ff('0x28')](_0x807c88[_0x97ff('0x26')],{'$or':_[_0x97ff('0x16')](_0x3be93a,function(_0x436923){if(_0x436923['type']!==_0x97ff('0x29')){var _0x1a075a={};_0x1a075a[_0x436923['name']]={'$like':'%'+_0x31cce5[_0x97ff('0x1b')]['filter']+'%'};return _0x1a075a;}})});}_0x807c88=_[_0x97ff('0x28')]({},_0x807c88,_0x31cce5[_0x97ff('0x2a')]);var _0x2494a3={'where':_0x807c88['where']};return db['Dynamics365Account']['count'](_0x2494a3)['then'](function(_0x523141){_0x1a9541[_0x97ff('0xc')]=_0x523141;if(_0x31cce5[_0x97ff('0x1b')][_0x97ff('0x2b')]){_0x807c88[_0x97ff('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x97ff('0x2d')](_0x807c88);})[_0x97ff('0xf')](function(_0x220f85){_0x1a9541[_0x97ff('0x2e')]=_0x220f85;return _0x1a9541;})[_0x97ff('0xf')](respondWithFilteredResult(_0x30e0c6,_0x807c88))[_0x97ff('0x2f')](handleError(_0x30e0c6,null));};exports['show']=function(_0x25b390,_0x111438){var _0xd6947b={'raw':![],'where':{'id':_0x25b390['params']['id']}},_0x447310={};_0x447310['model']=_['keys'](db[_0x97ff('0x17')][_0x97ff('0x30')]);_0x447310[_0x97ff('0x1b')]=_[_0x97ff('0x1c')](_0x25b390[_0x97ff('0x1b')]);_0x447310[_0x97ff('0x27')]=_[_0x97ff('0x1d')](_0x447310[_0x97ff('0x1e')],_0x447310[_0x97ff('0x1b')]);_0xd6947b[_0x97ff('0x1f')]=_[_0x97ff('0x1d')](_0x447310[_0x97ff('0x1e')],qs[_0x97ff('0x20')](_0x25b390[_0x97ff('0x1b')][_0x97ff('0x20')]));_0xd6947b[_0x97ff('0x1f')]=_0xd6947b[_0x97ff('0x1f')][_0x97ff('0x21')]?_0xd6947b[_0x97ff('0x1f')]:_0x447310[_0x97ff('0x1e')];if(_0x25b390['query']['includeAll']){_0xd6947b[_0x97ff('0x2c')]=[{'all':!![]}];}_0xd6947b=_[_0x97ff('0x28')]({},_0xd6947b,_0x25b390['options']);return db[_0x97ff('0x17')][_0x97ff('0x31')](_0xd6947b)['then'](handleEntityNotFound(_0x111438,null))[_0x97ff('0xf')](respondWithResult(_0x111438,null))['catch'](handleError(_0x111438,null));};exports['create']=function(_0x541975,_0x5396f7){return db[_0x97ff('0x17')][_0x97ff('0x32')](_0x541975[_0x97ff('0x33')],{})[_0x97ff('0xf')](respondWithResult(_0x5396f7,0xc9))['catch'](handleError(_0x5396f7,null));};exports['update']=function(_0x5a29ce,_0x5c418f){if(_0x5a29ce['body']['id']){delete _0x5a29ce[_0x97ff('0x33')]['id'];}return db[_0x97ff('0x17')][_0x97ff('0x31')]({'where':{'id':_0x5a29ce[_0x97ff('0x34')]['id']}})[_0x97ff('0xf')](handleEntityNotFound(_0x5c418f,null))['then'](saveUpdates(_0x5a29ce[_0x97ff('0x33')],null))['then'](respondWithResult(_0x5c418f,null))[_0x97ff('0x2f')](handleError(_0x5c418f,null));};exports['destroy']=function(_0x362b84,_0x2355f5){return db['Dynamics365Account'][_0x97ff('0x31')]({'where':{'id':_0x362b84['params']['id']}})[_0x97ff('0xf')](handleEntityNotFound(_0x2355f5,null))[_0x97ff('0xf')](removeEntity(_0x2355f5,null))[_0x97ff('0x2f')](handleError(_0x2355f5,null));};exports['getConfigurations']=function(_0x471e5b,_0x2fc2bd){var _0x21e830={};var _0x1f579e={};var _0x22af48;var _0xde94fc;return db['Dynamics365Account']['findOne']({'where':{'id':_0x471e5b[_0x97ff('0x34')]['id']}})[_0x97ff('0xf')](handleEntityNotFound(_0x2fc2bd,null))[_0x97ff('0xf')](function(_0x2f2078){if(_0x2f2078){_0x22af48=_0x2f2078;_0x1f579e[_0x97ff('0x1e')]=_[_0x97ff('0x1c')](db[_0x97ff('0x35')][_0x97ff('0x30')]);_0x1f579e[_0x97ff('0x1b')]=_[_0x97ff('0x1c')](_0x471e5b[_0x97ff('0x1b')]);_0x1f579e[_0x97ff('0x27')]=_[_0x97ff('0x1d')](_0x1f579e['model'],_0x1f579e[_0x97ff('0x1b')]);_0x21e830[_0x97ff('0x1f')]=_['intersection'](_0x1f579e[_0x97ff('0x1e')],qs['fields'](_0x471e5b[_0x97ff('0x1b')][_0x97ff('0x20')]));_0x21e830[_0x97ff('0x1f')]=_0x21e830[_0x97ff('0x1f')]['length']?_0x21e830[_0x97ff('0x1f')]:_0x1f579e['model'];_0x21e830['order']=qs[_0x97ff('0x25')](_0x471e5b[_0x97ff('0x1b')][_0x97ff('0x25')]);_0x21e830[_0x97ff('0x26')]=qs['filters'](_['pick'](_0x471e5b[_0x97ff('0x1b')],_0x1f579e[_0x97ff('0x27')]));if(_0x471e5b[_0x97ff('0x1b')]['filter']){_0x21e830[_0x97ff('0x26')]=_[_0x97ff('0x28')](_0x21e830[_0x97ff('0x26')],{'$or':_[_0x97ff('0x16')](_0x21e830['attributes'],function(_0x1260e9){var _0x4383d8={};_0x4383d8[_0x1260e9]={'$like':'%'+_0x471e5b[_0x97ff('0x1b')][_0x97ff('0x36')]+'%'};return _0x4383d8;})});}_0x21e830=_['merge']({},_0x21e830,_0x471e5b[_0x97ff('0x2a')]);return _0x22af48[_0x97ff('0x37')](_0x21e830);}})[_0x97ff('0xf')](function(_0x3fe721){if(_0x3fe721){_0xde94fc=_0x3fe721[_0x97ff('0x21')];if(!_0x471e5b[_0x97ff('0x1b')][_0x97ff('0x22')](_0x97ff('0x23'))){_0x21e830[_0x97ff('0x9')]=qs[_0x97ff('0x9')](_0x471e5b[_0x97ff('0x1b')]['limit']);_0x21e830[_0x97ff('0xb')]=qs['offset'](_0x471e5b[_0x97ff('0x1b')][_0x97ff('0xb')]);}return _0x22af48[_0x97ff('0x37')](_0x21e830);}})['then'](function(_0x2aab75){if(_0x2aab75){return _0x2aab75?{'count':_0xde94fc,'rows':_0x2aab75}:null;}})['then'](respondWithResult(_0x2fc2bd,null))[_0x97ff('0x2f')](handleError(_0x2fc2bd,null));};exports[_0x97ff('0x38')]=function(_0x1d6611,_0xa697ab){if(_0x1d6611[_0x97ff('0x33')]['id']){delete _0x1d6611['body']['id'];}return db[_0x97ff('0x17')]['findOne']({'where':{'id':_0x1d6611[_0x97ff('0x34')]['id']}})[_0x97ff('0xf')](handleEntityNotFound(_0xa697ab,null))[_0x97ff('0xf')](function(_0x218348){if(_0x218348){_0x1d6611['body']['AccountId']=_0x218348['id'];_0x1d6611[_0x97ff('0x33')][_0x97ff('0x39')]=integrations[_0x97ff('0x3a')](_0x1d6611['body']['channel'],_0x1d6611[_0x97ff('0x33')][_0x97ff('0x19')]);_0x1d6611[_0x97ff('0x33')][_0x97ff('0x3b')]=integrations[_0x97ff('0x3c')](_0x1d6611[_0x97ff('0x33')][_0x97ff('0x3d')],_0x1d6611[_0x97ff('0x33')][_0x97ff('0x19')]);return db[_0x97ff('0x35')][_0x97ff('0x32')](_0x1d6611[_0x97ff('0x33')],{'include':[{'model':db[_0x97ff('0x3e')],'as':_0x97ff('0x39')},{'model':db[_0x97ff('0x3e')],'as':_0x97ff('0x3b')}]});}return null;})['then'](respondWithResult(_0xa697ab,null))[_0x97ff('0x2f')](handleError(_0xa697ab,null));};function sanitizeRemoteUri(_0x380a06){var _0x3fcb0f=_0x380a06[_0x97ff('0x3f')](-0x1);if(_0x3fcb0f==='/')return _0x380a06['substring'](0x0,_0x380a06[_0x97ff('0x40')](_0x3fcb0f));return _0x380a06;}function getWebApiUrl(_0x1404f3){return util[_0x97ff('0x41')](_0x97ff('0x42'),_0x1404f3);}exports[_0x97ff('0x43')]=function(_0x3683ae,_0x56f1dc){var _0x4efafb=_0x3683ae[_0x97ff('0x1b')][_0x97ff('0x44')];var _0x54ce2a=_0x4efafb===_0x97ff('0x45')?_0x97ff('0x46'):_0x97ff('0x47');var _0x31f542='';var _0x513d73='';var _0x4fd7ab='';var _0x1cf228='';var _0x1f5a52='';var _0x2dfe9a='';var _0x5a6e63='';var _0x1679c8='';var _0x1f713f=[_0x97ff('0x48'),'description','customerid',_0x97ff('0x49'),_0x97ff('0x4a'),_0x97ff('0x4b'),_0x97ff('0x4c'),_0x97ff('0x4d'),'directioncode',_0x97ff('0x4e')];var _0x31cc9b=[_0x97ff('0x4f'),_0x97ff('0x50'),_0x97ff('0x51'),'billedserviceunits',_0x97ff('0x52'),_0x97ff('0x53'),_0x97ff('0x54'),'contractidname',_0x97ff('0x55'),_0x97ff('0x56'),_0x97ff('0x57'),_0x97ff('0x58'),_0x97ff('0x59'),_0x97ff('0x5a'),_0x97ff('0x5b'),_0x97ff('0x5c'),'customeridtype',_0x97ff('0x5d'),_0x97ff('0x5e'),'entitlementidname','entityimage_timestamp',_0x97ff('0x5f'),'escalatedon',_0x97ff('0x60'),_0x97ff('0x61'),_0x97ff('0x62'),_0x97ff('0x63'),_0x97ff('0x64'),'kbarticleidname',_0x97ff('0x65'),_0x97ff('0x66'),'modifiedbyexternalpartyname',_0x97ff('0x67'),_0x97ff('0x68'),_0x97ff('0x69'),_0x97ff('0x6a'),'modifiedonbehalfbyname',_0x97ff('0x6b'),_0x97ff('0x6c'),_0x97ff('0x6d'),_0x97ff('0x6e'),_0x97ff('0x6f'),_0x97ff('0x70'),_0x97ff('0x71'),_0x97ff('0x72'),_0x97ff('0x73'),_0x97ff('0x74'),_0x97ff('0x75'),_0x97ff('0x76'),_0x97ff('0x77'),_0x97ff('0x78'),_0x97ff('0x79'),_0x97ff('0x7a'),'resolvebykpiidname','responseby',_0x97ff('0x7b'),_0x97ff('0x7c'),'sentimentvalue',_0x97ff('0x7d'),_0x97ff('0x7e'),_0x97ff('0x7f'),'statecode',_0x97ff('0x80'),_0x97ff('0x81'),_0x97ff('0x82'),_0x97ff('0x83'),_0x97ff('0x84'),_0x97ff('0x85'),_0x97ff('0x86'),_0x97ff('0x87')];var _0x1280ea=_0x1f713f[_0x97ff('0x88')](_0x31cc9b);return db[_0x97ff('0x17')][_0x97ff('0x89')]({'where':{'id':_0x3683ae['params']['id']},'attributes':['id',_0x97ff('0x8a'),_0x97ff('0x8b'),_0x97ff('0x8c'),_0x97ff('0x8d'),_0x97ff('0x8e'),_0x97ff('0x8f'),_0x97ff('0x90')],'include':[{'model':db[_0x97ff('0x91')],'as':'CloudProvider','attributes':['id',_0x97ff('0x92'),_0x97ff('0x93')]}]})[_0x97ff('0xf')](handleEntityNotFound(_0x56f1dc,null))[_0x97ff('0xf')](function(_0x319786){if(_0x319786){if(_0x319786[_0x97ff('0x90')]){_0x319786[_0x97ff('0x94')]=_0x319786[_0x97ff('0x91')][_0x97ff('0x92')];_0x1679c8=sanitizeRemoteUri(_0x319786[_0x97ff('0x91')][_0x97ff('0x93')]);_0x5a6e63=getWebApiUrl(_0x1679c8);return _0x319786;}_0x1679c8=sanitizeRemoteUri(_0x319786[_0x97ff('0x8c')]);_0x5a6e63=getWebApiUrl(_0x1679c8);var _0x48a2ac={'method':_0x97ff('0x95'),'uri':'https://login.microsoftonline.com/'+_0x319786['tenantId']+_0x97ff('0x96'),'form':{'client_id':_0x319786[_0x97ff('0x8e')],'resource':_0x1679c8,'username':_0x319786[_0x97ff('0x8a')],'password':_0x319786[_0x97ff('0x8b')],'grant_type':'password','client_secret':_0x319786[_0x97ff('0x8f')]},'json':!![]};return rp(_0x48a2ac);}})[_0x97ff('0xf')](function(_0x5bc4d4){_0x2dfe9a=_0x5bc4d4[_0x97ff('0x94')];var _0x43596d={'method':_0x97ff('0x97'),'uri':encodeURI(_0x5a6e63+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x54ce2a+'\x27'),'headers':{'Authorization':_0x97ff('0x98')+_0x2dfe9a,'If-None-Match':null,'OData-Version':_0x97ff('0x99')},'json':!![]};return rp(_0x43596d);})[_0x97ff('0xf')](function(_0xa81304){var _0x545d3d=_0xa81304[_0x97ff('0x9a')][0x0];var _0x26ac13=_0x545d3d['MetadataId'];var _0xb2607={'method':_0x97ff('0x97'),'uri':_0x5a6e63+_0x97ff('0x9b')+_0x26ac13+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x97ff('0x98')+_0x2dfe9a,'If-None-Match':null,'OData-Version':_0x97ff('0x99')},'json':!![]};return rp(_0xb2607);})[_0x97ff('0xf')](function(_0x548a72){_0x31f542=_0x548a72;_0x513d73=_0x31f542[_0x97ff('0x9c')];_0x513d73=_[_0x97ff('0x9d')](_0x513d73,function(_0x283e57){return!_0x1280ea['includes'](_0x283e57[_0x97ff('0x9e')]);});var _0x4f28e7=[];var _0xf65250=[];_0x513d73[_0x97ff('0x9f')](function(_0x4559e3){if(_0x4559e3[_0x97ff('0xa0')]){var _0x1df279=_0x4559e3['@odata.type'][_0x97ff('0xa1')](_0x4559e3[_0x97ff('0xa0')]['lastIndexOf']('.')+0x1);if(_0x1df279===_0x97ff('0xa2')){_0x4f28e7[_0x97ff('0xa3')](getSelectList(_0x5a6e63,_0x4efafb,_0xf65250,_0x31f542[_0x97ff('0xa4')],_0x4559e3['MetadataId'],_0x2dfe9a));}}});return Promise[_0x97ff('0xa5')](_0x4f28e7);})[_0x97ff('0xf')](function(_0x154377){_0x4fd7ab=_0x154377[0x0];var _0x4261f5=[];var _0x420616=[];_0x513d73[_0x97ff('0x9f')](function(_0x1192f0){if(!_[_0x97ff('0xa6')](_0x1192f0['@odata.type'])){var _0x29015e=_0x1192f0[_0x97ff('0xa0')][_0x97ff('0xa1')](_0x1192f0[_0x97ff('0xa0')][_0x97ff('0x40')]('.')+0x1);if(_0x29015e==='BooleanAttributeMetadata'){_0x4261f5[_0x97ff('0xa3')](getBooleanList(_0x5a6e63,_0x4efafb,_0x420616,_0x31f542['MetadataId'],_0x1192f0['MetadataId'],_0x2dfe9a));}}});return Promise[_0x97ff('0xa5')](_0x4261f5);})['then'](function(_0x42ecfc){_0x1cf228=_0x42ecfc[0x0];var _0x40f48b=[];var _0x5315e8=[];_0x513d73[_0x97ff('0x9f')](function(_0x5cecc1){if(_0x5cecc1[_0x97ff('0xa0')]){var _0x3e7775=_0x5cecc1[_0x97ff('0xa0')][_0x97ff('0xa1')](_0x5cecc1[_0x97ff('0xa0')]['lastIndexOf']('.')+0x1);if(_0x3e7775===_0x97ff('0xa7')||_0x3e7775===_0x97ff('0xa8')||_0x3e7775===_0x97ff('0xa9')||_0x3e7775===_0x97ff('0xaa')||_0x3e7775===_0x97ff('0xab')||_0x3e7775==='DateTimeAttributeMetadata'||_0x3e7775===_0x97ff('0xac')||_0x3e7775===_0x97ff('0xad')||_0x3e7775==='StateAttributeMetadata'||_0x3e7775===_0x97ff('0xae')){_0x40f48b[_0x97ff('0xa3')](getInputList(_0x5a6e63,_0x4efafb,_0x3e7775,_0x5315e8,_0x31f542[_0x97ff('0xa4')],_0x5cecc1[_0x97ff('0xa4')],_0x2dfe9a));}}});return Promise[_0x97ff('0xa5')](_0x40f48b);})[_0x97ff('0xf')](function(_0xa6cc7c){_0x1f5a52=_0xa6cc7c[0x0];var _0x4d3a98=_0x4fd7ab[_0x97ff('0x88')](_0x1cf228)[_0x97ff('0x88')](_0x1f5a52);var _0x121660={'count':_0x4d3a98[_0x97ff('0x21')],'rows':_0x4d3a98};return _0x121660;})[_0x97ff('0xf')](respondWithResult(_0x56f1dc,null))['catch'](function(_0x41db3c){var _0x711874=_0x3683ae[_0x97ff('0x1b')][_0x97ff('0xaf')]?0x1f4:_0x41db3c[_0x97ff('0xb0')]||0x1f4;logger[_0x97ff('0xb1')](_0x41db3c[_0x97ff('0x12')]);delete _0x41db3c['name'];if(_0x711874===0x191){_0x711874=0x190;}_0x56f1dc[_0x97ff('0x8')](_0x711874)['send'](_0x3683ae[_0x97ff('0x1b')][_0x97ff('0xaf')]?{'message':_0x97ff('0xb2'),'statusCode':_0x41db3c['statusCode']}:_0x41db3c);});};function getSelectList(_0x2ef300,_0x51bd9d,_0x5cbe01,_0x47ef5a,_0x42aa0f,_0x22cc35){var _0x38fbbd={'method':_0x97ff('0x97'),'uri':_0x2ef300+_0x97ff('0x9b')+_0x47ef5a+_0x97ff('0xb3')+_0x42aa0f+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x97ff('0xb4'),'headers':{'Authorization':_0x97ff('0x98')+_0x22cc35,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x38fbbd)['then'](function(_0x3583ef){var _0x46cc0c=[];var _0x4ffa3e=_0x3583ef[_0x97ff('0xb5')]['Options'];_0x4ffa3e[_0x97ff('0x9f')](function(_0x14ba7a){_0x46cc0c[_0x97ff('0xa3')]({'name':_0x14ba7a[_0x97ff('0xb6')][_0x97ff('0xb7')]['Label'],'value':String(_0x14ba7a['Value'])});});var _0x27eccc={'id':_0x51bd9d+'_'+_0x3583ef[_0x97ff('0x9e')],'name':_0x3583ef[_0x97ff('0xb8')][_0x97ff('0xb7')][_0x97ff('0xb6')],'custom':![],'options':_0x46cc0c};_0x5cbe01['push'](_0x27eccc);return _0x5cbe01;});}function getBooleanList(_0x215f7b,_0x1ae8f0,_0x5c4764,_0x3b8dc6,_0x141140,_0x594813){var _0x45d85e={'method':_0x97ff('0x97'),'uri':_0x215f7b+'EntityDefinitions('+_0x3b8dc6+')/Attributes('+_0x141140+_0x97ff('0xb9'),'headers':{'Authorization':_0x97ff('0x98')+_0x594813,'If-None-Match':null,'OData-Version':_0x97ff('0x99')},'json':!![]};return rp(_0x45d85e)[_0x97ff('0xf')](function(_0x3af4f4){var _0x234fe2=[];_0x234fe2[_0x97ff('0xa3')]({'name':_0x3af4f4[_0x97ff('0xb5')][_0x97ff('0xba')][_0x97ff('0xb6')][_0x97ff('0xb7')][_0x97ff('0xb6')],'value':'true'},{'name':_0x3af4f4[_0x97ff('0xb5')]['FalseOption']['Label']['UserLocalizedLabel'][_0x97ff('0xb6')],'value':_0x97ff('0xbb')});var _0x127919={'id':_0x1ae8f0+'_'+_0x3af4f4[_0x97ff('0x9e')],'name':_0x3af4f4['DisplayName'][_0x97ff('0xb7')][_0x97ff('0xb6')],'custom':![],'options':_0x234fe2};_0x5c4764['push'](_0x127919);return _0x5c4764;});}function getInputList(_0x282791,_0x4da09d,_0x4fcc75,_0x5160c2,_0x3e92a8,_0x30a81c,_0x10f11a){var _0x3a3756={'method':_0x97ff('0x97'),'uri':_0x282791+'EntityDefinitions('+_0x3e92a8+_0x97ff('0xb3')+_0x30a81c+_0x97ff('0xbc')+_0x4fcc75+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x97ff('0x98')+_0x10f11a,'If-None-Match':null,'OData-Version':_0x97ff('0x99')},'json':!![]};return rp(_0x3a3756)[_0x97ff('0xf')](function(_0x33f977){var _0x4635ee={'id':_0x4da09d+'_'+_0x33f977[_0x97ff('0x9e')],'name':_0x33f977[_0x97ff('0xb8')][_0x97ff('0xb7')]?_0x33f977[_0x97ff('0xb8')][_0x97ff('0xb7')][_0x97ff('0xb6')]:_0x33f977[_0x97ff('0x9e')],'custom':![],'options':[]};_0x5160c2[_0x97ff('0xa3')](_0x4635ee);return _0x5160c2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f6a80f7..da75df5 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x34cdea,_0x2837d4){var _0x3b8216=function(_0x93e0e8){while(--_0x93e0e8){_0x34cdea['push'](_0x34cdea['shift']());}};_0x3b8216(++_0x2837d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xcb91[_0x903228];return _0xcec81d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x6485d3,_0x1aae2c){var _0x18ae6e=function(_0x1e6c28){while(--_0x1e6c28){_0x6485d3['push'](_0x6485d3['shift']());}};_0x18ae6e(++_0x1aae2c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 a69401e..1b8dfa2 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 _0x431d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account','Dynamics365Account','find','catch','lodash'];(function(_0x4f3487,_0x143272){var _0x58d74f=function(_0x24ec84){while(--_0x24ec84){_0x4f3487['push'](_0x4f3487['shift']());}};_0x58d74f(++_0x143272);}(_0x431d,0x1db));var _0xd431=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x431d[_0x55bd12];return _0x1941dd;};'use strict';var _=require(_0xd431('0x0'));var util=require(_0xd431('0x1'));var moment=require(_0xd431('0x2'));var BPromise=require(_0xd431('0x3'));var rs=require(_0xd431('0x4'));var fs=require('fs');var Redis=require(_0xd431('0x5'));var db=require(_0xd431('0x6'))['db'];var utils=require(_0xd431('0x7'));var logger=require(_0xd431('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd431('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217520,_0x4e42ca,_0xface44){return new BPromise(function(_0x6a7b6d,_0x5753d1){return client[_0xd431('0xa')](_0x217520,_0xface44)[_0xd431('0xb')](function(_0x1c6a34){logger[_0xd431('0xc')](_0xd431('0xd'),_0x4e42ca,_0xd431('0xe'));logger[_0xd431('0xf')](_0xd431('0x10'),_0x4e42ca,_0xd431('0xe'),JSON[_0xd431('0x11')](_0x1c6a34));if(_0x1c6a34['error']){if(_0x1c6a34[_0xd431('0x12')]['code']===0x1f4){logger['error'](_0xd431('0xd'),_0x4e42ca,_0x1c6a34[_0xd431('0x12')][_0xd431('0x13')]);return _0x5753d1(_0x1c6a34['error'][_0xd431('0x13')]);}logger['error'](_0xd431('0xd'),_0x4e42ca,_0x1c6a34[_0xd431('0x12')]['message']);return _0x6a7b6d(_0x1c6a34[_0xd431('0x12')][_0xd431('0x13')]);}else{logger[_0xd431('0xc')](_0xd431('0xd'),_0x4e42ca,_0xd431('0xe'));_0x6a7b6d(_0x1c6a34[_0xd431('0x14')][_0xd431('0x13')]);}})['catch'](function(_0x57b3d5){logger[_0xd431('0x12')](_0xd431('0xd'),_0x4e42ca,_0x57b3d5);_0x5753d1(_0x57b3d5);});});}exports[_0xd431('0x15')]=function(_0x40ebd8){var _0x1c4569=this;return new Promise(function(_0x34705f,_0x6f0355){return db['Dynamics365Account'][_0xd431('0x16')]({'raw':_0x40ebd8[_0xd431('0x17')]?_0x40ebd8[_0xd431('0x17')][_0xd431('0x18')]===undefined?!![]:![]:!![],'where':_0x40ebd8[_0xd431('0x17')]?_0x40ebd8[_0xd431('0x17')][_0xd431('0x19')]||null:null,'attributes':_0x40ebd8['options']?_0x40ebd8[_0xd431('0x17')][_0xd431('0x1a')]||null:null,'limit':_0x40ebd8['options']?_0x40ebd8[_0xd431('0x17')]['limit']||null:null,'include':_0x40ebd8[_0xd431('0x17')]?_0x40ebd8['options'][_0xd431('0x1b')]?_[_0xd431('0x1c')](_0x40ebd8[_0xd431('0x17')][_0xd431('0x1b')],function(_0x18e4ca){return{'model':db[_0x18e4ca[_0xd431('0x1d')]],'as':_0x18e4ca['as'],'attributes':_0x18e4ca[_0xd431('0x1a')],'include':_0x18e4ca['include']?_[_0xd431('0x1c')](_0x18e4ca[_0xd431('0x1b')],function(_0x2d0b90){return{'model':db[_0x2d0b90['model']],'as':_0x2d0b90['as'],'attributes':_0x2d0b90[_0xd431('0x1a')],'include':_0x2d0b90[_0xd431('0x1b')]?_[_0xd431('0x1c')](_0x2d0b90[_0xd431('0x1b')],function(_0xcfc92b){return{'model':db[_0xcfc92b[_0xd431('0x1d')]],'as':_0xcfc92b['as'],'attributes':_0xcfc92b[_0xd431('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd431('0xb')](function(_0x5e629a){logger[_0xd431('0xc')](_0xd431('0x15'),_0x40ebd8);logger['debug'](_0xd431('0x15'),_0x40ebd8,JSON[_0xd431('0x11')](_0x5e629a));_0x34705f(_0x5e629a);})['catch'](function(_0x3f3da9){logger[_0xd431('0x12')](_0xd431('0x15'),_0x3f3da9[_0xd431('0x13')],_0x40ebd8);_0x6f0355(_0x1c4569['error'](0x1f4,_0x3f3da9[_0xd431('0x13')]));});});};exports[_0xd431('0x1e')]=function(_0x283176){var _0x55f1d5=this;return new Promise(function(_0x46d9e3,_0x38a004){return db[_0xd431('0x1f')][_0xd431('0x20')]({'raw':_0x283176[_0xd431('0x17')]?_0x283176['options'][_0xd431('0x18')]===undefined?!![]:![]:!![],'where':_0x283176[_0xd431('0x17')]?_0x283176[_0xd431('0x17')][_0xd431('0x19')]||null:null,'attributes':_0x283176['options']?_0x283176[_0xd431('0x17')][_0xd431('0x1a')]||null:null,'include':_0x283176[_0xd431('0x17')]?_0x283176[_0xd431('0x17')][_0xd431('0x1b')]?_['map'](_0x283176[_0xd431('0x17')][_0xd431('0x1b')],function(_0xe2ae00){return{'model':db[_0xe2ae00[_0xd431('0x1d')]],'as':_0xe2ae00['as'],'attributes':_0xe2ae00[_0xd431('0x1a')],'include':_0xe2ae00[_0xd431('0x1b')]?_[_0xd431('0x1c')](_0xe2ae00['include'],function(_0x9f7308){return{'model':db[_0x9f7308['model']],'as':_0x9f7308['as'],'attributes':_0x9f7308[_0xd431('0x1a')],'include':_0x9f7308[_0xd431('0x1b')]?_['map'](_0x9f7308[_0xd431('0x1b')],function(_0x525717){return{'model':db[_0x525717[_0xd431('0x1d')]],'as':_0x525717['as'],'attributes':_0x525717[_0xd431('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd431('0xb')](function(_0x18d1ca){logger['info'](_0xd431('0x1e'),_0x283176);logger[_0xd431('0xf')](_0xd431('0x1e'),_0x283176,JSON[_0xd431('0x11')](_0x18d1ca));_0x46d9e3(_0x18d1ca);})[_0xd431('0x21')](function(_0x2e5516){logger['error']('ShowDynamics365Account',_0x2e5516['message'],_0x283176);_0x38a004(_0x55f1d5[_0xd431('0x12')](0x1f4,_0x2e5516[_0xd431('0x13')]));});});}; \ No newline at end of file +var _0x5ecb=['Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','debug','stringify','ShowDynamics365Account','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDynamics365Account'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5ecb,0x181));var _0xb5ec=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x5ecb[_0x46361e];return _0x14e302;};'use strict';var _=require(_0xb5ec('0x0'));var util=require(_0xb5ec('0x1'));var moment=require(_0xb5ec('0x2'));var BPromise=require(_0xb5ec('0x3'));var rs=require(_0xb5ec('0x4'));var fs=require('fs');var Redis=require(_0xb5ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5ec('0x6'));var logger=require(_0xb5ec('0x7'))(_0xb5ec('0x8'));var config=require(_0xb5ec('0x9'));var jayson=require(_0xb5ec('0xa'));var client=jayson[_0xb5ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35047d,_0x2b3d85,_0x16c232){return new BPromise(function(_0x182a8e,_0x49e168){return client[_0xb5ec('0xc')](_0x35047d,_0x16c232)['then'](function(_0x534830){logger[_0xb5ec('0xd')](_0xb5ec('0xe'),_0x2b3d85,'request\x20sent');logger['debug'](_0xb5ec('0xf'),_0x2b3d85,_0xb5ec('0x10'),JSON['stringify'](_0x534830));if(_0x534830[_0xb5ec('0x11')]){if(_0x534830['error'][_0xb5ec('0x12')]===0x1f4){logger[_0xb5ec('0x11')](_0xb5ec('0xe'),_0x2b3d85,_0x534830[_0xb5ec('0x11')][_0xb5ec('0x13')]);return _0x49e168(_0x534830[_0xb5ec('0x11')]['message']);}logger[_0xb5ec('0x11')](_0xb5ec('0xe'),_0x2b3d85,_0x534830[_0xb5ec('0x11')][_0xb5ec('0x13')]);return _0x182a8e(_0x534830[_0xb5ec('0x11')][_0xb5ec('0x13')]);}else{logger['info'](_0xb5ec('0xe'),_0x2b3d85,_0xb5ec('0x10'));_0x182a8e(_0x534830['result'][_0xb5ec('0x13')]);}})[_0xb5ec('0x14')](function(_0x147c2a){logger['error'](_0xb5ec('0xe'),_0x2b3d85,_0x147c2a);_0x49e168(_0x147c2a);});});}exports[_0xb5ec('0x15')]=function(_0x3c74ec){var _0x4b2cbf=this;return new Promise(function(_0x1dddb2,_0xd96dd3){return db[_0xb5ec('0x16')][_0xb5ec('0x17')]({'raw':_0x3c74ec[_0xb5ec('0x18')]?_0x3c74ec[_0xb5ec('0x18')][_0xb5ec('0x19')]===undefined?!![]:![]:!![],'where':_0x3c74ec[_0xb5ec('0x18')]?_0x3c74ec[_0xb5ec('0x18')][_0xb5ec('0x1a')]||null:null,'attributes':_0x3c74ec[_0xb5ec('0x18')]?_0x3c74ec[_0xb5ec('0x18')][_0xb5ec('0x1b')]||null:null,'limit':_0x3c74ec['options']?_0x3c74ec['options'][_0xb5ec('0x1c')]||null:null,'include':_0x3c74ec[_0xb5ec('0x18')]?_0x3c74ec['options']['include']?_[_0xb5ec('0x1d')](_0x3c74ec['options'][_0xb5ec('0x1e')],function(_0x4bbba2){return{'model':db[_0x4bbba2[_0xb5ec('0x1f')]],'as':_0x4bbba2['as'],'attributes':_0x4bbba2[_0xb5ec('0x1b')],'include':_0x4bbba2[_0xb5ec('0x1e')]?_[_0xb5ec('0x1d')](_0x4bbba2[_0xb5ec('0x1e')],function(_0x1ae26d){return{'model':db[_0x1ae26d[_0xb5ec('0x1f')]],'as':_0x1ae26d['as'],'attributes':_0x1ae26d['attributes'],'include':_0x1ae26d['include']?_[_0xb5ec('0x1d')](_0x1ae26d[_0xb5ec('0x1e')],function(_0x3b687b){return{'model':db[_0x3b687b[_0xb5ec('0x1f')]],'as':_0x3b687b['as'],'attributes':_0x3b687b[_0xb5ec('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x979674){logger[_0xb5ec('0xd')]('GetDynamics365Account',_0x3c74ec);logger[_0xb5ec('0x20')](_0xb5ec('0x15'),_0x3c74ec,JSON[_0xb5ec('0x21')](_0x979674));_0x1dddb2(_0x979674);})[_0xb5ec('0x14')](function(_0x24dbe9){logger['error'](_0xb5ec('0x15'),_0x24dbe9[_0xb5ec('0x13')],_0x3c74ec);_0xd96dd3(_0x4b2cbf['error'](0x1f4,_0x24dbe9['message']));});});};exports[_0xb5ec('0x22')]=function(_0x343471){var _0x547640=this;return new Promise(function(_0x5b6a22,_0x203853){return db[_0xb5ec('0x16')][_0xb5ec('0x23')]({'raw':_0x343471[_0xb5ec('0x18')]?_0x343471[_0xb5ec('0x18')][_0xb5ec('0x19')]===undefined?!![]:![]:!![],'where':_0x343471['options']?_0x343471[_0xb5ec('0x18')][_0xb5ec('0x1a')]||null:null,'attributes':_0x343471[_0xb5ec('0x18')]?_0x343471['options']['attributes']||null:null,'include':_0x343471[_0xb5ec('0x18')]?_0x343471['options'][_0xb5ec('0x1e')]?_[_0xb5ec('0x1d')](_0x343471['options'][_0xb5ec('0x1e')],function(_0x30e5db){return{'model':db[_0x30e5db[_0xb5ec('0x1f')]],'as':_0x30e5db['as'],'attributes':_0x30e5db['attributes'],'include':_0x30e5db[_0xb5ec('0x1e')]?_['map'](_0x30e5db[_0xb5ec('0x1e')],function(_0x48d596){return{'model':db[_0x48d596[_0xb5ec('0x1f')]],'as':_0x48d596['as'],'attributes':_0x48d596[_0xb5ec('0x1b')],'include':_0x48d596['include']?_['map'](_0x48d596[_0xb5ec('0x1e')],function(_0x331849){return{'model':db[_0x331849[_0xb5ec('0x1f')]],'as':_0x331849['as'],'attributes':_0x331849['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5ec('0x24')](function(_0x4c5e4b){logger[_0xb5ec('0xd')]('ShowDynamics365Account',_0x343471);logger[_0xb5ec('0x20')](_0xb5ec('0x22'),_0x343471,JSON[_0xb5ec('0x21')](_0x4c5e4b));_0x5b6a22(_0x4c5e4b);})[_0xb5ec('0x14')](function(_0xdd494){logger['error'](_0xb5ec('0x22'),_0xdd494[_0xb5ec('0x13')],_0x343471);_0x203853(_0x547640[_0xb5ec('0x11')](0x1f4,_0xdd494[_0xb5ec('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6c7a852..bf0bebb 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 _0xbc2c=['update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put'];(function(_0x337d7c,_0x569a9f){var _0x5665f6=function(_0x44eca2){while(--_0x44eca2){_0x337d7c['push'](_0x337d7c['shift']());}};_0x5665f6(++_0x569a9f);}(_0xbc2c,0x123));var _0xcbc2=function(_0x57b248,_0x2d5053){_0x57b248=_0x57b248-0x0;var _0x3a55f5=_0xbc2c[_0x57b248];return _0x3a55f5;};'use strict';var multer=require(_0xcbc2('0x0'));var util=require(_0xcbc2('0x1'));var path=require(_0xcbc2('0x2'));var timeout=require(_0xcbc2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcbc2('0x4'));var auth=require(_0xcbc2('0x5'));var interaction=require(_0xcbc2('0x6'));var config=require(_0xcbc2('0x7'));var controller=require(_0xcbc2('0x8'));router[_0xcbc2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcbc2('0x9')](_0xcbc2('0xa'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0xc')]);router['get'](_0xcbc2('0xd'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0xe')]);router[_0xcbc2('0x9')](_0xcbc2('0xf'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x10')]);router[_0xcbc2('0x9')](_0xcbc2('0x11'),auth[_0xcbc2('0xb')](),controller['getDescriptions']);router[_0xcbc2('0x12')]('/',auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x13')]);router[_0xcbc2('0x14')](_0xcbc2('0xa'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x15')]);router[_0xcbc2('0x16')](_0xcbc2('0xa'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x17')]);module['exports']=router; \ No newline at end of file +var _0x91b6=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer'];(function(_0x2c9f51,_0x2eec01){var _0x12abf9=function(_0x2d463f){while(--_0x2d463f){_0x2c9f51['push'](_0x2c9f51['shift']());}};_0x12abf9(++_0x2eec01);}(_0x91b6,0x18b));var _0x691b=function(_0x137f32,_0x5922c7){_0x137f32=_0x137f32-0x0;var _0x37b28b=_0x91b6[_0x137f32];return _0x37b28b;};'use strict';var multer=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var path=require('path');var timeout=require(_0x691b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x691b('0x3'));var auth=require(_0x691b('0x4'));var interaction=require(_0x691b('0x5'));var config=require(_0x691b('0x6'));var controller=require(_0x691b('0x7'));router[_0x691b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x691b('0x8')](_0x691b('0x9'),auth['isAuthenticated'](),controller[_0x691b('0xa')]);router[_0x691b('0x8')](_0x691b('0xb'),auth[_0x691b('0xc')](),controller[_0x691b('0xd')]);router[_0x691b('0x8')](_0x691b('0xe'),auth[_0x691b('0xc')](),controller['getSubjects']);router[_0x691b('0x8')](_0x691b('0xf'),auth[_0x691b('0xc')](),controller[_0x691b('0x10')]);router[_0x691b('0x11')]('/',auth[_0x691b('0xc')](),controller['create']);router[_0x691b('0x12')](_0x691b('0x9'),auth[_0x691b('0xc')](),controller[_0x691b('0x13')]);router['delete'](_0x691b('0x9'),auth[_0x691b('0xc')](),controller[_0x691b('0x14')]);module[_0x691b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1bd56ba..a4fe5cb 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 _0xdce9=['nothing','sequelize','exports','STRING','ENUM','incident','phonecall','contact'];(function(_0x549544,_0x27a1fd){var _0x5e87b8=function(_0x2cf4b9){while(--_0x2cf4b9){_0x549544['push'](_0x549544['shift']());}};_0x5e87b8(++_0x27a1fd);}(_0xdce9,0x99));var _0x9dce=function(_0x322886,_0x144334){_0x322886=_0x322886-0x0;var _0x5e4747=_0xdce9[_0x322886];return _0x5e4747;};'use strict';var Sequelize=require(_0x9dce('0x0'));module[_0x9dce('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9dce('0x2')]},'ticketType':{'type':Sequelize[_0x9dce('0x3')](_0x9dce('0x4'),_0x9dce('0x5')),'defaultValue':_0x9dce('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x9dce('0x6'),_0x9dce('0x7')),'defaultValue':_0x9dce('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3222=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x3222,0x133));var _0x2322=function(_0x3f5301,_0x2b30d0){_0x3f5301=_0x3f5301-0x0;var _0x549c7f=_0x3222[_0x3f5301];return _0x549c7f;};'use strict';var Sequelize=require(_0x2322('0x0'));module[_0x2322('0x1')]={'name':{'type':Sequelize[_0x2322('0x2')]},'description':{'type':Sequelize[_0x2322('0x2')]},'ticketType':{'type':Sequelize[_0x2322('0x3')](_0x2322('0x4'),_0x2322('0x5')),'defaultValue':_0x2322('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2322('0x6'),_0x2322('0x7')),'defaultValue':_0x2322('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2322('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2322('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 147453e..f3f30f2 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 _0x2cbd=['catch','show','includeAll','find','create','body','update','params','getFields','findOne','Dynamics365Field','order','sort','pick','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','filter','merge','VIRTUAL','options','where','Dynamics365Configuration','include','findAll','rows'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x2cbd,0x159));var _0xd2cb=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x2cbd[_0x2ddfd9];return _0x2668f0;};'use strict';var emlformat=require(_0xd2cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2cb('0x1'));var jsonpatch=require(_0xd2cb('0x2'));var rp=require(_0xd2cb('0x3'));var moment=require(_0xd2cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2cb('0x5'));var util=require(_0xd2cb('0x6'));var path=require(_0xd2cb('0x7'));var sox=require(_0xd2cb('0x8'));var csv=require(_0xd2cb('0x9'));var ejs=require(_0xd2cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd2cb('0xb'));var crypto=require(_0xd2cb('0xc'));var jsforce=require(_0xd2cb('0xd'));var deskjs=require(_0xd2cb('0xe'));var toCsv=require(_0xd2cb('0x9'));var querystring=require(_0xd2cb('0xf'));var Papa=require(_0xd2cb('0x10'));var Redis=require(_0xd2cb('0x11'));var authService=require(_0xd2cb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd2cb('0x13'));var hardwareService=require(_0xd2cb('0x14'));var logger=require('../../config/logger')(_0xd2cb('0x15'));var utils=require('../../config/utils');var config=require(_0xd2cb('0x16'));var licenseUtil=require(_0xd2cb('0x17'));var db=require(_0xd2cb('0x18'))['db'];function respondWithStatusCode(_0x920b7f,_0x24b27e){_0x24b27e=_0x24b27e||0xcc;return function(_0x3b3d87){if(_0x3b3d87){return _0x920b7f[_0xd2cb('0x19')](_0x24b27e);}return _0x920b7f[_0xd2cb('0x1a')](_0x24b27e)[_0xd2cb('0x1b')]();};}function respondWithResult(_0x1b7a5b,_0x3b8e36){_0x3b8e36=_0x3b8e36||0xc8;return function(_0x44b81e){if(_0x44b81e){return _0x1b7a5b[_0xd2cb('0x1a')](_0x3b8e36)['json'](_0x44b81e);}};}function respondWithFilteredResult(_0x3e1075,_0x25b6c5){return function(_0x380764){if(_0x380764){var _0x339d4f=typeof _0x25b6c5['offset']===_0xd2cb('0x1c')&&typeof _0x25b6c5['limit']===_0xd2cb('0x1c');var _0x48b4e3=_0x380764['count'];var _0x4fb97b=_0x339d4f?0x0:_0x25b6c5[_0xd2cb('0x1d')];var _0x2d20e9=_0x339d4f?_0x380764[_0xd2cb('0x1e')]:_0x25b6c5[_0xd2cb('0x1d')]+_0x25b6c5[_0xd2cb('0x1f')];var _0x27ba59;if(_0x2d20e9>=_0x48b4e3){_0x2d20e9=_0x48b4e3;_0x27ba59=0xc8;}else{_0x27ba59=0xce;}_0x3e1075[_0xd2cb('0x1a')](_0x27ba59);return _0x3e1075[_0xd2cb('0x20')]('Content-Range',_0x4fb97b+'-'+_0x2d20e9+'/'+_0x48b4e3)[_0xd2cb('0x21')](_0x380764);}return null;};}function patchUpdates(_0x19003a){return function(_0x4d83f1){try{jsonpatch['apply'](_0x4d83f1,_0x19003a,!![]);}catch(_0x5b91b5){return BPromise[_0xd2cb('0x22')](_0x5b91b5);}return _0x4d83f1[_0xd2cb('0x23')]();};}function saveUpdates(_0x4c1cc2,_0x288f05){return function(_0x4217e1){if(_0x4217e1){return _0x4217e1['update'](_0x4c1cc2)[_0xd2cb('0x24')](function(_0x171a0f){return _0x171a0f;});}return null;};}function removeEntity(_0x3fb5d3,_0x4ad50e){return function(_0x5dfb18){if(_0x5dfb18){return _0x5dfb18[_0xd2cb('0x25')]()[_0xd2cb('0x24')](function(){_0x3fb5d3[_0xd2cb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e493,_0x4fd9e3){return function(_0x43352b){if(!_0x43352b){_0x25e493[_0xd2cb('0x19')](0x194);}return _0x43352b;};}function handleError(_0x2aa708,_0x1141d2){_0x1141d2=_0x1141d2||0x1f4;return function(_0x200c6a){logger[_0xd2cb('0x26')](_0x200c6a['stack']);if(_0x200c6a[_0xd2cb('0x27')]){delete _0x200c6a[_0xd2cb('0x27')];}_0x2aa708[_0xd2cb('0x1a')](_0x1141d2)[_0xd2cb('0x28')](_0x200c6a);};}exports[_0xd2cb('0x29')]=function(_0x40da19,_0x1a3bc2){var _0x1f6011={},_0x30882e={},_0x253494={'count':0x0,'rows':[]};var _0x14990e=_[_0xd2cb('0x2a')](db['Dynamics365Configuration'][_0xd2cb('0x2b')],function(_0x571dd7){return{'name':_0x571dd7[_0xd2cb('0x2c')],'type':_0x571dd7[_0xd2cb('0x2d')][_0xd2cb('0x2e')]};});_0x30882e[_0xd2cb('0x2f')]=_[_0xd2cb('0x2a')](_0x14990e,_0xd2cb('0x27'));_0x30882e[_0xd2cb('0x30')]=_[_0xd2cb('0x31')](_0x40da19[_0xd2cb('0x30')]);_0x30882e[_0xd2cb('0x32')]=_[_0xd2cb('0x33')](_0x30882e[_0xd2cb('0x2f')],_0x30882e['query']);_0x1f6011[_0xd2cb('0x34')]=_[_0xd2cb('0x33')](_0x30882e[_0xd2cb('0x2f')],qs[_0xd2cb('0x35')](_0x40da19[_0xd2cb('0x30')][_0xd2cb('0x35')]));_0x1f6011[_0xd2cb('0x34')]=_0x1f6011['attributes'][_0xd2cb('0x36')]?_0x1f6011[_0xd2cb('0x34')]:_0x30882e[_0xd2cb('0x2f')];if(!_0x40da19[_0xd2cb('0x30')][_0xd2cb('0x37')]('nolimit')){_0x1f6011['limit']=qs[_0xd2cb('0x1f')](_0x40da19[_0xd2cb('0x30')][_0xd2cb('0x1f')]);_0x1f6011[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x40da19[_0xd2cb('0x30')][_0xd2cb('0x1d')]);}_0x1f6011['order']=qs['sort'](_0x40da19[_0xd2cb('0x30')]['sort']);_0x1f6011['where']=qs[_0xd2cb('0x32')](_['pick'](_0x40da19[_0xd2cb('0x30')],_0x30882e['filters']),_0x14990e);if(_0x40da19['query'][_0xd2cb('0x38')]){_0x1f6011['where']=_[_0xd2cb('0x39')](_0x1f6011['where'],{'$or':_[_0xd2cb('0x2a')](_0x14990e,function(_0x1c07e0){if(_0x1c07e0[_0xd2cb('0x2d')]!==_0xd2cb('0x3a')){var _0x4ff05c={};_0x4ff05c[_0x1c07e0['name']]={'$like':'%'+_0x40da19[_0xd2cb('0x30')]['filter']+'%'};return _0x4ff05c;}})});}_0x1f6011=_[_0xd2cb('0x39')]({},_0x1f6011,_0x40da19[_0xd2cb('0x3b')]);var _0x1bdd97={'where':_0x1f6011[_0xd2cb('0x3c')]};return db[_0xd2cb('0x3d')][_0xd2cb('0x1e')](_0x1bdd97)[_0xd2cb('0x24')](function(_0x3270ac){_0x253494[_0xd2cb('0x1e')]=_0x3270ac;if(_0x40da19['query']['includeAll']){_0x1f6011[_0xd2cb('0x3e')]=[{'all':!![]}];}return db[_0xd2cb('0x3d')][_0xd2cb('0x3f')](_0x1f6011);})[_0xd2cb('0x24')](function(_0x1563ed){_0x253494[_0xd2cb('0x40')]=_0x1563ed;return _0x253494;})[_0xd2cb('0x24')](respondWithFilteredResult(_0x1a3bc2,_0x1f6011))[_0xd2cb('0x41')](handleError(_0x1a3bc2,null));};exports[_0xd2cb('0x42')]=function(_0x18d9a8,_0x1e61b5){var _0x3b47dc={'raw':![],'where':{'id':_0x18d9a8['params']['id']}},_0x3d2f29={};_0x3d2f29[_0xd2cb('0x2f')]=_[_0xd2cb('0x31')](db[_0xd2cb('0x3d')]['rawAttributes']);_0x3d2f29[_0xd2cb('0x30')]=_[_0xd2cb('0x31')](_0x18d9a8[_0xd2cb('0x30')]);_0x3d2f29['filters']=_[_0xd2cb('0x33')](_0x3d2f29['model'],_0x3d2f29['query']);_0x3b47dc[_0xd2cb('0x34')]=_['intersection'](_0x3d2f29[_0xd2cb('0x2f')],qs[_0xd2cb('0x35')](_0x18d9a8[_0xd2cb('0x30')][_0xd2cb('0x35')]));_0x3b47dc[_0xd2cb('0x34')]=_0x3b47dc['attributes'][_0xd2cb('0x36')]?_0x3b47dc[_0xd2cb('0x34')]:_0x3d2f29['model'];if(_0x18d9a8[_0xd2cb('0x30')][_0xd2cb('0x43')]){_0x3b47dc[_0xd2cb('0x3e')]=[{'all':!![]}];}_0x3b47dc=_['merge']({},_0x3b47dc,_0x18d9a8['options']);return db[_0xd2cb('0x3d')][_0xd2cb('0x44')](_0x3b47dc)['then'](handleEntityNotFound(_0x1e61b5,null))['then'](respondWithResult(_0x1e61b5,null))[_0xd2cb('0x41')](handleError(_0x1e61b5,null));};exports[_0xd2cb('0x45')]=function(_0x5ae812,_0x10d5a7){return db[_0xd2cb('0x3d')][_0xd2cb('0x45')](_0x5ae812[_0xd2cb('0x46')],{})[_0xd2cb('0x24')](respondWithResult(_0x10d5a7,0xc9))[_0xd2cb('0x41')](handleError(_0x10d5a7,null));};exports[_0xd2cb('0x47')]=function(_0x520c39,_0x3c9fc6){if(_0x520c39[_0xd2cb('0x46')]['id']){delete _0x520c39['body']['id'];}return db[_0xd2cb('0x3d')][_0xd2cb('0x44')]({'where':{'id':_0x520c39[_0xd2cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c9fc6,null))['then'](saveUpdates(_0x520c39[_0xd2cb('0x46')],null))['then'](respondWithResult(_0x3c9fc6,null))[_0xd2cb('0x41')](handleError(_0x3c9fc6,null));};exports[_0xd2cb('0x25')]=function(_0x4a0a22,_0x3e08f4){return db[_0xd2cb('0x3d')][_0xd2cb('0x44')]({'where':{'id':_0x4a0a22['params']['id']}})[_0xd2cb('0x24')](handleEntityNotFound(_0x3e08f4,null))[_0xd2cb('0x24')](removeEntity(_0x3e08f4,null))['catch'](handleError(_0x3e08f4,null));};exports[_0xd2cb('0x49')]=function(_0x5b2a34,_0x148391,_0x2843cd){var _0x3e110f={};var _0x53af37={};var _0x5ec370;var _0x292ee8;return db[_0xd2cb('0x3d')][_0xd2cb('0x4a')]({'where':{'id':_0x5b2a34[_0xd2cb('0x48')]['id']}})[_0xd2cb('0x24')](handleEntityNotFound(_0x148391,null))[_0xd2cb('0x24')](function(_0x52644b){if(_0x52644b){_0x5ec370=_0x52644b;_0x53af37[_0xd2cb('0x2f')]=_[_0xd2cb('0x31')](db[_0xd2cb('0x4b')][_0xd2cb('0x2b')]);_0x53af37[_0xd2cb('0x30')]=_[_0xd2cb('0x31')](_0x5b2a34[_0xd2cb('0x30')]);_0x53af37[_0xd2cb('0x32')]=_[_0xd2cb('0x33')](_0x53af37['model'],_0x53af37['query']);_0x3e110f['attributes']=_[_0xd2cb('0x33')](_0x53af37['model'],qs[_0xd2cb('0x35')](_0x5b2a34[_0xd2cb('0x30')]['fields']));_0x3e110f[_0xd2cb('0x34')]=_0x3e110f['attributes'][_0xd2cb('0x36')]?_0x3e110f[_0xd2cb('0x34')]:_0x53af37[_0xd2cb('0x2f')];_0x3e110f[_0xd2cb('0x4c')]=qs[_0xd2cb('0x4d')](_0x5b2a34[_0xd2cb('0x30')][_0xd2cb('0x4d')]);_0x3e110f[_0xd2cb('0x3c')]=qs[_0xd2cb('0x32')](_[_0xd2cb('0x4e')](_0x5b2a34['query'],_0x53af37[_0xd2cb('0x32')]));if(_0x5b2a34['query'][_0xd2cb('0x38')]){_0x3e110f[_0xd2cb('0x3c')]=_['merge'](_0x3e110f[_0xd2cb('0x3c')],{'$or':_['map'](_0x3e110f[_0xd2cb('0x34')],function(_0x3628b6){var _0x3c4407={};_0x3c4407[_0x3628b6]={'$like':'%'+_0x5b2a34[_0xd2cb('0x30')][_0xd2cb('0x38')]+'%'};return _0x3c4407;})});}_0x3e110f=_['merge']({},_0x3e110f,_0x5b2a34[_0xd2cb('0x3b')]);return _0x5ec370['getFields'](_0x3e110f);}})[_0xd2cb('0x24')](function(_0xa48139){if(_0xa48139){_0x292ee8=_0xa48139[_0xd2cb('0x36')];if(!_0x5b2a34[_0xd2cb('0x30')][_0xd2cb('0x37')](_0xd2cb('0x4f'))){_0x3e110f[_0xd2cb('0x1f')]=qs[_0xd2cb('0x1f')](_0x5b2a34[_0xd2cb('0x30')][_0xd2cb('0x1f')]);_0x3e110f['offset']=qs[_0xd2cb('0x1d')](_0x5b2a34[_0xd2cb('0x30')][_0xd2cb('0x1d')]);}return _0x5ec370[_0xd2cb('0x49')](_0x3e110f);}})[_0xd2cb('0x24')](function(_0x26c3eb){if(_0x26c3eb){return _0x26c3eb?{'count':_0x292ee8,'rows':_0x26c3eb}:null;}})[_0xd2cb('0x24')](respondWithResult(_0x148391,null))[_0xd2cb('0x41')](handleError(_0x148391,null));};exports[_0xd2cb('0x50')]=function(_0x20bea7,_0x259f67,_0x1b0d70){var _0x475ab6={};var _0x3bbeaf={};var _0x4ab478;var _0xf730fb;return db[_0xd2cb('0x3d')][_0xd2cb('0x4a')]({'where':{'id':_0x20bea7[_0xd2cb('0x48')]['id']}})[_0xd2cb('0x24')](handleEntityNotFound(_0x259f67,null))[_0xd2cb('0x24')](function(_0x259847){if(_0x259847){_0x4ab478=_0x259847;_0x3bbeaf[_0xd2cb('0x2f')]=_['keys'](db[_0xd2cb('0x4b')][_0xd2cb('0x2b')]);_0x3bbeaf[_0xd2cb('0x30')]=_[_0xd2cb('0x31')](_0x20bea7['query']);_0x3bbeaf[_0xd2cb('0x32')]=_['intersection'](_0x3bbeaf['model'],_0x3bbeaf['query']);_0x475ab6[_0xd2cb('0x34')]=_[_0xd2cb('0x33')](_0x3bbeaf[_0xd2cb('0x2f')],qs[_0xd2cb('0x35')](_0x20bea7[_0xd2cb('0x30')][_0xd2cb('0x35')]));_0x475ab6[_0xd2cb('0x34')]=_0x475ab6['attributes'][_0xd2cb('0x36')]?_0x475ab6[_0xd2cb('0x34')]:_0x3bbeaf[_0xd2cb('0x2f')];_0x475ab6[_0xd2cb('0x4c')]=qs[_0xd2cb('0x4d')](_0x20bea7[_0xd2cb('0x30')][_0xd2cb('0x4d')]);_0x475ab6['where']=qs[_0xd2cb('0x32')](_[_0xd2cb('0x4e')](_0x20bea7['query'],_0x3bbeaf[_0xd2cb('0x32')]));if(_0x20bea7['query'][_0xd2cb('0x38')]){_0x475ab6['where']=_[_0xd2cb('0x39')](_0x475ab6['where'],{'$or':_[_0xd2cb('0x2a')](_0x475ab6[_0xd2cb('0x34')],function(_0x2d3f21){var _0x120a72={};_0x120a72[_0x2d3f21]={'$like':'%'+_0x20bea7['query']['filter']+'%'};return _0x120a72;})});}_0x475ab6=_['merge']({},_0x475ab6,_0x20bea7['options']);return _0x4ab478[_0xd2cb('0x50')](_0x475ab6);}})['then'](function(_0x1a6e52){if(_0x1a6e52){_0xf730fb=_0x1a6e52[_0xd2cb('0x36')];if(!_0x20bea7[_0xd2cb('0x30')][_0xd2cb('0x37')]('nolimit')){_0x475ab6['limit']=qs['limit'](_0x20bea7[_0xd2cb('0x30')][_0xd2cb('0x1f')]);_0x475ab6[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x20bea7[_0xd2cb('0x30')][_0xd2cb('0x1d')]);}return _0x4ab478['getSubjects'](_0x475ab6);}})[_0xd2cb('0x24')](function(_0x254a6c){if(_0x254a6c){return _0x254a6c?{'count':_0xf730fb,'rows':_0x254a6c}:null;}})[_0xd2cb('0x24')](respondWithResult(_0x259f67,null))['catch'](handleError(_0x259f67,null));};exports['getDescriptions']=function(_0x5ee247,_0x121fd5,_0x43afb9){var _0x80b54a={};var _0x390191={};var _0x256a9f;var _0x3a0617;return db[_0xd2cb('0x3d')][_0xd2cb('0x4a')]({'where':{'id':_0x5ee247[_0xd2cb('0x48')]['id']}})[_0xd2cb('0x24')](handleEntityNotFound(_0x121fd5,null))[_0xd2cb('0x24')](function(_0x887015){if(_0x887015){_0x256a9f=_0x887015;_0x390191[_0xd2cb('0x2f')]=_[_0xd2cb('0x31')](db['Dynamics365Field']['rawAttributes']);_0x390191['query']=_[_0xd2cb('0x31')](_0x5ee247[_0xd2cb('0x30')]);_0x390191[_0xd2cb('0x32')]=_['intersection'](_0x390191['model'],_0x390191['query']);_0x80b54a[_0xd2cb('0x34')]=_[_0xd2cb('0x33')](_0x390191['model'],qs[_0xd2cb('0x35')](_0x5ee247[_0xd2cb('0x30')][_0xd2cb('0x35')]));_0x80b54a[_0xd2cb('0x34')]=_0x80b54a[_0xd2cb('0x34')]['length']?_0x80b54a[_0xd2cb('0x34')]:_0x390191[_0xd2cb('0x2f')];_0x80b54a[_0xd2cb('0x4c')]=qs[_0xd2cb('0x4d')](_0x5ee247[_0xd2cb('0x30')][_0xd2cb('0x4d')]);_0x80b54a[_0xd2cb('0x3c')]=qs['filters'](_[_0xd2cb('0x4e')](_0x5ee247[_0xd2cb('0x30')],_0x390191[_0xd2cb('0x32')]));if(_0x5ee247[_0xd2cb('0x30')][_0xd2cb('0x38')]){_0x80b54a[_0xd2cb('0x3c')]=_['merge'](_0x80b54a[_0xd2cb('0x3c')],{'$or':_[_0xd2cb('0x2a')](_0x80b54a[_0xd2cb('0x34')],function(_0x564bc7){var _0x66d1af={};_0x66d1af[_0x564bc7]={'$like':'%'+_0x5ee247[_0xd2cb('0x30')][_0xd2cb('0x38')]+'%'};return _0x66d1af;})});}_0x80b54a=_[_0xd2cb('0x39')]({},_0x80b54a,_0x5ee247[_0xd2cb('0x3b')]);return _0x256a9f[_0xd2cb('0x51')](_0x80b54a);}})[_0xd2cb('0x24')](function(_0x28dd51){if(_0x28dd51){_0x3a0617=_0x28dd51[_0xd2cb('0x36')];if(!_0x5ee247['query']['hasOwnProperty'](_0xd2cb('0x4f'))){_0x80b54a[_0xd2cb('0x1f')]=qs[_0xd2cb('0x1f')](_0x5ee247['query'][_0xd2cb('0x1f')]);_0x80b54a[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x5ee247[_0xd2cb('0x30')]['offset']);}return _0x256a9f['getDescriptions'](_0x80b54a);}})[_0xd2cb('0x24')](function(_0xa2285c){if(_0xa2285c){return _0xa2285c?{'count':_0x3a0617,'rows':_0xa2285c}:null;}})[_0xd2cb('0x24')](respondWithResult(_0x121fd5,null))[_0xd2cb('0x41')](handleError(_0x121fd5,null));}; \ No newline at end of file +var _0x7240=['options','count','includeAll','include','findAll','rows','catch','find','body','params','getFields','getSubjects','findOne','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7240,0x14f));var _0x0724=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x7240[_0x307d86];return _0x361745;};'use strict';var emlformat=require(_0x0724('0x0'));var rimraf=require(_0x0724('0x1'));var zipdir=require(_0x0724('0x2'));var jsonpatch=require(_0x0724('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0724('0x4'));var Mustache=require(_0x0724('0x5'));var util=require('util');var path=require(_0x0724('0x6'));var sox=require(_0x0724('0x7'));var csv=require(_0x0724('0x8'));var ejs=require(_0x0724('0x9'));var fs=require('fs');var fs_extra=require(_0x0724('0xa'));var _=require(_0x0724('0xb'));var squel=require(_0x0724('0xc'));var crypto=require(_0x0724('0xd'));var jsforce=require(_0x0724('0xe'));var deskjs=require(_0x0724('0xf'));var toCsv=require(_0x0724('0x8'));var querystring=require(_0x0724('0x10'));var Papa=require('papaparse');var Redis=require(_0x0724('0x11'));var authService=require(_0x0724('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0724('0x13'));var hardwareService=require(_0x0724('0x14'));var logger=require(_0x0724('0x15'))(_0x0724('0x16'));var utils=require('../../config/utils');var config=require(_0x0724('0x17'));var licenseUtil=require(_0x0724('0x18'));var db=require(_0x0724('0x19'))['db'];function respondWithStatusCode(_0x5620b6,_0x12d1a7){_0x12d1a7=_0x12d1a7||0xcc;return function(_0xb76f43){if(_0xb76f43){return _0x5620b6[_0x0724('0x1a')](_0x12d1a7);}return _0x5620b6[_0x0724('0x1b')](_0x12d1a7)[_0x0724('0x1c')]();};}function respondWithResult(_0x3d09e1,_0x2456b8){_0x2456b8=_0x2456b8||0xc8;return function(_0x4a5305){if(_0x4a5305){return _0x3d09e1[_0x0724('0x1b')](_0x2456b8)[_0x0724('0x1d')](_0x4a5305);}};}function respondWithFilteredResult(_0x191889,_0x20b50a){return function(_0x3b3d6a){if(_0x3b3d6a){var _0x242021=typeof _0x20b50a[_0x0724('0x1e')]===_0x0724('0x1f')&&typeof _0x20b50a[_0x0724('0x20')]===_0x0724('0x1f');var _0x1d660c=_0x3b3d6a['count'];var _0x1a9634=_0x242021?0x0:_0x20b50a[_0x0724('0x1e')];var _0x2fac5e=_0x242021?_0x3b3d6a['count']:_0x20b50a[_0x0724('0x1e')]+_0x20b50a['limit'];var _0xafe172;if(_0x2fac5e>=_0x1d660c){_0x2fac5e=_0x1d660c;_0xafe172=0xc8;}else{_0xafe172=0xce;}_0x191889[_0x0724('0x1b')](_0xafe172);return _0x191889[_0x0724('0x21')](_0x0724('0x22'),_0x1a9634+'-'+_0x2fac5e+'/'+_0x1d660c)[_0x0724('0x1d')](_0x3b3d6a);}return null;};}function patchUpdates(_0x234a87){return function(_0x226f0f){try{jsonpatch[_0x0724('0x23')](_0x226f0f,_0x234a87,!![]);}catch(_0x2f4df9){return BPromise['reject'](_0x2f4df9);}return _0x226f0f[_0x0724('0x24')]();};}function saveUpdates(_0x38e899,_0x2202a6){return function(_0x3017d8){if(_0x3017d8){return _0x3017d8[_0x0724('0x25')](_0x38e899)[_0x0724('0x26')](function(_0xd81c8){return _0xd81c8;});}return null;};}function removeEntity(_0x2c3269,_0xb391ae){return function(_0x2e2d05){if(_0x2e2d05){return _0x2e2d05[_0x0724('0x27')]()['then'](function(){_0x2c3269[_0x0724('0x1b')](0xcc)[_0x0724('0x1c')]();});}};}function handleEntityNotFound(_0x5043de,_0x4a29d1){return function(_0x242bfd){if(!_0x242bfd){_0x5043de['sendStatus'](0x194);}return _0x242bfd;};}function handleError(_0x14167b,_0x9606a2){_0x9606a2=_0x9606a2||0x1f4;return function(_0x4c8784){logger[_0x0724('0x28')](_0x4c8784['stack']);if(_0x4c8784[_0x0724('0x29')]){delete _0x4c8784[_0x0724('0x29')];}_0x14167b['status'](_0x9606a2)['send'](_0x4c8784);};}exports[_0x0724('0x2a')]=function(_0x3849c5,_0x406362){var _0x20cdb0={},_0xb429e3={},_0x5db9ee={'count':0x0,'rows':[]};var _0x1513b3=_[_0x0724('0x2b')](db[_0x0724('0x2c')][_0x0724('0x2d')],function(_0x1f01de){return{'name':_0x1f01de[_0x0724('0x2e')],'type':_0x1f01de[_0x0724('0x2f')][_0x0724('0x30')]};});_0xb429e3[_0x0724('0x31')]=_['map'](_0x1513b3,_0x0724('0x29'));_0xb429e3[_0x0724('0x32')]=_[_0x0724('0x33')](_0x3849c5['query']);_0xb429e3[_0x0724('0x34')]=_[_0x0724('0x35')](_0xb429e3[_0x0724('0x31')],_0xb429e3[_0x0724('0x32')]);_0x20cdb0[_0x0724('0x36')]=_[_0x0724('0x35')](_0xb429e3[_0x0724('0x31')],qs[_0x0724('0x37')](_0x3849c5['query'][_0x0724('0x37')]));_0x20cdb0['attributes']=_0x20cdb0[_0x0724('0x36')][_0x0724('0x38')]?_0x20cdb0[_0x0724('0x36')]:_0xb429e3[_0x0724('0x31')];if(!_0x3849c5[_0x0724('0x32')][_0x0724('0x39')](_0x0724('0x3a'))){_0x20cdb0[_0x0724('0x20')]=qs[_0x0724('0x20')](_0x3849c5[_0x0724('0x32')][_0x0724('0x20')]);_0x20cdb0[_0x0724('0x1e')]=qs[_0x0724('0x1e')](_0x3849c5[_0x0724('0x32')][_0x0724('0x1e')]);}_0x20cdb0[_0x0724('0x3b')]=qs[_0x0724('0x3c')](_0x3849c5['query'][_0x0724('0x3c')]);_0x20cdb0[_0x0724('0x3d')]=qs[_0x0724('0x34')](_[_0x0724('0x3e')](_0x3849c5['query'],_0xb429e3[_0x0724('0x34')]),_0x1513b3);if(_0x3849c5[_0x0724('0x32')][_0x0724('0x3f')]){_0x20cdb0['where']=_[_0x0724('0x40')](_0x20cdb0[_0x0724('0x3d')],{'$or':_[_0x0724('0x2b')](_0x1513b3,function(_0xf629ab){if(_0xf629ab['type']!=='VIRTUAL'){var _0x4dc01e={};_0x4dc01e[_0xf629ab['name']]={'$like':'%'+_0x3849c5['query'][_0x0724('0x3f')]+'%'};return _0x4dc01e;}})});}_0x20cdb0=_[_0x0724('0x40')]({},_0x20cdb0,_0x3849c5[_0x0724('0x41')]);var _0x414f04={'where':_0x20cdb0['where']};return db[_0x0724('0x2c')][_0x0724('0x42')](_0x414f04)[_0x0724('0x26')](function(_0x5c2223){_0x5db9ee['count']=_0x5c2223;if(_0x3849c5[_0x0724('0x32')][_0x0724('0x43')]){_0x20cdb0[_0x0724('0x44')]=[{'all':!![]}];}return db[_0x0724('0x2c')][_0x0724('0x45')](_0x20cdb0);})[_0x0724('0x26')](function(_0x17ff10){_0x5db9ee[_0x0724('0x46')]=_0x17ff10;return _0x5db9ee;})['then'](respondWithFilteredResult(_0x406362,_0x20cdb0))[_0x0724('0x47')](handleError(_0x406362,null));};exports['show']=function(_0x541484,_0x4d8a41){var _0x359627={'raw':![],'where':{'id':_0x541484['params']['id']}},_0x314276={};_0x314276[_0x0724('0x31')]=_[_0x0724('0x33')](db['Dynamics365Configuration']['rawAttributes']);_0x314276[_0x0724('0x32')]=_[_0x0724('0x33')](_0x541484[_0x0724('0x32')]);_0x314276[_0x0724('0x34')]=_[_0x0724('0x35')](_0x314276[_0x0724('0x31')],_0x314276[_0x0724('0x32')]);_0x359627['attributes']=_[_0x0724('0x35')](_0x314276[_0x0724('0x31')],qs[_0x0724('0x37')](_0x541484[_0x0724('0x32')][_0x0724('0x37')]));_0x359627[_0x0724('0x36')]=_0x359627[_0x0724('0x36')][_0x0724('0x38')]?_0x359627[_0x0724('0x36')]:_0x314276[_0x0724('0x31')];if(_0x541484[_0x0724('0x32')][_0x0724('0x43')]){_0x359627[_0x0724('0x44')]=[{'all':!![]}];}_0x359627=_[_0x0724('0x40')]({},_0x359627,_0x541484['options']);return db['Dynamics365Configuration'][_0x0724('0x48')](_0x359627)[_0x0724('0x26')](handleEntityNotFound(_0x4d8a41,null))[_0x0724('0x26')](respondWithResult(_0x4d8a41,null))[_0x0724('0x47')](handleError(_0x4d8a41,null));};exports['create']=function(_0x4fae71,_0x3e6557){return db[_0x0724('0x2c')]['create'](_0x4fae71[_0x0724('0x49')],{})[_0x0724('0x26')](respondWithResult(_0x3e6557,0xc9))['catch'](handleError(_0x3e6557,null));};exports[_0x0724('0x25')]=function(_0x41a6c6,_0x3994e2){if(_0x41a6c6['body']['id']){delete _0x41a6c6[_0x0724('0x49')]['id'];}return db[_0x0724('0x2c')]['find']({'where':{'id':_0x41a6c6[_0x0724('0x4a')]['id']}})[_0x0724('0x26')](handleEntityNotFound(_0x3994e2,null))['then'](saveUpdates(_0x41a6c6['body'],null))[_0x0724('0x26')](respondWithResult(_0x3994e2,null))[_0x0724('0x47')](handleError(_0x3994e2,null));};exports[_0x0724('0x27')]=function(_0x3a7009,_0xbc2418){return db[_0x0724('0x2c')][_0x0724('0x48')]({'where':{'id':_0x3a7009[_0x0724('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbc2418,null))['then'](removeEntity(_0xbc2418,null))['catch'](handleError(_0xbc2418,null));};exports[_0x0724('0x4b')]=function(_0xda0bfb,_0x4c4af6,_0x224e52){var _0x40c403={};var _0x274e80={};var _0x1c0f3d;var _0x25e429;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0xda0bfb['params']['id']}})[_0x0724('0x26')](handleEntityNotFound(_0x4c4af6,null))[_0x0724('0x26')](function(_0x4c7e46){if(_0x4c7e46){_0x1c0f3d=_0x4c7e46;_0x274e80[_0x0724('0x31')]=_[_0x0724('0x33')](db['Dynamics365Field'][_0x0724('0x2d')]);_0x274e80[_0x0724('0x32')]=_['keys'](_0xda0bfb[_0x0724('0x32')]);_0x274e80[_0x0724('0x34')]=_[_0x0724('0x35')](_0x274e80[_0x0724('0x31')],_0x274e80[_0x0724('0x32')]);_0x40c403[_0x0724('0x36')]=_[_0x0724('0x35')](_0x274e80[_0x0724('0x31')],qs['fields'](_0xda0bfb['query'][_0x0724('0x37')]));_0x40c403[_0x0724('0x36')]=_0x40c403[_0x0724('0x36')][_0x0724('0x38')]?_0x40c403['attributes']:_0x274e80[_0x0724('0x31')];_0x40c403[_0x0724('0x3b')]=qs['sort'](_0xda0bfb[_0x0724('0x32')][_0x0724('0x3c')]);_0x40c403[_0x0724('0x3d')]=qs['filters'](_[_0x0724('0x3e')](_0xda0bfb[_0x0724('0x32')],_0x274e80['filters']));if(_0xda0bfb[_0x0724('0x32')]['filter']){_0x40c403['where']=_[_0x0724('0x40')](_0x40c403[_0x0724('0x3d')],{'$or':_['map'](_0x40c403[_0x0724('0x36')],function(_0x4cbae3){var _0xee39d4={};_0xee39d4[_0x4cbae3]={'$like':'%'+_0xda0bfb[_0x0724('0x32')][_0x0724('0x3f')]+'%'};return _0xee39d4;})});}_0x40c403=_[_0x0724('0x40')]({},_0x40c403,_0xda0bfb['options']);return _0x1c0f3d[_0x0724('0x4b')](_0x40c403);}})['then'](function(_0xb5eaa6){if(_0xb5eaa6){_0x25e429=_0xb5eaa6[_0x0724('0x38')];if(!_0xda0bfb[_0x0724('0x32')][_0x0724('0x39')](_0x0724('0x3a'))){_0x40c403[_0x0724('0x20')]=qs[_0x0724('0x20')](_0xda0bfb[_0x0724('0x32')][_0x0724('0x20')]);_0x40c403[_0x0724('0x1e')]=qs[_0x0724('0x1e')](_0xda0bfb[_0x0724('0x32')][_0x0724('0x1e')]);}return _0x1c0f3d['getFields'](_0x40c403);}})[_0x0724('0x26')](function(_0x4862b9){if(_0x4862b9){return _0x4862b9?{'count':_0x25e429,'rows':_0x4862b9}:null;}})[_0x0724('0x26')](respondWithResult(_0x4c4af6,null))[_0x0724('0x47')](handleError(_0x4c4af6,null));};exports[_0x0724('0x4c')]=function(_0x343776,_0x8ba39c,_0x8eddcf){var _0x1811bc={};var _0x55ce26={};var _0x206e50;var _0x5131cc;return db['Dynamics365Configuration'][_0x0724('0x4d')]({'where':{'id':_0x343776['params']['id']}})[_0x0724('0x26')](handleEntityNotFound(_0x8ba39c,null))['then'](function(_0xe79134){if(_0xe79134){_0x206e50=_0xe79134;_0x55ce26[_0x0724('0x31')]=_['keys'](db['Dynamics365Field'][_0x0724('0x2d')]);_0x55ce26['query']=_[_0x0724('0x33')](_0x343776['query']);_0x55ce26[_0x0724('0x34')]=_['intersection'](_0x55ce26['model'],_0x55ce26[_0x0724('0x32')]);_0x1811bc[_0x0724('0x36')]=_[_0x0724('0x35')](_0x55ce26[_0x0724('0x31')],qs[_0x0724('0x37')](_0x343776[_0x0724('0x32')][_0x0724('0x37')]));_0x1811bc['attributes']=_0x1811bc['attributes']['length']?_0x1811bc[_0x0724('0x36')]:_0x55ce26['model'];_0x1811bc[_0x0724('0x3b')]=qs[_0x0724('0x3c')](_0x343776[_0x0724('0x32')][_0x0724('0x3c')]);_0x1811bc['where']=qs[_0x0724('0x34')](_[_0x0724('0x3e')](_0x343776[_0x0724('0x32')],_0x55ce26[_0x0724('0x34')]));if(_0x343776[_0x0724('0x32')]['filter']){_0x1811bc[_0x0724('0x3d')]=_[_0x0724('0x40')](_0x1811bc['where'],{'$or':_['map'](_0x1811bc['attributes'],function(_0x327c70){var _0x101d8f={};_0x101d8f[_0x327c70]={'$like':'%'+_0x343776['query'][_0x0724('0x3f')]+'%'};return _0x101d8f;})});}_0x1811bc=_[_0x0724('0x40')]({},_0x1811bc,_0x343776[_0x0724('0x41')]);return _0x206e50['getSubjects'](_0x1811bc);}})['then'](function(_0x4b7b3c){if(_0x4b7b3c){_0x5131cc=_0x4b7b3c[_0x0724('0x38')];if(!_0x343776[_0x0724('0x32')][_0x0724('0x39')](_0x0724('0x3a'))){_0x1811bc[_0x0724('0x20')]=qs[_0x0724('0x20')](_0x343776[_0x0724('0x32')][_0x0724('0x20')]);_0x1811bc[_0x0724('0x1e')]=qs[_0x0724('0x1e')](_0x343776['query']['offset']);}return _0x206e50[_0x0724('0x4c')](_0x1811bc);}})[_0x0724('0x26')](function(_0x13abc1){if(_0x13abc1){return _0x13abc1?{'count':_0x5131cc,'rows':_0x13abc1}:null;}})[_0x0724('0x26')](respondWithResult(_0x8ba39c,null))[_0x0724('0x47')](handleError(_0x8ba39c,null));};exports[_0x0724('0x4e')]=function(_0x3a9a64,_0x5a133b,_0x4d3dd7){var _0x16a008={};var _0x1b8426={};var _0x1385c6;var _0x5b08c9;return db[_0x0724('0x2c')][_0x0724('0x4d')]({'where':{'id':_0x3a9a64[_0x0724('0x4a')]['id']}})[_0x0724('0x26')](handleEntityNotFound(_0x5a133b,null))[_0x0724('0x26')](function(_0x40af2f){if(_0x40af2f){_0x1385c6=_0x40af2f;_0x1b8426[_0x0724('0x31')]=_[_0x0724('0x33')](db[_0x0724('0x4f')]['rawAttributes']);_0x1b8426[_0x0724('0x32')]=_['keys'](_0x3a9a64['query']);_0x1b8426[_0x0724('0x34')]=_[_0x0724('0x35')](_0x1b8426[_0x0724('0x31')],_0x1b8426[_0x0724('0x32')]);_0x16a008[_0x0724('0x36')]=_[_0x0724('0x35')](_0x1b8426['model'],qs[_0x0724('0x37')](_0x3a9a64[_0x0724('0x32')][_0x0724('0x37')]));_0x16a008['attributes']=_0x16a008['attributes'][_0x0724('0x38')]?_0x16a008[_0x0724('0x36')]:_0x1b8426[_0x0724('0x31')];_0x16a008['order']=qs['sort'](_0x3a9a64[_0x0724('0x32')][_0x0724('0x3c')]);_0x16a008[_0x0724('0x3d')]=qs[_0x0724('0x34')](_['pick'](_0x3a9a64[_0x0724('0x32')],_0x1b8426[_0x0724('0x34')]));if(_0x3a9a64[_0x0724('0x32')]['filter']){_0x16a008[_0x0724('0x3d')]=_['merge'](_0x16a008[_0x0724('0x3d')],{'$or':_['map'](_0x16a008[_0x0724('0x36')],function(_0x35cd99){var _0x245113={};_0x245113[_0x35cd99]={'$like':'%'+_0x3a9a64[_0x0724('0x32')][_0x0724('0x3f')]+'%'};return _0x245113;})});}_0x16a008=_['merge']({},_0x16a008,_0x3a9a64[_0x0724('0x41')]);return _0x1385c6[_0x0724('0x4e')](_0x16a008);}})['then'](function(_0x1c8cb3){if(_0x1c8cb3){_0x5b08c9=_0x1c8cb3[_0x0724('0x38')];if(!_0x3a9a64[_0x0724('0x32')]['hasOwnProperty'](_0x0724('0x3a'))){_0x16a008[_0x0724('0x20')]=qs[_0x0724('0x20')](_0x3a9a64[_0x0724('0x32')]['limit']);_0x16a008[_0x0724('0x1e')]=qs['offset'](_0x3a9a64[_0x0724('0x32')][_0x0724('0x1e')]);}return _0x1385c6[_0x0724('0x4e')](_0x16a008);}})[_0x0724('0x26')](function(_0x5778fe){if(_0x5778fe){return _0x5778fe?{'count':_0x5b08c9,'rows':_0x5778fe}:null;}})[_0x0724('0x26')](respondWithResult(_0x5a133b,null))[_0x0724('0x47')](handleError(_0x5a133b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2ca0ed8..a67e8da 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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x1b60e3,_0x2d7494){var _0x14017e=function(_0x4f6127){while(--_0x4f6127){_0x1b60e3['push'](_0x1b60e3['shift']());}};_0x14017e(++_0x2d7494);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x35d77f,_0x54fc92){var _0x1baa79=function(_0x294d5c){while(--_0x294d5c){_0x35d77f['push'](_0x35d77f['shift']());}};_0x1baa79(++_0x54fc92);}(_0x34e8,0x12c));var _0x834e=function(_0x3eeaeb,_0x5cc579){_0x3eeaeb=_0x3eeaeb-0x0;var _0x5271cd=_0x34e8[_0x3eeaeb];return _0x5271cd;};'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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index fe7f68f..8e3226e 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 _0x92c3=['code','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xfa716b,_0x1fa236){var _0xe946ab=function(_0x495c2e){while(--_0x495c2e){_0xfa716b['push'](_0xfa716b['shift']());}};_0xe946ab(++_0x1fa236);}(_0x92c3,0x139));var _0x392c=function(_0x24ede4,_0x52134f){_0x24ede4=_0x24ede4-0x0;var _0x30cf51=_0x92c3[_0x24ede4];return _0x30cf51;};'use strict';var _=require(_0x392c('0x0'));var util=require(_0x392c('0x1'));var moment=require('moment');var BPromise=require(_0x392c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x392c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x392c('0x4'));var logger=require(_0x392c('0x5'))(_0x392c('0x6'));var config=require(_0x392c('0x7'));var jayson=require(_0x392c('0x8'));var client=jayson[_0x392c('0x9')][_0x392c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2615c7,_0x2229b1,_0x224cd9){return new BPromise(function(_0x23b022,_0x24ce5d){return client['request'](_0x2615c7,_0x224cd9)['then'](function(_0x1bdd85){logger['info'](_0x392c('0xb'),_0x2229b1,_0x392c('0xc'));logger[_0x392c('0xd')](_0x392c('0xe'),_0x2229b1,_0x392c('0xc'),JSON[_0x392c('0xf')](_0x1bdd85));if(_0x1bdd85[_0x392c('0x10')]){if(_0x1bdd85[_0x392c('0x10')][_0x392c('0x11')]===0x1f4){logger[_0x392c('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2229b1,_0x1bdd85[_0x392c('0x10')]['message']);return _0x24ce5d(_0x1bdd85['error'][_0x392c('0x12')]);}logger[_0x392c('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2229b1,_0x1bdd85[_0x392c('0x10')][_0x392c('0x12')]);return _0x23b022(_0x1bdd85['error'][_0x392c('0x12')]);}else{logger[_0x392c('0x13')](_0x392c('0xb'),_0x2229b1,'request\x20sent');_0x23b022(_0x1bdd85[_0x392c('0x14')][_0x392c('0x12')]);}})[_0x392c('0x15')](function(_0x511601){logger[_0x392c('0x10')](_0x392c('0xb'),_0x2229b1,_0x511601);_0x24ce5d(_0x511601);});});} \ No newline at end of file +var _0x6cef=['request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x26319d,_0x2fa694){var _0x57b1a5=function(_0x277c4e){while(--_0x277c4e){_0x26319d['push'](_0x26319d['shift']());}};_0x57b1a5(++_0x2fa694);}(_0x6cef,0x18b));var _0xf6ce=function(_0x4ea98d,_0x5c3a56){_0x4ea98d=_0x4ea98d-0x0;var _0x151023=_0x6cef[_0x4ea98d];return _0x151023;};'use strict';var _=require(_0xf6ce('0x0'));var util=require(_0xf6ce('0x1'));var moment=require(_0xf6ce('0x2'));var BPromise=require(_0xf6ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6ce('0x4'));var db=require(_0xf6ce('0x5'))['db'];var utils=require(_0xf6ce('0x6'));var logger=require(_0xf6ce('0x7'))(_0xf6ce('0x8'));var config=require(_0xf6ce('0x9'));var jayson=require(_0xf6ce('0xa'));var client=jayson[_0xf6ce('0xb')][_0xf6ce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1847be,_0x56fa53,_0x3c6017){return new BPromise(function(_0x5af217,_0x25d135){return client[_0xf6ce('0xd')](_0x1847be,_0x3c6017)[_0xf6ce('0xe')](function(_0x546112){logger[_0xf6ce('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x56fa53,_0xf6ce('0x10'));logger['debug'](_0xf6ce('0x11'),_0x56fa53,'request\x20sent',JSON['stringify'](_0x546112));if(_0x546112[_0xf6ce('0x12')]){if(_0x546112['error'][_0xf6ce('0x13')]===0x1f4){logger['error'](_0xf6ce('0x14'),_0x56fa53,_0x546112[_0xf6ce('0x12')][_0xf6ce('0x15')]);return _0x25d135(_0x546112['error'][_0xf6ce('0x15')]);}logger['error'](_0xf6ce('0x14'),_0x56fa53,_0x546112[_0xf6ce('0x12')][_0xf6ce('0x15')]);return _0x5af217(_0x546112[_0xf6ce('0x12')]['message']);}else{logger['info'](_0xf6ce('0x14'),_0x56fa53,_0xf6ce('0x10'));_0x5af217(_0x546112[_0xf6ce('0x16')][_0xf6ce('0x15')]);}})[_0xf6ce('0x17')](function(_0x553b95){logger[_0xf6ce('0x12')](_0xf6ce('0x14'),_0x56fa53,_0x553b95);_0x25d135(_0x553b95);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index d2d4863..2e8a9e0 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 _0xb853=['destroy','exports','multer','connect-timeout','Router','../../config/environment','get','index','/:id','isAuthenticated','show','update','delete'];(function(_0x2abe13,_0x1cdae5){var _0x3db615=function(_0x5d79c0){while(--_0x5d79c0){_0x2abe13['push'](_0x2abe13['shift']());}};_0x3db615(++_0x1cdae5);}(_0xb853,0x1a2));var _0x3b85=function(_0x302a85,_0x4ebe10){_0x302a85=_0x302a85-0x0;var _0x117b23=_0xb853[_0x302a85];return _0x117b23;};'use strict';var multer=require(_0x3b85('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3b85('0x1'));var express=require('express');var router=express[_0x3b85('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b85('0x3'));var controller=require('./intDynamics365Field.controller');router[_0x3b85('0x4')]('/',auth['isAuthenticated'](),controller[_0x3b85('0x5')]);router[_0x3b85('0x4')](_0x3b85('0x6'),auth[_0x3b85('0x7')](),controller[_0x3b85('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b85('0x6'),auth['isAuthenticated'](),controller[_0x3b85('0x9')]);router[_0x3b85('0xa')](_0x3b85('0x6'),auth['isAuthenticated'](),controller[_0x3b85('0xb')]);module[_0x3b85('0xc')]=router; \ No newline at end of file +var _0x9b3e=['post','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x9b3e,0x1e0));var _0xe9b3=function(_0x320129,_0x358d13){_0x320129=_0x320129-0x0;var _0xf4ad7d=_0x9b3e[_0x320129];return _0xf4ad7d;};'use strict';var multer=require(_0xe9b3('0x0'));var util=require(_0xe9b3('0x1'));var path=require('path');var timeout=require(_0xe9b3('0x2'));var express=require(_0xe9b3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe9b3('0x4'));var config=require(_0xe9b3('0x5'));var controller=require('./intDynamics365Field.controller');router[_0xe9b3('0x6')]('/',auth['isAuthenticated'](),controller[_0xe9b3('0x7')]);router[_0xe9b3('0x6')](_0xe9b3('0x8'),auth[_0xe9b3('0x9')](),controller['show']);router[_0xe9b3('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe9b3('0x8'),auth[_0xe9b3('0x9')](),controller[_0xe9b3('0xb')]);router[_0xe9b3('0xc')](_0xe9b3('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xe9b3('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 37dce37..aa1e96b 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 _0xbdae=['exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xbdae,0x196));var _0xebda=function(_0x2f5c2c,_0x7ebfaf){_0x2f5c2c=_0x2f5c2c-0x0;var _0x428e60=_0xbdae[_0x2f5c2c];return _0x428e60;};'use strict';var Sequelize=require('sequelize');module[_0xebda('0x0')]={'type':{'type':Sequelize['ENUM'](_0xebda('0x1'),_0xebda('0x2'),_0xebda('0x3'),_0xebda('0x4'),_0xebda('0x5')),'defaultValue':_0xebda('0x1')},'content':{'type':Sequelize[_0xebda('0x6')]},'key':{'type':Sequelize[_0xebda('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xebda('0x2'),_0xebda('0x3'))},'keyContent':{'type':Sequelize[_0xebda('0x6')]},'idField':{'type':Sequelize[_0xebda('0x6')]},'nameField':{'type':Sequelize[_0xebda('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xebda('0x6')]}}; \ No newline at end of file +var _0xaae3=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x1a2e26,_0x398392){var _0x446851=function(_0x535381){while(--_0x535381){_0x1a2e26['push'](_0x1a2e26['shift']());}};_0x446851(++_0x398392);}(_0xaae3,0x1c9));var _0x3aae=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0xaae3[_0x5962b4];return _0xe6443c;};'use strict';var Sequelize=require(_0x3aae('0x0'));module[_0x3aae('0x1')]={'type':{'type':Sequelize[_0x3aae('0x2')](_0x3aae('0x3'),_0x3aae('0x4'),_0x3aae('0x5'),_0x3aae('0x6'),'picklist'),'defaultValue':_0x3aae('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3aae('0x7')]},'keyType':{'type':Sequelize[_0x3aae('0x2')](_0x3aae('0x3'),_0x3aae('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3aae('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3aae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3aae('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1967693..ec6c7c6 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 _0x663a=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','filters','length','find','catch','create','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x3555f9,_0x99185f){var _0x3fe2e7=function(_0x25a445){while(--_0x25a445){_0x3555f9['push'](_0x3555f9['shift']());}};_0x3fe2e7(++_0x99185f);}(_0x663a,0x1f2));var _0xa663=function(_0x2eabba,_0x2a18cd){_0x2eabba=_0x2eabba-0x0;var _0xfc0a5e=_0x663a[_0x2eabba];return _0xfc0a5e;};'use strict';var emlformat=require(_0xa663('0x0'));var rimraf=require(_0xa663('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa663('0x2'));var rp=require(_0xa663('0x3'));var moment=require(_0xa663('0x4'));var BPromise=require(_0xa663('0x5'));var Mustache=require(_0xa663('0x6'));var util=require(_0xa663('0x7'));var path=require(_0xa663('0x8'));var sox=require(_0xa663('0x9'));var csv=require(_0xa663('0xa'));var ejs=require(_0xa663('0xb'));var fs=require('fs');var fs_extra=require(_0xa663('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa663('0xd'));var jsforce=require(_0xa663('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa663('0xa'));var querystring=require(_0xa663('0xf'));var Papa=require(_0xa663('0x10'));var Redis=require(_0xa663('0x11'));var authService=require(_0xa663('0x12'));var qs=require(_0xa663('0x13'));var as=require(_0xa663('0x14'));var hardwareService=require(_0xa663('0x15'));var logger=require(_0xa663('0x16'))(_0xa663('0x17'));var utils=require(_0xa663('0x18'));var config=require(_0xa663('0x19'));var licenseUtil=require(_0xa663('0x1a'));var db=require(_0xa663('0x1b'))['db'];function respondWithStatusCode(_0x421ad8,_0x5d143a){_0x5d143a=_0x5d143a||0xcc;return function(_0x47358f){if(_0x47358f){return _0x421ad8[_0xa663('0x1c')](_0x5d143a);}return _0x421ad8['status'](_0x5d143a)[_0xa663('0x1d')]();};}function respondWithResult(_0x2dfff4,_0x640911){_0x640911=_0x640911||0xc8;return function(_0x3caa52){if(_0x3caa52){return _0x2dfff4[_0xa663('0x1e')](_0x640911)[_0xa663('0x1f')](_0x3caa52);}};}function respondWithFilteredResult(_0x2a41ff,_0x23c1a5){return function(_0x583e67){if(_0x583e67){var _0x5c743d=typeof _0x23c1a5[_0xa663('0x20')]===_0xa663('0x21')&&typeof _0x23c1a5[_0xa663('0x22')]===_0xa663('0x21');var _0xd55358=_0x583e67[_0xa663('0x23')];var _0x25a97e=_0x5c743d?0x0:_0x23c1a5['offset'];var _0x5dcdee=_0x5c743d?_0x583e67[_0xa663('0x23')]:_0x23c1a5[_0xa663('0x20')]+_0x23c1a5[_0xa663('0x22')];var _0x881917;if(_0x5dcdee>=_0xd55358){_0x5dcdee=_0xd55358;_0x881917=0xc8;}else{_0x881917=0xce;}_0x2a41ff[_0xa663('0x1e')](_0x881917);return _0x2a41ff['set'](_0xa663('0x24'),_0x25a97e+'-'+_0x5dcdee+'/'+_0xd55358)[_0xa663('0x1f')](_0x583e67);}return null;};}function patchUpdates(_0x32e4a3){return function(_0x5600ad){try{jsonpatch[_0xa663('0x25')](_0x5600ad,_0x32e4a3,!![]);}catch(_0x41a9c4){return BPromise[_0xa663('0x26')](_0x41a9c4);}return _0x5600ad[_0xa663('0x27')]();};}function saveUpdates(_0x3559b0,_0x5d4f7e){return function(_0x32f94e){if(_0x32f94e){return _0x32f94e['update'](_0x3559b0)[_0xa663('0x28')](function(_0x2930b2){return _0x2930b2;});}return null;};}function removeEntity(_0x159198,_0x3c0f52){return function(_0x2b5266){if(_0x2b5266){return _0x2b5266[_0xa663('0x29')]()['then'](function(){_0x159198[_0xa663('0x1e')](0xcc)[_0xa663('0x1d')]();});}};}function handleEntityNotFound(_0x11fb4e,_0x4e6f35){return function(_0x4906a5){if(!_0x4906a5){_0x11fb4e[_0xa663('0x1c')](0x194);}return _0x4906a5;};}function handleError(_0x304f9d,_0x5c607b){_0x5c607b=_0x5c607b||0x1f4;return function(_0x5cfc07){logger[_0xa663('0x2a')](_0x5cfc07['stack']);if(_0x5cfc07[_0xa663('0x2b')]){delete _0x5cfc07[_0xa663('0x2b')];}_0x304f9d[_0xa663('0x1e')](_0x5c607b)[_0xa663('0x2c')](_0x5cfc07);};}exports[_0xa663('0x2d')]=function(_0x25a7f9,_0x22562b){var _0x485a78={},_0x1bd059={},_0x241368={'count':0x0,'rows':[]};var _0x2d5f2e=_[_0xa663('0x2e')](db[_0xa663('0x2f')][_0xa663('0x30')],function(_0x557df9){return{'name':_0x557df9[_0xa663('0x31')],'type':_0x557df9[_0xa663('0x32')][_0xa663('0x33')]};});_0x1bd059[_0xa663('0x34')]=_[_0xa663('0x2e')](_0x2d5f2e,'name');_0x1bd059['query']=_[_0xa663('0x35')](_0x25a7f9[_0xa663('0x36')]);_0x1bd059['filters']=_[_0xa663('0x37')](_0x1bd059['model'],_0x1bd059[_0xa663('0x36')]);_0x485a78['attributes']=_[_0xa663('0x37')](_0x1bd059[_0xa663('0x34')],qs['fields'](_0x25a7f9[_0xa663('0x36')][_0xa663('0x38')]));_0x485a78[_0xa663('0x39')]=_0x485a78[_0xa663('0x39')]['length']?_0x485a78[_0xa663('0x39')]:_0x1bd059['model'];if(!_0x25a7f9[_0xa663('0x36')][_0xa663('0x3a')]('nolimit')){_0x485a78[_0xa663('0x22')]=qs['limit'](_0x25a7f9['query'][_0xa663('0x22')]);_0x485a78['offset']=qs['offset'](_0x25a7f9['query'][_0xa663('0x20')]);}_0x485a78[_0xa663('0x3b')]=qs[_0xa663('0x3c')](_0x25a7f9[_0xa663('0x36')][_0xa663('0x3c')]);_0x485a78[_0xa663('0x3d')]=qs['filters'](_[_0xa663('0x3e')](_0x25a7f9[_0xa663('0x36')],_0x1bd059['filters']),_0x2d5f2e);if(_0x25a7f9[_0xa663('0x36')]['filter']){_0x485a78[_0xa663('0x3d')]=_[_0xa663('0x3f')](_0x485a78[_0xa663('0x3d')],{'$or':_[_0xa663('0x2e')](_0x2d5f2e,function(_0x3e758e){if(_0x3e758e[_0xa663('0x32')]!==_0xa663('0x40')){var _0x17e6e9={};_0x17e6e9[_0x3e758e['name']]={'$like':'%'+_0x25a7f9[_0xa663('0x36')][_0xa663('0x41')]+'%'};return _0x17e6e9;}})});}_0x485a78=_[_0xa663('0x3f')]({},_0x485a78,_0x25a7f9[_0xa663('0x42')]);var _0x6294d4={'where':_0x485a78[_0xa663('0x3d')]};return db[_0xa663('0x2f')][_0xa663('0x23')](_0x6294d4)['then'](function(_0x12953d){_0x241368['count']=_0x12953d;if(_0x25a7f9[_0xa663('0x36')][_0xa663('0x43')]){_0x485a78[_0xa663('0x44')]=[{'all':!![]}];}return db[_0xa663('0x2f')][_0xa663('0x45')](_0x485a78);})[_0xa663('0x28')](function(_0x459fd6){_0x241368[_0xa663('0x46')]=_0x459fd6;return _0x241368;})[_0xa663('0x28')](respondWithFilteredResult(_0x22562b,_0x485a78))['catch'](handleError(_0x22562b,null));};exports[_0xa663('0x47')]=function(_0x543e90,_0xb41c56){var _0xb92fe1={'raw':!![],'where':{'id':_0x543e90['params']['id']}},_0x31541a={};_0x31541a[_0xa663('0x34')]=_[_0xa663('0x35')](db[_0xa663('0x2f')][_0xa663('0x30')]);_0x31541a['query']=_[_0xa663('0x35')](_0x543e90['query']);_0x31541a[_0xa663('0x48')]=_[_0xa663('0x37')](_0x31541a[_0xa663('0x34')],_0x31541a['query']);_0xb92fe1[_0xa663('0x39')]=_['intersection'](_0x31541a[_0xa663('0x34')],qs[_0xa663('0x38')](_0x543e90['query'][_0xa663('0x38')]));_0xb92fe1[_0xa663('0x39')]=_0xb92fe1[_0xa663('0x39')][_0xa663('0x49')]?_0xb92fe1['attributes']:_0x31541a[_0xa663('0x34')];if(_0x543e90[_0xa663('0x36')][_0xa663('0x43')]){_0xb92fe1[_0xa663('0x44')]=[{'all':!![]}];}_0xb92fe1=_['merge']({},_0xb92fe1,_0x543e90[_0xa663('0x42')]);return db[_0xa663('0x2f')][_0xa663('0x4a')](_0xb92fe1)[_0xa663('0x28')](handleEntityNotFound(_0xb41c56,null))[_0xa663('0x28')](respondWithResult(_0xb41c56,null))[_0xa663('0x4b')](handleError(_0xb41c56,null));};exports[_0xa663('0x4c')]=function(_0x377a6d,_0x1557c9){return db['Dynamics365Field'][_0xa663('0x4c')](_0x377a6d['body'],{})['then'](respondWithResult(_0x1557c9,0xc9))['catch'](handleError(_0x1557c9,null));};exports[_0xa663('0x4d')]=function(_0x5890ea,_0x1db2bb){if(_0x5890ea[_0xa663('0x4e')]['id']){delete _0x5890ea['body']['id'];}return db[_0xa663('0x2f')][_0xa663('0x4a')]({'where':{'id':_0x5890ea[_0xa663('0x4f')]['id']}})[_0xa663('0x28')](handleEntityNotFound(_0x1db2bb,null))[_0xa663('0x28')](saveUpdates(_0x5890ea['body'],null))[_0xa663('0x28')](respondWithResult(_0x1db2bb,null))[_0xa663('0x4b')](handleError(_0x1db2bb,null));};exports[_0xa663('0x29')]=function(_0x5b47ce,_0x3a63bd){return db['Dynamics365Field']['find']({'where':{'id':_0x5b47ce['params']['id']}})[_0xa663('0x28')](handleEntityNotFound(_0x3a63bd,null))[_0xa663('0x28')](removeEntity(_0x3a63bd,null))[_0xa663('0x4b')](handleError(_0x3a63bd,null));}; \ No newline at end of file +var _0x3f33=['where','merge','VIRTUAL','options','Dynamics365Field','include','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter'];(function(_0x4df1af,_0x3a6bb6){var _0x3e78ed=function(_0x42f407){while(--_0x42f407){_0x4df1af['push'](_0x4df1af['shift']());}};_0x3e78ed(++_0x3a6bb6);}(_0x3f33,0x13e));var _0x33f3=function(_0x1a9ed0,_0x1085fc){_0x1a9ed0=_0x1a9ed0-0x0;var _0x47bbd6=_0x3f33[_0x1a9ed0];return _0x47bbd6;};'use strict';var emlformat=require(_0x33f3('0x0'));var rimraf=require(_0x33f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33f3('0x2'));var rp=require(_0x33f3('0x3'));var moment=require(_0x33f3('0x4'));var BPromise=require(_0x33f3('0x5'));var Mustache=require(_0x33f3('0x6'));var util=require(_0x33f3('0x7'));var path=require('path');var sox=require(_0x33f3('0x8'));var csv=require('to-csv');var ejs=require(_0x33f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33f3('0xa'));var squel=require(_0x33f3('0xb'));var crypto=require(_0x33f3('0xc'));var jsforce=require(_0x33f3('0xd'));var deskjs=require(_0x33f3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x33f3('0xf'));var Papa=require('papaparse');var Redis=require(_0x33f3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x33f3('0x11'));var as=require(_0x33f3('0x12'));var hardwareService=require(_0x33f3('0x13'));var logger=require(_0x33f3('0x14'))(_0x33f3('0x15'));var utils=require(_0x33f3('0x16'));var config=require(_0x33f3('0x17'));var licenseUtil=require(_0x33f3('0x18'));var db=require(_0x33f3('0x19'))['db'];function respondWithStatusCode(_0x37bd98,_0x4f7684){_0x4f7684=_0x4f7684||0xcc;return function(_0x49f703){if(_0x49f703){return _0x37bd98['sendStatus'](_0x4f7684);}return _0x37bd98[_0x33f3('0x1a')](_0x4f7684)[_0x33f3('0x1b')]();};}function respondWithResult(_0x576ad1,_0xfca8b){_0xfca8b=_0xfca8b||0xc8;return function(_0x2feaef){if(_0x2feaef){return _0x576ad1['status'](_0xfca8b)[_0x33f3('0x1c')](_0x2feaef);}};}function respondWithFilteredResult(_0x3a9e85,_0x17b47b){return function(_0x3e61b1){if(_0x3e61b1){var _0x56b6be=typeof _0x17b47b['offset']==='undefined'&&typeof _0x17b47b[_0x33f3('0x1d')]===_0x33f3('0x1e');var _0x4c6640=_0x3e61b1[_0x33f3('0x1f')];var _0x57d37f=_0x56b6be?0x0:_0x17b47b[_0x33f3('0x20')];var _0x27533e=_0x56b6be?_0x3e61b1[_0x33f3('0x1f')]:_0x17b47b[_0x33f3('0x20')]+_0x17b47b[_0x33f3('0x1d')];var _0x33e35f;if(_0x27533e>=_0x4c6640){_0x27533e=_0x4c6640;_0x33e35f=0xc8;}else{_0x33e35f=0xce;}_0x3a9e85[_0x33f3('0x1a')](_0x33e35f);return _0x3a9e85['set'](_0x33f3('0x21'),_0x57d37f+'-'+_0x27533e+'/'+_0x4c6640)[_0x33f3('0x1c')](_0x3e61b1);}return null;};}function patchUpdates(_0x337721){return function(_0x5c5c6b){try{jsonpatch[_0x33f3('0x22')](_0x5c5c6b,_0x337721,!![]);}catch(_0x818bd0){return BPromise[_0x33f3('0x23')](_0x818bd0);}return _0x5c5c6b[_0x33f3('0x24')]();};}function saveUpdates(_0x4136e5,_0x116741){return function(_0x5b4325){if(_0x5b4325){return _0x5b4325[_0x33f3('0x25')](_0x4136e5)[_0x33f3('0x26')](function(_0x58a2cd){return _0x58a2cd;});}return null;};}function removeEntity(_0xf7811e,_0x5dcf0){return function(_0x1d3472){if(_0x1d3472){return _0x1d3472[_0x33f3('0x27')]()[_0x33f3('0x26')](function(){_0xf7811e[_0x33f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50bfc6,_0x5c5bac){return function(_0x39b1d8){if(!_0x39b1d8){_0x50bfc6[_0x33f3('0x28')](0x194);}return _0x39b1d8;};}function handleError(_0x17f7ed,_0x5af631){_0x5af631=_0x5af631||0x1f4;return function(_0x5b9416){logger[_0x33f3('0x29')](_0x5b9416['stack']);if(_0x5b9416[_0x33f3('0x2a')]){delete _0x5b9416[_0x33f3('0x2a')];}_0x17f7ed[_0x33f3('0x1a')](_0x5af631)[_0x33f3('0x2b')](_0x5b9416);};}exports[_0x33f3('0x2c')]=function(_0x17c48f,_0x1ab996){var _0x5e0412={},_0x447d05={},_0x198adc={'count':0x0,'rows':[]};var _0x36786d=_['map'](db['Dynamics365Field'][_0x33f3('0x2d')],function(_0x35e617){return{'name':_0x35e617[_0x33f3('0x2e')],'type':_0x35e617[_0x33f3('0x2f')][_0x33f3('0x30')]};});_0x447d05[_0x33f3('0x31')]=_[_0x33f3('0x32')](_0x36786d,_0x33f3('0x2a'));_0x447d05[_0x33f3('0x33')]=_[_0x33f3('0x34')](_0x17c48f[_0x33f3('0x33')]);_0x447d05[_0x33f3('0x35')]=_[_0x33f3('0x36')](_0x447d05['model'],_0x447d05[_0x33f3('0x33')]);_0x5e0412[_0x33f3('0x37')]=_[_0x33f3('0x36')](_0x447d05[_0x33f3('0x31')],qs[_0x33f3('0x38')](_0x17c48f[_0x33f3('0x33')]['fields']));_0x5e0412[_0x33f3('0x37')]=_0x5e0412['attributes'][_0x33f3('0x39')]?_0x5e0412['attributes']:_0x447d05[_0x33f3('0x31')];if(!_0x17c48f[_0x33f3('0x33')][_0x33f3('0x3a')](_0x33f3('0x3b'))){_0x5e0412[_0x33f3('0x1d')]=qs[_0x33f3('0x1d')](_0x17c48f[_0x33f3('0x33')][_0x33f3('0x1d')]);_0x5e0412[_0x33f3('0x20')]=qs['offset'](_0x17c48f[_0x33f3('0x33')][_0x33f3('0x20')]);}_0x5e0412['order']=qs[_0x33f3('0x3c')](_0x17c48f['query'][_0x33f3('0x3c')]);_0x5e0412['where']=qs[_0x33f3('0x35')](_['pick'](_0x17c48f[_0x33f3('0x33')],_0x447d05[_0x33f3('0x35')]),_0x36786d);if(_0x17c48f[_0x33f3('0x33')][_0x33f3('0x3d')]){_0x5e0412[_0x33f3('0x3e')]=_[_0x33f3('0x3f')](_0x5e0412[_0x33f3('0x3e')],{'$or':_[_0x33f3('0x32')](_0x36786d,function(_0x3c23a8){if(_0x3c23a8[_0x33f3('0x2f')]!==_0x33f3('0x40')){var _0x46ae09={};_0x46ae09[_0x3c23a8[_0x33f3('0x2a')]]={'$like':'%'+_0x17c48f[_0x33f3('0x33')][_0x33f3('0x3d')]+'%'};return _0x46ae09;}})});}_0x5e0412=_['merge']({},_0x5e0412,_0x17c48f[_0x33f3('0x41')]);var _0x1ca4ce={'where':_0x5e0412[_0x33f3('0x3e')]};return db[_0x33f3('0x42')][_0x33f3('0x1f')](_0x1ca4ce)['then'](function(_0x3e9b9e){_0x198adc[_0x33f3('0x1f')]=_0x3e9b9e;if(_0x17c48f[_0x33f3('0x33')]['includeAll']){_0x5e0412[_0x33f3('0x43')]=[{'all':!![]}];}return db[_0x33f3('0x42')]['findAll'](_0x5e0412);})['then'](function(_0x2896f3){_0x198adc[_0x33f3('0x44')]=_0x2896f3;return _0x198adc;})['then'](respondWithFilteredResult(_0x1ab996,_0x5e0412))['catch'](handleError(_0x1ab996,null));};exports[_0x33f3('0x45')]=function(_0x1ffdf8,_0x52ef28){var _0xf92c5={'raw':!![],'where':{'id':_0x1ffdf8[_0x33f3('0x46')]['id']}},_0x27fa38={};_0x27fa38[_0x33f3('0x31')]=_[_0x33f3('0x34')](db['Dynamics365Field'][_0x33f3('0x2d')]);_0x27fa38[_0x33f3('0x33')]=_['keys'](_0x1ffdf8[_0x33f3('0x33')]);_0x27fa38['filters']=_['intersection'](_0x27fa38[_0x33f3('0x31')],_0x27fa38[_0x33f3('0x33')]);_0xf92c5[_0x33f3('0x37')]=_[_0x33f3('0x36')](_0x27fa38[_0x33f3('0x31')],qs[_0x33f3('0x38')](_0x1ffdf8[_0x33f3('0x33')][_0x33f3('0x38')]));_0xf92c5[_0x33f3('0x37')]=_0xf92c5[_0x33f3('0x37')][_0x33f3('0x39')]?_0xf92c5[_0x33f3('0x37')]:_0x27fa38[_0x33f3('0x31')];if(_0x1ffdf8[_0x33f3('0x33')][_0x33f3('0x47')]){_0xf92c5[_0x33f3('0x43')]=[{'all':!![]}];}_0xf92c5=_[_0x33f3('0x3f')]({},_0xf92c5,_0x1ffdf8[_0x33f3('0x41')]);return db[_0x33f3('0x42')][_0x33f3('0x48')](_0xf92c5)['then'](handleEntityNotFound(_0x52ef28,null))[_0x33f3('0x26')](respondWithResult(_0x52ef28,null))[_0x33f3('0x49')](handleError(_0x52ef28,null));};exports[_0x33f3('0x4a')]=function(_0x383ba3,_0x20ba13){return db[_0x33f3('0x42')][_0x33f3('0x4a')](_0x383ba3[_0x33f3('0x4b')],{})[_0x33f3('0x26')](respondWithResult(_0x20ba13,0xc9))[_0x33f3('0x49')](handleError(_0x20ba13,null));};exports['update']=function(_0x3638a0,_0x2dfd81){if(_0x3638a0[_0x33f3('0x4b')]['id']){delete _0x3638a0[_0x33f3('0x4b')]['id'];}return db[_0x33f3('0x42')][_0x33f3('0x48')]({'where':{'id':_0x3638a0[_0x33f3('0x46')]['id']}})[_0x33f3('0x26')](handleEntityNotFound(_0x2dfd81,null))[_0x33f3('0x26')](saveUpdates(_0x3638a0[_0x33f3('0x4b')],null))[_0x33f3('0x26')](respondWithResult(_0x2dfd81,null))[_0x33f3('0x49')](handleError(_0x2dfd81,null));};exports[_0x33f3('0x27')]=function(_0x1eb5b5,_0x4cc61f){return db['Dynamics365Field'][_0x33f3('0x48')]({'where':{'id':_0x1eb5b5[_0x33f3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cc61f,null))[_0x33f3('0x26')](removeEntity(_0x4cc61f,null))['catch'](handleError(_0x4cc61f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e97aa49..d848c20 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 _0xaecb=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xaecb,0xef));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var logger=require(_0xbaec('0x2'))(_0xbaec('0x3'));var moment=require(_0xbaec('0x4'));var BPromise=require(_0xbaec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbaec('0x6'));var attributes=require(_0xbaec('0x7'));module[_0xbaec('0x8')]=function(_0x3bf41f,_0x161ac4){return _0x3bf41f['define'](_0xbaec('0x9'),attributes,{'tableName':_0xbaec('0xa'),'paranoid':![],'indexes':[{'name':_0xbaec('0xb'),'fields':[_0xbaec('0xc'),_0xbaec('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ef3=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x4c0619,_0x58dd6b){var _0x40ee84=function(_0x507ec6){while(--_0x507ec6){_0x4c0619['push'](_0x4c0619['shift']());}};_0x40ee84(++_0x58dd6b);}(_0x9ef3,0x16d));var _0x39ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ef3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x39ef('0x0'));var util=require('util');var logger=require(_0x39ef('0x1'))(_0x39ef('0x2'));var moment=require(_0x39ef('0x3'));var BPromise=require(_0x39ef('0x4'));var rp=require(_0x39ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39ef('0x6'));var config=require(_0x39ef('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x39ef('0x8')]=function(_0xdea56,_0x1928de){return _0xdea56['define'](_0x39ef('0x9'),attributes,{'tableName':_0x39ef('0xa'),'paranoid':![],'indexes':[{'name':_0x39ef('0xb'),'fields':[_0x39ef('0xc'),_0x39ef('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index befd7bf..6138032 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 _0xd93a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x343027,_0x564e0c){var _0x98a521=function(_0x1e3583){while(--_0x1e3583){_0x343027['push'](_0x343027['shift']());}};_0x98a521(++_0x564e0c);}(_0xd93a,0x103));var _0xad93=function(_0x3e11a2,_0x3ca87a){_0x3e11a2=_0x3e11a2-0x0;var _0x5bb082=_0xd93a[_0x3e11a2];return _0x5bb082;};'use strict';var _=require(_0xad93('0x0'));var util=require(_0xad93('0x1'));var moment=require(_0xad93('0x2'));var BPromise=require(_0xad93('0x3'));var rs=require(_0xad93('0x4'));var fs=require('fs');var Redis=require(_0xad93('0x5'));var db=require(_0xad93('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xad93('0x7'))(_0xad93('0x8'));var config=require(_0xad93('0x9'));var jayson=require(_0xad93('0xa'));var client=jayson[_0xad93('0xb')][_0xad93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f198d,_0x1132b8,_0x1608da){return new BPromise(function(_0x469594,_0x4acd5c){return client[_0xad93('0xd')](_0x5f198d,_0x1608da)[_0xad93('0xe')](function(_0x58c29a){logger[_0xad93('0xf')](_0xad93('0x10'),_0x1132b8,_0xad93('0x11'));logger[_0xad93('0x12')](_0xad93('0x13'),_0x1132b8,_0xad93('0x11'),JSON[_0xad93('0x14')](_0x58c29a));if(_0x58c29a[_0xad93('0x15')]){if(_0x58c29a[_0xad93('0x15')][_0xad93('0x16')]===0x1f4){logger[_0xad93('0x15')](_0xad93('0x10'),_0x1132b8,_0x58c29a[_0xad93('0x15')][_0xad93('0x17')]);return _0x4acd5c(_0x58c29a[_0xad93('0x15')][_0xad93('0x17')]);}logger[_0xad93('0x15')](_0xad93('0x10'),_0x1132b8,_0x58c29a['error'][_0xad93('0x17')]);return _0x469594(_0x58c29a[_0xad93('0x15')][_0xad93('0x17')]);}else{logger[_0xad93('0xf')](_0xad93('0x10'),_0x1132b8,_0xad93('0x11'));_0x469594(_0x58c29a['result'][_0xad93('0x17')]);}})['catch'](function(_0x1b8733){logger[_0xad93('0x15')](_0xad93('0x10'),_0x1132b8,_0x1b8733);_0x4acd5c(_0x1b8733);});});} \ No newline at end of file +var _0x6928=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6928,0xfd));var _0x8692=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6928[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8692('0x0'));var BPromise=require('bluebird');var rs=require(_0x8692('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8692('0x2'))['db'];var utils=require(_0x8692('0x3'));var logger=require(_0x8692('0x4'))(_0x8692('0x5'));var config=require(_0x8692('0x6'));var jayson=require(_0x8692('0x7'));var client=jayson[_0x8692('0x8')][_0x8692('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ecc56,_0x4f13ab,_0x1c8358){return new BPromise(function(_0x57c9e7,_0x5b8d29){return client[_0x8692('0xa')](_0x1ecc56,_0x1c8358)[_0x8692('0xb')](function(_0x1cf43d){logger[_0x8692('0xc')](_0x8692('0xd'),_0x4f13ab,_0x8692('0xe'));logger['debug'](_0x8692('0xf'),_0x4f13ab,_0x8692('0xe'),JSON[_0x8692('0x10')](_0x1cf43d));if(_0x1cf43d[_0x8692('0x11')]){if(_0x1cf43d[_0x8692('0x11')][_0x8692('0x12')]===0x1f4){logger[_0x8692('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x4f13ab,_0x1cf43d[_0x8692('0x11')][_0x8692('0x13')]);return _0x5b8d29(_0x1cf43d[_0x8692('0x11')]['message']);}logger[_0x8692('0x11')](_0x8692('0xd'),_0x4f13ab,_0x1cf43d['error'][_0x8692('0x13')]);return _0x57c9e7(_0x1cf43d['error'][_0x8692('0x13')]);}else{logger[_0x8692('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4f13ab,_0x8692('0xe'));_0x57c9e7(_0x1cf43d[_0x8692('0x14')]['message']);}})[_0x8692('0x15')](function(_0x6235ad){logger['error'](_0x8692('0xd'),_0x4f13ab,_0x6235ad);_0x5b8d29(_0x6235ad);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e4dbabe..4c09fb7 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 _0x95ad=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','path'];(function(_0x1b48ee,_0x2d5942){var _0x154161=function(_0x3081f2){while(--_0x3081f2){_0x1b48ee['push'](_0x1b48ee['shift']());}};_0x154161(++_0x2d5942);}(_0x95ad,0x135));var _0xd95a=function(_0x2bd8d5,_0x2db5e8){_0x2bd8d5=_0x2bd8d5-0x0;var _0x522064=_0x95ad[_0x2bd8d5];return _0x522064;};'use strict';var multer=require(_0xd95a('0x0'));var util=require(_0xd95a('0x1'));var path=require(_0xd95a('0x2'));var timeout=require(_0xd95a('0x3'));var express=require(_0xd95a('0x4'));var router=express[_0xd95a('0x5')]();var fs_extra=require(_0xd95a('0x6'));var auth=require(_0xd95a('0x7'));var interaction=require(_0xd95a('0x8'));var config=require(_0xd95a('0x9'));var controller=require('./intFreshdeskAccount.controller');router[_0xd95a('0xa')]('/',auth[_0xd95a('0xb')](),controller[_0xd95a('0xc')]);router[_0xd95a('0xa')](_0xd95a('0xd'),auth[_0xd95a('0xb')](),controller[_0xd95a('0xe')]);router[_0xd95a('0xa')]('/:id/configurations',auth[_0xd95a('0xb')](),controller[_0xd95a('0xf')]);router[_0xd95a('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd95a('0x10')]);router[_0xd95a('0x11')]('/',auth[_0xd95a('0xb')](),controller[_0xd95a('0x12')]);router[_0xd95a('0x11')](_0xd95a('0x13'),auth[_0xd95a('0xb')](),controller[_0xd95a('0x14')]);router[_0xd95a('0x15')](_0xd95a('0xd'),auth[_0xd95a('0xb')](),controller[_0xd95a('0x16')]);router[_0xd95a('0x17')]('/:id',auth[_0xd95a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c4a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x5d5c49,_0x528f94){var _0x41cb72=function(_0x4fe8e2){while(--_0x4fe8e2){_0x5d5c49['push'](_0x5d5c49['shift']());}};_0x41cb72(++_0x528f94);}(_0x4c4a,0xc7));var _0xa4c4=function(_0x3eea28,_0x1cf9ec){_0x3eea28=_0x3eea28-0x0;var _0x2848cd=_0x4c4a[_0x3eea28];return _0x2848cd;};'use strict';var multer=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var path=require(_0xa4c4('0x2'));var timeout=require(_0xa4c4('0x3'));var express=require(_0xa4c4('0x4'));var router=express['Router']();var fs_extra=require(_0xa4c4('0x5'));var auth=require(_0xa4c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa4c4('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xa4c4('0x8')]('/',auth[_0xa4c4('0x9')](),controller['index']);router[_0xa4c4('0x8')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller['show']);router['get'](_0xa4c4('0xb'),auth['isAuthenticated'](),controller[_0xa4c4('0xc')]);router[_0xa4c4('0x8')](_0xa4c4('0xd'),auth['isAuthenticated'](),controller[_0xa4c4('0xe')]);router[_0xa4c4('0xf')]('/',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x10')]);router['post'](_0xa4c4('0xb'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x11')]);router['put'](_0xa4c4('0xa'),auth['isAuthenticated'](),controller[_0xa4c4('0x12')]);router[_0xa4c4('0x13')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x14')]);module[_0xa4c4('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 33b2579..cc3e9a2 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 _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1a3fe2,_0x553b71){var _0x490ee2=function(_0xc569b4){while(--_0xc569b4){_0x1a3fe2['push'](_0x1a3fe2['shift']());}};_0x490ee2(++_0x553b71);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'apiKey':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'serverUrl':{'type':Sequelize[_0xd781('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0424=['username','STRING'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0x0424,0x159));var _0x4042=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x0424[_0x3f8759];return _0x2d33ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'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 db46b46..eb2f8a9 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 _0x8b2b=['moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','FreshdeskConfiguration','FreshdeskField','Descriptions','apiKey','remoteUri','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','subject','agent','description','group','source','remove','custom_dropdown','label','default','choices','capitalize','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x459570,_0x231186){_0x459570=_0x459570-0x0;var _0x4c175c=_0x8b2b[_0x459570];return _0x4c175c;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3440bf,_0x5bd724){_0x5bd724=_0x5bd724||0xcc;return function(_0x5d6dc1){if(_0x5d6dc1){return _0x3440bf['sendStatus'](_0x5bd724);}return _0x3440bf[_0xb8b2('0x19')](_0x5bd724)[_0xb8b2('0x1a')]();};}function respondWithResult(_0x48b9df,_0x175885){_0x175885=_0x175885||0xc8;return function(_0x35ce5f){if(_0x35ce5f){return _0x48b9df[_0xb8b2('0x19')](_0x175885)[_0xb8b2('0x1b')](_0x35ce5f);}};}function respondWithFilteredResult(_0x46a592,_0x5b614d){return function(_0x4b5a28){if(_0x4b5a28){var _0xda50ef=typeof _0x5b614d[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x5b614d[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0x50dc12=_0x4b5a28['count'];var _0x129341=_0xda50ef?0x0:_0x5b614d[_0xb8b2('0x1c')];var _0x18661d=_0xda50ef?_0x4b5a28[_0xb8b2('0x1f')]:_0x5b614d['offset']+_0x5b614d[_0xb8b2('0x1e')];var _0x913200;if(_0x18661d>=_0x50dc12){_0x18661d=_0x50dc12;_0x913200=0xc8;}else{_0x913200=0xce;}_0x46a592[_0xb8b2('0x19')](_0x913200);return _0x46a592[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x129341+'-'+_0x18661d+'/'+_0x50dc12)[_0xb8b2('0x1b')](_0x4b5a28);}return null;};}function patchUpdates(_0x34ca46){return function(_0x4c1a22){try{jsonpatch[_0xb8b2('0x22')](_0x4c1a22,_0x34ca46,!![]);}catch(_0x28a2b5){return BPromise[_0xb8b2('0x23')](_0x28a2b5);}return _0x4c1a22[_0xb8b2('0x24')]();};}function saveUpdates(_0x316d3c,_0x5a0a43){return function(_0xe3b3c){if(_0xe3b3c){return _0xe3b3c['update'](_0x316d3c)[_0xb8b2('0x25')](function(_0x8239a7){return _0x8239a7;});}return null;};}function removeEntity(_0x2b40f8,_0x20082f){return function(_0x5dc876){if(_0x5dc876){return _0x5dc876[_0xb8b2('0x26')]()[_0xb8b2('0x25')](function(){_0x2b40f8[_0xb8b2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c5b1,_0x517c2a){return function(_0x585d5b){if(!_0x585d5b){_0x49c5b1[_0xb8b2('0x27')](0x194);}return _0x585d5b;};}function handleError(_0x10d8f3,_0x3bdb27){_0x3bdb27=_0x3bdb27||0x1f4;return function(_0x3b611b){logger[_0xb8b2('0x28')](_0x3b611b[_0xb8b2('0x29')]);if(_0x3b611b[_0xb8b2('0x2a')]){delete _0x3b611b[_0xb8b2('0x2a')];}_0x10d8f3[_0xb8b2('0x19')](_0x3bdb27)[_0xb8b2('0x2b')](_0x3b611b);};}exports[_0xb8b2('0x2c')]=function(_0x6ae308,_0x140b18){var _0xeb28c8={},_0x396fb3={},_0x234a63={'count':0x0,'rows':[]};var _0x3f9dc8=_['map'](db[_0xb8b2('0x2d')][_0xb8b2('0x2e')],function(_0x42b97f){return{'name':_0x42b97f[_0xb8b2('0x2f')],'type':_0x42b97f[_0xb8b2('0x30')]['key']};});_0x396fb3[_0xb8b2('0x31')]=_[_0xb8b2('0x32')](_0x3f9dc8,_0xb8b2('0x2a'));_0x396fb3['query']=_[_0xb8b2('0x33')](_0x6ae308[_0xb8b2('0x34')]);_0x396fb3['filters']=_[_0xb8b2('0x35')](_0x396fb3[_0xb8b2('0x31')],_0x396fb3[_0xb8b2('0x34')]);_0xeb28c8[_0xb8b2('0x36')]=_[_0xb8b2('0x35')](_0x396fb3[_0xb8b2('0x31')],qs[_0xb8b2('0x37')](_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x37')]));_0xeb28c8[_0xb8b2('0x36')]=_0xeb28c8['attributes'][_0xb8b2('0x38')]?_0xeb28c8[_0xb8b2('0x36')]:_0x396fb3['model'];if(!_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x39')](_0xb8b2('0x3a'))){_0xeb28c8[_0xb8b2('0x1e')]=qs[_0xb8b2('0x1e')](_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x1e')]);_0xeb28c8[_0xb8b2('0x1c')]=qs[_0xb8b2('0x1c')](_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x1c')]);}_0xeb28c8[_0xb8b2('0x3b')]=qs[_0xb8b2('0x3c')](_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x3c')]);_0xeb28c8[_0xb8b2('0x3d')]=qs[_0xb8b2('0x3e')](_[_0xb8b2('0x3f')](_0x6ae308[_0xb8b2('0x34')],_0x396fb3[_0xb8b2('0x3e')]),_0x3f9dc8);if(_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x40')]){_0xeb28c8[_0xb8b2('0x3d')]=_[_0xb8b2('0x41')](_0xeb28c8[_0xb8b2('0x3d')],{'$or':_[_0xb8b2('0x32')](_0x3f9dc8,function(_0x1ec12b){if(_0x1ec12b['type']!=='VIRTUAL'){var _0x79d89b={};_0x79d89b[_0x1ec12b['name']]={'$like':'%'+_0x6ae308[_0xb8b2('0x34')][_0xb8b2('0x40')]+'%'};return _0x79d89b;}})});}_0xeb28c8=_[_0xb8b2('0x41')]({},_0xeb28c8,_0x6ae308[_0xb8b2('0x42')]);var _0x55566a={'where':_0xeb28c8['where']};return db[_0xb8b2('0x2d')][_0xb8b2('0x1f')](_0x55566a)[_0xb8b2('0x25')](function(_0x20c93f){_0x234a63[_0xb8b2('0x1f')]=_0x20c93f;if(_0x6ae308['query'][_0xb8b2('0x43')]){_0xeb28c8[_0xb8b2('0x44')]=[{'all':!![]}];}return db[_0xb8b2('0x2d')][_0xb8b2('0x45')](_0xeb28c8);})[_0xb8b2('0x25')](function(_0x509ff1){_0x234a63[_0xb8b2('0x46')]=_0x509ff1;return _0x234a63;})[_0xb8b2('0x25')](respondWithFilteredResult(_0x140b18,_0xeb28c8))[_0xb8b2('0x47')](handleError(_0x140b18,null));};exports[_0xb8b2('0x48')]=function(_0x1890fc,_0x1f0ed2){var _0x37370a={'raw':![],'where':{'id':_0x1890fc[_0xb8b2('0x49')]['id']}},_0x339c2e={};_0x339c2e[_0xb8b2('0x31')]=_['keys'](db['FreshdeskAccount'][_0xb8b2('0x2e')]);_0x339c2e['query']=_[_0xb8b2('0x33')](_0x1890fc[_0xb8b2('0x34')]);_0x339c2e[_0xb8b2('0x3e')]=_[_0xb8b2('0x35')](_0x339c2e[_0xb8b2('0x31')],_0x339c2e['query']);_0x37370a[_0xb8b2('0x36')]=_[_0xb8b2('0x35')](_0x339c2e[_0xb8b2('0x31')],qs[_0xb8b2('0x37')](_0x1890fc[_0xb8b2('0x34')][_0xb8b2('0x37')]));_0x37370a[_0xb8b2('0x36')]=_0x37370a[_0xb8b2('0x36')][_0xb8b2('0x38')]?_0x37370a[_0xb8b2('0x36')]:_0x339c2e[_0xb8b2('0x31')];if(_0x1890fc['query'][_0xb8b2('0x43')]){_0x37370a[_0xb8b2('0x44')]=[{'all':!![]}];}_0x37370a=_[_0xb8b2('0x41')]({},_0x37370a,_0x1890fc[_0xb8b2('0x42')]);return db[_0xb8b2('0x2d')][_0xb8b2('0x4a')](_0x37370a)[_0xb8b2('0x25')](handleEntityNotFound(_0x1f0ed2,null))[_0xb8b2('0x25')](respondWithResult(_0x1f0ed2,null))[_0xb8b2('0x47')](handleError(_0x1f0ed2,null));};exports[_0xb8b2('0x4b')]=function(_0x2f6795,_0xcc853b){return db[_0xb8b2('0x2d')]['create'](_0x2f6795[_0xb8b2('0x4c')],{})[_0xb8b2('0x25')](respondWithResult(_0xcc853b,0xc9))['catch'](handleError(_0xcc853b,null));};exports[_0xb8b2('0x4d')]=function(_0x2b9c9a,_0x3d94d1){if(_0x2b9c9a['body']['id']){delete _0x2b9c9a[_0xb8b2('0x4c')]['id'];}return db[_0xb8b2('0x2d')][_0xb8b2('0x4a')]({'where':{'id':_0x2b9c9a[_0xb8b2('0x49')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x3d94d1,null))[_0xb8b2('0x25')](saveUpdates(_0x2b9c9a[_0xb8b2('0x4c')],null))[_0xb8b2('0x25')](respondWithResult(_0x3d94d1,null))[_0xb8b2('0x47')](handleError(_0x3d94d1,null));};exports[_0xb8b2('0x26')]=function(_0x79ae95,_0x4434b3){return db[_0xb8b2('0x2d')][_0xb8b2('0x4a')]({'where':{'id':_0x79ae95[_0xb8b2('0x49')]['id']}})['then'](handleEntityNotFound(_0x4434b3,null))['then'](removeEntity(_0x4434b3,null))[_0xb8b2('0x47')](handleError(_0x4434b3,null));};exports[_0xb8b2('0x4e')]=function(_0x5d8cbd,_0x765436,_0x14f67e){var _0x474859={};var _0x58c807={};var _0x422584;var _0x3a07b5;return db[_0xb8b2('0x2d')][_0xb8b2('0x4f')]({'where':{'id':_0x5d8cbd[_0xb8b2('0x49')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x765436,null))[_0xb8b2('0x25')](function(_0x25ad26){if(_0x25ad26){_0x422584=_0x25ad26;_0x58c807['model']=_[_0xb8b2('0x33')](db['FreshdeskConfiguration'][_0xb8b2('0x2e')]);_0x58c807[_0xb8b2('0x34')]=_[_0xb8b2('0x33')](_0x5d8cbd[_0xb8b2('0x34')]);_0x58c807[_0xb8b2('0x3e')]=_[_0xb8b2('0x35')](_0x58c807[_0xb8b2('0x31')],_0x58c807['query']);_0x474859[_0xb8b2('0x36')]=_[_0xb8b2('0x35')](_0x58c807[_0xb8b2('0x31')],qs[_0xb8b2('0x37')](_0x5d8cbd[_0xb8b2('0x34')]['fields']));_0x474859[_0xb8b2('0x36')]=_0x474859['attributes']['length']?_0x474859[_0xb8b2('0x36')]:_0x58c807[_0xb8b2('0x31')];_0x474859[_0xb8b2('0x3b')]=qs[_0xb8b2('0x3c')](_0x5d8cbd[_0xb8b2('0x34')][_0xb8b2('0x3c')]);_0x474859[_0xb8b2('0x3d')]=qs[_0xb8b2('0x3e')](_[_0xb8b2('0x3f')](_0x5d8cbd[_0xb8b2('0x34')],_0x58c807[_0xb8b2('0x3e')]));if(_0x5d8cbd[_0xb8b2('0x34')]['filter']){_0x474859[_0xb8b2('0x3d')]=_[_0xb8b2('0x41')](_0x474859['where'],{'$or':_[_0xb8b2('0x32')](_0x474859[_0xb8b2('0x36')],function(_0x3be2b8){var _0xc8aed5={};_0xc8aed5[_0x3be2b8]={'$like':'%'+_0x5d8cbd[_0xb8b2('0x34')]['filter']+'%'};return _0xc8aed5;})});}_0x474859=_[_0xb8b2('0x41')]({},_0x474859,_0x5d8cbd['options']);return _0x422584[_0xb8b2('0x4e')](_0x474859);}})[_0xb8b2('0x25')](function(_0x35bd1d){if(_0x35bd1d){_0x3a07b5=_0x35bd1d['length'];if(!_0x5d8cbd[_0xb8b2('0x34')][_0xb8b2('0x39')](_0xb8b2('0x3a'))){_0x474859[_0xb8b2('0x1e')]=qs[_0xb8b2('0x1e')](_0x5d8cbd['query']['limit']);_0x474859[_0xb8b2('0x1c')]=qs[_0xb8b2('0x1c')](_0x5d8cbd[_0xb8b2('0x34')][_0xb8b2('0x1c')]);}return _0x422584[_0xb8b2('0x4e')](_0x474859);}})[_0xb8b2('0x25')](function(_0x40d79b){if(_0x40d79b){return _0x40d79b?{'count':_0x3a07b5,'rows':_0x40d79b}:null;}})[_0xb8b2('0x25')](respondWithResult(_0x765436,null))['catch'](handleError(_0x765436,null));};exports[_0xb8b2('0x50')]=function(_0x4f25bb,_0x4a248b,_0x1bae0f){if(_0x4f25bb[_0xb8b2('0x4c')]['id']){delete _0x4f25bb[_0xb8b2('0x4c')]['id'];}return db[_0xb8b2('0x2d')][_0xb8b2('0x4f')]({'where':{'id':_0x4f25bb[_0xb8b2('0x49')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x4a248b,null))[_0xb8b2('0x25')](function(_0x552719){if(_0x552719){_0x4f25bb[_0xb8b2('0x4c')][_0xb8b2('0x51')]=_0x552719['id'];_0x4f25bb['body'][_0xb8b2('0x52')]=integrations['getSubjects'](_0x4f25bb[_0xb8b2('0x4c')][_0xb8b2('0x53')],_0x4f25bb[_0xb8b2('0x4c')][_0xb8b2('0x30')]);_0x4f25bb[_0xb8b2('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x4f25bb[_0xb8b2('0x4c')][_0xb8b2('0x53')],_0x4f25bb['body'][_0xb8b2('0x30')]);return db[_0xb8b2('0x54')][_0xb8b2('0x4b')](_0x4f25bb['body'],{'include':[{'model':db[_0xb8b2('0x55')],'as':_0xb8b2('0x52')},{'model':db['FreshdeskField'],'as':_0xb8b2('0x56')}]});}return null;})[_0xb8b2('0x25')](respondWithResult(_0x4a248b,null))['catch'](handleError(_0x4a248b,null));};exports['getFields']=function(_0x41251c,_0x1b5402,_0x2a7709){var _0x5f206d='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x41251c[_0xb8b2('0x49')]['id']},'attributes':['id','remoteUri',_0xb8b2('0x57')]})[_0xb8b2('0x25')](handleEntityNotFound(_0x1b5402,null))[_0xb8b2('0x25')](function(_0x3610d4){if(_0x3610d4){_0x5f206d=_0x3610d4[_0xb8b2('0x58')];var _0x3f5b9f=_0x5f206d['slice'](-0x1);if(_0x3f5b9f==='/'){_0x5f206d=_0x5f206d['substring'](0x0,_0x5f206d[_0xb8b2('0x59')](_0x3f5b9f));}return rp({'method':_0xb8b2('0x5a'),'uri':util['format'](_0xb8b2('0x5b'),_0x5f206d,_0xb8b2('0x5c')),'headers':{'Authorization':util[_0xb8b2('0x5d')](_0xb8b2('0x5e'),new Buffer(util[_0xb8b2('0x5d')]('%s:X',_0x3610d4[_0xb8b2('0x57')]))[_0xb8b2('0x5f')](_0xb8b2('0x60')))},'json':!![]});}})['then'](function(_0xbdc200){if(_0xbdc200){var _0x2de419=['requester',_0xb8b2('0x61'),_0xb8b2('0x62'),_0xb8b2('0x63'),_0xb8b2('0x19'),'priority',_0xb8b2('0x64'),_0xb8b2('0x65'),'ticket_type',_0xb8b2('0x64'),'company'];_[_0xb8b2('0x66')](_0xbdc200,function(_0xf719bb){return _0x2de419['includes'](_0xf719bb['name'])||!_0xf719bb['default']&&_0xf719bb['type']!=='custom_text'&&_0xf719bb['type']!==_0xb8b2('0x67');});return{'count':_0xbdc200[_0xb8b2('0x38')],'rows':_[_0xb8b2('0x32')](_0xbdc200,function(_0x4076ca){return{'id':_0x4076ca[_0xb8b2('0x2a')],'name':_0x4076ca[_0xb8b2('0x68')],'custom':!_0x4076ca[_0xb8b2('0x69')],'options':_0x4076ca[_0xb8b2('0x6a')]?_[_0xb8b2('0x32')](_0x4076ca[_0xb8b2('0x6a')],function(_0xc86c24){return{'name':_[_0xb8b2('0x6b')](_0xc86c24),'value':_0xc86c24};}):[]};})};}})['then'](respondWithResult(_0x1b5402,null))['catch'](function(_0x13413e){var _0xf2946b=_0x41251c[_0xb8b2('0x34')]['test']?0x1f4:_0x13413e['statusCode']||0x1f4;logger[_0xb8b2('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xb8b2('0x6c'),_0xf2946b,JSON[_0xb8b2('0x6d')](_0x13413e));delete _0x13413e[_0xb8b2('0x2a')];if(_0xf2946b===0x191){_0xf2946b=0x190;}_0x1b5402[_0xb8b2('0x19')](_0xf2946b)['send'](_0x41251c[_0xb8b2('0x34')][_0xb8b2('0x6e')]?{'message':_0xb8b2('0x6f'),'statusCode':_0x13413e[_0xb8b2('0x70')]}:_0x13413e);});}; \ No newline at end of file +var _0xbd5f=['%s:X','toString','requester','agent','priority','group','source','ticket_type','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','create','body','catch','find','findOne','FreshdeskConfiguration','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','format'];(function(_0x455ca6,_0x3191e3){var _0x514936=function(_0x2e9c74){while(--_0x2e9c74){_0x455ca6['push'](_0x455ca6['shift']());}};_0x514936(++_0x3191e3);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x24e123,_0x2dde41){_0x24e123=_0x24e123-0x0;var _0x3ab582=_0xbd5f[_0x24e123];return _0x3ab582;};'use strict';var emlformat=require(_0xfbd5('0x0'));var rimraf=require(_0xfbd5('0x1'));var zipdir=require(_0xfbd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbd5('0x3'));var moment=require('moment');var BPromise=require(_0xfbd5('0x4'));var Mustache=require('mustache');var util=require(_0xfbd5('0x5'));var path=require(_0xfbd5('0x6'));var sox=require(_0xfbd5('0x7'));var csv=require(_0xfbd5('0x8'));var ejs=require(_0xfbd5('0x9'));var fs=require('fs');var fs_extra=require(_0xfbd5('0xa'));var _=require(_0xfbd5('0xb'));var squel=require('squel');var crypto=require(_0xfbd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbd5('0x8'));var querystring=require('querystring');var Papa=require(_0xfbd5('0xd'));var Redis=require(_0xfbd5('0xe'));var authService=require(_0xfbd5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd5('0x10'))(_0xfbd5('0x11'));var utils=require(_0xfbd5('0x12'));var config=require(_0xfbd5('0x13'));var licenseUtil=require(_0xfbd5('0x14'));var db=require(_0xfbd5('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12d472,_0x5bc15f){_0x5bc15f=_0x5bc15f||0xcc;return function(_0xaadca0){if(_0xaadca0){return _0x12d472[_0xfbd5('0x16')](_0x5bc15f);}return _0x12d472['status'](_0x5bc15f)['end']();};}function respondWithResult(_0x82027d,_0x2db3b0){_0x2db3b0=_0x2db3b0||0xc8;return function(_0x2eb58a){if(_0x2eb58a){return _0x82027d[_0xfbd5('0x17')](_0x2db3b0)[_0xfbd5('0x18')](_0x2eb58a);}};}function respondWithFilteredResult(_0x1e09be,_0x1918aa){return function(_0x288d71){if(_0x288d71){var _0x48efb8=typeof _0x1918aa[_0xfbd5('0x19')]===_0xfbd5('0x1a')&&typeof _0x1918aa[_0xfbd5('0x1b')]==='undefined';var _0x472325=_0x288d71[_0xfbd5('0x1c')];var _0x56c8f4=_0x48efb8?0x0:_0x1918aa[_0xfbd5('0x19')];var _0x51cc13=_0x48efb8?_0x288d71['count']:_0x1918aa[_0xfbd5('0x19')]+_0x1918aa[_0xfbd5('0x1b')];var _0x4b3d44;if(_0x51cc13>=_0x472325){_0x51cc13=_0x472325;_0x4b3d44=0xc8;}else{_0x4b3d44=0xce;}_0x1e09be[_0xfbd5('0x17')](_0x4b3d44);return _0x1e09be[_0xfbd5('0x1d')]('Content-Range',_0x56c8f4+'-'+_0x51cc13+'/'+_0x472325)[_0xfbd5('0x18')](_0x288d71);}return null;};}function patchUpdates(_0x364c0c){return function(_0x4a3d68){try{jsonpatch[_0xfbd5('0x1e')](_0x4a3d68,_0x364c0c,!![]);}catch(_0x5b9911){return BPromise[_0xfbd5('0x1f')](_0x5b9911);}return _0x4a3d68[_0xfbd5('0x20')]();};}function saveUpdates(_0x22c032,_0x32dd82){return function(_0x4da1e3){if(_0x4da1e3){return _0x4da1e3[_0xfbd5('0x21')](_0x22c032)[_0xfbd5('0x22')](function(_0x6f4990){return _0x6f4990;});}return null;};}function removeEntity(_0x1e2702,_0x3b7aa7){return function(_0x2ddfd3){if(_0x2ddfd3){return _0x2ddfd3[_0xfbd5('0x23')]()[_0xfbd5('0x22')](function(){_0x1e2702['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d5d1,_0x2a6f8c){return function(_0x16faad){if(!_0x16faad){_0x51d5d1[_0xfbd5('0x16')](0x194);}return _0x16faad;};}function handleError(_0x5195c3,_0x5b2080){_0x5b2080=_0x5b2080||0x1f4;return function(_0x12d3c3){logger[_0xfbd5('0x24')](_0x12d3c3[_0xfbd5('0x25')]);if(_0x12d3c3[_0xfbd5('0x26')]){delete _0x12d3c3[_0xfbd5('0x26')];}_0x5195c3[_0xfbd5('0x17')](_0x5b2080)[_0xfbd5('0x27')](_0x12d3c3);};}exports[_0xfbd5('0x28')]=function(_0x582ad8,_0x284301){var _0x903794={},_0x195f41={},_0x3a18d8={'count':0x0,'rows':[]};var _0x4c1d97=_[_0xfbd5('0x29')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')],function(_0x443900){return{'name':_0x443900[_0xfbd5('0x2c')],'type':_0x443900[_0xfbd5('0x2d')][_0xfbd5('0x2e')]};});_0x195f41[_0xfbd5('0x2f')]=_[_0xfbd5('0x29')](_0x4c1d97,'name');_0x195f41[_0xfbd5('0x30')]=_[_0xfbd5('0x31')](_0x582ad8[_0xfbd5('0x30')]);_0x195f41[_0xfbd5('0x32')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],_0x195f41['query']);_0x903794[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x582ad8['query']['fields']));_0x903794['attributes']=_0x903794[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x903794[_0xfbd5('0x34')]:_0x195f41['model'];if(!_0x582ad8['query'][_0xfbd5('0x37')](_0xfbd5('0x38'))){_0x903794['limit']=qs['limit'](_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x1b')]);_0x903794[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x582ad8['query'][_0xfbd5('0x19')]);}_0x903794[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x582ad8['query'][_0xfbd5('0x3a')]);_0x903794[_0xfbd5('0x3b')]=qs['filters'](_[_0xfbd5('0x3c')](_0x582ad8[_0xfbd5('0x30')],_0x195f41[_0xfbd5('0x32')]),_0x4c1d97);if(_0x582ad8['query'][_0xfbd5('0x3d')]){_0x903794[_0xfbd5('0x3b')]=_[_0xfbd5('0x3e')](_0x903794[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x4c1d97,function(_0x4901cd){if(_0x4901cd[_0xfbd5('0x2d')]!==_0xfbd5('0x3f')){var _0x2387b1={};_0x2387b1[_0x4901cd[_0xfbd5('0x26')]]={'$like':'%'+_0x582ad8[_0xfbd5('0x30')]['filter']+'%'};return _0x2387b1;}})});}_0x903794=_[_0xfbd5('0x3e')]({},_0x903794,_0x582ad8['options']);var _0x3c4b10={'where':_0x903794[_0xfbd5('0x3b')]};return db[_0xfbd5('0x2a')][_0xfbd5('0x1c')](_0x3c4b10)[_0xfbd5('0x22')](function(_0x5b5a76){_0x3a18d8[_0xfbd5('0x1c')]=_0x5b5a76;if(_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x903794[_0xfbd5('0x41')]=[{'all':!![]}];}return db[_0xfbd5('0x2a')]['findAll'](_0x903794);})[_0xfbd5('0x22')](function(_0x3440b0){_0x3a18d8['rows']=_0x3440b0;return _0x3a18d8;})[_0xfbd5('0x22')](respondWithFilteredResult(_0x284301,_0x903794))['catch'](handleError(_0x284301,null));};exports[_0xfbd5('0x42')]=function(_0x43ae35,_0x5c502f){var _0x290ee4={'raw':![],'where':{'id':_0x43ae35[_0xfbd5('0x43')]['id']}},_0x2a976d={};_0x2a976d[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')]);_0x2a976d[_0xfbd5('0x30')]=_['keys'](_0x43ae35['query']);_0x2a976d['filters']=_['intersection'](_0x2a976d[_0xfbd5('0x2f')],_0x2a976d[_0xfbd5('0x30')]);_0x290ee4[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x2a976d[_0xfbd5('0x2f')],qs['fields'](_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x290ee4['attributes']=_0x290ee4['attributes'][_0xfbd5('0x36')]?_0x290ee4[_0xfbd5('0x34')]:_0x2a976d[_0xfbd5('0x2f')];if(_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x290ee4[_0xfbd5('0x41')]=[{'all':!![]}];}_0x290ee4=_[_0xfbd5('0x3e')]({},_0x290ee4,_0x43ae35[_0xfbd5('0x44')]);return db[_0xfbd5('0x2a')]['find'](_0x290ee4)[_0xfbd5('0x22')](handleEntityNotFound(_0x5c502f,null))[_0xfbd5('0x22')](respondWithResult(_0x5c502f,null))['catch'](handleError(_0x5c502f,null));};exports[_0xfbd5('0x45')]=function(_0x2285f9,_0x2764d0){return db[_0xfbd5('0x2a')][_0xfbd5('0x45')](_0x2285f9[_0xfbd5('0x46')],{})['then'](respondWithResult(_0x2764d0,0xc9))[_0xfbd5('0x47')](handleError(_0x2764d0,null));};exports[_0xfbd5('0x21')]=function(_0x5df44d,_0x5e0475){if(_0x5df44d['body']['id']){delete _0x5df44d[_0xfbd5('0x46')]['id'];}return db['FreshdeskAccount'][_0xfbd5('0x48')]({'where':{'id':_0x5df44d[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x5e0475,null))[_0xfbd5('0x22')](saveUpdates(_0x5df44d['body'],null))['then'](respondWithResult(_0x5e0475,null))['catch'](handleError(_0x5e0475,null));};exports[_0xfbd5('0x23')]=function(_0x14eca5,_0x14c4ff){return db[_0xfbd5('0x2a')]['find']({'where':{'id':_0x14eca5[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x14c4ff,null))[_0xfbd5('0x22')](removeEntity(_0x14c4ff,null))[_0xfbd5('0x47')](handleError(_0x14c4ff,null));};exports['getConfigurations']=function(_0x48c0d6,_0xa718dd,_0x4b55db){var _0x522bec={};var _0x110368={};var _0x9f848e;var _0x2d37bc;return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x48c0d6[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xa718dd,null))[_0xfbd5('0x22')](function(_0x1cd8b4){if(_0x1cd8b4){_0x9f848e=_0x1cd8b4;_0x110368[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x4a')][_0xfbd5('0x2b')]);_0x110368['query']=_[_0xfbd5('0x31')](_0x48c0d6['query']);_0x110368[_0xfbd5('0x32')]=_['intersection'](_0x110368[_0xfbd5('0x2f')],_0x110368['query']);_0x522bec[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x110368[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x48c0d6[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x522bec['attributes']=_0x522bec[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x522bec[_0xfbd5('0x34')]:_0x110368[_0xfbd5('0x2f')];_0x522bec[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x48c0d6['query'][_0xfbd5('0x3a')]);_0x522bec[_0xfbd5('0x3b')]=qs[_0xfbd5('0x32')](_[_0xfbd5('0x3c')](_0x48c0d6[_0xfbd5('0x30')],_0x110368[_0xfbd5('0x32')]));if(_0x48c0d6[_0xfbd5('0x30')]['filter']){_0x522bec['where']=_[_0xfbd5('0x3e')](_0x522bec[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x522bec['attributes'],function(_0x34882e){var _0x5b2d9a={};_0x5b2d9a[_0x34882e]={'$like':'%'+_0x48c0d6['query']['filter']+'%'};return _0x5b2d9a;})});}_0x522bec=_[_0xfbd5('0x3e')]({},_0x522bec,_0x48c0d6[_0xfbd5('0x44')]);return _0x9f848e[_0xfbd5('0x4b')](_0x522bec);}})[_0xfbd5('0x22')](function(_0x404801){if(_0x404801){_0x2d37bc=_0x404801['length'];if(!_0x48c0d6['query']['hasOwnProperty'](_0xfbd5('0x38'))){_0x522bec[_0xfbd5('0x1b')]=qs[_0xfbd5('0x1b')](_0x48c0d6[_0xfbd5('0x30')]['limit']);_0x522bec[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x48c0d6[_0xfbd5('0x30')]['offset']);}return _0x9f848e['getConfigurations'](_0x522bec);}})[_0xfbd5('0x22')](function(_0x5c3ca7){if(_0x5c3ca7){return _0x5c3ca7?{'count':_0x2d37bc,'rows':_0x5c3ca7}:null;}})[_0xfbd5('0x22')](respondWithResult(_0xa718dd,null))['catch'](handleError(_0xa718dd,null));};exports['addConfiguration']=function(_0x53a135,_0xf67581,_0x583164){if(_0x53a135[_0xfbd5('0x46')]['id']){delete _0x53a135[_0xfbd5('0x46')]['id'];}return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x53a135[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xf67581,null))[_0xfbd5('0x22')](function(_0x1c4bcf){if(_0x1c4bcf){_0x53a135[_0xfbd5('0x46')]['AccountId']=_0x1c4bcf['id'];_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x4c')]=integrations[_0xfbd5('0x4d')](_0x53a135['body']['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);_0x53a135['body'][_0xfbd5('0x4e')]=integrations[_0xfbd5('0x4f')](_0x53a135[_0xfbd5('0x46')]['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);return db['FreshdeskConfiguration'][_0xfbd5('0x45')](_0x53a135[_0xfbd5('0x46')],{'include':[{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4c')},{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4e')}]});}return null;})[_0xfbd5('0x22')](respondWithResult(_0xf67581,null))[_0xfbd5('0x47')](handleError(_0xf67581,null));};exports[_0xfbd5('0x51')]=function(_0x370ee7,_0x1b6dae,_0x35db5d){var _0x11ba00='';return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x370ee7[_0xfbd5('0x43')]['id']},'attributes':['id',_0xfbd5('0x52'),_0xfbd5('0x53')]})[_0xfbd5('0x22')](handleEntityNotFound(_0x1b6dae,null))[_0xfbd5('0x22')](function(_0x2ab57a){if(_0x2ab57a){_0x11ba00=_0x2ab57a[_0xfbd5('0x52')];var _0x23317e=_0x11ba00[_0xfbd5('0x54')](-0x1);if(_0x23317e==='/'){_0x11ba00=_0x11ba00[_0xfbd5('0x55')](0x0,_0x11ba00[_0xfbd5('0x56')](_0x23317e));}return rp({'method':_0xfbd5('0x57'),'uri':util['format'](_0xfbd5('0x58'),_0x11ba00,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xfbd5('0x59')]('Basic\x20%s',new Buffer(util[_0xfbd5('0x59')](_0xfbd5('0x5a'),_0x2ab57a[_0xfbd5('0x53')]))[_0xfbd5('0x5b')]('base64'))},'json':!![]});}})['then'](function(_0x14d9d7){if(_0x14d9d7){var _0x19ea66=[_0xfbd5('0x5c'),'subject',_0xfbd5('0x5d'),'description',_0xfbd5('0x17'),_0xfbd5('0x5e'),_0xfbd5('0x5f'),_0xfbd5('0x60'),_0xfbd5('0x61'),_0xfbd5('0x5f'),'company'];_['remove'](_0x14d9d7,function(_0x51f670){return _0x19ea66[_0xfbd5('0x62')](_0x51f670[_0xfbd5('0x26')])||!_0x51f670[_0xfbd5('0x63')]&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x64')&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x65');});return{'count':_0x14d9d7['length'],'rows':_['map'](_0x14d9d7,function(_0x24a625){return{'id':_0x24a625['name'],'name':_0x24a625['label'],'custom':!_0x24a625[_0xfbd5('0x63')],'options':_0x24a625[_0xfbd5('0x66')]?_[_0xfbd5('0x29')](_0x24a625[_0xfbd5('0x66')],function(_0x109ad5){return{'name':_[_0xfbd5('0x67')](_0x109ad5),'value':_0x109ad5};}):[]};})};}})[_0xfbd5('0x22')](respondWithResult(_0x1b6dae,null))[_0xfbd5('0x47')](function(_0x5942b5){var _0x462f53=_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?0x1f4:_0x5942b5[_0xfbd5('0x69')]||0x1f4;logger[_0xfbd5('0x24')](_0xfbd5('0x6a'),_0xfbd5('0x51'),_0x462f53,JSON[_0xfbd5('0x6b')](_0x5942b5));delete _0x5942b5['name'];if(_0x462f53===0x191){_0x462f53=0x190;}_0x1b6dae[_0xfbd5('0x17')](_0x462f53)['send'](_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?{'message':_0xfbd5('0x6c'),'statusCode':_0x5942b5[_0xfbd5('0x69')]}:_0x5942b5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3dc0492..1d8ccf8 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 _0x0fc9=['path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x167307,_0x5a60ae){var _0x550140=function(_0x5b5009){while(--_0x5b5009){_0x167307['push'](_0x167307['shift']());}};_0x550140(++_0x5a60ae);}(_0x0fc9,0x94));var _0x90fc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0fc9[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x90fc('0x0'));var util=require(_0x90fc('0x1'));var logger=require(_0x90fc('0x2'))(_0x90fc('0x3'));var moment=require(_0x90fc('0x4'));var BPromise=require(_0x90fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90fc('0x6'));var rimraf=require('rimraf');var config=require(_0x90fc('0x7'));var attributes=require(_0x90fc('0x8'));var integrations=require(_0x90fc('0x9'));module[_0x90fc('0xa')]=function(_0x379c55,_0x939d98){return _0x379c55[_0x90fc('0xb')](_0x90fc('0xc'),attributes,{'tableName':_0x90fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadda=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x5d401c,_0x16b432){var _0x1e9c2e=function(_0x5b81e8){while(--_0x5b81e8){_0x5d401c['push'](_0x5d401c['shift']());}};_0x1e9c2e(++_0x16b432);}(_0xadda,0xcf));var _0xaadd=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xadda[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xaadd('0x0'));var util=require(_0xaadd('0x1'));var logger=require(_0xaadd('0x2'))('api');var moment=require(_0xaadd('0x3'));var BPromise=require(_0xaadd('0x4'));var rp=require(_0xaadd('0x5'));var fs=require('fs');var path=require(_0xaadd('0x6'));var rimraf=require(_0xaadd('0x7'));var config=require(_0xaadd('0x8'));var attributes=require(_0xaadd('0x9'));var integrations=require(_0xaadd('0xa'));module[_0xaadd('0xb')]=function(_0x4a42ee,_0x2edb61){return _0x4a42ee[_0xaadd('0xc')](_0xaadd('0xd'),attributes,{'tableName':_0xaadd('0xe'),'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 fd2427a..1253825 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 _0xb5f6=['error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x912e82,_0x48d569){var _0x4706f9=function(_0xe4c32e){while(--_0xe4c32e){_0x912e82['push'](_0x912e82['shift']());}};_0x4706f9(++_0x48d569);}(_0xb5f6,0x12a));var _0x6b5f=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xb5f6[_0x13187a];return _0x65b85f;};'use strict';var _=require('lodash');var util=require(_0x6b5f('0x0'));var moment=require(_0x6b5f('0x1'));var BPromise=require(_0x6b5f('0x2'));var rs=require(_0x6b5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b5f('0x4'))['db'];var utils=require(_0x6b5f('0x5'));var logger=require('../../config/logger')(_0x6b5f('0x6'));var config=require(_0x6b5f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6b5f('0x8')][_0x6b5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40db17,_0x502260,_0x2d8a2b){return new BPromise(function(_0x517f26,_0xc51d45){return client[_0x6b5f('0xa')](_0x40db17,_0x2d8a2b)[_0x6b5f('0xb')](function(_0x2cbf21){logger[_0x6b5f('0xc')](_0x6b5f('0xd'),_0x502260,'request\x20sent');logger['debug'](_0x6b5f('0xe'),_0x502260,_0x6b5f('0xf'),JSON[_0x6b5f('0x10')](_0x2cbf21));if(_0x2cbf21[_0x6b5f('0x11')]){if(_0x2cbf21['error'][_0x6b5f('0x12')]===0x1f4){logger['error'](_0x6b5f('0xd'),_0x502260,_0x2cbf21[_0x6b5f('0x11')]['message']);return _0xc51d45(_0x2cbf21[_0x6b5f('0x11')][_0x6b5f('0x13')]);}logger[_0x6b5f('0x11')](_0x6b5f('0xd'),_0x502260,_0x2cbf21[_0x6b5f('0x11')][_0x6b5f('0x13')]);return _0x517f26(_0x2cbf21[_0x6b5f('0x11')][_0x6b5f('0x13')]);}else{logger[_0x6b5f('0xc')](_0x6b5f('0xd'),_0x502260,_0x6b5f('0xf'));_0x517f26(_0x2cbf21[_0x6b5f('0x14')][_0x6b5f('0x13')]);}})[_0x6b5f('0x15')](function(_0x450daf){logger['error'](_0x6b5f('0xd'),_0x502260,_0x450daf);_0xc51d45(_0x450daf);});});}exports[_0x6b5f('0x16')]=function(_0x50f816){var _0x1607b8=this;return new Promise(function(_0x7d0374,_0x5a3ba0){return db[_0x6b5f('0x17')][_0x6b5f('0x18')]({'raw':_0x50f816['options']?_0x50f816[_0x6b5f('0x19')][_0x6b5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x50f816[_0x6b5f('0x19')]?_0x50f816['options'][_0x6b5f('0x1b')]||null:null,'attributes':_0x50f816[_0x6b5f('0x19')]?_0x50f816[_0x6b5f('0x19')][_0x6b5f('0x1c')]||null:null,'limit':_0x50f816[_0x6b5f('0x19')]?_0x50f816[_0x6b5f('0x19')][_0x6b5f('0x1d')]||null:null,'include':_0x50f816['options']?_0x50f816[_0x6b5f('0x19')][_0x6b5f('0x1e')]?_[_0x6b5f('0x1f')](_0x50f816[_0x6b5f('0x19')]['include'],function(_0x378a61){return{'model':db[_0x378a61['model']],'as':_0x378a61['as'],'attributes':_0x378a61[_0x6b5f('0x1c')],'include':_0x378a61[_0x6b5f('0x1e')]?_[_0x6b5f('0x1f')](_0x378a61[_0x6b5f('0x1e')],function(_0x1accf8){return{'model':db[_0x1accf8['model']],'as':_0x1accf8['as'],'attributes':_0x1accf8[_0x6b5f('0x1c')],'include':_0x1accf8['include']?_['map'](_0x1accf8[_0x6b5f('0x1e')],function(_0x1e5f50){return{'model':db[_0x1e5f50[_0x6b5f('0x20')]],'as':_0x1e5f50['as'],'attributes':_0x1e5f50[_0x6b5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6b5f('0xb')](function(_0x2b8a13){logger[_0x6b5f('0xc')](_0x6b5f('0x16'),_0x50f816);logger['debug'](_0x6b5f('0x16'),_0x50f816,JSON['stringify'](_0x2b8a13));_0x7d0374(_0x2b8a13);})['catch'](function(_0x38f679){logger[_0x6b5f('0x11')](_0x6b5f('0x16'),_0x38f679['message'],_0x50f816);_0x5a3ba0(_0x1607b8[_0x6b5f('0x11')](0x1f4,_0x38f679[_0x6b5f('0x13')]));});});};exports[_0x6b5f('0x21')]=function(_0x238621){var _0x5733b1=this;return new Promise(function(_0x58a2be,_0x4e16d5){return db['FreshdeskAccount'][_0x6b5f('0x22')]({'raw':_0x238621[_0x6b5f('0x19')]?_0x238621[_0x6b5f('0x19')][_0x6b5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x238621[_0x6b5f('0x19')]?_0x238621[_0x6b5f('0x19')][_0x6b5f('0x1b')]||null:null,'attributes':_0x238621[_0x6b5f('0x19')]?_0x238621[_0x6b5f('0x19')][_0x6b5f('0x1c')]||null:null,'include':_0x238621['options']?_0x238621['options']['include']?_[_0x6b5f('0x1f')](_0x238621['options']['include'],function(_0x16f01e){return{'model':db[_0x16f01e['model']],'as':_0x16f01e['as'],'attributes':_0x16f01e[_0x6b5f('0x1c')],'include':_0x16f01e['include']?_[_0x6b5f('0x1f')](_0x16f01e[_0x6b5f('0x1e')],function(_0x23b83e){return{'model':db[_0x23b83e['model']],'as':_0x23b83e['as'],'attributes':_0x23b83e['attributes'],'include':_0x23b83e[_0x6b5f('0x1e')]?_[_0x6b5f('0x1f')](_0x23b83e[_0x6b5f('0x1e')],function(_0x51a845){return{'model':db[_0x51a845[_0x6b5f('0x20')]],'as':_0x51a845['as'],'attributes':_0x51a845[_0x6b5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6b5f('0xb')](function(_0x26650d){logger[_0x6b5f('0xc')](_0x6b5f('0x21'),_0x238621);logger['debug'](_0x6b5f('0x21'),_0x238621,JSON[_0x6b5f('0x10')](_0x26650d));_0x58a2be(_0x26650d);})[_0x6b5f('0x15')](function(_0x5ed4eb){logger[_0x6b5f('0x11')]('ShowFreshdeskAccount',_0x5ed4eb[_0x6b5f('0x13')],_0x238621);_0x4e16d5(_0x5733b1[_0x6b5f('0x11')](0x1f4,_0x5ed4eb[_0x6b5f('0x13')]));});});}; \ No newline at end of file +var _0x6b84=['FreshdeskAccount','findAll','options','where','attributes','limit','include','model','map','then','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch'];(function(_0x193368,_0x721b10){var _0x281da5=function(_0x52efe0){while(--_0x52efe0){_0x193368['push'](_0x193368['shift']());}};_0x281da5(++_0x721b10);}(_0x6b84,0x6f));var _0x46b8=function(_0x37bec4,_0x3e8fdf){_0x37bec4=_0x37bec4-0x0;var _0x3407d2=_0x6b84[_0x37bec4];return _0x3407d2;};'use strict';var _=require(_0x46b8('0x0'));var util=require(_0x46b8('0x1'));var moment=require(_0x46b8('0x2'));var BPromise=require(_0x46b8('0x3'));var rs=require(_0x46b8('0x4'));var fs=require('fs');var Redis=require(_0x46b8('0x5'));var db=require(_0x46b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x46b8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x46b8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15fd1e,_0x41d02e,_0x96a56d){return new BPromise(function(_0x6a84d2,_0x4e008e){return client['request'](_0x15fd1e,_0x96a56d)['then'](function(_0x26601f){logger[_0x46b8('0x9')](_0x46b8('0xa'),_0x41d02e,'request\x20sent');logger[_0x46b8('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x41d02e,_0x46b8('0xc'),JSON['stringify'](_0x26601f));if(_0x26601f[_0x46b8('0xd')]){if(_0x26601f[_0x46b8('0xd')][_0x46b8('0xe')]===0x1f4){logger[_0x46b8('0xd')](_0x46b8('0xa'),_0x41d02e,_0x26601f[_0x46b8('0xd')]['message']);return _0x4e008e(_0x26601f[_0x46b8('0xd')][_0x46b8('0xf')]);}logger[_0x46b8('0xd')](_0x46b8('0xa'),_0x41d02e,_0x26601f[_0x46b8('0xd')]['message']);return _0x6a84d2(_0x26601f[_0x46b8('0xd')][_0x46b8('0xf')]);}else{logger[_0x46b8('0x9')](_0x46b8('0xa'),_0x41d02e,_0x46b8('0xc'));_0x6a84d2(_0x26601f['result'][_0x46b8('0xf')]);}})[_0x46b8('0x10')](function(_0x74a176){logger[_0x46b8('0xd')](_0x46b8('0xa'),_0x41d02e,_0x74a176);_0x4e008e(_0x74a176);});});}exports['GetFreshdeskAccount']=function(_0x338278){var _0x4e791b=this;return new Promise(function(_0x21b8b1,_0xf3696b){return db[_0x46b8('0x11')][_0x46b8('0x12')]({'raw':_0x338278['options']?_0x338278[_0x46b8('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x338278[_0x46b8('0x13')]?_0x338278['options'][_0x46b8('0x14')]||null:null,'attributes':_0x338278[_0x46b8('0x13')]?_0x338278['options'][_0x46b8('0x15')]||null:null,'limit':_0x338278[_0x46b8('0x13')]?_0x338278[_0x46b8('0x13')][_0x46b8('0x16')]||null:null,'include':_0x338278[_0x46b8('0x13')]?_0x338278[_0x46b8('0x13')]['include']?_['map'](_0x338278[_0x46b8('0x13')][_0x46b8('0x17')],function(_0x1b3e52){return{'model':db[_0x1b3e52[_0x46b8('0x18')]],'as':_0x1b3e52['as'],'attributes':_0x1b3e52['attributes'],'include':_0x1b3e52[_0x46b8('0x17')]?_[_0x46b8('0x19')](_0x1b3e52['include'],function(_0x48aa70){return{'model':db[_0x48aa70['model']],'as':_0x48aa70['as'],'attributes':_0x48aa70[_0x46b8('0x15')],'include':_0x48aa70[_0x46b8('0x17')]?_[_0x46b8('0x19')](_0x48aa70['include'],function(_0x17dfaa){return{'model':db[_0x17dfaa[_0x46b8('0x18')]],'as':_0x17dfaa['as'],'attributes':_0x17dfaa[_0x46b8('0x15')]};}):[]};}):[]};}):[]:[]})[_0x46b8('0x1a')](function(_0x1c1911){logger[_0x46b8('0x9')](_0x46b8('0x1b'),_0x338278);logger[_0x46b8('0xb')](_0x46b8('0x1b'),_0x338278,JSON[_0x46b8('0x1c')](_0x1c1911));_0x21b8b1(_0x1c1911);})[_0x46b8('0x10')](function(_0x4c614e){logger[_0x46b8('0xd')](_0x46b8('0x1b'),_0x4c614e[_0x46b8('0xf')],_0x338278);_0xf3696b(_0x4e791b[_0x46b8('0xd')](0x1f4,_0x4c614e['message']));});});};exports[_0x46b8('0x1d')]=function(_0x4d6933){var _0x393230=this;return new Promise(function(_0x3cc90d,_0x527048){return db[_0x46b8('0x11')][_0x46b8('0x1e')]({'raw':_0x4d6933[_0x46b8('0x13')]?_0x4d6933[_0x46b8('0x13')][_0x46b8('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d6933[_0x46b8('0x13')]?_0x4d6933[_0x46b8('0x13')]['where']||null:null,'attributes':_0x4d6933[_0x46b8('0x13')]?_0x4d6933[_0x46b8('0x13')][_0x46b8('0x15')]||null:null,'include':_0x4d6933[_0x46b8('0x13')]?_0x4d6933[_0x46b8('0x13')][_0x46b8('0x17')]?_[_0x46b8('0x19')](_0x4d6933[_0x46b8('0x13')][_0x46b8('0x17')],function(_0x13b390){return{'model':db[_0x13b390[_0x46b8('0x18')]],'as':_0x13b390['as'],'attributes':_0x13b390['attributes'],'include':_0x13b390['include']?_[_0x46b8('0x19')](_0x13b390[_0x46b8('0x17')],function(_0x1ab0f3){return{'model':db[_0x1ab0f3[_0x46b8('0x18')]],'as':_0x1ab0f3['as'],'attributes':_0x1ab0f3[_0x46b8('0x15')],'include':_0x1ab0f3['include']?_['map'](_0x1ab0f3[_0x46b8('0x17')],function(_0x5a06c0){return{'model':db[_0x5a06c0[_0x46b8('0x18')]],'as':_0x5a06c0['as'],'attributes':_0x5a06c0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dbf86){logger[_0x46b8('0x9')](_0x46b8('0x1d'),_0x4d6933);logger[_0x46b8('0xb')]('ShowFreshdeskAccount',_0x4d6933,JSON['stringify'](_0x4dbf86));_0x3cc90d(_0x4dbf86);})[_0x46b8('0x10')](function(_0x31c3ae){logger[_0x46b8('0xd')](_0x46b8('0x1d'),_0x31c3ae[_0x46b8('0xf')],_0x4d6933);_0x527048(_0x393230['error'](0x1f4,_0x31c3ae[_0x46b8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ed320b9..dc2b344 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 _0x139c=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','exports','multer'];(function(_0xf48d35,_0x2044f4){var _0x23522=function(_0x5defe9){while(--_0x5defe9){_0xf48d35['push'](_0xf48d35['shift']());}};_0x23522(++_0x2044f4);}(_0x139c,0x17f));var _0xc139=function(_0x3f1f31,_0x6a09ec){_0x3f1f31=_0x3f1f31-0x0;var _0x1508b5=_0x139c[_0x3f1f31];return _0x1508b5;};'use strict';var multer=require(_0xc139('0x0'));var util=require(_0xc139('0x1'));var path=require('path');var timeout=require(_0xc139('0x2'));var express=require(_0xc139('0x3'));var router=express['Router']();var fs_extra=require(_0xc139('0x4'));var auth=require(_0xc139('0x5'));var interaction=require(_0xc139('0x6'));var config=require(_0xc139('0x7'));var controller=require(_0xc139('0x8'));router[_0xc139('0x9')]('/',auth['isAuthenticated'](),controller[_0xc139('0xa')]);router[_0xc139('0x9')](_0xc139('0xb'),auth[_0xc139('0xc')](),controller[_0xc139('0xd')]);router[_0xc139('0x9')](_0xc139('0xe'),auth[_0xc139('0xc')](),controller['getFields']);router['get'](_0xc139('0xf'),auth['isAuthenticated'](),controller[_0xc139('0x10')]);router[_0xc139('0x9')]('/:id/descriptions',auth[_0xc139('0xc')](),controller['getDescriptions']);router[_0xc139('0x9')](_0xc139('0x11'),auth[_0xc139('0xc')](),controller[_0xc139('0x12')]);router[_0xc139('0x13')]('/',auth[_0xc139('0xc')](),controller[_0xc139('0x14')]);router[_0xc139('0x13')](_0xc139('0x11'),auth[_0xc139('0xc')](),controller[_0xc139('0x15')]);router[_0xc139('0x16')](_0xc139('0xb'),auth[_0xc139('0xc')](),controller['update']);router['delete']('/:id',auth[_0xc139('0xc')](),controller['destroy']);module[_0xc139('0x17')]=router; \ No newline at end of file +var _0xe5c8=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xe5c8,0x86));var _0x8e5c=function(_0x1deb49,_0x4411fb){_0x1deb49=_0x1deb49-0x0;var _0x1d3310=_0xe5c8[_0x1deb49];return _0x1d3310;};'use strict';var multer=require(_0x8e5c('0x0'));var util=require('util');var path=require(_0x8e5c('0x1'));var timeout=require(_0x8e5c('0x2'));var express=require(_0x8e5c('0x3'));var router=express['Router']();var fs_extra=require(_0x8e5c('0x4'));var auth=require(_0x8e5c('0x5'));var interaction=require(_0x8e5c('0x6'));var config=require(_0x8e5c('0x7'));var controller=require(_0x8e5c('0x8'));router['get']('/',auth[_0x8e5c('0x9')](),controller[_0x8e5c('0xa')]);router['get'](_0x8e5c('0xb'),auth[_0x8e5c('0x9')](),controller[_0x8e5c('0xc')]);router[_0x8e5c('0xd')](_0x8e5c('0xe'),auth[_0x8e5c('0x9')](),controller[_0x8e5c('0xf')]);router['get'](_0x8e5c('0x10'),auth[_0x8e5c('0x9')](),controller['getSubjects']);router[_0x8e5c('0xd')]('/:id/descriptions',auth[_0x8e5c('0x9')](),controller[_0x8e5c('0x11')]);router['get'](_0x8e5c('0x12'),auth['isAuthenticated'](),controller[_0x8e5c('0x13')]);router[_0x8e5c('0x14')]('/',auth['isAuthenticated'](),controller[_0x8e5c('0x15')]);router['post']('/:id/tags',auth[_0x8e5c('0x9')](),controller['setTags']);router[_0x8e5c('0x16')](_0x8e5c('0xb'),auth[_0x8e5c('0x9')](),controller[_0x8e5c('0x17')]);router[_0x8e5c('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8e5c('0x19')]);module[_0x8e5c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 81c630d..e7f3c1a 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 _0x31e8=['STRING','sequelize','exports'];(function(_0x3af58b,_0x5ea72a){var _0x627027=function(_0x3d5b1c){while(--_0x3d5b1c){_0x3af58b['push'](_0x3af58b['shift']());}};_0x627027(++_0x5ea72a);}(_0x31e8,0xb8));var _0x831e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x31e8[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x831e('0x0'));module[_0x831e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x831e('0x2')]}}; \ No newline at end of file +var _0x912d=['STRING','sequelize','exports'];(function(_0x49ca0d,_0x43b42b){var _0x5852c3=function(_0x24ee19){while(--_0x24ee19){_0x49ca0d['push'](_0x49ca0d['shift']());}};_0x5852c3(++_0x43b42b);}(_0x912d,0x187));var _0xd912=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x912d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xd912('0x0'));module[_0xd912('0x1')]={'name':{'type':Sequelize[_0xd912('0x2')]},'description':{'type':Sequelize[_0xd912('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e222f2a..38045fa 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 _0x5f4c=['keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','create','body','find','findOne','getFields','nolimit','getSubjects','FreshdeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','query'];(function(_0x2b418d,_0x1d7c48){var _0x162164=function(_0x4413fc){while(--_0x4413fc){_0x2b418d['push'](_0x2b418d['shift']());}};_0x162164(++_0x1d7c48);}(_0x5f4c,0x124));var _0xc5f4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f4c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc5f4('0x0'));var rimraf=require(_0xc5f4('0x1'));var zipdir=require(_0xc5f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5f4('0x3'));var moment=require(_0xc5f4('0x4'));var BPromise=require(_0xc5f4('0x5'));var Mustache=require(_0xc5f4('0x6'));var util=require(_0xc5f4('0x7'));var path=require(_0xc5f4('0x8'));var sox=require(_0xc5f4('0x9'));var csv=require('to-csv');var ejs=require(_0xc5f4('0xa'));var fs=require('fs');var fs_extra=require(_0xc5f4('0xb'));var _=require(_0xc5f4('0xc'));var squel=require(_0xc5f4('0xd'));var crypto=require(_0xc5f4('0xe'));var jsforce=require(_0xc5f4('0xf'));var deskjs=require(_0xc5f4('0x10'));var toCsv=require(_0xc5f4('0x11'));var querystring=require(_0xc5f4('0x12'));var Papa=require(_0xc5f4('0x13'));var Redis=require(_0xc5f4('0x14'));var authService=require(_0xc5f4('0x15'));var qs=require(_0xc5f4('0x16'));var as=require(_0xc5f4('0x17'));var hardwareService=require(_0xc5f4('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xc5f4('0x19'));var config=require(_0xc5f4('0x1a'));var licenseUtil=require(_0xc5f4('0x1b'));var db=require(_0xc5f4('0x1c'))['db'];function respondWithStatusCode(_0x10f165,_0x17679c){_0x17679c=_0x17679c||0xcc;return function(_0x2cdd50){if(_0x2cdd50){return _0x10f165[_0xc5f4('0x1d')](_0x17679c);}return _0x10f165['status'](_0x17679c)['end']();};}function respondWithResult(_0x4c9094,_0x3a2d72){_0x3a2d72=_0x3a2d72||0xc8;return function(_0x2d68f1){if(_0x2d68f1){return _0x4c9094[_0xc5f4('0x1e')](_0x3a2d72)['json'](_0x2d68f1);}};}function respondWithFilteredResult(_0x1e46ee,_0x40a7dc){return function(_0x42d029){if(_0x42d029){var _0x4022aa=typeof _0x40a7dc[_0xc5f4('0x1f')]===_0xc5f4('0x20')&&typeof _0x40a7dc[_0xc5f4('0x21')]===_0xc5f4('0x20');var _0x48ff23=_0x42d029['count'];var _0x494d47=_0x4022aa?0x0:_0x40a7dc[_0xc5f4('0x1f')];var _0xa63b1e=_0x4022aa?_0x42d029[_0xc5f4('0x22')]:_0x40a7dc[_0xc5f4('0x1f')]+_0x40a7dc[_0xc5f4('0x21')];var _0x3d95f4;if(_0xa63b1e>=_0x48ff23){_0xa63b1e=_0x48ff23;_0x3d95f4=0xc8;}else{_0x3d95f4=0xce;}_0x1e46ee[_0xc5f4('0x1e')](_0x3d95f4);return _0x1e46ee[_0xc5f4('0x23')](_0xc5f4('0x24'),_0x494d47+'-'+_0xa63b1e+'/'+_0x48ff23)[_0xc5f4('0x25')](_0x42d029);}return null;};}function patchUpdates(_0x4d86f5){return function(_0x16ae40){try{jsonpatch[_0xc5f4('0x26')](_0x16ae40,_0x4d86f5,!![]);}catch(_0x404400){return BPromise['reject'](_0x404400);}return _0x16ae40['save']();};}function saveUpdates(_0xbd0637,_0x1559b8){return function(_0x6bd991){if(_0x6bd991){return _0x6bd991[_0xc5f4('0x27')](_0xbd0637)[_0xc5f4('0x28')](function(_0x42272d){return _0x42272d;});}return null;};}function removeEntity(_0x5d1245,_0x570569){return function(_0x13de56){if(_0x13de56){return _0x13de56[_0xc5f4('0x29')]()[_0xc5f4('0x28')](function(){_0x5d1245['status'](0xcc)[_0xc5f4('0x2a')]();});}};}function handleEntityNotFound(_0x486df9,_0x42fecb){return function(_0x22b42f){if(!_0x22b42f){_0x486df9[_0xc5f4('0x1d')](0x194);}return _0x22b42f;};}function handleError(_0x45b34e,_0x25576c){_0x25576c=_0x25576c||0x1f4;return function(_0x1d00a0){logger[_0xc5f4('0x2b')](_0x1d00a0['stack']);if(_0x1d00a0[_0xc5f4('0x2c')]){delete _0x1d00a0[_0xc5f4('0x2c')];}_0x45b34e[_0xc5f4('0x1e')](_0x25576c)[_0xc5f4('0x2d')](_0x1d00a0);};}exports[_0xc5f4('0x2e')]=function(_0x6d8a94,_0x5510d1){var _0x5655a1={},_0x5365c0={},_0x4d534d={'count':0x0,'rows':[]};var _0x5a0416=_[_0xc5f4('0x2f')](db[_0xc5f4('0x30')][_0xc5f4('0x31')],function(_0x341080){return{'name':_0x341080['fieldName'],'type':_0x341080[_0xc5f4('0x32')]['key']};});_0x5365c0['model']=_['map'](_0x5a0416,_0xc5f4('0x2c'));_0x5365c0[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x6d8a94[_0xc5f4('0x33')]);_0x5365c0['filters']=_[_0xc5f4('0x35')](_0x5365c0[_0xc5f4('0x36')],_0x5365c0['query']);_0x5655a1['attributes']=_['intersection'](_0x5365c0[_0xc5f4('0x36')],qs[_0xc5f4('0x37')](_0x6d8a94[_0xc5f4('0x33')][_0xc5f4('0x37')]));_0x5655a1[_0xc5f4('0x38')]=_0x5655a1[_0xc5f4('0x38')][_0xc5f4('0x39')]?_0x5655a1['attributes']:_0x5365c0[_0xc5f4('0x36')];if(!_0x6d8a94[_0xc5f4('0x33')][_0xc5f4('0x3a')]('nolimit')){_0x5655a1[_0xc5f4('0x21')]=qs['limit'](_0x6d8a94[_0xc5f4('0x33')]['limit']);_0x5655a1[_0xc5f4('0x1f')]=qs[_0xc5f4('0x1f')](_0x6d8a94[_0xc5f4('0x33')][_0xc5f4('0x1f')]);}_0x5655a1[_0xc5f4('0x3b')]=qs[_0xc5f4('0x3c')](_0x6d8a94[_0xc5f4('0x33')]['sort']);_0x5655a1[_0xc5f4('0x3d')]=qs[_0xc5f4('0x3e')](_[_0xc5f4('0x3f')](_0x6d8a94[_0xc5f4('0x33')],_0x5365c0[_0xc5f4('0x3e')]),_0x5a0416);if(_0x6d8a94[_0xc5f4('0x33')]['filter']){_0x5655a1[_0xc5f4('0x3d')]=_[_0xc5f4('0x40')](_0x5655a1['where'],{'$or':_[_0xc5f4('0x2f')](_0x5a0416,function(_0x1b8077){if(_0x1b8077[_0xc5f4('0x32')]!==_0xc5f4('0x41')){var _0x14907b={};_0x14907b[_0x1b8077[_0xc5f4('0x2c')]]={'$like':'%'+_0x6d8a94['query'][_0xc5f4('0x42')]+'%'};return _0x14907b;}})});}_0x5655a1=_[_0xc5f4('0x40')]({},_0x5655a1,_0x6d8a94[_0xc5f4('0x43')]);var _0x370d82={'where':_0x5655a1[_0xc5f4('0x3d')]};return db[_0xc5f4('0x30')]['count'](_0x370d82)['then'](function(_0x108bd8){_0x4d534d[_0xc5f4('0x22')]=_0x108bd8;if(_0x6d8a94[_0xc5f4('0x33')][_0xc5f4('0x44')]){_0x5655a1[_0xc5f4('0x45')]=[{'all':!![]}];}return db[_0xc5f4('0x30')][_0xc5f4('0x46')](_0x5655a1);})[_0xc5f4('0x28')](function(_0x12cab2){_0x4d534d['rows']=_0x12cab2;return _0x4d534d;})['then'](respondWithFilteredResult(_0x5510d1,_0x5655a1))[_0xc5f4('0x47')](handleError(_0x5510d1,null));};exports['show']=function(_0x2a993f,_0x352ef9){var _0x128849={'raw':![],'where':{'id':_0x2a993f[_0xc5f4('0x48')]['id']}},_0x173c6d={};_0x173c6d[_0xc5f4('0x36')]=_[_0xc5f4('0x34')](db['FreshdeskConfiguration'][_0xc5f4('0x31')]);_0x173c6d[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x2a993f[_0xc5f4('0x33')]);_0x173c6d['filters']=_['intersection'](_0x173c6d['model'],_0x173c6d[_0xc5f4('0x33')]);_0x128849['attributes']=_[_0xc5f4('0x35')](_0x173c6d[_0xc5f4('0x36')],qs['fields'](_0x2a993f[_0xc5f4('0x33')]['fields']));_0x128849[_0xc5f4('0x38')]=_0x128849[_0xc5f4('0x38')][_0xc5f4('0x39')]?_0x128849[_0xc5f4('0x38')]:_0x173c6d[_0xc5f4('0x36')];if(_0x2a993f['query'][_0xc5f4('0x44')]){_0x128849[_0xc5f4('0x45')]=[{'all':!![]}];}_0x128849=_[_0xc5f4('0x40')]({},_0x128849,_0x2a993f[_0xc5f4('0x43')]);return db[_0xc5f4('0x30')]['find'](_0x128849)[_0xc5f4('0x28')](handleEntityNotFound(_0x352ef9,null))[_0xc5f4('0x28')](respondWithResult(_0x352ef9,null))[_0xc5f4('0x47')](handleError(_0x352ef9,null));};exports[_0xc5f4('0x49')]=function(_0x33ef69,_0x2e82c){return db[_0xc5f4('0x30')][_0xc5f4('0x49')](_0x33ef69[_0xc5f4('0x4a')],{})[_0xc5f4('0x28')](respondWithResult(_0x2e82c,0xc9))['catch'](handleError(_0x2e82c,null));};exports[_0xc5f4('0x27')]=function(_0x1c13d0,_0x50db24){if(_0x1c13d0['body']['id']){delete _0x1c13d0[_0xc5f4('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0xc5f4('0x4b')]({'where':{'id':_0x1c13d0['params']['id']}})[_0xc5f4('0x28')](handleEntityNotFound(_0x50db24,null))[_0xc5f4('0x28')](saveUpdates(_0x1c13d0[_0xc5f4('0x4a')],null))[_0xc5f4('0x28')](respondWithResult(_0x50db24,null))[_0xc5f4('0x47')](handleError(_0x50db24,null));};exports[_0xc5f4('0x29')]=function(_0x1db15b,_0x463a7f){return db[_0xc5f4('0x30')][_0xc5f4('0x4b')]({'where':{'id':_0x1db15b[_0xc5f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x463a7f,null))[_0xc5f4('0x28')](removeEntity(_0x463a7f,null))[_0xc5f4('0x47')](handleError(_0x463a7f,null));};exports['getFields']=function(_0x4abfdd,_0x5818b4,_0x34cf19){var _0x2890d5={};var _0x1ff8bd={};var _0x47fb04;var _0x3d3f22;return db[_0xc5f4('0x30')][_0xc5f4('0x4c')]({'where':{'id':_0x4abfdd[_0xc5f4('0x48')]['id']}})[_0xc5f4('0x28')](handleEntityNotFound(_0x5818b4,null))['then'](function(_0x34ff31){if(_0x34ff31){_0x47fb04=_0x34ff31;_0x1ff8bd[_0xc5f4('0x36')]=_['keys'](db['FreshdeskField'][_0xc5f4('0x31')]);_0x1ff8bd[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x4abfdd[_0xc5f4('0x33')]);_0x1ff8bd[_0xc5f4('0x3e')]=_[_0xc5f4('0x35')](_0x1ff8bd[_0xc5f4('0x36')],_0x1ff8bd[_0xc5f4('0x33')]);_0x2890d5[_0xc5f4('0x38')]=_[_0xc5f4('0x35')](_0x1ff8bd[_0xc5f4('0x36')],qs[_0xc5f4('0x37')](_0x4abfdd[_0xc5f4('0x33')][_0xc5f4('0x37')]));_0x2890d5['attributes']=_0x2890d5[_0xc5f4('0x38')][_0xc5f4('0x39')]?_0x2890d5[_0xc5f4('0x38')]:_0x1ff8bd[_0xc5f4('0x36')];_0x2890d5['order']=qs['sort'](_0x4abfdd[_0xc5f4('0x33')][_0xc5f4('0x3c')]);_0x2890d5[_0xc5f4('0x3d')]=qs[_0xc5f4('0x3e')](_['pick'](_0x4abfdd['query'],_0x1ff8bd[_0xc5f4('0x3e')]));if(_0x4abfdd[_0xc5f4('0x33')][_0xc5f4('0x42')]){_0x2890d5[_0xc5f4('0x3d')]=_[_0xc5f4('0x40')](_0x2890d5[_0xc5f4('0x3d')],{'$or':_['map'](_0x2890d5['attributes'],function(_0x24cafb){var _0x11c88a={};_0x11c88a[_0x24cafb]={'$like':'%'+_0x4abfdd[_0xc5f4('0x33')][_0xc5f4('0x42')]+'%'};return _0x11c88a;})});}_0x2890d5=_[_0xc5f4('0x40')]({},_0x2890d5,_0x4abfdd['options']);return _0x47fb04[_0xc5f4('0x4d')](_0x2890d5);}})[_0xc5f4('0x28')](function(_0x5d1325){if(_0x5d1325){_0x3d3f22=_0x5d1325['length'];if(!_0x4abfdd['query'][_0xc5f4('0x3a')](_0xc5f4('0x4e'))){_0x2890d5[_0xc5f4('0x21')]=qs[_0xc5f4('0x21')](_0x4abfdd['query'][_0xc5f4('0x21')]);_0x2890d5[_0xc5f4('0x1f')]=qs[_0xc5f4('0x1f')](_0x4abfdd[_0xc5f4('0x33')][_0xc5f4('0x1f')]);}return _0x47fb04[_0xc5f4('0x4d')](_0x2890d5);}})[_0xc5f4('0x28')](function(_0x43e8d9){if(_0x43e8d9){return _0x43e8d9?{'count':_0x3d3f22,'rows':_0x43e8d9}:null;}})['then'](respondWithResult(_0x5818b4,null))[_0xc5f4('0x47')](handleError(_0x5818b4,null));};exports[_0xc5f4('0x4f')]=function(_0x453430,_0x3940be,_0x41a0bd){var _0x1a20d9={};var _0x566ed0={};var _0x47915a;var _0xb69753;return db['FreshdeskConfiguration'][_0xc5f4('0x4c')]({'where':{'id':_0x453430[_0xc5f4('0x48')]['id']}})[_0xc5f4('0x28')](handleEntityNotFound(_0x3940be,null))[_0xc5f4('0x28')](function(_0x76647b){if(_0x76647b){_0x47915a=_0x76647b;_0x566ed0[_0xc5f4('0x36')]=_[_0xc5f4('0x34')](db[_0xc5f4('0x50')][_0xc5f4('0x31')]);_0x566ed0[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x453430[_0xc5f4('0x33')]);_0x566ed0[_0xc5f4('0x3e')]=_['intersection'](_0x566ed0[_0xc5f4('0x36')],_0x566ed0[_0xc5f4('0x33')]);_0x1a20d9[_0xc5f4('0x38')]=_[_0xc5f4('0x35')](_0x566ed0[_0xc5f4('0x36')],qs[_0xc5f4('0x37')](_0x453430[_0xc5f4('0x33')][_0xc5f4('0x37')]));_0x1a20d9[_0xc5f4('0x38')]=_0x1a20d9['attributes']['length']?_0x1a20d9[_0xc5f4('0x38')]:_0x566ed0[_0xc5f4('0x36')];_0x1a20d9[_0xc5f4('0x3b')]=qs[_0xc5f4('0x3c')](_0x453430['query']['sort']);_0x1a20d9[_0xc5f4('0x3d')]=qs[_0xc5f4('0x3e')](_[_0xc5f4('0x3f')](_0x453430[_0xc5f4('0x33')],_0x566ed0['filters']));if(_0x453430[_0xc5f4('0x33')][_0xc5f4('0x42')]){_0x1a20d9[_0xc5f4('0x3d')]=_['merge'](_0x1a20d9[_0xc5f4('0x3d')],{'$or':_[_0xc5f4('0x2f')](_0x1a20d9[_0xc5f4('0x38')],function(_0x3673b7){var _0x47fcd7={};_0x47fcd7[_0x3673b7]={'$like':'%'+_0x453430[_0xc5f4('0x33')][_0xc5f4('0x42')]+'%'};return _0x47fcd7;})});}_0x1a20d9=_[_0xc5f4('0x40')]({},_0x1a20d9,_0x453430[_0xc5f4('0x43')]);return _0x47915a['getSubjects'](_0x1a20d9);}})[_0xc5f4('0x28')](function(_0x3cd177){if(_0x3cd177){_0xb69753=_0x3cd177[_0xc5f4('0x39')];if(!_0x453430[_0xc5f4('0x33')][_0xc5f4('0x3a')](_0xc5f4('0x4e'))){_0x1a20d9['limit']=qs[_0xc5f4('0x21')](_0x453430['query'][_0xc5f4('0x21')]);_0x1a20d9[_0xc5f4('0x1f')]=qs[_0xc5f4('0x1f')](_0x453430[_0xc5f4('0x33')]['offset']);}return _0x47915a['getSubjects'](_0x1a20d9);}})[_0xc5f4('0x28')](function(_0x51e9fe){if(_0x51e9fe){return _0x51e9fe?{'count':_0xb69753,'rows':_0x51e9fe}:null;}})['then'](respondWithResult(_0x3940be,null))[_0xc5f4('0x47')](handleError(_0x3940be,null));};exports[_0xc5f4('0x51')]=function(_0x33947d,_0x5e4226,_0x2b2ac7){var _0xf438a0={};var _0x3b8d63={};var _0x3d1247;var _0x387025;return db[_0xc5f4('0x30')][_0xc5f4('0x4c')]({'where':{'id':_0x33947d[_0xc5f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e4226,null))[_0xc5f4('0x28')](function(_0x41fb91){if(_0x41fb91){_0x3d1247=_0x41fb91;_0x3b8d63[_0xc5f4('0x36')]=_[_0xc5f4('0x34')](db['FreshdeskField'][_0xc5f4('0x31')]);_0x3b8d63[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x33947d['query']);_0x3b8d63[_0xc5f4('0x3e')]=_[_0xc5f4('0x35')](_0x3b8d63[_0xc5f4('0x36')],_0x3b8d63[_0xc5f4('0x33')]);_0xf438a0[_0xc5f4('0x38')]=_['intersection'](_0x3b8d63['model'],qs[_0xc5f4('0x37')](_0x33947d[_0xc5f4('0x33')]['fields']));_0xf438a0['attributes']=_0xf438a0[_0xc5f4('0x38')][_0xc5f4('0x39')]?_0xf438a0[_0xc5f4('0x38')]:_0x3b8d63[_0xc5f4('0x36')];_0xf438a0[_0xc5f4('0x3b')]=qs['sort'](_0x33947d[_0xc5f4('0x33')]['sort']);_0xf438a0['where']=qs[_0xc5f4('0x3e')](_[_0xc5f4('0x3f')](_0x33947d['query'],_0x3b8d63[_0xc5f4('0x3e')]));if(_0x33947d[_0xc5f4('0x33')][_0xc5f4('0x42')]){_0xf438a0[_0xc5f4('0x3d')]=_[_0xc5f4('0x40')](_0xf438a0[_0xc5f4('0x3d')],{'$or':_[_0xc5f4('0x2f')](_0xf438a0[_0xc5f4('0x38')],function(_0x4f9649){var _0x1bb920={};_0x1bb920[_0x4f9649]={'$like':'%'+_0x33947d[_0xc5f4('0x33')][_0xc5f4('0x42')]+'%'};return _0x1bb920;})});}_0xf438a0=_[_0xc5f4('0x40')]({},_0xf438a0,_0x33947d[_0xc5f4('0x43')]);return _0x3d1247['getDescriptions'](_0xf438a0);}})[_0xc5f4('0x28')](function(_0x19e416){if(_0x19e416){_0x387025=_0x19e416[_0xc5f4('0x39')];if(!_0x33947d[_0xc5f4('0x33')]['hasOwnProperty'](_0xc5f4('0x4e'))){_0xf438a0[_0xc5f4('0x21')]=qs[_0xc5f4('0x21')](_0x33947d[_0xc5f4('0x33')]['limit']);_0xf438a0[_0xc5f4('0x1f')]=qs[_0xc5f4('0x1f')](_0x33947d[_0xc5f4('0x33')]['offset']);}return _0x3d1247['getDescriptions'](_0xf438a0);}})['then'](function(_0x2dbccb){if(_0x2dbccb){return _0x2dbccb?{'count':_0x387025,'rows':_0x2dbccb}:null;}})[_0xc5f4('0x28')](respondWithResult(_0x5e4226,null))[_0xc5f4('0x47')](handleError(_0x5e4226,null));};exports['getTags']=function(_0x2bc0bc,_0x30f339,_0xa3bab4){var _0x6df02e={};var _0x4f6cca={};var _0x4d2e0e;var _0x5b66b3;return db[_0xc5f4('0x30')][_0xc5f4('0x4c')]({'where':{'id':_0x2bc0bc[_0xc5f4('0x48')]['id']}})[_0xc5f4('0x28')](handleEntityNotFound(_0x30f339,null))['then'](function(_0x433c6d){if(_0x433c6d){_0x4d2e0e=_0x433c6d;_0x4f6cca[_0xc5f4('0x36')]=_[_0xc5f4('0x34')](db[_0xc5f4('0x52')][_0xc5f4('0x31')]);_0x4f6cca[_0xc5f4('0x33')]=_[_0xc5f4('0x34')](_0x2bc0bc[_0xc5f4('0x33')]);_0x4f6cca[_0xc5f4('0x3e')]=_[_0xc5f4('0x35')](_0x4f6cca[_0xc5f4('0x36')],_0x4f6cca[_0xc5f4('0x33')]);_0x6df02e['attributes']=_[_0xc5f4('0x35')](_0x4f6cca[_0xc5f4('0x36')],qs['fields'](_0x2bc0bc['query']['fields']));_0x6df02e[_0xc5f4('0x38')]=_0x6df02e[_0xc5f4('0x38')][_0xc5f4('0x39')]?_0x6df02e[_0xc5f4('0x38')]:_0x4f6cca[_0xc5f4('0x36')];_0x6df02e[_0xc5f4('0x3b')]=qs['sort'](_0x2bc0bc[_0xc5f4('0x33')][_0xc5f4('0x3c')]);_0x6df02e[_0xc5f4('0x3d')]=qs[_0xc5f4('0x3e')](_['pick'](_0x2bc0bc[_0xc5f4('0x33')],_0x4f6cca[_0xc5f4('0x3e')]));if(_0x2bc0bc['query'][_0xc5f4('0x42')]){_0x6df02e[_0xc5f4('0x3d')]=_['merge'](_0x6df02e[_0xc5f4('0x3d')],{'$or':_['map'](_0x6df02e[_0xc5f4('0x38')],function(_0x5aa7af){var _0x22f2b8={};_0x22f2b8[_0x5aa7af]={'$like':'%'+_0x2bc0bc[_0xc5f4('0x33')][_0xc5f4('0x42')]+'%'};return _0x22f2b8;})});}_0x6df02e=_[_0xc5f4('0x40')]({},_0x6df02e,_0x2bc0bc[_0xc5f4('0x43')]);return _0x4d2e0e[_0xc5f4('0x53')](_0x6df02e);}})[_0xc5f4('0x28')](function(_0x391b09){if(_0x391b09){_0x5b66b3=_0x391b09['length'];if(!_0x2bc0bc[_0xc5f4('0x33')][_0xc5f4('0x3a')](_0xc5f4('0x4e'))){_0x6df02e['limit']=qs[_0xc5f4('0x21')](_0x2bc0bc[_0xc5f4('0x33')]['limit']);_0x6df02e[_0xc5f4('0x1f')]=qs[_0xc5f4('0x1f')](_0x2bc0bc[_0xc5f4('0x33')][_0xc5f4('0x1f')]);}return _0x4d2e0e[_0xc5f4('0x53')](_0x6df02e);}})['then'](function(_0x12f8c1){if(_0x12f8c1){return _0x12f8c1?{'count':_0x5b66b3,'rows':_0x12f8c1}:null;}})[_0xc5f4('0x28')](respondWithResult(_0x30f339,null))[_0xc5f4('0x47')](handleError(_0x30f339,null));};exports[_0xc5f4('0x54')]=function(_0xf7af1c,_0x3707bb,_0x67b41a){if(_0xf7af1c[_0xc5f4('0x4a')]['id']){delete _0xf7af1c[_0xc5f4('0x4a')]['id'];}return db[_0xc5f4('0x30')][_0xc5f4('0x4c')]({'where':{'id':_0xf7af1c['params']['id']}})[_0xc5f4('0x28')](handleEntityNotFound(_0x3707bb,null))[_0xc5f4('0x28')](function(_0x402934){if(_0x402934){return _0x402934[_0xc5f4('0x54')](_0xf7af1c[_0xc5f4('0x4a')][_0xc5f4('0x55')]||[]);}return null;})['then'](respondWithResult(_0x3707bb,null))['catch'](handleError(_0x3707bb,null));}; \ No newline at end of file +var _0x19fa=['error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','create','update','body','find','params','getFields','findOne','FreshdeskField','nolimit','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy'];(function(_0x5a5d5e,_0x4bee16){var _0x5a57bc=function(_0x3ea90d){while(--_0x3ea90d){_0x5a5d5e['push'](_0x5a5d5e['shift']());}};_0x5a57bc(++_0x4bee16);}(_0x19fa,0x1c0));var _0xa19f=function(_0x4a362d,_0x25adf1){_0x4a362d=_0x4a362d-0x0;var _0x17ff9b=_0x19fa[_0x4a362d];return _0x17ff9b;};'use strict';var emlformat=require(_0xa19f('0x0'));var rimraf=require(_0xa19f('0x1'));var zipdir=require(_0xa19f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa19f('0x3'));var moment=require(_0xa19f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa19f('0x5'));var util=require(_0xa19f('0x6'));var path=require('path');var sox=require(_0xa19f('0x7'));var csv=require('to-csv');var ejs=require(_0xa19f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa19f('0x9'));var jsforce=require(_0xa19f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa19f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa19f('0xc'));var qs=require(_0xa19f('0xd'));var as=require(_0xa19f('0xe'));var hardwareService=require(_0xa19f('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xa19f('0x10'));var config=require(_0xa19f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xa19f('0x12'))['db'];function respondWithStatusCode(_0xa849a2,_0x2fac8a){_0x2fac8a=_0x2fac8a||0xcc;return function(_0x1d1901){if(_0x1d1901){return _0xa849a2[_0xa19f('0x13')](_0x2fac8a);}return _0xa849a2[_0xa19f('0x14')](_0x2fac8a)[_0xa19f('0x15')]();};}function respondWithResult(_0xbd9160,_0x24f653){_0x24f653=_0x24f653||0xc8;return function(_0x49ae04){if(_0x49ae04){return _0xbd9160[_0xa19f('0x14')](_0x24f653)[_0xa19f('0x16')](_0x49ae04);}};}function respondWithFilteredResult(_0x5a6cac,_0x25e37d){return function(_0x4ccdcf){if(_0x4ccdcf){var _0x237d01=typeof _0x25e37d['offset']==='undefined'&&typeof _0x25e37d[_0xa19f('0x17')]===_0xa19f('0x18');var _0x60b2dd=_0x4ccdcf[_0xa19f('0x19')];var _0x3d913f=_0x237d01?0x0:_0x25e37d['offset'];var _0x527784=_0x237d01?_0x4ccdcf['count']:_0x25e37d['offset']+_0x25e37d[_0xa19f('0x17')];var _0x1e72f4;if(_0x527784>=_0x60b2dd){_0x527784=_0x60b2dd;_0x1e72f4=0xc8;}else{_0x1e72f4=0xce;}_0x5a6cac[_0xa19f('0x14')](_0x1e72f4);return _0x5a6cac[_0xa19f('0x1a')](_0xa19f('0x1b'),_0x3d913f+'-'+_0x527784+'/'+_0x60b2dd)['json'](_0x4ccdcf);}return null;};}function patchUpdates(_0x294c3c){return function(_0x51648d){try{jsonpatch['apply'](_0x51648d,_0x294c3c,!![]);}catch(_0x52cd30){return BPromise[_0xa19f('0x1c')](_0x52cd30);}return _0x51648d[_0xa19f('0x1d')]();};}function saveUpdates(_0x4a27b6,_0xd4fc1e){return function(_0x25e374){if(_0x25e374){return _0x25e374['update'](_0x4a27b6)[_0xa19f('0x1e')](function(_0x401c9f){return _0x401c9f;});}return null;};}function removeEntity(_0x3dbd83,_0x437ae4){return function(_0x487437){if(_0x487437){return _0x487437[_0xa19f('0x1f')]()[_0xa19f('0x1e')](function(){_0x3dbd83[_0xa19f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229c51,_0x213886){return function(_0x2fc381){if(!_0x2fc381){_0x229c51[_0xa19f('0x13')](0x194);}return _0x2fc381;};}function handleError(_0x2da1fb,_0x577884){_0x577884=_0x577884||0x1f4;return function(_0x4adf7a){logger[_0xa19f('0x20')](_0x4adf7a['stack']);if(_0x4adf7a[_0xa19f('0x21')]){delete _0x4adf7a[_0xa19f('0x21')];}_0x2da1fb['status'](_0x577884)[_0xa19f('0x22')](_0x4adf7a);};}exports[_0xa19f('0x23')]=function(_0x1154a2,_0x3d16c8){var _0xbe3ab7={},_0x280049={},_0x368318={'count':0x0,'rows':[]};var _0x7e9b25=_[_0xa19f('0x24')](db[_0xa19f('0x25')][_0xa19f('0x26')],function(_0x4f6e1c){return{'name':_0x4f6e1c[_0xa19f('0x27')],'type':_0x4f6e1c['type'][_0xa19f('0x28')]};});_0x280049[_0xa19f('0x29')]=_[_0xa19f('0x24')](_0x7e9b25,_0xa19f('0x21'));_0x280049[_0xa19f('0x2a')]=_['keys'](_0x1154a2['query']);_0x280049[_0xa19f('0x2b')]=_[_0xa19f('0x2c')](_0x280049[_0xa19f('0x29')],_0x280049[_0xa19f('0x2a')]);_0xbe3ab7[_0xa19f('0x2d')]=_[_0xa19f('0x2c')](_0x280049[_0xa19f('0x29')],qs[_0xa19f('0x2e')](_0x1154a2['query'][_0xa19f('0x2e')]));_0xbe3ab7[_0xa19f('0x2d')]=_0xbe3ab7[_0xa19f('0x2d')][_0xa19f('0x2f')]?_0xbe3ab7[_0xa19f('0x2d')]:_0x280049[_0xa19f('0x29')];if(!_0x1154a2[_0xa19f('0x2a')][_0xa19f('0x30')]('nolimit')){_0xbe3ab7[_0xa19f('0x17')]=qs[_0xa19f('0x17')](_0x1154a2[_0xa19f('0x2a')][_0xa19f('0x17')]);_0xbe3ab7['offset']=qs[_0xa19f('0x31')](_0x1154a2['query'][_0xa19f('0x31')]);}_0xbe3ab7['order']=qs['sort'](_0x1154a2['query'][_0xa19f('0x32')]);_0xbe3ab7[_0xa19f('0x33')]=qs['filters'](_[_0xa19f('0x34')](_0x1154a2[_0xa19f('0x2a')],_0x280049[_0xa19f('0x2b')]),_0x7e9b25);if(_0x1154a2[_0xa19f('0x2a')][_0xa19f('0x35')]){_0xbe3ab7[_0xa19f('0x33')]=_[_0xa19f('0x36')](_0xbe3ab7['where'],{'$or':_[_0xa19f('0x24')](_0x7e9b25,function(_0x1653d7){if(_0x1653d7['type']!==_0xa19f('0x37')){var _0x7cdb79={};_0x7cdb79[_0x1653d7['name']]={'$like':'%'+_0x1154a2[_0xa19f('0x2a')][_0xa19f('0x35')]+'%'};return _0x7cdb79;}})});}_0xbe3ab7=_['merge']({},_0xbe3ab7,_0x1154a2[_0xa19f('0x38')]);var _0x3e6a92={'where':_0xbe3ab7[_0xa19f('0x33')]};return db[_0xa19f('0x25')][_0xa19f('0x19')](_0x3e6a92)[_0xa19f('0x1e')](function(_0x154241){_0x368318['count']=_0x154241;if(_0x1154a2['query'][_0xa19f('0x39')]){_0xbe3ab7[_0xa19f('0x3a')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xa19f('0x3b')](_0xbe3ab7);})[_0xa19f('0x1e')](function(_0x168317){_0x368318[_0xa19f('0x3c')]=_0x168317;return _0x368318;})[_0xa19f('0x1e')](respondWithFilteredResult(_0x3d16c8,_0xbe3ab7))[_0xa19f('0x3d')](handleError(_0x3d16c8,null));};exports[_0xa19f('0x3e')]=function(_0x4b0563,_0x58f90a){var _0x24ab32={'raw':![],'where':{'id':_0x4b0563['params']['id']}},_0x354e67={};_0x354e67['model']=_['keys'](db[_0xa19f('0x25')]['rawAttributes']);_0x354e67['query']=_[_0xa19f('0x3f')](_0x4b0563[_0xa19f('0x2a')]);_0x354e67[_0xa19f('0x2b')]=_[_0xa19f('0x2c')](_0x354e67[_0xa19f('0x29')],_0x354e67['query']);_0x24ab32[_0xa19f('0x2d')]=_[_0xa19f('0x2c')](_0x354e67['model'],qs[_0xa19f('0x2e')](_0x4b0563['query'][_0xa19f('0x2e')]));_0x24ab32['attributes']=_0x24ab32[_0xa19f('0x2d')][_0xa19f('0x2f')]?_0x24ab32[_0xa19f('0x2d')]:_0x354e67[_0xa19f('0x29')];if(_0x4b0563[_0xa19f('0x2a')][_0xa19f('0x39')]){_0x24ab32[_0xa19f('0x3a')]=[{'all':!![]}];}_0x24ab32=_[_0xa19f('0x36')]({},_0x24ab32,_0x4b0563[_0xa19f('0x38')]);return db[_0xa19f('0x25')]['find'](_0x24ab32)[_0xa19f('0x1e')](handleEntityNotFound(_0x58f90a,null))[_0xa19f('0x1e')](respondWithResult(_0x58f90a,null))[_0xa19f('0x3d')](handleError(_0x58f90a,null));};exports['create']=function(_0x267676,_0x14ef15){return db[_0xa19f('0x25')][_0xa19f('0x40')](_0x267676['body'],{})['then'](respondWithResult(_0x14ef15,0xc9))[_0xa19f('0x3d')](handleError(_0x14ef15,null));};exports[_0xa19f('0x41')]=function(_0x479be5,_0x3a7c32){if(_0x479be5[_0xa19f('0x42')]['id']){delete _0x479be5['body']['id'];}return db[_0xa19f('0x25')][_0xa19f('0x43')]({'where':{'id':_0x479be5[_0xa19f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a7c32,null))['then'](saveUpdates(_0x479be5[_0xa19f('0x42')],null))['then'](respondWithResult(_0x3a7c32,null))[_0xa19f('0x3d')](handleError(_0x3a7c32,null));};exports[_0xa19f('0x1f')]=function(_0x5230b7,_0x564413){return db[_0xa19f('0x25')]['find']({'where':{'id':_0x5230b7[_0xa19f('0x44')]['id']}})['then'](handleEntityNotFound(_0x564413,null))[_0xa19f('0x1e')](removeEntity(_0x564413,null))[_0xa19f('0x3d')](handleError(_0x564413,null));};exports[_0xa19f('0x45')]=function(_0x49344f,_0x581cc0,_0xf1e4c){var _0x5495cb={};var _0x177362={};var _0x3057ba;var _0x336a76;return db[_0xa19f('0x25')][_0xa19f('0x46')]({'where':{'id':_0x49344f['params']['id']}})[_0xa19f('0x1e')](handleEntityNotFound(_0x581cc0,null))[_0xa19f('0x1e')](function(_0x567760){if(_0x567760){_0x3057ba=_0x567760;_0x177362[_0xa19f('0x29')]=_['keys'](db[_0xa19f('0x47')][_0xa19f('0x26')]);_0x177362[_0xa19f('0x2a')]=_[_0xa19f('0x3f')](_0x49344f[_0xa19f('0x2a')]);_0x177362[_0xa19f('0x2b')]=_['intersection'](_0x177362[_0xa19f('0x29')],_0x177362['query']);_0x5495cb['attributes']=_[_0xa19f('0x2c')](_0x177362['model'],qs[_0xa19f('0x2e')](_0x49344f['query'][_0xa19f('0x2e')]));_0x5495cb[_0xa19f('0x2d')]=_0x5495cb[_0xa19f('0x2d')]['length']?_0x5495cb[_0xa19f('0x2d')]:_0x177362['model'];_0x5495cb['order']=qs[_0xa19f('0x32')](_0x49344f[_0xa19f('0x2a')][_0xa19f('0x32')]);_0x5495cb[_0xa19f('0x33')]=qs[_0xa19f('0x2b')](_[_0xa19f('0x34')](_0x49344f[_0xa19f('0x2a')],_0x177362[_0xa19f('0x2b')]));if(_0x49344f[_0xa19f('0x2a')][_0xa19f('0x35')]){_0x5495cb['where']=_[_0xa19f('0x36')](_0x5495cb[_0xa19f('0x33')],{'$or':_['map'](_0x5495cb[_0xa19f('0x2d')],function(_0x54c042){var _0x590fc7={};_0x590fc7[_0x54c042]={'$like':'%'+_0x49344f['query'][_0xa19f('0x35')]+'%'};return _0x590fc7;})});}_0x5495cb=_[_0xa19f('0x36')]({},_0x5495cb,_0x49344f['options']);return _0x3057ba[_0xa19f('0x45')](_0x5495cb);}})['then'](function(_0x5d7297){if(_0x5d7297){_0x336a76=_0x5d7297[_0xa19f('0x2f')];if(!_0x49344f[_0xa19f('0x2a')][_0xa19f('0x30')](_0xa19f('0x48'))){_0x5495cb[_0xa19f('0x17')]=qs['limit'](_0x49344f['query']['limit']);_0x5495cb[_0xa19f('0x31')]=qs[_0xa19f('0x31')](_0x49344f[_0xa19f('0x2a')][_0xa19f('0x31')]);}return _0x3057ba[_0xa19f('0x45')](_0x5495cb);}})[_0xa19f('0x1e')](function(_0x409501){if(_0x409501){return _0x409501?{'count':_0x336a76,'rows':_0x409501}:null;}})['then'](respondWithResult(_0x581cc0,null))['catch'](handleError(_0x581cc0,null));};exports[_0xa19f('0x49')]=function(_0xe1d175,_0x2b3171,_0x567b96){var _0x505a07={};var _0x23c962={};var _0x41b2a9;var _0x21d73b;return db[_0xa19f('0x25')][_0xa19f('0x46')]({'where':{'id':_0xe1d175['params']['id']}})['then'](handleEntityNotFound(_0x2b3171,null))[_0xa19f('0x1e')](function(_0x385333){if(_0x385333){_0x41b2a9=_0x385333;_0x23c962[_0xa19f('0x29')]=_[_0xa19f('0x3f')](db[_0xa19f('0x47')]['rawAttributes']);_0x23c962['query']=_[_0xa19f('0x3f')](_0xe1d175['query']);_0x23c962[_0xa19f('0x2b')]=_['intersection'](_0x23c962[_0xa19f('0x29')],_0x23c962['query']);_0x505a07[_0xa19f('0x2d')]=_[_0xa19f('0x2c')](_0x23c962[_0xa19f('0x29')],qs['fields'](_0xe1d175[_0xa19f('0x2a')][_0xa19f('0x2e')]));_0x505a07[_0xa19f('0x2d')]=_0x505a07[_0xa19f('0x2d')][_0xa19f('0x2f')]?_0x505a07[_0xa19f('0x2d')]:_0x23c962[_0xa19f('0x29')];_0x505a07[_0xa19f('0x4a')]=qs[_0xa19f('0x32')](_0xe1d175['query'][_0xa19f('0x32')]);_0x505a07[_0xa19f('0x33')]=qs[_0xa19f('0x2b')](_[_0xa19f('0x34')](_0xe1d175[_0xa19f('0x2a')],_0x23c962['filters']));if(_0xe1d175['query']['filter']){_0x505a07['where']=_[_0xa19f('0x36')](_0x505a07[_0xa19f('0x33')],{'$or':_['map'](_0x505a07['attributes'],function(_0x377e13){var _0x2f8417={};_0x2f8417[_0x377e13]={'$like':'%'+_0xe1d175[_0xa19f('0x2a')][_0xa19f('0x35')]+'%'};return _0x2f8417;})});}_0x505a07=_['merge']({},_0x505a07,_0xe1d175[_0xa19f('0x38')]);return _0x41b2a9[_0xa19f('0x49')](_0x505a07);}})[_0xa19f('0x1e')](function(_0x1ae09c){if(_0x1ae09c){_0x21d73b=_0x1ae09c[_0xa19f('0x2f')];if(!_0xe1d175[_0xa19f('0x2a')]['hasOwnProperty'](_0xa19f('0x48'))){_0x505a07['limit']=qs[_0xa19f('0x17')](_0xe1d175['query'][_0xa19f('0x17')]);_0x505a07[_0xa19f('0x31')]=qs[_0xa19f('0x31')](_0xe1d175['query'][_0xa19f('0x31')]);}return _0x41b2a9[_0xa19f('0x49')](_0x505a07);}})[_0xa19f('0x1e')](function(_0x555165){if(_0x555165){return _0x555165?{'count':_0x21d73b,'rows':_0x555165}:null;}})[_0xa19f('0x1e')](respondWithResult(_0x2b3171,null))[_0xa19f('0x3d')](handleError(_0x2b3171,null));};exports['getDescriptions']=function(_0x3ed6d5,_0x4eabc7,_0x5d87d4){var _0x1425b6={};var _0x1acdfe={};var _0x371416;var _0x408821;return db[_0xa19f('0x25')][_0xa19f('0x46')]({'where':{'id':_0x3ed6d5[_0xa19f('0x44')]['id']}})['then'](handleEntityNotFound(_0x4eabc7,null))[_0xa19f('0x1e')](function(_0x1004b){if(_0x1004b){_0x371416=_0x1004b;_0x1acdfe[_0xa19f('0x29')]=_[_0xa19f('0x3f')](db[_0xa19f('0x47')][_0xa19f('0x26')]);_0x1acdfe['query']=_[_0xa19f('0x3f')](_0x3ed6d5['query']);_0x1acdfe[_0xa19f('0x2b')]=_[_0xa19f('0x2c')](_0x1acdfe[_0xa19f('0x29')],_0x1acdfe[_0xa19f('0x2a')]);_0x1425b6[_0xa19f('0x2d')]=_[_0xa19f('0x2c')](_0x1acdfe[_0xa19f('0x29')],qs[_0xa19f('0x2e')](_0x3ed6d5[_0xa19f('0x2a')][_0xa19f('0x2e')]));_0x1425b6[_0xa19f('0x2d')]=_0x1425b6[_0xa19f('0x2d')][_0xa19f('0x2f')]?_0x1425b6[_0xa19f('0x2d')]:_0x1acdfe[_0xa19f('0x29')];_0x1425b6[_0xa19f('0x4a')]=qs[_0xa19f('0x32')](_0x3ed6d5[_0xa19f('0x2a')][_0xa19f('0x32')]);_0x1425b6[_0xa19f('0x33')]=qs[_0xa19f('0x2b')](_['pick'](_0x3ed6d5['query'],_0x1acdfe['filters']));if(_0x3ed6d5['query'][_0xa19f('0x35')]){_0x1425b6[_0xa19f('0x33')]=_['merge'](_0x1425b6[_0xa19f('0x33')],{'$or':_[_0xa19f('0x24')](_0x1425b6['attributes'],function(_0x16e267){var _0x10aef3={};_0x10aef3[_0x16e267]={'$like':'%'+_0x3ed6d5[_0xa19f('0x2a')]['filter']+'%'};return _0x10aef3;})});}_0x1425b6=_[_0xa19f('0x36')]({},_0x1425b6,_0x3ed6d5['options']);return _0x371416[_0xa19f('0x4b')](_0x1425b6);}})[_0xa19f('0x1e')](function(_0x562088){if(_0x562088){_0x408821=_0x562088['length'];if(!_0x3ed6d5[_0xa19f('0x2a')][_0xa19f('0x30')](_0xa19f('0x48'))){_0x1425b6[_0xa19f('0x17')]=qs[_0xa19f('0x17')](_0x3ed6d5[_0xa19f('0x2a')][_0xa19f('0x17')]);_0x1425b6['offset']=qs[_0xa19f('0x31')](_0x3ed6d5[_0xa19f('0x2a')][_0xa19f('0x31')]);}return _0x371416[_0xa19f('0x4b')](_0x1425b6);}})['then'](function(_0x2dbf28){if(_0x2dbf28){return _0x2dbf28?{'count':_0x408821,'rows':_0x2dbf28}:null;}})[_0xa19f('0x1e')](respondWithResult(_0x4eabc7,null))['catch'](handleError(_0x4eabc7,null));};exports[_0xa19f('0x4c')]=function(_0x287dbf,_0x262cc9,_0xbc3170){var _0x31947b={};var _0x536ef1={};var _0x475b1c;var _0x42ddb7;return db[_0xa19f('0x25')][_0xa19f('0x46')]({'where':{'id':_0x287dbf[_0xa19f('0x44')]['id']}})[_0xa19f('0x1e')](handleEntityNotFound(_0x262cc9,null))['then'](function(_0x345a70){if(_0x345a70){_0x475b1c=_0x345a70;_0x536ef1[_0xa19f('0x29')]=_[_0xa19f('0x3f')](db[_0xa19f('0x4d')][_0xa19f('0x26')]);_0x536ef1[_0xa19f('0x2a')]=_[_0xa19f('0x3f')](_0x287dbf[_0xa19f('0x2a')]);_0x536ef1[_0xa19f('0x2b')]=_[_0xa19f('0x2c')](_0x536ef1[_0xa19f('0x29')],_0x536ef1['query']);_0x31947b[_0xa19f('0x2d')]=_[_0xa19f('0x2c')](_0x536ef1[_0xa19f('0x29')],qs['fields'](_0x287dbf[_0xa19f('0x2a')][_0xa19f('0x2e')]));_0x31947b[_0xa19f('0x2d')]=_0x31947b[_0xa19f('0x2d')][_0xa19f('0x2f')]?_0x31947b[_0xa19f('0x2d')]:_0x536ef1[_0xa19f('0x29')];_0x31947b[_0xa19f('0x4a')]=qs[_0xa19f('0x32')](_0x287dbf[_0xa19f('0x2a')][_0xa19f('0x32')]);_0x31947b[_0xa19f('0x33')]=qs[_0xa19f('0x2b')](_['pick'](_0x287dbf[_0xa19f('0x2a')],_0x536ef1[_0xa19f('0x2b')]));if(_0x287dbf[_0xa19f('0x2a')][_0xa19f('0x35')]){_0x31947b['where']=_['merge'](_0x31947b['where'],{'$or':_[_0xa19f('0x24')](_0x31947b[_0xa19f('0x2d')],function(_0x2d3e89){var _0x43270c={};_0x43270c[_0x2d3e89]={'$like':'%'+_0x287dbf[_0xa19f('0x2a')]['filter']+'%'};return _0x43270c;})});}_0x31947b=_['merge']({},_0x31947b,_0x287dbf[_0xa19f('0x38')]);return _0x475b1c['getTags'](_0x31947b);}})[_0xa19f('0x1e')](function(_0x56f813){if(_0x56f813){_0x42ddb7=_0x56f813['length'];if(!_0x287dbf[_0xa19f('0x2a')][_0xa19f('0x30')](_0xa19f('0x48'))){_0x31947b[_0xa19f('0x17')]=qs[_0xa19f('0x17')](_0x287dbf[_0xa19f('0x2a')][_0xa19f('0x17')]);_0x31947b[_0xa19f('0x31')]=qs[_0xa19f('0x31')](_0x287dbf['query'][_0xa19f('0x31')]);}return _0x475b1c[_0xa19f('0x4c')](_0x31947b);}})[_0xa19f('0x1e')](function(_0xb7c6d6){if(_0xb7c6d6){return _0xb7c6d6?{'count':_0x42ddb7,'rows':_0xb7c6d6}:null;}})[_0xa19f('0x1e')](respondWithResult(_0x262cc9,null))['catch'](handleError(_0x262cc9,null));};exports[_0xa19f('0x4e')]=function(_0x58a0b3,_0x34f696,_0x312473){if(_0x58a0b3[_0xa19f('0x42')]['id']){delete _0x58a0b3[_0xa19f('0x42')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x58a0b3[_0xa19f('0x44')]['id']}})['then'](handleEntityNotFound(_0x34f696,null))[_0xa19f('0x1e')](function(_0x376e22){if(_0x376e22){return _0x376e22[_0xa19f('0x4e')](_0x58a0b3[_0xa19f('0x42')][_0xa19f('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x34f696,null))[_0xa19f('0x3d')](handleError(_0x34f696,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 124a70a..28934a0 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 _0xfa99=['FreshdeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0xfa99,0xe5));var _0x9fa9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfa99[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x9fa9('0x0'));var logger=require(_0x9fa9('0x1'))(_0x9fa9('0x2'));var moment=require(_0x9fa9('0x3'));var BPromise=require(_0x9fa9('0x4'));var rp=require(_0x9fa9('0x5'));var fs=require('fs');var path=require(_0x9fa9('0x6'));var rimraf=require(_0x9fa9('0x7'));var config=require(_0x9fa9('0x8'));var attributes=require(_0x9fa9('0x9'));module[_0x9fa9('0xa')]=function(_0x2e9566,_0x91d635){return _0x2e9566['define'](_0x9fa9('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd079=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','moment','bluebird','path'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd079,0xd7));var _0x9d07=function(_0x118221,_0x7c2543){_0x118221=_0x118221-0x0;var _0x117be1=_0xd079[_0x118221];return _0x117be1;};'use strict';var _=require(_0x9d07('0x0'));var util=require(_0x9d07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d07('0x2'));var BPromise=require(_0x9d07('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d07('0x4'));var rimraf=require(_0x9d07('0x5'));var config=require(_0x9d07('0x6'));var attributes=require(_0x9d07('0x7'));module[_0x9d07('0x8')]=function(_0x45f529,_0x25ea11){return _0x45f529[_0x9d07('0x9')](_0x9d07('0xa'),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 bea0590..6f50f6b 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 _0x9afa=['../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x9afa,0x88));var _0xa9af=function(_0x279ed5,_0x2a8e27){_0x279ed5=_0x279ed5-0x0;var _0x4a3cfa=_0x9afa[_0x279ed5];return _0x4a3cfa;};'use strict';var _=require('lodash');var util=require(_0xa9af('0x0'));var moment=require(_0xa9af('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9af('0x2'));var fs=require('fs');var Redis=require(_0xa9af('0x3'));var db=require(_0xa9af('0x4'))['db'];var utils=require(_0xa9af('0x5'));var logger=require(_0xa9af('0x6'))(_0xa9af('0x7'));var config=require(_0xa9af('0x8'));var jayson=require(_0xa9af('0x9'));var client=jayson[_0xa9af('0xa')][_0xa9af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3393b0,_0x4037ea,_0x1d7cc7){return new BPromise(function(_0x20ef40,_0x5a7b01){return client[_0xa9af('0xc')](_0x3393b0,_0x1d7cc7)[_0xa9af('0xd')](function(_0x92e1a8){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4037ea,'request\x20sent');logger[_0xa9af('0xe')](_0xa9af('0xf'),_0x4037ea,_0xa9af('0x10'),JSON[_0xa9af('0x11')](_0x92e1a8));if(_0x92e1a8[_0xa9af('0x12')]){if(_0x92e1a8[_0xa9af('0x12')][_0xa9af('0x13')]===0x1f4){logger['error'](_0xa9af('0x14'),_0x4037ea,_0x92e1a8[_0xa9af('0x12')][_0xa9af('0x15')]);return _0x5a7b01(_0x92e1a8['error'][_0xa9af('0x15')]);}logger[_0xa9af('0x12')](_0xa9af('0x14'),_0x4037ea,_0x92e1a8['error'][_0xa9af('0x15')]);return _0x20ef40(_0x92e1a8[_0xa9af('0x12')][_0xa9af('0x15')]);}else{logger[_0xa9af('0x16')](_0xa9af('0x14'),_0x4037ea,'request\x20sent');_0x20ef40(_0x92e1a8['result'][_0xa9af('0x15')]);}})[_0xa9af('0x17')](function(_0x301ffb){logger[_0xa9af('0x12')](_0xa9af('0x14'),_0x4037ea,_0x301ffb);_0x5a7b01(_0x301ffb);});});} \ No newline at end of file +var _0x5be5=['info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3c7426,_0x53d4a6){var _0xdde032=function(_0x1e4fe0){while(--_0x1e4fe0){_0x3c7426['push'](_0x3c7426['shift']());}};_0xdde032(++_0x53d4a6);}(_0x5be5,0x179));var _0x55be=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x5be5[_0x38cb7c];return _0x2a5f5e;};'use strict';var _=require('lodash');var util=require(_0x55be('0x0'));var moment=require(_0x55be('0x1'));var BPromise=require('bluebird');var rs=require(_0x55be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55be('0x3'))['db'];var utils=require(_0x55be('0x4'));var logger=require('../../config/logger')(_0x55be('0x5'));var config=require(_0x55be('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x55be('0x7')][_0x55be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59dddd,_0x1761c2,_0x4e8a7a){return new BPromise(function(_0x27c21,_0x404e89){return client[_0x55be('0x9')](_0x59dddd,_0x4e8a7a)[_0x55be('0xa')](function(_0x557f9f){logger['info'](_0x55be('0xb'),_0x1761c2,_0x55be('0xc'));logger[_0x55be('0xd')](_0x55be('0xe'),_0x1761c2,'request\x20sent',JSON[_0x55be('0xf')](_0x557f9f));if(_0x557f9f[_0x55be('0x10')]){if(_0x557f9f[_0x55be('0x10')][_0x55be('0x11')]===0x1f4){logger[_0x55be('0x10')](_0x55be('0xb'),_0x1761c2,_0x557f9f['error'][_0x55be('0x12')]);return _0x404e89(_0x557f9f[_0x55be('0x10')][_0x55be('0x12')]);}logger[_0x55be('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1761c2,_0x557f9f[_0x55be('0x10')]['message']);return _0x27c21(_0x557f9f['error'][_0x55be('0x12')]);}else{logger[_0x55be('0x13')](_0x55be('0xb'),_0x1761c2,_0x55be('0xc'));_0x27c21(_0x557f9f[_0x55be('0x14')][_0x55be('0x12')]);}})[_0x55be('0x15')](function(_0x45d4f5){logger['error'](_0x55be('0xb'),_0x1761c2,_0x45d4f5);_0x404e89(_0x45d4f5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fd09bee..010ce23 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 _0x595c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x7cfc8e,_0x556614){var _0x3a2e95=function(_0x490d6f){while(--_0x490d6f){_0x7cfc8e['push'](_0x7cfc8e['shift']());}};_0x3a2e95(++_0x556614);}(_0x595c,0x118));var _0xc595=function(_0x5dc57f,_0x131db8){_0x5dc57f=_0x5dc57f-0x0;var _0x5c6b7b=_0x595c[_0x5dc57f];return _0x5c6b7b;};'use strict';var multer=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var path=require(_0xc595('0x2'));var timeout=require(_0xc595('0x3'));var express=require(_0xc595('0x4'));var router=express['Router']();var fs_extra=require(_0xc595('0x5'));var auth=require(_0xc595('0x6'));var interaction=require(_0xc595('0x7'));var config=require(_0xc595('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xc595('0x9')]('/',auth[_0xc595('0xa')](),controller[_0xc595('0xb')]);router[_0xc595('0x9')]('/:id',auth[_0xc595('0xa')](),controller[_0xc595('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc595('0xd')]);router[_0xc595('0xe')]('/:id',auth[_0xc595('0xa')](),controller['update']);router[_0xc595('0xf')](_0xc595('0x10'),auth[_0xc595('0xa')](),controller[_0xc595('0x11')]);module[_0xc595('0x12')]=router; \ No newline at end of file +var _0x79ce=['../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x18c4a7,_0x3f6e2c){var _0x6c6189=function(_0x39f190){while(--_0x39f190){_0x18c4a7['push'](_0x18c4a7['shift']());}};_0x6c6189(++_0x3f6e2c);}(_0x79ce,0x14f));var _0xe79c=function(_0x30bd9,_0x4c8859){_0x30bd9=_0x30bd9-0x0;var _0x58b6f5=_0x79ce[_0x30bd9];return _0x58b6f5;};'use strict';var multer=require(_0xe79c('0x0'));var util=require(_0xe79c('0x1'));var path=require(_0xe79c('0x2'));var timeout=require(_0xe79c('0x3'));var express=require('express');var router=express[_0xe79c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe79c('0x5'));var interaction=require(_0xe79c('0x6'));var config=require(_0xe79c('0x7'));var controller=require(_0xe79c('0x8'));router[_0xe79c('0x9')]('/',auth[_0xe79c('0xa')](),controller[_0xe79c('0xb')]);router['get'](_0xe79c('0xc'),auth[_0xe79c('0xa')](),controller['show']);router[_0xe79c('0xd')]('/',auth['isAuthenticated'](),controller[_0xe79c('0xe')]);router[_0xe79c('0xf')](_0xe79c('0xc'),auth[_0xe79c('0xa')](),controller['update']);router[_0xe79c('0x10')]('/:id',auth[_0xe79c('0xa')](),controller['destroy']);module[_0xe79c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index bd3d103..834a29d 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 _0x712d=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x501aaf,_0x50a951){var _0x21abe8=function(_0x5b8ac6){while(--_0x5b8ac6){_0x501aaf['push'](_0x501aaf['shift']());}};_0x21abe8(++_0x50a951);}(_0x712d,0x1ca));var _0xd712=function(_0x1a21e4,_0x57d560){_0x1a21e4=_0x1a21e4-0x0;var _0x2ada35=_0x712d[_0x1a21e4];return _0x2ada35;};'use strict';var Sequelize=require('sequelize');module[_0xd712('0x0')]={'type':{'type':Sequelize[_0xd712('0x1')](_0xd712('0x2'),_0xd712('0x3'),_0xd712('0x4'),'keyValue',_0xd712('0x5')),'defaultValue':_0xd712('0x2')},'content':{'type':Sequelize[_0xd712('0x6')]},'key':{'type':Sequelize[_0xd712('0x6')]},'keyType':{'type':Sequelize[_0xd712('0x1')](_0xd712('0x2'),_0xd712('0x3'),_0xd712('0x4'))},'keyContent':{'type':Sequelize[_0xd712('0x6')]},'idField':{'type':Sequelize[_0xd712('0x6')]},'nameField':{'type':Sequelize[_0xd712('0x6')]},'customField':{'type':Sequelize[_0xd712('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1830=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x282842,_0x4a8543){var _0x14fb59=function(_0x27e66f){while(--_0x27e66f){_0x282842['push'](_0x282842['shift']());}};_0x14fb59(++_0x4a8543);}(_0x1830,0x103));var _0x0183=function(_0x2c2f35,_0x20cda1){_0x2c2f35=_0x2c2f35-0x0;var _0x543b7e=_0x1830[_0x2c2f35];return _0x543b7e;};'use strict';var Sequelize=require(_0x0183('0x0'));module[_0x0183('0x1')]={'type':{'type':Sequelize[_0x0183('0x2')]('string',_0x0183('0x3'),_0x0183('0x4'),'keyValue',_0x0183('0x5')),'defaultValue':_0x0183('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0183('0x2')](_0x0183('0x6'),_0x0183('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0183('0x7')]},'customField':{'type':Sequelize[_0x0183('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5b8768f..2a8bf8d 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 _0x0490=['FreshdeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','save','update','then','destroy','stack','name','send','index'];(function(_0x11a106,_0x5fc559){var _0x4b3b84=function(_0x3faeba){while(--_0x3faeba){_0x11a106['push'](_0x11a106['shift']());}};_0x4b3b84(++_0x5fc559);}(_0x0490,0x147));var _0x0049=function(_0x4547f6,_0x36c67a){_0x4547f6=_0x4547f6-0x0;var _0x504bee=_0x0490[_0x4547f6];return _0x504bee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0049('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0049('0x1'));var Mustache=require(_0x0049('0x2'));var util=require(_0x0049('0x3'));var path=require(_0x0049('0x4'));var sox=require(_0x0049('0x5'));var csv=require(_0x0049('0x6'));var ejs=require(_0x0049('0x7'));var fs=require('fs');var fs_extra=require(_0x0049('0x8'));var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var licenseUtil=require(_0x0049('0x17'));var db=require(_0x0049('0x18'))['db'];function respondWithStatusCode(_0x5b4d44,_0x547be9){_0x547be9=_0x547be9||0xcc;return function(_0x3cf392){if(_0x3cf392){return _0x5b4d44[_0x0049('0x19')](_0x547be9);}return _0x5b4d44[_0x0049('0x1a')](_0x547be9)[_0x0049('0x1b')]();};}function respondWithResult(_0x42dc6b,_0x5934fc){_0x5934fc=_0x5934fc||0xc8;return function(_0x3aabfb){if(_0x3aabfb){return _0x42dc6b[_0x0049('0x1a')](_0x5934fc)['json'](_0x3aabfb);}};}function respondWithFilteredResult(_0x1802f5,_0x2aace1){return function(_0x2d6b06){if(_0x2d6b06){var _0x1a62aa=typeof _0x2aace1['offset']==='undefined'&&typeof _0x2aace1[_0x0049('0x1c')]===_0x0049('0x1d');var _0x291a94=_0x2d6b06[_0x0049('0x1e')];var _0x102b40=_0x1a62aa?0x0:_0x2aace1[_0x0049('0x1f')];var _0x191a20=_0x1a62aa?_0x2d6b06[_0x0049('0x1e')]:_0x2aace1[_0x0049('0x1f')]+_0x2aace1[_0x0049('0x1c')];var _0x59c64f;if(_0x191a20>=_0x291a94){_0x191a20=_0x291a94;_0x59c64f=0xc8;}else{_0x59c64f=0xce;}_0x1802f5[_0x0049('0x1a')](_0x59c64f);return _0x1802f5[_0x0049('0x20')]('Content-Range',_0x102b40+'-'+_0x191a20+'/'+_0x291a94)[_0x0049('0x21')](_0x2d6b06);}return null;};}function patchUpdates(_0x4624ff){return function(_0x2a5ec3){try{jsonpatch[_0x0049('0x22')](_0x2a5ec3,_0x4624ff,!![]);}catch(_0x144faa){return BPromise['reject'](_0x144faa);}return _0x2a5ec3[_0x0049('0x23')]();};}function saveUpdates(_0x462ceb,_0x49c00b){return function(_0x2170d2){if(_0x2170d2){return _0x2170d2[_0x0049('0x24')](_0x462ceb)[_0x0049('0x25')](function(_0x2507e9){return _0x2507e9;});}return null;};}function removeEntity(_0x91d727,_0x2e9f44){return function(_0x223c9c){if(_0x223c9c){return _0x223c9c[_0x0049('0x26')]()[_0x0049('0x25')](function(){_0x91d727[_0x0049('0x1a')](0xcc)[_0x0049('0x1b')]();});}};}function handleEntityNotFound(_0x211e5b,_0x47b0c4){return function(_0x217a12){if(!_0x217a12){_0x211e5b[_0x0049('0x19')](0x194);}return _0x217a12;};}function handleError(_0x3ce97f,_0x118bc0){_0x118bc0=_0x118bc0||0x1f4;return function(_0x435789){logger['error'](_0x435789[_0x0049('0x27')]);if(_0x435789['name']){delete _0x435789[_0x0049('0x28')];}_0x3ce97f[_0x0049('0x1a')](_0x118bc0)[_0x0049('0x29')](_0x435789);};}exports[_0x0049('0x2a')]=function(_0x4bc932,_0x305623){var _0x402774={},_0x2407d8={},_0x2b8715={'count':0x0,'rows':[]};var _0x414029=_['map'](db[_0x0049('0x2b')][_0x0049('0x2c')],function(_0x1c8b74){return{'name':_0x1c8b74['fieldName'],'type':_0x1c8b74[_0x0049('0x2d')][_0x0049('0x2e')]};});_0x2407d8[_0x0049('0x2f')]=_[_0x0049('0x30')](_0x414029,'name');_0x2407d8[_0x0049('0x31')]=_[_0x0049('0x32')](_0x4bc932['query']);_0x2407d8[_0x0049('0x33')]=_[_0x0049('0x34')](_0x2407d8['model'],_0x2407d8[_0x0049('0x31')]);_0x402774[_0x0049('0x35')]=_[_0x0049('0x34')](_0x2407d8[_0x0049('0x2f')],qs[_0x0049('0x36')](_0x4bc932['query'][_0x0049('0x36')]));_0x402774[_0x0049('0x35')]=_0x402774[_0x0049('0x35')][_0x0049('0x37')]?_0x402774[_0x0049('0x35')]:_0x2407d8['model'];if(!_0x4bc932[_0x0049('0x31')]['hasOwnProperty'](_0x0049('0x38'))){_0x402774[_0x0049('0x1c')]=qs[_0x0049('0x1c')](_0x4bc932['query'][_0x0049('0x1c')]);_0x402774['offset']=qs[_0x0049('0x1f')](_0x4bc932[_0x0049('0x31')][_0x0049('0x1f')]);}_0x402774['order']=qs[_0x0049('0x39')](_0x4bc932[_0x0049('0x31')][_0x0049('0x39')]);_0x402774[_0x0049('0x3a')]=qs[_0x0049('0x33')](_[_0x0049('0x3b')](_0x4bc932['query'],_0x2407d8[_0x0049('0x33')]),_0x414029);if(_0x4bc932[_0x0049('0x31')]['filter']){_0x402774['where']=_[_0x0049('0x3c')](_0x402774[_0x0049('0x3a')],{'$or':_[_0x0049('0x30')](_0x414029,function(_0x10b31b){if(_0x10b31b[_0x0049('0x2d')]!==_0x0049('0x3d')){var _0x2ab147={};_0x2ab147[_0x10b31b[_0x0049('0x28')]]={'$like':'%'+_0x4bc932['query'][_0x0049('0x3e')]+'%'};return _0x2ab147;}})});}_0x402774=_[_0x0049('0x3c')]({},_0x402774,_0x4bc932[_0x0049('0x3f')]);var _0x105904={'where':_0x402774[_0x0049('0x3a')]};return db[_0x0049('0x2b')][_0x0049('0x1e')](_0x105904)[_0x0049('0x25')](function(_0x48e0c5){_0x2b8715[_0x0049('0x1e')]=_0x48e0c5;if(_0x4bc932[_0x0049('0x31')][_0x0049('0x40')]){_0x402774[_0x0049('0x41')]=[{'all':!![]}];}return db[_0x0049('0x2b')][_0x0049('0x42')](_0x402774);})[_0x0049('0x25')](function(_0x21ea1a){_0x2b8715[_0x0049('0x43')]=_0x21ea1a;return _0x2b8715;})[_0x0049('0x25')](respondWithFilteredResult(_0x305623,_0x402774))[_0x0049('0x44')](handleError(_0x305623,null));};exports[_0x0049('0x45')]=function(_0x42c073,_0x4ebc42){var _0x22e083={'raw':!![],'where':{'id':_0x42c073[_0x0049('0x46')]['id']}},_0x2818dd={};_0x2818dd['model']=_['keys'](db[_0x0049('0x2b')]['rawAttributes']);_0x2818dd[_0x0049('0x31')]=_[_0x0049('0x32')](_0x42c073[_0x0049('0x31')]);_0x2818dd[_0x0049('0x33')]=_[_0x0049('0x34')](_0x2818dd[_0x0049('0x2f')],_0x2818dd[_0x0049('0x31')]);_0x22e083[_0x0049('0x35')]=_['intersection'](_0x2818dd['model'],qs['fields'](_0x42c073[_0x0049('0x31')][_0x0049('0x36')]));_0x22e083[_0x0049('0x35')]=_0x22e083['attributes'][_0x0049('0x37')]?_0x22e083[_0x0049('0x35')]:_0x2818dd[_0x0049('0x2f')];if(_0x42c073['query']['includeAll']){_0x22e083['include']=[{'all':!![]}];}_0x22e083=_[_0x0049('0x3c')]({},_0x22e083,_0x42c073['options']);return db['FreshdeskField'][_0x0049('0x47')](_0x22e083)[_0x0049('0x25')](handleEntityNotFound(_0x4ebc42,null))[_0x0049('0x25')](respondWithResult(_0x4ebc42,null))[_0x0049('0x44')](handleError(_0x4ebc42,null));};exports[_0x0049('0x48')]=function(_0x4a9961,_0xa60a2b){return db[_0x0049('0x2b')][_0x0049('0x48')](_0x4a9961[_0x0049('0x49')],{})[_0x0049('0x25')](respondWithResult(_0xa60a2b,0xc9))[_0x0049('0x44')](handleError(_0xa60a2b,null));};exports['update']=function(_0x433ce2,_0x5e9087){if(_0x433ce2[_0x0049('0x49')]['id']){delete _0x433ce2['body']['id'];}return db[_0x0049('0x2b')][_0x0049('0x47')]({'where':{'id':_0x433ce2[_0x0049('0x46')]['id']}})[_0x0049('0x25')](handleEntityNotFound(_0x5e9087,null))[_0x0049('0x25')](saveUpdates(_0x433ce2['body'],null))[_0x0049('0x25')](respondWithResult(_0x5e9087,null))[_0x0049('0x44')](handleError(_0x5e9087,null));};exports[_0x0049('0x26')]=function(_0x108694,_0x1cd1dc){return db[_0x0049('0x2b')]['find']({'where':{'id':_0x108694[_0x0049('0x46')]['id']}})['then'](handleEntityNotFound(_0x1cd1dc,null))[_0x0049('0x25')](removeEntity(_0x1cd1dc,null))[_0x0049('0x44')](handleError(_0x1cd1dc,null));}; \ No newline at end of file +var _0xe812=['json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','update','find','destroy','catch','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe812,0x1f2));var _0x2e81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe812[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e81('0x0'));var zipdir=require(_0x2e81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e81('0x2'));var BPromise=require(_0x2e81('0x3'));var Mustache=require('mustache');var util=require(_0x2e81('0x4'));var path=require(_0x2e81('0x5'));var sox=require('sox');var csv=require(_0x2e81('0x6'));var ejs=require(_0x2e81('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e81('0x8'));var squel=require(_0x2e81('0x9'));var crypto=require(_0x2e81('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e81('0xb'));var toCsv=require(_0x2e81('0x6'));var querystring=require(_0x2e81('0xc'));var Papa=require(_0x2e81('0xd'));var Redis=require('ioredis');var authService=require(_0x2e81('0xe'));var qs=require(_0x2e81('0xf'));var as=require(_0x2e81('0x10'));var hardwareService=require(_0x2e81('0x11'));var logger=require(_0x2e81('0x12'))(_0x2e81('0x13'));var utils=require(_0x2e81('0x14'));var config=require(_0x2e81('0x15'));var licenseUtil=require(_0x2e81('0x16'));var db=require(_0x2e81('0x17'))['db'];function respondWithStatusCode(_0x4284f3,_0x5c58a2){_0x5c58a2=_0x5c58a2||0xcc;return function(_0x30a730){if(_0x30a730){return _0x4284f3[_0x2e81('0x18')](_0x5c58a2);}return _0x4284f3['status'](_0x5c58a2)[_0x2e81('0x19')]();};}function respondWithResult(_0x5598a9,_0x2a4411){_0x2a4411=_0x2a4411||0xc8;return function(_0x2b24f0){if(_0x2b24f0){return _0x5598a9[_0x2e81('0x1a')](_0x2a4411)[_0x2e81('0x1b')](_0x2b24f0);}};}function respondWithFilteredResult(_0x1bb937,_0x3a8c05){return function(_0x53da62){if(_0x53da62){var _0xc4d315=typeof _0x3a8c05[_0x2e81('0x1c')]==='undefined'&&typeof _0x3a8c05[_0x2e81('0x1d')]==='undefined';var _0x2cc0c6=_0x53da62[_0x2e81('0x1e')];var _0x4c1b11=_0xc4d315?0x0:_0x3a8c05[_0x2e81('0x1c')];var _0x2bb9b6=_0xc4d315?_0x53da62[_0x2e81('0x1e')]:_0x3a8c05[_0x2e81('0x1c')]+_0x3a8c05[_0x2e81('0x1d')];var _0x1f20bf;if(_0x2bb9b6>=_0x2cc0c6){_0x2bb9b6=_0x2cc0c6;_0x1f20bf=0xc8;}else{_0x1f20bf=0xce;}_0x1bb937[_0x2e81('0x1a')](_0x1f20bf);return _0x1bb937[_0x2e81('0x1f')](_0x2e81('0x20'),_0x4c1b11+'-'+_0x2bb9b6+'/'+_0x2cc0c6)[_0x2e81('0x1b')](_0x53da62);}return null;};}function patchUpdates(_0x524694){return function(_0x10b77e){try{jsonpatch[_0x2e81('0x21')](_0x10b77e,_0x524694,!![]);}catch(_0x9ddf6b){return BPromise[_0x2e81('0x22')](_0x9ddf6b);}return _0x10b77e[_0x2e81('0x23')]();};}function saveUpdates(_0x386721,_0x18b9be){return function(_0x39ffa8){if(_0x39ffa8){return _0x39ffa8['update'](_0x386721)[_0x2e81('0x24')](function(_0x49e9f1){return _0x49e9f1;});}return null;};}function removeEntity(_0x2d50af,_0x4fe130){return function(_0x1d09cb){if(_0x1d09cb){return _0x1d09cb['destroy']()['then'](function(){_0x2d50af[_0x2e81('0x1a')](0xcc)[_0x2e81('0x19')]();});}};}function handleEntityNotFound(_0x4a75ff,_0x39e8c0){return function(_0x19b1a9){if(!_0x19b1a9){_0x4a75ff[_0x2e81('0x18')](0x194);}return _0x19b1a9;};}function handleError(_0x2d2fac,_0x2b66f9){_0x2b66f9=_0x2b66f9||0x1f4;return function(_0x3d13fc){logger[_0x2e81('0x25')](_0x3d13fc[_0x2e81('0x26')]);if(_0x3d13fc[_0x2e81('0x27')]){delete _0x3d13fc[_0x2e81('0x27')];}_0x2d2fac[_0x2e81('0x1a')](_0x2b66f9)[_0x2e81('0x28')](_0x3d13fc);};}exports[_0x2e81('0x29')]=function(_0x3ec91d,_0x4d195d){var _0x4e9aa5={},_0xfc7ce3={},_0x38cbc2={'count':0x0,'rows':[]};var _0x20ef21=_[_0x2e81('0x2a')](db[_0x2e81('0x2b')][_0x2e81('0x2c')],function(_0x243b20){return{'name':_0x243b20[_0x2e81('0x2d')],'type':_0x243b20[_0x2e81('0x2e')][_0x2e81('0x2f')]};});_0xfc7ce3[_0x2e81('0x30')]=_['map'](_0x20ef21,_0x2e81('0x27'));_0xfc7ce3[_0x2e81('0x31')]=_[_0x2e81('0x32')](_0x3ec91d[_0x2e81('0x31')]);_0xfc7ce3[_0x2e81('0x33')]=_[_0x2e81('0x34')](_0xfc7ce3[_0x2e81('0x30')],_0xfc7ce3[_0x2e81('0x31')]);_0x4e9aa5[_0x2e81('0x35')]=_[_0x2e81('0x34')](_0xfc7ce3[_0x2e81('0x30')],qs[_0x2e81('0x36')](_0x3ec91d[_0x2e81('0x31')][_0x2e81('0x36')]));_0x4e9aa5[_0x2e81('0x35')]=_0x4e9aa5[_0x2e81('0x35')][_0x2e81('0x37')]?_0x4e9aa5['attributes']:_0xfc7ce3[_0x2e81('0x30')];if(!_0x3ec91d[_0x2e81('0x31')]['hasOwnProperty'](_0x2e81('0x38'))){_0x4e9aa5[_0x2e81('0x1d')]=qs['limit'](_0x3ec91d[_0x2e81('0x31')][_0x2e81('0x1d')]);_0x4e9aa5[_0x2e81('0x1c')]=qs['offset'](_0x3ec91d[_0x2e81('0x31')][_0x2e81('0x1c')]);}_0x4e9aa5[_0x2e81('0x39')]=qs[_0x2e81('0x3a')](_0x3ec91d[_0x2e81('0x31')]['sort']);_0x4e9aa5['where']=qs['filters'](_['pick'](_0x3ec91d[_0x2e81('0x31')],_0xfc7ce3['filters']),_0x20ef21);if(_0x3ec91d['query'][_0x2e81('0x3b')]){_0x4e9aa5[_0x2e81('0x3c')]=_[_0x2e81('0x3d')](_0x4e9aa5['where'],{'$or':_[_0x2e81('0x2a')](_0x20ef21,function(_0x21b596){if(_0x21b596[_0x2e81('0x2e')]!==_0x2e81('0x3e')){var _0x396eef={};_0x396eef[_0x21b596['name']]={'$like':'%'+_0x3ec91d['query'][_0x2e81('0x3b')]+'%'};return _0x396eef;}})});}_0x4e9aa5=_[_0x2e81('0x3d')]({},_0x4e9aa5,_0x3ec91d[_0x2e81('0x3f')]);var _0x58aab2={'where':_0x4e9aa5[_0x2e81('0x3c')]};return db[_0x2e81('0x2b')][_0x2e81('0x1e')](_0x58aab2)['then'](function(_0x237ac4){_0x38cbc2[_0x2e81('0x1e')]=_0x237ac4;if(_0x3ec91d[_0x2e81('0x31')][_0x2e81('0x40')]){_0x4e9aa5[_0x2e81('0x41')]=[{'all':!![]}];}return db[_0x2e81('0x2b')][_0x2e81('0x42')](_0x4e9aa5);})[_0x2e81('0x24')](function(_0x5508f0){_0x38cbc2['rows']=_0x5508f0;return _0x38cbc2;})[_0x2e81('0x24')](respondWithFilteredResult(_0x4d195d,_0x4e9aa5))['catch'](handleError(_0x4d195d,null));};exports[_0x2e81('0x43')]=function(_0x9f5f03,_0xf3d7a5){var _0x42154f={'raw':!![],'where':{'id':_0x9f5f03[_0x2e81('0x44')]['id']}},_0x3c5fbb={};_0x3c5fbb['model']=_['keys'](db[_0x2e81('0x2b')][_0x2e81('0x2c')]);_0x3c5fbb[_0x2e81('0x31')]=_['keys'](_0x9f5f03[_0x2e81('0x31')]);_0x3c5fbb[_0x2e81('0x33')]=_['intersection'](_0x3c5fbb[_0x2e81('0x30')],_0x3c5fbb['query']);_0x42154f[_0x2e81('0x35')]=_[_0x2e81('0x34')](_0x3c5fbb[_0x2e81('0x30')],qs[_0x2e81('0x36')](_0x9f5f03['query'][_0x2e81('0x36')]));_0x42154f['attributes']=_0x42154f[_0x2e81('0x35')][_0x2e81('0x37')]?_0x42154f['attributes']:_0x3c5fbb[_0x2e81('0x30')];if(_0x9f5f03[_0x2e81('0x31')][_0x2e81('0x40')]){_0x42154f[_0x2e81('0x41')]=[{'all':!![]}];}_0x42154f=_[_0x2e81('0x3d')]({},_0x42154f,_0x9f5f03[_0x2e81('0x3f')]);return db[_0x2e81('0x2b')]['find'](_0x42154f)[_0x2e81('0x24')](handleEntityNotFound(_0xf3d7a5,null))['then'](respondWithResult(_0xf3d7a5,null))['catch'](handleError(_0xf3d7a5,null));};exports[_0x2e81('0x45')]=function(_0x5bd250,_0x551ad0){return db[_0x2e81('0x2b')][_0x2e81('0x45')](_0x5bd250[_0x2e81('0x46')],{})['then'](respondWithResult(_0x551ad0,0xc9))['catch'](handleError(_0x551ad0,null));};exports[_0x2e81('0x47')]=function(_0x1dd4d7,_0x16ed11){if(_0x1dd4d7[_0x2e81('0x46')]['id']){delete _0x1dd4d7['body']['id'];}return db['FreshdeskField'][_0x2e81('0x48')]({'where':{'id':_0x1dd4d7[_0x2e81('0x44')]['id']}})['then'](handleEntityNotFound(_0x16ed11,null))['then'](saveUpdates(_0x1dd4d7[_0x2e81('0x46')],null))[_0x2e81('0x24')](respondWithResult(_0x16ed11,null))['catch'](handleError(_0x16ed11,null));};exports[_0x2e81('0x49')]=function(_0x33a4d7,_0x25b243){return db[_0x2e81('0x2b')][_0x2e81('0x48')]({'where':{'id':_0x33a4d7['params']['id']}})[_0x2e81('0x24')](handleEntityNotFound(_0x25b243,null))[_0x2e81('0x24')](removeEntity(_0x25b243,null))[_0x2e81('0x4a')](handleError(_0x25b243,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e29afbd..e2b1728 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 _0x9de3=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0xcf3b3e,_0x4edd7b){var _0x48c583=function(_0x5f0cff){while(--_0x5f0cff){_0xcf3b3e['push'](_0xcf3b3e['shift']());}};_0x48c583(++_0x4edd7b);}(_0x9de3,0xea));var _0x39de=function(_0x2e5902,_0x442eaa){_0x2e5902=_0x2e5902-0x0;var _0x93d732=_0x9de3[_0x2e5902];return _0x93d732;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var logger=require(_0x39de('0x1'))(_0x39de('0x2'));var moment=require(_0x39de('0x3'));var BPromise=require('bluebird');var rp=require(_0x39de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39de('0x5'));var config=require(_0x39de('0x6'));var attributes=require(_0x39de('0x7'));module[_0x39de('0x8')]=function(_0x529524,_0x2e8f82){return _0x529524[_0x39de('0x9')](_0x39de('0xa'),attributes,{'tableName':_0x39de('0xb'),'paranoid':![],'indexes':[{'name':_0x39de('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc52f=['idField','FieldId','lodash','util','bluebird','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc52f,0x1e3));var _0xfc52=function(_0x29d7f6,_0xabb982){_0x29d7f6=_0x29d7f6-0x0;var _0x237809=_0xc52f[_0x29d7f6];return _0x237809;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc52('0x2'));var rp=require(_0xfc52('0x3'));var fs=require('fs');var path=require(_0xfc52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc52('0x5'));module[_0xfc52('0x6')]=function(_0x29636f,_0x5cb478){return _0x29636f[_0xfc52('0x7')](_0xfc52('0x8'),attributes,{'tableName':_0xfc52('0x9'),'paranoid':![],'indexes':[{'name':_0xfc52('0xa'),'fields':[_0xfc52('0xb'),_0xfc52('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index f009cd3..0d7286d 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 _0xac9a=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','FreshdeskField,\x20%s,\x20%s'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xac9a,0x18a));var _0xaac9=function(_0x55c138,_0x3f7aa8){_0x55c138=_0x55c138-0x0;var _0x569b52=_0xac9a[_0x55c138];return _0x569b52;};'use strict';var _=require(_0xaac9('0x0'));var util=require(_0xaac9('0x1'));var moment=require(_0xaac9('0x2'));var BPromise=require(_0xaac9('0x3'));var rs=require(_0xaac9('0x4'));var fs=require('fs');var Redis=require(_0xaac9('0x5'));var db=require(_0xaac9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac9('0x7'))('rpc');var config=require(_0xaac9('0x8'));var jayson=require(_0xaac9('0x9'));var client=jayson[_0xaac9('0xa')][_0xaac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x232b05,_0x50b0ef,_0x3cddaa){return new BPromise(function(_0x1322bf,_0x48b2f5){return client['request'](_0x232b05,_0x3cddaa)[_0xaac9('0xc')](function(_0x3f3228){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x50b0ef,'request\x20sent');logger[_0xaac9('0xd')](_0xaac9('0xe'),_0x50b0ef,_0xaac9('0xf'),JSON[_0xaac9('0x10')](_0x3f3228));if(_0x3f3228['error']){if(_0x3f3228[_0xaac9('0x11')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x50b0ef,_0x3f3228[_0xaac9('0x11')][_0xaac9('0x12')]);return _0x48b2f5(_0x3f3228[_0xaac9('0x11')][_0xaac9('0x12')]);}logger['error'](_0xaac9('0x13'),_0x50b0ef,_0x3f3228[_0xaac9('0x11')][_0xaac9('0x12')]);return _0x1322bf(_0x3f3228[_0xaac9('0x11')][_0xaac9('0x12')]);}else{logger[_0xaac9('0x14')](_0xaac9('0x13'),_0x50b0ef,_0xaac9('0xf'));_0x1322bf(_0x3f3228[_0xaac9('0x15')]['message']);}})[_0xaac9('0x16')](function(_0x1864ee){logger[_0xaac9('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x50b0ef,_0x1864ee);_0x48b2f5(_0x1864ee);});});} \ No newline at end of file +var _0xa3ae=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x3b22e7,_0x2fe92f){var _0x210f83=function(_0x16d180){while(--_0x16d180){_0x3b22e7['push'](_0x3b22e7['shift']());}};_0x210f83(++_0x2fe92f);}(_0xa3ae,0x7d));var _0xea3a=function(_0x3457c9,_0x440606){_0x3457c9=_0x3457c9-0x0;var _0x290e1b=_0xa3ae[_0x3457c9];return _0x290e1b;};'use strict';var _=require(_0xea3a('0x0'));var util=require(_0xea3a('0x1'));var moment=require('moment');var BPromise=require(_0xea3a('0x2'));var rs=require(_0xea3a('0x3'));var fs=require('fs');var Redis=require(_0xea3a('0x4'));var db=require(_0xea3a('0x5'))['db'];var utils=require(_0xea3a('0x6'));var logger=require('../../config/logger')(_0xea3a('0x7'));var config=require(_0xea3a('0x8'));var jayson=require(_0xea3a('0x9'));var client=jayson[_0xea3a('0xa')][_0xea3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24baaf,_0x4abba6,_0x460b7c){return new BPromise(function(_0x399f78,_0xf27a3b){return client['request'](_0x24baaf,_0x460b7c)[_0xea3a('0xc')](function(_0x2c2167){logger['info'](_0xea3a('0xd'),_0x4abba6,_0xea3a('0xe'));logger[_0xea3a('0xf')](_0xea3a('0x10'),_0x4abba6,'request\x20sent',JSON['stringify'](_0x2c2167));if(_0x2c2167[_0xea3a('0x11')]){if(_0x2c2167[_0xea3a('0x11')][_0xea3a('0x12')]===0x1f4){logger[_0xea3a('0x11')](_0xea3a('0xd'),_0x4abba6,_0x2c2167[_0xea3a('0x11')]['message']);return _0xf27a3b(_0x2c2167[_0xea3a('0x11')][_0xea3a('0x13')]);}logger[_0xea3a('0x11')](_0xea3a('0xd'),_0x4abba6,_0x2c2167['error'][_0xea3a('0x13')]);return _0x399f78(_0x2c2167[_0xea3a('0x11')]['message']);}else{logger['info'](_0xea3a('0xd'),_0x4abba6,'request\x20sent');_0x399f78(_0x2c2167[_0xea3a('0x14')]['message']);}})['catch'](function(_0x3b1a10){logger['error'](_0xea3a('0xd'),_0x4abba6,_0x3b1a10);_0xf27a3b(_0x3b1a10);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e1d06d9..40cae15 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 _0xeb74=['getFields','post','/:id/configurations','addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x584ddd,_0x41c6b5){var _0x2421d9=function(_0x12dff5){while(--_0x12dff5){_0x584ddd['push'](_0x584ddd['shift']());}};_0x2421d9(++_0x41c6b5);}(_0xeb74,0xe3));var _0x4eb7=function(_0x40b086,_0x7a10fe){_0x40b086=_0x40b086-0x0;var _0x1f325d=_0xeb74[_0x40b086];return _0x1f325d;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id/configurations',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),controller['create']);router[_0x4eb7('0x10')](_0x4eb7('0x11'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x12')]);router[_0x4eb7('0x13')](_0x4eb7('0x14'),auth[_0x4eb7('0xb')](),controller['update']);router['delete']('/:id',auth[_0x4eb7('0xb')](),controller['destroy']);module[_0x4eb7('0x15')]=router; \ No newline at end of file +var _0x757a=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','/:id','delete'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0x757a,0xde));var _0xa757=function(_0x2746e7,_0x5c6195){_0x2746e7=_0x2746e7-0x0;var _0x165c9b=_0x757a[_0x2746e7];return _0x165c9b;};'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['getConfigurations']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa757('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa757('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa757('0x12')]);module[_0xa757('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 190ce71..f310104 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0x35a375,_0x361953){var _0x167618=function(_0x43b047){while(--_0x43b047){_0x35a375['push'](_0x35a375['shift']());}};_0x167618(++_0x361953);}(_0x583c,0x12b));var _0xc583=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0x583c[_0x1c2f29];return _0x258465;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x7ba1c3,_0x3dd545){var _0x82b393=function(_0x1550ce){while(--_0x1550ce){_0x7ba1c3['push'](_0x7ba1c3['shift']());}};_0x82b393(++_0x3dd545);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'apiKey':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'serverUrl':{'type':Sequelize[_0xd781('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 5d143ea..fcebf38 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 _0x6e6f=['apiKey','username','remoteUri','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields'];(function(_0xf8ef99,_0x3e389d){var _0x53a843=function(_0x5b278b){while(--_0x5b278b){_0xf8ef99['push'](_0xf8ef99['shift']());}};_0x53a843(++_0x3e389d);}(_0x6e6f,0x76));var _0xf6e6=function(_0x3855f4,_0x16073b){_0x3855f4=_0x3855f4-0x0;var _0x3d4e63=_0x6e6f[_0x3855f4];return _0x3d4e63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6e6('0x0'));var zipdir=require(_0xf6e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6e6('0x2'));var moment=require(_0xf6e6('0x3'));var BPromise=require(_0xf6e6('0x4'));var Mustache=require(_0xf6e6('0x5'));var util=require(_0xf6e6('0x6'));var path=require(_0xf6e6('0x7'));var sox=require(_0xf6e6('0x8'));var csv=require('to-csv');var ejs=require(_0xf6e6('0x9'));var fs=require('fs');var fs_extra=require(_0xf6e6('0xa'));var _=require(_0xf6e6('0xb'));var squel=require(_0xf6e6('0xc'));var crypto=require(_0xf6e6('0xd'));var jsforce=require(_0xf6e6('0xe'));var deskjs=require(_0xf6e6('0xf'));var toCsv=require(_0xf6e6('0x10'));var querystring=require('querystring');var Papa=require(_0xf6e6('0x11'));var Redis=require(_0xf6e6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf6e6('0x13'));var as=require(_0xf6e6('0x14'));var hardwareService=require(_0xf6e6('0x15'));var logger=require(_0xf6e6('0x16'))(_0xf6e6('0x17'));var utils=require(_0xf6e6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf6e6('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf6e6('0x1a'));function respondWithStatusCode(_0x49f6e1,_0x132117){_0x132117=_0x132117||0xcc;return function(_0x1476d3){if(_0x1476d3){return _0x49f6e1[_0xf6e6('0x1b')](_0x132117);}return _0x49f6e1[_0xf6e6('0x1c')](_0x132117)[_0xf6e6('0x1d')]();};}function respondWithResult(_0x3ac118,_0x5eb785){_0x5eb785=_0x5eb785||0xc8;return function(_0x47ed15){if(_0x47ed15){return _0x3ac118[_0xf6e6('0x1c')](_0x5eb785)[_0xf6e6('0x1e')](_0x47ed15);}};}function respondWithFilteredResult(_0x1cc43b,_0xffcde6){return function(_0xc0bac6){if(_0xc0bac6){var _0x36e928=typeof _0xffcde6[_0xf6e6('0x1f')]===_0xf6e6('0x20')&&typeof _0xffcde6[_0xf6e6('0x21')]===_0xf6e6('0x20');var _0x2acc10=_0xc0bac6[_0xf6e6('0x22')];var _0x1ddc3c=_0x36e928?0x0:_0xffcde6['offset'];var _0x439d86=_0x36e928?_0xc0bac6[_0xf6e6('0x22')]:_0xffcde6[_0xf6e6('0x1f')]+_0xffcde6[_0xf6e6('0x21')];var _0x335daf;if(_0x439d86>=_0x2acc10){_0x439d86=_0x2acc10;_0x335daf=0xc8;}else{_0x335daf=0xce;}_0x1cc43b['status'](_0x335daf);return _0x1cc43b[_0xf6e6('0x23')](_0xf6e6('0x24'),_0x1ddc3c+'-'+_0x439d86+'/'+_0x2acc10)[_0xf6e6('0x1e')](_0xc0bac6);}return null;};}function patchUpdates(_0x2993bd){return function(_0x3bcfba){try{jsonpatch[_0xf6e6('0x25')](_0x3bcfba,_0x2993bd,!![]);}catch(_0x5650d2){return BPromise[_0xf6e6('0x26')](_0x5650d2);}return _0x3bcfba['save']();};}function saveUpdates(_0x38b570,_0x2f4378){return function(_0x49b80f){if(_0x49b80f){return _0x49b80f['update'](_0x38b570)[_0xf6e6('0x27')](function(_0x303c96){return _0x303c96;});}return null;};}function removeEntity(_0x538f8d,_0x3d439b){return function(_0x46b308){if(_0x46b308){return _0x46b308[_0xf6e6('0x28')]()[_0xf6e6('0x27')](function(){_0x538f8d[_0xf6e6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4ead,_0x2227e0){return function(_0x2bf171){if(!_0x2bf171){_0x4a4ead[_0xf6e6('0x1b')](0x194);}return _0x2bf171;};}function handleError(_0x518a17,_0x185eb6){_0x185eb6=_0x185eb6||0x1f4;return function(_0x3fb01b){logger[_0xf6e6('0x29')](_0x3fb01b[_0xf6e6('0x2a')]);if(_0x3fb01b[_0xf6e6('0x2b')]){delete _0x3fb01b[_0xf6e6('0x2b')];}_0x518a17['status'](_0x185eb6)[_0xf6e6('0x2c')](_0x3fb01b);};}exports[_0xf6e6('0x2d')]=function(_0x3ef2ff,_0x290841){var _0x128031={},_0x4a33aa={},_0x57e994={'count':0x0,'rows':[]};var _0x298c22=_[_0xf6e6('0x2e')](db[_0xf6e6('0x2f')]['rawAttributes'],function(_0x41aab0){return{'name':_0x41aab0[_0xf6e6('0x30')],'type':_0x41aab0[_0xf6e6('0x31')]['key']};});_0x4a33aa[_0xf6e6('0x32')]=_[_0xf6e6('0x2e')](_0x298c22,_0xf6e6('0x2b'));_0x4a33aa[_0xf6e6('0x33')]=_[_0xf6e6('0x34')](_0x3ef2ff[_0xf6e6('0x33')]);_0x4a33aa[_0xf6e6('0x35')]=_['intersection'](_0x4a33aa[_0xf6e6('0x32')],_0x4a33aa['query']);_0x128031[_0xf6e6('0x36')]=_[_0xf6e6('0x37')](_0x4a33aa[_0xf6e6('0x32')],qs['fields'](_0x3ef2ff[_0xf6e6('0x33')][_0xf6e6('0x38')]));_0x128031[_0xf6e6('0x36')]=_0x128031['attributes'][_0xf6e6('0x39')]?_0x128031[_0xf6e6('0x36')]:_0x4a33aa[_0xf6e6('0x32')];if(!_0x3ef2ff[_0xf6e6('0x33')]['hasOwnProperty']('nolimit')){_0x128031[_0xf6e6('0x21')]=qs['limit'](_0x3ef2ff['query']['limit']);_0x128031[_0xf6e6('0x1f')]=qs[_0xf6e6('0x1f')](_0x3ef2ff[_0xf6e6('0x33')]['offset']);}_0x128031[_0xf6e6('0x3a')]=qs[_0xf6e6('0x3b')](_0x3ef2ff[_0xf6e6('0x33')][_0xf6e6('0x3b')]);_0x128031[_0xf6e6('0x3c')]=qs[_0xf6e6('0x35')](_[_0xf6e6('0x3d')](_0x3ef2ff['query'],_0x4a33aa[_0xf6e6('0x35')]),_0x298c22);if(_0x3ef2ff[_0xf6e6('0x33')][_0xf6e6('0x3e')]){_0x128031['where']=_[_0xf6e6('0x3f')](_0x128031[_0xf6e6('0x3c')],{'$or':_[_0xf6e6('0x2e')](_0x298c22,function(_0x5cc359){if(_0x5cc359[_0xf6e6('0x31')]!==_0xf6e6('0x40')){var _0x3076fe={};_0x3076fe[_0x5cc359[_0xf6e6('0x2b')]]={'$like':'%'+_0x3ef2ff['query'][_0xf6e6('0x3e')]+'%'};return _0x3076fe;}})});}_0x128031=_[_0xf6e6('0x3f')]({},_0x128031,_0x3ef2ff[_0xf6e6('0x41')]);var _0x26d18d={'where':_0x128031[_0xf6e6('0x3c')]};return db[_0xf6e6('0x2f')][_0xf6e6('0x22')](_0x26d18d)[_0xf6e6('0x27')](function(_0x3a2b82){_0x57e994[_0xf6e6('0x22')]=_0x3a2b82;if(_0x3ef2ff['query'][_0xf6e6('0x42')]){_0x128031[_0xf6e6('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x128031);})['then'](function(_0xfc15b8){_0x57e994['rows']=_0xfc15b8;return _0x57e994;})[_0xf6e6('0x27')](respondWithFilteredResult(_0x290841,_0x128031))[_0xf6e6('0x44')](handleError(_0x290841,null));};exports[_0xf6e6('0x45')]=function(_0x3f9fd7,_0x454e85){var _0x125af6={'raw':![],'where':{'id':_0x3f9fd7[_0xf6e6('0x46')]['id']}},_0x2192ec={};_0x2192ec[_0xf6e6('0x32')]=_['keys'](db[_0xf6e6('0x2f')][_0xf6e6('0x47')]);_0x2192ec['query']=_[_0xf6e6('0x34')](_0x3f9fd7[_0xf6e6('0x33')]);_0x2192ec[_0xf6e6('0x35')]=_[_0xf6e6('0x37')](_0x2192ec[_0xf6e6('0x32')],_0x2192ec[_0xf6e6('0x33')]);_0x125af6[_0xf6e6('0x36')]=_[_0xf6e6('0x37')](_0x2192ec[_0xf6e6('0x32')],qs[_0xf6e6('0x38')](_0x3f9fd7[_0xf6e6('0x33')]['fields']));_0x125af6[_0xf6e6('0x36')]=_0x125af6[_0xf6e6('0x36')][_0xf6e6('0x39')]?_0x125af6['attributes']:_0x2192ec['model'];if(_0x3f9fd7[_0xf6e6('0x33')]['includeAll']){_0x125af6['include']=[{'all':!![]}];}_0x125af6=_[_0xf6e6('0x3f')]({},_0x125af6,_0x3f9fd7[_0xf6e6('0x41')]);return db[_0xf6e6('0x2f')][_0xf6e6('0x48')](_0x125af6)[_0xf6e6('0x27')](handleEntityNotFound(_0x454e85,null))['then'](respondWithResult(_0x454e85,null))[_0xf6e6('0x44')](handleError(_0x454e85,null));};exports['create']=function(_0x34c9f9,_0x2d091e){return db[_0xf6e6('0x2f')][_0xf6e6('0x49')](_0x34c9f9['body'],{})[_0xf6e6('0x27')](respondWithResult(_0x2d091e,0xc9))[_0xf6e6('0x44')](handleError(_0x2d091e,null));};exports[_0xf6e6('0x4a')]=function(_0x32c25a,_0x1366b2){if(_0x32c25a[_0xf6e6('0x4b')]['id']){delete _0x32c25a[_0xf6e6('0x4b')]['id'];}return db['FreshsalesAccount'][_0xf6e6('0x48')]({'where':{'id':_0x32c25a['params']['id']}})[_0xf6e6('0x27')](handleEntityNotFound(_0x1366b2,null))['then'](saveUpdates(_0x32c25a[_0xf6e6('0x4b')],null))[_0xf6e6('0x27')](respondWithResult(_0x1366b2,null))[_0xf6e6('0x44')](handleError(_0x1366b2,null));};exports[_0xf6e6('0x28')]=function(_0x2d1cfa,_0x241d51){return db[_0xf6e6('0x2f')][_0xf6e6('0x48')]({'where':{'id':_0x2d1cfa[_0xf6e6('0x46')]['id']}})[_0xf6e6('0x27')](handleEntityNotFound(_0x241d51,null))['then'](removeEntity(_0x241d51,null))[_0xf6e6('0x44')](handleError(_0x241d51,null));};exports[_0xf6e6('0x4c')]=function(_0x119b48,_0x40b6cd,_0x4967e7){var _0x3ecdb9={};var _0x4dc3fd={};var _0x3471c4;var _0x20c54c;return db[_0xf6e6('0x2f')][_0xf6e6('0x4d')]({'where':{'id':_0x119b48[_0xf6e6('0x46')]['id']}})[_0xf6e6('0x27')](handleEntityNotFound(_0x40b6cd,null))['then'](function(_0x1b50e9){if(_0x1b50e9){_0x3471c4=_0x1b50e9;_0x4dc3fd[_0xf6e6('0x32')]=_['keys'](db[_0xf6e6('0x4e')][_0xf6e6('0x47')]);_0x4dc3fd[_0xf6e6('0x33')]=_[_0xf6e6('0x34')](_0x119b48['query']);_0x4dc3fd[_0xf6e6('0x35')]=_[_0xf6e6('0x37')](_0x4dc3fd[_0xf6e6('0x32')],_0x4dc3fd['query']);_0x3ecdb9[_0xf6e6('0x36')]=_['intersection'](_0x4dc3fd[_0xf6e6('0x32')],qs[_0xf6e6('0x38')](_0x119b48[_0xf6e6('0x33')][_0xf6e6('0x38')]));_0x3ecdb9['attributes']=_0x3ecdb9[_0xf6e6('0x36')]['length']?_0x3ecdb9[_0xf6e6('0x36')]:_0x4dc3fd[_0xf6e6('0x32')];_0x3ecdb9[_0xf6e6('0x3a')]=qs[_0xf6e6('0x3b')](_0x119b48[_0xf6e6('0x33')][_0xf6e6('0x3b')]);_0x3ecdb9[_0xf6e6('0x3c')]=qs[_0xf6e6('0x35')](_[_0xf6e6('0x3d')](_0x119b48[_0xf6e6('0x33')],_0x4dc3fd[_0xf6e6('0x35')]));if(_0x119b48['query'][_0xf6e6('0x3e')]){_0x3ecdb9[_0xf6e6('0x3c')]=_['merge'](_0x3ecdb9[_0xf6e6('0x3c')],{'$or':_['map'](_0x3ecdb9[_0xf6e6('0x36')],function(_0x17fd62){var _0x5bebac={};_0x5bebac[_0x17fd62]={'$like':'%'+_0x119b48[_0xf6e6('0x33')][_0xf6e6('0x3e')]+'%'};return _0x5bebac;})});}_0x3ecdb9=_[_0xf6e6('0x3f')]({},_0x3ecdb9,_0x119b48[_0xf6e6('0x41')]);return _0x3471c4['getConfigurations'](_0x3ecdb9);}})['then'](function(_0x145ca5){if(_0x145ca5){_0x20c54c=_0x145ca5['length'];if(!_0x119b48[_0xf6e6('0x33')]['hasOwnProperty'](_0xf6e6('0x4f'))){_0x3ecdb9[_0xf6e6('0x21')]=qs['limit'](_0x119b48[_0xf6e6('0x33')][_0xf6e6('0x21')]);_0x3ecdb9[_0xf6e6('0x1f')]=qs[_0xf6e6('0x1f')](_0x119b48[_0xf6e6('0x33')][_0xf6e6('0x1f')]);}return _0x3471c4[_0xf6e6('0x4c')](_0x3ecdb9);}})[_0xf6e6('0x27')](function(_0x4fd22f){if(_0x4fd22f){return _0x4fd22f?{'count':_0x20c54c,'rows':_0x4fd22f}:null;}})['then'](respondWithResult(_0x40b6cd,null))[_0xf6e6('0x44')](handleError(_0x40b6cd,null));};exports[_0xf6e6('0x50')]=function(_0x84eba1,_0x42b285,_0x4f3fa9){if(_0x84eba1[_0xf6e6('0x4b')]['id']){delete _0x84eba1[_0xf6e6('0x4b')]['id'];}return db[_0xf6e6('0x2f')][_0xf6e6('0x4d')]({'where':{'id':_0x84eba1[_0xf6e6('0x46')]['id']}})[_0xf6e6('0x27')](handleEntityNotFound(_0x42b285,null))[_0xf6e6('0x27')](function(_0x2a4388){if(_0x2a4388){_0x84eba1[_0xf6e6('0x4b')]['AccountId']=_0x2a4388['id'];_0x84eba1['body']['Subjects']=integrations[_0xf6e6('0x51')](_0x84eba1[_0xf6e6('0x4b')][_0xf6e6('0x52')],_0x84eba1[_0xf6e6('0x4b')][_0xf6e6('0x31')]);_0x84eba1[_0xf6e6('0x4b')][_0xf6e6('0x53')]=integrations[_0xf6e6('0x54')](_0x84eba1['body']['channel'],_0x84eba1[_0xf6e6('0x4b')]['type']);return db[_0xf6e6('0x4e')][_0xf6e6('0x49')](_0x84eba1[_0xf6e6('0x4b')],{'include':[{'model':db[_0xf6e6('0x55')],'as':_0xf6e6('0x56')},{'model':db[_0xf6e6('0x55')],'as':_0xf6e6('0x53')}]});}return null;})['then'](respondWithResult(_0x42b285,null))[_0xf6e6('0x44')](handleError(_0x42b285,null));};exports[_0xf6e6('0x57')]=function(_0x43b953,_0x49cef4,_0x208f5f){var _0x4872a8='';var _0x3a3970='';return db[_0xf6e6('0x2f')][_0xf6e6('0x4d')]({'where':{'id':_0x43b953[_0xf6e6('0x46')]['id']},'attributes':['id','username','remoteUri',_0xf6e6('0x58')]})[_0xf6e6('0x27')](handleEntityNotFound(_0x49cef4,null))['then'](function(_0x406844){if(_0x406844){_0x3a3970=_0x406844[_0xf6e6('0x59')];_0x4872a8=_0x406844['remoteUri'];var _0x3b5d31=_0x406844[_0xf6e6('0x5a')][_0xf6e6('0x5b')](-0x1);if(_0x3b5d31==='/'){_0x4872a8=_0x4872a8[_0xf6e6('0x5c')](0x0,_0x4872a8['lastIndexOf'](_0x3b5d31));}return rp({'method':'GET','uri':util[_0xf6e6('0x5d')](_0xf6e6('0x5e'),_0x4872a8,_0xf6e6('0x5f')),'headers':{'Authorization':_0xf6e6('0x60')+_0x406844['apiKey']},'json':!![]});}})[_0xf6e6('0x27')](function(_0x49eab4){if(_0x49eab4){var _0x38aabd=_0x49eab4[_0xf6e6('0x61')];var _0x3e9c5f=![];var _0x2a0042=null;for(_0x2a0042=0x0;_0x2a0042<_0x38aabd[_0xf6e6('0x39')];_0x2a0042++){if(_0x38aabd[_0x2a0042][_0xf6e6('0x62')]===_0x3a3970){_0x3e9c5f=!![];}}if(_0x3e9c5f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf6e6('0x63')});}}})[_0xf6e6('0x27')](respondWithResult(_0x49cef4,null))[_0xf6e6('0x44')](function(_0x166a22){var _0x3e3991=_0x43b953[_0xf6e6('0x33')][_0xf6e6('0x64')]?0x1f4:_0x166a22[_0xf6e6('0x65')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf6e6('0x57'),_0x3e3991,JSON['stringify'](_0x166a22));delete _0x166a22[_0xf6e6('0x2b')];if(_0x3e3991===0x191){_0x3e3991=0x190;}_0x49cef4[_0xf6e6('0x1c')](_0x3e3991)[_0xf6e6('0x2c')](_0x43b953[_0xf6e6('0x33')][_0xf6e6('0x64')]?{'message':_0xf6e6('0x66'),'statusCode':_0x166a22['statusCode']}:_0x166a22);});}; \ No newline at end of file +var _0x6624=['includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','nolimit','getSubjects','channel','Subjects','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','apply','save','update','then','destroy','error','stack','name','send','index','FreshsalesAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6624,0x14f));var _0x4662=function(_0x40940d,_0x2e035f){_0x40940d=_0x40940d-0x0;var _0x3ea288=_0x6624[_0x40940d];return _0x3ea288;};'use strict';var emlformat=require(_0x4662('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4662('0x1'));var jsonpatch=require(_0x4662('0x2'));var rp=require(_0x4662('0x3'));var moment=require('moment');var BPromise=require(_0x4662('0x4'));var Mustache=require(_0x4662('0x5'));var util=require(_0x4662('0x6'));var path=require(_0x4662('0x7'));var sox=require(_0x4662('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4662('0x9'));var _=require(_0x4662('0xa'));var squel=require(_0x4662('0xb'));var crypto=require(_0x4662('0xc'));var jsforce=require(_0x4662('0xd'));var deskjs=require(_0x4662('0xe'));var toCsv=require(_0x4662('0xf'));var querystring=require(_0x4662('0x10'));var Papa=require(_0x4662('0x11'));var Redis=require(_0x4662('0x12'));var authService=require(_0x4662('0x13'));var qs=require(_0x4662('0x14'));var as=require(_0x4662('0x15'));var hardwareService=require(_0x4662('0x16'));var logger=require(_0x4662('0x17'))(_0x4662('0x18'));var utils=require(_0x4662('0x19'));var config=require(_0x4662('0x1a'));var licenseUtil=require(_0x4662('0x1b'));var db=require(_0x4662('0x1c'))['db'];var integrations=require(_0x4662('0x1d'));function respondWithStatusCode(_0x1bed69,_0x53fc95){_0x53fc95=_0x53fc95||0xcc;return function(_0x2dd75d){if(_0x2dd75d){return _0x1bed69[_0x4662('0x1e')](_0x53fc95);}return _0x1bed69[_0x4662('0x1f')](_0x53fc95)[_0x4662('0x20')]();};}function respondWithResult(_0x337be4,_0x5e37a5){_0x5e37a5=_0x5e37a5||0xc8;return function(_0x51a3e5){if(_0x51a3e5){return _0x337be4['status'](_0x5e37a5)[_0x4662('0x21')](_0x51a3e5);}};}function respondWithFilteredResult(_0x178253,_0x11d940){return function(_0x5694c8){if(_0x5694c8){var _0xaf2569=typeof _0x11d940[_0x4662('0x22')]===_0x4662('0x23')&&typeof _0x11d940[_0x4662('0x24')]==='undefined';var _0x411410=_0x5694c8['count'];var _0x2fedc4=_0xaf2569?0x0:_0x11d940[_0x4662('0x22')];var _0x4e4f9d=_0xaf2569?_0x5694c8['count']:_0x11d940['offset']+_0x11d940[_0x4662('0x24')];var _0x431e96;if(_0x4e4f9d>=_0x411410){_0x4e4f9d=_0x411410;_0x431e96=0xc8;}else{_0x431e96=0xce;}_0x178253[_0x4662('0x1f')](_0x431e96);return _0x178253['set']('Content-Range',_0x2fedc4+'-'+_0x4e4f9d+'/'+_0x411410)[_0x4662('0x21')](_0x5694c8);}return null;};}function patchUpdates(_0x1904a2){return function(_0x2455b1){try{jsonpatch[_0x4662('0x25')](_0x2455b1,_0x1904a2,!![]);}catch(_0x3266d8){return BPromise['reject'](_0x3266d8);}return _0x2455b1[_0x4662('0x26')]();};}function saveUpdates(_0x897442,_0x3bfee0){return function(_0x3007b5){if(_0x3007b5){return _0x3007b5[_0x4662('0x27')](_0x897442)[_0x4662('0x28')](function(_0x3b572e){return _0x3b572e;});}return null;};}function removeEntity(_0x10e991,_0x8859){return function(_0x3989ab){if(_0x3989ab){return _0x3989ab[_0x4662('0x29')]()[_0x4662('0x28')](function(){_0x10e991[_0x4662('0x1f')](0xcc)[_0x4662('0x20')]();});}};}function handleEntityNotFound(_0xef6d79,_0x15513e){return function(_0x3e6678){if(!_0x3e6678){_0xef6d79[_0x4662('0x1e')](0x194);}return _0x3e6678;};}function handleError(_0x13e7f2,_0x42640c){_0x42640c=_0x42640c||0x1f4;return function(_0x1bc3e0){logger[_0x4662('0x2a')](_0x1bc3e0[_0x4662('0x2b')]);if(_0x1bc3e0[_0x4662('0x2c')]){delete _0x1bc3e0[_0x4662('0x2c')];}_0x13e7f2[_0x4662('0x1f')](_0x42640c)[_0x4662('0x2d')](_0x1bc3e0);};}exports[_0x4662('0x2e')]=function(_0x4e975e,_0x6a21b3){var _0x1618b4={},_0x306cc2={},_0x1d7e9a={'count':0x0,'rows':[]};var _0x171138=_['map'](db[_0x4662('0x2f')]['rawAttributes'],function(_0x2d1198){return{'name':_0x2d1198[_0x4662('0x30')],'type':_0x2d1198[_0x4662('0x31')]['key']};});_0x306cc2[_0x4662('0x32')]=_[_0x4662('0x33')](_0x171138,'name');_0x306cc2[_0x4662('0x34')]=_[_0x4662('0x35')](_0x4e975e[_0x4662('0x34')]);_0x306cc2[_0x4662('0x36')]=_[_0x4662('0x37')](_0x306cc2[_0x4662('0x32')],_0x306cc2[_0x4662('0x34')]);_0x1618b4[_0x4662('0x38')]=_['intersection'](_0x306cc2[_0x4662('0x32')],qs['fields'](_0x4e975e[_0x4662('0x34')][_0x4662('0x39')]));_0x1618b4['attributes']=_0x1618b4['attributes'][_0x4662('0x3a')]?_0x1618b4[_0x4662('0x38')]:_0x306cc2[_0x4662('0x32')];if(!_0x4e975e['query'][_0x4662('0x3b')]('nolimit')){_0x1618b4[_0x4662('0x24')]=qs[_0x4662('0x24')](_0x4e975e[_0x4662('0x34')][_0x4662('0x24')]);_0x1618b4['offset']=qs[_0x4662('0x22')](_0x4e975e['query']['offset']);}_0x1618b4[_0x4662('0x3c')]=qs[_0x4662('0x3d')](_0x4e975e['query'][_0x4662('0x3d')]);_0x1618b4[_0x4662('0x3e')]=qs[_0x4662('0x36')](_[_0x4662('0x3f')](_0x4e975e[_0x4662('0x34')],_0x306cc2['filters']),_0x171138);if(_0x4e975e[_0x4662('0x34')][_0x4662('0x40')]){_0x1618b4[_0x4662('0x3e')]=_[_0x4662('0x41')](_0x1618b4['where'],{'$or':_[_0x4662('0x33')](_0x171138,function(_0x1c50cd){if(_0x1c50cd[_0x4662('0x31')]!==_0x4662('0x42')){var _0x7d52c5={};_0x7d52c5[_0x1c50cd[_0x4662('0x2c')]]={'$like':'%'+_0x4e975e[_0x4662('0x34')][_0x4662('0x40')]+'%'};return _0x7d52c5;}})});}_0x1618b4=_[_0x4662('0x41')]({},_0x1618b4,_0x4e975e[_0x4662('0x43')]);var _0x4e9eb9={'where':_0x1618b4['where']};return db[_0x4662('0x2f')][_0x4662('0x44')](_0x4e9eb9)[_0x4662('0x28')](function(_0x12b5a3){_0x1d7e9a[_0x4662('0x44')]=_0x12b5a3;if(_0x4e975e['query'][_0x4662('0x45')]){_0x1618b4[_0x4662('0x46')]=[{'all':!![]}];}return db[_0x4662('0x2f')][_0x4662('0x47')](_0x1618b4);})[_0x4662('0x28')](function(_0xb087c5){_0x1d7e9a[_0x4662('0x48')]=_0xb087c5;return _0x1d7e9a;})[_0x4662('0x28')](respondWithFilteredResult(_0x6a21b3,_0x1618b4))[_0x4662('0x49')](handleError(_0x6a21b3,null));};exports[_0x4662('0x4a')]=function(_0x5bbeec,_0x391dc3){var _0x3cdf87={'raw':![],'where':{'id':_0x5bbeec[_0x4662('0x4b')]['id']}},_0x11a474={};_0x11a474['model']=_[_0x4662('0x35')](db[_0x4662('0x2f')]['rawAttributes']);_0x11a474['query']=_[_0x4662('0x35')](_0x5bbeec[_0x4662('0x34')]);_0x11a474[_0x4662('0x36')]=_[_0x4662('0x37')](_0x11a474[_0x4662('0x32')],_0x11a474[_0x4662('0x34')]);_0x3cdf87[_0x4662('0x38')]=_[_0x4662('0x37')](_0x11a474[_0x4662('0x32')],qs[_0x4662('0x39')](_0x5bbeec[_0x4662('0x34')][_0x4662('0x39')]));_0x3cdf87[_0x4662('0x38')]=_0x3cdf87['attributes'][_0x4662('0x3a')]?_0x3cdf87[_0x4662('0x38')]:_0x11a474[_0x4662('0x32')];if(_0x5bbeec[_0x4662('0x34')][_0x4662('0x45')]){_0x3cdf87['include']=[{'all':!![]}];}_0x3cdf87=_[_0x4662('0x41')]({},_0x3cdf87,_0x5bbeec['options']);return db[_0x4662('0x2f')]['find'](_0x3cdf87)[_0x4662('0x28')](handleEntityNotFound(_0x391dc3,null))[_0x4662('0x28')](respondWithResult(_0x391dc3,null))[_0x4662('0x49')](handleError(_0x391dc3,null));};exports[_0x4662('0x4c')]=function(_0x307d49,_0x1be056){return db[_0x4662('0x2f')][_0x4662('0x4c')](_0x307d49[_0x4662('0x4d')],{})[_0x4662('0x28')](respondWithResult(_0x1be056,0xc9))['catch'](handleError(_0x1be056,null));};exports[_0x4662('0x27')]=function(_0x58fc05,_0x2f6972){if(_0x58fc05[_0x4662('0x4d')]['id']){delete _0x58fc05[_0x4662('0x4d')]['id'];}return db[_0x4662('0x2f')][_0x4662('0x4e')]({'where':{'id':_0x58fc05['params']['id']}})[_0x4662('0x28')](handleEntityNotFound(_0x2f6972,null))[_0x4662('0x28')](saveUpdates(_0x58fc05['body'],null))[_0x4662('0x28')](respondWithResult(_0x2f6972,null))[_0x4662('0x49')](handleError(_0x2f6972,null));};exports['destroy']=function(_0x3750c5,_0x123c91){return db[_0x4662('0x2f')][_0x4662('0x4e')]({'where':{'id':_0x3750c5[_0x4662('0x4b')]['id']}})['then'](handleEntityNotFound(_0x123c91,null))[_0x4662('0x28')](removeEntity(_0x123c91,null))[_0x4662('0x49')](handleError(_0x123c91,null));};exports[_0x4662('0x4f')]=function(_0x4e5f5c,_0x9425be,_0x17c591){var _0x2227d2={};var _0x5ef8c0={};var _0x555fc3;var _0xe0d3e3;return db[_0x4662('0x2f')][_0x4662('0x50')]({'where':{'id':_0x4e5f5c[_0x4662('0x4b')]['id']}})[_0x4662('0x28')](handleEntityNotFound(_0x9425be,null))[_0x4662('0x28')](function(_0x216667){if(_0x216667){_0x555fc3=_0x216667;_0x5ef8c0[_0x4662('0x32')]=_[_0x4662('0x35')](db[_0x4662('0x51')][_0x4662('0x52')]);_0x5ef8c0[_0x4662('0x34')]=_[_0x4662('0x35')](_0x4e5f5c[_0x4662('0x34')]);_0x5ef8c0['filters']=_[_0x4662('0x37')](_0x5ef8c0['model'],_0x5ef8c0[_0x4662('0x34')]);_0x2227d2[_0x4662('0x38')]=_[_0x4662('0x37')](_0x5ef8c0[_0x4662('0x32')],qs[_0x4662('0x39')](_0x4e5f5c[_0x4662('0x34')][_0x4662('0x39')]));_0x2227d2[_0x4662('0x38')]=_0x2227d2[_0x4662('0x38')][_0x4662('0x3a')]?_0x2227d2[_0x4662('0x38')]:_0x5ef8c0[_0x4662('0x32')];_0x2227d2[_0x4662('0x3c')]=qs[_0x4662('0x3d')](_0x4e5f5c['query'][_0x4662('0x3d')]);_0x2227d2[_0x4662('0x3e')]=qs[_0x4662('0x36')](_[_0x4662('0x3f')](_0x4e5f5c[_0x4662('0x34')],_0x5ef8c0[_0x4662('0x36')]));if(_0x4e5f5c[_0x4662('0x34')][_0x4662('0x40')]){_0x2227d2[_0x4662('0x3e')]=_[_0x4662('0x41')](_0x2227d2['where'],{'$or':_['map'](_0x2227d2[_0x4662('0x38')],function(_0x386229){var _0x1e58c4={};_0x1e58c4[_0x386229]={'$like':'%'+_0x4e5f5c['query'][_0x4662('0x40')]+'%'};return _0x1e58c4;})});}_0x2227d2=_[_0x4662('0x41')]({},_0x2227d2,_0x4e5f5c['options']);return _0x555fc3['getConfigurations'](_0x2227d2);}})[_0x4662('0x28')](function(_0x34703a){if(_0x34703a){_0xe0d3e3=_0x34703a['length'];if(!_0x4e5f5c[_0x4662('0x34')][_0x4662('0x3b')](_0x4662('0x53'))){_0x2227d2['limit']=qs[_0x4662('0x24')](_0x4e5f5c[_0x4662('0x34')][_0x4662('0x24')]);_0x2227d2[_0x4662('0x22')]=qs[_0x4662('0x22')](_0x4e5f5c[_0x4662('0x34')][_0x4662('0x22')]);}return _0x555fc3['getConfigurations'](_0x2227d2);}})[_0x4662('0x28')](function(_0x4c6309){if(_0x4c6309){return _0x4c6309?{'count':_0xe0d3e3,'rows':_0x4c6309}:null;}})['then'](respondWithResult(_0x9425be,null))[_0x4662('0x49')](handleError(_0x9425be,null));};exports['addConfiguration']=function(_0x2c55fb,_0x421092,_0x34fb1f){if(_0x2c55fb['body']['id']){delete _0x2c55fb[_0x4662('0x4d')]['id'];}return db[_0x4662('0x2f')][_0x4662('0x50')]({'where':{'id':_0x2c55fb[_0x4662('0x4b')]['id']}})[_0x4662('0x28')](handleEntityNotFound(_0x421092,null))[_0x4662('0x28')](function(_0x536bd0){if(_0x536bd0){_0x2c55fb['body']['AccountId']=_0x536bd0['id'];_0x2c55fb[_0x4662('0x4d')]['Subjects']=integrations[_0x4662('0x54')](_0x2c55fb[_0x4662('0x4d')]['channel'],_0x2c55fb['body']['type']);_0x2c55fb[_0x4662('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x2c55fb[_0x4662('0x4d')][_0x4662('0x55')],_0x2c55fb['body'][_0x4662('0x31')]);return db[_0x4662('0x51')][_0x4662('0x4c')](_0x2c55fb[_0x4662('0x4d')],{'include':[{'model':db['FreshsalesField'],'as':_0x4662('0x56')},{'model':db[_0x4662('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x421092,null))[_0x4662('0x49')](handleError(_0x421092,null));};exports[_0x4662('0x58')]=function(_0x607e96,_0x26e4a5,_0x1479e4){var _0x1710a0='';var _0x52e37d='';return db[_0x4662('0x2f')][_0x4662('0x50')]({'where':{'id':_0x607e96['params']['id']},'attributes':['id',_0x4662('0x59'),'remoteUri','apiKey']})['then'](handleEntityNotFound(_0x26e4a5,null))[_0x4662('0x28')](function(_0x312a37){if(_0x312a37){_0x52e37d=_0x312a37[_0x4662('0x59')];_0x1710a0=_0x312a37[_0x4662('0x5a')];var _0x2cb2f8=_0x312a37[_0x4662('0x5a')]['slice'](-0x1);if(_0x2cb2f8==='/'){_0x1710a0=_0x1710a0[_0x4662('0x5b')](0x0,_0x1710a0[_0x4662('0x5c')](_0x2cb2f8));}return rp({'method':_0x4662('0x5d'),'uri':util[_0x4662('0x5e')](_0x4662('0x5f'),_0x1710a0,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x312a37['apiKey']},'json':!![]});}})['then'](function(_0x3a8408){if(_0x3a8408){var _0x465a6b=_0x3a8408['users'];var _0x3d4bde=![];var _0x2712ed=null;for(_0x2712ed=0x0;_0x2712ed<_0x465a6b[_0x4662('0x3a')];_0x2712ed++){if(_0x465a6b[_0x2712ed][_0x4662('0x60')]===_0x52e37d){_0x3d4bde=!![];}}if(_0x3d4bde){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4662('0x61')});}}})[_0x4662('0x28')](respondWithResult(_0x26e4a5,null))[_0x4662('0x49')](function(_0x507f0a){var _0x911ce2=_0x607e96['query']['test']?0x1f4:_0x507f0a[_0x4662('0x62')]||0x1f4;logger[_0x4662('0x2a')](_0x4662('0x63'),'getFields',_0x911ce2,JSON['stringify'](_0x507f0a));delete _0x507f0a[_0x4662('0x2c')];if(_0x911ce2===0x191){_0x911ce2=0x190;}_0x26e4a5[_0x4662('0x1f')](_0x911ce2)[_0x4662('0x2d')](_0x607e96[_0x4662('0x34')]['test']?{'message':_0x4662('0x64'),'statusCode':_0x507f0a[_0x4662('0x62')]}:_0x507f0a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f6a295a..deaa9fa 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 _0xba34=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0xf1fd0d,_0x186b34){var _0x3b3a0f=function(_0x2456e0){while(--_0x2456e0){_0xf1fd0d['push'](_0xf1fd0d['shift']());}};_0x3b3a0f(++_0x186b34);}(_0xba34,0x119));var _0x4ba3=function(_0x1ae6ec,_0x82c08e){_0x1ae6ec=_0x1ae6ec-0x0;var _0x50dcb1=_0xba34[_0x1ae6ec];return _0x50dcb1;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e24=['request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3e24,0x167));var _0x43e2=function(_0x435150,_0x591cd9){_0x435150=_0x435150-0x0;var _0x13b3a4=_0x3e24[_0x435150];return _0x13b3a4;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));var integrations=require(_0x43e2('0x9'));module[_0x43e2('0xa')]=function(_0x43b5a7,_0x121e2e){return _0x43b5a7[_0x43e2('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x43e2('0xc'),'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 ebad966..b9014f2 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 _0x90b1=['ShowFreshsalesAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','find'];(function(_0x3fd322,_0x5c710e){var _0x235096=function(_0x52f7bc){while(--_0x52f7bc){_0x3fd322['push'](_0x3fd322['shift']());}};_0x235096(++_0x5c710e);}(_0x90b1,0x1bb));var _0x190b=function(_0x21f013,_0x3a2050){_0x21f013=_0x21f013-0x0;var _0x1addf8=_0x90b1[_0x21f013];return _0x1addf8;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')]({'raw':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x19')]||null:null,'attributes':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x1a')]||null:null,'limit':_0x21e458['options']?_0x21e458['options'][_0x190b('0x1b')]||null:null,'include':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')]['include']?_[_0x190b('0x1c')](_0x21e458[_0x190b('0x17')][_0x190b('0x1d')],function(_0x292ce3){return{'model':db[_0x292ce3[_0x190b('0x1e')]],'as':_0x292ce3['as'],'attributes':_0x292ce3[_0x190b('0x1a')],'include':_0x292ce3[_0x190b('0x1d')]?_['map'](_0x292ce3['include'],function(_0x262a63){return{'model':db[_0x262a63[_0x190b('0x1e')]],'as':_0x262a63['as'],'attributes':_0x262a63['attributes'],'include':_0x262a63['include']?_[_0x190b('0x1c')](_0x262a63['include'],function(_0x328e5e){return{'model':db[_0x328e5e[_0x190b('0x1e')]],'as':_0x328e5e['as'],'attributes':_0x328e5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x190b('0x1f')](function(_0x1deea6){logger['info'](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON['stringify'](_0x1deea6));_0x16c009(_0x1deea6);})['catch'](function(_0x3730cc){logger['error'](_0x190b('0x14'),_0x3730cc[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a['error'](0x1f4,_0x3730cc[_0x190b('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x40d060){var _0x4ff5a6=this;return new Promise(function(_0x19600d,_0x5650e1){return db[_0x190b('0x15')][_0x190b('0x20')]({'raw':_0x40d060['options']?_0x40d060[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x19')]||null:null,'attributes':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x1a')]||null:null,'include':_0x40d060['options']?_0x40d060['options'][_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x40d060['options'][_0x190b('0x1d')],function(_0x2dcd39){return{'model':db[_0x2dcd39[_0x190b('0x1e')]],'as':_0x2dcd39['as'],'attributes':_0x2dcd39[_0x190b('0x1a')],'include':_0x2dcd39[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x2dcd39[_0x190b('0x1d')],function(_0x5492b0){return{'model':db[_0x5492b0['model']],'as':_0x5492b0['as'],'attributes':_0x5492b0[_0x190b('0x1a')],'include':_0x5492b0[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x5492b0['include'],function(_0x33e9db){return{'model':db[_0x33e9db[_0x190b('0x1e')]],'as':_0x33e9db['as'],'attributes':_0x33e9db[_0x190b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8260){logger['info']('ShowFreshsalesAccount',_0x40d060);logger[_0x190b('0xc')](_0x190b('0x21'),_0x40d060,JSON['stringify'](_0x2a8260));_0x19600d(_0x2a8260);})[_0x190b('0x13')](function(_0xfd0d62){logger[_0x190b('0xf')]('ShowFreshsalesAccount',_0xfd0d62[_0x190b('0x11')],_0x40d060);_0x5650e1(_0x4ff5a6[_0x190b('0xf')](0x1f4,_0xfd0d62['message']));});});}; \ No newline at end of file +var _0xafc4=['raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFreshsalesAccount','FreshsalesAccount','options'];(function(_0x1ee477,_0xe2f0a2){var _0x33ce18=function(_0x154e48){while(--_0x154e48){_0x1ee477['push'](_0x1ee477['shift']());}};_0x33ce18(++_0xe2f0a2);}(_0xafc4,0x69));var _0x4afc=function(_0x5cc0c1,_0x225837){_0x5cc0c1=_0x5cc0c1-0x0;var _0x14fff5=_0xafc4[_0x5cc0c1];return _0x14fff5;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});}exports[_0x4afc('0x14')]=function(_0x22f809){var _0x3ad418=this;return new Promise(function(_0x16365f,_0x135349){return db[_0x4afc('0x15')]['findAll']({'raw':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'where':_0x22f809[_0x4afc('0x16')]?_0x22f809['options'][_0x4afc('0x18')]||null:null,'attributes':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x19')]||null:null,'limit':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1a')]||null:null,'include':_0x22f809['options']?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1b')]?_['map'](_0x22f809[_0x4afc('0x16')]['include'],function(_0x1aa676){return{'model':db[_0x1aa676[_0x4afc('0x1c')]],'as':_0x1aa676['as'],'attributes':_0x1aa676[_0x4afc('0x19')],'include':_0x1aa676[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x1aa676[_0x4afc('0x1b')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x1c')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x19')],'include':_0x40a0db[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x40a0db[_0x4afc('0x1b')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xa')](function(_0x2d6112){logger['info']('GetFreshsalesAccount',_0x22f809);logger['debug'](_0x4afc('0x14'),_0x22f809,JSON[_0x4afc('0xe')](_0x2d6112));_0x16365f(_0x2d6112);})['catch'](function(_0xd26d2f){logger[_0x4afc('0xf')]('GetFreshsalesAccount',_0xd26d2f['message'],_0x22f809);_0x135349(_0x3ad418['error'](0x1f4,_0xd26d2f[_0x4afc('0x11')]));});});};exports[_0x4afc('0x1e')]=function(_0x17a43d){var _0x46357b=this;return new Promise(function(_0xc1d91,_0x28cd3e){return db['FreshsalesAccount'][_0x4afc('0x1f')]({'raw':_0x17a43d[_0x4afc('0x16')]?_0x17a43d[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'where':_0x17a43d[_0x4afc('0x16')]?_0x17a43d[_0x4afc('0x16')][_0x4afc('0x18')]||null:null,'attributes':_0x17a43d[_0x4afc('0x16')]?_0x17a43d['options'][_0x4afc('0x19')]||null:null,'include':_0x17a43d['options']?_0x17a43d['options'][_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x17a43d[_0x4afc('0x16')][_0x4afc('0x1b')],function(_0x3ec6fa){return{'model':db[_0x3ec6fa[_0x4afc('0x1c')]],'as':_0x3ec6fa['as'],'attributes':_0x3ec6fa['attributes'],'include':_0x3ec6fa[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x3ec6fa[_0x4afc('0x1b')],function(_0x127ac8){return{'model':db[_0x127ac8[_0x4afc('0x1c')]],'as':_0x127ac8['as'],'attributes':_0x127ac8[_0x4afc('0x19')],'include':_0x127ac8['include']?_[_0x4afc('0x1d')](_0x127ac8[_0x4afc('0x1b')],function(_0x91565d){return{'model':db[_0x91565d[_0x4afc('0x1c')]],'as':_0x91565d['as'],'attributes':_0x91565d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c341){logger[_0x4afc('0xb')](_0x4afc('0x1e'),_0x17a43d);logger['debug']('ShowFreshsalesAccount',_0x17a43d,JSON[_0x4afc('0xe')](_0x43c341));_0xc1d91(_0x43c341);})['catch'](function(_0x5947bb){logger[_0x4afc('0xf')](_0x4afc('0x1e'),_0x5947bb[_0x4afc('0x11')],_0x17a43d);_0x28cd3e(_0x46357b[_0x4afc('0xf')](0x1f4,_0x5947bb[_0x4afc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index aedab97..2444b9c 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 _0x5295=['get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3795ff,_0x26f700){var _0x51cd3e=function(_0x99343c){while(--_0x99343c){_0x3795ff['push'](_0x3795ff['shift']());}};_0x51cd3e(++_0x26f700);}(_0x5295,0x17d));var _0x5529=function(_0x18c45d,_0x53e3e8){_0x18c45d=_0x18c45d-0x0;var _0x32db62=_0x5295[_0x18c45d];return _0x32db62;};'use strict';var multer=require(_0x5529('0x0'));var util=require(_0x5529('0x1'));var path=require(_0x5529('0x2'));var timeout=require(_0x5529('0x3'));var express=require(_0x5529('0x4'));var router=express[_0x5529('0x5')]();var fs_extra=require(_0x5529('0x6'));var auth=require(_0x5529('0x7'));var interaction=require(_0x5529('0x8'));var config=require(_0x5529('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x5529('0xa')]('/',auth['isAuthenticated'](),controller[_0x5529('0xb')]);router['get'](_0x5529('0xc'),auth[_0x5529('0xd')](),controller['show']);router[_0x5529('0xa')](_0x5529('0xe'),auth[_0x5529('0xd')](),controller[_0x5529('0xf')]);router[_0x5529('0xa')](_0x5529('0x10'),auth[_0x5529('0xd')](),controller[_0x5529('0x11')]);router[_0x5529('0xa')](_0x5529('0x12'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5529('0x13')](_0x5529('0xc'),auth[_0x5529('0xd')](),controller[_0x5529('0x14')]);router[_0x5529('0x15')](_0x5529('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5529('0x16')]=router; \ No newline at end of file +var _0x975e=['isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get'];(function(_0x5ac2a1,_0x3d6ea3){var _0x59213e=function(_0x3bf3e0){while(--_0x3bf3e0){_0x5ac2a1['push'](_0x5ac2a1['shift']());}};_0x59213e(++_0x3d6ea3);}(_0x975e,0x199));var _0xe975=function(_0x26b53f,_0x528724){_0x26b53f=_0x26b53f-0x0;var _0x4dda26=_0x975e[_0x26b53f];return _0x4dda26;};'use strict';var multer=require(_0xe975('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe975('0x1'));var express=require(_0xe975('0x2'));var router=express[_0xe975('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe975('0x4'));var config=require(_0xe975('0x5'));var controller=require(_0xe975('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe975('0x7')]);router[_0xe975('0x8')]('/:id',auth[_0xe975('0x9')](),controller['show']);router[_0xe975('0x8')](_0xe975('0xa'),auth[_0xe975('0x9')](),controller[_0xe975('0xb')]);router[_0xe975('0x8')](_0xe975('0xc'),auth[_0xe975('0x9')](),controller[_0xe975('0xd')]);router['get'](_0xe975('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xe975('0xf')]);router[_0xe975('0x10')](_0xe975('0x11'),auth[_0xe975('0x9')](),controller[_0xe975('0x12')]);router[_0xe975('0x13')](_0xe975('0x11'),auth['isAuthenticated'](),controller[_0xe975('0x14')]);module[_0xe975('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6e8a5c6..14693bf 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 _0x375b=['sequelize','exports','STRING'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x375b,0x7b));var _0xb375=function(_0x2ec5c8,_0x24630d){_0x2ec5c8=_0x2ec5c8-0x0;var _0x5b1419=_0x375b[_0x2ec5c8];return _0x5b1419;};'use strict';var Sequelize=require(_0xb375('0x0'));module[_0xb375('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb375('0x2')]}}; \ No newline at end of file +var _0x0c1e=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c1e,0xb8));var _0xe0c1=function(_0x43eae4,_0x50ee19){_0x43eae4=_0x43eae4-0x0;var _0x2cb2b1=_0x0c1e[_0x43eae4];return _0x2cb2b1;};'use strict';var Sequelize=require(_0xe0c1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe0c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6026138..c8bad61 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 _0x60f1=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','findAll','rows','params','includeAll','find','catch','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x60f1,0x95));var _0x160f=function(_0x1eaf9a,_0x4a10c3){_0x1eaf9a=_0x1eaf9a-0x0;var _0x1fbedb=_0x60f1[_0x1eaf9a];return _0x1fbedb;};'use strict';var emlformat=require(_0x160f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x160f('0x1'));var jsonpatch=require(_0x160f('0x2'));var rp=require(_0x160f('0x3'));var moment=require(_0x160f('0x4'));var BPromise=require(_0x160f('0x5'));var Mustache=require(_0x160f('0x6'));var util=require('util');var path=require(_0x160f('0x7'));var sox=require(_0x160f('0x8'));var csv=require('to-csv');var ejs=require(_0x160f('0x9'));var fs=require('fs');var fs_extra=require(_0x160f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x160f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x160f('0xc'));var querystring=require(_0x160f('0xd'));var Papa=require(_0x160f('0xe'));var Redis=require('ioredis');var authService=require(_0x160f('0xf'));var qs=require(_0x160f('0x10'));var as=require(_0x160f('0x11'));var hardwareService=require(_0x160f('0x12'));var logger=require('../../config/logger')(_0x160f('0x13'));var utils=require(_0x160f('0x14'));var config=require(_0x160f('0x15'));var licenseUtil=require(_0x160f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2945db,_0x3f6bdf){_0x3f6bdf=_0x3f6bdf||0xcc;return function(_0x251add){if(_0x251add){return _0x2945db['sendStatus'](_0x3f6bdf);}return _0x2945db[_0x160f('0x17')](_0x3f6bdf)['end']();};}function respondWithResult(_0x35a8c1,_0x2c7c2f){_0x2c7c2f=_0x2c7c2f||0xc8;return function(_0x5110f6){if(_0x5110f6){return _0x35a8c1['status'](_0x2c7c2f)[_0x160f('0x18')](_0x5110f6);}};}function respondWithFilteredResult(_0x11d29d,_0x1ae7e2){return function(_0x590947){if(_0x590947){var _0x465453=typeof _0x1ae7e2[_0x160f('0x19')]==='undefined'&&typeof _0x1ae7e2['limit']===_0x160f('0x1a');var _0x216b29=_0x590947[_0x160f('0x1b')];var _0x46966b=_0x465453?0x0:_0x1ae7e2[_0x160f('0x19')];var _0x386cae=_0x465453?_0x590947[_0x160f('0x1b')]:_0x1ae7e2['offset']+_0x1ae7e2[_0x160f('0x1c')];var _0x5d1395;if(_0x386cae>=_0x216b29){_0x386cae=_0x216b29;_0x5d1395=0xc8;}else{_0x5d1395=0xce;}_0x11d29d['status'](_0x5d1395);return _0x11d29d['set']('Content-Range',_0x46966b+'-'+_0x386cae+'/'+_0x216b29)[_0x160f('0x18')](_0x590947);}return null;};}function patchUpdates(_0x15b436){return function(_0x5736ea){try{jsonpatch[_0x160f('0x1d')](_0x5736ea,_0x15b436,!![]);}catch(_0x509b4d){return BPromise['reject'](_0x509b4d);}return _0x5736ea[_0x160f('0x1e')]();};}function saveUpdates(_0x225b8c,_0x553783){return function(_0x447a7e){if(_0x447a7e){return _0x447a7e[_0x160f('0x1f')](_0x225b8c)[_0x160f('0x20')](function(_0x1ec281){return _0x1ec281;});}return null;};}function removeEntity(_0x1f738d,_0x4eecc2){return function(_0x32c626){if(_0x32c626){return _0x32c626[_0x160f('0x21')]()[_0x160f('0x20')](function(){_0x1f738d['status'](0xcc)[_0x160f('0x22')]();});}};}function handleEntityNotFound(_0x3dbce4,_0x4ae0e2){return function(_0x2a3e97){if(!_0x2a3e97){_0x3dbce4[_0x160f('0x23')](0x194);}return _0x2a3e97;};}function handleError(_0x450d7a,_0x3b9d3d){_0x3b9d3d=_0x3b9d3d||0x1f4;return function(_0x272337){logger['error'](_0x272337[_0x160f('0x24')]);if(_0x272337[_0x160f('0x25')]){delete _0x272337[_0x160f('0x25')];}_0x450d7a[_0x160f('0x17')](_0x3b9d3d)['send'](_0x272337);};}exports[_0x160f('0x26')]=function(_0x38f2ff,_0x34cb4e){var _0x184caa={},_0x23db26={},_0x3372d0={'count':0x0,'rows':[]};var _0x25b1b7=_[_0x160f('0x27')](db['FreshsalesConfiguration'][_0x160f('0x28')],function(_0x1bdb59){return{'name':_0x1bdb59[_0x160f('0x29')],'type':_0x1bdb59[_0x160f('0x2a')]['key']};});_0x23db26[_0x160f('0x2b')]=_[_0x160f('0x27')](_0x25b1b7,_0x160f('0x25'));_0x23db26['query']=_[_0x160f('0x2c')](_0x38f2ff[_0x160f('0x2d')]);_0x23db26[_0x160f('0x2e')]=_['intersection'](_0x23db26[_0x160f('0x2b')],_0x23db26[_0x160f('0x2d')]);_0x184caa[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x23db26[_0x160f('0x2b')],qs[_0x160f('0x31')](_0x38f2ff[_0x160f('0x2d')][_0x160f('0x31')]));_0x184caa[_0x160f('0x2f')]=_0x184caa['attributes'][_0x160f('0x32')]?_0x184caa['attributes']:_0x23db26[_0x160f('0x2b')];if(!_0x38f2ff[_0x160f('0x2d')][_0x160f('0x33')](_0x160f('0x34'))){_0x184caa[_0x160f('0x1c')]=qs['limit'](_0x38f2ff['query'][_0x160f('0x1c')]);_0x184caa[_0x160f('0x19')]=qs[_0x160f('0x19')](_0x38f2ff[_0x160f('0x2d')][_0x160f('0x19')]);}_0x184caa[_0x160f('0x35')]=qs[_0x160f('0x36')](_0x38f2ff[_0x160f('0x2d')]['sort']);_0x184caa[_0x160f('0x37')]=qs['filters'](_[_0x160f('0x38')](_0x38f2ff[_0x160f('0x2d')],_0x23db26['filters']),_0x25b1b7);if(_0x38f2ff['query'][_0x160f('0x39')]){_0x184caa['where']=_[_0x160f('0x3a')](_0x184caa[_0x160f('0x37')],{'$or':_[_0x160f('0x27')](_0x25b1b7,function(_0x580202){if(_0x580202[_0x160f('0x2a')]!==_0x160f('0x3b')){var _0x48b47a={};_0x48b47a[_0x580202[_0x160f('0x25')]]={'$like':'%'+_0x38f2ff[_0x160f('0x2d')]['filter']+'%'};return _0x48b47a;}})});}_0x184caa=_['merge']({},_0x184caa,_0x38f2ff[_0x160f('0x3c')]);var _0xce960={'where':_0x184caa[_0x160f('0x37')]};return db[_0x160f('0x3d')][_0x160f('0x1b')](_0xce960)[_0x160f('0x20')](function(_0x163252){_0x3372d0[_0x160f('0x1b')]=_0x163252;if(_0x38f2ff[_0x160f('0x2d')]['includeAll']){_0x184caa['include']=[{'all':!![]}];}return db[_0x160f('0x3d')][_0x160f('0x3e')](_0x184caa);})['then'](function(_0x3947b6){_0x3372d0[_0x160f('0x3f')]=_0x3947b6;return _0x3372d0;})[_0x160f('0x20')](respondWithFilteredResult(_0x34cb4e,_0x184caa))['catch'](handleError(_0x34cb4e,null));};exports['show']=function(_0x5c109e,_0x503f90){var _0x265bf0={'raw':![],'where':{'id':_0x5c109e[_0x160f('0x40')]['id']}},_0xa95293={};_0xa95293[_0x160f('0x2b')]=_['keys'](db['FreshsalesConfiguration'][_0x160f('0x28')]);_0xa95293[_0x160f('0x2d')]=_['keys'](_0x5c109e[_0x160f('0x2d')]);_0xa95293[_0x160f('0x2e')]=_['intersection'](_0xa95293[_0x160f('0x2b')],_0xa95293[_0x160f('0x2d')]);_0x265bf0[_0x160f('0x2f')]=_[_0x160f('0x30')](_0xa95293['model'],qs[_0x160f('0x31')](_0x5c109e['query'][_0x160f('0x31')]));_0x265bf0[_0x160f('0x2f')]=_0x265bf0[_0x160f('0x2f')][_0x160f('0x32')]?_0x265bf0[_0x160f('0x2f')]:_0xa95293[_0x160f('0x2b')];if(_0x5c109e['query'][_0x160f('0x41')]){_0x265bf0['include']=[{'all':!![]}];}_0x265bf0=_[_0x160f('0x3a')]({},_0x265bf0,_0x5c109e[_0x160f('0x3c')]);return db[_0x160f('0x3d')][_0x160f('0x42')](_0x265bf0)[_0x160f('0x20')](handleEntityNotFound(_0x503f90,null))[_0x160f('0x20')](respondWithResult(_0x503f90,null))[_0x160f('0x43')](handleError(_0x503f90,null));};exports[_0x160f('0x44')]=function(_0x383394,_0x33e310){return db[_0x160f('0x3d')][_0x160f('0x44')](_0x383394[_0x160f('0x45')],{})[_0x160f('0x20')](respondWithResult(_0x33e310,0xc9))[_0x160f('0x43')](handleError(_0x33e310,null));};exports[_0x160f('0x1f')]=function(_0x5d653d,_0x199699){if(_0x5d653d[_0x160f('0x45')]['id']){delete _0x5d653d[_0x160f('0x45')]['id'];}return db[_0x160f('0x3d')][_0x160f('0x42')]({'where':{'id':_0x5d653d['params']['id']}})[_0x160f('0x20')](handleEntityNotFound(_0x199699,null))[_0x160f('0x20')](saveUpdates(_0x5d653d['body'],null))[_0x160f('0x20')](respondWithResult(_0x199699,null))['catch'](handleError(_0x199699,null));};exports[_0x160f('0x21')]=function(_0x179852,_0xc6d17b){return db[_0x160f('0x3d')][_0x160f('0x42')]({'where':{'id':_0x179852[_0x160f('0x40')]['id']}})[_0x160f('0x20')](handleEntityNotFound(_0xc6d17b,null))['then'](removeEntity(_0xc6d17b,null))[_0x160f('0x43')](handleError(_0xc6d17b,null));};exports[_0x160f('0x46')]=function(_0x4c32ad,_0x2e5bc2,_0x3e61b2){var _0x2d68d0={};var _0x471b1f={};var _0x18ec5d;var _0x578618;return db[_0x160f('0x3d')][_0x160f('0x47')]({'where':{'id':_0x4c32ad[_0x160f('0x40')]['id']}})[_0x160f('0x20')](handleEntityNotFound(_0x2e5bc2,null))[_0x160f('0x20')](function(_0x192e8b){if(_0x192e8b){_0x18ec5d=_0x192e8b;_0x471b1f[_0x160f('0x2b')]=_[_0x160f('0x2c')](db[_0x160f('0x48')]['rawAttributes']);_0x471b1f[_0x160f('0x2d')]=_[_0x160f('0x2c')](_0x4c32ad[_0x160f('0x2d')]);_0x471b1f[_0x160f('0x2e')]=_[_0x160f('0x30')](_0x471b1f['model'],_0x471b1f[_0x160f('0x2d')]);_0x2d68d0[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x471b1f[_0x160f('0x2b')],qs['fields'](_0x4c32ad['query'][_0x160f('0x31')]));_0x2d68d0[_0x160f('0x2f')]=_0x2d68d0[_0x160f('0x2f')][_0x160f('0x32')]?_0x2d68d0[_0x160f('0x2f')]:_0x471b1f[_0x160f('0x2b')];_0x2d68d0[_0x160f('0x35')]=qs[_0x160f('0x36')](_0x4c32ad['query']['sort']);_0x2d68d0[_0x160f('0x37')]=qs['filters'](_[_0x160f('0x38')](_0x4c32ad[_0x160f('0x2d')],_0x471b1f[_0x160f('0x2e')]));if(_0x4c32ad[_0x160f('0x2d')][_0x160f('0x39')]){_0x2d68d0[_0x160f('0x37')]=_[_0x160f('0x3a')](_0x2d68d0[_0x160f('0x37')],{'$or':_[_0x160f('0x27')](_0x2d68d0[_0x160f('0x2f')],function(_0x3d160b){var _0x156da6={};_0x156da6[_0x3d160b]={'$like':'%'+_0x4c32ad[_0x160f('0x2d')][_0x160f('0x39')]+'%'};return _0x156da6;})});}_0x2d68d0=_[_0x160f('0x3a')]({},_0x2d68d0,_0x4c32ad['options']);return _0x18ec5d['getSubjects'](_0x2d68d0);}})['then'](function(_0x5bcda1){if(_0x5bcda1){_0x578618=_0x5bcda1[_0x160f('0x32')];if(!_0x4c32ad[_0x160f('0x2d')][_0x160f('0x33')](_0x160f('0x34'))){_0x2d68d0[_0x160f('0x1c')]=qs[_0x160f('0x1c')](_0x4c32ad[_0x160f('0x2d')][_0x160f('0x1c')]);_0x2d68d0[_0x160f('0x19')]=qs[_0x160f('0x19')](_0x4c32ad[_0x160f('0x2d')][_0x160f('0x19')]);}return _0x18ec5d[_0x160f('0x46')](_0x2d68d0);}})[_0x160f('0x20')](function(_0x4214e6){if(_0x4214e6){return _0x4214e6?{'count':_0x578618,'rows':_0x4214e6}:null;}})[_0x160f('0x20')](respondWithResult(_0x2e5bc2,null))[_0x160f('0x43')](handleError(_0x2e5bc2,null));};exports[_0x160f('0x49')]=function(_0x103aa5,_0x4a9282,_0x27dd3c){var _0x4fb79a={};var _0x298064={};var _0x2c98ec;var _0x3dc5d4;return db[_0x160f('0x3d')]['findOne']({'where':{'id':_0x103aa5[_0x160f('0x40')]['id']}})[_0x160f('0x20')](handleEntityNotFound(_0x4a9282,null))[_0x160f('0x20')](function(_0x596045){if(_0x596045){_0x2c98ec=_0x596045;_0x298064[_0x160f('0x2b')]=_[_0x160f('0x2c')](db[_0x160f('0x48')]['rawAttributes']);_0x298064['query']=_[_0x160f('0x2c')](_0x103aa5[_0x160f('0x2d')]);_0x298064[_0x160f('0x2e')]=_[_0x160f('0x30')](_0x298064['model'],_0x298064[_0x160f('0x2d')]);_0x4fb79a[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x298064[_0x160f('0x2b')],qs[_0x160f('0x31')](_0x103aa5[_0x160f('0x2d')][_0x160f('0x31')]));_0x4fb79a[_0x160f('0x2f')]=_0x4fb79a[_0x160f('0x2f')][_0x160f('0x32')]?_0x4fb79a[_0x160f('0x2f')]:_0x298064[_0x160f('0x2b')];_0x4fb79a[_0x160f('0x35')]=qs[_0x160f('0x36')](_0x103aa5['query'][_0x160f('0x36')]);_0x4fb79a[_0x160f('0x37')]=qs[_0x160f('0x2e')](_['pick'](_0x103aa5[_0x160f('0x2d')],_0x298064[_0x160f('0x2e')]));if(_0x103aa5[_0x160f('0x2d')][_0x160f('0x39')]){_0x4fb79a[_0x160f('0x37')]=_[_0x160f('0x3a')](_0x4fb79a[_0x160f('0x37')],{'$or':_['map'](_0x4fb79a[_0x160f('0x2f')],function(_0x420093){var _0x28b895={};_0x28b895[_0x420093]={'$like':'%'+_0x103aa5[_0x160f('0x2d')][_0x160f('0x39')]+'%'};return _0x28b895;})});}_0x4fb79a=_[_0x160f('0x3a')]({},_0x4fb79a,_0x103aa5['options']);return _0x2c98ec[_0x160f('0x49')](_0x4fb79a);}})[_0x160f('0x20')](function(_0x4f7a2f){if(_0x4f7a2f){_0x3dc5d4=_0x4f7a2f['length'];if(!_0x103aa5[_0x160f('0x2d')][_0x160f('0x33')](_0x160f('0x34'))){_0x4fb79a[_0x160f('0x1c')]=qs[_0x160f('0x1c')](_0x103aa5['query'][_0x160f('0x1c')]);_0x4fb79a['offset']=qs[_0x160f('0x19')](_0x103aa5[_0x160f('0x2d')][_0x160f('0x19')]);}return _0x2c98ec[_0x160f('0x49')](_0x4fb79a);}})[_0x160f('0x20')](function(_0x10f731){if(_0x10f731){return _0x10f731?{'count':_0x3dc5d4,'rows':_0x10f731}:null;}})[_0x160f('0x20')](respondWithResult(_0x4a9282,null))[_0x160f('0x43')](handleError(_0x4a9282,null));};exports['getFields']=function(_0x535855,_0x3e769c,_0x1f3073){var _0x2a3dc3={};var _0x11649e={};var _0x2b87b7;var _0x5e4ee3;return db['FreshsalesConfiguration'][_0x160f('0x47')]({'where':{'id':_0x535855[_0x160f('0x40')]['id']}})[_0x160f('0x20')](handleEntityNotFound(_0x3e769c,null))['then'](function(_0x4cff4f){if(_0x4cff4f){_0x2b87b7=_0x4cff4f;_0x11649e[_0x160f('0x2b')]=_['keys'](db[_0x160f('0x48')]['rawAttributes']);_0x11649e[_0x160f('0x2d')]=_[_0x160f('0x2c')](_0x535855[_0x160f('0x2d')]);_0x11649e[_0x160f('0x2e')]=_[_0x160f('0x30')](_0x11649e[_0x160f('0x2b')],_0x11649e[_0x160f('0x2d')]);_0x2a3dc3[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x11649e[_0x160f('0x2b')],qs['fields'](_0x535855[_0x160f('0x2d')][_0x160f('0x31')]));_0x2a3dc3['attributes']=_0x2a3dc3[_0x160f('0x2f')][_0x160f('0x32')]?_0x2a3dc3[_0x160f('0x2f')]:_0x11649e['model'];_0x2a3dc3['order']=qs[_0x160f('0x36')](_0x535855[_0x160f('0x2d')]['sort']);_0x2a3dc3[_0x160f('0x37')]=qs[_0x160f('0x2e')](_[_0x160f('0x38')](_0x535855[_0x160f('0x2d')],_0x11649e[_0x160f('0x2e')]));if(_0x535855[_0x160f('0x2d')][_0x160f('0x39')]){_0x2a3dc3[_0x160f('0x37')]=_[_0x160f('0x3a')](_0x2a3dc3['where'],{'$or':_['map'](_0x2a3dc3[_0x160f('0x2f')],function(_0x1d6c00){var _0x317fc1={};_0x317fc1[_0x1d6c00]={'$like':'%'+_0x535855[_0x160f('0x2d')][_0x160f('0x39')]+'%'};return _0x317fc1;})});}_0x2a3dc3=_['merge']({},_0x2a3dc3,_0x535855['options']);return _0x2b87b7[_0x160f('0x4a')](_0x2a3dc3);}})[_0x160f('0x20')](function(_0xfd419f){if(_0xfd419f){_0x5e4ee3=_0xfd419f[_0x160f('0x32')];if(!_0x535855[_0x160f('0x2d')]['hasOwnProperty'](_0x160f('0x34'))){_0x2a3dc3[_0x160f('0x1c')]=qs[_0x160f('0x1c')](_0x535855[_0x160f('0x2d')][_0x160f('0x1c')]);_0x2a3dc3[_0x160f('0x19')]=qs['offset'](_0x535855[_0x160f('0x2d')]['offset']);}return _0x2b87b7[_0x160f('0x4a')](_0x2a3dc3);}})[_0x160f('0x20')](function(_0x21b07a){if(_0x21b07a){return _0x21b07a?{'count':_0x5e4ee3,'rows':_0x21b07a}:null;}})[_0x160f('0x20')](respondWithResult(_0x3e769c,null))[_0x160f('0x43')](handleError(_0x3e769c,null));}; \ No newline at end of file +var _0x5344=['key','model','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','body','destroy','getSubjects','findOne','nolimit','FreshsalesField','getDescriptions','hasOwnProperty','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','error','stack','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type'];(function(_0x5c2efe,_0x2e7fef){var _0x19bbbe=function(_0x5e2049){while(--_0x5e2049){_0x5c2efe['push'](_0x5c2efe['shift']());}};_0x19bbbe(++_0x2e7fef);}(_0x5344,0x6f));var _0x4534=function(_0x50a025,_0x30b23b){_0x50a025=_0x50a025-0x0;var _0x3d2a16=_0x5344[_0x50a025];return _0x3d2a16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4534('0x0'));var zipdir=require(_0x4534('0x1'));var jsonpatch=require(_0x4534('0x2'));var rp=require(_0x4534('0x3'));var moment=require('moment');var BPromise=require(_0x4534('0x4'));var Mustache=require(_0x4534('0x5'));var util=require('util');var path=require(_0x4534('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4534('0x7'));var _=require(_0x4534('0x8'));var squel=require(_0x4534('0x9'));var crypto=require(_0x4534('0xa'));var jsforce=require(_0x4534('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4534('0xc'));var querystring=require('querystring');var Papa=require(_0x4534('0xd'));var Redis=require(_0x4534('0xe'));var authService=require(_0x4534('0xf'));var qs=require(_0x4534('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4534('0x11'));var logger=require(_0x4534('0x12'))(_0x4534('0x13'));var utils=require(_0x4534('0x14'));var config=require(_0x4534('0x15'));var licenseUtil=require(_0x4534('0x16'));var db=require(_0x4534('0x17'))['db'];function respondWithStatusCode(_0x362389,_0x1f96a4){_0x1f96a4=_0x1f96a4||0xcc;return function(_0x324e5c){if(_0x324e5c){return _0x362389[_0x4534('0x18')](_0x1f96a4);}return _0x362389[_0x4534('0x19')](_0x1f96a4)[_0x4534('0x1a')]();};}function respondWithResult(_0x35b76e,_0x271190){_0x271190=_0x271190||0xc8;return function(_0x161ca9){if(_0x161ca9){return _0x35b76e['status'](_0x271190)[_0x4534('0x1b')](_0x161ca9);}};}function respondWithFilteredResult(_0x35cbe0,_0x1aa7c4){return function(_0x58bb5a){if(_0x58bb5a){var _0x4b1075=typeof _0x1aa7c4[_0x4534('0x1c')]==='undefined'&&typeof _0x1aa7c4[_0x4534('0x1d')]==='undefined';var _0x2043fc=_0x58bb5a[_0x4534('0x1e')];var _0x2dee81=_0x4b1075?0x0:_0x1aa7c4[_0x4534('0x1c')];var _0x743e8a=_0x4b1075?_0x58bb5a[_0x4534('0x1e')]:_0x1aa7c4[_0x4534('0x1c')]+_0x1aa7c4['limit'];var _0x1ac7b2;if(_0x743e8a>=_0x2043fc){_0x743e8a=_0x2043fc;_0x1ac7b2=0xc8;}else{_0x1ac7b2=0xce;}_0x35cbe0[_0x4534('0x19')](_0x1ac7b2);return _0x35cbe0[_0x4534('0x1f')]('Content-Range',_0x2dee81+'-'+_0x743e8a+'/'+_0x2043fc)[_0x4534('0x1b')](_0x58bb5a);}return null;};}function patchUpdates(_0x34228a){return function(_0x55fe39){try{jsonpatch[_0x4534('0x20')](_0x55fe39,_0x34228a,!![]);}catch(_0x3ce63b){return BPromise[_0x4534('0x21')](_0x3ce63b);}return _0x55fe39['save']();};}function saveUpdates(_0x1f44cc,_0x216685){return function(_0x59943a){if(_0x59943a){return _0x59943a[_0x4534('0x22')](_0x1f44cc)[_0x4534('0x23')](function(_0x19d79d){return _0x19d79d;});}return null;};}function removeEntity(_0x1b99ac,_0x11fafe){return function(_0x171715){if(_0x171715){return _0x171715['destroy']()['then'](function(){_0x1b99ac[_0x4534('0x19')](0xcc)[_0x4534('0x1a')]();});}};}function handleEntityNotFound(_0x2ec0af,_0x13e74c){return function(_0x38932c){if(!_0x38932c){_0x2ec0af[_0x4534('0x18')](0x194);}return _0x38932c;};}function handleError(_0xcf56a9,_0x4d3b11){_0x4d3b11=_0x4d3b11||0x1f4;return function(_0x440f8e){logger[_0x4534('0x24')](_0x440f8e[_0x4534('0x25')]);if(_0x440f8e['name']){delete _0x440f8e['name'];}_0xcf56a9['status'](_0x4d3b11)[_0x4534('0x26')](_0x440f8e);};}exports[_0x4534('0x27')]=function(_0x543008,_0x56a71a){var _0x266bf4={},_0x16b82b={},_0x2d9cce={'count':0x0,'rows':[]};var _0x14dd66=_[_0x4534('0x28')](db[_0x4534('0x29')][_0x4534('0x2a')],function(_0x133efb){return{'name':_0x133efb[_0x4534('0x2b')],'type':_0x133efb[_0x4534('0x2c')][_0x4534('0x2d')]};});_0x16b82b[_0x4534('0x2e')]=_[_0x4534('0x28')](_0x14dd66,_0x4534('0x2f'));_0x16b82b['query']=_['keys'](_0x543008[_0x4534('0x30')]);_0x16b82b[_0x4534('0x31')]=_[_0x4534('0x32')](_0x16b82b[_0x4534('0x2e')],_0x16b82b[_0x4534('0x30')]);_0x266bf4[_0x4534('0x33')]=_[_0x4534('0x32')](_0x16b82b[_0x4534('0x2e')],qs[_0x4534('0x34')](_0x543008[_0x4534('0x30')][_0x4534('0x34')]));_0x266bf4[_0x4534('0x33')]=_0x266bf4[_0x4534('0x33')][_0x4534('0x35')]?_0x266bf4[_0x4534('0x33')]:_0x16b82b[_0x4534('0x2e')];if(!_0x543008[_0x4534('0x30')]['hasOwnProperty']('nolimit')){_0x266bf4[_0x4534('0x1d')]=qs[_0x4534('0x1d')](_0x543008[_0x4534('0x30')][_0x4534('0x1d')]);_0x266bf4[_0x4534('0x1c')]=qs[_0x4534('0x1c')](_0x543008[_0x4534('0x30')][_0x4534('0x1c')]);}_0x266bf4[_0x4534('0x36')]=qs[_0x4534('0x37')](_0x543008[_0x4534('0x30')][_0x4534('0x37')]);_0x266bf4[_0x4534('0x38')]=qs['filters'](_[_0x4534('0x39')](_0x543008[_0x4534('0x30')],_0x16b82b[_0x4534('0x31')]),_0x14dd66);if(_0x543008[_0x4534('0x30')][_0x4534('0x3a')]){_0x266bf4[_0x4534('0x38')]=_[_0x4534('0x3b')](_0x266bf4[_0x4534('0x38')],{'$or':_[_0x4534('0x28')](_0x14dd66,function(_0x466c77){if(_0x466c77[_0x4534('0x2c')]!==_0x4534('0x3c')){var _0x3f2175={};_0x3f2175[_0x466c77['name']]={'$like':'%'+_0x543008[_0x4534('0x30')][_0x4534('0x3a')]+'%'};return _0x3f2175;}})});}_0x266bf4=_['merge']({},_0x266bf4,_0x543008[_0x4534('0x3d')]);var _0x5e0454={'where':_0x266bf4['where']};return db[_0x4534('0x29')][_0x4534('0x1e')](_0x5e0454)[_0x4534('0x23')](function(_0x263ae1){_0x2d9cce[_0x4534('0x1e')]=_0x263ae1;if(_0x543008[_0x4534('0x30')][_0x4534('0x3e')]){_0x266bf4[_0x4534('0x3f')]=[{'all':!![]}];}return db[_0x4534('0x29')]['findAll'](_0x266bf4);})[_0x4534('0x23')](function(_0x3f2276){_0x2d9cce['rows']=_0x3f2276;return _0x2d9cce;})[_0x4534('0x23')](respondWithFilteredResult(_0x56a71a,_0x266bf4))[_0x4534('0x40')](handleError(_0x56a71a,null));};exports[_0x4534('0x41')]=function(_0x1bb5ac,_0x5cbe89){var _0x2d089d={'raw':![],'where':{'id':_0x1bb5ac[_0x4534('0x42')]['id']}},_0x2b6fc6={};_0x2b6fc6[_0x4534('0x2e')]=_['keys'](db[_0x4534('0x29')][_0x4534('0x2a')]);_0x2b6fc6[_0x4534('0x30')]=_[_0x4534('0x43')](_0x1bb5ac[_0x4534('0x30')]);_0x2b6fc6[_0x4534('0x31')]=_[_0x4534('0x32')](_0x2b6fc6[_0x4534('0x2e')],_0x2b6fc6[_0x4534('0x30')]);_0x2d089d[_0x4534('0x33')]=_['intersection'](_0x2b6fc6[_0x4534('0x2e')],qs['fields'](_0x1bb5ac['query'][_0x4534('0x34')]));_0x2d089d[_0x4534('0x33')]=_0x2d089d[_0x4534('0x33')][_0x4534('0x35')]?_0x2d089d['attributes']:_0x2b6fc6[_0x4534('0x2e')];if(_0x1bb5ac['query'][_0x4534('0x3e')]){_0x2d089d['include']=[{'all':!![]}];}_0x2d089d=_[_0x4534('0x3b')]({},_0x2d089d,_0x1bb5ac[_0x4534('0x3d')]);return db[_0x4534('0x29')][_0x4534('0x44')](_0x2d089d)['then'](handleEntityNotFound(_0x5cbe89,null))['then'](respondWithResult(_0x5cbe89,null))[_0x4534('0x40')](handleError(_0x5cbe89,null));};exports['create']=function(_0x1aee4b,_0x1a58a1){return db[_0x4534('0x29')]['create'](_0x1aee4b[_0x4534('0x45')],{})[_0x4534('0x23')](respondWithResult(_0x1a58a1,0xc9))[_0x4534('0x40')](handleError(_0x1a58a1,null));};exports['update']=function(_0x4e9647,_0x3375e8){if(_0x4e9647[_0x4534('0x45')]['id']){delete _0x4e9647[_0x4534('0x45')]['id'];}return db[_0x4534('0x29')][_0x4534('0x44')]({'where':{'id':_0x4e9647[_0x4534('0x42')]['id']}})[_0x4534('0x23')](handleEntityNotFound(_0x3375e8,null))[_0x4534('0x23')](saveUpdates(_0x4e9647[_0x4534('0x45')],null))['then'](respondWithResult(_0x3375e8,null))[_0x4534('0x40')](handleError(_0x3375e8,null));};exports[_0x4534('0x46')]=function(_0x25a6c2,_0x1c07ff){return db[_0x4534('0x29')][_0x4534('0x44')]({'where':{'id':_0x25a6c2[_0x4534('0x42')]['id']}})[_0x4534('0x23')](handleEntityNotFound(_0x1c07ff,null))[_0x4534('0x23')](removeEntity(_0x1c07ff,null))[_0x4534('0x40')](handleError(_0x1c07ff,null));};exports[_0x4534('0x47')]=function(_0x2d491c,_0x526868,_0x366e70){var _0x96dc7a={};var _0x3b4d4e={};var _0x4c291a;var _0x541437;return db[_0x4534('0x29')][_0x4534('0x48')]({'where':{'id':_0x2d491c[_0x4534('0x42')]['id']}})[_0x4534('0x23')](handleEntityNotFound(_0x526868,null))[_0x4534('0x23')](function(_0x29723e){if(_0x29723e){_0x4c291a=_0x29723e;_0x3b4d4e['model']=_[_0x4534('0x43')](db['FreshsalesField'][_0x4534('0x2a')]);_0x3b4d4e[_0x4534('0x30')]=_[_0x4534('0x43')](_0x2d491c[_0x4534('0x30')]);_0x3b4d4e[_0x4534('0x31')]=_[_0x4534('0x32')](_0x3b4d4e[_0x4534('0x2e')],_0x3b4d4e[_0x4534('0x30')]);_0x96dc7a[_0x4534('0x33')]=_[_0x4534('0x32')](_0x3b4d4e[_0x4534('0x2e')],qs[_0x4534('0x34')](_0x2d491c[_0x4534('0x30')][_0x4534('0x34')]));_0x96dc7a['attributes']=_0x96dc7a[_0x4534('0x33')][_0x4534('0x35')]?_0x96dc7a[_0x4534('0x33')]:_0x3b4d4e['model'];_0x96dc7a[_0x4534('0x36')]=qs[_0x4534('0x37')](_0x2d491c[_0x4534('0x30')][_0x4534('0x37')]);_0x96dc7a[_0x4534('0x38')]=qs[_0x4534('0x31')](_[_0x4534('0x39')](_0x2d491c[_0x4534('0x30')],_0x3b4d4e[_0x4534('0x31')]));if(_0x2d491c[_0x4534('0x30')][_0x4534('0x3a')]){_0x96dc7a['where']=_[_0x4534('0x3b')](_0x96dc7a[_0x4534('0x38')],{'$or':_['map'](_0x96dc7a[_0x4534('0x33')],function(_0x3bbca2){var _0x1fea77={};_0x1fea77[_0x3bbca2]={'$like':'%'+_0x2d491c[_0x4534('0x30')]['filter']+'%'};return _0x1fea77;})});}_0x96dc7a=_[_0x4534('0x3b')]({},_0x96dc7a,_0x2d491c[_0x4534('0x3d')]);return _0x4c291a['getSubjects'](_0x96dc7a);}})['then'](function(_0x568081){if(_0x568081){_0x541437=_0x568081['length'];if(!_0x2d491c[_0x4534('0x30')]['hasOwnProperty'](_0x4534('0x49'))){_0x96dc7a['limit']=qs[_0x4534('0x1d')](_0x2d491c[_0x4534('0x30')]['limit']);_0x96dc7a[_0x4534('0x1c')]=qs[_0x4534('0x1c')](_0x2d491c['query']['offset']);}return _0x4c291a[_0x4534('0x47')](_0x96dc7a);}})['then'](function(_0x122a50){if(_0x122a50){return _0x122a50?{'count':_0x541437,'rows':_0x122a50}:null;}})[_0x4534('0x23')](respondWithResult(_0x526868,null))['catch'](handleError(_0x526868,null));};exports['getDescriptions']=function(_0x58e36e,_0x242c3c,_0x52c8d0){var _0x32bfe1={};var _0xddd899={};var _0x10e4d0;var _0x55b415;return db[_0x4534('0x29')]['findOne']({'where':{'id':_0x58e36e[_0x4534('0x42')]['id']}})[_0x4534('0x23')](handleEntityNotFound(_0x242c3c,null))[_0x4534('0x23')](function(_0x566da8){if(_0x566da8){_0x10e4d0=_0x566da8;_0xddd899[_0x4534('0x2e')]=_[_0x4534('0x43')](db[_0x4534('0x4a')][_0x4534('0x2a')]);_0xddd899[_0x4534('0x30')]=_[_0x4534('0x43')](_0x58e36e[_0x4534('0x30')]);_0xddd899[_0x4534('0x31')]=_['intersection'](_0xddd899['model'],_0xddd899[_0x4534('0x30')]);_0x32bfe1[_0x4534('0x33')]=_[_0x4534('0x32')](_0xddd899['model'],qs[_0x4534('0x34')](_0x58e36e[_0x4534('0x30')][_0x4534('0x34')]));_0x32bfe1[_0x4534('0x33')]=_0x32bfe1[_0x4534('0x33')][_0x4534('0x35')]?_0x32bfe1[_0x4534('0x33')]:_0xddd899['model'];_0x32bfe1['order']=qs[_0x4534('0x37')](_0x58e36e['query']['sort']);_0x32bfe1[_0x4534('0x38')]=qs[_0x4534('0x31')](_[_0x4534('0x39')](_0x58e36e[_0x4534('0x30')],_0xddd899[_0x4534('0x31')]));if(_0x58e36e[_0x4534('0x30')][_0x4534('0x3a')]){_0x32bfe1[_0x4534('0x38')]=_[_0x4534('0x3b')](_0x32bfe1['where'],{'$or':_[_0x4534('0x28')](_0x32bfe1[_0x4534('0x33')],function(_0x124e26){var _0x4d4741={};_0x4d4741[_0x124e26]={'$like':'%'+_0x58e36e[_0x4534('0x30')]['filter']+'%'};return _0x4d4741;})});}_0x32bfe1=_['merge']({},_0x32bfe1,_0x58e36e[_0x4534('0x3d')]);return _0x10e4d0[_0x4534('0x4b')](_0x32bfe1);}})[_0x4534('0x23')](function(_0x2fa52c){if(_0x2fa52c){_0x55b415=_0x2fa52c[_0x4534('0x35')];if(!_0x58e36e[_0x4534('0x30')][_0x4534('0x4c')]('nolimit')){_0x32bfe1['limit']=qs[_0x4534('0x1d')](_0x58e36e[_0x4534('0x30')][_0x4534('0x1d')]);_0x32bfe1[_0x4534('0x1c')]=qs['offset'](_0x58e36e[_0x4534('0x30')][_0x4534('0x1c')]);}return _0x10e4d0['getDescriptions'](_0x32bfe1);}})[_0x4534('0x23')](function(_0x52fe4c){if(_0x52fe4c){return _0x52fe4c?{'count':_0x55b415,'rows':_0x52fe4c}:null;}})[_0x4534('0x23')](respondWithResult(_0x242c3c,null))[_0x4534('0x40')](handleError(_0x242c3c,null));};exports[_0x4534('0x4d')]=function(_0x49d75e,_0x28dc54,_0x41fd62){var _0x38055a={};var _0x591510={};var _0x456be7;var _0x1c3cb3;return db[_0x4534('0x29')][_0x4534('0x48')]({'where':{'id':_0x49d75e[_0x4534('0x42')]['id']}})[_0x4534('0x23')](handleEntityNotFound(_0x28dc54,null))[_0x4534('0x23')](function(_0x166e80){if(_0x166e80){_0x456be7=_0x166e80;_0x591510[_0x4534('0x2e')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x591510[_0x4534('0x30')]=_[_0x4534('0x43')](_0x49d75e[_0x4534('0x30')]);_0x591510[_0x4534('0x31')]=_[_0x4534('0x32')](_0x591510['model'],_0x591510[_0x4534('0x30')]);_0x38055a[_0x4534('0x33')]=_[_0x4534('0x32')](_0x591510[_0x4534('0x2e')],qs[_0x4534('0x34')](_0x49d75e[_0x4534('0x30')][_0x4534('0x34')]));_0x38055a['attributes']=_0x38055a['attributes'][_0x4534('0x35')]?_0x38055a[_0x4534('0x33')]:_0x591510[_0x4534('0x2e')];_0x38055a[_0x4534('0x36')]=qs[_0x4534('0x37')](_0x49d75e[_0x4534('0x30')][_0x4534('0x37')]);_0x38055a[_0x4534('0x38')]=qs[_0x4534('0x31')](_['pick'](_0x49d75e[_0x4534('0x30')],_0x591510[_0x4534('0x31')]));if(_0x49d75e['query'][_0x4534('0x3a')]){_0x38055a[_0x4534('0x38')]=_[_0x4534('0x3b')](_0x38055a[_0x4534('0x38')],{'$or':_['map'](_0x38055a[_0x4534('0x33')],function(_0x121900){var _0x42cf3d={};_0x42cf3d[_0x121900]={'$like':'%'+_0x49d75e['query']['filter']+'%'};return _0x42cf3d;})});}_0x38055a=_['merge']({},_0x38055a,_0x49d75e[_0x4534('0x3d')]);return _0x456be7[_0x4534('0x4d')](_0x38055a);}})[_0x4534('0x23')](function(_0x495388){if(_0x495388){_0x1c3cb3=_0x495388[_0x4534('0x35')];if(!_0x49d75e['query']['hasOwnProperty'](_0x4534('0x49'))){_0x38055a[_0x4534('0x1d')]=qs[_0x4534('0x1d')](_0x49d75e['query'][_0x4534('0x1d')]);_0x38055a[_0x4534('0x1c')]=qs[_0x4534('0x1c')](_0x49d75e[_0x4534('0x30')][_0x4534('0x1c')]);}return _0x456be7[_0x4534('0x4d')](_0x38055a);}})['then'](function(_0x50032f){if(_0x50032f){return _0x50032f?{'count':_0x1c3cb3,'rows':_0x50032f}:null;}})['then'](respondWithResult(_0x28dc54,null))['catch'](handleError(_0x28dc54,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c01f0fb..5ce5e17 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 _0x0fd2=['define','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x2c4ee5,_0x4710b6){var _0x3aa942=function(_0x4d56cd){while(--_0x4d56cd){_0x2c4ee5['push'](_0x2c4ee5['shift']());}};_0x3aa942(++_0x4710b6);}(_0x0fd2,0x152));var _0x20fd=function(_0x53de6d,_0x45c593){_0x53de6d=_0x53de6d-0x0;var _0x1661f2=_0x0fd2[_0x53de6d];return _0x1661f2;};'use strict';var _=require(_0x20fd('0x0'));var util=require('util');var logger=require(_0x20fd('0x1'))('api');var moment=require(_0x20fd('0x2'));var BPromise=require(_0x20fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20fd('0x4'));var rimraf=require(_0x20fd('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3720e7,_0x2f62d7){return _0x3720e7[_0x20fd('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0x20fd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f99=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x5f99,0x12f));var _0x95f9=function(_0x362695,_0xe0f593){_0x362695=_0x362695-0x0;var _0x4dd232=_0x5f99[_0x362695];return _0x4dd232;};'use strict';var _=require(_0x95f9('0x0'));var util=require(_0x95f9('0x1'));var logger=require(_0x95f9('0x2'))(_0x95f9('0x3'));var moment=require(_0x95f9('0x4'));var BPromise=require(_0x95f9('0x5'));var rp=require(_0x95f9('0x6'));var fs=require('fs');var path=require(_0x95f9('0x7'));var rimraf=require(_0x95f9('0x8'));var config=require(_0x95f9('0x9'));var attributes=require(_0x95f9('0xa'));module[_0x95f9('0xb')]=function(_0x50bb60,_0x5e1adb){return _0x50bb60['define'](_0x95f9('0xc'),attributes,{'tableName':_0x95f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 89bfae8..464774e 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 _0xd853=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x313b7e,_0x585ac8){var _0xb3b50f=function(_0x165488){while(--_0x165488){_0x313b7e['push'](_0x313b7e['shift']());}};_0xb3b50f(++_0x585ac8);}(_0xd853,0x91));var _0x3d85=function(_0x9f9ed5,_0x56f438){_0x9f9ed5=_0x9f9ed5-0x0;var _0xbc71e3=_0xd853[_0x9f9ed5];return _0xbc71e3;};'use strict';var _=require(_0x3d85('0x0'));var util=require(_0x3d85('0x1'));var moment=require('moment');var BPromise=require(_0x3d85('0x2'));var rs=require(_0x3d85('0x3'));var fs=require('fs');var Redis=require(_0x3d85('0x4'));var db=require(_0x3d85('0x5'))['db'];var utils=require(_0x3d85('0x6'));var logger=require('../../config/logger')(_0x3d85('0x7'));var config=require(_0x3d85('0x8'));var jayson=require(_0x3d85('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2334a2,_0x3fad05,_0x1ad197){return new BPromise(function(_0x5996f6,_0xec1d89){return client['request'](_0x2334a2,_0x1ad197)[_0x3d85('0xa')](function(_0x282c48){logger[_0x3d85('0xb')](_0x3d85('0xc'),_0x3fad05,_0x3d85('0xd'));logger[_0x3d85('0xe')](_0x3d85('0xf'),_0x3fad05,'request\x20sent',JSON[_0x3d85('0x10')](_0x282c48));if(_0x282c48['error']){if(_0x282c48[_0x3d85('0x11')][_0x3d85('0x12')]===0x1f4){logger[_0x3d85('0x11')](_0x3d85('0xc'),_0x3fad05,_0x282c48[_0x3d85('0x11')][_0x3d85('0x13')]);return _0xec1d89(_0x282c48[_0x3d85('0x11')][_0x3d85('0x13')]);}logger['error'](_0x3d85('0xc'),_0x3fad05,_0x282c48[_0x3d85('0x11')][_0x3d85('0x13')]);return _0x5996f6(_0x282c48[_0x3d85('0x11')][_0x3d85('0x13')]);}else{logger[_0x3d85('0xb')](_0x3d85('0xc'),_0x3fad05,_0x3d85('0xd'));_0x5996f6(_0x282c48[_0x3d85('0x14')][_0x3d85('0x13')]);}})['catch'](function(_0x223235){logger[_0x3d85('0x11')](_0x3d85('0xc'),_0x3fad05,_0x223235);_0xec1d89(_0x223235);});});} \ No newline at end of file +var _0xf7b3=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xf7b3,0x1e6));var _0x3f7b=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xf7b3[_0x532112];return _0x23e5fb;};'use strict';var _=require(_0x3f7b('0x0'));var util=require(_0x3f7b('0x1'));var moment=require(_0x3f7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f7b('0x3'))['db'];var utils=require(_0x3f7b('0x4'));var logger=require(_0x3f7b('0x5'))(_0x3f7b('0x6'));var config=require(_0x3f7b('0x7'));var jayson=require(_0x3f7b('0x8'));var client=jayson[_0x3f7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d173d,_0x189831,_0x22388a){return new BPromise(function(_0xbe1958,_0x304ee4){return client[_0x3f7b('0xa')](_0x2d173d,_0x22388a)[_0x3f7b('0xb')](function(_0x568544){logger[_0x3f7b('0xc')](_0x3f7b('0xd'),_0x189831,_0x3f7b('0xe'));logger[_0x3f7b('0xf')](_0x3f7b('0x10'),_0x189831,_0x3f7b('0xe'),JSON[_0x3f7b('0x11')](_0x568544));if(_0x568544[_0x3f7b('0x12')]){if(_0x568544['error'][_0x3f7b('0x13')]===0x1f4){logger[_0x3f7b('0x12')](_0x3f7b('0xd'),_0x189831,_0x568544['error'][_0x3f7b('0x14')]);return _0x304ee4(_0x568544[_0x3f7b('0x12')][_0x3f7b('0x14')]);}logger['error'](_0x3f7b('0xd'),_0x189831,_0x568544[_0x3f7b('0x12')][_0x3f7b('0x14')]);return _0xbe1958(_0x568544['error']['message']);}else{logger[_0x3f7b('0xc')](_0x3f7b('0xd'),_0x189831,_0x3f7b('0xe'));_0xbe1958(_0x568544[_0x3f7b('0x15')][_0x3f7b('0x14')]);}})[_0x3f7b('0x16')](function(_0x31f09b){logger[_0x3f7b('0x12')](_0x3f7b('0xd'),_0x189831,_0x31f09b);_0x304ee4(_0x31f09b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0d5b98d..253cfb6 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 _0xfe57=['get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x35242b,_0x3c7a13){var _0x13647c=function(_0x5247ce){while(--_0x5247ce){_0x35242b['push'](_0x35242b['shift']());}};_0x13647c(++_0x3c7a13);}(_0xfe57,0x195));var _0x7fe5=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xfe57[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fe5('0x2'));var router=express[_0x7fe5('0x3')]();var fs_extra=require(_0x7fe5('0x4'));var auth=require(_0x7fe5('0x5'));var interaction=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var controller=require(_0x7fe5('0x8'));router[_0x7fe5('0x9')]('/',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xb')]);router[_0x7fe5('0x9')](_0x7fe5('0xc'),auth[_0x7fe5('0xa')](),controller['show']);router[_0x7fe5('0xd')]('/',auth['isAuthenticated'](),controller[_0x7fe5('0xe')]);router[_0x7fe5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7fe5('0x10')]);router[_0x7fe5('0x11')]('/:id',auth[_0x7fe5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd66c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','exports','multer','path','connect-timeout','express'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xd66c,0x106));var _0xcd66=function(_0x382f51,_0x98187f){_0x382f51=_0x382f51-0x0;var _0x3f8767=_0xd66c[_0x382f51];return _0x3f8767;};'use strict';var multer=require(_0xcd66('0x0'));var util=require('util');var path=require(_0xcd66('0x1'));var timeout=require(_0xcd66('0x2'));var express=require(_0xcd66('0x3'));var router=express[_0xcd66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd66('0x5'));var interaction=require(_0xcd66('0x6'));var config=require(_0xcd66('0x7'));var controller=require(_0xcd66('0x8'));router[_0xcd66('0x9')]('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0xb')]);router[_0xcd66('0x9')]('/:id',auth[_0xcd66('0xa')](),controller[_0xcd66('0xc')]);router[_0xcd66('0xd')]('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0xe')]);router[_0xcd66('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xcd66('0x10')]);router['delete'](_0xcd66('0x11'),auth[_0xcd66('0xa')](),controller['destroy']);module[_0xcd66('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 805a4b9..2697e44 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 _0xf005=['BOOLEAN','sequelize','exports','variable','keyValue','picklist','STRING','customVariable'];(function(_0x314a0b,_0x25b08d){var _0x4b7590=function(_0x3370e4){while(--_0x3370e4){_0x314a0b['push'](_0x314a0b['shift']());}};_0x4b7590(++_0x25b08d);}(_0xf005,0xd1));var _0x5f00=function(_0xe21a74,_0xd19b1e){_0xe21a74=_0xe21a74-0x0;var _0x59e99a=_0xf005[_0xe21a74];return _0x59e99a;};'use strict';var Sequelize=require(_0x5f00('0x0'));module[_0x5f00('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5f00('0x2'),'customVariable',_0x5f00('0x3'),_0x5f00('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5f00('0x5')]},'key':{'type':Sequelize[_0x5f00('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x5f00('0x6'))},'keyContent':{'type':Sequelize[_0x5f00('0x5')]},'idField':{'type':Sequelize[_0x5f00('0x5')]},'nameField':{'type':Sequelize[_0x5f00('0x5')]},'customField':{'type':Sequelize[_0x5f00('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf5b=['keyValue','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xcf5b,0x193));var _0xbcf5=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xcf5b[_0x4409e7];return _0x24c751;};'use strict';var Sequelize=require(_0xbcf5('0x0'));module[_0xbcf5('0x1')]={'type':{'type':Sequelize[_0xbcf5('0x2')](_0xbcf5('0x3'),_0xbcf5('0x4'),'customVariable',_0xbcf5('0x5'),'picklist'),'defaultValue':_0xbcf5('0x3')},'content':{'type':Sequelize[_0xbcf5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbcf5('0x2')]('string',_0xbcf5('0x4'),_0xbcf5('0x7'))},'keyContent':{'type':Sequelize[_0xbcf5('0x6')]},'idField':{'type':Sequelize[_0xbcf5('0x6')]},'nameField':{'type':Sequelize[_0xbcf5('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 55f0652..abc6b23 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 _0x75ff=['mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','update','then','destroy','error','stack','name','send','map','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','FreshsalesField','findAll','rows','catch','show','keys','intersection','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x29092c,_0x1b1048){var _0x195cb3=function(_0x2409ef){while(--_0x2409ef){_0x29092c['push'](_0x29092c['shift']());}};_0x195cb3(++_0x1b1048);}(_0x75ff,0x1eb));var _0xf75f=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x75ff[_0x2642cb];return _0xe6e41;};'use strict';var emlformat=require(_0xf75f('0x0'));var rimraf=require(_0xf75f('0x1'));var zipdir=require(_0xf75f('0x2'));var jsonpatch=require(_0xf75f('0x3'));var rp=require('request-promise');var moment=require(_0xf75f('0x4'));var BPromise=require(_0xf75f('0x5'));var Mustache=require(_0xf75f('0x6'));var util=require(_0xf75f('0x7'));var path=require(_0xf75f('0x8'));var sox=require(_0xf75f('0x9'));var csv=require('to-csv');var ejs=require(_0xf75f('0xa'));var fs=require('fs');var fs_extra=require(_0xf75f('0xb'));var _=require('lodash');var squel=require(_0xf75f('0xc'));var crypto=require('crypto');var jsforce=require(_0xf75f('0xd'));var deskjs=require(_0xf75f('0xe'));var toCsv=require(_0xf75f('0xf'));var querystring=require(_0xf75f('0x10'));var Papa=require(_0xf75f('0x11'));var Redis=require('ioredis');var authService=require(_0xf75f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf75f('0x13'));var hardwareService=require(_0xf75f('0x14'));var logger=require(_0xf75f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf75f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf75f('0x17'))['db'];function respondWithStatusCode(_0x412f1f,_0x2a4dc5){_0x2a4dc5=_0x2a4dc5||0xcc;return function(_0x4f364a){if(_0x4f364a){return _0x412f1f['sendStatus'](_0x2a4dc5);}return _0x412f1f[_0xf75f('0x18')](_0x2a4dc5)[_0xf75f('0x19')]();};}function respondWithResult(_0x50191a,_0x3c50bc){_0x3c50bc=_0x3c50bc||0xc8;return function(_0x304444){if(_0x304444){return _0x50191a['status'](_0x3c50bc)['json'](_0x304444);}};}function respondWithFilteredResult(_0x554616,_0x1e75d5){return function(_0x454f33){if(_0x454f33){var _0x4554a5=typeof _0x1e75d5[_0xf75f('0x1a')]==='undefined'&&typeof _0x1e75d5[_0xf75f('0x1b')]===_0xf75f('0x1c');var _0x48d7da=_0x454f33[_0xf75f('0x1d')];var _0x2021a4=_0x4554a5?0x0:_0x1e75d5[_0xf75f('0x1a')];var _0x7175c1=_0x4554a5?_0x454f33[_0xf75f('0x1d')]:_0x1e75d5[_0xf75f('0x1a')]+_0x1e75d5[_0xf75f('0x1b')];var _0x43e5f0;if(_0x7175c1>=_0x48d7da){_0x7175c1=_0x48d7da;_0x43e5f0=0xc8;}else{_0x43e5f0=0xce;}_0x554616[_0xf75f('0x18')](_0x43e5f0);return _0x554616['set'](_0xf75f('0x1e'),_0x2021a4+'-'+_0x7175c1+'/'+_0x48d7da)[_0xf75f('0x1f')](_0x454f33);}return null;};}function patchUpdates(_0x4c5c80){return function(_0x135bae){try{jsonpatch['apply'](_0x135bae,_0x4c5c80,!![]);}catch(_0x52f191){return BPromise['reject'](_0x52f191);}return _0x135bae['save']();};}function saveUpdates(_0x29326e,_0x5b5555){return function(_0x3e4cb7){if(_0x3e4cb7){return _0x3e4cb7[_0xf75f('0x20')](_0x29326e)[_0xf75f('0x21')](function(_0x3474b1){return _0x3474b1;});}return null;};}function removeEntity(_0x40003c,_0x4a144a){return function(_0x2c3a9c){if(_0x2c3a9c){return _0x2c3a9c[_0xf75f('0x22')]()['then'](function(){_0x40003c[_0xf75f('0x18')](0xcc)[_0xf75f('0x19')]();});}};}function handleEntityNotFound(_0xd3960d,_0x47b7be){return function(_0x2a3077){if(!_0x2a3077){_0xd3960d['sendStatus'](0x194);}return _0x2a3077;};}function handleError(_0x4f6928,_0x3ca97b){_0x3ca97b=_0x3ca97b||0x1f4;return function(_0x3e96fd){logger[_0xf75f('0x23')](_0x3e96fd[_0xf75f('0x24')]);if(_0x3e96fd[_0xf75f('0x25')]){delete _0x3e96fd[_0xf75f('0x25')];}_0x4f6928[_0xf75f('0x18')](_0x3ca97b)[_0xf75f('0x26')](_0x3e96fd);};}exports['index']=function(_0xc06907,_0x25d3e1){var _0x256138={},_0x1c845a={},_0x2fbfde={'count':0x0,'rows':[]};var _0x59a390=_[_0xf75f('0x27')](db['FreshsalesField']['rawAttributes'],function(_0x2edf80){return{'name':_0x2edf80[_0xf75f('0x28')],'type':_0x2edf80[_0xf75f('0x29')]['key']};});_0x1c845a[_0xf75f('0x2a')]=_[_0xf75f('0x27')](_0x59a390,_0xf75f('0x25'));_0x1c845a[_0xf75f('0x2b')]=_['keys'](_0xc06907['query']);_0x1c845a[_0xf75f('0x2c')]=_['intersection'](_0x1c845a['model'],_0x1c845a[_0xf75f('0x2b')]);_0x256138[_0xf75f('0x2d')]=_['intersection'](_0x1c845a[_0xf75f('0x2a')],qs[_0xf75f('0x2e')](_0xc06907[_0xf75f('0x2b')][_0xf75f('0x2e')]));_0x256138[_0xf75f('0x2d')]=_0x256138['attributes']['length']?_0x256138['attributes']:_0x1c845a['model'];if(!_0xc06907[_0xf75f('0x2b')][_0xf75f('0x2f')](_0xf75f('0x30'))){_0x256138[_0xf75f('0x1b')]=qs[_0xf75f('0x1b')](_0xc06907[_0xf75f('0x2b')]['limit']);_0x256138['offset']=qs[_0xf75f('0x1a')](_0xc06907['query'][_0xf75f('0x1a')]);}_0x256138[_0xf75f('0x31')]=qs[_0xf75f('0x32')](_0xc06907['query'][_0xf75f('0x32')]);_0x256138['where']=qs[_0xf75f('0x2c')](_[_0xf75f('0x33')](_0xc06907[_0xf75f('0x2b')],_0x1c845a[_0xf75f('0x2c')]),_0x59a390);if(_0xc06907[_0xf75f('0x2b')]['filter']){_0x256138[_0xf75f('0x34')]=_[_0xf75f('0x35')](_0x256138['where'],{'$or':_[_0xf75f('0x27')](_0x59a390,function(_0x1dfc5e){if(_0x1dfc5e['type']!==_0xf75f('0x36')){var _0x51b4c7={};_0x51b4c7[_0x1dfc5e['name']]={'$like':'%'+_0xc06907[_0xf75f('0x2b')][_0xf75f('0x37')]+'%'};return _0x51b4c7;}})});}_0x256138=_[_0xf75f('0x35')]({},_0x256138,_0xc06907[_0xf75f('0x38')]);var _0xda2a03={'where':_0x256138['where']};return db['FreshsalesField']['count'](_0xda2a03)[_0xf75f('0x21')](function(_0x25de3f){_0x2fbfde[_0xf75f('0x1d')]=_0x25de3f;if(_0xc06907[_0xf75f('0x2b')][_0xf75f('0x39')]){_0x256138[_0xf75f('0x3a')]=[{'all':!![]}];}return db[_0xf75f('0x3b')][_0xf75f('0x3c')](_0x256138);})[_0xf75f('0x21')](function(_0x23c6f1){_0x2fbfde[_0xf75f('0x3d')]=_0x23c6f1;return _0x2fbfde;})[_0xf75f('0x21')](respondWithFilteredResult(_0x25d3e1,_0x256138))[_0xf75f('0x3e')](handleError(_0x25d3e1,null));};exports[_0xf75f('0x3f')]=function(_0x5ef55b,_0x5cffc7){var _0x14ce47={'raw':!![],'where':{'id':_0x5ef55b['params']['id']}},_0x53598e={};_0x53598e[_0xf75f('0x2a')]=_[_0xf75f('0x40')](db[_0xf75f('0x3b')]['rawAttributes']);_0x53598e['query']=_[_0xf75f('0x40')](_0x5ef55b['query']);_0x53598e['filters']=_[_0xf75f('0x41')](_0x53598e['model'],_0x53598e[_0xf75f('0x2b')]);_0x14ce47[_0xf75f('0x2d')]=_[_0xf75f('0x41')](_0x53598e[_0xf75f('0x2a')],qs[_0xf75f('0x2e')](_0x5ef55b[_0xf75f('0x2b')][_0xf75f('0x2e')]));_0x14ce47[_0xf75f('0x2d')]=_0x14ce47[_0xf75f('0x2d')][_0xf75f('0x42')]?_0x14ce47[_0xf75f('0x2d')]:_0x53598e[_0xf75f('0x2a')];if(_0x5ef55b['query'][_0xf75f('0x39')]){_0x14ce47[_0xf75f('0x3a')]=[{'all':!![]}];}_0x14ce47=_[_0xf75f('0x35')]({},_0x14ce47,_0x5ef55b[_0xf75f('0x38')]);return db[_0xf75f('0x3b')][_0xf75f('0x43')](_0x14ce47)[_0xf75f('0x21')](handleEntityNotFound(_0x5cffc7,null))['then'](respondWithResult(_0x5cffc7,null))[_0xf75f('0x3e')](handleError(_0x5cffc7,null));};exports[_0xf75f('0x44')]=function(_0x4c4871,_0x29f46d){return db[_0xf75f('0x3b')]['create'](_0x4c4871['body'],{})[_0xf75f('0x21')](respondWithResult(_0x29f46d,0xc9))[_0xf75f('0x3e')](handleError(_0x29f46d,null));};exports[_0xf75f('0x20')]=function(_0x4dc48c,_0x43ebdb){if(_0x4dc48c['body']['id']){delete _0x4dc48c[_0xf75f('0x45')]['id'];}return db[_0xf75f('0x3b')][_0xf75f('0x43')]({'where':{'id':_0x4dc48c[_0xf75f('0x46')]['id']}})[_0xf75f('0x21')](handleEntityNotFound(_0x43ebdb,null))['then'](saveUpdates(_0x4dc48c['body'],null))[_0xf75f('0x21')](respondWithResult(_0x43ebdb,null))[_0xf75f('0x3e')](handleError(_0x43ebdb,null));};exports[_0xf75f('0x22')]=function(_0x1e1e85,_0x2a0cf2){return db[_0xf75f('0x3b')][_0xf75f('0x43')]({'where':{'id':_0x1e1e85[_0xf75f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a0cf2,null))[_0xf75f('0x21')](removeEntity(_0x2a0cf2,null))['catch'](handleError(_0x2a0cf2,null));}; \ No newline at end of file +var _0x0e3a=['count','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','FreshsalesField','findAll','rows','show','keys','options','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x4553e8,_0x480e3c){var _0x99e41=function(_0x4cf964){while(--_0x4cf964){_0x4553e8['push'](_0x4553e8['shift']());}};_0x99e41(++_0x480e3c);}(_0x0e3a,0x144));var _0xa0e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0e3a[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa0e3('0x0'));var jsonpatch=require(_0xa0e3('0x1'));var rp=require(_0xa0e3('0x2'));var moment=require(_0xa0e3('0x3'));var BPromise=require(_0xa0e3('0x4'));var Mustache=require(_0xa0e3('0x5'));var util=require(_0xa0e3('0x6'));var path=require('path');var sox=require(_0xa0e3('0x7'));var csv=require(_0xa0e3('0x8'));var ejs=require(_0xa0e3('0x9'));var fs=require('fs');var fs_extra=require(_0xa0e3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa0e3('0xb'));var jsforce=require(_0xa0e3('0xc'));var deskjs=require(_0xa0e3('0xd'));var toCsv=require(_0xa0e3('0x8'));var querystring=require(_0xa0e3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa0e3('0xf'));var qs=require(_0xa0e3('0x10'));var as=require(_0xa0e3('0x11'));var hardwareService=require(_0xa0e3('0x12'));var logger=require(_0xa0e3('0x13'))(_0xa0e3('0x14'));var utils=require('../../config/utils');var config=require(_0xa0e3('0x15'));var licenseUtil=require(_0xa0e3('0x16'));var db=require(_0xa0e3('0x17'))['db'];function respondWithStatusCode(_0x535207,_0x7c5e17){_0x7c5e17=_0x7c5e17||0xcc;return function(_0x358f5c){if(_0x358f5c){return _0x535207[_0xa0e3('0x18')](_0x7c5e17);}return _0x535207[_0xa0e3('0x19')](_0x7c5e17)[_0xa0e3('0x1a')]();};}function respondWithResult(_0x4498f1,_0x564fa1){_0x564fa1=_0x564fa1||0xc8;return function(_0x2a175a){if(_0x2a175a){return _0x4498f1[_0xa0e3('0x19')](_0x564fa1)[_0xa0e3('0x1b')](_0x2a175a);}};}function respondWithFilteredResult(_0x133df3,_0x3bb176){return function(_0x4f3450){if(_0x4f3450){var _0x4eac62=typeof _0x3bb176[_0xa0e3('0x1c')]==='undefined'&&typeof _0x3bb176[_0xa0e3('0x1d')]===_0xa0e3('0x1e');var _0x14ba60=_0x4f3450['count'];var _0x4328fb=_0x4eac62?0x0:_0x3bb176['offset'];var _0x543272=_0x4eac62?_0x4f3450[_0xa0e3('0x1f')]:_0x3bb176['offset']+_0x3bb176['limit'];var _0xf2be10;if(_0x543272>=_0x14ba60){_0x543272=_0x14ba60;_0xf2be10=0xc8;}else{_0xf2be10=0xce;}_0x133df3['status'](_0xf2be10);return _0x133df3['set']('Content-Range',_0x4328fb+'-'+_0x543272+'/'+_0x14ba60)[_0xa0e3('0x1b')](_0x4f3450);}return null;};}function patchUpdates(_0xaf9e15){return function(_0x18e774){try{jsonpatch['apply'](_0x18e774,_0xaf9e15,!![]);}catch(_0x37bc98){return BPromise[_0xa0e3('0x20')](_0x37bc98);}return _0x18e774['save']();};}function saveUpdates(_0x37828f,_0x5927de){return function(_0x2ee5dc){if(_0x2ee5dc){return _0x2ee5dc[_0xa0e3('0x21')](_0x37828f)[_0xa0e3('0x22')](function(_0x2fe8bd){return _0x2fe8bd;});}return null;};}function removeEntity(_0x84b0de,_0x2a3730){return function(_0x309076){if(_0x309076){return _0x309076[_0xa0e3('0x23')]()[_0xa0e3('0x22')](function(){_0x84b0de[_0xa0e3('0x19')](0xcc)[_0xa0e3('0x1a')]();});}};}function handleEntityNotFound(_0x2d01ca,_0x42a176){return function(_0x1c1308){if(!_0x1c1308){_0x2d01ca[_0xa0e3('0x18')](0x194);}return _0x1c1308;};}function handleError(_0x226b20,_0x5a2653){_0x5a2653=_0x5a2653||0x1f4;return function(_0x327c4d){logger[_0xa0e3('0x24')](_0x327c4d[_0xa0e3('0x25')]);if(_0x327c4d[_0xa0e3('0x26')]){delete _0x327c4d[_0xa0e3('0x26')];}_0x226b20[_0xa0e3('0x19')](_0x5a2653)[_0xa0e3('0x27')](_0x327c4d);};}exports['index']=function(_0x586a2a,_0x30ee0f){var _0x22eccb={},_0x5b6ec5={},_0x5bf83e={'count':0x0,'rows':[]};var _0x1b1238=_[_0xa0e3('0x28')](db['FreshsalesField'][_0xa0e3('0x29')],function(_0x5605cc){return{'name':_0x5605cc['fieldName'],'type':_0x5605cc[_0xa0e3('0x2a')]['key']};});_0x5b6ec5[_0xa0e3('0x2b')]=_[_0xa0e3('0x28')](_0x1b1238,_0xa0e3('0x26'));_0x5b6ec5[_0xa0e3('0x2c')]=_['keys'](_0x586a2a[_0xa0e3('0x2c')]);_0x5b6ec5[_0xa0e3('0x2d')]=_[_0xa0e3('0x2e')](_0x5b6ec5[_0xa0e3('0x2b')],_0x5b6ec5[_0xa0e3('0x2c')]);_0x22eccb['attributes']=_[_0xa0e3('0x2e')](_0x5b6ec5['model'],qs[_0xa0e3('0x2f')](_0x586a2a['query'][_0xa0e3('0x2f')]));_0x22eccb[_0xa0e3('0x30')]=_0x22eccb[_0xa0e3('0x30')][_0xa0e3('0x31')]?_0x22eccb[_0xa0e3('0x30')]:_0x5b6ec5[_0xa0e3('0x2b')];if(!_0x586a2a['query'][_0xa0e3('0x32')](_0xa0e3('0x33'))){_0x22eccb[_0xa0e3('0x1d')]=qs[_0xa0e3('0x1d')](_0x586a2a[_0xa0e3('0x2c')][_0xa0e3('0x1d')]);_0x22eccb['offset']=qs[_0xa0e3('0x1c')](_0x586a2a[_0xa0e3('0x2c')]['offset']);}_0x22eccb[_0xa0e3('0x34')]=qs[_0xa0e3('0x35')](_0x586a2a[_0xa0e3('0x2c')][_0xa0e3('0x35')]);_0x22eccb[_0xa0e3('0x36')]=qs[_0xa0e3('0x2d')](_[_0xa0e3('0x37')](_0x586a2a[_0xa0e3('0x2c')],_0x5b6ec5['filters']),_0x1b1238);if(_0x586a2a['query'][_0xa0e3('0x38')]){_0x22eccb[_0xa0e3('0x36')]=_[_0xa0e3('0x39')](_0x22eccb[_0xa0e3('0x36')],{'$or':_[_0xa0e3('0x28')](_0x1b1238,function(_0xf567af){if(_0xf567af['type']!=='VIRTUAL'){var _0x2d32cb={};_0x2d32cb[_0xf567af['name']]={'$like':'%'+_0x586a2a[_0xa0e3('0x2c')][_0xa0e3('0x38')]+'%'};return _0x2d32cb;}})});}_0x22eccb=_[_0xa0e3('0x39')]({},_0x22eccb,_0x586a2a['options']);var _0x1670a2={'where':_0x22eccb[_0xa0e3('0x36')]};return db['FreshsalesField']['count'](_0x1670a2)['then'](function(_0xd9443e){_0x5bf83e[_0xa0e3('0x1f')]=_0xd9443e;if(_0x586a2a['query'][_0xa0e3('0x3a')]){_0x22eccb[_0xa0e3('0x3b')]=[{'all':!![]}];}return db[_0xa0e3('0x3c')][_0xa0e3('0x3d')](_0x22eccb);})['then'](function(_0x1df4c2){_0x5bf83e[_0xa0e3('0x3e')]=_0x1df4c2;return _0x5bf83e;})[_0xa0e3('0x22')](respondWithFilteredResult(_0x30ee0f,_0x22eccb))['catch'](handleError(_0x30ee0f,null));};exports[_0xa0e3('0x3f')]=function(_0x277b01,_0x49b5f3){var _0x4e6c1f={'raw':!![],'where':{'id':_0x277b01['params']['id']}},_0x2f3a70={};_0x2f3a70[_0xa0e3('0x2b')]=_[_0xa0e3('0x40')](db['FreshsalesField']['rawAttributes']);_0x2f3a70[_0xa0e3('0x2c')]=_[_0xa0e3('0x40')](_0x277b01[_0xa0e3('0x2c')]);_0x2f3a70[_0xa0e3('0x2d')]=_[_0xa0e3('0x2e')](_0x2f3a70['model'],_0x2f3a70['query']);_0x4e6c1f[_0xa0e3('0x30')]=_['intersection'](_0x2f3a70['model'],qs['fields'](_0x277b01[_0xa0e3('0x2c')][_0xa0e3('0x2f')]));_0x4e6c1f[_0xa0e3('0x30')]=_0x4e6c1f[_0xa0e3('0x30')][_0xa0e3('0x31')]?_0x4e6c1f['attributes']:_0x2f3a70[_0xa0e3('0x2b')];if(_0x277b01[_0xa0e3('0x2c')]['includeAll']){_0x4e6c1f[_0xa0e3('0x3b')]=[{'all':!![]}];}_0x4e6c1f=_[_0xa0e3('0x39')]({},_0x4e6c1f,_0x277b01[_0xa0e3('0x41')]);return db[_0xa0e3('0x3c')][_0xa0e3('0x42')](_0x4e6c1f)[_0xa0e3('0x22')](handleEntityNotFound(_0x49b5f3,null))['then'](respondWithResult(_0x49b5f3,null))[_0xa0e3('0x43')](handleError(_0x49b5f3,null));};exports[_0xa0e3('0x44')]=function(_0x18c107,_0x2c236a){return db[_0xa0e3('0x3c')][_0xa0e3('0x44')](_0x18c107[_0xa0e3('0x45')],{})[_0xa0e3('0x22')](respondWithResult(_0x2c236a,0xc9))[_0xa0e3('0x43')](handleError(_0x2c236a,null));};exports[_0xa0e3('0x21')]=function(_0x2299d3,_0x288d00){if(_0x2299d3[_0xa0e3('0x45')]['id']){delete _0x2299d3[_0xa0e3('0x45')]['id'];}return db[_0xa0e3('0x3c')][_0xa0e3('0x42')]({'where':{'id':_0x2299d3['params']['id']}})[_0xa0e3('0x22')](handleEntityNotFound(_0x288d00,null))[_0xa0e3('0x22')](saveUpdates(_0x2299d3[_0xa0e3('0x45')],null))[_0xa0e3('0x22')](respondWithResult(_0x288d00,null))[_0xa0e3('0x43')](handleError(_0x288d00,null));};exports[_0xa0e3('0x23')]=function(_0x3df6de,_0x364a51){return db[_0xa0e3('0x3c')][_0xa0e3('0x42')]({'where':{'id':_0x3df6de[_0xa0e3('0x46')]['id']}})[_0xa0e3('0x22')](handleEntityNotFound(_0x364a51,null))['then'](removeEntity(_0x364a51,null))[_0xa0e3('0x43')](handleError(_0x364a51,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1cbf183..047cb89 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 _0x1d21=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash'];(function(_0x3f829f,_0x4565dc){var _0x577851=function(_0x571c05){while(--_0x571c05){_0x3f829f['push'](_0x3f829f['shift']());}};_0x577851(++_0x4565dc);}(_0x1d21,0x158));var _0x11d2=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x1d21[_0x12d812];return _0x3711ab;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x11d2('0xd'),_0x11d2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcefd=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField','FieldId'];(function(_0x52a20c,_0x49abc5){var _0x36861b=function(_0x53db18){while(--_0x53db18){_0x52a20c['push'](_0x52a20c['shift']());}};_0x36861b(++_0x49abc5);}(_0xcefd,0x126));var _0xdcef=function(_0xf5bda0,_0x2589e1){_0xf5bda0=_0xf5bda0-0x0;var _0x5303cb=_0xcefd[_0xf5bda0];return _0x5303cb;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var logger=require(_0xdcef('0x2'))('api');var moment=require(_0xdcef('0x3'));var BPromise=require(_0xdcef('0x4'));var rp=require(_0xdcef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var attributes=require(_0xdcef('0x8'));module['exports']=function(_0x2043a4,_0xcaa40a){return _0x2043a4[_0xdcef('0x9')](_0xdcef('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xdcef('0xb'),'fields':[_0xdcef('0xc'),_0xdcef('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 664243f..bb1f40b 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5d0912,_0x5a54cf){var _0x3ab6d=function(_0x505055){while(--_0x505055){_0x5d0912['push'](_0x5d0912['shift']());}};_0x3ab6d(++_0x5a54cf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x2d2f17,_0x2bd8a9){var _0x5a49ae=function(_0x1383d2){while(--_0x1383d2){_0x2d2f17['push'](_0x2d2f17['shift']());}};_0x5a49ae(++_0x2bd8a9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x182e68,_0x142bd9){_0x182e68=_0x182e68-0x0;var _0x45fc54=_0xd8fb[_0x182e68];return _0x45fc54;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ca9d73b..f057588 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5d5f7d,_0x1d9a54){var _0x2dd0d7=function(_0x1766d5){while(--_0x1766d5){_0x5d5f7d['push'](_0x5d5f7d['shift']());}};_0x2dd0d7(++_0x1d9a54);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1d6899,_0x3b3051){var _0x5d0f3f=function(_0x2a099b){while(--_0x2a099b){_0x1d6899['push'](_0x1d6899['shift']());}};_0x5d0f3f(++_0x3b3051);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0e4bbd9..6b7a196 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 _0xaa64=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x441d62,_0x3188f3){var _0x2099f0=function(_0x1df0d8){while(--_0x1df0d8){_0x441d62['push'](_0x441d62['shift']());}};_0x2099f0(++_0x3188f3);}(_0xaa64,0xf7));var _0x4aa6=function(_0x7f3b5f,_0xfe3d68){_0x7f3b5f=_0x7f3b5f-0x0;var _0x4d03cf=_0xaa64[_0x7f3b5f];return _0x4d03cf;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4aa6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4aa6('0x3')},'remoteUri':{'type':Sequelize[_0x4aa6('0x2')]},'password':{'type':Sequelize[_0x4aa6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4aa6('0x2')]},'securityToken':{'type':Sequelize[_0x4aa6('0x2')]},'serverUrl':{'type':Sequelize[_0x4aa6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4aa6('0x4')](_0x4aa6('0x5'),_0x4aa6('0x6')),'defaultValue':_0x4aa6('0x5')}}; \ No newline at end of file +var _0xb955=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb955,0x123));var _0x5b95=function(_0x4dc52b,_0x23f3cd){_0x4dc52b=_0x4dc52b-0x0;var _0x49d27d=_0xb955[_0x4dc52b];return _0x49d27d;};'use strict';var Sequelize=require(_0x5b95('0x0'));module[_0x5b95('0x1')]={'name':{'type':Sequelize[_0x5b95('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x5b95('0x3')},'remoteUri':{'type':Sequelize[_0x5b95('0x2')]},'password':{'type':Sequelize[_0x5b95('0x2')]},'clientId':{'type':Sequelize[_0x5b95('0x2')]},'clientSecret':{'type':Sequelize[_0x5b95('0x2')]},'securityToken':{'type':Sequelize[_0x5b95('0x2')]},'serverUrl':{'type':Sequelize[_0x5b95('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5b95('0x4')](_0x5b95('0x5'),_0x5b95('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 fea6c03..ff5b94d 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 _0xc4cb=['getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Task','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','clientId','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','statusCode','getFields','stringify','send','test','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','index','map','SalesforceAccount','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','getConfigurations','filter','hasOwnProperty','addConfiguration','findOne','Subjects'];(function(_0xfe69b5,_0x3eae9f){var _0x5867ea=function(_0x4cb5cc){while(--_0x4cb5cc){_0xfe69b5['push'](_0xfe69b5['shift']());}};_0x5867ea(++_0x3eae9f);}(_0xc4cb,0x11b));var _0xbc4c=function(_0x59c86e,_0x38ce57){_0x59c86e=_0x59c86e-0x0;var _0x48a50e=_0xc4cb[_0x59c86e];return _0x48a50e;};'use strict';var emlformat=require(_0xbc4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc4c('0x2'));var moment=require(_0xbc4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbc4c('0x4'));var util=require(_0xbc4c('0x5'));var path=require('path');var sox=require(_0xbc4c('0x6'));var csv=require(_0xbc4c('0x7'));var ejs=require(_0xbc4c('0x8'));var fs=require('fs');var fs_extra=require(_0xbc4c('0x9'));var _=require(_0xbc4c('0xa'));var squel=require(_0xbc4c('0xb'));var crypto=require(_0xbc4c('0xc'));var jsforce=require(_0xbc4c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbc4c('0x7'));var querystring=require('querystring');var Papa=require(_0xbc4c('0xe'));var Redis=require(_0xbc4c('0xf'));var authService=require(_0xbc4c('0x10'));var qs=require(_0xbc4c('0x11'));var as=require(_0xbc4c('0x12'));var hardwareService=require(_0xbc4c('0x13'));var logger=require('../../config/logger')(_0xbc4c('0x14'));var utils=require(_0xbc4c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x601345,_0x2226cc){_0x2226cc=_0x2226cc||0xcc;return function(_0x4508fa){if(_0x4508fa){return _0x601345['sendStatus'](_0x2226cc);}return _0x601345['status'](_0x2226cc)[_0xbc4c('0x16')]();};}function respondWithResult(_0x1d7bd1,_0x3e38fb){_0x3e38fb=_0x3e38fb||0xc8;return function(_0x3bf338){if(_0x3bf338){return _0x1d7bd1[_0xbc4c('0x17')](_0x3e38fb)['json'](_0x3bf338);}};}function respondWithFilteredResult(_0xd54b36,_0x39f522){return function(_0x34931a){if(_0x34931a){var _0x54c743=typeof _0x39f522[_0xbc4c('0x18')]===_0xbc4c('0x19')&&typeof _0x39f522[_0xbc4c('0x1a')]===_0xbc4c('0x19');var _0x46f3f6=_0x34931a[_0xbc4c('0x1b')];var _0x3aef7f=_0x54c743?0x0:_0x39f522[_0xbc4c('0x18')];var _0x1228f7=_0x54c743?_0x34931a['count']:_0x39f522[_0xbc4c('0x18')]+_0x39f522[_0xbc4c('0x1a')];var _0x3fe136;if(_0x1228f7>=_0x46f3f6){_0x1228f7=_0x46f3f6;_0x3fe136=0xc8;}else{_0x3fe136=0xce;}_0xd54b36['status'](_0x3fe136);return _0xd54b36[_0xbc4c('0x1c')](_0xbc4c('0x1d'),_0x3aef7f+'-'+_0x1228f7+'/'+_0x46f3f6)['json'](_0x34931a);}return null;};}function patchUpdates(_0x1b5d6d){return function(_0x4e3f3a){try{jsonpatch[_0xbc4c('0x1e')](_0x4e3f3a,_0x1b5d6d,!![]);}catch(_0x2dd1f2){return BPromise[_0xbc4c('0x1f')](_0x2dd1f2);}return _0x4e3f3a[_0xbc4c('0x20')]();};}function saveUpdates(_0x43a87f,_0x58608f){return function(_0x2938b3){if(_0x2938b3){return _0x2938b3[_0xbc4c('0x21')](_0x43a87f)[_0xbc4c('0x22')](function(_0x17b6fe){return _0x17b6fe;});}return null;};}function removeEntity(_0x3b38ae,_0x39ca60){return function(_0x5c8fcb){if(_0x5c8fcb){return _0x5c8fcb['destroy']()[_0xbc4c('0x22')](function(){_0x3b38ae['status'](0xcc)[_0xbc4c('0x16')]();});}};}function handleEntityNotFound(_0x4f094e,_0x55e8e3){return function(_0x3a3057){if(!_0x3a3057){_0x4f094e[_0xbc4c('0x23')](0x194);}return _0x3a3057;};}function handleError(_0x1f322b,_0x16f327){_0x16f327=_0x16f327||0x1f4;return function(_0x38a5e4){logger[_0xbc4c('0x24')](_0x38a5e4['stack']);if(_0x38a5e4['name']){delete _0x38a5e4['name'];}_0x1f322b[_0xbc4c('0x17')](_0x16f327)['send'](_0x38a5e4);};}exports[_0xbc4c('0x25')]=function(_0x5002dc,_0x2cdde2){var _0x58a7a7={},_0x3e6525={},_0x35c781={'count':0x0,'rows':[]};var _0x4fe23e=_[_0xbc4c('0x26')](db[_0xbc4c('0x27')]['rawAttributes'],function(_0x1e5df5){return{'name':_0x1e5df5[_0xbc4c('0x28')],'type':_0x1e5df5['type'][_0xbc4c('0x29')]};});_0x3e6525[_0xbc4c('0x2a')]=_[_0xbc4c('0x26')](_0x4fe23e,_0xbc4c('0x2b'));_0x3e6525['query']=_['keys'](_0x5002dc[_0xbc4c('0x2c')]);_0x3e6525[_0xbc4c('0x2d')]=_[_0xbc4c('0x2e')](_0x3e6525[_0xbc4c('0x2a')],_0x3e6525[_0xbc4c('0x2c')]);_0x58a7a7[_0xbc4c('0x2f')]=_[_0xbc4c('0x2e')](_0x3e6525[_0xbc4c('0x2a')],qs[_0xbc4c('0x30')](_0x5002dc[_0xbc4c('0x2c')][_0xbc4c('0x30')]));_0x58a7a7[_0xbc4c('0x2f')]=_0x58a7a7[_0xbc4c('0x2f')][_0xbc4c('0x31')]?_0x58a7a7[_0xbc4c('0x2f')]:_0x3e6525[_0xbc4c('0x2a')];if(!_0x5002dc[_0xbc4c('0x2c')]['hasOwnProperty'](_0xbc4c('0x32'))){_0x58a7a7['limit']=qs[_0xbc4c('0x1a')](_0x5002dc[_0xbc4c('0x2c')][_0xbc4c('0x1a')]);_0x58a7a7['offset']=qs[_0xbc4c('0x18')](_0x5002dc[_0xbc4c('0x2c')][_0xbc4c('0x18')]);}_0x58a7a7[_0xbc4c('0x33')]=qs[_0xbc4c('0x34')](_0x5002dc['query'][_0xbc4c('0x34')]);_0x58a7a7[_0xbc4c('0x35')]=qs[_0xbc4c('0x2d')](_[_0xbc4c('0x36')](_0x5002dc['query'],_0x3e6525[_0xbc4c('0x2d')]),_0x4fe23e);if(_0x5002dc['query']['filter']){_0x58a7a7[_0xbc4c('0x35')]=_[_0xbc4c('0x37')](_0x58a7a7[_0xbc4c('0x35')],{'$or':_[_0xbc4c('0x26')](_0x4fe23e,function(_0x3f34dc){if(_0x3f34dc[_0xbc4c('0x38')]!==_0xbc4c('0x39')){var _0x2ff760={};_0x2ff760[_0x3f34dc[_0xbc4c('0x2b')]]={'$like':'%'+_0x5002dc['query']['filter']+'%'};return _0x2ff760;}})});}_0x58a7a7=_[_0xbc4c('0x37')]({},_0x58a7a7,_0x5002dc[_0xbc4c('0x3a')]);var _0xaab1a9={'where':_0x58a7a7['where']};return db['SalesforceAccount']['count'](_0xaab1a9)[_0xbc4c('0x22')](function(_0x36b911){_0x35c781[_0xbc4c('0x1b')]=_0x36b911;if(_0x5002dc['query'][_0xbc4c('0x3b')]){_0x58a7a7['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xbc4c('0x3c')](_0x58a7a7);})[_0xbc4c('0x22')](function(_0x1aedcb){_0x35c781[_0xbc4c('0x3d')]=_0x1aedcb;return _0x35c781;})[_0xbc4c('0x22')](respondWithFilteredResult(_0x2cdde2,_0x58a7a7))[_0xbc4c('0x3e')](handleError(_0x2cdde2,null));};exports[_0xbc4c('0x3f')]=function(_0x54af92,_0xf4292b){var _0x249c22={'raw':![],'where':{'id':_0x54af92['params']['id']}},_0x455270={};_0x455270[_0xbc4c('0x2a')]=_[_0xbc4c('0x40')](db[_0xbc4c('0x27')][_0xbc4c('0x41')]);_0x455270[_0xbc4c('0x2c')]=_[_0xbc4c('0x40')](_0x54af92['query']);_0x455270[_0xbc4c('0x2d')]=_[_0xbc4c('0x2e')](_0x455270[_0xbc4c('0x2a')],_0x455270[_0xbc4c('0x2c')]);_0x249c22[_0xbc4c('0x2f')]=_[_0xbc4c('0x2e')](_0x455270[_0xbc4c('0x2a')],qs[_0xbc4c('0x30')](_0x54af92[_0xbc4c('0x2c')]['fields']));_0x249c22[_0xbc4c('0x2f')]=_0x249c22['attributes'][_0xbc4c('0x31')]?_0x249c22[_0xbc4c('0x2f')]:_0x455270[_0xbc4c('0x2a')];if(_0x54af92[_0xbc4c('0x2c')][_0xbc4c('0x3b')]){_0x249c22[_0xbc4c('0x42')]=[{'all':!![]}];}_0x249c22=_['merge']({},_0x249c22,_0x54af92[_0xbc4c('0x3a')]);return db[_0xbc4c('0x27')][_0xbc4c('0x43')](_0x249c22)['then'](handleEntityNotFound(_0xf4292b,null))[_0xbc4c('0x22')](respondWithResult(_0xf4292b,null))[_0xbc4c('0x3e')](handleError(_0xf4292b,null));};exports[_0xbc4c('0x44')]=function(_0x10d51a,_0x1f95c0){return db[_0xbc4c('0x27')][_0xbc4c('0x44')](_0x10d51a[_0xbc4c('0x45')],{})[_0xbc4c('0x22')](respondWithResult(_0x1f95c0,0xc9))[_0xbc4c('0x3e')](handleError(_0x1f95c0,null));};exports[_0xbc4c('0x21')]=function(_0x4afc43,_0x4d7a99){if(_0x4afc43[_0xbc4c('0x45')]['id']){delete _0x4afc43[_0xbc4c('0x45')]['id'];}return db[_0xbc4c('0x27')]['find']({'where':{'id':_0x4afc43[_0xbc4c('0x46')]['id']}})[_0xbc4c('0x22')](handleEntityNotFound(_0x4d7a99,null))['then'](saveUpdates(_0x4afc43[_0xbc4c('0x45')],null))[_0xbc4c('0x22')](respondWithResult(_0x4d7a99,null))[_0xbc4c('0x3e')](handleError(_0x4d7a99,null));};exports['destroy']=function(_0xde1d4e,_0x2f7089){return db[_0xbc4c('0x27')][_0xbc4c('0x43')]({'where':{'id':_0xde1d4e[_0xbc4c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f7089,null))[_0xbc4c('0x22')](removeEntity(_0x2f7089,null))[_0xbc4c('0x3e')](handleError(_0x2f7089,null));};exports[_0xbc4c('0x47')]=function(_0x4c8c6c,_0x283d8b,_0x48242a){var _0xfe4866={};var _0x14a866={};var _0x6a445e;var _0x1d8754;return db['SalesforceAccount']['findOne']({'where':{'id':_0x4c8c6c[_0xbc4c('0x46')]['id']}})[_0xbc4c('0x22')](handleEntityNotFound(_0x283d8b,null))[_0xbc4c('0x22')](function(_0x214f1d){if(_0x214f1d){_0x6a445e=_0x214f1d;_0x14a866['model']=_[_0xbc4c('0x40')](db['SalesforceConfiguration']['rawAttributes']);_0x14a866[_0xbc4c('0x2c')]=_[_0xbc4c('0x40')](_0x4c8c6c[_0xbc4c('0x2c')]);_0x14a866[_0xbc4c('0x2d')]=_[_0xbc4c('0x2e')](_0x14a866['model'],_0x14a866[_0xbc4c('0x2c')]);_0xfe4866[_0xbc4c('0x2f')]=_['intersection'](_0x14a866[_0xbc4c('0x2a')],qs[_0xbc4c('0x30')](_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x30')]));_0xfe4866[_0xbc4c('0x2f')]=_0xfe4866['attributes'][_0xbc4c('0x31')]?_0xfe4866['attributes']:_0x14a866[_0xbc4c('0x2a')];_0xfe4866[_0xbc4c('0x33')]=qs['sort'](_0x4c8c6c['query'][_0xbc4c('0x34')]);_0xfe4866[_0xbc4c('0x35')]=qs[_0xbc4c('0x2d')](_[_0xbc4c('0x36')](_0x4c8c6c[_0xbc4c('0x2c')],_0x14a866[_0xbc4c('0x2d')]));if(_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x48')]){_0xfe4866[_0xbc4c('0x35')]=_[_0xbc4c('0x37')](_0xfe4866[_0xbc4c('0x35')],{'$or':_[_0xbc4c('0x26')](_0xfe4866['attributes'],function(_0x197ddf){var _0x47995e={};_0x47995e[_0x197ddf]={'$like':'%'+_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x48')]+'%'};return _0x47995e;})});}_0xfe4866=_[_0xbc4c('0x37')]({},_0xfe4866,_0x4c8c6c['options']);return _0x6a445e[_0xbc4c('0x47')](_0xfe4866);}})['then'](function(_0x5acda8){if(_0x5acda8){_0x1d8754=_0x5acda8[_0xbc4c('0x31')];if(!_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x49')](_0xbc4c('0x32'))){_0xfe4866[_0xbc4c('0x1a')]=qs[_0xbc4c('0x1a')](_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x1a')]);_0xfe4866[_0xbc4c('0x18')]=qs[_0xbc4c('0x18')](_0x4c8c6c[_0xbc4c('0x2c')][_0xbc4c('0x18')]);}return _0x6a445e[_0xbc4c('0x47')](_0xfe4866);}})[_0xbc4c('0x22')](function(_0x54ba13){if(_0x54ba13){return _0x54ba13?{'count':_0x1d8754,'rows':_0x54ba13}:null;}})[_0xbc4c('0x22')](respondWithResult(_0x283d8b,null))[_0xbc4c('0x3e')](handleError(_0x283d8b,null));};exports[_0xbc4c('0x4a')]=function(_0x1108bc,_0x5e5e29,_0x1ffabc){if(_0x1108bc['body']['id']){delete _0x1108bc[_0xbc4c('0x45')]['id'];}return db[_0xbc4c('0x27')][_0xbc4c('0x4b')]({'where':{'id':_0x1108bc['params']['id']}})[_0xbc4c('0x22')](handleEntityNotFound(_0x5e5e29,null))[_0xbc4c('0x22')](function(_0x1c38ee){if(_0x1c38ee){_0x1108bc['body']['AccountId']=_0x1c38ee['id'];_0x1108bc[_0xbc4c('0x45')][_0xbc4c('0x4c')]=integrations[_0xbc4c('0x4d')](_0x1108bc['body'][_0xbc4c('0x4e')],_0x1108bc['body']['type']);_0x1108bc[_0xbc4c('0x45')][_0xbc4c('0x4f')]=integrations[_0xbc4c('0x50')](_0x1108bc[_0xbc4c('0x45')][_0xbc4c('0x4e')],_0x1108bc[_0xbc4c('0x45')][_0xbc4c('0x38')]);return db[_0xbc4c('0x51')][_0xbc4c('0x44')](_0x1108bc[_0xbc4c('0x45')],{'include':[{'model':db[_0xbc4c('0x52')],'as':_0xbc4c('0x4c')},{'model':db[_0xbc4c('0x52')],'as':'Descriptions'}]});}return null;})[_0xbc4c('0x22')](respondWithResult(_0x5e5e29,null))[_0xbc4c('0x3e')](handleError(_0x5e5e29,null));};exports['getFields']=function(_0x300432,_0x5cb182,_0x5836b6){var _0x135734;var _0x491ec8='';var _0x16c7e2=_0xbc4c('0x53');return db[_0xbc4c('0x27')][_0xbc4c('0x4b')]({'where':{'id':_0x300432[_0xbc4c('0x46')]['id']},'attributes':['id','remoteUri','clientId',_0xbc4c('0x54'),_0xbc4c('0x55'),_0xbc4c('0x56'),'securityToken']})[_0xbc4c('0x22')](handleEntityNotFound(_0x5cb182,null))['then'](function(_0x123301){if(_0x123301){_0x491ec8=_0x123301[_0xbc4c('0x57')];var _0x253399=_0x491ec8[_0xbc4c('0x58')](-0x1);if(_0x253399==='/'){_0x491ec8=_0x491ec8[_0xbc4c('0x59')](0x0,_0x491ec8[_0xbc4c('0x5a')](_0x253399));}_0x135734=new jsforce['Connection']({'oauth2':{'loginUrl':_0x491ec8,'clientId':_0x123301[_0xbc4c('0x5b')],'clientSecret':_0x123301[_0xbc4c('0x54')]}});return _0x135734[_0xbc4c('0x5c')](_0x123301['username'],_0x123301[_0xbc4c('0x56')][_0xbc4c('0x5d')](_0x123301['securityToken']));}})[_0xbc4c('0x22')](function(_0x3fa72a){if(_0x3fa72a){if(!_[_0xbc4c('0x5e')](_0x300432['query'][_0xbc4c('0x5f')])){_0x16c7e2=_0x300432['query'][_0xbc4c('0x5f')];}return _0x135734[_0xbc4c('0x60')](_0x16c7e2)[_0xbc4c('0x61')]();}})[_0xbc4c('0x22')](function(_0x52fa99){var _0x4cd548=[_0xbc4c('0x62'),'ActivityDate',_0xbc4c('0x63'),'IsRecurrence',_0xbc4c('0x64'),'Description'];var _0x5094fd=['string',_0xbc4c('0x65'),_0xbc4c('0x66'),_0xbc4c('0x67'),'email',_0xbc4c('0x68'),_0xbc4c('0x69')];if(_0x52fa99){_[_0xbc4c('0x6a')](_0x52fa99['fields'],function(_0x160557){return _0x4cd548[_0xbc4c('0x6b')](_0x160557['name'])||!_0x5094fd[_0xbc4c('0x6b')](_0x160557[_0xbc4c('0x38')]);});return{'count':_0x52fa99[_0xbc4c('0x30')]['length'],'rows':_['map'](_0x52fa99[_0xbc4c('0x30')],function(_0x5837b0){return{'id':_0x5837b0[_0xbc4c('0x2b')],'name':_0x5837b0[_0xbc4c('0x6c')],'custom':_0x5837b0[_0xbc4c('0x6d')],'options':_0x5837b0[_0xbc4c('0x6e')]['length']>0x0?_[_0xbc4c('0x26')](_0x5837b0[_0xbc4c('0x6e')],function(_0x2ace03){return{'name':_0x2ace03[_0xbc4c('0x6c')],'value':_0x2ace03['value']};}):_0x5837b0[_0xbc4c('0x38')]=='boolean'?[{'name':_0xbc4c('0x6f'),'value':_0xbc4c('0x70')},{'name':_0xbc4c('0x71'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x5cb182,null))[_0xbc4c('0x3e')](function(_0x50fd90){var _0x3f365e=_0x300432[_0xbc4c('0x2c')]['test']?0x1f4:_0x50fd90[_0xbc4c('0x72')]||0x1f4;logger[_0xbc4c('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xbc4c('0x73'),_0x3f365e,JSON[_0xbc4c('0x74')](_0x50fd90));delete _0x50fd90[_0xbc4c('0x2b')];if(_0x3f365e===0x191){_0x3f365e=0x190;}_0x5cb182[_0xbc4c('0x17')](_0x3f365e)[_0xbc4c('0x75')](_0x300432[_0xbc4c('0x2c')][_0xbc4c('0x76')]?{'message':_0xbc4c('0x77'),'statusCode':_0x50fd90[_0xbc4c('0x72')]}:_0x50fd90);});}; \ No newline at end of file +var _0x7cd8=['SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','findOne'];(function(_0x311d94,_0x1d006f){var _0x338cb9=function(_0x49c56f){while(--_0x49c56f){_0x311d94['push'](_0x311d94['shift']());}};_0x338cb9(++_0x1d006f);}(_0x7cd8,0x143));var _0x87cd=function(_0x5116ab,_0x27a62a){_0x5116ab=_0x5116ab-0x0;var _0x13c0aa=_0x7cd8[_0x5116ab];return _0x13c0aa;};'use strict';var emlformat=require(_0x87cd('0x0'));var rimraf=require(_0x87cd('0x1'));var zipdir=require(_0x87cd('0x2'));var jsonpatch=require(_0x87cd('0x3'));var rp=require('request-promise');var moment=require(_0x87cd('0x4'));var BPromise=require(_0x87cd('0x5'));var Mustache=require('mustache');var util=require(_0x87cd('0x6'));var path=require(_0x87cd('0x7'));var sox=require(_0x87cd('0x8'));var csv=require(_0x87cd('0x9'));var ejs=require(_0x87cd('0xa'));var fs=require('fs');var fs_extra=require(_0x87cd('0xb'));var _=require(_0x87cd('0xc'));var squel=require(_0x87cd('0xd'));var crypto=require(_0x87cd('0xe'));var jsforce=require(_0x87cd('0xf'));var deskjs=require(_0x87cd('0x10'));var toCsv=require(_0x87cd('0x9'));var querystring=require(_0x87cd('0x11'));var Papa=require(_0x87cd('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x87cd('0x13'));var as=require(_0x87cd('0x14'));var hardwareService=require(_0x87cd('0x15'));var logger=require('../../config/logger')(_0x87cd('0x16'));var utils=require('../../config/utils');var config=require(_0x87cd('0x17'));var licenseUtil=require(_0x87cd('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x87cd('0x19'));function respondWithStatusCode(_0x280338,_0x328b0e){_0x328b0e=_0x328b0e||0xcc;return function(_0x131e60){if(_0x131e60){return _0x280338[_0x87cd('0x1a')](_0x328b0e);}return _0x280338['status'](_0x328b0e)[_0x87cd('0x1b')]();};}function respondWithResult(_0x32bb7f,_0x4d7a44){_0x4d7a44=_0x4d7a44||0xc8;return function(_0x257614){if(_0x257614){return _0x32bb7f['status'](_0x4d7a44)[_0x87cd('0x1c')](_0x257614);}};}function respondWithFilteredResult(_0x1914ff,_0x2eb7e7){return function(_0x2af644){if(_0x2af644){var _0x59302d=typeof _0x2eb7e7[_0x87cd('0x1d')]===_0x87cd('0x1e')&&typeof _0x2eb7e7[_0x87cd('0x1f')]===_0x87cd('0x1e');var _0x23c139=_0x2af644['count'];var _0xe2a076=_0x59302d?0x0:_0x2eb7e7[_0x87cd('0x1d')];var _0x39832f=_0x59302d?_0x2af644[_0x87cd('0x20')]:_0x2eb7e7['offset']+_0x2eb7e7[_0x87cd('0x1f')];var _0x505de9;if(_0x39832f>=_0x23c139){_0x39832f=_0x23c139;_0x505de9=0xc8;}else{_0x505de9=0xce;}_0x1914ff[_0x87cd('0x21')](_0x505de9);return _0x1914ff[_0x87cd('0x22')](_0x87cd('0x23'),_0xe2a076+'-'+_0x39832f+'/'+_0x23c139)[_0x87cd('0x1c')](_0x2af644);}return null;};}function patchUpdates(_0x3a9418){return function(_0x47a7bb){try{jsonpatch[_0x87cd('0x24')](_0x47a7bb,_0x3a9418,!![]);}catch(_0x568847){return BPromise[_0x87cd('0x25')](_0x568847);}return _0x47a7bb[_0x87cd('0x26')]();};}function saveUpdates(_0x29a503,_0x17041e){return function(_0x101cef){if(_0x101cef){return _0x101cef[_0x87cd('0x27')](_0x29a503)[_0x87cd('0x28')](function(_0x57308e){return _0x57308e;});}return null;};}function removeEntity(_0x577d7d,_0xfdd5e3){return function(_0x24326e){if(_0x24326e){return _0x24326e[_0x87cd('0x29')]()[_0x87cd('0x28')](function(){_0x577d7d[_0x87cd('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe184e,_0x2722da){return function(_0x416348){if(!_0x416348){_0xbe184e[_0x87cd('0x1a')](0x194);}return _0x416348;};}function handleError(_0x1b0568,_0x5e7e8f){_0x5e7e8f=_0x5e7e8f||0x1f4;return function(_0x4f5657){logger[_0x87cd('0x2a')](_0x4f5657[_0x87cd('0x2b')]);if(_0x4f5657[_0x87cd('0x2c')]){delete _0x4f5657[_0x87cd('0x2c')];}_0x1b0568[_0x87cd('0x21')](_0x5e7e8f)[_0x87cd('0x2d')](_0x4f5657);};}exports[_0x87cd('0x2e')]=function(_0x4f3f91,_0x130807){var _0x2b194b={},_0x1e56fd={},_0x88ef75={'count':0x0,'rows':[]};var _0x37d14f=_[_0x87cd('0x2f')](db[_0x87cd('0x30')][_0x87cd('0x31')],function(_0x3a5d9a){return{'name':_0x3a5d9a[_0x87cd('0x32')],'type':_0x3a5d9a[_0x87cd('0x33')][_0x87cd('0x34')]};});_0x1e56fd[_0x87cd('0x35')]=_['map'](_0x37d14f,_0x87cd('0x2c'));_0x1e56fd[_0x87cd('0x36')]=_[_0x87cd('0x37')](_0x4f3f91['query']);_0x1e56fd[_0x87cd('0x38')]=_[_0x87cd('0x39')](_0x1e56fd[_0x87cd('0x35')],_0x1e56fd[_0x87cd('0x36')]);_0x2b194b['attributes']=_[_0x87cd('0x39')](_0x1e56fd[_0x87cd('0x35')],qs[_0x87cd('0x3a')](_0x4f3f91[_0x87cd('0x36')]['fields']));_0x2b194b[_0x87cd('0x3b')]=_0x2b194b[_0x87cd('0x3b')][_0x87cd('0x3c')]?_0x2b194b[_0x87cd('0x3b')]:_0x1e56fd[_0x87cd('0x35')];if(!_0x4f3f91[_0x87cd('0x36')][_0x87cd('0x3d')](_0x87cd('0x3e'))){_0x2b194b[_0x87cd('0x1f')]=qs[_0x87cd('0x1f')](_0x4f3f91[_0x87cd('0x36')][_0x87cd('0x1f')]);_0x2b194b[_0x87cd('0x1d')]=qs['offset'](_0x4f3f91['query']['offset']);}_0x2b194b[_0x87cd('0x3f')]=qs['sort'](_0x4f3f91[_0x87cd('0x36')][_0x87cd('0x40')]);_0x2b194b[_0x87cd('0x41')]=qs[_0x87cd('0x38')](_[_0x87cd('0x42')](_0x4f3f91[_0x87cd('0x36')],_0x1e56fd[_0x87cd('0x38')]),_0x37d14f);if(_0x4f3f91[_0x87cd('0x36')][_0x87cd('0x43')]){_0x2b194b[_0x87cd('0x41')]=_[_0x87cd('0x44')](_0x2b194b[_0x87cd('0x41')],{'$or':_[_0x87cd('0x2f')](_0x37d14f,function(_0x209976){if(_0x209976[_0x87cd('0x33')]!==_0x87cd('0x45')){var _0x38eec2={};_0x38eec2[_0x209976[_0x87cd('0x2c')]]={'$like':'%'+_0x4f3f91['query'][_0x87cd('0x43')]+'%'};return _0x38eec2;}})});}_0x2b194b=_['merge']({},_0x2b194b,_0x4f3f91['options']);var _0x1487e4={'where':_0x2b194b[_0x87cd('0x41')]};return db[_0x87cd('0x30')][_0x87cd('0x20')](_0x1487e4)['then'](function(_0x1a5631){_0x88ef75[_0x87cd('0x20')]=_0x1a5631;if(_0x4f3f91[_0x87cd('0x36')][_0x87cd('0x46')]){_0x2b194b[_0x87cd('0x47')]=[{'all':!![]}];}return db[_0x87cd('0x30')][_0x87cd('0x48')](_0x2b194b);})[_0x87cd('0x28')](function(_0x189e93){_0x88ef75[_0x87cd('0x49')]=_0x189e93;return _0x88ef75;})[_0x87cd('0x28')](respondWithFilteredResult(_0x130807,_0x2b194b))['catch'](handleError(_0x130807,null));};exports[_0x87cd('0x4a')]=function(_0x6fa5a2,_0x2067fc){var _0xa87938={'raw':![],'where':{'id':_0x6fa5a2[_0x87cd('0x4b')]['id']}},_0x4266a8={};_0x4266a8['model']=_['keys'](db[_0x87cd('0x30')][_0x87cd('0x31')]);_0x4266a8[_0x87cd('0x36')]=_[_0x87cd('0x37')](_0x6fa5a2[_0x87cd('0x36')]);_0x4266a8[_0x87cd('0x38')]=_[_0x87cd('0x39')](_0x4266a8['model'],_0x4266a8[_0x87cd('0x36')]);_0xa87938[_0x87cd('0x3b')]=_[_0x87cd('0x39')](_0x4266a8[_0x87cd('0x35')],qs['fields'](_0x6fa5a2[_0x87cd('0x36')][_0x87cd('0x3a')]));_0xa87938['attributes']=_0xa87938[_0x87cd('0x3b')][_0x87cd('0x3c')]?_0xa87938['attributes']:_0x4266a8[_0x87cd('0x35')];if(_0x6fa5a2[_0x87cd('0x36')][_0x87cd('0x46')]){_0xa87938[_0x87cd('0x47')]=[{'all':!![]}];}_0xa87938=_[_0x87cd('0x44')]({},_0xa87938,_0x6fa5a2[_0x87cd('0x4c')]);return db[_0x87cd('0x30')][_0x87cd('0x4d')](_0xa87938)[_0x87cd('0x28')](handleEntityNotFound(_0x2067fc,null))['then'](respondWithResult(_0x2067fc,null))['catch'](handleError(_0x2067fc,null));};exports['create']=function(_0x2ff4ce,_0x39a803){return db[_0x87cd('0x30')][_0x87cd('0x4e')](_0x2ff4ce[_0x87cd('0x4f')],{})[_0x87cd('0x28')](respondWithResult(_0x39a803,0xc9))[_0x87cd('0x50')](handleError(_0x39a803,null));};exports[_0x87cd('0x27')]=function(_0x5934da,_0x2a1984){if(_0x5934da[_0x87cd('0x4f')]['id']){delete _0x5934da[_0x87cd('0x4f')]['id'];}return db[_0x87cd('0x30')][_0x87cd('0x4d')]({'where':{'id':_0x5934da['params']['id']}})['then'](handleEntityNotFound(_0x2a1984,null))[_0x87cd('0x28')](saveUpdates(_0x5934da[_0x87cd('0x4f')],null))[_0x87cd('0x28')](respondWithResult(_0x2a1984,null))[_0x87cd('0x50')](handleError(_0x2a1984,null));};exports[_0x87cd('0x29')]=function(_0x2290a4,_0x4afa05){return db['SalesforceAccount'][_0x87cd('0x4d')]({'where':{'id':_0x2290a4[_0x87cd('0x4b')]['id']}})[_0x87cd('0x28')](handleEntityNotFound(_0x4afa05,null))[_0x87cd('0x28')](removeEntity(_0x4afa05,null))[_0x87cd('0x50')](handleError(_0x4afa05,null));};exports['getConfigurations']=function(_0x15efd9,_0x27c1f5,_0x10e928){var _0x82abe={};var _0x1ab7ef={};var _0x4b40d5;var _0x892a5a;return db['SalesforceAccount'][_0x87cd('0x51')]({'where':{'id':_0x15efd9[_0x87cd('0x4b')]['id']}})[_0x87cd('0x28')](handleEntityNotFound(_0x27c1f5,null))[_0x87cd('0x28')](function(_0x59f057){if(_0x59f057){_0x4b40d5=_0x59f057;_0x1ab7ef['model']=_['keys'](db[_0x87cd('0x52')][_0x87cd('0x31')]);_0x1ab7ef[_0x87cd('0x36')]=_['keys'](_0x15efd9[_0x87cd('0x36')]);_0x1ab7ef[_0x87cd('0x38')]=_[_0x87cd('0x39')](_0x1ab7ef[_0x87cd('0x35')],_0x1ab7ef[_0x87cd('0x36')]);_0x82abe[_0x87cd('0x3b')]=_['intersection'](_0x1ab7ef[_0x87cd('0x35')],qs[_0x87cd('0x3a')](_0x15efd9[_0x87cd('0x36')][_0x87cd('0x3a')]));_0x82abe[_0x87cd('0x3b')]=_0x82abe[_0x87cd('0x3b')][_0x87cd('0x3c')]?_0x82abe[_0x87cd('0x3b')]:_0x1ab7ef[_0x87cd('0x35')];_0x82abe[_0x87cd('0x3f')]=qs[_0x87cd('0x40')](_0x15efd9[_0x87cd('0x36')][_0x87cd('0x40')]);_0x82abe['where']=qs[_0x87cd('0x38')](_[_0x87cd('0x42')](_0x15efd9[_0x87cd('0x36')],_0x1ab7ef[_0x87cd('0x38')]));if(_0x15efd9[_0x87cd('0x36')][_0x87cd('0x43')]){_0x82abe[_0x87cd('0x41')]=_['merge'](_0x82abe['where'],{'$or':_['map'](_0x82abe[_0x87cd('0x3b')],function(_0x4e78b4){var _0x52163d={};_0x52163d[_0x4e78b4]={'$like':'%'+_0x15efd9['query'][_0x87cd('0x43')]+'%'};return _0x52163d;})});}_0x82abe=_[_0x87cd('0x44')]({},_0x82abe,_0x15efd9[_0x87cd('0x4c')]);return _0x4b40d5['getConfigurations'](_0x82abe);}})[_0x87cd('0x28')](function(_0x18f655){if(_0x18f655){_0x892a5a=_0x18f655['length'];if(!_0x15efd9[_0x87cd('0x36')][_0x87cd('0x3d')](_0x87cd('0x3e'))){_0x82abe[_0x87cd('0x1f')]=qs[_0x87cd('0x1f')](_0x15efd9[_0x87cd('0x36')][_0x87cd('0x1f')]);_0x82abe[_0x87cd('0x1d')]=qs[_0x87cd('0x1d')](_0x15efd9[_0x87cd('0x36')]['offset']);}return _0x4b40d5[_0x87cd('0x53')](_0x82abe);}})[_0x87cd('0x28')](function(_0x42d175){if(_0x42d175){return _0x42d175?{'count':_0x892a5a,'rows':_0x42d175}:null;}})[_0x87cd('0x28')](respondWithResult(_0x27c1f5,null))[_0x87cd('0x50')](handleError(_0x27c1f5,null));};exports[_0x87cd('0x54')]=function(_0x239d47,_0x5aba2e,_0x179f70){if(_0x239d47['body']['id']){delete _0x239d47[_0x87cd('0x4f')]['id'];}return db['SalesforceAccount'][_0x87cd('0x51')]({'where':{'id':_0x239d47[_0x87cd('0x4b')]['id']}})[_0x87cd('0x28')](handleEntityNotFound(_0x5aba2e,null))[_0x87cd('0x28')](function(_0x17d8a3){if(_0x17d8a3){_0x239d47[_0x87cd('0x4f')][_0x87cd('0x55')]=_0x17d8a3['id'];_0x239d47['body'][_0x87cd('0x56')]=integrations[_0x87cd('0x57')](_0x239d47[_0x87cd('0x4f')][_0x87cd('0x58')],_0x239d47[_0x87cd('0x4f')][_0x87cd('0x33')]);_0x239d47[_0x87cd('0x4f')][_0x87cd('0x59')]=integrations[_0x87cd('0x5a')](_0x239d47['body']['channel'],_0x239d47[_0x87cd('0x4f')]['type']);return db[_0x87cd('0x52')]['create'](_0x239d47['body'],{'include':[{'model':db[_0x87cd('0x5b')],'as':_0x87cd('0x56')},{'model':db['SalesforceField'],'as':_0x87cd('0x59')}]});}return null;})['then'](respondWithResult(_0x5aba2e,null))[_0x87cd('0x50')](handleError(_0x5aba2e,null));};exports[_0x87cd('0x5c')]=function(_0x2c775e,_0x55a107,_0xda5b6c){var _0x47d362;var _0x52016e='';var _0x37365f=_0x87cd('0x5d');return db[_0x87cd('0x30')][_0x87cd('0x51')]({'where':{'id':_0x2c775e[_0x87cd('0x4b')]['id']},'attributes':['id',_0x87cd('0x5e'),_0x87cd('0x5f'),_0x87cd('0x60'),_0x87cd('0x61'),_0x87cd('0x62'),_0x87cd('0x63')]})[_0x87cd('0x28')](handleEntityNotFound(_0x55a107,null))[_0x87cd('0x28')](function(_0xd31a64){if(_0xd31a64){_0x52016e=_0xd31a64[_0x87cd('0x5e')];var _0x36cc92=_0x52016e[_0x87cd('0x64')](-0x1);if(_0x36cc92==='/'){_0x52016e=_0x52016e[_0x87cd('0x65')](0x0,_0x52016e[_0x87cd('0x66')](_0x36cc92));}_0x47d362=new jsforce[(_0x87cd('0x67'))]({'oauth2':{'loginUrl':_0x52016e,'clientId':_0xd31a64[_0x87cd('0x5f')],'clientSecret':_0xd31a64[_0x87cd('0x60')]}});return _0x47d362[_0x87cd('0x68')](_0xd31a64[_0x87cd('0x61')],_0xd31a64[_0x87cd('0x62')][_0x87cd('0x69')](_0xd31a64[_0x87cd('0x63')]));}})[_0x87cd('0x28')](function(_0x297c2d){if(_0x297c2d){if(!_[_0x87cd('0x6a')](_0x2c775e[_0x87cd('0x36')][_0x87cd('0x6b')])){_0x37365f=_0x2c775e['query']['ticketType'];}return _0x47d362[_0x87cd('0x6c')](_0x37365f)[_0x87cd('0x6d')]();}})[_0x87cd('0x28')](function(_0x52b1d7){var _0x4da191=[_0x87cd('0x6e'),'ActivityDate',_0x87cd('0x6f'),_0x87cd('0x70'),_0x87cd('0x71'),_0x87cd('0x72')];var _0x2aa88b=[_0x87cd('0x73'),_0x87cd('0x74'),_0x87cd('0x75'),_0x87cd('0x76'),_0x87cd('0x77'),'textarea',_0x87cd('0x78')];if(_0x52b1d7){_[_0x87cd('0x79')](_0x52b1d7[_0x87cd('0x3a')],function(_0x5b0cec){return _0x4da191[_0x87cd('0x7a')](_0x5b0cec[_0x87cd('0x2c')])||!_0x2aa88b['includes'](_0x5b0cec[_0x87cd('0x33')]);});return{'count':_0x52b1d7[_0x87cd('0x3a')]['length'],'rows':_[_0x87cd('0x2f')](_0x52b1d7[_0x87cd('0x3a')],function(_0x41970d){return{'id':_0x41970d['name'],'name':_0x41970d['label'],'custom':_0x41970d[_0x87cd('0x7b')],'options':_0x41970d[_0x87cd('0x7c')][_0x87cd('0x3c')]>0x0?_[_0x87cd('0x2f')](_0x41970d['picklistValues'],function(_0x10fa68){return{'name':_0x10fa68[_0x87cd('0x7d')],'value':_0x10fa68[_0x87cd('0x7e')]};}):_0x41970d['type']=='boolean'?[{'name':_0x87cd('0x7f'),'value':_0x87cd('0x80')},{'name':_0x87cd('0x81'),'value':_0x87cd('0x82')}]:[]};})};}})[_0x87cd('0x28')](respondWithResult(_0x55a107,null))['catch'](function(_0x235691){var _0x34bb72=_0x2c775e[_0x87cd('0x36')]['test']?0x1f4:_0x235691['statusCode']||0x1f4;logger[_0x87cd('0x2a')](_0x87cd('0x83'),_0x87cd('0x5c'),_0x34bb72,JSON[_0x87cd('0x84')](_0x235691));delete _0x235691[_0x87cd('0x2c')];if(_0x34bb72===0x191){_0x34bb72=0x190;}_0x55a107[_0x87cd('0x21')](_0x34bb72)['send'](_0x2c775e['query'][_0x87cd('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x235691[_0x87cd('0x86')]}:_0x235691);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e887f28..88f963c 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 _0x37f8=['define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','request-promise','exports'];(function(_0x44cfbb,_0x3c9d74){var _0x4c59ae=function(_0x312f1d){while(--_0x312f1d){_0x44cfbb['push'](_0x44cfbb['shift']());}};_0x4c59ae(++_0x3c9d74);}(_0x37f8,0xd2));var _0x837f=function(_0x5043cb,_0x3f246b){_0x5043cb=_0x5043cb-0x0;var _0x578c04=_0x37f8[_0x5043cb];return _0x578c04;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x837f('0x5')]=function(_0x42986f,_0x224ad2){return _0x42986f[_0x837f('0x6')](_0x837f('0x7'),attributes,{'tableName':_0x837f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfba8=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b6ad5,_0xd6e1e2){var _0x359d28=function(_0xf85bb5){while(--_0xf85bb5){_0x3b6ad5['push'](_0x3b6ad5['shift']());}};_0x359d28(++_0xd6e1e2);}(_0xfba8,0x118));var _0x8fba=function(_0x5c3481,_0x4baafc){_0x5c3481=_0x5c3481-0x0;var _0x24bb95=_0xfba8[_0x5c3481];return _0x24bb95;};'use strict';var _=require(_0x8fba('0x0'));var util=require(_0x8fba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8fba('0x2'));var rp=require(_0x8fba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8fba('0x4'));var config=require(_0x8fba('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x8fba('0x6'));module[_0x8fba('0x7')]=function(_0x44aa55,_0x582783){return _0x44aa55[_0x8fba('0x8')](_0x8fba('0x9'),attributes,{'tableName':_0x8fba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 57e0609..f3e7a68 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 _0xce6a=['SalesforceAccount','raw','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','findAll','options','where','limit','include','map','model','attributes','ShowSalesforceAccount'];(function(_0x517f18,_0x157f60){var _0x1327ab=function(_0x1993bf){while(--_0x1993bf){_0x517f18['push'](_0x517f18['shift']());}};_0x1327ab(++_0x157f60);}(_0xce6a,0xd4));var _0xace6=function(_0x5050e8,_0x581230){_0x5050e8=_0x5050e8-0x0;var _0x4bd89d=_0xce6a[_0x5050e8];return _0x4bd89d;};'use strict';var _=require('lodash');var util=require(_0xace6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xace6('0x2'))['db'];var utils=require(_0xace6('0x3'));var logger=require(_0xace6('0x4'))(_0xace6('0x5'));var config=require(_0xace6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xace6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1379f3,_0x1f6c4d,_0x1e6c15){return new BPromise(function(_0x18e650,_0x10bb5e){return client['request'](_0x1379f3,_0x1e6c15)[_0xace6('0x8')](function(_0x3a0691){logger[_0xace6('0x9')](_0xace6('0xa'),_0x1f6c4d,'request\x20sent');logger[_0xace6('0xb')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1f6c4d,_0xace6('0xc'),JSON['stringify'](_0x3a0691));if(_0x3a0691[_0xace6('0xd')]){if(_0x3a0691['error'][_0xace6('0xe')]===0x1f4){logger['error'](_0xace6('0xa'),_0x1f6c4d,_0x3a0691['error']['message']);return _0x10bb5e(_0x3a0691[_0xace6('0xd')][_0xace6('0xf')]);}logger[_0xace6('0xd')](_0xace6('0xa'),_0x1f6c4d,_0x3a0691[_0xace6('0xd')][_0xace6('0xf')]);return _0x18e650(_0x3a0691[_0xace6('0xd')]['message']);}else{logger['info'](_0xace6('0xa'),_0x1f6c4d,_0xace6('0xc'));_0x18e650(_0x3a0691[_0xace6('0x10')]['message']);}})[_0xace6('0x11')](function(_0x58b6ce){logger['error'](_0xace6('0xa'),_0x1f6c4d,_0x58b6ce);_0x10bb5e(_0x58b6ce);});});}exports[_0xace6('0x12')]=function(_0x13888a){var _0x208927=this;return new Promise(function(_0xb4f47d,_0x4228f1){return db['SalesforceAccount'][_0xace6('0x13')]({'raw':_0x13888a[_0xace6('0x14')]?_0x13888a[_0xace6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x13888a['options']?_0x13888a['options'][_0xace6('0x15')]||null:null,'attributes':_0x13888a[_0xace6('0x14')]?_0x13888a[_0xace6('0x14')]['attributes']||null:null,'limit':_0x13888a[_0xace6('0x14')]?_0x13888a[_0xace6('0x14')][_0xace6('0x16')]||null:null,'include':_0x13888a[_0xace6('0x14')]?_0x13888a[_0xace6('0x14')][_0xace6('0x17')]?_[_0xace6('0x18')](_0x13888a[_0xace6('0x14')][_0xace6('0x17')],function(_0x5856e0){return{'model':db[_0x5856e0[_0xace6('0x19')]],'as':_0x5856e0['as'],'attributes':_0x5856e0[_0xace6('0x1a')],'include':_0x5856e0[_0xace6('0x17')]?_['map'](_0x5856e0['include'],function(_0x154f73){return{'model':db[_0x154f73[_0xace6('0x19')]],'as':_0x154f73['as'],'attributes':_0x154f73[_0xace6('0x1a')],'include':_0x154f73[_0xace6('0x17')]?_['map'](_0x154f73[_0xace6('0x17')],function(_0x497154){return{'model':db[_0x497154[_0xace6('0x19')]],'as':_0x497154['as'],'attributes':_0x497154[_0xace6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xace6('0x8')](function(_0x35ce75){logger['info'](_0xace6('0x12'),_0x13888a);logger[_0xace6('0xb')](_0xace6('0x12'),_0x13888a,JSON['stringify'](_0x35ce75));_0xb4f47d(_0x35ce75);})[_0xace6('0x11')](function(_0x27bfe3){logger[_0xace6('0xd')](_0xace6('0x12'),_0x27bfe3[_0xace6('0xf')],_0x13888a);_0x4228f1(_0x208927[_0xace6('0xd')](0x1f4,_0x27bfe3[_0xace6('0xf')]));});});};exports[_0xace6('0x1b')]=function(_0x3d259c){var _0x443846=this;return new Promise(function(_0x5b7853,_0x5abb7d){return db[_0xace6('0x1c')]['find']({'raw':_0x3d259c[_0xace6('0x14')]?_0x3d259c[_0xace6('0x14')][_0xace6('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d259c[_0xace6('0x14')]?_0x3d259c[_0xace6('0x14')]['where']||null:null,'attributes':_0x3d259c[_0xace6('0x14')]?_0x3d259c[_0xace6('0x14')]['attributes']||null:null,'include':_0x3d259c[_0xace6('0x14')]?_0x3d259c['options'][_0xace6('0x17')]?_['map'](_0x3d259c['options'][_0xace6('0x17')],function(_0x55c8ab){return{'model':db[_0x55c8ab['model']],'as':_0x55c8ab['as'],'attributes':_0x55c8ab[_0xace6('0x1a')],'include':_0x55c8ab[_0xace6('0x17')]?_[_0xace6('0x18')](_0x55c8ab[_0xace6('0x17')],function(_0x3fa36f){return{'model':db[_0x3fa36f[_0xace6('0x19')]],'as':_0x3fa36f['as'],'attributes':_0x3fa36f[_0xace6('0x1a')],'include':_0x3fa36f[_0xace6('0x17')]?_[_0xace6('0x18')](_0x3fa36f[_0xace6('0x17')],function(_0x3fe481){return{'model':db[_0x3fe481[_0xace6('0x19')]],'as':_0x3fe481['as'],'attributes':_0x3fe481[_0xace6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xace6('0x8')](function(_0x2d0ef8){logger['info'](_0xace6('0x1b'),_0x3d259c);logger[_0xace6('0xb')](_0xace6('0x1b'),_0x3d259c,JSON['stringify'](_0x2d0ef8));_0x5b7853(_0x2d0ef8);})['catch'](function(_0x35800e){logger[_0xace6('0xd')](_0xace6('0x1b'),_0x35800e[_0xace6('0xf')],_0x3d259c);_0x5abb7d(_0x443846['error'](0x1f4,_0x35800e[_0xace6('0xf')]));});});}; \ No newline at end of file +var _0xda37=['find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','model','debug','stringify'];(function(_0x587fdb,_0x50dd97){var _0x38ae8e=function(_0x3b5385){while(--_0x3b5385){_0x587fdb['push'](_0x587fdb['shift']());}};_0x38ae8e(++_0x50dd97);}(_0xda37,0x1d6));var _0x7da3=function(_0x5e9d11,_0x4aa4b3){_0x5e9d11=_0x5e9d11-0x0;var _0x562899=_0xda37[_0x5e9d11];return _0x562899;};'use strict';var _=require(_0x7da3('0x0'));var util=require(_0x7da3('0x1'));var moment=require(_0x7da3('0x2'));var BPromise=require(_0x7da3('0x3'));var rs=require(_0x7da3('0x4'));var fs=require('fs');var Redis=require(_0x7da3('0x5'));var db=require(_0x7da3('0x6'))['db'];var utils=require(_0x7da3('0x7'));var logger=require(_0x7da3('0x8'))('rpc');var config=require(_0x7da3('0x9'));var jayson=require(_0x7da3('0xa'));var client=jayson[_0x7da3('0xb')][_0x7da3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f201a,_0x1af2bd,_0x5ec027){return new BPromise(function(_0x2836ed,_0x2bd28d){return client[_0x7da3('0xd')](_0x4f201a,_0x5ec027)[_0x7da3('0xe')](function(_0x2f9b0e){logger[_0x7da3('0xf')](_0x7da3('0x10'),_0x1af2bd,_0x7da3('0x11'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1af2bd,'request\x20sent',JSON['stringify'](_0x2f9b0e));if(_0x2f9b0e[_0x7da3('0x12')]){if(_0x2f9b0e['error'][_0x7da3('0x13')]===0x1f4){logger[_0x7da3('0x12')](_0x7da3('0x10'),_0x1af2bd,_0x2f9b0e[_0x7da3('0x12')][_0x7da3('0x14')]);return _0x2bd28d(_0x2f9b0e[_0x7da3('0x12')][_0x7da3('0x14')]);}logger['error'](_0x7da3('0x10'),_0x1af2bd,_0x2f9b0e[_0x7da3('0x12')][_0x7da3('0x14')]);return _0x2836ed(_0x2f9b0e[_0x7da3('0x12')]['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1af2bd,_0x7da3('0x11'));_0x2836ed(_0x2f9b0e['result'][_0x7da3('0x14')]);}})[_0x7da3('0x15')](function(_0x50078a){logger[_0x7da3('0x12')](_0x7da3('0x10'),_0x1af2bd,_0x50078a);_0x2bd28d(_0x50078a);});});}exports[_0x7da3('0x16')]=function(_0x307ca0){var _0x168c59=this;return new Promise(function(_0xac3600,_0x276946){return db[_0x7da3('0x17')][_0x7da3('0x18')]({'raw':_0x307ca0[_0x7da3('0x19')]?_0x307ca0[_0x7da3('0x19')][_0x7da3('0x1a')]===undefined?!![]:![]:!![],'where':_0x307ca0[_0x7da3('0x19')]?_0x307ca0[_0x7da3('0x19')][_0x7da3('0x1b')]||null:null,'attributes':_0x307ca0[_0x7da3('0x19')]?_0x307ca0[_0x7da3('0x19')][_0x7da3('0x1c')]||null:null,'limit':_0x307ca0['options']?_0x307ca0[_0x7da3('0x19')]['limit']||null:null,'include':_0x307ca0[_0x7da3('0x19')]?_0x307ca0[_0x7da3('0x19')]['include']?_[_0x7da3('0x1d')](_0x307ca0['options'][_0x7da3('0x1e')],function(_0x12ab0c){return{'model':db[_0x12ab0c['model']],'as':_0x12ab0c['as'],'attributes':_0x12ab0c[_0x7da3('0x1c')],'include':_0x12ab0c[_0x7da3('0x1e')]?_[_0x7da3('0x1d')](_0x12ab0c[_0x7da3('0x1e')],function(_0x20f555){return{'model':db[_0x20f555[_0x7da3('0x1f')]],'as':_0x20f555['as'],'attributes':_0x20f555[_0x7da3('0x1c')],'include':_0x20f555['include']?_[_0x7da3('0x1d')](_0x20f555[_0x7da3('0x1e')],function(_0x37cdfe){return{'model':db[_0x37cdfe[_0x7da3('0x1f')]],'as':_0x37cdfe['as'],'attributes':_0x37cdfe[_0x7da3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7da3('0xe')](function(_0x3d4c7f){logger[_0x7da3('0xf')](_0x7da3('0x16'),_0x307ca0);logger[_0x7da3('0x20')](_0x7da3('0x16'),_0x307ca0,JSON[_0x7da3('0x21')](_0x3d4c7f));_0xac3600(_0x3d4c7f);})[_0x7da3('0x15')](function(_0x2904e1){logger[_0x7da3('0x12')](_0x7da3('0x16'),_0x2904e1['message'],_0x307ca0);_0x276946(_0x168c59[_0x7da3('0x12')](0x1f4,_0x2904e1[_0x7da3('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x52c55b){var _0x6dfb35=this;return new Promise(function(_0x2064e4,_0x3b90b2){return db[_0x7da3('0x17')][_0x7da3('0x22')]({'raw':_0x52c55b[_0x7da3('0x19')]?_0x52c55b[_0x7da3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x52c55b[_0x7da3('0x19')]?_0x52c55b[_0x7da3('0x19')]['where']||null:null,'attributes':_0x52c55b[_0x7da3('0x19')]?_0x52c55b[_0x7da3('0x19')][_0x7da3('0x1c')]||null:null,'include':_0x52c55b[_0x7da3('0x19')]?_0x52c55b[_0x7da3('0x19')][_0x7da3('0x1e')]?_[_0x7da3('0x1d')](_0x52c55b[_0x7da3('0x19')][_0x7da3('0x1e')],function(_0x3505f8){return{'model':db[_0x3505f8[_0x7da3('0x1f')]],'as':_0x3505f8['as'],'attributes':_0x3505f8[_0x7da3('0x1c')],'include':_0x3505f8[_0x7da3('0x1e')]?_[_0x7da3('0x1d')](_0x3505f8[_0x7da3('0x1e')],function(_0x4a0b78){return{'model':db[_0x4a0b78[_0x7da3('0x1f')]],'as':_0x4a0b78['as'],'attributes':_0x4a0b78[_0x7da3('0x1c')],'include':_0x4a0b78[_0x7da3('0x1e')]?_['map'](_0x4a0b78[_0x7da3('0x1e')],function(_0x5c0b9e){return{'model':db[_0x5c0b9e[_0x7da3('0x1f')]],'as':_0x5c0b9e['as'],'attributes':_0x5c0b9e[_0x7da3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7da3('0xe')](function(_0x9e9ecc){logger[_0x7da3('0xf')](_0x7da3('0x23'),_0x52c55b);logger[_0x7da3('0x20')](_0x7da3('0x23'),_0x52c55b,JSON['stringify'](_0x9e9ecc));_0x2064e4(_0x9e9ecc);})[_0x7da3('0x15')](function(_0x4c8976){logger[_0x7da3('0x12')](_0x7da3('0x23'),_0x4c8976[_0x7da3('0x14')],_0x52c55b);_0x3b90b2(_0x6dfb35['error'](0x1f4,_0x4c8976[_0x7da3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 67d20be..d14747d 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x32801e,_0x19448b){var _0x6301a=function(_0x4b1594){while(--_0x4b1594){_0x32801e['push'](_0x32801e['shift']());}};_0x6301a(++_0x19448b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x145631,_0x1d45a2){_0x145631=_0x145631-0x0;var _0x20f698=_0x5f2f[_0x145631];return _0x20f698;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x138df1,_0x5413aa){var _0x17ec6b=function(_0x197b40){while(--_0x197b40){_0x138df1['push'](_0x138df1['shift']());}};_0x17ec6b(++_0x5413aa);}(_0x7a54,0x106));var _0x47a5=function(_0x3f94e0,_0x2c7fce){_0x3f94e0=_0x3f94e0-0x0;var _0x24123a=_0x7a54[_0x3f94e0];return _0x24123a;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9f29eb3..8c68d8e 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 _0x0b66=['contact','exports','STRING','ENUM','Task','Case','lead','account_contact_lead','account','contact_lead','nothing'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0b66,0x1b9));var _0x60b6=function(_0x507262,_0x3cbbc5){_0x507262=_0x507262-0x0;var _0x449c1e=_0x0b66[_0x507262];return _0x449c1e;};'use strict';var Sequelize=require('sequelize');module[_0x60b6('0x0')]={'name':{'type':Sequelize[_0x60b6('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x60b6('0x2')](_0x60b6('0x3'),_0x60b6('0x4')),'defaultValue':_0x60b6('0x3')},'moduleSearch':{'type':Sequelize[_0x60b6('0x2')]('contact_lead','contact',_0x60b6('0x5'),_0x60b6('0x6'),_0x60b6('0x7')),'defaultValue':_0x60b6('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x60b6('0x9'),_0x60b6('0xa'),_0x60b6('0x5'),_0x60b6('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x60b6('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x60b6('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x60b6('0x1')]}}; \ No newline at end of file +var _0x99f5=['lead','account_contact_lead','account','nothing','contact','exports','STRING','Task','ENUM','contact_lead'];(function(_0x327e57,_0x3342a1){var _0x3279f6=function(_0x70ed4d){while(--_0x70ed4d){_0x327e57['push'](_0x327e57['shift']());}};_0x3279f6(++_0x3342a1);}(_0x99f5,0x16d));var _0x599f=function(_0x55d105,_0x219954){_0x55d105=_0x55d105-0x0;var _0xd8624d=_0x99f5[_0x55d105];return _0xd8624d;};'use strict';var Sequelize=require('sequelize');module[_0x599f('0x0')]={'name':{'type':Sequelize[_0x599f('0x1')]},'description':{'type':Sequelize[_0x599f('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x599f('0x2'),'Case'),'defaultValue':_0x599f('0x2')},'moduleSearch':{'type':Sequelize[_0x599f('0x3')](_0x599f('0x4'),'contact',_0x599f('0x5'),_0x599f('0x6'),_0x599f('0x7')),'defaultValue':_0x599f('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x599f('0x8'),_0x599f('0x9'),_0x599f('0x5'),_0x599f('0x7')),'defaultValue':_0x599f('0x5')},'leadId':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x599f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0d07c00..6918731 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 _0x27cf=['json','offset','undefined','limit','count','set','Content-Range','apply','then','sendStatus','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x20e40f,_0x1bd601){var _0x13d00b=function(_0x240c33){while(--_0x240c33){_0x20e40f['push'](_0x20e40f['shift']());}};_0x13d00b(++_0x1bd601);}(_0x27cf,0x1aa));var _0xf27c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x27cf[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0xf27c('0x0'));var rimraf=require(_0xf27c('0x1'));var zipdir=require(_0xf27c('0x2'));var jsonpatch=require(_0xf27c('0x3'));var rp=require('request-promise');var moment=require(_0xf27c('0x4'));var BPromise=require(_0xf27c('0x5'));var Mustache=require(_0xf27c('0x6'));var util=require(_0xf27c('0x7'));var path=require(_0xf27c('0x8'));var sox=require('sox');var csv=require(_0xf27c('0x9'));var ejs=require(_0xf27c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf27c('0xb'));var squel=require(_0xf27c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf27c('0xd'));var toCsv=require(_0xf27c('0x9'));var querystring=require(_0xf27c('0xe'));var Papa=require(_0xf27c('0xf'));var Redis=require('ioredis');var authService=require(_0xf27c('0x10'));var qs=require(_0xf27c('0x11'));var as=require(_0xf27c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf27c('0x13'));var config=require(_0xf27c('0x14'));var licenseUtil=require(_0xf27c('0x15'));var db=require(_0xf27c('0x16'))['db'];function respondWithStatusCode(_0x43a8a7,_0x59703f){_0x59703f=_0x59703f||0xcc;return function(_0x141c42){if(_0x141c42){return _0x43a8a7['sendStatus'](_0x59703f);}return _0x43a8a7[_0xf27c('0x17')](_0x59703f)['end']();};}function respondWithResult(_0x15a9e1,_0x143659){_0x143659=_0x143659||0xc8;return function(_0x5a405a){if(_0x5a405a){return _0x15a9e1[_0xf27c('0x17')](_0x143659)[_0xf27c('0x18')](_0x5a405a);}};}function respondWithFilteredResult(_0x59f1df,_0x466758){return function(_0x4073f1){if(_0x4073f1){var _0x2343a0=typeof _0x466758[_0xf27c('0x19')]===_0xf27c('0x1a')&&typeof _0x466758[_0xf27c('0x1b')]===_0xf27c('0x1a');var _0x2bad3e=_0x4073f1[_0xf27c('0x1c')];var _0x29b81d=_0x2343a0?0x0:_0x466758[_0xf27c('0x19')];var _0x980c4=_0x2343a0?_0x4073f1[_0xf27c('0x1c')]:_0x466758[_0xf27c('0x19')]+_0x466758[_0xf27c('0x1b')];var _0x4e18dc;if(_0x980c4>=_0x2bad3e){_0x980c4=_0x2bad3e;_0x4e18dc=0xc8;}else{_0x4e18dc=0xce;}_0x59f1df[_0xf27c('0x17')](_0x4e18dc);return _0x59f1df[_0xf27c('0x1d')](_0xf27c('0x1e'),_0x29b81d+'-'+_0x980c4+'/'+_0x2bad3e)[_0xf27c('0x18')](_0x4073f1);}return null;};}function patchUpdates(_0x84e424){return function(_0x34d379){try{jsonpatch[_0xf27c('0x1f')](_0x34d379,_0x84e424,!![]);}catch(_0x4f4f35){return BPromise['reject'](_0x4f4f35);}return _0x34d379['save']();};}function saveUpdates(_0x582837,_0x1925d0){return function(_0x5239a1){if(_0x5239a1){return _0x5239a1['update'](_0x582837)[_0xf27c('0x20')](function(_0x1ad6cf){return _0x1ad6cf;});}return null;};}function removeEntity(_0x341c39,_0x24eb69){return function(_0x51190a){if(_0x51190a){return _0x51190a['destroy']()['then'](function(){_0x341c39[_0xf27c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0fba,_0x3a6bb5){return function(_0x266b1a){if(!_0x266b1a){_0x5c0fba[_0xf27c('0x21')](0x194);}return _0x266b1a;};}function handleError(_0x30fd94,_0x428145){_0x428145=_0x428145||0x1f4;return function(_0x157356){logger[_0xf27c('0x22')](_0x157356[_0xf27c('0x23')]);if(_0x157356[_0xf27c('0x24')]){delete _0x157356['name'];}_0x30fd94[_0xf27c('0x17')](_0x428145)[_0xf27c('0x25')](_0x157356);};}exports['index']=function(_0x2e1825,_0x58bcaa){var _0x1a1ad6={},_0x52e65f={},_0x5bb8d0={'count':0x0,'rows':[]};var _0x53c9ef=_[_0xf27c('0x26')](db[_0xf27c('0x27')][_0xf27c('0x28')],function(_0x317f4d){return{'name':_0x317f4d[_0xf27c('0x29')],'type':_0x317f4d[_0xf27c('0x2a')][_0xf27c('0x2b')]};});_0x52e65f[_0xf27c('0x2c')]=_[_0xf27c('0x26')](_0x53c9ef,_0xf27c('0x24'));_0x52e65f[_0xf27c('0x2d')]=_['keys'](_0x2e1825[_0xf27c('0x2d')]);_0x52e65f[_0xf27c('0x2e')]=_[_0xf27c('0x2f')](_0x52e65f[_0xf27c('0x2c')],_0x52e65f[_0xf27c('0x2d')]);_0x1a1ad6[_0xf27c('0x30')]=_[_0xf27c('0x2f')](_0x52e65f[_0xf27c('0x2c')],qs[_0xf27c('0x31')](_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x31')]));_0x1a1ad6[_0xf27c('0x30')]=_0x1a1ad6[_0xf27c('0x30')][_0xf27c('0x32')]?_0x1a1ad6['attributes']:_0x52e65f['model'];if(!_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x33')](_0xf27c('0x34'))){_0x1a1ad6['limit']=qs['limit'](_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x1b')]);_0x1a1ad6['offset']=qs[_0xf27c('0x19')](_0x2e1825['query'][_0xf27c('0x19')]);}_0x1a1ad6[_0xf27c('0x35')]=qs['sort'](_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x36')]);_0x1a1ad6['where']=qs[_0xf27c('0x2e')](_['pick'](_0x2e1825['query'],_0x52e65f[_0xf27c('0x2e')]),_0x53c9ef);if(_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x37')]){_0x1a1ad6[_0xf27c('0x38')]=_[_0xf27c('0x39')](_0x1a1ad6['where'],{'$or':_['map'](_0x53c9ef,function(_0xea8cf7){if(_0xea8cf7[_0xf27c('0x2a')]!=='VIRTUAL'){var _0x49ec55={};_0x49ec55[_0xea8cf7[_0xf27c('0x24')]]={'$like':'%'+_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x37')]+'%'};return _0x49ec55;}})});}_0x1a1ad6=_[_0xf27c('0x39')]({},_0x1a1ad6,_0x2e1825['options']);var _0x385053={'where':_0x1a1ad6[_0xf27c('0x38')]};return db[_0xf27c('0x27')][_0xf27c('0x1c')](_0x385053)[_0xf27c('0x20')](function(_0x1941f3){_0x5bb8d0[_0xf27c('0x1c')]=_0x1941f3;if(_0x2e1825[_0xf27c('0x2d')][_0xf27c('0x3a')]){_0x1a1ad6[_0xf27c('0x3b')]=[{'all':!![]}];}return db[_0xf27c('0x27')][_0xf27c('0x3c')](_0x1a1ad6);})[_0xf27c('0x20')](function(_0x51e47d){_0x5bb8d0['rows']=_0x51e47d;return _0x5bb8d0;})[_0xf27c('0x20')](respondWithFilteredResult(_0x58bcaa,_0x1a1ad6))['catch'](handleError(_0x58bcaa,null));};exports[_0xf27c('0x3d')]=function(_0x10662d,_0x4d32ad){var _0x2caaf0={'raw':![],'where':{'id':_0x10662d[_0xf27c('0x3e')]['id']}},_0x314c8b={};_0x314c8b[_0xf27c('0x2c')]=_['keys'](db[_0xf27c('0x27')][_0xf27c('0x28')]);_0x314c8b[_0xf27c('0x2d')]=_[_0xf27c('0x3f')](_0x10662d[_0xf27c('0x2d')]);_0x314c8b[_0xf27c('0x2e')]=_[_0xf27c('0x2f')](_0x314c8b[_0xf27c('0x2c')],_0x314c8b[_0xf27c('0x2d')]);_0x2caaf0[_0xf27c('0x30')]=_[_0xf27c('0x2f')](_0x314c8b[_0xf27c('0x2c')],qs['fields'](_0x10662d[_0xf27c('0x2d')][_0xf27c('0x31')]));_0x2caaf0[_0xf27c('0x30')]=_0x2caaf0['attributes'][_0xf27c('0x32')]?_0x2caaf0[_0xf27c('0x30')]:_0x314c8b[_0xf27c('0x2c')];if(_0x10662d['query'][_0xf27c('0x3a')]){_0x2caaf0[_0xf27c('0x3b')]=[{'all':!![]}];}_0x2caaf0=_[_0xf27c('0x39')]({},_0x2caaf0,_0x10662d[_0xf27c('0x40')]);return db[_0xf27c('0x27')][_0xf27c('0x41')](_0x2caaf0)[_0xf27c('0x20')](handleEntityNotFound(_0x4d32ad,null))['then'](respondWithResult(_0x4d32ad,null))[_0xf27c('0x42')](handleError(_0x4d32ad,null));};exports[_0xf27c('0x43')]=function(_0x54e7aa,_0x187b61){return db[_0xf27c('0x27')]['create'](_0x54e7aa[_0xf27c('0x44')],{})[_0xf27c('0x20')](respondWithResult(_0x187b61,0xc9))[_0xf27c('0x42')](handleError(_0x187b61,null));};exports['update']=function(_0x3fa12e,_0xabadfc){if(_0x3fa12e[_0xf27c('0x44')]['id']){delete _0x3fa12e['body']['id'];}return db[_0xf27c('0x27')][_0xf27c('0x41')]({'where':{'id':_0x3fa12e['params']['id']}})['then'](handleEntityNotFound(_0xabadfc,null))[_0xf27c('0x20')](saveUpdates(_0x3fa12e['body'],null))[_0xf27c('0x20')](respondWithResult(_0xabadfc,null))[_0xf27c('0x42')](handleError(_0xabadfc,null));};exports['destroy']=function(_0x4762f0,_0x3743bd){return db[_0xf27c('0x27')]['find']({'where':{'id':_0x4762f0[_0xf27c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3743bd,null))[_0xf27c('0x20')](removeEntity(_0x3743bd,null))[_0xf27c('0x42')](handleError(_0x3743bd,null));};exports[_0xf27c('0x45')]=function(_0x23174b,_0x4ced37,_0x41c64e){var _0x18419b={};var _0xd0542b={};var _0xf707b0;var _0x26ff2b;return db[_0xf27c('0x27')][_0xf27c('0x46')]({'where':{'id':_0x23174b[_0xf27c('0x3e')]['id']}})[_0xf27c('0x20')](handleEntityNotFound(_0x4ced37,null))[_0xf27c('0x20')](function(_0x73e023){if(_0x73e023){_0xf707b0=_0x73e023;_0xd0542b['model']=_[_0xf27c('0x3f')](db[_0xf27c('0x47')][_0xf27c('0x28')]);_0xd0542b[_0xf27c('0x2d')]=_[_0xf27c('0x3f')](_0x23174b[_0xf27c('0x2d')]);_0xd0542b[_0xf27c('0x2e')]=_[_0xf27c('0x2f')](_0xd0542b[_0xf27c('0x2c')],_0xd0542b[_0xf27c('0x2d')]);_0x18419b[_0xf27c('0x30')]=_['intersection'](_0xd0542b[_0xf27c('0x2c')],qs[_0xf27c('0x31')](_0x23174b[_0xf27c('0x2d')][_0xf27c('0x31')]));_0x18419b['attributes']=_0x18419b[_0xf27c('0x30')][_0xf27c('0x32')]?_0x18419b[_0xf27c('0x30')]:_0xd0542b[_0xf27c('0x2c')];_0x18419b[_0xf27c('0x35')]=qs[_0xf27c('0x36')](_0x23174b[_0xf27c('0x2d')]['sort']);_0x18419b[_0xf27c('0x38')]=qs['filters'](_[_0xf27c('0x48')](_0x23174b[_0xf27c('0x2d')],_0xd0542b[_0xf27c('0x2e')]));if(_0x23174b['query'][_0xf27c('0x37')]){_0x18419b[_0xf27c('0x38')]=_[_0xf27c('0x39')](_0x18419b[_0xf27c('0x38')],{'$or':_[_0xf27c('0x26')](_0x18419b[_0xf27c('0x30')],function(_0x18e332){var _0x5eb2c6={};_0x5eb2c6[_0x18e332]={'$like':'%'+_0x23174b[_0xf27c('0x2d')][_0xf27c('0x37')]+'%'};return _0x5eb2c6;})});}_0x18419b=_[_0xf27c('0x39')]({},_0x18419b,_0x23174b[_0xf27c('0x40')]);return _0xf707b0[_0xf27c('0x45')](_0x18419b);}})[_0xf27c('0x20')](function(_0x4bd89b){if(_0x4bd89b){_0x26ff2b=_0x4bd89b[_0xf27c('0x32')];if(!_0x23174b[_0xf27c('0x2d')][_0xf27c('0x33')](_0xf27c('0x34'))){_0x18419b[_0xf27c('0x1b')]=qs['limit'](_0x23174b[_0xf27c('0x2d')][_0xf27c('0x1b')]);_0x18419b[_0xf27c('0x19')]=qs[_0xf27c('0x19')](_0x23174b[_0xf27c('0x2d')][_0xf27c('0x19')]);}return _0xf707b0[_0xf27c('0x45')](_0x18419b);}})[_0xf27c('0x20')](function(_0x18b7d4){if(_0x18b7d4){return _0x18b7d4?{'count':_0x26ff2b,'rows':_0x18b7d4}:null;}})['then'](respondWithResult(_0x4ced37,null))[_0xf27c('0x42')](handleError(_0x4ced37,null));};exports[_0xf27c('0x49')]=function(_0x533444,_0x2762b8,_0x125bb2){var _0x489575={};var _0x59ad0a={};var _0x3b3795;var _0x29587a;return db[_0xf27c('0x27')][_0xf27c('0x46')]({'where':{'id':_0x533444[_0xf27c('0x3e')]['id']}})[_0xf27c('0x20')](handleEntityNotFound(_0x2762b8,null))['then'](function(_0x2b64e){if(_0x2b64e){_0x3b3795=_0x2b64e;_0x59ad0a[_0xf27c('0x2c')]=_[_0xf27c('0x3f')](db[_0xf27c('0x47')][_0xf27c('0x28')]);_0x59ad0a[_0xf27c('0x2d')]=_[_0xf27c('0x3f')](_0x533444[_0xf27c('0x2d')]);_0x59ad0a[_0xf27c('0x2e')]=_[_0xf27c('0x2f')](_0x59ad0a[_0xf27c('0x2c')],_0x59ad0a[_0xf27c('0x2d')]);_0x489575[_0xf27c('0x30')]=_[_0xf27c('0x2f')](_0x59ad0a[_0xf27c('0x2c')],qs[_0xf27c('0x31')](_0x533444[_0xf27c('0x2d')]['fields']));_0x489575[_0xf27c('0x30')]=_0x489575[_0xf27c('0x30')][_0xf27c('0x32')]?_0x489575[_0xf27c('0x30')]:_0x59ad0a[_0xf27c('0x2c')];_0x489575[_0xf27c('0x35')]=qs[_0xf27c('0x36')](_0x533444['query'][_0xf27c('0x36')]);_0x489575[_0xf27c('0x38')]=qs[_0xf27c('0x2e')](_[_0xf27c('0x48')](_0x533444[_0xf27c('0x2d')],_0x59ad0a[_0xf27c('0x2e')]));if(_0x533444[_0xf27c('0x2d')][_0xf27c('0x37')]){_0x489575[_0xf27c('0x38')]=_[_0xf27c('0x39')](_0x489575['where'],{'$or':_[_0xf27c('0x26')](_0x489575[_0xf27c('0x30')],function(_0x3c02c7){var _0x5e80c4={};_0x5e80c4[_0x3c02c7]={'$like':'%'+_0x533444[_0xf27c('0x2d')]['filter']+'%'};return _0x5e80c4;})});}_0x489575=_[_0xf27c('0x39')]({},_0x489575,_0x533444[_0xf27c('0x40')]);return _0x3b3795[_0xf27c('0x49')](_0x489575);}})['then'](function(_0x585f23){if(_0x585f23){_0x29587a=_0x585f23[_0xf27c('0x32')];if(!_0x533444[_0xf27c('0x2d')]['hasOwnProperty'](_0xf27c('0x34'))){_0x489575[_0xf27c('0x1b')]=qs[_0xf27c('0x1b')](_0x533444[_0xf27c('0x2d')][_0xf27c('0x1b')]);_0x489575[_0xf27c('0x19')]=qs[_0xf27c('0x19')](_0x533444[_0xf27c('0x2d')][_0xf27c('0x19')]);}return _0x3b3795[_0xf27c('0x49')](_0x489575);}})['then'](function(_0xd1ca61){if(_0xd1ca61){return _0xd1ca61?{'count':_0x29587a,'rows':_0xd1ca61}:null;}})[_0xf27c('0x20')](respondWithResult(_0x2762b8,null))[_0xf27c('0x42')](handleError(_0x2762b8,null));};exports[_0xf27c('0x4a')]=function(_0x66505,_0x5dcb24,_0x1ab9c3){var _0x115f2e={};var _0x579f57={};var _0x5d0095;var _0x51c88a;return db[_0xf27c('0x27')][_0xf27c('0x46')]({'where':{'id':_0x66505[_0xf27c('0x3e')]['id']}})[_0xf27c('0x20')](handleEntityNotFound(_0x5dcb24,null))['then'](function(_0x4b959a){if(_0x4b959a){_0x5d0095=_0x4b959a;_0x579f57[_0xf27c('0x2c')]=_[_0xf27c('0x3f')](db['SalesforceField'][_0xf27c('0x28')]);_0x579f57['query']=_[_0xf27c('0x3f')](_0x66505[_0xf27c('0x2d')]);_0x579f57['filters']=_[_0xf27c('0x2f')](_0x579f57[_0xf27c('0x2c')],_0x579f57[_0xf27c('0x2d')]);_0x115f2e['attributes']=_['intersection'](_0x579f57['model'],qs[_0xf27c('0x31')](_0x66505['query'][_0xf27c('0x31')]));_0x115f2e[_0xf27c('0x30')]=_0x115f2e[_0xf27c('0x30')][_0xf27c('0x32')]?_0x115f2e['attributes']:_0x579f57[_0xf27c('0x2c')];_0x115f2e[_0xf27c('0x35')]=qs['sort'](_0x66505[_0xf27c('0x2d')]['sort']);_0x115f2e[_0xf27c('0x38')]=qs[_0xf27c('0x2e')](_[_0xf27c('0x48')](_0x66505[_0xf27c('0x2d')],_0x579f57[_0xf27c('0x2e')]));if(_0x66505['query'][_0xf27c('0x37')]){_0x115f2e[_0xf27c('0x38')]=_[_0xf27c('0x39')](_0x115f2e[_0xf27c('0x38')],{'$or':_[_0xf27c('0x26')](_0x115f2e['attributes'],function(_0x3e010f){var _0x14c231={};_0x14c231[_0x3e010f]={'$like':'%'+_0x66505[_0xf27c('0x2d')][_0xf27c('0x37')]+'%'};return _0x14c231;})});}_0x115f2e=_[_0xf27c('0x39')]({},_0x115f2e,_0x66505[_0xf27c('0x40')]);return _0x5d0095[_0xf27c('0x4a')](_0x115f2e);}})[_0xf27c('0x20')](function(_0x28fdb1){if(_0x28fdb1){_0x51c88a=_0x28fdb1['length'];if(!_0x66505[_0xf27c('0x2d')][_0xf27c('0x33')](_0xf27c('0x34'))){_0x115f2e[_0xf27c('0x1b')]=qs['limit'](_0x66505['query'][_0xf27c('0x1b')]);_0x115f2e['offset']=qs['offset'](_0x66505[_0xf27c('0x2d')][_0xf27c('0x19')]);}return _0x5d0095[_0xf27c('0x4a')](_0x115f2e);}})[_0xf27c('0x20')](function(_0x44928d){if(_0x44928d){return _0x44928d?{'count':_0x51c88a,'rows':_0x44928d}:null;}})[_0xf27c('0x20')](respondWithResult(_0x5dcb24,null))[_0xf27c('0x42')](handleError(_0x5dcb24,null));}; \ No newline at end of file +var _0x629d=['create','body','update','find','params','getFields','SalesforceField','order','hasOwnProperty','findOne','getSubjects','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','end','stack','name','send','index','fieldName','type','key','map','query','model','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','catch','show','keys','rawAttributes','include'];(function(_0x12749f,_0x293255){var _0x3fe381=function(_0x23a92b){while(--_0x23a92b){_0x12749f['push'](_0x12749f['shift']());}};_0x3fe381(++_0x293255);}(_0x629d,0x197));var _0xd629=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0x629d[_0x1bb11e];return _0x422492;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd629('0x0'));var zipdir=require(_0xd629('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd629('0x2'));var BPromise=require(_0xd629('0x3'));var Mustache=require(_0xd629('0x4'));var util=require(_0xd629('0x5'));var path=require('path');var sox=require(_0xd629('0x6'));var csv=require(_0xd629('0x7'));var ejs=require(_0xd629('0x8'));var fs=require('fs');var fs_extra=require(_0xd629('0x9'));var _=require(_0xd629('0xa'));var squel=require('squel');var crypto=require(_0xd629('0xb'));var jsforce=require(_0xd629('0xc'));var deskjs=require(_0xd629('0xd'));var toCsv=require(_0xd629('0x7'));var querystring=require(_0xd629('0xe'));var Papa=require(_0xd629('0xf'));var Redis=require(_0xd629('0x10'));var authService=require(_0xd629('0x11'));var qs=require(_0xd629('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd629('0x13'));var logger=require('../../config/logger')(_0xd629('0x14'));var utils=require('../../config/utils');var config=require(_0xd629('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd629('0x16'))['db'];function respondWithStatusCode(_0x29eeb9,_0x3c3d6c){_0x3c3d6c=_0x3c3d6c||0xcc;return function(_0x33e595){if(_0x33e595){return _0x29eeb9[_0xd629('0x17')](_0x3c3d6c);}return _0x29eeb9[_0xd629('0x18')](_0x3c3d6c)['end']();};}function respondWithResult(_0x3b3998,_0x14a71b){_0x14a71b=_0x14a71b||0xc8;return function(_0x5583d1){if(_0x5583d1){return _0x3b3998[_0xd629('0x18')](_0x14a71b)[_0xd629('0x19')](_0x5583d1);}};}function respondWithFilteredResult(_0xda3da4,_0x3af381){return function(_0x4b027b){if(_0x4b027b){var _0x546350=typeof _0x3af381[_0xd629('0x1a')]==='undefined'&&typeof _0x3af381[_0xd629('0x1b')]===_0xd629('0x1c');var _0x1498b9=_0x4b027b[_0xd629('0x1d')];var _0xbaeecc=_0x546350?0x0:_0x3af381[_0xd629('0x1a')];var _0x223565=_0x546350?_0x4b027b['count']:_0x3af381[_0xd629('0x1a')]+_0x3af381['limit'];var _0x1da39e;if(_0x223565>=_0x1498b9){_0x223565=_0x1498b9;_0x1da39e=0xc8;}else{_0x1da39e=0xce;}_0xda3da4[_0xd629('0x18')](_0x1da39e);return _0xda3da4[_0xd629('0x1e')](_0xd629('0x1f'),_0xbaeecc+'-'+_0x223565+'/'+_0x1498b9)[_0xd629('0x19')](_0x4b027b);}return null;};}function patchUpdates(_0x4cdab1){return function(_0x55fd82){try{jsonpatch[_0xd629('0x20')](_0x55fd82,_0x4cdab1,!![]);}catch(_0x2138e3){return BPromise['reject'](_0x2138e3);}return _0x55fd82[_0xd629('0x21')]();};}function saveUpdates(_0x2f8636,_0x16980d){return function(_0x2ec8a6){if(_0x2ec8a6){return _0x2ec8a6['update'](_0x2f8636)['then'](function(_0x1e56c2){return _0x1e56c2;});}return null;};}function removeEntity(_0x200cef,_0x402312){return function(_0x42d019){if(_0x42d019){return _0x42d019[_0xd629('0x22')]()[_0xd629('0x23')](function(){_0x200cef[_0xd629('0x18')](0xcc)[_0xd629('0x24')]();});}};}function handleEntityNotFound(_0x49b92e,_0x26a007){return function(_0x557707){if(!_0x557707){_0x49b92e[_0xd629('0x17')](0x194);}return _0x557707;};}function handleError(_0x3b9171,_0x2dc5aa){_0x2dc5aa=_0x2dc5aa||0x1f4;return function(_0x2f31dc){logger['error'](_0x2f31dc[_0xd629('0x25')]);if(_0x2f31dc[_0xd629('0x26')]){delete _0x2f31dc[_0xd629('0x26')];}_0x3b9171['status'](_0x2dc5aa)[_0xd629('0x27')](_0x2f31dc);};}exports[_0xd629('0x28')]=function(_0x447331,_0x1fe9a0){var _0x54afca={},_0x78dcff={},_0x2e6b11={'count':0x0,'rows':[]};var _0x5e0e9f=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0xa85b3c){return{'name':_0xa85b3c[_0xd629('0x29')],'type':_0xa85b3c[_0xd629('0x2a')][_0xd629('0x2b')]};});_0x78dcff['model']=_[_0xd629('0x2c')](_0x5e0e9f,_0xd629('0x26'));_0x78dcff['query']=_['keys'](_0x447331[_0xd629('0x2d')]);_0x78dcff['filters']=_['intersection'](_0x78dcff[_0xd629('0x2e')],_0x78dcff['query']);_0x54afca[_0xd629('0x2f')]=_[_0xd629('0x30')](_0x78dcff['model'],qs['fields'](_0x447331['query'][_0xd629('0x31')]));_0x54afca[_0xd629('0x2f')]=_0x54afca[_0xd629('0x2f')][_0xd629('0x32')]?_0x54afca[_0xd629('0x2f')]:_0x78dcff[_0xd629('0x2e')];if(!_0x447331[_0xd629('0x2d')]['hasOwnProperty'](_0xd629('0x33'))){_0x54afca[_0xd629('0x1b')]=qs[_0xd629('0x1b')](_0x447331[_0xd629('0x2d')][_0xd629('0x1b')]);_0x54afca[_0xd629('0x1a')]=qs[_0xd629('0x1a')](_0x447331[_0xd629('0x2d')][_0xd629('0x1a')]);}_0x54afca['order']=qs['sort'](_0x447331[_0xd629('0x2d')][_0xd629('0x34')]);_0x54afca['where']=qs[_0xd629('0x35')](_[_0xd629('0x36')](_0x447331[_0xd629('0x2d')],_0x78dcff[_0xd629('0x35')]),_0x5e0e9f);if(_0x447331[_0xd629('0x2d')][_0xd629('0x37')]){_0x54afca[_0xd629('0x38')]=_['merge'](_0x54afca[_0xd629('0x38')],{'$or':_['map'](_0x5e0e9f,function(_0x28faaf){if(_0x28faaf[_0xd629('0x2a')]!==_0xd629('0x39')){var _0x3073ed={};_0x3073ed[_0x28faaf[_0xd629('0x26')]]={'$like':'%'+_0x447331[_0xd629('0x2d')][_0xd629('0x37')]+'%'};return _0x3073ed;}})});}_0x54afca=_[_0xd629('0x3a')]({},_0x54afca,_0x447331[_0xd629('0x3b')]);var _0x3173e4={'where':_0x54afca[_0xd629('0x38')]};return db[_0xd629('0x3c')][_0xd629('0x1d')](_0x3173e4)[_0xd629('0x23')](function(_0x40893a){_0x2e6b11[_0xd629('0x1d')]=_0x40893a;if(_0x447331[_0xd629('0x2d')][_0xd629('0x3d')]){_0x54afca['include']=[{'all':!![]}];}return db[_0xd629('0x3c')]['findAll'](_0x54afca);})[_0xd629('0x23')](function(_0x1b1064){_0x2e6b11['rows']=_0x1b1064;return _0x2e6b11;})['then'](respondWithFilteredResult(_0x1fe9a0,_0x54afca))[_0xd629('0x3e')](handleError(_0x1fe9a0,null));};exports[_0xd629('0x3f')]=function(_0x21b272,_0x31804b){var _0x18b502={'raw':![],'where':{'id':_0x21b272['params']['id']}},_0x4d868b={};_0x4d868b[_0xd629('0x2e')]=_[_0xd629('0x40')](db['SalesforceConfiguration'][_0xd629('0x41')]);_0x4d868b['query']=_['keys'](_0x21b272[_0xd629('0x2d')]);_0x4d868b[_0xd629('0x35')]=_[_0xd629('0x30')](_0x4d868b[_0xd629('0x2e')],_0x4d868b['query']);_0x18b502[_0xd629('0x2f')]=_[_0xd629('0x30')](_0x4d868b[_0xd629('0x2e')],qs['fields'](_0x21b272[_0xd629('0x2d')]['fields']));_0x18b502[_0xd629('0x2f')]=_0x18b502['attributes']['length']?_0x18b502[_0xd629('0x2f')]:_0x4d868b[_0xd629('0x2e')];if(_0x21b272[_0xd629('0x2d')][_0xd629('0x3d')]){_0x18b502[_0xd629('0x42')]=[{'all':!![]}];}_0x18b502=_[_0xd629('0x3a')]({},_0x18b502,_0x21b272['options']);return db['SalesforceConfiguration']['find'](_0x18b502)['then'](handleEntityNotFound(_0x31804b,null))[_0xd629('0x23')](respondWithResult(_0x31804b,null))[_0xd629('0x3e')](handleError(_0x31804b,null));};exports[_0xd629('0x43')]=function(_0x457998,_0x46e5b3){return db[_0xd629('0x3c')]['create'](_0x457998[_0xd629('0x44')],{})[_0xd629('0x23')](respondWithResult(_0x46e5b3,0xc9))[_0xd629('0x3e')](handleError(_0x46e5b3,null));};exports[_0xd629('0x45')]=function(_0xd71af9,_0x579987){if(_0xd71af9[_0xd629('0x44')]['id']){delete _0xd71af9[_0xd629('0x44')]['id'];}return db[_0xd629('0x3c')][_0xd629('0x46')]({'where':{'id':_0xd71af9[_0xd629('0x47')]['id']}})['then'](handleEntityNotFound(_0x579987,null))[_0xd629('0x23')](saveUpdates(_0xd71af9['body'],null))[_0xd629('0x23')](respondWithResult(_0x579987,null))['catch'](handleError(_0x579987,null));};exports['destroy']=function(_0x41609d,_0xa35092){return db[_0xd629('0x3c')][_0xd629('0x46')]({'where':{'id':_0x41609d[_0xd629('0x47')]['id']}})['then'](handleEntityNotFound(_0xa35092,null))[_0xd629('0x23')](removeEntity(_0xa35092,null))[_0xd629('0x3e')](handleError(_0xa35092,null));};exports[_0xd629('0x48')]=function(_0x4af111,_0x1cb3cd,_0x3e06ec){var _0x300b79={};var _0x4ae6e7={};var _0x209e18;var _0x475558;return db[_0xd629('0x3c')]['findOne']({'where':{'id':_0x4af111[_0xd629('0x47')]['id']}})[_0xd629('0x23')](handleEntityNotFound(_0x1cb3cd,null))[_0xd629('0x23')](function(_0x466c6a){if(_0x466c6a){_0x209e18=_0x466c6a;_0x4ae6e7[_0xd629('0x2e')]=_[_0xd629('0x40')](db[_0xd629('0x49')][_0xd629('0x41')]);_0x4ae6e7[_0xd629('0x2d')]=_[_0xd629('0x40')](_0x4af111[_0xd629('0x2d')]);_0x4ae6e7[_0xd629('0x35')]=_['intersection'](_0x4ae6e7[_0xd629('0x2e')],_0x4ae6e7[_0xd629('0x2d')]);_0x300b79[_0xd629('0x2f')]=_[_0xd629('0x30')](_0x4ae6e7[_0xd629('0x2e')],qs[_0xd629('0x31')](_0x4af111['query'][_0xd629('0x31')]));_0x300b79[_0xd629('0x2f')]=_0x300b79[_0xd629('0x2f')][_0xd629('0x32')]?_0x300b79['attributes']:_0x4ae6e7[_0xd629('0x2e')];_0x300b79[_0xd629('0x4a')]=qs[_0xd629('0x34')](_0x4af111[_0xd629('0x2d')]['sort']);_0x300b79[_0xd629('0x38')]=qs[_0xd629('0x35')](_[_0xd629('0x36')](_0x4af111[_0xd629('0x2d')],_0x4ae6e7[_0xd629('0x35')]));if(_0x4af111['query'][_0xd629('0x37')]){_0x300b79[_0xd629('0x38')]=_[_0xd629('0x3a')](_0x300b79[_0xd629('0x38')],{'$or':_[_0xd629('0x2c')](_0x300b79[_0xd629('0x2f')],function(_0x1d05a3){var _0x31546e={};_0x31546e[_0x1d05a3]={'$like':'%'+_0x4af111[_0xd629('0x2d')]['filter']+'%'};return _0x31546e;})});}_0x300b79=_[_0xd629('0x3a')]({},_0x300b79,_0x4af111[_0xd629('0x3b')]);return _0x209e18[_0xd629('0x48')](_0x300b79);}})[_0xd629('0x23')](function(_0x1aa54e){if(_0x1aa54e){_0x475558=_0x1aa54e[_0xd629('0x32')];if(!_0x4af111[_0xd629('0x2d')][_0xd629('0x4b')](_0xd629('0x33'))){_0x300b79[_0xd629('0x1b')]=qs[_0xd629('0x1b')](_0x4af111['query']['limit']);_0x300b79[_0xd629('0x1a')]=qs[_0xd629('0x1a')](_0x4af111[_0xd629('0x2d')][_0xd629('0x1a')]);}return _0x209e18[_0xd629('0x48')](_0x300b79);}})[_0xd629('0x23')](function(_0x188ca7){if(_0x188ca7){return _0x188ca7?{'count':_0x475558,'rows':_0x188ca7}:null;}})[_0xd629('0x23')](respondWithResult(_0x1cb3cd,null))[_0xd629('0x3e')](handleError(_0x1cb3cd,null));};exports['getSubjects']=function(_0x4368a7,_0x2add6f,_0x510117){var _0x47c8b8={};var _0x8ec7a={};var _0x279cec;var _0x30dcf8;return db[_0xd629('0x3c')][_0xd629('0x4c')]({'where':{'id':_0x4368a7['params']['id']}})['then'](handleEntityNotFound(_0x2add6f,null))[_0xd629('0x23')](function(_0x15e8a1){if(_0x15e8a1){_0x279cec=_0x15e8a1;_0x8ec7a[_0xd629('0x2e')]=_['keys'](db[_0xd629('0x49')][_0xd629('0x41')]);_0x8ec7a[_0xd629('0x2d')]=_[_0xd629('0x40')](_0x4368a7[_0xd629('0x2d')]);_0x8ec7a[_0xd629('0x35')]=_['intersection'](_0x8ec7a['model'],_0x8ec7a[_0xd629('0x2d')]);_0x47c8b8[_0xd629('0x2f')]=_[_0xd629('0x30')](_0x8ec7a[_0xd629('0x2e')],qs[_0xd629('0x31')](_0x4368a7[_0xd629('0x2d')][_0xd629('0x31')]));_0x47c8b8[_0xd629('0x2f')]=_0x47c8b8[_0xd629('0x2f')]['length']?_0x47c8b8[_0xd629('0x2f')]:_0x8ec7a[_0xd629('0x2e')];_0x47c8b8[_0xd629('0x4a')]=qs['sort'](_0x4368a7[_0xd629('0x2d')][_0xd629('0x34')]);_0x47c8b8[_0xd629('0x38')]=qs[_0xd629('0x35')](_['pick'](_0x4368a7['query'],_0x8ec7a[_0xd629('0x35')]));if(_0x4368a7[_0xd629('0x2d')]['filter']){_0x47c8b8[_0xd629('0x38')]=_[_0xd629('0x3a')](_0x47c8b8['where'],{'$or':_['map'](_0x47c8b8[_0xd629('0x2f')],function(_0x3180ea){var _0xa659ed={};_0xa659ed[_0x3180ea]={'$like':'%'+_0x4368a7[_0xd629('0x2d')]['filter']+'%'};return _0xa659ed;})});}_0x47c8b8=_[_0xd629('0x3a')]({},_0x47c8b8,_0x4368a7[_0xd629('0x3b')]);return _0x279cec[_0xd629('0x4d')](_0x47c8b8);}})['then'](function(_0x40c93e){if(_0x40c93e){_0x30dcf8=_0x40c93e[_0xd629('0x32')];if(!_0x4368a7[_0xd629('0x2d')][_0xd629('0x4b')](_0xd629('0x33'))){_0x47c8b8[_0xd629('0x1b')]=qs[_0xd629('0x1b')](_0x4368a7[_0xd629('0x2d')][_0xd629('0x1b')]);_0x47c8b8[_0xd629('0x1a')]=qs[_0xd629('0x1a')](_0x4368a7[_0xd629('0x2d')][_0xd629('0x1a')]);}return _0x279cec[_0xd629('0x4d')](_0x47c8b8);}})[_0xd629('0x23')](function(_0x464eb2){if(_0x464eb2){return _0x464eb2?{'count':_0x30dcf8,'rows':_0x464eb2}:null;}})[_0xd629('0x23')](respondWithResult(_0x2add6f,null))['catch'](handleError(_0x2add6f,null));};exports[_0xd629('0x4e')]=function(_0x44f884,_0x52272a,_0x182d13){var _0x178937={};var _0x100c81={};var _0x18464b;var _0x32a737;return db[_0xd629('0x3c')][_0xd629('0x4c')]({'where':{'id':_0x44f884['params']['id']}})[_0xd629('0x23')](handleEntityNotFound(_0x52272a,null))['then'](function(_0x8395b9){if(_0x8395b9){_0x18464b=_0x8395b9;_0x100c81['model']=_[_0xd629('0x40')](db[_0xd629('0x49')][_0xd629('0x41')]);_0x100c81[_0xd629('0x2d')]=_['keys'](_0x44f884[_0xd629('0x2d')]);_0x100c81[_0xd629('0x35')]=_['intersection'](_0x100c81[_0xd629('0x2e')],_0x100c81[_0xd629('0x2d')]);_0x178937[_0xd629('0x2f')]=_[_0xd629('0x30')](_0x100c81['model'],qs[_0xd629('0x31')](_0x44f884[_0xd629('0x2d')][_0xd629('0x31')]));_0x178937[_0xd629('0x2f')]=_0x178937['attributes'][_0xd629('0x32')]?_0x178937[_0xd629('0x2f')]:_0x100c81[_0xd629('0x2e')];_0x178937[_0xd629('0x4a')]=qs[_0xd629('0x34')](_0x44f884['query'][_0xd629('0x34')]);_0x178937[_0xd629('0x38')]=qs[_0xd629('0x35')](_[_0xd629('0x36')](_0x44f884[_0xd629('0x2d')],_0x100c81['filters']));if(_0x44f884[_0xd629('0x2d')]['filter']){_0x178937[_0xd629('0x38')]=_[_0xd629('0x3a')](_0x178937['where'],{'$or':_['map'](_0x178937[_0xd629('0x2f')],function(_0x3afc41){var _0x1c0717={};_0x1c0717[_0x3afc41]={'$like':'%'+_0x44f884[_0xd629('0x2d')][_0xd629('0x37')]+'%'};return _0x1c0717;})});}_0x178937=_['merge']({},_0x178937,_0x44f884['options']);return _0x18464b['getDescriptions'](_0x178937);}})[_0xd629('0x23')](function(_0x4ccdbc){if(_0x4ccdbc){_0x32a737=_0x4ccdbc[_0xd629('0x32')];if(!_0x44f884[_0xd629('0x2d')][_0xd629('0x4b')]('nolimit')){_0x178937['limit']=qs[_0xd629('0x1b')](_0x44f884[_0xd629('0x2d')][_0xd629('0x1b')]);_0x178937[_0xd629('0x1a')]=qs['offset'](_0x44f884[_0xd629('0x2d')][_0xd629('0x1a')]);}return _0x18464b['getDescriptions'](_0x178937);}})['then'](function(_0x1a2e2d){if(_0x1a2e2d){return _0x1a2e2d?{'count':_0x32a737,'rows':_0x1a2e2d}:null;}})[_0xd629('0x23')](respondWithResult(_0x52272a,null))['catch'](handleError(_0x52272a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e81a11a..90b00e0 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 _0xb81d=['int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb81d,0x105));var _0xdb81=function(_0x48f62a,_0x45704f){_0x48f62a=_0x48f62a-0x0;var _0x3eac07=_0xb81d[_0x48f62a];return _0x3eac07;};'use strict';var _=require(_0xdb81('0x0'));var util=require(_0xdb81('0x1'));var logger=require(_0xdb81('0x2'))(_0xdb81('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb81('0x4'));var fs=require('fs');var path=require(_0xdb81('0x5'));var rimraf=require(_0xdb81('0x6'));var config=require(_0xdb81('0x7'));var attributes=require(_0xdb81('0x8'));module[_0xdb81('0x9')]=function(_0x1a6322,_0x69341){return _0x1a6322[_0xdb81('0xa')](_0xdb81('0xb'),attributes,{'tableName':_0xdb81('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x629a=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0xfa36b7,_0x599858){var _0x20f8ce=function(_0x374980){while(--_0x374980){_0xfa36b7['push'](_0xfa36b7['shift']());}};_0x20f8ce(++_0x599858);}(_0x629a,0x161));var _0xa629=function(_0x2a2e3a,_0x3d6be3){_0x2a2e3a=_0x2a2e3a-0x0;var _0x25c324=_0x629a[_0x2a2e3a];return _0x25c324;};'use strict';var _=require(_0xa629('0x0'));var util=require(_0xa629('0x1'));var logger=require(_0xa629('0x2'))(_0xa629('0x3'));var moment=require(_0xa629('0x4'));var BPromise=require('bluebird');var rp=require(_0xa629('0x5'));var fs=require('fs');var path=require(_0xa629('0x6'));var rimraf=require('rimraf');var config=require(_0xa629('0x7'));var attributes=require(_0xa629('0x8'));module[_0xa629('0x9')]=function(_0x46c9a1,_0x46ae83){return _0x46c9a1['define']('SalesforceConfiguration',attributes,{'tableName':_0xa629('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 54db9cf..706ffbd 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 _0x043f=['info','debug','request\x20sent','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4493de,_0x5bbecc){var _0x113682=function(_0x89a705){while(--_0x89a705){_0x4493de['push'](_0x4493de['shift']());}};_0x113682(++_0x5bbecc);}(_0x043f,0x197));var _0xf043=function(_0x13635d,_0x14d83e){_0x13635d=_0x13635d-0x0;var _0x3505b9=_0x043f[_0x13635d];return _0x3505b9;};'use strict';var _=require(_0xf043('0x0'));var util=require('util');var moment=require(_0xf043('0x1'));var BPromise=require(_0xf043('0x2'));var rs=require(_0xf043('0x3'));var fs=require('fs');var Redis=require(_0xf043('0x4'));var db=require(_0xf043('0x5'))['db'];var utils=require(_0xf043('0x6'));var logger=require('../../config/logger')(_0xf043('0x7'));var config=require(_0xf043('0x8'));var jayson=require(_0xf043('0x9'));var client=jayson['client'][_0xf043('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cd937,_0x579831,_0x8b0338){return new BPromise(function(_0x3cb54d,_0x41f618){return client[_0xf043('0xb')](_0x1cd937,_0x8b0338)[_0xf043('0xc')](function(_0x297552){logger[_0xf043('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x579831,'request\x20sent');logger[_0xf043('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x579831,_0xf043('0xf'),JSON['stringify'](_0x297552));if(_0x297552[_0xf043('0x10')]){if(_0x297552[_0xf043('0x10')]['code']===0x1f4){logger[_0xf043('0x10')](_0xf043('0x11'),_0x579831,_0x297552[_0xf043('0x10')][_0xf043('0x12')]);return _0x41f618(_0x297552[_0xf043('0x10')][_0xf043('0x12')]);}logger['error'](_0xf043('0x11'),_0x579831,_0x297552[_0xf043('0x10')]['message']);return _0x3cb54d(_0x297552['error']['message']);}else{logger[_0xf043('0xd')](_0xf043('0x11'),_0x579831,_0xf043('0xf'));_0x3cb54d(_0x297552[_0xf043('0x13')][_0xf043('0x12')]);}})['catch'](function(_0x179f92){logger[_0xf043('0x10')](_0xf043('0x11'),_0x579831,_0x179f92);_0x41f618(_0x179f92);});});} \ No newline at end of file +var _0x700c=['error','code','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1b5080,_0x3e7cc9){var _0x195c87=function(_0x1ef917){while(--_0x1ef917){_0x1b5080['push'](_0x1b5080['shift']());}};_0x195c87(++_0x3e7cc9);}(_0x700c,0x116));var _0xc700=function(_0x1e7eff,_0x57b53c){_0x1e7eff=_0x1e7eff-0x0;var _0x34c078=_0x700c[_0x1e7eff];return _0x34c078;};'use strict';var _=require(_0xc700('0x0'));var util=require(_0xc700('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc700('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc700('0x3'))['db'];var utils=require(_0xc700('0x4'));var logger=require('../../config/logger')(_0xc700('0x5'));var config=require('../../config/environment');var jayson=require(_0xc700('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34e609,_0x46fa40,_0x7a2304){return new BPromise(function(_0x217621,_0x4379e1){return client[_0xc700('0x7')](_0x34e609,_0x7a2304)['then'](function(_0xad1a86){logger['info'](_0xc700('0x8'),_0x46fa40,_0xc700('0x9'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x46fa40,_0xc700('0x9'),JSON[_0xc700('0xa')](_0xad1a86));if(_0xad1a86[_0xc700('0xb')]){if(_0xad1a86[_0xc700('0xb')][_0xc700('0xc')]===0x1f4){logger[_0xc700('0xb')](_0xc700('0x8'),_0x46fa40,_0xad1a86[_0xc700('0xb')]['message']);return _0x4379e1(_0xad1a86['error'][_0xc700('0xd')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x46fa40,_0xad1a86[_0xc700('0xb')][_0xc700('0xd')]);return _0x217621(_0xad1a86[_0xc700('0xb')][_0xc700('0xd')]);}else{logger[_0xc700('0xe')](_0xc700('0x8'),_0x46fa40,_0xc700('0x9'));_0x217621(_0xad1a86[_0xc700('0xf')][_0xc700('0xd')]);}})[_0xc700('0x10')](function(_0x37c0d9){logger[_0xc700('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46fa40,_0x37c0d9);_0x4379e1(_0x37c0d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b5b3d5e..a6ac55e 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 _0xe89e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x44e111,_0x427b22){var _0x551dc2=function(_0x5902b2){while(--_0x5902b2){_0x44e111['push'](_0x44e111['shift']());}};_0x551dc2(++_0x427b22);}(_0xe89e,0x160));var _0xee89=function(_0x1ab919,_0x3b6624){_0x1ab919=_0x1ab919-0x0;var _0x2e2795=_0xe89e[_0x1ab919];return _0x2e2795;};'use strict';var multer=require(_0xee89('0x0'));var util=require(_0xee89('0x1'));var path=require(_0xee89('0x2'));var timeout=require(_0xee89('0x3'));var express=require(_0xee89('0x4'));var router=express[_0xee89('0x5')]();var fs_extra=require(_0xee89('0x6'));var auth=require(_0xee89('0x7'));var interaction=require(_0xee89('0x8'));var config=require(_0xee89('0x9'));var controller=require(_0xee89('0xa'));router[_0xee89('0xb')]('/',auth[_0xee89('0xc')](),controller[_0xee89('0xd')]);router[_0xee89('0xb')](_0xee89('0xe'),auth['isAuthenticated'](),controller[_0xee89('0xf')]);router['post']('/',auth[_0xee89('0xc')](),controller[_0xee89('0x10')]);router[_0xee89('0x11')]('/:id',auth[_0xee89('0xc')](),controller['update']);router[_0xee89('0x12')](_0xee89('0xe'),auth['isAuthenticated'](),controller[_0xee89('0x13')]);module[_0xee89('0x14')]=router; \ No newline at end of file +var _0x4df2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x357d20,_0x29446e){var _0x78d39f=function(_0x18625b){while(--_0x18625b){_0x357d20['push'](_0x357d20['shift']());}};_0x78d39f(++_0x29446e);}(_0x4df2,0x11b));var _0x24df=function(_0x5048ee,_0x2f7198){_0x5048ee=_0x5048ee-0x0;var _0x1c77ad=_0x4df2[_0x5048ee];return _0x1c77ad;};'use strict';var multer=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var path=require(_0x24df('0x2'));var timeout=require(_0x24df('0x3'));var express=require(_0x24df('0x4'));var router=express[_0x24df('0x5')]();var fs_extra=require(_0x24df('0x6'));var auth=require(_0x24df('0x7'));var interaction=require(_0x24df('0x8'));var config=require(_0x24df('0x9'));var controller=require(_0x24df('0xa'));router[_0x24df('0xb')]('/',auth[_0x24df('0xc')](),controller[_0x24df('0xd')]);router[_0x24df('0xb')](_0x24df('0xe'),auth[_0x24df('0xc')](),controller['show']);router['post']('/',auth[_0x24df('0xc')](),controller[_0x24df('0xf')]);router[_0x24df('0x10')]('/:id',auth[_0x24df('0xc')](),controller['update']);router[_0x24df('0x11')]('/:id',auth[_0x24df('0xc')](),controller[_0x24df('0x12')]);module[_0x24df('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6e4ee9d..7190fb7 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 _0xf081=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x362882,_0x3012cf){var _0x4632c9=function(_0x1cdbb8){while(--_0x1cdbb8){_0x362882['push'](_0x362882['shift']());}};_0x4632c9(++_0x3012cf);}(_0xf081,0x77));var _0x1f08=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xf081[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0x1f08('0x0'));module['exports']={'type':{'type':Sequelize[_0x1f08('0x1')](_0x1f08('0x2'),_0x1f08('0x3'),_0x1f08('0x4'),'keyValue',_0x1f08('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1f08('0x6')]},'key':{'type':Sequelize[_0x1f08('0x6')]},'keyType':{'type':Sequelize[_0x1f08('0x1')](_0x1f08('0x2'),_0x1f08('0x3'),_0x1f08('0x4'))},'keyContent':{'type':Sequelize[_0x1f08('0x6')]},'idField':{'type':Sequelize[_0x1f08('0x6')]},'variableName':{'type':Sequelize[_0x1f08('0x6')]}}; \ No newline at end of file +var _0xd5d4=['picklist','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0xa0cecb,_0xfa59fd){var _0x382e2=function(_0x493814){while(--_0x493814){_0xa0cecb['push'](_0xa0cecb['shift']());}};_0x382e2(++_0xfa59fd);}(_0xd5d4,0x112));var _0x4d5d=function(_0xc59d5d,_0x5a6b47){_0xc59d5d=_0xc59d5d-0x0;var _0x3771b1=_0xd5d4[_0xc59d5d];return _0x3771b1;};'use strict';var Sequelize=require(_0x4d5d('0x0'));module[_0x4d5d('0x1')]={'type':{'type':Sequelize[_0x4d5d('0x2')]('string',_0x4d5d('0x3'),_0x4d5d('0x4'),_0x4d5d('0x5'),_0x4d5d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4d5d('0x7')]},'key':{'type':Sequelize[_0x4d5d('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4d5d('0x3'),_0x4d5d('0x4'))},'keyContent':{'type':Sequelize[_0x4d5d('0x7')]},'idField':{'type':Sequelize[_0x4d5d('0x7')]},'variableName':{'type':Sequelize[_0x4d5d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 83b9e83..d02560e 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 _0x9e9e=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','catch','params','keys','include','find','body','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','error','stack','send','index','map','SalesforceField','rawAttributes','type','query','filters'];(function(_0x1cc3bf,_0x132423){var _0xa6afef=function(_0x44bb18){while(--_0x44bb18){_0x1cc3bf['push'](_0x1cc3bf['shift']());}};_0xa6afef(++_0x132423);}(_0x9e9e,0xa4));var _0xe9e9=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x9e9e[_0x3aeb36];return _0xa2ef21;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9e9('0x0'));var jsonpatch=require(_0xe9e9('0x1'));var rp=require('request-promise');var moment=require(_0xe9e9('0x2'));var BPromise=require(_0xe9e9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9e9('0x4'));var sox=require(_0xe9e9('0x5'));var csv=require(_0xe9e9('0x6'));var ejs=require(_0xe9e9('0x7'));var fs=require('fs');var fs_extra=require(_0xe9e9('0x8'));var _=require(_0xe9e9('0x9'));var squel=require(_0xe9e9('0xa'));var crypto=require('crypto');var jsforce=require(_0xe9e9('0xb'));var deskjs=require(_0xe9e9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe9e9('0xd'));var Papa=require(_0xe9e9('0xe'));var Redis=require(_0xe9e9('0xf'));var authService=require(_0xe9e9('0x10'));var qs=require(_0xe9e9('0x11'));var as=require(_0xe9e9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe9e9('0x13'));var config=require(_0xe9e9('0x14'));var licenseUtil=require(_0xe9e9('0x15'));var db=require(_0xe9e9('0x16'))['db'];function respondWithStatusCode(_0x151209,_0x2bd7ac){_0x2bd7ac=_0x2bd7ac||0xcc;return function(_0x4b3bd0){if(_0x4b3bd0){return _0x151209[_0xe9e9('0x17')](_0x2bd7ac);}return _0x151209[_0xe9e9('0x18')](_0x2bd7ac)[_0xe9e9('0x19')]();};}function respondWithResult(_0x28fad0,_0x57325d){_0x57325d=_0x57325d||0xc8;return function(_0x226aad){if(_0x226aad){return _0x28fad0[_0xe9e9('0x18')](_0x57325d)[_0xe9e9('0x1a')](_0x226aad);}};}function respondWithFilteredResult(_0xb13d50,_0x26cd8a){return function(_0x44359a){if(_0x44359a){var _0x1d20ba=typeof _0x26cd8a[_0xe9e9('0x1b')]===_0xe9e9('0x1c')&&typeof _0x26cd8a[_0xe9e9('0x1d')]===_0xe9e9('0x1c');var _0xa0679c=_0x44359a[_0xe9e9('0x1e')];var _0x54df65=_0x1d20ba?0x0:_0x26cd8a[_0xe9e9('0x1b')];var _0x4ffcfe=_0x1d20ba?_0x44359a['count']:_0x26cd8a[_0xe9e9('0x1b')]+_0x26cd8a[_0xe9e9('0x1d')];var _0xb0266d;if(_0x4ffcfe>=_0xa0679c){_0x4ffcfe=_0xa0679c;_0xb0266d=0xc8;}else{_0xb0266d=0xce;}_0xb13d50[_0xe9e9('0x18')](_0xb0266d);return _0xb13d50['set'](_0xe9e9('0x1f'),_0x54df65+'-'+_0x4ffcfe+'/'+_0xa0679c)[_0xe9e9('0x1a')](_0x44359a);}return null;};}function patchUpdates(_0x1f5b44){return function(_0x5e633f){try{jsonpatch[_0xe9e9('0x20')](_0x5e633f,_0x1f5b44,!![]);}catch(_0x27fee0){return BPromise['reject'](_0x27fee0);}return _0x5e633f['save']();};}function saveUpdates(_0x57c2ba,_0x407c44){return function(_0x115602){if(_0x115602){return _0x115602[_0xe9e9('0x21')](_0x57c2ba)['then'](function(_0x59ea07){return _0x59ea07;});}return null;};}function removeEntity(_0x4efd97,_0x1fdba1){return function(_0x559cbd){if(_0x559cbd){return _0x559cbd[_0xe9e9('0x22')]()[_0xe9e9('0x23')](function(){_0x4efd97[_0xe9e9('0x18')](0xcc)[_0xe9e9('0x19')]();});}};}function handleEntityNotFound(_0x26a44d,_0x350748){return function(_0x19a2de){if(!_0x19a2de){_0x26a44d[_0xe9e9('0x17')](0x194);}return _0x19a2de;};}function handleError(_0x5caad7,_0x576b05){_0x576b05=_0x576b05||0x1f4;return function(_0xdf4bef){logger[_0xe9e9('0x24')](_0xdf4bef[_0xe9e9('0x25')]);if(_0xdf4bef['name']){delete _0xdf4bef['name'];}_0x5caad7[_0xe9e9('0x18')](_0x576b05)[_0xe9e9('0x26')](_0xdf4bef);};}exports[_0xe9e9('0x27')]=function(_0x4d32ba,_0x177609){var _0x2d9714={},_0xcd825e={},_0x1ec8f8={'count':0x0,'rows':[]};var _0x5ed85b=_[_0xe9e9('0x28')](db[_0xe9e9('0x29')][_0xe9e9('0x2a')],function(_0x1df3d){return{'name':_0x1df3d['fieldName'],'type':_0x1df3d[_0xe9e9('0x2b')]['key']};});_0xcd825e['model']=_[_0xe9e9('0x28')](_0x5ed85b,'name');_0xcd825e[_0xe9e9('0x2c')]=_['keys'](_0x4d32ba['query']);_0xcd825e[_0xe9e9('0x2d')]=_['intersection'](_0xcd825e[_0xe9e9('0x2e')],_0xcd825e[_0xe9e9('0x2c')]);_0x2d9714[_0xe9e9('0x2f')]=_[_0xe9e9('0x30')](_0xcd825e['model'],qs['fields'](_0x4d32ba[_0xe9e9('0x2c')][_0xe9e9('0x31')]));_0x2d9714[_0xe9e9('0x2f')]=_0x2d9714[_0xe9e9('0x2f')][_0xe9e9('0x32')]?_0x2d9714[_0xe9e9('0x2f')]:_0xcd825e[_0xe9e9('0x2e')];if(!_0x4d32ba[_0xe9e9('0x2c')][_0xe9e9('0x33')](_0xe9e9('0x34'))){_0x2d9714[_0xe9e9('0x1d')]=qs['limit'](_0x4d32ba[_0xe9e9('0x2c')]['limit']);_0x2d9714[_0xe9e9('0x1b')]=qs[_0xe9e9('0x1b')](_0x4d32ba['query'][_0xe9e9('0x1b')]);}_0x2d9714[_0xe9e9('0x35')]=qs[_0xe9e9('0x36')](_0x4d32ba[_0xe9e9('0x2c')][_0xe9e9('0x36')]);_0x2d9714['where']=qs['filters'](_[_0xe9e9('0x37')](_0x4d32ba[_0xe9e9('0x2c')],_0xcd825e['filters']),_0x5ed85b);if(_0x4d32ba['query'][_0xe9e9('0x38')]){_0x2d9714[_0xe9e9('0x39')]=_[_0xe9e9('0x3a')](_0x2d9714['where'],{'$or':_[_0xe9e9('0x28')](_0x5ed85b,function(_0x3468ff){if(_0x3468ff[_0xe9e9('0x2b')]!==_0xe9e9('0x3b')){var _0x43bc4e={};_0x43bc4e[_0x3468ff[_0xe9e9('0x3c')]]={'$like':'%'+_0x4d32ba['query'][_0xe9e9('0x38')]+'%'};return _0x43bc4e;}})});}_0x2d9714=_[_0xe9e9('0x3a')]({},_0x2d9714,_0x4d32ba[_0xe9e9('0x3d')]);var _0x5811f4={'where':_0x2d9714[_0xe9e9('0x39')]};return db['SalesforceField']['count'](_0x5811f4)['then'](function(_0x34d7c0){_0x1ec8f8[_0xe9e9('0x1e')]=_0x34d7c0;if(_0x4d32ba[_0xe9e9('0x2c')][_0xe9e9('0x3e')]){_0x2d9714['include']=[{'all':!![]}];}return db[_0xe9e9('0x29')][_0xe9e9('0x3f')](_0x2d9714);})[_0xe9e9('0x23')](function(_0x30833c){_0x1ec8f8['rows']=_0x30833c;return _0x1ec8f8;})['then'](respondWithFilteredResult(_0x177609,_0x2d9714))[_0xe9e9('0x40')](handleError(_0x177609,null));};exports['show']=function(_0x1a50b9,_0x37cd0e){var _0x4343e9={'raw':!![],'where':{'id':_0x1a50b9[_0xe9e9('0x41')]['id']}},_0x536997={};_0x536997[_0xe9e9('0x2e')]=_[_0xe9e9('0x42')](db[_0xe9e9('0x29')]['rawAttributes']);_0x536997[_0xe9e9('0x2c')]=_['keys'](_0x1a50b9[_0xe9e9('0x2c')]);_0x536997[_0xe9e9('0x2d')]=_[_0xe9e9('0x30')](_0x536997[_0xe9e9('0x2e')],_0x536997['query']);_0x4343e9[_0xe9e9('0x2f')]=_['intersection'](_0x536997[_0xe9e9('0x2e')],qs[_0xe9e9('0x31')](_0x1a50b9[_0xe9e9('0x2c')][_0xe9e9('0x31')]));_0x4343e9[_0xe9e9('0x2f')]=_0x4343e9[_0xe9e9('0x2f')][_0xe9e9('0x32')]?_0x4343e9[_0xe9e9('0x2f')]:_0x536997['model'];if(_0x1a50b9[_0xe9e9('0x2c')][_0xe9e9('0x3e')]){_0x4343e9[_0xe9e9('0x43')]=[{'all':!![]}];}_0x4343e9=_['merge']({},_0x4343e9,_0x1a50b9['options']);return db[_0xe9e9('0x29')][_0xe9e9('0x44')](_0x4343e9)['then'](handleEntityNotFound(_0x37cd0e,null))['then'](respondWithResult(_0x37cd0e,null))['catch'](handleError(_0x37cd0e,null));};exports['create']=function(_0x2235be,_0x2a24a6){return db[_0xe9e9('0x29')]['create'](_0x2235be[_0xe9e9('0x45')],{})[_0xe9e9('0x23')](respondWithResult(_0x2a24a6,0xc9))[_0xe9e9('0x40')](handleError(_0x2a24a6,null));};exports['update']=function(_0x2a2301,_0x49c5f4){if(_0x2a2301[_0xe9e9('0x45')]['id']){delete _0x2a2301[_0xe9e9('0x45')]['id'];}return db[_0xe9e9('0x29')][_0xe9e9('0x44')]({'where':{'id':_0x2a2301['params']['id']}})[_0xe9e9('0x23')](handleEntityNotFound(_0x49c5f4,null))[_0xe9e9('0x23')](saveUpdates(_0x2a2301[_0xe9e9('0x45')],null))[_0xe9e9('0x23')](respondWithResult(_0x49c5f4,null))[_0xe9e9('0x40')](handleError(_0x49c5f4,null));};exports[_0xe9e9('0x22')]=function(_0x91697d,_0x4079dc){return db['SalesforceField'][_0xe9e9('0x44')]({'where':{'id':_0x91697d['params']['id']}})['then'](handleEntityNotFound(_0x4079dc,null))[_0xe9e9('0x23')](removeEntity(_0x4079dc,null))[_0xe9e9('0x40')](handleError(_0x4079dc,null));}; \ No newline at end of file +var _0xc223=['count','offset','set','Content-Range','apply','save','destroy','then','end','sendStatus','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','status','json','undefined','limit'];(function(_0x8ce99,_0xe40fa0){var _0x186ca7=function(_0xa277bc){while(--_0xa277bc){_0x8ce99['push'](_0x8ce99['shift']());}};_0x186ca7(++_0xe40fa0);}(_0xc223,0xcb));var _0x3c22=function(_0x3d6574,_0x3f5079){_0x3d6574=_0x3d6574-0x0;var _0x41e57d=_0xc223[_0x3d6574];return _0x41e57d;};'use strict';var emlformat=require(_0x3c22('0x0'));var rimraf=require(_0x3c22('0x1'));var zipdir=require(_0x3c22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c22('0x3'));var moment=require(_0x3c22('0x4'));var BPromise=require(_0x3c22('0x5'));var Mustache=require(_0x3c22('0x6'));var util=require(_0x3c22('0x7'));var path=require(_0x3c22('0x8'));var sox=require(_0x3c22('0x9'));var csv=require(_0x3c22('0xa'));var ejs=require(_0x3c22('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c22('0xc'));var jsforce=require(_0x3c22('0xd'));var deskjs=require(_0x3c22('0xe'));var toCsv=require(_0x3c22('0xa'));var querystring=require('querystring');var Papa=require(_0x3c22('0xf'));var Redis=require(_0x3c22('0x10'));var authService=require(_0x3c22('0x11'));var qs=require(_0x3c22('0x12'));var as=require(_0x3c22('0x13'));var hardwareService=require(_0x3c22('0x14'));var logger=require(_0x3c22('0x15'))(_0x3c22('0x16'));var utils=require(_0x3c22('0x17'));var config=require(_0x3c22('0x18'));var licenseUtil=require(_0x3c22('0x19'));var db=require(_0x3c22('0x1a'))['db'];function respondWithStatusCode(_0xd8b427,_0x62075d){_0x62075d=_0x62075d||0xcc;return function(_0x3471be){if(_0x3471be){return _0xd8b427['sendStatus'](_0x62075d);}return _0xd8b427[_0x3c22('0x1b')](_0x62075d)['end']();};}function respondWithResult(_0x56bf97,_0x1b108d){_0x1b108d=_0x1b108d||0xc8;return function(_0x5b13f7){if(_0x5b13f7){return _0x56bf97[_0x3c22('0x1b')](_0x1b108d)[_0x3c22('0x1c')](_0x5b13f7);}};}function respondWithFilteredResult(_0x417b5b,_0x495214){return function(_0x5473d5){if(_0x5473d5){var _0xb7d0ef=typeof _0x495214['offset']===_0x3c22('0x1d')&&typeof _0x495214[_0x3c22('0x1e')]===_0x3c22('0x1d');var _0x2f09e6=_0x5473d5[_0x3c22('0x1f')];var _0x31a5f1=_0xb7d0ef?0x0:_0x495214['offset'];var _0x14bf73=_0xb7d0ef?_0x5473d5['count']:_0x495214[_0x3c22('0x20')]+_0x495214['limit'];var _0x38d9b2;if(_0x14bf73>=_0x2f09e6){_0x14bf73=_0x2f09e6;_0x38d9b2=0xc8;}else{_0x38d9b2=0xce;}_0x417b5b[_0x3c22('0x1b')](_0x38d9b2);return _0x417b5b[_0x3c22('0x21')](_0x3c22('0x22'),_0x31a5f1+'-'+_0x14bf73+'/'+_0x2f09e6)[_0x3c22('0x1c')](_0x5473d5);}return null;};}function patchUpdates(_0x39704d){return function(_0x413b91){try{jsonpatch[_0x3c22('0x23')](_0x413b91,_0x39704d,!![]);}catch(_0x5c62d0){return BPromise['reject'](_0x5c62d0);}return _0x413b91[_0x3c22('0x24')]();};}function saveUpdates(_0x4fa865,_0x520ea7){return function(_0x2a5e13){if(_0x2a5e13){return _0x2a5e13['update'](_0x4fa865)['then'](function(_0x4e2032){return _0x4e2032;});}return null;};}function removeEntity(_0x49032a,_0x814262){return function(_0x7b65af){if(_0x7b65af){return _0x7b65af[_0x3c22('0x25')]()[_0x3c22('0x26')](function(){_0x49032a[_0x3c22('0x1b')](0xcc)[_0x3c22('0x27')]();});}};}function handleEntityNotFound(_0x57950b,_0x2e18c6){return function(_0x5911d7){if(!_0x5911d7){_0x57950b[_0x3c22('0x28')](0x194);}return _0x5911d7;};}function handleError(_0x4a3461,_0xba502a){_0xba502a=_0xba502a||0x1f4;return function(_0x220172){logger[_0x3c22('0x29')](_0x220172[_0x3c22('0x2a')]);if(_0x220172[_0x3c22('0x2b')]){delete _0x220172[_0x3c22('0x2b')];}_0x4a3461[_0x3c22('0x1b')](_0xba502a)[_0x3c22('0x2c')](_0x220172);};}exports[_0x3c22('0x2d')]=function(_0x25d957,_0x1d2b2a){var _0x4aca97={},_0x944502={},_0x145596={'count':0x0,'rows':[]};var _0x514ffa=_['map'](db[_0x3c22('0x2e')][_0x3c22('0x2f')],function(_0x5d3931){return{'name':_0x5d3931[_0x3c22('0x30')],'type':_0x5d3931[_0x3c22('0x31')]['key']};});_0x944502['model']=_[_0x3c22('0x32')](_0x514ffa,_0x3c22('0x2b'));_0x944502[_0x3c22('0x33')]=_[_0x3c22('0x34')](_0x25d957[_0x3c22('0x33')]);_0x944502[_0x3c22('0x35')]=_['intersection'](_0x944502[_0x3c22('0x36')],_0x944502[_0x3c22('0x33')]);_0x4aca97[_0x3c22('0x37')]=_['intersection'](_0x944502[_0x3c22('0x36')],qs[_0x3c22('0x38')](_0x25d957[_0x3c22('0x33')][_0x3c22('0x38')]));_0x4aca97[_0x3c22('0x37')]=_0x4aca97[_0x3c22('0x37')][_0x3c22('0x39')]?_0x4aca97[_0x3c22('0x37')]:_0x944502['model'];if(!_0x25d957[_0x3c22('0x33')]['hasOwnProperty']('nolimit')){_0x4aca97[_0x3c22('0x1e')]=qs[_0x3c22('0x1e')](_0x25d957[_0x3c22('0x33')][_0x3c22('0x1e')]);_0x4aca97[_0x3c22('0x20')]=qs[_0x3c22('0x20')](_0x25d957['query'][_0x3c22('0x20')]);}_0x4aca97[_0x3c22('0x3a')]=qs[_0x3c22('0x3b')](_0x25d957[_0x3c22('0x33')][_0x3c22('0x3b')]);_0x4aca97[_0x3c22('0x3c')]=qs[_0x3c22('0x35')](_[_0x3c22('0x3d')](_0x25d957[_0x3c22('0x33')],_0x944502[_0x3c22('0x35')]),_0x514ffa);if(_0x25d957[_0x3c22('0x33')][_0x3c22('0x3e')]){_0x4aca97['where']=_[_0x3c22('0x3f')](_0x4aca97[_0x3c22('0x3c')],{'$or':_[_0x3c22('0x32')](_0x514ffa,function(_0xb6b666){if(_0xb6b666[_0x3c22('0x31')]!==_0x3c22('0x40')){var _0x5e9721={};_0x5e9721[_0xb6b666[_0x3c22('0x2b')]]={'$like':'%'+_0x25d957['query'][_0x3c22('0x3e')]+'%'};return _0x5e9721;}})});}_0x4aca97=_[_0x3c22('0x3f')]({},_0x4aca97,_0x25d957[_0x3c22('0x41')]);var _0x3289ce={'where':_0x4aca97[_0x3c22('0x3c')]};return db[_0x3c22('0x2e')][_0x3c22('0x1f')](_0x3289ce)[_0x3c22('0x26')](function(_0x1fa9d8){_0x145596[_0x3c22('0x1f')]=_0x1fa9d8;if(_0x25d957['query'][_0x3c22('0x42')]){_0x4aca97[_0x3c22('0x43')]=[{'all':!![]}];}return db[_0x3c22('0x2e')][_0x3c22('0x44')](_0x4aca97);})[_0x3c22('0x26')](function(_0x2665cf){_0x145596[_0x3c22('0x45')]=_0x2665cf;return _0x145596;})[_0x3c22('0x26')](respondWithFilteredResult(_0x1d2b2a,_0x4aca97))['catch'](handleError(_0x1d2b2a,null));};exports[_0x3c22('0x46')]=function(_0x1a6bb1,_0x1ce6dc){var _0x589b8a={'raw':!![],'where':{'id':_0x1a6bb1[_0x3c22('0x47')]['id']}},_0x1215fc={};_0x1215fc['model']=_[_0x3c22('0x34')](db[_0x3c22('0x2e')][_0x3c22('0x2f')]);_0x1215fc['query']=_[_0x3c22('0x34')](_0x1a6bb1[_0x3c22('0x33')]);_0x1215fc[_0x3c22('0x35')]=_[_0x3c22('0x48')](_0x1215fc[_0x3c22('0x36')],_0x1215fc['query']);_0x589b8a[_0x3c22('0x37')]=_['intersection'](_0x1215fc[_0x3c22('0x36')],qs['fields'](_0x1a6bb1[_0x3c22('0x33')]['fields']));_0x589b8a[_0x3c22('0x37')]=_0x589b8a['attributes'][_0x3c22('0x39')]?_0x589b8a[_0x3c22('0x37')]:_0x1215fc['model'];if(_0x1a6bb1[_0x3c22('0x33')][_0x3c22('0x42')]){_0x589b8a[_0x3c22('0x43')]=[{'all':!![]}];}_0x589b8a=_[_0x3c22('0x3f')]({},_0x589b8a,_0x1a6bb1[_0x3c22('0x41')]);return db[_0x3c22('0x2e')][_0x3c22('0x49')](_0x589b8a)[_0x3c22('0x26')](handleEntityNotFound(_0x1ce6dc,null))['then'](respondWithResult(_0x1ce6dc,null))[_0x3c22('0x4a')](handleError(_0x1ce6dc,null));};exports['create']=function(_0x26b946,_0x238b7d){return db[_0x3c22('0x2e')][_0x3c22('0x4b')](_0x26b946[_0x3c22('0x4c')],{})[_0x3c22('0x26')](respondWithResult(_0x238b7d,0xc9))[_0x3c22('0x4a')](handleError(_0x238b7d,null));};exports[_0x3c22('0x4d')]=function(_0x463cb1,_0x51b8eb){if(_0x463cb1['body']['id']){delete _0x463cb1['body']['id'];}return db[_0x3c22('0x2e')]['find']({'where':{'id':_0x463cb1['params']['id']}})[_0x3c22('0x26')](handleEntityNotFound(_0x51b8eb,null))[_0x3c22('0x26')](saveUpdates(_0x463cb1[_0x3c22('0x4c')],null))[_0x3c22('0x26')](respondWithResult(_0x51b8eb,null))[_0x3c22('0x4a')](handleError(_0x51b8eb,null));};exports[_0x3c22('0x25')]=function(_0x46f746,_0x339b9e){return db[_0x3c22('0x2e')][_0x3c22('0x49')]({'where':{'id':_0x46f746[_0x3c22('0x47')]['id']}})[_0x3c22('0x26')](handleEntityNotFound(_0x339b9e,null))[_0x3c22('0x26')](removeEntity(_0x339b9e,null))[_0x3c22('0x4a')](handleError(_0x339b9e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 34e8e91..bc63806 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 _0xca7b=['lodash','util','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','idField','FieldId'];(function(_0x1e6d9a,_0x548cf2){var _0x59b4da=function(_0x24a41d){while(--_0x24a41d){_0x1e6d9a['push'](_0x1e6d9a['shift']());}};_0x59b4da(++_0x548cf2);}(_0xca7b,0x1a0));var _0xbca7=function(_0x187b21,_0x2a5a16){_0x187b21=_0x187b21-0x0;var _0x1593ce=_0xca7b[_0x187b21];return _0x1593ce;};'use strict';var _=require(_0xbca7('0x0'));var util=require(_0xbca7('0x1'));var logger=require('../../config/logger')(_0xbca7('0x2'));var moment=require(_0xbca7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbca7('0x4'));var rimraf=require(_0xbca7('0x5'));var config=require(_0xbca7('0x6'));var attributes=require(_0xbca7('0x7'));module[_0xbca7('0x8')]=function(_0x5f0767,_0x3ad72f){return _0x5f0767[_0xbca7('0x9')](_0xbca7('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xbca7('0xb'),_0xbca7('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xddf3=['../../config/logger','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','lodash','util'];(function(_0x319fdc,_0x510a61){var _0x31f02d=function(_0x1fed91){while(--_0x1fed91){_0x319fdc['push'](_0x319fdc['shift']());}};_0x31f02d(++_0x510a61);}(_0xddf3,0x196));var _0x3ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ddf('0x0'));var util=require(_0x3ddf('0x1'));var logger=require(_0x3ddf('0x2'))('api');var moment=require(_0x3ddf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ddf('0x4'));var rimraf=require(_0x3ddf('0x5'));var config=require(_0x3ddf('0x6'));var attributes=require(_0x3ddf('0x7'));module[_0x3ddf('0x8')]=function(_0x3674b5,_0x1068d6){return _0x3674b5['define'](_0x3ddf('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3ddf('0xa'),'fields':[_0x3ddf('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4adac8a..13cbead 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 _0xf14d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x8f6f66,_0x4c0d9c){var _0xb86238=function(_0x139885){while(--_0x139885){_0x8f6f66['push'](_0x8f6f66['shift']());}};_0xb86238(++_0x4c0d9c);}(_0xf14d,0x11e));var _0xdf14=function(_0x4f5e17,_0x4a60e1){_0x4f5e17=_0x4f5e17-0x0;var _0x48ab6e=_0xf14d[_0x4f5e17];return _0x48ab6e;};'use strict';var _=require(_0xdf14('0x0'));var util=require(_0xdf14('0x1'));var moment=require(_0xdf14('0x2'));var BPromise=require(_0xdf14('0x3'));var rs=require(_0xdf14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf14('0x5'))['db'];var utils=require(_0xdf14('0x6'));var logger=require(_0xdf14('0x7'))(_0xdf14('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf14('0x9'));var client=jayson[_0xdf14('0xa')][_0xdf14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x596d36,_0x4c3a52,_0x19d73a){return new BPromise(function(_0x3a8e84,_0x290d54){return client[_0xdf14('0xc')](_0x596d36,_0x19d73a)[_0xdf14('0xd')](function(_0x330b85){logger['info'](_0xdf14('0xe'),_0x4c3a52,_0xdf14('0xf'));logger['debug'](_0xdf14('0x10'),_0x4c3a52,_0xdf14('0xf'),JSON['stringify'](_0x330b85));if(_0x330b85['error']){if(_0x330b85[_0xdf14('0x11')][_0xdf14('0x12')]===0x1f4){logger['error'](_0xdf14('0xe'),_0x4c3a52,_0x330b85['error'][_0xdf14('0x13')]);return _0x290d54(_0x330b85[_0xdf14('0x11')][_0xdf14('0x13')]);}logger[_0xdf14('0x11')](_0xdf14('0xe'),_0x4c3a52,_0x330b85[_0xdf14('0x11')][_0xdf14('0x13')]);return _0x3a8e84(_0x330b85['error'][_0xdf14('0x13')]);}else{logger[_0xdf14('0x14')](_0xdf14('0xe'),_0x4c3a52,_0xdf14('0xf'));_0x3a8e84(_0x330b85[_0xdf14('0x15')][_0xdf14('0x13')]);}})['catch'](function(_0x4a2f38){logger[_0xdf14('0x11')](_0xdf14('0xe'),_0x4c3a52,_0x4a2f38);_0x290d54(_0x4a2f38);});});} \ No newline at end of file +var _0x3ba4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util'];(function(_0x2bbe84,_0x27e011){var _0x5467bd=function(_0x3051e1){while(--_0x3051e1){_0x2bbe84['push'](_0x2bbe84['shift']());}};_0x5467bd(++_0x27e011);}(_0x3ba4,0x71));var _0x43ba=function(_0x6a106b,_0x3c1f53){_0x6a106b=_0x6a106b-0x0;var _0x3a8092=_0x3ba4[_0x6a106b];return _0x3a8092;};'use strict';var _=require(_0x43ba('0x0'));var util=require(_0x43ba('0x1'));var moment=require(_0x43ba('0x2'));var BPromise=require(_0x43ba('0x3'));var rs=require(_0x43ba('0x4'));var fs=require('fs');var Redis=require(_0x43ba('0x5'));var db=require(_0x43ba('0x6'))['db'];var utils=require(_0x43ba('0x7'));var logger=require(_0x43ba('0x8'))('rpc');var config=require(_0x43ba('0x9'));var jayson=require(_0x43ba('0xa'));var client=jayson[_0x43ba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21e8ee,_0x15ae53,_0x302c8a){return new BPromise(function(_0x142ab6,_0x5cc88a){return client[_0x43ba('0xc')](_0x21e8ee,_0x302c8a)['then'](function(_0x14e2d0){logger['info'](_0x43ba('0xd'),_0x15ae53,'request\x20sent');logger[_0x43ba('0xe')](_0x43ba('0xf'),_0x15ae53,'request\x20sent',JSON[_0x43ba('0x10')](_0x14e2d0));if(_0x14e2d0[_0x43ba('0x11')]){if(_0x14e2d0[_0x43ba('0x11')][_0x43ba('0x12')]===0x1f4){logger[_0x43ba('0x11')](_0x43ba('0xd'),_0x15ae53,_0x14e2d0['error']['message']);return _0x5cc88a(_0x14e2d0[_0x43ba('0x11')][_0x43ba('0x13')]);}logger[_0x43ba('0x11')]('SalesforceField,\x20%s,\x20%s',_0x15ae53,_0x14e2d0[_0x43ba('0x11')][_0x43ba('0x13')]);return _0x142ab6(_0x14e2d0['error']['message']);}else{logger[_0x43ba('0x14')]('SalesforceField,\x20%s,\x20%s',_0x15ae53,_0x43ba('0x15'));_0x142ab6(_0x14e2d0['result'][_0x43ba('0x13')]);}})[_0x43ba('0x16')](function(_0x11db00){logger['error']('SalesforceField,\x20%s,\x20%s',_0x15ae53,_0x11db00);_0x5cc88a(_0x11db00);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 66fe7d9..cbfa256 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 _0x220b=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','delete','destroy'];(function(_0xc12f77,_0xa77108){var _0x128aaa=function(_0x3acf43){while(--_0x3acf43){_0xc12f77['push'](_0xc12f77['shift']());}};_0x128aaa(++_0xa77108);}(_0x220b,0x1a2));var _0xb220=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x220b[_0x4e170e];return _0x338291;};'use strict';var multer=require('multer');var util=require(_0xb220('0x0'));var path=require(_0xb220('0x1'));var timeout=require(_0xb220('0x2'));var express=require(_0xb220('0x3'));var router=express['Router']();var fs_extra=require(_0xb220('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb220('0x5'));var config=require('../../config/environment');var controller=require(_0xb220('0x6'));router[_0xb220('0x7')]('/',auth[_0xb220('0x8')](),controller[_0xb220('0x9')]);router['get'](_0xb220('0xa'),auth[_0xb220('0x8')](),controller['show']);router[_0xb220('0x7')](_0xb220('0xb'),auth[_0xb220('0x8')](),controller[_0xb220('0xc')]);router[_0xb220('0x7')](_0xb220('0xd'),auth[_0xb220('0x8')](),controller[_0xb220('0xe')]);router[_0xb220('0xf')]('/',auth['isAuthenticated'](),controller[_0xb220('0x10')]);router[_0xb220('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xb220('0x8')](),controller['update']);router[_0xb220('0x11')](_0xb220('0xa'),auth[_0xb220('0x8')](),controller[_0xb220('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3b1b=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3b1b,0x139));var _0xb3b1=function(_0x42f612,_0x37d84d){_0x42f612=_0x42f612-0x0;var _0x5173c0=_0x3b1b[_0x42f612];return _0x5173c0;};'use strict';var multer=require(_0xb3b1('0x0'));var util=require(_0xb3b1('0x1'));var path=require(_0xb3b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3b1('0x3'));var router=express[_0xb3b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3b1('0x5'));var interaction=require(_0xb3b1('0x6'));var config=require(_0xb3b1('0x7'));var controller=require(_0xb3b1('0x8'));router['get']('/',auth[_0xb3b1('0x9')](),controller['index']);router[_0xb3b1('0xa')](_0xb3b1('0xb'),auth[_0xb3b1('0x9')](),controller[_0xb3b1('0xc')]);router[_0xb3b1('0xa')](_0xb3b1('0xd'),auth[_0xb3b1('0x9')](),controller[_0xb3b1('0xe')]);router[_0xb3b1('0xa')](_0xb3b1('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xb3b1('0x10')]('/',auth['isAuthenticated'](),controller[_0xb3b1('0x11')]);router[_0xb3b1('0x10')](_0xb3b1('0xd'),auth[_0xb3b1('0x9')](),controller[_0xb3b1('0x12')]);router[_0xb3b1('0x13')](_0xb3b1('0xb'),auth[_0xb3b1('0x9')](),controller[_0xb3b1('0x14')]);router[_0xb3b1('0x15')](_0xb3b1('0xb'),auth[_0xb3b1('0x9')](),controller[_0xb3b1('0x16')]);module[_0xb3b1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a378a8c..ff85fc5 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 _0x0407=['STRING','username','sequelize','exports'];(function(_0x180401,_0x1ffac6){var _0x32a876=function(_0x54ed5f){while(--_0x54ed5f){_0x180401['push'](_0x180401['shift']());}};_0x32a876(++_0x1ffac6);}(_0x0407,0x1a2));var _0x7040=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0x0407[_0x415603];return _0x131e72;};'use strict';var Sequelize=require(_0x7040('0x0'));module[_0x7040('0x1')]={'name':{'type':Sequelize[_0x7040('0x2')]},'description':{'type':Sequelize[_0x7040('0x2')]},'username':{'type':Sequelize[_0x7040('0x2')],'unique':_0x7040('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7040('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7040('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa37a=['remoteUri','sequelize','STRING'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa37a,0x184));var _0xaa37=function(_0x4a7cdb,_0x26dbd2){_0x4a7cdb=_0x4a7cdb-0x0;var _0xc77ef6=_0xa37a[_0x4a7cdb];return _0xc77ef6;};'use strict';var Sequelize=require(_0xaa37('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa37('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xaa37('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaa37('0x1')],'unique':_0xaa37('0x2')},'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 fd034a2..fde14db 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 _0x9059=['nolimit','sort','where','pick','filter','merge','VIRTUAL','ServicenowAccount','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','ServicenowConfiguration','order','options','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','watch_list','upon_reject','approval_history','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','category','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x42c781,_0x351948){var _0x27b600=function(_0x3215c0){while(--_0x3215c0){_0x42c781['push'](_0x42c781['shift']());}};_0x27b600(++_0x351948);}(_0x9059,0x7f));var _0x9905=function(_0x52a4dc,_0x2e6f85){_0x52a4dc=_0x52a4dc-0x0;var _0x29c783=_0x9059[_0x52a4dc];return _0x29c783;};'use strict';var emlformat=require(_0x9905('0x0'));var rimraf=require(_0x9905('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9905('0x2'));var rp=require(_0x9905('0x3'));var moment=require(_0x9905('0x4'));var BPromise=require(_0x9905('0x5'));var Mustache=require('mustache');var util=require(_0x9905('0x6'));var path=require('path');var sox=require(_0x9905('0x7'));var csv=require(_0x9905('0x8'));var ejs=require(_0x9905('0x9'));var fs=require('fs');var fs_extra=require(_0x9905('0xa'));var _=require(_0x9905('0xb'));var squel=require(_0x9905('0xc'));var crypto=require(_0x9905('0xd'));var jsforce=require(_0x9905('0xe'));var deskjs=require(_0x9905('0xf'));var toCsv=require(_0x9905('0x8'));var querystring=require(_0x9905('0x10'));var Papa=require(_0x9905('0x11'));var Redis=require(_0x9905('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9905('0x13'));var as=require(_0x9905('0x14'));var hardwareService=require(_0x9905('0x15'));var logger=require('../../config/logger')(_0x9905('0x16'));var utils=require(_0x9905('0x17'));var config=require(_0x9905('0x18'));var licenseUtil=require(_0x9905('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9905('0x1a'));function respondWithStatusCode(_0x4ebc78,_0x59788d){_0x59788d=_0x59788d||0xcc;return function(_0x1b5df0){if(_0x1b5df0){return _0x4ebc78[_0x9905('0x1b')](_0x59788d);}return _0x4ebc78['status'](_0x59788d)[_0x9905('0x1c')]();};}function respondWithResult(_0x27e57a,_0x516eea){_0x516eea=_0x516eea||0xc8;return function(_0x2188d9){if(_0x2188d9){return _0x27e57a[_0x9905('0x1d')](_0x516eea)[_0x9905('0x1e')](_0x2188d9);}};}function respondWithFilteredResult(_0x4b8897,_0x397303){return function(_0x26f847){if(_0x26f847){var _0x4796da=typeof _0x397303[_0x9905('0x1f')]===_0x9905('0x20')&&typeof _0x397303['limit']===_0x9905('0x20');var _0x1b54bb=_0x26f847[_0x9905('0x21')];var _0x1f0eba=_0x4796da?0x0:_0x397303['offset'];var _0xca0456=_0x4796da?_0x26f847[_0x9905('0x21')]:_0x397303[_0x9905('0x1f')]+_0x397303[_0x9905('0x22')];var _0x108a4d;if(_0xca0456>=_0x1b54bb){_0xca0456=_0x1b54bb;_0x108a4d=0xc8;}else{_0x108a4d=0xce;}_0x4b8897['status'](_0x108a4d);return _0x4b8897[_0x9905('0x23')](_0x9905('0x24'),_0x1f0eba+'-'+_0xca0456+'/'+_0x1b54bb)['json'](_0x26f847);}return null;};}function patchUpdates(_0x4b3f99){return function(_0x5dca80){try{jsonpatch[_0x9905('0x25')](_0x5dca80,_0x4b3f99,!![]);}catch(_0x57eb31){return BPromise[_0x9905('0x26')](_0x57eb31);}return _0x5dca80['save']();};}function saveUpdates(_0x1fb035,_0x48ad48){return function(_0x2333e7){if(_0x2333e7){return _0x2333e7[_0x9905('0x27')](_0x1fb035)[_0x9905('0x28')](function(_0x54d99d){return _0x54d99d;});}return null;};}function removeEntity(_0x46aeed,_0x524b9f){return function(_0x7dd0f8){if(_0x7dd0f8){return _0x7dd0f8[_0x9905('0x29')]()[_0x9905('0x28')](function(){_0x46aeed[_0x9905('0x1d')](0xcc)[_0x9905('0x1c')]();});}};}function handleEntityNotFound(_0xc88085,_0x371a12){return function(_0x59a5ed){if(!_0x59a5ed){_0xc88085[_0x9905('0x1b')](0x194);}return _0x59a5ed;};}function handleError(_0xf07ce6,_0x4f05ab){_0x4f05ab=_0x4f05ab||0x1f4;return function(_0x42526b){logger[_0x9905('0x2a')](_0x42526b[_0x9905('0x2b')]);if(_0x42526b[_0x9905('0x2c')]){delete _0x42526b[_0x9905('0x2c')];}_0xf07ce6['status'](_0x4f05ab)[_0x9905('0x2d')](_0x42526b);};}exports[_0x9905('0x2e')]=function(_0x58dfcc,_0x54ddf5){var _0x4d7c5b={},_0x31e78c={},_0x572f74={'count':0x0,'rows':[]};var _0x5b64a2=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x3edd78){return{'name':_0x3edd78[_0x9905('0x2f')],'type':_0x3edd78[_0x9905('0x30')][_0x9905('0x31')]};});_0x31e78c[_0x9905('0x32')]=_[_0x9905('0x33')](_0x5b64a2,_0x9905('0x2c'));_0x31e78c[_0x9905('0x34')]=_[_0x9905('0x35')](_0x58dfcc[_0x9905('0x34')]);_0x31e78c[_0x9905('0x36')]=_[_0x9905('0x37')](_0x31e78c[_0x9905('0x32')],_0x31e78c['query']);_0x4d7c5b['attributes']=_[_0x9905('0x37')](_0x31e78c[_0x9905('0x32')],qs[_0x9905('0x38')](_0x58dfcc['query']['fields']));_0x4d7c5b[_0x9905('0x39')]=_0x4d7c5b['attributes'][_0x9905('0x3a')]?_0x4d7c5b[_0x9905('0x39')]:_0x31e78c[_0x9905('0x32')];if(!_0x58dfcc[_0x9905('0x34')][_0x9905('0x3b')](_0x9905('0x3c'))){_0x4d7c5b[_0x9905('0x22')]=qs[_0x9905('0x22')](_0x58dfcc[_0x9905('0x34')][_0x9905('0x22')]);_0x4d7c5b[_0x9905('0x1f')]=qs[_0x9905('0x1f')](_0x58dfcc[_0x9905('0x34')][_0x9905('0x1f')]);}_0x4d7c5b['order']=qs[_0x9905('0x3d')](_0x58dfcc[_0x9905('0x34')][_0x9905('0x3d')]);_0x4d7c5b[_0x9905('0x3e')]=qs[_0x9905('0x36')](_[_0x9905('0x3f')](_0x58dfcc[_0x9905('0x34')],_0x31e78c[_0x9905('0x36')]),_0x5b64a2);if(_0x58dfcc[_0x9905('0x34')][_0x9905('0x40')]){_0x4d7c5b[_0x9905('0x3e')]=_[_0x9905('0x41')](_0x4d7c5b[_0x9905('0x3e')],{'$or':_[_0x9905('0x33')](_0x5b64a2,function(_0xe2346a){if(_0xe2346a[_0x9905('0x30')]!==_0x9905('0x42')){var _0x3348a3={};_0x3348a3[_0xe2346a[_0x9905('0x2c')]]={'$like':'%'+_0x58dfcc[_0x9905('0x34')][_0x9905('0x40')]+'%'};return _0x3348a3;}})});}_0x4d7c5b=_[_0x9905('0x41')]({},_0x4d7c5b,_0x58dfcc['options']);var _0x437191={'where':_0x4d7c5b[_0x9905('0x3e')]};return db[_0x9905('0x43')][_0x9905('0x21')](_0x437191)[_0x9905('0x28')](function(_0x4b5169){_0x572f74[_0x9905('0x21')]=_0x4b5169;if(_0x58dfcc['query'][_0x9905('0x44')]){_0x4d7c5b['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x9905('0x45')](_0x4d7c5b);})[_0x9905('0x28')](function(_0xf2b03c){_0x572f74[_0x9905('0x46')]=_0xf2b03c;return _0x572f74;})[_0x9905('0x28')](respondWithFilteredResult(_0x54ddf5,_0x4d7c5b))[_0x9905('0x47')](handleError(_0x54ddf5,null));};exports[_0x9905('0x48')]=function(_0x144bae,_0x5abdcc){var _0x22415b={'raw':![],'where':{'id':_0x144bae[_0x9905('0x49')]['id']}},_0x56ba7a={};_0x56ba7a['model']=_[_0x9905('0x35')](db[_0x9905('0x43')][_0x9905('0x4a')]);_0x56ba7a[_0x9905('0x34')]=_[_0x9905('0x35')](_0x144bae[_0x9905('0x34')]);_0x56ba7a[_0x9905('0x36')]=_[_0x9905('0x37')](_0x56ba7a[_0x9905('0x32')],_0x56ba7a[_0x9905('0x34')]);_0x22415b[_0x9905('0x39')]=_[_0x9905('0x37')](_0x56ba7a[_0x9905('0x32')],qs[_0x9905('0x38')](_0x144bae['query'][_0x9905('0x38')]));_0x22415b[_0x9905('0x39')]=_0x22415b['attributes']['length']?_0x22415b['attributes']:_0x56ba7a[_0x9905('0x32')];if(_0x144bae[_0x9905('0x34')]['includeAll']){_0x22415b[_0x9905('0x4b')]=[{'all':!![]}];}_0x22415b=_[_0x9905('0x41')]({},_0x22415b,_0x144bae['options']);return db[_0x9905('0x43')][_0x9905('0x4c')](_0x22415b)[_0x9905('0x28')](handleEntityNotFound(_0x5abdcc,null))['then'](respondWithResult(_0x5abdcc,null))[_0x9905('0x47')](handleError(_0x5abdcc,null));};exports[_0x9905('0x4d')]=function(_0x16536f,_0x1e8a38){return db[_0x9905('0x43')][_0x9905('0x4d')](_0x16536f[_0x9905('0x4e')],{})['then'](respondWithResult(_0x1e8a38,0xc9))['catch'](handleError(_0x1e8a38,null));};exports['update']=function(_0x3f323d,_0x4aa7da){if(_0x3f323d['body']['id']){delete _0x3f323d[_0x9905('0x4e')]['id'];}return db[_0x9905('0x43')]['find']({'where':{'id':_0x3f323d[_0x9905('0x49')]['id']}})[_0x9905('0x28')](handleEntityNotFound(_0x4aa7da,null))[_0x9905('0x28')](saveUpdates(_0x3f323d[_0x9905('0x4e')],null))[_0x9905('0x28')](respondWithResult(_0x4aa7da,null))[_0x9905('0x47')](handleError(_0x4aa7da,null));};exports[_0x9905('0x29')]=function(_0x5d9b3a,_0x434f72){return db[_0x9905('0x43')][_0x9905('0x4c')]({'where':{'id':_0x5d9b3a[_0x9905('0x49')]['id']}})['then'](handleEntityNotFound(_0x434f72,null))['then'](removeEntity(_0x434f72,null))[_0x9905('0x47')](handleError(_0x434f72,null));};exports[_0x9905('0x4f')]=function(_0x420b6f,_0x4ce423,_0x440419){var _0x27a11b={};var _0x1d0ecf={};var _0x2b1065;var _0x15b10d;return db[_0x9905('0x43')]['findOne']({'where':{'id':_0x420b6f[_0x9905('0x49')]['id']}})[_0x9905('0x28')](handleEntityNotFound(_0x4ce423,null))[_0x9905('0x28')](function(_0x50a773){if(_0x50a773){_0x2b1065=_0x50a773;_0x1d0ecf[_0x9905('0x32')]=_[_0x9905('0x35')](db[_0x9905('0x50')][_0x9905('0x4a')]);_0x1d0ecf[_0x9905('0x34')]=_['keys'](_0x420b6f[_0x9905('0x34')]);_0x1d0ecf['filters']=_[_0x9905('0x37')](_0x1d0ecf[_0x9905('0x32')],_0x1d0ecf[_0x9905('0x34')]);_0x27a11b['attributes']=_[_0x9905('0x37')](_0x1d0ecf['model'],qs[_0x9905('0x38')](_0x420b6f[_0x9905('0x34')][_0x9905('0x38')]));_0x27a11b[_0x9905('0x39')]=_0x27a11b[_0x9905('0x39')][_0x9905('0x3a')]?_0x27a11b[_0x9905('0x39')]:_0x1d0ecf[_0x9905('0x32')];_0x27a11b[_0x9905('0x51')]=qs[_0x9905('0x3d')](_0x420b6f['query']['sort']);_0x27a11b[_0x9905('0x3e')]=qs[_0x9905('0x36')](_[_0x9905('0x3f')](_0x420b6f[_0x9905('0x34')],_0x1d0ecf['filters']));if(_0x420b6f['query'][_0x9905('0x40')]){_0x27a11b[_0x9905('0x3e')]=_['merge'](_0x27a11b[_0x9905('0x3e')],{'$or':_[_0x9905('0x33')](_0x27a11b[_0x9905('0x39')],function(_0x270405){var _0x4c713a={};_0x4c713a[_0x270405]={'$like':'%'+_0x420b6f[_0x9905('0x34')]['filter']+'%'};return _0x4c713a;})});}_0x27a11b=_['merge']({},_0x27a11b,_0x420b6f[_0x9905('0x52')]);return _0x2b1065[_0x9905('0x4f')](_0x27a11b);}})[_0x9905('0x28')](function(_0x26a304){if(_0x26a304){_0x15b10d=_0x26a304[_0x9905('0x3a')];if(!_0x420b6f[_0x9905('0x34')][_0x9905('0x3b')](_0x9905('0x3c'))){_0x27a11b['limit']=qs[_0x9905('0x22')](_0x420b6f[_0x9905('0x34')][_0x9905('0x22')]);_0x27a11b[_0x9905('0x1f')]=qs[_0x9905('0x1f')](_0x420b6f[_0x9905('0x34')][_0x9905('0x1f')]);}return _0x2b1065[_0x9905('0x4f')](_0x27a11b);}})[_0x9905('0x28')](function(_0x3e9538){if(_0x3e9538){return _0x3e9538?{'count':_0x15b10d,'rows':_0x3e9538}:null;}})[_0x9905('0x28')](respondWithResult(_0x4ce423,null))['catch'](handleError(_0x4ce423,null));};exports['addConfiguration']=function(_0x5b6a42,_0x29747b,_0x5e1c72){if(_0x5b6a42[_0x9905('0x4e')]['id']){delete _0x5b6a42[_0x9905('0x4e')]['id'];}return db[_0x9905('0x43')][_0x9905('0x53')]({'where':{'id':_0x5b6a42[_0x9905('0x49')]['id']}})['then'](handleEntityNotFound(_0x29747b,null))['then'](function(_0x5c2387){if(_0x5c2387){_0x5b6a42['body'][_0x9905('0x54')]=_0x5c2387['id'];_0x5b6a42[_0x9905('0x4e')][_0x9905('0x55')]=integrations['getSubjects'](_0x5b6a42[_0x9905('0x4e')][_0x9905('0x56')],_0x5b6a42[_0x9905('0x4e')][_0x9905('0x30')]);_0x5b6a42[_0x9905('0x4e')][_0x9905('0x57')]=integrations[_0x9905('0x58')](_0x5b6a42['body']['channel'],_0x5b6a42['body'][_0x9905('0x30')]);return db[_0x9905('0x50')][_0x9905('0x4d')](_0x5b6a42['body'],{'include':[{'model':db[_0x9905('0x59')],'as':_0x9905('0x55')},{'model':db[_0x9905('0x59')],'as':_0x9905('0x57')}]});}return null;})[_0x9905('0x28')](respondWithResult(_0x29747b,null))[_0x9905('0x47')](handleError(_0x29747b,null));};exports[_0x9905('0x5a')]=function(_0x2addbc,_0x2a7eac,_0x43c643){var _0x3d7b55=[_0x9905('0x5b'),_0x9905('0x5c'),_0x9905('0x5d'),_0x9905('0x5e'),_0x9905('0x5f'),_0x9905('0x60'),_0x9905('0x61'),'severity','category'];var _0x3689ac=['parent',_0x9905('0x5b'),'caused_by',_0x9905('0x62'),_0x9905('0x63'),'sys_updated_on','child_incidents',_0x9905('0x5c'),_0x9905('0x64'),'number',_0x9905('0x65'),_0x9905('0x66'),_0x9905('0x67'),'user_input','sys_created_on',_0x9905('0x68'),_0x9905('0x69'),_0x9905('0x6a'),_0x9905('0x5d'),'order',_0x9905('0x6b'),'closed_at',_0x9905('0x6c'),_0x9905('0x6d'),'impact',_0x9905('0x6e'),_0x9905('0x6f'),_0x9905('0x70'),_0x9905('0x71'),'sys_domain_path',_0x9905('0x72'),'time_worked',_0x9905('0x73'),_0x9905('0x74'),'business_duration',_0x9905('0x75'),_0x9905('0x76'),_0x9905('0x77'),_0x9905('0x78'),_0x9905('0x79'),_0x9905('0x7a'),_0x9905('0x5e'),_0x9905('0x7b'),_0x9905('0x7c'),'close_code',_0x9905('0x7d'),_0x9905('0x7e'),_0x9905('0x7f'),_0x9905('0x80'),_0x9905('0x81'),_0x9905('0x82'),'description',_0x9905('0x83'),'notify','sys_class_name','close_notes','closed_by',_0x9905('0x84'),_0x9905('0x85'),_0x9905('0x86'),_0x9905('0x87'),_0x9905('0x88'),'incident_state',_0x9905('0x89'),_0x9905('0x8a'),_0x9905('0x8b'),_0x9905('0x8c'),'activity_due',_0x9905('0x8d'),_0x9905('0x8e'),_0x9905('0x8f'),'sla_due',_0x9905('0x90'),_0x9905('0x91'),_0x9905('0x92'),_0x9905('0x93'),_0x9905('0x94'),_0x9905('0x95'),_0x9905('0x96'),_0x9905('0x97'),_0x9905('0x98'),'location',_0x9905('0x99')];var _0x25283f='';var _0x10df12='';var _0x39aacf=[];var _0x1b2266='';var _0x22405e='';var _0x213937=[];var _0x5d4f3b='';var _0x1de463='';var _0x43f1ad={};var _0xa0268a='';return db[_0x9905('0x43')]['findOne']({'where':{'id':_0x2addbc['params']['id']},'attributes':['id','username',_0x9905('0x9a'),_0x9905('0x9b'),_0x9905('0x9c'),_0x9905('0x9d')]})[_0x9905('0x28')](handleEntityNotFound(_0x2a7eac,null))[_0x9905('0x28')](function(_0x4ad5ad){if(_0x4ad5ad){_0xa0268a=_0x4ad5ad[_0x9905('0x9c')];var _0x385457=_0xa0268a[_0x9905('0x9e')](-0x1);if(_0x385457==='/'){_0xa0268a=_0xa0268a[_0x9905('0x9f')](0x0,_0xa0268a[_0x9905('0xa0')](_0x385457));}_0x1de463=util['format']('%s/api/now/doc/table/schema/',_0xa0268a);_0x5d4f3b=util[_0x9905('0xa1')](_0x9905('0xa2'),_0xa0268a);_0x43f1ad={'user':_0x4ad5ad[_0x9905('0xa3')],'pass':_0x4ad5ad['password']};var _0x368a0d={'method':_0x9905('0xa4'),'uri':_0x1de463+'incident?sysparm_display_value=all','auth':_0x43f1ad,'json':!![]};return rp(_0x368a0d);}})[_0x9905('0x28')](function(_0x118b5a){if(_0x118b5a['result'][_0x9905('0x3a')]>0x0){_0x25283f=_0x118b5a['result'];}console['log'](_0x9905('0xa5'),_0x25283f);_0x213937=[];_0x10df12=Object[_0x9905('0xa6')]([],_0x25283f);_[_0x9905('0xa7')](_0x10df12,function(_0x25aec9){return!_0x3d7b55[_0x9905('0xa8')](_0x25aec9['name']);});_0x10df12['forEach'](function(_0x4cb9ef){var _0x453ab6=createFieldObject(_0x5d4f3b,_0x43f1ad,_0x4cb9ef[_0x9905('0xa9')],_0x4cb9ef[_0x9905('0x2c')],_0x4cb9ef[_0x9905('0xaa')],![]);_0x213937[_0x9905('0xab')](_0x453ab6);});return Promise[_0x9905('0xac')](_0x213937);})[_0x9905('0x28')](function(_0x47a94e){_0x39aacf=_0x47a94e;_0x1b2266=Object[_0x9905('0xa6')]([],_0x25283f);console[_0x9905('0xad')](_0x9905('0xae'),_0x25283f);_[_0x9905('0xa7')](_0x1b2266,function(_0x5cd2f3){return _0x3689ac['includes'](_0x5cd2f3[_0x9905('0x2c')]);});console[_0x9905('0xad')](_0x9905('0xaf'),_0x1b2266);_0x213937=[];_0x1b2266[_0x9905('0xb0')](function(_0x1950af){var _0x82fc40=createFieldObject(_0x5d4f3b,_0x43f1ad,_0x1950af['internalType'],_0x1950af[_0x9905('0x2c')],_0x1950af[_0x9905('0xaa')],!![]);_0x213937[_0x9905('0xab')](_0x82fc40);});return Promise[_0x9905('0xac')](_0x213937);})[_0x9905('0x28')](function(_0xa3a43f){_0x22405e=_0xa3a43f;var _0x3ec289=_0x39aacf['concat'](_0x22405e);return{'count':_0x3ec289[_0x9905('0x3a')],'rows':_0x3ec289};})[_0x9905('0x28')](respondWithResult(_0x2a7eac,null))['catch'](function(_0x344db1){console[_0x9905('0xad')]('ServiceNow\x20error:\x20'+_0x344db1);var _0x3bc255=_0x2addbc[_0x9905('0x34')][_0x9905('0xb1')]?0x1f4:_0x344db1[_0x9905('0xb2')]||0x1f4;logger[_0x9905('0x2a')](_0x344db1[_0x9905('0x2b')]);delete _0x344db1[_0x9905('0x2c')];if(_0x3bc255===0x191){_0x3bc255=0x190;}_0x2a7eac[_0x9905('0x1d')](_0x3bc255)[_0x9905('0x2d')](_0x2addbc[_0x9905('0x34')]['test']?{'message':_0x9905('0xb3'),'statusCode':_0x344db1[_0x9905('0xb2')]}:_0x344db1);});};function createFieldObject(_0xb95b91,_0x4e83ad,_0x524f39,_0x52ec19,_0x2873d1,_0x495d73){return new Promise(function(_0x4e945e,_0x58a103){var _0x1fd0c1={'id':_0x52ec19,'name':_0x2873d1,'custom':_0x495d73};if(_0x524f39===_0x9905('0xb4')){_0x1fd0c1[_0x9905('0x52')]=[{'name':_0x9905('0xb5'),'value':_0x9905('0xb6')},{'name':_0x9905('0xb7'),'value':_0x9905('0xb8')}];_0x4e945e(_0x1fd0c1);}else{var _0x168abe={'method':_0x9905('0xa4'),'uri':_0xb95b91+'sys_choice?sysparm_query=name=incident^element='+_0x52ec19,'auth':_0x4e83ad,'json':!![]};return rp(_0x168abe)[_0x9905('0x28')](function(_0x7ee5ed){var _0x46d025=[];if(_0x7ee5ed['result'][_0x9905('0x3a')]>0x0){_0x7ee5ed['result'][_0x9905('0xb0')](function(_0x86aad5){if(_0x86aad5[_0x9905('0xb9')]===_0x9905('0xb8')){var _0x23b7c4={'name':_0x86aad5[_0x9905('0xaa')],'value':_0x86aad5[_0x9905('0xba')]};_0x46d025[_0x9905('0xab')](_0x23b7c4);}});}_0x1fd0c1[_0x9905('0x52')]=_0x46d025;if(_0x1fd0c1['options'][_0x9905('0x3a')]>0x0){_0x4e945e(_0x1fd0c1);}else{if(_0x495d73==![]){_0x4e945e();}else{_0x4e945e(_0x1fd0c1);}}});}});} \ No newline at end of file +var _0x4ec0=['keys','includeAll','find','create','body','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','category','parent','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','problem_id','reassignment_count','activity_due','severity','sla_due','approval','comments_and_work_notes','reopen_count','upon_approval','correlation_id','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','log','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x29b5df,_0x34f8a8){var _0x2e6f96=function(_0x1ce8d5){while(--_0x1ce8d5){_0x29b5df['push'](_0x29b5df['shift']());}};_0x2e6f96(++_0x34f8a8);}(_0x4ec0,0x1dd));var _0x04ec=function(_0x1f4531,_0x58113e){_0x1f4531=_0x1f4531-0x0;var _0x93094f=_0x4ec0[_0x1f4531];return _0x93094f;};'use strict';var emlformat=require(_0x04ec('0x0'));var rimraf=require(_0x04ec('0x1'));var zipdir=require(_0x04ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04ec('0x3'));var moment=require(_0x04ec('0x4'));var BPromise=require(_0x04ec('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x04ec('0x6'));var sox=require(_0x04ec('0x7'));var csv=require(_0x04ec('0x8'));var ejs=require(_0x04ec('0x9'));var fs=require('fs');var fs_extra=require(_0x04ec('0xa'));var _=require(_0x04ec('0xb'));var squel=require(_0x04ec('0xc'));var crypto=require('crypto');var jsforce=require(_0x04ec('0xd'));var deskjs=require(_0x04ec('0xe'));var toCsv=require(_0x04ec('0x8'));var querystring=require(_0x04ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x04ec('0x10'));var authService=require(_0x04ec('0x11'));var qs=require(_0x04ec('0x12'));var as=require(_0x04ec('0x13'));var hardwareService=require(_0x04ec('0x14'));var logger=require(_0x04ec('0x15'))(_0x04ec('0x16'));var utils=require('../../config/utils');var config=require(_0x04ec('0x17'));var licenseUtil=require(_0x04ec('0x18'));var db=require(_0x04ec('0x19'))['db'];var integrations=require(_0x04ec('0x1a'));function respondWithStatusCode(_0x2b7978,_0x48205a){_0x48205a=_0x48205a||0xcc;return function(_0x670ce1){if(_0x670ce1){return _0x2b7978['sendStatus'](_0x48205a);}return _0x2b7978[_0x04ec('0x1b')](_0x48205a)[_0x04ec('0x1c')]();};}function respondWithResult(_0xf8b98f,_0x9a40b6){_0x9a40b6=_0x9a40b6||0xc8;return function(_0x54a693){if(_0x54a693){return _0xf8b98f['status'](_0x9a40b6)[_0x04ec('0x1d')](_0x54a693);}};}function respondWithFilteredResult(_0x4dd8d0,_0x4dfdb5){return function(_0x42d4cb){if(_0x42d4cb){var _0x224e0c=typeof _0x4dfdb5[_0x04ec('0x1e')]===_0x04ec('0x1f')&&typeof _0x4dfdb5[_0x04ec('0x20')]==='undefined';var _0x4bfb0b=_0x42d4cb[_0x04ec('0x21')];var _0xb3985a=_0x224e0c?0x0:_0x4dfdb5[_0x04ec('0x1e')];var _0x29d13d=_0x224e0c?_0x42d4cb[_0x04ec('0x21')]:_0x4dfdb5[_0x04ec('0x1e')]+_0x4dfdb5[_0x04ec('0x20')];var _0x5d3c8f;if(_0x29d13d>=_0x4bfb0b){_0x29d13d=_0x4bfb0b;_0x5d3c8f=0xc8;}else{_0x5d3c8f=0xce;}_0x4dd8d0[_0x04ec('0x1b')](_0x5d3c8f);return _0x4dd8d0[_0x04ec('0x22')](_0x04ec('0x23'),_0xb3985a+'-'+_0x29d13d+'/'+_0x4bfb0b)['json'](_0x42d4cb);}return null;};}function patchUpdates(_0x26b8a3){return function(_0x5b76b4){try{jsonpatch['apply'](_0x5b76b4,_0x26b8a3,!![]);}catch(_0x4c4af3){return BPromise[_0x04ec('0x24')](_0x4c4af3);}return _0x5b76b4[_0x04ec('0x25')]();};}function saveUpdates(_0x28a229,_0x47152c){return function(_0x4cecb8){if(_0x4cecb8){return _0x4cecb8[_0x04ec('0x26')](_0x28a229)[_0x04ec('0x27')](function(_0x5a11c6){return _0x5a11c6;});}return null;};}function removeEntity(_0x1db816,_0x242db8){return function(_0x3d424d){if(_0x3d424d){return _0x3d424d['destroy']()[_0x04ec('0x27')](function(){_0x1db816['status'](0xcc)[_0x04ec('0x1c')]();});}};}function handleEntityNotFound(_0x5926ca,_0x57be30){return function(_0x22725c){if(!_0x22725c){_0x5926ca[_0x04ec('0x28')](0x194);}return _0x22725c;};}function handleError(_0x46b78b,_0x39fa00){_0x39fa00=_0x39fa00||0x1f4;return function(_0x1bbce5){logger[_0x04ec('0x29')](_0x1bbce5[_0x04ec('0x2a')]);if(_0x1bbce5[_0x04ec('0x2b')]){delete _0x1bbce5[_0x04ec('0x2b')];}_0x46b78b[_0x04ec('0x1b')](_0x39fa00)[_0x04ec('0x2c')](_0x1bbce5);};}exports[_0x04ec('0x2d')]=function(_0x40e100,_0xe5d889){var _0x363948={},_0x1878c5={},_0x6f166a={'count':0x0,'rows':[]};var _0x4de339=_['map'](db[_0x04ec('0x2e')][_0x04ec('0x2f')],function(_0x247050){return{'name':_0x247050[_0x04ec('0x30')],'type':_0x247050['type'][_0x04ec('0x31')]};});_0x1878c5[_0x04ec('0x32')]=_[_0x04ec('0x33')](_0x4de339,_0x04ec('0x2b'));_0x1878c5[_0x04ec('0x34')]=_['keys'](_0x40e100[_0x04ec('0x34')]);_0x1878c5['filters']=_[_0x04ec('0x35')](_0x1878c5[_0x04ec('0x32')],_0x1878c5[_0x04ec('0x34')]);_0x363948['attributes']=_[_0x04ec('0x35')](_0x1878c5[_0x04ec('0x32')],qs[_0x04ec('0x36')](_0x40e100[_0x04ec('0x34')][_0x04ec('0x36')]));_0x363948[_0x04ec('0x37')]=_0x363948[_0x04ec('0x37')][_0x04ec('0x38')]?_0x363948[_0x04ec('0x37')]:_0x1878c5[_0x04ec('0x32')];if(!_0x40e100[_0x04ec('0x34')][_0x04ec('0x39')](_0x04ec('0x3a'))){_0x363948[_0x04ec('0x20')]=qs[_0x04ec('0x20')](_0x40e100[_0x04ec('0x34')][_0x04ec('0x20')]);_0x363948['offset']=qs[_0x04ec('0x1e')](_0x40e100[_0x04ec('0x34')]['offset']);}_0x363948[_0x04ec('0x3b')]=qs[_0x04ec('0x3c')](_0x40e100[_0x04ec('0x34')]['sort']);_0x363948[_0x04ec('0x3d')]=qs[_0x04ec('0x3e')](_[_0x04ec('0x3f')](_0x40e100[_0x04ec('0x34')],_0x1878c5['filters']),_0x4de339);if(_0x40e100['query'][_0x04ec('0x40')]){_0x363948[_0x04ec('0x3d')]=_[_0x04ec('0x41')](_0x363948[_0x04ec('0x3d')],{'$or':_['map'](_0x4de339,function(_0x36a82b){if(_0x36a82b[_0x04ec('0x42')]!==_0x04ec('0x43')){var _0x2951b4={};_0x2951b4[_0x36a82b['name']]={'$like':'%'+_0x40e100['query']['filter']+'%'};return _0x2951b4;}})});}_0x363948=_['merge']({},_0x363948,_0x40e100[_0x04ec('0x44')]);var _0x12bf68={'where':_0x363948[_0x04ec('0x3d')]};return db[_0x04ec('0x2e')][_0x04ec('0x21')](_0x12bf68)[_0x04ec('0x27')](function(_0x4ff466){_0x6f166a[_0x04ec('0x21')]=_0x4ff466;if(_0x40e100[_0x04ec('0x34')]['includeAll']){_0x363948[_0x04ec('0x45')]=[{'all':!![]}];}return db[_0x04ec('0x2e')][_0x04ec('0x46')](_0x363948);})[_0x04ec('0x27')](function(_0x446ecf){_0x6f166a[_0x04ec('0x47')]=_0x446ecf;return _0x6f166a;})[_0x04ec('0x27')](respondWithFilteredResult(_0xe5d889,_0x363948))[_0x04ec('0x48')](handleError(_0xe5d889,null));};exports[_0x04ec('0x49')]=function(_0x2e2731,_0x198428){var _0x30c967={'raw':![],'where':{'id':_0x2e2731[_0x04ec('0x4a')]['id']}},_0x107d38={};_0x107d38['model']=_['keys'](db[_0x04ec('0x2e')][_0x04ec('0x2f')]);_0x107d38[_0x04ec('0x34')]=_[_0x04ec('0x4b')](_0x2e2731[_0x04ec('0x34')]);_0x107d38[_0x04ec('0x3e')]=_[_0x04ec('0x35')](_0x107d38[_0x04ec('0x32')],_0x107d38['query']);_0x30c967[_0x04ec('0x37')]=_[_0x04ec('0x35')](_0x107d38['model'],qs[_0x04ec('0x36')](_0x2e2731['query'][_0x04ec('0x36')]));_0x30c967[_0x04ec('0x37')]=_0x30c967[_0x04ec('0x37')][_0x04ec('0x38')]?_0x30c967['attributes']:_0x107d38[_0x04ec('0x32')];if(_0x2e2731['query'][_0x04ec('0x4c')]){_0x30c967['include']=[{'all':!![]}];}_0x30c967=_['merge']({},_0x30c967,_0x2e2731[_0x04ec('0x44')]);return db['ServicenowAccount'][_0x04ec('0x4d')](_0x30c967)[_0x04ec('0x27')](handleEntityNotFound(_0x198428,null))['then'](respondWithResult(_0x198428,null))[_0x04ec('0x48')](handleError(_0x198428,null));};exports[_0x04ec('0x4e')]=function(_0x8538d0,_0x1ed5b7){return db['ServicenowAccount']['create'](_0x8538d0[_0x04ec('0x4f')],{})[_0x04ec('0x27')](respondWithResult(_0x1ed5b7,0xc9))[_0x04ec('0x48')](handleError(_0x1ed5b7,null));};exports[_0x04ec('0x26')]=function(_0x5301b0,_0xbf4ac){if(_0x5301b0[_0x04ec('0x4f')]['id']){delete _0x5301b0[_0x04ec('0x4f')]['id'];}return db[_0x04ec('0x2e')][_0x04ec('0x4d')]({'where':{'id':_0x5301b0[_0x04ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbf4ac,null))[_0x04ec('0x27')](saveUpdates(_0x5301b0[_0x04ec('0x4f')],null))['then'](respondWithResult(_0xbf4ac,null))[_0x04ec('0x48')](handleError(_0xbf4ac,null));};exports[_0x04ec('0x50')]=function(_0x2fcd42,_0x12588c){return db[_0x04ec('0x2e')][_0x04ec('0x4d')]({'where':{'id':_0x2fcd42[_0x04ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12588c,null))[_0x04ec('0x27')](removeEntity(_0x12588c,null))[_0x04ec('0x48')](handleError(_0x12588c,null));};exports[_0x04ec('0x51')]=function(_0x3666c8,_0x35427e,_0x2e5bf7){var _0x1d07a1={};var _0x1787b0={};var _0x159405;var _0x438721;return db['ServicenowAccount'][_0x04ec('0x52')]({'where':{'id':_0x3666c8[_0x04ec('0x4a')]['id']}})[_0x04ec('0x27')](handleEntityNotFound(_0x35427e,null))[_0x04ec('0x27')](function(_0x149055){if(_0x149055){_0x159405=_0x149055;_0x1787b0['model']=_[_0x04ec('0x4b')](db['ServicenowConfiguration']['rawAttributes']);_0x1787b0['query']=_[_0x04ec('0x4b')](_0x3666c8[_0x04ec('0x34')]);_0x1787b0[_0x04ec('0x3e')]=_['intersection'](_0x1787b0[_0x04ec('0x32')],_0x1787b0[_0x04ec('0x34')]);_0x1d07a1['attributes']=_[_0x04ec('0x35')](_0x1787b0[_0x04ec('0x32')],qs[_0x04ec('0x36')](_0x3666c8['query'][_0x04ec('0x36')]));_0x1d07a1[_0x04ec('0x37')]=_0x1d07a1[_0x04ec('0x37')][_0x04ec('0x38')]?_0x1d07a1[_0x04ec('0x37')]:_0x1787b0[_0x04ec('0x32')];_0x1d07a1[_0x04ec('0x3b')]=qs[_0x04ec('0x3c')](_0x3666c8[_0x04ec('0x34')]['sort']);_0x1d07a1['where']=qs[_0x04ec('0x3e')](_[_0x04ec('0x3f')](_0x3666c8['query'],_0x1787b0[_0x04ec('0x3e')]));if(_0x3666c8['query'][_0x04ec('0x40')]){_0x1d07a1[_0x04ec('0x3d')]=_[_0x04ec('0x41')](_0x1d07a1[_0x04ec('0x3d')],{'$or':_[_0x04ec('0x33')](_0x1d07a1[_0x04ec('0x37')],function(_0x3e7406){var _0xa27fb7={};_0xa27fb7[_0x3e7406]={'$like':'%'+_0x3666c8[_0x04ec('0x34')][_0x04ec('0x40')]+'%'};return _0xa27fb7;})});}_0x1d07a1=_[_0x04ec('0x41')]({},_0x1d07a1,_0x3666c8[_0x04ec('0x44')]);return _0x159405['getConfigurations'](_0x1d07a1);}})['then'](function(_0xe89804){if(_0xe89804){_0x438721=_0xe89804['length'];if(!_0x3666c8[_0x04ec('0x34')]['hasOwnProperty'](_0x04ec('0x3a'))){_0x1d07a1[_0x04ec('0x20')]=qs[_0x04ec('0x20')](_0x3666c8[_0x04ec('0x34')][_0x04ec('0x20')]);_0x1d07a1[_0x04ec('0x1e')]=qs[_0x04ec('0x1e')](_0x3666c8[_0x04ec('0x34')][_0x04ec('0x1e')]);}return _0x159405['getConfigurations'](_0x1d07a1);}})[_0x04ec('0x27')](function(_0x300a58){if(_0x300a58){return _0x300a58?{'count':_0x438721,'rows':_0x300a58}:null;}})[_0x04ec('0x27')](respondWithResult(_0x35427e,null))[_0x04ec('0x48')](handleError(_0x35427e,null));};exports['addConfiguration']=function(_0x51537c,_0x5d0864,_0x55c319){if(_0x51537c[_0x04ec('0x4f')]['id']){delete _0x51537c[_0x04ec('0x4f')]['id'];}return db['ServicenowAccount'][_0x04ec('0x52')]({'where':{'id':_0x51537c['params']['id']}})[_0x04ec('0x27')](handleEntityNotFound(_0x5d0864,null))[_0x04ec('0x27')](function(_0x5f33d2){if(_0x5f33d2){_0x51537c['body'][_0x04ec('0x53')]=_0x5f33d2['id'];_0x51537c['body'][_0x04ec('0x54')]=integrations[_0x04ec('0x55')](_0x51537c['body'][_0x04ec('0x56')],_0x51537c['body'][_0x04ec('0x42')]);_0x51537c[_0x04ec('0x4f')][_0x04ec('0x57')]=integrations[_0x04ec('0x58')](_0x51537c[_0x04ec('0x4f')][_0x04ec('0x56')],_0x51537c['body'][_0x04ec('0x42')]);return db['ServicenowConfiguration'][_0x04ec('0x4e')](_0x51537c[_0x04ec('0x4f')],{'include':[{'model':db[_0x04ec('0x59')],'as':_0x04ec('0x54')},{'model':db['ServicenowField'],'as':_0x04ec('0x57')}]});}return null;})[_0x04ec('0x27')](respondWithResult(_0x5d0864,null))[_0x04ec('0x48')](handleError(_0x5d0864,null));};exports[_0x04ec('0x5a')]=function(_0x5e2319,_0x787df,_0xad3448){var _0x5ee17d=[_0x04ec('0x5b'),_0x04ec('0x5c'),'knowledge',_0x04ec('0x5d'),_0x04ec('0x5e'),_0x04ec('0x5f'),'incident_state','severity',_0x04ec('0x60')];var _0x2e70b5=[_0x04ec('0x61'),'made_sla',_0x04ec('0x62'),'watch_list',_0x04ec('0x63'),_0x04ec('0x64'),'child_incidents','hold_reason',_0x04ec('0x65'),_0x04ec('0x66'),_0x04ec('0x67'),_0x04ec('0x68'),_0x04ec('0x69'),_0x04ec('0x6a'),_0x04ec('0x6b'),'sys_domain',_0x04ec('0x6c'),_0x04ec('0x6d'),_0x04ec('0x6e'),'order',_0x04ec('0x6f'),_0x04ec('0x70'),_0x04ec('0x71'),_0x04ec('0x72'),_0x04ec('0x73'),_0x04ec('0x74'),_0x04ec('0x75'),_0x04ec('0x76'),_0x04ec('0x77'),'sys_domain_path','rfc',_0x04ec('0x78'),_0x04ec('0x79'),'opened_at',_0x04ec('0x7a'),_0x04ec('0x7b'),_0x04ec('0x7c'),_0x04ec('0x7d'),_0x04ec('0x7e'),_0x04ec('0x7f'),_0x04ec('0x80'),_0x04ec('0x5d'),'work_notes','short_description',_0x04ec('0x5e'),_0x04ec('0x81'),_0x04ec('0x82'),_0x04ec('0x83'),_0x04ec('0x84'),_0x04ec('0x85'),_0x04ec('0x86'),'description',_0x04ec('0x87'),_0x04ec('0x5f'),_0x04ec('0x88'),'close_notes',_0x04ec('0x89'),_0x04ec('0x8a'),_0x04ec('0x8b'),_0x04ec('0x8c'),_0x04ec('0x8d'),_0x04ec('0x8e'),_0x04ec('0x8f'),'urgency',_0x04ec('0x90'),'company',_0x04ec('0x91'),_0x04ec('0x92'),'assigned_to',_0x04ec('0x93'),'comments',_0x04ec('0x94'),_0x04ec('0x95'),_0x04ec('0x96'),'due_date','sys_mod_count',_0x04ec('0x97'),'sys_tags','escalation',_0x04ec('0x98'),_0x04ec('0x99'),'location',_0x04ec('0x60')];var _0x25cc12='';var _0x1b69a7='';var _0x12e4e0=[];var _0xd4bdc7='';var _0x77fc6a='';var _0x1c1559=[];var _0x34d651='';var _0x566a70='';var _0x4bed8f={};var _0x3fc236='';return db['ServicenowAccount'][_0x04ec('0x52')]({'where':{'id':_0x5e2319[_0x04ec('0x4a')]['id']},'attributes':['id',_0x04ec('0x9a'),_0x04ec('0x9b'),'email',_0x04ec('0x9c'),_0x04ec('0x9d')]})[_0x04ec('0x27')](handleEntityNotFound(_0x787df,null))[_0x04ec('0x27')](function(_0x3db47e){if(_0x3db47e){_0x3fc236=_0x3db47e[_0x04ec('0x9c')];var _0xa20a61=_0x3fc236[_0x04ec('0x9e')](-0x1);if(_0xa20a61==='/'){_0x3fc236=_0x3fc236[_0x04ec('0x9f')](0x0,_0x3fc236['lastIndexOf'](_0xa20a61));}_0x566a70=util['format']('%s/api/now/doc/table/schema/',_0x3fc236);_0x34d651=util[_0x04ec('0xa0')](_0x04ec('0xa1'),_0x3fc236);_0x4bed8f={'user':_0x3db47e[_0x04ec('0x9a')],'pass':_0x3db47e['password']};var _0x4ff3c7={'method':_0x04ec('0xa2'),'uri':_0x566a70+_0x04ec('0xa3'),'auth':_0x4bed8f,'json':!![]};return rp(_0x4ff3c7);}})['then'](function(_0x7931c3){if(_0x7931c3[_0x04ec('0xa4')][_0x04ec('0x38')]>0x0){_0x25cc12=_0x7931c3[_0x04ec('0xa4')];}console['log']('incident\x20table\x20objects',_0x25cc12);_0x1c1559=[];_0x1b69a7=Object[_0x04ec('0xa5')]([],_0x25cc12);_[_0x04ec('0xa6')](_0x1b69a7,function(_0x3e97b4){return!_0x5ee17d[_0x04ec('0xa7')](_0x3e97b4[_0x04ec('0x2b')]);});_0x1b69a7[_0x04ec('0xa8')](function(_0x31e202){var _0x4cabff=createFieldObject(_0x34d651,_0x4bed8f,_0x31e202['internalType'],_0x31e202[_0x04ec('0x2b')],_0x31e202[_0x04ec('0xa9')],![]);_0x1c1559[_0x04ec('0xaa')](_0x4cabff);});return Promise['all'](_0x1c1559);})[_0x04ec('0x27')](function(_0x3cabe5){_0x12e4e0=_0x3cabe5;_0xd4bdc7=Object['assign']([],_0x25cc12);console['log'](_0x04ec('0xab'),_0x25cc12);_[_0x04ec('0xa6')](_0xd4bdc7,function(_0x409ed5){return _0x2e70b5[_0x04ec('0xa7')](_0x409ed5['name']);});console['log'](_0x04ec('0xac'),_0xd4bdc7);_0x1c1559=[];_0xd4bdc7[_0x04ec('0xa8')](function(_0x5ea977){var _0x1d52c2=createFieldObject(_0x34d651,_0x4bed8f,_0x5ea977[_0x04ec('0xad')],_0x5ea977[_0x04ec('0x2b')],_0x5ea977[_0x04ec('0xa9')],!![]);_0x1c1559[_0x04ec('0xaa')](_0x1d52c2);});return Promise['all'](_0x1c1559);})[_0x04ec('0x27')](function(_0x28a673){_0x77fc6a=_0x28a673;var _0x6d55b2=_0x12e4e0[_0x04ec('0xae')](_0x77fc6a);return{'count':_0x6d55b2[_0x04ec('0x38')],'rows':_0x6d55b2};})[_0x04ec('0x27')](respondWithResult(_0x787df,null))['catch'](function(_0x2ee986){console[_0x04ec('0xaf')](_0x04ec('0xb0')+_0x2ee986);var _0x591fe9=_0x5e2319['query'][_0x04ec('0xb1')]?0x1f4:_0x2ee986[_0x04ec('0xb2')]||0x1f4;logger[_0x04ec('0x29')](_0x2ee986[_0x04ec('0x2a')]);delete _0x2ee986[_0x04ec('0x2b')];if(_0x591fe9===0x191){_0x591fe9=0x190;}_0x787df[_0x04ec('0x1b')](_0x591fe9)[_0x04ec('0x2c')](_0x5e2319['query']['test']?{'message':_0x04ec('0xb3'),'statusCode':_0x2ee986[_0x04ec('0xb2')]}:_0x2ee986);});};function createFieldObject(_0x24778d,_0x2fb0aa,_0xa93d8f,_0x5bee0b,_0x209e9a,_0x24ac60){return new Promise(function(_0x518837,_0x227d0f){var _0x170b5c={'id':_0x5bee0b,'name':_0x209e9a,'custom':_0x24ac60};if(_0xa93d8f==='boolean'){_0x170b5c[_0x04ec('0x44')]=[{'name':'True','value':'true'},{'name':'False','value':_0x04ec('0xb4')}];_0x518837(_0x170b5c);}else{var _0x5d28c2={'method':_0x04ec('0xa2'),'uri':_0x24778d+_0x04ec('0xb5')+_0x5bee0b,'auth':_0x2fb0aa,'json':!![]};return rp(_0x5d28c2)[_0x04ec('0x27')](function(_0x2d7fb5){var _0x36e923=[];if(_0x2d7fb5[_0x04ec('0xa4')][_0x04ec('0x38')]>0x0){_0x2d7fb5[_0x04ec('0xa4')][_0x04ec('0xa8')](function(_0x54cfd5){if(_0x54cfd5[_0x04ec('0xb6')]===_0x04ec('0xb4')){var _0x5f2e5e={'name':_0x54cfd5[_0x04ec('0xa9')],'value':_0x54cfd5[_0x04ec('0xb7')]};_0x36e923['push'](_0x5f2e5e);}});}_0x170b5c[_0x04ec('0x44')]=_0x36e923;if(_0x170b5c[_0x04ec('0x44')]['length']>0x0){_0x518837(_0x170b5c);}else{if(_0x24ac60==![]){_0x518837();}else{_0x518837(_0x170b5c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index fcfe864..6468213 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 _0xafc4=['path','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x51eaf2,_0x5f1779){var _0x2b0e99=function(_0x291739){while(--_0x291739){_0x51eaf2['push'](_0x51eaf2['shift']());}};_0x2b0e99(++_0x5f1779);}(_0xafc4,0x69));var _0x4afc=function(_0x37f2f9,_0x662e94){_0x37f2f9=_0x37f2f9-0x0;var _0x1b3e97=_0xafc4[_0x37f2f9];return _0x1b3e97;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x577806,_0xf96e52){var _0x462e2b=function(_0x31f3fe){while(--_0x31f3fe){_0x577806['push'](_0x577806['shift']());}};_0x462e2b(++_0xf96e52);}(_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 logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'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 319743d..4143e0a 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 _0x9caa=['rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','options','raw','where','attributes','limit','include','model','debug','catch','ServicenowAccount','find','map','then','ShowServicenowAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x113982,_0x597be2){var _0x13ff92=function(_0x344be9){while(--_0x344be9){_0x113982['push'](_0x113982['shift']());}};_0x13ff92(++_0x597be2);}(_0x9caa,0x135));var _0xa9ca=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9caa[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa9ca('0x0'));var util=require(_0xa9ca('0x1'));var moment=require('moment');var BPromise=require(_0xa9ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9ca('0x3'))['db'];var utils=require(_0xa9ca('0x4'));var logger=require(_0xa9ca('0x5'))(_0xa9ca('0x6'));var config=require(_0xa9ca('0x7'));var jayson=require(_0xa9ca('0x8'));var client=jayson[_0xa9ca('0x9')][_0xa9ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48bb27,_0x58c2ed,_0x2f1e2b){return new BPromise(function(_0x518331,_0x3e61cc){return client[_0xa9ca('0xb')](_0x48bb27,_0x2f1e2b)['then'](function(_0x3c4fc8){logger[_0xa9ca('0xc')](_0xa9ca('0xd'),_0x58c2ed,_0xa9ca('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x58c2ed,_0xa9ca('0xe'),JSON[_0xa9ca('0xf')](_0x3c4fc8));if(_0x3c4fc8[_0xa9ca('0x10')]){if(_0x3c4fc8['error'][_0xa9ca('0x11')]===0x1f4){logger['error'](_0xa9ca('0xd'),_0x58c2ed,_0x3c4fc8[_0xa9ca('0x10')]['message']);return _0x3e61cc(_0x3c4fc8[_0xa9ca('0x10')][_0xa9ca('0x12')]);}logger['error'](_0xa9ca('0xd'),_0x58c2ed,_0x3c4fc8[_0xa9ca('0x10')]['message']);return _0x518331(_0x3c4fc8[_0xa9ca('0x10')][_0xa9ca('0x12')]);}else{logger[_0xa9ca('0xc')](_0xa9ca('0xd'),_0x58c2ed,_0xa9ca('0xe'));_0x518331(_0x3c4fc8[_0xa9ca('0x13')][_0xa9ca('0x12')]);}})['catch'](function(_0x140d63){logger[_0xa9ca('0x10')](_0xa9ca('0xd'),_0x58c2ed,_0x140d63);_0x3e61cc(_0x140d63);});});}exports[_0xa9ca('0x14')]=function(_0x17ca55){var _0x538b81=this;return new Promise(function(_0x1d6675,_0x5decb5){return db['ServicenowAccount']['findAll']({'raw':_0x17ca55['options']?_0x17ca55[_0xa9ca('0x15')][_0xa9ca('0x16')]===undefined?!![]:![]:!![],'where':_0x17ca55['options']?_0x17ca55[_0xa9ca('0x15')][_0xa9ca('0x17')]||null:null,'attributes':_0x17ca55['options']?_0x17ca55['options'][_0xa9ca('0x18')]||null:null,'limit':_0x17ca55[_0xa9ca('0x15')]?_0x17ca55[_0xa9ca('0x15')][_0xa9ca('0x19')]||null:null,'include':_0x17ca55[_0xa9ca('0x15')]?_0x17ca55[_0xa9ca('0x15')][_0xa9ca('0x1a')]?_['map'](_0x17ca55[_0xa9ca('0x15')][_0xa9ca('0x1a')],function(_0x2da105){return{'model':db[_0x2da105[_0xa9ca('0x1b')]],'as':_0x2da105['as'],'attributes':_0x2da105['attributes'],'include':_0x2da105[_0xa9ca('0x1a')]?_['map'](_0x2da105[_0xa9ca('0x1a')],function(_0xf7c762){return{'model':db[_0xf7c762[_0xa9ca('0x1b')]],'as':_0xf7c762['as'],'attributes':_0xf7c762[_0xa9ca('0x18')],'include':_0xf7c762[_0xa9ca('0x1a')]?_['map'](_0xf7c762[_0xa9ca('0x1a')],function(_0x52ee21){return{'model':db[_0x52ee21[_0xa9ca('0x1b')]],'as':_0x52ee21['as'],'attributes':_0x52ee21['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc925){logger[_0xa9ca('0xc')]('GetServicenowAccount',_0x17ca55);logger[_0xa9ca('0x1c')]('GetServicenowAccount',_0x17ca55,JSON['stringify'](_0x3bc925));_0x1d6675(_0x3bc925);})[_0xa9ca('0x1d')](function(_0x5c54ae){logger[_0xa9ca('0x10')](_0xa9ca('0x14'),_0x5c54ae['message'],_0x17ca55);_0x5decb5(_0x538b81[_0xa9ca('0x10')](0x1f4,_0x5c54ae[_0xa9ca('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x2cf529){var _0x20b98f=this;return new Promise(function(_0x199360,_0x3cf64c){return db[_0xa9ca('0x1e')][_0xa9ca('0x1f')]({'raw':_0x2cf529[_0xa9ca('0x15')]?_0x2cf529[_0xa9ca('0x15')][_0xa9ca('0x16')]===undefined?!![]:![]:!![],'where':_0x2cf529['options']?_0x2cf529[_0xa9ca('0x15')][_0xa9ca('0x17')]||null:null,'attributes':_0x2cf529[_0xa9ca('0x15')]?_0x2cf529[_0xa9ca('0x15')][_0xa9ca('0x18')]||null:null,'include':_0x2cf529[_0xa9ca('0x15')]?_0x2cf529['options'][_0xa9ca('0x1a')]?_[_0xa9ca('0x20')](_0x2cf529['options'][_0xa9ca('0x1a')],function(_0x593276){return{'model':db[_0x593276['model']],'as':_0x593276['as'],'attributes':_0x593276[_0xa9ca('0x18')],'include':_0x593276[_0xa9ca('0x1a')]?_[_0xa9ca('0x20')](_0x593276[_0xa9ca('0x1a')],function(_0x52ea14){return{'model':db[_0x52ea14[_0xa9ca('0x1b')]],'as':_0x52ea14['as'],'attributes':_0x52ea14[_0xa9ca('0x18')],'include':_0x52ea14[_0xa9ca('0x1a')]?_[_0xa9ca('0x20')](_0x52ea14['include'],function(_0x177eea){return{'model':db[_0x177eea[_0xa9ca('0x1b')]],'as':_0x177eea['as'],'attributes':_0x177eea['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9ca('0x21')](function(_0x168319){logger['info'](_0xa9ca('0x22'),_0x2cf529);logger['debug'](_0xa9ca('0x22'),_0x2cf529,JSON[_0xa9ca('0xf')](_0x168319));_0x199360(_0x168319);})['catch'](function(_0x1853c1){logger[_0xa9ca('0x10')]('ShowServicenowAccount',_0x1853c1[_0xa9ca('0x12')],_0x2cf529);_0x3cf64c(_0x20b98f[_0xa9ca('0x10')](0x1f4,_0x1853c1[_0xa9ca('0x12')]));});});}; \ No newline at end of file +var _0x8d99=['include','map','model','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit'];(function(_0x4d515a,_0x5d1897){var _0x519d66=function(_0x361715){while(--_0x361715){_0x4d515a['push'](_0x4d515a['shift']());}};_0x519d66(++_0x5d1897);}(_0x8d99,0x186));var _0x98d9=function(_0x407cf8,_0x51a10b){_0x407cf8=_0x407cf8-0x0;var _0x37cbc7=_0x8d99[_0x407cf8];return _0x37cbc7;};'use strict';var _=require(_0x98d9('0x0'));var util=require(_0x98d9('0x1'));var moment=require(_0x98d9('0x2'));var BPromise=require(_0x98d9('0x3'));var rs=require(_0x98d9('0x4'));var fs=require('fs');var Redis=require(_0x98d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98d9('0x6'));var logger=require(_0x98d9('0x7'))(_0x98d9('0x8'));var config=require(_0x98d9('0x9'));var jayson=require(_0x98d9('0xa'));var client=jayson['client'][_0x98d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x300db7,_0x5087ae,_0x1d29db){return new BPromise(function(_0x1f89a7,_0xd8d667){return client['request'](_0x300db7,_0x1d29db)[_0x98d9('0xc')](function(_0x2fa356){logger[_0x98d9('0xd')](_0x98d9('0xe'),_0x5087ae,'request\x20sent');logger[_0x98d9('0xf')](_0x98d9('0x10'),_0x5087ae,_0x98d9('0x11'),JSON[_0x98d9('0x12')](_0x2fa356));if(_0x2fa356[_0x98d9('0x13')]){if(_0x2fa356[_0x98d9('0x13')]['code']===0x1f4){logger[_0x98d9('0x13')](_0x98d9('0xe'),_0x5087ae,_0x2fa356['error'][_0x98d9('0x14')]);return _0xd8d667(_0x2fa356[_0x98d9('0x13')]['message']);}logger[_0x98d9('0x13')](_0x98d9('0xe'),_0x5087ae,_0x2fa356[_0x98d9('0x13')][_0x98d9('0x14')]);return _0x1f89a7(_0x2fa356[_0x98d9('0x13')][_0x98d9('0x14')]);}else{logger[_0x98d9('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5087ae,'request\x20sent');_0x1f89a7(_0x2fa356[_0x98d9('0x15')][_0x98d9('0x14')]);}})[_0x98d9('0x16')](function(_0x234c47){logger['error'](_0x98d9('0xe'),_0x5087ae,_0x234c47);_0xd8d667(_0x234c47);});});}exports[_0x98d9('0x17')]=function(_0x2ec945){var _0xe3f444=this;return new Promise(function(_0x3ebe5e,_0x46bb90){return db[_0x98d9('0x18')]['findAll']({'raw':_0x2ec945[_0x98d9('0x19')]?_0x2ec945[_0x98d9('0x19')][_0x98d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ec945[_0x98d9('0x19')]?_0x2ec945['options'][_0x98d9('0x1b')]||null:null,'attributes':_0x2ec945[_0x98d9('0x19')]?_0x2ec945[_0x98d9('0x19')][_0x98d9('0x1c')]||null:null,'limit':_0x2ec945[_0x98d9('0x19')]?_0x2ec945[_0x98d9('0x19')][_0x98d9('0x1d')]||null:null,'include':_0x2ec945['options']?_0x2ec945[_0x98d9('0x19')][_0x98d9('0x1e')]?_[_0x98d9('0x1f')](_0x2ec945[_0x98d9('0x19')][_0x98d9('0x1e')],function(_0x35ad24){return{'model':db[_0x35ad24[_0x98d9('0x20')]],'as':_0x35ad24['as'],'attributes':_0x35ad24[_0x98d9('0x1c')],'include':_0x35ad24[_0x98d9('0x1e')]?_['map'](_0x35ad24[_0x98d9('0x1e')],function(_0xc25a7e){return{'model':db[_0xc25a7e[_0x98d9('0x20')]],'as':_0xc25a7e['as'],'attributes':_0xc25a7e[_0x98d9('0x1c')],'include':_0xc25a7e[_0x98d9('0x1e')]?_[_0x98d9('0x1f')](_0xc25a7e[_0x98d9('0x1e')],function(_0x5f1736){return{'model':db[_0x5f1736[_0x98d9('0x20')]],'as':_0x5f1736['as'],'attributes':_0x5f1736[_0x98d9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x98d9('0xc')](function(_0x347fb1){logger[_0x98d9('0xd')](_0x98d9('0x17'),_0x2ec945);logger['debug'](_0x98d9('0x17'),_0x2ec945,JSON[_0x98d9('0x12')](_0x347fb1));_0x3ebe5e(_0x347fb1);})[_0x98d9('0x16')](function(_0x2d8f26){logger['error']('GetServicenowAccount',_0x2d8f26[_0x98d9('0x14')],_0x2ec945);_0x46bb90(_0xe3f444[_0x98d9('0x13')](0x1f4,_0x2d8f26['message']));});});};exports['ShowServicenowAccount']=function(_0x554a9d){var _0x311644=this;return new Promise(function(_0x1114ba,_0x215d3d){return db[_0x98d9('0x18')][_0x98d9('0x21')]({'raw':_0x554a9d[_0x98d9('0x19')]?_0x554a9d[_0x98d9('0x19')][_0x98d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x554a9d['options']?_0x554a9d[_0x98d9('0x19')]['where']||null:null,'attributes':_0x554a9d[_0x98d9('0x19')]?_0x554a9d['options']['attributes']||null:null,'include':_0x554a9d['options']?_0x554a9d[_0x98d9('0x19')][_0x98d9('0x1e')]?_[_0x98d9('0x1f')](_0x554a9d[_0x98d9('0x19')][_0x98d9('0x1e')],function(_0x1e7052){return{'model':db[_0x1e7052[_0x98d9('0x20')]],'as':_0x1e7052['as'],'attributes':_0x1e7052['attributes'],'include':_0x1e7052[_0x98d9('0x1e')]?_[_0x98d9('0x1f')](_0x1e7052[_0x98d9('0x1e')],function(_0x11364b){return{'model':db[_0x11364b[_0x98d9('0x20')]],'as':_0x11364b['as'],'attributes':_0x11364b[_0x98d9('0x1c')],'include':_0x11364b[_0x98d9('0x1e')]?_[_0x98d9('0x1f')](_0x11364b['include'],function(_0x44fd4f){return{'model':db[_0x44fd4f[_0x98d9('0x20')]],'as':_0x44fd4f['as'],'attributes':_0x44fd4f[_0x98d9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x98d9('0xc')](function(_0x5a6bfa){logger[_0x98d9('0xd')](_0x98d9('0x22'),_0x554a9d);logger[_0x98d9('0xf')]('ShowServicenowAccount',_0x554a9d,JSON[_0x98d9('0x12')](_0x5a6bfa));_0x1114ba(_0x5a6bfa);})[_0x98d9('0x16')](function(_0x4189f2){logger[_0x98d9('0x13')](_0x98d9('0x22'),_0x4189f2['message'],_0x554a9d);_0x215d3d(_0x311644[_0x98d9('0x13')](0x1f4,_0x4189f2['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a3b9219..c88f6a9 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 _0x2597=['create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x2597,0x13c));var _0x7259=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2597[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x7259('0x0'));var path=require(_0x7259('0x1'));var timeout=require(_0x7259('0x2'));var express=require(_0x7259('0x3'));var router=express[_0x7259('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7259('0x5'));var interaction=require(_0x7259('0x6'));var config=require(_0x7259('0x7'));var controller=require(_0x7259('0x8'));router[_0x7259('0x9')]('/',auth['isAuthenticated'](),controller[_0x7259('0xa')]);router[_0x7259('0x9')](_0x7259('0xb'),auth['isAuthenticated'](),controller[_0x7259('0xc')]);router[_0x7259('0x9')](_0x7259('0xd'),auth[_0x7259('0xe')](),controller[_0x7259('0xf')]);router[_0x7259('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7259('0x10')]);router[_0x7259('0x9')](_0x7259('0x11'),auth[_0x7259('0xe')](),controller[_0x7259('0x12')]);router[_0x7259('0x13')]('/',auth[_0x7259('0xe')](),controller[_0x7259('0x14')]);router[_0x7259('0x15')]('/:id',auth[_0x7259('0xe')](),controller['update']);router['delete'](_0x7259('0xb'),auth[_0x7259('0xe')](),controller[_0x7259('0x16')]);module[_0x7259('0x17')]=router; \ No newline at end of file +var _0xc202=['/:id/fields','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','show','get'];(function(_0x50bf60,_0x6192e2){var _0x4916fd=function(_0xd3f18d){while(--_0xd3f18d){_0x50bf60['push'](_0x50bf60['shift']());}};_0x4916fd(++_0x6192e2);}(_0xc202,0x1ea));var _0x2c20=function(_0x4bb187,_0x11eed3){_0x4bb187=_0x4bb187-0x0;var _0x2a7530=_0xc202[_0x4bb187];return _0x2a7530;};'use strict';var multer=require(_0x2c20('0x0'));var util=require(_0x2c20('0x1'));var path=require(_0x2c20('0x2'));var timeout=require(_0x2c20('0x3'));var express=require(_0x2c20('0x4'));var router=express['Router']();var fs_extra=require(_0x2c20('0x5'));var auth=require(_0x2c20('0x6'));var interaction=require(_0x2c20('0x7'));var config=require(_0x2c20('0x8'));var controller=require(_0x2c20('0x9'));router['get']('/',auth[_0x2c20('0xa')](),controller[_0x2c20('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2c20('0xc')]);router[_0x2c20('0xd')](_0x2c20('0xe'),auth[_0x2c20('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x2c20('0xa')](),controller['getSubjects']);router[_0x2c20('0xd')](_0x2c20('0xf'),auth[_0x2c20('0xa')](),controller[_0x2c20('0x10')]);router[_0x2c20('0x11')]('/',auth['isAuthenticated'](),controller[_0x2c20('0x12')]);router[_0x2c20('0x13')](_0x2c20('0x14'),auth[_0x2c20('0xa')](),controller[_0x2c20('0x15')]);router[_0x2c20('0x16')](_0x2c20('0x14'),auth[_0x2c20('0xa')](),controller[_0x2c20('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5badd9f..9705dfe 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 _0x0495=['exports','STRING','sequelize'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0495,0x86));var _0x5049=function(_0x4591f7,_0x5bbb1d){_0x4591f7=_0x4591f7-0x0;var _0x2062bc=_0x0495[_0x4591f7];return _0x2062bc;};'use strict';var Sequelize=require(_0x5049('0x0'));module[_0x5049('0x1')]={'name':{'type':Sequelize[_0x5049('0x2')]},'description':{'type':Sequelize[_0x5049('0x2')]}}; \ No newline at end of file +var _0x1776=['sequelize','exports','STRING'];(function(_0x249325,_0x25aa88){var _0x46e1e3=function(_0x214642){while(--_0x214642){_0x249325['push'](_0x249325['shift']());}};_0x46e1e3(++_0x25aa88);}(_0x1776,0xdb));var _0x6177=function(_0x228c13,_0x527e14){_0x228c13=_0x228c13-0x0;var _0x29ed27=_0x1776[_0x228c13];return _0x29ed27;};'use strict';var Sequelize=require(_0x6177('0x0'));module[_0x6177('0x1')]={'name':{'type':Sequelize[_0x6177('0x2')]},'description':{'type':Sequelize[_0x6177('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1e50c70..861f3d7 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 _0x7aa0=['../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','ServicenowConfiguration','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','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'];(function(_0x2e00d2,_0x12ef23){var _0x5258f5=function(_0x26af03){while(--_0x26af03){_0x2e00d2['push'](_0x2e00d2['shift']());}};_0x5258f5(++_0x12ef23);}(_0x7aa0,0x8c));var _0x07aa=function(_0x1324dc,_0x430524){_0x1324dc=_0x1324dc-0x0;var _0x29f70f=_0x7aa0[_0x1324dc];return _0x29f70f;};'use strict';var emlformat=require(_0x07aa('0x0'));var rimraf=require(_0x07aa('0x1'));var zipdir=require(_0x07aa('0x2'));var jsonpatch=require(_0x07aa('0x3'));var rp=require(_0x07aa('0x4'));var moment=require('moment');var BPromise=require(_0x07aa('0x5'));var Mustache=require('mustache');var util=require(_0x07aa('0x6'));var path=require(_0x07aa('0x7'));var sox=require(_0x07aa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07aa('0x9'));var _=require(_0x07aa('0xa'));var squel=require(_0x07aa('0xb'));var crypto=require(_0x07aa('0xc'));var jsforce=require(_0x07aa('0xd'));var deskjs=require(_0x07aa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x07aa('0xf'));var Papa=require('papaparse');var Redis=require(_0x07aa('0x10'));var authService=require(_0x07aa('0x11'));var qs=require(_0x07aa('0x12'));var as=require(_0x07aa('0x13'));var hardwareService=require(_0x07aa('0x14'));var logger=require(_0x07aa('0x15'))(_0x07aa('0x16'));var utils=require(_0x07aa('0x17'));var config=require(_0x07aa('0x18'));var licenseUtil=require(_0x07aa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47ddb4,_0xe0788e){_0xe0788e=_0xe0788e||0xcc;return function(_0x2ba8d2){if(_0x2ba8d2){return _0x47ddb4[_0x07aa('0x1a')](_0xe0788e);}return _0x47ddb4['status'](_0xe0788e)[_0x07aa('0x1b')]();};}function respondWithResult(_0x39b1fc,_0x4c563c){_0x4c563c=_0x4c563c||0xc8;return function(_0x1eade1){if(_0x1eade1){return _0x39b1fc[_0x07aa('0x1c')](_0x4c563c)['json'](_0x1eade1);}};}function respondWithFilteredResult(_0x45450b,_0x1a2099){return function(_0x29a9a7){if(_0x29a9a7){var _0x29ab68=typeof _0x1a2099['offset']===_0x07aa('0x1d')&&typeof _0x1a2099['limit']===_0x07aa('0x1d');var _0x7bbe2b=_0x29a9a7[_0x07aa('0x1e')];var _0x3c9c56=_0x29ab68?0x0:_0x1a2099[_0x07aa('0x1f')];var _0x392031=_0x29ab68?_0x29a9a7[_0x07aa('0x1e')]:_0x1a2099[_0x07aa('0x1f')]+_0x1a2099['limit'];var _0x1b88f2;if(_0x392031>=_0x7bbe2b){_0x392031=_0x7bbe2b;_0x1b88f2=0xc8;}else{_0x1b88f2=0xce;}_0x45450b[_0x07aa('0x1c')](_0x1b88f2);return _0x45450b[_0x07aa('0x20')](_0x07aa('0x21'),_0x3c9c56+'-'+_0x392031+'/'+_0x7bbe2b)[_0x07aa('0x22')](_0x29a9a7);}return null;};}function patchUpdates(_0x242518){return function(_0x4193cd){try{jsonpatch['apply'](_0x4193cd,_0x242518,!![]);}catch(_0x36f2c2){return BPromise[_0x07aa('0x23')](_0x36f2c2);}return _0x4193cd[_0x07aa('0x24')]();};}function saveUpdates(_0x3a1f69,_0x28929a){return function(_0x5aeaea){if(_0x5aeaea){return _0x5aeaea[_0x07aa('0x25')](_0x3a1f69)[_0x07aa('0x26')](function(_0x121a7a){return _0x121a7a;});}return null;};}function removeEntity(_0x54e45d,_0x495bf5){return function(_0x30c0e0){if(_0x30c0e0){return _0x30c0e0[_0x07aa('0x27')]()[_0x07aa('0x26')](function(){_0x54e45d['status'](0xcc)[_0x07aa('0x1b')]();});}};}function handleEntityNotFound(_0x56686b,_0x1835d7){return function(_0x513cda){if(!_0x513cda){_0x56686b[_0x07aa('0x1a')](0x194);}return _0x513cda;};}function handleError(_0x3f18ee,_0x4f1314){_0x4f1314=_0x4f1314||0x1f4;return function(_0x59ffd0){logger[_0x07aa('0x28')](_0x59ffd0['stack']);if(_0x59ffd0[_0x07aa('0x29')]){delete _0x59ffd0[_0x07aa('0x29')];}_0x3f18ee[_0x07aa('0x1c')](_0x4f1314)[_0x07aa('0x2a')](_0x59ffd0);};}exports[_0x07aa('0x2b')]=function(_0x10826c,_0x5b391e){var _0x219da5={},_0x5330ae={},_0x20b980={'count':0x0,'rows':[]};var _0x3c1f13=_['map'](db['ServicenowConfiguration'][_0x07aa('0x2c')],function(_0x1e5d34){return{'name':_0x1e5d34[_0x07aa('0x2d')],'type':_0x1e5d34[_0x07aa('0x2e')]['key']};});_0x5330ae['model']=_['map'](_0x3c1f13,_0x07aa('0x29'));_0x5330ae[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x10826c[_0x07aa('0x2f')]);_0x5330ae[_0x07aa('0x31')]=_[_0x07aa('0x32')](_0x5330ae['model'],_0x5330ae[_0x07aa('0x2f')]);_0x219da5['attributes']=_[_0x07aa('0x32')](_0x5330ae[_0x07aa('0x33')],qs['fields'](_0x10826c[_0x07aa('0x2f')][_0x07aa('0x34')]));_0x219da5[_0x07aa('0x35')]=_0x219da5['attributes']['length']?_0x219da5[_0x07aa('0x35')]:_0x5330ae['model'];if(!_0x10826c[_0x07aa('0x2f')][_0x07aa('0x36')]('nolimit')){_0x219da5['limit']=qs[_0x07aa('0x37')](_0x10826c['query']['limit']);_0x219da5[_0x07aa('0x1f')]=qs['offset'](_0x10826c[_0x07aa('0x2f')][_0x07aa('0x1f')]);}_0x219da5[_0x07aa('0x38')]=qs[_0x07aa('0x39')](_0x10826c['query']['sort']);_0x219da5[_0x07aa('0x3a')]=qs['filters'](_[_0x07aa('0x3b')](_0x10826c[_0x07aa('0x2f')],_0x5330ae[_0x07aa('0x31')]),_0x3c1f13);if(_0x10826c[_0x07aa('0x2f')][_0x07aa('0x3c')]){_0x219da5['where']=_[_0x07aa('0x3d')](_0x219da5[_0x07aa('0x3a')],{'$or':_[_0x07aa('0x3e')](_0x3c1f13,function(_0x2ec867){if(_0x2ec867['type']!==_0x07aa('0x3f')){var _0x4a80eb={};_0x4a80eb[_0x2ec867[_0x07aa('0x29')]]={'$like':'%'+_0x10826c['query'][_0x07aa('0x3c')]+'%'};return _0x4a80eb;}})});}_0x219da5=_[_0x07aa('0x3d')]({},_0x219da5,_0x10826c['options']);var _0x28dd6d={'where':_0x219da5[_0x07aa('0x3a')]};return db[_0x07aa('0x40')][_0x07aa('0x1e')](_0x28dd6d)[_0x07aa('0x26')](function(_0x3e9064){_0x20b980[_0x07aa('0x1e')]=_0x3e9064;if(_0x10826c['query'][_0x07aa('0x41')]){_0x219da5[_0x07aa('0x42')]=[{'all':!![]}];}return db[_0x07aa('0x40')][_0x07aa('0x43')](_0x219da5);})[_0x07aa('0x26')](function(_0x3892df){_0x20b980[_0x07aa('0x44')]=_0x3892df;return _0x20b980;})[_0x07aa('0x26')](respondWithFilteredResult(_0x5b391e,_0x219da5))[_0x07aa('0x45')](handleError(_0x5b391e,null));};exports['show']=function(_0x1b8bbf,_0x74de4d){var _0x4c1114={'raw':![],'where':{'id':_0x1b8bbf[_0x07aa('0x46')]['id']}},_0x227e15={};_0x227e15[_0x07aa('0x33')]=_['keys'](db[_0x07aa('0x40')][_0x07aa('0x2c')]);_0x227e15[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x1b8bbf['query']);_0x227e15['filters']=_['intersection'](_0x227e15[_0x07aa('0x33')],_0x227e15[_0x07aa('0x2f')]);_0x4c1114[_0x07aa('0x35')]=_[_0x07aa('0x32')](_0x227e15[_0x07aa('0x33')],qs['fields'](_0x1b8bbf[_0x07aa('0x2f')][_0x07aa('0x34')]));_0x4c1114[_0x07aa('0x35')]=_0x4c1114['attributes'][_0x07aa('0x47')]?_0x4c1114[_0x07aa('0x35')]:_0x227e15[_0x07aa('0x33')];if(_0x1b8bbf[_0x07aa('0x2f')]['includeAll']){_0x4c1114['include']=[{'all':!![]}];}_0x4c1114=_[_0x07aa('0x3d')]({},_0x4c1114,_0x1b8bbf[_0x07aa('0x48')]);return db[_0x07aa('0x40')]['find'](_0x4c1114)[_0x07aa('0x26')](handleEntityNotFound(_0x74de4d,null))[_0x07aa('0x26')](respondWithResult(_0x74de4d,null))[_0x07aa('0x45')](handleError(_0x74de4d,null));};exports[_0x07aa('0x49')]=function(_0x31c41c,_0x390f93){return db[_0x07aa('0x40')]['create'](_0x31c41c[_0x07aa('0x4a')],{})[_0x07aa('0x26')](respondWithResult(_0x390f93,0xc9))[_0x07aa('0x45')](handleError(_0x390f93,null));};exports[_0x07aa('0x25')]=function(_0xca0ca1,_0x18de86){if(_0xca0ca1[_0x07aa('0x4a')]['id']){delete _0xca0ca1[_0x07aa('0x4a')]['id'];}return db[_0x07aa('0x40')][_0x07aa('0x4b')]({'where':{'id':_0xca0ca1[_0x07aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x18de86,null))[_0x07aa('0x26')](saveUpdates(_0xca0ca1['body'],null))[_0x07aa('0x26')](respondWithResult(_0x18de86,null))[_0x07aa('0x45')](handleError(_0x18de86,null));};exports['destroy']=function(_0x21998e,_0x23c996){return db[_0x07aa('0x40')][_0x07aa('0x4b')]({'where':{'id':_0x21998e[_0x07aa('0x46')]['id']}})[_0x07aa('0x26')](handleEntityNotFound(_0x23c996,null))[_0x07aa('0x26')](removeEntity(_0x23c996,null))[_0x07aa('0x45')](handleError(_0x23c996,null));};exports[_0x07aa('0x4c')]=function(_0x85a822,_0x3105d6,_0x550285){var _0x56bea2={};var _0x3fa8b={};var _0x37fa9b;var _0x5f1702;return db[_0x07aa('0x40')][_0x07aa('0x4d')]({'where':{'id':_0x85a822[_0x07aa('0x46')]['id']}})[_0x07aa('0x26')](handleEntityNotFound(_0x3105d6,null))[_0x07aa('0x26')](function(_0x5f4354){if(_0x5f4354){_0x37fa9b=_0x5f4354;_0x3fa8b[_0x07aa('0x33')]=_[_0x07aa('0x30')](db[_0x07aa('0x4e')]['rawAttributes']);_0x3fa8b['query']=_[_0x07aa('0x30')](_0x85a822[_0x07aa('0x2f')]);_0x3fa8b[_0x07aa('0x31')]=_[_0x07aa('0x32')](_0x3fa8b[_0x07aa('0x33')],_0x3fa8b[_0x07aa('0x2f')]);_0x56bea2[_0x07aa('0x35')]=_['intersection'](_0x3fa8b[_0x07aa('0x33')],qs[_0x07aa('0x34')](_0x85a822['query'][_0x07aa('0x34')]));_0x56bea2[_0x07aa('0x35')]=_0x56bea2[_0x07aa('0x35')][_0x07aa('0x47')]?_0x56bea2['attributes']:_0x3fa8b[_0x07aa('0x33')];_0x56bea2['order']=qs[_0x07aa('0x39')](_0x85a822['query'][_0x07aa('0x39')]);_0x56bea2[_0x07aa('0x3a')]=qs[_0x07aa('0x31')](_['pick'](_0x85a822[_0x07aa('0x2f')],_0x3fa8b[_0x07aa('0x31')]));if(_0x85a822[_0x07aa('0x2f')][_0x07aa('0x3c')]){_0x56bea2[_0x07aa('0x3a')]=_[_0x07aa('0x3d')](_0x56bea2[_0x07aa('0x3a')],{'$or':_[_0x07aa('0x3e')](_0x56bea2[_0x07aa('0x35')],function(_0x1b417e){var _0x1348be={};_0x1348be[_0x1b417e]={'$like':'%'+_0x85a822[_0x07aa('0x2f')][_0x07aa('0x3c')]+'%'};return _0x1348be;})});}_0x56bea2=_[_0x07aa('0x3d')]({},_0x56bea2,_0x85a822[_0x07aa('0x48')]);return _0x37fa9b['getFields'](_0x56bea2);}})['then'](function(_0x1ebcae){if(_0x1ebcae){_0x5f1702=_0x1ebcae[_0x07aa('0x47')];if(!_0x85a822[_0x07aa('0x2f')][_0x07aa('0x36')](_0x07aa('0x4f'))){_0x56bea2[_0x07aa('0x37')]=qs[_0x07aa('0x37')](_0x85a822['query'][_0x07aa('0x37')]);_0x56bea2[_0x07aa('0x1f')]=qs['offset'](_0x85a822[_0x07aa('0x2f')]['offset']);}return _0x37fa9b[_0x07aa('0x4c')](_0x56bea2);}})[_0x07aa('0x26')](function(_0x72b1e7){if(_0x72b1e7){return _0x72b1e7?{'count':_0x5f1702,'rows':_0x72b1e7}:null;}})[_0x07aa('0x26')](respondWithResult(_0x3105d6,null))[_0x07aa('0x45')](handleError(_0x3105d6,null));};exports[_0x07aa('0x50')]=function(_0x531fad,_0x316101,_0x33ee86){var _0x1e99f8={};var _0x2eea49={};var _0x560f79;var _0x411feb;return db[_0x07aa('0x40')][_0x07aa('0x4d')]({'where':{'id':_0x531fad[_0x07aa('0x46')]['id']}})[_0x07aa('0x26')](handleEntityNotFound(_0x316101,null))[_0x07aa('0x26')](function(_0x2bfcc0){if(_0x2bfcc0){_0x560f79=_0x2bfcc0;_0x2eea49['model']=_[_0x07aa('0x30')](db[_0x07aa('0x4e')][_0x07aa('0x2c')]);_0x2eea49[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x531fad['query']);_0x2eea49[_0x07aa('0x31')]=_[_0x07aa('0x32')](_0x2eea49[_0x07aa('0x33')],_0x2eea49[_0x07aa('0x2f')]);_0x1e99f8[_0x07aa('0x35')]=_['intersection'](_0x2eea49[_0x07aa('0x33')],qs['fields'](_0x531fad[_0x07aa('0x2f')][_0x07aa('0x34')]));_0x1e99f8[_0x07aa('0x35')]=_0x1e99f8[_0x07aa('0x35')]['length']?_0x1e99f8[_0x07aa('0x35')]:_0x2eea49[_0x07aa('0x33')];_0x1e99f8['order']=qs[_0x07aa('0x39')](_0x531fad[_0x07aa('0x2f')][_0x07aa('0x39')]);_0x1e99f8[_0x07aa('0x3a')]=qs[_0x07aa('0x31')](_[_0x07aa('0x3b')](_0x531fad[_0x07aa('0x2f')],_0x2eea49[_0x07aa('0x31')]));if(_0x531fad[_0x07aa('0x2f')][_0x07aa('0x3c')]){_0x1e99f8[_0x07aa('0x3a')]=_[_0x07aa('0x3d')](_0x1e99f8[_0x07aa('0x3a')],{'$or':_[_0x07aa('0x3e')](_0x1e99f8['attributes'],function(_0x44b8d6){var _0x33f7d3={};_0x33f7d3[_0x44b8d6]={'$like':'%'+_0x531fad['query']['filter']+'%'};return _0x33f7d3;})});}_0x1e99f8=_[_0x07aa('0x3d')]({},_0x1e99f8,_0x531fad[_0x07aa('0x48')]);return _0x560f79['getSubjects'](_0x1e99f8);}})[_0x07aa('0x26')](function(_0x5d0894){if(_0x5d0894){_0x411feb=_0x5d0894[_0x07aa('0x47')];if(!_0x531fad[_0x07aa('0x2f')][_0x07aa('0x36')]('nolimit')){_0x1e99f8[_0x07aa('0x37')]=qs[_0x07aa('0x37')](_0x531fad[_0x07aa('0x2f')][_0x07aa('0x37')]);_0x1e99f8[_0x07aa('0x1f')]=qs['offset'](_0x531fad['query'][_0x07aa('0x1f')]);}return _0x560f79['getSubjects'](_0x1e99f8);}})[_0x07aa('0x26')](function(_0xc187b2){if(_0xc187b2){return _0xc187b2?{'count':_0x411feb,'rows':_0xc187b2}:null;}})[_0x07aa('0x26')](respondWithResult(_0x316101,null))[_0x07aa('0x45')](handleError(_0x316101,null));};exports[_0x07aa('0x51')]=function(_0x1cb771,_0x5075be,_0x3ae255){var _0x2de904={};var _0x1dbc86={};var _0x39fbde;var _0x581ebe;return db[_0x07aa('0x40')]['findOne']({'where':{'id':_0x1cb771[_0x07aa('0x46')]['id']}})[_0x07aa('0x26')](handleEntityNotFound(_0x5075be,null))[_0x07aa('0x26')](function(_0x39e6e2){if(_0x39e6e2){_0x39fbde=_0x39e6e2;_0x1dbc86[_0x07aa('0x33')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x1dbc86[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x1cb771[_0x07aa('0x2f')]);_0x1dbc86['filters']=_[_0x07aa('0x32')](_0x1dbc86[_0x07aa('0x33')],_0x1dbc86[_0x07aa('0x2f')]);_0x2de904[_0x07aa('0x35')]=_[_0x07aa('0x32')](_0x1dbc86[_0x07aa('0x33')],qs[_0x07aa('0x34')](_0x1cb771['query'][_0x07aa('0x34')]));_0x2de904[_0x07aa('0x35')]=_0x2de904[_0x07aa('0x35')][_0x07aa('0x47')]?_0x2de904[_0x07aa('0x35')]:_0x1dbc86[_0x07aa('0x33')];_0x2de904[_0x07aa('0x38')]=qs[_0x07aa('0x39')](_0x1cb771[_0x07aa('0x2f')][_0x07aa('0x39')]);_0x2de904['where']=qs[_0x07aa('0x31')](_[_0x07aa('0x3b')](_0x1cb771[_0x07aa('0x2f')],_0x1dbc86[_0x07aa('0x31')]));if(_0x1cb771[_0x07aa('0x2f')]['filter']){_0x2de904[_0x07aa('0x3a')]=_[_0x07aa('0x3d')](_0x2de904[_0x07aa('0x3a')],{'$or':_[_0x07aa('0x3e')](_0x2de904[_0x07aa('0x35')],function(_0x1eeebe){var _0x177c48={};_0x177c48[_0x1eeebe]={'$like':'%'+_0x1cb771[_0x07aa('0x2f')][_0x07aa('0x3c')]+'%'};return _0x177c48;})});}_0x2de904=_[_0x07aa('0x3d')]({},_0x2de904,_0x1cb771[_0x07aa('0x48')]);return _0x39fbde[_0x07aa('0x51')](_0x2de904);}})[_0x07aa('0x26')](function(_0x1f0e6e){if(_0x1f0e6e){_0x581ebe=_0x1f0e6e['length'];if(!_0x1cb771[_0x07aa('0x2f')][_0x07aa('0x36')](_0x07aa('0x4f'))){_0x2de904[_0x07aa('0x37')]=qs['limit'](_0x1cb771[_0x07aa('0x2f')][_0x07aa('0x37')]);_0x2de904['offset']=qs['offset'](_0x1cb771[_0x07aa('0x2f')][_0x07aa('0x1f')]);}return _0x39fbde[_0x07aa('0x51')](_0x2de904);}})['then'](function(_0x1660e9){if(_0x1660e9){return _0x1660e9?{'count':_0x581ebe,'rows':_0x1660e9}:null;}})[_0x07aa('0x26')](respondWithResult(_0x5075be,null))['catch'](handleError(_0x5075be,null));}; \ No newline at end of file +var _0x96ef=['intersection','fields','length','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x52fbc8,_0x9d40b2){var _0x5df1ff=function(_0x5dcd7b){while(--_0x5dcd7b){_0x52fbc8['push'](_0x52fbc8['shift']());}};_0x5df1ff(++_0x9d40b2);}(_0x96ef,0x1ad));var _0xf96e=function(_0x3c5adc,_0x1bb9f9){_0x3c5adc=_0x3c5adc-0x0;var _0x8c62ba=_0x96ef[_0x3c5adc];return _0x8c62ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf96e('0x0'));var zipdir=require(_0xf96e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf96e('0x2'));var moment=require(_0xf96e('0x3'));var BPromise=require(_0xf96e('0x4'));var Mustache=require(_0xf96e('0x5'));var util=require('util');var path=require(_0xf96e('0x6'));var sox=require(_0xf96e('0x7'));var csv=require(_0xf96e('0x8'));var ejs=require(_0xf96e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf96e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf96e('0xb'));var deskjs=require(_0xf96e('0xc'));var toCsv=require(_0xf96e('0x8'));var querystring=require('querystring');var Papa=require(_0xf96e('0xd'));var Redis=require(_0xf96e('0xe'));var authService=require(_0xf96e('0xf'));var qs=require(_0xf96e('0x10'));var as=require(_0xf96e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf96e('0x12'))(_0xf96e('0x13'));var utils=require(_0xf96e('0x14'));var config=require(_0xf96e('0x15'));var licenseUtil=require(_0xf96e('0x16'));var db=require(_0xf96e('0x17'))['db'];function respondWithStatusCode(_0x104e82,_0x52bc4e){_0x52bc4e=_0x52bc4e||0xcc;return function(_0x2baa27){if(_0x2baa27){return _0x104e82['sendStatus'](_0x52bc4e);}return _0x104e82[_0xf96e('0x18')](_0x52bc4e)[_0xf96e('0x19')]();};}function respondWithResult(_0x100017,_0x5888d7){_0x5888d7=_0x5888d7||0xc8;return function(_0x1ca284){if(_0x1ca284){return _0x100017['status'](_0x5888d7)[_0xf96e('0x1a')](_0x1ca284);}};}function respondWithFilteredResult(_0x546229,_0x1a7244){return function(_0x518fb1){if(_0x518fb1){var _0x3b7d7c=typeof _0x1a7244[_0xf96e('0x1b')]===_0xf96e('0x1c')&&typeof _0x1a7244[_0xf96e('0x1d')]===_0xf96e('0x1c');var _0x5c2d3b=_0x518fb1[_0xf96e('0x1e')];var _0x509215=_0x3b7d7c?0x0:_0x1a7244[_0xf96e('0x1b')];var _0x3f9b87=_0x3b7d7c?_0x518fb1[_0xf96e('0x1e')]:_0x1a7244[_0xf96e('0x1b')]+_0x1a7244['limit'];var _0x188bae;if(_0x3f9b87>=_0x5c2d3b){_0x3f9b87=_0x5c2d3b;_0x188bae=0xc8;}else{_0x188bae=0xce;}_0x546229[_0xf96e('0x18')](_0x188bae);return _0x546229[_0xf96e('0x1f')]('Content-Range',_0x509215+'-'+_0x3f9b87+'/'+_0x5c2d3b)[_0xf96e('0x1a')](_0x518fb1);}return null;};}function patchUpdates(_0x4b6972){return function(_0x2425f5){try{jsonpatch['apply'](_0x2425f5,_0x4b6972,!![]);}catch(_0x19c98a){return BPromise[_0xf96e('0x20')](_0x19c98a);}return _0x2425f5['save']();};}function saveUpdates(_0x54f1cf,_0x218328){return function(_0x379a0e){if(_0x379a0e){return _0x379a0e[_0xf96e('0x21')](_0x54f1cf)[_0xf96e('0x22')](function(_0x166db1){return _0x166db1;});}return null;};}function removeEntity(_0x42d847,_0x3af06d){return function(_0x57b96f){if(_0x57b96f){return _0x57b96f[_0xf96e('0x23')]()[_0xf96e('0x22')](function(){_0x42d847[_0xf96e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3109f2,_0x14ed3d){return function(_0x5e0a77){if(!_0x5e0a77){_0x3109f2[_0xf96e('0x24')](0x194);}return _0x5e0a77;};}function handleError(_0x356ae7,_0x456df8){_0x456df8=_0x456df8||0x1f4;return function(_0xc81fd6){logger[_0xf96e('0x25')](_0xc81fd6[_0xf96e('0x26')]);if(_0xc81fd6[_0xf96e('0x27')]){delete _0xc81fd6[_0xf96e('0x27')];}_0x356ae7['status'](_0x456df8)['send'](_0xc81fd6);};}exports[_0xf96e('0x28')]=function(_0x3436bd,_0x409a50){var _0x229482={},_0x41a56d={},_0x47e8cf={'count':0x0,'rows':[]};var _0x35eb01=_[_0xf96e('0x29')](db[_0xf96e('0x2a')][_0xf96e('0x2b')],function(_0x28494c){return{'name':_0x28494c[_0xf96e('0x2c')],'type':_0x28494c[_0xf96e('0x2d')][_0xf96e('0x2e')]};});_0x41a56d[_0xf96e('0x2f')]=_[_0xf96e('0x29')](_0x35eb01,_0xf96e('0x27'));_0x41a56d['query']=_[_0xf96e('0x30')](_0x3436bd[_0xf96e('0x31')]);_0x41a56d[_0xf96e('0x32')]=_[_0xf96e('0x33')](_0x41a56d[_0xf96e('0x2f')],_0x41a56d['query']);_0x229482['attributes']=_[_0xf96e('0x33')](_0x41a56d[_0xf96e('0x2f')],qs['fields'](_0x3436bd['query'][_0xf96e('0x34')]));_0x229482['attributes']=_0x229482['attributes'][_0xf96e('0x35')]?_0x229482[_0xf96e('0x36')]:_0x41a56d[_0xf96e('0x2f')];if(!_0x3436bd[_0xf96e('0x31')]['hasOwnProperty']('nolimit')){_0x229482[_0xf96e('0x1d')]=qs[_0xf96e('0x1d')](_0x3436bd[_0xf96e('0x31')][_0xf96e('0x1d')]);_0x229482[_0xf96e('0x1b')]=qs[_0xf96e('0x1b')](_0x3436bd[_0xf96e('0x31')][_0xf96e('0x1b')]);}_0x229482[_0xf96e('0x37')]=qs[_0xf96e('0x38')](_0x3436bd[_0xf96e('0x31')]['sort']);_0x229482[_0xf96e('0x39')]=qs['filters'](_[_0xf96e('0x3a')](_0x3436bd[_0xf96e('0x31')],_0x41a56d[_0xf96e('0x32')]),_0x35eb01);if(_0x3436bd[_0xf96e('0x31')][_0xf96e('0x3b')]){_0x229482[_0xf96e('0x39')]=_[_0xf96e('0x3c')](_0x229482[_0xf96e('0x39')],{'$or':_[_0xf96e('0x29')](_0x35eb01,function(_0x152ab9){if(_0x152ab9['type']!==_0xf96e('0x3d')){var _0x26782c={};_0x26782c[_0x152ab9['name']]={'$like':'%'+_0x3436bd[_0xf96e('0x31')]['filter']+'%'};return _0x26782c;}})});}_0x229482=_[_0xf96e('0x3c')]({},_0x229482,_0x3436bd[_0xf96e('0x3e')]);var _0x403a5={'where':_0x229482[_0xf96e('0x39')]};return db['ServicenowConfiguration'][_0xf96e('0x1e')](_0x403a5)[_0xf96e('0x22')](function(_0xb7895b){_0x47e8cf['count']=_0xb7895b;if(_0x3436bd['query'][_0xf96e('0x3f')]){_0x229482[_0xf96e('0x40')]=[{'all':!![]}];}return db[_0xf96e('0x2a')][_0xf96e('0x41')](_0x229482);})[_0xf96e('0x22')](function(_0x276318){_0x47e8cf[_0xf96e('0x42')]=_0x276318;return _0x47e8cf;})[_0xf96e('0x22')](respondWithFilteredResult(_0x409a50,_0x229482))[_0xf96e('0x43')](handleError(_0x409a50,null));};exports[_0xf96e('0x44')]=function(_0x577119,_0x4c2d93){var _0x4285a5={'raw':![],'where':{'id':_0x577119[_0xf96e('0x45')]['id']}},_0xbf4ce7={};_0xbf4ce7[_0xf96e('0x2f')]=_[_0xf96e('0x30')](db[_0xf96e('0x2a')][_0xf96e('0x2b')]);_0xbf4ce7[_0xf96e('0x31')]=_['keys'](_0x577119['query']);_0xbf4ce7[_0xf96e('0x32')]=_[_0xf96e('0x33')](_0xbf4ce7['model'],_0xbf4ce7[_0xf96e('0x31')]);_0x4285a5[_0xf96e('0x36')]=_[_0xf96e('0x33')](_0xbf4ce7['model'],qs[_0xf96e('0x34')](_0x577119[_0xf96e('0x31')][_0xf96e('0x34')]));_0x4285a5[_0xf96e('0x36')]=_0x4285a5[_0xf96e('0x36')]['length']?_0x4285a5['attributes']:_0xbf4ce7[_0xf96e('0x2f')];if(_0x577119[_0xf96e('0x31')][_0xf96e('0x3f')]){_0x4285a5[_0xf96e('0x40')]=[{'all':!![]}];}_0x4285a5=_[_0xf96e('0x3c')]({},_0x4285a5,_0x577119['options']);return db[_0xf96e('0x2a')][_0xf96e('0x46')](_0x4285a5)['then'](handleEntityNotFound(_0x4c2d93,null))[_0xf96e('0x22')](respondWithResult(_0x4c2d93,null))[_0xf96e('0x43')](handleError(_0x4c2d93,null));};exports['create']=function(_0x33c2ff,_0x27390a){return db[_0xf96e('0x2a')][_0xf96e('0x47')](_0x33c2ff[_0xf96e('0x48')],{})[_0xf96e('0x22')](respondWithResult(_0x27390a,0xc9))['catch'](handleError(_0x27390a,null));};exports[_0xf96e('0x21')]=function(_0x4b2200,_0x318d61){if(_0x4b2200[_0xf96e('0x48')]['id']){delete _0x4b2200[_0xf96e('0x48')]['id'];}return db[_0xf96e('0x2a')][_0xf96e('0x46')]({'where':{'id':_0x4b2200[_0xf96e('0x45')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x318d61,null))[_0xf96e('0x22')](saveUpdates(_0x4b2200[_0xf96e('0x48')],null))[_0xf96e('0x22')](respondWithResult(_0x318d61,null))[_0xf96e('0x43')](handleError(_0x318d61,null));};exports[_0xf96e('0x23')]=function(_0x50852b,_0x23a3a9){return db[_0xf96e('0x2a')][_0xf96e('0x46')]({'where':{'id':_0x50852b['params']['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x23a3a9,null))[_0xf96e('0x22')](removeEntity(_0x23a3a9,null))[_0xf96e('0x43')](handleError(_0x23a3a9,null));};exports[_0xf96e('0x49')]=function(_0x5ed577,_0x42f760,_0x3de271){var _0x228c72={};var _0xc5d7fd={};var _0x4982f0;var _0x118da2;return db[_0xf96e('0x2a')][_0xf96e('0x4a')]({'where':{'id':_0x5ed577[_0xf96e('0x45')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x42f760,null))[_0xf96e('0x22')](function(_0x1c1125){if(_0x1c1125){_0x4982f0=_0x1c1125;_0xc5d7fd[_0xf96e('0x2f')]=_[_0xf96e('0x30')](db[_0xf96e('0x4b')][_0xf96e('0x2b')]);_0xc5d7fd[_0xf96e('0x31')]=_['keys'](_0x5ed577[_0xf96e('0x31')]);_0xc5d7fd[_0xf96e('0x32')]=_[_0xf96e('0x33')](_0xc5d7fd[_0xf96e('0x2f')],_0xc5d7fd[_0xf96e('0x31')]);_0x228c72[_0xf96e('0x36')]=_[_0xf96e('0x33')](_0xc5d7fd[_0xf96e('0x2f')],qs[_0xf96e('0x34')](_0x5ed577[_0xf96e('0x31')]['fields']));_0x228c72[_0xf96e('0x36')]=_0x228c72[_0xf96e('0x36')][_0xf96e('0x35')]?_0x228c72[_0xf96e('0x36')]:_0xc5d7fd[_0xf96e('0x2f')];_0x228c72['order']=qs[_0xf96e('0x38')](_0x5ed577[_0xf96e('0x31')][_0xf96e('0x38')]);_0x228c72[_0xf96e('0x39')]=qs[_0xf96e('0x32')](_[_0xf96e('0x3a')](_0x5ed577[_0xf96e('0x31')],_0xc5d7fd[_0xf96e('0x32')]));if(_0x5ed577[_0xf96e('0x31')][_0xf96e('0x3b')]){_0x228c72[_0xf96e('0x39')]=_[_0xf96e('0x3c')](_0x228c72['where'],{'$or':_[_0xf96e('0x29')](_0x228c72['attributes'],function(_0x344bf8){var _0xcdcb66={};_0xcdcb66[_0x344bf8]={'$like':'%'+_0x5ed577[_0xf96e('0x31')][_0xf96e('0x3b')]+'%'};return _0xcdcb66;})});}_0x228c72=_[_0xf96e('0x3c')]({},_0x228c72,_0x5ed577[_0xf96e('0x3e')]);return _0x4982f0[_0xf96e('0x49')](_0x228c72);}})[_0xf96e('0x22')](function(_0x40735b){if(_0x40735b){_0x118da2=_0x40735b[_0xf96e('0x35')];if(!_0x5ed577[_0xf96e('0x31')][_0xf96e('0x4c')](_0xf96e('0x4d'))){_0x228c72[_0xf96e('0x1d')]=qs[_0xf96e('0x1d')](_0x5ed577[_0xf96e('0x31')][_0xf96e('0x1d')]);_0x228c72[_0xf96e('0x1b')]=qs[_0xf96e('0x1b')](_0x5ed577[_0xf96e('0x31')]['offset']);}return _0x4982f0[_0xf96e('0x49')](_0x228c72);}})[_0xf96e('0x22')](function(_0x28aa60){if(_0x28aa60){return _0x28aa60?{'count':_0x118da2,'rows':_0x28aa60}:null;}})[_0xf96e('0x22')](respondWithResult(_0x42f760,null))['catch'](handleError(_0x42f760,null));};exports[_0xf96e('0x4e')]=function(_0x351e0f,_0x32bc13,_0x32ed46){var _0x555f14={};var _0x459e18={};var _0x457eb3;var _0x3fc65e;return db[_0xf96e('0x2a')][_0xf96e('0x4a')]({'where':{'id':_0x351e0f[_0xf96e('0x45')]['id']}})['then'](handleEntityNotFound(_0x32bc13,null))[_0xf96e('0x22')](function(_0x461bee){if(_0x461bee){_0x457eb3=_0x461bee;_0x459e18[_0xf96e('0x2f')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x459e18[_0xf96e('0x31')]=_['keys'](_0x351e0f[_0xf96e('0x31')]);_0x459e18[_0xf96e('0x32')]=_[_0xf96e('0x33')](_0x459e18[_0xf96e('0x2f')],_0x459e18[_0xf96e('0x31')]);_0x555f14[_0xf96e('0x36')]=_[_0xf96e('0x33')](_0x459e18[_0xf96e('0x2f')],qs[_0xf96e('0x34')](_0x351e0f['query']['fields']));_0x555f14[_0xf96e('0x36')]=_0x555f14[_0xf96e('0x36')][_0xf96e('0x35')]?_0x555f14[_0xf96e('0x36')]:_0x459e18['model'];_0x555f14['order']=qs[_0xf96e('0x38')](_0x351e0f[_0xf96e('0x31')][_0xf96e('0x38')]);_0x555f14['where']=qs['filters'](_[_0xf96e('0x3a')](_0x351e0f[_0xf96e('0x31')],_0x459e18[_0xf96e('0x32')]));if(_0x351e0f[_0xf96e('0x31')][_0xf96e('0x3b')]){_0x555f14[_0xf96e('0x39')]=_[_0xf96e('0x3c')](_0x555f14['where'],{'$or':_[_0xf96e('0x29')](_0x555f14[_0xf96e('0x36')],function(_0x1e53d6){var _0x3b16a1={};_0x3b16a1[_0x1e53d6]={'$like':'%'+_0x351e0f[_0xf96e('0x31')][_0xf96e('0x3b')]+'%'};return _0x3b16a1;})});}_0x555f14=_[_0xf96e('0x3c')]({},_0x555f14,_0x351e0f[_0xf96e('0x3e')]);return _0x457eb3[_0xf96e('0x4e')](_0x555f14);}})[_0xf96e('0x22')](function(_0x382cfc){if(_0x382cfc){_0x3fc65e=_0x382cfc[_0xf96e('0x35')];if(!_0x351e0f['query']['hasOwnProperty'](_0xf96e('0x4d'))){_0x555f14[_0xf96e('0x1d')]=qs['limit'](_0x351e0f[_0xf96e('0x31')]['limit']);_0x555f14[_0xf96e('0x1b')]=qs[_0xf96e('0x1b')](_0x351e0f[_0xf96e('0x31')][_0xf96e('0x1b')]);}return _0x457eb3['getSubjects'](_0x555f14);}})['then'](function(_0x3daa03){if(_0x3daa03){return _0x3daa03?{'count':_0x3fc65e,'rows':_0x3daa03}:null;}})[_0xf96e('0x22')](respondWithResult(_0x32bc13,null))[_0xf96e('0x43')](handleError(_0x32bc13,null));};exports[_0xf96e('0x4f')]=function(_0x51958f,_0x18916a,_0x3e05c9){var _0x30c22c={};var _0x303c25={};var _0x1989cf;var _0x509de5;return db[_0xf96e('0x2a')][_0xf96e('0x4a')]({'where':{'id':_0x51958f[_0xf96e('0x45')]['id']}})['then'](handleEntityNotFound(_0x18916a,null))[_0xf96e('0x22')](function(_0x70675f){if(_0x70675f){_0x1989cf=_0x70675f;_0x303c25[_0xf96e('0x2f')]=_[_0xf96e('0x30')](db[_0xf96e('0x4b')][_0xf96e('0x2b')]);_0x303c25[_0xf96e('0x31')]=_[_0xf96e('0x30')](_0x51958f[_0xf96e('0x31')]);_0x303c25['filters']=_[_0xf96e('0x33')](_0x303c25[_0xf96e('0x2f')],_0x303c25['query']);_0x30c22c[_0xf96e('0x36')]=_[_0xf96e('0x33')](_0x303c25[_0xf96e('0x2f')],qs[_0xf96e('0x34')](_0x51958f[_0xf96e('0x31')][_0xf96e('0x34')]));_0x30c22c['attributes']=_0x30c22c['attributes'][_0xf96e('0x35')]?_0x30c22c[_0xf96e('0x36')]:_0x303c25[_0xf96e('0x2f')];_0x30c22c[_0xf96e('0x37')]=qs['sort'](_0x51958f['query'][_0xf96e('0x38')]);_0x30c22c[_0xf96e('0x39')]=qs['filters'](_[_0xf96e('0x3a')](_0x51958f['query'],_0x303c25[_0xf96e('0x32')]));if(_0x51958f[_0xf96e('0x31')]['filter']){_0x30c22c['where']=_[_0xf96e('0x3c')](_0x30c22c[_0xf96e('0x39')],{'$or':_[_0xf96e('0x29')](_0x30c22c[_0xf96e('0x36')],function(_0x52046a){var _0x330e0c={};_0x330e0c[_0x52046a]={'$like':'%'+_0x51958f[_0xf96e('0x31')]['filter']+'%'};return _0x330e0c;})});}_0x30c22c=_['merge']({},_0x30c22c,_0x51958f['options']);return _0x1989cf['getDescriptions'](_0x30c22c);}})[_0xf96e('0x22')](function(_0x5a3b7d){if(_0x5a3b7d){_0x509de5=_0x5a3b7d[_0xf96e('0x35')];if(!_0x51958f[_0xf96e('0x31')]['hasOwnProperty'](_0xf96e('0x4d'))){_0x30c22c[_0xf96e('0x1d')]=qs[_0xf96e('0x1d')](_0x51958f[_0xf96e('0x31')][_0xf96e('0x1d')]);_0x30c22c[_0xf96e('0x1b')]=qs['offset'](_0x51958f['query']['offset']);}return _0x1989cf[_0xf96e('0x4f')](_0x30c22c);}})[_0xf96e('0x22')](function(_0x45417c){if(_0x45417c){return _0x45417c?{'count':_0x509de5,'rows':_0x45417c}:null;}})[_0xf96e('0x22')](respondWithResult(_0x18916a,null))['catch'](handleError(_0x18916a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4de8b85..f0c24b1 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 _0x7269=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x5a6c96,_0x5de6a3){var _0xc0b988=function(_0xf82ead){while(--_0xf82ead){_0x5a6c96['push'](_0x5a6c96['shift']());}};_0xc0b988(++_0x5de6a3);}(_0x7269,0x76));var _0x9726=function(_0x31647b,_0x389c08){_0x31647b=_0x31647b-0x0;var _0x28a70b=_0x7269[_0x31647b];return _0x28a70b;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var logger=require(_0x9726('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9726('0x3'));var rp=require(_0x9726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9726('0x5'));var config=require(_0x9726('0x6'));var attributes=require(_0x9726('0x7'));module[_0x9726('0x8')]=function(_0x795889,_0x832cb){return _0x795889[_0x9726('0x9')](_0x9726('0xa'),attributes,{'tableName':_0x9726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8768=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x484bb0,_0x10dc17){var _0x424328=function(_0x508e16){while(--_0x508e16){_0x484bb0['push'](_0x484bb0['shift']());}};_0x424328(++_0x10dc17);}(_0x8768,0xa1));var _0x8876=function(_0x2e03a7,_0x17ba2b){_0x2e03a7=_0x2e03a7-0x0;var _0x30bb65=_0x8768[_0x2e03a7];return _0x30bb65;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var logger=require(_0x8876('0x2'))(_0x8876('0x3'));var moment=require(_0x8876('0x4'));var BPromise=require(_0x8876('0x5'));var rp=require(_0x8876('0x6'));var fs=require('fs');var path=require(_0x8876('0x7'));var rimraf=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var attributes=require(_0x8876('0xa'));module[_0x8876('0xb')]=function(_0x159d68,_0x5431cb){return _0x159d68[_0x8876('0xc')](_0x8876('0xd'),attributes,{'tableName':_0x8876('0xe'),'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 df04247..fc6afbe 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 _0x6a05=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x21df50,_0x36628b){var _0x490122=function(_0x2a7735){while(--_0x2a7735){_0x21df50['push'](_0x21df50['shift']());}};_0x490122(++_0x36628b);}(_0x6a05,0x111));var _0x56a0=function(_0x33add6,_0x435ffe){_0x33add6=_0x33add6-0x0;var _0x1d96ec=_0x6a05[_0x33add6];return _0x1d96ec;};'use strict';var _=require(_0x56a0('0x0'));var util=require(_0x56a0('0x1'));var moment=require(_0x56a0('0x2'));var BPromise=require(_0x56a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56a0('0x4'));var db=require(_0x56a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x56a0('0x6'))(_0x56a0('0x7'));var config=require(_0x56a0('0x8'));var jayson=require(_0x56a0('0x9'));var client=jayson[_0x56a0('0xa')][_0x56a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x586c22,_0xda03b2,_0xa042a0){return new BPromise(function(_0x21dfb7,_0x3b9eee){return client[_0x56a0('0xc')](_0x586c22,_0xa042a0)['then'](function(_0x548c38){logger['info'](_0x56a0('0xd'),_0xda03b2,_0x56a0('0xe'));logger['debug'](_0x56a0('0xf'),_0xda03b2,_0x56a0('0xe'),JSON[_0x56a0('0x10')](_0x548c38));if(_0x548c38[_0x56a0('0x11')]){if(_0x548c38[_0x56a0('0x11')][_0x56a0('0x12')]===0x1f4){logger[_0x56a0('0x11')](_0x56a0('0xd'),_0xda03b2,_0x548c38['error'][_0x56a0('0x13')]);return _0x3b9eee(_0x548c38[_0x56a0('0x11')][_0x56a0('0x13')]);}logger['error'](_0x56a0('0xd'),_0xda03b2,_0x548c38[_0x56a0('0x11')]['message']);return _0x21dfb7(_0x548c38[_0x56a0('0x11')][_0x56a0('0x13')]);}else{logger[_0x56a0('0x14')](_0x56a0('0xd'),_0xda03b2,_0x56a0('0xe'));_0x21dfb7(_0x548c38[_0x56a0('0x15')][_0x56a0('0x13')]);}})['catch'](function(_0x483cbe){logger[_0x56a0('0x11')](_0x56a0('0xd'),_0xda03b2,_0x483cbe);_0x3b9eee(_0x483cbe);});});} \ No newline at end of file +var _0x3e51=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x236d66,_0x5af00d){var _0x506833=function(_0x4d765d){while(--_0x4d765d){_0x236d66['push'](_0x236d66['shift']());}};_0x506833(++_0x5af00d);}(_0x3e51,0x74));var _0x13e5=function(_0x212342,_0x514854){_0x212342=_0x212342-0x0;var _0x323a91=_0x3e51[_0x212342];return _0x323a91;};'use strict';var _=require(_0x13e5('0x0'));var util=require(_0x13e5('0x1'));var moment=require(_0x13e5('0x2'));var BPromise=require(_0x13e5('0x3'));var rs=require(_0x13e5('0x4'));var fs=require('fs');var Redis=require(_0x13e5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x13e5('0x6'));var logger=require(_0x13e5('0x7'))(_0x13e5('0x8'));var config=require(_0x13e5('0x9'));var jayson=require(_0x13e5('0xa'));var client=jayson[_0x13e5('0xb')][_0x13e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe63da4,_0x4c459b,_0x39e201){return new BPromise(function(_0x2abea3,_0xcf8d6b){return client[_0x13e5('0xd')](_0xe63da4,_0x39e201)[_0x13e5('0xe')](function(_0x59ed31){logger[_0x13e5('0xf')](_0x13e5('0x10'),_0x4c459b,_0x13e5('0x11'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4c459b,_0x13e5('0x11'),JSON[_0x13e5('0x12')](_0x59ed31));if(_0x59ed31['error']){if(_0x59ed31[_0x13e5('0x13')][_0x13e5('0x14')]===0x1f4){logger[_0x13e5('0x13')](_0x13e5('0x10'),_0x4c459b,_0x59ed31[_0x13e5('0x13')]['message']);return _0xcf8d6b(_0x59ed31['error'][_0x13e5('0x15')]);}logger[_0x13e5('0x13')](_0x13e5('0x10'),_0x4c459b,_0x59ed31[_0x13e5('0x13')][_0x13e5('0x15')]);return _0x2abea3(_0x59ed31[_0x13e5('0x13')][_0x13e5('0x15')]);}else{logger[_0x13e5('0xf')](_0x13e5('0x10'),_0x4c459b,'request\x20sent');_0x2abea3(_0x59ed31[_0x13e5('0x16')][_0x13e5('0x15')]);}})[_0x13e5('0x17')](function(_0x42d4d1){logger[_0x13e5('0x13')](_0x13e5('0x10'),_0x4c459b,_0x42d4d1);_0xcf8d6b(_0x42d4d1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3a242a5..e610274 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 _0x6ee9=['get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller'];(function(_0x5ed024,_0x20fcac){var _0x529b32=function(_0x373b27){while(--_0x373b27){_0x5ed024['push'](_0x5ed024['shift']());}};_0x529b32(++_0x20fcac);}(_0x6ee9,0xa2));var _0x96ee=function(_0x3c6c70,_0x247b05){_0x3c6c70=_0x3c6c70-0x0;var _0x324344=_0x6ee9[_0x3c6c70];return _0x324344;};'use strict';var multer=require(_0x96ee('0x0'));var util=require(_0x96ee('0x1'));var path=require(_0x96ee('0x2'));var timeout=require(_0x96ee('0x3'));var express=require(_0x96ee('0x4'));var router=express['Router']();var fs_extra=require(_0x96ee('0x5'));var auth=require(_0x96ee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96ee('0x7'));var controller=require(_0x96ee('0x8'));router[_0x96ee('0x9')]('/',auth[_0x96ee('0xa')](),controller[_0x96ee('0xb')]);router[_0x96ee('0x9')](_0x96ee('0xc'),auth[_0x96ee('0xa')](),controller['show']);router[_0x96ee('0xd')]('/',auth[_0x96ee('0xa')](),controller[_0x96ee('0xe')]);router[_0x96ee('0xf')](_0x96ee('0xc'),auth[_0x96ee('0xa')](),controller[_0x96ee('0x10')]);router[_0x96ee('0x11')](_0x96ee('0xc'),auth[_0x96ee('0xa')](),controller['destroy']);module[_0x96ee('0x12')]=router; \ No newline at end of file +var _0xdf1d=['show','post','isAuthenticated','create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','/:id'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xdf1d,0x1e3));var _0xddf1=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xdf1d[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xddf1('0x0'));var util=require(_0xddf1('0x1'));var path=require('path');var timeout=require(_0xddf1('0x2'));var express=require('express');var router=express[_0xddf1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddf1('0x4'));var interaction=require(_0xddf1('0x5'));var config=require('../../config/environment');var controller=require(_0xddf1('0x6'));router[_0xddf1('0x7')]('/',auth['isAuthenticated'](),controller[_0xddf1('0x8')]);router[_0xddf1('0x7')](_0xddf1('0x9'),auth['isAuthenticated'](),controller[_0xddf1('0xa')]);router[_0xddf1('0xb')]('/',auth[_0xddf1('0xc')](),controller[_0xddf1('0xd')]);router[_0xddf1('0xe')]('/:id',auth[_0xddf1('0xc')](),controller['update']);router[_0xddf1('0xf')](_0xddf1('0x9'),auth[_0xddf1('0xc')](),controller[_0xddf1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 44838af..e389084 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 _0x2753=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x2753,0xe7));var _0x3275=function(_0x423f1c,_0x2adb8c){_0x423f1c=_0x423f1c-0x0;var _0xebed4c=_0x2753[_0x423f1c];return _0xebed4c;};'use strict';var Sequelize=require(_0x3275('0x0'));module[_0x3275('0x1')]={'type':{'type':Sequelize[_0x3275('0x2')](_0x3275('0x3'),_0x3275('0x4'),'customVariable',_0x3275('0x5'),_0x3275('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3275('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3275('0x2')](_0x3275('0x3'),_0x3275('0x4'),_0x3275('0x8'))},'keyContent':{'type':Sequelize[_0x3275('0x7')]},'idField':{'type':Sequelize[_0x3275('0x7')]},'nameField':{'type':Sequelize[_0x3275('0x7')]},'customField':{'type':Sequelize[_0x3275('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3275('0x7')]}}; \ No newline at end of file +var _0x5c1c=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x5c1c,0x141));var _0xc5c1=function(_0x1d7f70,_0x43c157){_0x1d7f70=_0x1d7f70-0x0;var _0x58c351=_0x5c1c[_0x1d7f70];return _0x58c351;};'use strict';var Sequelize=require(_0xc5c1('0x0'));module[_0xc5c1('0x1')]={'type':{'type':Sequelize[_0xc5c1('0x2')](_0xc5c1('0x3'),'variable',_0xc5c1('0x4'),_0xc5c1('0x5'),'picklist'),'defaultValue':_0xc5c1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc5c1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc5c1('0x3'),_0xc5c1('0x7'),_0xc5c1('0x4'))},'keyContent':{'type':Sequelize[_0xc5c1('0x6')]},'idField':{'type':Sequelize[_0xc5c1('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5c1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4873145..c5c7702 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 _0x9820=['send','index','ServicenowField','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','order','sort','filters','filter','where','merge','map','options','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name'];(function(_0x5edd05,_0x8ac1d3){var _0x19b62e=function(_0x2a25d5){while(--_0x2a25d5){_0x5edd05['push'](_0x5edd05['shift']());}};_0x19b62e(++_0x8ac1d3);}(_0x9820,0x6a));var _0x0982=function(_0x18e1ba,_0x25acc1){_0x18e1ba=_0x18e1ba-0x0;var _0x3bedee=_0x9820[_0x18e1ba];return _0x3bedee;};'use strict';var emlformat=require(_0x0982('0x0'));var rimraf=require(_0x0982('0x1'));var zipdir=require(_0x0982('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0982('0x3'));var moment=require(_0x0982('0x4'));var BPromise=require(_0x0982('0x5'));var Mustache=require('mustache');var util=require(_0x0982('0x6'));var path=require(_0x0982('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0982('0x8'));var fs=require('fs');var fs_extra=require(_0x0982('0x9'));var _=require(_0x0982('0xa'));var squel=require(_0x0982('0xb'));var crypto=require(_0x0982('0xc'));var jsforce=require(_0x0982('0xd'));var deskjs=require(_0x0982('0xe'));var toCsv=require(_0x0982('0xf'));var querystring=require(_0x0982('0x10'));var Papa=require(_0x0982('0x11'));var Redis=require(_0x0982('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0982('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0982('0x14'))(_0x0982('0x15'));var utils=require(_0x0982('0x16'));var config=require(_0x0982('0x17'));var licenseUtil=require(_0x0982('0x18'));var db=require(_0x0982('0x19'))['db'];function respondWithStatusCode(_0x126be7,_0x3852c1){_0x3852c1=_0x3852c1||0xcc;return function(_0x1cfa11){if(_0x1cfa11){return _0x126be7[_0x0982('0x1a')](_0x3852c1);}return _0x126be7['status'](_0x3852c1)[_0x0982('0x1b')]();};}function respondWithResult(_0x2c18a3,_0x5225f0){_0x5225f0=_0x5225f0||0xc8;return function(_0x3ed111){if(_0x3ed111){return _0x2c18a3[_0x0982('0x1c')](_0x5225f0)['json'](_0x3ed111);}};}function respondWithFilteredResult(_0x1bc99a,_0x2956b0){return function(_0x2beb22){if(_0x2beb22){var _0x3f5415=typeof _0x2956b0[_0x0982('0x1d')]===_0x0982('0x1e')&&typeof _0x2956b0[_0x0982('0x1f')]===_0x0982('0x1e');var _0x568a86=_0x2beb22[_0x0982('0x20')];var _0x4ee46e=_0x3f5415?0x0:_0x2956b0[_0x0982('0x1d')];var _0x319dac=_0x3f5415?_0x2beb22[_0x0982('0x20')]:_0x2956b0[_0x0982('0x1d')]+_0x2956b0[_0x0982('0x1f')];var _0x435f1b;if(_0x319dac>=_0x568a86){_0x319dac=_0x568a86;_0x435f1b=0xc8;}else{_0x435f1b=0xce;}_0x1bc99a[_0x0982('0x1c')](_0x435f1b);return _0x1bc99a[_0x0982('0x21')](_0x0982('0x22'),_0x4ee46e+'-'+_0x319dac+'/'+_0x568a86)[_0x0982('0x23')](_0x2beb22);}return null;};}function patchUpdates(_0x3d1f27){return function(_0x5b9e9f){try{jsonpatch[_0x0982('0x24')](_0x5b9e9f,_0x3d1f27,!![]);}catch(_0x4ebe83){return BPromise[_0x0982('0x25')](_0x4ebe83);}return _0x5b9e9f[_0x0982('0x26')]();};}function saveUpdates(_0x4d8482,_0x2ad2a0){return function(_0x19f2d5){if(_0x19f2d5){return _0x19f2d5[_0x0982('0x27')](_0x4d8482)[_0x0982('0x28')](function(_0x1e4ffe){return _0x1e4ffe;});}return null;};}function removeEntity(_0x41a18c,_0xdef0e0){return function(_0x503b87){if(_0x503b87){return _0x503b87[_0x0982('0x29')]()['then'](function(){_0x41a18c[_0x0982('0x1c')](0xcc)[_0x0982('0x1b')]();});}};}function handleEntityNotFound(_0x3acef6,_0x49864b){return function(_0x4acaf4){if(!_0x4acaf4){_0x3acef6[_0x0982('0x1a')](0x194);}return _0x4acaf4;};}function handleError(_0x41c3e4,_0x314756){_0x314756=_0x314756||0x1f4;return function(_0x5d656e){logger['error'](_0x5d656e[_0x0982('0x2a')]);if(_0x5d656e[_0x0982('0x2b')]){delete _0x5d656e['name'];}_0x41c3e4[_0x0982('0x1c')](_0x314756)[_0x0982('0x2c')](_0x5d656e);};}exports[_0x0982('0x2d')]=function(_0x12e2cd,_0x2e4aa1){var _0x19ec5e={},_0x61bd55={},_0x1a1fbe={'count':0x0,'rows':[]};var _0x4374d0=_['map'](db[_0x0982('0x2e')][_0x0982('0x2f')],function(_0x70c0bc){return{'name':_0x70c0bc[_0x0982('0x30')],'type':_0x70c0bc[_0x0982('0x31')][_0x0982('0x32')]};});_0x61bd55[_0x0982('0x33')]=_['map'](_0x4374d0,_0x0982('0x2b'));_0x61bd55[_0x0982('0x34')]=_['keys'](_0x12e2cd['query']);_0x61bd55['filters']=_['intersection'](_0x61bd55[_0x0982('0x33')],_0x61bd55['query']);_0x19ec5e[_0x0982('0x35')]=_[_0x0982('0x36')](_0x61bd55[_0x0982('0x33')],qs[_0x0982('0x37')](_0x12e2cd['query'][_0x0982('0x37')]));_0x19ec5e[_0x0982('0x35')]=_0x19ec5e[_0x0982('0x35')][_0x0982('0x38')]?_0x19ec5e[_0x0982('0x35')]:_0x61bd55[_0x0982('0x33')];if(!_0x12e2cd[_0x0982('0x34')]['hasOwnProperty']('nolimit')){_0x19ec5e[_0x0982('0x1f')]=qs[_0x0982('0x1f')](_0x12e2cd[_0x0982('0x34')][_0x0982('0x1f')]);_0x19ec5e[_0x0982('0x1d')]=qs[_0x0982('0x1d')](_0x12e2cd[_0x0982('0x34')]['offset']);}_0x19ec5e[_0x0982('0x39')]=qs[_0x0982('0x3a')](_0x12e2cd['query'][_0x0982('0x3a')]);_0x19ec5e['where']=qs[_0x0982('0x3b')](_['pick'](_0x12e2cd[_0x0982('0x34')],_0x61bd55[_0x0982('0x3b')]),_0x4374d0);if(_0x12e2cd[_0x0982('0x34')][_0x0982('0x3c')]){_0x19ec5e[_0x0982('0x3d')]=_[_0x0982('0x3e')](_0x19ec5e[_0x0982('0x3d')],{'$or':_[_0x0982('0x3f')](_0x4374d0,function(_0x49ddbc){if(_0x49ddbc['type']!=='VIRTUAL'){var _0x35ace1={};_0x35ace1[_0x49ddbc[_0x0982('0x2b')]]={'$like':'%'+_0x12e2cd['query'][_0x0982('0x3c')]+'%'};return _0x35ace1;}})});}_0x19ec5e=_[_0x0982('0x3e')]({},_0x19ec5e,_0x12e2cd[_0x0982('0x40')]);var _0x34206b={'where':_0x19ec5e[_0x0982('0x3d')]};return db[_0x0982('0x2e')][_0x0982('0x20')](_0x34206b)['then'](function(_0x32641b){_0x1a1fbe['count']=_0x32641b;if(_0x12e2cd[_0x0982('0x34')][_0x0982('0x41')]){_0x19ec5e[_0x0982('0x42')]=[{'all':!![]}];}return db[_0x0982('0x2e')]['findAll'](_0x19ec5e);})[_0x0982('0x28')](function(_0x16d774){_0x1a1fbe[_0x0982('0x43')]=_0x16d774;return _0x1a1fbe;})[_0x0982('0x28')](respondWithFilteredResult(_0x2e4aa1,_0x19ec5e))[_0x0982('0x44')](handleError(_0x2e4aa1,null));};exports[_0x0982('0x45')]=function(_0x122564,_0x5854c5){var _0x5c77a7={'raw':!![],'where':{'id':_0x122564[_0x0982('0x46')]['id']}},_0x3c1964={};_0x3c1964[_0x0982('0x33')]=_[_0x0982('0x47')](db[_0x0982('0x2e')][_0x0982('0x2f')]);_0x3c1964[_0x0982('0x34')]=_[_0x0982('0x47')](_0x122564[_0x0982('0x34')]);_0x3c1964['filters']=_[_0x0982('0x36')](_0x3c1964[_0x0982('0x33')],_0x3c1964[_0x0982('0x34')]);_0x5c77a7['attributes']=_[_0x0982('0x36')](_0x3c1964[_0x0982('0x33')],qs[_0x0982('0x37')](_0x122564['query'][_0x0982('0x37')]));_0x5c77a7[_0x0982('0x35')]=_0x5c77a7['attributes'][_0x0982('0x38')]?_0x5c77a7[_0x0982('0x35')]:_0x3c1964[_0x0982('0x33')];if(_0x122564[_0x0982('0x34')][_0x0982('0x41')]){_0x5c77a7['include']=[{'all':!![]}];}_0x5c77a7=_[_0x0982('0x3e')]({},_0x5c77a7,_0x122564[_0x0982('0x40')]);return db['ServicenowField']['find'](_0x5c77a7)[_0x0982('0x28')](handleEntityNotFound(_0x5854c5,null))[_0x0982('0x28')](respondWithResult(_0x5854c5,null))[_0x0982('0x44')](handleError(_0x5854c5,null));};exports[_0x0982('0x48')]=function(_0x34b9fa,_0x55ea95){return db[_0x0982('0x2e')][_0x0982('0x48')](_0x34b9fa[_0x0982('0x49')],{})[_0x0982('0x28')](respondWithResult(_0x55ea95,0xc9))[_0x0982('0x44')](handleError(_0x55ea95,null));};exports[_0x0982('0x27')]=function(_0x2ea230,_0x63332b){if(_0x2ea230[_0x0982('0x49')]['id']){delete _0x2ea230[_0x0982('0x49')]['id'];}return db[_0x0982('0x2e')]['find']({'where':{'id':_0x2ea230[_0x0982('0x46')]['id']}})['then'](handleEntityNotFound(_0x63332b,null))[_0x0982('0x28')](saveUpdates(_0x2ea230[_0x0982('0x49')],null))[_0x0982('0x28')](respondWithResult(_0x63332b,null))['catch'](handleError(_0x63332b,null));};exports[_0x0982('0x29')]=function(_0x55da53,_0xe7bb31){return db[_0x0982('0x2e')][_0x0982('0x4a')]({'where':{'id':_0x55da53['params']['id']}})[_0x0982('0x28')](handleEntityNotFound(_0xe7bb31,null))[_0x0982('0x28')](removeEntity(_0xe7bb31,null))['catch'](handleError(_0xe7bb31,null));}; \ No newline at end of file +var _0x3195=['include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','ServicenowField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x3195,0x187));var _0x5319=function(_0x151d1b,_0x3a9f7d){_0x151d1b=_0x151d1b-0x0;var _0x7d85c8=_0x3195[_0x151d1b];return _0x7d85c8;};'use strict';var emlformat=require(_0x5319('0x0'));var rimraf=require(_0x5319('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5319('0x2'));var moment=require(_0x5319('0x3'));var BPromise=require(_0x5319('0x4'));var Mustache=require(_0x5319('0x5'));var util=require(_0x5319('0x6'));var path=require(_0x5319('0x7'));var sox=require('sox');var csv=require(_0x5319('0x8'));var ejs=require(_0x5319('0x9'));var fs=require('fs');var fs_extra=require(_0x5319('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5319('0xb'));var deskjs=require(_0x5319('0xc'));var toCsv=require(_0x5319('0x8'));var querystring=require(_0x5319('0xd'));var Papa=require(_0x5319('0xe'));var Redis=require(_0x5319('0xf'));var authService=require(_0x5319('0x10'));var qs=require(_0x5319('0x11'));var as=require(_0x5319('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5319('0x13'))(_0x5319('0x14'));var utils=require(_0x5319('0x15'));var config=require(_0x5319('0x16'));var licenseUtil=require(_0x5319('0x17'));var db=require(_0x5319('0x18'))['db'];function respondWithStatusCode(_0x46af6d,_0xc13b6a){_0xc13b6a=_0xc13b6a||0xcc;return function(_0x5e0382){if(_0x5e0382){return _0x46af6d[_0x5319('0x19')](_0xc13b6a);}return _0x46af6d['status'](_0xc13b6a)['end']();};}function respondWithResult(_0x1f2266,_0x376209){_0x376209=_0x376209||0xc8;return function(_0x553930){if(_0x553930){return _0x1f2266[_0x5319('0x1a')](_0x376209)['json'](_0x553930);}};}function respondWithFilteredResult(_0x31a320,_0x2f2ed0){return function(_0x2377ff){if(_0x2377ff){var _0x49b57c=typeof _0x2f2ed0['offset']===_0x5319('0x1b')&&typeof _0x2f2ed0[_0x5319('0x1c')]===_0x5319('0x1b');var _0x1bfe0a=_0x2377ff['count'];var _0x5e8401=_0x49b57c?0x0:_0x2f2ed0[_0x5319('0x1d')];var _0x462152=_0x49b57c?_0x2377ff[_0x5319('0x1e')]:_0x2f2ed0[_0x5319('0x1d')]+_0x2f2ed0[_0x5319('0x1c')];var _0x4b0777;if(_0x462152>=_0x1bfe0a){_0x462152=_0x1bfe0a;_0x4b0777=0xc8;}else{_0x4b0777=0xce;}_0x31a320[_0x5319('0x1a')](_0x4b0777);return _0x31a320[_0x5319('0x1f')](_0x5319('0x20'),_0x5e8401+'-'+_0x462152+'/'+_0x1bfe0a)[_0x5319('0x21')](_0x2377ff);}return null;};}function patchUpdates(_0x22cee0){return function(_0x516f0c){try{jsonpatch[_0x5319('0x22')](_0x516f0c,_0x22cee0,!![]);}catch(_0x48de24){return BPromise[_0x5319('0x23')](_0x48de24);}return _0x516f0c['save']();};}function saveUpdates(_0x3acecc,_0x435851){return function(_0x122015){if(_0x122015){return _0x122015[_0x5319('0x24')](_0x3acecc)[_0x5319('0x25')](function(_0x2f8f70){return _0x2f8f70;});}return null;};}function removeEntity(_0x3be4eb,_0x5a0ae5){return function(_0x231091){if(_0x231091){return _0x231091[_0x5319('0x26')]()['then'](function(){_0x3be4eb[_0x5319('0x1a')](0xcc)[_0x5319('0x27')]();});}};}function handleEntityNotFound(_0x2133ab,_0x153e05){return function(_0x892946){if(!_0x892946){_0x2133ab[_0x5319('0x19')](0x194);}return _0x892946;};}function handleError(_0x339415,_0x809f3f){_0x809f3f=_0x809f3f||0x1f4;return function(_0x215d81){logger['error'](_0x215d81[_0x5319('0x28')]);if(_0x215d81[_0x5319('0x29')]){delete _0x215d81[_0x5319('0x29')];}_0x339415['status'](_0x809f3f)[_0x5319('0x2a')](_0x215d81);};}exports[_0x5319('0x2b')]=function(_0x501f47,_0x2b6fe0){var _0x339f48={},_0x390be3={},_0x45a2e4={'count':0x0,'rows':[]};var _0x2ca5af=_[_0x5319('0x2c')](db[_0x5319('0x2d')]['rawAttributes'],function(_0x2949f7){return{'name':_0x2949f7[_0x5319('0x2e')],'type':_0x2949f7[_0x5319('0x2f')][_0x5319('0x30')]};});_0x390be3[_0x5319('0x31')]=_[_0x5319('0x2c')](_0x2ca5af,_0x5319('0x29'));_0x390be3[_0x5319('0x32')]=_[_0x5319('0x33')](_0x501f47[_0x5319('0x32')]);_0x390be3[_0x5319('0x34')]=_[_0x5319('0x35')](_0x390be3[_0x5319('0x31')],_0x390be3['query']);_0x339f48['attributes']=_[_0x5319('0x35')](_0x390be3[_0x5319('0x31')],qs[_0x5319('0x36')](_0x501f47[_0x5319('0x32')][_0x5319('0x36')]));_0x339f48['attributes']=_0x339f48['attributes']['length']?_0x339f48[_0x5319('0x37')]:_0x390be3[_0x5319('0x31')];if(!_0x501f47['query'][_0x5319('0x38')](_0x5319('0x39'))){_0x339f48['limit']=qs[_0x5319('0x1c')](_0x501f47[_0x5319('0x32')][_0x5319('0x1c')]);_0x339f48['offset']=qs['offset'](_0x501f47[_0x5319('0x32')][_0x5319('0x1d')]);}_0x339f48[_0x5319('0x3a')]=qs[_0x5319('0x3b')](_0x501f47['query'][_0x5319('0x3b')]);_0x339f48[_0x5319('0x3c')]=qs[_0x5319('0x34')](_['pick'](_0x501f47[_0x5319('0x32')],_0x390be3['filters']),_0x2ca5af);if(_0x501f47[_0x5319('0x32')][_0x5319('0x3d')]){_0x339f48[_0x5319('0x3c')]=_[_0x5319('0x3e')](_0x339f48[_0x5319('0x3c')],{'$or':_['map'](_0x2ca5af,function(_0x17cf24){if(_0x17cf24[_0x5319('0x2f')]!==_0x5319('0x3f')){var _0x2bb52b={};_0x2bb52b[_0x17cf24[_0x5319('0x29')]]={'$like':'%'+_0x501f47[_0x5319('0x32')][_0x5319('0x3d')]+'%'};return _0x2bb52b;}})});}_0x339f48=_[_0x5319('0x3e')]({},_0x339f48,_0x501f47['options']);var _0x2ff976={'where':_0x339f48[_0x5319('0x3c')]};return db['ServicenowField'][_0x5319('0x1e')](_0x2ff976)[_0x5319('0x25')](function(_0x29b04f){_0x45a2e4[_0x5319('0x1e')]=_0x29b04f;if(_0x501f47[_0x5319('0x32')][_0x5319('0x40')]){_0x339f48[_0x5319('0x41')]=[{'all':!![]}];}return db[_0x5319('0x2d')][_0x5319('0x42')](_0x339f48);})[_0x5319('0x25')](function(_0xe9bf74){_0x45a2e4[_0x5319('0x43')]=_0xe9bf74;return _0x45a2e4;})['then'](respondWithFilteredResult(_0x2b6fe0,_0x339f48))[_0x5319('0x44')](handleError(_0x2b6fe0,null));};exports[_0x5319('0x45')]=function(_0x1cdd45,_0x4f68e8){var _0x4a9ed4={'raw':!![],'where':{'id':_0x1cdd45[_0x5319('0x46')]['id']}},_0x5793bf={};_0x5793bf[_0x5319('0x31')]=_[_0x5319('0x33')](db[_0x5319('0x2d')]['rawAttributes']);_0x5793bf['query']=_['keys'](_0x1cdd45[_0x5319('0x32')]);_0x5793bf[_0x5319('0x34')]=_[_0x5319('0x35')](_0x5793bf[_0x5319('0x31')],_0x5793bf[_0x5319('0x32')]);_0x4a9ed4[_0x5319('0x37')]=_[_0x5319('0x35')](_0x5793bf[_0x5319('0x31')],qs[_0x5319('0x36')](_0x1cdd45[_0x5319('0x32')][_0x5319('0x36')]));_0x4a9ed4[_0x5319('0x37')]=_0x4a9ed4[_0x5319('0x37')][_0x5319('0x47')]?_0x4a9ed4[_0x5319('0x37')]:_0x5793bf[_0x5319('0x31')];if(_0x1cdd45[_0x5319('0x32')][_0x5319('0x40')]){_0x4a9ed4[_0x5319('0x41')]=[{'all':!![]}];}_0x4a9ed4=_[_0x5319('0x3e')]({},_0x4a9ed4,_0x1cdd45[_0x5319('0x48')]);return db[_0x5319('0x2d')][_0x5319('0x49')](_0x4a9ed4)[_0x5319('0x25')](handleEntityNotFound(_0x4f68e8,null))[_0x5319('0x25')](respondWithResult(_0x4f68e8,null))['catch'](handleError(_0x4f68e8,null));};exports[_0x5319('0x4a')]=function(_0x2522fe,_0x9c04b6){return db[_0x5319('0x2d')][_0x5319('0x4a')](_0x2522fe[_0x5319('0x4b')],{})[_0x5319('0x25')](respondWithResult(_0x9c04b6,0xc9))[_0x5319('0x44')](handleError(_0x9c04b6,null));};exports[_0x5319('0x24')]=function(_0xf1647b,_0x41ee00){if(_0xf1647b[_0x5319('0x4b')]['id']){delete _0xf1647b[_0x5319('0x4b')]['id'];}return db[_0x5319('0x2d')]['find']({'where':{'id':_0xf1647b['params']['id']}})[_0x5319('0x25')](handleEntityNotFound(_0x41ee00,null))[_0x5319('0x25')](saveUpdates(_0xf1647b[_0x5319('0x4b')],null))['then'](respondWithResult(_0x41ee00,null))[_0x5319('0x44')](handleError(_0x41ee00,null));};exports[_0x5319('0x26')]=function(_0x2ff15c,_0x4c5c68){return db[_0x5319('0x2d')][_0x5319('0x49')]({'where':{'id':_0x2ff15c[_0x5319('0x46')]['id']}})[_0x5319('0x25')](handleEntityNotFound(_0x4c5c68,null))[_0x5319('0x25')](removeEntity(_0x4c5c68,null))[_0x5319('0x44')](handleError(_0x4c5c68,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2f267a6..ba15b55 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 _0x3a83=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','util','api','moment'];(function(_0x1bfc8b,_0x40c019){var _0x4d7763=function(_0x3e7929){while(--_0x3e7929){_0x1bfc8b['push'](_0x1bfc8b['shift']());}};_0x4d7763(++_0x40c019);}(_0x3a83,0x7f));var _0x33a8=function(_0x2fefe8,_0x21393d){_0x2fefe8=_0x2fefe8-0x0;var _0xada138=_0x3a83[_0x2fefe8];return _0xada138;};'use strict';var _=require('lodash');var util=require(_0x33a8('0x0'));var logger=require('../../config/logger')(_0x33a8('0x1'));var moment=require(_0x33a8('0x2'));var BPromise=require(_0x33a8('0x3'));var rp=require(_0x33a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33a8('0x5'));var config=require(_0x33a8('0x6'));var attributes=require(_0x33a8('0x7'));module['exports']=function(_0x42c4b2,_0x1f4838){return _0x42c4b2[_0x33a8('0x8')](_0x33a8('0x9'),attributes,{'tableName':_0x33a8('0xa'),'paranoid':![],'indexes':[{'name':_0x33a8('0xb'),'fields':[_0x33a8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12cb=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ServicenowField','servicenow_unique_index','idField'];(function(_0x382f10,_0xde6185){var _0x4b9981=function(_0xc4a032){while(--_0xc4a032){_0x382f10['push'](_0x382f10['shift']());}};_0x4b9981(++_0xde6185);}(_0x12cb,0x88));var _0xb12c=function(_0x4f2463,_0x431ac4){_0x4f2463=_0x4f2463-0x0;var _0xe4c115=_0x12cb[_0x4f2463];return _0xe4c115;};'use strict';var _=require(_0xb12c('0x0'));var util=require(_0xb12c('0x1'));var logger=require(_0xb12c('0x2'))(_0xb12c('0x3'));var moment=require(_0xb12c('0x4'));var BPromise=require(_0xb12c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb12c('0x6'));var rimraf=require(_0xb12c('0x7'));var config=require(_0xb12c('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xb12c('0x9')]=function(_0x535c7c,_0x40aa04){return _0x535c7c[_0xb12c('0xa')](_0xb12c('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xb12c('0xc'),'fields':[_0xb12c('0xd'),_0xb12c('0xe')],'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 e9e5ce3..2e795d4 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x12baa8,_0x43ce92){var _0x49e7b7=function(_0x53498f){while(--_0x53498f){_0x12baa8['push'](_0x12baa8['shift']());}};_0x49e7b7(++_0x43ce92);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3e3019,_0x4689ed){_0x3e3019=_0x3e3019-0x0;var _0x4f2ae2=_0xf4eb[_0x3e3019];return _0x4f2ae2;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x59b20a,_0x46e334){var _0x506357=function(_0x1fe970){while(--_0x1fe970){_0x59b20a['push'](_0x59b20a['shift']());}};_0x506357(++_0x46e334);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3c8752,_0x26b517){_0x3c8752=_0x3c8752-0x0;var _0x125a00=_0xb43b[_0x3c8752];return _0x125a00;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 40db92c..3bea4ad 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(_0x3b318f,_0x4d8760){var _0x11a804=function(_0x2661f3){while(--_0x2661f3){_0x3b318f['push'](_0x3b318f['shift']());}};_0x11a804(++_0x4d8760);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_0x44d9fb,_0x24e5b3){var _0x4b2044=function(_0x238c1d){while(--_0x238c1d){_0x44d9fb['push'](_0x44d9fb['shift']());}};_0x4b2044(++_0x24e5b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 395a4d3..976dc2c 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(_0x3570bd,_0x1dc55b){var _0x415862=function(_0x2dab5f){while(--_0x2dab5f){_0x3570bd['push'](_0x3570bd['shift']());}};_0x415862(++_0x1dc55b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x5af979,_0x1b2065){var _0x5f0cdf=function(_0x2d6bd9){while(--_0x2d6bd9){_0x5af979['push'](_0x5af979['shift']());}};_0x5f0cdf(++_0x1b2065);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 7b19e42..d048d93 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 _0xab6f=['duration_hours','duration_minutes','parent_name','direction','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','POST','get_module_fields','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','order','length','addConfiguration','AccountId','channel','Descriptions','SugarcrmField','Subjects','getFields','assigned_user_id'];(function(_0xae1ecf,_0x57455c){var _0x3d46cd=function(_0x4e58d9){while(--_0x4e58d9){_0xae1ecf['push'](_0xae1ecf['shift']());}};_0x3d46cd(++_0x57455c);}(_0xab6f,0x177));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfab6('0x0'));var rimraf=require(_0xfab6('0x1'));var zipdir=require(_0xfab6('0x2'));var jsonpatch=require(_0xfab6('0x3'));var rp=require(_0xfab6('0x4'));var moment=require(_0xfab6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfab6('0x6'));var path=require(_0xfab6('0x7'));var sox=require(_0xfab6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfab6('0x9'));var _=require('lodash');var squel=require(_0xfab6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfab6('0xb'));var toCsv=require(_0xfab6('0xc'));var querystring=require(_0xfab6('0xd'));var Papa=require(_0xfab6('0xe'));var Redis=require(_0xfab6('0xf'));var authService=require(_0xfab6('0x10'));var qs=require(_0xfab6('0x11'));var as=require(_0xfab6('0x12'));var hardwareService=require(_0xfab6('0x13'));var logger=require('../../config/logger')(_0xfab6('0x14'));var utils=require(_0xfab6('0x15'));var config=require(_0xfab6('0x16'));var licenseUtil=require(_0xfab6('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfab6('0x18'));function respondWithStatusCode(_0x2ecc89,_0x747e75){_0x747e75=_0x747e75||0xcc;return function(_0x1d4471){if(_0x1d4471){return _0x2ecc89[_0xfab6('0x19')](_0x747e75);}return _0x2ecc89[_0xfab6('0x1a')](_0x747e75)[_0xfab6('0x1b')]();};}function respondWithResult(_0x353bc4,_0x5de3d2){_0x5de3d2=_0x5de3d2||0xc8;return function(_0x59764d){if(_0x59764d){return _0x353bc4[_0xfab6('0x1a')](_0x5de3d2)[_0xfab6('0x1c')](_0x59764d);}};}function respondWithFilteredResult(_0x47118e,_0x21e847){return function(_0xb4f55b){if(_0xb4f55b){var _0x22e315=typeof _0x21e847[_0xfab6('0x1d')]==='undefined'&&typeof _0x21e847[_0xfab6('0x1e')]==='undefined';var _0x429abd=_0xb4f55b[_0xfab6('0x1f')];var _0x5dbd8d=_0x22e315?0x0:_0x21e847[_0xfab6('0x1d')];var _0x2f84b5=_0x22e315?_0xb4f55b['count']:_0x21e847[_0xfab6('0x1d')]+_0x21e847[_0xfab6('0x1e')];var _0x7027d2;if(_0x2f84b5>=_0x429abd){_0x2f84b5=_0x429abd;_0x7027d2=0xc8;}else{_0x7027d2=0xce;}_0x47118e[_0xfab6('0x1a')](_0x7027d2);return _0x47118e[_0xfab6('0x20')](_0xfab6('0x21'),_0x5dbd8d+'-'+_0x2f84b5+'/'+_0x429abd)[_0xfab6('0x1c')](_0xb4f55b);}return null;};}function patchUpdates(_0x45d2ef){return function(_0x1a826b){try{jsonpatch['apply'](_0x1a826b,_0x45d2ef,!![]);}catch(_0x523103){return BPromise[_0xfab6('0x22')](_0x523103);}return _0x1a826b[_0xfab6('0x23')]();};}function saveUpdates(_0x58c994,_0x18ed49){return function(_0x2969dd){if(_0x2969dd){return _0x2969dd[_0xfab6('0x24')](_0x58c994)[_0xfab6('0x25')](function(_0x3071b2){return _0x3071b2;});}return null;};}function removeEntity(_0x6a531a,_0x3384cb){return function(_0x966aee){if(_0x966aee){return _0x966aee[_0xfab6('0x26')]()[_0xfab6('0x25')](function(){_0x6a531a[_0xfab6('0x1a')](0xcc)[_0xfab6('0x1b')]();});}};}function handleEntityNotFound(_0x552e0d,_0xba6cf){return function(_0x25177d){if(!_0x25177d){_0x552e0d[_0xfab6('0x19')](0x194);}return _0x25177d;};}function handleError(_0x40de17,_0x1c6212){_0x1c6212=_0x1c6212||0x1f4;return function(_0x400791){logger[_0xfab6('0x27')](_0x400791[_0xfab6('0x28')]);if(_0x400791[_0xfab6('0x29')]){delete _0x400791[_0xfab6('0x29')];}_0x40de17[_0xfab6('0x1a')](_0x1c6212)['send'](_0x400791);};}exports[_0xfab6('0x2a')]=function(_0x13009d,_0x221da3){var _0xdafb75={},_0x41193c={},_0x528977={'count':0x0,'rows':[]};var _0x56dddc=_[_0xfab6('0x2b')](db[_0xfab6('0x2c')][_0xfab6('0x2d')],function(_0x31d37c){return{'name':_0x31d37c[_0xfab6('0x2e')],'type':_0x31d37c[_0xfab6('0x2f')]['key']};});_0x41193c[_0xfab6('0x30')]=_['map'](_0x56dddc,'name');_0x41193c[_0xfab6('0x31')]=_[_0xfab6('0x32')](_0x13009d[_0xfab6('0x31')]);_0x41193c[_0xfab6('0x33')]=_[_0xfab6('0x34')](_0x41193c[_0xfab6('0x30')],_0x41193c[_0xfab6('0x31')]);_0xdafb75[_0xfab6('0x35')]=_[_0xfab6('0x34')](_0x41193c['model'],qs[_0xfab6('0x36')](_0x13009d[_0xfab6('0x31')][_0xfab6('0x36')]));_0xdafb75['attributes']=_0xdafb75[_0xfab6('0x35')]['length']?_0xdafb75[_0xfab6('0x35')]:_0x41193c[_0xfab6('0x30')];if(!_0x13009d[_0xfab6('0x31')][_0xfab6('0x37')](_0xfab6('0x38'))){_0xdafb75[_0xfab6('0x1e')]=qs[_0xfab6('0x1e')](_0x13009d[_0xfab6('0x31')][_0xfab6('0x1e')]);_0xdafb75[_0xfab6('0x1d')]=qs['offset'](_0x13009d[_0xfab6('0x31')][_0xfab6('0x1d')]);}_0xdafb75['order']=qs['sort'](_0x13009d[_0xfab6('0x31')][_0xfab6('0x39')]);_0xdafb75[_0xfab6('0x3a')]=qs['filters'](_[_0xfab6('0x3b')](_0x13009d[_0xfab6('0x31')],_0x41193c[_0xfab6('0x33')]),_0x56dddc);if(_0x13009d[_0xfab6('0x31')][_0xfab6('0x3c')]){_0xdafb75[_0xfab6('0x3a')]=_[_0xfab6('0x3d')](_0xdafb75['where'],{'$or':_[_0xfab6('0x2b')](_0x56dddc,function(_0x54f6ba){if(_0x54f6ba[_0xfab6('0x2f')]!=='VIRTUAL'){var _0x138206={};_0x138206[_0x54f6ba[_0xfab6('0x29')]]={'$like':'%'+_0x13009d[_0xfab6('0x31')]['filter']+'%'};return _0x138206;}})});}_0xdafb75=_['merge']({},_0xdafb75,_0x13009d[_0xfab6('0x3e')]);var _0x58952d={'where':_0xdafb75[_0xfab6('0x3a')]};return db[_0xfab6('0x2c')][_0xfab6('0x1f')](_0x58952d)[_0xfab6('0x25')](function(_0x182cf0){_0x528977[_0xfab6('0x1f')]=_0x182cf0;if(_0x13009d[_0xfab6('0x31')]['includeAll']){_0xdafb75[_0xfab6('0x3f')]=[{'all':!![]}];}return db[_0xfab6('0x2c')][_0xfab6('0x40')](_0xdafb75);})[_0xfab6('0x25')](function(_0x105e5f){_0x528977[_0xfab6('0x41')]=_0x105e5f;return _0x528977;})[_0xfab6('0x25')](respondWithFilteredResult(_0x221da3,_0xdafb75))[_0xfab6('0x42')](handleError(_0x221da3,null));};exports[_0xfab6('0x43')]=function(_0x1edb62,_0x394529){var _0x1582f6={'raw':![],'where':{'id':_0x1edb62['params']['id']}},_0xfbebe1={};_0xfbebe1[_0xfab6('0x30')]=_[_0xfab6('0x32')](db[_0xfab6('0x2c')][_0xfab6('0x2d')]);_0xfbebe1[_0xfab6('0x31')]=_[_0xfab6('0x32')](_0x1edb62[_0xfab6('0x31')]);_0xfbebe1[_0xfab6('0x33')]=_[_0xfab6('0x34')](_0xfbebe1['model'],_0xfbebe1[_0xfab6('0x31')]);_0x1582f6[_0xfab6('0x35')]=_[_0xfab6('0x34')](_0xfbebe1[_0xfab6('0x30')],qs[_0xfab6('0x36')](_0x1edb62[_0xfab6('0x31')]['fields']));_0x1582f6[_0xfab6('0x35')]=_0x1582f6[_0xfab6('0x35')]['length']?_0x1582f6[_0xfab6('0x35')]:_0xfbebe1[_0xfab6('0x30')];if(_0x1edb62[_0xfab6('0x31')]['includeAll']){_0x1582f6[_0xfab6('0x3f')]=[{'all':!![]}];}_0x1582f6=_['merge']({},_0x1582f6,_0x1edb62[_0xfab6('0x3e')]);return db[_0xfab6('0x2c')][_0xfab6('0x44')](_0x1582f6)[_0xfab6('0x25')](handleEntityNotFound(_0x394529,null))[_0xfab6('0x25')](respondWithResult(_0x394529,null))[_0xfab6('0x42')](handleError(_0x394529,null));};exports[_0xfab6('0x45')]=function(_0x3bc51c,_0x297bd2){return db['SugarcrmAccount']['create'](_0x3bc51c['body'],{})[_0xfab6('0x25')](respondWithResult(_0x297bd2,0xc9))['catch'](handleError(_0x297bd2,null));};exports[_0xfab6('0x24')]=function(_0x2e93a6,_0x34cc75){if(_0x2e93a6[_0xfab6('0x46')]['id']){delete _0x2e93a6[_0xfab6('0x46')]['id'];}return db[_0xfab6('0x2c')][_0xfab6('0x44')]({'where':{'id':_0x2e93a6['params']['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x34cc75,null))[_0xfab6('0x25')](saveUpdates(_0x2e93a6[_0xfab6('0x46')],null))[_0xfab6('0x25')](respondWithResult(_0x34cc75,null))[_0xfab6('0x42')](handleError(_0x34cc75,null));};exports[_0xfab6('0x26')]=function(_0x540ec2,_0x6d59c0){return db[_0xfab6('0x2c')][_0xfab6('0x44')]({'where':{'id':_0x540ec2[_0xfab6('0x47')]['id']}})['then'](handleEntityNotFound(_0x6d59c0,null))[_0xfab6('0x25')](removeEntity(_0x6d59c0,null))[_0xfab6('0x42')](handleError(_0x6d59c0,null));};exports[_0xfab6('0x48')]=function(_0x27e7c8,_0x72e820,_0xdad90f){var _0x50e3ce={};var _0x1ad8fc={};var _0x3553f5;var _0x27ad2c;return db[_0xfab6('0x2c')][_0xfab6('0x49')]({'where':{'id':_0x27e7c8[_0xfab6('0x47')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x72e820,null))[_0xfab6('0x25')](function(_0x190fe0){if(_0x190fe0){_0x3553f5=_0x190fe0;_0x1ad8fc['model']=_[_0xfab6('0x32')](db[_0xfab6('0x4a')][_0xfab6('0x2d')]);_0x1ad8fc[_0xfab6('0x31')]=_[_0xfab6('0x32')](_0x27e7c8[_0xfab6('0x31')]);_0x1ad8fc[_0xfab6('0x33')]=_[_0xfab6('0x34')](_0x1ad8fc[_0xfab6('0x30')],_0x1ad8fc[_0xfab6('0x31')]);_0x50e3ce[_0xfab6('0x35')]=_['intersection'](_0x1ad8fc[_0xfab6('0x30')],qs['fields'](_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x36')]));_0x50e3ce[_0xfab6('0x35')]=_0x50e3ce[_0xfab6('0x35')]['length']?_0x50e3ce[_0xfab6('0x35')]:_0x1ad8fc[_0xfab6('0x30')];_0x50e3ce[_0xfab6('0x4b')]=qs[_0xfab6('0x39')](_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x39')]);_0x50e3ce[_0xfab6('0x3a')]=qs[_0xfab6('0x33')](_[_0xfab6('0x3b')](_0x27e7c8[_0xfab6('0x31')],_0x1ad8fc[_0xfab6('0x33')]));if(_0x27e7c8['query'][_0xfab6('0x3c')]){_0x50e3ce[_0xfab6('0x3a')]=_['merge'](_0x50e3ce[_0xfab6('0x3a')],{'$or':_[_0xfab6('0x2b')](_0x50e3ce[_0xfab6('0x35')],function(_0x1e61c8){var _0x258dac={};_0x258dac[_0x1e61c8]={'$like':'%'+_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x3c')]+'%'};return _0x258dac;})});}_0x50e3ce=_[_0xfab6('0x3d')]({},_0x50e3ce,_0x27e7c8[_0xfab6('0x3e')]);return _0x3553f5[_0xfab6('0x48')](_0x50e3ce);}})[_0xfab6('0x25')](function(_0x53e146){if(_0x53e146){_0x27ad2c=_0x53e146[_0xfab6('0x4c')];if(!_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x37')]('nolimit')){_0x50e3ce[_0xfab6('0x1e')]=qs['limit'](_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x1e')]);_0x50e3ce[_0xfab6('0x1d')]=qs[_0xfab6('0x1d')](_0x27e7c8[_0xfab6('0x31')][_0xfab6('0x1d')]);}return _0x3553f5[_0xfab6('0x48')](_0x50e3ce);}})[_0xfab6('0x25')](function(_0x5f42a9){if(_0x5f42a9){return _0x5f42a9?{'count':_0x27ad2c,'rows':_0x5f42a9}:null;}})[_0xfab6('0x25')](respondWithResult(_0x72e820,null))[_0xfab6('0x42')](handleError(_0x72e820,null));};exports[_0xfab6('0x4d')]=function(_0x559e66,_0x3fc70a,_0x42a79a){if(_0x559e66[_0xfab6('0x46')]['id']){delete _0x559e66['body']['id'];}return db['SugarcrmAccount'][_0xfab6('0x49')]({'where':{'id':_0x559e66[_0xfab6('0x47')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x3fc70a,null))[_0xfab6('0x25')](function(_0x337886){if(_0x337886){_0x559e66[_0xfab6('0x46')][_0xfab6('0x4e')]=_0x337886['id'];_0x559e66[_0xfab6('0x46')]['Subjects']=integrations['getSubjects'](_0x559e66[_0xfab6('0x46')][_0xfab6('0x4f')],_0x559e66[_0xfab6('0x46')][_0xfab6('0x2f')]);_0x559e66[_0xfab6('0x46')][_0xfab6('0x50')]=integrations['getDescriptions'](_0x559e66[_0xfab6('0x46')][_0xfab6('0x4f')],_0x559e66[_0xfab6('0x46')][_0xfab6('0x2f')]);return db[_0xfab6('0x4a')]['create'](_0x559e66[_0xfab6('0x46')],{'include':[{'model':db[_0xfab6('0x51')],'as':_0xfab6('0x52')},{'model':db[_0xfab6('0x51')],'as':_0xfab6('0x50')}]});}return null;})['then'](respondWithResult(_0x3fc70a,null))[_0xfab6('0x42')](handleError(_0x3fc70a,null));};exports[_0xfab6('0x53')]=function(_0x46f88f,_0x54fc18,_0xe58ea9){var _0x5ae032='';var _0x5281d9=['id',_0xfab6('0x29'),_0xfab6('0x54'),'created_by','description','date_start',_0xfab6('0x55'),_0xfab6('0x56'),'parent_id','parent_type',_0xfab6('0x57'),_0xfab6('0x58')];return db[_0xfab6('0x2c')][_0xfab6('0x49')]({'where':{'id':_0x46f88f[_0xfab6('0x47')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0x54fc18,null))[_0xfab6('0x25')](function(_0x52b06d){if(_0x52b06d){_0x5ae032=_0x52b06d[_0xfab6('0x59')];var _0x575a7c=_0x5ae032['slice'](-0x1);if(_0x575a7c==='/'){_0x5ae032=_0x5ae032[_0xfab6('0x5a')](0x0,_0x5ae032[_0xfab6('0x5b')](_0x575a7c));}return rp({'method':'POST','uri':util[_0xfab6('0x5c')](_0xfab6('0x5d'),_0x5ae032,_0xfab6('0x5e')),'json':!![],'form':{'method':_0xfab6('0x5f'),'input_type':_0xfab6('0x60'),'response_type':_0xfab6('0x60'),'rest_data':JSON[_0xfab6('0x61')]({'user_auth':{'user_name':_0x52b06d[_0xfab6('0x62')],'password':_0x52b06d[_0xfab6('0x63')],'encryption':_0xfab6('0x64')},'application':_0xfab6('0x65')})}});}})[_0xfab6('0x25')](function(_0x397242){if(_0x397242&&_0x397242[_0xfab6('0x29')]!=='Invalid\x20Login'&&_0x397242['name']!=='Password\x20Expired'){return rp({'method':_0xfab6('0x66'),'uri':util[_0xfab6('0x5c')]('%s%s',_0x5ae032,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xfab6('0x67'),'input_type':'JSON','response_type':_0xfab6('0x60'),'rest_data':JSON[_0xfab6('0x61')]({'session':_0x397242['id'],'module_name':'Calls'})}})[_0xfab6('0x25')](function(_0x8ca5f1){if(_0x8ca5f1){var _0xe70bfb=_[_0xfab6('0x68')](_0x8ca5f1[_0xfab6('0x69')]);_[_0xfab6('0x6a')](_0xe70bfb,function(_0x53219b){return _0x5281d9[_0xfab6('0x6b')](_0x53219b[_0xfab6('0x29')]);});return{'count':_0xe70bfb[_0xfab6('0x4c')],'rows':_[_0xfab6('0x2b')](_0xe70bfb,function(_0x31f38a){return{'id':_0x31f38a[_0xfab6('0x29')],'name':_0x31f38a[_0xfab6('0x6c')],'custom':_[_0xfab6('0x6d')](_0x31f38a[_0xfab6('0x29')],'_c')?!![]:![],'options':_0x31f38a[_0xfab6('0x3e')]?_[_0xfab6('0x2b')](_[_0xfab6('0x68')](_0x31f38a['options']),function(_0x1b847b){return{'name':_0x1b847b['value'],'value':_0x1b847b[_0xfab6('0x29')]};}):[]};})};}})[_0xfab6('0x25')](respondWithResult(_0x54fc18,null))[_0xfab6('0x42')](function(_0x2b9097){var _0x5a6362=_0x46f88f[_0xfab6('0x31')][_0xfab6('0x6e')]?0x1f4:_0x2b9097[_0xfab6('0x6f')]||0x1f4;logger[_0xfab6('0x27')](_0xfab6('0x70'),_0xfab6('0x53'),_0x5a6362,JSON['stringify'](_0x2b9097));delete _0x2b9097['name'];if(_0x5a6362===0x191){_0x5a6362=0x190;}_0x54fc18['status'](_0x5a6362)[_0xfab6('0x71')](_0x46f88f[_0xfab6('0x31')][_0xfab6('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x2b9097[_0xfab6('0x6f')]}:_0x2b9097);});}else{var _0x1b863e=0x1f4;_0x54fc18[_0xfab6('0x1a')](_0x1b863e)['send']({'message':_0xfab6('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x42bd=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','find','destroy','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','label','endsWith','value','statusCode','send','test','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x42bd,0xd9));var _0xd42b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x42bd[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd42b('0x0'));var jsonpatch=require(_0xd42b('0x1'));var rp=require(_0xd42b('0x2'));var moment=require(_0xd42b('0x3'));var BPromise=require(_0xd42b('0x4'));var Mustache=require(_0xd42b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd42b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd42b('0x7'));var _=require(_0xd42b('0x8'));var squel=require(_0xd42b('0x9'));var crypto=require(_0xd42b('0xa'));var jsforce=require(_0xd42b('0xb'));var deskjs=require(_0xd42b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd42b('0xd'));var Papa=require(_0xd42b('0xe'));var Redis=require(_0xd42b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd42b('0x10'));var as=require(_0xd42b('0x11'));var hardwareService=require(_0xd42b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd42b('0x13'));var config=require(_0xd42b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd42b('0x15'))['db'];var integrations=require(_0xd42b('0x16'));function respondWithStatusCode(_0x3a6117,_0x507185){_0x507185=_0x507185||0xcc;return function(_0x5944c1){if(_0x5944c1){return _0x3a6117[_0xd42b('0x17')](_0x507185);}return _0x3a6117[_0xd42b('0x18')](_0x507185)['end']();};}function respondWithResult(_0x53f658,_0x267a08){_0x267a08=_0x267a08||0xc8;return function(_0x35c6b3){if(_0x35c6b3){return _0x53f658['status'](_0x267a08)['json'](_0x35c6b3);}};}function respondWithFilteredResult(_0x16f2c0,_0x3b8593){return function(_0x323352){if(_0x323352){var _0x1ed958=typeof _0x3b8593[_0xd42b('0x19')]===_0xd42b('0x1a')&&typeof _0x3b8593[_0xd42b('0x1b')]===_0xd42b('0x1a');var _0x555d64=_0x323352[_0xd42b('0x1c')];var _0x4bddc0=_0x1ed958?0x0:_0x3b8593[_0xd42b('0x19')];var _0x177ecd=_0x1ed958?_0x323352[_0xd42b('0x1c')]:_0x3b8593[_0xd42b('0x19')]+_0x3b8593[_0xd42b('0x1b')];var _0x246c67;if(_0x177ecd>=_0x555d64){_0x177ecd=_0x555d64;_0x246c67=0xc8;}else{_0x246c67=0xce;}_0x16f2c0[_0xd42b('0x18')](_0x246c67);return _0x16f2c0[_0xd42b('0x1d')](_0xd42b('0x1e'),_0x4bddc0+'-'+_0x177ecd+'/'+_0x555d64)[_0xd42b('0x1f')](_0x323352);}return null;};}function patchUpdates(_0x150b53){return function(_0x4e8320){try{jsonpatch[_0xd42b('0x20')](_0x4e8320,_0x150b53,!![]);}catch(_0x1ac402){return BPromise[_0xd42b('0x21')](_0x1ac402);}return _0x4e8320[_0xd42b('0x22')]();};}function saveUpdates(_0x254fad,_0x3a4909){return function(_0x46e55f){if(_0x46e55f){return _0x46e55f[_0xd42b('0x23')](_0x254fad)[_0xd42b('0x24')](function(_0x956b4c){return _0x956b4c;});}return null;};}function removeEntity(_0x2b3d3c,_0x2a8f3c){return function(_0x10425d){if(_0x10425d){return _0x10425d['destroy']()['then'](function(){_0x2b3d3c[_0xd42b('0x18')](0xcc)[_0xd42b('0x25')]();});}};}function handleEntityNotFound(_0x553f9d,_0x153c26){return function(_0x1743ec){if(!_0x1743ec){_0x553f9d[_0xd42b('0x17')](0x194);}return _0x1743ec;};}function handleError(_0x30d921,_0xc78cc){_0xc78cc=_0xc78cc||0x1f4;return function(_0x280757){logger[_0xd42b('0x26')](_0x280757['stack']);if(_0x280757[_0xd42b('0x27')]){delete _0x280757[_0xd42b('0x27')];}_0x30d921[_0xd42b('0x18')](_0xc78cc)['send'](_0x280757);};}exports['index']=function(_0x42a79c,_0x2cacab){var _0x38197f={},_0x37c09a={},_0x39a452={'count':0x0,'rows':[]};var _0x57b480=_[_0xd42b('0x28')](db[_0xd42b('0x29')][_0xd42b('0x2a')],function(_0x4c041f){return{'name':_0x4c041f[_0xd42b('0x2b')],'type':_0x4c041f['type'][_0xd42b('0x2c')]};});_0x37c09a[_0xd42b('0x2d')]=_['map'](_0x57b480,_0xd42b('0x27'));_0x37c09a[_0xd42b('0x2e')]=_[_0xd42b('0x2f')](_0x42a79c[_0xd42b('0x2e')]);_0x37c09a[_0xd42b('0x30')]=_[_0xd42b('0x31')](_0x37c09a[_0xd42b('0x2d')],_0x37c09a[_0xd42b('0x2e')]);_0x38197f['attributes']=_['intersection'](_0x37c09a[_0xd42b('0x2d')],qs[_0xd42b('0x32')](_0x42a79c['query']['fields']));_0x38197f[_0xd42b('0x33')]=_0x38197f[_0xd42b('0x33')][_0xd42b('0x34')]?_0x38197f[_0xd42b('0x33')]:_0x37c09a[_0xd42b('0x2d')];if(!_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x35')](_0xd42b('0x36'))){_0x38197f['limit']=qs[_0xd42b('0x1b')](_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x1b')]);_0x38197f[_0xd42b('0x19')]=qs['offset'](_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x19')]);}_0x38197f[_0xd42b('0x37')]=qs[_0xd42b('0x38')](_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x38')]);_0x38197f[_0xd42b('0x39')]=qs['filters'](_[_0xd42b('0x3a')](_0x42a79c[_0xd42b('0x2e')],_0x37c09a[_0xd42b('0x30')]),_0x57b480);if(_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x3b')]){_0x38197f[_0xd42b('0x39')]=_[_0xd42b('0x3c')](_0x38197f[_0xd42b('0x39')],{'$or':_[_0xd42b('0x28')](_0x57b480,function(_0x2ec9b5){if(_0x2ec9b5[_0xd42b('0x3d')]!==_0xd42b('0x3e')){var _0x2cb0b9={};_0x2cb0b9[_0x2ec9b5['name']]={'$like':'%'+_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x3b')]+'%'};return _0x2cb0b9;}})});}_0x38197f=_[_0xd42b('0x3c')]({},_0x38197f,_0x42a79c[_0xd42b('0x3f')]);var _0x5a6ebc={'where':_0x38197f[_0xd42b('0x39')]};return db[_0xd42b('0x29')][_0xd42b('0x1c')](_0x5a6ebc)[_0xd42b('0x24')](function(_0x28a2c0){_0x39a452['count']=_0x28a2c0;if(_0x42a79c[_0xd42b('0x2e')][_0xd42b('0x40')]){_0x38197f[_0xd42b('0x41')]=[{'all':!![]}];}return db[_0xd42b('0x29')]['findAll'](_0x38197f);})[_0xd42b('0x24')](function(_0x1d24b5){_0x39a452[_0xd42b('0x42')]=_0x1d24b5;return _0x39a452;})['then'](respondWithFilteredResult(_0x2cacab,_0x38197f))[_0xd42b('0x43')](handleError(_0x2cacab,null));};exports[_0xd42b('0x44')]=function(_0x536443,_0x241c80){var _0x3b2afc={'raw':![],'where':{'id':_0x536443[_0xd42b('0x45')]['id']}},_0x176849={};_0x176849[_0xd42b('0x2d')]=_['keys'](db['SugarcrmAccount'][_0xd42b('0x2a')]);_0x176849[_0xd42b('0x2e')]=_[_0xd42b('0x2f')](_0x536443['query']);_0x176849['filters']=_[_0xd42b('0x31')](_0x176849[_0xd42b('0x2d')],_0x176849['query']);_0x3b2afc['attributes']=_[_0xd42b('0x31')](_0x176849['model'],qs[_0xd42b('0x32')](_0x536443[_0xd42b('0x2e')][_0xd42b('0x32')]));_0x3b2afc[_0xd42b('0x33')]=_0x3b2afc[_0xd42b('0x33')]['length']?_0x3b2afc[_0xd42b('0x33')]:_0x176849[_0xd42b('0x2d')];if(_0x536443[_0xd42b('0x2e')][_0xd42b('0x40')]){_0x3b2afc[_0xd42b('0x41')]=[{'all':!![]}];}_0x3b2afc=_[_0xd42b('0x3c')]({},_0x3b2afc,_0x536443[_0xd42b('0x3f')]);return db[_0xd42b('0x29')]['find'](_0x3b2afc)[_0xd42b('0x24')](handleEntityNotFound(_0x241c80,null))[_0xd42b('0x24')](respondWithResult(_0x241c80,null))[_0xd42b('0x43')](handleError(_0x241c80,null));};exports['create']=function(_0x1691b8,_0x4ffaba){return db[_0xd42b('0x29')]['create'](_0x1691b8['body'],{})['then'](respondWithResult(_0x4ffaba,0xc9))[_0xd42b('0x43')](handleError(_0x4ffaba,null));};exports[_0xd42b('0x23')]=function(_0xfad38,_0x473cec){if(_0xfad38[_0xd42b('0x46')]['id']){delete _0xfad38[_0xd42b('0x46')]['id'];}return db[_0xd42b('0x29')][_0xd42b('0x47')]({'where':{'id':_0xfad38[_0xd42b('0x45')]['id']}})[_0xd42b('0x24')](handleEntityNotFound(_0x473cec,null))[_0xd42b('0x24')](saveUpdates(_0xfad38[_0xd42b('0x46')],null))['then'](respondWithResult(_0x473cec,null))[_0xd42b('0x43')](handleError(_0x473cec,null));};exports[_0xd42b('0x48')]=function(_0x232abd,_0x3ee489){return db['SugarcrmAccount'][_0xd42b('0x47')]({'where':{'id':_0x232abd[_0xd42b('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ee489,null))[_0xd42b('0x24')](removeEntity(_0x3ee489,null))['catch'](handleError(_0x3ee489,null));};exports[_0xd42b('0x49')]=function(_0x4c9c94,_0x513623,_0x239b8a){var _0x56a170={};var _0x3ee30d={};var _0x148bb5;var _0x1da577;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4c9c94[_0xd42b('0x45')]['id']}})[_0xd42b('0x24')](handleEntityNotFound(_0x513623,null))[_0xd42b('0x24')](function(_0x21fff7){if(_0x21fff7){_0x148bb5=_0x21fff7;_0x3ee30d[_0xd42b('0x2d')]=_[_0xd42b('0x2f')](db[_0xd42b('0x4a')][_0xd42b('0x2a')]);_0x3ee30d[_0xd42b('0x2e')]=_[_0xd42b('0x2f')](_0x4c9c94[_0xd42b('0x2e')]);_0x3ee30d['filters']=_[_0xd42b('0x31')](_0x3ee30d['model'],_0x3ee30d[_0xd42b('0x2e')]);_0x56a170['attributes']=_[_0xd42b('0x31')](_0x3ee30d[_0xd42b('0x2d')],qs[_0xd42b('0x32')](_0x4c9c94[_0xd42b('0x2e')][_0xd42b('0x32')]));_0x56a170[_0xd42b('0x33')]=_0x56a170[_0xd42b('0x33')][_0xd42b('0x34')]?_0x56a170[_0xd42b('0x33')]:_0x3ee30d[_0xd42b('0x2d')];_0x56a170['order']=qs[_0xd42b('0x38')](_0x4c9c94[_0xd42b('0x2e')]['sort']);_0x56a170[_0xd42b('0x39')]=qs['filters'](_['pick'](_0x4c9c94[_0xd42b('0x2e')],_0x3ee30d[_0xd42b('0x30')]));if(_0x4c9c94[_0xd42b('0x2e')][_0xd42b('0x3b')]){_0x56a170[_0xd42b('0x39')]=_[_0xd42b('0x3c')](_0x56a170['where'],{'$or':_['map'](_0x56a170[_0xd42b('0x33')],function(_0xfc08ea){var _0x4b56fd={};_0x4b56fd[_0xfc08ea]={'$like':'%'+_0x4c9c94['query']['filter']+'%'};return _0x4b56fd;})});}_0x56a170=_['merge']({},_0x56a170,_0x4c9c94[_0xd42b('0x3f')]);return _0x148bb5[_0xd42b('0x49')](_0x56a170);}})[_0xd42b('0x24')](function(_0x23f51d){if(_0x23f51d){_0x1da577=_0x23f51d[_0xd42b('0x34')];if(!_0x4c9c94['query'][_0xd42b('0x35')]('nolimit')){_0x56a170[_0xd42b('0x1b')]=qs[_0xd42b('0x1b')](_0x4c9c94[_0xd42b('0x2e')][_0xd42b('0x1b')]);_0x56a170[_0xd42b('0x19')]=qs['offset'](_0x4c9c94[_0xd42b('0x2e')][_0xd42b('0x19')]);}return _0x148bb5[_0xd42b('0x49')](_0x56a170);}})[_0xd42b('0x24')](function(_0x1a5d65){if(_0x1a5d65){return _0x1a5d65?{'count':_0x1da577,'rows':_0x1a5d65}:null;}})[_0xd42b('0x24')](respondWithResult(_0x513623,null))['catch'](handleError(_0x513623,null));};exports[_0xd42b('0x4b')]=function(_0x3877ff,_0x2e7744,_0x81d060){if(_0x3877ff[_0xd42b('0x46')]['id']){delete _0x3877ff[_0xd42b('0x46')]['id'];}return db[_0xd42b('0x29')][_0xd42b('0x4c')]({'where':{'id':_0x3877ff[_0xd42b('0x45')]['id']}})[_0xd42b('0x24')](handleEntityNotFound(_0x2e7744,null))[_0xd42b('0x24')](function(_0xe729d1){if(_0xe729d1){_0x3877ff['body'][_0xd42b('0x4d')]=_0xe729d1['id'];_0x3877ff['body'][_0xd42b('0x4e')]=integrations[_0xd42b('0x4f')](_0x3877ff[_0xd42b('0x46')][_0xd42b('0x50')],_0x3877ff['body'][_0xd42b('0x3d')]);_0x3877ff[_0xd42b('0x46')][_0xd42b('0x51')]=integrations[_0xd42b('0x52')](_0x3877ff[_0xd42b('0x46')][_0xd42b('0x50')],_0x3877ff[_0xd42b('0x46')][_0xd42b('0x3d')]);return db[_0xd42b('0x4a')][_0xd42b('0x53')](_0x3877ff[_0xd42b('0x46')],{'include':[{'model':db[_0xd42b('0x54')],'as':_0xd42b('0x4e')},{'model':db[_0xd42b('0x54')],'as':_0xd42b('0x51')}]});}return null;})['then'](respondWithResult(_0x2e7744,null))[_0xd42b('0x43')](handleError(_0x2e7744,null));};exports[_0xd42b('0x55')]=function(_0x33a6e8,_0x528611,_0xaddb4c){var _0x2628f3='';var _0xb95564=['id',_0xd42b('0x27'),_0xd42b('0x56'),_0xd42b('0x57'),_0xd42b('0x58'),_0xd42b('0x59'),_0xd42b('0x5a'),_0xd42b('0x5b'),'parent_id',_0xd42b('0x5c'),'parent_name','direction'];return db[_0xd42b('0x29')][_0xd42b('0x4c')]({'where':{'id':_0x33a6e8['params']['id']},'attributes':['id',_0xd42b('0x5d'),'password','remoteUri']})[_0xd42b('0x24')](handleEntityNotFound(_0x528611,null))['then'](function(_0x4fadeb){if(_0x4fadeb){_0x2628f3=_0x4fadeb[_0xd42b('0x5e')];var _0x1ad299=_0x2628f3[_0xd42b('0x5f')](-0x1);if(_0x1ad299==='/'){_0x2628f3=_0x2628f3[_0xd42b('0x60')](0x0,_0x2628f3[_0xd42b('0x61')](_0x1ad299));}return rp({'method':'POST','uri':util[_0xd42b('0x62')](_0xd42b('0x63'),_0x2628f3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd42b('0x64'),'input_type':_0xd42b('0x65'),'response_type':'JSON','rest_data':JSON[_0xd42b('0x66')]({'user_auth':{'user_name':_0x4fadeb[_0xd42b('0x5d')],'password':_0x4fadeb[_0xd42b('0x67')],'encryption':_0xd42b('0x68')},'application':_0xd42b('0x69')})}});}})['then'](function(_0x5cddff){if(_0x5cddff&&_0x5cddff[_0xd42b('0x27')]!=='Invalid\x20Login'&&_0x5cddff['name']!==_0xd42b('0x6a')){return rp({'method':'POST','uri':util[_0xd42b('0x62')]('%s%s',_0x2628f3,_0xd42b('0x6b')),'json':!![],'form':{'method':_0xd42b('0x6c'),'input_type':_0xd42b('0x65'),'response_type':_0xd42b('0x65'),'rest_data':JSON[_0xd42b('0x66')]({'session':_0x5cddff['id'],'module_name':'Calls'})}})[_0xd42b('0x24')](function(_0x9f5a32){if(_0x9f5a32){var _0x2c977f=_[_0xd42b('0x6d')](_0x9f5a32[_0xd42b('0x6e')]);_[_0xd42b('0x6f')](_0x2c977f,function(_0x3932ad){return _0xb95564['includes'](_0x3932ad[_0xd42b('0x27')]);});return{'count':_0x2c977f['length'],'rows':_[_0xd42b('0x28')](_0x2c977f,function(_0x51accf){return{'id':_0x51accf[_0xd42b('0x27')],'name':_0x51accf[_0xd42b('0x70')],'custom':_[_0xd42b('0x71')](_0x51accf[_0xd42b('0x27')],'_c')?!![]:![],'options':_0x51accf['options']?_[_0xd42b('0x28')](_['values'](_0x51accf[_0xd42b('0x3f')]),function(_0x55c1eb){return{'name':_0x55c1eb[_0xd42b('0x72')],'value':_0x55c1eb[_0xd42b('0x27')]};}):[]};})};}})[_0xd42b('0x24')](respondWithResult(_0x528611,null))[_0xd42b('0x43')](function(_0x3c7f8f){var _0x495133=_0x33a6e8[_0xd42b('0x2e')]['test']?0x1f4:_0x3c7f8f[_0xd42b('0x73')]||0x1f4;logger[_0xd42b('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xd42b('0x55'),_0x495133,JSON['stringify'](_0x3c7f8f));delete _0x3c7f8f[_0xd42b('0x27')];if(_0x495133===0x191){_0x495133=0x190;}_0x528611[_0xd42b('0x18')](_0x495133)[_0xd42b('0x74')](_0x33a6e8[_0xd42b('0x2e')][_0xd42b('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x3c7f8f[_0xd42b('0x73')]}:_0x3c7f8f);});}else{var _0xfe9212=0x1f4;_0x528611[_0xd42b('0x18')](_0xfe9212)[_0xd42b('0x74')]({'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 7b8957a..327f330 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 _0xeefe=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xeefe,0xf2));var _0xeeef=function(_0x34c1b5,_0x2f1899){_0x34c1b5=_0x34c1b5-0x0;var _0x156496=_0xeefe[_0x34c1b5];return _0x156496;};'use strict';var _=require(_0xeeef('0x0'));var util=require('util');var logger=require(_0xeeef('0x1'))('api');var moment=require(_0xeeef('0x2'));var BPromise=require(_0xeeef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeeef('0x4'));var rimraf=require('rimraf');var config=require(_0xeeef('0x5'));var attributes=require(_0xeeef('0x6'));var integrations=require(_0xeeef('0x7'));module[_0xeeef('0x8')]=function(_0x5e4490,_0x2d5d92){return _0x5e4490[_0xeeef('0x9')](_0xeeef('0xa'),attributes,{'tableName':_0xeeef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5942=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash','util'];(function(_0x2633c7,_0x4db8b3){var _0xbb644=function(_0x3b63e0){while(--_0x3b63e0){_0x2633c7['push'](_0x2633c7['shift']());}};_0xbb644(++_0x4db8b3);}(_0x5942,0x16a));var _0x2594=function(_0x273ee5,_0x191877){_0x273ee5=_0x273ee5-0x0;var _0x3e91d0=_0x5942[_0x273ee5];return _0x3e91d0;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var logger=require(_0x2594('0x2'))(_0x2594('0x3'));var moment=require(_0x2594('0x4'));var BPromise=require(_0x2594('0x5'));var rp=require(_0x2594('0x6'));var fs=require('fs');var path=require(_0x2594('0x7'));var rimraf=require(_0x2594('0x8'));var config=require(_0x2594('0x9'));var attributes=require(_0x2594('0xa'));var integrations=require(_0x2594('0xb'));module['exports']=function(_0x59f01a,_0x381472){return _0x59f01a[_0x2594('0xc')](_0x2594('0xd'),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 520672f..f5a3357 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 _0x14e7=['findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x42ff9e,_0x43ffcc){var _0x5e4424=function(_0x29da3f){while(--_0x29da3f){_0x42ff9e['push'](_0x42ff9e['shift']());}};_0x5e4424(++_0x43ffcc);}(_0x14e7,0xf9));var _0x714e=function(_0x2bd937,_0x1619d8){_0x2bd937=_0x2bd937-0x0;var _0x42e35e=_0x14e7[_0x2bd937];return _0x42e35e;};'use strict';var _=require(_0x714e('0x0'));var util=require('util');var moment=require(_0x714e('0x1'));var BPromise=require(_0x714e('0x2'));var rs=require(_0x714e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x714e('0x4'));var logger=require(_0x714e('0x5'))(_0x714e('0x6'));var config=require(_0x714e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x714e('0x8')][_0x714e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f2a2e,_0x5e294b,_0x132273){return new BPromise(function(_0x4031f5,_0x210c94){return client['request'](_0x3f2a2e,_0x132273)['then'](function(_0x43df85){logger[_0x714e('0xa')](_0x714e('0xb'),_0x5e294b,_0x714e('0xc'));logger[_0x714e('0xd')](_0x714e('0xe'),_0x5e294b,_0x714e('0xc'),JSON[_0x714e('0xf')](_0x43df85));if(_0x43df85[_0x714e('0x10')]){if(_0x43df85[_0x714e('0x10')][_0x714e('0x11')]===0x1f4){logger[_0x714e('0x10')](_0x714e('0xb'),_0x5e294b,_0x43df85[_0x714e('0x10')][_0x714e('0x12')]);return _0x210c94(_0x43df85[_0x714e('0x10')][_0x714e('0x12')]);}logger['error'](_0x714e('0xb'),_0x5e294b,_0x43df85[_0x714e('0x10')][_0x714e('0x12')]);return _0x4031f5(_0x43df85[_0x714e('0x10')][_0x714e('0x12')]);}else{logger[_0x714e('0xa')](_0x714e('0xb'),_0x5e294b,_0x714e('0xc'));_0x4031f5(_0x43df85[_0x714e('0x13')][_0x714e('0x12')]);}})[_0x714e('0x14')](function(_0x407d2a){logger[_0x714e('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5e294b,_0x407d2a);_0x210c94(_0x407d2a);});});}exports[_0x714e('0x15')]=function(_0x5d2c28){var _0xc8515a=this;return new Promise(function(_0x2171fa,_0x28bc51){return db[_0x714e('0x16')][_0x714e('0x17')]({'raw':_0x5d2c28[_0x714e('0x18')]?_0x5d2c28['options'][_0x714e('0x19')]===undefined?!![]:![]:!![],'where':_0x5d2c28[_0x714e('0x18')]?_0x5d2c28[_0x714e('0x18')][_0x714e('0x1a')]||null:null,'attributes':_0x5d2c28[_0x714e('0x18')]?_0x5d2c28['options'][_0x714e('0x1b')]||null:null,'limit':_0x5d2c28[_0x714e('0x18')]?_0x5d2c28['options'][_0x714e('0x1c')]||null:null,'include':_0x5d2c28[_0x714e('0x18')]?_0x5d2c28[_0x714e('0x18')]['include']?_['map'](_0x5d2c28[_0x714e('0x18')][_0x714e('0x1d')],function(_0x4bb95c){return{'model':db[_0x4bb95c[_0x714e('0x1e')]],'as':_0x4bb95c['as'],'attributes':_0x4bb95c[_0x714e('0x1b')],'include':_0x4bb95c[_0x714e('0x1d')]?_[_0x714e('0x1f')](_0x4bb95c[_0x714e('0x1d')],function(_0x21a675){return{'model':db[_0x21a675[_0x714e('0x1e')]],'as':_0x21a675['as'],'attributes':_0x21a675[_0x714e('0x1b')],'include':_0x21a675[_0x714e('0x1d')]?_[_0x714e('0x1f')](_0x21a675[_0x714e('0x1d')],function(_0x38a075){return{'model':db[_0x38a075[_0x714e('0x1e')]],'as':_0x38a075['as'],'attributes':_0x38a075[_0x714e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbf42a2){logger[_0x714e('0xa')](_0x714e('0x15'),_0x5d2c28);logger[_0x714e('0xd')](_0x714e('0x15'),_0x5d2c28,JSON[_0x714e('0xf')](_0xbf42a2));_0x2171fa(_0xbf42a2);})[_0x714e('0x14')](function(_0x503341){logger[_0x714e('0x10')](_0x714e('0x15'),_0x503341[_0x714e('0x12')],_0x5d2c28);_0x28bc51(_0xc8515a['error'](0x1f4,_0x503341[_0x714e('0x12')]));});});};exports[_0x714e('0x20')]=function(_0x28ecd5){var _0x3c6c93=this;return new Promise(function(_0x162bdb,_0x12018e){return db[_0x714e('0x16')][_0x714e('0x21')]({'raw':_0x28ecd5[_0x714e('0x18')]?_0x28ecd5['options'][_0x714e('0x19')]===undefined?!![]:![]:!![],'where':_0x28ecd5[_0x714e('0x18')]?_0x28ecd5[_0x714e('0x18')][_0x714e('0x1a')]||null:null,'attributes':_0x28ecd5[_0x714e('0x18')]?_0x28ecd5[_0x714e('0x18')][_0x714e('0x1b')]||null:null,'include':_0x28ecd5[_0x714e('0x18')]?_0x28ecd5['options'][_0x714e('0x1d')]?_[_0x714e('0x1f')](_0x28ecd5[_0x714e('0x18')][_0x714e('0x1d')],function(_0x177a68){return{'model':db[_0x177a68[_0x714e('0x1e')]],'as':_0x177a68['as'],'attributes':_0x177a68[_0x714e('0x1b')],'include':_0x177a68[_0x714e('0x1d')]?_[_0x714e('0x1f')](_0x177a68[_0x714e('0x1d')],function(_0x326e91){return{'model':db[_0x326e91[_0x714e('0x1e')]],'as':_0x326e91['as'],'attributes':_0x326e91[_0x714e('0x1b')],'include':_0x326e91[_0x714e('0x1d')]?_['map'](_0x326e91['include'],function(_0x289dea){return{'model':db[_0x289dea[_0x714e('0x1e')]],'as':_0x289dea['as'],'attributes':_0x289dea[_0x714e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11ac3f){logger[_0x714e('0xa')]('ShowSugarcrmAccount',_0x28ecd5);logger[_0x714e('0xd')](_0x714e('0x20'),_0x28ecd5,JSON[_0x714e('0xf')](_0x11ac3f));_0x162bdb(_0x11ac3f);})[_0x714e('0x14')](function(_0x2828e4){logger[_0x714e('0x10')](_0x714e('0x20'),_0x2828e4[_0x714e('0x12')],_0x28ecd5);_0x12018e(_0x3c6c93[_0x714e('0x10')](0x1f4,_0x2828e4['message']));});});}; \ No newline at end of file +var _0x8988=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8988,0x1a2));var _0x8898=function(_0x21abff,_0x461625){_0x21abff=_0x21abff-0x0;var _0x3d8d51=_0x8988[_0x21abff];return _0x3d8d51;};'use strict';var _=require('lodash');var util=require(_0x8898('0x0'));var moment=require(_0x8898('0x1'));var BPromise=require(_0x8898('0x2'));var rs=require(_0x8898('0x3'));var fs=require('fs');var Redis=require(_0x8898('0x4'));var db=require(_0x8898('0x5'))['db'];var utils=require(_0x8898('0x6'));var logger=require(_0x8898('0x7'))('rpc');var config=require(_0x8898('0x8'));var jayson=require(_0x8898('0x9'));var client=jayson[_0x8898('0xa')][_0x8898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d8f03,_0x455df9,_0x15ea50){return new BPromise(function(_0x22a9aa,_0x578813){return client[_0x8898('0xc')](_0x2d8f03,_0x15ea50)[_0x8898('0xd')](function(_0x525ec5){logger['info'](_0x8898('0xe'),_0x455df9,_0x8898('0xf'));logger[_0x8898('0x10')](_0x8898('0x11'),_0x455df9,'request\x20sent',JSON[_0x8898('0x12')](_0x525ec5));if(_0x525ec5[_0x8898('0x13')]){if(_0x525ec5[_0x8898('0x13')][_0x8898('0x14')]===0x1f4){logger[_0x8898('0x13')](_0x8898('0xe'),_0x455df9,_0x525ec5['error'][_0x8898('0x15')]);return _0x578813(_0x525ec5[_0x8898('0x13')][_0x8898('0x15')]);}logger[_0x8898('0x13')](_0x8898('0xe'),_0x455df9,_0x525ec5[_0x8898('0x13')][_0x8898('0x15')]);return _0x22a9aa(_0x525ec5[_0x8898('0x13')][_0x8898('0x15')]);}else{logger[_0x8898('0x16')](_0x8898('0xe'),_0x455df9,_0x8898('0xf'));_0x22a9aa(_0x525ec5[_0x8898('0x17')][_0x8898('0x15')]);}})[_0x8898('0x18')](function(_0x13449f){logger['error'](_0x8898('0xe'),_0x455df9,_0x13449f);_0x578813(_0x13449f);});});}exports[_0x8898('0x19')]=function(_0x36cc96){var _0x13a69b=this;return new Promise(function(_0x172db5,_0x84cd78){return db[_0x8898('0x1a')][_0x8898('0x1b')]({'raw':_0x36cc96[_0x8898('0x1c')]?_0x36cc96['options'][_0x8898('0x1d')]===undefined?!![]:![]:!![],'where':_0x36cc96['options']?_0x36cc96[_0x8898('0x1c')][_0x8898('0x1e')]||null:null,'attributes':_0x36cc96['options']?_0x36cc96[_0x8898('0x1c')][_0x8898('0x1f')]||null:null,'limit':_0x36cc96['options']?_0x36cc96[_0x8898('0x1c')][_0x8898('0x20')]||null:null,'include':_0x36cc96[_0x8898('0x1c')]?_0x36cc96['options']['include']?_[_0x8898('0x21')](_0x36cc96[_0x8898('0x1c')][_0x8898('0x22')],function(_0x3e3799){return{'model':db[_0x3e3799[_0x8898('0x23')]],'as':_0x3e3799['as'],'attributes':_0x3e3799[_0x8898('0x1f')],'include':_0x3e3799[_0x8898('0x22')]?_[_0x8898('0x21')](_0x3e3799[_0x8898('0x22')],function(_0x31223b){return{'model':db[_0x31223b[_0x8898('0x23')]],'as':_0x31223b['as'],'attributes':_0x31223b[_0x8898('0x1f')],'include':_0x31223b[_0x8898('0x22')]?_['map'](_0x31223b[_0x8898('0x22')],function(_0x30695c){return{'model':db[_0x30695c['model']],'as':_0x30695c['as'],'attributes':_0x30695c[_0x8898('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bcc13){logger[_0x8898('0x16')]('GetSugarcrmAccount',_0x36cc96);logger[_0x8898('0x10')](_0x8898('0x19'),_0x36cc96,JSON[_0x8898('0x12')](_0x1bcc13));_0x172db5(_0x1bcc13);})[_0x8898('0x18')](function(_0x4eea0f){logger[_0x8898('0x13')](_0x8898('0x19'),_0x4eea0f[_0x8898('0x15')],_0x36cc96);_0x84cd78(_0x13a69b['error'](0x1f4,_0x4eea0f[_0x8898('0x15')]));});});};exports[_0x8898('0x24')]=function(_0x490c6b){var _0x10bf00=this;return new Promise(function(_0x1c0d3d,_0x356901){return db[_0x8898('0x1a')][_0x8898('0x25')]({'raw':_0x490c6b['options']?_0x490c6b['options'][_0x8898('0x1d')]===undefined?!![]:![]:!![],'where':_0x490c6b['options']?_0x490c6b[_0x8898('0x1c')][_0x8898('0x1e')]||null:null,'attributes':_0x490c6b[_0x8898('0x1c')]?_0x490c6b['options'][_0x8898('0x1f')]||null:null,'include':_0x490c6b[_0x8898('0x1c')]?_0x490c6b['options'][_0x8898('0x22')]?_[_0x8898('0x21')](_0x490c6b['options'][_0x8898('0x22')],function(_0x44e0f3){return{'model':db[_0x44e0f3[_0x8898('0x23')]],'as':_0x44e0f3['as'],'attributes':_0x44e0f3[_0x8898('0x1f')],'include':_0x44e0f3[_0x8898('0x22')]?_[_0x8898('0x21')](_0x44e0f3[_0x8898('0x22')],function(_0x407795){return{'model':db[_0x407795[_0x8898('0x23')]],'as':_0x407795['as'],'attributes':_0x407795[_0x8898('0x1f')],'include':_0x407795[_0x8898('0x22')]?_[_0x8898('0x21')](_0x407795['include'],function(_0x1ced72){return{'model':db[_0x1ced72[_0x8898('0x23')]],'as':_0x1ced72['as'],'attributes':_0x1ced72[_0x8898('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8898('0xd')](function(_0x1a3322){logger[_0x8898('0x16')]('ShowSugarcrmAccount',_0x490c6b);logger[_0x8898('0x10')](_0x8898('0x24'),_0x490c6b,JSON[_0x8898('0x12')](_0x1a3322));_0x1c0d3d(_0x1a3322);})[_0x8898('0x18')](function(_0xb43ad2){logger['error'](_0x8898('0x24'),_0xb43ad2[_0x8898('0x15')],_0x490c6b);_0x356901(_0x10bf00[_0x8898('0x13')](0x1f4,_0xb43ad2[_0x8898('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5fa8bbd..9458529 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 _0x135a=['get','index','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x47066d,_0x2ea60d){var _0x34baa9=function(_0x1fa0de){while(--_0x1fa0de){_0x47066d['push'](_0x47066d['shift']());}};_0x34baa9(++_0x2ea60d);}(_0x135a,0x117));var _0xa135=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x135a[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xa135('0x0'));var util=require('util');var path=require(_0xa135('0x1'));var timeout=require(_0xa135('0x2'));var express=require(_0xa135('0x3'));var router=express[_0xa135('0x4')]();var fs_extra=require(_0xa135('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa135('0x6'));var config=require(_0xa135('0x7'));var controller=require(_0xa135('0x8'));router[_0xa135('0x9')]('/',auth['isAuthenticated'](),controller[_0xa135('0xa')]);router[_0xa135('0x9')]('/:id',auth[_0xa135('0xb')](),controller[_0xa135('0xc')]);router[_0xa135('0x9')]('/:id/fields',auth[_0xa135('0xb')](),controller[_0xa135('0xd')]);router[_0xa135('0x9')](_0xa135('0xe'),auth['isAuthenticated'](),controller[_0xa135('0xf')]);router[_0xa135('0x9')](_0xa135('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa135('0x11')]('/',auth[_0xa135('0xb')](),controller[_0xa135('0x12')]);router[_0xa135('0x13')]('/:id',auth[_0xa135('0xb')](),controller['update']);router[_0xa135('0x14')](_0xa135('0x15'),auth[_0xa135('0xb')](),controller[_0xa135('0x16')]);module[_0xa135('0x17')]=router; \ No newline at end of file +var _0x32c3=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','util','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0xe72729,_0x503951){var _0x3f679b=function(_0x58939f){while(--_0x58939f){_0xe72729['push'](_0xe72729['shift']());}};_0x3f679b(++_0x503951);}(_0x32c3,0x170));var _0x332c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32c3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x332c('0x0'));var path=require('path');var timeout=require(_0x332c('0x1'));var express=require(_0x332c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x332c('0x3'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x332c('0x4')]('/',auth[_0x332c('0x5')](),controller[_0x332c('0x6')]);router[_0x332c('0x4')](_0x332c('0x7'),auth[_0x332c('0x5')](),controller['show']);router['get'](_0x332c('0x8'),auth[_0x332c('0x5')](),controller[_0x332c('0x9')]);router[_0x332c('0x4')](_0x332c('0xa'),auth['isAuthenticated'](),controller[_0x332c('0xb')]);router[_0x332c('0x4')](_0x332c('0xc'),auth[_0x332c('0x5')](),controller['getDescriptions']);router[_0x332c('0xd')]('/',auth['isAuthenticated'](),controller[_0x332c('0xe')]);router[_0x332c('0xf')]('/:id',auth[_0x332c('0x5')](),controller[_0x332c('0x10')]);router[_0x332c('0x11')](_0x332c('0x7'),auth[_0x332c('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index adf6c3a..a6a03ac 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 _0x803d=['exports','STRING','sequelize'];(function(_0x2446df,_0x19228f){var _0x36d276=function(_0xe1d269){while(--_0xe1d269){_0x2446df['push'](_0x2446df['shift']());}};_0x36d276(++_0x19228f);}(_0x803d,0x149));var _0xd803=function(_0x24f94b,_0x3eb0ef){_0x24f94b=_0x24f94b-0x0;var _0x5d6bfb=_0x803d[_0x24f94b];return _0x5d6bfb;};'use strict';var Sequelize=require(_0xd803('0x0'));module[_0xd803('0x1')]={'name':{'type':Sequelize[_0xd803('0x2')]},'description':{'type':Sequelize[_0xd803('0x2')]}}; \ No newline at end of file +var _0x1448=['exports','STRING'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x1448,0x168));var _0x8144=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1448[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8144('0x0')]={'name':{'type':Sequelize[_0x8144('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4438830..edbe99e 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 _0x3dae=['include','find','create','body','SugarcrmField','getFields','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','SugarcrmConfiguration','rows','catch','show','params','keys'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x3dae,0x180));var _0xe3da=function(_0x466c4e,_0x42ed54){_0x466c4e=_0x466c4e-0x0;var _0x2ff8ab=_0x3dae[_0x466c4e];return _0x2ff8ab;};'use strict';var emlformat=require(_0xe3da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3da('0x1'));var jsonpatch=require(_0xe3da('0x2'));var rp=require(_0xe3da('0x3'));var moment=require('moment');var BPromise=require(_0xe3da('0x4'));var Mustache=require('mustache');var util=require(_0xe3da('0x5'));var path=require(_0xe3da('0x6'));var sox=require(_0xe3da('0x7'));var csv=require(_0xe3da('0x8'));var ejs=require(_0xe3da('0x9'));var fs=require('fs');var fs_extra=require(_0xe3da('0xa'));var _=require('lodash');var squel=require(_0xe3da('0xb'));var crypto=require(_0xe3da('0xc'));var jsforce=require(_0xe3da('0xd'));var deskjs=require(_0xe3da('0xe'));var toCsv=require(_0xe3da('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe3da('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3da('0x10'));var logger=require(_0xe3da('0x11'))(_0xe3da('0x12'));var utils=require(_0xe3da('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe3da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49e4e3,_0xa610f8){_0xa610f8=_0xa610f8||0xcc;return function(_0x62b9f9){if(_0x62b9f9){return _0x49e4e3['sendStatus'](_0xa610f8);}return _0x49e4e3[_0xe3da('0x15')](_0xa610f8)[_0xe3da('0x16')]();};}function respondWithResult(_0xa0d4de,_0x5d4173){_0x5d4173=_0x5d4173||0xc8;return function(_0x18f9e1){if(_0x18f9e1){return _0xa0d4de[_0xe3da('0x15')](_0x5d4173)[_0xe3da('0x17')](_0x18f9e1);}};}function respondWithFilteredResult(_0x1c4b6f,_0x47710e){return function(_0x17020b){if(_0x17020b){var _0x897a25=typeof _0x47710e[_0xe3da('0x18')]===_0xe3da('0x19')&&typeof _0x47710e['limit']===_0xe3da('0x19');var _0x44ba53=_0x17020b[_0xe3da('0x1a')];var _0x860ff7=_0x897a25?0x0:_0x47710e[_0xe3da('0x18')];var _0x4d2af3=_0x897a25?_0x17020b[_0xe3da('0x1a')]:_0x47710e[_0xe3da('0x18')]+_0x47710e[_0xe3da('0x1b')];var _0x860aaa;if(_0x4d2af3>=_0x44ba53){_0x4d2af3=_0x44ba53;_0x860aaa=0xc8;}else{_0x860aaa=0xce;}_0x1c4b6f[_0xe3da('0x15')](_0x860aaa);return _0x1c4b6f['set'](_0xe3da('0x1c'),_0x860ff7+'-'+_0x4d2af3+'/'+_0x44ba53)[_0xe3da('0x17')](_0x17020b);}return null;};}function patchUpdates(_0x2d5b06){return function(_0x22e279){try{jsonpatch[_0xe3da('0x1d')](_0x22e279,_0x2d5b06,!![]);}catch(_0x1cd647){return BPromise[_0xe3da('0x1e')](_0x1cd647);}return _0x22e279[_0xe3da('0x1f')]();};}function saveUpdates(_0x486bf2,_0x1513d3){return function(_0xc54d7a){if(_0xc54d7a){return _0xc54d7a[_0xe3da('0x20')](_0x486bf2)[_0xe3da('0x21')](function(_0x5419ec){return _0x5419ec;});}return null;};}function removeEntity(_0x16d570,_0x117c43){return function(_0x507be4){if(_0x507be4){return _0x507be4[_0xe3da('0x22')]()[_0xe3da('0x21')](function(){_0x16d570[_0xe3da('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f7d0,_0x5ca18e){return function(_0x1f4e65){if(!_0x1f4e65){_0x46f7d0[_0xe3da('0x23')](0x194);}return _0x1f4e65;};}function handleError(_0x380c51,_0xce5ad5){_0xce5ad5=_0xce5ad5||0x1f4;return function(_0x296548){logger['error'](_0x296548['stack']);if(_0x296548[_0xe3da('0x24')]){delete _0x296548[_0xe3da('0x24')];}_0x380c51[_0xe3da('0x15')](_0xce5ad5)[_0xe3da('0x25')](_0x296548);};}exports['index']=function(_0x597a1b,_0x4cd939){var _0x4e1d97={},_0x36aef4={},_0x258eea={'count':0x0,'rows':[]};var _0x2d8be0=_['map'](db['SugarcrmConfiguration'][_0xe3da('0x26')],function(_0x47c321){return{'name':_0x47c321[_0xe3da('0x27')],'type':_0x47c321[_0xe3da('0x28')]['key']};});_0x36aef4['model']=_[_0xe3da('0x29')](_0x2d8be0,_0xe3da('0x24'));_0x36aef4[_0xe3da('0x2a')]=_['keys'](_0x597a1b[_0xe3da('0x2a')]);_0x36aef4[_0xe3da('0x2b')]=_['intersection'](_0x36aef4[_0xe3da('0x2c')],_0x36aef4['query']);_0x4e1d97[_0xe3da('0x2d')]=_[_0xe3da('0x2e')](_0x36aef4['model'],qs[_0xe3da('0x2f')](_0x597a1b[_0xe3da('0x2a')][_0xe3da('0x2f')]));_0x4e1d97['attributes']=_0x4e1d97['attributes'][_0xe3da('0x30')]?_0x4e1d97[_0xe3da('0x2d')]:_0x36aef4[_0xe3da('0x2c')];if(!_0x597a1b[_0xe3da('0x2a')][_0xe3da('0x31')](_0xe3da('0x32'))){_0x4e1d97['limit']=qs[_0xe3da('0x1b')](_0x597a1b['query']['limit']);_0x4e1d97['offset']=qs['offset'](_0x597a1b[_0xe3da('0x2a')][_0xe3da('0x18')]);}_0x4e1d97[_0xe3da('0x33')]=qs[_0xe3da('0x34')](_0x597a1b[_0xe3da('0x2a')]['sort']);_0x4e1d97['where']=qs[_0xe3da('0x2b')](_[_0xe3da('0x35')](_0x597a1b[_0xe3da('0x2a')],_0x36aef4[_0xe3da('0x2b')]),_0x2d8be0);if(_0x597a1b[_0xe3da('0x2a')][_0xe3da('0x36')]){_0x4e1d97[_0xe3da('0x37')]=_[_0xe3da('0x38')](_0x4e1d97[_0xe3da('0x37')],{'$or':_['map'](_0x2d8be0,function(_0x2bdfdf){if(_0x2bdfdf['type']!==_0xe3da('0x39')){var _0x5297b1={};_0x5297b1[_0x2bdfdf[_0xe3da('0x24')]]={'$like':'%'+_0x597a1b['query'][_0xe3da('0x36')]+'%'};return _0x5297b1;}})});}_0x4e1d97=_['merge']({},_0x4e1d97,_0x597a1b[_0xe3da('0x3a')]);var _0xacbd8d={'where':_0x4e1d97[_0xe3da('0x37')]};return db['SugarcrmConfiguration']['count'](_0xacbd8d)[_0xe3da('0x21')](function(_0x1f656f){_0x258eea[_0xe3da('0x1a')]=_0x1f656f;if(_0x597a1b['query'][_0xe3da('0x3b')]){_0x4e1d97['include']=[{'all':!![]}];}return db[_0xe3da('0x3c')]['findAll'](_0x4e1d97);})['then'](function(_0x50708c){_0x258eea[_0xe3da('0x3d')]=_0x50708c;return _0x258eea;})['then'](respondWithFilteredResult(_0x4cd939,_0x4e1d97))[_0xe3da('0x3e')](handleError(_0x4cd939,null));};exports[_0xe3da('0x3f')]=function(_0x22bbe7,_0xdc89d4){var _0x1353eb={'raw':![],'where':{'id':_0x22bbe7[_0xe3da('0x40')]['id']}},_0x57358a={};_0x57358a[_0xe3da('0x2c')]=_[_0xe3da('0x41')](db[_0xe3da('0x3c')]['rawAttributes']);_0x57358a['query']=_[_0xe3da('0x41')](_0x22bbe7[_0xe3da('0x2a')]);_0x57358a[_0xe3da('0x2b')]=_[_0xe3da('0x2e')](_0x57358a[_0xe3da('0x2c')],_0x57358a['query']);_0x1353eb[_0xe3da('0x2d')]=_[_0xe3da('0x2e')](_0x57358a[_0xe3da('0x2c')],qs['fields'](_0x22bbe7[_0xe3da('0x2a')][_0xe3da('0x2f')]));_0x1353eb[_0xe3da('0x2d')]=_0x1353eb[_0xe3da('0x2d')][_0xe3da('0x30')]?_0x1353eb['attributes']:_0x57358a[_0xe3da('0x2c')];if(_0x22bbe7[_0xe3da('0x2a')][_0xe3da('0x3b')]){_0x1353eb[_0xe3da('0x42')]=[{'all':!![]}];}_0x1353eb=_[_0xe3da('0x38')]({},_0x1353eb,_0x22bbe7[_0xe3da('0x3a')]);return db['SugarcrmConfiguration'][_0xe3da('0x43')](_0x1353eb)[_0xe3da('0x21')](handleEntityNotFound(_0xdc89d4,null))['then'](respondWithResult(_0xdc89d4,null))[_0xe3da('0x3e')](handleError(_0xdc89d4,null));};exports[_0xe3da('0x44')]=function(_0x4bd9b5,_0x391305){return db[_0xe3da('0x3c')]['create'](_0x4bd9b5[_0xe3da('0x45')],{})[_0xe3da('0x21')](respondWithResult(_0x391305,0xc9))['catch'](handleError(_0x391305,null));};exports[_0xe3da('0x20')]=function(_0x2e08f6,_0x162a0a){if(_0x2e08f6[_0xe3da('0x45')]['id']){delete _0x2e08f6['body']['id'];}return db[_0xe3da('0x3c')][_0xe3da('0x43')]({'where':{'id':_0x2e08f6[_0xe3da('0x40')]['id']}})['then'](handleEntityNotFound(_0x162a0a,null))[_0xe3da('0x21')](saveUpdates(_0x2e08f6[_0xe3da('0x45')],null))[_0xe3da('0x21')](respondWithResult(_0x162a0a,null))[_0xe3da('0x3e')](handleError(_0x162a0a,null));};exports[_0xe3da('0x22')]=function(_0x352546,_0xce38f1){return db['SugarcrmConfiguration'][_0xe3da('0x43')]({'where':{'id':_0x352546['params']['id']}})[_0xe3da('0x21')](handleEntityNotFound(_0xce38f1,null))[_0xe3da('0x21')](removeEntity(_0xce38f1,null))[_0xe3da('0x3e')](handleError(_0xce38f1,null));};exports['getFields']=function(_0x189343,_0x317da9,_0x4cd0c8){var _0x299193={};var _0x156ea2={};var _0x533237;var _0xd1a266;return db[_0xe3da('0x3c')]['findOne']({'where':{'id':_0x189343['params']['id']}})[_0xe3da('0x21')](handleEntityNotFound(_0x317da9,null))['then'](function(_0x2a9fe9){if(_0x2a9fe9){_0x533237=_0x2a9fe9;_0x156ea2[_0xe3da('0x2c')]=_[_0xe3da('0x41')](db[_0xe3da('0x46')][_0xe3da('0x26')]);_0x156ea2['query']=_['keys'](_0x189343['query']);_0x156ea2[_0xe3da('0x2b')]=_[_0xe3da('0x2e')](_0x156ea2['model'],_0x156ea2['query']);_0x299193[_0xe3da('0x2d')]=_[_0xe3da('0x2e')](_0x156ea2[_0xe3da('0x2c')],qs['fields'](_0x189343[_0xe3da('0x2a')][_0xe3da('0x2f')]));_0x299193[_0xe3da('0x2d')]=_0x299193[_0xe3da('0x2d')][_0xe3da('0x30')]?_0x299193['attributes']:_0x156ea2['model'];_0x299193[_0xe3da('0x33')]=qs[_0xe3da('0x34')](_0x189343[_0xe3da('0x2a')][_0xe3da('0x34')]);_0x299193['where']=qs['filters'](_[_0xe3da('0x35')](_0x189343[_0xe3da('0x2a')],_0x156ea2[_0xe3da('0x2b')]));if(_0x189343[_0xe3da('0x2a')][_0xe3da('0x36')]){_0x299193[_0xe3da('0x37')]=_[_0xe3da('0x38')](_0x299193['where'],{'$or':_[_0xe3da('0x29')](_0x299193[_0xe3da('0x2d')],function(_0x40c13c){var _0x10c57d={};_0x10c57d[_0x40c13c]={'$like':'%'+_0x189343['query'][_0xe3da('0x36')]+'%'};return _0x10c57d;})});}_0x299193=_[_0xe3da('0x38')]({},_0x299193,_0x189343[_0xe3da('0x3a')]);return _0x533237[_0xe3da('0x47')](_0x299193);}})['then'](function(_0x4001d7){if(_0x4001d7){_0xd1a266=_0x4001d7[_0xe3da('0x30')];if(!_0x189343[_0xe3da('0x2a')][_0xe3da('0x31')](_0xe3da('0x32'))){_0x299193[_0xe3da('0x1b')]=qs['limit'](_0x189343[_0xe3da('0x2a')][_0xe3da('0x1b')]);_0x299193[_0xe3da('0x18')]=qs[_0xe3da('0x18')](_0x189343[_0xe3da('0x2a')][_0xe3da('0x18')]);}return _0x533237[_0xe3da('0x47')](_0x299193);}})[_0xe3da('0x21')](function(_0x3c3fa2){if(_0x3c3fa2){return _0x3c3fa2?{'count':_0xd1a266,'rows':_0x3c3fa2}:null;}})['then'](respondWithResult(_0x317da9,null))[_0xe3da('0x3e')](handleError(_0x317da9,null));};exports[_0xe3da('0x48')]=function(_0x4a99a2,_0x2bb697,_0x5f4d23){var _0x4f8d1d={};var _0x5682a3={};var _0x48950a;var _0x148f9c;return db[_0xe3da('0x3c')]['findOne']({'where':{'id':_0x4a99a2['params']['id']}})[_0xe3da('0x21')](handleEntityNotFound(_0x2bb697,null))[_0xe3da('0x21')](function(_0x46c4a3){if(_0x46c4a3){_0x48950a=_0x46c4a3;_0x5682a3[_0xe3da('0x2c')]=_['keys'](db[_0xe3da('0x46')][_0xe3da('0x26')]);_0x5682a3[_0xe3da('0x2a')]=_['keys'](_0x4a99a2[_0xe3da('0x2a')]);_0x5682a3[_0xe3da('0x2b')]=_[_0xe3da('0x2e')](_0x5682a3['model'],_0x5682a3['query']);_0x4f8d1d[_0xe3da('0x2d')]=_[_0xe3da('0x2e')](_0x5682a3[_0xe3da('0x2c')],qs['fields'](_0x4a99a2[_0xe3da('0x2a')][_0xe3da('0x2f')]));_0x4f8d1d['attributes']=_0x4f8d1d[_0xe3da('0x2d')][_0xe3da('0x30')]?_0x4f8d1d[_0xe3da('0x2d')]:_0x5682a3[_0xe3da('0x2c')];_0x4f8d1d[_0xe3da('0x33')]=qs[_0xe3da('0x34')](_0x4a99a2[_0xe3da('0x2a')][_0xe3da('0x34')]);_0x4f8d1d['where']=qs['filters'](_['pick'](_0x4a99a2['query'],_0x5682a3[_0xe3da('0x2b')]));if(_0x4a99a2[_0xe3da('0x2a')]['filter']){_0x4f8d1d['where']=_['merge'](_0x4f8d1d[_0xe3da('0x37')],{'$or':_[_0xe3da('0x29')](_0x4f8d1d[_0xe3da('0x2d')],function(_0x7c1242){var _0x1524e4={};_0x1524e4[_0x7c1242]={'$like':'%'+_0x4a99a2[_0xe3da('0x2a')][_0xe3da('0x36')]+'%'};return _0x1524e4;})});}_0x4f8d1d=_[_0xe3da('0x38')]({},_0x4f8d1d,_0x4a99a2[_0xe3da('0x3a')]);return _0x48950a['getSubjects'](_0x4f8d1d);}})['then'](function(_0x55c0f6){if(_0x55c0f6){_0x148f9c=_0x55c0f6[_0xe3da('0x30')];if(!_0x4a99a2[_0xe3da('0x2a')][_0xe3da('0x31')](_0xe3da('0x32'))){_0x4f8d1d[_0xe3da('0x1b')]=qs['limit'](_0x4a99a2[_0xe3da('0x2a')]['limit']);_0x4f8d1d[_0xe3da('0x18')]=qs[_0xe3da('0x18')](_0x4a99a2[_0xe3da('0x2a')]['offset']);}return _0x48950a[_0xe3da('0x48')](_0x4f8d1d);}})[_0xe3da('0x21')](function(_0x4f1128){if(_0x4f1128){return _0x4f1128?{'count':_0x148f9c,'rows':_0x4f1128}:null;}})[_0xe3da('0x21')](respondWithResult(_0x2bb697,null))[_0xe3da('0x3e')](handleError(_0x2bb697,null));};exports[_0xe3da('0x49')]=function(_0x4772a0,_0x2f19ef,_0x232177){var _0x2c733b={};var _0x34e343={};var _0x3290c8;var _0x466332;return db[_0xe3da('0x3c')][_0xe3da('0x4a')]({'where':{'id':_0x4772a0[_0xe3da('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f19ef,null))[_0xe3da('0x21')](function(_0xdec9a9){if(_0xdec9a9){_0x3290c8=_0xdec9a9;_0x34e343[_0xe3da('0x2c')]=_[_0xe3da('0x41')](db[_0xe3da('0x46')][_0xe3da('0x26')]);_0x34e343[_0xe3da('0x2a')]=_[_0xe3da('0x41')](_0x4772a0['query']);_0x34e343[_0xe3da('0x2b')]=_['intersection'](_0x34e343[_0xe3da('0x2c')],_0x34e343[_0xe3da('0x2a')]);_0x2c733b[_0xe3da('0x2d')]=_[_0xe3da('0x2e')](_0x34e343['model'],qs[_0xe3da('0x2f')](_0x4772a0[_0xe3da('0x2a')][_0xe3da('0x2f')]));_0x2c733b[_0xe3da('0x2d')]=_0x2c733b[_0xe3da('0x2d')][_0xe3da('0x30')]?_0x2c733b['attributes']:_0x34e343[_0xe3da('0x2c')];_0x2c733b[_0xe3da('0x33')]=qs[_0xe3da('0x34')](_0x4772a0[_0xe3da('0x2a')]['sort']);_0x2c733b[_0xe3da('0x37')]=qs[_0xe3da('0x2b')](_['pick'](_0x4772a0['query'],_0x34e343['filters']));if(_0x4772a0[_0xe3da('0x2a')][_0xe3da('0x36')]){_0x2c733b['where']=_['merge'](_0x2c733b['where'],{'$or':_[_0xe3da('0x29')](_0x2c733b['attributes'],function(_0x2bb69e){var _0x4d16dc={};_0x4d16dc[_0x2bb69e]={'$like':'%'+_0x4772a0[_0xe3da('0x2a')]['filter']+'%'};return _0x4d16dc;})});}_0x2c733b=_['merge']({},_0x2c733b,_0x4772a0['options']);return _0x3290c8[_0xe3da('0x49')](_0x2c733b);}})['then'](function(_0x1f2d5b){if(_0x1f2d5b){_0x466332=_0x1f2d5b['length'];if(!_0x4772a0[_0xe3da('0x2a')][_0xe3da('0x31')](_0xe3da('0x32'))){_0x2c733b[_0xe3da('0x1b')]=qs[_0xe3da('0x1b')](_0x4772a0[_0xe3da('0x2a')][_0xe3da('0x1b')]);_0x2c733b['offset']=qs['offset'](_0x4772a0[_0xe3da('0x2a')][_0xe3da('0x18')]);}return _0x3290c8[_0xe3da('0x49')](_0x2c733b);}})['then'](function(_0x3714ac){if(_0x3714ac){return _0x3714ac?{'count':_0x466332,'rows':_0x3714ac}:null;}})['then'](respondWithResult(_0x2f19ef,null))[_0xe3da('0x3e')](handleError(_0x2f19ef,null));}; \ No newline at end of file +var _0xca05=['path','sox','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','name','map','SugarcrmConfiguration','type','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','getFields','SugarcrmField','rawAttributes','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','util'];(function(_0xaf7182,_0x469017){var _0x1df4de=function(_0x4431ae){while(--_0x4431ae){_0xaf7182['push'](_0xaf7182['shift']());}};_0x1df4de(++_0x469017);}(_0xca05,0x12a));var _0x5ca0=function(_0x5ae93d,_0x48a929){_0x5ae93d=_0x5ae93d-0x0;var _0x3bc344=_0xca05[_0x5ae93d];return _0x3bc344;};'use strict';var emlformat=require(_0x5ca0('0x0'));var rimraf=require(_0x5ca0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ca0('0x2'));var moment=require('moment');var BPromise=require(_0x5ca0('0x3'));var Mustache=require(_0x5ca0('0x4'));var util=require(_0x5ca0('0x5'));var path=require(_0x5ca0('0x6'));var sox=require(_0x5ca0('0x7'));var csv=require('to-csv');var ejs=require(_0x5ca0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ca0('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5ca0('0xa'));var querystring=require(_0x5ca0('0xb'));var Papa=require(_0x5ca0('0xc'));var Redis=require(_0x5ca0('0xd'));var authService=require(_0x5ca0('0xe'));var qs=require(_0x5ca0('0xf'));var as=require(_0x5ca0('0x10'));var hardwareService=require(_0x5ca0('0x11'));var logger=require(_0x5ca0('0x12'))('api');var utils=require(_0x5ca0('0x13'));var config=require(_0x5ca0('0x14'));var licenseUtil=require(_0x5ca0('0x15'));var db=require(_0x5ca0('0x16'))['db'];function respondWithStatusCode(_0x21542b,_0x517e3b){_0x517e3b=_0x517e3b||0xcc;return function(_0x5eaa9e){if(_0x5eaa9e){return _0x21542b[_0x5ca0('0x17')](_0x517e3b);}return _0x21542b[_0x5ca0('0x18')](_0x517e3b)['end']();};}function respondWithResult(_0x44212d,_0x3ee690){_0x3ee690=_0x3ee690||0xc8;return function(_0x4aab60){if(_0x4aab60){return _0x44212d['status'](_0x3ee690)['json'](_0x4aab60);}};}function respondWithFilteredResult(_0x3f0ae8,_0x3e6aad){return function(_0x2e22d9){if(_0x2e22d9){var _0xe3353a=typeof _0x3e6aad[_0x5ca0('0x19')]===_0x5ca0('0x1a')&&typeof _0x3e6aad[_0x5ca0('0x1b')]===_0x5ca0('0x1a');var _0x235dc4=_0x2e22d9['count'];var _0x1433b7=_0xe3353a?0x0:_0x3e6aad[_0x5ca0('0x19')];var _0x2d954f=_0xe3353a?_0x2e22d9[_0x5ca0('0x1c')]:_0x3e6aad['offset']+_0x3e6aad[_0x5ca0('0x1b')];var _0x582edb;if(_0x2d954f>=_0x235dc4){_0x2d954f=_0x235dc4;_0x582edb=0xc8;}else{_0x582edb=0xce;}_0x3f0ae8[_0x5ca0('0x18')](_0x582edb);return _0x3f0ae8[_0x5ca0('0x1d')](_0x5ca0('0x1e'),_0x1433b7+'-'+_0x2d954f+'/'+_0x235dc4)['json'](_0x2e22d9);}return null;};}function patchUpdates(_0x65f997){return function(_0x2ba26d){try{jsonpatch[_0x5ca0('0x1f')](_0x2ba26d,_0x65f997,!![]);}catch(_0xfe6798){return BPromise['reject'](_0xfe6798);}return _0x2ba26d[_0x5ca0('0x20')]();};}function saveUpdates(_0x59bde0,_0x1bbb6a){return function(_0x134e4c){if(_0x134e4c){return _0x134e4c['update'](_0x59bde0)[_0x5ca0('0x21')](function(_0x34be5c){return _0x34be5c;});}return null;};}function removeEntity(_0x4564e3,_0x3205ec){return function(_0x47a75b){if(_0x47a75b){return _0x47a75b[_0x5ca0('0x22')]()['then'](function(){_0x4564e3[_0x5ca0('0x18')](0xcc)[_0x5ca0('0x23')]();});}};}function handleEntityNotFound(_0x326f54,_0x4057d5){return function(_0x46fa81){if(!_0x46fa81){_0x326f54[_0x5ca0('0x17')](0x194);}return _0x46fa81;};}function handleError(_0x3b28bc,_0x246bb7){_0x246bb7=_0x246bb7||0x1f4;return function(_0x314f0e){logger[_0x5ca0('0x24')](_0x314f0e['stack']);if(_0x314f0e['name']){delete _0x314f0e[_0x5ca0('0x25')];}_0x3b28bc['status'](_0x246bb7)['send'](_0x314f0e);};}exports['index']=function(_0x249670,_0x134602){var _0x5d1dba={},_0x54d4d5={},_0xff70c7={'count':0x0,'rows':[]};var _0x5a92b0=_[_0x5ca0('0x26')](db[_0x5ca0('0x27')]['rawAttributes'],function(_0x307e99){return{'name':_0x307e99['fieldName'],'type':_0x307e99[_0x5ca0('0x28')]['key']};});_0x54d4d5['model']=_['map'](_0x5a92b0,_0x5ca0('0x25'));_0x54d4d5['query']=_[_0x5ca0('0x29')](_0x249670['query']);_0x54d4d5[_0x5ca0('0x2a')]=_[_0x5ca0('0x2b')](_0x54d4d5[_0x5ca0('0x2c')],_0x54d4d5[_0x5ca0('0x2d')]);_0x5d1dba[_0x5ca0('0x2e')]=_[_0x5ca0('0x2b')](_0x54d4d5['model'],qs[_0x5ca0('0x2f')](_0x249670[_0x5ca0('0x2d')][_0x5ca0('0x2f')]));_0x5d1dba[_0x5ca0('0x2e')]=_0x5d1dba[_0x5ca0('0x2e')][_0x5ca0('0x30')]?_0x5d1dba[_0x5ca0('0x2e')]:_0x54d4d5[_0x5ca0('0x2c')];if(!_0x249670[_0x5ca0('0x2d')]['hasOwnProperty'](_0x5ca0('0x31'))){_0x5d1dba[_0x5ca0('0x1b')]=qs[_0x5ca0('0x1b')](_0x249670[_0x5ca0('0x2d')][_0x5ca0('0x1b')]);_0x5d1dba[_0x5ca0('0x19')]=qs[_0x5ca0('0x19')](_0x249670[_0x5ca0('0x2d')]['offset']);}_0x5d1dba[_0x5ca0('0x32')]=qs['sort'](_0x249670[_0x5ca0('0x2d')][_0x5ca0('0x33')]);_0x5d1dba[_0x5ca0('0x34')]=qs[_0x5ca0('0x2a')](_[_0x5ca0('0x35')](_0x249670['query'],_0x54d4d5['filters']),_0x5a92b0);if(_0x249670['query'][_0x5ca0('0x36')]){_0x5d1dba[_0x5ca0('0x34')]=_['merge'](_0x5d1dba[_0x5ca0('0x34')],{'$or':_[_0x5ca0('0x26')](_0x5a92b0,function(_0x152715){if(_0x152715[_0x5ca0('0x28')]!==_0x5ca0('0x37')){var _0xc7c659={};_0xc7c659[_0x152715[_0x5ca0('0x25')]]={'$like':'%'+_0x249670[_0x5ca0('0x2d')][_0x5ca0('0x36')]+'%'};return _0xc7c659;}})});}_0x5d1dba=_[_0x5ca0('0x38')]({},_0x5d1dba,_0x249670[_0x5ca0('0x39')]);var _0x224e87={'where':_0x5d1dba[_0x5ca0('0x34')]};return db[_0x5ca0('0x27')][_0x5ca0('0x1c')](_0x224e87)[_0x5ca0('0x21')](function(_0x426312){_0xff70c7[_0x5ca0('0x1c')]=_0x426312;if(_0x249670[_0x5ca0('0x2d')]['includeAll']){_0x5d1dba[_0x5ca0('0x3a')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x5ca0('0x3b')](_0x5d1dba);})[_0x5ca0('0x21')](function(_0x586606){_0xff70c7[_0x5ca0('0x3c')]=_0x586606;return _0xff70c7;})['then'](respondWithFilteredResult(_0x134602,_0x5d1dba))[_0x5ca0('0x3d')](handleError(_0x134602,null));};exports[_0x5ca0('0x3e')]=function(_0x53a85c,_0x2a18d3){var _0x8037a0={'raw':![],'where':{'id':_0x53a85c[_0x5ca0('0x3f')]['id']}},_0x2bffaa={};_0x2bffaa['model']=_[_0x5ca0('0x29')](db[_0x5ca0('0x27')]['rawAttributes']);_0x2bffaa[_0x5ca0('0x2d')]=_[_0x5ca0('0x29')](_0x53a85c[_0x5ca0('0x2d')]);_0x2bffaa[_0x5ca0('0x2a')]=_['intersection'](_0x2bffaa[_0x5ca0('0x2c')],_0x2bffaa[_0x5ca0('0x2d')]);_0x8037a0['attributes']=_[_0x5ca0('0x2b')](_0x2bffaa[_0x5ca0('0x2c')],qs[_0x5ca0('0x2f')](_0x53a85c[_0x5ca0('0x2d')][_0x5ca0('0x2f')]));_0x8037a0[_0x5ca0('0x2e')]=_0x8037a0[_0x5ca0('0x2e')]['length']?_0x8037a0[_0x5ca0('0x2e')]:_0x2bffaa['model'];if(_0x53a85c[_0x5ca0('0x2d')][_0x5ca0('0x40')]){_0x8037a0['include']=[{'all':!![]}];}_0x8037a0=_[_0x5ca0('0x38')]({},_0x8037a0,_0x53a85c[_0x5ca0('0x39')]);return db[_0x5ca0('0x27')][_0x5ca0('0x41')](_0x8037a0)['then'](handleEntityNotFound(_0x2a18d3,null))[_0x5ca0('0x21')](respondWithResult(_0x2a18d3,null))[_0x5ca0('0x3d')](handleError(_0x2a18d3,null));};exports[_0x5ca0('0x42')]=function(_0x115049,_0x4eebe8){return db[_0x5ca0('0x27')][_0x5ca0('0x42')](_0x115049[_0x5ca0('0x43')],{})[_0x5ca0('0x21')](respondWithResult(_0x4eebe8,0xc9))[_0x5ca0('0x3d')](handleError(_0x4eebe8,null));};exports[_0x5ca0('0x44')]=function(_0x79fa17,_0x4452d8){if(_0x79fa17[_0x5ca0('0x43')]['id']){delete _0x79fa17[_0x5ca0('0x43')]['id'];}return db[_0x5ca0('0x27')][_0x5ca0('0x41')]({'where':{'id':_0x79fa17[_0x5ca0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4452d8,null))[_0x5ca0('0x21')](saveUpdates(_0x79fa17[_0x5ca0('0x43')],null))[_0x5ca0('0x21')](respondWithResult(_0x4452d8,null))[_0x5ca0('0x3d')](handleError(_0x4452d8,null));};exports[_0x5ca0('0x22')]=function(_0x3d8f14,_0x11175e){return db[_0x5ca0('0x27')][_0x5ca0('0x41')]({'where':{'id':_0x3d8f14[_0x5ca0('0x3f')]['id']}})[_0x5ca0('0x21')](handleEntityNotFound(_0x11175e,null))['then'](removeEntity(_0x11175e,null))[_0x5ca0('0x3d')](handleError(_0x11175e,null));};exports[_0x5ca0('0x45')]=function(_0x598276,_0x2d954a,_0x41db38){var _0xe423ee={};var _0x5ea894={};var _0x388f78;var _0x72839b;return db[_0x5ca0('0x27')]['findOne']({'where':{'id':_0x598276[_0x5ca0('0x3f')]['id']}})[_0x5ca0('0x21')](handleEntityNotFound(_0x2d954a,null))[_0x5ca0('0x21')](function(_0x33007b){if(_0x33007b){_0x388f78=_0x33007b;_0x5ea894[_0x5ca0('0x2c')]=_[_0x5ca0('0x29')](db[_0x5ca0('0x46')][_0x5ca0('0x47')]);_0x5ea894[_0x5ca0('0x2d')]=_['keys'](_0x598276[_0x5ca0('0x2d')]);_0x5ea894[_0x5ca0('0x2a')]=_[_0x5ca0('0x2b')](_0x5ea894[_0x5ca0('0x2c')],_0x5ea894[_0x5ca0('0x2d')]);_0xe423ee['attributes']=_['intersection'](_0x5ea894[_0x5ca0('0x2c')],qs[_0x5ca0('0x2f')](_0x598276['query'][_0x5ca0('0x2f')]));_0xe423ee[_0x5ca0('0x2e')]=_0xe423ee[_0x5ca0('0x2e')][_0x5ca0('0x30')]?_0xe423ee[_0x5ca0('0x2e')]:_0x5ea894[_0x5ca0('0x2c')];_0xe423ee['order']=qs[_0x5ca0('0x33')](_0x598276[_0x5ca0('0x2d')][_0x5ca0('0x33')]);_0xe423ee[_0x5ca0('0x34')]=qs[_0x5ca0('0x2a')](_['pick'](_0x598276['query'],_0x5ea894['filters']));if(_0x598276[_0x5ca0('0x2d')]['filter']){_0xe423ee[_0x5ca0('0x34')]=_[_0x5ca0('0x38')](_0xe423ee[_0x5ca0('0x34')],{'$or':_[_0x5ca0('0x26')](_0xe423ee[_0x5ca0('0x2e')],function(_0xdaacb1){var _0x1e05bb={};_0x1e05bb[_0xdaacb1]={'$like':'%'+_0x598276[_0x5ca0('0x2d')][_0x5ca0('0x36')]+'%'};return _0x1e05bb;})});}_0xe423ee=_[_0x5ca0('0x38')]({},_0xe423ee,_0x598276[_0x5ca0('0x39')]);return _0x388f78[_0x5ca0('0x45')](_0xe423ee);}})[_0x5ca0('0x21')](function(_0x9334c8){if(_0x9334c8){_0x72839b=_0x9334c8[_0x5ca0('0x30')];if(!_0x598276[_0x5ca0('0x2d')][_0x5ca0('0x48')](_0x5ca0('0x31'))){_0xe423ee[_0x5ca0('0x1b')]=qs['limit'](_0x598276['query'][_0x5ca0('0x1b')]);_0xe423ee[_0x5ca0('0x19')]=qs[_0x5ca0('0x19')](_0x598276[_0x5ca0('0x2d')]['offset']);}return _0x388f78[_0x5ca0('0x45')](_0xe423ee);}})['then'](function(_0x24648d){if(_0x24648d){return _0x24648d?{'count':_0x72839b,'rows':_0x24648d}:null;}})[_0x5ca0('0x21')](respondWithResult(_0x2d954a,null))[_0x5ca0('0x3d')](handleError(_0x2d954a,null));};exports[_0x5ca0('0x49')]=function(_0x3910bb,_0x22dc0a,_0x1799f9){var _0x236144={};var _0x2958bd={};var _0x2bceb3;var _0x4437b1;return db[_0x5ca0('0x27')][_0x5ca0('0x4a')]({'where':{'id':_0x3910bb[_0x5ca0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x22dc0a,null))[_0x5ca0('0x21')](function(_0x371bb1){if(_0x371bb1){_0x2bceb3=_0x371bb1;_0x2958bd[_0x5ca0('0x2c')]=_[_0x5ca0('0x29')](db[_0x5ca0('0x46')][_0x5ca0('0x47')]);_0x2958bd[_0x5ca0('0x2d')]=_[_0x5ca0('0x29')](_0x3910bb['query']);_0x2958bd[_0x5ca0('0x2a')]=_[_0x5ca0('0x2b')](_0x2958bd[_0x5ca0('0x2c')],_0x2958bd[_0x5ca0('0x2d')]);_0x236144['attributes']=_[_0x5ca0('0x2b')](_0x2958bd[_0x5ca0('0x2c')],qs[_0x5ca0('0x2f')](_0x3910bb[_0x5ca0('0x2d')][_0x5ca0('0x2f')]));_0x236144[_0x5ca0('0x2e')]=_0x236144[_0x5ca0('0x2e')]['length']?_0x236144[_0x5ca0('0x2e')]:_0x2958bd[_0x5ca0('0x2c')];_0x236144[_0x5ca0('0x32')]=qs['sort'](_0x3910bb[_0x5ca0('0x2d')][_0x5ca0('0x33')]);_0x236144[_0x5ca0('0x34')]=qs[_0x5ca0('0x2a')](_['pick'](_0x3910bb['query'],_0x2958bd[_0x5ca0('0x2a')]));if(_0x3910bb[_0x5ca0('0x2d')][_0x5ca0('0x36')]){_0x236144[_0x5ca0('0x34')]=_['merge'](_0x236144[_0x5ca0('0x34')],{'$or':_[_0x5ca0('0x26')](_0x236144['attributes'],function(_0x647033){var _0x314b96={};_0x314b96[_0x647033]={'$like':'%'+_0x3910bb[_0x5ca0('0x2d')]['filter']+'%'};return _0x314b96;})});}_0x236144=_[_0x5ca0('0x38')]({},_0x236144,_0x3910bb[_0x5ca0('0x39')]);return _0x2bceb3[_0x5ca0('0x49')](_0x236144);}})['then'](function(_0x44ee2e){if(_0x44ee2e){_0x4437b1=_0x44ee2e[_0x5ca0('0x30')];if(!_0x3910bb['query']['hasOwnProperty'](_0x5ca0('0x31'))){_0x236144[_0x5ca0('0x1b')]=qs[_0x5ca0('0x1b')](_0x3910bb[_0x5ca0('0x2d')][_0x5ca0('0x1b')]);_0x236144['offset']=qs[_0x5ca0('0x19')](_0x3910bb['query'][_0x5ca0('0x19')]);}return _0x2bceb3[_0x5ca0('0x49')](_0x236144);}})[_0x5ca0('0x21')](function(_0x3628ff){if(_0x3628ff){return _0x3628ff?{'count':_0x4437b1,'rows':_0x3628ff}:null;}})[_0x5ca0('0x21')](respondWithResult(_0x22dc0a,null))['catch'](handleError(_0x22dc0a,null));};exports[_0x5ca0('0x4b')]=function(_0x454cfe,_0x2f6e15,_0x11f679){var _0xedc348={};var _0x2696b8={};var _0x400639;var _0x50bb2e;return db[_0x5ca0('0x27')][_0x5ca0('0x4a')]({'where':{'id':_0x454cfe[_0x5ca0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f6e15,null))[_0x5ca0('0x21')](function(_0xb98580){if(_0xb98580){_0x400639=_0xb98580;_0x2696b8['model']=_[_0x5ca0('0x29')](db[_0x5ca0('0x46')][_0x5ca0('0x47')]);_0x2696b8[_0x5ca0('0x2d')]=_[_0x5ca0('0x29')](_0x454cfe[_0x5ca0('0x2d')]);_0x2696b8[_0x5ca0('0x2a')]=_[_0x5ca0('0x2b')](_0x2696b8[_0x5ca0('0x2c')],_0x2696b8[_0x5ca0('0x2d')]);_0xedc348['attributes']=_[_0x5ca0('0x2b')](_0x2696b8['model'],qs[_0x5ca0('0x2f')](_0x454cfe['query'][_0x5ca0('0x2f')]));_0xedc348[_0x5ca0('0x2e')]=_0xedc348['attributes'][_0x5ca0('0x30')]?_0xedc348['attributes']:_0x2696b8['model'];_0xedc348[_0x5ca0('0x32')]=qs[_0x5ca0('0x33')](_0x454cfe[_0x5ca0('0x2d')]['sort']);_0xedc348[_0x5ca0('0x34')]=qs[_0x5ca0('0x2a')](_['pick'](_0x454cfe[_0x5ca0('0x2d')],_0x2696b8['filters']));if(_0x454cfe[_0x5ca0('0x2d')]['filter']){_0xedc348[_0x5ca0('0x34')]=_[_0x5ca0('0x38')](_0xedc348[_0x5ca0('0x34')],{'$or':_[_0x5ca0('0x26')](_0xedc348['attributes'],function(_0x52bf76){var _0x55eae3={};_0x55eae3[_0x52bf76]={'$like':'%'+_0x454cfe[_0x5ca0('0x2d')][_0x5ca0('0x36')]+'%'};return _0x55eae3;})});}_0xedc348=_[_0x5ca0('0x38')]({},_0xedc348,_0x454cfe['options']);return _0x400639['getDescriptions'](_0xedc348);}})['then'](function(_0x23a50a){if(_0x23a50a){_0x50bb2e=_0x23a50a['length'];if(!_0x454cfe['query'][_0x5ca0('0x48')]('nolimit')){_0xedc348[_0x5ca0('0x1b')]=qs[_0x5ca0('0x1b')](_0x454cfe[_0x5ca0('0x2d')]['limit']);_0xedc348[_0x5ca0('0x19')]=qs['offset'](_0x454cfe[_0x5ca0('0x2d')][_0x5ca0('0x19')]);}return _0x400639[_0x5ca0('0x4b')](_0xedc348);}})['then'](function(_0x855f0d){if(_0x855f0d){return _0x855f0d?{'count':_0x50bb2e,'rows':_0x855f0d}:null;}})[_0x5ca0('0x21')](respondWithResult(_0x2f6e15,null))[_0x5ca0('0x3d')](handleError(_0x2f6e15,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index fdb5a4e..156dbf1 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 _0x5356=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x1c00a8,_0x420997){var _0x168ff6=function(_0x12800e){while(--_0x12800e){_0x1c00a8['push'](_0x1c00a8['shift']());}};_0x168ff6(++_0x420997);}(_0x5356,0x1aa));var _0x6535=function(_0x26d94c,_0x4bf18f){_0x26d94c=_0x26d94c-0x0;var _0x4a9392=_0x5356[_0x26d94c];return _0x4a9392;};'use strict';var _=require(_0x6535('0x0'));var util=require(_0x6535('0x1'));var logger=require(_0x6535('0x2'))('api');var moment=require(_0x6535('0x3'));var BPromise=require(_0x6535('0x4'));var rp=require(_0x6535('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6535('0x6'));var config=require(_0x6535('0x7'));var attributes=require(_0x6535('0x8'));module[_0x6535('0x9')]=function(_0x4ff2f0,_0x35f2d5){return _0x4ff2f0[_0x6535('0xa')](_0x6535('0xb'),attributes,{'tableName':_0x6535('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2418=['request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x2418,0x14a));var _0x8241=function(_0x3f31e1,_0x33a6dc){_0x3f31e1=_0x3f31e1-0x0;var _0x6aaa28=_0x2418[_0x3f31e1];return _0x6aaa28;};'use strict';var _=require(_0x8241('0x0'));var util=require(_0x8241('0x1'));var logger=require(_0x8241('0x2'))(_0x8241('0x3'));var moment=require(_0x8241('0x4'));var BPromise=require(_0x8241('0x5'));var rp=require(_0x8241('0x6'));var fs=require('fs');var path=require(_0x8241('0x7'));var rimraf=require(_0x8241('0x8'));var config=require(_0x8241('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8241('0xa')]=function(_0xaeec05,_0x4f17c4){return _0xaeec05[_0x8241('0xb')](_0x8241('0xc'),attributes,{'tableName':_0x8241('0xd'),'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 b5900a0..2918221 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 _0x50a2=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x50a2,0x1b0));var _0x250a=function(_0xf8badc,_0x46c03a){_0xf8badc=_0xf8badc-0x0;var _0x30e845=_0x50a2[_0xf8badc];return _0x30e845;};'use strict';var _=require(_0x250a('0x0'));var util=require(_0x250a('0x1'));var moment=require(_0x250a('0x2'));var BPromise=require('bluebird');var rs=require(_0x250a('0x3'));var fs=require('fs');var Redis=require(_0x250a('0x4'));var db=require(_0x250a('0x5'))['db'];var utils=require(_0x250a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x250a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38d0a0,_0x59e4ac,_0x227a5b){return new BPromise(function(_0x52f79f,_0x5c644b){return client[_0x250a('0x8')](_0x38d0a0,_0x227a5b)[_0x250a('0x9')](function(_0x1f7bd1){logger['info'](_0x250a('0xa'),_0x59e4ac,'request\x20sent');logger[_0x250a('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x59e4ac,'request\x20sent',JSON[_0x250a('0xc')](_0x1f7bd1));if(_0x1f7bd1['error']){if(_0x1f7bd1[_0x250a('0xd')][_0x250a('0xe')]===0x1f4){logger[_0x250a('0xd')](_0x250a('0xa'),_0x59e4ac,_0x1f7bd1[_0x250a('0xd')][_0x250a('0xf')]);return _0x5c644b(_0x1f7bd1[_0x250a('0xd')][_0x250a('0xf')]);}logger[_0x250a('0xd')](_0x250a('0xa'),_0x59e4ac,_0x1f7bd1['error'][_0x250a('0xf')]);return _0x52f79f(_0x1f7bd1['error'][_0x250a('0xf')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x59e4ac,_0x250a('0x10'));_0x52f79f(_0x1f7bd1[_0x250a('0x11')][_0x250a('0xf')]);}})['catch'](function(_0x10cbda){logger[_0x250a('0xd')](_0x250a('0xa'),_0x59e4ac,_0x10cbda);_0x5c644b(_0x10cbda);});});} \ No newline at end of file +var _0x4f3f=['../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x4f3f,0x6e));var _0xf4f3=function(_0x26e3a8,_0x2333cd){_0x26e3a8=_0x26e3a8-0x0;var _0x81f68d=_0x4f3f[_0x26e3a8];return _0x81f68d;};'use strict';var _=require(_0xf4f3('0x0'));var util=require(_0xf4f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf4f3('0x2'));var fs=require('fs');var Redis=require(_0xf4f3('0x3'));var db=require(_0xf4f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4f3('0x5'))(_0xf4f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xf4f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30e25d,_0x27d193,_0x5af369){return new BPromise(function(_0x2d8acc,_0x369b0c){return client[_0xf4f3('0x8')](_0x30e25d,_0x5af369)[_0xf4f3('0x9')](function(_0x4c118b){logger['info'](_0xf4f3('0xa'),_0x27d193,_0xf4f3('0xb'));logger[_0xf4f3('0xc')](_0xf4f3('0xd'),_0x27d193,_0xf4f3('0xb'),JSON['stringify'](_0x4c118b));if(_0x4c118b['error']){if(_0x4c118b[_0xf4f3('0xe')][_0xf4f3('0xf')]===0x1f4){logger['error'](_0xf4f3('0xa'),_0x27d193,_0x4c118b[_0xf4f3('0xe')][_0xf4f3('0x10')]);return _0x369b0c(_0x4c118b[_0xf4f3('0xe')][_0xf4f3('0x10')]);}logger['error'](_0xf4f3('0xa'),_0x27d193,_0x4c118b['error']['message']);return _0x2d8acc(_0x4c118b[_0xf4f3('0xe')][_0xf4f3('0x10')]);}else{logger['info'](_0xf4f3('0xa'),_0x27d193,_0xf4f3('0xb'));_0x2d8acc(_0x4c118b[_0xf4f3('0x11')]['message']);}})[_0xf4f3('0x12')](function(_0x1ddfbc){logger['error'](_0xf4f3('0xa'),_0x27d193,_0x1ddfbc);_0x369b0c(_0x1ddfbc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 330e5d6..99e5459 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 _0xb9b8=['/:id','isAuthenticated','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb9b8,0x7e));var _0x8b9b=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0xb9b8[_0x4c184d];return _0x23d997;};'use strict';var multer=require(_0x8b9b('0x0'));var util=require(_0x8b9b('0x1'));var path=require(_0x8b9b('0x2'));var timeout=require(_0x8b9b('0x3'));var express=require(_0x8b9b('0x4'));var router=express[_0x8b9b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8b9b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b9b('0x7'));var controller=require(_0x8b9b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8b9b('0x9')](_0x8b9b('0xa'),auth[_0x8b9b('0xb')](),controller[_0x8b9b('0xc')]);router[_0x8b9b('0xd')]('/',auth[_0x8b9b('0xb')](),controller[_0x8b9b('0xe')]);router['put'](_0x8b9b('0xa'),auth[_0x8b9b('0xb')](),controller[_0x8b9b('0xf')]);router[_0x8b9b('0x10')](_0x8b9b('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x372e=['update','delete','destroy','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','/:id'];(function(_0x16e5bc,_0x4209bf){var _0x267b1b=function(_0x170b0f){while(--_0x170b0f){_0x16e5bc['push'](_0x16e5bc['shift']());}};_0x267b1b(++_0x4209bf);}(_0x372e,0x9d));var _0xe372=function(_0xa9be61,_0x443e3c){_0xa9be61=_0xa9be61-0x0;var _0x54ea6a=_0x372e[_0xa9be61];return _0x54ea6a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe372('0x0')]();var fs_extra=require(_0xe372('0x1'));var auth=require(_0xe372('0x2'));var interaction=require(_0xe372('0x3'));var config=require(_0xe372('0x4'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xe372('0x5')](),controller[_0xe372('0x6')]);router[_0xe372('0x7')]('/:id',auth[_0xe372('0x5')](),controller[_0xe372('0x8')]);router['post']('/',auth[_0xe372('0x5')](),controller[_0xe372('0x9')]);router['put'](_0xe372('0xa'),auth[_0xe372('0x5')](),controller[_0xe372('0xb')]);router[_0xe372('0xc')](_0xe372('0xa'),auth[_0xe372('0x5')](),controller[_0xe372('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 218de5c..6c8add3 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 _0xc266=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xc266,0xd9));var _0x6c26=function(_0x314468,_0x2ee724){_0x314468=_0x314468-0x0;var _0xb8eb17=_0xc266[_0x314468];return _0xb8eb17;};'use strict';var Sequelize=require(_0x6c26('0x0'));module[_0x6c26('0x1')]={'type':{'type':Sequelize[_0x6c26('0x2')](_0x6c26('0x3'),'variable',_0x6c26('0x4'),_0x6c26('0x5'),_0x6c26('0x6')),'defaultValue':_0x6c26('0x3')},'content':{'type':Sequelize[_0x6c26('0x7')]},'key':{'type':Sequelize[_0x6c26('0x7')]},'keyType':{'type':Sequelize[_0x6c26('0x2')]('string',_0x6c26('0x8'),_0x6c26('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6c26('0x7')]},'nameField':{'type':Sequelize[_0x6c26('0x7')]},'customField':{'type':Sequelize[_0x6c26('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c26('0x7')]}}; \ No newline at end of file +var _0xd450=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd450,0x6f));var _0x0d45=function(_0x1500bf,_0x5246f0){_0x1500bf=_0x1500bf-0x0;var _0x41cbb2=_0xd450[_0x1500bf];return _0x41cbb2;};'use strict';var Sequelize=require('sequelize');module[_0x0d45('0x0')]={'type':{'type':Sequelize[_0x0d45('0x1')](_0x0d45('0x2'),_0x0d45('0x3'),_0x0d45('0x4'),_0x0d45('0x5'),_0x0d45('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0d45('0x7')]},'key':{'type':Sequelize[_0x0d45('0x7')]},'keyType':{'type':Sequelize[_0x0d45('0x1')](_0x0d45('0x2'),'variable',_0x0d45('0x4'))},'keyContent':{'type':Sequelize[_0x0d45('0x7')]},'idField':{'type':Sequelize[_0x0d45('0x7')]},'nameField':{'type':Sequelize[_0x0d45('0x7')]},'customField':{'type':Sequelize[_0x0d45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d45('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 118873c..583736f 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 _0x9a7d=['SugarcrmField','includeAll','include','rows','catch','show','params','length','create','body','find','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0xf03591,_0x26504c){var _0x25cd8e=function(_0x56bb13){while(--_0x56bb13){_0xf03591['push'](_0xf03591['shift']());}};_0x25cd8e(++_0x26504c);}(_0x9a7d,0x11f));var _0xd9a7=function(_0x5a96e6,_0x3595c1){_0x5a96e6=_0x5a96e6-0x0;var _0x29151d=_0x9a7d[_0x5a96e6];return _0x29151d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a7('0x1'));var moment=require(_0xd9a7('0x2'));var BPromise=require(_0xd9a7('0x3'));var Mustache=require(_0xd9a7('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd9a7('0x5'));var ejs=require(_0xd9a7('0x6'));var fs=require('fs');var fs_extra=require(_0xd9a7('0x7'));var _=require(_0xd9a7('0x8'));var squel=require(_0xd9a7('0x9'));var crypto=require(_0xd9a7('0xa'));var jsforce=require(_0xd9a7('0xb'));var deskjs=require(_0xd9a7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd9a7('0xd'));var Papa=require(_0xd9a7('0xe'));var Redis=require(_0xd9a7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd9a7('0x10'));var as=require(_0xd9a7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd9a7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd9a7('0x13'));var db=require(_0xd9a7('0x14'))['db'];function respondWithStatusCode(_0x215e59,_0x4de94a){_0x4de94a=_0x4de94a||0xcc;return function(_0x5b3e26){if(_0x5b3e26){return _0x215e59[_0xd9a7('0x15')](_0x4de94a);}return _0x215e59[_0xd9a7('0x16')](_0x4de94a)[_0xd9a7('0x17')]();};}function respondWithResult(_0x274ce8,_0xc6ad7e){_0xc6ad7e=_0xc6ad7e||0xc8;return function(_0x40a011){if(_0x40a011){return _0x274ce8[_0xd9a7('0x16')](_0xc6ad7e)[_0xd9a7('0x18')](_0x40a011);}};}function respondWithFilteredResult(_0x5d71b2,_0x39380e){return function(_0xc30f76){if(_0xc30f76){var _0x1fb89a=typeof _0x39380e['offset']==='undefined'&&typeof _0x39380e[_0xd9a7('0x19')]==='undefined';var _0x466079=_0xc30f76[_0xd9a7('0x1a')];var _0x25c4de=_0x1fb89a?0x0:_0x39380e[_0xd9a7('0x1b')];var _0x4aef00=_0x1fb89a?_0xc30f76[_0xd9a7('0x1a')]:_0x39380e[_0xd9a7('0x1b')]+_0x39380e[_0xd9a7('0x19')];var _0x2f00ca;if(_0x4aef00>=_0x466079){_0x4aef00=_0x466079;_0x2f00ca=0xc8;}else{_0x2f00ca=0xce;}_0x5d71b2[_0xd9a7('0x16')](_0x2f00ca);return _0x5d71b2['set']('Content-Range',_0x25c4de+'-'+_0x4aef00+'/'+_0x466079)[_0xd9a7('0x18')](_0xc30f76);}return null;};}function patchUpdates(_0x45fb7b){return function(_0x58caa1){try{jsonpatch['apply'](_0x58caa1,_0x45fb7b,!![]);}catch(_0x530c83){return BPromise[_0xd9a7('0x1c')](_0x530c83);}return _0x58caa1[_0xd9a7('0x1d')]();};}function saveUpdates(_0x42cb94,_0x553470){return function(_0x573ca7){if(_0x573ca7){return _0x573ca7[_0xd9a7('0x1e')](_0x42cb94)[_0xd9a7('0x1f')](function(_0xb745cb){return _0xb745cb;});}return null;};}function removeEntity(_0x506ba7,_0x4926fe){return function(_0x285ba6){if(_0x285ba6){return _0x285ba6[_0xd9a7('0x20')]()[_0xd9a7('0x1f')](function(){_0x506ba7[_0xd9a7('0x16')](0xcc)[_0xd9a7('0x17')]();});}};}function handleEntityNotFound(_0x4b74b8,_0x11dd2e){return function(_0x13da31){if(!_0x13da31){_0x4b74b8[_0xd9a7('0x15')](0x194);}return _0x13da31;};}function handleError(_0x2e3b2b,_0x4fda47){_0x4fda47=_0x4fda47||0x1f4;return function(_0x18e970){logger['error'](_0x18e970[_0xd9a7('0x21')]);if(_0x18e970[_0xd9a7('0x22')]){delete _0x18e970[_0xd9a7('0x22')];}_0x2e3b2b['status'](_0x4fda47)[_0xd9a7('0x23')](_0x18e970);};}exports[_0xd9a7('0x24')]=function(_0x50228d,_0x46adaf){var _0x2a7bc2={},_0x5ac74b={},_0x41ffe0={'count':0x0,'rows':[]};var _0x48e462=_['map'](db['SugarcrmField'][_0xd9a7('0x25')],function(_0x4c0f84){return{'name':_0x4c0f84[_0xd9a7('0x26')],'type':_0x4c0f84[_0xd9a7('0x27')][_0xd9a7('0x28')]};});_0x5ac74b[_0xd9a7('0x29')]=_[_0xd9a7('0x2a')](_0x48e462,_0xd9a7('0x22'));_0x5ac74b['query']=_[_0xd9a7('0x2b')](_0x50228d[_0xd9a7('0x2c')]);_0x5ac74b[_0xd9a7('0x2d')]=_['intersection'](_0x5ac74b[_0xd9a7('0x29')],_0x5ac74b[_0xd9a7('0x2c')]);_0x2a7bc2[_0xd9a7('0x2e')]=_[_0xd9a7('0x2f')](_0x5ac74b[_0xd9a7('0x29')],qs[_0xd9a7('0x30')](_0x50228d[_0xd9a7('0x2c')][_0xd9a7('0x30')]));_0x2a7bc2[_0xd9a7('0x2e')]=_0x2a7bc2['attributes']['length']?_0x2a7bc2['attributes']:_0x5ac74b['model'];if(!_0x50228d[_0xd9a7('0x2c')]['hasOwnProperty'](_0xd9a7('0x31'))){_0x2a7bc2[_0xd9a7('0x19')]=qs[_0xd9a7('0x19')](_0x50228d[_0xd9a7('0x2c')][_0xd9a7('0x19')]);_0x2a7bc2[_0xd9a7('0x1b')]=qs[_0xd9a7('0x1b')](_0x50228d[_0xd9a7('0x2c')][_0xd9a7('0x1b')]);}_0x2a7bc2[_0xd9a7('0x32')]=qs[_0xd9a7('0x33')](_0x50228d[_0xd9a7('0x2c')]['sort']);_0x2a7bc2[_0xd9a7('0x34')]=qs[_0xd9a7('0x2d')](_[_0xd9a7('0x35')](_0x50228d[_0xd9a7('0x2c')],_0x5ac74b[_0xd9a7('0x2d')]),_0x48e462);if(_0x50228d[_0xd9a7('0x2c')][_0xd9a7('0x36')]){_0x2a7bc2['where']=_['merge'](_0x2a7bc2[_0xd9a7('0x34')],{'$or':_[_0xd9a7('0x2a')](_0x48e462,function(_0xf3f1c0){if(_0xf3f1c0[_0xd9a7('0x27')]!==_0xd9a7('0x37')){var _0x5e6b13={};_0x5e6b13[_0xf3f1c0[_0xd9a7('0x22')]]={'$like':'%'+_0x50228d[_0xd9a7('0x2c')][_0xd9a7('0x36')]+'%'};return _0x5e6b13;}})});}_0x2a7bc2=_[_0xd9a7('0x38')]({},_0x2a7bc2,_0x50228d[_0xd9a7('0x39')]);var _0x1a1bdd={'where':_0x2a7bc2[_0xd9a7('0x34')]};return db[_0xd9a7('0x3a')][_0xd9a7('0x1a')](_0x1a1bdd)[_0xd9a7('0x1f')](function(_0x337a04){_0x41ffe0[_0xd9a7('0x1a')]=_0x337a04;if(_0x50228d['query'][_0xd9a7('0x3b')]){_0x2a7bc2[_0xd9a7('0x3c')]=[{'all':!![]}];}return db[_0xd9a7('0x3a')]['findAll'](_0x2a7bc2);})[_0xd9a7('0x1f')](function(_0x2a0a5b){_0x41ffe0[_0xd9a7('0x3d')]=_0x2a0a5b;return _0x41ffe0;})[_0xd9a7('0x1f')](respondWithFilteredResult(_0x46adaf,_0x2a7bc2))[_0xd9a7('0x3e')](handleError(_0x46adaf,null));};exports[_0xd9a7('0x3f')]=function(_0x2a9591,_0x4e913f){var _0x3cf999={'raw':!![],'where':{'id':_0x2a9591[_0xd9a7('0x40')]['id']}},_0xff87cb={};_0xff87cb[_0xd9a7('0x29')]=_['keys'](db[_0xd9a7('0x3a')][_0xd9a7('0x25')]);_0xff87cb['query']=_[_0xd9a7('0x2b')](_0x2a9591['query']);_0xff87cb[_0xd9a7('0x2d')]=_[_0xd9a7('0x2f')](_0xff87cb['model'],_0xff87cb[_0xd9a7('0x2c')]);_0x3cf999[_0xd9a7('0x2e')]=_[_0xd9a7('0x2f')](_0xff87cb[_0xd9a7('0x29')],qs[_0xd9a7('0x30')](_0x2a9591[_0xd9a7('0x2c')][_0xd9a7('0x30')]));_0x3cf999['attributes']=_0x3cf999[_0xd9a7('0x2e')][_0xd9a7('0x41')]?_0x3cf999[_0xd9a7('0x2e')]:_0xff87cb['model'];if(_0x2a9591[_0xd9a7('0x2c')][_0xd9a7('0x3b')]){_0x3cf999[_0xd9a7('0x3c')]=[{'all':!![]}];}_0x3cf999=_[_0xd9a7('0x38')]({},_0x3cf999,_0x2a9591['options']);return db[_0xd9a7('0x3a')]['find'](_0x3cf999)[_0xd9a7('0x1f')](handleEntityNotFound(_0x4e913f,null))[_0xd9a7('0x1f')](respondWithResult(_0x4e913f,null))[_0xd9a7('0x3e')](handleError(_0x4e913f,null));};exports['create']=function(_0x35ebeb,_0x1bea2d){return db['SugarcrmField'][_0xd9a7('0x42')](_0x35ebeb[_0xd9a7('0x43')],{})[_0xd9a7('0x1f')](respondWithResult(_0x1bea2d,0xc9))[_0xd9a7('0x3e')](handleError(_0x1bea2d,null));};exports[_0xd9a7('0x1e')]=function(_0x1715b7,_0x387d8a){if(_0x1715b7[_0xd9a7('0x43')]['id']){delete _0x1715b7[_0xd9a7('0x43')]['id'];}return db[_0xd9a7('0x3a')][_0xd9a7('0x44')]({'where':{'id':_0x1715b7[_0xd9a7('0x40')]['id']}})[_0xd9a7('0x1f')](handleEntityNotFound(_0x387d8a,null))['then'](saveUpdates(_0x1715b7[_0xd9a7('0x43')],null))['then'](respondWithResult(_0x387d8a,null))[_0xd9a7('0x3e')](handleError(_0x387d8a,null));};exports[_0xd9a7('0x20')]=function(_0x19355b,_0x54ed57){return db[_0xd9a7('0x3a')][_0xd9a7('0x44')]({'where':{'id':_0x19355b[_0xd9a7('0x40')]['id']}})[_0xd9a7('0x1f')](handleEntityNotFound(_0x54ed57,null))[_0xd9a7('0x1f')](removeEntity(_0x54ed57,null))['catch'](handleError(_0x54ed57,null));}; \ No newline at end of file +var _0x4c2c=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','includeAll','include','rows','show','params','keys','find','catch','create','update'];(function(_0x2d85f7,_0x1e165d){var _0x20a35e=function(_0x337978){while(--_0x337978){_0x2d85f7['push'](_0x2d85f7['shift']());}};_0x20a35e(++_0x1e165d);}(_0x4c2c,0x18c));var _0xc4c2=function(_0x3c62ef,_0x4bb6ab){_0x3c62ef=_0x3c62ef-0x0;var _0x4d44f1=_0x4c2c[_0x3c62ef];return _0x4d44f1;};'use strict';var emlformat=require(_0xc4c2('0x0'));var rimraf=require(_0xc4c2('0x1'));var zipdir=require(_0xc4c2('0x2'));var jsonpatch=require(_0xc4c2('0x3'));var rp=require(_0xc4c2('0x4'));var moment=require(_0xc4c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4c2('0x6'));var util=require(_0xc4c2('0x7'));var path=require('path');var sox=require(_0xc4c2('0x8'));var csv=require(_0xc4c2('0x9'));var ejs=require(_0xc4c2('0xa'));var fs=require('fs');var fs_extra=require(_0xc4c2('0xb'));var _=require(_0xc4c2('0xc'));var squel=require(_0xc4c2('0xd'));var crypto=require(_0xc4c2('0xe'));var jsforce=require(_0xc4c2('0xf'));var deskjs=require(_0xc4c2('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4c2('0x11'));var Redis=require(_0xc4c2('0x12'));var authService=require(_0xc4c2('0x13'));var qs=require(_0xc4c2('0x14'));var as=require(_0xc4c2('0x15'));var hardwareService=require(_0xc4c2('0x16'));var logger=require(_0xc4c2('0x17'))('api');var utils=require(_0xc4c2('0x18'));var config=require(_0xc4c2('0x19'));var licenseUtil=require(_0xc4c2('0x1a'));var db=require(_0xc4c2('0x1b'))['db'];function respondWithStatusCode(_0x594b4b,_0x386946){_0x386946=_0x386946||0xcc;return function(_0x4425ac){if(_0x4425ac){return _0x594b4b['sendStatus'](_0x386946);}return _0x594b4b[_0xc4c2('0x1c')](_0x386946)['end']();};}function respondWithResult(_0x5db9b3,_0x12a7de){_0x12a7de=_0x12a7de||0xc8;return function(_0x4869fa){if(_0x4869fa){return _0x5db9b3[_0xc4c2('0x1c')](_0x12a7de)['json'](_0x4869fa);}};}function respondWithFilteredResult(_0x202c90,_0x22b7b0){return function(_0x82de92){if(_0x82de92){var _0xcdfe36=typeof _0x22b7b0['offset']===_0xc4c2('0x1d')&&typeof _0x22b7b0[_0xc4c2('0x1e')]===_0xc4c2('0x1d');var _0x1bcbb5=_0x82de92[_0xc4c2('0x1f')];var _0x598e34=_0xcdfe36?0x0:_0x22b7b0['offset'];var _0x4fc44c=_0xcdfe36?_0x82de92[_0xc4c2('0x1f')]:_0x22b7b0[_0xc4c2('0x20')]+_0x22b7b0['limit'];var _0x416adf;if(_0x4fc44c>=_0x1bcbb5){_0x4fc44c=_0x1bcbb5;_0x416adf=0xc8;}else{_0x416adf=0xce;}_0x202c90['status'](_0x416adf);return _0x202c90[_0xc4c2('0x21')](_0xc4c2('0x22'),_0x598e34+'-'+_0x4fc44c+'/'+_0x1bcbb5)[_0xc4c2('0x23')](_0x82de92);}return null;};}function patchUpdates(_0x3c4e5f){return function(_0x4ca758){try{jsonpatch[_0xc4c2('0x24')](_0x4ca758,_0x3c4e5f,!![]);}catch(_0x2fba84){return BPromise[_0xc4c2('0x25')](_0x2fba84);}return _0x4ca758[_0xc4c2('0x26')]();};}function saveUpdates(_0x4d6ea,_0x257b14){return function(_0xd5256f){if(_0xd5256f){return _0xd5256f['update'](_0x4d6ea)[_0xc4c2('0x27')](function(_0x22fd3d){return _0x22fd3d;});}return null;};}function removeEntity(_0x1d507a,_0x3279c4){return function(_0x1cc03c){if(_0x1cc03c){return _0x1cc03c[_0xc4c2('0x28')]()[_0xc4c2('0x27')](function(){_0x1d507a[_0xc4c2('0x1c')](0xcc)[_0xc4c2('0x29')]();});}};}function handleEntityNotFound(_0xd10a1c,_0x5cb049){return function(_0x2848d8){if(!_0x2848d8){_0xd10a1c[_0xc4c2('0x2a')](0x194);}return _0x2848d8;};}function handleError(_0x1e20a2,_0x1e5c6f){_0x1e5c6f=_0x1e5c6f||0x1f4;return function(_0x68a967){logger[_0xc4c2('0x2b')](_0x68a967[_0xc4c2('0x2c')]);if(_0x68a967[_0xc4c2('0x2d')]){delete _0x68a967[_0xc4c2('0x2d')];}_0x1e20a2['status'](_0x1e5c6f)['send'](_0x68a967);};}exports[_0xc4c2('0x2e')]=function(_0x1508c0,_0x49d7a0){var _0x4569cb={},_0x51f37d={},_0x4a0dc8={'count':0x0,'rows':[]};var _0x809271=_['map'](db['SugarcrmField'][_0xc4c2('0x2f')],function(_0x35f0a7){return{'name':_0x35f0a7[_0xc4c2('0x30')],'type':_0x35f0a7[_0xc4c2('0x31')][_0xc4c2('0x32')]};});_0x51f37d['model']=_['map'](_0x809271,_0xc4c2('0x2d'));_0x51f37d['query']=_['keys'](_0x1508c0['query']);_0x51f37d[_0xc4c2('0x33')]=_[_0xc4c2('0x34')](_0x51f37d[_0xc4c2('0x35')],_0x51f37d[_0xc4c2('0x36')]);_0x4569cb['attributes']=_[_0xc4c2('0x34')](_0x51f37d['model'],qs[_0xc4c2('0x37')](_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x37')]));_0x4569cb[_0xc4c2('0x38')]=_0x4569cb[_0xc4c2('0x38')][_0xc4c2('0x39')]?_0x4569cb['attributes']:_0x51f37d[_0xc4c2('0x35')];if(!_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x3a')]('nolimit')){_0x4569cb[_0xc4c2('0x1e')]=qs[_0xc4c2('0x1e')](_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x1e')]);_0x4569cb['offset']=qs[_0xc4c2('0x20')](_0x1508c0['query']['offset']);}_0x4569cb[_0xc4c2('0x3b')]=qs[_0xc4c2('0x3c')](_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x3c')]);_0x4569cb['where']=qs['filters'](_[_0xc4c2('0x3d')](_0x1508c0[_0xc4c2('0x36')],_0x51f37d['filters']),_0x809271);if(_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x3e')]){_0x4569cb[_0xc4c2('0x3f')]=_[_0xc4c2('0x40')](_0x4569cb[_0xc4c2('0x3f')],{'$or':_['map'](_0x809271,function(_0x14e624){if(_0x14e624['type']!==_0xc4c2('0x41')){var _0x4fc8b5={};_0x4fc8b5[_0x14e624[_0xc4c2('0x2d')]]={'$like':'%'+_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x3e')]+'%'};return _0x4fc8b5;}})});}_0x4569cb=_[_0xc4c2('0x40')]({},_0x4569cb,_0x1508c0[_0xc4c2('0x42')]);var _0x4e10a1={'where':_0x4569cb[_0xc4c2('0x3f')]};return db[_0xc4c2('0x43')][_0xc4c2('0x1f')](_0x4e10a1)[_0xc4c2('0x27')](function(_0x5358e3){_0x4a0dc8[_0xc4c2('0x1f')]=_0x5358e3;if(_0x1508c0[_0xc4c2('0x36')][_0xc4c2('0x44')]){_0x4569cb[_0xc4c2('0x45')]=[{'all':!![]}];}return db[_0xc4c2('0x43')]['findAll'](_0x4569cb);})[_0xc4c2('0x27')](function(_0x5226de){_0x4a0dc8[_0xc4c2('0x46')]=_0x5226de;return _0x4a0dc8;})[_0xc4c2('0x27')](respondWithFilteredResult(_0x49d7a0,_0x4569cb))['catch'](handleError(_0x49d7a0,null));};exports[_0xc4c2('0x47')]=function(_0x4777e0,_0x52ff03){var _0x1d70de={'raw':!![],'where':{'id':_0x4777e0[_0xc4c2('0x48')]['id']}},_0x5348a6={};_0x5348a6[_0xc4c2('0x35')]=_[_0xc4c2('0x49')](db[_0xc4c2('0x43')][_0xc4c2('0x2f')]);_0x5348a6['query']=_['keys'](_0x4777e0['query']);_0x5348a6[_0xc4c2('0x33')]=_[_0xc4c2('0x34')](_0x5348a6[_0xc4c2('0x35')],_0x5348a6['query']);_0x1d70de[_0xc4c2('0x38')]=_[_0xc4c2('0x34')](_0x5348a6[_0xc4c2('0x35')],qs[_0xc4c2('0x37')](_0x4777e0['query'][_0xc4c2('0x37')]));_0x1d70de['attributes']=_0x1d70de['attributes'][_0xc4c2('0x39')]?_0x1d70de[_0xc4c2('0x38')]:_0x5348a6[_0xc4c2('0x35')];if(_0x4777e0[_0xc4c2('0x36')][_0xc4c2('0x44')]){_0x1d70de[_0xc4c2('0x45')]=[{'all':!![]}];}_0x1d70de=_[_0xc4c2('0x40')]({},_0x1d70de,_0x4777e0[_0xc4c2('0x42')]);return db[_0xc4c2('0x43')][_0xc4c2('0x4a')](_0x1d70de)['then'](handleEntityNotFound(_0x52ff03,null))[_0xc4c2('0x27')](respondWithResult(_0x52ff03,null))[_0xc4c2('0x4b')](handleError(_0x52ff03,null));};exports['create']=function(_0x1d369d,_0x23ef0c){return db['SugarcrmField'][_0xc4c2('0x4c')](_0x1d369d['body'],{})[_0xc4c2('0x27')](respondWithResult(_0x23ef0c,0xc9))['catch'](handleError(_0x23ef0c,null));};exports[_0xc4c2('0x4d')]=function(_0x1522c2,_0x249ab0){if(_0x1522c2[_0xc4c2('0x4e')]['id']){delete _0x1522c2[_0xc4c2('0x4e')]['id'];}return db['SugarcrmField'][_0xc4c2('0x4a')]({'where':{'id':_0x1522c2[_0xc4c2('0x48')]['id']}})[_0xc4c2('0x27')](handleEntityNotFound(_0x249ab0,null))[_0xc4c2('0x27')](saveUpdates(_0x1522c2['body'],null))[_0xc4c2('0x27')](respondWithResult(_0x249ab0,null))[_0xc4c2('0x4b')](handleError(_0x249ab0,null));};exports[_0xc4c2('0x28')]=function(_0x24837d,_0x19170a){return db['SugarcrmField']['find']({'where':{'id':_0x24837d[_0xc4c2('0x48')]['id']}})[_0xc4c2('0x27')](handleEntityNotFound(_0x19170a,null))['then'](removeEntity(_0x19170a,null))['catch'](handleError(_0x19170a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6cfd1d0..3feacf4 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 _0x376e=['../../config/environment','SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc0da83,_0x593052){var _0x3e2841=function(_0x274495){while(--_0x274495){_0xc0da83['push'](_0xc0da83['shift']());}};_0x3e2841(++_0x593052);}(_0x376e,0xfb));var _0xe376=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x376e[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xe376('0x0'));var util=require(_0xe376('0x1'));var logger=require(_0xe376('0x2'))(_0xe376('0x3'));var moment=require(_0xe376('0x4'));var BPromise=require(_0xe376('0x5'));var rp=require(_0xe376('0x6'));var fs=require('fs');var path=require(_0xe376('0x7'));var rimraf=require(_0xe376('0x8'));var config=require(_0xe376('0x9'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x435bfa,_0x32ece6){return _0x435bfa['define'](_0xe376('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe376('0xb'),'fields':[_0xe376('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5819=['exports','define','int_sugarcrm_fields','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5819,0x1c0));var _0x9581=function(_0x2e0bd5,_0x55fdfa){_0x2e0bd5=_0x2e0bd5-0x0;var _0x2dd7ff=_0x5819[_0x2e0bd5];return _0x2dd7ff;};'use strict';var _=require(_0x9581('0x0'));var util=require(_0x9581('0x1'));var logger=require('../../config/logger')(_0x9581('0x2'));var moment=require(_0x9581('0x3'));var BPromise=require(_0x9581('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9581('0x5'));var rimraf=require(_0x9581('0x6'));var config=require(_0x9581('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x9581('0x8')]=function(_0x415cdb,_0x33dc0f){return _0x415cdb[_0x9581('0x9')]('SugarcrmField',attributes,{'tableName':_0x9581('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x9581('0xb')],'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 527e4c3..8a429fa 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 _0x620d=['ioredis','../../config/logger','../../config/environment','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x516975,_0x5e4660){var _0x5c1b6f=function(_0x45de90){while(--_0x45de90){_0x516975['push'](_0x516975['shift']());}};_0x5c1b6f(++_0x5e4660);}(_0x620d,0x166));var _0xd620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd620('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd620('0x1'));var rs=require(_0xd620('0x2'));var fs=require('fs');var Redis=require(_0xd620('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd620('0x4'))('rpc');var config=require(_0xd620('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd620('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d49cd,_0x3ec72a,_0x458b11){return new BPromise(function(_0x5a6b79,_0x462840){return client[_0xd620('0x7')](_0x1d49cd,_0x458b11)['then'](function(_0x4f3082){logger[_0xd620('0x8')](_0xd620('0x9'),_0x3ec72a,_0xd620('0xa'));logger[_0xd620('0xb')](_0xd620('0xc'),_0x3ec72a,_0xd620('0xa'),JSON[_0xd620('0xd')](_0x4f3082));if(_0x4f3082[_0xd620('0xe')]){if(_0x4f3082[_0xd620('0xe')][_0xd620('0xf')]===0x1f4){logger[_0xd620('0xe')](_0xd620('0x9'),_0x3ec72a,_0x4f3082[_0xd620('0xe')][_0xd620('0x10')]);return _0x462840(_0x4f3082[_0xd620('0xe')][_0xd620('0x10')]);}logger['error'](_0xd620('0x9'),_0x3ec72a,_0x4f3082[_0xd620('0xe')]['message']);return _0x5a6b79(_0x4f3082['error']['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x3ec72a,'request\x20sent');_0x5a6b79(_0x4f3082[_0xd620('0x11')][_0xd620('0x10')]);}})[_0xd620('0x12')](function(_0x18a68c){logger[_0xd620('0xe')](_0xd620('0x9'),_0x3ec72a,_0x18a68c);_0x462840(_0x18a68c);});});} \ No newline at end of file +var _0x5154=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x5154,0x14d));var _0x4515=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5154[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4515('0x0'));var BPromise=require(_0x4515('0x1'));var rs=require(_0x4515('0x2'));var fs=require('fs');var Redis=require(_0x4515('0x3'));var db=require(_0x4515('0x4'))['db'];var utils=require(_0x4515('0x5'));var logger=require(_0x4515('0x6'))(_0x4515('0x7'));var config=require(_0x4515('0x8'));var jayson=require(_0x4515('0x9'));var client=jayson[_0x4515('0xa')][_0x4515('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0ec87,_0x2bd7f0,_0x3ad31d){return new BPromise(function(_0x4f832d,_0xd48cbd){return client['request'](_0xa0ec87,_0x3ad31d)[_0x4515('0xc')](function(_0x18e31a){logger[_0x4515('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2bd7f0,_0x4515('0xe'));logger['debug'](_0x4515('0xf'),_0x2bd7f0,'request\x20sent',JSON['stringify'](_0x18e31a));if(_0x18e31a['error']){if(_0x18e31a[_0x4515('0x10')][_0x4515('0x11')]===0x1f4){logger[_0x4515('0x10')](_0x4515('0x12'),_0x2bd7f0,_0x18e31a['error']['message']);return _0xd48cbd(_0x18e31a[_0x4515('0x10')][_0x4515('0x13')]);}logger[_0x4515('0x10')](_0x4515('0x12'),_0x2bd7f0,_0x18e31a['error'][_0x4515('0x13')]);return _0x4f832d(_0x18e31a[_0x4515('0x10')]['message']);}else{logger[_0x4515('0xd')](_0x4515('0x12'),_0x2bd7f0,_0x4515('0xe'));_0x4f832d(_0x18e31a[_0x4515('0x14')][_0x4515('0x13')]);}})[_0x4515('0x15')](function(_0x444a6e){logger[_0x4515('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2bd7f0,_0x444a6e);_0xd48cbd(_0x444a6e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4edc9c2..8658688 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 _0xa4fa=['/:id/configurations','getConfigurations','post','create','addConfiguration','/:id','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0xb6d3c1,_0x2222bb){var _0x6ce1ff=function(_0x35ef4f){while(--_0x35ef4f){_0xb6d3c1['push'](_0xb6d3c1['shift']());}};_0x6ce1ff(++_0x2222bb);}(_0xa4fa,0x1ca));var _0xaa4f=function(_0x2fc3ee,_0x56ab8c){_0x2fc3ee=_0x2fc3ee-0x0;var _0x2ad3f4=_0xa4fa[_0x2fc3ee];return _0x2ad3f4;};'use strict';var multer=require(_0xaa4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa4f('0x1'));var express=require(_0xaa4f('0x2'));var router=express['Router']();var fs_extra=require(_0xaa4f('0x3'));var auth=require(_0xaa4f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaa4f('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xaa4f('0x6')]('/',auth[_0xaa4f('0x7')](),controller[_0xaa4f('0x8')]);router[_0xaa4f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaa4f('0x9')]);router[_0xaa4f('0x6')](_0xaa4f('0xa'),auth[_0xaa4f('0x7')](),controller[_0xaa4f('0xb')]);router[_0xaa4f('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xaa4f('0xc')]('/',auth['isAuthenticated'](),controller[_0xaa4f('0xd')]);router[_0xaa4f('0xc')](_0xaa4f('0xa'),auth[_0xaa4f('0x7')](),controller[_0xaa4f('0xe')]);router['put'](_0xaa4f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xaa4f('0x10')]('/:id',auth[_0xaa4f('0x7')](),controller['destroy']);module[_0xaa4f('0x11')]=router; \ No newline at end of file +var _0x7b47=['post','create','addConfiguration','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields'];(function(_0x52fd3d,_0x3af718){var _0x49b06d=function(_0x2f4a2b){while(--_0x2f4a2b){_0x52fd3d['push'](_0x52fd3d['shift']());}};_0x49b06d(++_0x3af718);}(_0x7b47,0x118));var _0x77b4=function(_0x3d9518,_0x5d7944){_0x3d9518=_0x3d9518-0x0;var _0xa8fa67=_0x7b47[_0x3d9518];return _0xa8fa67;};'use strict';var multer=require('multer');var util=require(_0x77b4('0x0'));var path=require('path');var timeout=require(_0x77b4('0x1'));var express=require(_0x77b4('0x2'));var router=express[_0x77b4('0x3')]();var fs_extra=require(_0x77b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77b4('0x5'));var config=require('../../config/environment');var controller=require(_0x77b4('0x6'));router[_0x77b4('0x7')]('/',auth[_0x77b4('0x8')](),controller[_0x77b4('0x9')]);router[_0x77b4('0x7')](_0x77b4('0xa'),auth[_0x77b4('0x8')](),controller['show']);router[_0x77b4('0x7')](_0x77b4('0xb'),auth[_0x77b4('0x8')](),controller['getConfigurations']);router[_0x77b4('0x7')](_0x77b4('0xc'),auth[_0x77b4('0x8')](),controller[_0x77b4('0xd')]);router[_0x77b4('0xe')]('/',auth[_0x77b4('0x8')](),controller[_0x77b4('0xf')]);router[_0x77b4('0xe')](_0x77b4('0xb'),auth['isAuthenticated'](),controller[_0x77b4('0x10')]);router[_0x77b4('0x11')](_0x77b4('0xa'),auth[_0x77b4('0x8')](),controller['update']);router[_0x77b4('0x12')](_0x77b4('0xa'),auth[_0x77b4('0x8')](),controller[_0x77b4('0x13')]);module[_0x77b4('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 d804dbe..06a0232 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 _0xa4ae=['exports','STRING','HelpDesk','sequelize'];(function(_0x384470,_0x574338){var _0x383c51=function(_0x54edbb){while(--_0x54edbb){_0x384470['push'](_0x384470['shift']());}};_0x383c51(++_0x574338);}(_0xa4ae,0x1ab));var _0xea4a=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xa4ae[_0x5e8c32];return _0x595f7b;};'use strict';var Sequelize=require(_0xea4a('0x0'));module[_0xea4a('0x1')]={'name':{'type':Sequelize[_0xea4a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xea4a('0x2')],'allowNull':![],'defaultValue':_0xea4a('0x3')},'remoteUri':{'type':Sequelize[_0xea4a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xea4a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xea4a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf0e2=['STRING','HelpDesk','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf0e2,0x122));var _0x2f0e=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xf0e2[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require('sequelize');module[_0x2f0e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2f0e('0x1')]},'username':{'type':Sequelize[_0x2f0e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2f0e('0x1')],'allowNull':![],'defaultValue':_0x2f0e('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2f0e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 74c0b89..92cf49d 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 _0x4a1a=['squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','options','VtigerAccount','includeAll','findAll','catch','show','params','length','include','merge','create','body','find','destroy','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','reference','owner','remove','includes','editable','false','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','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x4a1a,0xe6));var _0xa4a1=function(_0x309e1e,_0x170d66){_0x309e1e=_0x309e1e-0x0;var _0x254a4a=_0x4a1a[_0x309e1e];return _0x254a4a;};'use strict';var emlformat=require(_0xa4a1('0x0'));var rimraf=require(_0xa4a1('0x1'));var zipdir=require(_0xa4a1('0x2'));var jsonpatch=require(_0xa4a1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4a1('0x4'));var path=require(_0xa4a1('0x5'));var sox=require(_0xa4a1('0x6'));var csv=require(_0xa4a1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4a1('0x8'));var _=require(_0xa4a1('0x9'));var squel=require(_0xa4a1('0xa'));var crypto=require(_0xa4a1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa4a1('0x7'));var querystring=require(_0xa4a1('0xc'));var Papa=require(_0xa4a1('0xd'));var Redis=require(_0xa4a1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa4a1('0xf'));var as=require(_0xa4a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4a1('0x11'))(_0xa4a1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4a1('0x13'))['db'];var integrations=require(_0xa4a1('0x14'));function respondWithStatusCode(_0x2139b7,_0x4de78d){_0x4de78d=_0x4de78d||0xcc;return function(_0x5c5917){if(_0x5c5917){return _0x2139b7['sendStatus'](_0x4de78d);}return _0x2139b7['status'](_0x4de78d)[_0xa4a1('0x15')]();};}function respondWithResult(_0x1cb6bf,_0x213074){_0x213074=_0x213074||0xc8;return function(_0x4b8ee0){if(_0x4b8ee0){return _0x1cb6bf[_0xa4a1('0x16')](_0x213074)[_0xa4a1('0x17')](_0x4b8ee0);}};}function respondWithFilteredResult(_0x4f3a7c,_0x188045){return function(_0x2d2085){if(_0x2d2085){var _0x503281=typeof _0x188045[_0xa4a1('0x18')]==='undefined'&&typeof _0x188045[_0xa4a1('0x19')]===_0xa4a1('0x1a');var _0x35dc6a=_0x2d2085[_0xa4a1('0x1b')];var _0x42ccd3=_0x503281?0x0:_0x188045[_0xa4a1('0x18')];var _0x67848d=_0x503281?_0x2d2085[_0xa4a1('0x1b')]:_0x188045[_0xa4a1('0x18')]+_0x188045[_0xa4a1('0x19')];var _0xaa977c;if(_0x67848d>=_0x35dc6a){_0x67848d=_0x35dc6a;_0xaa977c=0xc8;}else{_0xaa977c=0xce;}_0x4f3a7c[_0xa4a1('0x16')](_0xaa977c);return _0x4f3a7c['set'](_0xa4a1('0x1c'),_0x42ccd3+'-'+_0x67848d+'/'+_0x35dc6a)['json'](_0x2d2085);}return null;};}function patchUpdates(_0x16a270){return function(_0x195ec4){try{jsonpatch[_0xa4a1('0x1d')](_0x195ec4,_0x16a270,!![]);}catch(_0x3fa32a){return BPromise[_0xa4a1('0x1e')](_0x3fa32a);}return _0x195ec4[_0xa4a1('0x1f')]();};}function saveUpdates(_0x47c295,_0x1a0c97){return function(_0x503f23){if(_0x503f23){return _0x503f23[_0xa4a1('0x20')](_0x47c295)[_0xa4a1('0x21')](function(_0x44d361){return _0x44d361;});}return null;};}function removeEntity(_0x5cabdd,_0x5ae7f1){return function(_0x29cccf){if(_0x29cccf){return _0x29cccf['destroy']()[_0xa4a1('0x21')](function(){_0x5cabdd[_0xa4a1('0x16')](0xcc)[_0xa4a1('0x15')]();});}};}function handleEntityNotFound(_0x1f80d0,_0x549bd3){return function(_0x3e79bb){if(!_0x3e79bb){_0x1f80d0[_0xa4a1('0x22')](0x194);}return _0x3e79bb;};}function handleError(_0x417c98,_0x333d2d){_0x333d2d=_0x333d2d||0x1f4;return function(_0x18a7a6){logger['error'](_0x18a7a6['stack']);if(_0x18a7a6['name']){delete _0x18a7a6[_0xa4a1('0x23')];}_0x417c98[_0xa4a1('0x16')](_0x333d2d)[_0xa4a1('0x24')](_0x18a7a6);};}exports[_0xa4a1('0x25')]=function(_0x4717f6,_0x2769bc){var _0x519e44={},_0x139fd0={},_0x4afc20={'count':0x0,'rows':[]};var _0x2494cd=_[_0xa4a1('0x26')](db['VtigerAccount'][_0xa4a1('0x27')],function(_0x192e34){return{'name':_0x192e34[_0xa4a1('0x28')],'type':_0x192e34[_0xa4a1('0x29')][_0xa4a1('0x2a')]};});_0x139fd0[_0xa4a1('0x2b')]=_[_0xa4a1('0x26')](_0x2494cd,_0xa4a1('0x23'));_0x139fd0[_0xa4a1('0x2c')]=_[_0xa4a1('0x2d')](_0x4717f6['query']);_0x139fd0[_0xa4a1('0x2e')]=_[_0xa4a1('0x2f')](_0x139fd0[_0xa4a1('0x2b')],_0x139fd0[_0xa4a1('0x2c')]);_0x519e44[_0xa4a1('0x30')]=_[_0xa4a1('0x2f')](_0x139fd0[_0xa4a1('0x2b')],qs[_0xa4a1('0x31')](_0x4717f6['query'][_0xa4a1('0x31')]));_0x519e44[_0xa4a1('0x30')]=_0x519e44[_0xa4a1('0x30')]['length']?_0x519e44[_0xa4a1('0x30')]:_0x139fd0['model'];if(!_0x4717f6[_0xa4a1('0x2c')]['hasOwnProperty'](_0xa4a1('0x32'))){_0x519e44[_0xa4a1('0x19')]=qs[_0xa4a1('0x19')](_0x4717f6[_0xa4a1('0x2c')]['limit']);_0x519e44[_0xa4a1('0x18')]=qs[_0xa4a1('0x18')](_0x4717f6['query'][_0xa4a1('0x18')]);}_0x519e44[_0xa4a1('0x33')]=qs[_0xa4a1('0x34')](_0x4717f6[_0xa4a1('0x2c')]['sort']);_0x519e44[_0xa4a1('0x35')]=qs[_0xa4a1('0x2e')](_[_0xa4a1('0x36')](_0x4717f6[_0xa4a1('0x2c')],_0x139fd0['filters']),_0x2494cd);if(_0x4717f6[_0xa4a1('0x2c')][_0xa4a1('0x37')]){_0x519e44[_0xa4a1('0x35')]=_['merge'](_0x519e44[_0xa4a1('0x35')],{'$or':_[_0xa4a1('0x26')](_0x2494cd,function(_0x196283){if(_0x196283[_0xa4a1('0x29')]!=='VIRTUAL'){var _0x3c6eb9={};_0x3c6eb9[_0x196283[_0xa4a1('0x23')]]={'$like':'%'+_0x4717f6[_0xa4a1('0x2c')][_0xa4a1('0x37')]+'%'};return _0x3c6eb9;}})});}_0x519e44=_['merge']({},_0x519e44,_0x4717f6[_0xa4a1('0x38')]);var _0x1904ed={'where':_0x519e44[_0xa4a1('0x35')]};return db[_0xa4a1('0x39')][_0xa4a1('0x1b')](_0x1904ed)[_0xa4a1('0x21')](function(_0x38710f){_0x4afc20['count']=_0x38710f;if(_0x4717f6['query'][_0xa4a1('0x3a')]){_0x519e44['include']=[{'all':!![]}];}return db[_0xa4a1('0x39')][_0xa4a1('0x3b')](_0x519e44);})[_0xa4a1('0x21')](function(_0x3db4ec){_0x4afc20['rows']=_0x3db4ec;return _0x4afc20;})[_0xa4a1('0x21')](respondWithFilteredResult(_0x2769bc,_0x519e44))[_0xa4a1('0x3c')](handleError(_0x2769bc,null));};exports[_0xa4a1('0x3d')]=function(_0x51d012,_0x139d6b){var _0x5ac9c5={'raw':![],'where':{'id':_0x51d012[_0xa4a1('0x3e')]['id']}},_0x196872={};_0x196872[_0xa4a1('0x2b')]=_[_0xa4a1('0x2d')](db[_0xa4a1('0x39')]['rawAttributes']);_0x196872[_0xa4a1('0x2c')]=_[_0xa4a1('0x2d')](_0x51d012[_0xa4a1('0x2c')]);_0x196872[_0xa4a1('0x2e')]=_['intersection'](_0x196872[_0xa4a1('0x2b')],_0x196872[_0xa4a1('0x2c')]);_0x5ac9c5[_0xa4a1('0x30')]=_[_0xa4a1('0x2f')](_0x196872[_0xa4a1('0x2b')],qs[_0xa4a1('0x31')](_0x51d012[_0xa4a1('0x2c')][_0xa4a1('0x31')]));_0x5ac9c5[_0xa4a1('0x30')]=_0x5ac9c5['attributes'][_0xa4a1('0x3f')]?_0x5ac9c5['attributes']:_0x196872[_0xa4a1('0x2b')];if(_0x51d012['query']['includeAll']){_0x5ac9c5[_0xa4a1('0x40')]=[{'all':!![]}];}_0x5ac9c5=_[_0xa4a1('0x41')]({},_0x5ac9c5,_0x51d012[_0xa4a1('0x38')]);return db[_0xa4a1('0x39')]['find'](_0x5ac9c5)['then'](handleEntityNotFound(_0x139d6b,null))[_0xa4a1('0x21')](respondWithResult(_0x139d6b,null))[_0xa4a1('0x3c')](handleError(_0x139d6b,null));};exports[_0xa4a1('0x42')]=function(_0x3baaae,_0x5ab9bf){return db[_0xa4a1('0x39')][_0xa4a1('0x42')](_0x3baaae[_0xa4a1('0x43')],{})[_0xa4a1('0x21')](respondWithResult(_0x5ab9bf,0xc9))[_0xa4a1('0x3c')](handleError(_0x5ab9bf,null));};exports[_0xa4a1('0x20')]=function(_0x14c5cf,_0x301afc){if(_0x14c5cf['body']['id']){delete _0x14c5cf[_0xa4a1('0x43')]['id'];}return db[_0xa4a1('0x39')][_0xa4a1('0x44')]({'where':{'id':_0x14c5cf['params']['id']}})[_0xa4a1('0x21')](handleEntityNotFound(_0x301afc,null))[_0xa4a1('0x21')](saveUpdates(_0x14c5cf['body'],null))['then'](respondWithResult(_0x301afc,null))['catch'](handleError(_0x301afc,null));};exports[_0xa4a1('0x45')]=function(_0x27d0f7,_0x160555){return db[_0xa4a1('0x39')][_0xa4a1('0x44')]({'where':{'id':_0x27d0f7[_0xa4a1('0x3e')]['id']}})[_0xa4a1('0x21')](handleEntityNotFound(_0x160555,null))[_0xa4a1('0x21')](removeEntity(_0x160555,null))[_0xa4a1('0x3c')](handleError(_0x160555,null));};exports[_0xa4a1('0x46')]=function(_0x497d69,_0x1d6de3,_0x5d0301){var _0x416250={};var _0x4ea0a7={};var _0x31832a;var _0x1adb69;return db['VtigerAccount'][_0xa4a1('0x47')]({'where':{'id':_0x497d69[_0xa4a1('0x3e')]['id']}})[_0xa4a1('0x21')](handleEntityNotFound(_0x1d6de3,null))[_0xa4a1('0x21')](function(_0x5b009f){if(_0x5b009f){_0x31832a=_0x5b009f;_0x4ea0a7['model']=_[_0xa4a1('0x2d')](db['VtigerConfiguration'][_0xa4a1('0x27')]);_0x4ea0a7[_0xa4a1('0x2c')]=_[_0xa4a1('0x2d')](_0x497d69[_0xa4a1('0x2c')]);_0x4ea0a7[_0xa4a1('0x2e')]=_[_0xa4a1('0x2f')](_0x4ea0a7['model'],_0x4ea0a7[_0xa4a1('0x2c')]);_0x416250[_0xa4a1('0x30')]=_['intersection'](_0x4ea0a7['model'],qs[_0xa4a1('0x31')](_0x497d69[_0xa4a1('0x2c')][_0xa4a1('0x31')]));_0x416250[_0xa4a1('0x30')]=_0x416250[_0xa4a1('0x30')][_0xa4a1('0x3f')]?_0x416250[_0xa4a1('0x30')]:_0x4ea0a7[_0xa4a1('0x2b')];_0x416250[_0xa4a1('0x33')]=qs['sort'](_0x497d69[_0xa4a1('0x2c')]['sort']);_0x416250[_0xa4a1('0x35')]=qs[_0xa4a1('0x2e')](_[_0xa4a1('0x36')](_0x497d69[_0xa4a1('0x2c')],_0x4ea0a7[_0xa4a1('0x2e')]));if(_0x497d69[_0xa4a1('0x2c')][_0xa4a1('0x37')]){_0x416250[_0xa4a1('0x35')]=_[_0xa4a1('0x41')](_0x416250[_0xa4a1('0x35')],{'$or':_['map'](_0x416250['attributes'],function(_0x4e022b){var _0x5acae5={};_0x5acae5[_0x4e022b]={'$like':'%'+_0x497d69['query'][_0xa4a1('0x37')]+'%'};return _0x5acae5;})});}_0x416250=_[_0xa4a1('0x41')]({},_0x416250,_0x497d69[_0xa4a1('0x38')]);return _0x31832a[_0xa4a1('0x46')](_0x416250);}})[_0xa4a1('0x21')](function(_0x299d6d){if(_0x299d6d){_0x1adb69=_0x299d6d[_0xa4a1('0x3f')];if(!_0x497d69[_0xa4a1('0x2c')][_0xa4a1('0x48')](_0xa4a1('0x32'))){_0x416250['limit']=qs[_0xa4a1('0x19')](_0x497d69[_0xa4a1('0x2c')][_0xa4a1('0x19')]);_0x416250[_0xa4a1('0x18')]=qs[_0xa4a1('0x18')](_0x497d69[_0xa4a1('0x2c')][_0xa4a1('0x18')]);}return _0x31832a[_0xa4a1('0x46')](_0x416250);}})[_0xa4a1('0x21')](function(_0x26a0b0){if(_0x26a0b0){return _0x26a0b0?{'count':_0x1adb69,'rows':_0x26a0b0}:null;}})[_0xa4a1('0x21')](respondWithResult(_0x1d6de3,null))['catch'](handleError(_0x1d6de3,null));};exports[_0xa4a1('0x49')]=function(_0x4e1e3c,_0x5cd766,_0xc024d){if(_0x4e1e3c[_0xa4a1('0x43')]['id']){delete _0x4e1e3c[_0xa4a1('0x43')]['id'];}return db[_0xa4a1('0x39')][_0xa4a1('0x47')]({'where':{'id':_0x4e1e3c['params']['id']}})[_0xa4a1('0x21')](handleEntityNotFound(_0x5cd766,null))[_0xa4a1('0x21')](function(_0x431b56){if(_0x431b56){_0x4e1e3c[_0xa4a1('0x43')]['AccountId']=_0x431b56['id'];_0x4e1e3c[_0xa4a1('0x43')][_0xa4a1('0x4a')]=integrations[_0xa4a1('0x4b')](_0x4e1e3c[_0xa4a1('0x43')][_0xa4a1('0x4c')],_0x4e1e3c['body'][_0xa4a1('0x29')]);_0x4e1e3c[_0xa4a1('0x43')]['Descriptions']=integrations[_0xa4a1('0x4d')](_0x4e1e3c[_0xa4a1('0x43')][_0xa4a1('0x4c')],_0x4e1e3c['body'][_0xa4a1('0x29')]);return db[_0xa4a1('0x4e')][_0xa4a1('0x42')](_0x4e1e3c[_0xa4a1('0x43')],{'include':[{'model':db[_0xa4a1('0x4f')],'as':_0xa4a1('0x4a')},{'model':db['VtigerField'],'as':_0xa4a1('0x50')}]});}return null;})[_0xa4a1('0x21')](respondWithResult(_0x5cd766,null))[_0xa4a1('0x3c')](handleError(_0x5cd766,null));};var md5=require(_0xa4a1('0x51'));exports['getFields']=function(_0x43fe6a,_0x5940b9,_0x46e2dc){var _0x6a5727=null;var _0x36306a=null;var _0x131e5f=null;var _0x4a756a=null;var _0x2c2cb1='';return db[_0xa4a1('0x39')]['findOne']({'where':{'id':_0x43fe6a[_0xa4a1('0x3e')]['id']},'attributes':['id',_0xa4a1('0x23'),'username',_0xa4a1('0x52'),_0xa4a1('0x53'),_0xa4a1('0x54'),_0xa4a1('0x55'),_0xa4a1('0x56')]})[_0xa4a1('0x21')](handleEntityNotFound(_0x5940b9,null))[_0xa4a1('0x21')](function(_0x34d5b4){if(_0x34d5b4){_0x6a5727=_0x34d5b4[_0xa4a1('0x57')];_0x36306a=_0x34d5b4['accessKey'];_0x131e5f=_0x34d5b4[_0xa4a1('0x53')];_0x2c2cb1=_0x34d5b4[_0xa4a1('0x54')];var _0x2b08db=_0x2c2cb1[_0xa4a1('0x58')](-0x1);if(_0x2b08db==='/'){_0x2c2cb1=_0x2c2cb1[_0xa4a1('0x59')](0x0,_0x2c2cb1[_0xa4a1('0x5a')](_0x2b08db));}_0x4a756a=util[_0xa4a1('0x5b')](_0xa4a1('0x5c'),_0x2c2cb1);var _0x5b357b={'method':_0xa4a1('0x5d'),'uri':_0x4a756a,'qs':{'operation':_0xa4a1('0x5e'),'username':_0x34d5b4['username']},'json':!![]};return rp(_0x5b357b);}})['then'](function(_0x38a213){if(_0x38a213[_0xa4a1('0x5f')]){var _0x27f945={'method':_0xa4a1('0x60'),'uri':_0x4a756a,'form':{'operation':_0xa4a1('0x61'),'username':_0x6a5727,'accessKey':md5(_0x38a213[_0xa4a1('0x62')]['token']+_0x36306a)},'json':!![]};return rp(_0x27f945);}})[_0xa4a1('0x21')](function(_0x67f629){if(_0x67f629['success']){var _0x56deec={'method':'GET','uri':_0x4a756a,'qs':{'operation':_0xa4a1('0x63'),'username':_0x6a5727,'sessionName':_0x67f629[_0xa4a1('0x62')]['sessionName'],'elementType':_0x131e5f},'json':!![]};return rp(_0x56deec);}})['then'](function(_0x31b4e3){if(_0x31b4e3[_0xa4a1('0x5f')]){var _0x54a634=['autogenerated',_0xa4a1('0x64'),_0xa4a1('0x65')];_[_0xa4a1('0x66')](_0x31b4e3[_0xa4a1('0x62')][_0xa4a1('0x31')],function(_0xdacf91){return _0x54a634[_0xa4a1('0x67')](_0xdacf91[_0xa4a1('0x29')][_0xa4a1('0x23')]);});_[_0xa4a1('0x66')](_0x31b4e3['result'][_0xa4a1('0x31')],function(_0x3672fe){return _0x3672fe[_0xa4a1('0x68')]===_0xa4a1('0x69');});return{'count':_0x31b4e3[_0xa4a1('0x62')][_0xa4a1('0x31')][_0xa4a1('0x3f')],'rows':_[_0xa4a1('0x26')](_0x31b4e3[_0xa4a1('0x62')][_0xa4a1('0x31')],function(_0x1dc6db){return{'id':_0x1dc6db[_0xa4a1('0x23')],'name':_0x1dc6db[_0xa4a1('0x6a')],'custom':_[_0xa4a1('0x6b')](_0x1dc6db[_0xa4a1('0x23')],_0xa4a1('0x6c'))?!![]:![],'options':_0x1dc6db['type']['name']===_0xa4a1('0x6d')&&_0x1dc6db[_0xa4a1('0x29')][_0xa4a1('0x6e')]['length']>0x0?_[_0xa4a1('0x26')](_0x1dc6db[_0xa4a1('0x29')][_0xa4a1('0x6e')],function(_0x5ef94f){return{'name':_0x5ef94f[_0xa4a1('0x6a')],'value':_0x5ef94f[_0xa4a1('0x6f')]};}):[]};})};}})[_0xa4a1('0x21')](respondWithResult(_0x5940b9,null))[_0xa4a1('0x3c')](function(_0x344106){console[_0xa4a1('0x70')](_0xa4a1('0x71')+_0x344106);var _0x1f4059=_0x43fe6a['query'][_0xa4a1('0x72')]?0x1f4:_0x344106[_0xa4a1('0x73')]||0x1f4;logger[_0xa4a1('0x74')](_0xa4a1('0x75'),'getFields',_0x1f4059,JSON[_0xa4a1('0x76')](_0x344106));delete _0x344106[_0xa4a1('0x23')];if(_0x1f4059===0x191){_0x1f4059=0x190;}_0x5940b9[_0xa4a1('0x16')](_0x1f4059)['send'](_0x43fe6a[_0xa4a1('0x2c')][_0xa4a1('0x72')]?{'message':_0xa4a1('0x77'),'statusCode':_0x344106[_0xa4a1('0x73')]}:_0x344106);});}; \ No newline at end of file +var _0x3578=['includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','update','getConfigurations','findOne','VtigerConfiguration','order','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerField','description','moduleName','remoteUri','username','slice','substring','format','%s/webservice.php','GET','success','POST','result','reference','remove','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options'];(function(_0x4af43a,_0x19ceae){var _0x31b7db=function(_0x2ae272){while(--_0x2ae272){_0x4af43a['push'](_0x4af43a['shift']());}};_0x31b7db(++_0x19ceae);}(_0x3578,0x18f));var _0x8357=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x3578[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0x8357('0x0'));var rimraf=require(_0x8357('0x1'));var zipdir=require(_0x8357('0x2'));var jsonpatch=require(_0x8357('0x3'));var rp=require('request-promise');var moment=require(_0x8357('0x4'));var BPromise=require(_0x8357('0x5'));var Mustache=require(_0x8357('0x6'));var util=require(_0x8357('0x7'));var path=require(_0x8357('0x8'));var sox=require('sox');var csv=require(_0x8357('0x9'));var ejs=require(_0x8357('0xa'));var fs=require('fs');var fs_extra=require(_0x8357('0xb'));var _=require(_0x8357('0xc'));var squel=require('squel');var crypto=require(_0x8357('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8357('0xe'));var toCsv=require(_0x8357('0x9'));var querystring=require(_0x8357('0xf'));var Papa=require(_0x8357('0x10'));var Redis=require('ioredis');var authService=require(_0x8357('0x11'));var qs=require(_0x8357('0x12'));var as=require(_0x8357('0x13'));var hardwareService=require(_0x8357('0x14'));var logger=require('../../config/logger')(_0x8357('0x15'));var utils=require(_0x8357('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8357('0x17'))['db'];var integrations=require(_0x8357('0x18'));function respondWithStatusCode(_0xffe976,_0x456ded){_0x456ded=_0x456ded||0xcc;return function(_0x4d5bac){if(_0x4d5bac){return _0xffe976['sendStatus'](_0x456ded);}return _0xffe976[_0x8357('0x19')](_0x456ded)[_0x8357('0x1a')]();};}function respondWithResult(_0x31ef24,_0x331d08){_0x331d08=_0x331d08||0xc8;return function(_0x4a0d25){if(_0x4a0d25){return _0x31ef24[_0x8357('0x19')](_0x331d08)['json'](_0x4a0d25);}};}function respondWithFilteredResult(_0x21c468,_0x547798){return function(_0x14648c){if(_0x14648c){var _0x29fdcd=typeof _0x547798['offset']===_0x8357('0x1b')&&typeof _0x547798[_0x8357('0x1c')]===_0x8357('0x1b');var _0x508e9a=_0x14648c['count'];var _0x24c8d2=_0x29fdcd?0x0:_0x547798[_0x8357('0x1d')];var _0x50db3b=_0x29fdcd?_0x14648c[_0x8357('0x1e')]:_0x547798[_0x8357('0x1d')]+_0x547798[_0x8357('0x1c')];var _0x5d9a2d;if(_0x50db3b>=_0x508e9a){_0x50db3b=_0x508e9a;_0x5d9a2d=0xc8;}else{_0x5d9a2d=0xce;}_0x21c468[_0x8357('0x19')](_0x5d9a2d);return _0x21c468[_0x8357('0x1f')](_0x8357('0x20'),_0x24c8d2+'-'+_0x50db3b+'/'+_0x508e9a)[_0x8357('0x21')](_0x14648c);}return null;};}function patchUpdates(_0xb5a53c){return function(_0x2fef01){try{jsonpatch[_0x8357('0x22')](_0x2fef01,_0xb5a53c,!![]);}catch(_0x34b79a){return BPromise[_0x8357('0x23')](_0x34b79a);}return _0x2fef01[_0x8357('0x24')]();};}function saveUpdates(_0x84e8f3,_0x3998f4){return function(_0x4d70b0){if(_0x4d70b0){return _0x4d70b0['update'](_0x84e8f3)[_0x8357('0x25')](function(_0x1cde25){return _0x1cde25;});}return null;};}function removeEntity(_0x29199f,_0x36253f){return function(_0x5e554e){if(_0x5e554e){return _0x5e554e[_0x8357('0x26')]()[_0x8357('0x25')](function(){_0x29199f[_0x8357('0x19')](0xcc)[_0x8357('0x1a')]();});}};}function handleEntityNotFound(_0x384b23,_0xd17d5b){return function(_0x16f2cb){if(!_0x16f2cb){_0x384b23[_0x8357('0x27')](0x194);}return _0x16f2cb;};}function handleError(_0x46c337,_0x572cc1){_0x572cc1=_0x572cc1||0x1f4;return function(_0x3298d7){logger[_0x8357('0x28')](_0x3298d7[_0x8357('0x29')]);if(_0x3298d7['name']){delete _0x3298d7['name'];}_0x46c337[_0x8357('0x19')](_0x572cc1)[_0x8357('0x2a')](_0x3298d7);};}exports[_0x8357('0x2b')]=function(_0xf5ed20,_0x1c0fc1){var _0x2ce9f1={},_0x5e442f={},_0x3b8e0b={'count':0x0,'rows':[]};var _0x42cd57=_[_0x8357('0x2c')](db[_0x8357('0x2d')][_0x8357('0x2e')],function(_0x5989cb){return{'name':_0x5989cb[_0x8357('0x2f')],'type':_0x5989cb[_0x8357('0x30')]['key']};});_0x5e442f[_0x8357('0x31')]=_[_0x8357('0x2c')](_0x42cd57,_0x8357('0x32'));_0x5e442f[_0x8357('0x33')]=_[_0x8357('0x34')](_0xf5ed20['query']);_0x5e442f[_0x8357('0x35')]=_[_0x8357('0x36')](_0x5e442f[_0x8357('0x31')],_0x5e442f[_0x8357('0x33')]);_0x2ce9f1[_0x8357('0x37')]=_['intersection'](_0x5e442f[_0x8357('0x31')],qs[_0x8357('0x38')](_0xf5ed20[_0x8357('0x33')]['fields']));_0x2ce9f1[_0x8357('0x37')]=_0x2ce9f1[_0x8357('0x37')][_0x8357('0x39')]?_0x2ce9f1[_0x8357('0x37')]:_0x5e442f[_0x8357('0x31')];if(!_0xf5ed20['query'][_0x8357('0x3a')]('nolimit')){_0x2ce9f1[_0x8357('0x1c')]=qs['limit'](_0xf5ed20[_0x8357('0x33')][_0x8357('0x1c')]);_0x2ce9f1[_0x8357('0x1d')]=qs['offset'](_0xf5ed20['query'][_0x8357('0x1d')]);}_0x2ce9f1['order']=qs[_0x8357('0x3b')](_0xf5ed20[_0x8357('0x33')][_0x8357('0x3b')]);_0x2ce9f1[_0x8357('0x3c')]=qs[_0x8357('0x35')](_[_0x8357('0x3d')](_0xf5ed20[_0x8357('0x33')],_0x5e442f[_0x8357('0x35')]),_0x42cd57);if(_0xf5ed20[_0x8357('0x33')][_0x8357('0x3e')]){_0x2ce9f1['where']=_['merge'](_0x2ce9f1[_0x8357('0x3c')],{'$or':_[_0x8357('0x2c')](_0x42cd57,function(_0x12cebb){if(_0x12cebb['type']!==_0x8357('0x3f')){var _0x164876={};_0x164876[_0x12cebb[_0x8357('0x32')]]={'$like':'%'+_0xf5ed20['query'][_0x8357('0x3e')]+'%'};return _0x164876;}})});}_0x2ce9f1=_['merge']({},_0x2ce9f1,_0xf5ed20[_0x8357('0x40')]);var _0x5a148e={'where':_0x2ce9f1[_0x8357('0x3c')]};return db['VtigerAccount'][_0x8357('0x1e')](_0x5a148e)[_0x8357('0x25')](function(_0x29fabe){_0x3b8e0b[_0x8357('0x1e')]=_0x29fabe;if(_0xf5ed20[_0x8357('0x33')][_0x8357('0x41')]){_0x2ce9f1[_0x8357('0x42')]=[{'all':!![]}];}return db[_0x8357('0x2d')][_0x8357('0x43')](_0x2ce9f1);})[_0x8357('0x25')](function(_0x143345){_0x3b8e0b[_0x8357('0x44')]=_0x143345;return _0x3b8e0b;})[_0x8357('0x25')](respondWithFilteredResult(_0x1c0fc1,_0x2ce9f1))['catch'](handleError(_0x1c0fc1,null));};exports[_0x8357('0x45')]=function(_0x19d99a,_0x3e25a0){var _0x2c8b6e={'raw':![],'where':{'id':_0x19d99a[_0x8357('0x46')]['id']}},_0x1c12e9={};_0x1c12e9[_0x8357('0x31')]=_[_0x8357('0x34')](db[_0x8357('0x2d')][_0x8357('0x2e')]);_0x1c12e9[_0x8357('0x33')]=_[_0x8357('0x34')](_0x19d99a[_0x8357('0x33')]);_0x1c12e9[_0x8357('0x35')]=_['intersection'](_0x1c12e9[_0x8357('0x31')],_0x1c12e9[_0x8357('0x33')]);_0x2c8b6e[_0x8357('0x37')]=_[_0x8357('0x36')](_0x1c12e9[_0x8357('0x31')],qs[_0x8357('0x38')](_0x19d99a[_0x8357('0x33')]['fields']));_0x2c8b6e['attributes']=_0x2c8b6e[_0x8357('0x37')][_0x8357('0x39')]?_0x2c8b6e[_0x8357('0x37')]:_0x1c12e9[_0x8357('0x31')];if(_0x19d99a[_0x8357('0x33')][_0x8357('0x41')]){_0x2c8b6e[_0x8357('0x42')]=[{'all':!![]}];}_0x2c8b6e=_[_0x8357('0x47')]({},_0x2c8b6e,_0x19d99a[_0x8357('0x40')]);return db['VtigerAccount'][_0x8357('0x48')](_0x2c8b6e)[_0x8357('0x25')](handleEntityNotFound(_0x3e25a0,null))[_0x8357('0x25')](respondWithResult(_0x3e25a0,null))[_0x8357('0x49')](handleError(_0x3e25a0,null));};exports['create']=function(_0x20d5f1,_0x565123){return db[_0x8357('0x2d')][_0x8357('0x4a')](_0x20d5f1[_0x8357('0x4b')],{})[_0x8357('0x25')](respondWithResult(_0x565123,0xc9))[_0x8357('0x49')](handleError(_0x565123,null));};exports[_0x8357('0x4c')]=function(_0x1dd733,_0x2407db){if(_0x1dd733['body']['id']){delete _0x1dd733['body']['id'];}return db[_0x8357('0x2d')][_0x8357('0x48')]({'where':{'id':_0x1dd733[_0x8357('0x46')]['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x2407db,null))[_0x8357('0x25')](saveUpdates(_0x1dd733[_0x8357('0x4b')],null))[_0x8357('0x25')](respondWithResult(_0x2407db,null))[_0x8357('0x49')](handleError(_0x2407db,null));};exports[_0x8357('0x26')]=function(_0x5436ac,_0x547b0a){return db[_0x8357('0x2d')][_0x8357('0x48')]({'where':{'id':_0x5436ac[_0x8357('0x46')]['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x547b0a,null))['then'](removeEntity(_0x547b0a,null))[_0x8357('0x49')](handleError(_0x547b0a,null));};exports[_0x8357('0x4d')]=function(_0x59b71f,_0x5d1b5d,_0x25c6d8){var _0x2bdee8={};var _0x26b97b={};var _0x3b0b3a;var _0x33473b;return db[_0x8357('0x2d')][_0x8357('0x4e')]({'where':{'id':_0x59b71f[_0x8357('0x46')]['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x5d1b5d,null))[_0x8357('0x25')](function(_0x3c149e){if(_0x3c149e){_0x3b0b3a=_0x3c149e;_0x26b97b[_0x8357('0x31')]=_['keys'](db[_0x8357('0x4f')]['rawAttributes']);_0x26b97b['query']=_[_0x8357('0x34')](_0x59b71f[_0x8357('0x33')]);_0x26b97b[_0x8357('0x35')]=_['intersection'](_0x26b97b[_0x8357('0x31')],_0x26b97b[_0x8357('0x33')]);_0x2bdee8[_0x8357('0x37')]=_[_0x8357('0x36')](_0x26b97b[_0x8357('0x31')],qs[_0x8357('0x38')](_0x59b71f[_0x8357('0x33')]['fields']));_0x2bdee8[_0x8357('0x37')]=_0x2bdee8['attributes'][_0x8357('0x39')]?_0x2bdee8[_0x8357('0x37')]:_0x26b97b[_0x8357('0x31')];_0x2bdee8[_0x8357('0x50')]=qs['sort'](_0x59b71f[_0x8357('0x33')][_0x8357('0x3b')]);_0x2bdee8[_0x8357('0x3c')]=qs[_0x8357('0x35')](_[_0x8357('0x3d')](_0x59b71f[_0x8357('0x33')],_0x26b97b[_0x8357('0x35')]));if(_0x59b71f[_0x8357('0x33')]['filter']){_0x2bdee8[_0x8357('0x3c')]=_['merge'](_0x2bdee8[_0x8357('0x3c')],{'$or':_['map'](_0x2bdee8[_0x8357('0x37')],function(_0x40dfc1){var _0x3d65c1={};_0x3d65c1[_0x40dfc1]={'$like':'%'+_0x59b71f[_0x8357('0x33')][_0x8357('0x3e')]+'%'};return _0x3d65c1;})});}_0x2bdee8=_[_0x8357('0x47')]({},_0x2bdee8,_0x59b71f['options']);return _0x3b0b3a[_0x8357('0x4d')](_0x2bdee8);}})[_0x8357('0x25')](function(_0x18aeef){if(_0x18aeef){_0x33473b=_0x18aeef['length'];if(!_0x59b71f[_0x8357('0x33')][_0x8357('0x3a')](_0x8357('0x51'))){_0x2bdee8[_0x8357('0x1c')]=qs[_0x8357('0x1c')](_0x59b71f['query'][_0x8357('0x1c')]);_0x2bdee8[_0x8357('0x1d')]=qs['offset'](_0x59b71f['query'][_0x8357('0x1d')]);}return _0x3b0b3a[_0x8357('0x4d')](_0x2bdee8);}})[_0x8357('0x25')](function(_0xb80c6c){if(_0xb80c6c){return _0xb80c6c?{'count':_0x33473b,'rows':_0xb80c6c}:null;}})[_0x8357('0x25')](respondWithResult(_0x5d1b5d,null))[_0x8357('0x49')](handleError(_0x5d1b5d,null));};exports[_0x8357('0x52')]=function(_0x495bf9,_0x4ff759,_0x18d261){if(_0x495bf9[_0x8357('0x4b')]['id']){delete _0x495bf9['body']['id'];}return db[_0x8357('0x2d')][_0x8357('0x4e')]({'where':{'id':_0x495bf9['params']['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x4ff759,null))[_0x8357('0x25')](function(_0x36b295){if(_0x36b295){_0x495bf9[_0x8357('0x4b')]['AccountId']=_0x36b295['id'];_0x495bf9[_0x8357('0x4b')][_0x8357('0x53')]=integrations['getSubjects'](_0x495bf9[_0x8357('0x4b')][_0x8357('0x54')],_0x495bf9[_0x8357('0x4b')]['type']);_0x495bf9[_0x8357('0x4b')][_0x8357('0x55')]=integrations[_0x8357('0x56')](_0x495bf9[_0x8357('0x4b')]['channel'],_0x495bf9[_0x8357('0x4b')][_0x8357('0x30')]);return db['VtigerConfiguration'][_0x8357('0x4a')](_0x495bf9[_0x8357('0x4b')],{'include':[{'model':db[_0x8357('0x57')],'as':_0x8357('0x53')},{'model':db['VtigerField'],'as':_0x8357('0x55')}]});}return null;})[_0x8357('0x25')](respondWithResult(_0x4ff759,null))[_0x8357('0x49')](handleError(_0x4ff759,null));};var md5=require('md5');exports['getFields']=function(_0x1062a0,_0x2db18a,_0x850240){var _0x35c03c=null;var _0x1c5dd3=null;var _0x467a58=null;var _0x1bdfc9=null;var _0x31ad35='';return db['VtigerAccount'][_0x8357('0x4e')]({'where':{'id':_0x1062a0[_0x8357('0x46')]['id']},'attributes':['id','name','username',_0x8357('0x58'),_0x8357('0x59'),_0x8357('0x5a'),'serverUrl','accessKey']})[_0x8357('0x25')](handleEntityNotFound(_0x2db18a,null))[_0x8357('0x25')](function(_0x565857){if(_0x565857){_0x35c03c=_0x565857[_0x8357('0x5b')];_0x1c5dd3=_0x565857['accessKey'];_0x467a58=_0x565857['moduleName'];_0x31ad35=_0x565857[_0x8357('0x5a')];var _0x1e8617=_0x31ad35[_0x8357('0x5c')](-0x1);if(_0x1e8617==='/'){_0x31ad35=_0x31ad35[_0x8357('0x5d')](0x0,_0x31ad35['lastIndexOf'](_0x1e8617));}_0x1bdfc9=util[_0x8357('0x5e')](_0x8357('0x5f'),_0x31ad35);var _0x138aad={'method':_0x8357('0x60'),'uri':_0x1bdfc9,'qs':{'operation':'getchallenge','username':_0x565857['username']},'json':!![]};return rp(_0x138aad);}})[_0x8357('0x25')](function(_0x3356c6){if(_0x3356c6[_0x8357('0x61')]){var _0x134f43={'method':_0x8357('0x62'),'uri':_0x1bdfc9,'form':{'operation':'login','username':_0x35c03c,'accessKey':md5(_0x3356c6['result']['token']+_0x1c5dd3)},'json':!![]};return rp(_0x134f43);}})[_0x8357('0x25')](function(_0x31b853){if(_0x31b853['success']){var _0xca583c={'method':_0x8357('0x60'),'uri':_0x1bdfc9,'qs':{'operation':'describe','username':_0x35c03c,'sessionName':_0x31b853[_0x8357('0x63')]['sessionName'],'elementType':_0x467a58},'json':!![]};return rp(_0xca583c);}})[_0x8357('0x25')](function(_0x8d120b){if(_0x8d120b[_0x8357('0x61')]){var _0x4b8538=['autogenerated',_0x8357('0x64'),'owner'];_['remove'](_0x8d120b['result']['fields'],function(_0x194112){return _0x4b8538['includes'](_0x194112['type']['name']);});_[_0x8357('0x65')](_0x8d120b[_0x8357('0x63')][_0x8357('0x38')],function(_0x17b2d9){return _0x17b2d9[_0x8357('0x66')]===_0x8357('0x67');});return{'count':_0x8d120b[_0x8357('0x63')][_0x8357('0x38')]['length'],'rows':_[_0x8357('0x2c')](_0x8d120b[_0x8357('0x63')][_0x8357('0x38')],function(_0x235cbf){return{'id':_0x235cbf[_0x8357('0x32')],'name':_0x235cbf[_0x8357('0x68')],'custom':_['startsWith'](_0x235cbf[_0x8357('0x32')],_0x8357('0x69'))?!![]:![],'options':_0x235cbf['type'][_0x8357('0x32')]===_0x8357('0x6a')&&_0x235cbf['type'][_0x8357('0x6b')][_0x8357('0x39')]>0x0?_[_0x8357('0x2c')](_0x235cbf[_0x8357('0x30')]['picklistValues'],function(_0x465008){return{'name':_0x465008['label'],'value':_0x465008[_0x8357('0x6c')]};}):[]};})};}})['then'](respondWithResult(_0x2db18a,null))[_0x8357('0x49')](function(_0x5ae858){console[_0x8357('0x6d')](_0x8357('0x6e')+_0x5ae858);var _0x3f01eb=_0x1062a0[_0x8357('0x33')][_0x8357('0x6f')]?0x1f4:_0x5ae858['statusCode']||0x1f4;logger['error'](_0x8357('0x70'),_0x8357('0x71'),_0x3f01eb,JSON['stringify'](_0x5ae858));delete _0x5ae858[_0x8357('0x32')];if(_0x3f01eb===0x191){_0x3f01eb=0x190;}_0x2db18a['status'](_0x3f01eb)[_0x8357('0x2a')](_0x1062a0[_0x8357('0x33')][_0x8357('0x6f')]?{'message':_0x8357('0x72'),'statusCode':_0x5ae858[_0x8357('0x73')]}:_0x5ae858);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 40ada22..e28ab8f 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 _0x5f8e=['rimraf','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f8e,0x1aa));var _0xe5f8=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x5f8e[_0x21cb7f];return _0x5a079a;};'use strict';var _=require('lodash');var util=require(_0xe5f8('0x0'));var logger=require(_0xe5f8('0x1'))(_0xe5f8('0x2'));var moment=require(_0xe5f8('0x3'));var BPromise=require(_0xe5f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5f8('0x5'));var rimraf=require(_0xe5f8('0x6'));var config=require(_0xe5f8('0x7'));var attributes=require(_0xe5f8('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2baa65,_0x47c08a){return _0x2baa65[_0xe5f8('0x9')](_0xe5f8('0xa'),attributes,{'tableName':_0xe5f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02b6=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x02b6,0x1b2));var _0x602b=function(_0x24e3a4,_0x25f2c5){_0x24e3a4=_0x24e3a4-0x0;var _0x4ec350=_0x02b6[_0x24e3a4];return _0x4ec350;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x602b('0x1'));var moment=require('moment');var BPromise=require(_0x602b('0x2'));var rp=require(_0x602b('0x3'));var fs=require('fs');var path=require(_0x602b('0x4'));var rimraf=require('rimraf');var config=require(_0x602b('0x5'));var attributes=require(_0x602b('0x6'));var integrations=require(_0x602b('0x7'));module[_0x602b('0x8')]=function(_0x154275,_0x3441e3){return _0x154275['define'](_0x602b('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0f849d3..010aab8 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 _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x43077b,_0x2e8274){var _0x429348=function(_0x4e8d01){while(--_0x4e8d01){_0x43077b['push'](_0x43077b['shift']());}};_0x429348(++_0x2e8274);}(_0x0bb5,0x148));var _0x50bb=function(_0x566c19,_0x587c7f){_0x566c19=_0x566c19-0x0;var _0x377c15=_0x0bb5[_0x566c19];return _0x377c15;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file +var _0xd4f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x2477f7,_0x198641){var _0x423447=function(_0x818b34){while(--_0x818b34){_0x2477f7['push'](_0x2477f7['shift']());}};_0x423447(++_0x198641);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3e643c,_0xd84e96){_0x3e643c=_0x3e643c-0x0;var _0x500902=_0xd4f4[_0x3e643c];return _0x500902;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['VtigerAccount'][_0x4d4f('0x18')]({'raw':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1b')]||null:null,'attributes':_0x51dcf1['options']?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1c')]||null:null,'limit':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1d')]||null:null,'include':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1e')]?_['map'](_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1e')],function(_0x2d2fb3){return{'model':db[_0x2d2fb3[_0x4d4f('0x1f')]],'as':_0x2d2fb3['as'],'attributes':_0x2d2fb3[_0x4d4f('0x1c')],'include':_0x2d2fb3['include']?_[_0x4d4f('0x20')](_0x2d2fb3[_0x4d4f('0x1e')],function(_0x1cf365){return{'model':db[_0x1cf365[_0x4d4f('0x1f')]],'as':_0x1cf365['as'],'attributes':_0x1cf365['attributes'],'include':_0x1cf365['include']?_[_0x4d4f('0x20')](_0x1cf365[_0x4d4f('0x1e')],function(_0xa2492c){return{'model':db[_0xa2492c[_0x4d4f('0x1f')]],'as':_0xa2492c['as'],'attributes':_0xa2492c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x380ebf){logger[_0x4d4f('0xd')](_0x4d4f('0x17'),_0x51dcf1);logger['debug'](_0x4d4f('0x17'),_0x51dcf1,JSON['stringify'](_0x380ebf));_0x519501(_0x380ebf);})[_0x4d4f('0x16')](function(_0x333a40){logger['error'](_0x4d4f('0x17'),_0x333a40[_0x4d4f('0x15')],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x333a40[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x21')]=function(_0x43a704){var _0x4c69cb=this;return new Promise(function(_0x36eede,_0x4578b6){return db[_0x4d4f('0x22')][_0x4d4f('0x23')]({'raw':_0x43a704[_0x4d4f('0x19')]?_0x43a704['options'][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')]['where']||null:null,'attributes':_0x43a704['options']?_0x43a704['options'][_0x4d4f('0x1c')]||null:null,'include':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')][_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x43a704['options'][_0x4d4f('0x1e')],function(_0x1ab7c4){return{'model':db[_0x1ab7c4[_0x4d4f('0x1f')]],'as':_0x1ab7c4['as'],'attributes':_0x1ab7c4['attributes'],'include':_0x1ab7c4[_0x4d4f('0x1e')]?_['map'](_0x1ab7c4[_0x4d4f('0x1e')],function(_0x2f18df){return{'model':db[_0x2f18df[_0x4d4f('0x1f')]],'as':_0x2f18df['as'],'attributes':_0x2f18df[_0x4d4f('0x1c')],'include':_0x2f18df[_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x2f18df[_0x4d4f('0x1e')],function(_0x461900){return{'model':db[_0x461900['model']],'as':_0x461900['as'],'attributes':_0x461900['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x559441){logger['info'](_0x4d4f('0x21'),_0x43a704);logger[_0x4d4f('0x10')](_0x4d4f('0x21'),_0x43a704,JSON[_0x4d4f('0x12')](_0x559441));_0x36eede(_0x559441);})[_0x4d4f('0x16')](function(_0x56eed8){logger[_0x4d4f('0x13')](_0x4d4f('0x21'),_0x56eed8['message'],_0x43a704);_0x4578b6(_0x4c69cb[_0x4d4f('0x13')](0x1f4,_0x56eed8[_0x4d4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 035e522..febe5b1 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 _0x7e2e=['get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x36a5ed,_0x471fe7){var _0x98356f=function(_0x3f5bdf){while(--_0x3f5bdf){_0x36a5ed['push'](_0x36a5ed['shift']());}};_0x98356f(++_0x471fe7);}(_0x7e2e,0x129));var _0xe7e2=function(_0x1e4658,_0x2e8a2a){_0x1e4658=_0x1e4658-0x0;var _0x2bd3bd=_0x7e2e[_0x1e4658];return _0x2bd3bd;};'use strict';var multer=require(_0xe7e2('0x0'));var util=require(_0xe7e2('0x1'));var path=require(_0xe7e2('0x2'));var timeout=require(_0xe7e2('0x3'));var express=require(_0xe7e2('0x4'));var router=express['Router']();var fs_extra=require(_0xe7e2('0x5'));var auth=require(_0xe7e2('0x6'));var interaction=require(_0xe7e2('0x7'));var config=require(_0xe7e2('0x8'));var controller=require(_0xe7e2('0x9'));router['get']('/',auth[_0xe7e2('0xa')](),controller[_0xe7e2('0xb')]);router['get'](_0xe7e2('0xc'),auth['isAuthenticated'](),controller[_0xe7e2('0xd')]);router['get'](_0xe7e2('0xe'),auth[_0xe7e2('0xa')](),controller['getFields']);router[_0xe7e2('0xf')](_0xe7e2('0x10'),auth[_0xe7e2('0xa')](),controller[_0xe7e2('0x11')]);router[_0xe7e2('0xf')](_0xe7e2('0x12'),auth['isAuthenticated'](),controller[_0xe7e2('0x13')]);router[_0xe7e2('0x14')]('/',auth[_0xe7e2('0xa')](),controller[_0xe7e2('0x15')]);router[_0xe7e2('0x16')](_0xe7e2('0xc'),auth[_0xe7e2('0xa')](),controller[_0xe7e2('0x17')]);router['delete'](_0xe7e2('0xc'),auth[_0xe7e2('0xa')](),controller[_0xe7e2('0x18')]);module[_0xe7e2('0x19')]=router; \ No newline at end of file +var _0xaedd=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x43612b,_0x49e180){var _0x943e5e=function(_0x35ab64){while(--_0x35ab64){_0x43612b['push'](_0x43612b['shift']());}};_0x943e5e(++_0x49e180);}(_0xaedd,0x185));var _0xdaed=function(_0x240511,_0x5b24d0){_0x240511=_0x240511-0x0;var _0x2b8f7a=_0xaedd[_0x240511];return _0x2b8f7a;};'use strict';var multer=require(_0xdaed('0x0'));var util=require(_0xdaed('0x1'));var path=require(_0xdaed('0x2'));var timeout=require('connect-timeout');var express=require(_0xdaed('0x3'));var router=express[_0xdaed('0x4')]();var fs_extra=require(_0xdaed('0x5'));var auth=require(_0xdaed('0x6'));var interaction=require(_0xdaed('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xdaed('0x8')]('/',auth['isAuthenticated'](),controller[_0xdaed('0x9')]);router[_0xdaed('0x8')](_0xdaed('0xa'),auth[_0xdaed('0xb')](),controller[_0xdaed('0xc')]);router[_0xdaed('0x8')](_0xdaed('0xd'),auth[_0xdaed('0xb')](),controller[_0xdaed('0xe')]);router['get'](_0xdaed('0xf'),auth[_0xdaed('0xb')](),controller[_0xdaed('0x10')]);router['get'](_0xdaed('0x11'),auth[_0xdaed('0xb')](),controller[_0xdaed('0x12')]);router[_0xdaed('0x13')]('/',auth[_0xdaed('0xb')](),controller[_0xdaed('0x14')]);router[_0xdaed('0x15')](_0xdaed('0xa'),auth[_0xdaed('0xb')](),controller['update']);router[_0xdaed('0x16')](_0xdaed('0xa'),auth[_0xdaed('0xb')](),controller[_0xdaed('0x17')]);module[_0xdaed('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6c72f1f..b418a4c 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 _0x00da=['sequelize','exports','STRING'];(function(_0x2aa316,_0x2c4cf7){var _0x23bf49=function(_0x7a3a59){while(--_0x7a3a59){_0x2aa316['push'](_0x2aa316['shift']());}};_0x23bf49(++_0x2c4cf7);}(_0x00da,0xf6));var _0xa00d=function(_0x3689c9,_0x1f44b5){_0x3689c9=_0x3689c9-0x0;var _0xc0effb=_0x00da[_0x3689c9];return _0xc0effb;};'use strict';var Sequelize=require(_0xa00d('0x0'));module[_0xa00d('0x1')]={'name':{'type':Sequelize[_0xa00d('0x2')]},'description':{'type':Sequelize[_0xa00d('0x2')]}}; \ No newline at end of file +var _0xfca2=['sequelize','exports','STRING'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xfca2,0xe4));var _0x2fca=function(_0x27250c,_0x3e6637){_0x27250c=_0x27250c-0x0;var _0x7e3095=_0xfca2[_0x27250c];return _0x7e3095;};'use strict';var Sequelize=require(_0x2fca('0x0'));module[_0x2fca('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2fca('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2d2f0bf..724a38f 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 _0xb869=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','params','rawAttributes','fields','find','catch','create','body','update','destroy','findOne','sort','getFields','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','stack','name','index','map','VtigerConfiguration','fieldName','type'];(function(_0x4200e3,_0xb34e23){var _0x26ac37=function(_0x5b09e5){while(--_0x5b09e5){_0x4200e3['push'](_0x4200e3['shift']());}};_0x26ac37(++_0xb34e23);}(_0xb869,0x79));var _0x9b86=function(_0x456979,_0x113b2c){_0x456979=_0x456979-0x0;var _0x10ca39=_0xb869[_0x456979];return _0x10ca39;};'use strict';var emlformat=require(_0x9b86('0x0'));var rimraf=require(_0x9b86('0x1'));var zipdir=require(_0x9b86('0x2'));var jsonpatch=require(_0x9b86('0x3'));var rp=require(_0x9b86('0x4'));var moment=require(_0x9b86('0x5'));var BPromise=require(_0x9b86('0x6'));var Mustache=require(_0x9b86('0x7'));var util=require(_0x9b86('0x8'));var path=require(_0x9b86('0x9'));var sox=require(_0x9b86('0xa'));var csv=require(_0x9b86('0xb'));var ejs=require(_0x9b86('0xc'));var fs=require('fs');var fs_extra=require(_0x9b86('0xd'));var _=require(_0x9b86('0xe'));var squel=require(_0x9b86('0xf'));var crypto=require(_0x9b86('0x10'));var jsforce=require(_0x9b86('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x9b86('0xb'));var querystring=require(_0x9b86('0x12'));var Papa=require(_0x9b86('0x13'));var Redis=require(_0x9b86('0x14'));var authService=require(_0x9b86('0x15'));var qs=require(_0x9b86('0x16'));var as=require(_0x9b86('0x17'));var hardwareService=require(_0x9b86('0x18'));var logger=require(_0x9b86('0x19'))(_0x9b86('0x1a'));var utils=require(_0x9b86('0x1b'));var config=require(_0x9b86('0x1c'));var licenseUtil=require(_0x9b86('0x1d'));var db=require(_0x9b86('0x1e'))['db'];function respondWithStatusCode(_0x2e51dc,_0x1fa987){_0x1fa987=_0x1fa987||0xcc;return function(_0x2b1e29){if(_0x2b1e29){return _0x2e51dc[_0x9b86('0x1f')](_0x1fa987);}return _0x2e51dc[_0x9b86('0x20')](_0x1fa987)[_0x9b86('0x21')]();};}function respondWithResult(_0xc4ca14,_0x43c83c){_0x43c83c=_0x43c83c||0xc8;return function(_0x85b2f5){if(_0x85b2f5){return _0xc4ca14[_0x9b86('0x20')](_0x43c83c)[_0x9b86('0x22')](_0x85b2f5);}};}function respondWithFilteredResult(_0x3a7aae,_0x1bab67){return function(_0x40d949){if(_0x40d949){var _0x1ff0e9=typeof _0x1bab67[_0x9b86('0x23')]==='undefined'&&typeof _0x1bab67[_0x9b86('0x24')]==='undefined';var _0x2b627d=_0x40d949['count'];var _0x3978e8=_0x1ff0e9?0x0:_0x1bab67[_0x9b86('0x23')];var _0x5161d7=_0x1ff0e9?_0x40d949['count']:_0x1bab67['offset']+_0x1bab67['limit'];var _0x4607ea;if(_0x5161d7>=_0x2b627d){_0x5161d7=_0x2b627d;_0x4607ea=0xc8;}else{_0x4607ea=0xce;}_0x3a7aae[_0x9b86('0x20')](_0x4607ea);return _0x3a7aae['set'](_0x9b86('0x25'),_0x3978e8+'-'+_0x5161d7+'/'+_0x2b627d)['json'](_0x40d949);}return null;};}function patchUpdates(_0xdd18a4){return function(_0x804a77){try{jsonpatch[_0x9b86('0x26')](_0x804a77,_0xdd18a4,!![]);}catch(_0x4b57a6){return BPromise[_0x9b86('0x27')](_0x4b57a6);}return _0x804a77[_0x9b86('0x28')]();};}function saveUpdates(_0x148302,_0x2322be){return function(_0x52d7b2){if(_0x52d7b2){return _0x52d7b2['update'](_0x148302)[_0x9b86('0x29')](function(_0xd576e4){return _0xd576e4;});}return null;};}function removeEntity(_0x5174bc,_0x3bbacb){return function(_0x29fea9){if(_0x29fea9){return _0x29fea9['destroy']()['then'](function(){_0x5174bc[_0x9b86('0x20')](0xcc)[_0x9b86('0x21')]();});}};}function handleEntityNotFound(_0x360d92,_0x138ff9){return function(_0x204e4f){if(!_0x204e4f){_0x360d92[_0x9b86('0x1f')](0x194);}return _0x204e4f;};}function handleError(_0x32097a,_0x555d15){_0x555d15=_0x555d15||0x1f4;return function(_0x9b5a94){logger['error'](_0x9b5a94[_0x9b86('0x2a')]);if(_0x9b5a94[_0x9b86('0x2b')]){delete _0x9b5a94['name'];}_0x32097a[_0x9b86('0x20')](_0x555d15)['send'](_0x9b5a94);};}exports[_0x9b86('0x2c')]=function(_0x1ce67c,_0x3dac98){var _0x568537={},_0x6b63d1={},_0x45e35b={'count':0x0,'rows':[]};var _0xab13c1=_[_0x9b86('0x2d')](db[_0x9b86('0x2e')]['rawAttributes'],function(_0x492b27){return{'name':_0x492b27[_0x9b86('0x2f')],'type':_0x492b27[_0x9b86('0x30')][_0x9b86('0x31')]};});_0x6b63d1[_0x9b86('0x32')]=_[_0x9b86('0x2d')](_0xab13c1,_0x9b86('0x2b'));_0x6b63d1[_0x9b86('0x33')]=_[_0x9b86('0x34')](_0x1ce67c[_0x9b86('0x33')]);_0x6b63d1[_0x9b86('0x35')]=_[_0x9b86('0x36')](_0x6b63d1[_0x9b86('0x32')],_0x6b63d1['query']);_0x568537[_0x9b86('0x37')]=_['intersection'](_0x6b63d1[_0x9b86('0x32')],qs['fields'](_0x1ce67c[_0x9b86('0x33')]['fields']));_0x568537['attributes']=_0x568537[_0x9b86('0x37')][_0x9b86('0x38')]?_0x568537[_0x9b86('0x37')]:_0x6b63d1[_0x9b86('0x32')];if(!_0x1ce67c[_0x9b86('0x33')][_0x9b86('0x39')](_0x9b86('0x3a'))){_0x568537[_0x9b86('0x24')]=qs[_0x9b86('0x24')](_0x1ce67c[_0x9b86('0x33')]['limit']);_0x568537[_0x9b86('0x23')]=qs[_0x9b86('0x23')](_0x1ce67c['query'][_0x9b86('0x23')]);}_0x568537[_0x9b86('0x3b')]=qs['sort'](_0x1ce67c[_0x9b86('0x33')]['sort']);_0x568537['where']=qs[_0x9b86('0x35')](_[_0x9b86('0x3c')](_0x1ce67c['query'],_0x6b63d1[_0x9b86('0x35')]),_0xab13c1);if(_0x1ce67c['query'][_0x9b86('0x3d')]){_0x568537[_0x9b86('0x3e')]=_[_0x9b86('0x3f')](_0x568537[_0x9b86('0x3e')],{'$or':_[_0x9b86('0x2d')](_0xab13c1,function(_0xfb5bd8){if(_0xfb5bd8[_0x9b86('0x30')]!=='VIRTUAL'){var _0x33f5d9={};_0x33f5d9[_0xfb5bd8[_0x9b86('0x2b')]]={'$like':'%'+_0x1ce67c[_0x9b86('0x33')][_0x9b86('0x3d')]+'%'};return _0x33f5d9;}})});}_0x568537=_['merge']({},_0x568537,_0x1ce67c[_0x9b86('0x40')]);var _0x58369d={'where':_0x568537[_0x9b86('0x3e')]};return db['VtigerConfiguration'][_0x9b86('0x41')](_0x58369d)[_0x9b86('0x29')](function(_0x59057d){_0x45e35b[_0x9b86('0x41')]=_0x59057d;if(_0x1ce67c[_0x9b86('0x33')][_0x9b86('0x42')]){_0x568537[_0x9b86('0x43')]=[{'all':!![]}];}return db[_0x9b86('0x2e')][_0x9b86('0x44')](_0x568537);})[_0x9b86('0x29')](function(_0x43ad0a){_0x45e35b[_0x9b86('0x45')]=_0x43ad0a;return _0x45e35b;})[_0x9b86('0x29')](respondWithFilteredResult(_0x3dac98,_0x568537))['catch'](handleError(_0x3dac98,null));};exports['show']=function(_0x3490a1,_0x584701){var _0x11b4cb={'raw':![],'where':{'id':_0x3490a1[_0x9b86('0x46')]['id']}},_0x5832cc={};_0x5832cc[_0x9b86('0x32')]=_['keys'](db['VtigerConfiguration'][_0x9b86('0x47')]);_0x5832cc['query']=_[_0x9b86('0x34')](_0x3490a1[_0x9b86('0x33')]);_0x5832cc[_0x9b86('0x35')]=_[_0x9b86('0x36')](_0x5832cc[_0x9b86('0x32')],_0x5832cc['query']);_0x11b4cb['attributes']=_['intersection'](_0x5832cc[_0x9b86('0x32')],qs[_0x9b86('0x48')](_0x3490a1['query'][_0x9b86('0x48')]));_0x11b4cb['attributes']=_0x11b4cb[_0x9b86('0x37')][_0x9b86('0x38')]?_0x11b4cb[_0x9b86('0x37')]:_0x5832cc['model'];if(_0x3490a1[_0x9b86('0x33')][_0x9b86('0x42')]){_0x11b4cb[_0x9b86('0x43')]=[{'all':!![]}];}_0x11b4cb=_[_0x9b86('0x3f')]({},_0x11b4cb,_0x3490a1[_0x9b86('0x40')]);return db[_0x9b86('0x2e')][_0x9b86('0x49')](_0x11b4cb)[_0x9b86('0x29')](handleEntityNotFound(_0x584701,null))[_0x9b86('0x29')](respondWithResult(_0x584701,null))[_0x9b86('0x4a')](handleError(_0x584701,null));};exports[_0x9b86('0x4b')]=function(_0x36c295,_0x33e84f){return db[_0x9b86('0x2e')][_0x9b86('0x4b')](_0x36c295[_0x9b86('0x4c')],{})[_0x9b86('0x29')](respondWithResult(_0x33e84f,0xc9))['catch'](handleError(_0x33e84f,null));};exports[_0x9b86('0x4d')]=function(_0x1fbd4e,_0x4f90ea){if(_0x1fbd4e[_0x9b86('0x4c')]['id']){delete _0x1fbd4e[_0x9b86('0x4c')]['id'];}return db[_0x9b86('0x2e')][_0x9b86('0x49')]({'where':{'id':_0x1fbd4e['params']['id']}})[_0x9b86('0x29')](handleEntityNotFound(_0x4f90ea,null))[_0x9b86('0x29')](saveUpdates(_0x1fbd4e[_0x9b86('0x4c')],null))['then'](respondWithResult(_0x4f90ea,null))[_0x9b86('0x4a')](handleError(_0x4f90ea,null));};exports[_0x9b86('0x4e')]=function(_0x41b3ca,_0x2d9493){return db['VtigerConfiguration'][_0x9b86('0x49')]({'where':{'id':_0x41b3ca['params']['id']}})['then'](handleEntityNotFound(_0x2d9493,null))[_0x9b86('0x29')](removeEntity(_0x2d9493,null))['catch'](handleError(_0x2d9493,null));};exports['getFields']=function(_0xba9ed4,_0xa6400b,_0x305499){var _0x3a7836={};var _0x1cdb32={};var _0x622351;var _0x5a96b3;return db[_0x9b86('0x2e')][_0x9b86('0x4f')]({'where':{'id':_0xba9ed4[_0x9b86('0x46')]['id']}})[_0x9b86('0x29')](handleEntityNotFound(_0xa6400b,null))[_0x9b86('0x29')](function(_0x2ea657){if(_0x2ea657){_0x622351=_0x2ea657;_0x1cdb32[_0x9b86('0x32')]=_['keys'](db['VtigerField'][_0x9b86('0x47')]);_0x1cdb32[_0x9b86('0x33')]=_[_0x9b86('0x34')](_0xba9ed4[_0x9b86('0x33')]);_0x1cdb32[_0x9b86('0x35')]=_[_0x9b86('0x36')](_0x1cdb32[_0x9b86('0x32')],_0x1cdb32[_0x9b86('0x33')]);_0x3a7836[_0x9b86('0x37')]=_[_0x9b86('0x36')](_0x1cdb32[_0x9b86('0x32')],qs[_0x9b86('0x48')](_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x48')]));_0x3a7836['attributes']=_0x3a7836['attributes'][_0x9b86('0x38')]?_0x3a7836['attributes']:_0x1cdb32[_0x9b86('0x32')];_0x3a7836[_0x9b86('0x3b')]=qs[_0x9b86('0x50')](_0xba9ed4[_0x9b86('0x33')]['sort']);_0x3a7836[_0x9b86('0x3e')]=qs[_0x9b86('0x35')](_[_0x9b86('0x3c')](_0xba9ed4[_0x9b86('0x33')],_0x1cdb32['filters']));if(_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x3d')]){_0x3a7836[_0x9b86('0x3e')]=_[_0x9b86('0x3f')](_0x3a7836[_0x9b86('0x3e')],{'$or':_[_0x9b86('0x2d')](_0x3a7836[_0x9b86('0x37')],function(_0x1df74b){var _0x503336={};_0x503336[_0x1df74b]={'$like':'%'+_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x3d')]+'%'};return _0x503336;})});}_0x3a7836=_[_0x9b86('0x3f')]({},_0x3a7836,_0xba9ed4[_0x9b86('0x40')]);return _0x622351[_0x9b86('0x51')](_0x3a7836);}})['then'](function(_0x55389f){if(_0x55389f){_0x5a96b3=_0x55389f['length'];if(!_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x39')]('nolimit')){_0x3a7836[_0x9b86('0x24')]=qs['limit'](_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x24')]);_0x3a7836[_0x9b86('0x23')]=qs['offset'](_0xba9ed4[_0x9b86('0x33')][_0x9b86('0x23')]);}return _0x622351[_0x9b86('0x51')](_0x3a7836);}})[_0x9b86('0x29')](function(_0x487e75){if(_0x487e75){return _0x487e75?{'count':_0x5a96b3,'rows':_0x487e75}:null;}})[_0x9b86('0x29')](respondWithResult(_0xa6400b,null))[_0x9b86('0x4a')](handleError(_0xa6400b,null));};exports[_0x9b86('0x52')]=function(_0x5b76fb,_0x383b2e,_0x1984fc){var _0x244d6d={};var _0x4d05cf={};var _0x539c77;var _0x4f503c;return db[_0x9b86('0x2e')]['findOne']({'where':{'id':_0x5b76fb[_0x9b86('0x46')]['id']}})['then'](handleEntityNotFound(_0x383b2e,null))[_0x9b86('0x29')](function(_0x5bfc5c){if(_0x5bfc5c){_0x539c77=_0x5bfc5c;_0x4d05cf[_0x9b86('0x32')]=_[_0x9b86('0x34')](db[_0x9b86('0x53')][_0x9b86('0x47')]);_0x4d05cf[_0x9b86('0x33')]=_[_0x9b86('0x34')](_0x5b76fb[_0x9b86('0x33')]);_0x4d05cf[_0x9b86('0x35')]=_[_0x9b86('0x36')](_0x4d05cf['model'],_0x4d05cf[_0x9b86('0x33')]);_0x244d6d[_0x9b86('0x37')]=_[_0x9b86('0x36')](_0x4d05cf[_0x9b86('0x32')],qs[_0x9b86('0x48')](_0x5b76fb['query'][_0x9b86('0x48')]));_0x244d6d[_0x9b86('0x37')]=_0x244d6d['attributes'][_0x9b86('0x38')]?_0x244d6d[_0x9b86('0x37')]:_0x4d05cf[_0x9b86('0x32')];_0x244d6d[_0x9b86('0x3b')]=qs[_0x9b86('0x50')](_0x5b76fb[_0x9b86('0x33')][_0x9b86('0x50')]);_0x244d6d[_0x9b86('0x3e')]=qs[_0x9b86('0x35')](_['pick'](_0x5b76fb[_0x9b86('0x33')],_0x4d05cf[_0x9b86('0x35')]));if(_0x5b76fb[_0x9b86('0x33')]['filter']){_0x244d6d[_0x9b86('0x3e')]=_[_0x9b86('0x3f')](_0x244d6d[_0x9b86('0x3e')],{'$or':_['map'](_0x244d6d[_0x9b86('0x37')],function(_0x2fdd57){var _0x57a299={};_0x57a299[_0x2fdd57]={'$like':'%'+_0x5b76fb['query'][_0x9b86('0x3d')]+'%'};return _0x57a299;})});}_0x244d6d=_['merge']({},_0x244d6d,_0x5b76fb[_0x9b86('0x40')]);return _0x539c77[_0x9b86('0x52')](_0x244d6d);}})[_0x9b86('0x29')](function(_0x2bb2e4){if(_0x2bb2e4){_0x4f503c=_0x2bb2e4[_0x9b86('0x38')];if(!_0x5b76fb[_0x9b86('0x33')]['hasOwnProperty'](_0x9b86('0x3a'))){_0x244d6d[_0x9b86('0x24')]=qs[_0x9b86('0x24')](_0x5b76fb[_0x9b86('0x33')]['limit']);_0x244d6d['offset']=qs['offset'](_0x5b76fb[_0x9b86('0x33')][_0x9b86('0x23')]);}return _0x539c77[_0x9b86('0x52')](_0x244d6d);}})[_0x9b86('0x29')](function(_0x7eab2c){if(_0x7eab2c){return _0x7eab2c?{'count':_0x4f503c,'rows':_0x7eab2c}:null;}})[_0x9b86('0x29')](respondWithResult(_0x383b2e,null))[_0x9b86('0x4a')](handleError(_0x383b2e,null));};exports[_0x9b86('0x54')]=function(_0x2a71db,_0x5d1567,_0x33d48d){var _0x4e71fb={};var _0x1b92c6={};var _0x194b07;var _0xf3e77d;return db['VtigerConfiguration'][_0x9b86('0x4f')]({'where':{'id':_0x2a71db[_0x9b86('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d1567,null))[_0x9b86('0x29')](function(_0x26ac65){if(_0x26ac65){_0x194b07=_0x26ac65;_0x1b92c6['model']=_[_0x9b86('0x34')](db['VtigerField'][_0x9b86('0x47')]);_0x1b92c6[_0x9b86('0x33')]=_[_0x9b86('0x34')](_0x2a71db[_0x9b86('0x33')]);_0x1b92c6[_0x9b86('0x35')]=_[_0x9b86('0x36')](_0x1b92c6[_0x9b86('0x32')],_0x1b92c6[_0x9b86('0x33')]);_0x4e71fb[_0x9b86('0x37')]=_[_0x9b86('0x36')](_0x1b92c6[_0x9b86('0x32')],qs[_0x9b86('0x48')](_0x2a71db[_0x9b86('0x33')][_0x9b86('0x48')]));_0x4e71fb[_0x9b86('0x37')]=_0x4e71fb[_0x9b86('0x37')][_0x9b86('0x38')]?_0x4e71fb[_0x9b86('0x37')]:_0x1b92c6[_0x9b86('0x32')];_0x4e71fb[_0x9b86('0x3b')]=qs['sort'](_0x2a71db[_0x9b86('0x33')][_0x9b86('0x50')]);_0x4e71fb[_0x9b86('0x3e')]=qs['filters'](_[_0x9b86('0x3c')](_0x2a71db[_0x9b86('0x33')],_0x1b92c6['filters']));if(_0x2a71db[_0x9b86('0x33')][_0x9b86('0x3d')]){_0x4e71fb['where']=_['merge'](_0x4e71fb[_0x9b86('0x3e')],{'$or':_['map'](_0x4e71fb[_0x9b86('0x37')],function(_0x4e46ab){var _0x1e6ded={};_0x1e6ded[_0x4e46ab]={'$like':'%'+_0x2a71db[_0x9b86('0x33')][_0x9b86('0x3d')]+'%'};return _0x1e6ded;})});}_0x4e71fb=_[_0x9b86('0x3f')]({},_0x4e71fb,_0x2a71db[_0x9b86('0x40')]);return _0x194b07[_0x9b86('0x54')](_0x4e71fb);}})[_0x9b86('0x29')](function(_0x393308){if(_0x393308){_0xf3e77d=_0x393308[_0x9b86('0x38')];if(!_0x2a71db['query']['hasOwnProperty'](_0x9b86('0x3a'))){_0x4e71fb['limit']=qs['limit'](_0x2a71db[_0x9b86('0x33')][_0x9b86('0x24')]);_0x4e71fb[_0x9b86('0x23')]=qs['offset'](_0x2a71db[_0x9b86('0x33')][_0x9b86('0x23')]);}return _0x194b07[_0x9b86('0x54')](_0x4e71fb);}})[_0x9b86('0x29')](function(_0x3d4b5f){if(_0x3d4b5f){return _0x3d4b5f?{'count':_0xf3e77d,'rows':_0x3d4b5f}:null;}})[_0x9b86('0x29')](respondWithResult(_0x5d1567,null))[_0x9b86('0x4a')](handleError(_0x5d1567,null));}; \ No newline at end of file +var _0x0751=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getFields','findOne','VtigerField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch'];(function(_0x430dbd,_0x42b0bf){var _0x21b29a=function(_0x284c1f){while(--_0x284c1f){_0x430dbd['push'](_0x430dbd['shift']());}};_0x21b29a(++_0x42b0bf);}(_0x0751,0xd6));var _0x1075=function(_0x4fcfe9,_0x34b80c){_0x4fcfe9=_0x4fcfe9-0x0;var _0x355e21=_0x0751[_0x4fcfe9];return _0x355e21;};'use strict';var emlformat=require(_0x1075('0x0'));var rimraf=require(_0x1075('0x1'));var zipdir=require(_0x1075('0x2'));var jsonpatch=require(_0x1075('0x3'));var rp=require('request-promise');var moment=require(_0x1075('0x4'));var BPromise=require(_0x1075('0x5'));var Mustache=require(_0x1075('0x6'));var util=require(_0x1075('0x7'));var path=require('path');var sox=require(_0x1075('0x8'));var csv=require(_0x1075('0x9'));var ejs=require(_0x1075('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1075('0xb'));var squel=require('squel');var crypto=require(_0x1075('0xc'));var jsforce=require(_0x1075('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1075('0xe'));var Papa=require(_0x1075('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1075('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1075('0x11'))(_0x1075('0x12'));var utils=require(_0x1075('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1075('0x14'));var db=require(_0x1075('0x15'))['db'];function respondWithStatusCode(_0x610a88,_0x586e7a){_0x586e7a=_0x586e7a||0xcc;return function(_0x13df29){if(_0x13df29){return _0x610a88[_0x1075('0x16')](_0x586e7a);}return _0x610a88['status'](_0x586e7a)['end']();};}function respondWithResult(_0x57dade,_0x4939ec){_0x4939ec=_0x4939ec||0xc8;return function(_0x1584ff){if(_0x1584ff){return _0x57dade[_0x1075('0x17')](_0x4939ec)[_0x1075('0x18')](_0x1584ff);}};}function respondWithFilteredResult(_0x594d49,_0x456c59){return function(_0x1cfde9){if(_0x1cfde9){var _0x47b620=typeof _0x456c59[_0x1075('0x19')]===_0x1075('0x1a')&&typeof _0x456c59[_0x1075('0x1b')]===_0x1075('0x1a');var _0x3a052c=_0x1cfde9['count'];var _0x204be8=_0x47b620?0x0:_0x456c59[_0x1075('0x19')];var _0x4cebaa=_0x47b620?_0x1cfde9[_0x1075('0x1c')]:_0x456c59['offset']+_0x456c59['limit'];var _0x1333d5;if(_0x4cebaa>=_0x3a052c){_0x4cebaa=_0x3a052c;_0x1333d5=0xc8;}else{_0x1333d5=0xce;}_0x594d49['status'](_0x1333d5);return _0x594d49['set'](_0x1075('0x1d'),_0x204be8+'-'+_0x4cebaa+'/'+_0x3a052c)[_0x1075('0x18')](_0x1cfde9);}return null;};}function patchUpdates(_0x4f3222){return function(_0x8419){try{jsonpatch['apply'](_0x8419,_0x4f3222,!![]);}catch(_0x8be006){return BPromise[_0x1075('0x1e')](_0x8be006);}return _0x8419[_0x1075('0x1f')]();};}function saveUpdates(_0x29f0d8,_0x141ef6){return function(_0x38a6d5){if(_0x38a6d5){return _0x38a6d5[_0x1075('0x20')](_0x29f0d8)[_0x1075('0x21')](function(_0x182838){return _0x182838;});}return null;};}function removeEntity(_0x302d93,_0xc6c1a6){return function(_0x36af7f){if(_0x36af7f){return _0x36af7f[_0x1075('0x22')]()['then'](function(){_0x302d93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30be42,_0x312137){return function(_0x246448){if(!_0x246448){_0x30be42[_0x1075('0x16')](0x194);}return _0x246448;};}function handleError(_0x3b18ac,_0x3d844b){_0x3d844b=_0x3d844b||0x1f4;return function(_0xeb39f6){logger[_0x1075('0x23')](_0xeb39f6[_0x1075('0x24')]);if(_0xeb39f6[_0x1075('0x25')]){delete _0xeb39f6[_0x1075('0x25')];}_0x3b18ac[_0x1075('0x17')](_0x3d844b)['send'](_0xeb39f6);};}exports[_0x1075('0x26')]=function(_0x213a4d,_0x2658a8){var _0x1aa07c={},_0x20d3f8={},_0x4c2123={'count':0x0,'rows':[]};var _0x5b9749=_[_0x1075('0x27')](db[_0x1075('0x28')][_0x1075('0x29')],function(_0x572468){return{'name':_0x572468[_0x1075('0x2a')],'type':_0x572468[_0x1075('0x2b')]['key']};});_0x20d3f8[_0x1075('0x2c')]=_[_0x1075('0x27')](_0x5b9749,_0x1075('0x25'));_0x20d3f8['query']=_[_0x1075('0x2d')](_0x213a4d[_0x1075('0x2e')]);_0x20d3f8['filters']=_[_0x1075('0x2f')](_0x20d3f8[_0x1075('0x2c')],_0x20d3f8[_0x1075('0x2e')]);_0x1aa07c[_0x1075('0x30')]=_[_0x1075('0x2f')](_0x20d3f8[_0x1075('0x2c')],qs['fields'](_0x213a4d[_0x1075('0x2e')][_0x1075('0x31')]));_0x1aa07c[_0x1075('0x30')]=_0x1aa07c[_0x1075('0x30')]['length']?_0x1aa07c['attributes']:_0x20d3f8[_0x1075('0x2c')];if(!_0x213a4d[_0x1075('0x2e')]['hasOwnProperty']('nolimit')){_0x1aa07c[_0x1075('0x1b')]=qs[_0x1075('0x1b')](_0x213a4d[_0x1075('0x2e')]['limit']);_0x1aa07c[_0x1075('0x19')]=qs[_0x1075('0x19')](_0x213a4d[_0x1075('0x2e')][_0x1075('0x19')]);}_0x1aa07c[_0x1075('0x32')]=qs[_0x1075('0x33')](_0x213a4d[_0x1075('0x2e')][_0x1075('0x33')]);_0x1aa07c[_0x1075('0x34')]=qs[_0x1075('0x35')](_[_0x1075('0x36')](_0x213a4d['query'],_0x20d3f8['filters']),_0x5b9749);if(_0x213a4d[_0x1075('0x2e')][_0x1075('0x37')]){_0x1aa07c[_0x1075('0x34')]=_[_0x1075('0x38')](_0x1aa07c[_0x1075('0x34')],{'$or':_[_0x1075('0x27')](_0x5b9749,function(_0x3ca4e0){if(_0x3ca4e0[_0x1075('0x2b')]!==_0x1075('0x39')){var _0x38395b={};_0x38395b[_0x3ca4e0[_0x1075('0x25')]]={'$like':'%'+_0x213a4d[_0x1075('0x2e')]['filter']+'%'};return _0x38395b;}})});}_0x1aa07c=_[_0x1075('0x38')]({},_0x1aa07c,_0x213a4d[_0x1075('0x3a')]);var _0x18dd32={'where':_0x1aa07c[_0x1075('0x34')]};return db[_0x1075('0x28')][_0x1075('0x1c')](_0x18dd32)['then'](function(_0x4b575f){_0x4c2123[_0x1075('0x1c')]=_0x4b575f;if(_0x213a4d[_0x1075('0x2e')]['includeAll']){_0x1aa07c['include']=[{'all':!![]}];}return db[_0x1075('0x28')][_0x1075('0x3b')](_0x1aa07c);})['then'](function(_0xd79971){_0x4c2123[_0x1075('0x3c')]=_0xd79971;return _0x4c2123;})[_0x1075('0x21')](respondWithFilteredResult(_0x2658a8,_0x1aa07c))[_0x1075('0x3d')](handleError(_0x2658a8,null));};exports[_0x1075('0x3e')]=function(_0x4f2395,_0x4ac273){var _0x438a13={'raw':![],'where':{'id':_0x4f2395[_0x1075('0x3f')]['id']}},_0x250840={};_0x250840[_0x1075('0x2c')]=_[_0x1075('0x2d')](db[_0x1075('0x28')]['rawAttributes']);_0x250840['query']=_[_0x1075('0x2d')](_0x4f2395[_0x1075('0x2e')]);_0x250840[_0x1075('0x35')]=_[_0x1075('0x2f')](_0x250840[_0x1075('0x2c')],_0x250840[_0x1075('0x2e')]);_0x438a13[_0x1075('0x30')]=_[_0x1075('0x2f')](_0x250840[_0x1075('0x2c')],qs[_0x1075('0x31')](_0x4f2395[_0x1075('0x2e')][_0x1075('0x31')]));_0x438a13[_0x1075('0x30')]=_0x438a13[_0x1075('0x30')][_0x1075('0x40')]?_0x438a13['attributes']:_0x250840[_0x1075('0x2c')];if(_0x4f2395[_0x1075('0x2e')][_0x1075('0x41')]){_0x438a13[_0x1075('0x42')]=[{'all':!![]}];}_0x438a13=_[_0x1075('0x38')]({},_0x438a13,_0x4f2395[_0x1075('0x3a')]);return db['VtigerConfiguration'][_0x1075('0x43')](_0x438a13)[_0x1075('0x21')](handleEntityNotFound(_0x4ac273,null))['then'](respondWithResult(_0x4ac273,null))['catch'](handleError(_0x4ac273,null));};exports[_0x1075('0x44')]=function(_0x198338,_0x15bca5){return db['VtigerConfiguration'][_0x1075('0x44')](_0x198338['body'],{})[_0x1075('0x21')](respondWithResult(_0x15bca5,0xc9))['catch'](handleError(_0x15bca5,null));};exports[_0x1075('0x20')]=function(_0x1de465,_0x22d0eb){if(_0x1de465[_0x1075('0x45')]['id']){delete _0x1de465[_0x1075('0x45')]['id'];}return db[_0x1075('0x28')][_0x1075('0x43')]({'where':{'id':_0x1de465[_0x1075('0x3f')]['id']}})['then'](handleEntityNotFound(_0x22d0eb,null))[_0x1075('0x21')](saveUpdates(_0x1de465[_0x1075('0x45')],null))[_0x1075('0x21')](respondWithResult(_0x22d0eb,null))['catch'](handleError(_0x22d0eb,null));};exports[_0x1075('0x22')]=function(_0x319454,_0x4e80ea){return db[_0x1075('0x28')][_0x1075('0x43')]({'where':{'id':_0x319454[_0x1075('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e80ea,null))['then'](removeEntity(_0x4e80ea,null))['catch'](handleError(_0x4e80ea,null));};exports[_0x1075('0x46')]=function(_0x41a262,_0x43b463,_0x16efa8){var _0x25fdaf={};var _0xdc1ff3={};var _0x11565f;var _0x5c10a3;return db['VtigerConfiguration'][_0x1075('0x47')]({'where':{'id':_0x41a262[_0x1075('0x3f')]['id']}})[_0x1075('0x21')](handleEntityNotFound(_0x43b463,null))[_0x1075('0x21')](function(_0x24425c){if(_0x24425c){_0x11565f=_0x24425c;_0xdc1ff3[_0x1075('0x2c')]=_[_0x1075('0x2d')](db[_0x1075('0x48')][_0x1075('0x29')]);_0xdc1ff3[_0x1075('0x2e')]=_['keys'](_0x41a262[_0x1075('0x2e')]);_0xdc1ff3[_0x1075('0x35')]=_[_0x1075('0x2f')](_0xdc1ff3['model'],_0xdc1ff3[_0x1075('0x2e')]);_0x25fdaf[_0x1075('0x30')]=_[_0x1075('0x2f')](_0xdc1ff3['model'],qs['fields'](_0x41a262[_0x1075('0x2e')][_0x1075('0x31')]));_0x25fdaf[_0x1075('0x30')]=_0x25fdaf[_0x1075('0x30')][_0x1075('0x40')]?_0x25fdaf[_0x1075('0x30')]:_0xdc1ff3[_0x1075('0x2c')];_0x25fdaf[_0x1075('0x32')]=qs[_0x1075('0x33')](_0x41a262[_0x1075('0x2e')][_0x1075('0x33')]);_0x25fdaf[_0x1075('0x34')]=qs['filters'](_[_0x1075('0x36')](_0x41a262['query'],_0xdc1ff3[_0x1075('0x35')]));if(_0x41a262[_0x1075('0x2e')][_0x1075('0x37')]){_0x25fdaf['where']=_['merge'](_0x25fdaf['where'],{'$or':_[_0x1075('0x27')](_0x25fdaf[_0x1075('0x30')],function(_0x313982){var _0x84c4f6={};_0x84c4f6[_0x313982]={'$like':'%'+_0x41a262[_0x1075('0x2e')][_0x1075('0x37')]+'%'};return _0x84c4f6;})});}_0x25fdaf=_[_0x1075('0x38')]({},_0x25fdaf,_0x41a262[_0x1075('0x3a')]);return _0x11565f['getFields'](_0x25fdaf);}})[_0x1075('0x21')](function(_0x579af8){if(_0x579af8){_0x5c10a3=_0x579af8[_0x1075('0x40')];if(!_0x41a262[_0x1075('0x2e')][_0x1075('0x49')](_0x1075('0x4a'))){_0x25fdaf['limit']=qs['limit'](_0x41a262[_0x1075('0x2e')][_0x1075('0x1b')]);_0x25fdaf[_0x1075('0x19')]=qs['offset'](_0x41a262[_0x1075('0x2e')][_0x1075('0x19')]);}return _0x11565f['getFields'](_0x25fdaf);}})[_0x1075('0x21')](function(_0x5b4fdc){if(_0x5b4fdc){return _0x5b4fdc?{'count':_0x5c10a3,'rows':_0x5b4fdc}:null;}})['then'](respondWithResult(_0x43b463,null))['catch'](handleError(_0x43b463,null));};exports['getSubjects']=function(_0x382a1c,_0x5bce3b,_0x12fc50){var _0x34ea11={};var _0x32a06e={};var _0x3d2703;var _0x8f7e86;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x382a1c[_0x1075('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5bce3b,null))[_0x1075('0x21')](function(_0x40b8cd){if(_0x40b8cd){_0x3d2703=_0x40b8cd;_0x32a06e[_0x1075('0x2c')]=_[_0x1075('0x2d')](db[_0x1075('0x48')][_0x1075('0x29')]);_0x32a06e[_0x1075('0x2e')]=_['keys'](_0x382a1c[_0x1075('0x2e')]);_0x32a06e[_0x1075('0x35')]=_[_0x1075('0x2f')](_0x32a06e['model'],_0x32a06e['query']);_0x34ea11[_0x1075('0x30')]=_[_0x1075('0x2f')](_0x32a06e[_0x1075('0x2c')],qs[_0x1075('0x31')](_0x382a1c['query']['fields']));_0x34ea11[_0x1075('0x30')]=_0x34ea11[_0x1075('0x30')][_0x1075('0x40')]?_0x34ea11['attributes']:_0x32a06e[_0x1075('0x2c')];_0x34ea11[_0x1075('0x32')]=qs['sort'](_0x382a1c[_0x1075('0x2e')][_0x1075('0x33')]);_0x34ea11[_0x1075('0x34')]=qs['filters'](_[_0x1075('0x36')](_0x382a1c[_0x1075('0x2e')],_0x32a06e[_0x1075('0x35')]));if(_0x382a1c[_0x1075('0x2e')]['filter']){_0x34ea11[_0x1075('0x34')]=_[_0x1075('0x38')](_0x34ea11[_0x1075('0x34')],{'$or':_['map'](_0x34ea11[_0x1075('0x30')],function(_0xb2d3e0){var _0x3bbe4b={};_0x3bbe4b[_0xb2d3e0]={'$like':'%'+_0x382a1c[_0x1075('0x2e')][_0x1075('0x37')]+'%'};return _0x3bbe4b;})});}_0x34ea11=_[_0x1075('0x38')]({},_0x34ea11,_0x382a1c[_0x1075('0x3a')]);return _0x3d2703['getSubjects'](_0x34ea11);}})[_0x1075('0x21')](function(_0x2b1f8a){if(_0x2b1f8a){_0x8f7e86=_0x2b1f8a[_0x1075('0x40')];if(!_0x382a1c[_0x1075('0x2e')][_0x1075('0x49')](_0x1075('0x4a'))){_0x34ea11[_0x1075('0x1b')]=qs[_0x1075('0x1b')](_0x382a1c[_0x1075('0x2e')]['limit']);_0x34ea11[_0x1075('0x19')]=qs[_0x1075('0x19')](_0x382a1c[_0x1075('0x2e')]['offset']);}return _0x3d2703[_0x1075('0x4b')](_0x34ea11);}})[_0x1075('0x21')](function(_0x358f70){if(_0x358f70){return _0x358f70?{'count':_0x8f7e86,'rows':_0x358f70}:null;}})[_0x1075('0x21')](respondWithResult(_0x5bce3b,null))[_0x1075('0x3d')](handleError(_0x5bce3b,null));};exports[_0x1075('0x4c')]=function(_0x597767,_0x4d6f18,_0x476147){var _0x435e9d={};var _0x167fba={};var _0x2634d6;var _0x71a77d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x597767[_0x1075('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d6f18,null))[_0x1075('0x21')](function(_0x4f1492){if(_0x4f1492){_0x2634d6=_0x4f1492;_0x167fba[_0x1075('0x2c')]=_[_0x1075('0x2d')](db[_0x1075('0x48')]['rawAttributes']);_0x167fba[_0x1075('0x2e')]=_[_0x1075('0x2d')](_0x597767[_0x1075('0x2e')]);_0x167fba[_0x1075('0x35')]=_['intersection'](_0x167fba[_0x1075('0x2c')],_0x167fba['query']);_0x435e9d['attributes']=_[_0x1075('0x2f')](_0x167fba['model'],qs[_0x1075('0x31')](_0x597767[_0x1075('0x2e')]['fields']));_0x435e9d[_0x1075('0x30')]=_0x435e9d[_0x1075('0x30')]['length']?_0x435e9d['attributes']:_0x167fba['model'];_0x435e9d[_0x1075('0x32')]=qs[_0x1075('0x33')](_0x597767[_0x1075('0x2e')][_0x1075('0x33')]);_0x435e9d[_0x1075('0x34')]=qs['filters'](_[_0x1075('0x36')](_0x597767[_0x1075('0x2e')],_0x167fba['filters']));if(_0x597767['query']['filter']){_0x435e9d[_0x1075('0x34')]=_[_0x1075('0x38')](_0x435e9d['where'],{'$or':_[_0x1075('0x27')](_0x435e9d[_0x1075('0x30')],function(_0x22d4c9){var _0x292ff0={};_0x292ff0[_0x22d4c9]={'$like':'%'+_0x597767[_0x1075('0x2e')]['filter']+'%'};return _0x292ff0;})});}_0x435e9d=_[_0x1075('0x38')]({},_0x435e9d,_0x597767[_0x1075('0x3a')]);return _0x2634d6['getDescriptions'](_0x435e9d);}})[_0x1075('0x21')](function(_0x265dce){if(_0x265dce){_0x71a77d=_0x265dce[_0x1075('0x40')];if(!_0x597767[_0x1075('0x2e')][_0x1075('0x49')](_0x1075('0x4a'))){_0x435e9d['limit']=qs[_0x1075('0x1b')](_0x597767[_0x1075('0x2e')]['limit']);_0x435e9d[_0x1075('0x19')]=qs[_0x1075('0x19')](_0x597767[_0x1075('0x2e')][_0x1075('0x19')]);}return _0x2634d6[_0x1075('0x4c')](_0x435e9d);}})['then'](function(_0x222c24){if(_0x222c24){return _0x222c24?{'count':_0x71a77d,'rows':_0x222c24}:null;}})[_0x1075('0x21')](respondWithResult(_0x4d6f18,null))['catch'](handleError(_0x4d6f18,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 64a365c..da1300c 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 _0xbe4b=['../../config/logger','api','moment','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x517aba,_0x4814e5){var _0x246abe=function(_0x36b7a9){while(--_0x36b7a9){_0x517aba['push'](_0x517aba['shift']());}};_0x246abe(++_0x4814e5);}(_0xbe4b,0x149));var _0xbbe4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbe4b[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0xbbe4('0x0'));var logger=require(_0xbbe4('0x1'))(_0xbbe4('0x2'));var moment=require(_0xbbe4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbe4('0x4'));var config=require('../../config/environment');var attributes=require(_0xbbe4('0x5'));module[_0xbbe4('0x6')]=function(_0x39b811,_0x5f106a){return _0x39b811[_0xbbe4('0x7')](_0xbbe4('0x8'),attributes,{'tableName':_0xbbe4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dc3=['rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x289684,_0x130639){var _0x5ad588=function(_0x38e0a6){while(--_0x38e0a6){_0x289684['push'](_0x289684['shift']());}};_0x5ad588(++_0x130639);}(_0x1dc3,0x139));var _0x31dc=function(_0x1880ff,_0x1a0cce){_0x1880ff=_0x1880ff-0x0;var _0x4e3856=_0x1dc3[_0x1880ff];return _0x4e3856;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x31dc('0x0'))(_0x31dc('0x1'));var moment=require(_0x31dc('0x2'));var BPromise=require(_0x31dc('0x3'));var rp=require(_0x31dc('0x4'));var fs=require('fs');var path=require(_0x31dc('0x5'));var rimraf=require(_0x31dc('0x6'));var config=require('../../config/environment');var attributes=require(_0x31dc('0x7'));module[_0x31dc('0x8')]=function(_0x3ef35f,_0x39efef){return _0x3ef35f[_0x31dc('0x9')](_0x31dc('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9c47836..48dbd61 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 _0x133c=['request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3022b1,_0x33bc87){var _0x11518f=function(_0x5c0de4){while(--_0x5c0de4){_0x3022b1['push'](_0x3022b1['shift']());}};_0x11518f(++_0x33bc87);}(_0x133c,0x1c2));var _0xc133=function(_0x1f7a7e,_0x3ac087){_0x1f7a7e=_0x1f7a7e-0x0;var _0x18f367=_0x133c[_0x1f7a7e];return _0x18f367;};'use strict';var _=require(_0xc133('0x0'));var util=require(_0xc133('0x1'));var moment=require(_0xc133('0x2'));var BPromise=require(_0xc133('0x3'));var rs=require(_0xc133('0x4'));var fs=require('fs');var Redis=require(_0xc133('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc133('0x6'));var logger=require(_0xc133('0x7'))(_0xc133('0x8'));var config=require(_0xc133('0x9'));var jayson=require(_0xc133('0xa'));var client=jayson['client'][_0xc133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2923db,_0x1d0c30,_0x179f83){return new BPromise(function(_0x1565f1,_0x2f5e00){return client[_0xc133('0xc')](_0x2923db,_0x179f83)[_0xc133('0xd')](function(_0x1d7404){logger[_0xc133('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x1d0c30,'request\x20sent');logger[_0xc133('0xf')](_0xc133('0x10'),_0x1d0c30,'request\x20sent',JSON['stringify'](_0x1d7404));if(_0x1d7404['error']){if(_0x1d7404[_0xc133('0x11')][_0xc133('0x12')]===0x1f4){logger[_0xc133('0x11')](_0xc133('0x13'),_0x1d0c30,_0x1d7404[_0xc133('0x11')][_0xc133('0x14')]);return _0x2f5e00(_0x1d7404[_0xc133('0x11')]['message']);}logger[_0xc133('0x11')](_0xc133('0x13'),_0x1d0c30,_0x1d7404['error'][_0xc133('0x14')]);return _0x1565f1(_0x1d7404[_0xc133('0x11')]['message']);}else{logger[_0xc133('0xe')](_0xc133('0x13'),_0x1d0c30,_0xc133('0x15'));_0x1565f1(_0x1d7404['result'][_0xc133('0x14')]);}})['catch'](function(_0x57e417){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1d0c30,_0x57e417);_0x2f5e00(_0x57e417);});});} \ No newline at end of file +var _0x8a85=['then','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39f297,_0x183fc5){var _0x1fc96f=function(_0x12f041){while(--_0x12f041){_0x39f297['push'](_0x39f297['shift']());}};_0x1fc96f(++_0x183fc5);}(_0x8a85,0x64));var _0x58a8=function(_0x36a0e0,_0x31e3e9){_0x36a0e0=_0x36a0e0-0x0;var _0x4d8a5b=_0x8a85[_0x36a0e0];return _0x4d8a5b;};'use strict';var _=require('lodash');var util=require(_0x58a8('0x0'));var moment=require('moment');var BPromise=require(_0x58a8('0x1'));var rs=require(_0x58a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58a8('0x3'));var logger=require(_0x58a8('0x4'))(_0x58a8('0x5'));var config=require(_0x58a8('0x6'));var jayson=require(_0x58a8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b35d4,_0x17824c,_0x32f0d3){return new BPromise(function(_0x474aac,_0x1aceb1){return client['request'](_0x2b35d4,_0x32f0d3)[_0x58a8('0x8')](function(_0x427f42){logger[_0x58a8('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x17824c,'request\x20sent');logger['debug'](_0x58a8('0xa'),_0x17824c,_0x58a8('0xb'),JSON[_0x58a8('0xc')](_0x427f42));if(_0x427f42[_0x58a8('0xd')]){if(_0x427f42[_0x58a8('0xd')][_0x58a8('0xe')]===0x1f4){logger[_0x58a8('0xd')](_0x58a8('0xf'),_0x17824c,_0x427f42['error'][_0x58a8('0x10')]);return _0x1aceb1(_0x427f42[_0x58a8('0xd')][_0x58a8('0x10')]);}logger[_0x58a8('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x17824c,_0x427f42[_0x58a8('0xd')][_0x58a8('0x10')]);return _0x474aac(_0x427f42[_0x58a8('0xd')]['message']);}else{logger[_0x58a8('0x9')](_0x58a8('0xf'),_0x17824c,_0x58a8('0xb'));_0x474aac(_0x427f42[_0x58a8('0x11')][_0x58a8('0x10')]);}})['catch'](function(_0x1e45cf){logger['error'](_0x58a8('0xf'),_0x17824c,_0x1e45cf);_0x1aceb1(_0x1e45cf);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 01e9163..b0bc110 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 _0x6874=['../../config/environment','./intVtigerField.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x396f6a,_0x804e0c){var _0x1a3a53=function(_0x352196){while(--_0x352196){_0x396f6a['push'](_0x396f6a['shift']());}};_0x1a3a53(++_0x804e0c);}(_0x6874,0x133));var _0x4687=function(_0x180fda,_0x1af14f){_0x180fda=_0x180fda-0x0;var _0x3bddc9=_0x6874[_0x180fda];return _0x3bddc9;};'use strict';var multer=require(_0x4687('0x0'));var util=require(_0x4687('0x1'));var path=require(_0x4687('0x2'));var timeout=require('connect-timeout');var express=require(_0x4687('0x3'));var router=express[_0x4687('0x4')]();var fs_extra=require(_0x4687('0x5'));var auth=require(_0x4687('0x6'));var interaction=require(_0x4687('0x7'));var config=require(_0x4687('0x8'));var controller=require(_0x4687('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4687('0xa')]);router[_0x4687('0xb')](_0x4687('0xc'),auth[_0x4687('0xd')](),controller['show']);router[_0x4687('0xe')]('/',auth['isAuthenticated'](),controller[_0x4687('0xf')]);router[_0x4687('0x10')](_0x4687('0xc'),auth[_0x4687('0xd')](),controller[_0x4687('0x11')]);router[_0x4687('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4687('0x13')]);module[_0x4687('0x14')]=router; \ No newline at end of file +var _0x1dc3=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','/:id','update','destroy','exports','multer'];(function(_0x324efa,_0x12cf8e){var _0x4f69c9=function(_0x265b77){while(--_0x265b77){_0x324efa['push'](_0x324efa['shift']());}};_0x4f69c9(++_0x12cf8e);}(_0x1dc3,0xe3));var _0x31dc=function(_0x190cdc,_0xc0b8bc){_0x190cdc=_0x190cdc-0x0;var _0x3d0eec=_0x1dc3[_0x190cdc];return _0x3d0eec;};'use strict';var multer=require(_0x31dc('0x0'));var util=require(_0x31dc('0x1'));var path=require(_0x31dc('0x2'));var timeout=require(_0x31dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x31dc('0x4'));var auth=require(_0x31dc('0x5'));var interaction=require(_0x31dc('0x6'));var config=require(_0x31dc('0x7'));var controller=require(_0x31dc('0x8'));router[_0x31dc('0x9')]('/',auth[_0x31dc('0xa')](),controller[_0x31dc('0xb')]);router[_0x31dc('0x9')]('/:id',auth[_0x31dc('0xa')](),controller[_0x31dc('0xc')]);router[_0x31dc('0xd')]('/',auth[_0x31dc('0xa')](),controller[_0x31dc('0xe')]);router['put'](_0x31dc('0xf'),auth[_0x31dc('0xa')](),controller[_0x31dc('0x10')]);router['delete']('/:id',auth[_0x31dc('0xa')](),controller[_0x31dc('0x11')]);module[_0x31dc('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 6c3a80e..4cbf2ed 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 _0xeb42=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xeb42,0x1e0));var _0x2eb4=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xeb42[_0xa8883];return _0x479426;};'use strict';var Sequelize=require('sequelize');module[_0x2eb4('0x0')]={'type':{'type':Sequelize[_0x2eb4('0x1')](_0x2eb4('0x2'),_0x2eb4('0x3'),_0x2eb4('0x4'),_0x2eb4('0x5'),'picklist'),'defaultValue':_0x2eb4('0x2')},'content':{'type':Sequelize[_0x2eb4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x2eb4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2eb4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2eb4('0x6')]},'customField':{'type':Sequelize[_0x2eb4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2eb4('0x6')]}}; \ No newline at end of file +var _0x5243=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x5243,0x131));var _0x3524=function(_0x4ff323,_0x307ad7){_0x4ff323=_0x4ff323-0x0;var _0x211819=_0x5243[_0x4ff323];return _0x211819;};'use strict';var Sequelize=require(_0x3524('0x0'));module[_0x3524('0x1')]={'type':{'type':Sequelize[_0x3524('0x2')](_0x3524('0x3'),_0x3524('0x4'),_0x3524('0x5'),_0x3524('0x6'),_0x3524('0x7')),'defaultValue':_0x3524('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3524('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x3524('0x3'),_0x3524('0x4'),_0x3524('0x5'))},'keyContent':{'type':Sequelize[_0x3524('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3524('0x8')]},'customField':{'type':Sequelize[_0x3524('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3524('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9a7a20c..d240e1b 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 _0x18e4=['hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x18e4,0x1ce));var _0x418e=function(_0x41cd34,_0x32cd0c){_0x41cd34=_0x41cd34-0x0;var _0x1273e8=_0x18e4[_0x41cd34];return _0x1273e8;};'use strict';var emlformat=require(_0x418e('0x0'));var rimraf=require(_0x418e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x418e('0x2'));var rp=require(_0x418e('0x3'));var moment=require(_0x418e('0x4'));var BPromise=require(_0x418e('0x5'));var Mustache=require('mustache');var util=require(_0x418e('0x6'));var path=require(_0x418e('0x7'));var sox=require('sox');var csv=require(_0x418e('0x8'));var ejs=require(_0x418e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x418e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x418e('0xb'));var toCsv=require(_0x418e('0x8'));var querystring=require(_0x418e('0xc'));var Papa=require(_0x418e('0xd'));var Redis=require(_0x418e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x418e('0xf'));var as=require(_0x418e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x418e('0x11'))(_0x418e('0x12'));var utils=require(_0x418e('0x13'));var config=require(_0x418e('0x14'));var licenseUtil=require(_0x418e('0x15'));var db=require(_0x418e('0x16'))['db'];function respondWithStatusCode(_0x582989,_0x546177){_0x546177=_0x546177||0xcc;return function(_0xfa642c){if(_0xfa642c){return _0x582989[_0x418e('0x17')](_0x546177);}return _0x582989['status'](_0x546177)[_0x418e('0x18')]();};}function respondWithResult(_0xdcb21d,_0x582894){_0x582894=_0x582894||0xc8;return function(_0x569ee4){if(_0x569ee4){return _0xdcb21d[_0x418e('0x19')](_0x582894)[_0x418e('0x1a')](_0x569ee4);}};}function respondWithFilteredResult(_0x4dae51,_0x2effc7){return function(_0x20bc19){if(_0x20bc19){var _0x436853=typeof _0x2effc7['offset']===_0x418e('0x1b')&&typeof _0x2effc7[_0x418e('0x1c')]==='undefined';var _0x178ed9=_0x20bc19['count'];var _0x31b892=_0x436853?0x0:_0x2effc7[_0x418e('0x1d')];var _0x31da96=_0x436853?_0x20bc19[_0x418e('0x1e')]:_0x2effc7[_0x418e('0x1d')]+_0x2effc7['limit'];var _0x5e4ebc;if(_0x31da96>=_0x178ed9){_0x31da96=_0x178ed9;_0x5e4ebc=0xc8;}else{_0x5e4ebc=0xce;}_0x4dae51['status'](_0x5e4ebc);return _0x4dae51[_0x418e('0x1f')](_0x418e('0x20'),_0x31b892+'-'+_0x31da96+'/'+_0x178ed9)[_0x418e('0x1a')](_0x20bc19);}return null;};}function patchUpdates(_0x104307){return function(_0x39dac3){try{jsonpatch[_0x418e('0x21')](_0x39dac3,_0x104307,!![]);}catch(_0x109015){return BPromise[_0x418e('0x22')](_0x109015);}return _0x39dac3[_0x418e('0x23')]();};}function saveUpdates(_0x545244,_0x3d33ef){return function(_0x36eb40){if(_0x36eb40){return _0x36eb40[_0x418e('0x24')](_0x545244)[_0x418e('0x25')](function(_0x371697){return _0x371697;});}return null;};}function removeEntity(_0x3342d3,_0x5e9baf){return function(_0x3924f2){if(_0x3924f2){return _0x3924f2[_0x418e('0x26')]()['then'](function(){_0x3342d3[_0x418e('0x19')](0xcc)[_0x418e('0x18')]();});}};}function handleEntityNotFound(_0x3e7eb3,_0xcaa91c){return function(_0x158c58){if(!_0x158c58){_0x3e7eb3[_0x418e('0x17')](0x194);}return _0x158c58;};}function handleError(_0x12d594,_0x4af1c1){_0x4af1c1=_0x4af1c1||0x1f4;return function(_0xcfa835){logger[_0x418e('0x27')](_0xcfa835[_0x418e('0x28')]);if(_0xcfa835[_0x418e('0x29')]){delete _0xcfa835[_0x418e('0x29')];}_0x12d594[_0x418e('0x19')](_0x4af1c1)[_0x418e('0x2a')](_0xcfa835);};}exports['index']=function(_0xb2ca98,_0x421b0e){var _0x30daea={},_0x4c1407={},_0x55fd05={'count':0x0,'rows':[]};var _0x3fd21b=_['map'](db[_0x418e('0x2b')][_0x418e('0x2c')],function(_0x314e1c){return{'name':_0x314e1c[_0x418e('0x2d')],'type':_0x314e1c[_0x418e('0x2e')][_0x418e('0x2f')]};});_0x4c1407[_0x418e('0x30')]=_['map'](_0x3fd21b,_0x418e('0x29'));_0x4c1407['query']=_[_0x418e('0x31')](_0xb2ca98[_0x418e('0x32')]);_0x4c1407[_0x418e('0x33')]=_[_0x418e('0x34')](_0x4c1407[_0x418e('0x30')],_0x4c1407[_0x418e('0x32')]);_0x30daea[_0x418e('0x35')]=_[_0x418e('0x34')](_0x4c1407[_0x418e('0x30')],qs[_0x418e('0x36')](_0xb2ca98['query'][_0x418e('0x36')]));_0x30daea[_0x418e('0x35')]=_0x30daea[_0x418e('0x35')][_0x418e('0x37')]?_0x30daea[_0x418e('0x35')]:_0x4c1407['model'];if(!_0xb2ca98['query'][_0x418e('0x38')](_0x418e('0x39'))){_0x30daea['limit']=qs[_0x418e('0x1c')](_0xb2ca98[_0x418e('0x32')]['limit']);_0x30daea[_0x418e('0x1d')]=qs[_0x418e('0x1d')](_0xb2ca98['query'][_0x418e('0x1d')]);}_0x30daea['order']=qs[_0x418e('0x3a')](_0xb2ca98[_0x418e('0x32')][_0x418e('0x3a')]);_0x30daea['where']=qs[_0x418e('0x33')](_['pick'](_0xb2ca98[_0x418e('0x32')],_0x4c1407['filters']),_0x3fd21b);if(_0xb2ca98[_0x418e('0x32')][_0x418e('0x3b')]){_0x30daea[_0x418e('0x3c')]=_[_0x418e('0x3d')](_0x30daea[_0x418e('0x3c')],{'$or':_['map'](_0x3fd21b,function(_0x4a8b3f){if(_0x4a8b3f[_0x418e('0x2e')]!==_0x418e('0x3e')){var _0x20ae34={};_0x20ae34[_0x4a8b3f[_0x418e('0x29')]]={'$like':'%'+_0xb2ca98['query']['filter']+'%'};return _0x20ae34;}})});}_0x30daea=_[_0x418e('0x3d')]({},_0x30daea,_0xb2ca98[_0x418e('0x3f')]);var _0x4708eb={'where':_0x30daea[_0x418e('0x3c')]};return db[_0x418e('0x2b')][_0x418e('0x1e')](_0x4708eb)['then'](function(_0xcd0c41){_0x55fd05[_0x418e('0x1e')]=_0xcd0c41;if(_0xb2ca98[_0x418e('0x32')][_0x418e('0x40')]){_0x30daea['include']=[{'all':!![]}];}return db[_0x418e('0x2b')][_0x418e('0x41')](_0x30daea);})[_0x418e('0x25')](function(_0xcea64b){_0x55fd05[_0x418e('0x42')]=_0xcea64b;return _0x55fd05;})[_0x418e('0x25')](respondWithFilteredResult(_0x421b0e,_0x30daea))[_0x418e('0x43')](handleError(_0x421b0e,null));};exports[_0x418e('0x44')]=function(_0x406dd8,_0x1d086f){var _0x2c74aa={'raw':!![],'where':{'id':_0x406dd8[_0x418e('0x45')]['id']}},_0x4ce22f={};_0x4ce22f[_0x418e('0x30')]=_[_0x418e('0x31')](db['VtigerField']['rawAttributes']);_0x4ce22f['query']=_[_0x418e('0x31')](_0x406dd8['query']);_0x4ce22f['filters']=_[_0x418e('0x34')](_0x4ce22f['model'],_0x4ce22f['query']);_0x2c74aa['attributes']=_[_0x418e('0x34')](_0x4ce22f[_0x418e('0x30')],qs[_0x418e('0x36')](_0x406dd8[_0x418e('0x32')][_0x418e('0x36')]));_0x2c74aa[_0x418e('0x35')]=_0x2c74aa[_0x418e('0x35')][_0x418e('0x37')]?_0x2c74aa['attributes']:_0x4ce22f[_0x418e('0x30')];if(_0x406dd8[_0x418e('0x32')][_0x418e('0x40')]){_0x2c74aa[_0x418e('0x46')]=[{'all':!![]}];}_0x2c74aa=_[_0x418e('0x3d')]({},_0x2c74aa,_0x406dd8[_0x418e('0x3f')]);return db['VtigerField']['find'](_0x2c74aa)[_0x418e('0x25')](handleEntityNotFound(_0x1d086f,null))[_0x418e('0x25')](respondWithResult(_0x1d086f,null))[_0x418e('0x43')](handleError(_0x1d086f,null));};exports[_0x418e('0x47')]=function(_0x754a6f,_0x261088){return db[_0x418e('0x2b')]['create'](_0x754a6f['body'],{})[_0x418e('0x25')](respondWithResult(_0x261088,0xc9))[_0x418e('0x43')](handleError(_0x261088,null));};exports[_0x418e('0x24')]=function(_0x5dc095,_0x3503b2){if(_0x5dc095['body']['id']){delete _0x5dc095[_0x418e('0x48')]['id'];}return db[_0x418e('0x2b')][_0x418e('0x49')]({'where':{'id':_0x5dc095['params']['id']}})[_0x418e('0x25')](handleEntityNotFound(_0x3503b2,null))['then'](saveUpdates(_0x5dc095['body'],null))[_0x418e('0x25')](respondWithResult(_0x3503b2,null))['catch'](handleError(_0x3503b2,null));};exports['destroy']=function(_0xad90a4,_0x2fdbad){return db['VtigerField'][_0x418e('0x49')]({'where':{'id':_0xad90a4[_0x418e('0x45')]['id']}})[_0x418e('0x25')](handleEntityNotFound(_0x2fdbad,null))[_0x418e('0x25')](removeEntity(_0x2fdbad,null))[_0x418e('0x43')](handleError(_0x2fdbad,null));}; \ No newline at end of file +var _0xed32=['sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xed32,0x1a0));var _0x2ed3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xed32[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x2ed3('0x0'));var rimraf=require(_0x2ed3('0x1'));var zipdir=require(_0x2ed3('0x2'));var jsonpatch=require(_0x2ed3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ed3('0x4'));var Mustache=require(_0x2ed3('0x5'));var util=require(_0x2ed3('0x6'));var path=require('path');var sox=require(_0x2ed3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ed3('0x8'));var squel=require(_0x2ed3('0x9'));var crypto=require('crypto');var jsforce=require(_0x2ed3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2ed3('0xb'));var querystring=require(_0x2ed3('0xc'));var Papa=require(_0x2ed3('0xd'));var Redis=require(_0x2ed3('0xe'));var authService=require(_0x2ed3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ed3('0x10'));var hardwareService=require(_0x2ed3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2ed3('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae170,_0x2668c1){_0x2668c1=_0x2668c1||0xcc;return function(_0x27d6a9){if(_0x27d6a9){return _0x4ae170['sendStatus'](_0x2668c1);}return _0x4ae170[_0x2ed3('0x13')](_0x2668c1)['end']();};}function respondWithResult(_0x49087e,_0x3d9748){_0x3d9748=_0x3d9748||0xc8;return function(_0xcc53e9){if(_0xcc53e9){return _0x49087e['status'](_0x3d9748)[_0x2ed3('0x14')](_0xcc53e9);}};}function respondWithFilteredResult(_0x2cd5c9,_0x247fc6){return function(_0x46231f){if(_0x46231f){var _0x35b2fa=typeof _0x247fc6['offset']===_0x2ed3('0x15')&&typeof _0x247fc6[_0x2ed3('0x16')]===_0x2ed3('0x15');var _0x35e3e3=_0x46231f[_0x2ed3('0x17')];var _0x1ed7ef=_0x35b2fa?0x0:_0x247fc6[_0x2ed3('0x18')];var _0x1151df=_0x35b2fa?_0x46231f['count']:_0x247fc6[_0x2ed3('0x18')]+_0x247fc6['limit'];var _0x419f70;if(_0x1151df>=_0x35e3e3){_0x1151df=_0x35e3e3;_0x419f70=0xc8;}else{_0x419f70=0xce;}_0x2cd5c9[_0x2ed3('0x13')](_0x419f70);return _0x2cd5c9[_0x2ed3('0x19')](_0x2ed3('0x1a'),_0x1ed7ef+'-'+_0x1151df+'/'+_0x35e3e3)[_0x2ed3('0x14')](_0x46231f);}return null;};}function patchUpdates(_0x1e2957){return function(_0x20098e){try{jsonpatch['apply'](_0x20098e,_0x1e2957,!![]);}catch(_0x3d3506){return BPromise[_0x2ed3('0x1b')](_0x3d3506);}return _0x20098e[_0x2ed3('0x1c')]();};}function saveUpdates(_0x2403fa,_0x4c218e){return function(_0x2c43b0){if(_0x2c43b0){return _0x2c43b0[_0x2ed3('0x1d')](_0x2403fa)[_0x2ed3('0x1e')](function(_0x26c2e3){return _0x26c2e3;});}return null;};}function removeEntity(_0x197138,_0x33369a){return function(_0x2bb982){if(_0x2bb982){return _0x2bb982[_0x2ed3('0x1f')]()[_0x2ed3('0x1e')](function(){_0x197138['status'](0xcc)[_0x2ed3('0x20')]();});}};}function handleEntityNotFound(_0xc1d7ab,_0x5cdb7d){return function(_0x46c076){if(!_0x46c076){_0xc1d7ab[_0x2ed3('0x21')](0x194);}return _0x46c076;};}function handleError(_0x2fc9e0,_0x269576){_0x269576=_0x269576||0x1f4;return function(_0x54394e){logger['error'](_0x54394e[_0x2ed3('0x22')]);if(_0x54394e[_0x2ed3('0x23')]){delete _0x54394e['name'];}_0x2fc9e0[_0x2ed3('0x13')](_0x269576)['send'](_0x54394e);};}exports[_0x2ed3('0x24')]=function(_0x43fd69,_0x1d7018){var _0x8434d0={},_0x5d5a24={},_0x207cda={'count':0x0,'rows':[]};var _0xa4b5e4=_[_0x2ed3('0x25')](db[_0x2ed3('0x26')][_0x2ed3('0x27')],function(_0x1e77a5){return{'name':_0x1e77a5[_0x2ed3('0x28')],'type':_0x1e77a5[_0x2ed3('0x29')][_0x2ed3('0x2a')]};});_0x5d5a24[_0x2ed3('0x2b')]=_[_0x2ed3('0x25')](_0xa4b5e4,_0x2ed3('0x23'));_0x5d5a24[_0x2ed3('0x2c')]=_[_0x2ed3('0x2d')](_0x43fd69[_0x2ed3('0x2c')]);_0x5d5a24['filters']=_['intersection'](_0x5d5a24[_0x2ed3('0x2b')],_0x5d5a24[_0x2ed3('0x2c')]);_0x8434d0['attributes']=_[_0x2ed3('0x2e')](_0x5d5a24[_0x2ed3('0x2b')],qs[_0x2ed3('0x2f')](_0x43fd69[_0x2ed3('0x2c')]['fields']));_0x8434d0[_0x2ed3('0x30')]=_0x8434d0[_0x2ed3('0x30')][_0x2ed3('0x31')]?_0x8434d0['attributes']:_0x5d5a24['model'];if(!_0x43fd69['query'][_0x2ed3('0x32')](_0x2ed3('0x33'))){_0x8434d0[_0x2ed3('0x16')]=qs[_0x2ed3('0x16')](_0x43fd69[_0x2ed3('0x2c')][_0x2ed3('0x16')]);_0x8434d0[_0x2ed3('0x18')]=qs[_0x2ed3('0x18')](_0x43fd69[_0x2ed3('0x2c')][_0x2ed3('0x18')]);}_0x8434d0[_0x2ed3('0x34')]=qs[_0x2ed3('0x35')](_0x43fd69[_0x2ed3('0x2c')][_0x2ed3('0x35')]);_0x8434d0[_0x2ed3('0x36')]=qs[_0x2ed3('0x37')](_[_0x2ed3('0x38')](_0x43fd69[_0x2ed3('0x2c')],_0x5d5a24[_0x2ed3('0x37')]),_0xa4b5e4);if(_0x43fd69[_0x2ed3('0x2c')]['filter']){_0x8434d0[_0x2ed3('0x36')]=_[_0x2ed3('0x39')](_0x8434d0[_0x2ed3('0x36')],{'$or':_[_0x2ed3('0x25')](_0xa4b5e4,function(_0x598bfd){if(_0x598bfd['type']!==_0x2ed3('0x3a')){var _0x1dc2be={};_0x1dc2be[_0x598bfd[_0x2ed3('0x23')]]={'$like':'%'+_0x43fd69[_0x2ed3('0x2c')]['filter']+'%'};return _0x1dc2be;}})});}_0x8434d0=_[_0x2ed3('0x39')]({},_0x8434d0,_0x43fd69[_0x2ed3('0x3b')]);var _0x35bc7d={'where':_0x8434d0[_0x2ed3('0x36')]};return db[_0x2ed3('0x26')]['count'](_0x35bc7d)[_0x2ed3('0x1e')](function(_0x77316c){_0x207cda[_0x2ed3('0x17')]=_0x77316c;if(_0x43fd69['query'][_0x2ed3('0x3c')]){_0x8434d0['include']=[{'all':!![]}];}return db[_0x2ed3('0x26')][_0x2ed3('0x3d')](_0x8434d0);})[_0x2ed3('0x1e')](function(_0x1b7c54){_0x207cda['rows']=_0x1b7c54;return _0x207cda;})[_0x2ed3('0x1e')](respondWithFilteredResult(_0x1d7018,_0x8434d0))[_0x2ed3('0x3e')](handleError(_0x1d7018,null));};exports['show']=function(_0x5725c9,_0x282f71){var _0x40ca34={'raw':!![],'where':{'id':_0x5725c9[_0x2ed3('0x3f')]['id']}},_0x16ee86={};_0x16ee86[_0x2ed3('0x2b')]=_[_0x2ed3('0x2d')](db[_0x2ed3('0x26')][_0x2ed3('0x27')]);_0x16ee86['query']=_[_0x2ed3('0x2d')](_0x5725c9[_0x2ed3('0x2c')]);_0x16ee86['filters']=_['intersection'](_0x16ee86['model'],_0x16ee86[_0x2ed3('0x2c')]);_0x40ca34['attributes']=_[_0x2ed3('0x2e')](_0x16ee86[_0x2ed3('0x2b')],qs['fields'](_0x5725c9[_0x2ed3('0x2c')][_0x2ed3('0x2f')]));_0x40ca34[_0x2ed3('0x30')]=_0x40ca34[_0x2ed3('0x30')][_0x2ed3('0x31')]?_0x40ca34['attributes']:_0x16ee86[_0x2ed3('0x2b')];if(_0x5725c9[_0x2ed3('0x2c')]['includeAll']){_0x40ca34['include']=[{'all':!![]}];}_0x40ca34=_[_0x2ed3('0x39')]({},_0x40ca34,_0x5725c9[_0x2ed3('0x3b')]);return db['VtigerField']['find'](_0x40ca34)[_0x2ed3('0x1e')](handleEntityNotFound(_0x282f71,null))[_0x2ed3('0x1e')](respondWithResult(_0x282f71,null))[_0x2ed3('0x3e')](handleError(_0x282f71,null));};exports[_0x2ed3('0x40')]=function(_0x149539,_0x715f5b){return db[_0x2ed3('0x26')][_0x2ed3('0x40')](_0x149539[_0x2ed3('0x41')],{})[_0x2ed3('0x1e')](respondWithResult(_0x715f5b,0xc9))[_0x2ed3('0x3e')](handleError(_0x715f5b,null));};exports[_0x2ed3('0x1d')]=function(_0x3fbd65,_0xc85d97){if(_0x3fbd65['body']['id']){delete _0x3fbd65[_0x2ed3('0x41')]['id'];}return db[_0x2ed3('0x26')][_0x2ed3('0x42')]({'where':{'id':_0x3fbd65[_0x2ed3('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc85d97,null))[_0x2ed3('0x1e')](saveUpdates(_0x3fbd65[_0x2ed3('0x41')],null))[_0x2ed3('0x1e')](respondWithResult(_0xc85d97,null))['catch'](handleError(_0xc85d97,null));};exports[_0x2ed3('0x1f')]=function(_0x2fbc34,_0x5702b1){return db[_0x2ed3('0x26')][_0x2ed3('0x42')]({'where':{'id':_0x2fbc34[_0x2ed3('0x3f')]['id']}})[_0x2ed3('0x1e')](handleEntityNotFound(_0x5702b1,null))['then'](removeEntity(_0x5702b1,null))[_0x2ed3('0x3e')](handleError(_0x5702b1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1384fe0..e79681b 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 _0xf8ff=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x315ad0,_0x163c6f){var _0x5c823c=function(_0x38f489){while(--_0x38f489){_0x315ad0['push'](_0x315ad0['shift']());}};_0x5c823c(++_0x163c6f);}(_0xf8ff,0x16a));var _0xff8f=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xf8ff[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0xff8f('0x0'));var util=require('util');var logger=require(_0xff8f('0x1'))(_0xff8f('0x2'));var moment=require(_0xff8f('0x3'));var BPromise=require(_0xff8f('0x4'));var rp=require(_0xff8f('0x5'));var fs=require('fs');var path=require(_0xff8f('0x6'));var rimraf=require(_0xff8f('0x7'));var config=require(_0xff8f('0x8'));var attributes=require(_0xff8f('0x9'));module[_0xff8f('0xa')]=function(_0x12072a,_0x2d2a3f){return _0x12072a[_0xff8f('0xb')](_0xff8f('0xc'),attributes,{'tableName':_0xff8f('0xd'),'paranoid':![],'indexes':[{'name':_0xff8f('0xe'),'fields':[_0xff8f('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa833=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x30eb5b,_0x234476){var _0x559d73=function(_0x35e62f){while(--_0x35e62f){_0x30eb5b['push'](_0x30eb5b['shift']());}};_0x559d73(++_0x234476);}(_0xa833,0x168));var _0x3a83=function(_0xc809c5,_0x4d8252){_0xc809c5=_0xc809c5-0x0;var _0x16f225=_0xa833[_0xc809c5];return _0x16f225;};'use strict';var _=require(_0x3a83('0x0'));var util=require(_0x3a83('0x1'));var logger=require('../../config/logger')(_0x3a83('0x2'));var moment=require(_0x3a83('0x3'));var BPromise=require(_0x3a83('0x4'));var rp=require(_0x3a83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a83('0x6'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x331886,_0x183b69){return _0x331886[_0x3a83('0x7')]('VtigerField',attributes,{'tableName':_0x3a83('0x8'),'paranoid':![],'indexes':[{'name':_0x3a83('0x9'),'fields':[_0x3a83('0xa'),_0x3a83('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b987de8..7a26f76 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 _0xdfdb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x1d939f,_0x2939dd){var _0x5d3f39=function(_0x317ec0){while(--_0x317ec0){_0x1d939f['push'](_0x1d939f['shift']());}};_0x5d3f39(++_0x2939dd);}(_0xdfdb,0x110));var _0xbdfd=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xdfdb[_0x27604f];return _0x40d189;};'use strict';var _=require(_0xbdfd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbdfd('0x1'));var rs=require(_0xbdfd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdfd('0x3'))['db'];var utils=require(_0xbdfd('0x4'));var logger=require(_0xbdfd('0x5'))(_0xbdfd('0x6'));var config=require(_0xbdfd('0x7'));var jayson=require(_0xbdfd('0x8'));var client=jayson[_0xbdfd('0x9')][_0xbdfd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362b9f,_0x2b2867,_0x3d24cb){return new BPromise(function(_0x5d4ce1,_0x50bc4c){return client[_0xbdfd('0xb')](_0x362b9f,_0x3d24cb)[_0xbdfd('0xc')](function(_0x229e22){logger[_0xbdfd('0xd')](_0xbdfd('0xe'),_0x2b2867,_0xbdfd('0xf'));logger['debug'](_0xbdfd('0x10'),_0x2b2867,_0xbdfd('0xf'),JSON[_0xbdfd('0x11')](_0x229e22));if(_0x229e22[_0xbdfd('0x12')]){if(_0x229e22[_0xbdfd('0x12')][_0xbdfd('0x13')]===0x1f4){logger[_0xbdfd('0x12')]('VtigerField,\x20%s,\x20%s',_0x2b2867,_0x229e22['error']['message']);return _0x50bc4c(_0x229e22[_0xbdfd('0x12')][_0xbdfd('0x14')]);}logger['error'](_0xbdfd('0xe'),_0x2b2867,_0x229e22['error'][_0xbdfd('0x14')]);return _0x5d4ce1(_0x229e22[_0xbdfd('0x12')][_0xbdfd('0x14')]);}else{logger[_0xbdfd('0xd')](_0xbdfd('0xe'),_0x2b2867,'request\x20sent');_0x5d4ce1(_0x229e22[_0xbdfd('0x15')][_0xbdfd('0x14')]);}})[_0xbdfd('0x16')](function(_0x1e6e6d){logger[_0xbdfd('0x12')](_0xbdfd('0xe'),_0x2b2867,_0x1e6e6d);_0x50bc4c(_0x1e6e6d);});});} \ No newline at end of file +var _0xb8e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird'];(function(_0x4d0030,_0x25760d){var _0x54ed03=function(_0x5980a4){while(--_0x5980a4){_0x4d0030['push'](_0x4d0030['shift']());}};_0x54ed03(++_0x25760d);}(_0xb8e8,0x172));var _0x8b8e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb8e8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x8b8e('0x0'));var util=require(_0x8b8e('0x1'));var moment=require(_0x8b8e('0x2'));var BPromise=require(_0x8b8e('0x3'));var rs=require(_0x8b8e('0x4'));var fs=require('fs');var Redis=require(_0x8b8e('0x5'));var db=require(_0x8b8e('0x6'))['db'];var utils=require(_0x8b8e('0x7'));var logger=require(_0x8b8e('0x8'))(_0x8b8e('0x9'));var config=require(_0x8b8e('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26ab3d,_0x59bbb2,_0x196d6d){return new BPromise(function(_0x1123ae,_0x54e40b){return client[_0x8b8e('0xc')](_0x26ab3d,_0x196d6d)[_0x8b8e('0xd')](function(_0x1395d9){logger['info']('VtigerField,\x20%s,\x20%s',_0x59bbb2,_0x8b8e('0xe'));logger['debug'](_0x8b8e('0xf'),_0x59bbb2,_0x8b8e('0xe'),JSON['stringify'](_0x1395d9));if(_0x1395d9[_0x8b8e('0x10')]){if(_0x1395d9[_0x8b8e('0x10')][_0x8b8e('0x11')]===0x1f4){logger['error'](_0x8b8e('0x12'),_0x59bbb2,_0x1395d9[_0x8b8e('0x10')][_0x8b8e('0x13')]);return _0x54e40b(_0x1395d9[_0x8b8e('0x10')]['message']);}logger[_0x8b8e('0x10')](_0x8b8e('0x12'),_0x59bbb2,_0x1395d9[_0x8b8e('0x10')][_0x8b8e('0x13')]);return _0x1123ae(_0x1395d9[_0x8b8e('0x10')][_0x8b8e('0x13')]);}else{logger[_0x8b8e('0x14')](_0x8b8e('0x12'),_0x59bbb2,_0x8b8e('0xe'));_0x1123ae(_0x1395d9['result'][_0x8b8e('0x13')]);}})[_0x8b8e('0x15')](function(_0x466bf6){logger['error']('VtigerField,\x20%s,\x20%s',_0x59bbb2,_0x466bf6);_0x54e40b(_0x466bf6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b18fc6b..659f24c 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 _0x8390=['post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8390,0xf8));var _0x0839=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x8390[_0x1c3370];return _0xa9b358;};'use strict';var multer=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var path=require('path');var timeout=require(_0x0839('0x2'));var express=require(_0x0839('0x3'));var router=express[_0x0839('0x4')]();var fs_extra=require(_0x0839('0x5'));var auth=require(_0x0839('0x6'));var interaction=require(_0x0839('0x7'));var config=require('../../config/environment');var controller=require(_0x0839('0x8'));router['get']('/',auth[_0x0839('0x9')](),controller['index']);router[_0x0839('0xa')]('/:id',auth[_0x0839('0x9')](),controller[_0x0839('0xb')]);router[_0x0839('0xa')](_0x0839('0xc'),auth['isAuthenticated'](),controller[_0x0839('0xd')]);router[_0x0839('0xa')](_0x0839('0xe'),auth[_0x0839('0x9')](),controller[_0x0839('0xf')]);router[_0x0839('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0839('0xc'),auth['isAuthenticated'](),controller[_0x0839('0x11')]);router[_0x0839('0x12')](_0x0839('0x13'),auth['isAuthenticated'](),controller[_0x0839('0x14')]);router[_0x0839('0x15')](_0x0839('0x13'),auth[_0x0839('0x9')](),controller[_0x0839('0x16')]);module[_0x0839('0x17')]=router; \ No newline at end of file +var _0x6217=['create','addConfiguration','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x1d6f8c,_0x35f1e9){var _0x2df558=function(_0x2a0a83){while(--_0x2a0a83){_0x1d6f8c['push'](_0x1d6f8c['shift']());}};_0x2df558(++_0x35f1e9);}(_0x6217,0x1bc));var _0x7621=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x6217[_0x1aba25];return _0x47d997;};'use strict';var multer=require(_0x7621('0x0'));var util=require(_0x7621('0x1'));var path=require(_0x7621('0x2'));var timeout=require(_0x7621('0x3'));var express=require(_0x7621('0x4'));var router=express[_0x7621('0x5')]();var fs_extra=require(_0x7621('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7621('0x7'));var controller=require(_0x7621('0x8'));router[_0x7621('0x9')]('/',auth[_0x7621('0xa')](),controller[_0x7621('0xb')]);router[_0x7621('0x9')](_0x7621('0xc'),auth[_0x7621('0xa')](),controller[_0x7621('0xd')]);router[_0x7621('0x9')](_0x7621('0xe'),auth[_0x7621('0xa')](),controller[_0x7621('0xf')]);router[_0x7621('0x9')]('/:id/fields',auth[_0x7621('0xa')](),controller[_0x7621('0x10')]);router[_0x7621('0x11')]('/',auth['isAuthenticated'](),controller[_0x7621('0x12')]);router[_0x7621('0x11')](_0x7621('0xe'),auth[_0x7621('0xa')](),controller[_0x7621('0x13')]);router[_0x7621('0x14')](_0x7621('0xc'),auth[_0x7621('0xa')](),controller[_0x7621('0x15')]);router['delete'](_0x7621('0xc'),auth[_0x7621('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index becc0ad..5ebb863 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 _0x41d0=['ENUM','password','token','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d0,0x1c6));var _0x041d=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x41d0[_0x5466ab];return _0x40751a;};'use strict';var Sequelize=require(_0x041d('0x0'));module[_0x041d('0x1')]={'name':{'type':Sequelize[_0x041d('0x2')]},'description':{'type':Sequelize[_0x041d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x041d('0x3')},'password':{'type':Sequelize[_0x041d('0x2')]},'token':{'type':Sequelize[_0x041d('0x2')]},'remoteUri':{'type':Sequelize[_0x041d('0x2')],'unique':_0x041d('0x4')},'authType':{'type':Sequelize[_0x041d('0x5')](_0x041d('0x6'),_0x041d('0x7')),'defaultValue':_0x041d('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x041d('0x5')]('integrationTab',_0x041d('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa7db=['integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM','token','password'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xa7db,0xbf));var _0xba7d=function(_0x5b405b,_0x15a3ce){_0x5b405b=_0x5b405b-0x0;var _0x2b1f17=_0xa7db[_0x5b405b];return _0x2b1f17;};'use strict';var Sequelize=require(_0xba7d('0x0'));module[_0xba7d('0x1')]={'name':{'type':Sequelize[_0xba7d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xba7d('0x2')]},'token':{'type':Sequelize[_0xba7d('0x2')]},'remoteUri':{'type':Sequelize[_0xba7d('0x2')],'unique':_0xba7d('0x3')},'authType':{'type':Sequelize[_0xba7d('0x4')]('password',_0xba7d('0x5')),'defaultValue':_0xba7d('0x6')},'serverUrl':{'type':Sequelize[_0xba7d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xba7d('0x4')](_0xba7d('0x7'),_0xba7d('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 58c06a8..105af15 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 _0xb58b=['headers','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','findOne','token','authType','remoteUri','substring','GET','format','%s/%s','password'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb58b,0x1f1));var _0xbb58=function(_0x51662d,_0x8d4794){_0x51662d=_0x51662d-0x0;var _0x4199db=_0xb58b[_0x51662d];return _0x4199db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb58('0x18'));function respondWithStatusCode(_0x18810f,_0x4cda21){_0x4cda21=_0x4cda21||0xcc;return function(_0x132511){if(_0x132511){return _0x18810f[_0xbb58('0x19')](_0x4cda21);}return _0x18810f[_0xbb58('0x1a')](_0x4cda21)[_0xbb58('0x1b')]();};}function respondWithResult(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xc8;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1a')](_0x58245f)['json'](_0x110944);}};}function respondWithFilteredResult(_0x4ba30e,_0x33c20f){return function(_0x445b1f){if(_0x445b1f){var _0x38d69a=typeof _0x33c20f['offset']==='undefined'&&typeof _0x33c20f['limit']==='undefined';var _0x28637b=_0x445b1f[_0xbb58('0x1c')];var _0x48f3e0=_0x38d69a?0x0:_0x33c20f[_0xbb58('0x1d')];var _0x497653=_0x38d69a?_0x445b1f[_0xbb58('0x1c')]:_0x33c20f[_0xbb58('0x1d')]+_0x33c20f[_0xbb58('0x1e')];var _0xb8f982;if(_0x497653>=_0x28637b){_0x497653=_0x28637b;_0xb8f982=0xc8;}else{_0xb8f982=0xce;}_0x4ba30e[_0xbb58('0x1a')](_0xb8f982);return _0x4ba30e[_0xbb58('0x1f')](_0xbb58('0x20'),_0x48f3e0+'-'+_0x497653+'/'+_0x28637b)['json'](_0x445b1f);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x21')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x22')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x23')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x24')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x25')]()[_0xbb58('0x24')](function(){_0x21964d[_0xbb58('0x1a')](0xcc)[_0xbb58('0x1b')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x19')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x26')](_0x8e9ed9[_0xbb58('0x27')]);if(_0x8e9ed9[_0xbb58('0x28')]){delete _0x8e9ed9[_0xbb58('0x28')];}_0x1be0ae[_0xbb58('0x1a')](_0x129094)[_0xbb58('0x29')](_0x8e9ed9);};}exports[_0xbb58('0x2a')]=function(_0x2a0481,_0x4157c4){var _0x3559b6={},_0x573cca={},_0x2b0f73={'count':0x0,'rows':[]};var _0xe46bc1=_[_0xbb58('0x2b')](db[_0xbb58('0x2c')][_0xbb58('0x2d')],function(_0x9d379f){return{'name':_0x9d379f[_0xbb58('0x2e')],'type':_0x9d379f[_0xbb58('0x2f')][_0xbb58('0x30')]};});_0x573cca['model']=_[_0xbb58('0x2b')](_0xe46bc1,_0xbb58('0x28'));_0x573cca[_0xbb58('0x31')]=_[_0xbb58('0x32')](_0x2a0481[_0xbb58('0x31')]);_0x573cca[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],_0x573cca[_0xbb58('0x31')]);_0x3559b6[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x2a0481['query']['fields']));_0x3559b6['attributes']=_0x3559b6[_0xbb58('0x36')][_0xbb58('0x38')]?_0x3559b6[_0xbb58('0x36')]:_0x573cca[_0xbb58('0x35')];if(!_0x2a0481[_0xbb58('0x31')][_0xbb58('0x39')](_0xbb58('0x3a'))){_0x3559b6[_0xbb58('0x1e')]=qs['limit'](_0x2a0481[_0xbb58('0x31')][_0xbb58('0x1e')]);_0x3559b6['offset']=qs[_0xbb58('0x1d')](_0x2a0481['query'][_0xbb58('0x1d')]);}_0x3559b6['order']=qs[_0xbb58('0x3b')](_0x2a0481[_0xbb58('0x31')]['sort']);_0x3559b6[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x2a0481[_0xbb58('0x31')],_0x573cca[_0xbb58('0x33')]),_0xe46bc1);if(_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]){_0x3559b6[_0xbb58('0x3c')]=_['merge'](_0x3559b6[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0xe46bc1,function(_0x2da5ff){if(_0x2da5ff['type']!=='VIRTUAL'){var _0x133d56={};_0x133d56[_0x2da5ff['name']]={'$like':'%'+_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x133d56;}})});}_0x3559b6=_[_0xbb58('0x3f')]({},_0x3559b6,_0x2a0481['options']);var _0x485830={'where':_0x3559b6[_0xbb58('0x3c')]};return db[_0xbb58('0x2c')][_0xbb58('0x1c')](_0x485830)[_0xbb58('0x24')](function(_0x34a745){_0x2b0f73[_0xbb58('0x1c')]=_0x34a745;if(_0x2a0481['query'][_0xbb58('0x40')]){_0x3559b6[_0xbb58('0x41')]=[{'all':!![]}];}return db[_0xbb58('0x2c')][_0xbb58('0x42')](_0x3559b6);})[_0xbb58('0x24')](function(_0x301e15){_0x2b0f73['rows']=_0x301e15;return _0x2b0f73;})[_0xbb58('0x24')](respondWithFilteredResult(_0x4157c4,_0x3559b6))['catch'](handleError(_0x4157c4,null));};exports[_0xbb58('0x43')]=function(_0x285ad4,_0x29fb1c){var _0x45817f={'raw':![],'where':{'id':_0x285ad4[_0xbb58('0x44')]['id']}},_0x54099f={};_0x54099f[_0xbb58('0x35')]=_[_0xbb58('0x32')](db[_0xbb58('0x2c')]['rawAttributes']);_0x54099f[_0xbb58('0x31')]=_['keys'](_0x285ad4[_0xbb58('0x31')]);_0x54099f[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],_0x54099f[_0xbb58('0x31')]);_0x45817f[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x285ad4[_0xbb58('0x31')][_0xbb58('0x37')]));_0x45817f[_0xbb58('0x36')]=_0x45817f[_0xbb58('0x36')]['length']?_0x45817f[_0xbb58('0x36')]:_0x54099f['model'];if(_0x285ad4['query'][_0xbb58('0x40')]){_0x45817f[_0xbb58('0x41')]=[{'all':!![]}];}_0x45817f=_[_0xbb58('0x3f')]({},_0x45817f,_0x285ad4[_0xbb58('0x45')]);return db[_0xbb58('0x2c')][_0xbb58('0x46')](_0x45817f)[_0xbb58('0x24')](handleEntityNotFound(_0x29fb1c,null))[_0xbb58('0x24')](respondWithResult(_0x29fb1c,null))[_0xbb58('0x47')](handleError(_0x29fb1c,null));};exports[_0xbb58('0x48')]=function(_0x440fb3,_0x59a8cf){return db[_0xbb58('0x2c')][_0xbb58('0x48')](_0x440fb3['body'],{})[_0xbb58('0x24')](respondWithResult(_0x59a8cf,0xc9))[_0xbb58('0x47')](handleError(_0x59a8cf,null));};exports[_0xbb58('0x49')]=function(_0xdb0ff7,_0x5de68e){if(_0xdb0ff7[_0xbb58('0x4a')]['id']){delete _0xdb0ff7['body']['id'];}return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0xdb0ff7[_0xbb58('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de68e,null))[_0xbb58('0x24')](saveUpdates(_0xdb0ff7[_0xbb58('0x4a')],null))['then'](respondWithResult(_0x5de68e,null))[_0xbb58('0x47')](handleError(_0x5de68e,null));};exports['destroy']=function(_0x28301d,_0x2d81e0){return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0x28301d[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x2d81e0,null))[_0xbb58('0x24')](removeEntity(_0x2d81e0,null))['catch'](handleError(_0x2d81e0,null));};exports[_0xbb58('0x4b')]=function(_0x1fd892,_0x592da8,_0x3efbc6){var _0x98157={};var _0x5c19b7={};var _0x22802c;var _0x44636b;return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x1fd892[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x592da8,null))[_0xbb58('0x24')](function(_0x592879){if(_0x592879){_0x22802c=_0x592879;_0x5c19b7[_0xbb58('0x35')]=_['keys'](db[_0xbb58('0x4c')][_0xbb58('0x2d')]);_0x5c19b7[_0xbb58('0x31')]=_['keys'](_0x1fd892['query']);_0x5c19b7[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x5c19b7[_0xbb58('0x35')],_0x5c19b7[_0xbb58('0x31')]);_0x98157[_0xbb58('0x36')]=_['intersection'](_0x5c19b7[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x1fd892[_0xbb58('0x31')]['fields']));_0x98157[_0xbb58('0x36')]=_0x98157[_0xbb58('0x36')][_0xbb58('0x38')]?_0x98157[_0xbb58('0x36')]:_0x5c19b7[_0xbb58('0x35')];_0x98157['order']=qs[_0xbb58('0x3b')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3b')]);_0x98157[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x1fd892[_0xbb58('0x31')],_0x5c19b7[_0xbb58('0x33')]));if(_0x1fd892['query'][_0xbb58('0x3e')]){_0x98157['where']=_[_0xbb58('0x3f')](_0x98157[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0x98157[_0xbb58('0x36')],function(_0x3d6fba){var _0x1dbbd9={};_0x1dbbd9[_0x3d6fba]={'$like':'%'+_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x1dbbd9;})});}_0x98157=_[_0xbb58('0x3f')]({},_0x98157,_0x1fd892[_0xbb58('0x45')]);return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x3933f0){if(_0x3933f0){_0x44636b=_0x3933f0[_0xbb58('0x38')];if(!_0x1fd892[_0xbb58('0x31')]['hasOwnProperty'](_0xbb58('0x3a'))){_0x98157['limit']=qs[_0xbb58('0x1e')](_0x1fd892[_0xbb58('0x31')]['limit']);_0x98157[_0xbb58('0x1d')]=qs[_0xbb58('0x1d')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x1d')]);}return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x54bf2e){if(_0x54bf2e){return _0x54bf2e?{'count':_0x44636b,'rows':_0x54bf2e}:null;}})[_0xbb58('0x24')](respondWithResult(_0x592da8,null))[_0xbb58('0x47')](handleError(_0x592da8,null));};exports[_0xbb58('0x4d')]=function(_0x4bbccf,_0x11d41e,_0x419215){if(_0x4bbccf['body']['id']){delete _0x4bbccf[_0xbb58('0x4a')]['id'];}return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x4bbccf[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x11d41e,null))[_0xbb58('0x24')](function(_0x3c932e){if(_0x3c932e){_0x4bbccf[_0xbb58('0x4a')]['AccountId']=_0x3c932e['id'];_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x4e')]=integrations[_0xbb58('0x4f')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf['body']['type']);_0x4bbccf[_0xbb58('0x4a')]['Descriptions']=integrations[_0xbb58('0x51')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x2f')]);return db[_0xbb58('0x4c')][_0xbb58('0x48')](_0x4bbccf[_0xbb58('0x4a')],{'include':[{'model':db[_0xbb58('0x52')],'as':_0xbb58('0x4e')},{'model':db['ZendeskField'],'as':_0xbb58('0x53')}]});}return null;})[_0xbb58('0x24')](respondWithResult(_0x11d41e,null))[_0xbb58('0x47')](handleError(_0x11d41e,null));};exports['getFields']=function(_0x50bf24,_0x4bdc30,_0x5e9319){var _0x1e315e='';return db[_0xbb58('0x2c')][_0xbb58('0x54')]({'where':{'id':_0x50bf24[_0xbb58('0x44')]['id']},'attributes':['id','username','password',_0xbb58('0x55'),_0xbb58('0x56'),'remoteUri']})[_0xbb58('0x24')](handleEntityNotFound(_0x4bdc30,null))[_0xbb58('0x24')](function(_0x3cd96a){if(_0x3cd96a){_0x1e315e=_0x3cd96a[_0xbb58('0x57')];var _0x382d16=_0x1e315e['slice'](-0x1);if(_0x382d16==='/'){_0x1e315e=_0x1e315e[_0xbb58('0x58')](0x0,_0x1e315e['lastIndexOf'](_0x382d16));}var _0x52cf79={'method':_0xbb58('0x59'),'uri':util[_0xbb58('0x5a')](_0xbb58('0x5b'),_0x1e315e,'ticket_fields'),'json':!![]};switch(_0x3cd96a[_0xbb58('0x56')]){case _0xbb58('0x5c'):_0x52cf79[_0xbb58('0x5d')]={'Authorization':util[_0xbb58('0x5a')]('Basic\x20%s',new Buffer(util[_0xbb58('0x5a')]('%s:%s',_0x3cd96a['username'],_0x3cd96a[_0xbb58('0x5c')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;case'token':_0x52cf79['headers']={'Authorization':util[_0xbb58('0x5a')](_0xbb58('0x60'),new Buffer(util[_0xbb58('0x5a')](_0xbb58('0x61'),_0x3cd96a[_0xbb58('0x62')],_0x3cd96a[_0xbb58('0x55')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;default:throw new db[(_0xbb58('0x63'))][(_0xbb58('0x64'))](_0xbb58('0x65'));}return rp(_0x52cf79);}})['then'](function(_0x502f55){if(_0x502f55){var _0x36e2eb=[_0xbb58('0x66'),_0xbb58('0x67'),'group',_0xbb58('0x68')];_[_0xbb58('0x69')](_0x502f55[_0xbb58('0x6a')],function(_0x494c33){return _0x36e2eb[_0xbb58('0x6b')](_0x494c33['type']);});return{'count':_0x502f55[_0xbb58('0x6a')]['length'],'rows':_[_0xbb58('0x2b')](_0x502f55[_0xbb58('0x6a')],function(_0xaf9d6){return{'id':_0xaf9d6['id'],'name':_0xaf9d6[_0xbb58('0x6c')]>0x7?_0xaf9d6[_0xbb58('0x6d')]:_0xaf9d6[_0xbb58('0x2f')],'custom':_0xaf9d6['position']>0x7?!![]:![],'options':_0xaf9d6['system_field_options']?_0xaf9d6[_0xbb58('0x6e')]:_0xaf9d6[_0xbb58('0x6f')]?_0xaf9d6['custom_field_options']:[]};})};}})[_0xbb58('0x24')](respondWithResult(_0x4bdc30,null))[_0xbb58('0x47')](function(_0x43eb15){var _0x5604d1=_0x50bf24[_0xbb58('0x31')]['test']?0x1f4:_0x43eb15[_0xbb58('0x70')]||0x1f4;logger[_0xbb58('0x26')](_0xbb58('0x71'),_0xbb58('0x72'),_0x5604d1,JSON[_0xbb58('0x73')](_0x43eb15));delete _0x43eb15[_0xbb58('0x28')];if(_0x5604d1===0x191){_0x5604d1=0x190;}_0x4bdc30[_0xbb58('0x1a')](_0x5604d1)['send'](_0x50bf24[_0xbb58('0x31')][_0xbb58('0x74')]?{'message':_0xbb58('0x75'),'statusCode':_0x43eb15['statusCode']}:_0x43eb15);});}; \ No newline at end of file +var _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x35eb5a,_0x176172){var _0x579911=function(_0x3c05b2){while(--_0x3c05b2){_0x35eb5a['push'](_0x35eb5a['shift']());}};_0x579911(++_0x176172);}(_0xe511,0x16f));var _0x1e51=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0xe511[_0x33626e];return _0x254df4;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e5878fd..0634d9e 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 _0xc3c6=['./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5bf8be,_0x1a37ea){var _0x5c74d1=function(_0x5703ce){while(--_0x5703ce){_0x5bf8be['push'](_0x5bf8be['shift']());}};_0x5c74d1(++_0x1a37ea);}(_0xc3c6,0x198));var _0x6c3c=function(_0x887753,_0x383a3c){_0x887753=_0x887753-0x0;var _0x698734=_0xc3c6[_0x887753];return _0x698734;};'use strict';var _=require(_0x6c3c('0x0'));var util=require('util');var logger=require(_0x6c3c('0x1'))('api');var moment=require(_0x6c3c('0x2'));var BPromise=require('bluebird');var rp=require(_0x6c3c('0x3'));var fs=require('fs');var path=require(_0x6c3c('0x4'));var rimraf=require(_0x6c3c('0x5'));var config=require('../../config/environment');var attributes=require(_0x6c3c('0x6'));var integrations=require(_0x6c3c('0x7'));module['exports']=function(_0x154fa2,_0x13b983){return _0x154fa2['define'](_0x6c3c('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91d1=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91d1,0x6f));var _0x191d=function(_0x4a2d83,_0x5e06f1){_0x4a2d83=_0x4a2d83-0x0;var _0x3bdee5=_0x91d1[_0x4a2d83];return _0x3bdee5;};'use strict';var _=require(_0x191d('0x0'));var util=require(_0x191d('0x1'));var logger=require(_0x191d('0x2'))(_0x191d('0x3'));var moment=require(_0x191d('0x4'));var BPromise=require(_0x191d('0x5'));var rp=require(_0x191d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x191d('0x7'));var config=require(_0x191d('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x191d('0x9'));module[_0x191d('0xa')]=function(_0x50a831,_0x45ce10){return _0x50a831[_0x191d('0xb')](_0x191d('0xc'),attributes,{'tableName':_0x191d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7fa040e..0c9c768 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 _0xa059=['stringify','error','message','catch','ZendeskAccount','options','raw','where','attributes','limit','include','model','map','GetZendeskAccount','find','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0xa059,0x90));var _0x9a05=function(_0x535286,_0x4ce9d0){_0x535286=_0x535286-0x0;var _0x2726b6=_0xa059[_0x535286];return _0x2726b6;};'use strict';var _=require(_0x9a05('0x0'));var util=require(_0x9a05('0x1'));var moment=require(_0x9a05('0x2'));var BPromise=require(_0x9a05('0x3'));var rs=require(_0x9a05('0x4'));var fs=require('fs');var Redis=require(_0x9a05('0x5'));var db=require(_0x9a05('0x6'))['db'];var utils=require(_0x9a05('0x7'));var logger=require(_0x9a05('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9a05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x592321,_0x594279,_0x3d7937){return new BPromise(function(_0x403ed3,_0x138b24){return client['request'](_0x592321,_0x3d7937)[_0x9a05('0xa')](function(_0x3fb358){logger[_0x9a05('0xb')](_0x9a05('0xc'),_0x594279,_0x9a05('0xd'));logger[_0x9a05('0xe')](_0x9a05('0xf'),_0x594279,'request\x20sent',JSON[_0x9a05('0x10')](_0x3fb358));if(_0x3fb358[_0x9a05('0x11')]){if(_0x3fb358['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x594279,_0x3fb358['error']['message']);return _0x138b24(_0x3fb358[_0x9a05('0x11')][_0x9a05('0x12')]);}logger[_0x9a05('0x11')](_0x9a05('0xc'),_0x594279,_0x3fb358['error'][_0x9a05('0x12')]);return _0x403ed3(_0x3fb358[_0x9a05('0x11')][_0x9a05('0x12')]);}else{logger['info'](_0x9a05('0xc'),_0x594279,_0x9a05('0xd'));_0x403ed3(_0x3fb358['result']['message']);}})[_0x9a05('0x13')](function(_0x4c1697){logger[_0x9a05('0x11')](_0x9a05('0xc'),_0x594279,_0x4c1697);_0x138b24(_0x4c1697);});});}exports['GetZendeskAccount']=function(_0x52c5a6){var _0x4bf5a8=this;return new Promise(function(_0x4b01e6,_0x3ecf07){return db[_0x9a05('0x14')]['findAll']({'raw':_0x52c5a6['options']?_0x52c5a6[_0x9a05('0x15')][_0x9a05('0x16')]===undefined?!![]:![]:!![],'where':_0x52c5a6[_0x9a05('0x15')]?_0x52c5a6[_0x9a05('0x15')][_0x9a05('0x17')]||null:null,'attributes':_0x52c5a6[_0x9a05('0x15')]?_0x52c5a6[_0x9a05('0x15')][_0x9a05('0x18')]||null:null,'limit':_0x52c5a6[_0x9a05('0x15')]?_0x52c5a6['options'][_0x9a05('0x19')]||null:null,'include':_0x52c5a6['options']?_0x52c5a6[_0x9a05('0x15')][_0x9a05('0x1a')]?_['map'](_0x52c5a6[_0x9a05('0x15')][_0x9a05('0x1a')],function(_0x35217c){return{'model':db[_0x35217c[_0x9a05('0x1b')]],'as':_0x35217c['as'],'attributes':_0x35217c[_0x9a05('0x18')],'include':_0x35217c[_0x9a05('0x1a')]?_[_0x9a05('0x1c')](_0x35217c[_0x9a05('0x1a')],function(_0x25fbe4){return{'model':db[_0x25fbe4[_0x9a05('0x1b')]],'as':_0x25fbe4['as'],'attributes':_0x25fbe4['attributes'],'include':_0x25fbe4['include']?_[_0x9a05('0x1c')](_0x25fbe4[_0x9a05('0x1a')],function(_0x5916a6){return{'model':db[_0x5916a6[_0x9a05('0x1b')]],'as':_0x5916a6['as'],'attributes':_0x5916a6[_0x9a05('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a353c){logger[_0x9a05('0xb')](_0x9a05('0x1d'),_0x52c5a6);logger[_0x9a05('0xe')](_0x9a05('0x1d'),_0x52c5a6,JSON[_0x9a05('0x10')](_0x5a353c));_0x4b01e6(_0x5a353c);})[_0x9a05('0x13')](function(_0x4ed754){logger['error'](_0x9a05('0x1d'),_0x4ed754[_0x9a05('0x12')],_0x52c5a6);_0x3ecf07(_0x4bf5a8[_0x9a05('0x11')](0x1f4,_0x4ed754[_0x9a05('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x576046){var _0x3df7f1=this;return new Promise(function(_0x332fd5,_0x13b907){return db['ZendeskAccount'][_0x9a05('0x1e')]({'raw':_0x576046[_0x9a05('0x15')]?_0x576046['options'][_0x9a05('0x16')]===undefined?!![]:![]:!![],'where':_0x576046[_0x9a05('0x15')]?_0x576046['options']['where']||null:null,'attributes':_0x576046[_0x9a05('0x15')]?_0x576046[_0x9a05('0x15')][_0x9a05('0x18')]||null:null,'include':_0x576046['options']?_0x576046[_0x9a05('0x15')][_0x9a05('0x1a')]?_[_0x9a05('0x1c')](_0x576046['options'][_0x9a05('0x1a')],function(_0x2d5d20){return{'model':db[_0x2d5d20['model']],'as':_0x2d5d20['as'],'attributes':_0x2d5d20[_0x9a05('0x18')],'include':_0x2d5d20[_0x9a05('0x1a')]?_[_0x9a05('0x1c')](_0x2d5d20[_0x9a05('0x1a')],function(_0x8e862d){return{'model':db[_0x8e862d['model']],'as':_0x8e862d['as'],'attributes':_0x8e862d[_0x9a05('0x18')],'include':_0x8e862d[_0x9a05('0x1a')]?_['map'](_0x8e862d[_0x9a05('0x1a')],function(_0x173d4e){return{'model':db[_0x173d4e[_0x9a05('0x1b')]],'as':_0x173d4e['as'],'attributes':_0x173d4e[_0x9a05('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a05('0xa')](function(_0x225336){logger[_0x9a05('0xb')](_0x9a05('0x1f'),_0x576046);logger['debug'](_0x9a05('0x1f'),_0x576046,JSON['stringify'](_0x225336));_0x332fd5(_0x225336);})['catch'](function(_0x23e025){logger[_0x9a05('0x11')](_0x9a05('0x1f'),_0x23e025[_0x9a05('0x12')],_0x576046);_0x13b907(_0x3df7f1[_0x9a05('0x11')](0x1f4,_0x23e025[_0x9a05('0x12')]));});});}; \ No newline at end of file +var _0x6576=['limit','include','map','model','attributes','ShowZendeskAccount','find','debug','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZendeskAccount','findAll','options','raw','where'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x6576,0xb8));var _0x6657=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0x6576[_0x2376d1];return _0x443759;};'use strict';var _=require(_0x6657('0x0'));var util=require(_0x6657('0x1'));var moment=require('moment');var BPromise=require(_0x6657('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6657('0x3'));var db=require(_0x6657('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6657('0x5'))('rpc');var config=require(_0x6657('0x6'));var jayson=require(_0x6657('0x7'));var client=jayson[_0x6657('0x8')][_0x6657('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc517a,_0x1e2438,_0x41aa01){return new BPromise(function(_0x1d3c37,_0x246f5f){return client[_0x6657('0xa')](_0xfc517a,_0x41aa01)[_0x6657('0xb')](function(_0x590396){logger['info'](_0x6657('0xc'),_0x1e2438,_0x6657('0xd'));logger['debug'](_0x6657('0xe'),_0x1e2438,_0x6657('0xd'),JSON[_0x6657('0xf')](_0x590396));if(_0x590396[_0x6657('0x10')]){if(_0x590396[_0x6657('0x10')][_0x6657('0x11')]===0x1f4){logger[_0x6657('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x1e2438,_0x590396[_0x6657('0x10')][_0x6657('0x12')]);return _0x246f5f(_0x590396['error']['message']);}logger['error'](_0x6657('0xc'),_0x1e2438,_0x590396[_0x6657('0x10')]['message']);return _0x1d3c37(_0x590396['error'][_0x6657('0x12')]);}else{logger[_0x6657('0x13')](_0x6657('0xc'),_0x1e2438,_0x6657('0xd'));_0x1d3c37(_0x590396[_0x6657('0x14')][_0x6657('0x12')]);}})['catch'](function(_0x40c913){logger[_0x6657('0x10')](_0x6657('0xc'),_0x1e2438,_0x40c913);_0x246f5f(_0x40c913);});});}exports[_0x6657('0x15')]=function(_0x43c213){var _0x4cd98f=this;return new Promise(function(_0x38da17,_0x4a7d88){return db['ZendeskAccount'][_0x6657('0x16')]({'raw':_0x43c213[_0x6657('0x17')]?_0x43c213[_0x6657('0x17')][_0x6657('0x18')]===undefined?!![]:![]:!![],'where':_0x43c213[_0x6657('0x17')]?_0x43c213[_0x6657('0x17')][_0x6657('0x19')]||null:null,'attributes':_0x43c213[_0x6657('0x17')]?_0x43c213[_0x6657('0x17')]['attributes']||null:null,'limit':_0x43c213[_0x6657('0x17')]?_0x43c213[_0x6657('0x17')][_0x6657('0x1a')]||null:null,'include':_0x43c213[_0x6657('0x17')]?_0x43c213[_0x6657('0x17')][_0x6657('0x1b')]?_[_0x6657('0x1c')](_0x43c213[_0x6657('0x17')]['include'],function(_0x3f35ad){return{'model':db[_0x3f35ad[_0x6657('0x1d')]],'as':_0x3f35ad['as'],'attributes':_0x3f35ad[_0x6657('0x1e')],'include':_0x3f35ad[_0x6657('0x1b')]?_[_0x6657('0x1c')](_0x3f35ad[_0x6657('0x1b')],function(_0x45aa4b){return{'model':db[_0x45aa4b[_0x6657('0x1d')]],'as':_0x45aa4b['as'],'attributes':_0x45aa4b[_0x6657('0x1e')],'include':_0x45aa4b['include']?_[_0x6657('0x1c')](_0x45aa4b[_0x6657('0x1b')],function(_0x1320e6){return{'model':db[_0x1320e6[_0x6657('0x1d')]],'as':_0x1320e6['as'],'attributes':_0x1320e6[_0x6657('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6657('0xb')](function(_0x43da76){logger[_0x6657('0x13')](_0x6657('0x15'),_0x43c213);logger['debug'](_0x6657('0x15'),_0x43c213,JSON['stringify'](_0x43da76));_0x38da17(_0x43da76);})['catch'](function(_0x437ea9){logger[_0x6657('0x10')](_0x6657('0x15'),_0x437ea9['message'],_0x43c213);_0x4a7d88(_0x4cd98f['error'](0x1f4,_0x437ea9[_0x6657('0x12')]));});});};exports[_0x6657('0x1f')]=function(_0xe15f13){var _0x5f536f=this;return new Promise(function(_0x2d8fd7,_0x202efe){return db['ZendeskAccount'][_0x6657('0x20')]({'raw':_0xe15f13[_0x6657('0x17')]?_0xe15f13[_0x6657('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xe15f13[_0x6657('0x17')]?_0xe15f13[_0x6657('0x17')][_0x6657('0x19')]||null:null,'attributes':_0xe15f13[_0x6657('0x17')]?_0xe15f13[_0x6657('0x17')][_0x6657('0x1e')]||null:null,'include':_0xe15f13['options']?_0xe15f13['options'][_0x6657('0x1b')]?_['map'](_0xe15f13[_0x6657('0x17')][_0x6657('0x1b')],function(_0xd137f5){return{'model':db[_0xd137f5[_0x6657('0x1d')]],'as':_0xd137f5['as'],'attributes':_0xd137f5[_0x6657('0x1e')],'include':_0xd137f5[_0x6657('0x1b')]?_[_0x6657('0x1c')](_0xd137f5[_0x6657('0x1b')],function(_0x9bd5f7){return{'model':db[_0x9bd5f7['model']],'as':_0x9bd5f7['as'],'attributes':_0x9bd5f7[_0x6657('0x1e')],'include':_0x9bd5f7[_0x6657('0x1b')]?_[_0x6657('0x1c')](_0x9bd5f7[_0x6657('0x1b')],function(_0xa5caa7){return{'model':db[_0xa5caa7[_0x6657('0x1d')]],'as':_0xa5caa7['as'],'attributes':_0xa5caa7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf359){logger['info'](_0x6657('0x1f'),_0xe15f13);logger[_0x6657('0x21')]('ShowZendeskAccount',_0xe15f13,JSON[_0x6657('0xf')](_0x3bf359));_0x2d8fd7(_0x3bf359);})[_0x6657('0x22')](function(_0x4eb4f5){logger[_0x6657('0x10')](_0x6657('0x1f'),_0x4eb4f5['message'],_0xe15f13);_0x202efe(_0x5f536f[_0x6657('0x10')](0x1f4,_0x4eb4f5['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3f99205..72ff71e 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0xb688,0xcf));var _0x8b68=function(_0x58c18d,_0x4c0584){_0x58c18d=_0x58c18d-0x0;var _0x20bd58=_0xb688[_0x58c18d];return _0x20bd58;};'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('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=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(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x4024,0x89));var _0x4402=function(_0x4a0dc2,_0x3b05b4){_0x4a0dc2=_0x4a0dc2-0x0;var _0x2d4909=_0x4024[_0x4a0dc2];return _0x2d4909;};'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 389f066..c38b723 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 _0x5764=['STRING','exports'];(function(_0x28ac59,_0x193d3a){var _0x2c98dc=function(_0x3a351b){while(--_0x3a351b){_0x28ac59['push'](_0x28ac59['shift']());}};_0x2c98dc(++_0x193d3a);}(_0x5764,0x169));var _0x4576=function(_0xbdb106,_0x5ee065){_0xbdb106=_0xbdb106-0x0;var _0x4c844d=_0x5764[_0xbdb106];return _0x4c844d;};'use strict';var Sequelize=require('sequelize');module[_0x4576('0x0')]={'name':{'type':Sequelize[_0x4576('0x1')]},'description':{'type':Sequelize[_0x4576('0x1')]}}; \ No newline at end of file +var _0x6250=['exports','STRING','sequelize'];(function(_0x3b20c5,_0x243274){var _0x159595=function(_0x331f86){while(--_0x331f86){_0x3b20c5['push'](_0x3b20c5['shift']());}};_0x159595(++_0x243274);}(_0x6250,0xe9));var _0x0625=function(_0x333e86,_0x586ce2){_0x333e86=_0x333e86-0x0;var _0xbaa68c=_0x6250[_0x333e86];return _0xbaa68c;};'use strict';var Sequelize=require(_0x0625('0x0'));module[_0x0625('0x1')]={'name':{'type':Sequelize[_0x0625('0x2')]},'description':{'type':Sequelize[_0x0625('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 64b618e..4147d30 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 _0xa6ec=['filters','pick','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','include','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0xc14056,_0x126272){var _0x2f6b98=function(_0x546f9e){while(--_0x546f9e){_0xc14056['push'](_0xc14056['shift']());}};_0x2f6b98(++_0x126272);}(_0xa6ec,0x1c1));var _0xca6e=function(_0x12fa80,_0x902b57){_0x12fa80=_0x12fa80-0x0;var _0x2b939b=_0xa6ec[_0x12fa80];return _0x2b939b;};'use strict';var emlformat=require(_0xca6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca6e('0x1'));var jsonpatch=require(_0xca6e('0x2'));var rp=require(_0xca6e('0x3'));var moment=require('moment');var BPromise=require(_0xca6e('0x4'));var Mustache=require(_0xca6e('0x5'));var util=require(_0xca6e('0x6'));var path=require(_0xca6e('0x7'));var sox=require(_0xca6e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6e('0x9'));var _=require(_0xca6e('0xa'));var squel=require(_0xca6e('0xb'));var crypto=require('crypto');var jsforce=require(_0xca6e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xca6e('0xd'));var Papa=require(_0xca6e('0xe'));var Redis=require(_0xca6e('0xf'));var authService=require(_0xca6e('0x10'));var qs=require(_0xca6e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca6e('0x12'));var logger=require('../../config/logger')(_0xca6e('0x13'));var utils=require(_0xca6e('0x14'));var config=require(_0xca6e('0x15'));var licenseUtil=require(_0xca6e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3bff,_0x5d1827){_0x5d1827=_0x5d1827||0xcc;return function(_0x4e2d8e){if(_0x4e2d8e){return _0x2b3bff[_0xca6e('0x17')](_0x5d1827);}return _0x2b3bff['status'](_0x5d1827)[_0xca6e('0x18')]();};}function respondWithResult(_0x591b34,_0x1f45f8){_0x1f45f8=_0x1f45f8||0xc8;return function(_0x381a4b){if(_0x381a4b){return _0x591b34[_0xca6e('0x19')](_0x1f45f8)[_0xca6e('0x1a')](_0x381a4b);}};}function respondWithFilteredResult(_0x32ef3d,_0x26bc14){return function(_0x1fcec6){if(_0x1fcec6){var _0x3f71ae=typeof _0x26bc14[_0xca6e('0x1b')]===_0xca6e('0x1c')&&typeof _0x26bc14['limit']===_0xca6e('0x1c');var _0x395ef4=_0x1fcec6[_0xca6e('0x1d')];var _0x4d60f9=_0x3f71ae?0x0:_0x26bc14['offset'];var _0xefa332=_0x3f71ae?_0x1fcec6[_0xca6e('0x1d')]:_0x26bc14[_0xca6e('0x1b')]+_0x26bc14['limit'];var _0x3aaee8;if(_0xefa332>=_0x395ef4){_0xefa332=_0x395ef4;_0x3aaee8=0xc8;}else{_0x3aaee8=0xce;}_0x32ef3d[_0xca6e('0x19')](_0x3aaee8);return _0x32ef3d[_0xca6e('0x1e')](_0xca6e('0x1f'),_0x4d60f9+'-'+_0xefa332+'/'+_0x395ef4)[_0xca6e('0x1a')](_0x1fcec6);}return null;};}function patchUpdates(_0x17efcb){return function(_0x11df38){try{jsonpatch[_0xca6e('0x20')](_0x11df38,_0x17efcb,!![]);}catch(_0x27530a){return BPromise[_0xca6e('0x21')](_0x27530a);}return _0x11df38[_0xca6e('0x22')]();};}function saveUpdates(_0xc5cf87,_0x89bd6){return function(_0x14f01e){if(_0x14f01e){return _0x14f01e[_0xca6e('0x23')](_0xc5cf87)['then'](function(_0x456662){return _0x456662;});}return null;};}function removeEntity(_0x2cfd3f,_0x4d54ef){return function(_0x19c573){if(_0x19c573){return _0x19c573[_0xca6e('0x24')]()[_0xca6e('0x25')](function(){_0x2cfd3f['status'](0xcc)[_0xca6e('0x18')]();});}};}function handleEntityNotFound(_0x29353d,_0x443805){return function(_0x198187){if(!_0x198187){_0x29353d['sendStatus'](0x194);}return _0x198187;};}function handleError(_0x22d985,_0x136c11){_0x136c11=_0x136c11||0x1f4;return function(_0x12d1f4){logger[_0xca6e('0x26')](_0x12d1f4[_0xca6e('0x27')]);if(_0x12d1f4['name']){delete _0x12d1f4['name'];}_0x22d985[_0xca6e('0x19')](_0x136c11)[_0xca6e('0x28')](_0x12d1f4);};}exports[_0xca6e('0x29')]=function(_0x17944b,_0x3d1021){var _0x498fb6={},_0x272e90={},_0x497c73={'count':0x0,'rows':[]};var _0x253b81=_[_0xca6e('0x2a')](db[_0xca6e('0x2b')][_0xca6e('0x2c')],function(_0x40ca81){return{'name':_0x40ca81[_0xca6e('0x2d')],'type':_0x40ca81[_0xca6e('0x2e')][_0xca6e('0x2f')]};});_0x272e90[_0xca6e('0x30')]=_[_0xca6e('0x2a')](_0x253b81,'name');_0x272e90['query']=_[_0xca6e('0x31')](_0x17944b[_0xca6e('0x32')]);_0x272e90['filters']=_[_0xca6e('0x33')](_0x272e90[_0xca6e('0x30')],_0x272e90['query']);_0x498fb6[_0xca6e('0x34')]=_['intersection'](_0x272e90[_0xca6e('0x30')],qs[_0xca6e('0x35')](_0x17944b[_0xca6e('0x32')][_0xca6e('0x35')]));_0x498fb6['attributes']=_0x498fb6[_0xca6e('0x34')][_0xca6e('0x36')]?_0x498fb6[_0xca6e('0x34')]:_0x272e90['model'];if(!_0x17944b[_0xca6e('0x32')][_0xca6e('0x37')](_0xca6e('0x38'))){_0x498fb6[_0xca6e('0x39')]=qs[_0xca6e('0x39')](_0x17944b['query']['limit']);_0x498fb6[_0xca6e('0x1b')]=qs[_0xca6e('0x1b')](_0x17944b['query'][_0xca6e('0x1b')]);}_0x498fb6[_0xca6e('0x3a')]=qs[_0xca6e('0x3b')](_0x17944b[_0xca6e('0x32')][_0xca6e('0x3b')]);_0x498fb6[_0xca6e('0x3c')]=qs[_0xca6e('0x3d')](_[_0xca6e('0x3e')](_0x17944b[_0xca6e('0x32')],_0x272e90[_0xca6e('0x3d')]),_0x253b81);if(_0x17944b[_0xca6e('0x32')][_0xca6e('0x3f')]){_0x498fb6[_0xca6e('0x3c')]=_[_0xca6e('0x40')](_0x498fb6[_0xca6e('0x3c')],{'$or':_[_0xca6e('0x2a')](_0x253b81,function(_0x5aee14){if(_0x5aee14['type']!==_0xca6e('0x41')){var _0x2bf4a9={};_0x2bf4a9[_0x5aee14[_0xca6e('0x42')]]={'$like':'%'+_0x17944b[_0xca6e('0x32')][_0xca6e('0x3f')]+'%'};return _0x2bf4a9;}})});}_0x498fb6=_[_0xca6e('0x40')]({},_0x498fb6,_0x17944b[_0xca6e('0x43')]);var _0x49f5ed={'where':_0x498fb6['where']};return db['ZendeskConfiguration'][_0xca6e('0x1d')](_0x49f5ed)['then'](function(_0x2d8b81){_0x497c73[_0xca6e('0x1d')]=_0x2d8b81;if(_0x17944b[_0xca6e('0x32')][_0xca6e('0x44')]){_0x498fb6['include']=[{'all':!![]}];}return db[_0xca6e('0x2b')]['findAll'](_0x498fb6);})[_0xca6e('0x25')](function(_0x101237){_0x497c73[_0xca6e('0x45')]=_0x101237;return _0x497c73;})[_0xca6e('0x25')](respondWithFilteredResult(_0x3d1021,_0x498fb6))[_0xca6e('0x46')](handleError(_0x3d1021,null));};exports['show']=function(_0x43716c,_0x12e476){var _0x12b631={'raw':![],'where':{'id':_0x43716c[_0xca6e('0x47')]['id']}},_0x5b16f2={};_0x5b16f2[_0xca6e('0x30')]=_[_0xca6e('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x5b16f2[_0xca6e('0x32')]=_['keys'](_0x43716c[_0xca6e('0x32')]);_0x5b16f2[_0xca6e('0x3d')]=_[_0xca6e('0x33')](_0x5b16f2[_0xca6e('0x30')],_0x5b16f2['query']);_0x12b631[_0xca6e('0x34')]=_[_0xca6e('0x33')](_0x5b16f2['model'],qs[_0xca6e('0x35')](_0x43716c[_0xca6e('0x32')][_0xca6e('0x35')]));_0x12b631[_0xca6e('0x34')]=_0x12b631['attributes'][_0xca6e('0x36')]?_0x12b631[_0xca6e('0x34')]:_0x5b16f2[_0xca6e('0x30')];if(_0x43716c[_0xca6e('0x32')]['includeAll']){_0x12b631[_0xca6e('0x48')]=[{'all':!![]}];}_0x12b631=_['merge']({},_0x12b631,_0x43716c[_0xca6e('0x43')]);return db[_0xca6e('0x2b')][_0xca6e('0x49')](_0x12b631)[_0xca6e('0x25')](handleEntityNotFound(_0x12e476,null))[_0xca6e('0x25')](respondWithResult(_0x12e476,null))['catch'](handleError(_0x12e476,null));};exports[_0xca6e('0x4a')]=function(_0x38e27b,_0x157dc5){return db[_0xca6e('0x2b')][_0xca6e('0x4a')](_0x38e27b[_0xca6e('0x4b')],{})[_0xca6e('0x25')](respondWithResult(_0x157dc5,0xc9))[_0xca6e('0x46')](handleError(_0x157dc5,null));};exports['update']=function(_0x25280f,_0xcc3eb0){if(_0x25280f[_0xca6e('0x4b')]['id']){delete _0x25280f['body']['id'];}return db[_0xca6e('0x2b')]['find']({'where':{'id':_0x25280f['params']['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0xcc3eb0,null))[_0xca6e('0x25')](saveUpdates(_0x25280f[_0xca6e('0x4b')],null))[_0xca6e('0x25')](respondWithResult(_0xcc3eb0,null))[_0xca6e('0x46')](handleError(_0xcc3eb0,null));};exports[_0xca6e('0x24')]=function(_0x462548,_0x5ae9a2){return db[_0xca6e('0x2b')]['find']({'where':{'id':_0x462548[_0xca6e('0x47')]['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x5ae9a2,null))[_0xca6e('0x25')](removeEntity(_0x5ae9a2,null))[_0xca6e('0x46')](handleError(_0x5ae9a2,null));};exports[_0xca6e('0x4c')]=function(_0x43872c,_0x207c76,_0x5c17ce){var _0x90171d={};var _0xdd881d={};var _0x5aea54;var _0x17b582;return db['ZendeskConfiguration'][_0xca6e('0x4d')]({'where':{'id':_0x43872c['params']['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x207c76,null))['then'](function(_0x2b46cf){if(_0x2b46cf){_0x5aea54=_0x2b46cf;_0xdd881d['model']=_[_0xca6e('0x31')](db[_0xca6e('0x4e')][_0xca6e('0x2c')]);_0xdd881d[_0xca6e('0x32')]=_[_0xca6e('0x31')](_0x43872c[_0xca6e('0x32')]);_0xdd881d['filters']=_[_0xca6e('0x33')](_0xdd881d['model'],_0xdd881d['query']);_0x90171d['attributes']=_[_0xca6e('0x33')](_0xdd881d[_0xca6e('0x30')],qs['fields'](_0x43872c[_0xca6e('0x32')]['fields']));_0x90171d[_0xca6e('0x34')]=_0x90171d[_0xca6e('0x34')]['length']?_0x90171d[_0xca6e('0x34')]:_0xdd881d[_0xca6e('0x30')];_0x90171d[_0xca6e('0x3a')]=qs['sort'](_0x43872c[_0xca6e('0x32')][_0xca6e('0x3b')]);_0x90171d['where']=qs[_0xca6e('0x3d')](_[_0xca6e('0x3e')](_0x43872c[_0xca6e('0x32')],_0xdd881d['filters']));if(_0x43872c[_0xca6e('0x32')][_0xca6e('0x3f')]){_0x90171d[_0xca6e('0x3c')]=_[_0xca6e('0x40')](_0x90171d[_0xca6e('0x3c')],{'$or':_['map'](_0x90171d['attributes'],function(_0x5aea7f){var _0x2a1c92={};_0x2a1c92[_0x5aea7f]={'$like':'%'+_0x43872c[_0xca6e('0x32')][_0xca6e('0x3f')]+'%'};return _0x2a1c92;})});}_0x90171d=_['merge']({},_0x90171d,_0x43872c[_0xca6e('0x43')]);return _0x5aea54[_0xca6e('0x4c')](_0x90171d);}})['then'](function(_0x3e6ea9){if(_0x3e6ea9){_0x17b582=_0x3e6ea9['length'];if(!_0x43872c[_0xca6e('0x32')][_0xca6e('0x37')](_0xca6e('0x38'))){_0x90171d[_0xca6e('0x39')]=qs[_0xca6e('0x39')](_0x43872c['query'][_0xca6e('0x39')]);_0x90171d[_0xca6e('0x1b')]=qs[_0xca6e('0x1b')](_0x43872c['query'][_0xca6e('0x1b')]);}return _0x5aea54[_0xca6e('0x4c')](_0x90171d);}})[_0xca6e('0x25')](function(_0x12539f){if(_0x12539f){return _0x12539f?{'count':_0x17b582,'rows':_0x12539f}:null;}})[_0xca6e('0x25')](respondWithResult(_0x207c76,null))['catch'](handleError(_0x207c76,null));};exports[_0xca6e('0x4f')]=function(_0x2ef0da,_0x358ad8,_0x3f2008){var _0x35f6c9={};var _0xbf9f5f={};var _0xc57cda;var _0x119983;return db[_0xca6e('0x2b')][_0xca6e('0x4d')]({'where':{'id':_0x2ef0da[_0xca6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x358ad8,null))[_0xca6e('0x25')](function(_0x274a6c){if(_0x274a6c){_0xc57cda=_0x274a6c;_0xbf9f5f[_0xca6e('0x30')]=_[_0xca6e('0x31')](db[_0xca6e('0x4e')][_0xca6e('0x2c')]);_0xbf9f5f[_0xca6e('0x32')]=_[_0xca6e('0x31')](_0x2ef0da[_0xca6e('0x32')]);_0xbf9f5f[_0xca6e('0x3d')]=_[_0xca6e('0x33')](_0xbf9f5f[_0xca6e('0x30')],_0xbf9f5f[_0xca6e('0x32')]);_0x35f6c9[_0xca6e('0x34')]=_[_0xca6e('0x33')](_0xbf9f5f[_0xca6e('0x30')],qs[_0xca6e('0x35')](_0x2ef0da[_0xca6e('0x32')][_0xca6e('0x35')]));_0x35f6c9[_0xca6e('0x34')]=_0x35f6c9[_0xca6e('0x34')]['length']?_0x35f6c9[_0xca6e('0x34')]:_0xbf9f5f[_0xca6e('0x30')];_0x35f6c9[_0xca6e('0x3a')]=qs['sort'](_0x2ef0da['query'][_0xca6e('0x3b')]);_0x35f6c9[_0xca6e('0x3c')]=qs[_0xca6e('0x3d')](_[_0xca6e('0x3e')](_0x2ef0da['query'],_0xbf9f5f[_0xca6e('0x3d')]));if(_0x2ef0da[_0xca6e('0x32')][_0xca6e('0x3f')]){_0x35f6c9[_0xca6e('0x3c')]=_[_0xca6e('0x40')](_0x35f6c9[_0xca6e('0x3c')],{'$or':_[_0xca6e('0x2a')](_0x35f6c9[_0xca6e('0x34')],function(_0x4db6e6){var _0x4a894d={};_0x4a894d[_0x4db6e6]={'$like':'%'+_0x2ef0da[_0xca6e('0x32')][_0xca6e('0x3f')]+'%'};return _0x4a894d;})});}_0x35f6c9=_[_0xca6e('0x40')]({},_0x35f6c9,_0x2ef0da[_0xca6e('0x43')]);return _0xc57cda[_0xca6e('0x4f')](_0x35f6c9);}})[_0xca6e('0x25')](function(_0x26cef5){if(_0x26cef5){_0x119983=_0x26cef5[_0xca6e('0x36')];if(!_0x2ef0da['query'][_0xca6e('0x37')]('nolimit')){_0x35f6c9[_0xca6e('0x39')]=qs[_0xca6e('0x39')](_0x2ef0da['query'][_0xca6e('0x39')]);_0x35f6c9[_0xca6e('0x1b')]=qs[_0xca6e('0x1b')](_0x2ef0da[_0xca6e('0x32')][_0xca6e('0x1b')]);}return _0xc57cda[_0xca6e('0x4f')](_0x35f6c9);}})[_0xca6e('0x25')](function(_0x15ddf4){if(_0x15ddf4){return _0x15ddf4?{'count':_0x119983,'rows':_0x15ddf4}:null;}})[_0xca6e('0x25')](respondWithResult(_0x358ad8,null))['catch'](handleError(_0x358ad8,null));};exports[_0xca6e('0x50')]=function(_0x5cf2e7,_0x3a6936,_0xba750){var _0x1e220e={};var _0x5703ee={};var _0x4e3504;var _0x543e1d;return db[_0xca6e('0x2b')][_0xca6e('0x4d')]({'where':{'id':_0x5cf2e7[_0xca6e('0x47')]['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x3a6936,null))['then'](function(_0x2c78bb){if(_0x2c78bb){_0x4e3504=_0x2c78bb;_0x5703ee[_0xca6e('0x30')]=_['keys'](db[_0xca6e('0x4e')]['rawAttributes']);_0x5703ee[_0xca6e('0x32')]=_[_0xca6e('0x31')](_0x5cf2e7[_0xca6e('0x32')]);_0x5703ee[_0xca6e('0x3d')]=_[_0xca6e('0x33')](_0x5703ee[_0xca6e('0x30')],_0x5703ee['query']);_0x1e220e[_0xca6e('0x34')]=_['intersection'](_0x5703ee[_0xca6e('0x30')],qs[_0xca6e('0x35')](_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x35')]));_0x1e220e[_0xca6e('0x34')]=_0x1e220e[_0xca6e('0x34')][_0xca6e('0x36')]?_0x1e220e[_0xca6e('0x34')]:_0x5703ee['model'];_0x1e220e[_0xca6e('0x3a')]=qs[_0xca6e('0x3b')](_0x5cf2e7[_0xca6e('0x32')]['sort']);_0x1e220e['where']=qs[_0xca6e('0x3d')](_[_0xca6e('0x3e')](_0x5cf2e7['query'],_0x5703ee[_0xca6e('0x3d')]));if(_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x3f')]){_0x1e220e[_0xca6e('0x3c')]=_[_0xca6e('0x40')](_0x1e220e['where'],{'$or':_[_0xca6e('0x2a')](_0x1e220e['attributes'],function(_0x39bb37){var _0x86f986={};_0x86f986[_0x39bb37]={'$like':'%'+_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x3f')]+'%'};return _0x86f986;})});}_0x1e220e=_[_0xca6e('0x40')]({},_0x1e220e,_0x5cf2e7[_0xca6e('0x43')]);return _0x4e3504[_0xca6e('0x50')](_0x1e220e);}})['then'](function(_0x1400d1){if(_0x1400d1){_0x543e1d=_0x1400d1[_0xca6e('0x36')];if(!_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x37')]('nolimit')){_0x1e220e['limit']=qs['limit'](_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x39')]);_0x1e220e[_0xca6e('0x1b')]=qs[_0xca6e('0x1b')](_0x5cf2e7[_0xca6e('0x32')][_0xca6e('0x1b')]);}return _0x4e3504[_0xca6e('0x50')](_0x1e220e);}})[_0xca6e('0x25')](function(_0x12218a){if(_0x12218a){return _0x12218a?{'count':_0x543e1d,'rows':_0x12218a}:null;}})[_0xca6e('0x25')](respondWithResult(_0x3a6936,null))[_0xca6e('0x46')](handleError(_0x3a6936,null));};exports[_0xca6e('0x51')]=function(_0x2d95a7,_0x239684,_0x35c5b8){var _0x5e4039={};var _0x2928e3={};var _0xc5a799;var _0x47c4d0;return db[_0xca6e('0x2b')][_0xca6e('0x4d')]({'where':{'id':_0x2d95a7[_0xca6e('0x47')]['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x239684,null))[_0xca6e('0x25')](function(_0x283a4c){if(_0x283a4c){_0xc5a799=_0x283a4c;_0x2928e3['model']=_['keys'](db[_0xca6e('0x52')][_0xca6e('0x2c')]);_0x2928e3['query']=_[_0xca6e('0x31')](_0x2d95a7[_0xca6e('0x32')]);_0x2928e3[_0xca6e('0x3d')]=_[_0xca6e('0x33')](_0x2928e3['model'],_0x2928e3[_0xca6e('0x32')]);_0x5e4039[_0xca6e('0x34')]=_[_0xca6e('0x33')](_0x2928e3[_0xca6e('0x30')],qs[_0xca6e('0x35')](_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x35')]));_0x5e4039['attributes']=_0x5e4039['attributes']['length']?_0x5e4039[_0xca6e('0x34')]:_0x2928e3['model'];_0x5e4039[_0xca6e('0x3a')]=qs[_0xca6e('0x3b')](_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x3b')]);_0x5e4039[_0xca6e('0x3c')]=qs[_0xca6e('0x3d')](_[_0xca6e('0x3e')](_0x2d95a7[_0xca6e('0x32')],_0x2928e3[_0xca6e('0x3d')]));if(_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x3f')]){_0x5e4039[_0xca6e('0x3c')]=_['merge'](_0x5e4039[_0xca6e('0x3c')],{'$or':_['map'](_0x5e4039[_0xca6e('0x34')],function(_0x3a8343){var _0x47a886={};_0x47a886[_0x3a8343]={'$like':'%'+_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x3f')]+'%'};return _0x47a886;})});}_0x5e4039=_['merge']({},_0x5e4039,_0x2d95a7[_0xca6e('0x43')]);return _0xc5a799[_0xca6e('0x51')](_0x5e4039);}})[_0xca6e('0x25')](function(_0x4cc8a9){if(_0x4cc8a9){_0x47c4d0=_0x4cc8a9['length'];if(!_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x37')](_0xca6e('0x38'))){_0x5e4039['limit']=qs[_0xca6e('0x39')](_0x2d95a7[_0xca6e('0x32')][_0xca6e('0x39')]);_0x5e4039[_0xca6e('0x1b')]=qs[_0xca6e('0x1b')](_0x2d95a7['query']['offset']);}return _0xc5a799[_0xca6e('0x51')](_0x5e4039);}})[_0xca6e('0x25')](function(_0x3d54d0){if(_0x3d54d0){return _0x3d54d0?{'count':_0x47c4d0,'rows':_0x3d54d0}:null;}})[_0xca6e('0x25')](respondWithResult(_0x239684,null))[_0xca6e('0x46')](handleError(_0x239684,null));};exports['setTags']=function(_0x3bc267,_0x5d82c4,_0xe04390){if(_0x3bc267[_0xca6e('0x4b')]['id']){delete _0x3bc267['body']['id'];}return db[_0xca6e('0x2b')][_0xca6e('0x4d')]({'where':{'id':_0x3bc267[_0xca6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d82c4,null))[_0xca6e('0x25')](function(_0x1a91c9){if(_0x1a91c9){return _0x1a91c9[_0xca6e('0x53')](_0x3bc267[_0xca6e('0x4b')][_0xca6e('0x54')]||[]);}return null;})[_0xca6e('0x25')](respondWithResult(_0x5d82c4,null))[_0xca6e('0x46')](handleError(_0x5d82c4,null));}; \ No newline at end of file +var _0xf560=['send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','destroy','getFields','findOne','ZendeskField','order','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0xa613a6,_0x17119a){var _0x37580b=function(_0x1d02a6){while(--_0x1d02a6){_0xa613a6['push'](_0xa613a6['shift']());}};_0x37580b(++_0x17119a);}(_0xf560,0x12d));var _0x0f56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf560[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0f56('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f56('0x1'));var rp=require(_0x0f56('0x2'));var moment=require(_0x0f56('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f56('0x4'));var util=require('util');var path=require(_0x0f56('0x5'));var sox=require(_0x0f56('0x6'));var csv=require(_0x0f56('0x7'));var ejs=require(_0x0f56('0x8'));var fs=require('fs');var fs_extra=require(_0x0f56('0x9'));var _=require(_0x0f56('0xa'));var squel=require(_0x0f56('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f56('0xc'));var deskjs=require(_0x0f56('0xd'));var toCsv=require(_0x0f56('0x7'));var querystring=require('querystring');var Papa=require(_0x0f56('0xe'));var Redis=require(_0x0f56('0xf'));var authService=require(_0x0f56('0x10'));var qs=require(_0x0f56('0x11'));var as=require(_0x0f56('0x12'));var hardwareService=require(_0x0f56('0x13'));var logger=require(_0x0f56('0x14'))('api');var utils=require(_0x0f56('0x15'));var config=require(_0x0f56('0x16'));var licenseUtil=require(_0x0f56('0x17'));var db=require(_0x0f56('0x18'))['db'];function respondWithStatusCode(_0x3b9a8d,_0x4767fe){_0x4767fe=_0x4767fe||0xcc;return function(_0x3714b4){if(_0x3714b4){return _0x3b9a8d[_0x0f56('0x19')](_0x4767fe);}return _0x3b9a8d['status'](_0x4767fe)[_0x0f56('0x1a')]();};}function respondWithResult(_0x7c2834,_0x99db23){_0x99db23=_0x99db23||0xc8;return function(_0x382e23){if(_0x382e23){return _0x7c2834[_0x0f56('0x1b')](_0x99db23)[_0x0f56('0x1c')](_0x382e23);}};}function respondWithFilteredResult(_0x572af2,_0x307dbb){return function(_0x300a1e){if(_0x300a1e){var _0x5edcef=typeof _0x307dbb[_0x0f56('0x1d')]===_0x0f56('0x1e')&&typeof _0x307dbb[_0x0f56('0x1f')]===_0x0f56('0x1e');var _0x20d36b=_0x300a1e[_0x0f56('0x20')];var _0x7015c7=_0x5edcef?0x0:_0x307dbb[_0x0f56('0x1d')];var _0x128411=_0x5edcef?_0x300a1e[_0x0f56('0x20')]:_0x307dbb[_0x0f56('0x1d')]+_0x307dbb[_0x0f56('0x1f')];var _0xb2a64b;if(_0x128411>=_0x20d36b){_0x128411=_0x20d36b;_0xb2a64b=0xc8;}else{_0xb2a64b=0xce;}_0x572af2['status'](_0xb2a64b);return _0x572af2[_0x0f56('0x21')](_0x0f56('0x22'),_0x7015c7+'-'+_0x128411+'/'+_0x20d36b)[_0x0f56('0x1c')](_0x300a1e);}return null;};}function patchUpdates(_0x5c3451){return function(_0x17c771){try{jsonpatch[_0x0f56('0x23')](_0x17c771,_0x5c3451,!![]);}catch(_0x89013d){return BPromise[_0x0f56('0x24')](_0x89013d);}return _0x17c771[_0x0f56('0x25')]();};}function saveUpdates(_0x3d4e72,_0x54326b){return function(_0x341a43){if(_0x341a43){return _0x341a43[_0x0f56('0x26')](_0x3d4e72)[_0x0f56('0x27')](function(_0x41f8d8){return _0x41f8d8;});}return null;};}function removeEntity(_0x4cad53,_0x3dae00){return function(_0x4a0b7d){if(_0x4a0b7d){return _0x4a0b7d['destroy']()[_0x0f56('0x27')](function(){_0x4cad53['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x347e54,_0x486116){return function(_0x4f4b75){if(!_0x4f4b75){_0x347e54[_0x0f56('0x19')](0x194);}return _0x4f4b75;};}function handleError(_0x151bc5,_0x253da1){_0x253da1=_0x253da1||0x1f4;return function(_0x17741e){logger[_0x0f56('0x28')](_0x17741e[_0x0f56('0x29')]);if(_0x17741e[_0x0f56('0x2a')]){delete _0x17741e[_0x0f56('0x2a')];}_0x151bc5[_0x0f56('0x1b')](_0x253da1)[_0x0f56('0x2b')](_0x17741e);};}exports[_0x0f56('0x2c')]=function(_0x3b69bc,_0x45b1db){var _0x1a000d={},_0xd1f596={},_0x104d14={'count':0x0,'rows':[]};var _0x1f6979=_[_0x0f56('0x2d')](db[_0x0f56('0x2e')][_0x0f56('0x2f')],function(_0x90e457){return{'name':_0x90e457[_0x0f56('0x30')],'type':_0x90e457[_0x0f56('0x31')]['key']};});_0xd1f596[_0x0f56('0x32')]=_['map'](_0x1f6979,_0x0f56('0x2a'));_0xd1f596[_0x0f56('0x33')]=_[_0x0f56('0x34')](_0x3b69bc[_0x0f56('0x33')]);_0xd1f596[_0x0f56('0x35')]=_[_0x0f56('0x36')](_0xd1f596['model'],_0xd1f596[_0x0f56('0x33')]);_0x1a000d[_0x0f56('0x37')]=_[_0x0f56('0x36')](_0xd1f596[_0x0f56('0x32')],qs[_0x0f56('0x38')](_0x3b69bc[_0x0f56('0x33')][_0x0f56('0x38')]));_0x1a000d['attributes']=_0x1a000d[_0x0f56('0x37')][_0x0f56('0x39')]?_0x1a000d['attributes']:_0xd1f596[_0x0f56('0x32')];if(!_0x3b69bc['query'][_0x0f56('0x3a')](_0x0f56('0x3b'))){_0x1a000d[_0x0f56('0x1f')]=qs['limit'](_0x3b69bc[_0x0f56('0x33')]['limit']);_0x1a000d[_0x0f56('0x1d')]=qs[_0x0f56('0x1d')](_0x3b69bc[_0x0f56('0x33')][_0x0f56('0x1d')]);}_0x1a000d['order']=qs[_0x0f56('0x3c')](_0x3b69bc[_0x0f56('0x33')][_0x0f56('0x3c')]);_0x1a000d[_0x0f56('0x3d')]=qs[_0x0f56('0x35')](_['pick'](_0x3b69bc['query'],_0xd1f596[_0x0f56('0x35')]),_0x1f6979);if(_0x3b69bc[_0x0f56('0x33')]['filter']){_0x1a000d[_0x0f56('0x3d')]=_[_0x0f56('0x3e')](_0x1a000d['where'],{'$or':_[_0x0f56('0x2d')](_0x1f6979,function(_0x1935f5){if(_0x1935f5['type']!==_0x0f56('0x3f')){var _0x2d8769={};_0x2d8769[_0x1935f5[_0x0f56('0x2a')]]={'$like':'%'+_0x3b69bc['query'][_0x0f56('0x40')]+'%'};return _0x2d8769;}})});}_0x1a000d=_[_0x0f56('0x3e')]({},_0x1a000d,_0x3b69bc[_0x0f56('0x41')]);var _0x4eda2f={'where':_0x1a000d['where']};return db['ZendeskConfiguration'][_0x0f56('0x20')](_0x4eda2f)['then'](function(_0x4412c2){_0x104d14[_0x0f56('0x20')]=_0x4412c2;if(_0x3b69bc[_0x0f56('0x33')][_0x0f56('0x42')]){_0x1a000d['include']=[{'all':!![]}];}return db[_0x0f56('0x2e')][_0x0f56('0x43')](_0x1a000d);})[_0x0f56('0x27')](function(_0x48053c){_0x104d14[_0x0f56('0x44')]=_0x48053c;return _0x104d14;})[_0x0f56('0x27')](respondWithFilteredResult(_0x45b1db,_0x1a000d))['catch'](handleError(_0x45b1db,null));};exports[_0x0f56('0x45')]=function(_0x13d594,_0x2a4379){var _0x2b85f9={'raw':![],'where':{'id':_0x13d594[_0x0f56('0x46')]['id']}},_0x47e7bb={};_0x47e7bb[_0x0f56('0x32')]=_[_0x0f56('0x34')](db[_0x0f56('0x2e')][_0x0f56('0x2f')]);_0x47e7bb[_0x0f56('0x33')]=_[_0x0f56('0x34')](_0x13d594[_0x0f56('0x33')]);_0x47e7bb[_0x0f56('0x35')]=_['intersection'](_0x47e7bb['model'],_0x47e7bb['query']);_0x2b85f9[_0x0f56('0x37')]=_['intersection'](_0x47e7bb[_0x0f56('0x32')],qs[_0x0f56('0x38')](_0x13d594[_0x0f56('0x33')][_0x0f56('0x38')]));_0x2b85f9[_0x0f56('0x37')]=_0x2b85f9[_0x0f56('0x37')][_0x0f56('0x39')]?_0x2b85f9[_0x0f56('0x37')]:_0x47e7bb[_0x0f56('0x32')];if(_0x13d594[_0x0f56('0x33')][_0x0f56('0x42')]){_0x2b85f9['include']=[{'all':!![]}];}_0x2b85f9=_[_0x0f56('0x3e')]({},_0x2b85f9,_0x13d594[_0x0f56('0x41')]);return db[_0x0f56('0x2e')][_0x0f56('0x47')](_0x2b85f9)[_0x0f56('0x27')](handleEntityNotFound(_0x2a4379,null))[_0x0f56('0x27')](respondWithResult(_0x2a4379,null))[_0x0f56('0x48')](handleError(_0x2a4379,null));};exports['create']=function(_0xb54108,_0x7e11c6){return db[_0x0f56('0x2e')][_0x0f56('0x49')](_0xb54108[_0x0f56('0x4a')],{})[_0x0f56('0x27')](respondWithResult(_0x7e11c6,0xc9))[_0x0f56('0x48')](handleError(_0x7e11c6,null));};exports['update']=function(_0x377da7,_0x26fdba){if(_0x377da7[_0x0f56('0x4a')]['id']){delete _0x377da7['body']['id'];}return db[_0x0f56('0x2e')][_0x0f56('0x47')]({'where':{'id':_0x377da7[_0x0f56('0x46')]['id']}})[_0x0f56('0x27')](handleEntityNotFound(_0x26fdba,null))[_0x0f56('0x27')](saveUpdates(_0x377da7[_0x0f56('0x4a')],null))[_0x0f56('0x27')](respondWithResult(_0x26fdba,null))['catch'](handleError(_0x26fdba,null));};exports[_0x0f56('0x4b')]=function(_0x25bc1b,_0x4b084f){return db[_0x0f56('0x2e')][_0x0f56('0x47')]({'where':{'id':_0x25bc1b[_0x0f56('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b084f,null))[_0x0f56('0x27')](removeEntity(_0x4b084f,null))[_0x0f56('0x48')](handleError(_0x4b084f,null));};exports[_0x0f56('0x4c')]=function(_0xf4429c,_0x11d4b9,_0x50ba76){var _0x518b33={};var _0x3bbdba={};var _0x24868b;var _0xd03ab9;return db['ZendeskConfiguration'][_0x0f56('0x4d')]({'where':{'id':_0xf4429c[_0x0f56('0x46')]['id']}})[_0x0f56('0x27')](handleEntityNotFound(_0x11d4b9,null))[_0x0f56('0x27')](function(_0x50b3b5){if(_0x50b3b5){_0x24868b=_0x50b3b5;_0x3bbdba[_0x0f56('0x32')]=_[_0x0f56('0x34')](db[_0x0f56('0x4e')]['rawAttributes']);_0x3bbdba[_0x0f56('0x33')]=_[_0x0f56('0x34')](_0xf4429c[_0x0f56('0x33')]);_0x3bbdba[_0x0f56('0x35')]=_[_0x0f56('0x36')](_0x3bbdba[_0x0f56('0x32')],_0x3bbdba[_0x0f56('0x33')]);_0x518b33['attributes']=_['intersection'](_0x3bbdba[_0x0f56('0x32')],qs[_0x0f56('0x38')](_0xf4429c[_0x0f56('0x33')][_0x0f56('0x38')]));_0x518b33['attributes']=_0x518b33[_0x0f56('0x37')]['length']?_0x518b33['attributes']:_0x3bbdba['model'];_0x518b33[_0x0f56('0x4f')]=qs[_0x0f56('0x3c')](_0xf4429c[_0x0f56('0x33')][_0x0f56('0x3c')]);_0x518b33[_0x0f56('0x3d')]=qs['filters'](_['pick'](_0xf4429c[_0x0f56('0x33')],_0x3bbdba[_0x0f56('0x35')]));if(_0xf4429c['query'][_0x0f56('0x40')]){_0x518b33['where']=_[_0x0f56('0x3e')](_0x518b33[_0x0f56('0x3d')],{'$or':_['map'](_0x518b33[_0x0f56('0x37')],function(_0x40068a){var _0x56b3c8={};_0x56b3c8[_0x40068a]={'$like':'%'+_0xf4429c[_0x0f56('0x33')]['filter']+'%'};return _0x56b3c8;})});}_0x518b33=_[_0x0f56('0x3e')]({},_0x518b33,_0xf4429c[_0x0f56('0x41')]);return _0x24868b['getFields'](_0x518b33);}})['then'](function(_0x5a656e){if(_0x5a656e){_0xd03ab9=_0x5a656e['length'];if(!_0xf4429c[_0x0f56('0x33')][_0x0f56('0x3a')](_0x0f56('0x3b'))){_0x518b33[_0x0f56('0x1f')]=qs['limit'](_0xf4429c[_0x0f56('0x33')][_0x0f56('0x1f')]);_0x518b33[_0x0f56('0x1d')]=qs[_0x0f56('0x1d')](_0xf4429c['query']['offset']);}return _0x24868b['getFields'](_0x518b33);}})[_0x0f56('0x27')](function(_0x3e5df4){if(_0x3e5df4){return _0x3e5df4?{'count':_0xd03ab9,'rows':_0x3e5df4}:null;}})['then'](respondWithResult(_0x11d4b9,null))['catch'](handleError(_0x11d4b9,null));};exports['getSubjects']=function(_0x10c2b5,_0x1d1d45,_0x39310f){var _0x216550={};var _0x4e750f={};var _0x13d366;var _0x36bf78;return db[_0x0f56('0x2e')]['findOne']({'where':{'id':_0x10c2b5[_0x0f56('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d1d45,null))['then'](function(_0xe787eb){if(_0xe787eb){_0x13d366=_0xe787eb;_0x4e750f['model']=_[_0x0f56('0x34')](db[_0x0f56('0x4e')]['rawAttributes']);_0x4e750f[_0x0f56('0x33')]=_['keys'](_0x10c2b5[_0x0f56('0x33')]);_0x4e750f[_0x0f56('0x35')]=_[_0x0f56('0x36')](_0x4e750f[_0x0f56('0x32')],_0x4e750f[_0x0f56('0x33')]);_0x216550['attributes']=_[_0x0f56('0x36')](_0x4e750f['model'],qs['fields'](_0x10c2b5['query'][_0x0f56('0x38')]));_0x216550[_0x0f56('0x37')]=_0x216550[_0x0f56('0x37')][_0x0f56('0x39')]?_0x216550['attributes']:_0x4e750f[_0x0f56('0x32')];_0x216550[_0x0f56('0x4f')]=qs[_0x0f56('0x3c')](_0x10c2b5['query'][_0x0f56('0x3c')]);_0x216550[_0x0f56('0x3d')]=qs['filters'](_[_0x0f56('0x50')](_0x10c2b5[_0x0f56('0x33')],_0x4e750f[_0x0f56('0x35')]));if(_0x10c2b5[_0x0f56('0x33')][_0x0f56('0x40')]){_0x216550[_0x0f56('0x3d')]=_[_0x0f56('0x3e')](_0x216550[_0x0f56('0x3d')],{'$or':_[_0x0f56('0x2d')](_0x216550[_0x0f56('0x37')],function(_0x106c31){var _0x53c2ac={};_0x53c2ac[_0x106c31]={'$like':'%'+_0x10c2b5[_0x0f56('0x33')][_0x0f56('0x40')]+'%'};return _0x53c2ac;})});}_0x216550=_[_0x0f56('0x3e')]({},_0x216550,_0x10c2b5[_0x0f56('0x41')]);return _0x13d366[_0x0f56('0x51')](_0x216550);}})[_0x0f56('0x27')](function(_0x521ea5){if(_0x521ea5){_0x36bf78=_0x521ea5['length'];if(!_0x10c2b5[_0x0f56('0x33')][_0x0f56('0x3a')](_0x0f56('0x3b'))){_0x216550[_0x0f56('0x1f')]=qs['limit'](_0x10c2b5[_0x0f56('0x33')]['limit']);_0x216550[_0x0f56('0x1d')]=qs[_0x0f56('0x1d')](_0x10c2b5[_0x0f56('0x33')][_0x0f56('0x1d')]);}return _0x13d366[_0x0f56('0x51')](_0x216550);}})[_0x0f56('0x27')](function(_0x1c3d93){if(_0x1c3d93){return _0x1c3d93?{'count':_0x36bf78,'rows':_0x1c3d93}:null;}})[_0x0f56('0x27')](respondWithResult(_0x1d1d45,null))[_0x0f56('0x48')](handleError(_0x1d1d45,null));};exports[_0x0f56('0x52')]=function(_0x460eb9,_0xa5bc1f,_0x38bd4f){var _0x1993ac={};var _0x311841={};var _0x4a506e;var _0x3a59e2;return db[_0x0f56('0x2e')][_0x0f56('0x4d')]({'where':{'id':_0x460eb9[_0x0f56('0x46')]['id']}})[_0x0f56('0x27')](handleEntityNotFound(_0xa5bc1f,null))[_0x0f56('0x27')](function(_0x15ed67){if(_0x15ed67){_0x4a506e=_0x15ed67;_0x311841[_0x0f56('0x32')]=_[_0x0f56('0x34')](db[_0x0f56('0x4e')][_0x0f56('0x2f')]);_0x311841['query']=_['keys'](_0x460eb9[_0x0f56('0x33')]);_0x311841[_0x0f56('0x35')]=_[_0x0f56('0x36')](_0x311841[_0x0f56('0x32')],_0x311841['query']);_0x1993ac[_0x0f56('0x37')]=_[_0x0f56('0x36')](_0x311841[_0x0f56('0x32')],qs['fields'](_0x460eb9[_0x0f56('0x33')]['fields']));_0x1993ac[_0x0f56('0x37')]=_0x1993ac[_0x0f56('0x37')][_0x0f56('0x39')]?_0x1993ac[_0x0f56('0x37')]:_0x311841['model'];_0x1993ac[_0x0f56('0x4f')]=qs[_0x0f56('0x3c')](_0x460eb9[_0x0f56('0x33')]['sort']);_0x1993ac[_0x0f56('0x3d')]=qs['filters'](_[_0x0f56('0x50')](_0x460eb9[_0x0f56('0x33')],_0x311841[_0x0f56('0x35')]));if(_0x460eb9['query']['filter']){_0x1993ac[_0x0f56('0x3d')]=_['merge'](_0x1993ac['where'],{'$or':_[_0x0f56('0x2d')](_0x1993ac[_0x0f56('0x37')],function(_0x3b99cc){var _0xd7b4cf={};_0xd7b4cf[_0x3b99cc]={'$like':'%'+_0x460eb9[_0x0f56('0x33')]['filter']+'%'};return _0xd7b4cf;})});}_0x1993ac=_[_0x0f56('0x3e')]({},_0x1993ac,_0x460eb9['options']);return _0x4a506e[_0x0f56('0x52')](_0x1993ac);}})['then'](function(_0x28f4d6){if(_0x28f4d6){_0x3a59e2=_0x28f4d6[_0x0f56('0x39')];if(!_0x460eb9['query'][_0x0f56('0x3a')](_0x0f56('0x3b'))){_0x1993ac[_0x0f56('0x1f')]=qs[_0x0f56('0x1f')](_0x460eb9[_0x0f56('0x33')][_0x0f56('0x1f')]);_0x1993ac['offset']=qs['offset'](_0x460eb9[_0x0f56('0x33')]['offset']);}return _0x4a506e[_0x0f56('0x52')](_0x1993ac);}})[_0x0f56('0x27')](function(_0x30f4ad){if(_0x30f4ad){return _0x30f4ad?{'count':_0x3a59e2,'rows':_0x30f4ad}:null;}})[_0x0f56('0x27')](respondWithResult(_0xa5bc1f,null))[_0x0f56('0x48')](handleError(_0xa5bc1f,null));};exports[_0x0f56('0x53')]=function(_0x1df3f5,_0x91261c,_0x4f8ab9){var _0x52fa44={};var _0x39c862={};var _0x2afdfe;var _0x55ed90;return db[_0x0f56('0x2e')][_0x0f56('0x4d')]({'where':{'id':_0x1df3f5['params']['id']}})[_0x0f56('0x27')](handleEntityNotFound(_0x91261c,null))[_0x0f56('0x27')](function(_0x24e131){if(_0x24e131){_0x2afdfe=_0x24e131;_0x39c862[_0x0f56('0x32')]=_[_0x0f56('0x34')](db['Tag'][_0x0f56('0x2f')]);_0x39c862[_0x0f56('0x33')]=_[_0x0f56('0x34')](_0x1df3f5[_0x0f56('0x33')]);_0x39c862[_0x0f56('0x35')]=_['intersection'](_0x39c862[_0x0f56('0x32')],_0x39c862['query']);_0x52fa44[_0x0f56('0x37')]=_[_0x0f56('0x36')](_0x39c862[_0x0f56('0x32')],qs['fields'](_0x1df3f5[_0x0f56('0x33')][_0x0f56('0x38')]));_0x52fa44['attributes']=_0x52fa44[_0x0f56('0x37')][_0x0f56('0x39')]?_0x52fa44[_0x0f56('0x37')]:_0x39c862[_0x0f56('0x32')];_0x52fa44[_0x0f56('0x4f')]=qs['sort'](_0x1df3f5[_0x0f56('0x33')]['sort']);_0x52fa44[_0x0f56('0x3d')]=qs[_0x0f56('0x35')](_[_0x0f56('0x50')](_0x1df3f5[_0x0f56('0x33')],_0x39c862[_0x0f56('0x35')]));if(_0x1df3f5[_0x0f56('0x33')][_0x0f56('0x40')]){_0x52fa44[_0x0f56('0x3d')]=_[_0x0f56('0x3e')](_0x52fa44['where'],{'$or':_[_0x0f56('0x2d')](_0x52fa44[_0x0f56('0x37')],function(_0xbbbdc){var _0x434c80={};_0x434c80[_0xbbbdc]={'$like':'%'+_0x1df3f5[_0x0f56('0x33')][_0x0f56('0x40')]+'%'};return _0x434c80;})});}_0x52fa44=_[_0x0f56('0x3e')]({},_0x52fa44,_0x1df3f5[_0x0f56('0x41')]);return _0x2afdfe[_0x0f56('0x53')](_0x52fa44);}})[_0x0f56('0x27')](function(_0x239dfc){if(_0x239dfc){_0x55ed90=_0x239dfc[_0x0f56('0x39')];if(!_0x1df3f5['query'][_0x0f56('0x3a')]('nolimit')){_0x52fa44['limit']=qs[_0x0f56('0x1f')](_0x1df3f5[_0x0f56('0x33')]['limit']);_0x52fa44['offset']=qs[_0x0f56('0x1d')](_0x1df3f5[_0x0f56('0x33')]['offset']);}return _0x2afdfe['getTags'](_0x52fa44);}})['then'](function(_0x1633b7){if(_0x1633b7){return _0x1633b7?{'count':_0x55ed90,'rows':_0x1633b7}:null;}})[_0x0f56('0x27')](respondWithResult(_0x91261c,null))[_0x0f56('0x48')](handleError(_0x91261c,null));};exports[_0x0f56('0x54')]=function(_0x10b143,_0x53242b,_0x17f51b){if(_0x10b143[_0x0f56('0x4a')]['id']){delete _0x10b143['body']['id'];}return db[_0x0f56('0x2e')]['findOne']({'where':{'id':_0x10b143[_0x0f56('0x46')]['id']}})[_0x0f56('0x27')](handleEntityNotFound(_0x53242b,null))[_0x0f56('0x27')](function(_0x445a0c){if(_0x445a0c){return _0x445a0c[_0x0f56('0x54')](_0x10b143['body'][_0x0f56('0x55')]||[]);}return null;})[_0x0f56('0x27')](respondWithResult(_0x53242b,null))[_0x0f56('0x48')](handleError(_0x53242b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2608941..5d96a07 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x5d8b20,_0x1d45ad){var _0x3becf4=function(_0x55af4e){while(--_0x55af4e){_0x5d8b20['push'](_0x5d8b20['shift']());}};_0x3becf4(++_0x1d45ad);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','path','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0598,0x92));var _0x8059=function(_0x3220a3,_0x4174e7){_0x3220a3=_0x3220a3-0x0;var _0x4e0bbd=_0x0598[_0x3220a3];return _0x4e0bbd;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'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 7bc7841..7a44e8d 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 _0x4992=['info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x4992,0xd2));var _0x2499=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4992[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x2499('0x0'));var util=require(_0x2499('0x1'));var moment=require(_0x2499('0x2'));var BPromise=require(_0x2499('0x3'));var rs=require(_0x2499('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2499('0x5'));var logger=require(_0x2499('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2499('0x7'));var client=jayson['client'][_0x2499('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58e0c4,_0x3529a1,_0x1463b1){return new BPromise(function(_0x274eaf,_0xc7c71){return client[_0x2499('0x9')](_0x58e0c4,_0x1463b1)['then'](function(_0x75e34e){logger[_0x2499('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3529a1,'request\x20sent');logger['debug'](_0x2499('0xb'),_0x3529a1,_0x2499('0xc'),JSON[_0x2499('0xd')](_0x75e34e));if(_0x75e34e['error']){if(_0x75e34e[_0x2499('0xe')][_0x2499('0xf')]===0x1f4){logger[_0x2499('0xe')](_0x2499('0x10'),_0x3529a1,_0x75e34e['error'][_0x2499('0x11')]);return _0xc7c71(_0x75e34e[_0x2499('0xe')][_0x2499('0x11')]);}logger[_0x2499('0xe')](_0x2499('0x10'),_0x3529a1,_0x75e34e[_0x2499('0xe')]['message']);return _0x274eaf(_0x75e34e['error'][_0x2499('0x11')]);}else{logger['info'](_0x2499('0x10'),_0x3529a1,_0x2499('0xc'));_0x274eaf(_0x75e34e[_0x2499('0x12')]['message']);}})[_0x2499('0x13')](function(_0x3639c9){logger[_0x2499('0xe')](_0x2499('0x10'),_0x3529a1,_0x3639c9);_0xc7c71(_0x3639c9);});});} \ No newline at end of file +var _0x1920=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x2102f9,_0x1a6420){var _0x392616=function(_0x52e00e){while(--_0x52e00e){_0x2102f9['push'](_0x2102f9['shift']());}};_0x392616(++_0x1a6420);}(_0x1920,0x159));var _0x0192=function(_0x2b6423,_0x5176ee){_0x2b6423=_0x2b6423-0x0;var _0x4c82b2=_0x1920[_0x2b6423];return _0x4c82b2;};'use strict';var _=require(_0x0192('0x0'));var util=require(_0x0192('0x1'));var moment=require(_0x0192('0x2'));var BPromise=require(_0x0192('0x3'));var rs=require(_0x0192('0x4'));var fs=require('fs');var Redis=require(_0x0192('0x5'));var db=require(_0x0192('0x6'))['db'];var utils=require(_0x0192('0x7'));var logger=require(_0x0192('0x8'))(_0x0192('0x9'));var config=require(_0x0192('0xa'));var jayson=require(_0x0192('0xb'));var client=jayson[_0x0192('0xc')][_0x0192('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x10fe8b,_0x1c42bc,_0x83045f){return new BPromise(function(_0x4c45c3,_0x498f0e){return client[_0x0192('0xe')](_0x10fe8b,_0x83045f)['then'](function(_0x4cba30){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1c42bc,_0x0192('0xf'));logger[_0x0192('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1c42bc,_0x0192('0xf'),JSON[_0x0192('0x11')](_0x4cba30));if(_0x4cba30[_0x0192('0x12')]){if(_0x4cba30['error'][_0x0192('0x13')]===0x1f4){logger[_0x0192('0x12')](_0x0192('0x14'),_0x1c42bc,_0x4cba30[_0x0192('0x12')][_0x0192('0x15')]);return _0x498f0e(_0x4cba30[_0x0192('0x12')][_0x0192('0x15')]);}logger[_0x0192('0x12')](_0x0192('0x14'),_0x1c42bc,_0x4cba30[_0x0192('0x12')][_0x0192('0x15')]);return _0x4c45c3(_0x4cba30['error'][_0x0192('0x15')]);}else{logger['info'](_0x0192('0x14'),_0x1c42bc,'request\x20sent');_0x4c45c3(_0x4cba30[_0x0192('0x16')][_0x0192('0x15')]);}})['catch'](function(_0x48efe4){logger[_0x0192('0x12')](_0x0192('0x14'),_0x1c42bc,_0x48efe4);_0x498f0e(_0x48efe4);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8d08b3a..63c9e92 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 _0x102a=['show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x115fb0,_0x3b93ae){var _0x119632=function(_0x1c9d9f){while(--_0x1c9d9f){_0x115fb0['push'](_0x115fb0['shift']());}};_0x119632(++_0x3b93ae);}(_0x102a,0x196));var _0xa102=function(_0x16043e,_0x2f6b9d){_0x16043e=_0x16043e-0x0;var _0x5a10c6=_0x102a[_0x16043e];return _0x5a10c6;};'use strict';var multer=require(_0xa102('0x0'));var util=require('util');var path=require(_0xa102('0x1'));var timeout=require(_0xa102('0x2'));var express=require(_0xa102('0x3'));var router=express[_0xa102('0x4')]();var fs_extra=require(_0xa102('0x5'));var auth=require(_0xa102('0x6'));var interaction=require(_0xa102('0x7'));var config=require(_0xa102('0x8'));var controller=require(_0xa102('0x9'));router[_0xa102('0xa')]('/',auth[_0xa102('0xb')](),controller[_0xa102('0xc')]);router[_0xa102('0xa')](_0xa102('0xd'),auth[_0xa102('0xb')](),controller[_0xa102('0xe')]);router[_0xa102('0xf')]('/',auth[_0xa102('0xb')](),controller[_0xa102('0x10')]);router[_0xa102('0x11')](_0xa102('0xd'),auth[_0xa102('0xb')](),controller[_0xa102('0x12')]);router['delete']('/:id',auth[_0xa102('0xb')](),controller[_0xa102('0x13')]);module[_0xa102('0x14')]=router; \ No newline at end of file +var _0x8f48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x14aec5,_0x559472){var _0x1b36ef=function(_0x1bb908){while(--_0x1bb908){_0x14aec5['push'](_0x14aec5['shift']());}};_0x1b36ef(++_0x559472);}(_0x8f48,0x67));var _0x88f4=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0x8f48[_0x2b0f81];return _0x5ce74c;};'use strict';var multer=require(_0x88f4('0x0'));var util=require(_0x88f4('0x1'));var path=require(_0x88f4('0x2'));var timeout=require(_0x88f4('0x3'));var express=require(_0x88f4('0x4'));var router=express['Router']();var fs_extra=require(_0x88f4('0x5'));var auth=require(_0x88f4('0x6'));var interaction=require(_0x88f4('0x7'));var config=require(_0x88f4('0x8'));var controller=require(_0x88f4('0x9'));router[_0x88f4('0xa')]('/',auth[_0x88f4('0xb')](),controller[_0x88f4('0xc')]);router[_0x88f4('0xa')](_0x88f4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x88f4('0xe')]('/',auth[_0x88f4('0xb')](),controller['create']);router['put'](_0x88f4('0xd'),auth[_0x88f4('0xb')](),controller[_0x88f4('0xf')]);router[_0x88f4('0x10')](_0x88f4('0xd'),auth[_0x88f4('0xb')](),controller['destroy']);module[_0x88f4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0f98dd2..6a91c95 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 _0xcbea=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b14df,_0x2d6d66){var _0x1285e8=function(_0xbc19ce){while(--_0xbc19ce){_0x5b14df['push'](_0x5b14df['shift']());}};_0x1285e8(++_0x2d6d66);}(_0xcbea,0x143));var _0xacbe=function(_0x71fc67,_0x431dcb){_0x71fc67=_0x71fc67-0x0;var _0x22a759=_0xcbea[_0x71fc67];return _0x22a759;};'use strict';var Sequelize=require(_0xacbe('0x0'));module[_0xacbe('0x1')]={'type':{'type':Sequelize[_0xacbe('0x2')](_0xacbe('0x3'),_0xacbe('0x4'),_0xacbe('0x5'),_0xacbe('0x6'),_0xacbe('0x7')),'defaultValue':_0xacbe('0x3')},'content':{'type':Sequelize[_0xacbe('0x8')]},'key':{'type':Sequelize[_0xacbe('0x8')]},'keyType':{'type':Sequelize[_0xacbe('0x2')](_0xacbe('0x3'),_0xacbe('0x4'),_0xacbe('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xacbe('0x8')]},'customField':{'type':Sequelize[_0xacbe('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xacbe('0x8')]}}; \ No newline at end of file +var _0xae0b=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','exports'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xae0b,0x8f));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xbae0('0x0')]={'type':{'type':Sequelize[_0xbae0('0x1')](_0xbae0('0x2'),_0xbae0('0x3'),'customVariable',_0xbae0('0x4'),_0xbae0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbae0('0x6')]},'key':{'type':Sequelize[_0xbae0('0x6')]},'keyType':{'type':Sequelize[_0xbae0('0x1')](_0xbae0('0x2'),_0xbae0('0x3'),_0xbae0('0x7'))},'keyContent':{'type':Sequelize[_0xbae0('0x6')]},'idField':{'type':Sequelize[_0xbae0('0x6')]},'nameField':{'type':Sequelize[_0xbae0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbae0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 4c2396b..ed69ebd 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 _0x93a0=['create','body','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','then','includeAll','include','rows','catch','params','find'];(function(_0x2471a3,_0x87367d){var _0x163c61=function(_0x3506a7){while(--_0x3506a7){_0x2471a3['push'](_0x2471a3['shift']());}};_0x163c61(++_0x87367d);}(_0x93a0,0x1c4));var _0x093a=function(_0x3068da,_0x300c02){_0x3068da=_0x3068da-0x0;var _0x31c3f7=_0x93a0[_0x3068da];return _0x31c3f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x093a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x093a('0x1'));var moment=require(_0x093a('0x2'));var BPromise=require(_0x093a('0x3'));var Mustache=require(_0x093a('0x4'));var util=require(_0x093a('0x5'));var path=require('path');var sox=require(_0x093a('0x6'));var csv=require(_0x093a('0x7'));var ejs=require(_0x093a('0x8'));var fs=require('fs');var fs_extra=require(_0x093a('0x9'));var _=require(_0x093a('0xa'));var squel=require(_0x093a('0xb'));var crypto=require(_0x093a('0xc'));var jsforce=require(_0x093a('0xd'));var deskjs=require(_0x093a('0xe'));var toCsv=require(_0x093a('0x7'));var querystring=require(_0x093a('0xf'));var Papa=require(_0x093a('0x10'));var Redis=require('ioredis');var authService=require(_0x093a('0x11'));var qs=require(_0x093a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x093a('0x13'));var logger=require(_0x093a('0x14'))(_0x093a('0x15'));var utils=require(_0x093a('0x16'));var config=require(_0x093a('0x17'));var licenseUtil=require(_0x093a('0x18'));var db=require(_0x093a('0x19'))['db'];function respondWithStatusCode(_0x26cafd,_0x3cf6ff){_0x3cf6ff=_0x3cf6ff||0xcc;return function(_0x30b6f9){if(_0x30b6f9){return _0x26cafd[_0x093a('0x1a')](_0x3cf6ff);}return _0x26cafd['status'](_0x3cf6ff)[_0x093a('0x1b')]();};}function respondWithResult(_0x3d8125,_0x449f47){_0x449f47=_0x449f47||0xc8;return function(_0x2193ee){if(_0x2193ee){return _0x3d8125[_0x093a('0x1c')](_0x449f47)['json'](_0x2193ee);}};}function respondWithFilteredResult(_0x50d30f,_0x3e1267){return function(_0x2afa88){if(_0x2afa88){var _0xb9b3a6=typeof _0x3e1267[_0x093a('0x1d')]===_0x093a('0x1e')&&typeof _0x3e1267['limit']===_0x093a('0x1e');var _0x399059=_0x2afa88[_0x093a('0x1f')];var _0x374187=_0xb9b3a6?0x0:_0x3e1267[_0x093a('0x1d')];var _0x3f068a=_0xb9b3a6?_0x2afa88[_0x093a('0x1f')]:_0x3e1267[_0x093a('0x1d')]+_0x3e1267[_0x093a('0x20')];var _0x5c4c4c;if(_0x3f068a>=_0x399059){_0x3f068a=_0x399059;_0x5c4c4c=0xc8;}else{_0x5c4c4c=0xce;}_0x50d30f[_0x093a('0x1c')](_0x5c4c4c);return _0x50d30f[_0x093a('0x21')](_0x093a('0x22'),_0x374187+'-'+_0x3f068a+'/'+_0x399059)[_0x093a('0x23')](_0x2afa88);}return null;};}function patchUpdates(_0x33b7e6){return function(_0x5b8383){try{jsonpatch[_0x093a('0x24')](_0x5b8383,_0x33b7e6,!![]);}catch(_0x486dba){return BPromise[_0x093a('0x25')](_0x486dba);}return _0x5b8383[_0x093a('0x26')]();};}function saveUpdates(_0x218942,_0x56ed82){return function(_0x1170db){if(_0x1170db){return _0x1170db['update'](_0x218942)['then'](function(_0x54381c){return _0x54381c;});}return null;};}function removeEntity(_0x4f5324,_0x3b3a2d){return function(_0x424c09){if(_0x424c09){return _0x424c09[_0x093a('0x27')]()['then'](function(){_0x4f5324[_0x093a('0x1c')](0xcc)[_0x093a('0x1b')]();});}};}function handleEntityNotFound(_0x15fd31,_0x87e291){return function(_0x26e12a){if(!_0x26e12a){_0x15fd31[_0x093a('0x1a')](0x194);}return _0x26e12a;};}function handleError(_0x43debe,_0x879886){_0x879886=_0x879886||0x1f4;return function(_0x2c7000){logger['error'](_0x2c7000[_0x093a('0x28')]);if(_0x2c7000[_0x093a('0x29')]){delete _0x2c7000[_0x093a('0x29')];}_0x43debe[_0x093a('0x1c')](_0x879886)[_0x093a('0x2a')](_0x2c7000);};}exports['index']=function(_0x59247c,_0xb47c40){var _0x1bc2e2={},_0x1b581d={},_0x4de955={'count':0x0,'rows':[]};var _0x36e947=_['map'](db['ZendeskField'][_0x093a('0x2b')],function(_0xfb07ab){return{'name':_0xfb07ab[_0x093a('0x2c')],'type':_0xfb07ab[_0x093a('0x2d')]['key']};});_0x1b581d[_0x093a('0x2e')]=_[_0x093a('0x2f')](_0x36e947,_0x093a('0x29'));_0x1b581d[_0x093a('0x30')]=_[_0x093a('0x31')](_0x59247c[_0x093a('0x30')]);_0x1b581d[_0x093a('0x32')]=_[_0x093a('0x33')](_0x1b581d[_0x093a('0x2e')],_0x1b581d[_0x093a('0x30')]);_0x1bc2e2[_0x093a('0x34')]=_[_0x093a('0x33')](_0x1b581d['model'],qs[_0x093a('0x35')](_0x59247c[_0x093a('0x30')][_0x093a('0x35')]));_0x1bc2e2[_0x093a('0x34')]=_0x1bc2e2[_0x093a('0x34')][_0x093a('0x36')]?_0x1bc2e2[_0x093a('0x34')]:_0x1b581d[_0x093a('0x2e')];if(!_0x59247c[_0x093a('0x30')][_0x093a('0x37')](_0x093a('0x38'))){_0x1bc2e2[_0x093a('0x20')]=qs[_0x093a('0x20')](_0x59247c[_0x093a('0x30')][_0x093a('0x20')]);_0x1bc2e2[_0x093a('0x1d')]=qs['offset'](_0x59247c[_0x093a('0x30')][_0x093a('0x1d')]);}_0x1bc2e2[_0x093a('0x39')]=qs[_0x093a('0x3a')](_0x59247c[_0x093a('0x30')][_0x093a('0x3a')]);_0x1bc2e2[_0x093a('0x3b')]=qs[_0x093a('0x32')](_[_0x093a('0x3c')](_0x59247c['query'],_0x1b581d[_0x093a('0x32')]),_0x36e947);if(_0x59247c[_0x093a('0x30')][_0x093a('0x3d')]){_0x1bc2e2[_0x093a('0x3b')]=_[_0x093a('0x3e')](_0x1bc2e2[_0x093a('0x3b')],{'$or':_[_0x093a('0x2f')](_0x36e947,function(_0xb790f1){if(_0xb790f1['type']!==_0x093a('0x3f')){var _0x4375e9={};_0x4375e9[_0xb790f1[_0x093a('0x29')]]={'$like':'%'+_0x59247c['query'][_0x093a('0x3d')]+'%'};return _0x4375e9;}})});}_0x1bc2e2=_[_0x093a('0x3e')]({},_0x1bc2e2,_0x59247c[_0x093a('0x40')]);var _0x1e742b={'where':_0x1bc2e2[_0x093a('0x3b')]};return db[_0x093a('0x41')]['count'](_0x1e742b)[_0x093a('0x42')](function(_0x23e405){_0x4de955['count']=_0x23e405;if(_0x59247c['query'][_0x093a('0x43')]){_0x1bc2e2[_0x093a('0x44')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x1bc2e2);})[_0x093a('0x42')](function(_0x120af1){_0x4de955[_0x093a('0x45')]=_0x120af1;return _0x4de955;})[_0x093a('0x42')](respondWithFilteredResult(_0xb47c40,_0x1bc2e2))[_0x093a('0x46')](handleError(_0xb47c40,null));};exports['show']=function(_0x5a500f,_0x273e27){var _0x550a32={'raw':!![],'where':{'id':_0x5a500f[_0x093a('0x47')]['id']}},_0x497dbd={};_0x497dbd[_0x093a('0x2e')]=_[_0x093a('0x31')](db[_0x093a('0x41')][_0x093a('0x2b')]);_0x497dbd[_0x093a('0x30')]=_[_0x093a('0x31')](_0x5a500f[_0x093a('0x30')]);_0x497dbd[_0x093a('0x32')]=_['intersection'](_0x497dbd['model'],_0x497dbd[_0x093a('0x30')]);_0x550a32['attributes']=_[_0x093a('0x33')](_0x497dbd[_0x093a('0x2e')],qs[_0x093a('0x35')](_0x5a500f[_0x093a('0x30')][_0x093a('0x35')]));_0x550a32[_0x093a('0x34')]=_0x550a32[_0x093a('0x34')][_0x093a('0x36')]?_0x550a32[_0x093a('0x34')]:_0x497dbd[_0x093a('0x2e')];if(_0x5a500f[_0x093a('0x30')]['includeAll']){_0x550a32[_0x093a('0x44')]=[{'all':!![]}];}_0x550a32=_[_0x093a('0x3e')]({},_0x550a32,_0x5a500f[_0x093a('0x40')]);return db[_0x093a('0x41')][_0x093a('0x48')](_0x550a32)[_0x093a('0x42')](handleEntityNotFound(_0x273e27,null))[_0x093a('0x42')](respondWithResult(_0x273e27,null))[_0x093a('0x46')](handleError(_0x273e27,null));};exports[_0x093a('0x49')]=function(_0x2c28c3,_0x1f16ee){return db[_0x093a('0x41')][_0x093a('0x49')](_0x2c28c3['body'],{})[_0x093a('0x42')](respondWithResult(_0x1f16ee,0xc9))[_0x093a('0x46')](handleError(_0x1f16ee,null));};exports['update']=function(_0x210246,_0x59300c){if(_0x210246[_0x093a('0x4a')]['id']){delete _0x210246[_0x093a('0x4a')]['id'];}return db[_0x093a('0x41')]['find']({'where':{'id':_0x210246[_0x093a('0x47')]['id']}})['then'](handleEntityNotFound(_0x59300c,null))[_0x093a('0x42')](saveUpdates(_0x210246[_0x093a('0x4a')],null))[_0x093a('0x42')](respondWithResult(_0x59300c,null))[_0x093a('0x46')](handleError(_0x59300c,null));};exports[_0x093a('0x27')]=function(_0x28f09c,_0x3bc8ae){return db[_0x093a('0x41')][_0x093a('0x48')]({'where':{'id':_0x28f09c[_0x093a('0x47')]['id']}})[_0x093a('0x42')](handleEntityNotFound(_0x3bc8ae,null))[_0x093a('0x42')](removeEntity(_0x3bc8ae,null))[_0x093a('0x46')](handleError(_0x3bc8ae,null));}; \ No newline at end of file +var _0x7bfa=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskField','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x39e23b,_0x51ab1b){var _0x5d0447=function(_0x42a189){while(--_0x42a189){_0x39e23b['push'](_0x39e23b['shift']());}};_0x5d0447(++_0x51ab1b);}(_0x7bfa,0x173));var _0xa7bf=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x7bfa[_0x2cc594];return _0x4abff7;};'use strict';var emlformat=require(_0xa7bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7bf('0x1'));var rp=require(_0xa7bf('0x2'));var moment=require('moment');var BPromise=require(_0xa7bf('0x3'));var Mustache=require(_0xa7bf('0x4'));var util=require(_0xa7bf('0x5'));var path=require(_0xa7bf('0x6'));var sox=require(_0xa7bf('0x7'));var csv=require(_0xa7bf('0x8'));var ejs=require(_0xa7bf('0x9'));var fs=require('fs');var fs_extra=require(_0xa7bf('0xa'));var _=require(_0xa7bf('0xb'));var squel=require(_0xa7bf('0xc'));var crypto=require(_0xa7bf('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa7bf('0x8'));var querystring=require(_0xa7bf('0xe'));var Papa=require(_0xa7bf('0xf'));var Redis=require(_0xa7bf('0x10'));var authService=require(_0xa7bf('0x11'));var qs=require(_0xa7bf('0x12'));var as=require(_0xa7bf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7bf('0x14'))(_0xa7bf('0x15'));var utils=require('../../config/utils');var config=require(_0xa7bf('0x16'));var licenseUtil=require(_0xa7bf('0x17'));var db=require(_0xa7bf('0x18'))['db'];function respondWithStatusCode(_0x35bc2b,_0x1666e1){_0x1666e1=_0x1666e1||0xcc;return function(_0x24db2e){if(_0x24db2e){return _0x35bc2b['sendStatus'](_0x1666e1);}return _0x35bc2b[_0xa7bf('0x19')](_0x1666e1)[_0xa7bf('0x1a')]();};}function respondWithResult(_0x4d4274,_0xdc1bc0){_0xdc1bc0=_0xdc1bc0||0xc8;return function(_0x63d0f3){if(_0x63d0f3){return _0x4d4274[_0xa7bf('0x19')](_0xdc1bc0)[_0xa7bf('0x1b')](_0x63d0f3);}};}function respondWithFilteredResult(_0x563d25,_0x111178){return function(_0x47e538){if(_0x47e538){var _0xaa872c=typeof _0x111178[_0xa7bf('0x1c')]===_0xa7bf('0x1d')&&typeof _0x111178[_0xa7bf('0x1e')]===_0xa7bf('0x1d');var _0x28751e=_0x47e538[_0xa7bf('0x1f')];var _0x4cfbf3=_0xaa872c?0x0:_0x111178['offset'];var _0x26d20b=_0xaa872c?_0x47e538[_0xa7bf('0x1f')]:_0x111178['offset']+_0x111178[_0xa7bf('0x1e')];var _0x52b897;if(_0x26d20b>=_0x28751e){_0x26d20b=_0x28751e;_0x52b897=0xc8;}else{_0x52b897=0xce;}_0x563d25[_0xa7bf('0x19')](_0x52b897);return _0x563d25[_0xa7bf('0x20')](_0xa7bf('0x21'),_0x4cfbf3+'-'+_0x26d20b+'/'+_0x28751e)['json'](_0x47e538);}return null;};}function patchUpdates(_0x27cd0d){return function(_0x2035ad){try{jsonpatch[_0xa7bf('0x22')](_0x2035ad,_0x27cd0d,!![]);}catch(_0x32c9c5){return BPromise[_0xa7bf('0x23')](_0x32c9c5);}return _0x2035ad[_0xa7bf('0x24')]();};}function saveUpdates(_0x53ee35,_0x64e31f){return function(_0x3ac247){if(_0x3ac247){return _0x3ac247[_0xa7bf('0x25')](_0x53ee35)[_0xa7bf('0x26')](function(_0x11f2e3){return _0x11f2e3;});}return null;};}function removeEntity(_0x337bc0,_0x29db6d){return function(_0x4f9f37){if(_0x4f9f37){return _0x4f9f37[_0xa7bf('0x27')]()[_0xa7bf('0x26')](function(){_0x337bc0[_0xa7bf('0x19')](0xcc)[_0xa7bf('0x1a')]();});}};}function handleEntityNotFound(_0x29733b,_0x19f84b){return function(_0x46a3e8){if(!_0x46a3e8){_0x29733b['sendStatus'](0x194);}return _0x46a3e8;};}function handleError(_0x6bf1a1,_0x11fd30){_0x11fd30=_0x11fd30||0x1f4;return function(_0x19af53){logger[_0xa7bf('0x28')](_0x19af53['stack']);if(_0x19af53[_0xa7bf('0x29')]){delete _0x19af53['name'];}_0x6bf1a1['status'](_0x11fd30)[_0xa7bf('0x2a')](_0x19af53);};}exports[_0xa7bf('0x2b')]=function(_0x52ac98,_0x5da7cc){var _0x229999={},_0x15d65e={},_0x58addb={'count':0x0,'rows':[]};var _0x26de2a=_[_0xa7bf('0x2c')](db[_0xa7bf('0x2d')]['rawAttributes'],function(_0x1f47f8){return{'name':_0x1f47f8[_0xa7bf('0x2e')],'type':_0x1f47f8['type'][_0xa7bf('0x2f')]};});_0x15d65e['model']=_[_0xa7bf('0x2c')](_0x26de2a,_0xa7bf('0x29'));_0x15d65e[_0xa7bf('0x30')]=_[_0xa7bf('0x31')](_0x52ac98[_0xa7bf('0x30')]);_0x15d65e[_0xa7bf('0x32')]=_[_0xa7bf('0x33')](_0x15d65e[_0xa7bf('0x34')],_0x15d65e[_0xa7bf('0x30')]);_0x229999[_0xa7bf('0x35')]=_[_0xa7bf('0x33')](_0x15d65e[_0xa7bf('0x34')],qs[_0xa7bf('0x36')](_0x52ac98[_0xa7bf('0x30')]['fields']));_0x229999[_0xa7bf('0x35')]=_0x229999[_0xa7bf('0x35')]['length']?_0x229999['attributes']:_0x15d65e[_0xa7bf('0x34')];if(!_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x37')](_0xa7bf('0x38'))){_0x229999[_0xa7bf('0x1e')]=qs['limit'](_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x1e')]);_0x229999[_0xa7bf('0x1c')]=qs['offset'](_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x1c')]);}_0x229999[_0xa7bf('0x39')]=qs[_0xa7bf('0x3a')](_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x3a')]);_0x229999['where']=qs[_0xa7bf('0x32')](_['pick'](_0x52ac98['query'],_0x15d65e['filters']),_0x26de2a);if(_0x52ac98[_0xa7bf('0x30')]['filter']){_0x229999[_0xa7bf('0x3b')]=_['merge'](_0x229999[_0xa7bf('0x3b')],{'$or':_['map'](_0x26de2a,function(_0x16a0b0){if(_0x16a0b0[_0xa7bf('0x3c')]!==_0xa7bf('0x3d')){var _0x131569={};_0x131569[_0x16a0b0[_0xa7bf('0x29')]]={'$like':'%'+_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x3e')]+'%'};return _0x131569;}})});}_0x229999=_[_0xa7bf('0x3f')]({},_0x229999,_0x52ac98[_0xa7bf('0x40')]);var _0x5eb6ac={'where':_0x229999[_0xa7bf('0x3b')]};return db[_0xa7bf('0x2d')][_0xa7bf('0x1f')](_0x5eb6ac)['then'](function(_0x3e42f8){_0x58addb['count']=_0x3e42f8;if(_0x52ac98[_0xa7bf('0x30')][_0xa7bf('0x41')]){_0x229999['include']=[{'all':!![]}];}return db[_0xa7bf('0x2d')][_0xa7bf('0x42')](_0x229999);})[_0xa7bf('0x26')](function(_0x1405b4){_0x58addb[_0xa7bf('0x43')]=_0x1405b4;return _0x58addb;})[_0xa7bf('0x26')](respondWithFilteredResult(_0x5da7cc,_0x229999))[_0xa7bf('0x44')](handleError(_0x5da7cc,null));};exports[_0xa7bf('0x45')]=function(_0x273afc,_0x2eef06){var _0x5e15c0={'raw':!![],'where':{'id':_0x273afc[_0xa7bf('0x46')]['id']}},_0x43017a={};_0x43017a[_0xa7bf('0x34')]=_[_0xa7bf('0x31')](db[_0xa7bf('0x2d')][_0xa7bf('0x47')]);_0x43017a[_0xa7bf('0x30')]=_['keys'](_0x273afc[_0xa7bf('0x30')]);_0x43017a[_0xa7bf('0x32')]=_['intersection'](_0x43017a[_0xa7bf('0x34')],_0x43017a[_0xa7bf('0x30')]);_0x5e15c0['attributes']=_[_0xa7bf('0x33')](_0x43017a[_0xa7bf('0x34')],qs['fields'](_0x273afc[_0xa7bf('0x30')]['fields']));_0x5e15c0['attributes']=_0x5e15c0[_0xa7bf('0x35')][_0xa7bf('0x48')]?_0x5e15c0['attributes']:_0x43017a[_0xa7bf('0x34')];if(_0x273afc[_0xa7bf('0x30')]['includeAll']){_0x5e15c0[_0xa7bf('0x49')]=[{'all':!![]}];}_0x5e15c0=_[_0xa7bf('0x3f')]({},_0x5e15c0,_0x273afc[_0xa7bf('0x40')]);return db['ZendeskField'][_0xa7bf('0x4a')](_0x5e15c0)[_0xa7bf('0x26')](handleEntityNotFound(_0x2eef06,null))['then'](respondWithResult(_0x2eef06,null))[_0xa7bf('0x44')](handleError(_0x2eef06,null));};exports[_0xa7bf('0x4b')]=function(_0x302bb7,_0x4f6b08){return db[_0xa7bf('0x2d')][_0xa7bf('0x4b')](_0x302bb7[_0xa7bf('0x4c')],{})[_0xa7bf('0x26')](respondWithResult(_0x4f6b08,0xc9))['catch'](handleError(_0x4f6b08,null));};exports[_0xa7bf('0x25')]=function(_0xd3f06e,_0x469597){if(_0xd3f06e[_0xa7bf('0x4c')]['id']){delete _0xd3f06e[_0xa7bf('0x4c')]['id'];}return db[_0xa7bf('0x2d')][_0xa7bf('0x4a')]({'where':{'id':_0xd3f06e[_0xa7bf('0x46')]['id']}})[_0xa7bf('0x26')](handleEntityNotFound(_0x469597,null))[_0xa7bf('0x26')](saveUpdates(_0xd3f06e[_0xa7bf('0x4c')],null))['then'](respondWithResult(_0x469597,null))[_0xa7bf('0x44')](handleError(_0x469597,null));};exports['destroy']=function(_0x3fe504,_0x44930d){return db[_0xa7bf('0x2d')][_0xa7bf('0x4a')]({'where':{'id':_0x3fe504[_0xa7bf('0x46')]['id']}})['then'](handleEntityNotFound(_0x44930d,null))['then'](removeEntity(_0x44930d,null))[_0xa7bf('0x44')](handleError(_0x44930d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 32db0c7..485c850 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 _0xfd85=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','idField','lodash','util','../../config/logger'];(function(_0x26f7c3,_0x5865b5){var _0x804c69=function(_0x11f9a7){while(--_0x11f9a7){_0x26f7c3['push'](_0x26f7c3['shift']());}};_0x804c69(++_0x5865b5);}(_0xfd85,0x1e7));var _0x5fd8=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xfd85[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0x5fd8('0x0'));var util=require(_0x5fd8('0x1'));var logger=require(_0x5fd8('0x2'))(_0x5fd8('0x3'));var moment=require(_0x5fd8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fd8('0x5'));var fs=require('fs');var path=require(_0x5fd8('0x6'));var rimraf=require(_0x5fd8('0x7'));var config=require(_0x5fd8('0x8'));var attributes=require(_0x5fd8('0x9'));module[_0x5fd8('0xa')]=function(_0x49841d,_0x2ed34e){return _0x49841d[_0x5fd8('0xb')](_0x5fd8('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x5fd8('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd50c=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5bd2b0,_0x37df5c){var _0x130699=function(_0x38695f){while(--_0x38695f){_0x5bd2b0['push'](_0x5bd2b0['shift']());}};_0x130699(++_0x37df5c);}(_0xd50c,0xc8));var _0xcd50=function(_0x2437a9,_0x578a45){_0x2437a9=_0x2437a9-0x0;var _0x464b1f=_0xd50c[_0x2437a9];return _0x464b1f;};'use strict';var _=require(_0xcd50('0x0'));var util=require('util');var logger=require(_0xcd50('0x1'))('api');var moment=require(_0xcd50('0x2'));var BPromise=require(_0xcd50('0x3'));var rp=require(_0xcd50('0x4'));var fs=require('fs');var path=require(_0xcd50('0x5'));var rimraf=require(_0xcd50('0x6'));var config=require(_0xcd50('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xcd50('0x8')]=function(_0x46e63f,_0x529b01){return _0x46e63f[_0xcd50('0x9')](_0xcd50('0xa'),attributes,{'tableName':_0xcd50('0xb'),'paranoid':![],'indexes':[{'name':_0xcd50('0xc'),'fields':[_0xcd50('0xd'),_0xcd50('0xe')],'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 80ca17d..59846d5 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 _0xd994=['../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0xd994,0x78));var _0x4d99=function(_0x4e2afb,_0x2d0d35){_0x4e2afb=_0x4e2afb-0x0;var _0x2c54ae=_0xd994[_0x4e2afb];return _0x2c54ae;};'use strict';var _=require(_0x4d99('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4d99('0x1'));var rs=require(_0x4d99('0x2'));var fs=require('fs');var Redis=require(_0x4d99('0x3'));var db=require(_0x4d99('0x4'))['db'];var utils=require(_0x4d99('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d99('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d99('0x7')][_0x4d99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fd1a4,_0x199780,_0x5de136){return new BPromise(function(_0x4bbcdd,_0x31254a){return client[_0x4d99('0x9')](_0x2fd1a4,_0x5de136)[_0x4d99('0xa')](function(_0x1d5dd2){logger['info']('ZendeskField,\x20%s,\x20%s',_0x199780,_0x4d99('0xb'));logger[_0x4d99('0xc')](_0x4d99('0xd'),_0x199780,_0x4d99('0xb'),JSON[_0x4d99('0xe')](_0x1d5dd2));if(_0x1d5dd2['error']){if(_0x1d5dd2[_0x4d99('0xf')][_0x4d99('0x10')]===0x1f4){logger['error'](_0x4d99('0x11'),_0x199780,_0x1d5dd2[_0x4d99('0xf')][_0x4d99('0x12')]);return _0x31254a(_0x1d5dd2[_0x4d99('0xf')][_0x4d99('0x12')]);}logger['error'](_0x4d99('0x11'),_0x199780,_0x1d5dd2['error']['message']);return _0x4bbcdd(_0x1d5dd2[_0x4d99('0xf')][_0x4d99('0x12')]);}else{logger['info'](_0x4d99('0x11'),_0x199780,_0x4d99('0xb'));_0x4bbcdd(_0x1d5dd2[_0x4d99('0x13')]['message']);}})[_0x4d99('0x14')](function(_0x1109e1){logger[_0x4d99('0xf')](_0x4d99('0x11'),_0x199780,_0x1109e1);_0x31254a(_0x1109e1);});});} \ No newline at end of file +var _0x4653=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xffa302,_0xfd695c){var _0x38ea4b=function(_0xaa04c3){while(--_0xaa04c3){_0xffa302['push'](_0xffa302['shift']());}};_0x38ea4b(++_0xfd695c);}(_0x4653,0x68));var _0x3465=function(_0x538b3c,_0x4e4c92){_0x538b3c=_0x538b3c-0x0;var _0x32e270=_0x4653[_0x538b3c];return _0x32e270;};'use strict';var _=require(_0x3465('0x0'));var util=require(_0x3465('0x1'));var moment=require(_0x3465('0x2'));var BPromise=require(_0x3465('0x3'));var rs=require(_0x3465('0x4'));var fs=require('fs');var Redis=require(_0x3465('0x5'));var db=require(_0x3465('0x6'))['db'];var utils=require(_0x3465('0x7'));var logger=require(_0x3465('0x8'))(_0x3465('0x9'));var config=require('../../config/environment');var jayson=require(_0x3465('0xa'));var client=jayson[_0x3465('0xb')][_0x3465('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30e4bf,_0x4c5760,_0x546c0b){return new BPromise(function(_0x71e39b,_0x2bb0b8){return client[_0x3465('0xd')](_0x30e4bf,_0x546c0b)[_0x3465('0xe')](function(_0x103b81){logger['info'](_0x3465('0xf'),_0x4c5760,_0x3465('0x10'));logger[_0x3465('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4c5760,_0x3465('0x10'),JSON[_0x3465('0x12')](_0x103b81));if(_0x103b81['error']){if(_0x103b81[_0x3465('0x13')][_0x3465('0x14')]===0x1f4){logger[_0x3465('0x13')](_0x3465('0xf'),_0x4c5760,_0x103b81['error'][_0x3465('0x15')]);return _0x2bb0b8(_0x103b81[_0x3465('0x13')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x4c5760,_0x103b81[_0x3465('0x13')][_0x3465('0x15')]);return _0x71e39b(_0x103b81[_0x3465('0x13')][_0x3465('0x15')]);}else{logger[_0x3465('0x16')](_0x3465('0xf'),_0x4c5760,_0x3465('0x10'));_0x71e39b(_0x103b81[_0x3465('0x17')][_0x3465('0x15')]);}})[_0x3465('0x18')](function(_0x446e0c){logger[_0x3465('0x13')](_0x3465('0xf'),_0x4c5760,_0x446e0c);_0x2bb0b8(_0x446e0c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4913991..5d6bd8d 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 _0x179b=['create','put','update','delete','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x23ec94,_0x5537cd){var _0x2f37d6=function(_0x221ced){while(--_0x221ced){_0x23ec94['push'](_0x23ec94['shift']());}};_0x2f37d6(++_0x5537cd);}(_0x179b,0x1bb));var _0xb179=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x179b[_0x47a349];return _0x18ab75;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb179('0x0'));var router=express[_0xb179('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb179('0x2'));var config=require(_0xb179('0x3'));var controller=require(_0xb179('0x4'));router[_0xb179('0x5')]('/',auth[_0xb179('0x6')](),controller[_0xb179('0x7')]);router['get'](_0xb179('0x8'),auth[_0xb179('0x6')](),controller[_0xb179('0x9')]);router[_0xb179('0x5')](_0xb179('0xa'),auth[_0xb179('0x6')](),controller[_0xb179('0xb')]);router[_0xb179('0x5')](_0xb179('0xc'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xb179('0x6')](),controller[_0xb179('0xd')]);router['post'](_0xb179('0xa'),auth[_0xb179('0x6')](),controller['addConfiguration']);router[_0xb179('0xe')](_0xb179('0x8'),auth[_0xb179('0x6')](),controller[_0xb179('0xf')]);router[_0xb179('0x10')](_0xb179('0x8'),auth[_0xb179('0x6')](),controller[_0xb179('0x11')]);module[_0xb179('0x12')]=router; \ No newline at end of file +var _0x2235=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1b7c55,_0x2e61f5){var _0x54d096=function(_0xe7eba2){while(--_0xe7eba2){_0x1b7c55['push'](_0x1b7c55['shift']());}};_0x54d096(++_0x2e61f5);}(_0x2235,0xb1));var _0x5223=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2235[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5223('0x0'));var util=require(_0x5223('0x1'));var path=require('path');var timeout=require(_0x5223('0x2'));var express=require('express');var router=express[_0x5223('0x3')]();var fs_extra=require(_0x5223('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5223('0x5'));var config=require(_0x5223('0x6'));var controller=require(_0x5223('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5223('0x8')]);router[_0x5223('0x9')](_0x5223('0xa'),auth[_0x5223('0xb')](),controller['show']);router[_0x5223('0x9')](_0x5223('0xc'),auth[_0x5223('0xb')](),controller[_0x5223('0xd')]);router['get'](_0x5223('0xe'),auth[_0x5223('0xb')](),controller[_0x5223('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5223('0x10')]);router[_0x5223('0x11')](_0x5223('0xc'),auth[_0x5223('0xb')](),controller[_0x5223('0x12')]);router[_0x5223('0x13')](_0x5223('0xa'),auth[_0x5223('0xb')](),controller[_0x5223('0x14')]);router[_0x5223('0x15')](_0x5223('0xa'),auth[_0x5223('0xb')](),controller[_0x5223('0x16')]);module[_0x5223('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3db9bae..8ad1c0c 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 _0xe5b3=['STRING','exports'];(function(_0x5820f2,_0x8df64e){var _0x1f1ce6=function(_0x447109){while(--_0x447109){_0x5820f2['push'](_0x5820f2['shift']());}};_0x1f1ce6(++_0x8df64e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2a4692,_0x5db910){_0x2a4692=_0x2a4692-0x0;var _0x370e6b=_0xe5b3[_0x2a4692];return _0x370e6b;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0xd0bb=['exports','STRING','sequelize'];(function(_0x26ab60,_0x32211d){var _0x1891e0=function(_0x5969e2){while(--_0x5969e2){_0x26ab60['push'](_0x26ab60['shift']());}};_0x1891e0(++_0x32211d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x27b7be,_0x538e2d){_0x27b7be=_0x27b7be-0x0;var _0x1aa77e=_0xd0bb[_0x27b7be];return _0x1aa77e;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 87bbc53..3132fab 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 _0xf8dc=['rows','catch','show','params','length','includeAll','options','find','create','body','update','getConfigurations','ZohoConfiguration','pick','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','code','host','zoho.eu','com','slice','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','destroy','then','stack','index','map','ZohoAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','merge','VIRTUAL','include','findAll'];(function(_0x17c776,_0x1b0432){var _0x5511c2=function(_0x4bb4ac){while(--_0x4bb4ac){_0x17c776['push'](_0x17c776['shift']());}};_0x5511c2(++_0x1b0432);}(_0xf8dc,0x142));var _0xcf8d=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf8dc[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0xcf8d('0x0'));var rimraf=require(_0xcf8d('0x1'));var zipdir=require(_0xcf8d('0x2'));var jsonpatch=require(_0xcf8d('0x3'));var rp=require(_0xcf8d('0x4'));var moment=require('moment');var BPromise=require(_0xcf8d('0x5'));var Mustache=require(_0xcf8d('0x6'));var util=require(_0xcf8d('0x7'));var path=require(_0xcf8d('0x8'));var sox=require(_0xcf8d('0x9'));var csv=require(_0xcf8d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcf8d('0xb'));var jsforce=require(_0xcf8d('0xc'));var deskjs=require(_0xcf8d('0xd'));var toCsv=require(_0xcf8d('0xa'));var querystring=require(_0xcf8d('0xe'));var Papa=require(_0xcf8d('0xf'));var Redis=require(_0xcf8d('0x10'));var authService=require(_0xcf8d('0x11'));var qs=require(_0xcf8d('0x12'));var as=require(_0xcf8d('0x13'));var hardwareService=require(_0xcf8d('0x14'));var logger=require('../../config/logger')(_0xcf8d('0x15'));var utils=require(_0xcf8d('0x16'));var config=require(_0xcf8d('0x17'));var licenseUtil=require(_0xcf8d('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcf8d('0x19'));function respondWithStatusCode(_0x3e205a,_0x4d3ed7){_0x4d3ed7=_0x4d3ed7||0xcc;return function(_0x4b3d41){if(_0x4b3d41){return _0x3e205a[_0xcf8d('0x1a')](_0x4d3ed7);}return _0x3e205a[_0xcf8d('0x1b')](_0x4d3ed7)[_0xcf8d('0x1c')]();};}function respondWithResult(_0x1b0b73,_0x30a20f){_0x30a20f=_0x30a20f||0xc8;return function(_0x2d155a){if(_0x2d155a){return _0x1b0b73[_0xcf8d('0x1b')](_0x30a20f)[_0xcf8d('0x1d')](_0x2d155a);}};}function respondWithFilteredResult(_0x477ee0,_0x56ddd8){return function(_0x38bc36){if(_0x38bc36){var _0x2de9e9=typeof _0x56ddd8[_0xcf8d('0x1e')]===_0xcf8d('0x1f')&&typeof _0x56ddd8[_0xcf8d('0x20')]===_0xcf8d('0x1f');var _0x156a21=_0x38bc36[_0xcf8d('0x21')];var _0x2a07eb=_0x2de9e9?0x0:_0x56ddd8[_0xcf8d('0x1e')];var _0x3e8c67=_0x2de9e9?_0x38bc36[_0xcf8d('0x21')]:_0x56ddd8[_0xcf8d('0x1e')]+_0x56ddd8['limit'];var _0x2f09c1;if(_0x3e8c67>=_0x156a21){_0x3e8c67=_0x156a21;_0x2f09c1=0xc8;}else{_0x2f09c1=0xce;}_0x477ee0[_0xcf8d('0x1b')](_0x2f09c1);return _0x477ee0['set']('Content-Range',_0x2a07eb+'-'+_0x3e8c67+'/'+_0x156a21)['json'](_0x38bc36);}return null;};}function patchUpdates(_0x4de5ed){return function(_0x23b6d9){try{jsonpatch['apply'](_0x23b6d9,_0x4de5ed,!![]);}catch(_0x3cb7da){return BPromise[_0xcf8d('0x22')](_0x3cb7da);}return _0x23b6d9[_0xcf8d('0x23')]();};}function saveUpdates(_0x44f68e,_0x1782f2){return function(_0xbc67a4){if(_0xbc67a4){return _0xbc67a4['update'](_0x44f68e)['then'](function(_0x1736ac){return _0x1736ac;});}return null;};}function removeEntity(_0x9e7c1,_0x1fe1c7){return function(_0x2fc117){if(_0x2fc117){return _0x2fc117[_0xcf8d('0x24')]()[_0xcf8d('0x25')](function(){_0x9e7c1[_0xcf8d('0x1b')](0xcc)[_0xcf8d('0x1c')]();});}};}function handleEntityNotFound(_0x1e7c2a,_0x2182f6){return function(_0x3f16ad){if(!_0x3f16ad){_0x1e7c2a[_0xcf8d('0x1a')](0x194);}return _0x3f16ad;};}function handleError(_0x135e87,_0x527460){_0x527460=_0x527460||0x1f4;return function(_0x1243d0){logger['error'](_0x1243d0[_0xcf8d('0x26')]);if(_0x1243d0['name']){delete _0x1243d0['name'];}_0x135e87['status'](_0x527460)['send'](_0x1243d0);};}exports[_0xcf8d('0x27')]=function(_0x4f6155,_0xec85b4){var _0x1cca6f={},_0x424162={},_0x2e0163={'count':0x0,'rows':[]};var _0x1b77cc=_[_0xcf8d('0x28')](db[_0xcf8d('0x29')][_0xcf8d('0x2a')],function(_0x4679d4){return{'name':_0x4679d4['fieldName'],'type':_0x4679d4[_0xcf8d('0x2b')][_0xcf8d('0x2c')]};});_0x424162[_0xcf8d('0x2d')]=_[_0xcf8d('0x28')](_0x1b77cc,_0xcf8d('0x2e'));_0x424162[_0xcf8d('0x2f')]=_[_0xcf8d('0x30')](_0x4f6155[_0xcf8d('0x2f')]);_0x424162[_0xcf8d('0x31')]=_[_0xcf8d('0x32')](_0x424162[_0xcf8d('0x2d')],_0x424162[_0xcf8d('0x2f')]);_0x1cca6f['attributes']=_['intersection'](_0x424162[_0xcf8d('0x2d')],qs[_0xcf8d('0x33')](_0x4f6155[_0xcf8d('0x2f')]['fields']));_0x1cca6f[_0xcf8d('0x34')]=_0x1cca6f[_0xcf8d('0x34')]['length']?_0x1cca6f[_0xcf8d('0x34')]:_0x424162[_0xcf8d('0x2d')];if(!_0x4f6155[_0xcf8d('0x2f')]['hasOwnProperty'](_0xcf8d('0x35'))){_0x1cca6f[_0xcf8d('0x20')]=qs['limit'](_0x4f6155['query'][_0xcf8d('0x20')]);_0x1cca6f[_0xcf8d('0x1e')]=qs[_0xcf8d('0x1e')](_0x4f6155['query']['offset']);}_0x1cca6f[_0xcf8d('0x36')]=qs['sort'](_0x4f6155[_0xcf8d('0x2f')][_0xcf8d('0x37')]);_0x1cca6f['where']=qs['filters'](_['pick'](_0x4f6155['query'],_0x424162['filters']),_0x1b77cc);if(_0x4f6155['query'][_0xcf8d('0x38')]){_0x1cca6f[_0xcf8d('0x39')]=_[_0xcf8d('0x3a')](_0x1cca6f[_0xcf8d('0x39')],{'$or':_['map'](_0x1b77cc,function(_0x34f89f){if(_0x34f89f['type']!==_0xcf8d('0x3b')){var _0x192e08={};_0x192e08[_0x34f89f['name']]={'$like':'%'+_0x4f6155[_0xcf8d('0x2f')][_0xcf8d('0x38')]+'%'};return _0x192e08;}})});}_0x1cca6f=_[_0xcf8d('0x3a')]({},_0x1cca6f,_0x4f6155['options']);var _0x26fbd3={'where':_0x1cca6f[_0xcf8d('0x39')]};return db[_0xcf8d('0x29')][_0xcf8d('0x21')](_0x26fbd3)[_0xcf8d('0x25')](function(_0x399a9d){_0x2e0163[_0xcf8d('0x21')]=_0x399a9d;if(_0x4f6155['query']['includeAll']){_0x1cca6f[_0xcf8d('0x3c')]=[{'all':!![]}];}return db[_0xcf8d('0x29')][_0xcf8d('0x3d')](_0x1cca6f);})[_0xcf8d('0x25')](function(_0x58dde9){_0x2e0163[_0xcf8d('0x3e')]=_0x58dde9;return _0x2e0163;})[_0xcf8d('0x25')](respondWithFilteredResult(_0xec85b4,_0x1cca6f))[_0xcf8d('0x3f')](handleError(_0xec85b4,null));};exports[_0xcf8d('0x40')]=function(_0x2e37c3,_0x1dfad6){var _0x14146d={'raw':![],'where':{'id':_0x2e37c3[_0xcf8d('0x41')]['id']}},_0x16491f={};_0x16491f[_0xcf8d('0x2d')]=_['keys'](db[_0xcf8d('0x29')][_0xcf8d('0x2a')]);_0x16491f['query']=_[_0xcf8d('0x30')](_0x2e37c3[_0xcf8d('0x2f')]);_0x16491f[_0xcf8d('0x31')]=_[_0xcf8d('0x32')](_0x16491f['model'],_0x16491f[_0xcf8d('0x2f')]);_0x14146d[_0xcf8d('0x34')]=_[_0xcf8d('0x32')](_0x16491f[_0xcf8d('0x2d')],qs[_0xcf8d('0x33')](_0x2e37c3[_0xcf8d('0x2f')][_0xcf8d('0x33')]));_0x14146d[_0xcf8d('0x34')]=_0x14146d['attributes'][_0xcf8d('0x42')]?_0x14146d['attributes']:_0x16491f['model'];if(_0x2e37c3[_0xcf8d('0x2f')][_0xcf8d('0x43')]){_0x14146d[_0xcf8d('0x3c')]=[{'all':!![]}];}_0x14146d=_[_0xcf8d('0x3a')]({},_0x14146d,_0x2e37c3[_0xcf8d('0x44')]);return db[_0xcf8d('0x29')][_0xcf8d('0x45')](_0x14146d)[_0xcf8d('0x25')](handleEntityNotFound(_0x1dfad6,null))['then'](respondWithResult(_0x1dfad6,null))[_0xcf8d('0x3f')](handleError(_0x1dfad6,null));};exports['create']=function(_0x418513,_0x4f4c86){return db[_0xcf8d('0x29')][_0xcf8d('0x46')](_0x418513[_0xcf8d('0x47')],{})[_0xcf8d('0x25')](respondWithResult(_0x4f4c86,0xc9))[_0xcf8d('0x3f')](handleError(_0x4f4c86,null));};exports[_0xcf8d('0x48')]=function(_0x3730a6,_0x31a521){if(_0x3730a6['body']['id']){delete _0x3730a6[_0xcf8d('0x47')]['id'];}return db[_0xcf8d('0x29')]['find']({'where':{'id':_0x3730a6[_0xcf8d('0x41')]['id']}})[_0xcf8d('0x25')](handleEntityNotFound(_0x31a521,null))['then'](saveUpdates(_0x3730a6['body'],null))[_0xcf8d('0x25')](respondWithResult(_0x31a521,null))[_0xcf8d('0x3f')](handleError(_0x31a521,null));};exports[_0xcf8d('0x24')]=function(_0xdc47b3,_0x1f2783){return db[_0xcf8d('0x29')]['find']({'where':{'id':_0xdc47b3['params']['id']}})[_0xcf8d('0x25')](handleEntityNotFound(_0x1f2783,null))[_0xcf8d('0x25')](removeEntity(_0x1f2783,null))[_0xcf8d('0x3f')](handleError(_0x1f2783,null));};exports[_0xcf8d('0x49')]=function(_0x4722ff,_0x37df23,_0x3382df){var _0x4938b={};var _0xd0ac9b={};var _0x3e27cf;var _0xd3f370;return db[_0xcf8d('0x29')]['findOne']({'where':{'id':_0x4722ff[_0xcf8d('0x41')]['id']}})[_0xcf8d('0x25')](handleEntityNotFound(_0x37df23,null))['then'](function(_0x43680d){if(_0x43680d){_0x3e27cf=_0x43680d;_0xd0ac9b['model']=_['keys'](db[_0xcf8d('0x4a')][_0xcf8d('0x2a')]);_0xd0ac9b[_0xcf8d('0x2f')]=_[_0xcf8d('0x30')](_0x4722ff[_0xcf8d('0x2f')]);_0xd0ac9b['filters']=_[_0xcf8d('0x32')](_0xd0ac9b[_0xcf8d('0x2d')],_0xd0ac9b[_0xcf8d('0x2f')]);_0x4938b[_0xcf8d('0x34')]=_['intersection'](_0xd0ac9b['model'],qs['fields'](_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x33')]));_0x4938b[_0xcf8d('0x34')]=_0x4938b[_0xcf8d('0x34')][_0xcf8d('0x42')]?_0x4938b['attributes']:_0xd0ac9b[_0xcf8d('0x2d')];_0x4938b[_0xcf8d('0x36')]=qs['sort'](_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x37')]);_0x4938b[_0xcf8d('0x39')]=qs[_0xcf8d('0x31')](_[_0xcf8d('0x4b')](_0x4722ff[_0xcf8d('0x2f')],_0xd0ac9b[_0xcf8d('0x31')]));if(_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x38')]){_0x4938b[_0xcf8d('0x39')]=_[_0xcf8d('0x3a')](_0x4938b['where'],{'$or':_[_0xcf8d('0x28')](_0x4938b[_0xcf8d('0x34')],function(_0x1048ba){var _0x31661a={};_0x31661a[_0x1048ba]={'$like':'%'+_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x38')]+'%'};return _0x31661a;})});}_0x4938b=_[_0xcf8d('0x3a')]({},_0x4938b,_0x4722ff[_0xcf8d('0x44')]);return _0x3e27cf[_0xcf8d('0x49')](_0x4938b);}})[_0xcf8d('0x25')](function(_0xced20e){if(_0xced20e){_0xd3f370=_0xced20e[_0xcf8d('0x42')];if(!_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x4c')]('nolimit')){_0x4938b['limit']=qs[_0xcf8d('0x20')](_0x4722ff[_0xcf8d('0x2f')][_0xcf8d('0x20')]);_0x4938b[_0xcf8d('0x1e')]=qs[_0xcf8d('0x1e')](_0x4722ff['query'][_0xcf8d('0x1e')]);}return _0x3e27cf[_0xcf8d('0x49')](_0x4938b);}})[_0xcf8d('0x25')](function(_0x1d53ea){if(_0x1d53ea){return _0x1d53ea?{'count':_0xd3f370,'rows':_0x1d53ea}:null;}})[_0xcf8d('0x25')](respondWithResult(_0x37df23,null))[_0xcf8d('0x3f')](handleError(_0x37df23,null));};exports[_0xcf8d('0x4d')]=function(_0x159a0e,_0x451262,_0x15ca10){if(_0x159a0e[_0xcf8d('0x47')]['id']){delete _0x159a0e['body']['id'];}return db[_0xcf8d('0x29')][_0xcf8d('0x4e')]({'where':{'id':_0x159a0e[_0xcf8d('0x41')]['id']}})[_0xcf8d('0x25')](handleEntityNotFound(_0x451262,null))[_0xcf8d('0x25')](function(_0x5eefdf){if(_0x5eefdf){_0x159a0e[_0xcf8d('0x47')][_0xcf8d('0x4f')]=_0x5eefdf['id'];_0x159a0e[_0xcf8d('0x47')][_0xcf8d('0x50')]=integrations['getSubjects'](_0x159a0e[_0xcf8d('0x47')][_0xcf8d('0x51')],_0x159a0e['body'][_0xcf8d('0x2b')]);_0x159a0e['body']['Descriptions']=integrations['getDescriptions'](_0x159a0e[_0xcf8d('0x47')][_0xcf8d('0x51')],_0x159a0e[_0xcf8d('0x47')][_0xcf8d('0x2b')]);return db[_0xcf8d('0x4a')][_0xcf8d('0x46')](_0x159a0e[_0xcf8d('0x47')],{'include':[{'model':db['ZohoField'],'as':_0xcf8d('0x50')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x451262,null))[_0xcf8d('0x3f')](handleError(_0x451262,null));};function getAccessToken(_0x42eb0f){return new Promise(function(_0x78d092,_0x2d7dec){var _0x434f7b;switch(_0x42eb0f['zone']){case'US':_0x434f7b=_0xcf8d('0x52');break;case'AU':_0x434f7b=_0xcf8d('0x53');break;case'EU':_0x434f7b=_0xcf8d('0x54');break;case'IN':_0x434f7b='https://accounts.zoho.in';break;case'CN':_0x434f7b=_0xcf8d('0x55');break;default:_0x434f7b=_0xcf8d('0x54');break;}var _0x57d525={'method':_0xcf8d('0x56'),'uri':_0x434f7b+_0xcf8d('0x57'),'qs':{'refresh_token':_0x42eb0f[_0xcf8d('0x58')],'client_id':_0x42eb0f['clientId'],'client_secret':_0x42eb0f[_0xcf8d('0x59')],'grant_type':_0xcf8d('0x5a')},'json':!![]};return rp(_0x57d525)[_0xcf8d('0x25')](function(_0x193999){if(_0x193999[_0xcf8d('0x5b')]){_0x78d092(_0x193999['access_token']);}else{_0x2d7dec(_0xcf8d('0x5c'));}})[_0xcf8d('0x3f')](function(_0x1e1df1){_0x2d7dec(_0x1e1df1);});});}exports[_0xcf8d('0x5d')]=function(_0x149f12,_0x22e99c,_0x104d9a){var _0x24d13e,_0xfd2f8c,_0x24bc5e,_0x48a058,_0xd12ce7;return db[_0xcf8d('0x29')][_0xcf8d('0x4e')]({'where':{'id':_0x149f12['params']['id']},'attributes':['id','host',_0xcf8d('0x5e'),'clientId',_0xcf8d('0x59'),'serverUrl',_0xcf8d('0x5f'),'refreshToken']})['then'](handleEntityNotFound(_0x22e99c,null))[_0xcf8d('0x25')](function(_0x5bdf68){_0xd12ce7=_0x5bdf68;_0x24d13e=_0xd12ce7[_0xcf8d('0x60')];_0xfd2f8c=_0x24d13e===_0xcf8d('0x61')?'eu':_0xcf8d('0x62');_0x24bc5e=_0xd12ce7['serverUrl'];var _0x7eeb04=_0x24bc5e[_0xcf8d('0x63')](-0x1);if(_0x7eeb04==='/'||_0x7eeb04==='\x5c'||_0x7eeb04===':'){_0x24bc5e=_0x24bc5e['substring'](0x0,_0x24bc5e[_0xcf8d('0x64')](_0x7eeb04));}if(!_0xd12ce7[_0xcf8d('0x58')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xd12ce7);})['then'](function(_0x53c45c){if(_0x53c45c){return rp({'method':'GET','uri':util[_0xcf8d('0x65')](_0xcf8d('0x66'),_0xfd2f8c),'qs':{'module':_0xcf8d('0x67')},'headers':{'Authorization':_0xcf8d('0x68')+_0x53c45c},'json':!![]});}})['then'](function(_0x4f437b){if(_0x4f437b){if(_0x4f437b['response']&&_0x4f437b[_0xcf8d('0x69')][_0xcf8d('0x6a')]){throw new Error(_0x4f437b[_0xcf8d('0x69')][_0xcf8d('0x6a')][_0xcf8d('0x6b')]);}var _0x391e77=[];var _0xe48be9=[];var _0x369884=['Owner',_0xcf8d('0x6c'),'Description',_0xcf8d('0x6d'),_0xcf8d('0x6e'),_0xcf8d('0x6f'),_0xcf8d('0x70'),_0xcf8d('0x71')];_0xe48be9=_['remove'](_0x4f437b[_0xcf8d('0x33')],function(_0x254147){return _0x369884[_0xcf8d('0x72')](_0x254147[_0xcf8d('0x73')]);});for(var _0x2b96b7=0x0;_0x2b96b7<_0xe48be9['length'];_0x2b96b7++){if(_0xe48be9[_0x2b96b7][_0xcf8d('0x74')]===![]){_0x391e77[_0xcf8d('0x75')]({'id':_0xe48be9[_0x2b96b7]['id'],'name':_0xe48be9[_0x2b96b7][_0xcf8d('0x76')],'custom':_0xe48be9[_0x2b96b7][_0xcf8d('0x77')],'options':_0xe48be9[_0x2b96b7][_0xcf8d('0x78')]===_0xcf8d('0x79')&&_0xe48be9[_0x2b96b7]['pick_list_values'][_0xcf8d('0x42')]>-0x1?_[_0xcf8d('0x28')](_0xe48be9[_0x2b96b7][_0xcf8d('0x7a')],function(_0x404730){return{'name':_0x404730,'value':_0x404730};}):[]});}}return{'count':_0x391e77['length'],'rows':_0x391e77};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x22e99c,null))['catch'](function(_0x111c32){var _0x281c69=_0x149f12[_0xcf8d('0x2f')]['test']?0x1f4:_0x111c32['statusCode']||0x1f4;logger[_0xcf8d('0x6a')](_0xcf8d('0x7b'),'getFields',_0x281c69,JSON[_0xcf8d('0x7c')](_0x111c32));delete _0x111c32['name'];if(_0x281c69===0x191){_0x281c69=0x190;}_0x22e99c['status'](_0x281c69)[_0xcf8d('0x7d')](_0x149f12[_0xcf8d('0x2f')][_0xcf8d('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x111c32[_0xcf8d('0x7f')]}:_0x111c32);});}; \ No newline at end of file +var _0x4fa9=['clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fa9,0x1a6));var _0x94fa=function(_0x41dd3b,_0x1e9e80){_0x41dd3b=_0x41dd3b-0x0;var _0x975d5d=_0x4fa9[_0x41dd3b];return _0x975d5d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x94fa('0x0'));var rp=require(_0x94fa('0x1'));var moment=require(_0x94fa('0x2'));var BPromise=require(_0x94fa('0x3'));var Mustache=require(_0x94fa('0x4'));var util=require('util');var path=require(_0x94fa('0x5'));var sox=require(_0x94fa('0x6'));var csv=require(_0x94fa('0x7'));var ejs=require(_0x94fa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94fa('0x9'));var squel=require(_0x94fa('0xa'));var crypto=require(_0x94fa('0xb'));var jsforce=require(_0x94fa('0xc'));var deskjs=require(_0x94fa('0xd'));var toCsv=require(_0x94fa('0x7'));var querystring=require(_0x94fa('0xe'));var Papa=require(_0x94fa('0xf'));var Redis=require(_0x94fa('0x10'));var authService=require(_0x94fa('0x11'));var qs=require(_0x94fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94fa('0x13'));var logger=require(_0x94fa('0x14'))(_0x94fa('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94fa('0x16'));var db=require(_0x94fa('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x775b5e,_0x54a8c4){_0x54a8c4=_0x54a8c4||0xcc;return function(_0x20f920){if(_0x20f920){return _0x775b5e['sendStatus'](_0x54a8c4);}return _0x775b5e['status'](_0x54a8c4)[_0x94fa('0x18')]();};}function respondWithResult(_0x3c1647,_0x5a5f59){_0x5a5f59=_0x5a5f59||0xc8;return function(_0x4e41df){if(_0x4e41df){return _0x3c1647[_0x94fa('0x19')](_0x5a5f59)[_0x94fa('0x1a')](_0x4e41df);}};}function respondWithFilteredResult(_0x33b6c9,_0x3c8042){return function(_0x16d2b7){if(_0x16d2b7){var _0x53cda8=typeof _0x3c8042[_0x94fa('0x1b')]===_0x94fa('0x1c')&&typeof _0x3c8042['limit']===_0x94fa('0x1c');var _0x5b4aa2=_0x16d2b7[_0x94fa('0x1d')];var _0x1e48c8=_0x53cda8?0x0:_0x3c8042['offset'];var _0x2f6620=_0x53cda8?_0x16d2b7[_0x94fa('0x1d')]:_0x3c8042[_0x94fa('0x1b')]+_0x3c8042[_0x94fa('0x1e')];var _0x2a3f5e;if(_0x2f6620>=_0x5b4aa2){_0x2f6620=_0x5b4aa2;_0x2a3f5e=0xc8;}else{_0x2a3f5e=0xce;}_0x33b6c9[_0x94fa('0x19')](_0x2a3f5e);return _0x33b6c9[_0x94fa('0x1f')](_0x94fa('0x20'),_0x1e48c8+'-'+_0x2f6620+'/'+_0x5b4aa2)[_0x94fa('0x1a')](_0x16d2b7);}return null;};}function patchUpdates(_0x3dfb57){return function(_0x2f4fbe){try{jsonpatch['apply'](_0x2f4fbe,_0x3dfb57,!![]);}catch(_0x3f8644){return BPromise['reject'](_0x3f8644);}return _0x2f4fbe['save']();};}function saveUpdates(_0x55bd07,_0x52459a){return function(_0x34ad92){if(_0x34ad92){return _0x34ad92[_0x94fa('0x21')](_0x55bd07)[_0x94fa('0x22')](function(_0xcddbea){return _0xcddbea;});}return null;};}function removeEntity(_0x44edc4,_0x1d7ef4){return function(_0x4c837a){if(_0x4c837a){return _0x4c837a[_0x94fa('0x23')]()[_0x94fa('0x22')](function(){_0x44edc4[_0x94fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2518fd,_0x575b91){return function(_0x57d186){if(!_0x57d186){_0x2518fd[_0x94fa('0x24')](0x194);}return _0x57d186;};}function handleError(_0x2f96a1,_0x330de3){_0x330de3=_0x330de3||0x1f4;return function(_0xf8feef){logger['error'](_0xf8feef[_0x94fa('0x25')]);if(_0xf8feef[_0x94fa('0x26')]){delete _0xf8feef[_0x94fa('0x26')];}_0x2f96a1[_0x94fa('0x19')](_0x330de3)['send'](_0xf8feef);};}exports[_0x94fa('0x27')]=function(_0x457d57,_0x296752){var _0x156829={},_0x4c4e56={},_0x3b78c4={'count':0x0,'rows':[]};var _0x12cc89=_[_0x94fa('0x28')](db[_0x94fa('0x29')][_0x94fa('0x2a')],function(_0x558007){return{'name':_0x558007[_0x94fa('0x2b')],'type':_0x558007['type'][_0x94fa('0x2c')]};});_0x4c4e56['model']=_[_0x94fa('0x28')](_0x12cc89,_0x94fa('0x26'));_0x4c4e56[_0x94fa('0x2d')]=_[_0x94fa('0x2e')](_0x457d57['query']);_0x4c4e56[_0x94fa('0x2f')]=_[_0x94fa('0x30')](_0x4c4e56['model'],_0x4c4e56['query']);_0x156829['attributes']=_['intersection'](_0x4c4e56[_0x94fa('0x31')],qs['fields'](_0x457d57[_0x94fa('0x2d')][_0x94fa('0x32')]));_0x156829[_0x94fa('0x33')]=_0x156829[_0x94fa('0x33')][_0x94fa('0x34')]?_0x156829[_0x94fa('0x33')]:_0x4c4e56[_0x94fa('0x31')];if(!_0x457d57[_0x94fa('0x2d')][_0x94fa('0x35')](_0x94fa('0x36'))){_0x156829[_0x94fa('0x1e')]=qs[_0x94fa('0x1e')](_0x457d57[_0x94fa('0x2d')][_0x94fa('0x1e')]);_0x156829['offset']=qs['offset'](_0x457d57[_0x94fa('0x2d')][_0x94fa('0x1b')]);}_0x156829[_0x94fa('0x37')]=qs[_0x94fa('0x38')](_0x457d57[_0x94fa('0x2d')][_0x94fa('0x38')]);_0x156829[_0x94fa('0x39')]=qs[_0x94fa('0x2f')](_[_0x94fa('0x3a')](_0x457d57[_0x94fa('0x2d')],_0x4c4e56[_0x94fa('0x2f')]),_0x12cc89);if(_0x457d57[_0x94fa('0x2d')][_0x94fa('0x3b')]){_0x156829[_0x94fa('0x39')]=_['merge'](_0x156829[_0x94fa('0x39')],{'$or':_[_0x94fa('0x28')](_0x12cc89,function(_0x15e92e){if(_0x15e92e[_0x94fa('0x3c')]!=='VIRTUAL'){var _0x4b9da2={};_0x4b9da2[_0x15e92e[_0x94fa('0x26')]]={'$like':'%'+_0x457d57[_0x94fa('0x2d')]['filter']+'%'};return _0x4b9da2;}})});}_0x156829=_[_0x94fa('0x3d')]({},_0x156829,_0x457d57[_0x94fa('0x3e')]);var _0x3f6171={'where':_0x156829[_0x94fa('0x39')]};return db[_0x94fa('0x29')][_0x94fa('0x1d')](_0x3f6171)['then'](function(_0x4726da){_0x3b78c4[_0x94fa('0x1d')]=_0x4726da;if(_0x457d57[_0x94fa('0x2d')][_0x94fa('0x3f')]){_0x156829['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x94fa('0x40')](_0x156829);})[_0x94fa('0x22')](function(_0x209ee8){_0x3b78c4[_0x94fa('0x41')]=_0x209ee8;return _0x3b78c4;})[_0x94fa('0x22')](respondWithFilteredResult(_0x296752,_0x156829))[_0x94fa('0x42')](handleError(_0x296752,null));};exports[_0x94fa('0x43')]=function(_0x3268b6,_0x44acb9){var _0x9bb546={'raw':![],'where':{'id':_0x3268b6[_0x94fa('0x44')]['id']}},_0x524e3b={};_0x524e3b[_0x94fa('0x31')]=_[_0x94fa('0x2e')](db[_0x94fa('0x29')]['rawAttributes']);_0x524e3b[_0x94fa('0x2d')]=_[_0x94fa('0x2e')](_0x3268b6['query']);_0x524e3b[_0x94fa('0x2f')]=_[_0x94fa('0x30')](_0x524e3b['model'],_0x524e3b[_0x94fa('0x2d')]);_0x9bb546[_0x94fa('0x33')]=_['intersection'](_0x524e3b[_0x94fa('0x31')],qs['fields'](_0x3268b6['query']['fields']));_0x9bb546['attributes']=_0x9bb546[_0x94fa('0x33')]['length']?_0x9bb546[_0x94fa('0x33')]:_0x524e3b[_0x94fa('0x31')];if(_0x3268b6[_0x94fa('0x2d')][_0x94fa('0x3f')]){_0x9bb546[_0x94fa('0x45')]=[{'all':!![]}];}_0x9bb546=_[_0x94fa('0x3d')]({},_0x9bb546,_0x3268b6['options']);return db['ZohoAccount'][_0x94fa('0x46')](_0x9bb546)[_0x94fa('0x22')](handleEntityNotFound(_0x44acb9,null))[_0x94fa('0x22')](respondWithResult(_0x44acb9,null))['catch'](handleError(_0x44acb9,null));};exports[_0x94fa('0x47')]=function(_0x318b61,_0x1ad385){return db[_0x94fa('0x29')][_0x94fa('0x47')](_0x318b61[_0x94fa('0x48')],{})['then'](respondWithResult(_0x1ad385,0xc9))[_0x94fa('0x42')](handleError(_0x1ad385,null));};exports[_0x94fa('0x21')]=function(_0x585a6c,_0x38e477){if(_0x585a6c['body']['id']){delete _0x585a6c['body']['id'];}return db[_0x94fa('0x29')]['find']({'where':{'id':_0x585a6c[_0x94fa('0x44')]['id']}})['then'](handleEntityNotFound(_0x38e477,null))[_0x94fa('0x22')](saveUpdates(_0x585a6c['body'],null))[_0x94fa('0x22')](respondWithResult(_0x38e477,null))[_0x94fa('0x42')](handleError(_0x38e477,null));};exports[_0x94fa('0x23')]=function(_0x4dd98a,_0x554a54){return db['ZohoAccount'][_0x94fa('0x46')]({'where':{'id':_0x4dd98a[_0x94fa('0x44')]['id']}})['then'](handleEntityNotFound(_0x554a54,null))[_0x94fa('0x22')](removeEntity(_0x554a54,null))[_0x94fa('0x42')](handleError(_0x554a54,null));};exports['getConfigurations']=function(_0x1ef55a,_0x30781c,_0x979cd3){var _0x29000a={};var _0x1b8b29={};var _0x231206;var _0x433a92;return db[_0x94fa('0x29')][_0x94fa('0x49')]({'where':{'id':_0x1ef55a['params']['id']}})[_0x94fa('0x22')](handleEntityNotFound(_0x30781c,null))[_0x94fa('0x22')](function(_0x360adc){if(_0x360adc){_0x231206=_0x360adc;_0x1b8b29[_0x94fa('0x31')]=_[_0x94fa('0x2e')](db[_0x94fa('0x4a')][_0x94fa('0x2a')]);_0x1b8b29[_0x94fa('0x2d')]=_[_0x94fa('0x2e')](_0x1ef55a[_0x94fa('0x2d')]);_0x1b8b29[_0x94fa('0x2f')]=_[_0x94fa('0x30')](_0x1b8b29[_0x94fa('0x31')],_0x1b8b29['query']);_0x29000a[_0x94fa('0x33')]=_['intersection'](_0x1b8b29[_0x94fa('0x31')],qs['fields'](_0x1ef55a['query'][_0x94fa('0x32')]));_0x29000a[_0x94fa('0x33')]=_0x29000a['attributes']['length']?_0x29000a[_0x94fa('0x33')]:_0x1b8b29['model'];_0x29000a[_0x94fa('0x37')]=qs['sort'](_0x1ef55a[_0x94fa('0x2d')][_0x94fa('0x38')]);_0x29000a[_0x94fa('0x39')]=qs[_0x94fa('0x2f')](_['pick'](_0x1ef55a[_0x94fa('0x2d')],_0x1b8b29[_0x94fa('0x2f')]));if(_0x1ef55a['query']['filter']){_0x29000a[_0x94fa('0x39')]=_[_0x94fa('0x3d')](_0x29000a[_0x94fa('0x39')],{'$or':_[_0x94fa('0x28')](_0x29000a[_0x94fa('0x33')],function(_0x3676ab){var _0x952f33={};_0x952f33[_0x3676ab]={'$like':'%'+_0x1ef55a['query'][_0x94fa('0x3b')]+'%'};return _0x952f33;})});}_0x29000a=_[_0x94fa('0x3d')]({},_0x29000a,_0x1ef55a[_0x94fa('0x3e')]);return _0x231206['getConfigurations'](_0x29000a);}})[_0x94fa('0x22')](function(_0x39d20d){if(_0x39d20d){_0x433a92=_0x39d20d[_0x94fa('0x34')];if(!_0x1ef55a['query'][_0x94fa('0x35')]('nolimit')){_0x29000a[_0x94fa('0x1e')]=qs[_0x94fa('0x1e')](_0x1ef55a[_0x94fa('0x2d')]['limit']);_0x29000a['offset']=qs['offset'](_0x1ef55a[_0x94fa('0x2d')][_0x94fa('0x1b')]);}return _0x231206[_0x94fa('0x4b')](_0x29000a);}})[_0x94fa('0x22')](function(_0x7831d){if(_0x7831d){return _0x7831d?{'count':_0x433a92,'rows':_0x7831d}:null;}})[_0x94fa('0x22')](respondWithResult(_0x30781c,null))['catch'](handleError(_0x30781c,null));};exports[_0x94fa('0x4c')]=function(_0x40c434,_0x3b5404,_0x4cffbc){if(_0x40c434[_0x94fa('0x48')]['id']){delete _0x40c434['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x40c434[_0x94fa('0x44')]['id']}})[_0x94fa('0x22')](handleEntityNotFound(_0x3b5404,null))[_0x94fa('0x22')](function(_0x2a9b7a){if(_0x2a9b7a){_0x40c434[_0x94fa('0x48')]['AccountId']=_0x2a9b7a['id'];_0x40c434[_0x94fa('0x48')][_0x94fa('0x4d')]=integrations[_0x94fa('0x4e')](_0x40c434[_0x94fa('0x48')][_0x94fa('0x4f')],_0x40c434[_0x94fa('0x48')]['type']);_0x40c434[_0x94fa('0x48')][_0x94fa('0x50')]=integrations[_0x94fa('0x51')](_0x40c434[_0x94fa('0x48')][_0x94fa('0x4f')],_0x40c434[_0x94fa('0x48')][_0x94fa('0x3c')]);return db[_0x94fa('0x4a')][_0x94fa('0x47')](_0x40c434[_0x94fa('0x48')],{'include':[{'model':db[_0x94fa('0x52')],'as':_0x94fa('0x4d')},{'model':db[_0x94fa('0x52')],'as':_0x94fa('0x50')}]});}return null;})['then'](respondWithResult(_0x3b5404,null))['catch'](handleError(_0x3b5404,null));};function getAccessToken(_0x41a2f1){return new Promise(function(_0x3a54c6,_0x31ddae){var _0x32fbed;switch(_0x41a2f1['zone']){case'US':_0x32fbed='https://accounts.zoho.com';break;case'AU':_0x32fbed=_0x94fa('0x53');break;case'EU':_0x32fbed=_0x94fa('0x54');break;case'IN':_0x32fbed=_0x94fa('0x55');break;case'CN':_0x32fbed=_0x94fa('0x56');break;default:_0x32fbed=_0x94fa('0x54');break;}var _0x34ac17={'method':'POST','uri':_0x32fbed+_0x94fa('0x57'),'qs':{'refresh_token':_0x41a2f1[_0x94fa('0x58')],'client_id':_0x41a2f1[_0x94fa('0x59')],'client_secret':_0x41a2f1[_0x94fa('0x5a')],'grant_type':_0x94fa('0x5b')},'json':!![]};return rp(_0x34ac17)[_0x94fa('0x22')](function(_0x5b0243){if(_0x5b0243['access_token']){_0x3a54c6(_0x5b0243[_0x94fa('0x5c')]);}else{_0x31ddae(_0x94fa('0x5d'));}})['catch'](function(_0x1c5877){_0x31ddae(_0x1c5877);});});}exports['getFields']=function(_0x30ca80,_0x3e8ce5,_0x1f32d3){var _0x127427,_0x7e6dd6,_0x130bcc,_0x2cd0f1,_0x2f46f0;return db[_0x94fa('0x29')]['findOne']({'where':{'id':_0x30ca80[_0x94fa('0x44')]['id']},'attributes':['id',_0x94fa('0x5e'),'zone',_0x94fa('0x59'),_0x94fa('0x5a'),_0x94fa('0x5f'),_0x94fa('0x60'),_0x94fa('0x58')]})[_0x94fa('0x22')](handleEntityNotFound(_0x3e8ce5,null))[_0x94fa('0x22')](function(_0x22cc8f){_0x2f46f0=_0x22cc8f;_0x127427=_0x2f46f0['host'];_0x7e6dd6=_0x127427===_0x94fa('0x61')?'eu':_0x94fa('0x62');_0x130bcc=_0x2f46f0[_0x94fa('0x5f')];var _0xb37cbf=_0x130bcc[_0x94fa('0x63')](-0x1);if(_0xb37cbf==='/'||_0xb37cbf==='\x5c'||_0xb37cbf===':'){_0x130bcc=_0x130bcc[_0x94fa('0x64')](0x0,_0x130bcc[_0x94fa('0x65')](_0xb37cbf));}if(!_0x2f46f0['refreshToken']){throw new Error(_0x94fa('0x66'));}return getAccessToken(_0x2f46f0);})[_0x94fa('0x22')](function(_0x2b80ab){if(_0x2b80ab){return rp({'method':_0x94fa('0x67'),'uri':util['format'](_0x94fa('0x68'),_0x7e6dd6),'qs':{'module':'Calls'},'headers':{'Authorization':_0x94fa('0x69')+_0x2b80ab},'json':!![]});}})['then'](function(_0x3a124b){if(_0x3a124b){if(_0x3a124b['response']&&_0x3a124b[_0x94fa('0x6a')]['error']){throw new Error(_0x3a124b[_0x94fa('0x6a')][_0x94fa('0x6b')]['message']);}var _0x57ba06=[];var _0x3ee05b=[];var _0xb1c3d1=['Owner','Subject',_0x94fa('0x6c'),_0x94fa('0x6d'),_0x94fa('0x6e'),'Call_Result',_0x94fa('0x6f'),_0x94fa('0x70')];_0x3ee05b=_['remove'](_0x3a124b[_0x94fa('0x32')],function(_0x3b4d77){return _0xb1c3d1[_0x94fa('0x71')](_0x3b4d77[_0x94fa('0x72')]);});for(var _0x28e32d=0x0;_0x28e32d<_0x3ee05b[_0x94fa('0x34')];_0x28e32d++){if(_0x3ee05b[_0x28e32d][_0x94fa('0x73')]===![]){_0x57ba06[_0x94fa('0x74')]({'id':_0x3ee05b[_0x28e32d]['id'],'name':_0x3ee05b[_0x28e32d][_0x94fa('0x75')],'custom':_0x3ee05b[_0x28e32d][_0x94fa('0x76')],'options':_0x3ee05b[_0x28e32d][_0x94fa('0x77')]===_0x94fa('0x78')&&_0x3ee05b[_0x28e32d][_0x94fa('0x79')][_0x94fa('0x34')]>-0x1?_[_0x94fa('0x28')](_0x3ee05b[_0x28e32d][_0x94fa('0x79')],function(_0x16b1e9){return{'name':_0x16b1e9,'value':_0x16b1e9};}):[]});}}return{'count':_0x57ba06[_0x94fa('0x34')],'rows':_0x57ba06};}else{return{'count':0x0,'rows':[]};}})[_0x94fa('0x22')](respondWithResult(_0x3e8ce5,null))[_0x94fa('0x42')](function(_0x48ba53){var _0x218866=_0x30ca80[_0x94fa('0x2d')][_0x94fa('0x7a')]?0x1f4:_0x48ba53[_0x94fa('0x7b')]||0x1f4;logger[_0x94fa('0x6b')](_0x94fa('0x7c'),'getFields',_0x218866,JSON[_0x94fa('0x7d')](_0x48ba53));delete _0x48ba53[_0x94fa('0x26')];if(_0x218866===0x191){_0x218866=0x190;}_0x3e8ce5[_0x94fa('0x19')](_0x218866)[_0x94fa('0x7e')](_0x30ca80[_0x94fa('0x2d')]['test']?{'message':_0x94fa('0x7f'),'statusCode':_0x48ba53[_0x94fa('0x7b')]}:_0x48ba53);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a9aa8da..73eb690 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 _0x6e08=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','host','lastIndexOf','https://accounts.zoho.com','application/x-www-form-urlencoded','info','inspect','util','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','code','serverUrl','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refreshToken','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format'];(function(_0x22e513,_0x53d375){var _0x55d29b=function(_0x2ccff5){while(--_0x2ccff5){_0x22e513['push'](_0x22e513['shift']());}};_0x55d29b(++_0x53d375);}(_0x6e08,0xda));var _0x86e0=function(_0x2f85b3,_0x416a6f){_0x2f85b3=_0x2f85b3-0x0;var _0x99349d=_0x6e08[_0x2f85b3];return _0x99349d;};'use strict';var _=require('lodash');var util=require(_0x86e0('0x0'));var logger=require('../../config/logger')(_0x86e0('0x1'));var moment=require('moment');var BPromise=require(_0x86e0('0x2'));var rp=require(_0x86e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86e0('0x4'));var config=require(_0x86e0('0x5'));var attributes=require(_0x86e0('0x6'));var integrations=require(_0x86e0('0x7'));module[_0x86e0('0x8')]=function(_0x36b412,_0x1b1174){return _0x36b412[_0x86e0('0x9')](_0x86e0('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a60dc,_0x4c834f,_0x461db5){if(_0x4a60dc[_0x86e0('0xb')](_0x86e0('0xc'))||_0x4a60dc[_0x86e0('0xb')]('serverUrl')||_0x4a60dc[_0x86e0('0xb')](_0x86e0('0xd'))||_0x4a60dc[_0x86e0('0xb')](_0x86e0('0xe'))||_0x4a60dc[_0x86e0('0xb')](_0x86e0('0xf'))||_0x4a60dc[_0x86e0('0xb')]('host')){var _0xd7b2dc,_0x215676;_0xd7b2dc=_0x4a60dc[_0x86e0('0x10')];var _0x4dd79f=_0xd7b2dc[_0x86e0('0x11')](-0x1);if(_0x4dd79f==='/'||_0x4dd79f==='\x5c'||_0x4dd79f===':'){_0xd7b2dc=_0xd7b2dc[_0x86e0('0x12')](0x0,_0xd7b2dc['lastIndexOf'](_0x4dd79f));}switch(_0x4a60dc[_0x86e0('0xc')]){case'US':_0x215676='https://accounts.zoho.com';break;case'AU':_0x215676=_0x86e0('0x13');break;case'IN':_0x215676=_0x86e0('0x14');break;case'CN':_0x215676=_0x86e0('0x15');break;default:_0x215676=_0x86e0('0x16');break;}var _0x28e8bb={'method':_0x86e0('0x17'),'uri':_0x215676+_0x86e0('0x18'),'form':{'grant_type':_0x86e0('0x19'),'client_id':_0x4a60dc[_0x86e0('0xd')],'client_secret':_0x4a60dc[_0x86e0('0xe')],'redirect_uri':_0x4a60dc[_0x86e0('0x10')],'code':_0x4a60dc[_0x86e0('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x28e8bb)[_0x86e0('0x1a')](function(_0x353c03){var _0x45984b=JSON[_0x86e0('0x1b')](_0x353c03);if(_0x45984b['refresh_token']){_0x4a60dc[_0x86e0('0x1c')]=_0x45984b[_0x86e0('0x1d')];logger['info'](util['format'](_0x86e0('0x1e'),_0x4a60dc[_0x86e0('0x1f')],_0x4a60dc['id']));}else{logger[_0x86e0('0x20')](util[_0x86e0('0x21')](_0x86e0('0x22'),_0x4a60dc[_0x86e0('0x1f')],_0x4a60dc['id']),util['inspect'](_0x45984b,{'showHidden':![],'depth':null}));}return _0x461db5(null,_0x4c834f);})[_0x86e0('0x23')](function(_0x4f462a){logger[_0x86e0('0x20')](util['format'](_0x86e0('0x22'),_0x4a60dc[_0x86e0('0x1f')],_0x4a60dc['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x461db5(_0x4f462a);});}else{return _0x461db5(null,_0x4c834f);}},'beforeUpdate':function(_0x10a262,_0x56d418,_0x3b88bd){if(_0x10a262[_0x86e0('0xb')](_0x86e0('0xc'))||_0x10a262[_0x86e0('0xb')](_0x86e0('0x10'))||_0x10a262['changed'](_0x86e0('0xd'))||_0x10a262['changed'](_0x86e0('0xe'))||_0x10a262[_0x86e0('0xb')]('code')||_0x10a262[_0x86e0('0xb')](_0x86e0('0x24'))){var _0x577481,_0x40a63c;_0x577481=_0x10a262['serverUrl'];var _0x4d76ba=_0x577481[_0x86e0('0x11')](-0x1);if(_0x4d76ba==='/'||_0x4d76ba==='\x5c'||_0x4d76ba===':'){_0x577481=_0x577481[_0x86e0('0x12')](0x0,_0x577481[_0x86e0('0x25')](_0x4d76ba));}switch(_0x10a262[_0x86e0('0xc')]){case'US':_0x40a63c=_0x86e0('0x26');break;case'AU':_0x40a63c='https://accounts.zoho.com.au';break;case'IN':_0x40a63c=_0x86e0('0x14');break;case'CN':_0x40a63c=_0x86e0('0x15');break;default:_0x40a63c=_0x86e0('0x16');break;}var _0x1389a8={'method':'POST','uri':_0x40a63c+_0x86e0('0x18'),'form':{'grant_type':_0x86e0('0x19'),'client_id':_0x10a262[_0x86e0('0xd')],'client_secret':_0x10a262[_0x86e0('0xe')],'redirect_uri':_0x10a262[_0x86e0('0x10')],'code':_0x10a262[_0x86e0('0xf')]},'headers':{'Content-Type':_0x86e0('0x27')}};return rp(_0x1389a8)[_0x86e0('0x1a')](function(_0x4c5687){var _0x49025a=JSON[_0x86e0('0x1b')](_0x4c5687);if(_0x49025a[_0x86e0('0x1d')]){_0x10a262[_0x86e0('0x1c')]=_0x49025a[_0x86e0('0x1d')];logger[_0x86e0('0x28')](util[_0x86e0('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x10a262['name'],_0x10a262['id']));}else{logger[_0x86e0('0x20')](util[_0x86e0('0x21')](_0x86e0('0x22'),_0x10a262[_0x86e0('0x1f')],_0x10a262['id']),util[_0x86e0('0x29')](_0x49025a,{'showHidden':![],'depth':null}));}return _0x3b88bd(null,_0x56d418);})[_0x86e0('0x23')](function(_0x2c180d){logger[_0x86e0('0x20')](util[_0x86e0('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x10a262[_0x86e0('0x1f')],_0x10a262['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3b88bd(_0x2c180d);});}else{return _0x3b88bd(null,_0x56d418);}}}});}; \ No newline at end of file +var _0x2724=['catch','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','serverUrl','substring','https://accounts.zoho.com.au','POST','application/x-www-form-urlencoded','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2724,0x135));var _0x4272=function(_0x29e709,_0x512540){_0x29e709=_0x29e709-0x0;var _0x389743=_0x2724[_0x29e709];return _0x389743;};'use strict';var _=require(_0x4272('0x0'));var util=require(_0x4272('0x1'));var logger=require(_0x4272('0x2'))(_0x4272('0x3'));var moment=require(_0x4272('0x4'));var BPromise=require('bluebird');var rp=require(_0x4272('0x5'));var fs=require('fs');var path=require(_0x4272('0x6'));var rimraf=require(_0x4272('0x7'));var config=require(_0x4272('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4272('0x9')]=function(_0x3a76c0,_0x75141a){return _0x3a76c0[_0x4272('0xa')](_0x4272('0xb'),attributes,{'tableName':_0x4272('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36b400,_0x250891,_0x21e5f9){if(_0x36b400[_0x4272('0xd')](_0x4272('0xe'))||_0x36b400[_0x4272('0xd')]('serverUrl')||_0x36b400[_0x4272('0xd')](_0x4272('0xf'))||_0x36b400[_0x4272('0xd')](_0x4272('0x10'))||_0x36b400[_0x4272('0xd')](_0x4272('0x11'))||_0x36b400['changed'](_0x4272('0x12'))){var _0x30768f,_0x1270f1;_0x30768f=_0x36b400['serverUrl'];var _0x5088bd=_0x30768f[_0x4272('0x13')](-0x1);if(_0x5088bd==='/'||_0x5088bd==='\x5c'||_0x5088bd===':'){_0x30768f=_0x30768f['substring'](0x0,_0x30768f[_0x4272('0x14')](_0x5088bd));}switch(_0x36b400[_0x4272('0xe')]){case'US':_0x1270f1=_0x4272('0x15');break;case'AU':_0x1270f1='https://accounts.zoho.com.au';break;case'IN':_0x1270f1=_0x4272('0x16');break;case'CN':_0x1270f1=_0x4272('0x17');break;default:_0x1270f1=_0x4272('0x18');break;}var _0x1751e1={'method':'POST','uri':_0x1270f1+_0x4272('0x19'),'form':{'grant_type':_0x4272('0x1a'),'client_id':_0x36b400[_0x4272('0xf')],'client_secret':_0x36b400[_0x4272('0x10')],'redirect_uri':_0x36b400['serverUrl'],'code':_0x36b400[_0x4272('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1751e1)['then'](function(_0x25ba75){var _0x1c373d=JSON[_0x4272('0x1b')](_0x25ba75);if(_0x1c373d[_0x4272('0x1c')]){_0x36b400[_0x4272('0x1d')]=_0x1c373d[_0x4272('0x1c')];logger[_0x4272('0x1e')](util['format'](_0x4272('0x1f'),_0x36b400[_0x4272('0x20')],_0x36b400['id']));}else{logger[_0x4272('0x21')](util[_0x4272('0x22')](_0x4272('0x23'),_0x36b400[_0x4272('0x20')],_0x36b400['id']),util[_0x4272('0x24')](_0x1c373d,{'showHidden':![],'depth':null}));}return _0x21e5f9(null,_0x250891);})['catch'](function(_0x331978){logger[_0x4272('0x21')](util[_0x4272('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x36b400[_0x4272('0x20')],_0x36b400['id']),util[_0x4272('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x21e5f9(_0x331978);});}else{return _0x21e5f9(null,_0x250891);}},'beforeUpdate':function(_0x1c7135,_0x3018c0,_0x16d52d){if(_0x1c7135[_0x4272('0xd')](_0x4272('0xe'))||_0x1c7135['changed'](_0x4272('0x25'))||_0x1c7135['changed']('clientId')||_0x1c7135[_0x4272('0xd')]('clientSecret')||_0x1c7135[_0x4272('0xd')](_0x4272('0x11'))||_0x1c7135[_0x4272('0xd')](_0x4272('0x12'))){var _0x2dad4c,_0x172774;_0x2dad4c=_0x1c7135[_0x4272('0x25')];var _0xe1013=_0x2dad4c[_0x4272('0x13')](-0x1);if(_0xe1013==='/'||_0xe1013==='\x5c'||_0xe1013===':'){_0x2dad4c=_0x2dad4c[_0x4272('0x26')](0x0,_0x2dad4c['lastIndexOf'](_0xe1013));}switch(_0x1c7135[_0x4272('0xe')]){case'US':_0x172774=_0x4272('0x15');break;case'AU':_0x172774=_0x4272('0x27');break;case'IN':_0x172774=_0x4272('0x16');break;case'CN':_0x172774=_0x4272('0x17');break;default:_0x172774=_0x4272('0x18');break;}var _0x41aab8={'method':_0x4272('0x28'),'uri':_0x172774+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1c7135['clientId'],'client_secret':_0x1c7135[_0x4272('0x10')],'redirect_uri':_0x1c7135['serverUrl'],'code':_0x1c7135[_0x4272('0x11')]},'headers':{'Content-Type':_0x4272('0x29')}};return rp(_0x41aab8)[_0x4272('0x2a')](function(_0xc20f0e){var _0x30e280=JSON[_0x4272('0x1b')](_0xc20f0e);if(_0x30e280['refresh_token']){_0x1c7135['refreshToken']=_0x30e280[_0x4272('0x1c')];logger[_0x4272('0x1e')](util[_0x4272('0x22')](_0x4272('0x1f'),_0x1c7135[_0x4272('0x20')],_0x1c7135['id']));}else{logger[_0x4272('0x21')](util['format'](_0x4272('0x23'),_0x1c7135['name'],_0x1c7135['id']),util[_0x4272('0x24')](_0x30e280,{'showHidden':![],'depth':null}));}return _0x16d52d(null,_0x3018c0);})[_0x4272('0x2b')](function(_0x277253){logger[_0x4272('0x21')](util[_0x4272('0x22')](_0x4272('0x23'),_0x1c7135[_0x4272('0x20')],_0x1c7135['id']),util[_0x4272('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x16d52d(_0x277253);});}else{return _0x16d52d(null,_0x3018c0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 68f62ca..e8641b0 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 _0xeae8=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','ZohoAccount','findAll','options','raw','attributes','limit','include','model','map','then','GetZohoAccount','stringify','catch','ShowZohoAccount','find','where'];(function(_0x2fd719,_0xa1c429){var _0x3fcc83=function(_0x8e31fa){while(--_0x8e31fa){_0x2fd719['push'](_0x2fd719['shift']());}};_0x3fcc83(++_0xa1c429);}(_0xeae8,0x66));var _0x8eae=function(_0x26b29e,_0x2e0806){_0x26b29e=_0x26b29e-0x0;var _0x2e7bfc=_0xeae8[_0x26b29e];return _0x2e7bfc;};'use strict';var _=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var moment=require(_0x8eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x8eae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eae('0x5'))(_0x8eae('0x6'));var config=require(_0x8eae('0x7'));var jayson=require(_0x8eae('0x8'));var client=jayson[_0x8eae('0x9')][_0x8eae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c67f,_0xd2b0,_0x2dcd90){return new BPromise(function(_0x2ae6e7,_0x476ba1){return client['request'](_0x32c67f,_0x2dcd90)['then'](function(_0x1cd68f){logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));logger[_0x8eae('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd2b0,'request\x20sent',JSON['stringify'](_0x1cd68f));if(_0x1cd68f[_0x8eae('0xf')]){if(_0x1cd68f[_0x8eae('0xf')]['code']===0x1f4){logger[_0x8eae('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x476ba1(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}logger[_0x8eae('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x2ae6e7(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}else{logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));_0x2ae6e7(_0x1cd68f[_0x8eae('0x11')][_0x8eae('0x10')]);}})['catch'](function(_0x5e214e){logger['error'](_0x8eae('0xc'),_0xd2b0,_0x5e214e);_0x476ba1(_0x5e214e);});});}exports['GetZohoAccount']=function(_0x3db47b){var _0x3fe930=this;return new Promise(function(_0x386a97,_0x13331a){return db[_0x8eae('0x12')][_0x8eae('0x13')]({'raw':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x3db47b[_0x8eae('0x14')]?_0x3db47b['options']['where']||null:null,'attributes':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'limit':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x17')]||null:null,'include':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')]?_['map'](_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x171710){return{'model':db[_0x171710[_0x8eae('0x19')]],'as':_0x171710['as'],'attributes':_0x171710[_0x8eae('0x16')],'include':_0x171710[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x171710[_0x8eae('0x18')],function(_0x14c0c5){return{'model':db[_0x14c0c5[_0x8eae('0x19')]],'as':_0x14c0c5['as'],'attributes':_0x14c0c5[_0x8eae('0x16')],'include':_0x14c0c5['include']?_[_0x8eae('0x1a')](_0x14c0c5[_0x8eae('0x18')],function(_0x141940){return{'model':db[_0x141940[_0x8eae('0x19')]],'as':_0x141940['as'],'attributes':_0x141940[_0x8eae('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x206ba3){logger['info'](_0x8eae('0x1c'),_0x3db47b);logger['debug'](_0x8eae('0x1c'),_0x3db47b,JSON[_0x8eae('0x1d')](_0x206ba3));_0x386a97(_0x206ba3);})[_0x8eae('0x1e')](function(_0x3f5d30){logger[_0x8eae('0xf')]('GetZohoAccount',_0x3f5d30['message'],_0x3db47b);_0x13331a(_0x3fe930[_0x8eae('0xf')](0x1f4,_0x3f5d30[_0x8eae('0x10')]));});});};exports[_0x8eae('0x1f')]=function(_0x307a19){var _0x547eea=this;return new Promise(function(_0x113dc7,_0x22ffeb){return db[_0x8eae('0x12')][_0x8eae('0x20')]({'raw':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x21')]||null:null,'attributes':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'include':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x2fc72a){return{'model':db[_0x2fc72a[_0x8eae('0x19')]],'as':_0x2fc72a['as'],'attributes':_0x2fc72a['attributes'],'include':_0x2fc72a[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x2fc72a[_0x8eae('0x18')],function(_0x4bf905){return{'model':db[_0x4bf905[_0x8eae('0x19')]],'as':_0x4bf905['as'],'attributes':_0x4bf905[_0x8eae('0x16')],'include':_0x4bf905[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x4bf905['include'],function(_0xa885ad){return{'model':db[_0xa885ad['model']],'as':_0xa885ad['as'],'attributes':_0xa885ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x38713d){logger[_0x8eae('0xb')](_0x8eae('0x1f'),_0x307a19);logger[_0x8eae('0xe')](_0x8eae('0x1f'),_0x307a19,JSON[_0x8eae('0x1d')](_0x38713d));_0x113dc7(_0x38713d);})['catch'](function(_0x71f9be){logger[_0x8eae('0xf')]('ShowZohoAccount',_0x71f9be['message'],_0x307a19);_0x22ffeb(_0x547eea['error'](0x1f4,_0x71f9be[_0x8eae('0x10')]));});});}; \ No newline at end of file +var _0x6d0c=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ZohoAccount','options','where','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf42c09,_0x47c326){var _0x525b51=function(_0x274dcd){while(--_0x274dcd){_0xf42c09['push'](_0xf42c09['shift']());}};_0x525b51(++_0x47c326);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x1b0c8d,_0x30871a){_0x1b0c8d=_0x1b0c8d-0x0;var _0x5a8bb9=_0x6d0c[_0x1b0c8d];return _0x5a8bb9;};'use strict';var _=require(_0xc6d0('0x0'));var util=require(_0xc6d0('0x1'));var moment=require(_0xc6d0('0x2'));var BPromise=require(_0xc6d0('0x3'));var rs=require(_0xc6d0('0x4'));var fs=require('fs');var Redis=require(_0xc6d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc6d0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc6d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40ba33,_0xf1bb4f,_0x39e8be){return new BPromise(function(_0xbd2213,_0x1cf577){return client[_0xc6d0('0x9')](_0x40ba33,_0x39e8be)[_0xc6d0('0xa')](function(_0x1452b5){logger[_0xc6d0('0xb')](_0xc6d0('0xc'),_0xf1bb4f,_0xc6d0('0xd'));logger[_0xc6d0('0xe')](_0xc6d0('0xf'),_0xf1bb4f,_0xc6d0('0xd'),JSON[_0xc6d0('0x10')](_0x1452b5));if(_0x1452b5[_0xc6d0('0x11')]){if(_0x1452b5[_0xc6d0('0x11')][_0xc6d0('0x12')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xf1bb4f,_0x1452b5[_0xc6d0('0x11')][_0xc6d0('0x13')]);return _0x1cf577(_0x1452b5['error'][_0xc6d0('0x13')]);}logger[_0xc6d0('0x11')](_0xc6d0('0xc'),_0xf1bb4f,_0x1452b5['error']['message']);return _0xbd2213(_0x1452b5[_0xc6d0('0x11')][_0xc6d0('0x13')]);}else{logger[_0xc6d0('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xf1bb4f,_0xc6d0('0xd'));_0xbd2213(_0x1452b5['result'][_0xc6d0('0x13')]);}})[_0xc6d0('0x14')](function(_0x34ea2f){logger[_0xc6d0('0x11')](_0xc6d0('0xc'),_0xf1bb4f,_0x34ea2f);_0x1cf577(_0x34ea2f);});});}exports['GetZohoAccount']=function(_0x4b178c){var _0x55b27e=this;return new Promise(function(_0x1fa160,_0x375642){return db[_0xc6d0('0x15')]['findAll']({'raw':_0x4b178c[_0xc6d0('0x16')]?_0x4b178c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b178c[_0xc6d0('0x16')]?_0x4b178c[_0xc6d0('0x16')][_0xc6d0('0x17')]||null:null,'attributes':_0x4b178c[_0xc6d0('0x16')]?_0x4b178c[_0xc6d0('0x16')][_0xc6d0('0x18')]||null:null,'limit':_0x4b178c[_0xc6d0('0x16')]?_0x4b178c[_0xc6d0('0x16')]['limit']||null:null,'include':_0x4b178c[_0xc6d0('0x16')]?_0x4b178c[_0xc6d0('0x16')][_0xc6d0('0x19')]?_[_0xc6d0('0x1a')](_0x4b178c['options']['include'],function(_0x321a97){return{'model':db[_0x321a97[_0xc6d0('0x1b')]],'as':_0x321a97['as'],'attributes':_0x321a97[_0xc6d0('0x18')],'include':_0x321a97[_0xc6d0('0x19')]?_[_0xc6d0('0x1a')](_0x321a97[_0xc6d0('0x19')],function(_0x2cc17e){return{'model':db[_0x2cc17e[_0xc6d0('0x1b')]],'as':_0x2cc17e['as'],'attributes':_0x2cc17e[_0xc6d0('0x18')],'include':_0x2cc17e[_0xc6d0('0x19')]?_[_0xc6d0('0x1a')](_0x2cc17e[_0xc6d0('0x19')],function(_0x2bb7a8){return{'model':db[_0x2bb7a8['model']],'as':_0x2bb7a8['as'],'attributes':_0x2bb7a8['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6d0('0xa')](function(_0x415f95){logger[_0xc6d0('0xb')](_0xc6d0('0x1c'),_0x4b178c);logger['debug'](_0xc6d0('0x1c'),_0x4b178c,JSON[_0xc6d0('0x10')](_0x415f95));_0x1fa160(_0x415f95);})[_0xc6d0('0x14')](function(_0x3dcc61){logger[_0xc6d0('0x11')]('GetZohoAccount',_0x3dcc61[_0xc6d0('0x13')],_0x4b178c);_0x375642(_0x55b27e[_0xc6d0('0x11')](0x1f4,_0x3dcc61[_0xc6d0('0x13')]));});});};exports[_0xc6d0('0x1d')]=function(_0x4622ce){var _0x122c2c=this;return new Promise(function(_0x501d4e,_0x2985cf){return db[_0xc6d0('0x15')][_0xc6d0('0x1e')]({'raw':_0x4622ce[_0xc6d0('0x16')]?_0x4622ce[_0xc6d0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4622ce['options']?_0x4622ce[_0xc6d0('0x16')][_0xc6d0('0x17')]||null:null,'attributes':_0x4622ce['options']?_0x4622ce[_0xc6d0('0x16')][_0xc6d0('0x18')]||null:null,'include':_0x4622ce[_0xc6d0('0x16')]?_0x4622ce[_0xc6d0('0x16')][_0xc6d0('0x19')]?_[_0xc6d0('0x1a')](_0x4622ce['options'][_0xc6d0('0x19')],function(_0x54d9fc){return{'model':db[_0x54d9fc['model']],'as':_0x54d9fc['as'],'attributes':_0x54d9fc[_0xc6d0('0x18')],'include':_0x54d9fc[_0xc6d0('0x19')]?_[_0xc6d0('0x1a')](_0x54d9fc['include'],function(_0x4ca373){return{'model':db[_0x4ca373[_0xc6d0('0x1b')]],'as':_0x4ca373['as'],'attributes':_0x4ca373[_0xc6d0('0x18')],'include':_0x4ca373['include']?_['map'](_0x4ca373[_0xc6d0('0x19')],function(_0x41b739){return{'model':db[_0x41b739['model']],'as':_0x41b739['as'],'attributes':_0x41b739[_0xc6d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc6d0('0xa')](function(_0x19c6d1){logger['info']('ShowZohoAccount',_0x4622ce);logger[_0xc6d0('0xe')](_0xc6d0('0x1d'),_0x4622ce,JSON[_0xc6d0('0x10')](_0x19c6d1));_0x501d4e(_0x19c6d1);})['catch'](function(_0x520175){logger['error'](_0xc6d0('0x1d'),_0x520175[_0xc6d0('0x13')],_0x4622ce);_0x2985cf(_0x122c2c[_0xc6d0('0x11')](0x1f4,_0x520175['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 51520db..b8aea25 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 _0x7e3a=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','multer','util','path','express','../../components/auth/service'];(function(_0x56ebb1,_0x5309fb){var _0xebb026=function(_0xed4f63){while(--_0xed4f63){_0x56ebb1['push'](_0x56ebb1['shift']());}};_0xebb026(++_0x5309fb);}(_0x7e3a,0x14b));var _0xa7e3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7e3a[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xa7e3('0x0'));var util=require(_0xa7e3('0x1'));var path=require(_0xa7e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7e3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7e3('0x4'));var interaction=require(_0xa7e3('0x5'));var config=require(_0xa7e3('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xa7e3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa7e3('0x8')]);router[_0xa7e3('0x7')](_0xa7e3('0x9'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xb')]);router[_0xa7e3('0x7')](_0xa7e3('0xc'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xd')]);router[_0xa7e3('0x7')](_0xa7e3('0xe'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xf')]);router['get'](_0xa7e3('0x10'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x11')]);router[_0xa7e3('0x12')]('/',auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x13')]);router['put']('/:id',auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x14')]);router['delete'](_0xa7e3('0x9'),auth[_0xa7e3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8512=['express','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x8512,0x1c9));var _0x2851=function(_0x17b42a,_0x310bde){_0x17b42a=_0x17b42a-0x0;var _0x3277d6=_0x8512[_0x17b42a];return _0x3277d6;};'use strict';var multer=require(_0x2851('0x0'));var util=require('util');var path=require(_0x2851('0x1'));var timeout=require(_0x2851('0x2'));var express=require(_0x2851('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2851('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x2851('0x5')]('/',auth['isAuthenticated'](),controller[_0x2851('0x6')]);router[_0x2851('0x5')](_0x2851('0x7'),auth[_0x2851('0x8')](),controller[_0x2851('0x9')]);router[_0x2851('0x5')](_0x2851('0xa'),auth[_0x2851('0x8')](),controller[_0x2851('0xb')]);router['get'](_0x2851('0xc'),auth[_0x2851('0x8')](),controller[_0x2851('0xd')]);router[_0x2851('0x5')](_0x2851('0xe'),auth[_0x2851('0x8')](),controller[_0x2851('0xf')]);router['post']('/',auth[_0x2851('0x8')](),controller['create']);router['put']('/:id',auth[_0x2851('0x8')](),controller[_0x2851('0x10')]);router[_0x2851('0x11')](_0x2851('0x7'),auth[_0x2851('0x8')](),controller[_0x2851('0x12')]);module[_0x2851('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 224abaf..9c9f006 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 _0x66d6=['sequelize','STRING','ENUM','lead','nothing','contact_lead','contact'];(function(_0x236766,_0x5ab0b9){var _0x32313d=function(_0x5d60ac){while(--_0x5d60ac){_0x236766['push'](_0x236766['shift']());}};_0x32313d(++_0x5ab0b9);}(_0x66d6,0x1c7));var _0x666d=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0x66d6[_0x388914];return _0x1f9111;};'use strict';var Sequelize=require(_0x666d('0x0'));module['exports']={'name':{'type':Sequelize[_0x666d('0x1')]},'moduleCreate':{'type':Sequelize[_0x666d('0x2')](_0x666d('0x3'),'contact',_0x666d('0x4')),'defaultValue':_0x666d('0x3')},'moduleSearch':{'type':Sequelize[_0x666d('0x2')](_0x666d('0x5'),_0x666d('0x6'),_0x666d('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2568=['nothing','contact_lead','sequelize','STRING','ENUM','lead','contact'];(function(_0x478970,_0x5df032){var _0x1759f1=function(_0x58579d){while(--_0x58579d){_0x478970['push'](_0x478970['shift']());}};_0x1759f1(++_0x5df032);}(_0x2568,0x12f));var _0x8256=function(_0x58bea4,_0x2136ae){_0x58bea4=_0x58bea4-0x0;var _0x167e0c=_0x2568[_0x58bea4];return _0x167e0c;};'use strict';var Sequelize=require(_0x8256('0x0'));module['exports']={'name':{'type':Sequelize[_0x8256('0x1')]},'moduleCreate':{'type':Sequelize[_0x8256('0x2')](_0x8256('0x3'),_0x8256('0x4'),_0x8256('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x8256('0x6'),_0x8256('0x4'),_0x8256('0x3')),'defaultValue':_0x8256('0x6')},'description':{'type':Sequelize[_0x8256('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 06377e2..bc5dc40 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 _0xc80a=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','include','show','params','includeAll','find','catch','create','body','destroy','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xc80a,0x190));var _0xac80=function(_0x31ccca,_0x514be9){_0x31ccca=_0x31ccca-0x0;var _0x52dde1=_0xc80a[_0x31ccca];return _0x52dde1;};'use strict';var emlformat=require(_0xac80('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xac80('0x1'));var rp=require(_0xac80('0x2'));var moment=require(_0xac80('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac80('0x4'));var util=require(_0xac80('0x5'));var path=require(_0xac80('0x6'));var sox=require(_0xac80('0x7'));var csv=require(_0xac80('0x8'));var ejs=require(_0xac80('0x9'));var fs=require('fs');var fs_extra=require(_0xac80('0xa'));var _=require('lodash');var squel=require(_0xac80('0xb'));var crypto=require(_0xac80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xac80('0xd'));var toCsv=require(_0xac80('0x8'));var querystring=require(_0xac80('0xe'));var Papa=require('papaparse');var Redis=require(_0xac80('0xf'));var authService=require(_0xac80('0x10'));var qs=require(_0xac80('0x11'));var as=require(_0xac80('0x12'));var hardwareService=require(_0xac80('0x13'));var logger=require(_0xac80('0x14'))(_0xac80('0x15'));var utils=require(_0xac80('0x16'));var config=require(_0xac80('0x17'));var licenseUtil=require(_0xac80('0x18'));var db=require(_0xac80('0x19'))['db'];function respondWithStatusCode(_0x153812,_0x11e6a8){_0x11e6a8=_0x11e6a8||0xcc;return function(_0x3cf226){if(_0x3cf226){return _0x153812[_0xac80('0x1a')](_0x11e6a8);}return _0x153812[_0xac80('0x1b')](_0x11e6a8)[_0xac80('0x1c')]();};}function respondWithResult(_0x4af9e0,_0x28fff6){_0x28fff6=_0x28fff6||0xc8;return function(_0x7d721c){if(_0x7d721c){return _0x4af9e0[_0xac80('0x1b')](_0x28fff6)[_0xac80('0x1d')](_0x7d721c);}};}function respondWithFilteredResult(_0x261981,_0x472575){return function(_0xf709bb){if(_0xf709bb){var _0x59acbe=typeof _0x472575[_0xac80('0x1e')]===_0xac80('0x1f')&&typeof _0x472575[_0xac80('0x20')]===_0xac80('0x1f');var _0x3fba5c=_0xf709bb[_0xac80('0x21')];var _0x1366c0=_0x59acbe?0x0:_0x472575['offset'];var _0x1afea5=_0x59acbe?_0xf709bb[_0xac80('0x21')]:_0x472575[_0xac80('0x1e')]+_0x472575[_0xac80('0x20')];var _0x5a3fa6;if(_0x1afea5>=_0x3fba5c){_0x1afea5=_0x3fba5c;_0x5a3fa6=0xc8;}else{_0x5a3fa6=0xce;}_0x261981[_0xac80('0x1b')](_0x5a3fa6);return _0x261981[_0xac80('0x22')](_0xac80('0x23'),_0x1366c0+'-'+_0x1afea5+'/'+_0x3fba5c)['json'](_0xf709bb);}return null;};}function patchUpdates(_0x1c522d){return function(_0x3136e6){try{jsonpatch[_0xac80('0x24')](_0x3136e6,_0x1c522d,!![]);}catch(_0x288023){return BPromise[_0xac80('0x25')](_0x288023);}return _0x3136e6[_0xac80('0x26')]();};}function saveUpdates(_0x4315e1,_0x384979){return function(_0x5ae024){if(_0x5ae024){return _0x5ae024[_0xac80('0x27')](_0x4315e1)['then'](function(_0x5af18d){return _0x5af18d;});}return null;};}function removeEntity(_0x48dbd9,_0x485b12){return function(_0x177b6c){if(_0x177b6c){return _0x177b6c['destroy']()[_0xac80('0x28')](function(){_0x48dbd9['status'](0xcc)[_0xac80('0x1c')]();});}};}function handleEntityNotFound(_0x14ac7a,_0x11b5c6){return function(_0x4973b4){if(!_0x4973b4){_0x14ac7a[_0xac80('0x1a')](0x194);}return _0x4973b4;};}function handleError(_0x2eca1c,_0x23594){_0x23594=_0x23594||0x1f4;return function(_0x5b5c33){logger[_0xac80('0x29')](_0x5b5c33['stack']);if(_0x5b5c33[_0xac80('0x2a')]){delete _0x5b5c33[_0xac80('0x2a')];}_0x2eca1c[_0xac80('0x1b')](_0x23594)[_0xac80('0x2b')](_0x5b5c33);};}exports[_0xac80('0x2c')]=function(_0x86c84c,_0x4175b8){var _0x2821d8={},_0x561035={},_0x2866b1={'count':0x0,'rows':[]};var _0x512f4f=_[_0xac80('0x2d')](db['ZohoConfiguration'][_0xac80('0x2e')],function(_0xd96251){return{'name':_0xd96251['fieldName'],'type':_0xd96251[_0xac80('0x2f')][_0xac80('0x30')]};});_0x561035[_0xac80('0x31')]=_[_0xac80('0x2d')](_0x512f4f,_0xac80('0x2a'));_0x561035['query']=_[_0xac80('0x32')](_0x86c84c[_0xac80('0x33')]);_0x561035[_0xac80('0x34')]=_[_0xac80('0x35')](_0x561035[_0xac80('0x31')],_0x561035[_0xac80('0x33')]);_0x2821d8[_0xac80('0x36')]=_[_0xac80('0x35')](_0x561035[_0xac80('0x31')],qs[_0xac80('0x37')](_0x86c84c[_0xac80('0x33')]['fields']));_0x2821d8[_0xac80('0x36')]=_0x2821d8[_0xac80('0x36')][_0xac80('0x38')]?_0x2821d8['attributes']:_0x561035[_0xac80('0x31')];if(!_0x86c84c[_0xac80('0x33')]['hasOwnProperty'](_0xac80('0x39'))){_0x2821d8[_0xac80('0x20')]=qs[_0xac80('0x20')](_0x86c84c[_0xac80('0x33')][_0xac80('0x20')]);_0x2821d8[_0xac80('0x1e')]=qs[_0xac80('0x1e')](_0x86c84c[_0xac80('0x33')][_0xac80('0x1e')]);}_0x2821d8['order']=qs[_0xac80('0x3a')](_0x86c84c[_0xac80('0x33')][_0xac80('0x3a')]);_0x2821d8[_0xac80('0x3b')]=qs['filters'](_[_0xac80('0x3c')](_0x86c84c[_0xac80('0x33')],_0x561035[_0xac80('0x34')]),_0x512f4f);if(_0x86c84c[_0xac80('0x33')][_0xac80('0x3d')]){_0x2821d8[_0xac80('0x3b')]=_[_0xac80('0x3e')](_0x2821d8['where'],{'$or':_['map'](_0x512f4f,function(_0x13932e){if(_0x13932e['type']!==_0xac80('0x3f')){var _0x56e8ed={};_0x56e8ed[_0x13932e['name']]={'$like':'%'+_0x86c84c[_0xac80('0x33')][_0xac80('0x3d')]+'%'};return _0x56e8ed;}})});}_0x2821d8=_['merge']({},_0x2821d8,_0x86c84c[_0xac80('0x40')]);var _0x16a06d={'where':_0x2821d8['where']};return db[_0xac80('0x41')]['count'](_0x16a06d)[_0xac80('0x28')](function(_0x475c85){_0x2866b1['count']=_0x475c85;if(_0x86c84c[_0xac80('0x33')]['includeAll']){_0x2821d8[_0xac80('0x42')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x2821d8);})[_0xac80('0x28')](function(_0x47397c){_0x2866b1['rows']=_0x47397c;return _0x2866b1;})['then'](respondWithFilteredResult(_0x4175b8,_0x2821d8))['catch'](handleError(_0x4175b8,null));};exports[_0xac80('0x43')]=function(_0x59b5c4,_0x33f207){var _0x434c2e={'raw':![],'where':{'id':_0x59b5c4[_0xac80('0x44')]['id']}},_0x4761bb={};_0x4761bb[_0xac80('0x31')]=_[_0xac80('0x32')](db[_0xac80('0x41')]['rawAttributes']);_0x4761bb[_0xac80('0x33')]=_[_0xac80('0x32')](_0x59b5c4[_0xac80('0x33')]);_0x4761bb[_0xac80('0x34')]=_[_0xac80('0x35')](_0x4761bb[_0xac80('0x31')],_0x4761bb[_0xac80('0x33')]);_0x434c2e[_0xac80('0x36')]=_[_0xac80('0x35')](_0x4761bb[_0xac80('0x31')],qs[_0xac80('0x37')](_0x59b5c4[_0xac80('0x33')]['fields']));_0x434c2e[_0xac80('0x36')]=_0x434c2e[_0xac80('0x36')]['length']?_0x434c2e[_0xac80('0x36')]:_0x4761bb[_0xac80('0x31')];if(_0x59b5c4[_0xac80('0x33')][_0xac80('0x45')]){_0x434c2e[_0xac80('0x42')]=[{'all':!![]}];}_0x434c2e=_['merge']({},_0x434c2e,_0x59b5c4[_0xac80('0x40')]);return db[_0xac80('0x41')][_0xac80('0x46')](_0x434c2e)[_0xac80('0x28')](handleEntityNotFound(_0x33f207,null))[_0xac80('0x28')](respondWithResult(_0x33f207,null))[_0xac80('0x47')](handleError(_0x33f207,null));};exports['create']=function(_0x56116d,_0x472c37){return db[_0xac80('0x41')][_0xac80('0x48')](_0x56116d[_0xac80('0x49')],{})['then'](respondWithResult(_0x472c37,0xc9))['catch'](handleError(_0x472c37,null));};exports[_0xac80('0x27')]=function(_0x2c6565,_0x31f8e3){if(_0x2c6565[_0xac80('0x49')]['id']){delete _0x2c6565[_0xac80('0x49')]['id'];}return db[_0xac80('0x41')][_0xac80('0x46')]({'where':{'id':_0x2c6565[_0xac80('0x44')]['id']}})[_0xac80('0x28')](handleEntityNotFound(_0x31f8e3,null))[_0xac80('0x28')](saveUpdates(_0x2c6565[_0xac80('0x49')],null))[_0xac80('0x28')](respondWithResult(_0x31f8e3,null))[_0xac80('0x47')](handleError(_0x31f8e3,null));};exports[_0xac80('0x4a')]=function(_0x576289,_0xd4d253){return db[_0xac80('0x41')][_0xac80('0x46')]({'where':{'id':_0x576289[_0xac80('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4d253,null))[_0xac80('0x28')](removeEntity(_0xd4d253,null))[_0xac80('0x47')](handleError(_0xd4d253,null));};exports[_0xac80('0x4b')]=function(_0x3c851e,_0x5e4bfd,_0x5a4df5){var _0x2a2824={};var _0x5421dd={};var _0x59adbe;var _0x12612c;return db[_0xac80('0x41')][_0xac80('0x4c')]({'where':{'id':_0x3c851e['params']['id']}})['then'](handleEntityNotFound(_0x5e4bfd,null))[_0xac80('0x28')](function(_0x9ae505){if(_0x9ae505){_0x59adbe=_0x9ae505;_0x5421dd[_0xac80('0x31')]=_['keys'](db[_0xac80('0x4d')]['rawAttributes']);_0x5421dd[_0xac80('0x33')]=_['keys'](_0x3c851e[_0xac80('0x33')]);_0x5421dd[_0xac80('0x34')]=_[_0xac80('0x35')](_0x5421dd[_0xac80('0x31')],_0x5421dd[_0xac80('0x33')]);_0x2a2824[_0xac80('0x36')]=_[_0xac80('0x35')](_0x5421dd['model'],qs['fields'](_0x3c851e[_0xac80('0x33')][_0xac80('0x37')]));_0x2a2824[_0xac80('0x36')]=_0x2a2824[_0xac80('0x36')][_0xac80('0x38')]?_0x2a2824[_0xac80('0x36')]:_0x5421dd[_0xac80('0x31')];_0x2a2824['order']=qs['sort'](_0x3c851e[_0xac80('0x33')][_0xac80('0x3a')]);_0x2a2824['where']=qs['filters'](_[_0xac80('0x3c')](_0x3c851e['query'],_0x5421dd[_0xac80('0x34')]));if(_0x3c851e[_0xac80('0x33')]['filter']){_0x2a2824[_0xac80('0x3b')]=_[_0xac80('0x3e')](_0x2a2824[_0xac80('0x3b')],{'$or':_[_0xac80('0x2d')](_0x2a2824[_0xac80('0x36')],function(_0x344407){var _0xdaf7fa={};_0xdaf7fa[_0x344407]={'$like':'%'+_0x3c851e[_0xac80('0x33')][_0xac80('0x3d')]+'%'};return _0xdaf7fa;})});}_0x2a2824=_[_0xac80('0x3e')]({},_0x2a2824,_0x3c851e[_0xac80('0x40')]);return _0x59adbe[_0xac80('0x4b')](_0x2a2824);}})['then'](function(_0x114ee1){if(_0x114ee1){_0x12612c=_0x114ee1[_0xac80('0x38')];if(!_0x3c851e[_0xac80('0x33')][_0xac80('0x4e')](_0xac80('0x39'))){_0x2a2824[_0xac80('0x20')]=qs[_0xac80('0x20')](_0x3c851e[_0xac80('0x33')]['limit']);_0x2a2824[_0xac80('0x1e')]=qs[_0xac80('0x1e')](_0x3c851e[_0xac80('0x33')][_0xac80('0x1e')]);}return _0x59adbe[_0xac80('0x4b')](_0x2a2824);}})['then'](function(_0x8aa2ca){if(_0x8aa2ca){return _0x8aa2ca?{'count':_0x12612c,'rows':_0x8aa2ca}:null;}})[_0xac80('0x28')](respondWithResult(_0x5e4bfd,null))[_0xac80('0x47')](handleError(_0x5e4bfd,null));};exports[_0xac80('0x4f')]=function(_0x1362a3,_0x347fa5,_0x8ddd16){var _0x5eea62={};var _0x2699dc={};var _0x38b1fc;var _0x5e27e4;return db[_0xac80('0x41')][_0xac80('0x4c')]({'where':{'id':_0x1362a3[_0xac80('0x44')]['id']}})[_0xac80('0x28')](handleEntityNotFound(_0x347fa5,null))['then'](function(_0x4f6b4d){if(_0x4f6b4d){_0x38b1fc=_0x4f6b4d;_0x2699dc[_0xac80('0x31')]=_[_0xac80('0x32')](db[_0xac80('0x4d')][_0xac80('0x2e')]);_0x2699dc[_0xac80('0x33')]=_[_0xac80('0x32')](_0x1362a3[_0xac80('0x33')]);_0x2699dc[_0xac80('0x34')]=_[_0xac80('0x35')](_0x2699dc[_0xac80('0x31')],_0x2699dc[_0xac80('0x33')]);_0x5eea62[_0xac80('0x36')]=_['intersection'](_0x2699dc[_0xac80('0x31')],qs[_0xac80('0x37')](_0x1362a3['query']['fields']));_0x5eea62[_0xac80('0x36')]=_0x5eea62[_0xac80('0x36')][_0xac80('0x38')]?_0x5eea62[_0xac80('0x36')]:_0x2699dc['model'];_0x5eea62['order']=qs[_0xac80('0x3a')](_0x1362a3[_0xac80('0x33')][_0xac80('0x3a')]);_0x5eea62[_0xac80('0x3b')]=qs['filters'](_[_0xac80('0x3c')](_0x1362a3['query'],_0x2699dc['filters']));if(_0x1362a3[_0xac80('0x33')]['filter']){_0x5eea62[_0xac80('0x3b')]=_[_0xac80('0x3e')](_0x5eea62['where'],{'$or':_['map'](_0x5eea62[_0xac80('0x36')],function(_0x5288e2){var _0x42bc29={};_0x42bc29[_0x5288e2]={'$like':'%'+_0x1362a3[_0xac80('0x33')][_0xac80('0x3d')]+'%'};return _0x42bc29;})});}_0x5eea62=_[_0xac80('0x3e')]({},_0x5eea62,_0x1362a3[_0xac80('0x40')]);return _0x38b1fc[_0xac80('0x4f')](_0x5eea62);}})[_0xac80('0x28')](function(_0x22a6b2){if(_0x22a6b2){_0x5e27e4=_0x22a6b2[_0xac80('0x38')];if(!_0x1362a3[_0xac80('0x33')][_0xac80('0x4e')](_0xac80('0x39'))){_0x5eea62[_0xac80('0x20')]=qs[_0xac80('0x20')](_0x1362a3[_0xac80('0x33')][_0xac80('0x20')]);_0x5eea62[_0xac80('0x1e')]=qs[_0xac80('0x1e')](_0x1362a3[_0xac80('0x33')][_0xac80('0x1e')]);}return _0x38b1fc[_0xac80('0x4f')](_0x5eea62);}})[_0xac80('0x28')](function(_0x1af108){if(_0x1af108){return _0x1af108?{'count':_0x5e27e4,'rows':_0x1af108}:null;}})[_0xac80('0x28')](respondWithResult(_0x347fa5,null))[_0xac80('0x47')](handleError(_0x347fa5,null));};exports[_0xac80('0x50')]=function(_0x7c1f9c,_0x346224,_0x220f0d){var _0x2f770c={};var _0x13f862={};var _0x4f3c4a;var _0x5c482e;return db['ZohoConfiguration'][_0xac80('0x4c')]({'where':{'id':_0x7c1f9c[_0xac80('0x44')]['id']}})[_0xac80('0x28')](handleEntityNotFound(_0x346224,null))['then'](function(_0x4787f1){if(_0x4787f1){_0x4f3c4a=_0x4787f1;_0x13f862['model']=_[_0xac80('0x32')](db[_0xac80('0x4d')]['rawAttributes']);_0x13f862[_0xac80('0x33')]=_[_0xac80('0x32')](_0x7c1f9c[_0xac80('0x33')]);_0x13f862[_0xac80('0x34')]=_[_0xac80('0x35')](_0x13f862[_0xac80('0x31')],_0x13f862[_0xac80('0x33')]);_0x2f770c[_0xac80('0x36')]=_[_0xac80('0x35')](_0x13f862[_0xac80('0x31')],qs[_0xac80('0x37')](_0x7c1f9c[_0xac80('0x33')]['fields']));_0x2f770c[_0xac80('0x36')]=_0x2f770c[_0xac80('0x36')][_0xac80('0x38')]?_0x2f770c[_0xac80('0x36')]:_0x13f862[_0xac80('0x31')];_0x2f770c['order']=qs[_0xac80('0x3a')](_0x7c1f9c[_0xac80('0x33')]['sort']);_0x2f770c[_0xac80('0x3b')]=qs['filters'](_[_0xac80('0x3c')](_0x7c1f9c['query'],_0x13f862[_0xac80('0x34')]));if(_0x7c1f9c['query'][_0xac80('0x3d')]){_0x2f770c[_0xac80('0x3b')]=_['merge'](_0x2f770c[_0xac80('0x3b')],{'$or':_[_0xac80('0x2d')](_0x2f770c[_0xac80('0x36')],function(_0x39647c){var _0x45b22d={};_0x45b22d[_0x39647c]={'$like':'%'+_0x7c1f9c[_0xac80('0x33')][_0xac80('0x3d')]+'%'};return _0x45b22d;})});}_0x2f770c=_[_0xac80('0x3e')]({},_0x2f770c,_0x7c1f9c[_0xac80('0x40')]);return _0x4f3c4a[_0xac80('0x50')](_0x2f770c);}})[_0xac80('0x28')](function(_0x303bcf){if(_0x303bcf){_0x5c482e=_0x303bcf['length'];if(!_0x7c1f9c[_0xac80('0x33')]['hasOwnProperty'](_0xac80('0x39'))){_0x2f770c['limit']=qs['limit'](_0x7c1f9c[_0xac80('0x33')][_0xac80('0x20')]);_0x2f770c[_0xac80('0x1e')]=qs[_0xac80('0x1e')](_0x7c1f9c[_0xac80('0x33')][_0xac80('0x1e')]);}return _0x4f3c4a[_0xac80('0x50')](_0x2f770c);}})[_0xac80('0x28')](function(_0x3fd3b8){if(_0x3fd3b8){return _0x3fd3b8?{'count':_0x5c482e,'rows':_0x3fd3b8}:null;}})[_0xac80('0x28')](respondWithResult(_0x346224,null))['catch'](handleError(_0x346224,null));}; \ No newline at end of file +var _0xeedc=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x26b30f,_0x456ed6){var _0x15d9f3=function(_0x1e010d){while(--_0x1e010d){_0x26b30f['push'](_0x26b30f['shift']());}};_0x15d9f3(++_0x456ed6);}(_0xeedc,0xa1));var _0xceed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeedc[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xceed('0x0'));var rimraf=require(_0xceed('0x1'));var zipdir=require(_0xceed('0x2'));var jsonpatch=require(_0xceed('0x3'));var rp=require(_0xceed('0x4'));var moment=require(_0xceed('0x5'));var BPromise=require(_0xceed('0x6'));var Mustache=require(_0xceed('0x7'));var util=require(_0xceed('0x8'));var path=require(_0xceed('0x9'));var sox=require('sox');var csv=require(_0xceed('0xa'));var ejs=require(_0xceed('0xb'));var fs=require('fs');var fs_extra=require(_0xceed('0xc'));var _=require(_0xceed('0xd'));var squel=require(_0xceed('0xe'));var crypto=require(_0xceed('0xf'));var jsforce=require(_0xceed('0x10'));var deskjs=require(_0xceed('0x11'));var toCsv=require(_0xceed('0xa'));var querystring=require(_0xceed('0x12'));var Papa=require('papaparse');var Redis=require(_0xceed('0x13'));var authService=require(_0xceed('0x14'));var qs=require(_0xceed('0x15'));var as=require(_0xceed('0x16'));var hardwareService=require(_0xceed('0x17'));var logger=require(_0xceed('0x18'))(_0xceed('0x19'));var utils=require(_0xceed('0x1a'));var config=require(_0xceed('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xceed('0x1c'))['db'];function respondWithStatusCode(_0x45cc2f,_0x476652){_0x476652=_0x476652||0xcc;return function(_0x2e5dea){if(_0x2e5dea){return _0x45cc2f[_0xceed('0x1d')](_0x476652);}return _0x45cc2f['status'](_0x476652)[_0xceed('0x1e')]();};}function respondWithResult(_0x3e23cb,_0x2cce5e){_0x2cce5e=_0x2cce5e||0xc8;return function(_0x3660aa){if(_0x3660aa){return _0x3e23cb['status'](_0x2cce5e)[_0xceed('0x1f')](_0x3660aa);}};}function respondWithFilteredResult(_0x47d635,_0xf78a9){return function(_0x448e0c){if(_0x448e0c){var _0x11172c=typeof _0xf78a9[_0xceed('0x20')]===_0xceed('0x21')&&typeof _0xf78a9[_0xceed('0x22')]==='undefined';var _0x3b910f=_0x448e0c[_0xceed('0x23')];var _0x2ab566=_0x11172c?0x0:_0xf78a9[_0xceed('0x20')];var _0x1fdd62=_0x11172c?_0x448e0c[_0xceed('0x23')]:_0xf78a9[_0xceed('0x20')]+_0xf78a9[_0xceed('0x22')];var _0x4bf50f;if(_0x1fdd62>=_0x3b910f){_0x1fdd62=_0x3b910f;_0x4bf50f=0xc8;}else{_0x4bf50f=0xce;}_0x47d635[_0xceed('0x24')](_0x4bf50f);return _0x47d635['set'](_0xceed('0x25'),_0x2ab566+'-'+_0x1fdd62+'/'+_0x3b910f)[_0xceed('0x1f')](_0x448e0c);}return null;};}function patchUpdates(_0x591ed9){return function(_0x9ee3ee){try{jsonpatch[_0xceed('0x26')](_0x9ee3ee,_0x591ed9,!![]);}catch(_0x20d615){return BPromise[_0xceed('0x27')](_0x20d615);}return _0x9ee3ee[_0xceed('0x28')]();};}function saveUpdates(_0x361021,_0x32d71e){return function(_0x56ec0c){if(_0x56ec0c){return _0x56ec0c[_0xceed('0x29')](_0x361021)[_0xceed('0x2a')](function(_0x5dfe03){return _0x5dfe03;});}return null;};}function removeEntity(_0x198b54,_0x52dcce){return function(_0x5843cc){if(_0x5843cc){return _0x5843cc[_0xceed('0x2b')]()['then'](function(){_0x198b54[_0xceed('0x24')](0xcc)[_0xceed('0x1e')]();});}};}function handleEntityNotFound(_0x140732,_0x5d73e8){return function(_0x40f947){if(!_0x40f947){_0x140732['sendStatus'](0x194);}return _0x40f947;};}function handleError(_0x850bdd,_0x51c0c0){_0x51c0c0=_0x51c0c0||0x1f4;return function(_0x3711ba){logger['error'](_0x3711ba[_0xceed('0x2c')]);if(_0x3711ba[_0xceed('0x2d')]){delete _0x3711ba['name'];}_0x850bdd['status'](_0x51c0c0)['send'](_0x3711ba);};}exports[_0xceed('0x2e')]=function(_0xef9fbe,_0x395e3f){var _0x5859c0={},_0x124f65={},_0x1cd201={'count':0x0,'rows':[]};var _0x359199=_[_0xceed('0x2f')](db[_0xceed('0x30')][_0xceed('0x31')],function(_0x16f955){return{'name':_0x16f955[_0xceed('0x32')],'type':_0x16f955['type']['key']};});_0x124f65[_0xceed('0x33')]=_[_0xceed('0x2f')](_0x359199,'name');_0x124f65['query']=_[_0xceed('0x34')](_0xef9fbe[_0xceed('0x35')]);_0x124f65[_0xceed('0x36')]=_['intersection'](_0x124f65[_0xceed('0x33')],_0x124f65['query']);_0x5859c0[_0xceed('0x37')]=_[_0xceed('0x38')](_0x124f65[_0xceed('0x33')],qs[_0xceed('0x39')](_0xef9fbe[_0xceed('0x35')][_0xceed('0x39')]));_0x5859c0['attributes']=_0x5859c0[_0xceed('0x37')][_0xceed('0x3a')]?_0x5859c0[_0xceed('0x37')]:_0x124f65['model'];if(!_0xef9fbe['query'][_0xceed('0x3b')](_0xceed('0x3c'))){_0x5859c0[_0xceed('0x22')]=qs[_0xceed('0x22')](_0xef9fbe[_0xceed('0x35')]['limit']);_0x5859c0['offset']=qs['offset'](_0xef9fbe[_0xceed('0x35')][_0xceed('0x20')]);}_0x5859c0[_0xceed('0x3d')]=qs[_0xceed('0x3e')](_0xef9fbe[_0xceed('0x35')][_0xceed('0x3e')]);_0x5859c0[_0xceed('0x3f')]=qs[_0xceed('0x36')](_[_0xceed('0x40')](_0xef9fbe[_0xceed('0x35')],_0x124f65[_0xceed('0x36')]),_0x359199);if(_0xef9fbe['query'][_0xceed('0x41')]){_0x5859c0[_0xceed('0x3f')]=_['merge'](_0x5859c0[_0xceed('0x3f')],{'$or':_[_0xceed('0x2f')](_0x359199,function(_0x293346){if(_0x293346[_0xceed('0x42')]!=='VIRTUAL'){var _0x8e907d={};_0x8e907d[_0x293346['name']]={'$like':'%'+_0xef9fbe['query'][_0xceed('0x41')]+'%'};return _0x8e907d;}})});}_0x5859c0=_[_0xceed('0x43')]({},_0x5859c0,_0xef9fbe[_0xceed('0x44')]);var _0x55b83c={'where':_0x5859c0[_0xceed('0x3f')]};return db['ZohoConfiguration']['count'](_0x55b83c)[_0xceed('0x2a')](function(_0x32f664){_0x1cd201[_0xceed('0x23')]=_0x32f664;if(_0xef9fbe[_0xceed('0x35')][_0xceed('0x45')]){_0x5859c0[_0xceed('0x46')]=[{'all':!![]}];}return db[_0xceed('0x30')][_0xceed('0x47')](_0x5859c0);})['then'](function(_0x117182){_0x1cd201[_0xceed('0x48')]=_0x117182;return _0x1cd201;})[_0xceed('0x2a')](respondWithFilteredResult(_0x395e3f,_0x5859c0))['catch'](handleError(_0x395e3f,null));};exports[_0xceed('0x49')]=function(_0x73efae,_0x320e09){var _0x2f1b6a={'raw':![],'where':{'id':_0x73efae[_0xceed('0x4a')]['id']}},_0x5078b6={};_0x5078b6['model']=_[_0xceed('0x34')](db[_0xceed('0x30')][_0xceed('0x31')]);_0x5078b6[_0xceed('0x35')]=_['keys'](_0x73efae[_0xceed('0x35')]);_0x5078b6[_0xceed('0x36')]=_[_0xceed('0x38')](_0x5078b6[_0xceed('0x33')],_0x5078b6['query']);_0x2f1b6a[_0xceed('0x37')]=_[_0xceed('0x38')](_0x5078b6['model'],qs[_0xceed('0x39')](_0x73efae['query']['fields']));_0x2f1b6a[_0xceed('0x37')]=_0x2f1b6a[_0xceed('0x37')]['length']?_0x2f1b6a[_0xceed('0x37')]:_0x5078b6[_0xceed('0x33')];if(_0x73efae[_0xceed('0x35')][_0xceed('0x45')]){_0x2f1b6a['include']=[{'all':!![]}];}_0x2f1b6a=_[_0xceed('0x43')]({},_0x2f1b6a,_0x73efae[_0xceed('0x44')]);return db[_0xceed('0x30')][_0xceed('0x4b')](_0x2f1b6a)['then'](handleEntityNotFound(_0x320e09,null))['then'](respondWithResult(_0x320e09,null))['catch'](handleError(_0x320e09,null));};exports[_0xceed('0x4c')]=function(_0x37243b,_0x50c6b3){return db[_0xceed('0x30')][_0xceed('0x4c')](_0x37243b['body'],{})['then'](respondWithResult(_0x50c6b3,0xc9))[_0xceed('0x4d')](handleError(_0x50c6b3,null));};exports[_0xceed('0x29')]=function(_0x525108,_0x216e24){if(_0x525108[_0xceed('0x4e')]['id']){delete _0x525108[_0xceed('0x4e')]['id'];}return db[_0xceed('0x30')]['find']({'where':{'id':_0x525108['params']['id']}})['then'](handleEntityNotFound(_0x216e24,null))[_0xceed('0x2a')](saveUpdates(_0x525108[_0xceed('0x4e')],null))[_0xceed('0x2a')](respondWithResult(_0x216e24,null))[_0xceed('0x4d')](handleError(_0x216e24,null));};exports[_0xceed('0x2b')]=function(_0x44b354,_0x1a2953){return db[_0xceed('0x30')][_0xceed('0x4b')]({'where':{'id':_0x44b354[_0xceed('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a2953,null))[_0xceed('0x2a')](removeEntity(_0x1a2953,null))[_0xceed('0x4d')](handleError(_0x1a2953,null));};exports[_0xceed('0x4f')]=function(_0x5e7510,_0xb3d688,_0x5db307){var _0x4da2e9={};var _0x443db7={};var _0x208184;var _0x51b4ff;return db[_0xceed('0x30')][_0xceed('0x50')]({'where':{'id':_0x5e7510[_0xceed('0x4a')]['id']}})[_0xceed('0x2a')](handleEntityNotFound(_0xb3d688,null))[_0xceed('0x2a')](function(_0x2e3f78){if(_0x2e3f78){_0x208184=_0x2e3f78;_0x443db7[_0xceed('0x33')]=_[_0xceed('0x34')](db[_0xceed('0x51')][_0xceed('0x31')]);_0x443db7[_0xceed('0x35')]=_[_0xceed('0x34')](_0x5e7510[_0xceed('0x35')]);_0x443db7[_0xceed('0x36')]=_[_0xceed('0x38')](_0x443db7[_0xceed('0x33')],_0x443db7[_0xceed('0x35')]);_0x4da2e9['attributes']=_[_0xceed('0x38')](_0x443db7[_0xceed('0x33')],qs[_0xceed('0x39')](_0x5e7510[_0xceed('0x35')]['fields']));_0x4da2e9[_0xceed('0x37')]=_0x4da2e9[_0xceed('0x37')][_0xceed('0x3a')]?_0x4da2e9[_0xceed('0x37')]:_0x443db7[_0xceed('0x33')];_0x4da2e9['order']=qs[_0xceed('0x3e')](_0x5e7510['query'][_0xceed('0x3e')]);_0x4da2e9[_0xceed('0x3f')]=qs[_0xceed('0x36')](_[_0xceed('0x40')](_0x5e7510[_0xceed('0x35')],_0x443db7[_0xceed('0x36')]));if(_0x5e7510[_0xceed('0x35')][_0xceed('0x41')]){_0x4da2e9[_0xceed('0x3f')]=_[_0xceed('0x43')](_0x4da2e9[_0xceed('0x3f')],{'$or':_[_0xceed('0x2f')](_0x4da2e9[_0xceed('0x37')],function(_0x217555){var _0x14da2={};_0x14da2[_0x217555]={'$like':'%'+_0x5e7510[_0xceed('0x35')][_0xceed('0x41')]+'%'};return _0x14da2;})});}_0x4da2e9=_[_0xceed('0x43')]({},_0x4da2e9,_0x5e7510[_0xceed('0x44')]);return _0x208184[_0xceed('0x4f')](_0x4da2e9);}})[_0xceed('0x2a')](function(_0x45915c){if(_0x45915c){_0x51b4ff=_0x45915c[_0xceed('0x3a')];if(!_0x5e7510['query'][_0xceed('0x3b')]('nolimit')){_0x4da2e9['limit']=qs[_0xceed('0x22')](_0x5e7510[_0xceed('0x35')][_0xceed('0x22')]);_0x4da2e9['offset']=qs[_0xceed('0x20')](_0x5e7510[_0xceed('0x35')]['offset']);}return _0x208184[_0xceed('0x4f')](_0x4da2e9);}})['then'](function(_0x513cb3){if(_0x513cb3){return _0x513cb3?{'count':_0x51b4ff,'rows':_0x513cb3}:null;}})[_0xceed('0x2a')](respondWithResult(_0xb3d688,null))[_0xceed('0x4d')](handleError(_0xb3d688,null));};exports[_0xceed('0x52')]=function(_0x5e771b,_0x3bbc05,_0x252ae6){var _0x3e7220={};var _0x493dc5={};var _0x3cf8e4;var _0x21ef86;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5e771b[_0xceed('0x4a')]['id']}})[_0xceed('0x2a')](handleEntityNotFound(_0x3bbc05,null))['then'](function(_0x7ebf3e){if(_0x7ebf3e){_0x3cf8e4=_0x7ebf3e;_0x493dc5['model']=_['keys'](db[_0xceed('0x51')]['rawAttributes']);_0x493dc5[_0xceed('0x35')]=_[_0xceed('0x34')](_0x5e771b[_0xceed('0x35')]);_0x493dc5['filters']=_[_0xceed('0x38')](_0x493dc5[_0xceed('0x33')],_0x493dc5['query']);_0x3e7220[_0xceed('0x37')]=_[_0xceed('0x38')](_0x493dc5[_0xceed('0x33')],qs['fields'](_0x5e771b[_0xceed('0x35')][_0xceed('0x39')]));_0x3e7220[_0xceed('0x37')]=_0x3e7220[_0xceed('0x37')]['length']?_0x3e7220[_0xceed('0x37')]:_0x493dc5[_0xceed('0x33')];_0x3e7220[_0xceed('0x3d')]=qs['sort'](_0x5e771b[_0xceed('0x35')][_0xceed('0x3e')]);_0x3e7220[_0xceed('0x3f')]=qs[_0xceed('0x36')](_[_0xceed('0x40')](_0x5e771b['query'],_0x493dc5[_0xceed('0x36')]));if(_0x5e771b[_0xceed('0x35')][_0xceed('0x41')]){_0x3e7220[_0xceed('0x3f')]=_[_0xceed('0x43')](_0x3e7220['where'],{'$or':_[_0xceed('0x2f')](_0x3e7220['attributes'],function(_0x37b779){var _0x2edb42={};_0x2edb42[_0x37b779]={'$like':'%'+_0x5e771b[_0xceed('0x35')][_0xceed('0x41')]+'%'};return _0x2edb42;})});}_0x3e7220=_[_0xceed('0x43')]({},_0x3e7220,_0x5e771b['options']);return _0x3cf8e4['getSubjects'](_0x3e7220);}})[_0xceed('0x2a')](function(_0x5df84d){if(_0x5df84d){_0x21ef86=_0x5df84d['length'];if(!_0x5e771b[_0xceed('0x35')]['hasOwnProperty'](_0xceed('0x3c'))){_0x3e7220[_0xceed('0x22')]=qs['limit'](_0x5e771b['query'][_0xceed('0x22')]);_0x3e7220[_0xceed('0x20')]=qs['offset'](_0x5e771b[_0xceed('0x35')]['offset']);}return _0x3cf8e4['getSubjects'](_0x3e7220);}})[_0xceed('0x2a')](function(_0x3d3e7e){if(_0x3d3e7e){return _0x3d3e7e?{'count':_0x21ef86,'rows':_0x3d3e7e}:null;}})[_0xceed('0x2a')](respondWithResult(_0x3bbc05,null))[_0xceed('0x4d')](handleError(_0x3bbc05,null));};exports[_0xceed('0x53')]=function(_0x562c87,_0x4052e7,_0x23796f){var _0x4fee30={};var _0x941332={};var _0x4bf4f7;var _0x1085a0;return db[_0xceed('0x30')]['findOne']({'where':{'id':_0x562c87[_0xceed('0x4a')]['id']}})[_0xceed('0x2a')](handleEntityNotFound(_0x4052e7,null))[_0xceed('0x2a')](function(_0x5add48){if(_0x5add48){_0x4bf4f7=_0x5add48;_0x941332[_0xceed('0x33')]=_[_0xceed('0x34')](db[_0xceed('0x51')][_0xceed('0x31')]);_0x941332['query']=_[_0xceed('0x34')](_0x562c87['query']);_0x941332['filters']=_['intersection'](_0x941332['model'],_0x941332['query']);_0x4fee30[_0xceed('0x37')]=_[_0xceed('0x38')](_0x941332['model'],qs[_0xceed('0x39')](_0x562c87[_0xceed('0x35')][_0xceed('0x39')]));_0x4fee30[_0xceed('0x37')]=_0x4fee30[_0xceed('0x37')][_0xceed('0x3a')]?_0x4fee30[_0xceed('0x37')]:_0x941332[_0xceed('0x33')];_0x4fee30[_0xceed('0x3d')]=qs[_0xceed('0x3e')](_0x562c87[_0xceed('0x35')][_0xceed('0x3e')]);_0x4fee30[_0xceed('0x3f')]=qs['filters'](_[_0xceed('0x40')](_0x562c87['query'],_0x941332[_0xceed('0x36')]));if(_0x562c87['query'][_0xceed('0x41')]){_0x4fee30['where']=_[_0xceed('0x43')](_0x4fee30['where'],{'$or':_[_0xceed('0x2f')](_0x4fee30[_0xceed('0x37')],function(_0x2dd7dd){var _0x1cba7d={};_0x1cba7d[_0x2dd7dd]={'$like':'%'+_0x562c87[_0xceed('0x35')][_0xceed('0x41')]+'%'};return _0x1cba7d;})});}_0x4fee30=_[_0xceed('0x43')]({},_0x4fee30,_0x562c87[_0xceed('0x44')]);return _0x4bf4f7[_0xceed('0x53')](_0x4fee30);}})['then'](function(_0x177b88){if(_0x177b88){_0x1085a0=_0x177b88[_0xceed('0x3a')];if(!_0x562c87[_0xceed('0x35')]['hasOwnProperty'](_0xceed('0x3c'))){_0x4fee30['limit']=qs[_0xceed('0x22')](_0x562c87[_0xceed('0x35')][_0xceed('0x22')]);_0x4fee30[_0xceed('0x20')]=qs['offset'](_0x562c87[_0xceed('0x35')]['offset']);}return _0x4bf4f7['getDescriptions'](_0x4fee30);}})[_0xceed('0x2a')](function(_0xe9e955){if(_0xe9e955){return _0xe9e955?{'count':_0x1085a0,'rows':_0xe9e955}:null;}})[_0xceed('0x2a')](respondWithResult(_0x4052e7,null))[_0xceed('0x4d')](handleError(_0x4052e7,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index f850c12..cab6679 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 _0x283f=['int_zoho_configurations','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x570e02,_0x22ba0d){var _0x1015f9=function(_0x3027ea){while(--_0x3027ea){_0x570e02['push'](_0x570e02['shift']());}};_0x1015f9(++_0x22ba0d);}(_0x283f,0x65));var _0xf283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf283('0x0'));var logger=require(_0xf283('0x1'))(_0xf283('0x2'));var moment=require('moment');var BPromise=require(_0xf283('0x3'));var rp=require(_0xf283('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf283('0x5'));var attributes=require(_0xf283('0x6'));module[_0xf283('0x7')]=function(_0x334989,_0x475f05){return _0x334989[_0xf283('0x8')]('ZohoConfiguration',attributes,{'tableName':_0xf283('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c5=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','moment'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x94c5,0x105));var _0x594c=function(_0x4833b0,_0x556e8a){_0x4833b0=_0x4833b0-0x0;var _0x22e93b=_0x94c5[_0x4833b0];return _0x22e93b;};'use strict';var _=require('lodash');var util=require(_0x594c('0x0'));var logger=require(_0x594c('0x1'))('api');var moment=require(_0x594c('0x2'));var BPromise=require(_0x594c('0x3'));var rp=require(_0x594c('0x4'));var fs=require('fs');var path=require(_0x594c('0x5'));var rimraf=require(_0x594c('0x6'));var config=require(_0x594c('0x7'));var attributes=require(_0x594c('0x8'));module[_0x594c('0x9')]=function(_0x532709,_0x3e988e){return _0x532709['define'](_0x594c('0xa'),attributes,{'tableName':_0x594c('0xb'),'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 04e1f01..a5aa17b 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 _0x6bc0=['../../config/utils','../../config/logger','rpc','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5237b7,_0x1ec127){var _0x8e7cf5=function(_0x5f16e5){while(--_0x5f16e5){_0x5237b7['push'](_0x5237b7['shift']());}};_0x8e7cf5(++_0x1ec127);}(_0x6bc0,0x120));var _0x06bc=function(_0x128623,_0x2a0aa7){_0x128623=_0x128623-0x0;var _0x3e3be1=_0x6bc0[_0x128623];return _0x3e3be1;};'use strict';var _=require(_0x06bc('0x0'));var util=require(_0x06bc('0x1'));var moment=require(_0x06bc('0x2'));var BPromise=require(_0x06bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06bc('0x4'));var db=require(_0x06bc('0x5'))['db'];var utils=require(_0x06bc('0x6'));var logger=require(_0x06bc('0x7'))(_0x06bc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44d96e,_0x26cb93,_0x44995e){return new BPromise(function(_0x4cd029,_0x5ae02e){return client['request'](_0x44d96e,_0x44995e)[_0x06bc('0x9')](function(_0x2dd4b2){logger[_0x06bc('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x26cb93,'request\x20sent');logger[_0x06bc('0xb')](_0x06bc('0xc'),_0x26cb93,'request\x20sent',JSON[_0x06bc('0xd')](_0x2dd4b2));if(_0x2dd4b2[_0x06bc('0xe')]){if(_0x2dd4b2[_0x06bc('0xe')][_0x06bc('0xf')]===0x1f4){logger[_0x06bc('0xe')](_0x06bc('0x10'),_0x26cb93,_0x2dd4b2[_0x06bc('0xe')][_0x06bc('0x11')]);return _0x5ae02e(_0x2dd4b2[_0x06bc('0xe')][_0x06bc('0x11')]);}logger[_0x06bc('0xe')](_0x06bc('0x10'),_0x26cb93,_0x2dd4b2[_0x06bc('0xe')][_0x06bc('0x11')]);return _0x4cd029(_0x2dd4b2[_0x06bc('0xe')][_0x06bc('0x11')]);}else{logger[_0x06bc('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x26cb93,_0x06bc('0x12'));_0x4cd029(_0x2dd4b2[_0x06bc('0x13')][_0x06bc('0x11')]);}})[_0x06bc('0x14')](function(_0x5657e7){logger[_0x06bc('0xe')](_0x06bc('0x10'),_0x26cb93,_0x5657e7);_0x5ae02e(_0x5657e7);});});} \ No newline at end of file +var _0x5fec=['util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x190dbd,_0x24a507){var _0x868d27=function(_0x253c6f){while(--_0x253c6f){_0x190dbd['push'](_0x190dbd['shift']());}};_0x868d27(++_0x24a507);}(_0x5fec,0x133));var _0xc5fe=function(_0xa1ed99,_0x4d60d0){_0xa1ed99=_0xa1ed99-0x0;var _0x5b0a6a=_0x5fec[_0xa1ed99];return _0x5b0a6a;};'use strict';var _=require(_0xc5fe('0x0'));var util=require(_0xc5fe('0x1'));var moment=require(_0xc5fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5fe('0x4'));var logger=require('../../config/logger')(_0xc5fe('0x5'));var config=require('../../config/environment');var jayson=require(_0xc5fe('0x6'));var client=jayson[_0xc5fe('0x7')][_0xc5fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x581be7,_0x10673c,_0xa6eb19){return new BPromise(function(_0x58aa41,_0x1834a0){return client[_0xc5fe('0x9')](_0x581be7,_0xa6eb19)[_0xc5fe('0xa')](function(_0x28e553){logger[_0xc5fe('0xb')](_0xc5fe('0xc'),_0x10673c,_0xc5fe('0xd'));logger[_0xc5fe('0xe')](_0xc5fe('0xf'),_0x10673c,_0xc5fe('0xd'),JSON[_0xc5fe('0x10')](_0x28e553));if(_0x28e553[_0xc5fe('0x11')]){if(_0x28e553[_0xc5fe('0x11')][_0xc5fe('0x12')]===0x1f4){logger[_0xc5fe('0x11')](_0xc5fe('0xc'),_0x10673c,_0x28e553['error'][_0xc5fe('0x13')]);return _0x1834a0(_0x28e553[_0xc5fe('0x11')][_0xc5fe('0x13')]);}logger[_0xc5fe('0x11')](_0xc5fe('0xc'),_0x10673c,_0x28e553[_0xc5fe('0x11')][_0xc5fe('0x13')]);return _0x58aa41(_0x28e553['error'][_0xc5fe('0x13')]);}else{logger[_0xc5fe('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x10673c,_0xc5fe('0xd'));_0x58aa41(_0x28e553[_0xc5fe('0x14')]['message']);}})[_0xc5fe('0x15')](function(_0x284647){logger[_0xc5fe('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x10673c,_0x284647);_0x1834a0(_0x284647);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e318aef..6cd449e 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 _0x0c67=['put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x0c67,0x1ba));var _0x70c6=function(_0x11e3f1,_0x5ae68a){_0x11e3f1=_0x11e3f1-0x0;var _0x32daf0=_0x0c67[_0x11e3f1];return _0x32daf0;};'use strict';var multer=require('multer');var util=require(_0x70c6('0x0'));var path=require(_0x70c6('0x1'));var timeout=require('connect-timeout');var express=require(_0x70c6('0x2'));var router=express[_0x70c6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x70c6('0x4'));var interaction=require(_0x70c6('0x5'));var config=require('../../config/environment');var controller=require(_0x70c6('0x6'));router[_0x70c6('0x7')]('/',auth[_0x70c6('0x8')](),controller[_0x70c6('0x9')]);router[_0x70c6('0x7')](_0x70c6('0xa'),auth['isAuthenticated'](),controller[_0x70c6('0xb')]);router[_0x70c6('0xc')]('/',auth['isAuthenticated'](),controller[_0x70c6('0xd')]);router[_0x70c6('0xe')](_0x70c6('0xa'),auth[_0x70c6('0x8')](),controller[_0x70c6('0xf')]);router[_0x70c6('0x10')](_0x70c6('0xa'),auth[_0x70c6('0x8')](),controller[_0x70c6('0x11')]);module[_0x70c6('0x12')]=router; \ No newline at end of file +var _0xda9c=['./intZohoField.controller','get','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e0a4e,_0x3225dc){var _0x2b0d8d=function(_0x32944a){while(--_0x32944a){_0x4e0a4e['push'](_0x4e0a4e['shift']());}};_0x2b0d8d(++_0x3225dc);}(_0xda9c,0x7b));var _0xcda9=function(_0x42c4a6,_0x557487){_0x42c4a6=_0x42c4a6-0x0;var _0x5cdde6=_0xda9c[_0x42c4a6];return _0x5cdde6;};'use strict';var multer=require(_0xcda9('0x0'));var util=require(_0xcda9('0x1'));var path=require(_0xcda9('0x2'));var timeout=require(_0xcda9('0x3'));var express=require(_0xcda9('0x4'));var router=express[_0xcda9('0x5')]();var fs_extra=require(_0xcda9('0x6'));var auth=require(_0xcda9('0x7'));var interaction=require(_0xcda9('0x8'));var config=require(_0xcda9('0x9'));var controller=require(_0xcda9('0xa'));router[_0xcda9('0xb')]('/',auth[_0xcda9('0xc')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcda9('0xd')]);router[_0xcda9('0xe')]('/',auth[_0xcda9('0xc')](),controller['create']);router[_0xcda9('0xf')]('/:id',auth[_0xcda9('0xc')](),controller[_0xcda9('0x10')]);router[_0xcda9('0x11')]('/:id',auth[_0xcda9('0xc')](),controller['destroy']);module[_0xcda9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ce44a33..579a058 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 _0xd3da=['STRING','string','ENUM','variable','customVariable','keyValue'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd3da,0x1be));var _0xad3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3da[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xad3d('0x0')]('string',_0xad3d('0x1'),_0xad3d('0x2'),_0xad3d('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xad3d('0x4')]},'key':{'type':Sequelize[_0xad3d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xad3d('0x5'),_0xad3d('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xad3d('0x4')]},'idField':{'type':Sequelize[_0xad3d('0x4')]},'nameField':{'type':Sequelize[_0xad3d('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad3d('0x4')]}}; \ No newline at end of file +var _0x8916=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x198a68,_0x1ab1cc){var _0x5f0d21=function(_0x2cf1d0){while(--_0x2cf1d0){_0x198a68['push'](_0x198a68['shift']());}};_0x5f0d21(++_0x1ab1cc);}(_0x8916,0x1f0));var _0x6891=function(_0x5e302e,_0x317f71){_0x5e302e=_0x5e302e-0x0;var _0x3822a1=_0x8916[_0x5e302e];return _0x3822a1;};'use strict';var Sequelize=require(_0x6891('0x0'));module['exports']={'type':{'type':Sequelize[_0x6891('0x1')](_0x6891('0x2'),_0x6891('0x3'),_0x6891('0x4'),_0x6891('0x5'),_0x6891('0x6')),'defaultValue':_0x6891('0x2')},'content':{'type':Sequelize[_0x6891('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6891('0x1')](_0x6891('0x2'),'variable',_0x6891('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6891('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 44a9d6a..ccaef67 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 _0x20fe=['mustache','path','sox','fs-extra','lodash','squel','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','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','options','ZohoField','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x20fe,0x117));var _0xe20f=function(_0x56ed15,_0x3da79a){_0x56ed15=_0x56ed15-0x0;var _0x397fe7=_0x20fe[_0x56ed15];return _0x397fe7;};'use strict';var emlformat=require(_0xe20f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20f('0x1'));var jsonpatch=require(_0xe20f('0x2'));var rp=require('request-promise');var moment=require(_0xe20f('0x3'));var BPromise=require(_0xe20f('0x4'));var Mustache=require(_0xe20f('0x5'));var util=require('util');var path=require(_0xe20f('0x6'));var sox=require(_0xe20f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe20f('0x8'));var _=require(_0xe20f('0x9'));var squel=require(_0xe20f('0xa'));var crypto=require('crypto');var jsforce=require(_0xe20f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe20f('0xc'));var querystring=require(_0xe20f('0xd'));var Papa=require(_0xe20f('0xe'));var Redis=require(_0xe20f('0xf'));var authService=require(_0xe20f('0x10'));var qs=require(_0xe20f('0x11'));var as=require(_0xe20f('0x12'));var hardwareService=require(_0xe20f('0x13'));var logger=require(_0xe20f('0x14'))(_0xe20f('0x15'));var utils=require('../../config/utils');var config=require(_0xe20f('0x16'));var licenseUtil=require(_0xe20f('0x17'));var db=require(_0xe20f('0x18'))['db'];function respondWithStatusCode(_0x2561fa,_0xed2da8){_0xed2da8=_0xed2da8||0xcc;return function(_0x2744c7){if(_0x2744c7){return _0x2561fa['sendStatus'](_0xed2da8);}return _0x2561fa[_0xe20f('0x19')](_0xed2da8)[_0xe20f('0x1a')]();};}function respondWithResult(_0x402846,_0x2ce58a){_0x2ce58a=_0x2ce58a||0xc8;return function(_0xc8ab62){if(_0xc8ab62){return _0x402846[_0xe20f('0x19')](_0x2ce58a)['json'](_0xc8ab62);}};}function respondWithFilteredResult(_0x29ea76,_0x561ed9){return function(_0x88c9c8){if(_0x88c9c8){var _0x51a70a=typeof _0x561ed9[_0xe20f('0x1b')]===_0xe20f('0x1c')&&typeof _0x561ed9['limit']===_0xe20f('0x1c');var _0x49bdf9=_0x88c9c8[_0xe20f('0x1d')];var _0x371505=_0x51a70a?0x0:_0x561ed9[_0xe20f('0x1b')];var _0x15defd=_0x51a70a?_0x88c9c8['count']:_0x561ed9[_0xe20f('0x1b')]+_0x561ed9[_0xe20f('0x1e')];var _0x38d203;if(_0x15defd>=_0x49bdf9){_0x15defd=_0x49bdf9;_0x38d203=0xc8;}else{_0x38d203=0xce;}_0x29ea76[_0xe20f('0x19')](_0x38d203);return _0x29ea76[_0xe20f('0x1f')](_0xe20f('0x20'),_0x371505+'-'+_0x15defd+'/'+_0x49bdf9)[_0xe20f('0x21')](_0x88c9c8);}return null;};}function patchUpdates(_0xe0f099){return function(_0x3d8abe){try{jsonpatch['apply'](_0x3d8abe,_0xe0f099,!![]);}catch(_0x2ae588){return BPromise['reject'](_0x2ae588);}return _0x3d8abe['save']();};}function saveUpdates(_0x5317f0,_0x56c80d){return function(_0x435bce){if(_0x435bce){return _0x435bce['update'](_0x5317f0)[_0xe20f('0x22')](function(_0x1ae588){return _0x1ae588;});}return null;};}function removeEntity(_0x2311ff,_0x4b1509){return function(_0x3ac590){if(_0x3ac590){return _0x3ac590[_0xe20f('0x23')]()[_0xe20f('0x22')](function(){_0x2311ff[_0xe20f('0x19')](0xcc)[_0xe20f('0x1a')]();});}};}function handleEntityNotFound(_0x39bed4,_0x4b94f7){return function(_0x1a622b){if(!_0x1a622b){_0x39bed4['sendStatus'](0x194);}return _0x1a622b;};}function handleError(_0x16e7a0,_0x2c6aa3){_0x2c6aa3=_0x2c6aa3||0x1f4;return function(_0x5995c8){logger[_0xe20f('0x24')](_0x5995c8['stack']);if(_0x5995c8[_0xe20f('0x25')]){delete _0x5995c8['name'];}_0x16e7a0[_0xe20f('0x19')](_0x2c6aa3)[_0xe20f('0x26')](_0x5995c8);};}exports[_0xe20f('0x27')]=function(_0xdcb3e1,_0x40f414){var _0x52cd96={},_0x44c5ed={},_0x452e99={'count':0x0,'rows':[]};var _0x1323c3=_[_0xe20f('0x28')](db['ZohoField'][_0xe20f('0x29')],function(_0x4fc897){return{'name':_0x4fc897[_0xe20f('0x2a')],'type':_0x4fc897[_0xe20f('0x2b')][_0xe20f('0x2c')]};});_0x44c5ed[_0xe20f('0x2d')]=_[_0xe20f('0x28')](_0x1323c3,'name');_0x44c5ed[_0xe20f('0x2e')]=_[_0xe20f('0x2f')](_0xdcb3e1[_0xe20f('0x2e')]);_0x44c5ed['filters']=_[_0xe20f('0x30')](_0x44c5ed[_0xe20f('0x2d')],_0x44c5ed[_0xe20f('0x2e')]);_0x52cd96[_0xe20f('0x31')]=_[_0xe20f('0x30')](_0x44c5ed[_0xe20f('0x2d')],qs['fields'](_0xdcb3e1['query'][_0xe20f('0x32')]));_0x52cd96[_0xe20f('0x31')]=_0x52cd96[_0xe20f('0x31')][_0xe20f('0x33')]?_0x52cd96[_0xe20f('0x31')]:_0x44c5ed[_0xe20f('0x2d')];if(!_0xdcb3e1['query'][_0xe20f('0x34')]('nolimit')){_0x52cd96[_0xe20f('0x1e')]=qs[_0xe20f('0x1e')](_0xdcb3e1[_0xe20f('0x2e')][_0xe20f('0x1e')]);_0x52cd96[_0xe20f('0x1b')]=qs[_0xe20f('0x1b')](_0xdcb3e1[_0xe20f('0x2e')][_0xe20f('0x1b')]);}_0x52cd96[_0xe20f('0x35')]=qs[_0xe20f('0x36')](_0xdcb3e1['query']['sort']);_0x52cd96[_0xe20f('0x37')]=qs['filters'](_['pick'](_0xdcb3e1[_0xe20f('0x2e')],_0x44c5ed[_0xe20f('0x38')]),_0x1323c3);if(_0xdcb3e1['query']['filter']){_0x52cd96[_0xe20f('0x37')]=_['merge'](_0x52cd96[_0xe20f('0x37')],{'$or':_[_0xe20f('0x28')](_0x1323c3,function(_0x4b4b2b){if(_0x4b4b2b['type']!==_0xe20f('0x39')){var _0x1da1ff={};_0x1da1ff[_0x4b4b2b[_0xe20f('0x25')]]={'$like':'%'+_0xdcb3e1[_0xe20f('0x2e')][_0xe20f('0x3a')]+'%'};return _0x1da1ff;}})});}_0x52cd96=_['merge']({},_0x52cd96,_0xdcb3e1[_0xe20f('0x3b')]);var _0x2a0049={'where':_0x52cd96[_0xe20f('0x37')]};return db[_0xe20f('0x3c')][_0xe20f('0x1d')](_0x2a0049)[_0xe20f('0x22')](function(_0x45c442){_0x452e99[_0xe20f('0x1d')]=_0x45c442;if(_0xdcb3e1[_0xe20f('0x2e')][_0xe20f('0x3d')]){_0x52cd96[_0xe20f('0x3e')]=[{'all':!![]}];}return db[_0xe20f('0x3c')][_0xe20f('0x3f')](_0x52cd96);})[_0xe20f('0x22')](function(_0x58a06d){_0x452e99[_0xe20f('0x40')]=_0x58a06d;return _0x452e99;})[_0xe20f('0x22')](respondWithFilteredResult(_0x40f414,_0x52cd96))['catch'](handleError(_0x40f414,null));};exports['show']=function(_0x239637,_0x45c49d){var _0x35ceca={'raw':!![],'where':{'id':_0x239637[_0xe20f('0x41')]['id']}},_0x39bd69={};_0x39bd69[_0xe20f('0x2d')]=_['keys'](db['ZohoField'][_0xe20f('0x29')]);_0x39bd69[_0xe20f('0x2e')]=_[_0xe20f('0x2f')](_0x239637['query']);_0x39bd69[_0xe20f('0x38')]=_[_0xe20f('0x30')](_0x39bd69[_0xe20f('0x2d')],_0x39bd69[_0xe20f('0x2e')]);_0x35ceca[_0xe20f('0x31')]=_[_0xe20f('0x30')](_0x39bd69[_0xe20f('0x2d')],qs[_0xe20f('0x32')](_0x239637['query'][_0xe20f('0x32')]));_0x35ceca[_0xe20f('0x31')]=_0x35ceca[_0xe20f('0x31')][_0xe20f('0x33')]?_0x35ceca[_0xe20f('0x31')]:_0x39bd69[_0xe20f('0x2d')];if(_0x239637['query'][_0xe20f('0x3d')]){_0x35ceca[_0xe20f('0x3e')]=[{'all':!![]}];}_0x35ceca=_[_0xe20f('0x42')]({},_0x35ceca,_0x239637['options']);return db['ZohoField'][_0xe20f('0x43')](_0x35ceca)[_0xe20f('0x22')](handleEntityNotFound(_0x45c49d,null))['then'](respondWithResult(_0x45c49d,null))[_0xe20f('0x44')](handleError(_0x45c49d,null));};exports['create']=function(_0x434038,_0x168cb1){return db[_0xe20f('0x3c')][_0xe20f('0x45')](_0x434038[_0xe20f('0x46')],{})[_0xe20f('0x22')](respondWithResult(_0x168cb1,0xc9))[_0xe20f('0x44')](handleError(_0x168cb1,null));};exports['update']=function(_0xa652da,_0x330a56){if(_0xa652da[_0xe20f('0x46')]['id']){delete _0xa652da[_0xe20f('0x46')]['id'];}return db[_0xe20f('0x3c')]['find']({'where':{'id':_0xa652da[_0xe20f('0x41')]['id']}})[_0xe20f('0x22')](handleEntityNotFound(_0x330a56,null))[_0xe20f('0x22')](saveUpdates(_0xa652da[_0xe20f('0x46')],null))[_0xe20f('0x22')](respondWithResult(_0x330a56,null))[_0xe20f('0x44')](handleError(_0x330a56,null));};exports['destroy']=function(_0x28a05b,_0x2cb6f5){return db[_0xe20f('0x3c')][_0xe20f('0x43')]({'where':{'id':_0x28a05b[_0xe20f('0x41')]['id']}})[_0xe20f('0x22')](handleEntityNotFound(_0x2cb6f5,null))[_0xe20f('0x22')](removeEntity(_0x2cb6f5,null))['catch'](handleError(_0x2cb6f5,null));}; \ No newline at end of file +var _0x119f=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ZohoField','fieldName','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','model','rawAttributes','keys','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x126975,_0x3d695f){var _0x232935=function(_0x4fb94c){while(--_0x4fb94c){_0x126975['push'](_0x126975['shift']());}};_0x232935(++_0x3d695f);}(_0x119f,0xd4));var _0xf119=function(_0x2ad2eb,_0x369368){_0x2ad2eb=_0x2ad2eb-0x0;var _0x22f5f7=_0x119f[_0x2ad2eb];return _0x22f5f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf119('0x0'));var jsonpatch=require(_0xf119('0x1'));var rp=require('request-promise');var moment=require(_0xf119('0x2'));var BPromise=require(_0xf119('0x3'));var Mustache=require(_0xf119('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf119('0x5'));var ejs=require(_0xf119('0x6'));var fs=require('fs');var fs_extra=require(_0xf119('0x7'));var _=require(_0xf119('0x8'));var squel=require('squel');var crypto=require(_0xf119('0x9'));var jsforce=require(_0xf119('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf119('0x5'));var querystring=require(_0xf119('0xb'));var Papa=require(_0xf119('0xc'));var Redis=require(_0xf119('0xd'));var authService=require(_0xf119('0xe'));var qs=require(_0xf119('0xf'));var as=require(_0xf119('0x10'));var hardwareService=require(_0xf119('0x11'));var logger=require('../../config/logger')(_0xf119('0x12'));var utils=require(_0xf119('0x13'));var config=require(_0xf119('0x14'));var licenseUtil=require(_0xf119('0x15'));var db=require(_0xf119('0x16'))['db'];function respondWithStatusCode(_0xd9fa3c,_0x24557b){_0x24557b=_0x24557b||0xcc;return function(_0x1cceb4){if(_0x1cceb4){return _0xd9fa3c['sendStatus'](_0x24557b);}return _0xd9fa3c[_0xf119('0x17')](_0x24557b)[_0xf119('0x18')]();};}function respondWithResult(_0x4fc399,_0x425805){_0x425805=_0x425805||0xc8;return function(_0xe215ae){if(_0xe215ae){return _0x4fc399[_0xf119('0x17')](_0x425805)[_0xf119('0x19')](_0xe215ae);}};}function respondWithFilteredResult(_0x46c2d5,_0x172e66){return function(_0x5dcec6){if(_0x5dcec6){var _0x3451b9=typeof _0x172e66['offset']===_0xf119('0x1a')&&typeof _0x172e66[_0xf119('0x1b')]===_0xf119('0x1a');var _0x5b1044=_0x5dcec6['count'];var _0x3c0898=_0x3451b9?0x0:_0x172e66[_0xf119('0x1c')];var _0x278411=_0x3451b9?_0x5dcec6[_0xf119('0x1d')]:_0x172e66[_0xf119('0x1c')]+_0x172e66[_0xf119('0x1b')];var _0x3de036;if(_0x278411>=_0x5b1044){_0x278411=_0x5b1044;_0x3de036=0xc8;}else{_0x3de036=0xce;}_0x46c2d5[_0xf119('0x17')](_0x3de036);return _0x46c2d5[_0xf119('0x1e')](_0xf119('0x1f'),_0x3c0898+'-'+_0x278411+'/'+_0x5b1044)[_0xf119('0x19')](_0x5dcec6);}return null;};}function patchUpdates(_0x5c0ee7){return function(_0x230e04){try{jsonpatch['apply'](_0x230e04,_0x5c0ee7,!![]);}catch(_0x5f4667){return BPromise[_0xf119('0x20')](_0x5f4667);}return _0x230e04[_0xf119('0x21')]();};}function saveUpdates(_0x318b96,_0x5e9315){return function(_0x1b668f){if(_0x1b668f){return _0x1b668f[_0xf119('0x22')](_0x318b96)['then'](function(_0x8c2672){return _0x8c2672;});}return null;};}function removeEntity(_0x5aa87e,_0x4af69e){return function(_0x17f9d0){if(_0x17f9d0){return _0x17f9d0[_0xf119('0x23')]()[_0xf119('0x24')](function(){_0x5aa87e[_0xf119('0x17')](0xcc)[_0xf119('0x18')]();});}};}function handleEntityNotFound(_0x140a33,_0x17c6b5){return function(_0x32a4bc){if(!_0x32a4bc){_0x140a33[_0xf119('0x25')](0x194);}return _0x32a4bc;};}function handleError(_0x4c8369,_0x23c60f){_0x23c60f=_0x23c60f||0x1f4;return function(_0x242abf){logger[_0xf119('0x26')](_0x242abf[_0xf119('0x27')]);if(_0x242abf[_0xf119('0x28')]){delete _0x242abf[_0xf119('0x28')];}_0x4c8369[_0xf119('0x17')](_0x23c60f)[_0xf119('0x29')](_0x242abf);};}exports[_0xf119('0x2a')]=function(_0x256dc0,_0x1ccba2){var _0xf061b2={},_0x3d140f={},_0x54f5c8={'count':0x0,'rows':[]};var _0x5270c7=_[_0xf119('0x2b')](db[_0xf119('0x2c')]['rawAttributes'],function(_0xf2cb35){return{'name':_0xf2cb35[_0xf119('0x2d')],'type':_0xf2cb35['type'][_0xf119('0x2e')]};});_0x3d140f['model']=_[_0xf119('0x2b')](_0x5270c7,'name');_0x3d140f[_0xf119('0x2f')]=_['keys'](_0x256dc0[_0xf119('0x2f')]);_0x3d140f[_0xf119('0x30')]=_[_0xf119('0x31')](_0x3d140f['model'],_0x3d140f[_0xf119('0x2f')]);_0xf061b2[_0xf119('0x32')]=_[_0xf119('0x31')](_0x3d140f['model'],qs[_0xf119('0x33')](_0x256dc0['query'][_0xf119('0x33')]));_0xf061b2[_0xf119('0x32')]=_0xf061b2[_0xf119('0x32')][_0xf119('0x34')]?_0xf061b2['attributes']:_0x3d140f['model'];if(!_0x256dc0['query'][_0xf119('0x35')](_0xf119('0x36'))){_0xf061b2['limit']=qs[_0xf119('0x1b')](_0x256dc0[_0xf119('0x2f')][_0xf119('0x1b')]);_0xf061b2[_0xf119('0x1c')]=qs['offset'](_0x256dc0[_0xf119('0x2f')]['offset']);}_0xf061b2[_0xf119('0x37')]=qs[_0xf119('0x38')](_0x256dc0[_0xf119('0x2f')]['sort']);_0xf061b2[_0xf119('0x39')]=qs['filters'](_[_0xf119('0x3a')](_0x256dc0[_0xf119('0x2f')],_0x3d140f[_0xf119('0x30')]),_0x5270c7);if(_0x256dc0[_0xf119('0x2f')][_0xf119('0x3b')]){_0xf061b2[_0xf119('0x39')]=_[_0xf119('0x3c')](_0xf061b2[_0xf119('0x39')],{'$or':_['map'](_0x5270c7,function(_0x512d37){if(_0x512d37['type']!==_0xf119('0x3d')){var _0x58d6cd={};_0x58d6cd[_0x512d37[_0xf119('0x28')]]={'$like':'%'+_0x256dc0[_0xf119('0x2f')][_0xf119('0x3b')]+'%'};return _0x58d6cd;}})});}_0xf061b2=_[_0xf119('0x3c')]({},_0xf061b2,_0x256dc0[_0xf119('0x3e')]);var _0x102e66={'where':_0xf061b2[_0xf119('0x39')]};return db[_0xf119('0x2c')][_0xf119('0x1d')](_0x102e66)['then'](function(_0x398b37){_0x54f5c8[_0xf119('0x1d')]=_0x398b37;if(_0x256dc0[_0xf119('0x2f')][_0xf119('0x3f')]){_0xf061b2['include']=[{'all':!![]}];}return db[_0xf119('0x2c')][_0xf119('0x40')](_0xf061b2);})[_0xf119('0x24')](function(_0x34101c){_0x54f5c8[_0xf119('0x41')]=_0x34101c;return _0x54f5c8;})['then'](respondWithFilteredResult(_0x1ccba2,_0xf061b2))[_0xf119('0x42')](handleError(_0x1ccba2,null));};exports[_0xf119('0x43')]=function(_0x333537,_0x553964){var _0x465e38={'raw':!![],'where':{'id':_0x333537[_0xf119('0x44')]['id']}},_0x1f57ee={};_0x1f57ee[_0xf119('0x45')]=_['keys'](db[_0xf119('0x2c')][_0xf119('0x46')]);_0x1f57ee[_0xf119('0x2f')]=_[_0xf119('0x47')](_0x333537[_0xf119('0x2f')]);_0x1f57ee[_0xf119('0x30')]=_[_0xf119('0x31')](_0x1f57ee[_0xf119('0x45')],_0x1f57ee['query']);_0x465e38['attributes']=_[_0xf119('0x31')](_0x1f57ee['model'],qs[_0xf119('0x33')](_0x333537[_0xf119('0x2f')][_0xf119('0x33')]));_0x465e38[_0xf119('0x32')]=_0x465e38['attributes'][_0xf119('0x34')]?_0x465e38['attributes']:_0x1f57ee[_0xf119('0x45')];if(_0x333537[_0xf119('0x2f')][_0xf119('0x3f')]){_0x465e38['include']=[{'all':!![]}];}_0x465e38=_[_0xf119('0x3c')]({},_0x465e38,_0x333537['options']);return db['ZohoField']['find'](_0x465e38)[_0xf119('0x24')](handleEntityNotFound(_0x553964,null))[_0xf119('0x24')](respondWithResult(_0x553964,null))[_0xf119('0x42')](handleError(_0x553964,null));};exports[_0xf119('0x48')]=function(_0x4b35f2,_0x46cd76){return db[_0xf119('0x2c')][_0xf119('0x48')](_0x4b35f2[_0xf119('0x49')],{})['then'](respondWithResult(_0x46cd76,0xc9))['catch'](handleError(_0x46cd76,null));};exports[_0xf119('0x22')]=function(_0x3e6504,_0x66fc68){if(_0x3e6504['body']['id']){delete _0x3e6504[_0xf119('0x49')]['id'];}return db[_0xf119('0x2c')]['find']({'where':{'id':_0x3e6504[_0xf119('0x44')]['id']}})[_0xf119('0x24')](handleEntityNotFound(_0x66fc68,null))['then'](saveUpdates(_0x3e6504[_0xf119('0x49')],null))['then'](respondWithResult(_0x66fc68,null))[_0xf119('0x42')](handleError(_0x66fc68,null));};exports[_0xf119('0x23')]=function(_0x5ba057,_0x2dea5b){return db[_0xf119('0x2c')]['find']({'where':{'id':_0x5ba057[_0xf119('0x44')]['id']}})[_0xf119('0x24')](handleEntityNotFound(_0x2dea5b,null))['then'](removeEntity(_0x2dea5b,null))[_0xf119('0x42')](handleError(_0x2dea5b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0b8170c..3d724d4 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 _0x5430=['bluebird','rimraf','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x187f8b,_0x3ef111){var _0x57ad93=function(_0x4479a1){while(--_0x4479a1){_0x187f8b['push'](_0x187f8b['shift']());}};_0x57ad93(++_0x3ef111);}(_0x5430,0x10c));var _0x0543=function(_0x567611,_0x491b6a){_0x567611=_0x567611-0x0;var _0x46f5af=_0x5430[_0x567611];return _0x46f5af;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x0543('0x7')]=function(_0x45b909,_0x9754ba){return _0x45b909[_0x0543('0x8')](_0x0543('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0543('0xa'),'fields':[_0x0543('0xb'),_0x0543('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2da6=['api','moment','bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x33a214,_0x3c3490){var _0x379b48=function(_0x17e046){while(--_0x17e046){_0x33a214['push'](_0x33a214['shift']());}};_0x379b48(++_0x3c3490);}(_0x2da6,0x1dd));var _0x62da=function(_0x40fe51,_0x2785a5){_0x40fe51=_0x40fe51-0x0;var _0x373755=_0x2da6[_0x40fe51];return _0x373755;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));module[_0x62da('0x9')]=function(_0x3a59f8,_0x30437f){return _0x3a59f8[_0x62da('0xa')](_0x62da('0xb'),attributes,{'tableName':_0x62da('0xc'),'paranoid':![],'indexes':[{'name':_0x62da('0xd'),'fields':[_0x62da('0xe'),'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 63f3099..064da4a 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 _0xb8f1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x4ac260,_0x529c62){var _0x3d616d=function(_0x32aafd){while(--_0x32aafd){_0x4ac260['push'](_0x4ac260['shift']());}};_0x3d616d(++_0x529c62);}(_0xb8f1,0xa7));var _0x1b8f=function(_0x18a620,_0xf8e275){_0x18a620=_0x18a620-0x0;var _0x48391d=_0xb8f1[_0x18a620];return _0x48391d;};'use strict';var _=require(_0x1b8f('0x0'));var util=require(_0x1b8f('0x1'));var moment=require(_0x1b8f('0x2'));var BPromise=require(_0x1b8f('0x3'));var rs=require(_0x1b8f('0x4'));var fs=require('fs');var Redis=require(_0x1b8f('0x5'));var db=require(_0x1b8f('0x6'))['db'];var utils=require(_0x1b8f('0x7'));var logger=require('../../config/logger')(_0x1b8f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b8f('0x9'));var client=jayson[_0x1b8f('0xa')][_0x1b8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c9531,_0x3415d1,_0x3548ef){return new BPromise(function(_0x4de50b,_0x5cf461){return client[_0x1b8f('0xc')](_0x4c9531,_0x3548ef)[_0x1b8f('0xd')](function(_0x32ec91){logger[_0x1b8f('0xe')](_0x1b8f('0xf'),_0x3415d1,_0x1b8f('0x10'));logger[_0x1b8f('0x11')](_0x1b8f('0x12'),_0x3415d1,_0x1b8f('0x10'),JSON[_0x1b8f('0x13')](_0x32ec91));if(_0x32ec91['error']){if(_0x32ec91['error']['code']===0x1f4){logger[_0x1b8f('0x14')](_0x1b8f('0xf'),_0x3415d1,_0x32ec91['error'][_0x1b8f('0x15')]);return _0x5cf461(_0x32ec91['error'][_0x1b8f('0x15')]);}logger[_0x1b8f('0x14')](_0x1b8f('0xf'),_0x3415d1,_0x32ec91[_0x1b8f('0x14')][_0x1b8f('0x15')]);return _0x4de50b(_0x32ec91['error'][_0x1b8f('0x15')]);}else{logger[_0x1b8f('0xe')](_0x1b8f('0xf'),_0x3415d1,_0x1b8f('0x10'));_0x4de50b(_0x32ec91[_0x1b8f('0x16')]['message']);}})[_0x1b8f('0x17')](function(_0x333a89){logger['error'](_0x1b8f('0xf'),_0x3415d1,_0x333a89);_0x5cf461(_0x333a89);});});} \ No newline at end of file +var _0x9a98=['message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x381fb9,_0x549212){var _0x50e609=function(_0x4c2795){while(--_0x4c2795){_0x381fb9['push'](_0x381fb9['shift']());}};_0x50e609(++_0x549212);}(_0x9a98,0x67));var _0x89a9=function(_0x3b3914,_0x8d324){_0x3b3914=_0x3b3914-0x0;var _0x9cf7d5=_0x9a98[_0x3b3914];return _0x9cf7d5;};'use strict';var _=require(_0x89a9('0x0'));var util=require(_0x89a9('0x1'));var moment=require(_0x89a9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a9('0x3'));var db=require(_0x89a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x89a9('0x5'))(_0x89a9('0x6'));var config=require(_0x89a9('0x7'));var jayson=require(_0x89a9('0x8'));var client=jayson[_0x89a9('0x9')][_0x89a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c2acc,_0x118581,_0x42a091){return new BPromise(function(_0x2fe86e,_0x174386){return client[_0x89a9('0xb')](_0x2c2acc,_0x42a091)['then'](function(_0x395c35){logger['info'](_0x89a9('0xc'),_0x118581,_0x89a9('0xd'));logger['debug'](_0x89a9('0xe'),_0x118581,_0x89a9('0xd'),JSON['stringify'](_0x395c35));if(_0x395c35[_0x89a9('0xf')]){if(_0x395c35[_0x89a9('0xf')][_0x89a9('0x10')]===0x1f4){logger[_0x89a9('0xf')](_0x89a9('0xc'),_0x118581,_0x395c35[_0x89a9('0xf')]['message']);return _0x174386(_0x395c35['error'][_0x89a9('0x11')]);}logger[_0x89a9('0xf')](_0x89a9('0xc'),_0x118581,_0x395c35[_0x89a9('0xf')][_0x89a9('0x11')]);return _0x2fe86e(_0x395c35[_0x89a9('0xf')][_0x89a9('0x11')]);}else{logger[_0x89a9('0x12')](_0x89a9('0xc'),_0x118581,_0x89a9('0xd'));_0x2fe86e(_0x395c35[_0x89a9('0x13')][_0x89a9('0x11')]);}})['catch'](function(_0x10bd08){logger[_0x89a9('0xf')](_0x89a9('0xc'),_0x118581,_0x10bd08);_0x174386(_0x10bd08);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d9efd18..7469f79 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(_0x58ac3f,_0x190d30){var _0x327bc0=function(_0x595a8c){while(--_0x595a8c){_0x58ac3f['push'](_0x58ac3f['shift']());}};_0x327bc0(++_0x190d30);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1b7db17..4da5c32 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 _0xeff5=['BOOLEAN','state','sequelize','STRING','INTEGER'];(function(_0x2179e3,_0x3f7767){var _0x3a350b=function(_0x1a4975){while(--_0x1a4975){_0x2179e3['push'](_0x2179e3['shift']());}};_0x3a350b(++_0x3f7767);}(_0xeff5,0x101));var _0x5eff=function(_0x22900e,_0x40d166){_0x22900e=_0x22900e-0x0;var _0x415324=_0xeff5[_0x22900e];return _0x415324;};'use strict';var Sequelize=require(_0x5eff('0x0'));module['exports']={'name':{'type':Sequelize[_0x5eff('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x5eff('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x5eff('0x1')]},'path':{'type':Sequelize[_0x5eff('0x1')]},'type':{'type':Sequelize[_0x5eff('0x1')]},'size':{'type':Sequelize[_0x5eff('0x2')]},'active':{'type':Sequelize[_0x5eff('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x5eff('0x1')]},'logo':{'type':Sequelize[_0x5eff('0x1')]},'state':{'type':Sequelize[_0x5eff('0x1')],'unique':_0x5eff('0x4')},'description':{'type':Sequelize[_0x5eff('0x1')]},'title':{'type':Sequelize[_0x5eff('0x1')]},'remoteUri':{'type':Sequelize[_0x5eff('0x1')]},'link':{'type':Sequelize[_0x5eff('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xff4f=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0xff4f,0x19a));var _0xfff4=function(_0x3cb287,_0x3d9cf9){_0x3cb287=_0x3cb287-0x0;var _0x3258d3=_0xff4f[_0x3cb287];return _0x3258d3;};'use strict';var Sequelize=require(_0xfff4('0x0'));module[_0xfff4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfff4('0x2')},'version':{'type':Sequelize[_0xfff4('0x3')],'allowNull':![],'unique':_0xfff4('0x2')},'main':{'type':Sequelize[_0xfff4('0x3')],'defaultValue':_0xfff4('0x4')},'filename':{'type':Sequelize[_0xfff4('0x3')]},'path':{'type':Sequelize[_0xfff4('0x3')]},'type':{'type':Sequelize[_0xfff4('0x3')]},'size':{'type':Sequelize[_0xfff4('0x5')]},'active':{'type':Sequelize[_0xfff4('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xfff4('0x3')]},'logo':{'type':Sequelize[_0xfff4('0x3')]},'state':{'type':Sequelize[_0xfff4('0x3')],'unique':_0xfff4('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xfff4('0x3')]},'remoteUri':{'type':Sequelize[_0xfff4('0x3')]},'link':{'type':Sequelize[_0xfff4('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5efcd45..7dd55b2 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x1a37,0xb4));var _0x71a3=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1a37[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0x4137=['map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index'];(function(_0x34dbf7,_0x5e0c9c){var _0x1d8eeb=function(_0x1141ec){while(--_0x1141ec){_0x34dbf7['push'](_0x34dbf7['shift']());}};_0x1d8eeb(++_0x5e0c9c);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['Integration'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['Integration']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b535ab1..eb0fb72 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 _0x053a=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dfd10,_0x3169d5){var _0x267950=function(_0x15b4ae){while(--_0x15b4ae){_0x4dfd10['push'](_0x4dfd10['shift']());}};_0x267950(++_0x3169d5);}(_0x053a,0x80));var _0xa053=function(_0x1ff97f,_0x3060d6){_0x1ff97f=_0x1ff97f-0x0;var _0x2404db=_0x053a[_0x1ff97f];return _0x2404db;};'use strict';var _=require(_0xa053('0x0'));var util=require(_0xa053('0x1'));var logger=require(_0xa053('0x2'))(_0xa053('0x3'));var moment=require(_0xa053('0x4'));var BPromise=require(_0xa053('0x5'));var rp=require(_0xa053('0x6'));var fs=require('fs');var path=require(_0xa053('0x7'));var rimraf=require(_0xa053('0x8'));var config=require(_0xa053('0x9'));var attributes=require(_0xa053('0xa'));module[_0xa053('0xb')]=function(_0x28c507,_0x57c5b3){return _0x28c507[_0xa053('0xc')](_0xa053('0xd'),attributes,{'tableName':_0xa053('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f6=['path','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ef369,_0x40851f){var _0x3e851f=function(_0x136e58){while(--_0x136e58){_0x2ef369['push'](_0x2ef369['shift']());}};_0x3e851f(++_0x40851f);}(_0x42f6,0x66));var _0x642f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x42f6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x642f('0x0'));var util=require(_0x642f('0x1'));var logger=require(_0x642f('0x2'))(_0x642f('0x3'));var moment=require(_0x642f('0x4'));var BPromise=require(_0x642f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x642f('0x6'));var rimraf=require('rimraf');var config=require(_0x642f('0x7'));var attributes=require('./integration.attributes');module[_0x642f('0x8')]=function(_0x42d84e,_0x49d870){return _0x42d84e[_0x642f('0x9')](_0x642f('0xa'),attributes,{'tableName':_0x642f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ce775e1..74bf3a9 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d79a1,_0x1c4bac){var _0x5e5ed1=function(_0xd39dd8){while(--_0xd39dd8){_0x1d79a1['push'](_0x1d79a1['shift']());}};_0x5e5ed1(++_0x1c4bac);}(_0x14a0,0x8e));var _0x014a=function(_0x52baac,_0x5ce776){_0x52baac=_0x52baac-0x0;var _0x20a146=_0x14a0[_0x52baac];return _0x20a146;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4829ae,_0x7fe03){var _0x1485da=function(_0x1725c6){while(--_0x1725c6){_0x4829ae['push'](_0x4829ae['shift']());}};_0x1485da(++_0x7fe03);}(_0x896e,0x1e9));var _0xe896=function(_0x5914b3,_0x153bc4){_0x5914b3=_0x5914b3-0x0;var _0x42bf09=_0x896e[_0x5914b3];return _0x42bf09;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b09205f..4769ef6 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(_0x5f545a,_0x469ca9){var _0x1db569=function(_0x5bcb06){while(--_0x5bcb06){_0x5f545a['push'](_0x5f545a['shift']());}};_0x1db569(++_0x469ca9);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x56e790,_0x5bec09){var _0x4fa9fa=function(_0x513862){while(--_0x513862){_0x56e790['push'](_0x56e790['shift']());}};_0x4fa9fa(++_0x5bec09);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8a62353..7990dfc 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 _0x9fb1=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x42c5e0,_0x1b292b){var _0x5a26eb=function(_0x500306){while(--_0x500306){_0x42c5e0['push'](_0x42c5e0['shift']());}};_0x5a26eb(++_0x1b292b);}(_0x9fb1,0x11d));var _0x19fb=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9fb1[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x19fb('0x0'));module[_0x19fb('0x1')]={'integration':{'type':Sequelize[_0x19fb('0x2')]},'eventChannel':{'type':Sequelize[_0x19fb('0x2')]},'exitStatus':{'type':Sequelize[_0x19fb('0x2')]},'ticketId':{'type':Sequelize[_0x19fb('0x2')]},'integrationId':{'type':Sequelize[_0x19fb('0x3')]},'contacts':{'type':Sequelize[_0x19fb('0x2')]},'uniqueid':{'type':Sequelize[_0x19fb('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x19fb('0x2')]},'interface':{'type':Sequelize[_0x19fb('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x19fb('0x4')]},'agentconnectAt':{'type':Sequelize[_0x19fb('0x4')]},'holdtime':{'type':Sequelize[_0x19fb('0x3')]},'agentcomplete':{'type':Sequelize[_0x19fb('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x19fb('0x4')]},'talktime':{'type':Sequelize[_0x19fb('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x19fb('0x3')]},'reason':{'type':Sequelize[_0x19fb('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x19fb('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x19fb('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x19fb('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x19fb('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x19fb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x19fb('0x2')]},'connectedlinename':{'type':Sequelize[_0x19fb('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x19fb('0x2')]},'exten':{'type':Sequelize[_0x19fb('0x2')]},'priority':{'type':Sequelize[_0x19fb('0x2')]},'destchannel':{'type':Sequelize[_0x19fb('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x19fb('0x2')]},'destcalleridnum':{'type':Sequelize[_0x19fb('0x2')]},'destcalleridname':{'type':Sequelize[_0x19fb('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x19fb('0x2')]},'destaccountcode':{'type':Sequelize[_0x19fb('0x2')]},'destcontext':{'type':Sequelize[_0x19fb('0x2')]},'destexten':{'type':Sequelize[_0x19fb('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x19fb('0x2')]},'messageId':{'type':Sequelize[_0x19fb('0x2')]},'inReplyTo':{'type':Sequelize[_0x19fb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x19fb('0x2')]},'to':{'type':Sequelize[_0x19fb('0x2')]},'cc':{'type':Sequelize[_0x19fb('0x2')]},'attachment':{'type':Sequelize[_0x19fb('0x6')]},'html':{'type':Sequelize[_0x19fb('0x6')]},'text':{'type':Sequelize[_0x19fb('0x6')]},'status':{'type':Sequelize[_0x19fb('0x7')](_0x19fb('0x8'),_0x19fb('0x9'),_0x19fb('0xa'),_0x19fb('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x19fb('0x2')]},'appdata':{'type':Sequelize[_0x19fb('0x2')]},'projectId':{'type':Sequelize[_0x19fb('0x3')]}}; \ No newline at end of file +var _0x204c=['INTEGER','BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','sequelize','STRING','DATE'];(function(_0x3a259d,_0x313102){var _0x2e03e6=function(_0x908e9){while(--_0x908e9){_0x3a259d['push'](_0x3a259d['shift']());}};_0x2e03e6(++_0x313102);}(_0x204c,0xb1));var _0xc204=function(_0x21b582,_0x5552ef){_0x21b582=_0x21b582-0x0;var _0x14fde5=_0x204c[_0x21b582];return _0x14fde5;};'use strict';var Sequelize=require(_0xc204('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc204('0x1')]},'exitStatus':{'type':Sequelize[_0xc204('0x1')]},'ticketId':{'type':Sequelize[_0xc204('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc204('0x1')]},'calleridnum':{'type':Sequelize[_0xc204('0x1')]},'calleridname':{'type':Sequelize[_0xc204('0x1')]},'queue':{'type':Sequelize[_0xc204('0x1')]},'interface':{'type':Sequelize[_0xc204('0x1')]},'membername':{'type':Sequelize[_0xc204('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc204('0x2')]},'agentconnectAt':{'type':Sequelize[_0xc204('0x2')]},'holdtime':{'type':Sequelize[_0xc204('0x3')]},'agentcomplete':{'type':Sequelize[_0xc204('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc204('0x2')]},'talktime':{'type':Sequelize[_0xc204('0x3')]},'agentacw':{'type':Sequelize[_0xc204('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc204('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xc204('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc204('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc204('0x2')]},'lastevent':{'type':Sequelize[_0xc204('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc204('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc204('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc204('0x1')]},'connectedlinename':{'type':Sequelize[_0xc204('0x1')]},'language':{'type':Sequelize[_0xc204('0x1')]},'accountcode':{'type':Sequelize[_0xc204('0x1')]},'context':{'type':Sequelize[_0xc204('0x1')]},'exten':{'type':Sequelize[_0xc204('0x1')]},'priority':{'type':Sequelize[_0xc204('0x1')]},'destchannel':{'type':Sequelize[_0xc204('0x1')]},'destchannelstate':{'type':Sequelize[_0xc204('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc204('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc204('0x1')]},'destcalleridname':{'type':Sequelize[_0xc204('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc204('0x1')]},'destlanguage':{'type':Sequelize[_0xc204('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xc204('0x1')]},'destpriority':{'type':Sequelize[_0xc204('0x1')]},'destuniqueid':{'type':Sequelize[_0xc204('0x1')]},'messageId':{'type':Sequelize[_0xc204('0x1')]},'inReplyTo':{'type':Sequelize[_0xc204('0x1')]},'subject':{'type':Sequelize[_0xc204('0x1')]},'from':{'type':Sequelize[_0xc204('0x1')]},'to':{'type':Sequelize[_0xc204('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xc204('0x5')]},'html':{'type':Sequelize[_0xc204('0x5')]},'text':{'type':Sequelize[_0xc204('0x5')]},'status':{'type':Sequelize[_0xc204('0x6')]('SENT','SENDING',_0xc204('0x7'),_0xc204('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc204('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc204('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 431d4c7..54ff919 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 _0xcf8e=['../../config/license/util','../../mysqldb','status','end','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','params','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3f8df4,_0x50b2f0){var _0x240d3e=function(_0x5f182f){while(--_0x5f182f){_0x3f8df4['push'](_0x3f8df4['shift']());}};_0x240d3e(++_0x50b2f0);}(_0xcf8e,0x190));var _0xecf8=function(_0x910eae,_0x35919c){_0x910eae=_0x910eae-0x0;var _0x1c9dc9=_0xcf8e[_0x910eae];return _0x1c9dc9;};'use strict';var emlformat=require(_0xecf8('0x0'));var rimraf=require(_0xecf8('0x1'));var zipdir=require(_0xecf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecf8('0x3'));var BPromise=require(_0xecf8('0x4'));var Mustache=require(_0xecf8('0x5'));var util=require(_0xecf8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xecf8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecf8('0x8'));var squel=require(_0xecf8('0x9'));var crypto=require(_0xecf8('0xa'));var jsforce=require(_0xecf8('0xb'));var deskjs=require(_0xecf8('0xc'));var toCsv=require(_0xecf8('0x7'));var querystring=require(_0xecf8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecf8('0xe'));var qs=require(_0xecf8('0xf'));var as=require(_0xecf8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecf8('0x11'))('api');var utils=require(_0xecf8('0x12'));var config=require(_0xecf8('0x13'));var licenseUtil=require(_0xecf8('0x14'));var db=require(_0xecf8('0x15'))['db'];function respondWithStatusCode(_0x122bf0,_0x3ce924){_0x3ce924=_0x3ce924||0xcc;return function(_0x325e2c){if(_0x325e2c){return _0x122bf0['sendStatus'](_0x3ce924);}return _0x122bf0[_0xecf8('0x16')](_0x3ce924)[_0xecf8('0x17')]();};}function respondWithResult(_0x4bf88a,_0x2cf09b){_0x2cf09b=_0x2cf09b||0xc8;return function(_0x1cc008){if(_0x1cc008){return _0x4bf88a[_0xecf8('0x16')](_0x2cf09b)['json'](_0x1cc008);}};}function respondWithFilteredResult(_0x5a0f68,_0x1849f8){return function(_0x44ba68){if(_0x44ba68){var _0x46d180=typeof _0x1849f8['offset']===_0xecf8('0x18')&&typeof _0x1849f8[_0xecf8('0x19')]===_0xecf8('0x18');var _0x5203a1=_0x44ba68['count'];var _0xbbc4e0=_0x46d180?0x0:_0x1849f8['offset'];var _0x267c96=_0x46d180?_0x44ba68[_0xecf8('0x1a')]:_0x1849f8['offset']+_0x1849f8[_0xecf8('0x19')];var _0x3805d5;if(_0x267c96>=_0x5203a1){_0x267c96=_0x5203a1;_0x3805d5=0xc8;}else{_0x3805d5=0xce;}_0x5a0f68[_0xecf8('0x16')](_0x3805d5);return _0x5a0f68['set'](_0xecf8('0x1b'),_0xbbc4e0+'-'+_0x267c96+'/'+_0x5203a1)[_0xecf8('0x1c')](_0x44ba68);}return null;};}function patchUpdates(_0x910deb){return function(_0x56411f){try{jsonpatch['apply'](_0x56411f,_0x910deb,!![]);}catch(_0x26c043){return BPromise[_0xecf8('0x1d')](_0x26c043);}return _0x56411f[_0xecf8('0x1e')]();};}function saveUpdates(_0x4aa65d,_0x54f4c9){return function(_0xae1212){if(_0xae1212){return _0xae1212[_0xecf8('0x1f')](_0x4aa65d)['then'](function(_0x6fbb87){return _0x6fbb87;});}return null;};}function removeEntity(_0x46f2c7,_0x1a1dc8){return function(_0x40bc53){if(_0x40bc53){return _0x40bc53[_0xecf8('0x20')]()[_0xecf8('0x21')](function(){_0x46f2c7['status'](0xcc)[_0xecf8('0x17')]();});}};}function handleEntityNotFound(_0x47dab6,_0x3fded0){return function(_0x3df814){if(!_0x3df814){_0x47dab6['sendStatus'](0x194);}return _0x3df814;};}function handleError(_0x45ad84,_0x4ca855){_0x4ca855=_0x4ca855||0x1f4;return function(_0x51f188){logger[_0xecf8('0x22')](_0x51f188[_0xecf8('0x23')]);if(_0x51f188[_0xecf8('0x24')]){delete _0x51f188['name'];}_0x45ad84['status'](_0x4ca855)[_0xecf8('0x25')](_0x51f188);};}exports['index']=function(_0x2179c7,_0x59c91a){var _0x3b4495={},_0x5c684c={},_0x26d11c={'count':0x0,'rows':[]};var _0x28b9c2=_[_0xecf8('0x26')](db[_0xecf8('0x27')][_0xecf8('0x28')],function(_0x427d1c){return{'name':_0x427d1c['fieldName'],'type':_0x427d1c[_0xecf8('0x29')][_0xecf8('0x2a')]};});_0x5c684c[_0xecf8('0x2b')]=_[_0xecf8('0x26')](_0x28b9c2,_0xecf8('0x24'));_0x5c684c[_0xecf8('0x2c')]=_[_0xecf8('0x2d')](_0x2179c7[_0xecf8('0x2c')]);_0x5c684c[_0xecf8('0x2e')]=_[_0xecf8('0x2f')](_0x5c684c[_0xecf8('0x2b')],_0x5c684c[_0xecf8('0x2c')]);_0x3b4495[_0xecf8('0x30')]=_[_0xecf8('0x2f')](_0x5c684c['model'],qs['fields'](_0x2179c7['query']['fields']));_0x3b4495['attributes']=_0x3b4495['attributes'][_0xecf8('0x31')]?_0x3b4495[_0xecf8('0x30')]:_0x5c684c[_0xecf8('0x2b')];if(!_0x2179c7[_0xecf8('0x2c')][_0xecf8('0x32')](_0xecf8('0x33'))){_0x3b4495['limit']=qs[_0xecf8('0x19')](_0x2179c7[_0xecf8('0x2c')]['limit']);_0x3b4495['offset']=qs['offset'](_0x2179c7[_0xecf8('0x2c')][_0xecf8('0x34')]);}_0x3b4495[_0xecf8('0x35')]=qs[_0xecf8('0x36')](_0x2179c7[_0xecf8('0x2c')]['sort']);_0x3b4495[_0xecf8('0x37')]=qs[_0xecf8('0x2e')](_[_0xecf8('0x38')](_0x2179c7[_0xecf8('0x2c')],_0x5c684c[_0xecf8('0x2e')]),_0x28b9c2);if(_0x2179c7['query']['filter']){_0x3b4495['where']=_[_0xecf8('0x39')](_0x3b4495[_0xecf8('0x37')],{'$or':_['map'](_0x28b9c2,function(_0x5ef775){if(_0x5ef775[_0xecf8('0x29')]!==_0xecf8('0x3a')){var _0x1a7fca={};_0x1a7fca[_0x5ef775[_0xecf8('0x24')]]={'$like':'%'+_0x2179c7[_0xecf8('0x2c')]['filter']+'%'};return _0x1a7fca;}})});}_0x3b4495=_['merge']({},_0x3b4495,_0x2179c7[_0xecf8('0x3b')]);var _0x3c69bf={'where':_0x3b4495['where']};return db[_0xecf8('0x27')]['count'](_0x3c69bf)[_0xecf8('0x21')](function(_0x5bdfd7){_0x26d11c['count']=_0x5bdfd7;if(_0x2179c7[_0xecf8('0x2c')][_0xecf8('0x3c')]){_0x3b4495[_0xecf8('0x3d')]=[{'all':!![]}];}return db[_0xecf8('0x27')]['findAll'](_0x3b4495);})[_0xecf8('0x21')](function(_0x1297ff){_0x26d11c[_0xecf8('0x3e')]=_0x1297ff;return _0x26d11c;})[_0xecf8('0x21')](respondWithFilteredResult(_0x59c91a,_0x3b4495))['catch'](handleError(_0x59c91a,null));};exports['show']=function(_0x5ca633,_0x3f1453){var _0x511c8b={'raw':![],'where':{'id':_0x5ca633[_0xecf8('0x3f')]['id']}},_0x53f1e1={};_0x53f1e1['model']=_[_0xecf8('0x2d')](db['IntegrationReport'][_0xecf8('0x28')]);_0x53f1e1[_0xecf8('0x2c')]=_[_0xecf8('0x2d')](_0x5ca633[_0xecf8('0x2c')]);_0x53f1e1[_0xecf8('0x2e')]=_[_0xecf8('0x2f')](_0x53f1e1['model'],_0x53f1e1[_0xecf8('0x2c')]);_0x511c8b['attributes']=_[_0xecf8('0x2f')](_0x53f1e1[_0xecf8('0x2b')],qs[_0xecf8('0x40')](_0x5ca633[_0xecf8('0x2c')][_0xecf8('0x40')]));_0x511c8b['attributes']=_0x511c8b[_0xecf8('0x30')][_0xecf8('0x31')]?_0x511c8b[_0xecf8('0x30')]:_0x53f1e1['model'];if(_0x5ca633['query'][_0xecf8('0x3c')]){_0x511c8b[_0xecf8('0x3d')]=[{'all':!![]}];}_0x511c8b=_[_0xecf8('0x39')]({},_0x511c8b,_0x5ca633['options']);return db[_0xecf8('0x27')][_0xecf8('0x41')](_0x511c8b)['then'](handleEntityNotFound(_0x3f1453,null))['then'](respondWithResult(_0x3f1453,null))[_0xecf8('0x42')](handleError(_0x3f1453,null));};exports[_0xecf8('0x43')]=function(_0x21fdda,_0x11d394){return db[_0xecf8('0x27')]['create'](_0x21fdda[_0xecf8('0x44')],{})[_0xecf8('0x21')](respondWithResult(_0x11d394,0xc9))[_0xecf8('0x42')](handleError(_0x11d394,null));};exports[_0xecf8('0x1f')]=function(_0x232ee0,_0x1f6e44){if(_0x232ee0[_0xecf8('0x44')]['id']){delete _0x232ee0[_0xecf8('0x44')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x232ee0[_0xecf8('0x3f')]['id']}})[_0xecf8('0x21')](handleEntityNotFound(_0x1f6e44,null))['then'](saveUpdates(_0x232ee0[_0xecf8('0x44')],null))['then'](respondWithResult(_0x1f6e44,null))[_0xecf8('0x42')](handleError(_0x1f6e44,null));};exports[_0xecf8('0x20')]=function(_0x197a3f,_0x45b8a0){return db[_0xecf8('0x27')][_0xecf8('0x41')]({'where':{'id':_0x197a3f[_0xecf8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x45b8a0,null))[_0xecf8('0x21')](removeEntity(_0x45b8a0,null))[_0xecf8('0x42')](handleError(_0x45b8a0,null));};exports[_0xecf8('0x45')]=function(_0x4af035,_0x9993d0){return db[_0xecf8('0x27')]['describe']()[_0xecf8('0x21')](respondWithResult(_0x9993d0,null))[_0xecf8('0x42')](handleError(_0x9993d0,null));}; \ No newline at end of file +var _0x63dd=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1efaa8,_0x13ea3d){var _0x402028=function(_0x3d92d5){while(--_0x3d92d5){_0x1efaa8['push'](_0x1efaa8['shift']());}};_0x402028(++_0x13ea3d);}(_0x63dd,0x123));var _0xd63d=function(_0x3c8d82,_0xab4911){_0x3c8d82=_0x3c8d82-0x0;var _0x446e55=_0x63dd[_0x3c8d82];return _0x446e55;};'use strict';var emlformat=require(_0xd63d('0x0'));var rimraf=require(_0xd63d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd63d('0x2'));var rp=require(_0xd63d('0x3'));var moment=require(_0xd63d('0x4'));var BPromise=require(_0xd63d('0x5'));var Mustache=require(_0xd63d('0x6'));var util=require('util');var path=require(_0xd63d('0x7'));var sox=require(_0xd63d('0x8'));var csv=require(_0xd63d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd63d('0xa'));var _=require(_0xd63d('0xb'));var squel=require(_0xd63d('0xc'));var crypto=require(_0xd63d('0xd'));var jsforce=require(_0xd63d('0xe'));var deskjs=require(_0xd63d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd63d('0x10'));var Papa=require(_0xd63d('0x11'));var Redis=require(_0xd63d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd63d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd63d('0x14'));var logger=require(_0xd63d('0x15'))(_0xd63d('0x16'));var utils=require(_0xd63d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd63d('0x18'))['db'];function respondWithStatusCode(_0x352162,_0x3b29e7){_0x3b29e7=_0x3b29e7||0xcc;return function(_0x364dea){if(_0x364dea){return _0x352162[_0xd63d('0x19')](_0x3b29e7);}return _0x352162[_0xd63d('0x1a')](_0x3b29e7)[_0xd63d('0x1b')]();};}function respondWithResult(_0x4429f4,_0xad8e4e){_0xad8e4e=_0xad8e4e||0xc8;return function(_0x4445e3){if(_0x4445e3){return _0x4429f4[_0xd63d('0x1a')](_0xad8e4e)[_0xd63d('0x1c')](_0x4445e3);}};}function respondWithFilteredResult(_0x2331ef,_0x5eb743){return function(_0x1506b0){if(_0x1506b0){var _0x469424=typeof _0x5eb743['offset']===_0xd63d('0x1d')&&typeof _0x5eb743[_0xd63d('0x1e')]===_0xd63d('0x1d');var _0x3d2265=_0x1506b0[_0xd63d('0x1f')];var _0x2d72b3=_0x469424?0x0:_0x5eb743[_0xd63d('0x20')];var _0x33e989=_0x469424?_0x1506b0[_0xd63d('0x1f')]:_0x5eb743[_0xd63d('0x20')]+_0x5eb743[_0xd63d('0x1e')];var _0x34f548;if(_0x33e989>=_0x3d2265){_0x33e989=_0x3d2265;_0x34f548=0xc8;}else{_0x34f548=0xce;}_0x2331ef[_0xd63d('0x1a')](_0x34f548);return _0x2331ef[_0xd63d('0x21')](_0xd63d('0x22'),_0x2d72b3+'-'+_0x33e989+'/'+_0x3d2265)['json'](_0x1506b0);}return null;};}function patchUpdates(_0x1c5fa2){return function(_0x36e104){try{jsonpatch[_0xd63d('0x23')](_0x36e104,_0x1c5fa2,!![]);}catch(_0x1de648){return BPromise[_0xd63d('0x24')](_0x1de648);}return _0x36e104['save']();};}function saveUpdates(_0x4dac56,_0x4e64da){return function(_0x22354a){if(_0x22354a){return _0x22354a[_0xd63d('0x25')](_0x4dac56)[_0xd63d('0x26')](function(_0x28641d){return _0x28641d;});}return null;};}function removeEntity(_0x486891,_0x4dcb54){return function(_0x32564b){if(_0x32564b){return _0x32564b[_0xd63d('0x27')]()[_0xd63d('0x26')](function(){_0x486891['status'](0xcc)[_0xd63d('0x1b')]();});}};}function handleEntityNotFound(_0x383841,_0x55df08){return function(_0x436436){if(!_0x436436){_0x383841[_0xd63d('0x19')](0x194);}return _0x436436;};}function handleError(_0x659201,_0x5dee43){_0x5dee43=_0x5dee43||0x1f4;return function(_0x555e90){logger[_0xd63d('0x28')](_0x555e90[_0xd63d('0x29')]);if(_0x555e90[_0xd63d('0x2a')]){delete _0x555e90[_0xd63d('0x2a')];}_0x659201[_0xd63d('0x1a')](_0x5dee43)[_0xd63d('0x2b')](_0x555e90);};}exports['index']=function(_0x4b9812,_0x4d5fc2){var _0x2e7d09={},_0x53fa54={},_0x239b51={'count':0x0,'rows':[]};var _0x3c84ca=_[_0xd63d('0x2c')](db[_0xd63d('0x2d')][_0xd63d('0x2e')],function(_0x53d614){return{'name':_0x53d614[_0xd63d('0x2f')],'type':_0x53d614[_0xd63d('0x30')][_0xd63d('0x31')]};});_0x53fa54[_0xd63d('0x32')]=_['map'](_0x3c84ca,_0xd63d('0x2a'));_0x53fa54[_0xd63d('0x33')]=_[_0xd63d('0x34')](_0x4b9812[_0xd63d('0x33')]);_0x53fa54[_0xd63d('0x35')]=_[_0xd63d('0x36')](_0x53fa54['model'],_0x53fa54[_0xd63d('0x33')]);_0x2e7d09[_0xd63d('0x37')]=_[_0xd63d('0x36')](_0x53fa54[_0xd63d('0x32')],qs[_0xd63d('0x38')](_0x4b9812[_0xd63d('0x33')]['fields']));_0x2e7d09['attributes']=_0x2e7d09['attributes'][_0xd63d('0x39')]?_0x2e7d09[_0xd63d('0x37')]:_0x53fa54[_0xd63d('0x32')];if(!_0x4b9812[_0xd63d('0x33')][_0xd63d('0x3a')]('nolimit')){_0x2e7d09[_0xd63d('0x1e')]=qs[_0xd63d('0x1e')](_0x4b9812[_0xd63d('0x33')][_0xd63d('0x1e')]);_0x2e7d09['offset']=qs['offset'](_0x4b9812['query']['offset']);}_0x2e7d09[_0xd63d('0x3b')]=qs[_0xd63d('0x3c')](_0x4b9812[_0xd63d('0x33')][_0xd63d('0x3c')]);_0x2e7d09[_0xd63d('0x3d')]=qs['filters'](_[_0xd63d('0x3e')](_0x4b9812[_0xd63d('0x33')],_0x53fa54[_0xd63d('0x35')]),_0x3c84ca);if(_0x4b9812[_0xd63d('0x33')][_0xd63d('0x3f')]){_0x2e7d09[_0xd63d('0x3d')]=_[_0xd63d('0x40')](_0x2e7d09['where'],{'$or':_[_0xd63d('0x2c')](_0x3c84ca,function(_0x263c6d){if(_0x263c6d['type']!==_0xd63d('0x41')){var _0x4016a4={};_0x4016a4[_0x263c6d['name']]={'$like':'%'+_0x4b9812[_0xd63d('0x33')][_0xd63d('0x3f')]+'%'};return _0x4016a4;}})});}_0x2e7d09=_['merge']({},_0x2e7d09,_0x4b9812[_0xd63d('0x42')]);var _0x315b19={'where':_0x2e7d09[_0xd63d('0x3d')]};return db['IntegrationReport'][_0xd63d('0x1f')](_0x315b19)[_0xd63d('0x26')](function(_0x47f685){_0x239b51[_0xd63d('0x1f')]=_0x47f685;if(_0x4b9812[_0xd63d('0x33')]['includeAll']){_0x2e7d09[_0xd63d('0x43')]=[{'all':!![]}];}return db[_0xd63d('0x2d')][_0xd63d('0x44')](_0x2e7d09);})[_0xd63d('0x26')](function(_0x9ba879){_0x239b51[_0xd63d('0x45')]=_0x9ba879;return _0x239b51;})[_0xd63d('0x26')](respondWithFilteredResult(_0x4d5fc2,_0x2e7d09))[_0xd63d('0x46')](handleError(_0x4d5fc2,null));};exports[_0xd63d('0x47')]=function(_0x46b3c5,_0x438a32){var _0x438e3d={'raw':![],'where':{'id':_0x46b3c5[_0xd63d('0x48')]['id']}},_0x658545={};_0x658545[_0xd63d('0x32')]=_[_0xd63d('0x34')](db[_0xd63d('0x2d')][_0xd63d('0x2e')]);_0x658545[_0xd63d('0x33')]=_[_0xd63d('0x34')](_0x46b3c5['query']);_0x658545[_0xd63d('0x35')]=_['intersection'](_0x658545['model'],_0x658545[_0xd63d('0x33')]);_0x438e3d[_0xd63d('0x37')]=_[_0xd63d('0x36')](_0x658545[_0xd63d('0x32')],qs[_0xd63d('0x38')](_0x46b3c5[_0xd63d('0x33')][_0xd63d('0x38')]));_0x438e3d[_0xd63d('0x37')]=_0x438e3d['attributes']['length']?_0x438e3d['attributes']:_0x658545[_0xd63d('0x32')];if(_0x46b3c5[_0xd63d('0x33')][_0xd63d('0x49')]){_0x438e3d[_0xd63d('0x43')]=[{'all':!![]}];}_0x438e3d=_[_0xd63d('0x40')]({},_0x438e3d,_0x46b3c5[_0xd63d('0x42')]);return db[_0xd63d('0x2d')][_0xd63d('0x4a')](_0x438e3d)['then'](handleEntityNotFound(_0x438a32,null))['then'](respondWithResult(_0x438a32,null))['catch'](handleError(_0x438a32,null));};exports[_0xd63d('0x4b')]=function(_0x1f22d3,_0xe5df2b){return db[_0xd63d('0x2d')][_0xd63d('0x4b')](_0x1f22d3['body'],{})[_0xd63d('0x26')](respondWithResult(_0xe5df2b,0xc9))[_0xd63d('0x46')](handleError(_0xe5df2b,null));};exports[_0xd63d('0x25')]=function(_0x209125,_0xd1e22d){if(_0x209125[_0xd63d('0x4c')]['id']){delete _0x209125[_0xd63d('0x4c')]['id'];}return db['IntegrationReport'][_0xd63d('0x4a')]({'where':{'id':_0x209125[_0xd63d('0x48')]['id']}})[_0xd63d('0x26')](handleEntityNotFound(_0xd1e22d,null))[_0xd63d('0x26')](saveUpdates(_0x209125[_0xd63d('0x4c')],null))[_0xd63d('0x26')](respondWithResult(_0xd1e22d,null))['catch'](handleError(_0xd1e22d,null));};exports['destroy']=function(_0x10eb6c,_0x122e9e){return db['IntegrationReport']['find']({'where':{'id':_0x10eb6c[_0xd63d('0x48')]['id']}})[_0xd63d('0x26')](handleEntityNotFound(_0x122e9e,null))[_0xd63d('0x26')](removeEntity(_0x122e9e,null))[_0xd63d('0x46')](handleError(_0x122e9e,null));};exports['describe']=function(_0x389552,_0x33051){return db[_0xd63d('0x2d')]['describe']()['then'](respondWithResult(_0x33051,null))[_0xd63d('0x46')](handleError(_0x33051,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d4ac033..05cafd6 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 _0x1a1d=['IntegrationReport','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x312a3d,_0x1e7969){var _0x5da650=function(_0x6a86ea){while(--_0x6a86ea){_0x312a3d['push'](_0x312a3d['shift']());}};_0x5da650(++_0x1e7969);}(_0x1a1d,0x109));var _0xd1a1=function(_0x4720f5,_0x1c50bf){_0x4720f5=_0x4720f5-0x0;var _0x5d3224=_0x1a1d[_0x4720f5];return _0x5d3224;};'use strict';var _=require(_0xd1a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd1a1('0x1'));var moment=require(_0xd1a1('0x2'));var BPromise=require(_0xd1a1('0x3'));var rp=require(_0xd1a1('0x4'));var fs=require('fs');var path=require(_0xd1a1('0x5'));var rimraf=require('rimraf');var config=require(_0xd1a1('0x6'));var attributes=require(_0xd1a1('0x7'));module[_0xd1a1('0x8')]=function(_0x429814,_0x413a04){return _0x429814[_0xd1a1('0x9')](_0xd1a1('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc31=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./integrationReport.attributes','exports'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xbc31,0x177));var _0x1bc3=function(_0x274b76,_0x4bfb6c){_0x274b76=_0x274b76-0x0;var _0x51bf87=_0xbc31[_0x274b76];return _0x51bf87;};'use strict';var _=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var logger=require(_0x1bc3('0x2'))(_0x1bc3('0x3'));var moment=require('moment');var BPromise=require(_0x1bc3('0x4'));var rp=require(_0x1bc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bc3('0x6'));var config=require('../../config/environment');var attributes=require(_0x1bc3('0x7'));module[_0x1bc3('0x8')]=function(_0x5f126e,_0x409170){return _0x5f126e[_0x1bc3('0x9')](_0x1bc3('0xa'),attributes,{'tableName':_0x1bc3('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 1e9247f..25ea8ee 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 _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xc1983d,_0x28fdcd){_0xc1983d=_0xc1983d-0x0;var _0x3956fb=_0x7a54[_0xc1983d];return _0x3956fb;};'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')]('IntegrationReport,\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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36398d,_0xf8e34){var _0x1d6f5c=function(_0x5867ce){while(--_0x5867ce){_0x36398d['push'](_0x36398d['shift']());}};_0x1d6f5c(++_0xf8e34);}(_0xda19,0xd5));var _0x9da1=function(_0x3dffb9,_0x337545){_0x3dffb9=_0x3dffb9-0x0;var _0x12fce4=_0xda19[_0x3dffb9];return _0x12fce4;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f9a661c..456ab89 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 _0x8343=['exports','multer','util','path','express','fs-extra','./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy'];(function(_0x420951,_0x528d19){var _0x8a0fd5=function(_0x48b4af){while(--_0x48b4af){_0x420951['push'](_0x420951['shift']());}};_0x8a0fd5(++_0x528d19);}(_0x8343,0xa9));var _0x3834=function(_0x149eaa,_0x526c54){_0x149eaa=_0x149eaa-0x0;var _0x48fd5e=_0x8343[_0x149eaa];return _0x48fd5e;};'use strict';var multer=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var path=require(_0x3834('0x2'));var timeout=require('connect-timeout');var express=require(_0x3834('0x3'));var router=express['Router']();var fs_extra=require(_0x3834('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3834('0x5'));router[_0x3834('0x6')]('/',auth[_0x3834('0x7')](),controller['index']);router[_0x3834('0x6')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x9')]);router['get']('/:id/sub_intervals',auth[_0x3834('0x7')](),controller[_0x3834('0xa')]);router[_0x3834('0xb')]('/',auth[_0x3834('0x7')](),controller[_0x3834('0xc')]);router['post'](_0x3834('0xd'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x3834('0xe'),auth[_0x3834('0x7')](),controller[_0x3834('0xf')]);router[_0x3834('0x10')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x11')]);router[_0x3834('0x12')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x13')]);module[_0x3834('0x14')]=router; \ No newline at end of file +var _0x444f=['isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id'];(function(_0x525902,_0x3853e1){var _0x57059f=function(_0x3ec7fb){while(--_0x3ec7fb){_0x525902['push'](_0x525902['shift']());}};_0x57059f(++_0x3853e1);}(_0x444f,0xb5));var _0xf444=function(_0x5230ed,_0x2eb03e){_0x5230ed=_0x5230ed-0x0;var _0x43bb42=_0x444f[_0x5230ed];return _0x43bb42;};'use strict';var multer=require('multer');var util=require(_0xf444('0x0'));var path=require(_0xf444('0x1'));var timeout=require(_0xf444('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf444('0x3'));var auth=require(_0xf444('0x4'));var interaction=require(_0xf444('0x5'));var config=require(_0xf444('0x6'));var controller=require(_0xf444('0x7'));router[_0xf444('0x8')]('/',auth['isAuthenticated'](),controller[_0xf444('0x9')]);router[_0xf444('0x8')](_0xf444('0xa'),auth[_0xf444('0xb')](),controller[_0xf444('0xc')]);router['get'](_0xf444('0xd'),auth[_0xf444('0xb')](),controller[_0xf444('0xe')]);router[_0xf444('0xf')]('/',auth[_0xf444('0xb')](),controller[_0xf444('0x10')]);router[_0xf444('0xf')](_0xf444('0xd'),auth[_0xf444('0xb')](),controller[_0xf444('0x11')]);router['post']('/:id/sub_intervals/create_many',auth[_0xf444('0xb')](),controller[_0xf444('0x12')]);router[_0xf444('0x13')](_0xf444('0xa'),auth[_0xf444('0xb')](),controller[_0xf444('0x14')]);router[_0xf444('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf444('0x16')]);module[_0xf444('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 400bb07..5aa3166 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 _0x56f2=['STRING','sequelize','exports'];(function(_0x1587c7,_0x5bbff4){var _0x42cc4f=function(_0x36bb87){while(--_0x36bb87){_0x1587c7['push'](_0x1587c7['shift']());}};_0x42cc4f(++_0x5bbff4);}(_0x56f2,0xc4));var _0x256f=function(_0x5b7070,_0x2ef3e9){_0x5b7070=_0x5b7070-0x0;var _0x582712=_0x56f2[_0x5b7070];return _0x582712;};'use strict';var Sequelize=require(_0x256f('0x0'));module[_0x256f('0x1')]={'name':{'type':Sequelize[_0x256f('0x2')]},'description':{'type':Sequelize[_0x256f('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7536=['STRING'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x7536,0x1c8));var _0x6753=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0x7536[_0x5b311b];return _0x4fa0de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6753('0x0')]},'description':{'type':Sequelize[_0x6753('0x0')]},'interval':{'type':Sequelize[_0x6753('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 339981d..74a0912 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 _0x2402=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','show','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','order','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','stack','name','index','type','key','model','map','query','keys','attributes'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x2402,0x84));var _0x2240=function(_0xe38118,_0x2b4c34){_0xe38118=_0xe38118-0x0;var _0x2d6e91=_0x2402[_0xe38118];return _0x2d6e91;};'use strict';var emlformat=require(_0x2240('0x0'));var rimraf=require(_0x2240('0x1'));var zipdir=require(_0x2240('0x2'));var jsonpatch=require(_0x2240('0x3'));var rp=require(_0x2240('0x4'));var moment=require('moment');var BPromise=require(_0x2240('0x5'));var Mustache=require(_0x2240('0x6'));var util=require('util');var path=require(_0x2240('0x7'));var sox=require(_0x2240('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2240('0x9'));var _=require(_0x2240('0xa'));var squel=require(_0x2240('0xb'));var crypto=require('crypto');var jsforce=require(_0x2240('0xc'));var deskjs=require(_0x2240('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2240('0xe'));var Papa=require(_0x2240('0xf'));var Redis=require(_0x2240('0x10'));var authService=require(_0x2240('0x11'));var qs=require(_0x2240('0x12'));var as=require(_0x2240('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2240('0x14'))('api');var utils=require(_0x2240('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2240('0x16'));var db=require(_0x2240('0x17'))['db'];var extensions=require(_0x2240('0x18'));function respondWithStatusCode(_0x3b306a,_0x86c5f2){_0x86c5f2=_0x86c5f2||0xcc;return function(_0x478d7e){if(_0x478d7e){return _0x3b306a[_0x2240('0x19')](_0x86c5f2);}return _0x3b306a['status'](_0x86c5f2)[_0x2240('0x1a')]();};}function respondWithResult(_0x1d4e63,_0xf7b89c){_0xf7b89c=_0xf7b89c||0xc8;return function(_0x4b8462){if(_0x4b8462){return _0x1d4e63[_0x2240('0x1b')](_0xf7b89c)['json'](_0x4b8462);}};}function respondWithFilteredResult(_0xf4904,_0xa6b5b3){return function(_0x5711fc){if(_0x5711fc){var _0x2017b9=typeof _0xa6b5b3[_0x2240('0x1c')]==='undefined'&&typeof _0xa6b5b3[_0x2240('0x1d')]===_0x2240('0x1e');var _0x53ad9c=_0x5711fc[_0x2240('0x1f')];var _0x58bee8=_0x2017b9?0x0:_0xa6b5b3[_0x2240('0x1c')];var _0x3d3d3e=_0x2017b9?_0x5711fc[_0x2240('0x1f')]:_0xa6b5b3[_0x2240('0x1c')]+_0xa6b5b3[_0x2240('0x1d')];var _0x2cd6b5;if(_0x3d3d3e>=_0x53ad9c){_0x3d3d3e=_0x53ad9c;_0x2cd6b5=0xc8;}else{_0x2cd6b5=0xce;}_0xf4904[_0x2240('0x1b')](_0x2cd6b5);return _0xf4904['set'](_0x2240('0x20'),_0x58bee8+'-'+_0x3d3d3e+'/'+_0x53ad9c)['json'](_0x5711fc);}return null;};}function patchUpdates(_0xb4636c){return function(_0x5892bc){try{jsonpatch[_0x2240('0x21')](_0x5892bc,_0xb4636c,!![]);}catch(_0x1fd84a){return BPromise[_0x2240('0x22')](_0x1fd84a);}return _0x5892bc['save']();};}function saveUpdates(_0x5608ca,_0x1f8553){return function(_0x294e00){if(_0x294e00){return _0x294e00[_0x2240('0x23')](_0x5608ca)['then'](function(_0x57f026){return _0x57f026;});}return null;};}function removeEntity(_0x418304,_0x533585){return function(_0x53b222){if(_0x53b222){return _0x53b222[_0x2240('0x24')]()[_0x2240('0x25')](function(){var _0x1ed8b4=_0x53b222['get']({'plain':!![]});var _0xf662e4='Intervals';return db['UserProfileResource'][_0x2240('0x24')]({'where':{'type':_0xf662e4,'resourceId':_0x1ed8b4['id']}})[_0x2240('0x25')](function(){return _0x53b222;});})[_0x2240('0x25')](function(){_0x418304[_0x2240('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24784a,_0x41368d){return function(_0xa7a877){if(!_0xa7a877){_0x24784a[_0x2240('0x19')](0x194);}return _0xa7a877;};}function handleError(_0x5481cc,_0x4f5eb9){_0x4f5eb9=_0x4f5eb9||0x1f4;return function(_0x40a7a5){logger['error'](_0x40a7a5[_0x2240('0x26')]);if(_0x40a7a5[_0x2240('0x27')]){delete _0x40a7a5[_0x2240('0x27')];}_0x5481cc['status'](_0x4f5eb9)['send'](_0x40a7a5);};}exports[_0x2240('0x28')]=function(_0x53c141,_0x2a0363){var _0x1affda={},_0x117543={},_0xf3e13={'count':0x0,'rows':[]};var _0x1240d2=_['map'](db['Interval']['rawAttributes'],function(_0x360f5b){return{'name':_0x360f5b['fieldName'],'type':_0x360f5b[_0x2240('0x29')][_0x2240('0x2a')]};});_0x117543[_0x2240('0x2b')]=_[_0x2240('0x2c')](_0x1240d2,_0x2240('0x27'));_0x117543[_0x2240('0x2d')]=_[_0x2240('0x2e')](_0x53c141[_0x2240('0x2d')]);_0x117543['filters']=_['intersection'](_0x117543['model'],_0x117543[_0x2240('0x2d')]);_0x1affda[_0x2240('0x2f')]=_[_0x2240('0x30')](_0x117543[_0x2240('0x2b')],qs[_0x2240('0x31')](_0x53c141['query'][_0x2240('0x31')]));_0x1affda['attributes']=_0x1affda[_0x2240('0x2f')][_0x2240('0x32')]?_0x1affda[_0x2240('0x2f')]:_0x117543[_0x2240('0x2b')];if(!_0x53c141[_0x2240('0x2d')][_0x2240('0x33')](_0x2240('0x34'))){_0x1affda[_0x2240('0x1d')]=qs[_0x2240('0x1d')](_0x53c141['query']['limit']);_0x1affda['offset']=qs[_0x2240('0x1c')](_0x53c141[_0x2240('0x2d')][_0x2240('0x1c')]);}_0x1affda['order']=qs[_0x2240('0x35')](_0x53c141[_0x2240('0x2d')][_0x2240('0x35')]);_0x1affda[_0x2240('0x36')]=qs[_0x2240('0x37')](_[_0x2240('0x38')](_0x53c141[_0x2240('0x2d')],_0x117543[_0x2240('0x37')]),_0x1240d2);if(_0x53c141['query'][_0x2240('0x39')]){_0x1affda['where']=_[_0x2240('0x3a')](_0x1affda['where'],{'$or':_[_0x2240('0x2c')](_0x1240d2,function(_0x1d485c){if(_0x1d485c['type']!=='VIRTUAL'){var _0x4f9b36={};_0x4f9b36[_0x1d485c[_0x2240('0x27')]]={'$like':'%'+_0x53c141[_0x2240('0x2d')][_0x2240('0x39')]+'%'};return _0x4f9b36;}})});}_0x1affda=_[_0x2240('0x3a')]({},_0x1affda,_0x53c141[_0x2240('0x3b')]);var _0x33a38d={'where':_0x1affda[_0x2240('0x36')]};return db[_0x2240('0x3c')]['count'](_0x33a38d)[_0x2240('0x25')](function(_0x363083){_0xf3e13[_0x2240('0x1f')]=_0x363083;if(_0x53c141[_0x2240('0x2d')][_0x2240('0x3d')]){_0x1affda[_0x2240('0x3e')]=[{'all':!![]}];}return db[_0x2240('0x3c')][_0x2240('0x3f')](_0x1affda);})[_0x2240('0x25')](function(_0x33e271){_0xf3e13[_0x2240('0x40')]=_0x33e271;return _0xf3e13;})[_0x2240('0x25')](respondWithFilteredResult(_0x2a0363,_0x1affda))['catch'](handleError(_0x2a0363,null));};exports[_0x2240('0x41')]=function(_0x3050e2,_0x52b74d){var _0x535fca={'raw':!![],'where':{'id':_0x3050e2['params']['id']}},_0x3f9e14={};_0x3f9e14[_0x2240('0x2b')]=_['keys'](db[_0x2240('0x3c')][_0x2240('0x42')]);_0x3f9e14[_0x2240('0x2d')]=_['keys'](_0x3050e2[_0x2240('0x2d')]);_0x3f9e14[_0x2240('0x37')]=_['intersection'](_0x3f9e14['model'],_0x3f9e14[_0x2240('0x2d')]);_0x535fca['attributes']=_[_0x2240('0x30')](_0x3f9e14[_0x2240('0x2b')],qs['fields'](_0x3050e2['query'][_0x2240('0x31')]));_0x535fca['attributes']=_0x535fca[_0x2240('0x2f')][_0x2240('0x32')]?_0x535fca['attributes']:_0x3f9e14[_0x2240('0x2b')];if(_0x3050e2[_0x2240('0x2d')]['includeAll']){_0x535fca[_0x2240('0x3e')]=[{'all':!![]}];}_0x535fca=_[_0x2240('0x3a')]({},_0x535fca,_0x3050e2[_0x2240('0x3b')]);return db[_0x2240('0x3c')][_0x2240('0x43')](_0x535fca)[_0x2240('0x25')](handleEntityNotFound(_0x52b74d,null))[_0x2240('0x25')](respondWithResult(_0x52b74d,null))['catch'](handleError(_0x52b74d,null));};exports[_0x2240('0x44')]=function(_0x24c0c7,_0x122177){return db[_0x2240('0x3c')][_0x2240('0x44')](_0x24c0c7['body'],{})[_0x2240('0x25')](function(_0x547822){var _0x35cc0f=_0x24c0c7[_0x2240('0x45')][_0x2240('0x46')]({'plain':!![]});if(!_0x35cc0f)throw new Error(_0x2240('0x47'));if(_0x35cc0f[_0x2240('0x48')]===_0x2240('0x45')){var _0x74d1=_0x547822['get']({'plain':!![]});var _0x55c61a=_0x2240('0x49');return db[_0x2240('0x4a')][_0x2240('0x43')]({'where':{'name':_0x55c61a,'userProfileId':_0x35cc0f[_0x2240('0x4b')]},'raw':!![]})[_0x2240('0x25')](function(_0x2fe17c){if(_0x2fe17c&&_0x2fe17c['autoAssociation']===0x0){return db[_0x2240('0x4c')][_0x2240('0x44')]({'name':_0x74d1[_0x2240('0x27')],'resourceId':_0x74d1['id'],'type':_0x2fe17c[_0x2240('0x27')],'sectionId':_0x2fe17c['id']},{})['then'](function(){return _0x547822;});}else{return _0x547822;}})[_0x2240('0x4d')](function(_0x2cad00){logger[_0x2240('0x4e')](_0x2240('0x4f'),_0x2cad00);throw _0x2cad00;});}return _0x547822;})['then'](respondWithResult(_0x122177,0xc9))[_0x2240('0x4d')](handleError(_0x122177,null));};exports[_0x2240('0x23')]=function(_0x5f2d8f,_0x3a29f6){if(_0x5f2d8f[_0x2240('0x50')]['id']){delete _0x5f2d8f[_0x2240('0x50')]['id'];}return db[_0x2240('0x3c')]['find']({'where':{'id':_0x5f2d8f[_0x2240('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a29f6,null))[_0x2240('0x25')](saveUpdates(_0x5f2d8f['body'],null))[_0x2240('0x25')](respondWithResult(_0x3a29f6,null))[_0x2240('0x4d')](handleError(_0x3a29f6,null));};exports[_0x2240('0x24')]=function(_0xefc9,_0x1d50cb){return db[_0x2240('0x3c')][_0x2240('0x43')]({'where':{'id':_0xefc9[_0x2240('0x51')]['id']}})[_0x2240('0x25')](handleEntityNotFound(_0x1d50cb,null))['then'](removeEntity(_0x1d50cb,null))[_0x2240('0x4d')](handleError(_0x1d50cb,null));};exports[_0x2240('0x52')]=function(_0x40c6ad,_0x1674dc,_0x1a8f5c){if(_0x40c6ad[_0x2240('0x50')]['id']){delete _0x40c6ad['body']['id'];}return db[_0x2240('0x3c')][_0x2240('0x43')]({'where':{'id':_0x40c6ad['params']['id']}})[_0x2240('0x25')](handleEntityNotFound(_0x1674dc,null))['then'](function(_0x220039){if(_0x220039){_0x40c6ad[_0x2240('0x50')]['IntervalId']=_0x220039['id'];return db['Interval']['create'](_0x40c6ad['body']);}})[_0x2240('0x25')](respondWithResult(_0x1674dc,null))[_0x2240('0x4d')](handleError(_0x1674dc,null));};exports[_0x2240('0x53')]=function(_0x540757,_0x4a90c9,_0x35b011){var _0x3795db={};var _0x248aec={};var _0x4f305f;var _0xaae83d;return db[_0x2240('0x3c')]['findOne']({'where':{'id':_0x540757[_0x2240('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a90c9,null))[_0x2240('0x25')](function(_0x2d2b9e){if(_0x2d2b9e){_0x4f305f=_0x2d2b9e;_0x248aec[_0x2240('0x2b')]=_[_0x2240('0x2e')](db[_0x2240('0x3c')]['rawAttributes']);_0x248aec[_0x2240('0x2d')]=_[_0x2240('0x2e')](_0x540757['query']);_0x248aec['filters']=_[_0x2240('0x30')](_0x248aec[_0x2240('0x2b')],_0x248aec[_0x2240('0x2d')]);_0x3795db[_0x2240('0x2f')]=_[_0x2240('0x30')](_0x248aec[_0x2240('0x2b')],qs[_0x2240('0x31')](_0x540757['query'][_0x2240('0x31')]));_0x3795db[_0x2240('0x2f')]=_0x3795db['attributes'][_0x2240('0x32')]?_0x3795db[_0x2240('0x2f')]:_0x248aec[_0x2240('0x2b')];_0x3795db[_0x2240('0x54')]=qs['sort'](_0x540757['query'][_0x2240('0x35')]);_0x3795db[_0x2240('0x36')]=qs[_0x2240('0x37')](_[_0x2240('0x38')](_0x540757[_0x2240('0x2d')],_0x248aec['filters']));if(_0x540757[_0x2240('0x2d')][_0x2240('0x39')]){_0x3795db[_0x2240('0x36')]=_[_0x2240('0x3a')](_0x3795db['where'],{'$or':_[_0x2240('0x2c')](_0x3795db[_0x2240('0x2f')],function(_0x2bdfa0){var _0x351fd7={};_0x351fd7[_0x2bdfa0]={'$like':'%'+_0x540757[_0x2240('0x2d')][_0x2240('0x39')]+'%'};return _0x351fd7;})});}_0x3795db=_[_0x2240('0x3a')]({},_0x3795db,_0x540757[_0x2240('0x3b')]);return _0x4f305f[_0x2240('0x53')](_0x3795db);}})['then'](function(_0x4e139d){if(_0x4e139d){_0xaae83d=_0x4e139d[_0x2240('0x32')];if(!_0x540757[_0x2240('0x2d')][_0x2240('0x33')](_0x2240('0x34'))){_0x3795db[_0x2240('0x1d')]=qs[_0x2240('0x1d')](_0x540757['query'][_0x2240('0x1d')]);_0x3795db[_0x2240('0x1c')]=qs[_0x2240('0x1c')](_0x540757[_0x2240('0x2d')][_0x2240('0x1c')]);}return _0x4f305f[_0x2240('0x53')](_0x3795db);}})['then'](function(_0x57b0f8){if(_0x57b0f8){return _0x57b0f8?{'count':_0xaae83d,'rows':_0x57b0f8}:null;}})[_0x2240('0x25')](respondWithResult(_0x4a90c9,null))[_0x2240('0x4d')](handleError(_0x4a90c9,null));};exports[_0x2240('0x55')]=function(_0x3399e1,_0x21b649,_0x3360d3){return db[_0x2240('0x3c')]['findOne']({'where':{'id':_0x3399e1[_0x2240('0x51')]['id']}})[_0x2240('0x25')](handleEntityNotFound(_0x21b649,null))['then'](function(_0x586af5){if(_0x586af5){return db[_0x2240('0x56')][_0x2240('0x57')](function(_0x3b0e34){return db[_0x2240('0x3c')][_0x2240('0x24')]({'where':{'IntervalId':_0x3399e1[_0x2240('0x51')]['id']},'transaction':_0x3b0e34})['then'](function(_0x416e0a){var _0x5684e3=_[_0x2240('0x2c')](_0x3399e1[_0x2240('0x50')],function(_0x1b4c07){delete _0x1b4c07['id'];_0x1b4c07[_0x2240('0x58')]=_0x3399e1['params']['id'];return _0x1b4c07;});return db[_0x2240('0x3c')][_0x2240('0x59')](_0x5684e3,{'transaction':_0x3b0e34});});})[_0x2240('0x25')](function(){return db[_0x2240('0x3c')][_0x2240('0x3f')]({'where':{'IntervalId':_0x3399e1[_0x2240('0x51')]['id']}});});}})[_0x2240('0x25')](respondWithResult(_0x21b649,null))[_0x2240('0x4d')](handleError(_0x21b649,null));}; \ No newline at end of file +var _0x851a=['Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','count','Content-Range','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','stack','name','map'];(function(_0x27f928,_0x1c7456){var _0x1519fb=function(_0x43db75){while(--_0x43db75){_0x27f928['push'](_0x27f928['shift']());}};_0x1519fb(++_0x1c7456);}(_0x851a,0x8a));var _0xa851=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x851a[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0xa851('0x0'));var rimraf=require(_0xa851('0x1'));var zipdir=require(_0xa851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa851('0x3'));var moment=require(_0xa851('0x4'));var BPromise=require(_0xa851('0x5'));var Mustache=require(_0xa851('0x6'));var util=require(_0xa851('0x7'));var path=require('path');var sox=require(_0xa851('0x8'));var csv=require(_0xa851('0x9'));var ejs=require(_0xa851('0xa'));var fs=require('fs');var fs_extra=require(_0xa851('0xb'));var _=require(_0xa851('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa851('0xd'));var toCsv=require(_0xa851('0x9'));var querystring=require(_0xa851('0xe'));var Papa=require(_0xa851('0xf'));var Redis=require(_0xa851('0x10'));var authService=require(_0xa851('0x11'));var qs=require(_0xa851('0x12'));var as=require(_0xa851('0x13'));var hardwareService=require(_0xa851('0x14'));var logger=require(_0xa851('0x15'))(_0xa851('0x16'));var utils=require(_0xa851('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa851('0x18'))['db'];var extensions=require(_0xa851('0x19'));function respondWithStatusCode(_0x111906,_0x57ac76){_0x57ac76=_0x57ac76||0xcc;return function(_0x3d89bf){if(_0x3d89bf){return _0x111906['sendStatus'](_0x57ac76);}return _0x111906[_0xa851('0x1a')](_0x57ac76)[_0xa851('0x1b')]();};}function respondWithResult(_0x2544e5,_0x39b25e){_0x39b25e=_0x39b25e||0xc8;return function(_0x1ddd95){if(_0x1ddd95){return _0x2544e5[_0xa851('0x1a')](_0x39b25e)[_0xa851('0x1c')](_0x1ddd95);}};}function respondWithFilteredResult(_0x1661b5,_0xb0d50f){return function(_0x29feaa){if(_0x29feaa){var _0x15c767=typeof _0xb0d50f[_0xa851('0x1d')]==='undefined'&&typeof _0xb0d50f['limit']==='undefined';var _0x1f7f67=_0x29feaa['count'];var _0x37eb8e=_0x15c767?0x0:_0xb0d50f[_0xa851('0x1d')];var _0x12d165=_0x15c767?_0x29feaa[_0xa851('0x1e')]:_0xb0d50f[_0xa851('0x1d')]+_0xb0d50f['limit'];var _0x107575;if(_0x12d165>=_0x1f7f67){_0x12d165=_0x1f7f67;_0x107575=0xc8;}else{_0x107575=0xce;}_0x1661b5[_0xa851('0x1a')](_0x107575);return _0x1661b5['set'](_0xa851('0x1f'),_0x37eb8e+'-'+_0x12d165+'/'+_0x1f7f67)[_0xa851('0x1c')](_0x29feaa);}return null;};}function patchUpdates(_0x38a6f5){return function(_0x3b80e4){try{jsonpatch['apply'](_0x3b80e4,_0x38a6f5,!![]);}catch(_0x88add9){return BPromise['reject'](_0x88add9);}return _0x3b80e4[_0xa851('0x20')]();};}function saveUpdates(_0xc1fc6d,_0x5505bf){return function(_0x13ffbe){if(_0x13ffbe){return _0x13ffbe[_0xa851('0x21')](_0xc1fc6d)[_0xa851('0x22')](function(_0x43075d){return _0x43075d;});}return null;};}function removeEntity(_0xb0cc89,_0x256093){return function(_0x190cad){if(_0x190cad){return _0x190cad[_0xa851('0x23')]()[_0xa851('0x22')](function(){var _0x409055=_0x190cad[_0xa851('0x24')]({'plain':!![]});var _0x2af044=_0xa851('0x25');return db[_0xa851('0x26')]['destroy']({'where':{'type':_0x2af044,'resourceId':_0x409055['id']}})[_0xa851('0x22')](function(){return _0x190cad;});})[_0xa851('0x22')](function(){_0xb0cc89[_0xa851('0x1a')](0xcc)[_0xa851('0x1b')]();});}};}function handleEntityNotFound(_0xe04ca8,_0x2a94b8){return function(_0x574caa){if(!_0x574caa){_0xe04ca8[_0xa851('0x27')](0x194);}return _0x574caa;};}function handleError(_0x419ab5,_0x53b359){_0x53b359=_0x53b359||0x1f4;return function(_0x222418){logger[_0xa851('0x28')](_0x222418[_0xa851('0x29')]);if(_0x222418[_0xa851('0x2a')]){delete _0x222418[_0xa851('0x2a')];}_0x419ab5[_0xa851('0x1a')](_0x53b359)['send'](_0x222418);};}exports['index']=function(_0x44f6a9,_0x2ccf96){var _0x5512c8={},_0x1a64cb={},_0xc8a783={'count':0x0,'rows':[]};var _0x1bcc0f=_[_0xa851('0x2b')](db[_0xa851('0x2c')][_0xa851('0x2d')],function(_0x39fb74){return{'name':_0x39fb74[_0xa851('0x2e')],'type':_0x39fb74[_0xa851('0x2f')][_0xa851('0x30')]};});_0x1a64cb[_0xa851('0x31')]=_[_0xa851('0x2b')](_0x1bcc0f,_0xa851('0x2a'));_0x1a64cb[_0xa851('0x32')]=_['keys'](_0x44f6a9[_0xa851('0x32')]);_0x1a64cb[_0xa851('0x33')]=_[_0xa851('0x34')](_0x1a64cb[_0xa851('0x31')],_0x1a64cb[_0xa851('0x32')]);_0x5512c8[_0xa851('0x35')]=_[_0xa851('0x34')](_0x1a64cb[_0xa851('0x31')],qs['fields'](_0x44f6a9['query']['fields']));_0x5512c8[_0xa851('0x35')]=_0x5512c8[_0xa851('0x35')][_0xa851('0x36')]?_0x5512c8['attributes']:_0x1a64cb[_0xa851('0x31')];if(!_0x44f6a9['query'][_0xa851('0x37')]('nolimit')){_0x5512c8['limit']=qs[_0xa851('0x38')](_0x44f6a9[_0xa851('0x32')][_0xa851('0x38')]);_0x5512c8[_0xa851('0x1d')]=qs['offset'](_0x44f6a9[_0xa851('0x32')][_0xa851('0x1d')]);}_0x5512c8[_0xa851('0x39')]=qs['sort'](_0x44f6a9[_0xa851('0x32')][_0xa851('0x3a')]);_0x5512c8[_0xa851('0x3b')]=qs['filters'](_[_0xa851('0x3c')](_0x44f6a9[_0xa851('0x32')],_0x1a64cb['filters']),_0x1bcc0f);if(_0x44f6a9['query'][_0xa851('0x3d')]){_0x5512c8['where']=_['merge'](_0x5512c8[_0xa851('0x3b')],{'$or':_[_0xa851('0x2b')](_0x1bcc0f,function(_0x5666b1){if(_0x5666b1[_0xa851('0x2f')]!==_0xa851('0x3e')){var _0x4530a9={};_0x4530a9[_0x5666b1['name']]={'$like':'%'+_0x44f6a9['query']['filter']+'%'};return _0x4530a9;}})});}_0x5512c8=_[_0xa851('0x3f')]({},_0x5512c8,_0x44f6a9[_0xa851('0x40')]);var _0x2a10bd={'where':_0x5512c8[_0xa851('0x3b')]};return db[_0xa851('0x2c')]['count'](_0x2a10bd)[_0xa851('0x22')](function(_0x3199d3){_0xc8a783[_0xa851('0x1e')]=_0x3199d3;if(_0x44f6a9[_0xa851('0x32')][_0xa851('0x41')]){_0x5512c8[_0xa851('0x42')]=[{'all':!![]}];}return db['Interval'][_0xa851('0x43')](_0x5512c8);})['then'](function(_0x131fca){_0xc8a783[_0xa851('0x44')]=_0x131fca;return _0xc8a783;})['then'](respondWithFilteredResult(_0x2ccf96,_0x5512c8))['catch'](handleError(_0x2ccf96,null));};exports['show']=function(_0x4c4861,_0x1f8857){var _0x4881f6={'raw':!![],'where':{'id':_0x4c4861[_0xa851('0x45')]['id']}},_0x31a278={};_0x31a278['model']=_[_0xa851('0x46')](db[_0xa851('0x2c')][_0xa851('0x2d')]);_0x31a278[_0xa851('0x32')]=_[_0xa851('0x46')](_0x4c4861[_0xa851('0x32')]);_0x31a278[_0xa851('0x33')]=_[_0xa851('0x34')](_0x31a278['model'],_0x31a278[_0xa851('0x32')]);_0x4881f6[_0xa851('0x35')]=_['intersection'](_0x31a278[_0xa851('0x31')],qs[_0xa851('0x47')](_0x4c4861[_0xa851('0x32')][_0xa851('0x47')]));_0x4881f6[_0xa851('0x35')]=_0x4881f6[_0xa851('0x35')][_0xa851('0x36')]?_0x4881f6[_0xa851('0x35')]:_0x31a278[_0xa851('0x31')];if(_0x4c4861[_0xa851('0x32')]['includeAll']){_0x4881f6['include']=[{'all':!![]}];}_0x4881f6=_[_0xa851('0x3f')]({},_0x4881f6,_0x4c4861['options']);return db['Interval'][_0xa851('0x48')](_0x4881f6)['then'](handleEntityNotFound(_0x1f8857,null))[_0xa851('0x22')](respondWithResult(_0x1f8857,null))['catch'](handleError(_0x1f8857,null));};exports[_0xa851('0x49')]=function(_0x1e9ee4,_0x285159){return db[_0xa851('0x2c')]['create'](_0x1e9ee4[_0xa851('0x4a')],{})[_0xa851('0x22')](function(_0x3a38ba){var _0x4ecc0a=_0x1e9ee4[_0xa851('0x4b')][_0xa851('0x24')]({'plain':!![]});if(!_0x4ecc0a)throw new Error(_0xa851('0x4c'));if(_0x4ecc0a[_0xa851('0x4d')]===_0xa851('0x4b')){var _0x5a68bf=_0x3a38ba[_0xa851('0x24')]({'plain':!![]});var _0x496922=_0xa851('0x25');return db[_0xa851('0x4e')]['find']({'where':{'name':_0x496922,'userProfileId':_0x4ecc0a[_0xa851('0x4f')]},'raw':!![]})[_0xa851('0x22')](function(_0x1efc6b){if(_0x1efc6b&&_0x1efc6b[_0xa851('0x50')]===0x0){return db[_0xa851('0x26')][_0xa851('0x49')]({'name':_0x5a68bf[_0xa851('0x2a')],'resourceId':_0x5a68bf['id'],'type':_0x1efc6b[_0xa851('0x2a')],'sectionId':_0x1efc6b['id']},{})[_0xa851('0x22')](function(){return _0x3a38ba;});}else{return _0x3a38ba;}})[_0xa851('0x51')](function(_0x2a532c){logger['error'](_0xa851('0x52'),_0x2a532c);throw _0x2a532c;});}return _0x3a38ba;})[_0xa851('0x22')](respondWithResult(_0x285159,0xc9))[_0xa851('0x51')](handleError(_0x285159,null));};exports[_0xa851('0x21')]=function(_0x555c1d,_0x3008ca){if(_0x555c1d[_0xa851('0x4a')]['id']){delete _0x555c1d[_0xa851('0x4a')]['id'];}return db[_0xa851('0x2c')][_0xa851('0x48')]({'where':{'id':_0x555c1d[_0xa851('0x45')]['id']}})[_0xa851('0x22')](handleEntityNotFound(_0x3008ca,null))['then'](saveUpdates(_0x555c1d[_0xa851('0x4a')],null))[_0xa851('0x22')](respondWithResult(_0x3008ca,null))['catch'](handleError(_0x3008ca,null));};exports[_0xa851('0x23')]=function(_0x3b862b,_0x136539){return db[_0xa851('0x2c')][_0xa851('0x48')]({'where':{'id':_0x3b862b[_0xa851('0x45')]['id']}})['then'](handleEntityNotFound(_0x136539,null))[_0xa851('0x22')](removeEntity(_0x136539,null))['catch'](handleError(_0x136539,null));};exports[_0xa851('0x53')]=function(_0x338017,_0x5b6015,_0x2843f9){if(_0x338017[_0xa851('0x4a')]['id']){delete _0x338017[_0xa851('0x4a')]['id'];}return db['Interval'][_0xa851('0x48')]({'where':{'id':_0x338017['params']['id']}})[_0xa851('0x22')](handleEntityNotFound(_0x5b6015,null))[_0xa851('0x22')](function(_0x42ada7){if(_0x42ada7){_0x338017[_0xa851('0x4a')][_0xa851('0x54')]=_0x42ada7['id'];return db[_0xa851('0x2c')][_0xa851('0x49')](_0x338017[_0xa851('0x4a')]);}})[_0xa851('0x22')](respondWithResult(_0x5b6015,null))[_0xa851('0x51')](handleError(_0x5b6015,null));};exports['getIntervals']=function(_0x5964dd,_0x575688,_0xdbd8db){var _0x46597e={};var _0x5daacf={};var _0x360d00;var _0x45e82c;return db['Interval'][_0xa851('0x55')]({'where':{'id':_0x5964dd['params']['id']}})[_0xa851('0x22')](handleEntityNotFound(_0x575688,null))[_0xa851('0x22')](function(_0x4c1d5e){if(_0x4c1d5e){_0x360d00=_0x4c1d5e;_0x5daacf[_0xa851('0x31')]=_['keys'](db[_0xa851('0x2c')]['rawAttributes']);_0x5daacf[_0xa851('0x32')]=_[_0xa851('0x46')](_0x5964dd[_0xa851('0x32')]);_0x5daacf[_0xa851('0x33')]=_[_0xa851('0x34')](_0x5daacf[_0xa851('0x31')],_0x5daacf[_0xa851('0x32')]);_0x46597e[_0xa851('0x35')]=_[_0xa851('0x34')](_0x5daacf['model'],qs['fields'](_0x5964dd[_0xa851('0x32')][_0xa851('0x47')]));_0x46597e[_0xa851('0x35')]=_0x46597e[_0xa851('0x35')]['length']?_0x46597e[_0xa851('0x35')]:_0x5daacf[_0xa851('0x31')];_0x46597e[_0xa851('0x39')]=qs[_0xa851('0x3a')](_0x5964dd[_0xa851('0x32')][_0xa851('0x3a')]);_0x46597e[_0xa851('0x3b')]=qs[_0xa851('0x33')](_[_0xa851('0x3c')](_0x5964dd['query'],_0x5daacf['filters']));if(_0x5964dd[_0xa851('0x32')][_0xa851('0x3d')]){_0x46597e[_0xa851('0x3b')]=_[_0xa851('0x3f')](_0x46597e['where'],{'$or':_[_0xa851('0x2b')](_0x46597e[_0xa851('0x35')],function(_0xc75d37){var _0x57f5d0={};_0x57f5d0[_0xc75d37]={'$like':'%'+_0x5964dd[_0xa851('0x32')][_0xa851('0x3d')]+'%'};return _0x57f5d0;})});}_0x46597e=_[_0xa851('0x3f')]({},_0x46597e,_0x5964dd['options']);return _0x360d00[_0xa851('0x56')](_0x46597e);}})['then'](function(_0x4f2725){if(_0x4f2725){_0x45e82c=_0x4f2725[_0xa851('0x36')];if(!_0x5964dd[_0xa851('0x32')][_0xa851('0x37')]('nolimit')){_0x46597e['limit']=qs[_0xa851('0x38')](_0x5964dd[_0xa851('0x32')]['limit']);_0x46597e[_0xa851('0x1d')]=qs[_0xa851('0x1d')](_0x5964dd[_0xa851('0x32')]['offset']);}return _0x360d00[_0xa851('0x56')](_0x46597e);}})['then'](function(_0x3d4235){if(_0x3d4235){return _0x3d4235?{'count':_0x45e82c,'rows':_0x3d4235}:null;}})[_0xa851('0x22')](respondWithResult(_0x575688,null))[_0xa851('0x51')](handleError(_0x575688,null));};exports[_0xa851('0x57')]=function(_0x507794,_0x445456,_0x1ffbc3){return db[_0xa851('0x2c')][_0xa851('0x55')]({'where':{'id':_0x507794[_0xa851('0x45')]['id']}})[_0xa851('0x22')](handleEntityNotFound(_0x445456,null))[_0xa851('0x22')](function(_0x1b2fa8){if(_0x1b2fa8){return db[_0xa851('0x58')][_0xa851('0x59')](function(_0x22815a){return db[_0xa851('0x2c')][_0xa851('0x23')]({'where':{'IntervalId':_0x507794[_0xa851('0x45')]['id']},'transaction':_0x22815a})[_0xa851('0x22')](function(_0x52a865){var _0x24ded4=_[_0xa851('0x2b')](_0x507794['body'],function(_0x552bb3){delete _0x552bb3['id'];_0x552bb3[_0xa851('0x54')]=_0x507794[_0xa851('0x45')]['id'];return _0x552bb3;});return db['Interval'][_0xa851('0x5a')](_0x24ded4,{'transaction':_0x22815a});});})[_0xa851('0x22')](function(){return db[_0xa851('0x2c')][_0xa851('0x43')]({'where':{'IntervalId':_0x507794[_0xa851('0x45')]['id']}});});}})[_0xa851('0x22')](respondWithResult(_0x445456,null))[_0xa851('0x51')](handleError(_0x445456,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 09dc022..91c5fde 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 _0x222b=['tools_intervals','rewrite','interval','getIntervals','all','map','ifTime','then','reduce','../../utils/iftime','exports','define'];(function(_0x3ec100,_0x45b76b){var _0x5d2c7d=function(_0x543d42){while(--_0x543d42){_0x3ec100['push'](_0x3ec100['shift']());}};_0x5d2c7d(++_0x45b76b);}(_0x222b,0x171));var _0xb222=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x222b[_0x1c3b41];return _0x41e3fe;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xb222('0x0'))['iftime'];module[_0xb222('0x1')]=function(_0x473199){return _0x473199[_0xb222('0x2')]('Interval',attributes,{'tableName':_0xb222('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf02c25){extensions[_0xb222('0x4')](_0x473199,_0xf02c25);},'afterBulkCreate':function(_0x1aee5d,_0x13070f,_0xbf95ed){_0xbf95ed();extensions[_0xb222('0x4')](_0x473199,_0x1aee5d[0x0]);},'afterUpdate':function(_0x2a2650){extensions[_0xb222('0x4')](_0x473199,_0x2a2650);},'afterDestroy':function(_0x121ea8){extensions[_0xb222('0x4')](_0x473199,_0x121ea8);}},'instanceMethods':{'ifTime':function(_0x2c3ace=undefined,_0x4747dc=new Date()){if(typeof this[_0xb222('0x5')]==='string'){return iftime(this['interval'],_0x2c3ace,_0x4747dc);}else{return this[_0xb222('0x6')]()['then'](function(_0x904b16){return Promise[_0xb222('0x7')](_0x904b16[_0xb222('0x8')](function(_0x2be819){return _0x2be819[_0xb222('0x9')](_0x2c3ace,_0x4747dc);}));})[_0xb222('0xa')](function(_0x5bddb5){return _0x5bddb5[_0xb222('0xb')](function(_0x238593,_0x3e38e2){return _0x238593||_0x3e38e2;},![]);});}}}});}; \ No newline at end of file +var _0x2b44=['string','ifTime','then','reduce','../../components/extensions/rewrite','iftime','define','tools_intervals','rewrite','interval'];(function(_0x26a62b,_0x4ce537){var _0x213992=function(_0xddbecb){while(--_0xddbecb){_0x26a62b['push'](_0x26a62b['shift']());}};_0x213992(++_0x4ce537);}(_0x2b44,0x194));var _0x42b4=function(_0x368370,_0x534c3e){_0x368370=_0x368370-0x0;var _0xe4382d=_0x2b44[_0x368370];return _0xe4382d;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x42b4('0x0'));var iftime=require('../../utils/iftime')[_0x42b4('0x1')];module['exports']=function(_0x238780){return _0x238780[_0x42b4('0x2')]('Interval',attributes,{'tableName':_0x42b4('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41a651){extensions[_0x42b4('0x4')](_0x238780,_0x41a651);},'afterBulkCreate':function(_0x34b992,_0x7ac696,_0x198117){_0x198117();extensions[_0x42b4('0x4')](_0x238780,_0x34b992[0x0]);},'afterUpdate':function(_0x266628){extensions[_0x42b4('0x4')](_0x238780,_0x266628);},'afterDestroy':function(_0x2ee48f){extensions[_0x42b4('0x4')](_0x238780,_0x2ee48f);}},'instanceMethods':{'ifTime':function(_0x23c5e7=undefined,_0x10a158=new Date()){if(typeof this[_0x42b4('0x5')]===_0x42b4('0x6')){return iftime(this[_0x42b4('0x5')],_0x23c5e7,_0x10a158);}else{return this['getIntervals']()['then'](function(_0x348849){return Promise['all'](_0x348849['map'](function(_0x3bf364){return _0x3bf364[_0x42b4('0x7')](_0x23c5e7,_0x10a158);}));})[_0x42b4('0x8')](function(_0x3ba452){return _0x3ba452[_0x42b4('0x9')](function(_0x22a6b2,_0x362c22){return _0x22a6b2||_0x362c22;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2160249..60c5cd9 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 _0xaf70=['catch','error','message','ShowInterval','stringify','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','info','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0xaf70,0x17a));var _0x0af7=function(_0x16a6ec,_0x552727){_0x16a6ec=_0x16a6ec-0x0;var _0x25d4e1=_0xaf70[_0x16a6ec];return _0x25d4e1;};'use strict';var _=require('lodash');var util=require(_0x0af7('0x0'));var db=require(_0x0af7('0x1'))['db'];var iftime=require(_0x0af7('0x2'))['iftime'];var logger=require(_0x0af7('0x3'))(_0x0af7('0x4'));exports[_0x0af7('0x5')]=function(_0x5f016a){var _0x34378e=this;return new Promise(function(_0x434bea,_0x30409b){return db[_0x0af7('0x6')][_0x0af7('0x7')]({'raw':_0x5f016a[_0x0af7('0x8')]?_0x5f016a[_0x0af7('0x8')][_0x0af7('0x9')]===undefined?!![]:![]:!![],'where':_0x5f016a[_0x0af7('0x8')]?_0x5f016a[_0x0af7('0x8')][_0x0af7('0xa')]||null:null,'attributes':_0x5f016a[_0x0af7('0x8')]?_0x5f016a[_0x0af7('0x8')][_0x0af7('0xb')]||null:null,'limit':_0x5f016a['options']?_0x5f016a[_0x0af7('0x8')][_0x0af7('0xc')]||null:null,'include':_0x5f016a['options']?_0x5f016a[_0x0af7('0x8')][_0x0af7('0xd')]?_[_0x0af7('0xe')](_0x5f016a[_0x0af7('0x8')][_0x0af7('0xd')],function(_0x439f62){return{'model':db[_0x439f62[_0x0af7('0xf')]],'as':_0x439f62['as'],'attributes':_0x439f62['attributes'],'include':_0x439f62[_0x0af7('0xd')]?_[_0x0af7('0xe')](_0x439f62['include'],function(_0x5b8226){return{'model':db[_0x5b8226[_0x0af7('0xf')]],'as':_0x5b8226['as'],'attributes':_0x5b8226[_0x0af7('0xb')],'include':_0x5b8226[_0x0af7('0xd')]?_['map'](_0x5b8226[_0x0af7('0xd')],function(_0x4d519a){return{'model':db[_0x4d519a['model']],'as':_0x4d519a['as'],'attributes':_0x4d519a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0af7('0x10')](function(_0x393881){logger['info'](_0x0af7('0x5'),_0x5f016a);logger[_0x0af7('0x11')](_0x0af7('0x5'),_0x5f016a,JSON['stringify'](_0x393881));_0x434bea(_0x393881);})[_0x0af7('0x12')](function(_0x1e9ca7){logger[_0x0af7('0x13')](_0x0af7('0x5'),_0x1e9ca7[_0x0af7('0x14')],_0x5f016a);_0x30409b(_0x34378e['error'](0x1f4,_0x1e9ca7['message']));});});};exports[_0x0af7('0x15')]=function(_0x23029c){var _0x18c79b=this;return new Promise(function(_0x4764d0,_0x6623f2){return db[_0x0af7('0x6')]['find']({'raw':_0x23029c['options']?_0x23029c['options']['raw']===undefined?!![]:![]:!![],'where':_0x23029c[_0x0af7('0x8')]?_0x23029c[_0x0af7('0x8')][_0x0af7('0xa')]||null:null,'attributes':_0x23029c[_0x0af7('0x8')]?_0x23029c[_0x0af7('0x8')][_0x0af7('0xb')]||null:null,'include':_0x23029c['options']?_0x23029c[_0x0af7('0x8')][_0x0af7('0xd')]?_[_0x0af7('0xe')](_0x23029c[_0x0af7('0x8')][_0x0af7('0xd')],function(_0x53149d){return{'model':db[_0x53149d[_0x0af7('0xf')]],'as':_0x53149d['as'],'attributes':_0x53149d[_0x0af7('0xb')],'include':_0x53149d[_0x0af7('0xd')]?_[_0x0af7('0xe')](_0x53149d[_0x0af7('0xd')],function(_0x3d8a03){return{'model':db[_0x3d8a03[_0x0af7('0xf')]],'as':_0x3d8a03['as'],'attributes':_0x3d8a03['attributes'],'include':_0x3d8a03[_0x0af7('0xd')]?_[_0x0af7('0xe')](_0x3d8a03[_0x0af7('0xd')],function(_0xed4a05){return{'model':db[_0xed4a05['model']],'as':_0xed4a05['as'],'attributes':_0xed4a05[_0x0af7('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0af7('0x10')](function(_0x4cc66){logger['info'](_0x0af7('0x15'),_0x23029c);logger[_0x0af7('0x11')]('ShowInterval',_0x23029c,JSON[_0x0af7('0x16')](_0x4cc66));_0x4764d0(_0x4cc66);})['catch'](function(_0x25f0af){logger[_0x0af7('0x13')](_0x0af7('0x15'),_0x25f0af[_0x0af7('0x14')],_0x23029c);_0x6623f2(_0x18c79b[_0x0af7('0x13')](0x1f4,_0x25f0af[_0x0af7('0x14')]));});});};function checkArrayOfIntervals(_0x2c0f0c,_0x24342d){var _0x3ec919=[];return db[_0x0af7('0x6')][_0x0af7('0x7')]({'where':{'id':_0x2c0f0c}})[_0x0af7('0x10')](function(_0x2dd092){_0x3ec919=_0x2dd092;return Promise[_0x0af7('0x17')](_0x3ec919[_0x0af7('0xe')](function(_0x5a6576){return _0x5a6576[_0x0af7('0x18')](_0x24342d);}));})[_0x0af7('0x10')](function(_0x2ef88a){var _0x3b7e55=_0x2ef88a[_0x0af7('0x19')](function(_0x11870f,_0x4abcf3){return _0x11870f||_0x4abcf3;},![]);logger['info'](util[_0x0af7('0x1a')](_0x0af7('0x1b'),_0x3ec919[_0x0af7('0xe')](function(_0x340fdd){return _0x340fdd['name'];})[_0x0af7('0x1c')](',\x20'),_0x3ec919[_0x0af7('0xe')](function(_0x436359){return _0x436359['id'];})['join'](',\x20')));return _0x3b7e55;});}function checkSingleInterval(_0x222841,_0x2fae38){return db[_0x0af7('0x6')][_0x0af7('0x1d')](_0x222841)[_0x0af7('0x10')](function(_0x467ff6){if(_0x467ff6){logger[_0x0af7('0x1e')](util[_0x0af7('0x1a')](_0x0af7('0x1f'),_0x467ff6[_0x0af7('0x20')],_0x467ff6['id']));return _0x467ff6['ifTime'](_0x2fae38);}});}exports['IntervalIftime']=function(_0x588a9d){var _0x45d69b=_0x588a9d[_0x0af7('0x21')];var _0x131f92=Array[_0x0af7('0x22')](_0x588a9d[_0x0af7('0x23')])?_0x588a9d['intervals']:typeof _0x588a9d['intervals']===_0x0af7('0x24')?[_0x588a9d[_0x0af7('0x23')]]:[];var _0x38f872=_0x588a9d[_0x0af7('0x25')]||undefined;var _0x2c8acd=![];if(_0x131f92[_0x0af7('0x26')]){logger[_0x0af7('0x1e')](util[_0x0af7('0x1a')](_0x0af7('0x27'),_0x131f92[_0x0af7('0x1c')](';\x20')));}if(_0x38f872){logger[_0x0af7('0x1e')](util[_0x0af7('0x1a')](_0x0af7('0x28'),_0x38f872));}logger[_0x0af7('0x11')](_0x0af7('0x29'),_0x2c8acd);logger[_0x0af7('0x2a')](_0x0af7('0x2b'),_0x588a9d);return Promise['resolve']()[_0x0af7('0x10')](function(){if(Array[_0x0af7('0x22')](_0x45d69b)){return checkArrayOfIntervals(_0x45d69b,_0x38f872);}else if(_0x45d69b){return checkSingleInterval(_0x45d69b,_0x38f872);}})[_0x0af7('0x10')](function(_0x1f16de){var _0x5a961e=_0x131f92[_0x0af7('0x19')](function(_0x40950c,_0x48f01e){return _0x40950c||iftime(_0x48f01e,_0x38f872);},![]);_0x2c8acd=_0x1f16de||_0x5a961e;return _0x2c8acd;})['catch'](function(_0xe9df4c){logger[_0x0af7('0x13')]('IntervalIftime',_0x588a9d,_0xe9df4c);throw this['error'](0x1f4,_0xe9df4c[_0x0af7('0x14')]);});}; \ No newline at end of file +var _0x1d5d=['format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','map','model','then','info','GetInterval','debug','catch','error','message','find','where','ShowInterval','stringify','reduce'];(function(_0x54be6d,_0x3b43f7){var _0x15835c=function(_0x7b59ba){while(--_0x7b59ba){_0x54be6d['push'](_0x54be6d['shift']());}};_0x15835c(++_0x3b43f7);}(_0x1d5d,0xbc));var _0xd1d5=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x1d5d[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0xd1d5('0x0'));var db=require(_0xd1d5('0x1'))['db'];var iftime=require(_0xd1d5('0x2'))[_0xd1d5('0x3')];var logger=require(_0xd1d5('0x4'))(_0xd1d5('0x5'));exports['GetInterval']=function(_0x349634){var _0x29d7f4=this;return new Promise(function(_0xfcfb96,_0x5d72f2){return db[_0xd1d5('0x6')][_0xd1d5('0x7')]({'raw':_0x349634[_0xd1d5('0x8')]?_0x349634['options'][_0xd1d5('0x9')]===undefined?!![]:![]:!![],'where':_0x349634[_0xd1d5('0x8')]?_0x349634[_0xd1d5('0x8')]['where']||null:null,'attributes':_0x349634[_0xd1d5('0x8')]?_0x349634[_0xd1d5('0x8')][_0xd1d5('0xa')]||null:null,'limit':_0x349634[_0xd1d5('0x8')]?_0x349634['options'][_0xd1d5('0xb')]||null:null,'include':_0x349634[_0xd1d5('0x8')]?_0x349634[_0xd1d5('0x8')][_0xd1d5('0xc')]?_[_0xd1d5('0xd')](_0x349634['options'][_0xd1d5('0xc')],function(_0x1a656a){return{'model':db[_0x1a656a[_0xd1d5('0xe')]],'as':_0x1a656a['as'],'attributes':_0x1a656a[_0xd1d5('0xa')],'include':_0x1a656a[_0xd1d5('0xc')]?_[_0xd1d5('0xd')](_0x1a656a[_0xd1d5('0xc')],function(_0x16b6b6){return{'model':db[_0x16b6b6[_0xd1d5('0xe')]],'as':_0x16b6b6['as'],'attributes':_0x16b6b6[_0xd1d5('0xa')],'include':_0x16b6b6[_0xd1d5('0xc')]?_[_0xd1d5('0xd')](_0x16b6b6[_0xd1d5('0xc')],function(_0x5589bb){return{'model':db[_0x5589bb[_0xd1d5('0xe')]],'as':_0x5589bb['as'],'attributes':_0x5589bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1d5('0xf')](function(_0x1f59a6){logger[_0xd1d5('0x10')](_0xd1d5('0x11'),_0x349634);logger[_0xd1d5('0x12')]('GetInterval',_0x349634,JSON['stringify'](_0x1f59a6));_0xfcfb96(_0x1f59a6);})[_0xd1d5('0x13')](function(_0x1b9f40){logger[_0xd1d5('0x14')]('GetInterval',_0x1b9f40['message'],_0x349634);_0x5d72f2(_0x29d7f4['error'](0x1f4,_0x1b9f40[_0xd1d5('0x15')]));});});};exports['ShowInterval']=function(_0x17aae2){var _0xbf0137=this;return new Promise(function(_0x5be9d7,_0x4b6bce){return db['Interval'][_0xd1d5('0x16')]({'raw':_0x17aae2[_0xd1d5('0x8')]?_0x17aae2['options'][_0xd1d5('0x9')]===undefined?!![]:![]:!![],'where':_0x17aae2['options']?_0x17aae2[_0xd1d5('0x8')][_0xd1d5('0x17')]||null:null,'attributes':_0x17aae2[_0xd1d5('0x8')]?_0x17aae2['options'][_0xd1d5('0xa')]||null:null,'include':_0x17aae2[_0xd1d5('0x8')]?_0x17aae2['options'][_0xd1d5('0xc')]?_[_0xd1d5('0xd')](_0x17aae2['options'][_0xd1d5('0xc')],function(_0x56220c){return{'model':db[_0x56220c['model']],'as':_0x56220c['as'],'attributes':_0x56220c[_0xd1d5('0xa')],'include':_0x56220c['include']?_[_0xd1d5('0xd')](_0x56220c['include'],function(_0x44d7d9){return{'model':db[_0x44d7d9[_0xd1d5('0xe')]],'as':_0x44d7d9['as'],'attributes':_0x44d7d9['attributes'],'include':_0x44d7d9[_0xd1d5('0xc')]?_[_0xd1d5('0xd')](_0x44d7d9[_0xd1d5('0xc')],function(_0x5c5038){return{'model':db[_0x5c5038[_0xd1d5('0xe')]],'as':_0x5c5038['as'],'attributes':_0x5c5038[_0xd1d5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd1d5('0xf')](function(_0x540e51){logger[_0xd1d5('0x10')](_0xd1d5('0x18'),_0x17aae2);logger[_0xd1d5('0x12')](_0xd1d5('0x18'),_0x17aae2,JSON[_0xd1d5('0x19')](_0x540e51));_0x5be9d7(_0x540e51);})[_0xd1d5('0x13')](function(_0x98cc5f){logger[_0xd1d5('0x14')](_0xd1d5('0x18'),_0x98cc5f['message'],_0x17aae2);_0x4b6bce(_0xbf0137[_0xd1d5('0x14')](0x1f4,_0x98cc5f['message']));});});};function checkArrayOfIntervals(_0x56fe97,_0x8377d3){var _0x115517=[];return db[_0xd1d5('0x6')][_0xd1d5('0x7')]({'where':{'id':_0x56fe97}})['then'](function(_0xf5f14a){_0x115517=_0xf5f14a;return Promise['all'](_0x115517[_0xd1d5('0xd')](function(_0x150928){return _0x150928['ifTime'](_0x8377d3);}));})['then'](function(_0x459add){var _0x27021f=_0x459add[_0xd1d5('0x1a')](function(_0x308b33,_0x333393){return _0x308b33||_0x333393;},![]);logger[_0xd1d5('0x10')](util[_0xd1d5('0x1b')](_0xd1d5('0x1c'),_0x115517['map'](function(_0x21008b){return _0x21008b[_0xd1d5('0x1d')];})[_0xd1d5('0x1e')](',\x20'),_0x115517['map'](function(_0x76b5e1){return _0x76b5e1['id'];})[_0xd1d5('0x1e')](',\x20')));return _0x27021f;});}function checkSingleInterval(_0x2daa4c,_0x2412e8){return db['Interval'][_0xd1d5('0x1f')](_0x2daa4c)[_0xd1d5('0xf')](function(_0x3d3a92){if(_0x3d3a92){logger[_0xd1d5('0x10')](util[_0xd1d5('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3d3a92[_0xd1d5('0x1d')],_0x3d3a92['id']));return _0x3d3a92[_0xd1d5('0x20')](_0x2412e8);}});}exports[_0xd1d5('0x21')]=function(_0x4ef644){var _0x433bc2=_0x4ef644[_0xd1d5('0x22')];var _0x3460f6=Array[_0xd1d5('0x23')](_0x4ef644[_0xd1d5('0x24')])?_0x4ef644['intervals']:typeof _0x4ef644[_0xd1d5('0x24')]===_0xd1d5('0x25')?[_0x4ef644[_0xd1d5('0x24')]]:[];var _0x322a2a=_0x4ef644[_0xd1d5('0x26')]||undefined;var _0x134794=![];if(_0x3460f6[_0xd1d5('0x27')]){logger[_0xd1d5('0x10')](util[_0xd1d5('0x1b')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x3460f6['join'](';\x20')));}if(_0x322a2a){logger['info'](util[_0xd1d5('0x1b')](_0xd1d5('0x28'),_0x322a2a));}logger[_0xd1d5('0x12')]('Iftime',_0x134794);logger[_0xd1d5('0x29')](_0xd1d5('0x21'),_0x4ef644);return Promise[_0xd1d5('0x2a')]()[_0xd1d5('0xf')](function(){if(Array[_0xd1d5('0x23')](_0x433bc2)){return checkArrayOfIntervals(_0x433bc2,_0x322a2a);}else if(_0x433bc2){return checkSingleInterval(_0x433bc2,_0x322a2a);}})[_0xd1d5('0xf')](function(_0x18e237){var _0x3b312c=_0x3460f6['reduce'](function(_0x49311f,_0x4320c9){return _0x49311f||iftime(_0x4320c9,_0x322a2a);},![]);_0x134794=_0x18e237||_0x3b312c;return _0x134794;})[_0xd1d5('0x13')](function(_0x2b0a8f){logger[_0xd1d5('0x14')]('IntervalIftime',_0x4ef644,_0x2b0a8f);throw this['error'](0x1f4,_0x2b0a8f[_0xd1d5('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4bd312b..e2caaa9 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xb10b,0x12a));var _0xbb10=function(_0xdf4058,_0x3d913d){_0xdf4058=_0xdf4058-0x0;var _0x141888=_0xb10b[_0xdf4058];return _0x141888;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x3d3a2a,_0x2a8298){var _0x5f7683=function(_0xafabe1){while(--_0xafabe1){_0x3d3a2a['push'](_0x3d3a2a['shift']());}};_0x5f7683(++_0x2a8298);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cb7fd,_0x4dcb49){_0x3cb7fd=_0x3cb7fd-0x0;var _0x4c5f50=_0x5f2f[_0x3cb7fd];return _0x4c5f50;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 60da2a0..46ac623 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 _0xd59d=['socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','name','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','remoteAddress'];(function(_0x3c59b5,_0x40975c){var _0x40a8a1=function(_0x2c38c8){while(--_0x2c38c8){_0x3c59b5['push'](_0x3c59b5['shift']());}};_0x40a8a1(++_0x40975c);}(_0xd59d,0xe8));var _0xdd59=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xd59d[_0x53cf8e];return _0x459197;};'use strict';var BPromise=require(_0xdd59('0x0'));var https=require(_0xdd59('0x1'));var logger=require(_0xdd59('0x2'))(_0xdd59('0x3'));var USERNAME='support';var PASSWORD=_0xdd59('0x4');function openIssue(_0x487db5,_0x324069){var _0x38a13f={'fields':{'project':{'key':_0x487db5[_0xdd59('0x5')]||_0xdd59('0x6')},'summary':(_0x487db5[_0xdd59('0x7')]||_0xdd59('0x8'))+_0xdd59('0x9')+_0x487db5['ip'],'description':_0x487db5[_0xdd59('0xa')]||JSON[_0xdd59('0xb')](_0x487db5),'issuetype':{'name':_0x487db5[_0xdd59('0xc')]||_0xdd59('0xd')}}};_0x38a13f[_0xdd59('0xe')][_0xdd59('0xf')]=_0x487db5['email'];_0x38a13f[_0xdd59('0xe')][_0xdd59('0x10')]=_0x487db5['oldToken'];_0x38a13f[_0xdd59('0xe')][_0xdd59('0x11')]=_0x487db5[_0xdd59('0x12')];_0x38a13f['fields']['customfield_11503']=_0x487db5[_0xdd59('0x13')];_0x38a13f['fields']['customfield_11504']=_0x487db5[_0xdd59('0x14')];_0x38a13f['fields'][_0xdd59('0x15')]=_0x487db5['ip'];var _0x1b5bad={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xdd59('0x16'),'method':_0xdd59('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xdd59('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xdd59('0x19')](_0xdd59('0x1a'))}};var _0x5c519d=JSON[_0xdd59('0xb')](_0x38a13f);var _0x4bea0f=https[_0xdd59('0x1b')](_0x1b5bad,function(_0x55dcd1){_0x55dcd1[_0xdd59('0x1c')](_0xdd59('0x1d'));var _0x16c826='';_0x55dcd1['on'](_0xdd59('0x1e'),function(_0x290e88){_0x16c826+=_0x290e88;});_0x55dcd1['on'](_0xdd59('0x1f'),function(){if(_0x324069){return _0x324069['status'](_0x55dcd1['statusCode'])[_0xdd59('0x20')](JSON[_0xdd59('0x21')](_0x16c826));}});});_0x4bea0f['on'](_0xdd59('0x22'),function(_0x54a53f){if(_0x324069){return _0x324069[_0xdd59('0x23')](0x1f4)[_0xdd59('0x20')]({'errors':[{'message':_0xdd59('0x24'),'type':_0xdd59('0x25')}]});}});_0x4bea0f[_0xdd59('0x26')](_0x5c519d);_0x4bea0f[_0xdd59('0x1f')]();}exports[_0xdd59('0x27')]=openIssue;exports[_0xdd59('0x28')]=function(_0x262ffb,_0x21d9e8){_0x262ffb['body']['ip']=_0x262ffb[_0xdd59('0x29')][_0xdd59('0x2a')]||_0x262ffb['connection'][_0xdd59('0x2b')]||_0x262ffb[_0xdd59('0x2c')][_0xdd59('0x2b')]||_0x262ffb['connection']['socket'][_0xdd59('0x2b')];return openIssue(_0x262ffb[_0xdd59('0x2d')],_0x21d9e8);}; \ No newline at end of file +var _0x0ab2=['toString','base64','request','setEncoding','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','\x20from\x20','stringify','Bug','fields','customfield_11500','customfield_11501','name','customfield_10102','track.xcallymotion.com','POST','Basic\x20'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0x0ab2,0x1c3));var _0x20ab=function(_0x2689fe,_0x1299df){_0x2689fe=_0x2689fe-0x0;var _0x323f30=_0x0ab2[_0x2689fe];return _0x323f30;};'use strict';var BPromise=require(_0x20ab('0x0'));var https=require(_0x20ab('0x1'));var logger=require(_0x20ab('0x2'))('api');var USERNAME='support';var PASSWORD=_0x20ab('0x3');function openIssue(_0x113460,_0x24b2fc){var _0x10062b={'fields':{'project':{'key':_0x113460[_0x20ab('0x4')]||_0x20ab('0x5')},'summary':(_0x113460['summary']||'Report')+_0x20ab('0x6')+_0x113460['ip'],'description':_0x113460['description']||JSON[_0x20ab('0x7')](_0x113460),'issuetype':{'name':_0x113460['issuetype']||_0x20ab('0x8')}}};_0x10062b[_0x20ab('0x9')][_0x20ab('0xa')]=_0x113460['email'];_0x10062b['fields'][_0x20ab('0xb')]=_0x113460['oldToken'];_0x10062b[_0x20ab('0x9')]['customfield_11502']=_0x113460['newToken'];_0x10062b[_0x20ab('0x9')]['customfield_11503']=_0x113460[_0x20ab('0xc')];_0x10062b[_0x20ab('0x9')]['customfield_11504']=_0x113460['reason'];_0x10062b[_0x20ab('0x9')][_0x20ab('0xd')]=_0x113460['ip'];var _0x4630ab={'host':_0x20ab('0xe'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x20ab('0xf'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x20ab('0x10')+new Buffer(USERNAME+':'+PASSWORD)[_0x20ab('0x11')](_0x20ab('0x12'))}};var _0x49dc6c=JSON[_0x20ab('0x7')](_0x10062b);var _0x1b4f33=https[_0x20ab('0x13')](_0x4630ab,function(_0x1b3472){_0x1b3472[_0x20ab('0x14')]('utf8');var _0x618bc='';_0x1b3472['on']('data',function(_0xbffd33){_0x618bc+=_0xbffd33;});_0x1b3472['on']('end',function(){if(_0x24b2fc){return _0x24b2fc[_0x20ab('0x15')](_0x1b3472[_0x20ab('0x16')])[_0x20ab('0x17')](JSON['parse'](_0x618bc));}});});_0x1b4f33['on'](_0x20ab('0x18'),function(_0x16207f){if(_0x24b2fc){return _0x24b2fc[_0x20ab('0x15')](0x1f4)[_0x20ab('0x17')]({'errors':[{'message':_0x20ab('0x19'),'type':'api.jira'}]});}});_0x1b4f33[_0x20ab('0x1a')](_0x49dc6c);_0x1b4f33[_0x20ab('0x1b')]();}exports[_0x20ab('0x1c')]=openIssue;exports[_0x20ab('0x1d')]=function(_0x3f2d5a,_0x2dbaf2){_0x3f2d5a[_0x20ab('0x1e')]['ip']=_0x3f2d5a[_0x20ab('0x1f')][_0x20ab('0x20')]||_0x3f2d5a[_0x20ab('0x21')][_0x20ab('0x22')]||_0x3f2d5a[_0x20ab('0x23')][_0x20ab('0x22')]||_0x3f2d5a['connection'][_0x20ab('0x23')]['remoteAddress'];return openIssue(_0x3f2d5a[_0x20ab('0x1e')],_0x2dbaf2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 66392ce..1eae373 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 _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0xb6133b,_0x3f4777){var _0x246b3a=function(_0x2b3295){while(--_0x2b3295){_0xb6133b['push'](_0xb6133b['shift']());}};_0x246b3a(++_0x3f4777);}(_0x0bb5,0x148));var _0x50bb=function(_0x12911f,_0x4529c4){_0x12911f=_0x12911f-0x0;var _0x3e5646=_0x0bb5[_0x12911f];return _0x3e5646;};'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',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file +var _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xaa88,0x137));var _0x8aa8=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xaa88[_0x4aa838];return _0x3abff0;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 347e435..674a0eb 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x14a7fe,_0x5330d5){_0x14a7fe=_0x14a7fe-0x0;var _0x52504f=_0x7a54[_0x14a7fe];return _0x52504f;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x3c932c,_0x4aa736){_0x3c932c=_0x3c932c-0x0;var _0x1487ad=_0x7a54[_0x3c932c];return _0x1487ad;};'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 0343d77..19b806e 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 _0x5fc3=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','JscriptyAnswerReport','fieldName','type','model','query','keys','filters'];(function(_0x2f7b22,_0x1fd468){var _0x47bf72=function(_0xdca483){while(--_0xdca483){_0x2f7b22['push'](_0x2f7b22['shift']());}};_0x47bf72(++_0x1fd468);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x5fc3[_0x1602ef];return _0x5870ee;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26'));_0x9f3c8a[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x26b7cb[_0x35fc('0x2d')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x9f3c8a[_0x35fc('0x2c')],_0x9f3c8a[_0x35fc('0x2d')]);_0x383837['attributes']=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs['fields'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x31')]));_0x383837[_0x35fc('0x32')]=_0x383837[_0x35fc('0x32')][_0x35fc('0x33')]?_0x383837[_0x35fc('0x32')]:_0x9f3c8a['model'];if(!_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x34')](_0x35fc('0x35'))){_0x383837[_0x35fc('0x1c')]=qs[_0x35fc('0x1c')](_0x26b7cb[_0x35fc('0x2d')]['limit']);_0x383837[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x26b7cb[_0x35fc('0x2d')]['offset']);}_0x383837[_0x35fc('0x36')]=qs['sort'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x37')]);_0x383837[_0x35fc('0x38')]=qs[_0x35fc('0x2f')](_['pick'](_0x26b7cb['query'],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2d')]['filter']){_0x383837[_0x35fc('0x38')]=_['merge'](_0x383837[_0x35fc('0x38')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x2ca9ac){if(_0x2ca9ac[_0x35fc('0x2b')]!==_0x35fc('0x39')){var _0x3313fa={};_0x3313fa[_0x2ca9ac[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb['query'][_0x35fc('0x3a')]+'%'};return _0x3313fa;}})});}_0x383837=_[_0x35fc('0x3b')]({},_0x383837,_0x26b7cb['options']);var _0x1feda5={'where':_0x383837[_0x35fc('0x38')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1feda5)[_0x35fc('0x24')](function(_0x31d926){_0x3735da['count']=_0x31d926;if(_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x3c')]){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x35fc('0x3e')](_0x383837);})[_0x35fc('0x24')](function(_0x596919){_0x3735da[_0x35fc('0x3f')]=_0x596919;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x40')](handleError(_0x645eac,null));};exports[_0x35fc('0x41')]=function(_0x331439,_0x2a1cf6){var _0x211b70={'raw':!![],'where':{'id':_0x331439['params']['id']}},_0x3ec51f={};_0x3ec51f['model']=_[_0x35fc('0x2e')](db[_0x35fc('0x29')]['rawAttributes']);_0x3ec51f['query']=_['keys'](_0x331439[_0x35fc('0x2d')]);_0x3ec51f[_0x35fc('0x2f')]=_['intersection'](_0x3ec51f[_0x35fc('0x2c')],_0x3ec51f[_0x35fc('0x2d')]);_0x211b70[_0x35fc('0x32')]=_[_0x35fc('0x30')](_0x3ec51f['model'],qs['fields'](_0x331439['query']['fields']));_0x211b70['attributes']=_0x211b70[_0x35fc('0x32')][_0x35fc('0x33')]?_0x211b70['attributes']:_0x3ec51f[_0x35fc('0x2c')];if(_0x331439['query'][_0x35fc('0x3c')]){_0x211b70[_0x35fc('0x3d')]=[{'all':!![]}];}_0x211b70=_[_0x35fc('0x3b')]({},_0x211b70,_0x331439[_0x35fc('0x42')]);return db[_0x35fc('0x29')]['find'](_0x211b70)[_0x35fc('0x24')](handleEntityNotFound(_0x2a1cf6,null))[_0x35fc('0x24')](respondWithResult(_0x2a1cf6,null))['catch'](handleError(_0x2a1cf6,null));};exports[_0x35fc('0x43')]=function(_0x298b7b,_0x2a8a09){return db[_0x35fc('0x29')]['create'](_0x298b7b[_0x35fc('0x44')],{})['then'](respondWithResult(_0x2a8a09,0xc9))['catch'](handleError(_0x2a8a09,null));};exports[_0x35fc('0x23')]=function(_0x9db7e8,_0x18dc78){if(_0x9db7e8[_0x35fc('0x44')]['id']){delete _0x9db7e8[_0x35fc('0x44')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x9db7e8[_0x35fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0x24')](saveUpdates(_0x9db7e8[_0x35fc('0x44')],null))[_0x35fc('0x24')](respondWithResult(_0x18dc78,null))[_0x35fc('0x40')](handleError(_0x18dc78,null));};exports[_0x35fc('0x25')]=function(_0x1e3221,_0x1b8229){return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x1e3221[_0x35fc('0x46')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x1b8229,null))[_0x35fc('0x24')](removeEntity(_0x1b8229,null))[_0x35fc('0x40')](handleError(_0x1b8229,null));};exports[_0x35fc('0x47')]=function(_0x59c666,_0x553ed6){return db[_0x35fc('0x29')][_0x35fc('0x47')]()[_0x35fc('0x24')](respondWithResult(_0x553ed6,null))[_0x35fc('0x40')](handleError(_0x553ed6,null));}; \ No newline at end of file +var _0x8c52=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x8c52,0x7e));var _0x28c5=function(_0x4da572,_0x326408){_0x4da572=_0x4da572-0x0;var _0x378393=_0x8c52[_0x4da572];return _0x378393;};'use strict';var emlformat=require(_0x28c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28c5('0x1'));var jsonpatch=require(_0x28c5('0x2'));var rp=require(_0x28c5('0x3'));var moment=require(_0x28c5('0x4'));var BPromise=require(_0x28c5('0x5'));var Mustache=require(_0x28c5('0x6'));var util=require(_0x28c5('0x7'));var path=require(_0x28c5('0x8'));var sox=require(_0x28c5('0x9'));var csv=require(_0x28c5('0xa'));var ejs=require(_0x28c5('0xb'));var fs=require('fs');var fs_extra=require(_0x28c5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x28c5('0xd'));var toCsv=require(_0x28c5('0xa'));var querystring=require(_0x28c5('0xe'));var Papa=require('papaparse');var Redis=require(_0x28c5('0xf'));var authService=require(_0x28c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x28c5('0x11'));var hardwareService=require(_0x28c5('0x12'));var logger=require(_0x28c5('0x13'))(_0x28c5('0x14'));var utils=require(_0x28c5('0x15'));var config=require(_0x28c5('0x16'));var licenseUtil=require(_0x28c5('0x17'));var db=require(_0x28c5('0x18'))['db'];function respondWithStatusCode(_0x7873ef,_0x477fe1){_0x477fe1=_0x477fe1||0xcc;return function(_0x55f5af){if(_0x55f5af){return _0x7873ef[_0x28c5('0x19')](_0x477fe1);}return _0x7873ef[_0x28c5('0x1a')](_0x477fe1)[_0x28c5('0x1b')]();};}function respondWithResult(_0x9b5a83,_0x57cfde){_0x57cfde=_0x57cfde||0xc8;return function(_0x4520ea){if(_0x4520ea){return _0x9b5a83[_0x28c5('0x1a')](_0x57cfde)[_0x28c5('0x1c')](_0x4520ea);}};}function respondWithFilteredResult(_0x20f186,_0x477f2e){return function(_0x33cd69){if(_0x33cd69){var _0x199b0e=typeof _0x477f2e[_0x28c5('0x1d')]==='undefined'&&typeof _0x477f2e[_0x28c5('0x1e')]===_0x28c5('0x1f');var _0x19fc7f=_0x33cd69[_0x28c5('0x20')];var _0x47195d=_0x199b0e?0x0:_0x477f2e['offset'];var _0x5d6edd=_0x199b0e?_0x33cd69[_0x28c5('0x20')]:_0x477f2e[_0x28c5('0x1d')]+_0x477f2e['limit'];var _0x12b55e;if(_0x5d6edd>=_0x19fc7f){_0x5d6edd=_0x19fc7f;_0x12b55e=0xc8;}else{_0x12b55e=0xce;}_0x20f186[_0x28c5('0x1a')](_0x12b55e);return _0x20f186['set']('Content-Range',_0x47195d+'-'+_0x5d6edd+'/'+_0x19fc7f)['json'](_0x33cd69);}return null;};}function patchUpdates(_0x170667){return function(_0x21ffab){try{jsonpatch[_0x28c5('0x21')](_0x21ffab,_0x170667,!![]);}catch(_0x345e4a){return BPromise[_0x28c5('0x22')](_0x345e4a);}return _0x21ffab[_0x28c5('0x23')]();};}function saveUpdates(_0x162060,_0xd74d86){return function(_0x37a3fe){if(_0x37a3fe){return _0x37a3fe['update'](_0x162060)[_0x28c5('0x24')](function(_0x33464f){return _0x33464f;});}return null;};}function removeEntity(_0x3b1f32,_0x43ecd0){return function(_0x91d866){if(_0x91d866){return _0x91d866['destroy']()['then'](function(){_0x3b1f32['status'](0xcc)[_0x28c5('0x1b')]();});}};}function handleEntityNotFound(_0x320a79,_0x253625){return function(_0x3486e7){if(!_0x3486e7){_0x320a79[_0x28c5('0x19')](0x194);}return _0x3486e7;};}function handleError(_0x23cfaf,_0x477cc2){_0x477cc2=_0x477cc2||0x1f4;return function(_0x2e0cd8){logger['error'](_0x2e0cd8[_0x28c5('0x25')]);if(_0x2e0cd8[_0x28c5('0x26')]){delete _0x2e0cd8[_0x28c5('0x26')];}_0x23cfaf['status'](_0x477cc2)[_0x28c5('0x27')](_0x2e0cd8);};}exports[_0x28c5('0x28')]=function(_0x489e2a,_0x4784c3){var _0x1aa359={},_0x87e4d4={},_0x323334={'count':0x0,'rows':[]};var _0x597420=_[_0x28c5('0x29')](db['JscriptyAnswerReport'][_0x28c5('0x2a')],function(_0x7860b4){return{'name':_0x7860b4[_0x28c5('0x2b')],'type':_0x7860b4[_0x28c5('0x2c')]['key']};});_0x87e4d4[_0x28c5('0x2d')]=_['map'](_0x597420,_0x28c5('0x26'));_0x87e4d4[_0x28c5('0x2e')]=_[_0x28c5('0x2f')](_0x489e2a[_0x28c5('0x2e')]);_0x87e4d4['filters']=_[_0x28c5('0x30')](_0x87e4d4[_0x28c5('0x2d')],_0x87e4d4['query']);_0x1aa359[_0x28c5('0x31')]=_[_0x28c5('0x30')](_0x87e4d4[_0x28c5('0x2d')],qs['fields'](_0x489e2a[_0x28c5('0x2e')]['fields']));_0x1aa359['attributes']=_0x1aa359[_0x28c5('0x31')]['length']?_0x1aa359[_0x28c5('0x31')]:_0x87e4d4['model'];if(!_0x489e2a['query']['hasOwnProperty'](_0x28c5('0x32'))){_0x1aa359['limit']=qs[_0x28c5('0x1e')](_0x489e2a[_0x28c5('0x2e')][_0x28c5('0x1e')]);_0x1aa359['offset']=qs[_0x28c5('0x1d')](_0x489e2a[_0x28c5('0x2e')][_0x28c5('0x1d')]);}_0x1aa359[_0x28c5('0x33')]=qs[_0x28c5('0x34')](_0x489e2a[_0x28c5('0x2e')][_0x28c5('0x34')]);_0x1aa359[_0x28c5('0x35')]=qs[_0x28c5('0x36')](_['pick'](_0x489e2a[_0x28c5('0x2e')],_0x87e4d4[_0x28c5('0x36')]),_0x597420);if(_0x489e2a[_0x28c5('0x2e')][_0x28c5('0x37')]){_0x1aa359['where']=_['merge'](_0x1aa359[_0x28c5('0x35')],{'$or':_[_0x28c5('0x29')](_0x597420,function(_0x1a26c2){if(_0x1a26c2[_0x28c5('0x2c')]!==_0x28c5('0x38')){var _0x1623d4={};_0x1623d4[_0x1a26c2['name']]={'$like':'%'+_0x489e2a[_0x28c5('0x2e')]['filter']+'%'};return _0x1623d4;}})});}_0x1aa359=_[_0x28c5('0x39')]({},_0x1aa359,_0x489e2a[_0x28c5('0x3a')]);var _0xe035d={'where':_0x1aa359[_0x28c5('0x35')]};return db[_0x28c5('0x3b')][_0x28c5('0x20')](_0xe035d)[_0x28c5('0x24')](function(_0x1a1e8f){_0x323334['count']=_0x1a1e8f;if(_0x489e2a['query'][_0x28c5('0x3c')]){_0x1aa359[_0x28c5('0x3d')]=[{'all':!![]}];}return db[_0x28c5('0x3b')][_0x28c5('0x3e')](_0x1aa359);})[_0x28c5('0x24')](function(_0x3c6a7){_0x323334[_0x28c5('0x3f')]=_0x3c6a7;return _0x323334;})[_0x28c5('0x24')](respondWithFilteredResult(_0x4784c3,_0x1aa359))[_0x28c5('0x40')](handleError(_0x4784c3,null));};exports['show']=function(_0x1a49d3,_0x3448ff){var _0x579055={'raw':!![],'where':{'id':_0x1a49d3[_0x28c5('0x41')]['id']}},_0x580998={};_0x580998['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x580998[_0x28c5('0x2e')]=_[_0x28c5('0x2f')](_0x1a49d3[_0x28c5('0x2e')]);_0x580998[_0x28c5('0x36')]=_[_0x28c5('0x30')](_0x580998[_0x28c5('0x2d')],_0x580998[_0x28c5('0x2e')]);_0x579055[_0x28c5('0x31')]=_['intersection'](_0x580998[_0x28c5('0x2d')],qs['fields'](_0x1a49d3[_0x28c5('0x2e')][_0x28c5('0x42')]));_0x579055[_0x28c5('0x31')]=_0x579055[_0x28c5('0x31')][_0x28c5('0x43')]?_0x579055['attributes']:_0x580998[_0x28c5('0x2d')];if(_0x1a49d3[_0x28c5('0x2e')]['includeAll']){_0x579055[_0x28c5('0x3d')]=[{'all':!![]}];}_0x579055=_['merge']({},_0x579055,_0x1a49d3[_0x28c5('0x3a')]);return db['JscriptyAnswerReport'][_0x28c5('0x44')](_0x579055)[_0x28c5('0x24')](handleEntityNotFound(_0x3448ff,null))['then'](respondWithResult(_0x3448ff,null))['catch'](handleError(_0x3448ff,null));};exports['create']=function(_0x36a9da,_0x4fe58e){return db[_0x28c5('0x3b')][_0x28c5('0x45')](_0x36a9da[_0x28c5('0x46')],{})['then'](respondWithResult(_0x4fe58e,0xc9))[_0x28c5('0x40')](handleError(_0x4fe58e,null));};exports[_0x28c5('0x47')]=function(_0x4682af,_0x51c6b9){if(_0x4682af[_0x28c5('0x46')]['id']){delete _0x4682af[_0x28c5('0x46')]['id'];}return db[_0x28c5('0x3b')][_0x28c5('0x44')]({'where':{'id':_0x4682af[_0x28c5('0x41')]['id']}})[_0x28c5('0x24')](handleEntityNotFound(_0x51c6b9,null))['then'](saveUpdates(_0x4682af['body'],null))['then'](respondWithResult(_0x51c6b9,null))[_0x28c5('0x40')](handleError(_0x51c6b9,null));};exports[_0x28c5('0x48')]=function(_0x2401c3,_0x3f3237){return db[_0x28c5('0x3b')]['find']({'where':{'id':_0x2401c3[_0x28c5('0x41')]['id']}})[_0x28c5('0x24')](handleEntityNotFound(_0x3f3237,null))[_0x28c5('0x24')](removeEntity(_0x3f3237,null))['catch'](handleError(_0x3f3237,null));};exports[_0x28c5('0x49')]=function(_0x3edca4,_0x551978){return db[_0x28c5('0x3b')][_0x28c5('0x49')]()[_0x28c5('0x24')](respondWithResult(_0x551978,null))[_0x28c5('0x40')](handleError(_0x551978,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 011438f..51ee801 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 _0x55e9=['rimraf','../../config/environment','exports','define','JscriptyAnswerReport','lodash','util','api','moment','bluebird'];(function(_0x1f7a9b,_0x509a80){var _0x54d889=function(_0x59a32c){while(--_0x59a32c){_0x1f7a9b['push'](_0x1f7a9b['shift']());}};_0x54d889(++_0x509a80);}(_0x55e9,0x195));var _0x955e=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x55e9[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0x955e('0x0'));var util=require(_0x955e('0x1'));var logger=require('../../config/logger')(_0x955e('0x2'));var moment=require(_0x955e('0x3'));var BPromise=require(_0x955e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x955e('0x5'));var config=require(_0x955e('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x955e('0x7')]=function(_0x21f302,_0x1a0ff7){return _0x21f302[_0x955e('0x8')](_0x955e('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3892=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3892,0x10e));var _0x2389=function(_0x11ebfb,_0x2a92ce){_0x11ebfb=_0x11ebfb-0x0;var _0x2a6f41=_0x3892[_0x11ebfb];return _0x2a6f41;};'use strict';var _=require(_0x2389('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2389('0x1'));var moment=require('moment');var BPromise=require(_0x2389('0x2'));var rp=require(_0x2389('0x3'));var fs=require('fs');var path=require(_0x2389('0x4'));var rimraf=require(_0x2389('0x5'));var config=require(_0x2389('0x6'));var attributes=require(_0x2389('0x7'));module[_0x2389('0x8')]=function(_0x17d110,_0xbf562a){return _0x17d110[_0x2389('0x9')](_0x2389('0xa'),attributes,{'tableName':_0x2389('0xb'),'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 101639c..23f27e7 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 _0xd318=['error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x467622,_0x4ad91){var _0x35ca1a=function(_0x1cdb34){while(--_0x1cdb34){_0x467622['push'](_0x467622['shift']());}};_0x35ca1a(++_0x4ad91);}(_0xd318,0x119));var _0x8d31=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd318[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x8d31('0x0'));var moment=require(_0x8d31('0x1'));var BPromise=require(_0x8d31('0x2'));var rs=require(_0x8d31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d31('0x4'))['db'];var utils=require(_0x8d31('0x5'));var logger=require(_0x8d31('0x6'))(_0x8d31('0x7'));var config=require(_0x8d31('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8d31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4246e3,_0x242c95,_0x4b4b93){return new BPromise(function(_0x1998e2,_0x272fcb){return client[_0x8d31('0xa')](_0x4246e3,_0x4b4b93)[_0x8d31('0xb')](function(_0x446b24){logger[_0x8d31('0xc')](_0x8d31('0xd'),_0x242c95,'request\x20sent');logger[_0x8d31('0xe')](_0x8d31('0xf'),_0x242c95,_0x8d31('0x10'),JSON[_0x8d31('0x11')](_0x446b24));if(_0x446b24['error']){if(_0x446b24[_0x8d31('0x12')][_0x8d31('0x13')]===0x1f4){logger['error'](_0x8d31('0xd'),_0x242c95,_0x446b24[_0x8d31('0x12')]['message']);return _0x272fcb(_0x446b24[_0x8d31('0x12')][_0x8d31('0x14')]);}logger[_0x8d31('0x12')](_0x8d31('0xd'),_0x242c95,_0x446b24[_0x8d31('0x12')][_0x8d31('0x14')]);return _0x1998e2(_0x446b24['error'][_0x8d31('0x14')]);}else{logger[_0x8d31('0xc')](_0x8d31('0xd'),_0x242c95,_0x8d31('0x10'));_0x1998e2(_0x446b24[_0x8d31('0x15')]['message']);}})[_0x8d31('0x16')](function(_0x2b8cb4){logger[_0x8d31('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x242c95,_0x2b8cb4);_0x272fcb(_0x2b8cb4);});});} \ No newline at end of file +var _0xfa23=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4769c6,_0x3086e8){var _0x4bc451=function(_0x15f699){while(--_0x15f699){_0x4769c6['push'](_0x4769c6['shift']());}};_0x4bc451(++_0x3086e8);}(_0xfa23,0x1dd));var _0x3fa2=function(_0xa7e836,_0x613d38){_0xa7e836=_0xa7e836-0x0;var _0x167c6d=_0xfa23[_0xa7e836];return _0x167c6d;};'use strict';var _=require('lodash');var util=require(_0x3fa2('0x0'));var moment=require(_0x3fa2('0x1'));var BPromise=require(_0x3fa2('0x2'));var rs=require(_0x3fa2('0x3'));var fs=require('fs');var Redis=require(_0x3fa2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fa2('0x5'));var logger=require(_0x3fa2('0x6'))(_0x3fa2('0x7'));var config=require(_0x3fa2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fa2('0x9')][_0x3fa2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b23c1,_0x14967b,_0x4a3647){return new BPromise(function(_0x15c83b,_0x219c1f){return client[_0x3fa2('0xb')](_0x5b23c1,_0x4a3647)[_0x3fa2('0xc')](function(_0x210e70){logger[_0x3fa2('0xd')](_0x3fa2('0xe'),_0x14967b,_0x3fa2('0xf'));logger[_0x3fa2('0x10')](_0x3fa2('0x11'),_0x14967b,'request\x20sent',JSON['stringify'](_0x210e70));if(_0x210e70['error']){if(_0x210e70[_0x3fa2('0x12')][_0x3fa2('0x13')]===0x1f4){logger[_0x3fa2('0x12')](_0x3fa2('0xe'),_0x14967b,_0x210e70[_0x3fa2('0x12')][_0x3fa2('0x14')]);return _0x219c1f(_0x210e70[_0x3fa2('0x12')][_0x3fa2('0x14')]);}logger[_0x3fa2('0x12')](_0x3fa2('0xe'),_0x14967b,_0x210e70[_0x3fa2('0x12')][_0x3fa2('0x14')]);return _0x15c83b(_0x210e70[_0x3fa2('0x12')][_0x3fa2('0x14')]);}else{logger['info'](_0x3fa2('0xe'),_0x14967b,_0x3fa2('0xf'));_0x15c83b(_0x210e70[_0x3fa2('0x15')][_0x3fa2('0x14')]);}})[_0x3fa2('0x16')](function(_0x112b6e){logger[_0x3fa2('0x12')](_0x3fa2('0xe'),_0x14967b,_0x112b6e);_0x219c1f(_0x112b6e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 012f3b3..b392228 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 _0x7ec4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','update','destroy','exports'];(function(_0x2beb39,_0x1b3b07){var _0x275cea=function(_0x50648b){while(--_0x50648b){_0x2beb39['push'](_0x2beb39['shift']());}};_0x275cea(++_0x1b3b07);}(_0x7ec4,0x150));var _0x47ec=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7ec4[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x47ec('0x0'));var util=require(_0x47ec('0x1'));var path=require(_0x47ec('0x2'));var timeout=require(_0x47ec('0x3'));var express=require(_0x47ec('0x4'));var router=express[_0x47ec('0x5')]();var fs_extra=require(_0x47ec('0x6'));var auth=require(_0x47ec('0x7'));var interaction=require(_0x47ec('0x8'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x47ec('0x9')](),controller[_0x47ec('0xa')]);router[_0x47ec('0xb')](_0x47ec('0xc'),auth[_0x47ec('0x9')](),controller[_0x47ec('0xd')]);router[_0x47ec('0xb')](_0x47ec('0xe'),auth['isAuthenticated'](),controller[_0x47ec('0xf')]);router[_0x47ec('0xb')](_0x47ec('0x10'),auth[_0x47ec('0x9')](),controller[_0x47ec('0x11')]);router[_0x47ec('0xb')](_0x47ec('0x12'),auth[_0x47ec('0x9')](),timeout(_0x47ec('0x13')),controller[_0x47ec('0x14')]);router[_0x47ec('0x15')]('/',auth[_0x47ec('0x9')](),controller['create']);router[_0x47ec('0x15')](_0x47ec('0x16'),auth[_0x47ec('0x9')](),controller[_0x47ec('0x17')]);router[_0x47ec('0x18')]('/:id',auth[_0x47ec('0x9')](),controller[_0x47ec('0x19')]);router['delete'](_0x47ec('0xc'),auth[_0x47ec('0x9')](),controller[_0x47ec('0x1a')]);module[_0x47ec('0x1b')]=router; \ No newline at end of file +var _0x0db3=['post','/:id/clone','clone','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s'];(function(_0x563e27,_0x581bcc){var _0x5a8768=function(_0x4b204e){while(--_0x4b204e){_0x563e27['push'](_0x563e27['shift']());}};_0x5a8768(++_0x581bcc);}(_0x0db3,0x9e));var _0x30db=function(_0x362daf,_0xa85b22){_0x362daf=_0x362daf-0x0;var _0x14d1d4=_0x0db3[_0x362daf];return _0x14d1d4;};'use strict';var multer=require(_0x30db('0x0'));var util=require(_0x30db('0x1'));var path=require(_0x30db('0x2'));var timeout=require('connect-timeout');var express=require(_0x30db('0x3'));var router=express['Router']();var fs_extra=require(_0x30db('0x4'));var auth=require(_0x30db('0x5'));var interaction=require(_0x30db('0x6'));var config=require('../../config/environment');var controller=require(_0x30db('0x7'));router[_0x30db('0x8')]('/',auth[_0x30db('0x9')](),controller[_0x30db('0xa')]);router[_0x30db('0x8')]('/:id',auth[_0x30db('0x9')](),controller[_0x30db('0xb')]);router[_0x30db('0x8')](_0x30db('0xc'),auth[_0x30db('0x9')](),controller[_0x30db('0xd')]);router[_0x30db('0x8')](_0x30db('0xe'),auth[_0x30db('0x9')](),controller['getAnswers']);router['get'](_0x30db('0xf'),auth[_0x30db('0x9')](),timeout(_0x30db('0x10')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x30db('0x11')](_0x30db('0x12'),auth[_0x30db('0x9')](),controller[_0x30db('0x13')]);router[_0x30db('0x14')](_0x30db('0x15'),auth['isAuthenticated'](),controller[_0x30db('0x16')]);router[_0x30db('0x17')]('/:id',auth[_0x30db('0x9')](),controller[_0x30db('0x18')]);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 9163d20..0e74dca 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 _0x5ca1=['util','exports','STRING','name','long','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x5ca1,0xa3));var _0x15ca=function(_0x368163,_0x1e3010){_0x368163=_0x368163-0x0;var _0x55782e=_0x5ca1[_0x368163];return _0x55782e;};'use strict';var Sequelize=require(_0x15ca('0x0'));var _=require(_0x15ca('0x1'));var util=require(_0x15ca('0x2'));module[_0x15ca('0x3')]={'name':{'type':Sequelize[_0x15ca('0x4')],'unique':_0x15ca('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x15ca('0x6')),'set':function(_0x20e434){if(_['isObjectLike'](_0x20e434)){this[_0x15ca('0x7')](_0x15ca('0x8'),JSON[_0x15ca('0x9')](_0x20e434));}else if(_[_0x15ca('0xa')](_0x20e434)){this[_0x15ca('0x7')]('formData',_0x20e434);}else{this[_0x15ca('0x7')]('formData',util[_0x15ca('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x15ca('0xc')](_0x15ca('0x5'))||'',this[_0x15ca('0xc')](_0x15ca('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x15ca('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x15ca('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ed3=['stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','TEXT','long','setDataValue','formData'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x4ed3,0xca));var _0x34ed=function(_0x45d25f,_0x414062){_0x45d25f=_0x45d25f-0x0;var _0x5eedff=_0x4ed3[_0x45d25f];return _0x5eedff;};'use strict';var Sequelize=require(_0x34ed('0x0'));var _=require('lodash');var util=require(_0x34ed('0x1'));module[_0x34ed('0x2')]={'name':{'type':Sequelize[_0x34ed('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x34ed('0x3')]},'formData':{'type':Sequelize[_0x34ed('0x4')](_0x34ed('0x5')),'set':function(_0x3f301d){if(_['isObjectLike'](_0x3f301d)){this[_0x34ed('0x6')](_0x34ed('0x7'),JSON[_0x34ed('0x8')](_0x3f301d));}else if(_['isString'](_0x3f301d)){this[_0x34ed('0x6')](_0x34ed('0x7'),_0x3f301d);}else{this[_0x34ed('0x6')]('formData',util[_0x34ed('0x9')](_0x34ed('0xa'),this['getDataValue'](_0x34ed('0xb'))||'',this[_0x34ed('0xc')](_0x34ed('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x34ed('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x34ed('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 381a8ab..0b0753f 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 _0xdadf=['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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','reject','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','UserProfileSection','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xdadf,0x175));var _0xfdad=function(_0x2b3a9f,_0x1a13b9){_0x2b3a9f=_0x2b3a9f-0x0;var _0x4d013e=_0xdadf[_0x2b3a9f];return _0x4d013e;};'use strict';var emlformat=require(_0xfdad('0x0'));var rimraf=require(_0xfdad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdad('0x2'));var rp=require(_0xfdad('0x3'));var moment=require(_0xfdad('0x4'));var BPromise=require(_0xfdad('0x5'));var Mustache=require(_0xfdad('0x6'));var util=require(_0xfdad('0x7'));var path=require(_0xfdad('0x8'));var sox=require(_0xfdad('0x9'));var csv=require(_0xfdad('0xa'));var ejs=require(_0xfdad('0xb'));var fs=require('fs');var fs_extra=require(_0xfdad('0xc'));var _=require(_0xfdad('0xd'));var squel=require(_0xfdad('0xe'));var crypto=require(_0xfdad('0xf'));var jsforce=require(_0xfdad('0x10'));var deskjs=require(_0xfdad('0x11'));var toCsv=require(_0xfdad('0xa'));var querystring=require(_0xfdad('0x12'));var Papa=require(_0xfdad('0x13'));var Redis=require(_0xfdad('0x14'));var authService=require(_0xfdad('0x15'));var qs=require(_0xfdad('0x16'));var as=require(_0xfdad('0x17'));var hardwareService=require(_0xfdad('0x18'));var logger=require(_0xfdad('0x19'))(_0xfdad('0x1a'));var utils=require(_0xfdad('0x1b'));var config=require(_0xfdad('0x1c'));var licenseUtil=require(_0xfdad('0x1d'));var db=require(_0xfdad('0x1e'))['db'];function respondWithStatusCode(_0x20923a,_0x56fe68){_0x56fe68=_0x56fe68||0xcc;return function(_0x36d7a1){if(_0x36d7a1){return _0x20923a['sendStatus'](_0x56fe68);}return _0x20923a[_0xfdad('0x1f')](_0x56fe68)[_0xfdad('0x20')]();};}function respondWithResult(_0x3378b9,_0x58a90e){_0x58a90e=_0x58a90e||0xc8;return function(_0x411093){if(_0x411093){return _0x3378b9[_0xfdad('0x1f')](_0x58a90e)[_0xfdad('0x21')](_0x411093);}};}function respondWithFilteredResult(_0x2367f4,_0x560eed){return function(_0x6aa6b3){if(_0x6aa6b3){var _0x5b2b89=typeof _0x560eed['offset']==='undefined'&&typeof _0x560eed[_0xfdad('0x22')]===_0xfdad('0x23');var _0x3fa2bf=_0x6aa6b3[_0xfdad('0x24')];var _0x5a611e=_0x5b2b89?0x0:_0x560eed[_0xfdad('0x25')];var _0x9940d1=_0x5b2b89?_0x6aa6b3[_0xfdad('0x24')]:_0x560eed['offset']+_0x560eed[_0xfdad('0x22')];var _0x4da818;if(_0x9940d1>=_0x3fa2bf){_0x9940d1=_0x3fa2bf;_0x4da818=0xc8;}else{_0x4da818=0xce;}_0x2367f4[_0xfdad('0x1f')](_0x4da818);return _0x2367f4[_0xfdad('0x26')]('Content-Range',_0x5a611e+'-'+_0x9940d1+'/'+_0x3fa2bf)[_0xfdad('0x21')](_0x6aa6b3);}return null;};}function patchUpdates(_0x578c0b){return function(_0x9773e8){try{jsonpatch['apply'](_0x9773e8,_0x578c0b,!![]);}catch(_0x538020){return BPromise[_0xfdad('0x27')](_0x538020);}return _0x9773e8['save']();};}function saveUpdates(_0x31c418,_0x285fd4){return function(_0x17388a){if(_0x17388a){return _0x17388a[_0xfdad('0x28')](_0x31c418)[_0xfdad('0x29')](function(_0x2d35ea){return _0x2d35ea;});}return null;};}function removeEntity(_0xb7d452,_0x31141a){return function(_0x3b9bb7){if(_0x3b9bb7){return _0x3b9bb7[_0xfdad('0x2a')]()[_0xfdad('0x29')](function(){var _0x21249c=_0x3b9bb7[_0xfdad('0x2b')]({'plain':!![]});var _0x3f66b5=_0xfdad('0x2c');return db[_0xfdad('0x2d')][_0xfdad('0x2a')]({'where':{'type':_0x3f66b5,'resourceId':_0x21249c['id']}})[_0xfdad('0x29')](function(){return _0x3b9bb7;});})[_0xfdad('0x29')](function(){_0xb7d452[_0xfdad('0x1f')](0xcc)[_0xfdad('0x20')]();});}};}function handleEntityNotFound(_0x2da828,_0xaab57d){return function(_0x3f6c85){if(!_0x3f6c85){_0x2da828[_0xfdad('0x2e')](0x194);}return _0x3f6c85;};}function handleError(_0x428a8f,_0x22bab9){_0x22bab9=_0x22bab9||0x1f4;return function(_0x2b6fb3){logger[_0xfdad('0x2f')](_0x2b6fb3[_0xfdad('0x30')]);if(_0x2b6fb3[_0xfdad('0x31')]){delete _0x2b6fb3[_0xfdad('0x31')];}_0x428a8f[_0xfdad('0x1f')](_0x22bab9)['send'](_0x2b6fb3);};}exports['index']=function(_0x567f73,_0x248c7b){var _0x23500b={},_0x1db309={},_0x16e5bc={'count':0x0,'rows':[]};var _0x4fa07b=_[_0xfdad('0x32')](db[_0xfdad('0x33')][_0xfdad('0x34')],function(_0x1cbbfc){return{'name':_0x1cbbfc[_0xfdad('0x35')],'type':_0x1cbbfc['type'][_0xfdad('0x36')]};});_0x1db309[_0xfdad('0x37')]=_['map'](_0x4fa07b,_0xfdad('0x31'));_0x1db309[_0xfdad('0x38')]=_[_0xfdad('0x39')](_0x567f73[_0xfdad('0x38')]);_0x1db309[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x1db309[_0xfdad('0x37')],_0x1db309[_0xfdad('0x38')]);_0x23500b['attributes']=_['intersection'](_0x1db309[_0xfdad('0x37')],qs[_0xfdad('0x3c')](_0x567f73[_0xfdad('0x38')][_0xfdad('0x3c')]));_0x23500b[_0xfdad('0x3d')]=_0x23500b[_0xfdad('0x3d')][_0xfdad('0x3e')]?_0x23500b[_0xfdad('0x3d')]:_0x1db309[_0xfdad('0x37')];if(!_0x567f73[_0xfdad('0x38')][_0xfdad('0x3f')](_0xfdad('0x40'))){_0x23500b[_0xfdad('0x22')]=qs[_0xfdad('0x22')](_0x567f73[_0xfdad('0x38')][_0xfdad('0x22')]);_0x23500b[_0xfdad('0x25')]=qs[_0xfdad('0x25')](_0x567f73['query']['offset']);}_0x23500b[_0xfdad('0x41')]=qs[_0xfdad('0x42')](_0x567f73[_0xfdad('0x38')][_0xfdad('0x42')]);_0x23500b[_0xfdad('0x43')]=qs[_0xfdad('0x3a')](_[_0xfdad('0x44')](_0x567f73[_0xfdad('0x38')],_0x1db309[_0xfdad('0x3a')]),_0x4fa07b);if(_0x567f73[_0xfdad('0x38')]['filter']){_0x23500b['where']=_[_0xfdad('0x45')](_0x23500b['where'],{'$or':_[_0xfdad('0x32')](_0x4fa07b,function(_0x1751f9){if(_0x1751f9['type']!==_0xfdad('0x46')){var _0xa1c4e5={};_0xa1c4e5[_0x1751f9['name']]={'$like':'%'+_0x567f73['query'][_0xfdad('0x47')]+'%'};return _0xa1c4e5;}})});}_0x23500b=_[_0xfdad('0x45')]({},_0x23500b,_0x567f73[_0xfdad('0x48')]);var _0x866252={'where':_0x23500b[_0xfdad('0x43')]};return db[_0xfdad('0x33')][_0xfdad('0x24')](_0x866252)[_0xfdad('0x29')](function(_0x54d2fc){_0x16e5bc['count']=_0x54d2fc;if(_0x567f73[_0xfdad('0x38')][_0xfdad('0x49')]){_0x23500b[_0xfdad('0x4a')]=[{'all':!![]}];}return db[_0xfdad('0x33')]['findAll'](_0x23500b);})['then'](function(_0x54a04b){_0x16e5bc[_0xfdad('0x4b')]=_0x54a04b;return _0x16e5bc;})[_0xfdad('0x29')](respondWithFilteredResult(_0x248c7b,_0x23500b))[_0xfdad('0x4c')](handleError(_0x248c7b,null));};exports[_0xfdad('0x4d')]=function(_0x1edd44,_0xd84959){var _0x173201={'raw':![],'where':{'id':_0x1edd44[_0xfdad('0x4e')]['id']}},_0x90eb98={};_0x90eb98[_0xfdad('0x37')]=_['keys'](db['JscriptyProject'][_0xfdad('0x34')]);_0x90eb98[_0xfdad('0x38')]=_[_0xfdad('0x39')](_0x1edd44['query']);_0x90eb98[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x90eb98[_0xfdad('0x37')],_0x90eb98['query']);_0x173201['attributes']=_['intersection'](_0x90eb98[_0xfdad('0x37')],qs[_0xfdad('0x3c')](_0x1edd44[_0xfdad('0x38')][_0xfdad('0x3c')]));_0x173201[_0xfdad('0x3d')]=_0x173201[_0xfdad('0x3d')]['length']?_0x173201[_0xfdad('0x3d')]:_0x90eb98[_0xfdad('0x37')];if(_0x1edd44['query']['includeAll']){_0x173201[_0xfdad('0x4a')]=[{'all':!![]}];}_0x173201=_['merge']({},_0x173201,_0x1edd44['options']);return db[_0xfdad('0x33')][_0xfdad('0x4f')](_0x173201)['then'](handleEntityNotFound(_0xd84959,null))[_0xfdad('0x29')](respondWithResult(_0xd84959,null))[_0xfdad('0x4c')](handleError(_0xd84959,null));};exports['create']=function(_0x4a9e0e,_0x24fc2b){return db[_0xfdad('0x33')][_0xfdad('0x50')](_0x4a9e0e['body'],{})[_0xfdad('0x29')](function(_0x35f32f){var _0x365dbe=_0x4a9e0e[_0xfdad('0x51')][_0xfdad('0x2b')]({'plain':!![]});if(!_0x365dbe)throw new Error(_0xfdad('0x52'));if(_0x365dbe[_0xfdad('0x53')]===_0xfdad('0x51')){var _0x396e7f=_0x35f32f[_0xfdad('0x2b')]({'plain':!![]});var _0x5607e9='Projects';return db['UserProfileSection'][_0xfdad('0x4f')]({'where':{'name':_0x5607e9,'userProfileId':_0x365dbe[_0xfdad('0x54')]},'raw':!![]})['then'](function(_0x37fdfb){if(_0x37fdfb&&_0x37fdfb[_0xfdad('0x55')]===0x0){return db[_0xfdad('0x2d')][_0xfdad('0x50')]({'name':_0x396e7f[_0xfdad('0x31')],'resourceId':_0x396e7f['id'],'type':_0x37fdfb[_0xfdad('0x31')],'sectionId':_0x37fdfb['id']},{})[_0xfdad('0x29')](function(){return _0x35f32f;});}else{return _0x35f32f;}})[_0xfdad('0x4c')](function(_0xa3292f){logger[_0xfdad('0x2f')](_0xfdad('0x56'),_0xa3292f);throw _0xa3292f;});}return _0x35f32f;})[_0xfdad('0x29')](respondWithResult(_0x24fc2b,0xc9))[_0xfdad('0x4c')](handleError(_0x24fc2b,null));};exports[_0xfdad('0x57')]=function(_0x57b63e,_0x27a4a8){var _0x3a1a69={'where':{'id':_0x57b63e[_0xfdad('0x4e')]['id']}},_0x1c2a8e={};_0x1c2a8e[_0xfdad('0x37')]=_[_0xfdad('0x39')](db[_0xfdad('0x33')][_0xfdad('0x34')]);_0x3a1a69[_0xfdad('0x3d')]=_[_0xfdad('0x3b')](_0x1c2a8e[_0xfdad('0x37')],qs[_0xfdad('0x3c')](_0x57b63e['query'][_0xfdad('0x3c')]));_0x3a1a69[_0xfdad('0x3d')]=_0x3a1a69[_0xfdad('0x3d')]['length']?_0x3a1a69[_0xfdad('0x3d')]:_0x1c2a8e['model'];if(_0x57b63e[_0xfdad('0x38')][_0xfdad('0x49')]){_0x3a1a69[_0xfdad('0x4a')]=[{'all':!![]}];}_0x3a1a69=_[_0xfdad('0x45')]({},_0x3a1a69,_0x57b63e[_0xfdad('0x48')]);return db[_0xfdad('0x33')][_0xfdad('0x4f')](_0x3a1a69)['then'](handleEntityNotFound(_0x27a4a8,null))['then'](function(_0x4184de){if(_0x4184de){var _0x5e3852=_0x4184de[_0xfdad('0x2b')]({'plain':!![]});_0x5e3852=qs[_0xfdad('0x58')](_0x5e3852,['id',_0xfdad('0x59'),_0xfdad('0x5a')]);_0x57b63e['body']=_['omit'](_0x57b63e[_0xfdad('0x5b')],['id',_0xfdad('0x59'),_0xfdad('0x5a')]);return db[_0xfdad('0x33')][_0xfdad('0x50')](_[_0xfdad('0x45')](_0x5e3852,_0x57b63e[_0xfdad('0x5b')]),{'include':_0x57b63e[_0xfdad('0x38')][_0xfdad('0x49')]?[{'all':!![]}]:undefined})[_0xfdad('0x29')](function(_0x478d52){var _0x454e36=_0x57b63e[_0xfdad('0x51')][_0xfdad('0x2b')]({'plain':!![]});if(!_0x454e36)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x454e36[_0xfdad('0x53')]===_0xfdad('0x51')){var _0x19ebcf=_0x478d52['get']({'plain':!![]});var _0x4a31d3=_0xfdad('0x2c');return db[_0xfdad('0x5c')][_0xfdad('0x4f')]({'where':{'name':_0x4a31d3,'userProfileId':_0x454e36[_0xfdad('0x54')]},'raw':!![]})[_0xfdad('0x29')](function(_0x255f51){if(_0x255f51&&_0x255f51[_0xfdad('0x55')]===0x0){return db[_0xfdad('0x2d')][_0xfdad('0x50')]({'name':_0x19ebcf[_0xfdad('0x31')],'resourceId':_0x19ebcf['id'],'type':_0x255f51[_0xfdad('0x31')],'sectionId':_0x255f51['id']},{})[_0xfdad('0x29')](function(){return _0x478d52;});}else{return _0x478d52;}})['catch'](function(_0x482e5a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x482e5a);throw _0x482e5a;});}return _0x478d52;});}})['then'](respondWithResult(_0x27a4a8,0xc9))[_0xfdad('0x4c')](handleError(_0x27a4a8,null));};exports[_0xfdad('0x28')]=function(_0x5440bb,_0x1270d8){if(_0x5440bb['body']['id']){delete _0x5440bb[_0xfdad('0x5b')]['id'];}return db[_0xfdad('0x33')]['find']({'where':{'id':_0x5440bb[_0xfdad('0x4e')]['id']}})[_0xfdad('0x29')](handleEntityNotFound(_0x1270d8,null))['then'](saveUpdates(_0x5440bb[_0xfdad('0x5b')],null))[_0xfdad('0x29')](respondWithResult(_0x1270d8,null))['catch'](handleError(_0x1270d8,null));};exports[_0xfdad('0x2a')]=function(_0x5030c0,_0xa52f40){return db['JscriptyProject'][_0xfdad('0x4f')]({'where':{'id':_0x5030c0[_0xfdad('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa52f40,null))['then'](removeEntity(_0xa52f40,null))[_0xfdad('0x4c')](handleError(_0xa52f40,null));};exports[_0xfdad('0x5d')]=function(_0x440b63,_0x57d458,_0x16c2ad){var _0x26deac={'raw':!![],'where':{}};var _0x115d61={};var _0x25179e={'count':0x0,'rows':[]};return db[_0xfdad('0x33')][_0xfdad('0x5e')]({'where':{'id':_0x440b63[_0xfdad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57d458,null))['then'](function(_0x2a03b5){if(_0x2a03b5){_0x115d61[_0xfdad('0x37')]=_[_0xfdad('0x39')](db[_0xfdad('0x5f')][_0xfdad('0x34')]);_0x115d61[_0xfdad('0x38')]=_[_0xfdad('0x39')](_0x440b63[_0xfdad('0x38')]);_0x115d61[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x115d61[_0xfdad('0x37')],_0x115d61[_0xfdad('0x38')]);_0x26deac[_0xfdad('0x3d')]=_[_0xfdad('0x3b')](_0x115d61['model'],qs[_0xfdad('0x3c')](_0x440b63[_0xfdad('0x38')]['fields']));_0x26deac[_0xfdad('0x3d')]=_0x26deac[_0xfdad('0x3d')][_0xfdad('0x3e')]?_0x26deac[_0xfdad('0x3d')]:_0x115d61[_0xfdad('0x37')];if(!_0x440b63['query'][_0xfdad('0x3f')](_0xfdad('0x40'))){_0x26deac[_0xfdad('0x22')]=qs[_0xfdad('0x22')](_0x440b63['query'][_0xfdad('0x22')]);_0x26deac['offset']=qs['offset'](_0x440b63[_0xfdad('0x38')][_0xfdad('0x25')]);}_0x26deac[_0xfdad('0x41')]=qs[_0xfdad('0x42')](_0x440b63[_0xfdad('0x38')]['sort']);_0x26deac[_0xfdad('0x43')]=qs[_0xfdad('0x3a')](_[_0xfdad('0x44')](_0x440b63['query'],_0x115d61[_0xfdad('0x3a')]));_0x26deac['where'][_0xfdad('0x60')]=_0x2a03b5['id'];if(_0x440b63[_0xfdad('0x38')]['filter']){_0x26deac[_0xfdad('0x43')]=_['merge'](_0x26deac['where'],{'$or':_[_0xfdad('0x32')](_0x26deac['attributes'],function(_0x697c62){var _0x20b2df={};_0x20b2df[_0x697c62]={'$like':'%'+_0x440b63['query'][_0xfdad('0x47')]+'%'};return _0x20b2df;})});}_0x26deac=_[_0xfdad('0x45')]({},_0x26deac,_0x440b63[_0xfdad('0x48')]);return db[_0xfdad('0x5f')]['count']({'where':_0x26deac[_0xfdad('0x43')]})['then'](function(_0x2ae35d){_0x25179e[_0xfdad('0x24')]=_0x2ae35d;if(_0x440b63[_0xfdad('0x38')][_0xfdad('0x49')]){_0x26deac[_0xfdad('0x4a')]=[{'all':!![]}];}return db[_0xfdad('0x5f')][_0xfdad('0x61')](_0x26deac);})[_0xfdad('0x29')](function(_0xbd4e4a){_0x25179e[_0xfdad('0x4b')]=_0xbd4e4a;return _0x25179e;});}})[_0xfdad('0x29')](respondWithFilteredResult(_0x57d458,_0x26deac))[_0xfdad('0x4c')](handleError(_0x57d458,null));};exports[_0xfdad('0x62')]=function(_0x298a41,_0x824b4a,_0x4f0991){var _0x42b0b9={'raw':!![],'where':{}};var _0x2ad2da={};var _0x1bbd9a={'count':0x0,'rows':[]};return db[_0xfdad('0x33')][_0xfdad('0x5e')]({'where':{'id':_0x298a41[_0xfdad('0x4e')]['id']}})[_0xfdad('0x29')](handleEntityNotFound(_0x824b4a,null))[_0xfdad('0x29')](function(_0x271a57){if(_0x271a57){_0x2ad2da[_0xfdad('0x37')]=_[_0xfdad('0x39')](db[_0xfdad('0x63')][_0xfdad('0x34')]);_0x2ad2da[_0xfdad('0x38')]=_[_0xfdad('0x39')](_0x298a41[_0xfdad('0x38')]);_0x2ad2da[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x2ad2da[_0xfdad('0x37')],_0x2ad2da[_0xfdad('0x38')]);_0x42b0b9[_0xfdad('0x3d')]=_[_0xfdad('0x3b')](_0x2ad2da[_0xfdad('0x37')],qs[_0xfdad('0x3c')](_0x298a41[_0xfdad('0x38')][_0xfdad('0x3c')]));_0x42b0b9[_0xfdad('0x3d')]=_0x42b0b9['attributes'][_0xfdad('0x3e')]?_0x42b0b9[_0xfdad('0x3d')]:_0x2ad2da['model'];if(!_0x298a41[_0xfdad('0x38')][_0xfdad('0x3f')](_0xfdad('0x40'))){_0x42b0b9['limit']=qs['limit'](_0x298a41[_0xfdad('0x38')][_0xfdad('0x22')]);_0x42b0b9[_0xfdad('0x25')]=qs[_0xfdad('0x25')](_0x298a41[_0xfdad('0x38')][_0xfdad('0x25')]);}_0x42b0b9['order']=qs[_0xfdad('0x42')](_0x298a41[_0xfdad('0x38')][_0xfdad('0x42')]);_0x42b0b9['where']=qs[_0xfdad('0x3a')](_[_0xfdad('0x44')](_0x298a41[_0xfdad('0x38')],_0x2ad2da[_0xfdad('0x3a')]));_0x42b0b9[_0xfdad('0x43')][_0xfdad('0x60')]=_0x271a57['id'];if(_0x298a41[_0xfdad('0x38')][_0xfdad('0x47')]){_0x42b0b9[_0xfdad('0x43')]=_[_0xfdad('0x45')](_0x42b0b9[_0xfdad('0x43')],{'$or':_[_0xfdad('0x32')](_0x42b0b9[_0xfdad('0x3d')],function(_0x38189d){var _0x5acf4f={};_0x5acf4f[_0x38189d]={'$like':'%'+_0x298a41[_0xfdad('0x38')][_0xfdad('0x47')]+'%'};return _0x5acf4f;})});}_0x42b0b9=_['merge']({},_0x42b0b9,_0x298a41['options']);return db['JscriptyAnswerReport'][_0xfdad('0x24')]({'where':_0x42b0b9[_0xfdad('0x43')]})[_0xfdad('0x29')](function(_0x27278e){_0x1bbd9a[_0xfdad('0x24')]=_0x27278e;if(_0x298a41[_0xfdad('0x38')][_0xfdad('0x49')]){_0x42b0b9[_0xfdad('0x4a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xfdad('0x61')](_0x42b0b9);})['then'](function(_0x5063a2){_0x1bbd9a[_0xfdad('0x4b')]=_0x5063a2;return _0x1bbd9a;});}})[_0xfdad('0x29')](respondWithFilteredResult(_0x824b4a,_0x42b0b9))[_0xfdad('0x4c')](handleError(_0x824b4a,null));};function char(_0x565a8f){return _0xfdad('0x64')===typeof _0x565a8f?String[_0xfdad('0x65')][_0xfdad('0x66')](null,arguments):_0x565a8f;}function needsEncapsulation(_0x54c045){return!!_0x54c045&&(_0x54c045[_0xfdad('0x67')]()[_0xfdad('0x68')](char(0xd))>=0x0||_0x54c045[_0xfdad('0x67')]()['indexOf'](char(0xa))>=0x0||_0x54c045['toString']()[_0xfdad('0x68')](char(0x2c))>=0x0||_0x54c045[_0xfdad('0x67')]()[_0xfdad('0x68')](char(0x22))>=0x0);}function encapsulate(_0x497ad9){var _0x1fe2df=char(0x22),_0x9534a7='\x5c'+char(0x22),_0x55bba4=_0x497ad9['toString']()[_0xfdad('0x69')](new RegExp(_0x1fe2df,'g'),_0x9534a7);return _0x1fe2df+_0x55bba4+_0x1fe2df;}exports['getSummary']=function(_0x180815,_0x39b229,_0x5ec49f){var _0x12f1a1,_0x5018b1;var _0x17409e={'where':{'ProjectId':_0x180815[_0xfdad('0x4e')]['id']}};if(_0x180815[_0xfdad('0x38')]['startTime']){_0x17409e[_0xfdad('0x43')][_0xfdad('0x6a')]=JSON[_0xfdad('0x6b')](_0x180815['query'][_0xfdad('0x6c')]);}return db[_0xfdad('0x5f')][_0xfdad('0x61')](_0x17409e)[_0xfdad('0x29')](handleEntityNotFound(_0x39b229,null))[_0xfdad('0x29')](function(_0xe2e1ea){if(_0xe2e1ea){_0x12f1a1=_0xe2e1ea;return db[_0xfdad('0x6d')]['findAll']({'where':{'SessionId':{'$in':_[_0xfdad('0x32')](_0x12f1a1,'id')},'ProjectId':_0x180815[_0xfdad('0x4e')]['id']},'order':_0xfdad('0x6e')});}})[_0xfdad('0x29')](handleEntityNotFound(_0x39b229,null))['then'](function(_0x381856){if(_0x381856){_0x5018b1=_0x381856;var _0x16fd6b={};for(var _0x591767=0x0,_0x3dc27f=_0x5018b1[_0xfdad('0x3e')];_0x591767<_0x3dc27f;_0x591767++){if(!_0x16fd6b[_0xfdad('0x3f')](_0x5018b1[_0x591767][_0xfdad('0x6f')])){_0x16fd6b[_0x5018b1[_0x591767]['questionId']]=needsEncapsulation(_0x5018b1[_0x591767]['question'])?encapsulate(_0x5018b1[_0x591767]['question']):_0x5018b1[_0x591767][_0xfdad('0x70')];}}var _0x5b4d61=[],_0x50cf74={};for(var _0x5b05be=0x0,_0x1eb9d3=_0x12f1a1[_0xfdad('0x3e')];_0x5b05be<_0x1eb9d3;_0x5b05be++){_0x50cf74={'ProjectId':_0x180815['params']['id'],'SessionId':_0x12f1a1[_0x5b05be]['id'],'StartTime':moment(_0x12f1a1[_0x5b05be]['starttime'])[_0xfdad('0x71')](_0xfdad('0x72'))};for(var _0x4618b5=0x0,_0x2bc162=_0x5018b1[_0xfdad('0x3e')];_0x4618b5<_0x2bc162;_0x4618b5++){if(_0x5018b1[_0x4618b5][_0xfdad('0x73')]==_0x12f1a1[_0x5b05be]['id']&&_0x16fd6b['hasOwnProperty'](_0x5018b1[_0x4618b5][_0xfdad('0x6f')])){_0x50cf74[_0x16fd6b[_0x5018b1[_0x4618b5][_0xfdad('0x6f')]]]=_0x5018b1[_0x4618b5][_0xfdad('0x74')];}}for(var _0xce1acc in _0x16fd6b){if(!_0x50cf74['hasOwnProperty'](_0x16fd6b[_0xce1acc])){_0x50cf74[_0x16fd6b[_0xce1acc]]=null;}}_0x5b4d61['push'](_0x50cf74);}return _0x5b4d61;}})[_0xfdad('0x29')](function(_0x221ab8){if(!_['isEmpty'](_0x221ab8)){var _0x19ab38=toCsv(_0x221ab8);var _0x4cac4b=Date[_0xfdad('0x75')]();fs[_0xfdad('0x76')](util['format'](_0xfdad('0x77'),_0x180815[_0xfdad('0x4e')]['id'],_0x4cac4b),_0x19ab38);_0x39b229[_0xfdad('0x78')](_0xfdad('0x79'),_0xfdad('0x7a')+util[_0xfdad('0x71')](_0xfdad('0x7b'),_0x180815[_0xfdad('0x4e')]['id'],_0x4cac4b));_0x39b229[_0xfdad('0x78')](_0xfdad('0x7c'),'text/csv');return _0x39b229[_0xfdad('0x7d')](util[_0xfdad('0x71')](_0xfdad('0x77'),_0x180815[_0xfdad('0x4e')]['id'],_0x4cac4b));}else{return _0x39b229[_0xfdad('0x2e')](0xcc);}})[_0xfdad('0x4c')](handleError(_0x39b229,null));}; \ No newline at end of file +var _0x9672=['util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','Projects','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','JscriptyProject','include','findAll','catch','includeAll','options','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','nolimit','number','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x9672,0xee));var _0x2967=function(_0x2799aa,_0x2dfad0){_0x2799aa=_0x2799aa-0x0;var _0x4a2de1=_0x9672[_0x2799aa];return _0x4a2de1;};'use strict';var emlformat=require(_0x2967('0x0'));var rimraf=require(_0x2967('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2967('0x2'));var rp=require(_0x2967('0x3'));var moment=require(_0x2967('0x4'));var BPromise=require(_0x2967('0x5'));var Mustache=require('mustache');var util=require(_0x2967('0x6'));var path=require(_0x2967('0x7'));var sox=require(_0x2967('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2967('0x9'));var _=require(_0x2967('0xa'));var squel=require(_0x2967('0xb'));var crypto=require(_0x2967('0xc'));var jsforce=require(_0x2967('0xd'));var deskjs=require(_0x2967('0xe'));var toCsv=require(_0x2967('0xf'));var querystring=require(_0x2967('0x10'));var Papa=require('papaparse');var Redis=require(_0x2967('0x11'));var authService=require(_0x2967('0x12'));var qs=require(_0x2967('0x13'));var as=require(_0x2967('0x14'));var hardwareService=require(_0x2967('0x15'));var logger=require(_0x2967('0x16'))('api');var utils=require(_0x2967('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2967('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207630,_0x298f58){_0x298f58=_0x298f58||0xcc;return function(_0x4d777a){if(_0x4d777a){return _0x207630[_0x2967('0x19')](_0x298f58);}return _0x207630['status'](_0x298f58)[_0x2967('0x1a')]();};}function respondWithResult(_0x313b5c,_0x3ea4b3){_0x3ea4b3=_0x3ea4b3||0xc8;return function(_0x52d5c0){if(_0x52d5c0){return _0x313b5c['status'](_0x3ea4b3)[_0x2967('0x1b')](_0x52d5c0);}};}function respondWithFilteredResult(_0x9a4e11,_0x42296c){return function(_0x4e1d34){if(_0x4e1d34){var _0x574a9f=typeof _0x42296c[_0x2967('0x1c')]===_0x2967('0x1d')&&typeof _0x42296c[_0x2967('0x1e')]===_0x2967('0x1d');var _0x50fbcb=_0x4e1d34[_0x2967('0x1f')];var _0x426fee=_0x574a9f?0x0:_0x42296c[_0x2967('0x1c')];var _0x209f45=_0x574a9f?_0x4e1d34[_0x2967('0x1f')]:_0x42296c['offset']+_0x42296c[_0x2967('0x1e')];var _0x449991;if(_0x209f45>=_0x50fbcb){_0x209f45=_0x50fbcb;_0x449991=0xc8;}else{_0x449991=0xce;}_0x9a4e11[_0x2967('0x20')](_0x449991);return _0x9a4e11[_0x2967('0x21')]('Content-Range',_0x426fee+'-'+_0x209f45+'/'+_0x50fbcb)[_0x2967('0x1b')](_0x4e1d34);}return null;};}function patchUpdates(_0x1cb5e4){return function(_0x33bb91){try{jsonpatch['apply'](_0x33bb91,_0x1cb5e4,!![]);}catch(_0x5e0e26){return BPromise[_0x2967('0x22')](_0x5e0e26);}return _0x33bb91[_0x2967('0x23')]();};}function saveUpdates(_0x258eca,_0x10788e){return function(_0x832a72){if(_0x832a72){return _0x832a72[_0x2967('0x24')](_0x258eca)[_0x2967('0x25')](function(_0x3d1040){return _0x3d1040;});}return null;};}function removeEntity(_0x46ab4a,_0x5bd687){return function(_0x436b45){if(_0x436b45){return _0x436b45[_0x2967('0x26')]()[_0x2967('0x25')](function(){var _0x197763=_0x436b45['get']({'plain':!![]});var _0x42acb3=_0x2967('0x27');return db['UserProfileResource'][_0x2967('0x26')]({'where':{'type':_0x42acb3,'resourceId':_0x197763['id']}})[_0x2967('0x25')](function(){return _0x436b45;});})[_0x2967('0x25')](function(){_0x46ab4a[_0x2967('0x20')](0xcc)[_0x2967('0x1a')]();});}};}function handleEntityNotFound(_0x36c1d9,_0x1a3d42){return function(_0x4e0603){if(!_0x4e0603){_0x36c1d9[_0x2967('0x19')](0x194);}return _0x4e0603;};}function handleError(_0x2a0ad8,_0x1eefcb){_0x1eefcb=_0x1eefcb||0x1f4;return function(_0x57cee6){logger[_0x2967('0x28')](_0x57cee6[_0x2967('0x29')]);if(_0x57cee6[_0x2967('0x2a')]){delete _0x57cee6['name'];}_0x2a0ad8[_0x2967('0x20')](_0x1eefcb)[_0x2967('0x2b')](_0x57cee6);};}exports['index']=function(_0x1ee7cb,_0x45c7fd){var _0xcf476e={},_0x506c4e={},_0xbb2094={'count':0x0,'rows':[]};var _0xa264c9=_[_0x2967('0x2c')](db['JscriptyProject'][_0x2967('0x2d')],function(_0x2589b1){return{'name':_0x2589b1[_0x2967('0x2e')],'type':_0x2589b1[_0x2967('0x2f')][_0x2967('0x30')]};});_0x506c4e[_0x2967('0x31')]=_[_0x2967('0x2c')](_0xa264c9,_0x2967('0x2a'));_0x506c4e[_0x2967('0x32')]=_[_0x2967('0x33')](_0x1ee7cb[_0x2967('0x32')]);_0x506c4e[_0x2967('0x34')]=_[_0x2967('0x35')](_0x506c4e[_0x2967('0x31')],_0x506c4e[_0x2967('0x32')]);_0xcf476e[_0x2967('0x36')]=_['intersection'](_0x506c4e['model'],qs[_0x2967('0x37')](_0x1ee7cb[_0x2967('0x32')][_0x2967('0x37')]));_0xcf476e[_0x2967('0x36')]=_0xcf476e['attributes'][_0x2967('0x38')]?_0xcf476e['attributes']:_0x506c4e[_0x2967('0x31')];if(!_0x1ee7cb[_0x2967('0x32')][_0x2967('0x39')]('nolimit')){_0xcf476e[_0x2967('0x1e')]=qs['limit'](_0x1ee7cb[_0x2967('0x32')]['limit']);_0xcf476e[_0x2967('0x1c')]=qs[_0x2967('0x1c')](_0x1ee7cb['query'][_0x2967('0x1c')]);}_0xcf476e[_0x2967('0x3a')]=qs[_0x2967('0x3b')](_0x1ee7cb[_0x2967('0x32')][_0x2967('0x3b')]);_0xcf476e[_0x2967('0x3c')]=qs[_0x2967('0x34')](_[_0x2967('0x3d')](_0x1ee7cb[_0x2967('0x32')],_0x506c4e[_0x2967('0x34')]),_0xa264c9);if(_0x1ee7cb[_0x2967('0x32')][_0x2967('0x3e')]){_0xcf476e[_0x2967('0x3c')]=_[_0x2967('0x3f')](_0xcf476e[_0x2967('0x3c')],{'$or':_[_0x2967('0x2c')](_0xa264c9,function(_0x22d07e){if(_0x22d07e[_0x2967('0x2f')]!==_0x2967('0x40')){var _0x27cdd8={};_0x27cdd8[_0x22d07e[_0x2967('0x2a')]]={'$like':'%'+_0x1ee7cb[_0x2967('0x32')][_0x2967('0x3e')]+'%'};return _0x27cdd8;}})});}_0xcf476e=_[_0x2967('0x3f')]({},_0xcf476e,_0x1ee7cb['options']);var _0x55b6a0={'where':_0xcf476e[_0x2967('0x3c')]};return db[_0x2967('0x41')][_0x2967('0x1f')](_0x55b6a0)[_0x2967('0x25')](function(_0x3ce06d){_0xbb2094[_0x2967('0x1f')]=_0x3ce06d;if(_0x1ee7cb['query']['includeAll']){_0xcf476e[_0x2967('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0x2967('0x43')](_0xcf476e);})[_0x2967('0x25')](function(_0x31a35f){_0xbb2094['rows']=_0x31a35f;return _0xbb2094;})[_0x2967('0x25')](respondWithFilteredResult(_0x45c7fd,_0xcf476e))[_0x2967('0x44')](handleError(_0x45c7fd,null));};exports['show']=function(_0x58d864,_0x22aa97){var _0xf7e5a5={'raw':![],'where':{'id':_0x58d864['params']['id']}},_0x14be71={};_0x14be71[_0x2967('0x31')]=_[_0x2967('0x33')](db[_0x2967('0x41')][_0x2967('0x2d')]);_0x14be71['query']=_['keys'](_0x58d864[_0x2967('0x32')]);_0x14be71['filters']=_[_0x2967('0x35')](_0x14be71['model'],_0x14be71['query']);_0xf7e5a5[_0x2967('0x36')]=_[_0x2967('0x35')](_0x14be71['model'],qs[_0x2967('0x37')](_0x58d864[_0x2967('0x32')]['fields']));_0xf7e5a5[_0x2967('0x36')]=_0xf7e5a5[_0x2967('0x36')][_0x2967('0x38')]?_0xf7e5a5['attributes']:_0x14be71[_0x2967('0x31')];if(_0x58d864['query'][_0x2967('0x45')]){_0xf7e5a5[_0x2967('0x42')]=[{'all':!![]}];}_0xf7e5a5=_[_0x2967('0x3f')]({},_0xf7e5a5,_0x58d864[_0x2967('0x46')]);return db[_0x2967('0x41')][_0x2967('0x47')](_0xf7e5a5)['then'](handleEntityNotFound(_0x22aa97,null))[_0x2967('0x25')](respondWithResult(_0x22aa97,null))[_0x2967('0x44')](handleError(_0x22aa97,null));};exports['create']=function(_0x369128,_0x27bbac){return db['JscriptyProject']['create'](_0x369128['body'],{})['then'](function(_0x36513d){var _0x3af677=_0x369128['user'][_0x2967('0x48')]({'plain':!![]});if(!_0x3af677)throw new Error(_0x2967('0x49'));if(_0x3af677[_0x2967('0x4a')]===_0x2967('0x4b')){var _0x2fcad1=_0x36513d[_0x2967('0x48')]({'plain':!![]});var _0x4d119d='Projects';return db[_0x2967('0x4c')][_0x2967('0x47')]({'where':{'name':_0x4d119d,'userProfileId':_0x3af677['userProfileId']},'raw':!![]})['then'](function(_0x311985){if(_0x311985&&_0x311985['autoAssociation']===0x0){return db[_0x2967('0x4d')][_0x2967('0x4e')]({'name':_0x2fcad1['name'],'resourceId':_0x2fcad1['id'],'type':_0x311985[_0x2967('0x2a')],'sectionId':_0x311985['id']},{})['then'](function(){return _0x36513d;});}else{return _0x36513d;}})[_0x2967('0x44')](function(_0x94f00a){logger[_0x2967('0x28')](_0x2967('0x4f'),_0x94f00a);throw _0x94f00a;});}return _0x36513d;})[_0x2967('0x25')](respondWithResult(_0x27bbac,0xc9))[_0x2967('0x44')](handleError(_0x27bbac,null));};exports[_0x2967('0x50')]=function(_0x3d9f1a,_0x433216){var _0x5f52c0={'where':{'id':_0x3d9f1a[_0x2967('0x51')]['id']}},_0xd7a109={};_0xd7a109[_0x2967('0x31')]=_[_0x2967('0x33')](db[_0x2967('0x41')][_0x2967('0x2d')]);_0x5f52c0['attributes']=_[_0x2967('0x35')](_0xd7a109[_0x2967('0x31')],qs[_0x2967('0x37')](_0x3d9f1a[_0x2967('0x32')][_0x2967('0x37')]));_0x5f52c0[_0x2967('0x36')]=_0x5f52c0[_0x2967('0x36')][_0x2967('0x38')]?_0x5f52c0[_0x2967('0x36')]:_0xd7a109['model'];if(_0x3d9f1a[_0x2967('0x32')][_0x2967('0x45')]){_0x5f52c0[_0x2967('0x42')]=[{'all':!![]}];}_0x5f52c0=_[_0x2967('0x3f')]({},_0x5f52c0,_0x3d9f1a[_0x2967('0x46')]);return db[_0x2967('0x41')]['find'](_0x5f52c0)['then'](handleEntityNotFound(_0x433216,null))[_0x2967('0x25')](function(_0x20592f){if(_0x20592f){var _0xfbd8df=_0x20592f['get']({'plain':!![]});_0xfbd8df=qs[_0x2967('0x52')](_0xfbd8df,['id',_0x2967('0x53'),_0x2967('0x54')]);_0x3d9f1a[_0x2967('0x55')]=_[_0x2967('0x52')](_0x3d9f1a[_0x2967('0x55')],['id',_0x2967('0x53'),'updatedAt']);return db[_0x2967('0x41')][_0x2967('0x4e')](_[_0x2967('0x3f')](_0xfbd8df,_0x3d9f1a[_0x2967('0x55')]),{'include':_0x3d9f1a['query'][_0x2967('0x45')]?[{'all':!![]}]:undefined})[_0x2967('0x25')](function(_0x4680ec){var _0x503be6=_0x3d9f1a[_0x2967('0x4b')][_0x2967('0x48')]({'plain':!![]});if(!_0x503be6)throw new Error(_0x2967('0x49'));if(_0x503be6[_0x2967('0x4a')]===_0x2967('0x4b')){var _0x323491=_0x4680ec[_0x2967('0x48')]({'plain':!![]});var _0x1db9c3=_0x2967('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x1db9c3,'userProfileId':_0x503be6['userProfileId']},'raw':!![]})[_0x2967('0x25')](function(_0x24d827){if(_0x24d827&&_0x24d827['autoAssociation']===0x0){return db[_0x2967('0x4d')][_0x2967('0x4e')]({'name':_0x323491[_0x2967('0x2a')],'resourceId':_0x323491['id'],'type':_0x24d827[_0x2967('0x2a')],'sectionId':_0x24d827['id']},{})[_0x2967('0x25')](function(){return _0x4680ec;});}else{return _0x4680ec;}})[_0x2967('0x44')](function(_0x90265d){logger['error'](_0x2967('0x4f'),_0x90265d);throw _0x90265d;});}return _0x4680ec;});}})[_0x2967('0x25')](respondWithResult(_0x433216,0xc9))[_0x2967('0x44')](handleError(_0x433216,null));};exports[_0x2967('0x24')]=function(_0x3f7994,_0x16d269){if(_0x3f7994[_0x2967('0x55')]['id']){delete _0x3f7994[_0x2967('0x55')]['id'];}return db['JscriptyProject'][_0x2967('0x47')]({'where':{'id':_0x3f7994[_0x2967('0x51')]['id']}})['then'](handleEntityNotFound(_0x16d269,null))[_0x2967('0x25')](saveUpdates(_0x3f7994[_0x2967('0x55')],null))['then'](respondWithResult(_0x16d269,null))['catch'](handleError(_0x16d269,null));};exports[_0x2967('0x26')]=function(_0x381032,_0x56a146){return db[_0x2967('0x41')][_0x2967('0x47')]({'where':{'id':_0x381032[_0x2967('0x51')]['id']}})[_0x2967('0x25')](handleEntityNotFound(_0x56a146,null))[_0x2967('0x25')](removeEntity(_0x56a146,null))['catch'](handleError(_0x56a146,null));};exports[_0x2967('0x56')]=function(_0x40dd82,_0x183cc5,_0x3285e6){var _0x55e93a={'raw':!![],'where':{}};var _0x400ba6={};var _0x566f39={'count':0x0,'rows':[]};return db[_0x2967('0x41')][_0x2967('0x57')]({'where':{'id':_0x40dd82[_0x2967('0x51')]['id']}})['then'](handleEntityNotFound(_0x183cc5,null))['then'](function(_0x170655){if(_0x170655){_0x400ba6[_0x2967('0x31')]=_[_0x2967('0x33')](db[_0x2967('0x58')][_0x2967('0x2d')]);_0x400ba6[_0x2967('0x32')]=_['keys'](_0x40dd82[_0x2967('0x32')]);_0x400ba6['filters']=_[_0x2967('0x35')](_0x400ba6['model'],_0x400ba6[_0x2967('0x32')]);_0x55e93a['attributes']=_[_0x2967('0x35')](_0x400ba6['model'],qs[_0x2967('0x37')](_0x40dd82['query']['fields']));_0x55e93a[_0x2967('0x36')]=_0x55e93a[_0x2967('0x36')][_0x2967('0x38')]?_0x55e93a['attributes']:_0x400ba6[_0x2967('0x31')];if(!_0x40dd82[_0x2967('0x32')][_0x2967('0x39')]('nolimit')){_0x55e93a['limit']=qs[_0x2967('0x1e')](_0x40dd82[_0x2967('0x32')][_0x2967('0x1e')]);_0x55e93a[_0x2967('0x1c')]=qs[_0x2967('0x1c')](_0x40dd82[_0x2967('0x32')][_0x2967('0x1c')]);}_0x55e93a[_0x2967('0x3a')]=qs[_0x2967('0x3b')](_0x40dd82['query'][_0x2967('0x3b')]);_0x55e93a[_0x2967('0x3c')]=qs[_0x2967('0x34')](_[_0x2967('0x3d')](_0x40dd82['query'],_0x400ba6[_0x2967('0x34')]));_0x55e93a['where'][_0x2967('0x59')]=_0x170655['id'];if(_0x40dd82[_0x2967('0x32')][_0x2967('0x3e')]){_0x55e93a['where']=_[_0x2967('0x3f')](_0x55e93a[_0x2967('0x3c')],{'$or':_[_0x2967('0x2c')](_0x55e93a[_0x2967('0x36')],function(_0x4c5ad9){var _0x1d6500={};_0x1d6500[_0x4c5ad9]={'$like':'%'+_0x40dd82[_0x2967('0x32')][_0x2967('0x3e')]+'%'};return _0x1d6500;})});}_0x55e93a=_['merge']({},_0x55e93a,_0x40dd82['options']);return db[_0x2967('0x58')][_0x2967('0x1f')]({'where':_0x55e93a[_0x2967('0x3c')]})[_0x2967('0x25')](function(_0x2aa730){_0x566f39[_0x2967('0x1f')]=_0x2aa730;if(_0x40dd82[_0x2967('0x32')]['includeAll']){_0x55e93a[_0x2967('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x55e93a);})[_0x2967('0x25')](function(_0x2cb05d){_0x566f39[_0x2967('0x5a')]=_0x2cb05d;return _0x566f39;});}})[_0x2967('0x25')](respondWithFilteredResult(_0x183cc5,_0x55e93a))[_0x2967('0x44')](handleError(_0x183cc5,null));};exports[_0x2967('0x5b')]=function(_0x4015f7,_0x29dd35,_0x45a43c){var _0x5bb975={'raw':!![],'where':{}};var _0x5ebb4f={};var _0x5a3cc5={'count':0x0,'rows':[]};return db[_0x2967('0x41')][_0x2967('0x57')]({'where':{'id':_0x4015f7[_0x2967('0x51')]['id']}})[_0x2967('0x25')](handleEntityNotFound(_0x29dd35,null))['then'](function(_0x345e47){if(_0x345e47){_0x5ebb4f[_0x2967('0x31')]=_[_0x2967('0x33')](db[_0x2967('0x5c')][_0x2967('0x2d')]);_0x5ebb4f[_0x2967('0x32')]=_[_0x2967('0x33')](_0x4015f7[_0x2967('0x32')]);_0x5ebb4f[_0x2967('0x34')]=_[_0x2967('0x35')](_0x5ebb4f[_0x2967('0x31')],_0x5ebb4f[_0x2967('0x32')]);_0x5bb975['attributes']=_[_0x2967('0x35')](_0x5ebb4f[_0x2967('0x31')],qs['fields'](_0x4015f7[_0x2967('0x32')]['fields']));_0x5bb975[_0x2967('0x36')]=_0x5bb975['attributes'][_0x2967('0x38')]?_0x5bb975[_0x2967('0x36')]:_0x5ebb4f[_0x2967('0x31')];if(!_0x4015f7[_0x2967('0x32')][_0x2967('0x39')](_0x2967('0x5d'))){_0x5bb975[_0x2967('0x1e')]=qs[_0x2967('0x1e')](_0x4015f7[_0x2967('0x32')][_0x2967('0x1e')]);_0x5bb975['offset']=qs[_0x2967('0x1c')](_0x4015f7[_0x2967('0x32')][_0x2967('0x1c')]);}_0x5bb975[_0x2967('0x3a')]=qs['sort'](_0x4015f7[_0x2967('0x32')]['sort']);_0x5bb975[_0x2967('0x3c')]=qs[_0x2967('0x34')](_['pick'](_0x4015f7[_0x2967('0x32')],_0x5ebb4f[_0x2967('0x34')]));_0x5bb975['where']['ProjectId']=_0x345e47['id'];if(_0x4015f7['query'][_0x2967('0x3e')]){_0x5bb975[_0x2967('0x3c')]=_[_0x2967('0x3f')](_0x5bb975[_0x2967('0x3c')],{'$or':_['map'](_0x5bb975['attributes'],function(_0x2e7f2f){var _0x94b87d={};_0x94b87d[_0x2e7f2f]={'$like':'%'+_0x4015f7['query'][_0x2967('0x3e')]+'%'};return _0x94b87d;})});}_0x5bb975=_[_0x2967('0x3f')]({},_0x5bb975,_0x4015f7[_0x2967('0x46')]);return db['JscriptyAnswerReport'][_0x2967('0x1f')]({'where':_0x5bb975[_0x2967('0x3c')]})[_0x2967('0x25')](function(_0x23445){_0x5a3cc5[_0x2967('0x1f')]=_0x23445;if(_0x4015f7[_0x2967('0x32')][_0x2967('0x45')]){_0x5bb975['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x5bb975);})[_0x2967('0x25')](function(_0x1c8fbb){_0x5a3cc5[_0x2967('0x5a')]=_0x1c8fbb;return _0x5a3cc5;});}})[_0x2967('0x25')](respondWithFilteredResult(_0x29dd35,_0x5bb975))[_0x2967('0x44')](handleError(_0x29dd35,null));};function char(_0x5c5efe){return _0x2967('0x5e')===typeof _0x5c5efe?String[_0x2967('0x5f')][_0x2967('0x60')](null,arguments):_0x5c5efe;}function needsEncapsulation(_0x652abb){return!!_0x652abb&&(_0x652abb['toString']()[_0x2967('0x61')](char(0xd))>=0x0||_0x652abb[_0x2967('0x62')]()['indexOf'](char(0xa))>=0x0||_0x652abb[_0x2967('0x62')]()[_0x2967('0x61')](char(0x2c))>=0x0||_0x652abb[_0x2967('0x62')]()[_0x2967('0x61')](char(0x22))>=0x0);}function encapsulate(_0x2d888e){var _0x57b596=char(0x22),_0x458bcb='\x5c'+char(0x22),_0x5dad70=_0x2d888e[_0x2967('0x62')]()[_0x2967('0x63')](new RegExp(_0x57b596,'g'),_0x458bcb);return _0x57b596+_0x5dad70+_0x57b596;}exports[_0x2967('0x64')]=function(_0x299ce2,_0x1c3e82,_0x24aa72){var _0x59c44a,_0x127422;var _0x365db1={'where':{'ProjectId':_0x299ce2[_0x2967('0x51')]['id']}};if(_0x299ce2[_0x2967('0x32')][_0x2967('0x65')]){_0x365db1['where']['starttime']=JSON[_0x2967('0x66')](_0x299ce2[_0x2967('0x32')][_0x2967('0x65')]);}return db[_0x2967('0x58')][_0x2967('0x43')](_0x365db1)[_0x2967('0x25')](handleEntityNotFound(_0x1c3e82,null))[_0x2967('0x25')](function(_0x43ea58){if(_0x43ea58){_0x59c44a=_0x43ea58;return db[_0x2967('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x2967('0x2c')](_0x59c44a,'id')},'ProjectId':_0x299ce2[_0x2967('0x51')]['id']},'order':_0x2967('0x68')});}})[_0x2967('0x25')](handleEntityNotFound(_0x1c3e82,null))[_0x2967('0x25')](function(_0xbfc95e){if(_0xbfc95e){_0x127422=_0xbfc95e;var _0x121b7c={};for(var _0x34c6e1=0x0,_0x1be2db=_0x127422['length'];_0x34c6e1<_0x1be2db;_0x34c6e1++){if(!_0x121b7c[_0x2967('0x39')](_0x127422[_0x34c6e1][_0x2967('0x69')])){_0x121b7c[_0x127422[_0x34c6e1]['questionId']]=needsEncapsulation(_0x127422[_0x34c6e1][_0x2967('0x6a')])?encapsulate(_0x127422[_0x34c6e1][_0x2967('0x6a')]):_0x127422[_0x34c6e1]['question'];}}var _0x49c46e=[],_0x54bdc6={};for(var _0x3a7218=0x0,_0x5d7e85=_0x59c44a[_0x2967('0x38')];_0x3a7218<_0x5d7e85;_0x3a7218++){_0x54bdc6={'ProjectId':_0x299ce2[_0x2967('0x51')]['id'],'SessionId':_0x59c44a[_0x3a7218]['id'],'StartTime':moment(_0x59c44a[_0x3a7218][_0x2967('0x6b')])[_0x2967('0x6c')](_0x2967('0x6d'))};for(var _0x150cbf=0x0,_0x4fd393=_0x127422['length'];_0x150cbf<_0x4fd393;_0x150cbf++){if(_0x127422[_0x150cbf][_0x2967('0x6e')]==_0x59c44a[_0x3a7218]['id']&&_0x121b7c[_0x2967('0x39')](_0x127422[_0x150cbf][_0x2967('0x69')])){_0x54bdc6[_0x121b7c[_0x127422[_0x150cbf][_0x2967('0x69')]]]=_0x127422[_0x150cbf][_0x2967('0x6f')];}}for(var _0x5770ca in _0x121b7c){if(!_0x54bdc6[_0x2967('0x39')](_0x121b7c[_0x5770ca])){_0x54bdc6[_0x121b7c[_0x5770ca]]=null;}}_0x49c46e[_0x2967('0x70')](_0x54bdc6);}return _0x49c46e;}})[_0x2967('0x25')](function(_0x285fb6){if(!_['isEmpty'](_0x285fb6)){var _0x26888d=toCsv(_0x285fb6);var _0x3be433=Date[_0x2967('0x71')]();fs[_0x2967('0x72')](util['format'](_0x2967('0x73'),_0x299ce2['params']['id'],_0x3be433),_0x26888d);_0x1c3e82[_0x2967('0x74')](_0x2967('0x75'),'attachment;\x20filename='+util[_0x2967('0x6c')](_0x2967('0x76'),_0x299ce2[_0x2967('0x51')]['id'],_0x3be433));_0x1c3e82['setHeader'](_0x2967('0x77'),_0x2967('0x78'));return _0x1c3e82[_0x2967('0x79')](util[_0x2967('0x6c')](_0x2967('0x73'),_0x299ce2[_0x2967('0x51')]['id'],_0x3be433));}else{return _0x1c3e82[_0x2967('0x19')](0xcc);}})[_0x2967('0x44')](handleError(_0x1c3e82,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 518978d..1c753ba 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 _0x96f1=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e2c9d,_0x1cc6b4){var _0x1a3102=function(_0x400a82){while(--_0x400a82){_0x4e2c9d['push'](_0x4e2c9d['shift']());}};_0x1a3102(++_0x1cc6b4);}(_0x96f1,0x19c));var _0x196f=function(_0x2e3ec4,_0x220b08){_0x2e3ec4=_0x2e3ec4-0x0;var _0x2c95d8=_0x96f1[_0x2e3ec4];return _0x2c95d8;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require(_0x196f('0x2'))(_0x196f('0x3'));var moment=require(_0x196f('0x4'));var BPromise=require(_0x196f('0x5'));var rp=require(_0x196f('0x6'));var fs=require('fs');var path=require(_0x196f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196f('0x8'));module[_0x196f('0x9')]=function(_0x267906,_0x1f401c){return _0x267906[_0x196f('0xa')]('JscriptyProject',attributes,{'tableName':_0x196f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x142c=['./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x11adbd,_0x5055f5){var _0x270029=function(_0x25feb6){while(--_0x25feb6){_0x11adbd['push'](_0x11adbd['shift']());}};_0x270029(++_0x5055f5);}(_0x142c,0x86));var _0xc142=function(_0xce755b,_0x58fb87){_0xce755b=_0xce755b-0x0;var _0x30d6da=_0x142c[_0xce755b];return _0x30d6da;};'use strict';var _=require(_0xc142('0x0'));var util=require('util');var logger=require(_0xc142('0x1'))(_0xc142('0x2'));var moment=require(_0xc142('0x3'));var BPromise=require('bluebird');var rp=require(_0xc142('0x4'));var fs=require('fs');var path=require(_0xc142('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc142('0x6'));module['exports']=function(_0x4033e9,_0x53b32f){return _0x4033e9[_0xc142('0x7')](_0xc142('0x8'),attributes,{'tableName':_0xc142('0x9'),'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 f2f4aaf..7d8258e 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x25a223,_0x1adf07){var _0x1691a3=function(_0x5cfe15){while(--_0x5cfe15){_0x25a223['push'](_0x25a223['shift']());}};_0x1691a3(++_0x1adf07);}(_0xe706,0xa3));var _0x6e70=function(_0x4c378e,_0x286afb){_0x4c378e=_0x4c378e-0x0;var _0xf41ce7=_0xe706[_0x4c378e];return _0xf41ce7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4e0a96,_0x531ed7){var _0x255076=function(_0x2b8ba8){while(--_0x2b8ba8){_0x4e0a96['push'](_0x4e0a96['shift']());}};_0x255076(++_0x531ed7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x31b491,_0x22e59e){_0x31b491=_0x31b491-0x0;var _0x49017f=_0xf4eb[_0x31b491];return _0x49017f;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7acadbd..4f8eb57 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 _0x267c=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x267c,0xfc));var _0xc267=function(_0xcb9d19,_0xbaf70d){_0xcb9d19=_0xcb9d19-0x0;var _0x3d3c41=_0x267c[_0xcb9d19];return _0x3d3c41;};'use strict';var multer=require('multer');var util=require(_0xc267('0x0'));var path=require(_0xc267('0x1'));var timeout=require(_0xc267('0x2'));var express=require(_0xc267('0x3'));var router=express[_0xc267('0x4')]();var fs_extra=require(_0xc267('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc267('0x6'));var config=require(_0xc267('0x7'));var controller=require(_0xc267('0x8'));router[_0xc267('0x9')]('/',auth['isAuthenticated'](),controller[_0xc267('0xa')]);router['get'](_0xc267('0xb'),auth['isAuthenticated'](),controller[_0xc267('0xc')]);router[_0xc267('0x9')](_0xc267('0xd'),auth[_0xc267('0xe')](),controller[_0xc267('0xf')]);router[_0xc267('0x10')]('/',auth[_0xc267('0xe')](),controller[_0xc267('0x11')]);router[_0xc267('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc267('0x13')](_0xc267('0xd'),auth[_0xc267('0xe')](),controller[_0xc267('0x14')]);module['exports']=router; \ No newline at end of file +var _0x87ad=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2f3dfb,_0x252629){var _0x50f40c=function(_0x142033){while(--_0x142033){_0x2f3dfb['push'](_0x2f3dfb['shift']());}};_0x50f40c(++_0x252629);}(_0x87ad,0x113));var _0xd87a=function(_0x395330,_0x213561){_0x395330=_0x395330-0x0;var _0x4e16ef=_0x87ad[_0x395330];return _0x4e16ef;};'use strict';var multer=require(_0xd87a('0x0'));var util=require('util');var path=require(_0xd87a('0x1'));var timeout=require(_0xd87a('0x2'));var express=require(_0xd87a('0x3'));var router=express[_0xd87a('0x4')]();var fs_extra=require(_0xd87a('0x5'));var auth=require(_0xd87a('0x6'));var interaction=require(_0xd87a('0x7'));var config=require(_0xd87a('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0xd87a('0x9')]('/',auth[_0xd87a('0xa')](),controller[_0xd87a('0xb')]);router['get'](_0xd87a('0xc'),auth[_0xd87a('0xa')](),controller[_0xd87a('0xd')]);router[_0xd87a('0x9')](_0xd87a('0xe'),auth[_0xd87a('0xa')](),controller['show']);router[_0xd87a('0xf')]('/',auth[_0xd87a('0xa')](),controller['create']);router[_0xd87a('0x10')](_0xd87a('0xe'),auth[_0xd87a('0xa')](),controller[_0xd87a('0x11')]);router['delete'](_0xd87a('0xe'),auth[_0xd87a('0xa')](),controller[_0xd87a('0x12')]);module[_0xd87a('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4e60f27..4b841e2 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x33ed55,_0x46e699){_0x33ed55=_0x33ed55-0x0;var _0x17a50b=_0x7a54[_0x33ed55];return _0x17a50b;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x45efae,_0x487054){_0x45efae=_0x45efae-0x0;var _0x530fb3=_0x7a54[_0x45efae];return _0x530fb3;};'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 90c44fd..6e70ff7 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 _0x20d6=['stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','params','length','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error'];(function(_0x144514,_0xe2af14){var _0x4207a1=function(_0x3cb3ff){while(--_0x3cb3ff){_0x144514['push'](_0x144514['shift']());}};_0x4207a1(++_0xe2af14);}(_0x20d6,0x190));var _0x620d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x20d6[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x620d('0x0'));var rimraf=require(_0x620d('0x1'));var zipdir=require(_0x620d('0x2'));var jsonpatch=require(_0x620d('0x3'));var rp=require('request-promise');var moment=require(_0x620d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x620d('0x5'));var util=require(_0x620d('0x6'));var path=require(_0x620d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x620d('0x8'));var fs=require('fs');var fs_extra=require(_0x620d('0x9'));var _=require(_0x620d('0xa'));var squel=require(_0x620d('0xb'));var crypto=require(_0x620d('0xc'));var jsforce=require(_0x620d('0xd'));var deskjs=require(_0x620d('0xe'));var toCsv=require(_0x620d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x620d('0x10'));var authService=require(_0x620d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x620d('0x12'));var logger=require(_0x620d('0x13'))(_0x620d('0x14'));var utils=require(_0x620d('0x15'));var config=require(_0x620d('0x16'));var licenseUtil=require(_0x620d('0x17'));var db=require(_0x620d('0x18'))['db'];function respondWithStatusCode(_0xf93348,_0x5bfef2){_0x5bfef2=_0x5bfef2||0xcc;return function(_0x1c144f){if(_0x1c144f){return _0xf93348[_0x620d('0x19')](_0x5bfef2);}return _0xf93348[_0x620d('0x1a')](_0x5bfef2)['end']();};}function respondWithResult(_0xed4b63,_0x3a826c){_0x3a826c=_0x3a826c||0xc8;return function(_0x582605){if(_0x582605){return _0xed4b63['status'](_0x3a826c)[_0x620d('0x1b')](_0x582605);}};}function respondWithFilteredResult(_0x347fa7,_0x16bde1){return function(_0x2c65d8){if(_0x2c65d8){var _0x515ee=typeof _0x16bde1[_0x620d('0x1c')]===_0x620d('0x1d')&&typeof _0x16bde1[_0x620d('0x1e')]===_0x620d('0x1d');var _0x4e58ab=_0x2c65d8['count'];var _0x380693=_0x515ee?0x0:_0x16bde1[_0x620d('0x1c')];var _0x4bdca4=_0x515ee?_0x2c65d8[_0x620d('0x1f')]:_0x16bde1[_0x620d('0x1c')]+_0x16bde1[_0x620d('0x1e')];var _0x299032;if(_0x4bdca4>=_0x4e58ab){_0x4bdca4=_0x4e58ab;_0x299032=0xc8;}else{_0x299032=0xce;}_0x347fa7[_0x620d('0x1a')](_0x299032);return _0x347fa7[_0x620d('0x20')]('Content-Range',_0x380693+'-'+_0x4bdca4+'/'+_0x4e58ab)['json'](_0x2c65d8);}return null;};}function patchUpdates(_0x44d3d5){return function(_0x51b9d4){try{jsonpatch[_0x620d('0x21')](_0x51b9d4,_0x44d3d5,!![]);}catch(_0x41bbdd){return BPromise['reject'](_0x41bbdd);}return _0x51b9d4[_0x620d('0x22')]();};}function saveUpdates(_0x28f58e,_0x4b7497){return function(_0x4f11f3){if(_0x4f11f3){return _0x4f11f3['update'](_0x28f58e)[_0x620d('0x23')](function(_0x6db1fa){return _0x6db1fa;});}return null;};}function removeEntity(_0x43da59,_0x53528d){return function(_0x16ea7e){if(_0x16ea7e){return _0x16ea7e[_0x620d('0x24')]()[_0x620d('0x23')](function(){_0x43da59[_0x620d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b560,_0x1e669d){return function(_0x3c7b7a){if(!_0x3c7b7a){_0x20b560[_0x620d('0x19')](0x194);}return _0x3c7b7a;};}function handleError(_0x1583ce,_0x22c946){_0x22c946=_0x22c946||0x1f4;return function(_0x46278c){logger[_0x620d('0x25')](_0x46278c[_0x620d('0x26')]);if(_0x46278c[_0x620d('0x27')]){delete _0x46278c['name'];}_0x1583ce[_0x620d('0x1a')](_0x22c946)[_0x620d('0x28')](_0x46278c);};}exports[_0x620d('0x29')]=function(_0x2ac5b0,_0x38a874){var _0x53861a={},_0x5901bb={},_0x3bed3d={'count':0x0,'rows':[]};var _0x158086=_[_0x620d('0x2a')](db[_0x620d('0x2b')][_0x620d('0x2c')],function(_0x35d076){return{'name':_0x35d076[_0x620d('0x2d')],'type':_0x35d076['type']['key']};});_0x5901bb[_0x620d('0x2e')]=_['map'](_0x158086,_0x620d('0x27'));_0x5901bb[_0x620d('0x2f')]=_[_0x620d('0x30')](_0x2ac5b0[_0x620d('0x2f')]);_0x5901bb[_0x620d('0x31')]=_[_0x620d('0x32')](_0x5901bb[_0x620d('0x2e')],_0x5901bb[_0x620d('0x2f')]);_0x53861a[_0x620d('0x33')]=_['intersection'](_0x5901bb[_0x620d('0x2e')],qs[_0x620d('0x34')](_0x2ac5b0[_0x620d('0x2f')][_0x620d('0x34')]));_0x53861a[_0x620d('0x33')]=_0x53861a[_0x620d('0x33')]['length']?_0x53861a['attributes']:_0x5901bb[_0x620d('0x2e')];if(!_0x2ac5b0['query'][_0x620d('0x35')](_0x620d('0x36'))){_0x53861a['limit']=qs[_0x620d('0x1e')](_0x2ac5b0[_0x620d('0x2f')]['limit']);_0x53861a[_0x620d('0x1c')]=qs[_0x620d('0x1c')](_0x2ac5b0[_0x620d('0x2f')][_0x620d('0x1c')]);}_0x53861a[_0x620d('0x37')]=qs['sort'](_0x2ac5b0['query'][_0x620d('0x38')]);_0x53861a[_0x620d('0x39')]=qs[_0x620d('0x31')](_[_0x620d('0x3a')](_0x2ac5b0['query'],_0x5901bb[_0x620d('0x31')]),_0x158086);if(_0x2ac5b0[_0x620d('0x2f')][_0x620d('0x3b')]){_0x53861a[_0x620d('0x39')]=_[_0x620d('0x3c')](_0x53861a[_0x620d('0x39')],{'$or':_['map'](_0x158086,function(_0x35e2a3){if(_0x35e2a3[_0x620d('0x3d')]!==_0x620d('0x3e')){var _0x147aed={};_0x147aed[_0x35e2a3['name']]={'$like':'%'+_0x2ac5b0['query']['filter']+'%'};return _0x147aed;}})});}_0x53861a=_[_0x620d('0x3c')]({},_0x53861a,_0x2ac5b0[_0x620d('0x3f')]);var _0x251331={'where':_0x53861a['where']};return db[_0x620d('0x2b')][_0x620d('0x1f')](_0x251331)[_0x620d('0x23')](function(_0x2d92b2){_0x3bed3d[_0x620d('0x1f')]=_0x2d92b2;if(_0x2ac5b0[_0x620d('0x2f')]['includeAll']){_0x53861a['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x53861a);})[_0x620d('0x23')](function(_0x254d34){_0x3bed3d[_0x620d('0x40')]=_0x254d34;return _0x3bed3d;})[_0x620d('0x23')](respondWithFilteredResult(_0x38a874,_0x53861a))['catch'](handleError(_0x38a874,null));};exports['show']=function(_0xef119c,_0x4b69bb){var _0x20a3f5={'raw':!![],'where':{'id':_0xef119c[_0x620d('0x41')]['id']}},_0x4dd788={};_0x4dd788[_0x620d('0x2e')]=_[_0x620d('0x30')](db[_0x620d('0x2b')]['rawAttributes']);_0x4dd788['query']=_[_0x620d('0x30')](_0xef119c['query']);_0x4dd788['filters']=_[_0x620d('0x32')](_0x4dd788[_0x620d('0x2e')],_0x4dd788[_0x620d('0x2f')]);_0x20a3f5['attributes']=_[_0x620d('0x32')](_0x4dd788['model'],qs[_0x620d('0x34')](_0xef119c[_0x620d('0x2f')][_0x620d('0x34')]));_0x20a3f5[_0x620d('0x33')]=_0x20a3f5['attributes'][_0x620d('0x42')]?_0x20a3f5['attributes']:_0x4dd788[_0x620d('0x2e')];if(_0xef119c['query']['includeAll']){_0x20a3f5['include']=[{'all':!![]}];}_0x20a3f5=_[_0x620d('0x3c')]({},_0x20a3f5,_0xef119c[_0x620d('0x3f')]);return db[_0x620d('0x2b')][_0x620d('0x43')](_0x20a3f5)[_0x620d('0x23')](handleEntityNotFound(_0x4b69bb,null))[_0x620d('0x23')](respondWithResult(_0x4b69bb,null))[_0x620d('0x44')](handleError(_0x4b69bb,null));};exports[_0x620d('0x45')]=function(_0x12b029,_0x1ab54e){return db[_0x620d('0x2b')][_0x620d('0x45')](_0x12b029[_0x620d('0x46')],{})[_0x620d('0x23')](respondWithResult(_0x1ab54e,0xc9))[_0x620d('0x44')](handleError(_0x1ab54e,null));};exports[_0x620d('0x47')]=function(_0x343f1d,_0x3e32fa){if(_0x343f1d[_0x620d('0x46')]['id']){delete _0x343f1d['body']['id'];}return db['JscriptyQuestionReport'][_0x620d('0x43')]({'where':{'id':_0x343f1d['params']['id']}})[_0x620d('0x23')](handleEntityNotFound(_0x3e32fa,null))[_0x620d('0x23')](saveUpdates(_0x343f1d[_0x620d('0x46')],null))[_0x620d('0x23')](respondWithResult(_0x3e32fa,null))['catch'](handleError(_0x3e32fa,null));};exports[_0x620d('0x24')]=function(_0x40fd4c,_0x1d0575){return db[_0x620d('0x2b')][_0x620d('0x43')]({'where':{'id':_0x40fd4c[_0x620d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1d0575,null))[_0x620d('0x23')](removeEntity(_0x1d0575,null))[_0x620d('0x44')](handleError(_0x1d0575,null));};exports[_0x620d('0x48')]=function(_0x5e872f,_0x2440b6){return db[_0x620d('0x2b')][_0x620d('0x48')]()['then'](respondWithResult(_0x2440b6,null))['catch'](handleError(_0x2440b6,null));}; \ No newline at end of file +var _0x031d=['offset','set','Content-Range','save','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x1c73fb,_0x14262c){var _0x3409ff=function(_0x2bf311){while(--_0x2bf311){_0x1c73fb['push'](_0x1c73fb['shift']());}};_0x3409ff(++_0x14262c);}(_0x031d,0x1b7));var _0xd031=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x031d[_0x5beda8];return _0x2aa042;};'use strict';var emlformat=require(_0xd031('0x0'));var rimraf=require(_0xd031('0x1'));var zipdir=require(_0xd031('0x2'));var jsonpatch=require(_0xd031('0x3'));var rp=require(_0xd031('0x4'));var moment=require(_0xd031('0x5'));var BPromise=require(_0xd031('0x6'));var Mustache=require(_0xd031('0x7'));var util=require(_0xd031('0x8'));var path=require(_0xd031('0x9'));var sox=require(_0xd031('0xa'));var csv=require(_0xd031('0xb'));var ejs=require(_0xd031('0xc'));var fs=require('fs');var fs_extra=require(_0xd031('0xd'));var _=require(_0xd031('0xe'));var squel=require(_0xd031('0xf'));var crypto=require(_0xd031('0x10'));var jsforce=require(_0xd031('0x11'));var deskjs=require(_0xd031('0x12'));var toCsv=require(_0xd031('0xb'));var querystring=require(_0xd031('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd031('0x14'));var qs=require(_0xd031('0x15'));var as=require(_0xd031('0x16'));var hardwareService=require(_0xd031('0x17'));var logger=require(_0xd031('0x18'))(_0xd031('0x19'));var utils=require('../../config/utils');var config=require(_0xd031('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd031('0x1b'))['db'];function respondWithStatusCode(_0x5a775e,_0x28d256){_0x28d256=_0x28d256||0xcc;return function(_0x2df62f){if(_0x2df62f){return _0x5a775e[_0xd031('0x1c')](_0x28d256);}return _0x5a775e[_0xd031('0x1d')](_0x28d256)[_0xd031('0x1e')]();};}function respondWithResult(_0xe8d6a4,_0x32e4ec){_0x32e4ec=_0x32e4ec||0xc8;return function(_0x1d52a0){if(_0x1d52a0){return _0xe8d6a4[_0xd031('0x1d')](_0x32e4ec)[_0xd031('0x1f')](_0x1d52a0);}};}function respondWithFilteredResult(_0x4f4cc0,_0x16d2fe){return function(_0x1e748b){if(_0x1e748b){var _0x5a1e04=typeof _0x16d2fe['offset']===_0xd031('0x20')&&typeof _0x16d2fe[_0xd031('0x21')]===_0xd031('0x20');var _0xa34be8=_0x1e748b[_0xd031('0x22')];var _0x2b5f1d=_0x5a1e04?0x0:_0x16d2fe[_0xd031('0x23')];var _0x131fd6=_0x5a1e04?_0x1e748b[_0xd031('0x22')]:_0x16d2fe[_0xd031('0x23')]+_0x16d2fe[_0xd031('0x21')];var _0x1f9697;if(_0x131fd6>=_0xa34be8){_0x131fd6=_0xa34be8;_0x1f9697=0xc8;}else{_0x1f9697=0xce;}_0x4f4cc0[_0xd031('0x1d')](_0x1f9697);return _0x4f4cc0[_0xd031('0x24')](_0xd031('0x25'),_0x2b5f1d+'-'+_0x131fd6+'/'+_0xa34be8)[_0xd031('0x1f')](_0x1e748b);}return null;};}function patchUpdates(_0x375ac8){return function(_0x8fe3fd){try{jsonpatch['apply'](_0x8fe3fd,_0x375ac8,!![]);}catch(_0x2e38ef){return BPromise['reject'](_0x2e38ef);}return _0x8fe3fd[_0xd031('0x26')]();};}function saveUpdates(_0x1e8e30,_0x2aa05d){return function(_0x19d9a4){if(_0x19d9a4){return _0x19d9a4['update'](_0x1e8e30)[_0xd031('0x27')](function(_0x502bf8){return _0x502bf8;});}return null;};}function removeEntity(_0xee7940,_0x52fc5f){return function(_0x13bb21){if(_0x13bb21){return _0x13bb21['destroy']()[_0xd031('0x27')](function(){_0xee7940[_0xd031('0x1d')](0xcc)[_0xd031('0x1e')]();});}};}function handleEntityNotFound(_0x539c84,_0x191785){return function(_0x4cb64a){if(!_0x4cb64a){_0x539c84['sendStatus'](0x194);}return _0x4cb64a;};}function handleError(_0x2f3fe1,_0x11a72e){_0x11a72e=_0x11a72e||0x1f4;return function(_0x4be610){logger[_0xd031('0x28')](_0x4be610[_0xd031('0x29')]);if(_0x4be610['name']){delete _0x4be610[_0xd031('0x2a')];}_0x2f3fe1[_0xd031('0x1d')](_0x11a72e)[_0xd031('0x2b')](_0x4be610);};}exports[_0xd031('0x2c')]=function(_0x385211,_0x2e4ef8){var _0x5e41b8={},_0x326745={},_0x53e4a7={'count':0x0,'rows':[]};var _0x54d608=_[_0xd031('0x2d')](db[_0xd031('0x2e')][_0xd031('0x2f')],function(_0x43aacf){return{'name':_0x43aacf[_0xd031('0x30')],'type':_0x43aacf[_0xd031('0x31')][_0xd031('0x32')]};});_0x326745['model']=_[_0xd031('0x2d')](_0x54d608,_0xd031('0x2a'));_0x326745[_0xd031('0x33')]=_[_0xd031('0x34')](_0x385211[_0xd031('0x33')]);_0x326745['filters']=_[_0xd031('0x35')](_0x326745['model'],_0x326745[_0xd031('0x33')]);_0x5e41b8[_0xd031('0x36')]=_[_0xd031('0x35')](_0x326745[_0xd031('0x37')],qs[_0xd031('0x38')](_0x385211[_0xd031('0x33')][_0xd031('0x38')]));_0x5e41b8[_0xd031('0x36')]=_0x5e41b8[_0xd031('0x36')][_0xd031('0x39')]?_0x5e41b8[_0xd031('0x36')]:_0x326745[_0xd031('0x37')];if(!_0x385211[_0xd031('0x33')][_0xd031('0x3a')]('nolimit')){_0x5e41b8[_0xd031('0x21')]=qs[_0xd031('0x21')](_0x385211[_0xd031('0x33')]['limit']);_0x5e41b8['offset']=qs[_0xd031('0x23')](_0x385211[_0xd031('0x33')][_0xd031('0x23')]);}_0x5e41b8[_0xd031('0x3b')]=qs[_0xd031('0x3c')](_0x385211[_0xd031('0x33')][_0xd031('0x3c')]);_0x5e41b8['where']=qs[_0xd031('0x3d')](_[_0xd031('0x3e')](_0x385211[_0xd031('0x33')],_0x326745['filters']),_0x54d608);if(_0x385211[_0xd031('0x33')]['filter']){_0x5e41b8[_0xd031('0x3f')]=_[_0xd031('0x40')](_0x5e41b8['where'],{'$or':_['map'](_0x54d608,function(_0x3f2dcb){if(_0x3f2dcb['type']!==_0xd031('0x41')){var _0x2f6878={};_0x2f6878[_0x3f2dcb[_0xd031('0x2a')]]={'$like':'%'+_0x385211[_0xd031('0x33')][_0xd031('0x42')]+'%'};return _0x2f6878;}})});}_0x5e41b8=_[_0xd031('0x40')]({},_0x5e41b8,_0x385211['options']);var _0x4763c4={'where':_0x5e41b8[_0xd031('0x3f')]};return db['JscriptyQuestionReport'][_0xd031('0x22')](_0x4763c4)[_0xd031('0x27')](function(_0x336fac){_0x53e4a7[_0xd031('0x22')]=_0x336fac;if(_0x385211['query'][_0xd031('0x43')]){_0x5e41b8[_0xd031('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd031('0x45')](_0x5e41b8);})[_0xd031('0x27')](function(_0x408c72){_0x53e4a7['rows']=_0x408c72;return _0x53e4a7;})[_0xd031('0x27')](respondWithFilteredResult(_0x2e4ef8,_0x5e41b8))[_0xd031('0x46')](handleError(_0x2e4ef8,null));};exports[_0xd031('0x47')]=function(_0x1ca8d5,_0x2b1655){var _0x2e9046={'raw':!![],'where':{'id':_0x1ca8d5[_0xd031('0x48')]['id']}},_0x196f5a={};_0x196f5a[_0xd031('0x37')]=_['keys'](db[_0xd031('0x2e')]['rawAttributes']);_0x196f5a['query']=_[_0xd031('0x34')](_0x1ca8d5['query']);_0x196f5a[_0xd031('0x3d')]=_[_0xd031('0x35')](_0x196f5a[_0xd031('0x37')],_0x196f5a['query']);_0x2e9046[_0xd031('0x36')]=_[_0xd031('0x35')](_0x196f5a[_0xd031('0x37')],qs['fields'](_0x1ca8d5['query']['fields']));_0x2e9046[_0xd031('0x36')]=_0x2e9046[_0xd031('0x36')][_0xd031('0x39')]?_0x2e9046[_0xd031('0x36')]:_0x196f5a[_0xd031('0x37')];if(_0x1ca8d5[_0xd031('0x33')][_0xd031('0x43')]){_0x2e9046[_0xd031('0x44')]=[{'all':!![]}];}_0x2e9046=_[_0xd031('0x40')]({},_0x2e9046,_0x1ca8d5[_0xd031('0x49')]);return db[_0xd031('0x2e')][_0xd031('0x4a')](_0x2e9046)['then'](handleEntityNotFound(_0x2b1655,null))[_0xd031('0x27')](respondWithResult(_0x2b1655,null))['catch'](handleError(_0x2b1655,null));};exports[_0xd031('0x4b')]=function(_0x17765f,_0x17ba84){return db[_0xd031('0x2e')][_0xd031('0x4b')](_0x17765f[_0xd031('0x4c')],{})[_0xd031('0x27')](respondWithResult(_0x17ba84,0xc9))[_0xd031('0x46')](handleError(_0x17ba84,null));};exports[_0xd031('0x4d')]=function(_0x64a4a2,_0x387126){if(_0x64a4a2[_0xd031('0x4c')]['id']){delete _0x64a4a2[_0xd031('0x4c')]['id'];}return db[_0xd031('0x2e')][_0xd031('0x4a')]({'where':{'id':_0x64a4a2[_0xd031('0x48')]['id']}})[_0xd031('0x27')](handleEntityNotFound(_0x387126,null))['then'](saveUpdates(_0x64a4a2['body'],null))[_0xd031('0x27')](respondWithResult(_0x387126,null))[_0xd031('0x46')](handleError(_0x387126,null));};exports[_0xd031('0x4e')]=function(_0x309ded,_0x541aa1){return db[_0xd031('0x2e')][_0xd031('0x4a')]({'where':{'id':_0x309ded[_0xd031('0x48')]['id']}})[_0xd031('0x27')](handleEntityNotFound(_0x541aa1,null))[_0xd031('0x27')](removeEntity(_0x541aa1,null))['catch'](handleError(_0x541aa1,null));};exports['describe']=function(_0x529566,_0x29d57a){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x29d57a,null))[_0xd031('0x46')](handleError(_0x29d57a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9ff934e..97bd6f7 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 _0xa58d=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api'];(function(_0x405af6,_0x138eca){var _0x4fe08c=function(_0x144850){while(--_0x144850){_0x405af6['push'](_0x405af6['shift']());}};_0x4fe08c(++_0x138eca);}(_0xa58d,0x105));var _0xda58=function(_0x5c611c,_0x3a942f){_0x5c611c=_0x5c611c-0x0;var _0x58c02a=_0xa58d[_0x5c611c];return _0x58c02a;};'use strict';var _=require('lodash');var util=require(_0xda58('0x0'));var logger=require(_0xda58('0x1'))(_0xda58('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda58('0x3'));var fs=require('fs');var path=require(_0xda58('0x4'));var rimraf=require(_0xda58('0x5'));var config=require(_0xda58('0x6'));var attributes=require(_0xda58('0x7'));module[_0xda58('0x8')]=function(_0x395a8e,_0x5d3cd5){return _0x395a8e[_0xda58('0x9')](_0xda58('0xa'),attributes,{'tableName':_0xda58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26ee=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x35f0d6,_0x3069a2){var _0x51f93e=function(_0x200d84){while(--_0x200d84){_0x35f0d6['push'](_0x35f0d6['shift']());}};_0x51f93e(++_0x3069a2);}(_0x26ee,0x1af));var _0xe26e=function(_0x45387d,_0x30e41b){_0x45387d=_0x45387d-0x0;var _0x5d5939=_0x26ee[_0x45387d];return _0x5d5939;};'use strict';var _=require(_0xe26e('0x0'));var util=require(_0xe26e('0x1'));var logger=require(_0xe26e('0x2'))('api');var moment=require(_0xe26e('0x3'));var BPromise=require(_0xe26e('0x4'));var rp=require(_0xe26e('0x5'));var fs=require('fs');var path=require(_0xe26e('0x6'));var rimraf=require(_0xe26e('0x7'));var config=require(_0xe26e('0x8'));var attributes=require(_0xe26e('0x9'));module[_0xe26e('0xa')]=function(_0x5b70a1,_0x2a23cb){return _0x5b70a1[_0xe26e('0xb')](_0xe26e('0xc'),attributes,{'tableName':_0xe26e('0xd'),'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 859f5fe..432962e 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 _0x91a4=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0x91a4,0x1f0));var _0x491a=function(_0x143f6c,_0x1e477f){_0x143f6c=_0x143f6c-0x0;var _0x44ae64=_0x91a4[_0x143f6c];return _0x44ae64;};'use strict';var _=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var moment=require(_0x491a('0x2'));var BPromise=require('bluebird');var rs=require(_0x491a('0x3'));var fs=require('fs');var Redis=require(_0x491a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x491a('0x5'));var logger=require(_0x491a('0x6'))(_0x491a('0x7'));var config=require(_0x491a('0x8'));var jayson=require(_0x491a('0x9'));var client=jayson['client'][_0x491a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x102234,_0x54f855,_0x3712e7){return new BPromise(function(_0x32ec5d,_0x47f87b){return client['request'](_0x102234,_0x3712e7)['then'](function(_0x44f95f){logger[_0x491a('0xb')](_0x491a('0xc'),_0x54f855,'request\x20sent');logger[_0x491a('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x54f855,_0x491a('0xe'),JSON['stringify'](_0x44f95f));if(_0x44f95f['error']){if(_0x44f95f['error'][_0x491a('0xf')]===0x1f4){logger[_0x491a('0x10')](_0x491a('0xc'),_0x54f855,_0x44f95f['error'][_0x491a('0x11')]);return _0x47f87b(_0x44f95f['error']['message']);}logger[_0x491a('0x10')](_0x491a('0xc'),_0x54f855,_0x44f95f[_0x491a('0x10')][_0x491a('0x11')]);return _0x32ec5d(_0x44f95f[_0x491a('0x10')]['message']);}else{logger[_0x491a('0xb')](_0x491a('0xc'),_0x54f855,'request\x20sent');_0x32ec5d(_0x44f95f[_0x491a('0x12')][_0x491a('0x11')]);}})[_0x491a('0x13')](function(_0x4aedf3){logger[_0x491a('0x10')](_0x491a('0xc'),_0x54f855,_0x4aedf3);_0x47f87b(_0x4aedf3);});});} \ No newline at end of file +var _0x3877=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x31560a,_0x222949){var _0x454c8d=function(_0x45802f){while(--_0x45802f){_0x31560a['push'](_0x31560a['shift']());}};_0x454c8d(++_0x222949);}(_0x3877,0xcf));var _0x7387=function(_0xe9b0d5,_0x5a0d76){_0xe9b0d5=_0xe9b0d5-0x0;var _0x31a7ce=_0x3877[_0xe9b0d5];return _0x31a7ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7387('0x0'));var BPromise=require(_0x7387('0x1'));var rs=require(_0x7387('0x2'));var fs=require('fs');var Redis=require(_0x7387('0x3'));var db=require(_0x7387('0x4'))['db'];var utils=require(_0x7387('0x5'));var logger=require(_0x7387('0x6'))(_0x7387('0x7'));var config=require(_0x7387('0x8'));var jayson=require(_0x7387('0x9'));var client=jayson[_0x7387('0xa')][_0x7387('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b5b7,_0x121a58,_0x22089e){return new BPromise(function(_0x19e734,_0x2b3e3b){return client[_0x7387('0xc')](_0x33b5b7,_0x22089e)[_0x7387('0xd')](function(_0x553a3b){logger[_0x7387('0xe')](_0x7387('0xf'),_0x121a58,_0x7387('0x10'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x121a58,_0x7387('0x10'),JSON[_0x7387('0x11')](_0x553a3b));if(_0x553a3b[_0x7387('0x12')]){if(_0x553a3b['error'][_0x7387('0x13')]===0x1f4){logger[_0x7387('0x12')](_0x7387('0xf'),_0x121a58,_0x553a3b['error']['message']);return _0x2b3e3b(_0x553a3b[_0x7387('0x12')]['message']);}logger[_0x7387('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x121a58,_0x553a3b[_0x7387('0x12')]['message']);return _0x19e734(_0x553a3b['error'][_0x7387('0x14')]);}else{logger[_0x7387('0xe')](_0x7387('0xf'),_0x121a58,_0x7387('0x10'));_0x19e734(_0x553a3b[_0x7387('0x15')]['message']);}})['catch'](function(_0x140696){logger[_0x7387('0x12')](_0x7387('0xf'),_0x121a58,_0x140696);_0x2b3e3b(_0x140696);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2754822..977b6cb 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 _0xeedd=['isAuthenticated','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0xa8f24a,_0x48d7d3){var _0x3a1471=function(_0x281470){while(--_0x281470){_0xa8f24a['push'](_0xa8f24a['shift']());}};_0x3a1471(++_0x48d7d3);}(_0xeedd,0xc9));var _0xdeed=function(_0x1fe02a,_0x1c173d){_0x1fe02a=_0x1fe02a-0x0;var _0x5d32f8=_0xeedd[_0x1fe02a];return _0x5d32f8;};'use strict';var multer=require(_0xdeed('0x0'));var util=require(_0xdeed('0x1'));var path=require(_0xdeed('0x2'));var timeout=require('connect-timeout');var express=require(_0xdeed('0x3'));var router=express['Router']();var fs_extra=require(_0xdeed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdeed('0x5'));var config=require('../../config/environment');var controller=require(_0xdeed('0x6'));router[_0xdeed('0x7')]('/',auth[_0xdeed('0x8')](),controller['index']);router[_0xdeed('0x7')]('/describe',auth[_0xdeed('0x8')](),controller['describe']);router[_0xdeed('0x7')](_0xdeed('0x9'),auth[_0xdeed('0x8')](),controller[_0xdeed('0xa')]);router[_0xdeed('0x7')](_0xdeed('0xb'),auth[_0xdeed('0x8')](),controller['getQuestions']);router[_0xdeed('0xc')]('/',auth[_0xdeed('0x8')](),controller[_0xdeed('0xd')]);router[_0xdeed('0xe')](_0xdeed('0x9'),auth[_0xdeed('0x8')](),controller[_0xdeed('0xf')]);router[_0xdeed('0x10')](_0xdeed('0x9'),auth[_0xdeed('0x8')](),controller[_0xdeed('0x11')]);module[_0xdeed('0x12')]=router; \ No newline at end of file +var _0xd1a8=['fs-extra','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5b7ab7,_0xd165d4){var _0x2de7b1=function(_0x5d2f40){while(--_0x5d2f40){_0x5b7ab7['push'](_0x5b7ab7['shift']());}};_0x2de7b1(++_0xd165d4);}(_0xd1a8,0x1dc));var _0x8d1a=function(_0x359297,_0x59a8ba){_0x359297=_0x359297-0x0;var _0x32e4fb=_0xd1a8[_0x359297];return _0x32e4fb;};'use strict';var multer=require('multer');var util=require(_0x8d1a('0x0'));var path=require('path');var timeout=require(_0x8d1a('0x1'));var express=require(_0x8d1a('0x2'));var router=express[_0x8d1a('0x3')]();var fs_extra=require(_0x8d1a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x8d1a('0x5')]('/',auth[_0x8d1a('0x6')](),controller[_0x8d1a('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8d1a('0x8')]);router[_0x8d1a('0x5')](_0x8d1a('0x9'),auth[_0x8d1a('0x6')](),controller['show']);router[_0x8d1a('0x5')]('/:id/questions',auth[_0x8d1a('0x6')](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0x8d1a('0xa')]);router[_0x8d1a('0xb')]('/:id',auth[_0x8d1a('0x6')](),controller[_0x8d1a('0xc')]);router[_0x8d1a('0xd')](_0x8d1a('0x9'),auth[_0x8d1a('0x6')](),controller[_0x8d1a('0xe')]);module[_0x8d1a('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a79758c..aca2a43 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 _0xa8d9=['DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x25eea5,_0x161246){var _0x519286=function(_0x2ee50a){while(--_0x2ee50a){_0x25eea5['push'](_0x25eea5['shift']());}};_0x519286(++_0x161246);}(_0xa8d9,0x1f1));var _0x9a8d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8d9[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9a8d('0x0'));var Sequelize=require(_0x9a8d('0x1'));module[_0x9a8d('0x2')]={'starttime':{'type':Sequelize[_0x9a8d('0x3')],'set':function(_0x4343da){this['setDataValue'](_0x9a8d('0x4'),_0x4343da);this[_0x9a8d('0x5')]('endtime',moment()[_0x9a8d('0x6')](_0x9a8d('0x7')));}},'endtime':{'type':Sequelize[_0x9a8d('0x3')]},'membername':{'type':Sequelize[_0x9a8d('0x8')]},'projectname':{'type':Sequelize[_0x9a8d('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9a8d('0x8')]},'calleridname':{'type':Sequelize[_0x9a8d('0x8')]},'calleridnum':{'type':Sequelize[_0x9a8d('0x8')]},'completed':{'type':Sequelize[_0x9a8d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x966f=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0x966f,0xbf));var _0xf966=function(_0x3a3352,_0x173350){_0x3a3352=_0x3a3352-0x0;var _0x177ad8=_0x966f[_0x3a3352];return _0x177ad8;};'use strict';var moment=require(_0xf966('0x0'));var Sequelize=require(_0xf966('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xf966('0x2')],'set':function(_0x129c5e){this[_0xf966('0x3')](_0xf966('0x4'),_0x129c5e);this[_0xf966('0x3')](_0xf966('0x5'),moment()[_0xf966('0x6')](_0xf966('0x7')));}},'endtime':{'type':Sequelize[_0xf966('0x2')]},'membername':{'type':Sequelize[_0xf966('0x8')]},'projectname':{'type':Sequelize[_0xf966('0x8')]},'queue':{'type':Sequelize[_0xf966('0x8')]},'uniqueid':{'type':Sequelize[_0xf966('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf966('0x8')]},'completed':{'type':Sequelize[_0xf966('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9ffae73..b2ca8d7 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 _0x3efa=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','rawAttributes','options','find','create','catch','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','JscriptySessionReport','fieldName','type'];(function(_0x4b952a,_0x52809f){var _0x5a081f=function(_0x23367c){while(--_0x23367c){_0x4b952a['push'](_0x4b952a['shift']());}};_0x5a081f(++_0x52809f);}(_0x3efa,0x155));var _0xa3ef=function(_0x3bf0d4,_0x572800){_0x3bf0d4=_0x3bf0d4-0x0;var _0x10d373=_0x3efa[_0x3bf0d4];return _0x10d373;};'use strict';var emlformat=require(_0xa3ef('0x0'));var rimraf=require(_0xa3ef('0x1'));var zipdir=require(_0xa3ef('0x2'));var jsonpatch=require(_0xa3ef('0x3'));var rp=require('request-promise');var moment=require(_0xa3ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa3ef('0x5'));var util=require(_0xa3ef('0x6'));var path=require(_0xa3ef('0x7'));var sox=require(_0xa3ef('0x8'));var csv=require(_0xa3ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3ef('0xa'));var _=require(_0xa3ef('0xb'));var squel=require(_0xa3ef('0xc'));var crypto=require(_0xa3ef('0xd'));var jsforce=require(_0xa3ef('0xe'));var deskjs=require(_0xa3ef('0xf'));var toCsv=require(_0xa3ef('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3ef('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3ef('0x11'));var logger=require('../../config/logger')(_0xa3ef('0x12'));var utils=require('../../config/utils');var config=require(_0xa3ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ca56f,_0x1527b1){_0x1527b1=_0x1527b1||0xcc;return function(_0x5c8692){if(_0x5c8692){return _0x9ca56f[_0xa3ef('0x14')](_0x1527b1);}return _0x9ca56f[_0xa3ef('0x15')](_0x1527b1)['end']();};}function respondWithResult(_0x16f41f,_0x587947){_0x587947=_0x587947||0xc8;return function(_0x26e38c){if(_0x26e38c){return _0x16f41f[_0xa3ef('0x15')](_0x587947)[_0xa3ef('0x16')](_0x26e38c);}};}function respondWithFilteredResult(_0x5d9fc8,_0x5e2963){return function(_0x2b66c2){if(_0x2b66c2){var _0x4edd90=typeof _0x5e2963[_0xa3ef('0x17')]===_0xa3ef('0x18')&&typeof _0x5e2963[_0xa3ef('0x19')]==='undefined';var _0x5569c7=_0x2b66c2['count'];var _0x335cfe=_0x4edd90?0x0:_0x5e2963['offset'];var _0x252b08=_0x4edd90?_0x2b66c2[_0xa3ef('0x1a')]:_0x5e2963[_0xa3ef('0x17')]+_0x5e2963['limit'];var _0x1a49a0;if(_0x252b08>=_0x5569c7){_0x252b08=_0x5569c7;_0x1a49a0=0xc8;}else{_0x1a49a0=0xce;}_0x5d9fc8[_0xa3ef('0x15')](_0x1a49a0);return _0x5d9fc8[_0xa3ef('0x1b')](_0xa3ef('0x1c'),_0x335cfe+'-'+_0x252b08+'/'+_0x5569c7)[_0xa3ef('0x16')](_0x2b66c2);}return null;};}function patchUpdates(_0x332af0){return function(_0xfbcf7b){try{jsonpatch[_0xa3ef('0x1d')](_0xfbcf7b,_0x332af0,!![]);}catch(_0x4432c1){return BPromise[_0xa3ef('0x1e')](_0x4432c1);}return _0xfbcf7b[_0xa3ef('0x1f')]();};}function saveUpdates(_0x1f23cf,_0x49e16b){return function(_0x27ae85){if(_0x27ae85){return _0x27ae85[_0xa3ef('0x20')](_0x1f23cf)['then'](function(_0x25d134){return _0x25d134;});}return null;};}function removeEntity(_0x14e687,_0x1e2b47){return function(_0x6fc3f2){if(_0x6fc3f2){return _0x6fc3f2[_0xa3ef('0x21')]()[_0xa3ef('0x22')](function(){_0x14e687[_0xa3ef('0x15')](0xcc)[_0xa3ef('0x23')]();});}};}function handleEntityNotFound(_0x134d7b,_0x3ed871){return function(_0x5eb63d){if(!_0x5eb63d){_0x134d7b[_0xa3ef('0x14')](0x194);}return _0x5eb63d;};}function handleError(_0x4110f9,_0x366225){_0x366225=_0x366225||0x1f4;return function(_0x5415ac){logger[_0xa3ef('0x24')](_0x5415ac[_0xa3ef('0x25')]);if(_0x5415ac[_0xa3ef('0x26')]){delete _0x5415ac[_0xa3ef('0x26')];}_0x4110f9[_0xa3ef('0x15')](_0x366225)[_0xa3ef('0x27')](_0x5415ac);};}exports['index']=function(_0x3c333b,_0x56c081){var _0x342cd7={},_0x491986={},_0x4d356c={'count':0x0,'rows':[]};var _0x4d8f8f=_[_0xa3ef('0x28')](db[_0xa3ef('0x29')]['rawAttributes'],function(_0x4959a4){return{'name':_0x4959a4[_0xa3ef('0x2a')],'type':_0x4959a4[_0xa3ef('0x2b')]['key']};});_0x491986[_0xa3ef('0x2c')]=_[_0xa3ef('0x28')](_0x4d8f8f,'name');_0x491986[_0xa3ef('0x2d')]=_[_0xa3ef('0x2e')](_0x3c333b[_0xa3ef('0x2d')]);_0x491986[_0xa3ef('0x2f')]=_[_0xa3ef('0x30')](_0x491986['model'],_0x491986[_0xa3ef('0x2d')]);_0x342cd7[_0xa3ef('0x31')]=_[_0xa3ef('0x30')](_0x491986['model'],qs['fields'](_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x32')]));_0x342cd7[_0xa3ef('0x31')]=_0x342cd7[_0xa3ef('0x31')][_0xa3ef('0x33')]?_0x342cd7[_0xa3ef('0x31')]:_0x491986[_0xa3ef('0x2c')];if(!_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x34')](_0xa3ef('0x35'))){_0x342cd7[_0xa3ef('0x19')]=qs['limit'](_0x3c333b['query'][_0xa3ef('0x19')]);_0x342cd7[_0xa3ef('0x17')]=qs[_0xa3ef('0x17')](_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x17')]);}_0x342cd7[_0xa3ef('0x36')]=qs[_0xa3ef('0x37')](_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x37')]);_0x342cd7[_0xa3ef('0x38')]=qs[_0xa3ef('0x2f')](_[_0xa3ef('0x39')](_0x3c333b[_0xa3ef('0x2d')],_0x491986[_0xa3ef('0x2f')]),_0x4d8f8f);if(_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x3a')]){_0x342cd7[_0xa3ef('0x38')]=_[_0xa3ef('0x3b')](_0x342cd7[_0xa3ef('0x38')],{'$or':_[_0xa3ef('0x28')](_0x4d8f8f,function(_0x2d2602){if(_0x2d2602[_0xa3ef('0x2b')]!=='VIRTUAL'){var _0x1386f3={};_0x1386f3[_0x2d2602[_0xa3ef('0x26')]]={'$like':'%'+_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x3a')]+'%'};return _0x1386f3;}})});}_0x342cd7=_['merge']({},_0x342cd7,_0x3c333b['options']);var _0x15197b={'where':_0x342cd7[_0xa3ef('0x38')]};return db[_0xa3ef('0x29')][_0xa3ef('0x1a')](_0x15197b)[_0xa3ef('0x22')](function(_0x2ac7c2){_0x4d356c['count']=_0x2ac7c2;if(_0x3c333b[_0xa3ef('0x2d')][_0xa3ef('0x3c')]){_0x342cd7[_0xa3ef('0x3d')]=[{'all':!![]}];}return db[_0xa3ef('0x29')][_0xa3ef('0x3e')](_0x342cd7);})['then'](function(_0x18ff1e){_0x4d356c[_0xa3ef('0x3f')]=_0x18ff1e;return _0x4d356c;})['then'](respondWithFilteredResult(_0x56c081,_0x342cd7))['catch'](handleError(_0x56c081,null));};exports[_0xa3ef('0x40')]=function(_0xe36cb2,_0x473f58){var _0x3c1305={'raw':!![],'where':{'id':_0xe36cb2['params']['id']}},_0x4eaafe={};_0x4eaafe[_0xa3ef('0x2c')]=_[_0xa3ef('0x2e')](db['JscriptySessionReport'][_0xa3ef('0x41')]);_0x4eaafe[_0xa3ef('0x2d')]=_[_0xa3ef('0x2e')](_0xe36cb2['query']);_0x4eaafe['filters']=_['intersection'](_0x4eaafe[_0xa3ef('0x2c')],_0x4eaafe[_0xa3ef('0x2d')]);_0x3c1305[_0xa3ef('0x31')]=_[_0xa3ef('0x30')](_0x4eaafe[_0xa3ef('0x2c')],qs[_0xa3ef('0x32')](_0xe36cb2[_0xa3ef('0x2d')][_0xa3ef('0x32')]));_0x3c1305[_0xa3ef('0x31')]=_0x3c1305['attributes']['length']?_0x3c1305['attributes']:_0x4eaafe[_0xa3ef('0x2c')];if(_0xe36cb2['query'][_0xa3ef('0x3c')]){_0x3c1305[_0xa3ef('0x3d')]=[{'all':!![]}];}_0x3c1305=_[_0xa3ef('0x3b')]({},_0x3c1305,_0xe36cb2[_0xa3ef('0x42')]);return db['JscriptySessionReport'][_0xa3ef('0x43')](_0x3c1305)[_0xa3ef('0x22')](handleEntityNotFound(_0x473f58,null))['then'](respondWithResult(_0x473f58,null))['catch'](handleError(_0x473f58,null));};exports[_0xa3ef('0x44')]=function(_0x233ece,_0x21fd71){return db[_0xa3ef('0x29')][_0xa3ef('0x44')](_0x233ece['body'],{})[_0xa3ef('0x22')](respondWithResult(_0x21fd71,0xc9))[_0xa3ef('0x45')](handleError(_0x21fd71,null));};exports[_0xa3ef('0x20')]=function(_0x38d1bc,_0x96ac1){if(_0x38d1bc[_0xa3ef('0x46')]['id']){delete _0x38d1bc[_0xa3ef('0x46')]['id'];}return db[_0xa3ef('0x29')][_0xa3ef('0x43')]({'where':{'id':_0x38d1bc['params']['id']}})[_0xa3ef('0x22')](handleEntityNotFound(_0x96ac1,null))[_0xa3ef('0x22')](saveUpdates(_0x38d1bc[_0xa3ef('0x46')],null))[_0xa3ef('0x22')](respondWithResult(_0x96ac1,null))[_0xa3ef('0x45')](handleError(_0x96ac1,null));};exports['destroy']=function(_0x28375b,_0x7ae46){return db[_0xa3ef('0x29')][_0xa3ef('0x43')]({'where':{'id':_0x28375b[_0xa3ef('0x47')]['id']}})[_0xa3ef('0x22')](handleEntityNotFound(_0x7ae46,null))[_0xa3ef('0x22')](removeEntity(_0x7ae46,null))[_0xa3ef('0x45')](handleError(_0x7ae46,null));};exports[_0xa3ef('0x48')]=function(_0x3ebf54,_0x31da3e){return db[_0xa3ef('0x29')][_0xa3ef('0x48')]()[_0xa3ef('0x22')](respondWithResult(_0x31da3e,null))[_0xa3ef('0x45')](handleError(_0x31da3e,null));};exports[_0xa3ef('0x49')]=function(_0x53b72c,_0x4f8015,_0x1c44b1){var _0x178f59={'raw':!![],'where':{}};var _0x2514fe={};var _0x1794fd={'count':0x0,'rows':[]};return db[_0xa3ef('0x29')][_0xa3ef('0x4a')]({'where':{'id':_0x53b72c[_0xa3ef('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f8015,null))[_0xa3ef('0x22')](function(_0xdceb44){if(_0xdceb44){_0x2514fe[_0xa3ef('0x2c')]=_['keys'](db[_0xa3ef('0x4b')]['rawAttributes']);_0x2514fe[_0xa3ef('0x2d')]=_[_0xa3ef('0x2e')](_0x53b72c[_0xa3ef('0x2d')]);_0x2514fe[_0xa3ef('0x2f')]=_['intersection'](_0x2514fe[_0xa3ef('0x2c')],_0x2514fe[_0xa3ef('0x2d')]);_0x178f59['attributes']=_[_0xa3ef('0x30')](_0x2514fe[_0xa3ef('0x2c')],qs[_0xa3ef('0x32')](_0x53b72c['query'][_0xa3ef('0x32')]));_0x178f59[_0xa3ef('0x31')]=_0x178f59[_0xa3ef('0x31')][_0xa3ef('0x33')]?_0x178f59['attributes']:_0x2514fe['model'];if(!_0x53b72c[_0xa3ef('0x2d')][_0xa3ef('0x34')](_0xa3ef('0x35'))){_0x178f59[_0xa3ef('0x19')]=qs[_0xa3ef('0x19')](_0x53b72c[_0xa3ef('0x2d')][_0xa3ef('0x19')]);_0x178f59[_0xa3ef('0x17')]=qs[_0xa3ef('0x17')](_0x53b72c['query'][_0xa3ef('0x17')]);}_0x178f59['order']=qs['sort'](_0x53b72c[_0xa3ef('0x2d')]['sort']);_0x178f59[_0xa3ef('0x38')]=qs[_0xa3ef('0x2f')](_[_0xa3ef('0x39')](_0x53b72c[_0xa3ef('0x2d')],_0x2514fe['filters']));_0x178f59['where'][_0xa3ef('0x4c')]=_0xdceb44['id'];if(_0x53b72c['query'][_0xa3ef('0x3a')]){_0x178f59[_0xa3ef('0x38')]=_[_0xa3ef('0x3b')](_0x178f59[_0xa3ef('0x38')],{'$or':_['map'](_0x178f59[_0xa3ef('0x31')],function(_0x14d6b0){var _0x4f9e20={};_0x4f9e20[_0x14d6b0]={'$like':'%'+_0x53b72c[_0xa3ef('0x2d')]['filter']+'%'};return _0x4f9e20;})});}_0x178f59=_[_0xa3ef('0x3b')]({},_0x178f59,_0x53b72c[_0xa3ef('0x42')]);return db[_0xa3ef('0x4b')][_0xa3ef('0x1a')]({'where':_0x178f59[_0xa3ef('0x38')]})[_0xa3ef('0x22')](function(_0x420084){_0x1794fd[_0xa3ef('0x1a')]=_0x420084;if(_0x53b72c[_0xa3ef('0x2d')][_0xa3ef('0x3c')]){_0x178f59[_0xa3ef('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa3ef('0x3e')](_0x178f59);})[_0xa3ef('0x22')](function(_0x4266c9){_0x1794fd[_0xa3ef('0x3f')]=_0x4266c9;return _0x1794fd;});}})['then'](respondWithFilteredResult(_0x4f8015,_0x178f59))['catch'](handleError(_0x4f8015,null));}; \ No newline at end of file +var _0xf7c1=['create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0xf7c1,0x162));var _0x1f7c=function(_0x5e706c,_0x35cce6){_0x5e706c=_0x5e706c-0x0;var _0x347e9d=_0xf7c1[_0x5e706c];return _0x347e9d;};'use strict';var emlformat=require(_0x1f7c('0x0'));var rimraf=require(_0x1f7c('0x1'));var zipdir=require(_0x1f7c('0x2'));var jsonpatch=require(_0x1f7c('0x3'));var rp=require(_0x1f7c('0x4'));var moment=require(_0x1f7c('0x5'));var BPromise=require(_0x1f7c('0x6'));var Mustache=require(_0x1f7c('0x7'));var util=require(_0x1f7c('0x8'));var path=require(_0x1f7c('0x9'));var sox=require(_0x1f7c('0xa'));var csv=require(_0x1f7c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f7c('0xc'));var _=require(_0x1f7c('0xd'));var squel=require(_0x1f7c('0xe'));var crypto=require(_0x1f7c('0xf'));var jsforce=require(_0x1f7c('0x10'));var deskjs=require(_0x1f7c('0x11'));var toCsv=require(_0x1f7c('0xb'));var querystring=require(_0x1f7c('0x12'));var Papa=require(_0x1f7c('0x13'));var Redis=require('ioredis');var authService=require(_0x1f7c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f7c('0x15'))(_0x1f7c('0x16'));var utils=require(_0x1f7c('0x17'));var config=require(_0x1f7c('0x18'));var licenseUtil=require(_0x1f7c('0x19'));var db=require(_0x1f7c('0x1a'))['db'];function respondWithStatusCode(_0x525b96,_0x4ccb1e){_0x4ccb1e=_0x4ccb1e||0xcc;return function(_0xd72eed){if(_0xd72eed){return _0x525b96[_0x1f7c('0x1b')](_0x4ccb1e);}return _0x525b96['status'](_0x4ccb1e)[_0x1f7c('0x1c')]();};}function respondWithResult(_0x555243,_0x3cf3d7){_0x3cf3d7=_0x3cf3d7||0xc8;return function(_0x1fb668){if(_0x1fb668){return _0x555243[_0x1f7c('0x1d')](_0x3cf3d7)[_0x1f7c('0x1e')](_0x1fb668);}};}function respondWithFilteredResult(_0x44d12c,_0x524ce2){return function(_0x407487){if(_0x407487){var _0x357f9c=typeof _0x524ce2[_0x1f7c('0x1f')]===_0x1f7c('0x20')&&typeof _0x524ce2[_0x1f7c('0x21')]===_0x1f7c('0x20');var _0x10e609=_0x407487[_0x1f7c('0x22')];var _0x83ad1a=_0x357f9c?0x0:_0x524ce2[_0x1f7c('0x1f')];var _0x117f51=_0x357f9c?_0x407487[_0x1f7c('0x22')]:_0x524ce2[_0x1f7c('0x1f')]+_0x524ce2[_0x1f7c('0x21')];var _0x3c4c68;if(_0x117f51>=_0x10e609){_0x117f51=_0x10e609;_0x3c4c68=0xc8;}else{_0x3c4c68=0xce;}_0x44d12c['status'](_0x3c4c68);return _0x44d12c[_0x1f7c('0x23')](_0x1f7c('0x24'),_0x83ad1a+'-'+_0x117f51+'/'+_0x10e609)[_0x1f7c('0x1e')](_0x407487);}return null;};}function patchUpdates(_0x14a1b6){return function(_0x5cd649){try{jsonpatch[_0x1f7c('0x25')](_0x5cd649,_0x14a1b6,!![]);}catch(_0x551050){return BPromise[_0x1f7c('0x26')](_0x551050);}return _0x5cd649[_0x1f7c('0x27')]();};}function saveUpdates(_0x4a09f9,_0x5da6fb){return function(_0x375faf){if(_0x375faf){return _0x375faf[_0x1f7c('0x28')](_0x4a09f9)[_0x1f7c('0x29')](function(_0x1d650b){return _0x1d650b;});}return null;};}function removeEntity(_0x14dc0e,_0x36cd02){return function(_0x12b0f2){if(_0x12b0f2){return _0x12b0f2[_0x1f7c('0x2a')]()[_0x1f7c('0x29')](function(){_0x14dc0e[_0x1f7c('0x1d')](0xcc)[_0x1f7c('0x1c')]();});}};}function handleEntityNotFound(_0x1b6161,_0x5ec6a6){return function(_0x233c0a){if(!_0x233c0a){_0x1b6161[_0x1f7c('0x1b')](0x194);}return _0x233c0a;};}function handleError(_0x43238d,_0x4a2c30){_0x4a2c30=_0x4a2c30||0x1f4;return function(_0x1b28d5){logger['error'](_0x1b28d5[_0x1f7c('0x2b')]);if(_0x1b28d5[_0x1f7c('0x2c')]){delete _0x1b28d5[_0x1f7c('0x2c')];}_0x43238d[_0x1f7c('0x1d')](_0x4a2c30)[_0x1f7c('0x2d')](_0x1b28d5);};}exports[_0x1f7c('0x2e')]=function(_0x18d34a,_0x196931){var _0x1cf025={},_0x1a5db4={},_0x41111c={'count':0x0,'rows':[]};var _0x4e31d4=_[_0x1f7c('0x2f')](db['JscriptySessionReport'][_0x1f7c('0x30')],function(_0x5c5a44){return{'name':_0x5c5a44[_0x1f7c('0x31')],'type':_0x5c5a44[_0x1f7c('0x32')][_0x1f7c('0x33')]};});_0x1a5db4[_0x1f7c('0x34')]=_[_0x1f7c('0x2f')](_0x4e31d4,'name');_0x1a5db4['query']=_[_0x1f7c('0x35')](_0x18d34a[_0x1f7c('0x36')]);_0x1a5db4['filters']=_[_0x1f7c('0x37')](_0x1a5db4[_0x1f7c('0x34')],_0x1a5db4[_0x1f7c('0x36')]);_0x1cf025[_0x1f7c('0x38')]=_[_0x1f7c('0x37')](_0x1a5db4[_0x1f7c('0x34')],qs['fields'](_0x18d34a[_0x1f7c('0x36')][_0x1f7c('0x39')]));_0x1cf025[_0x1f7c('0x38')]=_0x1cf025[_0x1f7c('0x38')][_0x1f7c('0x3a')]?_0x1cf025[_0x1f7c('0x38')]:_0x1a5db4[_0x1f7c('0x34')];if(!_0x18d34a[_0x1f7c('0x36')]['hasOwnProperty'](_0x1f7c('0x3b'))){_0x1cf025['limit']=qs[_0x1f7c('0x21')](_0x18d34a[_0x1f7c('0x36')][_0x1f7c('0x21')]);_0x1cf025[_0x1f7c('0x1f')]=qs[_0x1f7c('0x1f')](_0x18d34a[_0x1f7c('0x36')]['offset']);}_0x1cf025[_0x1f7c('0x3c')]=qs[_0x1f7c('0x3d')](_0x18d34a[_0x1f7c('0x36')][_0x1f7c('0x3d')]);_0x1cf025[_0x1f7c('0x3e')]=qs['filters'](_['pick'](_0x18d34a[_0x1f7c('0x36')],_0x1a5db4[_0x1f7c('0x3f')]),_0x4e31d4);if(_0x18d34a[_0x1f7c('0x36')]['filter']){_0x1cf025['where']=_[_0x1f7c('0x40')](_0x1cf025[_0x1f7c('0x3e')],{'$or':_['map'](_0x4e31d4,function(_0xf3134d){if(_0xf3134d[_0x1f7c('0x32')]!==_0x1f7c('0x41')){var _0x52e616={};_0x52e616[_0xf3134d['name']]={'$like':'%'+_0x18d34a[_0x1f7c('0x36')]['filter']+'%'};return _0x52e616;}})});}_0x1cf025=_[_0x1f7c('0x40')]({},_0x1cf025,_0x18d34a[_0x1f7c('0x42')]);var _0x4bd724={'where':_0x1cf025['where']};return db[_0x1f7c('0x43')][_0x1f7c('0x22')](_0x4bd724)[_0x1f7c('0x29')](function(_0x32712b){_0x41111c[_0x1f7c('0x22')]=_0x32712b;if(_0x18d34a[_0x1f7c('0x36')][_0x1f7c('0x44')]){_0x1cf025[_0x1f7c('0x45')]=[{'all':!![]}];}return db[_0x1f7c('0x43')][_0x1f7c('0x46')](_0x1cf025);})[_0x1f7c('0x29')](function(_0x5ff2f4){_0x41111c[_0x1f7c('0x47')]=_0x5ff2f4;return _0x41111c;})[_0x1f7c('0x29')](respondWithFilteredResult(_0x196931,_0x1cf025))[_0x1f7c('0x48')](handleError(_0x196931,null));};exports[_0x1f7c('0x49')]=function(_0x3e0f97,_0x376484){var _0x4a5340={'raw':!![],'where':{'id':_0x3e0f97[_0x1f7c('0x4a')]['id']}},_0x37198a={};_0x37198a[_0x1f7c('0x34')]=_[_0x1f7c('0x35')](db[_0x1f7c('0x43')][_0x1f7c('0x30')]);_0x37198a[_0x1f7c('0x36')]=_[_0x1f7c('0x35')](_0x3e0f97[_0x1f7c('0x36')]);_0x37198a[_0x1f7c('0x3f')]=_[_0x1f7c('0x37')](_0x37198a[_0x1f7c('0x34')],_0x37198a[_0x1f7c('0x36')]);_0x4a5340['attributes']=_['intersection'](_0x37198a['model'],qs[_0x1f7c('0x39')](_0x3e0f97[_0x1f7c('0x36')]['fields']));_0x4a5340[_0x1f7c('0x38')]=_0x4a5340[_0x1f7c('0x38')][_0x1f7c('0x3a')]?_0x4a5340['attributes']:_0x37198a[_0x1f7c('0x34')];if(_0x3e0f97[_0x1f7c('0x36')][_0x1f7c('0x44')]){_0x4a5340[_0x1f7c('0x45')]=[{'all':!![]}];}_0x4a5340=_[_0x1f7c('0x40')]({},_0x4a5340,_0x3e0f97[_0x1f7c('0x42')]);return db[_0x1f7c('0x43')][_0x1f7c('0x4b')](_0x4a5340)[_0x1f7c('0x29')](handleEntityNotFound(_0x376484,null))[_0x1f7c('0x29')](respondWithResult(_0x376484,null))['catch'](handleError(_0x376484,null));};exports['create']=function(_0x37a92d,_0x149e5e){return db[_0x1f7c('0x43')][_0x1f7c('0x4c')](_0x37a92d[_0x1f7c('0x4d')],{})[_0x1f7c('0x29')](respondWithResult(_0x149e5e,0xc9))[_0x1f7c('0x48')](handleError(_0x149e5e,null));};exports[_0x1f7c('0x28')]=function(_0x35aea6,_0x4af871){if(_0x35aea6[_0x1f7c('0x4d')]['id']){delete _0x35aea6['body']['id'];}return db[_0x1f7c('0x43')][_0x1f7c('0x4b')]({'where':{'id':_0x35aea6[_0x1f7c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4af871,null))[_0x1f7c('0x29')](saveUpdates(_0x35aea6[_0x1f7c('0x4d')],null))[_0x1f7c('0x29')](respondWithResult(_0x4af871,null))['catch'](handleError(_0x4af871,null));};exports[_0x1f7c('0x2a')]=function(_0x54e709,_0x27692d){return db['JscriptySessionReport'][_0x1f7c('0x4b')]({'where':{'id':_0x54e709[_0x1f7c('0x4a')]['id']}})[_0x1f7c('0x29')](handleEntityNotFound(_0x27692d,null))[_0x1f7c('0x29')](removeEntity(_0x27692d,null))[_0x1f7c('0x48')](handleError(_0x27692d,null));};exports['describe']=function(_0xbe4818,_0x596995){return db[_0x1f7c('0x43')][_0x1f7c('0x4e')]()[_0x1f7c('0x29')](respondWithResult(_0x596995,null))['catch'](handleError(_0x596995,null));};exports[_0x1f7c('0x4f')]=function(_0x4e2fd3,_0x1b14fc,_0x46c6c5){var _0x186e29={'raw':!![],'where':{}};var _0x13adc0={};var _0xcf4c12={'count':0x0,'rows':[]};return db[_0x1f7c('0x43')][_0x1f7c('0x50')]({'where':{'id':_0x4e2fd3['params']['id']}})[_0x1f7c('0x29')](handleEntityNotFound(_0x1b14fc,null))[_0x1f7c('0x29')](function(_0x465cd1){if(_0x465cd1){_0x13adc0[_0x1f7c('0x34')]=_[_0x1f7c('0x35')](db[_0x1f7c('0x51')]['rawAttributes']);_0x13adc0[_0x1f7c('0x36')]=_[_0x1f7c('0x35')](_0x4e2fd3[_0x1f7c('0x36')]);_0x13adc0[_0x1f7c('0x3f')]=_['intersection'](_0x13adc0[_0x1f7c('0x34')],_0x13adc0[_0x1f7c('0x36')]);_0x186e29['attributes']=_[_0x1f7c('0x37')](_0x13adc0[_0x1f7c('0x34')],qs['fields'](_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x39')]));_0x186e29[_0x1f7c('0x38')]=_0x186e29['attributes'][_0x1f7c('0x3a')]?_0x186e29[_0x1f7c('0x38')]:_0x13adc0['model'];if(!_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x52')]('nolimit')){_0x186e29[_0x1f7c('0x21')]=qs['limit'](_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x21')]);_0x186e29[_0x1f7c('0x1f')]=qs[_0x1f7c('0x1f')](_0x4e2fd3['query'][_0x1f7c('0x1f')]);}_0x186e29[_0x1f7c('0x3c')]=qs[_0x1f7c('0x3d')](_0x4e2fd3['query'][_0x1f7c('0x3d')]);_0x186e29[_0x1f7c('0x3e')]=qs[_0x1f7c('0x3f')](_[_0x1f7c('0x53')](_0x4e2fd3['query'],_0x13adc0[_0x1f7c('0x3f')]));_0x186e29[_0x1f7c('0x3e')][_0x1f7c('0x54')]=_0x465cd1['id'];if(_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x55')]){_0x186e29['where']=_[_0x1f7c('0x40')](_0x186e29[_0x1f7c('0x3e')],{'$or':_['map'](_0x186e29[_0x1f7c('0x38')],function(_0x1da6de){var _0x5127c7={};_0x5127c7[_0x1da6de]={'$like':'%'+_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x55')]+'%'};return _0x5127c7;})});}_0x186e29=_[_0x1f7c('0x40')]({},_0x186e29,_0x4e2fd3[_0x1f7c('0x42')]);return db[_0x1f7c('0x51')]['count']({'where':_0x186e29['where']})[_0x1f7c('0x29')](function(_0x5294bc){_0xcf4c12[_0x1f7c('0x22')]=_0x5294bc;if(_0x4e2fd3[_0x1f7c('0x36')][_0x1f7c('0x44')]){_0x186e29[_0x1f7c('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1f7c('0x46')](_0x186e29);})['then'](function(_0x541826){_0xcf4c12[_0x1f7c('0x47')]=_0x541826;return _0xcf4c12;});}})[_0x1f7c('0x29')](respondWithFilteredResult(_0x1b14fc,_0x186e29))['catch'](handleError(_0x1b14fc,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 24b4baf..e5afea2 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 _0x4c60=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','bluebird','./jscriptySessionReport.attributes','exports'];(function(_0x1fd19e,_0x8fed02){var _0x5afd64=function(_0x5ac798){while(--_0x5ac798){_0x1fd19e['push'](_0x1fd19e['shift']());}};_0x5afd64(++_0x8fed02);}(_0x4c60,0xc1));var _0x04c6=function(_0x162dc8,_0x380693){_0x162dc8=_0x162dc8-0x0;var _0x1052a4=_0x4c60[_0x162dc8];return _0x1052a4;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5075,0x73));var _0x5507=function(_0x18bee8,_0x15e890){_0x18bee8=_0x18bee8-0x0;var _0x4301a9=_0x5075[_0x18bee8];return _0x4301a9;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 95fbc08..b06ddf7 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x2b8690,_0x352c24){var _0x49d165=function(_0x509e94){while(--_0x509e94){_0x2b8690['push'](_0x2b8690['shift']());}};_0x49d165(++_0x352c24);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file +var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x0424,0x159));var _0x4042=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x0424[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8af5635..19e5e9e 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 _0x6c2e=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id','isAuthenticated','/download_log_file','downloadLogFile'];(function(_0x12ec65,_0x5bd7c9){var _0x28502f=function(_0x3958de){while(--_0x3958de){_0x12ec65['push'](_0x12ec65['shift']());}};_0x28502f(++_0x5bd7c9);}(_0x6c2e,0x196));var _0xe6c2=function(_0x2ecfd3,_0x441216){_0x2ecfd3=_0x2ecfd3-0x0;var _0x4580ad=_0x6c2e[_0x2ecfd3];return _0x4580ad;};'use strict';var multer=require('multer');var util=require(_0xe6c2('0x0'));var path=require(_0xe6c2('0x1'));var timeout=require(_0xe6c2('0x2'));var express=require('express');var router=express[_0xe6c2('0x3')]();var fs_extra=require(_0xe6c2('0x4'));var auth=require(_0xe6c2('0x5'));var interaction=require(_0xe6c2('0x6'));var config=require('../../config/environment');var controller=require(_0xe6c2('0x7'));router[_0xe6c2('0x8')]('/',controller['index']);router[_0xe6c2('0x9')](_0xe6c2('0xa'),auth[_0xe6c2('0xb')](),controller['update']);router[_0xe6c2('0x8')](_0xe6c2('0xc'),auth[_0xe6c2('0xb')](),controller[_0xe6c2('0xd')]);module[_0xe6c2('0xe')]=router; \ No newline at end of file +var _0x5311=['express','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','multer','util','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5311,0x12d));var _0x1531=function(_0x1e1fd8,_0x4b6889){_0x1e1fd8=_0x1e1fd8-0x0;var _0x519fd2=_0x5311[_0x1e1fd8];return _0x519fd2;};'use strict';var multer=require(_0x1531('0x0'));var util=require(_0x1531('0x1'));var path=require(_0x1531('0x2'));var timeout=require('connect-timeout');var express=require(_0x1531('0x3'));var router=express['Router']();var fs_extra=require(_0x1531('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1531('0x5'));var config=require(_0x1531('0x6'));var controller=require(_0x1531('0x7'));router[_0x1531('0x8')]('/',controller[_0x1531('0x9')]);router[_0x1531('0xa')](_0x1531('0xb'),auth[_0x1531('0xc')](),controller[_0x1531('0xd')]);router[_0x1531('0x8')]('/download_log_file',auth[_0x1531('0xc')](),controller[_0x1531('0xe')]);module[_0x1531('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fe960ed..5d1b74c 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 _0xa053=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x281252,_0x2fced9){var _0x429731=function(_0x4e06f3){while(--_0x4e06f3){_0x281252['push'](_0x281252['shift']());}};_0x429731(++_0x2fced9);}(_0xa053,0x1a5));var _0x3a05=function(_0x165b1a,_0x3f8696){_0x165b1a=_0x165b1a-0x0;var _0x3da730=_0xa053[_0x165b1a];return _0x3da730;};'use strict';var Sequelize=require(_0x3a05('0x0'));module[_0x3a05('0x1')]={'license':{'type':Sequelize[_0x3a05('0x2')]},'data1':{'type':Sequelize[_0x3a05('0x3')]},'data2':{'type':Sequelize[_0x3a05('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3a05('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfccd=['sequelize','TEXT','STRING','INTEGER'];(function(_0x437a21,_0x3bcbd6){var _0x490f61=function(_0x57f395){while(--_0x57f395){_0x437a21['push'](_0x437a21['shift']());}};_0x490f61(++_0x3bcbd6);}(_0xfccd,0x1e8));var _0xdfcc=function(_0x3c6ff6,_0x4e136a){_0x3c6ff6=_0x3c6ff6-0x0;var _0x4ac5ba=_0xfccd[_0x3c6ff6];return _0x4ac5ba;};'use strict';var Sequelize=require(_0xdfcc('0x0'));module['exports']={'license':{'type':Sequelize[_0xdfcc('0x1')]},'data1':{'type':Sequelize[_0xdfcc('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xdfcc('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 57df6d5..eaf7736 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 _0xa0ef=['limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','attributes','intersection','fields','length','catch','update','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined'];(function(_0x500d8c,_0x1e89ef){var _0x1886e7=function(_0x1afd7c){while(--_0x1afd7c){_0x500d8c['push'](_0x500d8c['shift']());}};_0x1886e7(++_0x1e89ef);}(_0xa0ef,0xb1));var _0xfa0e=function(_0x624f98,_0x12488a){_0x624f98=_0x624f98-0x0;var _0x4e09ec=_0xa0ef[_0x624f98];return _0x4e09ec;};'use strict';var emlformat=require(_0xfa0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa0e('0x1'));var jsonpatch=require(_0xfa0e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa0e('0x3'));var Mustache=require(_0xfa0e('0x4'));var util=require(_0xfa0e('0x5'));var path=require(_0xfa0e('0x6'));var sox=require(_0xfa0e('0x7'));var csv=require(_0xfa0e('0x8'));var ejs=require(_0xfa0e('0x9'));var fs=require('fs');var fs_extra=require(_0xfa0e('0xa'));var _=require('lodash');var squel=require(_0xfa0e('0xb'));var crypto=require(_0xfa0e('0xc'));var jsforce=require(_0xfa0e('0xd'));var deskjs=require(_0xfa0e('0xe'));var toCsv=require(_0xfa0e('0x8'));var querystring=require(_0xfa0e('0xf'));var Papa=require(_0xfa0e('0x10'));var Redis=require(_0xfa0e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfa0e('0x12'));var as=require(_0xfa0e('0x13'));var hardwareService=require(_0xfa0e('0x14'));var logger=require('../../config/logger')(_0xfa0e('0x15'));var utils=require(_0xfa0e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa0e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f77c,_0x5f5633){_0x5f5633=_0x5f5633||0xcc;return function(_0xeebc4f){if(_0xeebc4f){return _0x11f77c[_0xfa0e('0x18')](_0x5f5633);}return _0x11f77c['status'](_0x5f5633)[_0xfa0e('0x19')]();};}function respondWithResult(_0x42835b,_0x5935bc){_0x5935bc=_0x5935bc||0xc8;return function(_0xc68f16){if(_0xc68f16){return _0x42835b[_0xfa0e('0x1a')](_0x5935bc)[_0xfa0e('0x1b')](_0xc68f16);}};}function respondWithFilteredResult(_0xc4816d,_0x601ecc){return function(_0x430540){if(_0x430540){var _0x1465b7=typeof _0x601ecc[_0xfa0e('0x1c')]===_0xfa0e('0x1d')&&typeof _0x601ecc[_0xfa0e('0x1e')]===_0xfa0e('0x1d');var _0x1f1d30=_0x430540[_0xfa0e('0x1f')];var _0xa14768=_0x1465b7?0x0:_0x601ecc['offset'];var _0x1fca8b=_0x1465b7?_0x430540[_0xfa0e('0x1f')]:_0x601ecc['offset']+_0x601ecc[_0xfa0e('0x1e')];var _0x2ae863;if(_0x1fca8b>=_0x1f1d30){_0x1fca8b=_0x1f1d30;_0x2ae863=0xc8;}else{_0x2ae863=0xce;}_0xc4816d[_0xfa0e('0x1a')](_0x2ae863);return _0xc4816d[_0xfa0e('0x20')](_0xfa0e('0x21'),_0xa14768+'-'+_0x1fca8b+'/'+_0x1f1d30)['json'](_0x430540);}return null;};}function patchUpdates(_0x4ac746){return function(_0x8e7eb6){try{jsonpatch[_0xfa0e('0x22')](_0x8e7eb6,_0x4ac746,!![]);}catch(_0x2169c5){return BPromise[_0xfa0e('0x23')](_0x2169c5);}return _0x8e7eb6['save']();};}function saveUpdates(_0x2e16fe,_0x14a4df){return function(_0x1e5c85){if(_0x1e5c85){return _0x1e5c85['update'](_0x2e16fe)[_0xfa0e('0x24')](function(_0x5c87b0){return _0x5c87b0;});}return null;};}function removeEntity(_0x3a3a34,_0x38e852){return function(_0x4658af){if(_0x4658af){return _0x4658af[_0xfa0e('0x25')]()[_0xfa0e('0x24')](function(){_0x3a3a34[_0xfa0e('0x1a')](0xcc)[_0xfa0e('0x19')]();});}};}function handleEntityNotFound(_0x592766,_0x3b9609){return function(_0x5c1719){if(!_0x5c1719){_0x592766[_0xfa0e('0x18')](0x194);}return _0x5c1719;};}function handleError(_0x4af23f,_0x4721a5){_0x4721a5=_0x4721a5||0x1f4;return function(_0x432719){logger[_0xfa0e('0x26')](_0x432719[_0xfa0e('0x27')]);if(_0x432719[_0xfa0e('0x28')]){delete _0x432719[_0xfa0e('0x28')];}_0x4af23f[_0xfa0e('0x1a')](_0x4721a5)['send'](_0x432719);};}var utilLicense=require(_0xfa0e('0x17'));exports[_0xfa0e('0x29')]=function(_0x1dddf7,_0x22c474){var _0x487494={'raw':!![],'where':{'id':0x1}},_0x3de937={};_0x3de937[_0xfa0e('0x2a')]=_[_0xfa0e('0x2b')](db[_0xfa0e('0x2c')][_0xfa0e('0x2d')]);_0x3de937[_0xfa0e('0x2e')]=_[_0xfa0e('0x2b')](_0x1dddf7[_0xfa0e('0x2e')]);_0x3de937['filters']=_['intersection'](_0x3de937[_0xfa0e('0x2a')],_0x3de937['query']);_0x487494[_0xfa0e('0x2f')]=_[_0xfa0e('0x30')](_0x3de937[_0xfa0e('0x2a')],qs[_0xfa0e('0x31')](_0x1dddf7[_0xfa0e('0x2e')][_0xfa0e('0x31')]));_0x487494[_0xfa0e('0x2f')]=_0x487494[_0xfa0e('0x2f')][_0xfa0e('0x32')]?_0x487494[_0xfa0e('0x2f')]:_0x3de937[_0xfa0e('0x2a')];_0x487494=_['merge']({},_0x487494,_0x1dddf7['options']);return utilLicense['getLicense'](_0x487494)[_0xfa0e('0x24')](respondWithResult(_0x22c474,null))[_0xfa0e('0x33')](handleError(_0x22c474,null));};exports[_0xfa0e('0x34')]=function(_0x2a1e8c,_0x4adbeb){if(_0x2a1e8c[_0xfa0e('0x35')]['id']){delete _0x2a1e8c[_0xfa0e('0x35')]['id'];}return db[_0xfa0e('0x2c')]['find']({'where':{'id':_0x2a1e8c[_0xfa0e('0x36')]['id']}})[_0xfa0e('0x24')](handleEntityNotFound(_0x4adbeb,null))[_0xfa0e('0x24')](function(_0x493b77){var _0x46706c=_0x493b77[_0xfa0e('0x37')]({'plain':!![]});return utilLicense[_0xfa0e('0x38')](_0x46706c,_0x2a1e8c[_0xfa0e('0x35')][_0xfa0e('0x39')]);})[_0xfa0e('0x24')](function(_0x53a07c){if(!_0x53a07c[_0xfa0e('0x3a')]){return saveUpdates(_0x2a1e8c[_0xfa0e('0x35')],null);}return _0x53a07c;})['then'](respondWithResult(_0x4adbeb,null))[_0xfa0e('0x33')](handleError(_0x4adbeb,null));};exports[_0xfa0e('0x3b')]=function(_0x6033c5,_0x557e38){var _0x5c5fd5=_0xfa0e('0x3c');var _0x1fb784=path['join'](_0xfa0e('0x3d'),_0xfa0e('0x3e'),_0xfa0e('0x3f'),_0x5c5fd5);_0x557e38[_0xfa0e('0x40')](_0xfa0e('0x41'),_0xfa0e('0x42')+_0x5c5fd5);_0x557e38[_0xfa0e('0x20')]('Content-Type',_0xfa0e('0x43'));_0x557e38[_0xfa0e('0x44')](_0x1fb784);}; \ No newline at end of file +var _0xe6d4=['undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','License','rawAttributes','query','model','intersection','fields','attributes','length','merge','options','getLicense','body','params','get','checkLicense','key','demo','catch','license-info.log','/var','log','xcally','setHeader','set','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x58d860,_0x5a1a29){var _0x40892f=function(_0x3c9af6){while(--_0x3c9af6){_0x58d860['push'](_0x58d860['shift']());}};_0x40892f(++_0x5a1a29);}(_0xe6d4,0x1b9));var _0x4e6d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe6d4[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e6d('0x0'));var zipdir=require(_0x4e6d('0x1'));var jsonpatch=require(_0x4e6d('0x2'));var rp=require(_0x4e6d('0x3'));var moment=require('moment');var BPromise=require(_0x4e6d('0x4'));var Mustache=require('mustache');var util=require(_0x4e6d('0x5'));var path=require('path');var sox=require(_0x4e6d('0x6'));var csv=require(_0x4e6d('0x7'));var ejs=require(_0x4e6d('0x8'));var fs=require('fs');var fs_extra=require(_0x4e6d('0x9'));var _=require(_0x4e6d('0xa'));var squel=require(_0x4e6d('0xb'));var crypto=require(_0x4e6d('0xc'));var jsforce=require(_0x4e6d('0xd'));var deskjs=require(_0x4e6d('0xe'));var toCsv=require(_0x4e6d('0x7'));var querystring=require(_0x4e6d('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e6d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e6d('0x11'));var logger=require(_0x4e6d('0x12'))(_0x4e6d('0x13'));var utils=require(_0x4e6d('0x14'));var config=require(_0x4e6d('0x15'));var licenseUtil=require(_0x4e6d('0x16'));var db=require(_0x4e6d('0x17'))['db'];function respondWithStatusCode(_0x5dcdf7,_0x5031a3){_0x5031a3=_0x5031a3||0xcc;return function(_0x5f2a6c){if(_0x5f2a6c){return _0x5dcdf7[_0x4e6d('0x18')](_0x5031a3);}return _0x5dcdf7[_0x4e6d('0x19')](_0x5031a3)[_0x4e6d('0x1a')]();};}function respondWithResult(_0x5de374,_0x406fb1){_0x406fb1=_0x406fb1||0xc8;return function(_0xf0b16a){if(_0xf0b16a){return _0x5de374[_0x4e6d('0x19')](_0x406fb1)[_0x4e6d('0x1b')](_0xf0b16a);}};}function respondWithFilteredResult(_0x384fae,_0xfd178c){return function(_0x399708){if(_0x399708){var _0x27fc95=typeof _0xfd178c['offset']===_0x4e6d('0x1c')&&typeof _0xfd178c[_0x4e6d('0x1d')]===_0x4e6d('0x1c');var _0x20cd20=_0x399708[_0x4e6d('0x1e')];var _0x442188=_0x27fc95?0x0:_0xfd178c[_0x4e6d('0x1f')];var _0x55231c=_0x27fc95?_0x399708[_0x4e6d('0x1e')]:_0xfd178c[_0x4e6d('0x1f')]+_0xfd178c[_0x4e6d('0x1d')];var _0x537925;if(_0x55231c>=_0x20cd20){_0x55231c=_0x20cd20;_0x537925=0xc8;}else{_0x537925=0xce;}_0x384fae[_0x4e6d('0x19')](_0x537925);return _0x384fae['set'](_0x4e6d('0x20'),_0x442188+'-'+_0x55231c+'/'+_0x20cd20)['json'](_0x399708);}return null;};}function patchUpdates(_0x17b331){return function(_0x364a05){try{jsonpatch[_0x4e6d('0x21')](_0x364a05,_0x17b331,!![]);}catch(_0x1a29dc){return BPromise[_0x4e6d('0x22')](_0x1a29dc);}return _0x364a05[_0x4e6d('0x23')]();};}function saveUpdates(_0x5882df,_0x291681){return function(_0x2e8689){if(_0x2e8689){return _0x2e8689[_0x4e6d('0x24')](_0x5882df)[_0x4e6d('0x25')](function(_0xa26259){return _0xa26259;});}return null;};}function removeEntity(_0x33b63b,_0x3a9caa){return function(_0x3c34ad){if(_0x3c34ad){return _0x3c34ad[_0x4e6d('0x26')]()[_0x4e6d('0x25')](function(){_0x33b63b[_0x4e6d('0x19')](0xcc)[_0x4e6d('0x1a')]();});}};}function handleEntityNotFound(_0x377245,_0x1f996a){return function(_0x181e7d){if(!_0x181e7d){_0x377245[_0x4e6d('0x18')](0x194);}return _0x181e7d;};}function handleError(_0x364e15,_0x2059ca){_0x2059ca=_0x2059ca||0x1f4;return function(_0x57d5f2){logger[_0x4e6d('0x27')](_0x57d5f2['stack']);if(_0x57d5f2[_0x4e6d('0x28')]){delete _0x57d5f2['name'];}_0x364e15['status'](_0x2059ca)[_0x4e6d('0x29')](_0x57d5f2);};}var utilLicense=require(_0x4e6d('0x16'));exports[_0x4e6d('0x2a')]=function(_0x233d64,_0xb80fdb){var _0x50da33={'raw':!![],'where':{'id':0x1}},_0x559769={};_0x559769['model']=_['keys'](db[_0x4e6d('0x2b')][_0x4e6d('0x2c')]);_0x559769[_0x4e6d('0x2d')]=_['keys'](_0x233d64['query']);_0x559769['filters']=_['intersection'](_0x559769[_0x4e6d('0x2e')],_0x559769[_0x4e6d('0x2d')]);_0x50da33['attributes']=_[_0x4e6d('0x2f')](_0x559769[_0x4e6d('0x2e')],qs[_0x4e6d('0x30')](_0x233d64[_0x4e6d('0x2d')][_0x4e6d('0x30')]));_0x50da33[_0x4e6d('0x31')]=_0x50da33[_0x4e6d('0x31')][_0x4e6d('0x32')]?_0x50da33[_0x4e6d('0x31')]:_0x559769[_0x4e6d('0x2e')];_0x50da33=_[_0x4e6d('0x33')]({},_0x50da33,_0x233d64[_0x4e6d('0x34')]);return utilLicense[_0x4e6d('0x35')](_0x50da33)['then'](respondWithResult(_0xb80fdb,null))['catch'](handleError(_0xb80fdb,null));};exports[_0x4e6d('0x24')]=function(_0x2137ff,_0x406aa5){if(_0x2137ff[_0x4e6d('0x36')]['id']){delete _0x2137ff[_0x4e6d('0x36')]['id'];}return db[_0x4e6d('0x2b')]['find']({'where':{'id':_0x2137ff[_0x4e6d('0x37')]['id']}})[_0x4e6d('0x25')](handleEntityNotFound(_0x406aa5,null))[_0x4e6d('0x25')](function(_0x1e9c2c){var _0xaab4ec=_0x1e9c2c[_0x4e6d('0x38')]({'plain':!![]});return utilLicense[_0x4e6d('0x39')](_0xaab4ec,_0x2137ff[_0x4e6d('0x36')][_0x4e6d('0x3a')]);})[_0x4e6d('0x25')](function(_0x13bcc1){if(!_0x13bcc1[_0x4e6d('0x3b')]){return saveUpdates(_0x2137ff[_0x4e6d('0x36')],null);}return _0x13bcc1;})[_0x4e6d('0x25')](respondWithResult(_0x406aa5,null))[_0x4e6d('0x3c')](handleError(_0x406aa5,null));};exports['downloadLogFile']=function(_0x2ec4dc,_0x510147){var _0x192827=_0x4e6d('0x3d');var _0x380ea5=path['join'](_0x4e6d('0x3e'),_0x4e6d('0x3f'),_0x4e6d('0x40'),_0x192827);_0x510147[_0x4e6d('0x41')]('Content-disposition','attachment;\x20filename='+_0x192827);_0x510147[_0x4e6d('0x42')]('Content-Type','text/plain');_0x510147['download'](_0x380ea5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 612e6cc..fcbcc57 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 _0xa819=['moment','request-promise','../../config/environment','exports','define','license','lodash','../../config/logger','api'];(function(_0x382df4,_0x568209){var _0x2258d2=function(_0x51ef40){while(--_0x51ef40){_0x382df4['push'](_0x382df4['shift']());}};_0x2258d2(++_0x568209);}(_0xa819,0x114));var _0x9a81=function(_0x1a89cd,_0x44338f){_0x1a89cd=_0x1a89cd-0x0;var _0x1023d0=_0xa819[_0x1a89cd];return _0x1023d0;};'use strict';var _=require(_0x9a81('0x0'));var util=require('util');var logger=require(_0x9a81('0x1'))(_0x9a81('0x2'));var moment=require(_0x9a81('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a81('0x5'));var attributes=require('./license.attributes');module[_0x9a81('0x6')]=function(_0x43e82e,_0x1fc43e){return _0x43e82e[_0x9a81('0x7')]('License',attributes,{'tableName':_0x9a81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8314=['exports','license','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./license.attributes'];(function(_0x41440e,_0x13027d){var _0x28f168=function(_0x329cbd){while(--_0x329cbd){_0x41440e['push'](_0x41440e['shift']());}};_0x28f168(++_0x13027d);}(_0x8314,0x124));var _0x4831=function(_0x17616b,_0x2e20d1){_0x17616b=_0x17616b-0x0;var _0x17b948=_0x8314[_0x17616b];return _0x17b948;};'use strict';var _=require(_0x4831('0x0'));var util=require(_0x4831('0x1'));var logger=require(_0x4831('0x2'))(_0x4831('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4831('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4831('0x5'));var config=require(_0x4831('0x6'));var attributes=require(_0x4831('0x7'));module[_0x4831('0x8')]=function(_0x26266a,_0x394d4e){return _0x26266a['define']('License',attributes,{'tableName':_0x4831('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 badde5a..3dd41fc 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 _0xdd6e=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xdd6e,0x130));var _0xedd6=function(_0x53d051,_0x5515a0){_0x53d051=_0x53d051-0x0;var _0x8f358b=_0xdd6e[_0x53d051];return _0x8f358b;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var moment=require(_0xedd6('0x2'));var BPromise=require(_0xedd6('0x3'));var rs=require(_0xedd6('0x4'));var fs=require('fs');var Redis=require(_0xedd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xedd6('0x6'));var logger=require(_0xedd6('0x7'))(_0xedd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xedd6('0x9'));var client=jayson[_0xedd6('0xa')][_0xedd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cdc0a,_0x13a465,_0x56da49){return new BPromise(function(_0x3860df,_0x548317){return client[_0xedd6('0xc')](_0x2cdc0a,_0x56da49)['then'](function(_0x432606){logger[_0xedd6('0xd')](_0xedd6('0xe'),_0x13a465,'request\x20sent');logger[_0xedd6('0xf')](_0xedd6('0x10'),_0x13a465,'request\x20sent',JSON[_0xedd6('0x11')](_0x432606));if(_0x432606[_0xedd6('0x12')]){if(_0x432606[_0xedd6('0x12')][_0xedd6('0x13')]===0x1f4){logger['error'](_0xedd6('0xe'),_0x13a465,_0x432606[_0xedd6('0x12')][_0xedd6('0x14')]);return _0x548317(_0x432606['error'][_0xedd6('0x14')]);}logger[_0xedd6('0x12')](_0xedd6('0xe'),_0x13a465,_0x432606[_0xedd6('0x12')][_0xedd6('0x14')]);return _0x3860df(_0x432606[_0xedd6('0x12')][_0xedd6('0x14')]);}else{logger[_0xedd6('0xd')]('License,\x20%s,\x20%s',_0x13a465,'request\x20sent');_0x3860df(_0x432606[_0xedd6('0x15')][_0xedd6('0x14')]);}})[_0xedd6('0x16')](function(_0x38369d){logger[_0xedd6('0x12')](_0xedd6('0xe'),_0x13a465,_0x38369d);_0x548317(_0x38369d);});});} \ No newline at end of file +var _0x021d=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x021d,0x8b));var _0xd021=function(_0x32df93,_0x5e5787){_0x32df93=_0x32df93-0x0;var _0x4379ed=_0x021d[_0x32df93];return _0x4379ed;};'use strict';var _=require(_0xd021('0x0'));var util=require('util');var moment=require(_0xd021('0x1'));var BPromise=require(_0xd021('0x2'));var rs=require(_0xd021('0x3'));var fs=require('fs');var Redis=require(_0xd021('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd021('0x5'))(_0xd021('0x6'));var config=require(_0xd021('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd021('0x8')][_0xd021('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c9495,_0x2bf7ca,_0x5d532c){return new BPromise(function(_0x4b3066,_0x122b57){return client[_0xd021('0xa')](_0x3c9495,_0x5d532c)[_0xd021('0xb')](function(_0x53fab7){logger[_0xd021('0xc')](_0xd021('0xd'),_0x2bf7ca,_0xd021('0xe'));logger[_0xd021('0xf')](_0xd021('0x10'),_0x2bf7ca,_0xd021('0xe'),JSON[_0xd021('0x11')](_0x53fab7));if(_0x53fab7['error']){if(_0x53fab7[_0xd021('0x12')][_0xd021('0x13')]===0x1f4){logger[_0xd021('0x12')](_0xd021('0xd'),_0x2bf7ca,_0x53fab7[_0xd021('0x12')]['message']);return _0x122b57(_0x53fab7[_0xd021('0x12')]['message']);}logger[_0xd021('0x12')](_0xd021('0xd'),_0x2bf7ca,_0x53fab7[_0xd021('0x12')][_0xd021('0x14')]);return _0x4b3066(_0x53fab7[_0xd021('0x12')]['message']);}else{logger[_0xd021('0xc')](_0xd021('0xd'),_0x2bf7ca,_0xd021('0xe'));_0x4b3066(_0x53fab7[_0xd021('0x15')]['message']);}})[_0xd021('0x16')](function(_0x18adfe){logger['error'](_0xd021('0xd'),_0x2bf7ca,_0x18adfe);_0x122b57(_0x18adfe);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index eb3ccef..c5504ed 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 _0x607b=['put','update','delete','removeImap','removeSmtp','/:id','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./mailAccount.controller','get','/describe','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','addAnswer','post','/:id/in_servers','addImap','addInteraction','addApplications','/:id/send','send'];(function(_0x2007e6,_0x43b204){var _0x31a410=function(_0x3a0186){while(--_0x3a0186){_0x2007e6['push'](_0x2007e6['shift']());}};_0x31a410(++_0x43b204);}(_0x607b,0x127));var _0xb607=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x607b[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express['Router']();var fs_extra=require(_0xb607('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb607('0x5'));var config=require('../../config/environment');var controller=require(_0xb607('0x6'));router[_0xb607('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb607('0x8'),auth[_0xb607('0x9')](),controller[_0xb607('0xa')]);router[_0xb607('0x7')]('/:id',auth[_0xb607('0x9')](),controller[_0xb607('0xb')]);router[_0xb607('0x7')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller['getDispositions']);router[_0xb607('0x7')](_0xb607('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb607('0x7')]('/:id/in_servers',auth[_0xb607('0x9')](),controller[_0xb607('0xe')]);router[_0xb607('0x7')](_0xb607('0xf'),auth['isAuthenticated'](),controller[_0xb607('0x10')]);router[_0xb607('0x7')](_0xb607('0x11'),auth[_0xb607('0x9')](),controller[_0xb607('0x12')]);router[_0xb607('0x7')](_0xb607('0x13'),auth[_0xb607('0x9')](),controller[_0xb607('0x14')]);router['get'](_0xb607('0x15'),auth[_0xb607('0x9')](),controller[_0xb607('0x16')]);router[_0xb607('0x7')]('/:id/verify',auth[_0xb607('0x9')](),controller['verifySmtp']);router['get'](_0xb607('0x17'),auth[_0xb607('0x9')](),controller[_0xb607('0x18')]);router['post'](_0xb607('0xc'),auth[_0xb607('0x9')](),controller['addDisposition']);router['post'](_0xb607('0xd'),auth[_0xb607('0x9')](),controller[_0xb607('0x19')]);router[_0xb607('0x1a')]('/',auth[_0xb607('0x9')](),controller['create']);router['post'](_0xb607('0x1b'),auth[_0xb607('0x9')](),controller[_0xb607('0x1c')]);router[_0xb607('0x1a')](_0xb607('0xf'),auth[_0xb607('0x9')](),controller['addSmtp']);router[_0xb607('0x1a')](_0xb607('0x11'),auth['isAuthenticated'](),controller[_0xb607('0x1d')]);router[_0xb607('0x1a')](_0xb607('0x13'),auth[_0xb607('0x9')](),controller[_0xb607('0x1e')]);router[_0xb607('0x1a')](_0xb607('0x1f'),auth[_0xb607('0x9')](),controller[_0xb607('0x20')]);router[_0xb607('0x1a')](_0xb607('0x17'),auth[_0xb607('0x9')](),controller['addAgents']);router[_0xb607('0x21')]('/:id',auth[_0xb607('0x9')](),controller[_0xb607('0x22')]);router[_0xb607('0x23')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller['removeDispositions']);router[_0xb607('0x23')](_0xb607('0xd'),auth[_0xb607('0x9')](),controller['removeAnswers']);router[_0xb607('0x23')]('/:id/in_servers',auth[_0xb607('0x9')](),controller[_0xb607('0x24')]);router[_0xb607('0x23')]('/:id/out_servers',auth[_0xb607('0x9')](),controller[_0xb607('0x25')]);router['delete'](_0xb607('0x26'),auth[_0xb607('0x9')](),controller['destroy']);router[_0xb607('0x23')](_0xb607('0x17'),auth['isAuthenticated'](),controller[_0xb607('0x27')]);module[_0xb607('0x28')]=router; \ No newline at end of file +var _0x0e96=['getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','/:id/users','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','get','/describe','/:id/dispositions'];(function(_0x1dd164,_0x3e16db){var _0x54447e=function(_0x2f56f7){while(--_0x2f56f7){_0x1dd164['push'](_0x1dd164['shift']());}};_0x54447e(++_0x3e16db);}(_0x0e96,0x13c));var _0x60e9=function(_0x296889,_0x27e579){_0x296889=_0x296889-0x0;var _0x3bc532=_0x0e96[_0x296889];return _0x3bc532;};'use strict';var multer=require(_0x60e9('0x0'));var util=require(_0x60e9('0x1'));var path=require(_0x60e9('0x2'));var timeout=require(_0x60e9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60e9('0x4'));var interaction=require(_0x60e9('0x5'));var config=require(_0x60e9('0x6'));var controller=require(_0x60e9('0x7'));router['get']('/',auth[_0x60e9('0x8')](),controller['index']);router[_0x60e9('0x9')](_0x60e9('0xa'),auth[_0x60e9('0x8')](),controller['describe']);router[_0x60e9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x60e9('0x9')](_0x60e9('0xb'),auth[_0x60e9('0x8')](),controller[_0x60e9('0xc')]);router[_0x60e9('0x9')](_0x60e9('0xd'),auth[_0x60e9('0x8')](),controller['getAnswers']);router['get'](_0x60e9('0xe'),auth[_0x60e9('0x8')](),controller['getImap']);router[_0x60e9('0x9')](_0x60e9('0xf'),auth[_0x60e9('0x8')](),controller['getSmtp']);router['get'](_0x60e9('0x10'),auth[_0x60e9('0x8')](),controller['getInteractions']);router[_0x60e9('0x9')](_0x60e9('0x11'),auth['isAuthenticated'](),controller[_0x60e9('0x12')]);router[_0x60e9('0x9')](_0x60e9('0x13'),auth[_0x60e9('0x8')](),controller['getMessages']);router[_0x60e9('0x9')](_0x60e9('0x14'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x15')]);router[_0x60e9('0x9')]('/:id/users',auth[_0x60e9('0x8')](),controller[_0x60e9('0x16')]);router[_0x60e9('0x17')]('/:id/dispositions',auth[_0x60e9('0x8')](),controller[_0x60e9('0x18')]);router[_0x60e9('0x17')]('/:id/canned_answers',auth[_0x60e9('0x8')](),controller[_0x60e9('0x19')]);router[_0x60e9('0x17')]('/',auth[_0x60e9('0x8')](),controller[_0x60e9('0x1a')]);router[_0x60e9('0x17')](_0x60e9('0xe'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x1b')]);router[_0x60e9('0x17')](_0x60e9('0xf'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x1c')]);router[_0x60e9('0x17')](_0x60e9('0x10'),auth['isAuthenticated'](),controller[_0x60e9('0x1d')]);router[_0x60e9('0x17')](_0x60e9('0x11'),auth[_0x60e9('0x8')](),controller['addApplications']);router[_0x60e9('0x17')](_0x60e9('0x1e'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x1f')]);router[_0x60e9('0x17')](_0x60e9('0x20'),auth[_0x60e9('0x8')](),controller['addAgents']);router['put'](_0x60e9('0x21'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x22')]);router[_0x60e9('0x23')](_0x60e9('0xb'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x24')]);router[_0x60e9('0x23')]('/:id/canned_answers',auth[_0x60e9('0x8')](),controller[_0x60e9('0x25')]);router[_0x60e9('0x23')](_0x60e9('0xe'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x26')]);router['delete']('/:id/out_servers',auth[_0x60e9('0x8')](),controller[_0x60e9('0x27')]);router[_0x60e9('0x23')]('/:id',auth[_0x60e9('0x8')](),controller['destroy']);router[_0x60e9('0x23')](_0x60e9('0x20'),auth[_0x60e9('0x8')](),controller[_0x60e9('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a0022c0..d8df7fc 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 _0xf07e=['ENUM','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x5dc733,_0x4bc05e){var _0x1e2b80=function(_0x2c8682){while(--_0x2c8682){_0x5dc733['push'](_0x5dc733['shift']());}};_0x1e2b80(++_0x4bc05e);}(_0xf07e,0x1f3));var _0xef07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf07e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xef07('0x0'));module[_0xef07('0x1')]={'description':{'type':Sequelize[_0xef07('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xef07('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xef07('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xef07('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xef07('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xef07('0x2')],'allowNull':![],'defaultValue':_0xef07('0x4')},'fontSize':{'type':Sequelize[_0xef07('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xef07('0x6')],'defaultValue':function(){return _0xef07('0x7');}},'notificationSound':{'type':Sequelize[_0xef07('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef07('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xef07('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef07('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef07('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef07('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef07('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xef07('0x3')],'defaultValue':![],'comment':_0xef07('0x8'),'set':function(_0x1af334){if(!_0x1af334)this[_0xef07('0x9')]('mandatoryDispositionPauseId',null);this[_0xef07('0x9')](_0xef07('0xa'),_0x1af334);}},'provider':{'type':Sequelize[_0xef07('0xb')]('gmail','hotmail',_0xef07('0xc'),_0xef07('0xd')),'defaultValue':null,'get':function(){if(!this[_0xef07('0xe')](_0xef07('0xf')))return _0xef07('0x10');return this[_0xef07('0xe')](_0xef07('0xf'));},'set':function(_0x44eaf8){if(_0x44eaf8==='custom')_0x44eaf8=null;return this['setDataValue'](_0xef07('0xf'),_0x44eaf8);}}}; \ No newline at end of file +var _0xd851=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd851,0x1ac));var _0x1d85=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0xd851[_0x9d14e3];return _0x19bf32;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1d85('0x0')]},'name':{'type':Sequelize[_0x1d85('0x0')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x1d85('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x1d85('0x1')]},'markAsUnread':{'type':Sequelize[_0x1d85('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1d85('0x0')],'allowNull':![],'defaultValue':_0x1d85('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1d85('0x1')],'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[_0x1d85('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d85('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d85('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1d85('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d85('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1d85('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d85('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d85('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x1d85('0x5')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1d85('0x6'),'set':function(_0x37a8ee){if(!_0x37a8ee)this[_0x1d85('0x7')]('mandatoryDispositionPauseId',null);this[_0x1d85('0x7')](_0x1d85('0x8'),_0x37a8ee);}},'provider':{'type':Sequelize[_0x1d85('0x9')](_0x1d85('0xa'),_0x1d85('0xb'),'yahoo',_0x1d85('0xc')),'defaultValue':null,'get':function(){if(!this[_0x1d85('0xd')](_0x1d85('0xe')))return _0x1d85('0xf');return this[_0x1d85('0xd')](_0x1d85('0xe'));},'set':function(_0x33e261){if(_0x33e261===_0x1d85('0xf'))_0x33e261=null;return this[_0x1d85('0x7')](_0x1d85('0xe'),_0x33e261);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 59285ba..4181891 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 _0xa06a=['omit','getInteractions','CmContact','Contact','internal','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','user','username','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','findAll','rows','show','params','MailServerIn','keys','filters','includeAll','body','provider','custom','secure','find','Mail\x20Account\x20not\x20found','describe','Disposition','create','findOne','order','MailAccountId','removeDispositions','ids','CannedAnswer','include','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','getImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction'];(function(_0x5cc099,_0x3f01da){var _0x829ef0=function(_0x4ba5a4){while(--_0x4ba5a4){_0x5cc099['push'](_0x5cc099['shift']());}};_0x829ef0(++_0x3f01da);}(_0xa06a,0xf9));var _0xaa06=function(_0x1f2276,_0x83a4b5){_0x1f2276=_0x1f2276-0x0;var _0x5bd139=_0xa06a[_0x1f2276];return _0x5bd139;};'use strict';var moment=require(_0xaa06('0x0'));var BPromise=require('bluebird');var util=require(_0xaa06('0x1'));var path=require(_0xaa06('0x2'));var _=require(_0xaa06('0x3'));var juice=require(_0xaa06('0x4'));var Redis=require(_0xaa06('0x5'));var qs=require(_0xaa06('0x6'));var logger=require(_0xaa06('0x7'))(_0xaa06('0x8'));var config=require(_0xaa06('0x9'));var db=require(_0xaa06('0xa'))['db'];config[_0xaa06('0xb')]=_[_0xaa06('0xc')](config['redis'],{'host':_0xaa06('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa06('0xb')]));require(_0xaa06('0xe'))['register'](socket);var jayson=require(_0xaa06('0xf'));var client=jayson[_0xaa06('0x10')][_0xaa06('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x222527,_0x4e83f8,_0x12370f,_0x4195ad){return new BPromise(function(_0x2c1f56,_0x48097e){var _0x515285=_0x4195ad||client;return _0x515285[_0xaa06('0x12')](_0x222527,_0x12370f)[_0xaa06('0x13')](function(_0x4e3be7){logger['info'](_0xaa06('0x14'),_0x4e83f8,'request\x20sent');logger[_0xaa06('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4e83f8,_0xaa06('0x16'),JSON['stringify'](_0x4e3be7));if(_0x4e3be7[_0xaa06('0x17')]){if(_0x4e3be7[_0xaa06('0x17')][_0xaa06('0x18')]===0x1f4){logger[_0xaa06('0x17')](_0xaa06('0x14'),_0x4e83f8,_0x4e3be7[_0xaa06('0x17')][_0xaa06('0x19')]);return _0x48097e(_0x4e3be7[_0xaa06('0x17')][_0xaa06('0x19')]);}logger[_0xaa06('0x17')](_0xaa06('0x14'),_0x4e83f8,_0x4e3be7[_0xaa06('0x17')][_0xaa06('0x19')]);return _0x2c1f56(_0x4e3be7[_0xaa06('0x17')][_0xaa06('0x19')]);}else{logger[_0xaa06('0x1a')]('MailAccount,\x20%s,\x20%s',_0x4e83f8,_0xaa06('0x16'));_0x2c1f56(_0x4e3be7['result']['message']);}})[_0xaa06('0x1b')](function(_0x55d244){logger[_0xaa06('0x17')]('MailAccount,\x20%s,\x20%s',_0x4e83f8,_0x55d244);_0x48097e(_0x55d244);});});}function respondWithStatusCode(_0x184c8b,_0x5ef159){_0x5ef159=_0x5ef159||0xcc;return function(_0x158ff7){if(_0x158ff7){return _0x184c8b[_0xaa06('0x1c')](_0x5ef159);}return _0x184c8b['status'](_0x5ef159)['end']();};}function respondWithResult(_0x2da2b4,_0x3d4ff1){_0x3d4ff1=_0x3d4ff1||0xc8;return function(_0x207759){if(_0x207759){return _0x2da2b4[_0xaa06('0x1d')](_0x3d4ff1)[_0xaa06('0x1e')](_0x207759);}};}function respondWithFilteredResult(_0x1d0c70,_0x3cb560){return function(_0x543a7f){if(_0x543a7f){var _0x4301d9=typeof _0x3cb560['offset']==='undefined'&&typeof _0x3cb560[_0xaa06('0x1f')]===_0xaa06('0x20');var _0x2d0645=_0x543a7f[_0xaa06('0x21')];var _0x1d7aab=_0x4301d9?0x0:_0x3cb560['offset'];var _0x24d4f0=_0x4301d9?_0x543a7f['count']:_0x3cb560[_0xaa06('0x22')]+_0x3cb560[_0xaa06('0x1f')];var _0x32172f;if(_0x24d4f0>=_0x2d0645){_0x24d4f0=_0x2d0645;_0x32172f=0xc8;}else{_0x32172f=0xce;}_0x1d0c70['status'](_0x32172f);return _0x1d0c70[_0xaa06('0x23')](_0xaa06('0x24'),_0x1d7aab+'-'+_0x24d4f0+'/'+_0x2d0645)[_0xaa06('0x1e')](_0x543a7f);}return null;};}function saveUpdates(_0x31eeed){return function(_0x5a166e){if(_0x5a166e){return _0x5a166e[_0xaa06('0x25')](_0x31eeed)[_0xaa06('0x13')](function(_0x180baf){return _0x180baf;});}return null;};}function removeEntity(_0x492eeb){return function(_0x1868fe){if(_0x1868fe){return _0x1868fe[_0xaa06('0x26')]()[_0xaa06('0x13')](function(){var _0x376b77=_0x1868fe[_0xaa06('0x27')]({'plain':!![]});var _0x5c25fe='MailAccounts';return db[_0xaa06('0x28')][_0xaa06('0x26')]({'where':{'type':_0x5c25fe,'resourceId':_0x376b77['id']}})['then'](function(){return _0x1868fe;});})[_0xaa06('0x13')](function(){_0x492eeb[_0xaa06('0x1d')](0xcc)[_0xaa06('0x29')]();});}};}function handleEntityNotFound(_0x4f7d62){return function(_0x3662e7){if(!_0x3662e7){_0x4f7d62[_0xaa06('0x1c')](0x194);}return _0x3662e7;};}function handleError(_0x2dd683,_0x3a9d9f){_0x3a9d9f=_0x3a9d9f||0x1f4;return function(_0x5c4d51){logger[_0xaa06('0x17')](_0x5c4d51[_0xaa06('0x2a')]);if(_0x5c4d51['name']){delete _0x5c4d51[_0xaa06('0x2b')];}_0x2dd683[_0xaa06('0x1d')](_0x3a9d9f)[_0xaa06('0x2c')](_0x5c4d51);};}function getImapHost(_0x2bcacf){switch(_0x2bcacf){case _0xaa06('0x2d'):return _0xaa06('0x2e');case _0xaa06('0x2f'):return'imap.mail.yahoo.com';case _0xaa06('0x30'):return'imap-mail.outlook.com';case _0xaa06('0x31'):return _0xaa06('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2bcacf);}function getSmtpHost(_0x1fb60b){switch(_0x1fb60b){case _0xaa06('0x2d'):return _0xaa06('0x33');case _0xaa06('0x2f'):return _0xaa06('0x34');case _0xaa06('0x30'):return _0xaa06('0x35');case _0xaa06('0x31'):return _0xaa06('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x1fb60b);}function getAuthenticationOptions(_0x5f16cd,_0x557613){var _0x2d3a97={};var _0x4a66e1={};if(_0x5f16cd){_0x2d3a97['user']=_0x4a66e1['user']=_0x557613['username'];_0x2d3a97[_0xaa06('0x37')]=_0x4a66e1[_0xaa06('0x38')]=_0x557613[_0xaa06('0x37')];if(_0x557613[_0xaa06('0x39')]){_0x2d3a97[_0xaa06('0x39')]=_0x4a66e1[_0xaa06('0x39')]=!![];_0x2d3a97[_0xaa06('0x3a')]=_0x4a66e1[_0xaa06('0x3a')]=_0x557613[_0xaa06('0x3a')];_0x2d3a97[_0xaa06('0x37')]=_0x4a66e1[_0xaa06('0x38')]=null;}else{_0x2d3a97[_0xaa06('0x3a')]=_0x4a66e1[_0xaa06('0x3a')]=null;}_0x2d3a97[_0xaa06('0x3b')]=getImapHost(_0x5f16cd);_0x2d3a97[_0xaa06('0x3c')]=0x3e1;_0x4a66e1[_0xaa06('0x3b')]=getSmtpHost(_0x5f16cd);_0x4a66e1['port']=0x24b;_0x4a66e1['secure']=![];_0x2d3a97[_0xaa06('0x3d')]=_0x4a66e1[_0xaa06('0x3d')]=null;}else{if(_0x557613[_0xaa06('0x3e')]){_0x2d3a97['user']=_0x4a66e1[_0xaa06('0x3f')]=_0x557613[_0xaa06('0x40')];_0x2d3a97[_0xaa06('0x37')]=_0x4a66e1[_0xaa06('0x38')]=_0x557613[_0xaa06('0x37')];}else{_0x2d3a97[_0xaa06('0x3e')]=_0x4a66e1[_0xaa06('0x3e')]=![];_0x2d3a97[_0xaa06('0x3f')]=_0x4a66e1[_0xaa06('0x3f')]=null;_0x2d3a97[_0xaa06('0x37')]=_0x4a66e1[_0xaa06('0x38')]=null;}_0x2d3a97['host']=_0x557613[_0xaa06('0x41')][_0xaa06('0x3b')];_0x2d3a97[_0xaa06('0x3c')]=_0x557613['Imap'][_0xaa06('0x3c')];_0x4a66e1['host']=_0x557613[_0xaa06('0x42')]['host'];_0x4a66e1[_0xaa06('0x3c')]=_0x557613[_0xaa06('0x42')]['port'];}return{'Imap':_0x2d3a97,'Smtp':_0x4a66e1};}exports[_0xaa06('0x43')]=function(_0x20c718,_0x27ce40){var _0x182fa6={'include':[{'model':db['MailServerIn'],'as':_0xaa06('0x41')},{'model':db[_0xaa06('0x44')],'as':_0xaa06('0x42')},{'model':db[_0xaa06('0x45')],'as':_0xaa06('0x46')}]},_0x314b05={},_0xf69e9={'count':0x0,'rows':[]};var _0x1827f4=_[_0xaa06('0x47')](db['MailAccount'][_0xaa06('0x48')],function(_0x7e9af8){return{'name':_0x7e9af8[_0xaa06('0x49')],'type':_0x7e9af8[_0xaa06('0x4a')][_0xaa06('0x4b')]};});_0x314b05[_0xaa06('0x4c')]=_[_0xaa06('0x47')](_0x1827f4,_0xaa06('0x2b'));_0x314b05['query']=_['keys'](_0x20c718[_0xaa06('0x4d')]);_0x314b05['filters']=_[_0xaa06('0x4e')](_0x314b05[_0xaa06('0x4c')],_0x314b05[_0xaa06('0x4d')]);_0x182fa6[_0xaa06('0x4f')]=_['intersection'](_0x314b05[_0xaa06('0x4c')],qs[_0xaa06('0x50')](_0x20c718['query'][_0xaa06('0x50')]));_0x182fa6[_0xaa06('0x4f')]=_0x182fa6[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x182fa6[_0xaa06('0x4f')]:_0x314b05[_0xaa06('0x4c')];if(!_0x20c718[_0xaa06('0x4d')][_0xaa06('0x52')](_0xaa06('0x53'))){_0x182fa6['limit']=qs[_0xaa06('0x1f')](_0x20c718[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0x182fa6[_0xaa06('0x22')]=qs[_0xaa06('0x22')](_0x20c718[_0xaa06('0x4d')][_0xaa06('0x22')]);}_0x182fa6['order']=qs[_0xaa06('0x54')](_0x20c718['query'][_0xaa06('0x54')]);_0x182fa6[_0xaa06('0x55')]=qs['filters'](_[_0xaa06('0x56')](_0x20c718[_0xaa06('0x4d')],_0x314b05['filters']),_0x1827f4);if(_0x20c718[_0xaa06('0x4d')][_0xaa06('0x57')]){_0x182fa6['where']=_[_0xaa06('0x58')](_0x182fa6[_0xaa06('0x55')],{'$or':_[_0xaa06('0x47')](_0x1827f4,function(_0x28c386){if(_0x28c386['type']!==_0xaa06('0x59')){var _0x3debf4={};_0x3debf4[_0x28c386[_0xaa06('0x2b')]]={'$like':'%'+_0x20c718[_0xaa06('0x4d')][_0xaa06('0x57')]+'%'};return _0x3debf4;}})});}_0x182fa6=_['merge']({},_0x182fa6,_0x20c718[_0xaa06('0x5a')]);var _0x47b569={'where':_0x182fa6['where']};return db['MailAccount'][_0xaa06('0x21')](_0x47b569)[_0xaa06('0x13')](function(_0x151be1){_0xf69e9['count']=_0x151be1;if(_0x20c718[_0xaa06('0x4d')]['includeAll']){_0x182fa6['include']=[{'all':!![]}];}return db[_0xaa06('0x5b')][_0xaa06('0x5c')](_0x182fa6);})[_0xaa06('0x13')](function(_0x325304){_0xf69e9[_0xaa06('0x5d')]=_0x325304;return _0xf69e9;})[_0xaa06('0x13')](respondWithFilteredResult(_0x27ce40,_0x182fa6))[_0xaa06('0x1b')](handleError(_0x27ce40,null));};exports[_0xaa06('0x5e')]=function(_0x5f5bf3,_0x11d1b5){var _0xd418f7={'raw':![],'where':{'id':_0x5f5bf3[_0xaa06('0x5f')]['id']},'include':[{'model':db[_0xaa06('0x60')],'as':_0xaa06('0x41')},{'model':db[_0xaa06('0x44')],'as':_0xaa06('0x42')},{'model':db[_0xaa06('0x45')],'as':'mandatoryDispositionPause'}]},_0xe94e90={};_0xe94e90[_0xaa06('0x4c')]=_['keys'](db[_0xaa06('0x5b')][_0xaa06('0x48')]);_0xe94e90['query']=_[_0xaa06('0x61')](_0x5f5bf3['query']);_0xe94e90[_0xaa06('0x62')]=_[_0xaa06('0x4e')](_0xe94e90[_0xaa06('0x4c')],_0xe94e90[_0xaa06('0x4d')]);_0xd418f7[_0xaa06('0x4f')]=_[_0xaa06('0x4e')](_0xe94e90[_0xaa06('0x4c')],qs['fields'](_0x5f5bf3['query'][_0xaa06('0x50')]));_0xd418f7[_0xaa06('0x4f')]=_0xd418f7[_0xaa06('0x4f')][_0xaa06('0x51')]?_0xd418f7['attributes']:_0xe94e90[_0xaa06('0x4c')];if(_0x5f5bf3[_0xaa06('0x4d')][_0xaa06('0x63')]){_0xd418f7['include']=[{'all':!![]}];}_0xd418f7=_[_0xaa06('0x58')]({},_0xd418f7,_0x5f5bf3[_0xaa06('0x5a')]);return db['MailAccount']['find'](_0xd418f7)['then'](handleEntityNotFound(_0x11d1b5,null))[_0xaa06('0x13')](respondWithResult(_0x11d1b5,null))[_0xaa06('0x1b')](handleError(_0x11d1b5,null));};exports[_0xaa06('0x25')]=function(_0x3b04ca,_0x4beebb){if(_0x3b04ca[_0xaa06('0x64')]['id']){delete _0x3b04ca[_0xaa06('0x64')]['id'];}var _0x3792c4=_0x3b04ca[_0xaa06('0x64')][_0xaa06('0x65')]===_0xaa06('0x66')?null:_0x3b04ca[_0xaa06('0x64')][_0xaa06('0x65')];var _0xb3aa27=_0x3b04ca['body'][_0xaa06('0x41')]||{};var _0xdbe2c3=_0x3b04ca['body'][_0xaa06('0x42')]||{};if(_0x3792c4){_0xb3aa27[_0xaa06('0x3b')]=getImapHost(_0x3792c4);_0xb3aa27[_0xaa06('0x3c')]=0x3e1;_0xdbe2c3['host']=getSmtpHost(_0x3792c4);_0xdbe2c3['port']=0x24b;_0xdbe2c3[_0xaa06('0x67')]=![];}if(_0xdbe2c3[_0xaa06('0x39')]){_0xdbe2c3[_0xaa06('0x67')]=![];}else{_0xdbe2c3[_0xaa06('0x3a')]=null;}if(!_0xb3aa27[_0xaa06('0x39')])_0xb3aa27[_0xaa06('0x3a')]=null;_0x3b04ca[_0xaa06('0x64')]['Imap']=_0xb3aa27;_0x3b04ca[_0xaa06('0x64')][_0xaa06('0x42')]=_0xdbe2c3;return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x3b04ca[_0xaa06('0x5f')]['id']},'include':[{'model':db[_0xaa06('0x60')],'as':_0xaa06('0x41')},{'model':db[_0xaa06('0x44')],'as':'Smtp'},{'model':db[_0xaa06('0x45')],'as':_0xaa06('0x46')}]})[_0xaa06('0x13')](handleEntityNotFound(_0x4beebb,null))[_0xaa06('0x13')](function(_0x465de1){if(!_0x465de1)throw new Error(_0xaa06('0x69'));if(_0x465de1[_0xaa06('0x3d')])delete _0x3b04ca[_0xaa06('0x64')][_0xaa06('0x41')];return _0x465de1;})['then'](saveUpdates(_0x3b04ca[_0xaa06('0x64')],null))[_0xaa06('0x13')](function(_0x1376be){if(!_0x3b04ca[_0xaa06('0x64')][_0xaa06('0x41')])return _0x1376be;return db[_0xaa06('0x60')][_0xaa06('0x25')](_0x3b04ca['body'][_0xaa06('0x41')],{'where':{'MailAccountId':_0x1376be['id']}})[_0xaa06('0x13')](function(){return _0x1376be;});})['then'](function(_0x26d7a9){if(!_0x3b04ca[_0xaa06('0x64')][_0xaa06('0x42')])return _0x26d7a9;return db[_0xaa06('0x44')][_0xaa06('0x25')](_0x3b04ca['body'][_0xaa06('0x42')],{'where':{'MailAccountId':_0x26d7a9['id']}})['then'](function(){return _0x26d7a9;});})[_0xaa06('0x13')](respondWithResult(_0x4beebb,null))[_0xaa06('0x1b')](handleError(_0x4beebb,null));};exports[_0xaa06('0x6a')]=function(_0x5b7053,_0x45a031){return db['MailAccount'][_0xaa06('0x6a')]()['then'](respondWithResult(_0x45a031,null))[_0xaa06('0x1b')](handleError(_0x45a031,null));};exports['addDisposition']=function(_0x241fac,_0x4ce250){if(_0x241fac['body']['id']){delete _0x241fac['body']['id'];}return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x241fac[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x4ce250,null))['then'](function(_0x3e55ad){if(_0x3e55ad){_0x241fac[_0xaa06('0x64')]['MailAccountId']=_0x3e55ad['id'];return db[_0xaa06('0x6b')][_0xaa06('0x6c')](_0x241fac[_0xaa06('0x64')]);}})[_0xaa06('0x13')](respondWithResult(_0x4ce250,null))[_0xaa06('0x1b')](handleError(_0x4ce250,null));};exports['getDispositions']=function(_0x23020e,_0xe9e290){var _0x39e0ba={'raw':![],'where':{}};var _0x5b5537={};var _0x4398e1={'count':0x0,'rows':[]};return db[_0xaa06('0x5b')][_0xaa06('0x6d')]({'where':{'id':_0x23020e['params']['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0xe9e290,null))[_0xaa06('0x13')](function(_0x43f25e){if(_0x43f25e){_0x5b5537['model']=_['keys'](db['Disposition'][_0xaa06('0x48')]);_0x5b5537[_0xaa06('0x4d')]=_['keys'](_0x23020e['query']);_0x5b5537[_0xaa06('0x62')]=_['intersection'](_0x5b5537[_0xaa06('0x4c')],_0x5b5537['query']);_0x39e0ba[_0xaa06('0x4f')]=_['intersection'](_0x5b5537['model'],qs[_0xaa06('0x50')](_0x23020e[_0xaa06('0x4d')][_0xaa06('0x50')]));_0x39e0ba[_0xaa06('0x4f')]=_0x39e0ba[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x39e0ba[_0xaa06('0x4f')]:_0x5b5537[_0xaa06('0x4c')];if(!_0x23020e[_0xaa06('0x4d')][_0xaa06('0x52')]('nolimit')){_0x39e0ba[_0xaa06('0x1f')]=qs['limit'](_0x23020e['query'][_0xaa06('0x1f')]);_0x39e0ba['offset']=qs[_0xaa06('0x22')](_0x23020e[_0xaa06('0x4d')][_0xaa06('0x22')]);}_0x39e0ba[_0xaa06('0x6e')]=qs[_0xaa06('0x54')](_0x23020e[_0xaa06('0x4d')][_0xaa06('0x54')]);_0x39e0ba[_0xaa06('0x55')]=qs[_0xaa06('0x62')](_['pick'](_0x23020e['query'],_0x5b5537[_0xaa06('0x62')]));_0x39e0ba[_0xaa06('0x55')][_0xaa06('0x6f')]=_0x43f25e['id'];if(_0x23020e[_0xaa06('0x4d')][_0xaa06('0x57')]){_0x39e0ba[_0xaa06('0x55')]=_['merge'](_0x39e0ba['where'],{'$or':_[_0xaa06('0x47')](_0x39e0ba[_0xaa06('0x4f')],function(_0x5d80a5){var _0x3b7bcb={};_0x3b7bcb[_0x5d80a5]={'$like':'%'+_0x23020e[_0xaa06('0x4d')][_0xaa06('0x57')]+'%'};return _0x3b7bcb;})});}_0x39e0ba=_['merge']({},_0x39e0ba,_0x23020e[_0xaa06('0x5a')]);return db[_0xaa06('0x6b')][_0xaa06('0x21')]({'where':_0x39e0ba[_0xaa06('0x55')]})[_0xaa06('0x13')](function(_0x5e0cbb){_0x4398e1[_0xaa06('0x21')]=_0x5e0cbb;if(_0x23020e['query'][_0xaa06('0x63')]){_0x39e0ba['include']=[{'all':!![]}];}return db[_0xaa06('0x6b')][_0xaa06('0x5c')](_0x39e0ba);})['then'](function(_0x4482e0){_0x4398e1[_0xaa06('0x5d')]=_0x4482e0;return _0x4398e1;});}})[_0xaa06('0x13')](respondWithFilteredResult(_0xe9e290,_0x39e0ba))['catch'](handleError(_0xe9e290,null));};exports[_0xaa06('0x70')]=function(_0x1abf7f,_0xb073e8){return db['MailAccount'][_0xaa06('0x68')]({'where':{'id':_0x1abf7f[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0xb073e8,null))[_0xaa06('0x13')](function(_0x294c56){if(_0x294c56){return _0x294c56['removeDispositions'](_0x1abf7f[_0xaa06('0x4d')][_0xaa06('0x71')]);}})[_0xaa06('0x13')](respondWithStatusCode(_0xb073e8,null))[_0xaa06('0x1b')](handleError(_0xb073e8,null));};exports['addAnswer']=function(_0x53fb9d,_0x4d46dd){if(_0x53fb9d[_0xaa06('0x64')]['id']){delete _0x53fb9d[_0xaa06('0x64')]['id'];}return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x53fb9d['params']['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x4d46dd,null))[_0xaa06('0x13')](function(_0x5ee87d){if(_0x5ee87d){_0x53fb9d[_0xaa06('0x64')][_0xaa06('0x6f')]=_0x5ee87d['id'];return db[_0xaa06('0x72')][_0xaa06('0x6c')](_0x53fb9d['body']);}})['then'](respondWithResult(_0x4d46dd,null))[_0xaa06('0x1b')](handleError(_0x4d46dd,null));};exports['getAnswers']=function(_0x2d8d26,_0x587444){var _0xf357b3={'raw':![],'where':{}};var _0x15f784={};var _0x1ab5d4={'count':0x0,'rows':[]};return db[_0xaa06('0x5b')]['findOne']({'where':{'id':_0x2d8d26[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x587444,null))['then'](function(_0x4634a0){if(_0x4634a0){_0x15f784['model']=_[_0xaa06('0x61')](db[_0xaa06('0x72')][_0xaa06('0x48')]);_0x15f784[_0xaa06('0x4d')]=_[_0xaa06('0x61')](_0x2d8d26[_0xaa06('0x4d')]);_0x15f784[_0xaa06('0x62')]=_[_0xaa06('0x4e')](_0x15f784[_0xaa06('0x4c')],_0x15f784[_0xaa06('0x4d')]);_0xf357b3[_0xaa06('0x4f')]=_[_0xaa06('0x4e')](_0x15f784[_0xaa06('0x4c')],qs[_0xaa06('0x50')](_0x2d8d26['query'][_0xaa06('0x50')]));_0xf357b3[_0xaa06('0x4f')]=_0xf357b3['attributes'][_0xaa06('0x51')]?_0xf357b3[_0xaa06('0x4f')]:_0x15f784[_0xaa06('0x4c')];if(!_0x2d8d26[_0xaa06('0x4d')]['hasOwnProperty']('nolimit')){_0xf357b3[_0xaa06('0x1f')]=qs[_0xaa06('0x1f')](_0x2d8d26[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0xf357b3['offset']=qs[_0xaa06('0x22')](_0x2d8d26['query'][_0xaa06('0x22')]);}_0xf357b3[_0xaa06('0x6e')]=qs[_0xaa06('0x54')](_0x2d8d26[_0xaa06('0x4d')]['sort']);_0xf357b3[_0xaa06('0x55')]=qs[_0xaa06('0x62')](_['pick'](_0x2d8d26[_0xaa06('0x4d')],_0x15f784['filters']));_0xf357b3[_0xaa06('0x55')][_0xaa06('0x6f')]=_0x4634a0['id'];if(_0x2d8d26[_0xaa06('0x4d')][_0xaa06('0x57')]){_0xf357b3[_0xaa06('0x55')]=_['merge'](_0xf357b3[_0xaa06('0x55')],{'$or':_['map'](_0xf357b3[_0xaa06('0x4f')],function(_0x33c829){var _0x1e9315={};_0x1e9315[_0x33c829]={'$like':'%'+_0x2d8d26[_0xaa06('0x4d')]['filter']+'%'};return _0x1e9315;})});}_0xf357b3=_[_0xaa06('0x58')]({},_0xf357b3,_0x2d8d26[_0xaa06('0x5a')]);return db[_0xaa06('0x72')][_0xaa06('0x21')]({'where':_0xf357b3[_0xaa06('0x55')]})[_0xaa06('0x13')](function(_0x40a23b){_0x1ab5d4[_0xaa06('0x21')]=_0x40a23b;if(_0x2d8d26[_0xaa06('0x4d')][_0xaa06('0x63')]){_0xf357b3[_0xaa06('0x73')]=[{'all':!![]}];}return db[_0xaa06('0x72')][_0xaa06('0x5c')](_0xf357b3);})[_0xaa06('0x13')](function(_0x591f8e){_0x1ab5d4[_0xaa06('0x5d')]=_0x591f8e;return _0x1ab5d4;});}})[_0xaa06('0x13')](respondWithFilteredResult(_0x587444,_0xf357b3))[_0xaa06('0x1b')](handleError(_0x587444,null));};exports[_0xaa06('0x74')]=function(_0x4844dc,_0x349782){return db['MailAccount']['find']({'where':{'id':_0x4844dc[_0xaa06('0x5f')]['id']}})['then'](handleEntityNotFound(_0x349782,null))['then'](function(_0x346320){if(_0x346320){return _0x346320[_0xaa06('0x74')](_0x4844dc[_0xaa06('0x4d')][_0xaa06('0x71')]);}})[_0xaa06('0x13')](respondWithStatusCode(_0x349782,null))[_0xaa06('0x1b')](handleError(_0x349782,null));};exports[_0xaa06('0x6c')]=function(_0x30c1bf,_0x304f66){var _0x35ae0f={'name':_0x30c1bf['body'][_0xaa06('0x2b')],'key':_0x30c1bf[_0xaa06('0x64')][_0xaa06('0x4b')],'provider':_0x30c1bf['body'][_0xaa06('0x65')]===_0xaa06('0x66')?null:_0x30c1bf['body'][_0xaa06('0x65')],'email':_0x30c1bf[_0xaa06('0x64')][_0xaa06('0x75')],'ListId':_0x30c1bf['body'][_0xaa06('0x76')],'active':!_[_0xaa06('0x77')](_0x30c1bf[_0xaa06('0x64')][_0xaa06('0x78')])?_0x30c1bf[_0xaa06('0x64')]['active']:!![],'description':_0x30c1bf[_0xaa06('0x64')][_0xaa06('0x79')]||null};var _0x437f05=getAuthenticationOptions(_0x35ae0f[_0xaa06('0x65')],_0x30c1bf['body']);_0x35ae0f['Imap']=_0x437f05['Imap'];_0x35ae0f[_0xaa06('0x42')]=_0x437f05[_0xaa06('0x42')];return db[_0xaa06('0x5b')]['create'](_0x35ae0f,{'include':[{'model':db[_0xaa06('0x44')],'as':'Smtp'},{'model':db[_0xaa06('0x60')],'as':_0xaa06('0x41')}]})[_0xaa06('0x13')](function(_0x349d99){var _0x57b807=_0x30c1bf[_0xaa06('0x3f')]['get']({'plain':!![]});if(!_0x57b807)throw new Error(_0xaa06('0x7a'));if(_0x57b807[_0xaa06('0x7b')]==='user'){var _0x21f02e=_0x349d99[_0xaa06('0x27')]({'plain':!![]});return db[_0xaa06('0x7c')]['find']({'where':{'name':_0xaa06('0x7d'),'userProfileId':_0x57b807[_0xaa06('0x7e')]},'raw':!![]})[_0xaa06('0x13')](function(_0x58330f){if(_0x58330f&&_0x58330f['autoAssociation']===0x0){return db[_0xaa06('0x28')][_0xaa06('0x6c')]({'name':_0x21f02e[_0xaa06('0x2b')],'resourceId':_0x21f02e['id'],'type':_0x58330f[_0xaa06('0x2b')],'sectionId':_0x58330f['id']},{})[_0xaa06('0x13')](function(){return _0x349d99;});}else{return _0x349d99;}})[_0xaa06('0x1b')](function(_0x5e2379){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2379);throw _0x5e2379;});}return _0x349d99;})[_0xaa06('0x13')](respondWithResult(_0x304f66,0xc9))[_0xaa06('0x1b')](handleError(_0x304f66,null));};exports['getImap']=function(_0x57cc6f,_0x4ad894){return db[_0xaa06('0x5b')][_0xaa06('0x6d')]({'where':{'id':_0x57cc6f[_0xaa06('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4ad894,null))[_0xaa06('0x13')](function(_0x46b74b){if(_0x46b74b){return _0x46b74b[_0xaa06('0x7f')]();}return null;})[_0xaa06('0x13')](respondWithResult(_0x4ad894,null))[_0xaa06('0x1b')](handleError(_0x4ad894,null));};exports['addImap']=function(_0x4a8504,_0x44fa84){if(_0x4a8504[_0xaa06('0x64')]['id']){delete _0x4a8504[_0xaa06('0x64')]['id'];}return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x4a8504[_0xaa06('0x5f')]['id']}})['then'](handleEntityNotFound(_0x44fa84,null))['then'](function(_0x528359){if(_0x528359){_0x4a8504['body'][_0xaa06('0x6f')]=_0x528359['id'];return db[_0xaa06('0x60')][_0xaa06('0x6c')](_0x4a8504['body']);}})[_0xaa06('0x13')](respondWithResult(_0x44fa84,null))['catch'](handleError(_0x44fa84,null));};exports['removeImap']=function(_0x3a1f90,_0x1f82f8){return db[_0xaa06('0x5b')][_0xaa06('0x6d')]({'where':{'id':_0x3a1f90[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x1f82f8,null))[_0xaa06('0x13')](function(_0xf83ed7){if(_0xf83ed7){return _0xf83ed7[_0xaa06('0x80')](null);}return null;})[_0xaa06('0x13')](respondWithStatusCode(_0x1f82f8,null))['catch'](handleError(_0x1f82f8,null));};exports['getSmtp']=function(_0x212523,_0x5c1d9b){return db[_0xaa06('0x5b')][_0xaa06('0x6d')]({'where':{'id':_0x212523[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x5c1d9b,null))[_0xaa06('0x13')](function(_0x397819){if(_0x397819){return _0x397819[_0xaa06('0x81')]();}return null;})[_0xaa06('0x13')](respondWithResult(_0x5c1d9b,null))[_0xaa06('0x1b')](handleError(_0x5c1d9b,null));};exports['addSmtp']=function(_0x484d22,_0x462e08){if(_0x484d22[_0xaa06('0x64')]['id']){delete _0x484d22[_0xaa06('0x64')]['id'];}return db['MailAccount'][_0xaa06('0x68')]({'where':{'id':_0x484d22[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x462e08,null))['then'](function(_0xdd54a5){if(_0xdd54a5){_0x484d22[_0xaa06('0x64')][_0xaa06('0x6f')]=_0xdd54a5['id'];return db[_0xaa06('0x44')][_0xaa06('0x6c')](_0x484d22['body']);}})[_0xaa06('0x13')](respondWithResult(_0x462e08,null))[_0xaa06('0x1b')](handleError(_0x462e08,null));};exports[_0xaa06('0x82')]=function(_0x19e1a2,_0x2ee7fa){return db['MailAccount'][_0xaa06('0x6d')]({'where':{'id':_0x19e1a2[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x2ee7fa,null))[_0xaa06('0x13')](function(_0x1825f9){if(_0x1825f9){return _0x1825f9['setSmtp'](null);}return null;})[_0xaa06('0x13')](respondWithStatusCode(_0x2ee7fa,null))[_0xaa06('0x1b')](handleError(_0x2ee7fa,null));};exports['addInteraction']=function(_0xcc8a6e,_0x3522d5){return db[_0xaa06('0x83')][_0xaa06('0x68')]({'where':{'id':_0xcc8a6e[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x3522d5,null))[_0xaa06('0x13')](function(_0x36fd88){if(_0x36fd88){return _0x36fd88[_0xaa06('0x84')](_0xcc8a6e[_0xaa06('0x64')]['ids'],_[_0xaa06('0x85')](_0xcc8a6e[_0xaa06('0x64')],[_0xaa06('0x71'),'id'])||{});}})[_0xaa06('0x13')](respondWithResult(_0x3522d5,null))[_0xaa06('0x1b')](handleError(_0x3522d5,null));};exports[_0xaa06('0x86')]=function(_0x2a6b90,_0x326575){var _0x35dfcc={'raw':![],'where':{}};var _0x5c276a={};var _0x2a1947={'count':0x0,'rows':[]};return db[_0xaa06('0x5b')]['findOne']({'where':{'id':_0x2a6b90['params']['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x326575,null))['then'](function(_0x4f5b92){if(_0x4f5b92){_0x5c276a[_0xaa06('0x4c')]=_[_0xaa06('0x61')](db[_0xaa06('0x83')][_0xaa06('0x48')]);_0x5c276a[_0xaa06('0x4d')]=_[_0xaa06('0x61')](_0x2a6b90[_0xaa06('0x4d')]);_0x5c276a['filters']=_[_0xaa06('0x4e')](_0x5c276a[_0xaa06('0x4c')],_0x5c276a['query']);_0x35dfcc['attributes']=_[_0xaa06('0x4e')](_0x5c276a[_0xaa06('0x4c')],qs['fields'](_0x2a6b90[_0xaa06('0x4d')][_0xaa06('0x50')]));_0x35dfcc[_0xaa06('0x4f')]=_0x35dfcc[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x35dfcc['attributes']:_0x5c276a[_0xaa06('0x4c')];if(!_0x2a6b90[_0xaa06('0x4d')][_0xaa06('0x52')](_0xaa06('0x53'))){_0x35dfcc['limit']=qs[_0xaa06('0x1f')](_0x2a6b90[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0x35dfcc[_0xaa06('0x22')]=qs[_0xaa06('0x22')](_0x2a6b90[_0xaa06('0x4d')]['offset']);}_0x35dfcc[_0xaa06('0x6e')]=qs['sort'](_0x2a6b90['query'][_0xaa06('0x54')]);_0x35dfcc[_0xaa06('0x55')]=qs[_0xaa06('0x62')](_[_0xaa06('0x56')](_0x2a6b90[_0xaa06('0x4d')],_0x5c276a[_0xaa06('0x62')]));_0x35dfcc[_0xaa06('0x55')][_0xaa06('0x6f')]=_0x4f5b92['id'];if(_0x2a6b90['query'][_0xaa06('0x57')]){_0x35dfcc[_0xaa06('0x55')]=_[_0xaa06('0x58')](_0x35dfcc[_0xaa06('0x55')],{'$or':_['map'](_0x35dfcc['attributes'],function(_0x1324cf){var _0x104286={};_0x104286[_0x1324cf]={'$like':'%'+_0x2a6b90['query']['filter']+'%'};return _0x104286;})});}_0x35dfcc=_[_0xaa06('0x58')]({},_0x35dfcc,_0x2a6b90[_0xaa06('0x5a')]);return db[_0xaa06('0x83')][_0xaa06('0x21')]({'where':_0x35dfcc[_0xaa06('0x55')]})[_0xaa06('0x13')](function(_0x4aa430){_0x2a1947['count']=_0x4aa430;if(_0x2a6b90[_0xaa06('0x4d')][_0xaa06('0x63')]){_0x35dfcc['include']=[{'model':db[_0xaa06('0x87')],'as':_0xaa06('0x88'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xaa06('0x2b'),'fullname',_0xaa06('0x89')],'required':![]},{'model':db[_0xaa06('0x8a')],'as':_0xaa06('0x8b'),'attributes':['id',_0xaa06('0x2b'),'color'],'where':_0x2a6b90[_0xaa06('0x4d')]['tag']?{'id':_0x2a6b90[_0xaa06('0x4d')]['tag']}:undefined,'required':_0x2a6b90[_0xaa06('0x4d')][_0xaa06('0x8c')]?!![]:![]}];}return db['MailInteraction'][_0xaa06('0x5c')](_0x35dfcc);})[_0xaa06('0x13')](function(_0x809b03){_0x2a1947[_0xaa06('0x5d')]=_0x809b03;return _0x2a1947;});}})[_0xaa06('0x13')](respondWithFilteredResult(_0x326575,_0x35dfcc))['catch'](handleError(_0x326575,null));};exports['addApplications']=function addApplications(_0x2a0d9b,_0x29c3db){var _0x15908f=_0x2a0d9b['params']['id'];var _0x5a55ae=_0x2a0d9b[_0xaa06('0x64')];var _0x16f3f0=0xc8;var _0x1ae9b3=null;return db[_0xaa06('0x8d')][_0xaa06('0x8e')]({'isolationLevel':db[_0xaa06('0x8d')]['Transaction'][_0xaa06('0x8f')][_0xaa06('0x90')]},function(_0x2b013b){return db[_0xaa06('0x5b')][_0xaa06('0x6d')]({'where':{'id':_0x15908f},'transaction':_0x2b013b})[_0xaa06('0x13')](function(_0x1a3910){if(_0x1a3910){return db[_0xaa06('0x91')][_0xaa06('0x26')]({'where':{'MailAccountId':_0x15908f},'transaction':_0x2b013b})[_0xaa06('0x13')](function(){var _0x4378c0=_[_0xaa06('0x47')](_0x5a55ae,function(_0x40b507){_0x40b507[_0xaa06('0x6f')]=_0x15908f;return _0x40b507;});return db['MailApplication']['bulkCreate'](_0x4378c0,{'transaction':_0x2b013b});});}else{_0x16f3f0=0x194;_0x1ae9b3=[];}});})['then'](function(){if(_0x16f3f0!==0x194){return db['MailApplication'][_0xaa06('0x92')]({'where':{'MailAccountId':_0x15908f},'order':_0xaa06('0x93')})[_0xaa06('0x13')](function(_0x496299){_0x1ae9b3=_0x496299;});}})[_0xaa06('0x1b')](function(_0x447073){_0x16f3f0=0x1f4;logger[_0xaa06('0x17')](_0x447073[_0xaa06('0x2a')]);if(_0x447073[_0xaa06('0x2b')]){delete _0x447073[_0xaa06('0x2b')];}_0x1ae9b3=_0x447073;})[_0xaa06('0x94')](function(){if(_0x1ae9b3===null){_0x29c3db['sendStatus'](_0x16f3f0);}else{if(_0x16f3f0===0x1f4){_0x29c3db[_0xaa06('0x1d')](_0x16f3f0)['send'](_0x1ae9b3);}else{_0x29c3db['status'](_0x16f3f0)['json'](_0x1ae9b3);}}});};exports[_0xaa06('0x95')]=function(_0x2139e2,_0x23219c){var _0x2a83ef={};var _0x4f1cab={};var _0x889a22;var _0xcd753e;return db[_0xaa06('0x5b')]['findOne']({'where':{'id':_0x2139e2['params']['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x23219c,null))[_0xaa06('0x13')](function(_0x5b3843){if(_0x5b3843){_0x889a22=_0x5b3843;_0x4f1cab['model']=_[_0xaa06('0x61')](db['MailApplication'][_0xaa06('0x48')]);_0x4f1cab[_0xaa06('0x4d')]=_[_0xaa06('0x61')](_0x2139e2[_0xaa06('0x4d')]);_0x4f1cab[_0xaa06('0x62')]=_['intersection'](_0x4f1cab[_0xaa06('0x4c')],_0x4f1cab[_0xaa06('0x4d')]);_0x2a83ef['attributes']=_[_0xaa06('0x4e')](_0x4f1cab[_0xaa06('0x4c')],qs[_0xaa06('0x50')](_0x2139e2['query']['fields']));_0x2a83ef[_0xaa06('0x4f')]=_0x2a83ef[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x2a83ef['attributes']:_0x4f1cab['model'];_0x2a83ef[_0xaa06('0x6e')]=qs[_0xaa06('0x54')](_0x2139e2[_0xaa06('0x4d')]['sort']);_0x2a83ef[_0xaa06('0x55')]=qs[_0xaa06('0x62')](_[_0xaa06('0x56')](_0x2139e2[_0xaa06('0x4d')],_0x4f1cab['filters']));if(_0x2139e2['query'][_0xaa06('0x57')]){_0x2a83ef[_0xaa06('0x55')]=_['merge'](_0x2a83ef[_0xaa06('0x55')],{'$or':_[_0xaa06('0x47')](_0x2a83ef['attributes'],function(_0x3fde19){var _0xd35a8d={};_0xd35a8d[_0x3fde19]={'$like':'%'+_0x2139e2[_0xaa06('0x4d')]['filter']+'%'};return _0xd35a8d;})});}_0x2a83ef=_[_0xaa06('0x58')]({},_0x2a83ef,_0x2139e2[_0xaa06('0x5a')]);return _0x889a22[_0xaa06('0x95')](_0x2a83ef);}})[_0xaa06('0x13')](function(_0x3a7cfc){if(_0x3a7cfc){_0xcd753e=_0x3a7cfc[_0xaa06('0x51')];if(!_0x2139e2[_0xaa06('0x4d')]['hasOwnProperty']('nolimit')){_0x2a83ef[_0xaa06('0x1f')]=qs[_0xaa06('0x1f')](_0x2139e2[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0x2a83ef[_0xaa06('0x22')]=qs[_0xaa06('0x22')](_0x2139e2[_0xaa06('0x4d')][_0xaa06('0x22')]);}return _0x889a22[_0xaa06('0x95')](_0x2a83ef);}})[_0xaa06('0x13')](function(_0x29d66a){if(_0x29d66a){return _0x29d66a?{'count':_0xcd753e,'rows':_0x29d66a}:null;}})[_0xaa06('0x13')](respondWithResult(_0x23219c,null))['catch'](handleError(_0x23219c,null));};exports[_0xaa06('0x96')]=function(_0x3a79ea,_0x1b2152){var _0x58c13f={'raw':!![],'where':{}};var _0x314bb5={};var _0x111ed4={'count':0x0,'rows':[]};return db['MailAccount'][_0xaa06('0x6d')]({'where':{'id':_0x3a79ea[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x1b2152,null))['then'](function(_0x2d62f6){if(_0x2d62f6){_0x314bb5['model']=_['keys'](db[_0xaa06('0x97')]['rawAttributes']);_0x314bb5[_0xaa06('0x4d')]=_['keys'](_0x3a79ea[_0xaa06('0x4d')]);_0x314bb5[_0xaa06('0x62')]=_[_0xaa06('0x4e')](_0x314bb5['model'],_0x314bb5['query']);_0x58c13f[_0xaa06('0x4f')]=_[_0xaa06('0x4e')](_0x314bb5[_0xaa06('0x4c')],qs[_0xaa06('0x50')](_0x3a79ea['query']['fields']));_0x58c13f[_0xaa06('0x4f')]=_0x58c13f[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x58c13f[_0xaa06('0x4f')]:_0x314bb5[_0xaa06('0x4c')];if(!_0x3a79ea[_0xaa06('0x4d')]['hasOwnProperty']('nolimit')){_0x58c13f[_0xaa06('0x1f')]=qs[_0xaa06('0x1f')](_0x3a79ea[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0x58c13f[_0xaa06('0x22')]=qs['offset'](_0x3a79ea[_0xaa06('0x4d')]['offset']);}_0x58c13f[_0xaa06('0x6e')]=qs[_0xaa06('0x54')](_0x3a79ea[_0xaa06('0x4d')][_0xaa06('0x54')]);_0x58c13f['where']=qs['filters'](_[_0xaa06('0x56')](_0x3a79ea[_0xaa06('0x4d')],_0x314bb5[_0xaa06('0x62')]));_0x58c13f[_0xaa06('0x55')]['MailAccountId']=_0x2d62f6['id'];if(_0x3a79ea[_0xaa06('0x4d')]['filter']){_0x58c13f[_0xaa06('0x55')]=_[_0xaa06('0x58')](_0x58c13f[_0xaa06('0x55')],{'$or':_['map'](_0x58c13f['attributes'],function(_0x170535){var _0x3aa426={};_0x3aa426[_0x170535]={'$like':'%'+_0x3a79ea['query']['filter']+'%'};return _0x3aa426;})});}if(_0x3a79ea[_0xaa06('0x4d')][_0xaa06('0x98')]){var _0x1550a9=_0x3a79ea['query']['$gte'][_0xaa06('0x99')](',');var _0x1ffb23={};_0x1ffb23[_0x1550a9[0x0]]={'$gte':moment(_0x1550a9[0x1])[_0xaa06('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x58c13f[_0xaa06('0x55')]=_['merge'](_0x58c13f[_0xaa06('0x55')],_0x1ffb23);}_0x58c13f=_['merge']({},_0x58c13f,_0x3a79ea[_0xaa06('0x5a')]);return db[_0xaa06('0x97')]['count']({'where':_0x58c13f[_0xaa06('0x55')]})[_0xaa06('0x13')](function(_0x24bf6c){_0x111ed4[_0xaa06('0x21')]=_0x24bf6c;if(_0x3a79ea[_0xaa06('0x4d')][_0xaa06('0x63')]){_0x58c13f[_0xaa06('0x73')]=[{'all':!![]}];}return db[_0xaa06('0x97')][_0xaa06('0x5c')](_0x58c13f);})['then'](function(_0x53302d){if(_0x3a79ea[_0xaa06('0x4d')][_0xaa06('0x9b')]==='true'){for(var _0xed9e17=0x0;_0xed9e17<_0x53302d[_0xaa06('0x51')];_0xed9e17++){_0x53302d[_0xed9e17]['body']=juice(_0x53302d[_0xed9e17][_0xaa06('0x64')]);}}_0x111ed4['rows']=_0x53302d;return _0x111ed4;});}})[_0xaa06('0x13')](respondWithFilteredResult(_0x1b2152,_0x58c13f))[_0xaa06('0x1b')](handleError(_0x1b2152,null));};exports[_0xaa06('0x2c')]=function(_0x3ca3c5,_0x304915){var _0x566a3b,_0x42ce31={},_0xb6657;if(_0x3ca3c5[_0xaa06('0x64')]['to']){_0xb6657=_0x3ca3c5[_0xaa06('0x64')]['to'][_0xaa06('0x99')](',')[0x0];}return db[_0xaa06('0x5b')]['find']({'where':{'id':_0x3ca3c5[_0xaa06('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xaa06('0x9c'),'include':[{'model':db[_0xaa06('0x87')],'as':_0xaa06('0x9d'),'where':{'email':_0xb6657},'limit':0x1,'order':[['updatedAt',_0xaa06('0x9e')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xaa06('0x9f'),'raw':!![]}]}]})[_0xaa06('0x13')](handleEntityNotFound(_0x304915,null))[_0xaa06('0x13')](function(_0xf4beb3){if(!_0xf4beb3)return;_0x566a3b=_0xf4beb3;if(!_0xf4beb3[_0xaa06('0x42')])throw new Error(_0xaa06('0xa0'));if(_['isNil'](_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa1')])){_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa1')]=util[_0xaa06('0x9a')](_0xaa06('0xa2'),_0xf4beb3[_0xaa06('0x2b')],_0xf4beb3[_0xaa06('0x75')]||_0xf4beb3[_0xaa06('0x42')][_0xaa06('0x3f')]);}if(_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa3')]&&_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa3')][_0xaa06('0x51')]){for(var _0x452654=0x0;_0x452654<_0x3ca3c5['body'][_0xaa06('0xa3')][_0xaa06('0x51')];_0x452654+=0x1){_0x3ca3c5[_0xaa06('0x64')]['attachments'][_0x452654]={'filename':_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa3')][_0x452654][_0xaa06('0x2b')],'path':path[_0xaa06('0xa4')](config[_0xaa06('0xa5')],_0xaa06('0xa6'),_0x3ca3c5[_0xaa06('0x64')]['attachments'][_0x452654][_0xaa06('0xa7')])};}}var _0x1531cd=_0xf4beb3[_0xaa06('0xa8')]();return respondWithRpcPromise(_0xaa06('0xa9'),'sendMail',{'account':_0x1531cd,'message':_0x3ca3c5['body']});})['then'](function(_0x161032){if(!_0x161032)return;_0x42ce31=_0x161032;if(!_0x566a3b[_0xaa06('0x9c')])throw new Error(_0xaa06('0xaa'));if(_0x566a3b['List'][_0xaa06('0x9d')][_0xaa06('0x51')])return _0x566a3b['List'][_0xaa06('0x9d')][0x0];return db[_0xaa06('0x87')][_0xaa06('0x6c')](_['defaults'](_0x3ca3c5[_0xaa06('0x64')],{'firstName':_0x3ca3c5[_0xaa06('0x64')]['to'],'email':_0x3ca3c5[_0xaa06('0x64')]['to'],'phone':_0x3ca3c5[_0xaa06('0x64')]['to'],'ListId':_0x566a3b[_0xaa06('0x76')]}));})[_0xaa06('0x13')](function(_0x2da1b7){if(!_0x2da1b7)return;var _0xe63abd={'UserId':_0x3ca3c5[_0xaa06('0x3f')]['id'],'ContactId':_0x2da1b7['id'],'MailAccountId':_0x566a3b['id'],'inReplyTo':_0x42ce31[_0xaa06('0xab')],'to':_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xa1')],'cc':_0x3ca3c5['body']['cc'],'subject':_0x3ca3c5['body'][_0xaa06('0xac')],'attach':_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xad')],'firstMsgDirection':_0xaa06('0xae'),'lastMsgAt':moment()['format'](_0xaa06('0xaf')),'lastMsgDirection':_0xaa06('0xae'),'Messages':[_[_0xaa06('0x58')](_0x3ca3c5[_0xaa06('0x64')],{'messageId':_0x42ce31[_0xaa06('0xab')],'sentAt':moment()[_0xaa06('0x9a')](_0xaa06('0xaf')),'read':!![],'MailAccountId':_0x566a3b['id'],'UserId':_0x3ca3c5['user']['id'],'ContactId':_0x2da1b7['id']})]};if(_0x3ca3c5[_0xaa06('0x64')][_0xaa06('0xb0')]){_0xe63abd=_['merge'](_0xe63abd,_0x3ca3c5[_0xaa06('0x64')]['Interaction']);}return db[_0xaa06('0x83')][_0xaa06('0x6c')](_0xe63abd,{'include':[{'model':db[_0xaa06('0x97')],'as':_0xaa06('0xb1')}]});})[_0xaa06('0x13')](respondWithResult(_0x304915,null))[_0xaa06('0x1b')](handleError(_0x304915,null));};exports['verifySmtp']=function(_0x2f4f64,_0x4b4127){return db['MailAccount']['find']({'where':{'id':_0x2f4f64[_0xaa06('0x5f')]['id']},'include':[{'model':db[_0xaa06('0x44')],'as':_0xaa06('0x42'),'raw':!![],'include':[{'model':db[_0xaa06('0x9f')],'as':'CloudProvider','raw':!![]}]}]})[_0xaa06('0x13')](handleEntityNotFound(_0x4b4127,null))[_0xaa06('0x13')](function(_0x6e6e7f){if(!_0x6e6e7f[_0xaa06('0x42')])return;var _0x90f86d=_0x6e6e7f['getSmtpOptions']();return respondWithRpcPromise(_0xaa06('0xb2'),_0xaa06('0xb3'),{'account':_0x90f86d});})['then'](respondWithResult(_0x4b4127,null))[_0xaa06('0x1b')](handleError(_0x4b4127,null));};exports[_0xaa06('0x26')]=function(_0x4f498a,_0x49959d){return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x4f498a[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x49959d,null))[_0xaa06('0x13')](function(_0x57c97a){if(_0x57c97a&&_0x57c97a[_0xaa06('0x3d')]){throw new db[(_0xaa06('0xb4'))][(_0xaa06('0xb5'))](_0xaa06('0xb6'));}return _0x57c97a;})['then'](removeEntity(_0x49959d,null))[_0xaa06('0x1b')](handleError(_0x49959d,null));};exports['addAgents']=function(_0x13604c,_0x515c6e){return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x13604c[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x515c6e,null))[_0xaa06('0x13')](function(_0x581ccd){if(_0x581ccd){return _0x581ccd['addAgents'](_0x13604c[_0xaa06('0x64')][_0xaa06('0x71')],_[_0xaa06('0x85')](_0x13604c[_0xaa06('0x64')],[_0xaa06('0x71'),'id'])||{})[_0xaa06('0xb7')](function(_0x43600b){for(var _0x326e61=0x0;_0x326e61<_0x13604c[_0xaa06('0x64')][_0xaa06('0x71')]['length'];_0x326e61+=0x1){socket[_0xaa06('0xb8')](_0xaa06('0xb9'),{'UserId':Number(_0x13604c[_0xaa06('0x64')][_0xaa06('0x71')][_0x326e61]),'MailAccountId':Number(_0x13604c[_0xaa06('0x5f')]['id'])});}return _0x43600b;});}})['then'](respondWithResult(_0x515c6e,null))[_0xaa06('0x1b')](handleError(_0x515c6e,null));};exports[_0xaa06('0xba')]=function(_0x144ac2,_0x64c3f4){return db[_0xaa06('0x5b')][_0xaa06('0x68')]({'where':{'id':_0x144ac2['params']['id']}})['then'](handleEntityNotFound(_0x64c3f4,null))[_0xaa06('0x13')](function(_0x55d69e){if(_0x55d69e){return _0x55d69e['removeAgents'](_0x144ac2['query'][_0xaa06('0x71')])[_0xaa06('0x13')](function(){if(_[_0xaa06('0xbb')](_0x144ac2[_0xaa06('0x4d')][_0xaa06('0x71')])){for(var _0x1c711d=0x0;_0x1c711d<_0x144ac2[_0xaa06('0x4d')]['ids'][_0xaa06('0x51')];_0x1c711d+=0x1){socket[_0xaa06('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x144ac2[_0xaa06('0x4d')][_0xaa06('0x71')][_0x1c711d]),'MailAccountId':Number(_0x144ac2['params']['id'])});}}else{socket[_0xaa06('0xb8')](_0xaa06('0xbc'),{'UserId':Number(_0x144ac2['query']['ids']),'MailAccountId':Number(_0x144ac2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x64c3f4,null))[_0xaa06('0x1b')](handleError(_0x64c3f4,null));};exports[_0xaa06('0xbd')]=function(_0x3f42ef,_0x4e5a05){var _0x2a95d6={};var _0x68d2cd={};var _0x4b7512;var _0x5ed63f;return db[_0xaa06('0x5b')]['findOne']({'where':{'id':_0x3f42ef[_0xaa06('0x5f')]['id']}})[_0xaa06('0x13')](handleEntityNotFound(_0x4e5a05,null))[_0xaa06('0x13')](function(_0x5a20a7){if(_0x5a20a7){_0x4b7512=_0x5a20a7;_0x68d2cd[_0xaa06('0x4c')]=_[_0xaa06('0x61')](db[_0xaa06('0xbe')][_0xaa06('0x48')]);_0x68d2cd[_0xaa06('0x4d')]=_[_0xaa06('0x61')](_0x3f42ef[_0xaa06('0x4d')]);_0x68d2cd[_0xaa06('0x62')]=_[_0xaa06('0x4e')](_0x68d2cd[_0xaa06('0x4c')],_0x68d2cd[_0xaa06('0x4d')]);_0x2a95d6['attributes']=_[_0xaa06('0x4e')](_0x68d2cd[_0xaa06('0x4c')],qs[_0xaa06('0x50')](_0x3f42ef[_0xaa06('0x4d')][_0xaa06('0x50')]));_0x2a95d6[_0xaa06('0x4f')]=_0x2a95d6[_0xaa06('0x4f')][_0xaa06('0x51')]?_0x2a95d6['attributes']:_0x68d2cd['model'];_0x2a95d6['order']=qs[_0xaa06('0x54')](_0x3f42ef[_0xaa06('0x4d')][_0xaa06('0x54')]);_0x2a95d6[_0xaa06('0x55')]=qs[_0xaa06('0x62')](_[_0xaa06('0x56')](_0x3f42ef[_0xaa06('0x4d')],_0x68d2cd[_0xaa06('0x62')]));if(_0x3f42ef[_0xaa06('0x4d')]['filter']){_0x2a95d6[_0xaa06('0x55')]=_['merge'](_0x2a95d6[_0xaa06('0x55')],{'$or':_[_0xaa06('0x47')](_0x2a95d6[_0xaa06('0x4f')],function(_0xe80fe5){var _0x1c0965={};_0x1c0965[_0xe80fe5]={'$like':'%'+_0x3f42ef[_0xaa06('0x4d')][_0xaa06('0x57')]+'%'};return _0x1c0965;})});}_0x2a95d6=_[_0xaa06('0x58')]({},_0x2a95d6,_0x3f42ef[_0xaa06('0x5a')]);return _0x4b7512[_0xaa06('0xbd')](_0x2a95d6);}})[_0xaa06('0x13')](function(_0x1d906f){if(_0x1d906f){_0x5ed63f=_0x1d906f['length'];if(!_0x3f42ef[_0xaa06('0x4d')]['hasOwnProperty'](_0xaa06('0x53'))){_0x2a95d6[_0xaa06('0x1f')]=qs[_0xaa06('0x1f')](_0x3f42ef[_0xaa06('0x4d')][_0xaa06('0x1f')]);_0x2a95d6['offset']=qs['offset'](_0x3f42ef[_0xaa06('0x4d')]['offset']);}return _0x4b7512[_0xaa06('0xbd')](_0x2a95d6);}})['then'](function(_0x2be2a8){if(_0x2be2a8){return _0x2be2a8?{'count':_0x5ed63f,'rows':_0x2be2a8}:null;}})['then'](respondWithResult(_0x4e5a05,null))[_0xaa06('0x1b')](handleError(_0x4e5a05,null));}; \ No newline at end of file +var _0x4a61=['send','gmail','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','authentication','username','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','MailAccount','includeAll','findAll','rows','catch','show','params','include','find','body','provider','custom','secure','service','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','format','out','Interaction','Messages','verifySmtp','CloudProvider','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','moment','util','lodash','ioredis','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','name'];(function(_0x270cc2,_0x319e8b){var _0x3e5030=function(_0x47e686){while(--_0x47e686){_0x270cc2['push'](_0x270cc2['shift']());}};_0x3e5030(++_0x319e8b);}(_0x4a61,0x97));var _0x14a6=function(_0x5b3933,_0x318159){_0x5b3933=_0x5b3933-0x0;var _0x3d15ad=_0x4a61[_0x5b3933];return _0x3d15ad;};'use strict';var moment=require(_0x14a6('0x0'));var BPromise=require('bluebird');var util=require(_0x14a6('0x1'));var path=require('path');var _=require(_0x14a6('0x2'));var juice=require('juice');var Redis=require(_0x14a6('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x14a6('0x4'))('api');var config=require(_0x14a6('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x14a6('0x6')](config[_0x14a6('0x7')],{'host':_0x14a6('0x8'),'port':0x18eb});var socket=require(_0x14a6('0x9'))(new Redis(config[_0x14a6('0x7')]));require(_0x14a6('0xa'))[_0x14a6('0xb')](socket);var jayson=require(_0x14a6('0xc'));var client=jayson[_0x14a6('0xd')][_0x14a6('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x49e029,_0x5b4bae,_0x5ecfb4,_0x3a1b27){return new BPromise(function(_0x469cac,_0x2a17a4){var _0x14a888=_0x3a1b27||client;return _0x14a888[_0x14a6('0xf')](_0x49e029,_0x5ecfb4)['then'](function(_0x3e623d){logger[_0x14a6('0x10')](_0x14a6('0x11'),_0x5b4bae,_0x14a6('0x12'));logger[_0x14a6('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5b4bae,_0x14a6('0x12'),JSON[_0x14a6('0x14')](_0x3e623d));if(_0x3e623d[_0x14a6('0x15')]){if(_0x3e623d[_0x14a6('0x15')][_0x14a6('0x16')]===0x1f4){logger[_0x14a6('0x15')](_0x14a6('0x11'),_0x5b4bae,_0x3e623d[_0x14a6('0x15')][_0x14a6('0x17')]);return _0x2a17a4(_0x3e623d['error'][_0x14a6('0x17')]);}logger['error'](_0x14a6('0x11'),_0x5b4bae,_0x3e623d[_0x14a6('0x15')][_0x14a6('0x17')]);return _0x469cac(_0x3e623d[_0x14a6('0x15')][_0x14a6('0x17')]);}else{logger['info'](_0x14a6('0x11'),_0x5b4bae,'request\x20sent');_0x469cac(_0x3e623d['result'][_0x14a6('0x17')]);}})['catch'](function(_0x49f9d0){logger[_0x14a6('0x15')](_0x14a6('0x11'),_0x5b4bae,_0x49f9d0);_0x2a17a4(_0x49f9d0);});});}function respondWithStatusCode(_0x1cf62d,_0x2f0ce5){_0x2f0ce5=_0x2f0ce5||0xcc;return function(_0x3771fa){if(_0x3771fa){return _0x1cf62d[_0x14a6('0x18')](_0x2f0ce5);}return _0x1cf62d[_0x14a6('0x19')](_0x2f0ce5)[_0x14a6('0x1a')]();};}function respondWithResult(_0x5d9846,_0x385ff7){_0x385ff7=_0x385ff7||0xc8;return function(_0x27cb14){if(_0x27cb14){return _0x5d9846[_0x14a6('0x19')](_0x385ff7)[_0x14a6('0x1b')](_0x27cb14);}};}function respondWithFilteredResult(_0x3155d4,_0x3d3e5a){return function(_0x377fc8){if(_0x377fc8){var _0x3fdcb4=typeof _0x3d3e5a['offset']===_0x14a6('0x1c')&&typeof _0x3d3e5a[_0x14a6('0x1d')]===_0x14a6('0x1c');var _0x4fd526=_0x377fc8[_0x14a6('0x1e')];var _0x46de97=_0x3fdcb4?0x0:_0x3d3e5a[_0x14a6('0x1f')];var _0x5208b1=_0x3fdcb4?_0x377fc8['count']:_0x3d3e5a['offset']+_0x3d3e5a[_0x14a6('0x1d')];var _0x449441;if(_0x5208b1>=_0x4fd526){_0x5208b1=_0x4fd526;_0x449441=0xc8;}else{_0x449441=0xce;}_0x3155d4[_0x14a6('0x19')](_0x449441);return _0x3155d4[_0x14a6('0x20')](_0x14a6('0x21'),_0x46de97+'-'+_0x5208b1+'/'+_0x4fd526)[_0x14a6('0x1b')](_0x377fc8);}return null;};}function saveUpdates(_0x3b1ebc){return function(_0x3f72f4){if(_0x3f72f4){return _0x3f72f4['update'](_0x3b1ebc)[_0x14a6('0x22')](function(_0x2f5547){return _0x2f5547;});}return null;};}function removeEntity(_0x50704d){return function(_0xa97d9b){if(_0xa97d9b){return _0xa97d9b[_0x14a6('0x23')]()[_0x14a6('0x22')](function(){var _0x5b4885=_0xa97d9b[_0x14a6('0x24')]({'plain':!![]});var _0x4d7c98=_0x14a6('0x25');return db[_0x14a6('0x26')][_0x14a6('0x23')]({'where':{'type':_0x4d7c98,'resourceId':_0x5b4885['id']}})[_0x14a6('0x22')](function(){return _0xa97d9b;});})[_0x14a6('0x22')](function(){_0x50704d[_0x14a6('0x19')](0xcc)[_0x14a6('0x1a')]();});}};}function handleEntityNotFound(_0x5d2b41){return function(_0x181a34){if(!_0x181a34){_0x5d2b41[_0x14a6('0x18')](0x194);}return _0x181a34;};}function handleError(_0x35af4d,_0x33b0cc){_0x33b0cc=_0x33b0cc||0x1f4;return function(_0x46a6a5){logger[_0x14a6('0x15')](_0x46a6a5['stack']);if(_0x46a6a5[_0x14a6('0x27')]){delete _0x46a6a5['name'];}_0x35af4d[_0x14a6('0x19')](_0x33b0cc)[_0x14a6('0x28')](_0x46a6a5);};}function getImapHost(_0x1d65cb){switch(_0x1d65cb){case _0x14a6('0x29'):return'imap.gmail.com';case'yahoo':return _0x14a6('0x2a');case _0x14a6('0x2b'):return'imap-mail.outlook.com';case _0x14a6('0x2c'):return _0x14a6('0x2d');}throw new Error(_0x14a6('0x2e'),_0x1d65cb);}function getSmtpHost(_0x3c5e26){switch(_0x3c5e26){case'gmail':return _0x14a6('0x2f');case _0x14a6('0x30'):return'smtp.mail.yahoo.com';case _0x14a6('0x2b'):return _0x14a6('0x31');case _0x14a6('0x2c'):return _0x14a6('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3c5e26);}function getAuthenticationOptions(_0x322ea6,_0x559456){var _0x4307ee={};var _0x36b6a0={};if(_0x322ea6){_0x4307ee[_0x14a6('0x33')]=_0x36b6a0[_0x14a6('0x33')]=_0x559456['username'];_0x4307ee[_0x14a6('0x34')]=_0x36b6a0[_0x14a6('0x35')]=_0x559456[_0x14a6('0x34')];if(_0x559456[_0x14a6('0x36')]){_0x4307ee[_0x14a6('0x36')]=_0x36b6a0[_0x14a6('0x36')]=!![];_0x4307ee['CloudProviderId']=_0x36b6a0[_0x14a6('0x37')]=_0x559456['CloudProviderId'];_0x4307ee['password']=_0x36b6a0[_0x14a6('0x35')]=null;}else{_0x4307ee[_0x14a6('0x37')]=_0x36b6a0[_0x14a6('0x37')]=null;}_0x4307ee[_0x14a6('0x38')]=getImapHost(_0x322ea6);_0x4307ee[_0x14a6('0x39')]=0x3e1;_0x36b6a0[_0x14a6('0x38')]=getSmtpHost(_0x322ea6);_0x36b6a0['port']=0x24b;_0x36b6a0['secure']=![];_0x4307ee['service']=_0x36b6a0['service']=null;}else{if(_0x559456[_0x14a6('0x3a')]){_0x4307ee['user']=_0x36b6a0[_0x14a6('0x33')]=_0x559456[_0x14a6('0x3b')];_0x4307ee[_0x14a6('0x34')]=_0x36b6a0[_0x14a6('0x35')]=_0x559456[_0x14a6('0x34')];}else{_0x4307ee[_0x14a6('0x3a')]=_0x36b6a0[_0x14a6('0x3a')]=![];_0x4307ee[_0x14a6('0x33')]=_0x36b6a0[_0x14a6('0x33')]=null;_0x4307ee[_0x14a6('0x34')]=_0x36b6a0[_0x14a6('0x35')]=null;}_0x4307ee[_0x14a6('0x38')]=_0x559456[_0x14a6('0x3c')][_0x14a6('0x38')];_0x4307ee[_0x14a6('0x39')]=_0x559456[_0x14a6('0x3c')][_0x14a6('0x39')];_0x36b6a0[_0x14a6('0x38')]=_0x559456[_0x14a6('0x3d')][_0x14a6('0x38')];_0x36b6a0[_0x14a6('0x39')]=_0x559456[_0x14a6('0x3d')]['port'];}return{'Imap':_0x4307ee,'Smtp':_0x36b6a0};}exports['index']=function(_0x1f8910,_0x108b68){var _0x256fb8={'include':[{'model':db[_0x14a6('0x3e')],'as':_0x14a6('0x3c')},{'model':db[_0x14a6('0x3f')],'as':_0x14a6('0x3d')},{'model':db[_0x14a6('0x40')],'as':_0x14a6('0x41')}]},_0x243070={},_0x6c6027={'count':0x0,'rows':[]};var _0x341e0a=_[_0x14a6('0x42')](db['MailAccount'][_0x14a6('0x43')],function(_0x3a782d){return{'name':_0x3a782d['fieldName'],'type':_0x3a782d[_0x14a6('0x44')][_0x14a6('0x45')]};});_0x243070[_0x14a6('0x46')]=_[_0x14a6('0x42')](_0x341e0a,_0x14a6('0x27'));_0x243070[_0x14a6('0x47')]=_[_0x14a6('0x48')](_0x1f8910['query']);_0x243070[_0x14a6('0x49')]=_[_0x14a6('0x4a')](_0x243070[_0x14a6('0x46')],_0x243070[_0x14a6('0x47')]);_0x256fb8[_0x14a6('0x4b')]=_['intersection'](_0x243070[_0x14a6('0x46')],qs[_0x14a6('0x4c')](_0x1f8910[_0x14a6('0x47')][_0x14a6('0x4c')]));_0x256fb8[_0x14a6('0x4b')]=_0x256fb8[_0x14a6('0x4b')][_0x14a6('0x4d')]?_0x256fb8[_0x14a6('0x4b')]:_0x243070[_0x14a6('0x46')];if(!_0x1f8910[_0x14a6('0x47')][_0x14a6('0x4e')]('nolimit')){_0x256fb8[_0x14a6('0x1d')]=qs['limit'](_0x1f8910[_0x14a6('0x47')][_0x14a6('0x1d')]);_0x256fb8[_0x14a6('0x1f')]=qs[_0x14a6('0x1f')](_0x1f8910['query'][_0x14a6('0x1f')]);}_0x256fb8[_0x14a6('0x4f')]=qs['sort'](_0x1f8910[_0x14a6('0x47')][_0x14a6('0x50')]);_0x256fb8['where']=qs[_0x14a6('0x49')](_[_0x14a6('0x51')](_0x1f8910[_0x14a6('0x47')],_0x243070[_0x14a6('0x49')]),_0x341e0a);if(_0x1f8910[_0x14a6('0x47')]['filter']){_0x256fb8[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x256fb8[_0x14a6('0x52')],{'$or':_[_0x14a6('0x42')](_0x341e0a,function(_0x420b0b){if(_0x420b0b['type']!==_0x14a6('0x54')){var _0x11456b={};_0x11456b[_0x420b0b[_0x14a6('0x27')]]={'$like':'%'+_0x1f8910['query'][_0x14a6('0x55')]+'%'};return _0x11456b;}})});}_0x256fb8=_['merge']({},_0x256fb8,_0x1f8910[_0x14a6('0x56')]);var _0x45ed7f={'where':_0x256fb8[_0x14a6('0x52')]};return db[_0x14a6('0x57')][_0x14a6('0x1e')](_0x45ed7f)['then'](function(_0x4235f1){_0x6c6027[_0x14a6('0x1e')]=_0x4235f1;if(_0x1f8910['query'][_0x14a6('0x58')]){_0x256fb8['include']=[{'all':!![]}];}return db[_0x14a6('0x57')][_0x14a6('0x59')](_0x256fb8);})[_0x14a6('0x22')](function(_0x7c7ab4){_0x6c6027[_0x14a6('0x5a')]=_0x7c7ab4;return _0x6c6027;})[_0x14a6('0x22')](respondWithFilteredResult(_0x108b68,_0x256fb8))[_0x14a6('0x5b')](handleError(_0x108b68,null));};exports[_0x14a6('0x5c')]=function(_0x271a12,_0x358426){var _0x221ae7={'raw':![],'where':{'id':_0x271a12[_0x14a6('0x5d')]['id']},'include':[{'model':db[_0x14a6('0x3e')],'as':_0x14a6('0x3c')},{'model':db[_0x14a6('0x3f')],'as':'Smtp'},{'model':db[_0x14a6('0x40')],'as':_0x14a6('0x41')}]},_0x1796a5={};_0x1796a5[_0x14a6('0x46')]=_[_0x14a6('0x48')](db[_0x14a6('0x57')][_0x14a6('0x43')]);_0x1796a5[_0x14a6('0x47')]=_[_0x14a6('0x48')](_0x271a12[_0x14a6('0x47')]);_0x1796a5[_0x14a6('0x49')]=_[_0x14a6('0x4a')](_0x1796a5[_0x14a6('0x46')],_0x1796a5[_0x14a6('0x47')]);_0x221ae7[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x1796a5[_0x14a6('0x46')],qs[_0x14a6('0x4c')](_0x271a12[_0x14a6('0x47')]['fields']));_0x221ae7[_0x14a6('0x4b')]=_0x221ae7[_0x14a6('0x4b')][_0x14a6('0x4d')]?_0x221ae7[_0x14a6('0x4b')]:_0x1796a5['model'];if(_0x271a12[_0x14a6('0x47')][_0x14a6('0x58')]){_0x221ae7[_0x14a6('0x5e')]=[{'all':!![]}];}_0x221ae7=_[_0x14a6('0x53')]({},_0x221ae7,_0x271a12[_0x14a6('0x56')]);return db[_0x14a6('0x57')][_0x14a6('0x5f')](_0x221ae7)[_0x14a6('0x22')](handleEntityNotFound(_0x358426,null))['then'](respondWithResult(_0x358426,null))['catch'](handleError(_0x358426,null));};exports['update']=function(_0x4a7647,_0x22bdbe){if(_0x4a7647['body']['id']){delete _0x4a7647[_0x14a6('0x60')]['id'];}var _0x1ada92=_0x4a7647[_0x14a6('0x60')][_0x14a6('0x61')]===_0x14a6('0x62')?null:_0x4a7647[_0x14a6('0x60')][_0x14a6('0x61')];var _0x6de36a=_0x4a7647[_0x14a6('0x60')]['Imap']||{};var _0x53720e=_0x4a7647['body'][_0x14a6('0x3d')]||{};if(_0x1ada92){_0x6de36a[_0x14a6('0x38')]=getImapHost(_0x1ada92);_0x6de36a[_0x14a6('0x39')]=0x3e1;_0x53720e[_0x14a6('0x38')]=getSmtpHost(_0x1ada92);_0x53720e[_0x14a6('0x39')]=0x24b;_0x53720e[_0x14a6('0x63')]=![];}if(_0x53720e['modernAuthentication']){_0x53720e[_0x14a6('0x63')]=![];}else{_0x53720e[_0x14a6('0x37')]=null;}if(!_0x6de36a[_0x14a6('0x36')])_0x6de36a['CloudProviderId']=null;_0x4a7647[_0x14a6('0x60')]['Imap']=_0x6de36a;_0x4a7647[_0x14a6('0x60')][_0x14a6('0x3d')]=_0x53720e;return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x4a7647[_0x14a6('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x14a6('0x3c')},{'model':db[_0x14a6('0x3f')],'as':'Smtp'},{'model':db[_0x14a6('0x40')],'as':'mandatoryDispositionPause'}]})[_0x14a6('0x22')](handleEntityNotFound(_0x22bdbe,null))[_0x14a6('0x22')](function(_0x4b585d){if(!_0x4b585d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4b585d[_0x14a6('0x64')])delete _0x4a7647['body'][_0x14a6('0x3c')];return _0x4b585d;})['then'](saveUpdates(_0x4a7647[_0x14a6('0x60')],null))[_0x14a6('0x22')](function(_0x3bd1e0){if(!_0x4a7647[_0x14a6('0x60')][_0x14a6('0x3c')])return _0x3bd1e0;return db[_0x14a6('0x3e')][_0x14a6('0x65')](_0x4a7647[_0x14a6('0x60')]['Imap'],{'where':{'MailAccountId':_0x3bd1e0['id']}})[_0x14a6('0x22')](function(){return _0x3bd1e0;});})[_0x14a6('0x22')](function(_0x171e40){if(!_0x4a7647[_0x14a6('0x60')]['Smtp'])return _0x171e40;return db[_0x14a6('0x3f')][_0x14a6('0x65')](_0x4a7647[_0x14a6('0x60')][_0x14a6('0x3d')],{'where':{'MailAccountId':_0x171e40['id']}})[_0x14a6('0x22')](function(){return _0x171e40;});})[_0x14a6('0x22')](respondWithResult(_0x22bdbe,null))['catch'](handleError(_0x22bdbe,null));};exports['describe']=function(_0x133d97,_0x20db3e){return db[_0x14a6('0x57')][_0x14a6('0x66')]()[_0x14a6('0x22')](respondWithResult(_0x20db3e,null))[_0x14a6('0x5b')](handleError(_0x20db3e,null));};exports[_0x14a6('0x67')]=function(_0x5031c7,_0x3c4d68){if(_0x5031c7[_0x14a6('0x60')]['id']){delete _0x5031c7[_0x14a6('0x60')]['id'];}return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x5031c7[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x3c4d68,null))['then'](function(_0x43f455){if(_0x43f455){_0x5031c7[_0x14a6('0x60')][_0x14a6('0x68')]=_0x43f455['id'];return db[_0x14a6('0x69')][_0x14a6('0x6a')](_0x5031c7[_0x14a6('0x60')]);}})['then'](respondWithResult(_0x3c4d68,null))['catch'](handleError(_0x3c4d68,null));};exports[_0x14a6('0x6b')]=function(_0xb9bc88,_0x2ca2a6){var _0x31d9cf={'raw':![],'where':{}};var _0x2e766f={};var _0x5be088={'count':0x0,'rows':[]};return db['MailAccount'][_0x14a6('0x6c')]({'where':{'id':_0xb9bc88[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x2ca2a6,null))[_0x14a6('0x22')](function(_0x4af8e){if(_0x4af8e){_0x2e766f['model']=_[_0x14a6('0x48')](db[_0x14a6('0x69')][_0x14a6('0x43')]);_0x2e766f[_0x14a6('0x47')]=_['keys'](_0xb9bc88[_0x14a6('0x47')]);_0x2e766f[_0x14a6('0x49')]=_['intersection'](_0x2e766f[_0x14a6('0x46')],_0x2e766f['query']);_0x31d9cf[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x2e766f[_0x14a6('0x46')],qs['fields'](_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x4c')]));_0x31d9cf[_0x14a6('0x4b')]=_0x31d9cf[_0x14a6('0x4b')][_0x14a6('0x4d')]?_0x31d9cf[_0x14a6('0x4b')]:_0x2e766f[_0x14a6('0x46')];if(!_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x4e')](_0x14a6('0x6d'))){_0x31d9cf[_0x14a6('0x1d')]=qs[_0x14a6('0x1d')](_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x1d')]);_0x31d9cf['offset']=qs['offset'](_0xb9bc88['query']['offset']);}_0x31d9cf[_0x14a6('0x4f')]=qs[_0x14a6('0x50')](_0xb9bc88[_0x14a6('0x47')]['sort']);_0x31d9cf[_0x14a6('0x52')]=qs['filters'](_['pick'](_0xb9bc88[_0x14a6('0x47')],_0x2e766f['filters']));_0x31d9cf[_0x14a6('0x52')][_0x14a6('0x68')]=_0x4af8e['id'];if(_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x55')]){_0x31d9cf[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x31d9cf[_0x14a6('0x52')],{'$or':_['map'](_0x31d9cf['attributes'],function(_0x50c343){var _0x2083a8={};_0x2083a8[_0x50c343]={'$like':'%'+_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x55')]+'%'};return _0x2083a8;})});}_0x31d9cf=_[_0x14a6('0x53')]({},_0x31d9cf,_0xb9bc88[_0x14a6('0x56')]);return db[_0x14a6('0x69')][_0x14a6('0x1e')]({'where':_0x31d9cf['where']})[_0x14a6('0x22')](function(_0x42e6b4){_0x5be088[_0x14a6('0x1e')]=_0x42e6b4;if(_0xb9bc88[_0x14a6('0x47')][_0x14a6('0x58')]){_0x31d9cf[_0x14a6('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x14a6('0x59')](_0x31d9cf);})[_0x14a6('0x22')](function(_0x2c8a90){_0x5be088[_0x14a6('0x5a')]=_0x2c8a90;return _0x5be088;});}})[_0x14a6('0x22')](respondWithFilteredResult(_0x2ca2a6,_0x31d9cf))['catch'](handleError(_0x2ca2a6,null));};exports['removeDispositions']=function(_0x159565,_0x3e0936){return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x159565[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x3e0936,null))[_0x14a6('0x22')](function(_0x35595a){if(_0x35595a){return _0x35595a[_0x14a6('0x6e')](_0x159565['query'][_0x14a6('0x6f')]);}})[_0x14a6('0x22')](respondWithStatusCode(_0x3e0936,null))[_0x14a6('0x5b')](handleError(_0x3e0936,null));};exports[_0x14a6('0x70')]=function(_0x3b8e30,_0x1ca51){if(_0x3b8e30[_0x14a6('0x60')]['id']){delete _0x3b8e30[_0x14a6('0x60')]['id'];}return db[_0x14a6('0x57')]['find']({'where':{'id':_0x3b8e30[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x1ca51,null))['then'](function(_0x27bdb6){if(_0x27bdb6){_0x3b8e30[_0x14a6('0x60')][_0x14a6('0x68')]=_0x27bdb6['id'];return db[_0x14a6('0x71')][_0x14a6('0x6a')](_0x3b8e30['body']);}})['then'](respondWithResult(_0x1ca51,null))[_0x14a6('0x5b')](handleError(_0x1ca51,null));};exports[_0x14a6('0x72')]=function(_0x20a583,_0x60c080){var _0x31ed36={'raw':![],'where':{}};var _0x494a82={};var _0x9d0161={'count':0x0,'rows':[]};return db[_0x14a6('0x57')]['findOne']({'where':{'id':_0x20a583[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x60c080,null))[_0x14a6('0x22')](function(_0x12ccb1){if(_0x12ccb1){_0x494a82[_0x14a6('0x46')]=_[_0x14a6('0x48')](db['CannedAnswer'][_0x14a6('0x43')]);_0x494a82['query']=_['keys'](_0x20a583[_0x14a6('0x47')]);_0x494a82[_0x14a6('0x49')]=_[_0x14a6('0x4a')](_0x494a82['model'],_0x494a82['query']);_0x31ed36[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x494a82[_0x14a6('0x46')],qs['fields'](_0x20a583[_0x14a6('0x47')]['fields']));_0x31ed36[_0x14a6('0x4b')]=_0x31ed36['attributes'][_0x14a6('0x4d')]?_0x31ed36[_0x14a6('0x4b')]:_0x494a82[_0x14a6('0x46')];if(!_0x20a583['query'][_0x14a6('0x4e')]('nolimit')){_0x31ed36['limit']=qs[_0x14a6('0x1d')](_0x20a583[_0x14a6('0x47')][_0x14a6('0x1d')]);_0x31ed36[_0x14a6('0x1f')]=qs[_0x14a6('0x1f')](_0x20a583['query'][_0x14a6('0x1f')]);}_0x31ed36['order']=qs[_0x14a6('0x50')](_0x20a583[_0x14a6('0x47')]['sort']);_0x31ed36[_0x14a6('0x52')]=qs[_0x14a6('0x49')](_[_0x14a6('0x51')](_0x20a583[_0x14a6('0x47')],_0x494a82[_0x14a6('0x49')]));_0x31ed36[_0x14a6('0x52')]['MailAccountId']=_0x12ccb1['id'];if(_0x20a583[_0x14a6('0x47')]['filter']){_0x31ed36[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x31ed36[_0x14a6('0x52')],{'$or':_[_0x14a6('0x42')](_0x31ed36[_0x14a6('0x4b')],function(_0x4b86d8){var _0x452958={};_0x452958[_0x4b86d8]={'$like':'%'+_0x20a583['query']['filter']+'%'};return _0x452958;})});}_0x31ed36=_[_0x14a6('0x53')]({},_0x31ed36,_0x20a583[_0x14a6('0x56')]);return db['CannedAnswer'][_0x14a6('0x1e')]({'where':_0x31ed36[_0x14a6('0x52')]})[_0x14a6('0x22')](function(_0x293f8d){_0x9d0161[_0x14a6('0x1e')]=_0x293f8d;if(_0x20a583[_0x14a6('0x47')][_0x14a6('0x58')]){_0x31ed36[_0x14a6('0x5e')]=[{'all':!![]}];}return db[_0x14a6('0x71')][_0x14a6('0x59')](_0x31ed36);})['then'](function(_0x47c8e8){_0x9d0161[_0x14a6('0x5a')]=_0x47c8e8;return _0x9d0161;});}})[_0x14a6('0x22')](respondWithFilteredResult(_0x60c080,_0x31ed36))[_0x14a6('0x5b')](handleError(_0x60c080,null));};exports[_0x14a6('0x73')]=function(_0x250e9b,_0x33008e){return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x250e9b['params']['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x33008e,null))[_0x14a6('0x22')](function(_0x1d9934){if(_0x1d9934){return _0x1d9934[_0x14a6('0x73')](_0x250e9b[_0x14a6('0x47')]['ids']);}})[_0x14a6('0x22')](respondWithStatusCode(_0x33008e,null))[_0x14a6('0x5b')](handleError(_0x33008e,null));};exports['create']=function(_0x3b6413,_0x223ee5){var _0x368313={'name':_0x3b6413[_0x14a6('0x60')][_0x14a6('0x27')],'key':_0x3b6413[_0x14a6('0x60')][_0x14a6('0x45')],'provider':_0x3b6413['body'][_0x14a6('0x61')]===_0x14a6('0x62')?null:_0x3b6413['body']['provider'],'email':_0x3b6413[_0x14a6('0x60')][_0x14a6('0x74')],'ListId':_0x3b6413[_0x14a6('0x60')][_0x14a6('0x75')],'active':!_[_0x14a6('0x76')](_0x3b6413['body'][_0x14a6('0x77')])?_0x3b6413['body'][_0x14a6('0x77')]:!![],'description':_0x3b6413[_0x14a6('0x60')][_0x14a6('0x78')]||null};var _0x9ce52a=getAuthenticationOptions(_0x368313['provider'],_0x3b6413[_0x14a6('0x60')]);_0x368313['Imap']=_0x9ce52a['Imap'];_0x368313[_0x14a6('0x3d')]=_0x9ce52a[_0x14a6('0x3d')];return db[_0x14a6('0x57')][_0x14a6('0x6a')](_0x368313,{'include':[{'model':db[_0x14a6('0x3f')],'as':_0x14a6('0x3d')},{'model':db[_0x14a6('0x3e')],'as':_0x14a6('0x3c')}]})[_0x14a6('0x22')](function(_0x53bc17){var _0x36640c=_0x3b6413[_0x14a6('0x33')][_0x14a6('0x24')]({'plain':!![]});if(!_0x36640c)throw new Error(_0x14a6('0x79'));if(_0x36640c[_0x14a6('0x7a')]===_0x14a6('0x33')){var _0x5d778c=_0x53bc17[_0x14a6('0x24')]({'plain':!![]});return db[_0x14a6('0x7b')][_0x14a6('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x36640c['userProfileId']},'raw':!![]})['then'](function(_0x15b051){if(_0x15b051&&_0x15b051['autoAssociation']===0x0){return db[_0x14a6('0x26')][_0x14a6('0x6a')]({'name':_0x5d778c[_0x14a6('0x27')],'resourceId':_0x5d778c['id'],'type':_0x15b051[_0x14a6('0x27')],'sectionId':_0x15b051['id']},{})[_0x14a6('0x22')](function(){return _0x53bc17;});}else{return _0x53bc17;}})[_0x14a6('0x5b')](function(_0xf8ea9a){logger['error'](_0x14a6('0x7c'),_0xf8ea9a);throw _0xf8ea9a;});}return _0x53bc17;})[_0x14a6('0x22')](respondWithResult(_0x223ee5,0xc9))['catch'](handleError(_0x223ee5,null));};exports[_0x14a6('0x7d')]=function(_0x27228d,_0x1af5f0){return db['MailAccount'][_0x14a6('0x6c')]({'where':{'id':_0x27228d[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x1af5f0,null))['then'](function(_0x2801ca){if(_0x2801ca){return _0x2801ca[_0x14a6('0x7d')]();}return null;})['then'](respondWithResult(_0x1af5f0,null))[_0x14a6('0x5b')](handleError(_0x1af5f0,null));};exports[_0x14a6('0x7e')]=function(_0x2fdef1,_0x2df51a){if(_0x2fdef1[_0x14a6('0x60')]['id']){delete _0x2fdef1[_0x14a6('0x60')]['id'];}return db[_0x14a6('0x57')]['find']({'where':{'id':_0x2fdef1['params']['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x2df51a,null))[_0x14a6('0x22')](function(_0x5cc63d){if(_0x5cc63d){_0x2fdef1[_0x14a6('0x60')][_0x14a6('0x68')]=_0x5cc63d['id'];return db[_0x14a6('0x3e')][_0x14a6('0x6a')](_0x2fdef1[_0x14a6('0x60')]);}})[_0x14a6('0x22')](respondWithResult(_0x2df51a,null))[_0x14a6('0x5b')](handleError(_0x2df51a,null));};exports[_0x14a6('0x7f')]=function(_0x255c95,_0x1a80b7){return db[_0x14a6('0x57')]['findOne']({'where':{'id':_0x255c95[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x1a80b7,null))[_0x14a6('0x22')](function(_0x352709){if(_0x352709){return _0x352709['setImap'](null);}return null;})[_0x14a6('0x22')](respondWithStatusCode(_0x1a80b7,null))[_0x14a6('0x5b')](handleError(_0x1a80b7,null));};exports[_0x14a6('0x80')]=function(_0x4ecb73,_0x111a71){return db[_0x14a6('0x57')][_0x14a6('0x6c')]({'where':{'id':_0x4ecb73[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x111a71,null))[_0x14a6('0x22')](function(_0xeae483){if(_0xeae483){return _0xeae483['getSmtp']();}return null;})[_0x14a6('0x22')](respondWithResult(_0x111a71,null))['catch'](handleError(_0x111a71,null));};exports['addSmtp']=function(_0x446424,_0x5c50b7){if(_0x446424['body']['id']){delete _0x446424[_0x14a6('0x60')]['id'];}return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x446424[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x5c50b7,null))['then'](function(_0x121232){if(_0x121232){_0x446424[_0x14a6('0x60')]['MailAccountId']=_0x121232['id'];return db[_0x14a6('0x3f')][_0x14a6('0x6a')](_0x446424[_0x14a6('0x60')]);}})[_0x14a6('0x22')](respondWithResult(_0x5c50b7,null))[_0x14a6('0x5b')](handleError(_0x5c50b7,null));};exports[_0x14a6('0x81')]=function(_0x37444f,_0x17e2b1){return db[_0x14a6('0x57')][_0x14a6('0x6c')]({'where':{'id':_0x37444f[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x17e2b1,null))[_0x14a6('0x22')](function(_0x5c07c7){if(_0x5c07c7){return _0x5c07c7[_0x14a6('0x82')](null);}return null;})[_0x14a6('0x22')](respondWithStatusCode(_0x17e2b1,null))[_0x14a6('0x5b')](handleError(_0x17e2b1,null));};exports[_0x14a6('0x83')]=function(_0x1e8866,_0x126f44){return db['MailInteraction'][_0x14a6('0x5f')]({'where':{'id':_0x1e8866[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x126f44,null))[_0x14a6('0x22')](function(_0x24baab){if(_0x24baab){return _0x24baab[_0x14a6('0x83')](_0x1e8866[_0x14a6('0x60')][_0x14a6('0x6f')],_['omit'](_0x1e8866[_0x14a6('0x60')],[_0x14a6('0x6f'),'id'])||{});}})[_0x14a6('0x22')](respondWithResult(_0x126f44,null))[_0x14a6('0x5b')](handleError(_0x126f44,null));};exports[_0x14a6('0x84')]=function(_0x594f88,_0x1f8cb8){var _0x3614ba={'raw':![],'where':{}};var _0x4d8029={};var _0xa32bd={'count':0x0,'rows':[]};return db[_0x14a6('0x57')]['findOne']({'where':{'id':_0x594f88[_0x14a6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1f8cb8,null))[_0x14a6('0x22')](function(_0xadbe22){if(_0xadbe22){_0x4d8029[_0x14a6('0x46')]=_[_0x14a6('0x48')](db['MailInteraction']['rawAttributes']);_0x4d8029[_0x14a6('0x47')]=_['keys'](_0x594f88[_0x14a6('0x47')]);_0x4d8029['filters']=_[_0x14a6('0x4a')](_0x4d8029[_0x14a6('0x46')],_0x4d8029[_0x14a6('0x47')]);_0x3614ba[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x4d8029[_0x14a6('0x46')],qs[_0x14a6('0x4c')](_0x594f88['query'][_0x14a6('0x4c')]));_0x3614ba[_0x14a6('0x4b')]=_0x3614ba['attributes'][_0x14a6('0x4d')]?_0x3614ba[_0x14a6('0x4b')]:_0x4d8029[_0x14a6('0x46')];if(!_0x594f88['query'][_0x14a6('0x4e')](_0x14a6('0x6d'))){_0x3614ba['limit']=qs[_0x14a6('0x1d')](_0x594f88[_0x14a6('0x47')][_0x14a6('0x1d')]);_0x3614ba[_0x14a6('0x1f')]=qs['offset'](_0x594f88[_0x14a6('0x47')][_0x14a6('0x1f')]);}_0x3614ba[_0x14a6('0x4f')]=qs['sort'](_0x594f88[_0x14a6('0x47')]['sort']);_0x3614ba[_0x14a6('0x52')]=qs[_0x14a6('0x49')](_[_0x14a6('0x51')](_0x594f88[_0x14a6('0x47')],_0x4d8029[_0x14a6('0x49')]));_0x3614ba[_0x14a6('0x52')][_0x14a6('0x68')]=_0xadbe22['id'];if(_0x594f88['query']['filter']){_0x3614ba['where']=_[_0x14a6('0x53')](_0x3614ba['where'],{'$or':_[_0x14a6('0x42')](_0x3614ba[_0x14a6('0x4b')],function(_0x135925){var _0x1890a9={};_0x1890a9[_0x135925]={'$like':'%'+_0x594f88['query'][_0x14a6('0x55')]+'%'};return _0x1890a9;})});}_0x3614ba=_['merge']({},_0x3614ba,_0x594f88[_0x14a6('0x56')]);return db[_0x14a6('0x85')]['count']({'where':_0x3614ba[_0x14a6('0x52')]})[_0x14a6('0x22')](function(_0x47e8e5){_0xa32bd['count']=_0x47e8e5;if(_0x594f88['query'][_0x14a6('0x58')]){_0x3614ba[_0x14a6('0x5e')]=[{'model':db[_0x14a6('0x86')],'as':_0x14a6('0x87'),'required':![]},{'model':db['User'],'as':_0x14a6('0x88'),'attributes':[_0x14a6('0x27'),_0x14a6('0x89'),_0x14a6('0x8a')],'required':![]},{'model':db[_0x14a6('0x8b')],'as':_0x14a6('0x8c'),'attributes':['id',_0x14a6('0x27'),'color'],'where':_0x594f88[_0x14a6('0x47')][_0x14a6('0x8d')]?{'id':_0x594f88['query'][_0x14a6('0x8d')]}:undefined,'required':_0x594f88[_0x14a6('0x47')][_0x14a6('0x8d')]?!![]:![]}];}return db[_0x14a6('0x85')][_0x14a6('0x59')](_0x3614ba);})[_0x14a6('0x22')](function(_0x1c98a1){_0xa32bd['rows']=_0x1c98a1;return _0xa32bd;});}})['then'](respondWithFilteredResult(_0x1f8cb8,_0x3614ba))['catch'](handleError(_0x1f8cb8,null));};exports['addApplications']=function addApplications(_0x4cb3bc,_0x28c408){var _0x3462c5=_0x4cb3bc[_0x14a6('0x5d')]['id'];var _0x4769f2=_0x4cb3bc[_0x14a6('0x60')];var _0x570efa=0xc8;var _0x1dd17d=null;return db[_0x14a6('0x8e')][_0x14a6('0x8f')]({'isolationLevel':db[_0x14a6('0x8e')]['Transaction']['ISOLATION_LEVELS'][_0x14a6('0x90')]},function(_0x21822c){return db['MailAccount'][_0x14a6('0x6c')]({'where':{'id':_0x3462c5},'transaction':_0x21822c})['then'](function(_0x2f6c94){if(_0x2f6c94){return db['MailApplication'][_0x14a6('0x23')]({'where':{'MailAccountId':_0x3462c5},'transaction':_0x21822c})[_0x14a6('0x22')](function(){var _0x52586a=_[_0x14a6('0x42')](_0x4769f2,function(_0x22cf6b){_0x22cf6b['MailAccountId']=_0x3462c5;return _0x22cf6b;});return db[_0x14a6('0x91')]['bulkCreate'](_0x52586a,{'transaction':_0x21822c});});}else{_0x570efa=0x194;_0x1dd17d=[];}});})[_0x14a6('0x22')](function(){if(_0x570efa!==0x194){return db[_0x14a6('0x91')][_0x14a6('0x92')]({'where':{'MailAccountId':_0x3462c5},'order':_0x14a6('0x93')})[_0x14a6('0x22')](function(_0x3aa65a){_0x1dd17d=_0x3aa65a;});}})[_0x14a6('0x5b')](function(_0x4bbdc4){_0x570efa=0x1f4;logger['error'](_0x4bbdc4[_0x14a6('0x94')]);if(_0x4bbdc4[_0x14a6('0x27')]){delete _0x4bbdc4[_0x14a6('0x27')];}_0x1dd17d=_0x4bbdc4;})['finally'](function(){if(_0x1dd17d===null){_0x28c408[_0x14a6('0x18')](_0x570efa);}else{if(_0x570efa===0x1f4){_0x28c408[_0x14a6('0x19')](_0x570efa)[_0x14a6('0x28')](_0x1dd17d);}else{_0x28c408[_0x14a6('0x19')](_0x570efa)[_0x14a6('0x1b')](_0x1dd17d);}}});};exports['getApplications']=function(_0xb591a5,_0x1c60d7){var _0x5c1423={};var _0x4c91da={};var _0x2284a8;var _0x38e99b;return db[_0x14a6('0x57')][_0x14a6('0x6c')]({'where':{'id':_0xb591a5[_0x14a6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c60d7,null))['then'](function(_0x2c8d48){if(_0x2c8d48){_0x2284a8=_0x2c8d48;_0x4c91da[_0x14a6('0x46')]=_[_0x14a6('0x48')](db[_0x14a6('0x91')]['rawAttributes']);_0x4c91da[_0x14a6('0x47')]=_[_0x14a6('0x48')](_0xb591a5[_0x14a6('0x47')]);_0x4c91da[_0x14a6('0x49')]=_[_0x14a6('0x4a')](_0x4c91da['model'],_0x4c91da[_0x14a6('0x47')]);_0x5c1423[_0x14a6('0x4b')]=_['intersection'](_0x4c91da[_0x14a6('0x46')],qs[_0x14a6('0x4c')](_0xb591a5[_0x14a6('0x47')]['fields']));_0x5c1423[_0x14a6('0x4b')]=_0x5c1423[_0x14a6('0x4b')][_0x14a6('0x4d')]?_0x5c1423['attributes']:_0x4c91da[_0x14a6('0x46')];_0x5c1423['order']=qs[_0x14a6('0x50')](_0xb591a5[_0x14a6('0x47')][_0x14a6('0x50')]);_0x5c1423[_0x14a6('0x52')]=qs['filters'](_['pick'](_0xb591a5[_0x14a6('0x47')],_0x4c91da[_0x14a6('0x49')]));if(_0xb591a5[_0x14a6('0x47')]['filter']){_0x5c1423[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x5c1423[_0x14a6('0x52')],{'$or':_[_0x14a6('0x42')](_0x5c1423['attributes'],function(_0x4aa67c){var _0x12d9c7={};_0x12d9c7[_0x4aa67c]={'$like':'%'+_0xb591a5[_0x14a6('0x47')]['filter']+'%'};return _0x12d9c7;})});}_0x5c1423=_[_0x14a6('0x53')]({},_0x5c1423,_0xb591a5['options']);return _0x2284a8['getApplications'](_0x5c1423);}})[_0x14a6('0x22')](function(_0x5870ac){if(_0x5870ac){_0x38e99b=_0x5870ac[_0x14a6('0x4d')];if(!_0xb591a5[_0x14a6('0x47')][_0x14a6('0x4e')](_0x14a6('0x6d'))){_0x5c1423[_0x14a6('0x1d')]=qs['limit'](_0xb591a5['query'][_0x14a6('0x1d')]);_0x5c1423[_0x14a6('0x1f')]=qs[_0x14a6('0x1f')](_0xb591a5['query'][_0x14a6('0x1f')]);}return _0x2284a8[_0x14a6('0x95')](_0x5c1423);}})[_0x14a6('0x22')](function(_0x35e2c2){if(_0x35e2c2){return _0x35e2c2?{'count':_0x38e99b,'rows':_0x35e2c2}:null;}})[_0x14a6('0x22')](respondWithResult(_0x1c60d7,null))['catch'](handleError(_0x1c60d7,null));};exports[_0x14a6('0x96')]=function(_0x5a6d66,_0x5038a8){var _0x5dac94={'raw':!![],'where':{}};var _0x589e94={};var _0x4bf317={'count':0x0,'rows':[]};return db['MailAccount'][_0x14a6('0x6c')]({'where':{'id':_0x5a6d66[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x5038a8,null))['then'](function(_0xe52278){if(_0xe52278){_0x589e94[_0x14a6('0x46')]=_[_0x14a6('0x48')](db[_0x14a6('0x97')][_0x14a6('0x43')]);_0x589e94['query']=_[_0x14a6('0x48')](_0x5a6d66[_0x14a6('0x47')]);_0x589e94[_0x14a6('0x49')]=_['intersection'](_0x589e94[_0x14a6('0x46')],_0x589e94[_0x14a6('0x47')]);_0x5dac94[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x589e94[_0x14a6('0x46')],qs['fields'](_0x5a6d66['query']['fields']));_0x5dac94[_0x14a6('0x4b')]=_0x5dac94[_0x14a6('0x4b')][_0x14a6('0x4d')]?_0x5dac94['attributes']:_0x589e94[_0x14a6('0x46')];if(!_0x5a6d66[_0x14a6('0x47')]['hasOwnProperty']('nolimit')){_0x5dac94[_0x14a6('0x1d')]=qs[_0x14a6('0x1d')](_0x5a6d66['query']['limit']);_0x5dac94[_0x14a6('0x1f')]=qs['offset'](_0x5a6d66['query'][_0x14a6('0x1f')]);}_0x5dac94['order']=qs[_0x14a6('0x50')](_0x5a6d66[_0x14a6('0x47')][_0x14a6('0x50')]);_0x5dac94['where']=qs[_0x14a6('0x49')](_['pick'](_0x5a6d66[_0x14a6('0x47')],_0x589e94[_0x14a6('0x49')]));_0x5dac94[_0x14a6('0x52')]['MailAccountId']=_0xe52278['id'];if(_0x5a6d66['query'][_0x14a6('0x55')]){_0x5dac94[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x5dac94['where'],{'$or':_[_0x14a6('0x42')](_0x5dac94[_0x14a6('0x4b')],function(_0x305b53){var _0x411fd7={};_0x411fd7[_0x305b53]={'$like':'%'+_0x5a6d66[_0x14a6('0x47')][_0x14a6('0x55')]+'%'};return _0x411fd7;})});}if(_0x5a6d66[_0x14a6('0x47')][_0x14a6('0x98')]){var _0x2569f0=_0x5a6d66[_0x14a6('0x47')]['$gte'][_0x14a6('0x99')](',');var _0x384f47={};_0x384f47[_0x2569f0[0x0]]={'$gte':moment(_0x2569f0[0x1])['format'](_0x14a6('0x9a'))};_0x5dac94[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0x5dac94[_0x14a6('0x52')],_0x384f47);}_0x5dac94=_[_0x14a6('0x53')]({},_0x5dac94,_0x5a6d66['options']);return db['MailMessage'][_0x14a6('0x1e')]({'where':_0x5dac94[_0x14a6('0x52')]})[_0x14a6('0x22')](function(_0x50a53d){_0x4bf317[_0x14a6('0x1e')]=_0x50a53d;if(_0x5a6d66[_0x14a6('0x47')][_0x14a6('0x58')]){_0x5dac94['include']=[{'all':!![]}];}return db[_0x14a6('0x97')][_0x14a6('0x59')](_0x5dac94);})[_0x14a6('0x22')](function(_0x5d03b3){if(_0x5a6d66[_0x14a6('0x47')][_0x14a6('0x9b')]===_0x14a6('0x9c')){for(var _0x4b76f1=0x0;_0x4b76f1<_0x5d03b3[_0x14a6('0x4d')];_0x4b76f1++){_0x5d03b3[_0x4b76f1][_0x14a6('0x60')]=juice(_0x5d03b3[_0x4b76f1][_0x14a6('0x60')]);}}_0x4bf317['rows']=_0x5d03b3;return _0x4bf317;});}})['then'](respondWithFilteredResult(_0x5038a8,_0x5dac94))['catch'](handleError(_0x5038a8,null));};exports[_0x14a6('0x28')]=function(_0x282369,_0x27d6dd){var _0x49f54a,_0xca686d={},_0x5e5bf7;if(_0x282369[_0x14a6('0x60')]['to']){_0x5e5bf7=_0x282369[_0x14a6('0x60')]['to'][_0x14a6('0x99')](',')[0x0];}return db[_0x14a6('0x57')]['find']({'where':{'id':_0x282369[_0x14a6('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x14a6('0x9d'),'where':{'email':_0x5e5bf7},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x14a6('0x3d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x14a6('0x22')](handleEntityNotFound(_0x27d6dd,null))[_0x14a6('0x22')](function(_0x154ec5){if(!_0x154ec5)return;_0x49f54a=_0x154ec5;if(!_0x154ec5[_0x14a6('0x3d')])throw new Error(_0x14a6('0x9e'));if(_[_0x14a6('0x76')](_0x282369['body'][_0x14a6('0x9f')])){_0x282369['body'][_0x14a6('0x9f')]=util['format']('%s\x20<%s>',_0x154ec5[_0x14a6('0x27')],_0x154ec5['email']||_0x154ec5[_0x14a6('0x3d')]['user']);}if(_0x282369[_0x14a6('0x60')][_0x14a6('0xa0')]&&_0x282369[_0x14a6('0x60')][_0x14a6('0xa0')][_0x14a6('0x4d')]){for(var _0xc10308=0x0;_0xc10308<_0x282369[_0x14a6('0x60')][_0x14a6('0xa0')]['length'];_0xc10308+=0x1){_0x282369[_0x14a6('0x60')][_0x14a6('0xa0')][_0xc10308]={'filename':_0x282369['body'][_0x14a6('0xa0')][_0xc10308][_0x14a6('0x27')],'path':path[_0x14a6('0xa1')](config[_0x14a6('0xa2')],'server/files/attachments',_0x282369[_0x14a6('0x60')][_0x14a6('0xa0')][_0xc10308][_0x14a6('0xa3')])};}}var _0x2670bb=_0x154ec5[_0x14a6('0xa4')]();return respondWithRpcPromise(_0x14a6('0xa5'),_0x14a6('0xa6'),{'account':_0x2670bb,'message':_0x282369[_0x14a6('0x60')]});})[_0x14a6('0x22')](function(_0x19da16){if(!_0x19da16)return;_0xca686d=_0x19da16;if(!_0x49f54a[_0x14a6('0xa7')])throw new Error(_0x14a6('0xa8'));if(_0x49f54a[_0x14a6('0xa7')][_0x14a6('0x9d')]['length'])return _0x49f54a[_0x14a6('0xa7')]['Contacts'][0x0];return db[_0x14a6('0x86')][_0x14a6('0x6a')](_[_0x14a6('0x6')](_0x282369[_0x14a6('0x60')],{'firstName':_0x282369[_0x14a6('0x60')]['to'],'email':_0x282369[_0x14a6('0x60')]['to'],'phone':_0x282369['body']['to'],'ListId':_0x49f54a[_0x14a6('0x75')]}));})[_0x14a6('0x22')](function(_0xaa6767){if(!_0xaa6767)return;var _0x3b31a9={'UserId':_0x282369['user']['id'],'ContactId':_0xaa6767['id'],'MailAccountId':_0x49f54a['id'],'inReplyTo':_0xca686d[_0x14a6('0xa9')],'to':_0x282369[_0x14a6('0x60')][_0x14a6('0x9f')],'cc':_0x282369[_0x14a6('0x60')]['cc'],'subject':_0x282369[_0x14a6('0x60')][_0x14a6('0xaa')],'attach':_0x282369[_0x14a6('0x60')][_0x14a6('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x14a6('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x14a6('0xad'),'Messages':[_[_0x14a6('0x53')](_0x282369['body'],{'messageId':_0xca686d[_0x14a6('0xa9')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x49f54a['id'],'UserId':_0x282369[_0x14a6('0x33')]['id'],'ContactId':_0xaa6767['id']})]};if(_0x282369[_0x14a6('0x60')][_0x14a6('0xae')]){_0x3b31a9=_[_0x14a6('0x53')](_0x3b31a9,_0x282369['body'][_0x14a6('0xae')]);}return db[_0x14a6('0x85')][_0x14a6('0x6a')](_0x3b31a9,{'include':[{'model':db[_0x14a6('0x97')],'as':_0x14a6('0xaf')}]});})[_0x14a6('0x22')](respondWithResult(_0x27d6dd,null))[_0x14a6('0x5b')](handleError(_0x27d6dd,null));};exports[_0x14a6('0xb0')]=function(_0x500e59,_0x259d03){return db['MailAccount'][_0x14a6('0x5f')]({'where':{'id':_0x500e59['params']['id']},'include':[{'model':db[_0x14a6('0x3f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x14a6('0xb1')],'as':_0x14a6('0xb1'),'raw':!![]}]}]})[_0x14a6('0x22')](handleEntityNotFound(_0x259d03,null))[_0x14a6('0x22')](function(_0x30c124){if(!_0x30c124[_0x14a6('0x3d')])return;var _0x3c3c60=_0x30c124['getSmtpOptions']();return respondWithRpcPromise(_0x14a6('0xb2'),_0x14a6('0xb0'),{'account':_0x3c3c60});})['then'](respondWithResult(_0x259d03,null))['catch'](handleError(_0x259d03,null));};exports['destroy']=function(_0x209dcb,_0x311d17){return db[_0x14a6('0x57')]['find']({'where':{'id':_0x209dcb[_0x14a6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x311d17,null))[_0x14a6('0x22')](function(_0x349ae8){if(_0x349ae8&&_0x349ae8[_0x14a6('0x64')]){throw new db[(_0x14a6('0xb3'))]['ValidationError'](_0x14a6('0xb4'));}return _0x349ae8;})[_0x14a6('0x22')](removeEntity(_0x311d17,null))[_0x14a6('0x5b')](handleError(_0x311d17,null));};exports[_0x14a6('0xb5')]=function(_0x108ae8,_0x27d6ee){return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x108ae8[_0x14a6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x27d6ee,null))[_0x14a6('0x22')](function(_0x55710c){if(_0x55710c){return _0x55710c[_0x14a6('0xb5')](_0x108ae8[_0x14a6('0x60')][_0x14a6('0x6f')],_[_0x14a6('0xb6')](_0x108ae8[_0x14a6('0x60')],[_0x14a6('0x6f'),'id'])||{})[_0x14a6('0xb7')](function(_0x35bb46){for(var _0x2a0337=0x0;_0x2a0337<_0x108ae8['body'][_0x14a6('0x6f')][_0x14a6('0x4d')];_0x2a0337+=0x1){socket['emit'](_0x14a6('0xb8'),{'UserId':Number(_0x108ae8[_0x14a6('0x60')][_0x14a6('0x6f')][_0x2a0337]),'MailAccountId':Number(_0x108ae8[_0x14a6('0x5d')]['id'])});}return _0x35bb46;});}})[_0x14a6('0x22')](respondWithResult(_0x27d6ee,null))[_0x14a6('0x5b')](handleError(_0x27d6ee,null));};exports['removeAgents']=function(_0x1d250b,_0xdaa81f){return db[_0x14a6('0x57')][_0x14a6('0x5f')]({'where':{'id':_0x1d250b[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0xdaa81f,null))[_0x14a6('0x22')](function(_0xd154b9){if(_0xd154b9){return _0xd154b9[_0x14a6('0xb9')](_0x1d250b[_0x14a6('0x47')][_0x14a6('0x6f')])['then'](function(){if(_[_0x14a6('0xba')](_0x1d250b[_0x14a6('0x47')][_0x14a6('0x6f')])){for(var _0x160558=0x0;_0x160558<_0x1d250b[_0x14a6('0x47')][_0x14a6('0x6f')][_0x14a6('0x4d')];_0x160558+=0x1){socket[_0x14a6('0xbb')](_0x14a6('0xbc'),{'UserId':Number(_0x1d250b[_0x14a6('0x47')][_0x14a6('0x6f')][_0x160558]),'MailAccountId':Number(_0x1d250b['params']['id'])});}}else{socket[_0x14a6('0xbb')](_0x14a6('0xbc'),{'UserId':Number(_0x1d250b[_0x14a6('0x47')]['ids']),'MailAccountId':Number(_0x1d250b[_0x14a6('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0xdaa81f,null))[_0x14a6('0x5b')](handleError(_0xdaa81f,null));};exports[_0x14a6('0xbd')]=function(_0x22546f,_0x1f2d8c){var _0xf9cff6={};var _0x3dc4b3={};var _0x4f6511;var _0x5b8cfb;return db[_0x14a6('0x57')]['findOne']({'where':{'id':_0x22546f[_0x14a6('0x5d')]['id']}})[_0x14a6('0x22')](handleEntityNotFound(_0x1f2d8c,null))['then'](function(_0x3263d7){if(_0x3263d7){_0x4f6511=_0x3263d7;_0x3dc4b3[_0x14a6('0x46')]=_[_0x14a6('0x48')](db[_0x14a6('0xbe')][_0x14a6('0x43')]);_0x3dc4b3[_0x14a6('0x47')]=_[_0x14a6('0x48')](_0x22546f[_0x14a6('0x47')]);_0x3dc4b3[_0x14a6('0x49')]=_[_0x14a6('0x4a')](_0x3dc4b3[_0x14a6('0x46')],_0x3dc4b3[_0x14a6('0x47')]);_0xf9cff6[_0x14a6('0x4b')]=_[_0x14a6('0x4a')](_0x3dc4b3[_0x14a6('0x46')],qs[_0x14a6('0x4c')](_0x22546f[_0x14a6('0x47')][_0x14a6('0x4c')]));_0xf9cff6[_0x14a6('0x4b')]=_0xf9cff6[_0x14a6('0x4b')]['length']?_0xf9cff6[_0x14a6('0x4b')]:_0x3dc4b3['model'];_0xf9cff6[_0x14a6('0x4f')]=qs[_0x14a6('0x50')](_0x22546f[_0x14a6('0x47')][_0x14a6('0x50')]);_0xf9cff6['where']=qs[_0x14a6('0x49')](_[_0x14a6('0x51')](_0x22546f[_0x14a6('0x47')],_0x3dc4b3[_0x14a6('0x49')]));if(_0x22546f[_0x14a6('0x47')][_0x14a6('0x55')]){_0xf9cff6[_0x14a6('0x52')]=_[_0x14a6('0x53')](_0xf9cff6[_0x14a6('0x52')],{'$or':_[_0x14a6('0x42')](_0xf9cff6['attributes'],function(_0x4fee17){var _0x4bf768={};_0x4bf768[_0x4fee17]={'$like':'%'+_0x22546f['query'][_0x14a6('0x55')]+'%'};return _0x4bf768;})});}_0xf9cff6=_[_0x14a6('0x53')]({},_0xf9cff6,_0x22546f['options']);return _0x4f6511[_0x14a6('0xbd')](_0xf9cff6);}})[_0x14a6('0x22')](function(_0x5214ef){if(_0x5214ef){_0x5b8cfb=_0x5214ef[_0x14a6('0x4d')];if(!_0x22546f[_0x14a6('0x47')][_0x14a6('0x4e')](_0x14a6('0x6d'))){_0xf9cff6[_0x14a6('0x1d')]=qs[_0x14a6('0x1d')](_0x22546f[_0x14a6('0x47')][_0x14a6('0x1d')]);_0xf9cff6[_0x14a6('0x1f')]=qs['offset'](_0x22546f[_0x14a6('0x47')]['offset']);}return _0x4f6511[_0x14a6('0xbd')](_0xf9cff6);}})[_0x14a6('0x22')](function(_0xc9c520){if(_0xc9c520){return _0xc9c520?{'count':_0x5b8cfb,'rows':_0xc9c520}:null;}})['then'](respondWithResult(_0x1f2d8c,null))[_0x14a6('0x5b')](handleError(_0x1f2d8c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b0d4cab..5b2367e 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 _0x0eb2=['update','remove','emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners','save'];(function(_0x227ebe,_0x5e2c09){var _0x40aad2=function(_0x22756e){while(--_0x22756e){_0x227ebe['push'](_0x227ebe['shift']());}};_0x40aad2(++_0x5e2c09);}(_0x0eb2,0x11c));var _0x20eb=function(_0x56407a,_0x51ab09){_0x56407a=_0x56407a-0x0;var _0x2e7c2e=_0x0eb2[_0x56407a];return _0x2e7c2e;};'use strict';var EventEmitter=require(_0x20eb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x20eb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x20eb('0x2')](0x0);var events={'afterCreate':_0x20eb('0x3'),'afterUpdate':_0x20eb('0x4'),'afterDestroy':_0x20eb('0x5')};function emitEvent(_0x525ecf){return function(_0x118292,_0x59e891,_0x48d831){MailAccountEvents['emit'](_0x525ecf+':'+_0x118292['id'],_0x118292);MailAccountEvents[_0x20eb('0x6')](_0x525ecf,_0x118292);_0x48d831(null);};}for(var e in events){if(events[_0x20eb('0x7')](e)){var event=events[e];MailAccount[_0x20eb('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xd4f4=['setMaxListeners','save','emit','hook','events'];(function(_0x2c79a0,_0x167c84){var _0x10ae49=function(_0x988a9c){while(--_0x988a9c){_0x2c79a0['push'](_0x2c79a0['shift']());}};_0x10ae49(++_0x167c84);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x222e5c,_0x13957c){_0x222e5c=_0x222e5c-0x0;var _0x1440cd=_0xd4f4[_0x222e5c];return _0x1440cd;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4d4f('0x1')](0x0);var events={'afterCreate':_0x4d4f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x160665){return function(_0x48e54e,_0x49f0ac,_0x41e226){MailAccountEvents[_0x4d4f('0x3')](_0x160665+':'+_0x48e54e['id'],_0x48e54e);MailAccountEvents[_0x4d4f('0x3')](_0x160665,_0x48e54e);_0x41e226(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x4d4f('0x4')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f3ced9b..b7bacf0 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 _0xc9bb=['mail_accounts','provider','custom','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount'];(function(_0xb0db87,_0x5c8d71){var _0x4a68e1=function(_0x4a5b17){while(--_0x4a5b17){_0xb0db87['push'](_0xb0db87['shift']());}};_0x4a68e1(++_0x5c8d71);}(_0xc9bb,0x12f));var _0xbc9b=function(_0x16dced,_0x2f8d60){_0x16dced=_0x16dced-0x0;var _0x40e9d7=_0xc9bb[_0x16dced];return _0x40e9d7;};'use strict';var attributes=require(_0xbc9b('0x0'));module[_0xbc9b('0x1')]=function(_0x1c4bf8){return _0x1c4bf8['define'](_0xbc9b('0x2'),attributes,{'tableName':_0xbc9b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4c2d1a=this;var _0x1b8f4d={'id':_0x4c2d1a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4c2d1a[_0xbc9b('0x4')]!==_0xbc9b('0x5')){_0x1b8f4d['service']=_0x4c2d1a[_0xbc9b('0x4')];}else{_0x1b8f4d['host']=_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0x7')];_0x1b8f4d['port']=_0x4c2d1a['Smtp'][_0xbc9b('0x8')];_0x1b8f4d[_0xbc9b('0x9')]=_0x4c2d1a[_0xbc9b('0x6')]['secure'];}if(_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xa')]){if(_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xb')]){if(!_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xc')])throw new Error(_0xbc9b('0xd'));_0x1b8f4d['auth']={'type':_0xbc9b('0xe'),'user':_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xf')],'accessToken':_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xc')][_0xbc9b('0x10')]};}else{_0x1b8f4d['auth']={'user':_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0xf')],'pass':_0x4c2d1a[_0xbc9b('0x6')][_0xbc9b('0x11')]};}}return _0x1b8f4d;}}});}; \ No newline at end of file +var _0xf4eb=['mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','exports','MailAccount'];(function(_0x292183,_0xd1a505){var _0x35017e=function(_0x1225e1){while(--_0x1225e1){_0x292183['push'](_0x292183['shift']());}};_0x35017e(++_0xd1a505);}(_0xf4eb,0xc4));var _0xbf4e=function(_0x11a87d,_0x2e0316){_0x11a87d=_0x11a87d-0x0;var _0x449f3f=_0xf4eb[_0x11a87d];return _0x449f3f;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xbf4e('0x0')]=function(_0x47f7be){return _0x47f7be['define'](_0xbf4e('0x1'),attributes,{'tableName':_0xbf4e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1abb70=this;var _0x356be0={'id':_0x1abb70['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1abb70[_0xbf4e('0x3')]!==_0xbf4e('0x4')){_0x356be0[_0xbf4e('0x5')]=_0x1abb70['provider'];}else{_0x356be0[_0xbf4e('0x6')]=_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0x6')];_0x356be0['port']=_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0x8')];_0x356be0['secure']=_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0x9')];}if(_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0xa')]){if(_0x1abb70[_0xbf4e('0x7')]['modernAuthentication']){if(!_0x1abb70['Smtp'][_0xbf4e('0xb')])throw new Error(_0xbf4e('0xc'));_0x356be0[_0xbf4e('0xd')]={'type':_0xbf4e('0xe'),'user':_0x1abb70['Smtp'][_0xbf4e('0xf')],'accessToken':_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0xb')][_0xbf4e('0x10')]};}else{_0x356be0['auth']={'user':_0x1abb70[_0xbf4e('0x7')]['user'],'pass':_0x1abb70[_0xbf4e('0x7')][_0xbf4e('0x11')]};}}return _0x356be0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 25d6d0d..8b26973 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 _0x687b=['lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','body','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','CloudProvider','List','omit','applications','list','orderBy','asc','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','spread','update','interaction','get','created','contact','originTo','originCc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','agent','name','waitForTheAssignedAgent','queueId','MailQueue','unshift','waitForTheAssignedQueue','Start','startRouting'];(function(_0x15d34a,_0x5beabf){var _0x34ec72=function(_0x1f0c8e){while(--_0x1f0c8e){_0x15d34a['push'](_0x15d34a['shift']());}};_0x34ec72(++_0x5beabf);}(_0x687b,0x14a));var _0xb687=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x687b[_0x532112];return _0x23e5fb;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var BPromise=require(_0xb687('0x2'));var rs=require(_0xb687('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xb687('0x4'))(_0xb687('0x5'));var config=require(_0xb687('0x6'));var jayson=require(_0xb687('0x7'));var client=jayson[_0xb687('0x8')][_0xb687('0x9')]({'port':0x232c});config[_0xb687('0xa')]=_[_0xb687('0xb')](config[_0xb687('0xa')],{'host':_0xb687('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb687('0xa')]));require(_0xb687('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a99c5,_0x21e3ab,_0x825ad){return new BPromise(function(_0x15dc9a,_0x404fdb){return client[_0xb687('0xe')](_0x1a99c5,_0x825ad)[_0xb687('0xf')](function(_0xaf4727){logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));logger[_0xb687('0x12')](_0xb687('0x13'),_0x21e3ab,_0xb687('0x11'),JSON['stringify'](_0xaf4727));if(_0xaf4727['error']){if(_0xaf4727[_0xb687('0x14')][_0xb687('0x15')]===0x1f4){logger['error'](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x404fdb(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x15dc9a(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}else{logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));_0x15dc9a(_0xaf4727[_0xb687('0x18')][_0xb687('0x17')]);}})['catch'](function(_0x48958d){logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0x48958d);_0x404fdb(_0x48958d);});});}exports[_0xb687('0x19')]=function(_0x4b593b){var _0x42cdd2=this;return new Promise(function(_0x481f1d,_0x1bd2bf){return db[_0xb687('0x1a')][_0xb687('0x1b')]({'raw':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b593b['options']?_0x4b593b[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1f')]||null:null,'limit':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x20')]||null:null,'include':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x21')]?_[_0xb687('0x22')](_0x4b593b['options'][_0xb687('0x21')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x23')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1f')],'include':_0x129347[_0xb687('0x21')]?_[_0xb687('0x22')](_0x129347[_0xb687('0x21')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x23')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1f')],'include':_0x3cb2f2['include']?_[_0xb687('0x22')](_0x3cb2f2[_0xb687('0x21')],function(_0x392721){return{'model':db[_0x392721[_0xb687('0x23')]],'as':_0x392721['as'],'attributes':_0x392721[_0xb687('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x4e9a06){logger[_0xb687('0x10')]('GetMailAccount',_0x4b593b);logger[_0xb687('0x12')](_0xb687('0x19'),_0x4b593b,JSON[_0xb687('0x24')](_0x4e9a06));_0x481f1d(_0x4e9a06);})[_0xb687('0x25')](function(_0x1ad3ef){logger[_0xb687('0x14')](_0xb687('0x19'),_0x1ad3ef['message'],_0x4b593b);_0x1bd2bf(_0x42cdd2[_0xb687('0x14')](0x1f4,_0x1ad3ef[_0xb687('0x17')]));});});};exports[_0xb687('0x26')]=function(_0x22cd1d){var _0xa18fec=this;return new Promise(function(_0x263834,_0x44be88){return db[_0xb687('0x1a')][_0xb687('0x27')]({'raw':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['attributes']||null:null,'include':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')]?_['map'](_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')],function(_0x548b83){return{'model':db[_0x548b83[_0xb687('0x23')]],'as':_0x548b83['as'],'attributes':_0x548b83['attributes'],'include':_0x548b83[_0xb687('0x21')]?_[_0xb687('0x22')](_0x548b83[_0xb687('0x21')],function(_0x3e146a){return{'model':db[_0x3e146a[_0xb687('0x23')]],'as':_0x3e146a['as'],'attributes':_0x3e146a[_0xb687('0x1f')],'include':_0x3e146a['include']?_[_0xb687('0x22')](_0x3e146a[_0xb687('0x21')],function(_0x2a73df){return{'model':db[_0x2a73df[_0xb687('0x23')]],'as':_0x2a73df['as'],'attributes':_0x2a73df['attributes']};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x100f4a){if(_0x22cd1d[_0xb687('0x1c')][_0xb687('0x28')]===!![])_0x100f4a[_0xb687('0x29')]('smtpOptions',_0x100f4a[_0xb687('0x2a')]());logger[_0xb687('0x10')](_0xb687('0x26'),_0x22cd1d);logger[_0xb687('0x12')](_0xb687('0x26'),_0x22cd1d,JSON[_0xb687('0x24')](_0x100f4a));_0x263834(_0x100f4a);})['catch'](function(_0x5ad577){logger[_0xb687('0x14')]('ShowMailAccount',_0x5ad577[_0xb687('0x17')],_0x22cd1d);_0x44be88(_0xa18fec[_0xb687('0x14')](0x1f4,_0x5ad577['message']));});});};exports[_0xb687('0x2b')]=function(_0x2ce07a){var _0x57776b=this;return new Promise(function(_0x394b56,_0x28031e){var _0x127b25={'body':_0x2ce07a['body'],'channel':_0xb687('0x2c')};var _0x9cffb2=_[_0xb687('0x2d')](_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')]),[_0xb687('0x31'),'updatedAt',_0xb687('0x32'),'ListId']);var _0x50fdb7=![];if(_0x2ce07a[_0xb687('0x33')]['id']){delete _0x2ce07a[_0xb687('0x33')]['id'];}if(_['isNil'](_0x2ce07a[_0xb687('0x33')]['from'])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x34')));}if(_['isNil'](_0x2ce07a[_0xb687('0x33')][_0xb687('0x33')])||_0x2ce07a['body'][_0xb687('0x33')]===''){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x35')));}if(_[_0xb687('0x36')](_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x38')+_0x9cffb2));}if(!_[_0xb687('0x39')](_0x9cffb2,_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cffb2));}var _0x1ac373={};_0x1ac373[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')];return db[_0xb687('0x1a')][_0xb687('0x27')]({'where':{'id':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb687('0x2f')],'as':_0xb687('0x3c'),'where':_0x1ac373,'limit':0x1,'order':[[_0xb687('0x3d'),_0xb687('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xb687('0x3f')},{'model':db[_0xb687('0x40')],'as':_0xb687('0x41'),'include':[{'model':db[_0xb687('0x42')],'as':'CloudProvider'}]}]})[_0xb687('0xf')](function(_0xfc4c5f){if(_0xfc4c5f&&_0xfc4c5f[_0xb687('0x43')]){var _0x401b99=_0xfc4c5f['get']({'plain':!![]});_0x127b25['account']=_[_0xb687('0x44')](_0x401b99,[_0xb687('0x3f'),_0xb687('0x43')]);_0x127b25['account']['smtpOptions']=_0xfc4c5f[_0xb687('0x2a')]();_0x127b25[_0xb687('0x45')]=_0x401b99[_0xb687('0x3f')];_0x127b25[_0xb687('0x46')]=_0x401b99[_0xb687('0x43')];_0x127b25[_0xb687('0x45')]=_[_0xb687('0x47')](_0x127b25[_0xb687('0x45')],['priority'],[_0xb687('0x48')]);if(_0x127b25[_0xb687('0x3b')]&&_0x127b25[_0xb687('0x3b')]['autoclose']){_0x127b25['applications']['push']({'id':0x0,'priority':_0x127b25['applications'][_0xb687('0x49')]+0x1,'app':_0xb687('0x4a'),'appdata':_0xb687('0x4b'),'interval':_0xb687('0x4c')});}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x3f')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x3f')];}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x43')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x43')];}if(_0x401b99[_0xb687('0x43')][_0xb687('0x3c')][_0xb687('0x49')]){return _0x401b99[_0xb687('0x43')][_0xb687('0x3c')][0x0];}var _0x4dca01=_['defaults'](_0x2ce07a[_0xb687('0x33')],{'firstName':_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')],'ListId':_0x401b99[_0xb687('0x4d')]});_0x4dca01[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')]['from'];return db[_0xb687('0x2f')]['create'](_0x4dca01);}else{throw new Error(_0xb687('0x4e'));}})[_0xb687('0xf')](function(_0x50fb31){_0x127b25['contact']=_0x50fb31;if(_0x50fb31){if(!_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId']){_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')]=rs['generate']()+'\x20'+_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')];}var _0x1a31f6={'ContactId':_0x50fb31['id'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId'],'to':_0x2ce07a['body'][_0xb687('0x17')]['from'],'cc':_0x2ce07a['body']['message']['cc'],'subject':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x50')],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'};return db[_0xb687('0x54')][_0xb687('0x27')]({'where':{'closed':![],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db[_0xb687('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x56')]}}]})[_0xb687('0xf')](function(_0x1c031f){if(_0x1c031f){return[_0x1c031f,![]];}return db[_0xb687('0x54')][_0xb687('0x57')](_0x1a31f6)['then'](function(_0x22da49){return[_0x22da49,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb687('0x58')](function(_0x293281,_0x18993a){if(_0x293281){_0x50fdb7=_0x18993a;if(!_0x18993a){return _0x293281[_0xb687('0x59')]({'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')],'to':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x3a')],'cc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['cc'],'subject':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x50')],'attach':_0x293281[_0xb687('0x51')]?_0x293281[_0xb687('0x51')]:_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'substatus':null,'substatusAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'});}else{return _0x293281;}}})[_0xb687('0xf')](function(_0x48838a){_0x127b25[_0xb687('0x5a')]=_0x48838a[_0xb687('0x5b')]({'plain':!![]});_0x127b25[_0xb687('0x5a')][_0xb687('0x5c')]=_0x50fdb7;return db['MailMessage'][_0xb687('0x57')]({'body':_0x2ce07a[_0xb687('0x33')]['body'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'MailInteractionId':_0x48838a['id'],'direction':'in','ContactId':_0x127b25[_0xb687('0x5d')]['id'],'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x4f')],'from':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')],'to':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['to'],'cc':_0x2ce07a[_0xb687('0x33')]['message']['cc'],'subject':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['subject'],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['attach'],'Attachments':_0x2ce07a['body'][_0xb687('0x17')]['attachments'],'originTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5e')],'originCc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5f')],'bcc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['bcc'],'ChatWebsiteId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x60')]||null,'originChannel':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x61')]||'Email','ChatOfflineMessageId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb687('0x62')],'as':_0xb687('0x63')}]});})[_0xb687('0xf')](function(_0x1227fe){_0x127b25['message']=_0x1227fe;if(!_0x127b25[_0xb687('0x5a')]['UserId']){return;}return db['User'][_0xb687('0x27')]({'attributes':['id','name'],'where':{'id':_0x127b25['interaction'][_0xb687('0x64')]}});})['then'](function(_0x137631){if(_0x137631){_0x127b25[_0xb687('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb687('0x65'),'appdata':_0x137631[_0xb687('0x66')]+','+(_0x127b25['account'][_0xb687('0x67')]||0xa),'interval':_0xb687('0x4c')});}if(!_0x127b25[_0xb687('0x5a')][_0xb687('0x68')]){return;}return db[_0xb687('0x69')][_0xb687('0x27')]({'attributes':['id',_0xb687('0x66')],'where':{'id':_0x127b25[_0xb687('0x5a')][_0xb687('0x68')]}});})[_0xb687('0xf')](function(_0x3a7a4a){if(_0x3a7a4a){_0x127b25['applications'][_0xb687('0x6a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3a7a4a['name']+','+(_0x127b25[_0xb687('0x3b')][_0xb687('0x6b')]||0x12c),'interval':_0xb687('0x4c')});}return respondWithRpcPromise(_0xb687('0x6c'),_0xb687('0x6d'),_0x127b25);})['then'](function(_0x59c94b){_0x394b56(_0x59c94b);})[_0xb687('0x25')](function(_0x316abd){_0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0x316abd[_0xb687('0x17')]));});});}; \ No newline at end of file +var _0x8958=['Applications','Smtp','CloudProvider','List','get','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','ListId','List\x20not\x20found','generate','messageId','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','bcc','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','moment','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','DESC','MailApplication'];(function(_0x42d8b6,_0x51a924){var _0x525afd=function(_0x1bfd83){while(--_0x1bfd83){_0x42d8b6['push'](_0x42d8b6['shift']());}};_0x525afd(++_0x51a924);}(_0x8958,0x93));var _0x8895=function(_0x37002e,_0x3c1f39){_0x37002e=_0x37002e-0x0;var _0x4eaf2d=_0x8958[_0x37002e];return _0x4eaf2d;};'use strict';var _=require('lodash');var moment=require(_0x8895('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x8895('0x1'))('rpc');var config=require(_0x8895('0x2'));var jayson=require(_0x8895('0x3'));var client=jayson[_0x8895('0x4')]['http']({'port':0x232c});config[_0x8895('0x5')]=_[_0x8895('0x6')](config[_0x8895('0x5')],{'host':_0x8895('0x7'),'port':0x18eb});var socket=require(_0x8895('0x8'))(new Redis(config['redis']));require(_0x8895('0x9'))[_0x8895('0xa')](socket);function respondWithRpcPromise(_0x408d4b,_0x24fe49,_0x6eab1e){return new BPromise(function(_0x29c126,_0x22a12b){return client[_0x8895('0xb')](_0x408d4b,_0x6eab1e)[_0x8895('0xc')](function(_0x107d86){logger['info'](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));logger[_0x8895('0xf')](_0x8895('0x10'),_0x24fe49,_0x8895('0xe'),JSON[_0x8895('0x11')](_0x107d86));if(_0x107d86['error']){if(_0x107d86[_0x8895('0x12')][_0x8895('0x13')]===0x1f4){logger[_0x8895('0x12')]('MailAccount,\x20%s,\x20%s',_0x24fe49,_0x107d86['error'][_0x8895('0x14')]);return _0x22a12b(_0x107d86['error'][_0x8895('0x14')]);}logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x107d86[_0x8895('0x12')][_0x8895('0x14')]);return _0x29c126(_0x107d86['error'][_0x8895('0x14')]);}else{logger[_0x8895('0x15')](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));_0x29c126(_0x107d86[_0x8895('0x16')][_0x8895('0x14')]);}})[_0x8895('0x17')](function(_0x26cee0){logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x26cee0);_0x22a12b(_0x26cee0);});});}exports[_0x8895('0x18')]=function(_0x6b8a16){var _0x2df795=this;return new Promise(function(_0x54e6d4,_0x522a4e){return db['MailAccount'][_0x8895('0x19')]({'raw':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1b')]===undefined?!![]:![]:!![],'where':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options'][_0x8895('0x1d')]||null:null,'limit':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1e')]||null:null,'include':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options']['include']?_[_0x8895('0x1f')](_0x6b8a16[_0x8895('0x1a')][_0x8895('0x20')],function(_0x24a376){return{'model':db[_0x24a376['model']],'as':_0x24a376['as'],'attributes':_0x24a376[_0x8895('0x1d')],'include':_0x24a376[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x24a376['include'],function(_0x4aee03){return{'model':db[_0x4aee03[_0x8895('0x21')]],'as':_0x4aee03['as'],'attributes':_0x4aee03['attributes'],'include':_0x4aee03[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x4aee03[_0x8895('0x20')],function(_0xf5fb66){return{'model':db[_0xf5fb66[_0x8895('0x21')]],'as':_0xf5fb66['as'],'attributes':_0xf5fb66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6e449d){logger[_0x8895('0x15')](_0x8895('0x18'),_0x6b8a16);logger[_0x8895('0xf')](_0x8895('0x18'),_0x6b8a16,JSON['stringify'](_0x6e449d));_0x54e6d4(_0x6e449d);})['catch'](function(_0x46ae32){logger[_0x8895('0x12')](_0x8895('0x18'),_0x46ae32[_0x8895('0x14')],_0x6b8a16);_0x522a4e(_0x2df795[_0x8895('0x12')](0x1f4,_0x46ae32['message']));});});};exports[_0x8895('0x22')]=function(_0x5d2f33){var _0x3f055a=this;return new Promise(function(_0x5b2b19,_0x40ba14){return db[_0x8895('0x23')][_0x8895('0x24')]({'raw':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['attributes']||null:null,'include':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33['options'][_0x8895('0x20')]?_['map'](_0x5d2f33[_0x8895('0x1a')][_0x8895('0x20')],function(_0x20907a){return{'model':db[_0x20907a[_0x8895('0x21')]],'as':_0x20907a['as'],'attributes':_0x20907a[_0x8895('0x1d')],'include':_0x20907a['include']?_[_0x8895('0x1f')](_0x20907a['include'],function(_0x57f58a){return{'model':db[_0x57f58a[_0x8895('0x21')]],'as':_0x57f58a['as'],'attributes':_0x57f58a[_0x8895('0x1d')],'include':_0x57f58a[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x57f58a[_0x8895('0x20')],function(_0x4b7fe0){return{'model':db[_0x4b7fe0[_0x8895('0x21')]],'as':_0x4b7fe0['as'],'attributes':_0x4b7fe0[_0x8895('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2557fc){if(_0x5d2f33['options'][_0x8895('0x25')]===!![])_0x2557fc[_0x8895('0x26')]('smtpOptions',_0x2557fc[_0x8895('0x27')]());logger[_0x8895('0x15')]('ShowMailAccount',_0x5d2f33);logger['debug'](_0x8895('0x22'),_0x5d2f33,JSON[_0x8895('0x11')](_0x2557fc));_0x5b2b19(_0x2557fc);})[_0x8895('0x17')](function(_0x331a9e){logger[_0x8895('0x12')]('ShowMailAccount',_0x331a9e[_0x8895('0x14')],_0x5d2f33);_0x40ba14(_0x3f055a[_0x8895('0x12')](0x1f4,_0x331a9e[_0x8895('0x14')]));});});};exports[_0x8895('0x28')]=function(_0x1d9e26){var _0x534876=this;return new Promise(function(_0x4a7e22,_0x174be1){var _0x5ebfc4={'body':_0x1d9e26[_0x8895('0x29')],'channel':_0x8895('0x2a')};var _0x526d90=_[_0x8895('0x2b')](_['keys'](db[_0x8895('0x2c')]['rawAttributes']),['createdAt','updatedAt','CompanyId','ListId']);var _0x47cf10=![];if(_0x1d9e26[_0x8895('0x29')]['id']){delete _0x1d9e26[_0x8895('0x29')]['id'];}if(_['isNil'](_0x1d9e26['body'][_0x8895('0x2d')])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8895('0x2e')](_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')])||_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')]===''){return _0x174be1(_0x534876['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x2f')+_0x526d90));}if(!_[_0x8895('0x30')](_0x526d90,_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x31')+_0x526d90));}var _0x3413cd={};_0x3413cd[_0x1d9e26[_0x8895('0x29')][_0x8895('0x32')]]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x23')]['find']({'where':{'id':_0x1d9e26[_0x8895('0x33')]['id']},'include':[{'model':db[_0x8895('0x34')],'as':'List','include':[{'model':db[_0x8895('0x2c')],'as':'Contacts','where':_0x3413cd,'limit':0x1,'order':[['updatedAt',_0x8895('0x35')]]}]},{'model':db[_0x8895('0x36')],'as':_0x8895('0x37')},{'model':db['MailServerOut'],'as':_0x8895('0x38'),'include':[{'model':db['CloudProvider'],'as':_0x8895('0x39')}]}]})[_0x8895('0xc')](function(_0xb3ecd6){if(_0xb3ecd6&&_0xb3ecd6[_0x8895('0x3a')]){var _0x2f3bf1=_0xb3ecd6[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x33')]=_['omit'](_0x2f3bf1,['Applications',_0x8895('0x3a')]);_0x5ebfc4[_0x8895('0x33')]['smtpOptions']=_0xb3ecd6[_0x8895('0x27')]();_0x5ebfc4['applications']=_0x2f3bf1['Applications'];_0x5ebfc4[_0x8895('0x3c')]=_0x2f3bf1['List'];_0x5ebfc4[_0x8895('0x3d')]=_[_0x8895('0x3e')](_0x5ebfc4[_0x8895('0x3d')],[_0x8895('0x3f')],[_0x8895('0x40')]);if(_0x5ebfc4[_0x8895('0x33')]&&_0x5ebfc4[_0x8895('0x33')][_0x8895('0x41')]){_0x5ebfc4['applications'][_0x8895('0x42')]({'id':0x0,'priority':_0x5ebfc4[_0x8895('0x3d')][_0x8895('0x43')]+0x1,'app':'close','appdata':_0x8895('0x41'),'interval':_0x8895('0x44')});}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')];}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')];}if(_0x2f3bf1['List'][_0x8895('0x45')][_0x8895('0x43')]){return _0x2f3bf1[_0x8895('0x3a')][_0x8895('0x45')][0x0];}var _0x3c8a97=_['defaults'](_0x1d9e26[_0x8895('0x29')],{'firstName':_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')],'ListId':_0x2f3bf1[_0x8895('0x46')]});_0x3c8a97[_0x1d9e26[_0x8895('0x29')]['mapKey']]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x2c')]['create'](_0x3c8a97);}else{throw new Error(_0x8895('0x47'));}})[_0x8895('0xc')](function(_0x2c777b){_0x5ebfc4['contact']=_0x2c777b;if(_0x2c777b){if(!_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']){_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']=rs[_0x8895('0x48')]()+'\x20'+_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x2d')];}var _0x545f13={'ContactId':_0x2c777b['id'],'MailAccountId':_0x1d9e26['account']['id'],'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x2d')],'cc':_0x1d9e26['body'][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4b')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x8895('0x4c')][_0x8895('0x24')]({'where':{'closed':![],'MailAccountId':_0x1d9e26['account']['id']},'include':[{'model':db[_0x8895('0x4d')],'as':_0x8895('0x4e'),'attributes':[_0x8895('0x49')],'where':{'messageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4f')]}}]})[_0x8895('0xc')](function(_0x1b1bc0){if(_0x1b1bc0){return[_0x1b1bc0,![]];}return db[_0x8895('0x4c')][_0x8895('0x50')](_0x545f13)[_0x8895('0xc')](function(_0x261d4b){return[_0x261d4b,!![]];});});}else{throw new Error(_0x8895('0x51'));}})[_0x8895('0x52')](function(_0x21c7bb,_0xb903d8){if(_0x21c7bb){_0x47cf10=_0xb903d8;if(!_0xb903d8){return _0x21c7bb[_0x8895('0x53')]({'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body']['message']['from'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x21c7bb['attach']?_0x21c7bb[_0x8895('0x4b')]:_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4b')],'substatus':null,'substatusAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgDirection':'in'});}else{return _0x21c7bb;}}})['then'](function(_0x6440ea){_0x5ebfc4[_0x8895('0x56')]=_0x6440ea[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x56')][_0x8895('0x57')]=_0x47cf10;return db[_0x8895('0x4d')][_0x8895('0x50')]({'body':_0x1d9e26['body'][_0x8895('0x29')],'MailAccountId':_0x1d9e26[_0x8895('0x33')]['id'],'MailInteractionId':_0x6440ea['id'],'direction':'in','ContactId':_0x5ebfc4['contact']['id'],'messageId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'from':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['from'],'to':_0x1d9e26[_0x8895('0x29')]['message']['to'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['attach'],'Attachments':_0x1d9e26[_0x8895('0x29')]['message']['attachments'],'originTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x58')],'originCc':_0x1d9e26['body'][_0x8895('0x14')]['originCc'],'bcc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x59')],'ChatWebsiteId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['ChatWebsiteId']||null,'originChannel':_0x1d9e26['body'][_0x8895('0x14')]['originChannel']||_0x8895('0x5a'),'ChatOfflineMessageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x5b')]||null},{'include':[{'model':db[_0x8895('0x5c')],'as':_0x8895('0x5d')}]});})[_0x8895('0xc')](function(_0x166e9a){_0x5ebfc4['message']=_0x166e9a;if(!_0x5ebfc4[_0x8895('0x56')]['UserId']){return;}return db['User'][_0x8895('0x24')]({'attributes':['id','name'],'where':{'id':_0x5ebfc4[_0x8895('0x56')][_0x8895('0x5e')]}});})[_0x8895('0xc')](function(_0x39f5e5){if(_0x39f5e5){_0x5ebfc4['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x39f5e5[_0x8895('0x5f')]+','+(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x60')]||0xa),'interval':_0x8895('0x44')});}if(!_0x5ebfc4[_0x8895('0x56')][_0x8895('0x61')]){return;}return db['MailQueue'][_0x8895('0x24')]({'attributes':['id',_0x8895('0x5f')],'where':{'id':_0x5ebfc4[_0x8895('0x56')]['queueId']}});})[_0x8895('0xc')](function(_0x565bb8){if(_0x565bb8){_0x5ebfc4[_0x8895('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8895('0x62'),'appdata':_0x565bb8[_0x8895('0x5f')]+','+(_0x5ebfc4['account'][_0x8895('0x63')]||0x12c),'interval':_0x8895('0x44')});}return respondWithRpcPromise('Start',_0x8895('0x64'),_0x5ebfc4);})[_0x8895('0xc')](function(_0x2af98f){_0x4a7e22(_0x2af98f);})[_0x8895('0x17')](function(_0x214730){_0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x214730[_0x8895('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f451203..097278c 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 _0x1b3c=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x4afa2f,_0x4c3b4b){var _0x5967df=function(_0x427ba5){while(--_0x427ba5){_0x4afa2f['push'](_0x4afa2f['shift']());}};_0x5967df(++_0x4c3b4b);}(_0x1b3c,0x1ea));var _0xc1b3=function(_0x34b13d,_0x296e46){_0x34b13d=_0x34b13d-0x0;var _0x36cb7b=_0x1b3c[_0x34b13d];return _0x36cb7b;};'use strict';var MailAccountEvents=require(_0xc1b3('0x0'));var events=[_0xc1b3('0x1'),_0xc1b3('0x2'),_0xc1b3('0x3')];function createListener(_0x1b8c71,_0x1667bc){return function(_0x2fb2d3){_0x1667bc[_0xc1b3('0x4')](_0x1b8c71,_0x2fb2d3);};}function removeListener(_0x22f58b,_0x1f8fcf){return function(){MailAccountEvents[_0xc1b3('0x5')](_0x22f58b,_0x1f8fcf);};}exports[_0xc1b3('0x6')]=function(_0x15cc63){for(var _0x3cce90=0x0,_0x127115=events[_0xc1b3('0x7')];_0x3cce90<_0x127115;_0x3cce90++){var _0x211b0a=events[_0x3cce90];var _0x210d14=createListener(_0xc1b3('0x8')+_0x211b0a,_0x15cc63);MailAccountEvents['on'](_0x211b0a,_0x210d14);}}; \ No newline at end of file +var _0x3906=['removeListener','register','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x3906,0xd6));var _0x6390=function(_0x4b920b,_0x1d91ff){_0x4b920b=_0x4b920b-0x0;var _0x5606e0=_0x3906[_0x4b920b];return _0x5606e0;};'use strict';var MailAccountEvents=require(_0x6390('0x0'));var events=[_0x6390('0x1'),'remove',_0x6390('0x2')];function createListener(_0x496b0e,_0x3b5cae){return function(_0x1cd66e){_0x3b5cae['emit'](_0x496b0e,_0x1cd66e);};}function removeListener(_0x3fa6f2,_0x1bf9be){return function(){MailAccountEvents[_0x6390('0x3')](_0x3fa6f2,_0x1bf9be);};}exports[_0x6390('0x4')]=function(_0x2f3cad){for(var _0x38629d=0x0,_0x2502e3=events[_0x6390('0x5')];_0x38629d<_0x2502e3;_0x38629d++){var _0x91f095=events[_0x38629d];var _0x18e2d5=createListener(_0x6390('0x6')+_0x91f095,_0x2f3cad);MailAccountEvents['on'](_0x91f095,_0x18e2d5);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ceafdec..1e9b077 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 _0xb7a8=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','update','delete','/:id','destroy','exports'];(function(_0x57b7a4,_0x13a82e){var _0x2f3278=function(_0x503e67){while(--_0x503e67){_0x57b7a4['push'](_0x57b7a4['shift']());}};_0x2f3278(++_0x13a82e);}(_0xb7a8,0x1b2));var _0x8b7a=function(_0x301082,_0x541737){_0x301082=_0x301082-0x0;var _0x110e70=_0xb7a8[_0x301082];return _0x110e70;};'use strict';var multer=require('multer');var util=require(_0x8b7a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b7a('0x1'));var router=express['Router']();var fs_extra=require(_0x8b7a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8b7a('0x3'));var config=require(_0x8b7a('0x4'));var controller=require(_0x8b7a('0x5'));router['get']('/:id',auth[_0x8b7a('0x6')](),controller[_0x8b7a('0x7')]);router[_0x8b7a('0x8')]('/:id',auth[_0x8b7a('0x6')](),controller[_0x8b7a('0x9')]);router[_0x8b7a('0xa')](_0x8b7a('0xb'),auth['isAuthenticated'](),controller[_0x8b7a('0xc')]);module[_0x8b7a('0xd')]=router; \ No newline at end of file +var _0xcf75=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x161709,_0x1a2a4c){var _0x1ac15c=function(_0x27dad0){while(--_0x27dad0){_0x161709['push'](_0x161709['shift']());}};_0x1ac15c(++_0x1a2a4c);}(_0xcf75,0x1a2));var _0x5cf7=function(_0x4585c8,_0xe158ee){_0x4585c8=_0x4585c8-0x0;var _0x50d4dc=_0xcf75[_0x4585c8];return _0x50d4dc;};'use strict';var multer=require(_0x5cf7('0x0'));var util=require(_0x5cf7('0x1'));var path=require(_0x5cf7('0x2'));var timeout=require(_0x5cf7('0x3'));var express=require(_0x5cf7('0x4'));var router=express[_0x5cf7('0x5')]();var fs_extra=require(_0x5cf7('0x6'));var auth=require(_0x5cf7('0x7'));var interaction=require(_0x5cf7('0x8'));var config=require(_0x5cf7('0x9'));var controller=require('./mailApplication.controller');router[_0x5cf7('0xa')](_0x5cf7('0xb'),auth['isAuthenticated'](),controller[_0x5cf7('0xc')]);router[_0x5cf7('0xd')](_0x5cf7('0xb'),auth[_0x5cf7('0xe')](),controller['update']);router['delete'](_0x5cf7('0xb'),auth[_0x5cf7('0xe')](),controller[_0x5cf7('0xf')]);module[_0x5cf7('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0fb3014..0995db7 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 _0x094d=['sequelize','exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x094d,0x66));var _0xd094=function(_0x5a5943,_0x57d3ef){_0x5a5943=_0x5a5943-0x0;var _0x29ef63=_0x094d[_0x5a5943];return _0x29ef63;};'use strict';var Sequelize=require(_0xd094('0x0'));module[_0xd094('0x1')]={'priority':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd094('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd094('0x4')],'defaultValue':_0xd094('0x5')}}; \ No newline at end of file +var _0xc034=['INTEGER','TEXT','STRING','sequelize'];(function(_0x575042,_0x55ee18){var _0x45e28d=function(_0x883582){while(--_0x883582){_0x575042['push'](_0x575042['shift']());}};_0x45e28d(++_0x55ee18);}(_0xc034,0x127));var _0x4c03=function(_0x52a470,_0xf1f68b){_0x52a470=_0x52a470-0x0;var _0x408ce6=_0xc034[_0x52a470];return _0x408ce6;};'use strict';var Sequelize=require(_0x4c03('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4c03('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4c03('0x2')]()},'description':{'type':Sequelize[_0x4c03('0x3')]},'interval':{'type':Sequelize[_0x4c03('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 2f16e93..31077dc 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x1d3168,_0x35d048){var _0x5c7c97=function(_0x4cbb43){while(--_0x4cbb43){_0x1d3168['push'](_0x1d3168['shift']());}};_0x5c7c97(++_0x35d048);}(_0xda3f,0xec));var _0xfda3=function(_0x4ad99f,_0x1de4ec){_0x4ad99f=_0x4ad99f-0x0;var _0x2183dd=_0xda3f[_0x4ad99f];return _0x2183dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x34bbd5,_0x3c810a){var _0x46244f=function(_0x5884b9){while(--_0x5884b9){_0x34bbd5['push'](_0x34bbd5['shift']());}};_0x46244f(++_0x3c810a);}(_0x70e0,0x17b));var _0x070e=function(_0x41c500,_0x3cf768){_0x41c500=_0x41c500-0x0;var _0x14500a=_0x70e0[_0x41c500];return _0x14500a;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7ced16c..8a8064e 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 _0x371b=['MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x11d3ad,_0x3925f2){var _0x43f97e=function(_0x1bb485){while(--_0x1bb485){_0x11d3ad['push'](_0x11d3ad['shift']());}};_0x43f97e(++_0x3925f2);}(_0x371b,0x114));var _0xb371=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x371b[_0x3b56c0];return _0x377efe;};'use strict';var _=require(_0xb371('0x0'));var util=require(_0xb371('0x1'));var logger=require(_0xb371('0x2'))(_0xb371('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb371('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb371('0x5'));var config=require(_0xb371('0x6'));var attributes=require(_0xb371('0x7'));module[_0xb371('0x8')]=function(_0x2fe6d3,_0x1df5ec){return _0x2fe6d3[_0xb371('0x9')](_0xb371('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb371('0xb'),'collate':_0xb371('0xc')});}; \ No newline at end of file +var _0x1715=['define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0x1715,0xc7));var _0x5171=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1715[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5171('0x0'));var util=require(_0x5171('0x1'));var logger=require(_0x5171('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5171('0x3'));var rp=require(_0x5171('0x4'));var fs=require('fs');var path=require(_0x5171('0x5'));var rimraf=require('rimraf');var config=require(_0x5171('0x6'));var attributes=require(_0x5171('0x7'));module[_0x5171('0x8')]=function(_0xef6018,_0x1ce462){return _0xef6018[_0x5171('0x9')](_0x5171('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5171('0xb'),'collate':_0x5171('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 51baf2b..98b1eac 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 _0x3448=['limit','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailApplication','MailApplication','update','options','raw','where','attributes'];(function(_0x159b6b,_0x52d23f){var _0x2dceb3=function(_0x221fec){while(--_0x221fec){_0x159b6b['push'](_0x159b6b['shift']());}};_0x2dceb3(++_0x52d23f);}(_0x3448,0xb6));var _0x8344=function(_0x5239b0,_0x1007cb){_0x5239b0=_0x5239b0-0x0;var _0xea0c90=_0x3448[_0x5239b0];return _0xea0c90;};'use strict';var _=require(_0x8344('0x0'));var util=require(_0x8344('0x1'));var moment=require(_0x8344('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8344('0x3'));var db=require(_0x8344('0x4'))['db'];var utils=require(_0x8344('0x5'));var logger=require('../../config/logger')(_0x8344('0x6'));var config=require('../../config/environment');var jayson=require(_0x8344('0x7'));var client=jayson[_0x8344('0x8')][_0x8344('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a50da,_0x31f1bf,_0x3ff9cd){return new BPromise(function(_0x11086f,_0x5c148b){return client[_0x8344('0xa')](_0x2a50da,_0x3ff9cd)[_0x8344('0xb')](function(_0x4984fb){logger[_0x8344('0xc')](_0x8344('0xd'),_0x31f1bf,_0x8344('0xe'));logger[_0x8344('0xf')](_0x8344('0x10'),_0x31f1bf,'request\x20sent',JSON[_0x8344('0x11')](_0x4984fb));if(_0x4984fb[_0x8344('0x12')]){if(_0x4984fb[_0x8344('0x12')]['code']===0x1f4){logger[_0x8344('0x12')](_0x8344('0xd'),_0x31f1bf,_0x4984fb[_0x8344('0x12')][_0x8344('0x13')]);return _0x5c148b(_0x4984fb[_0x8344('0x12')][_0x8344('0x13')]);}logger[_0x8344('0x12')](_0x8344('0xd'),_0x31f1bf,_0x4984fb[_0x8344('0x12')][_0x8344('0x13')]);return _0x11086f(_0x4984fb[_0x8344('0x12')]['message']);}else{logger['info'](_0x8344('0xd'),_0x31f1bf,_0x8344('0xe'));_0x11086f(_0x4984fb[_0x8344('0x14')][_0x8344('0x13')]);}})['catch'](function(_0x18e632){logger[_0x8344('0x12')](_0x8344('0xd'),_0x31f1bf,_0x18e632);_0x5c148b(_0x18e632);});});}exports[_0x8344('0x15')]=function(_0x238da2){var _0x3cc391=this;return new Promise(function(_0xdac825,_0x4ec3ab){return db[_0x8344('0x16')][_0x8344('0x17')](_0x238da2['body'],{'raw':_0x238da2[_0x8344('0x18')]?_0x238da2[_0x8344('0x18')][_0x8344('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238da2[_0x8344('0x18')]?_0x238da2['options'][_0x8344('0x1a')]||null:null,'attributes':_0x238da2['options']?_0x238da2['options'][_0x8344('0x1b')]||null:null,'limit':_0x238da2[_0x8344('0x18')]?_0x238da2[_0x8344('0x18')][_0x8344('0x1c')]||null:null})[_0x8344('0xb')](function(_0x4b2b53){logger[_0x8344('0xc')]('UpdateMailApplication',_0x238da2);logger[_0x8344('0xf')](_0x8344('0x15'),_0x238da2,JSON[_0x8344('0x11')](_0x4b2b53));_0xdac825(_0x4b2b53);})[_0x8344('0x1d')](function(_0xc89340){logger[_0x8344('0x12')]('UpdateMailApplication',_0xc89340['message'],_0x238da2);_0x4ec3ab(_0x3cc391[_0x8344('0x12')](0x1f4,_0xc89340[_0x8344('0x13')]));});});}; \ No newline at end of file +var _0x403e=['where','attributes','limit','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','MailApplication,\x20%s,\x20%s','error','message','result','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x186940,_0x289e25){var _0x20f150=function(_0x2315de){while(--_0x2315de){_0x186940['push'](_0x186940['shift']());}};_0x20f150(++_0x289e25);}(_0x403e,0x130));var _0xe403=function(_0x41d066,_0x27340e){_0x41d066=_0x41d066-0x0;var _0x2d5b79=_0x403e[_0x41d066];return _0x2d5b79;};'use strict';var _=require(_0xe403('0x0'));var util=require('util');var moment=require(_0xe403('0x1'));var BPromise=require(_0xe403('0x2'));var rs=require(_0xe403('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe403('0x4'))['db'];var utils=require(_0xe403('0x5'));var logger=require(_0xe403('0x6'))(_0xe403('0x7'));var config=require(_0xe403('0x8'));var jayson=require(_0xe403('0x9'));var client=jayson[_0xe403('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15b6bd,_0x364265,_0x264dbb){return new BPromise(function(_0x563e52,_0x221416){return client[_0xe403('0xb')](_0x15b6bd,_0x264dbb)['then'](function(_0x33bc37){logger[_0xe403('0xc')]('MailApplication,\x20%s,\x20%s',_0x364265,_0xe403('0xd'));logger['debug'](_0xe403('0xe'),_0x364265,_0xe403('0xd'),JSON[_0xe403('0xf')](_0x33bc37));if(_0x33bc37['error']){if(_0x33bc37['error']['code']===0x1f4){logger['error'](_0xe403('0x10'),_0x364265,_0x33bc37[_0xe403('0x11')][_0xe403('0x12')]);return _0x221416(_0x33bc37[_0xe403('0x11')][_0xe403('0x12')]);}logger[_0xe403('0x11')](_0xe403('0x10'),_0x364265,_0x33bc37[_0xe403('0x11')][_0xe403('0x12')]);return _0x563e52(_0x33bc37[_0xe403('0x11')][_0xe403('0x12')]);}else{logger[_0xe403('0xc')](_0xe403('0x10'),_0x364265,'request\x20sent');_0x563e52(_0x33bc37[_0xe403('0x13')][_0xe403('0x12')]);}})['catch'](function(_0x34f499){logger[_0xe403('0x11')](_0xe403('0x10'),_0x364265,_0x34f499);_0x221416(_0x34f499);});});}exports[_0xe403('0x14')]=function(_0x31c1bc){var _0x3632aa=this;return new Promise(function(_0x3b107a,_0x2f827f){return db[_0xe403('0x15')][_0xe403('0x16')](_0x31c1bc[_0xe403('0x17')],{'raw':_0x31c1bc[_0xe403('0x18')]?_0x31c1bc[_0xe403('0x18')][_0xe403('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c1bc[_0xe403('0x18')]?_0x31c1bc['options'][_0xe403('0x1a')]||null:null,'attributes':_0x31c1bc['options']?_0x31c1bc[_0xe403('0x18')][_0xe403('0x1b')]||null:null,'limit':_0x31c1bc[_0xe403('0x18')]?_0x31c1bc[_0xe403('0x18')][_0xe403('0x1c')]||null:null})['then'](function(_0x102d12){logger[_0xe403('0xc')](_0xe403('0x14'),_0x31c1bc);logger['debug'](_0xe403('0x14'),_0x31c1bc,JSON[_0xe403('0xf')](_0x102d12));_0x3b107a(_0x102d12);})[_0xe403('0x1d')](function(_0x43e246){logger['error'](_0xe403('0x14'),_0x43e246[_0xe403('0x12')],_0x31c1bc);_0x2f827f(_0x3632aa[_0xe403('0x11')](0x1f4,_0x43e246[_0xe403('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1239e09..04b5a5f 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 _0xcb68=['delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','update'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xcb68,0xdd));var _0x8cb6=function(_0x144863,_0x1dfd9d){_0x144863=_0x144863-0x0;var _0x588b12=_0xcb68[_0x144863];return _0x588b12;};'use strict';var express=require(_0x8cb6('0x0'));var router=express[_0x8cb6('0x1')]();var auth=require(_0x8cb6('0x2'));var interaction=require(_0x8cb6('0x3'));var controller=require(_0x8cb6('0x4'));router[_0x8cb6('0x5')]('/',auth[_0x8cb6('0x6')](),controller[_0x8cb6('0x7')]);router[_0x8cb6('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x8cb6('0x8')]);router[_0x8cb6('0x5')](_0x8cb6('0x9'),auth['isAuthenticated'](),controller[_0x8cb6('0xa')]);router['get'](_0x8cb6('0xb'),auth[_0x8cb6('0x6')](),controller[_0x8cb6('0xc')]);router['get'](_0x8cb6('0xd'),auth[_0x8cb6('0x6')](),controller['download']);router[_0x8cb6('0xe')]('/',auth[_0x8cb6('0x6')](),controller['create']);router[_0x8cb6('0xe')](_0x8cb6('0xb'),auth[_0x8cb6('0x6')](),controller['addMessage']);router[_0x8cb6('0xe')](_0x8cb6('0xf'),auth[_0x8cb6('0x6')](),interaction['tracked'](_0x8cb6('0x10'),_0x8cb6('0x11')),controller[_0x8cb6('0x12')]);router[_0x8cb6('0x13')](_0x8cb6('0x9'),auth['isAuthenticated'](),interaction[_0x8cb6('0x14')](_0x8cb6('0x10'),'mailinteraction:update'),controller[_0x8cb6('0x15')]);router[_0x8cb6('0x16')](_0x8cb6('0x9'),auth[_0x8cb6('0x6')](),interaction[_0x8cb6('0x14')](_0x8cb6('0x10'),_0x8cb6('0x17')),controller[_0x8cb6('0x18')]);router['delete'](_0x8cb6('0xf'),auth[_0x8cb6('0x6')](),controller[_0x8cb6('0x19')]);module[_0x8cb6('0x1a')]=router; \ No newline at end of file +var _0xd4ca=['show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','describe'];(function(_0x39b617,_0x421425){var _0x132f61=function(_0xcefc1d){while(--_0xcefc1d){_0x39b617['push'](_0x39b617['shift']());}};_0x132f61(++_0x421425);}(_0xd4ca,0x18e));var _0xad4c=function(_0x121287,_0x49f84c){_0x121287=_0x121287-0x0;var _0x24c833=_0xd4ca[_0x121287];return _0x24c833;};'use strict';var express=require(_0xad4c('0x0'));var router=express[_0xad4c('0x1')]();var auth=require(_0xad4c('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xad4c('0x3')]('/',auth[_0xad4c('0x4')](),controller[_0xad4c('0x5')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xad4c('0x6')]);router[_0xad4c('0x3')]('/:id',auth[_0xad4c('0x4')](),controller[_0xad4c('0x7')]);router['get'](_0xad4c('0x8'),auth[_0xad4c('0x4')](),controller[_0xad4c('0x9')]);router[_0xad4c('0x3')](_0xad4c('0xa'),auth[_0xad4c('0x4')](),controller['download']);router[_0xad4c('0xb')]('/',auth[_0xad4c('0x4')](),controller[_0xad4c('0xc')]);router['post'](_0xad4c('0x8'),auth['isAuthenticated'](),controller[_0xad4c('0xd')]);router[_0xad4c('0xb')](_0xad4c('0xe'),auth[_0xad4c('0x4')](),interaction[_0xad4c('0xf')](_0xad4c('0x10'),_0xad4c('0x11')),controller['addTags']);router[_0xad4c('0x12')](_0xad4c('0x13'),auth[_0xad4c('0x4')](),interaction[_0xad4c('0xf')](_0xad4c('0x10'),_0xad4c('0x14')),controller[_0xad4c('0x15')]);router['delete']('/:id',auth[_0xad4c('0x4')](),interaction[_0xad4c('0xf')](_0xad4c('0x10'),_0xad4c('0x16')),controller[_0xad4c('0x17')]);router[_0xad4c('0x18')](_0xad4c('0xe'),auth['isAuthenticated'](),controller[_0xad4c('0x19')]);module[_0xad4c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 492a9c8..03e029e 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 _0xaf09=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','out','ENUM','INTEGER','sequelize'];(function(_0x57ca64,_0x21c778){var _0xc8c958=function(_0x24485d){while(--_0x24485d){_0x57ca64['push'](_0x57ca64['shift']());}};_0xc8c958(++_0x21c778);}(_0xaf09,0xdb));var _0x9af0=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xaf09[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x9af0('0x0'));var iconv=require(_0x9af0('0x1'));module[_0x9af0('0x2')]={'closed':{'type':Sequelize[_0x9af0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9af0('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9af0('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9af0('0x5')]},'note':{'type':Sequelize[_0x9af0('0x5')]},'inReplyTo':{'type':Sequelize[_0x9af0('0x5')](0x1fe)},'to':{'type':Sequelize[_0x9af0('0x5')]},'cc':{'type':Sequelize[_0x9af0('0x6')](_0x9af0('0x7'))},'subject':{'type':Sequelize[_0x9af0('0x6')]()},'attach':{'type':Sequelize[_0x9af0('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x9af0('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9af0('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9af0('0x9')]('in',_0x9af0('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9af0('0xa')]}}; \ No newline at end of file +var _0x95b0=['iconv','exports','BOOLEAN','DATE','STRING','long','ENUM','out','sequelize'];(function(_0x1766f1,_0x4718b1){var _0x3a1e40=function(_0x6a79df){while(--_0x6a79df){_0x1766f1['push'](_0x1766f1['shift']());}};_0x3a1e40(++_0x4718b1);}(_0x95b0,0x155));var _0x095b=function(_0x3c8e40,_0x356bb8){_0x3c8e40=_0x3c8e40-0x0;var _0x3174b7=_0x95b0[_0x3c8e40];return _0x3174b7;};'use strict';var Sequelize=require(_0x095b('0x0'));var iconv=require(_0x095b('0x1'));module[_0x095b('0x2')]={'closed':{'type':Sequelize[_0x095b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x095b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x095b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x095b('0x5')]},'note':{'type':Sequelize[_0x095b('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x095b('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x095b('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x095b('0x4')]},'substatus':{'type':Sequelize[_0x095b('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x095b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x095b('0x7')]('in',_0x095b('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x095b('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x095b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c6fae9e..6087a79 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 _0xf481=['juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','undefined','limit','offset','count','set','Content-Range','then','destroy','sendStatus','error','stack','fieldName','type','key','findAll','mail','query','user','catch','show','params','keys','MailInteraction','rawAttributes','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','MailMessage','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','length','rows','spread','name','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Messages','from','bcc','subject','mkdirSync','each','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','build','unlinkSync','rimraf','moment','util','path','lodash'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf481,0xd9));var _0x1f48=function(_0x11e1ab,_0x4bb093){_0x11e1ab=_0x11e1ab-0x0;var _0x530ca0=_0xf481[_0x11e1ab];return _0x530ca0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f48('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1f48('0x1'));var BPromise=require('bluebird');var util=require(_0x1f48('0x2'));var path=require(_0x1f48('0x3'));var fs=require('fs');var _=require(_0x1f48('0x4'));var juice=require(_0x1f48('0x5'));var Redis=require(_0x1f48('0x6'));var interaction=require(_0x1f48('0x7'));var qs=require(_0x1f48('0x8'));var logger=require(_0x1f48('0x9'))(_0x1f48('0xa'));var config=require(_0x1f48('0xb'));var db=require(_0x1f48('0xc'))['db'];var htmlEntities=require(_0x1f48('0xd'));config[_0x1f48('0xe')]=_['defaults'](config[_0x1f48('0xe')],{'host':_0x1f48('0xf'),'port':0x18eb});var socket=require(_0x1f48('0x10'))(new Redis(config[_0x1f48('0xe')]));require(_0x1f48('0x11'))[_0x1f48('0x12')](socket);function respondWithStatusCode(_0x21b4d9,_0x128ec8){_0x128ec8=_0x128ec8||0xcc;return function(_0x40b3da){if(_0x40b3da){return _0x21b4d9['sendStatus'](_0x128ec8);}return _0x21b4d9[_0x1f48('0x13')](_0x128ec8)[_0x1f48('0x14')]();};}function respondWithResult(_0x559bc2,_0x1d1ffe){_0x1d1ffe=_0x1d1ffe||0xc8;return function(_0x49fcd7){if(_0x49fcd7){return _0x559bc2[_0x1f48('0x13')](_0x1d1ffe)[_0x1f48('0x15')](_0x49fcd7);}};}function respondWithFilteredResult(_0x297525,_0x4c2a58){return function(_0x2aa37c){if(_0x2aa37c){var _0x173cc8=typeof _0x4c2a58['offset']===_0x1f48('0x16')&&typeof _0x4c2a58[_0x1f48('0x17')]===_0x1f48('0x16');var _0xbb4939=_0x2aa37c['count'];var _0x5aa82e=_0x173cc8?0x0:_0x4c2a58[_0x1f48('0x18')];var _0x59aa7c=_0x173cc8?_0x2aa37c[_0x1f48('0x19')]:_0x4c2a58['offset']+_0x4c2a58[_0x1f48('0x17')];var _0x2a62ce;if(_0x59aa7c>=_0xbb4939){_0x59aa7c=_0xbb4939;_0x2a62ce=0xc8;}else{_0x2a62ce=0xce;}_0x297525[_0x1f48('0x13')](_0x2a62ce);return _0x297525[_0x1f48('0x1a')](_0x1f48('0x1b'),_0x5aa82e+'-'+_0x59aa7c+'/'+_0xbb4939)[_0x1f48('0x15')](_0x2aa37c);}return null;};}function saveUpdates(_0x4ced91){return function(_0x4dc13b){if(_0x4dc13b){return _0x4dc13b['update'](_0x4ced91)[_0x1f48('0x1c')](function(_0x3c3fa8){return _0x3c3fa8;});}return null;};}function removeEntity(_0x45c897){return function(_0x33d983){if(_0x33d983){return _0x33d983[_0x1f48('0x1d')]()[_0x1f48('0x1c')](function(){_0x45c897[_0x1f48('0x13')](0xcc)[_0x1f48('0x14')]();});}};}function handleEntityNotFound(_0x1b17f8){return function(_0x476cb2){if(!_0x476cb2){_0x1b17f8[_0x1f48('0x1e')](0x194);}return _0x476cb2;};}function handleError(_0xfef0c0,_0x4faad0){_0x4faad0=_0x4faad0||0x1f4;return function(_0x270879){logger[_0x1f48('0x1f')](_0x270879[_0x1f48('0x20')]);if(_0x270879['name']){delete _0x270879['name'];}_0xfef0c0[_0x1f48('0x13')](_0x4faad0)['send'](_0x270879);};}exports['index']=function(_0x4a4146,_0x46ea56){var _0x564d31={};var _0x1a5fda=_['map'](db['MailInteraction']['rawAttributes'],function(_0x4401d6){return{'name':_0x4401d6[_0x1f48('0x21')],'type':_0x4401d6[_0x1f48('0x22')][_0x1f48('0x23')]};});_0x564d31=qs['getOptions'](_0x1a5fda,_0x4a4146);return interaction[_0x1f48('0x24')](_0x1f48('0x25'),_0x4a4146[_0x1f48('0x26')],_0x4a4146[_0x1f48('0x27')],_0x564d31,_0x1a5fda)[_0x1f48('0x1c')](respondWithFilteredResult(_0x46ea56,_0x564d31))[_0x1f48('0x28')](handleError(_0x46ea56,null));};exports[_0x1f48('0x29')]=function(_0x39c75e,_0x393bba){var _0x1fea2e={'raw':![],'where':{'id':_0x39c75e[_0x1f48('0x2a')]['id']}},_0x19848b={};_0x19848b['model']=_[_0x1f48('0x2b')](db[_0x1f48('0x2c')][_0x1f48('0x2d')]);_0x19848b[_0x1f48('0x26')]=_[_0x1f48('0x2b')](_0x39c75e[_0x1f48('0x26')]);_0x19848b[_0x1f48('0x2e')]=_[_0x1f48('0x2f')](_0x19848b[_0x1f48('0x30')],_0x19848b[_0x1f48('0x26')]);_0x1fea2e[_0x1f48('0x31')]=_[_0x1f48('0x2f')](_0x19848b[_0x1f48('0x30')],qs['fields'](_0x39c75e[_0x1f48('0x26')][_0x1f48('0x32')]));_0x1fea2e[_0x1f48('0x31')]=_0x1fea2e[_0x1f48('0x31')]['length']?_0x1fea2e['attributes']:_0x19848b[_0x1f48('0x30')];if(_0x39c75e['query'][_0x1f48('0x33')]){_0x1fea2e[_0x1f48('0x34')]=[{'all':!![]}];}_0x1fea2e=_[_0x1f48('0x35')]({},_0x1fea2e,_0x39c75e[_0x1f48('0x36')]);return db['MailInteraction'][_0x1f48('0x37')](_0x1fea2e)[_0x1f48('0x1c')](handleEntityNotFound(_0x393bba,null))['then'](respondWithResult(_0x393bba,null))[_0x1f48('0x28')](handleError(_0x393bba,null));};exports['create']=function(_0xe7b96f,_0x4a7ac2){return db[_0x1f48('0x2c')][_0x1f48('0x38')](_0xe7b96f[_0x1f48('0x39')],{})[_0x1f48('0x1c')](respondWithResult(_0x4a7ac2,0xc9))['catch'](handleError(_0x4a7ac2,null));};exports[_0x1f48('0x3a')]=function(_0x32cca9,_0x488b2d){if(_0x32cca9[_0x1f48('0x39')]['id']){delete _0x32cca9[_0x1f48('0x39')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x32cca9['params']['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x488b2d,null))[_0x1f48('0x1c')](saveUpdates(_0x32cca9[_0x1f48('0x39')],null))[_0x1f48('0x1c')](respondWithResult(_0x488b2d,null))[_0x1f48('0x28')](handleError(_0x488b2d,null));};exports[_0x1f48('0x1d')]=function(_0x979732,_0x48732e){return db[_0x1f48('0x2c')][_0x1f48('0x37')]({'where':{'id':_0x979732[_0x1f48('0x2a')]['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x48732e,null))['then'](removeEntity(_0x48732e,null))['catch'](handleError(_0x48732e,null));};exports[_0x1f48('0x3b')]=function(_0x1ff7e4,_0x4770b5){return db[_0x1f48('0x2c')][_0x1f48('0x3b')]()[_0x1f48('0x1c')](respondWithResult(_0x4770b5,null))[_0x1f48('0x28')](handleError(_0x4770b5,null));};exports[_0x1f48('0x3c')]=function(_0x37c0a1,_0x534e4c){return db['MailMessage'][_0x1f48('0x37')]({'where':{'id':_0x37c0a1['params']['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x534e4c,null))[_0x1f48('0x1c')](function(_0x2dd349){if(_0x2dd349){return _0x2dd349[_0x1f48('0x3c')](_0x37c0a1['body'][_0x1f48('0x3d')],_[_0x1f48('0x3e')](_0x37c0a1[_0x1f48('0x39')],['ids','id'])||{});}})[_0x1f48('0x1c')](respondWithResult(_0x534e4c,null))['catch'](handleError(_0x534e4c,null));};exports[_0x1f48('0x3f')]=function(_0x507c0c,_0x20c06e){var _0x38058e={'raw':![],'where':{}};var _0x3606fe={};var _0x4db7f8={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x507c0c['params']['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x20c06e,null))[_0x1f48('0x1c')](function(_0xfae078){if(_0xfae078){_0x3606fe[_0x1f48('0x30')]=_[_0x1f48('0x2b')](db[_0x1f48('0x40')]['rawAttributes']);_0x3606fe[_0x1f48('0x26')]=_[_0x1f48('0x2b')](_0x507c0c[_0x1f48('0x26')]);_0x3606fe['filters']=_[_0x1f48('0x2f')](_0x3606fe[_0x1f48('0x30')],_0x3606fe[_0x1f48('0x26')]);_0x38058e[_0x1f48('0x31')]=_[_0x1f48('0x2f')](_0x3606fe[_0x1f48('0x30')],qs[_0x1f48('0x32')](_0x507c0c[_0x1f48('0x26')]['fields']));_0x38058e['attributes']=_0x38058e[_0x1f48('0x31')]['length']?_0x38058e[_0x1f48('0x31')]:_0x3606fe[_0x1f48('0x30')];if(!_0x507c0c[_0x1f48('0x26')][_0x1f48('0x41')](_0x1f48('0x42'))){_0x38058e[_0x1f48('0x17')]=qs[_0x1f48('0x17')](_0x507c0c[_0x1f48('0x26')][_0x1f48('0x17')]);_0x38058e[_0x1f48('0x18')]=qs[_0x1f48('0x18')](_0x507c0c['query'][_0x1f48('0x18')]);}_0x38058e['order']=qs[_0x1f48('0x43')](_0x507c0c[_0x1f48('0x26')]['sort']);_0x38058e[_0x1f48('0x44')]=qs[_0x1f48('0x2e')](_[_0x1f48('0x45')](_0x507c0c['query'],_0x3606fe['filters']));_0x38058e[_0x1f48('0x44')][_0x1f48('0x46')]=_0xfae078['id'];if(_0x507c0c[_0x1f48('0x26')][_0x1f48('0x47')]){_0x38058e[_0x1f48('0x44')]=_[_0x1f48('0x35')](_0x38058e[_0x1f48('0x44')],{'$or':_[_0x1f48('0x48')](_0x38058e[_0x1f48('0x31')],function(_0x217556){var _0x12bfd={};_0x12bfd[_0x217556]={'$like':'%'+_0x507c0c[_0x1f48('0x26')][_0x1f48('0x47')]+'%'};return _0x12bfd;})});}if(_0x507c0c[_0x1f48('0x26')][_0x1f48('0x49')]){var _0x2a9ed5=_0x507c0c[_0x1f48('0x26')]['$gte'][_0x1f48('0x4a')](',');var _0x3e5454={};_0x3e5454[_0x2a9ed5[0x0]]={'$gte':moment(_0x2a9ed5[0x1])[_0x1f48('0x4b')](_0x1f48('0x4c'))};_0x38058e[_0x1f48('0x44')]=_['merge'](_0x38058e[_0x1f48('0x44')],_0x3e5454);}_0x38058e=_[_0x1f48('0x35')]({},_0x38058e,_0x507c0c[_0x1f48('0x36')]);return db['MailMessage'][_0x1f48('0x19')]({'where':_0x38058e['where']})[_0x1f48('0x1c')](function(_0x4b9965){_0x4db7f8[_0x1f48('0x19')]=_0x4b9965;if(_0x507c0c[_0x1f48('0x26')][_0x1f48('0x33')]){_0x38058e[_0x1f48('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0x1f48('0x24')](_0x38058e);})['then'](function(_0x4b21aa){if(_0x507c0c['query'][_0x1f48('0x4d')]==='true'){for(var _0x1700f5=0x0;_0x1700f5<_0x4b21aa[_0x1f48('0x4e')];_0x1700f5++){_0x4b21aa[_0x1700f5][_0x1f48('0x39')]=juice(_0x4b21aa[_0x1700f5][_0x1f48('0x39')]);}}_0x4db7f8[_0x1f48('0x4f')]=_0x4b21aa;return _0x4db7f8;});}})[_0x1f48('0x1c')](respondWithFilteredResult(_0x20c06e,_0x38058e))[_0x1f48('0x28')](handleError(_0x20c06e,null));};exports['addTags']=function(_0x5ec395,_0x4d9f00){return db['MailInteraction'][_0x1f48('0x37')]({'where':{'id':_0x5ec395[_0x1f48('0x2a')]['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x4d9f00,null))[_0x1f48('0x1c')](function(_0x484f4f){if(_0x484f4f){return _0x484f4f['setTags'](_0x5ec395[_0x1f48('0x39')][_0x1f48('0x3d')],_[_0x1f48('0x3e')](_0x5ec395[_0x1f48('0x39')],[_0x1f48('0x3d'),'id'])||{})[_0x1f48('0x50')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1f48('0x51'),'color'],'where':{'id':_0x5ec395['body'][_0x1f48('0x3d')]}});})[_0x1f48('0x1c')](function(_0x21e861){socket[_0x1f48('0x52')](_0x1f48('0x53'),{'id':Number(_0x5ec395[_0x1f48('0x2a')]['id']),'tags':_0x21e861||[]});return{'id':Number(_0x5ec395['params']['id']),'tags':_0x21e861||[]};});}})[_0x1f48('0x1c')](respondWithResult(_0x4d9f00,null))['catch'](handleError(_0x4d9f00,null));};exports[_0x1f48('0x54')]=function(_0x51961f,_0x3a5796){return db[_0x1f48('0x2c')]['find']({'where':{'id':_0x51961f[_0x1f48('0x2a')]['id']}})[_0x1f48('0x1c')](handleEntityNotFound(_0x3a5796,null))[_0x1f48('0x1c')](function(_0x56fdc0){if(_0x56fdc0){return _0x56fdc0[_0x1f48('0x54')](_0x51961f[_0x1f48('0x26')][_0x1f48('0x3d')]);}})[_0x1f48('0x1c')](respondWithStatusCode(_0x3a5796,null))[_0x1f48('0x28')](handleError(_0x3a5796,null));};exports[_0x1f48('0x55')]=function(_0x394ecf,_0x28c37e){var _0x5df473=moment()[_0x1f48('0x56')]()[_0x1f48('0x57')]();var _0x570b8d=path['join'](config[_0x1f48('0x58')],_0x1f48('0x59'),_0x1f48('0x5a'),_0x1f48('0x5b'));var _0x578133=path[_0x1f48('0x5c')](config['root'],'server',_0x1f48('0x5a'),_0x1f48('0x5d'));var _0x718ff=path[_0x1f48('0x5c')](_0x570b8d,_0x5df473);var _0x44e8e2=util[_0x1f48('0x4b')](_0x1f48('0x5e'),_0x394ecf[_0x1f48('0x2a')]['id'],_0x5df473);var _0x35ff8a=path['join'](_0x570b8d,_0x44e8e2);var _0x38f138=[];if(_0x394ecf[_0x1f48('0x26')]['attachments']){_0x38f138[_0x1f48('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x257127=[{'model':db[_0x1f48('0x40')],'as':_0x1f48('0x60'),'attributes':['id',_0x1f48('0x39'),_0x1f48('0x61'),'to','cc',_0x1f48('0x62'),_0x1f48('0x63'),'createdAt'],'where':{'secret':![]},'order':qs[_0x1f48('0x43')]('id'),'include':_0x38f138}];return db['MailInteraction'][_0x1f48('0x37')]({'where':{'id':_0x394ecf[_0x1f48('0x2a')]['id']},'include':_0x257127})['then'](handleEntityNotFound(_0x28c37e,null))[_0x1f48('0x1c')](function(_0x49a506){if(_0x49a506&&_0x49a506['Messages']){var _0x499180=_0x49a506['get']({'plain':!![]});fs[_0x1f48('0x64')](_0x718ff);return BPromise[_0x1f48('0x65')](_0x499180[_0x1f48('0x60')],function(_0x147382,_0x33c19b){var _0x5943db={'from':_0x147382[_0x1f48('0x61')],'to':_0x147382['to']||'missing.recipient@your.company.com','subject':_0x147382[_0x1f48('0x63')],'html':htmlEntities['decode'](_0x147382[_0x1f48('0x39')]),'headers':{'Date':moment(_0x147382[_0x1f48('0x66')])['format'](_0x1f48('0x67'))},'attachments':[]};if(_0x147382['cc']){_0x5943db[_0x1f48('0x68')]['Cc']=_0x147382['cc'];}if(_0x147382[_0x1f48('0x62')]){_0x5943db['headers']['Bcc']=_0x147382[_0x1f48('0x62')];}return new BPromise(function(_0x1773c3,_0x286058){if(_0x147382['Attachments']){for(var _0x53ec53=0x0;_0x53ec53<_0x147382[_0x1f48('0x69')]['length'];_0x53ec53++){var _0x4a9957=_0x147382[_0x1f48('0x69')][_0x53ec53];var _0x4de9b7=path['join'](_0x578133,_0x4a9957[_0x1f48('0x6a')]);if(fs[_0x1f48('0x6b')](_0x4de9b7)){_0x5943db['attachments'][_0x1f48('0x5f')]({'name':_0x4a9957[_0x1f48('0x51')],'contentType':_0x4a9957[_0x1f48('0x22')],'data':fs[_0x1f48('0x6c')](_0x4de9b7)});}}}emlformat[_0x1f48('0x6d')](_0x5943db,function(_0x209125,_0x32e397){if(_0x209125)return _0x286058(_0x209125);fs['writeFileSync'](path[_0x1f48('0x5c')](_0x718ff,util[_0x1f48('0x4b')]('message%d.eml',_0x33c19b)),_0x32e397);return _0x1773c3(_0x32e397);});});})['then'](function(){return new BPromise(function(_0x2cfb5b,_0x228a7d){zipdir(_0x718ff,{'saveTo':_0x35ff8a},function(_0x3a00fb,_0x4fed4f){if(_0x3a00fb)return _0x228a7d(_0x3a00fb);return _0x2cfb5b(_0x4fed4f);});})['then'](function(){return new BPromise(function(_0x106b80,_0x2fe869){rimraf(_0x718ff,function(_0x477813){if(_0x477813)_0x2fe869(_0x477813);return _0x106b80();});});})['then'](function(){return _0x28c37e[_0x1f48('0x55')](_0x35ff8a,_0x44e8e2,function(_0x55ed79){if(!_0x55ed79)fs[_0x1f48('0x6e')](_0x35ff8a);});});});}else{return _0x28c37e['sendStatus'](0xc8);}})[_0x1f48('0x28')](handleError(_0x28c37e,null));}; \ No newline at end of file +var _0x3873=['util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','limit','count','offset','set','Content-Range','update','destroy','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','then','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','create','body','find','describe','addMessage','MailMessage','ids','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','format','rows','omit','spread','emit','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','get','mkdirSync','each','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0xfff214,_0x32e780){var _0x1c2f1b=function(_0x6b475f){while(--_0x6b475f){_0xfff214['push'](_0xfff214['shift']());}};_0x1c2f1b(++_0x32e780);}(_0x3873,0x136));var _0x3387=function(_0x1f8292,_0x3eb418){_0x1f8292=_0x1f8292-0x0;var _0x3a9bf2=_0x3873[_0x1f8292];return _0x3a9bf2;};'use strict';var emlformat=require(_0x3387('0x0'));var rimraf=require(_0x3387('0x1'));var zipdir=require(_0x3387('0x2'));var moment=require(_0x3387('0x3'));var BPromise=require(_0x3387('0x4'));var util=require(_0x3387('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x3387('0x6'));var juice=require(_0x3387('0x7'));var Redis=require(_0x3387('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x3387('0x9'));var logger=require(_0x3387('0xa'))('api');var config=require('../../config/environment');var db=require(_0x3387('0xb'))['db'];var htmlEntities=require(_0x3387('0xc'));config[_0x3387('0xd')]=_['defaults'](config[_0x3387('0xd')],{'host':_0x3387('0xe'),'port':0x18eb});var socket=require(_0x3387('0xf'))(new Redis(config[_0x3387('0xd')]));require(_0x3387('0x10'))[_0x3387('0x11')](socket);function respondWithStatusCode(_0x38dedb,_0x556787){_0x556787=_0x556787||0xcc;return function(_0x23f64b){if(_0x23f64b){return _0x38dedb[_0x3387('0x12')](_0x556787);}return _0x38dedb['status'](_0x556787)[_0x3387('0x13')]();};}function respondWithResult(_0x4de7b1,_0x1b0baa){_0x1b0baa=_0x1b0baa||0xc8;return function(_0x3a8eae){if(_0x3a8eae){return _0x4de7b1[_0x3387('0x14')](_0x1b0baa)[_0x3387('0x15')](_0x3a8eae);}};}function respondWithFilteredResult(_0x43a43d,_0x591b44){return function(_0x461985){if(_0x461985){var _0x412ebd=typeof _0x591b44['offset']==='undefined'&&typeof _0x591b44[_0x3387('0x16')]==='undefined';var _0x375f49=_0x461985[_0x3387('0x17')];var _0x3e3465=_0x412ebd?0x0:_0x591b44[_0x3387('0x18')];var _0x477736=_0x412ebd?_0x461985[_0x3387('0x17')]:_0x591b44[_0x3387('0x18')]+_0x591b44[_0x3387('0x16')];var _0x506309;if(_0x477736>=_0x375f49){_0x477736=_0x375f49;_0x506309=0xc8;}else{_0x506309=0xce;}_0x43a43d[_0x3387('0x14')](_0x506309);return _0x43a43d[_0x3387('0x19')](_0x3387('0x1a'),_0x3e3465+'-'+_0x477736+'/'+_0x375f49)[_0x3387('0x15')](_0x461985);}return null;};}function saveUpdates(_0x1a2fd9){return function(_0x5500b8){if(_0x5500b8){return _0x5500b8[_0x3387('0x1b')](_0x1a2fd9)['then'](function(_0x16e16d){return _0x16e16d;});}return null;};}function removeEntity(_0x7b8828){return function(_0x4711d8){if(_0x4711d8){return _0x4711d8[_0x3387('0x1c')]()['then'](function(){_0x7b8828[_0x3387('0x14')](0xcc)[_0x3387('0x13')]();});}};}function handleEntityNotFound(_0x3eedce){return function(_0xcf1b95){if(!_0xcf1b95){_0x3eedce[_0x3387('0x12')](0x194);}return _0xcf1b95;};}function handleError(_0x16450f,_0x3a0f73){_0x3a0f73=_0x3a0f73||0x1f4;return function(_0x2e4385){logger[_0x3387('0x1d')](_0x2e4385['stack']);if(_0x2e4385[_0x3387('0x1e')]){delete _0x2e4385[_0x3387('0x1e')];}_0x16450f[_0x3387('0x14')](_0x3a0f73)[_0x3387('0x1f')](_0x2e4385);};}exports[_0x3387('0x20')]=function(_0x7272fb,_0x48f046){var _0x49d6fc={};var _0x4dd5a7=_[_0x3387('0x21')](db[_0x3387('0x22')][_0x3387('0x23')],function(_0x1e6b05){return{'name':_0x1e6b05[_0x3387('0x24')],'type':_0x1e6b05[_0x3387('0x25')][_0x3387('0x26')]};});_0x49d6fc=qs[_0x3387('0x27')](_0x4dd5a7,_0x7272fb);return interaction[_0x3387('0x28')]('mail',_0x7272fb[_0x3387('0x29')],_0x7272fb[_0x3387('0x2a')],_0x49d6fc,_0x4dd5a7)[_0x3387('0x2b')](respondWithFilteredResult(_0x48f046,_0x49d6fc))[_0x3387('0x2c')](handleError(_0x48f046,null));};exports[_0x3387('0x2d')]=function(_0x314e47,_0x18f7e6){var _0xb7d935={'raw':![],'where':{'id':_0x314e47[_0x3387('0x2e')]['id']}},_0x4e3579={};_0x4e3579['model']=_[_0x3387('0x2f')](db[_0x3387('0x22')][_0x3387('0x23')]);_0x4e3579[_0x3387('0x29')]=_[_0x3387('0x2f')](_0x314e47[_0x3387('0x29')]);_0x4e3579[_0x3387('0x30')]=_[_0x3387('0x31')](_0x4e3579[_0x3387('0x32')],_0x4e3579[_0x3387('0x29')]);_0xb7d935[_0x3387('0x33')]=_[_0x3387('0x31')](_0x4e3579[_0x3387('0x32')],qs[_0x3387('0x34')](_0x314e47[_0x3387('0x29')][_0x3387('0x34')]));_0xb7d935[_0x3387('0x33')]=_0xb7d935[_0x3387('0x33')]['length']?_0xb7d935['attributes']:_0x4e3579[_0x3387('0x32')];if(_0x314e47['query'][_0x3387('0x35')]){_0xb7d935['include']=[{'all':!![]}];}_0xb7d935=_[_0x3387('0x36')]({},_0xb7d935,_0x314e47[_0x3387('0x37')]);return db['MailInteraction']['find'](_0xb7d935)[_0x3387('0x2b')](handleEntityNotFound(_0x18f7e6,null))[_0x3387('0x2b')](respondWithResult(_0x18f7e6,null))[_0x3387('0x2c')](handleError(_0x18f7e6,null));};exports[_0x3387('0x38')]=function(_0x1cc9ba,_0x2fb3f8){return db[_0x3387('0x22')][_0x3387('0x38')](_0x1cc9ba[_0x3387('0x39')],{})[_0x3387('0x2b')](respondWithResult(_0x2fb3f8,0xc9))[_0x3387('0x2c')](handleError(_0x2fb3f8,null));};exports['update']=function(_0x470cef,_0x32a549){if(_0x470cef[_0x3387('0x39')]['id']){delete _0x470cef[_0x3387('0x39')]['id'];}return db[_0x3387('0x22')][_0x3387('0x3a')]({'where':{'id':_0x470cef[_0x3387('0x2e')]['id']}})['then'](handleEntityNotFound(_0x32a549,null))[_0x3387('0x2b')](saveUpdates(_0x470cef[_0x3387('0x39')],null))[_0x3387('0x2b')](respondWithResult(_0x32a549,null))[_0x3387('0x2c')](handleError(_0x32a549,null));};exports[_0x3387('0x1c')]=function(_0xc7256c,_0x3c1c62){return db[_0x3387('0x22')][_0x3387('0x3a')]({'where':{'id':_0xc7256c[_0x3387('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3c1c62,null))[_0x3387('0x2b')](removeEntity(_0x3c1c62,null))[_0x3387('0x2c')](handleError(_0x3c1c62,null));};exports[_0x3387('0x3b')]=function(_0x37146e,_0x22a766){return db['MailInteraction'][_0x3387('0x3b')]()[_0x3387('0x2b')](respondWithResult(_0x22a766,null))[_0x3387('0x2c')](handleError(_0x22a766,null));};exports[_0x3387('0x3c')]=function(_0x4c3c4d,_0x4bba49){return db[_0x3387('0x3d')]['find']({'where':{'id':_0x4c3c4d[_0x3387('0x2e')]['id']}})[_0x3387('0x2b')](handleEntityNotFound(_0x4bba49,null))['then'](function(_0x11688f){if(_0x11688f){return _0x11688f[_0x3387('0x3c')](_0x4c3c4d['body'][_0x3387('0x3e')],_['omit'](_0x4c3c4d[_0x3387('0x39')],[_0x3387('0x3e'),'id'])||{});}})[_0x3387('0x2b')](respondWithResult(_0x4bba49,null))[_0x3387('0x2c')](handleError(_0x4bba49,null));};exports['getMessages']=function(_0x579d83,_0x4f29ab){var _0x470dc5={'raw':![],'where':{}};var _0x40d2a6={};var _0x5cf80a={'count':0x0,'rows':[]};return db[_0x3387('0x22')][_0x3387('0x3f')]({'where':{'id':_0x579d83[_0x3387('0x2e')]['id']}})[_0x3387('0x2b')](handleEntityNotFound(_0x4f29ab,null))['then'](function(_0x56d8e8){if(_0x56d8e8){_0x40d2a6[_0x3387('0x32')]=_[_0x3387('0x2f')](db[_0x3387('0x3d')]['rawAttributes']);_0x40d2a6['query']=_[_0x3387('0x2f')](_0x579d83[_0x3387('0x29')]);_0x40d2a6[_0x3387('0x30')]=_[_0x3387('0x31')](_0x40d2a6[_0x3387('0x32')],_0x40d2a6[_0x3387('0x29')]);_0x470dc5[_0x3387('0x33')]=_[_0x3387('0x31')](_0x40d2a6[_0x3387('0x32')],qs[_0x3387('0x34')](_0x579d83[_0x3387('0x29')]['fields']));_0x470dc5[_0x3387('0x33')]=_0x470dc5[_0x3387('0x33')][_0x3387('0x40')]?_0x470dc5['attributes']:_0x40d2a6['model'];if(!_0x579d83[_0x3387('0x29')][_0x3387('0x41')](_0x3387('0x42'))){_0x470dc5[_0x3387('0x16')]=qs[_0x3387('0x16')](_0x579d83['query'][_0x3387('0x16')]);_0x470dc5['offset']=qs[_0x3387('0x18')](_0x579d83[_0x3387('0x29')][_0x3387('0x18')]);}_0x470dc5[_0x3387('0x43')]=qs['sort'](_0x579d83[_0x3387('0x29')][_0x3387('0x44')]);_0x470dc5[_0x3387('0x45')]=qs[_0x3387('0x30')](_[_0x3387('0x46')](_0x579d83[_0x3387('0x29')],_0x40d2a6[_0x3387('0x30')]));_0x470dc5[_0x3387('0x45')][_0x3387('0x47')]=_0x56d8e8['id'];if(_0x579d83[_0x3387('0x29')][_0x3387('0x48')]){_0x470dc5[_0x3387('0x45')]=_['merge'](_0x470dc5['where'],{'$or':_[_0x3387('0x21')](_0x470dc5[_0x3387('0x33')],function(_0x2fbab6){var _0x161f55={};_0x161f55[_0x2fbab6]={'$like':'%'+_0x579d83[_0x3387('0x29')][_0x3387('0x48')]+'%'};return _0x161f55;})});}if(_0x579d83[_0x3387('0x29')]['$gte']){var _0x35cc7d=_0x579d83[_0x3387('0x29')]['$gte']['split'](',');var _0x208e58={};_0x208e58[_0x35cc7d[0x0]]={'$gte':moment(_0x35cc7d[0x1])[_0x3387('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x470dc5['where']=_[_0x3387('0x36')](_0x470dc5[_0x3387('0x45')],_0x208e58);}_0x470dc5=_[_0x3387('0x36')]({},_0x470dc5,_0x579d83[_0x3387('0x37')]);return db[_0x3387('0x3d')]['count']({'where':_0x470dc5['where']})[_0x3387('0x2b')](function(_0x533585){_0x5cf80a[_0x3387('0x17')]=_0x533585;if(_0x579d83[_0x3387('0x29')][_0x3387('0x35')]){_0x470dc5['include']=[{'all':!![]}];}return db[_0x3387('0x3d')][_0x3387('0x28')](_0x470dc5);})['then'](function(_0x636748){if(_0x579d83['query']['inlineCss']==='true'){for(var _0x19bcfa=0x0;_0x19bcfa<_0x636748[_0x3387('0x40')];_0x19bcfa++){_0x636748[_0x19bcfa][_0x3387('0x39')]=juice(_0x636748[_0x19bcfa][_0x3387('0x39')]);}}_0x5cf80a[_0x3387('0x4a')]=_0x636748;return _0x5cf80a;});}})[_0x3387('0x2b')](respondWithFilteredResult(_0x4f29ab,_0x470dc5))[_0x3387('0x2c')](handleError(_0x4f29ab,null));};exports['addTags']=function(_0x397fc8,_0x37fdce){return db[_0x3387('0x22')]['find']({'where':{'id':_0x397fc8[_0x3387('0x2e')]['id']}})[_0x3387('0x2b')](handleEntityNotFound(_0x37fdce,null))['then'](function(_0x227145){if(_0x227145){return _0x227145['setTags'](_0x397fc8[_0x3387('0x39')][_0x3387('0x3e')],_[_0x3387('0x4b')](_0x397fc8['body'],[_0x3387('0x3e'),'id'])||{})[_0x3387('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x397fc8[_0x3387('0x39')][_0x3387('0x3e')]}});})['then'](function(_0x49aa89){socket[_0x3387('0x4d')]('mailInteractionTags:save',{'id':Number(_0x397fc8[_0x3387('0x2e')]['id']),'tags':_0x49aa89||[]});return{'id':Number(_0x397fc8[_0x3387('0x2e')]['id']),'tags':_0x49aa89||[]};});}})[_0x3387('0x2b')](respondWithResult(_0x37fdce,null))[_0x3387('0x2c')](handleError(_0x37fdce,null));};exports[_0x3387('0x4e')]=function(_0x4f5c20,_0x53931c){return db['MailInteraction']['find']({'where':{'id':_0x4f5c20[_0x3387('0x2e')]['id']}})[_0x3387('0x2b')](handleEntityNotFound(_0x53931c,null))['then'](function(_0x1784d7){if(_0x1784d7){return _0x1784d7[_0x3387('0x4e')](_0x4f5c20[_0x3387('0x29')][_0x3387('0x3e')]);}})['then'](respondWithStatusCode(_0x53931c,null))[_0x3387('0x2c')](handleError(_0x53931c,null));};exports[_0x3387('0x4f')]=function(_0x3cfea3,_0x3991b7){var _0x2cf58b=moment()['unix']()[_0x3387('0x50')]();var _0x2dbd15=path[_0x3387('0x51')](config[_0x3387('0x52')],_0x3387('0x53'),_0x3387('0x54'),_0x3387('0x55'));var _0x1dc9ce=path['join'](config['root'],_0x3387('0x53'),_0x3387('0x54'),_0x3387('0x56'));var _0x2b0c12=path[_0x3387('0x51')](_0x2dbd15,_0x2cf58b);var _0x2cb921=util['format'](_0x3387('0x57'),_0x3cfea3['params']['id'],_0x2cf58b);var _0xe83037=path[_0x3387('0x51')](_0x2dbd15,_0x2cb921);var _0x4d4159=[];if(_0x3cfea3[_0x3387('0x29')]['attachments']){_0x4d4159[_0x3387('0x58')]({'model':db[_0x3387('0x59')],'as':_0x3387('0x5a'),'raw':!![]});}var _0x73c666=[{'model':db['MailMessage'],'as':_0x3387('0x5b'),'attributes':['id','body',_0x3387('0x5c'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs[_0x3387('0x44')]('id'),'include':_0x4d4159}];return db['MailInteraction'][_0x3387('0x3a')]({'where':{'id':_0x3cfea3[_0x3387('0x2e')]['id']},'include':_0x73c666})['then'](handleEntityNotFound(_0x3991b7,null))[_0x3387('0x2b')](function(_0x3c901c){if(_0x3c901c&&_0x3c901c[_0x3387('0x5b')]){var _0x24c145=_0x3c901c[_0x3387('0x5d')]({'plain':!![]});fs[_0x3387('0x5e')](_0x2b0c12);return BPromise[_0x3387('0x5f')](_0x24c145[_0x3387('0x5b')],function(_0x1350ec,_0x5269f1){var _0x3abd1f={'from':_0x1350ec['from'],'to':_0x1350ec['to']||'missing.recipient@your.company.com','subject':_0x1350ec['subject'],'html':htmlEntities['decode'](_0x1350ec['body']),'headers':{'Date':moment(_0x1350ec[_0x3387('0x60')])[_0x3387('0x49')](_0x3387('0x61'))},'attachments':[]};if(_0x1350ec['cc']){_0x3abd1f[_0x3387('0x62')]['Cc']=_0x1350ec['cc'];}if(_0x1350ec[_0x3387('0x63')]){_0x3abd1f[_0x3387('0x62')][_0x3387('0x64')]=_0x1350ec[_0x3387('0x63')];}return new BPromise(function(_0x2ceb7f,_0x2a8d01){if(_0x1350ec['Attachments']){for(var _0x15ef1f=0x0;_0x15ef1f<_0x1350ec[_0x3387('0x5a')]['length'];_0x15ef1f++){var _0x459646=_0x1350ec[_0x3387('0x5a')][_0x15ef1f];var _0x9bac4d=path[_0x3387('0x51')](_0x1dc9ce,_0x459646[_0x3387('0x65')]);if(fs[_0x3387('0x66')](_0x9bac4d)){_0x3abd1f[_0x3387('0x56')]['push']({'name':_0x459646[_0x3387('0x1e')],'contentType':_0x459646[_0x3387('0x25')],'data':fs['readFileSync'](_0x9bac4d)});}}}emlformat['build'](_0x3abd1f,function(_0x5cb031,_0x7d89c){if(_0x5cb031)return _0x2a8d01(_0x5cb031);fs[_0x3387('0x67')](path[_0x3387('0x51')](_0x2b0c12,util[_0x3387('0x49')](_0x3387('0x68'),_0x5269f1)),_0x7d89c);return _0x2ceb7f(_0x7d89c);});});})[_0x3387('0x2b')](function(){return new BPromise(function(_0x43e3a1,_0x1326c8){zipdir(_0x2b0c12,{'saveTo':_0xe83037},function(_0x3d345b,_0x35f963){if(_0x3d345b)return _0x1326c8(_0x3d345b);return _0x43e3a1(_0x35f963);});})[_0x3387('0x2b')](function(){return new BPromise(function(_0x205cc8,_0x1ef906){rimraf(_0x2b0c12,function(_0x19abe6){if(_0x19abe6)_0x1ef906(_0x19abe6);return _0x205cc8();});});})[_0x3387('0x2b')](function(){return _0x3991b7[_0x3387('0x4f')](_0xe83037,_0x2cb921,function(_0x5ba556){if(!_0x5ba556)fs['unlinkSync'](_0xe83037);});});});}else{return _0x3991b7[_0x3387('0x12')](0xc8);}})[_0x3387('0x2c')](handleError(_0x3991b7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 22eca12..b9578df 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 _0x1d86=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','setDataValue','map','findAll','then','unreadMessages'];(function(_0x4b4fc6,_0x127b45){var _0x33172a=function(_0x1ab4d0){while(--_0x1ab4d0){_0x4b4fc6['push'](_0x4b4fc6['shift']());}};_0x33172a(++_0x127b45);}(_0x1d86,0x7e));var _0x61d8=function(_0x1ea962,_0x3c5f40){_0x1ea962=_0x1ea962-0x0;var _0x4bd31e=_0x1d86[_0x1ea962];return _0x4bd31e;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x61d8('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x61d8('0x1')](0x0);var events={'afterCreate':_0x61d8('0x2'),'afterUpdate':'update','afterDestroy':_0x61d8('0x3')};function emitEvent(_0x1d170a){return function(_0x2e4ab8,_0x4ee0d4,_0x18b56f){_0x2e4ab8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1e1f22){_0x2e4ab8[_0x61d8('0x4')]('Users',_0x1e1f22[_0x61d8('0x5')](function(_0x44753b){return{'id':_0x44753b['id']};}));return MailMessage[_0x61d8('0x6')]({'where':{'MailInteractionId':_0x2e4ab8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x61d8('0x7')](function(_0xa35e78){_0x2e4ab8[_0x61d8('0x4')](_0x61d8('0x8'),_0xa35e78[_0x61d8('0x9')]);MailInteractionEvents[_0x61d8('0xa')](_0x1d170a+':'+_0x2e4ab8['id'],_0x2e4ab8);MailInteractionEvents['emit'](_0x1d170a,_0x2e4ab8);_0x18b56f(null);})[_0x61d8('0xb')](_0x18b56f(null));};}for(var e in events){if(events[_0x61d8('0xc')](e)){var event=events[e];MailInteraction[_0x61d8('0xd')](e,emitEvent(event));}}module[_0x61d8('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x4cdf=['MailMessage','save','update','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','MailInteraction','../../mysqldb'];(function(_0x45e1dd,_0x30d1d3){var _0x1b93ff=function(_0x4a8fba){while(--_0x4a8fba){_0x45e1dd['push'](_0x45e1dd['shift']());}};_0x1b93ff(++_0x30d1d3);}(_0x4cdf,0x10d));var _0xf4cd=function(_0x5bfbf8,_0x4e5f13){_0x5bfbf8=_0x5bfbf8-0x0;var _0x363a3c=_0x4cdf[_0x5bfbf8];return _0x363a3c;};'use strict';var EventEmitter=require(_0xf4cd('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xf4cd('0x1')];var MailMessage=require(_0xf4cd('0x2'))['db'][_0xf4cd('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf4cd('0x4'),'afterUpdate':_0xf4cd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x512989){return function(_0x3abb97,_0x3aac3e,_0x97daf7){_0x3abb97['getUsers']({'attributes':['id'],'raw':!![]})[_0xf4cd('0x6')](function(_0x3ff5cf){_0x3abb97['setDataValue'](_0xf4cd('0x7'),_0x3ff5cf[_0xf4cd('0x8')](function(_0x2a0061){return{'id':_0x2a0061['id']};}));return MailMessage[_0xf4cd('0x9')]({'where':{'MailInteractionId':_0x3abb97['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x79c56a){_0x3abb97[_0xf4cd('0xa')](_0xf4cd('0xb'),_0x79c56a['length']);MailInteractionEvents[_0xf4cd('0xc')](_0x512989+':'+_0x3abb97['id'],_0x3abb97);MailInteractionEvents[_0xf4cd('0xc')](_0x512989,_0x3abb97);_0x97daf7(null);})[_0xf4cd('0xd')](_0x97daf7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf4cd('0xe')](e,emitEvent(event));}}module[_0xf4cd('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 55d29c8..7af8031 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 _0xa661=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','define','MailInteraction','mail_interactions','subject','substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','substatusAt','models','get','then','utf8mb4'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa661,0xfb));var _0x1a66=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0xa661[_0x107f10];return _0x811cab;};'use strict';var _=require(_0x1a66('0x0'));var util=require(_0x1a66('0x1'));var logger=require('../../config/logger')(_0x1a66('0x2'));var moment=require(_0x1a66('0x3'));var BPromise=require(_0x1a66('0x4'));var rp=require(_0x1a66('0x5'));var fs=require('fs');var path=require(_0x1a66('0x6'));var rimraf=require(_0x1a66('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a66('0x8'));module['exports']=function(_0x30eea9,_0x2605db){return _0x30eea9[_0x1a66('0x9')](_0x1a66('0xa'),attributes,{'tableName':_0x1a66('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1a66('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e2892,_0x4e321d,_0x2a7716){if(_0x4e2892[_0x1a66('0xd')]){_0x4e2892['substatusAt']=moment()['format'](_0x1a66('0xe'));}if(_0x4e2892['closed']){_0x4e2892[_0x1a66('0xf')]=moment()[_0x1a66('0x10')](_0x1a66('0xe'));}_0x2a7716(null,_0x4e321d);},'beforeUpdate':function(_0x4f7d13,_0x410fb7,_0xc0ceba){if(_0x4f7d13['changed'](_0x1a66('0xd'))){_0x4f7d13['substatusAt']=_0x4f7d13[_0x1a66('0xd')]?moment()[_0x1a66('0x10')](_0x1a66('0xe')):null;}if(_0x4f7d13[_0x1a66('0x11')](_0x1a66('0x12'))){_0x4f7d13[_0x1a66('0xf')]=moment()[_0x1a66('0x10')](_0x1a66('0xe'));_0x4f7d13[_0x1a66('0xd')]=null;_0x4f7d13[_0x1a66('0x13')]=null;}_0xc0ceba(null,_0x4f7d13);},'afterUpdate':function(_0x1fda9e,_0x3d41e3,_0xb67934){var _0x32d75a=_0x30eea9[_0x1a66('0x14')];var _0x241b84=_0x1fda9e[_0x1a66('0x15')]({'plain':!![]});if(_0x241b84[_0x1a66('0x12')]){return _0x32d75a['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x241b84['id']}})[_0x1a66('0x16')](function(){_0xb67934();})['catch'](function(_0x3adae5){_0xb67934(_0x3adae5);});}else{_0xb67934();}}},'charset':_0x1a66('0x17'),'collate':_0x1a66('0x18')});}; \ No newline at end of file +var _0xa2d5=['request-promise','path','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models','get','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xa2d5,0x1e8));var _0x5a2d=function(_0x47440d,_0x39e22b){_0x47440d=_0x47440d-0x0;var _0x47eb09=_0xa2d5[_0x47440d];return _0x47eb09;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var logger=require(_0x5a2d('0x2'))(_0x5a2d('0x3'));var moment=require(_0x5a2d('0x4'));var BPromise=require(_0x5a2d('0x5'));var rp=require(_0x5a2d('0x6'));var fs=require('fs');var path=require(_0x5a2d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5a2d('0x8'));module[_0x5a2d('0x9')]=function(_0x59ba19,_0x2062b8){return _0x59ba19[_0x5a2d('0xa')]('MailInteraction',attributes,{'tableName':_0x5a2d('0xb'),'paranoid':![],'indexes':[{'name':_0x5a2d('0xc'),'fields':[_0x5a2d('0xd'),'to'],'type':_0x5a2d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x358bb2,_0x319c59,_0x53f2e3){if(_0x358bb2[_0x5a2d('0xf')]){_0x358bb2[_0x5a2d('0x10')]=moment()[_0x5a2d('0x11')](_0x5a2d('0x12'));}if(_0x358bb2['closed']){_0x358bb2['closedAt']=moment()[_0x5a2d('0x11')](_0x5a2d('0x12'));}_0x53f2e3(null,_0x319c59);},'beforeUpdate':function(_0x4c12f6,_0x45af38,_0x3b3988){if(_0x4c12f6[_0x5a2d('0x13')](_0x5a2d('0xf'))){_0x4c12f6[_0x5a2d('0x10')]=_0x4c12f6[_0x5a2d('0xf')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4c12f6[_0x5a2d('0x13')](_0x5a2d('0x14'))){_0x4c12f6[_0x5a2d('0x15')]=moment()['format'](_0x5a2d('0x12'));_0x4c12f6['substatus']=null;_0x4c12f6[_0x5a2d('0x10')]=null;}_0x3b3988(null,_0x4c12f6);},'afterUpdate':function(_0x53df14,_0xac9b01,_0x3a1eda){var _0x514d22=_0x59ba19[_0x5a2d('0x16')];var _0x590620=_0x53df14[_0x5a2d('0x17')]({'plain':!![]});if(_0x590620[_0x5a2d('0x14')]){return _0x514d22['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x590620['id']}})['then'](function(){_0x3a1eda();})[_0x5a2d('0x18')](function(_0x44e8c2){_0x3a1eda(_0x44e8c2);});}else{_0x3a1eda();}}},'charset':'utf8mb4','collate':_0x5a2d('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b046328..0cdf406 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 _0x4932=['redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x4932,0x164));var _0x2493=function(_0x58b5d7,_0x79ca8a){_0x58b5d7=_0x58b5d7-0x0;var _0x817269=_0x4932[_0x58b5d7];return _0x817269;};'use strict';var _=require(_0x2493('0x0'));var util=require(_0x2493('0x1'));var moment=require(_0x2493('0x2'));var BPromise=require(_0x2493('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2493('0x4'));var db=require(_0x2493('0x5'))['db'];var utils=require(_0x2493('0x6'));var logger=require(_0x2493('0x7'))(_0x2493('0x8'));var config=require(_0x2493('0x9'));var jayson=require(_0x2493('0xa'));var client=jayson[_0x2493('0xb')]['http']({'port':0x232a});config[_0x2493('0xc')]=_['defaults'](config[_0x2493('0xc')],{'host':_0x2493('0xd'),'port':0x18eb});var socket=require(_0x2493('0xe'))(new Redis(config[_0x2493('0xc')]));require(_0x2493('0xf'))[_0x2493('0x10')](socket);function respondWithRpcPromise(_0xc522cf,_0x4caf35,_0x102984){return new BPromise(function(_0x306be1,_0x1f5d97){return client[_0x2493('0x11')](_0xc522cf,_0x102984)[_0x2493('0x12')](function(_0x43c5b1){logger[_0x2493('0x13')]('MailInteraction,\x20%s,\x20%s',_0x4caf35,_0x2493('0x14'));logger[_0x2493('0x15')](_0x2493('0x16'),_0x4caf35,_0x2493('0x14'),JSON['stringify'](_0x43c5b1));if(_0x43c5b1[_0x2493('0x17')]){if(_0x43c5b1[_0x2493('0x17')][_0x2493('0x18')]===0x1f4){logger['error'](_0x2493('0x19'),_0x4caf35,_0x43c5b1[_0x2493('0x17')][_0x2493('0x1a')]);return _0x1f5d97(_0x43c5b1['error'][_0x2493('0x1a')]);}logger[_0x2493('0x17')](_0x2493('0x19'),_0x4caf35,_0x43c5b1['error'][_0x2493('0x1a')]);return _0x306be1(_0x43c5b1[_0x2493('0x17')][_0x2493('0x1a')]);}else{logger[_0x2493('0x13')](_0x2493('0x19'),_0x4caf35,'request\x20sent');_0x306be1(_0x43c5b1[_0x2493('0x1b')]['message']);}})[_0x2493('0x1c')](function(_0x4903fa){logger['error'](_0x2493('0x19'),_0x4caf35,_0x4903fa);_0x1f5d97(_0x4903fa);});});}exports[_0x2493('0x1d')]=function(_0x5c028a){var _0x73aa56=this;return new Promise(function(_0x547825,_0x409ddd){return db['MailInteraction'][_0x2493('0x1e')](_0x5c028a[_0x2493('0x1f')],{'raw':_0x5c028a[_0x2493('0x20')]?_0x5c028a['options'][_0x2493('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c028a['options']?_0x5c028a[_0x2493('0x20')][_0x2493('0x22')]||null:null,'attributes':_0x5c028a['options']?_0x5c028a['options'][_0x2493('0x23')]||null:null,'limit':_0x5c028a[_0x2493('0x20')]?_0x5c028a[_0x2493('0x20')][_0x2493('0x24')]||null:null})[_0x2493('0x12')](function(_0x4c4094){logger['info'](_0x2493('0x1d'),_0x5c028a);logger[_0x2493('0x15')]('UpdateMailInteraction',_0x5c028a,JSON[_0x2493('0x25')](_0x4c4094));_0x547825(_0x4c4094);})[_0x2493('0x1c')](function(_0x1e5a24){logger['error']('UpdateMailInteraction',_0x1e5a24[_0x2493('0x1a')],_0x5c028a);_0x409ddd(_0x73aa56[_0x2493('0x17')](0x1f4,_0x1e5a24['message']));});});};exports[_0x2493('0x26')]=function(_0x2687b5){return new Promise(function(_0x1c47af,_0x1f1095){return db[_0x2493('0x27')][_0x2493('0x28')]({'where':_0x2687b5[_0x2493('0x20')]?_0x2687b5['options'][_0x2493('0x22')]||null:null})[_0x2493('0x12')](function(_0x2bbe9b){if(_0x2bbe9b){return _0x2bbe9b[_0x2493('0x29')](_0x2687b5[_0x2493('0x1f')][_0x2493('0x2a')],_[_0x2493('0x2b')](_0x2687b5[_0x2493('0x1f')],[_0x2493('0x2a'),'id'])||{});}})[_0x2493('0x2c')](function(_0x2fd281){logger['info'](_0x2493('0x2d'),_0x2687b5);logger[_0x2493('0x15')](_0x2493('0x2d'),_0x2687b5,JSON[_0x2493('0x25')](_0x2fd281));_0x1c47af(_0x2fd281);})[_0x2493('0x1c')](function(_0x5a80a8){logger[_0x2493('0x17')]('AddTags',_0x5a80a8[_0x2493('0x1a')],_0x2687b5);_0x1f1095(_this[_0x2493('0x17')](0x1f4,_0x5a80a8[_0x2493('0x1a')]));});});}; \ No newline at end of file +var _0x1560=['http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x407fb2,_0x4b6813){var _0xfde875=function(_0x131120){while(--_0x131120){_0x407fb2['push'](_0x407fb2['shift']());}};_0xfde875(++_0x4b6813);}(_0x1560,0x155));var _0x0156=function(_0xe5b87d,_0x3241d1){_0xe5b87d=_0xe5b87d-0x0;var _0x5f2391=_0x1560[_0xe5b87d];return _0x5f2391;};'use strict';var _=require(_0x0156('0x0'));var util=require('util');var moment=require(_0x0156('0x1'));var BPromise=require(_0x0156('0x2'));var rs=require(_0x0156('0x3'));var fs=require('fs');var Redis=require(_0x0156('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0156('0x5'));var logger=require(_0x0156('0x6'))(_0x0156('0x7'));var config=require(_0x0156('0x8'));var jayson=require(_0x0156('0x9'));var client=jayson[_0x0156('0xa')][_0x0156('0xb')]({'port':0x232a});config[_0x0156('0xc')]=_[_0x0156('0xd')](config[_0x0156('0xc')],{'host':_0x0156('0xe'),'port':0x18eb});var socket=require(_0x0156('0xf'))(new Redis(config['redis']));require(_0x0156('0x10'))[_0x0156('0x11')](socket);function respondWithRpcPromise(_0x1a4202,_0x4b4f4c,_0x2fea4b){return new BPromise(function(_0x4dd31b,_0x55b9a6){return client[_0x0156('0x12')](_0x1a4202,_0x2fea4b)[_0x0156('0x13')](function(_0x1a1478){logger[_0x0156('0x14')](_0x0156('0x15'),_0x4b4f4c,_0x0156('0x16'));logger[_0x0156('0x17')](_0x0156('0x18'),_0x4b4f4c,_0x0156('0x16'),JSON['stringify'](_0x1a1478));if(_0x1a1478['error']){if(_0x1a1478[_0x0156('0x19')][_0x0156('0x1a')]===0x1f4){logger['error'](_0x0156('0x15'),_0x4b4f4c,_0x1a1478[_0x0156('0x19')][_0x0156('0x1b')]);return _0x55b9a6(_0x1a1478['error']['message']);}logger[_0x0156('0x19')](_0x0156('0x15'),_0x4b4f4c,_0x1a1478[_0x0156('0x19')]['message']);return _0x4dd31b(_0x1a1478[_0x0156('0x19')]['message']);}else{logger[_0x0156('0x14')](_0x0156('0x15'),_0x4b4f4c,_0x0156('0x16'));_0x4dd31b(_0x1a1478[_0x0156('0x1c')]['message']);}})[_0x0156('0x1d')](function(_0x26b3d2){logger[_0x0156('0x19')](_0x0156('0x15'),_0x4b4f4c,_0x26b3d2);_0x55b9a6(_0x26b3d2);});});}exports[_0x0156('0x1e')]=function(_0x45af0e){var _0x50e848=this;return new Promise(function(_0x6f5dc9,_0x51bac0){return db['MailInteraction'][_0x0156('0x1f')](_0x45af0e[_0x0156('0x20')],{'raw':_0x45af0e[_0x0156('0x21')]?_0x45af0e['options'][_0x0156('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45af0e[_0x0156('0x21')]?_0x45af0e[_0x0156('0x21')]['where']||null:null,'attributes':_0x45af0e[_0x0156('0x21')]?_0x45af0e['options'][_0x0156('0x23')]||null:null,'limit':_0x45af0e[_0x0156('0x21')]?_0x45af0e[_0x0156('0x21')][_0x0156('0x24')]||null:null})['then'](function(_0x134730){logger[_0x0156('0x14')]('UpdateMailInteraction',_0x45af0e);logger['debug'](_0x0156('0x1e'),_0x45af0e,JSON['stringify'](_0x134730));_0x6f5dc9(_0x134730);})['catch'](function(_0x3ced7d){logger['error']('UpdateMailInteraction',_0x3ced7d[_0x0156('0x1b')],_0x45af0e);_0x51bac0(_0x50e848[_0x0156('0x19')](0x1f4,_0x3ced7d[_0x0156('0x1b')]));});});};exports[_0x0156('0x25')]=function(_0x485bfd){return new Promise(function(_0x41553f,_0x3187ef){return db[_0x0156('0x26')][_0x0156('0x27')]({'where':_0x485bfd[_0x0156('0x21')]?_0x485bfd[_0x0156('0x21')]['where']||null:null})['then'](function(_0x18b23a){if(_0x18b23a){return _0x18b23a[_0x0156('0x28')](_0x485bfd[_0x0156('0x20')]['ids'],_['omit'](_0x485bfd['body'],[_0x0156('0x29'),'id'])||{});}})['spread'](function(_0x24d467){logger[_0x0156('0x14')](_0x0156('0x2a'),_0x485bfd);logger[_0x0156('0x17')]('AddTags',_0x485bfd,JSON[_0x0156('0x2b')](_0x24d467));_0x41553f(_0x24d467);})[_0x0156('0x1d')](function(_0x309db3){logger[_0x0156('0x19')](_0x0156('0x2a'),_0x309db3[_0x0156('0x1b')],_0x485bfd);_0x3187ef(_this['error'](0x1f4,_0x309db3[_0x0156('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c374957..b4f83b0 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 _0x6b25=['remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x1a25da,_0x4910cb){var _0x251459=function(_0x52b1a9){while(--_0x52b1a9){_0x1a25da['push'](_0x1a25da['shift']());}};_0x251459(++_0x4910cb);}(_0x6b25,0x139));var _0x56b2=function(_0x3a1775,_0x267a48){_0x3a1775=_0x3a1775-0x0;var _0x2c2f43=_0x6b25[_0x3a1775];return _0x2c2f43;};'use strict';var MailInteractionEvents=require(_0x56b2('0x0'));var events=[_0x56b2('0x1'),_0x56b2('0x2'),_0x56b2('0x3')];function createListener(_0x218b88,_0x37a410){return function(_0x2eef15){_0x37a410[_0x56b2('0x4')](_0x218b88,_0x2eef15);};}function removeListener(_0x4ac563,_0x25e73c){return function(){MailInteractionEvents[_0x56b2('0x5')](_0x4ac563,_0x25e73c);};}exports[_0x56b2('0x6')]=function(_0x2dbedd){for(var _0x40e373=0x0,_0x2f1726=events[_0x56b2('0x7')];_0x40e373<_0x2f1726;_0x40e373++){var _0x15de19=events[_0x40e373];var _0x30cbdd=createListener(_0x56b2('0x8')+_0x15de19,_0x2dbedd);MailInteractionEvents['on'](_0x15de19,_0x30cbdd);}}; \ No newline at end of file +var _0xf20d=['removeListener','length','mailInteraction:','save','remove','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf20d,0x153));var _0xdf20=function(_0x31cbdc,_0x3e81f4){_0x31cbdc=_0x31cbdc-0x0;var _0x1d9bc9=_0xf20d[_0x31cbdc];return _0x1d9bc9;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xdf20('0x0'),_0xdf20('0x1'),_0xdf20('0x2')];function createListener(_0x3a1555,_0x4f722f){return function(_0x296ed0){_0x4f722f['emit'](_0x3a1555,_0x296ed0);};}function removeListener(_0x4a888d,_0x10109f){return function(){MailInteractionEvents[_0xdf20('0x3')](_0x4a888d,_0x10109f);};}exports['register']=function(_0x152024){for(var _0x12e81d=0x0,_0x5023f3=events[_0xdf20('0x4')];_0x12e81d<_0x5023f3;_0x12e81d++){var _0xbefc4c=events[_0x12e81d];var _0x4ebf33=createListener(_0xdf20('0x5')+_0xbefc4c,_0x152024);MailInteractionEvents['on'](_0xbefc4c,_0x4ebf33);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index abfe16e..9af0fe4 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 _0xb240=['./mailMessage.controller','get','isAuthenticated','index','describe','show','download','post','tracked','mail','mailmessage:create','create','/:id','put','/:id/accept','accept','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e2435,_0xc531a1){var _0x5d49e7=function(_0x214b4f){while(--_0x214b4f){_0x3e2435['push'](_0x3e2435['shift']());}};_0x5d49e7(++_0xc531a1);}(_0xb240,0x7e));var _0x0b24=function(_0x41944e,_0x133278){_0x41944e=_0x41944e-0x0;var _0x442308=_0xb240[_0x41944e];return _0x442308;};'use strict';var multer=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var path=require(_0x0b24('0x2'));var timeout=require(_0x0b24('0x3'));var express=require(_0x0b24('0x4'));var router=express[_0x0b24('0x5')]();var fs_extra=require(_0x0b24('0x6'));var auth=require(_0x0b24('0x7'));var interaction=require(_0x0b24('0x8'));var config=require('../../config/environment');var controller=require(_0x0b24('0x9'));router[_0x0b24('0xa')]('/',auth[_0x0b24('0xb')](),controller[_0x0b24('0xc')]);router[_0x0b24('0xa')]('/describe',auth[_0x0b24('0xb')](),controller[_0x0b24('0xd')]);router[_0x0b24('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0b24('0xe')]);router['get']('/:id/download',auth[_0x0b24('0xb')](),controller[_0x0b24('0xf')]);router[_0x0b24('0x10')]('/',auth[_0x0b24('0xb')](),interaction[_0x0b24('0x11')](_0x0b24('0x12'),_0x0b24('0x13')),controller[_0x0b24('0x14')]);router['put'](_0x0b24('0x15'),auth[_0x0b24('0xb')](),controller['update']);router[_0x0b24('0x16')](_0x0b24('0x17'),auth[_0x0b24('0xb')](),controller[_0x0b24('0x18')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x0b24('0x19')](_0x0b24('0x15'),auth[_0x0b24('0xb')](),controller['destroy']);module[_0x0b24('0x1a')]=router; \ No newline at end of file +var _0xb5fd=['get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','/:id/reject','reject','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0xb5fd,0x82));var _0xdb5f=function(_0x411020,_0x3a4970){_0x411020=_0x411020-0x0;var _0x2c8aa3=_0xb5fd[_0x411020];return _0x2c8aa3;};'use strict';var multer=require(_0xdb5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdb5f('0x1'));var express=require(_0xdb5f('0x2'));var router=express[_0xdb5f('0x3')]();var fs_extra=require(_0xdb5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdb5f('0x5'));var config=require(_0xdb5f('0x6'));var controller=require(_0xdb5f('0x7'));router['get']('/',auth[_0xdb5f('0x8')](),controller[_0xdb5f('0x9')]);router[_0xdb5f('0xa')](_0xdb5f('0xb'),auth[_0xdb5f('0x8')](),controller[_0xdb5f('0xc')]);router[_0xdb5f('0xa')](_0xdb5f('0xd'),auth[_0xdb5f('0x8')](),controller[_0xdb5f('0xe')]);router[_0xdb5f('0xa')](_0xdb5f('0xf'),auth[_0xdb5f('0x8')](),controller[_0xdb5f('0x10')]);router[_0xdb5f('0x11')]('/',auth['isAuthenticated'](),interaction[_0xdb5f('0x12')](_0xdb5f('0x13'),_0xdb5f('0x14')),controller[_0xdb5f('0x15')]);router['put']('/:id',auth[_0xdb5f('0x8')](),controller[_0xdb5f('0x16')]);router[_0xdb5f('0x17')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0xdb5f('0x18'),auth[_0xdb5f('0x8')](),controller[_0xdb5f('0x19')]);router[_0xdb5f('0x1a')](_0xdb5f('0xd'),auth['isAuthenticated'](),controller[_0xdb5f('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9fdc24c..5bf0d85 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 _0x21ab=['INTEGER','Email','Chat','sequelize','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5323e8,_0x1e38a8){var _0x1b1c32=function(_0xda9bdc){while(--_0xda9bdc){_0x5323e8['push'](_0x5323e8['shift']());}};_0x1b1c32(++_0x1e38a8);}(_0x21ab,0x7c));var _0xb21a=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x21ab[_0x1e03e4];return _0x4a887e;};'use strict';var Sequelize=require(_0xb21a('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xb21a('0x1')](_0xb21a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb21a('0x1')]('medium')},'read':{'type':Sequelize[_0xb21a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb21a('0x4')]('in','out'),'defaultValue':_0xb21a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb21a('0x6')](0x1fe)},'from':{'type':Sequelize[_0xb21a('0x6')]},'to':{'type':Sequelize[_0xb21a('0x1')](_0xb21a('0x2'))},'cc':{'type':Sequelize[_0xb21a('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xb21a('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xb21a('0x7')]},'attach':{'type':Sequelize[_0xb21a('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb21a('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb21a('0x7')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xb21a('0x1')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xb21a('0x9'),_0xb21a('0xa')),'defaultValue':_0xb21a('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x279a=['sequelize','lodash','BOOLEAN','ENUM','out','STRING','TEXT','long','DATE','Chat'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x279a,0xdc));var _0xa279=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x279a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa279('0x0'));var _=require(_0xa279('0x1'));module['exports']={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xa279('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa279('0x3')]('in',_0xa279('0x4')),'defaultValue':_0xa279('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa279('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa279('0x6')](_0xa279('0x7'))},'cc':{'type':Sequelize[_0xa279('0x6')](_0xa279('0x7'))},'bcc':{'type':Sequelize[_0xa279('0x6')](_0xa279('0x7'))},'subject':{'type':Sequelize[_0xa279('0x6')]},'sentAt':{'type':Sequelize[_0xa279('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa279('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa279('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xa279('0x7'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0xa279('0x3')]('Email',_0xa279('0x9')),'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 f2ddef3..ec7ba59 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 _0x0134=['name','index','MailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','length','find','update','body','params','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','fullname','event','rejectmessage','unix','toString','server','tmp','files','message-%s.eml','from','bcc','subject','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','type','build','writeFileSync','download','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0134,0x74));var _0x4013=function(_0x233b2a,_0x440cd1){_0x233b2a=_0x233b2a-0x0;var _0x4e828a=_0x0134[_0x233b2a];return _0x4e828a;};'use strict';var emlformat=require(_0x4013('0x0'));var moment=require(_0x4013('0x1'));var BPromise=require(_0x4013('0x2'));var util=require(_0x4013('0x3'));var path=require(_0x4013('0x4'));var fs=require('fs');var _=require(_0x4013('0x5'));var Redis=require(_0x4013('0x6'));var htmlToText=require(_0x4013('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4013('0x8'));var interaction_log=require('../../config/logger')(_0x4013('0x9'));var config=require(_0x4013('0xa'));var db=require(_0x4013('0xb'))['db'];config[_0x4013('0xc')]=_[_0x4013('0xd')](config[_0x4013('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4013('0xe'))(new Redis(config[_0x4013('0xc')]));var htmlEntities=require(_0x4013('0xf'));require('./mailMessage.socket')[_0x4013('0x10')](socket);var jayson=require(_0x4013('0x11'));var client=jayson['client'][_0x4013('0x12')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x4013('0x13')][_0x4013('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x3fb05f,_0x6acc5d,_0x508612,_0xa558f1){return new BPromise(function(_0x31ce4d,_0x449273){var _0x455912=_0xa558f1||client;return _0x455912[_0x4013('0x14')](_0x3fb05f,_0x508612)[_0x4013('0x15')](function(_0x306bac){logger[_0x4013('0x16')](_0x4013('0x17'),_0x6acc5d,'request\x20sent');logger['debug'](_0x4013('0x18'),_0x6acc5d,_0x4013('0x19'),JSON[_0x4013('0x1a')](_0x306bac));if(_0x306bac[_0x4013('0x1b')]){if(_0x306bac[_0x4013('0x1b')]['code']===0x1f4){logger[_0x4013('0x1b')]('MailMessage,\x20%s,\x20%s',_0x6acc5d,_0x306bac[_0x4013('0x1b')][_0x4013('0x1c')]);return _0x449273(_0x306bac[_0x4013('0x1b')][_0x4013('0x1c')]);}logger['error'](_0x4013('0x17'),_0x6acc5d,_0x306bac['error']['message']);return _0x31ce4d(_0x306bac[_0x4013('0x1b')][_0x4013('0x1c')]);}else{logger[_0x4013('0x16')]('MailMessage,\x20%s,\x20%s',_0x6acc5d,_0x4013('0x19'));_0x31ce4d(_0x306bac[_0x4013('0x1d')][_0x4013('0x1c')]);}})[_0x4013('0x1e')](function(_0x333858){logger[_0x4013('0x1b')]('MailMessage,\x20%s,\x20%s',_0x6acc5d,_0x333858);_0x449273(_0x333858);});});}function respondWithResult(_0x3d044e,_0x260066){_0x260066=_0x260066||0xc8;return function(_0x424696){if(_0x424696){return _0x3d044e[_0x4013('0x1f')](_0x260066)['json'](_0x424696);}};}function respondWithFilteredResult(_0x262db5,_0x2befb2){return function(_0x22ad2e){if(_0x22ad2e){var _0x579dc6=typeof _0x2befb2[_0x4013('0x20')]==='undefined'&&typeof _0x2befb2[_0x4013('0x21')]===_0x4013('0x22');var _0x15e397=_0x22ad2e[_0x4013('0x23')];var _0x380bf2=_0x579dc6?0x0:_0x2befb2[_0x4013('0x20')];var _0x4c314d=_0x579dc6?_0x22ad2e['count']:_0x2befb2[_0x4013('0x20')]+_0x2befb2[_0x4013('0x21')];var _0x2eff72;if(_0x4c314d>=_0x15e397){_0x4c314d=_0x15e397;_0x2eff72=0xc8;}else{_0x2eff72=0xce;}_0x262db5[_0x4013('0x1f')](_0x2eff72);return _0x262db5[_0x4013('0x24')](_0x4013('0x25'),_0x380bf2+'-'+_0x4c314d+'/'+_0x15e397)['json'](_0x22ad2e);}return null;};}function saveUpdates(_0x3d6ded){return function(_0x450ef2){if(_0x450ef2){return _0x450ef2['update'](_0x3d6ded)[_0x4013('0x15')](function(_0x3416ec){return _0x3416ec;});}return null;};}function removeEntity(_0x12e064){return function(_0x5121e8){if(_0x5121e8){return _0x5121e8[_0x4013('0x26')]()[_0x4013('0x15')](function(){_0x12e064[_0x4013('0x1f')](0xcc)[_0x4013('0x27')]();});}};}function handleEntityNotFound(_0x315c55){return function(_0x5087ce){if(!_0x5087ce){_0x315c55[_0x4013('0x28')](0x194);}return _0x5087ce;};}function handleError(_0x5c154b,_0x48e3b3){_0x48e3b3=_0x48e3b3||0x1f4;return function(_0x5ba23c){logger['error'](_0x5ba23c[_0x4013('0x29')]);if(_0x5ba23c[_0x4013('0x2a')]){delete _0x5ba23c[_0x4013('0x2a')];}_0x5c154b[_0x4013('0x1f')](_0x48e3b3)['send'](_0x5ba23c);};}exports[_0x4013('0x2b')]=function(_0x4a5148,_0x54a94d){var _0x4ab56c={},_0x555beb={},_0x143b40={'count':0x0,'rows':[]};var _0x4e1251=_['map'](db[_0x4013('0x2c')][_0x4013('0x2d')],function(_0x163cee){return{'name':_0x163cee[_0x4013('0x2e')],'type':_0x163cee['type'][_0x4013('0x2f')]};});_0x555beb[_0x4013('0x30')]=_['map'](_0x4e1251,'name');_0x555beb[_0x4013('0x31')]=_[_0x4013('0x32')](_0x4a5148[_0x4013('0x31')]);_0x555beb[_0x4013('0x33')]=_[_0x4013('0x34')](_0x555beb[_0x4013('0x30')],_0x555beb['query']);_0x4ab56c[_0x4013('0x35')]=_[_0x4013('0x34')](_0x555beb[_0x4013('0x30')],qs['fields'](_0x4a5148['query'][_0x4013('0x36')]));_0x4ab56c[_0x4013('0x35')]=_0x4ab56c[_0x4013('0x35')]['length']?_0x4ab56c['attributes']:_0x555beb[_0x4013('0x30')];if(!_0x4a5148[_0x4013('0x31')]['hasOwnProperty'](_0x4013('0x37'))){_0x4ab56c[_0x4013('0x21')]=qs[_0x4013('0x21')](_0x4a5148[_0x4013('0x31')][_0x4013('0x21')]);_0x4ab56c['offset']=qs[_0x4013('0x20')](_0x4a5148['query'][_0x4013('0x20')]);}_0x4ab56c[_0x4013('0x38')]=qs[_0x4013('0x39')](_0x4a5148[_0x4013('0x31')]['sort']);_0x4ab56c[_0x4013('0x3a')]=qs[_0x4013('0x33')](_[_0x4013('0x3b')](_0x4a5148['query'],_0x555beb['filters']),_0x4e1251);if(_0x4a5148[_0x4013('0x31')]['filter']){_0x4ab56c[_0x4013('0x3a')]=_[_0x4013('0x3c')](_0x4ab56c['where'],{'$or':_[_0x4013('0x3d')](_0x4e1251,function(_0x1827be){if(_0x1827be['type']!=='VIRTUAL'){var _0x5321c2={};_0x5321c2[_0x1827be['name']]={'$like':'%'+_0x4a5148['query'][_0x4013('0x3e')]+'%'};return _0x5321c2;}})});}_0x4ab56c=_[_0x4013('0x3c')]({},_0x4ab56c,_0x4a5148[_0x4013('0x3f')]);var _0x3f8c15={'where':_0x4ab56c[_0x4013('0x3a')]};return db[_0x4013('0x2c')][_0x4013('0x23')](_0x3f8c15)[_0x4013('0x15')](function(_0x3b3230){_0x143b40['count']=_0x3b3230;if(_0x4a5148[_0x4013('0x31')][_0x4013('0x40')]){_0x4ab56c[_0x4013('0x41')]=[{'all':!![]}];}return db[_0x4013('0x2c')]['findAll'](_0x4ab56c);})[_0x4013('0x15')](function(_0x4754ea){_0x143b40['rows']=_0x4754ea;return _0x143b40;})['then'](respondWithFilteredResult(_0x54a94d,_0x4ab56c))[_0x4013('0x1e')](handleError(_0x54a94d,null));};exports['show']=function(_0x428c32,_0x5ad07f){var _0x12138d={'raw':!![],'where':{'id':_0x428c32['params']['id']}},_0x1bb90e={};_0x1bb90e[_0x4013('0x30')]=_[_0x4013('0x32')](db['MailMessage']['rawAttributes']);_0x1bb90e[_0x4013('0x31')]=_[_0x4013('0x32')](_0x428c32[_0x4013('0x31')]);_0x1bb90e[_0x4013('0x33')]=_[_0x4013('0x34')](_0x1bb90e[_0x4013('0x30')],_0x1bb90e[_0x4013('0x31')]);_0x12138d[_0x4013('0x35')]=_[_0x4013('0x34')](_0x1bb90e['model'],qs[_0x4013('0x36')](_0x428c32['query'][_0x4013('0x36')]));_0x12138d[_0x4013('0x35')]=_0x12138d['attributes'][_0x4013('0x42')]?_0x12138d['attributes']:_0x1bb90e[_0x4013('0x30')];if(_0x428c32[_0x4013('0x31')][_0x4013('0x40')]){_0x12138d['include']=[{'all':!![]}];}_0x12138d=_[_0x4013('0x3c')]({},_0x12138d,_0x428c32['options']);return db[_0x4013('0x2c')][_0x4013('0x43')](_0x12138d)[_0x4013('0x15')](handleEntityNotFound(_0x5ad07f,null))[_0x4013('0x15')](respondWithResult(_0x5ad07f,null))[_0x4013('0x1e')](handleError(_0x5ad07f,null));};exports[_0x4013('0x44')]=function(_0x366af1,_0x4c5f50){if(_0x366af1[_0x4013('0x45')]['id']){delete _0x366af1[_0x4013('0x45')]['id'];}return db[_0x4013('0x2c')]['find']({'where':{'id':_0x366af1[_0x4013('0x46')]['id']}})[_0x4013('0x15')](handleEntityNotFound(_0x4c5f50,null))[_0x4013('0x15')](saveUpdates(_0x366af1[_0x4013('0x45')],null))['then'](respondWithResult(_0x4c5f50,null))[_0x4013('0x1e')](handleError(_0x4c5f50,null));};exports[_0x4013('0x26')]=function(_0x3b1555,_0x3ca6ba){return db['MailMessage']['find']({'where':{'id':_0x3b1555[_0x4013('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ca6ba,null))[_0x4013('0x15')](removeEntity(_0x3ca6ba,null))[_0x4013('0x1e')](handleError(_0x3ca6ba,null));};exports[_0x4013('0x47')]=function(_0x5671c3,_0x16e4d0){return db[_0x4013('0x2c')][_0x4013('0x47')]()[_0x4013('0x15')](respondWithResult(_0x16e4d0,null))[_0x4013('0x1e')](handleError(_0x16e4d0,null));};exports[_0x4013('0x48')]=function(_0x332e31,_0x47cbc1){return db[_0x4013('0x2c')][_0x4013('0x48')](_0x332e31[_0x4013('0x45')])[_0x4013('0x15')](function(_0x3d3c34){if(_0x3d3c34){if(_0x3d3c34['direction']===_0x4013('0x49')&&!_0x3d3c34[_0x4013('0x4a')]){var _0x47899b,_0x4de3da,_0x21d4a8;if(_0x332e31[_0x4013('0x45')]['to']){_0x4de3da=_0x332e31[_0x4013('0x45')]['to'][_0x4013('0x4b')](',')[0x0];}return db[_0x4013('0x4c')][_0x4013('0x4d')]({'where':{'id':_0x3d3c34[_0x4013('0x4e')]},'include':[{'model':db[_0x4013('0x4f')],'as':_0x4013('0x50'),'include':[{'model':db[_0x4013('0x51')],'as':_0x4013('0x52'),'where':{'email':_0x4de3da},'limit':0x1,'order':[[_0x4013('0x53'),_0x4013('0x54')]]}]},{'model':db[_0x4013('0x55')],'as':_0x4013('0x56'),'raw':!![],'include':[{'model':db[_0x4013('0x57')],'as':_0x4013('0x57'),'raw':!![]}]}]})[_0x4013('0x15')](function(_0x3057d6){_0x47899b=_0x3057d6;if(!_0x47899b||!_0x47899b[_0x4013('0x56')])return;var _0x3fc29a=_0x47899b[_0x4013('0x58')]();if(_0x332e31[_0x4013('0x45')][_0x4013('0x59')]&&_0x332e31[_0x4013('0x45')][_0x4013('0x59')][_0x4013('0x42')]){for(var _0x139913=0x0;_0x139913<_0x332e31[_0x4013('0x45')][_0x4013('0x59')][_0x4013('0x42')];_0x139913+=0x1){_0x332e31[_0x4013('0x45')]['attachments'][_0x139913]={'filename':_0x332e31[_0x4013('0x45')]['attachments'][_0x139913][_0x4013('0x2a')],'path':path[_0x4013('0x5a')](config[_0x4013('0x5b')],_0x4013('0x5c'),_0x332e31[_0x4013('0x45')]['attachments'][_0x139913]['basename'])};}}_0x21d4a8={'account':_0x3fc29a,'message':_0x332e31[_0x4013('0x45')]};return;})[_0x4013('0x15')](function(){if(_0x47899b[_0x4013('0x50')]){if(_0x47899b[_0x4013('0x50')][_0x4013('0x52')][_0x4013('0x42')]){return _0x47899b['List'][_0x4013('0x52')][0x0];}else{return db[_0x4013('0x51')][_0x4013('0x48')](_['defaults'](_0x332e31['body'],{'firstName':_0x332e31['body']['to'],'email':_0x332e31['body']['to'],'phone':_0x332e31[_0x4013('0x45')]['to'],'ListId':_0x47899b[_0x4013('0x5d')]}));}}else{throw new Error(_0x4013('0x5e'));}})[_0x4013('0x15')](function(){if(_0x21d4a8){return respondWithRpcPromise('SendMail',_0x4013('0x5f'),_0x21d4a8,client9003)[_0x4013('0x15')](function(_0xf0de1e){return _0x3d3c34['update']({'read':!![],'messageId':_0xf0de1e['messageId'],'sentAt':moment()[_0x4013('0x60')](_0x4013('0x61'))});})[_0x4013('0x1e')](function(_0x2bc48e){logger[_0x4013('0x1b')]('%s',JSON[_0x4013('0x1a')](_0x2bc48e));return _0x3d3c34;});}return _0x3d3c34;});}return _0x3d3c34;}})[_0x4013('0x15')](respondWithResult(_0x47cbc1,0xc9))[_0x4013('0x1e')](handleError(_0x47cbc1,null));};exports[_0x4013('0x62')]=function(_0x135dd2,_0x4d25f4){var _0x143eaf={'agent':{},'channel':'mail'};if(_0x135dd2[_0x4013('0x45')]['id']){delete _0x135dd2[_0x4013('0x45')]['id'];}_0x135dd2['body'][_0x4013('0x63')]=!![];_0x135dd2['body'][_0x4013('0x64')]=moment()[_0x4013('0x60')](_0x4013('0x61'));_0x135dd2[_0x4013('0x45')][_0x4013('0x65')]=_0x135dd2[_0x4013('0x45')][_0x4013('0x65')]||_0x135dd2[_0x4013('0x66')]['id'];_0x143eaf[_0x4013('0x67')]['id']=_0x135dd2[_0x4013('0x45')][_0x4013('0x65')];return db['MailMessage'][_0x4013('0x43')]({'where':{'id':_0x135dd2['params']['id'],'UserId':null}})[_0x4013('0x15')](handleEntityNotFound(_0x4d25f4,null))['then'](saveUpdates(_0x135dd2[_0x4013('0x45')],null))[_0x4013('0x15')](function(_0x48b7f9){if(_0x48b7f9){_0x143eaf[_0x4013('0x1c')]=_0x48b7f9[_0x4013('0x68')]({'plain':!![]});return db[_0x4013('0x69')][_0x4013('0x43')]({'where':{'id':_0x48b7f9[_0x4013('0x6a')]}});}return null;})[_0x4013('0x15')](handleEntityNotFound(_0x4d25f4,null))[_0x4013('0x15')](function(_0xfa5519){if(_0xfa5519){return _0xfa5519[_0x4013('0x44')]({'UserId':_0x135dd2[_0x4013('0x45')]['UserId'],'read1stAt':_[_0x4013('0x6b')](_0xfa5519[_0x4013('0x6c')])?moment()[_0x4013('0x60')](_0x4013('0x61')):undefined});}return null;})[_0x4013('0x15')](function(_0x31c39b){if(_0x31c39b){_0x143eaf[_0x4013('0x6d')]=_0x31c39b[_0x4013('0x68')]({'plain':!![]});interaction_log[_0x4013('0x16')](_0x4013('0x6e'),_0x135dd2[_0x4013('0x66')]['id'],_0x135dd2[_0x4013('0x66')][_0x4013('0x2a')],_0x135dd2[_0x4013('0x66')]['role'],_0x143eaf[_0x4013('0x6d')]['id'],_0x135dd2[_0x4013('0x45')]?JSON[_0x4013('0x1a')](_0x135dd2[_0x4013('0x45')]):'null');return respondWithRpcPromise(_0x4013('0x6f'),_0x4013('0x70'),_0x143eaf);}return null;})[_0x4013('0x15')](function(_0x29ce25){var _0x3792fc=_0x4013('0x71')+_0x29ce25[_0x4013('0x1c')][_0x4013('0x72')];return db[_0x4013('0x73')][_0x4013('0x31')](_0x3792fc,{'type':db[_0x4013('0x74')][_0x4013('0x75')]['SELECT'],'raw':!![]})[_0x4013('0x15')](function(_0x1183ff){return _0x1183ff;});})[_0x4013('0x15')](function(_0x4b8387){if(_0x4b8387){_0x143eaf['message'][_0x4013('0x76')]=_0x4b8387[0x0];if(!_0x135dd2[_0x4013('0x45')]['UserId'])return;return db['User'][_0x4013('0x43')]({'where':{'id':_0x135dd2[_0x4013('0x45')][_0x4013('0x65')],'role':'agent'},'attributes':['id',_0x4013('0x2a'),'fullname',_0x4013('0x77'),_0x4013('0x78')],'raw':!![]});}return null;})[_0x4013('0x15')](function(_0x341c48){if(!_0x341c48)return null;_0x143eaf[_0x4013('0x1c')][_0x4013('0x67')]=_0x341c48;return _0x143eaf;})[_0x4013('0x15')](function(_0x69fdc6){if(_0x69fdc6){if(_0x135dd2[_0x4013('0x45')][_0x4013('0x79')]){_0x143eaf[_0x4013('0x1c')][_0x4013('0x7a')]=util['format'](_0x4013('0x7b'),_0x135dd2[_0x4013('0x66')][_0x4013('0x2a')]);_0x143eaf[_0x4013('0x1c')][_0x4013('0x7c')]=_0x143eaf['channel'];_0x143eaf[_0x4013('0x1c')][_0x4013('0x7d')]=_0x143eaf[_0x4013('0x7c')];_0x143eaf[_0x4013('0x1c')]['event']='accept';_0x143eaf[_0x4013('0x1c')][_0x4013('0x45')]=htmlToText[_0x4013('0x7e')](_0x143eaf[_0x4013('0x1c')]['body']);return respondWithRpcPromise(_0x4013('0x7f'),'EventManager',{'event':'acceptmessage','message':_0x143eaf['message']},client9002)[_0x4013('0x15')](function(){return _0x143eaf;});}return _0x143eaf;}return null;})[_0x4013('0x15')](respondWithResult(_0x4d25f4,null))[_0x4013('0x1e')](handleError(_0x4d25f4,null));};exports[_0x4013('0x80')]=function(_0x87aeb5,_0x38c2f7){var _0x36365b={'agent':{},'channel':'mail'};if(_0x87aeb5[_0x4013('0x45')]['id']){delete _0x87aeb5['body']['id'];}_0x87aeb5[_0x4013('0x45')]['UserId']=_0x87aeb5['body']['UserId']||_0x87aeb5[_0x4013('0x66')]['id'];_0x36365b[_0x4013('0x67')]['id']=_0x87aeb5[_0x4013('0x45')][_0x4013('0x65')];return db[_0x4013('0x2c')]['find']({'where':{'id':_0x87aeb5[_0x4013('0x46')]['id'],'UserId':null}})[_0x4013('0x15')](handleEntityNotFound(_0x38c2f7,null))[_0x4013('0x15')](function(_0x351f60){if(_0x351f60){_0x36365b[_0x4013('0x1c')]=_0x351f60['get']({'plain':!![]});return db[_0x4013('0x69')][_0x4013('0x43')]({'where':{'id':_0x351f60[_0x4013('0x6a')]}});}return null;})[_0x4013('0x15')](handleEntityNotFound(_0x38c2f7,null))[_0x4013('0x15')](function(_0x165a38){if(_0x165a38){_0x36365b[_0x4013('0x6d')]=_0x165a38[_0x4013('0x68')]({'plain':!![]});interaction_log[_0x4013('0x16')](_0x4013('0x81'),_0x87aeb5['user']['id'],_0x87aeb5['user'][_0x4013('0x2a')],_0x87aeb5[_0x4013('0x66')]['role'],_0x36365b[_0x4013('0x6d')]['id'],_0x87aeb5[_0x4013('0x45')]?JSON['stringify'](_0x87aeb5[_0x4013('0x45')]):'null');return respondWithRpcPromise(_0x4013('0x82'),_0x4013('0x83'),_0x36365b);}return null;})['then'](function(_0x398568){var _0x4717a8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x398568[_0x4013('0x1c')][_0x4013('0x72')];return db[_0x4013('0x73')]['query'](_0x4717a8,{'type':db[_0x4013('0x74')]['QueryTypes'][_0x4013('0x84')],'raw':!![]})[_0x4013('0x15')](function(_0x11c1e7){return _0x11c1e7;});})[_0x4013('0x15')](function(_0x5523c5){if(_0x5523c5){_0x36365b[_0x4013('0x1c')]['contact']=_0x5523c5[0x0];if(!_0x87aeb5[_0x4013('0x45')]['UserId'])return;return db[_0x4013('0x85')][_0x4013('0x43')]({'where':{'id':_0x87aeb5['body']['UserId'],'role':_0x4013('0x67')},'attributes':['id',_0x4013('0x2a'),_0x4013('0x86'),'email',_0x4013('0x78')],'raw':!![]});}return null;})['then'](function(_0x2ffafc){if(!_0x2ffafc)return null;_0x36365b[_0x4013('0x1c')][_0x4013('0x67')]=_0x2ffafc;return _0x36365b;})['then'](function(_0x342df5){if(_0x342df5){_0x342df5[_0x4013('0x1c')][_0x4013('0x7a')]=util['format']('SIP/%s',_0x87aeb5[_0x4013('0x66')][_0x4013('0x2a')]);_0x342df5[_0x4013('0x1c')][_0x4013('0x7c')]=_0x36365b[_0x4013('0x7c')];_0x342df5[_0x4013('0x1c')][_0x4013('0x7d')]=_0x36365b[_0x4013('0x7c')];_0x342df5[_0x4013('0x1c')][_0x4013('0x87')]='reject';_0x342df5[_0x4013('0x1c')][_0x4013('0x45')]=htmlToText[_0x4013('0x7e')](_0x36365b[_0x4013('0x1c')][_0x4013('0x45')]);respondWithRpcPromise(_0x4013('0x7f'),_0x4013('0x7f'),{'event':_0x4013('0x88'),'message':_0x342df5[_0x4013('0x1c')]},client9002);return _0x36365b;}return null;})['then'](respondWithResult(_0x38c2f7,null))['catch'](handleError(_0x38c2f7,null));};exports['download']=function(_0x3e2afc,_0x2c4be7){var _0x4b6957=moment()[_0x4013('0x89')]()[_0x4013('0x8a')]();var _0x706104=path[_0x4013('0x5a')](config[_0x4013('0x5b')],_0x4013('0x8b'),'files',_0x4013('0x8c'));var _0x4f672e=path[_0x4013('0x5a')](config[_0x4013('0x5b')],_0x4013('0x8b'),_0x4013('0x8d'),_0x4013('0x59'));var _0x3efc2d=util[_0x4013('0x60')](_0x4013('0x8e'),_0x4b6957);return db[_0x4013('0x2c')][_0x4013('0x43')]({'where':{'id':_0x3e2afc[_0x4013('0x46')]['id']},'attributes':['id',_0x4013('0x45'),_0x4013('0x8f'),'to','cc',_0x4013('0x90'),_0x4013('0x91'),'createdAt'],'include':_0x3e2afc[_0x4013('0x31')][_0x4013('0x59')]?[{'model':db[_0x4013('0x92')],'as':'Attachments'}]:undefined})[_0x4013('0x15')](handleEntityNotFound(_0x2c4be7,null))['then'](function(_0xf6a125){if(_0xf6a125){var _0x4c87cc=_0xf6a125;var _0x3839d7={'from':_0x4c87cc[_0x4013('0x8f')],'to':_0x4c87cc['to'],'subject':_0x4c87cc[_0x4013('0x91')],'html':htmlEntities['decode'](_0x4c87cc[_0x4013('0x45')]),'headers':{'Date':moment(_0x4c87cc[_0x4013('0x93')])[_0x4013('0x60')](_0x4013('0x94'))},'attachments':[]};if(_0xf6a125['cc']){_0x3839d7[_0x4013('0x95')]['Cc']=_0xf6a125['cc'];}if(_0xf6a125[_0x4013('0x90')]){_0x3839d7[_0x4013('0x95')][_0x4013('0x96')]=_0xf6a125['bcc'];}return new BPromise(function(_0x2bc210,_0x1ea160){if(_0xf6a125[_0x4013('0x97')]){for(var _0x5e83e3=0x0;_0x5e83e3<_0xf6a125[_0x4013('0x97')][_0x4013('0x42')];_0x5e83e3++){var _0x20aa11=_0xf6a125[_0x4013('0x97')][_0x5e83e3];var _0x427bb2=path['join'](_0x4f672e,_0x20aa11[_0x4013('0x98')]);if(fs[_0x4013('0x99')](_0x427bb2)){_0x3839d7[_0x4013('0x59')]['push']({'name':_0x20aa11[_0x4013('0x2a')],'contentType':_0x20aa11[_0x4013('0x9a')],'data':fs['readFileSync'](_0x427bb2)});}}}emlformat[_0x4013('0x9b')](_0x3839d7,function(_0x464a36,_0x3f8a3a){if(_0x464a36)return _0x1ea160(_0x464a36);fs[_0x4013('0x9c')](path[_0x4013('0x5a')](_0x706104,_0x3efc2d),_0x3f8a3a);return _0x2bc210(_0x3f8a3a);});});}})['then'](function(_0x13bfca){if(_0x13bfca){return _0x2c4be7[_0x4013('0x9d')](path[_0x4013('0x5a')](_0x706104,_0x3efc2d),_0x3efc2d,function(_0x4a75ab){if(!_0x4a75ab)fs['unlinkSync'](path[_0x4013('0x5a')](_0x706104,_0x3efc2d));});}})[_0x4013('0x1e')](handleError(_0x2c4be7,null));}; \ No newline at end of file +var _0x7afa=['List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','read','format','UserId','user','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','fullname','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','catch','status','offset','undefined','limit','count','Content-Range','json','update','destroy','end','stack','name','send','MailMessage','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','body','params','find','describe','create','split','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List','ListId'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7afa,0x16f));var _0xa7af=function(_0x4ecad4,_0x333adb){_0x4ecad4=_0x4ecad4-0x0;var _0x54985c=_0x7afa[_0x4ecad4];return _0x54985c;};'use strict';var emlformat=require(_0xa7af('0x0'));var moment=require(_0xa7af('0x1'));var BPromise=require(_0xa7af('0x2'));var util=require('util');var path=require(_0xa7af('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xa7af('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xa7af('0x5'))('api');var interaction_log=require(_0xa7af('0x5'))(_0xa7af('0x6'));var config=require(_0xa7af('0x7'));var db=require(_0xa7af('0x8'))['db'];config[_0xa7af('0x9')]=_[_0xa7af('0xa')](config[_0xa7af('0x9')],{'host':_0xa7af('0xb'),'port':0x18eb});var socket=require(_0xa7af('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0xa7af('0xd'));require(_0xa7af('0xe'))[_0xa7af('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa7af('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xa7af('0x10')][_0xa7af('0x11')]({'port':0x232b});var client9002=jayson[_0xa7af('0x10')][_0xa7af('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x23886f,_0xf47488,_0x2edf2a,_0x2e6ade){return new BPromise(function(_0x3967e3,_0x10d198){var _0x5e98ee=_0x2e6ade||client;return _0x5e98ee['request'](_0x23886f,_0x2edf2a)[_0xa7af('0x12')](function(_0x32c523){logger['info']('MailMessage,\x20%s,\x20%s',_0xf47488,_0xa7af('0x13'));logger[_0xa7af('0x14')](_0xa7af('0x15'),_0xf47488,_0xa7af('0x13'),JSON[_0xa7af('0x16')](_0x32c523));if(_0x32c523[_0xa7af('0x17')]){if(_0x32c523[_0xa7af('0x17')][_0xa7af('0x18')]===0x1f4){logger['error'](_0xa7af('0x19'),_0xf47488,_0x32c523[_0xa7af('0x17')][_0xa7af('0x1a')]);return _0x10d198(_0x32c523[_0xa7af('0x17')][_0xa7af('0x1a')]);}logger[_0xa7af('0x17')](_0xa7af('0x19'),_0xf47488,_0x32c523['error'][_0xa7af('0x1a')]);return _0x3967e3(_0x32c523[_0xa7af('0x17')][_0xa7af('0x1a')]);}else{logger[_0xa7af('0x1b')](_0xa7af('0x19'),_0xf47488,_0xa7af('0x13'));_0x3967e3(_0x32c523['result'][_0xa7af('0x1a')]);}})[_0xa7af('0x1c')](function(_0xc13337){logger[_0xa7af('0x17')](_0xa7af('0x19'),_0xf47488,_0xc13337);_0x10d198(_0xc13337);});});}function respondWithResult(_0x436e3b,_0x3bb549){_0x3bb549=_0x3bb549||0xc8;return function(_0x87c0e4){if(_0x87c0e4){return _0x436e3b[_0xa7af('0x1d')](_0x3bb549)['json'](_0x87c0e4);}};}function respondWithFilteredResult(_0x1f6760,_0x20c481){return function(_0x3851a4){if(_0x3851a4){var _0x48c527=typeof _0x20c481[_0xa7af('0x1e')]===_0xa7af('0x1f')&&typeof _0x20c481[_0xa7af('0x20')]===_0xa7af('0x1f');var _0x3e8756=_0x3851a4[_0xa7af('0x21')];var _0x290ff0=_0x48c527?0x0:_0x20c481['offset'];var _0x2dcacc=_0x48c527?_0x3851a4[_0xa7af('0x21')]:_0x20c481[_0xa7af('0x1e')]+_0x20c481[_0xa7af('0x20')];var _0x2b4eed;if(_0x2dcacc>=_0x3e8756){_0x2dcacc=_0x3e8756;_0x2b4eed=0xc8;}else{_0x2b4eed=0xce;}_0x1f6760[_0xa7af('0x1d')](_0x2b4eed);return _0x1f6760['set'](_0xa7af('0x22'),_0x290ff0+'-'+_0x2dcacc+'/'+_0x3e8756)[_0xa7af('0x23')](_0x3851a4);}return null;};}function saveUpdates(_0x4575bf){return function(_0x11abc9){if(_0x11abc9){return _0x11abc9[_0xa7af('0x24')](_0x4575bf)[_0xa7af('0x12')](function(_0x38a38b){return _0x38a38b;});}return null;};}function removeEntity(_0x29b0a4){return function(_0x301636){if(_0x301636){return _0x301636[_0xa7af('0x25')]()[_0xa7af('0x12')](function(){_0x29b0a4[_0xa7af('0x1d')](0xcc)[_0xa7af('0x26')]();});}};}function handleEntityNotFound(_0x3c4648){return function(_0x47c1e9){if(!_0x47c1e9){_0x3c4648['sendStatus'](0x194);}return _0x47c1e9;};}function handleError(_0x194715,_0x127fcc){_0x127fcc=_0x127fcc||0x1f4;return function(_0x20819d){logger[_0xa7af('0x17')](_0x20819d[_0xa7af('0x27')]);if(_0x20819d[_0xa7af('0x28')]){delete _0x20819d[_0xa7af('0x28')];}_0x194715[_0xa7af('0x1d')](_0x127fcc)[_0xa7af('0x29')](_0x20819d);};}exports['index']=function(_0x58bbb8,_0x37643b){var _0x518778={},_0x2d688d={},_0x2c22c3={'count':0x0,'rows':[]};var _0x37f65f=_['map'](db[_0xa7af('0x2a')][_0xa7af('0x2b')],function(_0x539734){return{'name':_0x539734['fieldName'],'type':_0x539734[_0xa7af('0x2c')][_0xa7af('0x2d')]};});_0x2d688d[_0xa7af('0x2e')]=_[_0xa7af('0x2f')](_0x37f65f,'name');_0x2d688d[_0xa7af('0x30')]=_[_0xa7af('0x31')](_0x58bbb8[_0xa7af('0x30')]);_0x2d688d[_0xa7af('0x32')]=_['intersection'](_0x2d688d[_0xa7af('0x2e')],_0x2d688d['query']);_0x518778[_0xa7af('0x33')]=_[_0xa7af('0x34')](_0x2d688d[_0xa7af('0x2e')],qs[_0xa7af('0x35')](_0x58bbb8['query'][_0xa7af('0x35')]));_0x518778['attributes']=_0x518778[_0xa7af('0x33')][_0xa7af('0x36')]?_0x518778['attributes']:_0x2d688d[_0xa7af('0x2e')];if(!_0x58bbb8[_0xa7af('0x30')][_0xa7af('0x37')](_0xa7af('0x38'))){_0x518778['limit']=qs[_0xa7af('0x20')](_0x58bbb8[_0xa7af('0x30')]['limit']);_0x518778[_0xa7af('0x1e')]=qs[_0xa7af('0x1e')](_0x58bbb8[_0xa7af('0x30')][_0xa7af('0x1e')]);}_0x518778['order']=qs[_0xa7af('0x39')](_0x58bbb8['query'][_0xa7af('0x39')]);_0x518778[_0xa7af('0x3a')]=qs[_0xa7af('0x32')](_[_0xa7af('0x3b')](_0x58bbb8['query'],_0x2d688d['filters']),_0x37f65f);if(_0x58bbb8[_0xa7af('0x30')]['filter']){_0x518778[_0xa7af('0x3a')]=_[_0xa7af('0x3c')](_0x518778[_0xa7af('0x3a')],{'$or':_[_0xa7af('0x2f')](_0x37f65f,function(_0x24e1c8){if(_0x24e1c8['type']!==_0xa7af('0x3d')){var _0x3eb373={};_0x3eb373[_0x24e1c8[_0xa7af('0x28')]]={'$like':'%'+_0x58bbb8[_0xa7af('0x30')]['filter']+'%'};return _0x3eb373;}})});}_0x518778=_['merge']({},_0x518778,_0x58bbb8[_0xa7af('0x3e')]);var _0x402548={'where':_0x518778[_0xa7af('0x3a')]};return db[_0xa7af('0x2a')][_0xa7af('0x21')](_0x402548)[_0xa7af('0x12')](function(_0x558532){_0x2c22c3['count']=_0x558532;if(_0x58bbb8[_0xa7af('0x30')][_0xa7af('0x3f')]){_0x518778[_0xa7af('0x40')]=[{'all':!![]}];}return db[_0xa7af('0x2a')][_0xa7af('0x41')](_0x518778);})[_0xa7af('0x12')](function(_0x149cd5){_0x2c22c3[_0xa7af('0x42')]=_0x149cd5;return _0x2c22c3;})[_0xa7af('0x12')](respondWithFilteredResult(_0x37643b,_0x518778))[_0xa7af('0x1c')](handleError(_0x37643b,null));};exports[_0xa7af('0x43')]=function(_0x10bd60,_0x45c169){var _0x575fa1={'raw':!![],'where':{'id':_0x10bd60['params']['id']}},_0xdb5665={};_0xdb5665[_0xa7af('0x2e')]=_[_0xa7af('0x31')](db['MailMessage'][_0xa7af('0x2b')]);_0xdb5665[_0xa7af('0x30')]=_[_0xa7af('0x31')](_0x10bd60[_0xa7af('0x30')]);_0xdb5665[_0xa7af('0x32')]=_[_0xa7af('0x34')](_0xdb5665[_0xa7af('0x2e')],_0xdb5665[_0xa7af('0x30')]);_0x575fa1[_0xa7af('0x33')]=_[_0xa7af('0x34')](_0xdb5665['model'],qs[_0xa7af('0x35')](_0x10bd60[_0xa7af('0x30')][_0xa7af('0x35')]));_0x575fa1[_0xa7af('0x33')]=_0x575fa1[_0xa7af('0x33')][_0xa7af('0x36')]?_0x575fa1[_0xa7af('0x33')]:_0xdb5665[_0xa7af('0x2e')];if(_0x10bd60[_0xa7af('0x30')][_0xa7af('0x3f')]){_0x575fa1[_0xa7af('0x40')]=[{'all':!![]}];}_0x575fa1=_[_0xa7af('0x3c')]({},_0x575fa1,_0x10bd60[_0xa7af('0x3e')]);return db[_0xa7af('0x2a')]['find'](_0x575fa1)[_0xa7af('0x12')](handleEntityNotFound(_0x45c169,null))[_0xa7af('0x12')](respondWithResult(_0x45c169,null))[_0xa7af('0x1c')](handleError(_0x45c169,null));};exports['update']=function(_0x138671,_0x2e881e){if(_0x138671[_0xa7af('0x44')]['id']){delete _0x138671[_0xa7af('0x44')]['id'];}return db[_0xa7af('0x2a')]['find']({'where':{'id':_0x138671[_0xa7af('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e881e,null))[_0xa7af('0x12')](saveUpdates(_0x138671[_0xa7af('0x44')],null))['then'](respondWithResult(_0x2e881e,null))[_0xa7af('0x1c')](handleError(_0x2e881e,null));};exports[_0xa7af('0x25')]=function(_0x330652,_0x13986b){return db[_0xa7af('0x2a')][_0xa7af('0x46')]({'where':{'id':_0x330652[_0xa7af('0x45')]['id']}})['then'](handleEntityNotFound(_0x13986b,null))[_0xa7af('0x12')](removeEntity(_0x13986b,null))[_0xa7af('0x1c')](handleError(_0x13986b,null));};exports[_0xa7af('0x47')]=function(_0x3719a9,_0x3fe556){return db[_0xa7af('0x2a')][_0xa7af('0x47')]()[_0xa7af('0x12')](respondWithResult(_0x3fe556,null))[_0xa7af('0x1c')](handleError(_0x3fe556,null));};exports[_0xa7af('0x48')]=function(_0x4a0a09,_0x187469){return db[_0xa7af('0x2a')][_0xa7af('0x48')](_0x4a0a09[_0xa7af('0x44')])[_0xa7af('0x12')](function(_0x2b9311){if(_0x2b9311){if(_0x2b9311['direction']==='out'&&!_0x2b9311['secret']){var _0x3aaf81,_0x1e1c53,_0x4c0f02;if(_0x4a0a09[_0xa7af('0x44')]['to']){_0x1e1c53=_0x4a0a09[_0xa7af('0x44')]['to'][_0xa7af('0x49')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2b9311[_0xa7af('0x4a')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa7af('0x4b')],'as':_0xa7af('0x4c'),'where':{'email':_0x1e1c53},'limit':0x1,'order':[[_0xa7af('0x4d'),_0xa7af('0x4e')]]}]},{'model':db[_0xa7af('0x4f')],'as':_0xa7af('0x50'),'raw':!![],'include':[{'model':db[_0xa7af('0x51')],'as':'CloudProvider','raw':!![]}]}]})[_0xa7af('0x12')](function(_0x467eb7){_0x3aaf81=_0x467eb7;if(!_0x3aaf81||!_0x3aaf81[_0xa7af('0x50')])return;var _0x2946b6=_0x3aaf81[_0xa7af('0x52')]();if(_0x4a0a09[_0xa7af('0x44')][_0xa7af('0x53')]&&_0x4a0a09[_0xa7af('0x44')]['attachments'][_0xa7af('0x36')]){for(var _0x3d6dfd=0x0;_0x3d6dfd<_0x4a0a09[_0xa7af('0x44')][_0xa7af('0x53')][_0xa7af('0x36')];_0x3d6dfd+=0x1){_0x4a0a09[_0xa7af('0x44')][_0xa7af('0x53')][_0x3d6dfd]={'filename':_0x4a0a09['body'][_0xa7af('0x53')][_0x3d6dfd][_0xa7af('0x28')],'path':path['join'](config[_0xa7af('0x54')],_0xa7af('0x55'),_0x4a0a09['body'][_0xa7af('0x53')][_0x3d6dfd][_0xa7af('0x56')])};}}_0x4c0f02={'account':_0x2946b6,'message':_0x4a0a09['body']};return;})[_0xa7af('0x12')](function(){if(_0x3aaf81[_0xa7af('0x57')]){if(_0x3aaf81[_0xa7af('0x57')][_0xa7af('0x4c')][_0xa7af('0x36')]){return _0x3aaf81[_0xa7af('0x57')][_0xa7af('0x4c')][0x0];}else{return db['CmContact'][_0xa7af('0x48')](_['defaults'](_0x4a0a09[_0xa7af('0x44')],{'firstName':_0x4a0a09['body']['to'],'email':_0x4a0a09[_0xa7af('0x44')]['to'],'phone':_0x4a0a09[_0xa7af('0x44')]['to'],'ListId':_0x3aaf81[_0xa7af('0x58')]}));}}else{throw new Error(_0xa7af('0x59'));}})['then'](function(){if(_0x4c0f02){return respondWithRpcPromise(_0xa7af('0x5a'),_0xa7af('0x5b'),_0x4c0f02,client9003)['then'](function(_0x1435ef){return _0x2b9311['update']({'read':!![],'messageId':_0x1435ef[_0xa7af('0x5c')],'sentAt':moment()['format'](_0xa7af('0x5d'))});})[_0xa7af('0x1c')](function(_0xa3fc87){logger[_0xa7af('0x17')]('%s',JSON['stringify'](_0xa3fc87));return _0x2b9311;});}return _0x2b9311;});}return _0x2b9311;}})[_0xa7af('0x12')](respondWithResult(_0x187469,0xc9))[_0xa7af('0x1c')](handleError(_0x187469,null));};exports['accept']=function(_0x400fd7,_0x2a0891){var _0x4f83b5={'agent':{},'channel':'mail'};if(_0x400fd7[_0xa7af('0x44')]['id']){delete _0x400fd7[_0xa7af('0x44')]['id'];}_0x400fd7[_0xa7af('0x44')][_0xa7af('0x5e')]=!![];_0x400fd7[_0xa7af('0x44')]['readAt']=moment()[_0xa7af('0x5f')](_0xa7af('0x5d'));_0x400fd7[_0xa7af('0x44')]['UserId']=_0x400fd7['body'][_0xa7af('0x60')]||_0x400fd7[_0xa7af('0x61')]['id'];_0x4f83b5['agent']['id']=_0x400fd7[_0xa7af('0x44')][_0xa7af('0x60')];return db[_0xa7af('0x2a')][_0xa7af('0x46')]({'where':{'id':_0x400fd7[_0xa7af('0x45')]['id'],'UserId':null}})[_0xa7af('0x12')](handleEntityNotFound(_0x2a0891,null))['then'](saveUpdates(_0x400fd7['body'],null))['then'](function(_0x2b1433){if(_0x2b1433){_0x4f83b5['message']=_0x2b1433[_0xa7af('0x62')]({'plain':!![]});return db['MailInteraction'][_0xa7af('0x46')]({'where':{'id':_0x2b1433[_0xa7af('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2a0891,null))[_0xa7af('0x12')](function(_0x4764e4){if(_0x4764e4){return _0x4764e4[_0xa7af('0x24')]({'UserId':_0x400fd7[_0xa7af('0x44')][_0xa7af('0x60')],'read1stAt':_['isNil'](_0x4764e4[_0xa7af('0x64')])?moment()[_0xa7af('0x5f')](_0xa7af('0x5d')):undefined});}return null;})[_0xa7af('0x12')](function(_0xe2fa38){if(_0xe2fa38){_0x4f83b5[_0xa7af('0x65')]=_0xe2fa38['get']({'plain':!![]});interaction_log['info'](_0xa7af('0x66'),_0x400fd7[_0xa7af('0x61')]['id'],_0x400fd7['user'][_0xa7af('0x28')],_0x400fd7[_0xa7af('0x61')][_0xa7af('0x67')],_0x4f83b5[_0xa7af('0x65')]['id'],_0x400fd7['body']?JSON[_0xa7af('0x16')](_0x400fd7[_0xa7af('0x44')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa7af('0x68'),_0x4f83b5);}return null;})['then'](function(_0x33e775){var _0x537187=_0xa7af('0x69')+_0x33e775[_0xa7af('0x1a')]['ContactId'];return db['sequelize'][_0xa7af('0x30')](_0x537187,{'type':db[_0xa7af('0x6a')]['QueryTypes'][_0xa7af('0x6b')],'raw':!![]})['then'](function(_0x29f9fd){return _0x29f9fd;});})[_0xa7af('0x12')](function(_0x26f446){if(_0x26f446){_0x4f83b5[_0xa7af('0x1a')]['contact']=_0x26f446[0x0];if(!_0x400fd7[_0xa7af('0x44')]['UserId'])return;return db[_0xa7af('0x6c')][_0xa7af('0x46')]({'where':{'id':_0x400fd7['body'][_0xa7af('0x60')],'role':_0xa7af('0x6d')},'attributes':['id','name','fullname',_0xa7af('0x6e'),_0xa7af('0x6f')],'raw':!![]});}return null;})[_0xa7af('0x12')](function(_0x2a63d0){if(!_0x2a63d0)return null;_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x6d')]=_0x2a63d0;return _0x4f83b5;})[_0xa7af('0x12')](function(_0x5ec10b){if(_0x5ec10b){if(_0x400fd7[_0xa7af('0x44')][_0xa7af('0x70')]){_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x71')]=util['format'](_0xa7af('0x72'),_0x400fd7[_0xa7af('0x61')][_0xa7af('0x28')]);_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x73')]=_0x4f83b5['channel'];_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x74')]=_0x4f83b5['channel'];_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x75')]=_0xa7af('0x76');_0x4f83b5[_0xa7af('0x1a')][_0xa7af('0x44')]=htmlToText['fromString'](_0x4f83b5['message'][_0xa7af('0x44')]);return respondWithRpcPromise('EventManager',_0xa7af('0x77'),{'event':'acceptmessage','message':_0x4f83b5['message']},client9002)[_0xa7af('0x12')](function(){return _0x4f83b5;});}return _0x4f83b5;}return null;})['then'](respondWithResult(_0x2a0891,null))[_0xa7af('0x1c')](handleError(_0x2a0891,null));};exports[_0xa7af('0x78')]=function(_0x42691a,_0x26be11){var _0x573d16={'agent':{},'channel':'mail'};if(_0x42691a[_0xa7af('0x44')]['id']){delete _0x42691a['body']['id'];}_0x42691a['body'][_0xa7af('0x60')]=_0x42691a['body']['UserId']||_0x42691a[_0xa7af('0x61')]['id'];_0x573d16[_0xa7af('0x6d')]['id']=_0x42691a[_0xa7af('0x44')][_0xa7af('0x60')];return db[_0xa7af('0x2a')][_0xa7af('0x46')]({'where':{'id':_0x42691a[_0xa7af('0x45')]['id'],'UserId':null}})[_0xa7af('0x12')](handleEntityNotFound(_0x26be11,null))[_0xa7af('0x12')](function(_0x33679d){if(_0x33679d){_0x573d16[_0xa7af('0x1a')]=_0x33679d['get']({'plain':!![]});return db[_0xa7af('0x79')]['find']({'where':{'id':_0x33679d[_0xa7af('0x63')]}});}return null;})[_0xa7af('0x12')](handleEntityNotFound(_0x26be11,null))[_0xa7af('0x12')](function(_0x527e14){if(_0x527e14){_0x573d16[_0xa7af('0x65')]=_0x527e14['get']({'plain':!![]});interaction_log[_0xa7af('0x1b')](_0xa7af('0x7a'),_0x42691a['user']['id'],_0x42691a['user'][_0xa7af('0x28')],_0x42691a['user'][_0xa7af('0x67')],_0x573d16[_0xa7af('0x65')]['id'],_0x42691a[_0xa7af('0x44')]?JSON[_0xa7af('0x16')](_0x42691a[_0xa7af('0x44')]):_0xa7af('0x7b'));return respondWithRpcPromise(_0xa7af('0x7c'),_0xa7af('0x7d'),_0x573d16);}return null;})[_0xa7af('0x12')](function(_0x118966){var _0x3b4392=_0xa7af('0x69')+_0x118966[_0xa7af('0x1a')][_0xa7af('0x7e')];return db[_0xa7af('0x7f')]['query'](_0x3b4392,{'type':db['Sequelize'][_0xa7af('0x80')]['SELECT'],'raw':!![]})[_0xa7af('0x12')](function(_0x566850){return _0x566850;});})['then'](function(_0x1e1ca2){if(_0x1e1ca2){_0x573d16[_0xa7af('0x1a')]['contact']=_0x1e1ca2[0x0];if(!_0x42691a[_0xa7af('0x44')]['UserId'])return;return db[_0xa7af('0x6c')][_0xa7af('0x46')]({'where':{'id':_0x42691a[_0xa7af('0x44')][_0xa7af('0x60')],'role':_0xa7af('0x6d')},'attributes':['id',_0xa7af('0x28'),_0xa7af('0x81'),'email',_0xa7af('0x6f')],'raw':!![]});}return null;})[_0xa7af('0x12')](function(_0x26a9fb){if(!_0x26a9fb)return null;_0x573d16[_0xa7af('0x1a')][_0xa7af('0x6d')]=_0x26a9fb;return _0x573d16;})[_0xa7af('0x12')](function(_0x5aeb9e){if(_0x5aeb9e){_0x5aeb9e['message'][_0xa7af('0x71')]=util['format']('SIP/%s',_0x42691a[_0xa7af('0x61')][_0xa7af('0x28')]);_0x5aeb9e[_0xa7af('0x1a')][_0xa7af('0x73')]=_0x573d16[_0xa7af('0x73')];_0x5aeb9e[_0xa7af('0x1a')][_0xa7af('0x74')]=_0x573d16[_0xa7af('0x73')];_0x5aeb9e[_0xa7af('0x1a')][_0xa7af('0x75')]='reject';_0x5aeb9e['message'][_0xa7af('0x44')]=htmlToText['fromString'](_0x573d16['message'][_0xa7af('0x44')]);respondWithRpcPromise('EventManager',_0xa7af('0x77'),{'event':_0xa7af('0x82'),'message':_0x5aeb9e[_0xa7af('0x1a')]},client9002);return _0x573d16;}return null;})['then'](respondWithResult(_0x26be11,null))['catch'](handleError(_0x26be11,null));};exports[_0xa7af('0x83')]=function(_0x4dd19f,_0x1dd5b4){var _0x4382b8=moment()[_0xa7af('0x84')]()[_0xa7af('0x85')]();var _0x2fa84e=path[_0xa7af('0x86')](config[_0xa7af('0x54')],_0xa7af('0x87'),_0xa7af('0x88'),_0xa7af('0x89'));var _0x3c4203=path[_0xa7af('0x86')](config['root'],'server',_0xa7af('0x88'),_0xa7af('0x53'));var _0x547411=util[_0xa7af('0x5f')](_0xa7af('0x8a'),_0x4382b8);return db[_0xa7af('0x2a')][_0xa7af('0x46')]({'where':{'id':_0x4dd19f[_0xa7af('0x45')]['id']},'attributes':['id',_0xa7af('0x44'),_0xa7af('0x8b'),'to','cc',_0xa7af('0x8c'),'subject',_0xa7af('0x8d')],'include':_0x4dd19f[_0xa7af('0x30')][_0xa7af('0x53')]?[{'model':db['Attachment'],'as':_0xa7af('0x8e')}]:undefined})['then'](handleEntityNotFound(_0x1dd5b4,null))[_0xa7af('0x12')](function(_0x12d946){if(_0x12d946){var _0x3f5968=_0x12d946;var _0x33b2c0={'from':_0x3f5968[_0xa7af('0x8b')],'to':_0x3f5968['to'],'subject':_0x3f5968[_0xa7af('0x8f')],'html':htmlEntities['decode'](_0x3f5968[_0xa7af('0x44')]),'headers':{'Date':moment(_0x3f5968[_0xa7af('0x8d')])[_0xa7af('0x5f')](_0xa7af('0x90'))},'attachments':[]};if(_0x12d946['cc']){_0x33b2c0[_0xa7af('0x91')]['Cc']=_0x12d946['cc'];}if(_0x12d946[_0xa7af('0x8c')]){_0x33b2c0[_0xa7af('0x91')][_0xa7af('0x92')]=_0x12d946[_0xa7af('0x8c')];}return new BPromise(function(_0x3e28b3,_0x4a09af){if(_0x12d946['Attachments']){for(var _0x417cc1=0x0;_0x417cc1<_0x12d946['Attachments'][_0xa7af('0x36')];_0x417cc1++){var _0x29c51d=_0x12d946['Attachments'][_0x417cc1];var _0x3def34=path[_0xa7af('0x86')](_0x3c4203,_0x29c51d[_0xa7af('0x56')]);if(fs[_0xa7af('0x93')](_0x3def34)){_0x33b2c0[_0xa7af('0x53')][_0xa7af('0x94')]({'name':_0x29c51d[_0xa7af('0x28')],'contentType':_0x29c51d[_0xa7af('0x2c')],'data':fs[_0xa7af('0x95')](_0x3def34)});}}}emlformat['build'](_0x33b2c0,function(_0x454f87,_0x21fa97){if(_0x454f87)return _0x4a09af(_0x454f87);fs[_0xa7af('0x96')](path[_0xa7af('0x86')](_0x2fa84e,_0x547411),_0x21fa97);return _0x3e28b3(_0x21fa97);});});}})[_0xa7af('0x12')](function(_0xf1d53e){if(_0xf1d53e){return _0x1dd5b4[_0xa7af('0x83')](path['join'](_0x2fa84e,_0x547411),_0x547411,function(_0x200dc0){if(!_0x200dc0)fs[_0xa7af('0x97')](path[_0xa7af('0x86')](_0x2fa84e,_0x547411));});}})[_0xa7af('0x1c')](handleError(_0x1dd5b4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a8be92e..6711c43 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 _0x3857=['update','remove','emit','exports','events','save'];(function(_0x14f5e9,_0x394602){var _0x5afb1b=function(_0x5ba8f9){while(--_0x5ba8f9){_0x14f5e9['push'](_0x14f5e9['shift']());}};_0x5afb1b(++_0x394602);}(_0x3857,0x172));var _0x7385=function(_0x2cad69,_0x467679){_0x2cad69=_0x2cad69-0x0;var _0x286fbd=_0x3857[_0x2cad69];return _0x286fbd;};'use strict';var EventEmitter=require(_0x7385('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7385('0x1'),'afterUpdate':_0x7385('0x2'),'afterDestroy':_0x7385('0x3')};function emitEvent(_0x5b1c08){return function(_0x239a26,_0xd214e3,_0x6a02c5){MailMessageEvents['emit'](_0x5b1c08+':'+_0x239a26['id'],_0x239a26);MailMessageEvents[_0x7385('0x4')](_0x5b1c08,_0x239a26);_0x6a02c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x7385('0x5')]=MailMessageEvents; \ No newline at end of file +var _0xe216=['hook','exports','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x57aef1,_0x7809a){var _0x219ee9=function(_0x2632ec){while(--_0x2632ec){_0x57aef1['push'](_0x57aef1['shift']());}};_0x219ee9(++_0x7809a);}(_0xe216,0x158));var _0x6e21=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xe216[_0xfedc72];return _0x2c7c78;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x6e21('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6e21('0x1')](0x0);var events={'afterCreate':_0x6e21('0x2'),'afterUpdate':_0x6e21('0x3'),'afterDestroy':_0x6e21('0x4')};function emitEvent(_0x2c30d5){return function(_0x5330bc,_0x2d5aaf,_0x494c46){MailMessageEvents[_0x6e21('0x5')](_0x2c30d5+':'+_0x5330bc['id'],_0x5330bc);MailMessageEvents[_0x6e21('0x5')](_0x2c30d5,_0x5330bc);_0x494c46(null);};}for(var e in events){if(events[_0x6e21('0x6')](e)){var event=events[e];MailMessage[_0x6e21('0x7')](e,emitEvent(event));}}module[_0x6e21('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c5edb5e..b1a8240 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 _0xf3aa=['subject','body','get','direction','toLowerCase','out','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','mail_messages','messageId','plainBody'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3aa,0xcb));var _0xaf3a=function(_0x13248d,_0x35184a){_0x13248d=_0x13248d-0x0;var _0x564f27=_0xf3aa[_0x13248d];return _0x564f27;};'use strict';var _=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var logger=require(_0xaf3a('0x2'))(_0xaf3a('0x3'));var moment=require(_0xaf3a('0x4'));var BPromise=require(_0xaf3a('0x5'));var rp=require(_0xaf3a('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xaf3a('0x7'));var rimraf=require('rimraf');var config=require(_0xaf3a('0x8'));var attributes=require('./mailMessage.attributes');module[_0xaf3a('0x9')]=function(_0x2d4855,_0xbbaf16){return _0x2d4855[_0xaf3a('0xa')]('MailMessage',attributes,{'tableName':_0xaf3a('0xb'),'paranoid':![],'indexes':[{'name':_0xaf3a('0xc'),'fields':[_0xaf3a('0xc')]},{'name':'fti_mail_messages','fields':[_0xaf3a('0xd'),_0xaf3a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ad7ec,_0x1f0680,_0x1e6f3e){if(_0x3ad7ec[_0xaf3a('0xf')]){_0x3ad7ec[_0xaf3a('0xd')]=htmlToText['fromString'](_0x3ad7ec[_0xaf3a('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1e6f3e(null,_0x1f0680);},'afterCreate':function(_0x3fcc5f,_0xe172ee,_0x2c8219){var _0x17f532=_0x2d4855['models'];var _0x497dbf=_0x3fcc5f[_0xaf3a('0x10')]({'plain':!![]});if(_0x497dbf[_0xaf3a('0x11')][_0xaf3a('0x12')]()==='in'||_0x497dbf[_0xaf3a('0x11')][_0xaf3a('0x12')]()===_0xaf3a('0x13')&&!_0x497dbf['secret']&&!_[_0xaf3a('0x14')](_0x497dbf['UserId'])){_0x17f532[_0xaf3a('0x15')][_0xaf3a('0x16')]({'where':{'id':_0x497dbf[_0xaf3a('0x17')]}})[_0xaf3a('0x18')](function(_0x26aa8d){if(_0x26aa8d){_0x26aa8d[_0xaf3a('0x19')]({'lastMsgAt':_0x497dbf[_0xaf3a('0x1a')],'lastMsgDirection':_0x497dbf[_0xaf3a('0x11')][_0xaf3a('0x12')]()});}})[_0xaf3a('0x1b')](function(_0x8df5c9){console[_0xaf3a('0x1c')](_0x8df5c9);});}_0x2c8219();}},'charset':_0xaf3a('0x1d'),'collate':_0xaf3a('0x1e')});}; \ No newline at end of file +var _0x2e22=['plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages'];(function(_0x446947,_0x8dbb01){var _0x5edde8=function(_0x13e2aa){while(--_0x13e2aa){_0x446947['push'](_0x446947['shift']());}};_0x5edde8(++_0x8dbb01);}(_0x2e22,0x1f2));var _0x22e2=function(_0x14ca26,_0xf6f7c2){_0x14ca26=_0x14ca26-0x0;var _0x2061e9=_0x2e22[_0x14ca26];return _0x2061e9;};'use strict';var _=require(_0x22e2('0x0'));var util=require(_0x22e2('0x1'));var logger=require(_0x22e2('0x2'))(_0x22e2('0x3'));var moment=require('moment');var BPromise=require(_0x22e2('0x4'));var rp=require(_0x22e2('0x5'));var htmlToText=require(_0x22e2('0x6'));var fs=require('fs');var path=require(_0x22e2('0x7'));var rimraf=require('rimraf');var config=require(_0x22e2('0x8'));var attributes=require(_0x22e2('0x9'));module[_0x22e2('0xa')]=function(_0x726714,_0x3daf13){return _0x726714['define']('MailMessage',attributes,{'tableName':_0x22e2('0xb'),'paranoid':![],'indexes':[{'name':_0x22e2('0xc'),'fields':[_0x22e2('0xc')]},{'name':_0x22e2('0xd'),'fields':[_0x22e2('0xe'),_0x22e2('0xf')],'type':_0x22e2('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x411b4e,_0x3e9053,_0x5f57a8){if(_0x411b4e[_0x22e2('0x11')]){_0x411b4e[_0x22e2('0xe')]=htmlToText['fromString'](_0x411b4e[_0x22e2('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f57a8(null,_0x3e9053);},'afterCreate':function(_0x537705,_0x1d5101,_0x200ebe){var _0x160de7=_0x726714[_0x22e2('0x12')];var _0x50a30c=_0x537705['get']({'plain':!![]});if(_0x50a30c[_0x22e2('0x13')][_0x22e2('0x14')]()==='in'||_0x50a30c['direction'][_0x22e2('0x14')]()==='out'&&!_0x50a30c[_0x22e2('0x15')]&&!_[_0x22e2('0x16')](_0x50a30c[_0x22e2('0x17')])){_0x160de7[_0x22e2('0x18')][_0x22e2('0x19')]({'where':{'id':_0x50a30c[_0x22e2('0x1a')]}})[_0x22e2('0x1b')](function(_0x179421){if(_0x179421){_0x179421['update']({'lastMsgAt':_0x50a30c[_0x22e2('0x1c')],'lastMsgDirection':_0x50a30c[_0x22e2('0x13')]['toLowerCase']()});}})[_0x22e2('0x1d')](function(_0x5ea940){console[_0x22e2('0x1e')](_0x5ea940);});}_0x200ebe();}},'charset':_0x22e2('0x1f'),'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 58a2d13..f520f4f 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 _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x439892,_0x452c91){var _0x2d9cfb=function(_0x3c3286){while(--_0x3c3286){_0x439892['push'](_0x439892['shift']());}};_0x2d9cfb(++_0x452c91);}(_0xfff0,0x139));var _0x0fff=function(_0xba36b6,_0x1f52c3){_0xba36b6=_0xba36b6-0x0;var _0x46b63e=_0xfff0[_0xba36b6];return _0x46b63e;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file +var _0xf4f4=['message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1b6215,_0x552306){var _0x294a17=function(_0x1034b1){while(--_0x1034b1){_0x1b6215['push'](_0x1b6215['shift']());}};_0x294a17(++_0x552306);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x555263,_0xefc087){_0x555263=_0x555263-0x0;var _0x28bf16=_0xf4f4[_0x555263];return _0x28bf16;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});config[_0x4f4f('0xb')]=_[_0x4f4f('0xc')](config[_0x4f4f('0xb')],{'host':_0x4f4f('0xd'),'port':0x18eb});var socket=require(_0x4f4f('0xe'))(new Redis(config['redis']));require(_0x4f4f('0xf'))[_0x4f4f('0x10')](socket);function respondWithRpcPromise(_0x39e36b,_0x2d86d1,_0x116f22){return new BPromise(function(_0x11940f,_0x87a9a2){return client[_0x4f4f('0x11')](_0x39e36b,_0x116f22)['then'](function(_0x5956c6){logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));logger[_0x4f4f('0x15')](_0x4f4f('0x16'),_0x2d86d1,_0x4f4f('0x14'),JSON['stringify'](_0x5956c6));if(_0x5956c6[_0x4f4f('0x17')]){if(_0x5956c6['error'][_0x4f4f('0x18')]===0x1f4){logger[_0x4f4f('0x17')](_0x4f4f('0x13'),_0x2d86d1,_0x5956c6[_0x4f4f('0x17')]['message']);return _0x87a9a2(_0x5956c6[_0x4f4f('0x17')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);return _0x11940f(_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);}else{logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));_0x11940f(_0x5956c6[_0x4f4f('0x1a')][_0x4f4f('0x19')]);}})[_0x4f4f('0x1b')](function(_0x32b549){logger[_0x4f4f('0x17')]('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x32b549);_0x87a9a2(_0x32b549);});});}exports[_0x4f4f('0x1c')]=function(_0x4622c2){var _0x2f84e5=this;return new Promise(function(_0x201c60,_0x302a79){return db[_0x4f4f('0x1d')][_0x4f4f('0x1e')](_0x4622c2[_0x4f4f('0x1f')],{'raw':_0x4622c2[_0x4f4f('0x20')]?_0x4622c2[_0x4f4f('0x20')][_0x4f4f('0x21')]===undefined?!![]:![]:!![]})[_0x4f4f('0x22')](function(_0x17984d){logger[_0x4f4f('0x12')]('CreateMailMessage',_0x4622c2);logger['debug']('CreateMailMessage',_0x4622c2,JSON[_0x4f4f('0x23')](_0x17984d));_0x201c60(_0x17984d);})[_0x4f4f('0x1b')](function(_0x5186ac){logger[_0x4f4f('0x17')](_0x4f4f('0x1c'),_0x5186ac[_0x4f4f('0x19')],_0x4622c2);_0x302a79(_0x2f84e5[_0x4f4f('0x17')](0x1f4,_0x5186ac[_0x4f4f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index deb8e10..9960b6d 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 _0x5c86=['mailMessage:','remove','update','emit','removeListener','length'];(function(_0x40dfc1,_0x3c68d6){var _0x5f0cef=function(_0x413392){while(--_0x413392){_0x40dfc1['push'](_0x40dfc1['shift']());}};_0x5f0cef(++_0x3c68d6);}(_0x5c86,0x73));var _0x65c8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5c86[_0x501510];return _0x1e6ee5;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x65c8('0x0'),_0x65c8('0x1')];function createListener(_0x354b44,_0x50bf4c){return function(_0x1b13a7){_0x50bf4c[_0x65c8('0x2')](_0x354b44,_0x1b13a7);};}function removeListener(_0x3ceee9,_0x5cbde0){return function(){MailMessageEvents[_0x65c8('0x3')](_0x3ceee9,_0x5cbde0);};}exports['register']=function(_0x3b5a2f){for(var _0x17916a=0x0,_0x18ffe6=events[_0x65c8('0x4')];_0x17916a<_0x18ffe6;_0x17916a++){var _0x4d6582=events[_0x17916a];var _0x3dd4cc=createListener(_0x65c8('0x5')+_0x4d6582,_0x3b5a2f);MailMessageEvents['on'](_0x4d6582,_0x3dd4cc);}}; \ No newline at end of file +var _0x47e6=['length','save','emit','register'];(function(_0x23bf20,_0x4ff949){var _0xef090a=function(_0x325378){while(--_0x325378){_0x23bf20['push'](_0x23bf20['shift']());}};_0xef090a(++_0x4ff949);}(_0x47e6,0xe5));var _0x647e=function(_0x508dd9,_0x2eef72){_0x508dd9=_0x508dd9-0x0;var _0x2947ec=_0x47e6[_0x508dd9];return _0x2947ec;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x647e('0x0'),'remove','update'];function createListener(_0x1b8cb2,_0x4f1aeb){return function(_0x5059d8){_0x4f1aeb[_0x647e('0x1')](_0x1b8cb2,_0x5059d8);};}function removeListener(_0x3d93f6,_0x4116fe){return function(){MailMessageEvents['removeListener'](_0x3d93f6,_0x4116fe);};}exports[_0x647e('0x2')]=function(_0x337e6f){for(var _0x21e5ef=0x0,_0x5a37a1=events[_0x647e('0x3')];_0x21e5ef<_0x5a37a1;_0x21e5ef++){var _0x226129=events[_0x21e5ef];var _0x4f7c2a=createListener('mailMessage:'+_0x226129,_0x337e6f);MailMessageEvents['on'](_0x226129,_0x4f7c2a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 304181b..95fe637 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 _0x5876=['Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5876,0xdd));var _0x6587=function(_0x5b33ad,_0x2a7d55){_0x5b33ad=_0x5b33ad-0x0;var _0x16ec00=_0x5876[_0x5b33ad];return _0x16ec00;};'use strict';var multer=require('multer');var util=require(_0x6587('0x0'));var path=require(_0x6587('0x1'));var timeout=require(_0x6587('0x2'));var express=require('express');var router=express[_0x6587('0x3')]();var fs_extra=require(_0x6587('0x4'));var auth=require(_0x6587('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6587('0x6'));var controller=require(_0x6587('0x7'));router[_0x6587('0x8')]('/',auth['isAuthenticated'](),controller[_0x6587('0x9')]);router[_0x6587('0x8')]('/describe',auth[_0x6587('0xa')](),controller[_0x6587('0xb')]);router[_0x6587('0x8')](_0x6587('0xc'),auth['isAuthenticated'](),controller[_0x6587('0xd')]);router[_0x6587('0x8')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0xf')]);router[_0x6587('0x8')](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x11')]);router[_0x6587('0x8')]('/:id/users',auth[_0x6587('0xa')](),controller[_0x6587('0x12')]);router[_0x6587('0x13')]('/',auth[_0x6587('0xa')](),controller[_0x6587('0x14')]);router[_0x6587('0x13')](_0x6587('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6587('0x13')](_0x6587('0x15'),auth[_0x6587('0xa')](),controller[_0x6587('0x16')]);router['put'](_0x6587('0xc'),auth[_0x6587('0xa')](),controller[_0x6587('0x17')]);router[_0x6587('0x18')]('/:id',auth[_0x6587('0xa')](),controller['destroy']);router[_0x6587('0x18')](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x19')]);router[_0x6587('0x18')](_0x6587('0x15'),auth[_0x6587('0xa')](),controller[_0x6587('0x1a')]);module[_0x6587('0x1b')]=router; \ No newline at end of file +var _0xd363=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x501d1c,_0x22144a){var _0x1ddb0f=function(_0x146b78){while(--_0x146b78){_0x501d1c['push'](_0x501d1c['shift']());}};_0x1ddb0f(++_0x22144a);}(_0xd363,0x7c));var _0x3d36=function(_0x577f3d,_0x43ab79){_0x577f3d=_0x577f3d-0x0;var _0x3b11f6=_0xd363[_0x577f3d];return _0x3b11f6;};'use strict';var multer=require(_0x3d36('0x0'));var util=require(_0x3d36('0x1'));var path=require(_0x3d36('0x2'));var timeout=require(_0x3d36('0x3'));var express=require(_0x3d36('0x4'));var router=express[_0x3d36('0x5')]();var fs_extra=require(_0x3d36('0x6'));var auth=require(_0x3d36('0x7'));var interaction=require(_0x3d36('0x8'));var config=require('../../config/environment');var controller=require(_0x3d36('0x9'));router[_0x3d36('0xa')]('/',auth[_0x3d36('0xb')](),controller[_0x3d36('0xc')]);router[_0x3d36('0xa')](_0x3d36('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x3d36('0xa')](_0x3d36('0xe'),auth[_0x3d36('0xb')](),controller[_0x3d36('0xf')]);router[_0x3d36('0xa')]('/:id/members',auth[_0x3d36('0xb')](),controller[_0x3d36('0x10')]);router[_0x3d36('0xa')](_0x3d36('0x11'),auth[_0x3d36('0xb')](),controller[_0x3d36('0x12')]);router[_0x3d36('0xa')](_0x3d36('0x13'),auth[_0x3d36('0xb')](),controller[_0x3d36('0x14')]);router[_0x3d36('0x15')]('/',auth[_0x3d36('0xb')](),controller[_0x3d36('0x16')]);router['post'](_0x3d36('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3d36('0x15')](_0x3d36('0x13'),auth[_0x3d36('0xb')](),controller['addAgents']);router['put'](_0x3d36('0xe'),auth[_0x3d36('0xb')](),controller[_0x3d36('0x17')]);router[_0x3d36('0x18')](_0x3d36('0xe'),auth[_0x3d36('0xb')](),controller[_0x3d36('0x19')]);router[_0x3d36('0x18')](_0x3d36('0x11'),auth[_0x3d36('0xb')](),controller[_0x3d36('0x1a')]);router['delete'](_0x3d36('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3d36('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b3b09f3..131963b 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 _0x6f64=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x6f64,0xc9));var _0x46f6=function(_0x128d75,_0x7ef83c){_0x128d75=_0x128d75-0x0;var _0x2034e3=_0x6f64[_0x128d75];return _0x2034e3;};'use strict';var Sequelize=require(_0x46f6('0x0'));module[_0x46f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x46f6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46f6('0x3')](_0x46f6('0x4'),_0x46f6('0x5'),_0x46f6('0x6'))}}; \ No newline at end of file +var _0x20bf=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0x20bf,0x14f));var _0xf20b=function(_0x2dea39,_0x505dc2){_0x2dea39=_0x2dea39-0x0;var _0x1580fb=_0x20bf[_0x2dea39];return _0x1580fb;};'use strict';var Sequelize=require('sequelize');module[_0xf20b('0x0')]={'name':{'type':Sequelize[_0xf20b('0x1')],'unique':_0xf20b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf20b('0x1')]},'timeout':{'type':Sequelize[_0xf20b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf20b('0x4'),_0xf20b('0x5'),_0xf20b('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3b0afd3..86e680b 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 _0x8d31=['role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','UserMailQueue','hasOwnProperty','sort','MailQueueId','filter','map','UserId','mailPause','updatedAt','createdAt','getTeams','findOne','order','pick','nolimit','addTeams','ids','Team','User','Agents','online','flatMap','sequelize','transaction','findOrCreate','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','value','isEmpty','forEach','userMailQueue:remove','addAgents','omit','spread','removeAgents','getAgents','bluebird','util','../../components/parsers/qs','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','merge','options','find','create','body','user'];(function(_0x282f0c,_0x29771a){var _0x3d9b6a=function(_0x4c465f){while(--_0x4c465f){_0x282f0c['push'](_0x282f0c['shift']());}};_0x3d9b6a(++_0x29771a);}(_0x8d31,0x11f));var _0x18d3=function(_0x46789d,_0x39ceb0){_0x46789d=_0x46789d-0x0;var _0xaa735c=_0x8d31[_0x46789d];return _0xaa735c;};'use strict';var BPromise=require(_0x18d3('0x0'));var util=require(_0x18d3('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x18d3('0x2'));var logger=require('../../config/logger')(_0x18d3('0x3'));var config=require(_0x18d3('0x4'));var db=require(_0x18d3('0x5'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x18d3('0x6'),'port':0x18eb});var socket=require(_0x18d3('0x7'))(new Redis(config[_0x18d3('0x8')]));require(_0x18d3('0x9'))[_0x18d3('0xa')](socket);function respondWithStatusCode(_0x430657,_0x36a5ad){_0x36a5ad=_0x36a5ad||0xcc;return function(_0x377a0c){if(_0x377a0c){return _0x430657[_0x18d3('0xb')](_0x36a5ad);}return _0x430657[_0x18d3('0xc')](_0x36a5ad)[_0x18d3('0xd')]();};}function respondWithResult(_0x1abf93,_0x3b39d5){_0x3b39d5=_0x3b39d5||0xc8;return function(_0x4748a3){if(_0x4748a3){return _0x1abf93[_0x18d3('0xc')](_0x3b39d5)['json'](_0x4748a3);}};}function respondWithFilteredResult(_0x4bceef,_0x1fedbb){return function(_0x4230ae){if(_0x4230ae){var _0x4d53f4=typeof _0x1fedbb[_0x18d3('0xe')]===_0x18d3('0xf')&&typeof _0x1fedbb[_0x18d3('0x10')]==='undefined';var _0x42c512=_0x4230ae['count'];var _0x4f4230=_0x4d53f4?0x0:_0x1fedbb['offset'];var _0x4fb961=_0x4d53f4?_0x4230ae[_0x18d3('0x11')]:_0x1fedbb[_0x18d3('0xe')]+_0x1fedbb['limit'];var _0x2113c3;if(_0x4fb961>=_0x42c512){_0x4fb961=_0x42c512;_0x2113c3=0xc8;}else{_0x2113c3=0xce;}_0x4bceef[_0x18d3('0xc')](_0x2113c3);return _0x4bceef[_0x18d3('0x12')]('Content-Range',_0x4f4230+'-'+_0x4fb961+'/'+_0x42c512)['json'](_0x4230ae);}return null;};}function saveUpdates(_0x2675ae){return function(_0x29e409){if(_0x29e409){return _0x29e409['update'](_0x2675ae)[_0x18d3('0x13')](function(_0x7be984){return _0x7be984;});}return null;};}function removeEntity(_0x29f74a){return function(_0x413e65){if(_0x413e65){return _0x413e65[_0x18d3('0x14')]()['then'](function(){var _0x18a61f=_0x413e65[_0x18d3('0x15')]({'plain':!![]});var _0x4822fa=_0x18d3('0x16');return db[_0x18d3('0x17')]['destroy']({'where':{'type':_0x4822fa,'resourceId':_0x18a61f['id']}})[_0x18d3('0x13')](function(){return _0x413e65;});})[_0x18d3('0x13')](function(){_0x29f74a[_0x18d3('0xc')](0xcc)[_0x18d3('0xd')]();});}};}function handleEntityNotFound(_0x173d3f){return function(_0x2f63af){if(!_0x2f63af){_0x173d3f[_0x18d3('0xb')](0x194);}return _0x2f63af;};}function handleError(_0x5f0fdd,_0x52a794){_0x52a794=_0x52a794||0x1f4;return function(_0x5d27d6){logger['error'](_0x5d27d6[_0x18d3('0x18')]);if(_0x5d27d6[_0x18d3('0x19')]){delete _0x5d27d6[_0x18d3('0x19')];}_0x5f0fdd[_0x18d3('0xc')](_0x52a794)[_0x18d3('0x1a')](_0x5d27d6);};}exports[_0x18d3('0x1b')]=function(_0x123588,_0x3fb9a0){var _0x2e6dd5={};var _0x4a4626={'count':0x0,'rows':[]};var _0x2bf3fa=_['map'](db[_0x18d3('0x1c')][_0x18d3('0x1d')],function(_0x38707c){return{'name':_0x38707c[_0x18d3('0x1e')],'type':_0x38707c[_0x18d3('0x1f')][_0x18d3('0x20')]};});_0x2e6dd5=qs[_0x18d3('0x21')](_0x2bf3fa,_0x123588);var _0x46d89d={'where':_0x2e6dd5[_0x18d3('0x22')]};return db[_0x18d3('0x1c')][_0x18d3('0x11')](_0x46d89d)[_0x18d3('0x13')](function(_0x385a68){_0x4a4626['count']=_0x385a68;_0x2e6dd5[_0x18d3('0x23')]=qs[_0x18d3('0x23')](_0x123588['query']);return db[_0x18d3('0x1c')][_0x18d3('0x24')](_0x2e6dd5);})[_0x18d3('0x13')](function(_0x18f157){_0x4a4626[_0x18d3('0x25')]=_0x18f157;return _0x4a4626;})[_0x18d3('0x13')](respondWithFilteredResult(_0x3fb9a0,_0x2e6dd5))[_0x18d3('0x26')](handleError(_0x3fb9a0,null));};exports[_0x18d3('0x27')]=function(_0x5de620,_0x57b9d1){var _0x2eab97={'raw':!![],'where':{'id':_0x5de620[_0x18d3('0x28')]['id']}},_0x4504a9={};_0x4504a9[_0x18d3('0x29')]=_[_0x18d3('0x2a')](db[_0x18d3('0x1c')][_0x18d3('0x1d')]);_0x4504a9[_0x18d3('0x2b')]=_[_0x18d3('0x2a')](_0x5de620[_0x18d3('0x2b')]);_0x4504a9[_0x18d3('0x2c')]=_[_0x18d3('0x2d')](_0x4504a9[_0x18d3('0x29')],_0x4504a9['query']);_0x2eab97[_0x18d3('0x2e')]=_['intersection'](_0x4504a9['model'],qs[_0x18d3('0x2f')](_0x5de620['query'][_0x18d3('0x2f')]));_0x2eab97[_0x18d3('0x2e')]=_0x2eab97['attributes'][_0x18d3('0x30')]?_0x2eab97[_0x18d3('0x2e')]:_0x4504a9[_0x18d3('0x29')];if(_0x5de620['query']['includeAll']){_0x2eab97[_0x18d3('0x23')]=[{'all':!![]}];}_0x2eab97=_[_0x18d3('0x31')]({},_0x2eab97,_0x5de620[_0x18d3('0x32')]);return db[_0x18d3('0x1c')][_0x18d3('0x33')](_0x2eab97)['then'](handleEntityNotFound(_0x57b9d1,null))[_0x18d3('0x13')](respondWithResult(_0x57b9d1,null))[_0x18d3('0x26')](handleError(_0x57b9d1,null));};exports[_0x18d3('0x34')]=function(_0x424d8b,_0xcc5061){return db[_0x18d3('0x1c')][_0x18d3('0x34')](_0x424d8b[_0x18d3('0x35')],{})[_0x18d3('0x13')](function(_0x12457e){var _0x2adb99=_0x424d8b[_0x18d3('0x36')][_0x18d3('0x15')]({'plain':!![]});if(!_0x2adb99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adb99[_0x18d3('0x37')]===_0x18d3('0x36')){var _0x13001b=_0x12457e[_0x18d3('0x15')]({'plain':!![]});var _0x13866b=_0x18d3('0x16');return db['UserProfileSection'][_0x18d3('0x33')]({'where':{'name':_0x13866b,'userProfileId':_0x2adb99[_0x18d3('0x38')]},'raw':!![]})[_0x18d3('0x13')](function(_0x1928ca){if(_0x1928ca&&_0x1928ca['autoAssociation']===0x0){return db[_0x18d3('0x17')][_0x18d3('0x34')]({'name':_0x13001b['name'],'resourceId':_0x13001b['id'],'type':_0x1928ca['name'],'sectionId':_0x1928ca['id']},{})['then'](function(){return _0x12457e;});}else{return _0x12457e;}})[_0x18d3('0x26')](function(_0x3f0f9f){logger[_0x18d3('0x39')](_0x18d3('0x3a'),_0x3f0f9f);throw _0x3f0f9f;});}return _0x12457e;})[_0x18d3('0x13')](respondWithResult(_0xcc5061,0xc9))[_0x18d3('0x26')](handleError(_0xcc5061,null));};exports[_0x18d3('0x3b')]=function(_0x327c5e,_0x4ac3d2){if(_0x327c5e[_0x18d3('0x35')]['id']){delete _0x327c5e[_0x18d3('0x35')]['id'];}return db[_0x18d3('0x1c')]['find']({'where':{'id':_0x327c5e[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](handleEntityNotFound(_0x4ac3d2,null))[_0x18d3('0x13')](saveUpdates(_0x327c5e[_0x18d3('0x35')],null))[_0x18d3('0x13')](respondWithResult(_0x4ac3d2,null))['catch'](handleError(_0x4ac3d2,null));};exports[_0x18d3('0x14')]=function(_0x81b762,_0x316045){return db['MailQueue'][_0x18d3('0x33')]({'where':{'id':_0x81b762[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](handleEntityNotFound(_0x316045,null))[_0x18d3('0x13')](removeEntity(_0x316045,null))[_0x18d3('0x26')](handleError(_0x316045,null));};exports['describe']=function(_0xbf1cc0,_0x1c69e7){return db['MailQueue']['describe']()[_0x18d3('0x13')](respondWithResult(_0x1c69e7,null))[_0x18d3('0x26')](handleError(_0x1c69e7,null));};exports[_0x18d3('0x3c')]=function(_0x3ee369,_0x134bfd){var _0x563935={'raw':!![],'where':{}},_0x113707={},_0x383469;return db[_0x18d3('0x1c')]['findOne']({'where':{'id':_0x3ee369[_0x18d3('0x28')]['id']}})['then'](handleEntityNotFound(_0x134bfd,null))[_0x18d3('0x13')](function(_0xe50243){if(_0xe50243){_0x383469=_0xe50243[_0x18d3('0x15')]({'plain':!![]});_0x113707[_0x18d3('0x29')]=_[_0x18d3('0x2a')](db[_0x18d3('0x3d')]['rawAttributes']);_0x113707[_0x18d3('0x2b')]=_[_0x18d3('0x2a')](_0x3ee369[_0x18d3('0x2b')]);_0x113707[_0x18d3('0x2c')]=_['intersection'](_0x113707[_0x18d3('0x29')],_0x113707[_0x18d3('0x2b')]);_0x563935[_0x18d3('0x2e')]=_[_0x18d3('0x2d')](_0x113707[_0x18d3('0x29')],qs['fields'](_0x3ee369[_0x18d3('0x2b')][_0x18d3('0x2f')]));_0x563935[_0x18d3('0x2e')]=_0x563935['attributes'][_0x18d3('0x30')]?_0x563935['attributes']:_0x113707[_0x18d3('0x29')];if(!_0x3ee369['query'][_0x18d3('0x3e')]('nolimit')){_0x563935[_0x18d3('0x10')]=qs[_0x18d3('0x10')](_0x3ee369[_0x18d3('0x2b')][_0x18d3('0x10')]);_0x563935[_0x18d3('0xe')]=qs['offset'](_0x3ee369[_0x18d3('0x2b')][_0x18d3('0xe')]);}_0x563935['order']=qs['sort'](_0x3ee369[_0x18d3('0x2b')][_0x18d3('0x3f')]);_0x563935[_0x18d3('0x22')]=qs[_0x18d3('0x2c')](_['pick'](_0x3ee369[_0x18d3('0x2b')],_0x113707[_0x18d3('0x2c')]));_0x563935['where'][_0x18d3('0x40')]=_0xe50243['id'];if(_0x3ee369['query'][_0x18d3('0x41')]){_0x563935[_0x18d3('0x22')]=_[_0x18d3('0x31')](_0x563935[_0x18d3('0x22')],{'$or':_[_0x18d3('0x42')](_0x563935[_0x18d3('0x2e')],function(_0x251e8e){var _0x2b94ba={};_0x2b94ba[_0x251e8e]={'$like':'%'+_0x3ee369['query'][_0x18d3('0x41')]+'%'};return _0x2b94ba;})});}_0x563935=_[_0x18d3('0x31')]({},_0x563935,_0x3ee369[_0x18d3('0x32')]);return db[_0x18d3('0x3d')][_0x18d3('0x24')](_0x563935);}})[_0x18d3('0x13')](function(_0x2e2e6d){if(_0x2e2e6d){return db['User']['findAndCountAll']({'where':{'id':_[_0x18d3('0x42')](_0x2e2e6d,_0x18d3('0x43')),'role':'agent'},'attributes':['id',_0x18d3('0x19'),_0x18d3('0x44'),_0x18d3('0x45'),'createdAt']});}})[_0x18d3('0x13')](function(_0x3ae0e0){if(_0x3ae0e0){return{'count':_0x3ae0e0['count'],'rows':_[_0x18d3('0x42')](_0x3ae0e0[_0x18d3('0x25')],function(_0x28d0d5){return{'membername':_0x28d0d5[_0x18d3('0x19')],'UserId':_0x28d0d5['id'],'queue_name':_0x383469[_0x18d3('0x19')],'MailQueueId':_0x383469['id'],'interface':util['format']('%s/%s','SIP',_0x28d0d5[_0x18d3('0x19')]),'penalty':0x0,'paused':_0x28d0d5['mailPause'],'createdAt':_0x28d0d5[_0x18d3('0x46')],'updatedAt':_0x28d0d5[_0x18d3('0x45')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x18d3('0x13')](respondWithFilteredResult(_0x134bfd,_0x563935))[_0x18d3('0x26')](handleError(_0x134bfd,null));};exports[_0x18d3('0x47')]=function(_0x296249,_0x1550e9){var _0x79cff2={};var _0x56d581={};var _0x463a00;var _0x7d1ecd;return db[_0x18d3('0x1c')][_0x18d3('0x48')]({'where':{'id':_0x296249[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](handleEntityNotFound(_0x1550e9,null))[_0x18d3('0x13')](function(_0x13b667){if(_0x13b667){_0x463a00=_0x13b667;_0x56d581[_0x18d3('0x29')]=_[_0x18d3('0x2a')](db['Team'][_0x18d3('0x1d')]);_0x56d581[_0x18d3('0x2b')]=_[_0x18d3('0x2a')](_0x296249['query']);_0x56d581['filters']=_[_0x18d3('0x2d')](_0x56d581['model'],_0x56d581[_0x18d3('0x2b')]);_0x79cff2[_0x18d3('0x2e')]=_['intersection'](_0x56d581[_0x18d3('0x29')],qs[_0x18d3('0x2f')](_0x296249[_0x18d3('0x2b')][_0x18d3('0x2f')]));_0x79cff2[_0x18d3('0x2e')]=_0x79cff2[_0x18d3('0x2e')][_0x18d3('0x30')]?_0x79cff2['attributes']:_0x56d581['model'];_0x79cff2[_0x18d3('0x49')]=qs[_0x18d3('0x3f')](_0x296249[_0x18d3('0x2b')]['sort']);_0x79cff2[_0x18d3('0x22')]=qs[_0x18d3('0x2c')](_[_0x18d3('0x4a')](_0x296249['query'],_0x56d581['filters']));if(_0x296249[_0x18d3('0x2b')][_0x18d3('0x41')]){_0x79cff2['where']=_[_0x18d3('0x31')](_0x79cff2[_0x18d3('0x22')],{'$or':_['map'](_0x79cff2[_0x18d3('0x2e')],function(_0xb06aa9){var _0x442f7f={};_0x442f7f[_0xb06aa9]={'$like':'%'+_0x296249['query']['filter']+'%'};return _0x442f7f;})});}_0x79cff2=_[_0x18d3('0x31')]({},_0x79cff2,_0x296249[_0x18d3('0x32')]);return _0x463a00[_0x18d3('0x47')](_0x79cff2);}})[_0x18d3('0x13')](function(_0x59ca92){if(_0x59ca92){_0x7d1ecd=_0x59ca92['length'];if(!_0x296249[_0x18d3('0x2b')][_0x18d3('0x3e')](_0x18d3('0x4b'))){_0x79cff2[_0x18d3('0x10')]=qs['limit'](_0x296249[_0x18d3('0x2b')][_0x18d3('0x10')]);_0x79cff2[_0x18d3('0xe')]=qs[_0x18d3('0xe')](_0x296249[_0x18d3('0x2b')][_0x18d3('0xe')]);}return _0x463a00['getTeams'](_0x79cff2);}})['then'](function(_0x1fc92b){if(_0x1fc92b){return _0x1fc92b?{'count':_0x7d1ecd,'rows':_0x1fc92b}:null;}})[_0x18d3('0x13')](respondWithResult(_0x1550e9,null))[_0x18d3('0x26')](handleError(_0x1550e9,null));};exports[_0x18d3('0x4c')]=function(_0x1df22a,_0x5eee45){var _0x6d9a39=_0x1df22a[_0x18d3('0x35')][_0x18d3('0x4d')];return db[_0x18d3('0x4e')]['findAll']({'where':{'id':_0x6d9a39},'attributes':['id'],'include':[{'model':db[_0x18d3('0x4f')],'as':_0x18d3('0x50'),'attributes':['id','name',_0x18d3('0x51'),'voicePause','interface'],'raw':!![]}]})[_0x18d3('0x13')](function(_0x1069c8){if(_0x1069c8){var _0x31e4ea=_[_0x18d3('0x52')](_0x1069c8,function(_0xd5606e){var _0x45ddc0=_0xd5606e['get']({'plain':!![]});return _0x45ddc0[_0x18d3('0x50')];});return db[_0x18d3('0x1c')]['find']({'where':{'id':_0x1df22a[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](function(_0x400a2c){return db[_0x18d3('0x53')][_0x18d3('0x54')](function(_0x25a23a){return _0x400a2c[_0x18d3('0x4c')](_0x6d9a39,{'transaction':_0x25a23a})[_0x18d3('0x13')](function(){return BPromise['each'](_0x31e4ea,function(_0x1e81d5){return db['UserMailQueue'][_0x18d3('0x55')]({'where':{'UserId':_0x1e81d5['id'],'MailQueueId':_0x1df22a['params']['id']},'transaction':_0x25a23a});});})[_0x18d3('0x13')](function(){_0x31e4ea['forEach'](function(_0xaafea2){socket[_0x18d3('0x56')](_0x18d3('0x57'),{'UserId':_0xaafea2['id'],'MailQueueId':_0x400a2c['id']});});});});});}})[_0x18d3('0x13')](respondWithStatusCode(_0x5eee45,null))[_0x18d3('0x26')](handleError(_0x5eee45,null));};exports['removeTeams']=function(_0x2dc086,_0x30241d){return db[_0x18d3('0x4e')][_0x18d3('0x24')]({'where':{'id':_0x2dc086[_0x18d3('0x2b')][_0x18d3('0x4d')]},'attributes':['id'],'include':[{'model':db[_0x18d3('0x4f')],'as':_0x18d3('0x50'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30241d,null))[_0x18d3('0x13')](function(_0x10e2a9){var _0x241f7b=_[_0x18d3('0x42')](_0x10e2a9,'id');var _0x1970bc=[];var _0x263d71=[];var _0x29af63=squel['select']();_0x29af63[_0x18d3('0x58')](_0x18d3('0x59'))[_0x18d3('0x5a')](_0x18d3('0x5b'),'tq')[_0x18d3('0x5c')](_0x18d3('0x5d'),'ut',_0x18d3('0x5e'))[_0x18d3('0x22')](_0x18d3('0x5f'),_0x2dc086[_0x18d3('0x28')]['id']);for(var _0x4d9ebe=0x0;_0x4d9ebe<_0x10e2a9[_0x18d3('0x30')];_0x4d9ebe+=0x1){let _0x2a4833=_0x10e2a9[_0x4d9ebe];for(var _0x867db4=0x0;_0x867db4<_0x2a4833[_0x18d3('0x50')]['length'];_0x867db4+=0x1){let _0x1f0c43=_0x2a4833[_0x18d3('0x50')][_0x867db4];var _0xa7cf3c=_0x29af63[_0x18d3('0x60')]();_0xa7cf3c[_0x18d3('0x22')](_0x18d3('0x61'),_0x1f0c43['id']);_0x263d71[_0x18d3('0x62')](db[_0x18d3('0x53')]['query'](_0xa7cf3c[_0x18d3('0x63')](),{'type':db[_0x18d3('0x53')][_0x18d3('0x64')]['SELECT']})[_0x18d3('0x13')](function(_0x4ceff2){if(_0x4ceff2['length']===0x1){return _0x1f0c43['id'];}else{var _0x27228e=_[_0x18d3('0x65')](_['map'](_0x4ceff2,'TeamId'),function(_0x49ccb2){return _[_0x18d3('0x66')](_0x241f7b,_0x49ccb2);});if(_0x27228e){return _0x1f0c43['id'];}}}));}}return BPromise[_0x18d3('0x67')](_0x263d71)[_0x18d3('0x13')](function(_0x4e2ee3){_0x1970bc=_(_0x1970bc)[_0x18d3('0x68')](_0x4e2ee3)['compact']()[_0x18d3('0x69')]();return db[_0x18d3('0x1c')][_0x18d3('0x33')]({'where':{'id':_0x2dc086[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](function(_0x17745b){return db[_0x18d3('0x53')]['transaction'](function(_0x57a379){return _0x17745b['removeTeams'](_0x2dc086[_0x18d3('0x2b')][_0x18d3('0x4d')],{'transaction':_0x57a379})[_0x18d3('0x13')](function(){if(!_[_0x18d3('0x6a')](_0x1970bc)){return _0x17745b['removeAgents'](_0x1970bc,{'transaction':_0x57a379});}})[_0x18d3('0x13')](function(){_0x1970bc[_0x18d3('0x6b')](function(_0x3f19eb){socket[_0x18d3('0x56')](_0x18d3('0x6c'),{'UserId':_0x3f19eb,'MailQueueId':_0x17745b['id']});});});});});});})[_0x18d3('0x13')](respondWithStatusCode(_0x30241d,null))[_0x18d3('0x26')](handleError(_0x30241d,null));};exports[_0x18d3('0x6d')]=function(_0x418442,_0x2c1024){return db[_0x18d3('0x1c')][_0x18d3('0x33')]({'where':{'id':_0x418442[_0x18d3('0x28')]['id']}})['then'](handleEntityNotFound(_0x2c1024,null))['then'](function(_0x511887){if(_0x511887){return _0x511887[_0x18d3('0x6d')](_0x418442['body'][_0x18d3('0x4d')],_[_0x18d3('0x6e')](_0x418442[_0x18d3('0x35')],[_0x18d3('0x4d'),'id'])||{})[_0x18d3('0x6f')](function(_0x297e6d){for(var _0x59f2cb=0x0;_0x59f2cb<_0x418442[_0x18d3('0x35')][_0x18d3('0x4d')][_0x18d3('0x30')];_0x59f2cb+=0x1){socket[_0x18d3('0x56')](_0x18d3('0x57'),{'UserId':Number(_0x418442[_0x18d3('0x35')][_0x18d3('0x4d')][_0x59f2cb]),'MailQueueId':Number(_0x418442['params']['id'])});}return _0x297e6d;});}})[_0x18d3('0x13')](respondWithResult(_0x2c1024,null))[_0x18d3('0x26')](handleError(_0x2c1024,null));};exports[_0x18d3('0x70')]=function(_0x42a6ad,_0x19e7ce){return db[_0x18d3('0x1c')][_0x18d3('0x33')]({'where':{'id':_0x42a6ad[_0x18d3('0x28')]['id']}})[_0x18d3('0x13')](handleEntityNotFound(_0x19e7ce,null))[_0x18d3('0x13')](function(_0x11650e){if(_0x11650e){return _0x11650e[_0x18d3('0x70')](_0x42a6ad['query'][_0x18d3('0x4d')])[_0x18d3('0x13')](function(){if(_['isArray'](_0x42a6ad[_0x18d3('0x2b')]['ids'])){for(var _0x1923ec=0x0;_0x1923ec<_0x42a6ad[_0x18d3('0x2b')][_0x18d3('0x4d')]['length'];_0x1923ec+=0x1){socket[_0x18d3('0x56')](_0x18d3('0x6c'),{'UserId':Number(_0x42a6ad[_0x18d3('0x2b')][_0x18d3('0x4d')][_0x1923ec]),'MailQueueId':Number(_0x42a6ad[_0x18d3('0x28')]['id'])});}}else{socket['emit'](_0x18d3('0x6c'),{'UserId':Number(_0x42a6ad[_0x18d3('0x2b')][_0x18d3('0x4d')]),'MailQueueId':Number(_0x42a6ad[_0x18d3('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x19e7ce,null))[_0x18d3('0x26')](handleError(_0x19e7ce,null));};exports['getAgents']=function(_0x2f65ba,_0x8c74){var _0x42c957={};var _0x2b155c={};var _0x4934a3;var _0x419890;return db[_0x18d3('0x1c')][_0x18d3('0x48')]({'where':{'id':_0x2f65ba['params']['id']}})[_0x18d3('0x13')](handleEntityNotFound(_0x8c74,null))[_0x18d3('0x13')](function(_0x88020){if(_0x88020){_0x4934a3=_0x88020;_0x2b155c[_0x18d3('0x29')]=_['keys'](db[_0x18d3('0x4f')][_0x18d3('0x1d')]);_0x2b155c[_0x18d3('0x2b')]=_[_0x18d3('0x2a')](_0x2f65ba[_0x18d3('0x2b')]);_0x2b155c[_0x18d3('0x2c')]=_[_0x18d3('0x2d')](_0x2b155c['model'],_0x2b155c[_0x18d3('0x2b')]);_0x42c957['attributes']=_['intersection'](_0x2b155c[_0x18d3('0x29')],qs['fields'](_0x2f65ba[_0x18d3('0x2b')][_0x18d3('0x2f')]));_0x42c957[_0x18d3('0x2e')]=_0x42c957[_0x18d3('0x2e')]['length']?_0x42c957[_0x18d3('0x2e')]:_0x2b155c[_0x18d3('0x29')];_0x42c957[_0x18d3('0x49')]=qs[_0x18d3('0x3f')](_0x2f65ba['query']['sort']);_0x42c957[_0x18d3('0x22')]=qs['filters'](_[_0x18d3('0x4a')](_0x2f65ba[_0x18d3('0x2b')],_0x2b155c[_0x18d3('0x2c')]));if(_0x2f65ba[_0x18d3('0x2b')][_0x18d3('0x41')]){_0x42c957[_0x18d3('0x22')]=_[_0x18d3('0x31')](_0x42c957[_0x18d3('0x22')],{'$or':_[_0x18d3('0x42')](_0x42c957[_0x18d3('0x2e')],function(_0x5bca4f){var _0x35bef1={};_0x35bef1[_0x5bca4f]={'$like':'%'+_0x2f65ba[_0x18d3('0x2b')][_0x18d3('0x41')]+'%'};return _0x35bef1;})});}_0x42c957=_['merge']({},_0x42c957,_0x2f65ba[_0x18d3('0x32')]);return _0x4934a3[_0x18d3('0x71')](_0x42c957);}})[_0x18d3('0x13')](function(_0x2e21de){if(_0x2e21de){_0x419890=_0x2e21de['length'];if(!_0x2f65ba[_0x18d3('0x2b')][_0x18d3('0x3e')]('nolimit')){_0x42c957['limit']=qs[_0x18d3('0x10')](_0x2f65ba[_0x18d3('0x2b')][_0x18d3('0x10')]);_0x42c957[_0x18d3('0xe')]=qs['offset'](_0x2f65ba['query'][_0x18d3('0xe')]);}return _0x4934a3[_0x18d3('0x71')](_0x42c957);}})[_0x18d3('0x13')](function(_0x33d105){if(_0x33d105){return _0x33d105?{'count':_0x419890,'rows':_0x33d105}:null;}})[_0x18d3('0x13')](respondWithResult(_0x8c74,null))[_0x18d3('0x26')](handleError(_0x8c74,null));}; \ No newline at end of file +var _0x8fac=['autoAssociation','body','describe','getMembers','findOne','UserMailQueue','nolimit','sort','pick','MailQueueId','filter','merge','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','Team','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','get','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8fac,0xbc));var _0xc8fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8fac[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0xc8fa('0x0'));var util=require(_0xc8fa('0x1'));var _=require(_0xc8fa('0x2'));var squel=require(_0xc8fa('0x3'));var Redis=require(_0xc8fa('0x4'));var qs=require(_0xc8fa('0x5'));var logger=require('../../config/logger')('api');var config=require(_0xc8fa('0x6'));var db=require('../../mysqldb')['db'];config[_0xc8fa('0x7')]=_[_0xc8fa('0x8')](config[_0xc8fa('0x7')],{'host':_0xc8fa('0x9'),'port':0x18eb});var socket=require(_0xc8fa('0xa'))(new Redis(config[_0xc8fa('0x7')]));require(_0xc8fa('0xb'))[_0xc8fa('0xc')](socket);function respondWithStatusCode(_0x284c82,_0x202d38){_0x202d38=_0x202d38||0xcc;return function(_0x31930e){if(_0x31930e){return _0x284c82[_0xc8fa('0xd')](_0x202d38);}return _0x284c82[_0xc8fa('0xe')](_0x202d38)[_0xc8fa('0xf')]();};}function respondWithResult(_0x5f2f36,_0x5cb6b4){_0x5cb6b4=_0x5cb6b4||0xc8;return function(_0x4c0b9d){if(_0x4c0b9d){return _0x5f2f36[_0xc8fa('0xe')](_0x5cb6b4)[_0xc8fa('0x10')](_0x4c0b9d);}};}function respondWithFilteredResult(_0x4a4b53,_0x1e690a){return function(_0x58291e){if(_0x58291e){var _0x481a6e=typeof _0x1e690a['offset']===_0xc8fa('0x11')&&typeof _0x1e690a[_0xc8fa('0x12')]===_0xc8fa('0x11');var _0x2fc296=_0x58291e[_0xc8fa('0x13')];var _0x6a01ff=_0x481a6e?0x0:_0x1e690a['offset'];var _0x31b02d=_0x481a6e?_0x58291e[_0xc8fa('0x13')]:_0x1e690a[_0xc8fa('0x14')]+_0x1e690a[_0xc8fa('0x12')];var _0x2b821d;if(_0x31b02d>=_0x2fc296){_0x31b02d=_0x2fc296;_0x2b821d=0xc8;}else{_0x2b821d=0xce;}_0x4a4b53['status'](_0x2b821d);return _0x4a4b53[_0xc8fa('0x15')]('Content-Range',_0x6a01ff+'-'+_0x31b02d+'/'+_0x2fc296)[_0xc8fa('0x10')](_0x58291e);}return null;};}function saveUpdates(_0x496a88){return function(_0x4cf7be){if(_0x4cf7be){return _0x4cf7be[_0xc8fa('0x16')](_0x496a88)[_0xc8fa('0x17')](function(_0x1df53){return _0x1df53;});}return null;};}function removeEntity(_0x1f27b4){return function(_0x5d50ed){if(_0x5d50ed){return _0x5d50ed[_0xc8fa('0x18')]()['then'](function(){var _0x470f8b=_0x5d50ed[_0xc8fa('0x19')]({'plain':!![]});var _0x5c1a93='MailQueues';return db['UserProfileResource'][_0xc8fa('0x18')]({'where':{'type':_0x5c1a93,'resourceId':_0x470f8b['id']}})[_0xc8fa('0x17')](function(){return _0x5d50ed;});})['then'](function(){_0x1f27b4[_0xc8fa('0xe')](0xcc)[_0xc8fa('0xf')]();});}};}function handleEntityNotFound(_0x3d82cb){return function(_0x3ed2c6){if(!_0x3ed2c6){_0x3d82cb[_0xc8fa('0xd')](0x194);}return _0x3ed2c6;};}function handleError(_0x2d2194,_0x47e89f){_0x47e89f=_0x47e89f||0x1f4;return function(_0x6bd4fc){logger[_0xc8fa('0x1a')](_0x6bd4fc[_0xc8fa('0x1b')]);if(_0x6bd4fc[_0xc8fa('0x1c')]){delete _0x6bd4fc[_0xc8fa('0x1c')];}_0x2d2194['status'](_0x47e89f)[_0xc8fa('0x1d')](_0x6bd4fc);};}exports[_0xc8fa('0x1e')]=function(_0xc00d5b,_0x126ed0){var _0x3e081={};var _0x5a055f={'count':0x0,'rows':[]};var _0x424f69=_[_0xc8fa('0x1f')](db[_0xc8fa('0x20')][_0xc8fa('0x21')],function(_0x33371b){return{'name':_0x33371b[_0xc8fa('0x22')],'type':_0x33371b['type'][_0xc8fa('0x23')]};});_0x3e081=qs[_0xc8fa('0x24')](_0x424f69,_0xc00d5b);var _0x45fe27={'where':_0x3e081[_0xc8fa('0x25')]};return db['MailQueue'][_0xc8fa('0x13')](_0x45fe27)[_0xc8fa('0x17')](function(_0x43fb54){_0x5a055f[_0xc8fa('0x13')]=_0x43fb54;_0x3e081[_0xc8fa('0x26')]=qs[_0xc8fa('0x26')](_0xc00d5b[_0xc8fa('0x27')]);return db[_0xc8fa('0x20')][_0xc8fa('0x28')](_0x3e081);})[_0xc8fa('0x17')](function(_0x466614){_0x5a055f[_0xc8fa('0x29')]=_0x466614;return _0x5a055f;})[_0xc8fa('0x17')](respondWithFilteredResult(_0x126ed0,_0x3e081))[_0xc8fa('0x2a')](handleError(_0x126ed0,null));};exports[_0xc8fa('0x2b')]=function(_0x195330,_0x32bff5){var _0x1e9cd8={'raw':!![],'where':{'id':_0x195330[_0xc8fa('0x2c')]['id']}},_0x98734e={};_0x98734e['model']=_[_0xc8fa('0x2d')](db['MailQueue'][_0xc8fa('0x21')]);_0x98734e[_0xc8fa('0x27')]=_['keys'](_0x195330[_0xc8fa('0x27')]);_0x98734e[_0xc8fa('0x2e')]=_[_0xc8fa('0x2f')](_0x98734e[_0xc8fa('0x30')],_0x98734e[_0xc8fa('0x27')]);_0x1e9cd8[_0xc8fa('0x31')]=_[_0xc8fa('0x2f')](_0x98734e[_0xc8fa('0x30')],qs[_0xc8fa('0x32')](_0x195330[_0xc8fa('0x27')]['fields']));_0x1e9cd8[_0xc8fa('0x31')]=_0x1e9cd8[_0xc8fa('0x31')][_0xc8fa('0x33')]?_0x1e9cd8[_0xc8fa('0x31')]:_0x98734e['model'];if(_0x195330[_0xc8fa('0x27')][_0xc8fa('0x34')]){_0x1e9cd8[_0xc8fa('0x26')]=[{'all':!![]}];}_0x1e9cd8=_['merge']({},_0x1e9cd8,_0x195330[_0xc8fa('0x35')]);return db[_0xc8fa('0x20')][_0xc8fa('0x36')](_0x1e9cd8)[_0xc8fa('0x17')](handleEntityNotFound(_0x32bff5,null))[_0xc8fa('0x17')](respondWithResult(_0x32bff5,null))[_0xc8fa('0x2a')](handleError(_0x32bff5,null));};exports[_0xc8fa('0x37')]=function(_0x3ca558,_0x4b26e0){return db[_0xc8fa('0x20')][_0xc8fa('0x37')](_0x3ca558['body'],{})['then'](function(_0x732ad){var _0x1380e0=_0x3ca558[_0xc8fa('0x38')][_0xc8fa('0x19')]({'plain':!![]});if(!_0x1380e0)throw new Error(_0xc8fa('0x39'));if(_0x1380e0[_0xc8fa('0x3a')]===_0xc8fa('0x38')){var _0x552f1d=_0x732ad[_0xc8fa('0x19')]({'plain':!![]});var _0x4caa5d=_0xc8fa('0x3b');return db[_0xc8fa('0x3c')][_0xc8fa('0x36')]({'where':{'name':_0x4caa5d,'userProfileId':_0x1380e0[_0xc8fa('0x3d')]},'raw':!![]})[_0xc8fa('0x17')](function(_0x4833c2){if(_0x4833c2&&_0x4833c2[_0xc8fa('0x3e')]===0x0){return db['UserProfileResource'][_0xc8fa('0x37')]({'name':_0x552f1d[_0xc8fa('0x1c')],'resourceId':_0x552f1d['id'],'type':_0x4833c2[_0xc8fa('0x1c')],'sectionId':_0x4833c2['id']},{})[_0xc8fa('0x17')](function(){return _0x732ad;});}else{return _0x732ad;}})['catch'](function(_0x285d1d){logger[_0xc8fa('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x285d1d);throw _0x285d1d;});}return _0x732ad;})[_0xc8fa('0x17')](respondWithResult(_0x4b26e0,0xc9))[_0xc8fa('0x2a')](handleError(_0x4b26e0,null));};exports[_0xc8fa('0x16')]=function(_0x3b9ba9,_0x2ce4a9){if(_0x3b9ba9[_0xc8fa('0x3f')]['id']){delete _0x3b9ba9['body']['id'];}return db[_0xc8fa('0x20')][_0xc8fa('0x36')]({'where':{'id':_0x3b9ba9[_0xc8fa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2ce4a9,null))['then'](saveUpdates(_0x3b9ba9[_0xc8fa('0x3f')],null))[_0xc8fa('0x17')](respondWithResult(_0x2ce4a9,null))[_0xc8fa('0x2a')](handleError(_0x2ce4a9,null));};exports['destroy']=function(_0x23292c,_0x438dc4){return db['MailQueue'][_0xc8fa('0x36')]({'where':{'id':_0x23292c[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](handleEntityNotFound(_0x438dc4,null))[_0xc8fa('0x17')](removeEntity(_0x438dc4,null))[_0xc8fa('0x2a')](handleError(_0x438dc4,null));};exports[_0xc8fa('0x40')]=function(_0x15c7e4,_0x2986b9){return db['MailQueue'][_0xc8fa('0x40')]()['then'](respondWithResult(_0x2986b9,null))[_0xc8fa('0x2a')](handleError(_0x2986b9,null));};exports[_0xc8fa('0x41')]=function(_0x18e490,_0x198c0a){var _0xe41723={'raw':!![],'where':{}},_0x22494d={},_0x46966d;return db[_0xc8fa('0x20')][_0xc8fa('0x42')]({'where':{'id':_0x18e490[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](handleEntityNotFound(_0x198c0a,null))[_0xc8fa('0x17')](function(_0x4a886c){if(_0x4a886c){_0x46966d=_0x4a886c[_0xc8fa('0x19')]({'plain':!![]});_0x22494d[_0xc8fa('0x30')]=_['keys'](db[_0xc8fa('0x43')]['rawAttributes']);_0x22494d[_0xc8fa('0x27')]=_[_0xc8fa('0x2d')](_0x18e490[_0xc8fa('0x27')]);_0x22494d[_0xc8fa('0x2e')]=_[_0xc8fa('0x2f')](_0x22494d[_0xc8fa('0x30')],_0x22494d[_0xc8fa('0x27')]);_0xe41723['attributes']=_['intersection'](_0x22494d[_0xc8fa('0x30')],qs['fields'](_0x18e490['query'][_0xc8fa('0x32')]));_0xe41723['attributes']=_0xe41723['attributes'][_0xc8fa('0x33')]?_0xe41723[_0xc8fa('0x31')]:_0x22494d[_0xc8fa('0x30')];if(!_0x18e490[_0xc8fa('0x27')]['hasOwnProperty'](_0xc8fa('0x44'))){_0xe41723[_0xc8fa('0x12')]=qs[_0xc8fa('0x12')](_0x18e490['query']['limit']);_0xe41723[_0xc8fa('0x14')]=qs[_0xc8fa('0x14')](_0x18e490[_0xc8fa('0x27')][_0xc8fa('0x14')]);}_0xe41723['order']=qs[_0xc8fa('0x45')](_0x18e490['query'][_0xc8fa('0x45')]);_0xe41723['where']=qs[_0xc8fa('0x2e')](_[_0xc8fa('0x46')](_0x18e490[_0xc8fa('0x27')],_0x22494d['filters']));_0xe41723[_0xc8fa('0x25')][_0xc8fa('0x47')]=_0x4a886c['id'];if(_0x18e490[_0xc8fa('0x27')][_0xc8fa('0x48')]){_0xe41723[_0xc8fa('0x25')]=_[_0xc8fa('0x49')](_0xe41723['where'],{'$or':_[_0xc8fa('0x1f')](_0xe41723[_0xc8fa('0x31')],function(_0x28f034){var _0x6e4f43={};_0x6e4f43[_0x28f034]={'$like':'%'+_0x18e490[_0xc8fa('0x27')][_0xc8fa('0x48')]+'%'};return _0x6e4f43;})});}_0xe41723=_[_0xc8fa('0x49')]({},_0xe41723,_0x18e490[_0xc8fa('0x35')]);return db['UserMailQueue'][_0xc8fa('0x28')](_0xe41723);}})[_0xc8fa('0x17')](function(_0x3c1414){if(_0x3c1414){return db[_0xc8fa('0x4a')]['findAndCountAll']({'where':{'id':_[_0xc8fa('0x1f')](_0x3c1414,_0xc8fa('0x4b')),'role':_0xc8fa('0x4c')},'attributes':['id','name',_0xc8fa('0x4d'),_0xc8fa('0x4e'),_0xc8fa('0x4f')]});}})[_0xc8fa('0x17')](function(_0xbd47d6){if(_0xbd47d6){return{'count':_0xbd47d6[_0xc8fa('0x13')],'rows':_[_0xc8fa('0x1f')](_0xbd47d6[_0xc8fa('0x29')],function(_0x471dc5){return{'membername':_0x471dc5[_0xc8fa('0x1c')],'UserId':_0x471dc5['id'],'queue_name':_0x46966d[_0xc8fa('0x1c')],'MailQueueId':_0x46966d['id'],'interface':util[_0xc8fa('0x50')](_0xc8fa('0x51'),_0xc8fa('0x52'),_0x471dc5[_0xc8fa('0x1c')]),'penalty':0x0,'paused':_0x471dc5[_0xc8fa('0x4d')],'createdAt':_0x471dc5[_0xc8fa('0x4f')],'updatedAt':_0x471dc5[_0xc8fa('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc8fa('0x17')](respondWithFilteredResult(_0x198c0a,_0xe41723))[_0xc8fa('0x2a')](handleError(_0x198c0a,null));};exports[_0xc8fa('0x53')]=function(_0x15a399,_0x45b848){var _0x4e5628={};var _0x3d8328={};var _0x15b19a;var _0x4516bd;return db[_0xc8fa('0x20')][_0xc8fa('0x42')]({'where':{'id':_0x15a399[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](handleEntityNotFound(_0x45b848,null))[_0xc8fa('0x17')](function(_0x31efb8){if(_0x31efb8){_0x15b19a=_0x31efb8;_0x3d8328[_0xc8fa('0x30')]=_['keys'](db['Team'][_0xc8fa('0x21')]);_0x3d8328[_0xc8fa('0x27')]=_[_0xc8fa('0x2d')](_0x15a399[_0xc8fa('0x27')]);_0x3d8328['filters']=_[_0xc8fa('0x2f')](_0x3d8328['model'],_0x3d8328['query']);_0x4e5628[_0xc8fa('0x31')]=_[_0xc8fa('0x2f')](_0x3d8328['model'],qs[_0xc8fa('0x32')](_0x15a399[_0xc8fa('0x27')][_0xc8fa('0x32')]));_0x4e5628[_0xc8fa('0x31')]=_0x4e5628[_0xc8fa('0x31')][_0xc8fa('0x33')]?_0x4e5628[_0xc8fa('0x31')]:_0x3d8328[_0xc8fa('0x30')];_0x4e5628[_0xc8fa('0x54')]=qs[_0xc8fa('0x45')](_0x15a399[_0xc8fa('0x27')][_0xc8fa('0x45')]);_0x4e5628['where']=qs['filters'](_['pick'](_0x15a399[_0xc8fa('0x27')],_0x3d8328[_0xc8fa('0x2e')]));if(_0x15a399['query'][_0xc8fa('0x48')]){_0x4e5628[_0xc8fa('0x25')]=_[_0xc8fa('0x49')](_0x4e5628[_0xc8fa('0x25')],{'$or':_[_0xc8fa('0x1f')](_0x4e5628[_0xc8fa('0x31')],function(_0x5f21e6){var _0x1b9e81={};_0x1b9e81[_0x5f21e6]={'$like':'%'+_0x15a399[_0xc8fa('0x27')]['filter']+'%'};return _0x1b9e81;})});}_0x4e5628=_[_0xc8fa('0x49')]({},_0x4e5628,_0x15a399[_0xc8fa('0x35')]);return _0x15b19a[_0xc8fa('0x53')](_0x4e5628);}})[_0xc8fa('0x17')](function(_0x1646ad){if(_0x1646ad){_0x4516bd=_0x1646ad[_0xc8fa('0x33')];if(!_0x15a399['query'][_0xc8fa('0x55')]('nolimit')){_0x4e5628[_0xc8fa('0x12')]=qs[_0xc8fa('0x12')](_0x15a399[_0xc8fa('0x27')][_0xc8fa('0x12')]);_0x4e5628['offset']=qs[_0xc8fa('0x14')](_0x15a399[_0xc8fa('0x27')][_0xc8fa('0x14')]);}return _0x15b19a[_0xc8fa('0x53')](_0x4e5628);}})[_0xc8fa('0x17')](function(_0x496ec4){if(_0x496ec4){return _0x496ec4?{'count':_0x4516bd,'rows':_0x496ec4}:null;}})[_0xc8fa('0x17')](respondWithResult(_0x45b848,null))[_0xc8fa('0x2a')](handleError(_0x45b848,null));};exports[_0xc8fa('0x56')]=function(_0x18db46,_0x4dc8a3){var _0x5018c9=_0x18db46[_0xc8fa('0x3f')][_0xc8fa('0x57')];return db['Team'][_0xc8fa('0x28')]({'where':{'id':_0x5018c9},'attributes':['id'],'include':[{'model':db[_0xc8fa('0x4a')],'as':_0xc8fa('0x58'),'attributes':['id',_0xc8fa('0x1c'),_0xc8fa('0x59'),_0xc8fa('0x5a'),_0xc8fa('0x5b')],'raw':!![]}]})[_0xc8fa('0x17')](function(_0x391916){if(_0x391916){var _0x3a5d1b=_['flatMap'](_0x391916,function(_0x401500){var _0x1a7945=_0x401500['get']({'plain':!![]});return _0x1a7945[_0xc8fa('0x58')];});return db[_0xc8fa('0x20')][_0xc8fa('0x36')]({'where':{'id':_0x18db46[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](function(_0xc8bc79){return db[_0xc8fa('0x5c')][_0xc8fa('0x5d')](function(_0x3ede42){return _0xc8bc79[_0xc8fa('0x56')](_0x5018c9,{'transaction':_0x3ede42})[_0xc8fa('0x17')](function(){return BPromise[_0xc8fa('0x5e')](_0x3a5d1b,function(_0x198f1f){return db['UserMailQueue'][_0xc8fa('0x5f')]({'where':{'UserId':_0x198f1f['id'],'MailQueueId':_0x18db46['params']['id']},'transaction':_0x3ede42});});})[_0xc8fa('0x17')](function(){_0x3a5d1b[_0xc8fa('0x60')](function(_0x469946){socket[_0xc8fa('0x61')]('userMailQueue:save',{'UserId':_0x469946['id'],'MailQueueId':_0xc8bc79['id']});});});});});}})[_0xc8fa('0x17')](respondWithStatusCode(_0x4dc8a3,null))['catch'](handleError(_0x4dc8a3,null));};exports[_0xc8fa('0x62')]=function(_0x1fbb88,_0x240357){return db[_0xc8fa('0x63')][_0xc8fa('0x28')]({'where':{'id':_0x1fbb88[_0xc8fa('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc8fa('0x4a')],'as':_0xc8fa('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc8fa('0x17')](handleEntityNotFound(_0x240357,null))[_0xc8fa('0x17')](function(_0x59d9a2){var _0x195a22=_[_0xc8fa('0x1f')](_0x59d9a2,'id');var _0x5919dc=[];var _0x17ed84=[];var _0x10d9bb=squel[_0xc8fa('0x64')]();_0x10d9bb['field'](_0xc8fa('0x65'))[_0xc8fa('0x66')](_0xc8fa('0x67'),'tq')[_0xc8fa('0x68')](_0xc8fa('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc8fa('0x6a'),_0x1fbb88[_0xc8fa('0x2c')]['id']);for(var _0x1cbe4b=0x0;_0x1cbe4b<_0x59d9a2[_0xc8fa('0x33')];_0x1cbe4b+=0x1){let _0x40312b=_0x59d9a2[_0x1cbe4b];for(var _0x40c66c=0x0;_0x40c66c<_0x40312b[_0xc8fa('0x58')][_0xc8fa('0x33')];_0x40c66c+=0x1){let _0x1ed9f8=_0x40312b[_0xc8fa('0x58')][_0x40c66c];var _0x20fe71=_0x10d9bb[_0xc8fa('0x6b')]();_0x20fe71[_0xc8fa('0x25')]('ut.UserId\x20=\x20?',_0x1ed9f8['id']);_0x17ed84[_0xc8fa('0x6c')](db[_0xc8fa('0x5c')][_0xc8fa('0x27')](_0x20fe71[_0xc8fa('0x6d')](),{'type':db[_0xc8fa('0x5c')][_0xc8fa('0x6e')][_0xc8fa('0x6f')]})[_0xc8fa('0x17')](function(_0x12bd02){if(_0x12bd02[_0xc8fa('0x33')]===0x1){return _0x1ed9f8['id'];}else{var _0x498c3e=_[_0xc8fa('0x70')](_[_0xc8fa('0x1f')](_0x12bd02,_0xc8fa('0x71')),function(_0x564a4a){return _[_0xc8fa('0x72')](_0x195a22,_0x564a4a);});if(_0x498c3e){return _0x1ed9f8['id'];}}}));}}return BPromise['all'](_0x17ed84)[_0xc8fa('0x17')](function(_0x3bb751){_0x5919dc=_(_0x5919dc)[_0xc8fa('0x73')](_0x3bb751)[_0xc8fa('0x74')]()['value']();return db[_0xc8fa('0x20')][_0xc8fa('0x36')]({'where':{'id':_0x1fbb88[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](function(_0x281959){return db[_0xc8fa('0x5c')][_0xc8fa('0x5d')](function(_0x142ee8){return _0x281959['removeTeams'](_0x1fbb88[_0xc8fa('0x27')][_0xc8fa('0x57')],{'transaction':_0x142ee8})[_0xc8fa('0x17')](function(){if(!_[_0xc8fa('0x75')](_0x5919dc)){return _0x281959[_0xc8fa('0x76')](_0x5919dc,{'transaction':_0x142ee8});}})[_0xc8fa('0x17')](function(){_0x5919dc[_0xc8fa('0x60')](function(_0x273b41){socket['emit']('userMailQueue:remove',{'UserId':_0x273b41,'MailQueueId':_0x281959['id']});});});});});});})[_0xc8fa('0x17')](respondWithStatusCode(_0x240357,null))[_0xc8fa('0x2a')](handleError(_0x240357,null));};exports['addAgents']=function(_0x5d8725,_0x27bd76){return db[_0xc8fa('0x20')][_0xc8fa('0x36')]({'where':{'id':_0x5d8725[_0xc8fa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x27bd76,null))[_0xc8fa('0x17')](function(_0x3fb3ac){if(_0x3fb3ac){return _0x3fb3ac[_0xc8fa('0x77')](_0x5d8725[_0xc8fa('0x3f')][_0xc8fa('0x57')],_[_0xc8fa('0x78')](_0x5d8725[_0xc8fa('0x3f')],[_0xc8fa('0x57'),'id'])||{})[_0xc8fa('0x79')](function(_0x4022bf){for(var _0x146a09=0x0;_0x146a09<_0x5d8725['body']['ids']['length'];_0x146a09+=0x1){socket[_0xc8fa('0x61')]('userMailQueue:save',{'UserId':Number(_0x5d8725['body'][_0xc8fa('0x57')][_0x146a09]),'MailQueueId':Number(_0x5d8725['params']['id'])});}return _0x4022bf;});}})[_0xc8fa('0x17')](respondWithResult(_0x27bd76,null))[_0xc8fa('0x2a')](handleError(_0x27bd76,null));};exports['removeAgents']=function(_0x1ed66b,_0x15947a){return db[_0xc8fa('0x20')][_0xc8fa('0x36')]({'where':{'id':_0x1ed66b[_0xc8fa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x15947a,null))['then'](function(_0x1191a3){if(_0x1191a3){return _0x1191a3[_0xc8fa('0x76')](_0x1ed66b[_0xc8fa('0x27')][_0xc8fa('0x57')])['then'](function(){if(_[_0xc8fa('0x7a')](_0x1ed66b[_0xc8fa('0x27')][_0xc8fa('0x57')])){for(var _0x5215d1=0x0;_0x5215d1<_0x1ed66b[_0xc8fa('0x27')][_0xc8fa('0x57')][_0xc8fa('0x33')];_0x5215d1+=0x1){socket[_0xc8fa('0x61')](_0xc8fa('0x7b'),{'UserId':Number(_0x1ed66b['query'][_0xc8fa('0x57')][_0x5215d1]),'MailQueueId':Number(_0x1ed66b['params']['id'])});}}else{socket['emit'](_0xc8fa('0x7b'),{'UserId':Number(_0x1ed66b[_0xc8fa('0x27')][_0xc8fa('0x57')]),'MailQueueId':Number(_0x1ed66b[_0xc8fa('0x2c')]['id'])});}});}})[_0xc8fa('0x17')](respondWithStatusCode(_0x15947a,null))[_0xc8fa('0x2a')](handleError(_0x15947a,null));};exports[_0xc8fa('0x7c')]=function(_0x4ab54d,_0x2cfb78){var _0x200785={};var _0x5e8d90={};var _0x39e640;var _0x2ac6cd;return db[_0xc8fa('0x20')]['findOne']({'where':{'id':_0x4ab54d[_0xc8fa('0x2c')]['id']}})[_0xc8fa('0x17')](handleEntityNotFound(_0x2cfb78,null))[_0xc8fa('0x17')](function(_0x2fdfbd){if(_0x2fdfbd){_0x39e640=_0x2fdfbd;_0x5e8d90[_0xc8fa('0x30')]=_['keys'](db[_0xc8fa('0x4a')]['rawAttributes']);_0x5e8d90[_0xc8fa('0x27')]=_[_0xc8fa('0x2d')](_0x4ab54d[_0xc8fa('0x27')]);_0x5e8d90[_0xc8fa('0x2e')]=_[_0xc8fa('0x2f')](_0x5e8d90[_0xc8fa('0x30')],_0x5e8d90[_0xc8fa('0x27')]);_0x200785[_0xc8fa('0x31')]=_['intersection'](_0x5e8d90['model'],qs['fields'](_0x4ab54d['query'][_0xc8fa('0x32')]));_0x200785['attributes']=_0x200785[_0xc8fa('0x31')]['length']?_0x200785[_0xc8fa('0x31')]:_0x5e8d90[_0xc8fa('0x30')];_0x200785[_0xc8fa('0x54')]=qs[_0xc8fa('0x45')](_0x4ab54d[_0xc8fa('0x27')][_0xc8fa('0x45')]);_0x200785['where']=qs[_0xc8fa('0x2e')](_[_0xc8fa('0x46')](_0x4ab54d[_0xc8fa('0x27')],_0x5e8d90['filters']));if(_0x4ab54d[_0xc8fa('0x27')][_0xc8fa('0x48')]){_0x200785[_0xc8fa('0x25')]=_[_0xc8fa('0x49')](_0x200785[_0xc8fa('0x25')],{'$or':_[_0xc8fa('0x1f')](_0x200785[_0xc8fa('0x31')],function(_0x2bf1fc){var _0xa9f27e={};_0xa9f27e[_0x2bf1fc]={'$like':'%'+_0x4ab54d[_0xc8fa('0x27')][_0xc8fa('0x48')]+'%'};return _0xa9f27e;})});}_0x200785=_[_0xc8fa('0x49')]({},_0x200785,_0x4ab54d['options']);return _0x39e640[_0xc8fa('0x7c')](_0x200785);}})[_0xc8fa('0x17')](function(_0xc02759){if(_0xc02759){_0x2ac6cd=_0xc02759['length'];if(!_0x4ab54d[_0xc8fa('0x27')][_0xc8fa('0x55')]('nolimit')){_0x200785[_0xc8fa('0x12')]=qs[_0xc8fa('0x12')](_0x4ab54d[_0xc8fa('0x27')][_0xc8fa('0x12')]);_0x200785[_0xc8fa('0x14')]=qs[_0xc8fa('0x14')](_0x4ab54d[_0xc8fa('0x27')]['offset']);}return _0x39e640[_0xc8fa('0x7c')](_0x200785);}})['then'](function(_0x4043bc){if(_0x4043bc){return _0x4043bc?{'count':_0x2ac6cd,'rows':_0x4043bc}:null;}})[_0xc8fa('0x17')](respondWithResult(_0x2cfb78,null))['catch'](handleError(_0x2cfb78,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a71d3f5..e29a70e 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 _0xb532=['hasOwnProperty','hook','exports','../../mysqldb','MailQueue','save','update','remove','emit'];(function(_0x374a7e,_0x47afcc){var _0x479891=function(_0x54def9){while(--_0x54def9){_0x374a7e['push'](_0x374a7e['shift']());}};_0x479891(++_0x47afcc);}(_0xb532,0x13e));var _0x2b53=function(_0x5f5164,_0xa128be){_0x5f5164=_0x5f5164-0x0;var _0x3ec41d=_0xb532[_0x5f5164];return _0x3ec41d;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2b53('0x0'))['db'][_0x2b53('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b53('0x2'),'afterUpdate':_0x2b53('0x3'),'afterDestroy':_0x2b53('0x4')};function emitEvent(_0x5d6e93){return function(_0x5c17b8,_0x47fa10,_0x42b073){MailQueueEvents[_0x2b53('0x5')](_0x5d6e93+':'+_0x5c17b8['id'],_0x5c17b8);MailQueueEvents['emit'](_0x5d6e93,_0x5c17b8);_0x42b073(null);};}for(var e in events){if(events[_0x2b53('0x6')](e)){var event=events[e];MailQueue[_0x2b53('0x7')](e,emitEvent(event));}}module[_0x2b53('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x7e19=['events','MailQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x192a8e,_0x2fc581){var _0x284767=function(_0x5959b1){while(--_0x5959b1){_0x192a8e['push'](_0x192a8e['shift']());}};_0x284767(++_0x2fc581);}(_0x7e19,0xa0));var _0x97e1=function(_0x574b2a,_0x4aac51){_0x574b2a=_0x574b2a-0x0;var _0x5a34c5=_0x7e19[_0x574b2a];return _0x5a34c5;};'use strict';var EventEmitter=require(_0x97e1('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x97e1('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x97e1('0x2')](0x0);var events={'afterCreate':_0x97e1('0x3'),'afterUpdate':'update','afterDestroy':_0x97e1('0x4')};function emitEvent(_0x4692e1){return function(_0xd406f6,_0x383d4d,_0x5e89f2){MailQueueEvents['emit'](_0x4692e1+':'+_0xd406f6['id'],_0xd406f6);MailQueueEvents[_0x97e1('0x5')](_0x4692e1,_0xd406f6);_0x5e89f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x97e1('0x6')](e,emitEvent(event));}}module[_0x97e1('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 e12f5e3..d221c0c 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 _0x7ed1=['exports','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes'];(function(_0x28492b,_0x1cd247){var _0x1fa7b5=function(_0x57e17c){while(--_0x57e17c){_0x28492b['push'](_0x28492b['shift']());}};_0x1fa7b5(++_0x1cd247);}(_0x7ed1,0x93));var _0x17ed=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7ed1[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0x17ed('0x0'));var util=require(_0x17ed('0x1'));var logger=require('../../config/logger')(_0x17ed('0x2'));var moment=require(_0x17ed('0x3'));var BPromise=require(_0x17ed('0x4'));var rp=require(_0x17ed('0x5'));var fs=require('fs');var path=require(_0x17ed('0x6'));var rimraf=require(_0x17ed('0x7'));var config=require('../../config/environment');var attributes=require(_0x17ed('0x8'));module[_0x17ed('0x9')]=function(_0x58af9a,_0x54a68d){return _0x58af9a['define'](_0x17ed('0xa'),attributes,{'tableName':_0x17ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeae=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x4367b8,_0x4209a3){var _0x1d1676=function(_0x1b2a90){while(--_0x1b2a90){_0x4367b8['push'](_0x4367b8['shift']());}};_0x1d1676(++_0x4209a3);}(_0xeeae,0x119));var _0xeeea=function(_0x55d070,_0x217865){_0x55d070=_0x55d070-0x0;var _0x1b4b62=_0xeeae[_0x55d070];return _0x1b4b62;};'use strict';var _=require(_0xeeea('0x0'));var util=require(_0xeeea('0x1'));var logger=require(_0xeeea('0x2'))(_0xeeea('0x3'));var moment=require(_0xeeea('0x4'));var BPromise=require(_0xeeea('0x5'));var rp=require(_0xeeea('0x6'));var fs=require('fs');var path=require(_0xeeea('0x7'));var rimraf=require(_0xeeea('0x8'));var config=require(_0xeeea('0x9'));var attributes=require(_0xeeea('0xa'));module[_0xeeea('0xb')]=function(_0x3ea3e3,_0x3288c9){return _0x3ea3e3[_0xeeea('0xc')](_0xeeea('0xd'),attributes,{'tableName':_0xeeea('0xe'),'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 785f3bd..c122d8e 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 _0x6675=['result','GetMailQueue','MailQueue','options','where','attributes','limit','include','model','map','stringify','catch','find','raw','ShowMailQueue','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x410fda,_0x3a5a6f){var _0x3bfb38=function(_0x187d11){while(--_0x187d11){_0x410fda['push'](_0x410fda['shift']());}};_0x3bfb38(++_0x3a5a6f);}(_0x6675,0x15c));var _0x5667=function(_0x4f5ee8,_0x1d8506){_0x4f5ee8=_0x4f5ee8-0x0;var _0x41285f=_0x6675[_0x4f5ee8];return _0x41285f;};'use strict';var _=require(_0x5667('0x0'));var util=require('util');var moment=require(_0x5667('0x1'));var BPromise=require(_0x5667('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5667('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5667('0x4'))(_0x5667('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5667('0x6')][_0x5667('0x7')]({'port':0x232a});config[_0x5667('0x8')]=_['defaults'](config[_0x5667('0x8')],{'host':_0x5667('0x9'),'port':0x18eb});var socket=require(_0x5667('0xa'))(new Redis(config['redis']));require(_0x5667('0xb'))['register'](socket);function respondWithRpcPromise(_0x239ea9,_0x3aa78a,_0x424914){return new BPromise(function(_0x568c79,_0x545acc){return client[_0x5667('0xc')](_0x239ea9,_0x424914)[_0x5667('0xd')](function(_0x334e85){logger[_0x5667('0xe')](_0x5667('0xf'),_0x3aa78a,'request\x20sent');logger[_0x5667('0x10')](_0x5667('0x11'),_0x3aa78a,_0x5667('0x12'),JSON['stringify'](_0x334e85));if(_0x334e85[_0x5667('0x13')]){if(_0x334e85[_0x5667('0x13')][_0x5667('0x14')]===0x1f4){logger['error'](_0x5667('0xf'),_0x3aa78a,_0x334e85[_0x5667('0x13')][_0x5667('0x15')]);return _0x545acc(_0x334e85[_0x5667('0x13')][_0x5667('0x15')]);}logger['error'](_0x5667('0xf'),_0x3aa78a,_0x334e85[_0x5667('0x13')][_0x5667('0x15')]);return _0x568c79(_0x334e85['error'][_0x5667('0x15')]);}else{logger[_0x5667('0xe')]('MailQueue,\x20%s,\x20%s',_0x3aa78a,_0x5667('0x12'));_0x568c79(_0x334e85[_0x5667('0x16')][_0x5667('0x15')]);}})['catch'](function(_0x4e81be){logger['error'](_0x5667('0xf'),_0x3aa78a,_0x4e81be);_0x545acc(_0x4e81be);});});}exports[_0x5667('0x17')]=function(_0x66fc77){var _0x2a4ee0=this;return new Promise(function(_0x2998fc,_0xfef39a){return db[_0x5667('0x18')]['findAll']({'raw':_0x66fc77[_0x5667('0x19')]?_0x66fc77[_0x5667('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x66fc77[_0x5667('0x19')]?_0x66fc77[_0x5667('0x19')][_0x5667('0x1a')]||null:null,'attributes':_0x66fc77[_0x5667('0x19')]?_0x66fc77[_0x5667('0x19')][_0x5667('0x1b')]||null:null,'limit':_0x66fc77[_0x5667('0x19')]?_0x66fc77[_0x5667('0x19')][_0x5667('0x1c')]||null:null,'include':_0x66fc77['options']?_0x66fc77[_0x5667('0x19')][_0x5667('0x1d')]?_['map'](_0x66fc77[_0x5667('0x19')][_0x5667('0x1d')],function(_0x505c1b){return{'model':db[_0x505c1b[_0x5667('0x1e')]],'as':_0x505c1b['as'],'attributes':_0x505c1b[_0x5667('0x1b')],'include':_0x505c1b['include']?_['map'](_0x505c1b[_0x5667('0x1d')],function(_0x376e26){return{'model':db[_0x376e26['model']],'as':_0x376e26['as'],'attributes':_0x376e26[_0x5667('0x1b')],'include':_0x376e26['include']?_[_0x5667('0x1f')](_0x376e26[_0x5667('0x1d')],function(_0x45a454){return{'model':db[_0x45a454[_0x5667('0x1e')]],'as':_0x45a454['as'],'attributes':_0x45a454[_0x5667('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5667('0xd')](function(_0xfa811c){logger[_0x5667('0xe')]('GetMailQueue',_0x66fc77);logger[_0x5667('0x10')](_0x5667('0x17'),_0x66fc77,JSON[_0x5667('0x20')](_0xfa811c));_0x2998fc(_0xfa811c);})[_0x5667('0x21')](function(_0x547054){logger[_0x5667('0x13')](_0x5667('0x17'),_0x547054[_0x5667('0x15')],_0x66fc77);_0xfef39a(_0x2a4ee0[_0x5667('0x13')](0x1f4,_0x547054[_0x5667('0x15')]));});});};exports['ShowMailQueue']=function(_0x19edf8){var _0x137b9c=this;return new Promise(function(_0x59658c,_0x357b89){return db['MailQueue'][_0x5667('0x22')]({'raw':_0x19edf8[_0x5667('0x19')]?_0x19edf8[_0x5667('0x19')][_0x5667('0x23')]===undefined?!![]:![]:!![],'where':_0x19edf8[_0x5667('0x19')]?_0x19edf8[_0x5667('0x19')][_0x5667('0x1a')]||null:null,'attributes':_0x19edf8[_0x5667('0x19')]?_0x19edf8[_0x5667('0x19')]['attributes']||null:null,'include':_0x19edf8['options']?_0x19edf8[_0x5667('0x19')][_0x5667('0x1d')]?_[_0x5667('0x1f')](_0x19edf8[_0x5667('0x19')][_0x5667('0x1d')],function(_0x474e17){return{'model':db[_0x474e17[_0x5667('0x1e')]],'as':_0x474e17['as'],'attributes':_0x474e17[_0x5667('0x1b')],'include':_0x474e17[_0x5667('0x1d')]?_[_0x5667('0x1f')](_0x474e17['include'],function(_0x4e7ea1){return{'model':db[_0x4e7ea1[_0x5667('0x1e')]],'as':_0x4e7ea1['as'],'attributes':_0x4e7ea1[_0x5667('0x1b')],'include':_0x4e7ea1[_0x5667('0x1d')]?_[_0x5667('0x1f')](_0x4e7ea1[_0x5667('0x1d')],function(_0x100f14){return{'model':db[_0x100f14['model']],'as':_0x100f14['as'],'attributes':_0x100f14[_0x5667('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5667('0xd')](function(_0x4f7db9){logger[_0x5667('0xe')](_0x5667('0x24'),_0x19edf8);logger['debug']('ShowMailQueue',_0x19edf8,JSON[_0x5667('0x20')](_0x4f7db9));_0x59658c(_0x4f7db9);})[_0x5667('0x21')](function(_0x1fd8cd){logger[_0x5667('0x13')](_0x5667('0x24'),_0x1fd8cd[_0x5667('0x15')],_0x19edf8);_0x357b89(_0x137b9c[_0x5667('0x13')](0x1f4,_0x1fd8cd[_0x5667('0x15')]));});});}; \ No newline at end of file +var _0x9db3=['catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','socket.io-emitter','./mailQueue.socket','then','request\x20sent','debug','error','code','message','MailQueue,\x20%s,\x20%s','info','result'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x9db3,0xe0));var _0x39db=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9db3[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x39db('0x0'));var moment=require(_0x39db('0x1'));var BPromise=require(_0x39db('0x2'));var rs=require(_0x39db('0x3'));var fs=require('fs');var Redis=require(_0x39db('0x4'));var db=require(_0x39db('0x5'))['db'];var utils=require(_0x39db('0x6'));var logger=require(_0x39db('0x7'))('rpc');var config=require(_0x39db('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x39db('0x9')]=_['defaults'](config[_0x39db('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x39db('0xa'))(new Redis(config[_0x39db('0x9')]));require(_0x39db('0xb'))['register'](socket);function respondWithRpcPromise(_0x3b981d,_0x1426ad,_0x33b377){return new BPromise(function(_0x13a6eb,_0x49de25){return client['request'](_0x3b981d,_0x33b377)[_0x39db('0xc')](function(_0x2f7e87){logger['info']('MailQueue,\x20%s,\x20%s',_0x1426ad,_0x39db('0xd'));logger[_0x39db('0xe')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x1426ad,_0x39db('0xd'),JSON['stringify'](_0x2f7e87));if(_0x2f7e87[_0x39db('0xf')]){if(_0x2f7e87[_0x39db('0xf')][_0x39db('0x10')]===0x1f4){logger[_0x39db('0xf')]('MailQueue,\x20%s,\x20%s',_0x1426ad,_0x2f7e87[_0x39db('0xf')]['message']);return _0x49de25(_0x2f7e87[_0x39db('0xf')][_0x39db('0x11')]);}logger[_0x39db('0xf')](_0x39db('0x12'),_0x1426ad,_0x2f7e87['error']['message']);return _0x13a6eb(_0x2f7e87[_0x39db('0xf')]['message']);}else{logger[_0x39db('0x13')](_0x39db('0x12'),_0x1426ad,_0x39db('0xd'));_0x13a6eb(_0x2f7e87[_0x39db('0x14')][_0x39db('0x11')]);}})[_0x39db('0x15')](function(_0x160601){logger[_0x39db('0xf')](_0x39db('0x12'),_0x1426ad,_0x160601);_0x49de25(_0x160601);});});}exports[_0x39db('0x16')]=function(_0x4cf3c1){var _0x4574e1=this;return new Promise(function(_0x3e405e,_0x55e142){return db[_0x39db('0x17')]['findAll']({'raw':_0x4cf3c1[_0x39db('0x18')]?_0x4cf3c1['options'][_0x39db('0x19')]===undefined?!![]:![]:!![],'where':_0x4cf3c1[_0x39db('0x18')]?_0x4cf3c1[_0x39db('0x18')][_0x39db('0x1a')]||null:null,'attributes':_0x4cf3c1[_0x39db('0x18')]?_0x4cf3c1[_0x39db('0x18')][_0x39db('0x1b')]||null:null,'limit':_0x4cf3c1[_0x39db('0x18')]?_0x4cf3c1[_0x39db('0x18')][_0x39db('0x1c')]||null:null,'include':_0x4cf3c1[_0x39db('0x18')]?_0x4cf3c1['options'][_0x39db('0x1d')]?_['map'](_0x4cf3c1[_0x39db('0x18')][_0x39db('0x1d')],function(_0x24f4cf){return{'model':db[_0x24f4cf[_0x39db('0x1e')]],'as':_0x24f4cf['as'],'attributes':_0x24f4cf[_0x39db('0x1b')],'include':_0x24f4cf['include']?_['map'](_0x24f4cf[_0x39db('0x1d')],function(_0x800e5d){return{'model':db[_0x800e5d[_0x39db('0x1e')]],'as':_0x800e5d['as'],'attributes':_0x800e5d[_0x39db('0x1b')],'include':_0x800e5d[_0x39db('0x1d')]?_[_0x39db('0x1f')](_0x800e5d[_0x39db('0x1d')],function(_0x462b88){return{'model':db[_0x462b88['model']],'as':_0x462b88['as'],'attributes':_0x462b88['attributes']};}):[]};}):[]};}):[]:[]})[_0x39db('0xc')](function(_0x5dbd0c){logger[_0x39db('0x13')]('GetMailQueue',_0x4cf3c1);logger[_0x39db('0xe')](_0x39db('0x16'),_0x4cf3c1,JSON[_0x39db('0x20')](_0x5dbd0c));_0x3e405e(_0x5dbd0c);})[_0x39db('0x15')](function(_0x1d7b6b){logger[_0x39db('0xf')](_0x39db('0x16'),_0x1d7b6b[_0x39db('0x11')],_0x4cf3c1);_0x55e142(_0x4574e1[_0x39db('0xf')](0x1f4,_0x1d7b6b[_0x39db('0x11')]));});});};exports[_0x39db('0x21')]=function(_0x279c73){var _0x865ca6=this;return new Promise(function(_0x10f7f1,_0x3fd7f3){return db[_0x39db('0x17')][_0x39db('0x22')]({'raw':_0x279c73['options']?_0x279c73['options'][_0x39db('0x19')]===undefined?!![]:![]:!![],'where':_0x279c73[_0x39db('0x18')]?_0x279c73[_0x39db('0x18')][_0x39db('0x1a')]||null:null,'attributes':_0x279c73[_0x39db('0x18')]?_0x279c73[_0x39db('0x18')][_0x39db('0x1b')]||null:null,'include':_0x279c73['options']?_0x279c73['options'][_0x39db('0x1d')]?_[_0x39db('0x1f')](_0x279c73[_0x39db('0x18')][_0x39db('0x1d')],function(_0x120841){return{'model':db[_0x120841['model']],'as':_0x120841['as'],'attributes':_0x120841[_0x39db('0x1b')],'include':_0x120841['include']?_[_0x39db('0x1f')](_0x120841[_0x39db('0x1d')],function(_0x17abec){return{'model':db[_0x17abec[_0x39db('0x1e')]],'as':_0x17abec['as'],'attributes':_0x17abec[_0x39db('0x1b')],'include':_0x17abec['include']?_[_0x39db('0x1f')](_0x17abec[_0x39db('0x1d')],function(_0x338002){return{'model':db[_0x338002[_0x39db('0x1e')]],'as':_0x338002['as'],'attributes':_0x338002['attributes']};}):[]};}):[]};}):[]:[]})[_0x39db('0xc')](function(_0x2e386f){logger['info']('ShowMailQueue',_0x279c73);logger['debug']('ShowMailQueue',_0x279c73,JSON['stringify'](_0x2e386f));_0x10f7f1(_0x2e386f);})['catch'](function(_0x53120d){logger['error'](_0x39db('0x21'),_0x53120d[_0x39db('0x11')],_0x279c73);_0x3fd7f3(_0x865ca6[_0x39db('0xf')](0x1f4,_0x53120d[_0x39db('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ae47ec3..db54a38 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 _0x4a56=['register','length','./mailQueue.events','save','update','removeListener'];(function(_0x4f01d9,_0x5976c2){var _0x230dc7=function(_0x199a63){while(--_0x199a63){_0x4f01d9['push'](_0x4f01d9['shift']());}};_0x230dc7(++_0x5976c2);}(_0x4a56,0x17c));var _0x64a5=function(_0x104f49,_0x1568ab){_0x104f49=_0x104f49-0x0;var _0x2d8b84=_0x4a56[_0x104f49];return _0x2d8b84;};'use strict';var MailQueueEvents=require(_0x64a5('0x0'));var events=[_0x64a5('0x1'),'remove',_0x64a5('0x2')];function createListener(_0x4d37b,_0x4254db){return function(_0x3d98f5){_0x4254db['emit'](_0x4d37b,_0x3d98f5);};}function removeListener(_0x3b478a,_0x3930c2){return function(){MailQueueEvents[_0x64a5('0x3')](_0x3b478a,_0x3930c2);};}exports[_0x64a5('0x4')]=function(_0x4d7361){for(var _0x17317b=0x0,_0x512273=events[_0x64a5('0x5')];_0x17317b<_0x512273;_0x17317b++){var _0x356e4a=events[_0x17317b];var _0x360b72=createListener('mailQueue:'+_0x356e4a,_0x4d7361);MailQueueEvents['on'](_0x356e4a,_0x360b72);}}; \ No newline at end of file +var _0x06a3=['./mailQueue.events','save','update','emit','removeListener','register','length','mailQueue:'];(function(_0x27e01a,_0x131524){var _0x46c3a3=function(_0x1942c5){while(--_0x1942c5){_0x27e01a['push'](_0x27e01a['shift']());}};_0x46c3a3(++_0x131524);}(_0x06a3,0xa0));var _0x306a=function(_0x12b1a6,_0x22df2d){_0x12b1a6=_0x12b1a6-0x0;var _0x5813d3=_0x06a3[_0x12b1a6];return _0x5813d3;};'use strict';var MailQueueEvents=require(_0x306a('0x0'));var events=[_0x306a('0x1'),'remove',_0x306a('0x2')];function createListener(_0x2e775e,_0x36612d){return function(_0x2ab1c5){_0x36612d[_0x306a('0x3')](_0x2e775e,_0x2ab1c5);};}function removeListener(_0x126ae5,_0x4237a3){return function(){MailQueueEvents[_0x306a('0x4')](_0x126ae5,_0x4237a3);};}exports[_0x306a('0x5')]=function(_0x52ef99){for(var _0x47a5f0=0x0,_0x5338d7=events[_0x306a('0x6')];_0x47a5f0<_0x5338d7;_0x47a5f0++){var _0x3e4cef=events[_0x47a5f0];var _0x355510=createListener(_0x306a('0x7')+_0x3e4cef,_0x52ef99);MailQueueEvents['on'](_0x3e4cef,_0x355510);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a15d0f2..54db150 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 _0x6827=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','create','put','delete','destroy','multer'];(function(_0x1fd441,_0x2629bf){var _0x411a91=function(_0x5d14e3){while(--_0x5d14e3){_0x1fd441['push'](_0x1fd441['shift']());}};_0x411a91(++_0x2629bf);}(_0x6827,0x153));var _0x7682=function(_0x298ce4,_0x4a49a7){_0x298ce4=_0x298ce4-0x0;var _0x5d236f=_0x6827[_0x298ce4];return _0x5d236f;};'use strict';var multer=require(_0x7682('0x0'));var util=require(_0x7682('0x1'));var path=require('path');var timeout=require(_0x7682('0x2'));var express=require('express');var router=express[_0x7682('0x3')]();var fs_extra=require(_0x7682('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7682('0x5'));var config=require(_0x7682('0x6'));var controller=require(_0x7682('0x7'));router[_0x7682('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7682('0x8')](_0x7682('0x9'),auth[_0x7682('0xa')](),controller[_0x7682('0xb')]);router[_0x7682('0x8')](_0x7682('0xc'),auth[_0x7682('0xa')](),controller['show']);router['post']('/',auth[_0x7682('0xa')](),controller[_0x7682('0xd')]);router[_0x7682('0xe')](_0x7682('0xc'),auth[_0x7682('0xa')](),controller['update']);router[_0x7682('0xf')]('/:id',auth[_0x7682('0xa')](),controller[_0x7682('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4b86=['/describe','describe','/:id','post','update','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x7148b6,_0xa61534){var _0x111019=function(_0x452d96){while(--_0x452d96){_0x7148b6['push'](_0x7148b6['shift']());}};_0x111019(++_0xa61534);}(_0x4b86,0x146));var _0x64b8=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0x4b86[_0x1cd5b1];return _0x25b4c7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x64b8('0x0'));var express=require(_0x64b8('0x1'));var router=express[_0x64b8('0x2')]();var fs_extra=require(_0x64b8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x64b8('0x4'));var config=require(_0x64b8('0x5'));var controller=require(_0x64b8('0x6'));router[_0x64b8('0x7')]('/',auth[_0x64b8('0x8')](),controller[_0x64b8('0x9')]);router[_0x64b8('0x7')](_0x64b8('0xa'),auth[_0x64b8('0x8')](),controller[_0x64b8('0xb')]);router[_0x64b8('0x7')](_0x64b8('0xc'),auth[_0x64b8('0x8')](),controller['show']);router[_0x64b8('0xd')]('/',auth[_0x64b8('0x8')](),controller['create']);router['put']('/:id',auth[_0x64b8('0x8')](),controller[_0x64b8('0xe')]);router['delete'](_0x64b8('0xc'),auth[_0x64b8('0x8')](),controller['destroy']);module[_0x64b8('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 261b322..1da7b66 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 _0xf4bd=['exports','STRING','DATE','sequelize'];(function(_0xaae678,_0x501815){var _0x43c439=function(_0x4d5a62){while(--_0x4d5a62){_0xaae678['push'](_0xaae678['shift']());}};_0x43c439(++_0x501815);}(_0xf4bd,0xe7));var _0xdf4b=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xf4bd[_0x21aec3];return _0x288bbc;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf4b('0x0'));module[_0xdf4b('0x1')]={'uniqueid':{'type':Sequelize[_0xdf4b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdf4b('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdf4b('0x2')]}}; \ No newline at end of file +var _0x7c96=['DATE','STRING'];(function(_0x413982,_0x19cf62){var _0x548b0a=function(_0x537f0a){while(--_0x537f0a){_0x413982['push'](_0x413982['shift']());}};_0x548b0a(++_0x19cf62);}(_0x7c96,0x11d));var _0x67c9=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x7c96[_0x2a67fe];return _0x57e726;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x67c9('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x67c9('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x67c9('0x1')]},'acceptAt':{'type':Sequelize[_0x67c9('0x1')]},'exitAt':{'type':Sequelize[_0x67c9('0x1')]},'reason':{'type':Sequelize[_0x67c9('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3b2c6dc..a48c65c 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 _0x0120=['name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x479aae,_0x20c464){var _0x53840d=function(_0x48aaf4){while(--_0x48aaf4){_0x479aae['push'](_0x479aae['shift']());}};_0x53840d(++_0x20c464);}(_0x0120,0x6f));var _0x0012=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0120[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x42bcd7,_0x5e820b){return function(_0x351ffd){if(!_0x351ffd){_0x42bcd7[_0x0012('0x28')](0x194);}return _0x351ffd;};}function handleError(_0xbb5b55,_0x2a0302){_0x2a0302=_0x2a0302||0x1f4;return function(_0x173cb3){logger[_0x0012('0x29')](_0x173cb3[_0x0012('0x2a')]);if(_0x173cb3[_0x0012('0x2b')]){delete _0x173cb3[_0x0012('0x2b')];}_0xbb5b55[_0x0012('0x1a')](_0x2a0302)[_0x0012('0x2c')](_0x173cb3);};}exports[_0x0012('0x2d')]=function(_0x45c3ca,_0x3ce788){var _0x1282bb={},_0x276389={},_0x1b676d={'count':0x0,'rows':[]};var _0x1f4a0a=_[_0x0012('0x2e')](db[_0x0012('0x2f')][_0x0012('0x30')],function(_0x4d0998){return{'name':_0x4d0998[_0x0012('0x31')],'type':_0x4d0998[_0x0012('0x32')]['key']};});_0x276389[_0x0012('0x33')]=_[_0x0012('0x2e')](_0x1f4a0a,_0x0012('0x2b'));_0x276389[_0x0012('0x34')]=_[_0x0012('0x35')](_0x45c3ca['query']);_0x276389[_0x0012('0x36')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],_0x276389['query']);_0x1282bb[_0x0012('0x38')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],qs[_0x0012('0x39')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x39')]));_0x1282bb['attributes']=_0x1282bb[_0x0012('0x38')][_0x0012('0x3a')]?_0x1282bb[_0x0012('0x38')]:_0x276389[_0x0012('0x33')];if(!_0x45c3ca['query']['hasOwnProperty'](_0x0012('0x3b'))){_0x1282bb[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x1b')]);_0x1282bb[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x45c3ca['query'][_0x0012('0x1e')]);}_0x1282bb[_0x0012('0x3c')]=qs['sort'](_0x45c3ca[_0x0012('0x34')][_0x0012('0x3d')]);_0x1282bb[_0x0012('0x3e')]=qs[_0x0012('0x36')](_[_0x0012('0x3f')](_0x45c3ca[_0x0012('0x34')],_0x276389[_0x0012('0x36')]),_0x1f4a0a);if(_0x45c3ca['query'][_0x0012('0x40')]){_0x1282bb['where']=_[_0x0012('0x41')](_0x1282bb['where'],{'$or':_['map'](_0x1f4a0a,function(_0x1c35aa){if(_0x1c35aa[_0x0012('0x32')]!==_0x0012('0x42')){var _0x4e4424={};_0x4e4424[_0x1c35aa[_0x0012('0x2b')]]={'$like':'%'+_0x45c3ca[_0x0012('0x34')][_0x0012('0x40')]+'%'};return _0x4e4424;}})});}_0x1282bb=_[_0x0012('0x41')]({},_0x1282bb,_0x45c3ca[_0x0012('0x43')]);var _0x379780={'where':_0x1282bb[_0x0012('0x3e')]};return db[_0x0012('0x2f')]['count'](_0x379780)[_0x0012('0x25')](function(_0x25aff1){_0x1b676d[_0x0012('0x1d')]=_0x25aff1;if(_0x45c3ca[_0x0012('0x34')][_0x0012('0x44')]){_0x1282bb[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x2f')]['findAll'](_0x1282bb);})['then'](function(_0x1c54de){_0x1b676d['rows']=_0x1c54de;return _0x1b676d;})[_0x0012('0x25')](respondWithFilteredResult(_0x3ce788,_0x1282bb))[_0x0012('0x46')](handleError(_0x3ce788,null));};exports[_0x0012('0x47')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x48')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x35')](db[_0x0012('0x2f')][_0x0012('0x30')]);_0x1bd93a[_0x0012('0x34')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x36')]=_['intersection'](_0x1bd93a[_0x0012('0x33')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x38')]=_[_0x0012('0x37')](_0x1bd93a[_0x0012('0x33')],qs[_0x0012('0x39')](_0x40f80d['query'][_0x0012('0x39')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x38')][_0x0012('0x3a')]?_0x5348a2[_0x0012('0x38')]:_0x1bd93a[_0x0012('0x33')];if(_0x40f80d[_0x0012('0x34')][_0x0012('0x44')]){_0x5348a2[_0x0012('0x45')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x43')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x5348a2)[_0x0012('0x25')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x25')](respondWithResult(_0x32c1f9,null))[_0x0012('0x46')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['MailQueueReport'][_0x0012('0x4a')](_0x5894ee[_0x0012('0x4b')],{})[_0x0012('0x25')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x46')](handleError(_0x48de64,null));};exports[_0x0012('0x24')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x4b')]['id']){delete _0x53d552[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x53d552[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x25')](saveUpdates(_0x53d552[_0x0012('0x4b')],null))[_0x0012('0x25')](respondWithResult(_0x44ffaf,null))[_0x0012('0x46')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x2f')]['find']({'where':{'id':_0x2389cd[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x25')](removeEntity(_0x12cb8f,null))[_0x0012('0x46')](handleError(_0x12cb8f,null));};exports[_0x0012('0x4c')]=function(_0x5f283f,_0xd11428){return db['MailQueueReport'][_0x0012('0x4c')]()[_0x0012('0x25')](respondWithResult(_0xd11428,null))['catch'](handleError(_0xd11428,null));}; \ No newline at end of file +var _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['MailQueueReport'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['MailQueueReport'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f8f9213..ac5e497 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 _0x340b=['../../config/logger','api','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x340b,0x1b6));var _0xb340=function(_0x11bcec,_0x47f25d){_0x11bcec=_0x11bcec-0x0;var _0x17dc57=_0x340b[_0x11bcec];return _0x17dc57;};'use strict';var _=require(_0xb340('0x0'));var util=require(_0xb340('0x1'));var logger=require(_0xb340('0x2'))(_0xb340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb340('0x4'));var rimraf=require('rimraf');var config=require(_0xb340('0x5'));var attributes=require(_0xb340('0x6'));module[_0xb340('0x7')]=function(_0x5978f7,_0x49cfb9){return _0x5978f7[_0xb340('0x8')](_0xb340('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb340('0xa'),'fields':[_0xb340('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f24=['./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2ebc9e,_0x54ede0){var _0x349bf8=function(_0x4c06a9){while(--_0x4c06a9){_0x2ebc9e['push'](_0x2ebc9e['shift']());}};_0x349bf8(++_0x54ede0);}(_0x2f24,0x115));var _0x42f2=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2f24[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x42f2('0x0'));var util=require(_0x42f2('0x1'));var logger=require(_0x42f2('0x2'))(_0x42f2('0x3'));var moment=require(_0x42f2('0x4'));var BPromise=require(_0x42f2('0x5'));var rp=require(_0x42f2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f2('0x7'));var config=require(_0x42f2('0x8'));var attributes=require(_0x42f2('0x9'));module[_0x42f2('0xa')]=function(_0x440903,_0x27a2a7){return _0x440903['define']('MailQueueReport',attributes,{'tableName':_0x42f2('0xb'),'paranoid':![],'indexes':[{'name':_0x42f2('0xc'),'fields':[_0x42f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8a4ad47..c4aa2b8 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x399582,_0x357ec4){var _0x1975c7=function(_0x197c2d){while(--_0x197c2d){_0x399582['push'](_0x399582['shift']());}};_0x1975c7(++_0x357ec4);}(_0x326f,0xd1));var _0xf326=function(_0x325239,_0x3102d9){_0x325239=_0x325239-0x0;var _0x4da350=_0x326f[_0x325239];return _0x4da350;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x39ac28,_0x41bc52){var _0xb63d27=function(_0x3afb3a){while(--_0x3afb3a){_0x39ac28['push'](_0x39ac28['shift']());}};_0xb63d27(++_0x41bc52);}(_0x7a54,0x106));var _0x47a5=function(_0x29bcff,_0x3e3218){_0x29bcff=_0x29bcff-0x0;var _0x4a4503=_0x7a54[_0x29bcff];return _0x4a4503;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e8ddb9d..975f485 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x35fb79,_0x47f0dc){var _0x1f6764=function(_0x219ad9){while(--_0x219ad9){_0x35fb79['push'](_0x35fb79['shift']());}};_0x1f6764(++_0x47f0dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index cf85824..6c1d079 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 _0xf130=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xf130,0x149));var _0x0f13=function(_0xfafc6e,_0x320b2f){_0xfafc6e=_0xfafc6e-0x0;var _0x3c3766=_0xf130[_0xfafc6e];return _0x3c3766;};'use strict';var Sequelize=require(_0x0f13('0x0'));module[_0x0f13('0x1')]={'description':{'type':Sequelize[_0x0f13('0x2')]},'host':{'type':Sequelize[_0x0f13('0x2')]},'authentication':{'type':Sequelize[_0x0f13('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0f13('0x2')]},'password':{'type':Sequelize[_0x0f13('0x2')]},'port':{'type':Sequelize[_0x0f13('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0f13('0x2')],'defaultValue':_0x0f13('0x5')},'connTimeout':{'type':Sequelize[_0x0f13('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0f13('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x0f13('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x33f7=['sequelize','exports','STRING','INBOX','INTEGER','BOOLEAN'];(function(_0x263ec1,_0x847395){var _0x1f6b32=function(_0x4e0a46){while(--_0x4e0a46){_0x263ec1['push'](_0x263ec1['shift']());}};_0x1f6b32(++_0x847395);}(_0x33f7,0xc6));var _0x733f=function(_0x1bdc52,_0x4876a9){_0x1bdc52=_0x1bdc52-0x0;var _0xdf3fa3=_0x33f7[_0x1bdc52];return _0xdf3fa3;};'use strict';var Sequelize=require(_0x733f('0x0'));module[_0x733f('0x1')]={'description':{'type':Sequelize[_0x733f('0x2')]},'host':{'type':Sequelize[_0x733f('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x733f('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x733f('0x2')],'defaultValue':_0x733f('0x3')},'connTimeout':{'type':Sequelize[_0x733f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x733f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x733f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x733f('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4e22a24..53afa84 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 _0x2942=['../../config/environment','./mailServerIn.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x252d6c,_0x49ecf2){var _0x54d3d0=function(_0x243d47){while(--_0x243d47){_0x252d6c['push'](_0x252d6c['shift']());}};_0x54d3d0(++_0x49ecf2);}(_0x2942,0x88));var _0x2294=function(_0x1fe9a4,_0xba8fb){_0x1fe9a4=_0x1fe9a4-0x0;var _0x2750be=_0x2942[_0x1fe9a4];return _0x2750be;};'use strict';var _=require(_0x2294('0x0'));var util=require(_0x2294('0x1'));var logger=require(_0x2294('0x2'))(_0x2294('0x3'));var moment=require(_0x2294('0x4'));var BPromise=require(_0x2294('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2294('0x6'));var rimraf=require(_0x2294('0x7'));var config=require(_0x2294('0x8'));var attributes=require(_0x2294('0x9'));module[_0x2294('0xa')]=function(_0x1268f7,_0x542f11){return _0x1268f7[_0x2294('0xb')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe637=['exports','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x5cd78e,_0x5c36ee){var _0x2bbdd3=function(_0x37ef9e){while(--_0x37ef9e){_0x5cd78e['push'](_0x5cd78e['shift']());}};_0x2bbdd3(++_0x5c36ee);}(_0xe637,0x146));var _0x7e63=function(_0x57be37,_0x45a272){_0x57be37=_0x57be37-0x0;var _0xcfb320=_0xe637[_0x57be37];return _0xcfb320;};'use strict';var _=require(_0x7e63('0x0'));var util=require(_0x7e63('0x1'));var logger=require('../../config/logger')(_0x7e63('0x2'));var moment=require(_0x7e63('0x3'));var BPromise=require(_0x7e63('0x4'));var rp=require(_0x7e63('0x5'));var fs=require('fs');var path=require(_0x7e63('0x6'));var rimraf=require(_0x7e63('0x7'));var config=require(_0x7e63('0x8'));var attributes=require(_0x7e63('0x9'));module[_0x7e63('0xa')]=function(_0x153fd1,_0x3ef7cc){return _0x153fd1['define']('MailServerIn',attributes,{'tableName':_0x7e63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 8f06252..a9ea323 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 _0xde0f=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xde0f,0x1ab));var _0xfde0=function(_0x3c3e8e,_0x4c9342){_0x3c3e8e=_0x3c3e8e-0x0;var _0x5c7330=_0xde0f[_0x3c3e8e];return _0x5c7330;};'use strict';var _=require(_0xfde0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfde0('0x2'));var db=require(_0xfde0('0x3'))['db'];var utils=require(_0xfde0('0x4'));var logger=require('../../config/logger')(_0xfde0('0x5'));var config=require(_0xfde0('0x6'));var jayson=require(_0xfde0('0x7'));var client=jayson[_0xfde0('0x8')][_0xfde0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25eeec,_0x385a86,_0x383429){return new BPromise(function(_0x3b3859,_0x3f3414){return client[_0xfde0('0xa')](_0x25eeec,_0x383429)[_0xfde0('0xb')](function(_0x82b38c){logger[_0xfde0('0xc')](_0xfde0('0xd'),_0x385a86,_0xfde0('0xe'));logger[_0xfde0('0xf')](_0xfde0('0x10'),_0x385a86,_0xfde0('0xe'),JSON['stringify'](_0x82b38c));if(_0x82b38c[_0xfde0('0x11')]){if(_0x82b38c['error'][_0xfde0('0x12')]===0x1f4){logger[_0xfde0('0x11')](_0xfde0('0xd'),_0x385a86,_0x82b38c[_0xfde0('0x11')][_0xfde0('0x13')]);return _0x3f3414(_0x82b38c[_0xfde0('0x11')][_0xfde0('0x13')]);}logger['error'](_0xfde0('0xd'),_0x385a86,_0x82b38c[_0xfde0('0x11')][_0xfde0('0x13')]);return _0x3b3859(_0x82b38c[_0xfde0('0x11')]['message']);}else{logger[_0xfde0('0xc')](_0xfde0('0xd'),_0x385a86,_0xfde0('0xe'));_0x3b3859(_0x82b38c[_0xfde0('0x14')][_0xfde0('0x13')]);}})[_0xfde0('0x15')](function(_0x1a45c9){logger[_0xfde0('0x11')](_0xfde0('0xd'),_0x385a86,_0x1a45c9);_0x3f3414(_0x1a45c9);});});}exports[_0xfde0('0x16')]=function(_0x390522){var _0x6509ad=this;return new Promise(function(_0x1d720c,_0x57ada6){return db[_0xfde0('0x17')][_0xfde0('0x18')]({'raw':_0x390522[_0xfde0('0x19')]?_0x390522['options'][_0xfde0('0x1a')]===undefined?!![]:![]:!![],'where':_0x390522[_0xfde0('0x19')]?_0x390522['options'][_0xfde0('0x1b')]||null:null,'attributes':_0x390522[_0xfde0('0x19')]?_0x390522[_0xfde0('0x19')][_0xfde0('0x1c')]||null:null,'limit':_0x390522[_0xfde0('0x19')]?_0x390522[_0xfde0('0x19')][_0xfde0('0x1d')]||null:null,'include':_0x390522['options']?_0x390522[_0xfde0('0x19')][_0xfde0('0x1e')]?_[_0xfde0('0x1f')](_0x390522[_0xfde0('0x19')][_0xfde0('0x1e')],function(_0x19e5a0){return{'model':db[_0x19e5a0['model']],'as':_0x19e5a0['as'],'attributes':_0x19e5a0[_0xfde0('0x1c')],'include':_0x19e5a0[_0xfde0('0x1e')]?_[_0xfde0('0x1f')](_0x19e5a0[_0xfde0('0x1e')],function(_0x29e247){return{'model':db[_0x29e247[_0xfde0('0x20')]],'as':_0x29e247['as'],'attributes':_0x29e247[_0xfde0('0x1c')],'include':_0x29e247[_0xfde0('0x1e')]?_[_0xfde0('0x1f')](_0x29e247[_0xfde0('0x1e')],function(_0x5ed9d8){return{'model':db[_0x5ed9d8[_0xfde0('0x20')]],'as':_0x5ed9d8['as'],'attributes':_0x5ed9d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfde0('0xb')](function(_0x261208){logger[_0xfde0('0xc')](_0xfde0('0x16'),_0x390522);logger['debug'](_0xfde0('0x16'),_0x390522,JSON[_0xfde0('0x21')](_0x261208));_0x1d720c(_0x261208);})[_0xfde0('0x15')](function(_0x3f683d){logger[_0xfde0('0x11')](_0xfde0('0x16'),_0x3f683d[_0xfde0('0x13')],_0x390522);_0x57ada6(_0x6509ad['error'](0x1f4,_0x3f683d[_0xfde0('0x13')]));});});}; \ No newline at end of file +var _0x4fdc=['error','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x4fdc,0x84));var _0xc4fd=function(_0x4da59a,_0x315d38){_0x4da59a=_0x4da59a-0x0;var _0x149cd6=_0x4fdc[_0x4da59a];return _0x149cd6;};'use strict';var _=require('lodash');var util=require(_0xc4fd('0x0'));var moment=require('moment');var BPromise=require(_0xc4fd('0x1'));var rs=require(_0xc4fd('0x2'));var fs=require('fs');var Redis=require(_0xc4fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4fd('0x4'));var logger=require(_0xc4fd('0x5'))(_0xc4fd('0x6'));var config=require(_0xc4fd('0x7'));var jayson=require(_0xc4fd('0x8'));var client=jayson[_0xc4fd('0x9')][_0xc4fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57502f,_0x473a38,_0x355b9f){return new BPromise(function(_0x4962d7,_0x72b9e3){return client['request'](_0x57502f,_0x355b9f)['then'](function(_0x448be9){logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x473a38,_0xc4fd('0xd'));logger[_0xc4fd('0xe')](_0xc4fd('0xf'),_0x473a38,_0xc4fd('0xd'),JSON[_0xc4fd('0x10')](_0x448be9));if(_0x448be9['error']){if(_0x448be9['error'][_0xc4fd('0x11')]===0x1f4){logger[_0xc4fd('0x12')](_0xc4fd('0xc'),_0x473a38,_0x448be9['error'][_0xc4fd('0x13')]);return _0x72b9e3(_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);}logger[_0xc4fd('0x12')](_0xc4fd('0xc'),_0x473a38,_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);return _0x4962d7(_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);}else{logger['info'](_0xc4fd('0xc'),_0x473a38,'request\x20sent');_0x4962d7(_0x448be9['result'][_0xc4fd('0x13')]);}})[_0xc4fd('0x14')](function(_0x533217){logger['error'](_0xc4fd('0xc'),_0x473a38,_0x533217);_0x72b9e3(_0x533217);});});}exports[_0xc4fd('0x15')]=function(_0x2bc246){var _0x4137d0=this;return new Promise(function(_0xaf6c46,_0x314206){return db[_0xc4fd('0x16')]['findAll']({'raw':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x18')]===undefined?!![]:![]:!![],'where':_0x2bc246['options']?_0x2bc246['options'][_0xc4fd('0x19')]||null:null,'attributes':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x1a')]||null:null,'limit':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')]['limit']||null:null,'include':_0x2bc246['options']?_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x1b')]?_[_0xc4fd('0x1c')](_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x1b')],function(_0x433eb4){return{'model':db[_0x433eb4[_0xc4fd('0x1d')]],'as':_0x433eb4['as'],'attributes':_0x433eb4[_0xc4fd('0x1a')],'include':_0x433eb4[_0xc4fd('0x1b')]?_['map'](_0x433eb4[_0xc4fd('0x1b')],function(_0x18b1a8){return{'model':db[_0x18b1a8[_0xc4fd('0x1d')]],'as':_0x18b1a8['as'],'attributes':_0x18b1a8[_0xc4fd('0x1a')],'include':_0x18b1a8[_0xc4fd('0x1b')]?_[_0xc4fd('0x1c')](_0x18b1a8[_0xc4fd('0x1b')],function(_0x15022d){return{'model':db[_0x15022d[_0xc4fd('0x1d')]],'as':_0x15022d['as'],'attributes':_0x15022d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4726d2){logger[_0xc4fd('0xb')](_0xc4fd('0x15'),_0x2bc246);logger[_0xc4fd('0xe')](_0xc4fd('0x15'),_0x2bc246,JSON[_0xc4fd('0x10')](_0x4726d2));_0xaf6c46(_0x4726d2);})['catch'](function(_0x15d61b){logger[_0xc4fd('0x12')](_0xc4fd('0x15'),_0x15d61b[_0xc4fd('0x13')],_0x2bc246);_0x314206(_0x4137d0[_0xc4fd('0x12')](0x1f4,_0x15d61b[_0xc4fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 025161d..def75c2 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(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x224344,_0x547ee4){_0x224344=_0x224344-0x0;var _0x158107=_0x7a54[_0x224344];return _0x158107;};'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 6767a69..674bc43 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 _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x56c843,_0x3dfe3c){var _0x1981e2=function(_0x93f1ec){while(--_0x93f1ec){_0x56c843['push'](_0x56c843['shift']());}};_0x1981e2(++_0x3dfe3c);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7334=['sequelize','exports','STRING','BOOLEAN'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x7334,0x184));var _0x4733=function(_0x4f57c5,_0x2a26d9){_0x4f57c5=_0x4f57c5-0x0;var _0x59d7f6=_0x7334[_0x4f57c5];return _0x59d7f6;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'description':{'type':Sequelize[_0x4733('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4733('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4733('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x4733('0x2')]},'authentication':{'type':Sequelize[_0x4733('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4733('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1634752..425bad5 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 _0x2b52=['../../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','reject','save','then','destroy','error','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body','update','find','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'];(function(_0x139e21,_0x4614c2){var _0x3e7bfa=function(_0x3e48ca){while(--_0x3e48ca){_0x139e21['push'](_0x139e21['shift']());}};_0x3e7bfa(++_0x4614c2);}(_0x2b52,0x160));var _0x22b5=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x2b52[_0xa45395];return _0x3c83d2;};'use strict';var emlformat=require(_0x22b5('0x0'));var rimraf=require(_0x22b5('0x1'));var zipdir=require(_0x22b5('0x2'));var jsonpatch=require(_0x22b5('0x3'));var rp=require(_0x22b5('0x4'));var moment=require(_0x22b5('0x5'));var BPromise=require(_0x22b5('0x6'));var Mustache=require(_0x22b5('0x7'));var util=require(_0x22b5('0x8'));var path=require(_0x22b5('0x9'));var sox=require(_0x22b5('0xa'));var csv=require(_0x22b5('0xb'));var ejs=require(_0x22b5('0xc'));var fs=require('fs');var fs_extra=require(_0x22b5('0xd'));var _=require('lodash');var squel=require(_0x22b5('0xe'));var crypto=require(_0x22b5('0xf'));var jsforce=require(_0x22b5('0x10'));var deskjs=require(_0x22b5('0x11'));var toCsv=require(_0x22b5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x22b5('0x12'));var qs=require(_0x22b5('0x13'));var as=require(_0x22b5('0x14'));var hardwareService=require(_0x22b5('0x15'));var logger=require(_0x22b5('0x16'))(_0x22b5('0x17'));var utils=require(_0x22b5('0x18'));var config=require(_0x22b5('0x19'));var licenseUtil=require(_0x22b5('0x1a'));var db=require(_0x22b5('0x1b'))['db'];function respondWithStatusCode(_0x18bca3,_0x322a1b){_0x322a1b=_0x322a1b||0xcc;return function(_0x10b11a){if(_0x10b11a){return _0x18bca3[_0x22b5('0x1c')](_0x322a1b);}return _0x18bca3[_0x22b5('0x1d')](_0x322a1b)['end']();};}function respondWithResult(_0x2dd4e5,_0x1cd9be){_0x1cd9be=_0x1cd9be||0xc8;return function(_0x8df84e){if(_0x8df84e){return _0x2dd4e5[_0x22b5('0x1d')](_0x1cd9be)[_0x22b5('0x1e')](_0x8df84e);}};}function respondWithFilteredResult(_0x512a55,_0x4b5950){return function(_0xa8177f){if(_0xa8177f){var _0x22db39=typeof _0x4b5950[_0x22b5('0x1f')]===_0x22b5('0x20')&&typeof _0x4b5950[_0x22b5('0x21')]===_0x22b5('0x20');var _0x3daf5c=_0xa8177f[_0x22b5('0x22')];var _0x512eed=_0x22db39?0x0:_0x4b5950['offset'];var _0x22655b=_0x22db39?_0xa8177f[_0x22b5('0x22')]:_0x4b5950[_0x22b5('0x1f')]+_0x4b5950[_0x22b5('0x21')];var _0x53b37f;if(_0x22655b>=_0x3daf5c){_0x22655b=_0x3daf5c;_0x53b37f=0xc8;}else{_0x53b37f=0xce;}_0x512a55['status'](_0x53b37f);return _0x512a55['set']('Content-Range',_0x512eed+'-'+_0x22655b+'/'+_0x3daf5c)[_0x22b5('0x1e')](_0xa8177f);}return null;};}function patchUpdates(_0x41dd6e){return function(_0x5e4af2){try{jsonpatch['apply'](_0x5e4af2,_0x41dd6e,!![]);}catch(_0x560123){return BPromise[_0x22b5('0x23')](_0x560123);}return _0x5e4af2[_0x22b5('0x24')]();};}function saveUpdates(_0x39d837,_0x525f17){return function(_0x4eb6a2){if(_0x4eb6a2){return _0x4eb6a2['update'](_0x39d837)[_0x22b5('0x25')](function(_0xa4a5fc){return _0xa4a5fc;});}return null;};}function removeEntity(_0x42e393,_0x21872e){return function(_0x2e7ecd){if(_0x2e7ecd){return _0x2e7ecd[_0x22b5('0x26')]()[_0x22b5('0x25')](function(){_0x42e393[_0x22b5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c120,_0x19f595){return function(_0x562f59){if(!_0x562f59){_0x31c120[_0x22b5('0x1c')](0x194);}return _0x562f59;};}function handleError(_0x36b016,_0x2556c4){_0x2556c4=_0x2556c4||0x1f4;return function(_0x5a6de6){logger[_0x22b5('0x27')](_0x5a6de6['stack']);if(_0x5a6de6[_0x22b5('0x28')]){delete _0x5a6de6[_0x22b5('0x28')];}_0x36b016[_0x22b5('0x1d')](_0x2556c4)['send'](_0x5a6de6);};}exports[_0x22b5('0x29')]=function(_0x1e2ac8,_0x414cdf){var _0x1d60e9={},_0x36ffd8={},_0x279313={'count':0x0,'rows':[]};var _0x2cf38d=_[_0x22b5('0x2a')](db[_0x22b5('0x2b')][_0x22b5('0x2c')],function(_0x32c0c9){return{'name':_0x32c0c9[_0x22b5('0x2d')],'type':_0x32c0c9[_0x22b5('0x2e')][_0x22b5('0x2f')]};});_0x36ffd8['model']=_[_0x22b5('0x2a')](_0x2cf38d,_0x22b5('0x28'));_0x36ffd8[_0x22b5('0x30')]=_[_0x22b5('0x31')](_0x1e2ac8[_0x22b5('0x30')]);_0x36ffd8[_0x22b5('0x32')]=_[_0x22b5('0x33')](_0x36ffd8[_0x22b5('0x34')],_0x36ffd8[_0x22b5('0x30')]);_0x1d60e9[_0x22b5('0x35')]=_[_0x22b5('0x33')](_0x36ffd8[_0x22b5('0x34')],qs[_0x22b5('0x36')](_0x1e2ac8['query'][_0x22b5('0x36')]));_0x1d60e9[_0x22b5('0x35')]=_0x1d60e9[_0x22b5('0x35')][_0x22b5('0x37')]?_0x1d60e9[_0x22b5('0x35')]:_0x36ffd8[_0x22b5('0x34')];if(!_0x1e2ac8[_0x22b5('0x30')][_0x22b5('0x38')]('nolimit')){_0x1d60e9[_0x22b5('0x21')]=qs['limit'](_0x1e2ac8['query']['limit']);_0x1d60e9[_0x22b5('0x1f')]=qs[_0x22b5('0x1f')](_0x1e2ac8[_0x22b5('0x30')][_0x22b5('0x1f')]);}_0x1d60e9[_0x22b5('0x39')]=qs['sort'](_0x1e2ac8['query'][_0x22b5('0x3a')]);_0x1d60e9[_0x22b5('0x3b')]=qs[_0x22b5('0x32')](_[_0x22b5('0x3c')](_0x1e2ac8['query'],_0x36ffd8[_0x22b5('0x32')]),_0x2cf38d);if(_0x1e2ac8[_0x22b5('0x30')][_0x22b5('0x3d')]){_0x1d60e9[_0x22b5('0x3b')]=_[_0x22b5('0x3e')](_0x1d60e9[_0x22b5('0x3b')],{'$or':_['map'](_0x2cf38d,function(_0x2ecb1b){if(_0x2ecb1b[_0x22b5('0x2e')]!==_0x22b5('0x3f')){var _0x1407dc={};_0x1407dc[_0x2ecb1b[_0x22b5('0x28')]]={'$like':'%'+_0x1e2ac8[_0x22b5('0x30')]['filter']+'%'};return _0x1407dc;}})});}_0x1d60e9=_[_0x22b5('0x3e')]({},_0x1d60e9,_0x1e2ac8['options']);var _0x41936b={'where':_0x1d60e9[_0x22b5('0x3b')]};return db[_0x22b5('0x2b')][_0x22b5('0x22')](_0x41936b)[_0x22b5('0x25')](function(_0x435a01){_0x279313['count']=_0x435a01;if(_0x1e2ac8[_0x22b5('0x30')][_0x22b5('0x40')]){_0x1d60e9[_0x22b5('0x41')]=[{'all':!![]}];}return db[_0x22b5('0x2b')][_0x22b5('0x42')](_0x1d60e9);})[_0x22b5('0x25')](function(_0x34bf1a){_0x279313[_0x22b5('0x43')]=_0x34bf1a;return _0x279313;})[_0x22b5('0x25')](respondWithFilteredResult(_0x414cdf,_0x1d60e9))[_0x22b5('0x44')](handleError(_0x414cdf,null));};exports['show']=function(_0x9c9b2d,_0x54b5fc){var _0x2d61a3={'raw':!![],'where':{'id':_0x9c9b2d[_0x22b5('0x45')]['id']}},_0x1cd964={};_0x1cd964[_0x22b5('0x34')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x1cd964['query']=_[_0x22b5('0x31')](_0x9c9b2d['query']);_0x1cd964['filters']=_[_0x22b5('0x33')](_0x1cd964['model'],_0x1cd964[_0x22b5('0x30')]);_0x2d61a3[_0x22b5('0x35')]=_[_0x22b5('0x33')](_0x1cd964[_0x22b5('0x34')],qs[_0x22b5('0x36')](_0x9c9b2d[_0x22b5('0x30')]['fields']));_0x2d61a3[_0x22b5('0x35')]=_0x2d61a3['attributes'][_0x22b5('0x37')]?_0x2d61a3[_0x22b5('0x35')]:_0x1cd964[_0x22b5('0x34')];if(_0x9c9b2d[_0x22b5('0x30')][_0x22b5('0x40')]){_0x2d61a3[_0x22b5('0x41')]=[{'all':!![]}];}_0x2d61a3=_['merge']({},_0x2d61a3,_0x9c9b2d['options']);return db[_0x22b5('0x2b')]['find'](_0x2d61a3)['then'](handleEntityNotFound(_0x54b5fc,null))['then'](respondWithResult(_0x54b5fc,null))[_0x22b5('0x44')](handleError(_0x54b5fc,null));};exports[_0x22b5('0x46')]=function(_0x2de8a6,_0x3bed54){return db[_0x22b5('0x2b')][_0x22b5('0x46')](_0x2de8a6[_0x22b5('0x47')],{})[_0x22b5('0x25')](respondWithResult(_0x3bed54,0xc9))[_0x22b5('0x44')](handleError(_0x3bed54,null));};exports[_0x22b5('0x48')]=function(_0x1f6afe,_0xe95ad6){if(_0x1f6afe[_0x22b5('0x47')]['id']){delete _0x1f6afe[_0x22b5('0x47')]['id'];}return db['MailServerOut'][_0x22b5('0x49')]({'where':{'id':_0x1f6afe['params']['id']}})[_0x22b5('0x25')](handleEntityNotFound(_0xe95ad6,null))[_0x22b5('0x25')](saveUpdates(_0x1f6afe[_0x22b5('0x47')],null))[_0x22b5('0x25')](respondWithResult(_0xe95ad6,null))['catch'](handleError(_0xe95ad6,null));};exports['destroy']=function(_0x516627,_0x36979d){return db['MailServerOut']['find']({'where':{'id':_0x516627[_0x22b5('0x45')]['id']}})[_0x22b5('0x25')](handleEntityNotFound(_0x36979d,null))[_0x22b5('0x25')](removeEntity(_0x36979d,null))[_0x22b5('0x44')](handleError(_0x36979d,null));}; \ No newline at end of file +var _0x08de=['nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','intersection','fields','length','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','MailServerOut','key','model','keys','query','filters','attributes','hasOwnProperty'];(function(_0x48a90d,_0xa49882){var _0x2f2921=function(_0x4595d3){while(--_0x4595d3){_0x48a90d['push'](_0x48a90d['shift']());}};_0x2f2921(++_0xa49882);}(_0x08de,0x193));var _0xe08d=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x08de[_0x4d2f00];return _0x2d7b7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe08d('0x0'));var zipdir=require(_0xe08d('0x1'));var jsonpatch=require(_0xe08d('0x2'));var rp=require(_0xe08d('0x3'));var moment=require('moment');var BPromise=require(_0xe08d('0x4'));var Mustache=require(_0xe08d('0x5'));var util=require(_0xe08d('0x6'));var path=require(_0xe08d('0x7'));var sox=require(_0xe08d('0x8'));var csv=require(_0xe08d('0x9'));var ejs=require(_0xe08d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe08d('0xb'));var squel=require(_0xe08d('0xc'));var crypto=require(_0xe08d('0xd'));var jsforce=require(_0xe08d('0xe'));var deskjs=require(_0xe08d('0xf'));var toCsv=require(_0xe08d('0x9'));var querystring=require(_0xe08d('0x10'));var Papa=require(_0xe08d('0x11'));var Redis=require('ioredis');var authService=require(_0xe08d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe08d('0x13'))(_0xe08d('0x14'));var utils=require(_0xe08d('0x15'));var config=require(_0xe08d('0x16'));var licenseUtil=require(_0xe08d('0x17'));var db=require(_0xe08d('0x18'))['db'];function respondWithStatusCode(_0x31cba2,_0xec0ec8){_0xec0ec8=_0xec0ec8||0xcc;return function(_0x447e1f){if(_0x447e1f){return _0x31cba2['sendStatus'](_0xec0ec8);}return _0x31cba2[_0xe08d('0x19')](_0xec0ec8)['end']();};}function respondWithResult(_0x5377ff,_0x448cf9){_0x448cf9=_0x448cf9||0xc8;return function(_0x21bc29){if(_0x21bc29){return _0x5377ff[_0xe08d('0x19')](_0x448cf9)[_0xe08d('0x1a')](_0x21bc29);}};}function respondWithFilteredResult(_0x190de6,_0xa3bd62){return function(_0x43316b){if(_0x43316b){var _0x5912ad=typeof _0xa3bd62[_0xe08d('0x1b')]===_0xe08d('0x1c')&&typeof _0xa3bd62[_0xe08d('0x1d')]===_0xe08d('0x1c');var _0x3bc431=_0x43316b['count'];var _0x54b94f=_0x5912ad?0x0:_0xa3bd62[_0xe08d('0x1b')];var _0xf59552=_0x5912ad?_0x43316b[_0xe08d('0x1e')]:_0xa3bd62[_0xe08d('0x1b')]+_0xa3bd62[_0xe08d('0x1d')];var _0x11c70a;if(_0xf59552>=_0x3bc431){_0xf59552=_0x3bc431;_0x11c70a=0xc8;}else{_0x11c70a=0xce;}_0x190de6[_0xe08d('0x19')](_0x11c70a);return _0x190de6[_0xe08d('0x1f')](_0xe08d('0x20'),_0x54b94f+'-'+_0xf59552+'/'+_0x3bc431)[_0xe08d('0x1a')](_0x43316b);}return null;};}function patchUpdates(_0x1e1260){return function(_0x37276b){try{jsonpatch[_0xe08d('0x21')](_0x37276b,_0x1e1260,!![]);}catch(_0x1bdfed){return BPromise[_0xe08d('0x22')](_0x1bdfed);}return _0x37276b[_0xe08d('0x23')]();};}function saveUpdates(_0x52ecfc,_0xfd9f60){return function(_0x58dff3){if(_0x58dff3){return _0x58dff3[_0xe08d('0x24')](_0x52ecfc)[_0xe08d('0x25')](function(_0xa37bce){return _0xa37bce;});}return null;};}function removeEntity(_0xc2fab9,_0x42b5b2){return function(_0x493583){if(_0x493583){return _0x493583[_0xe08d('0x26')]()[_0xe08d('0x25')](function(){_0xc2fab9['status'](0xcc)[_0xe08d('0x27')]();});}};}function handleEntityNotFound(_0x41c71b,_0x45808a){return function(_0x4953f6){if(!_0x4953f6){_0x41c71b['sendStatus'](0x194);}return _0x4953f6;};}function handleError(_0x56739c,_0x32db15){_0x32db15=_0x32db15||0x1f4;return function(_0x3434a1){logger['error'](_0x3434a1[_0xe08d('0x28')]);if(_0x3434a1[_0xe08d('0x29')]){delete _0x3434a1['name'];}_0x56739c[_0xe08d('0x19')](_0x32db15)[_0xe08d('0x2a')](_0x3434a1);};}exports[_0xe08d('0x2b')]=function(_0x4fac5f,_0x495252){var _0x402608={},_0x43358e={},_0x2e7591={'count':0x0,'rows':[]};var _0x27c294=_[_0xe08d('0x2c')](db[_0xe08d('0x2d')]['rawAttributes'],function(_0x17b750){return{'name':_0x17b750['fieldName'],'type':_0x17b750['type'][_0xe08d('0x2e')]};});_0x43358e[_0xe08d('0x2f')]=_[_0xe08d('0x2c')](_0x27c294,'name');_0x43358e['query']=_[_0xe08d('0x30')](_0x4fac5f[_0xe08d('0x31')]);_0x43358e[_0xe08d('0x32')]=_['intersection'](_0x43358e['model'],_0x43358e['query']);_0x402608[_0xe08d('0x33')]=_['intersection'](_0x43358e['model'],qs['fields'](_0x4fac5f['query']['fields']));_0x402608['attributes']=_0x402608[_0xe08d('0x33')]['length']?_0x402608[_0xe08d('0x33')]:_0x43358e[_0xe08d('0x2f')];if(!_0x4fac5f[_0xe08d('0x31')][_0xe08d('0x34')](_0xe08d('0x35'))){_0x402608['limit']=qs[_0xe08d('0x1d')](_0x4fac5f[_0xe08d('0x31')]['limit']);_0x402608[_0xe08d('0x1b')]=qs[_0xe08d('0x1b')](_0x4fac5f[_0xe08d('0x31')][_0xe08d('0x1b')]);}_0x402608[_0xe08d('0x36')]=qs[_0xe08d('0x37')](_0x4fac5f[_0xe08d('0x31')][_0xe08d('0x37')]);_0x402608[_0xe08d('0x38')]=qs[_0xe08d('0x32')](_[_0xe08d('0x39')](_0x4fac5f['query'],_0x43358e[_0xe08d('0x32')]),_0x27c294);if(_0x4fac5f['query'][_0xe08d('0x3a')]){_0x402608['where']=_[_0xe08d('0x3b')](_0x402608['where'],{'$or':_[_0xe08d('0x2c')](_0x27c294,function(_0x3d3750){if(_0x3d3750[_0xe08d('0x3c')]!==_0xe08d('0x3d')){var _0x2fc052={};_0x2fc052[_0x3d3750[_0xe08d('0x29')]]={'$like':'%'+_0x4fac5f[_0xe08d('0x31')]['filter']+'%'};return _0x2fc052;}})});}_0x402608=_[_0xe08d('0x3b')]({},_0x402608,_0x4fac5f['options']);var _0x820c01={'where':_0x402608[_0xe08d('0x38')]};return db[_0xe08d('0x2d')]['count'](_0x820c01)[_0xe08d('0x25')](function(_0x43a6a1){_0x2e7591[_0xe08d('0x1e')]=_0x43a6a1;if(_0x4fac5f[_0xe08d('0x31')]['includeAll']){_0x402608['include']=[{'all':!![]}];}return db['MailServerOut'][_0xe08d('0x3e')](_0x402608);})['then'](function(_0x3d6f40){_0x2e7591[_0xe08d('0x3f')]=_0x3d6f40;return _0x2e7591;})[_0xe08d('0x25')](respondWithFilteredResult(_0x495252,_0x402608))[_0xe08d('0x40')](handleError(_0x495252,null));};exports[_0xe08d('0x41')]=function(_0x29a0a6,_0x447b32){var _0x44cc45={'raw':!![],'where':{'id':_0x29a0a6[_0xe08d('0x42')]['id']}},_0x368fc8={};_0x368fc8[_0xe08d('0x2f')]=_[_0xe08d('0x30')](db[_0xe08d('0x2d')][_0xe08d('0x43')]);_0x368fc8[_0xe08d('0x31')]=_['keys'](_0x29a0a6['query']);_0x368fc8['filters']=_[_0xe08d('0x44')](_0x368fc8['model'],_0x368fc8['query']);_0x44cc45['attributes']=_[_0xe08d('0x44')](_0x368fc8['model'],qs[_0xe08d('0x45')](_0x29a0a6[_0xe08d('0x31')][_0xe08d('0x45')]));_0x44cc45['attributes']=_0x44cc45[_0xe08d('0x33')][_0xe08d('0x46')]?_0x44cc45[_0xe08d('0x33')]:_0x368fc8[_0xe08d('0x2f')];if(_0x29a0a6[_0xe08d('0x31')][_0xe08d('0x47')]){_0x44cc45['include']=[{'all':!![]}];}_0x44cc45=_[_0xe08d('0x3b')]({},_0x44cc45,_0x29a0a6[_0xe08d('0x48')]);return db[_0xe08d('0x2d')][_0xe08d('0x49')](_0x44cc45)[_0xe08d('0x25')](handleEntityNotFound(_0x447b32,null))[_0xe08d('0x25')](respondWithResult(_0x447b32,null))['catch'](handleError(_0x447b32,null));};exports[_0xe08d('0x4a')]=function(_0x46c582,_0x337891){return db[_0xe08d('0x2d')][_0xe08d('0x4a')](_0x46c582[_0xe08d('0x4b')],{})['then'](respondWithResult(_0x337891,0xc9))[_0xe08d('0x40')](handleError(_0x337891,null));};exports[_0xe08d('0x24')]=function(_0x2f6598,_0x207a5f){if(_0x2f6598[_0xe08d('0x4b')]['id']){delete _0x2f6598[_0xe08d('0x4b')]['id'];}return db[_0xe08d('0x2d')][_0xe08d('0x49')]({'where':{'id':_0x2f6598['params']['id']}})[_0xe08d('0x25')](handleEntityNotFound(_0x207a5f,null))[_0xe08d('0x25')](saveUpdates(_0x2f6598[_0xe08d('0x4b')],null))[_0xe08d('0x25')](respondWithResult(_0x207a5f,null))[_0xe08d('0x40')](handleError(_0x207a5f,null));};exports[_0xe08d('0x26')]=function(_0x361f04,_0x8f6e93){return db[_0xe08d('0x2d')][_0xe08d('0x49')]({'where':{'id':_0x361f04['params']['id']}})['then'](handleEntityNotFound(_0x8f6e93,null))[_0xe08d('0x25')](removeEntity(_0x8f6e93,null))[_0xe08d('0x40')](handleError(_0x8f6e93,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2f68c78..931c161 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 _0x93ee=['rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger','api','bluebird','path'];(function(_0x3c4a4d,_0x1e2b93){var _0x2b6d0d=function(_0x56ba6f){while(--_0x56ba6f){_0x3c4a4d['push'](_0x3c4a4d['shift']());}};_0x2b6d0d(++_0x1e2b93);}(_0x93ee,0x1d1));var _0xe93e=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x93ee[_0x13f980];return _0x27153c;};'use strict';var _=require(_0xe93e('0x0'));var util=require('util');var logger=require(_0xe93e('0x1'))(_0xe93e('0x2'));var moment=require('moment');var BPromise=require(_0xe93e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe93e('0x4'));var rimraf=require(_0xe93e('0x5'));var config=require('../../config/environment');var attributes=require(_0xe93e('0x6'));module[_0xe93e('0x7')]=function(_0x688edb,_0xdcbbfc){return _0x688edb[_0xe93e('0x8')](_0xe93e('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9b8=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash','util','api','moment'];(function(_0x36322e,_0x54d45d){var _0x5488ec=function(_0x387bab){while(--_0x387bab){_0x36322e['push'](_0x36322e['shift']());}};_0x5488ec(++_0x54d45d);}(_0xf9b8,0x188));var _0x8f9b=function(_0x228728,_0x22fbd9){_0x228728=_0x228728-0x0;var _0x3e5ed8=_0xf9b8[_0x228728];return _0x3e5ed8;};'use strict';var _=require(_0x8f9b('0x0'));var util=require(_0x8f9b('0x1'));var logger=require('../../config/logger')(_0x8f9b('0x2'));var moment=require(_0x8f9b('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f9b('0x4'));var fs=require('fs');var path=require(_0x8f9b('0x5'));var rimraf=require(_0x8f9b('0x6'));var config=require(_0x8f9b('0x7'));var attributes=require(_0x8f9b('0x8'));module[_0x8f9b('0x9')]=function(_0x4909da,_0x3666d6){return _0x4909da['define'](_0x8f9b('0xa'),attributes,{'tableName':'mail_servers_out','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 295704f..f7c32f0 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x58fe86,_0x19655f){var _0x3f0732=function(_0x1d0b4a){while(--_0x1d0b4a){_0x58fe86['push'](_0x58fe86['shift']());}};_0x3f0732(++_0x19655f);}(_0xadb5,0xad));var _0x5adb=function(_0xb17dce,_0x19e1a0){_0xb17dce=_0xb17dce-0x0;var _0x3fc1e9=_0xadb5[_0xb17dce];return _0x3fc1e9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x369eae,_0x21667f){var _0x214f6b=function(_0x4ac130){while(--_0x4ac130){_0x369eae['push'](_0x369eae['shift']());}};_0x214f6b(++_0x21667f);}(_0x1261,0x144));var _0x1126=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0x1261[_0x3c700f];return _0x1bf773;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 79b9b35..9832ebe 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 _0x3d2d=['../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x25eca9,_0x357208){var _0x423c06=function(_0x422edf){while(--_0x422edf){_0x25eca9['push'](_0x25eca9['shift']());}};_0x423c06(++_0x357208);}(_0x3d2d,0x143));var _0xd3d2=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x3d2d[_0x179e11];return _0x549f04;};'use strict';var multer=require(_0xd3d2('0x0'));var util=require(_0xd3d2('0x1'));var path=require(_0xd3d2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3d2('0x3'));var router=express['Router']();var fs_extra=require(_0xd3d2('0x4'));var auth=require(_0xd3d2('0x5'));var interaction=require(_0xd3d2('0x6'));var config=require(_0xd3d2('0x7'));var controller=require(_0xd3d2('0x8'));router['get']('/',auth[_0xd3d2('0x9')](),controller[_0xd3d2('0xa')]);router['get'](_0xd3d2('0xb'),auth[_0xd3d2('0x9')](),controller[_0xd3d2('0xc')]);router[_0xd3d2('0xd')](_0xd3d2('0xe'),auth[_0xd3d2('0x9')](),controller['show']);router[_0xd3d2('0xf')]('/',auth[_0xd3d2('0x9')](),controller[_0xd3d2('0x10')]);router[_0xd3d2('0x11')](_0xd3d2('0xe'),auth[_0xd3d2('0x9')](),controller[_0xd3d2('0x12')]);router[_0xd3d2('0x13')]('/:id',auth[_0xd3d2('0x9')](),controller[_0xd3d2('0x14')]);module[_0xd3d2('0x15')]=router; \ No newline at end of file +var _0x6bee=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0x6bee,0x1b2));var _0xe6be=function(_0x4a6bc6,_0x25826b){_0x4a6bc6=_0x4a6bc6-0x0;var _0x2fd4e6=_0x6bee[_0x4a6bc6];return _0x2fd4e6;};'use strict';var multer=require(_0xe6be('0x0'));var util=require(_0xe6be('0x1'));var path=require('path');var timeout=require(_0xe6be('0x2'));var express=require(_0xe6be('0x3'));var router=express[_0xe6be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe6be('0x6'));var controller=require(_0xe6be('0x7'));router[_0xe6be('0x8')]('/',auth[_0xe6be('0x9')](),controller['index']);router[_0xe6be('0x8')](_0xe6be('0xa'),auth[_0xe6be('0x9')](),controller[_0xe6be('0xb')]);router[_0xe6be('0x8')](_0xe6be('0xc'),auth['isAuthenticated'](),controller[_0xe6be('0xd')]);router[_0xe6be('0xe')]('/',auth[_0xe6be('0x9')](),controller[_0xe6be('0xf')]);router[_0xe6be('0x10')]('/:id',auth[_0xe6be('0x9')](),controller[_0xe6be('0x11')]);router['delete'](_0xe6be('0xc'),auth['isAuthenticated'](),controller[_0xe6be('0x12')]);module[_0xe6be('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 71d4d22..0a05dab 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 _0xda19=['STRING','exports'];(function(_0x22a6e6,_0xac09f9){var _0x1a8b56=function(_0x142a8c){while(--_0x142a8c){_0x22a6e6['push'](_0x22a6e6['shift']());}};_0x1a8b56(++_0xac09f9);}(_0xda19,0xd5));var _0x9da1=function(_0x4670b1,_0x25b27f){_0x4670b1=_0x4670b1-0x0;var _0x49a73a=_0xda19[_0x4670b1];return _0x49a73a;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9da1('0x1')]}}; \ No newline at end of file +var _0xed1c=['sequelize','exports'];(function(_0x3378a1,_0x48e464){var _0x5dbf94=function(_0x40370d){while(--_0x40370d){_0x3378a1['push'](_0x3378a1['shift']());}};_0x5dbf94(++_0x48e464);}(_0xed1c,0xe4));var _0xced1=function(_0x234456,_0x32bb45){_0x234456=_0x234456-0x0;var _0x25ebea=_0xed1c[_0x234456];return _0x25ebea;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','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 db261a2..8cb2452 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 _0x0269=['bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','update','params','describe','eml-format','zip-dir','request-promise'];(function(_0x38ae35,_0x16c078){var _0x4b3e8f=function(_0x1d182a){while(--_0x1d182a){_0x38ae35['push'](_0x38ae35['shift']());}};_0x4b3e8f(++_0x16c078);}(_0x0269,0x135));var _0x9026=function(_0xcd60be,_0x28dcfa){_0xcd60be=_0xcd60be-0x0;var _0x51bec0=_0x0269[_0xcd60be];return _0x51bec0;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9026('0x10'));var as=require(_0x9026('0x11'));var hardwareService=require(_0x9026('0x12'));var logger=require('../../config/logger')(_0x9026('0x13'));var utils=require('../../config/utils');var config=require(_0x9026('0x14'));var licenseUtil=require(_0x9026('0x15'));var db=require(_0x9026('0x16'))['db'];function respondWithStatusCode(_0x2148f0,_0x40f526){_0x40f526=_0x40f526||0xcc;return function(_0x40b5dd){if(_0x40b5dd){return _0x2148f0[_0x9026('0x17')](_0x40f526);}return _0x2148f0['status'](_0x40f526)[_0x9026('0x18')]();};}function respondWithResult(_0x4ee699,_0x385afc){_0x385afc=_0x385afc||0xc8;return function(_0x2612cd){if(_0x2612cd){return _0x4ee699[_0x9026('0x19')](_0x385afc)[_0x9026('0x1a')](_0x2612cd);}};}function respondWithFilteredResult(_0x11c0d1,_0x421ee2){return function(_0x142465){if(_0x142465){var _0x1eb679=typeof _0x421ee2['offset']===_0x9026('0x1b')&&typeof _0x421ee2[_0x9026('0x1c')]==='undefined';var _0xc68011=_0x142465[_0x9026('0x1d')];var _0x15b3ab=_0x1eb679?0x0:_0x421ee2[_0x9026('0x1e')];var _0x1d1613=_0x1eb679?_0x142465[_0x9026('0x1d')]:_0x421ee2[_0x9026('0x1e')]+_0x421ee2[_0x9026('0x1c')];var _0x52edf1;if(_0x1d1613>=_0xc68011){_0x1d1613=_0xc68011;_0x52edf1=0xc8;}else{_0x52edf1=0xce;}_0x11c0d1[_0x9026('0x19')](_0x52edf1);return _0x11c0d1['set'](_0x9026('0x1f'),_0x15b3ab+'-'+_0x1d1613+'/'+_0xc68011)['json'](_0x142465);}return null;};}function patchUpdates(_0x2a9bf0){return function(_0x1b03af){try{jsonpatch[_0x9026('0x20')](_0x1b03af,_0x2a9bf0,!![]);}catch(_0x22a77c){return BPromise[_0x9026('0x21')](_0x22a77c);}return _0x1b03af[_0x9026('0x22')]();};}function saveUpdates(_0x71a263,_0x39f515){return function(_0x12e0b3){if(_0x12e0b3){return _0x12e0b3['update'](_0x71a263)['then'](function(_0x7b962){return _0x7b962;});}return null;};}function removeEntity(_0x134221,_0x2968fb){return function(_0x82a8e0){if(_0x82a8e0){return _0x82a8e0[_0x9026('0x23')]()[_0x9026('0x24')](function(){_0x134221[_0x9026('0x19')](0xcc)[_0x9026('0x18')]();});}};}function handleEntityNotFound(_0x775596,_0x4293df){return function(_0xde5c83){if(!_0xde5c83){_0x775596[_0x9026('0x17')](0x194);}return _0xde5c83;};}function handleError(_0x38fd9c,_0x2ace13){_0x2ace13=_0x2ace13||0x1f4;return function(_0x28dba4){logger[_0x9026('0x25')](_0x28dba4[_0x9026('0x26')]);if(_0x28dba4[_0x9026('0x27')]){delete _0x28dba4[_0x9026('0x27')];}_0x38fd9c['status'](_0x2ace13)[_0x9026('0x28')](_0x28dba4);};}exports[_0x9026('0x29')]=function(_0x30c988,_0x103ce7){var _0x17dc25={},_0x3cead8={},_0x23cf05={'count':0x0,'rows':[]};var _0xedb8bb=_[_0x9026('0x2a')](db[_0x9026('0x2b')][_0x9026('0x2c')],function(_0x5d2672){return{'name':_0x5d2672[_0x9026('0x2d')],'type':_0x5d2672[_0x9026('0x2e')][_0x9026('0x2f')]};});_0x3cead8[_0x9026('0x30')]=_[_0x9026('0x2a')](_0xedb8bb,_0x9026('0x27'));_0x3cead8[_0x9026('0x31')]=_['keys'](_0x30c988[_0x9026('0x31')]);_0x3cead8['filters']=_[_0x9026('0x32')](_0x3cead8[_0x9026('0x30')],_0x3cead8[_0x9026('0x31')]);_0x17dc25[_0x9026('0x33')]=_[_0x9026('0x32')](_0x3cead8[_0x9026('0x30')],qs['fields'](_0x30c988[_0x9026('0x31')][_0x9026('0x34')]));_0x17dc25[_0x9026('0x33')]=_0x17dc25[_0x9026('0x33')]['length']?_0x17dc25[_0x9026('0x33')]:_0x3cead8[_0x9026('0x30')];if(!_0x30c988['query'][_0x9026('0x35')](_0x9026('0x36'))){_0x17dc25[_0x9026('0x1c')]=qs[_0x9026('0x1c')](_0x30c988[_0x9026('0x31')][_0x9026('0x1c')]);_0x17dc25[_0x9026('0x1e')]=qs[_0x9026('0x1e')](_0x30c988['query'][_0x9026('0x1e')]);}_0x17dc25[_0x9026('0x37')]=qs['sort'](_0x30c988[_0x9026('0x31')][_0x9026('0x38')]);_0x17dc25[_0x9026('0x39')]=qs[_0x9026('0x3a')](_[_0x9026('0x3b')](_0x30c988[_0x9026('0x31')],_0x3cead8[_0x9026('0x3a')]),_0xedb8bb);if(_0x30c988[_0x9026('0x31')]['filter']){_0x17dc25[_0x9026('0x39')]=_[_0x9026('0x3c')](_0x17dc25[_0x9026('0x39')],{'$or':_[_0x9026('0x2a')](_0xedb8bb,function(_0x1fc5cc){if(_0x1fc5cc[_0x9026('0x2e')]!==_0x9026('0x3d')){var _0x4c950e={};_0x4c950e[_0x1fc5cc[_0x9026('0x27')]]={'$like':'%'+_0x30c988['query'][_0x9026('0x3e')]+'%'};return _0x4c950e;}})});}_0x17dc25=_[_0x9026('0x3c')]({},_0x17dc25,_0x30c988[_0x9026('0x3f')]);var _0x3e106a={'where':_0x17dc25['where']};return db['MailSubstatus'][_0x9026('0x1d')](_0x3e106a)[_0x9026('0x24')](function(_0x51e719){_0x23cf05['count']=_0x51e719;if(_0x30c988['query'][_0x9026('0x40')]){_0x17dc25[_0x9026('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9026('0x42')](_0x17dc25);})[_0x9026('0x24')](function(_0x1a77bd){_0x23cf05[_0x9026('0x43')]=_0x1a77bd;return _0x23cf05;})[_0x9026('0x24')](respondWithFilteredResult(_0x103ce7,_0x17dc25))[_0x9026('0x44')](handleError(_0x103ce7,null));};exports[_0x9026('0x45')]=function(_0x2c24f4,_0x5e18cf){var _0x2d6801={'raw':!![],'where':{'id':_0x2c24f4['params']['id']}},_0x2ece36={};_0x2ece36['model']=_['keys'](db[_0x9026('0x2b')][_0x9026('0x2c')]);_0x2ece36[_0x9026('0x31')]=_[_0x9026('0x46')](_0x2c24f4[_0x9026('0x31')]);_0x2ece36['filters']=_[_0x9026('0x32')](_0x2ece36['model'],_0x2ece36[_0x9026('0x31')]);_0x2d6801[_0x9026('0x33')]=_[_0x9026('0x32')](_0x2ece36[_0x9026('0x30')],qs['fields'](_0x2c24f4['query'][_0x9026('0x34')]));_0x2d6801[_0x9026('0x33')]=_0x2d6801[_0x9026('0x33')][_0x9026('0x47')]?_0x2d6801[_0x9026('0x33')]:_0x2ece36[_0x9026('0x30')];if(_0x2c24f4['query'][_0x9026('0x40')]){_0x2d6801['include']=[{'all':!![]}];}_0x2d6801=_[_0x9026('0x3c')]({},_0x2d6801,_0x2c24f4[_0x9026('0x3f')]);return db['MailSubstatus'][_0x9026('0x48')](_0x2d6801)['then'](handleEntityNotFound(_0x5e18cf,null))[_0x9026('0x24')](respondWithResult(_0x5e18cf,null))['catch'](handleError(_0x5e18cf,null));};exports[_0x9026('0x49')]=function(_0x48ceb1,_0x530244){return db[_0x9026('0x2b')][_0x9026('0x49')](_0x48ceb1[_0x9026('0x4a')],{})['then'](respondWithResult(_0x530244,0xc9))[_0x9026('0x44')](handleError(_0x530244,null));};exports[_0x9026('0x4b')]=function(_0x446cd0,_0x442e5a){if(_0x446cd0[_0x9026('0x4a')]['id']){delete _0x446cd0['body']['id'];}return db[_0x9026('0x2b')][_0x9026('0x48')]({'where':{'id':_0x446cd0[_0x9026('0x4c')]['id']}})[_0x9026('0x24')](handleEntityNotFound(_0x442e5a,null))[_0x9026('0x24')](saveUpdates(_0x446cd0[_0x9026('0x4a')],null))['then'](respondWithResult(_0x442e5a,null))[_0x9026('0x44')](handleError(_0x442e5a,null));};exports['destroy']=function(_0x2e3025,_0xf0a02e){return db['MailSubstatus'][_0x9026('0x48')]({'where':{'id':_0x2e3025[_0x9026('0x4c')]['id']}})[_0x9026('0x24')](handleEntityNotFound(_0xf0a02e,null))[_0x9026('0x24')](removeEntity(_0xf0a02e,null))[_0x9026('0x44')](handleError(_0xf0a02e,null));};exports[_0x9026('0x4d')]=function(_0x2d038c,_0x3c338e){return db[_0x9026('0x2b')][_0x9026('0x4d')]()['then'](respondWithResult(_0x3c338e,null))[_0x9026('0x44')](handleError(_0x3c338e,null));}; \ No newline at end of file +var _0x4e7a=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir'];(function(_0x159b72,_0x183756){var _0x4fa7b7=function(_0x43e36b){while(--_0x43e36b){_0x159b72['push'](_0x159b72['shift']());}};_0x4fa7b7(++_0x183756);}(_0x4e7a,0x1b9));var _0xa4e7=function(_0x2377a3,_0x7b4522){_0x2377a3=_0x2377a3-0x0;var _0x538284=_0x4e7a[_0x2377a3];return _0x538284;};'use strict';var emlformat=require(_0xa4e7('0x0'));var rimraf=require(_0xa4e7('0x1'));var zipdir=require(_0xa4e7('0x2'));var jsonpatch=require(_0xa4e7('0x3'));var rp=require(_0xa4e7('0x4'));var moment=require(_0xa4e7('0x5'));var BPromise=require(_0xa4e7('0x6'));var Mustache=require(_0xa4e7('0x7'));var util=require(_0xa4e7('0x8'));var path=require(_0xa4e7('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4e7('0xa'));var fs=require('fs');var fs_extra=require(_0xa4e7('0xb'));var _=require('lodash');var squel=require(_0xa4e7('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4e7('0xd'));var deskjs=require(_0xa4e7('0xe'));var toCsv=require(_0xa4e7('0xf'));var querystring=require(_0xa4e7('0x10'));var Papa=require(_0xa4e7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4e7('0x12'));var hardwareService=require(_0xa4e7('0x13'));var logger=require(_0xa4e7('0x14'))(_0xa4e7('0x15'));var utils=require(_0xa4e7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4e7('0x17'))['db'];function respondWithStatusCode(_0x2a75a1,_0x2b4744){_0x2b4744=_0x2b4744||0xcc;return function(_0x1bbba2){if(_0x1bbba2){return _0x2a75a1[_0xa4e7('0x18')](_0x2b4744);}return _0x2a75a1[_0xa4e7('0x19')](_0x2b4744)[_0xa4e7('0x1a')]();};}function respondWithResult(_0x5b3e76,_0x2bbc5a){_0x2bbc5a=_0x2bbc5a||0xc8;return function(_0x596c10){if(_0x596c10){return _0x5b3e76[_0xa4e7('0x19')](_0x2bbc5a)['json'](_0x596c10);}};}function respondWithFilteredResult(_0x4efa90,_0x22de21){return function(_0x98bbea){if(_0x98bbea){var _0x242ecc=typeof _0x22de21[_0xa4e7('0x1b')]==='undefined'&&typeof _0x22de21['limit']===_0xa4e7('0x1c');var _0x5c91b7=_0x98bbea[_0xa4e7('0x1d')];var _0x5c7edd=_0x242ecc?0x0:_0x22de21['offset'];var _0x1cd50e=_0x242ecc?_0x98bbea[_0xa4e7('0x1d')]:_0x22de21[_0xa4e7('0x1b')]+_0x22de21['limit'];var _0x29f003;if(_0x1cd50e>=_0x5c91b7){_0x1cd50e=_0x5c91b7;_0x29f003=0xc8;}else{_0x29f003=0xce;}_0x4efa90[_0xa4e7('0x19')](_0x29f003);return _0x4efa90['set']('Content-Range',_0x5c7edd+'-'+_0x1cd50e+'/'+_0x5c91b7)[_0xa4e7('0x1e')](_0x98bbea);}return null;};}function patchUpdates(_0x239bf7){return function(_0x2d5503){try{jsonpatch[_0xa4e7('0x1f')](_0x2d5503,_0x239bf7,!![]);}catch(_0x50d00b){return BPromise[_0xa4e7('0x20')](_0x50d00b);}return _0x2d5503[_0xa4e7('0x21')]();};}function saveUpdates(_0x4999cb,_0x598c56){return function(_0x4f9739){if(_0x4f9739){return _0x4f9739[_0xa4e7('0x22')](_0x4999cb)[_0xa4e7('0x23')](function(_0x591943){return _0x591943;});}return null;};}function removeEntity(_0x42b945,_0x5311a7){return function(_0x291a7b){if(_0x291a7b){return _0x291a7b[_0xa4e7('0x24')]()[_0xa4e7('0x23')](function(){_0x42b945[_0xa4e7('0x19')](0xcc)[_0xa4e7('0x1a')]();});}};}function handleEntityNotFound(_0x203026,_0x1cc4ef){return function(_0x72d739){if(!_0x72d739){_0x203026[_0xa4e7('0x18')](0x194);}return _0x72d739;};}function handleError(_0x2322b8,_0x28f345){_0x28f345=_0x28f345||0x1f4;return function(_0x18378d){logger['error'](_0x18378d[_0xa4e7('0x25')]);if(_0x18378d[_0xa4e7('0x26')]){delete _0x18378d[_0xa4e7('0x26')];}_0x2322b8[_0xa4e7('0x19')](_0x28f345)[_0xa4e7('0x27')](_0x18378d);};}exports[_0xa4e7('0x28')]=function(_0x2675bb,_0x30836c){var _0x27db6d={},_0x3e3c06={},_0x1f867d={'count':0x0,'rows':[]};var _0x5c1517=_[_0xa4e7('0x29')](db[_0xa4e7('0x2a')][_0xa4e7('0x2b')],function(_0x225785){return{'name':_0x225785['fieldName'],'type':_0x225785[_0xa4e7('0x2c')]['key']};});_0x3e3c06[_0xa4e7('0x2d')]=_[_0xa4e7('0x29')](_0x5c1517,_0xa4e7('0x26'));_0x3e3c06[_0xa4e7('0x2e')]=_[_0xa4e7('0x2f')](_0x2675bb['query']);_0x3e3c06[_0xa4e7('0x30')]=_[_0xa4e7('0x31')](_0x3e3c06['model'],_0x3e3c06[_0xa4e7('0x2e')]);_0x27db6d[_0xa4e7('0x32')]=_[_0xa4e7('0x31')](_0x3e3c06[_0xa4e7('0x2d')],qs[_0xa4e7('0x33')](_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x33')]));_0x27db6d[_0xa4e7('0x32')]=_0x27db6d[_0xa4e7('0x32')][_0xa4e7('0x34')]?_0x27db6d['attributes']:_0x3e3c06[_0xa4e7('0x2d')];if(!_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x35')](_0xa4e7('0x36'))){_0x27db6d['limit']=qs[_0xa4e7('0x37')](_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x37')]);_0x27db6d[_0xa4e7('0x1b')]=qs[_0xa4e7('0x1b')](_0x2675bb['query'][_0xa4e7('0x1b')]);}_0x27db6d[_0xa4e7('0x38')]=qs[_0xa4e7('0x39')](_0x2675bb[_0xa4e7('0x2e')]['sort']);_0x27db6d[_0xa4e7('0x3a')]=qs[_0xa4e7('0x30')](_['pick'](_0x2675bb[_0xa4e7('0x2e')],_0x3e3c06[_0xa4e7('0x30')]),_0x5c1517);if(_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x3b')]){_0x27db6d[_0xa4e7('0x3a')]=_[_0xa4e7('0x3c')](_0x27db6d[_0xa4e7('0x3a')],{'$or':_[_0xa4e7('0x29')](_0x5c1517,function(_0x1ef7a4){if(_0x1ef7a4['type']!==_0xa4e7('0x3d')){var _0x4fb1e0={};_0x4fb1e0[_0x1ef7a4[_0xa4e7('0x26')]]={'$like':'%'+_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x3b')]+'%'};return _0x4fb1e0;}})});}_0x27db6d=_[_0xa4e7('0x3c')]({},_0x27db6d,_0x2675bb[_0xa4e7('0x3e')]);var _0x84784a={'where':_0x27db6d[_0xa4e7('0x3a')]};return db['MailSubstatus'][_0xa4e7('0x1d')](_0x84784a)[_0xa4e7('0x23')](function(_0x56e8ba){_0x1f867d[_0xa4e7('0x1d')]=_0x56e8ba;if(_0x2675bb[_0xa4e7('0x2e')][_0xa4e7('0x3f')]){_0x27db6d[_0xa4e7('0x40')]=[{'all':!![]}];}return db[_0xa4e7('0x2a')][_0xa4e7('0x41')](_0x27db6d);})[_0xa4e7('0x23')](function(_0x254fae){_0x1f867d[_0xa4e7('0x42')]=_0x254fae;return _0x1f867d;})[_0xa4e7('0x23')](respondWithFilteredResult(_0x30836c,_0x27db6d))['catch'](handleError(_0x30836c,null));};exports[_0xa4e7('0x43')]=function(_0x3366a3,_0x55399f){var _0x3bc110={'raw':!![],'where':{'id':_0x3366a3['params']['id']}},_0x523eae={};_0x523eae[_0xa4e7('0x2d')]=_[_0xa4e7('0x2f')](db[_0xa4e7('0x2a')][_0xa4e7('0x2b')]);_0x523eae[_0xa4e7('0x2e')]=_[_0xa4e7('0x2f')](_0x3366a3[_0xa4e7('0x2e')]);_0x523eae[_0xa4e7('0x30')]=_['intersection'](_0x523eae['model'],_0x523eae['query']);_0x3bc110[_0xa4e7('0x32')]=_[_0xa4e7('0x31')](_0x523eae[_0xa4e7('0x2d')],qs['fields'](_0x3366a3[_0xa4e7('0x2e')][_0xa4e7('0x33')]));_0x3bc110[_0xa4e7('0x32')]=_0x3bc110[_0xa4e7('0x32')][_0xa4e7('0x34')]?_0x3bc110['attributes']:_0x523eae['model'];if(_0x3366a3[_0xa4e7('0x2e')][_0xa4e7('0x3f')]){_0x3bc110[_0xa4e7('0x40')]=[{'all':!![]}];}_0x3bc110=_[_0xa4e7('0x3c')]({},_0x3bc110,_0x3366a3[_0xa4e7('0x3e')]);return db[_0xa4e7('0x2a')][_0xa4e7('0x44')](_0x3bc110)[_0xa4e7('0x23')](handleEntityNotFound(_0x55399f,null))[_0xa4e7('0x23')](respondWithResult(_0x55399f,null))[_0xa4e7('0x45')](handleError(_0x55399f,null));};exports[_0xa4e7('0x46')]=function(_0x466a75,_0x4585e3){return db[_0xa4e7('0x2a')]['create'](_0x466a75['body'],{})['then'](respondWithResult(_0x4585e3,0xc9))[_0xa4e7('0x45')](handleError(_0x4585e3,null));};exports['update']=function(_0x53450c,_0x160c75){if(_0x53450c[_0xa4e7('0x47')]['id']){delete _0x53450c[_0xa4e7('0x47')]['id'];}return db[_0xa4e7('0x2a')][_0xa4e7('0x44')]({'where':{'id':_0x53450c[_0xa4e7('0x48')]['id']}})[_0xa4e7('0x23')](handleEntityNotFound(_0x160c75,null))[_0xa4e7('0x23')](saveUpdates(_0x53450c[_0xa4e7('0x47')],null))['then'](respondWithResult(_0x160c75,null))[_0xa4e7('0x45')](handleError(_0x160c75,null));};exports[_0xa4e7('0x24')]=function(_0x1a86a4,_0x49477b){return db[_0xa4e7('0x2a')][_0xa4e7('0x44')]({'where':{'id':_0x1a86a4[_0xa4e7('0x48')]['id']}})[_0xa4e7('0x23')](handleEntityNotFound(_0x49477b,null))[_0xa4e7('0x23')](removeEntity(_0x49477b,null))[_0xa4e7('0x45')](handleError(_0x49477b,null));};exports[_0xa4e7('0x49')]=function(_0x855f57,_0x3e51bc){return db[_0xa4e7('0x2a')][_0xa4e7('0x49')]()[_0xa4e7('0x23')](respondWithResult(_0x3e51bc,null))['catch'](handleError(_0x3e51bc,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 3f8a765..c6ff052 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 _0x7761=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7761,0xd4));var _0x1776=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7761[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x1776('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x1776('0x1')](0x0);var events={'afterUpdate':_0x1776('0x2')};function emitEvent(_0x3ec950){return function(_0x54fed5,_0x5a7171,_0x35cb8f){MailSubstatusEvents['emit'](_0x3ec950+':'+_0x54fed5['id'],_0x54fed5);MailSubstatusEvents['emit'](_0x3ec950,_0x54fed5);_0x35cb8f(null);};}for(var e in events){if(events[_0x1776('0x3')](e)){var event=events[e];MailSubstatus[_0x1776('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xba7f=['setMaxListeners','emit','exports','events','MailSubstatus'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0xba7f,0xad));var _0xfba7=function(_0x5c5898,_0x147645){_0x5c5898=_0x5c5898-0x0;var _0x24d645=_0xba7f[_0x5c5898];return _0x24d645;};'use strict';var EventEmitter=require(_0xfba7('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xfba7('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xfba7('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x589dc6){return function(_0x390638,_0x28db91,_0x2fd6e6){MailSubstatusEvents[_0xfba7('0x3')](_0x589dc6+':'+_0x390638['id'],_0x390638);MailSubstatusEvents[_0xfba7('0x3')](_0x589dc6,_0x390638);_0x2fd6e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xfba7('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 28f5001..6bef591 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 _0xb249=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues'];(function(_0x154f75,_0xd2b043){var _0x219e66=function(_0x4cb4d6){while(--_0x4cb4d6){_0x154f75['push'](_0x154f75['shift']());}};_0x219e66(++_0xd2b043);}(_0xb249,0x18e));var _0x9b24=function(_0x14fcdf,_0x581032){_0x14fcdf=_0x14fcdf-0x0;var _0x85f8d4=_0xb249[_0x14fcdf];return _0x85f8d4;};'use strict';var attributes=require(_0x9b24('0x0'));module[_0x9b24('0x1')]=function(_0x5e673a){var _0x1b5c9e=_0x5e673a[_0x9b24('0x2')];return _0x5e673a[_0x9b24('0x3')](_0x9b24('0x4'),attributes,{'tableName':_0x9b24('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x49d40c,_0xe18543,_0x4cff73){return _0x1b5c9e[_0x9b24('0x6')][_0x9b24('0x7')]({'value':_0x49d40c[_0x9b24('0x8')]},{'where':{'field':'mailSubstatus','value':_0x49d40c[_0x9b24('0x9')]['name']}})[_0x9b24('0xa')](function(){_0x4cff73();})[_0x9b24('0xb')](function(_0x31ec11){_0x4cff73(_0x31ec11);});}}});}; \ No newline at end of file +var _0xffe2=['mailSubstatus','_previousDataValues','then','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0xffe2,0x1d8));var _0x2ffe=function(_0x4d9b05,_0xcf1402){_0x4d9b05=_0x4d9b05-0x0;var _0x373a4f=_0xffe2[_0x4d9b05];return _0x373a4f;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2ffe('0x0')]=function(_0x491d63){var _0x3e61ab=_0x491d63[_0x2ffe('0x1')];return _0x491d63[_0x2ffe('0x2')](_0x2ffe('0x3'),attributes,{'tableName':_0x2ffe('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3734c2,_0x168944,_0x140d6a){return _0x3e61ab[_0x2ffe('0x5')][_0x2ffe('0x6')]({'value':_0x3734c2[_0x2ffe('0x7')]},{'where':{'field':_0x2ffe('0x8'),'value':_0x3734c2[_0x2ffe('0x9')][_0x2ffe('0x7')]}})[_0x2ffe('0xa')](function(){_0x140d6a();})[_0x2ffe('0xb')](function(_0x47c0a0){_0x140d6a(_0x47c0a0);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 951b4cc..0a412dd 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 _0x9fe9=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9fe9,0x184));var _0x99fe=function(_0x229112,_0x4c445a){_0x229112=_0x229112-0x0;var _0x400a9d=_0x9fe9[_0x229112];return _0x400a9d;};'use strict';var _=require(_0x99fe('0x0'));var util=require(_0x99fe('0x1'));var moment=require(_0x99fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x99fe('0x3'));var fs=require('fs');var Redis=require(_0x99fe('0x4'));var db=require(_0x99fe('0x5'))['db'];var utils=require(_0x99fe('0x6'));var logger=require(_0x99fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x99fe('0x8'));var client=jayson['client'][_0x99fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5de96d,_0x30837c,_0x4fbd52){return new BPromise(function(_0x158ffd,_0x8f9053){return client[_0x99fe('0xa')](_0x5de96d,_0x4fbd52)['then'](function(_0x5efbde){logger[_0x99fe('0xb')](_0x99fe('0xc'),_0x30837c,_0x99fe('0xd'));logger[_0x99fe('0xe')](_0x99fe('0xf'),_0x30837c,_0x99fe('0xd'),JSON[_0x99fe('0x10')](_0x5efbde));if(_0x5efbde['error']){if(_0x5efbde[_0x99fe('0x11')]['code']===0x1f4){logger[_0x99fe('0x11')](_0x99fe('0xc'),_0x30837c,_0x5efbde[_0x99fe('0x11')]['message']);return _0x8f9053(_0x5efbde['error'][_0x99fe('0x12')]);}logger[_0x99fe('0x11')](_0x99fe('0xc'),_0x30837c,_0x5efbde['error'][_0x99fe('0x12')]);return _0x158ffd(_0x5efbde[_0x99fe('0x11')]['message']);}else{logger[_0x99fe('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x30837c,_0x99fe('0xd'));_0x158ffd(_0x5efbde[_0x99fe('0x13')][_0x99fe('0x12')]);}})[_0x99fe('0x14')](function(_0x3f86c8){logger[_0x99fe('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x30837c,_0x3f86c8);_0x8f9053(_0x3f86c8);});});} \ No newline at end of file +var _0x729b=['http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x543bf6,_0x763bd7){var _0x4187b3=function(_0x2e44c7){while(--_0x2e44c7){_0x543bf6['push'](_0x543bf6['shift']());}};_0x4187b3(++_0x763bd7);}(_0x729b,0x1b1));var _0xb729=function(_0x26b192,_0x39f552){_0x26b192=_0x26b192-0x0;var _0x3e4970=_0x729b[_0x26b192];return _0x3e4970;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb729('0x0'));var rs=require(_0xb729('0x1'));var fs=require('fs');var Redis=require(_0xb729('0x2'));var db=require(_0xb729('0x3'))['db'];var utils=require(_0xb729('0x4'));var logger=require(_0xb729('0x5'))('rpc');var config=require(_0xb729('0x6'));var jayson=require(_0xb729('0x7'));var client=jayson['client'][_0xb729('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f0806,_0x8f419e,_0x4a95c6){return new BPromise(function(_0x3e8320,_0x3b75af){return client[_0xb729('0x9')](_0x1f0806,_0x4a95c6)[_0xb729('0xa')](function(_0x31cb17){logger['info'](_0xb729('0xb'),_0x8f419e,_0xb729('0xc'));logger[_0xb729('0xd')](_0xb729('0xe'),_0x8f419e,'request\x20sent',JSON[_0xb729('0xf')](_0x31cb17));if(_0x31cb17[_0xb729('0x10')]){if(_0x31cb17[_0xb729('0x10')][_0xb729('0x11')]===0x1f4){logger['error'](_0xb729('0xb'),_0x8f419e,_0x31cb17['error']['message']);return _0x3b75af(_0x31cb17[_0xb729('0x10')][_0xb729('0x12')]);}logger[_0xb729('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x8f419e,_0x31cb17[_0xb729('0x10')]['message']);return _0x3e8320(_0x31cb17[_0xb729('0x10')][_0xb729('0x12')]);}else{logger['info'](_0xb729('0xb'),_0x8f419e,_0xb729('0xc'));_0x3e8320(_0x31cb17[_0xb729('0x13')]['message']);}})[_0xb729('0x14')](function(_0x95e163){logger[_0xb729('0x10')](_0xb729('0xb'),_0x8f419e,_0x95e163);_0x3b75af(_0x95e163);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 40ec84a..1661096 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 _0xe98a=['describe','show','post','create','put','/:id','delete','path','express','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x467aca,_0x38cb17){var _0x435d68=function(_0x5c41cd){while(--_0x5c41cd){_0x467aca['push'](_0x467aca['shift']());}};_0x435d68(++_0x38cb17);}(_0xe98a,0x87));var _0xae98=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xe98a[_0x49ad79];return _0xa4e38a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae98('0x0'));var timeout=require('connect-timeout');var express=require(_0xae98('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae98('0x2'));var config=require(_0xae98('0x3'));var controller=require(_0xae98('0x4'));router[_0xae98('0x5')]('/',auth['isAuthenticated'](),controller[_0xae98('0x6')]);router[_0xae98('0x5')](_0xae98('0x7'),auth[_0xae98('0x8')](),controller[_0xae98('0x9')]);router[_0xae98('0x5')]('/:id',auth[_0xae98('0x8')](),controller[_0xae98('0xa')]);router[_0xae98('0xb')]('/',auth['isAuthenticated'](),controller[_0xae98('0xc')]);router[_0xae98('0xd')](_0xae98('0xe'),auth[_0xae98('0x8')](),controller['update']);router[_0xae98('0xf')](_0xae98('0xe'),auth[_0xae98('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2f41=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','describe','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x39c597,_0x26a446){var _0x5ba0a1=function(_0x104963){while(--_0x104963){_0x39c597['push'](_0x39c597['shift']());}};_0x5ba0a1(++_0x26a446);}(_0x2f41,0x18f));var _0x12f4=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x2f41[_0x1762b4];return _0x29beda;};'use strict';var multer=require(_0x12f4('0x0'));var util=require(_0x12f4('0x1'));var path=require(_0x12f4('0x2'));var timeout=require(_0x12f4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x12f4('0x4'));var interaction=require(_0x12f4('0x5'));var config=require(_0x12f4('0x6'));var controller=require(_0x12f4('0x7'));router[_0x12f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x12f4('0x9')]);router[_0x12f4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x12f4('0xa')]);router[_0x12f4('0x8')]('/:id',auth[_0x12f4('0xb')](),controller[_0x12f4('0xc')]);router[_0x12f4('0xd')]('/',auth[_0x12f4('0xb')](),controller[_0x12f4('0xe')]);router['put'](_0x12f4('0xf'),auth[_0x12f4('0xb')](),controller[_0x12f4('0x10')]);router[_0x12f4('0x11')](_0x12f4('0xf'),auth[_0x12f4('0xb')](),controller[_0x12f4('0x12')]);module[_0x12f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f816bf6..3a39ff5 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2510e3,_0x3c9772){var _0x5d9e48=function(_0x517638){while(--_0x517638){_0x2510e3['push'](_0x2510e3['shift']());}};_0x5d9e48(++_0x3c9772);}(_0xf4eb,0xec));var _0xbf4e=function(_0x58ac15,_0x5921f7){_0x58ac15=_0x58ac15-0x0;var _0x58b6da=_0xf4eb[_0x58ac15];return _0x58b6da;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x18a63a,_0x259cec){var _0x2cca04=function(_0x556e74){while(--_0x556e74){_0x18a63a['push'](_0x18a63a['shift']());}};_0x2cca04(++_0x259cec);}(_0x008c,0x188));var _0xc008=function(_0x46b579,_0x566d72){_0x46b579=_0x46b579-0x0;var _0x373a12=_0x008c[_0x46b579];return _0x373a12;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cbbb1b4..8dd038e 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 _0xd60a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','MailTransferReport','findAll','rows','catch','show','include','options','find','create','body','update','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis'];(function(_0x2e01aa,_0x6ded9b){var _0x1766e2=function(_0x27b479){while(--_0x27b479){_0x2e01aa['push'](_0x2e01aa['shift']());}};_0x1766e2(++_0x6ded9b);}(_0xd60a,0xd4));var _0xad60=function(_0x5156ab,_0xbc1cb){_0x5156ab=_0x5156ab-0x0;var _0x4d16b0=_0xd60a[_0x5156ab];return _0x4d16b0;};'use strict';var emlformat=require(_0xad60('0x0'));var rimraf=require(_0xad60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad60('0x2'));var rp=require(_0xad60('0x3'));var moment=require(_0xad60('0x4'));var BPromise=require(_0xad60('0x5'));var Mustache=require(_0xad60('0x6'));var util=require(_0xad60('0x7'));var path=require(_0xad60('0x8'));var sox=require('sox');var csv=require(_0xad60('0x9'));var ejs=require(_0xad60('0xa'));var fs=require('fs');var fs_extra=require(_0xad60('0xb'));var _=require(_0xad60('0xc'));var squel=require('squel');var crypto=require(_0xad60('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xad60('0xe'));var toCsv=require(_0xad60('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad60('0xf'));var authService=require(_0xad60('0x10'));var qs=require(_0xad60('0x11'));var as=require(_0xad60('0x12'));var hardwareService=require(_0xad60('0x13'));var logger=require(_0xad60('0x14'))(_0xad60('0x15'));var utils=require(_0xad60('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xad60('0x17'));var db=require(_0xad60('0x18'))['db'];function respondWithStatusCode(_0x3c5d8f,_0x1e3acb){_0x1e3acb=_0x1e3acb||0xcc;return function(_0x57203a){if(_0x57203a){return _0x3c5d8f['sendStatus'](_0x1e3acb);}return _0x3c5d8f['status'](_0x1e3acb)[_0xad60('0x19')]();};}function respondWithResult(_0x26feba,_0x2f6442){_0x2f6442=_0x2f6442||0xc8;return function(_0x8c3c5a){if(_0x8c3c5a){return _0x26feba[_0xad60('0x1a')](_0x2f6442)[_0xad60('0x1b')](_0x8c3c5a);}};}function respondWithFilteredResult(_0x145735,_0x5efce9){return function(_0x2bc771){if(_0x2bc771){var _0x3e5374=typeof _0x5efce9[_0xad60('0x1c')]==='undefined'&&typeof _0x5efce9[_0xad60('0x1d')]==='undefined';var _0x46cb79=_0x2bc771['count'];var _0x4f158a=_0x3e5374?0x0:_0x5efce9['offset'];var _0x5508e3=_0x3e5374?_0x2bc771[_0xad60('0x1e')]:_0x5efce9['offset']+_0x5efce9['limit'];var _0x315ab6;if(_0x5508e3>=_0x46cb79){_0x5508e3=_0x46cb79;_0x315ab6=0xc8;}else{_0x315ab6=0xce;}_0x145735[_0xad60('0x1a')](_0x315ab6);return _0x145735['set'](_0xad60('0x1f'),_0x4f158a+'-'+_0x5508e3+'/'+_0x46cb79)[_0xad60('0x1b')](_0x2bc771);}return null;};}function patchUpdates(_0xabdd95){return function(_0x200adb){try{jsonpatch[_0xad60('0x20')](_0x200adb,_0xabdd95,!![]);}catch(_0x288dea){return BPromise[_0xad60('0x21')](_0x288dea);}return _0x200adb[_0xad60('0x22')]();};}function saveUpdates(_0xb66bc8,_0xe60b04){return function(_0x19173c){if(_0x19173c){return _0x19173c['update'](_0xb66bc8)[_0xad60('0x23')](function(_0x3844f1){return _0x3844f1;});}return null;};}function removeEntity(_0x3e9046,_0x3ecef4){return function(_0x15d2dc){if(_0x15d2dc){return _0x15d2dc['destroy']()['then'](function(){_0x3e9046[_0xad60('0x1a')](0xcc)[_0xad60('0x19')]();});}};}function handleEntityNotFound(_0x405dc7,_0x121598){return function(_0x436a68){if(!_0x436a68){_0x405dc7[_0xad60('0x24')](0x194);}return _0x436a68;};}function handleError(_0x5173e3,_0x2d6c45){_0x2d6c45=_0x2d6c45||0x1f4;return function(_0x7dffab){logger[_0xad60('0x25')](_0x7dffab[_0xad60('0x26')]);if(_0x7dffab[_0xad60('0x27')]){delete _0x7dffab['name'];}_0x5173e3[_0xad60('0x1a')](_0x2d6c45)[_0xad60('0x28')](_0x7dffab);};}exports[_0xad60('0x29')]=function(_0x268ef2,_0x327fd2){var _0x24a39f={},_0xd491d9={},_0x40800e={'count':0x0,'rows':[]};var _0x389151=_[_0xad60('0x2a')](db['MailTransferReport'][_0xad60('0x2b')],function(_0x157086){return{'name':_0x157086['fieldName'],'type':_0x157086[_0xad60('0x2c')]['key']};});_0xd491d9[_0xad60('0x2d')]=_[_0xad60('0x2a')](_0x389151,_0xad60('0x27'));_0xd491d9[_0xad60('0x2e')]=_[_0xad60('0x2f')](_0x268ef2[_0xad60('0x2e')]);_0xd491d9[_0xad60('0x30')]=_['intersection'](_0xd491d9['model'],_0xd491d9[_0xad60('0x2e')]);_0x24a39f[_0xad60('0x31')]=_[_0xad60('0x32')](_0xd491d9[_0xad60('0x2d')],qs[_0xad60('0x33')](_0x268ef2[_0xad60('0x2e')][_0xad60('0x33')]));_0x24a39f[_0xad60('0x31')]=_0x24a39f[_0xad60('0x31')][_0xad60('0x34')]?_0x24a39f['attributes']:_0xd491d9[_0xad60('0x2d')];if(!_0x268ef2[_0xad60('0x2e')]['hasOwnProperty'](_0xad60('0x35'))){_0x24a39f[_0xad60('0x1d')]=qs['limit'](_0x268ef2[_0xad60('0x2e')][_0xad60('0x1d')]);_0x24a39f['offset']=qs['offset'](_0x268ef2[_0xad60('0x2e')][_0xad60('0x1c')]);}_0x24a39f[_0xad60('0x36')]=qs['sort'](_0x268ef2[_0xad60('0x2e')][_0xad60('0x37')]);_0x24a39f[_0xad60('0x38')]=qs[_0xad60('0x30')](_[_0xad60('0x39')](_0x268ef2[_0xad60('0x2e')],_0xd491d9[_0xad60('0x30')]),_0x389151);if(_0x268ef2['query'][_0xad60('0x3a')]){_0x24a39f['where']=_[_0xad60('0x3b')](_0x24a39f['where'],{'$or':_[_0xad60('0x2a')](_0x389151,function(_0x2baea5){if(_0x2baea5['type']!==_0xad60('0x3c')){var _0x471a50={};_0x471a50[_0x2baea5['name']]={'$like':'%'+_0x268ef2['query'][_0xad60('0x3a')]+'%'};return _0x471a50;}})});}_0x24a39f=_['merge']({},_0x24a39f,_0x268ef2['options']);var _0x1de59c={'where':_0x24a39f[_0xad60('0x38')]};return db['MailTransferReport']['count'](_0x1de59c)[_0xad60('0x23')](function(_0x3cd86b){_0x40800e[_0xad60('0x1e')]=_0x3cd86b;if(_0x268ef2[_0xad60('0x2e')][_0xad60('0x3d')]){_0x24a39f['include']=[{'all':!![]}];}return db[_0xad60('0x3e')][_0xad60('0x3f')](_0x24a39f);})[_0xad60('0x23')](function(_0x219496){_0x40800e[_0xad60('0x40')]=_0x219496;return _0x40800e;})[_0xad60('0x23')](respondWithFilteredResult(_0x327fd2,_0x24a39f))[_0xad60('0x41')](handleError(_0x327fd2,null));};exports[_0xad60('0x42')]=function(_0x271462,_0x354222){var _0x2aa7bc={'raw':!![],'where':{'id':_0x271462['params']['id']}},_0x299683={};_0x299683[_0xad60('0x2d')]=_[_0xad60('0x2f')](db[_0xad60('0x3e')][_0xad60('0x2b')]);_0x299683[_0xad60('0x2e')]=_[_0xad60('0x2f')](_0x271462[_0xad60('0x2e')]);_0x299683[_0xad60('0x30')]=_[_0xad60('0x32')](_0x299683[_0xad60('0x2d')],_0x299683[_0xad60('0x2e')]);_0x2aa7bc['attributes']=_[_0xad60('0x32')](_0x299683[_0xad60('0x2d')],qs[_0xad60('0x33')](_0x271462[_0xad60('0x2e')][_0xad60('0x33')]));_0x2aa7bc['attributes']=_0x2aa7bc[_0xad60('0x31')][_0xad60('0x34')]?_0x2aa7bc[_0xad60('0x31')]:_0x299683['model'];if(_0x271462['query']['includeAll']){_0x2aa7bc[_0xad60('0x43')]=[{'all':!![]}];}_0x2aa7bc=_[_0xad60('0x3b')]({},_0x2aa7bc,_0x271462[_0xad60('0x44')]);return db[_0xad60('0x3e')][_0xad60('0x45')](_0x2aa7bc)[_0xad60('0x23')](handleEntityNotFound(_0x354222,null))['then'](respondWithResult(_0x354222,null))['catch'](handleError(_0x354222,null));};exports[_0xad60('0x46')]=function(_0x5939dc,_0x3dc3cf){return db[_0xad60('0x3e')][_0xad60('0x46')](_0x5939dc[_0xad60('0x47')],{})[_0xad60('0x23')](respondWithResult(_0x3dc3cf,0xc9))['catch'](handleError(_0x3dc3cf,null));};exports[_0xad60('0x48')]=function(_0x4c2614,_0x8d1740){if(_0x4c2614[_0xad60('0x47')]['id']){delete _0x4c2614[_0xad60('0x47')]['id'];}return db[_0xad60('0x3e')][_0xad60('0x45')]({'where':{'id':_0x4c2614[_0xad60('0x49')]['id']}})['then'](handleEntityNotFound(_0x8d1740,null))[_0xad60('0x23')](saveUpdates(_0x4c2614['body'],null))['then'](respondWithResult(_0x8d1740,null))['catch'](handleError(_0x8d1740,null));};exports[_0xad60('0x4a')]=function(_0x459ed5,_0x15d47a){return db[_0xad60('0x3e')][_0xad60('0x45')]({'where':{'id':_0x459ed5[_0xad60('0x49')]['id']}})[_0xad60('0x23')](handleEntityNotFound(_0x15d47a,null))[_0xad60('0x23')](removeEntity(_0x15d47a,null))[_0xad60('0x41')](handleError(_0x15d47a,null));};exports[_0xad60('0x4b')]=function(_0x4c1047,_0x212c80){return db[_0xad60('0x3e')][_0xad60('0x4b')]()['then'](respondWithResult(_0x212c80,null))[_0xad60('0x41')](handleError(_0x212c80,null));}; \ No newline at end of file +var _0x1b14=['MailTransferReport','rows','params','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0x1b14,0x1e3));var _0x41b1=function(_0x99ad0a,_0x5832fd){_0x99ad0a=_0x99ad0a-0x0;var _0x6c4330=_0x1b14[_0x99ad0a];return _0x6c4330;};'use strict';var emlformat=require(_0x41b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41b1('0x1'));var jsonpatch=require(_0x41b1('0x2'));var rp=require(_0x41b1('0x3'));var moment=require(_0x41b1('0x4'));var BPromise=require(_0x41b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x41b1('0x6'));var sox=require(_0x41b1('0x7'));var csv=require(_0x41b1('0x8'));var ejs=require(_0x41b1('0x9'));var fs=require('fs');var fs_extra=require(_0x41b1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x41b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x41b1('0xc'));var toCsv=require(_0x41b1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41b1('0xd'));var authService=require(_0x41b1('0xe'));var qs=require(_0x41b1('0xf'));var as=require(_0x41b1('0x10'));var hardwareService=require(_0x41b1('0x11'));var logger=require('../../config/logger')(_0x41b1('0x12'));var utils=require('../../config/utils');var config=require(_0x41b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ab05e,_0x4a9a7b){_0x4a9a7b=_0x4a9a7b||0xcc;return function(_0x33f07c){if(_0x33f07c){return _0x1ab05e[_0x41b1('0x14')](_0x4a9a7b);}return _0x1ab05e['status'](_0x4a9a7b)['end']();};}function respondWithResult(_0x406e87,_0x368313){_0x368313=_0x368313||0xc8;return function(_0x5473a5){if(_0x5473a5){return _0x406e87[_0x41b1('0x15')](_0x368313)[_0x41b1('0x16')](_0x5473a5);}};}function respondWithFilteredResult(_0x32877f,_0x6bba18){return function(_0x1540e2){if(_0x1540e2){var _0x28d1dd=typeof _0x6bba18[_0x41b1('0x17')]===_0x41b1('0x18')&&typeof _0x6bba18[_0x41b1('0x19')]==='undefined';var _0x14af29=_0x1540e2[_0x41b1('0x1a')];var _0x182e40=_0x28d1dd?0x0:_0x6bba18[_0x41b1('0x17')];var _0x14daad=_0x28d1dd?_0x1540e2['count']:_0x6bba18[_0x41b1('0x17')]+_0x6bba18[_0x41b1('0x19')];var _0x3d4d4c;if(_0x14daad>=_0x14af29){_0x14daad=_0x14af29;_0x3d4d4c=0xc8;}else{_0x3d4d4c=0xce;}_0x32877f['status'](_0x3d4d4c);return _0x32877f['set']('Content-Range',_0x182e40+'-'+_0x14daad+'/'+_0x14af29)['json'](_0x1540e2);}return null;};}function patchUpdates(_0x12a0d3){return function(_0x513c3e){try{jsonpatch['apply'](_0x513c3e,_0x12a0d3,!![]);}catch(_0x5a6ac0){return BPromise[_0x41b1('0x1b')](_0x5a6ac0);}return _0x513c3e[_0x41b1('0x1c')]();};}function saveUpdates(_0x18e96d,_0x35e8a0){return function(_0x2f435d){if(_0x2f435d){return _0x2f435d[_0x41b1('0x1d')](_0x18e96d)['then'](function(_0x1b9f45){return _0x1b9f45;});}return null;};}function removeEntity(_0x269e08,_0x15fa0b){return function(_0x187a51){if(_0x187a51){return _0x187a51[_0x41b1('0x1e')]()[_0x41b1('0x1f')](function(){_0x269e08[_0x41b1('0x15')](0xcc)[_0x41b1('0x20')]();});}};}function handleEntityNotFound(_0x1b4e84,_0x489d82){return function(_0x38f060){if(!_0x38f060){_0x1b4e84['sendStatus'](0x194);}return _0x38f060;};}function handleError(_0xfffab8,_0x4e0cc2){_0x4e0cc2=_0x4e0cc2||0x1f4;return function(_0x1dd2a1){logger['error'](_0x1dd2a1[_0x41b1('0x21')]);if(_0x1dd2a1[_0x41b1('0x22')]){delete _0x1dd2a1['name'];}_0xfffab8['status'](_0x4e0cc2)[_0x41b1('0x23')](_0x1dd2a1);};}exports[_0x41b1('0x24')]=function(_0x561e64,_0x16e24f){var _0xb27b49={},_0x2b09f0={},_0xfe34a4={'count':0x0,'rows':[]};var _0x1ff6d1=_[_0x41b1('0x25')](db['MailTransferReport'][_0x41b1('0x26')],function(_0x166d83){return{'name':_0x166d83['fieldName'],'type':_0x166d83['type'][_0x41b1('0x27')]};});_0x2b09f0[_0x41b1('0x28')]=_['map'](_0x1ff6d1,_0x41b1('0x22'));_0x2b09f0[_0x41b1('0x29')]=_[_0x41b1('0x2a')](_0x561e64['query']);_0x2b09f0[_0x41b1('0x2b')]=_[_0x41b1('0x2c')](_0x2b09f0['model'],_0x2b09f0[_0x41b1('0x29')]);_0xb27b49[_0x41b1('0x2d')]=_[_0x41b1('0x2c')](_0x2b09f0[_0x41b1('0x28')],qs[_0x41b1('0x2e')](_0x561e64[_0x41b1('0x29')][_0x41b1('0x2e')]));_0xb27b49[_0x41b1('0x2d')]=_0xb27b49[_0x41b1('0x2d')][_0x41b1('0x2f')]?_0xb27b49[_0x41b1('0x2d')]:_0x2b09f0['model'];if(!_0x561e64[_0x41b1('0x29')][_0x41b1('0x30')](_0x41b1('0x31'))){_0xb27b49['limit']=qs['limit'](_0x561e64[_0x41b1('0x29')]['limit']);_0xb27b49[_0x41b1('0x17')]=qs[_0x41b1('0x17')](_0x561e64[_0x41b1('0x29')][_0x41b1('0x17')]);}_0xb27b49[_0x41b1('0x32')]=qs[_0x41b1('0x33')](_0x561e64['query'][_0x41b1('0x33')]);_0xb27b49[_0x41b1('0x34')]=qs[_0x41b1('0x2b')](_[_0x41b1('0x35')](_0x561e64['query'],_0x2b09f0[_0x41b1('0x2b')]),_0x1ff6d1);if(_0x561e64[_0x41b1('0x29')][_0x41b1('0x36')]){_0xb27b49[_0x41b1('0x34')]=_['merge'](_0xb27b49[_0x41b1('0x34')],{'$or':_[_0x41b1('0x25')](_0x1ff6d1,function(_0xb5ffc9){if(_0xb5ffc9[_0x41b1('0x37')]!==_0x41b1('0x38')){var _0x134fdc={};_0x134fdc[_0xb5ffc9[_0x41b1('0x22')]]={'$like':'%'+_0x561e64[_0x41b1('0x29')][_0x41b1('0x36')]+'%'};return _0x134fdc;}})});}_0xb27b49=_[_0x41b1('0x39')]({},_0xb27b49,_0x561e64[_0x41b1('0x3a')]);var _0x4711da={'where':_0xb27b49[_0x41b1('0x34')]};return db['MailTransferReport'][_0x41b1('0x1a')](_0x4711da)[_0x41b1('0x1f')](function(_0xe6d91){_0xfe34a4['count']=_0xe6d91;if(_0x561e64['query'][_0x41b1('0x3b')]){_0xb27b49[_0x41b1('0x3c')]=[{'all':!![]}];}return db[_0x41b1('0x3d')]['findAll'](_0xb27b49);})[_0x41b1('0x1f')](function(_0x277370){_0xfe34a4[_0x41b1('0x3e')]=_0x277370;return _0xfe34a4;})[_0x41b1('0x1f')](respondWithFilteredResult(_0x16e24f,_0xb27b49))['catch'](handleError(_0x16e24f,null));};exports['show']=function(_0x54278d,_0x3a017b){var _0x23ea49={'raw':!![],'where':{'id':_0x54278d[_0x41b1('0x3f')]['id']}},_0x1170d2={};_0x1170d2[_0x41b1('0x28')]=_[_0x41b1('0x2a')](db[_0x41b1('0x3d')][_0x41b1('0x26')]);_0x1170d2['query']=_['keys'](_0x54278d['query']);_0x1170d2[_0x41b1('0x2b')]=_[_0x41b1('0x2c')](_0x1170d2[_0x41b1('0x28')],_0x1170d2['query']);_0x23ea49['attributes']=_['intersection'](_0x1170d2[_0x41b1('0x28')],qs['fields'](_0x54278d[_0x41b1('0x29')][_0x41b1('0x2e')]));_0x23ea49[_0x41b1('0x2d')]=_0x23ea49[_0x41b1('0x2d')][_0x41b1('0x2f')]?_0x23ea49[_0x41b1('0x2d')]:_0x1170d2['model'];if(_0x54278d[_0x41b1('0x29')][_0x41b1('0x3b')]){_0x23ea49[_0x41b1('0x3c')]=[{'all':!![]}];}_0x23ea49=_[_0x41b1('0x39')]({},_0x23ea49,_0x54278d['options']);return db[_0x41b1('0x3d')]['find'](_0x23ea49)[_0x41b1('0x1f')](handleEntityNotFound(_0x3a017b,null))['then'](respondWithResult(_0x3a017b,null))[_0x41b1('0x40')](handleError(_0x3a017b,null));};exports['create']=function(_0x3e8ec9,_0x48c147){return db[_0x41b1('0x3d')]['create'](_0x3e8ec9[_0x41b1('0x41')],{})[_0x41b1('0x1f')](respondWithResult(_0x48c147,0xc9))[_0x41b1('0x40')](handleError(_0x48c147,null));};exports['update']=function(_0x5a665b,_0x2dde9b){if(_0x5a665b[_0x41b1('0x41')]['id']){delete _0x5a665b[_0x41b1('0x41')]['id'];}return db[_0x41b1('0x3d')][_0x41b1('0x42')]({'where':{'id':_0x5a665b['params']['id']}})[_0x41b1('0x1f')](handleEntityNotFound(_0x2dde9b,null))[_0x41b1('0x1f')](saveUpdates(_0x5a665b[_0x41b1('0x41')],null))['then'](respondWithResult(_0x2dde9b,null))['catch'](handleError(_0x2dde9b,null));};exports[_0x41b1('0x1e')]=function(_0x287c39,_0x7b0575){return db[_0x41b1('0x3d')][_0x41b1('0x42')]({'where':{'id':_0x287c39['params']['id']}})['then'](handleEntityNotFound(_0x7b0575,null))[_0x41b1('0x1f')](removeEntity(_0x7b0575,null))[_0x41b1('0x40')](handleError(_0x7b0575,null));};exports[_0x41b1('0x43')]=function(_0x1c6715,_0x4272d8){return db[_0x41b1('0x3d')]['describe']()[_0x41b1('0x1f')](respondWithResult(_0x4272d8,null))['catch'](handleError(_0x4272d8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7cb9c1d..e392f33 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 _0x0a25=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0a25,0x68));var _0x50a2=function(_0xb71c35,_0x129343){_0xb71c35=_0xb71c35-0x0;var _0x39224f=_0x0a25[_0xb71c35];return _0x39224f;};'use strict';var _=require(_0x50a2('0x0'));var util=require(_0x50a2('0x1'));var logger=require('../../config/logger')(_0x50a2('0x2'));var moment=require(_0x50a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x50a2('0x4'));var fs=require('fs');var path=require(_0x50a2('0x5'));var rimraf=require(_0x50a2('0x6'));var config=require(_0x50a2('0x7'));var attributes=require(_0x50a2('0x8'));module[_0x50a2('0x9')]=function(_0x33fef7,_0x8b6ba4){return _0x33fef7[_0x50a2('0xa')](_0x50a2('0xb'),attributes,{'tableName':_0x50a2('0xc'),'paranoid':![],'indexes':[{'name':_0x50a2('0xd'),'fields':[_0x50a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6548=['bluebird','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','moment'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6548,0x133));var _0x8654=function(_0x1a47f2,_0x5dc0e9){_0x1a47f2=_0x1a47f2-0x0;var _0x4e6075=_0x6548[_0x1a47f2];return _0x4e6075;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8654('0x1'));var moment=require(_0x8654('0x2'));var BPromise=require(_0x8654('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8654('0x4'));var attributes=require('./mailTransferReport.attributes');module[_0x8654('0x5')]=function(_0x1b2d35,_0x3b6266){return _0x1b2d35[_0x8654('0x6')](_0x8654('0x7'),attributes,{'tableName':_0x8654('0x8'),'paranoid':![],'indexes':[{'name':_0x8654('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ac73f2a..c6fac0c 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 _0x9003=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x6fecc6,_0x422338){var _0x374846=function(_0x1308f7){while(--_0x1308f7){_0x6fecc6['push'](_0x6fecc6['shift']());}};_0x374846(++_0x422338);}(_0x9003,0xe4));var _0x3900=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9003[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x3900('0x0'));var util=require(_0x3900('0x1'));var moment=require(_0x3900('0x2'));var BPromise=require(_0x3900('0x3'));var rs=require(_0x3900('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3900('0x5'))['db'];var utils=require(_0x3900('0x6'));var logger=require(_0x3900('0x7'))(_0x3900('0x8'));var config=require(_0x3900('0x9'));var jayson=require(_0x3900('0xa'));var client=jayson[_0x3900('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x325036,_0x24a608,_0x400b7d){return new BPromise(function(_0x340529,_0x57171b){return client[_0x3900('0xc')](_0x325036,_0x400b7d)[_0x3900('0xd')](function(_0x33bdff){logger[_0x3900('0xe')](_0x3900('0xf'),_0x24a608,_0x3900('0x10'));logger[_0x3900('0x11')](_0x3900('0x12'),_0x24a608,_0x3900('0x10'),JSON[_0x3900('0x13')](_0x33bdff));if(_0x33bdff[_0x3900('0x14')]){if(_0x33bdff[_0x3900('0x14')][_0x3900('0x15')]===0x1f4){logger[_0x3900('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x24a608,_0x33bdff[_0x3900('0x14')][_0x3900('0x16')]);return _0x57171b(_0x33bdff[_0x3900('0x14')][_0x3900('0x16')]);}logger[_0x3900('0x14')](_0x3900('0xf'),_0x24a608,_0x33bdff[_0x3900('0x14')][_0x3900('0x16')]);return _0x340529(_0x33bdff['error'][_0x3900('0x16')]);}else{logger[_0x3900('0xe')](_0x3900('0xf'),_0x24a608,_0x3900('0x10'));_0x340529(_0x33bdff['result'][_0x3900('0x16')]);}})[_0x3900('0x17')](function(_0xd42978){logger[_0x3900('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x24a608,_0xd42978);_0x57171b(_0xd42978);});});} \ No newline at end of file +var _0x23a1=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2e8596,_0x5afd65){var _0x2333c3=function(_0x557cfe){while(--_0x557cfe){_0x2e8596['push'](_0x2e8596['shift']());}};_0x2333c3(++_0x5afd65);}(_0x23a1,0xb0));var _0x123a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x123a('0x0'));var util=require(_0x123a('0x1'));var moment=require(_0x123a('0x2'));var BPromise=require(_0x123a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x123a('0x4'));var db=require(_0x123a('0x5'))['db'];var utils=require(_0x123a('0x6'));var logger=require(_0x123a('0x7'))(_0x123a('0x8'));var config=require(_0x123a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c6f01,_0x4a2e85,_0x99502f){return new BPromise(function(_0x5d1f9f,_0x1fd1bb){return client['request'](_0x1c6f01,_0x99502f)['then'](function(_0x1757c4){logger['info'](_0x123a('0xa'),_0x4a2e85,'request\x20sent');logger[_0x123a('0xb')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4a2e85,_0x123a('0xc'),JSON[_0x123a('0xd')](_0x1757c4));if(_0x1757c4[_0x123a('0xe')]){if(_0x1757c4[_0x123a('0xe')][_0x123a('0xf')]===0x1f4){logger[_0x123a('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4a2e85,_0x1757c4[_0x123a('0xe')][_0x123a('0x10')]);return _0x1fd1bb(_0x1757c4[_0x123a('0xe')]['message']);}logger['error'](_0x123a('0xa'),_0x4a2e85,_0x1757c4[_0x123a('0xe')]['message']);return _0x5d1f9f(_0x1757c4['error'][_0x123a('0x10')]);}else{logger['info'](_0x123a('0xa'),_0x4a2e85,_0x123a('0xc'));_0x5d1f9f(_0x1757c4[_0x123a('0x11')][_0x123a('0x10')]);}})[_0x123a('0x12')](function(_0x58e1cd){logger[_0x123a('0xe')](_0x123a('0xa'),_0x4a2e85,_0x58e1cd);_0x1fd1bb(_0x58e1cd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0c1b549..3bafb89 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 _0x27d1=['Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','post','create','put','delete','destroy','exports','multer','util','path','express'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x27d1,0x7a));var _0x127d=function(_0x389376,_0x10a8eb){_0x389376=_0x389376-0x0;var _0x1303a6=_0x27d1[_0x389376];return _0x1303a6;};'use strict';var multer=require(_0x127d('0x0'));var util=require(_0x127d('0x1'));var path=require(_0x127d('0x2'));var timeout=require('connect-timeout');var express=require(_0x127d('0x3'));var router=express[_0x127d('0x4')]();var fs_extra=require(_0x127d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x127d('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x127d('0x7')]('/',auth['isAuthenticated'](),controller[_0x127d('0x8')]);router[_0x127d('0x7')](_0x127d('0x9'),auth[_0x127d('0xa')](),controller[_0x127d('0xb')]);router[_0x127d('0x7')]('/:id',auth[_0x127d('0xa')](),controller['show']);router[_0x127d('0xc')]('/',auth[_0x127d('0xa')](),controller[_0x127d('0xd')]);router[_0x127d('0xe')]('/:id',auth[_0x127d('0xa')](),controller['update']);router[_0x127d('0xf')]('/:id',auth[_0x127d('0xa')](),controller[_0x127d('0x10')]);module[_0x127d('0x11')]=router; \ No newline at end of file +var _0x415a=['/:id','show','post','create','put','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d33b9,_0xc280bb){var _0x4e12d6=function(_0x187bfb){while(--_0x187bfb){_0x2d33b9['push'](_0x2d33b9['shift']());}};_0x4e12d6(++_0xc280bb);}(_0x415a,0x1bf));var _0xa415=function(_0x55c263,_0x50d38c){_0x55c263=_0x55c263-0x0;var _0x5d283c=_0x415a[_0x55c263];return _0x5d283c;};'use strict';var multer=require(_0xa415('0x0'));var util=require(_0xa415('0x1'));var path=require(_0xa415('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa415('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa415('0x4'));var interaction=require(_0xa415('0x5'));var config=require(_0xa415('0x6'));var controller=require(_0xa415('0x7'));router[_0xa415('0x8')]('/',auth[_0xa415('0x9')](),controller[_0xa415('0xa')]);router[_0xa415('0x8')](_0xa415('0xb'),auth[_0xa415('0x9')](),controller[_0xa415('0xc')]);router[_0xa415('0x8')](_0xa415('0xd'),auth[_0xa415('0x9')](),controller[_0xa415('0xe')]);router[_0xa415('0xf')]('/',auth[_0xa415('0x9')](),controller[_0xa415('0x10')]);router[_0xa415('0x11')]('/:id',auth[_0xa415('0x9')](),controller['update']);router['delete'](_0xa415('0xd'),auth[_0xa415('0x9')](),controller[_0xa415('0x12')]);module[_0xa415('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a658843..e0dd3f9 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 _0x4499=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x924c29,_0x309120){var _0x24ddd6=function(_0x1c8a9e){while(--_0x1c8a9e){_0x924c29['push'](_0x924c29['shift']());}};_0x24ddd6(++_0x309120);}(_0x4499,0x98));var _0x9449=function(_0x4283e1,_0x80344){_0x4283e1=_0x4283e1-0x0;var _0x201855=_0x4499[_0x4283e1];return _0x201855;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9449('0x0'));module[_0x9449('0x1')]={'channel':{'type':Sequelize[_0x9449('0x2')]},'membername':{'type':Sequelize[_0x9449('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x9449('0x3'),'comment':_0x9449('0x4')},'duration':{'type':Sequelize[_0x9449('0x5')]},'enterAt':{'type':Sequelize[_0x9449('0x6')]},'exitAt':{'type':Sequelize[_0x9449('0x6')],'set':function(_0x13a06c){var _0x2993ba=moment(_0x13a06c);var _0xed2941=moment(this[_0x9449('0x7')](_0x9449('0x8')));var _0x370480=_0x2993ba[_0x9449('0x9')](_0xed2941,_0x9449('0xa'));this[_0x9449('0xb')](_0x9449('0xc'),_0x13a06c);this['setDataValue'](_0x9449('0xd'),_0x370480>=0x0?_0x370480:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9449('0x2')],'comment':_0x9449('0xe')},'data3':{'type':Sequelize[_0x9449('0x2')],'comment':_0x9449('0xf')},'data4':{'type':Sequelize[_0x9449('0x2')],'comment':_0x9449('0x10')},'data5':{'type':Sequelize[_0x9449('0x2')],'comment':_0x9449('0x11')},'role':{'type':Sequelize[_0x9449('0x2')]},'internal':{'type':Sequelize[_0x9449('0x5')]},'uniqueid':{'type':Sequelize[_0x9449('0x2')]}}; \ No newline at end of file +var _0x503d=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','diff'];(function(_0x32808c,_0x11f2df){var _0x429771=function(_0x5eb98d){while(--_0x5eb98d){_0x32808c['push'](_0x32808c['shift']());}};_0x429771(++_0x11f2df);}(_0x503d,0x13b));var _0xd503=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0x503d[_0x5448a9];return _0x1924af;};'use strict';var Sequelize=require(_0xd503('0x0'));var moment=require(_0xd503('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd503('0x2')]},'interface':{'type':Sequelize[_0xd503('0x2')]},'type':{'type':Sequelize[_0xd503('0x2')],'defaultValue':_0xd503('0x3'),'comment':_0xd503('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd503('0x5')],'set':function(_0x326277){var _0x5e13d4=moment(_0x326277);var _0x3907a8=moment(this['getDataValue']('enterAt'));var _0x4570c7=_0x5e13d4[_0xd503('0x6')](_0x3907a8,'seconds');this['setDataValue']('exitAt',_0x326277);this[_0xd503('0x7')](_0xd503('0x8'),_0x4570c7>=0x0?_0x4570c7:null);}},'data1':{'type':Sequelize[_0xd503('0x2')],'comment':_0xd503('0x9')},'data2':{'type':Sequelize[_0xd503('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xd503('0x2')],'comment':_0xd503('0xa')},'data4':{'type':Sequelize[_0xd503('0x2')],'comment':_0xd503('0xb')},'data5':{'type':Sequelize[_0xd503('0x2')],'comment':_0xd503('0xc')},'role':{'type':Sequelize[_0xd503('0x2')]},'internal':{'type':Sequelize[_0xd503('0xd')]},'uniqueid':{'type':Sequelize[_0xd503('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 48333d5..345cbec 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x34e8,0x12c));var _0x834e=function(_0x58671e,_0x40a498){_0x58671e=_0x58671e-0x0;var _0x5a3391=_0x34e8[_0x58671e];return _0x5a3391;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x197a55,_0x4654ea){var _0x108330=function(_0x5917e0){while(--_0x5917e0){_0x197a55['push'](_0x197a55['shift']());}};_0x108330(++_0x4654ea);}(_0x008c,0x188));var _0xc008=function(_0x2dd752,_0x59b4fc){_0x2dd752=_0x2dd752-0x0;var _0x297823=_0x008c[_0x2dd752];return _0x297823;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 2cfb37b..d91e77e 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 _0x6e0a=['interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername'];(function(_0x2cb58b,_0x5a879d){var _0xe9dd9c=function(_0x11e835){while(--_0x11e835){_0x2cb58b['push'](_0x2cb58b['shift']());}};_0xe9dd9c(++_0x5a879d);}(_0x6e0a,0xa1));var _0xa6e0=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x6e0a[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0xa6e0('0x0'));var util=require(_0xa6e0('0x1'));var logger=require(_0xa6e0('0x2'))(_0xa6e0('0x3'));var moment=require(_0xa6e0('0x4'));var BPromise=require(_0xa6e0('0x5'));var rp=require(_0xa6e0('0x6'));var fs=require('fs');var path=require(_0xa6e0('0x7'));var rimraf=require(_0xa6e0('0x8'));var config=require(_0xa6e0('0x9'));var attributes=require(_0xa6e0('0xa'));module['exports']=function(_0x256be3,_0x373ffe){return _0x256be3[_0xa6e0('0xb')]('MemberReport',attributes,{'tableName':_0xa6e0('0xc'),'paranoid':![],'indexes':[{'name':_0xa6e0('0xd'),'fields':[_0xa6e0('0xe'),_0xa6e0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1e0=['report_member','membername_interface','membername','interface','../../config/logger','moment','bluebird','path','../../config/environment','define','MemberReport'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xb1e0,0x138));var _0x0b1e=function(_0x164d2a,_0x9d33ee){_0x164d2a=_0x164d2a-0x0;var _0x2934d9=_0xb1e0[_0x164d2a];return _0x2934d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b1e('0x0'))('api');var moment=require(_0x0b1e('0x1'));var BPromise=require(_0x0b1e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b1e('0x3'));var rimraf=require('rimraf');var config=require(_0x0b1e('0x4'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x4e647c,_0x4bd35e){return _0x4e647c[_0x0b1e('0x5')](_0x0b1e('0x6'),attributes,{'tableName':_0x0b1e('0x7'),'paranoid':![],'indexes':[{'name':_0x0b1e('0x8'),'fields':[_0x0b1e('0x9'),_0x0b1e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2fe8606..72a1923 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 _0x5655=['http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','include','info','debug','CreateMemberReport','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x121fd2,_0x2164e7){var _0xea1043=function(_0x1ccdfa){while(--_0x1ccdfa){_0x121fd2['push'](_0x121fd2['shift']());}};_0xea1043(++_0x2164e7);}(_0x5655,0x15e));var _0x5565=function(_0x505c51,_0x18a9af){_0x505c51=_0x505c51-0x0;var _0xa01d5f=_0x5655[_0x505c51];return _0xa01d5f;};'use strict';var _=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var moment=require(_0x5565('0x2'));var BPromise=require(_0x5565('0x3'));var rs=require(_0x5565('0x4'));var fs=require('fs');var Redis=require(_0x5565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5565('0x6'))('rpc');var config=require(_0x5565('0x7'));var jayson=require(_0x5565('0x8'));var client=jayson[_0x5565('0x9')][_0x5565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x106d59,_0x5427a3,_0xc88d42){return new BPromise(function(_0x2980c9,_0x1a47c8){return client[_0x5565('0xb')](_0x106d59,_0xc88d42)[_0x5565('0xc')](function(_0x15fbe5){logger['info'](_0x5565('0xd'),_0x5427a3,_0x5565('0xe'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x5427a3,_0x5565('0xe'),JSON[_0x5565('0xf')](_0x15fbe5));if(_0x15fbe5['error']){if(_0x15fbe5['error'][_0x5565('0x10')]===0x1f4){logger[_0x5565('0x11')](_0x5565('0xd'),_0x5427a3,_0x15fbe5[_0x5565('0x11')][_0x5565('0x12')]);return _0x1a47c8(_0x15fbe5[_0x5565('0x11')][_0x5565('0x12')]);}logger[_0x5565('0x11')]('MemberReport,\x20%s,\x20%s',_0x5427a3,_0x15fbe5[_0x5565('0x11')][_0x5565('0x12')]);return _0x2980c9(_0x15fbe5[_0x5565('0x11')][_0x5565('0x12')]);}else{logger['info'](_0x5565('0xd'),_0x5427a3,_0x5565('0xe'));_0x2980c9(_0x15fbe5[_0x5565('0x13')][_0x5565('0x12')]);}})[_0x5565('0x14')](function(_0x592af2){logger['error'](_0x5565('0xd'),_0x5427a3,_0x592af2);_0x1a47c8(_0x592af2);});});}exports[_0x5565('0x15')]=function(_0x4f56df){var _0x36d189=this;return new Promise(function(_0x42002c,_0x339e87){return db[_0x5565('0x16')]['findAll']({'raw':_0x4f56df['options']?_0x4f56df[_0x5565('0x17')][_0x5565('0x18')]===undefined?!![]:![]:!![],'where':_0x4f56df[_0x5565('0x17')]?_0x4f56df[_0x5565('0x17')][_0x5565('0x19')]||null:null,'attributes':_0x4f56df[_0x5565('0x17')]?_0x4f56df['options'][_0x5565('0x1a')]||null:null,'limit':_0x4f56df[_0x5565('0x17')]?_0x4f56df['options'][_0x5565('0x1b')]||null:null,'include':_0x4f56df[_0x5565('0x17')]?_0x4f56df[_0x5565('0x17')]['include']?_[_0x5565('0x1c')](_0x4f56df['options'][_0x5565('0x1d')],function(_0x1ab95b){return{'model':db[_0x1ab95b['model']],'as':_0x1ab95b['as'],'attributes':_0x1ab95b['attributes'],'include':_0x1ab95b[_0x5565('0x1d')]?_[_0x5565('0x1c')](_0x1ab95b[_0x5565('0x1d')],function(_0x53fe47){return{'model':db[_0x53fe47['model']],'as':_0x53fe47['as'],'attributes':_0x53fe47[_0x5565('0x1a')],'include':_0x53fe47[_0x5565('0x1d')]?_['map'](_0x53fe47[_0x5565('0x1d')],function(_0x2eead1){return{'model':db[_0x2eead1['model']],'as':_0x2eead1['as'],'attributes':_0x2eead1[_0x5565('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d0171){logger[_0x5565('0x1e')](_0x5565('0x15'),_0x4f56df);logger[_0x5565('0x1f')](_0x5565('0x15'),_0x4f56df,JSON[_0x5565('0xf')](_0x3d0171));_0x42002c(_0x3d0171);})[_0x5565('0x14')](function(_0x33bcb6){logger[_0x5565('0x11')]('GetMemberReport',_0x33bcb6[_0x5565('0x12')],_0x4f56df);_0x339e87(_0x36d189['error'](0x1f4,_0x33bcb6['message']));});});};exports[_0x5565('0x20')]=function(_0x5b032c){var _0x37925a=this;return new Promise(function(_0x392579,_0x1bd5aa){return db['MemberReport']['create'](_0x5b032c[_0x5565('0x21')],{'raw':_0x5b032c[_0x5565('0x17')]?_0x5b032c[_0x5565('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2ac2b3){logger['info'](_0x5565('0x20'),_0x5b032c);logger['debug'](_0x5565('0x20'),_0x5b032c,JSON['stringify'](_0x2ac2b3));_0x392579(_0x2ac2b3);})['catch'](function(_0xc04467){logger[_0x5565('0x11')]('CreateMemberReport',_0xc04467[_0x5565('0x12')],_0x5b032c);_0x1bd5aa(_0x37925a[_0x5565('0x11')](0x1f4,_0xc04467[_0x5565('0x12')]));});});};exports[_0x5565('0x22')]=function(_0x140718){var _0x265e56=this;return new Promise(function(_0x215f59,_0x1a7399){return db[_0x5565('0x16')][_0x5565('0x23')](_0x140718['body'],{'raw':_0x140718[_0x5565('0x17')]?_0x140718[_0x5565('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x140718[_0x5565('0x17')]?_0x140718[_0x5565('0x17')]['where']||null:null,'attributes':_0x140718[_0x5565('0x17')]?_0x140718[_0x5565('0x17')]['attributes']||null:null,'limit':_0x140718['options']?_0x140718[_0x5565('0x17')][_0x5565('0x1b')]||null:null})[_0x5565('0xc')](function(_0x4e909b){logger[_0x5565('0x1e')](_0x5565('0x22'),_0x140718);logger[_0x5565('0x1f')](_0x5565('0x22'),_0x140718,JSON['stringify'](_0x4e909b));_0x215f59(_0x4e909b);})['catch'](function(_0x4c1254){logger[_0x5565('0x11')](_0x5565('0x22'),_0x4c1254['message'],_0x140718);_0x1a7399(_0x265e56[_0x5565('0x11')](0x1f4,_0x4c1254['message']));});});}; \ No newline at end of file +var _0x7b84=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','findAll','raw','options','where','attributes','limit','include','map','model','debug','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','lodash'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7b84,0x167));var _0x47b8=function(_0x19b51c,_0x144ad2){_0x19b51c=_0x19b51c-0x0;var _0xc199bd=_0x7b84[_0x19b51c];return _0xc199bd;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c35b,_0x81b22f,_0x1ae3b6){return new BPromise(function(_0x129a65,_0x6ad89){return client[_0x47b8('0xc')](_0x30c35b,_0x1ae3b6)[_0x47b8('0xd')](function(_0x46267c){logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,'request\x20sent');logger['debug'](_0x47b8('0x10'),_0x81b22f,_0x47b8('0x11'),JSON[_0x47b8('0x12')](_0x46267c));if(_0x46267c[_0x47b8('0x13')]){if(_0x46267c['error'][_0x47b8('0x14')]===0x1f4){logger[_0x47b8('0x13')]('MemberReport,\x20%s,\x20%s',_0x81b22f,_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);return _0x6ad89(_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);}logger[_0x47b8('0x13')]('MemberReport,\x20%s,\x20%s',_0x81b22f,_0x46267c['error'][_0x47b8('0x15')]);return _0x129a65(_0x46267c['error'][_0x47b8('0x15')]);}else{logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,_0x47b8('0x11'));_0x129a65(_0x46267c[_0x47b8('0x16')][_0x47b8('0x15')]);}})[_0x47b8('0x17')](function(_0x35bb3a){logger[_0x47b8('0x13')]('MemberReport,\x20%s,\x20%s',_0x81b22f,_0x35bb3a);_0x6ad89(_0x35bb3a);});});}exports[_0x47b8('0x18')]=function(_0x4c1c0b){var _0x310719=this;return new Promise(function(_0x3da863,_0x31e55c){return db['MemberReport'][_0x47b8('0x19')]({'raw':_0x4c1c0b['options']?_0x4c1c0b['options'][_0x47b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1c0b['options']?_0x4c1c0b[_0x47b8('0x1b')][_0x47b8('0x1c')]||null:null,'attributes':_0x4c1c0b[_0x47b8('0x1b')]?_0x4c1c0b[_0x47b8('0x1b')][_0x47b8('0x1d')]||null:null,'limit':_0x4c1c0b[_0x47b8('0x1b')]?_0x4c1c0b[_0x47b8('0x1b')][_0x47b8('0x1e')]||null:null,'include':_0x4c1c0b['options']?_0x4c1c0b[_0x47b8('0x1b')][_0x47b8('0x1f')]?_[_0x47b8('0x20')](_0x4c1c0b['options'][_0x47b8('0x1f')],function(_0x1f1dd3){return{'model':db[_0x1f1dd3[_0x47b8('0x21')]],'as':_0x1f1dd3['as'],'attributes':_0x1f1dd3['attributes'],'include':_0x1f1dd3[_0x47b8('0x1f')]?_['map'](_0x1f1dd3[_0x47b8('0x1f')],function(_0x511dbd){return{'model':db[_0x511dbd[_0x47b8('0x21')]],'as':_0x511dbd['as'],'attributes':_0x511dbd[_0x47b8('0x1d')],'include':_0x511dbd[_0x47b8('0x1f')]?_[_0x47b8('0x20')](_0x511dbd[_0x47b8('0x1f')],function(_0x1dcd63){return{'model':db[_0x1dcd63[_0x47b8('0x21')]],'as':_0x1dcd63['as'],'attributes':_0x1dcd63[_0x47b8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47b8('0xd')](function(_0x11132d){logger[_0x47b8('0xe')](_0x47b8('0x18'),_0x4c1c0b);logger[_0x47b8('0x22')](_0x47b8('0x18'),_0x4c1c0b,JSON['stringify'](_0x11132d));_0x3da863(_0x11132d);})['catch'](function(_0x23a317){logger[_0x47b8('0x13')](_0x47b8('0x18'),_0x23a317[_0x47b8('0x15')],_0x4c1c0b);_0x31e55c(_0x310719[_0x47b8('0x13')](0x1f4,_0x23a317['message']));});});};exports[_0x47b8('0x23')]=function(_0x2402c2){var _0x4edc09=this;return new Promise(function(_0x12f350,_0x7a04e1){return db[_0x47b8('0x24')]['create'](_0x2402c2[_0x47b8('0x25')],{'raw':_0x2402c2['options']?_0x2402c2[_0x47b8('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x47b8('0xd')](function(_0x404fc4){logger['info']('CreateMemberReport',_0x2402c2);logger[_0x47b8('0x22')]('CreateMemberReport',_0x2402c2,JSON[_0x47b8('0x12')](_0x404fc4));_0x12f350(_0x404fc4);})[_0x47b8('0x17')](function(_0xcd6500){logger[_0x47b8('0x13')](_0x47b8('0x23'),_0xcd6500[_0x47b8('0x15')],_0x2402c2);_0x7a04e1(_0x4edc09['error'](0x1f4,_0xcd6500[_0x47b8('0x15')]));});});};exports[_0x47b8('0x26')]=function(_0x3e98d4){var _0xb279b4=this;return new Promise(function(_0x11984f,_0x9b4856){return db[_0x47b8('0x24')][_0x47b8('0x27')](_0x3e98d4['body'],{'raw':_0x3e98d4[_0x47b8('0x1b')]?_0x3e98d4['options'][_0x47b8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e98d4[_0x47b8('0x1b')]?_0x3e98d4[_0x47b8('0x1b')][_0x47b8('0x1c')]||null:null,'attributes':_0x3e98d4[_0x47b8('0x1b')]?_0x3e98d4[_0x47b8('0x1b')][_0x47b8('0x1d')]||null:null,'limit':_0x3e98d4[_0x47b8('0x1b')]?_0x3e98d4[_0x47b8('0x1b')]['limit']||null:null})['then'](function(_0x791167){logger[_0x47b8('0xe')]('UpdateMemberReport',_0x3e98d4);logger[_0x47b8('0x22')](_0x47b8('0x26'),_0x3e98d4,JSON['stringify'](_0x791167));_0x11984f(_0x791167);})[_0x47b8('0x17')](function(_0x184801){logger[_0x47b8('0x13')](_0x47b8('0x26'),_0x184801[_0x47b8('0x15')],_0x3e98d4);_0x9b4856(_0xb279b4['error'](0x1f4,_0x184801['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 09979b8..bb3ea57 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 _0x86db=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x5d5661,_0x33773e){var _0x5dbd14=function(_0x2abe7a){while(--_0x2abe7a){_0x5d5661['push'](_0x5d5661['shift']());}};_0x5dbd14(++_0x33773e);}(_0x86db,0xf4));var _0xb86d=function(_0x27efcf,_0x320952){_0x27efcf=_0x27efcf-0x0;var _0xdb0237=_0x86db[_0x27efcf];return _0xdb0237;};'use strict';var multer=require(_0xb86d('0x0'));var util=require(_0xb86d('0x1'));var path=require('path');var timeout=require(_0xb86d('0x2'));var express=require(_0xb86d('0x3'));var router=express[_0xb86d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb86d('0x5'));var config=require(_0xb86d('0x6'));var controller=require(_0xb86d('0x7'));router['get']('/',controller['index']);module[_0xb86d('0x8')]=router; \ No newline at end of file +var _0x59ec=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4cc4e8,_0x12fda4){var _0x341919=function(_0x27e1c7){while(--_0x27e1c7){_0x4cc4e8['push'](_0x4cc4e8['shift']());}};_0x341919(++_0x12fda4);}(_0x59ec,0x102));var _0xc59e=function(_0x2a0a15,_0x5d016){_0x2a0a15=_0x2a0a15-0x0;var _0x3c7a3f=_0x59ec[_0x2a0a15];return _0x3c7a3f;};'use strict';var multer=require(_0xc59e('0x0'));var util=require(_0xc59e('0x1'));var path=require('path');var timeout=require(_0xc59e('0x2'));var express=require(_0xc59e('0x3'));var router=express['Router']();var fs_extra=require(_0xc59e('0x4'));var auth=require(_0xc59e('0x5'));var interaction=require(_0xc59e('0x6'));var config=require(_0xc59e('0x7'));var controller=require(_0xc59e('0x8'));router[_0xc59e('0x9')]('/',controller[_0xc59e('0xa')]);module[_0xc59e('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d506a4a..681983d 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 _0xe1ae=['exports','STRING'];(function(_0x5f298d,_0x589f94){var _0x93496c=function(_0x5a1408){while(--_0x5a1408){_0x5f298d['push'](_0x5f298d['shift']());}};_0x93496c(++_0x589f94);}(_0xe1ae,0x1a2));var _0xee1a=function(_0x3d6d80,_0x1689b7){_0x3d6d80=_0x3d6d80-0x0;var _0x30712a=_0xe1ae[_0x3d6d80];return _0x30712a;};'use strict';var Sequelize=require('sequelize');module[_0xee1a('0x0')]={'version':{'type':Sequelize[_0xee1a('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xa681=['exports','version'];(function(_0x271c01,_0x3af2d5){var _0x45fad3=function(_0x3e6d60){while(--_0x3e6d60){_0x271c01['push'](_0x271c01['shift']());}};_0x45fad3(++_0x3af2d5);}(_0xa681,0x1a0));var _0x1a68=function(_0x4a7a2c,_0x272de1){_0x4a7a2c=_0x4a7a2c-0x0;var _0x186654=_0xa681[_0x4a7a2c];return _0x186654;};'use strict';var Sequelize=require('sequelize');module[_0x1a68('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x1a68('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 72af737..5678bcb 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 _0x83bd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','Migration','includeAll','include','findAll','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query'];(function(_0x37abca,_0x11f1b5){var _0x253800=function(_0xa88e9f){while(--_0xa88e9f){_0x37abca['push'](_0x37abca['shift']());}};_0x253800(++_0x11f1b5);}(_0x83bd,0xed));var _0xd83b=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x83bd[_0x18cd5b];return _0x5eaa52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd83b('0x0'));var zipdir=require(_0xd83b('0x1'));var jsonpatch=require(_0xd83b('0x2'));var rp=require(_0xd83b('0x3'));var moment=require(_0xd83b('0x4'));var BPromise=require(_0xd83b('0x5'));var Mustache=require(_0xd83b('0x6'));var util=require('util');var path=require(_0xd83b('0x7'));var sox=require(_0xd83b('0x8'));var csv=require(_0xd83b('0x9'));var ejs=require(_0xd83b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd83b('0xb'));var squel=require(_0xd83b('0xc'));var crypto=require(_0xd83b('0xd'));var jsforce=require(_0xd83b('0xe'));var deskjs=require(_0xd83b('0xf'));var toCsv=require(_0xd83b('0x9'));var querystring=require(_0xd83b('0x10'));var Papa=require(_0xd83b('0x11'));var Redis=require(_0xd83b('0x12'));var authService=require(_0xd83b('0x13'));var qs=require(_0xd83b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd83b('0x15'));var logger=require('../../config/logger')(_0xd83b('0x16'));var utils=require('../../config/utils');var config=require(_0xd83b('0x17'));var licenseUtil=require(_0xd83b('0x18'));var db=require(_0xd83b('0x19'))['db'];function respondWithStatusCode(_0x1270b6,_0x370b95){_0x370b95=_0x370b95||0xcc;return function(_0x407069){if(_0x407069){return _0x1270b6['sendStatus'](_0x370b95);}return _0x1270b6[_0xd83b('0x1a')](_0x370b95)[_0xd83b('0x1b')]();};}function respondWithResult(_0x7b2d8c,_0x5aa2e3){_0x5aa2e3=_0x5aa2e3||0xc8;return function(_0x832ad7){if(_0x832ad7){return _0x7b2d8c[_0xd83b('0x1a')](_0x5aa2e3)[_0xd83b('0x1c')](_0x832ad7);}};}function respondWithFilteredResult(_0x187018,_0x232fc7){return function(_0x5e2ef3){if(_0x5e2ef3){var _0x5aca8c=typeof _0x232fc7[_0xd83b('0x1d')]==='undefined'&&typeof _0x232fc7[_0xd83b('0x1e')]===_0xd83b('0x1f');var _0x1ed760=_0x5e2ef3[_0xd83b('0x20')];var _0x28d7b5=_0x5aca8c?0x0:_0x232fc7['offset'];var _0x3d85d1=_0x5aca8c?_0x5e2ef3[_0xd83b('0x20')]:_0x232fc7[_0xd83b('0x1d')]+_0x232fc7[_0xd83b('0x1e')];var _0x470317;if(_0x3d85d1>=_0x1ed760){_0x3d85d1=_0x1ed760;_0x470317=0xc8;}else{_0x470317=0xce;}_0x187018[_0xd83b('0x1a')](_0x470317);return _0x187018[_0xd83b('0x21')](_0xd83b('0x22'),_0x28d7b5+'-'+_0x3d85d1+'/'+_0x1ed760)[_0xd83b('0x1c')](_0x5e2ef3);}return null;};}function patchUpdates(_0x33b0dc){return function(_0x926380){try{jsonpatch[_0xd83b('0x23')](_0x926380,_0x33b0dc,!![]);}catch(_0xb91b56){return BPromise[_0xd83b('0x24')](_0xb91b56);}return _0x926380[_0xd83b('0x25')]();};}function saveUpdates(_0x9a9dde,_0x21bcfd){return function(_0x369563){if(_0x369563){return _0x369563['update'](_0x9a9dde)[_0xd83b('0x26')](function(_0x1e0d66){return _0x1e0d66;});}return null;};}function removeEntity(_0x5d0619,_0x4747d4){return function(_0x358a4d){if(_0x358a4d){return _0x358a4d[_0xd83b('0x27')]()[_0xd83b('0x26')](function(){_0x5d0619[_0xd83b('0x1a')](0xcc)[_0xd83b('0x1b')]();});}};}function handleEntityNotFound(_0x13cb28,_0x5629e7){return function(_0x2b462b){if(!_0x2b462b){_0x13cb28[_0xd83b('0x28')](0x194);}return _0x2b462b;};}function handleError(_0x45cf56,_0x2e04e5){_0x2e04e5=_0x2e04e5||0x1f4;return function(_0xec00c2){logger[_0xd83b('0x29')](_0xec00c2[_0xd83b('0x2a')]);if(_0xec00c2[_0xd83b('0x2b')]){delete _0xec00c2[_0xd83b('0x2b')];}_0x45cf56['status'](_0x2e04e5)[_0xd83b('0x2c')](_0xec00c2);};}exports[_0xd83b('0x2d')]=function(_0x3639e1,_0x2394e2){var _0x38d6c3={},_0xcf3c78={},_0x56686c={'count':0x0,'rows':[]};var _0x8002bd=_[_0xd83b('0x2e')](db['Migration']['rawAttributes'],function(_0xd89065){return{'name':_0xd89065[_0xd83b('0x2f')],'type':_0xd89065['type'][_0xd83b('0x30')]};});_0xcf3c78[_0xd83b('0x31')]=_['map'](_0x8002bd,_0xd83b('0x2b'));_0xcf3c78[_0xd83b('0x32')]=_[_0xd83b('0x33')](_0x3639e1[_0xd83b('0x32')]);_0xcf3c78[_0xd83b('0x34')]=_[_0xd83b('0x35')](_0xcf3c78[_0xd83b('0x31')],_0xcf3c78[_0xd83b('0x32')]);_0x38d6c3[_0xd83b('0x36')]=_[_0xd83b('0x35')](_0xcf3c78[_0xd83b('0x31')],qs[_0xd83b('0x37')](_0x3639e1[_0xd83b('0x32')][_0xd83b('0x37')]));_0x38d6c3['attributes']=_0x38d6c3['attributes'][_0xd83b('0x38')]?_0x38d6c3[_0xd83b('0x36')]:_0xcf3c78[_0xd83b('0x31')];if(!_0x3639e1[_0xd83b('0x32')][_0xd83b('0x39')](_0xd83b('0x3a'))){_0x38d6c3[_0xd83b('0x1e')]=qs[_0xd83b('0x1e')](_0x3639e1[_0xd83b('0x32')][_0xd83b('0x1e')]);_0x38d6c3[_0xd83b('0x1d')]=qs[_0xd83b('0x1d')](_0x3639e1['query'][_0xd83b('0x1d')]);}_0x38d6c3[_0xd83b('0x3b')]=qs[_0xd83b('0x3c')](_0x3639e1[_0xd83b('0x32')]['sort']);_0x38d6c3['where']=qs['filters'](_['pick'](_0x3639e1[_0xd83b('0x32')],_0xcf3c78[_0xd83b('0x34')]),_0x8002bd);if(_0x3639e1[_0xd83b('0x32')][_0xd83b('0x3d')]){_0x38d6c3['where']=_[_0xd83b('0x3e')](_0x38d6c3[_0xd83b('0x3f')],{'$or':_['map'](_0x8002bd,function(_0x462ba5){if(_0x462ba5[_0xd83b('0x40')]!==_0xd83b('0x41')){var _0x44ca2a={};_0x44ca2a[_0x462ba5[_0xd83b('0x2b')]]={'$like':'%'+_0x3639e1[_0xd83b('0x32')]['filter']+'%'};return _0x44ca2a;}})});}_0x38d6c3=_[_0xd83b('0x3e')]({},_0x38d6c3,_0x3639e1[_0xd83b('0x42')]);var _0x1ed93e={'where':_0x38d6c3['where']};return db[_0xd83b('0x43')][_0xd83b('0x20')](_0x1ed93e)['then'](function(_0x269004){_0x56686c[_0xd83b('0x20')]=_0x269004;if(_0x3639e1['query'][_0xd83b('0x44')]){_0x38d6c3[_0xd83b('0x45')]=[{'all':!![]}];}return db['Migration'][_0xd83b('0x46')](_0x38d6c3);})['then'](function(_0x367632){_0x56686c['rows']=_0x367632;return _0x56686c;})[_0xd83b('0x26')](respondWithFilteredResult(_0x2394e2,_0x38d6c3))[_0xd83b('0x47')](handleError(_0x2394e2,null));}; \ No newline at end of file +var _0x3baa=['reject','save','update','then','error','name','send','index','Migration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','include','findAll','rows','catch','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply'];(function(_0x4642e6,_0x59ae62){var _0xa41f5f=function(_0x52aaad){while(--_0x52aaad){_0x4642e6['push'](_0x4642e6['shift']());}};_0xa41f5f(++_0x59ae62);}(_0x3baa,0x65));var _0xa3ba=function(_0x28d93a,_0x5ac50e){_0x28d93a=_0x28d93a-0x0;var _0x6a3f9f=_0x3baa[_0x28d93a];return _0x6a3f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa3ba('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3ba('0x1'));var moment=require(_0xa3ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa3ba('0x3'));var util=require('util');var path=require(_0xa3ba('0x4'));var sox=require(_0xa3ba('0x5'));var csv=require(_0xa3ba('0x6'));var ejs=require(_0xa3ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3ba('0x8'));var squel=require(_0xa3ba('0x9'));var crypto=require(_0xa3ba('0xa'));var jsforce=require(_0xa3ba('0xb'));var deskjs=require(_0xa3ba('0xc'));var toCsv=require(_0xa3ba('0x6'));var querystring=require(_0xa3ba('0xd'));var Papa=require(_0xa3ba('0xe'));var Redis=require(_0xa3ba('0xf'));var authService=require(_0xa3ba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa3ba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa3ba('0x12'));var utils=require(_0xa3ba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa3ba('0x14'));var db=require(_0xa3ba('0x15'))['db'];function respondWithStatusCode(_0x57c25c,_0x3c2159){_0x3c2159=_0x3c2159||0xcc;return function(_0x6b8ac3){if(_0x6b8ac3){return _0x57c25c[_0xa3ba('0x16')](_0x3c2159);}return _0x57c25c[_0xa3ba('0x17')](_0x3c2159)[_0xa3ba('0x18')]();};}function respondWithResult(_0x3bd59d,_0x212c47){_0x212c47=_0x212c47||0xc8;return function(_0x3091a8){if(_0x3091a8){return _0x3bd59d['status'](_0x212c47)[_0xa3ba('0x19')](_0x3091a8);}};}function respondWithFilteredResult(_0x472430,_0x50c7d5){return function(_0xeeadce){if(_0xeeadce){var _0x8223b9=typeof _0x50c7d5['offset']===_0xa3ba('0x1a')&&typeof _0x50c7d5[_0xa3ba('0x1b')]==='undefined';var _0x35b664=_0xeeadce[_0xa3ba('0x1c')];var _0x5a64e4=_0x8223b9?0x0:_0x50c7d5[_0xa3ba('0x1d')];var _0x3439d9=_0x8223b9?_0xeeadce[_0xa3ba('0x1c')]:_0x50c7d5[_0xa3ba('0x1d')]+_0x50c7d5['limit'];var _0x5df65e;if(_0x3439d9>=_0x35b664){_0x3439d9=_0x35b664;_0x5df65e=0xc8;}else{_0x5df65e=0xce;}_0x472430[_0xa3ba('0x17')](_0x5df65e);return _0x472430['set']('Content-Range',_0x5a64e4+'-'+_0x3439d9+'/'+_0x35b664)[_0xa3ba('0x19')](_0xeeadce);}return null;};}function patchUpdates(_0x39dd39){return function(_0x473259){try{jsonpatch[_0xa3ba('0x1e')](_0x473259,_0x39dd39,!![]);}catch(_0x1c801b){return BPromise[_0xa3ba('0x1f')](_0x1c801b);}return _0x473259[_0xa3ba('0x20')]();};}function saveUpdates(_0x1325eb,_0x2e91b9){return function(_0xa8232d){if(_0xa8232d){return _0xa8232d[_0xa3ba('0x21')](_0x1325eb)[_0xa3ba('0x22')](function(_0x137cd9){return _0x137cd9;});}return null;};}function removeEntity(_0x475817,_0x487904){return function(_0x3dc757){if(_0x3dc757){return _0x3dc757['destroy']()['then'](function(){_0x475817['status'](0xcc)[_0xa3ba('0x18')]();});}};}function handleEntityNotFound(_0xdb6cd3,_0x3a16c9){return function(_0x361007){if(!_0x361007){_0xdb6cd3[_0xa3ba('0x16')](0x194);}return _0x361007;};}function handleError(_0x2d6e1a,_0xfa9fc3){_0xfa9fc3=_0xfa9fc3||0x1f4;return function(_0x18c5d5){logger[_0xa3ba('0x23')](_0x18c5d5['stack']);if(_0x18c5d5[_0xa3ba('0x24')]){delete _0x18c5d5[_0xa3ba('0x24')];}_0x2d6e1a[_0xa3ba('0x17')](_0xfa9fc3)[_0xa3ba('0x25')](_0x18c5d5);};}exports[_0xa3ba('0x26')]=function(_0x209488,_0x142926){var _0x10483f={},_0x5ad709={},_0x1356ce={'count':0x0,'rows':[]};var _0x555d00=_['map'](db[_0xa3ba('0x27')][_0xa3ba('0x28')],function(_0x1d8890){return{'name':_0x1d8890[_0xa3ba('0x29')],'type':_0x1d8890[_0xa3ba('0x2a')]['key']};});_0x5ad709[_0xa3ba('0x2b')]=_['map'](_0x555d00,'name');_0x5ad709[_0xa3ba('0x2c')]=_[_0xa3ba('0x2d')](_0x209488[_0xa3ba('0x2c')]);_0x5ad709['filters']=_[_0xa3ba('0x2e')](_0x5ad709[_0xa3ba('0x2b')],_0x5ad709[_0xa3ba('0x2c')]);_0x10483f[_0xa3ba('0x2f')]=_[_0xa3ba('0x2e')](_0x5ad709[_0xa3ba('0x2b')],qs[_0xa3ba('0x30')](_0x209488[_0xa3ba('0x2c')]['fields']));_0x10483f[_0xa3ba('0x2f')]=_0x10483f[_0xa3ba('0x2f')][_0xa3ba('0x31')]?_0x10483f[_0xa3ba('0x2f')]:_0x5ad709['model'];if(!_0x209488[_0xa3ba('0x2c')][_0xa3ba('0x32')](_0xa3ba('0x33'))){_0x10483f[_0xa3ba('0x1b')]=qs['limit'](_0x209488[_0xa3ba('0x2c')]['limit']);_0x10483f[_0xa3ba('0x1d')]=qs[_0xa3ba('0x1d')](_0x209488['query'][_0xa3ba('0x1d')]);}_0x10483f[_0xa3ba('0x34')]=qs[_0xa3ba('0x35')](_0x209488[_0xa3ba('0x2c')][_0xa3ba('0x35')]);_0x10483f[_0xa3ba('0x36')]=qs[_0xa3ba('0x37')](_[_0xa3ba('0x38')](_0x209488[_0xa3ba('0x2c')],_0x5ad709[_0xa3ba('0x37')]),_0x555d00);if(_0x209488['query'][_0xa3ba('0x39')]){_0x10483f['where']=_['merge'](_0x10483f[_0xa3ba('0x36')],{'$or':_[_0xa3ba('0x3a')](_0x555d00,function(_0x11086e){if(_0x11086e[_0xa3ba('0x2a')]!==_0xa3ba('0x3b')){var _0x3ebacd={};_0x3ebacd[_0x11086e['name']]={'$like':'%'+_0x209488[_0xa3ba('0x2c')][_0xa3ba('0x39')]+'%'};return _0x3ebacd;}})});}_0x10483f=_[_0xa3ba('0x3c')]({},_0x10483f,_0x209488[_0xa3ba('0x3d')]);var _0x1e60ec={'where':_0x10483f['where']};return db[_0xa3ba('0x27')][_0xa3ba('0x1c')](_0x1e60ec)[_0xa3ba('0x22')](function(_0x31df38){_0x1356ce[_0xa3ba('0x1c')]=_0x31df38;if(_0x209488['query']['includeAll']){_0x10483f[_0xa3ba('0x3e')]=[{'all':!![]}];}return db[_0xa3ba('0x27')][_0xa3ba('0x3f')](_0x10483f);})[_0xa3ba('0x22')](function(_0x4f9b90){_0x1356ce[_0xa3ba('0x40')]=_0x4f9b90;return _0x1356ce;})[_0xa3ba('0x22')](respondWithFilteredResult(_0x142926,_0x10483f))[_0xa3ba('0x41')](handleError(_0x142926,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 46e4050..835f9de 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 _0x5510=['exports','migrations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0x5510,0x9c));var _0x0551=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x5510[_0x40015a];return _0x42f8a4;};'use strict';var _=require(_0x0551('0x0'));var util=require(_0x0551('0x1'));var logger=require(_0x0551('0x2'))(_0x0551('0x3'));var moment=require('moment');var BPromise=require(_0x0551('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0551('0x5'));var rimraf=require(_0x0551('0x6'));var config=require(_0x0551('0x7'));var attributes=require(_0x0551('0x8'));module[_0x0551('0x9')]=function(_0x5a379e,_0x5264da){return _0x5a379e['define']('Migration',attributes,{'tableName':_0x0551('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1acd=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5ec070,_0x59b5d5){var _0x1228ab=function(_0x3905d3){while(--_0x3905d3){_0x5ec070['push'](_0x5ec070['shift']());}};_0x1228ab(++_0x59b5d5);}(_0x1acd,0x1df));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd1ac('0x0'))('api');var moment=require(_0xd1ac('0x1'));var BPromise=require('bluebird');var rp=require(_0xd1ac('0x2'));var fs=require('fs');var path=require(_0xd1ac('0x3'));var rimraf=require(_0xd1ac('0x4'));var config=require(_0xd1ac('0x5'));var attributes=require(_0xd1ac('0x6'));module[_0xd1ac('0x7')]=function(_0x54e5b9,_0x459b4b){return _0x54e5b9[_0xd1ac('0x8')](_0xd1ac('0x9'),attributes,{'tableName':_0xd1ac('0xa'),'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 23cf562..5dab421 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 _0xb458=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4619f6,_0x47902d){var _0x2a0bc2=function(_0x427aa0){while(--_0x427aa0){_0x4619f6['push'](_0x4619f6['shift']());}};_0x2a0bc2(++_0x47902d);}(_0xb458,0xca));var _0x8b45=function(_0x1bcac2,_0x2f2084){_0x1bcac2=_0x1bcac2-0x0;var _0x3f813a=_0xb458[_0x1bcac2];return _0x3f813a;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('Migration,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});} \ No newline at end of file +var _0xb6b8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x2fe319,_0x5b32c9){var _0xaf1ab2=function(_0x24db69){while(--_0x24db69){_0x2fe319['push'](_0x2fe319['shift']());}};_0xaf1ab2(++_0x5b32c9);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x2b52ed,_0x1ecbd3){_0x2b52ed=_0x2b52ed-0x0;var _0x48784c=_0xb6b8[_0x2b52ed];return _0x48784c;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var moment=require(_0x8b6b('0x1'));var BPromise=require(_0x8b6b('0x2'));var rs=require(_0x8b6b('0x3'));var fs=require('fs');var Redis=require(_0x8b6b('0x4'));var db=require(_0x8b6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b6b('0x6'))(_0x8b6b('0x7'));var config=require(_0x8b6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56da2a,_0x21bbc2,_0x303c21){return new BPromise(function(_0x142239,_0x21c84e){return client[_0x8b6b('0xa')](_0x56da2a,_0x303c21)[_0x8b6b('0xb')](function(_0x1f2c39){logger[_0x8b6b('0xc')]('Migration,\x20%s,\x20%s',_0x21bbc2,'request\x20sent');logger['debug'](_0x8b6b('0xd'),_0x21bbc2,_0x8b6b('0xe'),JSON[_0x8b6b('0xf')](_0x1f2c39));if(_0x1f2c39['error']){if(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x11')]===0x1f4){logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x21c84e(_0x1f2c39[_0x8b6b('0x10')]['message']);}logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x142239(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x13')]);}else{logger[_0x8b6b('0xc')](_0x8b6b('0x12'),_0x21bbc2,'request\x20sent');_0x142239(_0x1f2c39[_0x8b6b('0x14')][_0x8b6b('0x13')]);}})[_0x8b6b('0x15')](function(_0x2d16c7){logger[_0x8b6b('0x10')](_0x8b6b('0x12'),_0x21bbc2,_0x2d16c7);_0x21c84e(_0x2d16c7);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 36efa3b..a60735c 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 _0xcde7=['connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','path'];(function(_0x1b6e5d,_0x52c24f){var _0x1251b=function(_0xe25a3b){while(--_0xe25a3b){_0x1b6e5d['push'](_0x1b6e5d['shift']());}};_0x1251b(++_0x52c24f);}(_0xcde7,0x65));var _0x7cde=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcde7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cde('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cde('0x4'));var controller=require(_0x7cde('0x5'));router[_0x7cde('0x6')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x8')]);router[_0x7cde('0x6')]('/:id',auth[_0x7cde('0x7')](),controller['show']);router[_0x7cde('0x9')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0xa')]);router[_0x7cde('0xb')]('/:id',auth[_0x7cde('0x7')](),controller[_0x7cde('0xc')]);router[_0x7cde('0xd')](_0x7cde('0xe'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xf')]);module[_0x7cde('0x10')]=router; \ No newline at end of file +var _0x29b6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','delete'];(function(_0x5e1530,_0x33a102){var _0x4f4958=function(_0x5de933){while(--_0x5de933){_0x5e1530['push'](_0x5e1530['shift']());}};_0x4f4958(++_0x33a102);}(_0x29b6,0x17e));var _0x629b=function(_0x2fe188,_0x447bf4){_0x2fe188=_0x2fe188-0x0;var _0x41ee01=_0x29b6[_0x2fe188];return _0x41ee01;};'use strict';var multer=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var path=require(_0x629b('0x2'));var timeout=require(_0x629b('0x3'));var express=require(_0x629b('0x4'));var router=express[_0x629b('0x5')]();var fs_extra=require(_0x629b('0x6'));var auth=require(_0x629b('0x7'));var interaction=require(_0x629b('0x8'));var config=require(_0x629b('0x9'));var controller=require('./network.controller');router[_0x629b('0xa')]('/',auth['isAuthenticated'](),controller[_0x629b('0xb')]);router[_0x629b('0xa')](_0x629b('0xc'),auth[_0x629b('0xd')](),controller['show']);router[_0x629b('0xe')]('/',auth[_0x629b('0xd')](),controller['create']);router[_0x629b('0xf')](_0x629b('0xc'),auth[_0x629b('0xd')](),controller[_0x629b('0x10')]);router[_0x629b('0x11')](_0x629b('0xc'),auth[_0x629b('0xd')](),controller[_0x629b('0x12')]);module[_0x629b('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 e2a4f86..de433c8 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 _0x4f94=['STRING','sequelize','exports','ENUM','localnet','externip','stun','turn'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x4f94,0x1a9));var _0x44f9=function(_0x10a185,_0x554999){_0x10a185=_0x10a185-0x0;var _0x17e4c7=_0x4f94[_0x10a185];return _0x17e4c7;};'use strict';var Sequelize=require(_0x44f9('0x0'));module[_0x44f9('0x1')]={'type':{'type':Sequelize[_0x44f9('0x2')](_0x44f9('0x3'),_0x44f9('0x4'),_0x44f9('0x5'),_0x44f9('0x6'))},'value':{'type':Sequelize[_0x44f9('0x7')]},'username':{'type':Sequelize[_0x44f9('0x7')]},'password':{'type':Sequelize[_0x44f9('0x7')]}}; \ No newline at end of file +var _0xbbeb=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0xbbeb,0x180));var _0xbbbe=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xbbeb[_0x228ac9];return _0x69fe02;};'use strict';var Sequelize=require(_0xbbbe('0x0'));module[_0xbbbe('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbbbe('0x2'),_0xbbbe('0x3'),_0xbbbe('0x4'),_0xbbbe('0x5'))},'value':{'type':Sequelize[_0xbbbe('0x6')]},'username':{'type':Sequelize[_0xbbbe('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7bed3d7..41b258c 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 _0x3175=['then','info','request\x20sent','debug','stringify','error','Network,\x20%s,\x20%s','message','result','catch','offset','undefined','limit','count','set','Content-Range','json','update','destroy','status','end','stack','name','send','index','map','Network','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','show','params','length','includeAll','include','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','Reload','find','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','http','request'];(function(_0x56d7c5,_0x531819){var _0x59cda1=function(_0x320d06){while(--_0x320d06){_0x56d7c5['push'](_0x56d7c5['shift']());}};_0x59cda1(++_0x531819);}(_0x3175,0x9e));var _0x5317=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x3175[_0x3f88bc];return _0x4df1c4;};'use strict';var util=require(_0x5317('0x0'));var path=require(_0x5317('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5317('0x2'));var qs=require(_0x5317('0x3'));var logger=require(_0x5317('0x4'))(_0x5317('0x5'));var config=require(_0x5317('0x6'));var db=require(_0x5317('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5317('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32e402,_0x1ec5f7,_0x259a0c,_0xcedf9c){return new Promise(function(_0x536175,_0x2dbcd3){var _0x382659=_0xcedf9c||client;return _0x382659[_0x5317('0x9')](_0x32e402,_0x259a0c)[_0x5317('0xa')](function(_0x4248df){logger[_0x5317('0xb')]('Network,\x20%s,\x20%s',_0x1ec5f7,_0x5317('0xc'));logger[_0x5317('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x1ec5f7,'request\x20sent',JSON[_0x5317('0xe')](_0x4248df));if(_0x4248df[_0x5317('0xf')]){if(_0x4248df[_0x5317('0xf')]['code']===0x1f4){logger[_0x5317('0xf')](_0x5317('0x10'),_0x1ec5f7,_0x4248df[_0x5317('0xf')][_0x5317('0x11')]);return _0x2dbcd3(_0x4248df['error'][_0x5317('0x11')]);}logger[_0x5317('0xf')]('Network,\x20%s,\x20%s',_0x1ec5f7,_0x4248df[_0x5317('0xf')][_0x5317('0x11')]);return _0x536175(_0x4248df[_0x5317('0xf')]['message']);}else{logger[_0x5317('0xb')](_0x5317('0x10'),_0x1ec5f7,_0x5317('0xc'));_0x536175(_0x4248df[_0x5317('0x12')][_0x5317('0x11')]);}})[_0x5317('0x13')](function(_0x40d9d8){logger[_0x5317('0xf')](_0x5317('0x10'),_0x1ec5f7,_0x40d9d8);_0x2dbcd3(_0x40d9d8);});});}function respondWithResult(_0xaf74fd,_0xbc0078){_0xbc0078=_0xbc0078||0xc8;return function(_0x1db69d){if(_0x1db69d){return _0xaf74fd['status'](_0xbc0078)['json'](_0x1db69d);}};}function respondWithFilteredResult(_0xb4deac,_0x546c45){return function(_0x2cca10){if(_0x2cca10){var _0x25786b=typeof _0x546c45[_0x5317('0x14')]===_0x5317('0x15')&&typeof _0x546c45[_0x5317('0x16')]==='undefined';var _0x4cc377=_0x2cca10[_0x5317('0x17')];var _0x5dde5a=_0x25786b?0x0:_0x546c45[_0x5317('0x14')];var _0x226f64=_0x25786b?_0x2cca10[_0x5317('0x17')]:_0x546c45[_0x5317('0x14')]+_0x546c45[_0x5317('0x16')];var _0xeb71ec;if(_0x226f64>=_0x4cc377){_0x226f64=_0x4cc377;_0xeb71ec=0xc8;}else{_0xeb71ec=0xce;}_0xb4deac['status'](_0xeb71ec);return _0xb4deac[_0x5317('0x18')](_0x5317('0x19'),_0x5dde5a+'-'+_0x226f64+'/'+_0x4cc377)[_0x5317('0x1a')](_0x2cca10);}return null;};}function saveUpdates(_0x5e0b9b){return function(_0x3b0006){if(_0x3b0006){return _0x3b0006[_0x5317('0x1b')](_0x5e0b9b)[_0x5317('0xa')](function(_0x537a4e){return _0x537a4e;});}return null;};}function removeEntity(_0x45d76d){return function(_0x5b8a77){if(_0x5b8a77){return _0x5b8a77[_0x5317('0x1c')]()[_0x5317('0xa')](function(){_0x45d76d[_0x5317('0x1d')](0xcc)[_0x5317('0x1e')]();});}};}function handleEntityNotFound(_0x424173){return function(_0xd3eafe){if(!_0xd3eafe){_0x424173['sendStatus'](0x194);}return _0xd3eafe;};}function handleError(_0x5b5ed6,_0x5bf988){_0x5bf988=_0x5bf988||0x1f4;return function(_0x47439e){logger[_0x5317('0xf')](_0x47439e[_0x5317('0x1f')]);if(_0x47439e[_0x5317('0x20')]){delete _0x47439e[_0x5317('0x20')];}_0x5b5ed6[_0x5317('0x1d')](_0x5bf988)[_0x5317('0x21')](_0x47439e);};}exports[_0x5317('0x22')]=function(_0x1a8d13,_0x446f55){var _0x2d4e32={},_0x50e4b6={},_0x12a689={'count':0x0,'rows':[]};var _0x5adcfa=_[_0x5317('0x23')](db[_0x5317('0x24')][_0x5317('0x25')],function(_0x6f45d2){return{'name':_0x6f45d2['fieldName'],'type':_0x6f45d2[_0x5317('0x26')][_0x5317('0x27')]};});_0x50e4b6['model']=_[_0x5317('0x23')](_0x5adcfa,_0x5317('0x20'));_0x50e4b6[_0x5317('0x28')]=_[_0x5317('0x29')](_0x1a8d13[_0x5317('0x28')]);_0x50e4b6['filters']=_[_0x5317('0x2a')](_0x50e4b6[_0x5317('0x2b')],_0x50e4b6[_0x5317('0x28')]);_0x2d4e32['attributes']=_[_0x5317('0x2a')](_0x50e4b6[_0x5317('0x2b')],qs[_0x5317('0x2c')](_0x1a8d13[_0x5317('0x28')][_0x5317('0x2c')]));_0x2d4e32[_0x5317('0x2d')]=_0x2d4e32[_0x5317('0x2d')]['length']?_0x2d4e32[_0x5317('0x2d')]:_0x50e4b6[_0x5317('0x2b')];if(!_0x1a8d13[_0x5317('0x28')]['hasOwnProperty']('nolimit')){_0x2d4e32[_0x5317('0x16')]=qs[_0x5317('0x16')](_0x1a8d13[_0x5317('0x28')][_0x5317('0x16')]);_0x2d4e32[_0x5317('0x14')]=qs[_0x5317('0x14')](_0x1a8d13['query'][_0x5317('0x14')]);}_0x2d4e32[_0x5317('0x2e')]=qs[_0x5317('0x2f')](_0x1a8d13[_0x5317('0x28')][_0x5317('0x2f')]);_0x2d4e32[_0x5317('0x30')]=qs[_0x5317('0x31')](_[_0x5317('0x32')](_0x1a8d13['query'],_0x50e4b6[_0x5317('0x31')]),_0x5adcfa);if(_0x1a8d13[_0x5317('0x28')]['filter']){_0x2d4e32[_0x5317('0x30')]=_[_0x5317('0x33')](_0x2d4e32[_0x5317('0x30')],{'$or':_[_0x5317('0x23')](_0x5adcfa,function(_0x994f8){if(_0x994f8[_0x5317('0x26')]!==_0x5317('0x34')){var _0x583dce={};_0x583dce[_0x994f8[_0x5317('0x20')]]={'$like':'%'+_0x1a8d13[_0x5317('0x28')][_0x5317('0x35')]+'%'};return _0x583dce;}})});}_0x2d4e32=_[_0x5317('0x33')]({},_0x2d4e32,_0x1a8d13[_0x5317('0x36')]);var _0x92ce18={'where':_0x2d4e32[_0x5317('0x30')]};return db[_0x5317('0x24')][_0x5317('0x17')](_0x92ce18)['then'](function(_0x37a40d){_0x12a689[_0x5317('0x17')]=_0x37a40d;if(_0x1a8d13[_0x5317('0x28')]['includeAll']){_0x2d4e32['include']=[{'all':!![]}];}return db[_0x5317('0x24')][_0x5317('0x37')](_0x2d4e32);})[_0x5317('0xa')](function(_0x5a9a8c){_0x12a689['rows']=_0x5a9a8c;return _0x12a689;})[_0x5317('0xa')](respondWithFilteredResult(_0x446f55,_0x2d4e32))[_0x5317('0x13')](handleError(_0x446f55,null));};exports[_0x5317('0x38')]=function(_0x219c99,_0x49b031){var _0x3be6ec={'raw':!![],'where':{'id':_0x219c99[_0x5317('0x39')]['id']}},_0x572c53={};_0x572c53[_0x5317('0x2b')]=_[_0x5317('0x29')](db[_0x5317('0x24')][_0x5317('0x25')]);_0x572c53[_0x5317('0x28')]=_[_0x5317('0x29')](_0x219c99[_0x5317('0x28')]);_0x572c53[_0x5317('0x31')]=_[_0x5317('0x2a')](_0x572c53[_0x5317('0x2b')],_0x572c53[_0x5317('0x28')]);_0x3be6ec['attributes']=_[_0x5317('0x2a')](_0x572c53['model'],qs[_0x5317('0x2c')](_0x219c99[_0x5317('0x28')][_0x5317('0x2c')]));_0x3be6ec[_0x5317('0x2d')]=_0x3be6ec[_0x5317('0x2d')][_0x5317('0x3a')]?_0x3be6ec[_0x5317('0x2d')]:_0x572c53[_0x5317('0x2b')];if(_0x219c99[_0x5317('0x28')][_0x5317('0x3b')]){_0x3be6ec[_0x5317('0x3c')]=[{'all':!![]}];}_0x3be6ec=_[_0x5317('0x33')]({},_0x3be6ec,_0x219c99[_0x5317('0x36')]);return db[_0x5317('0x24')]['find'](_0x3be6ec)[_0x5317('0xa')](handleEntityNotFound(_0x49b031,null))[_0x5317('0xa')](respondWithResult(_0x49b031,null))[_0x5317('0x13')](handleError(_0x49b031,null));};exports['create']=function(_0x1a4db6,_0x5ea1e3){var _0x37b28c;return db['Network'][_0x5317('0x3d')](_0x1a4db6[_0x5317('0x3e')],{'raw':!![]})[_0x5317('0xa')](function(_0x2c6ba7){_0x37b28c=_0x2c6ba7;return db[_0x5317('0x24')][_0x5317('0x37')]({'where':{'type':_0x1a4db6[_0x5317('0x3e')]['type']},'raw':!![]});})[_0x5317('0xa')](function(_0xfd7b83){if(_0x37b28c['type'][_0x5317('0x3f')]()==_0x5317('0x40')){var _0xff0eea=fs['readFileSync'](path[_0x5317('0x41')](config[_0x5317('0x42')],_0x5317('0x43')),_0x5317('0x44'));var _0x166ca2=ejs['render'](_0xff0eea,{'networks':_0xfd7b83||[]});fs[_0x5317('0x45')](_0x5317('0x46'),_0x166ca2);return respondWithRpcPromise('Reload','create',{'module':_0x5317('0x47')});}else if(_0x37b28c[_0x5317('0x26')][_0x5317('0x3f')]()==_0x5317('0x48')){var _0x1225df=fs[_0x5317('0x49')](path[_0x5317('0x41')](config[_0x5317('0x42')],_0x5317('0x4a')),_0x5317('0x44'));var _0x13f816=ejs[_0x5317('0x4b')](_0x1225df,{'networks':_0xfd7b83||[]});fs[_0x5317('0x45')](_0x5317('0x4c'),_0x13f816);return respondWithRpcPromise('Reload','create',{'module':_0x5317('0x47')});}else{var _0x3b8282=fs['readFileSync'](path[_0x5317('0x41')](config[_0x5317('0x42')],_0x5317('0x4d')),'utf8');var _0x141e22=ejs[_0x5317('0x4b')](_0x3b8282,{'networks':_0xfd7b83||[]});fs[_0x5317('0x45')](util[_0x5317('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x1a4db6['body']['type'][_0x5317('0x4f')]()),_0x141e22);return respondWithRpcPromise(_0x5317('0x50'),_0x5317('0x3d'),{'module':'chan_sip.so'});}})[_0x5317('0xa')](function(){return _0x37b28c;})['then'](respondWithResult(_0x5ea1e3,0xc9))['catch'](handleError(_0x5ea1e3,null));};exports[_0x5317('0x1b')]=function(_0x392afa,_0x1e88b6){var _0x19a356;return db[_0x5317('0x24')][_0x5317('0x51')]({'where':{'id':_0x392afa['params']['id']}})['then'](handleEntityNotFound(_0x1e88b6,null))[_0x5317('0xa')](saveUpdates(_0x392afa['body'],null))['then'](function(_0x2b919c){if(_0x2b919c){_0x19a356=_0x2b919c;return db[_0x5317('0x24')][_0x5317('0x37')]({'where':{'type':_0x19a356[_0x5317('0x26')]},'raw':!![]});}return null;})[_0x5317('0xa')](function(_0x47978e){if(_0x19a356[_0x5317('0x26')][_0x5317('0x3f')]()==_0x5317('0x40')){var _0x2da686=fs[_0x5317('0x49')](path[_0x5317('0x41')](config[_0x5317('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x33235a=ejs['render'](_0x2da686,{'networks':_0x47978e||[]});fs[_0x5317('0x45')](_0x5317('0x46'),_0x33235a);return respondWithRpcPromise(_0x5317('0x50'),_0x5317('0x1b'),{'module':_0x5317('0x47')});}else if(_0x19a356[_0x5317('0x26')]['toUpperCase']()=='TURN'){var _0xc5aa43=fs[_0x5317('0x49')](path[_0x5317('0x41')](config[_0x5317('0x42')],_0x5317('0x4a')),'utf8');var _0x2adc75=ejs[_0x5317('0x4b')](_0xc5aa43,{'networks':_0x47978e||[]});fs['writeFileSync'](_0x5317('0x4c'),_0x2adc75);return respondWithRpcPromise(_0x5317('0x50'),'update',{'module':_0x5317('0x47')});}else{var _0x4d0961=fs[_0x5317('0x49')](path['join'](config[_0x5317('0x42')],'server/files/templates/network.ejs'),_0x5317('0x44'));var _0x27924b=ejs['render'](_0x4d0961,{'networks':_0x47978e||[]});fs[_0x5317('0x45')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x392afa[_0x5317('0x3e')]['type'][_0x5317('0x4f')]()),_0x27924b);return respondWithRpcPromise(_0x5317('0x50'),_0x5317('0x1b'),{'module':_0x5317('0x52')});}})[_0x5317('0xa')](function(_0x327aab){if(_0x327aab){return _0x19a356;}return null;})[_0x5317('0xa')](respondWithResult(_0x1e88b6,null))['catch'](handleError(_0x1e88b6,null));};exports[_0x5317('0x1c')]=function(_0x30169e,_0x521d3b){var _0x3f6691;return db[_0x5317('0x24')][_0x5317('0x51')]({'where':{'id':_0x30169e[_0x5317('0x39')]['id']}})[_0x5317('0xa')](function(_0x1b397a){_0x3f6691=_0x1b397a;return _0x1b397a;})['then'](handleEntityNotFound(_0x521d3b,null))[_0x5317('0xa')](removeEntity(_0x521d3b,null))[_0x5317('0xa')](function(){if(_0x3f6691){return db[_0x5317('0x24')]['findAll']({'where':{'type':_0x3f6691['type']},'raw':!![]});}})[_0x5317('0xa')](function(_0x5ce473){if(_0x3f6691[_0x5317('0x26')][_0x5317('0x3f')]()==_0x5317('0x40')){var _0x1c659d=fs['readFileSync'](path['join'](config['root'],_0x5317('0x43')),_0x5317('0x44'));var _0x1ff7ce=ejs['render'](_0x1c659d,{'networks':_0x5ce473||[]});fs[_0x5317('0x45')](_0x5317('0x46'),_0x1ff7ce);return respondWithRpcPromise('Reload',_0x5317('0x1c'),{'module':_0x5317('0x47')});}else if(_0x3f6691[_0x5317('0x26')][_0x5317('0x3f')]()==_0x5317('0x48')){var _0x1dd825=fs['readFileSync'](path['join'](config['root'],_0x5317('0x4a')),_0x5317('0x44'));var _0x3074e7=ejs['render'](_0x1dd825,{'networks':_0x5ce473||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x3074e7);return respondWithRpcPromise('Reload',_0x5317('0x1c'),{'module':_0x5317('0x47')});}else{var _0x3481c5=fs[_0x5317('0x49')](path['join'](config['root'],_0x5317('0x4d')),_0x5317('0x44'));var _0x41f9d7=ejs[_0x5317('0x4b')](_0x3481c5,{'networks':_0x5ce473||[]});fs[_0x5317('0x45')](util[_0x5317('0x4e')](_0x5317('0x53'),_0x3f6691[_0x5317('0x26')][_0x5317('0x4f')]()),_0x41f9d7);return respondWithRpcPromise(_0x5317('0x50'),_0x5317('0x1c'),{'module':_0x5317('0x52')});}})[_0x5317('0x13')](handleError(_0x521d3b,null));}; \ No newline at end of file +var _0xcee7=['catch','status','json','undefined','offset','count','limit','set','update','destroy','sendStatus','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','show','params','fields','find','create','findAll','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','writeFileSync','join','server/files/templates/network.ejs','render','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/stun_xcally.conf','TURN','toLowerCase','format','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2041bd,_0x1d2e49){var _0x2d9c17=function(_0x4a1a04){while(--_0x4a1a04){_0x2041bd['push'](_0x2041bd['shift']());}};_0x2d9c17(++_0x1d2e49);}(_0xcee7,0xeb));var _0x7cee=function(_0x11cf11,_0x6f67cb){_0x11cf11=_0x11cf11-0x0;var _0x1a62ad=_0xcee7[_0x11cf11];return _0x1a62ad;};'use strict';var util=require(_0x7cee('0x0'));var path=require(_0x7cee('0x1'));var ejs=require(_0x7cee('0x2'));var fs=require('fs');var _=require(_0x7cee('0x3'));var qs=require(_0x7cee('0x4'));var logger=require(_0x7cee('0x5'))(_0x7cee('0x6'));var config=require(_0x7cee('0x7'));var db=require(_0x7cee('0x8'))['db'];var jayson=require(_0x7cee('0x9'));var client=jayson[_0x7cee('0xa')][_0x7cee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af3bb,_0x9e5eb0,_0x154f77,_0x44f04b){return new Promise(function(_0x5014e1,_0x25b81f){var _0x21b34e=_0x44f04b||client;return _0x21b34e[_0x7cee('0xc')](_0x1af3bb,_0x154f77)[_0x7cee('0xd')](function(_0x32b66b){logger[_0x7cee('0xe')](_0x7cee('0xf'),_0x9e5eb0,_0x7cee('0x10'));logger['debug'](_0x7cee('0x11'),_0x9e5eb0,_0x7cee('0x10'),JSON[_0x7cee('0x12')](_0x32b66b));if(_0x32b66b[_0x7cee('0x13')]){if(_0x32b66b['error'][_0x7cee('0x14')]===0x1f4){logger[_0x7cee('0x13')](_0x7cee('0xf'),_0x9e5eb0,_0x32b66b[_0x7cee('0x13')][_0x7cee('0x15')]);return _0x25b81f(_0x32b66b[_0x7cee('0x13')][_0x7cee('0x15')]);}logger['error'](_0x7cee('0xf'),_0x9e5eb0,_0x32b66b[_0x7cee('0x13')]['message']);return _0x5014e1(_0x32b66b[_0x7cee('0x13')]['message']);}else{logger['info'](_0x7cee('0xf'),_0x9e5eb0,_0x7cee('0x10'));_0x5014e1(_0x32b66b[_0x7cee('0x16')]['message']);}})[_0x7cee('0x17')](function(_0x27ea2d){logger['error']('Network,\x20%s,\x20%s',_0x9e5eb0,_0x27ea2d);_0x25b81f(_0x27ea2d);});});}function respondWithResult(_0x2023d5,_0x3be176){_0x3be176=_0x3be176||0xc8;return function(_0x187391){if(_0x187391){return _0x2023d5[_0x7cee('0x18')](_0x3be176)[_0x7cee('0x19')](_0x187391);}};}function respondWithFilteredResult(_0x195796,_0x5e7288){return function(_0x29bbbe){if(_0x29bbbe){var _0x413af3=typeof _0x5e7288['offset']==='undefined'&&typeof _0x5e7288['limit']===_0x7cee('0x1a');var _0x1a95bb=_0x29bbbe['count'];var _0x15ec0e=_0x413af3?0x0:_0x5e7288[_0x7cee('0x1b')];var _0x24d789=_0x413af3?_0x29bbbe[_0x7cee('0x1c')]:_0x5e7288[_0x7cee('0x1b')]+_0x5e7288[_0x7cee('0x1d')];var _0x37a42e;if(_0x24d789>=_0x1a95bb){_0x24d789=_0x1a95bb;_0x37a42e=0xc8;}else{_0x37a42e=0xce;}_0x195796['status'](_0x37a42e);return _0x195796[_0x7cee('0x1e')]('Content-Range',_0x15ec0e+'-'+_0x24d789+'/'+_0x1a95bb)[_0x7cee('0x19')](_0x29bbbe);}return null;};}function saveUpdates(_0x34a835){return function(_0x1452d2){if(_0x1452d2){return _0x1452d2[_0x7cee('0x1f')](_0x34a835)[_0x7cee('0xd')](function(_0x2792e7){return _0x2792e7;});}return null;};}function removeEntity(_0x5dfe78){return function(_0x280996){if(_0x280996){return _0x280996[_0x7cee('0x20')]()['then'](function(){_0x5dfe78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x451d89){return function(_0x43975a){if(!_0x43975a){_0x451d89[_0x7cee('0x21')](0x194);}return _0x43975a;};}function handleError(_0x276144,_0x313722){_0x313722=_0x313722||0x1f4;return function(_0x18ca28){logger[_0x7cee('0x13')](_0x18ca28['stack']);if(_0x18ca28[_0x7cee('0x22')]){delete _0x18ca28[_0x7cee('0x22')];}_0x276144['status'](_0x313722)[_0x7cee('0x23')](_0x18ca28);};}exports[_0x7cee('0x24')]=function(_0x4533c2,_0x1c7ff6){var _0x15ea88={},_0x46abda={},_0x258ae5={'count':0x0,'rows':[]};var _0x5601c3=_[_0x7cee('0x25')](db[_0x7cee('0x26')][_0x7cee('0x27')],function(_0x1fe92a){return{'name':_0x1fe92a['fieldName'],'type':_0x1fe92a[_0x7cee('0x28')][_0x7cee('0x29')]};});_0x46abda[_0x7cee('0x2a')]=_[_0x7cee('0x25')](_0x5601c3,_0x7cee('0x22'));_0x46abda[_0x7cee('0x2b')]=_[_0x7cee('0x2c')](_0x4533c2[_0x7cee('0x2b')]);_0x46abda[_0x7cee('0x2d')]=_[_0x7cee('0x2e')](_0x46abda[_0x7cee('0x2a')],_0x46abda[_0x7cee('0x2b')]);_0x15ea88[_0x7cee('0x2f')]=_[_0x7cee('0x2e')](_0x46abda[_0x7cee('0x2a')],qs['fields'](_0x4533c2[_0x7cee('0x2b')]['fields']));_0x15ea88['attributes']=_0x15ea88[_0x7cee('0x2f')][_0x7cee('0x30')]?_0x15ea88[_0x7cee('0x2f')]:_0x46abda['model'];if(!_0x4533c2['query'][_0x7cee('0x31')](_0x7cee('0x32'))){_0x15ea88[_0x7cee('0x1d')]=qs[_0x7cee('0x1d')](_0x4533c2['query'][_0x7cee('0x1d')]);_0x15ea88[_0x7cee('0x1b')]=qs[_0x7cee('0x1b')](_0x4533c2['query']['offset']);}_0x15ea88[_0x7cee('0x33')]=qs[_0x7cee('0x34')](_0x4533c2[_0x7cee('0x2b')][_0x7cee('0x34')]);_0x15ea88['where']=qs[_0x7cee('0x2d')](_['pick'](_0x4533c2[_0x7cee('0x2b')],_0x46abda['filters']),_0x5601c3);if(_0x4533c2[_0x7cee('0x2b')][_0x7cee('0x35')]){_0x15ea88[_0x7cee('0x36')]=_[_0x7cee('0x37')](_0x15ea88[_0x7cee('0x36')],{'$or':_[_0x7cee('0x25')](_0x5601c3,function(_0x555dbc){if(_0x555dbc[_0x7cee('0x28')]!=='VIRTUAL'){var _0x1a1283={};_0x1a1283[_0x555dbc[_0x7cee('0x22')]]={'$like':'%'+_0x4533c2[_0x7cee('0x2b')]['filter']+'%'};return _0x1a1283;}})});}_0x15ea88=_[_0x7cee('0x37')]({},_0x15ea88,_0x4533c2[_0x7cee('0x38')]);var _0x59c284={'where':_0x15ea88[_0x7cee('0x36')]};return db[_0x7cee('0x26')]['count'](_0x59c284)[_0x7cee('0xd')](function(_0x521fe8){_0x258ae5[_0x7cee('0x1c')]=_0x521fe8;if(_0x4533c2[_0x7cee('0x2b')][_0x7cee('0x39')]){_0x15ea88[_0x7cee('0x3a')]=[{'all':!![]}];}return db[_0x7cee('0x26')]['findAll'](_0x15ea88);})[_0x7cee('0xd')](function(_0x444f15){_0x258ae5[_0x7cee('0x3b')]=_0x444f15;return _0x258ae5;})[_0x7cee('0xd')](respondWithFilteredResult(_0x1c7ff6,_0x15ea88))['catch'](handleError(_0x1c7ff6,null));};exports[_0x7cee('0x3c')]=function(_0x1a3f73,_0x42d575){var _0x176d86={'raw':!![],'where':{'id':_0x1a3f73[_0x7cee('0x3d')]['id']}},_0x554bdd={};_0x554bdd[_0x7cee('0x2a')]=_[_0x7cee('0x2c')](db['Network'][_0x7cee('0x27')]);_0x554bdd[_0x7cee('0x2b')]=_['keys'](_0x1a3f73[_0x7cee('0x2b')]);_0x554bdd[_0x7cee('0x2d')]=_[_0x7cee('0x2e')](_0x554bdd[_0x7cee('0x2a')],_0x554bdd[_0x7cee('0x2b')]);_0x176d86[_0x7cee('0x2f')]=_[_0x7cee('0x2e')](_0x554bdd[_0x7cee('0x2a')],qs[_0x7cee('0x3e')](_0x1a3f73[_0x7cee('0x2b')][_0x7cee('0x3e')]));_0x176d86['attributes']=_0x176d86[_0x7cee('0x2f')]['length']?_0x176d86[_0x7cee('0x2f')]:_0x554bdd[_0x7cee('0x2a')];if(_0x1a3f73[_0x7cee('0x2b')][_0x7cee('0x39')]){_0x176d86['include']=[{'all':!![]}];}_0x176d86=_[_0x7cee('0x37')]({},_0x176d86,_0x1a3f73[_0x7cee('0x38')]);return db[_0x7cee('0x26')][_0x7cee('0x3f')](_0x176d86)[_0x7cee('0xd')](handleEntityNotFound(_0x42d575,null))[_0x7cee('0xd')](respondWithResult(_0x42d575,null))[_0x7cee('0x17')](handleError(_0x42d575,null));};exports[_0x7cee('0x40')]=function(_0x27a9ef,_0x581cae){var _0x5b30ae;return db[_0x7cee('0x26')][_0x7cee('0x40')](_0x27a9ef['body'],{'raw':!![]})[_0x7cee('0xd')](function(_0x4e99e5){_0x5b30ae=_0x4e99e5;return db[_0x7cee('0x26')][_0x7cee('0x41')]({'where':{'type':_0x27a9ef[_0x7cee('0x42')][_0x7cee('0x28')]},'raw':!![]});})[_0x7cee('0xd')](function(_0xa16959){if(_0x5b30ae[_0x7cee('0x28')][_0x7cee('0x43')]()==_0x7cee('0x44')){var _0x58132a=fs[_0x7cee('0x45')](path['join'](config['root'],_0x7cee('0x46')),_0x7cee('0x47'));var _0x4e0789=ejs['render'](_0x58132a,{'networks':_0xa16959||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4e0789);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x40'),{'module':_0x7cee('0x49')});}else if(_0x5b30ae['type']['toUpperCase']()=='TURN'){var _0x37c353=fs['readFileSync'](path['join'](config[_0x7cee('0x4a')],_0x7cee('0x4b')),_0x7cee('0x47'));var _0x528f68=ejs['render'](_0x37c353,{'networks':_0xa16959||[]});fs[_0x7cee('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x528f68);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x40'),{'module':'res_stun_monitor.so'});}else{var _0x2b7f43=fs[_0x7cee('0x45')](path[_0x7cee('0x4d')](config[_0x7cee('0x4a')],_0x7cee('0x4e')),_0x7cee('0x47'));var _0x3520de=ejs[_0x7cee('0x4f')](_0x2b7f43,{'networks':_0xa16959||[]});fs['writeFileSync'](util['format'](_0x7cee('0x50'),_0x27a9ef[_0x7cee('0x42')][_0x7cee('0x28')]['toLowerCase']()),_0x3520de);return respondWithRpcPromise('Reload','create',{'module':_0x7cee('0x51')});}})['then'](function(){return _0x5b30ae;})[_0x7cee('0xd')](respondWithResult(_0x581cae,0xc9))[_0x7cee('0x17')](handleError(_0x581cae,null));};exports['update']=function(_0x3c4ab5,_0x485f68){var _0x3a521c;return db[_0x7cee('0x26')][_0x7cee('0x3f')]({'where':{'id':_0x3c4ab5['params']['id']}})[_0x7cee('0xd')](handleEntityNotFound(_0x485f68,null))[_0x7cee('0xd')](saveUpdates(_0x3c4ab5[_0x7cee('0x42')],null))['then'](function(_0x51691b){if(_0x51691b){_0x3a521c=_0x51691b;return db[_0x7cee('0x26')]['findAll']({'where':{'type':_0x3a521c['type']},'raw':!![]});}return null;})[_0x7cee('0xd')](function(_0xd24845){if(_0x3a521c['type'][_0x7cee('0x43')]()=='STUN'){var _0x350cc6=fs['readFileSync'](path[_0x7cee('0x4d')](config[_0x7cee('0x4a')],_0x7cee('0x46')),_0x7cee('0x47'));var _0x2742dc=ejs[_0x7cee('0x4f')](_0x350cc6,{'networks':_0xd24845||[]});fs[_0x7cee('0x4c')](_0x7cee('0x52'),_0x2742dc);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x1f'),{'module':_0x7cee('0x49')});}else if(_0x3a521c[_0x7cee('0x28')]['toUpperCase']()==_0x7cee('0x53')){var _0x176faa=fs[_0x7cee('0x45')](path[_0x7cee('0x4d')](config[_0x7cee('0x4a')],_0x7cee('0x4b')),_0x7cee('0x47'));var _0x2cf94d=ejs[_0x7cee('0x4f')](_0x176faa,{'networks':_0xd24845||[]});fs[_0x7cee('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x2cf94d);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x1f'),{'module':_0x7cee('0x49')});}else{var _0x27a9d9=fs[_0x7cee('0x45')](path[_0x7cee('0x4d')](config[_0x7cee('0x4a')],'server/files/templates/network.ejs'),'utf8');var _0xc1616c=ejs[_0x7cee('0x4f')](_0x27a9d9,{'networks':_0xd24845||[]});fs[_0x7cee('0x4c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3c4ab5[_0x7cee('0x42')]['type'][_0x7cee('0x54')]()),_0xc1616c);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x1f'),{'module':_0x7cee('0x51')});}})[_0x7cee('0xd')](function(_0x6a6a97){if(_0x6a6a97){return _0x3a521c;}return null;})[_0x7cee('0xd')](respondWithResult(_0x485f68,null))[_0x7cee('0x17')](handleError(_0x485f68,null));};exports[_0x7cee('0x20')]=function(_0x4df75d,_0x2cace6){var _0x2a19dd;return db[_0x7cee('0x26')]['find']({'where':{'id':_0x4df75d[_0x7cee('0x3d')]['id']}})[_0x7cee('0xd')](function(_0x25be52){_0x2a19dd=_0x25be52;return _0x25be52;})[_0x7cee('0xd')](handleEntityNotFound(_0x2cace6,null))[_0x7cee('0xd')](removeEntity(_0x2cace6,null))[_0x7cee('0xd')](function(){if(_0x2a19dd){return db['Network']['findAll']({'where':{'type':_0x2a19dd['type']},'raw':!![]});}})[_0x7cee('0xd')](function(_0x105ca7){if(_0x2a19dd[_0x7cee('0x28')][_0x7cee('0x43')]()=='STUN'){var _0x4a41dc=fs[_0x7cee('0x45')](path['join'](config[_0x7cee('0x4a')],_0x7cee('0x46')),_0x7cee('0x47'));var _0x38410c=ejs[_0x7cee('0x4f')](_0x4a41dc,{'networks':_0x105ca7||[]});fs[_0x7cee('0x4c')]('/etc/asterisk/stun_xcally.conf',_0x38410c);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x20'),{'module':_0x7cee('0x49')});}else if(_0x2a19dd[_0x7cee('0x28')][_0x7cee('0x43')]()==_0x7cee('0x53')){var _0x561030=fs['readFileSync'](path[_0x7cee('0x4d')](config['root'],_0x7cee('0x4b')),'utf8');var _0x1431c7=ejs[_0x7cee('0x4f')](_0x561030,{'networks':_0x105ca7||[]});fs[_0x7cee('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x1431c7);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x2cb09e=fs['readFileSync'](path[_0x7cee('0x4d')](config[_0x7cee('0x4a')],_0x7cee('0x4e')),'utf8');var _0x225851=ejs[_0x7cee('0x4f')](_0x2cb09e,{'networks':_0x105ca7||[]});fs[_0x7cee('0x4c')](util[_0x7cee('0x55')](_0x7cee('0x50'),_0x2a19dd[_0x7cee('0x28')]['toLowerCase']()),_0x225851);return respondWithRpcPromise(_0x7cee('0x48'),_0x7cee('0x20'),{'module':_0x7cee('0x51')});}})['catch'](handleError(_0x2cace6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cb227fd..b645a2b 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 _0xaf93=['bluebird','path','rimraf','../../config/environment','./network.attributes','exports','Network','lodash','util','moment'];(function(_0x1d002d,_0x909245){var _0xefc4e9=function(_0x515c4d){while(--_0x515c4d){_0x1d002d['push'](_0x1d002d['shift']());}};_0xefc4e9(++_0x909245);}(_0xaf93,0x151));var _0x3af9=function(_0x3550d4,_0xa10bca){_0x3550d4=_0x3550d4-0x0;var _0x1c8ba1=_0xaf93[_0x3550d4];return _0x1c8ba1;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3af9('0x4'));var rimraf=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var attributes=require(_0x3af9('0x7'));module[_0x3af9('0x8')]=function(_0x1ad446,_0x333abb){return _0x1ad446['define'](_0x3af9('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d2=['api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger'];(function(_0x5c7c31,_0x22aa86){var _0x193fdf=function(_0x271ade){while(--_0x271ade){_0x5c7c31['push'](_0x5c7c31['shift']());}};_0x193fdf(++_0x22aa86);}(_0x16d2,0x123));var _0x216d=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x16d2[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var moment=require(_0x216d('0x4'));var BPromise=require(_0x216d('0x5'));var rp=require(_0x216d('0x6'));var fs=require('fs');var path=require(_0x216d('0x7'));var rimraf=require(_0x216d('0x8'));var config=require('../../config/environment');var attributes=require(_0x216d('0x9'));module[_0x216d('0xa')]=function(_0xef687c,_0x205101){return _0xef687c[_0x216d('0xb')](_0x216d('0xc'),attributes,{'tableName':_0x216d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 890bf94..7a02d56 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1902bc,_0x254d36){_0x1902bc=_0x1902bc-0x0;var _0x42b8df=_0x7a54[_0x1902bc];return _0x42b8df;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a7951,_0x1ccaab){var _0x3d95b7=function(_0x238565){while(--_0x238565){_0x2a7951['push'](_0x2a7951['shift']());}};_0x3d95b7(++_0x1ccaab);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2fcfebf..07c4cc4 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 _0x3d7a=['getAgents','post','create','notify','addApplications','send','put','update','delete','/:id','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/users'];(function(_0x3d42cc,_0x20c1d5){var _0x43780c=function(_0x22b70e){while(--_0x22b70e){_0x3d42cc['push'](_0x3d42cc['shift']());}};_0x43780c(++_0x20c1d5);}(_0x3d7a,0x11e));var _0xa3d7=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x3d7a[_0x366388];return _0x41c97e;};'use strict';var multer=require(_0xa3d7('0x0'));var util=require('util');var path=require(_0xa3d7('0x1'));var timeout=require(_0xa3d7('0x2'));var express=require('express');var router=express[_0xa3d7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3d7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa3d7('0x5'));var controller=require(_0xa3d7('0x6'));router[_0xa3d7('0x7')]('/',auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x9')]);router['get'](_0xa3d7('0xa'),auth['isAuthenticated'](),controller[_0xa3d7('0xb')]);router[_0xa3d7('0x7')]('/:id',auth[_0xa3d7('0x8')](),controller[_0xa3d7('0xc')]);router[_0xa3d7('0x7')](_0xa3d7('0xd'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0xe')]);router[_0xa3d7('0x7')](_0xa3d7('0xf'),auth[_0xa3d7('0x8')](),controller['getAnswers']);router[_0xa3d7('0x7')](_0xa3d7('0x10'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x11')]);router[_0xa3d7('0x7')](_0xa3d7('0x12'),auth[_0xa3d7('0x8')](),controller['getInteractions']);router['get'](_0xa3d7('0x13'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x14')]);router[_0xa3d7('0x15')]('/',auth['isAuthenticated'](),controller[_0xa3d7('0x16')]);router[_0xa3d7('0x15')](_0xa3d7('0xd'),auth[_0xa3d7('0x8')](),controller['addDisposition']);router[_0xa3d7('0x15')](_0xa3d7('0xf'),auth[_0xa3d7('0x8')](),controller['addAnswer']);router[_0xa3d7('0x15')]('/:id/notify',controller[_0xa3d7('0x17')]);router['post'](_0xa3d7('0x10'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x18')]);router[_0xa3d7('0x15')]('/:id/users',auth[_0xa3d7('0x8')](),controller['addAgents']);router[_0xa3d7('0x15')]('/:id/send',auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x19')]);router[_0xa3d7('0x1a')]('/:id',auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x1b')]);router[_0xa3d7('0x1c')](_0xa3d7('0x1d'),auth[_0xa3d7('0x8')](),controller['destroy']);router[_0xa3d7('0x1c')](_0xa3d7('0xd'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x1e')]);router[_0xa3d7('0x1c')](_0xa3d7('0xf'),auth['isAuthenticated'](),controller[_0xa3d7('0x1f')]);router[_0xa3d7('0x1c')](_0xa3d7('0x13'),auth[_0xa3d7('0x8')](),controller[_0xa3d7('0x20')]);module[_0xa3d7('0x21')]=router; \ No newline at end of file +var _0xbc85=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','destroy','delete','removeAnswers','removeAgents'];(function(_0x472513,_0x1462e8){var _0x2308c6=function(_0x5e1839){while(--_0x5e1839){_0x472513['push'](_0x472513['shift']());}};_0x2308c6(++_0x1462e8);}(_0xbc85,0x139));var _0x5bc8=function(_0x4df5d3,_0x522c48){_0x4df5d3=_0x4df5d3-0x0;var _0x34a8d=_0xbc85[_0x4df5d3];return _0x34a8d;};'use strict';var multer=require(_0x5bc8('0x0'));var util=require(_0x5bc8('0x1'));var path=require(_0x5bc8('0x2'));var timeout=require(_0x5bc8('0x3'));var express=require(_0x5bc8('0x4'));var router=express[_0x5bc8('0x5')]();var fs_extra=require(_0x5bc8('0x6'));var auth=require(_0x5bc8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5bc8('0x8'));var controller=require(_0x5bc8('0x9'));router[_0x5bc8('0xa')]('/',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0xc')]);router[_0x5bc8('0xa')](_0x5bc8('0xd'),auth[_0x5bc8('0xb')](),controller[_0x5bc8('0xe')]);router['get']('/:id',auth[_0x5bc8('0xb')](),controller['show']);router[_0x5bc8('0xa')]('/:id/dispositions',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0xf')]);router[_0x5bc8('0xa')](_0x5bc8('0x10'),auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x11')]);router[_0x5bc8('0xa')](_0x5bc8('0x12'),auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x13')]);router[_0x5bc8('0xa')]('/:id/interactions',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x14')]);router[_0x5bc8('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x5bc8('0x15')]);router['post']('/',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x16')]);router[_0x5bc8('0x17')](_0x5bc8('0x18'),auth[_0x5bc8('0xb')](),controller['addDisposition']);router[_0x5bc8('0x17')]('/:id/canned_answers',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x19')]);router['post'](_0x5bc8('0x1a'),controller['notify']);router[_0x5bc8('0x17')](_0x5bc8('0x12'),auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x1b')]);router[_0x5bc8('0x17')](_0x5bc8('0x1c'),auth['isAuthenticated'](),controller[_0x5bc8('0x1d')]);router[_0x5bc8('0x17')](_0x5bc8('0x1e'),auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x1f')]);router[_0x5bc8('0x20')](_0x5bc8('0x21'),auth[_0x5bc8('0xb')](),controller['update']);router['delete']('/:id',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x22')]);router[_0x5bc8('0x23')](_0x5bc8('0x18'),auth[_0x5bc8('0xb')](),controller['removeDispositions']);router[_0x5bc8('0x23')](_0x5bc8('0x10'),auth['isAuthenticated'](),controller[_0x5bc8('0x24')]);router[_0x5bc8('0x23')]('/:id/users',auth[_0x5bc8('0xb')](),controller[_0x5bc8('0x25')]);module[_0x5bc8('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b364702..a9c5842 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 _0xd322=['exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0xd322,0x125));var _0x2d32=function(_0x201ece,_0x31c91e){_0x201ece=_0x201ece-0x0;var _0x5724ae=_0xd322[_0x201ece];return _0x5724ae;};'use strict';var Sequelize=require(_0x2d32('0x0'));var rs=require('randomstring');module[_0x2d32('0x1')]={'name':{'type':Sequelize[_0x2d32('0x2')],'unique':_0x2d32('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2d32('0x2')],'defaultValue':function(){return rs[_0x2d32('0x4')]();}},'replyUri':{'type':Sequelize[_0x2d32('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2d32('0x5')],'defaultValue':function(){return _0x2d32('0x6');}},'notificationSound':{'type':Sequelize[_0x2d32('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d32('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d32('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2d32('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2d32('0x2')]},'queueTransfer':{'type':Sequelize[_0x2d32('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d32('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d32('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d32('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2d32('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2d32('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2d32('0xa'),'set':function(_0x4227aa){if(!_0x4227aa)this[_0x2d32('0xb')](_0x2d32('0xc'),null);this[_0x2d32('0xb')](_0x2d32('0xd'),_0x4227aa);}}}; \ No newline at end of file +var _0xa57a=['mandatoryDisposition','randomstring','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1a2bb0,_0x58328f){var _0x230353=function(_0x2b94d3){while(--_0x2b94d3){_0x1a2bb0['push'](_0x1a2bb0['shift']());}};_0x230353(++_0x58328f);}(_0xa57a,0x90));var _0xaa57=function(_0x5d9341,_0x1104d3){_0x5d9341=_0x5d9341-0x0;var _0x175e6b=_0xa57a[_0x5d9341];return _0x175e6b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xaa57('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa57('0x1')],'unique':_0xaa57('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xaa57('0x1')]},'token':{'type':Sequelize[_0xaa57('0x1')],'defaultValue':function(){return rs[_0xaa57('0x3')]();}},'replyUri':{'type':Sequelize[_0xaa57('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaa57('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaa57('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xaa57('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaa57('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa57('0x1')]},'queueTransfer':{'type':Sequelize[_0xaa57('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa57('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa57('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa57('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xaa57('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xaa57('0x5')],'defaultValue':![],'comment':_0xaa57('0x8'),'set':function(_0x107cfb){if(!_0x107cfb)this[_0xaa57('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xaa57('0xa'),_0x107cfb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a37a065..94dc23d 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 _0xb1aa=['save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','fields','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition','create','getDispositions','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','Contacts','firstName','threadId','OpenchannelInteraction','externalUrl','contact','lastName','messageId','created','interaction','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','color','tag','addAgents','ids','omit','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','reject'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xb1aa,0x159));var _0xab1a=function(_0x2eeb4b,_0x3585ad){_0x2eeb4b=_0x2eeb4b-0x0;var _0x245dff=_0xb1aa[_0x2eeb4b];return _0x245dff;};'use strict';var emlformat=require(_0xab1a('0x0'));var rimraf=require(_0xab1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab1a('0x2'));var rp=require('request-promise');var moment=require(_0xab1a('0x3'));var BPromise=require(_0xab1a('0x4'));var Mustache=require(_0xab1a('0x5'));var util=require(_0xab1a('0x6'));var path=require(_0xab1a('0x7'));var sox=require(_0xab1a('0x8'));var csv=require(_0xab1a('0x9'));var ejs=require(_0xab1a('0xa'));var fs=require('fs');var fs_extra=require(_0xab1a('0xb'));var _=require(_0xab1a('0xc'));var squel=require('squel');var crypto=require(_0xab1a('0xd'));var jsforce=require(_0xab1a('0xe'));var deskjs=require(_0xab1a('0xf'));var toCsv=require(_0xab1a('0x9'));var querystring=require(_0xab1a('0x10'));var Papa=require(_0xab1a('0x11'));var Redis=require(_0xab1a('0x12'));var authService=require(_0xab1a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xab1a('0x14'));var hardwareService=require(_0xab1a('0x15'));var logger=require(_0xab1a('0x16'))(_0xab1a('0x17'));var utils=require(_0xab1a('0x18'));var config=require(_0xab1a('0x19'));var licenseUtil=require(_0xab1a('0x1a'));var db=require(_0xab1a('0x1b'))['db'];config[_0xab1a('0x1c')]=_[_0xab1a('0x1d')](config[_0xab1a('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xab1a('0x1e'))(new Redis(config['redis']));require(_0xab1a('0x1f'))[_0xab1a('0x20')](socket);var jayson=require(_0xab1a('0x21'));var client=jayson[_0xab1a('0x22')][_0xab1a('0x23')]({'port':0x232c});var client9002=jayson[_0xab1a('0x22')][_0xab1a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x318dd7,_0x1329d9,_0x661aa8,_0x468d20){return new BPromise(function(_0x4b5fe6,_0x22b910){var _0x23fb1f=_0x468d20||client;return _0x23fb1f[_0xab1a('0x24')](_0x318dd7,_0x661aa8)[_0xab1a('0x25')](function(_0x24a612){logger[_0xab1a('0x26')](_0xab1a('0x27'),_0x1329d9,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1329d9,'request\x20sent',JSON[_0xab1a('0x28')](_0x24a612));if(_0x24a612[_0xab1a('0x29')]){if(_0x24a612[_0xab1a('0x29')][_0xab1a('0x2a')]===0x1f4){logger[_0xab1a('0x29')](_0xab1a('0x27'),_0x1329d9,_0x24a612[_0xab1a('0x29')]['message']);return _0x22b910(_0x24a612[_0xab1a('0x29')][_0xab1a('0x2b')]);}logger[_0xab1a('0x29')](_0xab1a('0x27'),_0x1329d9,_0x24a612[_0xab1a('0x29')]['message']);return _0x4b5fe6(_0x24a612[_0xab1a('0x29')][_0xab1a('0x2b')]);}else{logger[_0xab1a('0x26')](_0xab1a('0x27'),_0x1329d9,_0xab1a('0x2c'));_0x4b5fe6(_0x24a612[_0xab1a('0x2d')]['message']);}})[_0xab1a('0x2e')](function(_0x41d4e6){logger[_0xab1a('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x1329d9,_0x41d4e6);_0x22b910(_0x41d4e6);});});}function respondWithStatusCode(_0x5c7a37,_0x10c4a8){_0x10c4a8=_0x10c4a8||0xcc;return function(_0x62e6bb){if(_0x62e6bb){return _0x5c7a37[_0xab1a('0x2f')](_0x10c4a8);}return _0x5c7a37['status'](_0x10c4a8)[_0xab1a('0x30')]();};}function respondWithResult(_0x35ae5f,_0x140483){_0x140483=_0x140483||0xc8;return function(_0x473720){if(_0x473720){return _0x35ae5f[_0xab1a('0x31')](_0x140483)[_0xab1a('0x32')](_0x473720);}};}function respondWithFilteredResult(_0x1853c8,_0x411707){return function(_0x122b94){if(_0x122b94){var _0x2fba42=typeof _0x411707[_0xab1a('0x33')]===_0xab1a('0x34')&&typeof _0x411707[_0xab1a('0x35')]===_0xab1a('0x34');var _0x49ce09=_0x122b94[_0xab1a('0x36')];var _0x13d163=_0x2fba42?0x0:_0x411707['offset'];var _0x110650=_0x2fba42?_0x122b94[_0xab1a('0x36')]:_0x411707[_0xab1a('0x33')]+_0x411707[_0xab1a('0x35')];var _0x3ffded;if(_0x110650>=_0x49ce09){_0x110650=_0x49ce09;_0x3ffded=0xc8;}else{_0x3ffded=0xce;}_0x1853c8[_0xab1a('0x31')](_0x3ffded);return _0x1853c8[_0xab1a('0x37')]('Content-Range',_0x13d163+'-'+_0x110650+'/'+_0x49ce09)[_0xab1a('0x32')](_0x122b94);}return null;};}function patchUpdates(_0x571141){return function(_0x207194){try{jsonpatch['apply'](_0x207194,_0x571141,!![]);}catch(_0xfa2eaa){return BPromise[_0xab1a('0x38')](_0xfa2eaa);}return _0x207194[_0xab1a('0x39')]();};}function saveUpdates(_0x2e8afd,_0x1b5523){return function(_0x1fcff6){if(_0x1fcff6){return _0x1fcff6['update'](_0x2e8afd)[_0xab1a('0x25')](function(_0x1d1fc4){return _0x1d1fc4;});}return null;};}function removeEntity(_0x410683,_0x30f1c2){return function(_0x2c5064){if(_0x2c5064){return _0x2c5064['destroy']()['then'](function(){var _0x1ce017=_0x2c5064[_0xab1a('0x3a')]({'plain':!![]});var _0x12a47a=_0xab1a('0x3b');return db[_0xab1a('0x3c')][_0xab1a('0x3d')]({'where':{'type':_0x12a47a,'resourceId':_0x1ce017['id']}})['then'](function(){return _0x2c5064;});})[_0xab1a('0x25')](function(){_0x410683[_0xab1a('0x31')](0xcc)[_0xab1a('0x30')]();});}};}function handleEntityNotFound(_0x824456,_0x29cf35){return function(_0x405dc3){if(!_0x405dc3){_0x824456[_0xab1a('0x2f')](0x194);}return _0x405dc3;};}function handleError(_0x452d81,_0x4f5dc7){_0x4f5dc7=_0x4f5dc7||0x1f4;return function(_0xed30c9){logger[_0xab1a('0x29')](_0xed30c9[_0xab1a('0x3e')]);if(_0xed30c9[_0xab1a('0x3f')]){delete _0xed30c9[_0xab1a('0x3f')];}_0x452d81[_0xab1a('0x31')](_0x4f5dc7)[_0xab1a('0x40')](_0xed30c9);};}exports[_0xab1a('0x41')]=function(_0x31e9b6,_0x1a0128){var _0x139e4e={'include':[{'model':db[_0xab1a('0x42')],'as':_0xab1a('0x43')}]},_0x3e9244={},_0x5e1ab4={'count':0x0,'rows':[]};var _0x37e946=_[_0xab1a('0x44')](db[_0xab1a('0x45')][_0xab1a('0x46')],function(_0x5784c3){return{'name':_0x5784c3['fieldName'],'type':_0x5784c3['type'][_0xab1a('0x47')]};});_0x3e9244['model']=_['map'](_0x37e946,'name');_0x3e9244[_0xab1a('0x48')]=_[_0xab1a('0x49')](_0x31e9b6['query']);_0x3e9244[_0xab1a('0x4a')]=_[_0xab1a('0x4b')](_0x3e9244[_0xab1a('0x4c')],_0x3e9244[_0xab1a('0x48')]);_0x139e4e[_0xab1a('0x4d')]=_['intersection'](_0x3e9244[_0xab1a('0x4c')],qs['fields'](_0x31e9b6[_0xab1a('0x48')]['fields']));_0x139e4e[_0xab1a('0x4d')]=_0x139e4e[_0xab1a('0x4d')][_0xab1a('0x4e')]?_0x139e4e[_0xab1a('0x4d')]:_0x3e9244['model'];if(!_0x31e9b6['query']['hasOwnProperty'](_0xab1a('0x4f'))){_0x139e4e[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0x31e9b6['query'][_0xab1a('0x35')]);_0x139e4e[_0xab1a('0x33')]=qs[_0xab1a('0x33')](_0x31e9b6[_0xab1a('0x48')][_0xab1a('0x33')]);}_0x139e4e[_0xab1a('0x50')]=qs[_0xab1a('0x51')](_0x31e9b6[_0xab1a('0x48')][_0xab1a('0x51')]);_0x139e4e[_0xab1a('0x52')]=qs['filters'](_[_0xab1a('0x53')](_0x31e9b6['query'],_0x3e9244[_0xab1a('0x4a')]),_0x37e946);if(_0x31e9b6[_0xab1a('0x48')][_0xab1a('0x54')]){_0x139e4e[_0xab1a('0x52')]=_['merge'](_0x139e4e[_0xab1a('0x52')],{'$or':_[_0xab1a('0x44')](_0x37e946,function(_0x1e594c){if(_0x1e594c[_0xab1a('0x55')]!==_0xab1a('0x56')){var _0x1a3255={};_0x1a3255[_0x1e594c[_0xab1a('0x3f')]]={'$like':'%'+_0x31e9b6['query']['filter']+'%'};return _0x1a3255;}})});}_0x139e4e=_[_0xab1a('0x57')]({},_0x139e4e,_0x31e9b6[_0xab1a('0x58')]);var _0x264657={'where':_0x139e4e[_0xab1a('0x52')]};return db[_0xab1a('0x45')][_0xab1a('0x36')](_0x264657)[_0xab1a('0x25')](function(_0x4444ef){_0x5e1ab4[_0xab1a('0x36')]=_0x4444ef;if(_0x31e9b6[_0xab1a('0x48')][_0xab1a('0x59')]){_0x139e4e[_0xab1a('0x5a')]=[{'all':!![]}];}return db[_0xab1a('0x45')][_0xab1a('0x5b')](_0x139e4e);})['then'](function(_0x885884){_0x5e1ab4[_0xab1a('0x5c')]=_0x885884;return _0x5e1ab4;})[_0xab1a('0x25')](respondWithFilteredResult(_0x1a0128,_0x139e4e))[_0xab1a('0x2e')](handleError(_0x1a0128,null));};exports[_0xab1a('0x5d')]=function(_0x549f49,_0x58c869){var _0x3e18ba={'raw':![],'where':{'id':_0x549f49[_0xab1a('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0xab1a('0x43')}]},_0x7496e2={};_0x7496e2[_0xab1a('0x4c')]=_[_0xab1a('0x49')](db['OpenchannelAccount'][_0xab1a('0x46')]);_0x7496e2[_0xab1a('0x48')]=_['keys'](_0x549f49[_0xab1a('0x48')]);_0x7496e2[_0xab1a('0x4a')]=_['intersection'](_0x7496e2[_0xab1a('0x4c')],_0x7496e2['query']);_0x3e18ba[_0xab1a('0x4d')]=_[_0xab1a('0x4b')](_0x7496e2['model'],qs[_0xab1a('0x5f')](_0x549f49[_0xab1a('0x48')]['fields']));_0x3e18ba[_0xab1a('0x4d')]=_0x3e18ba['attributes'][_0xab1a('0x4e')]?_0x3e18ba[_0xab1a('0x4d')]:_0x7496e2[_0xab1a('0x4c')];if(_0x549f49[_0xab1a('0x48')][_0xab1a('0x59')]){_0x3e18ba[_0xab1a('0x5a')]=[{'all':!![]}];}_0x3e18ba=_[_0xab1a('0x57')]({},_0x3e18ba,_0x549f49[_0xab1a('0x58')]);return db['OpenchannelAccount']['find'](_0x3e18ba)[_0xab1a('0x25')](handleEntityNotFound(_0x58c869,null))[_0xab1a('0x25')](respondWithResult(_0x58c869,null))[_0xab1a('0x2e')](handleError(_0x58c869,null));};exports['create']=function(_0x281d6e,_0x4483bb){return db[_0xab1a('0x45')]['create'](_0x281d6e['body'],{})['then'](function(_0x34d796){var _0xcef056=_0x281d6e[_0xab1a('0x60')]['get']({'plain':!![]});if(!_0xcef056)throw new Error(_0xab1a('0x61'));if(_0xcef056[_0xab1a('0x62')]===_0xab1a('0x60')){var _0xd6cb53=_0x34d796[_0xab1a('0x3a')]({'plain':!![]});var _0x3e94ae='OpenchannelAccounts';return db[_0xab1a('0x63')][_0xab1a('0x64')]({'where':{'name':_0x3e94ae,'userProfileId':_0xcef056[_0xab1a('0x65')]},'raw':!![]})[_0xab1a('0x25')](function(_0x1adeff){if(_0x1adeff&&_0x1adeff[_0xab1a('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0xd6cb53[_0xab1a('0x3f')],'resourceId':_0xd6cb53['id'],'type':_0x1adeff[_0xab1a('0x3f')],'sectionId':_0x1adeff['id']},{})[_0xab1a('0x25')](function(){return _0x34d796;});}else{return _0x34d796;}})['catch'](function(_0x3eae02){logger[_0xab1a('0x29')](_0xab1a('0x67'),_0x3eae02);throw _0x3eae02;});}return _0x34d796;})[_0xab1a('0x25')](respondWithResult(_0x4483bb,0xc9))['catch'](handleError(_0x4483bb,null));};exports[_0xab1a('0x68')]=function(_0x3a1d1c,_0x2be743){if(_0x3a1d1c[_0xab1a('0x69')]['id']){delete _0x3a1d1c[_0xab1a('0x69')]['id'];}return db['OpenchannelAccount'][_0xab1a('0x64')]({'where':{'id':_0x3a1d1c[_0xab1a('0x5e')]['id']},'include':[{'model':db[_0xab1a('0x42')],'as':_0xab1a('0x43')}]})['then'](handleEntityNotFound(_0x2be743,null))['then'](saveUpdates(_0x3a1d1c['body'],null))[_0xab1a('0x25')](respondWithResult(_0x2be743,null))[_0xab1a('0x2e')](handleError(_0x2be743,null));};exports[_0xab1a('0x3d')]=function(_0x11f3bf,_0x11e2da){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x11f3bf['params']['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x11e2da,null))[_0xab1a('0x25')](removeEntity(_0x11e2da,null))[_0xab1a('0x2e')](handleError(_0x11e2da,null));};exports[_0xab1a('0x6a')]=function(_0xaa15fd,_0x33ee01){return db['OpenchannelAccount'][_0xab1a('0x6a')]()[_0xab1a('0x25')](respondWithResult(_0x33ee01,null))[_0xab1a('0x2e')](handleError(_0x33ee01,null));};exports[_0xab1a('0x6b')]=function(_0x552d0c,_0x56276d,_0x133bb5){if(_0x552d0c[_0xab1a('0x69')]['id']){delete _0x552d0c[_0xab1a('0x69')]['id'];}return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x552d0c[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x56276d,null))[_0xab1a('0x25')](function(_0x5ee9d3){if(_0x5ee9d3){_0x552d0c[_0xab1a('0x69')][_0xab1a('0x6c')]=_0x5ee9d3['id'];return db[_0xab1a('0x6d')][_0xab1a('0x6e')](_0x552d0c['body']);}})[_0xab1a('0x25')](respondWithResult(_0x56276d,null))[_0xab1a('0x2e')](handleError(_0x56276d,null));};exports[_0xab1a('0x6f')]=function(_0x2eeeba,_0x1e8f14,_0x4c302d){var _0x16be31={'raw':![],'where':{}};var _0x1a8431={};var _0x348c83={'count':0x0,'rows':[]};return db[_0xab1a('0x45')]['findOne']({'where':{'id':_0x2eeeba[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x1e8f14,null))[_0xab1a('0x25')](function(_0x2e777c){if(_0x2e777c){_0x1a8431[_0xab1a('0x4c')]=_[_0xab1a('0x49')](db['Disposition']['rawAttributes']);_0x1a8431[_0xab1a('0x48')]=_[_0xab1a('0x49')](_0x2eeeba['query']);_0x1a8431[_0xab1a('0x4a')]=_[_0xab1a('0x4b')](_0x1a8431[_0xab1a('0x4c')],_0x1a8431[_0xab1a('0x48')]);_0x16be31['attributes']=_['intersection'](_0x1a8431[_0xab1a('0x4c')],qs[_0xab1a('0x5f')](_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x5f')]));_0x16be31[_0xab1a('0x4d')]=_0x16be31['attributes']['length']?_0x16be31[_0xab1a('0x4d')]:_0x1a8431[_0xab1a('0x4c')];if(!_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x70')]('nolimit')){_0x16be31[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x35')]);_0x16be31[_0xab1a('0x33')]=qs[_0xab1a('0x33')](_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x33')]);}_0x16be31[_0xab1a('0x50')]=qs['sort'](_0x2eeeba[_0xab1a('0x48')]['sort']);_0x16be31['where']=qs[_0xab1a('0x4a')](_[_0xab1a('0x53')](_0x2eeeba[_0xab1a('0x48')],_0x1a8431[_0xab1a('0x4a')]));_0x16be31[_0xab1a('0x52')][_0xab1a('0x6c')]=_0x2e777c['id'];if(_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x54')]){_0x16be31[_0xab1a('0x52')]=_[_0xab1a('0x57')](_0x16be31[_0xab1a('0x52')],{'$or':_[_0xab1a('0x44')](_0x16be31[_0xab1a('0x4d')],function(_0x32b5f5){var _0x601b1b={};_0x601b1b[_0x32b5f5]={'$like':'%'+_0x2eeeba['query'][_0xab1a('0x54')]+'%'};return _0x601b1b;})});}_0x16be31=_[_0xab1a('0x57')]({},_0x16be31,_0x2eeeba['options']);return db[_0xab1a('0x6d')][_0xab1a('0x36')]({'where':_0x16be31[_0xab1a('0x52')]})[_0xab1a('0x25')](function(_0x50c06e){_0x348c83['count']=_0x50c06e;if(_0x2eeeba[_0xab1a('0x48')][_0xab1a('0x59')]){_0x16be31['include']=[{'all':!![]}];}return db[_0xab1a('0x6d')]['findAll'](_0x16be31);})[_0xab1a('0x25')](function(_0x19cb48){_0x348c83[_0xab1a('0x5c')]=_0x19cb48;return _0x348c83;});}})[_0xab1a('0x25')](respondWithFilteredResult(_0x1e8f14,_0x16be31))[_0xab1a('0x2e')](handleError(_0x1e8f14,null));};exports['removeDispositions']=function(_0x2a92e3,_0x1613f4,_0x343cb0){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x2a92e3[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x1613f4,null))[_0xab1a('0x25')](function(_0x121ae1){if(_0x121ae1){return _0x121ae1[_0xab1a('0x71')](_0x2a92e3[_0xab1a('0x48')]['ids']);}})[_0xab1a('0x25')](respondWithStatusCode(_0x1613f4,null))[_0xab1a('0x2e')](handleError(_0x1613f4,null));};exports[_0xab1a('0x72')]=function(_0x3e94f2,_0x416426,_0x3763f3){if(_0x3e94f2[_0xab1a('0x69')]['id']){delete _0x3e94f2['body']['id'];}return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x3e94f2['params']['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x416426,null))['then'](function(_0x3a43b6){if(_0x3a43b6){_0x3e94f2[_0xab1a('0x69')][_0xab1a('0x6c')]=_0x3a43b6['id'];return db[_0xab1a('0x73')][_0xab1a('0x6e')](_0x3e94f2[_0xab1a('0x69')]);}})['then'](respondWithResult(_0x416426,null))['catch'](handleError(_0x416426,null));};exports[_0xab1a('0x74')]=function(_0xa6fd69,_0x59658a,_0x314927){var _0x10c4cc={'raw':![],'where':{}};var _0x2e7900={};var _0x1a1f29={'count':0x0,'rows':[]};return db[_0xab1a('0x45')][_0xab1a('0x75')]({'where':{'id':_0xa6fd69[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x59658a,null))[_0xab1a('0x25')](function(_0xa06972){if(_0xa06972){_0x2e7900[_0xab1a('0x4c')]=_[_0xab1a('0x49')](db['CannedAnswer'][_0xab1a('0x46')]);_0x2e7900['query']=_[_0xab1a('0x49')](_0xa6fd69[_0xab1a('0x48')]);_0x2e7900[_0xab1a('0x4a')]=_[_0xab1a('0x4b')](_0x2e7900[_0xab1a('0x4c')],_0x2e7900[_0xab1a('0x48')]);_0x10c4cc['attributes']=_['intersection'](_0x2e7900[_0xab1a('0x4c')],qs[_0xab1a('0x5f')](_0xa6fd69[_0xab1a('0x48')][_0xab1a('0x5f')]));_0x10c4cc['attributes']=_0x10c4cc[_0xab1a('0x4d')][_0xab1a('0x4e')]?_0x10c4cc[_0xab1a('0x4d')]:_0x2e7900[_0xab1a('0x4c')];if(!_0xa6fd69[_0xab1a('0x48')][_0xab1a('0x70')](_0xab1a('0x4f'))){_0x10c4cc[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0xa6fd69[_0xab1a('0x48')][_0xab1a('0x35')]);_0x10c4cc[_0xab1a('0x33')]=qs['offset'](_0xa6fd69['query'][_0xab1a('0x33')]);}_0x10c4cc[_0xab1a('0x50')]=qs[_0xab1a('0x51')](_0xa6fd69[_0xab1a('0x48')][_0xab1a('0x51')]);_0x10c4cc[_0xab1a('0x52')]=qs['filters'](_['pick'](_0xa6fd69[_0xab1a('0x48')],_0x2e7900[_0xab1a('0x4a')]));_0x10c4cc[_0xab1a('0x52')][_0xab1a('0x6c')]=_0xa06972['id'];if(_0xa6fd69['query']['filter']){_0x10c4cc[_0xab1a('0x52')]=_['merge'](_0x10c4cc[_0xab1a('0x52')],{'$or':_[_0xab1a('0x44')](_0x10c4cc[_0xab1a('0x4d')],function(_0x5a372a){var _0x5f02f5={};_0x5f02f5[_0x5a372a]={'$like':'%'+_0xa6fd69['query'][_0xab1a('0x54')]+'%'};return _0x5f02f5;})});}_0x10c4cc=_[_0xab1a('0x57')]({},_0x10c4cc,_0xa6fd69[_0xab1a('0x58')]);return db[_0xab1a('0x73')]['count']({'where':_0x10c4cc[_0xab1a('0x52')]})['then'](function(_0x1f0b1e){_0x1a1f29[_0xab1a('0x36')]=_0x1f0b1e;if(_0xa6fd69[_0xab1a('0x48')][_0xab1a('0x59')]){_0x10c4cc[_0xab1a('0x5a')]=[{'all':!![]}];}return db[_0xab1a('0x73')]['findAll'](_0x10c4cc);})['then'](function(_0x2dbd44){_0x1a1f29['rows']=_0x2dbd44;return _0x1a1f29;});}})[_0xab1a('0x25')](respondWithFilteredResult(_0x59658a,_0x10c4cc))[_0xab1a('0x2e')](handleError(_0x59658a,null));};exports['removeAnswers']=function(_0x4b45d2,_0x313b99,_0x29ba17){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x4b45d2[_0xab1a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x313b99,null))[_0xab1a('0x25')](function(_0xef2e8a){if(_0xef2e8a){return _0xef2e8a[_0xab1a('0x76')](_0x4b45d2[_0xab1a('0x48')]['ids']);}})[_0xab1a('0x25')](respondWithStatusCode(_0x313b99,null))['catch'](handleError(_0x313b99,null));};exports[_0xab1a('0x77')]=function(_0x11218e,_0x3c33a0,_0x3e37e6){var _0x55df24={'body':_0x11218e[_0xab1a('0x69')],'channel':_0xab1a('0x78')};var _0x1827f7=[];var _0x10fa87=[];var _0x334a4c={};var _0x272d46=![];return db['CmContact'][_0xab1a('0x6a')]()[_0xab1a('0x25')](function(_0x373b33){if(!_0x373b33){throw new db[(_0xab1a('0x79'))]['ValidationError'](_0xab1a('0x7a'));}_0x1827f7=_['difference'](_[_0xab1a('0x49')](_0x373b33),[_0xab1a('0x7b'),_0xab1a('0x7c')]);_0x10fa87=_[_0xab1a('0x7d')](_[_0xab1a('0x49')](_0x373b33),['createdAt','updatedAt','CompanyId',_0xab1a('0x7e')]);if(_0x11218e[_0xab1a('0x69')]['id']){delete _0x11218e[_0xab1a('0x69')]['id'];}if(_[_0xab1a('0x7f')](_0x11218e[_0xab1a('0x69')][_0xab1a('0x80')])){throw new db[(_0xab1a('0x79'))][(_0xab1a('0x81'))](_0xab1a('0x82'));}if(_[_0xab1a('0x7f')](_0x11218e[_0xab1a('0x69')][_0xab1a('0x69')])||_0x11218e['body']['body']===''){throw new db[(_0xab1a('0x79'))][(_0xab1a('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xab1a('0x7f')](_0x11218e[_0xab1a('0x69')][_0xab1a('0x83')])){throw new db['Sequelize'][(_0xab1a('0x81'))](_0xab1a('0x84')+_0x10fa87);}if(!_[_0xab1a('0x85')](_0x10fa87,_0x11218e[_0xab1a('0x69')][_0xab1a('0x83')])){throw new db[(_0xab1a('0x79'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10fa87);}_0x334a4c[_0x11218e['body'][_0xab1a('0x83')]]=_0x11218e[_0xab1a('0x69')][_0xab1a('0x80')];})[_0xab1a('0x25')](function(){return db['OpenchannelAccount'][_0xab1a('0x64')]({'where':{'id':_0x11218e[_0xab1a('0x5e')]['id']},'include':[{'model':db[_0xab1a('0x86')],'as':_0xab1a('0x87'),'include':[{'model':db[_0xab1a('0x88')],'as':'Contacts','where':_0x334a4c,'limit':0x1,'order':[['updatedAt',_0xab1a('0x89')]]}]},{'model':db[_0xab1a('0x8a')],'as':_0xab1a('0x8b')}]});})[_0xab1a('0x25')](handleEntityNotFound(_0x3c33a0,null))[_0xab1a('0x25')](function(_0x68960b){if(_0x68960b&&_0x68960b['List']){_0x55df24[_0xab1a('0x8c')]=_0x68960b;_0x55df24[_0xab1a('0x8d')]=_0x68960b['Applications'];_0x55df24[_0xab1a('0x8e')]=_0x68960b['List'];_0x55df24['applications']=_['orderBy'](_0x55df24[_0xab1a('0x8d')],[_0xab1a('0x8f')],[_0xab1a('0x90')]);if(_0x55df24[_0xab1a('0x8c')][_0xab1a('0x8b')]){delete _0x55df24[_0xab1a('0x8c')][_0xab1a('0x8b')];}if(_0x55df24[_0xab1a('0x8c')][_0xab1a('0x87')]&&_0x55df24['account'][_0xab1a('0x87')]['Contacts'][_0xab1a('0x4e')]){return _0x55df24[_0xab1a('0x8c')][_0xab1a('0x87')][_0xab1a('0x91')][0x0];}var _0x55bbd8=_['defaults'](_0x11218e[_0xab1a('0x69')],{'firstName':_0x11218e['body'][_0xab1a('0x80')],'ListId':_0x68960b[_0xab1a('0x7e')]});_0x55bbd8[_0x11218e[_0xab1a('0x69')][_0xab1a('0x83')]]=_0x11218e['body']['from'];return db[_0xab1a('0x88')]['create'](_0x55bbd8,{'fields':_0x1827f7,'raw':!![]});}})[_0xab1a('0x25')](handleEntityNotFound(_0x3c33a0,null))[_0xab1a('0x25')](function(_0xb6000e){_0x55df24['contact']=_0xb6000e;if(_0xb6000e){var _0x3c8cb3={'ContactId':_0xb6000e['id'],'OpenchannelAccountId':_0x11218e[_0xab1a('0x5e')]['id'],'from':(_0xb6000e[_0xab1a('0x92')]||'')+'\x20'+(_0xb6000e['lastName']||'')};var _0x18e519={'OpenchannelAccountId':_0x11218e[_0xab1a('0x5e')]['id'],'closed':![]};if(_0x11218e['body']['threadId']){_0x18e519[_0xab1a('0x93')]=_0x11218e[_0xab1a('0x69')]['threadId'];return db[_0xab1a('0x94')][_0xab1a('0x64')]({'where':_0x18e519})[_0xab1a('0x25')](function(_0x4e370a){if(_0x4e370a){return[_0x4e370a,![]];}_0x3c8cb3[_0xab1a('0x93')]=_0x11218e['body'][_0xab1a('0x93')];_0x3c8cb3[_0xab1a('0x95')]=_0x11218e[_0xab1a('0x69')][_0xab1a('0x95')];return db['OpenchannelInteraction']['create'](_0x3c8cb3)[_0xab1a('0x25')](function(_0x2a8ad6){return[_0x2a8ad6,!![]];});});}else{_0x18e519['threadId']=null;}_0x18e519['ContactId']=_0xb6000e['id'];return db['OpenchannelInteraction']['find']({'where':_0x18e519})[_0xab1a('0x25')](function(_0x7fcea6){if(_0x7fcea6){return[_0x7fcea6,![]];}return db['OpenchannelInteraction'][_0xab1a('0x6e')](_0x3c8cb3)[_0xab1a('0x25')](function(_0x1057b0){return[_0x1057b0,!![]];});});}})['spread'](function(_0x5bd724,_0x4d73b3){if(_0x5bd724){_0x272d46=_0x4d73b3;if(!_0x4d73b3){var _0x2b2bf9={'from':(_0x55df24['contact'][_0xab1a('0x92')]||'')+'\x20'+(_0x55df24[_0xab1a('0x96')][_0xab1a('0x97')]||'')};if(_0x11218e[_0xab1a('0x69')][_0xab1a('0x93')]&&_0x11218e[_0xab1a('0x69')][_0xab1a('0x98')]&&_0x11218e[_0xab1a('0x69')][_0xab1a('0x93')]!=_0x11218e[_0xab1a('0x69')][_0xab1a('0x98')]){_0x2b2bf9[_0xab1a('0x93')]=_0x11218e[_0xab1a('0x69')][_0xab1a('0x98')];}return _0x5bd724['update'](_0x2b2bf9);}else{return _0x5bd724;}}})['then'](function(_0x57f974){_0x55df24['interaction']=_0x57f974[_0xab1a('0x3a')]({'plain':!![]});_0x55df24['interaction'][_0xab1a('0x99')]=_0x272d46;if(_0x55df24[_0xab1a('0x9a')][_0xab1a('0x99')]){if(_0x55df24[_0xab1a('0x8c')][_0xab1a('0x9b')]){_0x55df24[_0xab1a('0x8d')][_0xab1a('0x9c')]({'id':0x0,'priority':_0x55df24[_0xab1a('0x8d')][_0xab1a('0x4e')]+0x1,'app':'close','appdata':_0xab1a('0x9d'),'interval':_0xab1a('0x9e')});}}return db[_0xab1a('0x9f')][_0xab1a('0x6e')]({'body':_0x11218e[_0xab1a('0x69')]['body'],'OpenchannelAccountId':_0x11218e[_0xab1a('0x5e')]['id'],'OpenchannelInteractionId':_0x57f974['id'],'direction':'in','ContactId':_0x55df24[_0xab1a('0x96')]['id'],'AttachmentId':_0x11218e[_0xab1a('0x69')][_0xab1a('0xa0')]});})['then'](function(_0x44acb2){_0x55df24['message']=_0x44acb2;if(!_0x55df24[_0xab1a('0x9a')][_0xab1a('0xa1')])return;return db[_0xab1a('0xa2')][_0xab1a('0x64')]({'attributes':['id',_0xab1a('0x3f')],'where':{'id':_0x55df24[_0xab1a('0x9a')][_0xab1a('0xa1')]}});})[_0xab1a('0x25')](function(_0x253cb0){if(_0x253cb0){_0x55df24[_0xab1a('0x8d')][_0xab1a('0xa3')]({'id':0x0,'priority':0x0,'app':_0xab1a('0xa4'),'appdata':_0x253cb0[_0xab1a('0x3f')]+','+(_0x55df24['account'][_0xab1a('0xa5')]||0xa),'interval':_0xab1a('0x9e')});}if(!_0x55df24[_0xab1a('0x9a')][_0xab1a('0xa6')])return;return db[_0xab1a('0xa7')]['find']({'attributes':['id',_0xab1a('0x3f')],'where':{'id':_0x55df24[_0xab1a('0x9a')][_0xab1a('0xa6')]}});})['then'](function(_0x106f72){if(_0x106f72){_0x55df24[_0xab1a('0x8d')][_0xab1a('0xa3')]({'id':0x0,'priority':0x1,'app':_0xab1a('0xa8'),'appdata':_0x106f72[_0xab1a('0x3f')]+','+(_0x55df24[_0xab1a('0x8c')][_0xab1a('0xa9')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xab1a('0xaa'),'startRouting',_0x55df24);})[_0xab1a('0x25')](function(_0x5a831a){respondWithRpcPromise(_0xab1a('0xab'),'EventManager',{'event':'notify','message':_0x5a831a},client9002);return _0x5a831a;})[_0xab1a('0x25')](respondWithResult(_0x3c33a0,null))[_0xab1a('0x2e')](handleError(_0x3c33a0,null));};exports[_0xab1a('0xac')]=function(_0x59a426,_0xb8bb96){var _0x3170ba=_0x59a426['params']['id'];var _0x36ceb9=_0x59a426[_0xab1a('0x69')];var _0xae3f58=0xc8;var _0x36c081=null;return db[_0xab1a('0xad')][_0xab1a('0xae')]({'isolationLevel':db[_0xab1a('0xad')][_0xab1a('0xaf')][_0xab1a('0xb0')][_0xab1a('0xb1')]},function(_0x2646eb){return db[_0xab1a('0x45')][_0xab1a('0x75')]({'where':{'id':_0x3170ba},'transaction':_0x2646eb})['then'](function(_0x3c21b9){if(_0x3c21b9){return db[_0xab1a('0x8a')][_0xab1a('0x3d')]({'where':{'OpenchannelAccountId':_0x3170ba},'transaction':_0x2646eb})['then'](function(){var _0x57bed6=_[_0xab1a('0x44')](_0x36ceb9,function(_0x4f7e78){_0x4f7e78['OpenchannelAccountId']=_0x3170ba;return _0x4f7e78;});return db[_0xab1a('0x8a')][_0xab1a('0xb2')](_0x57bed6,{'transaction':_0x2646eb});});}else{_0xae3f58=0x194;_0x36c081=[];}});})[_0xab1a('0x25')](function(){if(_0xae3f58!==0x194){return db[_0xab1a('0x8a')][_0xab1a('0xb3')]({'where':{'OpenchannelAccountId':_0x3170ba},'order':_0xab1a('0x8f')})[_0xab1a('0x25')](function(_0x574b49){_0x36c081=_0x574b49;});}})['catch'](function(_0x476b7a){_0xae3f58=0x1f4;logger[_0xab1a('0x29')](_0x476b7a['stack']);if(_0x476b7a['name']){delete _0x476b7a[_0xab1a('0x3f')];}_0x36c081=_0x476b7a;})[_0xab1a('0xb4')](function(){if(_0x36c081===null){_0xb8bb96['sendStatus'](_0xae3f58);}else{if(_0xae3f58===0x1f4){_0xb8bb96['status'](_0xae3f58)['send'](_0x36c081);}else{_0xb8bb96[_0xab1a('0x31')](_0xae3f58)['json'](_0x36c081);}}});};exports[_0xab1a('0xb5')]=function(_0x33c7a6,_0x3a6121,_0x3a2c24){var _0x3ef7be={};var _0x5cd17e={};var _0x35d837;var _0x3632d4;return db[_0xab1a('0x45')][_0xab1a('0x75')]({'where':{'id':_0x33c7a6['params']['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x3a6121,null))[_0xab1a('0x25')](function(_0x1cd6aa){if(_0x1cd6aa){_0x35d837=_0x1cd6aa;_0x5cd17e[_0xab1a('0x4c')]=_[_0xab1a('0x49')](db[_0xab1a('0x8a')][_0xab1a('0x46')]);_0x5cd17e[_0xab1a('0x48')]=_[_0xab1a('0x49')](_0x33c7a6[_0xab1a('0x48')]);_0x5cd17e[_0xab1a('0x4a')]=_['intersection'](_0x5cd17e[_0xab1a('0x4c')],_0x5cd17e[_0xab1a('0x48')]);_0x3ef7be[_0xab1a('0x4d')]=_['intersection'](_0x5cd17e['model'],qs[_0xab1a('0x5f')](_0x33c7a6['query']['fields']));_0x3ef7be[_0xab1a('0x4d')]=_0x3ef7be[_0xab1a('0x4d')][_0xab1a('0x4e')]?_0x3ef7be[_0xab1a('0x4d')]:_0x5cd17e[_0xab1a('0x4c')];_0x3ef7be[_0xab1a('0x50')]=qs[_0xab1a('0x51')](_0x33c7a6[_0xab1a('0x48')][_0xab1a('0x51')]);_0x3ef7be[_0xab1a('0x52')]=qs['filters'](_[_0xab1a('0x53')](_0x33c7a6[_0xab1a('0x48')],_0x5cd17e[_0xab1a('0x4a')]));if(_0x33c7a6[_0xab1a('0x48')][_0xab1a('0x54')]){_0x3ef7be[_0xab1a('0x52')]=_['merge'](_0x3ef7be[_0xab1a('0x52')],{'$or':_['map'](_0x3ef7be[_0xab1a('0x4d')],function(_0x3a4edb){var _0x312609={};_0x312609[_0x3a4edb]={'$like':'%'+_0x33c7a6[_0xab1a('0x48')][_0xab1a('0x54')]+'%'};return _0x312609;})});}_0x3ef7be=_[_0xab1a('0x57')]({},_0x3ef7be,_0x33c7a6[_0xab1a('0x58')]);return _0x35d837[_0xab1a('0xb5')](_0x3ef7be);}})[_0xab1a('0x25')](function(_0x3ed6cf){if(_0x3ed6cf){_0x3632d4=_0x3ed6cf[_0xab1a('0x4e')];if(!_0x33c7a6[_0xab1a('0x48')]['hasOwnProperty'](_0xab1a('0x4f'))){_0x3ef7be[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0x33c7a6[_0xab1a('0x48')][_0xab1a('0x35')]);_0x3ef7be[_0xab1a('0x33')]=qs[_0xab1a('0x33')](_0x33c7a6[_0xab1a('0x48')][_0xab1a('0x33')]);}return _0x35d837[_0xab1a('0xb5')](_0x3ef7be);}})[_0xab1a('0x25')](function(_0x50cb19){if(_0x50cb19){return _0x50cb19?{'count':_0x3632d4,'rows':_0x50cb19}:null;}})['then'](respondWithResult(_0x3a6121,null))['catch'](handleError(_0x3a6121,null));};exports[_0xab1a('0xb6')]=function(_0x2a4a16,_0x5b5d25,_0xfc6b3){var _0x2b8df4={'raw':![],'where':{}};var _0x133a0a={};var _0x4aca80={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2a4a16[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x5b5d25,null))['then'](function(_0x3d17f1){if(_0x3d17f1){_0x133a0a['model']=_['keys'](db['OpenchannelInteraction'][_0xab1a('0x46')]);_0x133a0a[_0xab1a('0x48')]=_[_0xab1a('0x49')](_0x2a4a16[_0xab1a('0x48')]);_0x133a0a[_0xab1a('0x4a')]=_[_0xab1a('0x4b')](_0x133a0a[_0xab1a('0x4c')],_0x133a0a[_0xab1a('0x48')]);_0x2b8df4['attributes']=_[_0xab1a('0x4b')](_0x133a0a[_0xab1a('0x4c')],qs[_0xab1a('0x5f')](_0x2a4a16['query'][_0xab1a('0x5f')]));_0x2b8df4['attributes']=_0x2b8df4[_0xab1a('0x4d')][_0xab1a('0x4e')]?_0x2b8df4[_0xab1a('0x4d')]:_0x133a0a[_0xab1a('0x4c')];if(!_0x2a4a16[_0xab1a('0x48')][_0xab1a('0x70')](_0xab1a('0x4f'))){_0x2b8df4[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0x2a4a16[_0xab1a('0x48')][_0xab1a('0x35')]);_0x2b8df4[_0xab1a('0x33')]=qs['offset'](_0x2a4a16['query'][_0xab1a('0x33')]);}_0x2b8df4[_0xab1a('0x50')]=qs['sort'](_0x2a4a16[_0xab1a('0x48')][_0xab1a('0x51')]);_0x2b8df4['where']=qs[_0xab1a('0x4a')](_['pick'](_0x2a4a16['query'],_0x133a0a[_0xab1a('0x4a')]));_0x2b8df4[_0xab1a('0x52')][_0xab1a('0x6c')]=_0x3d17f1['id'];if(_0x2a4a16['query']['filter']){_0x2b8df4['where']=_[_0xab1a('0x57')](_0x2b8df4['where'],{'$or':_[_0xab1a('0x44')](_0x2b8df4[_0xab1a('0x4d')],function(_0x36d5a0){var _0x559a47={};_0x559a47[_0x36d5a0]={'$like':'%'+_0x2a4a16['query'][_0xab1a('0x54')]+'%'};return _0x559a47;})});}_0x2b8df4=_['merge']({},_0x2b8df4,_0x2a4a16['options']);return db[_0xab1a('0x94')][_0xab1a('0x36')]({'where':_0x2b8df4['where']})[_0xab1a('0x25')](function(_0x1bc106){_0x4aca80[_0xab1a('0x36')]=_0x1bc106;if(_0x2a4a16[_0xab1a('0x48')][_0xab1a('0x59')]){_0x2b8df4['include']=[{'model':db[_0xab1a('0x88')],'as':_0xab1a('0xb7'),'required':![]},{'model':db['User'],'as':_0xab1a('0xb8'),'attributes':['name',_0xab1a('0xb9'),_0xab1a('0xba')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xab1a('0x3f'),_0xab1a('0xbb')],'where':_0x2a4a16[_0xab1a('0x48')][_0xab1a('0xbc')]?{'id':_0x2a4a16['query'][_0xab1a('0xbc')]}:undefined,'required':_0x2a4a16[_0xab1a('0x48')][_0xab1a('0xbc')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xab1a('0x5b')](_0x2b8df4);})['then'](function(_0x573e07){_0x4aca80[_0xab1a('0x5c')]=_0x573e07;return _0x4aca80;});}})[_0xab1a('0x25')](respondWithFilteredResult(_0x5b5d25,_0x2b8df4))['catch'](handleError(_0x5b5d25,null));};exports['addAgents']=function(_0x1bdf67,_0x1cdf78,_0x10908b){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x1bdf67[_0xab1a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1cdf78,null))[_0xab1a('0x25')](function(_0xd421b7){if(_0xd421b7){return _0xd421b7[_0xab1a('0xbd')](_0x1bdf67[_0xab1a('0x69')][_0xab1a('0xbe')],_[_0xab1a('0xbf')](_0x1bdf67[_0xab1a('0x69')],[_0xab1a('0xbe'),'id'])||{})['spread'](function(_0x53f417){for(var _0x121c05=0x0;_0x121c05<_0x1bdf67[_0xab1a('0x69')][_0xab1a('0xbe')][_0xab1a('0x4e')];_0x121c05+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x1bdf67[_0xab1a('0x69')][_0xab1a('0xbe')][_0x121c05]),'OpenchannelAccountId':Number(_0x1bdf67[_0xab1a('0x5e')]['id'])});}return _0x53f417;});}})[_0xab1a('0x25')](respondWithResult(_0x1cdf78,null))[_0xab1a('0x2e')](handleError(_0x1cdf78,null));};exports[_0xab1a('0xc0')]=function(_0x5b8467,_0x3313b7,_0x560b8c){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x5b8467[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x3313b7,null))[_0xab1a('0x25')](function(_0x1dfacf){if(_0x1dfacf){return _0x1dfacf[_0xab1a('0xc0')](_0x5b8467[_0xab1a('0x48')][_0xab1a('0xbe')])[_0xab1a('0x25')](function(){if(_[_0xab1a('0xc1')](_0x5b8467[_0xab1a('0x48')]['ids'])){for(var _0x297ac0=0x0;_0x297ac0<_0x5b8467[_0xab1a('0x48')][_0xab1a('0xbe')]['length'];_0x297ac0+=0x1){socket['emit'](_0xab1a('0xc2'),{'UserId':Number(_0x5b8467[_0xab1a('0x48')][_0xab1a('0xbe')][_0x297ac0]),'OpenchannelAccountId':Number(_0x5b8467['params']['id'])});}}else{socket[_0xab1a('0xc3')](_0xab1a('0xc2'),{'UserId':Number(_0x5b8467[_0xab1a('0x48')]['ids']),'OpenchannelAccountId':Number(_0x5b8467[_0xab1a('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3313b7,null))['catch'](handleError(_0x3313b7,null));};exports[_0xab1a('0xc4')]=function(_0x5a3d48,_0x5780cc,_0x369321){var _0xb8f8e8={};var _0x481846={};var _0x37eb5d;var _0x3976cc;return db['OpenchannelAccount'][_0xab1a('0x75')]({'where':{'id':_0x5a3d48[_0xab1a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5780cc,null))['then'](function(_0x45b5ec){if(_0x45b5ec){_0x37eb5d=_0x45b5ec;_0x481846['model']=_['keys'](db[_0xab1a('0xa2')][_0xab1a('0x46')]);_0x481846[_0xab1a('0x48')]=_['keys'](_0x5a3d48[_0xab1a('0x48')]);_0x481846[_0xab1a('0x4a')]=_[_0xab1a('0x4b')](_0x481846[_0xab1a('0x4c')],_0x481846[_0xab1a('0x48')]);_0xb8f8e8['attributes']=_['intersection'](_0x481846[_0xab1a('0x4c')],qs[_0xab1a('0x5f')](_0x5a3d48['query'][_0xab1a('0x5f')]));_0xb8f8e8[_0xab1a('0x4d')]=_0xb8f8e8[_0xab1a('0x4d')]['length']?_0xb8f8e8[_0xab1a('0x4d')]:_0x481846[_0xab1a('0x4c')];_0xb8f8e8[_0xab1a('0x50')]=qs[_0xab1a('0x51')](_0x5a3d48[_0xab1a('0x48')]['sort']);_0xb8f8e8[_0xab1a('0x52')]=qs[_0xab1a('0x4a')](_[_0xab1a('0x53')](_0x5a3d48[_0xab1a('0x48')],_0x481846['filters']));if(_0x5a3d48['query'][_0xab1a('0x54')]){_0xb8f8e8['where']=_[_0xab1a('0x57')](_0xb8f8e8[_0xab1a('0x52')],{'$or':_[_0xab1a('0x44')](_0xb8f8e8['attributes'],function(_0x5d62cd){var _0x1ce44c={};_0x1ce44c[_0x5d62cd]={'$like':'%'+_0x5a3d48[_0xab1a('0x48')]['filter']+'%'};return _0x1ce44c;})});}_0xb8f8e8=_[_0xab1a('0x57')]({},_0xb8f8e8,_0x5a3d48['options']);return _0x37eb5d[_0xab1a('0xc4')](_0xb8f8e8);}})[_0xab1a('0x25')](function(_0x3614a7){if(_0x3614a7){_0x3976cc=_0x3614a7[_0xab1a('0x4e')];if(!_0x5a3d48['query'][_0xab1a('0x70')]('nolimit')){_0xb8f8e8[_0xab1a('0x35')]=qs[_0xab1a('0x35')](_0x5a3d48[_0xab1a('0x48')]['limit']);_0xb8f8e8[_0xab1a('0x33')]=qs[_0xab1a('0x33')](_0x5a3d48['query'][_0xab1a('0x33')]);}return _0x37eb5d['getAgents'](_0xb8f8e8);}})['then'](function(_0x395471){if(_0x395471){return _0x395471?{'count':_0x3976cc,'rows':_0x395471}:null;}})[_0xab1a('0x25')](respondWithResult(_0x5780cc,null))[_0xab1a('0x2e')](handleError(_0x5780cc,null));};exports[_0xab1a('0x40')]=function(_0x1be31d,_0x5cd05f,_0x4623ca){var _0x50a295,_0x28dc10,_0x54899f;if(_[_0xab1a('0x7f')](_0x1be31d['body']['body'])||_0x1be31d[_0xab1a('0x69')]['body']===''){throw new db[(_0xab1a('0x79'))][(_0xab1a('0x81'))](_0xab1a('0xc5'));}if(_['isNil'](_0x1be31d[_0xab1a('0x69')]['to'])){}_0x50a295=_0x1be31d[_0xab1a('0x69')]['to'];return db[_0xab1a('0x45')]['findOne']({'where':{'id':_0x1be31d[_0xab1a('0x5e')]['id']}})[_0xab1a('0x25')](handleEntityNotFound(_0x5cd05f,null))['then'](function(_0x202b4a){if(_0x202b4a){return db[_0xab1a('0x45')][_0xab1a('0x64')]({'where':{'id':_0x202b4a['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xab1a('0x88')],'as':_0xab1a('0x91'),'where':{[_0x202b4a[_0xab1a('0x83')]]:_0x50a295},'limit':0x1,'order':[['updatedAt',_0xab1a('0x89')]]}]}]})[_0xab1a('0x25')](handleEntityNotFound(_0x5cd05f,null))[_0xab1a('0x25')](function(_0x3da0ae){if(_0x3da0ae&&_0x3da0ae[_0xab1a('0x87')]){_0x28dc10=_0x3da0ae[_0xab1a('0x3a')]({'plain':!![]});if(_0x28dc10[_0xab1a('0x87')]&&_0x28dc10[_0xab1a('0x87')][_0xab1a('0x91')][_0xab1a('0x4e')]){return _0x28dc10[_0xab1a('0x87')][_0xab1a('0x91')][0x0];}return db[_0xab1a('0x88')]['create'](_[_0xab1a('0x1d')](_0x1be31d[_0xab1a('0x69')],{'firstName':_0x50a295,[_0x3da0ae[_0xab1a('0x83')]]:_0x50a295,'phone':_0x50a295,'ListId':_0x28dc10[_0xab1a('0x7e')]}));}})['then'](handleEntityNotFound(_0x5cd05f,null))[_0xab1a('0x25')](function(_0xf0239b){if(_0xf0239b){_0x54899f=_0xf0239b;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x54899f['id'],'closed':![],'OpenchannelAccountId':_0x28dc10['id']}})[_0xab1a('0x25')](function(_0x1e94f6){if(_0x1e94f6){return[_0x1e94f6,![]];}return db[_0xab1a('0x94')][_0xab1a('0x6e')]({'UserId':_0x1be31d['user']['id'],'ContactId':_0x54899f['id'],'OpenchannelAccountId':_0x28dc10['id'],'lastMsgDirection':'out','firstMsgDirection':_0xab1a('0xc6'),'Messages':[_[_0xab1a('0x57')](_0x1be31d[_0xab1a('0x69')],{'read':![],'body':_0x1be31d[_0xab1a('0x69')]['body'],'OpenchannelAccountId':_0x28dc10['id'],'UserId':_0x1be31d['user']['id'],'ContactId':_0x54899f['id']})]},{'include':[{'model':db[_0xab1a('0x9f')],'as':'Messages'}]})[_0xab1a('0x25')](function(_0x5d214a){return[_0x5d214a,!![]];});});}})['spread'](function(_0x19a03d,_0x4de65e){if(_0x4de65e){return _0x19a03d;}return db[_0xab1a('0x9f')]['create'](_['merge'](_0x1be31d[_0xab1a('0x69')],{'read':![],'body':_0x1be31d[_0xab1a('0x69')][_0xab1a('0x69')],'OpenchannelAccountId':_0x28dc10['id'],'OpenchannelInteractionId':_0x19a03d['id'],'UserId':_0x1be31d[_0xab1a('0x60')]['id'],'ContactId':_0x54899f['id']}))[_0xab1a('0x25')](function(_0xa980d8){_0x19a03d['dataValues'][_0xab1a('0xc7')]=[];_0x19a03d[_0xab1a('0xc8')]['Messages'][_0xab1a('0x9c')](_0xa980d8['dataValues']);return _0x19a03d;});});}})[_0xab1a('0x25')](respondWithResult(_0x5cd05f,null))[_0xab1a('0x2e')](handleError(_0x5cd05f,null));}; \ No newline at end of file +var _0xb512=['*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','send','Pause','mandatoryDispositionPause','rawAttributes','type','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','OpenchannelAccount','includeAll','rows','show','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','OpenchannelAccountId','Disposition','findOne','removeDispositions','CannedAnswer','getAnswers','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','OpenchannelApplication','applications','Applications','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged'];(function(_0x4dc891,_0x4258f2){var _0x23f733=function(_0x1ff42d){while(--_0x1ff42d){_0x4dc891['push'](_0x4dc891['shift']());}};_0x23f733(++_0x4258f2);}(_0xb512,0xe6));var _0x2b51=function(_0x3eea5f,_0x344d1e){_0x3eea5f=_0x3eea5f-0x0;var _0x1052a4=_0xb512[_0x3eea5f];return _0x1052a4;};'use strict';var emlformat=require(_0x2b51('0x0'));var rimraf=require(_0x2b51('0x1'));var zipdir=require(_0x2b51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b51('0x3'));var moment=require(_0x2b51('0x4'));var BPromise=require(_0x2b51('0x5'));var Mustache=require(_0x2b51('0x6'));var util=require('util');var path=require(_0x2b51('0x7'));var sox=require(_0x2b51('0x8'));var csv=require(_0x2b51('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b51('0xa'));var crypto=require(_0x2b51('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2b51('0xc'));var toCsv=require(_0x2b51('0x9'));var querystring=require(_0x2b51('0xd'));var Papa=require(_0x2b51('0xe'));var Redis=require(_0x2b51('0xf'));var authService=require(_0x2b51('0x10'));var qs=require(_0x2b51('0x11'));var as=require(_0x2b51('0x12'));var hardwareService=require(_0x2b51('0x13'));var logger=require(_0x2b51('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2b51('0x15'));var licenseUtil=require(_0x2b51('0x16'));var db=require(_0x2b51('0x17'))['db'];config[_0x2b51('0x18')]=_[_0x2b51('0x19')](config[_0x2b51('0x18')],{'host':_0x2b51('0x1a'),'port':0x18eb});var socket=require(_0x2b51('0x1b'))(new Redis(config[_0x2b51('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x2b51('0x1c'));var client=jayson[_0x2b51('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x2b51('0x1d')][_0x2b51('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1dd3c3,_0x4bbf22,_0x37629e,_0x514720){return new BPromise(function(_0x2f64a0,_0x21aff9){var _0x328403=_0x514720||client;return _0x328403['request'](_0x1dd3c3,_0x37629e)[_0x2b51('0x1f')](function(_0x709e54){logger[_0x2b51('0x20')](_0x2b51('0x21'),_0x4bbf22,'request\x20sent');logger[_0x2b51('0x22')](_0x2b51('0x23'),_0x4bbf22,'request\x20sent',JSON[_0x2b51('0x24')](_0x709e54));if(_0x709e54[_0x2b51('0x25')]){if(_0x709e54[_0x2b51('0x25')][_0x2b51('0x26')]===0x1f4){logger[_0x2b51('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bbf22,_0x709e54[_0x2b51('0x25')][_0x2b51('0x27')]);return _0x21aff9(_0x709e54[_0x2b51('0x25')][_0x2b51('0x27')]);}logger[_0x2b51('0x25')](_0x2b51('0x21'),_0x4bbf22,_0x709e54[_0x2b51('0x25')]['message']);return _0x2f64a0(_0x709e54[_0x2b51('0x25')][_0x2b51('0x27')]);}else{logger[_0x2b51('0x20')](_0x2b51('0x21'),_0x4bbf22,_0x2b51('0x28'));_0x2f64a0(_0x709e54[_0x2b51('0x29')][_0x2b51('0x27')]);}})[_0x2b51('0x2a')](function(_0x1f591e){logger[_0x2b51('0x25')](_0x2b51('0x21'),_0x4bbf22,_0x1f591e);_0x21aff9(_0x1f591e);});});}function respondWithStatusCode(_0x8121fe,_0x1cfd68){_0x1cfd68=_0x1cfd68||0xcc;return function(_0x2f596a){if(_0x2f596a){return _0x8121fe[_0x2b51('0x2b')](_0x1cfd68);}return _0x8121fe[_0x2b51('0x2c')](_0x1cfd68)[_0x2b51('0x2d')]();};}function respondWithResult(_0x1cf392,_0x4e3716){_0x4e3716=_0x4e3716||0xc8;return function(_0x20667f){if(_0x20667f){return _0x1cf392[_0x2b51('0x2c')](_0x4e3716)[_0x2b51('0x2e')](_0x20667f);}};}function respondWithFilteredResult(_0x38395a,_0x26da91){return function(_0x1cb706){if(_0x1cb706){var _0x26a415=typeof _0x26da91[_0x2b51('0x2f')]===_0x2b51('0x30')&&typeof _0x26da91[_0x2b51('0x31')]===_0x2b51('0x30');var _0x1ae3b7=_0x1cb706[_0x2b51('0x32')];var _0x405a8b=_0x26a415?0x0:_0x26da91[_0x2b51('0x2f')];var _0x505592=_0x26a415?_0x1cb706['count']:_0x26da91[_0x2b51('0x2f')]+_0x26da91['limit'];var _0x1f0197;if(_0x505592>=_0x1ae3b7){_0x505592=_0x1ae3b7;_0x1f0197=0xc8;}else{_0x1f0197=0xce;}_0x38395a['status'](_0x1f0197);return _0x38395a[_0x2b51('0x33')](_0x2b51('0x34'),_0x405a8b+'-'+_0x505592+'/'+_0x1ae3b7)['json'](_0x1cb706);}return null;};}function patchUpdates(_0x49bd66){return function(_0x4cabaa){try{jsonpatch[_0x2b51('0x35')](_0x4cabaa,_0x49bd66,!![]);}catch(_0x55c06c){return BPromise[_0x2b51('0x36')](_0x55c06c);}return _0x4cabaa[_0x2b51('0x37')]();};}function saveUpdates(_0x115edd,_0xf756f8){return function(_0x3504fc){if(_0x3504fc){return _0x3504fc[_0x2b51('0x38')](_0x115edd)[_0x2b51('0x1f')](function(_0x82a7a5){return _0x82a7a5;});}return null;};}function removeEntity(_0x4b1495,_0x1f64f9){return function(_0x3c6c4d){if(_0x3c6c4d){return _0x3c6c4d['destroy']()['then'](function(){var _0x5382ea=_0x3c6c4d[_0x2b51('0x39')]({'plain':!![]});var _0x46ca29=_0x2b51('0x3a');return db[_0x2b51('0x3b')][_0x2b51('0x3c')]({'where':{'type':_0x46ca29,'resourceId':_0x5382ea['id']}})[_0x2b51('0x1f')](function(){return _0x3c6c4d;});})['then'](function(){_0x4b1495['status'](0xcc)[_0x2b51('0x2d')]();});}};}function handleEntityNotFound(_0x12e17d,_0xcc80d1){return function(_0x2eaced){if(!_0x2eaced){_0x12e17d['sendStatus'](0x194);}return _0x2eaced;};}function handleError(_0x55169b,_0x4214f6){_0x4214f6=_0x4214f6||0x1f4;return function(_0xcb31ec){logger[_0x2b51('0x25')](_0xcb31ec[_0x2b51('0x3d')]);if(_0xcb31ec['name']){delete _0xcb31ec['name'];}_0x55169b[_0x2b51('0x2c')](_0x4214f6)[_0x2b51('0x3e')](_0xcb31ec);};}exports['index']=function(_0x51f0e1,_0x3c0fac){var _0x18aafe={'include':[{'model':db[_0x2b51('0x3f')],'as':_0x2b51('0x40')}]},_0x59a299={},_0x3e420b={'count':0x0,'rows':[]};var _0x2b8195=_['map'](db['OpenchannelAccount'][_0x2b51('0x41')],function(_0x2baae9){return{'name':_0x2baae9['fieldName'],'type':_0x2baae9[_0x2b51('0x42')]['key']};});_0x59a299['model']=_[_0x2b51('0x43')](_0x2b8195,'name');_0x59a299['query']=_[_0x2b51('0x44')](_0x51f0e1[_0x2b51('0x45')]);_0x59a299[_0x2b51('0x46')]=_[_0x2b51('0x47')](_0x59a299[_0x2b51('0x48')],_0x59a299[_0x2b51('0x45')]);_0x18aafe['attributes']=_[_0x2b51('0x47')](_0x59a299[_0x2b51('0x48')],qs[_0x2b51('0x49')](_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x49')]));_0x18aafe['attributes']=_0x18aafe[_0x2b51('0x4a')][_0x2b51('0x4b')]?_0x18aafe[_0x2b51('0x4a')]:_0x59a299[_0x2b51('0x48')];if(!_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x4c')](_0x2b51('0x4d'))){_0x18aafe[_0x2b51('0x31')]=qs['limit'](_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x31')]);_0x18aafe[_0x2b51('0x2f')]=qs[_0x2b51('0x2f')](_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x2f')]);}_0x18aafe[_0x2b51('0x4e')]=qs[_0x2b51('0x4f')](_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x4f')]);_0x18aafe[_0x2b51('0x50')]=qs[_0x2b51('0x46')](_[_0x2b51('0x51')](_0x51f0e1[_0x2b51('0x45')],_0x59a299[_0x2b51('0x46')]),_0x2b8195);if(_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x52')]){_0x18aafe[_0x2b51('0x50')]=_[_0x2b51('0x53')](_0x18aafe[_0x2b51('0x50')],{'$or':_[_0x2b51('0x43')](_0x2b8195,function(_0x2faa90){if(_0x2faa90[_0x2b51('0x42')]!=='VIRTUAL'){var _0x59f368={};_0x59f368[_0x2faa90[_0x2b51('0x54')]]={'$like':'%'+_0x51f0e1[_0x2b51('0x45')]['filter']+'%'};return _0x59f368;}})});}_0x18aafe=_[_0x2b51('0x53')]({},_0x18aafe,_0x51f0e1[_0x2b51('0x55')]);var _0x255c8d={'where':_0x18aafe[_0x2b51('0x50')]};return db[_0x2b51('0x56')]['count'](_0x255c8d)['then'](function(_0x12e13c){_0x3e420b[_0x2b51('0x32')]=_0x12e13c;if(_0x51f0e1[_0x2b51('0x45')][_0x2b51('0x57')]){_0x18aafe['include']=[{'all':!![]}];}return db[_0x2b51('0x56')]['findAll'](_0x18aafe);})[_0x2b51('0x1f')](function(_0x43e067){_0x3e420b[_0x2b51('0x58')]=_0x43e067;return _0x3e420b;})[_0x2b51('0x1f')](respondWithFilteredResult(_0x3c0fac,_0x18aafe))['catch'](handleError(_0x3c0fac,null));};exports[_0x2b51('0x59')]=function(_0xe7f9f6,_0x580c90){var _0x374961={'raw':![],'where':{'id':_0xe7f9f6['params']['id']},'include':[{'model':db[_0x2b51('0x3f')],'as':_0x2b51('0x40')}]},_0xcf5e03={};_0xcf5e03[_0x2b51('0x48')]=_[_0x2b51('0x44')](db['OpenchannelAccount'][_0x2b51('0x41')]);_0xcf5e03[_0x2b51('0x45')]=_[_0x2b51('0x44')](_0xe7f9f6['query']);_0xcf5e03['filters']=_[_0x2b51('0x47')](_0xcf5e03[_0x2b51('0x48')],_0xcf5e03[_0x2b51('0x45')]);_0x374961[_0x2b51('0x4a')]=_[_0x2b51('0x47')](_0xcf5e03[_0x2b51('0x48')],qs['fields'](_0xe7f9f6[_0x2b51('0x45')]['fields']));_0x374961[_0x2b51('0x4a')]=_0x374961['attributes'][_0x2b51('0x4b')]?_0x374961[_0x2b51('0x4a')]:_0xcf5e03[_0x2b51('0x48')];if(_0xe7f9f6['query']['includeAll']){_0x374961[_0x2b51('0x5a')]=[{'all':!![]}];}_0x374961=_[_0x2b51('0x53')]({},_0x374961,_0xe7f9f6[_0x2b51('0x55')]);return db[_0x2b51('0x56')][_0x2b51('0x5b')](_0x374961)[_0x2b51('0x1f')](handleEntityNotFound(_0x580c90,null))[_0x2b51('0x1f')](respondWithResult(_0x580c90,null))[_0x2b51('0x2a')](handleError(_0x580c90,null));};exports[_0x2b51('0x5c')]=function(_0x77679b,_0xe30161){return db['OpenchannelAccount']['create'](_0x77679b[_0x2b51('0x5d')],{})['then'](function(_0x410618){var _0x10f0b0=_0x77679b[_0x2b51('0x5e')][_0x2b51('0x39')]({'plain':!![]});if(!_0x10f0b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10f0b0[_0x2b51('0x5f')]===_0x2b51('0x5e')){var _0x53bdd0=_0x410618[_0x2b51('0x39')]({'plain':!![]});var _0x32f613=_0x2b51('0x3a');return db['UserProfileSection'][_0x2b51('0x5b')]({'where':{'name':_0x32f613,'userProfileId':_0x10f0b0[_0x2b51('0x60')]},'raw':!![]})[_0x2b51('0x1f')](function(_0x121c26){if(_0x121c26&&_0x121c26[_0x2b51('0x61')]===0x0){return db[_0x2b51('0x3b')][_0x2b51('0x5c')]({'name':_0x53bdd0[_0x2b51('0x54')],'resourceId':_0x53bdd0['id'],'type':_0x121c26[_0x2b51('0x54')],'sectionId':_0x121c26['id']},{})['then'](function(){return _0x410618;});}else{return _0x410618;}})[_0x2b51('0x2a')](function(_0x3f5655){logger['error'](_0x2b51('0x62'),_0x3f5655);throw _0x3f5655;});}return _0x410618;})[_0x2b51('0x1f')](respondWithResult(_0xe30161,0xc9))[_0x2b51('0x2a')](handleError(_0xe30161,null));};exports[_0x2b51('0x38')]=function(_0x5c2d81,_0x1fcbf8){if(_0x5c2d81[_0x2b51('0x5d')]['id']){delete _0x5c2d81['body']['id'];}return db[_0x2b51('0x56')][_0x2b51('0x5b')]({'where':{'id':_0x5c2d81['params']['id']},'include':[{'model':db[_0x2b51('0x3f')],'as':_0x2b51('0x40')}]})['then'](handleEntityNotFound(_0x1fcbf8,null))['then'](saveUpdates(_0x5c2d81['body'],null))[_0x2b51('0x1f')](respondWithResult(_0x1fcbf8,null))[_0x2b51('0x2a')](handleError(_0x1fcbf8,null));};exports['destroy']=function(_0x455288,_0x189383){return db[_0x2b51('0x56')]['find']({'where':{'id':_0x455288['params']['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x189383,null))[_0x2b51('0x1f')](removeEntity(_0x189383,null))[_0x2b51('0x2a')](handleError(_0x189383,null));};exports[_0x2b51('0x63')]=function(_0x2f40a8,_0x24631f){return db['OpenchannelAccount']['describe']()[_0x2b51('0x1f')](respondWithResult(_0x24631f,null))[_0x2b51('0x2a')](handleError(_0x24631f,null));};exports[_0x2b51('0x64')]=function(_0x388886,_0x286b46,_0x1e0a86){if(_0x388886[_0x2b51('0x5d')]['id']){delete _0x388886[_0x2b51('0x5d')]['id'];}return db[_0x2b51('0x56')]['find']({'where':{'id':_0x388886[_0x2b51('0x65')]['id']}})['then'](handleEntityNotFound(_0x286b46,null))[_0x2b51('0x1f')](function(_0x95ce6e){if(_0x95ce6e){_0x388886[_0x2b51('0x5d')][_0x2b51('0x66')]=_0x95ce6e['id'];return db[_0x2b51('0x67')][_0x2b51('0x5c')](_0x388886[_0x2b51('0x5d')]);}})[_0x2b51('0x1f')](respondWithResult(_0x286b46,null))[_0x2b51('0x2a')](handleError(_0x286b46,null));};exports['getDispositions']=function(_0x481263,_0x113001,_0x24e1dc){var _0x18a720={'raw':![],'where':{}};var _0xfdbe9b={};var _0x215e82={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2b51('0x68')]({'where':{'id':_0x481263['params']['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x113001,null))[_0x2b51('0x1f')](function(_0x53d68d){if(_0x53d68d){_0xfdbe9b[_0x2b51('0x48')]=_[_0x2b51('0x44')](db[_0x2b51('0x67')]['rawAttributes']);_0xfdbe9b[_0x2b51('0x45')]=_[_0x2b51('0x44')](_0x481263[_0x2b51('0x45')]);_0xfdbe9b[_0x2b51('0x46')]=_[_0x2b51('0x47')](_0xfdbe9b[_0x2b51('0x48')],_0xfdbe9b[_0x2b51('0x45')]);_0x18a720['attributes']=_['intersection'](_0xfdbe9b[_0x2b51('0x48')],qs['fields'](_0x481263[_0x2b51('0x45')][_0x2b51('0x49')]));_0x18a720[_0x2b51('0x4a')]=_0x18a720[_0x2b51('0x4a')][_0x2b51('0x4b')]?_0x18a720[_0x2b51('0x4a')]:_0xfdbe9b[_0x2b51('0x48')];if(!_0x481263['query'][_0x2b51('0x4c')]('nolimit')){_0x18a720['limit']=qs[_0x2b51('0x31')](_0x481263[_0x2b51('0x45')]['limit']);_0x18a720[_0x2b51('0x2f')]=qs[_0x2b51('0x2f')](_0x481263[_0x2b51('0x45')][_0x2b51('0x2f')]);}_0x18a720[_0x2b51('0x4e')]=qs[_0x2b51('0x4f')](_0x481263[_0x2b51('0x45')][_0x2b51('0x4f')]);_0x18a720[_0x2b51('0x50')]=qs[_0x2b51('0x46')](_['pick'](_0x481263[_0x2b51('0x45')],_0xfdbe9b['filters']));_0x18a720[_0x2b51('0x50')][_0x2b51('0x66')]=_0x53d68d['id'];if(_0x481263[_0x2b51('0x45')][_0x2b51('0x52')]){_0x18a720[_0x2b51('0x50')]=_[_0x2b51('0x53')](_0x18a720[_0x2b51('0x50')],{'$or':_[_0x2b51('0x43')](_0x18a720[_0x2b51('0x4a')],function(_0x2d997b){var _0x3dd390={};_0x3dd390[_0x2d997b]={'$like':'%'+_0x481263[_0x2b51('0x45')][_0x2b51('0x52')]+'%'};return _0x3dd390;})});}_0x18a720=_[_0x2b51('0x53')]({},_0x18a720,_0x481263['options']);return db['Disposition']['count']({'where':_0x18a720[_0x2b51('0x50')]})[_0x2b51('0x1f')](function(_0x2d8b43){_0x215e82[_0x2b51('0x32')]=_0x2d8b43;if(_0x481263['query'][_0x2b51('0x57')]){_0x18a720[_0x2b51('0x5a')]=[{'all':!![]}];}return db[_0x2b51('0x67')]['findAll'](_0x18a720);})[_0x2b51('0x1f')](function(_0x1e64ce){_0x215e82['rows']=_0x1e64ce;return _0x215e82;});}})[_0x2b51('0x1f')](respondWithFilteredResult(_0x113001,_0x18a720))[_0x2b51('0x2a')](handleError(_0x113001,null));};exports['removeDispositions']=function(_0x3ee584,_0x435711,_0x285b15){return db['OpenchannelAccount'][_0x2b51('0x5b')]({'where':{'id':_0x3ee584[_0x2b51('0x65')]['id']}})['then'](handleEntityNotFound(_0x435711,null))[_0x2b51('0x1f')](function(_0x37d653){if(_0x37d653){return _0x37d653[_0x2b51('0x69')](_0x3ee584[_0x2b51('0x45')]['ids']);}})[_0x2b51('0x1f')](respondWithStatusCode(_0x435711,null))['catch'](handleError(_0x435711,null));};exports['addAnswer']=function(_0x5c3c79,_0x1286b4,_0x30ecd6){if(_0x5c3c79[_0x2b51('0x5d')]['id']){delete _0x5c3c79[_0x2b51('0x5d')]['id'];}return db[_0x2b51('0x56')]['find']({'where':{'id':_0x5c3c79[_0x2b51('0x65')]['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x1286b4,null))[_0x2b51('0x1f')](function(_0x34ff31){if(_0x34ff31){_0x5c3c79[_0x2b51('0x5d')]['OpenchannelAccountId']=_0x34ff31['id'];return db[_0x2b51('0x6a')][_0x2b51('0x5c')](_0x5c3c79[_0x2b51('0x5d')]);}})['then'](respondWithResult(_0x1286b4,null))[_0x2b51('0x2a')](handleError(_0x1286b4,null));};exports[_0x2b51('0x6b')]=function(_0x43bf9b,_0x188f60,_0x4a8789){var _0x5233a4={'raw':![],'where':{}};var _0x2d1a6={};var _0x3a33a6={'count':0x0,'rows':[]};return db[_0x2b51('0x56')]['findOne']({'where':{'id':_0x43bf9b[_0x2b51('0x65')]['id']}})['then'](handleEntityNotFound(_0x188f60,null))[_0x2b51('0x1f')](function(_0x3354f4){if(_0x3354f4){_0x2d1a6[_0x2b51('0x48')]=_[_0x2b51('0x44')](db[_0x2b51('0x6a')]['rawAttributes']);_0x2d1a6['query']=_['keys'](_0x43bf9b[_0x2b51('0x45')]);_0x2d1a6[_0x2b51('0x46')]=_[_0x2b51('0x47')](_0x2d1a6[_0x2b51('0x48')],_0x2d1a6['query']);_0x5233a4[_0x2b51('0x4a')]=_[_0x2b51('0x47')](_0x2d1a6['model'],qs[_0x2b51('0x49')](_0x43bf9b['query']['fields']));_0x5233a4[_0x2b51('0x4a')]=_0x5233a4[_0x2b51('0x4a')][_0x2b51('0x4b')]?_0x5233a4['attributes']:_0x2d1a6[_0x2b51('0x48')];if(!_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x4c')](_0x2b51('0x4d'))){_0x5233a4[_0x2b51('0x31')]=qs[_0x2b51('0x31')](_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x31')]);_0x5233a4[_0x2b51('0x2f')]=qs[_0x2b51('0x2f')](_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x2f')]);}_0x5233a4[_0x2b51('0x4e')]=qs['sort'](_0x43bf9b[_0x2b51('0x45')]['sort']);_0x5233a4['where']=qs[_0x2b51('0x46')](_[_0x2b51('0x51')](_0x43bf9b[_0x2b51('0x45')],_0x2d1a6[_0x2b51('0x46')]));_0x5233a4[_0x2b51('0x50')][_0x2b51('0x66')]=_0x3354f4['id'];if(_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x52')]){_0x5233a4['where']=_[_0x2b51('0x53')](_0x5233a4['where'],{'$or':_[_0x2b51('0x43')](_0x5233a4[_0x2b51('0x4a')],function(_0x400997){var _0x49e7d0={};_0x49e7d0[_0x400997]={'$like':'%'+_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x52')]+'%'};return _0x49e7d0;})});}_0x5233a4=_[_0x2b51('0x53')]({},_0x5233a4,_0x43bf9b[_0x2b51('0x55')]);return db['CannedAnswer'][_0x2b51('0x32')]({'where':_0x5233a4['where']})[_0x2b51('0x1f')](function(_0x3ae3e8){_0x3a33a6[_0x2b51('0x32')]=_0x3ae3e8;if(_0x43bf9b[_0x2b51('0x45')][_0x2b51('0x57')]){_0x5233a4[_0x2b51('0x5a')]=[{'all':!![]}];}return db[_0x2b51('0x6a')][_0x2b51('0x6c')](_0x5233a4);})['then'](function(_0x5c58c5){_0x3a33a6[_0x2b51('0x58')]=_0x5c58c5;return _0x3a33a6;});}})[_0x2b51('0x1f')](respondWithFilteredResult(_0x188f60,_0x5233a4))[_0x2b51('0x2a')](handleError(_0x188f60,null));};exports[_0x2b51('0x6d')]=function(_0x3b7a8c,_0x3a33e2,_0x2ca546){return db[_0x2b51('0x56')][_0x2b51('0x5b')]({'where':{'id':_0x3b7a8c[_0x2b51('0x65')]['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x3a33e2,null))['then'](function(_0x38f771){if(_0x38f771){return _0x38f771[_0x2b51('0x6d')](_0x3b7a8c[_0x2b51('0x45')][_0x2b51('0x6e')]);}})[_0x2b51('0x1f')](respondWithStatusCode(_0x3a33e2,null))[_0x2b51('0x2a')](handleError(_0x3a33e2,null));};exports[_0x2b51('0x6f')]=function(_0x293bcd,_0x1347bf,_0xe4ed25){var _0x4b9e9d={'body':_0x293bcd['body'],'channel':_0x2b51('0x70')};var _0xa9c868=[];var _0x40c2ba=[];var _0x23fc13={};var _0xdd950c=![];return db[_0x2b51('0x71')]['describe']()['then'](function(_0x4ed1c7){if(!_0x4ed1c7){throw new db[(_0x2b51('0x72'))][(_0x2b51('0x73'))](_0x2b51('0x74'));}_0xa9c868=_[_0x2b51('0x75')](_[_0x2b51('0x44')](_0x4ed1c7),[_0x2b51('0x76'),'updatedAt']);_0x40c2ba=_['difference'](_[_0x2b51('0x44')](_0x4ed1c7),['createdAt','updatedAt',_0x2b51('0x77'),_0x2b51('0x78')]);if(_0x293bcd['body']['id']){delete _0x293bcd[_0x2b51('0x5d')]['id'];}if(_[_0x2b51('0x79')](_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7a')])){throw new db['Sequelize'][(_0x2b51('0x73'))](_0x2b51('0x7b'));}if(_[_0x2b51('0x79')](_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x5d')])||_0x293bcd['body']['body']===''){throw new db['Sequelize'][(_0x2b51('0x73'))](_0x2b51('0x7c'));}if(_[_0x2b51('0x79')](_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7d')])){throw new db[(_0x2b51('0x72'))]['ValidationError'](_0x2b51('0x7e')+_0x40c2ba);}if(!_['includes'](_0x40c2ba,_0x293bcd['body'][_0x2b51('0x7d')])){throw new db[(_0x2b51('0x72'))][(_0x2b51('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40c2ba);}_0x23fc13[_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7d')]]=_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7a')];})[_0x2b51('0x1f')](function(){return db[_0x2b51('0x56')]['find']({'where':{'id':_0x293bcd['params']['id']},'include':[{'model':db[_0x2b51('0x7f')],'as':_0x2b51('0x80'),'include':[{'model':db[_0x2b51('0x71')],'as':_0x2b51('0x81'),'where':_0x23fc13,'limit':0x1,'order':[[_0x2b51('0x82'),_0x2b51('0x83')]]}]},{'model':db[_0x2b51('0x84')],'as':'Applications'}]});})[_0x2b51('0x1f')](handleEntityNotFound(_0x1347bf,null))[_0x2b51('0x1f')](function(_0x466b4e){if(_0x466b4e&&_0x466b4e[_0x2b51('0x80')]){_0x4b9e9d['account']=_0x466b4e;_0x4b9e9d[_0x2b51('0x85')]=_0x466b4e[_0x2b51('0x86')];_0x4b9e9d['list']=_0x466b4e['List'];_0x4b9e9d[_0x2b51('0x85')]=_['orderBy'](_0x4b9e9d[_0x2b51('0x85')],[_0x2b51('0x87')],[_0x2b51('0x88')]);if(_0x4b9e9d[_0x2b51('0x89')][_0x2b51('0x86')]){delete _0x4b9e9d[_0x2b51('0x89')][_0x2b51('0x86')];}if(_0x4b9e9d[_0x2b51('0x89')][_0x2b51('0x80')]&&_0x4b9e9d['account'][_0x2b51('0x80')][_0x2b51('0x81')]['length']){return _0x4b9e9d[_0x2b51('0x89')][_0x2b51('0x80')][_0x2b51('0x81')][0x0];}var _0x410332=_[_0x2b51('0x19')](_0x293bcd[_0x2b51('0x5d')],{'firstName':_0x293bcd['body']['from'],'ListId':_0x466b4e[_0x2b51('0x78')]});_0x410332[_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7d')]]=_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x7a')];return db['CmContact'][_0x2b51('0x5c')](_0x410332,{'fields':_0xa9c868,'raw':!![]});}})[_0x2b51('0x1f')](handleEntityNotFound(_0x1347bf,null))['then'](function(_0x49827c){_0x4b9e9d[_0x2b51('0x8a')]=_0x49827c;if(_0x49827c){var _0x3186e2={'ContactId':_0x49827c['id'],'OpenchannelAccountId':_0x293bcd['params']['id'],'from':(_0x49827c[_0x2b51('0x8b')]||'')+'\x20'+(_0x49827c[_0x2b51('0x8c')]||'')};var _0x430482={'OpenchannelAccountId':_0x293bcd[_0x2b51('0x65')]['id'],'closed':![]};if(_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x8d')]){_0x430482[_0x2b51('0x8d')]=_0x293bcd['body'][_0x2b51('0x8d')];return db[_0x2b51('0x8e')]['find']({'where':_0x430482})[_0x2b51('0x1f')](function(_0x432f62){if(_0x432f62){return[_0x432f62,![]];}_0x3186e2['threadId']=_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x8d')];_0x3186e2[_0x2b51('0x8f')]=_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x8f')];return db[_0x2b51('0x8e')][_0x2b51('0x5c')](_0x3186e2)['then'](function(_0x488432){return[_0x488432,!![]];});});}else{_0x430482[_0x2b51('0x8d')]=null;}_0x430482[_0x2b51('0x90')]=_0x49827c['id'];return db[_0x2b51('0x8e')][_0x2b51('0x5b')]({'where':_0x430482})[_0x2b51('0x1f')](function(_0xb15cbe){if(_0xb15cbe){return[_0xb15cbe,![]];}return db[_0x2b51('0x8e')][_0x2b51('0x5c')](_0x3186e2)[_0x2b51('0x1f')](function(_0x2d7618){return[_0x2d7618,!![]];});});}})[_0x2b51('0x91')](function(_0x90a253,_0x39bd2b){if(_0x90a253){_0xdd950c=_0x39bd2b;if(!_0x39bd2b){var _0x6abb8b={'from':(_0x4b9e9d[_0x2b51('0x8a')][_0x2b51('0x8b')]||'')+'\x20'+(_0x4b9e9d[_0x2b51('0x8a')]['lastName']||'')};if(_0x293bcd[_0x2b51('0x5d')]['threadId']&&_0x293bcd['body'][_0x2b51('0x92')]&&_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x8d')]!=_0x293bcd[_0x2b51('0x5d')]['messageId']){_0x6abb8b[_0x2b51('0x8d')]=_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x92')];}return _0x90a253['update'](_0x6abb8b);}else{return _0x90a253;}}})[_0x2b51('0x1f')](function(_0x42412f){_0x4b9e9d[_0x2b51('0x93')]=_0x42412f['get']({'plain':!![]});_0x4b9e9d[_0x2b51('0x93')][_0x2b51('0x94')]=_0xdd950c;if(_0x4b9e9d[_0x2b51('0x93')][_0x2b51('0x94')]){if(_0x4b9e9d['account'][_0x2b51('0x95')]){_0x4b9e9d[_0x2b51('0x85')]['push']({'id':0x0,'priority':_0x4b9e9d['applications'][_0x2b51('0x4b')]+0x1,'app':_0x2b51('0x96'),'appdata':_0x2b51('0x97'),'interval':_0x2b51('0x98')});}}return db['OpenchannelMessage'][_0x2b51('0x5c')]({'body':_0x293bcd[_0x2b51('0x5d')][_0x2b51('0x5d')],'OpenchannelAccountId':_0x293bcd['params']['id'],'OpenchannelInteractionId':_0x42412f['id'],'direction':'in','ContactId':_0x4b9e9d[_0x2b51('0x8a')]['id'],'AttachmentId':_0x293bcd['body'][_0x2b51('0x99')]});})['then'](function(_0x43720e){_0x4b9e9d[_0x2b51('0x27')]=_0x43720e;if(!_0x4b9e9d['interaction'][_0x2b51('0x9a')])return;return db[_0x2b51('0x9b')]['find']({'attributes':['id',_0x2b51('0x54')],'where':{'id':_0x4b9e9d[_0x2b51('0x93')][_0x2b51('0x9a')]}});})[_0x2b51('0x1f')](function(_0x5a10ff){if(_0x5a10ff){_0x4b9e9d['applications'][_0x2b51('0x9c')]({'id':0x0,'priority':0x0,'app':_0x2b51('0x9d'),'appdata':_0x5a10ff[_0x2b51('0x54')]+','+(_0x4b9e9d[_0x2b51('0x89')][_0x2b51('0x9e')]||0xa),'interval':_0x2b51('0x98')});}if(!_0x4b9e9d[_0x2b51('0x93')][_0x2b51('0x9f')])return;return db[_0x2b51('0xa0')][_0x2b51('0x5b')]({'attributes':['id',_0x2b51('0x54')],'where':{'id':_0x4b9e9d[_0x2b51('0x93')][_0x2b51('0x9f')]}});})['then'](function(_0x24bf34){if(_0x24bf34){_0x4b9e9d[_0x2b51('0x85')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2b51('0xa1'),'appdata':_0x24bf34[_0x2b51('0x54')]+','+(_0x4b9e9d[_0x2b51('0x89')][_0x2b51('0xa2')]||0x12c),'interval':_0x2b51('0x98')});}return respondWithRpcPromise('Start',_0x2b51('0xa3'),_0x4b9e9d);})[_0x2b51('0x1f')](function(_0x120d22){respondWithRpcPromise('EventManager',_0x2b51('0xa4'),{'event':_0x2b51('0x6f'),'message':_0x120d22},client9002);return _0x120d22;})[_0x2b51('0x1f')](respondWithResult(_0x1347bf,null))[_0x2b51('0x2a')](handleError(_0x1347bf,null));};exports[_0x2b51('0xa5')]=function(_0x3fa251,_0x59ae9f){var _0xed4d8f=_0x3fa251[_0x2b51('0x65')]['id'];var _0x1a4e2b=_0x3fa251[_0x2b51('0x5d')];var _0x1a0622=0xc8;var _0xe87d33=null;return db[_0x2b51('0xa6')][_0x2b51('0xa7')]({'isolationLevel':db['sequelize']['Transaction'][_0x2b51('0xa8')][_0x2b51('0xa9')]},function(_0x14299b){return db[_0x2b51('0x56')][_0x2b51('0x68')]({'where':{'id':_0xed4d8f},'transaction':_0x14299b})[_0x2b51('0x1f')](function(_0x1326a9){if(_0x1326a9){return db[_0x2b51('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0xed4d8f},'transaction':_0x14299b})[_0x2b51('0x1f')](function(){var _0x409eca=_[_0x2b51('0x43')](_0x1a4e2b,function(_0x45c826){_0x45c826[_0x2b51('0x66')]=_0xed4d8f;return _0x45c826;});return db[_0x2b51('0x84')][_0x2b51('0xaa')](_0x409eca,{'transaction':_0x14299b});});}else{_0x1a0622=0x194;_0xe87d33=[];}});})['then'](function(){if(_0x1a0622!==0x194){return db[_0x2b51('0x84')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0xed4d8f},'order':_0x2b51('0x87')})['then'](function(_0x4dcdd4){_0xe87d33=_0x4dcdd4;});}})['catch'](function(_0x1a741d){_0x1a0622=0x1f4;logger['error'](_0x1a741d[_0x2b51('0x3d')]);if(_0x1a741d[_0x2b51('0x54')]){delete _0x1a741d[_0x2b51('0x54')];}_0xe87d33=_0x1a741d;})[_0x2b51('0xab')](function(){if(_0xe87d33===null){_0x59ae9f['sendStatus'](_0x1a0622);}else{if(_0x1a0622===0x1f4){_0x59ae9f['status'](_0x1a0622)['send'](_0xe87d33);}else{_0x59ae9f[_0x2b51('0x2c')](_0x1a0622)[_0x2b51('0x2e')](_0xe87d33);}}});};exports[_0x2b51('0xac')]=function(_0x22e239,_0x49c653,_0x46d653){var _0x40603f={};var _0x1c3d8b={};var _0x537fbc;var _0x43179a;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x22e239[_0x2b51('0x65')]['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x49c653,null))[_0x2b51('0x1f')](function(_0x450a43){if(_0x450a43){_0x537fbc=_0x450a43;_0x1c3d8b[_0x2b51('0x48')]=_[_0x2b51('0x44')](db[_0x2b51('0x84')][_0x2b51('0x41')]);_0x1c3d8b['query']=_[_0x2b51('0x44')](_0x22e239[_0x2b51('0x45')]);_0x1c3d8b[_0x2b51('0x46')]=_['intersection'](_0x1c3d8b[_0x2b51('0x48')],_0x1c3d8b[_0x2b51('0x45')]);_0x40603f[_0x2b51('0x4a')]=_[_0x2b51('0x47')](_0x1c3d8b[_0x2b51('0x48')],qs[_0x2b51('0x49')](_0x22e239[_0x2b51('0x45')][_0x2b51('0x49')]));_0x40603f[_0x2b51('0x4a')]=_0x40603f[_0x2b51('0x4a')][_0x2b51('0x4b')]?_0x40603f[_0x2b51('0x4a')]:_0x1c3d8b['model'];_0x40603f[_0x2b51('0x4e')]=qs[_0x2b51('0x4f')](_0x22e239['query'][_0x2b51('0x4f')]);_0x40603f[_0x2b51('0x50')]=qs['filters'](_[_0x2b51('0x51')](_0x22e239['query'],_0x1c3d8b[_0x2b51('0x46')]));if(_0x22e239[_0x2b51('0x45')]['filter']){_0x40603f[_0x2b51('0x50')]=_['merge'](_0x40603f['where'],{'$or':_['map'](_0x40603f[_0x2b51('0x4a')],function(_0x31b2c2){var _0x61f02={};_0x61f02[_0x31b2c2]={'$like':'%'+_0x22e239[_0x2b51('0x45')][_0x2b51('0x52')]+'%'};return _0x61f02;})});}_0x40603f=_[_0x2b51('0x53')]({},_0x40603f,_0x22e239[_0x2b51('0x55')]);return _0x537fbc[_0x2b51('0xac')](_0x40603f);}})['then'](function(_0x27a2fd){if(_0x27a2fd){_0x43179a=_0x27a2fd[_0x2b51('0x4b')];if(!_0x22e239[_0x2b51('0x45')]['hasOwnProperty'](_0x2b51('0x4d'))){_0x40603f[_0x2b51('0x31')]=qs[_0x2b51('0x31')](_0x22e239[_0x2b51('0x45')][_0x2b51('0x31')]);_0x40603f['offset']=qs[_0x2b51('0x2f')](_0x22e239[_0x2b51('0x45')]['offset']);}return _0x537fbc['getApplications'](_0x40603f);}})[_0x2b51('0x1f')](function(_0x3d8cc4){if(_0x3d8cc4){return _0x3d8cc4?{'count':_0x43179a,'rows':_0x3d8cc4}:null;}})[_0x2b51('0x1f')](respondWithResult(_0x49c653,null))['catch'](handleError(_0x49c653,null));};exports['getInteractions']=function(_0x11d773,_0x5e958e,_0x4813c1){var _0x3ae574={'raw':![],'where':{}};var _0x1af36b={};var _0x1b57b0={'count':0x0,'rows':[]};return db[_0x2b51('0x56')][_0x2b51('0x68')]({'where':{'id':_0x11d773[_0x2b51('0x65')]['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x5e958e,null))['then'](function(_0x1b280f){if(_0x1b280f){_0x1af36b[_0x2b51('0x48')]=_[_0x2b51('0x44')](db[_0x2b51('0x8e')][_0x2b51('0x41')]);_0x1af36b['query']=_[_0x2b51('0x44')](_0x11d773[_0x2b51('0x45')]);_0x1af36b['filters']=_[_0x2b51('0x47')](_0x1af36b[_0x2b51('0x48')],_0x1af36b[_0x2b51('0x45')]);_0x3ae574[_0x2b51('0x4a')]=_[_0x2b51('0x47')](_0x1af36b[_0x2b51('0x48')],qs[_0x2b51('0x49')](_0x11d773[_0x2b51('0x45')][_0x2b51('0x49')]));_0x3ae574['attributes']=_0x3ae574['attributes'][_0x2b51('0x4b')]?_0x3ae574[_0x2b51('0x4a')]:_0x1af36b[_0x2b51('0x48')];if(!_0x11d773[_0x2b51('0x45')][_0x2b51('0x4c')](_0x2b51('0x4d'))){_0x3ae574[_0x2b51('0x31')]=qs[_0x2b51('0x31')](_0x11d773[_0x2b51('0x45')][_0x2b51('0x31')]);_0x3ae574[_0x2b51('0x2f')]=qs[_0x2b51('0x2f')](_0x11d773['query']['offset']);}_0x3ae574[_0x2b51('0x4e')]=qs['sort'](_0x11d773[_0x2b51('0x45')]['sort']);_0x3ae574[_0x2b51('0x50')]=qs[_0x2b51('0x46')](_[_0x2b51('0x51')](_0x11d773[_0x2b51('0x45')],_0x1af36b['filters']));_0x3ae574[_0x2b51('0x50')][_0x2b51('0x66')]=_0x1b280f['id'];if(_0x11d773['query'][_0x2b51('0x52')]){_0x3ae574[_0x2b51('0x50')]=_['merge'](_0x3ae574['where'],{'$or':_[_0x2b51('0x43')](_0x3ae574[_0x2b51('0x4a')],function(_0x5dd310){var _0x4344a6={};_0x4344a6[_0x5dd310]={'$like':'%'+_0x11d773[_0x2b51('0x45')]['filter']+'%'};return _0x4344a6;})});}_0x3ae574=_[_0x2b51('0x53')]({},_0x3ae574,_0x11d773[_0x2b51('0x55')]);return db[_0x2b51('0x8e')][_0x2b51('0x32')]({'where':_0x3ae574[_0x2b51('0x50')]})['then'](function(_0x23b374){_0x1b57b0[_0x2b51('0x32')]=_0x23b374;if(_0x11d773[_0x2b51('0x45')]['includeAll']){_0x3ae574[_0x2b51('0x5a')]=[{'model':db[_0x2b51('0x71')],'as':'Contact','required':![]},{'model':db[_0x2b51('0x9b')],'as':_0x2b51('0xad'),'attributes':['name',_0x2b51('0xae'),_0x2b51('0xaf')],'required':![]},{'model':db[_0x2b51('0xb0')],'as':_0x2b51('0xb1'),'attributes':['id',_0x2b51('0x54'),'color'],'where':_0x11d773['query'][_0x2b51('0xb2')]?{'id':_0x11d773['query'][_0x2b51('0xb2')]}:undefined,'required':_0x11d773[_0x2b51('0x45')][_0x2b51('0xb2')]?!![]:![]}];}return db[_0x2b51('0x8e')][_0x2b51('0x6c')](_0x3ae574);})[_0x2b51('0x1f')](function(_0x2b60cc){_0x1b57b0[_0x2b51('0x58')]=_0x2b60cc;return _0x1b57b0;});}})[_0x2b51('0x1f')](respondWithFilteredResult(_0x5e958e,_0x3ae574))[_0x2b51('0x2a')](handleError(_0x5e958e,null));};exports[_0x2b51('0xb3')]=function(_0x31b3cf,_0x55aba6,_0x5ec535){return db[_0x2b51('0x56')][_0x2b51('0x5b')]({'where':{'id':_0x31b3cf[_0x2b51('0x65')]['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0x55aba6,null))[_0x2b51('0x1f')](function(_0x51c66d){if(_0x51c66d){return _0x51c66d[_0x2b51('0xb3')](_0x31b3cf[_0x2b51('0x5d')][_0x2b51('0x6e')],_[_0x2b51('0xb4')](_0x31b3cf[_0x2b51('0x5d')],['ids','id'])||{})[_0x2b51('0x91')](function(_0x358812){for(var _0x45f927=0x0;_0x45f927<_0x31b3cf[_0x2b51('0x5d')]['ids'][_0x2b51('0x4b')];_0x45f927+=0x1){socket[_0x2b51('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x31b3cf[_0x2b51('0x5d')][_0x2b51('0x6e')][_0x45f927]),'OpenchannelAccountId':Number(_0x31b3cf['params']['id'])});}return _0x358812;});}})[_0x2b51('0x1f')](respondWithResult(_0x55aba6,null))[_0x2b51('0x2a')](handleError(_0x55aba6,null));};exports['removeAgents']=function(_0x1832ae,_0x4c1b1d,_0x158c1d){return db[_0x2b51('0x56')][_0x2b51('0x5b')]({'where':{'id':_0x1832ae['params']['id']}})['then'](handleEntityNotFound(_0x4c1b1d,null))[_0x2b51('0x1f')](function(_0x27692a){if(_0x27692a){return _0x27692a[_0x2b51('0xb6')](_0x1832ae[_0x2b51('0x45')][_0x2b51('0x6e')])[_0x2b51('0x1f')](function(){if(_[_0x2b51('0xb7')](_0x1832ae[_0x2b51('0x45')][_0x2b51('0x6e')])){for(var _0x357451=0x0;_0x357451<_0x1832ae[_0x2b51('0x45')]['ids']['length'];_0x357451+=0x1){socket[_0x2b51('0xb5')](_0x2b51('0xb8'),{'UserId':Number(_0x1832ae[_0x2b51('0x45')][_0x2b51('0x6e')][_0x357451]),'OpenchannelAccountId':Number(_0x1832ae[_0x2b51('0x65')]['id'])});}}else{socket['emit'](_0x2b51('0xb8'),{'UserId':Number(_0x1832ae[_0x2b51('0x45')][_0x2b51('0x6e')]),'OpenchannelAccountId':Number(_0x1832ae['params']['id'])});}});}})[_0x2b51('0x1f')](respondWithStatusCode(_0x4c1b1d,null))[_0x2b51('0x2a')](handleError(_0x4c1b1d,null));};exports[_0x2b51('0xb9')]=function(_0x561881,_0xacd1c2,_0x566ab1){var _0x1bca81={};var _0x2eb149={};var _0x1f56dd;var _0x196d55;return db[_0x2b51('0x56')][_0x2b51('0x68')]({'where':{'id':_0x561881['params']['id']}})[_0x2b51('0x1f')](handleEntityNotFound(_0xacd1c2,null))[_0x2b51('0x1f')](function(_0x5920d5){if(_0x5920d5){_0x1f56dd=_0x5920d5;_0x2eb149[_0x2b51('0x48')]=_[_0x2b51('0x44')](db[_0x2b51('0x9b')][_0x2b51('0x41')]);_0x2eb149[_0x2b51('0x45')]=_[_0x2b51('0x44')](_0x561881['query']);_0x2eb149[_0x2b51('0x46')]=_[_0x2b51('0x47')](_0x2eb149[_0x2b51('0x48')],_0x2eb149['query']);_0x1bca81[_0x2b51('0x4a')]=_['intersection'](_0x2eb149[_0x2b51('0x48')],qs[_0x2b51('0x49')](_0x561881['query'][_0x2b51('0x49')]));_0x1bca81[_0x2b51('0x4a')]=_0x1bca81[_0x2b51('0x4a')][_0x2b51('0x4b')]?_0x1bca81[_0x2b51('0x4a')]:_0x2eb149[_0x2b51('0x48')];_0x1bca81[_0x2b51('0x4e')]=qs[_0x2b51('0x4f')](_0x561881['query'][_0x2b51('0x4f')]);_0x1bca81['where']=qs['filters'](_[_0x2b51('0x51')](_0x561881[_0x2b51('0x45')],_0x2eb149[_0x2b51('0x46')]));if(_0x561881['query'][_0x2b51('0x52')]){_0x1bca81[_0x2b51('0x50')]=_[_0x2b51('0x53')](_0x1bca81['where'],{'$or':_['map'](_0x1bca81[_0x2b51('0x4a')],function(_0x27868c){var _0x111122={};_0x111122[_0x27868c]={'$like':'%'+_0x561881[_0x2b51('0x45')][_0x2b51('0x52')]+'%'};return _0x111122;})});}_0x1bca81=_[_0x2b51('0x53')]({},_0x1bca81,_0x561881['options']);return _0x1f56dd[_0x2b51('0xb9')](_0x1bca81);}})[_0x2b51('0x1f')](function(_0x1266f6){if(_0x1266f6){_0x196d55=_0x1266f6[_0x2b51('0x4b')];if(!_0x561881[_0x2b51('0x45')][_0x2b51('0x4c')](_0x2b51('0x4d'))){_0x1bca81['limit']=qs['limit'](_0x561881['query'][_0x2b51('0x31')]);_0x1bca81[_0x2b51('0x2f')]=qs[_0x2b51('0x2f')](_0x561881[_0x2b51('0x45')][_0x2b51('0x2f')]);}return _0x1f56dd[_0x2b51('0xb9')](_0x1bca81);}})['then'](function(_0x1a8c83){if(_0x1a8c83){return _0x1a8c83?{'count':_0x196d55,'rows':_0x1a8c83}:null;}})[_0x2b51('0x1f')](respondWithResult(_0xacd1c2,null))[_0x2b51('0x2a')](handleError(_0xacd1c2,null));};exports[_0x2b51('0x3e')]=function(_0x2b2c24,_0x54076f,_0x30f234){var _0x511c8f,_0x5059f7,_0xcc59d0;if(_[_0x2b51('0x79')](_0x2b2c24[_0x2b51('0x5d')][_0x2b51('0x5d')])||_0x2b2c24[_0x2b51('0x5d')][_0x2b51('0x5d')]===''){throw new db[(_0x2b51('0x72'))][(_0x2b51('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2b51('0x79')](_0x2b2c24[_0x2b51('0x5d')]['to'])){}_0x511c8f=_0x2b2c24[_0x2b51('0x5d')]['to'];return db['OpenchannelAccount'][_0x2b51('0x68')]({'where':{'id':_0x2b2c24['params']['id']}})['then'](handleEntityNotFound(_0x54076f,null))[_0x2b51('0x1f')](function(_0x31f90a){if(_0x31f90a){return db[_0x2b51('0x56')]['find']({'where':{'id':_0x31f90a['id']},'include':[{'model':db[_0x2b51('0x7f')],'as':_0x2b51('0x80'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x31f90a['mapKey']]:_0x511c8f},'limit':0x1,'order':[[_0x2b51('0x82'),'DESC']]}]}]})[_0x2b51('0x1f')](handleEntityNotFound(_0x54076f,null))[_0x2b51('0x1f')](function(_0x4ce6d4){if(_0x4ce6d4&&_0x4ce6d4[_0x2b51('0x80')]){_0x5059f7=_0x4ce6d4[_0x2b51('0x39')]({'plain':!![]});if(_0x5059f7[_0x2b51('0x80')]&&_0x5059f7[_0x2b51('0x80')]['Contacts'][_0x2b51('0x4b')]){return _0x5059f7[_0x2b51('0x80')][_0x2b51('0x81')][0x0];}return db[_0x2b51('0x71')][_0x2b51('0x5c')](_['defaults'](_0x2b2c24[_0x2b51('0x5d')],{'firstName':_0x511c8f,[_0x4ce6d4[_0x2b51('0x7d')]]:_0x511c8f,'phone':_0x511c8f,'ListId':_0x5059f7[_0x2b51('0x78')]}));}})[_0x2b51('0x1f')](handleEntityNotFound(_0x54076f,null))['then'](function(_0x273985){if(_0x273985){_0xcc59d0=_0x273985;return db[_0x2b51('0x8e')][_0x2b51('0x5b')]({'where':{'ContactId':_0xcc59d0['id'],'closed':![],'OpenchannelAccountId':_0x5059f7['id']}})['then'](function(_0x117c28){if(_0x117c28){return[_0x117c28,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x2b2c24[_0x2b51('0x5e')]['id'],'ContactId':_0xcc59d0['id'],'OpenchannelAccountId':_0x5059f7['id'],'lastMsgDirection':'out','firstMsgDirection':_0x2b51('0xba'),'Messages':[_[_0x2b51('0x53')](_0x2b2c24[_0x2b51('0x5d')],{'read':![],'body':_0x2b2c24[_0x2b51('0x5d')]['body'],'OpenchannelAccountId':_0x5059f7['id'],'UserId':_0x2b2c24[_0x2b51('0x5e')]['id'],'ContactId':_0xcc59d0['id']})]},{'include':[{'model':db[_0x2b51('0xbb')],'as':_0x2b51('0xbc')}]})[_0x2b51('0x1f')](function(_0x2d8614){return[_0x2d8614,!![]];});});}})[_0x2b51('0x91')](function(_0x5e3514,_0x1b09fa){if(_0x1b09fa){return _0x5e3514;}return db[_0x2b51('0xbb')]['create'](_['merge'](_0x2b2c24['body'],{'read':![],'body':_0x2b2c24[_0x2b51('0x5d')]['body'],'OpenchannelAccountId':_0x5059f7['id'],'OpenchannelInteractionId':_0x5e3514['id'],'UserId':_0x2b2c24[_0x2b51('0x5e')]['id'],'ContactId':_0xcc59d0['id']}))['then'](function(_0x2da41c){_0x5e3514[_0x2b51('0xbd')][_0x2b51('0xbc')]=[];_0x5e3514[_0x2b51('0xbd')][_0x2b51('0xbc')][_0x2b51('0xbe')](_0x2da41c[_0x2b51('0xbd')]);return _0x5e3514;});});}})[_0x2b51('0x1f')](respondWithResult(_0x54076f,null))[_0x2b51('0x2a')](handleError(_0x54076f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8af4fb4..6d8cf38 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 _0x99e9=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4334b6,_0xa69ea8){var _0x31bcb0=function(_0x2c385b){while(--_0x2c385b){_0x4334b6['push'](_0x4334b6['shift']());}};_0x31bcb0(++_0xa69ea8);}(_0x99e9,0xb4));var _0x999e=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x99e9[_0x1d80be];return _0xf9a4f3;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x999e('0x0'))['db'][_0x999e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x999e('0x2')](0x0);var events={'afterCreate':_0x999e('0x3'),'afterUpdate':'update','afterDestroy':_0x999e('0x4')};function emitEvent(_0x2f803e){return function(_0x3aac27,_0x4e2112,_0x296411){OpenchannelAccountEvents['emit'](_0x2f803e+':'+_0x3aac27['id'],_0x3aac27);OpenchannelAccountEvents[_0x999e('0x5')](_0x2f803e,_0x3aac27);_0x296411(null);};}for(var e in events){if(events[_0x999e('0x6')](e)){var event=events[e];OpenchannelAccount[_0x999e('0x7')](e,emitEvent(event));}}module[_0x999e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x0bb5,0x148));var _0x50bb=function(_0x1ba356,_0x5d62be){_0x1ba356=_0x1ba356-0x0;var _0x3bc269=_0x0bb5[_0x1ba356];return _0x3bc269;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('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 92600db..2c071cb 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(_0x7bf248,_0x138154){var _0x3f0a55=function(_0x1e707e){while(--_0x1e707e){_0x7bf248['push'](_0x7bf248['shift']());}};_0x3f0a55(++_0x138154);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x30fd03,_0x1a34b3){var _0x539f3f=function(_0x47a378){while(--_0x47a378){_0x30fd03['push'](_0x30fd03['shift']());}};_0x539f3f(++_0x1a34b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 f58b31a..9b36a65 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 _0xe205=['request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket'];(function(_0x381256,_0x1a1d8d){var _0x52ff69=function(_0x380fae){while(--_0x380fae){_0x381256['push'](_0x381256['shift']());}};_0x52ff69(++_0x1a1d8d);}(_0xe205,0xa7));var _0x5e20=function(_0x41ea1f,_0x59f342){_0x41ea1f=_0x41ea1f-0x0;var _0x1132e7=_0xe205[_0x41ea1f];return _0x1132e7;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5e20('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e20('0xd')]));require(_0x5e20('0xe'))['register'](socket);function respondWithRpcPromise(_0x91dca7,_0x3855dd,_0x13e7c2){return new BPromise(function(_0x24c9aa,_0x5cb51d){return client[_0x5e20('0xf')](_0x91dca7,_0x13e7c2)[_0x5e20('0x10')](function(_0x270689){logger[_0x5e20('0x11')](_0x5e20('0x12'),_0x3855dd,_0x5e20('0x13'));logger['debug'](_0x5e20('0x14'),_0x3855dd,_0x5e20('0x13'),JSON[_0x5e20('0x15')](_0x270689));if(_0x270689['error']){if(_0x270689[_0x5e20('0x16')]['code']===0x1f4){logger[_0x5e20('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x3855dd,_0x270689[_0x5e20('0x16')][_0x5e20('0x17')]);return _0x5cb51d(_0x270689[_0x5e20('0x16')][_0x5e20('0x17')]);}logger[_0x5e20('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x3855dd,_0x270689[_0x5e20('0x16')][_0x5e20('0x17')]);return _0x24c9aa(_0x270689[_0x5e20('0x16')][_0x5e20('0x17')]);}else{logger[_0x5e20('0x11')](_0x5e20('0x12'),_0x3855dd,_0x5e20('0x13'));_0x24c9aa(_0x270689[_0x5e20('0x18')]['message']);}})[_0x5e20('0x19')](function(_0xd38d1f){logger['error'](_0x5e20('0x12'),_0x3855dd,_0xd38d1f);_0x5cb51d(_0xd38d1f);});});} \ No newline at end of file +var _0x0c5d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x43f16f,_0x5a35a9){var _0x66c5c5=function(_0x76a0de){while(--_0x76a0de){_0x43f16f['push'](_0x43f16f['shift']());}};_0x66c5c5(++_0x5a35a9);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x2b8280,_0x211188){_0x2b8280=_0x2b8280-0x0;var _0x25ba0a=_0x0c5d[_0x2b8280];return _0x25ba0a;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var moment=require('moment');var BPromise=require(_0xd0c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0c5('0x3'));var db=require(_0xd0c5('0x4'))['db'];var utils=require(_0xd0c5('0x5'));var logger=require(_0xd0c5('0x6'))(_0xd0c5('0x7'));var config=require(_0xd0c5('0x8'));var jayson=require(_0xd0c5('0x9'));var client=jayson[_0xd0c5('0xa')]['http']({'port':0x232a});config[_0xd0c5('0xb')]=_['defaults'](config['redis'],{'host':_0xd0c5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd0c5('0xd'))[_0xd0c5('0xe')](socket);function respondWithRpcPromise(_0x50ed33,_0x33a77b,_0x3d53ab){return new BPromise(function(_0x5ae844,_0x458d02){return client[_0xd0c5('0xf')](_0x50ed33,_0x3d53ab)[_0xd0c5('0x10')](function(_0x30ea26){logger[_0xd0c5('0x11')](_0xd0c5('0x12'),_0x33a77b,_0xd0c5('0x13'));logger[_0xd0c5('0x14')](_0xd0c5('0x15'),_0x33a77b,_0xd0c5('0x13'),JSON[_0xd0c5('0x16')](_0x30ea26));if(_0x30ea26[_0xd0c5('0x17')]){if(_0x30ea26['error'][_0xd0c5('0x18')]===0x1f4){logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x30ea26[_0xd0c5('0x17')]['message']);return _0x458d02(_0x30ea26[_0xd0c5('0x17')][_0xd0c5('0x19')]);}logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x30ea26['error'][_0xd0c5('0x19')]);return _0x5ae844(_0x30ea26['error'][_0xd0c5('0x19')]);}else{logger['info'](_0xd0c5('0x12'),_0x33a77b,_0xd0c5('0x13'));_0x5ae844(_0x30ea26[_0xd0c5('0x1a')][_0xd0c5('0x19')]);}})[_0xd0c5('0x1b')](function(_0x410445){logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x410445);_0x458d02(_0x410445);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c4f4731..a5c1522 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 _0xd957=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelAccountEvents=require(_0x7d95('0x0'));var events=[_0x7d95('0x1'),'remove',_0x7d95('0x2')];function createListener(_0x2035b7,_0x5d0023){return function(_0xf7608a){_0x5d0023[_0x7d95('0x3')](_0x2035b7,_0xf7608a);};}function removeListener(_0x291309,_0x9750e1){return function(){OpenchannelAccountEvents[_0x7d95('0x4')](_0x291309,_0x9750e1);};}exports[_0x7d95('0x5')]=function(_0x2de581){for(var _0x514355=0x0,_0x181ca5=events[_0x7d95('0x6')];_0x514355<_0x181ca5;_0x514355++){var _0x4f10ec=events[_0x514355];var _0xfd14f6=createListener(_0x7d95('0x7')+_0x4f10ec,_0x2de581);OpenchannelAccountEvents['on'](_0x4f10ec,_0xfd14f6);}}; \ No newline at end of file +var _0x7dc2=['remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x1664cb,_0x57a951){var _0x4edd61=function(_0x13306c){while(--_0x13306c){_0x1664cb['push'](_0x1664cb['shift']());}};_0x4edd61(++_0x57a951);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x27dc('0x0'),_0x27dc('0x1')];function createListener(_0x49a9e7,_0x426f56){return function(_0x57d4b4){_0x426f56[_0x27dc('0x2')](_0x49a9e7,_0x57d4b4);};}function removeListener(_0x29ba23,_0x52337b){return function(){OpenchannelAccountEvents[_0x27dc('0x3')](_0x29ba23,_0x52337b);};}exports[_0x27dc('0x4')]=function(_0x5a442a){for(var _0x29eaac=0x0,_0x4d2e10=events[_0x27dc('0x5')];_0x29eaac<_0x4d2e10;_0x29eaac++){var _0x3b3eee=events[_0x29eaac];var _0x5181ab=createListener(_0x27dc('0x6')+_0x3b3eee,_0x5a442a);OpenchannelAccountEvents['on'](_0x3b3eee,_0x5181ab);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 81cd573..5f6b521 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 _0xc081=['multer','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','destroy'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xc081,0x1e4));var _0x1c08=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xc081[_0x499210];return _0x2e153d;};'use strict';var multer=require(_0x1c08('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1c08('0x1'));var express=require(_0x1c08('0x2'));var router=express[_0x1c08('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c08('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x1c08('0x5')]('/',auth['isAuthenticated'](),controller[_0x1c08('0x6')]);router[_0x1c08('0x5')](_0x1c08('0x7'),auth[_0x1c08('0x8')](),controller[_0x1c08('0x9')]);router['post']('/',auth[_0x1c08('0x8')](),controller['create']);router['put']('/:id',auth[_0x1c08('0x8')](),controller['update']);router['delete'](_0x1c08('0x7'),auth[_0x1c08('0x8')](),controller[_0x1c08('0xa')]);module['exports']=router; \ No newline at end of file +var _0xbf99=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','post','create','update','destroy','exports','multer','express','Router'];(function(_0x4e2250,_0x2c9f2f){var _0x1a25b0=function(_0x430d97){while(--_0x430d97){_0x4e2250['push'](_0x4e2250['shift']());}};_0x1a25b0(++_0x2c9f2f);}(_0xbf99,0x10d));var _0x9bf9=function(_0x531649,_0x3f8c92){_0x531649=_0x531649-0x0;var _0x548650=_0xbf99[_0x531649];return _0x548650;};'use strict';var multer=require(_0x9bf9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bf9('0x1'));var router=express[_0x9bf9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9bf9('0x3'));var interaction=require(_0x9bf9('0x4'));var config=require(_0x9bf9('0x5'));var controller=require(_0x9bf9('0x6'));router['get']('/',auth[_0x9bf9('0x7')](),controller[_0x9bf9('0x8')]);router[_0x9bf9('0x9')](_0x9bf9('0xa'),auth[_0x9bf9('0x7')](),controller['show']);router[_0x9bf9('0xb')]('/',auth[_0x9bf9('0x7')](),controller[_0x9bf9('0xc')]);router['put']('/:id',auth[_0x9bf9('0x7')](),controller[_0x9bf9('0xd')]);router['delete'](_0x9bf9('0xa'),auth[_0x9bf9('0x7')](),controller[_0x9bf9('0xe')]);module[_0x9bf9('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 300a4ef..2d102ed 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 _0x26dd=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x46d7b0,_0x45bc2e){var _0x4935d0=function(_0x344f7e){while(--_0x344f7e){_0x46d7b0['push'](_0x46d7b0['shift']());}};_0x4935d0(++_0x45bc2e);}(_0x26dd,0xdf));var _0xd26d=function(_0x4a129a,_0x267674){_0x4a129a=_0x4a129a-0x0;var _0x49919f=_0x26dd[_0x4a129a];return _0x49919f;};'use strict';var Sequelize=require('sequelize');module[_0xd26d('0x0')]={'priority':{'type':Sequelize[_0xd26d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd26d('0x2')],'allowNull':![],'defaultValue':_0xd26d('0x3')},'appdata':{'type':Sequelize[_0xd26d('0x4')]()},'description':{'type':Sequelize[_0xd26d('0x2')]},'interval':{'type':Sequelize[_0xd26d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x82ce=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x2e8d11,_0x5de71a){var _0x30bb51=function(_0x4edf30){while(--_0x4edf30){_0x2e8d11['push'](_0x2e8d11['shift']());}};_0x30bb51(++_0x5de71a);}(_0x82ce,0xc2));var _0xe82c=function(_0x442e5b,_0x511cff){_0x442e5b=_0x442e5b-0x0;var _0x3f8b52=_0x82ce[_0x442e5b];return _0x3f8b52;};'use strict';var Sequelize=require('sequelize');module[_0xe82c('0x0')]={'priority':{'type':Sequelize[_0xe82c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe82c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe82c('0x2')]},'interval':{'type':Sequelize[_0xe82c('0x2')],'defaultValue':_0xe82c('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 4fef9a5..7a6b5e7 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 _0x3df4=['reject','save','update','destroy','then','error','stack','name','send','map','OpenchannelApplication','fieldName','type','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x3ef7f1,_0x341d2c){var _0x296bdd=function(_0x3eb09a){while(--_0x3eb09a){_0x3ef7f1['push'](_0x3ef7f1['shift']());}};_0x296bdd(++_0x341d2c);}(_0x3df4,0xff));var _0x43df=function(_0x2c5dcd,_0x10a72c){_0x2c5dcd=_0x2c5dcd-0x0;var _0x19688d=_0x3df4[_0x2c5dcd];return _0x19688d;};'use strict';var emlformat=require(_0x43df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43df('0x1'));var jsonpatch=require(_0x43df('0x2'));var rp=require(_0x43df('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43df('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x43df('0x5'));var ejs=require(_0x43df('0x6'));var fs=require('fs');var fs_extra=require(_0x43df('0x7'));var _=require('lodash');var squel=require(_0x43df('0x8'));var crypto=require(_0x43df('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x43df('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x43df('0xa'));var authService=require(_0x43df('0xb'));var qs=require(_0x43df('0xc'));var as=require(_0x43df('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43df('0xe'));var utils=require(_0x43df('0xf'));var config=require(_0x43df('0x10'));var licenseUtil=require(_0x43df('0x11'));var db=require(_0x43df('0x12'))['db'];function respondWithStatusCode(_0x134ad9,_0x156633){_0x156633=_0x156633||0xcc;return function(_0x242a95){if(_0x242a95){return _0x134ad9[_0x43df('0x13')](_0x156633);}return _0x134ad9[_0x43df('0x14')](_0x156633)[_0x43df('0x15')]();};}function respondWithResult(_0x1e1667,_0x474406){_0x474406=_0x474406||0xc8;return function(_0x2b72ab){if(_0x2b72ab){return _0x1e1667['status'](_0x474406)[_0x43df('0x16')](_0x2b72ab);}};}function respondWithFilteredResult(_0x96d1c6,_0x597db4){return function(_0x1ca12f){if(_0x1ca12f){var _0xcecf81=typeof _0x597db4[_0x43df('0x17')]===_0x43df('0x18')&&typeof _0x597db4['limit']===_0x43df('0x18');var _0x217d20=_0x1ca12f[_0x43df('0x19')];var _0x5cd4a0=_0xcecf81?0x0:_0x597db4[_0x43df('0x17')];var _0x337d0c=_0xcecf81?_0x1ca12f[_0x43df('0x19')]:_0x597db4[_0x43df('0x17')]+_0x597db4[_0x43df('0x1a')];var _0xafee69;if(_0x337d0c>=_0x217d20){_0x337d0c=_0x217d20;_0xafee69=0xc8;}else{_0xafee69=0xce;}_0x96d1c6[_0x43df('0x14')](_0xafee69);return _0x96d1c6['set'](_0x43df('0x1b'),_0x5cd4a0+'-'+_0x337d0c+'/'+_0x217d20)[_0x43df('0x16')](_0x1ca12f);}return null;};}function patchUpdates(_0x31fa26){return function(_0x3a28a3){try{jsonpatch[_0x43df('0x1c')](_0x3a28a3,_0x31fa26,!![]);}catch(_0x4c2078){return BPromise[_0x43df('0x1d')](_0x4c2078);}return _0x3a28a3[_0x43df('0x1e')]();};}function saveUpdates(_0x479bc6,_0x5458ad){return function(_0x48ac3e){if(_0x48ac3e){return _0x48ac3e[_0x43df('0x1f')](_0x479bc6)['then'](function(_0x45a254){return _0x45a254;});}return null;};}function removeEntity(_0x447cb1,_0x4885fd){return function(_0x56979c){if(_0x56979c){return _0x56979c[_0x43df('0x20')]()[_0x43df('0x21')](function(){_0x447cb1[_0x43df('0x14')](0xcc)[_0x43df('0x15')]();});}};}function handleEntityNotFound(_0x1556f4,_0x17416){return function(_0x374b4e){if(!_0x374b4e){_0x1556f4['sendStatus'](0x194);}return _0x374b4e;};}function handleError(_0x2ad5dd,_0x4c2d10){_0x4c2d10=_0x4c2d10||0x1f4;return function(_0x24ba19){logger[_0x43df('0x22')](_0x24ba19[_0x43df('0x23')]);if(_0x24ba19[_0x43df('0x24')]){delete _0x24ba19[_0x43df('0x24')];}_0x2ad5dd[_0x43df('0x14')](_0x4c2d10)[_0x43df('0x25')](_0x24ba19);};}exports['index']=function(_0x28ae3e,_0x559fcd){var _0x36ab6b={},_0x3a5cfc={},_0x55e6a1={'count':0x0,'rows':[]};var _0x29d7a7=_[_0x43df('0x26')](db[_0x43df('0x27')]['rawAttributes'],function(_0x57d5ad){return{'name':_0x57d5ad[_0x43df('0x28')],'type':_0x57d5ad[_0x43df('0x29')]['key']};});_0x3a5cfc['model']=_[_0x43df('0x26')](_0x29d7a7,_0x43df('0x24'));_0x3a5cfc[_0x43df('0x2a')]=_[_0x43df('0x2b')](_0x28ae3e['query']);_0x3a5cfc['filters']=_[_0x43df('0x2c')](_0x3a5cfc['model'],_0x3a5cfc['query']);_0x36ab6b[_0x43df('0x2d')]=_[_0x43df('0x2c')](_0x3a5cfc[_0x43df('0x2e')],qs['fields'](_0x28ae3e[_0x43df('0x2a')][_0x43df('0x2f')]));_0x36ab6b[_0x43df('0x2d')]=_0x36ab6b[_0x43df('0x2d')]['length']?_0x36ab6b['attributes']:_0x3a5cfc[_0x43df('0x2e')];if(!_0x28ae3e[_0x43df('0x2a')][_0x43df('0x30')](_0x43df('0x31'))){_0x36ab6b[_0x43df('0x1a')]=qs[_0x43df('0x1a')](_0x28ae3e[_0x43df('0x2a')][_0x43df('0x1a')]);_0x36ab6b[_0x43df('0x17')]=qs['offset'](_0x28ae3e[_0x43df('0x2a')][_0x43df('0x17')]);}_0x36ab6b[_0x43df('0x32')]=qs[_0x43df('0x33')](_0x28ae3e[_0x43df('0x2a')]['sort']);_0x36ab6b[_0x43df('0x34')]=qs[_0x43df('0x35')](_[_0x43df('0x36')](_0x28ae3e[_0x43df('0x2a')],_0x3a5cfc[_0x43df('0x35')]),_0x29d7a7);if(_0x28ae3e[_0x43df('0x2a')][_0x43df('0x37')]){_0x36ab6b[_0x43df('0x34')]=_[_0x43df('0x38')](_0x36ab6b[_0x43df('0x34')],{'$or':_['map'](_0x29d7a7,function(_0x5e74ed){if(_0x5e74ed[_0x43df('0x29')]!==_0x43df('0x39')){var _0x58eb2a={};_0x58eb2a[_0x5e74ed[_0x43df('0x24')]]={'$like':'%'+_0x28ae3e[_0x43df('0x2a')][_0x43df('0x37')]+'%'};return _0x58eb2a;}})});}_0x36ab6b=_[_0x43df('0x38')]({},_0x36ab6b,_0x28ae3e[_0x43df('0x3a')]);var _0x35fbaa={'where':_0x36ab6b[_0x43df('0x34')]};return db[_0x43df('0x27')][_0x43df('0x19')](_0x35fbaa)[_0x43df('0x21')](function(_0xa26942){_0x55e6a1[_0x43df('0x19')]=_0xa26942;if(_0x28ae3e['query'][_0x43df('0x3b')]){_0x36ab6b[_0x43df('0x3c')]=[{'all':!![]}];}return db[_0x43df('0x27')][_0x43df('0x3d')](_0x36ab6b);})[_0x43df('0x21')](function(_0x306387){_0x55e6a1[_0x43df('0x3e')]=_0x306387;return _0x55e6a1;})[_0x43df('0x21')](respondWithFilteredResult(_0x559fcd,_0x36ab6b))[_0x43df('0x3f')](handleError(_0x559fcd,null));};exports[_0x43df('0x40')]=function(_0x4d8276,_0x19d0e9){var _0x4039de={'raw':!![],'where':{'id':_0x4d8276[_0x43df('0x41')]['id']}},_0x47e3ea={};_0x47e3ea[_0x43df('0x2e')]=_[_0x43df('0x2b')](db[_0x43df('0x27')][_0x43df('0x42')]);_0x47e3ea[_0x43df('0x2a')]=_['keys'](_0x4d8276[_0x43df('0x2a')]);_0x47e3ea[_0x43df('0x35')]=_[_0x43df('0x2c')](_0x47e3ea['model'],_0x47e3ea['query']);_0x4039de[_0x43df('0x2d')]=_[_0x43df('0x2c')](_0x47e3ea[_0x43df('0x2e')],qs['fields'](_0x4d8276[_0x43df('0x2a')][_0x43df('0x2f')]));_0x4039de[_0x43df('0x2d')]=_0x4039de[_0x43df('0x2d')][_0x43df('0x43')]?_0x4039de[_0x43df('0x2d')]:_0x47e3ea[_0x43df('0x2e')];if(_0x4d8276[_0x43df('0x2a')][_0x43df('0x3b')]){_0x4039de['include']=[{'all':!![]}];}_0x4039de=_[_0x43df('0x38')]({},_0x4039de,_0x4d8276[_0x43df('0x3a')]);return db['OpenchannelApplication'][_0x43df('0x44')](_0x4039de)['then'](handleEntityNotFound(_0x19d0e9,null))['then'](respondWithResult(_0x19d0e9,null))[_0x43df('0x3f')](handleError(_0x19d0e9,null));};exports[_0x43df('0x45')]=function(_0x2b3590,_0x4f0385){return db[_0x43df('0x27')]['create'](_0x2b3590[_0x43df('0x46')],{})['then'](respondWithResult(_0x4f0385,0xc9))[_0x43df('0x3f')](handleError(_0x4f0385,null));};exports[_0x43df('0x1f')]=function(_0x2bf6e6,_0x7a96c6){if(_0x2bf6e6[_0x43df('0x46')]['id']){delete _0x2bf6e6[_0x43df('0x46')]['id'];}return db[_0x43df('0x27')]['find']({'where':{'id':_0x2bf6e6['params']['id']}})[_0x43df('0x21')](handleEntityNotFound(_0x7a96c6,null))[_0x43df('0x21')](saveUpdates(_0x2bf6e6[_0x43df('0x46')],null))[_0x43df('0x21')](respondWithResult(_0x7a96c6,null))[_0x43df('0x3f')](handleError(_0x7a96c6,null));};exports['destroy']=function(_0x58a4f2,_0x3be4f7){return db['OpenchannelApplication'][_0x43df('0x44')]({'where':{'id':_0x58a4f2[_0x43df('0x41')]['id']}})[_0x43df('0x21')](handleEntityNotFound(_0x3be4f7,null))['then'](removeEntity(_0x3be4f7,null))[_0x43df('0x3f')](handleError(_0x3be4f7,null));}; \ No newline at end of file +var _0x17a8=['send','index','map','OpenchannelApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','catch','create','body','params','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x17a8,0x156));var _0x817a=function(_0x53c506,_0x1c0fe8){_0x53c506=_0x53c506-0x0;var _0x165888=_0x17a8[_0x53c506];return _0x165888;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x817a('0x0'));var zipdir=require(_0x817a('0x1'));var jsonpatch=require(_0x817a('0x2'));var rp=require(_0x817a('0x3'));var moment=require('moment');var BPromise=require(_0x817a('0x4'));var Mustache=require(_0x817a('0x5'));var util=require(_0x817a('0x6'));var path=require(_0x817a('0x7'));var sox=require(_0x817a('0x8'));var csv=require(_0x817a('0x9'));var ejs=require(_0x817a('0xa'));var fs=require('fs');var fs_extra=require(_0x817a('0xb'));var _=require(_0x817a('0xc'));var squel=require(_0x817a('0xd'));var crypto=require('crypto');var jsforce=require(_0x817a('0xe'));var deskjs=require(_0x817a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x817a('0x10'));var Redis=require(_0x817a('0x11'));var authService=require(_0x817a('0x12'));var qs=require(_0x817a('0x13'));var as=require(_0x817a('0x14'));var hardwareService=require(_0x817a('0x15'));var logger=require(_0x817a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x817a('0x17'));var db=require(_0x817a('0x18'))['db'];function respondWithStatusCode(_0x5cdb0c,_0x21fd8b){_0x21fd8b=_0x21fd8b||0xcc;return function(_0x49cd1b){if(_0x49cd1b){return _0x5cdb0c['sendStatus'](_0x21fd8b);}return _0x5cdb0c['status'](_0x21fd8b)[_0x817a('0x19')]();};}function respondWithResult(_0x144c54,_0x567a03){_0x567a03=_0x567a03||0xc8;return function(_0x5a1cda){if(_0x5a1cda){return _0x144c54[_0x817a('0x1a')](_0x567a03)[_0x817a('0x1b')](_0x5a1cda);}};}function respondWithFilteredResult(_0x3b8649,_0x30489d){return function(_0x49faf9){if(_0x49faf9){var _0x29981c=typeof _0x30489d[_0x817a('0x1c')]==='undefined'&&typeof _0x30489d[_0x817a('0x1d')]===_0x817a('0x1e');var _0x34c9a3=_0x49faf9[_0x817a('0x1f')];var _0x53e211=_0x29981c?0x0:_0x30489d['offset'];var _0x1de3ae=_0x29981c?_0x49faf9[_0x817a('0x1f')]:_0x30489d[_0x817a('0x1c')]+_0x30489d[_0x817a('0x1d')];var _0xb16d4a;if(_0x1de3ae>=_0x34c9a3){_0x1de3ae=_0x34c9a3;_0xb16d4a=0xc8;}else{_0xb16d4a=0xce;}_0x3b8649['status'](_0xb16d4a);return _0x3b8649[_0x817a('0x20')](_0x817a('0x21'),_0x53e211+'-'+_0x1de3ae+'/'+_0x34c9a3)[_0x817a('0x1b')](_0x49faf9);}return null;};}function patchUpdates(_0x57a8d3){return function(_0x34b5b6){try{jsonpatch[_0x817a('0x22')](_0x34b5b6,_0x57a8d3,!![]);}catch(_0x477f2b){return BPromise[_0x817a('0x23')](_0x477f2b);}return _0x34b5b6[_0x817a('0x24')]();};}function saveUpdates(_0x2d922d,_0x458342){return function(_0x35b235){if(_0x35b235){return _0x35b235[_0x817a('0x25')](_0x2d922d)[_0x817a('0x26')](function(_0x5091e3){return _0x5091e3;});}return null;};}function removeEntity(_0x53eeb0,_0x2acb3a){return function(_0x519814){if(_0x519814){return _0x519814['destroy']()[_0x817a('0x26')](function(){_0x53eeb0[_0x817a('0x1a')](0xcc)[_0x817a('0x19')]();});}};}function handleEntityNotFound(_0x1c35f6,_0x555cc){return function(_0x59ba8c){if(!_0x59ba8c){_0x1c35f6[_0x817a('0x27')](0x194);}return _0x59ba8c;};}function handleError(_0x561faf,_0x240c9c){_0x240c9c=_0x240c9c||0x1f4;return function(_0x5b76bb){logger[_0x817a('0x28')](_0x5b76bb[_0x817a('0x29')]);if(_0x5b76bb[_0x817a('0x2a')]){delete _0x5b76bb[_0x817a('0x2a')];}_0x561faf['status'](_0x240c9c)[_0x817a('0x2b')](_0x5b76bb);};}exports[_0x817a('0x2c')]=function(_0x4a1c98,_0x2e4b05){var _0x3a3e4a={},_0x484e97={},_0x154183={'count':0x0,'rows':[]};var _0x2b1998=_[_0x817a('0x2d')](db[_0x817a('0x2e')][_0x817a('0x2f')],function(_0x294b56){return{'name':_0x294b56['fieldName'],'type':_0x294b56[_0x817a('0x30')]['key']};});_0x484e97[_0x817a('0x31')]=_['map'](_0x2b1998,_0x817a('0x2a'));_0x484e97[_0x817a('0x32')]=_[_0x817a('0x33')](_0x4a1c98['query']);_0x484e97[_0x817a('0x34')]=_[_0x817a('0x35')](_0x484e97[_0x817a('0x31')],_0x484e97[_0x817a('0x32')]);_0x3a3e4a[_0x817a('0x36')]=_[_0x817a('0x35')](_0x484e97[_0x817a('0x31')],qs['fields'](_0x4a1c98[_0x817a('0x32')][_0x817a('0x37')]));_0x3a3e4a[_0x817a('0x36')]=_0x3a3e4a[_0x817a('0x36')]['length']?_0x3a3e4a['attributes']:_0x484e97['model'];if(!_0x4a1c98[_0x817a('0x32')][_0x817a('0x38')](_0x817a('0x39'))){_0x3a3e4a['limit']=qs[_0x817a('0x1d')](_0x4a1c98[_0x817a('0x32')][_0x817a('0x1d')]);_0x3a3e4a[_0x817a('0x1c')]=qs['offset'](_0x4a1c98[_0x817a('0x32')]['offset']);}_0x3a3e4a[_0x817a('0x3a')]=qs[_0x817a('0x3b')](_0x4a1c98[_0x817a('0x32')][_0x817a('0x3b')]);_0x3a3e4a[_0x817a('0x3c')]=qs[_0x817a('0x34')](_[_0x817a('0x3d')](_0x4a1c98[_0x817a('0x32')],_0x484e97[_0x817a('0x34')]),_0x2b1998);if(_0x4a1c98['query'][_0x817a('0x3e')]){_0x3a3e4a[_0x817a('0x3c')]=_[_0x817a('0x3f')](_0x3a3e4a[_0x817a('0x3c')],{'$or':_[_0x817a('0x2d')](_0x2b1998,function(_0x1b920e){if(_0x1b920e[_0x817a('0x30')]!=='VIRTUAL'){var _0xeb65ce={};_0xeb65ce[_0x1b920e[_0x817a('0x2a')]]={'$like':'%'+_0x4a1c98[_0x817a('0x32')][_0x817a('0x3e')]+'%'};return _0xeb65ce;}})});}_0x3a3e4a=_[_0x817a('0x3f')]({},_0x3a3e4a,_0x4a1c98[_0x817a('0x40')]);var _0x599ba9={'where':_0x3a3e4a[_0x817a('0x3c')]};return db[_0x817a('0x2e')]['count'](_0x599ba9)['then'](function(_0x4790de){_0x154183[_0x817a('0x1f')]=_0x4790de;if(_0x4a1c98[_0x817a('0x32')][_0x817a('0x41')]){_0x3a3e4a[_0x817a('0x42')]=[{'all':!![]}];}return db[_0x817a('0x2e')][_0x817a('0x43')](_0x3a3e4a);})[_0x817a('0x26')](function(_0x4aecf5){_0x154183[_0x817a('0x44')]=_0x4aecf5;return _0x154183;})[_0x817a('0x26')](respondWithFilteredResult(_0x2e4b05,_0x3a3e4a))['catch'](handleError(_0x2e4b05,null));};exports[_0x817a('0x45')]=function(_0x1c3150,_0xbcb377){var _0x1679bc={'raw':!![],'where':{'id':_0x1c3150['params']['id']}},_0x23703e={};_0x23703e[_0x817a('0x31')]=_[_0x817a('0x33')](db['OpenchannelApplication'][_0x817a('0x2f')]);_0x23703e[_0x817a('0x32')]=_[_0x817a('0x33')](_0x1c3150[_0x817a('0x32')]);_0x23703e[_0x817a('0x34')]=_[_0x817a('0x35')](_0x23703e[_0x817a('0x31')],_0x23703e['query']);_0x1679bc[_0x817a('0x36')]=_[_0x817a('0x35')](_0x23703e[_0x817a('0x31')],qs['fields'](_0x1c3150[_0x817a('0x32')][_0x817a('0x37')]));_0x1679bc[_0x817a('0x36')]=_0x1679bc['attributes'][_0x817a('0x46')]?_0x1679bc[_0x817a('0x36')]:_0x23703e['model'];if(_0x1c3150[_0x817a('0x32')][_0x817a('0x41')]){_0x1679bc[_0x817a('0x42')]=[{'all':!![]}];}_0x1679bc=_[_0x817a('0x3f')]({},_0x1679bc,_0x1c3150[_0x817a('0x40')]);return db[_0x817a('0x2e')]['find'](_0x1679bc)[_0x817a('0x26')](handleEntityNotFound(_0xbcb377,null))[_0x817a('0x26')](respondWithResult(_0xbcb377,null))[_0x817a('0x47')](handleError(_0xbcb377,null));};exports['create']=function(_0x5e34a3,_0x3bace5){return db[_0x817a('0x2e')][_0x817a('0x48')](_0x5e34a3['body'],{})[_0x817a('0x26')](respondWithResult(_0x3bace5,0xc9))['catch'](handleError(_0x3bace5,null));};exports[_0x817a('0x25')]=function(_0x3a06d4,_0x12441f){if(_0x3a06d4[_0x817a('0x49')]['id']){delete _0x3a06d4['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3a06d4[_0x817a('0x4a')]['id']}})[_0x817a('0x26')](handleEntityNotFound(_0x12441f,null))['then'](saveUpdates(_0x3a06d4[_0x817a('0x49')],null))[_0x817a('0x26')](respondWithResult(_0x12441f,null))['catch'](handleError(_0x12441f,null));};exports[_0x817a('0x4b')]=function(_0x51d19a,_0x15713d){return db['OpenchannelApplication'][_0x817a('0x4c')]({'where':{'id':_0x51d19a[_0x817a('0x4a')]['id']}})[_0x817a('0x26')](handleEntityNotFound(_0x15713d,null))[_0x817a('0x26')](removeEntity(_0x15713d,null))['catch'](handleError(_0x15713d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 938bfbe..c8c752e 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 _0xa8d7=['define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3753e8,_0x3bfdd3){var _0x4ffb3b=function(_0x3eb91e){while(--_0x3eb91e){_0x3753e8['push'](_0x3753e8['shift']());}};_0x4ffb3b(++_0x3bfdd3);}(_0xa8d7,0x154));var _0x7a8d=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xa8d7[_0x258b93];return _0x35484b;};'use strict';var _=require(_0x7a8d('0x0'));var util=require('util');var logger=require(_0x7a8d('0x1'))('api');var moment=require(_0x7a8d('0x2'));var BPromise=require('bluebird');var rp=require(_0x7a8d('0x3'));var fs=require('fs');var path=require(_0x7a8d('0x4'));var rimraf=require(_0x7a8d('0x5'));var config=require(_0x7a8d('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x7a8d('0x7')]=function(_0x19f684,_0x55dfdf){return _0x19f684[_0x7a8d('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x7a8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a8d('0xa'),'collate':_0x7a8d('0xb')});}; \ No newline at end of file +var _0x0704=['exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','./openchannelApplication.attributes'];(function(_0x1a3e69,_0x26b8c0){var _0x353eec=function(_0x5393c5){while(--_0x5393c5){_0x1a3e69['push'](_0x1a3e69['shift']());}};_0x353eec(++_0x26b8c0);}(_0x0704,0x1d3));var _0x4070=function(_0x37ad5a,_0x55b590){_0x37ad5a=_0x37ad5a-0x0;var _0x1ab506=_0x0704[_0x37ad5a];return _0x1ab506;};'use strict';var _=require('lodash');var util=require(_0x4070('0x0'));var logger=require('../../config/logger')(_0x4070('0x1'));var moment=require(_0x4070('0x2'));var BPromise=require(_0x4070('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4070('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4070('0x5'));module[_0x4070('0x6')]=function(_0x57eee1,_0x2bc208){return _0x57eee1['define'](_0x4070('0x7'),attributes,{'tableName':_0x4070('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4070('0x9'),'collate':_0x4070('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 31a6749..fdf5ceb 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 _0xc381=['../../config/logger','../../config/environment','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','UpdateOpenchannelApplication','OpenchannelApplication','update','raw','options','where','attributes','limit','debug','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3afd09,_0x496caa){var _0x5c6d35=function(_0x4682a2){while(--_0x4682a2){_0x3afd09['push'](_0x3afd09['shift']());}};_0x5c6d35(++_0x496caa);}(_0xc381,0xcb));var _0x1c38=function(_0x508276,_0x56c804){_0x508276=_0x508276-0x0;var _0xfc4c3=_0xc381[_0x508276];return _0xfc4c3;};'use strict';var _=require(_0x1c38('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c38('0x1'));var rs=require(_0x1c38('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c38('0x3'))['db'];var utils=require(_0x1c38('0x4'));var logger=require(_0x1c38('0x5'))('rpc');var config=require(_0x1c38('0x6'));var jayson=require(_0x1c38('0x7'));var client=jayson['client'][_0x1c38('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d618,_0xb1c887,_0x1012d0){return new BPromise(function(_0x107b09,_0x15766b){return client['request'](_0x33d618,_0x1012d0)[_0x1c38('0x9')](function(_0x5c8917){logger[_0x1c38('0xa')](_0x1c38('0xb'),_0xb1c887,_0x1c38('0xc'));logger['debug'](_0x1c38('0xd'),_0xb1c887,_0x1c38('0xc'),JSON['stringify'](_0x5c8917));if(_0x5c8917[_0x1c38('0xe')]){if(_0x5c8917[_0x1c38('0xe')]['code']===0x1f4){logger[_0x1c38('0xe')](_0x1c38('0xb'),_0xb1c887,_0x5c8917['error'][_0x1c38('0xf')]);return _0x15766b(_0x5c8917[_0x1c38('0xe')][_0x1c38('0xf')]);}logger['error'](_0x1c38('0xb'),_0xb1c887,_0x5c8917[_0x1c38('0xe')][_0x1c38('0xf')]);return _0x107b09(_0x5c8917[_0x1c38('0xe')][_0x1c38('0xf')]);}else{logger[_0x1c38('0xa')](_0x1c38('0xb'),_0xb1c887,_0x1c38('0xc'));_0x107b09(_0x5c8917['result'][_0x1c38('0xf')]);}})['catch'](function(_0x3d20f1){logger[_0x1c38('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0xb1c887,_0x3d20f1);_0x15766b(_0x3d20f1);});});}exports[_0x1c38('0x10')]=function(_0x14d623){var _0x3b295c=this;return new Promise(function(_0x59a584,_0x3c1122){return db[_0x1c38('0x11')][_0x1c38('0x12')](_0x14d623['body'],{'raw':_0x14d623['options']?_0x14d623['options'][_0x1c38('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14d623['options']?_0x14d623[_0x1c38('0x14')][_0x1c38('0x15')]||null:null,'attributes':_0x14d623['options']?_0x14d623[_0x1c38('0x14')][_0x1c38('0x16')]||null:null,'limit':_0x14d623[_0x1c38('0x14')]?_0x14d623[_0x1c38('0x14')][_0x1c38('0x17')]||null:null})[_0x1c38('0x9')](function(_0x214f4c){logger[_0x1c38('0xa')](_0x1c38('0x10'),_0x14d623);logger[_0x1c38('0x18')]('UpdateOpenchannelApplication',_0x14d623,JSON['stringify'](_0x214f4c));_0x59a584(_0x214f4c);})[_0x1c38('0x19')](function(_0x14d59b){logger['error'](_0x1c38('0x10'),_0x14d59b[_0x1c38('0xf')],_0x14d623);_0x3c1122(_0x3b295c[_0x1c38('0xe')](0x1f4,_0x14d59b['message']));});});}; \ No newline at end of file +var _0x53ce=['limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw'];(function(_0x543c8a,_0x269673){var _0x6f8929=function(_0x34496a){while(--_0x34496a){_0x543c8a['push'](_0x543c8a['shift']());}};_0x6f8929(++_0x269673);}(_0x53ce,0x7a));var _0xe53c=function(_0x1d616e,_0x1be7d2){_0x1d616e=_0x1d616e-0x0;var _0xaeb225=_0x53ce[_0x1d616e];return _0xaeb225;};'use strict';var _=require('lodash');var util=require(_0xe53c('0x0'));var moment=require(_0xe53c('0x1'));var BPromise=require(_0xe53c('0x2'));var rs=require(_0xe53c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe53c('0x4'))['db'];var utils=require(_0xe53c('0x5'));var logger=require(_0xe53c('0x6'))(_0xe53c('0x7'));var config=require(_0xe53c('0x8'));var jayson=require(_0xe53c('0x9'));var client=jayson[_0xe53c('0xa')][_0xe53c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a05ed,_0x16a4c5,_0x21fef9){return new BPromise(function(_0xe53436,_0x4a20d1){return client[_0xe53c('0xc')](_0x1a05ed,_0x21fef9)[_0xe53c('0xd')](function(_0xb95eee){logger[_0xe53c('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x16a4c5,_0xe53c('0xf'));logger[_0xe53c('0x10')](_0xe53c('0x11'),_0x16a4c5,'request\x20sent',JSON['stringify'](_0xb95eee));if(_0xb95eee[_0xe53c('0x12')]){if(_0xb95eee['error']['code']===0x1f4){logger[_0xe53c('0x12')](_0xe53c('0x13'),_0x16a4c5,_0xb95eee[_0xe53c('0x12')][_0xe53c('0x14')]);return _0x4a20d1(_0xb95eee[_0xe53c('0x12')]['message']);}logger[_0xe53c('0x12')](_0xe53c('0x13'),_0x16a4c5,_0xb95eee['error'][_0xe53c('0x14')]);return _0xe53436(_0xb95eee[_0xe53c('0x12')][_0xe53c('0x14')]);}else{logger[_0xe53c('0xe')](_0xe53c('0x13'),_0x16a4c5,_0xe53c('0xf'));_0xe53436(_0xb95eee[_0xe53c('0x15')][_0xe53c('0x14')]);}})[_0xe53c('0x16')](function(_0x1e79c3){logger[_0xe53c('0x12')](_0xe53c('0x13'),_0x16a4c5,_0x1e79c3);_0x4a20d1(_0x1e79c3);});});}exports[_0xe53c('0x17')]=function(_0x614c28){var _0x2f0cfb=this;return new Promise(function(_0x2d20ae,_0x3a37f2){return db['OpenchannelApplication'][_0xe53c('0x18')](_0x614c28[_0xe53c('0x19')],{'raw':_0x614c28[_0xe53c('0x1a')]?_0x614c28[_0xe53c('0x1a')][_0xe53c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x614c28[_0xe53c('0x1a')]?_0x614c28[_0xe53c('0x1a')]['where']||null:null,'attributes':_0x614c28['options']?_0x614c28[_0xe53c('0x1a')]['attributes']||null:null,'limit':_0x614c28[_0xe53c('0x1a')]?_0x614c28[_0xe53c('0x1a')][_0xe53c('0x1c')]||null:null})[_0xe53c('0xd')](function(_0x159687){logger['info'](_0xe53c('0x17'),_0x614c28);logger[_0xe53c('0x10')](_0xe53c('0x17'),_0x614c28,JSON[_0xe53c('0x1d')](_0x159687));_0x2d20ae(_0x159687);})[_0xe53c('0x16')](function(_0xbb531b){logger[_0xe53c('0x12')](_0xe53c('0x17'),_0xbb531b['message'],_0x614c28);_0x3a37f2(_0x2f0cfb[_0xe53c('0x12')](0x1f4,_0xbb531b[_0xe53c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a8691db..e02baef 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 _0x9bbc=['connect-timeout','Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','getMessages','post','create','/:id/messages','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x1f83ac,_0x8016fc){var _0x1985de=function(_0x1d5947){while(--_0x1d5947){_0x1f83ac['push'](_0x1f83ac['shift']());}};_0x1985de(++_0x8016fc);}(_0x9bbc,0x1a1));var _0xc9bb=function(_0x5ddcdc,_0x47b288){_0x5ddcdc=_0x5ddcdc-0x0;var _0x19639f=_0x9bbc[_0x5ddcdc];return _0x19639f;};'use strict';var multer=require(_0xc9bb('0x0'));var util=require(_0xc9bb('0x1'));var path=require(_0xc9bb('0x2'));var timeout=require(_0xc9bb('0x3'));var express=require('express');var router=express[_0xc9bb('0x4')]();var fs_extra=require(_0xc9bb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc9bb('0x6'));var config=require('../../config/environment');var controller=require(_0xc9bb('0x7'));router[_0xc9bb('0x8')]('/',auth[_0xc9bb('0x9')](),controller['index']);router[_0xc9bb('0x8')](_0xc9bb('0xa'),auth[_0xc9bb('0x9')](),controller[_0xc9bb('0xb')]);router['get'](_0xc9bb('0xc'),auth[_0xc9bb('0x9')](),controller['show']);router[_0xc9bb('0x8')]('/:id/messages',auth[_0xc9bb('0x9')](),controller[_0xc9bb('0xd')]);router[_0xc9bb('0x8')]('/:id/download',auth[_0xc9bb('0x9')](),controller['download']);router[_0xc9bb('0xe')]('/',auth[_0xc9bb('0x9')](),controller[_0xc9bb('0xf')]);router['post'](_0xc9bb('0x10'),auth[_0xc9bb('0x9')](),controller['addMessage']);router[_0xc9bb('0xe')](_0xc9bb('0x11'),auth[_0xc9bb('0x9')](),interaction['tracked'](_0xc9bb('0x12'),_0xc9bb('0x13')),controller[_0xc9bb('0x14')]);router[_0xc9bb('0x15')](_0xc9bb('0xc'),auth[_0xc9bb('0x9')](),interaction['tracked'](_0xc9bb('0x12'),_0xc9bb('0x16')),controller['update']);router[_0xc9bb('0x17')](_0xc9bb('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc9bb('0x12'),_0xc9bb('0x18')),controller[_0xc9bb('0x19')]);router[_0xc9bb('0x17')]('/:id/tags',auth[_0xc9bb('0x9')](),controller[_0xc9bb('0x1a')]);module[_0xc9bb('0x1b')]=router; \ No newline at end of file +var _0xac2d=['openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','openchannel'];(function(_0x2de8bc,_0x49c2a2){var _0x18c574=function(_0x3d3d19){while(--_0x3d3d19){_0x2de8bc['push'](_0x2de8bc['shift']());}};_0x18c574(++_0x49c2a2);}(_0xac2d,0x18c));var _0xdac2=function(_0x7276b8,_0x32d520){_0x7276b8=_0x7276b8-0x0;var _0x81306b=_0xac2d[_0x7276b8];return _0x81306b;};'use strict';var multer=require(_0xdac2('0x0'));var util=require(_0xdac2('0x1'));var path=require('path');var timeout=require(_0xdac2('0x2'));var express=require(_0xdac2('0x3'));var router=express[_0xdac2('0x4')]();var fs_extra=require(_0xdac2('0x5'));var auth=require(_0xdac2('0x6'));var interaction=require(_0xdac2('0x7'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xdac2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdac2('0x9'),auth[_0xdac2('0xa')](),controller[_0xdac2('0xb')]);router[_0xdac2('0x8')](_0xdac2('0xc'),auth[_0xdac2('0xa')](),controller['show']);router['get'](_0xdac2('0xd'),auth[_0xdac2('0xa')](),controller[_0xdac2('0xe')]);router['get'](_0xdac2('0xf'),auth[_0xdac2('0xa')](),controller[_0xdac2('0x10')]);router[_0xdac2('0x11')]('/',auth[_0xdac2('0xa')](),controller[_0xdac2('0x12')]);router[_0xdac2('0x11')](_0xdac2('0xd'),auth[_0xdac2('0xa')](),controller['addMessage']);router[_0xdac2('0x11')]('/:id/tags',auth[_0xdac2('0xa')](),interaction['tracked'](_0xdac2('0x13'),_0xdac2('0x14')),controller[_0xdac2('0x15')]);router[_0xdac2('0x16')]('/:id',auth[_0xdac2('0xa')](),interaction[_0xdac2('0x17')]('openchannel',_0xdac2('0x18')),controller[_0xdac2('0x19')]);router[_0xdac2('0x1a')](_0xdac2('0xc'),auth[_0xdac2('0xa')](),interaction[_0xdac2('0x17')](_0xdac2('0x13'),_0xdac2('0x1b')),controller[_0xdac2('0x1c')]);router[_0xdac2('0x1a')](_0xdac2('0x1d'),auth[_0xdac2('0xa')](),controller[_0xdac2('0x1e')]);module[_0xdac2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c485964..be2ac86 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 _0x5566=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x30b5e6,_0x4655e2){var _0x20ec32=function(_0x4891f8){while(--_0x4891f8){_0x30b5e6['push'](_0x30b5e6['shift']());}};_0x20ec32(++_0x4655e2);}(_0x5566,0x179));var _0x6556=function(_0x2924e6,_0x4694aa){_0x2924e6=_0x2924e6-0x0;var _0x57a53b=_0x5566[_0x2924e6];return _0x57a53b;};'use strict';var Sequelize=require(_0x6556('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6556('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6556('0x2')]},'disposition':{'type':Sequelize[_0x6556('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6556('0x3')]},'note':{'type':Sequelize[_0x6556('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6556('0x3')]},'externalUrl':{'type':Sequelize[_0x6556('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6556('0x4')]('in',_0x6556('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6556('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6556('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x6556('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9d62=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x9d62,0xaf));var _0x29d6=function(_0x4364b4,_0x3fcc80){_0x4364b4=_0x4364b4-0x0;var _0x442873=_0x9d62[_0x4364b4];return _0x442873;};'use strict';var Sequelize=require(_0x29d6('0x0'));module[_0x29d6('0x1')]={'closed':{'type':Sequelize[_0x29d6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x29d6('0x3')]},'disposition':{'type':Sequelize[_0x29d6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x29d6('0x4')]},'note':{'type':Sequelize[_0x29d6('0x4')]},'read1stAt':{'type':Sequelize[_0x29d6('0x3')]},'threadId':{'type':Sequelize[_0x29d6('0x4')]},'externalUrl':{'type':Sequelize[_0x29d6('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x29d6('0x5')]('in',_0x29d6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x29d6('0x5')]('in',_0x29d6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x29d6('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x29d6('0x2')],'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 b85cb9d..a9630bb 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 _0x3fbf=['OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','N.A.','closed','threadId','Public','basename','createReadStream','createWriteStream','direction','out','Contact','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','rawAttributes','filters','intersection','fields','attributes','includeAll','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','keys','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','firstName','lastName','Attachment','Messages','createdAt','secret','read'];(function(_0x1ce0ac,_0xc4b457){var _0x516fbf=function(_0x20ed51){while(--_0x20ed51){_0x1ce0ac['push'](_0x1ce0ac['shift']());}};_0x516fbf(++_0xc4b457);}(_0x3fbf,0x187));var _0xf3fb=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x3fbf[_0x4fe19c];return _0x952ac7;};'use strict';var rimraf=require(_0xf3fb('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf3fb('0x1'));var util=require(_0xf3fb('0x2'));var path=require(_0xf3fb('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf3fb('0x4'));var Redis=require(_0xf3fb('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf3fb('0x6'));var pdf=require(_0xf3fb('0x7'));var logger=require('../../config/logger')(_0xf3fb('0x8'));var config=require(_0xf3fb('0x9'));var db=require('../../mysqldb')['db'];config[_0xf3fb('0xa')]=_['defaults'](config[_0xf3fb('0xa')],{'host':_0xf3fb('0xb'),'port':0x18eb});var socket=require(_0xf3fb('0xc'))(new Redis(config[_0xf3fb('0xa')]));require(_0xf3fb('0xd'))['register'](socket);function respondWithStatusCode(_0x270cb7,_0x2fb52f){_0x2fb52f=_0x2fb52f||0xcc;return function(_0x4a563f){if(_0x4a563f){return _0x270cb7[_0xf3fb('0xe')](_0x2fb52f);}return _0x270cb7[_0xf3fb('0xf')](_0x2fb52f)['end']();};}function respondWithResult(_0xcc0fdd,_0x23c594){_0x23c594=_0x23c594||0xc8;return function(_0x29c129){if(_0x29c129){return _0xcc0fdd[_0xf3fb('0xf')](_0x23c594)[_0xf3fb('0x10')](_0x29c129);}};}function respondWithFilteredResult(_0x1b7ff2,_0x266480){return function(_0x3362ca){if(_0x3362ca){var _0x2c2bc6=typeof _0x266480[_0xf3fb('0x11')]===_0xf3fb('0x12')&&typeof _0x266480[_0xf3fb('0x13')]===_0xf3fb('0x12');var _0x465072=_0x3362ca[_0xf3fb('0x14')];var _0x1a731d=_0x2c2bc6?0x0:_0x266480[_0xf3fb('0x11')];var _0xd93e30=_0x2c2bc6?_0x3362ca['count']:_0x266480[_0xf3fb('0x11')]+_0x266480['limit'];var _0x5bed6d;if(_0xd93e30>=_0x465072){_0xd93e30=_0x465072;_0x5bed6d=0xc8;}else{_0x5bed6d=0xce;}_0x1b7ff2['status'](_0x5bed6d);return _0x1b7ff2[_0xf3fb('0x15')]('Content-Range',_0x1a731d+'-'+_0xd93e30+'/'+_0x465072)[_0xf3fb('0x10')](_0x3362ca);}return null;};}function saveUpdates(_0x58e592){return function(_0x39b3c8){if(_0x39b3c8){return _0x39b3c8[_0xf3fb('0x16')](_0x58e592)[_0xf3fb('0x17')](function(_0x26bfc3){return _0x26bfc3;});}return null;};}function removeEntity(_0x19c554){return function(_0x5b8d63){if(_0x5b8d63){return _0x5b8d63[_0xf3fb('0x18')]()[_0xf3fb('0x17')](function(){_0x19c554[_0xf3fb('0xf')](0xcc)[_0xf3fb('0x19')]();});}};}function handleEntityNotFound(_0x56a7ea){return function(_0x533f09){if(!_0x533f09){_0x56a7ea[_0xf3fb('0xe')](0x194);}return _0x533f09;};}function handleError(_0x5d5afc,_0x387293){_0x387293=_0x387293||0x1f4;return function(_0x15a6f5){logger[_0xf3fb('0x1a')](_0x15a6f5[_0xf3fb('0x1b')]);if(_0x15a6f5[_0xf3fb('0x1c')]){delete _0x15a6f5['name'];}_0x5d5afc[_0xf3fb('0xf')](_0x387293)[_0xf3fb('0x1d')](_0x15a6f5);};}exports[_0xf3fb('0x1e')]=function(_0x10b899,_0x338059){var _0x29ce0c={};var _0x28ec5e=_[_0xf3fb('0x1f')](db[_0xf3fb('0x20')]['rawAttributes'],function(_0x4774db){return{'name':_0x4774db[_0xf3fb('0x21')],'type':_0x4774db[_0xf3fb('0x22')][_0xf3fb('0x23')]};});_0x29ce0c=qs[_0xf3fb('0x24')](_0x28ec5e,_0x10b899);return interaction[_0xf3fb('0x25')](_0xf3fb('0x26'),_0x10b899[_0xf3fb('0x27')],_0x10b899[_0xf3fb('0x28')],_0x29ce0c,_0x28ec5e)[_0xf3fb('0x17')](respondWithFilteredResult(_0x338059,_0x29ce0c))[_0xf3fb('0x29')](handleError(_0x338059,null));};exports[_0xf3fb('0x2a')]=function(_0x4326d4,_0x4b329d){var _0x1f9773={};if(_0x4326d4['query'][_0xf3fb('0x22')]&&_0x4326d4[_0xf3fb('0x27')][_0xf3fb('0x22')]===_0xf3fb('0x2b')){_0x1f9773[_0xf3fb('0x2b')]=_0x4326d4[_0xf3fb('0x2c')]['id'];}else{_0x1f9773['id']=_0x4326d4[_0xf3fb('0x2c')]['id'];}var _0x38377c={'raw':![],'where':_0x1f9773},_0x31cb6f={};_0x31cb6f[_0xf3fb('0x2d')]=_['keys'](db['OpenchannelInteraction'][_0xf3fb('0x2e')]);_0x31cb6f[_0xf3fb('0x27')]=_['keys'](_0x4326d4[_0xf3fb('0x27')]);_0x31cb6f[_0xf3fb('0x2f')]=_[_0xf3fb('0x30')](_0x31cb6f['model'],_0x31cb6f[_0xf3fb('0x27')]);_0x38377c['attributes']=_[_0xf3fb('0x30')](_0x31cb6f['model'],qs['fields'](_0x4326d4[_0xf3fb('0x27')][_0xf3fb('0x31')]));_0x38377c[_0xf3fb('0x32')]=_0x38377c[_0xf3fb('0x32')]['length']?_0x38377c['attributes']:_0x31cb6f[_0xf3fb('0x2d')];if(_0x4326d4[_0xf3fb('0x27')][_0xf3fb('0x33')]){_0x38377c['include']=[{'all':!![]}];}_0x38377c=_[_0xf3fb('0x34')]({},_0x38377c,_0x4326d4['options']);return db[_0xf3fb('0x20')][_0xf3fb('0x35')](_0x38377c)[_0xf3fb('0x17')](handleEntityNotFound(_0x4b329d,null))[_0xf3fb('0x17')](respondWithResult(_0x4b329d,null))[_0xf3fb('0x29')](handleError(_0x4b329d,null));};exports[_0xf3fb('0x36')]=function(_0xe6f8f9,_0x2ecb28){return db[_0xf3fb('0x20')][_0xf3fb('0x36')](_0xe6f8f9['body'],{})[_0xf3fb('0x17')](respondWithResult(_0x2ecb28,0xc9))['catch'](handleError(_0x2ecb28,null));};exports[_0xf3fb('0x16')]=function(_0x50a09c,_0x1e41ac){if(_0x50a09c[_0xf3fb('0x37')]['id']){delete _0x50a09c[_0xf3fb('0x37')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x50a09c['params']['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x1e41ac,null))['then'](saveUpdates(_0x50a09c[_0xf3fb('0x37')],null))[_0xf3fb('0x17')](respondWithResult(_0x1e41ac,null))['catch'](handleError(_0x1e41ac,null));};exports['destroy']=function(_0x3dd669,_0x39e7e0){return db[_0xf3fb('0x20')][_0xf3fb('0x35')]({'where':{'id':_0x3dd669[_0xf3fb('0x2c')]['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x39e7e0,null))[_0xf3fb('0x17')](removeEntity(_0x39e7e0,null))[_0xf3fb('0x29')](handleError(_0x39e7e0,null));};exports['describe']=function(_0x877f19,_0x512d2f){return db[_0xf3fb('0x20')][_0xf3fb('0x38')]()[_0xf3fb('0x17')](respondWithResult(_0x512d2f,null))[_0xf3fb('0x29')](handleError(_0x512d2f,null));};exports[_0xf3fb('0x39')]=function(_0x4718d1,_0x371211){return db[_0xf3fb('0x3a')]['find']({'where':{'id':_0x4718d1[_0xf3fb('0x2c')]['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x371211,null))['then'](function(_0xb944b8){if(_0xb944b8){return _0xb944b8[_0xf3fb('0x39')](_0x4718d1[_0xf3fb('0x37')][_0xf3fb('0x3b')],_['omit'](_0x4718d1[_0xf3fb('0x37')],[_0xf3fb('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x371211,null))[_0xf3fb('0x29')](handleError(_0x371211,null));};exports['getMessages']=function(_0x2c9271,_0x2161d1){var _0x315707={'raw':![],'where':{}};var _0x4aed4e={};var _0x1196c0={'count':0x0,'rows':[]};return db[_0xf3fb('0x20')][_0xf3fb('0x3c')]({'where':{'id':_0x2c9271['params']['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x2161d1,null))['then'](function(_0x38eada){if(_0x38eada){_0x4aed4e[_0xf3fb('0x2d')]=_['keys'](db['OpenchannelMessage'][_0xf3fb('0x2e')]);_0x4aed4e[_0xf3fb('0x27')]=_[_0xf3fb('0x3d')](_0x2c9271['query']);_0x4aed4e['filters']=_['intersection'](_0x4aed4e[_0xf3fb('0x2d')],_0x4aed4e[_0xf3fb('0x27')]);_0x315707['attributes']=_[_0xf3fb('0x30')](_0x4aed4e[_0xf3fb('0x2d')],qs[_0xf3fb('0x31')](_0x2c9271['query'][_0xf3fb('0x31')]));_0x315707[_0xf3fb('0x32')]=_0x315707[_0xf3fb('0x32')]['length']?_0x315707['attributes']:_0x4aed4e[_0xf3fb('0x2d')];if(!_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x3e')](_0xf3fb('0x3f'))){_0x315707[_0xf3fb('0x13')]=qs[_0xf3fb('0x13')](_0x2c9271['query'][_0xf3fb('0x13')]);_0x315707[_0xf3fb('0x11')]=qs[_0xf3fb('0x11')](_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x11')]);}_0x315707['order']=qs[_0xf3fb('0x40')](_0x2c9271[_0xf3fb('0x27')]['sort']);_0x315707[_0xf3fb('0x41')]=qs['filters'](_['pick'](_0x2c9271[_0xf3fb('0x27')],_0x4aed4e[_0xf3fb('0x2f')]));_0x315707[_0xf3fb('0x41')][_0xf3fb('0x42')]=_0x38eada['id'];if(_0x2c9271['query'][_0xf3fb('0x43')]){_0x315707['where']=_[_0xf3fb('0x34')](_0x315707[_0xf3fb('0x41')],{'$or':_[_0xf3fb('0x1f')](_0x315707[_0xf3fb('0x32')],function(_0x260e6a){var _0x24615d={};_0x24615d[_0x260e6a]={'$like':'%'+_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x43')]+'%'};return _0x24615d;})});}if(_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x44')]){var _0x68ff8=_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x44')][_0xf3fb('0x45')](',');var _0x2d7e2d={};_0x2d7e2d[_0x68ff8[0x0]]={'$gte':moment(_0x68ff8[0x1])[_0xf3fb('0x46')](_0xf3fb('0x47'))};_0x315707[_0xf3fb('0x41')]=_[_0xf3fb('0x34')](_0x315707['where'],_0x2d7e2d);}_0x315707=_[_0xf3fb('0x34')]({},_0x315707,_0x2c9271[_0xf3fb('0x48')]);return db[_0xf3fb('0x3a')]['count']({'where':_0x315707[_0xf3fb('0x41')]})[_0xf3fb('0x17')](function(_0x4e2a65){_0x1196c0[_0xf3fb('0x14')]=_0x4e2a65;if(_0x2c9271[_0xf3fb('0x27')][_0xf3fb('0x33')]){_0x315707[_0xf3fb('0x49')]=[{'all':!![]}];}return db[_0xf3fb('0x3a')][_0xf3fb('0x25')](_0x315707);})['then'](function(_0x3eec4d){_0x1196c0[_0xf3fb('0x4a')]=_0x3eec4d;return _0x1196c0;});}})['then'](respondWithFilteredResult(_0x2161d1,_0x315707))[_0xf3fb('0x29')](handleError(_0x2161d1,null));};exports[_0xf3fb('0x4b')]=function(_0x339e74,_0x20308a){return db['OpenchannelInteraction'][_0xf3fb('0x35')]({'where':{'id':_0x339e74[_0xf3fb('0x2c')]['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x20308a,null))[_0xf3fb('0x17')](function(_0x16e750){if(_0x16e750){return _0x16e750[_0xf3fb('0x4c')](_0x339e74['body'][_0xf3fb('0x3b')],_['omit'](_0x339e74['body'],['ids','id'])||{})['spread'](function(){return db[_0xf3fb('0x4d')][_0xf3fb('0x25')]({'attributes':['id',_0xf3fb('0x1c'),'color'],'where':{'id':_0x339e74[_0xf3fb('0x37')][_0xf3fb('0x3b')]}});})[_0xf3fb('0x17')](function(_0x456b40){socket[_0xf3fb('0x4e')](_0xf3fb('0x4f'),{'id':Number(_0x339e74[_0xf3fb('0x2c')]['id']),'tags':_0x456b40||[]});return{'id':Number(_0x339e74['params']['id']),'tags':_0x456b40||[]};});}})[_0xf3fb('0x17')](respondWithResult(_0x20308a,null))[_0xf3fb('0x29')](handleError(_0x20308a,null));};exports[_0xf3fb('0x50')]=function(_0x3ec6a5,_0x4fc979){return db[_0xf3fb('0x20')]['find']({'where':{'id':_0x3ec6a5[_0xf3fb('0x2c')]['id']}})[_0xf3fb('0x17')](handleEntityNotFound(_0x4fc979,null))['then'](function(_0xd63905){if(_0xd63905){return _0xd63905[_0xf3fb('0x50')](_0x3ec6a5['query'][_0xf3fb('0x3b')]);}})[_0xf3fb('0x17')](respondWithStatusCode(_0x4fc979,null))['catch'](handleError(_0x4fc979,null));};exports['download']=function(_0x15036d,_0x50d67d){var _0x4240f4=moment()[_0xf3fb('0x51')]()[_0xf3fb('0x52')]();var _0x12b61b=path[_0xf3fb('0x53')](config[_0xf3fb('0x54')],_0xf3fb('0x55'),_0xf3fb('0x56'),'tmp');var _0x19752c=path[_0xf3fb('0x53')](config['root'],_0xf3fb('0x55'),_0xf3fb('0x56'),'attachments');var _0x2d0a51=path['join'](_0x12b61b,_0x4240f4);var _0x1f71fb=util['format'](_0xf3fb('0x57'),_0x15036d[_0xf3fb('0x2c')]['id'],_0x4240f4);var _0x141185=path[_0xf3fb('0x53')](_0x12b61b,_0x1f71fb);var _0x50ca63=[];_0x50ca63[_0xf3fb('0x58')]({'model':db[_0xf3fb('0x59')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x50ca63[_0xf3fb('0x58')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf3fb('0x5a'),_0xf3fb('0x5b')],'raw':!![]});if(_0x15036d[_0xf3fb('0x27')]['attachments']){_0x50ca63['push']({'model':db[_0xf3fb('0x5c')],'as':_0xf3fb('0x5c'),'raw':!![]});}var _0x2d5872=[{'model':db[_0xf3fb('0x3a')],'as':_0xf3fb('0x5d'),'attributes':['id',_0xf3fb('0x37'),_0xf3fb('0x5e'),'direction',_0xf3fb('0x5f'),_0xf3fb('0x60')],'include':_0x50ca63}];_0x2d5872[_0xf3fb('0x58')]({'model':db[_0xf3fb('0x61')],'as':_0xf3fb('0x62'),'attributes':['id',_0xf3fb('0x1c')]});_0x2d5872[_0xf3fb('0x58')]({'model':db['User'],'as':_0xf3fb('0x63'),'attributes':['id',_0xf3fb('0x64')]});return db[_0xf3fb('0x20')]['find']({'where':{'id':_0x15036d[_0xf3fb('0x2c')]['id']},'include':_0x2d5872})[_0xf3fb('0x17')](handleEntityNotFound(_0x50d67d,null))[_0xf3fb('0x17')](function(_0x42b247){if(_0x42b247){var _0x19930b=_0x42b247[_0xf3fb('0x65')]({'plain':!![]});fs[_0xf3fb('0x66')](_0x2d0a51);var _0x1d0a38={'channel':_0xf3fb('0x67'),'account':_0x19930b[_0xf3fb('0x62')][_0xf3fb('0x1c')],'agent':_0x19930b[_0xf3fb('0x63')]?_0x19930b[_0xf3fb('0x63')][_0xf3fb('0x64')]:_0xf3fb('0x68'),'createdAt':moment(_0x19930b[_0xf3fb('0x5e')])[_0xf3fb('0x46')](_0xf3fb('0x47'))[_0xf3fb('0x52')](),'closedAt':_0x19930b[_0xf3fb('0x69')]?moment(_0x19930b['closedAt'])[_0xf3fb('0x46')](_0xf3fb('0x47'))[_0xf3fb('0x52')]():'','disposition':_0x19930b['disposition'],'visibility':_0x19930b[_0xf3fb('0x6a')]?_0xf3fb('0x6b'):'Private','messages':_(_0x19930b[_0xf3fb('0x5d')])[_0xf3fb('0x43')]({'secret':![]})[_0xf3fb('0x1f')](function(_0x53b540){if(_0x53b540[_0xf3fb('0x5c')]){var _0x5f2527=path[_0xf3fb('0x53')](_0x19752c,_0x53b540[_0xf3fb('0x5c')][_0xf3fb('0x6c')]);if(fs['existsSync'](_0x5f2527)){fs[_0xf3fb('0x6d')](_0x5f2527)['pipe'](fs[_0xf3fb('0x6e')](path[_0xf3fb('0x53')](_0x2d0a51,_0x53b540[_0xf3fb('0x5c')][_0xf3fb('0x6c')])));}}return{'date':moment(_0x53b540[_0xf3fb('0x5e')])['format'](_0xf3fb('0x47'))['toString'](),'sender':_0x53b540[_0xf3fb('0x6f')]===_0xf3fb('0x70')?_0x53b540[_0xf3fb('0x59')]?_0x53b540[_0xf3fb('0x59')][_0xf3fb('0x64')]:'System':_0x53b540['Contact'][_0xf3fb('0x5a')]+(_0x53b540[_0xf3fb('0x71')][_0xf3fb('0x5b')]?'\x20'+_0x53b540[_0xf3fb('0x71')][_0xf3fb('0x5b')]:''),'body':_0x53b540[_0xf3fb('0x5c')]?_0x53b540[_0xf3fb('0x5c')][_0xf3fb('0x6c')]:_0x53b540[_0xf3fb('0x37')],'direction':_0x53b540[_0xf3fb('0x6f')]===_0xf3fb('0x70')?'A':'C','secret':_0x53b540['secret'],'read':_0x53b540['read'],'attachment':_0x53b540[_0xf3fb('0x5c')]};})[_0xf3fb('0x72')]()};return ejs[_0xf3fb('0x73')](path[_0xf3fb('0x53')](config['root'],_0xf3fb('0x55'),'views',_0xf3fb('0x74')),{'interaction':_0x1d0a38})[_0xf3fb('0x17')](function(_0x55bde7){var _0x557765=path[_0xf3fb('0x53')](_0x2d0a51,_0xf3fb('0x75')+_0x19930b['id']+'-'+_0x4240f4+'.pdf');var _0x428ba9={'path':_0x557765,'channel':_0xf3fb('0x67'),'interactionId':_0x19930b['id']};return pdf[_0xf3fb('0x76')](_0x55bde7,_0x428ba9);})[_0xf3fb('0x17')](function(){return new Promise(function(_0x418faf,_0x4b4efe){zipdir(_0x2d0a51,{'saveTo':_0x141185},function(_0x772d9e,_0x1c8f50){if(_0x772d9e)return _0x4b4efe(_0x772d9e);return _0x418faf(_0x1c8f50);});})[_0xf3fb('0x17')](function(){return new Promise(function(_0x5471a1,_0x367679){rimraf(_0x2d0a51,function(_0x2834be){if(_0x2834be)_0x367679(_0x2834be);return _0x5471a1();});});})[_0xf3fb('0x17')](function(){return _0x50d67d[_0xf3fb('0x77')](_0x141185,_0x1f71fb,function(_0x5bf26c){if(_0x5bf26c){logger[_0xf3fb('0x1a')](_0xf3fb('0x78'),_0x5bf26c);}else{fs[_0xf3fb('0x79')](_0x141185);}});});});}else{return _0x50d67d['sendStatus'](0xc8);}})[_0xf3fb('0x29')](handleError(_0x50d67d,null));}; \ No newline at end of file +var _0x7447=['query','user','catch','show','type','from','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','split','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','join','server','root','files','attachments','format','transcript-%d-%s.zip','User','fullname','push','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','out','System','Contact','lastName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','findAll','openchannel'];(function(_0x43af48,_0x21ae46){var _0x3fc076=function(_0x5d2e7e){while(--_0x5d2e7e){_0x43af48['push'](_0x43af48['shift']());}};_0x3fc076(++_0x21ae46);}(_0x7447,0x1f1));var _0x7744=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x7447[_0x234ae1];return _0x227ba0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7744('0x0'));var moment=require('moment');var util=require(_0x7744('0x1'));var path=require(_0x7744('0x2'));var ejs=require(_0x7744('0x3'));var fs=require('fs');var _=require(_0x7744('0x4'));var Redis=require('ioredis');var interaction=require(_0x7744('0x5'));var qs=require(_0x7744('0x6'));var pdf=require(_0x7744('0x7'));var logger=require(_0x7744('0x8'))('api');var config=require(_0x7744('0x9'));var db=require(_0x7744('0xa'))['db'];config[_0x7744('0xb')]=_[_0x7744('0xc')](config['redis'],{'host':_0x7744('0xd'),'port':0x18eb});var socket=require(_0x7744('0xe'))(new Redis(config[_0x7744('0xb')]));require(_0x7744('0xf'))[_0x7744('0x10')](socket);function respondWithStatusCode(_0xa58681,_0x26c844){_0x26c844=_0x26c844||0xcc;return function(_0x29e481){if(_0x29e481){return _0xa58681[_0x7744('0x11')](_0x26c844);}return _0xa58681['status'](_0x26c844)[_0x7744('0x12')]();};}function respondWithResult(_0x4a63ad,_0x1925d5){_0x1925d5=_0x1925d5||0xc8;return function(_0x5e8c06){if(_0x5e8c06){return _0x4a63ad['status'](_0x1925d5)[_0x7744('0x13')](_0x5e8c06);}};}function respondWithFilteredResult(_0x397421,_0x2a92f2){return function(_0x4516db){if(_0x4516db){var _0x29cdf7=typeof _0x2a92f2[_0x7744('0x14')]===_0x7744('0x15')&&typeof _0x2a92f2['limit']===_0x7744('0x15');var _0x2f3038=_0x4516db['count'];var _0x312573=_0x29cdf7?0x0:_0x2a92f2['offset'];var _0xa8ed08=_0x29cdf7?_0x4516db[_0x7744('0x16')]:_0x2a92f2[_0x7744('0x14')]+_0x2a92f2[_0x7744('0x17')];var _0x368831;if(_0xa8ed08>=_0x2f3038){_0xa8ed08=_0x2f3038;_0x368831=0xc8;}else{_0x368831=0xce;}_0x397421[_0x7744('0x18')](_0x368831);return _0x397421[_0x7744('0x19')](_0x7744('0x1a'),_0x312573+'-'+_0xa8ed08+'/'+_0x2f3038)[_0x7744('0x13')](_0x4516db);}return null;};}function saveUpdates(_0x59c8f6){return function(_0x144278){if(_0x144278){return _0x144278[_0x7744('0x1b')](_0x59c8f6)[_0x7744('0x1c')](function(_0x135c16){return _0x135c16;});}return null;};}function removeEntity(_0x12dec1){return function(_0x1d2753){if(_0x1d2753){return _0x1d2753[_0x7744('0x1d')]()[_0x7744('0x1c')](function(){_0x12dec1['status'](0xcc)[_0x7744('0x12')]();});}};}function handleEntityNotFound(_0x8b1ddf){return function(_0x5e9345){if(!_0x5e9345){_0x8b1ddf[_0x7744('0x11')](0x194);}return _0x5e9345;};}function handleError(_0x4ce128,_0x3e3642){_0x3e3642=_0x3e3642||0x1f4;return function(_0x3fdaa7){logger[_0x7744('0x1e')](_0x3fdaa7[_0x7744('0x1f')]);if(_0x3fdaa7[_0x7744('0x20')]){delete _0x3fdaa7[_0x7744('0x20')];}_0x4ce128['status'](_0x3e3642)[_0x7744('0x21')](_0x3fdaa7);};}exports[_0x7744('0x22')]=function(_0x38e8d9,_0x5d069a){var _0x7dcc4c={};var _0x1f46e6=_[_0x7744('0x23')](db[_0x7744('0x24')][_0x7744('0x25')],function(_0x2d4290){return{'name':_0x2d4290[_0x7744('0x26')],'type':_0x2d4290['type'][_0x7744('0x27')]};});_0x7dcc4c=qs[_0x7744('0x28')](_0x1f46e6,_0x38e8d9);return interaction[_0x7744('0x29')](_0x7744('0x2a'),_0x38e8d9[_0x7744('0x2b')],_0x38e8d9[_0x7744('0x2c')],_0x7dcc4c,_0x1f46e6)['then'](respondWithFilteredResult(_0x5d069a,_0x7dcc4c))[_0x7744('0x2d')](handleError(_0x5d069a,null));};exports[_0x7744('0x2e')]=function(_0x462076,_0x22e331){var _0x5035ce={};if(_0x462076['query'][_0x7744('0x2f')]&&_0x462076[_0x7744('0x2b')][_0x7744('0x2f')]===_0x7744('0x30')){_0x5035ce[_0x7744('0x30')]=_0x462076[_0x7744('0x31')]['id'];}else{_0x5035ce['id']=_0x462076[_0x7744('0x31')]['id'];}var _0xa0c0da={'raw':![],'where':_0x5035ce},_0x314cd4={};_0x314cd4[_0x7744('0x32')]=_[_0x7744('0x33')](db['OpenchannelInteraction'][_0x7744('0x25')]);_0x314cd4['query']=_[_0x7744('0x33')](_0x462076[_0x7744('0x2b')]);_0x314cd4[_0x7744('0x34')]=_[_0x7744('0x35')](_0x314cd4[_0x7744('0x32')],_0x314cd4[_0x7744('0x2b')]);_0xa0c0da['attributes']=_[_0x7744('0x35')](_0x314cd4[_0x7744('0x32')],qs[_0x7744('0x36')](_0x462076[_0x7744('0x2b')][_0x7744('0x36')]));_0xa0c0da[_0x7744('0x37')]=_0xa0c0da['attributes'][_0x7744('0x38')]?_0xa0c0da[_0x7744('0x37')]:_0x314cd4[_0x7744('0x32')];if(_0x462076[_0x7744('0x2b')][_0x7744('0x39')]){_0xa0c0da[_0x7744('0x3a')]=[{'all':!![]}];}_0xa0c0da=_[_0x7744('0x3b')]({},_0xa0c0da,_0x462076[_0x7744('0x3c')]);return db[_0x7744('0x24')][_0x7744('0x3d')](_0xa0c0da)[_0x7744('0x1c')](handleEntityNotFound(_0x22e331,null))[_0x7744('0x1c')](respondWithResult(_0x22e331,null))[_0x7744('0x2d')](handleError(_0x22e331,null));};exports['create']=function(_0x27cf1e,_0x182fbb){return db[_0x7744('0x24')][_0x7744('0x3e')](_0x27cf1e[_0x7744('0x3f')],{})['then'](respondWithResult(_0x182fbb,0xc9))[_0x7744('0x2d')](handleError(_0x182fbb,null));};exports[_0x7744('0x1b')]=function(_0x5eefbb,_0x46e70d){if(_0x5eefbb[_0x7744('0x3f')]['id']){delete _0x5eefbb['body']['id'];}return db[_0x7744('0x24')][_0x7744('0x3d')]({'where':{'id':_0x5eefbb['params']['id']}})['then'](handleEntityNotFound(_0x46e70d,null))[_0x7744('0x1c')](saveUpdates(_0x5eefbb['body'],null))[_0x7744('0x1c')](respondWithResult(_0x46e70d,null))[_0x7744('0x2d')](handleError(_0x46e70d,null));};exports[_0x7744('0x1d')]=function(_0x505755,_0x3c7250){return db['OpenchannelInteraction'][_0x7744('0x3d')]({'where':{'id':_0x505755[_0x7744('0x31')]['id']}})[_0x7744('0x1c')](handleEntityNotFound(_0x3c7250,null))[_0x7744('0x1c')](removeEntity(_0x3c7250,null))[_0x7744('0x2d')](handleError(_0x3c7250,null));};exports['describe']=function(_0x288ee2,_0x3ffd68){return db['OpenchannelInteraction'][_0x7744('0x40')]()[_0x7744('0x1c')](respondWithResult(_0x3ffd68,null))[_0x7744('0x2d')](handleError(_0x3ffd68,null));};exports[_0x7744('0x41')]=function(_0x58338e,_0x109870){return db[_0x7744('0x42')][_0x7744('0x3d')]({'where':{'id':_0x58338e[_0x7744('0x31')]['id']}})[_0x7744('0x1c')](handleEntityNotFound(_0x109870,null))[_0x7744('0x1c')](function(_0x493b2d){if(_0x493b2d){return _0x493b2d[_0x7744('0x41')](_0x58338e[_0x7744('0x3f')][_0x7744('0x43')],_[_0x7744('0x44')](_0x58338e[_0x7744('0x3f')],[_0x7744('0x43'),'id'])||{});}})[_0x7744('0x1c')](respondWithResult(_0x109870,null))['catch'](handleError(_0x109870,null));};exports[_0x7744('0x45')]=function(_0x3a6860,_0x4a3c50){var _0x464ced={'raw':![],'where':{}};var _0x1bc489={};var _0x541bec={'count':0x0,'rows':[]};return db[_0x7744('0x24')][_0x7744('0x46')]({'where':{'id':_0x3a6860[_0x7744('0x31')]['id']}})[_0x7744('0x1c')](handleEntityNotFound(_0x4a3c50,null))[_0x7744('0x1c')](function(_0xf9691b){if(_0xf9691b){_0x1bc489[_0x7744('0x32')]=_[_0x7744('0x33')](db[_0x7744('0x42')][_0x7744('0x25')]);_0x1bc489['query']=_[_0x7744('0x33')](_0x3a6860[_0x7744('0x2b')]);_0x1bc489[_0x7744('0x34')]=_[_0x7744('0x35')](_0x1bc489[_0x7744('0x32')],_0x1bc489[_0x7744('0x2b')]);_0x464ced['attributes']=_[_0x7744('0x35')](_0x1bc489[_0x7744('0x32')],qs['fields'](_0x3a6860[_0x7744('0x2b')][_0x7744('0x36')]));_0x464ced[_0x7744('0x37')]=_0x464ced[_0x7744('0x37')]['length']?_0x464ced[_0x7744('0x37')]:_0x1bc489[_0x7744('0x32')];if(!_0x3a6860[_0x7744('0x2b')][_0x7744('0x47')](_0x7744('0x48'))){_0x464ced[_0x7744('0x17')]=qs['limit'](_0x3a6860[_0x7744('0x2b')][_0x7744('0x17')]);_0x464ced['offset']=qs[_0x7744('0x14')](_0x3a6860[_0x7744('0x2b')][_0x7744('0x14')]);}_0x464ced[_0x7744('0x49')]=qs[_0x7744('0x4a')](_0x3a6860[_0x7744('0x2b')][_0x7744('0x4a')]);_0x464ced[_0x7744('0x4b')]=qs[_0x7744('0x34')](_[_0x7744('0x4c')](_0x3a6860['query'],_0x1bc489['filters']));_0x464ced[_0x7744('0x4b')][_0x7744('0x4d')]=_0xf9691b['id'];if(_0x3a6860[_0x7744('0x2b')]['filter']){_0x464ced[_0x7744('0x4b')]=_[_0x7744('0x3b')](_0x464ced[_0x7744('0x4b')],{'$or':_[_0x7744('0x23')](_0x464ced[_0x7744('0x37')],function(_0x35fbd2){var _0x1e9fd4={};_0x1e9fd4[_0x35fbd2]={'$like':'%'+_0x3a6860['query'][_0x7744('0x4e')]+'%'};return _0x1e9fd4;})});}if(_0x3a6860[_0x7744('0x2b')]['$gte']){var _0x383f78=_0x3a6860[_0x7744('0x2b')]['$gte'][_0x7744('0x4f')](',');var _0x107ae3={};_0x107ae3[_0x383f78[0x0]]={'$gte':moment(_0x383f78[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x464ced[_0x7744('0x4b')]=_['merge'](_0x464ced[_0x7744('0x4b')],_0x107ae3);}_0x464ced=_[_0x7744('0x3b')]({},_0x464ced,_0x3a6860[_0x7744('0x3c')]);return db['OpenchannelMessage']['count']({'where':_0x464ced[_0x7744('0x4b')]})[_0x7744('0x1c')](function(_0x5bda71){_0x541bec[_0x7744('0x16')]=_0x5bda71;if(_0x3a6860[_0x7744('0x2b')][_0x7744('0x39')]){_0x464ced[_0x7744('0x3a')]=[{'all':!![]}];}return db[_0x7744('0x42')][_0x7744('0x29')](_0x464ced);})[_0x7744('0x1c')](function(_0x14cb07){_0x541bec[_0x7744('0x50')]=_0x14cb07;return _0x541bec;});}})['then'](respondWithFilteredResult(_0x4a3c50,_0x464ced))['catch'](handleError(_0x4a3c50,null));};exports[_0x7744('0x51')]=function(_0x3ba861,_0x516a23){return db[_0x7744('0x24')][_0x7744('0x3d')]({'where':{'id':_0x3ba861[_0x7744('0x31')]['id']}})[_0x7744('0x1c')](handleEntityNotFound(_0x516a23,null))[_0x7744('0x1c')](function(_0x589909){if(_0x589909){return _0x589909[_0x7744('0x52')](_0x3ba861[_0x7744('0x3f')][_0x7744('0x43')],_[_0x7744('0x44')](_0x3ba861['body'],[_0x7744('0x43'),'id'])||{})[_0x7744('0x53')](function(){return db[_0x7744('0x54')][_0x7744('0x29')]({'attributes':['id',_0x7744('0x20'),'color'],'where':{'id':_0x3ba861[_0x7744('0x3f')][_0x7744('0x43')]}});})[_0x7744('0x1c')](function(_0x562e03){socket[_0x7744('0x55')](_0x7744('0x56'),{'id':Number(_0x3ba861[_0x7744('0x31')]['id']),'tags':_0x562e03||[]});return{'id':Number(_0x3ba861[_0x7744('0x31')]['id']),'tags':_0x562e03||[]};});}})[_0x7744('0x1c')](respondWithResult(_0x516a23,null))[_0x7744('0x2d')](handleError(_0x516a23,null));};exports[_0x7744('0x57')]=function(_0x15b83c,_0x1ac646){return db[_0x7744('0x24')][_0x7744('0x3d')]({'where':{'id':_0x15b83c[_0x7744('0x31')]['id']}})['then'](handleEntityNotFound(_0x1ac646,null))[_0x7744('0x1c')](function(_0x16c36f){if(_0x16c36f){return _0x16c36f[_0x7744('0x57')](_0x15b83c['query'][_0x7744('0x43')]);}})[_0x7744('0x1c')](respondWithStatusCode(_0x1ac646,null))[_0x7744('0x2d')](handleError(_0x1ac646,null));};exports[_0x7744('0x58')]=function(_0x25c564,_0x48e8c3){var _0x16c702=moment()['unix']()[_0x7744('0x59')]();var _0x529b83=path[_0x7744('0x5a')](config['root'],_0x7744('0x5b'),'files','tmp');var _0x1b287f=path[_0x7744('0x5a')](config[_0x7744('0x5c')],_0x7744('0x5b'),_0x7744('0x5d'),_0x7744('0x5e'));var _0x103331=path[_0x7744('0x5a')](_0x529b83,_0x16c702);var _0x430207=util[_0x7744('0x5f')](_0x7744('0x60'),_0x25c564[_0x7744('0x31')]['id'],_0x16c702);var _0x429656=path[_0x7744('0x5a')](_0x529b83,_0x430207);var _0x136d6b=[];_0x136d6b['push']({'model':db[_0x7744('0x61')],'as':'User','attributes':['id',_0x7744('0x62')],'raw':!![]});_0x136d6b[_0x7744('0x63')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x7744('0x64'),'lastName'],'raw':!![]});if(_0x25c564[_0x7744('0x2b')]['attachments']){_0x136d6b['push']({'model':db[_0x7744('0x65')],'as':'Attachment','raw':!![]});}var _0x55b3a8=[{'model':db['OpenchannelMessage'],'as':_0x7744('0x66'),'attributes':['id',_0x7744('0x3f'),_0x7744('0x67'),_0x7744('0x68'),_0x7744('0x69'),_0x7744('0x6a')],'include':_0x136d6b}];_0x55b3a8['push']({'model':db[_0x7744('0x6b')],'as':_0x7744('0x6c'),'attributes':['id',_0x7744('0x20')]});_0x55b3a8[_0x7744('0x63')]({'model':db[_0x7744('0x61')],'as':_0x7744('0x6d'),'attributes':['id','fullname']});return db[_0x7744('0x24')]['find']({'where':{'id':_0x25c564[_0x7744('0x31')]['id']},'include':_0x55b3a8})[_0x7744('0x1c')](handleEntityNotFound(_0x48e8c3,null))[_0x7744('0x1c')](function(_0xb62d6c){if(_0xb62d6c){var _0x503ccc=_0xb62d6c[_0x7744('0x6e')]({'plain':!![]});fs[_0x7744('0x6f')](_0x103331);var _0x3f2feb={'channel':_0x7744('0x70'),'account':_0x503ccc[_0x7744('0x6c')][_0x7744('0x20')],'agent':_0x503ccc[_0x7744('0x6d')]?_0x503ccc[_0x7744('0x6d')][_0x7744('0x62')]:_0x7744('0x71'),'createdAt':moment(_0x503ccc['createdAt'])[_0x7744('0x5f')](_0x7744('0x72'))[_0x7744('0x59')](),'closedAt':_0x503ccc[_0x7744('0x73')]?moment(_0x503ccc[_0x7744('0x74')])[_0x7744('0x5f')](_0x7744('0x72'))['toString']():'','disposition':_0x503ccc[_0x7744('0x75')],'visibility':_0x503ccc[_0x7744('0x76')]?_0x7744('0x77'):'Private','messages':_(_0x503ccc[_0x7744('0x66')])[_0x7744('0x4e')]({'secret':![]})['map'](function(_0x158a65){if(_0x158a65[_0x7744('0x65')]){var _0x568737=path[_0x7744('0x5a')](_0x1b287f,_0x158a65[_0x7744('0x65')][_0x7744('0x78')]);if(fs[_0x7744('0x79')](_0x568737)){fs[_0x7744('0x7a')](_0x568737)[_0x7744('0x7b')](fs['createWriteStream'](path[_0x7744('0x5a')](_0x103331,_0x158a65['Attachment'][_0x7744('0x78')])));}}return{'date':moment(_0x158a65[_0x7744('0x67')])[_0x7744('0x5f')](_0x7744('0x72'))[_0x7744('0x59')](),'sender':_0x158a65[_0x7744('0x68')]===_0x7744('0x7c')?_0x158a65['User']?_0x158a65[_0x7744('0x61')]['fullname']:_0x7744('0x7d'):_0x158a65[_0x7744('0x7e')]['firstName']+(_0x158a65[_0x7744('0x7e')]['lastName']?'\x20'+_0x158a65[_0x7744('0x7e')][_0x7744('0x7f')]:''),'body':_0x158a65['Attachment']?_0x158a65[_0x7744('0x65')][_0x7744('0x78')]:_0x158a65[_0x7744('0x3f')],'direction':_0x158a65[_0x7744('0x68')]===_0x7744('0x7c')?'A':'C','secret':_0x158a65[_0x7744('0x69')],'read':_0x158a65[_0x7744('0x6a')],'attachment':_0x158a65['Attachment']};})[_0x7744('0x80')]()};return ejs['renderFile'](path['join'](config['root'],_0x7744('0x5b'),_0x7744('0x81'),_0x7744('0x82')),{'interaction':_0x3f2feb})['then'](function(_0x453ae7){var _0x554c53=path[_0x7744('0x5a')](_0x103331,_0x7744('0x83')+_0x503ccc['id']+'-'+_0x16c702+_0x7744('0x84'));var _0x4c6eff={'path':_0x554c53,'channel':_0x7744('0x70'),'interactionId':_0x503ccc['id']};return pdf[_0x7744('0x85')](_0x453ae7,_0x4c6eff);})[_0x7744('0x1c')](function(){return new Promise(function(_0x224711,_0x9926a8){zipdir(_0x103331,{'saveTo':_0x429656},function(_0xa7d50,_0x58cb5f){if(_0xa7d50)return _0x9926a8(_0xa7d50);return _0x224711(_0x58cb5f);});})['then'](function(){return new Promise(function(_0x460093,_0x47bf61){rimraf(_0x103331,function(_0x2c695b){if(_0x2c695b)_0x47bf61(_0x2c695b);return _0x460093();});});})[_0x7744('0x1c')](function(){return _0x48e8c3[_0x7744('0x58')](_0x429656,_0x430207,function(_0x12181d){if(_0x12181d){logger[_0x7744('0x1e')]('Unable\x20to\x20delete\x20zip\x20file',_0x12181d);}else{fs[_0x7744('0x86')](_0x429656);}});});});}else{return _0x48e8c3['sendStatus'](0xc8);}})['catch'](handleError(_0x48e8c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 29dff8d..062edb6 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 _0x6e51=['map','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x3e1758,_0x101ccf){var _0x5b555c=function(_0x239d1b){while(--_0x239d1b){_0x3e1758['push'](_0x3e1758['shift']());}};_0x5b555c(++_0x101ccf);}(_0x6e51,0x97));var _0x16e5=function(_0x57715c,_0x263df0){_0x57715c=_0x57715c-0x0;var _0x422e1f=_0x6e51[_0x57715c];return _0x422e1f;};'use strict';var EventEmitter=require(_0x16e5('0x0'));var OpenchannelInteraction=require(_0x16e5('0x1'))['db'][_0x16e5('0x2')];var OpenchannelMessage=require(_0x16e5('0x1'))['db'][_0x16e5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x16e5('0x4')](0x0);var events={'afterCreate':_0x16e5('0x5'),'afterUpdate':'update','afterDestroy':_0x16e5('0x6')};function emitEvent(_0x1ecf75){return function(_0x1e3bd5,_0x48603d,_0xf82da9){_0x1e3bd5[_0x16e5('0x7')]({'attributes':['id'],'raw':!![]})[_0x16e5('0x8')](function(_0x502886){_0x1e3bd5[_0x16e5('0x9')](_0x16e5('0xa'),_0x502886[_0x16e5('0xb')](function(_0xb9d7d4){return{'id':_0xb9d7d4['id']};}));return OpenchannelMessage[_0x16e5('0xc')]({'where':{'OpenchannelInteractionId':_0x1e3bd5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16e5('0x8')](function(_0x1accd5){_0x1e3bd5[_0x16e5('0x9')](_0x16e5('0xd'),_0x1accd5['length']);OpenchannelInteractionEvents[_0x16e5('0xe')](_0x1ecf75+':'+_0x1e3bd5['id'],_0x1e3bd5);OpenchannelInteractionEvents[_0x16e5('0xe')](_0x1ecf75,_0x1e3bd5);_0xf82da9(null);})[_0x16e5('0xf')](_0xf82da9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x16e5('0x10')](e,emitEvent(event));}}module[_0x16e5('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7d6e=['update','remove','getUsers','setDataValue','Users','map','then','emit','catch','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save'];(function(_0x4cd266,_0x4c7a6c){var _0x44a878=function(_0x2903ec){while(--_0x2903ec){_0x4cd266['push'](_0x4cd266['shift']());}};_0x44a878(++_0x4c7a6c);}(_0x7d6e,0xdc));var _0xe7d6=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0x7d6e[_0x21de89];return _0x290b7e;};'use strict';var EventEmitter=require(_0xe7d6('0x0'));var OpenchannelInteraction=require(_0xe7d6('0x1'))['db'][_0xe7d6('0x2')];var OpenchannelMessage=require(_0xe7d6('0x1'))['db'][_0xe7d6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7d6('0x4'),'afterUpdate':_0xe7d6('0x5'),'afterDestroy':_0xe7d6('0x6')};function emitEvent(_0x2f2994){return function(_0x1ffc6a,_0x5cac56,_0x4db4b4){_0x1ffc6a[_0xe7d6('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4588a6){_0x1ffc6a[_0xe7d6('0x8')](_0xe7d6('0x9'),_0x4588a6[_0xe7d6('0xa')](function(_0x36d212){return{'id':_0x36d212['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1ffc6a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe7d6('0xb')](function(_0x4cc51e){_0x1ffc6a[_0xe7d6('0x8')]('unreadMessages',_0x4cc51e['length']);OpenchannelInteractionEvents['emit'](_0x2f2994+':'+_0x1ffc6a['id'],_0x1ffc6a);OpenchannelInteractionEvents[_0xe7d6('0xc')](_0x2f2994,_0x1ffc6a);_0x4db4b4(null);})[_0xe7d6('0xd')](_0x4db4b4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xe7d6('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7f46f51..9afe6f4 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 _0x468a=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','path','rimraf','./openchannelInteraction.attributes','define'];(function(_0x44c374,_0x3bcfc3){var _0x2ffe21=function(_0x52e275){while(--_0x52e275){_0x44c374['push'](_0x44c374['shift']());}};_0x2ffe21(++_0x3bcfc3);}(_0x468a,0x13b));var _0xa468=function(_0x33bd08,_0x341570){_0x33bd08=_0x33bd08-0x0;var _0x5e8d7b=_0x468a[_0x33bd08];return _0x5e8d7b;};'use strict';var _=require('lodash');var util=require(_0xa468('0x0'));var logger=require('../../config/logger')(_0xa468('0x1'));var moment=require('moment');var BPromise=require(_0xa468('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa468('0x3'));var rimraf=require(_0xa468('0x4'));var config=require('../../config/environment');var attributes=require(_0xa468('0x5'));module['exports']=function(_0x5c7646,_0x3220f3){return _0x5c7646[_0xa468('0x6')](_0xa468('0x7'),attributes,{'tableName':_0xa468('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa468('0x9'),'collate':_0xa468('0xa'),'hooks':{'beforeUpdate':function(_0x2b6b58,_0x2cd2ea,_0x3f40b0){if(_0x2b6b58[_0xa468('0xb')]('closed')){_0x2b6b58['closedAt']=moment()[_0xa468('0xc')](_0xa468('0xd'));}_0x3f40b0(null,_0x2b6b58);}}});}; \ No newline at end of file +var _0x8bc5=['api','path','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x28b2a8,_0x1a8d5a){var _0x57c1b5=function(_0x37e46c){while(--_0x37e46c){_0x28b2a8['push'](_0x28b2a8['shift']());}};_0x57c1b5(++_0x1a8d5a);}(_0x8bc5,0x66));var _0x58bc=function(_0x32cce8,_0xf9f52b){_0x32cce8=_0x32cce8-0x0;var _0x539648=_0x8bc5[_0x32cce8];return _0x539648;};'use strict';var _=require(_0x58bc('0x0'));var util=require(_0x58bc('0x1'));var logger=require(_0x58bc('0x2'))(_0x58bc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58bc('0x4'));var rimraf=require('rimraf');var config=require(_0x58bc('0x5'));var attributes=require(_0x58bc('0x6'));module['exports']=function(_0x201e9b,_0x2d4d69){return _0x201e9b[_0x58bc('0x7')]('OpenchannelInteraction',attributes,{'tableName':_0x58bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58bc('0x9'),'collate':_0x58bc('0xa'),'hooks':{'beforeUpdate':function(_0x33a305,_0x38ffd6,_0x2980ca){if(_0x33a305[_0x58bc('0xb')](_0x58bc('0xc'))){_0x33a305['closedAt']=moment()[_0x58bc('0xd')](_0x58bc('0xe'));}_0x2980ca(null,_0x33a305);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4cf970b..47c4e9c 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 _0xc0e9=['debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','OpenchannelInteraction','find','then','body','ids','spread','AddTags'];(function(_0x429fda,_0x4ee60b){var _0x43b7d8=function(_0xa214f1){while(--_0xa214f1){_0x429fda['push'](_0x429fda['shift']());}};_0x43b7d8(++_0x4ee60b);}(_0xc0e9,0x7f));var _0x9c0e=function(_0x3232c0,_0x266df2){_0x3232c0=_0x3232c0-0x0;var _0x579f76=_0xc0e9[_0x3232c0];return _0x579f76;};'use strict';var _=require(_0x9c0e('0x0'));var util=require(_0x9c0e('0x1'));var moment=require(_0x9c0e('0x2'));var BPromise=require(_0x9c0e('0x3'));var rs=require(_0x9c0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c0e('0x5'))['db'];var utils=require(_0x9c0e('0x6'));var logger=require(_0x9c0e('0x7'))('rpc');var config=require(_0x9c0e('0x8'));var jayson=require(_0x9c0e('0x9'));var client=jayson[_0x9c0e('0xa')][_0x9c0e('0xb')]({'port':0x232a});config[_0x9c0e('0xc')]=_[_0x9c0e('0xd')](config[_0x9c0e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c0e('0xe'))(new Redis(config[_0x9c0e('0xc')]));require(_0x9c0e('0xf'))[_0x9c0e('0x10')](socket);function respondWithRpcPromise(_0x1f1510,_0x4cffad,_0x5e7b1f){return new BPromise(function(_0x362218,_0x432e4c){return client[_0x9c0e('0x11')](_0x1f1510,_0x5e7b1f)['then'](function(_0x2cb374){logger['info'](_0x9c0e('0x12'),_0x4cffad,'request\x20sent');logger['debug'](_0x9c0e('0x13'),_0x4cffad,_0x9c0e('0x14'),JSON['stringify'](_0x2cb374));if(_0x2cb374['error']){if(_0x2cb374[_0x9c0e('0x15')][_0x9c0e('0x16')]===0x1f4){logger[_0x9c0e('0x15')](_0x9c0e('0x12'),_0x4cffad,_0x2cb374[_0x9c0e('0x15')][_0x9c0e('0x17')]);return _0x432e4c(_0x2cb374[_0x9c0e('0x15')][_0x9c0e('0x17')]);}logger[_0x9c0e('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4cffad,_0x2cb374['error']['message']);return _0x362218(_0x2cb374[_0x9c0e('0x15')]['message']);}else{logger[_0x9c0e('0x18')](_0x9c0e('0x12'),_0x4cffad,_0x9c0e('0x14'));_0x362218(_0x2cb374['result']['message']);}})[_0x9c0e('0x19')](function(_0x39cf4){logger[_0x9c0e('0x15')](_0x9c0e('0x12'),_0x4cffad,_0x39cf4);_0x432e4c(_0x39cf4);});});}exports['UpdateOpenchannelInteraction']=function(_0x4470c1){var _0x55571b=this;return new Promise(function(_0x470251,_0x1c3f5f){return db['OpenchannelInteraction'][_0x9c0e('0x1a')](_0x4470c1['body'],{'raw':_0x4470c1[_0x9c0e('0x1b')]?_0x4470c1[_0x9c0e('0x1b')][_0x9c0e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4470c1['options']?_0x4470c1[_0x9c0e('0x1b')][_0x9c0e('0x1d')]||null:null,'attributes':_0x4470c1['options']?_0x4470c1['options'][_0x9c0e('0x1e')]||null:null,'limit':_0x4470c1[_0x9c0e('0x1b')]?_0x4470c1[_0x9c0e('0x1b')][_0x9c0e('0x1f')]||null:null})['then'](function(_0x1f56a3){logger['info'](_0x9c0e('0x20'),_0x4470c1);logger['debug'](_0x9c0e('0x20'),_0x4470c1,JSON[_0x9c0e('0x21')](_0x1f56a3));_0x470251(_0x1f56a3);})[_0x9c0e('0x19')](function(_0x2ccc0a){logger[_0x9c0e('0x15')](_0x9c0e('0x20'),_0x2ccc0a[_0x9c0e('0x17')],_0x4470c1);_0x1c3f5f(_0x55571b[_0x9c0e('0x15')](0x1f4,_0x2ccc0a[_0x9c0e('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3522f3){return new Promise(function(_0x284fda,_0x4c0d0c){return db[_0x9c0e('0x22')][_0x9c0e('0x23')]({'where':_0x3522f3[_0x9c0e('0x1b')]?_0x3522f3[_0x9c0e('0x1b')][_0x9c0e('0x1d')]||null:null})[_0x9c0e('0x24')](function(_0x182d3f){if(_0x182d3f){return _0x182d3f['addTags'](_0x3522f3[_0x9c0e('0x25')][_0x9c0e('0x26')],_['omit'](_0x3522f3[_0x9c0e('0x25')],[_0x9c0e('0x26'),'id'])||{});}})[_0x9c0e('0x27')](function(_0x262be1){logger[_0x9c0e('0x18')](_0x9c0e('0x28'),_0x3522f3);logger[_0x9c0e('0x29')](_0x9c0e('0x28'),_0x3522f3,JSON[_0x9c0e('0x21')](_0x262be1));_0x284fda(_0x262be1);})[_0x9c0e('0x19')](function(_0x137109){logger[_0x9c0e('0x15')](_0x9c0e('0x28'),_0x137109[_0x9c0e('0x17')],_0x3522f3);_0x4c0d0c(_this['error'](0x1f4,_0x137109['message']));});});}; \ No newline at end of file +var _0x51fc=['omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','addTags','ids'];(function(_0x404a57,_0x15412c){var _0x46cad2=function(_0x32c3f4){while(--_0x32c3f4){_0x404a57['push'](_0x404a57['shift']());}};_0x46cad2(++_0x15412c);}(_0x51fc,0x1e3));var _0xc51f=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0x51fc[_0x2bf1d6];return _0x1be08a;};'use strict';var _=require(_0xc51f('0x0'));var util=require(_0xc51f('0x1'));var moment=require(_0xc51f('0x2'));var BPromise=require(_0xc51f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc51f('0x4'));var db=require(_0xc51f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc51f('0x6'))('rpc');var config=require(_0xc51f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc51f('0x8')][_0xc51f('0x9')]({'port':0x232a});config[_0xc51f('0xa')]=_['defaults'](config[_0xc51f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc51f('0xb'))(new Redis(config['redis']));require(_0xc51f('0xc'))[_0xc51f('0xd')](socket);function respondWithRpcPromise(_0xe643e7,_0x16d39c,_0x111406){return new BPromise(function(_0x56031d,_0x1e74cf){return client[_0xc51f('0xe')](_0xe643e7,_0x111406)[_0xc51f('0xf')](function(_0x1276ee){logger['info'](_0xc51f('0x10'),_0x16d39c,'request\x20sent');logger[_0xc51f('0x11')](_0xc51f('0x12'),_0x16d39c,'request\x20sent',JSON[_0xc51f('0x13')](_0x1276ee));if(_0x1276ee[_0xc51f('0x14')]){if(_0x1276ee[_0xc51f('0x14')][_0xc51f('0x15')]===0x1f4){logger[_0xc51f('0x14')](_0xc51f('0x10'),_0x16d39c,_0x1276ee[_0xc51f('0x14')][_0xc51f('0x16')]);return _0x1e74cf(_0x1276ee[_0xc51f('0x14')][_0xc51f('0x16')]);}logger[_0xc51f('0x14')](_0xc51f('0x10'),_0x16d39c,_0x1276ee[_0xc51f('0x14')][_0xc51f('0x16')]);return _0x56031d(_0x1276ee[_0xc51f('0x14')]['message']);}else{logger[_0xc51f('0x17')](_0xc51f('0x10'),_0x16d39c,_0xc51f('0x18'));_0x56031d(_0x1276ee[_0xc51f('0x19')][_0xc51f('0x16')]);}})[_0xc51f('0x1a')](function(_0x3ebe28){logger['error'](_0xc51f('0x10'),_0x16d39c,_0x3ebe28);_0x1e74cf(_0x3ebe28);});});}exports['UpdateOpenchannelInteraction']=function(_0x5a7797){var _0x329530=this;return new Promise(function(_0x7fd8a7,_0x19b802){return db[_0xc51f('0x1b')][_0xc51f('0x1c')](_0x5a7797['body'],{'raw':_0x5a7797[_0xc51f('0x1d')]?_0x5a7797['options'][_0xc51f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7797[_0xc51f('0x1d')]?_0x5a7797[_0xc51f('0x1d')][_0xc51f('0x1f')]||null:null,'attributes':_0x5a7797[_0xc51f('0x1d')]?_0x5a7797[_0xc51f('0x1d')][_0xc51f('0x20')]||null:null,'limit':_0x5a7797[_0xc51f('0x1d')]?_0x5a7797[_0xc51f('0x1d')][_0xc51f('0x21')]||null:null})[_0xc51f('0xf')](function(_0x9f880a){logger[_0xc51f('0x17')](_0xc51f('0x22'),_0x5a7797);logger[_0xc51f('0x11')]('UpdateOpenchannelInteraction',_0x5a7797,JSON[_0xc51f('0x13')](_0x9f880a));_0x7fd8a7(_0x9f880a);})['catch'](function(_0x562a2d){logger[_0xc51f('0x14')](_0xc51f('0x22'),_0x562a2d[_0xc51f('0x16')],_0x5a7797);_0x19b802(_0x329530[_0xc51f('0x14')](0x1f4,_0x562a2d[_0xc51f('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x220dab){return new Promise(function(_0x21ea4e,_0x23e8c6){return db[_0xc51f('0x1b')]['find']({'where':_0x220dab[_0xc51f('0x1d')]?_0x220dab[_0xc51f('0x1d')]['where']||null:null})[_0xc51f('0xf')](function(_0x7b5b56){if(_0x7b5b56){return _0x7b5b56[_0xc51f('0x23')](_0x220dab['body'][_0xc51f('0x24')],_[_0xc51f('0x25')](_0x220dab['body'],[_0xc51f('0x24'),'id'])||{});}})[_0xc51f('0x26')](function(_0x2e97f1){logger[_0xc51f('0x17')](_0xc51f('0x27'),_0x220dab);logger[_0xc51f('0x11')](_0xc51f('0x27'),_0x220dab,JSON[_0xc51f('0x13')](_0x2e97f1));_0x21ea4e(_0x2e97f1);})[_0xc51f('0x1a')](function(_0x3b1495){logger[_0xc51f('0x14')](_0xc51f('0x27'),_0x3b1495[_0xc51f('0x16')],_0x220dab);_0x23e8c6(_this['error'](0x1f4,_0x3b1495[_0xc51f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a927ae1..5f0a453 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 _0xcfc8=['remove','update','emit','removeListener','register','length','openchannelInteraction:','save'];(function(_0x3fed4c,_0x359eff){var _0x2a63fb=function(_0x3c556b){while(--_0x3c556b){_0x3fed4c['push'](_0x3fed4c['shift']());}};_0x2a63fb(++_0x359eff);}(_0xcfc8,0xdf));var _0x8cfc=function(_0x332a06,_0x30ecea){_0x332a06=_0x332a06-0x0;var _0x1f7d9e=_0xcfc8[_0x332a06];return _0x1f7d9e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x8cfc('0x0'),_0x8cfc('0x1'),_0x8cfc('0x2')];function createListener(_0x9cdbb6,_0x480bf8){return function(_0x241ba0){_0x480bf8[_0x8cfc('0x3')](_0x9cdbb6,_0x241ba0);};}function removeListener(_0x55aa31,_0x526723){return function(){OpenchannelInteractionEvents[_0x8cfc('0x4')](_0x55aa31,_0x526723);};}exports[_0x8cfc('0x5')]=function(_0x419f99){for(var _0x5e98f1=0x0,_0x345fc8=events[_0x8cfc('0x6')];_0x5e98f1<_0x345fc8;_0x5e98f1++){var _0x172b17=events[_0x5e98f1];var _0x522be9=createListener(_0x8cfc('0x7')+_0x172b17,_0x419f99);OpenchannelInteractionEvents['on'](_0x172b17,_0x522be9);}}; \ No newline at end of file +var _0x228c=['openchannelInteraction:','update','emit','removeListener','register'];(function(_0x38785a,_0x12b44f){var _0x512d9a=function(_0x3ce152){while(--_0x3ce152){_0x38785a['push'](_0x38785a['shift']());}};_0x512d9a(++_0x12b44f);}(_0x228c,0x6f));var _0xc228=function(_0xb24c7f,_0x9d3908){_0xb24c7f=_0xb24c7f-0x0;var _0x3968b2=_0x228c[_0xb24c7f];return _0x3968b2;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save','remove',_0xc228('0x0')];function createListener(_0x60dccf,_0x1b5b5f){return function(_0x266e55){_0x1b5b5f[_0xc228('0x1')](_0x60dccf,_0x266e55);};}function removeListener(_0x514afe,_0x3bbb74){return function(){OpenchannelInteractionEvents[_0xc228('0x2')](_0x514afe,_0x3bbb74);};}exports[_0xc228('0x3')]=function(_0x4aacf5){for(var _0x246902=0x0,_0x365270=events['length'];_0x246902<_0x365270;_0x246902++){var _0xfde3d4=events[_0x246902];var _0x1a05a9=createListener(_0xc228('0x4')+_0xfde3d4,_0x4aacf5);OpenchannelInteractionEvents['on'](_0xfde3d4,_0x1a05a9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ac2de2b..716ce71 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x585ea6,_0x1f16c8){var _0x687b52=function(_0x341a1a){while(--_0x341a1a){_0x585ea6['push'](_0x585ea6['shift']());}};_0x687b52(++_0x1f16c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x5d3a22,_0x59ffcd){var _0xefcb06=function(_0x45a634){while(--_0x45a634){_0x5d3a22['push'](_0x5d3a22['shift']());}};_0xefcb06(++_0x59ffcd);}(_0xe706,0xa3));var _0x6e70=function(_0x590ef7,_0x175f08){_0x590ef7=_0x590ef7-0x0;var _0x4c2634=_0xe706[_0x590ef7];return _0x4c2634;};'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')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 131bf79..3c00988 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 _0x2ca5=['medium','BOOLEAN','out','DATE','STRING','exports','TEXT'];(function(_0x148411,_0x21527a){var _0x2bee9e=function(_0x2daa7a){while(--_0x2daa7a){_0x148411['push'](_0x148411['shift']());}};_0x2bee9e(++_0x21527a);}(_0x2ca5,0x108));var _0x52ca=function(_0x367054,_0x1debc3){_0x367054=_0x367054-0x0;var _0x472454=_0x2ca5[_0x367054];return _0x472454;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'body':{'type':Sequelize[_0x52ca('0x1')](_0x52ca('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x52ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x52ca('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x52ca('0x5')]},'providerName':{'type':Sequelize[_0x52ca('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x566f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4a1d41,_0x300f53){var _0x472fac=function(_0xe7f8cd){while(--_0xe7f8cd){_0x4a1d41['push'](_0x4a1d41['shift']());}};_0x472fac(++_0x300f53);}(_0x566f,0x124));var _0xf566=function(_0x3bb410,_0x376364){_0x3bb410=_0x3bb410-0x0;var _0xd1a50=_0x566f[_0x3bb410];return _0xd1a50;};'use strict';var Sequelize=require(_0xf566('0x0'));module[_0xf566('0x1')]={'body':{'type':Sequelize[_0xf566('0x2')](_0xf566('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf566('0x5')]('in',_0xf566('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf566('0x7')]},'providerName':{'type':Sequelize[_0xf566('0x8')]},'providerResponse':{'type':Sequelize[_0xf566('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6e00919..b7d2e40 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 _0x1751=['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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','limit','undefined','offset','set','Content-Range','apply','save','update','then','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','find','create','describe','accept','openchannel','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','openchannel-interactions','reject','RejectMessage','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x273033,_0x24f181){var _0x1e6b54=function(_0x48750e){while(--_0x48750e){_0x273033['push'](_0x273033['shift']());}};_0x1e6b54(++_0x24f181);}(_0x1751,0x76));var _0x1175=function(_0x5c0f28,_0x5b7fb1){_0x5c0f28=_0x5c0f28-0x0;var _0x26747c=_0x1751[_0x5c0f28];return _0x26747c;};'use strict';var emlformat=require(_0x1175('0x0'));var rimraf=require(_0x1175('0x1'));var zipdir=require(_0x1175('0x2'));var jsonpatch=require(_0x1175('0x3'));var rp=require('request-promise');var moment=require(_0x1175('0x4'));var BPromise=require(_0x1175('0x5'));var Mustache=require(_0x1175('0x6'));var util=require(_0x1175('0x7'));var path=require(_0x1175('0x8'));var sox=require(_0x1175('0x9'));var csv=require(_0x1175('0xa'));var ejs=require(_0x1175('0xb'));var fs=require('fs');var fs_extra=require(_0x1175('0xc'));var _=require(_0x1175('0xd'));var squel=require(_0x1175('0xe'));var crypto=require(_0x1175('0xf'));var jsforce=require(_0x1175('0x10'));var deskjs=require(_0x1175('0x11'));var toCsv=require(_0x1175('0xa'));var querystring=require(_0x1175('0x12'));var Papa=require(_0x1175('0x13'));var Redis=require(_0x1175('0x14'));var authService=require(_0x1175('0x15'));var qs=require(_0x1175('0x16'));var as=require(_0x1175('0x17'));var hardwareService=require(_0x1175('0x18'));var logger=require(_0x1175('0x19'))(_0x1175('0x1a'));var utils=require(_0x1175('0x1b'));var config=require(_0x1175('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1175('0x1d')]=_[_0x1175('0x1e')](config['redis'],{'host':_0x1175('0x1f'),'port':0x18eb});var socket=require(_0x1175('0x20'))(new Redis(config[_0x1175('0x1d')]));require('./openchannelMessage.socket')[_0x1175('0x21')](socket);var jayson=require(_0x1175('0x22'));var client=jayson[_0x1175('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x1175('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14be3c,_0x43b6b1,_0x2a9bc4,_0x2585be){return new BPromise(function(_0x5c1a14,_0x18119f){var _0xaa45d=_0x2585be||client;return _0xaa45d['request'](_0x14be3c,_0x2a9bc4)['then'](function(_0x40b685){logger[_0x1175('0x24')](_0x1175('0x25'),_0x43b6b1,_0x1175('0x26'));logger[_0x1175('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x43b6b1,_0x1175('0x26'),JSON[_0x1175('0x28')](_0x40b685));if(_0x40b685[_0x1175('0x29')]){if(_0x40b685[_0x1175('0x29')][_0x1175('0x2a')]===0x1f4){logger[_0x1175('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b6b1,_0x40b685['error'][_0x1175('0x2b')]);return _0x18119f(_0x40b685[_0x1175('0x29')][_0x1175('0x2b')]);}logger[_0x1175('0x29')](_0x1175('0x25'),_0x43b6b1,_0x40b685[_0x1175('0x29')][_0x1175('0x2b')]);return _0x5c1a14(_0x40b685['error'][_0x1175('0x2b')]);}else{logger[_0x1175('0x24')](_0x1175('0x25'),_0x43b6b1,_0x1175('0x26'));_0x5c1a14(_0x40b685[_0x1175('0x2c')][_0x1175('0x2b')]);}})[_0x1175('0x2d')](function(_0x5a3dc9){logger[_0x1175('0x29')](_0x1175('0x25'),_0x43b6b1,_0x5a3dc9);_0x18119f(_0x5a3dc9);});});}function respondWithStatusCode(_0x38cf17,_0x5ad9b5){_0x5ad9b5=_0x5ad9b5||0xcc;return function(_0x491901){if(_0x491901){return _0x38cf17['sendStatus'](_0x5ad9b5);}return _0x38cf17[_0x1175('0x2e')](_0x5ad9b5)[_0x1175('0x2f')]();};}function respondWithResult(_0x3fd476,_0x5e4ac6){_0x5e4ac6=_0x5e4ac6||0xc8;return function(_0x5884a3){if(_0x5884a3){return _0x3fd476['status'](_0x5e4ac6)['json'](_0x5884a3);}};}function respondWithFilteredResult(_0x3abc9c,_0x3db0f7){return function(_0x1fabfb){if(_0x1fabfb){var _0x1e29d0=typeof _0x3db0f7['offset']==='undefined'&&typeof _0x3db0f7[_0x1175('0x30')]===_0x1175('0x31');var _0x57f7a8=_0x1fabfb['count'];var _0x5b6bfb=_0x1e29d0?0x0:_0x3db0f7[_0x1175('0x32')];var _0x305939=_0x1e29d0?_0x1fabfb['count']:_0x3db0f7[_0x1175('0x32')]+_0x3db0f7[_0x1175('0x30')];var _0x135d1b;if(_0x305939>=_0x57f7a8){_0x305939=_0x57f7a8;_0x135d1b=0xc8;}else{_0x135d1b=0xce;}_0x3abc9c[_0x1175('0x2e')](_0x135d1b);return _0x3abc9c[_0x1175('0x33')](_0x1175('0x34'),_0x5b6bfb+'-'+_0x305939+'/'+_0x57f7a8)['json'](_0x1fabfb);}return null;};}function patchUpdates(_0x3a32ec){return function(_0x399f53){try{jsonpatch[_0x1175('0x35')](_0x399f53,_0x3a32ec,!![]);}catch(_0x35929e){return BPromise['reject'](_0x35929e);}return _0x399f53[_0x1175('0x36')]();};}function saveUpdates(_0x5c0b9f,_0x476822){return function(_0x115e62){if(_0x115e62){return _0x115e62[_0x1175('0x37')](_0x5c0b9f)[_0x1175('0x38')](function(_0x6ec44b){return _0x6ec44b;});}return null;};}function removeEntity(_0x28bbb7,_0x574d77){return function(_0x49ed96){if(_0x49ed96){return _0x49ed96['destroy']()[_0x1175('0x38')](function(){_0x28bbb7[_0x1175('0x2e')](0xcc)[_0x1175('0x2f')]();});}};}function handleEntityNotFound(_0x40d809,_0x1661ae){return function(_0x2beda3){if(!_0x2beda3){_0x40d809['sendStatus'](0x194);}return _0x2beda3;};}function handleError(_0x4a10cd,_0x3862f4){_0x3862f4=_0x3862f4||0x1f4;return function(_0x325cb7){logger[_0x1175('0x29')](_0x325cb7['stack']);if(_0x325cb7[_0x1175('0x39')]){delete _0x325cb7[_0x1175('0x39')];}_0x4a10cd[_0x1175('0x2e')](_0x3862f4)['send'](_0x325cb7);};}exports['index']=function(_0x57650d,_0x177715){var _0x561023={},_0x20e9b1={},_0x23c0fc={'count':0x0,'rows':[]};var _0x43bb01=_[_0x1175('0x3a')](db[_0x1175('0x3b')][_0x1175('0x3c')],function(_0x2240d2){return{'name':_0x2240d2[_0x1175('0x3d')],'type':_0x2240d2[_0x1175('0x3e')][_0x1175('0x3f')]};});_0x20e9b1[_0x1175('0x40')]=_[_0x1175('0x3a')](_0x43bb01,_0x1175('0x39'));_0x20e9b1[_0x1175('0x41')]=_[_0x1175('0x42')](_0x57650d[_0x1175('0x41')]);_0x20e9b1['filters']=_[_0x1175('0x43')](_0x20e9b1[_0x1175('0x40')],_0x20e9b1[_0x1175('0x41')]);_0x561023['attributes']=_[_0x1175('0x43')](_0x20e9b1[_0x1175('0x40')],qs[_0x1175('0x44')](_0x57650d[_0x1175('0x41')][_0x1175('0x44')]));_0x561023['attributes']=_0x561023[_0x1175('0x45')][_0x1175('0x46')]?_0x561023[_0x1175('0x45')]:_0x20e9b1[_0x1175('0x40')];if(!_0x57650d['query'][_0x1175('0x47')](_0x1175('0x48'))){_0x561023[_0x1175('0x30')]=qs['limit'](_0x57650d[_0x1175('0x41')]['limit']);_0x561023[_0x1175('0x32')]=qs[_0x1175('0x32')](_0x57650d[_0x1175('0x41')][_0x1175('0x32')]);}_0x561023[_0x1175('0x49')]=qs[_0x1175('0x4a')](_0x57650d[_0x1175('0x41')][_0x1175('0x4a')]);_0x561023[_0x1175('0x4b')]=qs[_0x1175('0x4c')](_['pick'](_0x57650d['query'],_0x20e9b1[_0x1175('0x4c')]),_0x43bb01);if(_0x57650d[_0x1175('0x41')]['filter']){_0x561023[_0x1175('0x4b')]=_[_0x1175('0x4d')](_0x561023['where'],{'$or':_[_0x1175('0x3a')](_0x43bb01,function(_0x1ed96f){if(_0x1ed96f[_0x1175('0x3e')]!==_0x1175('0x4e')){var _0x18e8d5={};_0x18e8d5[_0x1ed96f[_0x1175('0x39')]]={'$like':'%'+_0x57650d[_0x1175('0x41')][_0x1175('0x4f')]+'%'};return _0x18e8d5;}})});}_0x561023=_[_0x1175('0x4d')]({},_0x561023,_0x57650d[_0x1175('0x50')]);var _0x2e49d9={'where':_0x561023[_0x1175('0x4b')]};return db[_0x1175('0x3b')][_0x1175('0x51')](_0x2e49d9)[_0x1175('0x38')](function(_0x33f2c1){_0x23c0fc[_0x1175('0x51')]=_0x33f2c1;if(_0x57650d['query']['includeAll']){_0x561023[_0x1175('0x52')]=[{'all':!![]}];}return db[_0x1175('0x3b')][_0x1175('0x53')](_0x561023);})['then'](function(_0x2f69f5){_0x23c0fc[_0x1175('0x54')]=_0x2f69f5;return _0x23c0fc;})[_0x1175('0x38')](respondWithFilteredResult(_0x177715,_0x561023))[_0x1175('0x2d')](handleError(_0x177715,null));};exports[_0x1175('0x55')]=function(_0x92cca9,_0x49b6c6){var _0x71c6bc={'raw':!![],'where':{'id':_0x92cca9[_0x1175('0x56')]['id']}},_0x3a44a6={};_0x3a44a6[_0x1175('0x40')]=_[_0x1175('0x42')](db[_0x1175('0x3b')][_0x1175('0x3c')]);_0x3a44a6[_0x1175('0x41')]=_[_0x1175('0x42')](_0x92cca9['query']);_0x3a44a6['filters']=_[_0x1175('0x43')](_0x3a44a6[_0x1175('0x40')],_0x3a44a6[_0x1175('0x41')]);_0x71c6bc[_0x1175('0x45')]=_['intersection'](_0x3a44a6[_0x1175('0x40')],qs['fields'](_0x92cca9['query'][_0x1175('0x44')]));_0x71c6bc[_0x1175('0x45')]=_0x71c6bc[_0x1175('0x45')]['length']?_0x71c6bc[_0x1175('0x45')]:_0x3a44a6[_0x1175('0x40')];if(_0x92cca9[_0x1175('0x41')]['includeAll']){_0x71c6bc['include']=[{'all':!![]}];}_0x71c6bc=_[_0x1175('0x4d')]({},_0x71c6bc,_0x92cca9[_0x1175('0x50')]);return db[_0x1175('0x3b')][_0x1175('0x57')](_0x71c6bc)[_0x1175('0x38')](handleEntityNotFound(_0x49b6c6,null))[_0x1175('0x38')](respondWithResult(_0x49b6c6,null))[_0x1175('0x2d')](handleError(_0x49b6c6,null));};exports[_0x1175('0x58')]=function(_0x213b7c,_0x191b44){return db[_0x1175('0x3b')][_0x1175('0x58')](_0x213b7c['body'],{})['then'](respondWithResult(_0x191b44,0xc9))[_0x1175('0x2d')](handleError(_0x191b44,null));};exports[_0x1175('0x37')]=function(_0x527c58,_0x306160){if(_0x527c58['body']['id']){delete _0x527c58['body']['id'];}return db[_0x1175('0x3b')][_0x1175('0x57')]({'where':{'id':_0x527c58[_0x1175('0x56')]['id']}})[_0x1175('0x38')](handleEntityNotFound(_0x306160,null))[_0x1175('0x38')](saveUpdates(_0x527c58['body'],null))['then'](respondWithResult(_0x306160,null))['catch'](handleError(_0x306160,null));};exports['destroy']=function(_0x3070b7,_0x2e2654){return db['OpenchannelMessage'][_0x1175('0x57')]({'where':{'id':_0x3070b7[_0x1175('0x56')]['id']}})[_0x1175('0x38')](handleEntityNotFound(_0x2e2654,null))[_0x1175('0x38')](removeEntity(_0x2e2654,null))[_0x1175('0x2d')](handleError(_0x2e2654,null));};exports[_0x1175('0x59')]=function(_0x12d02d,_0x23316e){return db[_0x1175('0x3b')][_0x1175('0x59')]()['then'](respondWithResult(_0x23316e,null))[_0x1175('0x2d')](handleError(_0x23316e,null));};var interaction_log=require(_0x1175('0x19'))('openchannel-interactions');exports[_0x1175('0x5a')]=function(_0x2e03be,_0x4606c8,_0xcab9c4){var _0x470f8b={'agent':{},'channel':_0x1175('0x5b')};if(_0x2e03be[_0x1175('0x5c')]['id']){delete _0x2e03be['body']['id'];}_0x2e03be[_0x1175('0x5c')][_0x1175('0x5d')]=!![];_0x2e03be['body'][_0x1175('0x5e')]=moment()[_0x1175('0x5f')](_0x1175('0x60'));_0x2e03be[_0x1175('0x5c')][_0x1175('0x61')]=_0x2e03be['body']['UserId']||_0x2e03be[_0x1175('0x62')]['id'];_0x470f8b[_0x1175('0x63')]['id']=_0x2e03be['body'][_0x1175('0x61')];return db['OpenchannelMessage']['find']({'where':{'id':_0x2e03be[_0x1175('0x56')]['id'],'UserId':null}})[_0x1175('0x38')](handleEntityNotFound(_0x4606c8,null))['then'](saveUpdates(_0x2e03be[_0x1175('0x5c')],null))[_0x1175('0x38')](function(_0xa3f39f){if(_0xa3f39f){_0x470f8b[_0x1175('0x2b')]=_0xa3f39f[_0x1175('0x64')]({'plain':!![]});return db[_0x1175('0x65')][_0x1175('0x57')]({'where':{'id':_0xa3f39f[_0x1175('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4606c8,null))['then'](function(_0x2bc197){if(_0x2bc197){return _0x2bc197['update']({'UserId':_0x2e03be[_0x1175('0x5c')][_0x1175('0x61')],'read1stAt':_[_0x1175('0x67')](_0x2bc197['read1stAt'])?moment()[_0x1175('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1c912a){if(_0x1c912a){_0x470f8b[_0x1175('0x68')]=_0x1c912a[_0x1175('0x64')]({'plain':!![]});interaction_log[_0x1175('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e03be['user']['id'],_0x2e03be[_0x1175('0x62')][_0x1175('0x39')],_0x2e03be['user'][_0x1175('0x69')],_0x470f8b['interaction']['id'],_0x2e03be[_0x1175('0x5c')]?JSON[_0x1175('0x28')](_0x2e03be['body']):'null');return respondWithRpcPromise(_0x1175('0x6a'),'acceptMessage',_0x470f8b);}return null;})[_0x1175('0x38')](function(_0x27ab44){var _0x3f7b68=_0x1175('0x6b')+_0x27ab44[_0x1175('0x2b')][_0x1175('0x6c')];return db[_0x1175('0x6d')][_0x1175('0x41')](_0x3f7b68,{'type':db[_0x1175('0x6e')][_0x1175('0x6f')][_0x1175('0x70')],'raw':!![]})[_0x1175('0x38')](function(_0x47ca2e){return _0x47ca2e;});})['then'](function(_0x1c3d8d){if(_0x1c3d8d){_0x470f8b['message'][_0x1175('0x71')]=_0x1c3d8d[0x0];if(!_0x2e03be['body'][_0x1175('0x61')])return;return db[_0x1175('0x72')][_0x1175('0x57')]({'where':{'id':_0x2e03be[_0x1175('0x5c')][_0x1175('0x61')],'role':_0x1175('0x63')},'attributes':['id',_0x1175('0x39'),_0x1175('0x73'),'email',_0x1175('0x74')],'raw':!![]});}return null;})[_0x1175('0x38')](function(_0x56b312){if(!_0x56b312)return null;_0x470f8b[_0x1175('0x2b')][_0x1175('0x63')]=_0x56b312;return _0x470f8b;})['then'](function(_0x477bee){if(_0x477bee){if(_0x2e03be[_0x1175('0x5c')][_0x1175('0x75')]){_0x470f8b[_0x1175('0x2b')][_0x1175('0x76')]=util[_0x1175('0x5f')](_0x1175('0x77'),_0x2e03be[_0x1175('0x62')]['name']);_0x470f8b['message'][_0x1175('0x78')]=_0x470f8b[_0x1175('0x78')];_0x470f8b[_0x1175('0x2b')][_0x1175('0x79')]=_0x470f8b[_0x1175('0x78')];_0x470f8b[_0x1175('0x2b')][_0x1175('0x7a')]=_0x1175('0x5a');return respondWithRpcPromise(_0x1175('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x470f8b[_0x1175('0x2b')]},client9002)[_0x1175('0x38')](function(){return _0x470f8b;});}return _0x470f8b;}return null;})['then'](respondWithResult(_0x4606c8,null))[_0x1175('0x2d')](handleError(_0x4606c8,null));};var interaction_log=require(_0x1175('0x19'))(_0x1175('0x7c'));exports[_0x1175('0x7d')]=function(_0x4251f9,_0x593109,_0x2ac4e2){var _0x30e4a7={'agent':{},'channel':_0x1175('0x5b')};if(_0x4251f9[_0x1175('0x5c')]['id']){delete _0x4251f9[_0x1175('0x5c')]['id'];}_0x4251f9[_0x1175('0x5c')][_0x1175('0x61')]=_0x4251f9[_0x1175('0x5c')][_0x1175('0x61')]||_0x4251f9[_0x1175('0x62')]['id'];_0x30e4a7['agent']['id']=_0x4251f9['body']['UserId'];return db[_0x1175('0x3b')][_0x1175('0x57')]({'where':{'id':_0x4251f9[_0x1175('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x593109,null))[_0x1175('0x38')](function(_0x1f9722){if(_0x1f9722){_0x30e4a7[_0x1175('0x2b')]=_0x1f9722[_0x1175('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1175('0x57')]({'where':{'id':_0x1f9722[_0x1175('0x66')]}});}return null;})[_0x1175('0x38')](handleEntityNotFound(_0x593109,null))[_0x1175('0x38')](function(_0x4a1311){if(_0x4a1311){_0x30e4a7[_0x1175('0x68')]=_0x4a1311[_0x1175('0x64')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4251f9['user']['id'],_0x4251f9[_0x1175('0x62')][_0x1175('0x39')],_0x4251f9['user']['role'],_0x30e4a7['interaction']['id'],_0x4251f9[_0x1175('0x5c')]?JSON['stringify'](_0x4251f9['body']):'null');return respondWithRpcPromise(_0x1175('0x7e'),'rejectMessage',_0x30e4a7);}return null;})[_0x1175('0x38')](function(_0xf28135){var _0x365dc9=_0x1175('0x6b')+_0xf28135[_0x1175('0x2b')][_0x1175('0x6c')];return db[_0x1175('0x6d')]['query'](_0x365dc9,{'type':db['Sequelize'][_0x1175('0x6f')]['SELECT'],'raw':!![]})[_0x1175('0x38')](function(_0x1bb019){return _0x1bb019;});})[_0x1175('0x38')](function(_0x196f82){if(_0x196f82){_0x30e4a7['message'][_0x1175('0x71')]=_0x196f82[0x0];if(!_0x4251f9[_0x1175('0x5c')]['UserId'])return;return db[_0x1175('0x72')]['find']({'where':{'id':_0x4251f9[_0x1175('0x5c')][_0x1175('0x61')],'role':'agent'},'attributes':['id',_0x1175('0x39'),_0x1175('0x73'),_0x1175('0x7f'),_0x1175('0x74')],'raw':!![]});}return null;})[_0x1175('0x38')](function(_0x1820d5){if(!_0x1820d5)return null;_0x30e4a7[_0x1175('0x2b')]['agent']=_0x1820d5;return _0x30e4a7;})[_0x1175('0x38')](function(_0x2d533d){if(_0x2d533d){_0x2d533d[_0x1175('0x2b')]['interface']=util[_0x1175('0x5f')]('SIP/%s',_0x4251f9[_0x1175('0x62')][_0x1175('0x39')]);_0x2d533d[_0x1175('0x2b')][_0x1175('0x78')]=_0x30e4a7[_0x1175('0x78')];_0x2d533d[_0x1175('0x2b')][_0x1175('0x79')]=_0x30e4a7[_0x1175('0x78')];_0x2d533d[_0x1175('0x2b')]['event']=_0x1175('0x7d');respondWithRpcPromise(_0x1175('0x7b'),_0x1175('0x7b'),{'event':_0x1175('0x80'),'message':_0x2d533d['message']},client9002);return _0x30e4a7;}return null;})[_0x1175('0x38')](respondWithResult(_0x593109,null))['catch'](handleError(_0x593109,null));}; \ No newline at end of file +var _0xe6b4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','merge','options','count','includeAll','include','rows','show','params','length','find','create','body','update','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','QueryTypes','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6b4,0x188));var _0x4e6b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe6b4[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x4e6b('0x0'));var rimraf=require(_0x4e6b('0x1'));var zipdir=require(_0x4e6b('0x2'));var jsonpatch=require(_0x4e6b('0x3'));var rp=require(_0x4e6b('0x4'));var moment=require(_0x4e6b('0x5'));var BPromise=require(_0x4e6b('0x6'));var Mustache=require('mustache');var util=require(_0x4e6b('0x7'));var path=require('path');var sox=require(_0x4e6b('0x8'));var csv=require(_0x4e6b('0x9'));var ejs=require(_0x4e6b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e6b('0xb'));var squel=require(_0x4e6b('0xc'));var crypto=require(_0x4e6b('0xd'));var jsforce=require(_0x4e6b('0xe'));var deskjs=require(_0x4e6b('0xf'));var toCsv=require(_0x4e6b('0x9'));var querystring=require(_0x4e6b('0x10'));var Papa=require('papaparse');var Redis=require(_0x4e6b('0x11'));var authService=require(_0x4e6b('0x12'));var qs=require(_0x4e6b('0x13'));var as=require(_0x4e6b('0x14'));var hardwareService=require(_0x4e6b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e6b('0x16'));var licenseUtil=require(_0x4e6b('0x17'));var db=require(_0x4e6b('0x18'))['db'];config['redis']=_[_0x4e6b('0x19')](config['redis'],{'host':_0x4e6b('0x1a'),'port':0x18eb});var socket=require(_0x4e6b('0x1b'))(new Redis(config[_0x4e6b('0x1c')]));require(_0x4e6b('0x1d'))[_0x4e6b('0x1e')](socket);var jayson=require(_0x4e6b('0x1f'));var client=jayson[_0x4e6b('0x20')][_0x4e6b('0x21')]({'port':0x232c});var client9002=jayson[_0x4e6b('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14f822,_0x19df80,_0x1bca29,_0x4f8bf5){return new BPromise(function(_0x20a7f9,_0x4b2438){var _0x281f00=_0x4f8bf5||client;return _0x281f00[_0x4e6b('0x22')](_0x14f822,_0x1bca29)['then'](function(_0x34f2a6){logger[_0x4e6b('0x23')](_0x4e6b('0x24'),_0x19df80,_0x4e6b('0x25'));logger[_0x4e6b('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x19df80,_0x4e6b('0x25'),JSON[_0x4e6b('0x27')](_0x34f2a6));if(_0x34f2a6[_0x4e6b('0x28')]){if(_0x34f2a6[_0x4e6b('0x28')][_0x4e6b('0x29')]===0x1f4){logger['error'](_0x4e6b('0x24'),_0x19df80,_0x34f2a6[_0x4e6b('0x28')][_0x4e6b('0x2a')]);return _0x4b2438(_0x34f2a6[_0x4e6b('0x28')][_0x4e6b('0x2a')]);}logger[_0x4e6b('0x28')](_0x4e6b('0x24'),_0x19df80,_0x34f2a6[_0x4e6b('0x28')]['message']);return _0x20a7f9(_0x34f2a6[_0x4e6b('0x28')][_0x4e6b('0x2a')]);}else{logger[_0x4e6b('0x23')](_0x4e6b('0x24'),_0x19df80,_0x4e6b('0x25'));_0x20a7f9(_0x34f2a6['result']['message']);}})[_0x4e6b('0x2b')](function(_0x59019a){logger[_0x4e6b('0x28')](_0x4e6b('0x24'),_0x19df80,_0x59019a);_0x4b2438(_0x59019a);});});}function respondWithStatusCode(_0x22eea8,_0x381482){_0x381482=_0x381482||0xcc;return function(_0x5dbd28){if(_0x5dbd28){return _0x22eea8['sendStatus'](_0x381482);}return _0x22eea8[_0x4e6b('0x2c')](_0x381482)[_0x4e6b('0x2d')]();};}function respondWithResult(_0x336246,_0x3731ed){_0x3731ed=_0x3731ed||0xc8;return function(_0x2ddae9){if(_0x2ddae9){return _0x336246[_0x4e6b('0x2c')](_0x3731ed)['json'](_0x2ddae9);}};}function respondWithFilteredResult(_0x41cd38,_0x5f2b2d){return function(_0x38f368){if(_0x38f368){var _0x58032a=typeof _0x5f2b2d[_0x4e6b('0x2e')]===_0x4e6b('0x2f')&&typeof _0x5f2b2d[_0x4e6b('0x30')]===_0x4e6b('0x2f');var _0x477a6a=_0x38f368['count'];var _0x7566dd=_0x58032a?0x0:_0x5f2b2d['offset'];var _0x2bcd35=_0x58032a?_0x38f368['count']:_0x5f2b2d['offset']+_0x5f2b2d[_0x4e6b('0x30')];var _0x384aa4;if(_0x2bcd35>=_0x477a6a){_0x2bcd35=_0x477a6a;_0x384aa4=0xc8;}else{_0x384aa4=0xce;}_0x41cd38[_0x4e6b('0x2c')](_0x384aa4);return _0x41cd38[_0x4e6b('0x31')](_0x4e6b('0x32'),_0x7566dd+'-'+_0x2bcd35+'/'+_0x477a6a)[_0x4e6b('0x33')](_0x38f368);}return null;};}function patchUpdates(_0x12b488){return function(_0x55a236){try{jsonpatch[_0x4e6b('0x34')](_0x55a236,_0x12b488,!![]);}catch(_0x5431ac){return BPromise['reject'](_0x5431ac);}return _0x55a236[_0x4e6b('0x35')]();};}function saveUpdates(_0x55f2fb,_0x16ee6c){return function(_0x4a79e6){if(_0x4a79e6){return _0x4a79e6['update'](_0x55f2fb)[_0x4e6b('0x36')](function(_0x372506){return _0x372506;});}return null;};}function removeEntity(_0x1759a8,_0x1177c3){return function(_0x4d37a3){if(_0x4d37a3){return _0x4d37a3['destroy']()[_0x4e6b('0x36')](function(){_0x1759a8[_0x4e6b('0x2c')](0xcc)[_0x4e6b('0x2d')]();});}};}function handleEntityNotFound(_0x4d913a,_0x476a5b){return function(_0x5daa02){if(!_0x5daa02){_0x4d913a[_0x4e6b('0x37')](0x194);}return _0x5daa02;};}function handleError(_0x1a1ecb,_0x4477f9){_0x4477f9=_0x4477f9||0x1f4;return function(_0x3f2f0d){logger[_0x4e6b('0x28')](_0x3f2f0d[_0x4e6b('0x38')]);if(_0x3f2f0d[_0x4e6b('0x39')]){delete _0x3f2f0d[_0x4e6b('0x39')];}_0x1a1ecb[_0x4e6b('0x2c')](_0x4477f9)[_0x4e6b('0x3a')](_0x3f2f0d);};}exports['index']=function(_0x59dca9,_0x112ac9){var _0x2e56cf={},_0x73e31e={},_0xcf77d0={'count':0x0,'rows':[]};var _0x925bf=_[_0x4e6b('0x3b')](db[_0x4e6b('0x3c')][_0x4e6b('0x3d')],function(_0x187b76){return{'name':_0x187b76[_0x4e6b('0x3e')],'type':_0x187b76['type'][_0x4e6b('0x3f')]};});_0x73e31e['model']=_[_0x4e6b('0x3b')](_0x925bf,_0x4e6b('0x39'));_0x73e31e['query']=_[_0x4e6b('0x40')](_0x59dca9[_0x4e6b('0x41')]);_0x73e31e['filters']=_[_0x4e6b('0x42')](_0x73e31e[_0x4e6b('0x43')],_0x73e31e['query']);_0x2e56cf[_0x4e6b('0x44')]=_[_0x4e6b('0x42')](_0x73e31e[_0x4e6b('0x43')],qs[_0x4e6b('0x45')](_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x45')]));_0x2e56cf[_0x4e6b('0x44')]=_0x2e56cf[_0x4e6b('0x44')]['length']?_0x2e56cf['attributes']:_0x73e31e[_0x4e6b('0x43')];if(!_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x46')](_0x4e6b('0x47'))){_0x2e56cf[_0x4e6b('0x30')]=qs[_0x4e6b('0x30')](_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x30')]);_0x2e56cf[_0x4e6b('0x2e')]=qs[_0x4e6b('0x2e')](_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x2e')]);}_0x2e56cf[_0x4e6b('0x48')]=qs[_0x4e6b('0x49')](_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x49')]);_0x2e56cf[_0x4e6b('0x4a')]=qs[_0x4e6b('0x4b')](_['pick'](_0x59dca9[_0x4e6b('0x41')],_0x73e31e[_0x4e6b('0x4b')]),_0x925bf);if(_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x4c')]){_0x2e56cf[_0x4e6b('0x4a')]=_['merge'](_0x2e56cf['where'],{'$or':_[_0x4e6b('0x3b')](_0x925bf,function(_0x385702){if(_0x385702[_0x4e6b('0x4d')]!=='VIRTUAL'){var _0x1b4ac6={};_0x1b4ac6[_0x385702[_0x4e6b('0x39')]]={'$like':'%'+_0x59dca9[_0x4e6b('0x41')]['filter']+'%'};return _0x1b4ac6;}})});}_0x2e56cf=_[_0x4e6b('0x4e')]({},_0x2e56cf,_0x59dca9[_0x4e6b('0x4f')]);var _0x12ecbe={'where':_0x2e56cf[_0x4e6b('0x4a')]};return db[_0x4e6b('0x3c')][_0x4e6b('0x50')](_0x12ecbe)[_0x4e6b('0x36')](function(_0x39a8ad){_0xcf77d0[_0x4e6b('0x50')]=_0x39a8ad;if(_0x59dca9[_0x4e6b('0x41')][_0x4e6b('0x51')]){_0x2e56cf[_0x4e6b('0x52')]=[{'all':!![]}];}return db[_0x4e6b('0x3c')]['findAll'](_0x2e56cf);})[_0x4e6b('0x36')](function(_0x3afb2a){_0xcf77d0[_0x4e6b('0x53')]=_0x3afb2a;return _0xcf77d0;})[_0x4e6b('0x36')](respondWithFilteredResult(_0x112ac9,_0x2e56cf))[_0x4e6b('0x2b')](handleError(_0x112ac9,null));};exports[_0x4e6b('0x54')]=function(_0x43c011,_0xba7ceb){var _0x2dfe74={'raw':!![],'where':{'id':_0x43c011[_0x4e6b('0x55')]['id']}},_0x3dcfeb={};_0x3dcfeb[_0x4e6b('0x43')]=_[_0x4e6b('0x40')](db['OpenchannelMessage'][_0x4e6b('0x3d')]);_0x3dcfeb[_0x4e6b('0x41')]=_['keys'](_0x43c011['query']);_0x3dcfeb[_0x4e6b('0x4b')]=_[_0x4e6b('0x42')](_0x3dcfeb['model'],_0x3dcfeb['query']);_0x2dfe74['attributes']=_[_0x4e6b('0x42')](_0x3dcfeb['model'],qs['fields'](_0x43c011[_0x4e6b('0x41')][_0x4e6b('0x45')]));_0x2dfe74['attributes']=_0x2dfe74['attributes'][_0x4e6b('0x56')]?_0x2dfe74[_0x4e6b('0x44')]:_0x3dcfeb[_0x4e6b('0x43')];if(_0x43c011[_0x4e6b('0x41')]['includeAll']){_0x2dfe74[_0x4e6b('0x52')]=[{'all':!![]}];}_0x2dfe74=_[_0x4e6b('0x4e')]({},_0x2dfe74,_0x43c011['options']);return db['OpenchannelMessage'][_0x4e6b('0x57')](_0x2dfe74)['then'](handleEntityNotFound(_0xba7ceb,null))['then'](respondWithResult(_0xba7ceb,null))['catch'](handleError(_0xba7ceb,null));};exports[_0x4e6b('0x58')]=function(_0x53ba2c,_0x9c7c31){return db['OpenchannelMessage'][_0x4e6b('0x58')](_0x53ba2c[_0x4e6b('0x59')],{})[_0x4e6b('0x36')](respondWithResult(_0x9c7c31,0xc9))[_0x4e6b('0x2b')](handleError(_0x9c7c31,null));};exports[_0x4e6b('0x5a')]=function(_0x1328a3,_0x28cd31){if(_0x1328a3[_0x4e6b('0x59')]['id']){delete _0x1328a3['body']['id'];}return db[_0x4e6b('0x3c')][_0x4e6b('0x57')]({'where':{'id':_0x1328a3[_0x4e6b('0x55')]['id']}})['then'](handleEntityNotFound(_0x28cd31,null))[_0x4e6b('0x36')](saveUpdates(_0x1328a3[_0x4e6b('0x59')],null))[_0x4e6b('0x36')](respondWithResult(_0x28cd31,null))[_0x4e6b('0x2b')](handleError(_0x28cd31,null));};exports[_0x4e6b('0x5b')]=function(_0x38c135,_0x33caa1){return db[_0x4e6b('0x3c')][_0x4e6b('0x57')]({'where':{'id':_0x38c135[_0x4e6b('0x55')]['id']}})[_0x4e6b('0x36')](handleEntityNotFound(_0x33caa1,null))[_0x4e6b('0x36')](removeEntity(_0x33caa1,null))[_0x4e6b('0x2b')](handleError(_0x33caa1,null));};exports[_0x4e6b('0x5c')]=function(_0x99e1c8,_0x7bfc71){return db[_0x4e6b('0x3c')][_0x4e6b('0x5c')]()[_0x4e6b('0x36')](respondWithResult(_0x7bfc71,null))['catch'](handleError(_0x7bfc71,null));};var interaction_log=require(_0x4e6b('0x5d'))(_0x4e6b('0x5e'));exports[_0x4e6b('0x5f')]=function(_0x23539c,_0x57eb1f,_0x555690){var _0x59931f={'agent':{},'channel':_0x4e6b('0x60')};if(_0x23539c['body']['id']){delete _0x23539c[_0x4e6b('0x59')]['id'];}_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x61')]=!![];_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x62')]=moment()[_0x4e6b('0x63')](_0x4e6b('0x64'));_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x65')]=_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x65')]||_0x23539c['user']['id'];_0x59931f[_0x4e6b('0x66')]['id']=_0x23539c[_0x4e6b('0x59')]['UserId'];return db[_0x4e6b('0x3c')]['find']({'where':{'id':_0x23539c[_0x4e6b('0x55')]['id'],'UserId':null}})[_0x4e6b('0x36')](handleEntityNotFound(_0x57eb1f,null))[_0x4e6b('0x36')](saveUpdates(_0x23539c[_0x4e6b('0x59')],null))[_0x4e6b('0x36')](function(_0x19c73d){if(_0x19c73d){_0x59931f[_0x4e6b('0x2a')]=_0x19c73d[_0x4e6b('0x67')]({'plain':!![]});return db[_0x4e6b('0x68')][_0x4e6b('0x57')]({'where':{'id':_0x19c73d[_0x4e6b('0x69')]}});}return null;})[_0x4e6b('0x36')](handleEntityNotFound(_0x57eb1f,null))[_0x4e6b('0x36')](function(_0x5595c5){if(_0x5595c5){return _0x5595c5[_0x4e6b('0x5a')]({'UserId':_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x65')],'read1stAt':_[_0x4e6b('0x6a')](_0x5595c5['read1stAt'])?moment()[_0x4e6b('0x63')](_0x4e6b('0x64')):undefined});}return null;})['then'](function(_0x1f1a79){if(_0x1f1a79){_0x59931f[_0x4e6b('0x6b')]=_0x1f1a79['get']({'plain':!![]});interaction_log[_0x4e6b('0x23')](_0x4e6b('0x6c'),_0x23539c[_0x4e6b('0x6d')]['id'],_0x23539c[_0x4e6b('0x6d')][_0x4e6b('0x39')],_0x23539c['user'][_0x4e6b('0x6e')],_0x59931f[_0x4e6b('0x6b')]['id'],_0x23539c[_0x4e6b('0x59')]?JSON[_0x4e6b('0x27')](_0x23539c['body']):'null');return respondWithRpcPromise(_0x4e6b('0x6f'),_0x4e6b('0x70'),_0x59931f);}return null;})[_0x4e6b('0x36')](function(_0x350c0f){var _0x10adb0=_0x4e6b('0x71')+_0x350c0f[_0x4e6b('0x2a')]['ContactId'];return db[_0x4e6b('0x72')]['query'](_0x10adb0,{'type':db[_0x4e6b('0x73')]['QueryTypes'][_0x4e6b('0x74')],'raw':!![]})['then'](function(_0x328afe){return _0x328afe;});})['then'](function(_0x362fe6){if(_0x362fe6){_0x59931f[_0x4e6b('0x2a')][_0x4e6b('0x75')]=_0x362fe6[0x0];if(!_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x65')])return;return db['User'][_0x4e6b('0x57')]({'where':{'id':_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x65')],'role':_0x4e6b('0x66')},'attributes':['id',_0x4e6b('0x39'),_0x4e6b('0x76'),_0x4e6b('0x77'),_0x4e6b('0x78')],'raw':!![]});}return null;})[_0x4e6b('0x36')](function(_0x3227a9){if(!_0x3227a9)return null;_0x59931f['message'][_0x4e6b('0x66')]=_0x3227a9;return _0x59931f;})[_0x4e6b('0x36')](function(_0x3ed264){if(_0x3ed264){if(_0x23539c[_0x4e6b('0x59')][_0x4e6b('0x79')]){_0x59931f[_0x4e6b('0x2a')][_0x4e6b('0x7a')]=util[_0x4e6b('0x63')](_0x4e6b('0x7b'),_0x23539c['user']['name']);_0x59931f[_0x4e6b('0x2a')][_0x4e6b('0x7c')]=_0x59931f[_0x4e6b('0x7c')];_0x59931f['message'][_0x4e6b('0x7d')]=_0x59931f['channel'];_0x59931f[_0x4e6b('0x2a')]['event']=_0x4e6b('0x5f');return respondWithRpcPromise(_0x4e6b('0x7e'),_0x4e6b('0x7e'),{'event':_0x4e6b('0x7f'),'message':_0x59931f[_0x4e6b('0x2a')]},client9002)[_0x4e6b('0x36')](function(){return _0x59931f;});}return _0x59931f;}return null;})[_0x4e6b('0x36')](respondWithResult(_0x57eb1f,null))['catch'](handleError(_0x57eb1f,null));};var interaction_log=require(_0x4e6b('0x5d'))('openchannel-interactions');exports[_0x4e6b('0x80')]=function(_0x3d465d,_0x286024,_0x2ea3b3){var _0x2234b8={'agent':{},'channel':_0x4e6b('0x60')};if(_0x3d465d[_0x4e6b('0x59')]['id']){delete _0x3d465d[_0x4e6b('0x59')]['id'];}_0x3d465d[_0x4e6b('0x59')][_0x4e6b('0x65')]=_0x3d465d[_0x4e6b('0x59')][_0x4e6b('0x65')]||_0x3d465d[_0x4e6b('0x6d')]['id'];_0x2234b8[_0x4e6b('0x66')]['id']=_0x3d465d[_0x4e6b('0x59')][_0x4e6b('0x65')];return db[_0x4e6b('0x3c')][_0x4e6b('0x57')]({'where':{'id':_0x3d465d[_0x4e6b('0x55')]['id'],'UserId':null}})[_0x4e6b('0x36')](handleEntityNotFound(_0x286024,null))[_0x4e6b('0x36')](function(_0x4e95cc){if(_0x4e95cc){_0x2234b8[_0x4e6b('0x2a')]=_0x4e95cc[_0x4e6b('0x67')]({'plain':!![]});return db[_0x4e6b('0x68')]['find']({'where':{'id':_0x4e95cc[_0x4e6b('0x69')]}});}return null;})[_0x4e6b('0x36')](handleEntityNotFound(_0x286024,null))[_0x4e6b('0x36')](function(_0x5527f2){if(_0x5527f2){_0x2234b8[_0x4e6b('0x6b')]=_0x5527f2[_0x4e6b('0x67')]({'plain':!![]});interaction_log[_0x4e6b('0x23')](_0x4e6b('0x81'),_0x3d465d[_0x4e6b('0x6d')]['id'],_0x3d465d[_0x4e6b('0x6d')][_0x4e6b('0x39')],_0x3d465d['user'][_0x4e6b('0x6e')],_0x2234b8[_0x4e6b('0x6b')]['id'],_0x3d465d[_0x4e6b('0x59')]?JSON[_0x4e6b('0x27')](_0x3d465d[_0x4e6b('0x59')]):_0x4e6b('0x82'));return respondWithRpcPromise(_0x4e6b('0x83'),_0x4e6b('0x84'),_0x2234b8);}return null;})[_0x4e6b('0x36')](function(_0x40b53d){var _0x11488b=_0x4e6b('0x71')+_0x40b53d['message'][_0x4e6b('0x85')];return db[_0x4e6b('0x72')][_0x4e6b('0x41')](_0x11488b,{'type':db[_0x4e6b('0x73')][_0x4e6b('0x86')][_0x4e6b('0x74')],'raw':!![]})['then'](function(_0x1258a2){return _0x1258a2;});})[_0x4e6b('0x36')](function(_0x263976){if(_0x263976){_0x2234b8[_0x4e6b('0x2a')][_0x4e6b('0x75')]=_0x263976[0x0];if(!_0x3d465d[_0x4e6b('0x59')][_0x4e6b('0x65')])return;return db['User'][_0x4e6b('0x57')]({'where':{'id':_0x3d465d[_0x4e6b('0x59')][_0x4e6b('0x65')],'role':'agent'},'attributes':['id',_0x4e6b('0x39'),_0x4e6b('0x76'),'email','internal'],'raw':!![]});}return null;})[_0x4e6b('0x36')](function(_0x375cfa){if(!_0x375cfa)return null;_0x2234b8[_0x4e6b('0x2a')][_0x4e6b('0x66')]=_0x375cfa;return _0x2234b8;})[_0x4e6b('0x36')](function(_0x57958d){if(_0x57958d){_0x57958d['message'][_0x4e6b('0x7a')]=util[_0x4e6b('0x63')](_0x4e6b('0x7b'),_0x3d465d[_0x4e6b('0x6d')][_0x4e6b('0x39')]);_0x57958d[_0x4e6b('0x2a')][_0x4e6b('0x7c')]=_0x2234b8['channel'];_0x57958d[_0x4e6b('0x2a')]['motionChannel']=_0x2234b8['channel'];_0x57958d[_0x4e6b('0x2a')][_0x4e6b('0x87')]='reject';respondWithRpcPromise(_0x4e6b('0x7e'),_0x4e6b('0x7e'),{'event':_0x4e6b('0x88'),'message':_0x57958d[_0x4e6b('0x2a')]},client9002);return _0x2234b8;}return null;})[_0x4e6b('0x36')](respondWithResult(_0x286024,null))[_0x4e6b('0x2b')](handleError(_0x286024,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7755b70..eceb3f0 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 _0x70fe=['exports','events','../../mysqldb','save','update','emit','hook'];(function(_0x5a64ff,_0x9655fe){var _0x5fcfd3=function(_0x3f3a0e){while(--_0x3f3a0e){_0x5a64ff['push'](_0x5a64ff['shift']());}};_0x5fcfd3(++_0x9655fe);}(_0x70fe,0x1d6));var _0xe70f=function(_0x33d7a1,_0x7ff978){_0x33d7a1=_0x33d7a1-0x0;var _0x426e90=_0x70fe[_0x33d7a1];return _0x426e90;};'use strict';var EventEmitter=require(_0xe70f('0x0'));var OpenchannelMessage=require(_0xe70f('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe70f('0x2'),'afterUpdate':_0xe70f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28cbc6){return function(_0x329a1b,_0x2213ba,_0x5a90f4){OpenchannelMessageEvents[_0xe70f('0x4')](_0x28cbc6+':'+_0x329a1b['id'],_0x329a1b);OpenchannelMessageEvents[_0xe70f('0x4')](_0x28cbc6,_0x329a1b);_0x5a90f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe70f('0x5')](e,emitEvent(event));}}module[_0xe70f('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xcb5a=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x40e121,_0x51c9bf){var _0x3585c7=function(_0x3e7b20){while(--_0x3e7b20){_0x40e121['push'](_0x40e121['shift']());}};_0x3585c7(++_0x51c9bf);}(_0xcb5a,0x1d6));var _0xacb5=function(_0xa7a636,_0x528aaf){_0xa7a636=_0xa7a636-0x0;var _0x51258b=_0xcb5a[_0xa7a636];return _0x51258b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xacb5('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xacb5('0x1')](0x0);var events={'afterCreate':_0xacb5('0x2'),'afterUpdate':_0xacb5('0x3'),'afterDestroy':'remove'};function emitEvent(_0xe3dd4d){return function(_0x39ea8b,_0x196513,_0x46d42f){OpenchannelMessageEvents[_0xacb5('0x4')](_0xe3dd4d+':'+_0x39ea8b['id'],_0x39ea8b);OpenchannelMessageEvents[_0xacb5('0x4')](_0xe3dd4d,_0x39ea8b);_0x46d42f(null);};}for(var e in events){if(events[_0xacb5('0x5')](e)){var event=events[e];OpenchannelMessage[_0xacb5('0x6')](e,emitEvent(event));}}module[_0xacb5('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a12eb2b..d64e3b6 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 _0xd717=['find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret','describe','OpenchannelAccount'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xd717,0x1f2));var _0x7d71=function(_0x4833cd,_0x455f75){_0x4833cd=_0x4833cd-0x0;var _0x5209a0=_0xd717[_0x4833cd];return _0x5209a0;};'use strict';var _=require(_0x7d71('0x0'));var util=require(_0x7d71('0x1'));var logger=require(_0x7d71('0x2'))(_0x7d71('0x3'));var moment=require(_0x7d71('0x4'));var BPromise=require(_0x7d71('0x5'));var rp=require(_0x7d71('0x6'));var fs=require('fs');var path=require(_0x7d71('0x7'));var rimraf=require(_0x7d71('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d71('0x9'));module[_0x7d71('0xa')]=function(_0x1fa5da,_0x27f906){return _0x1fa5da[_0x7d71('0xb')](_0x7d71('0xc'),attributes,{'tableName':_0x7d71('0xd'),'paranoid':![],'indexes':[{'name':_0x7d71('0xe'),'fields':[_0x7d71('0xf')],'type':_0x7d71('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x314d87,_0x320cc0,_0x23b82a){var _0x1d2bf1=_0x1fa5da['models'];var _0x558f14=_0x314d87[_0x7d71('0x11')]({'plain':!![]});if(_0x558f14[_0x7d71('0x12')]['toLowerCase']()==='in'||_0x558f14[_0x7d71('0x12')][_0x7d71('0x13')]()==='out'&&!_0x558f14['secret']&&!_['isNil'](_0x558f14[_0x7d71('0x14')])){_0x1d2bf1[_0x7d71('0x15')]['findOne']({'where':{'id':_0x558f14[_0x7d71('0x16')]}})[_0x7d71('0x17')](function(_0x40f059){if(_0x40f059){_0x40f059[_0x7d71('0x18')]({'lastMsgAt':_0x558f14[_0x7d71('0x19')],'lastMsgDirection':_0x558f14[_0x7d71('0x12')][_0x7d71('0x13')]()});}})[_0x7d71('0x1a')](function(_0x66e40c){console[_0x7d71('0x1b')](_0x66e40c);});}if(_0x558f14['direction']===_0x7d71('0x1c')&&!_0x558f14[_0x7d71('0x1d')]){var _0x558f74;_0x1d2bf1['CmContact'][_0x7d71('0x1e')]()[_0x7d71('0x17')](function(_0x317396){return _0x1d2bf1[_0x7d71('0x1f')][_0x7d71('0x20')]({'where':{'id':_0x558f14[_0x7d71('0x21')]},'include':[{'model':_0x1d2bf1[_0x7d71('0x15')],'as':_0x7d71('0x22'),'where':{'id':_0x558f14['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1d2bf1['CmContact'],'as':_0x7d71('0x23'),'attributes':_[_0x7d71('0x24')](_0x317396)}]}]});})['then'](function(_0x5b66f2){_0x558f74=_0x5b66f2[_0x7d71('0x11')]({'plain':!![]});if(_0x558f74&&_0x558f74[_0x7d71('0x25')]){logger[_0x7d71('0x26')](_0x7d71('0x27'),'afterCreate',util[_0x7d71('0x28')](_0x7d71('0x29'),_0x558f14['id'],_0x558f74['replyUri']));if(_0x558f74[_0x7d71('0x22')]&&_0x558f74[_0x7d71('0x22')][_0x7d71('0x2a')]){_0x558f14[_0x7d71('0x2b')]=_[_0x7d71('0x2c')](_0x558f74[_0x7d71('0x22')][0x0],_0x7d71('0x23'));_0x558f14[_0x7d71('0x23')]=_0x558f74[_0x7d71('0x22')][0x0][_0x7d71('0x23')];}var _0x320cc0={'method':_0x7d71('0x2d'),'uri':encodeURI(_0x558f74['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x320cc0[_0x7d71('0x2e')]){case _0x7d71('0x2f'):_0x320cc0['qs']=_0x558f14;break;case _0x7d71('0x2d'):_0x320cc0[_0x7d71('0xf')]=_0x558f14;break;}return rp(_0x320cc0)[_0x7d71('0x17')](function(_0x26c259){logger[_0x7d71('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x7d71('0x30'),util[_0x7d71('0x28')](_0x7d71('0x31'),_0x558f14['id'],_0x558f74[_0x7d71('0x25')]));if(_0x26c259[_0x7d71('0xf')][_0x7d71('0x32')]&&_0x26c259[_0x7d71('0xf')]['threadId']!=_0x558f14['Interaction'][_0x7d71('0x32')]){return _0x1d2bf1[_0x7d71('0x15')][_0x7d71('0x18')]({'threadId':_0x26c259[_0x7d71('0xf')][_0x7d71('0x32')]},{'where':{'id':_0x558f14[_0x7d71('0x2b')]['id']}});}else{return;}})['then'](function(){return _0x314d87['update']({'read':!![]});})[_0x7d71('0x1a')](function(_0x3f2101){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x7d71('0x33')](_0x3f2101,{'showHidden':![],'depth':null}));_0x23b82a();});}else{_0x23b82a();}})[_0x7d71('0x34')](function(){_0x23b82a();});}else{_0x23b82a();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x29c3=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','createdAt','error','out','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','Interaction','catch','afterCreate'];(function(_0xd4e511,_0x3c2f23){var _0x211e6e=function(_0x224824){while(--_0x224824){_0xd4e511['push'](_0xd4e511['shift']());}};_0x211e6e(++_0x3c2f23);}(_0x29c3,0xa3));var _0x329c=function(_0xd0f748,_0x2432e2){_0xd0f748=_0xd0f748-0x0;var _0x5095b4=_0x29c3[_0xd0f748];return _0x5095b4;};'use strict';var _=require(_0x329c('0x0'));var util=require(_0x329c('0x1'));var logger=require('../../config/logger')(_0x329c('0x2'));var moment=require(_0x329c('0x3'));var BPromise=require(_0x329c('0x4'));var rp=require(_0x329c('0x5'));var fs=require('fs');var path=require(_0x329c('0x6'));var rimraf=require(_0x329c('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x329c('0x8')]=function(_0x2ed922,_0x50b0c5){return _0x2ed922[_0x329c('0x9')](_0x329c('0xa'),attributes,{'tableName':_0x329c('0xb'),'paranoid':![],'indexes':[{'name':_0x329c('0xc'),'fields':[_0x329c('0xd')],'type':_0x329c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55336e,_0x5b81ea,_0xbe66a8){var _0x1989cb=_0x2ed922['models'];var _0x444227=_0x55336e[_0x329c('0xf')]({'plain':!![]});if(_0x444227[_0x329c('0x10')]['toLowerCase']()==='in'||_0x444227[_0x329c('0x10')][_0x329c('0x11')]()==='out'&&!_0x444227[_0x329c('0x12')]&&!_[_0x329c('0x13')](_0x444227['UserId'])){_0x1989cb[_0x329c('0x14')][_0x329c('0x15')]({'where':{'id':_0x444227['OpenchannelInteractionId']}})['then'](function(_0xccd7db){if(_0xccd7db){_0xccd7db['update']({'lastMsgAt':_0x444227[_0x329c('0x16')],'lastMsgDirection':_0x444227['direction'][_0x329c('0x11')]()});}})['catch'](function(_0x2252ab){console[_0x329c('0x17')](_0x2252ab);});}if(_0x444227[_0x329c('0x10')]===_0x329c('0x18')&&!_0x444227[_0x329c('0x12')]){var _0x5dd0cf;_0x1989cb['CmContact'][_0x329c('0x19')]()[_0x329c('0x1a')](function(_0x3851e2){return _0x1989cb[_0x329c('0x1b')]['find']({'where':{'id':_0x444227[_0x329c('0x1c')]},'include':[{'model':_0x1989cb['OpenchannelInteraction'],'as':_0x329c('0x1d'),'where':{'id':_0x444227[_0x329c('0x1e')]},'limit':0x1,'include':[{'model':_0x1989cb[_0x329c('0x1f')],'as':_0x329c('0x20'),'attributes':_[_0x329c('0x21')](_0x3851e2)}]}]});})[_0x329c('0x1a')](function(_0xf28ab3){_0x5dd0cf=_0xf28ab3['get']({'plain':!![]});if(_0x5dd0cf&&_0x5dd0cf['replyUri']){logger[_0x329c('0x22')](_0x329c('0x23'),'afterCreate',util[_0x329c('0x24')](_0x329c('0x25'),_0x444227['id'],_0x5dd0cf[_0x329c('0x26')]));if(_0x5dd0cf[_0x329c('0x1d')]&&_0x5dd0cf['Interactions'][_0x329c('0x27')]){_0x444227['Interaction']=_[_0x329c('0x28')](_0x5dd0cf[_0x329c('0x1d')][0x0],_0x329c('0x20'));_0x444227[_0x329c('0x20')]=_0x5dd0cf[_0x329c('0x1d')][0x0][_0x329c('0x20')];}var _0x5b81ea={'method':_0x329c('0x29'),'uri':encodeURI(_0x5dd0cf['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5b81ea['method']){case _0x329c('0x2a'):_0x5b81ea['qs']=_0x444227;break;case _0x329c('0x29'):_0x5b81ea[_0x329c('0xd')]=_0x444227;break;}return rp(_0x5b81ea)[_0x329c('0x1a')](function(_0xd14bf4){logger[_0x329c('0x22')](_0x329c('0x23'),'afterCreate',util[_0x329c('0x24')](_0x329c('0x2b'),_0x444227['id'],_0x5dd0cf['replyUri']));if(_0xd14bf4['body'][_0x329c('0x2c')]&&_0xd14bf4[_0x329c('0xd')][_0x329c('0x2c')]!=_0x444227['Interaction'][_0x329c('0x2c')]){return _0x1989cb[_0x329c('0x14')][_0x329c('0x2d')]({'threadId':_0xd14bf4[_0x329c('0xd')][_0x329c('0x2c')]},{'where':{'id':_0x444227[_0x329c('0x2e')]['id']}});}else{return;}})[_0x329c('0x1a')](function(){return _0x55336e[_0x329c('0x2d')]({'read':!![]});})[_0x329c('0x2f')](function(_0x21c897){logger[_0x329c('0x17')](_0x329c('0x23'),_0x329c('0x30'),util[_0x329c('0x31')](_0x21c897,{'showHidden':![],'depth':null}));_0xbe66a8();});}else{_0xbe66a8();}})[_0x329c('0x32')](function(){_0xbe66a8();});}else{_0xbe66a8();}}},'charset':_0x329c('0x33'),'collate':_0x329c('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fcc27df..c3e1633 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x279f13,_0x20331d){var _0x2a22e8=function(_0x36247b){while(--_0x36247b){_0x279f13['push'](_0x279f13['shift']());}};_0x2a22e8(++_0x20331d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x253882,_0x1fc9ee){var _0x5d0f34=function(_0x531c6b){while(--_0x531c6b){_0x253882['push'](_0x253882['shift']());}};_0x5d0f34(++_0x1fc9ee);}(_0x2ef3,0xba));var _0x32ef=function(_0x4477d0,_0x26f7bf){_0x4477d0=_0x4477d0-0x0;var _0x292742=_0x2ef3[_0x4477d0];return _0x292742;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 46c56d8..e028fed 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 _0x5f4a=['register','length','openchannelMessage:','./openchannelMessage.events','save','update','removeListener'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x5f4a,0x1bc));var _0xa5f4=function(_0x43b8f2,_0x4b1a29){_0x43b8f2=_0x43b8f2-0x0;var _0x3b5a31=_0x5f4a[_0x43b8f2];return _0x3b5a31;};'use strict';var OpenchannelMessageEvents=require(_0xa5f4('0x0'));var events=[_0xa5f4('0x1'),'remove',_0xa5f4('0x2')];function createListener(_0x4bcd9e,_0x4f268e){return function(_0x4bc0e8){_0x4f268e['emit'](_0x4bcd9e,_0x4bc0e8);};}function removeListener(_0x3afe01,_0x33965b){return function(){OpenchannelMessageEvents[_0xa5f4('0x3')](_0x3afe01,_0x33965b);};}exports[_0xa5f4('0x4')]=function(_0x36ebe2){for(var _0x347b81=0x0,_0x27c2f2=events[_0xa5f4('0x5')];_0x347b81<_0x27c2f2;_0x347b81++){var _0x8ecb1b=events[_0x347b81];var _0x416a8f=createListener(_0xa5f4('0x6')+_0x8ecb1b,_0x36ebe2);OpenchannelMessageEvents['on'](_0x8ecb1b,_0x416a8f);}}; \ No newline at end of file +var _0xd983=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0xccdd4e,_0x3bd2d2){var _0xfb7d09=function(_0x995d75){while(--_0x995d75){_0xccdd4e['push'](_0xccdd4e['shift']());}};_0xfb7d09(++_0x3bd2d2);}(_0xd983,0x7d));var _0x3d98=function(_0x10ed79,_0x5b8041){_0x10ed79=_0x10ed79-0x0;var _0x2e502f=_0xd983[_0x10ed79];return _0x2e502f;};'use strict';var OpenchannelMessageEvents=require(_0x3d98('0x0'));var events=[_0x3d98('0x1'),_0x3d98('0x2'),'update'];function createListener(_0x282341,_0x1d5601){return function(_0x1cb3ca){_0x1d5601[_0x3d98('0x3')](_0x282341,_0x1cb3ca);};}function removeListener(_0x28d595,_0x2d4a92){return function(){OpenchannelMessageEvents[_0x3d98('0x4')](_0x28d595,_0x2d4a92);};}exports[_0x3d98('0x5')]=function(_0x611f2d){for(var _0x21450e=0x0,_0x27df6e=events[_0x3d98('0x6')];_0x21450e<_0x27df6e;_0x21450e++){var _0x2ee957=events[_0x21450e];var _0x5b4af0=createListener(_0x3d98('0x7')+_0x2ee957,_0x611f2d);OpenchannelMessageEvents['on'](_0x2ee957,_0x5b4af0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c303aa2..f8375a0 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 _0x3335=['addTeams','addAgents','put','delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3335,0xae));var _0x5333=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x3335[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require('multer');var util=require(_0x5333('0x0'));var path=require(_0x5333('0x1'));var timeout=require(_0x5333('0x2'));var express=require('express');var router=express[_0x5333('0x3')]();var fs_extra=require(_0x5333('0x4'));var auth=require(_0x5333('0x5'));var interaction=require(_0x5333('0x6'));var config=require(_0x5333('0x7'));var controller=require(_0x5333('0x8'));router[_0x5333('0x9')]('/',auth['isAuthenticated'](),controller[_0x5333('0xa')]);router['get'](_0x5333('0xb'),auth[_0x5333('0xc')](),controller[_0x5333('0xd')]);router[_0x5333('0x9')]('/:id',auth[_0x5333('0xc')](),controller[_0x5333('0xe')]);router[_0x5333('0x9')](_0x5333('0xf'),auth['isAuthenticated'](),controller[_0x5333('0x10')]);router[_0x5333('0x9')](_0x5333('0x11'),auth['isAuthenticated'](),controller[_0x5333('0x12')]);router[_0x5333('0x9')]('/:id/users',auth[_0x5333('0xc')](),controller[_0x5333('0x13')]);router[_0x5333('0x14')]('/',auth['isAuthenticated'](),controller[_0x5333('0x15')]);router[_0x5333('0x14')]('/:id/teams',auth[_0x5333('0xc')](),controller[_0x5333('0x16')]);router[_0x5333('0x14')]('/:id/users',auth[_0x5333('0xc')](),controller[_0x5333('0x17')]);router[_0x5333('0x18')]('/:id',auth[_0x5333('0xc')](),controller['update']);router[_0x5333('0x19')](_0x5333('0x1a'),auth[_0x5333('0xc')](),controller['destroy']);router[_0x5333('0x19')](_0x5333('0x11'),auth[_0x5333('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x5333('0xc')](),controller['removeAgents']);module[_0x5333('0x1b')]=router; \ No newline at end of file +var _0xe735=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id'];(function(_0x28c752,_0x238454){var _0x30cd6c=function(_0x4c71be){while(--_0x4c71be){_0x28c752['push'](_0x28c752['shift']());}};_0x30cd6c(++_0x238454);}(_0xe735,0x128));var _0x5e73=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0xe735[_0x60286b];return _0x5dff69;};'use strict';var multer=require(_0x5e73('0x0'));var util=require(_0x5e73('0x1'));var path=require(_0x5e73('0x2'));var timeout=require(_0x5e73('0x3'));var express=require(_0x5e73('0x4'));var router=express[_0x5e73('0x5')]();var fs_extra=require(_0x5e73('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e73('0x7'));var controller=require(_0x5e73('0x8'));router[_0x5e73('0x9')]('/',auth[_0x5e73('0xa')](),controller[_0x5e73('0xb')]);router[_0x5e73('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5e73('0x9')]('/:id',auth[_0x5e73('0xa')](),controller[_0x5e73('0xc')]);router[_0x5e73('0x9')]('/:id/members',auth[_0x5e73('0xa')](),controller['getMembers']);router[_0x5e73('0x9')](_0x5e73('0xd'),auth[_0x5e73('0xa')](),controller[_0x5e73('0xe')]);router[_0x5e73('0x9')](_0x5e73('0xf'),auth['isAuthenticated'](),controller[_0x5e73('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e73('0x11')]);router[_0x5e73('0x12')](_0x5e73('0xd'),auth[_0x5e73('0xa')](),controller[_0x5e73('0x13')]);router[_0x5e73('0x12')](_0x5e73('0xf'),auth[_0x5e73('0xa')](),controller[_0x5e73('0x14')]);router[_0x5e73('0x15')](_0x5e73('0x16'),auth['isAuthenticated'](),controller[_0x5e73('0x17')]);router[_0x5e73('0x18')](_0x5e73('0x16'),auth[_0x5e73('0xa')](),controller[_0x5e73('0x19')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x5e73('0x1a')]);router['delete'](_0x5e73('0xf'),auth[_0x5e73('0xa')](),controller[_0x5e73('0x1b')]);module[_0x5e73('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e143a0c..62800fb 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 _0x08e7=['rrmemory','roundrobin','exports','STRING','INTEGER'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x08e7,0x197));var _0x708e=function(_0x5e1834,_0x11fc01){_0x5e1834=_0x5e1834-0x0;var _0x3e6bb8=_0x08e7[_0x5e1834];return _0x3e6bb8;};'use strict';var Sequelize=require('sequelize');module[_0x708e('0x0')]={'name':{'type':Sequelize[_0x708e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x708e('0x1')]},'timeout':{'type':Sequelize[_0x708e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x708e('0x3'),'beepall',_0x708e('0x4'))}}; \ No newline at end of file +var _0xc15c=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4bc48f,_0x4b783c){var _0x453148=function(_0x1b6046){while(--_0x1b6046){_0x4bc48f['push'](_0x4bc48f['shift']());}};_0x453148(++_0x4b783c);}(_0xc15c,0x146));var _0xcc15=function(_0x383131,_0x201048){_0x383131=_0x383131-0x0;var _0x1038e6=_0xc15c[_0x383131];return _0x1038e6;};'use strict';var Sequelize=require(_0xcc15('0x0'));module[_0xcc15('0x1')]={'name':{'type':Sequelize[_0xcc15('0x2')],'unique':_0xcc15('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc15('0x2')]},'timeout':{'type':Sequelize[_0xcc15('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc15('0x5')](_0xcc15('0x6'),_0xcc15('0x7'),_0xcc15('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7eecf28..69280e7 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 _0x4b77=['includes','all','union','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','update','then','get','destroy','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','rows','catch','show','params','keys','model','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','filters','nolimit','limit','order','sort','pick','OpenchannelQueueId','filter','findAll','User','findAndCountAll','UserId','openchannelPause','updatedAt','format','SIP','Team','getTeams','hasOwnProperty','addTeams','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4b77,0x180));var _0x74b7=function(_0x5c422f,_0x40274a){_0x5c422f=_0x5c422f-0x0;var _0x193768=_0x4b77[_0x5c422f];return _0x193768;};'use strict';var BPromise=require(_0x74b7('0x0'));var util=require('util');var _=require(_0x74b7('0x1'));var squel=require('squel');var Redis=require(_0x74b7('0x2'));var qs=require(_0x74b7('0x3'));var logger=require(_0x74b7('0x4'))(_0x74b7('0x5'));var config=require('../../config/environment');var db=require(_0x74b7('0x6'))['db'];config['redis']=_['defaults'](config[_0x74b7('0x7')],{'host':_0x74b7('0x8'),'port':0x18eb});var socket=require(_0x74b7('0x9'))(new Redis(config[_0x74b7('0x7')]));require(_0x74b7('0xa'))[_0x74b7('0xb')](socket);function respondWithStatusCode(_0x27403d,_0x28a950){_0x28a950=_0x28a950||0xcc;return function(_0x20520f){if(_0x20520f){return _0x27403d[_0x74b7('0xc')](_0x28a950);}return _0x27403d[_0x74b7('0xd')](_0x28a950)[_0x74b7('0xe')]();};}function respondWithResult(_0x12fb8f,_0xb75a40){_0xb75a40=_0xb75a40||0xc8;return function(_0x52861d){if(_0x52861d){return _0x12fb8f[_0x74b7('0xd')](_0xb75a40)[_0x74b7('0xf')](_0x52861d);}};}function respondWithFilteredResult(_0x3673bf,_0x471c6b){return function(_0x359eb5){if(_0x359eb5){var _0x3bf779=typeof _0x471c6b[_0x74b7('0x10')]==='undefined'&&typeof _0x471c6b['limit']===_0x74b7('0x11');var _0x270ffc=_0x359eb5[_0x74b7('0x12')];var _0x136a62=_0x3bf779?0x0:_0x471c6b[_0x74b7('0x10')];var _0x5a2734=_0x3bf779?_0x359eb5['count']:_0x471c6b[_0x74b7('0x10')]+_0x471c6b['limit'];var _0x5650cb;if(_0x5a2734>=_0x270ffc){_0x5a2734=_0x270ffc;_0x5650cb=0xc8;}else{_0x5650cb=0xce;}_0x3673bf[_0x74b7('0xd')](_0x5650cb);return _0x3673bf[_0x74b7('0x13')]('Content-Range',_0x136a62+'-'+_0x5a2734+'/'+_0x270ffc)[_0x74b7('0xf')](_0x359eb5);}return null;};}function saveUpdates(_0x10832e){return function(_0x3b79a5){if(_0x3b79a5){return _0x3b79a5[_0x74b7('0x14')](_0x10832e)[_0x74b7('0x15')](function(_0xce15ea){return _0xce15ea;});}return null;};}function removeEntity(_0x174a35){return function(_0x550144){if(_0x550144){return _0x550144['destroy']()[_0x74b7('0x15')](function(){var _0x124b79=_0x550144[_0x74b7('0x16')]({'plain':!![]});var _0x189d29='OpenchannelQueues';return db['UserProfileResource'][_0x74b7('0x17')]({'where':{'type':_0x189d29,'resourceId':_0x124b79['id']}})['then'](function(){return _0x550144;});})[_0x74b7('0x15')](function(){_0x174a35[_0x74b7('0xd')](0xcc)[_0x74b7('0xe')]();});}};}function handleEntityNotFound(_0x4515b7){return function(_0x32c58b){if(!_0x32c58b){_0x4515b7[_0x74b7('0xc')](0x194);}return _0x32c58b;};}function handleError(_0x4337ec,_0x75a7c7){_0x75a7c7=_0x75a7c7||0x1f4;return function(_0x5b5cd9){logger[_0x74b7('0x18')](_0x5b5cd9[_0x74b7('0x19')]);if(_0x5b5cd9[_0x74b7('0x1a')]){delete _0x5b5cd9[_0x74b7('0x1a')];}_0x4337ec[_0x74b7('0xd')](_0x75a7c7)[_0x74b7('0x1b')](_0x5b5cd9);};}exports[_0x74b7('0x1c')]=function(_0x54f771,_0x5969b7){var _0x55224c={};var _0x43b167={'count':0x0,'rows':[]};var _0x13e1c8=_[_0x74b7('0x1d')](db[_0x74b7('0x1e')][_0x74b7('0x1f')],function(_0x3c44ce){return{'name':_0x3c44ce['fieldName'],'type':_0x3c44ce[_0x74b7('0x20')][_0x74b7('0x21')]};});_0x55224c=qs[_0x74b7('0x22')](_0x13e1c8,_0x54f771);var _0x2e4b47={'where':_0x55224c[_0x74b7('0x23')]};return db['OpenchannelQueue'][_0x74b7('0x12')](_0x2e4b47)[_0x74b7('0x15')](function(_0xaba3da){_0x43b167[_0x74b7('0x12')]=_0xaba3da;_0x55224c[_0x74b7('0x24')]=qs[_0x74b7('0x24')](_0x54f771[_0x74b7('0x25')]);return db[_0x74b7('0x1e')]['findAll'](_0x55224c);})[_0x74b7('0x15')](function(_0x31e8a2){_0x43b167[_0x74b7('0x26')]=_0x31e8a2;return _0x43b167;})[_0x74b7('0x15')](respondWithFilteredResult(_0x5969b7,_0x55224c))[_0x74b7('0x27')](handleError(_0x5969b7,null));};exports[_0x74b7('0x28')]=function(_0x1c69ed,_0x46f113){var _0x124ce1={'raw':!![],'where':{'id':_0x1c69ed[_0x74b7('0x29')]['id']}},_0x2c92ab={};_0x2c92ab['model']=_[_0x74b7('0x2a')](db[_0x74b7('0x1e')]['rawAttributes']);_0x2c92ab[_0x74b7('0x25')]=_[_0x74b7('0x2a')](_0x1c69ed[_0x74b7('0x25')]);_0x2c92ab['filters']=_['intersection'](_0x2c92ab[_0x74b7('0x2b')],_0x2c92ab[_0x74b7('0x25')]);_0x124ce1[_0x74b7('0x2c')]=_[_0x74b7('0x2d')](_0x2c92ab[_0x74b7('0x2b')],qs[_0x74b7('0x2e')](_0x1c69ed[_0x74b7('0x25')][_0x74b7('0x2e')]));_0x124ce1[_0x74b7('0x2c')]=_0x124ce1['attributes'][_0x74b7('0x2f')]?_0x124ce1['attributes']:_0x2c92ab[_0x74b7('0x2b')];if(_0x1c69ed[_0x74b7('0x25')][_0x74b7('0x30')]){_0x124ce1[_0x74b7('0x24')]=[{'all':!![]}];}_0x124ce1=_[_0x74b7('0x31')]({},_0x124ce1,_0x1c69ed[_0x74b7('0x32')]);return db[_0x74b7('0x1e')][_0x74b7('0x33')](_0x124ce1)['then'](handleEntityNotFound(_0x46f113,null))[_0x74b7('0x15')](respondWithResult(_0x46f113,null))[_0x74b7('0x27')](handleError(_0x46f113,null));};exports[_0x74b7('0x34')]=function(_0x2d338d,_0x3c39c7){return db[_0x74b7('0x1e')][_0x74b7('0x34')](_0x2d338d[_0x74b7('0x35')],{})[_0x74b7('0x15')](function(_0x5971c7){var _0x4558e4=_0x2d338d[_0x74b7('0x36')]['get']({'plain':!![]});if(!_0x4558e4)throw new Error(_0x74b7('0x37'));if(_0x4558e4[_0x74b7('0x38')]===_0x74b7('0x36')){var _0x16ad2b=_0x5971c7[_0x74b7('0x16')]({'plain':!![]});var _0x20bfe9=_0x74b7('0x39');return db[_0x74b7('0x3a')][_0x74b7('0x33')]({'where':{'name':_0x20bfe9,'userProfileId':_0x4558e4[_0x74b7('0x3b')]},'raw':!![]})[_0x74b7('0x15')](function(_0x2770b6){if(_0x2770b6&&_0x2770b6[_0x74b7('0x3c')]===0x0){return db[_0x74b7('0x3d')]['create']({'name':_0x16ad2b['name'],'resourceId':_0x16ad2b['id'],'type':_0x2770b6[_0x74b7('0x1a')],'sectionId':_0x2770b6['id']},{})[_0x74b7('0x15')](function(){return _0x5971c7;});}else{return _0x5971c7;}})[_0x74b7('0x27')](function(_0x15e9b9){logger[_0x74b7('0x18')](_0x74b7('0x3e'),_0x15e9b9);throw _0x15e9b9;});}return _0x5971c7;})[_0x74b7('0x15')](respondWithResult(_0x3c39c7,0xc9))[_0x74b7('0x27')](handleError(_0x3c39c7,null));};exports[_0x74b7('0x14')]=function(_0x2b4aa0,_0x4d8800){if(_0x2b4aa0[_0x74b7('0x35')]['id']){delete _0x2b4aa0[_0x74b7('0x35')]['id'];}return db[_0x74b7('0x1e')]['find']({'where':{'id':_0x2b4aa0['params']['id']}})['then'](handleEntityNotFound(_0x4d8800,null))['then'](saveUpdates(_0x2b4aa0[_0x74b7('0x35')],null))[_0x74b7('0x15')](respondWithResult(_0x4d8800,null))['catch'](handleError(_0x4d8800,null));};exports['destroy']=function(_0x2528ad,_0x1e7b50){return db['OpenchannelQueue'][_0x74b7('0x33')]({'where':{'id':_0x2528ad[_0x74b7('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e7b50,null))[_0x74b7('0x15')](removeEntity(_0x1e7b50,null))[_0x74b7('0x27')](handleError(_0x1e7b50,null));};exports[_0x74b7('0x3f')]=function(_0xa39e95,_0x505f85){return db[_0x74b7('0x1e')][_0x74b7('0x3f')]()[_0x74b7('0x15')](respondWithResult(_0x505f85,null))[_0x74b7('0x27')](handleError(_0x505f85,null));};exports[_0x74b7('0x40')]=function(_0x5f1ff6,_0x643d56){var _0x28a5c9={'raw':!![],'where':{}},_0x2eff92={},_0x16d69f;return db[_0x74b7('0x1e')][_0x74b7('0x41')]({'where':{'id':_0x5f1ff6['params']['id']}})[_0x74b7('0x15')](handleEntityNotFound(_0x643d56,null))[_0x74b7('0x15')](function(_0xa4c6fe){if(_0xa4c6fe){_0x16d69f=_0xa4c6fe[_0x74b7('0x16')]({'plain':!![]});_0x2eff92['model']=_[_0x74b7('0x2a')](db[_0x74b7('0x42')]['rawAttributes']);_0x2eff92[_0x74b7('0x25')]=_[_0x74b7('0x2a')](_0x5f1ff6[_0x74b7('0x25')]);_0x2eff92[_0x74b7('0x43')]=_[_0x74b7('0x2d')](_0x2eff92['model'],_0x2eff92['query']);_0x28a5c9[_0x74b7('0x2c')]=_['intersection'](_0x2eff92[_0x74b7('0x2b')],qs[_0x74b7('0x2e')](_0x5f1ff6[_0x74b7('0x25')][_0x74b7('0x2e')]));_0x28a5c9[_0x74b7('0x2c')]=_0x28a5c9['attributes'][_0x74b7('0x2f')]?_0x28a5c9[_0x74b7('0x2c')]:_0x2eff92[_0x74b7('0x2b')];if(!_0x5f1ff6[_0x74b7('0x25')]['hasOwnProperty'](_0x74b7('0x44'))){_0x28a5c9['limit']=qs[_0x74b7('0x45')](_0x5f1ff6[_0x74b7('0x25')][_0x74b7('0x45')]);_0x28a5c9[_0x74b7('0x10')]=qs['offset'](_0x5f1ff6['query']['offset']);}_0x28a5c9[_0x74b7('0x46')]=qs[_0x74b7('0x47')](_0x5f1ff6[_0x74b7('0x25')][_0x74b7('0x47')]);_0x28a5c9[_0x74b7('0x23')]=qs['filters'](_[_0x74b7('0x48')](_0x5f1ff6[_0x74b7('0x25')],_0x2eff92['filters']));_0x28a5c9['where'][_0x74b7('0x49')]=_0xa4c6fe['id'];if(_0x5f1ff6['query'][_0x74b7('0x4a')]){_0x28a5c9[_0x74b7('0x23')]=_['merge'](_0x28a5c9[_0x74b7('0x23')],{'$or':_[_0x74b7('0x1d')](_0x28a5c9[_0x74b7('0x2c')],function(_0x4e7bd2){var _0x30c842={};_0x30c842[_0x4e7bd2]={'$like':'%'+_0x5f1ff6[_0x74b7('0x25')][_0x74b7('0x4a')]+'%'};return _0x30c842;})});}_0x28a5c9=_[_0x74b7('0x31')]({},_0x28a5c9,_0x5f1ff6[_0x74b7('0x32')]);return db[_0x74b7('0x42')][_0x74b7('0x4b')](_0x28a5c9);}})[_0x74b7('0x15')](function(_0x2a53c0){if(_0x2a53c0){return db[_0x74b7('0x4c')][_0x74b7('0x4d')]({'where':{'id':_['map'](_0x2a53c0,_0x74b7('0x4e')),'role':'agent'},'attributes':['id',_0x74b7('0x1a'),_0x74b7('0x4f'),_0x74b7('0x50'),'createdAt']});}})[_0x74b7('0x15')](function(_0x34ab80){if(_0x34ab80){return{'count':_0x34ab80['count'],'rows':_['map'](_0x34ab80['rows'],function(_0x4362a0){return{'membername':_0x4362a0[_0x74b7('0x1a')],'UserId':_0x4362a0['id'],'queue_name':_0x16d69f[_0x74b7('0x1a')],'OpenchannelQueueId':_0x16d69f['id'],'interface':util[_0x74b7('0x51')]('%s/%s',_0x74b7('0x52'),_0x4362a0[_0x74b7('0x1a')]),'penalty':0x0,'paused':_0x4362a0[_0x74b7('0x4f')],'createdAt':_0x4362a0['createdAt'],'updatedAt':_0x4362a0[_0x74b7('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74b7('0x15')](respondWithFilteredResult(_0x643d56,_0x28a5c9))[_0x74b7('0x27')](handleError(_0x643d56,null));};exports['getTeams']=function(_0x1e4bf5,_0x491e4e){var _0x3057f0={};var _0x2500d3={};var _0xf88379;var _0x56ffbd;return db[_0x74b7('0x1e')][_0x74b7('0x41')]({'where':{'id':_0x1e4bf5[_0x74b7('0x29')]['id']}})[_0x74b7('0x15')](handleEntityNotFound(_0x491e4e,null))['then'](function(_0x2d59a6){if(_0x2d59a6){_0xf88379=_0x2d59a6;_0x2500d3[_0x74b7('0x2b')]=_['keys'](db[_0x74b7('0x53')][_0x74b7('0x1f')]);_0x2500d3[_0x74b7('0x25')]=_['keys'](_0x1e4bf5['query']);_0x2500d3[_0x74b7('0x43')]=_['intersection'](_0x2500d3['model'],_0x2500d3[_0x74b7('0x25')]);_0x3057f0[_0x74b7('0x2c')]=_[_0x74b7('0x2d')](_0x2500d3[_0x74b7('0x2b')],qs[_0x74b7('0x2e')](_0x1e4bf5[_0x74b7('0x25')]['fields']));_0x3057f0[_0x74b7('0x2c')]=_0x3057f0[_0x74b7('0x2c')]['length']?_0x3057f0[_0x74b7('0x2c')]:_0x2500d3[_0x74b7('0x2b')];_0x3057f0[_0x74b7('0x46')]=qs[_0x74b7('0x47')](_0x1e4bf5[_0x74b7('0x25')][_0x74b7('0x47')]);_0x3057f0[_0x74b7('0x23')]=qs[_0x74b7('0x43')](_[_0x74b7('0x48')](_0x1e4bf5[_0x74b7('0x25')],_0x2500d3[_0x74b7('0x43')]));if(_0x1e4bf5['query'][_0x74b7('0x4a')]){_0x3057f0[_0x74b7('0x23')]=_[_0x74b7('0x31')](_0x3057f0['where'],{'$or':_[_0x74b7('0x1d')](_0x3057f0[_0x74b7('0x2c')],function(_0x57e24f){var _0x4c2f05={};_0x4c2f05[_0x57e24f]={'$like':'%'+_0x1e4bf5[_0x74b7('0x25')][_0x74b7('0x4a')]+'%'};return _0x4c2f05;})});}_0x3057f0=_[_0x74b7('0x31')]({},_0x3057f0,_0x1e4bf5[_0x74b7('0x32')]);return _0xf88379[_0x74b7('0x54')](_0x3057f0);}})['then'](function(_0x220123){if(_0x220123){_0x56ffbd=_0x220123[_0x74b7('0x2f')];if(!_0x1e4bf5[_0x74b7('0x25')][_0x74b7('0x55')](_0x74b7('0x44'))){_0x3057f0[_0x74b7('0x45')]=qs[_0x74b7('0x45')](_0x1e4bf5[_0x74b7('0x25')][_0x74b7('0x45')]);_0x3057f0[_0x74b7('0x10')]=qs['offset'](_0x1e4bf5[_0x74b7('0x25')][_0x74b7('0x10')]);}return _0xf88379[_0x74b7('0x54')](_0x3057f0);}})[_0x74b7('0x15')](function(_0x36076d){if(_0x36076d){return _0x36076d?{'count':_0x56ffbd,'rows':_0x36076d}:null;}})['then'](respondWithResult(_0x491e4e,null))[_0x74b7('0x27')](handleError(_0x491e4e,null));};exports[_0x74b7('0x56')]=function(_0x1685ec,_0x59ab4f){var _0x28417a=_0x1685ec[_0x74b7('0x35')]['ids'];return db['Team'][_0x74b7('0x4b')]({'where':{'id':_0x28417a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x74b7('0x57'),'attributes':['id',_0x74b7('0x1a'),_0x74b7('0x58'),_0x74b7('0x59'),_0x74b7('0x5a')],'raw':!![]}]})[_0x74b7('0x15')](function(_0xa2b8b3){if(_0xa2b8b3){var _0x1b588f=_['flatMap'](_0xa2b8b3,function(_0x172d96){var _0x45b781=_0x172d96[_0x74b7('0x16')]({'plain':!![]});return _0x45b781[_0x74b7('0x57')];});return db[_0x74b7('0x1e')]['find']({'where':{'id':_0x1685ec[_0x74b7('0x29')]['id']}})['then'](function(_0x41aafd){return db[_0x74b7('0x5b')][_0x74b7('0x5c')](function(_0x15b304){return _0x41aafd[_0x74b7('0x56')](_0x28417a,{'transaction':_0x15b304})[_0x74b7('0x15')](function(){return BPromise['each'](_0x1b588f,function(_0x4ed761){return db[_0x74b7('0x42')][_0x74b7('0x5d')]({'where':{'UserId':_0x4ed761['id'],'OpenchannelQueueId':_0x1685ec[_0x74b7('0x29')]['id']},'transaction':_0x15b304});});})[_0x74b7('0x15')](function(){_0x1b588f['forEach'](function(_0x56eb57){socket['emit'](_0x74b7('0x5e'),{'UserId':_0x56eb57['id'],'OpenchannelQueueId':_0x41aafd['id']});});});});});}})[_0x74b7('0x15')](respondWithStatusCode(_0x59ab4f,null))[_0x74b7('0x27')](handleError(_0x59ab4f,null));};exports[_0x74b7('0x5f')]=function(_0x123b59,_0x5ed691){return db['Team'][_0x74b7('0x4b')]({'where':{'id':_0x123b59[_0x74b7('0x25')][_0x74b7('0x60')]},'attributes':['id'],'include':[{'model':db[_0x74b7('0x4c')],'as':_0x74b7('0x57'),'attributes':['id'],'raw':!![]}]})[_0x74b7('0x15')](handleEntityNotFound(_0x5ed691,null))['then'](function(_0x193edc){var _0x116da1=_[_0x74b7('0x1d')](_0x193edc,'id');var _0x5236a3=[];var _0x29ccae=[];var _0x1ed041=squel[_0x74b7('0x61')]();_0x1ed041[_0x74b7('0x62')](_0x74b7('0x63'))['from'](_0x74b7('0x64'),'tq')[_0x74b7('0x65')](_0x74b7('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x74b7('0x23')](_0x74b7('0x67'),_0x123b59[_0x74b7('0x29')]['id']);for(var _0x598f24=0x0;_0x598f24<_0x193edc[_0x74b7('0x2f')];_0x598f24+=0x1){let _0x475be9=_0x193edc[_0x598f24];for(var _0x3c82c4=0x0;_0x3c82c4<_0x475be9[_0x74b7('0x57')]['length'];_0x3c82c4+=0x1){let _0x1719f6=_0x475be9[_0x74b7('0x57')][_0x3c82c4];var _0xfc06ea=_0x1ed041[_0x74b7('0x68')]();_0xfc06ea['where'](_0x74b7('0x69'),_0x1719f6['id']);_0x29ccae[_0x74b7('0x6a')](db[_0x74b7('0x5b')][_0x74b7('0x25')](_0xfc06ea[_0x74b7('0x6b')](),{'type':db[_0x74b7('0x5b')][_0x74b7('0x6c')][_0x74b7('0x6d')]})[_0x74b7('0x15')](function(_0x243057){if(_0x243057[_0x74b7('0x2f')]===0x1){return _0x1719f6['id'];}else{var _0x720dfe=_[_0x74b7('0x6e')](_['map'](_0x243057,_0x74b7('0x6f')),function(_0x871f70){return _[_0x74b7('0x70')](_0x116da1,_0x871f70);});if(_0x720dfe){return _0x1719f6['id'];}}}));}}return BPromise[_0x74b7('0x71')](_0x29ccae)[_0x74b7('0x15')](function(_0x4f02e0){_0x5236a3=_(_0x5236a3)[_0x74b7('0x72')](_0x4f02e0)['compact']()[_0x74b7('0x73')]();return db[_0x74b7('0x1e')]['find']({'where':{'id':_0x123b59[_0x74b7('0x29')]['id']}})[_0x74b7('0x15')](function(_0x5aec46){return db[_0x74b7('0x5b')][_0x74b7('0x5c')](function(_0x4ae2e3){return _0x5aec46[_0x74b7('0x5f')](_0x123b59[_0x74b7('0x25')][_0x74b7('0x60')],{'transaction':_0x4ae2e3})[_0x74b7('0x15')](function(){if(!_['isEmpty'](_0x5236a3)){return _0x5aec46[_0x74b7('0x74')](_0x5236a3,{'transaction':_0x4ae2e3});}})[_0x74b7('0x15')](function(){_0x5236a3['forEach'](function(_0x2ca789){socket[_0x74b7('0x75')](_0x74b7('0x76'),{'UserId':_0x2ca789,'OpenchannelQueueId':_0x5aec46['id']});});});});});});})[_0x74b7('0x15')](respondWithStatusCode(_0x5ed691,null))[_0x74b7('0x27')](handleError(_0x5ed691,null));};exports[_0x74b7('0x77')]=function(_0x495e6a,_0x519848){return db[_0x74b7('0x1e')][_0x74b7('0x33')]({'where':{'id':_0x495e6a['params']['id']}})[_0x74b7('0x15')](handleEntityNotFound(_0x519848,null))[_0x74b7('0x15')](function(_0x267d6d){if(_0x267d6d){return _0x267d6d[_0x74b7('0x77')](_0x495e6a[_0x74b7('0x35')][_0x74b7('0x60')],_[_0x74b7('0x78')](_0x495e6a[_0x74b7('0x35')],[_0x74b7('0x60'),'id'])||{})[_0x74b7('0x79')](function(_0x283f1f){for(var _0x450379=0x0;_0x450379<_0x495e6a[_0x74b7('0x35')]['ids'][_0x74b7('0x2f')];_0x450379+=0x1){socket[_0x74b7('0x75')](_0x74b7('0x5e'),{'UserId':Number(_0x495e6a['body'][_0x74b7('0x60')][_0x450379]),'OpenchannelQueueId':Number(_0x495e6a[_0x74b7('0x29')]['id'])});}return _0x283f1f;});}})['then'](respondWithResult(_0x519848,null))[_0x74b7('0x27')](handleError(_0x519848,null));};exports[_0x74b7('0x74')]=function(_0x91f00d,_0x10ed3e){return db[_0x74b7('0x1e')][_0x74b7('0x33')]({'where':{'id':_0x91f00d['params']['id']}})[_0x74b7('0x15')](handleEntityNotFound(_0x10ed3e,null))[_0x74b7('0x15')](function(_0x63134d){if(_0x63134d){return _0x63134d[_0x74b7('0x74')](_0x91f00d['query']['ids'])[_0x74b7('0x15')](function(){if(_[_0x74b7('0x7a')](_0x91f00d[_0x74b7('0x25')][_0x74b7('0x60')])){for(var _0x41ad96=0x0;_0x41ad96<_0x91f00d[_0x74b7('0x25')][_0x74b7('0x60')][_0x74b7('0x2f')];_0x41ad96+=0x1){socket[_0x74b7('0x75')](_0x74b7('0x76'),{'UserId':Number(_0x91f00d['query']['ids'][_0x41ad96]),'OpenchannelQueueId':Number(_0x91f00d[_0x74b7('0x29')]['id'])});}}else{socket[_0x74b7('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x91f00d[_0x74b7('0x25')][_0x74b7('0x60')]),'OpenchannelQueueId':Number(_0x91f00d[_0x74b7('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x10ed3e,null))[_0x74b7('0x27')](handleError(_0x10ed3e,null));};exports['getAgents']=function(_0x25c8c2,_0x11759c){var _0x2a7490={};var _0x57a204={};var _0x2f3517;var _0x585ae8;return db[_0x74b7('0x1e')][_0x74b7('0x41')]({'where':{'id':_0x25c8c2[_0x74b7('0x29')]['id']}})['then'](handleEntityNotFound(_0x11759c,null))['then'](function(_0x60a313){if(_0x60a313){_0x2f3517=_0x60a313;_0x57a204['model']=_['keys'](db[_0x74b7('0x4c')][_0x74b7('0x1f')]);_0x57a204[_0x74b7('0x25')]=_[_0x74b7('0x2a')](_0x25c8c2['query']);_0x57a204['filters']=_['intersection'](_0x57a204[_0x74b7('0x2b')],_0x57a204['query']);_0x2a7490['attributes']=_[_0x74b7('0x2d')](_0x57a204[_0x74b7('0x2b')],qs[_0x74b7('0x2e')](_0x25c8c2[_0x74b7('0x25')][_0x74b7('0x2e')]));_0x2a7490[_0x74b7('0x2c')]=_0x2a7490['attributes']['length']?_0x2a7490['attributes']:_0x57a204[_0x74b7('0x2b')];_0x2a7490[_0x74b7('0x46')]=qs[_0x74b7('0x47')](_0x25c8c2[_0x74b7('0x25')][_0x74b7('0x47')]);_0x2a7490[_0x74b7('0x23')]=qs[_0x74b7('0x43')](_[_0x74b7('0x48')](_0x25c8c2[_0x74b7('0x25')],_0x57a204['filters']));if(_0x25c8c2[_0x74b7('0x25')][_0x74b7('0x4a')]){_0x2a7490[_0x74b7('0x23')]=_[_0x74b7('0x31')](_0x2a7490[_0x74b7('0x23')],{'$or':_[_0x74b7('0x1d')](_0x2a7490[_0x74b7('0x2c')],function(_0x365f8c){var _0x29e948={};_0x29e948[_0x365f8c]={'$like':'%'+_0x25c8c2['query'][_0x74b7('0x4a')]+'%'};return _0x29e948;})});}_0x2a7490=_['merge']({},_0x2a7490,_0x25c8c2[_0x74b7('0x32')]);return _0x2f3517[_0x74b7('0x7b')](_0x2a7490);}})[_0x74b7('0x15')](function(_0x1c7c47){if(_0x1c7c47){_0x585ae8=_0x1c7c47[_0x74b7('0x2f')];if(!_0x25c8c2['query'][_0x74b7('0x55')](_0x74b7('0x44'))){_0x2a7490[_0x74b7('0x45')]=qs[_0x74b7('0x45')](_0x25c8c2['query'][_0x74b7('0x45')]);_0x2a7490[_0x74b7('0x10')]=qs[_0x74b7('0x10')](_0x25c8c2[_0x74b7('0x25')][_0x74b7('0x10')]);}return _0x2f3517[_0x74b7('0x7b')](_0x2a7490);}})['then'](function(_0x19f9f6){if(_0x19f9f6){return _0x19f9f6?{'count':_0x585ae8,'rows':_0x19f9f6}:null;}})[_0x74b7('0x15')](respondWithResult(_0x11759c,null))[_0x74b7('0x27')](handleError(_0x11759c,null));}; \ No newline at end of file +var _0xed64=['ids','omit','getAgents','util','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','where','include','findAll','rows','catch','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','filters','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','params','Team','order','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0xed64,0xf3));var _0x4ed6=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0xed64[_0x27b423];return _0x5c11b8;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ed6('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x4ed6('0x1'));var qs=require(_0x4ed6('0x2'));var logger=require(_0x4ed6('0x3'))('api');var config=require('../../config/environment');var db=require(_0x4ed6('0x4'))['db'];config[_0x4ed6('0x5')]=_[_0x4ed6('0x6')](config[_0x4ed6('0x5')],{'host':_0x4ed6('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ed6('0x5')]));require(_0x4ed6('0x8'))[_0x4ed6('0x9')](socket);function respondWithStatusCode(_0xd3ed83,_0xd69654){_0xd69654=_0xd69654||0xcc;return function(_0x30c0e1){if(_0x30c0e1){return _0xd3ed83[_0x4ed6('0xa')](_0xd69654);}return _0xd3ed83[_0x4ed6('0xb')](_0xd69654)[_0x4ed6('0xc')]();};}function respondWithResult(_0x3d605e,_0x3d4c8c){_0x3d4c8c=_0x3d4c8c||0xc8;return function(_0x5ded5f){if(_0x5ded5f){return _0x3d605e[_0x4ed6('0xb')](_0x3d4c8c)['json'](_0x5ded5f);}};}function respondWithFilteredResult(_0x5f190b,_0x54b5fb){return function(_0x5d8536){if(_0x5d8536){var _0x541a43=typeof _0x54b5fb[_0x4ed6('0xd')]===_0x4ed6('0xe')&&typeof _0x54b5fb[_0x4ed6('0xf')]===_0x4ed6('0xe');var _0x311e0d=_0x5d8536[_0x4ed6('0x10')];var _0x3d66b1=_0x541a43?0x0:_0x54b5fb[_0x4ed6('0xd')];var _0x427aa2=_0x541a43?_0x5d8536[_0x4ed6('0x10')]:_0x54b5fb[_0x4ed6('0xd')]+_0x54b5fb[_0x4ed6('0xf')];var _0x166106;if(_0x427aa2>=_0x311e0d){_0x427aa2=_0x311e0d;_0x166106=0xc8;}else{_0x166106=0xce;}_0x5f190b[_0x4ed6('0xb')](_0x166106);return _0x5f190b[_0x4ed6('0x11')](_0x4ed6('0x12'),_0x3d66b1+'-'+_0x427aa2+'/'+_0x311e0d)[_0x4ed6('0x13')](_0x5d8536);}return null;};}function saveUpdates(_0x18098b){return function(_0x238540){if(_0x238540){return _0x238540[_0x4ed6('0x14')](_0x18098b)[_0x4ed6('0x15')](function(_0xf8aa61){return _0xf8aa61;});}return null;};}function removeEntity(_0x18c55f){return function(_0x5e42e4){if(_0x5e42e4){return _0x5e42e4[_0x4ed6('0x16')]()[_0x4ed6('0x15')](function(){var _0x4a12eb=_0x5e42e4[_0x4ed6('0x17')]({'plain':!![]});var _0x5a9503=_0x4ed6('0x18');return db[_0x4ed6('0x19')][_0x4ed6('0x16')]({'where':{'type':_0x5a9503,'resourceId':_0x4a12eb['id']}})[_0x4ed6('0x15')](function(){return _0x5e42e4;});})['then'](function(){_0x18c55f[_0x4ed6('0xb')](0xcc)[_0x4ed6('0xc')]();});}};}function handleEntityNotFound(_0x3ddfdd){return function(_0x263892){if(!_0x263892){_0x3ddfdd[_0x4ed6('0xa')](0x194);}return _0x263892;};}function handleError(_0x484f4d,_0x338fa4){_0x338fa4=_0x338fa4||0x1f4;return function(_0x1b1f20){logger['error'](_0x1b1f20[_0x4ed6('0x1a')]);if(_0x1b1f20[_0x4ed6('0x1b')]){delete _0x1b1f20[_0x4ed6('0x1b')];}_0x484f4d[_0x4ed6('0xb')](_0x338fa4)['send'](_0x1b1f20);};}exports[_0x4ed6('0x1c')]=function(_0x1fb586,_0x252e42){var _0x23335={};var _0x1ad3f0={'count':0x0,'rows':[]};var _0x1b1013=_[_0x4ed6('0x1d')](db[_0x4ed6('0x1e')][_0x4ed6('0x1f')],function(_0x26c25e){return{'name':_0x26c25e[_0x4ed6('0x20')],'type':_0x26c25e[_0x4ed6('0x21')]['key']};});_0x23335=qs[_0x4ed6('0x22')](_0x1b1013,_0x1fb586);var _0x58e189={'where':_0x23335[_0x4ed6('0x23')]};return db[_0x4ed6('0x1e')][_0x4ed6('0x10')](_0x58e189)[_0x4ed6('0x15')](function(_0xeee19e){_0x1ad3f0[_0x4ed6('0x10')]=_0xeee19e;_0x23335[_0x4ed6('0x24')]=qs[_0x4ed6('0x24')](_0x1fb586['query']);return db['OpenchannelQueue'][_0x4ed6('0x25')](_0x23335);})[_0x4ed6('0x15')](function(_0x1f43a5){_0x1ad3f0[_0x4ed6('0x26')]=_0x1f43a5;return _0x1ad3f0;})['then'](respondWithFilteredResult(_0x252e42,_0x23335))[_0x4ed6('0x27')](handleError(_0x252e42,null));};exports['show']=function(_0x24a572,_0x2e7c61){var _0xf49281={'raw':!![],'where':{'id':_0x24a572['params']['id']}},_0x558592={};_0x558592[_0x4ed6('0x28')]=_[_0x4ed6('0x29')](db['OpenchannelQueue'][_0x4ed6('0x1f')]);_0x558592[_0x4ed6('0x2a')]=_[_0x4ed6('0x29')](_0x24a572[_0x4ed6('0x2a')]);_0x558592['filters']=_['intersection'](_0x558592['model'],_0x558592[_0x4ed6('0x2a')]);_0xf49281[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x558592[_0x4ed6('0x28')],qs['fields'](_0x24a572[_0x4ed6('0x2a')][_0x4ed6('0x2d')]));_0xf49281[_0x4ed6('0x2b')]=_0xf49281[_0x4ed6('0x2b')][_0x4ed6('0x2e')]?_0xf49281['attributes']:_0x558592[_0x4ed6('0x28')];if(_0x24a572['query'][_0x4ed6('0x2f')]){_0xf49281['include']=[{'all':!![]}];}_0xf49281=_[_0x4ed6('0x30')]({},_0xf49281,_0x24a572[_0x4ed6('0x31')]);return db['OpenchannelQueue']['find'](_0xf49281)['then'](handleEntityNotFound(_0x2e7c61,null))[_0x4ed6('0x15')](respondWithResult(_0x2e7c61,null))[_0x4ed6('0x27')](handleError(_0x2e7c61,null));};exports['create']=function(_0x558be6,_0x1527fc){return db[_0x4ed6('0x1e')][_0x4ed6('0x32')](_0x558be6[_0x4ed6('0x33')],{})[_0x4ed6('0x15')](function(_0x1f9df6){var _0x33a8cd=_0x558be6[_0x4ed6('0x34')][_0x4ed6('0x17')]({'plain':!![]});if(!_0x33a8cd)throw new Error(_0x4ed6('0x35'));if(_0x33a8cd[_0x4ed6('0x36')]==='user'){var _0x2e56ac=_0x1f9df6[_0x4ed6('0x17')]({'plain':!![]});var _0x128076=_0x4ed6('0x18');return db[_0x4ed6('0x37')][_0x4ed6('0x38')]({'where':{'name':_0x128076,'userProfileId':_0x33a8cd[_0x4ed6('0x39')]},'raw':!![]})[_0x4ed6('0x15')](function(_0x243c12){if(_0x243c12&&_0x243c12['autoAssociation']===0x0){return db[_0x4ed6('0x19')]['create']({'name':_0x2e56ac[_0x4ed6('0x1b')],'resourceId':_0x2e56ac['id'],'type':_0x243c12['name'],'sectionId':_0x243c12['id']},{})[_0x4ed6('0x15')](function(){return _0x1f9df6;});}else{return _0x1f9df6;}})[_0x4ed6('0x27')](function(_0x3d37a8){logger[_0x4ed6('0x3a')](_0x4ed6('0x3b'),_0x3d37a8);throw _0x3d37a8;});}return _0x1f9df6;})[_0x4ed6('0x15')](respondWithResult(_0x1527fc,0xc9))['catch'](handleError(_0x1527fc,null));};exports[_0x4ed6('0x14')]=function(_0x39ecc2,_0x32f68b){if(_0x39ecc2[_0x4ed6('0x33')]['id']){delete _0x39ecc2['body']['id'];}return db[_0x4ed6('0x1e')][_0x4ed6('0x38')]({'where':{'id':_0x39ecc2['params']['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x32f68b,null))[_0x4ed6('0x15')](saveUpdates(_0x39ecc2[_0x4ed6('0x33')],null))[_0x4ed6('0x15')](respondWithResult(_0x32f68b,null))[_0x4ed6('0x27')](handleError(_0x32f68b,null));};exports['destroy']=function(_0x484d06,_0x16a506){return db[_0x4ed6('0x1e')]['find']({'where':{'id':_0x484d06['params']['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x16a506,null))['then'](removeEntity(_0x16a506,null))[_0x4ed6('0x27')](handleError(_0x16a506,null));};exports[_0x4ed6('0x3c')]=function(_0xec3795,_0x4aa934){return db[_0x4ed6('0x1e')][_0x4ed6('0x3c')]()[_0x4ed6('0x15')](respondWithResult(_0x4aa934,null))['catch'](handleError(_0x4aa934,null));};exports[_0x4ed6('0x3d')]=function(_0x82005c,_0x3e11ab){var _0x320942={'raw':!![],'where':{}},_0x3471f4={},_0x12f7b6;return db[_0x4ed6('0x1e')][_0x4ed6('0x3e')]({'where':{'id':_0x82005c['params']['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x3e11ab,null))[_0x4ed6('0x15')](function(_0x151b8e){if(_0x151b8e){_0x12f7b6=_0x151b8e[_0x4ed6('0x17')]({'plain':!![]});_0x3471f4['model']=_['keys'](db[_0x4ed6('0x3f')][_0x4ed6('0x1f')]);_0x3471f4['query']=_['keys'](_0x82005c['query']);_0x3471f4[_0x4ed6('0x40')]=_[_0x4ed6('0x2c')](_0x3471f4[_0x4ed6('0x28')],_0x3471f4[_0x4ed6('0x2a')]);_0x320942[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x3471f4['model'],qs['fields'](_0x82005c[_0x4ed6('0x2a')]['fields']));_0x320942['attributes']=_0x320942[_0x4ed6('0x2b')][_0x4ed6('0x2e')]?_0x320942[_0x4ed6('0x2b')]:_0x3471f4[_0x4ed6('0x28')];if(!_0x82005c['query'][_0x4ed6('0x41')](_0x4ed6('0x42'))){_0x320942['limit']=qs[_0x4ed6('0xf')](_0x82005c[_0x4ed6('0x2a')][_0x4ed6('0xf')]);_0x320942[_0x4ed6('0xd')]=qs[_0x4ed6('0xd')](_0x82005c['query'][_0x4ed6('0xd')]);}_0x320942['order']=qs['sort'](_0x82005c['query'][_0x4ed6('0x43')]);_0x320942[_0x4ed6('0x23')]=qs[_0x4ed6('0x40')](_[_0x4ed6('0x44')](_0x82005c['query'],_0x3471f4[_0x4ed6('0x40')]));_0x320942[_0x4ed6('0x23')][_0x4ed6('0x45')]=_0x151b8e['id'];if(_0x82005c['query'][_0x4ed6('0x46')]){_0x320942[_0x4ed6('0x23')]=_[_0x4ed6('0x30')](_0x320942[_0x4ed6('0x23')],{'$or':_[_0x4ed6('0x1d')](_0x320942[_0x4ed6('0x2b')],function(_0x7b3dff){var _0x6f99e9={};_0x6f99e9[_0x7b3dff]={'$like':'%'+_0x82005c[_0x4ed6('0x2a')]['filter']+'%'};return _0x6f99e9;})});}_0x320942=_[_0x4ed6('0x30')]({},_0x320942,_0x82005c[_0x4ed6('0x31')]);return db['UserOpenchannelQueue'][_0x4ed6('0x25')](_0x320942);}})[_0x4ed6('0x15')](function(_0xbfab6e){if(_0xbfab6e){return db[_0x4ed6('0x47')][_0x4ed6('0x48')]({'where':{'id':_['map'](_0xbfab6e,'UserId'),'role':'agent'},'attributes':['id','name',_0x4ed6('0x49'),_0x4ed6('0x4a'),_0x4ed6('0x4b')]});}})[_0x4ed6('0x15')](function(_0x33f97e){if(_0x33f97e){return{'count':_0x33f97e[_0x4ed6('0x10')],'rows':_[_0x4ed6('0x1d')](_0x33f97e[_0x4ed6('0x26')],function(_0x382f74){return{'membername':_0x382f74[_0x4ed6('0x1b')],'UserId':_0x382f74['id'],'queue_name':_0x12f7b6[_0x4ed6('0x1b')],'OpenchannelQueueId':_0x12f7b6['id'],'interface':util[_0x4ed6('0x4c')](_0x4ed6('0x4d'),'SIP',_0x382f74[_0x4ed6('0x1b')]),'penalty':0x0,'paused':_0x382f74[_0x4ed6('0x49')],'createdAt':_0x382f74[_0x4ed6('0x4b')],'updatedAt':_0x382f74[_0x4ed6('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ed6('0x15')](respondWithFilteredResult(_0x3e11ab,_0x320942))[_0x4ed6('0x27')](handleError(_0x3e11ab,null));};exports[_0x4ed6('0x4e')]=function(_0x124bbd,_0x3f9858){var _0x187e42={};var _0x583e81={};var _0x3874b8;var _0x3a7122;return db[_0x4ed6('0x1e')]['findOne']({'where':{'id':_0x124bbd[_0x4ed6('0x4f')]['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x3f9858,null))[_0x4ed6('0x15')](function(_0x807ce6){if(_0x807ce6){_0x3874b8=_0x807ce6;_0x583e81[_0x4ed6('0x28')]=_[_0x4ed6('0x29')](db[_0x4ed6('0x50')][_0x4ed6('0x1f')]);_0x583e81[_0x4ed6('0x2a')]=_[_0x4ed6('0x29')](_0x124bbd[_0x4ed6('0x2a')]);_0x583e81[_0x4ed6('0x40')]=_[_0x4ed6('0x2c')](_0x583e81['model'],_0x583e81[_0x4ed6('0x2a')]);_0x187e42[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x583e81[_0x4ed6('0x28')],qs[_0x4ed6('0x2d')](_0x124bbd[_0x4ed6('0x2a')]['fields']));_0x187e42[_0x4ed6('0x2b')]=_0x187e42[_0x4ed6('0x2b')][_0x4ed6('0x2e')]?_0x187e42['attributes']:_0x583e81['model'];_0x187e42[_0x4ed6('0x51')]=qs[_0x4ed6('0x43')](_0x124bbd[_0x4ed6('0x2a')][_0x4ed6('0x43')]);_0x187e42[_0x4ed6('0x23')]=qs['filters'](_[_0x4ed6('0x44')](_0x124bbd[_0x4ed6('0x2a')],_0x583e81[_0x4ed6('0x40')]));if(_0x124bbd[_0x4ed6('0x2a')]['filter']){_0x187e42[_0x4ed6('0x23')]=_['merge'](_0x187e42[_0x4ed6('0x23')],{'$or':_['map'](_0x187e42['attributes'],function(_0x169411){var _0x5b4a0c={};_0x5b4a0c[_0x169411]={'$like':'%'+_0x124bbd[_0x4ed6('0x2a')][_0x4ed6('0x46')]+'%'};return _0x5b4a0c;})});}_0x187e42=_[_0x4ed6('0x30')]({},_0x187e42,_0x124bbd[_0x4ed6('0x31')]);return _0x3874b8[_0x4ed6('0x4e')](_0x187e42);}})['then'](function(_0x4a5686){if(_0x4a5686){_0x3a7122=_0x4a5686['length'];if(!_0x124bbd[_0x4ed6('0x2a')]['hasOwnProperty']('nolimit')){_0x187e42[_0x4ed6('0xf')]=qs[_0x4ed6('0xf')](_0x124bbd[_0x4ed6('0x2a')]['limit']);_0x187e42[_0x4ed6('0xd')]=qs[_0x4ed6('0xd')](_0x124bbd[_0x4ed6('0x2a')][_0x4ed6('0xd')]);}return _0x3874b8[_0x4ed6('0x4e')](_0x187e42);}})[_0x4ed6('0x15')](function(_0x5969e5){if(_0x5969e5){return _0x5969e5?{'count':_0x3a7122,'rows':_0x5969e5}:null;}})['then'](respondWithResult(_0x3f9858,null))[_0x4ed6('0x27')](handleError(_0x3f9858,null));};exports['addTeams']=function(_0x5d095d,_0x410d7c){var _0x34f2e2=_0x5d095d[_0x4ed6('0x33')]['ids'];return db[_0x4ed6('0x50')][_0x4ed6('0x25')]({'where':{'id':_0x34f2e2},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x4ed6('0x1b'),_0x4ed6('0x52'),_0x4ed6('0x53'),_0x4ed6('0x54')],'raw':!![]}]})[_0x4ed6('0x15')](function(_0x289b10){if(_0x289b10){var _0x38b099=_[_0x4ed6('0x55')](_0x289b10,function(_0x16c49a){var _0x54eb7d=_0x16c49a['get']({'plain':!![]});return _0x54eb7d[_0x4ed6('0x56')];});return db['OpenchannelQueue'][_0x4ed6('0x38')]({'where':{'id':_0x5d095d['params']['id']}})['then'](function(_0x3894e3){return db[_0x4ed6('0x57')][_0x4ed6('0x58')](function(_0x126ace){return _0x3894e3[_0x4ed6('0x59')](_0x34f2e2,{'transaction':_0x126ace})['then'](function(){return BPromise['each'](_0x38b099,function(_0x173491){return db[_0x4ed6('0x3f')][_0x4ed6('0x5a')]({'where':{'UserId':_0x173491['id'],'OpenchannelQueueId':_0x5d095d[_0x4ed6('0x4f')]['id']},'transaction':_0x126ace});});})[_0x4ed6('0x15')](function(){_0x38b099['forEach'](function(_0x12d454){socket[_0x4ed6('0x5b')](_0x4ed6('0x5c'),{'UserId':_0x12d454['id'],'OpenchannelQueueId':_0x3894e3['id']});});});});});}})[_0x4ed6('0x15')](respondWithStatusCode(_0x410d7c,null))[_0x4ed6('0x27')](handleError(_0x410d7c,null));};exports[_0x4ed6('0x5d')]=function(_0x546a85,_0x112378){return db[_0x4ed6('0x50')][_0x4ed6('0x25')]({'where':{'id':_0x546a85[_0x4ed6('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4ed6('0x47')],'as':_0x4ed6('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x112378,null))[_0x4ed6('0x15')](function(_0x372627){var _0x42e212=_[_0x4ed6('0x1d')](_0x372627,'id');var _0x5e8ee4=[];var _0x214223=[];var _0x74880a=squel[_0x4ed6('0x5e')]();_0x74880a[_0x4ed6('0x5f')](_0x4ed6('0x60'))[_0x4ed6('0x61')](_0x4ed6('0x62'),'tq')['join'](_0x4ed6('0x63'),'ut',_0x4ed6('0x64'))[_0x4ed6('0x23')](_0x4ed6('0x65'),_0x546a85[_0x4ed6('0x4f')]['id']);for(var _0x483055=0x0;_0x483055<_0x372627[_0x4ed6('0x2e')];_0x483055+=0x1){let _0x322aff=_0x372627[_0x483055];for(var _0x2e748a=0x0;_0x2e748a<_0x322aff['Agents']['length'];_0x2e748a+=0x1){let _0x1859c1=_0x322aff[_0x4ed6('0x56')][_0x2e748a];var _0x1dc38c=_0x74880a[_0x4ed6('0x66')]();_0x1dc38c['where'](_0x4ed6('0x67'),_0x1859c1['id']);_0x214223[_0x4ed6('0x68')](db[_0x4ed6('0x57')][_0x4ed6('0x2a')](_0x1dc38c[_0x4ed6('0x69')](),{'type':db[_0x4ed6('0x57')][_0x4ed6('0x6a')][_0x4ed6('0x6b')]})[_0x4ed6('0x15')](function(_0xf3073e){if(_0xf3073e[_0x4ed6('0x2e')]===0x1){return _0x1859c1['id'];}else{var _0xae6d5=_[_0x4ed6('0x6c')](_[_0x4ed6('0x1d')](_0xf3073e,'TeamId'),function(_0x16c21b){return _['includes'](_0x42e212,_0x16c21b);});if(_0xae6d5){return _0x1859c1['id'];}}}));}}return BPromise[_0x4ed6('0x6d')](_0x214223)[_0x4ed6('0x15')](function(_0x987ea5){_0x5e8ee4=_(_0x5e8ee4)[_0x4ed6('0x6e')](_0x987ea5)[_0x4ed6('0x6f')]()[_0x4ed6('0x70')]();return db['OpenchannelQueue'][_0x4ed6('0x38')]({'where':{'id':_0x546a85[_0x4ed6('0x4f')]['id']}})[_0x4ed6('0x15')](function(_0x1f13cf){return db[_0x4ed6('0x57')]['transaction'](function(_0x4cc86a){return _0x1f13cf[_0x4ed6('0x5d')](_0x546a85[_0x4ed6('0x2a')]['ids'],{'transaction':_0x4cc86a})[_0x4ed6('0x15')](function(){if(!_['isEmpty'](_0x5e8ee4)){return _0x1f13cf[_0x4ed6('0x71')](_0x5e8ee4,{'transaction':_0x4cc86a});}})['then'](function(){_0x5e8ee4[_0x4ed6('0x72')](function(_0x50152e){socket['emit'](_0x4ed6('0x73'),{'UserId':_0x50152e,'OpenchannelQueueId':_0x1f13cf['id']});});});});});});})[_0x4ed6('0x15')](respondWithStatusCode(_0x112378,null))['catch'](handleError(_0x112378,null));};exports[_0x4ed6('0x74')]=function(_0x1e7ab9,_0x4f2456){return db[_0x4ed6('0x1e')][_0x4ed6('0x38')]({'where':{'id':_0x1e7ab9[_0x4ed6('0x4f')]['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x4f2456,null))[_0x4ed6('0x15')](function(_0x2593c8){if(_0x2593c8){return _0x2593c8[_0x4ed6('0x74')](_0x1e7ab9[_0x4ed6('0x33')][_0x4ed6('0x75')],_[_0x4ed6('0x76')](_0x1e7ab9[_0x4ed6('0x33')],[_0x4ed6('0x75'),'id'])||{})['spread'](function(_0x477d5b){for(var _0x2e2de8=0x0;_0x2e2de8<_0x1e7ab9['body']['ids']['length'];_0x2e2de8+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x1e7ab9['body'][_0x4ed6('0x75')][_0x2e2de8]),'OpenchannelQueueId':Number(_0x1e7ab9[_0x4ed6('0x4f')]['id'])});}return _0x477d5b;});}})[_0x4ed6('0x15')](respondWithResult(_0x4f2456,null))[_0x4ed6('0x27')](handleError(_0x4f2456,null));};exports[_0x4ed6('0x71')]=function(_0x242835,_0x41b145){return db['OpenchannelQueue']['find']({'where':{'id':_0x242835[_0x4ed6('0x4f')]['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x41b145,null))[_0x4ed6('0x15')](function(_0x41634f){if(_0x41634f){return _0x41634f[_0x4ed6('0x71')](_0x242835[_0x4ed6('0x2a')][_0x4ed6('0x75')])[_0x4ed6('0x15')](function(){if(_['isArray'](_0x242835[_0x4ed6('0x2a')][_0x4ed6('0x75')])){for(var _0x1bd2f1=0x0;_0x1bd2f1<_0x242835[_0x4ed6('0x2a')][_0x4ed6('0x75')][_0x4ed6('0x2e')];_0x1bd2f1+=0x1){socket[_0x4ed6('0x5b')](_0x4ed6('0x73'),{'UserId':Number(_0x242835[_0x4ed6('0x2a')]['ids'][_0x1bd2f1]),'OpenchannelQueueId':Number(_0x242835['params']['id'])});}}else{socket[_0x4ed6('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x242835['query'][_0x4ed6('0x75')]),'OpenchannelQueueId':Number(_0x242835['params']['id'])});}});}})['then'](respondWithStatusCode(_0x41b145,null))[_0x4ed6('0x27')](handleError(_0x41b145,null));};exports[_0x4ed6('0x77')]=function(_0x41bbcd,_0x37d61d){var _0xe91117={};var _0x4c1564={};var _0x1509b9;var _0x2ebc15;return db[_0x4ed6('0x1e')][_0x4ed6('0x3e')]({'where':{'id':_0x41bbcd[_0x4ed6('0x4f')]['id']}})[_0x4ed6('0x15')](handleEntityNotFound(_0x37d61d,null))['then'](function(_0x513963){if(_0x513963){_0x1509b9=_0x513963;_0x4c1564[_0x4ed6('0x28')]=_[_0x4ed6('0x29')](db[_0x4ed6('0x47')][_0x4ed6('0x1f')]);_0x4c1564[_0x4ed6('0x2a')]=_[_0x4ed6('0x29')](_0x41bbcd[_0x4ed6('0x2a')]);_0x4c1564['filters']=_[_0x4ed6('0x2c')](_0x4c1564['model'],_0x4c1564[_0x4ed6('0x2a')]);_0xe91117[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x4c1564[_0x4ed6('0x28')],qs[_0x4ed6('0x2d')](_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0x2d')]));_0xe91117[_0x4ed6('0x2b')]=_0xe91117[_0x4ed6('0x2b')][_0x4ed6('0x2e')]?_0xe91117[_0x4ed6('0x2b')]:_0x4c1564['model'];_0xe91117[_0x4ed6('0x51')]=qs[_0x4ed6('0x43')](_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0x43')]);_0xe91117[_0x4ed6('0x23')]=qs[_0x4ed6('0x40')](_[_0x4ed6('0x44')](_0x41bbcd['query'],_0x4c1564[_0x4ed6('0x40')]));if(_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0x46')]){_0xe91117[_0x4ed6('0x23')]=_[_0x4ed6('0x30')](_0xe91117[_0x4ed6('0x23')],{'$or':_[_0x4ed6('0x1d')](_0xe91117[_0x4ed6('0x2b')],function(_0x79ee4e){var _0x354693={};_0x354693[_0x79ee4e]={'$like':'%'+_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0x46')]+'%'};return _0x354693;})});}_0xe91117=_[_0x4ed6('0x30')]({},_0xe91117,_0x41bbcd[_0x4ed6('0x31')]);return _0x1509b9[_0x4ed6('0x77')](_0xe91117);}})[_0x4ed6('0x15')](function(_0x413cb9){if(_0x413cb9){_0x2ebc15=_0x413cb9[_0x4ed6('0x2e')];if(!_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0x41')]('nolimit')){_0xe91117[_0x4ed6('0xf')]=qs[_0x4ed6('0xf')](_0x41bbcd['query'][_0x4ed6('0xf')]);_0xe91117[_0x4ed6('0xd')]=qs[_0x4ed6('0xd')](_0x41bbcd[_0x4ed6('0x2a')][_0x4ed6('0xd')]);}return _0x1509b9[_0x4ed6('0x77')](_0xe91117);}})[_0x4ed6('0x15')](function(_0x465982){if(_0x465982){return _0x465982?{'count':_0x2ebc15,'rows':_0x465982}:null;}})[_0x4ed6('0x15')](respondWithResult(_0x37d61d,null))['catch'](handleError(_0x37d61d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 63acfe5..a28808d 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 _0x33b9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4c58ef,_0x4984a4){var _0x3db58d=function(_0x2c0ab0){while(--_0x2c0ab0){_0x4c58ef['push'](_0x4c58ef['shift']());}};_0x3db58d(++_0x4984a4);}(_0x33b9,0x1ed));var _0x933b=function(_0x16b3b6,_0x21990e){_0x16b3b6=_0x16b3b6-0x0;var _0x1b00cf=_0x33b9[_0x16b3b6];return _0x1b00cf;};'use strict';var EventEmitter=require(_0x933b('0x0'));var OpenchannelQueue=require(_0x933b('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x933b('0x2')](0x0);var events={'afterCreate':_0x933b('0x3'),'afterUpdate':'update','afterDestroy':_0x933b('0x4')};function emitEvent(_0x35aaa6){return function(_0x43077d,_0x2b6c22,_0x36edb7){OpenchannelQueueEvents[_0x933b('0x5')](_0x35aaa6+':'+_0x43077d['id'],_0x43077d);OpenchannelQueueEvents['emit'](_0x35aaa6,_0x43077d);_0x36edb7(null);};}for(var e in events){if(events[_0x933b('0x6')](e)){var event=events[e];OpenchannelQueue[_0x933b('0x7')](e,emitEvent(event));}}module[_0x933b('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1087=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x5caabb,_0x2b0cc1){var _0x2929d8=function(_0x389698){while(--_0x389698){_0x5caabb['push'](_0x5caabb['shift']());}};_0x2929d8(++_0x2b0cc1);}(_0x1087,0x72));var _0x7108=function(_0x1c0329,_0x3c0756){_0x1c0329=_0x1c0329-0x0;var _0x7f71e3=_0x1087[_0x1c0329];return _0x7f71e3;};'use strict';var EventEmitter=require(_0x7108('0x0'));var OpenchannelQueue=require(_0x7108('0x1'))['db'][_0x7108('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7108('0x3'),'afterUpdate':_0x7108('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3560af){return function(_0x4fa9c4,_0x261333,_0x230524){OpenchannelQueueEvents[_0x7108('0x5')](_0x3560af+':'+_0x4fa9c4['id'],_0x4fa9c4);OpenchannelQueueEvents[_0x7108('0x5')](_0x3560af,_0x4fa9c4);_0x230524(null);};}for(var e in events){if(events[_0x7108('0x6')](e)){var event=events[e];OpenchannelQueue[_0x7108('0x7')](e,emitEvent(event));}}module[_0x7108('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8318e71..2b38454 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 _0x995d=['api','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x995d,0xe1));var _0xd995=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x995d[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xd995('0x0'));var util=require(_0xd995('0x1'));var logger=require(_0xd995('0x2'))(_0xd995('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd995('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd995('0x5'));var config=require(_0xd995('0x6'));var attributes=require(_0xd995('0x7'));module[_0xd995('0x8')]=function(_0x9f125a,_0x4cf4fb){return _0x9f125a[_0xd995('0x9')](_0xd995('0xa'),attributes,{'tableName':_0xd995('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf4a=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f72c0,_0x58fc88){var _0x159820=function(_0x8c6df2){while(--_0x8c6df2){_0x1f72c0['push'](_0x1f72c0['shift']());}};_0x159820(++_0x58fc88);}(_0xcf4a,0x116));var _0xacf4=function(_0x3f897f,_0x502f33){_0x3f897f=_0x3f897f-0x0;var _0x47c8ad=_0xcf4a[_0x3f897f];return _0x47c8ad;};'use strict';var _=require(_0xacf4('0x0'));var util=require(_0xacf4('0x1'));var logger=require(_0xacf4('0x2'))(_0xacf4('0x3'));var moment=require(_0xacf4('0x4'));var BPromise=require(_0xacf4('0x5'));var rp=require(_0xacf4('0x6'));var fs=require('fs');var path=require(_0xacf4('0x7'));var rimraf=require(_0xacf4('0x8'));var config=require(_0xacf4('0x9'));var attributes=require(_0xacf4('0xa'));module[_0xacf4('0xb')]=function(_0x14a673,_0x2d5ca3){return _0x14a673[_0xacf4('0xc')](_0xacf4('0xd'),attributes,{'tableName':_0xacf4('0xe'),'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 9cac837..d9b73ec 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 _0x0f31=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register'];(function(_0x26c88d,_0x1d6df4){var _0x2835a2=function(_0x95b284){while(--_0x95b284){_0x26c88d['push'](_0x26c88d['shift']());}};_0x2835a2(++_0x1d6df4);}(_0x0f31,0x10f));var _0x10f3=function(_0x101373,_0x2ff37a){_0x101373=_0x101373-0x0;var _0x3b4550=_0x0f31[_0x101373];return _0x3b4550;};'use strict';var _=require(_0x10f3('0x0'));var util=require(_0x10f3('0x1'));var moment=require('moment');var BPromise=require(_0x10f3('0x2'));var rs=require(_0x10f3('0x3'));var fs=require('fs');var Redis=require(_0x10f3('0x4'));var db=require(_0x10f3('0x5'))['db'];var utils=require(_0x10f3('0x6'));var logger=require(_0x10f3('0x7'))(_0x10f3('0x8'));var config=require(_0x10f3('0x9'));var jayson=require(_0x10f3('0xa'));var client=jayson['client'][_0x10f3('0xb')]({'port':0x232a});config[_0x10f3('0xc')]=_[_0x10f3('0xd')](config[_0x10f3('0xc')],{'host':_0x10f3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10f3('0xc')]));require('./openchannelQueue.socket')[_0x10f3('0xf')](socket);function respondWithRpcPromise(_0x4315fd,_0x260609,_0x31652a){return new BPromise(function(_0x3b412e,_0x3e393e){return client[_0x10f3('0x10')](_0x4315fd,_0x31652a)[_0x10f3('0x11')](function(_0x5e5cdf){logger[_0x10f3('0x12')](_0x10f3('0x13'),_0x260609,_0x10f3('0x14'));logger[_0x10f3('0x15')](_0x10f3('0x16'),_0x260609,_0x10f3('0x14'),JSON[_0x10f3('0x17')](_0x5e5cdf));if(_0x5e5cdf[_0x10f3('0x18')]){if(_0x5e5cdf[_0x10f3('0x18')][_0x10f3('0x19')]===0x1f4){logger[_0x10f3('0x18')](_0x10f3('0x13'),_0x260609,_0x5e5cdf[_0x10f3('0x18')][_0x10f3('0x1a')]);return _0x3e393e(_0x5e5cdf[_0x10f3('0x18')][_0x10f3('0x1a')]);}logger[_0x10f3('0x18')](_0x10f3('0x13'),_0x260609,_0x5e5cdf['error'][_0x10f3('0x1a')]);return _0x3b412e(_0x5e5cdf['error']['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x260609,'request\x20sent');_0x3b412e(_0x5e5cdf[_0x10f3('0x1b')][_0x10f3('0x1a')]);}})[_0x10f3('0x1c')](function(_0x4fe08d){logger[_0x10f3('0x18')](_0x10f3('0x13'),_0x260609,_0x4fe08d);_0x3e393e(_0x4fe08d);});});}exports[_0x10f3('0x1d')]=function(_0x47efbf){var _0x223d94=this;return new Promise(function(_0x277398,_0x3a11c1){return db['OpenchannelQueue'][_0x10f3('0x1e')]({'raw':_0x47efbf['options']?_0x47efbf[_0x10f3('0x1f')][_0x10f3('0x20')]===undefined?!![]:![]:!![],'where':_0x47efbf[_0x10f3('0x1f')]?_0x47efbf['options'][_0x10f3('0x21')]||null:null,'attributes':_0x47efbf[_0x10f3('0x1f')]?_0x47efbf[_0x10f3('0x1f')][_0x10f3('0x22')]||null:null,'limit':_0x47efbf[_0x10f3('0x1f')]?_0x47efbf['options']['limit']||null:null,'include':_0x47efbf['options']?_0x47efbf[_0x10f3('0x1f')][_0x10f3('0x23')]?_[_0x10f3('0x24')](_0x47efbf[_0x10f3('0x1f')][_0x10f3('0x23')],function(_0x3386d7){return{'model':db[_0x3386d7[_0x10f3('0x25')]],'as':_0x3386d7['as'],'attributes':_0x3386d7['attributes'],'include':_0x3386d7[_0x10f3('0x23')]?_[_0x10f3('0x24')](_0x3386d7[_0x10f3('0x23')],function(_0x2d3b46){return{'model':db[_0x2d3b46[_0x10f3('0x25')]],'as':_0x2d3b46['as'],'attributes':_0x2d3b46[_0x10f3('0x22')],'include':_0x2d3b46['include']?_[_0x10f3('0x24')](_0x2d3b46[_0x10f3('0x23')],function(_0x31e187){return{'model':db[_0x31e187['model']],'as':_0x31e187['as'],'attributes':_0x31e187[_0x10f3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x10f3('0x11')](function(_0x59d065){logger['info'](_0x10f3('0x1d'),_0x47efbf);logger[_0x10f3('0x15')](_0x10f3('0x1d'),_0x47efbf,JSON[_0x10f3('0x17')](_0x59d065));_0x277398(_0x59d065);})[_0x10f3('0x1c')](function(_0x3d3b2b){logger[_0x10f3('0x18')]('GetOpenchannelQueue',_0x3d3b2b[_0x10f3('0x1a')],_0x47efbf);_0x3a11c1(_0x223d94[_0x10f3('0x18')](0x1f4,_0x3d3b2b[_0x10f3('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x69d1b1){var _0x2fd599=this;return new Promise(function(_0x4cb6a0,_0x25d6bf){return db[_0x10f3('0x26')][_0x10f3('0x27')]({'raw':_0x69d1b1[_0x10f3('0x1f')]?_0x69d1b1['options'][_0x10f3('0x20')]===undefined?!![]:![]:!![],'where':_0x69d1b1[_0x10f3('0x1f')]?_0x69d1b1[_0x10f3('0x1f')][_0x10f3('0x21')]||null:null,'attributes':_0x69d1b1[_0x10f3('0x1f')]?_0x69d1b1[_0x10f3('0x1f')][_0x10f3('0x22')]||null:null,'include':_0x69d1b1['options']?_0x69d1b1[_0x10f3('0x1f')][_0x10f3('0x23')]?_[_0x10f3('0x24')](_0x69d1b1[_0x10f3('0x1f')]['include'],function(_0x569a13){return{'model':db[_0x569a13[_0x10f3('0x25')]],'as':_0x569a13['as'],'attributes':_0x569a13[_0x10f3('0x22')],'include':_0x569a13['include']?_[_0x10f3('0x24')](_0x569a13[_0x10f3('0x23')],function(_0xf2ddca){return{'model':db[_0xf2ddca[_0x10f3('0x25')]],'as':_0xf2ddca['as'],'attributes':_0xf2ddca['attributes'],'include':_0xf2ddca[_0x10f3('0x23')]?_['map'](_0xf2ddca[_0x10f3('0x23')],function(_0x3f6366){return{'model':db[_0x3f6366[_0x10f3('0x25')]],'as':_0x3f6366['as'],'attributes':_0x3f6366[_0x10f3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x10f3('0x11')](function(_0x2c8559){logger[_0x10f3('0x12')](_0x10f3('0x28'),_0x69d1b1);logger[_0x10f3('0x15')](_0x10f3('0x28'),_0x69d1b1,JSON['stringify'](_0x2c8559));_0x4cb6a0(_0x2c8559);})[_0x10f3('0x1c')](function(_0x2384a4){logger[_0x10f3('0x18')](_0x10f3('0x28'),_0x2384a4[_0x10f3('0x1a')],_0x69d1b1);_0x25d6bf(_0x2fd599[_0x10f3('0x18')](0x1f4,_0x2384a4[_0x10f3('0x1a')]));});});}; \ No newline at end of file +var _0xdc22=['localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','model','map','GetOpenchannelQueue','find','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x2728da,_0x3929b3){var _0x5dc22d=function(_0x7e8934){while(--_0x7e8934){_0x2728da['push'](_0x2728da['shift']());}};_0x5dc22d(++_0x3929b3);}(_0xdc22,0x9b));var _0x2dc2=function(_0x11c0cb,_0x4476aa){_0x11c0cb=_0x11c0cb-0x0;var _0x3dbf20=_0xdc22[_0x11c0cb];return _0x3dbf20;};'use strict';var _=require('lodash');var util=require(_0x2dc2('0x0'));var moment=require(_0x2dc2('0x1'));var BPromise=require(_0x2dc2('0x2'));var rs=require(_0x2dc2('0x3'));var fs=require('fs');var Redis=require(_0x2dc2('0x4'));var db=require(_0x2dc2('0x5'))['db'];var utils=require(_0x2dc2('0x6'));var logger=require('../../config/logger')(_0x2dc2('0x7'));var config=require(_0x2dc2('0x8'));var jayson=require(_0x2dc2('0x9'));var client=jayson[_0x2dc2('0xa')]['http']({'port':0x232a});config[_0x2dc2('0xb')]=_[_0x2dc2('0xc')](config['redis'],{'host':_0x2dc2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2dc2('0xb')]));require(_0x2dc2('0xe'))[_0x2dc2('0xf')](socket);function respondWithRpcPromise(_0x405561,_0x4c57db,_0x439118){return new BPromise(function(_0x4fa3ed,_0x4f626d){return client[_0x2dc2('0x10')](_0x405561,_0x439118)[_0x2dc2('0x11')](function(_0x45d638){logger[_0x2dc2('0x12')](_0x2dc2('0x13'),_0x4c57db,_0x2dc2('0x14'));logger[_0x2dc2('0x15')](_0x2dc2('0x16'),_0x4c57db,'request\x20sent',JSON[_0x2dc2('0x17')](_0x45d638));if(_0x45d638['error']){if(_0x45d638['error'][_0x2dc2('0x18')]===0x1f4){logger[_0x2dc2('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c57db,_0x45d638[_0x2dc2('0x19')][_0x2dc2('0x1a')]);return _0x4f626d(_0x45d638[_0x2dc2('0x19')]['message']);}logger[_0x2dc2('0x19')](_0x2dc2('0x13'),_0x4c57db,_0x45d638[_0x2dc2('0x19')][_0x2dc2('0x1a')]);return _0x4fa3ed(_0x45d638['error'][_0x2dc2('0x1a')]);}else{logger[_0x2dc2('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c57db,_0x2dc2('0x14'));_0x4fa3ed(_0x45d638[_0x2dc2('0x1b')][_0x2dc2('0x1a')]);}})[_0x2dc2('0x1c')](function(_0x335b1c){logger[_0x2dc2('0x19')](_0x2dc2('0x13'),_0x4c57db,_0x335b1c);_0x4f626d(_0x335b1c);});});}exports['GetOpenchannelQueue']=function(_0x12b616){var _0x27ba72=this;return new Promise(function(_0x5439ac,_0x404915){return db[_0x2dc2('0x1d')][_0x2dc2('0x1e')]({'raw':_0x12b616[_0x2dc2('0x1f')]?_0x12b616[_0x2dc2('0x1f')][_0x2dc2('0x20')]===undefined?!![]:![]:!![],'where':_0x12b616[_0x2dc2('0x1f')]?_0x12b616[_0x2dc2('0x1f')]['where']||null:null,'attributes':_0x12b616[_0x2dc2('0x1f')]?_0x12b616[_0x2dc2('0x1f')][_0x2dc2('0x21')]||null:null,'limit':_0x12b616['options']?_0x12b616[_0x2dc2('0x1f')][_0x2dc2('0x22')]||null:null,'include':_0x12b616[_0x2dc2('0x1f')]?_0x12b616[_0x2dc2('0x1f')][_0x2dc2('0x23')]?_['map'](_0x12b616[_0x2dc2('0x1f')][_0x2dc2('0x23')],function(_0x33060e){return{'model':db[_0x33060e[_0x2dc2('0x24')]],'as':_0x33060e['as'],'attributes':_0x33060e['attributes'],'include':_0x33060e['include']?_['map'](_0x33060e['include'],function(_0x213543){return{'model':db[_0x213543['model']],'as':_0x213543['as'],'attributes':_0x213543[_0x2dc2('0x21')],'include':_0x213543[_0x2dc2('0x23')]?_[_0x2dc2('0x25')](_0x213543[_0x2dc2('0x23')],function(_0x28b550){return{'model':db[_0x28b550['model']],'as':_0x28b550['as'],'attributes':_0x28b550[_0x2dc2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453cb9){logger[_0x2dc2('0x12')](_0x2dc2('0x26'),_0x12b616);logger[_0x2dc2('0x15')](_0x2dc2('0x26'),_0x12b616,JSON[_0x2dc2('0x17')](_0x453cb9));_0x5439ac(_0x453cb9);})[_0x2dc2('0x1c')](function(_0x5cba05){logger[_0x2dc2('0x19')]('GetOpenchannelQueue',_0x5cba05['message'],_0x12b616);_0x404915(_0x27ba72[_0x2dc2('0x19')](0x1f4,_0x5cba05['message']));});});};exports['ShowOpenchannelQueue']=function(_0x406bc6){var _0x346820=this;return new Promise(function(_0x19b117,_0x5ec9f7){return db['OpenchannelQueue'][_0x2dc2('0x27')]({'raw':_0x406bc6[_0x2dc2('0x1f')]?_0x406bc6[_0x2dc2('0x1f')][_0x2dc2('0x20')]===undefined?!![]:![]:!![],'where':_0x406bc6[_0x2dc2('0x1f')]?_0x406bc6['options'][_0x2dc2('0x28')]||null:null,'attributes':_0x406bc6[_0x2dc2('0x1f')]?_0x406bc6[_0x2dc2('0x1f')][_0x2dc2('0x21')]||null:null,'include':_0x406bc6[_0x2dc2('0x1f')]?_0x406bc6['options'][_0x2dc2('0x23')]?_['map'](_0x406bc6[_0x2dc2('0x1f')][_0x2dc2('0x23')],function(_0x364f6b){return{'model':db[_0x364f6b[_0x2dc2('0x24')]],'as':_0x364f6b['as'],'attributes':_0x364f6b[_0x2dc2('0x21')],'include':_0x364f6b[_0x2dc2('0x23')]?_[_0x2dc2('0x25')](_0x364f6b[_0x2dc2('0x23')],function(_0xc9fd06){return{'model':db[_0xc9fd06[_0x2dc2('0x24')]],'as':_0xc9fd06['as'],'attributes':_0xc9fd06[_0x2dc2('0x21')],'include':_0xc9fd06[_0x2dc2('0x23')]?_[_0x2dc2('0x25')](_0xc9fd06[_0x2dc2('0x23')],function(_0x5cb47f){return{'model':db[_0x5cb47f[_0x2dc2('0x24')]],'as':_0x5cb47f['as'],'attributes':_0x5cb47f[_0x2dc2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2dc2('0x11')](function(_0xa640f5){logger['info'](_0x2dc2('0x29'),_0x406bc6);logger[_0x2dc2('0x15')](_0x2dc2('0x29'),_0x406bc6,JSON[_0x2dc2('0x17')](_0xa640f5));_0x19b117(_0xa640f5);})['catch'](function(_0x175cb4){logger[_0x2dc2('0x19')](_0x2dc2('0x29'),_0x175cb4[_0x2dc2('0x1a')],_0x406bc6);_0x5ec9f7(_0x346820[_0x2dc2('0x19')](0x1f4,_0x175cb4[_0x2dc2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b7c3aa1..56b8bad 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 _0xb279=['emit','./openchannelQueue.events','save','remove'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xb279,0xb5));var _0x9b27=function(_0x449a7e,_0xd69ef4){_0x449a7e=_0x449a7e-0x0;var _0x4d3ee5=_0xb279[_0x449a7e];return _0x4d3ee5;};'use strict';var OpenchannelQueueEvents=require(_0x9b27('0x0'));var events=[_0x9b27('0x1'),_0x9b27('0x2'),'update'];function createListener(_0x5e4260,_0x2c1c3a){return function(_0x4687f4){_0x2c1c3a[_0x9b27('0x3')](_0x5e4260,_0x4687f4);};}function removeListener(_0x19bc9e,_0x180f0e){return function(){OpenchannelQueueEvents['removeListener'](_0x19bc9e,_0x180f0e);};}exports['register']=function(_0x36d59f){for(var _0x531d2b=0x0,_0x3c8df9=events['length'];_0x531d2b<_0x3c8df9;_0x531d2b++){var _0x35123a=events[_0x531d2b];var _0x1b258b=createListener('openchannelQueue:'+_0x35123a,_0x36d59f);OpenchannelQueueEvents['on'](_0x35123a,_0x1b258b);}}; \ No newline at end of file +var _0x702c=['update','emit','./openchannelQueue.events','save','remove'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x702c,0x188));var _0xc702=function(_0x19b1fc,_0x2bf52f){_0x19b1fc=_0x19b1fc-0x0;var _0x34cbd6=_0x702c[_0x19b1fc];return _0x34cbd6;};'use strict';var OpenchannelQueueEvents=require(_0xc702('0x0'));var events=[_0xc702('0x1'),_0xc702('0x2'),_0xc702('0x3')];function createListener(_0x484c4f,_0x4cf12c){return function(_0x57a30d){_0x4cf12c[_0xc702('0x4')](_0x484c4f,_0x57a30d);};}function removeListener(_0x133bfb,_0x1f2485){return function(){OpenchannelQueueEvents['removeListener'](_0x133bfb,_0x1f2485);};}exports['register']=function(_0x20ab26){for(var _0x4acd9b=0x0,_0x35dfd0=events['length'];_0x4acd9b<_0x35dfd0;_0x4acd9b++){var _0x298820=events[_0x4acd9b];var _0x1bd7c6=createListener('openchannelQueue:'+_0x298820,_0x20ab26);OpenchannelQueueEvents['on'](_0x298820,_0x1bd7c6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d953aad..b73886a 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 _0x39e1=['../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2217ec,_0x1bd3ce){var _0x2a3863=function(_0x4fdb81){while(--_0x4fdb81){_0x2217ec['push'](_0x2217ec['shift']());}};_0x2a3863(++_0x1bd3ce);}(_0x39e1,0xb7));var _0x139e=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x39e1[_0x1bf8cc];return _0x322d20;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x139e('0x0'));var timeout=require(_0x139e('0x1'));var express=require('express');var router=express[_0x139e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x139e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x139e('0x4'));var controller=require(_0x139e('0x5'));router[_0x139e('0x6')]('/',auth['isAuthenticated'](),controller[_0x139e('0x7')]);router[_0x139e('0x6')](_0x139e('0x8'),auth[_0x139e('0x9')](),controller[_0x139e('0xa')]);router[_0x139e('0x6')](_0x139e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x139e('0xc')]('/',auth[_0x139e('0x9')](),controller[_0x139e('0xd')]);router['put'](_0x139e('0xb'),auth[_0x139e('0x9')](),controller['update']);router[_0x139e('0xe')](_0x139e('0xb'),auth[_0x139e('0x9')](),controller[_0x139e('0xf')]);module[_0x139e('0x10')]=router; \ No newline at end of file +var _0x77cb=['describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x3f9631,_0x51ffcb){var _0x242d84=function(_0xfcd4f7){while(--_0xfcd4f7){_0x3f9631['push'](_0x3f9631['shift']());}};_0x242d84(++_0x51ffcb);}(_0x77cb,0xe6));var _0xb77c=function(_0x1a58ba,_0x3a8026){_0x1a58ba=_0x1a58ba-0x0;var _0x36ed9d=_0x77cb[_0x1a58ba];return _0x36ed9d;};'use strict';var multer=require(_0xb77c('0x0'));var util=require(_0xb77c('0x1'));var path=require(_0xb77c('0x2'));var timeout=require(_0xb77c('0x3'));var express=require('express');var router=express[_0xb77c('0x4')]();var fs_extra=require(_0xb77c('0x5'));var auth=require(_0xb77c('0x6'));var interaction=require(_0xb77c('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xb77c('0x8')](),controller[_0xb77c('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb77c('0xa')]);router[_0xb77c('0xb')](_0xb77c('0xc'),auth[_0xb77c('0x8')](),controller[_0xb77c('0xd')]);router[_0xb77c('0xe')]('/',auth[_0xb77c('0x8')](),controller[_0xb77c('0xf')]);router[_0xb77c('0x10')](_0xb77c('0xc'),auth['isAuthenticated'](),controller[_0xb77c('0x11')]);router[_0xb77c('0x12')](_0xb77c('0xc'),auth['isAuthenticated'](),controller[_0xb77c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c4eb418..c38288d 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 _0xa61a=['moment','sequelize','exports','STRING','DATE'];(function(_0x162674,_0xe81d6c){var _0x3c802e=function(_0x3faf76){while(--_0x3faf76){_0x162674['push'](_0x162674['shift']());}};_0x3c802e(++_0xe81d6c);}(_0xa61a,0xc8));var _0xaa61=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xa61a[_0x592e40];return _0x5d4288;};'use strict';var moment=require(_0xaa61('0x0'));var Sequelize=require(_0xaa61('0x1'));module[_0xaa61('0x2')]={'uniqueid':{'type':Sequelize[_0xaa61('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xaa61('0x4')]},'leaveAt':{'type':Sequelize[_0xaa61('0x4')]},'acceptAt':{'type':Sequelize[_0xaa61('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xaa61('0x3')]}}; \ No newline at end of file +var _0x84c7=['DATE','moment','sequelize','exports','STRING'];(function(_0x52e216,_0x3346c6){var _0x75b019=function(_0x290a70){while(--_0x290a70){_0x52e216['push'](_0x52e216['shift']());}};_0x75b019(++_0x3346c6);}(_0x84c7,0x6f));var _0x784c=function(_0x3816ed,_0x403c47){_0x3816ed=_0x3816ed-0x0;var _0x3c92bc=_0x84c7[_0x3816ed];return _0x3c92bc;};'use strict';var moment=require(_0x784c('0x0'));var Sequelize=require(_0x784c('0x1'));module[_0x784c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x784c('0x3')]},'joinAt':{'type':Sequelize[_0x784c('0x4')]},'leaveAt':{'type':Sequelize[_0x784c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x784c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 254284f..55050ba 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 _0x492c=['describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update'];(function(_0x5c8d4f,_0x371f74){var _0x54e3d6=function(_0x503b97){while(--_0x503b97){_0x5c8d4f['push'](_0x5c8d4f['shift']());}};_0x54e3d6(++_0x371f74);}(_0x492c,0x1c3));var _0xc492=function(_0x31548c,_0x42dc58){_0x31548c=_0x31548c-0x0;var _0x4c79b9=_0x492c[_0x31548c];return _0x4c79b9;};'use strict';var emlformat=require(_0xc492('0x0'));var rimraf=require(_0xc492('0x1'));var zipdir=require(_0xc492('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc492('0x3'));var moment=require(_0xc492('0x4'));var BPromise=require(_0xc492('0x5'));var Mustache=require('mustache');var util=require(_0xc492('0x6'));var path=require(_0xc492('0x7'));var sox=require(_0xc492('0x8'));var csv=require(_0xc492('0x9'));var ejs=require(_0xc492('0xa'));var fs=require('fs');var fs_extra=require(_0xc492('0xb'));var _=require('lodash');var squel=require(_0xc492('0xc'));var crypto=require('crypto');var jsforce=require(_0xc492('0xd'));var deskjs=require(_0xc492('0xe'));var toCsv=require(_0xc492('0x9'));var querystring=require(_0xc492('0xf'));var Papa=require(_0xc492('0x10'));var Redis=require(_0xc492('0x11'));var authService=require(_0xc492('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc492('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc492('0x14'));var utils=require(_0xc492('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc492('0x16'));var db=require(_0xc492('0x17'))['db'];function respondWithStatusCode(_0x58f490,_0x70fa13){_0x70fa13=_0x70fa13||0xcc;return function(_0x2c8da8){if(_0x2c8da8){return _0x58f490[_0xc492('0x18')](_0x70fa13);}return _0x58f490['status'](_0x70fa13)[_0xc492('0x19')]();};}function respondWithResult(_0x3f5969,_0x5d8ff9){_0x5d8ff9=_0x5d8ff9||0xc8;return function(_0x17eecf){if(_0x17eecf){return _0x3f5969[_0xc492('0x1a')](_0x5d8ff9)['json'](_0x17eecf);}};}function respondWithFilteredResult(_0x29c386,_0x9fc656){return function(_0x7cb59a){if(_0x7cb59a){var _0x12d081=typeof _0x9fc656['offset']===_0xc492('0x1b')&&typeof _0x9fc656[_0xc492('0x1c')]==='undefined';var _0x51fc70=_0x7cb59a['count'];var _0x236347=_0x12d081?0x0:_0x9fc656[_0xc492('0x1d')];var _0x416e3e=_0x12d081?_0x7cb59a[_0xc492('0x1e')]:_0x9fc656[_0xc492('0x1d')]+_0x9fc656[_0xc492('0x1c')];var _0x162101;if(_0x416e3e>=_0x51fc70){_0x416e3e=_0x51fc70;_0x162101=0xc8;}else{_0x162101=0xce;}_0x29c386[_0xc492('0x1a')](_0x162101);return _0x29c386[_0xc492('0x1f')](_0xc492('0x20'),_0x236347+'-'+_0x416e3e+'/'+_0x51fc70)[_0xc492('0x21')](_0x7cb59a);}return null;};}function patchUpdates(_0x3768f8){return function(_0x3e62ce){try{jsonpatch[_0xc492('0x22')](_0x3e62ce,_0x3768f8,!![]);}catch(_0x4b29e6){return BPromise['reject'](_0x4b29e6);}return _0x3e62ce['save']();};}function saveUpdates(_0x195ea7,_0x5ac6eb){return function(_0x154ac7){if(_0x154ac7){return _0x154ac7['update'](_0x195ea7)[_0xc492('0x23')](function(_0x2936b8){return _0x2936b8;});}return null;};}function removeEntity(_0x3bec4b,_0x590107){return function(_0x328fe6){if(_0x328fe6){return _0x328fe6[_0xc492('0x24')]()['then'](function(){_0x3bec4b[_0xc492('0x1a')](0xcc)[_0xc492('0x19')]();});}};}function handleEntityNotFound(_0x3684ef,_0x598abd){return function(_0x37db96){if(!_0x37db96){_0x3684ef[_0xc492('0x18')](0x194);}return _0x37db96;};}function handleError(_0xccbc3f,_0x109452){_0x109452=_0x109452||0x1f4;return function(_0xc1a69f){logger[_0xc492('0x25')](_0xc1a69f[_0xc492('0x26')]);if(_0xc1a69f[_0xc492('0x27')]){delete _0xc1a69f[_0xc492('0x27')];}_0xccbc3f[_0xc492('0x1a')](_0x109452)[_0xc492('0x28')](_0xc1a69f);};}exports[_0xc492('0x29')]=function(_0x5b210d,_0x177506){var _0x5b5cf8={},_0x439a2a={},_0x3e0f19={'count':0x0,'rows':[]};var _0x43a892=_[_0xc492('0x2a')](db[_0xc492('0x2b')][_0xc492('0x2c')],function(_0x14e982){return{'name':_0x14e982[_0xc492('0x2d')],'type':_0x14e982[_0xc492('0x2e')][_0xc492('0x2f')]};});_0x439a2a[_0xc492('0x30')]=_['map'](_0x43a892,_0xc492('0x27'));_0x439a2a[_0xc492('0x31')]=_['keys'](_0x5b210d['query']);_0x439a2a[_0xc492('0x32')]=_[_0xc492('0x33')](_0x439a2a[_0xc492('0x30')],_0x439a2a[_0xc492('0x31')]);_0x5b5cf8[_0xc492('0x34')]=_['intersection'](_0x439a2a[_0xc492('0x30')],qs['fields'](_0x5b210d[_0xc492('0x31')][_0xc492('0x35')]));_0x5b5cf8[_0xc492('0x34')]=_0x5b5cf8[_0xc492('0x34')][_0xc492('0x36')]?_0x5b5cf8[_0xc492('0x34')]:_0x439a2a['model'];if(!_0x5b210d['query']['hasOwnProperty'](_0xc492('0x37'))){_0x5b5cf8[_0xc492('0x1c')]=qs[_0xc492('0x1c')](_0x5b210d['query'][_0xc492('0x1c')]);_0x5b5cf8[_0xc492('0x1d')]=qs[_0xc492('0x1d')](_0x5b210d[_0xc492('0x31')][_0xc492('0x1d')]);}_0x5b5cf8[_0xc492('0x38')]=qs[_0xc492('0x39')](_0x5b210d[_0xc492('0x31')][_0xc492('0x39')]);_0x5b5cf8[_0xc492('0x3a')]=qs[_0xc492('0x32')](_['pick'](_0x5b210d['query'],_0x439a2a[_0xc492('0x32')]),_0x43a892);if(_0x5b210d[_0xc492('0x31')]['filter']){_0x5b5cf8[_0xc492('0x3a')]=_['merge'](_0x5b5cf8[_0xc492('0x3a')],{'$or':_[_0xc492('0x2a')](_0x43a892,function(_0x139464){if(_0x139464[_0xc492('0x2e')]!=='VIRTUAL'){var _0xf7750c={};_0xf7750c[_0x139464[_0xc492('0x27')]]={'$like':'%'+_0x5b210d['query'][_0xc492('0x3b')]+'%'};return _0xf7750c;}})});}_0x5b5cf8=_[_0xc492('0x3c')]({},_0x5b5cf8,_0x5b210d[_0xc492('0x3d')]);var _0x45a0f6={'where':_0x5b5cf8[_0xc492('0x3a')]};return db[_0xc492('0x2b')][_0xc492('0x1e')](_0x45a0f6)[_0xc492('0x23')](function(_0x38e835){_0x3e0f19[_0xc492('0x1e')]=_0x38e835;if(_0x5b210d[_0xc492('0x31')][_0xc492('0x3e')]){_0x5b5cf8[_0xc492('0x3f')]=[{'all':!![]}];}return db[_0xc492('0x2b')][_0xc492('0x40')](_0x5b5cf8);})[_0xc492('0x23')](function(_0x346617){_0x3e0f19[_0xc492('0x41')]=_0x346617;return _0x3e0f19;})['then'](respondWithFilteredResult(_0x177506,_0x5b5cf8))['catch'](handleError(_0x177506,null));};exports[_0xc492('0x42')]=function(_0x1361f1,_0x4e63c5){var _0x5c3e53={'raw':!![],'where':{'id':_0x1361f1[_0xc492('0x43')]['id']}},_0x3d02f5={};_0x3d02f5[_0xc492('0x30')]=_[_0xc492('0x44')](db[_0xc492('0x2b')][_0xc492('0x2c')]);_0x3d02f5['query']=_[_0xc492('0x44')](_0x1361f1[_0xc492('0x31')]);_0x3d02f5[_0xc492('0x32')]=_[_0xc492('0x33')](_0x3d02f5[_0xc492('0x30')],_0x3d02f5[_0xc492('0x31')]);_0x5c3e53[_0xc492('0x34')]=_[_0xc492('0x33')](_0x3d02f5[_0xc492('0x30')],qs[_0xc492('0x35')](_0x1361f1[_0xc492('0x31')][_0xc492('0x35')]));_0x5c3e53['attributes']=_0x5c3e53['attributes'][_0xc492('0x36')]?_0x5c3e53[_0xc492('0x34')]:_0x3d02f5[_0xc492('0x30')];if(_0x1361f1['query'][_0xc492('0x3e')]){_0x5c3e53['include']=[{'all':!![]}];}_0x5c3e53=_['merge']({},_0x5c3e53,_0x1361f1['options']);return db['OpenchannelQueueReport'][_0xc492('0x45')](_0x5c3e53)[_0xc492('0x23')](handleEntityNotFound(_0x4e63c5,null))['then'](respondWithResult(_0x4e63c5,null))[_0xc492('0x46')](handleError(_0x4e63c5,null));};exports['create']=function(_0x30d0c7,_0x5209d1){return db[_0xc492('0x2b')][_0xc492('0x47')](_0x30d0c7[_0xc492('0x48')],{})['then'](respondWithResult(_0x5209d1,0xc9))['catch'](handleError(_0x5209d1,null));};exports[_0xc492('0x49')]=function(_0x4a54cd,_0x47074c){if(_0x4a54cd[_0xc492('0x48')]['id']){delete _0x4a54cd[_0xc492('0x48')]['id'];}return db[_0xc492('0x2b')][_0xc492('0x45')]({'where':{'id':_0x4a54cd[_0xc492('0x43')]['id']}})[_0xc492('0x23')](handleEntityNotFound(_0x47074c,null))['then'](saveUpdates(_0x4a54cd[_0xc492('0x48')],null))['then'](respondWithResult(_0x47074c,null))[_0xc492('0x46')](handleError(_0x47074c,null));};exports['destroy']=function(_0x1e39b2,_0x42842e){return db[_0xc492('0x2b')][_0xc492('0x45')]({'where':{'id':_0x1e39b2[_0xc492('0x43')]['id']}})[_0xc492('0x23')](handleEntityNotFound(_0x42842e,null))['then'](removeEntity(_0x42842e,null))['catch'](handleError(_0x42842e,null));};exports[_0xc492('0x4a')]=function(_0x767848,_0x38379d){return db[_0xc492('0x2b')][_0xc492('0x4a')]()[_0xc492('0x23')](respondWithResult(_0x38379d,null))[_0xc492('0x46')](handleError(_0x38379d,null));}; \ No newline at end of file +var _0xc38b=['fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','include','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc38b,0xac));var _0xbc38=function(_0x19fed7,_0x4601c9){_0x19fed7=_0x19fed7-0x0;var _0x3ea578=_0xc38b[_0x19fed7];return _0x3ea578;};'use strict';var emlformat=require(_0xbc38('0x0'));var rimraf=require(_0xbc38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc38('0x2'));var rp=require(_0xbc38('0x3'));var moment=require(_0xbc38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbc38('0x5'));var util=require('util');var path=require(_0xbc38('0x6'));var sox=require(_0xbc38('0x7'));var csv=require(_0xbc38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbc38('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc38('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbc38('0xb'));var Papa=require(_0xbc38('0xc'));var Redis=require(_0xbc38('0xd'));var authService=require(_0xbc38('0xe'));var qs=require(_0xbc38('0xf'));var as=require(_0xbc38('0x10'));var hardwareService=require(_0xbc38('0x11'));var logger=require(_0xbc38('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xbc38('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc38('0x14'))['db'];function respondWithStatusCode(_0x53eb05,_0x290569){_0x290569=_0x290569||0xcc;return function(_0x3eede4){if(_0x3eede4){return _0x53eb05['sendStatus'](_0x290569);}return _0x53eb05['status'](_0x290569)['end']();};}function respondWithResult(_0x27b1ce,_0x2c94e2){_0x2c94e2=_0x2c94e2||0xc8;return function(_0x4c90b4){if(_0x4c90b4){return _0x27b1ce[_0xbc38('0x15')](_0x2c94e2)[_0xbc38('0x16')](_0x4c90b4);}};}function respondWithFilteredResult(_0x42c34a,_0x491479){return function(_0x5a46df){if(_0x5a46df){var _0x2df08f=typeof _0x491479[_0xbc38('0x17')]===_0xbc38('0x18')&&typeof _0x491479[_0xbc38('0x19')]===_0xbc38('0x18');var _0x4cbbd7=_0x5a46df[_0xbc38('0x1a')];var _0x3bed0f=_0x2df08f?0x0:_0x491479['offset'];var _0x5e2d79=_0x2df08f?_0x5a46df[_0xbc38('0x1a')]:_0x491479[_0xbc38('0x17')]+_0x491479[_0xbc38('0x19')];var _0x118e31;if(_0x5e2d79>=_0x4cbbd7){_0x5e2d79=_0x4cbbd7;_0x118e31=0xc8;}else{_0x118e31=0xce;}_0x42c34a[_0xbc38('0x15')](_0x118e31);return _0x42c34a['set']('Content-Range',_0x3bed0f+'-'+_0x5e2d79+'/'+_0x4cbbd7)[_0xbc38('0x16')](_0x5a46df);}return null;};}function patchUpdates(_0x1abffb){return function(_0x59fc19){try{jsonpatch['apply'](_0x59fc19,_0x1abffb,!![]);}catch(_0x2c9a50){return BPromise['reject'](_0x2c9a50);}return _0x59fc19[_0xbc38('0x1b')]();};}function saveUpdates(_0x4b3ccf,_0x12c31d){return function(_0x19df64){if(_0x19df64){return _0x19df64[_0xbc38('0x1c')](_0x4b3ccf)[_0xbc38('0x1d')](function(_0x4a2af9){return _0x4a2af9;});}return null;};}function removeEntity(_0x3e3d58,_0x55dd21){return function(_0x3c4c3e){if(_0x3c4c3e){return _0x3c4c3e[_0xbc38('0x1e')]()[_0xbc38('0x1d')](function(){_0x3e3d58[_0xbc38('0x15')](0xcc)[_0xbc38('0x1f')]();});}};}function handleEntityNotFound(_0x1979b7,_0x3d7319){return function(_0x232869){if(!_0x232869){_0x1979b7[_0xbc38('0x20')](0x194);}return _0x232869;};}function handleError(_0x1749fd,_0x5da73a){_0x5da73a=_0x5da73a||0x1f4;return function(_0x1e0c64){logger[_0xbc38('0x21')](_0x1e0c64[_0xbc38('0x22')]);if(_0x1e0c64[_0xbc38('0x23')]){delete _0x1e0c64[_0xbc38('0x23')];}_0x1749fd[_0xbc38('0x15')](_0x5da73a)[_0xbc38('0x24')](_0x1e0c64);};}exports[_0xbc38('0x25')]=function(_0x3095f0,_0x1fc854){var _0x41c126={},_0x1deb2d={},_0x467d12={'count':0x0,'rows':[]};var _0x46dbe7=_[_0xbc38('0x26')](db[_0xbc38('0x27')][_0xbc38('0x28')],function(_0x224349){return{'name':_0x224349[_0xbc38('0x29')],'type':_0x224349[_0xbc38('0x2a')][_0xbc38('0x2b')]};});_0x1deb2d[_0xbc38('0x2c')]=_[_0xbc38('0x26')](_0x46dbe7,_0xbc38('0x23'));_0x1deb2d[_0xbc38('0x2d')]=_[_0xbc38('0x2e')](_0x3095f0['query']);_0x1deb2d['filters']=_[_0xbc38('0x2f')](_0x1deb2d[_0xbc38('0x2c')],_0x1deb2d[_0xbc38('0x2d')]);_0x41c126['attributes']=_[_0xbc38('0x2f')](_0x1deb2d[_0xbc38('0x2c')],qs['fields'](_0x3095f0[_0xbc38('0x2d')][_0xbc38('0x30')]));_0x41c126[_0xbc38('0x31')]=_0x41c126[_0xbc38('0x31')][_0xbc38('0x32')]?_0x41c126[_0xbc38('0x31')]:_0x1deb2d[_0xbc38('0x2c')];if(!_0x3095f0[_0xbc38('0x2d')][_0xbc38('0x33')](_0xbc38('0x34'))){_0x41c126[_0xbc38('0x19')]=qs['limit'](_0x3095f0[_0xbc38('0x2d')][_0xbc38('0x19')]);_0x41c126[_0xbc38('0x17')]=qs[_0xbc38('0x17')](_0x3095f0[_0xbc38('0x2d')][_0xbc38('0x17')]);}_0x41c126[_0xbc38('0x35')]=qs[_0xbc38('0x36')](_0x3095f0[_0xbc38('0x2d')][_0xbc38('0x36')]);_0x41c126[_0xbc38('0x37')]=qs['filters'](_[_0xbc38('0x38')](_0x3095f0[_0xbc38('0x2d')],_0x1deb2d[_0xbc38('0x39')]),_0x46dbe7);if(_0x3095f0[_0xbc38('0x2d')]['filter']){_0x41c126['where']=_[_0xbc38('0x3a')](_0x41c126['where'],{'$or':_[_0xbc38('0x26')](_0x46dbe7,function(_0x6eb0fc){if(_0x6eb0fc[_0xbc38('0x2a')]!==_0xbc38('0x3b')){var _0x38d6b1={};_0x38d6b1[_0x6eb0fc[_0xbc38('0x23')]]={'$like':'%'+_0x3095f0['query'][_0xbc38('0x3c')]+'%'};return _0x38d6b1;}})});}_0x41c126=_[_0xbc38('0x3a')]({},_0x41c126,_0x3095f0['options']);var _0x35cdd4={'where':_0x41c126['where']};return db['OpenchannelQueueReport'][_0xbc38('0x1a')](_0x35cdd4)['then'](function(_0x123506){_0x467d12[_0xbc38('0x1a')]=_0x123506;if(_0x3095f0[_0xbc38('0x2d')]['includeAll']){_0x41c126[_0xbc38('0x3d')]=[{'all':!![]}];}return db[_0xbc38('0x27')]['findAll'](_0x41c126);})[_0xbc38('0x1d')](function(_0x2efcd2){_0x467d12[_0xbc38('0x3e')]=_0x2efcd2;return _0x467d12;})[_0xbc38('0x1d')](respondWithFilteredResult(_0x1fc854,_0x41c126))[_0xbc38('0x3f')](handleError(_0x1fc854,null));};exports[_0xbc38('0x40')]=function(_0x36c088,_0x577fb6){var _0x1da4cd={'raw':!![],'where':{'id':_0x36c088['params']['id']}},_0x5a66e9={};_0x5a66e9['model']=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x5a66e9['query']=_[_0xbc38('0x2e')](_0x36c088[_0xbc38('0x2d')]);_0x5a66e9[_0xbc38('0x39')]=_['intersection'](_0x5a66e9['model'],_0x5a66e9[_0xbc38('0x2d')]);_0x1da4cd[_0xbc38('0x31')]=_[_0xbc38('0x2f')](_0x5a66e9[_0xbc38('0x2c')],qs[_0xbc38('0x30')](_0x36c088[_0xbc38('0x2d')][_0xbc38('0x30')]));_0x1da4cd[_0xbc38('0x31')]=_0x1da4cd[_0xbc38('0x31')][_0xbc38('0x32')]?_0x1da4cd[_0xbc38('0x31')]:_0x5a66e9[_0xbc38('0x2c')];if(_0x36c088[_0xbc38('0x2d')]['includeAll']){_0x1da4cd['include']=[{'all':!![]}];}_0x1da4cd=_[_0xbc38('0x3a')]({},_0x1da4cd,_0x36c088[_0xbc38('0x41')]);return db['OpenchannelQueueReport'][_0xbc38('0x42')](_0x1da4cd)[_0xbc38('0x1d')](handleEntityNotFound(_0x577fb6,null))[_0xbc38('0x1d')](respondWithResult(_0x577fb6,null))['catch'](handleError(_0x577fb6,null));};exports[_0xbc38('0x43')]=function(_0x14cbfe,_0x4e52f6){return db[_0xbc38('0x27')][_0xbc38('0x43')](_0x14cbfe[_0xbc38('0x44')],{})[_0xbc38('0x1d')](respondWithResult(_0x4e52f6,0xc9))[_0xbc38('0x3f')](handleError(_0x4e52f6,null));};exports[_0xbc38('0x1c')]=function(_0x44eba4,_0x259583){if(_0x44eba4[_0xbc38('0x44')]['id']){delete _0x44eba4[_0xbc38('0x44')]['id'];}return db['OpenchannelQueueReport'][_0xbc38('0x42')]({'where':{'id':_0x44eba4[_0xbc38('0x45')]['id']}})[_0xbc38('0x1d')](handleEntityNotFound(_0x259583,null))[_0xbc38('0x1d')](saveUpdates(_0x44eba4[_0xbc38('0x44')],null))[_0xbc38('0x1d')](respondWithResult(_0x259583,null))[_0xbc38('0x3f')](handleError(_0x259583,null));};exports[_0xbc38('0x1e')]=function(_0xb8fbb3,_0x205377){return db[_0xbc38('0x27')][_0xbc38('0x42')]({'where':{'id':_0xb8fbb3['params']['id']}})[_0xbc38('0x1d')](handleEntityNotFound(_0x205377,null))[_0xbc38('0x1d')](removeEntity(_0x205377,null))[_0xbc38('0x3f')](handleError(_0x205377,null));};exports['describe']=function(_0x4bc1ab,_0x4d5508){return db['OpenchannelQueueReport'][_0xbc38('0x46')]()['then'](respondWithResult(_0x4d5508,null))[_0xbc38('0x3f')](handleError(_0x4d5508,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8003791..d42c60c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x814b,0x1a2));var _0xb814=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x814b[_0x4e6eac];return _0x79f963;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x1deefa,_0x862114){var _0x4fbdb6=function(_0x1f6ef5){while(--_0x1f6ef5){_0x1deefa['push'](_0x1deefa['shift']());}};_0x4fbdb6(++_0x862114);}(_0x5fc3,0xa8));var _0x35fc=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x5fc3[_0x452968];return _0xb6f9ae;};'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 c1db6bb..b910471 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 _0x0b7f=['CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','stringify','catch','UpdateOpenchannelQueueReport','update','body','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x4eb875,_0x331999){var _0x2c2c0d=function(_0x10efcf){while(--_0x10efcf){_0x4eb875['push'](_0x4eb875['shift']());}};_0x2c2c0d(++_0x331999);}(_0x0b7f,0x115));var _0xf0b7=function(_0x5e630e,_0x105b73){_0x5e630e=_0x5e630e-0x0;var _0x20405b=_0x0b7f[_0x5e630e];return _0x20405b;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateOpenchannelQueueReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});};exports[_0xf0b7('0x1c')]=function(_0x2cfb7b){var _0x14782a=this;return new Promise(function(_0x210afa,_0x2ba0da){return db[_0xf0b7('0x15')][_0xf0b7('0x1d')](_0x2cfb7b[_0xf0b7('0x1e')],{'raw':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')]['where']||null:null,'attributes':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')][_0xf0b7('0x1f')]||null:null,'limit':_0x2cfb7b['options']?_0x2cfb7b[_0xf0b7('0x17')][_0xf0b7('0x20')]||null:null})[_0xf0b7('0xb')](function(_0x4fda93){logger[_0xf0b7('0xc')](_0xf0b7('0x1c'),_0x2cfb7b);logger[_0xf0b7('0x19')](_0xf0b7('0x1c'),_0x2cfb7b,JSON[_0xf0b7('0x1a')](_0x4fda93));_0x210afa(_0x4fda93);})[_0xf0b7('0x1b')](function(_0x10643f){logger[_0xf0b7('0xe')](_0xf0b7('0x1c'),_0x10643f[_0xf0b7('0x11')],_0x2cfb7b);_0x2ba0da(_0x14782a['error'](0x1f4,_0x10643f[_0xf0b7('0x11')]));});});}; \ No newline at end of file +var _0xef0f=['OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','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','CreateOpenchannelQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef0f,0x168));var _0xfef0=function(_0x2fd07f,_0x58c4fa){_0x2fd07f=_0x2fd07f-0x0;var _0x6bdebd=_0xef0f[_0x2fd07f];return _0x6bdebd;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![]})[_0xfef0('0xc')](function(_0x28dee1){logger['info'](_0xfef0('0x18'),_0x581459);logger['debug'](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x28dee1));_0x1642cd(_0x28dee1);})['catch'](function(_0x4897af){logger['error'](_0xfef0('0x18'),_0x4897af['message'],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x4897af[_0xfef0('0x15')]));});});};exports[_0xfef0('0x1d')]=function(_0x4483f2){var _0x249fe4=this;return new Promise(function(_0xd687ed,_0x5c9085){return db['OpenchannelQueueReport'][_0xfef0('0x1e')](_0x4483f2[_0xfef0('0x1f')],{'raw':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x20')]||null:null,'attributes':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2['options'][_0xfef0('0x21')]||null:null,'limit':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x22')]||null:null})[_0xfef0('0xc')](function(_0x1ac4a3){logger[_0xfef0('0xd')](_0xfef0('0x1d'),_0x4483f2);logger[_0xfef0('0x10')](_0xfef0('0x1d'),_0x4483f2,JSON[_0xfef0('0x12')](_0x1ac4a3));_0xd687ed(_0x1ac4a3);})[_0xfef0('0x17')](function(_0x51af0f){logger[_0xfef0('0x13')]('UpdateOpenchannelQueueReport',_0x51af0f['message'],_0x4483f2);_0x5c9085(_0x249fe4[_0xfef0('0x13')](0x1f4,_0x51af0f[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ed8abb9..5aeee90 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 _0x8662=['get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x8662,0x1bd));var _0x2866=function(_0x14473f,_0x1b93ea){_0x14473f=_0x14473f-0x0;var _0x7b682e=_0x8662[_0x14473f];return _0x7b682e;};'use strict';var multer=require(_0x2866('0x0'));var util=require(_0x2866('0x1'));var path=require(_0x2866('0x2'));var timeout=require(_0x2866('0x3'));var express=require(_0x2866('0x4'));var router=express[_0x2866('0x5')]();var fs_extra=require(_0x2866('0x6'));var auth=require(_0x2866('0x7'));var interaction=require(_0x2866('0x8'));var config=require(_0x2866('0x9'));var controller=require(_0x2866('0xa'));router[_0x2866('0xb')]('/',auth[_0x2866('0xc')](),controller[_0x2866('0xd')]);router[_0x2866('0xb')]('/describe',auth[_0x2866('0xc')](),controller[_0x2866('0xe')]);router['get'](_0x2866('0xf'),auth[_0x2866('0xc')](),controller[_0x2866('0x10')]);router[_0x2866('0x11')]('/',auth[_0x2866('0xc')](),controller[_0x2866('0x12')]);router[_0x2866('0x13')](_0x2866('0xf'),auth[_0x2866('0xc')](),controller[_0x2866('0x14')]);router[_0x2866('0x15')](_0x2866('0xf'),auth['isAuthenticated'](),controller[_0x2866('0x16')]);module[_0x2866('0x17')]=router; \ No newline at end of file +var _0x2a3e=['path','connect-timeout','express','fs-extra','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util'];(function(_0x205c30,_0x317695){var _0x5b5aa2=function(_0x5e0001){while(--_0x5e0001){_0x205c30['push'](_0x205c30['shift']());}};_0x5b5aa2(++_0x317695);}(_0x2a3e,0x130));var _0xe2a3=function(_0x4475e0,_0x1c54c1){_0x4475e0=_0x4475e0-0x0;var _0x44d629=_0x2a3e[_0x4475e0];return _0x44d629;};'use strict';var multer=require(_0xe2a3('0x0'));var util=require(_0xe2a3('0x1'));var path=require(_0xe2a3('0x2'));var timeout=require(_0xe2a3('0x3'));var express=require(_0xe2a3('0x4'));var router=express['Router']();var fs_extra=require(_0xe2a3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2a3('0x6'));router[_0xe2a3('0x7')]('/',auth[_0xe2a3('0x8')](),controller[_0xe2a3('0x9')]);router[_0xe2a3('0x7')]('/describe',auth[_0xe2a3('0x8')](),controller['describe']);router[_0xe2a3('0x7')](_0xe2a3('0xa'),auth[_0xe2a3('0x8')](),controller[_0xe2a3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2a3('0xc')]);router[_0xe2a3('0xd')](_0xe2a3('0xa'),auth[_0xe2a3('0x8')](),controller['update']);router[_0xe2a3('0xe')](_0xe2a3('0xa'),auth[_0xe2a3('0x8')](),controller[_0xe2a3('0xf')]);module[_0xe2a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0d3f19d..abb1dbd 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x396101,_0x2d5b6c){var _0x4006c0=function(_0x365cec){while(--_0x365cec){_0x396101['push'](_0x396101['shift']());}};_0x4006c0(++_0x2d5b6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x34e8,0x12c));var _0x834e=function(_0x191271,_0xa361a0){_0x191271=_0x191271-0x0;var _0x3cb277=_0x34e8[_0x191271];return _0x3cb277;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4c6b68c..e193aba 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 _0x1f7c=['crypto','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','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','sendStatus','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','model','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x9fdb4b,_0x3b9ae9){var _0x36a1ed=function(_0x6c8c5e){while(--_0x6c8c5e){_0x9fdb4b['push'](_0x9fdb4b['shift']());}};_0x36a1ed(++_0x3b9ae9);}(_0x1f7c,0x122));var _0xc1f7=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x1f7c[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require(_0xc1f7('0x0'));var rimraf=require(_0xc1f7('0x1'));var zipdir=require(_0xc1f7('0x2'));var jsonpatch=require(_0xc1f7('0x3'));var rp=require(_0xc1f7('0x4'));var moment=require(_0xc1f7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc1f7('0x6'));var util=require(_0xc1f7('0x7'));var path=require(_0xc1f7('0x8'));var sox=require(_0xc1f7('0x9'));var csv=require(_0xc1f7('0xa'));var ejs=require(_0xc1f7('0xb'));var fs=require('fs');var fs_extra=require(_0xc1f7('0xc'));var _=require(_0xc1f7('0xd'));var squel=require('squel');var crypto=require(_0xc1f7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc1f7('0xf'));var toCsv=require(_0xc1f7('0xa'));var querystring=require(_0xc1f7('0x10'));var Papa=require('papaparse');var Redis=require(_0xc1f7('0x11'));var authService=require(_0xc1f7('0x12'));var qs=require(_0xc1f7('0x13'));var as=require(_0xc1f7('0x14'));var hardwareService=require(_0xc1f7('0x15'));var logger=require('../../config/logger')(_0xc1f7('0x16'));var utils=require(_0xc1f7('0x17'));var config=require(_0xc1f7('0x18'));var licenseUtil=require(_0xc1f7('0x19'));var db=require(_0xc1f7('0x1a'))['db'];function respondWithStatusCode(_0x1d03c6,_0x5cfd84){_0x5cfd84=_0x5cfd84||0xcc;return function(_0x5b3c7e){if(_0x5b3c7e){return _0x1d03c6['sendStatus'](_0x5cfd84);}return _0x1d03c6[_0xc1f7('0x1b')](_0x5cfd84)['end']();};}function respondWithResult(_0x1521cf,_0x3673f4){_0x3673f4=_0x3673f4||0xc8;return function(_0x1f5438){if(_0x1f5438){return _0x1521cf['status'](_0x3673f4)[_0xc1f7('0x1c')](_0x1f5438);}};}function respondWithFilteredResult(_0x561519,_0x2a0a37){return function(_0x4c7da1){if(_0x4c7da1){var _0x3da31f=typeof _0x2a0a37['offset']==='undefined'&&typeof _0x2a0a37['limit']==='undefined';var _0x416429=_0x4c7da1[_0xc1f7('0x1d')];var _0x137771=_0x3da31f?0x0:_0x2a0a37[_0xc1f7('0x1e')];var _0x3a0233=_0x3da31f?_0x4c7da1[_0xc1f7('0x1d')]:_0x2a0a37['offset']+_0x2a0a37[_0xc1f7('0x1f')];var _0x289ece;if(_0x3a0233>=_0x416429){_0x3a0233=_0x416429;_0x289ece=0xc8;}else{_0x289ece=0xce;}_0x561519['status'](_0x289ece);return _0x561519[_0xc1f7('0x20')](_0xc1f7('0x21'),_0x137771+'-'+_0x3a0233+'/'+_0x416429)[_0xc1f7('0x1c')](_0x4c7da1);}return null;};}function patchUpdates(_0x3aeb60){return function(_0x37eded){try{jsonpatch['apply'](_0x37eded,_0x3aeb60,!![]);}catch(_0x5d8fce){return BPromise[_0xc1f7('0x22')](_0x5d8fce);}return _0x37eded[_0xc1f7('0x23')]();};}function saveUpdates(_0x465d6d,_0x330693){return function(_0x564fa9){if(_0x564fa9){return _0x564fa9[_0xc1f7('0x24')](_0x465d6d)[_0xc1f7('0x25')](function(_0x4c0ff7){return _0x4c0ff7;});}return null;};}function removeEntity(_0x3f8cd2,_0x11b8c6){return function(_0xfc7f89){if(_0xfc7f89){return _0xfc7f89['destroy']()['then'](function(){_0x3f8cd2[_0xc1f7('0x1b')](0xcc)[_0xc1f7('0x26')]();});}};}function handleEntityNotFound(_0x2e1ff7,_0x160e31){return function(_0x3ce638){if(!_0x3ce638){_0x2e1ff7[_0xc1f7('0x27')](0x194);}return _0x3ce638;};}function handleError(_0x51264f,_0x223d56){_0x223d56=_0x223d56||0x1f4;return function(_0x43352b){logger[_0xc1f7('0x28')](_0x43352b['stack']);if(_0x43352b[_0xc1f7('0x29')]){delete _0x43352b[_0xc1f7('0x29')];}_0x51264f[_0xc1f7('0x1b')](_0x223d56)['send'](_0x43352b);};}exports[_0xc1f7('0x2a')]=function(_0x38109f,_0x6c3d63){var _0x406885={},_0x29df75={},_0x4c4823={'count':0x0,'rows':[]};var _0x4200ac=_[_0xc1f7('0x2b')](db[_0xc1f7('0x2c')][_0xc1f7('0x2d')],function(_0x90f2a8){return{'name':_0x90f2a8[_0xc1f7('0x2e')],'type':_0x90f2a8[_0xc1f7('0x2f')][_0xc1f7('0x30')]};});_0x29df75['model']=_[_0xc1f7('0x2b')](_0x4200ac,_0xc1f7('0x29'));_0x29df75[_0xc1f7('0x31')]=_['keys'](_0x38109f[_0xc1f7('0x31')]);_0x29df75[_0xc1f7('0x32')]=_[_0xc1f7('0x33')](_0x29df75['model'],_0x29df75[_0xc1f7('0x31')]);_0x406885[_0xc1f7('0x34')]=_[_0xc1f7('0x33')](_0x29df75['model'],qs[_0xc1f7('0x35')](_0x38109f['query'][_0xc1f7('0x35')]));_0x406885[_0xc1f7('0x34')]=_0x406885[_0xc1f7('0x34')][_0xc1f7('0x36')]?_0x406885[_0xc1f7('0x34')]:_0x29df75['model'];if(!_0x38109f[_0xc1f7('0x31')][_0xc1f7('0x37')](_0xc1f7('0x38'))){_0x406885[_0xc1f7('0x1f')]=qs[_0xc1f7('0x1f')](_0x38109f[_0xc1f7('0x31')][_0xc1f7('0x1f')]);_0x406885[_0xc1f7('0x1e')]=qs[_0xc1f7('0x1e')](_0x38109f['query']['offset']);}_0x406885[_0xc1f7('0x39')]=qs[_0xc1f7('0x3a')](_0x38109f['query'][_0xc1f7('0x3a')]);_0x406885[_0xc1f7('0x3b')]=qs[_0xc1f7('0x32')](_[_0xc1f7('0x3c')](_0x38109f[_0xc1f7('0x31')],_0x29df75['filters']),_0x4200ac);if(_0x38109f[_0xc1f7('0x31')][_0xc1f7('0x3d')]){_0x406885[_0xc1f7('0x3b')]=_[_0xc1f7('0x3e')](_0x406885[_0xc1f7('0x3b')],{'$or':_[_0xc1f7('0x2b')](_0x4200ac,function(_0x386d86){if(_0x386d86[_0xc1f7('0x2f')]!==_0xc1f7('0x3f')){var _0xc527a8={};_0xc527a8[_0x386d86[_0xc1f7('0x29')]]={'$like':'%'+_0x38109f[_0xc1f7('0x31')][_0xc1f7('0x3d')]+'%'};return _0xc527a8;}})});}_0x406885=_[_0xc1f7('0x3e')]({},_0x406885,_0x38109f[_0xc1f7('0x40')]);var _0x302c59={'where':_0x406885[_0xc1f7('0x3b')]};return db['OpenchannelTransferReport']['count'](_0x302c59)[_0xc1f7('0x25')](function(_0xf065d8){_0x4c4823[_0xc1f7('0x1d')]=_0xf065d8;if(_0x38109f[_0xc1f7('0x31')][_0xc1f7('0x41')]){_0x406885[_0xc1f7('0x42')]=[{'all':!![]}];}return db[_0xc1f7('0x2c')]['findAll'](_0x406885);})['then'](function(_0x34fba4){_0x4c4823[_0xc1f7('0x43')]=_0x34fba4;return _0x4c4823;})['then'](respondWithFilteredResult(_0x6c3d63,_0x406885))[_0xc1f7('0x44')](handleError(_0x6c3d63,null));};exports['show']=function(_0xc77af5,_0x495cf3){var _0xa42df1={'raw':!![],'where':{'id':_0xc77af5[_0xc1f7('0x45')]['id']}},_0x14612d={};_0x14612d[_0xc1f7('0x46')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x14612d[_0xc1f7('0x31')]=_[_0xc1f7('0x47')](_0xc77af5[_0xc1f7('0x31')]);_0x14612d['filters']=_[_0xc1f7('0x33')](_0x14612d[_0xc1f7('0x46')],_0x14612d[_0xc1f7('0x31')]);_0xa42df1[_0xc1f7('0x34')]=_[_0xc1f7('0x33')](_0x14612d[_0xc1f7('0x46')],qs[_0xc1f7('0x35')](_0xc77af5['query']['fields']));_0xa42df1[_0xc1f7('0x34')]=_0xa42df1['attributes'][_0xc1f7('0x36')]?_0xa42df1[_0xc1f7('0x34')]:_0x14612d[_0xc1f7('0x46')];if(_0xc77af5[_0xc1f7('0x31')][_0xc1f7('0x41')]){_0xa42df1['include']=[{'all':!![]}];}_0xa42df1=_['merge']({},_0xa42df1,_0xc77af5[_0xc1f7('0x40')]);return db[_0xc1f7('0x2c')][_0xc1f7('0x48')](_0xa42df1)[_0xc1f7('0x25')](handleEntityNotFound(_0x495cf3,null))[_0xc1f7('0x25')](respondWithResult(_0x495cf3,null))[_0xc1f7('0x44')](handleError(_0x495cf3,null));};exports[_0xc1f7('0x49')]=function(_0x3f702a,_0x30d478){return db[_0xc1f7('0x2c')][_0xc1f7('0x49')](_0x3f702a[_0xc1f7('0x4a')],{})['then'](respondWithResult(_0x30d478,0xc9))[_0xc1f7('0x44')](handleError(_0x30d478,null));};exports[_0xc1f7('0x24')]=function(_0x5865a1,_0x5e7d81){if(_0x5865a1['body']['id']){delete _0x5865a1[_0xc1f7('0x4a')]['id'];}return db[_0xc1f7('0x2c')][_0xc1f7('0x48')]({'where':{'id':_0x5865a1[_0xc1f7('0x45')]['id']}})[_0xc1f7('0x25')](handleEntityNotFound(_0x5e7d81,null))['then'](saveUpdates(_0x5865a1['body'],null))[_0xc1f7('0x25')](respondWithResult(_0x5e7d81,null))['catch'](handleError(_0x5e7d81,null));};exports[_0xc1f7('0x4b')]=function(_0x51f421,_0x33da82){return db[_0xc1f7('0x2c')][_0xc1f7('0x48')]({'where':{'id':_0x51f421[_0xc1f7('0x45')]['id']}})[_0xc1f7('0x25')](handleEntityNotFound(_0x33da82,null))[_0xc1f7('0x25')](removeEntity(_0x33da82,null))[_0xc1f7('0x44')](handleError(_0x33da82,null));};exports['describe']=function(_0x293faa,_0x35504f){return db[_0xc1f7('0x2c')]['describe']()[_0xc1f7('0x25')](respondWithResult(_0x35504f,null))[_0xc1f7('0x44')](handleError(_0x35504f,null));}; \ No newline at end of file +var _0x4614=['OpenchannelTransferReport','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','status','end','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','error','stack','name','index','map'];(function(_0x22e278,_0x366259){var _0x5592b8=function(_0x28de0a){while(--_0x28de0a){_0x22e278['push'](_0x22e278['shift']());}};_0x5592b8(++_0x366259);}(_0x4614,0xfd));var _0x4461=function(_0x361b43,_0x32bf50){_0x361b43=_0x361b43-0x0;var _0x2fe0f5=_0x4614[_0x361b43];return _0x2fe0f5;};'use strict';var emlformat=require(_0x4461('0x0'));var rimraf=require(_0x4461('0x1'));var zipdir=require(_0x4461('0x2'));var jsonpatch=require(_0x4461('0x3'));var rp=require('request-promise');var moment=require(_0x4461('0x4'));var BPromise=require(_0x4461('0x5'));var Mustache=require(_0x4461('0x6'));var util=require(_0x4461('0x7'));var path=require(_0x4461('0x8'));var sox=require(_0x4461('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4461('0xa'));var _=require('lodash');var squel=require(_0x4461('0xb'));var crypto=require('crypto');var jsforce=require(_0x4461('0xc'));var deskjs=require(_0x4461('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4461('0xe'));var Papa=require(_0x4461('0xf'));var Redis=require(_0x4461('0x10'));var authService=require(_0x4461('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4461('0x12'));var hardwareService=require(_0x4461('0x13'));var logger=require(_0x4461('0x14'))(_0x4461('0x15'));var utils=require(_0x4461('0x16'));var config=require(_0x4461('0x17'));var licenseUtil=require(_0x4461('0x18'));var db=require(_0x4461('0x19'))['db'];function respondWithStatusCode(_0x160b05,_0x3e2694){_0x3e2694=_0x3e2694||0xcc;return function(_0x3eadbc){if(_0x3eadbc){return _0x160b05['sendStatus'](_0x3e2694);}return _0x160b05[_0x4461('0x1a')](_0x3e2694)[_0x4461('0x1b')]();};}function respondWithResult(_0x44db46,_0x4bc04a){_0x4bc04a=_0x4bc04a||0xc8;return function(_0x116ca9){if(_0x116ca9){return _0x44db46[_0x4461('0x1a')](_0x4bc04a)['json'](_0x116ca9);}};}function respondWithFilteredResult(_0x2b130c,_0x3cbf74){return function(_0x3c7e14){if(_0x3c7e14){var _0xc9f864=typeof _0x3cbf74[_0x4461('0x1c')]===_0x4461('0x1d')&&typeof _0x3cbf74[_0x4461('0x1e')]===_0x4461('0x1d');var _0x404110=_0x3c7e14[_0x4461('0x1f')];var _0x5eaeb4=_0xc9f864?0x0:_0x3cbf74['offset'];var _0x52ce58=_0xc9f864?_0x3c7e14['count']:_0x3cbf74[_0x4461('0x1c')]+_0x3cbf74['limit'];var _0x593950;if(_0x52ce58>=_0x404110){_0x52ce58=_0x404110;_0x593950=0xc8;}else{_0x593950=0xce;}_0x2b130c[_0x4461('0x1a')](_0x593950);return _0x2b130c[_0x4461('0x20')]('Content-Range',_0x5eaeb4+'-'+_0x52ce58+'/'+_0x404110)['json'](_0x3c7e14);}return null;};}function patchUpdates(_0x17d229){return function(_0x118297){try{jsonpatch[_0x4461('0x21')](_0x118297,_0x17d229,!![]);}catch(_0x40b48d){return BPromise['reject'](_0x40b48d);}return _0x118297[_0x4461('0x22')]();};}function saveUpdates(_0x32fe88,_0x67e530){return function(_0x3ef22f){if(_0x3ef22f){return _0x3ef22f[_0x4461('0x23')](_0x32fe88)[_0x4461('0x24')](function(_0x191283){return _0x191283;});}return null;};}function removeEntity(_0x50f7c1,_0x307fc5){return function(_0x32ba63){if(_0x32ba63){return _0x32ba63['destroy']()[_0x4461('0x24')](function(){_0x50f7c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x317a96,_0x14c74b){return function(_0x4a2deb){if(!_0x4a2deb){_0x317a96[_0x4461('0x25')](0x194);}return _0x4a2deb;};}function handleError(_0x21f64c,_0x5b3010){_0x5b3010=_0x5b3010||0x1f4;return function(_0x2da05c){logger[_0x4461('0x26')](_0x2da05c[_0x4461('0x27')]);if(_0x2da05c[_0x4461('0x28')]){delete _0x2da05c[_0x4461('0x28')];}_0x21f64c['status'](_0x5b3010)['send'](_0x2da05c);};}exports[_0x4461('0x29')]=function(_0x1fd754,_0x4ec9af){var _0x540004={},_0x440cef={},_0x367f4e={'count':0x0,'rows':[]};var _0x118240=_[_0x4461('0x2a')](db[_0x4461('0x2b')][_0x4461('0x2c')],function(_0x51e436){return{'name':_0x51e436['fieldName'],'type':_0x51e436['type'][_0x4461('0x2d')]};});_0x440cef[_0x4461('0x2e')]=_[_0x4461('0x2a')](_0x118240,_0x4461('0x28'));_0x440cef[_0x4461('0x2f')]=_[_0x4461('0x30')](_0x1fd754['query']);_0x440cef[_0x4461('0x31')]=_['intersection'](_0x440cef[_0x4461('0x2e')],_0x440cef[_0x4461('0x2f')]);_0x540004[_0x4461('0x32')]=_[_0x4461('0x33')](_0x440cef[_0x4461('0x2e')],qs[_0x4461('0x34')](_0x1fd754[_0x4461('0x2f')][_0x4461('0x34')]));_0x540004[_0x4461('0x32')]=_0x540004[_0x4461('0x32')]['length']?_0x540004[_0x4461('0x32')]:_0x440cef[_0x4461('0x2e')];if(!_0x1fd754[_0x4461('0x2f')][_0x4461('0x35')](_0x4461('0x36'))){_0x540004[_0x4461('0x1e')]=qs['limit'](_0x1fd754[_0x4461('0x2f')][_0x4461('0x1e')]);_0x540004[_0x4461('0x1c')]=qs[_0x4461('0x1c')](_0x1fd754['query'][_0x4461('0x1c')]);}_0x540004[_0x4461('0x37')]=qs[_0x4461('0x38')](_0x1fd754[_0x4461('0x2f')][_0x4461('0x38')]);_0x540004[_0x4461('0x39')]=qs[_0x4461('0x31')](_['pick'](_0x1fd754[_0x4461('0x2f')],_0x440cef[_0x4461('0x31')]),_0x118240);if(_0x1fd754['query']['filter']){_0x540004[_0x4461('0x39')]=_[_0x4461('0x3a')](_0x540004[_0x4461('0x39')],{'$or':_[_0x4461('0x2a')](_0x118240,function(_0x55ed27){if(_0x55ed27['type']!=='VIRTUAL'){var _0x1265d3={};_0x1265d3[_0x55ed27['name']]={'$like':'%'+_0x1fd754[_0x4461('0x2f')][_0x4461('0x3b')]+'%'};return _0x1265d3;}})});}_0x540004=_[_0x4461('0x3a')]({},_0x540004,_0x1fd754[_0x4461('0x3c')]);var _0x311ca4={'where':_0x540004['where']};return db[_0x4461('0x2b')][_0x4461('0x1f')](_0x311ca4)[_0x4461('0x24')](function(_0x466a1d){_0x367f4e['count']=_0x466a1d;if(_0x1fd754[_0x4461('0x2f')][_0x4461('0x3d')]){_0x540004[_0x4461('0x3e')]=[{'all':!![]}];}return db[_0x4461('0x2b')][_0x4461('0x3f')](_0x540004);})[_0x4461('0x24')](function(_0x2f1785){_0x367f4e[_0x4461('0x40')]=_0x2f1785;return _0x367f4e;})[_0x4461('0x24')](respondWithFilteredResult(_0x4ec9af,_0x540004))[_0x4461('0x41')](handleError(_0x4ec9af,null));};exports[_0x4461('0x42')]=function(_0x57c27b,_0x4168f9){var _0x4849f9={'raw':!![],'where':{'id':_0x57c27b[_0x4461('0x43')]['id']}},_0x167d0f={};_0x167d0f[_0x4461('0x2e')]=_['keys'](db['OpenchannelTransferReport'][_0x4461('0x2c')]);_0x167d0f[_0x4461('0x2f')]=_['keys'](_0x57c27b['query']);_0x167d0f[_0x4461('0x31')]=_[_0x4461('0x33')](_0x167d0f[_0x4461('0x2e')],_0x167d0f[_0x4461('0x2f')]);_0x4849f9[_0x4461('0x32')]=_['intersection'](_0x167d0f[_0x4461('0x2e')],qs[_0x4461('0x34')](_0x57c27b[_0x4461('0x2f')][_0x4461('0x34')]));_0x4849f9[_0x4461('0x32')]=_0x4849f9[_0x4461('0x32')][_0x4461('0x44')]?_0x4849f9[_0x4461('0x32')]:_0x167d0f['model'];if(_0x57c27b[_0x4461('0x2f')][_0x4461('0x3d')]){_0x4849f9[_0x4461('0x3e')]=[{'all':!![]}];}_0x4849f9=_[_0x4461('0x3a')]({},_0x4849f9,_0x57c27b[_0x4461('0x3c')]);return db[_0x4461('0x2b')][_0x4461('0x45')](_0x4849f9)['then'](handleEntityNotFound(_0x4168f9,null))[_0x4461('0x24')](respondWithResult(_0x4168f9,null))[_0x4461('0x41')](handleError(_0x4168f9,null));};exports['create']=function(_0xcd954b,_0x5c11b5){return db[_0x4461('0x2b')][_0x4461('0x46')](_0xcd954b[_0x4461('0x47')],{})[_0x4461('0x24')](respondWithResult(_0x5c11b5,0xc9))['catch'](handleError(_0x5c11b5,null));};exports['update']=function(_0x11e691,_0x53b0a8){if(_0x11e691[_0x4461('0x47')]['id']){delete _0x11e691[_0x4461('0x47')]['id'];}return db[_0x4461('0x2b')][_0x4461('0x45')]({'where':{'id':_0x11e691[_0x4461('0x43')]['id']}})['then'](handleEntityNotFound(_0x53b0a8,null))[_0x4461('0x24')](saveUpdates(_0x11e691[_0x4461('0x47')],null))[_0x4461('0x24')](respondWithResult(_0x53b0a8,null))['catch'](handleError(_0x53b0a8,null));};exports[_0x4461('0x48')]=function(_0x435a03,_0x1aa778){return db[_0x4461('0x2b')][_0x4461('0x45')]({'where':{'id':_0x435a03[_0x4461('0x43')]['id']}})[_0x4461('0x24')](handleEntityNotFound(_0x1aa778,null))[_0x4461('0x24')](removeEntity(_0x1aa778,null))[_0x4461('0x41')](handleError(_0x1aa778,null));};exports[_0x4461('0x49')]=function(_0x164c08,_0x150fe3){return db[_0x4461('0x2b')][_0x4461('0x49')]()['then'](respondWithResult(_0x150fe3,null))[_0x4461('0x41')](handleError(_0x150fe3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 254d128..63d2e5c 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 _0xb2e6=['exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1089c3,_0x340bb6){var _0x3f07c4=function(_0x34141c){while(--_0x34141c){_0x1089c3['push'](_0x1089c3['shift']());}};_0x3f07c4(++_0x340bb6);}(_0xb2e6,0x16f));var _0x6b2e=function(_0x29271c,_0x4735c9){_0x29271c=_0x29271c-0x0;var _0x19848a=_0xb2e6[_0x29271c];return _0x19848a;};'use strict';var _=require(_0x6b2e('0x0'));var util=require(_0x6b2e('0x1'));var logger=require(_0x6b2e('0x2'))('api');var moment=require(_0x6b2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b2e('0x5'));var config=require(_0x6b2e('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6b2e('0x7')]=function(_0x2f15e2,_0x384c5b){return _0x2f15e2[_0x6b2e('0x8')](_0x6b2e('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6b2e('0xa'),'fields':[_0x6b2e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a64=['./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2a64,0x164));var _0x42a6=function(_0x2b89af,_0x4d4263){_0x2b89af=_0x2b89af-0x0;var _0x498777=_0x2a64[_0x2b89af];return _0x498777;};'use strict';var _=require(_0x42a6('0x0'));var util=require(_0x42a6('0x1'));var logger=require('../../config/logger')(_0x42a6('0x2'));var moment=require(_0x42a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x42a6('0x4'));var fs=require('fs');var path=require(_0x42a6('0x5'));var rimraf=require(_0x42a6('0x6'));var config=require(_0x42a6('0x7'));var attributes=require(_0x42a6('0x8'));module[_0x42a6('0x9')]=function(_0xc72ef0,_0x8aacff){return _0xc72ef0[_0x42a6('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x42a6('0xb'),'paranoid':![],'indexes':[{'name':_0x42a6('0xc'),'fields':[_0x42a6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5671557..a50f627 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 _0xa9b1=['http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x393376,_0x1951fa){var _0x15980c=function(_0x1240fa){while(--_0x1240fa){_0x393376['push'](_0x393376['shift']());}};_0x15980c(++_0x1951fa);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a9b('0x0'));var BPromise=require(_0x1a9b('0x1'));var rs=require(_0x1a9b('0x2'));var fs=require('fs');var Redis=require(_0x1a9b('0x3'));var db=require(_0x1a9b('0x4'))['db'];var utils=require(_0x1a9b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1a9b('0x6'));var client=jayson[_0x1a9b('0x7')][_0x1a9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc55657,_0x32cff5,_0x16c344){return new BPromise(function(_0x263b84,_0x16e01a){return client[_0x1a9b('0x9')](_0xc55657,_0x16c344)[_0x1a9b('0xa')](function(_0x162d6a){logger[_0x1a9b('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x32cff5,'request\x20sent');logger[_0x1a9b('0xc')](_0x1a9b('0xd'),_0x32cff5,_0x1a9b('0xe'),JSON['stringify'](_0x162d6a));if(_0x162d6a['error']){if(_0x162d6a['error'][_0x1a9b('0xf')]===0x1f4){logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x162d6a[_0x1a9b('0x10')][_0x1a9b('0x12')]);return _0x16e01a(_0x162d6a[_0x1a9b('0x10')]['message']);}logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x162d6a[_0x1a9b('0x10')]['message']);return _0x263b84(_0x162d6a[_0x1a9b('0x10')][_0x1a9b('0x12')]);}else{logger['info'](_0x1a9b('0x11'),_0x32cff5,'request\x20sent');_0x263b84(_0x162d6a[_0x1a9b('0x13')][_0x1a9b('0x12')]);}})[_0x1a9b('0x14')](function(_0x3903b7){logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x3903b7);_0x16e01a(_0x3903b7);});});} \ No newline at end of file +var _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x40acad,_0xb7be7e){var _0x2784ea=function(_0x1f76f3){while(--_0x1f76f3){_0x40acad['push'](_0x40acad['shift']());}};_0x2784ea(++_0xb7be7e);}(_0x0207,0x162));var _0x7020=function(_0x5709c1,_0x4ce07e){_0x5709c1=_0x5709c1-0x0;var _0x3f267f=_0x0207[_0x5709c1];return _0x3f267f;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0799695..205dbe9 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 _0xae1d=['index','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0xae1d,0x80));var _0xdae1=function(_0x165082,_0x207ae8){_0x165082=_0x165082-0x0;var _0x21989b=_0xae1d[_0x165082];return _0x21989b;};'use strict';var multer=require(_0xdae1('0x0'));var util=require(_0xdae1('0x1'));var path=require(_0xdae1('0x2'));var timeout=require(_0xdae1('0x3'));var express=require(_0xdae1('0x4'));var router=express[_0xdae1('0x5')]();var fs_extra=require(_0xdae1('0x6'));var auth=require(_0xdae1('0x7'));var interaction=require(_0xdae1('0x8'));var config=require(_0xdae1('0x9'));var controller=require('./pause.controller');router[_0xdae1('0xa')]('/',auth[_0xdae1('0xb')](),controller[_0xdae1('0xc')]);router[_0xdae1('0xa')]('/:id',auth[_0xdae1('0xb')](),controller[_0xdae1('0xd')]);router['post']('/',auth[_0xdae1('0xb')](),controller[_0xdae1('0xe')]);router[_0xdae1('0xf')](_0xdae1('0x10'),auth[_0xdae1('0xb')](),controller[_0xdae1('0x11')]);router[_0xdae1('0x12')](_0xdae1('0x10'),auth['isAuthenticated'](),controller[_0xdae1('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa235=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x5aeb13,_0x6c8b12){var _0x5ec974=function(_0x542b73){while(--_0x542b73){_0x5aeb13['push'](_0x5aeb13['shift']());}};_0x5ec974(++_0x6c8b12);}(_0xa235,0xab));var _0x5a23=function(_0x208429,_0x3f8848){_0x208429=_0x208429-0x0;var _0x406352=_0xa235[_0x208429];return _0x406352;};'use strict';var multer=require(_0x5a23('0x0'));var util=require('util');var path=require(_0x5a23('0x1'));var timeout=require(_0x5a23('0x2'));var express=require('express');var router=express[_0x5a23('0x3')]();var fs_extra=require(_0x5a23('0x4'));var auth=require(_0x5a23('0x5'));var interaction=require(_0x5a23('0x6'));var config=require(_0x5a23('0x7'));var controller=require(_0x5a23('0x8'));router[_0x5a23('0x9')]('/',auth[_0x5a23('0xa')](),controller[_0x5a23('0xb')]);router['get'](_0x5a23('0xc'),auth[_0x5a23('0xa')](),controller[_0x5a23('0xd')]);router['post']('/',auth[_0x5a23('0xa')](),controller[_0x5a23('0xe')]);router[_0x5a23('0xf')]('/:id',auth[_0x5a23('0xa')](),controller[_0x5a23('0x10')]);router[_0x5a23('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5a23('0x12')]);module[_0x5a23('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index cfb4e55..67689a9 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 _0xf804=['name','exports','STRING'];(function(_0x40913e,_0x1935a7){var _0x13042b=function(_0x5a742e){while(--_0x5a742e){_0x40913e['push'](_0x40913e['shift']());}};_0x13042b(++_0x1935a7);}(_0xf804,0x1c3));var _0x4f80=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf804[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x4f80('0x0')]={'name':{'type':Sequelize[_0x4f80('0x1')],'unique':_0x4f80('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4f80('0x1')]}}; \ No newline at end of file +var _0x78b3=['STRING','name'];(function(_0x1c290d,_0x52f8e2){var _0x3bbfd6=function(_0x5ee0be){while(--_0x5ee0be){_0x1c290d['push'](_0x1c290d['shift']());}};_0x3bbfd6(++_0x52f8e2);}(_0x78b3,0xa0));var _0x378b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x78b3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x378b('0x0')],'unique':_0x378b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x378b('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 53d2cf8..78ed3db 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 _0x508e=['find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x508e,0xab));var _0xe508=function(_0x5e64bf,_0x151e17){_0x5e64bf=_0x5e64bf-0x0;var _0x3e5419=_0x508e[_0x5e64bf];return _0x3e5419;};'use strict';var emlformat=require(_0xe508('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe508('0x1'));var jsonpatch=require(_0xe508('0x2'));var rp=require(_0xe508('0x3'));var moment=require(_0xe508('0x4'));var BPromise=require(_0xe508('0x5'));var Mustache=require(_0xe508('0x6'));var util=require(_0xe508('0x7'));var path=require(_0xe508('0x8'));var sox=require(_0xe508('0x9'));var csv=require(_0xe508('0xa'));var ejs=require(_0xe508('0xb'));var fs=require('fs');var fs_extra=require(_0xe508('0xc'));var _=require(_0xe508('0xd'));var squel=require(_0xe508('0xe'));var crypto=require(_0xe508('0xf'));var jsforce=require(_0xe508('0x10'));var deskjs=require(_0xe508('0x11'));var toCsv=require(_0xe508('0xa'));var querystring=require(_0xe508('0x12'));var Papa=require(_0xe508('0x13'));var Redis=require(_0xe508('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe508('0x15'));var hardwareService=require(_0xe508('0x16'));var logger=require('../../config/logger')(_0xe508('0x17'));var utils=require(_0xe508('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe508('0x19'));var db=require(_0xe508('0x1a'))['db'];function respondWithStatusCode(_0x2df9a9,_0x3b6a30){_0x3b6a30=_0x3b6a30||0xcc;return function(_0x59ffbf){if(_0x59ffbf){return _0x2df9a9['sendStatus'](_0x3b6a30);}return _0x2df9a9[_0xe508('0x1b')](_0x3b6a30)[_0xe508('0x1c')]();};}function respondWithResult(_0x512d42,_0x17a261){_0x17a261=_0x17a261||0xc8;return function(_0x4c7c24){if(_0x4c7c24){return _0x512d42['status'](_0x17a261)[_0xe508('0x1d')](_0x4c7c24);}};}function respondWithFilteredResult(_0x1f9217,_0x4a896c){return function(_0x2007f5){if(_0x2007f5){var _0x106eb6=typeof _0x4a896c['offset']===_0xe508('0x1e')&&typeof _0x4a896c['limit']===_0xe508('0x1e');var _0x188e3e=_0x2007f5[_0xe508('0x1f')];var _0xe457=_0x106eb6?0x0:_0x4a896c[_0xe508('0x20')];var _0x197620=_0x106eb6?_0x2007f5[_0xe508('0x1f')]:_0x4a896c[_0xe508('0x20')]+_0x4a896c[_0xe508('0x21')];var _0x33fff4;if(_0x197620>=_0x188e3e){_0x197620=_0x188e3e;_0x33fff4=0xc8;}else{_0x33fff4=0xce;}_0x1f9217[_0xe508('0x1b')](_0x33fff4);return _0x1f9217[_0xe508('0x22')](_0xe508('0x23'),_0xe457+'-'+_0x197620+'/'+_0x188e3e)[_0xe508('0x1d')](_0x2007f5);}return null;};}function patchUpdates(_0x6fac0e){return function(_0x3892f1){try{jsonpatch[_0xe508('0x24')](_0x3892f1,_0x6fac0e,!![]);}catch(_0x3230d0){return BPromise[_0xe508('0x25')](_0x3230d0);}return _0x3892f1[_0xe508('0x26')]();};}function saveUpdates(_0x189c8d,_0x4bb958){return function(_0x5270bc){if(_0x5270bc){return _0x5270bc['update'](_0x189c8d)[_0xe508('0x27')](function(_0x1801bf){return _0x1801bf;});}return null;};}function removeEntity(_0x4eec11,_0x5f1374){return function(_0x1fffee){if(_0x1fffee){return _0x1fffee[_0xe508('0x28')]()[_0xe508('0x27')](function(){var _0x396a2d=_0x1fffee[_0xe508('0x29')]({'plain':!![]});var _0x41d098='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x41d098,'resourceId':_0x396a2d['id']}})[_0xe508('0x27')](function(){return _0x1fffee;});})[_0xe508('0x27')](function(){_0x4eec11[_0xe508('0x1b')](0xcc)[_0xe508('0x1c')]();});}};}function handleEntityNotFound(_0x2cf9b0,_0x2bd980){return function(_0x1f326d){if(!_0x1f326d){_0x2cf9b0['sendStatus'](0x194);}return _0x1f326d;};}function handleError(_0x4cccfc,_0x501682){_0x501682=_0x501682||0x1f4;return function(_0x4b806){logger['error'](_0x4b806['stack']);if(_0x4b806[_0xe508('0x2a')]){delete _0x4b806[_0xe508('0x2a')];}_0x4cccfc[_0xe508('0x1b')](_0x501682)[_0xe508('0x2b')](_0x4b806);};}exports[_0xe508('0x2c')]=function(_0x76729f,_0x49431d){var _0x5308dc={},_0x163e0a={},_0x252aa9={'count':0x0,'rows':[]};var _0x4559f5=_[_0xe508('0x2d')](db[_0xe508('0x2e')][_0xe508('0x2f')],function(_0x21de0e){return{'name':_0x21de0e[_0xe508('0x30')],'type':_0x21de0e[_0xe508('0x31')][_0xe508('0x32')]};});_0x163e0a[_0xe508('0x33')]=_[_0xe508('0x2d')](_0x4559f5,'name');_0x163e0a[_0xe508('0x34')]=_[_0xe508('0x35')](_0x76729f[_0xe508('0x34')]);_0x163e0a[_0xe508('0x36')]=_[_0xe508('0x37')](_0x163e0a[_0xe508('0x33')],_0x163e0a[_0xe508('0x34')]);_0x5308dc[_0xe508('0x38')]=_[_0xe508('0x37')](_0x163e0a[_0xe508('0x33')],qs['fields'](_0x76729f[_0xe508('0x34')][_0xe508('0x39')]));_0x5308dc['attributes']=_0x5308dc['attributes']['length']?_0x5308dc[_0xe508('0x38')]:_0x163e0a['model'];if(!_0x76729f[_0xe508('0x34')][_0xe508('0x3a')](_0xe508('0x3b'))){_0x5308dc[_0xe508('0x21')]=qs[_0xe508('0x21')](_0x76729f['query'][_0xe508('0x21')]);_0x5308dc[_0xe508('0x20')]=qs[_0xe508('0x20')](_0x76729f['query'][_0xe508('0x20')]);}_0x5308dc['order']=qs[_0xe508('0x3c')](_0x76729f[_0xe508('0x34')][_0xe508('0x3c')]);_0x5308dc['where']=qs[_0xe508('0x36')](_['pick'](_0x76729f[_0xe508('0x34')],_0x163e0a['filters']),_0x4559f5);if(_0x76729f[_0xe508('0x34')][_0xe508('0x3d')]){_0x5308dc['where']=_['merge'](_0x5308dc[_0xe508('0x3e')],{'$or':_[_0xe508('0x2d')](_0x4559f5,function(_0x248923){if(_0x248923[_0xe508('0x31')]!==_0xe508('0x3f')){var _0x148eb0={};_0x148eb0[_0x248923[_0xe508('0x2a')]]={'$like':'%'+_0x76729f[_0xe508('0x34')]['filter']+'%'};return _0x148eb0;}})});}_0x5308dc=_[_0xe508('0x40')]({},_0x5308dc,_0x76729f[_0xe508('0x41')]);var _0x57fd65={'where':_0x5308dc['where']};return db[_0xe508('0x2e')][_0xe508('0x1f')](_0x57fd65)['then'](function(_0x514190){_0x252aa9[_0xe508('0x1f')]=_0x514190;if(_0x76729f[_0xe508('0x34')][_0xe508('0x42')]){_0x5308dc[_0xe508('0x43')]=[{'all':!![]}];}return db['Pause'][_0xe508('0x44')](_0x5308dc);})[_0xe508('0x27')](function(_0x218c26){_0x252aa9['rows']=_0x218c26;return _0x252aa9;})[_0xe508('0x27')](respondWithFilteredResult(_0x49431d,_0x5308dc))[_0xe508('0x45')](handleError(_0x49431d,null));};exports[_0xe508('0x46')]=function(_0x109284,_0x27cf87){var _0x3ea995={'raw':!![],'where':{'id':_0x109284[_0xe508('0x47')]['id']}},_0xa7c2a={};_0xa7c2a[_0xe508('0x33')]=_[_0xe508('0x35')](db[_0xe508('0x2e')][_0xe508('0x2f')]);_0xa7c2a[_0xe508('0x34')]=_[_0xe508('0x35')](_0x109284[_0xe508('0x34')]);_0xa7c2a['filters']=_[_0xe508('0x37')](_0xa7c2a[_0xe508('0x33')],_0xa7c2a[_0xe508('0x34')]);_0x3ea995[_0xe508('0x38')]=_[_0xe508('0x37')](_0xa7c2a[_0xe508('0x33')],qs[_0xe508('0x39')](_0x109284[_0xe508('0x34')][_0xe508('0x39')]));_0x3ea995['attributes']=_0x3ea995[_0xe508('0x38')]['length']?_0x3ea995['attributes']:_0xa7c2a[_0xe508('0x33')];if(_0x109284['query'][_0xe508('0x42')]){_0x3ea995[_0xe508('0x43')]=[{'all':!![]}];}_0x3ea995=_[_0xe508('0x40')]({},_0x3ea995,_0x109284[_0xe508('0x41')]);return db['Pause']['find'](_0x3ea995)[_0xe508('0x27')](handleEntityNotFound(_0x27cf87,null))[_0xe508('0x27')](respondWithResult(_0x27cf87,null))[_0xe508('0x45')](handleError(_0x27cf87,null));};exports[_0xe508('0x48')]=function(_0x2e36fe,_0x54d3f6){return db['Pause'][_0xe508('0x48')](_0x2e36fe[_0xe508('0x49')],{})[_0xe508('0x27')](function(_0x18014c){var _0x4e79d3=_0x2e36fe[_0xe508('0x4a')][_0xe508('0x29')]({'plain':!![]});if(!_0x4e79d3)throw new Error(_0xe508('0x4b'));if(_0x4e79d3['role']==='user'){var _0x6bb0ae=_0x18014c[_0xe508('0x29')]({'plain':!![]});var _0x10e8dd=_0xe508('0x4c');return db[_0xe508('0x4d')][_0xe508('0x4e')]({'where':{'name':_0x10e8dd,'userProfileId':_0x4e79d3[_0xe508('0x4f')]},'raw':!![]})['then'](function(_0x34c90a){if(_0x34c90a&&_0x34c90a['autoAssociation']===0x0){return db[_0xe508('0x50')][_0xe508('0x48')]({'name':_0x6bb0ae[_0xe508('0x2a')],'resourceId':_0x6bb0ae['id'],'type':_0x34c90a[_0xe508('0x2a')],'sectionId':_0x34c90a['id']},{})['then'](function(){return _0x18014c;});}else{return _0x18014c;}})[_0xe508('0x45')](function(_0x2de7c2){logger['error'](_0xe508('0x51'),_0x2de7c2);throw _0x2de7c2;});}return _0x18014c;})[_0xe508('0x27')](respondWithResult(_0x54d3f6,0xc9))[_0xe508('0x45')](handleError(_0x54d3f6,null));};exports[_0xe508('0x52')]=function(_0x1e529e,_0x485071){if(_0x1e529e[_0xe508('0x49')]['id']){delete _0x1e529e['body']['id'];}return db['Pause']['find']({'where':{'id':_0x1e529e['params']['id']}})[_0xe508('0x27')](handleEntityNotFound(_0x485071,null))[_0xe508('0x27')](saveUpdates(_0x1e529e[_0xe508('0x49')],null))[_0xe508('0x27')](respondWithResult(_0x485071,null))[_0xe508('0x45')](handleError(_0x485071,null));};exports['destroy']=function(_0x2ce051,_0x18c187){return db[_0xe508('0x2e')][_0xe508('0x4e')]({'where':{'id':_0x2ce051[_0xe508('0x47')]['id']}})[_0xe508('0x27')](handleEntityNotFound(_0x18c187,null))[_0xe508('0x27')](removeEntity(_0x18c187,null))[_0xe508('0x45')](handleError(_0x18c187,null));}; \ No newline at end of file +var _0xbb93=['merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','user','role','get','Pauses','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','UserProfileResource','end','name','send','index','map','Pause','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x455294,_0x49563f){var _0x385d14=function(_0x330313){while(--_0x330313){_0x455294['push'](_0x455294['shift']());}};_0x385d14(++_0x49563f);}(_0xbb93,0x1b7));var _0x3bb9=function(_0x55a5e1,_0x161a67){_0x55a5e1=_0x55a5e1-0x0;var _0x3bd267=_0xbb93[_0x55a5e1];return _0x3bd267;};'use strict';var emlformat=require(_0x3bb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bb9('0x1'));var jsonpatch=require(_0x3bb9('0x2'));var rp=require(_0x3bb9('0x3'));var moment=require('moment');var BPromise=require(_0x3bb9('0x4'));var Mustache=require(_0x3bb9('0x5'));var util=require('util');var path=require(_0x3bb9('0x6'));var sox=require(_0x3bb9('0x7'));var csv=require(_0x3bb9('0x8'));var ejs=require(_0x3bb9('0x9'));var fs=require('fs');var fs_extra=require(_0x3bb9('0xa'));var _=require(_0x3bb9('0xb'));var squel=require(_0x3bb9('0xc'));var crypto=require('crypto');var jsforce=require(_0x3bb9('0xd'));var deskjs=require(_0x3bb9('0xe'));var toCsv=require(_0x3bb9('0x8'));var querystring=require(_0x3bb9('0xf'));var Papa=require(_0x3bb9('0x10'));var Redis=require(_0x3bb9('0x11'));var authService=require(_0x3bb9('0x12'));var qs=require(_0x3bb9('0x13'));var as=require(_0x3bb9('0x14'));var hardwareService=require(_0x3bb9('0x15'));var logger=require(_0x3bb9('0x16'))('api');var utils=require(_0x3bb9('0x17'));var config=require(_0x3bb9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb9('0x19'))['db'];function respondWithStatusCode(_0x1a4865,_0x3f325f){_0x3f325f=_0x3f325f||0xcc;return function(_0x430b3d){if(_0x430b3d){return _0x1a4865[_0x3bb9('0x1a')](_0x3f325f);}return _0x1a4865[_0x3bb9('0x1b')](_0x3f325f)['end']();};}function respondWithResult(_0x1626ac,_0x524da4){_0x524da4=_0x524da4||0xc8;return function(_0xf1f9fc){if(_0xf1f9fc){return _0x1626ac[_0x3bb9('0x1b')](_0x524da4)[_0x3bb9('0x1c')](_0xf1f9fc);}};}function respondWithFilteredResult(_0x2d9683,_0x2fcbde){return function(_0x4c82ca){if(_0x4c82ca){var _0x1cdb6c=typeof _0x2fcbde['offset']===_0x3bb9('0x1d')&&typeof _0x2fcbde[_0x3bb9('0x1e')]==='undefined';var _0x30c2e7=_0x4c82ca[_0x3bb9('0x1f')];var _0xc804dc=_0x1cdb6c?0x0:_0x2fcbde['offset'];var _0x278d32=_0x1cdb6c?_0x4c82ca[_0x3bb9('0x1f')]:_0x2fcbde[_0x3bb9('0x20')]+_0x2fcbde[_0x3bb9('0x1e')];var _0x45a34e;if(_0x278d32>=_0x30c2e7){_0x278d32=_0x30c2e7;_0x45a34e=0xc8;}else{_0x45a34e=0xce;}_0x2d9683[_0x3bb9('0x1b')](_0x45a34e);return _0x2d9683['set'](_0x3bb9('0x21'),_0xc804dc+'-'+_0x278d32+'/'+_0x30c2e7)[_0x3bb9('0x1c')](_0x4c82ca);}return null;};}function patchUpdates(_0x5b6723){return function(_0x48b391){try{jsonpatch[_0x3bb9('0x22')](_0x48b391,_0x5b6723,!![]);}catch(_0x1815fa){return BPromise[_0x3bb9('0x23')](_0x1815fa);}return _0x48b391['save']();};}function saveUpdates(_0x7e850f,_0x2a597f){return function(_0x5827b0){if(_0x5827b0){return _0x5827b0['update'](_0x7e850f)[_0x3bb9('0x24')](function(_0x1980ee){return _0x1980ee;});}return null;};}function removeEntity(_0x57167a,_0x2abd3e){return function(_0x596d71){if(_0x596d71){return _0x596d71[_0x3bb9('0x25')]()[_0x3bb9('0x24')](function(){var _0x325cc2=_0x596d71['get']({'plain':!![]});var _0x116306='Pauses';return db[_0x3bb9('0x26')][_0x3bb9('0x25')]({'where':{'type':_0x116306,'resourceId':_0x325cc2['id']}})[_0x3bb9('0x24')](function(){return _0x596d71;});})[_0x3bb9('0x24')](function(){_0x57167a[_0x3bb9('0x1b')](0xcc)[_0x3bb9('0x27')]();});}};}function handleEntityNotFound(_0x26d56c,_0x8e9489){return function(_0x47ae0c){if(!_0x47ae0c){_0x26d56c['sendStatus'](0x194);}return _0x47ae0c;};}function handleError(_0x1840be,_0x28fb23){_0x28fb23=_0x28fb23||0x1f4;return function(_0x50e56d){logger['error'](_0x50e56d['stack']);if(_0x50e56d[_0x3bb9('0x28')]){delete _0x50e56d[_0x3bb9('0x28')];}_0x1840be[_0x3bb9('0x1b')](_0x28fb23)[_0x3bb9('0x29')](_0x50e56d);};}exports[_0x3bb9('0x2a')]=function(_0x496616,_0x1210ba){var _0x4e6e54={},_0x4aeab0={},_0x5e16af={'count':0x0,'rows':[]};var _0x3bca59=_[_0x3bb9('0x2b')](db[_0x3bb9('0x2c')][_0x3bb9('0x2d')],function(_0x178a0d){return{'name':_0x178a0d[_0x3bb9('0x2e')],'type':_0x178a0d['type'][_0x3bb9('0x2f')]};});_0x4aeab0['model']=_[_0x3bb9('0x2b')](_0x3bca59,_0x3bb9('0x28'));_0x4aeab0[_0x3bb9('0x30')]=_['keys'](_0x496616[_0x3bb9('0x30')]);_0x4aeab0[_0x3bb9('0x31')]=_[_0x3bb9('0x32')](_0x4aeab0[_0x3bb9('0x33')],_0x4aeab0[_0x3bb9('0x30')]);_0x4e6e54['attributes']=_[_0x3bb9('0x32')](_0x4aeab0[_0x3bb9('0x33')],qs['fields'](_0x496616[_0x3bb9('0x30')][_0x3bb9('0x34')]));_0x4e6e54[_0x3bb9('0x35')]=_0x4e6e54[_0x3bb9('0x35')][_0x3bb9('0x36')]?_0x4e6e54[_0x3bb9('0x35')]:_0x4aeab0[_0x3bb9('0x33')];if(!_0x496616[_0x3bb9('0x30')][_0x3bb9('0x37')]('nolimit')){_0x4e6e54['limit']=qs['limit'](_0x496616[_0x3bb9('0x30')][_0x3bb9('0x1e')]);_0x4e6e54[_0x3bb9('0x20')]=qs[_0x3bb9('0x20')](_0x496616['query'][_0x3bb9('0x20')]);}_0x4e6e54[_0x3bb9('0x38')]=qs[_0x3bb9('0x39')](_0x496616[_0x3bb9('0x30')][_0x3bb9('0x39')]);_0x4e6e54[_0x3bb9('0x3a')]=qs[_0x3bb9('0x31')](_['pick'](_0x496616[_0x3bb9('0x30')],_0x4aeab0['filters']),_0x3bca59);if(_0x496616[_0x3bb9('0x30')]['filter']){_0x4e6e54[_0x3bb9('0x3a')]=_[_0x3bb9('0x3b')](_0x4e6e54['where'],{'$or':_[_0x3bb9('0x2b')](_0x3bca59,function(_0x25cc71){if(_0x25cc71[_0x3bb9('0x3c')]!==_0x3bb9('0x3d')){var _0x20015f={};_0x20015f[_0x25cc71[_0x3bb9('0x28')]]={'$like':'%'+_0x496616[_0x3bb9('0x30')]['filter']+'%'};return _0x20015f;}})});}_0x4e6e54=_[_0x3bb9('0x3b')]({},_0x4e6e54,_0x496616[_0x3bb9('0x3e')]);var _0x2e3b2f={'where':_0x4e6e54['where']};return db[_0x3bb9('0x2c')][_0x3bb9('0x1f')](_0x2e3b2f)[_0x3bb9('0x24')](function(_0x4f4a04){_0x5e16af[_0x3bb9('0x1f')]=_0x4f4a04;if(_0x496616[_0x3bb9('0x30')][_0x3bb9('0x3f')]){_0x4e6e54[_0x3bb9('0x40')]=[{'all':!![]}];}return db[_0x3bb9('0x2c')][_0x3bb9('0x41')](_0x4e6e54);})[_0x3bb9('0x24')](function(_0x222e0d){_0x5e16af['rows']=_0x222e0d;return _0x5e16af;})[_0x3bb9('0x24')](respondWithFilteredResult(_0x1210ba,_0x4e6e54))['catch'](handleError(_0x1210ba,null));};exports[_0x3bb9('0x42')]=function(_0x5820dc,_0xf89187){var _0x28faa1={'raw':!![],'where':{'id':_0x5820dc[_0x3bb9('0x43')]['id']}},_0x5c0434={};_0x5c0434['model']=_[_0x3bb9('0x44')](db[_0x3bb9('0x2c')][_0x3bb9('0x2d')]);_0x5c0434['query']=_['keys'](_0x5820dc[_0x3bb9('0x30')]);_0x5c0434['filters']=_['intersection'](_0x5c0434[_0x3bb9('0x33')],_0x5c0434[_0x3bb9('0x30')]);_0x28faa1[_0x3bb9('0x35')]=_['intersection'](_0x5c0434[_0x3bb9('0x33')],qs[_0x3bb9('0x34')](_0x5820dc['query'][_0x3bb9('0x34')]));_0x28faa1[_0x3bb9('0x35')]=_0x28faa1[_0x3bb9('0x35')][_0x3bb9('0x36')]?_0x28faa1[_0x3bb9('0x35')]:_0x5c0434[_0x3bb9('0x33')];if(_0x5820dc[_0x3bb9('0x30')]['includeAll']){_0x28faa1['include']=[{'all':!![]}];}_0x28faa1=_[_0x3bb9('0x3b')]({},_0x28faa1,_0x5820dc[_0x3bb9('0x3e')]);return db['Pause'][_0x3bb9('0x45')](_0x28faa1)[_0x3bb9('0x24')](handleEntityNotFound(_0xf89187,null))[_0x3bb9('0x24')](respondWithResult(_0xf89187,null))[_0x3bb9('0x46')](handleError(_0xf89187,null));};exports[_0x3bb9('0x47')]=function(_0x4485ce,_0x9b4e1){return db[_0x3bb9('0x2c')][_0x3bb9('0x47')](_0x4485ce['body'],{})['then'](function(_0x2eb3e6){var _0x4534e8=_0x4485ce[_0x3bb9('0x48')]['get']({'plain':!![]});if(!_0x4534e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4534e8[_0x3bb9('0x49')]===_0x3bb9('0x48')){var _0x3303bb=_0x2eb3e6[_0x3bb9('0x4a')]({'plain':!![]});var _0x37c601=_0x3bb9('0x4b');return db[_0x3bb9('0x4c')]['find']({'where':{'name':_0x37c601,'userProfileId':_0x4534e8[_0x3bb9('0x4d')]},'raw':!![]})[_0x3bb9('0x24')](function(_0x2a9f7a){if(_0x2a9f7a&&_0x2a9f7a[_0x3bb9('0x4e')]===0x0){return db[_0x3bb9('0x26')][_0x3bb9('0x47')]({'name':_0x3303bb[_0x3bb9('0x28')],'resourceId':_0x3303bb['id'],'type':_0x2a9f7a[_0x3bb9('0x28')],'sectionId':_0x2a9f7a['id']},{})[_0x3bb9('0x24')](function(){return _0x2eb3e6;});}else{return _0x2eb3e6;}})['catch'](function(_0x10c8df){logger[_0x3bb9('0x4f')](_0x3bb9('0x50'),_0x10c8df);throw _0x10c8df;});}return _0x2eb3e6;})['then'](respondWithResult(_0x9b4e1,0xc9))[_0x3bb9('0x46')](handleError(_0x9b4e1,null));};exports[_0x3bb9('0x51')]=function(_0xe91869,_0x2fdd3e){if(_0xe91869[_0x3bb9('0x52')]['id']){delete _0xe91869[_0x3bb9('0x52')]['id'];}return db[_0x3bb9('0x2c')][_0x3bb9('0x45')]({'where':{'id':_0xe91869[_0x3bb9('0x43')]['id']}})[_0x3bb9('0x24')](handleEntityNotFound(_0x2fdd3e,null))[_0x3bb9('0x24')](saveUpdates(_0xe91869[_0x3bb9('0x52')],null))[_0x3bb9('0x24')](respondWithResult(_0x2fdd3e,null))[_0x3bb9('0x46')](handleError(_0x2fdd3e,null));};exports[_0x3bb9('0x25')]=function(_0x548c7a,_0x5cbe19){return db[_0x3bb9('0x2c')]['find']({'where':{'id':_0x548c7a[_0x3bb9('0x43')]['id']}})[_0x3bb9('0x24')](handleEntityNotFound(_0x5cbe19,null))[_0x3bb9('0x24')](removeEntity(_0x5cbe19,null))[_0x3bb9('0x46')](handleError(_0x5cbe19,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5ff3fc5..3e1f14a 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x6270f7,_0x3e1d17){var _0x597003=function(_0x549ea8){while(--_0x549ea8){_0x6270f7['push'](_0x6270f7['shift']());}};_0x597003(++_0x3e1d17);}(_0xabce,0x103));var _0xeabc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xabce[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1f150c1..36a13bd 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x23b960,_0x3fedb1){var _0x38d635=function(_0x26c82d){while(--_0x26c82d){_0x23b960['push'](_0x23b960['shift']());}};_0x38d635(++_0x3fedb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0xb10b[_0x8ec6b4];return _0x52c0d0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1babed,_0x5440fb){var _0x145b32=function(_0x2ec77b){while(--_0x2ec77b){_0x1babed['push'](_0x1babed['shift']());}};_0x145b32(++_0x5440fb);}(_0x7a54,0x106));var _0x47a5=function(_0x12350b,_0x24911a){_0x12350b=_0x12350b-0x0;var _0x13c8e4=_0x7a54[_0x12350b];return _0x13c8e4;};'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 6146bc5..914ea0c 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 _0xe107=['get','/webhook','webhookGet','show','isAuthenticated','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./plugin.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe107,0xb3));var _0x7e10=function(_0x523a81,_0x537812){_0x523a81=_0x523a81-0x0;var _0x2f5e13=_0xe107[_0x523a81];return _0x2f5e13;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),controller[_0x7e10('0x9')]);router[_0x7e10('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e10('0xa')]);router['get']('/:id/download',auth[_0x7e10('0xb')](),controller[_0x7e10('0xc')]);var upload=multer({'storage':multer[_0x7e10('0xd')]({'destination':function(_0x2bd58a,_0x256cb1,_0x52ba74){_0x52ba74(null,path[_0x7e10('0xe')](config['root'],_0x7e10('0xf')));},'filename':function(_0x2ca84c,_0x2f4d72,_0x5434dd){_0x2f4d72[_0x7e10('0x10')]=_0x2f4d72[_0x7e10('0x10')][_0x7e10('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5434dd(null,util[_0x7e10('0x12')](_0x7e10('0x13'),path[_0x7e10('0x14')](_0x2f4d72[_0x7e10('0x10')],path[_0x7e10('0x15')](_0x2f4d72['originalname'])),Date[_0x7e10('0x16')](),path[_0x7e10('0x15')](_0x2f4d72['originalname'])));}})});router['post']('/',upload[_0x7e10('0x17')]('file'),controller[_0x7e10('0x18')]);router[_0x7e10('0x19')](_0x7e10('0x8'),controller[_0x7e10('0x1a')]);router['put'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1c')]);router['delete'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1d')]);module[_0x7e10('0x1e')]=router; \ No newline at end of file +var _0x0b78=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports'];(function(_0x889916,_0x2b08d7){var _0x5b734e=function(_0x50728d){while(--_0x50728d){_0x889916['push'](_0x889916['shift']());}};_0x5b734e(++_0x2b08d7);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')](_0x80b7('0xc'),auth['isAuthenticated'](),controller[_0x80b7('0xd')]);router[_0x80b7('0xb')](_0x80b7('0xe'),auth['isAuthenticated'](),controller[_0x80b7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1a00,_0x4599c1,_0x3b19da){_0x3b19da(null,path[_0x80b7('0x10')](config[_0x80b7('0x11')],_0x80b7('0x12')));},'filename':function(_0x3f8c16,_0x145241,_0x323d06){_0x145241[_0x80b7('0x13')]=_0x145241[_0x80b7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d06(null,util[_0x80b7('0x14')](_0x80b7('0x15'),path['basename'](_0x145241[_0x80b7('0x13')],path[_0x80b7('0x16')](_0x145241['originalname'])),Date[_0x80b7('0x17')](),path[_0x80b7('0x16')](_0x145241[_0x80b7('0x13')])));}})});router[_0x80b7('0x18')]('/',upload[_0x80b7('0x19')](_0x80b7('0x1a')),controller[_0x80b7('0x1b')]);router[_0x80b7('0x18')](_0x80b7('0x9'),controller[_0x80b7('0x1c')]);router['put'](_0x80b7('0xc'),auth[_0x80b7('0x1d')](),controller[_0x80b7('0x1e')]);router[_0x80b7('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x80b7('0x1f')]);module[_0x80b7('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 fb2faf8..31204f3 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 _0x8133=['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.','adminOnly','agentOnly','always','never','sequelize','exports'];(function(_0x1157d3,_0x153f19){var _0x220a6a=function(_0x299e6b){while(--_0x299e6b){_0x1157d3['push'](_0x1157d3['shift']());}};_0x220a6a(++_0x153f19);}(_0x8133,0x1b0));var _0x3813=function(_0x16a25a,_0x337688){_0x16a25a=_0x16a25a-0x0;var _0x2db8c4=_0x8133[_0x16a25a];return _0x2db8c4;};'use strict';var Sequelize=require(_0x3813('0x0'));module[_0x3813('0x1')]={'name':{'type':Sequelize[_0x3813('0x2')]},'type':{'type':Sequelize[_0x3813('0x3')](_0x3813('0x4'),_0x3813('0x5'))},'description':{'type':Sequelize[_0x3813('0x6')]},'version':{'type':Sequelize[_0x3813('0x6')]},'path':{'type':Sequelize[_0x3813('0x2')],'comment':_0x3813('0x7')},'active':{'type':Sequelize[_0x3813('0x8')],'defaultValue':0x0,'comment':_0x3813('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x3813('0xa'),_0x3813('0xb'),_0x3813('0xc'),_0x3813('0xd')),'defaultValue':_0x3813('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x3813('0x2')]},'adminUrl':{'type':Sequelize[_0x3813('0x2')]},'agentUrl':{'type':Sequelize[_0x3813('0x2')]},'scriptName':{'type':Sequelize[_0x3813('0x2')]},'scriptPath':{'type':Sequelize[_0x3813('0x2')]}}; \ No newline at end of file +var _0xf0a6=['ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x6fde07,_0x7586ea){var _0x543c16=function(_0x5c9c27){while(--_0x5c9c27){_0x6fde07['push'](_0x6fde07['shift']());}};_0x543c16(++_0x7586ea);}(_0xf0a6,0xa1));var _0x6f0a=function(_0x2e6f36,_0x2ca045){_0x2e6f36=_0x2e6f36-0x0;var _0x1d019a=_0xf0a6[_0x2e6f36];return _0x1d019a;};'use strict';var Sequelize=require(_0x6f0a('0x0'));module[_0x6f0a('0x1')]={'name':{'type':Sequelize[_0x6f0a('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6f0a('0x3'),_0x6f0a('0x4'))},'description':{'type':Sequelize[_0x6f0a('0x5')]},'version':{'type':Sequelize[_0x6f0a('0x5')]},'path':{'type':Sequelize[_0x6f0a('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x6f0a('0x6')],'defaultValue':0x0,'comment':_0x6f0a('0x7')},'sidebar':{'type':Sequelize[_0x6f0a('0x8')](_0x6f0a('0x9'),_0x6f0a('0xa'),_0x6f0a('0xb'),'never'),'defaultValue':_0x6f0a('0xb'),'comment':_0x6f0a('0xc')},'icon':{'type':Sequelize[_0x6f0a('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x6f0a('0x2')]},'scriptName':{'type':Sequelize[_0x6f0a('0x2')]},'scriptPath':{'type':Sequelize[_0x6f0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a33db0b..6fc8048 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 _0x53cf=['format','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','%s%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','Plugin','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','download','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','server/files/plugins','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','html','admin','test','plugins','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding'];(function(_0x389fb5,_0x2d34e1){var _0x37731a=function(_0x23bfde){while(--_0x23bfde){_0x389fb5['push'](_0x389fb5['shift']());}};_0x37731a(++_0x2d34e1);}(_0x53cf,0x167));var _0xf53c=function(_0x5985b8,_0x3aa9b7){_0x5985b8=_0x5985b8-0x0;var _0x19c894=_0x53cf[_0x5985b8];return _0x19c894;};'use strict';var emlformat=require(_0xf53c('0x0'));var rimraf=require(_0xf53c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf53c('0x2'));var moment=require(_0xf53c('0x3'));var BPromise=require(_0xf53c('0x4'));var Mustache=require(_0xf53c('0x5'));var util=require(_0xf53c('0x6'));var path=require(_0xf53c('0x7'));var sox=require(_0xf53c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf53c('0x9'));var _=require(_0xf53c('0xa'));var squel=require('squel');var crypto=require(_0xf53c('0xb'));var jsforce=require(_0xf53c('0xc'));var deskjs=require(_0xf53c('0xd'));var toCsv=require(_0xf53c('0xe'));var querystring=require(_0xf53c('0xf'));var Papa=require(_0xf53c('0x10'));var extract=require(_0xf53c('0x11'));var rimraf=require(_0xf53c('0x1'));var archiver=require(_0xf53c('0x12'));var Redis=require(_0xf53c('0x13'));var authService=require(_0xf53c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf53c('0x15'));var hardwareService=require(_0xf53c('0x16'));var logger=require(_0xf53c('0x17'))(_0xf53c('0x18'));var utils=require(_0xf53c('0x19'));var config=require(_0xf53c('0x1a'));var licenseUtil=require(_0xf53c('0x1b'));var db=require('../../mysqldb')['db'];config[_0xf53c('0x1c')]=_[_0xf53c('0x1d')](config[_0xf53c('0x1c')],{'host':_0xf53c('0x1e'),'port':0x18eb});var socket=require(_0xf53c('0x1f'))(new Redis(config[_0xf53c('0x1c')]));require(_0xf53c('0x20'))[_0xf53c('0x21')](socket);function respondWithStatusCode(_0x2028d1,_0x318868){_0x318868=_0x318868||0xcc;return function(_0x3065db){if(_0x3065db){return _0x2028d1[_0xf53c('0x22')](_0x318868);}return _0x2028d1[_0xf53c('0x23')](_0x318868)['end']();};}function respondWithResult(_0x1927d7,_0x35d221){_0x35d221=_0x35d221||0xc8;return function(_0xc0e742){if(_0xc0e742){return _0x1927d7[_0xf53c('0x23')](_0x35d221)[_0xf53c('0x24')](_0xc0e742);}};}function respondWithFilteredResult(_0x1738cc,_0x9c0f50){return function(_0x9af0ed){if(_0x9af0ed){var _0x24349d=typeof _0x9c0f50[_0xf53c('0x25')]===_0xf53c('0x26')&&typeof _0x9c0f50['limit']===_0xf53c('0x26');var _0x2fba42=_0x9af0ed[_0xf53c('0x27')];var _0x32a007=_0x24349d?0x0:_0x9c0f50['offset'];var _0x4043a4=_0x24349d?_0x9af0ed['count']:_0x9c0f50['offset']+_0x9c0f50[_0xf53c('0x28')];var _0x5a4947;if(_0x4043a4>=_0x2fba42){_0x4043a4=_0x2fba42;_0x5a4947=0xc8;}else{_0x5a4947=0xce;}_0x1738cc[_0xf53c('0x23')](_0x5a4947);return _0x1738cc['set'](_0xf53c('0x29'),_0x32a007+'-'+_0x4043a4+'/'+_0x2fba42)['json'](_0x9af0ed);}return null;};}function patchUpdates(_0x5d3edc){return function(_0x3e3976){try{jsonpatch[_0xf53c('0x2a')](_0x3e3976,_0x5d3edc,!![]);}catch(_0x3a01ff){return BPromise[_0xf53c('0x2b')](_0x3a01ff);}return _0x3e3976[_0xf53c('0x2c')]();};}function saveUpdates(_0x2b447a,_0x5bdf8b){return function(_0x311683){if(_0x311683){return _0x311683[_0xf53c('0x2d')](_0x2b447a)[_0xf53c('0x2e')](function(_0x41829b){return _0x41829b;});}return null;};}function removeEntity(_0x2b7543,_0x3f97dd){return function(_0xa7b0a7){if(_0xa7b0a7){return _0xa7b0a7[_0xf53c('0x2f')]()[_0xf53c('0x2e')](function(){var _0x2a8acb=_0xa7b0a7[_0xf53c('0x30')]({'plain':!![]});var _0x2e2078=_0xf53c('0x31');return db[_0xf53c('0x32')][_0xf53c('0x2f')]({'where':{'type':_0x2e2078,'resourceId':_0x2a8acb['id']}})['then'](function(){return _0xa7b0a7;});})['then'](function(){_0x2b7543[_0xf53c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589ac7,_0x5cd3e8){return function(_0x226fa4){if(!_0x226fa4){_0x589ac7[_0xf53c('0x22')](0x194);}return _0x226fa4;};}function handleError(_0x260da1,_0xe06fe8){_0xe06fe8=_0xe06fe8||0x1f4;return function(_0x4fe563){logger[_0xf53c('0x33')](_0x4fe563[_0xf53c('0x34')]);if(_0x4fe563[_0xf53c('0x35')]){delete _0x4fe563[_0xf53c('0x35')];}_0x260da1[_0xf53c('0x23')](_0xe06fe8)[_0xf53c('0x36')](_0x4fe563);};}exports['index']=function(_0x571fb0,_0x2f42f1){var _0x240a73={},_0x3ae5a9={},_0xb02a71={'count':0x0,'rows':[]};var _0x6dc7c5=_['map'](db[_0xf53c('0x37')][_0xf53c('0x38')],function(_0x427c88){return{'name':_0x427c88[_0xf53c('0x39')],'type':_0x427c88[_0xf53c('0x3a')]['key']};});_0x3ae5a9[_0xf53c('0x3b')]=_[_0xf53c('0x3c')](_0x6dc7c5,'name');_0x3ae5a9[_0xf53c('0x3d')]=_[_0xf53c('0x3e')](_0x571fb0[_0xf53c('0x3d')]);_0x3ae5a9['filters']=_['intersection'](_0x3ae5a9[_0xf53c('0x3b')],_0x3ae5a9[_0xf53c('0x3d')]);_0x240a73[_0xf53c('0x3f')]=_['intersection'](_0x3ae5a9[_0xf53c('0x3b')],qs[_0xf53c('0x40')](_0x571fb0['query'][_0xf53c('0x40')]));_0x240a73[_0xf53c('0x3f')]=_0x240a73['attributes']['length']?_0x240a73[_0xf53c('0x3f')]:_0x3ae5a9[_0xf53c('0x3b')];if(!_0x571fb0[_0xf53c('0x3d')][_0xf53c('0x41')]('nolimit')){_0x240a73[_0xf53c('0x28')]=qs[_0xf53c('0x28')](_0x571fb0['query'][_0xf53c('0x28')]);_0x240a73[_0xf53c('0x25')]=qs['offset'](_0x571fb0[_0xf53c('0x3d')][_0xf53c('0x25')]);}_0x240a73[_0xf53c('0x42')]=qs[_0xf53c('0x43')](_0x571fb0[_0xf53c('0x3d')][_0xf53c('0x43')]);_0x240a73[_0xf53c('0x44')]=qs[_0xf53c('0x45')](_[_0xf53c('0x46')](_0x571fb0[_0xf53c('0x3d')],_0x3ae5a9[_0xf53c('0x45')]),_0x6dc7c5);if(_0x571fb0[_0xf53c('0x3d')][_0xf53c('0x47')]){_0x240a73[_0xf53c('0x44')]=_['merge'](_0x240a73[_0xf53c('0x44')],{'$or':_[_0xf53c('0x3c')](_0x6dc7c5,function(_0x1ce976){if(_0x1ce976[_0xf53c('0x3a')]!==_0xf53c('0x48')){var _0x2a1c1f={};_0x2a1c1f[_0x1ce976['name']]={'$like':'%'+_0x571fb0['query']['filter']+'%'};return _0x2a1c1f;}})});}_0x240a73=_[_0xf53c('0x49')]({},_0x240a73,_0x571fb0[_0xf53c('0x4a')]);var _0x5ec8de={'where':_0x240a73['where']};return db['Plugin'][_0xf53c('0x27')](_0x5ec8de)[_0xf53c('0x2e')](function(_0x4d2235){_0xb02a71[_0xf53c('0x27')]=_0x4d2235;if(_0x571fb0[_0xf53c('0x3d')][_0xf53c('0x4b')]){_0x240a73['include']=[{'all':!![]}];}return db[_0xf53c('0x37')][_0xf53c('0x4c')](_0x240a73);})[_0xf53c('0x2e')](function(_0x3ce02f){_0xb02a71[_0xf53c('0x4d')]=_0x3ce02f;return _0xb02a71;})[_0xf53c('0x2e')](respondWithFilteredResult(_0x2f42f1,_0x240a73))[_0xf53c('0x4e')](handleError(_0x2f42f1,null));};exports[_0xf53c('0x4f')]=function(_0x554e6b,_0x503e42){var _0x37c680={'raw':!![],'where':{'id':_0x554e6b[_0xf53c('0x50')]['id']}},_0x570414={};_0x570414[_0xf53c('0x3b')]=_['keys'](db[_0xf53c('0x37')][_0xf53c('0x38')]);_0x570414[_0xf53c('0x3d')]=_[_0xf53c('0x3e')](_0x554e6b['query']);_0x570414['filters']=_[_0xf53c('0x51')](_0x570414[_0xf53c('0x3b')],_0x570414[_0xf53c('0x3d')]);_0x37c680[_0xf53c('0x3f')]=_['intersection'](_0x570414[_0xf53c('0x3b')],qs['fields'](_0x554e6b[_0xf53c('0x3d')][_0xf53c('0x40')]));_0x37c680[_0xf53c('0x3f')]=_0x37c680[_0xf53c('0x3f')][_0xf53c('0x52')]?_0x37c680['attributes']:_0x570414[_0xf53c('0x3b')];if(_0x554e6b[_0xf53c('0x3d')][_0xf53c('0x4b')]){_0x37c680[_0xf53c('0x53')]=[{'all':!![]}];}_0x37c680=_[_0xf53c('0x49')]({},_0x37c680,_0x554e6b['options']);return db[_0xf53c('0x37')][_0xf53c('0x54')](_0x37c680)[_0xf53c('0x2e')](handleEntityNotFound(_0x503e42,null))['then'](respondWithResult(_0x503e42,null))[_0xf53c('0x4e')](handleError(_0x503e42,null));};exports[_0xf53c('0x55')]=function(_0x12dd33,_0xd5f343,_0x2af73a){return db[_0xf53c('0x37')]['find']({'where':{'id':_0x12dd33[_0xf53c('0x50')]['id']},'attributes':[_0xf53c('0x35'),_0xf53c('0x7')],'raw':!![]})[_0xf53c('0x2e')](handleEntityNotFound(_0xd5f343,null))['then'](function(_0x3f43c9){if(_0x3f43c9){var _0x26144f=path['join'](config['root'],'server/files/plugins',util['format'](_0xf53c('0x56'),path[_0xf53c('0x57')](_0x3f43c9[_0xf53c('0x7')])));var _0x3a71df=fs[_0xf53c('0x58')](_0x26144f);var _0x1caf3a=archiver('zip',{'zlib':{'level':0x9}});_0x1caf3a['on']('warning',function(_0x458196){if(_0x458196[_0xf53c('0x59')]===_0xf53c('0x5a')){logger[_0xf53c('0x33')](_0x458196);}else{throw new db[(_0xf53c('0x5b'))][(_0xf53c('0x5c'))](_0xf53c('0x5d'));}});_0x1caf3a['on'](_0xf53c('0x33'),function(_0x12f4a6){throw new db['Sequelize'][(_0xf53c('0x5c'))](_0xf53c('0x5d'));});_0x1caf3a[_0xf53c('0x5e')](_0x3a71df);_0x1caf3a[_0xf53c('0x5f')](_0xf53c('0x60'),{'cwd':path[_0xf53c('0x61')](config[_0xf53c('0x62')],'server/files/plugins',path[_0xf53c('0x63')](_0x3f43c9['path'])),'ignore':[path['join'](path[_0xf53c('0x57')](_0x3f43c9[_0xf53c('0x7')]),_0xf53c('0x64')),path[_0xf53c('0x61')](path[_0xf53c('0x57')](_0x3f43c9['path']),_0xf53c('0x65'))],'nodir':!![]})[_0xf53c('0x66')]();_0x3a71df['on'](_0xf53c('0x67'),function(){if(!fs['existsSync'](_0x26144f)){throw new db[(_0xf53c('0x5b'))][(_0xf53c('0x5c'))](_0xf53c('0x68'));}return _0xd5f343[_0xf53c('0x55')](_0x26144f,util['format'](_0xf53c('0x56'),path[_0xf53c('0x57')](_0x3f43c9['path'])),function(_0x46439b){if(_0x46439b){throw new db[(_0xf53c('0x5b'))][(_0xf53c('0x5c'))](_0xf53c('0x69'));}fs['unlinkSync'](_0x26144f);logger[_0xf53c('0x6a')](_0xf53c('0x6b'));logger[_0xf53c('0x6a')](_0xf53c('0x6c'));});});}return null;})[_0xf53c('0x4e')](handleError(_0xd5f343,null));};exports[_0xf53c('0x6d')]=function(_0x30a67d,_0x163f76,_0x4c2d4d){var _0x47c2cb=path[_0xf53c('0x57')](_0x30a67d[_0xf53c('0x6e')]['filename'],path[_0xf53c('0x6f')](_0x30a67d[_0xf53c('0x6e')]['filename']));var _0x2f2d77=path[_0xf53c('0x61')](config[_0xf53c('0x62')],_0xf53c('0x70'),_0x30a67d[_0xf53c('0x6e')]['filename']);var _0x489e80=path['join'](config[_0xf53c('0x62')],_0xf53c('0x70'),_0x47c2cb);logger[_0xf53c('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x2f2d77);logger[_0xf53c('0x6a')](_0xf53c('0x71'),_0x489e80);try{fs[_0xf53c('0x72')](_0x2f2d77,parseInt('0777',0x8));extract(_0x2f2d77,{'dir':_0x489e80},function(_0x1ac07c){if(_0x1ac07c){logger[_0xf53c('0x33')](_0x1ac07c);handleError(_0x1ac07c,!![]);};var _0x59b716=fs[_0xf53c('0x73')](_0x489e80);if(_0x59b716[_0xf53c('0x52')]>0x1){removeReferences(_0x2f2d77,_0x489e80);logger[_0xf53c('0x33')](_0xf53c('0x74'));return _0x4c2d4d(new Error(_0xf53c('0x74')));}var _0x299c9a=fs[_0xf53c('0x75')](path[_0xf53c('0x61')](_0x489e80,_0x59b716[0x0]));if(_0x299c9a['isFile']()){removeReferences(_0x2f2d77,_0x489e80);logger['error'](_0xf53c('0x74'));return _0x4c2d4d(new Error(_0xf53c('0x74')));}if(_0x299c9a['isDirectory']()){var _0xf1f5d0=fs[_0xf53c('0x73')](path['join'](_0x489e80,_0x59b716[0x0]));if(_0xf1f5d0[_0xf53c('0x52')]===0x0){removeReferences(_0x2f2d77,_0x489e80);logger[_0xf53c('0x33')]('Invalid\x20plugin\x20structure');return _0x4c2d4d(new Error(_0xf53c('0x74')));}var _0x112fe3=_0xf1f5d0[_0xf53c('0x76')](function(_0x50c39c){return _0x50c39c==='manifest.json';});if(!_0x112fe3){return _0x4c2d4d(new Error('Plugin\x20manifest\x20missing'));}var _0x476f3b=fs[_0xf53c('0x77')](path[_0xf53c('0x61')](_0x489e80,_0x59b716[0x0],'manifest.json'));var _0x3e9736=JSON[_0xf53c('0x78')](_0x476f3b);if(_0xf53c('0x26')==typeof _0x3e9736['name']){return _0x4c2d4d(new Error(_0xf53c('0x79')));}if(_0xf53c('0x26')==typeof _0x3e9736['type']){return _0x4c2d4d(new Error(_0xf53c('0x7a')));}if('undefined'==typeof _0x3e9736['version']){return _0x4c2d4d(new Error(_0xf53c('0x7b')));}if(_0xf53c('0x26')==typeof _0x3e9736[_0xf53c('0x7c')]){return _0x4c2d4d(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3e9736['type']==='html'){if(_0xf53c('0x26')==typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')]){return _0x4c2d4d(new Error(_0xf53c('0x7e')));}if('undefined'==typeof _0x3e9736['parameters'][_0xf53c('0x7d')]['admin']&&_0xf53c('0x26')==typeof _0x3e9736[_0xf53c('0x7c')]['views'][_0xf53c('0x7f')]){return _0x4c2d4d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3e9736[_0xf53c('0x3a')]===_0xf53c('0x80')){if(_0xf53c('0x26')==typeof _0x3e9736['parameters'][_0xf53c('0x81')]){return _0x4c2d4d(new Error(_0xf53c('0x82')));}if(_0xf53c('0x26')==typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x83')]){return _0x4c2d4d(new Error(_0xf53c('0x84')));}}else{return _0x4c2d4d(new Error(_0xf53c('0x85')));}var _0x45ac7d=_0x3e9736['name'];var _0x3a2d70=_0x3e9736[_0xf53c('0x86')];var _0x3df10f=_0x3e9736[_0xf53c('0x3a')];var _0x1af228=_0x3e9736[_0xf53c('0x87')]?_0x3e9736[_0xf53c('0x87')]:_0xf53c('0x88');var _0x500bfa=_0x3e9736[_0xf53c('0x89')]?_0x3e9736[_0xf53c('0x89')]:_0xf53c('0x8a');var _0x22bee3='';var _0xe6fc8b='';var _0x5db3c8='';var _0x3b19b0='';var _0x4dff5e=_0x3e9736[_0xf53c('0x8b')];if(_0x3df10f===_0xf53c('0x8c')){if(_0xf53c('0x26')!=typeof _0x3e9736['parameters'][_0xf53c('0x7d')][_0xf53c('0x8d')]){var _0x387f4c=_0x3e9736['parameters'][_0xf53c('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf53c('0x8e')](_0x387f4c)){_0x22bee3=path[_0xf53c('0x61')]('plugins',_0x47c2cb,_0x59b716[0x0],_0x387f4c);}else{_0x22bee3=_0x387f4c;}}else{logger[_0xf53c('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')][_0xf53c('0x7f')]){var _0x273735=_0x3e9736[_0xf53c('0x7c')]['views'][_0xf53c('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf53c('0x8e')](_0x273735)){_0xe6fc8b=path[_0xf53c('0x61')](_0xf53c('0x8f'),_0x47c2cb,_0x59b716[0x0],_0x273735);}else{_0xe6fc8b=_0x273735;}}else{logger[_0xf53c('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3df10f===_0xf53c('0x80')){_0x5db3c8=_0x3e9736[_0xf53c('0x7c')][_0xf53c('0x81')];_0x3b19b0=_0x3e9736['parameters']['scriptPath'];if(_0xf53c('0x26')!=typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')]){if(_0xf53c('0x26')!=typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')]['admin']){var _0x387f4c=_0x3e9736['parameters'][_0xf53c('0x7d')][_0xf53c('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xf53c('0x8e')](_0x387f4c)){_0x22bee3=path[_0xf53c('0x61')](_0xf53c('0x8f'),_0x47c2cb,_0x59b716[0x0],_0x387f4c);}else{_0x22bee3=_0x387f4c;}}if(_0xf53c('0x26')!=typeof _0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')][_0xf53c('0x7f')]){var _0x273735=_0x3e9736[_0xf53c('0x7c')][_0xf53c('0x7d')][_0xf53c('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf53c('0x8e')](_0x273735)){_0xe6fc8b=path[_0xf53c('0x61')](_0xf53c('0x8f'),_0x47c2cb,_0x59b716[0x0],_0x273735);}else{_0xe6fc8b=_0x273735;}}}}var _0x369117={'name':_0x45ac7d,'description':_0x3a2d70,'path':path[_0xf53c('0x61')](_0x47c2cb,_0x59b716[0x0]),'type':_0x3df10f,'sidebar':_0x1af228,'icon':_0x500bfa,'adminUrl':_0x22bee3,'agentUrl':_0xe6fc8b,'scriptName':_0x5db3c8,'scriptPath':_0x3b19b0,'version':_0x4dff5e};removeReferences(_0x2f2d77,null);return db[_0xf53c('0x37')]['create'](_0x369117)['then'](function(_0x3afcaa){var _0x4e6aea={'role':_0x30a67d[_0xf53c('0x90')]['role'],'userProfileId':_0x30a67d[_0xf53c('0x90')][_0xf53c('0x91')]};if(!_0x4e6aea)throw new Error(_0xf53c('0x92'));if(_0x4e6aea['role']===_0xf53c('0x93')){var _0xb67897=_0x3afcaa[_0xf53c('0x30')]({'plain':!![]});return db[_0xf53c('0x94')][_0xf53c('0x54')]({'where':{'name':_0xf53c('0x31'),'userProfileId':_0x4e6aea[_0xf53c('0x91')]},'raw':!![]})['then'](function(_0x4693e3){if(_0x4693e3&&_0x4693e3[_0xf53c('0x95')]===0x0){return db[_0xf53c('0x32')][_0xf53c('0x96')]({'name':_0xb67897['name'],'resourceId':_0xb67897['id'],'type':_0x4693e3[_0xf53c('0x35')],'sectionId':_0x4693e3['id']},{})[_0xf53c('0x2e')](function(){return _0x3afcaa;});}else{return _0x3afcaa;}})[_0xf53c('0x4e')](function(_0x48a233){logger[_0xf53c('0x33')](_0xf53c('0x97'),_0x48a233);throw _0x48a233;});}return _0x3afcaa;})[_0xf53c('0x2e')](respondWithResult(_0x163f76,null))[_0xf53c('0x4e')](handleError(_0x163f76,null));}});}catch(_0xbe19a8){_0x163f76['status'](0x1f4)[_0xf53c('0x36')](_0xbe19a8);}};function removeReferences(_0x57638f,_0x5680d4){try{if(_0x57638f){fs[_0xf53c('0x98')](_0x57638f);logger[_0xf53c('0x6a')](_0xf53c('0x99'));}if(_0x5680d4){rimraf(_0x5680d4,function(){});logger[_0xf53c('0x6a')](_0xf53c('0x9a'));}}catch(_0x41159c){logger[_0xf53c('0x33')](_0x41159c);}}exports[_0xf53c('0x2d')]=function(_0x33a3e3,_0x3e75a8,_0x2760d1){return db[_0xf53c('0x37')][_0xf53c('0x54')]({'where':{'id':_0x33a3e3[_0xf53c('0x50')]['id']}})[_0xf53c('0x2e')](handleEntityNotFound(_0x3e75a8,null))['then'](saveUpdates(_0x33a3e3['body'],null))['then'](respondWithResult(_0x3e75a8,null))['catch'](handleError(_0x3e75a8,null));};exports[_0xf53c('0x9b')]=function(_0x251790,_0x27110d,_0x46bd9b){return db['Plugin']['find']({'where':{'id':_0x251790[_0xf53c('0x50')]['id']}})[_0xf53c('0x2e')](function(_0x191352){if(_0x191352){return _0x191352['destroy']();}})[_0xf53c('0x2e')](function(_0x1911eb){rimraf(path[_0xf53c('0x61')](config[_0xf53c('0x62')],'server/files/plugins',path[_0xf53c('0x63')](_0x1911eb['path'])),function(){});return _0x1911eb;})[_0xf53c('0x2e')](handleEntityNotFound(_0x27110d,null))[_0xf53c('0x2e')](respondWithStatusCode(_0x27110d,null))[_0xf53c('0x4e')](handleError(_0x27110d,null));};exports[_0xf53c('0x9c')]=function(_0x19b687,_0x21c0a1,_0x2141d8){return BPromise[_0xf53c('0x9d')]()[_0xf53c('0x2e')](function(){if(!_0x19b687[_0xf53c('0x3d')][_0xf53c('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x19b687[_0xf53c('0x3d')]['port']){throw new Error(_0xf53c('0x9e'));}var _0x3a34ca=_0x19b687[_0xf53c('0x3d')][_0xf53c('0x9f')]?_0x19b687['query'][_0xf53c('0x9f')]+':'+_0x19b687[_0xf53c('0x3d')]['port']:_0xf53c('0xa0')+_0x19b687['query'][_0xf53c('0xa1')];var _0x55695b=_0x19b687[_0xf53c('0x3d')][_0xf53c('0x24')]?_0x19b687[_0xf53c('0x3d')][_0xf53c('0x24')]:!![];var _0x188da2=_0x19b687[_0xf53c('0x3d')][_0xf53c('0xa2')]?_0x19b687[_0xf53c('0x3d')][_0xf53c('0xa2')]:null;var _0x38190e={'method':_0x19b687['method'],'uri':util[_0xf53c('0xa3')]('%s%s',_0x3a34ca,_0x19b687[_0xf53c('0x3d')][_0xf53c('0x7')]),'json':_0x55695b,'resolveWithFullResponse':!![],'encoding':_0x188da2,'qs':_0x19b687[_0xf53c('0x3d')]};if(_0x19b687['headers']){_0x38190e['headers']=_0x19b687[_0xf53c('0xa4')];if(_0x38190e[_0xf53c('0xa4')][_0xf53c('0xa5')]){delete _0x38190e[_0xf53c('0xa4')][_0xf53c('0xa5')];}}if(_0x38190e[_0xf53c('0xa4')]['content-type']){delete _0x38190e[_0xf53c('0xa4')][_0xf53c('0xa6')];}return rp(_0x38190e);})['then'](function(_0x620759){if(_0x620759){_0x21c0a1[_0xf53c('0xa7')](_0x620759[_0xf53c('0xa4')]);logger['info'](_0x620759[_0xf53c('0x90')]);if(_[_0xf53c('0xa8')](_0x19b687[_0xf53c('0x3d')]['path'],'download')&&_0x620759[_0xf53c('0xa9')]==0x1f4){return _0x21c0a1[_0xf53c('0x22')](_0x620759['statusCode']);}else{return _0x21c0a1['status'](_0x620759[_0xf53c('0xa9')])[_0xf53c('0x36')](_0x620759['body']);}}else{return _0x21c0a1[_0xf53c('0x22')](0xc8);}})[_0xf53c('0x4e')](handleError(_0x21c0a1,null));};exports[_0xf53c('0xaa')]=function(_0x155013,_0x5a6e30,_0x1ba72b){return BPromise[_0xf53c('0x9d')]()[_0xf53c('0x2e')](function(){if(!_0x155013[_0xf53c('0x3d')][_0xf53c('0x7')]){throw new Error(_0xf53c('0xab'));}if(!_0x155013[_0xf53c('0x3d')][_0xf53c('0xa1')]){throw new Error(_0xf53c('0x9e'));}var _0x4d6775=_0x155013[_0xf53c('0x3d')][_0xf53c('0x9f')]?_0x155013[_0xf53c('0x3d')]['hostname']+':'+_0x155013[_0xf53c('0x3d')][_0xf53c('0xa1')]:_0xf53c('0xa0')+_0x155013[_0xf53c('0x3d')]['port'];var _0x415113=_0x155013[_0xf53c('0x3d')][_0xf53c('0x24')]?_0x155013['query'][_0xf53c('0x24')]:!![];var _0x189647=_0x155013[_0xf53c('0x3d')][_0xf53c('0xa2')]?_0x155013[_0xf53c('0x3d')][_0xf53c('0xa2')]:null;var _0x5cf458={'method':_0x155013[_0xf53c('0xac')],'uri':util[_0xf53c('0xa3')](_0xf53c('0xad'),_0x4d6775,_0x155013['query'][_0xf53c('0x7')]),'json':_0x415113,'resolveWithFullResponse':!![],'encoding':_0x189647,'body':_0x155013[_0xf53c('0x90')]};if(_0x155013['headers']){_0x5cf458['headers']=_0x155013[_0xf53c('0xa4')];if(_0x5cf458['headers'][_0xf53c('0xa5')]){delete _0x5cf458[_0xf53c('0xa4')][_0xf53c('0xa5')];}}if(_0x5cf458[_0xf53c('0xa4')][_0xf53c('0xa6')]){delete _0x5cf458[_0xf53c('0xa4')]['content-type'];}return rp(_0x5cf458);})[_0xf53c('0x2e')](function(_0x116462){if(_0x116462){_0x5a6e30[_0xf53c('0xa7')](_0x116462[_0xf53c('0xa4')]);logger[_0xf53c('0x6a')](_0x116462[_0xf53c('0x90')]);return _0x5a6e30['status'](_0x116462[_0xf53c('0xa9')])[_0xf53c('0x36')](_0x116462[_0xf53c('0x90')]);}else{return _0x5a6e30['sendStatus'](0xc8);}})[_0xf53c('0x4e')](handleError(_0x5a6e30,null));}; \ No newline at end of file +var _0xd64f=['content-type','endsWith','statusCode','webhookPost','resolve','%s%s','set','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./plugin.socket','register','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','destroy','then','get','Plugins','sendStatus','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','download','find','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','error','Sequelize','Error','glob','**/*','dirname','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','body','role','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','update','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','headers','content-length'];(function(_0x4794be,_0x399b70){var _0x4c716a=function(_0x3bb38a){while(--_0x3bb38a){_0x4794be['push'](_0x4794be['shift']());}};_0x4c716a(++_0x399b70);}(_0xd64f,0x153));var _0xfd64=function(_0x56d171,_0x4d42a1){_0x56d171=_0x56d171-0x0;var _0x4e7224=_0xd64f[_0x56d171];return _0x4e7224;};'use strict';var emlformat=require(_0xfd64('0x0'));var rimraf=require(_0xfd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd64('0x2'));var moment=require('moment');var BPromise=require(_0xfd64('0x3'));var Mustache=require('mustache');var util=require(_0xfd64('0x4'));var path=require(_0xfd64('0x5'));var sox=require(_0xfd64('0x6'));var csv=require(_0xfd64('0x7'));var ejs=require(_0xfd64('0x8'));var fs=require('fs');var fs_extra=require(_0xfd64('0x9'));var _=require(_0xfd64('0xa'));var squel=require('squel');var crypto=require(_0xfd64('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfd64('0xc'));var toCsv=require(_0xfd64('0x7'));var querystring=require('querystring');var Papa=require(_0xfd64('0xd'));var extract=require(_0xfd64('0xe'));var rimraf=require(_0xfd64('0x1'));var archiver=require(_0xfd64('0xf'));var Redis=require(_0xfd64('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd64('0x11'));var as=require(_0xfd64('0x12'));var hardwareService=require(_0xfd64('0x13'));var logger=require(_0xfd64('0x14'))(_0xfd64('0x15'));var utils=require(_0xfd64('0x16'));var config=require(_0xfd64('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd64('0x18'))['db'];config['redis']=_[_0xfd64('0x19')](config[_0xfd64('0x1a')],{'host':_0xfd64('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd64('0x1a')]));require(_0xfd64('0x1c'))[_0xfd64('0x1d')](socket);function respondWithStatusCode(_0x374e05,_0x3c2bb3){_0x3c2bb3=_0x3c2bb3||0xcc;return function(_0x3b44f0){if(_0x3b44f0){return _0x374e05['sendStatus'](_0x3c2bb3);}return _0x374e05[_0xfd64('0x1e')](_0x3c2bb3)[_0xfd64('0x1f')]();};}function respondWithResult(_0x12ca6d,_0x2f7d10){_0x2f7d10=_0x2f7d10||0xc8;return function(_0x3d1337){if(_0x3d1337){return _0x12ca6d[_0xfd64('0x1e')](_0x2f7d10)[_0xfd64('0x20')](_0x3d1337);}};}function respondWithFilteredResult(_0x413a87,_0x379c3f){return function(_0x20775d){if(_0x20775d){var _0x39dc2d=typeof _0x379c3f['offset']==='undefined'&&typeof _0x379c3f[_0xfd64('0x21')]===_0xfd64('0x22');var _0x1fffbc=_0x20775d['count'];var _0x5e1bae=_0x39dc2d?0x0:_0x379c3f[_0xfd64('0x23')];var _0x1664b4=_0x39dc2d?_0x20775d[_0xfd64('0x24')]:_0x379c3f[_0xfd64('0x23')]+_0x379c3f[_0xfd64('0x21')];var _0x3d46e2;if(_0x1664b4>=_0x1fffbc){_0x1664b4=_0x1fffbc;_0x3d46e2=0xc8;}else{_0x3d46e2=0xce;}_0x413a87[_0xfd64('0x1e')](_0x3d46e2);return _0x413a87['set'](_0xfd64('0x25'),_0x5e1bae+'-'+_0x1664b4+'/'+_0x1fffbc)[_0xfd64('0x20')](_0x20775d);}return null;};}function patchUpdates(_0x3b9e48){return function(_0x3df680){try{jsonpatch[_0xfd64('0x26')](_0x3df680,_0x3b9e48,!![]);}catch(_0x3a4cf8){return BPromise[_0xfd64('0x27')](_0x3a4cf8);}return _0x3df680[_0xfd64('0x28')]();};}function saveUpdates(_0x42319e,_0x81f70){return function(_0x2bef2a){if(_0x2bef2a){return _0x2bef2a['update'](_0x42319e)['then'](function(_0x18f458){return _0x18f458;});}return null;};}function removeEntity(_0x29bc1e,_0x4c9869){return function(_0xc5560){if(_0xc5560){return _0xc5560[_0xfd64('0x29')]()[_0xfd64('0x2a')](function(){var _0x3c511a=_0xc5560[_0xfd64('0x2b')]({'plain':!![]});var _0x3b7d6a=_0xfd64('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b7d6a,'resourceId':_0x3c511a['id']}})[_0xfd64('0x2a')](function(){return _0xc5560;});})[_0xfd64('0x2a')](function(){_0x29bc1e['status'](0xcc)[_0xfd64('0x1f')]();});}};}function handleEntityNotFound(_0x319181,_0x5aa2dc){return function(_0x5b6fb1){if(!_0x5b6fb1){_0x319181[_0xfd64('0x2d')](0x194);}return _0x5b6fb1;};}function handleError(_0xe3cf2e,_0x117045){_0x117045=_0x117045||0x1f4;return function(_0x538b59){logger['error'](_0x538b59['stack']);if(_0x538b59[_0xfd64('0x2e')]){delete _0x538b59[_0xfd64('0x2e')];}_0xe3cf2e['status'](_0x117045)[_0xfd64('0x2f')](_0x538b59);};}exports[_0xfd64('0x30')]=function(_0x500503,_0x3c0c75){var _0x4ff1a5={},_0x3c2df6={},_0x52696a={'count':0x0,'rows':[]};var _0x14495e=_['map'](db[_0xfd64('0x31')][_0xfd64('0x32')],function(_0xf850a5){return{'name':_0xf850a5[_0xfd64('0x33')],'type':_0xf850a5[_0xfd64('0x34')][_0xfd64('0x35')]};});_0x3c2df6[_0xfd64('0x36')]=_[_0xfd64('0x37')](_0x14495e,_0xfd64('0x2e'));_0x3c2df6['query']=_[_0xfd64('0x38')](_0x500503[_0xfd64('0x39')]);_0x3c2df6[_0xfd64('0x3a')]=_['intersection'](_0x3c2df6[_0xfd64('0x36')],_0x3c2df6[_0xfd64('0x39')]);_0x4ff1a5[_0xfd64('0x3b')]=_[_0xfd64('0x3c')](_0x3c2df6[_0xfd64('0x36')],qs[_0xfd64('0x3d')](_0x500503[_0xfd64('0x39')][_0xfd64('0x3d')]));_0x4ff1a5[_0xfd64('0x3b')]=_0x4ff1a5[_0xfd64('0x3b')][_0xfd64('0x3e')]?_0x4ff1a5[_0xfd64('0x3b')]:_0x3c2df6[_0xfd64('0x36')];if(!_0x500503[_0xfd64('0x39')][_0xfd64('0x3f')](_0xfd64('0x40'))){_0x4ff1a5[_0xfd64('0x21')]=qs[_0xfd64('0x21')](_0x500503[_0xfd64('0x39')]['limit']);_0x4ff1a5[_0xfd64('0x23')]=qs[_0xfd64('0x23')](_0x500503['query'][_0xfd64('0x23')]);}_0x4ff1a5[_0xfd64('0x41')]=qs[_0xfd64('0x42')](_0x500503[_0xfd64('0x39')][_0xfd64('0x42')]);_0x4ff1a5[_0xfd64('0x43')]=qs[_0xfd64('0x3a')](_[_0xfd64('0x44')](_0x500503[_0xfd64('0x39')],_0x3c2df6[_0xfd64('0x3a')]),_0x14495e);if(_0x500503[_0xfd64('0x39')][_0xfd64('0x45')]){_0x4ff1a5[_0xfd64('0x43')]=_['merge'](_0x4ff1a5[_0xfd64('0x43')],{'$or':_[_0xfd64('0x37')](_0x14495e,function(_0x20947f){if(_0x20947f[_0xfd64('0x34')]!=='VIRTUAL'){var _0x329f54={};_0x329f54[_0x20947f[_0xfd64('0x2e')]]={'$like':'%'+_0x500503[_0xfd64('0x39')][_0xfd64('0x45')]+'%'};return _0x329f54;}})});}_0x4ff1a5=_[_0xfd64('0x46')]({},_0x4ff1a5,_0x500503[_0xfd64('0x47')]);var _0x39a499={'where':_0x4ff1a5[_0xfd64('0x43')]};return db['Plugin'][_0xfd64('0x24')](_0x39a499)['then'](function(_0x358b03){_0x52696a[_0xfd64('0x24')]=_0x358b03;if(_0x500503[_0xfd64('0x39')]['includeAll']){_0x4ff1a5[_0xfd64('0x48')]=[{'all':!![]}];}return db['Plugin'][_0xfd64('0x49')](_0x4ff1a5);})[_0xfd64('0x2a')](function(_0x1d9645){_0x52696a[_0xfd64('0x4a')]=_0x1d9645;return _0x52696a;})[_0xfd64('0x2a')](respondWithFilteredResult(_0x3c0c75,_0x4ff1a5))['catch'](handleError(_0x3c0c75,null));};exports[_0xfd64('0x4b')]=function(_0x1229f1,_0x4e1681){var _0x275fa8={'raw':!![],'where':{'id':_0x1229f1[_0xfd64('0x4c')]['id']}},_0x489a70={};_0x489a70['model']=_[_0xfd64('0x38')](db['Plugin'][_0xfd64('0x32')]);_0x489a70[_0xfd64('0x39')]=_[_0xfd64('0x38')](_0x1229f1[_0xfd64('0x39')]);_0x489a70[_0xfd64('0x3a')]=_[_0xfd64('0x3c')](_0x489a70[_0xfd64('0x36')],_0x489a70[_0xfd64('0x39')]);_0x275fa8['attributes']=_[_0xfd64('0x3c')](_0x489a70[_0xfd64('0x36')],qs[_0xfd64('0x3d')](_0x1229f1[_0xfd64('0x39')]['fields']));_0x275fa8[_0xfd64('0x3b')]=_0x275fa8[_0xfd64('0x3b')][_0xfd64('0x3e')]?_0x275fa8['attributes']:_0x489a70[_0xfd64('0x36')];if(_0x1229f1['query'][_0xfd64('0x4d')]){_0x275fa8[_0xfd64('0x48')]=[{'all':!![]}];}_0x275fa8=_[_0xfd64('0x46')]({},_0x275fa8,_0x1229f1['options']);return db['Plugin']['find'](_0x275fa8)[_0xfd64('0x2a')](handleEntityNotFound(_0x4e1681,null))[_0xfd64('0x2a')](respondWithResult(_0x4e1681,null))['catch'](handleError(_0x4e1681,null));};exports[_0xfd64('0x4e')]=function(_0x458fa0,_0x2156af,_0x51b9e5){return db[_0xfd64('0x31')][_0xfd64('0x4f')]({'where':{'id':_0x458fa0[_0xfd64('0x4c')]['id']},'attributes':[_0xfd64('0x2e'),_0xfd64('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x2156af,null))[_0xfd64('0x2a')](function(_0x5e5d92){if(_0x5e5d92){var _0x271e27=path[_0xfd64('0x50')](config[_0xfd64('0x51')],_0xfd64('0x52'),util[_0xfd64('0x53')](_0xfd64('0x54'),path[_0xfd64('0x55')](_0x5e5d92['path'])));var _0x510d3a=fs['createWriteStream'](_0x271e27);var _0x4c7449=archiver(_0xfd64('0x56'),{'zlib':{'level':0x9}});_0x4c7449['on'](_0xfd64('0x57'),function(_0x4414ac){if(_0x4414ac[_0xfd64('0x58')]==='ENOENT'){logger[_0xfd64('0x59')](_0x4414ac);}else{throw new db[(_0xfd64('0x5a'))][(_0xfd64('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4c7449['on']('error',function(_0x4885b9){throw new db[(_0xfd64('0x5a'))][(_0xfd64('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4c7449['pipe'](_0x510d3a);_0x4c7449[_0xfd64('0x5c')](_0xfd64('0x5d'),{'cwd':path['join'](config['root'],_0xfd64('0x52'),path[_0xfd64('0x5e')](_0x5e5d92[_0xfd64('0x5')])),'ignore':[path[_0xfd64('0x50')](path[_0xfd64('0x55')](_0x5e5d92[_0xfd64('0x5')]),'node_modules/**/*'),path[_0xfd64('0x50')](path[_0xfd64('0x55')](_0x5e5d92[_0xfd64('0x5')]),_0xfd64('0x5f'))],'nodir':!![]})[_0xfd64('0x60')]();_0x510d3a['on'](_0xfd64('0x61'),function(){if(!fs[_0xfd64('0x62')](_0x271e27)){throw new db['Sequelize'][(_0xfd64('0x5b'))]('Plugin\x20not\x20found');}return _0x2156af[_0xfd64('0x4e')](_0x271e27,util[_0xfd64('0x53')](_0xfd64('0x54'),path[_0xfd64('0x55')](_0x5e5d92[_0xfd64('0x5')])),function(_0x5ddc3){if(_0x5ddc3){throw new db[(_0xfd64('0x5a'))][(_0xfd64('0x5b'))](_0xfd64('0x63'));}fs[_0xfd64('0x64')](_0x271e27);logger[_0xfd64('0x65')](_0xfd64('0x66'));logger['info'](_0xfd64('0x67'));});});}return null;})[_0xfd64('0x68')](handleError(_0x2156af,null));};exports['upload']=function(_0x4c3e73,_0x425955,_0x2eefcb){var _0xa98b30=path['basename'](_0x4c3e73[_0xfd64('0x69')][_0xfd64('0x6a')],path[_0xfd64('0x6b')](_0x4c3e73[_0xfd64('0x69')][_0xfd64('0x6a')]));var _0x35b860=path['join'](config[_0xfd64('0x51')],'server/files/plugins',_0x4c3e73['file'][_0xfd64('0x6a')]);var _0x1b3e39=path['join'](config[_0xfd64('0x51')],_0xfd64('0x52'),_0xa98b30);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x35b860);logger[_0xfd64('0x65')](_0xfd64('0x6c'),_0x1b3e39);try{fs[_0xfd64('0x6d')](_0x35b860,parseInt('0777',0x8));extract(_0x35b860,{'dir':_0x1b3e39},function(_0x20cce8){if(_0x20cce8){logger[_0xfd64('0x59')](_0x20cce8);handleError(_0x20cce8,!![]);};var _0x127584=fs[_0xfd64('0x6e')](_0x1b3e39);if(_0x127584[_0xfd64('0x3e')]>0x1){removeReferences(_0x35b860,_0x1b3e39);logger[_0xfd64('0x59')](_0xfd64('0x6f'));return _0x2eefcb(new Error('Invalid\x20plugin\x20structure'));}var _0x3c3128=fs[_0xfd64('0x70')](path[_0xfd64('0x50')](_0x1b3e39,_0x127584[0x0]));if(_0x3c3128[_0xfd64('0x71')]()){removeReferences(_0x35b860,_0x1b3e39);logger['error'](_0xfd64('0x6f'));return _0x2eefcb(new Error(_0xfd64('0x6f')));}if(_0x3c3128[_0xfd64('0x72')]()){var _0x4c26b5=fs[_0xfd64('0x6e')](path['join'](_0x1b3e39,_0x127584[0x0]));if(_0x4c26b5['length']===0x0){removeReferences(_0x35b860,_0x1b3e39);logger['error']('Invalid\x20plugin\x20structure');return _0x2eefcb(new Error('Invalid\x20plugin\x20structure'));}var _0x86db2d=_0x4c26b5[_0xfd64('0x73')](function(_0x3f85cb){return _0x3f85cb===_0xfd64('0x74');});if(!_0x86db2d){return _0x2eefcb(new Error(_0xfd64('0x75')));}var _0x58ea7a=fs[_0xfd64('0x76')](path['join'](_0x1b3e39,_0x127584[0x0],_0xfd64('0x74')));var _0x524305=JSON[_0xfd64('0x77')](_0x58ea7a);if('undefined'==typeof _0x524305[_0xfd64('0x2e')]){return _0x2eefcb(new Error(_0xfd64('0x78')));}if(_0xfd64('0x22')==typeof _0x524305[_0xfd64('0x34')]){return _0x2eefcb(new Error(_0xfd64('0x79')));}if(_0xfd64('0x22')==typeof _0x524305[_0xfd64('0x7a')]){return _0x2eefcb(new Error(_0xfd64('0x7b')));}if(_0xfd64('0x22')==typeof _0x524305[_0xfd64('0x7c')]){return _0x2eefcb(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x524305[_0xfd64('0x34')]===_0xfd64('0x7d')){if('undefined'==typeof _0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')]){return _0x2eefcb(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x524305['parameters'][_0xfd64('0x7e')]['admin']&&'undefined'==typeof _0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')]['agent']){return _0x2eefcb(new Error(_0xfd64('0x7f')));}}else if(_0x524305['type']==='script'){if(_0xfd64('0x22')==typeof _0x524305['parameters'][_0xfd64('0x80')]){return _0x2eefcb(new Error(_0xfd64('0x81')));}if(_0xfd64('0x22')==typeof _0x524305[_0xfd64('0x7c')][_0xfd64('0x82')]){return _0x2eefcb(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2eefcb(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x11a9b1=_0x524305[_0xfd64('0x2e')];var _0x303f71=_0x524305[_0xfd64('0x83')];var _0x56d3c4=_0x524305[_0xfd64('0x34')];var _0xdd963f=_0x524305[_0xfd64('0x84')]?_0x524305[_0xfd64('0x84')]:_0xfd64('0x85');var _0x2c847a=_0x524305['icon']?_0x524305[_0xfd64('0x86')]:_0xfd64('0x87');var _0xfa91a='';var _0x405390='';var _0x5c12fe='';var _0x2f1ecc='';var _0x466288=_0x524305[_0xfd64('0x7a')];if(_0x56d3c4===_0xfd64('0x7d')){if(_0xfd64('0x22')!=typeof _0x524305['parameters'][_0xfd64('0x7e')][_0xfd64('0x88')]){var _0x3b1038=_0x524305['parameters'][_0xfd64('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xfd64('0x89')](_0x3b1038)){_0xfa91a=path[_0xfd64('0x50')](_0xfd64('0x8a'),_0xa98b30,_0x127584[0x0],_0x3b1038);}else{_0xfa91a=_0x3b1038;}}else{logger[_0xfd64('0x65')](_0xfd64('0x8b'));}if(_0xfd64('0x22')!=typeof _0x524305[_0xfd64('0x7c')]['views'][_0xfd64('0x8c')]){var _0xb35a26=_0x524305[_0xfd64('0x7c')]['views'][_0xfd64('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xfd64('0x89')](_0xb35a26)){_0x405390=path[_0xfd64('0x50')](_0xfd64('0x8a'),_0xa98b30,_0x127584[0x0],_0xb35a26);}else{_0x405390=_0xb35a26;}}else{logger['info'](_0xfd64('0x8d'));}}else if(_0x56d3c4===_0xfd64('0x8e')){_0x5c12fe=_0x524305[_0xfd64('0x7c')][_0xfd64('0x80')];_0x2f1ecc=_0x524305[_0xfd64('0x7c')][_0xfd64('0x82')];if(_0xfd64('0x22')!=typeof _0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')]){if(_0xfd64('0x22')!=typeof _0x524305[_0xfd64('0x7c')]['views'][_0xfd64('0x88')]){var _0x3b1038=_0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')][_0xfd64('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xfd64('0x89')](_0x3b1038)){_0xfa91a=path['join'](_0xfd64('0x8a'),_0xa98b30,_0x127584[0x0],_0x3b1038);}else{_0xfa91a=_0x3b1038;}}if(_0xfd64('0x22')!=typeof _0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')][_0xfd64('0x8c')]){var _0xb35a26=_0x524305[_0xfd64('0x7c')][_0xfd64('0x7e')][_0xfd64('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xfd64('0x89')](_0xb35a26)){_0x405390=path['join'](_0xfd64('0x8a'),_0xa98b30,_0x127584[0x0],_0xb35a26);}else{_0x405390=_0xb35a26;}}}}var _0x36fc14={'name':_0x11a9b1,'description':_0x303f71,'path':path[_0xfd64('0x50')](_0xa98b30,_0x127584[0x0]),'type':_0x56d3c4,'sidebar':_0xdd963f,'icon':_0x2c847a,'adminUrl':_0xfa91a,'agentUrl':_0x405390,'scriptName':_0x5c12fe,'scriptPath':_0x2f1ecc,'version':_0x466288};removeReferences(_0x35b860,null);return db[_0xfd64('0x31')]['create'](_0x36fc14)[_0xfd64('0x2a')](function(_0xfea195){var _0x3cf2e7={'role':_0x4c3e73[_0xfd64('0x8f')][_0xfd64('0x90')],'userProfileId':_0x4c3e73[_0xfd64('0x8f')][_0xfd64('0x91')]};if(!_0x3cf2e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cf2e7[_0xfd64('0x90')]===_0xfd64('0x92')){var _0x93309=_0xfea195[_0xfd64('0x2b')]({'plain':!![]});return db[_0xfd64('0x93')][_0xfd64('0x4f')]({'where':{'name':_0xfd64('0x2c'),'userProfileId':_0x3cf2e7[_0xfd64('0x91')]},'raw':!![]})[_0xfd64('0x2a')](function(_0x43476f){if(_0x43476f&&_0x43476f[_0xfd64('0x94')]===0x0){return db[_0xfd64('0x95')]['create']({'name':_0x93309[_0xfd64('0x2e')],'resourceId':_0x93309['id'],'type':_0x43476f['name'],'sectionId':_0x43476f['id']},{})[_0xfd64('0x2a')](function(){return _0xfea195;});}else{return _0xfea195;}})[_0xfd64('0x68')](function(_0x3f6ca7){logger[_0xfd64('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f6ca7);throw _0x3f6ca7;});}return _0xfea195;})[_0xfd64('0x2a')](respondWithResult(_0x425955,null))['catch'](handleError(_0x425955,null));}});}catch(_0xb92d26){_0x425955[_0xfd64('0x1e')](0x1f4)['send'](_0xb92d26);}};function removeReferences(_0x52df85,_0x59fc10){try{if(_0x52df85){fs[_0xfd64('0x64')](_0x52df85);logger['info']('Zip\x20archive\x20removed');}if(_0x59fc10){rimraf(_0x59fc10,function(){});logger[_0xfd64('0x65')]('Extracted\x20folder\x20removed');}}catch(_0x5e8336){logger[_0xfd64('0x59')](_0x5e8336);}}exports[_0xfd64('0x96')]=function(_0x3d6b13,_0x31cc4a,_0x4ce396){return db[_0xfd64('0x31')][_0xfd64('0x4f')]({'where':{'id':_0x3d6b13[_0xfd64('0x4c')]['id']}})[_0xfd64('0x2a')](handleEntityNotFound(_0x31cc4a,null))[_0xfd64('0x2a')](saveUpdates(_0x3d6b13[_0xfd64('0x8f')],null))[_0xfd64('0x2a')](respondWithResult(_0x31cc4a,null))[_0xfd64('0x68')](handleError(_0x31cc4a,null));};exports['delete']=function(_0x546798,_0x15bf6c,_0x19e0ac){return db['Plugin']['find']({'where':{'id':_0x546798[_0xfd64('0x4c')]['id']}})['then'](function(_0x1970b9){if(_0x1970b9){return _0x1970b9[_0xfd64('0x29')]();}})[_0xfd64('0x2a')](function(_0x269139){rimraf(path[_0xfd64('0x50')](config[_0xfd64('0x51')],_0xfd64('0x52'),path[_0xfd64('0x5e')](_0x269139[_0xfd64('0x5')])),function(){});return _0x269139;})['then'](handleEntityNotFound(_0x15bf6c,null))[_0xfd64('0x2a')](respondWithStatusCode(_0x15bf6c,null))[_0xfd64('0x68')](handleError(_0x15bf6c,null));};exports['webhookGet']=function(_0x1efeca,_0x3c4aaf,_0x3a4dc1){return BPromise['resolve']()['then'](function(){if(!_0x1efeca[_0xfd64('0x39')]['path']){throw new Error(_0xfd64('0x97'));}if(!_0x1efeca['query'][_0xfd64('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3725ec=_0x1efeca[_0xfd64('0x39')]['hostname']?_0x1efeca[_0xfd64('0x39')][_0xfd64('0x99')]+':'+_0x1efeca[_0xfd64('0x39')][_0xfd64('0x98')]:_0xfd64('0x9a')+_0x1efeca[_0xfd64('0x39')][_0xfd64('0x98')];var _0x5a2a94=_0x1efeca[_0xfd64('0x39')][_0xfd64('0x20')]?_0x1efeca[_0xfd64('0x39')][_0xfd64('0x20')]:!![];var _0x5e86ff=_0x1efeca['query'][_0xfd64('0x9b')]?_0x1efeca[_0xfd64('0x39')][_0xfd64('0x9b')]:null;var _0xe7a463={'method':_0x1efeca[_0xfd64('0x9c')],'uri':util[_0xfd64('0x53')]('%s%s',_0x3725ec,_0x1efeca['query']['path']),'json':_0x5a2a94,'resolveWithFullResponse':!![],'encoding':_0x5e86ff,'qs':_0x1efeca['query']};if(_0x1efeca[_0xfd64('0x9d')]){_0xe7a463[_0xfd64('0x9d')]=_0x1efeca['headers'];if(_0xe7a463[_0xfd64('0x9d')][_0xfd64('0x9e')]){delete _0xe7a463[_0xfd64('0x9d')][_0xfd64('0x9e')];}}if(_0xe7a463[_0xfd64('0x9d')][_0xfd64('0x9f')]){delete _0xe7a463['headers'][_0xfd64('0x9f')];}return rp(_0xe7a463);})[_0xfd64('0x2a')](function(_0x50380e){if(_0x50380e){_0x3c4aaf['set'](_0x50380e['headers']);logger[_0xfd64('0x65')](_0x50380e[_0xfd64('0x8f')]);if(_[_0xfd64('0xa0')](_0x1efeca['query'][_0xfd64('0x5')],_0xfd64('0x4e'))&&_0x50380e[_0xfd64('0xa1')]==0x1f4){return _0x3c4aaf[_0xfd64('0x2d')](_0x50380e[_0xfd64('0xa1')]);}else{return _0x3c4aaf[_0xfd64('0x1e')](_0x50380e[_0xfd64('0xa1')])['send'](_0x50380e[_0xfd64('0x8f')]);}}else{return _0x3c4aaf['sendStatus'](0xc8);}})['catch'](handleError(_0x3c4aaf,null));};exports[_0xfd64('0xa2')]=function(_0x593f46,_0x10c055,_0x42dee7){return BPromise[_0xfd64('0xa3')]()[_0xfd64('0x2a')](function(){if(!_0x593f46[_0xfd64('0x39')][_0xfd64('0x5')]){throw new Error(_0xfd64('0x97'));}if(!_0x593f46['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5508ad=_0x593f46[_0xfd64('0x39')][_0xfd64('0x99')]?_0x593f46[_0xfd64('0x39')][_0xfd64('0x99')]+':'+_0x593f46['query'][_0xfd64('0x98')]:_0xfd64('0x9a')+_0x593f46[_0xfd64('0x39')][_0xfd64('0x98')];var _0x17e11d=_0x593f46[_0xfd64('0x39')][_0xfd64('0x20')]?_0x593f46[_0xfd64('0x39')]['json']:!![];var _0x281c16=_0x593f46[_0xfd64('0x39')][_0xfd64('0x9b')]?_0x593f46['query']['encoding']:null;var _0x238a15={'method':_0x593f46['method'],'uri':util[_0xfd64('0x53')](_0xfd64('0xa4'),_0x5508ad,_0x593f46['query'][_0xfd64('0x5')]),'json':_0x17e11d,'resolveWithFullResponse':!![],'encoding':_0x281c16,'body':_0x593f46[_0xfd64('0x8f')]};if(_0x593f46['headers']){_0x238a15[_0xfd64('0x9d')]=_0x593f46[_0xfd64('0x9d')];if(_0x238a15[_0xfd64('0x9d')][_0xfd64('0x9e')]){delete _0x238a15[_0xfd64('0x9d')][_0xfd64('0x9e')];}}if(_0x238a15['headers']['content-type']){delete _0x238a15[_0xfd64('0x9d')]['content-type'];}return rp(_0x238a15);})[_0xfd64('0x2a')](function(_0x35caf6){if(_0x35caf6){_0x10c055[_0xfd64('0xa5')](_0x35caf6[_0xfd64('0x9d')]);logger[_0xfd64('0x65')](_0x35caf6['body']);return _0x10c055[_0xfd64('0x1e')](_0x35caf6[_0xfd64('0xa1')])['send'](_0x35caf6[_0xfd64('0x8f')]);}else{return _0x10c055[_0xfd64('0x2d')](0xc8);}})[_0xfd64('0x68')](handleError(_0x10c055,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6932f79..b3dfd52 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 _0xae30=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x4103a6,_0x5bed97){var _0x1be2b3=function(_0x414f49){while(--_0x414f49){_0x4103a6['push'](_0x4103a6['shift']());}};_0x1be2b3(++_0x5bed97);}(_0xae30,0x10a));var _0x0ae3=function(_0x532b8b,_0x4d0cb0){_0x532b8b=_0x532b8b-0x0;var _0x3e2607=_0xae30[_0x532b8b];return _0x3e2607;};'use strict';var EventEmitter=require(_0x0ae3('0x0'));var Plugin=require(_0x0ae3('0x1'))['db'][_0x0ae3('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ae3('0x3'),'afterUpdate':_0x0ae3('0x4'),'afterDestroy':_0x0ae3('0x5')};function emitEvent(_0x1e3bed){return function(_0x51f481,_0x23a7a1,_0xcf497c){PluginEvents[_0x0ae3('0x6')](_0x1e3bed+':'+_0x51f481['id'],_0x51f481);PluginEvents[_0x0ae3('0x6')](_0x1e3bed,_0x51f481);_0xcf497c(null);};}for(var e in events){if(events[_0x0ae3('0x7')](e)){var event=events[e];Plugin[_0x0ae3('0x8')](e,emitEvent(event));}}module[_0x0ae3('0x9')]=PluginEvents; \ No newline at end of file +var _0x12e9=['Plugin','save','update','emit','hasOwnProperty','exports'];(function(_0x1cde5d,_0x575b61){var _0x50f9be=function(_0xca0793){while(--_0xca0793){_0x1cde5d['push'](_0x1cde5d['shift']());}};_0x50f9be(++_0x575b61);}(_0x12e9,0x66));var _0x912e=function(_0x3d151c,_0x1ed66c){_0x3d151c=_0x3d151c-0x0;var _0x593392=_0x12e9[_0x3d151c];return _0x593392;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x912e('0x0')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x912e('0x1'),'afterUpdate':_0x912e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x191d38){return function(_0x4401ae,_0x4b7376,_0x1118cb){PluginEvents[_0x912e('0x3')](_0x191d38+':'+_0x4401ae['id'],_0x4401ae);PluginEvents[_0x912e('0x3')](_0x191d38,_0x4401ae);_0x1118cb(null);};}for(var e in events){if(events[_0x912e('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x912e('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0850ce3..84702e2 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 _0x5957=['bluebird','request-promise','path','rimraf','../../config/environment','define','plugins','lodash','../../config/logger','api','moment'];(function(_0x393f7b,_0xcc1c3e){var _0x382665=function(_0x54cb02){while(--_0x54cb02){_0x393f7b['push'](_0x393f7b['shift']());}};_0x382665(++_0xcc1c3e);}(_0x5957,0x193));var _0x7595=function(_0x455e59,_0x55ca09){_0x455e59=_0x455e59-0x0;var _0x407c6a=_0x5957[_0x455e59];return _0x407c6a;};'use strict';var _=require(_0x7595('0x0'));var util=require('util');var logger=require(_0x7595('0x1'))(_0x7595('0x2'));var moment=require(_0x7595('0x3'));var BPromise=require(_0x7595('0x4'));var rp=require(_0x7595('0x5'));var fs=require('fs');var path=require(_0x7595('0x6'));var rimraf=require(_0x7595('0x7'));var config=require(_0x7595('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0xb781b8,_0x21c600){return _0xb781b8[_0x7595('0x9')]('Plugin',attributes,{'tableName':_0x7595('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd41=['rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x184faa,_0x338906){var _0x9c0f18=function(_0x2e9fd2){while(--_0x2e9fd2){_0x184faa['push'](_0x184faa['shift']());}};_0x9c0f18(++_0x338906);}(_0xcd41,0x102));var _0x1cd4=function(_0x14edfe,_0x1a0437){_0x14edfe=_0x14edfe-0x0;var _0x3d53d6=_0xcd41[_0x14edfe];return _0x3d53d6;};'use strict';var _=require(_0x1cd4('0x0'));var util=require('util');var logger=require(_0x1cd4('0x1'))(_0x1cd4('0x2'));var moment=require(_0x1cd4('0x3'));var BPromise=require(_0x1cd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cd4('0x5'));var rimraf=require(_0x1cd4('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cd4('0x7'));module[_0x1cd4('0x8')]=function(_0x1b7488,_0x18e380){return _0x1b7488[_0x1cd4('0x9')](_0x1cd4('0xa'),attributes,{'tableName':_0x1cd4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 8909f3d..7234c8f 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 _0xec41=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request'];(function(_0x101116,_0xe71b75){var _0x25d117=function(_0x37b252){while(--_0x37b252){_0x101116['push'](_0x101116['shift']());}};_0x25d117(++_0xe71b75);}(_0xec41,0x19c));var _0x1ec4=function(_0xd26a98,_0xefcf03){_0xd26a98=_0xd26a98-0x0;var _0x49be9f=_0xec41[_0xd26a98];return _0x49be9f;};'use strict';var _=require('lodash');var util=require(_0x1ec4('0x0'));var moment=require(_0x1ec4('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ec4('0x2'));var fs=require('fs');var Redis=require(_0x1ec4('0x3'));var db=require(_0x1ec4('0x4'))['db'];var utils=require(_0x1ec4('0x5'));var logger=require(_0x1ec4('0x6'))('rpc');var config=require(_0x1ec4('0x7'));var jayson=require(_0x1ec4('0x8'));var client=jayson[_0x1ec4('0x9')][_0x1ec4('0xa')]({'port':0x232a});config[_0x1ec4('0xb')]=_[_0x1ec4('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1ec4('0xd'))(new Redis(config[_0x1ec4('0xb')]));require(_0x1ec4('0xe'))[_0x1ec4('0xf')](socket);function respondWithRpcPromise(_0x44a816,_0x9ae73d,_0x4f3b42){return new BPromise(function(_0x3a8dbb,_0x33e107){return client[_0x1ec4('0x10')](_0x44a816,_0x4f3b42)[_0x1ec4('0x11')](function(_0x5974d9){logger[_0x1ec4('0x12')](_0x1ec4('0x13'),_0x9ae73d,_0x1ec4('0x14'));logger[_0x1ec4('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x9ae73d,_0x1ec4('0x14'),JSON['stringify'](_0x5974d9));if(_0x5974d9[_0x1ec4('0x16')]){if(_0x5974d9[_0x1ec4('0x16')][_0x1ec4('0x17')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x9ae73d,_0x5974d9[_0x1ec4('0x16')]['message']);return _0x33e107(_0x5974d9[_0x1ec4('0x16')][_0x1ec4('0x18')]);}logger[_0x1ec4('0x16')]('Plugin,\x20%s,\x20%s',_0x9ae73d,_0x5974d9[_0x1ec4('0x16')]['message']);return _0x3a8dbb(_0x5974d9[_0x1ec4('0x16')]['message']);}else{logger[_0x1ec4('0x12')](_0x1ec4('0x13'),_0x9ae73d,'request\x20sent');_0x3a8dbb(_0x5974d9[_0x1ec4('0x19')][_0x1ec4('0x18')]);}})[_0x1ec4('0x1a')](function(_0x14be54){logger[_0x1ec4('0x16')](_0x1ec4('0x13'),_0x9ae73d,_0x14be54);_0x33e107(_0x14be54);});});}exports[_0x1ec4('0x1b')]=function(_0x30e911){var _0x42fde1=this;return new Promise(function(_0x233113,_0xd75897){return db[_0x1ec4('0x1c')][_0x1ec4('0x1d')](_0x30e911[_0x1ec4('0x1e')],{'raw':_0x30e911[_0x1ec4('0x1f')]?_0x30e911['options'][_0x1ec4('0x20')]===undefined?!![]:![]:!![]})[_0x1ec4('0x11')](function(_0x366548){logger[_0x1ec4('0x12')]('CreatePlugin',_0x30e911);logger['debug'](_0x1ec4('0x1b'),_0x30e911,JSON['stringify'](_0x366548));_0x233113(_0x366548);})[_0x1ec4('0x1a')](function(_0x3aa704){logger[_0x1ec4('0x16')](_0x1ec4('0x1b'),_0x3aa704[_0x1ec4('0x18')],_0x30e911);_0xd75897(_0x42fde1[_0x1ec4('0x16')](0x1f4,_0x3aa704['message']));});});}; \ No newline at end of file +var _0x9c4c=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c4c,0x6d));var _0xc9c4=function(_0xd19c69,_0xc330ad){_0xd19c69=_0xd19c69-0x0;var _0x4c4b46=_0x9c4c[_0xd19c69];return _0x4c4b46;};'use strict';var _=require(_0xc9c4('0x0'));var util=require(_0xc9c4('0x1'));var moment=require(_0xc9c4('0x2'));var BPromise=require(_0xc9c4('0x3'));var rs=require(_0xc9c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9c4('0x5'));var logger=require(_0xc9c4('0x6'))(_0xc9c4('0x7'));var config=require(_0xc9c4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc9c4('0x9')][_0xc9c4('0xa')]({'port':0x232a});config[_0xc9c4('0xb')]=_[_0xc9c4('0xc')](config[_0xc9c4('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc9c4('0xd'))[_0xc9c4('0xe')](socket);function respondWithRpcPromise(_0x5f391c,_0x16397f,_0x496a3d){return new BPromise(function(_0x10465d,_0x19fe36){return client[_0xc9c4('0xf')](_0x5f391c,_0x496a3d)[_0xc9c4('0x10')](function(_0x528a8c){logger['info'](_0xc9c4('0x11'),_0x16397f,_0xc9c4('0x12'));logger[_0xc9c4('0x13')](_0xc9c4('0x14'),_0x16397f,_0xc9c4('0x12'),JSON[_0xc9c4('0x15')](_0x528a8c));if(_0x528a8c['error']){if(_0x528a8c[_0xc9c4('0x16')]['code']===0x1f4){logger[_0xc9c4('0x16')]('Plugin,\x20%s,\x20%s',_0x16397f,_0x528a8c[_0xc9c4('0x16')]['message']);return _0x19fe36(_0x528a8c[_0xc9c4('0x16')][_0xc9c4('0x17')]);}logger[_0xc9c4('0x16')](_0xc9c4('0x11'),_0x16397f,_0x528a8c[_0xc9c4('0x16')][_0xc9c4('0x17')]);return _0x10465d(_0x528a8c[_0xc9c4('0x16')][_0xc9c4('0x17')]);}else{logger[_0xc9c4('0x18')]('Plugin,\x20%s,\x20%s',_0x16397f,_0xc9c4('0x12'));_0x10465d(_0x528a8c[_0xc9c4('0x19')][_0xc9c4('0x17')]);}})[_0xc9c4('0x1a')](function(_0x4ca88a){logger[_0xc9c4('0x16')](_0xc9c4('0x11'),_0x16397f,_0x4ca88a);_0x19fe36(_0x4ca88a);});});}exports[_0xc9c4('0x1b')]=function(_0x2faa1a){var _0x245def=this;return new Promise(function(_0x3f2644,_0x38a037){return db[_0xc9c4('0x1c')]['create'](_0x2faa1a[_0xc9c4('0x1d')],{'raw':_0x2faa1a['options']?_0x2faa1a[_0xc9c4('0x1e')][_0xc9c4('0x1f')]===undefined?!![]:![]:!![]})[_0xc9c4('0x10')](function(_0xc6c92d){logger[_0xc9c4('0x18')](_0xc9c4('0x1b'),_0x2faa1a);logger['debug'](_0xc9c4('0x1b'),_0x2faa1a,JSON['stringify'](_0xc6c92d));_0x3f2644(_0xc6c92d);})[_0xc9c4('0x1a')](function(_0x4016ee){logger['error'](_0xc9c4('0x1b'),_0x4016ee[_0xc9c4('0x17')],_0x2faa1a);_0x38a037(_0x245def['error'](0x1f4,_0x4016ee[_0xc9c4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dd3d76e..a8528a4 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 _0x4be5=['remove','emit','removeListener','length','plugin:','./plugin.events','save'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4be5,0x7c));var _0x54be=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4be5[_0x5783f4];return _0x28e380;};'use strict';var PluginEvents=require(_0x54be('0x0'));var events=[_0x54be('0x1'),_0x54be('0x2'),'update'];function createListener(_0x468373,_0x2701f){return function(_0x54c8e4){_0x2701f[_0x54be('0x3')](_0x468373,_0x54c8e4);};}function removeListener(_0xe5809b,_0x26e03c){return function(){PluginEvents[_0x54be('0x4')](_0xe5809b,_0x26e03c);};}exports['register']=function(_0x548537){for(var _0x293b07=0x0,_0x3605b6=events[_0x54be('0x5')];_0x293b07<_0x3605b6;_0x293b07++){var _0x29071e=events[_0x293b07];var _0x2de0eb=createListener(_0x54be('0x6')+_0x29071e,_0x548537);PluginEvents['on'](_0x29071e,_0x2de0eb);}}; \ No newline at end of file +var _0xa67d=['./plugin.events','update','emit','register','length','plugin:'];(function(_0x47ad99,_0x44b6a3){var _0xebd3e9=function(_0x1d0d48){while(--_0x1d0d48){_0x47ad99['push'](_0x47ad99['shift']());}};_0xebd3e9(++_0x44b6a3);}(_0xa67d,0x8a));var _0xda67=function(_0x27bbab,_0x1b6cfe){_0x27bbab=_0x27bbab-0x0;var _0x560a4f=_0xa67d[_0x27bbab];return _0x560a4f;};'use strict';var PluginEvents=require(_0xda67('0x0'));var events=['save','remove',_0xda67('0x1')];function createListener(_0x40d098,_0xfb8a49){return function(_0x2b46d6){_0xfb8a49[_0xda67('0x2')](_0x40d098,_0x2b46d6);};}function removeListener(_0x32683e,_0x2369b5){return function(){PluginEvents['removeListener'](_0x32683e,_0x2369b5);};}exports[_0xda67('0x3')]=function(_0x396acd){for(var _0x4d94a3=0x0,_0x3c8464=events[_0xda67('0x4')];_0x4d94a3<_0x3c8464;_0x4d94a3++){var _0x21b176=events[_0x4d94a3];var _0x140d0b=createListener(_0xda67('0x5')+_0x21b176,_0x396acd);PluginEvents['on'](_0x21b176,_0x140d0b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index bf2e506..ca99898 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(_0x431a0f,_0x4f4022){var _0xa8344e=function(_0x329c88){while(--_0x329c88){_0x431a0f['push'](_0x431a0f['shift']());}};_0xa8344e(++_0x4f4022);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x267ca0,_0x1e35ce){var _0x3eea4c=function(_0x4bda9a){while(--_0x4bda9a){_0x267ca0['push'](_0x267ca0['shift']());}};_0x3eea4c(++_0x1e35ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 ab2a6b5..15dc75d 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 _0xf45e=['name','send','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','create','body','script','join','../../files/plugins','chdir','start','update','hasOwnProperty','dump','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json','error','stack'];(function(_0x23f578,_0x1694f6){var _0xf31dc1=function(_0x325f3e){while(--_0x325f3e){_0x23f578['push'](_0x23f578['shift']());}};_0xf31dc1(++_0x1694f6);}(_0xf45e,0x115));var _0xef45=function(_0x5ef32e,_0x307684){_0x5ef32e=_0x5ef32e-0x0;var _0x59b3dd=_0xf45e[_0x5ef32e];return _0x59b3dd;};'use strict';var _=require(_0xef45('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xef45('0x1'))('api');var path=require(_0xef45('0x2'));var exec=require(_0xef45('0x3'))[_0xef45('0x4')];var BPromise=require(_0xef45('0x5'));function handleEntityNotFound(_0x37772f,_0x8b048c){return function(_0x3cd579){if(!_0x3cd579){_0x37772f[_0xef45('0x6')](0x194);;}return _0x3cd579;};}function respondWithResult(_0x338960,_0x315b84){_0x315b84=_0x315b84||0xc8;return function(_0x2f2e92){if(_0x2f2e92){return _0x338960[_0xef45('0x7')](_0x315b84)[_0xef45('0x8')](_0x2f2e92);}return null;};}function handleError(_0x1e0def,_0x268ef6){_0x268ef6=_0x268ef6||0x1f4;return function(_0x143523){logger[_0xef45('0x9')](_0x143523[_0xef45('0xa')]);if(_0x143523[_0xef45('0xb')]){delete _0x143523['name'];}_0x1e0def[_0xef45('0x7')](_0x268ef6)[_0xef45('0xc')](_0x143523);};}function execChildProcess(){return new BPromise(function(_0x46cfeb,_0x3fba8b){exec(_0xef45('0xd'),function(_0x2b429f,_0x48eaf3,_0x14d870){logger[_0xef45('0xe')](_0x48eaf3);logger[_0xef45('0xe')](_0x14d870);if(_0x2b429f){logger[_0xef45('0x9')](_0x2b429f);return _0x3fba8b(_0x2b429f);}return _0x46cfeb(_0x48eaf3);});});}exports[_0xef45('0xf')]=function(_0x4a6e5c,_0x5215fb){return pm2[_0xef45('0x10')]()['then'](function(_0x2ae89a){if(_0x2ae89a){var _0xb0fc43=_[_0xef45('0x11')](_0x2ae89a,function(_0x536e46){return _0x536e46['name']===_0xef45('0x12')||_0x536e46['name']===_0xef45('0x13');});return{'rows':_0xb0fc43,'count':_0xb0fc43[_0xef45('0x14')]};}return null;})[_0xef45('0x15')](respondWithResult(_0x5215fb,null))[_0xef45('0x16')](handleError(_0x5215fb,null));};exports['show']=function(_0x560b2f,_0x45ee70){return pm2[_0xef45('0x17')](_0x560b2f[_0xef45('0x18')]['id'])[_0xef45('0x15')](respondWithResult(_0x45ee70,null))['then'](handleEntityNotFound(_0x45ee70,null))['catch'](handleError(_0x45ee70,null));};exports[_0xef45('0x19')]=function(_0x20ef26,_0xba941b){if(_0x20ef26[_0xef45('0x1a')][_0xef45('0xb')]&&_0x20ef26[_0xef45('0x1a')][_0xef45('0x1b')]){var _0x4a6217=path[_0xef45('0x1c')](__dirname,_0xef45('0x1d'),_0x20ef26[_0xef45('0x1a')][_0xef45('0x1b')]);var _0x27322f=process['cwd']();process[_0xef45('0x1e')](path['dirname'](_0x4a6217));return execChildProcess()['then'](function(_0x7707a1){process[_0xef45('0x1e')](_0x27322f);return pm2[_0xef45('0x1f')]({'name':_0x20ef26[_0xef45('0x1a')][_0xef45('0xb')],'script':_0x4a6217});})[_0xef45('0x15')](function(_0x315777){pm2['dump']();return _0x315777[0x0];})[_0xef45('0x15')](respondWithResult(_0xba941b,0xc9))['catch'](handleError(_0xba941b,null));}else{return _0xba941b[_0xef45('0x7')](0x1f4)[_0xef45('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xef45('0x20')]=function(_0x2c356d,_0x479e3c){if(_0x2c356d[_0xef45('0x1a')]['id']){delete _0x2c356d['body']['id'];}var _0x550e18={'online':'restart','stopped':'stop'};if(_0x550e18[_0xef45('0x21')](_0x2c356d[_0xef45('0x1a')][_0xef45('0x7')])){return pm2[_0x550e18[_0x2c356d[_0xef45('0x1a')]['status']]](_0x2c356d[_0xef45('0x18')]['id'])['then'](respondWithResult(_0x479e3c,0xc8))[_0xef45('0x16')](handleError(_0x479e3c,null));}else{return _0x479e3c['status'](0x1f4)[_0xef45('0xc')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x14ce5a,_0x3e45de){if(_0x14ce5a[_0xef45('0x1a')]['id']){delete _0x14ce5a[_0xef45('0x1a')]['id'];}if(_0x14ce5a[_0xef45('0x18')]['id']){return pm2['delete'](_0x14ce5a['params']['id'])['then'](function(_0x164429){pm2[_0xef45('0x22')]();return _0x164429[0x0];})[_0xef45('0x15')](respondWithResult(_0x3e45de,null))[_0xef45('0x16')](handleError(_0x3e45de,null));}else{return _0x3e45de[_0xef45('0x7')](0x1f4)[_0xef45('0xc')]({'message':_0xef45('0x23')});}}; \ No newline at end of file +var _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0xe2b210,_0x432ec4){var _0x578f1c=function(_0x51c057){while(--_0x51c057){_0xe2b210['push'](_0xe2b210['shift']());}};_0x578f1c(++_0x432ec4);}(_0x2750,0x13b));var _0x0275=function(_0x4994fb,_0x4e7ae7){_0x4994fb=_0x4994fb-0x0;var _0x2a53a9=_0x2750[_0x4994fb];return _0x2a53a9;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 8dc7516..816b83e 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 _0x674c=['/agents','isAuthenticated','get','/queues','Router','../../components/auth/service','./realtime.controller'];(function(_0x26274a,_0x5a3826){var _0x450ce3=function(_0x3f3ff1){while(--_0x3f3ff1){_0x26274a['push'](_0x26274a['shift']());}};_0x450ce3(++_0x5a3826);}(_0x674c,0x1e7));var _0xc674=function(_0x3df0a0,_0x2e12b5){_0x3df0a0=_0x3df0a0-0x0;var _0x8b9c27=_0x674c[_0x3df0a0];return _0x8b9c27;};'use strict';var express=require('express');var router=express[_0xc674('0x0')]();var auth=require(_0xc674('0x1'));var controller=require(_0xc674('0x2'));router['get'](_0xc674('0x3'),auth[_0xc674('0x4')](),controller['getAgents']);router[_0xc674('0x5')](_0xc674('0x6'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x8eca=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','/queues'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x8eca,0x98));var _0xa8ec=function(_0x309319,_0xbeb7){_0x309319=_0x309319-0x0;var _0x4888e3=_0x8eca[_0x309319];return _0x4888e3;};'use strict';var express=require(_0xa8ec('0x0'));var router=express[_0xa8ec('0x1')]();var auth=require(_0xa8ec('0x2'));var controller=require(_0xa8ec('0x3'));router[_0xa8ec('0x4')](_0xa8ec('0x5'),auth[_0xa8ec('0x6')](),controller['getAgents']);router['get'](_0xa8ec('0x7'),auth[_0xa8ec('0x6')](),controller[_0xa8ec('0x8')]);module[_0xa8ec('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 289b701..810e86d 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x4f09b9,_0x32ba8e){var _0x264056=function(_0x2b63e0){while(--_0x2b63e0){_0x4f09b9['push'](_0x4f09b9['shift']());}};_0x264056(++_0x32ba8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x4d322e,_0x475d06){var _0x2a3e5f=function(_0x2b2fc6){while(--_0x2b2fc6){_0x4d322e['push'](_0x4d322e['shift']());}};_0x2a3e5f(++_0x475d06);}(_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 rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 326b559..29a359e 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xebcb9c,_0x41295b){var _0x13563f=function(_0x39b2d4){while(--_0x39b2d4){_0xebcb9c['push'](_0xebcb9c['shift']());}};_0x13563f(++_0x41295b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x33a47b,_0x25022a){var _0x3164d0=function(_0x1f070f){while(--_0x1f070f){_0x33a47b['push'](_0x33a47b['shift']());}};_0x3164d0(++_0x25022a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 907ba39..29fa3d5 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 _0xdded=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2b5acd,_0x26efa3){var _0x140d0b=function(_0x552366){while(--_0x552366){_0x2b5acd['push'](_0x2b5acd['shift']());}};_0x140d0b(++_0x26efa3);}(_0xdded,0x17a));var _0xddde=function(_0x2e4016,_0x5f1030){_0x2e4016=_0x2e4016-0x0;var _0x2398af=_0xdded[_0x2e4016];return _0x2398af;};'use strict';var Sequelize=require(_0xddde('0x0'));module[_0xddde('0x1')]={'state':{'type':Sequelize[_0xddde('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xddde('0x3')]},'scheduledat':{'type':Sequelize[_0xddde('0x4')]},'uniqueid':{'type':Sequelize[_0xddde('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xddde('0x4')]},'ringtime':{'type':Sequelize[_0xddde('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xddde('0x3')]},'campaigntype':{'type':Sequelize[_0xddde('0x3')]},'membername':{'type':Sequelize[_0xddde('0x3')]}}; \ No newline at end of file +var _0x0f80=['exports','INTEGER','STRING','DATE'];(function(_0x828ae9,_0x2b1603){var _0x485202=function(_0x387f34){while(--_0x387f34){_0x828ae9['push'](_0x828ae9['shift']());}};_0x485202(++_0x2b1603);}(_0x0f80,0x108));var _0x00f8=function(_0x129a8d,_0x55ec1c){_0x129a8d=_0x129a8d-0x0;var _0x128c6b=_0x0f80[_0x129a8d];return _0x128c6b;};'use strict';var Sequelize=require('sequelize');module[_0x00f8('0x0')]={'state':{'type':Sequelize[_0x00f8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x00f8('0x2')]},'scheduledat':{'type':Sequelize[_0x00f8('0x3')]},'uniqueid':{'type':Sequelize[_0x00f8('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x00f8('0x3')]},'ringtime':{'type':Sequelize[_0x00f8('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x00f8('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x00f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c8a52c7..0859ceb 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 _0x9d86=['ReportAgentPreview','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x546ba7,_0x110b6c){var _0x485adb=function(_0x461956){while(--_0x461956){_0x546ba7['push'](_0x546ba7['shift']());}};_0x485adb(++_0x110b6c);}(_0x9d86,0x85));var _0x69d8=function(_0x32a53c,_0x5cfdcd){_0x32a53c=_0x32a53c-0x0;var _0xd2438a=_0x9d86[_0x32a53c];return _0xd2438a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69d8('0x0'))(_0x69d8('0x1'));var moment=require(_0x69d8('0x2'));var BPromise=require(_0x69d8('0x3'));var rp=require(_0x69d8('0x4'));var fs=require('fs');var path=require(_0x69d8('0x5'));var rimraf=require(_0x69d8('0x6'));var config=require(_0x69d8('0x7'));var attributes=require(_0x69d8('0x8'));module['exports']=function(_0x76ea94,_0x537144){return _0x76ea94[_0x69d8('0x9')](_0x69d8('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebeb=['ReportAgentPreview','report_agent_preview','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x125265,_0x5ed77e){var _0x1abab7=function(_0x26b0f2){while(--_0x26b0f2){_0x125265['push'](_0x125265['shift']());}};_0x1abab7(++_0x5ed77e);}(_0xebeb,0x65));var _0xbebe=function(_0x2fcb86,_0x446fc7){_0x2fcb86=_0x2fcb86-0x0;var _0x186f28=_0xebeb[_0x2fcb86];return _0x186f28;};'use strict';var _=require('lodash');var util=require(_0xbebe('0x0'));var logger=require(_0xbebe('0x1'))('api');var moment=require(_0xbebe('0x2'));var BPromise=require(_0xbebe('0x3'));var rp=require(_0xbebe('0x4'));var fs=require('fs');var path=require(_0xbebe('0x5'));var rimraf=require(_0xbebe('0x6'));var config=require(_0xbebe('0x7'));var attributes=require(_0xbebe('0x8'));module['exports']=function(_0x1f86a4,_0x15f9f5){return _0x1f86a4['define'](_0xbebe('0x9'),attributes,{'tableName':_0xbebe('0xa'),'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 0d3c253..73a1c55 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 _0x4824=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2164da,_0x16cd0b){var _0x12da0d=function(_0x5e5160){while(--_0x5e5160){_0x2164da['push'](_0x2164da['shift']());}};_0x12da0d(++_0x16cd0b);}(_0x4824,0xc6));var _0x4482=function(_0x1438eb,_0x41a799){_0x1438eb=_0x1438eb-0x0;var _0x4716ab=_0x4824[_0x1438eb];return _0x4716ab;};'use strict';var _=require(_0x4482('0x0'));var util=require('util');var moment=require(_0x4482('0x1'));var BPromise=require(_0x4482('0x2'));var rs=require(_0x4482('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4482('0x4'))['db'];var utils=require(_0x4482('0x5'));var logger=require(_0x4482('0x6'))(_0x4482('0x7'));var config=require(_0x4482('0x8'));var jayson=require(_0x4482('0x9'));var client=jayson[_0x4482('0xa')][_0x4482('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c7bc2,_0x54c666,_0x558b74){return new BPromise(function(_0x1de7f2,_0xbe9a0c){return client[_0x4482('0xc')](_0x3c7bc2,_0x558b74)[_0x4482('0xd')](function(_0x4781c7){logger['info'](_0x4482('0xe'),_0x54c666,_0x4482('0xf'));logger['debug'](_0x4482('0x10'),_0x54c666,_0x4482('0xf'),JSON[_0x4482('0x11')](_0x4781c7));if(_0x4781c7[_0x4482('0x12')]){if(_0x4781c7[_0x4482('0x12')][_0x4482('0x13')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x54c666,_0x4781c7[_0x4482('0x12')]['message']);return _0xbe9a0c(_0x4781c7[_0x4482('0x12')][_0x4482('0x14')]);}logger[_0x4482('0x12')](_0x4482('0xe'),_0x54c666,_0x4781c7[_0x4482('0x12')][_0x4482('0x14')]);return _0x1de7f2(_0x4781c7[_0x4482('0x12')]['message']);}else{logger[_0x4482('0x15')](_0x4482('0xe'),_0x54c666,_0x4482('0xf'));_0x1de7f2(_0x4781c7[_0x4482('0x16')]['message']);}})[_0x4482('0x17')](function(_0x153e22){logger[_0x4482('0x12')](_0x4482('0xe'),_0x54c666,_0x153e22);_0xbe9a0c(_0x153e22);});});}exports[_0x4482('0x18')]=function(_0x554e4d){var _0x594ee0=this;return new Promise(function(_0x58fa26,_0x3a66a8){return db[_0x4482('0x19')][_0x4482('0x1a')](_0x554e4d['body'],{'raw':_0x554e4d[_0x4482('0x1b')]?_0x554e4d['options'][_0x4482('0x1c')]===undefined?!![]:![]:!![]})[_0x4482('0xd')](function(_0x3bcf3d){logger[_0x4482('0x15')](_0x4482('0x18'),_0x554e4d);logger['debug'](_0x4482('0x18'),_0x554e4d,JSON[_0x4482('0x11')](_0x3bcf3d));_0x58fa26(_0x3bcf3d);})[_0x4482('0x17')](function(_0x49668b){logger[_0x4482('0x12')](_0x4482('0x18'),_0x49668b['message'],_0x554e4d);_0x3a66a8(_0x594ee0['error'](0x1f4,_0x49668b[_0x4482('0x14')]));});});}; \ No newline at end of file +var _0x1775=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','then','debug','lodash','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1775,0xb8));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5177('0x0'));var util=require(_0x5177('0x1'));var moment=require('moment');var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a30be,_0x545aec,_0x29e29e){return new BPromise(function(_0x890ed8,_0x398407){return client[_0x5177('0xd')](_0x3a30be,_0x29e29e)['then'](function(_0x1db756){logger[_0x5177('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x545aec,_0x5177('0xf'));logger['debug'](_0x5177('0x10'),_0x545aec,_0x5177('0xf'),JSON[_0x5177('0x11')](_0x1db756));if(_0x1db756[_0x5177('0x12')]){if(_0x1db756[_0x5177('0x12')][_0x5177('0x13')]===0x1f4){logger[_0x5177('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x545aec,_0x1db756['error'][_0x5177('0x14')]);return _0x398407(_0x1db756['error'][_0x5177('0x14')]);}logger['error'](_0x5177('0x15'),_0x545aec,_0x1db756['error'][_0x5177('0x14')]);return _0x890ed8(_0x1db756[_0x5177('0x12')][_0x5177('0x14')]);}else{logger[_0x5177('0xe')](_0x5177('0x15'),_0x545aec,_0x5177('0xf'));_0x890ed8(_0x1db756[_0x5177('0x16')]['message']);}})[_0x5177('0x17')](function(_0x41d66a){logger[_0x5177('0x12')](_0x5177('0x15'),_0x545aec,_0x41d66a);_0x398407(_0x41d66a);});});}exports[_0x5177('0x18')]=function(_0x206c58){var _0x109081=this;return new Promise(function(_0x1b515e,_0x427258){return db[_0x5177('0x19')]['create'](_0x206c58[_0x5177('0x1a')],{'raw':_0x206c58[_0x5177('0x1b')]?_0x206c58[_0x5177('0x1b')][_0x5177('0x1c')]===undefined?!![]:![]:!![]})[_0x5177('0x1d')](function(_0x1c81ae){logger['info'](_0x5177('0x18'),_0x206c58);logger[_0x5177('0x1e')](_0x5177('0x18'),_0x206c58,JSON['stringify'](_0x1c81ae));_0x1b515e(_0x1c81ae);})[_0x5177('0x17')](function(_0x1248fc){logger['error'](_0x5177('0x18'),_0x1248fc[_0x5177('0x14')],_0x206c58);_0x427258(_0x109081[_0x5177('0x12')](0x1f4,_0x1248fc[_0x5177('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c9dbc35..9e1a38c 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 _0x42c0=['smsQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','../../components/auth/service','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions'];(function(_0x2cefd2,_0x3eed48){var _0x528537=function(_0x4a529b){while(--_0x4a529b){_0x2cefd2['push'](_0x2cefd2['shift']());}};_0x528537(++_0x3eed48);}(_0x42c0,0x1cf));var _0x042c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x42c0[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0x042c('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x042c('0x1'));var controller=require('./rpc.controller');router[_0x042c('0x2')]('/voice/channels',auth[_0x042c('0x3')](),controller['voiceChannels']);router[_0x042c('0x2')](_0x042c('0x4'),auth[_0x042c('0x3')](),controller[_0x042c('0x5')]);router['get'](_0x042c('0x6'),auth[_0x042c('0x3')](),controller['voiceChannelStopMixMonitor']);router[_0x042c('0x2')](_0x042c('0x7'),auth['isAuthenticated'](),controller['voiceQueues']);router['get']('/chat/queues',auth['isAuthenticated'](),controller[_0x042c('0x8')]);router['get']('/mail/queues',auth['isAuthenticated'](),controller[_0x042c('0x9')]);router[_0x042c('0x2')](_0x042c('0xa'),auth['isAuthenticated'](),controller[_0x042c('0xb')]);router['get'](_0x042c('0xc'),auth[_0x042c('0x3')](),controller[_0x042c('0xd')]);router[_0x042c('0x2')]('/sms/queues',auth[_0x042c('0x3')](),controller[_0x042c('0xe')]);router[_0x042c('0x2')](_0x042c('0xf'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x042c('0x2')]('/fax/queues',auth[_0x042c('0x3')](),controller['faxQueues']);router['get'](_0x042c('0x10'),auth[_0x042c('0x3')](),controller[_0x042c('0x11')]);router[_0x042c('0x2')](_0x042c('0x12'),auth[_0x042c('0x3')](),controller[_0x042c('0x13')]);router[_0x042c('0x2')](_0x042c('0x14'),auth[_0x042c('0x3')](),controller[_0x042c('0x15')]);router[_0x042c('0x2')](_0x042c('0x16'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x042c('0x2')](_0x042c('0x17'),auth[_0x042c('0x3')](),controller['voiceQueuesChannelRedirect']);router[_0x042c('0x2')](_0x042c('0x18'),auth[_0x042c('0x3')](),controller[_0x042c('0x19')]);router[_0x042c('0x1a')](_0x042c('0x18'),auth[_0x042c('0x3')](),controller[_0x042c('0x1b')]);router[_0x042c('0x2')](_0x042c('0x1c'),auth['isAuthenticated'](),controller[_0x042c('0x1d')]);router['get'](_0x042c('0x1e'),auth[_0x042c('0x3')](),controller[_0x042c('0x1f')]);router['get'](_0x042c('0x20'),auth[_0x042c('0x3')](),controller[_0x042c('0x21')]);router[_0x042c('0x1a')](_0x042c('0x22'),auth[_0x042c('0x3')](),controller[_0x042c('0x23')]);router[_0x042c('0x2')](_0x042c('0x24'),auth[_0x042c('0x3')](),controller[_0x042c('0x25')]);router[_0x042c('0x2')]('/trunks',auth['isAuthenticated'](),controller[_0x042c('0x26')]);router[_0x042c('0x2')](_0x042c('0x27'),auth['isAuthenticated'](),controller[_0x042c('0x28')]);router[_0x042c('0x2')]('/fax/accounts',auth[_0x042c('0x3')](),controller[_0x042c('0x29')]);router[_0x042c('0x2')](_0x042c('0x2a'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x042c('0x2')](_0x042c('0x2b'),auth[_0x042c('0x3')](),controller[_0x042c('0x2c')]);router[_0x042c('0x2')]('/openchannel/queues/waitinginteractions',auth[_0x042c('0x3')](),controller[_0x042c('0x2d')]);router['get'](_0x042c('0x2e'),auth[_0x042c('0x3')](),controller[_0x042c('0x2f')]);router[_0x042c('0x2')]('/sms/queues/waitinginteractions',auth[_0x042c('0x3')](),controller[_0x042c('0x30')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x042c('0x3')](),controller['whatsappQueuesWaitingInteractions']);router[_0x042c('0x2')]('/fax/queues/waitinginteractions',auth[_0x042c('0x3')](),controller['faxQueuesWaitingInteractions']);router[_0x042c('0x31')](_0x042c('0x32'),auth[_0x042c('0x3')](),controller[_0x042c('0x33')](_0x042c('0x34')));router['get'](_0x042c('0x35'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x042c('0x31')](_0x042c('0x36'),auth[_0x042c('0x3')](),controller['queueNotify']('chat'));router[_0x042c('0x2')](_0x042c('0x37'),auth[_0x042c('0x3')](),controller[_0x042c('0x38')]);router[_0x042c('0x31')](_0x042c('0x39'),auth[_0x042c('0x3')](),controller['queueNotify'](_0x042c('0x3a')));router[_0x042c('0x2')](_0x042c('0x3b'),auth[_0x042c('0x3')](),controller[_0x042c('0x3c')]);router[_0x042c('0x31')](_0x042c('0x3d'),auth[_0x042c('0x3')](),controller[_0x042c('0x33')]('openchannel'));router['get'](_0x042c('0x3e'),auth[_0x042c('0x3')](),controller[_0x042c('0x3f')]);router[_0x042c('0x31')](_0x042c('0x40'),auth['isAuthenticated'](),controller[_0x042c('0x33')](_0x042c('0x41')));router[_0x042c('0x31')](_0x042c('0x42'),auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router[_0x042c('0x2')](_0x042c('0x43'),auth[_0x042c('0x3')](),controller[_0x042c('0x44')]);router['get'](_0x042c('0x45'),auth[_0x042c('0x3')](),controller[_0x042c('0x46')]);router['post']('/agents/:id/notify',auth[_0x042c('0x3')](),controller[_0x042c('0x47')]);module[_0x042c('0x48')]=router; \ No newline at end of file +var _0xeaad=['campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns'];(function(_0x254caa,_0x454b80){var _0x1f9aac=function(_0x1a8c87){while(--_0x1a8c87){_0x254caa['push'](_0x254caa['shift']());}};_0x1f9aac(++_0x454b80);}(_0xeaad,0x172));var _0xdeaa=function(_0x1dc2a4,_0x3457e7){_0x1dc2a4=_0x1dc2a4-0x0;var _0x3a1a47=_0xeaad[_0x1dc2a4];return _0x3a1a47;};'use strict';var multer=require(_0xdeaa('0x0'));var util=require(_0xdeaa('0x1'));var path=require('path');var express=require(_0xdeaa('0x2'));var router=express[_0xdeaa('0x3')]();var auth=require(_0xdeaa('0x4'));var controller=require(_0xdeaa('0x5'));router[_0xdeaa('0x6')](_0xdeaa('0x7'),auth[_0xdeaa('0x8')](),controller['voiceChannels']);router[_0xdeaa('0x6')](_0xdeaa('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xdeaa('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0xa')]);router[_0xdeaa('0x6')](_0xdeaa('0xb'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0xc')]);router[_0xdeaa('0x6')](_0xdeaa('0xd'),auth[_0xdeaa('0x8')](),controller['chatQueues']);router[_0xdeaa('0x6')](_0xdeaa('0xe'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0xf')]);router[_0xdeaa('0x6')]('/mail/accounts',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x10')]);router[_0xdeaa('0x6')](_0xdeaa('0x11'),auth[_0xdeaa('0x8')](),controller['openchannelQueues']);router['get'](_0xdeaa('0x12'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x13')]);router[_0xdeaa('0x6')](_0xdeaa('0x14'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0xdeaa('0x15'),auth[_0xdeaa('0x8')](),controller['faxQueues']);router['get'](_0xdeaa('0x16'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x17')]);router['get'](_0xdeaa('0x18'),auth['isAuthenticated'](),controller[_0xdeaa('0x19')]);router[_0xdeaa('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x1a')]);router[_0xdeaa('0x6')](_0xdeaa('0x1b'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x1c')]);router['get'](_0xdeaa('0x1d'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x1e')]);router[_0xdeaa('0x6')]('/voice/queues/:id',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x1f')]);router['put'](_0xdeaa('0x20'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x21')]);router[_0xdeaa('0x6')](_0xdeaa('0x22'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x23')]);router[_0xdeaa('0x6')]('/outbound/channels',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x24')]);router['get']('/agents',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x25')]);router[_0xdeaa('0x26')](_0xdeaa('0x27'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x28')]);router[_0xdeaa('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0xdeaa('0x29')]);router[_0xdeaa('0x6')](_0xdeaa('0x2a'),auth['isAuthenticated'](),controller[_0xdeaa('0x2b')]);router[_0xdeaa('0x6')](_0xdeaa('0x2c'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x2d')]);router[_0xdeaa('0x6')](_0xdeaa('0x2e'),auth['isAuthenticated'](),controller['faxAccounts']);router['get'](_0xdeaa('0x2f'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x30')]);router[_0xdeaa('0x6')]('/mail/queues/waitinginteractions',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x31')]);router[_0xdeaa('0x6')](_0xdeaa('0x32'),auth['isAuthenticated'](),controller[_0xdeaa('0x33')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x34')]);router['get']('/sms/queues/waitinginteractions',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x35')]);router[_0xdeaa('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xdeaa('0x36')]);router['get'](_0xdeaa('0x37'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x38')]);router['post'](_0xdeaa('0x39'),auth[_0xdeaa('0x8')](),controller['queueNotify'](_0xdeaa('0x3a')));router[_0xdeaa('0x6')](_0xdeaa('0x3b'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x3c')]);router['post'](_0xdeaa('0x3d'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x3e')](_0xdeaa('0x3f')));router[_0xdeaa('0x6')](_0xdeaa('0x40'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x41')]);router[_0xdeaa('0x42')](_0xdeaa('0x43'),auth[_0xdeaa('0x8')](),controller['queueNotify'](_0xdeaa('0x44')));router[_0xdeaa('0x6')](_0xdeaa('0x45'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x46')]);router[_0xdeaa('0x42')](_0xdeaa('0x47'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x3e')]('openchannel'));router[_0xdeaa('0x6')](_0xdeaa('0x48'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x49')]);router[_0xdeaa('0x42')]('/sms/queues/:id/notify',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x3e')](_0xdeaa('0x4a')));router[_0xdeaa('0x42')]('/whatsapp/queues/:id/notify',auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x3e')](_0xdeaa('0x4b')));router[_0xdeaa('0x6')](_0xdeaa('0x4c'),auth['isAuthenticated'](),controller[_0xdeaa('0x4d')]);router[_0xdeaa('0x6')](_0xdeaa('0x4e'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x4f')]);router[_0xdeaa('0x42')](_0xdeaa('0x50'),auth[_0xdeaa('0x8')](),controller[_0xdeaa('0x51')]);module[_0xdeaa('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 80b61c8..34b183e 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(_0x1a2fd2,_0x3904df){var _0x476ad5=function(_0x5681a5){while(--_0x5681a5){_0x1a2fd2['push'](_0x1a2fd2['shift']());}};_0x476ad5(++_0x3904df);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0xb10b,0x12a));var _0xbb10=function(_0x27ebc2,_0x5a63d3){_0x27ebc2=_0x27ebc2-0x0;var _0x5aba33=_0xb10b[_0x27ebc2];return _0x5aba33;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 09373c1..94799b0 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 _0x3436=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','put','update'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x3436,0x9d));var _0x6343=function(_0x1ff13d,_0x4d60fd){_0x1ff13d=_0x1ff13d-0x0;var _0x1c7b2b=_0x3436[_0x1ff13d];return _0x1c7b2b;};'use strict';var multer=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var path=require('path');var timeout=require(_0x6343('0x2'));var express=require(_0x6343('0x3'));var router=express[_0x6343('0x4')]();var fs_extra=require(_0x6343('0x5'));var auth=require(_0x6343('0x6'));var interaction=require(_0x6343('0x7'));var config=require('../../config/environment');var controller=require(_0x6343('0x8'));router[_0x6343('0x9')]('/',auth[_0x6343('0xa')](),controller[_0x6343('0xb')]);router['get'](_0x6343('0xc'),auth[_0x6343('0xa')](),controller[_0x6343('0xd')]);router[_0x6343('0x9')](_0x6343('0xe'),auth['isAuthenticated'](),controller[_0x6343('0xf')]);router[_0x6343('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6343('0x11')](_0x6343('0xc'),auth[_0x6343('0xa')](),controller[_0x6343('0x12')]);router[_0x6343('0x13')](_0x6343('0xc'),auth['isAuthenticated'](),controller[_0x6343('0x14')]);module[_0x6343('0x15')]=router; \ No newline at end of file +var _0xafd0=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','post','create','put','update','delete'];(function(_0x29944b,_0x528a25){var _0x22a5e2=function(_0x1aae35){while(--_0x1aae35){_0x29944b['push'](_0x29944b['shift']());}};_0x22a5e2(++_0x528a25);}(_0xafd0,0x11a));var _0x0afd=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xafd0[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var path=require(_0x0afd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0afd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0afd('0x4'));var interaction=require(_0x0afd('0x5'));var config=require('../../config/environment');var controller=require(_0x0afd('0x6'));router[_0x0afd('0x7')]('/',auth['isAuthenticated'](),controller[_0x0afd('0x8')]);router[_0x0afd('0x7')](_0x0afd('0x9'),auth[_0x0afd('0xa')](),controller[_0x0afd('0xb')]);router[_0x0afd('0x7')](_0x0afd('0xc'),auth[_0x0afd('0xa')](),controller['run']);router[_0x0afd('0xd')]('/',auth[_0x0afd('0xa')](),controller[_0x0afd('0xe')]);router[_0x0afd('0xf')](_0x0afd('0x9'),auth[_0x0afd('0xa')](),controller[_0x0afd('0x10')]);router[_0x0afd('0x11')](_0x0afd('0x9'),auth[_0x0afd('0xa')](),controller[_0x0afd('0x12')]);module[_0x0afd('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f9780e9..7b0ec5a 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 _0xbfc4=['default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','months','weeks','days','hours','minutes','csv','pdf','xlsx','ENUM','custom'];(function(_0x2b42e5,_0x4e3dbf){var _0x2c4fb5=function(_0x4aa621){while(--_0x4aa621){_0x2b42e5['push'](_0x2b42e5['shift']());}};_0x2c4fb5(++_0x4e3dbf);}(_0xbfc4,0x1de));var _0x4bfc=function(_0x363390,_0x14dc6d){_0x363390=_0x363390-0x0;var _0x5a94b4=_0xbfc4[_0x363390];return _0x5a94b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4bfc('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4bfc('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4bfc('0x2')},'startAt':{'type':Sequelize[_0x4bfc('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4bfc('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x4bfc('0x4'),'quarters',_0x4bfc('0x5'),_0x4bfc('0x6'),_0x4bfc('0x7'),_0x4bfc('0x8'),_0x4bfc('0x9')),'allowNull':![],'defaultValue':_0x4bfc('0x7')},'output':{'type':Sequelize['ENUM'](_0x4bfc('0xa'),_0x4bfc('0xb'),_0x4bfc('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x4bfc('0xd')](_0x4bfc('0xe'),_0x4bfc('0xf')),'allowNull':![],'defaultValue':_0x4bfc('0xe')},'sendMail':{'type':Sequelize[_0x4bfc('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x4bfc('0x0')]},'cc':{'type':Sequelize[_0x4bfc('0x10')]},'bcc':{'type':Sequelize[_0x4bfc('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x4bfc('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcdc9=['weeks','days','hours','csv','xlsx','custom','default','TEXT','sequelize','exports','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xcdc9,0x1d3));var _0x9cdc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcdc9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x9cdc('0x0'));module[_0x9cdc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9cdc('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9cdc('0x3')],'allowNull':![],'defaultValue':_0x9cdc('0x4')},'startAt':{'type':Sequelize[_0x9cdc('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9cdc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9cdc('0x7')]('years',_0x9cdc('0x8'),'months',_0x9cdc('0x9'),_0x9cdc('0xa'),_0x9cdc('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x9cdc('0xa')},'output':{'type':Sequelize[_0x9cdc('0x7')](_0x9cdc('0xc'),'pdf',_0x9cdc('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x9cdc('0x7')](_0x9cdc('0xe'),_0x9cdc('0xf')),'allowNull':![],'defaultValue':_0x9cdc('0xe')},'sendMail':{'type':Sequelize[_0x9cdc('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9cdc('0x3')]},'cc':{'type':Sequelize[_0x9cdc('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index df04e96..8fe2ffb 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 _0x3ac9=['rows','show','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','get','UserProfileResource','stack','name','index','map','Schedule','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x3ac9,0x110));var _0x93ac=function(_0x4eee9e,_0x57aa9f){_0x4eee9e=_0x4eee9e-0x0;var _0x37bc2b=_0x3ac9[_0x4eee9e];return _0x37bc2b;};'use strict';var emlformat=require(_0x93ac('0x0'));var rimraf=require(_0x93ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93ac('0x2'));var rp=require(_0x93ac('0x3'));var moment=require(_0x93ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93ac('0x5'));var util=require(_0x93ac('0x6'));var path=require(_0x93ac('0x7'));var sox=require(_0x93ac('0x8'));var csv=require(_0x93ac('0x9'));var ejs=require(_0x93ac('0xa'));var fs=require('fs');var fs_extra=require(_0x93ac('0xb'));var _=require(_0x93ac('0xc'));var squel=require(_0x93ac('0xd'));var crypto=require(_0x93ac('0xe'));var jsforce=require(_0x93ac('0xf'));var deskjs=require(_0x93ac('0x10'));var toCsv=require(_0x93ac('0x9'));var querystring=require(_0x93ac('0x11'));var Papa=require(_0x93ac('0x12'));var Redis=require(_0x93ac('0x13'));var authService=require(_0x93ac('0x14'));var qs=require(_0x93ac('0x15'));var as=require(_0x93ac('0x16'));var hardwareService=require(_0x93ac('0x17'));var logger=require('../../config/logger')(_0x93ac('0x18'));var utils=require(_0x93ac('0x19'));var config=require(_0x93ac('0x1a'));var licenseUtil=require(_0x93ac('0x1b'));var db=require(_0x93ac('0x1c'))['db'];function respondWithStatusCode(_0x350415,_0x3e4349){_0x3e4349=_0x3e4349||0xcc;return function(_0x12e7a1){if(_0x12e7a1){return _0x350415[_0x93ac('0x1d')](_0x3e4349);}return _0x350415[_0x93ac('0x1e')](_0x3e4349)[_0x93ac('0x1f')]();};}function respondWithResult(_0x4b8801,_0x10fd4d){_0x10fd4d=_0x10fd4d||0xc8;return function(_0x78ba70){if(_0x78ba70){return _0x4b8801['status'](_0x10fd4d)[_0x93ac('0x20')](_0x78ba70);}};}function respondWithFilteredResult(_0x3c304a,_0x3546c8){return function(_0x864201){if(_0x864201){var _0x3e1bd4=typeof _0x3546c8[_0x93ac('0x21')]===_0x93ac('0x22')&&typeof _0x3546c8['limit']===_0x93ac('0x22');var _0x38232d=_0x864201[_0x93ac('0x23')];var _0x34c807=_0x3e1bd4?0x0:_0x3546c8[_0x93ac('0x21')];var _0x4e7272=_0x3e1bd4?_0x864201['count']:_0x3546c8[_0x93ac('0x21')]+_0x3546c8['limit'];var _0x20ac8a;if(_0x4e7272>=_0x38232d){_0x4e7272=_0x38232d;_0x20ac8a=0xc8;}else{_0x20ac8a=0xce;}_0x3c304a[_0x93ac('0x1e')](_0x20ac8a);return _0x3c304a['set'](_0x93ac('0x24'),_0x34c807+'-'+_0x4e7272+'/'+_0x38232d)[_0x93ac('0x20')](_0x864201);}return null;};}function patchUpdates(_0x52fbd7){return function(_0x43cc2c){try{jsonpatch[_0x93ac('0x25')](_0x43cc2c,_0x52fbd7,!![]);}catch(_0x225736){return BPromise[_0x93ac('0x26')](_0x225736);}return _0x43cc2c[_0x93ac('0x27')]();};}function saveUpdates(_0x37100f,_0x1fe179){return function(_0xe95fd6){if(_0xe95fd6){return _0xe95fd6['update'](_0x37100f)[_0x93ac('0x28')](function(_0x4d018a){return _0x4d018a;});}return null;};}function removeEntity(_0x58d191,_0x1cc368){return function(_0x5090a9){if(_0x5090a9){return _0x5090a9['destroy']()[_0x93ac('0x28')](function(){var _0x500096=_0x5090a9[_0x93ac('0x29')]({'plain':!![]});var _0x4b7792='Scheduler';return db[_0x93ac('0x2a')]['destroy']({'where':{'type':_0x4b7792,'resourceId':_0x500096['id']}})[_0x93ac('0x28')](function(){return _0x5090a9;});})['then'](function(){_0x58d191[_0x93ac('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x343a12,_0x3018f7){return function(_0x1f60c2){if(!_0x1f60c2){_0x343a12[_0x93ac('0x1d')](0x194);}return _0x1f60c2;};}function handleError(_0x5d01bc,_0x32705f){_0x32705f=_0x32705f||0x1f4;return function(_0x33dc56){logger['error'](_0x33dc56[_0x93ac('0x2b')]);if(_0x33dc56[_0x93ac('0x2c')]){delete _0x33dc56['name'];}_0x5d01bc[_0x93ac('0x1e')](_0x32705f)['send'](_0x33dc56);};}exports[_0x93ac('0x2d')]=function(_0x4b0adf,_0x4563e9){var _0x5a8268={},_0x28310a={},_0x18ce1e={'count':0x0,'rows':[]};var _0x3ca4e0=_[_0x93ac('0x2e')](db[_0x93ac('0x2f')][_0x93ac('0x30')],function(_0x185d9f){return{'name':_0x185d9f['fieldName'],'type':_0x185d9f[_0x93ac('0x31')]['key']};});_0x28310a[_0x93ac('0x32')]=_[_0x93ac('0x2e')](_0x3ca4e0,_0x93ac('0x2c'));_0x28310a[_0x93ac('0x33')]=_['keys'](_0x4b0adf[_0x93ac('0x33')]);_0x28310a[_0x93ac('0x34')]=_[_0x93ac('0x35')](_0x28310a[_0x93ac('0x32')],_0x28310a[_0x93ac('0x33')]);_0x5a8268[_0x93ac('0x36')]=_['intersection'](_0x28310a[_0x93ac('0x32')],qs['fields'](_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x37')]));_0x5a8268[_0x93ac('0x36')]=_0x5a8268[_0x93ac('0x36')][_0x93ac('0x38')]?_0x5a8268[_0x93ac('0x36')]:_0x28310a[_0x93ac('0x32')];if(!_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x39')](_0x93ac('0x3a'))){_0x5a8268['limit']=qs['limit'](_0x4b0adf[_0x93ac('0x33')]['limit']);_0x5a8268['offset']=qs[_0x93ac('0x21')](_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x21')]);}_0x5a8268['order']=qs[_0x93ac('0x3b')](_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x3b')]);_0x5a8268[_0x93ac('0x3c')]=qs['filters'](_['pick'](_0x4b0adf[_0x93ac('0x33')],_0x28310a[_0x93ac('0x34')]),_0x3ca4e0);if(_0x4b0adf[_0x93ac('0x33')]['filter']){_0x5a8268[_0x93ac('0x3c')]=_[_0x93ac('0x3d')](_0x5a8268[_0x93ac('0x3c')],{'$or':_[_0x93ac('0x2e')](_0x3ca4e0,function(_0x33f053){if(_0x33f053[_0x93ac('0x31')]!==_0x93ac('0x3e')){var _0x23066e={};_0x23066e[_0x33f053[_0x93ac('0x2c')]]={'$like':'%'+_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x3f')]+'%'};return _0x23066e;}})});}_0x5a8268=_['merge']({},_0x5a8268,_0x4b0adf[_0x93ac('0x40')]);var _0x3f82fe={'where':_0x5a8268[_0x93ac('0x3c')]};return db[_0x93ac('0x2f')][_0x93ac('0x23')](_0x3f82fe)[_0x93ac('0x28')](function(_0x24d693){_0x18ce1e[_0x93ac('0x23')]=_0x24d693;if(_0x4b0adf[_0x93ac('0x33')][_0x93ac('0x41')]){_0x5a8268[_0x93ac('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x93ac('0x43')](_0x5a8268);})[_0x93ac('0x28')](function(_0x52e7e5){_0x18ce1e[_0x93ac('0x44')]=_0x52e7e5;return _0x18ce1e;})['then'](respondWithFilteredResult(_0x4563e9,_0x5a8268))['catch'](handleError(_0x4563e9,null));};exports[_0x93ac('0x45')]=function(_0x56671d,_0x495cd5){var _0x2e6859={'raw':![],'where':{'id':_0x56671d[_0x93ac('0x46')]['id']}},_0x58ff50={};_0x58ff50['model']=_['keys'](db['Schedule']['rawAttributes']);_0x58ff50[_0x93ac('0x33')]=_[_0x93ac('0x47')](_0x56671d[_0x93ac('0x33')]);_0x58ff50[_0x93ac('0x34')]=_[_0x93ac('0x35')](_0x58ff50[_0x93ac('0x32')],_0x58ff50[_0x93ac('0x33')]);_0x2e6859[_0x93ac('0x36')]=_[_0x93ac('0x35')](_0x58ff50['model'],qs[_0x93ac('0x37')](_0x56671d[_0x93ac('0x33')][_0x93ac('0x37')]));_0x2e6859[_0x93ac('0x36')]=_0x2e6859[_0x93ac('0x36')]['length']?_0x2e6859[_0x93ac('0x36')]:_0x58ff50[_0x93ac('0x32')];if(_0x56671d['query'][_0x93ac('0x41')]){_0x2e6859['include']=[{'all':!![]}];}_0x2e6859=_[_0x93ac('0x3d')]({},_0x2e6859,_0x56671d[_0x93ac('0x40')]);return db['Schedule'][_0x93ac('0x48')](_0x2e6859)[_0x93ac('0x28')](handleEntityNotFound(_0x495cd5,null))[_0x93ac('0x28')](respondWithResult(_0x495cd5,null))[_0x93ac('0x49')](handleError(_0x495cd5,null));};exports['create']=function(_0x2f7716,_0x1b359a){return db['Schedule'][_0x93ac('0x4a')](_0x2f7716[_0x93ac('0x4b')],{})['then'](function(_0x1b74ff){var _0x35ccbb=_0x2f7716['user'][_0x93ac('0x29')]({'plain':!![]});if(!_0x35ccbb)throw new Error(_0x93ac('0x4c'));if(_0x35ccbb['role']===_0x93ac('0x4d')){var _0x58a71a=_0x1b74ff[_0x93ac('0x29')]({'plain':!![]});var _0x4a5820='Scheduler';return db[_0x93ac('0x4e')]['find']({'where':{'name':_0x4a5820,'userProfileId':_0x35ccbb[_0x93ac('0x4f')]},'raw':!![]})[_0x93ac('0x28')](function(_0x373053){if(_0x373053&&_0x373053[_0x93ac('0x50')]===0x0){return db[_0x93ac('0x2a')][_0x93ac('0x4a')]({'name':_0x58a71a[_0x93ac('0x2c')],'resourceId':_0x58a71a['id'],'type':_0x373053['name'],'sectionId':_0x373053['id']},{})[_0x93ac('0x28')](function(){return _0x1b74ff;});}else{return _0x1b74ff;}})[_0x93ac('0x49')](function(_0x51f4cd){logger[_0x93ac('0x51')](_0x93ac('0x52'),_0x51f4cd);throw _0x51f4cd;});}return _0x1b74ff;})['then'](respondWithResult(_0x1b359a,0xc9))['catch'](handleError(_0x1b359a,null));};exports['update']=function(_0x135dbb,_0x4b709e){if(_0x135dbb[_0x93ac('0x4b')]['id']){delete _0x135dbb[_0x93ac('0x4b')]['id'];}return db[_0x93ac('0x2f')][_0x93ac('0x48')]({'where':{'id':_0x135dbb[_0x93ac('0x46')]['id']}})[_0x93ac('0x28')](handleEntityNotFound(_0x4b709e,null))[_0x93ac('0x28')](saveUpdates(_0x135dbb['body'],null))['then'](respondWithResult(_0x4b709e,null))[_0x93ac('0x49')](handleError(_0x4b709e,null));};exports['destroy']=function(_0x41cbf9,_0x3fbe57){return db['Schedule'][_0x93ac('0x48')]({'where':{'id':_0x41cbf9[_0x93ac('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fbe57,null))[_0x93ac('0x28')](removeEntity(_0x3fbe57,null))[_0x93ac('0x49')](handleError(_0x3fbe57,null));};exports['run']=function(_0x23093c,_0x210bb0,_0x140fe7){var _0x286863=require(_0x93ac('0x53'));return db[_0x93ac('0x2f')][_0x93ac('0x48')]({'where':{'id':_0x23093c[_0x93ac('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x210bb0,null))[_0x93ac('0x28')](function(){_0x286863[_0x93ac('0x54')](_0x23093c[_0x93ac('0x46')]['id']);})['then'](respondWithStatusCode(_0x210bb0,null))[_0x93ac('0x49')](handleError(_0x210bb0,null));}; \ No newline at end of file +var _0xae2d=['then','destroy','get','error','stack','name','send','map','Schedule','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','options','include','findAll','rows','catch','params','rawAttributes','includeAll','merge','find','create','body','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xae2d,0x1b7));var _0xdae2=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0xae2d[_0x2179f1];return _0x176ec9;};'use strict';var emlformat=require(_0xdae2('0x0'));var rimraf=require(_0xdae2('0x1'));var zipdir=require(_0xdae2('0x2'));var jsonpatch=require(_0xdae2('0x3'));var rp=require(_0xdae2('0x4'));var moment=require('moment');var BPromise=require(_0xdae2('0x5'));var Mustache=require(_0xdae2('0x6'));var util=require('util');var path=require(_0xdae2('0x7'));var sox=require(_0xdae2('0x8'));var csv=require(_0xdae2('0x9'));var ejs=require(_0xdae2('0xa'));var fs=require('fs');var fs_extra=require(_0xdae2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdae2('0xc'));var deskjs=require(_0xdae2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdae2('0xe'));var Papa=require('papaparse');var Redis=require(_0xdae2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdae2('0x10'));var hardwareService=require(_0xdae2('0x11'));var logger=require(_0xdae2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xdae2('0x13'));var licenseUtil=require(_0xdae2('0x14'));var db=require(_0xdae2('0x15'))['db'];function respondWithStatusCode(_0x28cee3,_0x15e2d7){_0x15e2d7=_0x15e2d7||0xcc;return function(_0x1c59ba){if(_0x1c59ba){return _0x28cee3[_0xdae2('0x16')](_0x15e2d7);}return _0x28cee3['status'](_0x15e2d7)[_0xdae2('0x17')]();};}function respondWithResult(_0x2be8ef,_0x311c7b){_0x311c7b=_0x311c7b||0xc8;return function(_0x2e9edf){if(_0x2e9edf){return _0x2be8ef[_0xdae2('0x18')](_0x311c7b)[_0xdae2('0x19')](_0x2e9edf);}};}function respondWithFilteredResult(_0x4e050d,_0x2563a7){return function(_0x29cd7d){if(_0x29cd7d){var _0x5d301d=typeof _0x2563a7['offset']===_0xdae2('0x1a')&&typeof _0x2563a7[_0xdae2('0x1b')]===_0xdae2('0x1a');var _0x3834e2=_0x29cd7d[_0xdae2('0x1c')];var _0x10bc3c=_0x5d301d?0x0:_0x2563a7[_0xdae2('0x1d')];var _0x5f8fdd=_0x5d301d?_0x29cd7d['count']:_0x2563a7[_0xdae2('0x1d')]+_0x2563a7[_0xdae2('0x1b')];var _0x47e2b4;if(_0x5f8fdd>=_0x3834e2){_0x5f8fdd=_0x3834e2;_0x47e2b4=0xc8;}else{_0x47e2b4=0xce;}_0x4e050d[_0xdae2('0x18')](_0x47e2b4);return _0x4e050d[_0xdae2('0x1e')]('Content-Range',_0x10bc3c+'-'+_0x5f8fdd+'/'+_0x3834e2)[_0xdae2('0x19')](_0x29cd7d);}return null;};}function patchUpdates(_0x236385){return function(_0xe878c4){try{jsonpatch[_0xdae2('0x1f')](_0xe878c4,_0x236385,!![]);}catch(_0x31f5fb){return BPromise[_0xdae2('0x20')](_0x31f5fb);}return _0xe878c4[_0xdae2('0x21')]();};}function saveUpdates(_0x2b8357,_0x1eee64){return function(_0xe35d1c){if(_0xe35d1c){return _0xe35d1c[_0xdae2('0x22')](_0x2b8357)[_0xdae2('0x23')](function(_0xacf072){return _0xacf072;});}return null;};}function removeEntity(_0x4d65cc,_0x539086){return function(_0x1de622){if(_0x1de622){return _0x1de622[_0xdae2('0x24')]()[_0xdae2('0x23')](function(){var _0x1d9400=_0x1de622[_0xdae2('0x25')]({'plain':!![]});var _0x39ba46='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x39ba46,'resourceId':_0x1d9400['id']}})[_0xdae2('0x23')](function(){return _0x1de622;});})[_0xdae2('0x23')](function(){_0x4d65cc[_0xdae2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a75da,_0x27891c){return function(_0x10b2f8){if(!_0x10b2f8){_0x5a75da[_0xdae2('0x16')](0x194);}return _0x10b2f8;};}function handleError(_0x1e1042,_0x28aab8){_0x28aab8=_0x28aab8||0x1f4;return function(_0x1374ec){logger[_0xdae2('0x26')](_0x1374ec[_0xdae2('0x27')]);if(_0x1374ec[_0xdae2('0x28')]){delete _0x1374ec['name'];}_0x1e1042[_0xdae2('0x18')](_0x28aab8)[_0xdae2('0x29')](_0x1374ec);};}exports['index']=function(_0x5111ad,_0xbe45b2){var _0x390d9c={},_0x2d2520={},_0x569b85={'count':0x0,'rows':[]};var _0x3e3ffb=_[_0xdae2('0x2a')](db[_0xdae2('0x2b')]['rawAttributes'],function(_0x2bebf4){return{'name':_0x2bebf4['fieldName'],'type':_0x2bebf4['type']['key']};});_0x2d2520[_0xdae2('0x2c')]=_[_0xdae2('0x2a')](_0x3e3ffb,_0xdae2('0x28'));_0x2d2520[_0xdae2('0x2d')]=_[_0xdae2('0x2e')](_0x5111ad[_0xdae2('0x2d')]);_0x2d2520['filters']=_[_0xdae2('0x2f')](_0x2d2520[_0xdae2('0x2c')],_0x2d2520[_0xdae2('0x2d')]);_0x390d9c[_0xdae2('0x30')]=_[_0xdae2('0x2f')](_0x2d2520[_0xdae2('0x2c')],qs['fields'](_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x31')]));_0x390d9c[_0xdae2('0x30')]=_0x390d9c[_0xdae2('0x30')][_0xdae2('0x32')]?_0x390d9c[_0xdae2('0x30')]:_0x2d2520[_0xdae2('0x2c')];if(!_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x33')](_0xdae2('0x34'))){_0x390d9c[_0xdae2('0x1b')]=qs[_0xdae2('0x1b')](_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x1b')]);_0x390d9c[_0xdae2('0x1d')]=qs['offset'](_0x5111ad['query']['offset']);}_0x390d9c[_0xdae2('0x35')]=qs[_0xdae2('0x36')](_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x36')]);_0x390d9c['where']=qs[_0xdae2('0x37')](_[_0xdae2('0x38')](_0x5111ad[_0xdae2('0x2d')],_0x2d2520[_0xdae2('0x37')]),_0x3e3ffb);if(_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x39')]){_0x390d9c[_0xdae2('0x3a')]=_['merge'](_0x390d9c[_0xdae2('0x3a')],{'$or':_[_0xdae2('0x2a')](_0x3e3ffb,function(_0x5299f4){if(_0x5299f4['type']!=='VIRTUAL'){var _0x4b6a12={};_0x4b6a12[_0x5299f4[_0xdae2('0x28')]]={'$like':'%'+_0x5111ad[_0xdae2('0x2d')][_0xdae2('0x39')]+'%'};return _0x4b6a12;}})});}_0x390d9c=_['merge']({},_0x390d9c,_0x5111ad[_0xdae2('0x3b')]);var _0x5eb091={'where':_0x390d9c['where']};return db[_0xdae2('0x2b')][_0xdae2('0x1c')](_0x5eb091)[_0xdae2('0x23')](function(_0x3fcd9a){_0x569b85[_0xdae2('0x1c')]=_0x3fcd9a;if(_0x5111ad['query']['includeAll']){_0x390d9c[_0xdae2('0x3c')]=[{'all':!![]}];}return db[_0xdae2('0x2b')][_0xdae2('0x3d')](_0x390d9c);})['then'](function(_0x3d48e8){_0x569b85[_0xdae2('0x3e')]=_0x3d48e8;return _0x569b85;})[_0xdae2('0x23')](respondWithFilteredResult(_0xbe45b2,_0x390d9c))[_0xdae2('0x3f')](handleError(_0xbe45b2,null));};exports['show']=function(_0x55c878,_0x36115f){var _0x5d58e={'raw':![],'where':{'id':_0x55c878[_0xdae2('0x40')]['id']}},_0x5f5651={};_0x5f5651[_0xdae2('0x2c')]=_['keys'](db['Schedule'][_0xdae2('0x41')]);_0x5f5651[_0xdae2('0x2d')]=_[_0xdae2('0x2e')](_0x55c878[_0xdae2('0x2d')]);_0x5f5651['filters']=_[_0xdae2('0x2f')](_0x5f5651['model'],_0x5f5651['query']);_0x5d58e[_0xdae2('0x30')]=_[_0xdae2('0x2f')](_0x5f5651[_0xdae2('0x2c')],qs['fields'](_0x55c878[_0xdae2('0x2d')][_0xdae2('0x31')]));_0x5d58e['attributes']=_0x5d58e['attributes'][_0xdae2('0x32')]?_0x5d58e['attributes']:_0x5f5651[_0xdae2('0x2c')];if(_0x55c878['query'][_0xdae2('0x42')]){_0x5d58e['include']=[{'all':!![]}];}_0x5d58e=_[_0xdae2('0x43')]({},_0x5d58e,_0x55c878['options']);return db[_0xdae2('0x2b')][_0xdae2('0x44')](_0x5d58e)['then'](handleEntityNotFound(_0x36115f,null))['then'](respondWithResult(_0x36115f,null))[_0xdae2('0x3f')](handleError(_0x36115f,null));};exports[_0xdae2('0x45')]=function(_0x3df499,_0x217a8b){return db['Schedule']['create'](_0x3df499[_0xdae2('0x46')],{})[_0xdae2('0x23')](function(_0x4c6ab5){var _0x5bc25f=_0x3df499[_0xdae2('0x47')][_0xdae2('0x25')]({'plain':!![]});if(!_0x5bc25f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bc25f['role']===_0xdae2('0x47')){var _0x5d6c98=_0x4c6ab5[_0xdae2('0x25')]({'plain':!![]});var _0x486a76=_0xdae2('0x48');return db[_0xdae2('0x49')]['find']({'where':{'name':_0x486a76,'userProfileId':_0x5bc25f[_0xdae2('0x4a')]},'raw':!![]})[_0xdae2('0x23')](function(_0x27037d){if(_0x27037d&&_0x27037d[_0xdae2('0x4b')]===0x0){return db[_0xdae2('0x4c')][_0xdae2('0x45')]({'name':_0x5d6c98['name'],'resourceId':_0x5d6c98['id'],'type':_0x27037d['name'],'sectionId':_0x27037d['id']},{})[_0xdae2('0x23')](function(){return _0x4c6ab5;});}else{return _0x4c6ab5;}})['catch'](function(_0x16fb7d){logger['error'](_0xdae2('0x4d'),_0x16fb7d);throw _0x16fb7d;});}return _0x4c6ab5;})[_0xdae2('0x23')](respondWithResult(_0x217a8b,0xc9))['catch'](handleError(_0x217a8b,null));};exports['update']=function(_0x5eef98,_0x1fca97){if(_0x5eef98[_0xdae2('0x46')]['id']){delete _0x5eef98[_0xdae2('0x46')]['id'];}return db[_0xdae2('0x2b')][_0xdae2('0x44')]({'where':{'id':_0x5eef98[_0xdae2('0x40')]['id']}})[_0xdae2('0x23')](handleEntityNotFound(_0x1fca97,null))[_0xdae2('0x23')](saveUpdates(_0x5eef98[_0xdae2('0x46')],null))[_0xdae2('0x23')](respondWithResult(_0x1fca97,null))['catch'](handleError(_0x1fca97,null));};exports[_0xdae2('0x24')]=function(_0x80d01d,_0x5aade6){return db[_0xdae2('0x2b')]['find']({'where':{'id':_0x80d01d[_0xdae2('0x40')]['id']}})[_0xdae2('0x23')](handleEntityNotFound(_0x5aade6,null))[_0xdae2('0x23')](removeEntity(_0x5aade6,null))[_0xdae2('0x3f')](handleError(_0x5aade6,null));};exports['run']=function(_0x524a50,_0x121474,_0xfa16eb){var _0x262c85=require(_0xdae2('0x4e'));return db['Schedule'][_0xdae2('0x44')]({'where':{'id':_0x524a50[_0xdae2('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x121474,null))['then'](function(){_0x262c85['run'](_0x524a50[_0xdae2('0x40')]['id']);})[_0xdae2('0x23')](respondWithStatusCode(_0x121474,null))[_0xdae2('0x3f')](handleError(_0x121474,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f75a9d5..bbbcf50 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 _0x35c7=['./schedule.attributes','tools_schedules','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x312d8f,_0x7c37bf){var _0x5a093f=function(_0x2cc88f){while(--_0x2cc88f){_0x312d8f['push'](_0x312d8f['shift']());}};_0x5a093f(++_0x7c37bf);}(_0x35c7,0x1cd));var _0x735c=function(_0x398f0d,_0x5150f8){_0x398f0d=_0x398f0d-0x0;var _0x1c9e8f=_0x35c7[_0x398f0d];return _0x1c9e8f;};'use strict';var _=require('lodash');var util=require(_0x735c('0x0'));var logger=require('../../config/logger')(_0x735c('0x1'));var moment=require('moment');var BPromise=require(_0x735c('0x2'));var rp=require(_0x735c('0x3'));var fs=require('fs');var path=require(_0x735c('0x4'));var rimraf=require(_0x735c('0x5'));var config=require(_0x735c('0x6'));var attributes=require(_0x735c('0x7'));module['exports']=function(_0x2d9907,_0x12e383){return _0x2d9907['define']('Schedule',attributes,{'tableName':_0x735c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe38b=['request-promise','path','rimraf','./schedule.attributes','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54f013,_0x42a1ba){var _0x45cda8=function(_0x218664){while(--_0x218664){_0x54f013['push'](_0x54f013['shift']());}};_0x45cda8(++_0x42a1ba);}(_0xe38b,0x14a));var _0xbe38=function(_0x491f2b,_0x2a2a94){_0x491f2b=_0x491f2b-0x0;var _0x5dcf96=_0xe38b[_0x491f2b];return _0x5dcf96;};'use strict';var _=require(_0xbe38('0x0'));var util=require(_0xbe38('0x1'));var logger=require(_0xbe38('0x2'))(_0xbe38('0x3'));var moment=require(_0xbe38('0x4'));var BPromise=require(_0xbe38('0x5'));var rp=require(_0xbe38('0x6'));var fs=require('fs');var path=require(_0xbe38('0x7'));var rimraf=require(_0xbe38('0x8'));var config=require('../../config/environment');var attributes=require(_0xbe38('0x9'));module['exports']=function(_0x17f198,_0x2a12c4){return _0x17f198['define'](_0xbe38('0xa'),attributes,{'tableName':_0xbe38('0xb'),'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 3d54004..ee8441c 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 _0xf8b8=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf8b8,0xc5));var _0x8f8b=function(_0x2f5960,_0x5f4ea9){_0x2f5960=_0x2f5960-0x0;var _0x43c84f=_0xf8b8[_0x2f5960];return _0x43c84f;};'use strict';var _=require(_0x8f8b('0x0'));var util=require(_0x8f8b('0x1'));var moment=require(_0x8f8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f8b('0x3'));var fs=require('fs');var Redis=require(_0x8f8b('0x4'));var db=require(_0x8f8b('0x5'))['db'];var utils=require(_0x8f8b('0x6'));var logger=require(_0x8f8b('0x7'))('rpc');var config=require(_0x8f8b('0x8'));var jayson=require(_0x8f8b('0x9'));var client=jayson[_0x8f8b('0xa')][_0x8f8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14671c,_0x2ff781,_0x34a45d){return new BPromise(function(_0x5f1745,_0x21efce){return client[_0x8f8b('0xc')](_0x14671c,_0x34a45d)[_0x8f8b('0xd')](function(_0xc9e2d1){logger[_0x8f8b('0xe')](_0x8f8b('0xf'),_0x2ff781,'request\x20sent');logger[_0x8f8b('0x10')](_0x8f8b('0x11'),_0x2ff781,_0x8f8b('0x12'),JSON['stringify'](_0xc9e2d1));if(_0xc9e2d1[_0x8f8b('0x13')]){if(_0xc9e2d1[_0x8f8b('0x13')][_0x8f8b('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x2ff781,_0xc9e2d1[_0x8f8b('0x13')][_0x8f8b('0x15')]);return _0x21efce(_0xc9e2d1[_0x8f8b('0x13')]['message']);}logger[_0x8f8b('0x13')](_0x8f8b('0xf'),_0x2ff781,_0xc9e2d1[_0x8f8b('0x13')][_0x8f8b('0x15')]);return _0x5f1745(_0xc9e2d1['error']['message']);}else{logger[_0x8f8b('0xe')](_0x8f8b('0xf'),_0x2ff781,_0x8f8b('0x12'));_0x5f1745(_0xc9e2d1[_0x8f8b('0x16')][_0x8f8b('0x15')]);}})[_0x8f8b('0x17')](function(_0x3a29af){logger['error']('Schedule,\x20%s,\x20%s',_0x2ff781,_0x3a29af);_0x21efce(_0x3a29af);});});} \ No newline at end of file +var _0x18e5=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','result'];(function(_0x39e45d,_0x241658){var _0x1a739d=function(_0x59a29f){while(--_0x59a29f){_0x39e45d['push'](_0x39e45d['shift']());}};_0x1a739d(++_0x241658);}(_0x18e5,0x115));var _0x518e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x18e5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x518e('0x0'));var util=require(_0x518e('0x1'));var moment=require(_0x518e('0x2'));var BPromise=require('bluebird');var rs=require(_0x518e('0x3'));var fs=require('fs');var Redis=require(_0x518e('0x4'));var db=require(_0x518e('0x5'))['db'];var utils=require(_0x518e('0x6'));var logger=require('../../config/logger')(_0x518e('0x7'));var config=require(_0x518e('0x8'));var jayson=require(_0x518e('0x9'));var client=jayson[_0x518e('0xa')][_0x518e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a6e2,_0x51328c,_0x5891c5){return new BPromise(function(_0xddf1e2,_0x8cdb94){return client['request'](_0x13a6e2,_0x5891c5)[_0x518e('0xc')](function(_0x579b82){logger[_0x518e('0xd')]('Schedule,\x20%s,\x20%s',_0x51328c,_0x518e('0xe'));logger[_0x518e('0xf')](_0x518e('0x10'),_0x51328c,_0x518e('0xe'),JSON['stringify'](_0x579b82));if(_0x579b82['error']){if(_0x579b82[_0x518e('0x11')][_0x518e('0x12')]===0x1f4){logger['error'](_0x518e('0x13'),_0x51328c,_0x579b82[_0x518e('0x11')][_0x518e('0x14')]);return _0x8cdb94(_0x579b82[_0x518e('0x11')]['message']);}logger['error'](_0x518e('0x13'),_0x51328c,_0x579b82[_0x518e('0x11')][_0x518e('0x14')]);return _0xddf1e2(_0x579b82[_0x518e('0x11')][_0x518e('0x14')]);}else{logger[_0x518e('0xd')](_0x518e('0x13'),_0x51328c,_0x518e('0xe'));_0xddf1e2(_0x579b82[_0x518e('0x15')]['message']);}})[_0x518e('0x16')](function(_0x3bf6c6){logger['error'](_0x518e('0x13'),_0x51328c,_0x3bf6c6);_0x8cdb94(_0x3bf6c6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ca3a929..44f8550 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 _0x77cf=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x333f78,_0x39a9cf){var _0x169189=function(_0x1fcddd){while(--_0x1fcddd){_0x333f78['push'](_0x333f78['shift']());}};_0x169189(++_0x39a9cf);}(_0x77cf,0x1a9));var _0xf77c=function(_0x5da0a9,_0x153fdd){_0x5da0a9=_0x5da0a9-0x0;var _0x1d7009=_0x77cf[_0x5da0a9];return _0x1d7009;};'use strict';var multer=require(_0xf77c('0x0'));var util=require(_0xf77c('0x1'));var path=require(_0xf77c('0x2'));var timeout=require(_0xf77c('0x3'));var express=require('express');var router=express[_0xf77c('0x4')]();var fs_extra=require(_0xf77c('0x5'));var auth=require(_0xf77c('0x6'));var interaction=require(_0xf77c('0x7'));var config=require(_0xf77c('0x8'));var controller=require('./screenRecording.controller');router[_0xf77c('0x9')]('/',auth[_0xf77c('0xa')](),controller[_0xf77c('0xb')]);router[_0xf77c('0x9')](_0xf77c('0xc'),auth[_0xf77c('0xa')](),controller[_0xf77c('0xd')]);router[_0xf77c('0x9')](_0xf77c('0xe'),auth['isAuthenticated'](),controller[_0xf77c('0xf')]);router[_0xf77c('0x9')](_0xf77c('0x10'),auth[_0xf77c('0xa')](),controller[_0xf77c('0x11')]);router['post']('/',auth[_0xf77c('0xa')](),controller[_0xf77c('0x12')]);router[_0xf77c('0x13')](_0xf77c('0xe'),auth[_0xf77c('0xa')](),controller[_0xf77c('0x14')]);router[_0xf77c('0x15')]('/:id',auth[_0xf77c('0xa')](),controller[_0xf77c('0x16')]);module[_0xf77c('0x17')]=router; \ No newline at end of file +var _0x5152=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','put','update','exports','util'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x5152,0x1a3));var _0x2515=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x5152[_0x282a1f];return _0x296ea7;};'use strict';var multer=require('multer');var util=require(_0x2515('0x0'));var path=require(_0x2515('0x1'));var timeout=require(_0x2515('0x2'));var express=require(_0x2515('0x3'));var router=express[_0x2515('0x4')]();var fs_extra=require(_0x2515('0x5'));var auth=require(_0x2515('0x6'));var interaction=require(_0x2515('0x7'));var config=require(_0x2515('0x8'));var controller=require(_0x2515('0x9'));router[_0x2515('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2515('0xa')]('/describe',auth[_0x2515('0xb')](),controller[_0x2515('0xc')]);router[_0x2515('0xa')](_0x2515('0xd'),auth[_0x2515('0xb')](),controller[_0x2515('0xe')]);router[_0x2515('0xa')](_0x2515('0xf'),auth[_0x2515('0xb')](),controller[_0x2515('0x10')]);router[_0x2515('0x11')]('/',auth[_0x2515('0xb')](),controller['create']);router[_0x2515('0x12')]('/:id',auth[_0x2515('0xb')](),controller[_0x2515('0x13')]);router['delete'](_0x2515('0xd'),auth[_0x2515('0xb')](),controller['destroy']);module[_0x2515('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8f935ed..febe692 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 _0x082a=['toString','DATE','createdAt','updatedAt','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm'];(function(_0x286544,_0x3e0d36){var _0x564aa4=function(_0x203930){while(--_0x203930){_0x286544['push'](_0x286544['shift']());}};_0x564aa4(++_0x3e0d36);}(_0x082a,0x154));var _0xa082=function(_0x374120,_0x7feb64){_0x374120=_0x374120-0x0;var _0x2e26b9=_0x082a[_0x374120];return _0x2e26b9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa082('0x0'));var path=require(_0xa082('0x1'));var config=require(_0xa082('0x2'));module['exports']={'format':{'type':Sequelize[_0xa082('0x3')],'get':function(){return this[_0xa082('0x4')](_0xa082('0x5'))?path[_0xa082('0x6')](this[_0xa082('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xa082('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa082('0x7')],'set':function(_0x41030c){var _0x5ae561=_0x41030c[_0xa082('0x8')](/\\/g,'/');this[_0xa082('0x9')](_0xa082('0x5'),_0x5ae561);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa082('0xa')],'set':function(_0xafc3c1){this[_0xa082('0x9')](_0xa082('0xb'),moment()[_0xa082('0xc')](_0xafc3c1,'ms'));this['setDataValue'](_0xa082('0xd'),moment());this[_0xa082('0x9')](_0xa082('0xe'),_0xafc3c1);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa082('0xb')))[_0xa082('0xf')](_0xa082('0x10'))[_0xa082('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa082('0x4')](_0xa082('0xd')))[_0xa082('0xf')](_0xa082('0x10'))[_0xa082('0x11')]();}},'createdAt':{'type':Sequelize[_0xa082('0x12')],'get':function(){return moment(this['getDataValue'](_0xa082('0x13')))[_0xa082('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xa082('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa082('0x12')],'get':function(){return moment(this[_0xa082('0x4')](_0xa082('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xa082('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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xf3e2,0x168));var _0x2f3e=function(_0x336a6e,_0x4c454f){_0x336a6e=_0x336a6e-0x0;var _0x4c0b21=_0xf3e2[_0x336a6e];return _0x4c0b21;};'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 4ac4bed..779d0a3 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 _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x41472b,_0x58f477){var _0x17cdc8=function(_0x2de5ef){while(--_0x2de5ef){_0x41472b['push'](_0x41472b['shift']());}};_0x17cdc8(++_0x58f477);}(_0x33c5,0xe6));var _0x533c=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x33c5[_0x1deee5];return _0x1d6c3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file +var _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x33793a,_0x515635){var _0x242389=function(_0x11f5aa){while(--_0x11f5aa){_0x33793a['push'](_0x33793a['shift']());}};_0x242389(++_0x515635);}(_0x6f47,0xc7));var _0x76f4=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6f47[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7353838..a4c9987 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 _0xc711=['api','bluebird','request-promise','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','../../config/logger'];(function(_0x73b93,_0x4a25ac){var _0xbda8da=function(_0x15d251){while(--_0x15d251){_0x73b93['push'](_0x73b93['shift']());}};_0xbda8da(++_0x4a25ac);}(_0xc711,0x1a3));var _0x1c71=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xc711[_0x3861f7];return _0x50879f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c71('0x0'))(_0x1c71('0x1'));var moment=require('moment');var BPromise=require(_0x1c71('0x2'));var rp=require(_0x1c71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c71('0x4'));var config=require('../../config/environment');var attributes=require(_0x1c71('0x5'));module['exports']=function(_0x2446e1,_0x2a7b44){return _0x2446e1[_0x1c71('0x6')](_0x1c71('0x7'),attributes,{'tableName':_0x1c71('0x8'),'paranoid':![],'indexes':[{'name':_0x1c71('0x9'),'fields':[_0x1c71('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe07=['interactionid','util','../../config/logger','bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording'];(function(_0x10f469,_0x5649b3){var _0x56ff8d=function(_0x328d8f){while(--_0x328d8f){_0x10f469['push'](_0x10f469['shift']());}};_0x56ff8d(++_0x5649b3);}(_0xfe07,0x10f));var _0x7fe0=function(_0x384aa8,_0x542f4c){_0x384aa8=_0x384aa8-0x0;var _0x29d8ea=_0xfe07[_0x384aa8];return _0x29d8ea;};'use strict';var _=require('lodash');var util=require(_0x7fe0('0x0'));var logger=require(_0x7fe0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fe0('0x2'));var rp=require(_0x7fe0('0x3'));var fs=require('fs');var path=require(_0x7fe0('0x4'));var rimraf=require(_0x7fe0('0x5'));var config=require('../../config/environment');var attributes=require(_0x7fe0('0x6'));module['exports']=function(_0x2d6efc,_0x43e6c7){return _0x2d6efc[_0x7fe0('0x7')](_0x7fe0('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x7fe0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0e7bb7d..cb1c071 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 _0xd248=['ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x5e293d,_0xe9faea){var _0x8a0f61=function(_0x1185ef){while(--_0x1185ef){_0x5e293d['push'](_0x5e293d['shift']());}};_0x8a0f61(++_0xe9faea);}(_0xd248,0x95));var _0x8d24=function(_0x3e7b3b,_0x14d240){_0x3e7b3b=_0x3e7b3b-0x0;var _0x2aa720=_0xd248[_0x3e7b3b];return _0x2aa720;};'use strict';var _=require(_0x8d24('0x0'));var util=require(_0x8d24('0x1'));var moment=require('moment');var BPromise=require(_0x8d24('0x2'));var rs=require(_0x8d24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d24('0x4'));var logger=require(_0x8d24('0x5'))(_0x8d24('0x6'));var config=require(_0x8d24('0x7'));var jayson=require(_0x8d24('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9132,_0x71ebb7,_0x26775c){return new BPromise(function(_0x5eee5f,_0x574368){return client['request'](_0x4a9132,_0x26775c)[_0x8d24('0x9')](function(_0x4ae0af){logger[_0x8d24('0xa')](_0x8d24('0xb'),_0x71ebb7,_0x8d24('0xc'));logger[_0x8d24('0xd')](_0x8d24('0xe'),_0x71ebb7,_0x8d24('0xc'),JSON[_0x8d24('0xf')](_0x4ae0af));if(_0x4ae0af['error']){if(_0x4ae0af[_0x8d24('0x10')]['code']===0x1f4){logger[_0x8d24('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x71ebb7,_0x4ae0af[_0x8d24('0x10')][_0x8d24('0x11')]);return _0x574368(_0x4ae0af[_0x8d24('0x10')][_0x8d24('0x11')]);}logger[_0x8d24('0x10')](_0x8d24('0xb'),_0x71ebb7,_0x4ae0af[_0x8d24('0x10')][_0x8d24('0x11')]);return _0x5eee5f(_0x4ae0af[_0x8d24('0x10')][_0x8d24('0x11')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x71ebb7,_0x8d24('0xc'));_0x5eee5f(_0x4ae0af[_0x8d24('0x12')][_0x8d24('0x11')]);}})[_0x8d24('0x13')](function(_0x1b4dd0){logger['error'](_0x8d24('0xb'),_0x71ebb7,_0x1b4dd0);_0x574368(_0x1b4dd0);});});} \ No newline at end of file +var _0x3799=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x3799,0x1ba));var _0x9379=function(_0x59c53d,_0x2375a5){_0x59c53d=_0x59c53d-0x0;var _0x4941b9=_0x3799[_0x59c53d];return _0x4941b9;};'use strict';var _=require(_0x9379('0x0'));var util=require(_0x9379('0x1'));var moment=require(_0x9379('0x2'));var BPromise=require('bluebird');var rs=require(_0x9379('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9379('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9379('0x5'))(_0x9379('0x6'));var config=require(_0x9379('0x7'));var jayson=require(_0x9379('0x8'));var client=jayson[_0x9379('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29c96a,_0x5461e7,_0x280eb5){return new BPromise(function(_0x57aedc,_0x45bb35){return client['request'](_0x29c96a,_0x280eb5)[_0x9379('0xa')](function(_0x9eed73){logger[_0x9379('0xb')](_0x9379('0xc'),_0x5461e7,_0x9379('0xd'));logger[_0x9379('0xe')](_0x9379('0xf'),_0x5461e7,_0x9379('0xd'),JSON['stringify'](_0x9eed73));if(_0x9eed73[_0x9379('0x10')]){if(_0x9eed73['error'][_0x9379('0x11')]===0x1f4){logger['error'](_0x9379('0xc'),_0x5461e7,_0x9eed73[_0x9379('0x10')][_0x9379('0x12')]);return _0x45bb35(_0x9eed73['error'][_0x9379('0x12')]);}logger[_0x9379('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x5461e7,_0x9eed73[_0x9379('0x10')][_0x9379('0x12')]);return _0x57aedc(_0x9eed73['error'][_0x9379('0x12')]);}else{logger['info'](_0x9379('0xc'),_0x5461e7,'request\x20sent');_0x57aedc(_0x9eed73[_0x9379('0x13')][_0x9379('0x12')]);}})['catch'](function(_0x5d8b11){logger[_0x9379('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x5461e7,_0x5d8b11);_0x45bb35(_0x5d8b11);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 11b2b31..5d91afe 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 _0xa16e=['/:id/logo_login','/:id/gdpr','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','addLogoLogin','preferred','/:id/preferred','favicon','/:id/favicon','addFavicon','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0xa16e,0xdf));var _0xea16=function(_0x2093e3,_0x8eb650){_0x2093e3=_0x2093e3-0x0;var _0x841d6=_0xa16e[_0x2093e3];return _0x841d6;};'use strict';var multer=require(_0xea16('0x0'));var util=require(_0xea16('0x1'));var path=require(_0xea16('0x2'));var timeout=require(_0xea16('0x3'));var express=require(_0xea16('0x4'));var router=express[_0xea16('0x5')]();var fs_extra=require(_0xea16('0x6'));var auth=require(_0xea16('0x7'));var interaction=require(_0xea16('0x8'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xea16('0x9')]('/',auth[_0xea16('0xa')](),controller[_0xea16('0xb')]);router[_0xea16('0x9')](_0xea16('0xc'),controller[_0xea16('0xd')]);router[_0xea16('0x9')](_0xea16('0xe'),controller['show']);router[_0xea16('0x9')](_0xea16('0xf'),controller[_0xea16('0x10')]);router[_0xea16('0x9')](_0xea16('0x11'),controller['getLogoLogin']);router[_0xea16('0x9')](_0xea16('0x12'),controller['gdpr']);router[_0xea16('0x9')]('/:id/preferred',controller['getPreferred']);router[_0xea16('0x9')]('/:id/favicon',controller[_0xea16('0x13')]);var upload=multer({'storage':multer[_0xea16('0x14')]({'destination':function(_0x2f0d8b,_0x35c798,_0x432bef){_0x432bef(null,path[_0xea16('0x15')](config[_0xea16('0x16')],'server/files/images/logos/'));},'filename':function(_0x11ac06,_0x11ee13,_0x12bcdd){_0x12bcdd(null,util[_0xea16('0x17')](_0xea16('0x18'),_0xea16('0x19'),path[_0xea16('0x1a')](_0x11ee13[_0xea16('0x1b')])));}})});router[_0xea16('0x1c')]('/:id/logo',upload[_0xea16('0x1d')](_0xea16('0x1e')),controller[_0xea16('0x1f')]);var upload=multer({'storage':multer[_0xea16('0x14')]({'destination':function(_0x545ee1,_0x4cb727,_0x20f15d){_0x20f15d(null,path[_0xea16('0x15')](config['root'],_0xea16('0x20')));},'filename':function(_0x1ce3eb,_0x1a9019,_0x43b8cb){_0x43b8cb(null,util[_0xea16('0x17')](_0xea16('0x18'),'logologin',path['extname'](_0x1a9019[_0xea16('0x1b')])));}})});router[_0xea16('0x1c')]('/:id/logo_login',upload[_0xea16('0x1d')](_0xea16('0x1e')),controller[_0xea16('0x21')]);var upload=multer({'storage':multer[_0xea16('0x14')]({'destination':function(_0x246df3,_0x4425b0,_0x20db88){_0x20db88(null,path[_0xea16('0x15')](config['root'],_0xea16('0x20')));},'filename':function(_0x2c1f85,_0x272b7f,_0x29d66a){_0x29d66a(null,util[_0xea16('0x17')](_0xea16('0x18'),_0xea16('0x22'),path[_0xea16('0x1a')](_0x272b7f[_0xea16('0x1b')])));}})});router[_0xea16('0x1c')](_0xea16('0x23'),upload[_0xea16('0x1d')](_0xea16('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0xea16('0x14')]({'destination':function(_0x4ac8a3,_0x5d584a,_0x39cadd){_0x39cadd(null,path[_0xea16('0x15')](config[_0xea16('0x16')],_0xea16('0x20')));},'filename':function(_0x4125c0,_0x21545b,_0xbc28a6){_0xbc28a6(null,util[_0xea16('0x17')](_0xea16('0x18'),_0xea16('0x24'),path[_0xea16('0x1a')](_0x21545b['originalname'])));}})});router[_0xea16('0x1c')](_0xea16('0x25'),upload['single'](_0xea16('0x1e')),controller[_0xea16('0x26')]);router[_0xea16('0x27')](_0xea16('0xe'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7ffa=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/now','getDate','get','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','post','single','file','%s%s','logologin','extname','originalname','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util'];(function(_0x38cba5,_0x4b4446){var _0x1f4fbf=function(_0x1ad908){while(--_0x1ad908){_0x38cba5['push'](_0x38cba5['shift']());}};_0x1f4fbf(++_0x4b4446);}(_0x7ffa,0x198));var _0xa7ff=function(_0x282de5,_0x4ffa42){_0x282de5=_0x282de5-0x0;var _0x248ee9=_0x7ffa[_0x282de5];return _0x248ee9;};'use strict';var multer=require(_0xa7ff('0x0'));var util=require(_0xa7ff('0x1'));var path=require(_0xa7ff('0x2'));var timeout=require(_0xa7ff('0x3'));var express=require('express');var router=express[_0xa7ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa7ff('0x5'));var interaction=require(_0xa7ff('0x6'));var config=require(_0xa7ff('0x7'));var controller=require('./setting.controller');router['get']('/',auth[_0xa7ff('0x8')](),controller[_0xa7ff('0x9')]);router['get'](_0xa7ff('0xa'),controller[_0xa7ff('0xb')]);router[_0xa7ff('0xc')](_0xa7ff('0xd'),controller[_0xa7ff('0xe')]);router[_0xa7ff('0xc')](_0xa7ff('0xf'),controller['getLogo']);router[_0xa7ff('0xc')](_0xa7ff('0x10'),controller[_0xa7ff('0x11')]);router['get'](_0xa7ff('0x12'),controller['gdpr']);router[_0xa7ff('0xc')](_0xa7ff('0x13'),controller[_0xa7ff('0x14')]);router[_0xa7ff('0xc')](_0xa7ff('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xa7ff('0x16')]({'destination':function(_0x2700cd,_0xd991ea,_0x3a64b4){_0x3a64b4(null,path[_0xa7ff('0x17')](config[_0xa7ff('0x18')],_0xa7ff('0x19')));},'filename':function(_0x57ccf8,_0x8fda02,_0x5e8038){_0x5e8038(null,util[_0xa7ff('0x1a')]('%s%s','logo',path['extname'](_0x8fda02['originalname'])));}})});router[_0xa7ff('0x1b')](_0xa7ff('0xf'),upload[_0xa7ff('0x1c')](_0xa7ff('0x1d')),controller['addLogo']);var upload=multer({'storage':multer[_0xa7ff('0x16')]({'destination':function(_0x32d295,_0x2f45d1,_0xe1f4ed){_0xe1f4ed(null,path[_0xa7ff('0x17')](config[_0xa7ff('0x18')],'server/files/images/logos/'));},'filename':function(_0x1349ae,_0x3660b2,_0x2377ff){_0x2377ff(null,util[_0xa7ff('0x1a')](_0xa7ff('0x1e'),_0xa7ff('0x1f'),path[_0xa7ff('0x20')](_0x3660b2[_0xa7ff('0x21')])));}})});router[_0xa7ff('0x1b')](_0xa7ff('0x10'),upload[_0xa7ff('0x1c')](_0xa7ff('0x1d')),controller[_0xa7ff('0x22')]);var upload=multer({'storage':multer[_0xa7ff('0x16')]({'destination':function(_0x133418,_0x43e352,_0x3a39ce){_0x3a39ce(null,path[_0xa7ff('0x17')](config['root'],_0xa7ff('0x19')));},'filename':function(_0x3b0f2c,_0x3bc05d,_0x329b95){_0x329b95(null,util['format'](_0xa7ff('0x1e'),'preferred',path[_0xa7ff('0x20')](_0x3bc05d[_0xa7ff('0x21')])));}})});router[_0xa7ff('0x1b')](_0xa7ff('0x13'),upload[_0xa7ff('0x1c')](_0xa7ff('0x1d')),controller[_0xa7ff('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dff31,_0x4bf80a,_0x253b6e){_0x253b6e(null,path[_0xa7ff('0x17')](config[_0xa7ff('0x18')],_0xa7ff('0x19')));},'filename':function(_0x468e6d,_0x5ee185,_0x32d0f7){_0x32d0f7(null,util[_0xa7ff('0x1a')]('%s%s',_0xa7ff('0x24'),path[_0xa7ff('0x20')](_0x5ee185['originalname'])));}})});router[_0xa7ff('0x1b')](_0xa7ff('0x15'),upload[_0xa7ff('0x1c')](_0xa7ff('0x1d')),controller[_0xa7ff('0x25')]);router[_0xa7ff('0x26')](_0xa7ff('0xd'),auth[_0xa7ff('0x8')](),controller[_0xa7ff('0x27')]);module[_0xa7ff('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 9ee7d5c..48f9902 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x5040a2,_0x1f6263){var _0x95e3b2=function(_0x49bc7c){while(--_0x49bc7c){_0x5040a2['push'](_0x5040a2['shift']());}};_0x95e3b2(++_0x1f6263);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x49a87c,_0x2c2ec6){var _0x1b7726=function(_0x29c172){while(--_0x29c172){_0x49a87c['push'](_0x49a87c['shift']());}};_0x1b7726(++_0x2c2ec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b4bd42f..ce8dc2e 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 _0x075e=['root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','../../config/license/util','getLogoLogin','favicon','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','default_preferred.png','ValidationError','getFavicon','default_favicon.ico','getDate','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','findAll','rows','show','params','include','find','body','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join'];(function(_0x50aea5,_0x5dd077){var _0x4657f1=function(_0x57fb40){while(--_0x57fb40){_0x50aea5['push'](_0x50aea5['shift']());}};_0x4657f1(++_0x5dd077);}(_0x075e,0x92));var _0xe075=function(_0x24e934,_0x4b63aa){_0x24e934=_0x24e934-0x0;var _0x1dea46=_0x075e[_0x24e934];return _0x1dea46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe075('0x0'));var zipdir=require(_0xe075('0x1'));var jsonpatch=require(_0xe075('0x2'));var rp=require(_0xe075('0x3'));var moment=require(_0xe075('0x4'));var BPromise=require(_0xe075('0x5'));var Mustache=require(_0xe075('0x6'));var util=require(_0xe075('0x7'));var path=require('path');var sox=require(_0xe075('0x8'));var csv=require(_0xe075('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe075('0xa'));var _=require(_0xe075('0xb'));var squel=require(_0xe075('0xc'));var crypto=require(_0xe075('0xd'));var jsforce=require(_0xe075('0xe'));var deskjs=require(_0xe075('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe075('0x10'));var Papa=require(_0xe075('0x11'));var Redis=require('ioredis');var authService=require(_0xe075('0x12'));var qs=require(_0xe075('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe075('0x14'));var logger=require(_0xe075('0x15'))(_0xe075('0x16'));var utils=require(_0xe075('0x17'));var config=require(_0xe075('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xe075('0x19')][_0xe075('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3dbea6,_0x41aaf5,_0x4d0182,_0x21aa92){return new BPromise(function(_0x4fbf61,_0x239f7a){var _0x892655=_0x21aa92||client;return _0x892655[_0xe075('0x1b')](_0x3dbea6,_0x4d0182)[_0xe075('0x1c')](function(_0x1d283a){logger['info']('Setting,\x20%s,\x20%s',_0x41aaf5,_0xe075('0x1d'));logger[_0xe075('0x1e')](_0xe075('0x1f'),_0x41aaf5,_0xe075('0x1d'),JSON[_0xe075('0x20')](_0x1d283a));if(_0x1d283a[_0xe075('0x21')]){if(_0x1d283a[_0xe075('0x21')]['code']===0x1f4){logger[_0xe075('0x21')](_0xe075('0x22'),_0x41aaf5,_0x1d283a[_0xe075('0x21')][_0xe075('0x23')]);return _0x239f7a(_0x1d283a['error'][_0xe075('0x23')]);}logger[_0xe075('0x21')](_0xe075('0x22'),_0x41aaf5,_0x1d283a[_0xe075('0x21')][_0xe075('0x23')]);return _0x4fbf61(_0x1d283a[_0xe075('0x21')][_0xe075('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x41aaf5,_0xe075('0x1d'));_0x4fbf61(_0x1d283a[_0xe075('0x24')][_0xe075('0x23')]);}})[_0xe075('0x25')](function(_0x590352){logger['error'](_0xe075('0x22'),_0x41aaf5,_0x590352);_0x239f7a(_0x590352);});});}function respondWithStatusCode(_0x125042,_0x1120e2){_0x1120e2=_0x1120e2||0xcc;return function(_0x532e63){if(_0x532e63){return _0x125042[_0xe075('0x26')](_0x1120e2);}return _0x125042['status'](_0x1120e2)[_0xe075('0x27')]();};}function respondWithResult(_0x31b1bd,_0x4113d8){_0x4113d8=_0x4113d8||0xc8;return function(_0x5c7e89){if(_0x5c7e89){return _0x31b1bd[_0xe075('0x28')](_0x4113d8)['json'](_0x5c7e89);}};}function respondWithFilteredResult(_0x3a4e10,_0x4d4ae8){return function(_0x598776){if(_0x598776){var _0x54838c=typeof _0x4d4ae8['offset']===_0xe075('0x29')&&typeof _0x4d4ae8['limit']===_0xe075('0x29');var _0x1901c1=_0x598776[_0xe075('0x2a')];var _0x1e8da5=_0x54838c?0x0:_0x4d4ae8[_0xe075('0x2b')];var _0x43570b=_0x54838c?_0x598776['count']:_0x4d4ae8[_0xe075('0x2b')]+_0x4d4ae8[_0xe075('0x2c')];var _0x1d7b93;if(_0x43570b>=_0x1901c1){_0x43570b=_0x1901c1;_0x1d7b93=0xc8;}else{_0x1d7b93=0xce;}_0x3a4e10['status'](_0x1d7b93);return _0x3a4e10['set'](_0xe075('0x2d'),_0x1e8da5+'-'+_0x43570b+'/'+_0x1901c1)[_0xe075('0x2e')](_0x598776);}return null;};}function patchUpdates(_0x1aaf08){return function(_0xb376b9){try{jsonpatch[_0xe075('0x2f')](_0xb376b9,_0x1aaf08,!![]);}catch(_0x6672a1){return BPromise[_0xe075('0x30')](_0x6672a1);}return _0xb376b9[_0xe075('0x31')]();};}function saveUpdates(_0x4bcb58,_0x19868b){return function(_0x4c99a4){if(_0x4c99a4){return _0x4c99a4[_0xe075('0x32')](_0x4bcb58)[_0xe075('0x1c')](function(_0x112d80){return _0x112d80;});}return null;};}function removeEntity(_0x47a895,_0x539c75){return function(_0x603a55){if(_0x603a55){return _0x603a55[_0xe075('0x33')]()[_0xe075('0x1c')](function(){_0x47a895[_0xe075('0x28')](0xcc)[_0xe075('0x27')]();});}};}function handleEntityNotFound(_0x3a1ede,_0x53ed9c){return function(_0xf957de){if(!_0xf957de){_0x3a1ede[_0xe075('0x26')](0x194);}return _0xf957de;};}function handleError(_0x37e247,_0x326b0){_0x326b0=_0x326b0||0x1f4;return function(_0x5d0937){logger[_0xe075('0x21')](_0x5d0937[_0xe075('0x34')]);if(_0x5d0937[_0xe075('0x35')]){delete _0x5d0937[_0xe075('0x35')];}_0x37e247[_0xe075('0x28')](_0x326b0)[_0xe075('0x36')](_0x5d0937);};}exports[_0xe075('0x37')]=function(_0xa7f3cf,_0x2cbf5c){var _0x1a6521={},_0x13e8d8={},_0x1f7a1f={'count':0x0,'rows':[]};var _0x263f60=_[_0xe075('0x38')](db[_0xe075('0x39')][_0xe075('0x3a')],function(_0x5ad672){return{'name':_0x5ad672[_0xe075('0x3b')],'type':_0x5ad672['type'][_0xe075('0x3c')]};});_0x13e8d8[_0xe075('0x3d')]=_[_0xe075('0x38')](_0x263f60,_0xe075('0x35'));_0x13e8d8['query']=_[_0xe075('0x3e')](_0xa7f3cf['query']);_0x13e8d8['filters']=_[_0xe075('0x3f')](_0x13e8d8[_0xe075('0x3d')],_0x13e8d8[_0xe075('0x40')]);_0x1a6521[_0xe075('0x41')]=_[_0xe075('0x3f')](_0x13e8d8[_0xe075('0x3d')],qs['fields'](_0xa7f3cf[_0xe075('0x40')][_0xe075('0x42')]));_0x1a6521[_0xe075('0x41')]=_0x1a6521[_0xe075('0x41')][_0xe075('0x43')]?_0x1a6521['attributes']:_0x13e8d8[_0xe075('0x3d')];if(!_0xa7f3cf[_0xe075('0x40')][_0xe075('0x44')](_0xe075('0x45'))){_0x1a6521[_0xe075('0x2c')]=qs[_0xe075('0x2c')](_0xa7f3cf[_0xe075('0x40')][_0xe075('0x2c')]);_0x1a6521['offset']=qs['offset'](_0xa7f3cf[_0xe075('0x40')][_0xe075('0x2b')]);}_0x1a6521[_0xe075('0x46')]=qs[_0xe075('0x47')](_0xa7f3cf[_0xe075('0x40')][_0xe075('0x47')]);_0x1a6521['where']=qs[_0xe075('0x48')](_[_0xe075('0x49')](_0xa7f3cf[_0xe075('0x40')],_0x13e8d8['filters']),_0x263f60);if(_0xa7f3cf[_0xe075('0x40')][_0xe075('0x4a')]){_0x1a6521['where']=_[_0xe075('0x4b')](_0x1a6521[_0xe075('0x4c')],{'$or':_['map'](_0x263f60,function(_0xd7fb8e){if(_0xd7fb8e['type']!=='VIRTUAL'){var _0x4feac6={};_0x4feac6[_0xd7fb8e[_0xe075('0x35')]]={'$like':'%'+_0xa7f3cf[_0xe075('0x40')][_0xe075('0x4a')]+'%'};return _0x4feac6;}})});}_0x1a6521=_[_0xe075('0x4b')]({},_0x1a6521,_0xa7f3cf[_0xe075('0x4d')]);var _0x45cc40={'where':_0x1a6521[_0xe075('0x4c')]};return db[_0xe075('0x39')][_0xe075('0x2a')](_0x45cc40)[_0xe075('0x1c')](function(_0x35f7c4){_0x1f7a1f[_0xe075('0x2a')]=_0x35f7c4;if(_0xa7f3cf[_0xe075('0x40')][_0xe075('0x4e')]){_0x1a6521['include']=[{'all':!![]}];}return db[_0xe075('0x39')][_0xe075('0x4f')](_0x1a6521);})[_0xe075('0x1c')](function(_0x15f6d0){_0x1f7a1f[_0xe075('0x50')]=_0x15f6d0;return _0x1f7a1f;})[_0xe075('0x1c')](respondWithFilteredResult(_0x2cbf5c,_0x1a6521))[_0xe075('0x25')](handleError(_0x2cbf5c,null));};exports[_0xe075('0x51')]=function(_0x35c834,_0x5aa965){var _0x45b9e0={'raw':![],'where':{'id':_0x35c834[_0xe075('0x52')]['id']}},_0x53a628={};_0x53a628[_0xe075('0x3d')]=_[_0xe075('0x3e')](db[_0xe075('0x39')]['rawAttributes']);_0x53a628['query']=_['keys'](_0x35c834[_0xe075('0x40')]);_0x53a628['filters']=_[_0xe075('0x3f')](_0x53a628[_0xe075('0x3d')],_0x53a628[_0xe075('0x40')]);_0x45b9e0['attributes']=_[_0xe075('0x3f')](_0x53a628[_0xe075('0x3d')],qs[_0xe075('0x42')](_0x35c834[_0xe075('0x40')][_0xe075('0x42')]));_0x45b9e0[_0xe075('0x41')]=_0x45b9e0[_0xe075('0x41')][_0xe075('0x43')]?_0x45b9e0[_0xe075('0x41')]:_0x53a628[_0xe075('0x3d')];if(_0x35c834[_0xe075('0x40')][_0xe075('0x4e')]){_0x45b9e0[_0xe075('0x53')]=[{'all':!![]}];}_0x45b9e0=_[_0xe075('0x4b')]({},_0x45b9e0,_0x35c834['options']);return db[_0xe075('0x39')][_0xe075('0x54')](_0x45b9e0)[_0xe075('0x1c')](handleEntityNotFound(_0x5aa965,null))['then'](respondWithResult(_0x5aa965,null))[_0xe075('0x25')](handleError(_0x5aa965,null));};exports['update']=function(_0x3f52e1,_0x3a6999){if(_0x3f52e1[_0xe075('0x55')]['id']){delete _0x3f52e1[_0xe075('0x55')]['id'];}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x3f52e1['params']['id']}})['then'](handleEntityNotFound(_0x3a6999,null))['then'](saveUpdates(_0x3f52e1['body'],null))[_0xe075('0x1c')](respondWithResult(_0x3a6999,null))[_0xe075('0x25')](handleError(_0x3a6999,null));};exports[_0xe075('0x56')]=function(_0x5c9240,_0x598a72,_0x4bfeb6){if(_0x5c9240[_0xe075('0x57')]&&_0x5c9240['file']['filename']){_0x5c9240[_0xe075('0x55')][_0xe075('0x58')]=_0x5c9240[_0xe075('0x57')][_0xe075('0x59')];}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x5c9240[_0xe075('0x52')]['id']}})[_0xe075('0x1c')](handleEntityNotFound(_0x598a72,null))['then'](saveUpdates(_0x5c9240[_0xe075('0x55')],null))[_0xe075('0x1c')](respondWithResult(_0x598a72,null))['catch'](handleError(_0x598a72,null));};exports[_0xe075('0x5a')]=function(_0x1334fc,_0x1f3291,_0x1de5d6){if(_0x1334fc[_0xe075('0x57')]&&_0x1334fc[_0xe075('0x57')]['filename']){_0x1334fc[_0xe075('0x55')]['loginLogo']=_0x1334fc[_0xe075('0x57')][_0xe075('0x59')];}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x1334fc['params']['id']}})['then'](handleEntityNotFound(_0x1f3291,null))[_0xe075('0x1c')](saveUpdates(_0x1334fc[_0xe075('0x55')],null))['then'](respondWithResult(_0x1f3291,null))[_0xe075('0x25')](handleError(_0x1f3291,null));};var utilLicense=require('../../config/license/util');exports[_0xe075('0x5b')]=function(_0xa8906f,_0x3eba02,_0x44701b){var _0x4023c9=_0xe075('0x5c');var _0x35ce1d={'custom':![]};return utilLicense[_0xe075('0x5d')]()['then'](function(_0x2e02c9){if(_0x2e02c9){_0x35ce1d=_0x2e02c9;}return db[_0xe075('0x39')]['find']({'where':{'id':_0xa8906f[_0xe075('0x52')]['id']},'attributes':[_0xe075('0x58'),_0xe075('0x5e'),_0xe075('0x5f'),'favicon',_0xe075('0x60'),_0xe075('0x61'),_0xe075('0x62'),_0xe075('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x3eba02,null))['then'](function(_0x341f3c){if(_0x341f3c){var _0x5547ef=_0x341f3c[_0xe075('0x58')]&&fs[_0xe075('0x64')](path[_0xe075('0x65')](config[_0xe075('0x66')],_0x4023c9,_[_0xe075('0x67')](_0x341f3c['logo'])))?path[_0xe075('0x65')](config['root'],_0x4023c9,_['toLower'](_0x341f3c[_0xe075('0x58')])):path[_0xe075('0x65')](config[_0xe075('0x66')],_0x4023c9,_[_0xe075('0x67')](_0xe075('0x68')));var _0x2a64a0=_0xe075('0x69')+_[_0xe075('0x6a')](_0xe075('0x58'));if(_0x341f3c[_0x2a64a0]||!_0x35ce1d[_0xe075('0x6b')]){_0x5547ef=path[_0xe075('0x65')](config[_0xe075('0x66')],_0x4023c9,_[_0xe075('0x67')](_0xe075('0x68')));}if(!fs['existsSync'](_0x5547ef)){throw new db[(_0xe075('0x6c'))]['ValidationError'](_[_0xe075('0x6a')](_0xe075('0x58'))+_0xe075('0x6d'));}return _0x3eba02['download'](_0x5547ef);}})[_0xe075('0x25')](handleError(_0x3eba02,null));};var utilLicense=require(_0xe075('0x6e'));exports[_0xe075('0x6f')]=function(_0x10a4c6,_0x5b6fa0,_0x5910e5){var _0x455656=_0xe075('0x5c');var _0x36b5a0={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x33ebe4){if(_0x33ebe4){_0x36b5a0=_0x33ebe4;}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x10a4c6[_0xe075('0x52')]['id']},'attributes':[_0xe075('0x58'),_0xe075('0x5e'),_0xe075('0x5f'),_0xe075('0x70'),_0xe075('0x60'),'defaultLoginLogo',_0xe075('0x62'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5b6fa0,null))[_0xe075('0x1c')](function(_0x8c190c){if(_0x8c190c){var _0xeebc6f=_0x8c190c['loginLogo']&&fs[_0xe075('0x64')](path[_0xe075('0x65')](config[_0xe075('0x66')],_0x455656,_[_0xe075('0x67')](_0x8c190c['loginLogo'])))?path[_0xe075('0x65')](config[_0xe075('0x66')],_0x455656,_[_0xe075('0x67')](_0x8c190c[_0xe075('0x5e')])):path[_0xe075('0x65')](config[_0xe075('0x66')],_0x455656,_[_0xe075('0x67')](_0xe075('0x71')));var _0x4f6764=_0xe075('0x69')+_[_0xe075('0x6a')](_0xe075('0x5e'));if(_0x8c190c[_0x4f6764]||!_0x36b5a0['custom']){_0xeebc6f=path['join'](config[_0xe075('0x66')],_0x455656,_[_0xe075('0x67')](_0xe075('0x71')));}if(!fs['existsSync'](_0xeebc6f)){throw new db[(_0xe075('0x6c'))]['ValidationError'](_[_0xe075('0x6a')](_0xe075('0x5e'))+_0xe075('0x6d'));}return _0x5b6fa0[_0xe075('0x72')](_0xeebc6f);}})[_0xe075('0x25')](handleError(_0x5b6fa0,null));};exports[_0xe075('0x73')]=function(_0x53ad05,_0x57c27a){return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x53ad05[_0xe075('0x52')]['id']},'attributes':[_0xe075('0x74')]})[_0xe075('0x1c')](respondWithResult(_0x57c27a,null))[_0xe075('0x25')](handleError(_0x57c27a,null));};exports[_0xe075('0x75')]=function(_0x3cbd36,_0x1bd131,_0x47a5b3){if(_0x3cbd36[_0xe075('0x57')]&&_0x3cbd36[_0xe075('0x57')][_0xe075('0x59')]){_0x3cbd36[_0xe075('0x55')]['preferred']=_0x3cbd36[_0xe075('0x57')][_0xe075('0x59')];}return db[_0xe075('0x39')]['find']({'where':{'id':_0x3cbd36[_0xe075('0x52')]['id']}})['then'](handleEntityNotFound(_0x1bd131,null))['then'](saveUpdates(_0x3cbd36[_0xe075('0x55')],null))[_0xe075('0x1c')](respondWithResult(_0x1bd131,null))[_0xe075('0x25')](handleError(_0x1bd131,null));};var utilLicense=require(_0xe075('0x6e'));exports['getPreferred']=function(_0x491f30,_0x185c6e,_0x51ed2e){var _0x42fe13=_0xe075('0x5c');var _0x38dbfe={'custom':![]};return utilLicense[_0xe075('0x5d')]()[_0xe075('0x1c')](function(_0x37e853){if(_0x37e853){_0x38dbfe=_0x37e853;}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x491f30[_0xe075('0x52')]['id']},'attributes':[_0xe075('0x58'),'loginLogo',_0xe075('0x5f'),_0xe075('0x70'),'defaultLogo',_0xe075('0x61'),_0xe075('0x62'),_0xe075('0x63')],'raw':!![]});})[_0xe075('0x1c')](handleEntityNotFound(_0x185c6e,null))['then'](function(_0x5304e8){if(_0x5304e8){var _0x109ffd=_0x5304e8['preferred']&&fs[_0xe075('0x64')](path[_0xe075('0x65')](config[_0xe075('0x66')],_0x42fe13,_[_0xe075('0x67')](_0x5304e8[_0xe075('0x5f')])))?path[_0xe075('0x65')](config[_0xe075('0x66')],_0x42fe13,_['toLower'](_0x5304e8[_0xe075('0x5f')])):path[_0xe075('0x65')](config[_0xe075('0x66')],_0x42fe13,_['toLower'](_0xe075('0x76')));var _0x379a3a=_0xe075('0x69')+_[_0xe075('0x6a')](_0xe075('0x5f'));if(_0x5304e8[_0x379a3a]||!_0x38dbfe[_0xe075('0x6b')]||!_0x38dbfe[_0xe075('0x5f')]){_0x109ffd=path['join'](config[_0xe075('0x66')],_0x42fe13,_[_0xe075('0x67')](_0xe075('0x76')));}if(!fs[_0xe075('0x64')](_0x109ffd)){throw new db[(_0xe075('0x6c'))][(_0xe075('0x77'))](_[_0xe075('0x6a')](_0xe075('0x5f'))+_0xe075('0x6d'));}return _0x185c6e[_0xe075('0x72')](_0x109ffd);}})[_0xe075('0x25')](handleError(_0x185c6e,null));};exports['addFavicon']=function(_0x5a6b7a,_0x58244b,_0x1cb213){if(_0x5a6b7a[_0xe075('0x57')]&&_0x5a6b7a[_0xe075('0x57')][_0xe075('0x59')]){_0x5a6b7a[_0xe075('0x55')][_0xe075('0x70')]=_0x5a6b7a[_0xe075('0x57')][_0xe075('0x59')];}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x5a6b7a[_0xe075('0x52')]['id']}})['then'](handleEntityNotFound(_0x58244b,null))[_0xe075('0x1c')](saveUpdates(_0x5a6b7a[_0xe075('0x55')],null))[_0xe075('0x1c')](respondWithResult(_0x58244b,null))[_0xe075('0x25')](handleError(_0x58244b,null));};var utilLicense=require(_0xe075('0x6e'));exports[_0xe075('0x78')]=function(_0x478f5b,_0xec445d,_0x4c67a2){var _0x404470='server/files/images/logos';var _0x4d8bc0={'custom':![]};return utilLicense[_0xe075('0x5d')]()[_0xe075('0x1c')](function(_0x148154){if(_0x148154){_0x4d8bc0=_0x148154;}return db[_0xe075('0x39')][_0xe075('0x54')]({'where':{'id':_0x478f5b[_0xe075('0x52')]['id']},'attributes':['logo','loginLogo',_0xe075('0x5f'),_0xe075('0x70'),_0xe075('0x60'),_0xe075('0x61'),_0xe075('0x62'),_0xe075('0x63')],'raw':!![]});})[_0xe075('0x1c')](handleEntityNotFound(_0xec445d,null))[_0xe075('0x1c')](function(_0x34bfcb){if(_0x34bfcb){var _0x180bc1=_0x34bfcb['favicon']&&fs[_0xe075('0x64')](path[_0xe075('0x65')](config[_0xe075('0x66')],_0x404470,_[_0xe075('0x67')](_0x34bfcb[_0xe075('0x70')])))?path['join'](config[_0xe075('0x66')],_0x404470,_[_0xe075('0x67')](_0x34bfcb[_0xe075('0x70')])):path[_0xe075('0x65')](config[_0xe075('0x66')],_0x404470,_['toLower'](_0xe075('0x79')));var _0x430dfe='default'+_[_0xe075('0x6a')](_0xe075('0x70'));if(_0x34bfcb[_0x430dfe]||!_0x4d8bc0[_0xe075('0x6b')]){_0x180bc1=path[_0xe075('0x65')](config[_0xe075('0x66')],_0x404470,_[_0xe075('0x67')]('default_favicon.ico'));}if(!fs[_0xe075('0x64')](_0x180bc1)){throw new db[(_0xe075('0x6c'))][(_0xe075('0x77'))](_['upperFirst'](_0xe075('0x70'))+_0xe075('0x6d'));}return _0xec445d['download'](_0x180bc1);}})[_0xe075('0x25')](handleError(_0xec445d,null));};exports[_0xe075('0x7a')]=function(_0x5f18bc,_0x1bfc0b){var _0x3806ea={'offset':moment()['utcOffset']()};_0x3806ea['now']=moment()['utcOffset'](_0x3806ea[_0xe075('0x2b')])[_0xe075('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1bfc0b['status'](0xc8)[_0xe075('0x36')](_0x3806ea);}; \ No newline at end of file +var _0xdc84=['offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','download','preferred','defaultFavicon','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default_favicon.ico','custom','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xdc84,0x1d5));var _0x4dc8=function(_0x899a7b,_0x47f3fe){_0x899a7b=_0x899a7b-0x0;var _0x501574=_0xdc84[_0x899a7b];return _0x501574;};'use strict';var emlformat=require(_0x4dc8('0x0'));var rimraf=require(_0x4dc8('0x1'));var zipdir=require(_0x4dc8('0x2'));var jsonpatch=require(_0x4dc8('0x3'));var rp=require(_0x4dc8('0x4'));var moment=require('moment');var BPromise=require(_0x4dc8('0x5'));var Mustache=require(_0x4dc8('0x6'));var util=require(_0x4dc8('0x7'));var path=require(_0x4dc8('0x8'));var sox=require(_0x4dc8('0x9'));var csv=require(_0x4dc8('0xa'));var ejs=require(_0x4dc8('0xb'));var fs=require('fs');var fs_extra=require(_0x4dc8('0xc'));var _=require(_0x4dc8('0xd'));var squel=require(_0x4dc8('0xe'));var crypto=require(_0x4dc8('0xf'));var jsforce=require(_0x4dc8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4dc8('0x11'));var Papa=require(_0x4dc8('0x12'));var Redis=require(_0x4dc8('0x13'));var authService=require(_0x4dc8('0x14'));var qs=require(_0x4dc8('0x15'));var as=require(_0x4dc8('0x16'));var hardwareService=require(_0x4dc8('0x17'));var logger=require(_0x4dc8('0x18'))('api');var utils=require(_0x4dc8('0x19'));var config=require(_0x4dc8('0x1a'));var licenseUtil=require(_0x4dc8('0x1b'));var db=require(_0x4dc8('0x1c'))['db'];var jayson=require(_0x4dc8('0x1d'));var client=jayson[_0x4dc8('0x1e')][_0x4dc8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x34a472,_0xabcb63,_0x3a0c4c,_0x159fb9){return new BPromise(function(_0x3ee8af,_0x7edee0){var _0x32b363=_0x159fb9||client;return _0x32b363[_0x4dc8('0x20')](_0x34a472,_0x3a0c4c)[_0x4dc8('0x21')](function(_0x175749){logger[_0x4dc8('0x22')](_0x4dc8('0x23'),_0xabcb63,_0x4dc8('0x24'));logger[_0x4dc8('0x25')](_0x4dc8('0x26'),_0xabcb63,_0x4dc8('0x24'),JSON[_0x4dc8('0x27')](_0x175749));if(_0x175749[_0x4dc8('0x28')]){if(_0x175749['error'][_0x4dc8('0x29')]===0x1f4){logger[_0x4dc8('0x28')](_0x4dc8('0x23'),_0xabcb63,_0x175749['error'][_0x4dc8('0x2a')]);return _0x7edee0(_0x175749['error']['message']);}logger[_0x4dc8('0x28')]('Setting,\x20%s,\x20%s',_0xabcb63,_0x175749['error'][_0x4dc8('0x2a')]);return _0x3ee8af(_0x175749[_0x4dc8('0x28')][_0x4dc8('0x2a')]);}else{logger['info'](_0x4dc8('0x23'),_0xabcb63,_0x4dc8('0x24'));_0x3ee8af(_0x175749[_0x4dc8('0x2b')]['message']);}})[_0x4dc8('0x2c')](function(_0x1ecf4f){logger[_0x4dc8('0x28')](_0x4dc8('0x23'),_0xabcb63,_0x1ecf4f);_0x7edee0(_0x1ecf4f);});});}function respondWithStatusCode(_0x25612f,_0xc9557c){_0xc9557c=_0xc9557c||0xcc;return function(_0x3c569f){if(_0x3c569f){return _0x25612f[_0x4dc8('0x2d')](_0xc9557c);}return _0x25612f[_0x4dc8('0x2e')](_0xc9557c)[_0x4dc8('0x2f')]();};}function respondWithResult(_0x27d4bd,_0x32ca8f){_0x32ca8f=_0x32ca8f||0xc8;return function(_0x5736f7){if(_0x5736f7){return _0x27d4bd['status'](_0x32ca8f)[_0x4dc8('0x30')](_0x5736f7);}};}function respondWithFilteredResult(_0x2d349c,_0x373bc8){return function(_0x10aa45){if(_0x10aa45){var _0x7311c3=typeof _0x373bc8['offset']===_0x4dc8('0x31')&&typeof _0x373bc8['limit']===_0x4dc8('0x31');var _0x370752=_0x10aa45['count'];var _0x435a3a=_0x7311c3?0x0:_0x373bc8['offset'];var _0x3fd9d3=_0x7311c3?_0x10aa45[_0x4dc8('0x32')]:_0x373bc8[_0x4dc8('0x33')]+_0x373bc8[_0x4dc8('0x34')];var _0x1cf58b;if(_0x3fd9d3>=_0x370752){_0x3fd9d3=_0x370752;_0x1cf58b=0xc8;}else{_0x1cf58b=0xce;}_0x2d349c[_0x4dc8('0x2e')](_0x1cf58b);return _0x2d349c[_0x4dc8('0x35')](_0x4dc8('0x36'),_0x435a3a+'-'+_0x3fd9d3+'/'+_0x370752)[_0x4dc8('0x30')](_0x10aa45);}return null;};}function patchUpdates(_0x5d1433){return function(_0x28c3c9){try{jsonpatch['apply'](_0x28c3c9,_0x5d1433,!![]);}catch(_0x314282){return BPromise[_0x4dc8('0x37')](_0x314282);}return _0x28c3c9['save']();};}function saveUpdates(_0x530889,_0xd35071){return function(_0x4f153c){if(_0x4f153c){return _0x4f153c[_0x4dc8('0x38')](_0x530889)['then'](function(_0x30761f){return _0x30761f;});}return null;};}function removeEntity(_0x46bdec,_0x3a3f7a){return function(_0xdffc77){if(_0xdffc77){return _0xdffc77[_0x4dc8('0x39')]()['then'](function(){_0x46bdec[_0x4dc8('0x2e')](0xcc)[_0x4dc8('0x2f')]();});}};}function handleEntityNotFound(_0x122695,_0x24f8ff){return function(_0x4cdddc){if(!_0x4cdddc){_0x122695['sendStatus'](0x194);}return _0x4cdddc;};}function handleError(_0x456ec3,_0x10f5da){_0x10f5da=_0x10f5da||0x1f4;return function(_0x13638a){logger[_0x4dc8('0x28')](_0x13638a[_0x4dc8('0x3a')]);if(_0x13638a[_0x4dc8('0x3b')]){delete _0x13638a[_0x4dc8('0x3b')];}_0x456ec3['status'](_0x10f5da)[_0x4dc8('0x3c')](_0x13638a);};}exports['index']=function(_0x5086a6,_0x288630){var _0x561304={},_0xf8efe9={},_0x3b654b={'count':0x0,'rows':[]};var _0x26be71=_[_0x4dc8('0x3d')](db[_0x4dc8('0x3e')][_0x4dc8('0x3f')],function(_0x30bdaa){return{'name':_0x30bdaa[_0x4dc8('0x40')],'type':_0x30bdaa[_0x4dc8('0x41')][_0x4dc8('0x42')]};});_0xf8efe9['model']=_[_0x4dc8('0x3d')](_0x26be71,_0x4dc8('0x3b'));_0xf8efe9[_0x4dc8('0x43')]=_[_0x4dc8('0x44')](_0x5086a6['query']);_0xf8efe9[_0x4dc8('0x45')]=_[_0x4dc8('0x46')](_0xf8efe9[_0x4dc8('0x47')],_0xf8efe9[_0x4dc8('0x43')]);_0x561304['attributes']=_['intersection'](_0xf8efe9['model'],qs[_0x4dc8('0x48')](_0x5086a6[_0x4dc8('0x43')][_0x4dc8('0x48')]));_0x561304[_0x4dc8('0x49')]=_0x561304[_0x4dc8('0x49')][_0x4dc8('0x4a')]?_0x561304['attributes']:_0xf8efe9[_0x4dc8('0x47')];if(!_0x5086a6[_0x4dc8('0x43')][_0x4dc8('0x4b')](_0x4dc8('0x4c'))){_0x561304[_0x4dc8('0x34')]=qs[_0x4dc8('0x34')](_0x5086a6['query']['limit']);_0x561304['offset']=qs[_0x4dc8('0x33')](_0x5086a6[_0x4dc8('0x43')][_0x4dc8('0x33')]);}_0x561304['order']=qs[_0x4dc8('0x4d')](_0x5086a6[_0x4dc8('0x43')]['sort']);_0x561304['where']=qs['filters'](_[_0x4dc8('0x4e')](_0x5086a6[_0x4dc8('0x43')],_0xf8efe9[_0x4dc8('0x45')]),_0x26be71);if(_0x5086a6[_0x4dc8('0x43')]['filter']){_0x561304[_0x4dc8('0x4f')]=_[_0x4dc8('0x50')](_0x561304[_0x4dc8('0x4f')],{'$or':_['map'](_0x26be71,function(_0x52df25){if(_0x52df25[_0x4dc8('0x41')]!==_0x4dc8('0x51')){var _0x2bf578={};_0x2bf578[_0x52df25[_0x4dc8('0x3b')]]={'$like':'%'+_0x5086a6[_0x4dc8('0x43')][_0x4dc8('0x52')]+'%'};return _0x2bf578;}})});}_0x561304=_[_0x4dc8('0x50')]({},_0x561304,_0x5086a6['options']);var _0x2d40db={'where':_0x561304[_0x4dc8('0x4f')]};return db[_0x4dc8('0x3e')][_0x4dc8('0x32')](_0x2d40db)['then'](function(_0x348531){_0x3b654b['count']=_0x348531;if(_0x5086a6[_0x4dc8('0x43')][_0x4dc8('0x53')]){_0x561304[_0x4dc8('0x54')]=[{'all':!![]}];}return db[_0x4dc8('0x3e')][_0x4dc8('0x55')](_0x561304);})[_0x4dc8('0x21')](function(_0x38882b){_0x3b654b[_0x4dc8('0x56')]=_0x38882b;return _0x3b654b;})['then'](respondWithFilteredResult(_0x288630,_0x561304))[_0x4dc8('0x2c')](handleError(_0x288630,null));};exports[_0x4dc8('0x57')]=function(_0x131739,_0x33984d){var _0x509caf={'raw':![],'where':{'id':_0x131739[_0x4dc8('0x58')]['id']}},_0x21c0ce={};_0x21c0ce[_0x4dc8('0x47')]=_[_0x4dc8('0x44')](db[_0x4dc8('0x3e')][_0x4dc8('0x3f')]);_0x21c0ce['query']=_[_0x4dc8('0x44')](_0x131739[_0x4dc8('0x43')]);_0x21c0ce[_0x4dc8('0x45')]=_[_0x4dc8('0x46')](_0x21c0ce[_0x4dc8('0x47')],_0x21c0ce[_0x4dc8('0x43')]);_0x509caf[_0x4dc8('0x49')]=_['intersection'](_0x21c0ce[_0x4dc8('0x47')],qs['fields'](_0x131739[_0x4dc8('0x43')][_0x4dc8('0x48')]));_0x509caf['attributes']=_0x509caf[_0x4dc8('0x49')]['length']?_0x509caf[_0x4dc8('0x49')]:_0x21c0ce[_0x4dc8('0x47')];if(_0x131739[_0x4dc8('0x43')][_0x4dc8('0x53')]){_0x509caf[_0x4dc8('0x54')]=[{'all':!![]}];}_0x509caf=_[_0x4dc8('0x50')]({},_0x509caf,_0x131739[_0x4dc8('0x59')]);return db['Setting'][_0x4dc8('0x5a')](_0x509caf)[_0x4dc8('0x21')](handleEntityNotFound(_0x33984d,null))['then'](respondWithResult(_0x33984d,null))['catch'](handleError(_0x33984d,null));};exports[_0x4dc8('0x38')]=function(_0x266aff,_0x3821e8){if(_0x266aff[_0x4dc8('0x5b')]['id']){delete _0x266aff[_0x4dc8('0x5b')]['id'];}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x266aff['params']['id']}})[_0x4dc8('0x21')](handleEntityNotFound(_0x3821e8,null))[_0x4dc8('0x21')](saveUpdates(_0x266aff[_0x4dc8('0x5b')],null))[_0x4dc8('0x21')](respondWithResult(_0x3821e8,null))['catch'](handleError(_0x3821e8,null));};exports[_0x4dc8('0x5c')]=function(_0x105461,_0x5228a4,_0x3ae290){if(_0x105461[_0x4dc8('0x5d')]&&_0x105461['file'][_0x4dc8('0x5e')]){_0x105461[_0x4dc8('0x5b')][_0x4dc8('0x5f')]=_0x105461[_0x4dc8('0x5d')][_0x4dc8('0x5e')];}return db[_0x4dc8('0x3e')]['find']({'where':{'id':_0x105461['params']['id']}})['then'](handleEntityNotFound(_0x5228a4,null))['then'](saveUpdates(_0x105461['body'],null))[_0x4dc8('0x21')](respondWithResult(_0x5228a4,null))['catch'](handleError(_0x5228a4,null));};exports[_0x4dc8('0x60')]=function(_0x2a1463,_0x14bdf0,_0x949a0c){if(_0x2a1463[_0x4dc8('0x5d')]&&_0x2a1463[_0x4dc8('0x5d')][_0x4dc8('0x5e')]){_0x2a1463[_0x4dc8('0x5b')]['loginLogo']=_0x2a1463[_0x4dc8('0x5d')][_0x4dc8('0x5e')];}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x2a1463['params']['id']}})['then'](handleEntityNotFound(_0x14bdf0,null))[_0x4dc8('0x21')](saveUpdates(_0x2a1463[_0x4dc8('0x5b')],null))[_0x4dc8('0x21')](respondWithResult(_0x14bdf0,null))['catch'](handleError(_0x14bdf0,null));};var utilLicense=require('../../config/license/util');exports[_0x4dc8('0x61')]=function(_0x2f2598,_0x687880,_0x278f7d){var _0x45c6cd=_0x4dc8('0x62');var _0x1db851={'custom':![]};return utilLicense[_0x4dc8('0x63')]()['then'](function(_0x5f06cc){if(_0x5f06cc){_0x1db851=_0x5f06cc;}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x2f2598[_0x4dc8('0x58')]['id']},'attributes':['logo',_0x4dc8('0x64'),'preferred',_0x4dc8('0x65'),_0x4dc8('0x66'),_0x4dc8('0x67'),_0x4dc8('0x68'),'defaultFavicon'],'raw':!![]});})[_0x4dc8('0x21')](handleEntityNotFound(_0x687880,null))[_0x4dc8('0x21')](function(_0xc2bd3a){if(_0xc2bd3a){var _0x115d72=_0xc2bd3a[_0x4dc8('0x5f')]&&fs[_0x4dc8('0x69')](path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x45c6cd,_['toLower'](_0xc2bd3a['logo'])))?path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x45c6cd,_[_0x4dc8('0x6c')](_0xc2bd3a[_0x4dc8('0x5f')])):path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x45c6cd,_[_0x4dc8('0x6c')](_0x4dc8('0x6d')));var _0x129584=_0x4dc8('0x6e')+_[_0x4dc8('0x6f')]('logo');if(_0xc2bd3a[_0x129584]||!_0x1db851['custom']){_0x115d72=path['join'](config['root'],_0x45c6cd,_['toLower']('default_logo.svg'));}if(!fs['existsSync'](_0x115d72)){throw new db[(_0x4dc8('0x70'))]['ValidationError'](_['upperFirst'](_0x4dc8('0x5f'))+_0x4dc8('0x71'));}return _0x687880[_0x4dc8('0x72')](_0x115d72);}})['catch'](handleError(_0x687880,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x342bb6,_0x49ec81,_0x71b596){var _0x476965=_0x4dc8('0x62');var _0x4115a4={'custom':![]};return utilLicense[_0x4dc8('0x63')]()[_0x4dc8('0x21')](function(_0xb0acc5){if(_0xb0acc5){_0x4115a4=_0xb0acc5;}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x342bb6[_0x4dc8('0x58')]['id']},'attributes':['logo',_0x4dc8('0x64'),_0x4dc8('0x73'),_0x4dc8('0x65'),_0x4dc8('0x66'),_0x4dc8('0x67'),_0x4dc8('0x68'),_0x4dc8('0x74')],'raw':!![]});})[_0x4dc8('0x21')](handleEntityNotFound(_0x49ec81,null))[_0x4dc8('0x21')](function(_0x6d654a){if(_0x6d654a){var _0x45d0a1=_0x6d654a[_0x4dc8('0x64')]&&fs[_0x4dc8('0x69')](path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x476965,_[_0x4dc8('0x6c')](_0x6d654a[_0x4dc8('0x64')])))?path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x476965,_[_0x4dc8('0x6c')](_0x6d654a[_0x4dc8('0x64')])):path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x476965,_[_0x4dc8('0x6c')]('default_loginLogo.svg'));var _0xedbbc7='default'+_[_0x4dc8('0x6f')](_0x4dc8('0x64'));if(_0x6d654a[_0xedbbc7]||!_0x4115a4['custom']){_0x45d0a1=path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x476965,_[_0x4dc8('0x6c')](_0x4dc8('0x75')));}if(!fs[_0x4dc8('0x69')](_0x45d0a1)){throw new db[(_0x4dc8('0x70'))][(_0x4dc8('0x76'))](_['upperFirst'](_0x4dc8('0x64'))+_0x4dc8('0x71'));}return _0x49ec81[_0x4dc8('0x72')](_0x45d0a1);}})[_0x4dc8('0x2c')](handleError(_0x49ec81,null));};exports[_0x4dc8('0x77')]=function(_0x50fa93,_0x3b6d35){return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x50fa93[_0x4dc8('0x58')]['id']},'attributes':[_0x4dc8('0x78')]})[_0x4dc8('0x21')](respondWithResult(_0x3b6d35,null))[_0x4dc8('0x2c')](handleError(_0x3b6d35,null));};exports[_0x4dc8('0x79')]=function(_0x2ff780,_0x1ceb02,_0x32d656){if(_0x2ff780[_0x4dc8('0x5d')]&&_0x2ff780['file'][_0x4dc8('0x5e')]){_0x2ff780[_0x4dc8('0x5b')][_0x4dc8('0x73')]=_0x2ff780[_0x4dc8('0x5d')][_0x4dc8('0x5e')];}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x2ff780[_0x4dc8('0x58')]['id']}})[_0x4dc8('0x21')](handleEntityNotFound(_0x1ceb02,null))[_0x4dc8('0x21')](saveUpdates(_0x2ff780[_0x4dc8('0x5b')],null))[_0x4dc8('0x21')](respondWithResult(_0x1ceb02,null))[_0x4dc8('0x2c')](handleError(_0x1ceb02,null));};var utilLicense=require(_0x4dc8('0x1b'));exports[_0x4dc8('0x7a')]=function(_0x36c48f,_0x3d9e18,_0x5d5e99){var _0x39b6dd=_0x4dc8('0x62');var _0x1fd1c4={'custom':![]};return utilLicense[_0x4dc8('0x63')]()[_0x4dc8('0x21')](function(_0xe7e3ed){if(_0xe7e3ed){_0x1fd1c4=_0xe7e3ed;}return db['Setting']['find']({'where':{'id':_0x36c48f['params']['id']},'attributes':[_0x4dc8('0x5f'),_0x4dc8('0x64'),_0x4dc8('0x73'),_0x4dc8('0x65'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x4dc8('0x74')],'raw':!![]});})['then'](handleEntityNotFound(_0x3d9e18,null))['then'](function(_0x3e73a3){if(_0x3e73a3){var _0x4169da=_0x3e73a3['preferred']&&fs[_0x4dc8('0x69')](path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x39b6dd,_[_0x4dc8('0x6c')](_0x3e73a3[_0x4dc8('0x73')])))?path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x39b6dd,_[_0x4dc8('0x6c')](_0x3e73a3[_0x4dc8('0x73')])):path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x39b6dd,_['toLower'](_0x4dc8('0x7b')));var _0x273bf0=_0x4dc8('0x6e')+_[_0x4dc8('0x6f')](_0x4dc8('0x73'));if(_0x3e73a3[_0x273bf0]||!_0x1fd1c4['custom']||!_0x1fd1c4[_0x4dc8('0x73')]){_0x4169da=path['join'](config[_0x4dc8('0x6b')],_0x39b6dd,_['toLower'](_0x4dc8('0x7b')));}if(!fs[_0x4dc8('0x69')](_0x4169da)){throw new db[(_0x4dc8('0x70'))][(_0x4dc8('0x76'))](_[_0x4dc8('0x6f')](_0x4dc8('0x73'))+_0x4dc8('0x71'));}return _0x3d9e18['download'](_0x4169da);}})['catch'](handleError(_0x3d9e18,null));};exports['addFavicon']=function(_0x364289,_0xeb608b,_0x48554c){if(_0x364289['file']&&_0x364289[_0x4dc8('0x5d')][_0x4dc8('0x5e')]){_0x364289['body'][_0x4dc8('0x65')]=_0x364289['file'][_0x4dc8('0x5e')];}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x364289['params']['id']}})[_0x4dc8('0x21')](handleEntityNotFound(_0xeb608b,null))[_0x4dc8('0x21')](saveUpdates(_0x364289[_0x4dc8('0x5b')],null))['then'](respondWithResult(_0xeb608b,null))[_0x4dc8('0x2c')](handleError(_0xeb608b,null));};var utilLicense=require(_0x4dc8('0x1b'));exports['getFavicon']=function(_0x23bff6,_0xce2305,_0x2c889c){var _0x4e9e35=_0x4dc8('0x62');var _0x2ece82={'custom':![]};return utilLicense[_0x4dc8('0x63')]()[_0x4dc8('0x21')](function(_0x3617d0){if(_0x3617d0){_0x2ece82=_0x3617d0;}return db[_0x4dc8('0x3e')][_0x4dc8('0x5a')]({'where':{'id':_0x23bff6['params']['id']},'attributes':[_0x4dc8('0x5f'),'loginLogo',_0x4dc8('0x73'),_0x4dc8('0x65'),'defaultLogo','defaultLoginLogo',_0x4dc8('0x68'),_0x4dc8('0x74')],'raw':!![]});})[_0x4dc8('0x21')](handleEntityNotFound(_0xce2305,null))['then'](function(_0x2b78c7){if(_0x2b78c7){var _0x346e5b=_0x2b78c7[_0x4dc8('0x65')]&&fs[_0x4dc8('0x69')](path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x4e9e35,_[_0x4dc8('0x6c')](_0x2b78c7[_0x4dc8('0x65')])))?path['join'](config[_0x4dc8('0x6b')],_0x4e9e35,_['toLower'](_0x2b78c7[_0x4dc8('0x65')])):path[_0x4dc8('0x6a')](config[_0x4dc8('0x6b')],_0x4e9e35,_[_0x4dc8('0x6c')](_0x4dc8('0x7c')));var _0x32541c=_0x4dc8('0x6e')+_[_0x4dc8('0x6f')](_0x4dc8('0x65'));if(_0x2b78c7[_0x32541c]||!_0x2ece82[_0x4dc8('0x7d')]){_0x346e5b=path[_0x4dc8('0x6a')](config['root'],_0x4e9e35,_[_0x4dc8('0x6c')](_0x4dc8('0x7c')));}if(!fs['existsSync'](_0x346e5b)){throw new db[(_0x4dc8('0x70'))][(_0x4dc8('0x76'))](_[_0x4dc8('0x6f')](_0x4dc8('0x65'))+_0x4dc8('0x71'));}return _0xce2305[_0x4dc8('0x72')](_0x346e5b);}})[_0x4dc8('0x2c')](handleError(_0xce2305,null));};exports[_0x4dc8('0x7e')]=function(_0x4e71a6,_0x45b7b8){var _0x3daa42={'offset':moment()[_0x4dc8('0x7f')]()};_0x3daa42['now']=moment()[_0x4dc8('0x7f')](_0x3daa42[_0x4dc8('0x33')])[_0x4dc8('0x80')](_0x4dc8('0x81'));return _0x45b7b8['status'](0xc8)['send'](_0x3daa42);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0a8ca67..3d91ee6 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(_0x2aa87d,_0x1aa073){var _0x3a1812=function(_0x51ffc0){while(--_0x51ffc0){_0x2aa87d['push'](_0x2aa87d['shift']());}};_0x3a1812(++_0x1aa073);}(_0x3e74,0x175));var _0x43e7=function(_0x3cd5bb,_0x7afb75){_0x3cd5bb=_0x3cd5bb-0x0;var _0x2f8250=_0x3e74[_0x3cd5bb];return _0x2f8250;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4470d8,_0x557676){var _0x3c45f1=function(_0xa38dfc){while(--_0xa38dfc){_0x4470d8['push'](_0x4470d8['shift']());}};_0x3c45f1(++_0x557676);}(_0xedd9,0xfc));var _0x9edd=function(_0x55e8a9,_0x17cc3c){_0x55e8a9=_0x55e8a9-0x0;var _0x136a6d=_0xedd9[_0x55e8a9];return _0x136a6d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index a2943a2..51bff68 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 _0x53f9=['jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','find','raw','options','map','include','attributes','model','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x11deb0,_0x134734){var _0x3f63e1=function(_0x4c9a49){while(--_0x4c9a49){_0x11deb0['push'](_0x11deb0['shift']());}};_0x3f63e1(++_0x134734);}(_0x53f9,0x12e));var _0x953f=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x53f9[_0x888385];return _0x22d5c2;};'use strict';var _=require('lodash');var util=require(_0x953f('0x0'));var moment=require(_0x953f('0x1'));var BPromise=require('bluebird');var rs=require(_0x953f('0x2'));var fs=require('fs');var Redis=require(_0x953f('0x3'));var db=require(_0x953f('0x4'))['db'];var utils=require(_0x953f('0x5'));var logger=require('../../config/logger')(_0x953f('0x6'));var config=require(_0x953f('0x7'));var jayson=require(_0x953f('0x8'));var client=jayson[_0x953f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264844,_0x2e529d,_0x11de33){return new BPromise(function(_0x2a10b2,_0x20bddb){return client[_0x953f('0xa')](_0x264844,_0x11de33)['then'](function(_0x33a9c1){logger[_0x953f('0xb')](_0x953f('0xc'),_0x2e529d,_0x953f('0xd'));logger[_0x953f('0xe')](_0x953f('0xf'),_0x2e529d,_0x953f('0xd'),JSON[_0x953f('0x10')](_0x33a9c1));if(_0x33a9c1['error']){if(_0x33a9c1[_0x953f('0x11')][_0x953f('0x12')]===0x1f4){logger[_0x953f('0x11')](_0x953f('0xc'),_0x2e529d,_0x33a9c1[_0x953f('0x11')][_0x953f('0x13')]);return _0x20bddb(_0x33a9c1[_0x953f('0x11')][_0x953f('0x13')]);}logger[_0x953f('0x11')](_0x953f('0xc'),_0x2e529d,_0x33a9c1[_0x953f('0x11')]['message']);return _0x2a10b2(_0x33a9c1[_0x953f('0x11')][_0x953f('0x13')]);}else{logger[_0x953f('0xb')]('Setting,\x20%s,\x20%s',_0x2e529d,'request\x20sent');_0x2a10b2(_0x33a9c1[_0x953f('0x14')][_0x953f('0x13')]);}})[_0x953f('0x15')](function(_0x40da69){logger['error'](_0x953f('0xc'),_0x2e529d,_0x40da69);_0x20bddb(_0x40da69);});});}exports[_0x953f('0x16')]=function(_0x2bb7b5){var _0x3082b9=this;return new Promise(function(_0x3abfaa,_0x295950){return db['Setting'][_0x953f('0x17')]({'raw':_0x2bb7b5['options']?_0x2bb7b5['options'][_0x953f('0x18')]===undefined?!![]:![]:!![],'where':_0x2bb7b5[_0x953f('0x19')]?_0x2bb7b5[_0x953f('0x19')]['where']||null:null,'attributes':_0x2bb7b5[_0x953f('0x19')]?_0x2bb7b5[_0x953f('0x19')]['attributes']||null:null,'include':_0x2bb7b5[_0x953f('0x19')]?_0x2bb7b5[_0x953f('0x19')]['include']?_[_0x953f('0x1a')](_0x2bb7b5['options'][_0x953f('0x1b')],function(_0x27192e){return{'model':db[_0x27192e['model']],'as':_0x27192e['as'],'attributes':_0x27192e[_0x953f('0x1c')],'include':_0x27192e['include']?_['map'](_0x27192e[_0x953f('0x1b')],function(_0x5da945){return{'model':db[_0x5da945['model']],'as':_0x5da945['as'],'attributes':_0x5da945[_0x953f('0x1c')],'include':_0x5da945[_0x953f('0x1b')]?_[_0x953f('0x1a')](_0x5da945[_0x953f('0x1b')],function(_0x4656dd){return{'model':db[_0x4656dd[_0x953f('0x1d')]],'as':_0x4656dd['as'],'attributes':_0x4656dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x953f('0x1e')](function(_0x12119d){logger[_0x953f('0xb')](_0x953f('0x16'),_0x2bb7b5);logger[_0x953f('0xe')](_0x953f('0x16'),_0x2bb7b5,JSON[_0x953f('0x10')](_0x12119d));_0x3abfaa(_0x12119d);})[_0x953f('0x15')](function(_0x4bd139){logger['error'](_0x953f('0x16'),_0x4bd139[_0x953f('0x13')],_0x2bb7b5);_0x295950(_0x3082b9['error'](0x1f4,_0x4bd139[_0x953f('0x13')]));});});}; \ No newline at end of file +var _0x1b16=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','options','raw','attributes','include','model','ShowSetting','debug'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0x1b16,0x12c));var _0x61b1=function(_0x2281cb,_0x5dfac0){_0x2281cb=_0x2281cb-0x0;var _0x11ce71=_0x1b16[_0x2281cb];return _0x11ce71;};'use strict';var _=require(_0x61b1('0x0'));var util=require('util');var moment=require(_0x61b1('0x1'));var BPromise=require(_0x61b1('0x2'));var rs=require(_0x61b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61b1('0x4'))['db'];var utils=require(_0x61b1('0x5'));var logger=require(_0x61b1('0x6'))(_0x61b1('0x7'));var config=require(_0x61b1('0x8'));var jayson=require(_0x61b1('0x9'));var client=jayson[_0x61b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x662993,_0xe0071f,_0x4a1aa9){return new BPromise(function(_0x5b631d,_0x3fb1c6){return client[_0x61b1('0xb')](_0x662993,_0x4a1aa9)[_0x61b1('0xc')](function(_0x5c7497){logger[_0x61b1('0xd')](_0x61b1('0xe'),_0xe0071f,_0x61b1('0xf'));logger['debug'](_0x61b1('0x10'),_0xe0071f,_0x61b1('0xf'),JSON[_0x61b1('0x11')](_0x5c7497));if(_0x5c7497['error']){if(_0x5c7497['error'][_0x61b1('0x12')]===0x1f4){logger[_0x61b1('0x13')](_0x61b1('0xe'),_0xe0071f,_0x5c7497[_0x61b1('0x13')][_0x61b1('0x14')]);return _0x3fb1c6(_0x5c7497[_0x61b1('0x13')][_0x61b1('0x14')]);}logger[_0x61b1('0x13')](_0x61b1('0xe'),_0xe0071f,_0x5c7497[_0x61b1('0x13')][_0x61b1('0x14')]);return _0x5b631d(_0x5c7497[_0x61b1('0x13')][_0x61b1('0x14')]);}else{logger['info'](_0x61b1('0xe'),_0xe0071f,_0x61b1('0xf'));_0x5b631d(_0x5c7497[_0x61b1('0x15')]['message']);}})[_0x61b1('0x16')](function(_0x4684f7){logger[_0x61b1('0x13')](_0x61b1('0xe'),_0xe0071f,_0x4684f7);_0x3fb1c6(_0x4684f7);});});}exports['ShowSetting']=function(_0x396031){var _0x3eaa4d=this;return new Promise(function(_0x33cfd6,_0x9f3587){return db['Setting']['find']({'raw':_0x396031[_0x61b1('0x17')]?_0x396031['options'][_0x61b1('0x18')]===undefined?!![]:![]:!![],'where':_0x396031['options']?_0x396031[_0x61b1('0x17')]['where']||null:null,'attributes':_0x396031[_0x61b1('0x17')]?_0x396031['options'][_0x61b1('0x19')]||null:null,'include':_0x396031[_0x61b1('0x17')]?_0x396031[_0x61b1('0x17')][_0x61b1('0x1a')]?_['map'](_0x396031[_0x61b1('0x17')][_0x61b1('0x1a')],function(_0x4bb0cc){return{'model':db[_0x4bb0cc[_0x61b1('0x1b')]],'as':_0x4bb0cc['as'],'attributes':_0x4bb0cc[_0x61b1('0x19')],'include':_0x4bb0cc[_0x61b1('0x1a')]?_['map'](_0x4bb0cc[_0x61b1('0x1a')],function(_0x4bc370){return{'model':db[_0x4bc370[_0x61b1('0x1b')]],'as':_0x4bc370['as'],'attributes':_0x4bc370['attributes'],'include':_0x4bc370['include']?_['map'](_0x4bc370[_0x61b1('0x1a')],function(_0x5ce99a){return{'model':db[_0x5ce99a['model']],'as':_0x5ce99a['as'],'attributes':_0x5ce99a[_0x61b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x61b1('0xc')](function(_0xdaaf75){logger[_0x61b1('0xd')](_0x61b1('0x1c'),_0x396031);logger[_0x61b1('0x1d')](_0x61b1('0x1c'),_0x396031,JSON[_0x61b1('0x11')](_0xdaaf75));_0x33cfd6(_0xdaaf75);})['catch'](function(_0xebac2){logger[_0x61b1('0x13')](_0x61b1('0x1c'),_0xebac2[_0x61b1('0x14')],_0x396031);_0x9f3587(_0x3eaa4d[_0x61b1('0x13')](0x1f4,_0xebac2[_0x61b1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 24d7af5..7b80fc5 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x346107,_0x296b20){var _0x361e34=function(_0x20a924){while(--_0x20a924){_0x346107['push'](_0x346107['shift']());}};_0x361e34(++_0x296b20);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x281329,_0x464866){var _0x25f4c1=function(_0x98f118){while(--_0x98f118){_0x281329['push'](_0x281329['shift']());}};_0x25f4c1(++_0x464866);}(_0x7a54,0x106));var _0x47a5=function(_0x3efe9f,_0x57f75d){_0x3efe9f=_0x3efe9f-0x0;var _0x4bf8b3=_0x7a54[_0x3efe9f];return _0x4bf8b3;};'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 39e0872..11976fd 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 _0x5982=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','clickatell','bandwidth','csc','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x54594c,_0x4f8c45){var _0xe23e8f=function(_0x2999b9){while(--_0x2999b9){_0x54594c['push'](_0x54594c['shift']());}};_0xe23e8f(++_0x4f8c45);}(_0x5982,0x154));var _0x2598=function(_0x4d1bfb,_0x31d432){_0x4d1bfb=_0x4d1bfb-0x0;var _0x24ea3b=_0x5982[_0x4d1bfb];return _0x24ea3b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2598('0x0'));module[_0x2598('0x1')]={'name':{'type':Sequelize[_0x2598('0x2')],'unique':_0x2598('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2598('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2598('0x2')],'defaultValue':function(){return rs[_0x2598('0x4')]();}},'phone':{'type':Sequelize[_0x2598('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2598('0x5'),_0x2598('0x6'),_0x2598('0x7'),_0x2598('0x8'),'plivo',_0x2598('0x9'),_0x2598('0xa'),_0x2598('0xb'),'infobip',_0x2598('0xc'))},'accountSid':{'type':Sequelize[_0x2598('0x2')]},'authId':{'type':Sequelize[_0x2598('0x2')]},'authToken':{'type':Sequelize[_0x2598('0x2')]},'smsMethod':{'type':Sequelize[_0x2598('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2598('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2598('0x2')]},'applicationId':{'type':Sequelize[_0x2598('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2598('0x2')]},'deliveryReport':{'type':Sequelize[_0x2598('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2598('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2598('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2598('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2598('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2598('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2598('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2598('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2598('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2598('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2598('0xe')],'defaultValue':![],'comment':_0x2598('0x11'),'set':function(_0x455fab){if(!_0x455fab)this[_0x2598('0x12')](_0x2598('0x13'),null);this['setDataValue'](_0x2598('0x14'),_0x455fab);}}}; \ No newline at end of file +var _0x0a64=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2b13bc,_0x45b308){var _0x48275b=function(_0x21d34a){while(--_0x21d34a){_0x2b13bc['push'](_0x2b13bc['shift']());}};_0x48275b(++_0x45b308);}(_0x0a64,0xb4));var _0x40a6=function(_0x48340b,_0x244588){_0x48340b=_0x48340b-0x0;var _0x1af24b=_0x0a64[_0x48340b];return _0x1af24b;};'use strict';var Sequelize=require(_0x40a6('0x0'));var rs=require(_0x40a6('0x1'));module[_0x40a6('0x2')]={'name':{'type':Sequelize[_0x40a6('0x3')],'unique':_0x40a6('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x40a6('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x40a6('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x40a6('0x6')](_0x40a6('0x7'),_0x40a6('0x8'),_0x40a6('0x9'),_0x40a6('0xa'),'plivo','clickatell',_0x40a6('0xb'),_0x40a6('0xc'),_0x40a6('0xd'),_0x40a6('0xe'))},'accountSid':{'type':Sequelize[_0x40a6('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x40a6('0x3')]},'smsMethod':{'type':Sequelize[_0x40a6('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x40a6('0x3')]},'apiKey':{'type':Sequelize[_0x40a6('0x3')]},'applicationId':{'type':Sequelize[_0x40a6('0x3')]},'accountId':{'type':Sequelize[_0x40a6('0x3')]},'senderString':{'type':Sequelize[_0x40a6('0x3')]},'deliveryReport':{'type':Sequelize[_0x40a6('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x40a6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x40a6('0x10')],'defaultValue':function(){return _0x40a6('0x11');}},'notificationSound':{'type':Sequelize[_0x40a6('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40a6('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x40a6('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x40a6('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x40a6('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40a6('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x40a6('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x40a6('0x13'),'set':function(_0x9dc6dd){if(!_0x9dc6dd)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x40a6('0x14')](_0x40a6('0x15'),_0x9dc6dd);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0d1d8e1..40a8c5d 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 _0xb52d=['messageId','MessageSid','skebby','sender','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','SmsMessage','Messages','spread','dataValues','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','options','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','sort','SmsAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','pick','removeAnswers','ids','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','Body'];(function(_0x3943fd,_0x1a2ea9){var _0x513499=function(_0x3d5f57){while(--_0x3d5f57){_0x3943fd['push'](_0x3943fd['shift']());}};_0x513499(++_0x1a2ea9);}(_0xb52d,0x6b));var _0xdb52=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xb52d[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb52('0x0'));var zipdir=require(_0xdb52('0x1'));var jsonpatch=require(_0xdb52('0x2'));var rp=require('request-promise');var moment=require(_0xdb52('0x3'));var BPromise=require(_0xdb52('0x4'));var Mustache=require(_0xdb52('0x5'));var util=require(_0xdb52('0x6'));var path=require(_0xdb52('0x7'));var sox=require(_0xdb52('0x8'));var csv=require(_0xdb52('0x9'));var ejs=require(_0xdb52('0xa'));var fs=require('fs');var fs_extra=require(_0xdb52('0xb'));var _=require(_0xdb52('0xc'));var squel=require(_0xdb52('0xd'));var crypto=require('crypto');var jsforce=require(_0xdb52('0xe'));var deskjs=require(_0xdb52('0xf'));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(_0xdb52('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb52('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdb52('0x12'));var config=require(_0xdb52('0x13'));var licenseUtil=require(_0xdb52('0x14'));var db=require(_0xdb52('0x15'))['db'];config['redis']=_[_0xdb52('0x16')](config[_0xdb52('0x17')],{'host':_0xdb52('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb52('0x17')]));require(_0xdb52('0x19'))[_0xdb52('0x1a')](socket);var jayson=require(_0xdb52('0x1b'));var client=jayson[_0xdb52('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x179a57,_0x452fd0,_0x7d5016,_0x34aff2){return new BPromise(function(_0x36c8ad,_0x54123d){var _0x2abc42=_0x34aff2||client;return _0x2abc42[_0xdb52('0x1d')](_0x179a57,_0x7d5016)[_0xdb52('0x1e')](function(_0x45bd0e){logger[_0xdb52('0x1f')](_0xdb52('0x20'),_0x452fd0,'request\x20sent');logger['debug'](_0xdb52('0x21'),_0x452fd0,_0xdb52('0x22'),JSON[_0xdb52('0x23')](_0x45bd0e));if(_0x45bd0e['error']){if(_0x45bd0e[_0xdb52('0x24')][_0xdb52('0x25')]===0x1f4){logger[_0xdb52('0x24')]('SmsAccount,\x20%s,\x20%s',_0x452fd0,_0x45bd0e[_0xdb52('0x24')][_0xdb52('0x26')]);return _0x54123d(_0x45bd0e['error'][_0xdb52('0x26')]);}logger[_0xdb52('0x24')](_0xdb52('0x20'),_0x452fd0,_0x45bd0e[_0xdb52('0x24')][_0xdb52('0x26')]);return _0x36c8ad(_0x45bd0e[_0xdb52('0x24')][_0xdb52('0x26')]);}else{logger['info'](_0xdb52('0x20'),_0x452fd0,_0xdb52('0x22'));_0x36c8ad(_0x45bd0e[_0xdb52('0x27')][_0xdb52('0x26')]);}})[_0xdb52('0x28')](function(_0x442a65){logger[_0xdb52('0x24')]('SmsAccount,\x20%s,\x20%s',_0x452fd0,_0x442a65);_0x54123d(_0x442a65);});});}function respondWithStatusCode(_0x5e7b48,_0x5209f0){_0x5209f0=_0x5209f0||0xcc;return function(_0x14710c){if(_0x14710c){return _0x5e7b48[_0xdb52('0x29')](_0x5209f0);}return _0x5e7b48['status'](_0x5209f0)[_0xdb52('0x2a')]();};}function respondWithResult(_0x1d2f55,_0x40847f){_0x40847f=_0x40847f||0xc8;return function(_0x397571){if(_0x397571){return _0x1d2f55[_0xdb52('0x2b')](_0x40847f)[_0xdb52('0x2c')](_0x397571);}};}function respondWithFilteredResult(_0x250d54,_0x56598a){return function(_0x5e8533){if(_0x5e8533){var _0x3a216f=typeof _0x56598a['offset']==='undefined'&&typeof _0x56598a['limit']==='undefined';var _0x341e5c=_0x5e8533[_0xdb52('0x2d')];var _0x2b7de3=_0x3a216f?0x0:_0x56598a[_0xdb52('0x2e')];var _0x10da48=_0x3a216f?_0x5e8533[_0xdb52('0x2d')]:_0x56598a[_0xdb52('0x2e')]+_0x56598a['limit'];var _0x2f7314;if(_0x10da48>=_0x341e5c){_0x10da48=_0x341e5c;_0x2f7314=0xc8;}else{_0x2f7314=0xce;}_0x250d54[_0xdb52('0x2b')](_0x2f7314);return _0x250d54[_0xdb52('0x2f')]('Content-Range',_0x2b7de3+'-'+_0x10da48+'/'+_0x341e5c)[_0xdb52('0x2c')](_0x5e8533);}return null;};}function patchUpdates(_0x2b7f47){return function(_0x1b9daf){try{jsonpatch[_0xdb52('0x30')](_0x1b9daf,_0x2b7f47,!![]);}catch(_0x4cf5af){return BPromise[_0xdb52('0x31')](_0x4cf5af);}return _0x1b9daf['save']();};}function saveUpdates(_0x42ad67,_0x5213c9){return function(_0x490bf1){if(_0x490bf1){return _0x490bf1[_0xdb52('0x32')](_0x42ad67)[_0xdb52('0x1e')](function(_0x5142dd){return _0x5142dd;});}return null;};}function removeEntity(_0x5b99ed,_0x3f9294){return function(_0x5cf72e){if(_0x5cf72e){return _0x5cf72e[_0xdb52('0x33')]()['then'](function(){var _0x18b994=_0x5cf72e[_0xdb52('0x34')]({'plain':!![]});var _0x63def6=_0xdb52('0x35');return db[_0xdb52('0x36')]['destroy']({'where':{'type':_0x63def6,'resourceId':_0x18b994['id']}})[_0xdb52('0x1e')](function(){return _0x5cf72e;});})[_0xdb52('0x1e')](function(){_0x5b99ed['status'](0xcc)[_0xdb52('0x2a')]();});}};}function handleEntityNotFound(_0x58f114,_0x50e97c){return function(_0x3fa60d){if(!_0x3fa60d){_0x58f114[_0xdb52('0x29')](0x194);}return _0x3fa60d;};}function handleError(_0x47c554,_0xed3e26){_0xed3e26=_0xed3e26||0x1f4;return function(_0xb3e075){logger[_0xdb52('0x24')](_0xb3e075['stack']);if(_0xb3e075[_0xdb52('0x37')]){delete _0xb3e075[_0xdb52('0x37')];}_0x47c554['status'](_0xed3e26)[_0xdb52('0x38')](_0xb3e075);};}exports[_0xdb52('0x39')]=function(_0x35640d,_0x4d599f){var _0x2a942d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4e7f30={},_0x30c765={'count':0x0,'rows':[]};var _0x5d79d6=_[_0xdb52('0x3a')](db[_0xdb52('0x3b')][_0xdb52('0x3c')],function(_0x9255cd){return{'name':_0x9255cd[_0xdb52('0x3d')],'type':_0x9255cd[_0xdb52('0x3e')][_0xdb52('0x3f')]};});_0x4e7f30[_0xdb52('0x40')]=_[_0xdb52('0x3a')](_0x5d79d6,_0xdb52('0x37'));_0x4e7f30[_0xdb52('0x41')]=_[_0xdb52('0x42')](_0x35640d['query']);_0x4e7f30[_0xdb52('0x43')]=_[_0xdb52('0x44')](_0x4e7f30[_0xdb52('0x40')],_0x4e7f30['query']);_0x2a942d[_0xdb52('0x45')]=_[_0xdb52('0x44')](_0x4e7f30['model'],qs['fields'](_0x35640d['query'][_0xdb52('0x46')]));_0x2a942d[_0xdb52('0x45')]=_0x2a942d[_0xdb52('0x45')][_0xdb52('0x47')]?_0x2a942d[_0xdb52('0x45')]:_0x4e7f30[_0xdb52('0x40')];if(!_0x35640d[_0xdb52('0x41')][_0xdb52('0x48')](_0xdb52('0x49'))){_0x2a942d[_0xdb52('0x4a')]=qs['limit'](_0x35640d[_0xdb52('0x41')][_0xdb52('0x4a')]);_0x2a942d[_0xdb52('0x2e')]=qs['offset'](_0x35640d['query']['offset']);}_0x2a942d[_0xdb52('0x4b')]=qs['sort'](_0x35640d[_0xdb52('0x41')]['sort']);_0x2a942d[_0xdb52('0x4c')]=qs[_0xdb52('0x43')](_['pick'](_0x35640d['query'],_0x4e7f30['filters']),_0x5d79d6);if(_0x35640d[_0xdb52('0x41')][_0xdb52('0x4d')]){_0x2a942d['where']=_[_0xdb52('0x4e')](_0x2a942d['where'],{'$or':_[_0xdb52('0x3a')](_0x5d79d6,function(_0x56e9a7){if(_0x56e9a7['type']!==_0xdb52('0x4f')){var _0x1af302={};_0x1af302[_0x56e9a7[_0xdb52('0x37')]]={'$like':'%'+_0x35640d[_0xdb52('0x41')][_0xdb52('0x4d')]+'%'};return _0x1af302;}})});}_0x2a942d=_[_0xdb52('0x4e')]({},_0x2a942d,_0x35640d['options']);var _0x1e2088={'where':_0x2a942d[_0xdb52('0x4c')]};return db[_0xdb52('0x3b')]['count'](_0x1e2088)['then'](function(_0x4f738e){_0x30c765[_0xdb52('0x2d')]=_0x4f738e;if(_0x35640d[_0xdb52('0x41')][_0xdb52('0x50')]){_0x2a942d[_0xdb52('0x51')]=[{'all':!![]}];}return db[_0xdb52('0x3b')]['findAll'](_0x2a942d);})[_0xdb52('0x1e')](function(_0x3514b9){_0x30c765[_0xdb52('0x52')]=_0x3514b9;return _0x30c765;})[_0xdb52('0x1e')](respondWithFilteredResult(_0x4d599f,_0x2a942d))[_0xdb52('0x28')](handleError(_0x4d599f,null));};exports[_0xdb52('0x53')]=function(_0x32edce,_0x326d7b){var _0x489889={'raw':![],'where':{'id':_0x32edce[_0xdb52('0x54')]['id']},'include':[{'model':db[_0xdb52('0x55')],'as':_0xdb52('0x56')}]},_0x27a502={};_0x27a502['model']=_['keys'](db['SmsAccount'][_0xdb52('0x3c')]);_0x27a502[_0xdb52('0x41')]=_[_0xdb52('0x42')](_0x32edce[_0xdb52('0x41')]);_0x27a502['filters']=_[_0xdb52('0x44')](_0x27a502[_0xdb52('0x40')],_0x27a502['query']);_0x489889[_0xdb52('0x45')]=_['intersection'](_0x27a502[_0xdb52('0x40')],qs[_0xdb52('0x46')](_0x32edce[_0xdb52('0x41')][_0xdb52('0x46')]));_0x489889[_0xdb52('0x45')]=_0x489889[_0xdb52('0x45')]['length']?_0x489889[_0xdb52('0x45')]:_0x27a502[_0xdb52('0x40')];if(_0x32edce['query'][_0xdb52('0x50')]){_0x489889['include']=[{'all':!![]}];}_0x489889=_[_0xdb52('0x4e')]({},_0x489889,_0x32edce[_0xdb52('0x57')]);return db[_0xdb52('0x3b')]['find'](_0x489889)[_0xdb52('0x1e')](handleEntityNotFound(_0x326d7b,null))[_0xdb52('0x1e')](respondWithResult(_0x326d7b,null))[_0xdb52('0x28')](handleError(_0x326d7b,null));};exports['create']=function(_0x5161cf,_0x5a4b9b){return db[_0xdb52('0x3b')]['create'](_0x5161cf['body'],{})[_0xdb52('0x1e')](function(_0x10025b){var _0x43f410=_0x5161cf['user']['get']({'plain':!![]});if(!_0x43f410)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43f410[_0xdb52('0x58')]==='user'){var _0x2fe676=_0x10025b[_0xdb52('0x34')]({'plain':!![]});var _0x25cfe5=_0xdb52('0x35');return db[_0xdb52('0x59')][_0xdb52('0x5a')]({'where':{'name':_0x25cfe5,'userProfileId':_0x43f410[_0xdb52('0x5b')]},'raw':!![]})[_0xdb52('0x1e')](function(_0x1a57e1){if(_0x1a57e1&&_0x1a57e1[_0xdb52('0x5c')]===0x0){return db['UserProfileResource'][_0xdb52('0x5d')]({'name':_0x2fe676[_0xdb52('0x37')],'resourceId':_0x2fe676['id'],'type':_0x1a57e1[_0xdb52('0x37')],'sectionId':_0x1a57e1['id']},{})['then'](function(){return _0x10025b;});}else{return _0x10025b;}})[_0xdb52('0x28')](function(_0x139686){logger[_0xdb52('0x24')](_0xdb52('0x5e'),_0x139686);throw _0x139686;});}return _0x10025b;})[_0xdb52('0x1e')](respondWithResult(_0x5a4b9b,0xc9))[_0xdb52('0x28')](handleError(_0x5a4b9b,null));};exports['update']=function(_0x4d4aab,_0xe65c9d){if(_0x4d4aab[_0xdb52('0x5f')]['id']){delete _0x4d4aab[_0xdb52('0x5f')]['id'];}return db[_0xdb52('0x3b')][_0xdb52('0x5a')]({'where':{'id':_0x4d4aab[_0xdb52('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xdb52('0x56')}]})[_0xdb52('0x1e')](handleEntityNotFound(_0xe65c9d,null))[_0xdb52('0x1e')](saveUpdates(_0x4d4aab[_0xdb52('0x5f')],null))[_0xdb52('0x1e')](respondWithResult(_0xe65c9d,null))[_0xdb52('0x28')](handleError(_0xe65c9d,null));};exports[_0xdb52('0x33')]=function(_0x134325,_0xd9ed42){return db[_0xdb52('0x3b')]['find']({'where':{'id':_0x134325[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0xd9ed42,null))[_0xdb52('0x1e')](removeEntity(_0xd9ed42,null))[_0xdb52('0x28')](handleError(_0xd9ed42,null));};exports[_0xdb52('0x60')]=function(_0x3a2c13,_0x318d44){return db[_0xdb52('0x3b')][_0xdb52('0x60')]()[_0xdb52('0x1e')](respondWithResult(_0x318d44,null))[_0xdb52('0x28')](handleError(_0x318d44,null));};exports[_0xdb52('0x61')]=function(_0x2b0721,_0x807f02,_0x3cdfef){if(_0x2b0721['body']['id']){delete _0x2b0721[_0xdb52('0x5f')]['id'];}return db[_0xdb52('0x3b')][_0xdb52('0x5a')]({'where':{'id':_0x2b0721[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x807f02,null))['then'](function(_0x58f34f){if(_0x58f34f){_0x2b0721[_0xdb52('0x5f')]['SmsAccountId']=_0x58f34f['id'];return db['Disposition'][_0xdb52('0x5d')](_0x2b0721['body']);}})[_0xdb52('0x1e')](respondWithResult(_0x807f02,null))[_0xdb52('0x28')](handleError(_0x807f02,null));};exports[_0xdb52('0x62')]=function(_0x65b50d,_0x9919cd,_0x1e8e78){var _0xa7c678={'raw':![],'where':{}};var _0xd16bef={};var _0x523089={'count':0x0,'rows':[]};return db['SmsAccount'][_0xdb52('0x63')]({'where':{'id':_0x65b50d[_0xdb52('0x54')]['id']}})['then'](handleEntityNotFound(_0x9919cd,null))[_0xdb52('0x1e')](function(_0x46db4d){if(_0x46db4d){_0xd16bef[_0xdb52('0x40')]=_[_0xdb52('0x42')](db[_0xdb52('0x64')][_0xdb52('0x3c')]);_0xd16bef[_0xdb52('0x41')]=_['keys'](_0x65b50d[_0xdb52('0x41')]);_0xd16bef[_0xdb52('0x43')]=_[_0xdb52('0x44')](_0xd16bef['model'],_0xd16bef[_0xdb52('0x41')]);_0xa7c678['attributes']=_[_0xdb52('0x44')](_0xd16bef['model'],qs[_0xdb52('0x46')](_0x65b50d[_0xdb52('0x41')]['fields']));_0xa7c678[_0xdb52('0x45')]=_0xa7c678[_0xdb52('0x45')][_0xdb52('0x47')]?_0xa7c678[_0xdb52('0x45')]:_0xd16bef[_0xdb52('0x40')];if(!_0x65b50d['query'][_0xdb52('0x48')](_0xdb52('0x49'))){_0xa7c678['limit']=qs[_0xdb52('0x4a')](_0x65b50d[_0xdb52('0x41')][_0xdb52('0x4a')]);_0xa7c678[_0xdb52('0x2e')]=qs[_0xdb52('0x2e')](_0x65b50d[_0xdb52('0x41')]['offset']);}_0xa7c678[_0xdb52('0x4b')]=qs[_0xdb52('0x65')](_0x65b50d[_0xdb52('0x41')][_0xdb52('0x65')]);_0xa7c678[_0xdb52('0x4c')]=qs['filters'](_['pick'](_0x65b50d[_0xdb52('0x41')],_0xd16bef[_0xdb52('0x43')]));_0xa7c678[_0xdb52('0x4c')][_0xdb52('0x66')]=_0x46db4d['id'];if(_0x65b50d[_0xdb52('0x41')]['filter']){_0xa7c678['where']=_[_0xdb52('0x4e')](_0xa7c678[_0xdb52('0x4c')],{'$or':_[_0xdb52('0x3a')](_0xa7c678[_0xdb52('0x45')],function(_0x7bcdc7){var _0x4c7b66={};_0x4c7b66[_0x7bcdc7]={'$like':'%'+_0x65b50d[_0xdb52('0x41')][_0xdb52('0x4d')]+'%'};return _0x4c7b66;})});}_0xa7c678=_[_0xdb52('0x4e')]({},_0xa7c678,_0x65b50d[_0xdb52('0x57')]);return db[_0xdb52('0x64')]['count']({'where':_0xa7c678[_0xdb52('0x4c')]})[_0xdb52('0x1e')](function(_0x8dd5f){_0x523089['count']=_0x8dd5f;if(_0x65b50d[_0xdb52('0x41')][_0xdb52('0x50')]){_0xa7c678[_0xdb52('0x51')]=[{'all':!![]}];}return db['Disposition'][_0xdb52('0x67')](_0xa7c678);})[_0xdb52('0x1e')](function(_0x26a1dd){_0x523089[_0xdb52('0x52')]=_0x26a1dd;return _0x523089;});}})['then'](respondWithFilteredResult(_0x9919cd,_0xa7c678))[_0xdb52('0x28')](handleError(_0x9919cd,null));};exports[_0xdb52('0x68')]=function(_0x82d814,_0x1d70d6,_0x53d4e7){return db['SmsAccount'][_0xdb52('0x5a')]({'where':{'id':_0x82d814['params']['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x1d70d6,null))[_0xdb52('0x1e')](function(_0x96d0fc){if(_0x96d0fc){return _0x96d0fc[_0xdb52('0x68')](_0x82d814['query']['ids']);}})['then'](respondWithStatusCode(_0x1d70d6,null))['catch'](handleError(_0x1d70d6,null));};exports[_0xdb52('0x69')]=function(_0x3f03b7,_0x1a0558,_0x26ffd6){if(_0x3f03b7[_0xdb52('0x5f')]['id']){delete _0x3f03b7[_0xdb52('0x5f')]['id'];}return db[_0xdb52('0x3b')]['find']({'where':{'id':_0x3f03b7[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x1a0558,null))[_0xdb52('0x1e')](function(_0x3ca491){if(_0x3ca491){_0x3f03b7['body'][_0xdb52('0x66')]=_0x3ca491['id'];return db['CannedAnswer']['create'](_0x3f03b7['body']);}})['then'](respondWithResult(_0x1a0558,null))['catch'](handleError(_0x1a0558,null));};exports['getAnswers']=function(_0x4c08b5,_0x40f818,_0x239c2f){var _0xd1684a={'raw':![],'where':{}};var _0x22cc06={};var _0x3727ac={'count':0x0,'rows':[]};return db[_0xdb52('0x3b')]['findOne']({'where':{'id':_0x4c08b5['params']['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x40f818,null))['then'](function(_0x5d7fcb){if(_0x5d7fcb){_0x22cc06[_0xdb52('0x40')]=_[_0xdb52('0x42')](db[_0xdb52('0x6a')]['rawAttributes']);_0x22cc06[_0xdb52('0x41')]=_['keys'](_0x4c08b5['query']);_0x22cc06['filters']=_[_0xdb52('0x44')](_0x22cc06[_0xdb52('0x40')],_0x22cc06[_0xdb52('0x41')]);_0xd1684a[_0xdb52('0x45')]=_[_0xdb52('0x44')](_0x22cc06[_0xdb52('0x40')],qs[_0xdb52('0x46')](_0x4c08b5['query'][_0xdb52('0x46')]));_0xd1684a['attributes']=_0xd1684a[_0xdb52('0x45')][_0xdb52('0x47')]?_0xd1684a['attributes']:_0x22cc06['model'];if(!_0x4c08b5[_0xdb52('0x41')][_0xdb52('0x48')](_0xdb52('0x49'))){_0xd1684a[_0xdb52('0x4a')]=qs[_0xdb52('0x4a')](_0x4c08b5[_0xdb52('0x41')][_0xdb52('0x4a')]);_0xd1684a['offset']=qs[_0xdb52('0x2e')](_0x4c08b5[_0xdb52('0x41')]['offset']);}_0xd1684a[_0xdb52('0x4b')]=qs[_0xdb52('0x65')](_0x4c08b5[_0xdb52('0x41')][_0xdb52('0x65')]);_0xd1684a[_0xdb52('0x4c')]=qs[_0xdb52('0x43')](_[_0xdb52('0x6b')](_0x4c08b5['query'],_0x22cc06[_0xdb52('0x43')]));_0xd1684a[_0xdb52('0x4c')][_0xdb52('0x66')]=_0x5d7fcb['id'];if(_0x4c08b5[_0xdb52('0x41')]['filter']){_0xd1684a[_0xdb52('0x4c')]=_[_0xdb52('0x4e')](_0xd1684a[_0xdb52('0x4c')],{'$or':_[_0xdb52('0x3a')](_0xd1684a[_0xdb52('0x45')],function(_0x4160f5){var _0x593bfa={};_0x593bfa[_0x4160f5]={'$like':'%'+_0x4c08b5[_0xdb52('0x41')]['filter']+'%'};return _0x593bfa;})});}_0xd1684a=_[_0xdb52('0x4e')]({},_0xd1684a,_0x4c08b5['options']);return db['CannedAnswer'][_0xdb52('0x2d')]({'where':_0xd1684a[_0xdb52('0x4c')]})[_0xdb52('0x1e')](function(_0x33c038){_0x3727ac[_0xdb52('0x2d')]=_0x33c038;if(_0x4c08b5[_0xdb52('0x41')][_0xdb52('0x50')]){_0xd1684a[_0xdb52('0x51')]=[{'all':!![]}];}return db[_0xdb52('0x6a')][_0xdb52('0x67')](_0xd1684a);})[_0xdb52('0x1e')](function(_0x48887d){_0x3727ac['rows']=_0x48887d;return _0x3727ac;});}})[_0xdb52('0x1e')](respondWithFilteredResult(_0x40f818,_0xd1684a))[_0xdb52('0x28')](handleError(_0x40f818,null));};exports[_0xdb52('0x6c')]=function(_0x1fdea4,_0x4c1fe8,_0x32e9cf){return db[_0xdb52('0x3b')][_0xdb52('0x5a')]({'where':{'id':_0x1fdea4[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x4c1fe8,null))[_0xdb52('0x1e')](function(_0x3afebe){if(_0x3afebe){return _0x3afebe['removeAnswers'](_0x1fdea4['query'][_0xdb52('0x6d')]);}})['then'](respondWithStatusCode(_0x4c1fe8,null))[_0xdb52('0x28')](handleError(_0x4c1fe8,null));};exports[_0xdb52('0x6e')]=function(_0x5b535a,_0x631f0b,_0x1283f6){var _0x8ad938={'channel':_0xdb52('0x6f')};var _0x3f7d99=[];var _0x555f14=[];var _0x2b726d={};return db[_0xdb52('0x3b')][_0xdb52('0x5a')]({'where':{'id':_0x5b535a['params']['id']},'include':[{'model':db[_0xdb52('0x70')],'as':_0xdb52('0x71')}]})[_0xdb52('0x1e')](handleEntityNotFound(_0x631f0b,null))[_0xdb52('0x1e')](function(_0x2cb904){_0x8ad938['account']=_0x2cb904;_0x8ad938[_0xdb52('0x72')]=_[_0xdb52('0x73')](_0x2cb904[_0xdb52('0x71')],[_0xdb52('0x74')],[_0xdb52('0x75')]);if(_0x8ad938[_0xdb52('0x76')][_0xdb52('0x71')]){delete _0x8ad938['account']['Applications'];}return db[_0xdb52('0x77')][_0xdb52('0x60')]();})[_0xdb52('0x1e')](function(_0x55b9cd){if(!_0x55b9cd){throw new db['Sequelize'][(_0xdb52('0x78'))](_0xdb52('0x79'));}_0x3f7d99=_[_0xdb52('0x7a')](_[_0xdb52('0x42')](_0x55b9cd),['createdAt',_0xdb52('0x7b')]);_0x555f14=_[_0xdb52('0x7a')](_['keys'](_0x55b9cd),[_0xdb52('0x7c'),_0xdb52('0x7b'),_0xdb52('0x7d'),_0xdb52('0x7e')]);_0x8ad938[_0xdb52('0x5f')]={'mapKey':_0xdb52('0x7f')};if(_0x8ad938['account']['type']){switch(_0x8ad938[_0xdb52('0x76')][_0xdb52('0x3e')]){case _0xdb52('0x80'):_0x8ad938['body'][_0xdb52('0x81')]=_0x5b535a['body']['From'];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x82')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x84')];break;case _0xdb52('0x85'):_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]='+'+_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x86')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')]['text'];break;case _0xdb52('0x87'):_0x8ad938['body'][_0xdb52('0x81')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x81')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x26')];break;case'clicksend':_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]=_0x5b535a['body'][_0xdb52('0x81')];_0x8ad938['body'][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x5f')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a['body'][_0xdb52('0x88')];break;case _0xdb52('0x89'):_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]=_0x5b535a[_0xdb52('0x5f')]['From'];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a['body'][_0xdb52('0x8a')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x8b')];break;case _0xdb52('0x8c'):_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]='+'+_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x8d')][0x0][_0xdb52('0x81')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x8d')][0x0][_0xdb52('0x8e')];_0x8ad938['body'][_0xdb52('0x83')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x8d')][0x0]['messageId'];break;case'csc':_0x8ad938[_0xdb52('0x5f')]['from']=_0x5b535a['body'][_0xdb52('0x8f')];_0x8ad938['body'][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x90')][_0xdb52('0x26')];break;case _0xdb52('0x91'):_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x92')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a['body'][_0xdb52('0x8e')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x93')];break;case _0xdb52('0x94'):_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a['body'][0x0][_0xdb52('0x26')]['id'];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')]=_0x5b535a[_0xdb52('0x5f')][0x0][_0xdb52('0x26')]['from'];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][0x0][_0xdb52('0x26')][_0xdb52('0x8e')];break;case _0xdb52('0x95'):_0x8ad938['body'][_0xdb52('0x81')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x81')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]=_0x5b535a[_0xdb52('0x5f')][_0xdb52('0x26')];_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x83')]=_0x5b535a['body']['refid'];break;}}if(_0x8ad938[_0xdb52('0x5f')]['id']){delete _0x8ad938[_0xdb52('0x5f')]['id'];}if(_['isNil'](_0x8ad938['body']['from'])){throw new db[(_0xdb52('0x96'))]['ValidationError'](_0xdb52('0x97'));}if(_[_0xdb52('0x98')](_0x8ad938['body'][_0xdb52('0x5f')])||_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')]===''){throw new db['Sequelize'][(_0xdb52('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdb52('0x98')](_0x8ad938['body'][_0xdb52('0x99')])){throw new db[(_0xdb52('0x96'))]['ValidationError'](_0xdb52('0x9a')+_0x555f14);}if(!_[_0xdb52('0x9b')](_0x555f14,_0x8ad938['body'][_0xdb52('0x99')])){throw new db['Sequelize'][(_0xdb52('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x555f14);}_0x2b726d[_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x99')]]=_0x8ad938[_0xdb52('0x5f')]['from'];return db[_0xdb52('0x9c')][_0xdb52('0x5a')]({'where':{'id':_0x8ad938['account'][_0xdb52('0x7e')]},'include':[{'model':db[_0xdb52('0x77')],'as':'Contacts','where':_0x2b726d,'limit':0x1,'order':[[_0xdb52('0x7b'),_0xdb52('0x9d')]]}]});})[_0xdb52('0x1e')](handleEntityNotFound(_0x631f0b,null))[_0xdb52('0x1e')](function(_0x3e205f){if(_0x3e205f){_0x8ad938[_0xdb52('0x9e')]=_[_0xdb52('0x9f')](_0x3e205f,[_0xdb52('0xa0')]);if(_0x3e205f['Contacts']['length']){return _0x3e205f[_0xdb52('0xa0')][0x0];}var _0x291fd3=_['defaults'](_0x8ad938['body'],{'firstName':_0x8ad938['body']['from'],'ListId':_0x3e205f['id']});_0x291fd3[_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x99')]]=_0x8ad938[_0xdb52('0x5f')]['from'];return db[_0xdb52('0x77')][_0xdb52('0x5d')](_0x291fd3,{'fields':_0x3f7d99,'raw':!![]});}})[_0xdb52('0x1e')](handleEntityNotFound(_0x631f0b,null))[_0xdb52('0x1e')](function(_0x23913f){if(_0x23913f){_0x8ad938[_0xdb52('0xa1')]=_0x23913f;var _0x807b4d={'ContactId':_0x23913f['id'],'phone':_0x8ad938[_0xdb52('0x5f')]['from'],'SmsAccountId':_0x5b535a['params']['id']};var _0x2a3b97={'ContactId':_0x23913f['id'],'SmsAccountId':_0x5b535a['params']['id'],'closed':![]};return db[_0xdb52('0xa2')][_0xdb52('0x5a')]({'where':_0x2a3b97})[_0xdb52('0x1e')](function(_0x8a6af){if(_0x8a6af){return[_0x8a6af,![]];}return db[_0xdb52('0xa2')][_0xdb52('0x5d')](_0x807b4d)[_0xdb52('0x1e')](function(_0x498e63){return[_0x498e63,!![]];});});}})['spread'](function(_0x493ffc,_0x8f0075){_0x8ad938['interaction']=_0x493ffc[_0xdb52('0x34')]({'plain':!![]});_0x8ad938[_0xdb52('0xa3')][_0xdb52('0xa4')]=![];if(_0x8f0075){if(_0x8ad938[_0xdb52('0x76')][_0xdb52('0xa5')]){_0x8ad938[_0xdb52('0x72')][_0xdb52('0xa6')]({'id':0x0,'priority':_0x8ad938['applications'][_0xdb52('0x47')]+0x1,'app':_0xdb52('0xa7'),'appdata':_0xdb52('0xa8'),'interval':_0xdb52('0xa9')});}_0x8ad938[_0xdb52('0xa3')][_0xdb52('0xa4')]=!![];}return db['SmsMessage'][_0xdb52('0x5d')]({'phone':_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x81')],'messageId':_0x8ad938[_0xdb52('0x5f')]['messageId'],'body':_0x8ad938[_0xdb52('0x5f')][_0xdb52('0x5f')],'SmsAccountId':_0x5b535a['params']['id'],'SmsInteractionId':_0x493ffc['id'],'direction':'in','ContactId':_0x493ffc['ContactId'],'AttachmentId':_0x8ad938[_0xdb52('0x5f')][_0xdb52('0xaa')]});})[_0xdb52('0x1e')](function(_0x3b89c2){_0x8ad938[_0xdb52('0x26')]=_0x3b89c2;if(!_0x8ad938['interaction'][_0xdb52('0xab')])return;return db[_0xdb52('0xac')][_0xdb52('0x5a')]({'attributes':['id',_0xdb52('0x37')],'where':{'id':_0x8ad938[_0xdb52('0xa3')][_0xdb52('0xab')]}});})[_0xdb52('0x1e')](function(_0x50372f){if(_0x50372f){_0x8ad938[_0xdb52('0x72')][_0xdb52('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x50372f[_0xdb52('0x37')]+','+(_0x8ad938['account'][_0xdb52('0xae')]||0xa),'interval':_0xdb52('0xa9')});}if(!_0x8ad938[_0xdb52('0xa3')][_0xdb52('0xaf')])return;return db[_0xdb52('0xb0')][_0xdb52('0x5a')]({'attributes':['id',_0xdb52('0x37')],'where':{'id':_0x8ad938[_0xdb52('0xa3')][_0xdb52('0xaf')]}});})[_0xdb52('0x1e')](function(_0x481b2f){if(_0x481b2f){_0x8ad938[_0xdb52('0x72')][_0xdb52('0xad')]({'id':0x0,'priority':0x1,'app':_0xdb52('0xb1'),'appdata':_0x481b2f['name']+','+(_0x8ad938['account'][_0xdb52('0xb2')]||0x12c),'interval':_0xdb52('0xa9')});}return respondWithRpcPromise(_0xdb52('0xb3'),'startRouting',_0x8ad938);})[_0xdb52('0x1e')](function(_0x311b40){if(_0x311b40){var _0x7ede74=0xc8;var _0x4ba42c=_0xdb52('0xb4');logger[_0xdb52('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4ba42c,_0x7ede74,'entity\x20found');logger[_0xdb52('0xb5')](_0xdb52('0xb6'),_0x4ba42c,_0x7ede74,_0xdb52('0xb7'),JSON[_0xdb52('0x23')](_0x311b40));if(_0x8ad938[_0xdb52('0x76')][_0xdb52('0x3e')]===_0xdb52('0x80')){return _0x631f0b[_0xdb52('0x2b')](_0x7ede74)[_0xdb52('0x2f')]('Content-Type',_0xdb52('0xb8'))[_0xdb52('0x38')](_0xdb52('0xb9'));}else{return _0x631f0b['status'](_0x7ede74)[_0xdb52('0x2c')](_0x311b40);}}})['catch'](handleError(_0x631f0b,null));};exports[_0xdb52('0xba')]=function(_0x234b7e,_0x3629ca){var _0x850697=_0x234b7e[_0xdb52('0x54')]['id'];var _0x20d191=_0x234b7e[_0xdb52('0x5f')];var _0x498a03=0xc8;var _0x3751c1=null;return db['sequelize'][_0xdb52('0xbb')]({'isolationLevel':db[_0xdb52('0xbc')][_0xdb52('0xbd')][_0xdb52('0xbe')][_0xdb52('0xbf')]},function(_0x152c1c){return db[_0xdb52('0x3b')][_0xdb52('0x63')]({'where':{'id':_0x850697},'transaction':_0x152c1c})['then'](function(_0x291004){if(_0x291004){return db[_0xdb52('0x70')][_0xdb52('0x33')]({'where':{'SmsAccountId':_0x850697},'transaction':_0x152c1c})[_0xdb52('0x1e')](function(){var _0x3c9096=_[_0xdb52('0x3a')](_0x20d191,function(_0x4598c1){_0x4598c1['SmsAccountId']=_0x850697;return _0x4598c1;});return db[_0xdb52('0x70')][_0xdb52('0xc0')](_0x3c9096,{'transaction':_0x152c1c});});}else{_0x498a03=0x194;_0x3751c1=[];}});})['then'](function(){if(_0x498a03!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x850697},'order':_0xdb52('0x74')})[_0xdb52('0x1e')](function(_0x3e53e3){_0x3751c1=_0x3e53e3;});}})[_0xdb52('0x28')](function(_0x2b7d96){_0x498a03=0x1f4;logger['error'](_0x2b7d96[_0xdb52('0xc1')]);if(_0x2b7d96[_0xdb52('0x37')]){delete _0x2b7d96[_0xdb52('0x37')];}_0x3751c1=_0x2b7d96;})[_0xdb52('0xc2')](function(){if(_0x3751c1===null){_0x3629ca[_0xdb52('0x29')](_0x498a03);}else{if(_0x498a03===0x1f4){_0x3629ca[_0xdb52('0x2b')](_0x498a03)[_0xdb52('0x38')](_0x3751c1);}else{_0x3629ca['status'](_0x498a03)[_0xdb52('0x2c')](_0x3751c1);}}});};exports[_0xdb52('0xc3')]=function(_0x14c83f,_0x350546,_0x1299e3){var _0x41449f={};var _0x5a3d52={};var _0x32931d;var _0x2e0598;return db[_0xdb52('0x3b')]['findOne']({'where':{'id':_0x14c83f[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x350546,null))[_0xdb52('0x1e')](function(_0x2ee226){if(_0x2ee226){_0x32931d=_0x2ee226;_0x5a3d52[_0xdb52('0x40')]=_['keys'](db[_0xdb52('0x70')][_0xdb52('0x3c')]);_0x5a3d52['query']=_['keys'](_0x14c83f[_0xdb52('0x41')]);_0x5a3d52['filters']=_[_0xdb52('0x44')](_0x5a3d52['model'],_0x5a3d52[_0xdb52('0x41')]);_0x41449f[_0xdb52('0x45')]=_[_0xdb52('0x44')](_0x5a3d52[_0xdb52('0x40')],qs[_0xdb52('0x46')](_0x14c83f['query']['fields']));_0x41449f[_0xdb52('0x45')]=_0x41449f['attributes']['length']?_0x41449f[_0xdb52('0x45')]:_0x5a3d52[_0xdb52('0x40')];_0x41449f[_0xdb52('0x4b')]=qs[_0xdb52('0x65')](_0x14c83f[_0xdb52('0x41')][_0xdb52('0x65')]);_0x41449f[_0xdb52('0x4c')]=qs[_0xdb52('0x43')](_[_0xdb52('0x6b')](_0x14c83f['query'],_0x5a3d52[_0xdb52('0x43')]));if(_0x14c83f['query'][_0xdb52('0x4d')]){_0x41449f[_0xdb52('0x4c')]=_[_0xdb52('0x4e')](_0x41449f[_0xdb52('0x4c')],{'$or':_[_0xdb52('0x3a')](_0x41449f[_0xdb52('0x45')],function(_0x1e6a5){var _0x289b85={};_0x289b85[_0x1e6a5]={'$like':'%'+_0x14c83f[_0xdb52('0x41')][_0xdb52('0x4d')]+'%'};return _0x289b85;})});}_0x41449f=_['merge']({},_0x41449f,_0x14c83f[_0xdb52('0x57')]);return _0x32931d[_0xdb52('0xc3')](_0x41449f);}})[_0xdb52('0x1e')](function(_0xc2187b){if(_0xc2187b){_0x2e0598=_0xc2187b[_0xdb52('0x47')];if(!_0x14c83f[_0xdb52('0x41')][_0xdb52('0x48')](_0xdb52('0x49'))){_0x41449f[_0xdb52('0x4a')]=qs[_0xdb52('0x4a')](_0x14c83f[_0xdb52('0x41')]['limit']);_0x41449f[_0xdb52('0x2e')]=qs[_0xdb52('0x2e')](_0x14c83f[_0xdb52('0x41')][_0xdb52('0x2e')]);}return _0x32931d[_0xdb52('0xc3')](_0x41449f);}})[_0xdb52('0x1e')](function(_0xce029b){if(_0xce029b){return _0xce029b?{'count':_0x2e0598,'rows':_0xce029b}:null;}})[_0xdb52('0x1e')](respondWithResult(_0x350546,null))[_0xdb52('0x28')](handleError(_0x350546,null));};exports[_0xdb52('0xc4')]=function(_0x464080,_0x234be7,_0x5870db){var _0x585bf6={'raw':![],'where':{}};var _0x1b4b68={};var _0x3507bb={'count':0x0,'rows':[]};return db[_0xdb52('0x3b')][_0xdb52('0x63')]({'where':{'id':_0x464080[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x234be7,null))[_0xdb52('0x1e')](function(_0x55b8ee){if(_0x55b8ee){_0x1b4b68['model']=_[_0xdb52('0x42')](db[_0xdb52('0xa2')][_0xdb52('0x3c')]);_0x1b4b68['query']=_[_0xdb52('0x42')](_0x464080[_0xdb52('0x41')]);_0x1b4b68[_0xdb52('0x43')]=_[_0xdb52('0x44')](_0x1b4b68['model'],_0x1b4b68[_0xdb52('0x41')]);_0x585bf6[_0xdb52('0x45')]=_['intersection'](_0x1b4b68[_0xdb52('0x40')],qs[_0xdb52('0x46')](_0x464080[_0xdb52('0x41')][_0xdb52('0x46')]));_0x585bf6[_0xdb52('0x45')]=_0x585bf6['attributes'][_0xdb52('0x47')]?_0x585bf6[_0xdb52('0x45')]:_0x1b4b68[_0xdb52('0x40')];if(!_0x464080[_0xdb52('0x41')][_0xdb52('0x48')](_0xdb52('0x49'))){_0x585bf6[_0xdb52('0x4a')]=qs['limit'](_0x464080['query'][_0xdb52('0x4a')]);_0x585bf6['offset']=qs[_0xdb52('0x2e')](_0x464080['query'][_0xdb52('0x2e')]);}_0x585bf6[_0xdb52('0x4b')]=qs[_0xdb52('0x65')](_0x464080[_0xdb52('0x41')]['sort']);_0x585bf6[_0xdb52('0x4c')]=qs['filters'](_[_0xdb52('0x6b')](_0x464080[_0xdb52('0x41')],_0x1b4b68[_0xdb52('0x43')]));_0x585bf6[_0xdb52('0x4c')]['SmsAccountId']=_0x55b8ee['id'];if(_0x464080['query'][_0xdb52('0x4d')]){_0x585bf6[_0xdb52('0x4c')]=_[_0xdb52('0x4e')](_0x585bf6[_0xdb52('0x4c')],{'$or':_['map'](_0x585bf6[_0xdb52('0x45')],function(_0x545a84){var _0x507bbc={};_0x507bbc[_0x545a84]={'$like':'%'+_0x464080[_0xdb52('0x41')][_0xdb52('0x4d')]+'%'};return _0x507bbc;})});}_0x585bf6=_['merge']({},_0x585bf6,_0x464080['options']);return db[_0xdb52('0xa2')][_0xdb52('0x2d')]({'where':_0x585bf6['where']})['then'](function(_0x41cfdf){_0x3507bb[_0xdb52('0x2d')]=_0x41cfdf;if(_0x464080[_0xdb52('0x41')][_0xdb52('0x50')]){_0x585bf6[_0xdb52('0x51')]=[{'model':db[_0xdb52('0x77')],'as':_0xdb52('0xc5'),'required':![]},{'model':db[_0xdb52('0xac')],'as':_0xdb52('0xc6'),'attributes':[_0xdb52('0x37'),_0xdb52('0xc7'),_0xdb52('0xc8')],'required':![]},{'model':db[_0xdb52('0xc9')],'as':_0xdb52('0xca'),'attributes':['id',_0xdb52('0x37'),_0xdb52('0xcb')],'where':_0x464080[_0xdb52('0x41')]['tag']?{'id':_0x464080[_0xdb52('0x41')][_0xdb52('0xcc')]}:undefined,'required':_0x464080[_0xdb52('0x41')][_0xdb52('0xcc')]?!![]:![]}];}return db[_0xdb52('0xa2')]['findAll'](_0x585bf6);})['then'](function(_0x3b0681){_0x3507bb['rows']=_0x3b0681;return _0x3507bb;});}})['then'](respondWithFilteredResult(_0x234be7,_0x585bf6))[_0xdb52('0x28')](handleError(_0x234be7,null));};exports[_0xdb52('0x38')]=function(_0x5a051b,_0x4a8791,_0x9edb93){var _0x90c9cb,_0x167e14,_0x2c7b99;if(_[_0xdb52('0x98')](_0x5a051b['body'][_0xdb52('0x5f')])||_0x5a051b[_0xdb52('0x5f')][_0xdb52('0x5f')]===''){throw new db[(_0xdb52('0x96'))][(_0xdb52('0x78'))](_0xdb52('0xcd'));}if(_[_0xdb52('0x98')](_0x5a051b[_0xdb52('0x5f')]['to'])){throw new db[(_0xdb52('0x96'))][(_0xdb52('0x78'))](_0xdb52('0xce'));}_0x90c9cb=_0x5a051b[_0xdb52('0x5f')]['to'];return db['SmsAccount'][_0xdb52('0x5a')]({'where':{'id':_0x5a051b[_0xdb52('0x54')]['id']},'include':[{'model':db[_0xdb52('0x9c')],'as':'List','include':[{'model':db[_0xdb52('0x77')],'as':_0xdb52('0xa0'),'where':{'mobile':_0x90c9cb},'limit':0x1,'order':[[_0xdb52('0x7b'),_0xdb52('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x4a8791,null))[_0xdb52('0x1e')](function(_0x35051b){if(_0x35051b&&_0x35051b[_0xdb52('0xcf')]){_0x167e14=_0x35051b[_0xdb52('0x34')]({'plain':!![]});if(_0x167e14[_0xdb52('0xcf')]&&_0x167e14[_0xdb52('0xcf')][_0xdb52('0xa0')]['length']){return _0x167e14[_0xdb52('0xcf')][_0xdb52('0xa0')][0x0];}return db['CmContact'][_0xdb52('0x5d')](_[_0xdb52('0x16')](_0x5a051b['body'],{'firstName':_0x90c9cb,'mobile':_0x90c9cb,'phone':_0x90c9cb,'ListId':_0x167e14[_0xdb52('0x7e')]}));}})[_0xdb52('0x1e')](handleEntityNotFound(_0x4a8791,null))[_0xdb52('0x1e')](function(_0x1aa9c1){if(_0x1aa9c1){_0x2c7b99=_0x1aa9c1;return db['SmsInteraction']['find']({'where':{'ContactId':_0x2c7b99['id'],'closed':![],'SmsAccountId':_0x167e14['id']}})['then'](function(_0x24d67e){if(_0x24d67e){return[_0x24d67e,![]];}return db['SmsInteraction']['create']({'UserId':_0x5a051b[_0xdb52('0xd0')]['id'],'ContactId':_0x2c7b99['id'],'SmsAccountId':_0x167e14['id'],'phone':_0x90c9cb,'firstMsgDirection':_0xdb52('0xd1'),'Messages':[_['merge'](_0x5a051b[_0xdb52('0x5f')],{'read':![],'body':_0x5a051b[_0xdb52('0x5f')][_0xdb52('0x5f')],'phone':_0x90c9cb,'SmsAccountId':_0x167e14['id'],'UserId':_0x5a051b[_0xdb52('0xd0')]['id'],'ContactId':_0x2c7b99['id']})]},{'include':[{'model':db[_0xdb52('0xd2')],'as':_0xdb52('0xd3')}]})[_0xdb52('0x1e')](function(_0x52cc37){return[_0x52cc37,!![]];});});}})[_0xdb52('0xd4')](function(_0x2b6e13,_0x1aeff3){if(_0x1aeff3){return _0x2b6e13;}return db[_0xdb52('0xd2')][_0xdb52('0x5d')](_[_0xdb52('0x4e')](_0x5a051b[_0xdb52('0x5f')],{'read':![],'body':_0x5a051b[_0xdb52('0x5f')][_0xdb52('0x5f')],'phone':_0x90c9cb,'SmsAccountId':_0x167e14['id'],'SmsInteractionId':_0x2b6e13['id'],'UserId':_0x5a051b['user']['id'],'ContactId':_0x2c7b99['id']}))[_0xdb52('0x1e')](function(_0x53e4e4){_0x2b6e13[_0xdb52('0xd5')][_0xdb52('0xd3')]=[];_0x2b6e13[_0xdb52('0xd5')]['Messages'][_0xdb52('0xa6')](_0x53e4e4[_0xdb52('0xd5')]);return _0x2b6e13;});})[_0xdb52('0x1e')](respondWithResult(_0x4a8791,null))[_0xdb52('0x28')](handleError(_0x4a8791,null));};exports[_0xdb52('0x2b')]=function(_0x41797b,_0x1af9ee,_0x2db5b3){if(_0x41797b[_0xdb52('0x5f')]['id']){delete _0x41797b[_0xdb52('0x5f')]['id'];}var _0x5a31bc,_0x4e64f4,_0xdf6f31;return db['SmsAccount'][_0xdb52('0x5a')]({'where':{'id':_0x41797b[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x1af9ee,null))[_0xdb52('0x1e')](function(_0x20ad12){if(_0x20ad12){_0xdf6f31=_0x20ad12;logger[_0xdb52('0xb5')](_0xdb52('0x21'),_0xdb52('0x2b'),'received\x20delivery\x20report\x20from',_0x20ad12[_0xdb52('0x3e')],util['inspect'](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));switch(_0x20ad12[_0xdb52('0x3e')]){case _0xdb52('0x85'):if(_0x41797b[_0xdb52('0x5f')]['skebby_dispatch_id']&&_0x41797b['body'][_0xdb52('0x2b')]){_0x4e64f4=_0x41797b['body'][_0xdb52('0x2b')];return db['SmsMessage'][_0xdb52('0x5a')]({'where':{'messageId':_0x41797b[_0xdb52('0x5f')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x41797b[_0xdb52('0x5f')][_0xdb52('0xd6')]&&_0x41797b['body'][_0xdb52('0xd7')]){_0x4e64f4=_0x41797b['body']['statusInt'];return db['SmsMessage'][_0xdb52('0x5a')]({'where':{'messageId':_0x41797b[_0xdb52('0x5f')]['requestid']}});}break;case _0xdb52('0xd8'):if(_0x41797b[_0xdb52('0x5f')][_0xdb52('0x88')]&&_0x41797b['body']['status_code']){_0x4e64f4=_0x41797b[_0xdb52('0x5f')][_0xdb52('0xd9')];return db[_0xdb52('0xd2')]['find']({'where':{'messageId':_0x41797b[_0xdb52('0x5f')][_0xdb52('0x88')]}});}break;case _0xdb52('0x8c'):var _0x5d062f=_0x41797b[_0xdb52('0x5f')][_0xdb52('0x8d')][0x0];if(_0x5d062f[_0xdb52('0x83')]&&_0x5d062f[_0xdb52('0x2b')][_0xdb52('0xda')]===_0xdb52('0xdb')){_0x4e64f4=_0x5d062f[_0xdb52('0x2b')][_0xdb52('0xda')];return db[_0xdb52('0xd2')][_0xdb52('0x5a')]({'where':{'messageId':_0x5d062f['messageId']}});}break;case'clickatell':if(_0x41797b['body']['messageId']&&_0x41797b[_0xdb52('0x5f')][_0xdb52('0x2b')]){_0x4e64f4=_0x41797b[_0xdb52('0x5f')][_0xdb52('0x2b')];return db[_0xdb52('0xd2')][_0xdb52('0x5a')]({'where':{'messageId':_0x41797b[_0xdb52('0x5f')][_0xdb52('0x83')]}});}break;case _0xdb52('0x94'):if(_0x41797b['body'][0x0][_0xdb52('0x26')]['id']){_0x4e64f4=_0x41797b['body'][0x0][_0xdb52('0x3e')];return db['SmsMessage'][_0xdb52('0x5a')]({'where':{'messageId':_0x41797b['body'][0x0][_0xdb52('0x26')]['id']}});}break;case _0xdb52('0x95'):if(_0x41797b[_0xdb52('0x5f')][_0xdb52('0xdc')]&&_0x41797b[_0xdb52('0x5f')]['status']){_0x4e64f4=_0x41797b['body'][_0xdb52('0x2b')];return db[_0xdb52('0xd2')][_0xdb52('0x5a')]({'where':{'messageId':_0x41797b[_0xdb52('0x5f')][_0xdb52('0xdc')]}});}break;}}})[_0xdb52('0x1e')](handleEntityNotFound(_0x1af9ee,null))['then'](function(_0x12bd90){if(_0x12bd90){_0x5a31bc=_0x12bd90;switch(_0xdf6f31[_0xdb52('0x3e')]){case _0xdb52('0x85'):if(_0x4e64f4===_0xdb52('0xdb')){return _0x5a31bc['update']({'read':!![]});}else{logger[_0xdb52('0x24')](_0xdb52('0x21'),_0xdb52('0x2b'),'skebby',util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0x87'):if(_0x4e64f4==='1'){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger[_0xdb52('0x24')](_0xdb52('0x21'),_0xdb52('0x2b'),'skebby',util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0xd8'):if(!_0x41797b[_0xdb52('0x5f')][_0xdb52('0xde')]&&_0x4e64f4>=0xc8&&_0x4e64f4<=0xce){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger[_0xdb52('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdb52('0x2b'),_0xdb52('0xd8'),util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0x8c'):var _0x379dc7=_0x41797b[_0xdb52('0x5f')][_0xdb52('0x8d')][0x0];if(_0x379dc7[_0xdb52('0x2b')][_0xdb52('0xda')]===_0xdb52('0xdb')){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger[_0xdb52('0x24')](_0xdb52('0x21'),_0xdb52('0x2b'),_0xdb52('0x8c'),util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0x91'):if(_0x4e64f4==_0xdb52('0xdf')||_0x4e64f4==_0xdb52('0xe0')){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger['error'](_0xdb52('0x21'),_0xdb52('0x2b'),'clickatell',util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0x94'):if(_0x4e64f4==_0xdb52('0xe1')){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger[_0xdb52('0x24')](_0xdb52('0x21'),'status',_0xdb52('0x94'),util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xdb52('0x95'):if(_0x4e64f4==='DELIVRD'||_0x4e64f4===_0xdb52('0xe2')){return _0x5a31bc[_0xdb52('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdb52('0x2b'),_0xdb52('0x95'),util[_0xdb52('0xdd')](_0x41797b[_0xdb52('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x5a31bc;}})[_0xdb52('0x1e')](respondWithResult(_0x1af9ee,null))[_0xdb52('0x28')](handleError(_0x1af9ee,null));};exports['statusGet']=function(_0x37542b,_0x5191f4,_0x414ac0){var _0x6d16ae,_0xe5ad43,_0x10c295;return db[_0xdb52('0x3b')][_0xdb52('0x5a')]({'where':{'id':_0x37542b[_0xdb52('0x54')]['id']}})['then'](handleEntityNotFound(_0x5191f4,null))['then'](function(_0x5bc2e1){if(_0x5bc2e1){_0x10c295=_0x5bc2e1;logger[_0xdb52('0xb5')](_0xdb52('0x21'),_0xdb52('0x2b'),_0xdb52('0xe3'),_0x5bc2e1[_0xdb52('0x3e')],util[_0xdb52('0xdd')](_0x37542b[_0xdb52('0x41')],{'showHidden':![],'depth':null}));switch(_0x5bc2e1[_0xdb52('0x3e')]){case _0xdb52('0xe4'):if(_0x37542b[_0xdb52('0x41')][_0xdb52('0xe5')]&&_0x37542b[_0xdb52('0x41')][_0xdb52('0xe6')]){_0xe5ad43=_0x37542b['query'][_0xdb52('0xe6')];return db['SmsMessage'][_0xdb52('0x5a')]({'where':{'messageId':_0x37542b[_0xdb52('0x41')][_0xdb52('0xe5')]}});}break;}}})['then'](handleEntityNotFound(_0x5191f4,null))[_0xdb52('0x1e')](function(_0x10c798){if(_0x10c798){_0x6d16ae=_0x10c798;switch(_0x10c295[_0xdb52('0x3e')]){case _0xdb52('0xe4'):if(_0xe5ad43==='2'||_0xe5ad43==='6'){return _0x6d16ae[_0xdb52('0x32')]({'read':!![]});}else{logger[_0xdb52('0x24')](_0xdb52('0x21'),_0xdb52('0x2b'),'csc',util[_0xdb52('0xdd')](_0x37542b[_0xdb52('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x6d16ae;}})[_0xdb52('0x1e')](respondWithResult(_0x5191f4,null))[_0xdb52('0x28')](handleError(_0x5191f4,null));};exports[_0xdb52('0xe7')]=function(_0x532d40,_0x2fed1a,_0x33bf24){return db[_0xdb52('0x3b')]['find']({'where':{'id':_0x532d40['params']['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x2fed1a,null))[_0xdb52('0x1e')](function(_0x438228){if(_0x438228){return _0x438228['addAgents'](_0x532d40[_0xdb52('0x5f')][_0xdb52('0x6d')],_[_0xdb52('0x9f')](_0x532d40[_0xdb52('0x5f')],['ids','id'])||{})[_0xdb52('0xd4')](function(_0x43c27f){for(var _0x5ca1ff=0x0;_0x5ca1ff<_0x532d40[_0xdb52('0x5f')][_0xdb52('0x6d')][_0xdb52('0x47')];_0x5ca1ff+=0x1){socket[_0xdb52('0xe8')](_0xdb52('0xe9'),{'UserId':Number(_0x532d40[_0xdb52('0x5f')][_0xdb52('0x6d')][_0x5ca1ff]),'SmsAccountId':Number(_0x532d40[_0xdb52('0x54')]['id'])});}return _0x43c27f;});}})[_0xdb52('0x1e')](respondWithResult(_0x2fed1a,null))[_0xdb52('0x28')](handleError(_0x2fed1a,null));};exports[_0xdb52('0xea')]=function(_0x396658,_0x55bc89,_0x3e2b42){return db['SmsAccount'][_0xdb52('0x5a')]({'where':{'id':_0x396658['params']['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x55bc89,null))['then'](function(_0x3e9add){if(_0x3e9add){return _0x3e9add[_0xdb52('0xea')](_0x396658[_0xdb52('0x41')][_0xdb52('0x6d')])['then'](function(){if(_[_0xdb52('0xeb')](_0x396658[_0xdb52('0x41')][_0xdb52('0x6d')])){for(var _0x1b5e7c=0x0;_0x1b5e7c<_0x396658[_0xdb52('0x41')][_0xdb52('0x6d')][_0xdb52('0x47')];_0x1b5e7c+=0x1){socket[_0xdb52('0xe8')]('userSmsAccount:remove',{'UserId':Number(_0x396658['query'][_0xdb52('0x6d')][_0x1b5e7c]),'SmsAccountId':Number(_0x396658['params']['id'])});}}else{socket[_0xdb52('0xe8')](_0xdb52('0xec'),{'UserId':Number(_0x396658[_0xdb52('0x41')]['ids']),'SmsAccountId':Number(_0x396658['params']['id'])});}});}})[_0xdb52('0x1e')](respondWithStatusCode(_0x55bc89,null))[_0xdb52('0x28')](handleError(_0x55bc89,null));};exports[_0xdb52('0xed')]=function(_0x3f130d,_0x69d85f,_0x3b9e3c){var _0x3ac267={};var _0x52865b={};var _0x446067;var _0x5b247a;return db[_0xdb52('0x3b')][_0xdb52('0x63')]({'where':{'id':_0x3f130d[_0xdb52('0x54')]['id']}})[_0xdb52('0x1e')](handleEntityNotFound(_0x69d85f,null))['then'](function(_0x1350d9){if(_0x1350d9){_0x446067=_0x1350d9;_0x52865b[_0xdb52('0x40')]=_[_0xdb52('0x42')](db['User']['rawAttributes']);_0x52865b[_0xdb52('0x41')]=_[_0xdb52('0x42')](_0x3f130d['query']);_0x52865b['filters']=_[_0xdb52('0x44')](_0x52865b[_0xdb52('0x40')],_0x52865b[_0xdb52('0x41')]);_0x3ac267[_0xdb52('0x45')]=_[_0xdb52('0x44')](_0x52865b['model'],qs[_0xdb52('0x46')](_0x3f130d['query']['fields']));_0x3ac267['attributes']=_0x3ac267[_0xdb52('0x45')][_0xdb52('0x47')]?_0x3ac267[_0xdb52('0x45')]:_0x52865b['model'];_0x3ac267[_0xdb52('0x4b')]=qs[_0xdb52('0x65')](_0x3f130d[_0xdb52('0x41')][_0xdb52('0x65')]);_0x3ac267[_0xdb52('0x4c')]=qs[_0xdb52('0x43')](_['pick'](_0x3f130d[_0xdb52('0x41')],_0x52865b[_0xdb52('0x43')]));if(_0x3f130d['query']['filter']){_0x3ac267['where']=_[_0xdb52('0x4e')](_0x3ac267[_0xdb52('0x4c')],{'$or':_['map'](_0x3ac267[_0xdb52('0x45')],function(_0x5b59c4){var _0x4c2f12={};_0x4c2f12[_0x5b59c4]={'$like':'%'+_0x3f130d[_0xdb52('0x41')][_0xdb52('0x4d')]+'%'};return _0x4c2f12;})});}_0x3ac267=_[_0xdb52('0x4e')]({},_0x3ac267,_0x3f130d['options']);return _0x446067[_0xdb52('0xed')](_0x3ac267);}})[_0xdb52('0x1e')](function(_0x4f9c2f){if(_0x4f9c2f){_0x5b247a=_0x4f9c2f['length'];if(!_0x3f130d[_0xdb52('0x41')]['hasOwnProperty'](_0xdb52('0x49'))){_0x3ac267['limit']=qs[_0xdb52('0x4a')](_0x3f130d[_0xdb52('0x41')][_0xdb52('0x4a')]);_0x3ac267[_0xdb52('0x2e')]=qs[_0xdb52('0x2e')](_0x3f130d[_0xdb52('0x41')]['offset']);}return _0x446067[_0xdb52('0xed')](_0x3ac267);}})[_0xdb52('0x1e')](function(_0x20c730){if(_0x20c730){return _0x20c730?{'count':_0x5b247a,'rows':_0x20c730}:null;}})[_0xdb52('0x1e')](respondWithResult(_0x69d85f,null))['catch'](handleError(_0x69d85f,null));}; \ No newline at end of file +var _0x9fc7=['mobile','twilio','from','From','Body','skebby','sender','text','connectel','clicksend','message_id','Text','messageId','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','applications','close','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','order','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','defaults','user','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','intelepeer','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','csc','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','get','SmsAccounts','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','orderBy','Applications','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId'];(function(_0x40186a,_0x5b26f0){var _0x4dad1c=function(_0x155e29){while(--_0x155e29){_0x40186a['push'](_0x40186a['shift']());}};_0x4dad1c(++_0x5b26f0);}(_0x9fc7,0x6f));var _0x79fc=function(_0x18b79c,_0x72c0e6){_0x18b79c=_0x18b79c-0x0;var _0x4591c1=_0x9fc7[_0x18b79c];return _0x4591c1;};'use strict';var emlformat=require(_0x79fc('0x0'));var rimraf=require(_0x79fc('0x1'));var zipdir=require(_0x79fc('0x2'));var jsonpatch=require(_0x79fc('0x3'));var rp=require('request-promise');var moment=require(_0x79fc('0x4'));var BPromise=require(_0x79fc('0x5'));var Mustache=require(_0x79fc('0x6'));var util=require('util');var path=require(_0x79fc('0x7'));var sox=require(_0x79fc('0x8'));var csv=require('to-csv');var ejs=require(_0x79fc('0x9'));var fs=require('fs');var fs_extra=require(_0x79fc('0xa'));var _=require(_0x79fc('0xb'));var squel=require(_0x79fc('0xc'));var crypto=require(_0x79fc('0xd'));var jsforce=require(_0x79fc('0xe'));var deskjs=require(_0x79fc('0xf'));var toCsv=require(_0x79fc('0x10'));var querystring=require(_0x79fc('0x11'));var Papa=require(_0x79fc('0x12'));var Redis=require(_0x79fc('0x13'));var authService=require(_0x79fc('0x14'));var qs=require(_0x79fc('0x15'));var as=require(_0x79fc('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x79fc('0x17'))(_0x79fc('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x79fc('0x19'));var db=require(_0x79fc('0x1a'))['db'];config[_0x79fc('0x1b')]=_['defaults'](config['redis'],{'host':_0x79fc('0x1c'),'port':0x18eb});var socket=require(_0x79fc('0x1d'))(new Redis(config[_0x79fc('0x1b')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x79fc('0x1e'));var client=jayson['client'][_0x79fc('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5e2967,_0x398413,_0x172949,_0x481326){return new BPromise(function(_0x288438,_0x199864){var _0x48be06=_0x481326||client;return _0x48be06[_0x79fc('0x20')](_0x5e2967,_0x172949)[_0x79fc('0x21')](function(_0x425d5b){logger[_0x79fc('0x22')](_0x79fc('0x23'),_0x398413,'request\x20sent');logger['debug'](_0x79fc('0x24'),_0x398413,_0x79fc('0x25'),JSON[_0x79fc('0x26')](_0x425d5b));if(_0x425d5b[_0x79fc('0x27')]){if(_0x425d5b[_0x79fc('0x27')][_0x79fc('0x28')]===0x1f4){logger[_0x79fc('0x27')](_0x79fc('0x23'),_0x398413,_0x425d5b[_0x79fc('0x27')][_0x79fc('0x29')]);return _0x199864(_0x425d5b['error'][_0x79fc('0x29')]);}logger[_0x79fc('0x27')](_0x79fc('0x23'),_0x398413,_0x425d5b['error'][_0x79fc('0x29')]);return _0x288438(_0x425d5b['error']['message']);}else{logger[_0x79fc('0x22')]('SmsAccount,\x20%s,\x20%s',_0x398413,_0x79fc('0x25'));_0x288438(_0x425d5b['result'][_0x79fc('0x29')]);}})[_0x79fc('0x2a')](function(_0x5c3db2){logger['error'](_0x79fc('0x23'),_0x398413,_0x5c3db2);_0x199864(_0x5c3db2);});});}function respondWithStatusCode(_0x25ca43,_0x49ace1){_0x49ace1=_0x49ace1||0xcc;return function(_0x10a057){if(_0x10a057){return _0x25ca43[_0x79fc('0x2b')](_0x49ace1);}return _0x25ca43[_0x79fc('0x2c')](_0x49ace1)[_0x79fc('0x2d')]();};}function respondWithResult(_0x259b9f,_0x4907ab){_0x4907ab=_0x4907ab||0xc8;return function(_0x1e23cb){if(_0x1e23cb){return _0x259b9f[_0x79fc('0x2c')](_0x4907ab)['json'](_0x1e23cb);}};}function respondWithFilteredResult(_0x375fae,_0x2251fa){return function(_0x5e9266){if(_0x5e9266){var _0x339a09=typeof _0x2251fa['offset']==='undefined'&&typeof _0x2251fa[_0x79fc('0x2e')]===_0x79fc('0x2f');var _0x492c98=_0x5e9266[_0x79fc('0x30')];var _0x289ff1=_0x339a09?0x0:_0x2251fa['offset'];var _0x3f959b=_0x339a09?_0x5e9266[_0x79fc('0x30')]:_0x2251fa[_0x79fc('0x31')]+_0x2251fa[_0x79fc('0x2e')];var _0x461f5d;if(_0x3f959b>=_0x492c98){_0x3f959b=_0x492c98;_0x461f5d=0xc8;}else{_0x461f5d=0xce;}_0x375fae[_0x79fc('0x2c')](_0x461f5d);return _0x375fae[_0x79fc('0x32')](_0x79fc('0x33'),_0x289ff1+'-'+_0x3f959b+'/'+_0x492c98)[_0x79fc('0x34')](_0x5e9266);}return null;};}function patchUpdates(_0x5e5476){return function(_0x568d78){try{jsonpatch[_0x79fc('0x35')](_0x568d78,_0x5e5476,!![]);}catch(_0x59a984){return BPromise['reject'](_0x59a984);}return _0x568d78[_0x79fc('0x36')]();};}function saveUpdates(_0x33c0ba,_0x39901a){return function(_0x84f331){if(_0x84f331){return _0x84f331[_0x79fc('0x37')](_0x33c0ba)['then'](function(_0x53f7c5){return _0x53f7c5;});}return null;};}function removeEntity(_0x759302,_0x5405d3){return function(_0x2d4832){if(_0x2d4832){return _0x2d4832['destroy']()[_0x79fc('0x21')](function(){var _0x501766=_0x2d4832[_0x79fc('0x38')]({'plain':!![]});var _0x1442a0=_0x79fc('0x39');return db[_0x79fc('0x3a')]['destroy']({'where':{'type':_0x1442a0,'resourceId':_0x501766['id']}})[_0x79fc('0x21')](function(){return _0x2d4832;});})['then'](function(){_0x759302[_0x79fc('0x2c')](0xcc)[_0x79fc('0x2d')]();});}};}function handleEntityNotFound(_0x515ef1,_0x32bef3){return function(_0xa8d99f){if(!_0xa8d99f){_0x515ef1['sendStatus'](0x194);}return _0xa8d99f;};}function handleError(_0xec24eb,_0x137815){_0x137815=_0x137815||0x1f4;return function(_0x2cfe21){logger[_0x79fc('0x27')](_0x2cfe21['stack']);if(_0x2cfe21[_0x79fc('0x3b')]){delete _0x2cfe21['name'];}_0xec24eb[_0x79fc('0x2c')](_0x137815)[_0x79fc('0x3c')](_0x2cfe21);};}exports[_0x79fc('0x3d')]=function(_0x4f4721,_0x133622){var _0x426a09={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x21edbe={},_0x227be3={'count':0x0,'rows':[]};var _0x3de033=_[_0x79fc('0x3e')](db['SmsAccount']['rawAttributes'],function(_0x4ad5a1){return{'name':_0x4ad5a1[_0x79fc('0x3f')],'type':_0x4ad5a1[_0x79fc('0x40')][_0x79fc('0x41')]};});_0x21edbe[_0x79fc('0x42')]=_[_0x79fc('0x3e')](_0x3de033,_0x79fc('0x3b'));_0x21edbe[_0x79fc('0x43')]=_['keys'](_0x4f4721[_0x79fc('0x43')]);_0x21edbe[_0x79fc('0x44')]=_['intersection'](_0x21edbe[_0x79fc('0x42')],_0x21edbe['query']);_0x426a09['attributes']=_[_0x79fc('0x45')](_0x21edbe[_0x79fc('0x42')],qs[_0x79fc('0x46')](_0x4f4721[_0x79fc('0x43')][_0x79fc('0x46')]));_0x426a09[_0x79fc('0x47')]=_0x426a09[_0x79fc('0x47')][_0x79fc('0x48')]?_0x426a09[_0x79fc('0x47')]:_0x21edbe[_0x79fc('0x42')];if(!_0x4f4721['query'][_0x79fc('0x49')]('nolimit')){_0x426a09[_0x79fc('0x2e')]=qs[_0x79fc('0x2e')](_0x4f4721[_0x79fc('0x43')][_0x79fc('0x2e')]);_0x426a09[_0x79fc('0x31')]=qs[_0x79fc('0x31')](_0x4f4721['query'][_0x79fc('0x31')]);}_0x426a09['order']=qs[_0x79fc('0x4a')](_0x4f4721[_0x79fc('0x43')][_0x79fc('0x4a')]);_0x426a09[_0x79fc('0x4b')]=qs[_0x79fc('0x44')](_[_0x79fc('0x4c')](_0x4f4721['query'],_0x21edbe['filters']),_0x3de033);if(_0x4f4721[_0x79fc('0x43')][_0x79fc('0x4d')]){_0x426a09[_0x79fc('0x4b')]=_[_0x79fc('0x4e')](_0x426a09[_0x79fc('0x4b')],{'$or':_[_0x79fc('0x3e')](_0x3de033,function(_0x495dfd){if(_0x495dfd[_0x79fc('0x40')]!=='VIRTUAL'){var _0x28ba61={};_0x28ba61[_0x495dfd['name']]={'$like':'%'+_0x4f4721[_0x79fc('0x43')][_0x79fc('0x4d')]+'%'};return _0x28ba61;}})});}_0x426a09=_[_0x79fc('0x4e')]({},_0x426a09,_0x4f4721[_0x79fc('0x4f')]);var _0x3fa35b={'where':_0x426a09[_0x79fc('0x4b')]};return db[_0x79fc('0x50')][_0x79fc('0x30')](_0x3fa35b)[_0x79fc('0x21')](function(_0x514a0d){_0x227be3[_0x79fc('0x30')]=_0x514a0d;if(_0x4f4721[_0x79fc('0x43')][_0x79fc('0x51')]){_0x426a09[_0x79fc('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x79fc('0x53')](_0x426a09);})[_0x79fc('0x21')](function(_0x1aa2b4){_0x227be3[_0x79fc('0x54')]=_0x1aa2b4;return _0x227be3;})[_0x79fc('0x21')](respondWithFilteredResult(_0x133622,_0x426a09))['catch'](handleError(_0x133622,null));};exports[_0x79fc('0x55')]=function(_0x4e7754,_0x360b0d){var _0x7077e8={'raw':![],'where':{'id':_0x4e7754[_0x79fc('0x56')]['id']},'include':[{'model':db[_0x79fc('0x57')],'as':_0x79fc('0x58')}]},_0x34ebdc={};_0x34ebdc[_0x79fc('0x42')]=_[_0x79fc('0x59')](db[_0x79fc('0x50')][_0x79fc('0x5a')]);_0x34ebdc[_0x79fc('0x43')]=_[_0x79fc('0x59')](_0x4e7754['query']);_0x34ebdc['filters']=_['intersection'](_0x34ebdc['model'],_0x34ebdc['query']);_0x7077e8[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0x34ebdc['model'],qs[_0x79fc('0x46')](_0x4e7754['query']['fields']));_0x7077e8[_0x79fc('0x47')]=_0x7077e8[_0x79fc('0x47')][_0x79fc('0x48')]?_0x7077e8['attributes']:_0x34ebdc[_0x79fc('0x42')];if(_0x4e7754[_0x79fc('0x43')][_0x79fc('0x51')]){_0x7077e8[_0x79fc('0x52')]=[{'all':!![]}];}_0x7077e8=_[_0x79fc('0x4e')]({},_0x7077e8,_0x4e7754[_0x79fc('0x4f')]);return db['SmsAccount'][_0x79fc('0x5b')](_0x7077e8)[_0x79fc('0x21')](handleEntityNotFound(_0x360b0d,null))[_0x79fc('0x21')](respondWithResult(_0x360b0d,null))[_0x79fc('0x2a')](handleError(_0x360b0d,null));};exports[_0x79fc('0x5c')]=function(_0x48e7d5,_0x57fb4f){return db[_0x79fc('0x50')][_0x79fc('0x5c')](_0x48e7d5[_0x79fc('0x5d')],{})[_0x79fc('0x21')](function(_0x14f537){var _0x4675a4=_0x48e7d5['user'][_0x79fc('0x38')]({'plain':!![]});if(!_0x4675a4)throw new Error(_0x79fc('0x5e'));if(_0x4675a4[_0x79fc('0x5f')]==='user'){var _0x2e565d=_0x14f537[_0x79fc('0x38')]({'plain':!![]});var _0x3be19f='SmsAccounts';return db[_0x79fc('0x60')][_0x79fc('0x5b')]({'where':{'name':_0x3be19f,'userProfileId':_0x4675a4[_0x79fc('0x61')]},'raw':!![]})['then'](function(_0x3a5533){if(_0x3a5533&&_0x3a5533['autoAssociation']===0x0){return db[_0x79fc('0x3a')][_0x79fc('0x5c')]({'name':_0x2e565d[_0x79fc('0x3b')],'resourceId':_0x2e565d['id'],'type':_0x3a5533['name'],'sectionId':_0x3a5533['id']},{})[_0x79fc('0x21')](function(){return _0x14f537;});}else{return _0x14f537;}})['catch'](function(_0x44f384){logger[_0x79fc('0x27')](_0x79fc('0x62'),_0x44f384);throw _0x44f384;});}return _0x14f537;})[_0x79fc('0x21')](respondWithResult(_0x57fb4f,0xc9))[_0x79fc('0x2a')](handleError(_0x57fb4f,null));};exports[_0x79fc('0x37')]=function(_0x1db3c1,_0x5caaa2){if(_0x1db3c1[_0x79fc('0x5d')]['id']){delete _0x1db3c1[_0x79fc('0x5d')]['id'];}return db['SmsAccount'][_0x79fc('0x5b')]({'where':{'id':_0x1db3c1[_0x79fc('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x79fc('0x58')}]})['then'](handleEntityNotFound(_0x5caaa2,null))['then'](saveUpdates(_0x1db3c1['body'],null))[_0x79fc('0x21')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports[_0x79fc('0x63')]=function(_0x3e5d23,_0x3b3829){return db['SmsAccount'][_0x79fc('0x5b')]({'where':{'id':_0x3e5d23[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x3b3829,null))[_0x79fc('0x21')](removeEntity(_0x3b3829,null))['catch'](handleError(_0x3b3829,null));};exports[_0x79fc('0x64')]=function(_0x330ced,_0x4e0869){return db[_0x79fc('0x50')][_0x79fc('0x64')]()[_0x79fc('0x21')](respondWithResult(_0x4e0869,null))[_0x79fc('0x2a')](handleError(_0x4e0869,null));};exports[_0x79fc('0x65')]=function(_0x3f3e84,_0x14171c,_0x5815a6){if(_0x3f3e84[_0x79fc('0x5d')]['id']){delete _0x3f3e84[_0x79fc('0x5d')]['id'];}return db['SmsAccount'][_0x79fc('0x5b')]({'where':{'id':_0x3f3e84[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x14171c,null))[_0x79fc('0x21')](function(_0x4dda94){if(_0x4dda94){_0x3f3e84[_0x79fc('0x5d')]['SmsAccountId']=_0x4dda94['id'];return db[_0x79fc('0x66')][_0x79fc('0x5c')](_0x3f3e84[_0x79fc('0x5d')]);}})[_0x79fc('0x21')](respondWithResult(_0x14171c,null))[_0x79fc('0x2a')](handleError(_0x14171c,null));};exports[_0x79fc('0x67')]=function(_0x5703d9,_0x27ad9f,_0x454132){var _0x2efa1c={'raw':![],'where':{}};var _0x106c7b={};var _0x5474c2={'count':0x0,'rows':[]};return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x5703d9[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x27ad9f,null))[_0x79fc('0x21')](function(_0x36eb81){if(_0x36eb81){_0x106c7b[_0x79fc('0x42')]=_[_0x79fc('0x59')](db['Disposition'][_0x79fc('0x5a')]);_0x106c7b[_0x79fc('0x43')]=_['keys'](_0x5703d9[_0x79fc('0x43')]);_0x106c7b[_0x79fc('0x44')]=_[_0x79fc('0x45')](_0x106c7b[_0x79fc('0x42')],_0x106c7b[_0x79fc('0x43')]);_0x2efa1c[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0x106c7b[_0x79fc('0x42')],qs['fields'](_0x5703d9[_0x79fc('0x43')]['fields']));_0x2efa1c[_0x79fc('0x47')]=_0x2efa1c[_0x79fc('0x47')][_0x79fc('0x48')]?_0x2efa1c[_0x79fc('0x47')]:_0x106c7b[_0x79fc('0x42')];if(!_0x5703d9[_0x79fc('0x43')][_0x79fc('0x49')](_0x79fc('0x69'))){_0x2efa1c[_0x79fc('0x2e')]=qs[_0x79fc('0x2e')](_0x5703d9[_0x79fc('0x43')]['limit']);_0x2efa1c['offset']=qs[_0x79fc('0x31')](_0x5703d9['query']['offset']);}_0x2efa1c['order']=qs[_0x79fc('0x4a')](_0x5703d9[_0x79fc('0x43')]['sort']);_0x2efa1c['where']=qs[_0x79fc('0x44')](_[_0x79fc('0x4c')](_0x5703d9[_0x79fc('0x43')],_0x106c7b[_0x79fc('0x44')]));_0x2efa1c[_0x79fc('0x4b')][_0x79fc('0x6a')]=_0x36eb81['id'];if(_0x5703d9[_0x79fc('0x43')][_0x79fc('0x4d')]){_0x2efa1c[_0x79fc('0x4b')]=_[_0x79fc('0x4e')](_0x2efa1c[_0x79fc('0x4b')],{'$or':_[_0x79fc('0x3e')](_0x2efa1c[_0x79fc('0x47')],function(_0x70876f){var _0x2db873={};_0x2db873[_0x70876f]={'$like':'%'+_0x5703d9[_0x79fc('0x43')][_0x79fc('0x4d')]+'%'};return _0x2db873;})});}_0x2efa1c=_[_0x79fc('0x4e')]({},_0x2efa1c,_0x5703d9[_0x79fc('0x4f')]);return db['Disposition']['count']({'where':_0x2efa1c[_0x79fc('0x4b')]})['then'](function(_0x22755f){_0x5474c2[_0x79fc('0x30')]=_0x22755f;if(_0x5703d9[_0x79fc('0x43')][_0x79fc('0x51')]){_0x2efa1c[_0x79fc('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2efa1c);})[_0x79fc('0x21')](function(_0x283eb1){_0x5474c2['rows']=_0x283eb1;return _0x5474c2;});}})[_0x79fc('0x21')](respondWithFilteredResult(_0x27ad9f,_0x2efa1c))[_0x79fc('0x2a')](handleError(_0x27ad9f,null));};exports[_0x79fc('0x6b')]=function(_0x529b9f,_0x571fc8,_0x1564aa){return db['SmsAccount']['find']({'where':{'id':_0x529b9f[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x571fc8,null))[_0x79fc('0x21')](function(_0xc1b128){if(_0xc1b128){return _0xc1b128[_0x79fc('0x6b')](_0x529b9f[_0x79fc('0x43')][_0x79fc('0x6c')]);}})[_0x79fc('0x21')](respondWithStatusCode(_0x571fc8,null))['catch'](handleError(_0x571fc8,null));};exports[_0x79fc('0x6d')]=function(_0x5a00f8,_0x4e6d9d,_0xb53b19){if(_0x5a00f8['body']['id']){delete _0x5a00f8['body']['id'];}return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x5a00f8[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x4e6d9d,null))[_0x79fc('0x21')](function(_0x442009){if(_0x442009){_0x5a00f8[_0x79fc('0x5d')][_0x79fc('0x6a')]=_0x442009['id'];return db['CannedAnswer'][_0x79fc('0x5c')](_0x5a00f8[_0x79fc('0x5d')]);}})[_0x79fc('0x21')](respondWithResult(_0x4e6d9d,null))[_0x79fc('0x2a')](handleError(_0x4e6d9d,null));};exports['getAnswers']=function(_0x15869a,_0xefbb83,_0x191561){var _0x14ae78={'raw':![],'where':{}};var _0x3de755={};var _0x2c8030={'count':0x0,'rows':[]};return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x15869a[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0xefbb83,null))[_0x79fc('0x21')](function(_0x2dca8b){if(_0x2dca8b){_0x3de755[_0x79fc('0x42')]=_[_0x79fc('0x59')](db[_0x79fc('0x6e')]['rawAttributes']);_0x3de755[_0x79fc('0x43')]=_[_0x79fc('0x59')](_0x15869a[_0x79fc('0x43')]);_0x3de755[_0x79fc('0x44')]=_[_0x79fc('0x45')](_0x3de755['model'],_0x3de755[_0x79fc('0x43')]);_0x14ae78[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0x3de755[_0x79fc('0x42')],qs[_0x79fc('0x46')](_0x15869a[_0x79fc('0x43')][_0x79fc('0x46')]));_0x14ae78[_0x79fc('0x47')]=_0x14ae78[_0x79fc('0x47')][_0x79fc('0x48')]?_0x14ae78[_0x79fc('0x47')]:_0x3de755['model'];if(!_0x15869a['query'][_0x79fc('0x49')]('nolimit')){_0x14ae78[_0x79fc('0x2e')]=qs[_0x79fc('0x2e')](_0x15869a[_0x79fc('0x43')][_0x79fc('0x2e')]);_0x14ae78[_0x79fc('0x31')]=qs[_0x79fc('0x31')](_0x15869a[_0x79fc('0x43')]['offset']);}_0x14ae78['order']=qs[_0x79fc('0x4a')](_0x15869a['query'][_0x79fc('0x4a')]);_0x14ae78['where']=qs[_0x79fc('0x44')](_[_0x79fc('0x4c')](_0x15869a[_0x79fc('0x43')],_0x3de755[_0x79fc('0x44')]));_0x14ae78['where']['SmsAccountId']=_0x2dca8b['id'];if(_0x15869a[_0x79fc('0x43')][_0x79fc('0x4d')]){_0x14ae78['where']=_['merge'](_0x14ae78[_0x79fc('0x4b')],{'$or':_[_0x79fc('0x3e')](_0x14ae78[_0x79fc('0x47')],function(_0x127cc3){var _0x10e561={};_0x10e561[_0x127cc3]={'$like':'%'+_0x15869a['query'][_0x79fc('0x4d')]+'%'};return _0x10e561;})});}_0x14ae78=_[_0x79fc('0x4e')]({},_0x14ae78,_0x15869a[_0x79fc('0x4f')]);return db[_0x79fc('0x6e')][_0x79fc('0x30')]({'where':_0x14ae78[_0x79fc('0x4b')]})[_0x79fc('0x21')](function(_0x2b7499){_0x2c8030[_0x79fc('0x30')]=_0x2b7499;if(_0x15869a[_0x79fc('0x43')][_0x79fc('0x51')]){_0x14ae78[_0x79fc('0x52')]=[{'all':!![]}];}return db[_0x79fc('0x6e')][_0x79fc('0x53')](_0x14ae78);})['then'](function(_0x26309a){_0x2c8030['rows']=_0x26309a;return _0x2c8030;});}})['then'](respondWithFilteredResult(_0xefbb83,_0x14ae78))[_0x79fc('0x2a')](handleError(_0xefbb83,null));};exports['removeAnswers']=function(_0x36ba8f,_0x51daac,_0x155011){return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x36ba8f['params']['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x51daac,null))[_0x79fc('0x21')](function(_0x16fd2e){if(_0x16fd2e){return _0x16fd2e[_0x79fc('0x6f')](_0x36ba8f[_0x79fc('0x43')][_0x79fc('0x6c')]);}})[_0x79fc('0x21')](respondWithStatusCode(_0x51daac,null))[_0x79fc('0x2a')](handleError(_0x51daac,null));};exports[_0x79fc('0x70')]=function(_0x1272e1,_0x349924,_0x51bc2f){var _0x3516ff={'channel':_0x79fc('0x71')};var _0x21453a=[];var _0x58b38c=[];var _0x599ff0={};return db['SmsAccount'][_0x79fc('0x5b')]({'where':{'id':_0x1272e1[_0x79fc('0x56')]['id']},'include':[{'model':db[_0x79fc('0x72')],'as':'Applications'}]})[_0x79fc('0x21')](handleEntityNotFound(_0x349924,null))[_0x79fc('0x21')](function(_0x245ffd){_0x3516ff[_0x79fc('0x73')]=_0x245ffd;_0x3516ff['applications']=_[_0x79fc('0x74')](_0x245ffd[_0x79fc('0x75')],['priority'],['asc']);if(_0x3516ff[_0x79fc('0x73')][_0x79fc('0x75')]){delete _0x3516ff[_0x79fc('0x73')]['Applications'];}return db[_0x79fc('0x76')][_0x79fc('0x64')]();})[_0x79fc('0x21')](function(_0x1830b2){if(!_0x1830b2){throw new db['Sequelize'][(_0x79fc('0x77'))]('no\x20available\x20attributes');}_0x21453a=_[_0x79fc('0x78')](_[_0x79fc('0x59')](_0x1830b2),[_0x79fc('0x79'),'updatedAt']);_0x58b38c=_[_0x79fc('0x78')](_[_0x79fc('0x59')](_0x1830b2),['createdAt',_0x79fc('0x7a'),_0x79fc('0x7b'),_0x79fc('0x7c')]);_0x3516ff[_0x79fc('0x5d')]={'mapKey':_0x79fc('0x7d')};if(_0x3516ff[_0x79fc('0x73')][_0x79fc('0x40')]){switch(_0x3516ff['account'][_0x79fc('0x40')]){case _0x79fc('0x7e'):_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1['body'][_0x79fc('0x80')];_0x3516ff[_0x79fc('0x5d')]['body']=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x81')];_0x3516ff[_0x79fc('0x5d')]['messageId']=_0x1272e1['body']['MessageSid'];break;case _0x79fc('0x82'):_0x3516ff[_0x79fc('0x5d')]['from']='+'+_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x83')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x84')];break;case _0x79fc('0x85'):_0x3516ff[_0x79fc('0x5d')]['from']=_0x1272e1['body'][_0x79fc('0x7f')];_0x3516ff['body']['body']=_0x1272e1['body'][_0x79fc('0x29')];break;case _0x79fc('0x86'):_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1['body'][_0x79fc('0x7f')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1['body']['body'];_0x3516ff[_0x79fc('0x5d')]['messageId']=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x87')];break;case'plivo':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x80')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1['body'][_0x79fc('0x88')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x89')]=_0x1272e1['body'][_0x79fc('0x8a')];break;case _0x79fc('0x8b'):_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]='+'+_0x1272e1[_0x79fc('0x5d')]['results'][0x0]['from'];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x8c')][0x0][_0x79fc('0x84')];_0x3516ff[_0x79fc('0x5d')]['messageId']=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x8c')][0x0][_0x79fc('0x89')];break;case'csc':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1['body'][_0x79fc('0x8d')];_0x3516ff['body'][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x8e')][_0x79fc('0x29')];break;case _0x79fc('0x8f'):_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x90')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x84')];_0x3516ff['body'][_0x79fc('0x89')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x91')];break;case'bandwidth':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x89')]=_0x1272e1['body'][0x0][_0x79fc('0x29')]['id'];_0x3516ff[_0x79fc('0x5d')]['from']=_0x1272e1[_0x79fc('0x5d')][0x0][_0x79fc('0x29')][_0x79fc('0x7f')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')][0x0]['message']['text'];break;case'intelepeer':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')]=_0x1272e1[_0x79fc('0x5d')][_0x79fc('0x7f')];_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]=_0x1272e1[_0x79fc('0x5d')]['message'];_0x3516ff['body'][_0x79fc('0x89')]=_0x1272e1['body'][_0x79fc('0x92')];break;}}if(_0x3516ff[_0x79fc('0x5d')]['id']){delete _0x3516ff[_0x79fc('0x5d')]['id'];}if(_[_0x79fc('0x93')](_0x3516ff[_0x79fc('0x5d')]['from'])){throw new db[(_0x79fc('0x94'))][(_0x79fc('0x77'))](_0x79fc('0x95'));}if(_[_0x79fc('0x93')](_0x3516ff[_0x79fc('0x5d')]['body'])||_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')]===''){throw new db[(_0x79fc('0x94'))][(_0x79fc('0x77'))](_0x79fc('0x96'));}if(_['isNil'](_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x97')])){throw new db[(_0x79fc('0x94'))][(_0x79fc('0x77'))](_0x79fc('0x98')+_0x58b38c);}if(!_[_0x79fc('0x99')](_0x58b38c,_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x97')])){throw new db['Sequelize'][(_0x79fc('0x77'))](_0x79fc('0x9a')+_0x58b38c);}_0x599ff0[_0x3516ff[_0x79fc('0x5d')]['mapKey']]=_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')];return db[_0x79fc('0x9b')][_0x79fc('0x5b')]({'where':{'id':_0x3516ff['account']['ListId']},'include':[{'model':db[_0x79fc('0x76')],'as':_0x79fc('0x9c'),'where':_0x599ff0,'limit':0x1,'order':[[_0x79fc('0x7a'),_0x79fc('0x9d')]]}]});})[_0x79fc('0x21')](handleEntityNotFound(_0x349924,null))[_0x79fc('0x21')](function(_0x1dd1fd){if(_0x1dd1fd){_0x3516ff[_0x79fc('0x9e')]=_[_0x79fc('0x9f')](_0x1dd1fd,[_0x79fc('0x9c')]);if(_0x1dd1fd['Contacts'][_0x79fc('0x48')]){return _0x1dd1fd['Contacts'][0x0];}var _0x234ff7=_['defaults'](_0x3516ff['body'],{'firstName':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')],'ListId':_0x1dd1fd['id']});_0x234ff7[_0x3516ff[_0x79fc('0x5d')]['mapKey']]=_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')];return db[_0x79fc('0x76')][_0x79fc('0x5c')](_0x234ff7,{'fields':_0x21453a,'raw':!![]});}})['then'](handleEntityNotFound(_0x349924,null))[_0x79fc('0x21')](function(_0x14fec8){if(_0x14fec8){_0x3516ff[_0x79fc('0xa0')]=_0x14fec8;var _0x2288ad={'ContactId':_0x14fec8['id'],'phone':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x7f')],'SmsAccountId':_0x1272e1['params']['id']};var _0x3c0fdb={'ContactId':_0x14fec8['id'],'SmsAccountId':_0x1272e1[_0x79fc('0x56')]['id'],'closed':![]};return db[_0x79fc('0xa1')][_0x79fc('0x5b')]({'where':_0x3c0fdb})[_0x79fc('0x21')](function(_0x62fba9){if(_0x62fba9){return[_0x62fba9,![]];}return db['SmsInteraction'][_0x79fc('0x5c')](_0x2288ad)[_0x79fc('0x21')](function(_0x4bb917){return[_0x4bb917,!![]];});});}})[_0x79fc('0xa2')](function(_0x288330,_0x506a02){_0x3516ff['interaction']=_0x288330[_0x79fc('0x38')]({'plain':!![]});_0x3516ff[_0x79fc('0xa3')]['created']=![];if(_0x506a02){if(_0x3516ff['account'][_0x79fc('0xa4')]){_0x3516ff['applications']['push']({'id':0x0,'priority':_0x3516ff[_0x79fc('0xa5')][_0x79fc('0x48')]+0x1,'app':_0x79fc('0xa6'),'appdata':'unmanaged','interval':_0x79fc('0xa7')});}_0x3516ff[_0x79fc('0xa3')]['created']=!![];}return db[_0x79fc('0xa8')]['create']({'phone':_0x3516ff['body'][_0x79fc('0x7f')],'messageId':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x89')],'body':_0x3516ff[_0x79fc('0x5d')][_0x79fc('0x5d')],'SmsAccountId':_0x1272e1[_0x79fc('0x56')]['id'],'SmsInteractionId':_0x288330['id'],'direction':'in','ContactId':_0x288330[_0x79fc('0xa9')],'AttachmentId':_0x3516ff[_0x79fc('0x5d')]['AttachmentId']});})[_0x79fc('0x21')](function(_0x415dcb){_0x3516ff['message']=_0x415dcb;if(!_0x3516ff[_0x79fc('0xa3')][_0x79fc('0xaa')])return;return db[_0x79fc('0xab')][_0x79fc('0x5b')]({'attributes':['id',_0x79fc('0x3b')],'where':{'id':_0x3516ff['interaction'][_0x79fc('0xaa')]}});})['then'](function(_0x3b0a1d){if(_0x3b0a1d){_0x3516ff[_0x79fc('0xa5')][_0x79fc('0xac')]({'id':0x0,'priority':0x0,'app':_0x79fc('0xad'),'appdata':_0x3b0a1d[_0x79fc('0x3b')]+','+(_0x3516ff['account'][_0x79fc('0xae')]||0xa),'interval':_0x79fc('0xa7')});}if(!_0x3516ff[_0x79fc('0xa3')][_0x79fc('0xaf')])return;return db[_0x79fc('0xb0')][_0x79fc('0x5b')]({'attributes':['id',_0x79fc('0x3b')],'where':{'id':_0x3516ff['interaction'][_0x79fc('0xaf')]}});})[_0x79fc('0x21')](function(_0x126872){if(_0x126872){_0x3516ff[_0x79fc('0xa5')][_0x79fc('0xac')]({'id':0x0,'priority':0x1,'app':_0x79fc('0xb1'),'appdata':_0x126872[_0x79fc('0x3b')]+','+(_0x3516ff[_0x79fc('0x73')][_0x79fc('0xb2')]||0x12c),'interval':_0x79fc('0xa7')});}return respondWithRpcPromise(_0x79fc('0xb3'),'startRouting',_0x3516ff);})['then'](function(_0x9cb23b){if(_0x9cb23b){var _0x5401b7=0xc8;var _0x1b7266=_0x79fc('0xb4');logger[_0x79fc('0x22')](_0x79fc('0x24'),_0x1b7266,_0x5401b7,'entity\x20found');logger[_0x79fc('0xb5')](_0x79fc('0xb6'),_0x1b7266,_0x5401b7,_0x79fc('0xb7'),JSON['stringify'](_0x9cb23b));if(_0x3516ff[_0x79fc('0x73')][_0x79fc('0x40')]===_0x79fc('0x7e')){return _0x349924[_0x79fc('0x2c')](_0x5401b7)[_0x79fc('0x32')](_0x79fc('0xb8'),'text/xml')[_0x79fc('0x3c')](_0x79fc('0xb9'));}else{return _0x349924[_0x79fc('0x2c')](_0x5401b7)[_0x79fc('0x34')](_0x9cb23b);}}})[_0x79fc('0x2a')](handleError(_0x349924,null));};exports[_0x79fc('0xba')]=function(_0x1e6383,_0x5952aa){var _0x45bdd6=_0x1e6383[_0x79fc('0x56')]['id'];var _0x50638d=_0x1e6383[_0x79fc('0x5d')];var _0x1cc207=0xc8;var _0x4b4dfe=null;return db[_0x79fc('0xbb')][_0x79fc('0xbc')]({'isolationLevel':db['sequelize'][_0x79fc('0xbd')]['ISOLATION_LEVELS'][_0x79fc('0xbe')]},function(_0x53273a){return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x45bdd6},'transaction':_0x53273a})[_0x79fc('0x21')](function(_0x243887){if(_0x243887){return db[_0x79fc('0x72')]['destroy']({'where':{'SmsAccountId':_0x45bdd6},'transaction':_0x53273a})[_0x79fc('0x21')](function(){var _0x11863e=_[_0x79fc('0x3e')](_0x50638d,function(_0x16d2a6){_0x16d2a6[_0x79fc('0x6a')]=_0x45bdd6;return _0x16d2a6;});return db[_0x79fc('0x72')][_0x79fc('0xbf')](_0x11863e,{'transaction':_0x53273a});});}else{_0x1cc207=0x194;_0x4b4dfe=[];}});})[_0x79fc('0x21')](function(){if(_0x1cc207!==0x194){return db['SmsApplication'][_0x79fc('0xc0')]({'where':{'SmsAccountId':_0x45bdd6},'order':_0x79fc('0xc1')})['then'](function(_0x12554b){_0x4b4dfe=_0x12554b;});}})[_0x79fc('0x2a')](function(_0x199b2b){_0x1cc207=0x1f4;logger[_0x79fc('0x27')](_0x199b2b['stack']);if(_0x199b2b[_0x79fc('0x3b')]){delete _0x199b2b['name'];}_0x4b4dfe=_0x199b2b;})[_0x79fc('0xc2')](function(){if(_0x4b4dfe===null){_0x5952aa[_0x79fc('0x2b')](_0x1cc207);}else{if(_0x1cc207===0x1f4){_0x5952aa[_0x79fc('0x2c')](_0x1cc207)['send'](_0x4b4dfe);}else{_0x5952aa[_0x79fc('0x2c')](_0x1cc207)[_0x79fc('0x34')](_0x4b4dfe);}}});};exports[_0x79fc('0xc3')]=function(_0x3b734d,_0x43c02b,_0x5c8d13){var _0x265ea7={};var _0x1f1100={};var _0x35a347;var _0x1a0908;return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x3b734d[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x43c02b,null))[_0x79fc('0x21')](function(_0x22673f){if(_0x22673f){_0x35a347=_0x22673f;_0x1f1100[_0x79fc('0x42')]=_[_0x79fc('0x59')](db[_0x79fc('0x72')][_0x79fc('0x5a')]);_0x1f1100[_0x79fc('0x43')]=_[_0x79fc('0x59')](_0x3b734d[_0x79fc('0x43')]);_0x1f1100[_0x79fc('0x44')]=_['intersection'](_0x1f1100[_0x79fc('0x42')],_0x1f1100[_0x79fc('0x43')]);_0x265ea7[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0x1f1100['model'],qs[_0x79fc('0x46')](_0x3b734d[_0x79fc('0x43')][_0x79fc('0x46')]));_0x265ea7[_0x79fc('0x47')]=_0x265ea7[_0x79fc('0x47')]['length']?_0x265ea7[_0x79fc('0x47')]:_0x1f1100[_0x79fc('0x42')];_0x265ea7[_0x79fc('0xc4')]=qs[_0x79fc('0x4a')](_0x3b734d[_0x79fc('0x43')][_0x79fc('0x4a')]);_0x265ea7[_0x79fc('0x4b')]=qs[_0x79fc('0x44')](_['pick'](_0x3b734d[_0x79fc('0x43')],_0x1f1100[_0x79fc('0x44')]));if(_0x3b734d[_0x79fc('0x43')]['filter']){_0x265ea7[_0x79fc('0x4b')]=_[_0x79fc('0x4e')](_0x265ea7[_0x79fc('0x4b')],{'$or':_['map'](_0x265ea7[_0x79fc('0x47')],function(_0x2b499f){var _0x78f868={};_0x78f868[_0x2b499f]={'$like':'%'+_0x3b734d[_0x79fc('0x43')][_0x79fc('0x4d')]+'%'};return _0x78f868;})});}_0x265ea7=_['merge']({},_0x265ea7,_0x3b734d[_0x79fc('0x4f')]);return _0x35a347[_0x79fc('0xc3')](_0x265ea7);}})[_0x79fc('0x21')](function(_0x32921a){if(_0x32921a){_0x1a0908=_0x32921a[_0x79fc('0x48')];if(!_0x3b734d[_0x79fc('0x43')]['hasOwnProperty']('nolimit')){_0x265ea7[_0x79fc('0x2e')]=qs[_0x79fc('0x2e')](_0x3b734d['query'][_0x79fc('0x2e')]);_0x265ea7[_0x79fc('0x31')]=qs[_0x79fc('0x31')](_0x3b734d[_0x79fc('0x43')][_0x79fc('0x31')]);}return _0x35a347[_0x79fc('0xc3')](_0x265ea7);}})[_0x79fc('0x21')](function(_0x3fc187){if(_0x3fc187){return _0x3fc187?{'count':_0x1a0908,'rows':_0x3fc187}:null;}})['then'](respondWithResult(_0x43c02b,null))[_0x79fc('0x2a')](handleError(_0x43c02b,null));};exports[_0x79fc('0xc5')]=function(_0x3b5b40,_0x5093cb,_0x2cb46e){var _0x10f128={'raw':![],'where':{}};var _0x466f0f={};var _0x12e9f0={'count':0x0,'rows':[]};return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x3b5b40[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x5093cb,null))[_0x79fc('0x21')](function(_0x49cf75){if(_0x49cf75){_0x466f0f[_0x79fc('0x42')]=_[_0x79fc('0x59')](db[_0x79fc('0xa1')][_0x79fc('0x5a')]);_0x466f0f[_0x79fc('0x43')]=_[_0x79fc('0x59')](_0x3b5b40[_0x79fc('0x43')]);_0x466f0f[_0x79fc('0x44')]=_['intersection'](_0x466f0f['model'],_0x466f0f[_0x79fc('0x43')]);_0x10f128[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0x466f0f[_0x79fc('0x42')],qs[_0x79fc('0x46')](_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x46')]));_0x10f128['attributes']=_0x10f128[_0x79fc('0x47')]['length']?_0x10f128[_0x79fc('0x47')]:_0x466f0f[_0x79fc('0x42')];if(!_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x49')](_0x79fc('0x69'))){_0x10f128[_0x79fc('0x2e')]=qs['limit'](_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x2e')]);_0x10f128[_0x79fc('0x31')]=qs[_0x79fc('0x31')](_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x31')]);}_0x10f128['order']=qs[_0x79fc('0x4a')](_0x3b5b40['query'][_0x79fc('0x4a')]);_0x10f128[_0x79fc('0x4b')]=qs[_0x79fc('0x44')](_[_0x79fc('0x4c')](_0x3b5b40[_0x79fc('0x43')],_0x466f0f[_0x79fc('0x44')]));_0x10f128[_0x79fc('0x4b')][_0x79fc('0x6a')]=_0x49cf75['id'];if(_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x4d')]){_0x10f128['where']=_[_0x79fc('0x4e')](_0x10f128['where'],{'$or':_[_0x79fc('0x3e')](_0x10f128[_0x79fc('0x47')],function(_0x5713bc){var _0x16a3ec={};_0x16a3ec[_0x5713bc]={'$like':'%'+_0x3b5b40[_0x79fc('0x43')][_0x79fc('0x4d')]+'%'};return _0x16a3ec;})});}_0x10f128=_[_0x79fc('0x4e')]({},_0x10f128,_0x3b5b40[_0x79fc('0x4f')]);return db[_0x79fc('0xa1')][_0x79fc('0x30')]({'where':_0x10f128[_0x79fc('0x4b')]})['then'](function(_0x52861e){_0x12e9f0[_0x79fc('0x30')]=_0x52861e;if(_0x3b5b40['query'][_0x79fc('0x51')]){_0x10f128[_0x79fc('0x52')]=[{'model':db[_0x79fc('0x76')],'as':_0x79fc('0xc6'),'required':![]},{'model':db[_0x79fc('0xab')],'as':_0x79fc('0xc7'),'attributes':[_0x79fc('0x3b'),_0x79fc('0xc8'),_0x79fc('0xc9')],'required':![]},{'model':db[_0x79fc('0xca')],'as':_0x79fc('0xcb'),'attributes':['id',_0x79fc('0x3b'),'color'],'where':_0x3b5b40[_0x79fc('0x43')][_0x79fc('0xcc')]?{'id':_0x3b5b40[_0x79fc('0x43')][_0x79fc('0xcc')]}:undefined,'required':_0x3b5b40[_0x79fc('0x43')][_0x79fc('0xcc')]?!![]:![]}];}return db[_0x79fc('0xa1')]['findAll'](_0x10f128);})[_0x79fc('0x21')](function(_0x5f5480){_0x12e9f0[_0x79fc('0x54')]=_0x5f5480;return _0x12e9f0;});}})['then'](respondWithFilteredResult(_0x5093cb,_0x10f128))[_0x79fc('0x2a')](handleError(_0x5093cb,null));};exports[_0x79fc('0x3c')]=function(_0x302b98,_0x505cda,_0x3505a4){var _0x3d7f62,_0x2246cb,_0x300ebd;if(_[_0x79fc('0x93')](_0x302b98[_0x79fc('0x5d')]['body'])||_0x302b98[_0x79fc('0x5d')]['body']===''){throw new db['Sequelize'][(_0x79fc('0x77'))](_0x79fc('0x96'));}if(_[_0x79fc('0x93')](_0x302b98[_0x79fc('0x5d')]['to'])){throw new db[(_0x79fc('0x94'))]['ValidationError'](_0x79fc('0xcd'));}_0x3d7f62=_0x302b98[_0x79fc('0x5d')]['to'];return db[_0x79fc('0x50')]['find']({'where':{'id':_0x302b98[_0x79fc('0x56')]['id']},'include':[{'model':db[_0x79fc('0x9b')],'as':'List','include':[{'model':db[_0x79fc('0x76')],'as':_0x79fc('0x9c'),'where':{'mobile':_0x3d7f62},'limit':0x1,'order':[[_0x79fc('0x7a'),_0x79fc('0x9d')]]}]}]})[_0x79fc('0x21')](handleEntityNotFound(_0x505cda,null))[_0x79fc('0x21')](function(_0x3f2fa7){if(_0x3f2fa7&&_0x3f2fa7[_0x79fc('0xce')]){_0x2246cb=_0x3f2fa7[_0x79fc('0x38')]({'plain':!![]});if(_0x2246cb['List']&&_0x2246cb[_0x79fc('0xce')]['Contacts'][_0x79fc('0x48')]){return _0x2246cb[_0x79fc('0xce')]['Contacts'][0x0];}return db[_0x79fc('0x76')][_0x79fc('0x5c')](_[_0x79fc('0xcf')](_0x302b98[_0x79fc('0x5d')],{'firstName':_0x3d7f62,'mobile':_0x3d7f62,'phone':_0x3d7f62,'ListId':_0x2246cb[_0x79fc('0x7c')]}));}})[_0x79fc('0x21')](handleEntityNotFound(_0x505cda,null))[_0x79fc('0x21')](function(_0x54fe08){if(_0x54fe08){_0x300ebd=_0x54fe08;return db[_0x79fc('0xa1')]['find']({'where':{'ContactId':_0x300ebd['id'],'closed':![],'SmsAccountId':_0x2246cb['id']}})[_0x79fc('0x21')](function(_0x41c414){if(_0x41c414){return[_0x41c414,![]];}return db[_0x79fc('0xa1')][_0x79fc('0x5c')]({'UserId':_0x302b98['user']['id'],'ContactId':_0x300ebd['id'],'SmsAccountId':_0x2246cb['id'],'phone':_0x3d7f62,'firstMsgDirection':'out','Messages':[_[_0x79fc('0x4e')](_0x302b98[_0x79fc('0x5d')],{'read':![],'body':_0x302b98[_0x79fc('0x5d')][_0x79fc('0x5d')],'phone':_0x3d7f62,'SmsAccountId':_0x2246cb['id'],'UserId':_0x302b98[_0x79fc('0xd0')]['id'],'ContactId':_0x300ebd['id']})]},{'include':[{'model':db[_0x79fc('0xa8')],'as':'Messages'}]})[_0x79fc('0x21')](function(_0x4a68ca){return[_0x4a68ca,!![]];});});}})[_0x79fc('0xa2')](function(_0x523d6c,_0x558c41){if(_0x558c41){return _0x523d6c;}return db[_0x79fc('0xa8')][_0x79fc('0x5c')](_['merge'](_0x302b98[_0x79fc('0x5d')],{'read':![],'body':_0x302b98[_0x79fc('0x5d')][_0x79fc('0x5d')],'phone':_0x3d7f62,'SmsAccountId':_0x2246cb['id'],'SmsInteractionId':_0x523d6c['id'],'UserId':_0x302b98['user']['id'],'ContactId':_0x300ebd['id']}))['then'](function(_0x3b5ffb){_0x523d6c[_0x79fc('0xd1')]['Messages']=[];_0x523d6c[_0x79fc('0xd1')]['Messages'][_0x79fc('0xd2')](_0x3b5ffb['dataValues']);return _0x523d6c;});})['then'](respondWithResult(_0x505cda,null))[_0x79fc('0x2a')](handleError(_0x505cda,null));};exports[_0x79fc('0x2c')]=function(_0x595ad1,_0x49ff1c,_0x47db5f){if(_0x595ad1[_0x79fc('0x5d')]['id']){delete _0x595ad1[_0x79fc('0x5d')]['id'];}var _0x2ff38b,_0x4d86a7,_0x27c93b;return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x595ad1[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x49ff1c,null))[_0x79fc('0x21')](function(_0x50ceb9){if(_0x50ceb9){_0x27c93b=_0x50ceb9;logger[_0x79fc('0xb5')](_0x79fc('0x24'),_0x79fc('0x2c'),'received\x20delivery\x20report\x20from',_0x50ceb9['type'],util[_0x79fc('0xd3')](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));switch(_0x50ceb9['type']){case _0x79fc('0x82'):if(_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xd4')]&&_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x2c')]){_0x4d86a7=_0x595ad1['body'][_0x79fc('0x2c')];return db[_0x79fc('0xa8')][_0x79fc('0x5b')]({'where':{'messageId':_0x595ad1['body']['skebby_dispatch_id']}});}break;case _0x79fc('0x85'):if(_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xd5')]&&_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xd6')]){_0x4d86a7=_0x595ad1[_0x79fc('0x5d')]['statusInt'];return db[_0x79fc('0xa8')][_0x79fc('0x5b')]({'where':{'messageId':_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xd5')]}});}break;case _0x79fc('0x86'):if(_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x87')]&&_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xd7')]){_0x4d86a7=_0x595ad1['body'][_0x79fc('0xd7')];return db[_0x79fc('0xa8')][_0x79fc('0x5b')]({'where':{'messageId':_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x87')]}});}break;case _0x79fc('0x8b'):var _0x49bc2b=_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x8c')][0x0];if(_0x49bc2b[_0x79fc('0x89')]&&_0x49bc2b['status'][_0x79fc('0xd8')]===_0x79fc('0xd9')){_0x4d86a7=_0x49bc2b[_0x79fc('0x2c')][_0x79fc('0xd8')];return db[_0x79fc('0xa8')][_0x79fc('0x5b')]({'where':{'messageId':_0x49bc2b[_0x79fc('0x89')]}});}break;case _0x79fc('0x8f'):if(_0x595ad1['body'][_0x79fc('0x89')]&&_0x595ad1['body'][_0x79fc('0x2c')]){_0x4d86a7=_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x2c')];return db[_0x79fc('0xa8')]['find']({'where':{'messageId':_0x595ad1['body'][_0x79fc('0x89')]}});}break;case _0x79fc('0xda'):if(_0x595ad1[_0x79fc('0x5d')][0x0][_0x79fc('0x29')]['id']){_0x4d86a7=_0x595ad1[_0x79fc('0x5d')][0x0]['type'];return db[_0x79fc('0xa8')]['find']({'where':{'messageId':_0x595ad1[_0x79fc('0x5d')][0x0][_0x79fc('0x29')]['id']}});}break;case _0x79fc('0xdb'):if(_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xdc')]&&_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x2c')]){_0x4d86a7=_0x595ad1[_0x79fc('0x5d')][_0x79fc('0x2c')];return db['SmsMessage'][_0x79fc('0x5b')]({'where':{'messageId':_0x595ad1[_0x79fc('0x5d')][_0x79fc('0xdc')]}});}break;}}})[_0x79fc('0x21')](handleEntityNotFound(_0x49ff1c,null))[_0x79fc('0x21')](function(_0x1321ba){if(_0x1321ba){_0x2ff38b=_0x1321ba;switch(_0x27c93b['type']){case'skebby':if(_0x4d86a7==='DELIVERED'){return _0x2ff38b[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util['inspect'](_0x595ad1['body'],{'showHidden':![],'depth':null}));}break;case _0x79fc('0x85'):if(_0x4d86a7==='1'){return _0x2ff38b[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')](_0x79fc('0x24'),'status',_0x79fc('0x82'),util['inspect'](_0x595ad1['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x595ad1['body'][_0x79fc('0xdd')]&&_0x4d86a7>=0xc8&&_0x4d86a7<=0xce){return _0x2ff38b[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x79fc('0x2c'),_0x79fc('0x86'),util[_0x79fc('0xd3')](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x79fc('0x8b'):var _0x50505b=_0x595ad1['body'][_0x79fc('0x8c')][0x0];if(_0x50505b[_0x79fc('0x2c')]['groupName']==='DELIVERED'){return _0x2ff38b[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')](_0x79fc('0x24'),_0x79fc('0x2c'),'infobip',util['inspect'](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x79fc('0x8f'):if(_0x4d86a7=='DELIVERED_TO_GATEWAY'||_0x4d86a7==_0x79fc('0xde')){return _0x2ff38b['update']({'read':!![]});}else{logger[_0x79fc('0x27')](_0x79fc('0x24'),_0x79fc('0x2c'),_0x79fc('0x8f'),util[_0x79fc('0xd3')](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x79fc('0xda'):if(_0x4d86a7==_0x79fc('0xdf')){return _0x2ff38b['update']({'read':!![]});}else{logger['error'](_0x79fc('0x24'),_0x79fc('0x2c'),_0x79fc('0xda'),util['inspect'](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x79fc('0xdb'):if(_0x4d86a7===_0x79fc('0xe0')||_0x4d86a7===_0x79fc('0xe1')){return _0x2ff38b[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')](_0x79fc('0x24'),_0x79fc('0x2c'),'intelepeer',util[_0x79fc('0xd3')](_0x595ad1[_0x79fc('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x2ff38b;}})[_0x79fc('0x21')](respondWithResult(_0x49ff1c,null))[_0x79fc('0x2a')](handleError(_0x49ff1c,null));};exports['statusGet']=function(_0x47a343,_0x435f4e,_0x1c3253){var _0x19a0b1,_0x4ad783,_0x53e49f;return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x47a343[_0x79fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x435f4e,null))[_0x79fc('0x21')](function(_0x31fa81){if(_0x31fa81){_0x53e49f=_0x31fa81;logger[_0x79fc('0xb5')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x31fa81[_0x79fc('0x40')],util[_0x79fc('0xd3')](_0x47a343['query'],{'showHidden':![],'depth':null}));switch(_0x31fa81[_0x79fc('0x40')]){case _0x79fc('0xe2'):if(_0x47a343['query']['message-id']&&_0x47a343['query'][_0x79fc('0xe3')]){_0x4ad783=_0x47a343[_0x79fc('0x43')]['state'];return db[_0x79fc('0xa8')][_0x79fc('0x5b')]({'where':{'messageId':_0x47a343['query'][_0x79fc('0xe4')]}});}break;}}})[_0x79fc('0x21')](handleEntityNotFound(_0x435f4e,null))[_0x79fc('0x21')](function(_0x5d173d){if(_0x5d173d){_0x19a0b1=_0x5d173d;switch(_0x53e49f[_0x79fc('0x40')]){case _0x79fc('0xe2'):if(_0x4ad783==='2'||_0x4ad783==='6'){return _0x19a0b1[_0x79fc('0x37')]({'read':!![]});}else{logger[_0x79fc('0x27')](_0x79fc('0x24'),_0x79fc('0x2c'),'csc',util[_0x79fc('0xd3')](_0x47a343[_0x79fc('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x19a0b1;}})['then'](respondWithResult(_0x435f4e,null))['catch'](handleError(_0x435f4e,null));};exports[_0x79fc('0xe5')]=function(_0x5a5296,_0x18cdef,_0x1e1321){return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x5a5296[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x18cdef,null))[_0x79fc('0x21')](function(_0x179afe){if(_0x179afe){return _0x179afe[_0x79fc('0xe5')](_0x5a5296[_0x79fc('0x5d')][_0x79fc('0x6c')],_[_0x79fc('0x9f')](_0x5a5296[_0x79fc('0x5d')],['ids','id'])||{})[_0x79fc('0xa2')](function(_0x20b3ad){for(var _0x5d234e=0x0;_0x5d234e<_0x5a5296['body'][_0x79fc('0x6c')][_0x79fc('0x48')];_0x5d234e+=0x1){socket['emit'](_0x79fc('0xe6'),{'UserId':Number(_0x5a5296[_0x79fc('0x5d')][_0x79fc('0x6c')][_0x5d234e]),'SmsAccountId':Number(_0x5a5296[_0x79fc('0x56')]['id'])});}return _0x20b3ad;});}})[_0x79fc('0x21')](respondWithResult(_0x18cdef,null))[_0x79fc('0x2a')](handleError(_0x18cdef,null));};exports['removeAgents']=function(_0x1fbbac,_0x5f9f17,_0x20e7c6){return db[_0x79fc('0x50')][_0x79fc('0x5b')]({'where':{'id':_0x1fbbac[_0x79fc('0x56')]['id']}})[_0x79fc('0x21')](handleEntityNotFound(_0x5f9f17,null))[_0x79fc('0x21')](function(_0xbacacc){if(_0xbacacc){return _0xbacacc[_0x79fc('0xe7')](_0x1fbbac[_0x79fc('0x43')]['ids'])[_0x79fc('0x21')](function(){if(_[_0x79fc('0xe8')](_0x1fbbac[_0x79fc('0x43')][_0x79fc('0x6c')])){for(var _0x5a7941=0x0;_0x5a7941<_0x1fbbac[_0x79fc('0x43')][_0x79fc('0x6c')]['length'];_0x5a7941+=0x1){socket[_0x79fc('0xe9')](_0x79fc('0xea'),{'UserId':Number(_0x1fbbac[_0x79fc('0x43')][_0x79fc('0x6c')][_0x5a7941]),'SmsAccountId':Number(_0x1fbbac[_0x79fc('0x56')]['id'])});}}else{socket[_0x79fc('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x1fbbac[_0x79fc('0x43')][_0x79fc('0x6c')]),'SmsAccountId':Number(_0x1fbbac[_0x79fc('0x56')]['id'])});}});}})[_0x79fc('0x21')](respondWithStatusCode(_0x5f9f17,null))[_0x79fc('0x2a')](handleError(_0x5f9f17,null));};exports[_0x79fc('0xeb')]=function(_0x2949f9,_0x2a8569,_0x3dc488){var _0x29a9ff={};var _0xca1882={};var _0x16edfe;var _0x3e933a;return db[_0x79fc('0x50')][_0x79fc('0x68')]({'where':{'id':_0x2949f9[_0x79fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a8569,null))[_0x79fc('0x21')](function(_0x2ebad6){if(_0x2ebad6){_0x16edfe=_0x2ebad6;_0xca1882['model']=_[_0x79fc('0x59')](db[_0x79fc('0xab')]['rawAttributes']);_0xca1882['query']=_['keys'](_0x2949f9[_0x79fc('0x43')]);_0xca1882['filters']=_[_0x79fc('0x45')](_0xca1882['model'],_0xca1882[_0x79fc('0x43')]);_0x29a9ff[_0x79fc('0x47')]=_[_0x79fc('0x45')](_0xca1882['model'],qs[_0x79fc('0x46')](_0x2949f9['query']['fields']));_0x29a9ff['attributes']=_0x29a9ff['attributes'][_0x79fc('0x48')]?_0x29a9ff[_0x79fc('0x47')]:_0xca1882['model'];_0x29a9ff[_0x79fc('0xc4')]=qs[_0x79fc('0x4a')](_0x2949f9[_0x79fc('0x43')][_0x79fc('0x4a')]);_0x29a9ff[_0x79fc('0x4b')]=qs[_0x79fc('0x44')](_[_0x79fc('0x4c')](_0x2949f9['query'],_0xca1882['filters']));if(_0x2949f9[_0x79fc('0x43')]['filter']){_0x29a9ff[_0x79fc('0x4b')]=_[_0x79fc('0x4e')](_0x29a9ff[_0x79fc('0x4b')],{'$or':_[_0x79fc('0x3e')](_0x29a9ff['attributes'],function(_0x8c5713){var _0x12aaf4={};_0x12aaf4[_0x8c5713]={'$like':'%'+_0x2949f9[_0x79fc('0x43')][_0x79fc('0x4d')]+'%'};return _0x12aaf4;})});}_0x29a9ff=_[_0x79fc('0x4e')]({},_0x29a9ff,_0x2949f9[_0x79fc('0x4f')]);return _0x16edfe[_0x79fc('0xeb')](_0x29a9ff);}})[_0x79fc('0x21')](function(_0x32fbc6){if(_0x32fbc6){_0x3e933a=_0x32fbc6[_0x79fc('0x48')];if(!_0x2949f9[_0x79fc('0x43')][_0x79fc('0x49')](_0x79fc('0x69'))){_0x29a9ff[_0x79fc('0x2e')]=qs[_0x79fc('0x2e')](_0x2949f9[_0x79fc('0x43')]['limit']);_0x29a9ff['offset']=qs[_0x79fc('0x31')](_0x2949f9[_0x79fc('0x43')]['offset']);}return _0x16edfe[_0x79fc('0xeb')](_0x29a9ff);}})[_0x79fc('0x21')](function(_0x1c77cc){if(_0x1c77cc){return _0x1c77cc?{'count':_0x3e933a,'rows':_0x1c77cc}:null;}})[_0x79fc('0x21')](respondWithResult(_0x2a8569,null))['catch'](handleError(_0x2a8569,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4c52c33..8b83cfd 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 _0xd288=['SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x28517d,_0x4f31fc){var _0x343b90=function(_0x46d397){while(--_0x46d397){_0x28517d['push'](_0x28517d['shift']());}};_0x343b90(++_0x4f31fc);}(_0xd288,0x1af));var _0x8d28=function(_0x4789e7,_0x989575){_0x4789e7=_0x4789e7-0x0;var _0x58c1e3=_0xd288[_0x4789e7];return _0x58c1e3;};'use strict';var EventEmitter=require(_0x8d28('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8d28('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d28('0x2'),'afterUpdate':_0x8d28('0x3'),'afterDestroy':_0x8d28('0x4')};function emitEvent(_0x38ac15){return function(_0x120a51,_0x5d08bf,_0x467260){SmsAccountEvents[_0x8d28('0x5')](_0x38ac15+':'+_0x120a51['id'],_0x120a51);SmsAccountEvents['emit'](_0x38ac15,_0x120a51);_0x467260(null);};}for(var e in events){if(events[_0x8d28('0x6')](e)){var event=events[e];SmsAccount[_0x8d28('0x7')](e,emitEvent(event));}}module[_0x8d28('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xebd4=['update','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2d30a0,_0x3c61a1){var _0x331525=function(_0x485a04){while(--_0x485a04){_0x2d30a0['push'](_0x2d30a0['shift']());}};_0x331525(++_0x3c61a1);}(_0xebd4,0x6c));var _0x4ebd=function(_0x17151c,_0x5ec2e0){_0x17151c=_0x17151c-0x0;var _0x585932=_0xebd4[_0x17151c];return _0x585932;};'use strict';var EventEmitter=require(_0x4ebd('0x0'));var SmsAccount=require(_0x4ebd('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4ebd('0x2')](0x0);var events={'afterCreate':_0x4ebd('0x3'),'afterUpdate':_0x4ebd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54966f){return function(_0x21e932,_0x4ad1ce,_0x4d13b8){SmsAccountEvents[_0x4ebd('0x5')](_0x54966f+':'+_0x21e932['id'],_0x21e932);SmsAccountEvents[_0x4ebd('0x5')](_0x54966f,_0x21e932);_0x4d13b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4ebd('0x6')](e,emitEvent(event));}}module[_0x4ebd('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 61b2746..b786afc 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 _0x7f7d=['moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','../../config/logger','api'];(function(_0x1536c2,_0x17968a){var _0x5cdfaa=function(_0x5273ea){while(--_0x5273ea){_0x1536c2['push'](_0x1536c2['shift']());}};_0x5cdfaa(++_0x17968a);}(_0x7f7d,0xed));var _0xd7f7=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7f7d[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0xd7f7('0x0'));var logger=require(_0xd7f7('0x1'))(_0xd7f7('0x2'));var moment=require(_0xd7f7('0x3'));var BPromise=require(_0xd7f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7f7('0x5'));var rimraf=require(_0xd7f7('0x6'));var config=require(_0xd7f7('0x7'));var attributes=require(_0xd7f7('0x8'));module['exports']=function(_0x24d6e2,_0x929af){return _0x24d6e2[_0xd7f7('0x9')](_0xd7f7('0xa'),attributes,{'tableName':_0xd7f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ba=['./smsAccount.attributes','exports','define','SmsAccount','lodash','util','moment','path','rimraf'];(function(_0x42d45f,_0x5280){var _0x590458=function(_0x16073f){while(--_0x16073f){_0x42d45f['push'](_0x42d45f['shift']());}};_0x590458(++_0x5280);}(_0xb7ba,0x79));var _0xab7b=function(_0x4c2769,_0x42aadd){_0x4c2769=_0x4c2769-0x0;var _0x27bdf9=_0xb7ba[_0x4c2769];return _0x27bdf9;};'use strict';var _=require(_0xab7b('0x0'));var util=require(_0xab7b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xab7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab7b('0x3'));var rimraf=require(_0xab7b('0x4'));var config=require('../../config/environment');var attributes=require(_0xab7b('0x5'));module[_0xab7b('0x6')]=function(_0x534934,_0x456b59){return _0x534934[_0xab7b('0x7')](_0xab7b('0x8'),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 ac829ca..661312c 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 _0x935d=['http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsAccount','find','options','where','include','map','attributes','model','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x43f38a,_0x44c537){var _0x112284=function(_0x12568c){while(--_0x12568c){_0x43f38a['push'](_0x43f38a['shift']());}};_0x112284(++_0x44c537);}(_0x935d,0x1be));var _0xd935=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x935d[_0x28d18d];return _0x470640;};'use strict';var _=require(_0xd935('0x0'));var util=require(_0xd935('0x1'));var moment=require(_0xd935('0x2'));var BPromise=require(_0xd935('0x3'));var rs=require(_0xd935('0x4'));var fs=require('fs');var Redis=require(_0xd935('0x5'));var db=require(_0xd935('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd935('0x7'));var config=require('../../config/environment');var jayson=require(_0xd935('0x8'));var client=jayson[_0xd935('0x9')][_0xd935('0xa')]({'port':0x232a});config[_0xd935('0xb')]=_[_0xd935('0xc')](config['redis'],{'host':_0xd935('0xd'),'port':0x18eb});var socket=require(_0xd935('0xe'))(new Redis(config['redis']));require(_0xd935('0xf'))['register'](socket);function respondWithRpcPromise(_0x5f3e07,_0x2f356e,_0x235fa9){return new BPromise(function(_0x1d50e1,_0x4640fa){return client[_0xd935('0x10')](_0x5f3e07,_0x235fa9)[_0xd935('0x11')](function(_0x2a5194){logger['info'](_0xd935('0x12'),_0x2f356e,_0xd935('0x13'));logger[_0xd935('0x14')](_0xd935('0x15'),_0x2f356e,_0xd935('0x13'),JSON[_0xd935('0x16')](_0x2a5194));if(_0x2a5194[_0xd935('0x17')]){if(_0x2a5194[_0xd935('0x17')][_0xd935('0x18')]===0x1f4){logger[_0xd935('0x17')](_0xd935('0x12'),_0x2f356e,_0x2a5194['error'][_0xd935('0x19')]);return _0x4640fa(_0x2a5194[_0xd935('0x17')]['message']);}logger[_0xd935('0x17')](_0xd935('0x12'),_0x2f356e,_0x2a5194['error'][_0xd935('0x19')]);return _0x1d50e1(_0x2a5194[_0xd935('0x17')][_0xd935('0x19')]);}else{logger[_0xd935('0x1a')](_0xd935('0x12'),_0x2f356e,'request\x20sent');_0x1d50e1(_0x2a5194[_0xd935('0x1b')][_0xd935('0x19')]);}})[_0xd935('0x1c')](function(_0x2fa105){logger[_0xd935('0x17')](_0xd935('0x12'),_0x2f356e,_0x2fa105);_0x4640fa(_0x2fa105);});});}exports['ShowSmsAccount']=function(_0x177329){var _0x51c77b=this;return new Promise(function(_0x2fff78,_0x2ceb95){return db[_0xd935('0x1d')][_0xd935('0x1e')]({'raw':_0x177329[_0xd935('0x1f')]?_0x177329['options']['raw']===undefined?!![]:![]:!![],'where':_0x177329['options']?_0x177329[_0xd935('0x1f')][_0xd935('0x20')]||null:null,'attributes':_0x177329['options']?_0x177329['options']['attributes']||null:null,'include':_0x177329['options']?_0x177329['options'][_0xd935('0x21')]?_[_0xd935('0x22')](_0x177329[_0xd935('0x1f')][_0xd935('0x21')],function(_0x21e285){return{'model':db[_0x21e285['model']],'as':_0x21e285['as'],'attributes':_0x21e285['attributes'],'include':_0x21e285[_0xd935('0x21')]?_[_0xd935('0x22')](_0x21e285['include'],function(_0x16d74c){return{'model':db[_0x16d74c['model']],'as':_0x16d74c['as'],'attributes':_0x16d74c[_0xd935('0x23')],'include':_0x16d74c[_0xd935('0x21')]?_[_0xd935('0x22')](_0x16d74c['include'],function(_0x241d09){return{'model':db[_0x241d09[_0xd935('0x24')]],'as':_0x241d09['as'],'attributes':_0x241d09[_0xd935('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd935('0x11')](function(_0x12ab07){logger[_0xd935('0x1a')]('ShowSmsAccount',_0x177329);logger[_0xd935('0x14')](_0xd935('0x25'),_0x177329,JSON['stringify'](_0x12ab07));_0x2fff78(_0x12ab07);})['catch'](function(_0x3f3a0b){logger[_0xd935('0x17')](_0xd935('0x25'),_0x3f3a0b[_0xd935('0x19')],_0x177329);_0x2ceb95(_0x51c77b['error'](0x1f4,_0x3f3a0b[_0xd935('0x19')]));});});}; \ No newline at end of file +var _0xb892=['raw','where','attributes','include','map','model','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xb892,0x9b));var _0x2b89=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xb892[_0x4ae829];return _0x256b31;};'use strict';var _=require('lodash');var util=require(_0x2b89('0x0'));var moment=require(_0x2b89('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b89('0x2'));var fs=require('fs');var Redis=require(_0x2b89('0x3'));var db=require(_0x2b89('0x4'))['db'];var utils=require(_0x2b89('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b89('0x6'));var jayson=require(_0x2b89('0x7'));var client=jayson[_0x2b89('0x8')][_0x2b89('0x9')]({'port':0x232a});config[_0x2b89('0xa')]=_[_0x2b89('0xb')](config[_0x2b89('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b89('0xc'))(new Redis(config[_0x2b89('0xa')]));require('./smsAccount.socket')[_0x2b89('0xd')](socket);function respondWithRpcPromise(_0x3a3c4d,_0x2aee2d,_0x4d470c){return new BPromise(function(_0x4f849f,_0x25ea04){return client[_0x2b89('0xe')](_0x3a3c4d,_0x4d470c)[_0x2b89('0xf')](function(_0xa4251f){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2aee2d,'request\x20sent');logger['debug'](_0x2b89('0x10'),_0x2aee2d,_0x2b89('0x11'),JSON[_0x2b89('0x12')](_0xa4251f));if(_0xa4251f[_0x2b89('0x13')]){if(_0xa4251f[_0x2b89('0x13')][_0x2b89('0x14')]===0x1f4){logger[_0x2b89('0x13')](_0x2b89('0x15'),_0x2aee2d,_0xa4251f['error'][_0x2b89('0x16')]);return _0x25ea04(_0xa4251f[_0x2b89('0x13')][_0x2b89('0x16')]);}logger[_0x2b89('0x13')](_0x2b89('0x15'),_0x2aee2d,_0xa4251f[_0x2b89('0x13')]['message']);return _0x4f849f(_0xa4251f['error'][_0x2b89('0x16')]);}else{logger[_0x2b89('0x17')]('SmsAccount,\x20%s,\x20%s',_0x2aee2d,_0x2b89('0x11'));_0x4f849f(_0xa4251f[_0x2b89('0x18')][_0x2b89('0x16')]);}})[_0x2b89('0x19')](function(_0x8b3aba){logger[_0x2b89('0x13')](_0x2b89('0x15'),_0x2aee2d,_0x8b3aba);_0x25ea04(_0x8b3aba);});});}exports[_0x2b89('0x1a')]=function(_0x42134a){var _0xa7f742=this;return new Promise(function(_0x1ab4e5,_0x5e9040){return db[_0x2b89('0x1b')][_0x2b89('0x1c')]({'raw':_0x42134a['options']?_0x42134a[_0x2b89('0x1d')][_0x2b89('0x1e')]===undefined?!![]:![]:!![],'where':_0x42134a[_0x2b89('0x1d')]?_0x42134a[_0x2b89('0x1d')][_0x2b89('0x1f')]||null:null,'attributes':_0x42134a['options']?_0x42134a['options'][_0x2b89('0x20')]||null:null,'include':_0x42134a[_0x2b89('0x1d')]?_0x42134a['options'][_0x2b89('0x21')]?_[_0x2b89('0x22')](_0x42134a[_0x2b89('0x1d')]['include'],function(_0x421cdc){return{'model':db[_0x421cdc['model']],'as':_0x421cdc['as'],'attributes':_0x421cdc[_0x2b89('0x20')],'include':_0x421cdc[_0x2b89('0x21')]?_[_0x2b89('0x22')](_0x421cdc[_0x2b89('0x21')],function(_0x54dd12){return{'model':db[_0x54dd12[_0x2b89('0x23')]],'as':_0x54dd12['as'],'attributes':_0x54dd12['attributes'],'include':_0x54dd12[_0x2b89('0x21')]?_[_0x2b89('0x22')](_0x54dd12[_0x2b89('0x21')],function(_0x22e47f){return{'model':db[_0x22e47f[_0x2b89('0x23')]],'as':_0x22e47f['as'],'attributes':_0x22e47f[_0x2b89('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2b89('0xf')](function(_0x104b76){logger[_0x2b89('0x17')](_0x2b89('0x1a'),_0x42134a);logger[_0x2b89('0x24')](_0x2b89('0x1a'),_0x42134a,JSON[_0x2b89('0x12')](_0x104b76));_0x1ab4e5(_0x104b76);})[_0x2b89('0x19')](function(_0x58d4c9){logger[_0x2b89('0x13')](_0x2b89('0x1a'),_0x58d4c9[_0x2b89('0x16')],_0x42134a);_0x5e9040(_0xa7f742[_0x2b89('0x13')](0x1f4,_0x58d4c9[_0x2b89('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 83834ed..d43a425 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 9ec3638..b8ba333 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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x377462,_0x100a9d){var _0xf03b87=function(_0x3aad73){while(--_0x3aad73){_0x377462['push'](_0x377462['shift']());}};_0xf03b87(++_0x100a9d);}(_0xe14b,0x93));var _0xbe14=function(_0x42523d,_0x271eed){_0x42523d=_0x42523d-0x0;var _0x54d9c2=_0xe14b[_0x42523d];return _0x54d9c2;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x14dcde,_0x4a374a){var _0x10d73c=function(_0x4f27e0){while(--_0x4f27e0){_0x14dcde['push'](_0x14dcde['shift']());}};_0x10d73c(++_0x4a374a);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c0644cc..6f87e81 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 _0xb2a4=['TEXT','sequelize','exports','INTEGER','noop'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb2a4,0x169));var _0x4b2a=function(_0x33831d,_0x6be5e9){_0x33831d=_0x33831d-0x0;var _0x138ef1=_0xb2a4[_0x33831d];return _0x138ef1;};'use strict';var Sequelize=require(_0x4b2a('0x0'));module[_0x4b2a('0x1')]={'priority':{'type':Sequelize[_0x4b2a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b2a('0x3')},'appdata':{'type':Sequelize[_0x4b2a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0544=['INTEGER','STRING','noop','sequelize'];(function(_0x5f06c2,_0x55cedf){var _0x585b37=function(_0x311050){while(--_0x311050){_0x5f06c2['push'](_0x5f06c2['shift']());}};_0x585b37(++_0x55cedf);}(_0x0544,0xc3));var _0x4054=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0544[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x4054('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4054('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4054('0x2')],'allowNull':![],'defaultValue':_0x4054('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4054('0x2')]},'interval':{'type':Sequelize[_0x4054('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 997aa9b..3beffed 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 _0x809b=['end','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SmsApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3c177c,_0x5ed860){var _0x53501c=function(_0x4b89c8){while(--_0x4b89c8){_0x3c177c['push'](_0x3c177c['shift']());}};_0x53501c(++_0x5ed860);}(_0x809b,0x83));var _0xb809=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x809b[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xb809('0x0'));var rimraf=require(_0xb809('0x1'));var zipdir=require(_0xb809('0x2'));var jsonpatch=require(_0xb809('0x3'));var rp=require(_0xb809('0x4'));var moment=require(_0xb809('0x5'));var BPromise=require(_0xb809('0x6'));var Mustache=require(_0xb809('0x7'));var util=require('util');var path=require(_0xb809('0x8'));var sox=require(_0xb809('0x9'));var csv=require(_0xb809('0xa'));var ejs=require(_0xb809('0xb'));var fs=require('fs');var fs_extra=require(_0xb809('0xc'));var _=require(_0xb809('0xd'));var squel=require(_0xb809('0xe'));var crypto=require(_0xb809('0xf'));var jsforce=require(_0xb809('0x10'));var deskjs=require(_0xb809('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb809('0x12'));var Papa=require(_0xb809('0x13'));var Redis=require(_0xb809('0x14'));var authService=require(_0xb809('0x15'));var qs=require(_0xb809('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb809('0x17'));var logger=require(_0xb809('0x18'))(_0xb809('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb809('0x1a'));var db=require(_0xb809('0x1b'))['db'];function respondWithStatusCode(_0x1fc94b,_0x466bf6){_0x466bf6=_0x466bf6||0xcc;return function(_0x27b54a){if(_0x27b54a){return _0x1fc94b[_0xb809('0x1c')](_0x466bf6);}return _0x1fc94b['status'](_0x466bf6)[_0xb809('0x1d')]();};}function respondWithResult(_0x5872f6,_0x17dd63){_0x17dd63=_0x17dd63||0xc8;return function(_0x3f60ce){if(_0x3f60ce){return _0x5872f6['status'](_0x17dd63)['json'](_0x3f60ce);}};}function respondWithFilteredResult(_0x2da302,_0xec3e2){return function(_0x1bdb4c){if(_0x1bdb4c){var _0x443bf1=typeof _0xec3e2[_0xb809('0x1e')]===_0xb809('0x1f')&&typeof _0xec3e2['limit']===_0xb809('0x1f');var _0x122afb=_0x1bdb4c['count'];var _0x45f348=_0x443bf1?0x0:_0xec3e2[_0xb809('0x1e')];var _0x103a8e=_0x443bf1?_0x1bdb4c[_0xb809('0x20')]:_0xec3e2[_0xb809('0x1e')]+_0xec3e2[_0xb809('0x21')];var _0x4f0455;if(_0x103a8e>=_0x122afb){_0x103a8e=_0x122afb;_0x4f0455=0xc8;}else{_0x4f0455=0xce;}_0x2da302[_0xb809('0x22')](_0x4f0455);return _0x2da302[_0xb809('0x23')](_0xb809('0x24'),_0x45f348+'-'+_0x103a8e+'/'+_0x122afb)['json'](_0x1bdb4c);}return null;};}function patchUpdates(_0x42caad){return function(_0x2db5d9){try{jsonpatch[_0xb809('0x25')](_0x2db5d9,_0x42caad,!![]);}catch(_0x48a7f3){return BPromise[_0xb809('0x26')](_0x48a7f3);}return _0x2db5d9[_0xb809('0x27')]();};}function saveUpdates(_0x537135,_0x4e452d){return function(_0x19f354){if(_0x19f354){return _0x19f354[_0xb809('0x28')](_0x537135)['then'](function(_0x50217a){return _0x50217a;});}return null;};}function removeEntity(_0x4e7aa2,_0x4b792b){return function(_0x2a3f7f){if(_0x2a3f7f){return _0x2a3f7f[_0xb809('0x29')]()[_0xb809('0x2a')](function(){_0x4e7aa2[_0xb809('0x22')](0xcc)[_0xb809('0x1d')]();});}};}function handleEntityNotFound(_0x4bbc77,_0x4c0f26){return function(_0x494b78){if(!_0x494b78){_0x4bbc77[_0xb809('0x1c')](0x194);}return _0x494b78;};}function handleError(_0x41fb9f,_0x5051f8){_0x5051f8=_0x5051f8||0x1f4;return function(_0x24b492){logger[_0xb809('0x2b')](_0x24b492[_0xb809('0x2c')]);if(_0x24b492[_0xb809('0x2d')]){delete _0x24b492['name'];}_0x41fb9f['status'](_0x5051f8)[_0xb809('0x2e')](_0x24b492);};}exports[_0xb809('0x2f')]=function(_0xe515a8,_0x1dd256){var _0x24cd13={},_0x4fc8a9={},_0x1ed851={'count':0x0,'rows':[]};var _0x36ee2b=_[_0xb809('0x30')](db[_0xb809('0x31')]['rawAttributes'],function(_0x5aa0d4){return{'name':_0x5aa0d4[_0xb809('0x32')],'type':_0x5aa0d4[_0xb809('0x33')]['key']};});_0x4fc8a9[_0xb809('0x34')]=_['map'](_0x36ee2b,'name');_0x4fc8a9[_0xb809('0x35')]=_[_0xb809('0x36')](_0xe515a8[_0xb809('0x35')]);_0x4fc8a9[_0xb809('0x37')]=_[_0xb809('0x38')](_0x4fc8a9[_0xb809('0x34')],_0x4fc8a9[_0xb809('0x35')]);_0x24cd13[_0xb809('0x39')]=_[_0xb809('0x38')](_0x4fc8a9[_0xb809('0x34')],qs[_0xb809('0x3a')](_0xe515a8[_0xb809('0x35')]['fields']));_0x24cd13[_0xb809('0x39')]=_0x24cd13['attributes'][_0xb809('0x3b')]?_0x24cd13['attributes']:_0x4fc8a9['model'];if(!_0xe515a8[_0xb809('0x35')][_0xb809('0x3c')]('nolimit')){_0x24cd13['limit']=qs[_0xb809('0x21')](_0xe515a8[_0xb809('0x35')]['limit']);_0x24cd13[_0xb809('0x1e')]=qs[_0xb809('0x1e')](_0xe515a8[_0xb809('0x35')]['offset']);}_0x24cd13[_0xb809('0x3d')]=qs['sort'](_0xe515a8[_0xb809('0x35')][_0xb809('0x3e')]);_0x24cd13[_0xb809('0x3f')]=qs['filters'](_[_0xb809('0x40')](_0xe515a8['query'],_0x4fc8a9[_0xb809('0x37')]),_0x36ee2b);if(_0xe515a8[_0xb809('0x35')]['filter']){_0x24cd13[_0xb809('0x3f')]=_[_0xb809('0x41')](_0x24cd13['where'],{'$or':_['map'](_0x36ee2b,function(_0x2ec431){if(_0x2ec431['type']!==_0xb809('0x42')){var _0x3beea0={};_0x3beea0[_0x2ec431[_0xb809('0x2d')]]={'$like':'%'+_0xe515a8[_0xb809('0x35')][_0xb809('0x43')]+'%'};return _0x3beea0;}})});}_0x24cd13=_['merge']({},_0x24cd13,_0xe515a8[_0xb809('0x44')]);var _0x239c65={'where':_0x24cd13[_0xb809('0x3f')]};return db['SmsApplication']['count'](_0x239c65)['then'](function(_0x5a1dff){_0x1ed851[_0xb809('0x20')]=_0x5a1dff;if(_0xe515a8['query']['includeAll']){_0x24cd13[_0xb809('0x45')]=[{'all':!![]}];}return db[_0xb809('0x31')][_0xb809('0x46')](_0x24cd13);})[_0xb809('0x2a')](function(_0x29152a){_0x1ed851[_0xb809('0x47')]=_0x29152a;return _0x1ed851;})[_0xb809('0x2a')](respondWithFilteredResult(_0x1dd256,_0x24cd13))['catch'](handleError(_0x1dd256,null));};exports[_0xb809('0x48')]=function(_0x83d7de,_0x2a817a){var _0x4587c0={'raw':!![],'where':{'id':_0x83d7de[_0xb809('0x49')]['id']}},_0x15ccc4={};_0x15ccc4['model']=_[_0xb809('0x36')](db[_0xb809('0x31')][_0xb809('0x4a')]);_0x15ccc4[_0xb809('0x35')]=_['keys'](_0x83d7de['query']);_0x15ccc4[_0xb809('0x37')]=_[_0xb809('0x38')](_0x15ccc4['model'],_0x15ccc4[_0xb809('0x35')]);_0x4587c0[_0xb809('0x39')]=_[_0xb809('0x38')](_0x15ccc4[_0xb809('0x34')],qs['fields'](_0x83d7de['query']['fields']));_0x4587c0[_0xb809('0x39')]=_0x4587c0[_0xb809('0x39')][_0xb809('0x3b')]?_0x4587c0[_0xb809('0x39')]:_0x15ccc4[_0xb809('0x34')];if(_0x83d7de[_0xb809('0x35')][_0xb809('0x4b')]){_0x4587c0[_0xb809('0x45')]=[{'all':!![]}];}_0x4587c0=_[_0xb809('0x41')]({},_0x4587c0,_0x83d7de['options']);return db[_0xb809('0x31')][_0xb809('0x4c')](_0x4587c0)[_0xb809('0x2a')](handleEntityNotFound(_0x2a817a,null))[_0xb809('0x2a')](respondWithResult(_0x2a817a,null))['catch'](handleError(_0x2a817a,null));};exports[_0xb809('0x4d')]=function(_0x702e66,_0xb6fede){return db[_0xb809('0x31')][_0xb809('0x4d')](_0x702e66[_0xb809('0x4e')],{})['then'](respondWithResult(_0xb6fede,0xc9))[_0xb809('0x4f')](handleError(_0xb6fede,null));};exports[_0xb809('0x28')]=function(_0x3dcfae,_0x8f90d4){if(_0x3dcfae['body']['id']){delete _0x3dcfae['body']['id'];}return db[_0xb809('0x31')][_0xb809('0x4c')]({'where':{'id':_0x3dcfae[_0xb809('0x49')]['id']}})[_0xb809('0x2a')](handleEntityNotFound(_0x8f90d4,null))[_0xb809('0x2a')](saveUpdates(_0x3dcfae[_0xb809('0x4e')],null))['then'](respondWithResult(_0x8f90d4,null))[_0xb809('0x4f')](handleError(_0x8f90d4,null));};exports[_0xb809('0x29')]=function(_0xd112cb,_0x5df0f){return db['SmsApplication']['find']({'where':{'id':_0xd112cb['params']['id']}})[_0xb809('0x2a')](handleEntityNotFound(_0x5df0f,null))[_0xb809('0x2a')](removeEntity(_0x5df0f,null))[_0xb809('0x4f')](handleError(_0x5df0f,null));}; \ No newline at end of file +var _0x747f=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','then','error','name','index','map','SmsApplication','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x1906ab,_0x286f32){var _0x1ab815=function(_0x3e459f){while(--_0x3e459f){_0x1906ab['push'](_0x1906ab['shift']());}};_0x1ab815(++_0x286f32);}(_0x747f,0x1f2));var _0xf747=function(_0x57d9d8,_0x2fbe4b){_0x57d9d8=_0x57d9d8-0x0;var _0x3de78f=_0x747f[_0x57d9d8];return _0x3de78f;};'use strict';var emlformat=require(_0xf747('0x0'));var rimraf=require(_0xf747('0x1'));var zipdir=require(_0xf747('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf747('0x3'));var BPromise=require(_0xf747('0x4'));var Mustache=require(_0xf747('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf747('0x6'));var csv=require(_0xf747('0x7'));var ejs=require(_0xf747('0x8'));var fs=require('fs');var fs_extra=require(_0xf747('0x9'));var _=require('lodash');var squel=require(_0xf747('0xa'));var crypto=require(_0xf747('0xb'));var jsforce=require(_0xf747('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf747('0x7'));var querystring=require(_0xf747('0xd'));var Papa=require(_0xf747('0xe'));var Redis=require(_0xf747('0xf'));var authService=require(_0xf747('0x10'));var qs=require(_0xf747('0x11'));var as=require(_0xf747('0x12'));var hardwareService=require(_0xf747('0x13'));var logger=require(_0xf747('0x14'))(_0xf747('0x15'));var utils=require(_0xf747('0x16'));var config=require(_0xf747('0x17'));var licenseUtil=require(_0xf747('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5063,_0x1b56fb){_0x1b56fb=_0x1b56fb||0xcc;return function(_0x4fa168){if(_0x4fa168){return _0x5c5063[_0xf747('0x19')](_0x1b56fb);}return _0x5c5063[_0xf747('0x1a')](_0x1b56fb)['end']();};}function respondWithResult(_0x196012,_0x2bd1ac){_0x2bd1ac=_0x2bd1ac||0xc8;return function(_0x34b36e){if(_0x34b36e){return _0x196012[_0xf747('0x1a')](_0x2bd1ac)[_0xf747('0x1b')](_0x34b36e);}};}function respondWithFilteredResult(_0x362d53,_0x41fabe){return function(_0x5a6eab){if(_0x5a6eab){var _0x983025=typeof _0x41fabe[_0xf747('0x1c')]===_0xf747('0x1d')&&typeof _0x41fabe[_0xf747('0x1e')]===_0xf747('0x1d');var _0x2f4743=_0x5a6eab[_0xf747('0x1f')];var _0x52bcf0=_0x983025?0x0:_0x41fabe[_0xf747('0x1c')];var _0xc56512=_0x983025?_0x5a6eab['count']:_0x41fabe[_0xf747('0x1c')]+_0x41fabe[_0xf747('0x1e')];var _0x2c0117;if(_0xc56512>=_0x2f4743){_0xc56512=_0x2f4743;_0x2c0117=0xc8;}else{_0x2c0117=0xce;}_0x362d53[_0xf747('0x1a')](_0x2c0117);return _0x362d53[_0xf747('0x20')]('Content-Range',_0x52bcf0+'-'+_0xc56512+'/'+_0x2f4743)[_0xf747('0x1b')](_0x5a6eab);}return null;};}function patchUpdates(_0x1466e7){return function(_0x292d77){try{jsonpatch[_0xf747('0x21')](_0x292d77,_0x1466e7,!![]);}catch(_0x3a943c){return BPromise['reject'](_0x3a943c);}return _0x292d77['save']();};}function saveUpdates(_0x405232,_0x503191){return function(_0x67bd8a){if(_0x67bd8a){return _0x67bd8a[_0xf747('0x22')](_0x405232)['then'](function(_0x277fb7){return _0x277fb7;});}return null;};}function removeEntity(_0xee0240,_0x224216){return function(_0x14f089){if(_0x14f089){return _0x14f089[_0xf747('0x23')]()[_0xf747('0x24')](function(){_0xee0240[_0xf747('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0127,_0x3689a1){return function(_0x1dd703){if(!_0x1dd703){_0x4a0127[_0xf747('0x19')](0x194);}return _0x1dd703;};}function handleError(_0x164674,_0x446c8d){_0x446c8d=_0x446c8d||0x1f4;return function(_0x448e2c){logger[_0xf747('0x25')](_0x448e2c['stack']);if(_0x448e2c[_0xf747('0x26')]){delete _0x448e2c['name'];}_0x164674['status'](_0x446c8d)['send'](_0x448e2c);};}exports[_0xf747('0x27')]=function(_0x46b86b,_0x3da507){var _0x5312bb={},_0x20fb22={},_0x12349d={'count':0x0,'rows':[]};var _0x200949=_[_0xf747('0x28')](db[_0xf747('0x29')][_0xf747('0x2a')],function(_0x56cbe3){return{'name':_0x56cbe3['fieldName'],'type':_0x56cbe3['type'][_0xf747('0x2b')]};});_0x20fb22[_0xf747('0x2c')]=_['map'](_0x200949,_0xf747('0x26'));_0x20fb22[_0xf747('0x2d')]=_['keys'](_0x46b86b['query']);_0x20fb22[_0xf747('0x2e')]=_[_0xf747('0x2f')](_0x20fb22[_0xf747('0x2c')],_0x20fb22[_0xf747('0x2d')]);_0x5312bb[_0xf747('0x30')]=_[_0xf747('0x2f')](_0x20fb22[_0xf747('0x2c')],qs[_0xf747('0x31')](_0x46b86b[_0xf747('0x2d')][_0xf747('0x31')]));_0x5312bb[_0xf747('0x30')]=_0x5312bb[_0xf747('0x30')]['length']?_0x5312bb[_0xf747('0x30')]:_0x20fb22[_0xf747('0x2c')];if(!_0x46b86b[_0xf747('0x2d')][_0xf747('0x32')](_0xf747('0x33'))){_0x5312bb[_0xf747('0x1e')]=qs['limit'](_0x46b86b[_0xf747('0x2d')][_0xf747('0x1e')]);_0x5312bb['offset']=qs[_0xf747('0x1c')](_0x46b86b[_0xf747('0x2d')]['offset']);}_0x5312bb[_0xf747('0x34')]=qs[_0xf747('0x35')](_0x46b86b[_0xf747('0x2d')][_0xf747('0x35')]);_0x5312bb[_0xf747('0x36')]=qs['filters'](_[_0xf747('0x37')](_0x46b86b['query'],_0x20fb22[_0xf747('0x2e')]),_0x200949);if(_0x46b86b[_0xf747('0x2d')]['filter']){_0x5312bb[_0xf747('0x36')]=_[_0xf747('0x38')](_0x5312bb[_0xf747('0x36')],{'$or':_[_0xf747('0x28')](_0x200949,function(_0x2b68e8){if(_0x2b68e8[_0xf747('0x39')]!==_0xf747('0x3a')){var _0x407fc0={};_0x407fc0[_0x2b68e8[_0xf747('0x26')]]={'$like':'%'+_0x46b86b[_0xf747('0x2d')][_0xf747('0x3b')]+'%'};return _0x407fc0;}})});}_0x5312bb=_[_0xf747('0x38')]({},_0x5312bb,_0x46b86b[_0xf747('0x3c')]);var _0x52b5e4={'where':_0x5312bb[_0xf747('0x36')]};return db[_0xf747('0x29')][_0xf747('0x1f')](_0x52b5e4)['then'](function(_0x5ae9c3){_0x12349d[_0xf747('0x1f')]=_0x5ae9c3;if(_0x46b86b[_0xf747('0x2d')]['includeAll']){_0x5312bb[_0xf747('0x3d')]=[{'all':!![]}];}return db[_0xf747('0x29')][_0xf747('0x3e')](_0x5312bb);})[_0xf747('0x24')](function(_0xaa4060){_0x12349d[_0xf747('0x3f')]=_0xaa4060;return _0x12349d;})[_0xf747('0x24')](respondWithFilteredResult(_0x3da507,_0x5312bb))[_0xf747('0x40')](handleError(_0x3da507,null));};exports['show']=function(_0x1dad1c,_0xf94c6d){var _0x2fc77e={'raw':!![],'where':{'id':_0x1dad1c[_0xf747('0x41')]['id']}},_0x3d1397={};_0x3d1397[_0xf747('0x2c')]=_[_0xf747('0x42')](db[_0xf747('0x29')][_0xf747('0x2a')]);_0x3d1397[_0xf747('0x2d')]=_[_0xf747('0x42')](_0x1dad1c[_0xf747('0x2d')]);_0x3d1397[_0xf747('0x2e')]=_[_0xf747('0x2f')](_0x3d1397[_0xf747('0x2c')],_0x3d1397[_0xf747('0x2d')]);_0x2fc77e[_0xf747('0x30')]=_['intersection'](_0x3d1397['model'],qs[_0xf747('0x31')](_0x1dad1c[_0xf747('0x2d')][_0xf747('0x31')]));_0x2fc77e[_0xf747('0x30')]=_0x2fc77e[_0xf747('0x30')][_0xf747('0x43')]?_0x2fc77e[_0xf747('0x30')]:_0x3d1397['model'];if(_0x1dad1c[_0xf747('0x2d')][_0xf747('0x44')]){_0x2fc77e[_0xf747('0x3d')]=[{'all':!![]}];}_0x2fc77e=_[_0xf747('0x38')]({},_0x2fc77e,_0x1dad1c[_0xf747('0x3c')]);return db[_0xf747('0x29')][_0xf747('0x45')](_0x2fc77e)['then'](handleEntityNotFound(_0xf94c6d,null))[_0xf747('0x24')](respondWithResult(_0xf94c6d,null))[_0xf747('0x40')](handleError(_0xf94c6d,null));};exports[_0xf747('0x46')]=function(_0x1b805c,_0x4fe387){return db[_0xf747('0x29')][_0xf747('0x46')](_0x1b805c[_0xf747('0x47')],{})[_0xf747('0x24')](respondWithResult(_0x4fe387,0xc9))[_0xf747('0x40')](handleError(_0x4fe387,null));};exports[_0xf747('0x22')]=function(_0x3f713d,_0x55814a){if(_0x3f713d[_0xf747('0x47')]['id']){delete _0x3f713d[_0xf747('0x47')]['id'];}return db['SmsApplication'][_0xf747('0x45')]({'where':{'id':_0x3f713d[_0xf747('0x41')]['id']}})[_0xf747('0x24')](handleEntityNotFound(_0x55814a,null))[_0xf747('0x24')](saveUpdates(_0x3f713d[_0xf747('0x47')],null))[_0xf747('0x24')](respondWithResult(_0x55814a,null))[_0xf747('0x40')](handleError(_0x55814a,null));};exports[_0xf747('0x23')]=function(_0xe9eacb,_0x16258b){return db[_0xf747('0x29')][_0xf747('0x45')]({'where':{'id':_0xe9eacb[_0xf747('0x41')]['id']}})[_0xf747('0x24')](handleEntityNotFound(_0x16258b,null))[_0xf747('0x24')](removeEntity(_0x16258b,null))[_0xf747('0x40')](handleError(_0x16258b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0fb669a..172c132 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 _0x08ab=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x4a0e21,_0x2f99b5){var _0x571cfe=function(_0xafd3f9){while(--_0xafd3f9){_0x4a0e21['push'](_0x4a0e21['shift']());}};_0x571cfe(++_0x2f99b5);}(_0x08ab,0x173));var _0xb08a=function(_0xd4477e,_0xe29d1d){_0xd4477e=_0xd4477e-0x0;var _0x1f992c=_0x08ab[_0xd4477e];return _0x1f992c;};'use strict';var _=require(_0xb08a('0x0'));var util=require(_0xb08a('0x1'));var logger=require(_0xb08a('0x2'))('api');var moment=require(_0xb08a('0x3'));var BPromise=require(_0xb08a('0x4'));var rp=require(_0xb08a('0x5'));var fs=require('fs');var path=require(_0xb08a('0x6'));var rimraf=require(_0xb08a('0x7'));var config=require(_0xb08a('0x8'));var attributes=require(_0xb08a('0x9'));module[_0xb08a('0xa')]=function(_0x45b97f,_0x1a60f3){return _0x45b97f[_0xb08a('0xb')](_0xb08a('0xc'),attributes,{'tableName':_0xb08a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb08a('0xe'),'collate':_0xb08a('0xf')});}; \ No newline at end of file +var _0xd245=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xd245,0x1e8));var _0x5d24=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xd245[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var logger=require(_0x5d24('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d24('0x3'));var rp=require(_0x5d24('0x4'));var fs=require('fs');var path=require(_0x5d24('0x5'));var rimraf=require(_0x5d24('0x6'));var config=require(_0x5d24('0x7'));var attributes=require('./smsApplication.attributes');module[_0x5d24('0x8')]=function(_0x7d2d9,_0x13930d){return _0x7d2d9[_0x5d24('0x9')](_0x5d24('0xa'),attributes,{'tableName':_0x5d24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d24('0xc'),'collate':_0x5d24('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4c9ed2f..6cdf51c 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 _0xeba2=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0xeba2,0x70));var _0x2eba=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xeba2[_0x421263];return _0x34e4b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2eba('0x0'));var BPromise=require(_0x2eba('0x1'));var rs=require(_0x2eba('0x2'));var fs=require('fs');var Redis=require(_0x2eba('0x3'));var db=require(_0x2eba('0x4'))['db'];var utils=require(_0x2eba('0x5'));var logger=require(_0x2eba('0x6'))(_0x2eba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4d9a,_0x14c40a,_0x4e7a50){return new BPromise(function(_0x279806,_0x1fed79){return client[_0x2eba('0x9')](_0x1b4d9a,_0x4e7a50)[_0x2eba('0xa')](function(_0x1cc4e){logger[_0x2eba('0xb')](_0x2eba('0xc'),_0x14c40a,_0x2eba('0xd'));logger[_0x2eba('0xe')](_0x2eba('0xf'),_0x14c40a,'request\x20sent',JSON[_0x2eba('0x10')](_0x1cc4e));if(_0x1cc4e[_0x2eba('0x11')]){if(_0x1cc4e['error'][_0x2eba('0x12')]===0x1f4){logger[_0x2eba('0x11')](_0x2eba('0xc'),_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x1fed79(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x279806(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}else{logger[_0x2eba('0xb')]('SmsApplication,\x20%s,\x20%s',_0x14c40a,_0x2eba('0xd'));_0x279806(_0x1cc4e[_0x2eba('0x14')][_0x2eba('0x13')]);}})[_0x2eba('0x15')](function(_0x2de66e){logger['error'](_0x2eba('0xc'),_0x14c40a,_0x2de66e);_0x1fed79(_0x2de66e);});});} \ No newline at end of file +var _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird'];(function(_0x3ae10d,_0x1a7d1d){var _0x27e528=function(_0x621d99){while(--_0x621d99){_0x3ae10d['push'](_0x3ae10d['shift']());}};_0x27e528(++_0x1a7d1d);}(_0x0b7f,0x115));var _0xf0b7=function(_0x13772c,_0x4544b3){_0x13772c=_0x13772c-0x0;var _0x3397db=_0x0b7f[_0x13772c];return _0x3397db;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7809c9a..81e2d13 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0x2032,0xd9));var _0x2203=function(_0x111a1a,_0x107c5a){_0x111a1a=_0x111a1a-0x0;var _0x8d4734=_0x2032[_0x111a1a];return _0x8d4734;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 68155db..e6898ab 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 _0xc2c7=['STRING','ENUM','out','INTEGER','moment','exports','BOOLEAN','DATE'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xc2c7,0x134));var _0x7c2c=function(_0x367dc3,_0x52ec80){_0x367dc3=_0x367dc3-0x0;var _0x8e315=_0xc2c7[_0x367dc3];return _0x8e315;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7c2c('0x0'));module[_0x7c2c('0x1')]={'closed':{'type':Sequelize[_0x7c2c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7c2c('0x3')]},'disposition':{'type':Sequelize[_0x7c2c('0x4')]},'secondDisposition':{'type':Sequelize[_0x7c2c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7c2c('0x4')]},'note':{'type':Sequelize[_0x7c2c('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7c2c('0x5')]('in',_0x7c2c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7c2c('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7c2c('0x7')]}}; \ No newline at end of file +var _0xa3fe=['sequelize','exports','BOOLEAN','STRING','ENUM','out','DATE','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3fe,0xd8));var _0xea3f=function(_0x3dbc31,_0x3debd1){_0x3dbc31=_0x3dbc31-0x0;var _0x947e37=_0xa3fe[_0x3dbc31];return _0x947e37;};'use strict';var Sequelize=require(_0xea3f('0x0'));var moment=require('moment');module[_0xea3f('0x1')]={'closed':{'type':Sequelize[_0xea3f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xea3f('0x3')]},'secondDisposition':{'type':Sequelize[_0xea3f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xea3f('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xea3f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xea3f('0x4')]('in',_0xea3f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea3f('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xea3f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xea3f('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ef82b6e..8ef7b07 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 _0xc2fc=['sms','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','includeAll','include','options','SmsInteraction','find','create','update','body','describe','addMessage','SmsMessage','ids','omit','getMessages','length','hasOwnProperty','limit','order','where','pick','SmsInteractionId','filter','merge','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','fullname','CmContact','Contact','lastName','Messages','createdAt','secret','read','Account','User','get','mkdirSync','Sms','Owner','N.A.','closed','disposition','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','undefined','count','offset','set','json','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc2fc,0x1b3));var _0xcc2f=function(_0xb0b95a,_0x3ca3b3){_0xb0b95a=_0xb0b95a-0x0;var _0x4fcfd0=_0xc2fc[_0xb0b95a];return _0x4fcfd0;};'use strict';var rimraf=require(_0xcc2f('0x0'));var zipdir=require(_0xcc2f('0x1'));var moment=require(_0xcc2f('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xcc2f('0x3'));var ejs=require(_0xcc2f('0x4'));var fs=require('fs');var _=require(_0xcc2f('0x5'));var Redis=require(_0xcc2f('0x6'));var interaction=require(_0xcc2f('0x7'));var qs=require(_0xcc2f('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xcc2f('0x9'))('api');var config=require(_0xcc2f('0xa'));var db=require(_0xcc2f('0xb'))['db'];config[_0xcc2f('0xc')]=_['defaults'](config[_0xcc2f('0xc')],{'host':_0xcc2f('0xd'),'port':0x18eb});var socket=require(_0xcc2f('0xe'))(new Redis(config[_0xcc2f('0xc')]));require(_0xcc2f('0xf'))[_0xcc2f('0x10')](socket);function respondWithStatusCode(_0x199da9,_0x495533){_0x495533=_0x495533||0xcc;return function(_0x38b2ec){if(_0x38b2ec){return _0x199da9[_0xcc2f('0x11')](_0x495533);}return _0x199da9['status'](_0x495533)[_0xcc2f('0x12')]();};}function respondWithResult(_0x386cee,_0x2481ec){_0x2481ec=_0x2481ec||0xc8;return function(_0x204354){if(_0x204354){return _0x386cee[_0xcc2f('0x13')](_0x2481ec)['json'](_0x204354);}};}function respondWithFilteredResult(_0x4d7610,_0x2e1993){return function(_0x201201){if(_0x201201){var _0x360c16=typeof _0x2e1993['offset']===_0xcc2f('0x14')&&typeof _0x2e1993['limit']==='undefined';var _0x1d246c=_0x201201[_0xcc2f('0x15')];var _0x3ae86a=_0x360c16?0x0:_0x2e1993[_0xcc2f('0x16')];var _0xb060c9=_0x360c16?_0x201201[_0xcc2f('0x15')]:_0x2e1993[_0xcc2f('0x16')]+_0x2e1993['limit'];var _0x264d4c;if(_0xb060c9>=_0x1d246c){_0xb060c9=_0x1d246c;_0x264d4c=0xc8;}else{_0x264d4c=0xce;}_0x4d7610[_0xcc2f('0x13')](_0x264d4c);return _0x4d7610[_0xcc2f('0x17')]('Content-Range',_0x3ae86a+'-'+_0xb060c9+'/'+_0x1d246c)[_0xcc2f('0x18')](_0x201201);}return null;};}function saveUpdates(_0x36db35){return function(_0x4d3317){if(_0x4d3317){return _0x4d3317['update'](_0x36db35)[_0xcc2f('0x19')](function(_0x43c9a6){return _0x43c9a6;});}return null;};}function removeEntity(_0x378ec1){return function(_0x1b882f){if(_0x1b882f){return _0x1b882f[_0xcc2f('0x1a')]()[_0xcc2f('0x19')](function(){_0x378ec1[_0xcc2f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c71f6){return function(_0x213bf6){if(!_0x213bf6){_0x3c71f6['sendStatus'](0x194);}return _0x213bf6;};}function handleError(_0x1c355d,_0x37766b){_0x37766b=_0x37766b||0x1f4;return function(_0x21fc66){logger['error'](_0x21fc66[_0xcc2f('0x1b')]);if(_0x21fc66[_0xcc2f('0x1c')]){delete _0x21fc66[_0xcc2f('0x1c')];}_0x1c355d['status'](_0x37766b)[_0xcc2f('0x1d')](_0x21fc66);};}exports[_0xcc2f('0x1e')]=function(_0x1c668b,_0x15c6ae){var _0xc0f43f={};var _0x215880=_[_0xcc2f('0x1f')](db['SmsInteraction'][_0xcc2f('0x20')],function(_0x46d4c7){return{'name':_0x46d4c7[_0xcc2f('0x21')],'type':_0x46d4c7['type'][_0xcc2f('0x22')]};});_0xc0f43f=qs[_0xcc2f('0x23')](_0x215880,_0x1c668b);return interaction[_0xcc2f('0x24')](_0xcc2f('0x25'),_0x1c668b[_0xcc2f('0x26')],_0x1c668b[_0xcc2f('0x27')],_0xc0f43f,_0x215880)['then'](respondWithFilteredResult(_0x15c6ae,_0xc0f43f))[_0xcc2f('0x28')](handleError(_0x15c6ae,null));};exports[_0xcc2f('0x29')]=function(_0x214f9c,_0x4bbe24){var _0xb56ed7={'raw':![],'where':{'id':_0x214f9c[_0xcc2f('0x2a')]['id']}},_0x393189={};_0x393189[_0xcc2f('0x2b')]=_[_0xcc2f('0x2c')](db['SmsInteraction'][_0xcc2f('0x20')]);_0x393189['query']=_[_0xcc2f('0x2c')](_0x214f9c[_0xcc2f('0x26')]);_0x393189[_0xcc2f('0x2d')]=_['intersection'](_0x393189['model'],_0x393189['query']);_0xb56ed7[_0xcc2f('0x2e')]=_[_0xcc2f('0x2f')](_0x393189[_0xcc2f('0x2b')],qs[_0xcc2f('0x30')](_0x214f9c[_0xcc2f('0x26')]['fields']));_0xb56ed7[_0xcc2f('0x2e')]=_0xb56ed7['attributes']['length']?_0xb56ed7[_0xcc2f('0x2e')]:_0x393189['model'];if(_0x214f9c[_0xcc2f('0x26')][_0xcc2f('0x31')]){_0xb56ed7[_0xcc2f('0x32')]=[{'all':!![]}];}_0xb56ed7=_['merge']({},_0xb56ed7,_0x214f9c[_0xcc2f('0x33')]);return db[_0xcc2f('0x34')][_0xcc2f('0x35')](_0xb56ed7)['then'](handleEntityNotFound(_0x4bbe24,null))[_0xcc2f('0x19')](respondWithResult(_0x4bbe24,null))[_0xcc2f('0x28')](handleError(_0x4bbe24,null));};exports[_0xcc2f('0x36')]=function(_0x3b6e0f,_0x5bfd26){return db[_0xcc2f('0x34')][_0xcc2f('0x36')](_0x3b6e0f['body'],{})[_0xcc2f('0x19')](respondWithResult(_0x5bfd26,0xc9))[_0xcc2f('0x28')](handleError(_0x5bfd26,null));};exports[_0xcc2f('0x37')]=function(_0x1291da,_0x55e51a){if(_0x1291da[_0xcc2f('0x38')]['id']){delete _0x1291da['body']['id'];}return db[_0xcc2f('0x34')]['find']({'where':{'id':_0x1291da[_0xcc2f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x55e51a,null))[_0xcc2f('0x19')](saveUpdates(_0x1291da[_0xcc2f('0x38')],null))[_0xcc2f('0x19')](respondWithResult(_0x55e51a,null))['catch'](handleError(_0x55e51a,null));};exports[_0xcc2f('0x1a')]=function(_0x23590e,_0x1abc5e){return db[_0xcc2f('0x34')][_0xcc2f('0x35')]({'where':{'id':_0x23590e[_0xcc2f('0x2a')]['id']}})[_0xcc2f('0x19')](handleEntityNotFound(_0x1abc5e,null))[_0xcc2f('0x19')](removeEntity(_0x1abc5e,null))[_0xcc2f('0x28')](handleError(_0x1abc5e,null));};exports[_0xcc2f('0x39')]=function(_0x30c1d0,_0x22db0f){return db[_0xcc2f('0x34')]['describe']()['then'](respondWithResult(_0x22db0f,null))[_0xcc2f('0x28')](handleError(_0x22db0f,null));};exports[_0xcc2f('0x3a')]=function(_0x5888f2,_0x543310){return db[_0xcc2f('0x3b')][_0xcc2f('0x35')]({'where':{'id':_0x5888f2[_0xcc2f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x543310,null))[_0xcc2f('0x19')](function(_0x2ca8cd){if(_0x2ca8cd){return _0x2ca8cd[_0xcc2f('0x3a')](_0x5888f2[_0xcc2f('0x38')][_0xcc2f('0x3c')],_[_0xcc2f('0x3d')](_0x5888f2[_0xcc2f('0x38')],['ids','id'])||{});}})[_0xcc2f('0x19')](respondWithResult(_0x543310,null))[_0xcc2f('0x28')](handleError(_0x543310,null));};exports[_0xcc2f('0x3e')]=function(_0x209858,_0x49eb83){var _0x39f581={'raw':![],'where':{}};var _0xd666d0={};var _0x43d576={'count':0x0,'rows':[]};return db[_0xcc2f('0x34')]['findOne']({'where':{'id':_0x209858[_0xcc2f('0x2a')]['id']}})[_0xcc2f('0x19')](handleEntityNotFound(_0x49eb83,null))['then'](function(_0x2b6956){if(_0x2b6956){_0xd666d0[_0xcc2f('0x2b')]=_[_0xcc2f('0x2c')](db['SmsMessage'][_0xcc2f('0x20')]);_0xd666d0['query']=_[_0xcc2f('0x2c')](_0x209858['query']);_0xd666d0[_0xcc2f('0x2d')]=_[_0xcc2f('0x2f')](_0xd666d0[_0xcc2f('0x2b')],_0xd666d0[_0xcc2f('0x26')]);_0x39f581['attributes']=_[_0xcc2f('0x2f')](_0xd666d0['model'],qs[_0xcc2f('0x30')](_0x209858[_0xcc2f('0x26')][_0xcc2f('0x30')]));_0x39f581['attributes']=_0x39f581[_0xcc2f('0x2e')][_0xcc2f('0x3f')]?_0x39f581[_0xcc2f('0x2e')]:_0xd666d0[_0xcc2f('0x2b')];if(!_0x209858[_0xcc2f('0x26')][_0xcc2f('0x40')]('nolimit')){_0x39f581['limit']=qs[_0xcc2f('0x41')](_0x209858[_0xcc2f('0x26')][_0xcc2f('0x41')]);_0x39f581['offset']=qs[_0xcc2f('0x16')](_0x209858[_0xcc2f('0x26')]['offset']);}_0x39f581[_0xcc2f('0x42')]=qs['sort'](_0x209858[_0xcc2f('0x26')]['sort']);_0x39f581[_0xcc2f('0x43')]=qs['filters'](_[_0xcc2f('0x44')](_0x209858[_0xcc2f('0x26')],_0xd666d0[_0xcc2f('0x2d')]));_0x39f581[_0xcc2f('0x43')][_0xcc2f('0x45')]=_0x2b6956['id'];if(_0x209858[_0xcc2f('0x26')][_0xcc2f('0x46')]){_0x39f581['where']=_[_0xcc2f('0x47')](_0x39f581['where'],{'$or':_[_0xcc2f('0x1f')](_0x39f581[_0xcc2f('0x2e')],function(_0x1197f1){var _0x5442bd={};_0x5442bd[_0x1197f1]={'$like':'%'+_0x209858[_0xcc2f('0x26')]['filter']+'%'};return _0x5442bd;})});}if(_0x209858[_0xcc2f('0x26')]['$gte']){var _0x5ca308=_0x209858[_0xcc2f('0x26')]['$gte'][_0xcc2f('0x48')](',');var _0x204ffa={};_0x204ffa[_0x5ca308[0x0]]={'$gte':moment(_0x5ca308[0x1])[_0xcc2f('0x49')](_0xcc2f('0x4a'))};_0x39f581[_0xcc2f('0x43')]=_[_0xcc2f('0x47')](_0x39f581[_0xcc2f('0x43')],_0x204ffa);}_0x39f581=_[_0xcc2f('0x47')]({},_0x39f581,_0x209858[_0xcc2f('0x33')]);return db[_0xcc2f('0x3b')][_0xcc2f('0x15')]({'where':_0x39f581['where']})[_0xcc2f('0x19')](function(_0x3b83a0){_0x43d576['count']=_0x3b83a0;if(_0x209858['query']['includeAll']){_0x39f581[_0xcc2f('0x32')]=[{'all':!![]}];}return db['SmsMessage'][_0xcc2f('0x24')](_0x39f581);})[_0xcc2f('0x19')](function(_0x16c178){_0x43d576[_0xcc2f('0x4b')]=_0x16c178;return _0x43d576;});}})['then'](respondWithFilteredResult(_0x49eb83,_0x39f581))[_0xcc2f('0x28')](handleError(_0x49eb83,null));};exports['addTags']=function(_0x1799b4,_0x325e33){return db[_0xcc2f('0x34')]['find']({'where':{'id':_0x1799b4[_0xcc2f('0x2a')]['id']}})[_0xcc2f('0x19')](handleEntityNotFound(_0x325e33,null))[_0xcc2f('0x19')](function(_0x39b2d8){if(_0x39b2d8){return _0x39b2d8[_0xcc2f('0x4c')](_0x1799b4['body'][_0xcc2f('0x3c')],_[_0xcc2f('0x3d')](_0x1799b4[_0xcc2f('0x38')],['ids','id'])||{})[_0xcc2f('0x4d')](function(){return db[_0xcc2f('0x4e')][_0xcc2f('0x24')]({'attributes':['id',_0xcc2f('0x1c'),_0xcc2f('0x4f')],'where':{'id':_0x1799b4['body'][_0xcc2f('0x3c')]}});})[_0xcc2f('0x19')](function(_0x3e56cf){socket[_0xcc2f('0x50')](_0xcc2f('0x51'),{'id':Number(_0x1799b4['params']['id']),'tags':_0x3e56cf||[]});return{'id':Number(_0x1799b4['params']['id']),'tags':_0x3e56cf||[]};});}})[_0xcc2f('0x19')](respondWithResult(_0x325e33,null))['catch'](handleError(_0x325e33,null));};exports[_0xcc2f('0x52')]=function(_0x5efb8c,_0x4a9008){return db[_0xcc2f('0x34')][_0xcc2f('0x35')]({'where':{'id':_0x5efb8c[_0xcc2f('0x2a')]['id']}})[_0xcc2f('0x19')](handleEntityNotFound(_0x4a9008,null))[_0xcc2f('0x19')](function(_0x4f2884){if(_0x4f2884){return _0x4f2884[_0xcc2f('0x52')](_0x5efb8c[_0xcc2f('0x26')][_0xcc2f('0x3c')]);}})['then'](respondWithStatusCode(_0x4a9008,null))[_0xcc2f('0x28')](handleError(_0x4a9008,null));};exports[_0xcc2f('0x53')]=function(_0x8c02e2,_0x25af0c){var _0x293366=moment()[_0xcc2f('0x54')]()[_0xcc2f('0x55')]();var _0x2bfefe=path['join'](config[_0xcc2f('0x56')],_0xcc2f('0x57'),_0xcc2f('0x58'),_0xcc2f('0x59'));var _0x569745=path[_0xcc2f('0x5a')](_0x2bfefe,_0x293366);var _0x200bc6=util[_0xcc2f('0x49')](_0xcc2f('0x5b'),_0x8c02e2[_0xcc2f('0x2a')]['id'],_0x293366);var _0x16383e=path[_0xcc2f('0x5a')](_0x2bfefe,_0x200bc6);var _0x7bd1dc=[];_0x7bd1dc[_0xcc2f('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0xcc2f('0x5d')],'raw':!![]});_0x7bd1dc['push']({'model':db[_0xcc2f('0x5e')],'as':_0xcc2f('0x5f'),'attributes':['id','firstName',_0xcc2f('0x60')],'raw':!![]});var _0x5d79f9=[{'model':db[_0xcc2f('0x3b')],'as':_0xcc2f('0x61'),'attributes':['id',_0xcc2f('0x38'),_0xcc2f('0x62'),'direction',_0xcc2f('0x63'),_0xcc2f('0x64')],'include':_0x7bd1dc}];_0x5d79f9[_0xcc2f('0x5c')]({'model':db['SmsAccount'],'as':_0xcc2f('0x65'),'attributes':['id',_0xcc2f('0x1c')]});_0x5d79f9[_0xcc2f('0x5c')]({'model':db[_0xcc2f('0x66')],'as':'Owner','attributes':['id',_0xcc2f('0x5d')]});return db['SmsInteraction'][_0xcc2f('0x35')]({'where':{'id':_0x8c02e2[_0xcc2f('0x2a')]['id']},'include':_0x5d79f9})['then'](handleEntityNotFound(_0x25af0c,null))[_0xcc2f('0x19')](function(_0x4e0c8d){if(_0x4e0c8d){var _0x280090=_0x4e0c8d[_0xcc2f('0x67')]({'plain':!![]});fs[_0xcc2f('0x68')](_0x569745);var _0x5d6da6={'channel':_0xcc2f('0x69'),'account':_0x280090[_0xcc2f('0x65')][_0xcc2f('0x1c')],'agent':_0x280090[_0xcc2f('0x6a')]?_0x280090[_0xcc2f('0x6a')][_0xcc2f('0x5d')]:_0xcc2f('0x6b'),'createdAt':moment(_0x280090[_0xcc2f('0x62')])[_0xcc2f('0x49')](_0xcc2f('0x4a'))[_0xcc2f('0x55')](),'closedAt':_0x280090[_0xcc2f('0x6c')]?moment(_0x280090['closedAt'])[_0xcc2f('0x49')](_0xcc2f('0x4a'))['toString']():'','disposition':_0x280090[_0xcc2f('0x6d')],'messages':_(_0x280090[_0xcc2f('0x61')])['filter']({'secret':![]})[_0xcc2f('0x1f')](function(_0x105736){return{'date':moment(_0x105736[_0xcc2f('0x62')])[_0xcc2f('0x49')](_0xcc2f('0x4a'))[_0xcc2f('0x55')](),'sender':_0x105736['direction']===_0xcc2f('0x6e')?_0x105736[_0xcc2f('0x66')]?_0x105736[_0xcc2f('0x66')][_0xcc2f('0x5d')]:_0xcc2f('0x6f'):_0x105736[_0xcc2f('0x5f')]['firstName']+(_0x105736[_0xcc2f('0x5f')]['lastName']?'\x20'+_0x105736[_0xcc2f('0x5f')][_0xcc2f('0x60')]:''),'body':_0x105736['body'],'direction':_0x105736['direction']===_0xcc2f('0x6e')?'A':'C','secret':_0x105736[_0xcc2f('0x63')],'read':_0x105736[_0xcc2f('0x64')]};})['value']()};return ejs[_0xcc2f('0x70')](path[_0xcc2f('0x5a')](config[_0xcc2f('0x56')],_0xcc2f('0x57'),'views',_0xcc2f('0x71')),{'interaction':_0x5d6da6})['then'](function(_0x544dce){var _0x25b3aa=path[_0xcc2f('0x5a')](_0x569745,_0xcc2f('0x72')+_0x280090['id']+'-'+_0x293366+_0xcc2f('0x73'));var _0xc74985={'path':_0x25b3aa,'channel':_0xcc2f('0x69'),'interactionId':_0x280090['id']};return pdf[_0xcc2f('0x74')](_0x544dce,_0xc74985);})['then'](function(){return new BPromise(function(_0x5d4447,_0x469bef){zipdir(_0x569745,{'saveTo':_0x16383e},function(_0x3ed974,_0x395307){if(_0x3ed974)return _0x469bef(_0x3ed974);return _0x5d4447(_0x395307);});})['then'](function(){return new BPromise(function(_0x57313a,_0x59000e){rimraf(_0x569745,function(_0xa545be){if(_0xa545be)_0x59000e(_0xa545be);return _0x57313a();});});})[_0xcc2f('0x19')](function(){return _0x25af0c[_0xcc2f('0x53')](_0x16383e,_0x200bc6,function(_0x132b1f){if(_0x132b1f){console['log']('err',_0x132b1f);}else{fs[_0xcc2f('0x75')](_0x16383e);}});});});}else{return _0x25af0c[_0xcc2f('0x11')](0xc8);}})['catch'](handleError(_0x25af0c,null));}; \ No newline at end of file +var _0xed5a=['toString','closed','disposition','map','out','System','server','.pdf','Sms','createPdfFromHTML','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','set','then','destroy','error','stack','name','send','index','rawAttributes','type','key','findAll','sms','user','show','params','model','SmsInteraction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','describe','ids','omit','getMessages','findOne','keys','SmsMessage','hasOwnProperty','nolimit','limit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','rows','addTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','root','files','join','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','Owner','get','mkdirSync','Account','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xed5a,0x1cf));var _0xaed5=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0xed5a[_0x401d67];return _0x25076b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xaed5('0x0'));var moment=require(_0xaed5('0x1'));var BPromise=require(_0xaed5('0x2'));var util=require(_0xaed5('0x3'));var path=require(_0xaed5('0x4'));var ejs=require(_0xaed5('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xaed5('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xaed5('0x7'))(_0xaed5('0x8'));var config=require(_0xaed5('0x9'));var db=require(_0xaed5('0xa'))['db'];config[_0xaed5('0xb')]=_[_0xaed5('0xc')](config[_0xaed5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaed5('0xd'))(new Redis(config[_0xaed5('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5336de,_0x25afa0){_0x25afa0=_0x25afa0||0xcc;return function(_0x1a3269){if(_0x1a3269){return _0x5336de[_0xaed5('0xe')](_0x25afa0);}return _0x5336de[_0xaed5('0xf')](_0x25afa0)[_0xaed5('0x10')]();};}function respondWithResult(_0x4b9cb0,_0x32124f){_0x32124f=_0x32124f||0xc8;return function(_0x29cc79){if(_0x29cc79){return _0x4b9cb0[_0xaed5('0xf')](_0x32124f)[_0xaed5('0x11')](_0x29cc79);}};}function respondWithFilteredResult(_0x43a745,_0x4a266d){return function(_0x62c84a){if(_0x62c84a){var _0x372f77=typeof _0x4a266d[_0xaed5('0x12')]===_0xaed5('0x13')&&typeof _0x4a266d['limit']==='undefined';var _0x3d8d90=_0x62c84a[_0xaed5('0x14')];var _0x43c93a=_0x372f77?0x0:_0x4a266d[_0xaed5('0x12')];var _0x3dfbd8=_0x372f77?_0x62c84a['count']:_0x4a266d[_0xaed5('0x12')]+_0x4a266d['limit'];var _0x3e0294;if(_0x3dfbd8>=_0x3d8d90){_0x3dfbd8=_0x3d8d90;_0x3e0294=0xc8;}else{_0x3e0294=0xce;}_0x43a745[_0xaed5('0xf')](_0x3e0294);return _0x43a745[_0xaed5('0x15')]('Content-Range',_0x43c93a+'-'+_0x3dfbd8+'/'+_0x3d8d90)['json'](_0x62c84a);}return null;};}function saveUpdates(_0x5ee3e2){return function(_0x112ff1){if(_0x112ff1){return _0x112ff1['update'](_0x5ee3e2)[_0xaed5('0x16')](function(_0x5ee2ac){return _0x5ee2ac;});}return null;};}function removeEntity(_0x2b3cec){return function(_0x1c0a55){if(_0x1c0a55){return _0x1c0a55[_0xaed5('0x17')]()[_0xaed5('0x16')](function(){_0x2b3cec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d278a){return function(_0x13a0e8){if(!_0x13a0e8){_0x3d278a['sendStatus'](0x194);}return _0x13a0e8;};}function handleError(_0x450a86,_0x2d7c3a){_0x2d7c3a=_0x2d7c3a||0x1f4;return function(_0x2a13bc){logger[_0xaed5('0x18')](_0x2a13bc[_0xaed5('0x19')]);if(_0x2a13bc['name']){delete _0x2a13bc[_0xaed5('0x1a')];}_0x450a86['status'](_0x2d7c3a)[_0xaed5('0x1b')](_0x2a13bc);};}exports[_0xaed5('0x1c')]=function(_0x415314,_0xcd89d){var _0xa93aaa={};var _0x386440=_['map'](db['SmsInteraction'][_0xaed5('0x1d')],function(_0x1e5cf4){return{'name':_0x1e5cf4['fieldName'],'type':_0x1e5cf4[_0xaed5('0x1e')][_0xaed5('0x1f')]};});_0xa93aaa=qs['getOptions'](_0x386440,_0x415314);return interaction[_0xaed5('0x20')](_0xaed5('0x21'),_0x415314['query'],_0x415314[_0xaed5('0x22')],_0xa93aaa,_0x386440)[_0xaed5('0x16')](respondWithFilteredResult(_0xcd89d,_0xa93aaa))['catch'](handleError(_0xcd89d,null));};exports[_0xaed5('0x23')]=function(_0x46b393,_0x343def){var _0x4ed037={'raw':![],'where':{'id':_0x46b393[_0xaed5('0x24')]['id']}},_0x3f32c3={};_0x3f32c3[_0xaed5('0x25')]=_['keys'](db[_0xaed5('0x26')]['rawAttributes']);_0x3f32c3[_0xaed5('0x27')]=_['keys'](_0x46b393[_0xaed5('0x27')]);_0x3f32c3[_0xaed5('0x28')]=_[_0xaed5('0x29')](_0x3f32c3['model'],_0x3f32c3[_0xaed5('0x27')]);_0x4ed037[_0xaed5('0x2a')]=_['intersection'](_0x3f32c3['model'],qs[_0xaed5('0x2b')](_0x46b393[_0xaed5('0x27')][_0xaed5('0x2b')]));_0x4ed037['attributes']=_0x4ed037['attributes'][_0xaed5('0x2c')]?_0x4ed037[_0xaed5('0x2a')]:_0x3f32c3['model'];if(_0x46b393[_0xaed5('0x27')][_0xaed5('0x2d')]){_0x4ed037[_0xaed5('0x2e')]=[{'all':!![]}];}_0x4ed037=_[_0xaed5('0x2f')]({},_0x4ed037,_0x46b393[_0xaed5('0x30')]);return db[_0xaed5('0x26')][_0xaed5('0x31')](_0x4ed037)[_0xaed5('0x16')](handleEntityNotFound(_0x343def,null))[_0xaed5('0x16')](respondWithResult(_0x343def,null))[_0xaed5('0x32')](handleError(_0x343def,null));};exports[_0xaed5('0x33')]=function(_0x3a56ea,_0x31934b){return db[_0xaed5('0x26')][_0xaed5('0x33')](_0x3a56ea[_0xaed5('0x34')],{})[_0xaed5('0x16')](respondWithResult(_0x31934b,0xc9))['catch'](handleError(_0x31934b,null));};exports[_0xaed5('0x35')]=function(_0x47cf53,_0x50429f){if(_0x47cf53[_0xaed5('0x34')]['id']){delete _0x47cf53['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x47cf53['params']['id']}})['then'](handleEntityNotFound(_0x50429f,null))[_0xaed5('0x16')](saveUpdates(_0x47cf53[_0xaed5('0x34')],null))['then'](respondWithResult(_0x50429f,null))[_0xaed5('0x32')](handleError(_0x50429f,null));};exports[_0xaed5('0x17')]=function(_0x417ebc,_0x34d40d){return db[_0xaed5('0x26')]['find']({'where':{'id':_0x417ebc[_0xaed5('0x24')]['id']}})[_0xaed5('0x16')](handleEntityNotFound(_0x34d40d,null))[_0xaed5('0x16')](removeEntity(_0x34d40d,null))['catch'](handleError(_0x34d40d,null));};exports[_0xaed5('0x36')]=function(_0x59e867,_0x2be105){return db[_0xaed5('0x26')][_0xaed5('0x36')]()[_0xaed5('0x16')](respondWithResult(_0x2be105,null))['catch'](handleError(_0x2be105,null));};exports['addMessage']=function(_0x4df344,_0x37aa7d){return db['SmsMessage'][_0xaed5('0x31')]({'where':{'id':_0x4df344[_0xaed5('0x24')]['id']}})[_0xaed5('0x16')](handleEntityNotFound(_0x37aa7d,null))[_0xaed5('0x16')](function(_0x1a022b){if(_0x1a022b){return _0x1a022b['addMessage'](_0x4df344[_0xaed5('0x34')][_0xaed5('0x37')],_[_0xaed5('0x38')](_0x4df344[_0xaed5('0x34')],[_0xaed5('0x37'),'id'])||{});}})['then'](respondWithResult(_0x37aa7d,null))[_0xaed5('0x32')](handleError(_0x37aa7d,null));};exports[_0xaed5('0x39')]=function(_0x38e818,_0x4bde59){var _0x5d2f13={'raw':![],'where':{}};var _0x17cc42={};var _0x4a594c={'count':0x0,'rows':[]};return db[_0xaed5('0x26')][_0xaed5('0x3a')]({'where':{'id':_0x38e818[_0xaed5('0x24')]['id']}})[_0xaed5('0x16')](handleEntityNotFound(_0x4bde59,null))[_0xaed5('0x16')](function(_0xef85b9){if(_0xef85b9){_0x17cc42[_0xaed5('0x25')]=_[_0xaed5('0x3b')](db[_0xaed5('0x3c')]['rawAttributes']);_0x17cc42['query']=_[_0xaed5('0x3b')](_0x38e818[_0xaed5('0x27')]);_0x17cc42['filters']=_[_0xaed5('0x29')](_0x17cc42[_0xaed5('0x25')],_0x17cc42['query']);_0x5d2f13[_0xaed5('0x2a')]=_['intersection'](_0x17cc42[_0xaed5('0x25')],qs[_0xaed5('0x2b')](_0x38e818['query'][_0xaed5('0x2b')]));_0x5d2f13[_0xaed5('0x2a')]=_0x5d2f13[_0xaed5('0x2a')]['length']?_0x5d2f13[_0xaed5('0x2a')]:_0x17cc42[_0xaed5('0x25')];if(!_0x38e818[_0xaed5('0x27')][_0xaed5('0x3d')](_0xaed5('0x3e'))){_0x5d2f13['limit']=qs['limit'](_0x38e818[_0xaed5('0x27')][_0xaed5('0x3f')]);_0x5d2f13[_0xaed5('0x12')]=qs[_0xaed5('0x12')](_0x38e818[_0xaed5('0x27')]['offset']);}_0x5d2f13[_0xaed5('0x40')]=qs[_0xaed5('0x41')](_0x38e818[_0xaed5('0x27')][_0xaed5('0x41')]);_0x5d2f13[_0xaed5('0x42')]=qs[_0xaed5('0x28')](_[_0xaed5('0x43')](_0x38e818[_0xaed5('0x27')],_0x17cc42[_0xaed5('0x28')]));_0x5d2f13[_0xaed5('0x42')][_0xaed5('0x44')]=_0xef85b9['id'];if(_0x38e818['query'][_0xaed5('0x45')]){_0x5d2f13[_0xaed5('0x42')]=_['merge'](_0x5d2f13[_0xaed5('0x42')],{'$or':_['map'](_0x5d2f13[_0xaed5('0x2a')],function(_0x2b618a){var _0x37abd1={};_0x37abd1[_0x2b618a]={'$like':'%'+_0x38e818[_0xaed5('0x27')][_0xaed5('0x45')]+'%'};return _0x37abd1;})});}if(_0x38e818[_0xaed5('0x27')]['$gte']){var _0x492a81=_0x38e818['query'][_0xaed5('0x46')][_0xaed5('0x47')](',');var _0x46b4bf={};_0x46b4bf[_0x492a81[0x0]]={'$gte':moment(_0x492a81[0x1])[_0xaed5('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5d2f13[_0xaed5('0x42')]=_[_0xaed5('0x2f')](_0x5d2f13[_0xaed5('0x42')],_0x46b4bf);}_0x5d2f13=_[_0xaed5('0x2f')]({},_0x5d2f13,_0x38e818[_0xaed5('0x30')]);return db['SmsMessage'][_0xaed5('0x14')]({'where':_0x5d2f13[_0xaed5('0x42')]})[_0xaed5('0x16')](function(_0x4499b2){_0x4a594c[_0xaed5('0x14')]=_0x4499b2;if(_0x38e818[_0xaed5('0x27')]['includeAll']){_0x5d2f13[_0xaed5('0x2e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5d2f13);})['then'](function(_0x4f4228){_0x4a594c[_0xaed5('0x49')]=_0x4f4228;return _0x4a594c;});}})[_0xaed5('0x16')](respondWithFilteredResult(_0x4bde59,_0x5d2f13))[_0xaed5('0x32')](handleError(_0x4bde59,null));};exports[_0xaed5('0x4a')]=function(_0x847f2b,_0x4cd0d3){return db['SmsInteraction'][_0xaed5('0x31')]({'where':{'id':_0x847f2b[_0xaed5('0x24')]['id']}})[_0xaed5('0x16')](handleEntityNotFound(_0x4cd0d3,null))[_0xaed5('0x16')](function(_0x233763){if(_0x233763){return _0x233763['setTags'](_0x847f2b[_0xaed5('0x34')][_0xaed5('0x37')],_[_0xaed5('0x38')](_0x847f2b[_0xaed5('0x34')],[_0xaed5('0x37'),'id'])||{})['spread'](function(){return db[_0xaed5('0x4b')]['findAll']({'attributes':['id','name',_0xaed5('0x4c')],'where':{'id':_0x847f2b[_0xaed5('0x34')]['ids']}});})[_0xaed5('0x16')](function(_0x3a5b5d){socket[_0xaed5('0x4d')](_0xaed5('0x4e'),{'id':Number(_0x847f2b[_0xaed5('0x24')]['id']),'tags':_0x3a5b5d||[]});return{'id':Number(_0x847f2b[_0xaed5('0x24')]['id']),'tags':_0x3a5b5d||[]};});}})[_0xaed5('0x16')](respondWithResult(_0x4cd0d3,null))[_0xaed5('0x32')](handleError(_0x4cd0d3,null));};exports[_0xaed5('0x4f')]=function(_0x13d191,_0x5909ec){return db[_0xaed5('0x26')]['find']({'where':{'id':_0x13d191[_0xaed5('0x24')]['id']}})['then'](handleEntityNotFound(_0x5909ec,null))[_0xaed5('0x16')](function(_0x5c137c){if(_0x5c137c){return _0x5c137c[_0xaed5('0x4f')](_0x13d191['query'][_0xaed5('0x37')]);}})[_0xaed5('0x16')](respondWithStatusCode(_0x5909ec,null))[_0xaed5('0x32')](handleError(_0x5909ec,null));};exports[_0xaed5('0x50')]=function(_0x19a8d5,_0x4c381){var _0x5ea9e0=moment()[_0xaed5('0x51')]()['toString']();var _0x4e8678=path['join'](config[_0xaed5('0x52')],'server',_0xaed5('0x53'),'tmp');var _0x19164e=path[_0xaed5('0x54')](_0x4e8678,_0x5ea9e0);var _0xf124f8=util['format'](_0xaed5('0x55'),_0x19a8d5[_0xaed5('0x24')]['id'],_0x5ea9e0);var _0x4e20ea=path[_0xaed5('0x54')](_0x4e8678,_0xf124f8);var _0x4741a5=[];_0x4741a5['push']({'model':db['User'],'as':_0xaed5('0x56'),'attributes':['id','fullname'],'raw':!![]});_0x4741a5['push']({'model':db[_0xaed5('0x57')],'as':_0xaed5('0x58'),'attributes':['id',_0xaed5('0x59'),_0xaed5('0x5a')],'raw':!![]});var _0x5dea18=[{'model':db['SmsMessage'],'as':_0xaed5('0x5b'),'attributes':['id',_0xaed5('0x34'),_0xaed5('0x5c'),_0xaed5('0x5d'),'secret',_0xaed5('0x5e')],'include':_0x4741a5}];_0x5dea18['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x5dea18['push']({'model':db['User'],'as':_0xaed5('0x5f'),'attributes':['id','fullname']});return db[_0xaed5('0x26')]['find']({'where':{'id':_0x19a8d5[_0xaed5('0x24')]['id']},'include':_0x5dea18})['then'](handleEntityNotFound(_0x4c381,null))[_0xaed5('0x16')](function(_0x40f48a){if(_0x40f48a){var _0x29f11f=_0x40f48a[_0xaed5('0x60')]({'plain':!![]});fs[_0xaed5('0x61')](_0x19164e);var _0x1dc398={'channel':'Sms','account':_0x29f11f[_0xaed5('0x62')]['name'],'agent':_0x29f11f[_0xaed5('0x5f')]?_0x29f11f[_0xaed5('0x5f')][_0xaed5('0x63')]:_0xaed5('0x64'),'createdAt':moment(_0x29f11f[_0xaed5('0x5c')])['format'](_0xaed5('0x65'))[_0xaed5('0x66')](),'closedAt':_0x29f11f[_0xaed5('0x67')]?moment(_0x29f11f['closedAt'])[_0xaed5('0x48')](_0xaed5('0x65'))[_0xaed5('0x66')]():'','disposition':_0x29f11f[_0xaed5('0x68')],'messages':_(_0x29f11f[_0xaed5('0x5b')])['filter']({'secret':![]})[_0xaed5('0x69')](function(_0x4eae33){return{'date':moment(_0x4eae33['createdAt'])[_0xaed5('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaed5('0x66')](),'sender':_0x4eae33['direction']===_0xaed5('0x6a')?_0x4eae33[_0xaed5('0x56')]?_0x4eae33[_0xaed5('0x56')][_0xaed5('0x63')]:_0xaed5('0x6b'):_0x4eae33['Contact'][_0xaed5('0x59')]+(_0x4eae33[_0xaed5('0x58')][_0xaed5('0x5a')]?'\x20'+_0x4eae33[_0xaed5('0x58')][_0xaed5('0x5a')]:''),'body':_0x4eae33[_0xaed5('0x34')],'direction':_0x4eae33[_0xaed5('0x5d')]===_0xaed5('0x6a')?'A':'C','secret':_0x4eae33['secret'],'read':_0x4eae33[_0xaed5('0x5e')]};})['value']()};return ejs['renderFile'](path['join'](config['root'],_0xaed5('0x6c'),'views','downloadInteraction.ejs'),{'interaction':_0x1dc398})[_0xaed5('0x16')](function(_0x2f8a1c){var _0x178c5f=path['join'](_0x19164e,'transcript-'+_0x29f11f['id']+'-'+_0x5ea9e0+_0xaed5('0x6d'));var _0x1f9ff8={'path':_0x178c5f,'channel':_0xaed5('0x6e'),'interactionId':_0x29f11f['id']};return pdf[_0xaed5('0x6f')](_0x2f8a1c,_0x1f9ff8);})[_0xaed5('0x16')](function(){return new BPromise(function(_0x1cf7e6,_0x5994e8){zipdir(_0x19164e,{'saveTo':_0x4e20ea},function(_0x4fc4c2,_0x533dcd){if(_0x4fc4c2)return _0x5994e8(_0x4fc4c2);return _0x1cf7e6(_0x533dcd);});})[_0xaed5('0x16')](function(){return new BPromise(function(_0x2f57e4,_0x24ffb4){rimraf(_0x19164e,function(_0x1f2ac9){if(_0x1f2ac9)_0x24ffb4(_0x1f2ac9);return _0x2f57e4();});});})[_0xaed5('0x16')](function(){return _0x4c381[_0xaed5('0x50')](_0x4e20ea,_0xf124f8,function(_0x5a109e){if(_0x5a109e){console['log']('err',_0x5a109e);}else{fs[_0xaed5('0x70')](_0x4e20ea);}});});});}else{return _0x4c381[_0xaed5('0xe')](0xc8);}})['catch'](handleError(_0x4c381,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7452a08..b29d736 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 _0x5204=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x419032,_0x3e95dc){var _0x54b9f3=function(_0x3014a9){while(--_0x3014a9){_0x419032['push'](_0x419032['shift']());}};_0x54b9f3(++_0x3e95dc);}(_0x5204,0xdf));var _0x4520=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x5204[_0xa60623];return _0x4a6487;};'use strict';var EventEmitter=require(_0x4520('0x0'));var SmsInteraction=require(_0x4520('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4520('0x1'))['db'][_0x4520('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4520('0x3')](0x0);var events={'afterCreate':_0x4520('0x4'),'afterUpdate':_0x4520('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d89c){return function(_0x58b8a8,_0x180174,_0x209381){_0x58b8a8[_0x4520('0x6')]({'attributes':['id'],'raw':!![]})[_0x4520('0x7')](function(_0x396d29){_0x58b8a8[_0x4520('0x8')](_0x4520('0x9'),_0x396d29['map'](function(_0x297f0a){return{'id':_0x297f0a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x58b8a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4520('0x7')](function(_0x37a617){_0x58b8a8[_0x4520('0x8')](_0x4520('0xa'),_0x37a617[_0x4520('0xb')]);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c+':'+_0x58b8a8['id'],_0x58b8a8);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c,_0x58b8a8);_0x209381(null);})[_0x4520('0xd')](_0x209381(null));};}for(var e in events){if(events[_0x4520('0xe')](e)){var event=events[e];SmsInteraction[_0x4520('0xf')](e,emitEvent(event));}}module[_0x4520('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x4e13b0,_0x1ca561){var _0x5c2a63=function(_0xc1d181){while(--_0xc1d181){_0x4e13b0['push'](_0x4e13b0['shift']());}};_0x5c2a63(++_0x1ca561);}(_0xef0f,0x168));var _0xfef0=function(_0x13eec2,_0xe78b42){_0x13eec2=_0x13eec2-0x0;var _0x46c367=_0xef0f[_0x13eec2];return _0x46c367;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 21feb7e..3aa3d99 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 _0x33a6=['define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','./smsInteraction.attributes','exports'];(function(_0x10a30e,_0xa0a0ed){var _0x56d163=function(_0x41a53c){while(--_0x41a53c){_0x10a30e['push'](_0x10a30e['shift']());}};_0x56d163(++_0xa0a0ed);}(_0x33a6,0xbb));var _0x633a=function(_0x18e7ab,_0x2822d6){_0x18e7ab=_0x18e7ab-0x0;var _0x187b58=_0x33a6[_0x18e7ab];return _0x187b58;};'use strict';var _=require(_0x633a('0x0'));var util=require(_0x633a('0x1'));var logger=require(_0x633a('0x2'))(_0x633a('0x3'));var moment=require(_0x633a('0x4'));var BPromise=require(_0x633a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x633a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x633a('0x7'));module[_0x633a('0x8')]=function(_0x1786dd,_0x420518){return _0x1786dd[_0x633a('0x9')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1449a6,_0x18cebe,_0x3cdab3){if(_0x1449a6['changed'](_0x633a('0xa'))){_0x1449a6[_0x633a('0xb')]=moment()[_0x633a('0xc')](_0x633a('0xd'));}_0x3cdab3(null,_0x1449a6);}}});}; \ No newline at end of file +var _0xc4f2=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4f2,0xd3));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c4f('0x0'));var util=require('util');var logger=require(_0x2c4f('0x1'))('api');var moment=require(_0x2c4f('0x2'));var BPromise=require(_0x2c4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c4f('0x4'));var config=require(_0x2c4f('0x5'));var attributes=require(_0x2c4f('0x6'));module['exports']=function(_0x107303,_0x26ac70){return _0x107303[_0x2c4f('0x7')](_0x2c4f('0x8'),attributes,{'tableName':_0x2c4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x575979,_0x40db31,_0x2d4de4){if(_0x575979[_0x2c4f('0xa')](_0x2c4f('0xb'))){_0x575979['closedAt']=moment()[_0x2c4f('0xc')](_0x2c4f('0xd'));}_0x2d4de4(null,_0x575979);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2de13ad..8e8b122 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 _0x1ed2=['localhost','socket.io-emitter','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction,\x20%s,\x20%s','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','info','AddTagsToSmsInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2ae493,_0x5b50ac){var _0x4a5000=function(_0x342010){while(--_0x342010){_0x2ae493['push'](_0x2ae493['shift']());}};_0x4a5000(++_0x5b50ac);}(_0x1ed2,0xed));var _0x21ed=function(_0x47b017,_0x52942d){_0x47b017=_0x47b017-0x0;var _0x485638=_0x1ed2[_0x47b017];return _0x485638;};'use strict';var _=require(_0x21ed('0x0'));var util=require(_0x21ed('0x1'));var moment=require(_0x21ed('0x2'));var BPromise=require(_0x21ed('0x3'));var rs=require(_0x21ed('0x4'));var fs=require('fs');var Redis=require(_0x21ed('0x5'));var db=require(_0x21ed('0x6'))['db'];var utils=require(_0x21ed('0x7'));var logger=require('../../config/logger')(_0x21ed('0x8'));var config=require(_0x21ed('0x9'));var jayson=require(_0x21ed('0xa'));var client=jayson[_0x21ed('0xb')][_0x21ed('0xc')]({'port':0x232a});config[_0x21ed('0xd')]=_[_0x21ed('0xe')](config[_0x21ed('0xd')],{'host':_0x21ed('0xf'),'port':0x18eb});var socket=require(_0x21ed('0x10'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4845e4,_0x3dfd61,_0x3fea6b){return new BPromise(function(_0x35e3ea,_0x2a488e){return client['request'](_0x4845e4,_0x3fea6b)[_0x21ed('0x11')](function(_0x563de0){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3dfd61,_0x21ed('0x12'));logger[_0x21ed('0x13')](_0x21ed('0x14'),_0x3dfd61,_0x21ed('0x12'),JSON[_0x21ed('0x15')](_0x563de0));if(_0x563de0[_0x21ed('0x16')]){if(_0x563de0['error'][_0x21ed('0x17')]===0x1f4){logger[_0x21ed('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x3dfd61,_0x563de0[_0x21ed('0x16')][_0x21ed('0x18')]);return _0x2a488e(_0x563de0['error'][_0x21ed('0x18')]);}logger[_0x21ed('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x3dfd61,_0x563de0[_0x21ed('0x16')][_0x21ed('0x18')]);return _0x35e3ea(_0x563de0[_0x21ed('0x16')][_0x21ed('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3dfd61,_0x21ed('0x12'));_0x35e3ea(_0x563de0[_0x21ed('0x19')]['message']);}})[_0x21ed('0x1a')](function(_0x522398){logger[_0x21ed('0x16')](_0x21ed('0x1b'),_0x3dfd61,_0x522398);_0x2a488e(_0x522398);});});}exports[_0x21ed('0x1c')]=function(_0x339916){var _0x1d8aef=this;return new Promise(function(_0x40f2d1,_0x24b4f5){return db[_0x21ed('0x1d')][_0x21ed('0x1e')](_0x339916[_0x21ed('0x1f')],{'raw':_0x339916[_0x21ed('0x20')]?_0x339916[_0x21ed('0x20')][_0x21ed('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339916['options']?_0x339916[_0x21ed('0x20')][_0x21ed('0x22')]||null:null,'attributes':_0x339916[_0x21ed('0x20')]?_0x339916[_0x21ed('0x20')]['attributes']||null:null,'limit':_0x339916[_0x21ed('0x20')]?_0x339916[_0x21ed('0x20')][_0x21ed('0x23')]||null:null})[_0x21ed('0x11')](function(_0x2afbe4){logger[_0x21ed('0x24')](_0x21ed('0x1c'),_0x339916);logger[_0x21ed('0x13')]('UpdateSmsInteraction',_0x339916,JSON['stringify'](_0x2afbe4));_0x40f2d1(_0x2afbe4);})['catch'](function(_0x2837d){logger['error'](_0x21ed('0x1c'),_0x2837d[_0x21ed('0x18')],_0x339916);_0x24b4f5(_0x1d8aef['error'](0x1f4,_0x2837d[_0x21ed('0x18')]));});});};exports[_0x21ed('0x25')]=function(_0x5ec565){return new Promise(function(_0x50ed47,_0x52a4dd){return db['SmsInteraction']['find']({'where':_0x5ec565[_0x21ed('0x20')]?_0x5ec565['options'][_0x21ed('0x22')]||null:null})[_0x21ed('0x11')](function(_0x1908d4){if(_0x1908d4){return _0x1908d4['addTags'](_0x5ec565[_0x21ed('0x1f')][_0x21ed('0x26')],_[_0x21ed('0x27')](_0x5ec565[_0x21ed('0x1f')],['ids','id'])||{});}})[_0x21ed('0x28')](function(_0x1a7f08){logger[_0x21ed('0x24')](_0x21ed('0x29'),_0x5ec565);logger['debug'](_0x21ed('0x29'),_0x5ec565,JSON[_0x21ed('0x15')](_0x1a7f08));_0x50ed47(_0x1a7f08);})[_0x21ed('0x1a')](function(_0x4f0af5){logger[_0x21ed('0x16')](_0x21ed('0x29'),_0x4f0af5[_0x21ed('0x18')],_0x5ec565);_0x52a4dd(_this[_0x21ed('0x16')](0x1f4,_0x4f0af5[_0x21ed('0x18')]));});});}; \ No newline at end of file +var _0xd01e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','info','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x236d67,_0x2495ca){var _0x48c090=function(_0x59b5ba){while(--_0x59b5ba){_0x236d67['push'](_0x236d67['shift']());}};_0x48c090(++_0x2495ca);}(_0xd01e,0x84));var _0xed01=function(_0x104f85,_0x32e6de){_0x104f85=_0x104f85-0x0;var _0x465afa=_0xd01e[_0x104f85];return _0x465afa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed01('0x0'));var BPromise=require(_0xed01('0x1'));var rs=require(_0xed01('0x2'));var fs=require('fs');var Redis=require(_0xed01('0x3'));var db=require(_0xed01('0x4'))['db'];var utils=require(_0xed01('0x5'));var logger=require(_0xed01('0x6'))(_0xed01('0x7'));var config=require(_0xed01('0x8'));var jayson=require(_0xed01('0x9'));var client=jayson[_0xed01('0xa')][_0xed01('0xb')]({'port':0x232a});config[_0xed01('0xc')]=_[_0xed01('0xd')](config[_0xed01('0xc')],{'host':_0xed01('0xe'),'port':0x18eb});var socket=require(_0xed01('0xf'))(new Redis(config[_0xed01('0xc')]));require(_0xed01('0x10'))[_0xed01('0x11')](socket);function respondWithRpcPromise(_0x7cccf1,_0x77a0eb,_0x565d95){return new BPromise(function(_0x38fb1a,_0x182d8b){return client[_0xed01('0x12')](_0x7cccf1,_0x565d95)[_0xed01('0x13')](function(_0x11b989){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x77a0eb,'request\x20sent');logger[_0xed01('0x14')](_0xed01('0x15'),_0x77a0eb,_0xed01('0x16'),JSON[_0xed01('0x17')](_0x11b989));if(_0x11b989[_0xed01('0x18')]){if(_0x11b989[_0xed01('0x18')][_0xed01('0x19')]===0x1f4){logger[_0xed01('0x18')](_0xed01('0x1a'),_0x77a0eb,_0x11b989[_0xed01('0x18')][_0xed01('0x1b')]);return _0x182d8b(_0x11b989[_0xed01('0x18')][_0xed01('0x1b')]);}logger[_0xed01('0x18')](_0xed01('0x1a'),_0x77a0eb,_0x11b989[_0xed01('0x18')]['message']);return _0x38fb1a(_0x11b989[_0xed01('0x18')][_0xed01('0x1b')]);}else{logger['info'](_0xed01('0x1a'),_0x77a0eb,_0xed01('0x16'));_0x38fb1a(_0x11b989[_0xed01('0x1c')][_0xed01('0x1b')]);}})[_0xed01('0x1d')](function(_0x56c797){logger[_0xed01('0x18')](_0xed01('0x1a'),_0x77a0eb,_0x56c797);_0x182d8b(_0x56c797);});});}exports['UpdateSmsInteraction']=function(_0x5dd786){var _0x4d6dc9=this;return new Promise(function(_0x44577c,_0x316ec1){return db[_0xed01('0x1e')][_0xed01('0x1f')](_0x5dd786[_0xed01('0x20')],{'raw':_0x5dd786[_0xed01('0x21')]?_0x5dd786[_0xed01('0x21')][_0xed01('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd786[_0xed01('0x21')]?_0x5dd786[_0xed01('0x21')][_0xed01('0x23')]||null:null,'attributes':_0x5dd786[_0xed01('0x21')]?_0x5dd786[_0xed01('0x21')][_0xed01('0x24')]||null:null,'limit':_0x5dd786[_0xed01('0x21')]?_0x5dd786[_0xed01('0x21')][_0xed01('0x25')]||null:null})['then'](function(_0x3d3fe5){logger[_0xed01('0x26')](_0xed01('0x27'),_0x5dd786);logger[_0xed01('0x14')](_0xed01('0x27'),_0x5dd786,JSON['stringify'](_0x3d3fe5));_0x44577c(_0x3d3fe5);})[_0xed01('0x1d')](function(_0x56b7c5){logger['error'](_0xed01('0x27'),_0x56b7c5[_0xed01('0x1b')],_0x5dd786);_0x316ec1(_0x4d6dc9['error'](0x1f4,_0x56b7c5['message']));});});};exports[_0xed01('0x28')]=function(_0x506a57){return new Promise(function(_0x33a6d7,_0x4e0996){return db['SmsInteraction']['find']({'where':_0x506a57['options']?_0x506a57[_0xed01('0x21')][_0xed01('0x23')]||null:null})[_0xed01('0x13')](function(_0x5004bd){if(_0x5004bd){return _0x5004bd[_0xed01('0x29')](_0x506a57[_0xed01('0x20')][_0xed01('0x2a')],_[_0xed01('0x2b')](_0x506a57[_0xed01('0x20')],['ids','id'])||{});}})[_0xed01('0x2c')](function(_0x494724){logger[_0xed01('0x26')](_0xed01('0x2d'),_0x506a57);logger['debug'](_0xed01('0x2d'),_0x506a57,JSON['stringify'](_0x494724));_0x33a6d7(_0x494724);})['catch'](function(_0x7e8bd5){logger[_0xed01('0x18')](_0xed01('0x2d'),_0x7e8bd5[_0xed01('0x1b')],_0x506a57);_0x4e0996(_this['error'](0x1f4,_0x7e8bd5[_0xed01('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e8085d4..91fb35d 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 _0xe882=['emit','length','./smsInteraction.events','save','remove','update'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xe882,0x7a));var _0x2e88=function(_0x95ca57,_0x3908f9){_0x95ca57=_0x95ca57-0x0;var _0x70015e=_0xe882[_0x95ca57];return _0x70015e;};'use strict';var SmsInteractionEvents=require(_0x2e88('0x0'));var events=[_0x2e88('0x1'),_0x2e88('0x2'),_0x2e88('0x3')];function createListener(_0x5ab6ad,_0x4e18bd){return function(_0x4a49a7){_0x4e18bd[_0x2e88('0x4')](_0x5ab6ad,_0x4a49a7);};}function removeListener(_0x448200,_0x2b5556){return function(){SmsInteractionEvents['removeListener'](_0x448200,_0x2b5556);};}exports['register']=function(_0x363b6a){for(var _0x2889c8=0x0,_0x1203f4=events[_0x2e88('0x5')];_0x2889c8<_0x1203f4;_0x2889c8++){var _0x4b909d=events[_0x2889c8];var _0x294e0d=createListener('smsInteraction:'+_0x4b909d,_0x363b6a);SmsInteractionEvents['on'](_0x4b909d,_0x294e0d);}}; \ No newline at end of file +var _0x1040=['remove','update','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0xf273f9,_0x486198){var _0xb4abcc=function(_0x2f9418){while(--_0x2f9418){_0xf273f9['push'](_0xf273f9['shift']());}};_0xb4abcc(++_0x486198);}(_0x1040,0xe6));var _0x0104=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x1040[_0x2ce6d5];return _0x32d272;};'use strict';var SmsInteractionEvents=require(_0x0104('0x0'));var events=[_0x0104('0x1'),_0x0104('0x2'),_0x0104('0x3')];function createListener(_0x5e410c,_0x4d856e){return function(_0x134101){_0x4d856e[_0x0104('0x4')](_0x5e410c,_0x134101);};}function removeListener(_0x3c1628,_0x78b4f){return function(){SmsInteractionEvents['removeListener'](_0x3c1628,_0x78b4f);};}exports[_0x0104('0x5')]=function(_0x5120c8){for(var _0x29cdd5=0x0,_0x1a6b42=events[_0x0104('0x6')];_0x29cdd5<_0x1a6b42;_0x29cdd5++){var _0x65da2=events[_0x29cdd5];var _0x40e650=createListener(_0x0104('0x7')+_0x65da2,_0x5120c8);SmsInteractionEvents['on'](_0x65da2,_0x40e650);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4a251bf..2f1c3cb 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 _0xecbc=['../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xecbc,0x86));var _0xcecb=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xecbc[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xcecb('0x0'));var util=require(_0xcecb('0x1'));var path=require(_0xcecb('0x2'));var timeout=require(_0xcecb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcecb('0x4'));var auth=require(_0xcecb('0x5'));var interaction=require(_0xcecb('0x6'));var config=require('../../config/environment');var controller=require(_0xcecb('0x7'));router[_0xcecb('0x8')]('/',auth[_0xcecb('0x9')](),controller[_0xcecb('0xa')]);router['get'](_0xcecb('0xb'),auth['isAuthenticated'](),controller[_0xcecb('0xc')]);router[_0xcecb('0x8')](_0xcecb('0xd'),auth[_0xcecb('0x9')](),controller[_0xcecb('0xe')]);router[_0xcecb('0xf')]('/',auth[_0xcecb('0x9')](),interaction[_0xcecb('0x10')](_0xcecb('0x11'),_0xcecb('0x12')),controller[_0xcecb('0x13')]);router[_0xcecb('0xf')]('/:id/status',controller[_0xcecb('0x14')]);router[_0xcecb('0x15')](_0xcecb('0xd'),auth[_0xcecb('0x9')](),controller[_0xcecb('0x16')]);router[_0xcecb('0x15')](_0xcecb('0x17'),auth[_0xcecb('0x9')](),controller[_0xcecb('0x18')]);router[_0xcecb('0x15')](_0xcecb('0x19'),auth[_0xcecb('0x9')](),controller[_0xcecb('0x1a')]);router[_0xcecb('0x1b')](_0xcecb('0xd'),auth[_0xcecb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xde44=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','show','isAuthenticated','sms','smsmessage:create','post','/:id/status','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x4c9854,_0x44531e){var _0x3b78bb=function(_0x677d72){while(--_0x677d72){_0x4c9854['push'](_0x4c9854['shift']());}};_0x3b78bb(++_0x44531e);}(_0xde44,0x160));var _0x4de4=function(_0x344e53,_0x10ddf9){_0x344e53=_0x344e53-0x0;var _0x3f3439=_0xde44[_0x344e53];return _0x3f3439;};'use strict';var multer=require(_0x4de4('0x0'));var util=require(_0x4de4('0x1'));var path=require(_0x4de4('0x2'));var timeout=require(_0x4de4('0x3'));var express=require('express');var router=express[_0x4de4('0x4')]();var fs_extra=require(_0x4de4('0x5'));var auth=require(_0x4de4('0x6'));var interaction=require(_0x4de4('0x7'));var config=require(_0x4de4('0x8'));var controller=require('./smsMessage.controller');router[_0x4de4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4de4('0xa')]);router[_0x4de4('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4de4('0xb')]);router[_0x4de4('0x9')](_0x4de4('0xc'),auth['isAuthenticated'](),controller[_0x4de4('0xd')]);router['post']('/',auth[_0x4de4('0xe')](),interaction['tracked'](_0x4de4('0xf'),_0x4de4('0x10')),controller['create']);router[_0x4de4('0x11')](_0x4de4('0x12'),controller['status']);router['put'](_0x4de4('0xc'),auth[_0x4de4('0xe')](),controller[_0x4de4('0x13')]);router['put'](_0x4de4('0x14'),auth[_0x4de4('0xe')](),controller[_0x4de4('0x15')]);router['put'](_0x4de4('0x16'),auth['isAuthenticated'](),controller[_0x4de4('0x17')]);router[_0x4de4('0x18')](_0x4de4('0xc'),auth[_0x4de4('0xe')](),controller[_0x4de4('0x19')]);module[_0x4de4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 02674bc..9f19c38 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 _0x5827=['DATE','BOOLEAN','sequelize','exports','TEXT','out'];(function(_0x40a992,_0x1fb4b4){var _0x19c98d=function(_0x5df076){while(--_0x5df076){_0x40a992['push'](_0x40a992['shift']());}};_0x19c98d(++_0x1fb4b4);}(_0x5827,0xb0));var _0x7582=function(_0x146b8d,_0x3d4467){_0x146b8d=_0x146b8d-0x0;var _0x2fe335=_0x5827[_0x146b8d];return _0x2fe335;};'use strict';var Sequelize=require(_0x7582('0x0'));module[_0x7582('0x1')]={'body':{'type':Sequelize[_0x7582('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7582('0x3')),'defaultValue':_0x7582('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7582('0x4')]},'secret':{'type':Sequelize[_0x7582('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7582('0x2')]}}; \ No newline at end of file +var _0x548b=['TEXT','medium','BOOLEAN','ENUM','STRING','DATE','sequelize'];(function(_0x1a6618,_0x4d4067){var _0x34a2c4=function(_0x5df8d3){while(--_0x5df8d3){_0x1a6618['push'](_0x1a6618['shift']());}};_0x34a2c4(++_0x4d4067);}(_0x548b,0x14f));var _0xb548=function(_0x2e6297,_0x233a17){_0x2e6297=_0x2e6297-0x0;var _0x2a8303=_0x548b[_0x2e6297];return _0x2a8303;};'use strict';var Sequelize=require(_0xb548('0x0'));module['exports']={'body':{'type':Sequelize[_0xb548('0x1')](_0xb548('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb548('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb548('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb548('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb548('0x5')]},'readAt':{'type':Sequelize[_0xb548('0x6')]},'secret':{'type':Sequelize[_0xb548('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb548('0x5')]},'providerResponse':{'type':Sequelize[_0xb548('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 42d40c0..5b4513a 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 _0xfdad=['user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','contact','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','sms-interactions','accept','sms','read','readAt','format','UserId'];(function(_0x119ded,_0x497e72){var _0x22108b=function(_0x3da0cf){while(--_0x3da0cf){_0x119ded['push'](_0x119ded['shift']());}};_0x22108b(++_0x497e72);}(_0xfdad,0x164));var _0xdfda=function(_0x3d187f,_0x5177af){_0x3d187f=_0x3d187f-0x0;var _0x3ccce7=_0xfdad[_0x3d187f];return _0x3ccce7;};'use strict';var emlformat=require(_0xdfda('0x0'));var rimraf=require(_0xdfda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfda('0x2'));var rp=require(_0xdfda('0x3'));var moment=require('moment');var BPromise=require(_0xdfda('0x4'));var Mustache=require(_0xdfda('0x5'));var util=require(_0xdfda('0x6'));var path=require('path');var sox=require(_0xdfda('0x7'));var csv=require(_0xdfda('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfda('0x9'));var _=require(_0xdfda('0xa'));var squel=require(_0xdfda('0xb'));var crypto=require(_0xdfda('0xc'));var jsforce=require(_0xdfda('0xd'));var deskjs=require(_0xdfda('0xe'));var toCsv=require(_0xdfda('0x8'));var querystring=require(_0xdfda('0xf'));var Papa=require(_0xdfda('0x10'));var Redis=require(_0xdfda('0x11'));var authService=require(_0xdfda('0x12'));var qs=require(_0xdfda('0x13'));var as=require(_0xdfda('0x14'));var hardwareService=require(_0xdfda('0x15'));var logger=require(_0xdfda('0x16'))(_0xdfda('0x17'));var utils=require('../../config/utils');var config=require(_0xdfda('0x18'));var licenseUtil=require(_0xdfda('0x19'));var db=require(_0xdfda('0x1a'))['db'];config[_0xdfda('0x1b')]=_[_0xdfda('0x1c')](config['redis'],{'host':_0xdfda('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdfda('0x1e'))[_0xdfda('0x1f')](socket);var jayson=require(_0xdfda('0x20'));var client=jayson['client'][_0xdfda('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xdfda('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xf250d0,_0x19d124,_0x3fe8ff,_0x55b626){return new BPromise(function(_0x5baf98,_0x1a791e){var _0x2f3d09=_0x55b626||client;return _0x2f3d09[_0xdfda('0x22')](_0xf250d0,_0x3fe8ff)[_0xdfda('0x23')](function(_0x4ecc87){logger[_0xdfda('0x24')](_0xdfda('0x25'),_0x19d124,_0xdfda('0x26'));logger[_0xdfda('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19d124,_0xdfda('0x26'),JSON[_0xdfda('0x28')](_0x4ecc87));if(_0x4ecc87[_0xdfda('0x29')]){if(_0x4ecc87['error']['code']===0x1f4){logger['error'](_0xdfda('0x25'),_0x19d124,_0x4ecc87['error'][_0xdfda('0x2a')]);return _0x1a791e(_0x4ecc87[_0xdfda('0x29')][_0xdfda('0x2a')]);}logger[_0xdfda('0x29')](_0xdfda('0x25'),_0x19d124,_0x4ecc87['error'][_0xdfda('0x2a')]);return _0x5baf98(_0x4ecc87[_0xdfda('0x29')]['message']);}else{logger[_0xdfda('0x24')]('SmsMessage,\x20%s,\x20%s',_0x19d124,'request\x20sent');_0x5baf98(_0x4ecc87['result'][_0xdfda('0x2a')]);}})[_0xdfda('0x2b')](function(_0x24f892){logger['error'](_0xdfda('0x25'),_0x19d124,_0x24f892);_0x1a791e(_0x24f892);});});}function respondWithStatusCode(_0x55b0e6,_0x3dc264){_0x3dc264=_0x3dc264||0xcc;return function(_0x2e70c0){if(_0x2e70c0){return _0x55b0e6[_0xdfda('0x2c')](_0x3dc264);}return _0x55b0e6[_0xdfda('0x2d')](_0x3dc264)[_0xdfda('0x2e')]();};}function respondWithResult(_0xb4eac1,_0x9f5aff){_0x9f5aff=_0x9f5aff||0xc8;return function(_0x36727d){if(_0x36727d){return _0xb4eac1['status'](_0x9f5aff)[_0xdfda('0x2f')](_0x36727d);}};}function respondWithFilteredResult(_0x57331a,_0x1e0f8f){return function(_0x594822){if(_0x594822){var _0x12a057=typeof _0x1e0f8f[_0xdfda('0x30')]==='undefined'&&typeof _0x1e0f8f[_0xdfda('0x31')]===_0xdfda('0x32');var _0x4351f6=_0x594822['count'];var _0x29e8ac=_0x12a057?0x0:_0x1e0f8f[_0xdfda('0x30')];var _0x5d3673=_0x12a057?_0x594822[_0xdfda('0x33')]:_0x1e0f8f['offset']+_0x1e0f8f[_0xdfda('0x31')];var _0x20d136;if(_0x5d3673>=_0x4351f6){_0x5d3673=_0x4351f6;_0x20d136=0xc8;}else{_0x20d136=0xce;}_0x57331a[_0xdfda('0x2d')](_0x20d136);return _0x57331a[_0xdfda('0x34')](_0xdfda('0x35'),_0x29e8ac+'-'+_0x5d3673+'/'+_0x4351f6)[_0xdfda('0x2f')](_0x594822);}return null;};}function patchUpdates(_0x4a7e41){return function(_0x1addf5){try{jsonpatch['apply'](_0x1addf5,_0x4a7e41,!![]);}catch(_0x4b9383){return BPromise[_0xdfda('0x36')](_0x4b9383);}return _0x1addf5[_0xdfda('0x37')]();};}function saveUpdates(_0x137031,_0x47ee58){return function(_0x52cc67){if(_0x52cc67){return _0x52cc67[_0xdfda('0x38')](_0x137031)['then'](function(_0xcc78f1){return _0xcc78f1;});}return null;};}function removeEntity(_0x378890,_0x135b70){return function(_0x1ecd0e){if(_0x1ecd0e){return _0x1ecd0e[_0xdfda('0x39')]()[_0xdfda('0x23')](function(){_0x378890[_0xdfda('0x2d')](0xcc)[_0xdfda('0x2e')]();});}};}function handleEntityNotFound(_0x1c30da,_0x5e02a5){return function(_0x593d76){if(!_0x593d76){_0x1c30da[_0xdfda('0x2c')](0x194);}return _0x593d76;};}function handleError(_0x2e0b94,_0x326833){_0x326833=_0x326833||0x1f4;return function(_0x189523){logger[_0xdfda('0x29')](_0x189523[_0xdfda('0x3a')]);if(_0x189523[_0xdfda('0x3b')]){delete _0x189523[_0xdfda('0x3b')];}_0x2e0b94['status'](_0x326833)['send'](_0x189523);};}exports[_0xdfda('0x3c')]=function(_0xa5077f,_0x24176b){var _0xc47138={},_0x5908a3={},_0xd27cc5={'count':0x0,'rows':[]};var _0x46bd17=_[_0xdfda('0x3d')](db[_0xdfda('0x3e')][_0xdfda('0x3f')],function(_0x52dcbf){return{'name':_0x52dcbf[_0xdfda('0x40')],'type':_0x52dcbf[_0xdfda('0x41')][_0xdfda('0x42')]};});_0x5908a3[_0xdfda('0x43')]=_[_0xdfda('0x3d')](_0x46bd17,_0xdfda('0x3b'));_0x5908a3[_0xdfda('0x44')]=_[_0xdfda('0x45')](_0xa5077f[_0xdfda('0x44')]);_0x5908a3[_0xdfda('0x46')]=_[_0xdfda('0x47')](_0x5908a3[_0xdfda('0x43')],_0x5908a3[_0xdfda('0x44')]);_0xc47138['attributes']=_[_0xdfda('0x47')](_0x5908a3[_0xdfda('0x43')],qs[_0xdfda('0x48')](_0xa5077f[_0xdfda('0x44')][_0xdfda('0x48')]));_0xc47138[_0xdfda('0x49')]=_0xc47138['attributes'][_0xdfda('0x4a')]?_0xc47138[_0xdfda('0x49')]:_0x5908a3[_0xdfda('0x43')];if(!_0xa5077f[_0xdfda('0x44')][_0xdfda('0x4b')](_0xdfda('0x4c'))){_0xc47138[_0xdfda('0x31')]=qs[_0xdfda('0x31')](_0xa5077f[_0xdfda('0x44')][_0xdfda('0x31')]);_0xc47138[_0xdfda('0x30')]=qs[_0xdfda('0x30')](_0xa5077f['query'][_0xdfda('0x30')]);}_0xc47138[_0xdfda('0x4d')]=qs[_0xdfda('0x4e')](_0xa5077f[_0xdfda('0x44')][_0xdfda('0x4e')]);_0xc47138['where']=qs['filters'](_[_0xdfda('0x4f')](_0xa5077f[_0xdfda('0x44')],_0x5908a3['filters']),_0x46bd17);if(_0xa5077f['query'][_0xdfda('0x50')]){_0xc47138[_0xdfda('0x51')]=_[_0xdfda('0x52')](_0xc47138['where'],{'$or':_[_0xdfda('0x3d')](_0x46bd17,function(_0x44c46e){if(_0x44c46e[_0xdfda('0x41')]!==_0xdfda('0x53')){var _0x600f68={};_0x600f68[_0x44c46e['name']]={'$like':'%'+_0xa5077f['query'][_0xdfda('0x50')]+'%'};return _0x600f68;}})});}_0xc47138=_[_0xdfda('0x52')]({},_0xc47138,_0xa5077f[_0xdfda('0x54')]);var _0x30d443={'where':_0xc47138[_0xdfda('0x51')]};return db[_0xdfda('0x3e')][_0xdfda('0x33')](_0x30d443)['then'](function(_0x41e9f1){_0xd27cc5['count']=_0x41e9f1;if(_0xa5077f[_0xdfda('0x44')][_0xdfda('0x55')]){_0xc47138[_0xdfda('0x56')]=[{'all':!![]}];}return db[_0xdfda('0x3e')][_0xdfda('0x57')](_0xc47138);})['then'](function(_0x3dc88c){_0xd27cc5[_0xdfda('0x58')]=_0x3dc88c;return _0xd27cc5;})[_0xdfda('0x23')](respondWithFilteredResult(_0x24176b,_0xc47138))[_0xdfda('0x2b')](handleError(_0x24176b,null));};exports['show']=function(_0x2db515,_0x2fb758){var _0x292d84={'raw':!![],'where':{'id':_0x2db515[_0xdfda('0x59')]['id']}},_0x5351fb={};_0x5351fb[_0xdfda('0x43')]=_['keys'](db[_0xdfda('0x3e')][_0xdfda('0x3f')]);_0x5351fb[_0xdfda('0x44')]=_[_0xdfda('0x45')](_0x2db515['query']);_0x5351fb[_0xdfda('0x46')]=_['intersection'](_0x5351fb['model'],_0x5351fb[_0xdfda('0x44')]);_0x292d84[_0xdfda('0x49')]=_[_0xdfda('0x47')](_0x5351fb[_0xdfda('0x43')],qs[_0xdfda('0x48')](_0x2db515[_0xdfda('0x44')]['fields']));_0x292d84['attributes']=_0x292d84[_0xdfda('0x49')]['length']?_0x292d84[_0xdfda('0x49')]:_0x5351fb['model'];if(_0x2db515[_0xdfda('0x44')][_0xdfda('0x55')]){_0x292d84[_0xdfda('0x56')]=[{'all':!![]}];}_0x292d84=_[_0xdfda('0x52')]({},_0x292d84,_0x2db515['options']);return db[_0xdfda('0x3e')][_0xdfda('0x5a')](_0x292d84)[_0xdfda('0x23')](handleEntityNotFound(_0x2fb758,null))[_0xdfda('0x23')](respondWithResult(_0x2fb758,null))[_0xdfda('0x2b')](handleError(_0x2fb758,null));};exports['create']=function(_0xe58ef8,_0x179e87){return db['SmsMessage'][_0xdfda('0x5b')](_0xe58ef8['body'],{})[_0xdfda('0x23')](respondWithResult(_0x179e87,0xc9))['catch'](handleError(_0x179e87,null));};exports[_0xdfda('0x38')]=function(_0xf19b5e,_0x467e50){if(_0xf19b5e[_0xdfda('0x5c')]['id']){delete _0xf19b5e[_0xdfda('0x5c')]['id'];}return db[_0xdfda('0x3e')]['find']({'where':{'id':_0xf19b5e[_0xdfda('0x59')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x467e50,null))[_0xdfda('0x23')](saveUpdates(_0xf19b5e['body'],null))[_0xdfda('0x23')](respondWithResult(_0x467e50,null))[_0xdfda('0x2b')](handleError(_0x467e50,null));};exports[_0xdfda('0x39')]=function(_0x5e9c60,_0x180d2f){return db[_0xdfda('0x3e')][_0xdfda('0x5a')]({'where':{'id':_0x5e9c60[_0xdfda('0x59')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x180d2f,null))[_0xdfda('0x23')](removeEntity(_0x180d2f,null))['catch'](handleError(_0x180d2f,null));};exports['describe']=function(_0x40ebf2,_0x59d895){return db[_0xdfda('0x3e')]['describe']()['then'](respondWithResult(_0x59d895,null))['catch'](handleError(_0x59d895,null));};var interaction_log=require('../../config/logger')(_0xdfda('0x5d'));exports[_0xdfda('0x5e')]=function(_0x4d5c8e,_0x3a7562,_0x5c4c8f){var _0x51974c={'agent':{},'channel':_0xdfda('0x5f')};if(_0x4d5c8e[_0xdfda('0x5c')]['id']){delete _0x4d5c8e[_0xdfda('0x5c')]['id'];}_0x4d5c8e[_0xdfda('0x5c')][_0xdfda('0x60')]=!![];_0x4d5c8e[_0xdfda('0x5c')][_0xdfda('0x61')]=moment()[_0xdfda('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d5c8e[_0xdfda('0x5c')][_0xdfda('0x63')]=_0x4d5c8e['body']['UserId']||_0x4d5c8e[_0xdfda('0x64')]['id'];_0x51974c[_0xdfda('0x65')]['id']=_0x4d5c8e[_0xdfda('0x5c')]['UserId'];return db[_0xdfda('0x3e')][_0xdfda('0x5a')]({'where':{'id':_0x4d5c8e[_0xdfda('0x59')]['id'],'UserId':null}})[_0xdfda('0x23')](handleEntityNotFound(_0x3a7562,null))[_0xdfda('0x23')](saveUpdates(_0x4d5c8e['body'],null))[_0xdfda('0x23')](function(_0x59c2a8){if(_0x59c2a8){_0x51974c[_0xdfda('0x2a')]=_0x59c2a8[_0xdfda('0x66')]({'plain':!![]});return db[_0xdfda('0x67')]['find']({'where':{'id':_0x59c2a8[_0xdfda('0x68')]}});}return null;})[_0xdfda('0x23')](handleEntityNotFound(_0x3a7562,null))[_0xdfda('0x23')](function(_0x3fb84d){if(_0x3fb84d){return _0x3fb84d['update']({'UserId':_0x4d5c8e[_0xdfda('0x5c')][_0xdfda('0x63')],'read1stAt':_[_0xdfda('0x69')](_0x3fb84d[_0xdfda('0x6a')])?moment()['format'](_0xdfda('0x6b')):undefined});}return null;})[_0xdfda('0x23')](function(_0x5f33b3){if(_0x5f33b3){_0x51974c[_0xdfda('0x6c')]=_0x5f33b3[_0xdfda('0x66')]({'plain':!![]});interaction_log[_0xdfda('0x24')](_0xdfda('0x6d'),_0x4d5c8e[_0xdfda('0x64')]['id'],_0x4d5c8e[_0xdfda('0x64')][_0xdfda('0x3b')],_0x4d5c8e[_0xdfda('0x64')][_0xdfda('0x6e')],_0x51974c['interaction']['id'],_0x4d5c8e[_0xdfda('0x5c')]?JSON['stringify'](_0x4d5c8e[_0xdfda('0x5c')]):_0xdfda('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xdfda('0x70'),_0x51974c);}return null;})[_0xdfda('0x23')](function(_0x2b842d){var _0x2e5822=_0xdfda('0x71')+_0x2b842d['message'][_0xdfda('0x72')];return db[_0xdfda('0x73')][_0xdfda('0x44')](_0x2e5822,{'type':db[_0xdfda('0x74')]['QueryTypes'][_0xdfda('0x75')],'raw':!![]})['then'](function(_0x29c775){return _0x29c775;});})[_0xdfda('0x23')](function(_0x954753){if(_0x954753){_0x51974c[_0xdfda('0x2a')]['contact']=_0x954753[0x0];if(!_0x4d5c8e['body']['UserId'])return;return db[_0xdfda('0x76')][_0xdfda('0x5a')]({'where':{'id':_0x4d5c8e['body'][_0xdfda('0x63')],'role':'agent'},'attributes':['id',_0xdfda('0x3b'),'fullname',_0xdfda('0x77'),_0xdfda('0x78')],'raw':!![]});}return null;})['then'](function(_0x437971){if(!_0x437971)return null;_0x51974c[_0xdfda('0x2a')][_0xdfda('0x65')]=_0x437971;return _0x51974c;})['then'](function(_0x34b6cc){if(_0x34b6cc){if(_0x4d5c8e[_0xdfda('0x5c')][_0xdfda('0x79')]){_0x51974c[_0xdfda('0x2a')][_0xdfda('0x7a')]=util[_0xdfda('0x62')](_0xdfda('0x7b'),_0x4d5c8e[_0xdfda('0x64')]['name']);_0x51974c[_0xdfda('0x2a')][_0xdfda('0x7c')]=_0x51974c[_0xdfda('0x7c')];_0x51974c[_0xdfda('0x2a')][_0xdfda('0x7d')]=_0x51974c[_0xdfda('0x7c')];_0x51974c[_0xdfda('0x2a')][_0xdfda('0x7e')]=_0xdfda('0x5e');return respondWithRpcPromise(_0xdfda('0x7f'),'EventManager',{'event':_0xdfda('0x80'),'message':_0x51974c[_0xdfda('0x2a')]},client9002)[_0xdfda('0x23')](function(){return _0x51974c;});}return _0x51974c;}return null;})[_0xdfda('0x23')](respondWithResult(_0x3a7562,null))[_0xdfda('0x2b')](handleError(_0x3a7562,null));};var interaction_log=require(_0xdfda('0x16'))(_0xdfda('0x5d'));exports[_0xdfda('0x36')]=function(_0x827989,_0x4894e1,_0x23b705){var _0x393a70={'agent':{},'channel':_0xdfda('0x5f')};if(_0x827989[_0xdfda('0x5c')]['id']){delete _0x827989[_0xdfda('0x5c')]['id'];}_0x827989['body'][_0xdfda('0x63')]=_0x827989[_0xdfda('0x5c')][_0xdfda('0x63')]||_0x827989['user']['id'];_0x393a70[_0xdfda('0x65')]['id']=_0x827989[_0xdfda('0x5c')][_0xdfda('0x63')];return db[_0xdfda('0x3e')]['find']({'where':{'id':_0x827989[_0xdfda('0x59')]['id'],'UserId':null}})[_0xdfda('0x23')](handleEntityNotFound(_0x4894e1,null))[_0xdfda('0x23')](function(_0x318b13){if(_0x318b13){_0x393a70[_0xdfda('0x2a')]=_0x318b13[_0xdfda('0x66')]({'plain':!![]});return db[_0xdfda('0x67')][_0xdfda('0x5a')]({'where':{'id':_0x318b13[_0xdfda('0x68')]}});}return null;})[_0xdfda('0x23')](handleEntityNotFound(_0x4894e1,null))[_0xdfda('0x23')](function(_0x2618bc){if(_0x2618bc){_0x393a70[_0xdfda('0x6c')]=_0x2618bc['get']({'plain':!![]});interaction_log[_0xdfda('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x827989['user']['id'],_0x827989[_0xdfda('0x64')]['name'],_0x827989['user']['role'],_0x393a70[_0xdfda('0x6c')]['id'],_0x827989[_0xdfda('0x5c')]?JSON['stringify'](_0x827989[_0xdfda('0x5c')]):_0xdfda('0x6f'));return respondWithRpcPromise(_0xdfda('0x81'),_0xdfda('0x82'),_0x393a70);}return null;})[_0xdfda('0x23')](function(_0x3e426f){var _0x4bd1b4=_0xdfda('0x71')+_0x3e426f['message']['ContactId'];return db[_0xdfda('0x73')]['query'](_0x4bd1b4,{'type':db[_0xdfda('0x74')]['QueryTypes'][_0xdfda('0x75')],'raw':!![]})[_0xdfda('0x23')](function(_0xbc7a6d){return _0xbc7a6d;});})[_0xdfda('0x23')](function(_0x20ebfa){if(_0x20ebfa){_0x393a70[_0xdfda('0x2a')][_0xdfda('0x83')]=_0x20ebfa[0x0];if(!_0x827989['body']['UserId'])return;return db['User'][_0xdfda('0x5a')]({'where':{'id':_0x827989['body'][_0xdfda('0x63')],'role':_0xdfda('0x65')},'attributes':['id',_0xdfda('0x3b'),'fullname',_0xdfda('0x77'),_0xdfda('0x78')],'raw':!![]});}return null;})[_0xdfda('0x23')](function(_0x79426){if(!_0x79426)return null;_0x393a70[_0xdfda('0x2a')][_0xdfda('0x65')]=_0x79426;return _0x393a70;})[_0xdfda('0x23')](function(_0x14261c){if(_0x14261c){_0x14261c['message']['interface']=util[_0xdfda('0x62')](_0xdfda('0x7b'),_0x827989[_0xdfda('0x64')][_0xdfda('0x3b')]);_0x14261c[_0xdfda('0x2a')][_0xdfda('0x7c')]=_0x393a70[_0xdfda('0x7c')];_0x14261c[_0xdfda('0x2a')]['motionChannel']=_0x393a70[_0xdfda('0x7c')];_0x14261c['message']['event']=_0xdfda('0x36');respondWithRpcPromise(_0xdfda('0x7f'),'EventManager',{'event':_0xdfda('0x84'),'message':_0x14261c[_0xdfda('0x2a')]},client9002);return _0x393a70;}return null;})['then'](respondWithResult(_0x4894e1,null))['catch'](handleError(_0x4894e1,null));};exports[_0xdfda('0x2d')]=function(_0x2b9a5d,_0x216e05,_0x2e2b95){if(_0x2b9a5d[_0xdfda('0x5c')]['id']){delete _0x2b9a5d[_0xdfda('0x5c')]['id'];}var _0x58cf47;return db[_0xdfda('0x3e')][_0xdfda('0x5a')]({'where':{'id':_0x2b9a5d[_0xdfda('0x59')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x216e05,null))[_0xdfda('0x23')](function(_0x45ba14){if(_0x45ba14){_0x58cf47=_0x45ba14;return db[_0xdfda('0x85')][_0xdfda('0x5a')]({'where':{'id':_0x45ba14[_0xdfda('0x86')]}});}})[_0xdfda('0x23')](handleEntityNotFound(_0x216e05,null))[_0xdfda('0x23')](function(_0x414e70){if(_0x414e70){logger[_0xdfda('0x27')](_0xdfda('0x87'),_0xdfda('0x2d'),_0xdfda('0x88'),_0x414e70[_0xdfda('0x41')],util[_0xdfda('0x89')](_0x2b9a5d[_0xdfda('0x5c')],{'showHidden':![],'depth':null}));switch(_0x414e70[_0xdfda('0x41')]){case'twilio':if(_0x2b9a5d['body'][_0xdfda('0x8a')]&&_0x2b9a5d['body'][_0xdfda('0x8a')]===_0x58cf47[_0xdfda('0x8b')]){return _0x58cf47[_0xdfda('0x38')]({'read':!![]});}else{logger[_0xdfda('0x29')](_0xdfda('0x8c'),_0xdfda('0x2d'),_0xdfda('0x8d'),util[_0xdfda('0x89')](_0x2b9a5d[_0xdfda('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xdfda('0x8e'):if(_0x2b9a5d['body'][_0xdfda('0x8f')]&&_0x2b9a5d[_0xdfda('0x5c')][_0xdfda('0x8f')]===_0x58cf47['messageId']&&_[_0xdfda('0x90')]([_0xdfda('0x91'),_0xdfda('0x92')],_0x2b9a5d[_0xdfda('0x5c')][_0xdfda('0x93')])>=0x0){return _0x58cf47['update']({'read':!![]});}else{logger[_0xdfda('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdfda('0x2d'),'plivio',util[_0xdfda('0x89')](_0x2b9a5d[_0xdfda('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4954be=_0x2b9a5d[_0xdfda('0x5c')][_0xdfda('0x94')][0x0];if(_0x4954be[_0xdfda('0x2d')][_0xdfda('0x95')]===_0xdfda('0x96')){return _0x58cf47['update']({'read':!![]});}else{logger[_0xdfda('0x29')](_0xdfda('0x8c'),_0xdfda('0x2d'),_0xdfda('0x97'),util[_0xdfda('0x89')](_0x2b9a5d[_0xdfda('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x58cf47;}})[_0xdfda('0x23')](respondWithResult(_0x216e05,null))[_0xdfda('0x2b')](handleError(_0x216e05,null));}; \ No newline at end of file +var _0x9627=['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','defaults','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','offset','undefined','limit','count','Content-Range','json','save','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','type','filters','query','attributes','intersection','model','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','create','body','find','describe','read','readAt','format','UserId','user','get','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','sms-interactions','reject','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','internal','rejectmessage','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','inspect','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x9627,0x8a));var _0x7962=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x9627[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0x7962('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7962('0x1'));var jsonpatch=require(_0x7962('0x2'));var rp=require(_0x7962('0x3'));var moment=require(_0x7962('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7962('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7962('0x6'));var csv=require(_0x7962('0x7'));var ejs=require(_0x7962('0x8'));var fs=require('fs');var fs_extra=require(_0x7962('0x9'));var _=require(_0x7962('0xa'));var squel=require('squel');var crypto=require(_0x7962('0xb'));var jsforce=require(_0x7962('0xc'));var deskjs=require(_0x7962('0xd'));var toCsv=require(_0x7962('0x7'));var querystring=require(_0x7962('0xe'));var Papa=require(_0x7962('0xf'));var Redis=require(_0x7962('0x10'));var authService=require(_0x7962('0x11'));var qs=require(_0x7962('0x12'));var as=require(_0x7962('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7962('0x14'))(_0x7962('0x15'));var utils=require(_0x7962('0x16'));var config=require(_0x7962('0x17'));var licenseUtil=require(_0x7962('0x18'));var db=require(_0x7962('0x19'))['db'];config['redis']=_[_0x7962('0x1a')](config[_0x7962('0x1b')],{'host':_0x7962('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7962('0x1b')]));require(_0x7962('0x1d'))[_0x7962('0x1e')](socket);var jayson=require(_0x7962('0x1f'));var client=jayson[_0x7962('0x20')][_0x7962('0x21')]({'port':0x232c});var client9002=jayson[_0x7962('0x20')][_0x7962('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x17652f,_0x2d4b4e,_0x43339c,_0x3bc3c4){return new BPromise(function(_0x390fc8,_0x2f90b1){var _0x44466f=_0x3bc3c4||client;return _0x44466f[_0x7962('0x22')](_0x17652f,_0x43339c)[_0x7962('0x23')](function(_0x9f2745){logger[_0x7962('0x24')](_0x7962('0x25'),_0x2d4b4e,_0x7962('0x26'));logger[_0x7962('0x27')](_0x7962('0x28'),_0x2d4b4e,_0x7962('0x26'),JSON[_0x7962('0x29')](_0x9f2745));if(_0x9f2745['error']){if(_0x9f2745[_0x7962('0x2a')][_0x7962('0x2b')]===0x1f4){logger[_0x7962('0x2a')](_0x7962('0x25'),_0x2d4b4e,_0x9f2745[_0x7962('0x2a')][_0x7962('0x2c')]);return _0x2f90b1(_0x9f2745[_0x7962('0x2a')][_0x7962('0x2c')]);}logger[_0x7962('0x2a')](_0x7962('0x25'),_0x2d4b4e,_0x9f2745['error'][_0x7962('0x2c')]);return _0x390fc8(_0x9f2745[_0x7962('0x2a')][_0x7962('0x2c')]);}else{logger[_0x7962('0x24')](_0x7962('0x25'),_0x2d4b4e,_0x7962('0x26'));_0x390fc8(_0x9f2745['result'][_0x7962('0x2c')]);}})[_0x7962('0x2d')](function(_0x3ad1f7){logger[_0x7962('0x2a')](_0x7962('0x25'),_0x2d4b4e,_0x3ad1f7);_0x2f90b1(_0x3ad1f7);});});}function respondWithStatusCode(_0x37709b,_0x165189){_0x165189=_0x165189||0xcc;return function(_0x37375e){if(_0x37375e){return _0x37709b['sendStatus'](_0x165189);}return _0x37709b['status'](_0x165189)[_0x7962('0x2e')]();};}function respondWithResult(_0x678c30,_0x2c0e9e){_0x2c0e9e=_0x2c0e9e||0xc8;return function(_0x5bb46e){if(_0x5bb46e){return _0x678c30[_0x7962('0x2f')](_0x2c0e9e)['json'](_0x5bb46e);}};}function respondWithFilteredResult(_0x46997b,_0x473a3b){return function(_0x371f18){if(_0x371f18){var _0xa3d21d=typeof _0x473a3b[_0x7962('0x30')]===_0x7962('0x31')&&typeof _0x473a3b[_0x7962('0x32')]==='undefined';var _0x20606d=_0x371f18['count'];var _0x1e351d=_0xa3d21d?0x0:_0x473a3b['offset'];var _0x21bda6=_0xa3d21d?_0x371f18[_0x7962('0x33')]:_0x473a3b[_0x7962('0x30')]+_0x473a3b[_0x7962('0x32')];var _0x29c61a;if(_0x21bda6>=_0x20606d){_0x21bda6=_0x20606d;_0x29c61a=0xc8;}else{_0x29c61a=0xce;}_0x46997b[_0x7962('0x2f')](_0x29c61a);return _0x46997b['set'](_0x7962('0x34'),_0x1e351d+'-'+_0x21bda6+'/'+_0x20606d)[_0x7962('0x35')](_0x371f18);}return null;};}function patchUpdates(_0x3522db){return function(_0x3a6b3a){try{jsonpatch['apply'](_0x3a6b3a,_0x3522db,!![]);}catch(_0x55d8cf){return BPromise['reject'](_0x55d8cf);}return _0x3a6b3a[_0x7962('0x36')]();};}function saveUpdates(_0x21a831,_0x5438f3){return function(_0x3cb72b){if(_0x3cb72b){return _0x3cb72b[_0x7962('0x37')](_0x21a831)[_0x7962('0x23')](function(_0xc4f12d){return _0xc4f12d;});}return null;};}function removeEntity(_0x79312f,_0x4d6577){return function(_0x528e96){if(_0x528e96){return _0x528e96[_0x7962('0x38')]()[_0x7962('0x23')](function(){_0x79312f['status'](0xcc)[_0x7962('0x2e')]();});}};}function handleEntityNotFound(_0x2c1e99,_0x5657f7){return function(_0x1974ab){if(!_0x1974ab){_0x2c1e99[_0x7962('0x39')](0x194);}return _0x1974ab;};}function handleError(_0x502d71,_0x187119){_0x187119=_0x187119||0x1f4;return function(_0x2f64df){logger[_0x7962('0x2a')](_0x2f64df[_0x7962('0x3a')]);if(_0x2f64df[_0x7962('0x3b')]){delete _0x2f64df[_0x7962('0x3b')];}_0x502d71[_0x7962('0x2f')](_0x187119)[_0x7962('0x3c')](_0x2f64df);};}exports[_0x7962('0x3d')]=function(_0xbc4f25,_0x33af6e){var _0x111e09={},_0x1f0e80={},_0x432cf4={'count':0x0,'rows':[]};var _0x2ccdce=_[_0x7962('0x3e')](db[_0x7962('0x3f')][_0x7962('0x40')],function(_0x26ac9f){return{'name':_0x26ac9f['fieldName'],'type':_0x26ac9f[_0x7962('0x41')]['key']};});_0x1f0e80['model']=_[_0x7962('0x3e')](_0x2ccdce,_0x7962('0x3b'));_0x1f0e80['query']=_['keys'](_0xbc4f25['query']);_0x1f0e80[_0x7962('0x42')]=_['intersection'](_0x1f0e80['model'],_0x1f0e80[_0x7962('0x43')]);_0x111e09[_0x7962('0x44')]=_[_0x7962('0x45')](_0x1f0e80[_0x7962('0x46')],qs['fields'](_0xbc4f25[_0x7962('0x43')]['fields']));_0x111e09[_0x7962('0x44')]=_0x111e09[_0x7962('0x44')]['length']?_0x111e09['attributes']:_0x1f0e80[_0x7962('0x46')];if(!_0xbc4f25[_0x7962('0x43')]['hasOwnProperty'](_0x7962('0x47'))){_0x111e09[_0x7962('0x32')]=qs[_0x7962('0x32')](_0xbc4f25[_0x7962('0x43')]['limit']);_0x111e09[_0x7962('0x30')]=qs[_0x7962('0x30')](_0xbc4f25[_0x7962('0x43')]['offset']);}_0x111e09['order']=qs[_0x7962('0x48')](_0xbc4f25[_0x7962('0x43')][_0x7962('0x48')]);_0x111e09[_0x7962('0x49')]=qs[_0x7962('0x42')](_[_0x7962('0x4a')](_0xbc4f25[_0x7962('0x43')],_0x1f0e80[_0x7962('0x42')]),_0x2ccdce);if(_0xbc4f25[_0x7962('0x43')]['filter']){_0x111e09[_0x7962('0x49')]=_[_0x7962('0x4b')](_0x111e09[_0x7962('0x49')],{'$or':_[_0x7962('0x3e')](_0x2ccdce,function(_0x621c21){if(_0x621c21[_0x7962('0x41')]!==_0x7962('0x4c')){var _0x5c6ac5={};_0x5c6ac5[_0x621c21['name']]={'$like':'%'+_0xbc4f25['query'][_0x7962('0x4d')]+'%'};return _0x5c6ac5;}})});}_0x111e09=_[_0x7962('0x4b')]({},_0x111e09,_0xbc4f25[_0x7962('0x4e')]);var _0xf74597={'where':_0x111e09['where']};return db[_0x7962('0x3f')]['count'](_0xf74597)['then'](function(_0x18082e){_0x432cf4['count']=_0x18082e;if(_0xbc4f25[_0x7962('0x43')][_0x7962('0x4f')]){_0x111e09[_0x7962('0x50')]=[{'all':!![]}];}return db[_0x7962('0x3f')][_0x7962('0x51')](_0x111e09);})[_0x7962('0x23')](function(_0x9ccc1b){_0x432cf4[_0x7962('0x52')]=_0x9ccc1b;return _0x432cf4;})['then'](respondWithFilteredResult(_0x33af6e,_0x111e09))[_0x7962('0x2d')](handleError(_0x33af6e,null));};exports[_0x7962('0x53')]=function(_0x1feeb5,_0x21362c){var _0x443311={'raw':!![],'where':{'id':_0x1feeb5[_0x7962('0x54')]['id']}},_0x2ea416={};_0x2ea416[_0x7962('0x46')]=_[_0x7962('0x55')](db[_0x7962('0x3f')][_0x7962('0x40')]);_0x2ea416['query']=_[_0x7962('0x55')](_0x1feeb5[_0x7962('0x43')]);_0x2ea416['filters']=_[_0x7962('0x45')](_0x2ea416[_0x7962('0x46')],_0x2ea416['query']);_0x443311[_0x7962('0x44')]=_[_0x7962('0x45')](_0x2ea416[_0x7962('0x46')],qs['fields'](_0x1feeb5[_0x7962('0x43')]['fields']));_0x443311['attributes']=_0x443311[_0x7962('0x44')][_0x7962('0x56')]?_0x443311[_0x7962('0x44')]:_0x2ea416[_0x7962('0x46')];if(_0x1feeb5[_0x7962('0x43')][_0x7962('0x4f')]){_0x443311['include']=[{'all':!![]}];}_0x443311=_['merge']({},_0x443311,_0x1feeb5[_0x7962('0x4e')]);return db['SmsMessage']['find'](_0x443311)[_0x7962('0x23')](handleEntityNotFound(_0x21362c,null))[_0x7962('0x23')](respondWithResult(_0x21362c,null))['catch'](handleError(_0x21362c,null));};exports[_0x7962('0x57')]=function(_0x3021bd,_0x47f65f){return db['SmsMessage']['create'](_0x3021bd[_0x7962('0x58')],{})[_0x7962('0x23')](respondWithResult(_0x47f65f,0xc9))['catch'](handleError(_0x47f65f,null));};exports[_0x7962('0x37')]=function(_0x111af9,_0x52ee6c){if(_0x111af9[_0x7962('0x58')]['id']){delete _0x111af9[_0x7962('0x58')]['id'];}return db[_0x7962('0x3f')][_0x7962('0x59')]({'where':{'id':_0x111af9[_0x7962('0x54')]['id']}})['then'](handleEntityNotFound(_0x52ee6c,null))[_0x7962('0x23')](saveUpdates(_0x111af9[_0x7962('0x58')],null))[_0x7962('0x23')](respondWithResult(_0x52ee6c,null))[_0x7962('0x2d')](handleError(_0x52ee6c,null));};exports[_0x7962('0x38')]=function(_0x444b3f,_0x1818bc){return db['SmsMessage'][_0x7962('0x59')]({'where':{'id':_0x444b3f[_0x7962('0x54')]['id']}})[_0x7962('0x23')](handleEntityNotFound(_0x1818bc,null))[_0x7962('0x23')](removeEntity(_0x1818bc,null))[_0x7962('0x2d')](handleError(_0x1818bc,null));};exports[_0x7962('0x5a')]=function(_0x1bfd2a,_0x788fbb){return db['SmsMessage'][_0x7962('0x5a')]()['then'](respondWithResult(_0x788fbb,null))[_0x7962('0x2d')](handleError(_0x788fbb,null));};var interaction_log=require(_0x7962('0x14'))('sms-interactions');exports['accept']=function(_0x224972,_0x2821ee,_0x2cbd75){var _0x4351f0={'agent':{},'channel':'sms'};if(_0x224972[_0x7962('0x58')]['id']){delete _0x224972[_0x7962('0x58')]['id'];}_0x224972[_0x7962('0x58')][_0x7962('0x5b')]=!![];_0x224972['body'][_0x7962('0x5c')]=moment()[_0x7962('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x224972['body']['UserId']=_0x224972[_0x7962('0x58')][_0x7962('0x5e')]||_0x224972[_0x7962('0x5f')]['id'];_0x4351f0['agent']['id']=_0x224972[_0x7962('0x58')][_0x7962('0x5e')];return db[_0x7962('0x3f')][_0x7962('0x59')]({'where':{'id':_0x224972[_0x7962('0x54')]['id'],'UserId':null}})[_0x7962('0x23')](handleEntityNotFound(_0x2821ee,null))[_0x7962('0x23')](saveUpdates(_0x224972[_0x7962('0x58')],null))[_0x7962('0x23')](function(_0x38f152){if(_0x38f152){_0x4351f0['message']=_0x38f152[_0x7962('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x7962('0x59')]({'where':{'id':_0x38f152[_0x7962('0x61')]}});}return null;})[_0x7962('0x23')](handleEntityNotFound(_0x2821ee,null))[_0x7962('0x23')](function(_0x4e054c){if(_0x4e054c){return _0x4e054c[_0x7962('0x37')]({'UserId':_0x224972[_0x7962('0x58')][_0x7962('0x5e')],'read1stAt':_['isNil'](_0x4e054c[_0x7962('0x62')])?moment()[_0x7962('0x5d')](_0x7962('0x63')):undefined});}return null;})[_0x7962('0x23')](function(_0x471ade){if(_0x471ade){_0x4351f0[_0x7962('0x64')]=_0x471ade[_0x7962('0x60')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x224972[_0x7962('0x5f')]['id'],_0x224972[_0x7962('0x5f')][_0x7962('0x3b')],_0x224972[_0x7962('0x5f')][_0x7962('0x65')],_0x4351f0[_0x7962('0x64')]['id'],_0x224972[_0x7962('0x58')]?JSON[_0x7962('0x29')](_0x224972[_0x7962('0x58')]):_0x7962('0x66'));return respondWithRpcPromise(_0x7962('0x67'),_0x7962('0x68'),_0x4351f0);}return null;})[_0x7962('0x23')](function(_0x371107){var _0x4f5e10=_0x7962('0x69')+_0x371107[_0x7962('0x2c')][_0x7962('0x6a')];return db[_0x7962('0x6b')][_0x7962('0x43')](_0x4f5e10,{'type':db['Sequelize'][_0x7962('0x6c')][_0x7962('0x6d')],'raw':!![]})['then'](function(_0x1cfe48){return _0x1cfe48;});})[_0x7962('0x23')](function(_0x20fcbe){if(_0x20fcbe){_0x4351f0[_0x7962('0x2c')][_0x7962('0x6e')]=_0x20fcbe[0x0];if(!_0x224972[_0x7962('0x58')][_0x7962('0x5e')])return;return db[_0x7962('0x6f')][_0x7962('0x59')]({'where':{'id':_0x224972[_0x7962('0x58')][_0x7962('0x5e')],'role':_0x7962('0x70')},'attributes':['id',_0x7962('0x3b'),_0x7962('0x71'),_0x7962('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x49c913){if(!_0x49c913)return null;_0x4351f0[_0x7962('0x2c')][_0x7962('0x70')]=_0x49c913;return _0x4351f0;})[_0x7962('0x23')](function(_0x3e5295){if(_0x3e5295){if(_0x224972[_0x7962('0x58')][_0x7962('0x73')]){_0x4351f0[_0x7962('0x2c')][_0x7962('0x74')]=util[_0x7962('0x5d')](_0x7962('0x75'),_0x224972['user'][_0x7962('0x3b')]);_0x4351f0[_0x7962('0x2c')][_0x7962('0x76')]=_0x4351f0[_0x7962('0x76')];_0x4351f0[_0x7962('0x2c')][_0x7962('0x77')]=_0x4351f0[_0x7962('0x76')];_0x4351f0['message'][_0x7962('0x78')]=_0x7962('0x79');return respondWithRpcPromise(_0x7962('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x4351f0['message']},client9002)[_0x7962('0x23')](function(){return _0x4351f0;});}return _0x4351f0;}return null;})[_0x7962('0x23')](respondWithResult(_0x2821ee,null))[_0x7962('0x2d')](handleError(_0x2821ee,null));};var interaction_log=require(_0x7962('0x14'))(_0x7962('0x7b'));exports[_0x7962('0x7c')]=function(_0x11135a,_0x597559,_0x1df731){var _0x44823e={'agent':{},'channel':_0x7962('0x7d')};if(_0x11135a['body']['id']){delete _0x11135a['body']['id'];}_0x11135a['body']['UserId']=_0x11135a[_0x7962('0x58')]['UserId']||_0x11135a[_0x7962('0x5f')]['id'];_0x44823e['agent']['id']=_0x11135a[_0x7962('0x58')][_0x7962('0x5e')];return db['SmsMessage'][_0x7962('0x59')]({'where':{'id':_0x11135a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x597559,null))[_0x7962('0x23')](function(_0x44b7ac){if(_0x44b7ac){_0x44823e[_0x7962('0x2c')]=_0x44b7ac['get']({'plain':!![]});return db[_0x7962('0x7e')][_0x7962('0x59')]({'where':{'id':_0x44b7ac['SmsInteractionId']}});}return null;})[_0x7962('0x23')](handleEntityNotFound(_0x597559,null))[_0x7962('0x23')](function(_0xc4ba65){if(_0xc4ba65){_0x44823e['interaction']=_0xc4ba65[_0x7962('0x60')]({'plain':!![]});interaction_log[_0x7962('0x24')](_0x7962('0x7f'),_0x11135a[_0x7962('0x5f')]['id'],_0x11135a[_0x7962('0x5f')][_0x7962('0x3b')],_0x11135a[_0x7962('0x5f')][_0x7962('0x65')],_0x44823e[_0x7962('0x64')]['id'],_0x11135a['body']?JSON[_0x7962('0x29')](_0x11135a[_0x7962('0x58')]):'null');return respondWithRpcPromise(_0x7962('0x80'),_0x7962('0x81'),_0x44823e);}return null;})[_0x7962('0x23')](function(_0x5a43fb){var _0x712312='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a43fb[_0x7962('0x2c')]['ContactId'];return db[_0x7962('0x6b')][_0x7962('0x43')](_0x712312,{'type':db[_0x7962('0x82')][_0x7962('0x6c')]['SELECT'],'raw':!![]})[_0x7962('0x23')](function(_0x2b398e){return _0x2b398e;});})['then'](function(_0x2f2d8f){if(_0x2f2d8f){_0x44823e[_0x7962('0x2c')][_0x7962('0x6e')]=_0x2f2d8f[0x0];if(!_0x11135a['body'][_0x7962('0x5e')])return;return db[_0x7962('0x6f')][_0x7962('0x59')]({'where':{'id':_0x11135a[_0x7962('0x58')][_0x7962('0x5e')],'role':_0x7962('0x70')},'attributes':['id','name',_0x7962('0x71'),_0x7962('0x72'),_0x7962('0x83')],'raw':!![]});}return null;})[_0x7962('0x23')](function(_0xa91b1c){if(!_0xa91b1c)return null;_0x44823e[_0x7962('0x2c')][_0x7962('0x70')]=_0xa91b1c;return _0x44823e;})[_0x7962('0x23')](function(_0x387035){if(_0x387035){_0x387035[_0x7962('0x2c')][_0x7962('0x74')]=util[_0x7962('0x5d')]('SIP/%s',_0x11135a[_0x7962('0x5f')][_0x7962('0x3b')]);_0x387035['message'][_0x7962('0x76')]=_0x44823e[_0x7962('0x76')];_0x387035[_0x7962('0x2c')][_0x7962('0x77')]=_0x44823e['channel'];_0x387035[_0x7962('0x2c')][_0x7962('0x78')]=_0x7962('0x7c');respondWithRpcPromise(_0x7962('0x7a'),_0x7962('0x7a'),{'event':_0x7962('0x84'),'message':_0x387035[_0x7962('0x2c')]},client9002);return _0x44823e;}return null;})['then'](respondWithResult(_0x597559,null))[_0x7962('0x2d')](handleError(_0x597559,null));};exports[_0x7962('0x2f')]=function(_0x5aa527,_0x1279fa,_0x4cffb1){if(_0x5aa527[_0x7962('0x58')]['id']){delete _0x5aa527[_0x7962('0x58')]['id'];}var _0x3fba3e;return db[_0x7962('0x3f')][_0x7962('0x59')]({'where':{'id':_0x5aa527[_0x7962('0x54')]['id']}})[_0x7962('0x23')](handleEntityNotFound(_0x1279fa,null))[_0x7962('0x23')](function(_0x26ee61){if(_0x26ee61){_0x3fba3e=_0x26ee61;return db['SmsAccount']['find']({'where':{'id':_0x26ee61[_0x7962('0x85')]}});}})[_0x7962('0x23')](handleEntityNotFound(_0x1279fa,null))[_0x7962('0x23')](function(_0x30fc40){if(_0x30fc40){logger['debug'](_0x7962('0x28'),_0x7962('0x2f'),'received\x20delivery\x20report\x20from',_0x30fc40[_0x7962('0x41')],util['inspect'](_0x5aa527[_0x7962('0x58')],{'showHidden':![],'depth':null}));switch(_0x30fc40[_0x7962('0x41')]){case _0x7962('0x86'):if(_0x5aa527[_0x7962('0x58')][_0x7962('0x87')]&&_0x5aa527[_0x7962('0x58')][_0x7962('0x87')]===_0x3fba3e[_0x7962('0x88')]){return _0x3fba3e[_0x7962('0x37')]({'read':!![]});}else{logger[_0x7962('0x2a')](_0x7962('0x89'),'status','twilio',util['inspect'](_0x5aa527[_0x7962('0x58')],{'showHidden':![],'depth':null}));}break;case _0x7962('0x8a'):if(_0x5aa527[_0x7962('0x58')][_0x7962('0x8b')]&&_0x5aa527[_0x7962('0x58')][_0x7962('0x8b')]===_0x3fba3e['messageId']&&_[_0x7962('0x8c')]([_0x7962('0x8d'),_0x7962('0x8e')],_0x5aa527[_0x7962('0x58')][_0x7962('0x8f')])>=0x0){return _0x3fba3e['update']({'read':!![]});}else{logger[_0x7962('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7962('0x2f'),'plivio',util[_0x7962('0x90')](_0x5aa527[_0x7962('0x58')],{'showHidden':![],'depth':null}));}break;case _0x7962('0x91'):var _0x55e1dd=_0x5aa527[_0x7962('0x58')][_0x7962('0x92')][0x0];if(_0x55e1dd['status'][_0x7962('0x93')]===_0x7962('0x94')){return _0x3fba3e[_0x7962('0x37')]({'read':!![]});}else{logger[_0x7962('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7962('0x2f'),'infobip',util[_0x7962('0x90')](_0x5aa527['body'],{'showHidden':![],'depth':null}));}break;}return _0x3fba3e;}})[_0x7962('0x23')](respondWithResult(_0x1279fa,null))['catch'](handleError(_0x1279fa,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a411a7a..26bf20b 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 _0x93f0=['exports','events','../../mysqldb','SmsMessage','update','remove','emit','hook'];(function(_0x5d6f0a,_0x54fe5e){var _0x108f44=function(_0x16b66c){while(--_0x16b66c){_0x5d6f0a['push'](_0x5d6f0a['shift']());}};_0x108f44(++_0x54fe5e);}(_0x93f0,0x1b9));var _0x093f=function(_0x386b27,_0x51c316){_0x386b27=_0x386b27-0x0;var _0x8c021b=_0x93f0[_0x386b27];return _0x8c021b;};'use strict';var EventEmitter=require(_0x093f('0x0'));var SmsMessage=require(_0x093f('0x1'))['db'][_0x093f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x093f('0x3'),'afterDestroy':_0x093f('0x4')};function emitEvent(_0x46412a){return function(_0x3074cf,_0x5de046,_0x504eeb){SmsMessageEvents[_0x093f('0x5')](_0x46412a+':'+_0x3074cf['id'],_0x3074cf);SmsMessageEvents[_0x093f('0x5')](_0x46412a,_0x3074cf);_0x504eeb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x093f('0x6')](e,emitEvent(event));}}module[_0x093f('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x8874=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x8874,0xa0));var _0x4887=function(_0x5255b0,_0x5909cf){_0x5255b0=_0x5255b0-0x0;var _0x249c0a=_0x8874[_0x5255b0];return _0x249c0a;};'use strict';var EventEmitter=require(_0x4887('0x0'));var SmsMessage=require(_0x4887('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4887('0x2'),'afterUpdate':'update','afterDestroy':_0x4887('0x3')};function emitEvent(_0x17434e){return function(_0x1c27b0,_0xdbba30,_0x3ae695){SmsMessageEvents[_0x4887('0x4')](_0x17434e+':'+_0x1c27b0['id'],_0x1c27b0);SmsMessageEvents[_0x4887('0x4')](_0x17434e,_0x1c27b0);_0x3ae695(null);};}for(var e in events){if(events[_0x4887('0x5')](e)){var event=events[e];SmsMessage[_0x4887('0x6')](e,emitEvent(event));}}module[_0x4887('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ed43c27..3b21e8b 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 _0x4b06=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','phone','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','messages','clickSend','authId','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','sort','length','md5','digest','hex','signature=','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','create','remote','/api/sms/messages/','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x5ec90b,_0x933837){var _0x2dfefe=function(_0x167a53){while(--_0x167a53){_0x5ec90b['push'](_0x5ec90b['shift']());}};_0x2dfefe(++_0x933837);}(_0x4b06,0x1ce));var _0x64b0=function(_0x5624cc,_0x3a998a){_0x5624cc=_0x5624cc-0x0;var _0x108277=_0x4b06[_0x5624cc];return _0x108277;};'use strict';var _=require(_0x64b0('0x0'));var util=require(_0x64b0('0x1'));var logger=require(_0x64b0('0x2'))(_0x64b0('0x3'));var moment=require(_0x64b0('0x4'));var BPromise=require(_0x64b0('0x5'));var rp=require(_0x64b0('0x6'));var fs=require('fs');var path=require(_0x64b0('0x7'));var rimraf=require('rimraf');var config=require(_0x64b0('0x8'));var attributes=require(_0x64b0('0x9'));module[_0x64b0('0xa')]=function(_0x3c1b3b,_0x143804){return _0x3c1b3b[_0x64b0('0xb')](_0x64b0('0xc'),attributes,{'tableName':_0x64b0('0xd'),'paranoid':![],'indexes':[{'name':_0x64b0('0xe'),'fields':[_0x64b0('0xe')]},{'name':_0x64b0('0xf'),'fields':['body'],'type':_0x64b0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3926,_0x4973e4,_0x501aac){var _0x65314f=_0x3c1b3b[_0x64b0('0x11')];var _0x252b35=_0x3a3926[_0x64b0('0x12')]({'plain':!![]});if(_0x252b35[_0x64b0('0x13')]['toLowerCase']()==='in'||_0x252b35['direction'][_0x64b0('0x14')]()===_0x64b0('0x15')&&!_0x252b35[_0x64b0('0x16')]&&!_[_0x64b0('0x17')](_0x252b35[_0x64b0('0x18')])&&!_[_0x64b0('0x17')](_0x252b35[_0x64b0('0x19')])){_0x65314f[_0x64b0('0x1a')][_0x64b0('0x1b')]({'where':{'id':_0x252b35[_0x64b0('0x19')]}})[_0x64b0('0x1c')](function(_0x19a384){if(_0x19a384){_0x19a384[_0x64b0('0x1d')]({'lastMsgAt':_0x252b35['createdAt'],'lastMsgDirection':_0x252b35[_0x64b0('0x13')][_0x64b0('0x14')]()});}})['catch'](function(_0x1f6839){console[_0x64b0('0x1e')](_0x1f6839);});}if(_0x252b35['direction']===_0x64b0('0x15')&&!_0x252b35[_0x64b0('0x16')]){var _0x23c5f8;_0x65314f[_0x64b0('0x1f')][_0x64b0('0x20')]({'where':{'id':_0x252b35[_0x64b0('0x21')]},'raw':!![]})[_0x64b0('0x1c')](function(_0xb67342){_0x23c5f8=_0xb67342;if(_0x23c5f8&&_0x23c5f8['type']){switch(_0x23c5f8['type']){case _0x64b0('0x22'):var _0x54adbd=require(_0x64b0('0x22'));if(_0x23c5f8[_0x64b0('0x23')]&&_0x23c5f8['authToken']&&_0x23c5f8['phone']){var _0x11c205=new _0x54adbd(_0x23c5f8['accountSid'],_0x23c5f8[_0x64b0('0x24')]);_0x11c205['messages'][_0x64b0('0x25')]({'body':_0x252b35['body'],'to':_0x252b35['phone'],'from':_0x23c5f8['phone'],'statusCallback':_0x23c5f8[_0x64b0('0x26')]+_0x64b0('0x27')+_0x252b35['id']+_0x64b0('0x28')+_0x23c5f8['token']})[_0x64b0('0x1c')](function(_0x267a37){if(_0x267a37[_0x64b0('0x29')]){return _0x3a3926['update']({'messageId':_0x267a37['sid']});}})[_0x64b0('0x2a')](function(_0xbd6595){logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),'twilio',util[_0x64b0('0x2d')](_0xbd6595,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),'twilio',_0x64b0('0x2e'));}break;case _0x64b0('0x2f'):var _0x54b342=_0x64b0('0x30');if(_0x23c5f8[_0x64b0('0x31')]&&_0x23c5f8[_0x64b0('0x32')]){var _0x40a8aa={'recipient':[_0x252b35['phone']],'message':_0x252b35[_0x64b0('0x33')],'message_type':_0x23c5f8[_0x64b0('0x34')]};if(_0x23c5f8[_0x64b0('0x34')]&&_0x23c5f8[_0x64b0('0x34')]!=='SI'){_0x40a8aa[_0x64b0('0x35')]=_0x23c5f8[_0x64b0('0x36')];}var _0x5b30ac={'url':_0x54b342+_0x64b0('0x37')+_0x23c5f8[_0x64b0('0x31')]+_0x64b0('0x38')+_0x23c5f8['password'],'method':_0x64b0('0x39')};rp(_0x5b30ac)[_0x64b0('0x1c')](function(_0x571cbd){var _0x50b5e5=_0x571cbd[_0x64b0('0x3a')](';');var _0x54d7cd={'user_key':_0x50b5e5[0x0],'session_key':_0x50b5e5[0x1]};_0x5b30ac={'url':_0x54b342+'sms','method':_0x64b0('0x3b'),'headers':{'user_key':_0x54d7cd[_0x64b0('0x3c')],'Session_key':_0x54d7cd[_0x64b0('0x3d')]},'json':!![],'body':_0x40a8aa};return rp(_0x5b30ac);})[_0x64b0('0x1c')](function(_0x24ea93){if(_0x24ea93[_0x64b0('0x3e')]>=0x1){var _0x52cc3b={'messageId':_0x24ea93[_0x64b0('0x3f')]};if(_0x23c5f8[_0x64b0('0x34')]!=='GP'||!_0x23c5f8[_0x64b0('0x40')]){_0x52cc3b[_0x64b0('0x41')]=!![];}return _0x3a3926[_0x64b0('0x1d')](_0x52cc3b);}else{return logger[_0x64b0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x64b0('0x2c'),_0x64b0('0x2f'),util['inspect'](_0x24ea93,{'showHidden':![],'depth':null}));}})[_0x64b0('0x2a')](function(_0x4b054d){return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x2f'),util[_0x64b0('0x2d')](_0x4b054d,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x2f'),_0x64b0('0x42'));}break;case _0x64b0('0x43'):if(_0x23c5f8[_0x64b0('0x24')]){var _0x1d1518={'recipient':_0x252b35[_0x64b0('0x36')],'message':_0x252b35[_0x64b0('0x33')],'sender':_0x23c5f8[_0x64b0('0x44')]||_0x23c5f8[_0x64b0('0x36')],'authorization':_0x23c5f8[_0x64b0('0x24')]};var _0x4973e4={'method':'POST','uri':_0x64b0('0x45'),'body':_0x1d1518,'json':!![]};rp(_0x4973e4)['then'](function(_0x38853c){var _0x25531c={'messageId':_0x38853c['requestid']};if(!_0x23c5f8[_0x64b0('0x40')]){_0x25531c[_0x64b0('0x41')]=!![];}return _0x3a3926['update'](_0x25531c);})[_0x64b0('0x2a')](function(_0xf6e6ad){logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x43'),util[_0x64b0('0x2d')](_0xf6e6ad,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),'connectel',_0x64b0('0x46'));}break;case'clicksend':if(_0x23c5f8[_0x64b0('0x31')]&&_0x23c5f8[_0x64b0('0x32')]){var _0x1d1518={'messages':[{'source':'xCALLY\x20Motion','to':_0x252b35['phone'],'body':_0x252b35[_0x64b0('0x33')],'from':_0x23c5f8[_0x64b0('0x44')]||_0x23c5f8['phone']}]};var _0x3051ae=util[_0x64b0('0x47')](_0x64b0('0x48'),_0x23c5f8[_0x64b0('0x31')],_0x23c5f8[_0x64b0('0x32')]);var _0x4973e4={'method':'POST','uri':_0x64b0('0x49'),'body':_0x1d1518,'headers':{'Authorization':util[_0x64b0('0x47')]('Basic\x20%s',new Buffer(_0x3051ae)[_0x64b0('0x4a')](_0x64b0('0x4b')))},'json':!![]};rp(_0x4973e4)[_0x64b0('0x1c')](function(_0x349977){if(_0x349977[_0x64b0('0x4c')]>=0xc8&&_0x349977['http_code']<=0xce){if(_0x349977['data']&&_0x349977[_0x64b0('0x4d')][_0x64b0('0x4e')]>0x0){var _0x58a54b=_['head'](_0x349977[_0x64b0('0x4d')][_0x64b0('0x4f')]);var _0x2115b5={'messageId':_0x58a54b['message_id']};if(!_0x23c5f8[_0x64b0('0x40')]){_0x2115b5[_0x64b0('0x41')]=!![];}return _0x3a3926[_0x64b0('0x1d')](_0x2115b5);}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x50'),util[_0x64b0('0x2d')](_0x349977,{'showHidden':![],'depth':null}));}}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x50'),util['inspect'](_0x349977,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a45b9){logger[_0x64b0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x64b0('0x50'),util[_0x64b0('0x2d')](_0x2a45b9,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),'clickSend',_0x64b0('0x42'));}break;case'plivo':if(_0x23c5f8[_0x64b0('0x51')]&&_0x23c5f8[_0x64b0('0x24')]){var _0x1d1518={'dst':_0x252b35[_0x64b0('0x36')],'text':_0x252b35[_0x64b0('0x33')],'src':_0x23c5f8[_0x64b0('0x44')]||_0x23c5f8[_0x64b0('0x36')],'url':_0x23c5f8[_0x64b0('0x26')]+_0x64b0('0x27')+_0x252b35['id']+_0x64b0('0x28')+_0x23c5f8['token']};var _0x3051ae=util[_0x64b0('0x47')](_0x64b0('0x48'),_0x23c5f8[_0x64b0('0x51')],_0x23c5f8[_0x64b0('0x24')]);var _0x4973e4={'method':'POST','uri':util[_0x64b0('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x23c5f8[_0x64b0('0x51')]),'body':_0x1d1518,'headers':{'Authorization':util[_0x64b0('0x47')](_0x64b0('0x52'),new Buffer(_0x3051ae)['toString'](_0x64b0('0x4b')))},'json':!![]};rp(_0x4973e4)[_0x64b0('0x1c')](function(_0x3cf0d8){var _0x2db34d={'messageId':_0x3cf0d8[_0x64b0('0x53')][0x0]};return _0x3a3926['update'](_0x2db34d);})[_0x64b0('0x2a')](function(_0xc28780){logger[_0x64b0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x64b0('0x2c'),_0x64b0('0x54'),util['inspect'](_0xc28780,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x54'),_0x64b0('0x55'));}break;case _0x64b0('0x56'):if(_0x23c5f8[_0x64b0('0x31')]&&_0x23c5f8[_0x64b0('0x32')]){if(_0x23c5f8[_0x64b0('0x57')]){var _0x42cf41={'method':_0x64b0('0x3b'),'uri':_0x23c5f8[_0x64b0('0x57')]+_0x64b0('0x58'),'body':{'username':_0x23c5f8[_0x64b0('0x31')],'password':_0x23c5f8['password']},'json':!![]};return rp(_0x42cf41)[_0x64b0('0x1c')](function(_0x5853fa){var _0x29886b={'method':_0x64b0('0x3b'),'uri':_0x23c5f8[_0x64b0('0x57')]+_0x64b0('0x59'),'body':{'messages':[{'from':_0x23c5f8[_0x64b0('0x36')],'destinations':[{'to':_0x252b35[_0x64b0('0x36')]}],'text':_0x252b35['body'],'notifyUrl':_0x23c5f8[_0x64b0('0x26')]+_0x64b0('0x27')+_0x252b35['id']+_0x64b0('0x28')+_0x23c5f8[_0x64b0('0x5a')],'notifyContentType':_0x64b0('0x5b'),'callbackData':_0x23c5f8[_0x64b0('0x36')]+';'+_0x252b35['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x5853fa[_0x64b0('0x5a')]},'json':!![]};return rp(_0x29886b)[_0x64b0('0x1c')](function(_0x3b6174){if(_0x3b6174[_0x64b0('0x4f')]){var _0xe61858={'messageId':_0x3b6174[_0x64b0('0x4f')][0x0][_0x64b0('0xe')]};if(!_0x23c5f8[_0x64b0('0x40')]){_0xe61858['read']=!![];}return _0x3a3926[_0x64b0('0x1d')](_0xe61858);}else{return logger['error'](_0x64b0('0x2b'),'afterCreate',_0x64b0('0x56'),util[_0x64b0('0x2d')](_0x3b6174,{'showHidden':![],'depth':null}));}});})[_0x64b0('0x2a')](function(_0x3feb9e){return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),'afterCreate',_0x64b0('0x56'),util[_0x64b0('0x2d')](_0x3feb9e,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x64b0('0x56'),_0x64b0('0x5c'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x64b0('0x2c'),_0x64b0('0x56'),_0x64b0('0x42'));}break;case'csc':var _0x3f20a4=require(_0x64b0('0x5d'));if(_0x23c5f8[_0x64b0('0x5e')]){var _0x2f2602={};_0x2f2602[_0x64b0('0x5f')]=_0x23c5f8[_0x64b0('0x31')];_0x2f2602[_0x64b0('0x36')]=_0x252b35[_0x64b0('0x36')];_0x2f2602['sender']=_0x23c5f8[_0x64b0('0x36')];_0x2f2602['text']=_0x252b35['body'];_0x2f2602[_0x64b0('0x60')]=+new Date();var _0x34329e='';var _0x55615b='';var _0x5399c9=Object['keys'](_0x2f2602);_0x5399c9[_0x64b0('0x61')]();for(var _0x37f44e=0x0;_0x37f44e<_0x5399c9[_0x64b0('0x62')];_0x37f44e++){if(_0x34329e!=''){_0x34329e+='&';}_0x34329e+=_0x5399c9[_0x37f44e]+'='+encodeURIComponent(_0x2f2602[_0x5399c9[_0x37f44e]]);_0x55615b+=_0x2f2602[_0x5399c9[_0x37f44e]];}_0x55615b+=_0x23c5f8[_0x64b0('0x5e')];_0x55615b=_0x3f20a4['createHash'](_0x64b0('0x63'))[_0x64b0('0x1d')](_0x55615b)[_0x64b0('0x64')](_0x64b0('0x65'));if(_0x34329e!==''){_0x34329e+='&';}_0x34329e+=_0x64b0('0x66')+_0x55615b;var _0x5b30ac={'method':_0x64b0('0x39'),'uri':_0x23c5f8['baseUrl']+'/external/get/send.php?'+_0x34329e,'json':!![]};return rp(_0x5b30ac)['then'](function(_0x26c974){var _0x171624=Object[_0x64b0('0x67')](_0x26c974);if(_0x26c974[_0x171624[0x0]]['error']&&parseInt(_0x26c974[_0x171624[0x0]][_0x64b0('0x1e')])===0x0){var _0x5b05e1={'messageId':_0x26c974[_0x171624[0x0]][_0x64b0('0x68')]};if(!_0x23c5f8[_0x64b0('0x40')]){_0x5b05e1['read']=!![];}return _0x3a3926[_0x64b0('0x1d')](_0x5b05e1);}else{return logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),'csc',util['inspect'](_0x26c974[_0x64b0('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3651fc){return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),'csc',util[_0x64b0('0x2d')](_0x3651fc,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x64b0('0x2c'),_0x64b0('0x69'),_0x64b0('0x6a'));}break;case _0x64b0('0x6b'):if(_0x23c5f8[_0x64b0('0x5e')]){var _0x5dd5fe={'method':'POST','uri':_0x64b0('0x6c'),'headers':{'Authorization':_0x23c5f8[_0x64b0('0x5e')]},'body':{'content':_0x252b35[_0x64b0('0x33')],'to':[_0x252b35[_0x64b0('0x36')]],'from':_0x23c5f8[_0x64b0('0x36')],'binary':![],'clientMessageId':_0x64b0('0x6d'),'charset':_0x64b0('0x6e')},'json':!![]};rp(_0x5dd5fe)[_0x64b0('0x1c')](function(_0x49ba2e){if(!_0x49ba2e[_0x64b0('0x1e')]){var _0x59904d={'messageId':_0x49ba2e['messages'][0x0][_0x64b0('0x6f')]};if(!_0x23c5f8['deliveryReport']){_0x59904d['read']=!![];}return _0x3a3926[_0x64b0('0x1d')](_0x59904d);}else{return logger['error'](_0x64b0('0x2b'),'afterCreate','clickatell',util[_0x64b0('0x2d')](_0x49ba2e[_0x64b0('0x1e')],{'showHidden':![],'depth':null}));}})[_0x64b0('0x2a')](function(_0x470885){return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x6b'),util[_0x64b0('0x2d')](_0x470885,{'showHidden':![],'depth':null}));});}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),'afterCreate','clickatell',_0x64b0('0x6a'));}break;case _0x64b0('0x70'):if(_0x23c5f8['username']&&_0x23c5f8[_0x64b0('0x32')]){var _0x3051ae=util[_0x64b0('0x47')](_0x64b0('0x48'),_0x23c5f8['username'],_0x23c5f8[_0x64b0('0x32')]);var _0x4973e4={'method':_0x64b0('0x3b'),'uri':_0x64b0('0x71')+_0x23c5f8[_0x64b0('0x72')]+_0x64b0('0x73'),'body':{'to':[_0x252b35[_0x64b0('0x36')]],'text':_0x252b35['body'],'from':_0x23c5f8['phone'],'applicationId':_0x23c5f8['applicationId']},'headers':{'Authorization':util[_0x64b0('0x47')](_0x64b0('0x52'),new Buffer(_0x3051ae)['toString']('base64'))},'json':!![]};rp(_0x4973e4)[_0x64b0('0x1c')](function(_0x2eecfb){if(_0x2eecfb['id']){var _0xe6605c={'messageId':_0x2eecfb['id']};return _0x3a3926['update'](_0xe6605c);}else{logger[_0x64b0('0x1e')](_0x64b0('0x2b'),'afterCreate',_0x64b0('0x70'),util['inspect'](_0x2eecfb,{'showHidden':![],'depth':null}));}})[_0x64b0('0x2a')](function(_0x359e73){logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x70'),util['inspect'](_0x359e73,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x64b0('0x2b'),'afterCreate',_0x64b0('0x70'),_0x64b0('0x42'));}break;case _0x64b0('0x74'):if(_0x23c5f8[_0x64b0('0x5e')]){var _0x4379b4={};var _0x5b30ac={'method':_0x64b0('0x3b'),'uri':_0x64b0('0x75'),'headers':{'Authorization':_0x64b0('0x76')+_0x23c5f8['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x23c5f8[_0x64b0('0x36')],'to':_0x252b35['phone'],'text':_0x252b35['body']},'json':!![]};return rp(_0x5b30ac)[_0x64b0('0x1c')](function(_0x317920){if(_0x317920[_0x64b0('0x77')]==0xca){_0x4379b4['message']=_0x317920;var _0x3212bd={'method':_0x64b0('0x3b'),'uri':_0x64b0('0x78'),'headers':{'Authorization':_0x64b0('0x76')+_0x23c5f8[_0x64b0('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x4379b4[_0x64b0('0x79')][_0x64b0('0x7a')]},'json':!![]};return rp(_0x3212bd)[_0x64b0('0x1c')](function(_0x3ced56){_0x4379b4[_0x64b0('0x7b')]=_0x3ced56;var _0x4e6ff8={'messageId':_0x4379b4['message']['refid'],'read':!![]};return _0x3a3926[_0x64b0('0x1d')](_0x4e6ff8);});}else{return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x74'),util[_0x64b0('0x2d')](_0x317920,{'showHidden':![],'depth':null}));}})[_0x64b0('0x2a')](function(_0x32bd30){return logger['error'](_0x64b0('0x2b'),_0x64b0('0x2c'),'intelepeer',util[_0x64b0('0x2d')](_0x32bd30,{'showHidden':![],'depth':null}));});}else{return logger[_0x64b0('0x1e')](_0x64b0('0x2b'),_0x64b0('0x2c'),_0x64b0('0x74'),'Token\x20not\x20received');}break;}}})[_0x64b0('0x7c')](function(){_0x501aac();});}else{_0x501aac();}}},'charset':_0x64b0('0x7d'),'collate':_0x64b0('0x7e')});}; \ No newline at end of file +var _0xd24c=['length','createHash','md5','digest','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','toLowerCase','direction','out','UserId','SmsInteractionId','SmsInteraction','update','catch','secret','SmsAccount','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','senderString','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','remote','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys'];(function(_0x144bde,_0x80ccdb){var _0x398343=function(_0x50a1a6){while(--_0x50a1a6){_0x144bde['push'](_0x144bde['shift']());}};_0x398343(++_0x80ccdb);}(_0xd24c,0x118));var _0xcd24=function(_0x3a24cc,_0x549fcd){_0x3a24cc=_0x3a24cc-0x0;var _0x22ef11=_0xd24c[_0x3a24cc];return _0x22ef11;};'use strict';var _=require(_0xcd24('0x0'));var util=require(_0xcd24('0x1'));var logger=require(_0xcd24('0x2'))(_0xcd24('0x3'));var moment=require(_0xcd24('0x4'));var BPromise=require(_0xcd24('0x5'));var rp=require(_0xcd24('0x6'));var fs=require('fs');var path=require(_0xcd24('0x7'));var rimraf=require('rimraf');var config=require(_0xcd24('0x8'));var attributes=require(_0xcd24('0x9'));module[_0xcd24('0xa')]=function(_0x2562aa,_0x4d8b14){return _0x2562aa[_0xcd24('0xb')]('SmsMessage',attributes,{'tableName':_0xcd24('0xc'),'paranoid':![],'indexes':[{'name':_0xcd24('0xd'),'fields':[_0xcd24('0xd')]},{'name':'fti_sms_messages','fields':[_0xcd24('0xe')],'type':_0xcd24('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb791b1,_0x3cd3b4,_0x73babb){var _0x5415b8=_0x2562aa[_0xcd24('0x10')];var _0x2ed1a6=_0xb791b1['get']({'plain':!![]});if(_0x2ed1a6['direction'][_0xcd24('0x11')]()==='in'||_0x2ed1a6[_0xcd24('0x12')]['toLowerCase']()===_0xcd24('0x13')&&!_0x2ed1a6['secret']&&!_['isNil'](_0x2ed1a6[_0xcd24('0x14')])&&!_['isNil'](_0x2ed1a6[_0xcd24('0x15')])){_0x5415b8[_0xcd24('0x16')]['findOne']({'where':{'id':_0x2ed1a6[_0xcd24('0x15')]}})['then'](function(_0x3afab7){if(_0x3afab7){_0x3afab7[_0xcd24('0x17')]({'lastMsgAt':_0x2ed1a6['createdAt'],'lastMsgDirection':_0x2ed1a6[_0xcd24('0x12')][_0xcd24('0x11')]()});}})[_0xcd24('0x18')](function(_0x157be8){console['error'](_0x157be8);});}if(_0x2ed1a6[_0xcd24('0x12')]===_0xcd24('0x13')&&!_0x2ed1a6[_0xcd24('0x19')]){var _0x44691c;_0x5415b8[_0xcd24('0x1a')]['find']({'where':{'id':_0x2ed1a6[_0xcd24('0x1b')]},'raw':!![]})[_0xcd24('0x1c')](function(_0x4581ec){_0x44691c=_0x4581ec;if(_0x44691c&&_0x44691c[_0xcd24('0x1d')]){switch(_0x44691c[_0xcd24('0x1d')]){case _0xcd24('0x1e'):var _0x1c2b88=require(_0xcd24('0x1e'));if(_0x44691c[_0xcd24('0x1f')]&&_0x44691c[_0xcd24('0x20')]&&_0x44691c[_0xcd24('0x21')]){var _0x337ef9=new _0x1c2b88(_0x44691c[_0xcd24('0x1f')],_0x44691c[_0xcd24('0x20')]);_0x337ef9['messages'][_0xcd24('0x22')]({'body':_0x2ed1a6[_0xcd24('0xe')],'to':_0x2ed1a6[_0xcd24('0x21')],'from':_0x44691c['phone'],'statusCallback':_0x44691c['remote']+'/api/sms/messages/'+_0x2ed1a6['id']+_0xcd24('0x23')+_0x44691c[_0xcd24('0x24')]})['then'](function(_0x39c3d7){if(_0x39c3d7[_0xcd24('0x25')]){return _0xb791b1[_0xcd24('0x17')]({'messageId':_0x39c3d7[_0xcd24('0x25')]});}})['catch'](function(_0x41e9d6){logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),'twilio',util[_0xcd24('0x29')](_0x41e9d6,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x1e'),_0xcd24('0x2a'));}break;case _0xcd24('0x2b'):var _0x5ac9e6=_0xcd24('0x2c');if(_0x44691c['username']&&_0x44691c[_0xcd24('0x2d')]){var _0x5efdaf={'recipient':[_0x2ed1a6[_0xcd24('0x21')]],'message':_0x2ed1a6[_0xcd24('0xe')],'message_type':_0x44691c['smsMethod']};if(_0x44691c[_0xcd24('0x2e')]&&_0x44691c[_0xcd24('0x2e')]!=='SI'){_0x5efdaf[_0xcd24('0x2f')]=_0x44691c[_0xcd24('0x21')];}var _0x2f5480={'url':_0x5ac9e6+_0xcd24('0x30')+_0x44691c[_0xcd24('0x31')]+_0xcd24('0x32')+_0x44691c[_0xcd24('0x2d')],'method':_0xcd24('0x33')};rp(_0x2f5480)[_0xcd24('0x1c')](function(_0x31ba0b){var _0x1c42d4=_0x31ba0b[_0xcd24('0x34')](';');var _0x4c2852={'user_key':_0x1c42d4[0x0],'session_key':_0x1c42d4[0x1]};_0x2f5480={'url':_0x5ac9e6+_0xcd24('0x35'),'method':_0xcd24('0x36'),'headers':{'user_key':_0x4c2852['user_key'],'Session_key':_0x4c2852[_0xcd24('0x37')]},'json':!![],'body':_0x5efdaf};return rp(_0x2f5480);})[_0xcd24('0x1c')](function(_0xe56713){if(_0xe56713[_0xcd24('0x38')]>=0x1){var _0x4587bc={'messageId':_0xe56713[_0xcd24('0x39')]};if(_0x44691c[_0xcd24('0x2e')]!=='GP'||!_0x44691c[_0xcd24('0x3a')]){_0x4587bc[_0xcd24('0x3b')]=!![];}return _0xb791b1['update'](_0x4587bc);}else{return logger[_0xcd24('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcd24('0x28'),_0xcd24('0x2b'),util[_0xcd24('0x29')](_0xe56713,{'showHidden':![],'depth':null}));}})[_0xcd24('0x18')](function(_0x175eb2){return logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x2b'),util[_0xcd24('0x29')](_0x175eb2,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x44691c[_0xcd24('0x20')]){var _0x3266eb={'recipient':_0x2ed1a6[_0xcd24('0x21')],'message':_0x2ed1a6['body'],'sender':_0x44691c[_0xcd24('0x3c')]||_0x44691c[_0xcd24('0x21')],'authorization':_0x44691c[_0xcd24('0x20')]};var _0x3cd3b4={'method':_0xcd24('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3266eb,'json':!![]};rp(_0x3cd3b4)['then'](function(_0x59cc35){var _0x5afb66={'messageId':_0x59cc35['requestid']};if(!_0x44691c[_0xcd24('0x3a')]){_0x5afb66['read']=!![];}return _0xb791b1[_0xcd24('0x17')](_0x5afb66);})[_0xcd24('0x18')](function(_0x45292d){logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x3d'),util['inspect'](_0x45292d,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x3d'),_0xcd24('0x3e'));}break;case _0xcd24('0x3f'):if(_0x44691c[_0xcd24('0x31')]&&_0x44691c[_0xcd24('0x2d')]){var _0x3266eb={'messages':[{'source':_0xcd24('0x40'),'to':_0x2ed1a6[_0xcd24('0x21')],'body':_0x2ed1a6[_0xcd24('0xe')],'from':_0x44691c[_0xcd24('0x3c')]||_0x44691c['phone']}]};var _0x1a81fe=util[_0xcd24('0x41')]('%s:%s',_0x44691c['username'],_0x44691c[_0xcd24('0x2d')]);var _0x3cd3b4={'method':_0xcd24('0x36'),'uri':_0xcd24('0x42'),'body':_0x3266eb,'headers':{'Authorization':util[_0xcd24('0x41')](_0xcd24('0x43'),new Buffer(_0x1a81fe)[_0xcd24('0x44')](_0xcd24('0x45')))},'json':!![]};rp(_0x3cd3b4)[_0xcd24('0x1c')](function(_0xea6310){if(_0xea6310[_0xcd24('0x46')]>=0xc8&&_0xea6310[_0xcd24('0x46')]<=0xce){if(_0xea6310['data']&&_0xea6310[_0xcd24('0x47')][_0xcd24('0x48')]>0x0){var _0x54f09d=_[_0xcd24('0x49')](_0xea6310['data'][_0xcd24('0x4a')]);var _0xeedb1c={'messageId':_0x54f09d['message_id']};if(!_0x44691c[_0xcd24('0x3a')]){_0xeedb1c[_0xcd24('0x3b')]=!![];}return _0xb791b1[_0xcd24('0x17')](_0xeedb1c);}else{logger[_0xcd24('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcd24('0x4b'),util[_0xcd24('0x29')](_0xea6310,{'showHidden':![],'depth':null}));}}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x4b'),util['inspect'](_0xea6310,{'showHidden':![],'depth':null}));}})['catch'](function(_0x56487c){logger[_0xcd24('0x26')](_0xcd24('0x27'),'afterCreate',_0xcd24('0x4b'),util['inspect'](_0x56487c,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),'afterCreate',_0xcd24('0x4b'),_0xcd24('0x4c'));}break;case _0xcd24('0x4d'):if(_0x44691c['authId']&&_0x44691c[_0xcd24('0x20')]){var _0x3266eb={'dst':_0x2ed1a6['phone'],'text':_0x2ed1a6[_0xcd24('0xe')],'src':_0x44691c[_0xcd24('0x3c')]||_0x44691c[_0xcd24('0x21')],'url':_0x44691c[_0xcd24('0x4e')]+_0xcd24('0x4f')+_0x2ed1a6['id']+'/status?token='+_0x44691c[_0xcd24('0x24')]};var _0x1a81fe=util['format']('%s:%s',_0x44691c[_0xcd24('0x50')],_0x44691c[_0xcd24('0x20')]);var _0x3cd3b4={'method':_0xcd24('0x36'),'uri':util['format'](_0xcd24('0x51'),_0x44691c[_0xcd24('0x50')]),'body':_0x3266eb,'headers':{'Authorization':util[_0xcd24('0x41')]('Basic\x20%s',new Buffer(_0x1a81fe)[_0xcd24('0x44')]('base64'))},'json':!![]};rp(_0x3cd3b4)[_0xcd24('0x1c')](function(_0x1c8aab){var _0x5c1328={'messageId':_0x1c8aab[_0xcd24('0x52')][0x0]};return _0xb791b1[_0xcd24('0x17')](_0x5c1328);})[_0xcd24('0x18')](function(_0x15414f){logger['error'](_0xcd24('0x27'),'afterCreate',_0xcd24('0x4d'),util['inspect'](_0x15414f,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x4d'),_0xcd24('0x53'));}break;case _0xcd24('0x54'):if(_0x44691c['username']&&_0x44691c[_0xcd24('0x2d')]){if(_0x44691c[_0xcd24('0x55')]){var _0x3f3de7={'method':_0xcd24('0x36'),'uri':_0x44691c[_0xcd24('0x55')]+_0xcd24('0x56'),'body':{'username':_0x44691c['username'],'password':_0x44691c[_0xcd24('0x2d')]},'json':!![]};return rp(_0x3f3de7)[_0xcd24('0x1c')](function(_0x4c49e3){var _0xea6d16={'method':_0xcd24('0x36'),'uri':_0x44691c[_0xcd24('0x55')]+_0xcd24('0x57'),'body':{'messages':[{'from':_0x44691c[_0xcd24('0x21')],'destinations':[{'to':_0x2ed1a6['phone']}],'text':_0x2ed1a6['body'],'notifyUrl':_0x44691c['remote']+'/api/sms/messages/'+_0x2ed1a6['id']+_0xcd24('0x23')+_0x44691c[_0xcd24('0x24')],'notifyContentType':_0xcd24('0x58'),'callbackData':_0x44691c['phone']+';'+_0x2ed1a6[_0xcd24('0xe')]}]},'headers':{'Authorization':_0xcd24('0x59')+_0x4c49e3[_0xcd24('0x24')]},'json':!![]};return rp(_0xea6d16)[_0xcd24('0x1c')](function(_0x2df8d4){if(_0x2df8d4[_0xcd24('0x4a')]){var _0x2395f2={'messageId':_0x2df8d4[_0xcd24('0x4a')][0x0][_0xcd24('0xd')]};if(!_0x44691c[_0xcd24('0x3a')]){_0x2395f2[_0xcd24('0x3b')]=!![];}return _0xb791b1[_0xcd24('0x17')](_0x2395f2);}else{return logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x54'),util[_0xcd24('0x29')](_0x2df8d4,{'showHidden':![],'depth':null}));}});})[_0xcd24('0x18')](function(_0x460ca5){return logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x54'),util[_0xcd24('0x29')](_0x460ca5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x54'),_0xcd24('0x5a'));}}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),'afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xcd24('0x5b'):var _0x5b9a95=require(_0xcd24('0x5c'));if(_0x44691c[_0xcd24('0x5d')]){var _0x192c2f={};_0x192c2f[_0xcd24('0x5e')]=_0x44691c[_0xcd24('0x31')];_0x192c2f[_0xcd24('0x21')]=_0x2ed1a6[_0xcd24('0x21')];_0x192c2f[_0xcd24('0x2f')]=_0x44691c[_0xcd24('0x21')];_0x192c2f[_0xcd24('0x5f')]=_0x2ed1a6[_0xcd24('0xe')];_0x192c2f[_0xcd24('0x60')]=+new Date();var _0x227d85='';var _0x1ef2f2='';var _0x1031ff=Object[_0xcd24('0x61')](_0x192c2f);_0x1031ff['sort']();for(var _0x1c9635=0x0;_0x1c9635<_0x1031ff[_0xcd24('0x62')];_0x1c9635++){if(_0x227d85!=''){_0x227d85+='&';}_0x227d85+=_0x1031ff[_0x1c9635]+'='+encodeURIComponent(_0x192c2f[_0x1031ff[_0x1c9635]]);_0x1ef2f2+=_0x192c2f[_0x1031ff[_0x1c9635]];}_0x1ef2f2+=_0x44691c['apiKey'];_0x1ef2f2=_0x5b9a95[_0xcd24('0x63')](_0xcd24('0x64'))['update'](_0x1ef2f2)[_0xcd24('0x65')]('hex');if(_0x227d85!==''){_0x227d85+='&';}_0x227d85+='signature='+_0x1ef2f2;var _0x2f5480={'method':_0xcd24('0x33'),'uri':_0x44691c[_0xcd24('0x55')]+_0xcd24('0x66')+_0x227d85,'json':!![]};return rp(_0x2f5480)[_0xcd24('0x1c')](function(_0x5f34a1){var _0x5c7f26=Object['keys'](_0x5f34a1);if(_0x5f34a1[_0x5c7f26[0x0]]['error']&&parseInt(_0x5f34a1[_0x5c7f26[0x0]][_0xcd24('0x26')])===0x0){var _0xec1478={'messageId':_0x5f34a1[_0x5c7f26[0x0]][_0xcd24('0x67')]};if(!_0x44691c[_0xcd24('0x3a')]){_0xec1478['read']=!![];}return _0xb791b1[_0xcd24('0x17')](_0xec1478);}else{return logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x5b'),util[_0xcd24('0x29')](_0x5f34a1[_0xcd24('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1a1c5b){return logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x5b'),util[_0xcd24('0x29')](_0x1a1c5b,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcd24('0x28'),_0xcd24('0x5b'),_0xcd24('0x68'));}break;case'clickatell':if(_0x44691c['apiKey']){var _0xd5440={'method':'POST','uri':_0xcd24('0x69'),'headers':{'Authorization':_0x44691c['apiKey']},'body':{'content':_0x2ed1a6[_0xcd24('0xe')],'to':[_0x2ed1a6[_0xcd24('0x21')]],'from':_0x44691c['phone'],'binary':![],'clientMessageId':_0xcd24('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0xd5440)[_0xcd24('0x1c')](function(_0x3da7f5){if(!_0x3da7f5[_0xcd24('0x26')]){var _0x264d4f={'messageId':_0x3da7f5['messages'][0x0][_0xcd24('0x6b')]};if(!_0x44691c[_0xcd24('0x3a')]){_0x264d4f['read']=!![];}return _0xb791b1[_0xcd24('0x17')](_0x264d4f);}else{return logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x6c'),util['inspect'](_0x3da7f5[_0xcd24('0x26')],{'showHidden':![],'depth':null}));}})[_0xcd24('0x18')](function(_0x24ee8c){return logger[_0xcd24('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcd24('0x28'),'clickatell',util['inspect'](_0x24ee8c,{'showHidden':![],'depth':null}));});}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),_0xcd24('0x6c'),_0xcd24('0x68'));}break;case _0xcd24('0x6d'):if(_0x44691c['username']&&_0x44691c[_0xcd24('0x2d')]){var _0x1a81fe=util[_0xcd24('0x41')](_0xcd24('0x6e'),_0x44691c[_0xcd24('0x31')],_0x44691c[_0xcd24('0x2d')]);var _0x3cd3b4={'method':'POST','uri':_0xcd24('0x6f')+_0x44691c[_0xcd24('0x70')]+_0xcd24('0x71'),'body':{'to':[_0x2ed1a6[_0xcd24('0x21')]],'text':_0x2ed1a6['body'],'from':_0x44691c[_0xcd24('0x21')],'applicationId':_0x44691c[_0xcd24('0x72')]},'headers':{'Authorization':util['format'](_0xcd24('0x43'),new Buffer(_0x1a81fe)['toString'](_0xcd24('0x45')))},'json':!![]};rp(_0x3cd3b4)[_0xcd24('0x1c')](function(_0x26f865){if(_0x26f865['id']){var _0x138a64={'messageId':_0x26f865['id']};return _0xb791b1['update'](_0x138a64);}else{logger[_0xcd24('0x26')](_0xcd24('0x27'),'afterCreate',_0xcd24('0x6d'),util[_0xcd24('0x29')](_0x26f865,{'showHidden':![],'depth':null}));}})['catch'](function(_0x20ab27){logger['error'](_0xcd24('0x27'),'afterCreate',_0xcd24('0x6d'),util['inspect'](_0x20ab27,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcd24('0x28'),_0xcd24('0x6d'),_0xcd24('0x4c'));}break;case _0xcd24('0x73'):if(_0x44691c[_0xcd24('0x5d')]){var _0x47b3fe={};var _0x2f5480={'method':_0xcd24('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xcd24('0x74')+_0x44691c[_0xcd24('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x44691c[_0xcd24('0x21')],'to':_0x2ed1a6['phone'],'text':_0x2ed1a6[_0xcd24('0xe')]},'json':!![]};return rp(_0x2f5480)[_0xcd24('0x1c')](function(_0x2c5f78){if(_0x2c5f78[_0xcd24('0x75')]==0xca){_0x47b3fe[_0xcd24('0x76')]=_0x2c5f78;var _0xb92572={'method':_0xcd24('0x36'),'uri':_0xcd24('0x77'),'headers':{'Authorization':_0xcd24('0x74')+_0x44691c[_0xcd24('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x47b3fe[_0xcd24('0x76')][_0xcd24('0x78')]},'json':!![]};return rp(_0xb92572)[_0xcd24('0x1c')](function(_0x22be25){_0x47b3fe[_0xcd24('0x79')]=_0x22be25;var _0x1d66ea={'messageId':_0x47b3fe['message'][_0xcd24('0x78')],'read':!![]};return _0xb791b1[_0xcd24('0x17')](_0x1d66ea);});}else{return logger[_0xcd24('0x26')](_0xcd24('0x27'),_0xcd24('0x28'),'intelepeer',util[_0xcd24('0x29')](_0x2c5f78,{'showHidden':![],'depth':null}));}})[_0xcd24('0x18')](function(_0x1e765c){return logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),'intelepeer',util[_0xcd24('0x29')](_0x1e765c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xcd24('0x27'),_0xcd24('0x28'),'intelepeer',_0xcd24('0x7a'));}break;}}})[_0xcd24('0x7b')](function(){_0x73babb();});}else{_0x73babb();}}},'charset':_0xcd24('0x7c'),'collate':_0xcd24('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ba3ae4d..be94b99 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 _0x23cd=['stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x41813b,_0x46638f){var _0x6b8547=function(_0xcea722){while(--_0xcea722){_0x41813b['push'](_0x41813b['shift']());}};_0x6b8547(++_0x46638f);}(_0x23cd,0xab));var _0xd23c=function(_0x11d8e5,_0x33e563){_0x11d8e5=_0x11d8e5-0x0;var _0x1f5477=_0x23cd[_0x11d8e5];return _0x1f5477;};'use strict';var _=require('lodash');var util=require(_0xd23c('0x0'));var moment=require(_0xd23c('0x1'));var BPromise=require(_0xd23c('0x2'));var rs=require(_0xd23c('0x3'));var fs=require('fs');var Redis=require(_0xd23c('0x4'));var db=require(_0xd23c('0x5'))['db'];var utils=require(_0xd23c('0x6'));var logger=require(_0xd23c('0x7'))(_0xd23c('0x8'));var config=require('../../config/environment');var jayson=require(_0xd23c('0x9'));var client=jayson['client'][_0xd23c('0xa')]({'port':0x232a});config['redis']=_[_0xd23c('0xb')](config[_0xd23c('0xc')],{'host':_0xd23c('0xd'),'port':0x18eb});var socket=require(_0xd23c('0xe'))(new Redis(config['redis']));require(_0xd23c('0xf'))['register'](socket);function respondWithRpcPromise(_0x486861,_0x1acdc9,_0x1bf6d1){return new BPromise(function(_0x31f763,_0x4e1e34){return client[_0xd23c('0x10')](_0x486861,_0x1bf6d1)['then'](function(_0x3d0af0){logger[_0xd23c('0x11')](_0xd23c('0x12'),_0x1acdc9,_0xd23c('0x13'));logger['debug'](_0xd23c('0x14'),_0x1acdc9,'request\x20sent',JSON[_0xd23c('0x15')](_0x3d0af0));if(_0x3d0af0['error']){if(_0x3d0af0[_0xd23c('0x16')]['code']===0x1f4){logger['error'](_0xd23c('0x12'),_0x1acdc9,_0x3d0af0[_0xd23c('0x16')][_0xd23c('0x17')]);return _0x4e1e34(_0x3d0af0[_0xd23c('0x16')][_0xd23c('0x17')]);}logger['error'](_0xd23c('0x12'),_0x1acdc9,_0x3d0af0[_0xd23c('0x16')][_0xd23c('0x17')]);return _0x31f763(_0x3d0af0['error'][_0xd23c('0x17')]);}else{logger[_0xd23c('0x11')](_0xd23c('0x12'),_0x1acdc9,'request\x20sent');_0x31f763(_0x3d0af0[_0xd23c('0x18')][_0xd23c('0x17')]);}})[_0xd23c('0x19')](function(_0xf60e91){logger[_0xd23c('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1acdc9,_0xf60e91);_0x4e1e34(_0xf60e91);});});}exports[_0xd23c('0x1a')]=function(_0x3ca97a){var _0xcdfb8e=this;return new Promise(function(_0x4a4100,_0x20e58d){return db[_0xd23c('0x1b')]['create'](_0x3ca97a[_0xd23c('0x1c')],{'raw':_0x3ca97a[_0xd23c('0x1d')]?_0x3ca97a['options'][_0xd23c('0x1e')]===undefined?!![]:![]:!![]})[_0xd23c('0x1f')](function(_0x729681){logger[_0xd23c('0x11')](_0xd23c('0x1a'),_0x3ca97a);logger['debug'](_0xd23c('0x1a'),_0x3ca97a,JSON[_0xd23c('0x15')](_0x729681));_0x4a4100(_0x729681);})[_0xd23c('0x19')](function(_0x4f59aa){logger[_0xd23c('0x16')](_0xd23c('0x1a'),_0x4f59aa['message'],_0x3ca97a);_0x20e58d(_0xcdfb8e[_0xd23c('0x16')](0x1f4,_0x4f59aa[_0xd23c('0x17')]));});});}; \ No newline at end of file +var _0x6dfe=['error','code','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4b14b7,_0x2724df){var _0x5ba6fe=function(_0x31b2a9){while(--_0x31b2a9){_0x4b14b7['push'](_0x4b14b7['shift']());}};_0x5ba6fe(++_0x2724df);}(_0x6dfe,0x10c));var _0xe6df=function(_0xf102b2,_0xa614c4){_0xf102b2=_0xf102b2-0x0;var _0x1ab409=_0x6dfe[_0xf102b2];return _0x1ab409;};'use strict';var _=require(_0xe6df('0x0'));var util=require(_0xe6df('0x1'));var moment=require(_0xe6df('0x2'));var BPromise=require(_0xe6df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6df('0x4'))['db'];var utils=require(_0xe6df('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe6df('0x6'));var jayson=require(_0xe6df('0x7'));var client=jayson[_0xe6df('0x8')]['http']({'port':0x232a});config['redis']=_[_0xe6df('0x9')](config['redis'],{'host':_0xe6df('0xa'),'port':0x18eb});var socket=require(_0xe6df('0xb'))(new Redis(config[_0xe6df('0xc')]));require('./smsMessage.socket')[_0xe6df('0xd')](socket);function respondWithRpcPromise(_0x32b46a,_0x961bbb,_0x500f60){return new BPromise(function(_0x325e2d,_0x27592e){return client[_0xe6df('0xe')](_0x32b46a,_0x500f60)['then'](function(_0x422eb4){logger[_0xe6df('0xf')](_0xe6df('0x10'),_0x961bbb,_0xe6df('0x11'));logger[_0xe6df('0x12')](_0xe6df('0x13'),_0x961bbb,_0xe6df('0x11'),JSON['stringify'](_0x422eb4));if(_0x422eb4[_0xe6df('0x14')]){if(_0x422eb4[_0xe6df('0x14')][_0xe6df('0x15')]===0x1f4){logger['error'](_0xe6df('0x10'),_0x961bbb,_0x422eb4[_0xe6df('0x14')][_0xe6df('0x16')]);return _0x27592e(_0x422eb4['error'][_0xe6df('0x16')]);}logger['error'](_0xe6df('0x10'),_0x961bbb,_0x422eb4[_0xe6df('0x14')]['message']);return _0x325e2d(_0x422eb4['error'][_0xe6df('0x16')]);}else{logger[_0xe6df('0xf')](_0xe6df('0x10'),_0x961bbb,'request\x20sent');_0x325e2d(_0x422eb4[_0xe6df('0x17')][_0xe6df('0x16')]);}})[_0xe6df('0x18')](function(_0x32bf78){logger[_0xe6df('0x14')]('SmsMessage,\x20%s,\x20%s',_0x961bbb,_0x32bf78);_0x27592e(_0x32bf78);});});}exports[_0xe6df('0x19')]=function(_0x3cdf32){var _0x19ae1c=this;return new Promise(function(_0x535d7e,_0x319dcb){return db[_0xe6df('0x1a')]['create'](_0x3cdf32[_0xe6df('0x1b')],{'raw':_0x3cdf32[_0xe6df('0x1c')]?_0x3cdf32['options'][_0xe6df('0x1d')]===undefined?!![]:![]:!![]})[_0xe6df('0x1e')](function(_0x3a77b0){logger['info']('CreateSmsMessage',_0x3cdf32);logger['debug'](_0xe6df('0x19'),_0x3cdf32,JSON[_0xe6df('0x1f')](_0x3a77b0));_0x535d7e(_0x3a77b0);})[_0xe6df('0x18')](function(_0x21c3d3){logger[_0xe6df('0x14')]('CreateSmsMessage',_0x21c3d3[_0xe6df('0x16')],_0x3cdf32);_0x319dcb(_0x19ae1c[_0xe6df('0x14')](0x1f4,_0x21c3d3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a20f394..8f38b3a 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 _0x7e77=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x7e77,0x1e6));var _0x77e7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x7e77[_0x4792c8];return _0x35edb1;};'use strict';var SmsMessageEvents=require(_0x77e7('0x0'));var events=[_0x77e7('0x1'),_0x77e7('0x2'),_0x77e7('0x3')];function createListener(_0x625a8d,_0x305d49){return function(_0x15b4ed){_0x305d49[_0x77e7('0x4')](_0x625a8d,_0x15b4ed);};}function removeListener(_0x4aefd3,_0x30c1c2){return function(){SmsMessageEvents[_0x77e7('0x5')](_0x4aefd3,_0x30c1c2);};}exports[_0x77e7('0x6')]=function(_0xf348d5){for(var _0x407e3f=0x0,_0x27563e=events[_0x77e7('0x7')];_0x407e3f<_0x27563e;_0x407e3f++){var _0x5160ca=events[_0x407e3f];var _0x3f4131=createListener(_0x77e7('0x8')+_0x5160ca,_0xf348d5);SmsMessageEvents['on'](_0x5160ca,_0x3f4131);}}; \ No newline at end of file +var _0xf650=['emit','removeListener','register','length','smsMessage:','update'];(function(_0x2700d5,_0x1b113b){var _0xdc3338=function(_0x1d07ed){while(--_0x1d07ed){_0x2700d5['push'](_0x2700d5['shift']());}};_0xdc3338(++_0x1b113b);}(_0xf650,0x185));var _0x0f65=function(_0x338792,_0x30b638){_0x338792=_0x338792-0x0;var _0x1dc9b3=_0xf650[_0x338792];return _0x1dc9b3;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0x0f65('0x0')];function createListener(_0x23376b,_0x5afee8){return function(_0x545ae1){_0x5afee8[_0x0f65('0x1')](_0x23376b,_0x545ae1);};}function removeListener(_0x112411,_0x26e0ea){return function(){SmsMessageEvents[_0x0f65('0x2')](_0x112411,_0x26e0ea);};}exports[_0x0f65('0x3')]=function(_0x436553){for(var _0x20d6c7=0x0,_0x30b242=events[_0x0f65('0x4')];_0x20d6c7<_0x30b242;_0x20d6c7++){var _0x2625f7=events[_0x20d6c7];var _0x4f00e0=createListener(_0x0f65('0x5')+_0x2625f7,_0x436553);SmsMessageEvents['on'](_0x2625f7,_0x4f00e0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a936c59..7556c8d 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 _0xbaa7=['/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','addTeams'];(function(_0x388e6a,_0x57a323){var _0xc60b64=function(_0x110e36){while(--_0x110e36){_0x388e6a['push'](_0x388e6a['shift']());}};_0xc60b64(++_0x57a323);}(_0xbaa7,0x158));var _0x7baa=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbaa7[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x7baa('0x0'));var util=require(_0x7baa('0x1'));var path=require('path');var timeout=require(_0x7baa('0x2'));var express=require(_0x7baa('0x3'));var router=express[_0x7baa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7baa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7baa('0x6'));var controller=require(_0x7baa('0x7'));router[_0x7baa('0x8')]('/',auth[_0x7baa('0x9')](),controller[_0x7baa('0xa')]);router[_0x7baa('0x8')](_0x7baa('0xb'),auth[_0x7baa('0x9')](),controller['describe']);router['get'](_0x7baa('0xc'),auth[_0x7baa('0x9')](),controller[_0x7baa('0xd')]);router[_0x7baa('0x8')](_0x7baa('0xe'),auth['isAuthenticated'](),controller[_0x7baa('0xf')]);router[_0x7baa('0x8')](_0x7baa('0x10'),auth[_0x7baa('0x9')](),controller['getTeams']);router[_0x7baa('0x8')]('/:id/users',auth[_0x7baa('0x9')](),controller[_0x7baa('0x11')]);router[_0x7baa('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7baa('0x12')](_0x7baa('0x10'),auth[_0x7baa('0x9')](),controller[_0x7baa('0x13')]);router[_0x7baa('0x12')](_0x7baa('0x14'),auth['isAuthenticated'](),controller[_0x7baa('0x15')]);router[_0x7baa('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7baa('0x17')]);router[_0x7baa('0x18')](_0x7baa('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x7baa('0x18')](_0x7baa('0x10'),auth['isAuthenticated'](),controller[_0x7baa('0x19')]);router['delete'](_0x7baa('0x14'),auth['isAuthenticated'](),controller[_0x7baa('0x1a')]);module[_0x7baa('0x1b')]=router; \ No newline at end of file +var _0x0dcc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','/:id','update','destroy','removeAgents','exports','util','path','express'];(function(_0x552237,_0xad1067){var _0x21919c=function(_0x239365){while(--_0x239365){_0x552237['push'](_0x552237['shift']());}};_0x21919c(++_0xad1067);}(_0x0dcc,0x1e3));var _0xc0dc=function(_0x45b135,_0x1e3d55){_0x45b135=_0x45b135-0x0;var _0x147fba=_0x0dcc[_0x45b135];return _0x147fba;};'use strict';var multer=require('multer');var util=require(_0xc0dc('0x0'));var path=require(_0xc0dc('0x1'));var timeout=require('connect-timeout');var express=require(_0xc0dc('0x2'));var router=express[_0xc0dc('0x3')]();var fs_extra=require(_0xc0dc('0x4'));var auth=require(_0xc0dc('0x5'));var interaction=require(_0xc0dc('0x6'));var config=require(_0xc0dc('0x7'));var controller=require(_0xc0dc('0x8'));router[_0xc0dc('0x9')]('/',auth[_0xc0dc('0xa')](),controller[_0xc0dc('0xb')]);router['get'](_0xc0dc('0xc'),auth[_0xc0dc('0xa')](),controller[_0xc0dc('0xd')]);router[_0xc0dc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc0dc('0xe')]);router[_0xc0dc('0x9')](_0xc0dc('0xf'),auth[_0xc0dc('0xa')](),controller[_0xc0dc('0x10')]);router['get'](_0xc0dc('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xc0dc('0x9')](_0xc0dc('0x12'),auth[_0xc0dc('0xa')](),controller[_0xc0dc('0x13')]);router[_0xc0dc('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0xc0dc('0xa')](),controller[_0xc0dc('0x15')]);router[_0xc0dc('0x14')](_0xc0dc('0x12'),auth[_0xc0dc('0xa')](),controller['addAgents']);router['put'](_0xc0dc('0x16'),auth[_0xc0dc('0xa')](),controller[_0xc0dc('0x17')]);router['delete'](_0xc0dc('0x16'),auth[_0xc0dc('0xa')](),controller[_0xc0dc('0x18')]);router['delete']('/:id/teams',auth[_0xc0dc('0xa')](),controller['removeTeams']);router['delete'](_0xc0dc('0x12'),auth['isAuthenticated'](),controller[_0xc0dc('0x19')]);module[_0xc0dc('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 eb3cba9..1b6f6b7 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 _0x013f=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x1c1f1f,_0x4addd5){var _0x19b499=function(_0x5d47c1){while(--_0x5d47c1){_0x1c1f1f['push'](_0x1c1f1f['shift']());}};_0x19b499(++_0x4addd5);}(_0x013f,0x70));var _0xf013=function(_0x28ddf8,_0x3228e6){_0x28ddf8=_0x28ddf8-0x0;var _0x4edf3e=_0x013f[_0x28ddf8];return _0x4edf3e;};'use strict';var Sequelize=require(_0xf013('0x0'));module[_0xf013('0x1')]={'name':{'type':Sequelize[_0xf013('0x2')],'unique':_0xf013('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf013('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf013('0x5')]('rrmemory',_0xf013('0x6'),_0xf013('0x7'))}}; \ No newline at end of file +var _0x421c=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0xb05f5d,_0x4cbc88){var _0x53f7c1=function(_0x2ba55a){while(--_0x2ba55a){_0xb05f5d['push'](_0xb05f5d['shift']());}};_0x53f7c1(++_0x4cbc88);}(_0x421c,0x13a));var _0xc421=function(_0x4d8494,_0x4f19a8){_0x4d8494=_0x4d8494-0x0;var _0x225cc2=_0x421c[_0x4d8494];return _0x225cc2;};'use strict';var Sequelize=require(_0xc421('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc421('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc421('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc421('0x3')](_0xc421('0x4'),_0xc421('0x5'),_0xc421('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index eccfa16..0c5d117 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x0b0e[_0x356e8d];return _0x39e65a;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x0b0e,0x187));var _0xe0b0=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0x0b0e[_0x149f32];return _0x11f475;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1fed3d6..468f2cc 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 _0xf288=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xfde6b3,_0x1334f9){var _0x326049=function(_0x2a25fe){while(--_0x2a25fe){_0xfde6b3['push'](_0xfde6b3['shift']());}};_0x326049(++_0x1334f9);}(_0xf288,0xd6));var _0x8f28=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0xf288[_0x19aa84];return _0x536146;};'use strict';var EventEmitter=require(_0x8f28('0x0'));var SmsQueue=require(_0x8f28('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8f28('0x2')](0x0);var events={'afterCreate':_0x8f28('0x3'),'afterUpdate':_0x8f28('0x4'),'afterDestroy':_0x8f28('0x5')};function emitEvent(_0x4a9ed3){return function(_0x1d2256,_0x1fa0bc,_0x230054){SmsQueueEvents[_0x8f28('0x6')](_0x4a9ed3+':'+_0x1d2256['id'],_0x1d2256);SmsQueueEvents['emit'](_0x4a9ed3,_0x1d2256);_0x230054(null);};}for(var e in events){if(events[_0x8f28('0x7')](e)){var event=events[e];SmsQueue[_0x8f28('0x8')](e,emitEvent(event));}}module[_0x8f28('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xef50=['exports','events','../../mysqldb','SmsQueue','save','update','remove','emit','hook'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0xef50,0x76));var _0x0ef5=function(_0x1f0e7a,_0x5613df){_0x1f0e7a=_0x1f0e7a-0x0;var _0x47f222=_0xef50[_0x1f0e7a];return _0x47f222;};'use strict';var EventEmitter=require(_0x0ef5('0x0'));var SmsQueue=require(_0x0ef5('0x1'))['db'][_0x0ef5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ef5('0x3'),'afterUpdate':_0x0ef5('0x4'),'afterDestroy':_0x0ef5('0x5')};function emitEvent(_0x467c11){return function(_0xca0589,_0x52311a,_0x49cf24){SmsQueueEvents[_0x0ef5('0x6')](_0x467c11+':'+_0xca0589['id'],_0xca0589);SmsQueueEvents[_0x0ef5('0x6')](_0x467c11,_0xca0589);_0x49cf24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x0ef5('0x7')](e,emitEvent(event));}}module[_0x0ef5('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8b213c5..221191f 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 _0x3e9c=['./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3ee44c,_0x292fc2){var _0x15971a=function(_0x9aced8){while(--_0x9aced8){_0x3ee44c['push'](_0x3ee44c['shift']());}};_0x15971a(++_0x292fc2);}(_0x3e9c,0xf6));var _0xc3e9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3e9c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc3e9('0x0'));var util=require('util');var logger=require(_0xc3e9('0x1'))('api');var moment=require(_0xc3e9('0x2'));var BPromise=require(_0xc3e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3e9('0x4'));var rimraf=require(_0xc3e9('0x5'));var config=require(_0xc3e9('0x6'));var attributes=require(_0xc3e9('0x7'));module['exports']=function(_0x4726a6,_0x302a06){return _0x4726a6[_0xc3e9('0x8')](_0xc3e9('0x9'),attributes,{'tableName':_0xc3e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf7e=['lodash','api','moment','bluebird','../../config/environment','exports','define','sms_queues'];(function(_0x4f94b7,_0x51cce6){var _0x16d901=function(_0x566381){while(--_0x566381){_0x4f94b7['push'](_0x4f94b7['shift']());}};_0x16d901(++_0x51cce6);}(_0xdf7e,0x1e0));var _0xedf7=function(_0x2e12af,_0xde849a){_0x2e12af=_0x2e12af-0x0;var _0x1e57fb=_0xdf7e[_0x2e12af];return _0x1e57fb;};'use strict';var _=require(_0xedf7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xedf7('0x1'));var moment=require(_0xedf7('0x2'));var BPromise=require(_0xedf7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xedf7('0x4'));var attributes=require('./smsQueue.attributes');module[_0xedf7('0x5')]=function(_0x217248,_0x387da8){return _0x217248[_0xedf7('0x6')]('SmsQueue',attributes,{'tableName':_0xedf7('0x7'),'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 dc0118d..dcc42df 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 _0x186e=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','findAll','options','where','limit','include','model','attributes','map','ShowSmsQueue','SmsQueue','find','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x186e,0xca));var _0xe186=function(_0x4b9a59,_0x4a9a23){_0x4b9a59=_0x4b9a59-0x0;var _0x5c7927=_0x186e[_0x4b9a59];return _0x5c7927;};'use strict';var _=require(_0xe186('0x0'));var util=require(_0xe186('0x1'));var moment=require(_0xe186('0x2'));var BPromise=require('bluebird');var rs=require(_0xe186('0x3'));var fs=require('fs');var Redis=require(_0xe186('0x4'));var db=require(_0xe186('0x5'))['db'];var utils=require(_0xe186('0x6'));var logger=require('../../config/logger')(_0xe186('0x7'));var config=require('../../config/environment');var jayson=require(_0xe186('0x8'));var client=jayson[_0xe186('0x9')][_0xe186('0xa')]({'port':0x232a});config[_0xe186('0xb')]=_[_0xe186('0xc')](config['redis'],{'host':_0xe186('0xd'),'port':0x18eb});var socket=require(_0xe186('0xe'))(new Redis(config[_0xe186('0xb')]));require(_0xe186('0xf'))['register'](socket);function respondWithRpcPromise(_0x4eeb5b,_0x3fa371,_0x2c083){return new BPromise(function(_0x6a60eb,_0xe2f574){return client[_0xe186('0x10')](_0x4eeb5b,_0x2c083)[_0xe186('0x11')](function(_0xa6d88e){logger[_0xe186('0x12')](_0xe186('0x13'),_0x3fa371,_0xe186('0x14'));logger[_0xe186('0x15')](_0xe186('0x16'),_0x3fa371,_0xe186('0x14'),JSON['stringify'](_0xa6d88e));if(_0xa6d88e['error']){if(_0xa6d88e[_0xe186('0x17')][_0xe186('0x18')]===0x1f4){logger['error'](_0xe186('0x13'),_0x3fa371,_0xa6d88e[_0xe186('0x17')][_0xe186('0x19')]);return _0xe2f574(_0xa6d88e[_0xe186('0x17')][_0xe186('0x19')]);}logger[_0xe186('0x17')](_0xe186('0x13'),_0x3fa371,_0xa6d88e['error'][_0xe186('0x19')]);return _0x6a60eb(_0xa6d88e[_0xe186('0x17')]['message']);}else{logger[_0xe186('0x12')]('SmsQueue,\x20%s,\x20%s',_0x3fa371,_0xe186('0x14'));_0x6a60eb(_0xa6d88e[_0xe186('0x1a')][_0xe186('0x19')]);}})[_0xe186('0x1b')](function(_0x49066a){logger[_0xe186('0x17')](_0xe186('0x13'),_0x3fa371,_0x49066a);_0xe2f574(_0x49066a);});});}exports[_0xe186('0x1c')]=function(_0x58200e){var _0x1da3eb=this;return new Promise(function(_0x40a8d3,_0x21882c){return db['SmsQueue'][_0xe186('0x1d')]({'raw':_0x58200e[_0xe186('0x1e')]?_0x58200e[_0xe186('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x58200e[_0xe186('0x1e')]?_0x58200e[_0xe186('0x1e')][_0xe186('0x1f')]||null:null,'attributes':_0x58200e[_0xe186('0x1e')]?_0x58200e[_0xe186('0x1e')]['attributes']||null:null,'limit':_0x58200e[_0xe186('0x1e')]?_0x58200e[_0xe186('0x1e')][_0xe186('0x20')]||null:null,'include':_0x58200e['options']?_0x58200e[_0xe186('0x1e')][_0xe186('0x21')]?_['map'](_0x58200e[_0xe186('0x1e')][_0xe186('0x21')],function(_0x63af94){return{'model':db[_0x63af94[_0xe186('0x22')]],'as':_0x63af94['as'],'attributes':_0x63af94[_0xe186('0x23')],'include':_0x63af94[_0xe186('0x21')]?_[_0xe186('0x24')](_0x63af94['include'],function(_0x4e2ed8){return{'model':db[_0x4e2ed8[_0xe186('0x22')]],'as':_0x4e2ed8['as'],'attributes':_0x4e2ed8[_0xe186('0x23')],'include':_0x4e2ed8[_0xe186('0x21')]?_[_0xe186('0x24')](_0x4e2ed8[_0xe186('0x21')],function(_0x44de02){return{'model':db[_0x44de02[_0xe186('0x22')]],'as':_0x44de02['as'],'attributes':_0x44de02[_0xe186('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe186('0x11')](function(_0x2a6582){logger[_0xe186('0x12')](_0xe186('0x1c'),_0x58200e);logger[_0xe186('0x15')](_0xe186('0x1c'),_0x58200e,JSON['stringify'](_0x2a6582));_0x40a8d3(_0x2a6582);})[_0xe186('0x1b')](function(_0x3941ef){logger[_0xe186('0x17')](_0xe186('0x1c'),_0x3941ef['message'],_0x58200e);_0x21882c(_0x1da3eb[_0xe186('0x17')](0x1f4,_0x3941ef[_0xe186('0x19')]));});});};exports[_0xe186('0x25')]=function(_0x775e1){var _0x5bec36=this;return new Promise(function(_0x5cead1,_0x46f81d){return db[_0xe186('0x26')][_0xe186('0x27')]({'raw':_0x775e1[_0xe186('0x1e')]?_0x775e1[_0xe186('0x1e')][_0xe186('0x28')]===undefined?!![]:![]:!![],'where':_0x775e1[_0xe186('0x1e')]?_0x775e1['options'][_0xe186('0x1f')]||null:null,'attributes':_0x775e1[_0xe186('0x1e')]?_0x775e1[_0xe186('0x1e')][_0xe186('0x23')]||null:null,'include':_0x775e1[_0xe186('0x1e')]?_0x775e1[_0xe186('0x1e')]['include']?_['map'](_0x775e1[_0xe186('0x1e')][_0xe186('0x21')],function(_0x259468){return{'model':db[_0x259468[_0xe186('0x22')]],'as':_0x259468['as'],'attributes':_0x259468['attributes'],'include':_0x259468[_0xe186('0x21')]?_['map'](_0x259468[_0xe186('0x21')],function(_0x3918b5){return{'model':db[_0x3918b5[_0xe186('0x22')]],'as':_0x3918b5['as'],'attributes':_0x3918b5[_0xe186('0x23')],'include':_0x3918b5[_0xe186('0x21')]?_[_0xe186('0x24')](_0x3918b5[_0xe186('0x21')],function(_0x5b04b1){return{'model':db[_0x5b04b1[_0xe186('0x22')]],'as':_0x5b04b1['as'],'attributes':_0x5b04b1[_0xe186('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe186('0x11')](function(_0x1d7495){logger[_0xe186('0x12')](_0xe186('0x25'),_0x775e1);logger['debug']('ShowSmsQueue',_0x775e1,JSON[_0xe186('0x29')](_0x1d7495));_0x5cead1(_0x1d7495);})[_0xe186('0x1b')](function(_0x46bd98){logger['error'](_0xe186('0x25'),_0x46bd98[_0xe186('0x19')],_0x775e1);_0x46f81d(_0x5bec36[_0xe186('0x17')](0x1f4,_0x46bd98[_0xe186('0x19')]));});});}; \ No newline at end of file +var _0xee12=['SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xee12,0x1a9));var _0x2ee1=function(_0x312af4,_0x59adfc){_0x312af4=_0x312af4-0x0;var _0xbf7cd5=_0xee12[_0x312af4];return _0xbf7cd5;};'use strict';var _=require(_0x2ee1('0x0'));var util=require('util');var moment=require(_0x2ee1('0x1'));var BPromise=require(_0x2ee1('0x2'));var rs=require(_0x2ee1('0x3'));var fs=require('fs');var Redis=require(_0x2ee1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ee1('0x5'));var logger=require(_0x2ee1('0x6'))(_0x2ee1('0x7'));var config=require(_0x2ee1('0x8'));var jayson=require(_0x2ee1('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2ee1('0xa')](config[_0x2ee1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ee1('0xc'))(new Redis(config[_0x2ee1('0xb')]));require(_0x2ee1('0xd'))[_0x2ee1('0xe')](socket);function respondWithRpcPromise(_0x117406,_0x5c42dc,_0x456d93){return new BPromise(function(_0x1bc005,_0x15d552){return client['request'](_0x117406,_0x456d93)[_0x2ee1('0xf')](function(_0x1df0e7){logger[_0x2ee1('0x10')](_0x2ee1('0x11'),_0x5c42dc,_0x2ee1('0x12'));logger['debug'](_0x2ee1('0x13'),_0x5c42dc,_0x2ee1('0x12'),JSON['stringify'](_0x1df0e7));if(_0x1df0e7[_0x2ee1('0x14')]){if(_0x1df0e7[_0x2ee1('0x14')]['code']===0x1f4){logger[_0x2ee1('0x14')](_0x2ee1('0x11'),_0x5c42dc,_0x1df0e7[_0x2ee1('0x14')][_0x2ee1('0x15')]);return _0x15d552(_0x1df0e7[_0x2ee1('0x14')][_0x2ee1('0x15')]);}logger[_0x2ee1('0x14')](_0x2ee1('0x11'),_0x5c42dc,_0x1df0e7[_0x2ee1('0x14')][_0x2ee1('0x15')]);return _0x1bc005(_0x1df0e7[_0x2ee1('0x14')][_0x2ee1('0x15')]);}else{logger['info'](_0x2ee1('0x11'),_0x5c42dc,'request\x20sent');_0x1bc005(_0x1df0e7[_0x2ee1('0x16')][_0x2ee1('0x15')]);}})[_0x2ee1('0x17')](function(_0x216601){logger[_0x2ee1('0x14')](_0x2ee1('0x11'),_0x5c42dc,_0x216601);_0x15d552(_0x216601);});});}exports[_0x2ee1('0x18')]=function(_0x2cfcdf){var _0x162c15=this;return new Promise(function(_0x1ccdca,_0x122f76){return db[_0x2ee1('0x19')][_0x2ee1('0x1a')]({'raw':_0x2cfcdf[_0x2ee1('0x1b')]?_0x2cfcdf[_0x2ee1('0x1b')][_0x2ee1('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cfcdf['options']?_0x2cfcdf[_0x2ee1('0x1b')][_0x2ee1('0x1d')]||null:null,'attributes':_0x2cfcdf[_0x2ee1('0x1b')]?_0x2cfcdf[_0x2ee1('0x1b')][_0x2ee1('0x1e')]||null:null,'limit':_0x2cfcdf[_0x2ee1('0x1b')]?_0x2cfcdf['options']['limit']||null:null,'include':_0x2cfcdf[_0x2ee1('0x1b')]?_0x2cfcdf[_0x2ee1('0x1b')][_0x2ee1('0x1f')]?_[_0x2ee1('0x20')](_0x2cfcdf['options'][_0x2ee1('0x1f')],function(_0x204053){return{'model':db[_0x204053[_0x2ee1('0x21')]],'as':_0x204053['as'],'attributes':_0x204053[_0x2ee1('0x1e')],'include':_0x204053[_0x2ee1('0x1f')]?_[_0x2ee1('0x20')](_0x204053[_0x2ee1('0x1f')],function(_0x4b5745){return{'model':db[_0x4b5745[_0x2ee1('0x21')]],'as':_0x4b5745['as'],'attributes':_0x4b5745[_0x2ee1('0x1e')],'include':_0x4b5745['include']?_[_0x2ee1('0x20')](_0x4b5745[_0x2ee1('0x1f')],function(_0x689d05){return{'model':db[_0x689d05[_0x2ee1('0x21')]],'as':_0x689d05['as'],'attributes':_0x689d05[_0x2ee1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2ee1('0xf')](function(_0x57138b){logger[_0x2ee1('0x10')](_0x2ee1('0x18'),_0x2cfcdf);logger[_0x2ee1('0x22')](_0x2ee1('0x18'),_0x2cfcdf,JSON[_0x2ee1('0x23')](_0x57138b));_0x1ccdca(_0x57138b);})['catch'](function(_0x484d4c){logger[_0x2ee1('0x14')](_0x2ee1('0x18'),_0x484d4c[_0x2ee1('0x15')],_0x2cfcdf);_0x122f76(_0x162c15[_0x2ee1('0x14')](0x1f4,_0x484d4c[_0x2ee1('0x15')]));});});};exports[_0x2ee1('0x24')]=function(_0x58a7c8){var _0x1008f5=this;return new Promise(function(_0x342b1f,_0x43e2a9){return db['SmsQueue']['find']({'raw':_0x58a7c8['options']?_0x58a7c8[_0x2ee1('0x1b')][_0x2ee1('0x1c')]===undefined?!![]:![]:!![],'where':_0x58a7c8['options']?_0x58a7c8[_0x2ee1('0x1b')][_0x2ee1('0x1d')]||null:null,'attributes':_0x58a7c8[_0x2ee1('0x1b')]?_0x58a7c8[_0x2ee1('0x1b')][_0x2ee1('0x1e')]||null:null,'include':_0x58a7c8[_0x2ee1('0x1b')]?_0x58a7c8['options']['include']?_[_0x2ee1('0x20')](_0x58a7c8['options']['include'],function(_0x528b49){return{'model':db[_0x528b49[_0x2ee1('0x21')]],'as':_0x528b49['as'],'attributes':_0x528b49['attributes'],'include':_0x528b49['include']?_['map'](_0x528b49[_0x2ee1('0x1f')],function(_0x23132b){return{'model':db[_0x23132b[_0x2ee1('0x21')]],'as':_0x23132b['as'],'attributes':_0x23132b['attributes'],'include':_0x23132b[_0x2ee1('0x1f')]?_[_0x2ee1('0x20')](_0x23132b[_0x2ee1('0x1f')],function(_0x515c7c){return{'model':db[_0x515c7c[_0x2ee1('0x21')]],'as':_0x515c7c['as'],'attributes':_0x515c7c[_0x2ee1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2ee1('0xf')](function(_0x44278f){logger[_0x2ee1('0x10')]('ShowSmsQueue',_0x58a7c8);logger['debug'](_0x2ee1('0x24'),_0x58a7c8,JSON[_0x2ee1('0x23')](_0x44278f));_0x342b1f(_0x44278f);})[_0x2ee1('0x17')](function(_0x10ccf4){logger['error'](_0x2ee1('0x24'),_0x10ccf4['message'],_0x58a7c8);_0x43e2a9(_0x1008f5[_0x2ee1('0x14')](0x1f4,_0x10ccf4[_0x2ee1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 14bc676..b0bcd1f 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 _0xa817=['emit','removeListener','register','length','./smsQueue.events','save','remove','update'];(function(_0x1446c2,_0x3d355c){var _0x38b278=function(_0x36d38d){while(--_0x36d38d){_0x1446c2['push'](_0x1446c2['shift']());}};_0x38b278(++_0x3d355c);}(_0xa817,0xf4));var _0x7a81=function(_0xd9b1e1,_0x58c9e7){_0xd9b1e1=_0xd9b1e1-0x0;var _0xc765d9=_0xa817[_0xd9b1e1];return _0xc765d9;};'use strict';var SmsQueueEvents=require(_0x7a81('0x0'));var events=[_0x7a81('0x1'),_0x7a81('0x2'),_0x7a81('0x3')];function createListener(_0x8a502f,_0x21980e){return function(_0x20203b){_0x21980e[_0x7a81('0x4')](_0x8a502f,_0x20203b);};}function removeListener(_0x27cbf0,_0x4be924){return function(){SmsQueueEvents[_0x7a81('0x5')](_0x27cbf0,_0x4be924);};}exports[_0x7a81('0x6')]=function(_0x5d92af){for(var _0x52e605=0x0,_0x4be2fa=events[_0x7a81('0x7')];_0x52e605<_0x4be2fa;_0x52e605++){var _0x40319b=events[_0x52e605];var _0x3b2751=createListener('smsQueue:'+_0x40319b,_0x5d92af);SmsQueueEvents['on'](_0x40319b,_0x3b2751);}}; \ No newline at end of file +var _0x2a91=['register','length','save','remove','update','emit','removeListener'];(function(_0x4338ab,_0x5bcf1c){var _0x3a9ada=function(_0x996a5f){while(--_0x996a5f){_0x4338ab['push'](_0x4338ab['shift']());}};_0x3a9ada(++_0x5bcf1c);}(_0x2a91,0xc6));var _0x12a9=function(_0x2ac075,_0x21d37d){_0x2ac075=_0x2ac075-0x0;var _0x42f071=_0x2a91[_0x2ac075];return _0x42f071;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x12a9('0x0'),_0x12a9('0x1'),_0x12a9('0x2')];function createListener(_0x379bda,_0x5d259a){return function(_0x1ddc06){_0x5d259a[_0x12a9('0x3')](_0x379bda,_0x1ddc06);};}function removeListener(_0x25b3c5,_0x49bfa7){return function(){SmsQueueEvents[_0x12a9('0x4')](_0x25b3c5,_0x49bfa7);};}exports[_0x12a9('0x5')]=function(_0x1154fc){for(var _0x1fc1a0=0x0,_0x1c0ee0=events[_0x12a9('0x6')];_0x1fc1a0<_0x1c0ee0;_0x1fc1a0++){var _0x28e739=events[_0x1fc1a0];var _0x526864=createListener('smsQueue:'+_0x28e739,_0x1154fc);SmsQueueEvents['on'](_0x28e739,_0x526864);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b65f0c6..eac9d05 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 _0x8d59=['post','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8d59,0xb9));var _0x98d5=function(_0x5281fb,_0x51d61a){_0x5281fb=_0x5281fb-0x0;var _0x2be1aa=_0x8d59[_0x5281fb];return _0x2be1aa;};'use strict';var multer=require(_0x98d5('0x0'));var util=require(_0x98d5('0x1'));var path=require(_0x98d5('0x2'));var timeout=require(_0x98d5('0x3'));var express=require(_0x98d5('0x4'));var router=express['Router']();var fs_extra=require(_0x98d5('0x5'));var auth=require(_0x98d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98d5('0x7'));var controller=require(_0x98d5('0x8'));router['get']('/',auth[_0x98d5('0x9')](),controller[_0x98d5('0xa')]);router[_0x98d5('0xb')](_0x98d5('0xc'),auth[_0x98d5('0x9')](),controller[_0x98d5('0xd')]);router[_0x98d5('0xb')](_0x98d5('0xe'),auth[_0x98d5('0x9')](),controller['show']);router[_0x98d5('0xf')]('/',auth['isAuthenticated'](),controller[_0x98d5('0x10')]);router[_0x98d5('0x11')](_0x98d5('0xe'),auth[_0x98d5('0x9')](),controller[_0x98d5('0x12')]);router['delete'](_0x98d5('0xe'),auth[_0x98d5('0x9')](),controller[_0x98d5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x65b8=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x2e7522,_0x5b1548){var _0x200019=function(_0x4aebdd){while(--_0x4aebdd){_0x2e7522['push'](_0x2e7522['shift']());}};_0x200019(++_0x5b1548);}(_0x65b8,0x1c1));var _0x865b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x65b8[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x865b('0x0'));var util=require(_0x865b('0x1'));var path=require(_0x865b('0x2'));var timeout=require(_0x865b('0x3'));var express=require('express');var router=express[_0x865b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x865b('0x5'));var config=require(_0x865b('0x6'));var controller=require(_0x865b('0x7'));router[_0x865b('0x8')]('/',auth['isAuthenticated'](),controller[_0x865b('0x9')]);router[_0x865b('0x8')](_0x865b('0xa'),auth[_0x865b('0xb')](),controller[_0x865b('0xc')]);router[_0x865b('0x8')](_0x865b('0xd'),auth['isAuthenticated'](),controller[_0x865b('0xe')]);router[_0x865b('0xf')]('/',auth[_0x865b('0xb')](),controller[_0x865b('0x10')]);router[_0x865b('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x865b('0x12')](_0x865b('0xd'),auth[_0x865b('0xb')](),controller[_0x865b('0x13')]);module[_0x865b('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 27fce9c..9df0fd8 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 _0xb673=['DATE','moment','sequelize','STRING'];(function(_0x44cb68,_0x3ca3f2){var _0x4a42c2=function(_0x45c49d){while(--_0x45c49d){_0x44cb68['push'](_0x44cb68['shift']());}};_0x4a42c2(++_0x3ca3f2);}(_0xb673,0xa5));var _0x3b67=function(_0x2b083f,_0xaf1d7e){_0x2b083f=_0x2b083f-0x0;var _0x821aa9=_0xb673[_0x2b083f];return _0x821aa9;};'use strict';var moment=require(_0x3b67('0x0'));var Sequelize=require(_0x3b67('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b67('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3b67('0x2')]},'joinAt':{'type':Sequelize[_0x3b67('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3b67('0x3')]},'exitAt':{'type':Sequelize[_0x3b67('0x3')]},'reason':{'type':Sequelize[_0x3b67('0x2')]}}; \ No newline at end of file +var _0x6bac=['DATE','moment','exports','STRING'];(function(_0x211640,_0x561da4){var _0xa1f536=function(_0x4dab9b){while(--_0x4dab9b){_0x211640['push'](_0x211640['shift']());}};_0xa1f536(++_0x561da4);}(_0x6bac,0xa5));var _0xc6ba=function(_0x468604,_0x1ae162){_0x468604=_0x468604-0x0;var _0x5262a0=_0x6bac[_0x468604];return _0x5262a0;};'use strict';var moment=require(_0xc6ba('0x0'));var Sequelize=require('sequelize');module[_0xc6ba('0x1')]={'uniqueid':{'type':Sequelize[_0xc6ba('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc6ba('0x2')]},'joinAt':{'type':Sequelize[_0xc6ba('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc6ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b9b2622..e2ccc7c 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 _0xe408=['update','error','stack','name','index','key','map','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','SmsQueueReport','then','include','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save'];(function(_0x3b72cb,_0x112f26){var _0x202da6=function(_0x9b6ba2){while(--_0x9b6ba2){_0x3b72cb['push'](_0x3b72cb['shift']());}};_0x202da6(++_0x112f26);}(_0xe408,0x69));var _0x8e40=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xe408[_0x3718b7];return _0xf8c91e;};'use strict';var emlformat=require(_0x8e40('0x0'));var rimraf=require(_0x8e40('0x1'));var zipdir=require(_0x8e40('0x2'));var jsonpatch=require(_0x8e40('0x3'));var rp=require(_0x8e40('0x4'));var moment=require(_0x8e40('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e40('0x6'));var path=require(_0x8e40('0x7'));var sox=require(_0x8e40('0x8'));var csv=require(_0x8e40('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e40('0xa'));var _=require(_0x8e40('0xb'));var squel=require('squel');var crypto=require(_0x8e40('0xc'));var jsforce=require(_0x8e40('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e40('0x9'));var querystring=require(_0x8e40('0xe'));var Papa=require(_0x8e40('0xf'));var Redis=require(_0x8e40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e40('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8e40('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8e40('0x13'));var db=require(_0x8e40('0x14'))['db'];function respondWithStatusCode(_0x58c4f8,_0x2657dd){_0x2657dd=_0x2657dd||0xcc;return function(_0x7b0c99){if(_0x7b0c99){return _0x58c4f8[_0x8e40('0x15')](_0x2657dd);}return _0x58c4f8[_0x8e40('0x16')](_0x2657dd)[_0x8e40('0x17')]();};}function respondWithResult(_0x335486,_0x4a6038){_0x4a6038=_0x4a6038||0xc8;return function(_0x5069f3){if(_0x5069f3){return _0x335486[_0x8e40('0x16')](_0x4a6038)['json'](_0x5069f3);}};}function respondWithFilteredResult(_0x167a06,_0x46756b){return function(_0x1df521){if(_0x1df521){var _0x439506=typeof _0x46756b[_0x8e40('0x18')]===_0x8e40('0x19')&&typeof _0x46756b[_0x8e40('0x1a')]===_0x8e40('0x19');var _0x2a6270=_0x1df521[_0x8e40('0x1b')];var _0x4eb09b=_0x439506?0x0:_0x46756b[_0x8e40('0x18')];var _0x45f15b=_0x439506?_0x1df521['count']:_0x46756b[_0x8e40('0x18')]+_0x46756b[_0x8e40('0x1a')];var _0x4d7f30;if(_0x45f15b>=_0x2a6270){_0x45f15b=_0x2a6270;_0x4d7f30=0xc8;}else{_0x4d7f30=0xce;}_0x167a06[_0x8e40('0x16')](_0x4d7f30);return _0x167a06[_0x8e40('0x1c')](_0x8e40('0x1d'),_0x4eb09b+'-'+_0x45f15b+'/'+_0x2a6270)[_0x8e40('0x1e')](_0x1df521);}return null;};}function patchUpdates(_0xe5ff2a){return function(_0x30dfbe){try{jsonpatch['apply'](_0x30dfbe,_0xe5ff2a,!![]);}catch(_0x14ed55){return BPromise[_0x8e40('0x1f')](_0x14ed55);}return _0x30dfbe[_0x8e40('0x20')]();};}function saveUpdates(_0x3edc87,_0x3ec0ee){return function(_0x1dbc18){if(_0x1dbc18){return _0x1dbc18[_0x8e40('0x21')](_0x3edc87)['then'](function(_0x14696b){return _0x14696b;});}return null;};}function removeEntity(_0xb896f1,_0x5a5215){return function(_0x2e8f60){if(_0x2e8f60){return _0x2e8f60['destroy']()['then'](function(){_0xb896f1[_0x8e40('0x16')](0xcc)[_0x8e40('0x17')]();});}};}function handleEntityNotFound(_0x3b992b,_0x32d222){return function(_0x5b2b48){if(!_0x5b2b48){_0x3b992b[_0x8e40('0x15')](0x194);}return _0x5b2b48;};}function handleError(_0x290baa,_0x451951){_0x451951=_0x451951||0x1f4;return function(_0x5efe04){logger[_0x8e40('0x22')](_0x5efe04[_0x8e40('0x23')]);if(_0x5efe04[_0x8e40('0x24')]){delete _0x5efe04[_0x8e40('0x24')];}_0x290baa[_0x8e40('0x16')](_0x451951)['send'](_0x5efe04);};}exports[_0x8e40('0x25')]=function(_0x532c7e,_0x2c5a97){var _0x67be10={},_0x3fb6fe={},_0x2837e3={'count':0x0,'rows':[]};var _0x38b1d1=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x11405b){return{'name':_0x11405b['fieldName'],'type':_0x11405b['type'][_0x8e40('0x26')]};});_0x3fb6fe['model']=_[_0x8e40('0x27')](_0x38b1d1,_0x8e40('0x24'));_0x3fb6fe[_0x8e40('0x28')]=_[_0x8e40('0x29')](_0x532c7e[_0x8e40('0x28')]);_0x3fb6fe[_0x8e40('0x2a')]=_['intersection'](_0x3fb6fe['model'],_0x3fb6fe[_0x8e40('0x28')]);_0x67be10[_0x8e40('0x2b')]=_[_0x8e40('0x2c')](_0x3fb6fe[_0x8e40('0x2d')],qs[_0x8e40('0x2e')](_0x532c7e[_0x8e40('0x28')][_0x8e40('0x2e')]));_0x67be10['attributes']=_0x67be10[_0x8e40('0x2b')][_0x8e40('0x2f')]?_0x67be10[_0x8e40('0x2b')]:_0x3fb6fe[_0x8e40('0x2d')];if(!_0x532c7e['query']['hasOwnProperty'](_0x8e40('0x30'))){_0x67be10['limit']=qs[_0x8e40('0x1a')](_0x532c7e[_0x8e40('0x28')][_0x8e40('0x1a')]);_0x67be10[_0x8e40('0x18')]=qs['offset'](_0x532c7e[_0x8e40('0x28')][_0x8e40('0x18')]);}_0x67be10[_0x8e40('0x31')]=qs['sort'](_0x532c7e[_0x8e40('0x28')][_0x8e40('0x32')]);_0x67be10[_0x8e40('0x33')]=qs[_0x8e40('0x2a')](_['pick'](_0x532c7e[_0x8e40('0x28')],_0x3fb6fe['filters']),_0x38b1d1);if(_0x532c7e[_0x8e40('0x28')][_0x8e40('0x34')]){_0x67be10[_0x8e40('0x33')]=_[_0x8e40('0x35')](_0x67be10[_0x8e40('0x33')],{'$or':_[_0x8e40('0x27')](_0x38b1d1,function(_0x49504a){if(_0x49504a[_0x8e40('0x36')]!==_0x8e40('0x37')){var _0x57f278={};_0x57f278[_0x49504a[_0x8e40('0x24')]]={'$like':'%'+_0x532c7e['query']['filter']+'%'};return _0x57f278;}})});}_0x67be10=_[_0x8e40('0x35')]({},_0x67be10,_0x532c7e[_0x8e40('0x38')]);var _0x23800d={'where':_0x67be10[_0x8e40('0x33')]};return db[_0x8e40('0x39')][_0x8e40('0x1b')](_0x23800d)[_0x8e40('0x3a')](function(_0x4b5865){_0x2837e3[_0x8e40('0x1b')]=_0x4b5865;if(_0x532c7e['query']['includeAll']){_0x67be10[_0x8e40('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x67be10);})[_0x8e40('0x3a')](function(_0x203fd1){_0x2837e3[_0x8e40('0x3c')]=_0x203fd1;return _0x2837e3;})['then'](respondWithFilteredResult(_0x2c5a97,_0x67be10))[_0x8e40('0x3d')](handleError(_0x2c5a97,null));};exports[_0x8e40('0x3e')]=function(_0x3bea6a,_0x299af7){var _0x26510f={'raw':!![],'where':{'id':_0x3bea6a[_0x8e40('0x3f')]['id']}},_0x3b118a={};_0x3b118a[_0x8e40('0x2d')]=_['keys'](db[_0x8e40('0x39')]['rawAttributes']);_0x3b118a['query']=_[_0x8e40('0x29')](_0x3bea6a[_0x8e40('0x28')]);_0x3b118a[_0x8e40('0x2a')]=_[_0x8e40('0x2c')](_0x3b118a['model'],_0x3b118a[_0x8e40('0x28')]);_0x26510f[_0x8e40('0x2b')]=_[_0x8e40('0x2c')](_0x3b118a['model'],qs[_0x8e40('0x2e')](_0x3bea6a[_0x8e40('0x28')][_0x8e40('0x2e')]));_0x26510f['attributes']=_0x26510f[_0x8e40('0x2b')]['length']?_0x26510f[_0x8e40('0x2b')]:_0x3b118a[_0x8e40('0x2d')];if(_0x3bea6a[_0x8e40('0x28')][_0x8e40('0x40')]){_0x26510f[_0x8e40('0x3b')]=[{'all':!![]}];}_0x26510f=_[_0x8e40('0x35')]({},_0x26510f,_0x3bea6a['options']);return db[_0x8e40('0x39')][_0x8e40('0x41')](_0x26510f)[_0x8e40('0x3a')](handleEntityNotFound(_0x299af7,null))['then'](respondWithResult(_0x299af7,null))[_0x8e40('0x3d')](handleError(_0x299af7,null));};exports[_0x8e40('0x42')]=function(_0x57c8f8,_0x555a76){return db[_0x8e40('0x39')]['create'](_0x57c8f8[_0x8e40('0x43')],{})['then'](respondWithResult(_0x555a76,0xc9))['catch'](handleError(_0x555a76,null));};exports['update']=function(_0x3e018f,_0x4a8928){if(_0x3e018f[_0x8e40('0x43')]['id']){delete _0x3e018f[_0x8e40('0x43')]['id'];}return db[_0x8e40('0x39')][_0x8e40('0x41')]({'where':{'id':_0x3e018f[_0x8e40('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4a8928,null))[_0x8e40('0x3a')](saveUpdates(_0x3e018f[_0x8e40('0x43')],null))[_0x8e40('0x3a')](respondWithResult(_0x4a8928,null))[_0x8e40('0x3d')](handleError(_0x4a8928,null));};exports[_0x8e40('0x44')]=function(_0x494efd,_0x3e557e){return db['SmsQueueReport'][_0x8e40('0x41')]({'where':{'id':_0x494efd['params']['id']}})[_0x8e40('0x3a')](handleEntityNotFound(_0x3e557e,null))[_0x8e40('0x3a')](removeEntity(_0x3e557e,null))[_0x8e40('0x3d')](handleError(_0x3e557e,null));};exports['describe']=function(_0x40ce6f,_0x20e9d3){return db[_0x8e40('0x39')]['describe']()[_0x8e40('0x3a')](respondWithResult(_0x20e9d3,null))[_0x8e40('0x3d')](handleError(_0x20e9d3,null));}; \ No newline at end of file +var _0x3bb4=['lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','include','findAll','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','ejs','fs-extra'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x3bb4,0x91));var _0x43bb=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0x3bb4[_0x185063];return _0x16d9d3;};'use strict';var emlformat=require(_0x43bb('0x0'));var rimraf=require(_0x43bb('0x1'));var zipdir=require(_0x43bb('0x2'));var jsonpatch=require(_0x43bb('0x3'));var rp=require(_0x43bb('0x4'));var moment=require(_0x43bb('0x5'));var BPromise=require(_0x43bb('0x6'));var Mustache=require(_0x43bb('0x7'));var util=require(_0x43bb('0x8'));var path=require(_0x43bb('0x9'));var sox=require('sox');var csv=require(_0x43bb('0xa'));var ejs=require(_0x43bb('0xb'));var fs=require('fs');var fs_extra=require(_0x43bb('0xc'));var _=require(_0x43bb('0xd'));var squel=require('squel');var crypto=require(_0x43bb('0xe'));var jsforce=require(_0x43bb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x43bb('0xa'));var querystring=require(_0x43bb('0x10'));var Papa=require(_0x43bb('0x11'));var Redis=require('ioredis');var authService=require(_0x43bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x43bb('0x13'));var hardwareService=require(_0x43bb('0x14'));var logger=require(_0x43bb('0x15'))(_0x43bb('0x16'));var utils=require(_0x43bb('0x17'));var config=require(_0x43bb('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x129873,_0x1fabce){_0x1fabce=_0x1fabce||0xcc;return function(_0x321f89){if(_0x321f89){return _0x129873['sendStatus'](_0x1fabce);}return _0x129873[_0x43bb('0x19')](_0x1fabce)[_0x43bb('0x1a')]();};}function respondWithResult(_0xfa6955,_0x4185b6){_0x4185b6=_0x4185b6||0xc8;return function(_0xf4c121){if(_0xf4c121){return _0xfa6955[_0x43bb('0x19')](_0x4185b6)[_0x43bb('0x1b')](_0xf4c121);}};}function respondWithFilteredResult(_0x54c6d0,_0x3d36ab){return function(_0x50f131){if(_0x50f131){var _0x350687=typeof _0x3d36ab[_0x43bb('0x1c')]===_0x43bb('0x1d')&&typeof _0x3d36ab[_0x43bb('0x1e')]===_0x43bb('0x1d');var _0x5325ff=_0x50f131[_0x43bb('0x1f')];var _0x36cd42=_0x350687?0x0:_0x3d36ab[_0x43bb('0x1c')];var _0xe309dc=_0x350687?_0x50f131[_0x43bb('0x1f')]:_0x3d36ab[_0x43bb('0x1c')]+_0x3d36ab[_0x43bb('0x1e')];var _0x127d19;if(_0xe309dc>=_0x5325ff){_0xe309dc=_0x5325ff;_0x127d19=0xc8;}else{_0x127d19=0xce;}_0x54c6d0[_0x43bb('0x19')](_0x127d19);return _0x54c6d0[_0x43bb('0x20')](_0x43bb('0x21'),_0x36cd42+'-'+_0xe309dc+'/'+_0x5325ff)[_0x43bb('0x1b')](_0x50f131);}return null;};}function patchUpdates(_0x2b69c4){return function(_0x49ce63){try{jsonpatch[_0x43bb('0x22')](_0x49ce63,_0x2b69c4,!![]);}catch(_0x27f9ed){return BPromise[_0x43bb('0x23')](_0x27f9ed);}return _0x49ce63[_0x43bb('0x24')]();};}function saveUpdates(_0x3b16bc,_0x65cce8){return function(_0x2003b7){if(_0x2003b7){return _0x2003b7[_0x43bb('0x25')](_0x3b16bc)[_0x43bb('0x26')](function(_0x418cf4){return _0x418cf4;});}return null;};}function removeEntity(_0x50082a,_0x45659a){return function(_0x372394){if(_0x372394){return _0x372394[_0x43bb('0x27')]()[_0x43bb('0x26')](function(){_0x50082a[_0x43bb('0x19')](0xcc)[_0x43bb('0x1a')]();});}};}function handleEntityNotFound(_0x506fe7,_0x42fb2c){return function(_0x7687c8){if(!_0x7687c8){_0x506fe7[_0x43bb('0x28')](0x194);}return _0x7687c8;};}function handleError(_0x51be26,_0x512cfe){_0x512cfe=_0x512cfe||0x1f4;return function(_0x382ecd){logger[_0x43bb('0x29')](_0x382ecd[_0x43bb('0x2a')]);if(_0x382ecd[_0x43bb('0x2b')]){delete _0x382ecd[_0x43bb('0x2b')];}_0x51be26[_0x43bb('0x19')](_0x512cfe)[_0x43bb('0x2c')](_0x382ecd);};}exports[_0x43bb('0x2d')]=function(_0x56b249,_0x383a8d){var _0x4aa730={},_0x37cf7e={},_0x4edbd4={'count':0x0,'rows':[]};var _0x83c647=_[_0x43bb('0x2e')](db['SmsQueueReport'][_0x43bb('0x2f')],function(_0x5ae0d9){return{'name':_0x5ae0d9[_0x43bb('0x30')],'type':_0x5ae0d9[_0x43bb('0x31')][_0x43bb('0x32')]};});_0x37cf7e['model']=_[_0x43bb('0x2e')](_0x83c647,'name');_0x37cf7e[_0x43bb('0x33')]=_[_0x43bb('0x34')](_0x56b249[_0x43bb('0x33')]);_0x37cf7e[_0x43bb('0x35')]=_['intersection'](_0x37cf7e['model'],_0x37cf7e[_0x43bb('0x33')]);_0x4aa730[_0x43bb('0x36')]=_[_0x43bb('0x37')](_0x37cf7e[_0x43bb('0x38')],qs[_0x43bb('0x39')](_0x56b249[_0x43bb('0x33')]['fields']));_0x4aa730[_0x43bb('0x36')]=_0x4aa730[_0x43bb('0x36')][_0x43bb('0x3a')]?_0x4aa730[_0x43bb('0x36')]:_0x37cf7e[_0x43bb('0x38')];if(!_0x56b249['query'][_0x43bb('0x3b')](_0x43bb('0x3c'))){_0x4aa730[_0x43bb('0x1e')]=qs['limit'](_0x56b249[_0x43bb('0x33')]['limit']);_0x4aa730[_0x43bb('0x1c')]=qs['offset'](_0x56b249[_0x43bb('0x33')]['offset']);}_0x4aa730['order']=qs[_0x43bb('0x3d')](_0x56b249['query'][_0x43bb('0x3d')]);_0x4aa730[_0x43bb('0x3e')]=qs[_0x43bb('0x35')](_[_0x43bb('0x3f')](_0x56b249['query'],_0x37cf7e[_0x43bb('0x35')]),_0x83c647);if(_0x56b249['query'][_0x43bb('0x40')]){_0x4aa730['where']=_[_0x43bb('0x41')](_0x4aa730[_0x43bb('0x3e')],{'$or':_[_0x43bb('0x2e')](_0x83c647,function(_0x143cc8){if(_0x143cc8[_0x43bb('0x31')]!=='VIRTUAL'){var _0x525f74={};_0x525f74[_0x143cc8['name']]={'$like':'%'+_0x56b249['query'][_0x43bb('0x40')]+'%'};return _0x525f74;}})});}_0x4aa730=_['merge']({},_0x4aa730,_0x56b249[_0x43bb('0x42')]);var _0x58672c={'where':_0x4aa730['where']};return db[_0x43bb('0x43')][_0x43bb('0x1f')](_0x58672c)[_0x43bb('0x26')](function(_0x235cfe){_0x4edbd4[_0x43bb('0x1f')]=_0x235cfe;if(_0x56b249[_0x43bb('0x33')][_0x43bb('0x44')]){_0x4aa730[_0x43bb('0x45')]=[{'all':!![]}];}return db[_0x43bb('0x43')][_0x43bb('0x46')](_0x4aa730);})[_0x43bb('0x26')](function(_0x53fb07){_0x4edbd4[_0x43bb('0x47')]=_0x53fb07;return _0x4edbd4;})[_0x43bb('0x26')](respondWithFilteredResult(_0x383a8d,_0x4aa730))[_0x43bb('0x48')](handleError(_0x383a8d,null));};exports[_0x43bb('0x49')]=function(_0x5efa0d,_0xa4925e){var _0x3b1245={'raw':!![],'where':{'id':_0x5efa0d[_0x43bb('0x4a')]['id']}},_0x320b24={};_0x320b24[_0x43bb('0x38')]=_[_0x43bb('0x34')](db[_0x43bb('0x43')][_0x43bb('0x2f')]);_0x320b24[_0x43bb('0x33')]=_['keys'](_0x5efa0d[_0x43bb('0x33')]);_0x320b24[_0x43bb('0x35')]=_['intersection'](_0x320b24[_0x43bb('0x38')],_0x320b24[_0x43bb('0x33')]);_0x3b1245[_0x43bb('0x36')]=_[_0x43bb('0x37')](_0x320b24[_0x43bb('0x38')],qs[_0x43bb('0x39')](_0x5efa0d[_0x43bb('0x33')]['fields']));_0x3b1245[_0x43bb('0x36')]=_0x3b1245[_0x43bb('0x36')]['length']?_0x3b1245[_0x43bb('0x36')]:_0x320b24[_0x43bb('0x38')];if(_0x5efa0d[_0x43bb('0x33')][_0x43bb('0x44')]){_0x3b1245[_0x43bb('0x45')]=[{'all':!![]}];}_0x3b1245=_[_0x43bb('0x41')]({},_0x3b1245,_0x5efa0d[_0x43bb('0x42')]);return db[_0x43bb('0x43')][_0x43bb('0x4b')](_0x3b1245)[_0x43bb('0x26')](handleEntityNotFound(_0xa4925e,null))[_0x43bb('0x26')](respondWithResult(_0xa4925e,null))[_0x43bb('0x48')](handleError(_0xa4925e,null));};exports[_0x43bb('0x4c')]=function(_0x17a066,_0x57058a){return db[_0x43bb('0x43')][_0x43bb('0x4c')](_0x17a066[_0x43bb('0x4d')],{})[_0x43bb('0x26')](respondWithResult(_0x57058a,0xc9))[_0x43bb('0x48')](handleError(_0x57058a,null));};exports[_0x43bb('0x25')]=function(_0x36ab2f,_0x331c2e){if(_0x36ab2f['body']['id']){delete _0x36ab2f[_0x43bb('0x4d')]['id'];}return db['SmsQueueReport'][_0x43bb('0x4b')]({'where':{'id':_0x36ab2f[_0x43bb('0x4a')]['id']}})[_0x43bb('0x26')](handleEntityNotFound(_0x331c2e,null))[_0x43bb('0x26')](saveUpdates(_0x36ab2f[_0x43bb('0x4d')],null))[_0x43bb('0x26')](respondWithResult(_0x331c2e,null))['catch'](handleError(_0x331c2e,null));};exports['destroy']=function(_0x1fdacf,_0x1ed2e4){return db[_0x43bb('0x43')]['find']({'where':{'id':_0x1fdacf[_0x43bb('0x4a')]['id']}})[_0x43bb('0x26')](handleEntityNotFound(_0x1ed2e4,null))[_0x43bb('0x26')](removeEntity(_0x1ed2e4,null))[_0x43bb('0x48')](handleError(_0x1ed2e4,null));};exports[_0x43bb('0x4e')]=function(_0x430cf5,_0x4e3440){return db[_0x43bb('0x43')][_0x43bb('0x4e')]()['then'](respondWithResult(_0x4e3440,null))['catch'](handleError(_0x4e3440,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 29d564f..ff96bc3 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x370597,_0x39eaf2){var _0x3e5ca2=function(_0x1e1d7b){while(--_0x1e1d7b){_0x370597['push'](_0x370597['shift']());}};_0x3e5ca2(++_0x39eaf2);}(_0xe706,0xa3));var _0x6e70=function(_0x27e2c8,_0x5f40a0){_0x27e2c8=_0x27e2c8-0x0;var _0x5454d4=_0xe706[_0x27e2c8];return _0x5454d4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index eb614d7..37f090b 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 _0x7999=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','stringify','UpdateSmsQueueReport','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x6663b0,_0x31ce17){var _0x5e61ac=function(_0x58db77){while(--_0x58db77){_0x6663b0['push'](_0x6663b0['shift']());}};_0x5e61ac(++_0x31ce17);}(_0x7999,0x17f));var _0x9799=function(_0x272fa4,_0xf712d1){_0x272fa4=_0x272fa4-0x0;var _0x25ec85=_0x7999[_0x272fa4];return _0x25ec85;};'use strict';var _=require(_0x9799('0x0'));var util=require('util');var moment=require(_0x9799('0x1'));var BPromise=require(_0x9799('0x2'));var rs=require(_0x9799('0x3'));var fs=require('fs');var Redis=require(_0x9799('0x4'));var db=require(_0x9799('0x5'))['db'];var utils=require(_0x9799('0x6'));var logger=require(_0x9799('0x7'))('rpc');var config=require(_0x9799('0x8'));var jayson=require(_0x9799('0x9'));var client=jayson['client'][_0x9799('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213e0e,_0x25f9da,_0x190bd1){return new BPromise(function(_0x17d7a1,_0x22a748){return client[_0x9799('0xb')](_0x213e0e,_0x190bd1)[_0x9799('0xc')](function(_0x50e035){logger['info'](_0x9799('0xd'),_0x25f9da,_0x9799('0xe'));logger[_0x9799('0xf')](_0x9799('0x10'),_0x25f9da,_0x9799('0xe'),JSON['stringify'](_0x50e035));if(_0x50e035['error']){if(_0x50e035['error'][_0x9799('0x11')]===0x1f4){logger[_0x9799('0x12')](_0x9799('0xd'),_0x25f9da,_0x50e035[_0x9799('0x12')][_0x9799('0x13')]);return _0x22a748(_0x50e035['error'][_0x9799('0x13')]);}logger[_0x9799('0x12')](_0x9799('0xd'),_0x25f9da,_0x50e035[_0x9799('0x12')][_0x9799('0x13')]);return _0x17d7a1(_0x50e035['error'][_0x9799('0x13')]);}else{logger[_0x9799('0x14')](_0x9799('0xd'),_0x25f9da,_0x9799('0xe'));_0x17d7a1(_0x50e035[_0x9799('0x15')][_0x9799('0x13')]);}})[_0x9799('0x16')](function(_0x88bdaa){logger[_0x9799('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x25f9da,_0x88bdaa);_0x22a748(_0x88bdaa);});});}exports[_0x9799('0x17')]=function(_0x16ddfe){var _0x419817=this;return new Promise(function(_0x3d61e4,_0x3ce48e){return db[_0x9799('0x18')]['create'](_0x16ddfe[_0x9799('0x19')],{'raw':_0x16ddfe['options']?_0x16ddfe[_0x9799('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9799('0xc')](function(_0x157ebb){logger[_0x9799('0x14')](_0x9799('0x17'),_0x16ddfe);logger['debug'](_0x9799('0x17'),_0x16ddfe,JSON[_0x9799('0x1b')](_0x157ebb));_0x3d61e4(_0x157ebb);})['catch'](function(_0x206169){logger[_0x9799('0x12')]('CreateSmsQueueReport',_0x206169[_0x9799('0x13')],_0x16ddfe);_0x3ce48e(_0x419817[_0x9799('0x12')](0x1f4,_0x206169[_0x9799('0x13')]));});});};exports[_0x9799('0x1c')]=function(_0x55ac74){var _0x44d68d=this;return new Promise(function(_0x20f94d,_0x5a7537){return db[_0x9799('0x18')]['update'](_0x55ac74[_0x9799('0x19')],{'raw':_0x55ac74[_0x9799('0x1a')]?_0x55ac74[_0x9799('0x1a')][_0x9799('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ac74[_0x9799('0x1a')]?_0x55ac74[_0x9799('0x1a')][_0x9799('0x1e')]||null:null,'attributes':_0x55ac74[_0x9799('0x1a')]?_0x55ac74[_0x9799('0x1a')][_0x9799('0x1f')]||null:null,'limit':_0x55ac74[_0x9799('0x1a')]?_0x55ac74[_0x9799('0x1a')][_0x9799('0x20')]||null:null})[_0x9799('0xc')](function(_0x417571){logger[_0x9799('0x14')]('UpdateSmsQueueReport',_0x55ac74);logger['debug']('UpdateSmsQueueReport',_0x55ac74,JSON[_0x9799('0x1b')](_0x417571));_0x20f94d(_0x417571);})[_0x9799('0x16')](function(_0x5447f5){logger[_0x9799('0x12')]('UpdateSmsQueueReport',_0x5447f5[_0x9799('0x13')],_0x55ac74);_0x5a7537(_0x44d68d[_0x9799('0x12')](0x1f4,_0x5447f5[_0x9799('0x13')]));});});}; \ No newline at end of file +var _0x29b1=['limit','then','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','create','body','options','UpdateSmsQueueReport','SmsQueueReport','raw','where','attributes'];(function(_0x322184,_0x4ecac1){var _0x18f08a=function(_0x332317){while(--_0x332317){_0x322184['push'](_0x322184['shift']());}};_0x18f08a(++_0x4ecac1);}(_0x29b1,0xf2));var _0x129b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x29b1[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x129b('0x0'));var BPromise=require(_0x129b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129b('0x2'))['db'];var utils=require(_0x129b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x129b('0x4'));var jayson=require(_0x129b('0x5'));var client=jayson[_0x129b('0x6')][_0x129b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xecc731,_0x3a955a,_0xceff6d){return new BPromise(function(_0x5927dd,_0x17bb27){return client[_0x129b('0x8')](_0xecc731,_0xceff6d)['then'](function(_0x2a6b3f){logger[_0x129b('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x3a955a,'request\x20sent');logger[_0x129b('0xa')](_0x129b('0xb'),_0x3a955a,_0x129b('0xc'),JSON[_0x129b('0xd')](_0x2a6b3f));if(_0x2a6b3f[_0x129b('0xe')]){if(_0x2a6b3f['error'][_0x129b('0xf')]===0x1f4){logger['error'](_0x129b('0x10'),_0x3a955a,_0x2a6b3f[_0x129b('0xe')]['message']);return _0x17bb27(_0x2a6b3f[_0x129b('0xe')][_0x129b('0x11')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3a955a,_0x2a6b3f[_0x129b('0xe')][_0x129b('0x11')]);return _0x5927dd(_0x2a6b3f[_0x129b('0xe')][_0x129b('0x11')]);}else{logger[_0x129b('0x9')](_0x129b('0x10'),_0x3a955a,_0x129b('0xc'));_0x5927dd(_0x2a6b3f['result'][_0x129b('0x11')]);}})[_0x129b('0x12')](function(_0x5c6111){logger[_0x129b('0xe')](_0x129b('0x10'),_0x3a955a,_0x5c6111);_0x17bb27(_0x5c6111);});});}exports[_0x129b('0x13')]=function(_0x2c1fb4){var _0x17634b=this;return new Promise(function(_0x2d38db,_0x4cdc0c){return db['SmsQueueReport'][_0x129b('0x14')](_0x2c1fb4[_0x129b('0x15')],{'raw':_0x2c1fb4[_0x129b('0x16')]?_0x2c1fb4[_0x129b('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6def31){logger[_0x129b('0x9')](_0x129b('0x13'),_0x2c1fb4);logger[_0x129b('0xa')](_0x129b('0x13'),_0x2c1fb4,JSON[_0x129b('0xd')](_0x6def31));_0x2d38db(_0x6def31);})[_0x129b('0x12')](function(_0x1bfbe2){logger[_0x129b('0xe')](_0x129b('0x13'),_0x1bfbe2[_0x129b('0x11')],_0x2c1fb4);_0x4cdc0c(_0x17634b[_0x129b('0xe')](0x1f4,_0x1bfbe2[_0x129b('0x11')]));});});};exports[_0x129b('0x17')]=function(_0x545efa){var _0x20e604=this;return new Promise(function(_0x4e4076,_0x55870e){return db[_0x129b('0x18')]['update'](_0x545efa[_0x129b('0x15')],{'raw':_0x545efa['options']?_0x545efa[_0x129b('0x16')][_0x129b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x545efa[_0x129b('0x16')]?_0x545efa[_0x129b('0x16')][_0x129b('0x1a')]||null:null,'attributes':_0x545efa[_0x129b('0x16')]?_0x545efa[_0x129b('0x16')][_0x129b('0x1b')]||null:null,'limit':_0x545efa[_0x129b('0x16')]?_0x545efa[_0x129b('0x16')][_0x129b('0x1c')]||null:null})[_0x129b('0x1d')](function(_0x3804e5){logger[_0x129b('0x9')](_0x129b('0x17'),_0x545efa);logger['debug'](_0x129b('0x17'),_0x545efa,JSON[_0x129b('0xd')](_0x3804e5));_0x4e4076(_0x3804e5);})[_0x129b('0x12')](function(_0x2a0289){logger[_0x129b('0xe')](_0x129b('0x17'),_0x2a0289[_0x129b('0x11')],_0x545efa);_0x55870e(_0x20e604['error'](0x1f4,_0x2a0289['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 230c8f4..5eeb4a8 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 _0xfd20=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfd20,0x66));var _0x0fd2=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0xfd20[_0x136e17];return _0x5099c9;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/describe',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')]('/',auth['isAuthenticated'](),controller[_0x0fd2('0xd')]);router[_0x0fd2('0xe')]('/:id',auth[_0x0fd2('0x7')](),controller['update']);router[_0x0fd2('0xf')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x10')]);module[_0x0fd2('0x11')]=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x4163f3,_0x5b11d6){var _0x4d1fc1=function(_0x35e05d){while(--_0x35e05d){_0x4163f3['push'](_0x4163f3['shift']());}};_0x4d1fc1(++_0x5b11d6);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);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 5a74791..f3c63cb 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x49eaba,_0x2bd164){var _0x826c11=function(_0xf23d84){while(--_0xf23d84){_0x49eaba['push'](_0x49eaba['shift']());}};_0x826c11(++_0x2bd164);}(_0x70e0,0x17b));var _0x070e=function(_0x4592da,_0x1d41ad){_0x4592da=_0x4592da-0x0;var _0x56f2d2=_0x70e0[_0x4592da];return _0x56f2d2;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3c5924,_0x4d295f){var _0x576958=function(_0x4a3e2d){while(--_0x4a3e2d){_0x3c5924['push'](_0x3c5924['shift']());}};_0x576958(++_0x4d295f);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 41ad177..e36b900 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 _0x5aac=['name','send','map','SmsTransferReport','rawAttributes','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','keys','length','find','catch','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x11908c,_0x547af6){var _0x10cd4e=function(_0x2c0d66){while(--_0x2c0d66){_0x11908c['push'](_0x11908c['shift']());}};_0x10cd4e(++_0x547af6);}(_0x5aac,0x1ea));var _0xc5aa=function(_0xe2a56d,_0x45b025){_0xe2a56d=_0xe2a56d-0x0;var _0x529238=_0x5aac[_0xe2a56d];return _0x529238;};'use strict';var emlformat=require(_0xc5aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5aa('0x1'));var jsonpatch=require(_0xc5aa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc5aa('0x3'));var Mustache=require(_0xc5aa('0x4'));var util=require(_0xc5aa('0x5'));var path=require(_0xc5aa('0x6'));var sox=require(_0xc5aa('0x7'));var csv=require(_0xc5aa('0x8'));var ejs=require(_0xc5aa('0x9'));var fs=require('fs');var fs_extra=require(_0xc5aa('0xa'));var _=require(_0xc5aa('0xb'));var squel=require(_0xc5aa('0xc'));var crypto=require(_0xc5aa('0xd'));var jsforce=require(_0xc5aa('0xe'));var deskjs=require(_0xc5aa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc5aa('0x10'));var Papa=require(_0xc5aa('0x11'));var Redis=require(_0xc5aa('0x12'));var authService=require(_0xc5aa('0x13'));var qs=require(_0xc5aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5aa('0x15'));var logger=require('../../config/logger')(_0xc5aa('0x16'));var utils=require('../../config/utils');var config=require(_0xc5aa('0x17'));var licenseUtil=require(_0xc5aa('0x18'));var db=require(_0xc5aa('0x19'))['db'];function respondWithStatusCode(_0x485222,_0x229c2a){_0x229c2a=_0x229c2a||0xcc;return function(_0x4162fc){if(_0x4162fc){return _0x485222[_0xc5aa('0x1a')](_0x229c2a);}return _0x485222[_0xc5aa('0x1b')](_0x229c2a)[_0xc5aa('0x1c')]();};}function respondWithResult(_0x295869,_0x39d569){_0x39d569=_0x39d569||0xc8;return function(_0x38b12e){if(_0x38b12e){return _0x295869['status'](_0x39d569)[_0xc5aa('0x1d')](_0x38b12e);}};}function respondWithFilteredResult(_0x5114f9,_0x5557be){return function(_0x20e535){if(_0x20e535){var _0x4385ae=typeof _0x5557be['offset']===_0xc5aa('0x1e')&&typeof _0x5557be[_0xc5aa('0x1f')]==='undefined';var _0x1c6905=_0x20e535[_0xc5aa('0x20')];var _0xd88cba=_0x4385ae?0x0:_0x5557be['offset'];var _0x310f05=_0x4385ae?_0x20e535['count']:_0x5557be[_0xc5aa('0x21')]+_0x5557be[_0xc5aa('0x1f')];var _0xed3481;if(_0x310f05>=_0x1c6905){_0x310f05=_0x1c6905;_0xed3481=0xc8;}else{_0xed3481=0xce;}_0x5114f9[_0xc5aa('0x1b')](_0xed3481);return _0x5114f9[_0xc5aa('0x22')](_0xc5aa('0x23'),_0xd88cba+'-'+_0x310f05+'/'+_0x1c6905)['json'](_0x20e535);}return null;};}function patchUpdates(_0x5ceb2a){return function(_0x2439bb){try{jsonpatch[_0xc5aa('0x24')](_0x2439bb,_0x5ceb2a,!![]);}catch(_0x1251ad){return BPromise[_0xc5aa('0x25')](_0x1251ad);}return _0x2439bb[_0xc5aa('0x26')]();};}function saveUpdates(_0x4a3756,_0x2a787f){return function(_0x57e4db){if(_0x57e4db){return _0x57e4db['update'](_0x4a3756)[_0xc5aa('0x27')](function(_0x54c1a2){return _0x54c1a2;});}return null;};}function removeEntity(_0x6f6bbe,_0x46a38b){return function(_0x51598e){if(_0x51598e){return _0x51598e['destroy']()[_0xc5aa('0x27')](function(){_0x6f6bbe[_0xc5aa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45342b,_0x452f56){return function(_0x267936){if(!_0x267936){_0x45342b['sendStatus'](0x194);}return _0x267936;};}function handleError(_0x98068,_0x4b658b){_0x4b658b=_0x4b658b||0x1f4;return function(_0x31a09){logger[_0xc5aa('0x28')](_0x31a09[_0xc5aa('0x29')]);if(_0x31a09[_0xc5aa('0x2a')]){delete _0x31a09[_0xc5aa('0x2a')];}_0x98068[_0xc5aa('0x1b')](_0x4b658b)[_0xc5aa('0x2b')](_0x31a09);};}exports['index']=function(_0x3382d2,_0x59b49c){var _0x39d9fc={},_0x43d48f={},_0x20f1c0={'count':0x0,'rows':[]};var _0x53a9d5=_[_0xc5aa('0x2c')](db[_0xc5aa('0x2d')][_0xc5aa('0x2e')],function(_0x24035a){return{'name':_0x24035a['fieldName'],'type':_0x24035a['type']['key']};});_0x43d48f[_0xc5aa('0x2f')]=_[_0xc5aa('0x2c')](_0x53a9d5,_0xc5aa('0x2a'));_0x43d48f[_0xc5aa('0x30')]=_['keys'](_0x3382d2['query']);_0x43d48f['filters']=_[_0xc5aa('0x31')](_0x43d48f[_0xc5aa('0x2f')],_0x43d48f[_0xc5aa('0x30')]);_0x39d9fc['attributes']=_[_0xc5aa('0x31')](_0x43d48f[_0xc5aa('0x2f')],qs['fields'](_0x3382d2[_0xc5aa('0x30')][_0xc5aa('0x32')]));_0x39d9fc[_0xc5aa('0x33')]=_0x39d9fc[_0xc5aa('0x33')]['length']?_0x39d9fc[_0xc5aa('0x33')]:_0x43d48f['model'];if(!_0x3382d2[_0xc5aa('0x30')]['hasOwnProperty'](_0xc5aa('0x34'))){_0x39d9fc[_0xc5aa('0x1f')]=qs[_0xc5aa('0x1f')](_0x3382d2[_0xc5aa('0x30')][_0xc5aa('0x1f')]);_0x39d9fc[_0xc5aa('0x21')]=qs[_0xc5aa('0x21')](_0x3382d2[_0xc5aa('0x30')][_0xc5aa('0x21')]);}_0x39d9fc[_0xc5aa('0x35')]=qs[_0xc5aa('0x36')](_0x3382d2[_0xc5aa('0x30')]['sort']);_0x39d9fc[_0xc5aa('0x37')]=qs[_0xc5aa('0x38')](_[_0xc5aa('0x39')](_0x3382d2[_0xc5aa('0x30')],_0x43d48f['filters']),_0x53a9d5);if(_0x3382d2[_0xc5aa('0x30')][_0xc5aa('0x3a')]){_0x39d9fc['where']=_[_0xc5aa('0x3b')](_0x39d9fc[_0xc5aa('0x37')],{'$or':_['map'](_0x53a9d5,function(_0x5f4444){if(_0x5f4444[_0xc5aa('0x3c')]!==_0xc5aa('0x3d')){var _0x50a1f0={};_0x50a1f0[_0x5f4444[_0xc5aa('0x2a')]]={'$like':'%'+_0x3382d2[_0xc5aa('0x30')]['filter']+'%'};return _0x50a1f0;}})});}_0x39d9fc=_[_0xc5aa('0x3b')]({},_0x39d9fc,_0x3382d2[_0xc5aa('0x3e')]);var _0x483d7f={'where':_0x39d9fc[_0xc5aa('0x37')]};return db['SmsTransferReport'][_0xc5aa('0x20')](_0x483d7f)[_0xc5aa('0x27')](function(_0x393606){_0x20f1c0[_0xc5aa('0x20')]=_0x393606;if(_0x3382d2[_0xc5aa('0x30')][_0xc5aa('0x3f')]){_0x39d9fc[_0xc5aa('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xc5aa('0x41')](_0x39d9fc);})[_0xc5aa('0x27')](function(_0x30e3a8){_0x20f1c0['rows']=_0x30e3a8;return _0x20f1c0;})[_0xc5aa('0x27')](respondWithFilteredResult(_0x59b49c,_0x39d9fc))['catch'](handleError(_0x59b49c,null));};exports['show']=function(_0x41044b,_0x2eaf4){var _0x4224a2={'raw':!![],'where':{'id':_0x41044b[_0xc5aa('0x42')]['id']}},_0x1eade5={};_0x1eade5[_0xc5aa('0x2f')]=_['keys'](db[_0xc5aa('0x2d')]['rawAttributes']);_0x1eade5[_0xc5aa('0x30')]=_[_0xc5aa('0x43')](_0x41044b[_0xc5aa('0x30')]);_0x1eade5['filters']=_[_0xc5aa('0x31')](_0x1eade5[_0xc5aa('0x2f')],_0x1eade5[_0xc5aa('0x30')]);_0x4224a2[_0xc5aa('0x33')]=_[_0xc5aa('0x31')](_0x1eade5[_0xc5aa('0x2f')],qs[_0xc5aa('0x32')](_0x41044b[_0xc5aa('0x30')]['fields']));_0x4224a2['attributes']=_0x4224a2[_0xc5aa('0x33')][_0xc5aa('0x44')]?_0x4224a2[_0xc5aa('0x33')]:_0x1eade5[_0xc5aa('0x2f')];if(_0x41044b['query']['includeAll']){_0x4224a2[_0xc5aa('0x40')]=[{'all':!![]}];}_0x4224a2=_[_0xc5aa('0x3b')]({},_0x4224a2,_0x41044b[_0xc5aa('0x3e')]);return db[_0xc5aa('0x2d')][_0xc5aa('0x45')](_0x4224a2)[_0xc5aa('0x27')](handleEntityNotFound(_0x2eaf4,null))[_0xc5aa('0x27')](respondWithResult(_0x2eaf4,null))[_0xc5aa('0x46')](handleError(_0x2eaf4,null));};exports[_0xc5aa('0x47')]=function(_0x5cd18f,_0x3cab37){return db['SmsTransferReport'][_0xc5aa('0x47')](_0x5cd18f['body'],{})[_0xc5aa('0x27')](respondWithResult(_0x3cab37,0xc9))[_0xc5aa('0x46')](handleError(_0x3cab37,null));};exports[_0xc5aa('0x48')]=function(_0x274e7f,_0x16ca56){if(_0x274e7f[_0xc5aa('0x49')]['id']){delete _0x274e7f[_0xc5aa('0x49')]['id'];}return db[_0xc5aa('0x2d')][_0xc5aa('0x45')]({'where':{'id':_0x274e7f[_0xc5aa('0x42')]['id']}})[_0xc5aa('0x27')](handleEntityNotFound(_0x16ca56,null))['then'](saveUpdates(_0x274e7f[_0xc5aa('0x49')],null))['then'](respondWithResult(_0x16ca56,null))[_0xc5aa('0x46')](handleError(_0x16ca56,null));};exports[_0xc5aa('0x4a')]=function(_0xe32777,_0xfa047b){return db[_0xc5aa('0x2d')][_0xc5aa('0x45')]({'where':{'id':_0xe32777[_0xc5aa('0x42')]['id']}})[_0xc5aa('0x27')](handleEntityNotFound(_0xfa047b,null))[_0xc5aa('0x27')](removeEntity(_0xfa047b,null))[_0xc5aa('0x46')](handleError(_0xfa047b,null));};exports[_0xc5aa('0x4b')]=function(_0x3caa4d,_0x1757b3){return db[_0xc5aa('0x2d')][_0xc5aa('0x4b')]()[_0xc5aa('0x27')](respondWithResult(_0x1757b3,null))['catch'](handleError(_0x1757b3,null));}; \ No newline at end of file +var _0xcd15=['pick','filter','merge','VIRTUAL','options','SmsTransferReport','count','includeAll','include','rows','catch','params','intersection','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xcd15,0xf6));var _0x5cd1=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0xcd15[_0x2daef6];return _0x62d030;};'use strict';var emlformat=require(_0x5cd1('0x0'));var rimraf=require(_0x5cd1('0x1'));var zipdir=require(_0x5cd1('0x2'));var jsonpatch=require(_0x5cd1('0x3'));var rp=require(_0x5cd1('0x4'));var moment=require(_0x5cd1('0x5'));var BPromise=require(_0x5cd1('0x6'));var Mustache=require(_0x5cd1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5cd1('0x8'));var csv=require(_0x5cd1('0x9'));var ejs=require(_0x5cd1('0xa'));var fs=require('fs');var fs_extra=require(_0x5cd1('0xb'));var _=require(_0x5cd1('0xc'));var squel=require(_0x5cd1('0xd'));var crypto=require(_0x5cd1('0xe'));var jsforce=require(_0x5cd1('0xf'));var deskjs=require(_0x5cd1('0x10'));var toCsv=require(_0x5cd1('0x9'));var querystring=require('querystring');var Papa=require(_0x5cd1('0x11'));var Redis=require('ioredis');var authService=require(_0x5cd1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5cd1('0x13'));var hardwareService=require(_0x5cd1('0x14'));var logger=require('../../config/logger')(_0x5cd1('0x15'));var utils=require(_0x5cd1('0x16'));var config=require(_0x5cd1('0x17'));var licenseUtil=require(_0x5cd1('0x18'));var db=require(_0x5cd1('0x19'))['db'];function respondWithStatusCode(_0x2a90f8,_0x28b496){_0x28b496=_0x28b496||0xcc;return function(_0x33f2ac){if(_0x33f2ac){return _0x2a90f8[_0x5cd1('0x1a')](_0x28b496);}return _0x2a90f8[_0x5cd1('0x1b')](_0x28b496)[_0x5cd1('0x1c')]();};}function respondWithResult(_0x4ef1be,_0x25bcee){_0x25bcee=_0x25bcee||0xc8;return function(_0x3d3ef9){if(_0x3d3ef9){return _0x4ef1be[_0x5cd1('0x1b')](_0x25bcee)[_0x5cd1('0x1d')](_0x3d3ef9);}};}function respondWithFilteredResult(_0x3440be,_0x19c1ab){return function(_0x503889){if(_0x503889){var _0x44b418=typeof _0x19c1ab[_0x5cd1('0x1e')]===_0x5cd1('0x1f')&&typeof _0x19c1ab[_0x5cd1('0x20')]===_0x5cd1('0x1f');var _0x33f231=_0x503889['count'];var _0x308974=_0x44b418?0x0:_0x19c1ab[_0x5cd1('0x1e')];var _0x52abba=_0x44b418?_0x503889['count']:_0x19c1ab['offset']+_0x19c1ab['limit'];var _0x47dee2;if(_0x52abba>=_0x33f231){_0x52abba=_0x33f231;_0x47dee2=0xc8;}else{_0x47dee2=0xce;}_0x3440be[_0x5cd1('0x1b')](_0x47dee2);return _0x3440be[_0x5cd1('0x21')](_0x5cd1('0x22'),_0x308974+'-'+_0x52abba+'/'+_0x33f231)[_0x5cd1('0x1d')](_0x503889);}return null;};}function patchUpdates(_0x13fc09){return function(_0x2f1ff3){try{jsonpatch[_0x5cd1('0x23')](_0x2f1ff3,_0x13fc09,!![]);}catch(_0x4f8ef3){return BPromise[_0x5cd1('0x24')](_0x4f8ef3);}return _0x2f1ff3['save']();};}function saveUpdates(_0x22f34d,_0x4b3729){return function(_0x109a0c){if(_0x109a0c){return _0x109a0c[_0x5cd1('0x25')](_0x22f34d)['then'](function(_0x22216d){return _0x22216d;});}return null;};}function removeEntity(_0x4c1f40,_0x2d2c00){return function(_0x32876a){if(_0x32876a){return _0x32876a[_0x5cd1('0x26')]()[_0x5cd1('0x27')](function(){_0x4c1f40[_0x5cd1('0x1b')](0xcc)[_0x5cd1('0x1c')]();});}};}function handleEntityNotFound(_0x26d720,_0x2010f6){return function(_0x24c85a){if(!_0x24c85a){_0x26d720[_0x5cd1('0x1a')](0x194);}return _0x24c85a;};}function handleError(_0x28d96a,_0x2ae1a4){_0x2ae1a4=_0x2ae1a4||0x1f4;return function(_0x41e1db){logger[_0x5cd1('0x28')](_0x41e1db[_0x5cd1('0x29')]);if(_0x41e1db[_0x5cd1('0x2a')]){delete _0x41e1db[_0x5cd1('0x2a')];}_0x28d96a[_0x5cd1('0x1b')](_0x2ae1a4)[_0x5cd1('0x2b')](_0x41e1db);};}exports['index']=function(_0x43d9b9,_0x534d4a){var _0x38fb35={},_0x46f1fd={},_0xe4419d={'count':0x0,'rows':[]};var _0x4ac01e=_['map'](db['SmsTransferReport'][_0x5cd1('0x2c')],function(_0x1d942a){return{'name':_0x1d942a[_0x5cd1('0x2d')],'type':_0x1d942a['type']['key']};});_0x46f1fd[_0x5cd1('0x2e')]=_[_0x5cd1('0x2f')](_0x4ac01e,_0x5cd1('0x2a'));_0x46f1fd[_0x5cd1('0x30')]=_[_0x5cd1('0x31')](_0x43d9b9['query']);_0x46f1fd[_0x5cd1('0x32')]=_['intersection'](_0x46f1fd[_0x5cd1('0x2e')],_0x46f1fd[_0x5cd1('0x30')]);_0x38fb35[_0x5cd1('0x33')]=_['intersection'](_0x46f1fd[_0x5cd1('0x2e')],qs[_0x5cd1('0x34')](_0x43d9b9[_0x5cd1('0x30')][_0x5cd1('0x34')]));_0x38fb35[_0x5cd1('0x33')]=_0x38fb35['attributes']['length']?_0x38fb35[_0x5cd1('0x33')]:_0x46f1fd['model'];if(!_0x43d9b9[_0x5cd1('0x30')][_0x5cd1('0x35')](_0x5cd1('0x36'))){_0x38fb35[_0x5cd1('0x20')]=qs[_0x5cd1('0x20')](_0x43d9b9[_0x5cd1('0x30')][_0x5cd1('0x20')]);_0x38fb35[_0x5cd1('0x1e')]=qs[_0x5cd1('0x1e')](_0x43d9b9['query']['offset']);}_0x38fb35[_0x5cd1('0x37')]=qs['sort'](_0x43d9b9[_0x5cd1('0x30')][_0x5cd1('0x38')]);_0x38fb35[_0x5cd1('0x39')]=qs[_0x5cd1('0x32')](_[_0x5cd1('0x3a')](_0x43d9b9[_0x5cd1('0x30')],_0x46f1fd[_0x5cd1('0x32')]),_0x4ac01e);if(_0x43d9b9[_0x5cd1('0x30')][_0x5cd1('0x3b')]){_0x38fb35[_0x5cd1('0x39')]=_[_0x5cd1('0x3c')](_0x38fb35[_0x5cd1('0x39')],{'$or':_[_0x5cd1('0x2f')](_0x4ac01e,function(_0xfdcc2d){if(_0xfdcc2d['type']!==_0x5cd1('0x3d')){var _0x3e7c1e={};_0x3e7c1e[_0xfdcc2d[_0x5cd1('0x2a')]]={'$like':'%'+_0x43d9b9[_0x5cd1('0x30')]['filter']+'%'};return _0x3e7c1e;}})});}_0x38fb35=_['merge']({},_0x38fb35,_0x43d9b9[_0x5cd1('0x3e')]);var _0x5839bf={'where':_0x38fb35[_0x5cd1('0x39')]};return db[_0x5cd1('0x3f')][_0x5cd1('0x40')](_0x5839bf)[_0x5cd1('0x27')](function(_0x595f44){_0xe4419d[_0x5cd1('0x40')]=_0x595f44;if(_0x43d9b9['query'][_0x5cd1('0x41')]){_0x38fb35[_0x5cd1('0x42')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x38fb35);})[_0x5cd1('0x27')](function(_0x4afe23){_0xe4419d[_0x5cd1('0x43')]=_0x4afe23;return _0xe4419d;})[_0x5cd1('0x27')](respondWithFilteredResult(_0x534d4a,_0x38fb35))[_0x5cd1('0x44')](handleError(_0x534d4a,null));};exports['show']=function(_0x15d0d3,_0x16d6a0){var _0x505725={'raw':!![],'where':{'id':_0x15d0d3[_0x5cd1('0x45')]['id']}},_0x802e14={};_0x802e14[_0x5cd1('0x2e')]=_[_0x5cd1('0x31')](db[_0x5cd1('0x3f')][_0x5cd1('0x2c')]);_0x802e14[_0x5cd1('0x30')]=_[_0x5cd1('0x31')](_0x15d0d3[_0x5cd1('0x30')]);_0x802e14[_0x5cd1('0x32')]=_[_0x5cd1('0x46')](_0x802e14['model'],_0x802e14[_0x5cd1('0x30')]);_0x505725[_0x5cd1('0x33')]=_[_0x5cd1('0x46')](_0x802e14[_0x5cd1('0x2e')],qs[_0x5cd1('0x34')](_0x15d0d3[_0x5cd1('0x30')][_0x5cd1('0x34')]));_0x505725[_0x5cd1('0x33')]=_0x505725['attributes'][_0x5cd1('0x47')]?_0x505725['attributes']:_0x802e14[_0x5cd1('0x2e')];if(_0x15d0d3[_0x5cd1('0x30')][_0x5cd1('0x41')]){_0x505725[_0x5cd1('0x42')]=[{'all':!![]}];}_0x505725=_['merge']({},_0x505725,_0x15d0d3[_0x5cd1('0x3e')]);return db[_0x5cd1('0x3f')]['find'](_0x505725)['then'](handleEntityNotFound(_0x16d6a0,null))[_0x5cd1('0x27')](respondWithResult(_0x16d6a0,null))[_0x5cd1('0x44')](handleError(_0x16d6a0,null));};exports[_0x5cd1('0x48')]=function(_0x688faf,_0x415192){return db[_0x5cd1('0x3f')][_0x5cd1('0x48')](_0x688faf[_0x5cd1('0x49')],{})['then'](respondWithResult(_0x415192,0xc9))['catch'](handleError(_0x415192,null));};exports[_0x5cd1('0x25')]=function(_0x2dce1c,_0x505541){if(_0x2dce1c[_0x5cd1('0x49')]['id']){delete _0x2dce1c[_0x5cd1('0x49')]['id'];}return db[_0x5cd1('0x3f')][_0x5cd1('0x4a')]({'where':{'id':_0x2dce1c['params']['id']}})[_0x5cd1('0x27')](handleEntityNotFound(_0x505541,null))['then'](saveUpdates(_0x2dce1c[_0x5cd1('0x49')],null))[_0x5cd1('0x27')](respondWithResult(_0x505541,null))['catch'](handleError(_0x505541,null));};exports[_0x5cd1('0x26')]=function(_0x31c885,_0x4c6400){return db[_0x5cd1('0x3f')][_0x5cd1('0x4a')]({'where':{'id':_0x31c885[_0x5cd1('0x45')]['id']}})[_0x5cd1('0x27')](handleEntityNotFound(_0x4c6400,null))[_0x5cd1('0x27')](removeEntity(_0x4c6400,null))[_0x5cd1('0x44')](handleError(_0x4c6400,null));};exports[_0x5cd1('0x4b')]=function(_0x5f0cba,_0x2ca6c0){return db[_0x5cd1('0x3f')][_0x5cd1('0x4b')]()[_0x5cd1('0x27')](respondWithResult(_0x2ca6c0,null))['catch'](handleError(_0x2ca6c0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f6552e0..7562891 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 _0x8b97=['../../config/environment','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x55205d,_0x1d5cae){var _0x946766=function(_0x5c569d){while(--_0x5c569d){_0x55205d['push'](_0x55205d['shift']());}};_0x946766(++_0x1d5cae);}(_0x8b97,0x1d9));var _0x78b9=function(_0x41b132,_0x1e096c){_0x41b132=_0x41b132-0x0;var _0x2ad393=_0x8b97[_0x41b132];return _0x2ad393;};'use strict';var _=require(_0x78b9('0x0'));var util=require('util');var logger=require(_0x78b9('0x1'))(_0x78b9('0x2'));var moment=require(_0x78b9('0x3'));var BPromise=require(_0x78b9('0x4'));var rp=require(_0x78b9('0x5'));var fs=require('fs');var path=require(_0x78b9('0x6'));var rimraf=require('rimraf');var config=require(_0x78b9('0x7'));var attributes=require(_0x78b9('0x8'));module['exports']=function(_0x194bb3,_0x1de137){return _0x194bb3['define'](_0x78b9('0x9'),attributes,{'tableName':_0x78b9('0xa'),'paranoid':![],'indexes':[{'name':_0x78b9('0xb'),'fields':[_0x78b9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38df=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x38f7b1,_0x3d6c11){var _0x25a9fd=function(_0x2bb939){while(--_0x2bb939){_0x38f7b1['push'](_0x38f7b1['shift']());}};_0x25a9fd(++_0x3d6c11);}(_0x38df,0x144));var _0xf38d=function(_0x394c2e,_0x436edd){_0x394c2e=_0x394c2e-0x0;var _0x2907aa=_0x38df[_0x394c2e];return _0x2907aa;};'use strict';var _=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var logger=require(_0xf38d('0x2'))(_0xf38d('0x3'));var moment=require(_0xf38d('0x4'));var BPromise=require(_0xf38d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf38d('0x6'));var config=require(_0xf38d('0x7'));var attributes=require(_0xf38d('0x8'));module['exports']=function(_0x42c0bc,_0x3b7646){return _0x42c0bc[_0xf38d('0x9')](_0xf38d('0xa'),attributes,{'tableName':_0xf38d('0xb'),'paranoid':![],'indexes':[{'name':_0xf38d('0xc'),'fields':[_0xf38d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fa5c048..f905f92 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 _0x692c=['../../config/environment','jayson/promise','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x283070,_0x8542df){var _0x3584d2=function(_0x102637){while(--_0x102637){_0x283070['push'](_0x283070['shift']());}};_0x3584d2(++_0x8542df);}(_0x692c,0x6a));var _0xc692=function(_0x3de416,_0x3abc77){_0x3de416=_0x3de416-0x0;var _0x17c7ae=_0x692c[_0x3de416];return _0x17c7ae;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var moment=require(_0xc692('0x2'));var BPromise=require(_0xc692('0x3'));var rs=require(_0xc692('0x4'));var fs=require('fs');var Redis=require(_0xc692('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc692('0x6'));var logger=require(_0xc692('0x7'))(_0xc692('0x8'));var config=require(_0xc692('0x9'));var jayson=require(_0xc692('0xa'));var client=jayson[_0xc692('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1229,_0x3a0bb4,_0x170b93){return new BPromise(function(_0x25e291,_0x38d716){return client[_0xc692('0xc')](_0x4c1229,_0x170b93)[_0xc692('0xd')](function(_0x2ad982){logger['info'](_0xc692('0xe'),_0x3a0bb4,_0xc692('0xf'));logger[_0xc692('0x10')](_0xc692('0x11'),_0x3a0bb4,_0xc692('0xf'),JSON['stringify'](_0x2ad982));if(_0x2ad982[_0xc692('0x12')]){if(_0x2ad982[_0xc692('0x12')][_0xc692('0x13')]===0x1f4){logger['error'](_0xc692('0xe'),_0x3a0bb4,_0x2ad982['error'][_0xc692('0x14')]);return _0x38d716(_0x2ad982[_0xc692('0x12')]['message']);}logger[_0xc692('0x12')](_0xc692('0xe'),_0x3a0bb4,_0x2ad982[_0xc692('0x12')][_0xc692('0x14')]);return _0x25e291(_0x2ad982[_0xc692('0x12')][_0xc692('0x14')]);}else{logger[_0xc692('0x15')](_0xc692('0xe'),_0x3a0bb4,_0xc692('0xf'));_0x25e291(_0x2ad982['result'][_0xc692('0x14')]);}})[_0xc692('0x16')](function(_0x523919){logger[_0xc692('0x12')](_0xc692('0xe'),_0x3a0bb4,_0x523919);_0x38d716(_0x523919);});});} \ No newline at end of file +var _0xe0c3=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f3910,_0x121b63){var _0x939fb2=function(_0x163382){while(--_0x163382){_0x1f3910['push'](_0x1f3910['shift']());}};_0x939fb2(++_0x121b63);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var moment=require(_0x3e0c('0x1'));var BPromise=require(_0x3e0c('0x2'));var rs=require(_0x3e0c('0x3'));var fs=require('fs');var Redis=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];var utils=require(_0x3e0c('0x6'));var logger=require(_0x3e0c('0x7'))(_0x3e0c('0x8'));var config=require(_0x3e0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e339a,_0x3f6607,_0x243b5b){return new BPromise(function(_0x29673d,_0x2d2c39){return client[_0x3e0c('0xb')](_0x1e339a,_0x243b5b)[_0x3e0c('0xc')](function(_0x13ac88){logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,'request\x20sent');logger['debug'](_0x3e0c('0xf'),_0x3f6607,_0x3e0c('0x10'),JSON[_0x3e0c('0x11')](_0x13ac88));if(_0x13ac88[_0x3e0c('0x12')]){if(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x13')]===0x1f4){logger[_0x3e0c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x3f6607,_0x13ac88[_0x3e0c('0x12')]['message']);return _0x2d2c39(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}logger['error'](_0x3e0c('0xe'),_0x3f6607,_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);return _0x29673d(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}else{logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,_0x3e0c('0x10'));_0x29673d(_0x13ac88[_0x3e0c('0x15')][_0x3e0c('0x14')]);}})[_0x3e0c('0x16')](function(_0x1f8e71){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x3f6607,_0x1f8e71);_0x2d2c39(_0x1f8e71);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c1caf6e..c962d95 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 _0xbe70=['put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','post','single','create'];(function(_0x2ccf75,_0x38ea08){var _0x144af2=function(_0xb1b36e){while(--_0xb1b36e){_0x2ccf75['push'](_0x2ccf75['shift']());}};_0x144af2(++_0x38ea08);}(_0xbe70,0xd3));var _0x0be7=function(_0x45d948,_0x1f7d49){_0x45d948=_0x45d948-0x0;var _0x57bf83=_0xbe70[_0x45d948];return _0x57bf83;};'use strict';var multer=require('multer');var util=require(_0x0be7('0x0'));var path=require(_0x0be7('0x1'));var timeout=require(_0x0be7('0x2'));var express=require('express');var router=express[_0x0be7('0x3')]();var fs_extra=require(_0x0be7('0x4'));var auth=require(_0x0be7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0be7('0x6'));var controller=require('./sound.controller');router[_0x0be7('0x7')]('/',auth[_0x0be7('0x8')](),controller['index']);router[_0x0be7('0x7')](_0x0be7('0x9'),auth['isAuthenticated'](),controller[_0x0be7('0xa')]);router[_0x0be7('0x7')](_0x0be7('0xb'),auth['isAuthenticated'](),controller[_0x0be7('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x88434a,_0xc82c63,_0x1ae3d5){_0x1ae3d5(null,path['join'](config['root'],_0x0be7('0xd')));},'filename':function(_0x2ab138,_0x4a2719,_0x225953){_0x4a2719['originalname']=_0x4a2719['originalname'][_0x0be7('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x225953(null,util[_0x0be7('0xf')](_0x0be7('0x10'),path[_0x0be7('0x11')](_0x4a2719[_0x0be7('0x12')],path[_0x0be7('0x13')](_0x4a2719[_0x0be7('0x12')])),Date['now'](),path[_0x0be7('0x13')](_0x4a2719['originalname'])));}})});router[_0x0be7('0x14')]('/',upload[_0x0be7('0x15')]('file'),controller[_0x0be7('0x16')]);router[_0x0be7('0x17')]('/:id',auth[_0x0be7('0x8')](),controller[_0x0be7('0x18')]);router[_0x0be7('0x19')](_0x0be7('0x9'),auth[_0x0be7('0x8')](),controller[_0x0be7('0x19')]);module['exports']=router; \ No newline at end of file +var _0xcee8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id/download','download','join','root','originalname','replace','basename','extname','now','post','single','file','create','put','/:id','update','exports','multer','util','path'];(function(_0x3c0e44,_0x475443){var _0xda3ca1=function(_0xbaba0d){while(--_0xbaba0d){_0x3c0e44['push'](_0x3c0e44['shift']());}};_0xda3ca1(++_0x475443);}(_0xcee8,0xb1));var _0x8cee=function(_0x2e41ed,_0x10c21f){_0x2e41ed=_0x2e41ed-0x0;var _0x3e1d80=_0xcee8[_0x2e41ed];return _0x3e1d80;};'use strict';var multer=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var path=require(_0x8cee('0x2'));var timeout=require(_0x8cee('0x3'));var express=require(_0x8cee('0x4'));var router=express[_0x8cee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8cee('0x6'));var interaction=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var controller=require(_0x8cee('0x9'));router['get']('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xb')]);router['get']('/:id',auth[_0x8cee('0xa')](),controller['show']);router[_0x8cee('0xc')](_0x8cee('0xd'),auth[_0x8cee('0xa')](),controller[_0x8cee('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17d67a,_0x3b9198,_0x4c09d7){_0x4c09d7(null,path[_0x8cee('0xf')](config[_0x8cee('0x10')],'server/files/sounds/original/'));},'filename':function(_0x87452,_0x59a77e,_0x28df81){_0x59a77e[_0x8cee('0x11')]=_0x59a77e[_0x8cee('0x11')][_0x8cee('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x28df81(null,util['format']('%s-%s%s',path[_0x8cee('0x13')](_0x59a77e[_0x8cee('0x11')],path[_0x8cee('0x14')](_0x59a77e[_0x8cee('0x11')])),Date[_0x8cee('0x15')](),path[_0x8cee('0x14')](_0x59a77e[_0x8cee('0x11')])));}})});router[_0x8cee('0x16')]('/',upload[_0x8cee('0x17')](_0x8cee('0x18')),controller[_0x8cee('0x19')]);router[_0x8cee('0x1a')](_0x8cee('0x1b'),auth[_0x8cee('0xa')](),controller[_0x8cee('0x1c')]);router['delete'](_0x8cee('0x1b'),auth['isAuthenticated'](),controller['delete']);module[_0x8cee('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b378eb2..086b672 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 _0x66a1=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x5e3efd,_0x42e5d8){var _0x30ef89=function(_0x225999){while(--_0x225999){_0x5e3efd['push'](_0x5e3efd['shift']());}};_0x30ef89(++_0x42e5d8);}(_0x66a1,0x9b));var _0x166a=function(_0x483f0f,_0x129cca){_0x483f0f=_0x483f0f-0x0;var _0x127824=_0x66a1[_0x483f0f];return _0x127824;};'use strict';var Sequelize=require(_0x166a('0x0'));module[_0x166a('0x1')]={'name':{'type':Sequelize[_0x166a('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x166a('0x2')]},'original_duration':{'type':Sequelize[_0x166a('0x3')]},'original_sampleCount':{'type':Sequelize[_0x166a('0x4')]},'original_channelCount':{'type':Sequelize[_0x166a('0x5')]},'original_bitRate':{'type':Sequelize[_0x166a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x166a('0x5')]},'converted_format':{'type':Sequelize[_0x166a('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x166a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x166a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x166a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x166a('0x5')]}}; \ No newline at end of file +var _0xe872=['name','FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0xa7c1a8,_0x534094){var _0x53a712=function(_0x443957){while(--_0x443957){_0xa7c1a8['push'](_0xa7c1a8['shift']());}};_0x53a712(++_0x534094);}(_0xe872,0xd6));var _0x2e87=function(_0x157988,_0x4fb6a3){_0x157988=_0x157988-0x0;var _0x33a78a=_0xe872[_0x157988];return _0x33a78a;};'use strict';var Sequelize=require(_0x2e87('0x0'));module[_0x2e87('0x1')]={'name':{'type':Sequelize[_0x2e87('0x2')],'unique':_0x2e87('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2e87('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2e87('0x2')]},'original_format':{'type':Sequelize[_0x2e87('0x2')]},'original_duration':{'type':Sequelize[_0x2e87('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2e87('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2e87('0x5')]},'converted_format':{'type':Sequelize[_0x2e87('0x2')]},'converted_duration':{'type':Sequelize[_0x2e87('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2e87('0x6')]},'converted_channelCount':{'type':Sequelize[_0x2e87('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x2e87('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9289cf9..5ad4339 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 _0x6db2=['../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','download','params','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','format','%s.%s','catch','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','end','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','delete','original_format','eml-format','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4d3052,_0x7e31a2){var _0x2b2004=function(_0x4a1efd){while(--_0x4a1efd){_0x4d3052['push'](_0x4d3052['shift']());}};_0x2b2004(++_0x7e31a2);}(_0x6db2,0x172));var _0x26db=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x6db2[_0x4207a6];return _0x42b37a;};'use strict';var emlformat=require(_0x26db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x26db('0x1'));var rp=require('request-promise');var moment=require(_0x26db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x26db('0x3'));var util=require(_0x26db('0x4'));var path=require(_0x26db('0x5'));var sox=require(_0x26db('0x6'));var csv=require('to-csv');var ejs=require(_0x26db('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26db('0x8'));var squel=require(_0x26db('0x9'));var crypto=require(_0x26db('0xa'));var jsforce=require(_0x26db('0xb'));var deskjs=require(_0x26db('0xc'));var toCsv=require(_0x26db('0xd'));var querystring=require('querystring');var Papa=require(_0x26db('0xe'));var Redis=require(_0x26db('0xf'));var authService=require(_0x26db('0x10'));var qs=require(_0x26db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26db('0x12'));var logger=require(_0x26db('0x13'))(_0x26db('0x14'));var utils=require(_0x26db('0x15'));var config=require(_0x26db('0x16'));var licenseUtil=require(_0x26db('0x17'));var db=require(_0x26db('0x18'))['db'];function respondWithStatusCode(_0x18d390,_0x349bcb){_0x349bcb=_0x349bcb||0xcc;return function(_0x393aba){if(_0x393aba){return _0x18d390['sendStatus'](_0x349bcb);}return _0x18d390[_0x26db('0x19')](_0x349bcb)['end']();};}function respondWithResult(_0x4d5588,_0x48b1f0){_0x48b1f0=_0x48b1f0||0xc8;return function(_0x2d2832){if(_0x2d2832){return _0x4d5588[_0x26db('0x19')](_0x48b1f0)[_0x26db('0x1a')](_0x2d2832);}};}function respondWithFilteredResult(_0x429d72,_0x30f703){return function(_0x4ac645){if(_0x4ac645){var _0x2bc155=typeof _0x30f703[_0x26db('0x1b')]==='undefined'&&typeof _0x30f703['limit']===_0x26db('0x1c');var _0x471d64=_0x4ac645[_0x26db('0x1d')];var _0x26de38=_0x2bc155?0x0:_0x30f703['offset'];var _0x5a453d=_0x2bc155?_0x4ac645['count']:_0x30f703[_0x26db('0x1b')]+_0x30f703[_0x26db('0x1e')];var _0x15366b;if(_0x5a453d>=_0x471d64){_0x5a453d=_0x471d64;_0x15366b=0xc8;}else{_0x15366b=0xce;}_0x429d72['status'](_0x15366b);return _0x429d72[_0x26db('0x1f')]('Content-Range',_0x26de38+'-'+_0x5a453d+'/'+_0x471d64)[_0x26db('0x1a')](_0x4ac645);}return null;};}function patchUpdates(_0x3b817a){return function(_0x2333d7){try{jsonpatch[_0x26db('0x20')](_0x2333d7,_0x3b817a,!![]);}catch(_0x47ab47){return BPromise[_0x26db('0x21')](_0x47ab47);}return _0x2333d7[_0x26db('0x22')]();};}function saveUpdates(_0x115840,_0x321a4b){return function(_0xd88fb6){if(_0xd88fb6){return _0xd88fb6['update'](_0x115840)['then'](function(_0x363046){return _0x363046;});}return null;};}function removeEntity(_0x124546,_0x55ea41){return function(_0x3930ee){if(_0x3930ee){return _0x3930ee[_0x26db('0x23')]()[_0x26db('0x24')](function(){var _0x3d10d1=_0x3930ee[_0x26db('0x25')]({'plain':!![]});var _0xe88a0=_0x26db('0x26');return db[_0x26db('0x27')][_0x26db('0x23')]({'where':{'type':_0xe88a0,'resourceId':_0x3d10d1['id']}})[_0x26db('0x24')](function(){return _0x3930ee;});})[_0x26db('0x24')](function(){_0x124546['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x257936,_0xf98ea1){return function(_0x59abbe){if(!_0x59abbe){_0x257936[_0x26db('0x28')](0x194);}return _0x59abbe;};}function handleError(_0xd62a7d,_0x4bb12b){_0x4bb12b=_0x4bb12b||0x1f4;return function(_0x4763bb){logger[_0x26db('0x29')](_0x4763bb[_0x26db('0x2a')]);if(_0x4763bb[_0x26db('0x2b')]){delete _0x4763bb[_0x26db('0x2b')];}_0xd62a7d[_0x26db('0x19')](_0x4bb12b)[_0x26db('0x2c')](_0x4763bb);};}exports[_0x26db('0x2d')]=function(_0x5478e7,_0x52130e){var _0xc28404={},_0x1e8a4c={},_0x165e2e={'count':0x0,'rows':[]};var _0x2ca20a=_[_0x26db('0x2e')](db[_0x26db('0x2f')][_0x26db('0x30')],function(_0x32ed54){return{'name':_0x32ed54[_0x26db('0x31')],'type':_0x32ed54['type'][_0x26db('0x32')]};});_0x1e8a4c['model']=_[_0x26db('0x2e')](_0x2ca20a,_0x26db('0x2b'));_0x1e8a4c[_0x26db('0x33')]=_[_0x26db('0x34')](_0x5478e7[_0x26db('0x33')]);_0x1e8a4c[_0x26db('0x35')]=_['intersection'](_0x1e8a4c[_0x26db('0x36')],_0x1e8a4c[_0x26db('0x33')]);_0xc28404[_0x26db('0x37')]=_[_0x26db('0x38')](_0x1e8a4c[_0x26db('0x36')],qs['fields'](_0x5478e7['query'][_0x26db('0x39')]));_0xc28404[_0x26db('0x37')]=_0xc28404[_0x26db('0x37')][_0x26db('0x3a')]?_0xc28404[_0x26db('0x37')]:_0x1e8a4c[_0x26db('0x36')];if(!_0x5478e7[_0x26db('0x33')][_0x26db('0x3b')](_0x26db('0x3c'))){_0xc28404['limit']=qs['limit'](_0x5478e7['query']['limit']);_0xc28404[_0x26db('0x1b')]=qs[_0x26db('0x1b')](_0x5478e7['query'][_0x26db('0x1b')]);}_0xc28404[_0x26db('0x3d')]=qs[_0x26db('0x3e')](_0x5478e7['query'][_0x26db('0x3e')]);_0xc28404[_0x26db('0x3f')]=qs[_0x26db('0x35')](_['pick'](_0x5478e7[_0x26db('0x33')],_0x1e8a4c['filters']),_0x2ca20a);if(_0x5478e7[_0x26db('0x33')][_0x26db('0x40')]){_0xc28404[_0x26db('0x3f')]=_[_0x26db('0x41')](_0xc28404[_0x26db('0x3f')],{'$or':_[_0x26db('0x2e')](_0x2ca20a,function(_0x59b28d){if(_0x59b28d[_0x26db('0x42')]!==_0x26db('0x43')){var _0x424809={};_0x424809[_0x59b28d[_0x26db('0x2b')]]={'$like':'%'+_0x5478e7['query'][_0x26db('0x40')]+'%'};return _0x424809;}})});}_0xc28404=_[_0x26db('0x41')]({},_0xc28404,_0x5478e7[_0x26db('0x44')]);var _0xed030b={'where':_0xc28404[_0x26db('0x3f')]};return db[_0x26db('0x2f')]['count'](_0xed030b)[_0x26db('0x24')](function(_0x1238d9){_0x165e2e[_0x26db('0x1d')]=_0x1238d9;if(_0x5478e7[_0x26db('0x33')][_0x26db('0x45')]){_0xc28404[_0x26db('0x46')]=[{'all':!![]}];}return db[_0x26db('0x2f')][_0x26db('0x47')](_0xc28404);})[_0x26db('0x24')](function(_0x43b5e4){_0x165e2e[_0x26db('0x48')]=_0x43b5e4;return _0x165e2e;})[_0x26db('0x24')](respondWithFilteredResult(_0x52130e,_0xc28404))['catch'](handleError(_0x52130e,null));};exports[_0x26db('0x49')]=function(_0x1435c5,_0x1e0ddd){var _0x4eab9a={'raw':!![],'where':{'id':_0x1435c5['params']['id']}},_0x26b275={};_0x26b275[_0x26db('0x36')]=_[_0x26db('0x34')](db[_0x26db('0x2f')][_0x26db('0x30')]);_0x26b275[_0x26db('0x33')]=_['keys'](_0x1435c5[_0x26db('0x33')]);_0x26b275['filters']=_[_0x26db('0x38')](_0x26b275[_0x26db('0x36')],_0x26b275[_0x26db('0x33')]);_0x4eab9a[_0x26db('0x37')]=_[_0x26db('0x38')](_0x26b275[_0x26db('0x36')],qs[_0x26db('0x39')](_0x1435c5[_0x26db('0x33')]['fields']));_0x4eab9a['attributes']=_0x4eab9a['attributes']['length']?_0x4eab9a[_0x26db('0x37')]:_0x26b275[_0x26db('0x36')];if(_0x1435c5[_0x26db('0x33')][_0x26db('0x45')]){_0x4eab9a[_0x26db('0x46')]=[{'all':!![]}];}_0x4eab9a=_[_0x26db('0x41')]({},_0x4eab9a,_0x1435c5[_0x26db('0x44')]);return db[_0x26db('0x2f')][_0x26db('0x4a')](_0x4eab9a)[_0x26db('0x24')](handleEntityNotFound(_0x1e0ddd,null))['then'](respondWithResult(_0x1e0ddd,null))['catch'](handleError(_0x1e0ddd,null));};exports[_0x26db('0x4b')]=function(_0xc33702,_0x5e0a55,_0x494509){return db[_0x26db('0x2f')][_0x26db('0x4a')]({'where':{'id':_0xc33702[_0x26db('0x4c')]['id']},'attributes':['name',_0x26db('0x4d'),'converted_format'],'raw':!![]})[_0x26db('0x24')](handleEntityNotFound(_0x5e0a55,null))['then'](function(_0x1d916a){if(_0x1d916a){if(!fs[_0x26db('0x4e')](path[_0x26db('0x4f')](config[_0x26db('0x50')],_0x26db('0x51'),_0x1d916a[_0x26db('0x4d')]+'.'+_0x1d916a[_0x26db('0x52')]))){throw new db['Sequelize'][(_0x26db('0x53'))](_0x26db('0x54'));}return _0x5e0a55[_0x26db('0x4b')](path[_0x26db('0x4f')](config['root'],_0x26db('0x51'),util[_0x26db('0x55')](_0x26db('0x56'),_0x1d916a['save_name'],_0x1d916a[_0x26db('0x52')])),util[_0x26db('0x55')](_0x26db('0x56'),_0x1d916a['name'],_0x1d916a['converted_format']));}return null;})[_0x26db('0x57')](handleError(_0x5e0a55,null));};exports[_0x26db('0x58')]=function(_0x3a92a7,_0x115410,_0x1a86f2){var _0x2b01ac={'name':path[_0x26db('0x59')](_0x3a92a7['file'][_0x26db('0x5a')],path[_0x26db('0x5b')](_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5a')])),'save_name':path[_0x26db('0x59')](_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5d')],path[_0x26db('0x5b')](_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5d')])),'original_format':path[_0x26db('0x5b')](_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5a')])[_0x26db('0x5e')](0x1),'converted_format':_0x26db('0x5f')};var _0x37c727=path[_0x26db('0x4f')](config[_0x26db('0x50')],_0x26db('0x60'),_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5d')]);var _0x5805c7=path['join'](config[_0x26db('0x50')],'server/files/sounds/converted',util[_0x26db('0x55')](_0x26db('0x56'),path[_0x26db('0x59')](_0x3a92a7[_0x26db('0x5c')]['filename'],path[_0x26db('0x5b')](_0x3a92a7[_0x26db('0x5c')][_0x26db('0x5d')])),_0x2b01ac[_0x26db('0x52')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x37c727);logger[_0x26db('0x61')](_0x26db('0x62'),_0x5805c7);try{fs[_0x26db('0x63')](_0x37c727,parseInt(_0x26db('0x64'),0x8));var _0x92d65e=sox[_0x26db('0x65')](_0x37c727,_0x5805c7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x92d65e['on'](_0x26db('0x29'),function(_0x1071da){fs[_0x26db('0x66')](_0x37c727);_0x115410['status'](0x1f4)[_0x26db('0x2c')](_0x1071da);});_0x92d65e['on']('src',function(_0x1e5900){_0x2b01ac[_0x26db('0x67')]=isNaN(_0x1e5900[_0x26db('0x68')])?null:_0x1e5900[_0x26db('0x68')]*0x3e8;_0x2b01ac[_0x26db('0x69')]=isNaN(_0x1e5900['sampleCount'])?null:_0x1e5900[_0x26db('0x6a')];_0x2b01ac[_0x26db('0x6b')]=isNaN(_0x1e5900[_0x26db('0x6c')])?null:_0x1e5900['channelCount'];_0x2b01ac[_0x26db('0x6d')]=isNaN(_0x1e5900[_0x26db('0x6e')])?null:_0x1e5900[_0x26db('0x6e')];_0x2b01ac[_0x26db('0x6f')]=isNaN(_0x1e5900[_0x26db('0x70')])?null:_0x1e5900[_0x26db('0x70')];});_0x92d65e['on'](_0x26db('0x71'),function(_0x599563){_0x2b01ac[_0x26db('0x72')]=isNaN(_0x599563[_0x26db('0x68')])?null:_0x599563[_0x26db('0x68')]*0x3e8;_0x2b01ac[_0x26db('0x73')]=isNaN(_0x599563['sampleCount'])?null:_0x599563[_0x26db('0x6a')];_0x2b01ac[_0x26db('0x74')]=isNaN(_0x599563[_0x26db('0x6c')])?null:_0x599563['channelCount'];_0x2b01ac[_0x26db('0x75')]=isNaN(_0x599563['bitRate'])?null:_0x599563['bitRate'];_0x2b01ac['converted_sampleRate']=isNaN(_0x599563[_0x26db('0x70')])?null:_0x599563[_0x26db('0x70')];});_0x92d65e['on'](_0x26db('0x76'),function(){fs['chmodSync'](_0x5805c7,parseInt(_0x26db('0x64'),0x8));return db[_0x26db('0x2f')]['create'](_0x2b01ac)[_0x26db('0x24')](function(_0x7b208){var _0x2f40f2={'role':_0x3a92a7[_0x26db('0x77')]['role'],'userProfileId':_0x3a92a7[_0x26db('0x77')][_0x26db('0x78')]};if(!_0x2f40f2)throw new Error(_0x26db('0x79'));if(_0x2f40f2[_0x26db('0x7a')]===_0x26db('0x7b')){var _0x1c6616=_0x7b208[_0x26db('0x25')]({'plain':!![]});return db[_0x26db('0x7c')][_0x26db('0x4a')]({'where':{'name':_0x26db('0x26'),'userProfileId':_0x2f40f2[_0x26db('0x78')]},'raw':!![]})[_0x26db('0x24')](function(_0x2fd27c){if(_0x2fd27c&&_0x2fd27c['autoAssociation']===0x0){return db[_0x26db('0x27')]['create']({'name':_0x1c6616[_0x26db('0x2b')],'resourceId':_0x1c6616['id'],'type':_0x2fd27c[_0x26db('0x2b')],'sectionId':_0x2fd27c['id']},{})[_0x26db('0x24')](function(){return _0x7b208;});}else{return _0x7b208;}})[_0x26db('0x57')](function(_0x5e0f0b){logger[_0x26db('0x29')](_0x26db('0x7d'),_0x5e0f0b);throw _0x5e0f0b;});}return _0x7b208;})['then'](respondWithResult(_0x115410,null))[_0x26db('0x57')](handleError(_0x115410,null));});_0x92d65e['start']();}catch(_0x23d453){_0x115410['status'](0x1f4)[_0x26db('0x2c')](_0x23d453);}};exports[_0x26db('0x7e')]=function(_0x1b7888,_0x1f3c57,_0x52de89){return db[_0x26db('0x2f')][_0x26db('0x4a')]({'where':{'id':_0x1b7888[_0x26db('0x4c')]['id']}})[_0x26db('0x24')](handleEntityNotFound(_0x1f3c57,null))['then'](saveUpdates(_[_0x26db('0x7f')](_0x1b7888[_0x26db('0x77')],[_0x26db('0x2b'),_0x26db('0x80')]),null))[_0x26db('0x24')](respondWithResult(_0x1f3c57,null))[_0x26db('0x57')](handleError(_0x1f3c57,null));};exports[_0x26db('0x81')]=function(_0x3cf70f,_0x558285,_0x1fe0c7){return db[_0x26db('0x2f')][_0x26db('0x4a')]({'where':{'id':_0x3cf70f['params']['id']}})[_0x26db('0x24')](function(_0x2a6985){if(_0x2a6985){return _0x2a6985[_0x26db('0x23')]();}})[_0x26db('0x24')](function(_0x4efe1f){var _0x1a21ba=path[_0x26db('0x4f')](config[_0x26db('0x50')],_0x26db('0x60'),util[_0x26db('0x55')](_0x26db('0x56'),_0x4efe1f[_0x26db('0x4d')],_0x4efe1f[_0x26db('0x82')]));var _0x444530=path[_0x26db('0x4f')](config[_0x26db('0x50')],'server/files/sounds/converted',util[_0x26db('0x55')]('%s.%s',_0x4efe1f[_0x26db('0x4d')],_0x4efe1f[_0x26db('0x52')]));fs[_0x26db('0x66')](_0x1a21ba);fs[_0x26db('0x66')](_0x444530);return _0x4efe1f;})['then'](function(_0x557728){if(_0x557728){return _0x558285[_0x26db('0x19')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x558285,null))[_0x26db('0x57')](handleError(_0x558285,null));}; \ No newline at end of file +var _0xe40e=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','update','then','get','Sounds','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Sound','include','catch','show','includeAll','find','download','params','converted_format','existsSync','root','save_name','Sequelize','Sound\x20not\x20found','format','%s.%s','file','filename','extname','originalname','substring','join','server/files/sounds/converted','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','server/files/sounds/original','original_format','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xe40e,0xef));var _0xee40=function(_0x36e9c6,_0x2907e7){_0x36e9c6=_0x36e9c6-0x0;var _0x14b4a7=_0xe40e[_0x36e9c6];return _0x14b4a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee40('0x0'));var jsonpatch=require(_0xee40('0x1'));var rp=require(_0xee40('0x2'));var moment=require(_0xee40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee40('0x4'));var util=require(_0xee40('0x5'));var path=require('path');var sox=require(_0xee40('0x6'));var csv=require(_0xee40('0x7'));var ejs=require(_0xee40('0x8'));var fs=require('fs');var fs_extra=require(_0xee40('0x9'));var _=require('lodash');var squel=require(_0xee40('0xa'));var crypto=require('crypto');var jsforce=require(_0xee40('0xb'));var deskjs=require(_0xee40('0xc'));var toCsv=require(_0xee40('0x7'));var querystring=require('querystring');var Papa=require(_0xee40('0xd'));var Redis=require(_0xee40('0xe'));var authService=require(_0xee40('0xf'));var qs=require(_0xee40('0x10'));var as=require(_0xee40('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee40('0x12'))('api');var utils=require(_0xee40('0x13'));var config=require(_0xee40('0x14'));var licenseUtil=require(_0xee40('0x15'));var db=require(_0xee40('0x16'))['db'];function respondWithStatusCode(_0x4f3887,_0x23395b){_0x23395b=_0x23395b||0xcc;return function(_0x190aa2){if(_0x190aa2){return _0x4f3887[_0xee40('0x17')](_0x23395b);}return _0x4f3887[_0xee40('0x18')](_0x23395b)[_0xee40('0x19')]();};}function respondWithResult(_0x291604,_0x5b66f1){_0x5b66f1=_0x5b66f1||0xc8;return function(_0x4d84f3){if(_0x4d84f3){return _0x291604['status'](_0x5b66f1)['json'](_0x4d84f3);}};}function respondWithFilteredResult(_0x2a1b42,_0xb70861){return function(_0x2773bb){if(_0x2773bb){var _0x5f9f8d=typeof _0xb70861['offset']===_0xee40('0x1a')&&typeof _0xb70861['limit']==='undefined';var _0xc47cc8=_0x2773bb['count'];var _0x3dfcd1=_0x5f9f8d?0x0:_0xb70861[_0xee40('0x1b')];var _0x2069c6=_0x5f9f8d?_0x2773bb[_0xee40('0x1c')]:_0xb70861[_0xee40('0x1b')]+_0xb70861[_0xee40('0x1d')];var _0x296e25;if(_0x2069c6>=_0xc47cc8){_0x2069c6=_0xc47cc8;_0x296e25=0xc8;}else{_0x296e25=0xce;}_0x2a1b42[_0xee40('0x18')](_0x296e25);return _0x2a1b42[_0xee40('0x1e')](_0xee40('0x1f'),_0x3dfcd1+'-'+_0x2069c6+'/'+_0xc47cc8)[_0xee40('0x20')](_0x2773bb);}return null;};}function patchUpdates(_0xbadb4e){return function(_0x3239e0){try{jsonpatch['apply'](_0x3239e0,_0xbadb4e,!![]);}catch(_0x563f7f){return BPromise['reject'](_0x563f7f);}return _0x3239e0['save']();};}function saveUpdates(_0x11df5d,_0x1c344a){return function(_0x34caee){if(_0x34caee){return _0x34caee[_0xee40('0x21')](_0x11df5d)[_0xee40('0x22')](function(_0x4a104c){return _0x4a104c;});}return null;};}function removeEntity(_0x4d08d5,_0x56517a){return function(_0x219d64){if(_0x219d64){return _0x219d64['destroy']()['then'](function(){var _0x47d72e=_0x219d64[_0xee40('0x23')]({'plain':!![]});var _0x550e2d=_0xee40('0x24');return db['UserProfileResource'][_0xee40('0x25')]({'where':{'type':_0x550e2d,'resourceId':_0x47d72e['id']}})[_0xee40('0x22')](function(){return _0x219d64;});})[_0xee40('0x22')](function(){_0x4d08d5[_0xee40('0x18')](0xcc)[_0xee40('0x19')]();});}};}function handleEntityNotFound(_0x31c518,_0xbae15e){return function(_0x1a8bae){if(!_0x1a8bae){_0x31c518['sendStatus'](0x194);}return _0x1a8bae;};}function handleError(_0x154252,_0x30ef5d){_0x30ef5d=_0x30ef5d||0x1f4;return function(_0x3e7606){logger[_0xee40('0x26')](_0x3e7606[_0xee40('0x27')]);if(_0x3e7606[_0xee40('0x28')]){delete _0x3e7606[_0xee40('0x28')];}_0x154252[_0xee40('0x18')](_0x30ef5d)[_0xee40('0x29')](_0x3e7606);};}exports[_0xee40('0x2a')]=function(_0x40663d,_0x752389){var _0x2117a3={},_0x3f0443={},_0xd84bad={'count':0x0,'rows':[]};var _0x4c6149=_[_0xee40('0x2b')](db['Sound'][_0xee40('0x2c')],function(_0x1b2818){return{'name':_0x1b2818[_0xee40('0x2d')],'type':_0x1b2818[_0xee40('0x2e')]['key']};});_0x3f0443[_0xee40('0x2f')]=_[_0xee40('0x2b')](_0x4c6149,'name');_0x3f0443['query']=_[_0xee40('0x30')](_0x40663d['query']);_0x3f0443[_0xee40('0x31')]=_[_0xee40('0x32')](_0x3f0443[_0xee40('0x2f')],_0x3f0443[_0xee40('0x33')]);_0x2117a3['attributes']=_[_0xee40('0x32')](_0x3f0443[_0xee40('0x2f')],qs[_0xee40('0x34')](_0x40663d[_0xee40('0x33')][_0xee40('0x34')]));_0x2117a3[_0xee40('0x35')]=_0x2117a3[_0xee40('0x35')][_0xee40('0x36')]?_0x2117a3[_0xee40('0x35')]:_0x3f0443['model'];if(!_0x40663d[_0xee40('0x33')][_0xee40('0x37')](_0xee40('0x38'))){_0x2117a3['limit']=qs[_0xee40('0x1d')](_0x40663d['query']['limit']);_0x2117a3[_0xee40('0x1b')]=qs[_0xee40('0x1b')](_0x40663d[_0xee40('0x33')][_0xee40('0x1b')]);}_0x2117a3[_0xee40('0x39')]=qs[_0xee40('0x3a')](_0x40663d[_0xee40('0x33')][_0xee40('0x3a')]);_0x2117a3[_0xee40('0x3b')]=qs[_0xee40('0x31')](_['pick'](_0x40663d[_0xee40('0x33')],_0x3f0443[_0xee40('0x31')]),_0x4c6149);if(_0x40663d[_0xee40('0x33')]['filter']){_0x2117a3[_0xee40('0x3b')]=_[_0xee40('0x3c')](_0x2117a3[_0xee40('0x3b')],{'$or':_['map'](_0x4c6149,function(_0x54a5c5){if(_0x54a5c5[_0xee40('0x2e')]!==_0xee40('0x3d')){var _0x28c880={};_0x28c880[_0x54a5c5['name']]={'$like':'%'+_0x40663d[_0xee40('0x33')][_0xee40('0x3e')]+'%'};return _0x28c880;}})});}_0x2117a3=_[_0xee40('0x3c')]({},_0x2117a3,_0x40663d[_0xee40('0x3f')]);var _0x1503a5={'where':_0x2117a3['where']};return db[_0xee40('0x40')][_0xee40('0x1c')](_0x1503a5)[_0xee40('0x22')](function(_0x31ff67){_0xd84bad[_0xee40('0x1c')]=_0x31ff67;if(_0x40663d[_0xee40('0x33')]['includeAll']){_0x2117a3[_0xee40('0x41')]=[{'all':!![]}];}return db[_0xee40('0x40')]['findAll'](_0x2117a3);})[_0xee40('0x22')](function(_0x16d539){_0xd84bad['rows']=_0x16d539;return _0xd84bad;})[_0xee40('0x22')](respondWithFilteredResult(_0x752389,_0x2117a3))[_0xee40('0x42')](handleError(_0x752389,null));};exports[_0xee40('0x43')]=function(_0x15de74,_0x36690b){var _0x1e2895={'raw':!![],'where':{'id':_0x15de74['params']['id']}},_0x50baf5={};_0x50baf5['model']=_[_0xee40('0x30')](db[_0xee40('0x40')][_0xee40('0x2c')]);_0x50baf5[_0xee40('0x33')]=_[_0xee40('0x30')](_0x15de74[_0xee40('0x33')]);_0x50baf5['filters']=_[_0xee40('0x32')](_0x50baf5[_0xee40('0x2f')],_0x50baf5['query']);_0x1e2895[_0xee40('0x35')]=_['intersection'](_0x50baf5[_0xee40('0x2f')],qs[_0xee40('0x34')](_0x15de74[_0xee40('0x33')][_0xee40('0x34')]));_0x1e2895[_0xee40('0x35')]=_0x1e2895[_0xee40('0x35')][_0xee40('0x36')]?_0x1e2895[_0xee40('0x35')]:_0x50baf5[_0xee40('0x2f')];if(_0x15de74[_0xee40('0x33')][_0xee40('0x44')]){_0x1e2895[_0xee40('0x41')]=[{'all':!![]}];}_0x1e2895=_[_0xee40('0x3c')]({},_0x1e2895,_0x15de74['options']);return db[_0xee40('0x40')][_0xee40('0x45')](_0x1e2895)[_0xee40('0x22')](handleEntityNotFound(_0x36690b,null))['then'](respondWithResult(_0x36690b,null))[_0xee40('0x42')](handleError(_0x36690b,null));};exports[_0xee40('0x46')]=function(_0x22f325,_0x17181e,_0x1bf395){return db['Sound']['find']({'where':{'id':_0x22f325[_0xee40('0x47')]['id']},'attributes':['name','save_name',_0xee40('0x48')],'raw':!![]})[_0xee40('0x22')](handleEntityNotFound(_0x17181e,null))[_0xee40('0x22')](function(_0x14d1be){if(_0x14d1be){if(!fs[_0xee40('0x49')](path['join'](config[_0xee40('0x4a')],'server/files/sounds/converted',_0x14d1be[_0xee40('0x4b')]+'.'+_0x14d1be['converted_format']))){throw new db[(_0xee40('0x4c'))]['ValidationError'](_0xee40('0x4d'));}return _0x17181e[_0xee40('0x46')](path['join'](config['root'],'server/files/sounds/converted',util[_0xee40('0x4e')]('%s.%s',_0x14d1be['save_name'],_0x14d1be[_0xee40('0x48')])),util[_0xee40('0x4e')](_0xee40('0x4f'),_0x14d1be[_0xee40('0x28')],_0x14d1be['converted_format']));}return null;})[_0xee40('0x42')](handleError(_0x17181e,null));};exports['create']=function(_0x330e8e,_0x330e89,_0x4d2ab9){var _0x237d63={'name':path['basename'](_0x330e8e[_0xee40('0x50')]['originalname'],path['extname'](_0x330e8e['file']['originalname'])),'save_name':path['basename'](_0x330e8e[_0xee40('0x50')]['filename'],path['extname'](_0x330e8e[_0xee40('0x50')][_0xee40('0x51')])),'original_format':path[_0xee40('0x52')](_0x330e8e['file'][_0xee40('0x53')])[_0xee40('0x54')](0x1),'converted_format':'wav'};var _0x1b666e=path[_0xee40('0x55')](config[_0xee40('0x4a')],'server/files/sounds/original',_0x330e8e[_0xee40('0x50')][_0xee40('0x51')]);var _0x1217f3=path[_0xee40('0x55')](config[_0xee40('0x4a')],_0xee40('0x56'),util['format']('%s.%s',path[_0xee40('0x57')](_0x330e8e[_0xee40('0x50')][_0xee40('0x51')],path['extname'](_0x330e8e[_0xee40('0x50')]['filename'])),_0x237d63['converted_format']));logger[_0xee40('0x58')](_0xee40('0x59'),_0x1b666e);logger['info'](_0xee40('0x5a'),_0x1217f3);try{fs[_0xee40('0x5b')](_0x1b666e,parseInt(_0xee40('0x5c'),0x8));var _0x590df6=sox['transcode'](_0x1b666e,_0x1217f3,{'sampleRate':0x1f40,'format':_0xee40('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x590df6['on']('error',function(_0x27b0ac){fs['unlinkSync'](_0x1b666e);_0x330e89[_0xee40('0x18')](0x1f4)[_0xee40('0x29')](_0x27b0ac);});_0x590df6['on'](_0xee40('0x5e'),function(_0x1e533d){_0x237d63[_0xee40('0x5f')]=isNaN(_0x1e533d[_0xee40('0x60')])?null:_0x1e533d['duration']*0x3e8;_0x237d63[_0xee40('0x61')]=isNaN(_0x1e533d[_0xee40('0x62')])?null:_0x1e533d[_0xee40('0x62')];_0x237d63[_0xee40('0x63')]=isNaN(_0x1e533d[_0xee40('0x64')])?null:_0x1e533d['channelCount'];_0x237d63[_0xee40('0x65')]=isNaN(_0x1e533d[_0xee40('0x66')])?null:_0x1e533d[_0xee40('0x66')];_0x237d63[_0xee40('0x67')]=isNaN(_0x1e533d[_0xee40('0x68')])?null:_0x1e533d[_0xee40('0x68')];});_0x590df6['on'](_0xee40('0x69'),function(_0x892141){_0x237d63[_0xee40('0x6a')]=isNaN(_0x892141['duration'])?null:_0x892141[_0xee40('0x60')]*0x3e8;_0x237d63[_0xee40('0x6b')]=isNaN(_0x892141[_0xee40('0x62')])?null:_0x892141['sampleCount'];_0x237d63[_0xee40('0x6c')]=isNaN(_0x892141[_0xee40('0x64')])?null:_0x892141[_0xee40('0x64')];_0x237d63[_0xee40('0x6d')]=isNaN(_0x892141[_0xee40('0x66')])?null:_0x892141[_0xee40('0x66')];_0x237d63[_0xee40('0x6e')]=isNaN(_0x892141['sampleRate'])?null:_0x892141[_0xee40('0x68')];});_0x590df6['on'](_0xee40('0x19'),function(){fs[_0xee40('0x5b')](_0x1217f3,parseInt(_0xee40('0x5c'),0x8));return db[_0xee40('0x40')]['create'](_0x237d63)[_0xee40('0x22')](function(_0x4e74c3){var _0x26c6fa={'role':_0x330e8e[_0xee40('0x6f')][_0xee40('0x70')],'userProfileId':_0x330e8e[_0xee40('0x6f')][_0xee40('0x71')]};if(!_0x26c6fa)throw new Error(_0xee40('0x72'));if(_0x26c6fa[_0xee40('0x70')]==='user'){var _0x5dfc11=_0x4e74c3['get']({'plain':!![]});return db['UserProfileSection'][_0xee40('0x45')]({'where':{'name':_0xee40('0x24'),'userProfileId':_0x26c6fa['userProfileId']},'raw':!![]})[_0xee40('0x22')](function(_0x1c8149){if(_0x1c8149&&_0x1c8149[_0xee40('0x73')]===0x0){return db[_0xee40('0x74')][_0xee40('0x75')]({'name':_0x5dfc11[_0xee40('0x28')],'resourceId':_0x5dfc11['id'],'type':_0x1c8149[_0xee40('0x28')],'sectionId':_0x1c8149['id']},{})[_0xee40('0x22')](function(){return _0x4e74c3;});}else{return _0x4e74c3;}})[_0xee40('0x42')](function(_0x3be8e3){logger[_0xee40('0x26')](_0xee40('0x76'),_0x3be8e3);throw _0x3be8e3;});}return _0x4e74c3;})[_0xee40('0x22')](respondWithResult(_0x330e89,null))[_0xee40('0x42')](handleError(_0x330e89,null));});_0x590df6[_0xee40('0x77')]();}catch(_0x2ff6f5){_0x330e89[_0xee40('0x18')](0x1f4)[_0xee40('0x29')](_0x2ff6f5);}};exports[_0xee40('0x21')]=function(_0x21a540,_0x475843,_0x51cc39){return db[_0xee40('0x40')]['find']({'where':{'id':_0x21a540[_0xee40('0x47')]['id']}})[_0xee40('0x22')](handleEntityNotFound(_0x475843,null))[_0xee40('0x22')](saveUpdates(_[_0xee40('0x78')](_0x21a540[_0xee40('0x6f')],[_0xee40('0x28'),_0xee40('0x79')]),null))['then'](respondWithResult(_0x475843,null))[_0xee40('0x42')](handleError(_0x475843,null));};exports['delete']=function(_0x343b7d,_0x11815b,_0x413466){return db['Sound'][_0xee40('0x45')]({'where':{'id':_0x343b7d[_0xee40('0x47')]['id']}})[_0xee40('0x22')](function(_0x20ce6c){if(_0x20ce6c){return _0x20ce6c[_0xee40('0x25')]();}})[_0xee40('0x22')](function(_0xc5dfa3){var _0x5795ce=path['join'](config['root'],_0xee40('0x7a'),util[_0xee40('0x4e')](_0xee40('0x4f'),_0xc5dfa3[_0xee40('0x4b')],_0xc5dfa3[_0xee40('0x7b')]));var _0x61762a=path['join'](config[_0xee40('0x4a')],_0xee40('0x56'),util[_0xee40('0x4e')](_0xee40('0x4f'),_0xc5dfa3[_0xee40('0x4b')],_0xc5dfa3[_0xee40('0x48')]));fs['unlinkSync'](_0x5795ce);fs[_0xee40('0x7c')](_0x61762a);return _0xc5dfa3;})['then'](function(_0x119d10){if(_0x119d10){return _0x11815b[_0xee40('0x18')](0xcc)[_0xee40('0x19')]();}})[_0xee40('0x22')](handleEntityNotFound(_0x11815b,null))[_0xee40('0x42')](handleError(_0x11815b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c456769..9ec71ea 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 _0x7f46=['../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','exports','define','Sound','lodash','util'];(function(_0x1ca61b,_0x115c5b){var _0xb533de=function(_0x2b32e6){while(--_0x2b32e6){_0x1ca61b['push'](_0x1ca61b['shift']());}};_0xb533de(++_0x115c5b);}(_0x7f46,0x8e));var _0x67f4=function(_0x5c7d4b,_0x305110){_0x5c7d4b=_0x5c7d4b-0x0;var _0x422e90=_0x7f46[_0x5c7d4b];return _0x422e90;};'use strict';var _=require(_0x67f4('0x0'));var util=require(_0x67f4('0x1'));var logger=require(_0x67f4('0x2'))(_0x67f4('0x3'));var moment=require(_0x67f4('0x4'));var BPromise=require(_0x67f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67f4('0x6'));var rimraf=require(_0x67f4('0x7'));var config=require('../../config/environment');var attributes=require(_0x67f4('0x8'));module[_0x67f4('0x9')]=function(_0x12e05f,_0xca995){return _0x12e05f[_0x67f4('0xa')](_0x67f4('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eda=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash'];(function(_0x12d950,_0x226770){var _0x4f1438=function(_0x2394ec){while(--_0x2394ec){_0x12d950['push'](_0x12d950['shift']());}};_0x4f1438(++_0x226770);}(_0x1eda,0x143));var _0xa1ed=function(_0x45f271,_0x2b6a85){_0x45f271=_0x45f271-0x0;var _0xbfab27=_0x1eda[_0x45f271];return _0xbfab27;};'use strict';var _=require(_0xa1ed('0x0'));var util=require(_0xa1ed('0x1'));var logger=require(_0xa1ed('0x2'))(_0xa1ed('0x3'));var moment=require(_0xa1ed('0x4'));var BPromise=require(_0xa1ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1ed('0x6'));var rimraf=require('rimraf');var config=require(_0xa1ed('0x7'));var attributes=require(_0xa1ed('0x8'));module[_0xa1ed('0x9')]=function(_0x4ec9a4,_0x242383){return _0x4ec9a4[_0xa1ed('0xa')]('Sound',attributes,{'tableName':_0xa1ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 24d96a9..e9f8c37 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 _0xff43=['find','options','raw','attributes','include','model','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound'];(function(_0x1ad886,_0x1cd92b){var _0xf4d862=function(_0x234425){while(--_0x234425){_0x1ad886['push'](_0x1ad886['shift']());}};_0xf4d862(++_0x1cd92b);}(_0xff43,0x9d));var _0x3ff4=function(_0x4354d4,_0x2063bc){_0x4354d4=_0x4354d4-0x0;var _0x17e862=_0xff43[_0x4354d4];return _0x17e862;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3ff4('0x0'));var rs=require(_0x3ff4('0x1'));var fs=require('fs');var Redis=require(_0x3ff4('0x2'));var db=require(_0x3ff4('0x3'))['db'];var utils=require(_0x3ff4('0x4'));var logger=require(_0x3ff4('0x5'))(_0x3ff4('0x6'));var config=require(_0x3ff4('0x7'));var jayson=require(_0x3ff4('0x8'));var client=jayson['client'][_0x3ff4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50b5fc,_0x966035,_0xe7bbbb){return new BPromise(function(_0x1d7791,_0x3134da){return client['request'](_0x50b5fc,_0xe7bbbb)[_0x3ff4('0xa')](function(_0x1be750){logger[_0x3ff4('0xb')]('Sound,\x20%s,\x20%s',_0x966035,_0x3ff4('0xc'));logger[_0x3ff4('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x966035,_0x3ff4('0xc'),JSON[_0x3ff4('0xe')](_0x1be750));if(_0x1be750[_0x3ff4('0xf')]){if(_0x1be750['error'][_0x3ff4('0x10')]===0x1f4){logger[_0x3ff4('0xf')](_0x3ff4('0x11'),_0x966035,_0x1be750['error'][_0x3ff4('0x12')]);return _0x3134da(_0x1be750[_0x3ff4('0xf')][_0x3ff4('0x12')]);}logger['error'](_0x3ff4('0x11'),_0x966035,_0x1be750[_0x3ff4('0xf')][_0x3ff4('0x12')]);return _0x1d7791(_0x1be750['error'][_0x3ff4('0x12')]);}else{logger['info'](_0x3ff4('0x11'),_0x966035,_0x3ff4('0xc'));_0x1d7791(_0x1be750[_0x3ff4('0x13')][_0x3ff4('0x12')]);}})[_0x3ff4('0x14')](function(_0x378dcf){logger[_0x3ff4('0xf')](_0x3ff4('0x11'),_0x966035,_0x378dcf);_0x3134da(_0x378dcf);});});}exports[_0x3ff4('0x15')]=function(_0x4e0cb6){var _0x1b81eb=this;return new Promise(function(_0x1ea538,_0x4164bd){return db[_0x3ff4('0x16')][_0x3ff4('0x17')]({'raw':_0x4e0cb6[_0x3ff4('0x18')]?_0x4e0cb6[_0x3ff4('0x18')][_0x3ff4('0x19')]===undefined?!![]:![]:!![],'where':_0x4e0cb6[_0x3ff4('0x18')]?_0x4e0cb6[_0x3ff4('0x18')]['where']||null:null,'attributes':_0x4e0cb6[_0x3ff4('0x18')]?_0x4e0cb6['options'][_0x3ff4('0x1a')]||null:null,'include':_0x4e0cb6[_0x3ff4('0x18')]?_0x4e0cb6[_0x3ff4('0x18')][_0x3ff4('0x1b')]?_['map'](_0x4e0cb6[_0x3ff4('0x18')][_0x3ff4('0x1b')],function(_0x21e8ce){return{'model':db[_0x21e8ce[_0x3ff4('0x1c')]],'as':_0x21e8ce['as'],'attributes':_0x21e8ce[_0x3ff4('0x1a')],'include':_0x21e8ce[_0x3ff4('0x1b')]?_[_0x3ff4('0x1d')](_0x21e8ce['include'],function(_0x2b063a){return{'model':db[_0x2b063a[_0x3ff4('0x1c')]],'as':_0x2b063a['as'],'attributes':_0x2b063a['attributes'],'include':_0x2b063a[_0x3ff4('0x1b')]?_['map'](_0x2b063a[_0x3ff4('0x1b')],function(_0x430158){return{'model':db[_0x430158[_0x3ff4('0x1c')]],'as':_0x430158['as'],'attributes':_0x430158[_0x3ff4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ee8ae){logger[_0x3ff4('0xb')](_0x3ff4('0x15'),_0x4e0cb6);logger[_0x3ff4('0xd')](_0x3ff4('0x15'),_0x4e0cb6,JSON[_0x3ff4('0xe')](_0x2ee8ae));_0x1ea538(_0x2ee8ae);})[_0x3ff4('0x14')](function(_0x22e24a){logger[_0x3ff4('0xf')](_0x3ff4('0x15'),_0x22e24a[_0x3ff4('0x12')],_0x4e0cb6);_0x4164bd(_0x1b81eb[_0x3ff4('0xf')](0x1f4,_0x22e24a['message']));});});}; \ No newline at end of file +var _0x9a93=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','Sound','find','options','attributes','include','map','model','catch'];(function(_0x3a85d2,_0x35f4d8){var _0x40820f=function(_0x179afb){while(--_0x179afb){_0x3a85d2['push'](_0x3a85d2['shift']());}};_0x40820f(++_0x35f4d8);}(_0x9a93,0xd9));var _0x39a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x39a9('0x0'));var util=require(_0x39a9('0x1'));var moment=require(_0x39a9('0x2'));var BPromise=require(_0x39a9('0x3'));var rs=require(_0x39a9('0x4'));var fs=require('fs');var Redis=require(_0x39a9('0x5'));var db=require(_0x39a9('0x6'))['db'];var utils=require(_0x39a9('0x7'));var logger=require(_0x39a9('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x39a9('0x9'));var client=jayson[_0x39a9('0xa')][_0x39a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204034,_0x42abce,_0x376751){return new BPromise(function(_0x5120f0,_0x59b04e){return client[_0x39a9('0xc')](_0x204034,_0x376751)[_0x39a9('0xd')](function(_0x2f5b62){logger['info'](_0x39a9('0xe'),_0x42abce,_0x39a9('0xf'));logger[_0x39a9('0x10')](_0x39a9('0x11'),_0x42abce,_0x39a9('0xf'),JSON['stringify'](_0x2f5b62));if(_0x2f5b62[_0x39a9('0x12')]){if(_0x2f5b62[_0x39a9('0x12')][_0x39a9('0x13')]===0x1f4){logger[_0x39a9('0x12')](_0x39a9('0xe'),_0x42abce,_0x2f5b62[_0x39a9('0x12')][_0x39a9('0x14')]);return _0x59b04e(_0x2f5b62['error'][_0x39a9('0x14')]);}logger[_0x39a9('0x12')]('Sound,\x20%s,\x20%s',_0x42abce,_0x2f5b62[_0x39a9('0x12')]['message']);return _0x5120f0(_0x2f5b62[_0x39a9('0x12')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x42abce,_0x39a9('0xf'));_0x5120f0(_0x2f5b62[_0x39a9('0x15')]['message']);}})['catch'](function(_0x35d3c4){logger['error'](_0x39a9('0xe'),_0x42abce,_0x35d3c4);_0x59b04e(_0x35d3c4);});});}exports[_0x39a9('0x16')]=function(_0x434a8c){var _0x5621de=this;return new Promise(function(_0x693c8e,_0x1cf23d){return db[_0x39a9('0x17')][_0x39a9('0x18')]({'raw':_0x434a8c[_0x39a9('0x19')]?_0x434a8c[_0x39a9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x434a8c[_0x39a9('0x19')]?_0x434a8c['options']['where']||null:null,'attributes':_0x434a8c[_0x39a9('0x19')]?_0x434a8c['options'][_0x39a9('0x1a')]||null:null,'include':_0x434a8c[_0x39a9('0x19')]?_0x434a8c[_0x39a9('0x19')][_0x39a9('0x1b')]?_[_0x39a9('0x1c')](_0x434a8c[_0x39a9('0x19')][_0x39a9('0x1b')],function(_0x2ee47b){return{'model':db[_0x2ee47b['model']],'as':_0x2ee47b['as'],'attributes':_0x2ee47b[_0x39a9('0x1a')],'include':_0x2ee47b[_0x39a9('0x1b')]?_[_0x39a9('0x1c')](_0x2ee47b[_0x39a9('0x1b')],function(_0x4fa977){return{'model':db[_0x4fa977['model']],'as':_0x4fa977['as'],'attributes':_0x4fa977[_0x39a9('0x1a')],'include':_0x4fa977[_0x39a9('0x1b')]?_[_0x39a9('0x1c')](_0x4fa977[_0x39a9('0x1b')],function(_0x242266){return{'model':db[_0x242266[_0x39a9('0x1d')]],'as':_0x242266['as'],'attributes':_0x242266[_0x39a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x39a9('0xd')](function(_0x32e0a6){logger['info'](_0x39a9('0x16'),_0x434a8c);logger[_0x39a9('0x10')](_0x39a9('0x16'),_0x434a8c,JSON['stringify'](_0x32e0a6));_0x693c8e(_0x32e0a6);})[_0x39a9('0x1e')](function(_0x41c29b){logger[_0x39a9('0x12')]('ShowSound',_0x41c29b[_0x39a9('0x14')],_0x434a8c);_0x1cf23d(_0x5621de[_0x39a9('0x12')](0x1f4,_0x41c29b[_0x39a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b22d682..77a08eb 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x25a655,_0x1ba5b6){var _0x3da605=function(_0xb31e2e){while(--_0xb31e2e){_0x25a655['push'](_0x25a655['shift']());}};_0x3da605(++_0x1ba5b6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5ada5d,_0x52a72a){_0x5ada5d=_0x5ada5d-0x0;var _0x3ba95f=_0x9ffd[_0x5ada5d];return _0x3ba95f;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 87379e6..087de71 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 _0xea35=['out','TEXT','sequelize','exports','STRING','medium','ENUM'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xea35,0x19f));var _0x5ea3=function(_0x3f13fd,_0x1c3910){_0x3f13fd=_0x3f13fd-0x0;var _0x456cf9=_0xea35[_0x3f13fd];return _0x456cf9;};'use strict';var Sequelize=require(_0x5ea3('0x0'));module[_0x5ea3('0x1')]={'uniqueid':{'type':Sequelize[_0x5ea3('0x2')]},'body':{'type':Sequelize['TEXT'](_0x5ea3('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5ea3('0x4')]('in',_0x5ea3('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5ea3('0x6')]}}; \ No newline at end of file +var _0x6829=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x2719b8,_0x36cf33){var _0x25d1b3=function(_0x16b434){while(--_0x16b434){_0x2719b8['push'](_0x2719b8['shift']());}};_0x25d1b3(++_0x36cf33);}(_0x6829,0x163));var _0x9682=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6829[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x9682('0x0'));module[_0x9682('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x9682('0x2')](_0x9682('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9682('0x4')]('in',_0x9682('0x5')),'defaultValue':_0x9682('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9682('0x6')]},'providerResponse':{'type':Sequelize[_0x9682('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8cf303d..f70f2f7 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 _0x5ab9=['create','body','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','end','status','offset','limit','undefined','count','Content-Range','json','reject','update','destroy','then','name','index','map','SquareMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','rawAttributes','options','find'];(function(_0x399095,_0x133dae){var _0x40a046=function(_0x1e6803){while(--_0x1e6803){_0x399095['push'](_0x399095['shift']());}};_0x40a046(++_0x133dae);}(_0x5ab9,0x117));var _0x95ab=function(_0x4f3e33,_0x5704a8){_0x4f3e33=_0x4f3e33-0x0;var _0x1a070c=_0x5ab9[_0x4f3e33];return _0x1a070c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ab('0x1'));var rp=require(_0x95ab('0x2'));var moment=require(_0x95ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x95ab('0x4'));var util=require(_0x95ab('0x5'));var path=require('path');var sox=require(_0x95ab('0x6'));var csv=require('to-csv');var ejs=require(_0x95ab('0x7'));var fs=require('fs');var fs_extra=require(_0x95ab('0x8'));var _=require('lodash');var squel=require(_0x95ab('0x9'));var crypto=require('crypto');var jsforce=require(_0x95ab('0xa'));var deskjs=require(_0x95ab('0xb'));var toCsv=require(_0x95ab('0xc'));var querystring=require(_0x95ab('0xd'));var Papa=require(_0x95ab('0xe'));var Redis=require(_0x95ab('0xf'));var authService=require(_0x95ab('0x10'));var qs=require(_0x95ab('0x11'));var as=require(_0x95ab('0x12'));var hardwareService=require(_0x95ab('0x13'));var logger=require(_0x95ab('0x14'))(_0x95ab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x95ab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1053d3,_0x35515a){_0x35515a=_0x35515a||0xcc;return function(_0x2e2e99){if(_0x2e2e99){return _0x1053d3['sendStatus'](_0x35515a);}return _0x1053d3['status'](_0x35515a)[_0x95ab('0x17')]();};}function respondWithResult(_0x3bbd05,_0x427889){_0x427889=_0x427889||0xc8;return function(_0x2b1d19){if(_0x2b1d19){return _0x3bbd05[_0x95ab('0x18')](_0x427889)['json'](_0x2b1d19);}};}function respondWithFilteredResult(_0x308cdf,_0x8743ad){return function(_0x27e1a3){if(_0x27e1a3){var _0x3fd3d2=typeof _0x8743ad[_0x95ab('0x19')]==='undefined'&&typeof _0x8743ad[_0x95ab('0x1a')]===_0x95ab('0x1b');var _0x4b7ffd=_0x27e1a3[_0x95ab('0x1c')];var _0x1889da=_0x3fd3d2?0x0:_0x8743ad[_0x95ab('0x19')];var _0x137646=_0x3fd3d2?_0x27e1a3[_0x95ab('0x1c')]:_0x8743ad[_0x95ab('0x19')]+_0x8743ad[_0x95ab('0x1a')];var _0x2ce167;if(_0x137646>=_0x4b7ffd){_0x137646=_0x4b7ffd;_0x2ce167=0xc8;}else{_0x2ce167=0xce;}_0x308cdf['status'](_0x2ce167);return _0x308cdf['set'](_0x95ab('0x1d'),_0x1889da+'-'+_0x137646+'/'+_0x4b7ffd)[_0x95ab('0x1e')](_0x27e1a3);}return null;};}function patchUpdates(_0x3446b4){return function(_0xb1885e){try{jsonpatch['apply'](_0xb1885e,_0x3446b4,!![]);}catch(_0x4e5b9b){return BPromise[_0x95ab('0x1f')](_0x4e5b9b);}return _0xb1885e['save']();};}function saveUpdates(_0x50e6ce,_0x3cd351){return function(_0x3eb073){if(_0x3eb073){return _0x3eb073[_0x95ab('0x20')](_0x50e6ce)['then'](function(_0x5ebcc8){return _0x5ebcc8;});}return null;};}function removeEntity(_0x2d71f8,_0x11e92d){return function(_0x37aaea){if(_0x37aaea){return _0x37aaea[_0x95ab('0x21')]()[_0x95ab('0x22')](function(){_0x2d71f8[_0x95ab('0x18')](0xcc)[_0x95ab('0x17')]();});}};}function handleEntityNotFound(_0x46309d,_0x31f4c1){return function(_0x5cb9be){if(!_0x5cb9be){_0x46309d['sendStatus'](0x194);}return _0x5cb9be;};}function handleError(_0xd28b4f,_0x2cdc52){_0x2cdc52=_0x2cdc52||0x1f4;return function(_0x58231c){logger['error'](_0x58231c['stack']);if(_0x58231c[_0x95ab('0x23')]){delete _0x58231c[_0x95ab('0x23')];}_0xd28b4f[_0x95ab('0x18')](_0x2cdc52)['send'](_0x58231c);};}exports[_0x95ab('0x24')]=function(_0x395516,_0x1fcd49){var _0x9e7f4d={},_0x1f5ee8={},_0xd0bc7={'count':0x0,'rows':[]};var _0x56b4e3=_[_0x95ab('0x25')](db[_0x95ab('0x26')]['rawAttributes'],function(_0x9965d3){return{'name':_0x9965d3[_0x95ab('0x27')],'type':_0x9965d3[_0x95ab('0x28')]['key']};});_0x1f5ee8[_0x95ab('0x29')]=_[_0x95ab('0x25')](_0x56b4e3,_0x95ab('0x23'));_0x1f5ee8[_0x95ab('0x2a')]=_[_0x95ab('0x2b')](_0x395516[_0x95ab('0x2a')]);_0x1f5ee8['filters']=_[_0x95ab('0x2c')](_0x1f5ee8[_0x95ab('0x29')],_0x1f5ee8[_0x95ab('0x2a')]);_0x9e7f4d[_0x95ab('0x2d')]=_[_0x95ab('0x2c')](_0x1f5ee8[_0x95ab('0x29')],qs[_0x95ab('0x2e')](_0x395516[_0x95ab('0x2a')][_0x95ab('0x2e')]));_0x9e7f4d[_0x95ab('0x2d')]=_0x9e7f4d[_0x95ab('0x2d')][_0x95ab('0x2f')]?_0x9e7f4d[_0x95ab('0x2d')]:_0x1f5ee8[_0x95ab('0x29')];if(!_0x395516[_0x95ab('0x2a')][_0x95ab('0x30')](_0x95ab('0x31'))){_0x9e7f4d[_0x95ab('0x1a')]=qs[_0x95ab('0x1a')](_0x395516['query'][_0x95ab('0x1a')]);_0x9e7f4d[_0x95ab('0x19')]=qs[_0x95ab('0x19')](_0x395516[_0x95ab('0x2a')][_0x95ab('0x19')]);}_0x9e7f4d[_0x95ab('0x32')]=qs[_0x95ab('0x33')](_0x395516[_0x95ab('0x2a')][_0x95ab('0x33')]);_0x9e7f4d[_0x95ab('0x34')]=qs[_0x95ab('0x35')](_[_0x95ab('0x36')](_0x395516[_0x95ab('0x2a')],_0x1f5ee8[_0x95ab('0x35')]),_0x56b4e3);if(_0x395516[_0x95ab('0x2a')][_0x95ab('0x37')]){_0x9e7f4d['where']=_['merge'](_0x9e7f4d['where'],{'$or':_[_0x95ab('0x25')](_0x56b4e3,function(_0x18eda3){if(_0x18eda3[_0x95ab('0x28')]!==_0x95ab('0x38')){var _0x285696={};_0x285696[_0x18eda3['name']]={'$like':'%'+_0x395516[_0x95ab('0x2a')][_0x95ab('0x37')]+'%'};return _0x285696;}})});}_0x9e7f4d=_[_0x95ab('0x39')]({},_0x9e7f4d,_0x395516['options']);var _0xba40f9={'where':_0x9e7f4d['where']};return db[_0x95ab('0x26')][_0x95ab('0x1c')](_0xba40f9)[_0x95ab('0x22')](function(_0x13612b){_0xd0bc7[_0x95ab('0x1c')]=_0x13612b;if(_0x395516[_0x95ab('0x2a')][_0x95ab('0x3a')]){_0x9e7f4d[_0x95ab('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x95ab('0x3c')](_0x9e7f4d);})[_0x95ab('0x22')](function(_0x18af01){_0xd0bc7[_0x95ab('0x3d')]=_0x18af01;return _0xd0bc7;})[_0x95ab('0x22')](respondWithFilteredResult(_0x1fcd49,_0x9e7f4d))[_0x95ab('0x3e')](handleError(_0x1fcd49,null));};exports['show']=function(_0x26c872,_0x3198e1){var _0x996f5={'raw':!![],'where':{'id':_0x26c872['params']['id']}},_0x2b9d8e={};_0x2b9d8e[_0x95ab('0x29')]=_[_0x95ab('0x2b')](db[_0x95ab('0x26')][_0x95ab('0x3f')]);_0x2b9d8e[_0x95ab('0x2a')]=_['keys'](_0x26c872['query']);_0x2b9d8e[_0x95ab('0x35')]=_['intersection'](_0x2b9d8e['model'],_0x2b9d8e[_0x95ab('0x2a')]);_0x996f5[_0x95ab('0x2d')]=_[_0x95ab('0x2c')](_0x2b9d8e[_0x95ab('0x29')],qs['fields'](_0x26c872[_0x95ab('0x2a')][_0x95ab('0x2e')]));_0x996f5[_0x95ab('0x2d')]=_0x996f5[_0x95ab('0x2d')]['length']?_0x996f5[_0x95ab('0x2d')]:_0x2b9d8e['model'];if(_0x26c872[_0x95ab('0x2a')][_0x95ab('0x3a')]){_0x996f5['include']=[{'all':!![]}];}_0x996f5=_[_0x95ab('0x39')]({},_0x996f5,_0x26c872[_0x95ab('0x40')]);return db[_0x95ab('0x26')][_0x95ab('0x41')](_0x996f5)[_0x95ab('0x22')](handleEntityNotFound(_0x3198e1,null))[_0x95ab('0x22')](respondWithResult(_0x3198e1,null))[_0x95ab('0x3e')](handleError(_0x3198e1,null));};exports[_0x95ab('0x42')]=function(_0x2238ee,_0x254d16){return db[_0x95ab('0x26')][_0x95ab('0x42')](_0x2238ee[_0x95ab('0x43')],{})[_0x95ab('0x22')](respondWithResult(_0x254d16,0xc9))['catch'](handleError(_0x254d16,null));};exports[_0x95ab('0x20')]=function(_0x5296a3,_0x38e3f5){if(_0x5296a3[_0x95ab('0x43')]['id']){delete _0x5296a3[_0x95ab('0x43')]['id'];}return db[_0x95ab('0x26')][_0x95ab('0x41')]({'where':{'id':_0x5296a3[_0x95ab('0x44')]['id']}})[_0x95ab('0x22')](handleEntityNotFound(_0x38e3f5,null))[_0x95ab('0x22')](saveUpdates(_0x5296a3['body'],null))['then'](respondWithResult(_0x38e3f5,null))['catch'](handleError(_0x38e3f5,null));};exports[_0x95ab('0x21')]=function(_0x21b0c6,_0x1c0aa8){return db[_0x95ab('0x26')]['find']({'where':{'id':_0x21b0c6[_0x95ab('0x44')]['id']}})[_0x95ab('0x22')](handleEntityNotFound(_0x1c0aa8,null))['then'](removeEntity(_0x1c0aa8,null))['catch'](handleError(_0x1c0aa8,null));}; \ No newline at end of file +var _0x251f=['api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x137238,_0x2f6d20){var _0x84f9fd=function(_0x273871){while(--_0x273871){_0x137238['push'](_0x137238['shift']());}};_0x84f9fd(++_0x2f6d20);}(_0x251f,0xbe));var _0xf251=function(_0x3500a2,_0x2ce6e5){_0x3500a2=_0x3500a2-0x0;var _0x5bdf7a=_0x251f[_0x3500a2];return _0x5bdf7a;};'use strict';var emlformat=require(_0xf251('0x0'));var rimraf=require(_0xf251('0x1'));var zipdir=require(_0xf251('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf251('0x3'));var BPromise=require(_0xf251('0x4'));var Mustache=require(_0xf251('0x5'));var util=require('util');var path=require(_0xf251('0x6'));var sox=require(_0xf251('0x7'));var csv=require('to-csv');var ejs=require(_0xf251('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf251('0x9'));var squel=require('squel');var crypto=require(_0xf251('0xa'));var jsforce=require(_0xf251('0xb'));var deskjs=require(_0xf251('0xc'));var toCsv=require(_0xf251('0xd'));var querystring=require(_0xf251('0xe'));var Papa=require(_0xf251('0xf'));var Redis=require('ioredis');var authService=require(_0xf251('0x10'));var qs=require(_0xf251('0x11'));var as=require(_0xf251('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf251('0x13'))(_0xf251('0x14'));var utils=require(_0xf251('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf251('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ce30e,_0x515b6d){_0x515b6d=_0x515b6d||0xcc;return function(_0x42a63d){if(_0x42a63d){return _0x2ce30e[_0xf251('0x17')](_0x515b6d);}return _0x2ce30e['status'](_0x515b6d)[_0xf251('0x18')]();};}function respondWithResult(_0x18bf6b,_0x201ec0){_0x201ec0=_0x201ec0||0xc8;return function(_0x6b78a1){if(_0x6b78a1){return _0x18bf6b[_0xf251('0x19')](_0x201ec0)[_0xf251('0x1a')](_0x6b78a1);}};}function respondWithFilteredResult(_0x3cc58d,_0x2873ea){return function(_0x50f6d9){if(_0x50f6d9){var _0x7ae1aa=typeof _0x2873ea['offset']===_0xf251('0x1b')&&typeof _0x2873ea[_0xf251('0x1c')]===_0xf251('0x1b');var _0x285f69=_0x50f6d9['count'];var _0xa61ce5=_0x7ae1aa?0x0:_0x2873ea[_0xf251('0x1d')];var _0x236037=_0x7ae1aa?_0x50f6d9[_0xf251('0x1e')]:_0x2873ea['offset']+_0x2873ea[_0xf251('0x1c')];var _0x286901;if(_0x236037>=_0x285f69){_0x236037=_0x285f69;_0x286901=0xc8;}else{_0x286901=0xce;}_0x3cc58d['status'](_0x286901);return _0x3cc58d[_0xf251('0x1f')](_0xf251('0x20'),_0xa61ce5+'-'+_0x236037+'/'+_0x285f69)['json'](_0x50f6d9);}return null;};}function patchUpdates(_0x2c3c46){return function(_0x3264ed){try{jsonpatch[_0xf251('0x21')](_0x3264ed,_0x2c3c46,!![]);}catch(_0x4c8267){return BPromise['reject'](_0x4c8267);}return _0x3264ed['save']();};}function saveUpdates(_0x3df81e,_0x19f89d){return function(_0x1875b2){if(_0x1875b2){return _0x1875b2['update'](_0x3df81e)[_0xf251('0x22')](function(_0x19b349){return _0x19b349;});}return null;};}function removeEntity(_0x138289,_0x275754){return function(_0x3d0d28){if(_0x3d0d28){return _0x3d0d28[_0xf251('0x23')]()[_0xf251('0x22')](function(){_0x138289[_0xf251('0x19')](0xcc)[_0xf251('0x18')]();});}};}function handleEntityNotFound(_0x4964ae,_0x2fa803){return function(_0x574996){if(!_0x574996){_0x4964ae['sendStatus'](0x194);}return _0x574996;};}function handleError(_0x243c1e,_0xc5bd70){_0xc5bd70=_0xc5bd70||0x1f4;return function(_0x236ccf){logger[_0xf251('0x24')](_0x236ccf[_0xf251('0x25')]);if(_0x236ccf[_0xf251('0x26')]){delete _0x236ccf[_0xf251('0x26')];}_0x243c1e[_0xf251('0x19')](_0xc5bd70)['send'](_0x236ccf);};}exports[_0xf251('0x27')]=function(_0x21f447,_0x1f2af8){var _0x152a27={},_0x532078={},_0x5602dd={'count':0x0,'rows':[]};var _0x5ebb67=_[_0xf251('0x28')](db[_0xf251('0x29')][_0xf251('0x2a')],function(_0x2d3484){return{'name':_0x2d3484['fieldName'],'type':_0x2d3484[_0xf251('0x2b')][_0xf251('0x2c')]};});_0x532078[_0xf251('0x2d')]=_[_0xf251('0x28')](_0x5ebb67,_0xf251('0x26'));_0x532078['query']=_[_0xf251('0x2e')](_0x21f447[_0xf251('0x2f')]);_0x532078[_0xf251('0x30')]=_[_0xf251('0x31')](_0x532078[_0xf251('0x2d')],_0x532078[_0xf251('0x2f')]);_0x152a27[_0xf251('0x32')]=_['intersection'](_0x532078[_0xf251('0x2d')],qs[_0xf251('0x33')](_0x21f447[_0xf251('0x2f')][_0xf251('0x33')]));_0x152a27['attributes']=_0x152a27['attributes']['length']?_0x152a27[_0xf251('0x32')]:_0x532078[_0xf251('0x2d')];if(!_0x21f447['query']['hasOwnProperty']('nolimit')){_0x152a27[_0xf251('0x1c')]=qs[_0xf251('0x1c')](_0x21f447[_0xf251('0x2f')][_0xf251('0x1c')]);_0x152a27[_0xf251('0x1d')]=qs[_0xf251('0x1d')](_0x21f447['query']['offset']);}_0x152a27[_0xf251('0x34')]=qs[_0xf251('0x35')](_0x21f447[_0xf251('0x2f')][_0xf251('0x35')]);_0x152a27[_0xf251('0x36')]=qs[_0xf251('0x30')](_['pick'](_0x21f447['query'],_0x532078[_0xf251('0x30')]),_0x5ebb67);if(_0x21f447[_0xf251('0x2f')]['filter']){_0x152a27[_0xf251('0x36')]=_[_0xf251('0x37')](_0x152a27[_0xf251('0x36')],{'$or':_['map'](_0x5ebb67,function(_0x1535b3){if(_0x1535b3[_0xf251('0x2b')]!==_0xf251('0x38')){var _0xd8eb7a={};_0xd8eb7a[_0x1535b3[_0xf251('0x26')]]={'$like':'%'+_0x21f447[_0xf251('0x2f')]['filter']+'%'};return _0xd8eb7a;}})});}_0x152a27=_['merge']({},_0x152a27,_0x21f447[_0xf251('0x39')]);var _0x35a216={'where':_0x152a27[_0xf251('0x36')]};return db[_0xf251('0x29')][_0xf251('0x1e')](_0x35a216)['then'](function(_0x2826c4){_0x5602dd[_0xf251('0x1e')]=_0x2826c4;if(_0x21f447['query'][_0xf251('0x3a')]){_0x152a27[_0xf251('0x3b')]=[{'all':!![]}];}return db[_0xf251('0x29')][_0xf251('0x3c')](_0x152a27);})[_0xf251('0x22')](function(_0xff3af0){_0x5602dd[_0xf251('0x3d')]=_0xff3af0;return _0x5602dd;})[_0xf251('0x22')](respondWithFilteredResult(_0x1f2af8,_0x152a27))[_0xf251('0x3e')](handleError(_0x1f2af8,null));};exports[_0xf251('0x3f')]=function(_0x3ef04e,_0x2e3c71){var _0x57959f={'raw':!![],'where':{'id':_0x3ef04e[_0xf251('0x40')]['id']}},_0x30e9bc={};_0x30e9bc[_0xf251('0x2d')]=_[_0xf251('0x2e')](db['SquareMessage'][_0xf251('0x2a')]);_0x30e9bc[_0xf251('0x2f')]=_[_0xf251('0x2e')](_0x3ef04e['query']);_0x30e9bc['filters']=_['intersection'](_0x30e9bc[_0xf251('0x2d')],_0x30e9bc[_0xf251('0x2f')]);_0x57959f['attributes']=_[_0xf251('0x31')](_0x30e9bc[_0xf251('0x2d')],qs['fields'](_0x3ef04e[_0xf251('0x2f')][_0xf251('0x33')]));_0x57959f['attributes']=_0x57959f[_0xf251('0x32')][_0xf251('0x41')]?_0x57959f['attributes']:_0x30e9bc[_0xf251('0x2d')];if(_0x3ef04e[_0xf251('0x2f')][_0xf251('0x3a')]){_0x57959f[_0xf251('0x3b')]=[{'all':!![]}];}_0x57959f=_[_0xf251('0x37')]({},_0x57959f,_0x3ef04e[_0xf251('0x39')]);return db['SquareMessage'][_0xf251('0x42')](_0x57959f)[_0xf251('0x22')](handleEntityNotFound(_0x2e3c71,null))[_0xf251('0x22')](respondWithResult(_0x2e3c71,null))[_0xf251('0x3e')](handleError(_0x2e3c71,null));};exports[_0xf251('0x43')]=function(_0x326d7d,_0x1b3820){return db[_0xf251('0x29')][_0xf251('0x43')](_0x326d7d[_0xf251('0x44')],{})['then'](respondWithResult(_0x1b3820,0xc9))[_0xf251('0x3e')](handleError(_0x1b3820,null));};exports[_0xf251('0x45')]=function(_0x3be0b2,_0x592ad0){if(_0x3be0b2[_0xf251('0x44')]['id']){delete _0x3be0b2[_0xf251('0x44')]['id'];}return db[_0xf251('0x29')][_0xf251('0x42')]({'where':{'id':_0x3be0b2[_0xf251('0x40')]['id']}})[_0xf251('0x22')](handleEntityNotFound(_0x592ad0,null))['then'](saveUpdates(_0x3be0b2[_0xf251('0x44')],null))[_0xf251('0x22')](respondWithResult(_0x592ad0,null))['catch'](handleError(_0x592ad0,null));};exports[_0xf251('0x23')]=function(_0x371628,_0x22e6d9){return db['SquareMessage']['find']({'where':{'id':_0x371628[_0xf251('0x40')]['id']}})[_0xf251('0x22')](handleEntityNotFound(_0x22e6d9,null))['then'](removeEntity(_0x22e6d9,null))[_0xf251('0x3e')](handleError(_0x22e6d9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a7b6819..e1d9441 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 _0x42c0=['moment','rimraf','../../config/environment','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x34f456,_0x271849){var _0x589f55=function(_0x32e03d){while(--_0x32e03d){_0x34f456['push'](_0x34f456['shift']());}};_0x589f55(++_0x271849);}(_0x42c0,0x72));var _0x042c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x42c0[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x042c('0x0'));var util=require(_0x042c('0x1'));var logger=require(_0x042c('0x2'))('api');var moment=require(_0x042c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x042c('0x4'));var config=require(_0x042c('0x5'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x563d9e,_0x457ec9){return _0x563d9e[_0x042c('0x6')](_0x042c('0x7'),attributes,{'tableName':_0x042c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e98=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x2d7712,_0x39aba4){var _0x2efa08=function(_0xfbe847){while(--_0xfbe847){_0x2d7712['push'](_0x2d7712['shift']());}};_0x2efa08(++_0x39aba4);}(_0x7e98,0xfd));var _0x87e9=function(_0x4e4963,_0x335928){_0x4e4963=_0x4e4963-0x0;var _0x41bcf5=_0x7e98[_0x4e4963];return _0x41bcf5;};'use strict';var _=require(_0x87e9('0x0'));var util=require(_0x87e9('0x1'));var logger=require(_0x87e9('0x2'))(_0x87e9('0x3'));var moment=require(_0x87e9('0x4'));var BPromise=require(_0x87e9('0x5'));var rp=require(_0x87e9('0x6'));var fs=require('fs');var path=require(_0x87e9('0x7'));var rimraf=require(_0x87e9('0x8'));var config=require(_0x87e9('0x9'));var attributes=require(_0x87e9('0xa'));module[_0x87e9('0xb')]=function(_0x36905f,_0x595bb2){return _0x36905f[_0x87e9('0xc')](_0x87e9('0xd'),attributes,{'tableName':_0x87e9('0xe'),'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 5d94eb2..ca7ec5d 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 _0x1e97=['result','catch','create','body','options','raw','CreateSquareMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x363816,_0xc20c5a){var _0x368201=function(_0x57dae1){while(--_0x57dae1){_0x363816['push'](_0x363816['shift']());}};_0x368201(++_0xc20c5a);}(_0x1e97,0x1b7));var _0x71e9=function(_0x2f073b,_0x20d7fb){_0x2f073b=_0x2f073b-0x0;var _0x50e646=_0x1e97[_0x2f073b];return _0x50e646;};'use strict';var _=require(_0x71e9('0x0'));var util=require('util');var moment=require(_0x71e9('0x1'));var BPromise=require('bluebird');var rs=require(_0x71e9('0x2'));var fs=require('fs');var Redis=require(_0x71e9('0x3'));var db=require(_0x71e9('0x4'))['db'];var utils=require(_0x71e9('0x5'));var logger=require(_0x71e9('0x6'))(_0x71e9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfb0a,_0x29671f,_0x51a1cc){return new BPromise(function(_0x36e35c,_0x2c7823){return client[_0x71e9('0x9')](_0x1cfb0a,_0x51a1cc)[_0x71e9('0xa')](function(_0x42fe20){logger[_0x71e9('0xb')](_0x71e9('0xc'),_0x29671f,_0x71e9('0xd'));logger[_0x71e9('0xe')](_0x71e9('0xf'),_0x29671f,_0x71e9('0xd'),JSON[_0x71e9('0x10')](_0x42fe20));if(_0x42fe20[_0x71e9('0x11')]){if(_0x42fe20[_0x71e9('0x11')][_0x71e9('0x12')]===0x1f4){logger[_0x71e9('0x11')](_0x71e9('0xc'),_0x29671f,_0x42fe20[_0x71e9('0x11')][_0x71e9('0x13')]);return _0x2c7823(_0x42fe20[_0x71e9('0x11')][_0x71e9('0x13')]);}logger['error'](_0x71e9('0xc'),_0x29671f,_0x42fe20['error'][_0x71e9('0x13')]);return _0x36e35c(_0x42fe20[_0x71e9('0x11')][_0x71e9('0x13')]);}else{logger[_0x71e9('0xb')]('SquareMessage,\x20%s,\x20%s',_0x29671f,_0x71e9('0xd'));_0x36e35c(_0x42fe20[_0x71e9('0x14')][_0x71e9('0x13')]);}})[_0x71e9('0x15')](function(_0x4b44fd){logger[_0x71e9('0x11')](_0x71e9('0xc'),_0x29671f,_0x4b44fd);_0x2c7823(_0x4b44fd);});});}exports['CreateSquareMessage']=function(_0xe7e69c){var _0x1d15e4=this;return new Promise(function(_0x1539c9,_0x3cada8){return db['SquareMessage'][_0x71e9('0x16')](_0xe7e69c[_0x71e9('0x17')],{'raw':_0xe7e69c['options']?_0xe7e69c[_0x71e9('0x18')][_0x71e9('0x19')]===undefined?!![]:![]:!![]})[_0x71e9('0xa')](function(_0x5c52cd){logger[_0x71e9('0xb')]('CreateSquareMessage',_0xe7e69c);logger[_0x71e9('0xe')](_0x71e9('0x1a'),_0xe7e69c,JSON['stringify'](_0x5c52cd));_0x1539c9(_0x5c52cd);})[_0x71e9('0x15')](function(_0x56c019){logger[_0x71e9('0x11')]('CreateSquareMessage',_0x56c019[_0x71e9('0x13')],_0xe7e69c);_0x3cada8(_0x1d15e4[_0x71e9('0x11')](0x1f4,_0x56c019[_0x71e9('0x13')]));});});}; \ No newline at end of file +var _0xaf8c=['../../config/environment','jayson/promise','http','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36315b,_0x8793de){var _0x2adff2=function(_0x1c4c95){while(--_0x1c4c95){_0x36315b['push'](_0x36315b['shift']());}};_0x2adff2(++_0x8793de);}(_0xaf8c,0x1e5));var _0xcaf8=function(_0x50c1df,_0x1fdd9c){_0x50c1df=_0x50c1df-0x0;var _0x2b83a5=_0xaf8c[_0x50c1df];return _0x2b83a5;};'use strict';var _=require(_0xcaf8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcaf8('0x1'));var rs=require(_0xcaf8('0x2'));var fs=require('fs');var Redis=require(_0xcaf8('0x3'));var db=require(_0xcaf8('0x4'))['db'];var utils=require(_0xcaf8('0x5'));var logger=require(_0xcaf8('0x6'))(_0xcaf8('0x7'));var config=require(_0xcaf8('0x8'));var jayson=require(_0xcaf8('0x9'));var client=jayson['client'][_0xcaf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6d81,_0x3653b5,_0x5aee3f){return new BPromise(function(_0x8e874a,_0x512e7e){return client['request'](_0x1f6d81,_0x5aee3f)[_0xcaf8('0xb')](function(_0x21ce47){logger[_0xcaf8('0xc')]('SquareMessage,\x20%s,\x20%s',_0x3653b5,_0xcaf8('0xd'));logger['debug'](_0xcaf8('0xe'),_0x3653b5,_0xcaf8('0xd'),JSON['stringify'](_0x21ce47));if(_0x21ce47[_0xcaf8('0xf')]){if(_0x21ce47['error'][_0xcaf8('0x10')]===0x1f4){logger[_0xcaf8('0xf')](_0xcaf8('0x11'),_0x3653b5,_0x21ce47['error'][_0xcaf8('0x12')]);return _0x512e7e(_0x21ce47['error'][_0xcaf8('0x12')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x3653b5,_0x21ce47[_0xcaf8('0xf')][_0xcaf8('0x12')]);return _0x8e874a(_0x21ce47[_0xcaf8('0xf')]['message']);}else{logger['info'](_0xcaf8('0x11'),_0x3653b5,'request\x20sent');_0x8e874a(_0x21ce47[_0xcaf8('0x13')][_0xcaf8('0x12')]);}})['catch'](function(_0x1f42d8){logger[_0xcaf8('0xf')](_0xcaf8('0x11'),_0x3653b5,_0x1f42d8);_0x512e7e(_0x1f42d8);});});}exports[_0xcaf8('0x14')]=function(_0x5b43d3){var _0x15ef19=this;return new Promise(function(_0x4f9e32,_0x1273bb){return db[_0xcaf8('0x15')][_0xcaf8('0x16')](_0x5b43d3[_0xcaf8('0x17')],{'raw':_0x5b43d3[_0xcaf8('0x18')]?_0x5b43d3[_0xcaf8('0x18')][_0xcaf8('0x19')]===undefined?!![]:![]:!![]})[_0xcaf8('0xb')](function(_0x4b3eb3){logger[_0xcaf8('0xc')](_0xcaf8('0x14'),_0x5b43d3);logger[_0xcaf8('0x1a')]('CreateSquareMessage',_0x5b43d3,JSON[_0xcaf8('0x1b')](_0x4b3eb3));_0x4f9e32(_0x4b3eb3);})[_0xcaf8('0x1c')](function(_0x4e6467){logger[_0xcaf8('0xf')](_0xcaf8('0x14'),_0x4e6467['message'],_0x5b43d3);_0x1273bb(_0x15ef19['error'](0x1f4,_0x4e6467[_0xcaf8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 52294a2..1dccd6b 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 _0x1586=['/:id','isAuthenticated','show','15s','test','post','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index'];(function(_0xc0bc7f,_0x51678d){var _0x5a5597=function(_0x3c05a3){while(--_0x3c05a3){_0xc0bc7f['push'](_0xc0bc7f['shift']());}};_0x5a5597(++_0x51678d);}(_0x1586,0x1ae));var _0x6158=function(_0x179039,_0x1fb713){_0x179039=_0x179039-0x0;var _0xeb427=_0x1586[_0x179039];return _0xeb427;};'use strict';var multer=require('multer');var util=require(_0x6158('0x0'));var path=require(_0x6158('0x1'));var timeout=require(_0x6158('0x2'));var express=require(_0x6158('0x3'));var router=express['Router']();var fs_extra=require(_0x6158('0x4'));var auth=require(_0x6158('0x5'));var interaction=require(_0x6158('0x6'));var config=require(_0x6158('0x7'));var controller=require(_0x6158('0x8'));router[_0x6158('0x9')]('/',auth['isAuthenticated'](),controller[_0x6158('0xa')]);router['get'](_0x6158('0xb'),auth[_0x6158('0xc')](),controller[_0x6158('0xd')]);router[_0x6158('0x9')]('/:id/test',auth[_0x6158('0xc')](),timeout(_0x6158('0xe')),controller[_0x6158('0xf')]);router[_0x6158('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6158('0x11')](_0x6158('0xb'),auth['isAuthenticated'](),controller[_0x6158('0x12')]);router['delete'](_0x6158('0xb'),auth['isAuthenticated'](),controller[_0x6158('0x13')]);module[_0x6158('0x14')]=router; \ No newline at end of file +var _0x4e5c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','15s','test','post','put','/:id','delete','destroy','exports','multer','path','express'];(function(_0x372bdd,_0x1700e6){var _0x3ae6dc=function(_0x2c3bfd){while(--_0x2c3bfd){_0x372bdd['push'](_0x372bdd['shift']());}};_0x3ae6dc(++_0x1700e6);}(_0x4e5c,0x101));var _0xc4e5=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x4e5c[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0xc4e5('0x0'));var util=require('util');var path=require(_0xc4e5('0x1'));var timeout=require('connect-timeout');var express=require(_0xc4e5('0x2'));var router=express['Router']();var fs_extra=require(_0xc4e5('0x3'));var auth=require(_0xc4e5('0x4'));var interaction=require(_0xc4e5('0x5'));var config=require(_0xc4e5('0x6'));var controller=require(_0xc4e5('0x7'));router[_0xc4e5('0x8')]('/',auth[_0xc4e5('0x9')](),controller[_0xc4e5('0xa')]);router[_0xc4e5('0x8')]('/:id',auth[_0xc4e5('0x9')](),controller[_0xc4e5('0xb')]);router[_0xc4e5('0x8')]('/:id/test',auth[_0xc4e5('0x9')](),timeout(_0xc4e5('0xc')),controller[_0xc4e5('0xd')]);router[_0xc4e5('0xe')]('/',auth[_0xc4e5('0x9')](),controller['create']);router[_0xc4e5('0xf')](_0xc4e5('0x10'),auth[_0xc4e5('0x9')](),controller['update']);router[_0xc4e5('0x11')]('/:id',auth[_0xc4e5('0x9')](),controller[_0xc4e5('0x12')]);module[_0xc4e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e17c4c8..dc69bcf 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 _0xc771=['name','sequelize','exports','STRING'];(function(_0x2b8096,_0x2e5c5d){var _0xd8449e=function(_0x1d3f23){while(--_0x1d3f23){_0x2b8096['push'](_0x2b8096['shift']());}};_0xd8449e(++_0x2e5c5d);}(_0xc771,0xd1));var _0x1c77=function(_0x21f7bc,_0x36d038){_0x21f7bc=_0x21f7bc-0x0;var _0x55d33d=_0xc771[_0x21f7bc];return _0x55d33d;};'use strict';var Sequelize=require(_0x1c77('0x0'));module[_0x1c77('0x1')]={'name':{'type':Sequelize[_0x1c77('0x2')],'unique':_0x1c77('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1c77('0x2')]},'description':{'type':Sequelize[_0x1c77('0x2')]}}; \ No newline at end of file +var _0x97b6=['sequelize','name','STRING'];(function(_0x56d125,_0x122e36){var _0x4bd92c=function(_0x277730){while(--_0x277730){_0x56d125['push'](_0x56d125['shift']());}};_0x4bd92c(++_0x122e36);}(_0x97b6,0x1ad));var _0x697b=function(_0x32faa6,_0x231c1f){_0x32faa6=_0x32faa6-0x0;var _0x1526dd=_0x97b6[_0x32faa6];return _0x1526dd;};'use strict';var Sequelize=require(_0x697b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x697b('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x697b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 786eef2..e64a6b7 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 _0x2145=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','ODBC','UserProfileResource','destroy','error','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x47d18a,_0xd53074){var _0x130c43=function(_0x380f11){while(--_0x380f11){_0x47d18a['push'](_0x47d18a['shift']());}};_0x130c43(++_0xd53074);}(_0x2145,0x125));var _0x5214=function(_0x5ebeb7,_0x21e17a){_0x5ebeb7=_0x5ebeb7-0x0;var _0x58bf10=_0x2145[_0x5ebeb7];return _0x58bf10;};'use strict';var emlformat=require(_0x5214('0x0'));var rimraf=require(_0x5214('0x1'));var zipdir=require(_0x5214('0x2'));var jsonpatch=require(_0x5214('0x3'));var rp=require('request-promise');var moment=require(_0x5214('0x4'));var BPromise=require(_0x5214('0x5'));var Mustache=require(_0x5214('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5214('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5214('0x8'));var _=require('lodash');var squel=require(_0x5214('0x9'));var crypto=require(_0x5214('0xa'));var jsforce=require(_0x5214('0xb'));var deskjs=require(_0x5214('0xc'));var toCsv=require(_0x5214('0x7'));var querystring=require('querystring');var Papa=require(_0x5214('0xd'));var Redis=require(_0x5214('0xe'));var authService=require(_0x5214('0xf'));var qs=require(_0x5214('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5214('0x11'))(_0x5214('0x12'));var utils=require('../../config/utils');var config=require(_0x5214('0x13'));var licenseUtil=require(_0x5214('0x14'));var db=require(_0x5214('0x15'))['db'];function respondWithStatusCode(_0x3927e2,_0x2f11c2){_0x2f11c2=_0x2f11c2||0xcc;return function(_0x37556b){if(_0x37556b){return _0x3927e2[_0x5214('0x16')](_0x2f11c2);}return _0x3927e2['status'](_0x2f11c2)[_0x5214('0x17')]();};}function respondWithResult(_0x3a414b,_0x36250d){_0x36250d=_0x36250d||0xc8;return function(_0x30278c){if(_0x30278c){return _0x3a414b[_0x5214('0x18')](_0x36250d)['json'](_0x30278c);}};}function respondWithFilteredResult(_0x46ff84,_0x337990){return function(_0x2e6235){if(_0x2e6235){var _0x179852=typeof _0x337990[_0x5214('0x19')]===_0x5214('0x1a')&&typeof _0x337990['limit']===_0x5214('0x1a');var _0x40b7cd=_0x2e6235[_0x5214('0x1b')];var _0xd736e8=_0x179852?0x0:_0x337990['offset'];var _0x249526=_0x179852?_0x2e6235[_0x5214('0x1b')]:_0x337990['offset']+_0x337990[_0x5214('0x1c')];var _0x13a685;if(_0x249526>=_0x40b7cd){_0x249526=_0x40b7cd;_0x13a685=0xc8;}else{_0x13a685=0xce;}_0x46ff84[_0x5214('0x18')](_0x13a685);return _0x46ff84[_0x5214('0x1d')](_0x5214('0x1e'),_0xd736e8+'-'+_0x249526+'/'+_0x40b7cd)[_0x5214('0x1f')](_0x2e6235);}return null;};}function patchUpdates(_0x301522){return function(_0x186d58){try{jsonpatch['apply'](_0x186d58,_0x301522,!![]);}catch(_0x4fa7de){return BPromise[_0x5214('0x20')](_0x4fa7de);}return _0x186d58[_0x5214('0x21')]();};}function saveUpdates(_0x96be71,_0x5873d8){return function(_0x18d3c2){if(_0x18d3c2){return _0x18d3c2[_0x5214('0x22')](_0x96be71)[_0x5214('0x23')](function(_0x55fa0a){return _0x55fa0a;});}return null;};}function removeEntity(_0x494058,_0x5892e3){return function(_0x2d17a1){if(_0x2d17a1){return _0x2d17a1['destroy']()[_0x5214('0x23')](function(){var _0x54fc8c=_0x2d17a1['get']({'plain':!![]});var _0x3d18e1=_0x5214('0x24');return db[_0x5214('0x25')][_0x5214('0x26')]({'where':{'type':_0x3d18e1,'resourceId':_0x54fc8c['id']}})[_0x5214('0x23')](function(){return _0x2d17a1;});})[_0x5214('0x23')](function(){_0x494058[_0x5214('0x18')](0xcc)[_0x5214('0x17')]();});}};}function handleEntityNotFound(_0x489bb1,_0x43b6e1){return function(_0x4cb0d1){if(!_0x4cb0d1){_0x489bb1[_0x5214('0x16')](0x194);}return _0x4cb0d1;};}function handleError(_0x4da181,_0x8c4ee){_0x8c4ee=_0x8c4ee||0x1f4;return function(_0x2ed3b7){logger[_0x5214('0x27')](_0x2ed3b7[_0x5214('0x28')]);if(_0x2ed3b7['name']){delete _0x2ed3b7['name'];}_0x4da181[_0x5214('0x18')](_0x8c4ee)[_0x5214('0x29')](_0x2ed3b7);};}exports[_0x5214('0x2a')]=function(_0x5bf7ac,_0x30830f){var _0x332902={},_0x4dfc84={},_0x396a6d={'count':0x0,'rows':[]};var _0x4a7a19=_[_0x5214('0x2b')](db[_0x5214('0x2c')][_0x5214('0x2d')],function(_0x51d249){return{'name':_0x51d249[_0x5214('0x2e')],'type':_0x51d249[_0x5214('0x2f')][_0x5214('0x30')]};});_0x4dfc84[_0x5214('0x31')]=_[_0x5214('0x2b')](_0x4a7a19,_0x5214('0x32'));_0x4dfc84[_0x5214('0x33')]=_['keys'](_0x5bf7ac[_0x5214('0x33')]);_0x4dfc84[_0x5214('0x34')]=_['intersection'](_0x4dfc84[_0x5214('0x31')],_0x4dfc84['query']);_0x332902[_0x5214('0x35')]=_[_0x5214('0x36')](_0x4dfc84[_0x5214('0x31')],qs['fields'](_0x5bf7ac[_0x5214('0x33')][_0x5214('0x37')]));_0x332902[_0x5214('0x35')]=_0x332902[_0x5214('0x35')][_0x5214('0x38')]?_0x332902[_0x5214('0x35')]:_0x4dfc84[_0x5214('0x31')];if(!_0x5bf7ac['query'][_0x5214('0x39')](_0x5214('0x3a'))){_0x332902[_0x5214('0x1c')]=qs[_0x5214('0x1c')](_0x5bf7ac[_0x5214('0x33')][_0x5214('0x1c')]);_0x332902[_0x5214('0x19')]=qs['offset'](_0x5bf7ac[_0x5214('0x33')]['offset']);}_0x332902[_0x5214('0x3b')]=qs[_0x5214('0x3c')](_0x5bf7ac[_0x5214('0x33')][_0x5214('0x3c')]);_0x332902[_0x5214('0x3d')]=qs[_0x5214('0x34')](_[_0x5214('0x3e')](_0x5bf7ac['query'],_0x4dfc84[_0x5214('0x34')]),_0x4a7a19);if(_0x5bf7ac[_0x5214('0x33')][_0x5214('0x3f')]){_0x332902[_0x5214('0x3d')]=_['merge'](_0x332902[_0x5214('0x3d')],{'$or':_[_0x5214('0x2b')](_0x4a7a19,function(_0x40ce2a){if(_0x40ce2a['type']!==_0x5214('0x40')){var _0x129241={};_0x129241[_0x40ce2a[_0x5214('0x32')]]={'$like':'%'+_0x5bf7ac['query'][_0x5214('0x3f')]+'%'};return _0x129241;}})});}_0x332902=_[_0x5214('0x41')]({},_0x332902,_0x5bf7ac[_0x5214('0x42')]);var _0x40976d={'where':_0x332902[_0x5214('0x3d')]};return db['SquareOdbc'][_0x5214('0x1b')](_0x40976d)['then'](function(_0x5ae66a){_0x396a6d[_0x5214('0x1b')]=_0x5ae66a;if(_0x5bf7ac[_0x5214('0x33')][_0x5214('0x43')]){_0x332902[_0x5214('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x5214('0x45')](_0x332902);})[_0x5214('0x23')](function(_0x37d82d){_0x396a6d['rows']=_0x37d82d;return _0x396a6d;})[_0x5214('0x23')](respondWithFilteredResult(_0x30830f,_0x332902))[_0x5214('0x46')](handleError(_0x30830f,null));};exports[_0x5214('0x47')]=function(_0xd60498,_0x2309df){var _0x5413cd={'raw':!![],'where':{'id':_0xd60498[_0x5214('0x48')]['id']}},_0x384200={};_0x384200['model']=_['keys'](db[_0x5214('0x2c')]['rawAttributes']);_0x384200[_0x5214('0x33')]=_[_0x5214('0x49')](_0xd60498[_0x5214('0x33')]);_0x384200[_0x5214('0x34')]=_[_0x5214('0x36')](_0x384200[_0x5214('0x31')],_0x384200[_0x5214('0x33')]);_0x5413cd['attributes']=_[_0x5214('0x36')](_0x384200[_0x5214('0x31')],qs[_0x5214('0x37')](_0xd60498['query'][_0x5214('0x37')]));_0x5413cd[_0x5214('0x35')]=_0x5413cd[_0x5214('0x35')][_0x5214('0x38')]?_0x5413cd[_0x5214('0x35')]:_0x384200[_0x5214('0x31')];if(_0xd60498[_0x5214('0x33')][_0x5214('0x43')]){_0x5413cd[_0x5214('0x44')]=[{'all':!![]}];}_0x5413cd=_[_0x5214('0x41')]({},_0x5413cd,_0xd60498['options']);return db[_0x5214('0x2c')][_0x5214('0x4a')](_0x5413cd)[_0x5214('0x23')](handleEntityNotFound(_0x2309df,null))[_0x5214('0x23')](respondWithResult(_0x2309df,null))['catch'](handleError(_0x2309df,null));};exports[_0x5214('0x4b')]=function(_0x2e8d53,_0x2e96f6){return db[_0x5214('0x2c')][_0x5214('0x4b')](_0x2e8d53[_0x5214('0x4c')],{})[_0x5214('0x23')](function(_0x596b30){var _0x534318=_0x2e8d53[_0x5214('0x4d')][_0x5214('0x4e')]({'plain':!![]});if(!_0x534318)throw new Error(_0x5214('0x4f'));if(_0x534318[_0x5214('0x50')]===_0x5214('0x4d')){var _0x58874f=_0x596b30[_0x5214('0x4e')]({'plain':!![]});var _0x3d0831=_0x5214('0x24');return db[_0x5214('0x51')][_0x5214('0x4a')]({'where':{'name':_0x3d0831,'userProfileId':_0x534318[_0x5214('0x52')]},'raw':!![]})['then'](function(_0x56dace){if(_0x56dace&&_0x56dace['autoAssociation']===0x0){return db[_0x5214('0x25')][_0x5214('0x4b')]({'name':_0x58874f['name'],'resourceId':_0x58874f['id'],'type':_0x56dace[_0x5214('0x32')],'sectionId':_0x56dace['id']},{})['then'](function(){return _0x596b30;});}else{return _0x596b30;}})[_0x5214('0x46')](function(_0x40f541){logger['error'](_0x5214('0x53'),_0x40f541);throw _0x40f541;});}return _0x596b30;})[_0x5214('0x23')](respondWithResult(_0x2e96f6,0xc9))['catch'](handleError(_0x2e96f6,null));};exports[_0x5214('0x22')]=function(_0xeacfd3,_0x4004c2){if(_0xeacfd3[_0x5214('0x4c')]['id']){delete _0xeacfd3[_0x5214('0x4c')]['id'];}return db[_0x5214('0x2c')]['find']({'where':{'id':_0xeacfd3[_0x5214('0x48')]['id']}})[_0x5214('0x23')](handleEntityNotFound(_0x4004c2,null))['then'](saveUpdates(_0xeacfd3[_0x5214('0x4c')],null))[_0x5214('0x23')](respondWithResult(_0x4004c2,null))[_0x5214('0x46')](handleError(_0x4004c2,null));};exports[_0x5214('0x26')]=function(_0x3fd05f,_0x5c18e7){return db[_0x5214('0x2c')][_0x5214('0x4a')]({'where':{'id':_0x3fd05f[_0x5214('0x48')]['id']}})[_0x5214('0x23')](handleEntityNotFound(_0x5c18e7,null))['then'](removeEntity(_0x5c18e7,null))[_0x5214('0x46')](handleError(_0x5c18e7,null));};exports[_0x5214('0x54')]=function(_0x4a868b,_0x319e12,_0x4367d9){var _0x19beaf;return db[_0x5214('0x2c')]['find']({'where':{'id':_0x4a868b[_0x5214('0x48')]['id']},'attributes':['id',_0x5214('0x55')]})['then'](handleEntityNotFound(_0x319e12,null))[_0x5214('0x23')](function(_0x35ef12){if(_0x35ef12){var _0x266f42=require(_0x5214('0x56'))();_0x266f42['openSync'](_0x35ef12[_0x5214('0x55')]);_0x266f42[_0x5214('0x57')]();return _0x35ef12;}})['then'](respondWithResult(_0x319e12,null))['catch'](handleError(_0x319e12,null));}; \ No newline at end of file +var _0xb77f=['save','then','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','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','dsn','odbc','openSync','closeSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb77f,0x147));var _0xfb77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb77f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xfb77('0x0'));var rimraf=require(_0xfb77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb77('0x2'));var moment=require(_0xfb77('0x3'));var BPromise=require(_0xfb77('0x4'));var Mustache=require(_0xfb77('0x5'));var util=require('util');var path=require(_0xfb77('0x6'));var sox=require(_0xfb77('0x7'));var csv=require(_0xfb77('0x8'));var ejs=require(_0xfb77('0x9'));var fs=require('fs');var fs_extra=require(_0xfb77('0xa'));var _=require('lodash');var squel=require(_0xfb77('0xb'));var crypto=require(_0xfb77('0xc'));var jsforce=require(_0xfb77('0xd'));var deskjs=require(_0xfb77('0xe'));var toCsv=require(_0xfb77('0x8'));var querystring=require(_0xfb77('0xf'));var Papa=require(_0xfb77('0x10'));var Redis=require(_0xfb77('0x11'));var authService=require(_0xfb77('0x12'));var qs=require(_0xfb77('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb77('0x14'));var logger=require(_0xfb77('0x15'))(_0xfb77('0x16'));var utils=require(_0xfb77('0x17'));var config=require(_0xfb77('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2043d4,_0x5d70f7){_0x5d70f7=_0x5d70f7||0xcc;return function(_0x298c00){if(_0x298c00){return _0x2043d4[_0xfb77('0x19')](_0x5d70f7);}return _0x2043d4[_0xfb77('0x1a')](_0x5d70f7)[_0xfb77('0x1b')]();};}function respondWithResult(_0x2fa78d,_0x46d39d){_0x46d39d=_0x46d39d||0xc8;return function(_0x136ca9){if(_0x136ca9){return _0x2fa78d[_0xfb77('0x1a')](_0x46d39d)[_0xfb77('0x1c')](_0x136ca9);}};}function respondWithFilteredResult(_0x2aee48,_0x5a1665){return function(_0x4556c7){if(_0x4556c7){var _0x3a6726=typeof _0x5a1665[_0xfb77('0x1d')]===_0xfb77('0x1e')&&typeof _0x5a1665['limit']===_0xfb77('0x1e');var _0x1437d2=_0x4556c7['count'];var _0x42d868=_0x3a6726?0x0:_0x5a1665[_0xfb77('0x1d')];var _0x1c284d=_0x3a6726?_0x4556c7[_0xfb77('0x1f')]:_0x5a1665[_0xfb77('0x1d')]+_0x5a1665[_0xfb77('0x20')];var _0x2b0249;if(_0x1c284d>=_0x1437d2){_0x1c284d=_0x1437d2;_0x2b0249=0xc8;}else{_0x2b0249=0xce;}_0x2aee48[_0xfb77('0x1a')](_0x2b0249);return _0x2aee48[_0xfb77('0x21')](_0xfb77('0x22'),_0x42d868+'-'+_0x1c284d+'/'+_0x1437d2)[_0xfb77('0x1c')](_0x4556c7);}return null;};}function patchUpdates(_0xd43076){return function(_0x4d4457){try{jsonpatch[_0xfb77('0x23')](_0x4d4457,_0xd43076,!![]);}catch(_0x5cc40b){return BPromise[_0xfb77('0x24')](_0x5cc40b);}return _0x4d4457[_0xfb77('0x25')]();};}function saveUpdates(_0x34c1f9,_0x3d6419){return function(_0x4abefc){if(_0x4abefc){return _0x4abefc['update'](_0x34c1f9)[_0xfb77('0x26')](function(_0x3ceb55){return _0x3ceb55;});}return null;};}function removeEntity(_0x4516e5,_0x3c27c9){return function(_0x3694cd){if(_0x3694cd){return _0x3694cd['destroy']()[_0xfb77('0x26')](function(){var _0x1f969a=_0x3694cd['get']({'plain':!![]});var _0x2313e8=_0xfb77('0x27');return db[_0xfb77('0x28')][_0xfb77('0x29')]({'where':{'type':_0x2313e8,'resourceId':_0x1f969a['id']}})[_0xfb77('0x26')](function(){return _0x3694cd;});})['then'](function(){_0x4516e5[_0xfb77('0x1a')](0xcc)[_0xfb77('0x1b')]();});}};}function handleEntityNotFound(_0x11e2a6,_0x24e6f0){return function(_0x59654b){if(!_0x59654b){_0x11e2a6[_0xfb77('0x19')](0x194);}return _0x59654b;};}function handleError(_0x17133d,_0x571c05){_0x571c05=_0x571c05||0x1f4;return function(_0x5d6975){logger[_0xfb77('0x2a')](_0x5d6975['stack']);if(_0x5d6975[_0xfb77('0x2b')]){delete _0x5d6975[_0xfb77('0x2b')];}_0x17133d[_0xfb77('0x1a')](_0x571c05)[_0xfb77('0x2c')](_0x5d6975);};}exports[_0xfb77('0x2d')]=function(_0x34ccbf,_0x5ea3a9){var _0x311d93={},_0x3d7d3c={},_0xa28f5e={'count':0x0,'rows':[]};var _0x1ed580=_[_0xfb77('0x2e')](db[_0xfb77('0x2f')][_0xfb77('0x30')],function(_0x315ca8){return{'name':_0x315ca8[_0xfb77('0x31')],'type':_0x315ca8[_0xfb77('0x32')][_0xfb77('0x33')]};});_0x3d7d3c['model']=_[_0xfb77('0x2e')](_0x1ed580,'name');_0x3d7d3c['query']=_['keys'](_0x34ccbf[_0xfb77('0x34')]);_0x3d7d3c[_0xfb77('0x35')]=_[_0xfb77('0x36')](_0x3d7d3c[_0xfb77('0x37')],_0x3d7d3c[_0xfb77('0x34')]);_0x311d93[_0xfb77('0x38')]=_[_0xfb77('0x36')](_0x3d7d3c['model'],qs[_0xfb77('0x39')](_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x39')]));_0x311d93[_0xfb77('0x38')]=_0x311d93[_0xfb77('0x38')]['length']?_0x311d93[_0xfb77('0x38')]:_0x3d7d3c['model'];if(!_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x3a')](_0xfb77('0x3b'))){_0x311d93[_0xfb77('0x20')]=qs[_0xfb77('0x20')](_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x20')]);_0x311d93[_0xfb77('0x1d')]=qs[_0xfb77('0x1d')](_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x1d')]);}_0x311d93[_0xfb77('0x3c')]=qs[_0xfb77('0x3d')](_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x3d')]);_0x311d93[_0xfb77('0x3e')]=qs[_0xfb77('0x35')](_[_0xfb77('0x3f')](_0x34ccbf[_0xfb77('0x34')],_0x3d7d3c[_0xfb77('0x35')]),_0x1ed580);if(_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x40')]){_0x311d93['where']=_['merge'](_0x311d93[_0xfb77('0x3e')],{'$or':_['map'](_0x1ed580,function(_0x4a4e2b){if(_0x4a4e2b['type']!==_0xfb77('0x41')){var _0x21e192={};_0x21e192[_0x4a4e2b[_0xfb77('0x2b')]]={'$like':'%'+_0x34ccbf[_0xfb77('0x34')]['filter']+'%'};return _0x21e192;}})});}_0x311d93=_['merge']({},_0x311d93,_0x34ccbf[_0xfb77('0x42')]);var _0x122eef={'where':_0x311d93[_0xfb77('0x3e')]};return db['SquareOdbc']['count'](_0x122eef)[_0xfb77('0x26')](function(_0x29b3e0){_0xa28f5e[_0xfb77('0x1f')]=_0x29b3e0;if(_0x34ccbf[_0xfb77('0x34')][_0xfb77('0x43')]){_0x311d93[_0xfb77('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0xfb77('0x45')](_0x311d93);})['then'](function(_0x5e07af){_0xa28f5e[_0xfb77('0x46')]=_0x5e07af;return _0xa28f5e;})[_0xfb77('0x26')](respondWithFilteredResult(_0x5ea3a9,_0x311d93))[_0xfb77('0x47')](handleError(_0x5ea3a9,null));};exports[_0xfb77('0x48')]=function(_0xfb3443,_0x55d666){var _0x29fa09={'raw':!![],'where':{'id':_0xfb3443[_0xfb77('0x49')]['id']}},_0x3c9e39={};_0x3c9e39[_0xfb77('0x37')]=_[_0xfb77('0x4a')](db[_0xfb77('0x2f')][_0xfb77('0x30')]);_0x3c9e39[_0xfb77('0x34')]=_[_0xfb77('0x4a')](_0xfb3443[_0xfb77('0x34')]);_0x3c9e39[_0xfb77('0x35')]=_[_0xfb77('0x36')](_0x3c9e39[_0xfb77('0x37')],_0x3c9e39[_0xfb77('0x34')]);_0x29fa09[_0xfb77('0x38')]=_[_0xfb77('0x36')](_0x3c9e39['model'],qs[_0xfb77('0x39')](_0xfb3443[_0xfb77('0x34')][_0xfb77('0x39')]));_0x29fa09[_0xfb77('0x38')]=_0x29fa09['attributes'][_0xfb77('0x4b')]?_0x29fa09['attributes']:_0x3c9e39[_0xfb77('0x37')];if(_0xfb3443[_0xfb77('0x34')][_0xfb77('0x43')]){_0x29fa09[_0xfb77('0x44')]=[{'all':!![]}];}_0x29fa09=_[_0xfb77('0x4c')]({},_0x29fa09,_0xfb3443['options']);return db[_0xfb77('0x2f')][_0xfb77('0x4d')](_0x29fa09)['then'](handleEntityNotFound(_0x55d666,null))[_0xfb77('0x26')](respondWithResult(_0x55d666,null))[_0xfb77('0x47')](handleError(_0x55d666,null));};exports[_0xfb77('0x4e')]=function(_0x5f40bd,_0x180ae7){return db[_0xfb77('0x2f')][_0xfb77('0x4e')](_0x5f40bd[_0xfb77('0x4f')],{})[_0xfb77('0x26')](function(_0x17d425){var _0xc0c459=_0x5f40bd['user'][_0xfb77('0x50')]({'plain':!![]});if(!_0xc0c459)throw new Error(_0xfb77('0x51'));if(_0xc0c459[_0xfb77('0x52')]===_0xfb77('0x53')){var _0x179637=_0x17d425[_0xfb77('0x50')]({'plain':!![]});var _0x97012='ODBC';return db[_0xfb77('0x54')][_0xfb77('0x4d')]({'where':{'name':_0x97012,'userProfileId':_0xc0c459['userProfileId']},'raw':!![]})[_0xfb77('0x26')](function(_0x2983c4){if(_0x2983c4&&_0x2983c4[_0xfb77('0x55')]===0x0){return db['UserProfileResource'][_0xfb77('0x4e')]({'name':_0x179637[_0xfb77('0x2b')],'resourceId':_0x179637['id'],'type':_0x2983c4['name'],'sectionId':_0x2983c4['id']},{})[_0xfb77('0x26')](function(){return _0x17d425;});}else{return _0x17d425;}})[_0xfb77('0x47')](function(_0x1737e0){logger['error'](_0xfb77('0x56'),_0x1737e0);throw _0x1737e0;});}return _0x17d425;})['then'](respondWithResult(_0x180ae7,0xc9))[_0xfb77('0x47')](handleError(_0x180ae7,null));};exports['update']=function(_0xd35dc2,_0x380c07){if(_0xd35dc2[_0xfb77('0x4f')]['id']){delete _0xd35dc2[_0xfb77('0x4f')]['id'];}return db[_0xfb77('0x2f')][_0xfb77('0x4d')]({'where':{'id':_0xd35dc2[_0xfb77('0x49')]['id']}})['then'](handleEntityNotFound(_0x380c07,null))[_0xfb77('0x26')](saveUpdates(_0xd35dc2['body'],null))[_0xfb77('0x26')](respondWithResult(_0x380c07,null))[_0xfb77('0x47')](handleError(_0x380c07,null));};exports[_0xfb77('0x29')]=function(_0x518cec,_0x3e2724){return db[_0xfb77('0x2f')]['find']({'where':{'id':_0x518cec[_0xfb77('0x49')]['id']}})[_0xfb77('0x26')](handleEntityNotFound(_0x3e2724,null))[_0xfb77('0x26')](removeEntity(_0x3e2724,null))['catch'](handleError(_0x3e2724,null));};exports['test']=function(_0x46c190,_0x3df657,_0x159067){var _0x453c43;return db[_0xfb77('0x2f')][_0xfb77('0x4d')]({'where':{'id':_0x46c190[_0xfb77('0x49')]['id']},'attributes':['id',_0xfb77('0x57')]})[_0xfb77('0x26')](handleEntityNotFound(_0x3df657,null))[_0xfb77('0x26')](function(_0x242a23){if(_0x242a23){var _0x56828b=require(_0xfb77('0x58'))();_0x56828b[_0xfb77('0x59')](_0x242a23[_0xfb77('0x57')]);_0x56828b[_0xfb77('0x5a')]();return _0x242a23;}})['then'](respondWithResult(_0x3df657,null))['catch'](handleError(_0x3df657,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 33b4e9e..174e3de 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 _0x573d=['bluebird','request-promise','path','rimraf','../../config/environment','define','SquareOdbc','square_odbc','util','../../config/logger','api'];(function(_0x3beb04,_0x2e6c4f){var _0x188a35=function(_0x191c6e){while(--_0x191c6e){_0x3beb04['push'](_0x3beb04['shift']());}};_0x188a35(++_0x2e6c4f);}(_0x573d,0x189));var _0xd573=function(_0x4777ee,_0x42674d){_0x4777ee=_0x4777ee-0x0;var _0x1b637f=_0x573d[_0x4777ee];return _0x1b637f;};'use strict';var _=require('lodash');var util=require(_0xd573('0x0'));var logger=require(_0xd573('0x1'))(_0xd573('0x2'));var moment=require('moment');var BPromise=require(_0xd573('0x3'));var rp=require(_0xd573('0x4'));var fs=require('fs');var path=require(_0xd573('0x5'));var rimraf=require(_0xd573('0x6'));var config=require(_0xd573('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x440d66,_0x315afc){return _0x440d66[_0xd573('0x8')](_0xd573('0x9'),attributes,{'tableName':_0xd573('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6223=['moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api'];(function(_0x194da4,_0x5ae2b5){var _0x12236a=function(_0x18bb45){while(--_0x18bb45){_0x194da4['push'](_0x194da4['shift']());}};_0x12236a(++_0x5ae2b5);}(_0x6223,0x8b));var _0x3622=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x6223[_0x5bf2b3];return _0x5e8a9b;};'use strict';var _=require(_0x3622('0x0'));var util=require(_0x3622('0x1'));var logger=require(_0x3622('0x2'))(_0x3622('0x3'));var moment=require(_0x3622('0x4'));var BPromise=require(_0x3622('0x5'));var rp=require(_0x3622('0x6'));var fs=require('fs');var path=require(_0x3622('0x7'));var rimraf=require(_0x3622('0x8'));var config=require('../../config/environment');var attributes=require(_0x3622('0x9'));module['exports']=function(_0x2f94bd,_0x102742){return _0x2f94bd[_0x3622('0xa')](_0x3622('0xb'),attributes,{'tableName':_0x3622('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 bff17de..fbeb60f 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 _0x016a=['model','ShowSquareOdbc','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','SquareOdbc','options','raw','where','include','map','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x016a,0x196));var _0xa016=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x016a[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xa016('0x0'));var util=require(_0xa016('0x1'));var moment=require(_0xa016('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa016('0x3'));var db=require(_0xa016('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa016('0x5'))(_0xa016('0x6'));var config=require(_0xa016('0x7'));var jayson=require(_0xa016('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xed3e90,_0x59f2ca,_0x5b0ffa){return new BPromise(function(_0x55e76d,_0x526eab){return client[_0xa016('0x9')](_0xed3e90,_0x5b0ffa)[_0xa016('0xa')](function(_0x431fff){logger[_0xa016('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x59f2ca,'request\x20sent');logger['debug'](_0xa016('0xc'),_0x59f2ca,_0xa016('0xd'),JSON[_0xa016('0xe')](_0x431fff));if(_0x431fff['error']){if(_0x431fff['error'][_0xa016('0xf')]===0x1f4){logger[_0xa016('0x10')](_0xa016('0x11'),_0x59f2ca,_0x431fff[_0xa016('0x10')][_0xa016('0x12')]);return _0x526eab(_0x431fff['error'][_0xa016('0x12')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x59f2ca,_0x431fff[_0xa016('0x10')][_0xa016('0x12')]);return _0x55e76d(_0x431fff[_0xa016('0x10')][_0xa016('0x12')]);}else{logger[_0xa016('0xb')](_0xa016('0x11'),_0x59f2ca,_0xa016('0xd'));_0x55e76d(_0x431fff[_0xa016('0x13')][_0xa016('0x12')]);}})[_0xa016('0x14')](function(_0x24d2fd){logger[_0xa016('0x10')](_0xa016('0x11'),_0x59f2ca,_0x24d2fd);_0x526eab(_0x24d2fd);});});}exports['ShowSquareOdbc']=function(_0x3a700c){var _0x3f8945=this;return new Promise(function(_0x398914,_0x49c25e){return db[_0xa016('0x15')]['find']({'raw':_0x3a700c['options']?_0x3a700c[_0xa016('0x16')][_0xa016('0x17')]===undefined?!![]:![]:!![],'where':_0x3a700c[_0xa016('0x16')]?_0x3a700c[_0xa016('0x16')][_0xa016('0x18')]||null:null,'attributes':_0x3a700c[_0xa016('0x16')]?_0x3a700c[_0xa016('0x16')]['attributes']||null:null,'include':_0x3a700c[_0xa016('0x16')]?_0x3a700c[_0xa016('0x16')][_0xa016('0x19')]?_[_0xa016('0x1a')](_0x3a700c[_0xa016('0x16')]['include'],function(_0x42d4ca){return{'model':db[_0x42d4ca['model']],'as':_0x42d4ca['as'],'attributes':_0x42d4ca[_0xa016('0x1b')],'include':_0x42d4ca[_0xa016('0x19')]?_['map'](_0x42d4ca[_0xa016('0x19')],function(_0x2958bc){return{'model':db[_0x2958bc[_0xa016('0x1c')]],'as':_0x2958bc['as'],'attributes':_0x2958bc[_0xa016('0x1b')],'include':_0x2958bc[_0xa016('0x19')]?_[_0xa016('0x1a')](_0x2958bc['include'],function(_0x1dd87a){return{'model':db[_0x1dd87a[_0xa016('0x1c')]],'as':_0x1dd87a['as'],'attributes':_0x1dd87a[_0xa016('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa016('0xa')](function(_0x283442){logger[_0xa016('0xb')](_0xa016('0x1d'),_0x3a700c);logger[_0xa016('0x1e')]('ShowSquareOdbc',_0x3a700c,JSON['stringify'](_0x283442));_0x398914(_0x283442);})[_0xa016('0x14')](function(_0x1ae54f){logger['error']('ShowSquareOdbc',_0x1ae54f[_0xa016('0x12')],_0x3a700c);_0x49c25e(_0x3f8945[_0xa016('0x10')](0x1f4,_0x1ae54f[_0xa016('0x12')]));});});}; \ No newline at end of file +var _0x188b=['SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x28fe68,_0x33a2be){var _0x58d3f9=function(_0x386f0e){while(--_0x386f0e){_0x28fe68['push'](_0x28fe68['shift']());}};_0x58d3f9(++_0x33a2be);}(_0x188b,0x1cb));var _0xb188=function(_0x890b39,_0xb62605){_0x890b39=_0x890b39-0x0;var _0x5937e4=_0x188b[_0x890b39];return _0x5937e4;};'use strict';var _=require(_0xb188('0x0'));var util=require(_0xb188('0x1'));var moment=require(_0xb188('0x2'));var BPromise=require(_0xb188('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb188('0x4'));var db=require(_0xb188('0x5'))['db'];var utils=require(_0xb188('0x6'));var logger=require(_0xb188('0x7'))(_0xb188('0x8'));var config=require(_0xb188('0x9'));var jayson=require(_0xb188('0xa'));var client=jayson[_0xb188('0xb')][_0xb188('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c3a9c,_0x262301,_0x6f596e){return new BPromise(function(_0x4e921f,_0x191ed3){return client[_0xb188('0xd')](_0x3c3a9c,_0x6f596e)[_0xb188('0xe')](function(_0x4891a2){logger[_0xb188('0xf')](_0xb188('0x10'),_0x262301,'request\x20sent');logger['debug'](_0xb188('0x11'),_0x262301,_0xb188('0x12'),JSON[_0xb188('0x13')](_0x4891a2));if(_0x4891a2['error']){if(_0x4891a2[_0xb188('0x14')][_0xb188('0x15')]===0x1f4){logger[_0xb188('0x14')](_0xb188('0x10'),_0x262301,_0x4891a2[_0xb188('0x14')][_0xb188('0x16')]);return _0x191ed3(_0x4891a2[_0xb188('0x14')][_0xb188('0x16')]);}logger[_0xb188('0x14')](_0xb188('0x10'),_0x262301,_0x4891a2[_0xb188('0x14')][_0xb188('0x16')]);return _0x4e921f(_0x4891a2[_0xb188('0x14')][_0xb188('0x16')]);}else{logger[_0xb188('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x262301,_0xb188('0x12'));_0x4e921f(_0x4891a2[_0xb188('0x17')][_0xb188('0x16')]);}})[_0xb188('0x18')](function(_0x4b791a){logger[_0xb188('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x262301,_0x4b791a);_0x191ed3(_0x4b791a);});});}exports[_0xb188('0x19')]=function(_0x29dd20){var _0x3d3562=this;return new Promise(function(_0x4ad36d,_0x43ea7f){return db['SquareOdbc'][_0xb188('0x1a')]({'raw':_0x29dd20['options']?_0x29dd20[_0xb188('0x1b')][_0xb188('0x1c')]===undefined?!![]:![]:!![],'where':_0x29dd20[_0xb188('0x1b')]?_0x29dd20[_0xb188('0x1b')][_0xb188('0x1d')]||null:null,'attributes':_0x29dd20['options']?_0x29dd20[_0xb188('0x1b')][_0xb188('0x1e')]||null:null,'include':_0x29dd20[_0xb188('0x1b')]?_0x29dd20[_0xb188('0x1b')][_0xb188('0x1f')]?_['map'](_0x29dd20['options'][_0xb188('0x1f')],function(_0x1c15a6){return{'model':db[_0x1c15a6[_0xb188('0x20')]],'as':_0x1c15a6['as'],'attributes':_0x1c15a6[_0xb188('0x1e')],'include':_0x1c15a6[_0xb188('0x1f')]?_['map'](_0x1c15a6[_0xb188('0x1f')],function(_0x58a80d){return{'model':db[_0x58a80d[_0xb188('0x20')]],'as':_0x58a80d['as'],'attributes':_0x58a80d[_0xb188('0x1e')],'include':_0x58a80d[_0xb188('0x1f')]?_['map'](_0x58a80d['include'],function(_0x4c9b4e){return{'model':db[_0x4c9b4e[_0xb188('0x20')]],'as':_0x4c9b4e['as'],'attributes':_0x4c9b4e[_0xb188('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb188('0xe')](function(_0x2f1abd){logger[_0xb188('0xf')](_0xb188('0x19'),_0x29dd20);logger[_0xb188('0x21')]('ShowSquareOdbc',_0x29dd20,JSON[_0xb188('0x13')](_0x2f1abd));_0x4ad36d(_0x2f1abd);})[_0xb188('0x18')](function(_0x1089e5){logger['error']('ShowSquareOdbc',_0x1089e5[_0xb188('0x16')],_0x29dd20);_0x43ea7f(_0x3d3562['error'](0x1f4,_0x1089e5[_0xb188('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 55b774f..29f3619 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 _0xcd1a=['create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0xcd1a,0x131));var _0xacd1=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcd1a[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var path=require(_0xacd1('0x2'));var timeout=require(_0xacd1('0x3'));var express=require(_0xacd1('0x4'));var router=express[_0xacd1('0x5')]();var fs_extra=require(_0xacd1('0x6'));var auth=require(_0xacd1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xacd1('0x8'));var controller=require(_0xacd1('0x9'));router[_0xacd1('0xa')]('/',auth[_0xacd1('0xb')](),controller[_0xacd1('0xc')]);router[_0xacd1('0xa')]('/:id',auth[_0xacd1('0xb')](),controller[_0xacd1('0xd')]);router[_0xacd1('0xe')]('/',auth[_0xacd1('0xb')](),controller[_0xacd1('0xf')]);router['put'](_0xacd1('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xacd1('0x11')]('/:id',auth[_0xacd1('0xb')](),controller[_0xacd1('0x12')]);module[_0xacd1('0x13')]=router; \ No newline at end of file +var _0x65d9=['show','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x65d9,0x1eb));var _0x965d=function(_0x48752e,_0x5e7946){_0x48752e=_0x48752e-0x0;var _0x142632=_0x65d9[_0x48752e];return _0x142632;};'use strict';var multer=require('multer');var util=require(_0x965d('0x0'));var path=require('path');var timeout=require(_0x965d('0x1'));var express=require(_0x965d('0x2'));var router=express[_0x965d('0x3')]();var fs_extra=require(_0x965d('0x4'));var auth=require(_0x965d('0x5'));var interaction=require(_0x965d('0x6'));var config=require(_0x965d('0x7'));var controller=require(_0x965d('0x8'));router[_0x965d('0x9')]('/',auth[_0x965d('0xa')](),controller[_0x965d('0xb')]);router[_0x965d('0x9')](_0x965d('0xc'),auth['isAuthenticated'](),controller[_0x965d('0xd')]);router['post']('/',auth[_0x965d('0xa')](),controller['create']);router[_0x965d('0xe')](_0x965d('0xc'),auth[_0x965d('0xa')](),controller[_0x965d('0xf')]);router[_0x965d('0x10')](_0x965d('0xc'),auth[_0x965d('0xa')](),controller['destroy']);module[_0x965d('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 73c82ec..f03ef73 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 _0xe1d7=['getDataValue','toString','utf8','production','DATE','exports','TEXT','BLOB','long','preproduction'];(function(_0x2af377,_0x1c8430){var _0x5d120a=function(_0x1a644c){while(--_0x1a644c){_0x2af377['push'](_0x2af377['shift']());}};_0x5d120a(++_0x1c8430);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x580cee,_0x189c97){_0x580cee=_0x580cee-0x0;var _0x47dfe9=_0xe1d7[_0x580cee];return _0x47dfe9;};'use strict';var Sequelize=require('sequelize');module[_0x7e1d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x7e1d('0x1')]},'preproduction':{'type':Sequelize[_0x7e1d('0x2')](_0x7e1d('0x3')),'get':function(){if(this['getDataValue'](_0x7e1d('0x4'))){return this[_0x7e1d('0x5')](_0x7e1d('0x4'))[_0x7e1d('0x6')](_0x7e1d('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x7e1d('0x3')),'get':function(){if(this[_0x7e1d('0x5')]('production')){return this[_0x7e1d('0x5')](_0x7e1d('0x8'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x7e1d('0x9')]},'publishedAt':{'type':Sequelize[_0x7e1d('0x9')]}}; \ No newline at end of file +var _0x01a6=['production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x01a6,0x162));var _0x601a=function(_0x30102a,_0x5a674b){_0x30102a=_0x30102a-0x0;var _0x2ab3d3=_0x01a6[_0x30102a];return _0x2ab3d3;};'use strict';var Sequelize=require(_0x601a('0x0'));module['exports']={'name':{'type':Sequelize[_0x601a('0x1')],'unique':_0x601a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x601a('0x1')]},'notes':{'type':Sequelize[_0x601a('0x3')]},'preproduction':{'type':Sequelize[_0x601a('0x4')]('long'),'get':function(){if(this[_0x601a('0x5')]('preproduction')){return this[_0x601a('0x5')](_0x601a('0x6'))[_0x601a('0x7')](_0x601a('0x8'));}}},'production':{'type':Sequelize[_0x601a('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x601a('0x9'))){return this[_0x601a('0x5')](_0x601a('0x9'))['toString'](_0x601a('0x8'));}}},'savedAt':{'type':Sequelize[_0x601a('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d77732e..d33d003 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 _0x3e70=['fields','length','order','sort','where','filter','merge','options','count','includeAll','findAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','pick','production','lodash','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','status','json','undefined','limit','offset','set','Content-Range','destroy','then','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model'];(function(_0x1293b8,_0x5361cd){var _0x150324=function(_0x1085ad){while(--_0x1085ad){_0x1293b8['push'](_0x1293b8['shift']());}};_0x150324(++_0x5361cd);}(_0x3e70,0x164));var _0x03e7=function(_0x56de88,_0x1ced39){_0x56de88=_0x56de88-0x0;var _0x2d079a=_0x3e70[_0x56de88];return _0x2d079a;};'use strict';var _=require(_0x03e7('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x03e7('0x1'))('api');var config=require(_0x03e7('0x2'));var db=require(_0x03e7('0x3'))['db'];config[_0x03e7('0x4')]=_[_0x03e7('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x03e7('0x6'))[_0x03e7('0x7')](socket);function respondWithResult(_0x1b9faa,_0x5d2876){_0x5d2876=_0x5d2876||0xc8;return function(_0x1f27d0){if(_0x1f27d0){return _0x1b9faa[_0x03e7('0x8')](_0x5d2876)[_0x03e7('0x9')](_0x1f27d0);}};}function respondWithFilteredResult(_0xad78b6,_0x2e0419){return function(_0x850542){if(_0x850542){var _0xc34160=typeof _0x2e0419['offset']===_0x03e7('0xa')&&typeof _0x2e0419[_0x03e7('0xb')]===_0x03e7('0xa');var _0xffcd4c=_0x850542['count'];var _0x1ef1fe=_0xc34160?0x0:_0x2e0419[_0x03e7('0xc')];var _0x20f56f=_0xc34160?_0x850542['count']:_0x2e0419['offset']+_0x2e0419[_0x03e7('0xb')];var _0x10b987;if(_0x20f56f>=_0xffcd4c){_0x20f56f=_0xffcd4c;_0x10b987=0xc8;}else{_0x10b987=0xce;}_0xad78b6[_0x03e7('0x8')](_0x10b987);return _0xad78b6[_0x03e7('0xd')](_0x03e7('0xe'),_0x1ef1fe+'-'+_0x20f56f+'/'+_0xffcd4c)[_0x03e7('0x9')](_0x850542);}return null;};}function saveUpdates(_0x5e31e4){return function(_0x362f20){if(_0x362f20){return _0x362f20['update'](_0x5e31e4)['then'](function(_0x43ee53){return _0x43ee53;});}return null;};}function removeEntity(_0x57bf43){return function(_0x3996a8){if(_0x3996a8){return _0x3996a8[_0x03e7('0xf')]()[_0x03e7('0x10')](function(){var _0x1e0d3a=_0x3996a8[_0x03e7('0x11')]({'plain':!![]});var _0x1b0e2a='SquareProjects';return db[_0x03e7('0x12')][_0x03e7('0xf')]({'where':{'type':_0x1b0e2a,'resourceId':_0x1e0d3a['id']}})[_0x03e7('0x10')](function(){return _0x3996a8;});})[_0x03e7('0x10')](function(){var _0x2662f5=new Redis(config[_0x03e7('0x4')]);_0x2662f5[_0x03e7('0x13')](_0x03e7('0x14'),JSON[_0x03e7('0x15')]({'id':_0x3996a8['id'],'deleted':!![]}));})[_0x03e7('0x10')](function(){_0x57bf43['status'](0xcc)[_0x03e7('0x16')]();});}};}function handleEntityNotFound(_0x186fed){return function(_0x5c5753){if(!_0x5c5753){_0x186fed[_0x03e7('0x17')](0x194);}return _0x5c5753;};}function handleError(_0x596517,_0x16024e){_0x16024e=_0x16024e||0x1f4;return function(_0x259e88){logger[_0x03e7('0x18')](_0x259e88[_0x03e7('0x19')]);if(_0x259e88[_0x03e7('0x1a')]){delete _0x259e88[_0x03e7('0x1a')];}_0x596517['status'](_0x16024e)[_0x03e7('0x1b')](_0x259e88);};}exports['index']=function(_0x238f42,_0x2977e3){var _0x6df0f7={},_0x5f076f={},_0xf09938={'count':0x0,'rows':[]};var _0x42e163=_[_0x03e7('0x1c')](db[_0x03e7('0x1d')][_0x03e7('0x1e')],function(_0xf92d88){return{'name':_0xf92d88[_0x03e7('0x1f')],'type':_0xf92d88[_0x03e7('0x20')][_0x03e7('0x21')]};});_0x5f076f['model']=_[_0x03e7('0x1c')](_0x42e163,_0x03e7('0x1a'));_0x5f076f[_0x03e7('0x22')]=_[_0x03e7('0x23')](_0x238f42['query']);_0x5f076f[_0x03e7('0x24')]=_[_0x03e7('0x25')](_0x5f076f['model'],_0x5f076f[_0x03e7('0x22')]);_0x6df0f7[_0x03e7('0x26')]=_[_0x03e7('0x25')](_0x5f076f[_0x03e7('0x27')],qs['fields'](_0x238f42[_0x03e7('0x22')][_0x03e7('0x28')]));_0x6df0f7[_0x03e7('0x26')]=_0x6df0f7[_0x03e7('0x26')][_0x03e7('0x29')]?_0x6df0f7[_0x03e7('0x26')]:_0x5f076f[_0x03e7('0x27')];if(!_0x238f42['query']['hasOwnProperty']('nolimit')){_0x6df0f7[_0x03e7('0xb')]=qs[_0x03e7('0xb')](_0x238f42[_0x03e7('0x22')][_0x03e7('0xb')]);_0x6df0f7[_0x03e7('0xc')]=qs['offset'](_0x238f42[_0x03e7('0x22')][_0x03e7('0xc')]);}_0x6df0f7[_0x03e7('0x2a')]=qs[_0x03e7('0x2b')](_0x238f42[_0x03e7('0x22')]['sort']);_0x6df0f7[_0x03e7('0x2c')]=qs[_0x03e7('0x24')](_['pick'](_0x238f42[_0x03e7('0x22')],_0x5f076f[_0x03e7('0x24')]),_0x42e163);if(_0x238f42[_0x03e7('0x22')][_0x03e7('0x2d')]){_0x6df0f7[_0x03e7('0x2c')]=_['merge'](_0x6df0f7[_0x03e7('0x2c')],{'$or':_['map'](_0x42e163,function(_0x240d2a){if(_0x240d2a[_0x03e7('0x20')]!=='VIRTUAL'){var _0x203015={};_0x203015[_0x240d2a[_0x03e7('0x1a')]]={'$like':'%'+_0x238f42[_0x03e7('0x22')][_0x03e7('0x2d')]+'%'};return _0x203015;}})});}_0x6df0f7=_[_0x03e7('0x2e')]({},_0x6df0f7,_0x238f42[_0x03e7('0x2f')]);var _0x3d1c70={'where':_0x6df0f7[_0x03e7('0x2c')]};return db['SquareProject'][_0x03e7('0x30')](_0x3d1c70)['then'](function(_0x76ee3d){_0xf09938['count']=_0x76ee3d;if(_0x238f42[_0x03e7('0x22')][_0x03e7('0x31')]){_0x6df0f7['include']=[{'all':!![]}];}return db['SquareProject'][_0x03e7('0x32')](_0x6df0f7);})['then'](function(_0x1664c8){_0xf09938['rows']=_0x1664c8;return _0xf09938;})[_0x03e7('0x10')](respondWithFilteredResult(_0x2977e3,_0x6df0f7))[_0x03e7('0x33')](handleError(_0x2977e3,null));};exports[_0x03e7('0x34')]=function(_0x882cb5,_0x405401){var _0x29294e={'raw':![],'where':{'id':_0x882cb5[_0x03e7('0x35')]['id']}},_0x139c4f={};_0x139c4f[_0x03e7('0x27')]=_[_0x03e7('0x23')](db[_0x03e7('0x1d')]['rawAttributes']);_0x139c4f[_0x03e7('0x22')]=_['keys'](_0x882cb5[_0x03e7('0x22')]);_0x139c4f[_0x03e7('0x24')]=_[_0x03e7('0x25')](_0x139c4f['model'],_0x139c4f[_0x03e7('0x22')]);_0x29294e[_0x03e7('0x26')]=_[_0x03e7('0x25')](_0x139c4f[_0x03e7('0x27')],qs['fields'](_0x882cb5[_0x03e7('0x22')]['fields']));_0x29294e['attributes']=_0x29294e[_0x03e7('0x26')][_0x03e7('0x29')]?_0x29294e[_0x03e7('0x26')]:_0x139c4f[_0x03e7('0x27')];if(_0x882cb5['query'][_0x03e7('0x31')]){_0x29294e[_0x03e7('0x36')]=[{'all':!![]}];}_0x29294e=_[_0x03e7('0x2e')]({},_0x29294e,_0x882cb5[_0x03e7('0x2f')]);return db[_0x03e7('0x1d')][_0x03e7('0x37')](_0x29294e)[_0x03e7('0x10')](handleEntityNotFound(_0x405401,null))[_0x03e7('0x10')](respondWithResult(_0x405401,null))[_0x03e7('0x33')](handleError(_0x405401,null));};exports['create']=function(_0x3e536b,_0x892362){return db[_0x03e7('0x1d')][_0x03e7('0x38')](_0x3e536b['body'],{})['then'](function(_0x2e3a4c){var _0x33d568=_0x3e536b[_0x03e7('0x39')][_0x03e7('0x11')]({'plain':!![]});if(!_0x33d568)throw new Error(_0x03e7('0x3a'));if(_0x33d568[_0x03e7('0x3b')]===_0x03e7('0x39')){var _0x49b94a=_0x2e3a4c[_0x03e7('0x11')]({'plain':!![]});var _0xdc2391=_0x03e7('0x3c');return db['UserProfileSection']['find']({'where':{'name':_0xdc2391,'userProfileId':_0x33d568['userProfileId']},'raw':!![]})[_0x03e7('0x10')](function(_0x424845){if(_0x424845&&_0x424845['autoAssociation']===0x0){return db[_0x03e7('0x12')][_0x03e7('0x38')]({'name':_0x49b94a[_0x03e7('0x1a')],'resourceId':_0x49b94a['id'],'type':_0x424845[_0x03e7('0x1a')],'sectionId':_0x424845['id']},{})[_0x03e7('0x10')](function(){return _0x2e3a4c;});}else{return _0x2e3a4c;}})['catch'](function(_0x4e0cf9){logger[_0x03e7('0x18')](_0x03e7('0x3d'),_0x4e0cf9);throw _0x4e0cf9;});}return _0x2e3a4c;})[_0x03e7('0x10')](respondWithResult(_0x892362,0xc9))[_0x03e7('0x33')](handleError(_0x892362,null));};exports[_0x03e7('0x3e')]=function(_0x429640,_0x19b31d){if(_0x429640[_0x03e7('0x3f')]['id']){delete _0x429640[_0x03e7('0x3f')]['id'];}return db[_0x03e7('0x1d')]['find']({'where':{'id':_0x429640['params']['id']}})['then'](handleEntityNotFound(_0x19b31d,null))[_0x03e7('0x10')](saveUpdates(_0x429640['body'],null))[_0x03e7('0x10')](function(_0x7d1bb6){if(!_0x7d1bb6)return;var _0x43e55c=_0x7d1bb6[_0x03e7('0x11')]({'plain':!![]});return _0x43e55c;})[_0x03e7('0x10')](function(_0x6e68ea){var _0x9545ff=new Redis(config[_0x03e7('0x4')]);_0x9545ff[_0x03e7('0x13')](_0x03e7('0x14'),JSON[_0x03e7('0x15')](_[_0x03e7('0x40')](_0x6e68ea,['id',_0x03e7('0x1a'),_0x03e7('0x41')])));return _0x6e68ea;})[_0x03e7('0x10')](respondWithResult(_0x19b31d,null))[_0x03e7('0x33')](handleError(_0x19b31d,null));};exports['destroy']=function(_0x150e8a,_0x43d838){return db[_0x03e7('0x1d')][_0x03e7('0x37')]({'where':{'id':_0x150e8a[_0x03e7('0x35')]['id']}})['then'](handleEntityNotFound(_0x43d838,null))[_0x03e7('0x10')](removeEntity(_0x43d838,null))[_0x03e7('0x33')](handleError(_0x43d838,null));}; \ No newline at end of file +var _0xe78b=['count','set','Content-Range','then','destroy','get','SquareProjects','publish','agi','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','params','lodash','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit'];(function(_0x703c04,_0x2f0f79){var _0x45ec70=function(_0xa987bc){while(--_0xa987bc){_0x703c04['push'](_0x703c04['shift']());}};_0x45ec70(++_0x2f0f79);}(_0xe78b,0x1a0));var _0xbe78=function(_0x22739c,_0x575983){_0x22739c=_0x22739c-0x0;var _0x5ebbca=_0xe78b[_0x22739c];return _0x5ebbca;};'use strict';var _=require(_0xbe78('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe78('0x1'))(_0xbe78('0x2'));var config=require(_0xbe78('0x3'));var db=require(_0xbe78('0x4'))['db'];config['redis']=_[_0xbe78('0x5')](config[_0xbe78('0x6')],{'host':_0xbe78('0x7'),'port':0x18eb});var socket=require(_0xbe78('0x8'))(new Redis(config[_0xbe78('0x6')]));require(_0xbe78('0x9'))[_0xbe78('0xa')](socket);function respondWithResult(_0x10d4c2,_0x142b82){_0x142b82=_0x142b82||0xc8;return function(_0xf743fc){if(_0xf743fc){return _0x10d4c2[_0xbe78('0xb')](_0x142b82)[_0xbe78('0xc')](_0xf743fc);}};}function respondWithFilteredResult(_0x2115c1,_0x19a63b){return function(_0x3cd0d6){if(_0x3cd0d6){var _0x4003c5=typeof _0x19a63b[_0xbe78('0xd')]===_0xbe78('0xe')&&typeof _0x19a63b[_0xbe78('0xf')]==='undefined';var _0x3e9dbd=_0x3cd0d6[_0xbe78('0x10')];var _0x3bb8cc=_0x4003c5?0x0:_0x19a63b[_0xbe78('0xd')];var _0x19f2fd=_0x4003c5?_0x3cd0d6[_0xbe78('0x10')]:_0x19a63b['offset']+_0x19a63b['limit'];var _0x35e941;if(_0x19f2fd>=_0x3e9dbd){_0x19f2fd=_0x3e9dbd;_0x35e941=0xc8;}else{_0x35e941=0xce;}_0x2115c1['status'](_0x35e941);return _0x2115c1[_0xbe78('0x11')](_0xbe78('0x12'),_0x3bb8cc+'-'+_0x19f2fd+'/'+_0x3e9dbd)['json'](_0x3cd0d6);}return null;};}function saveUpdates(_0x279831){return function(_0x5507fd){if(_0x5507fd){return _0x5507fd['update'](_0x279831)[_0xbe78('0x13')](function(_0x3fd621){return _0x3fd621;});}return null;};}function removeEntity(_0x494769){return function(_0x467373){if(_0x467373){return _0x467373[_0xbe78('0x14')]()[_0xbe78('0x13')](function(){var _0x23fc96=_0x467373[_0xbe78('0x15')]({'plain':!![]});var _0x48e743=_0xbe78('0x16');return db['UserProfileResource'][_0xbe78('0x14')]({'where':{'type':_0x48e743,'resourceId':_0x23fc96['id']}})[_0xbe78('0x13')](function(){return _0x467373;});})[_0xbe78('0x13')](function(){var _0xce5262=new Redis(config[_0xbe78('0x6')]);_0xce5262[_0xbe78('0x17')](_0xbe78('0x18'),JSON['stringify']({'id':_0x467373['id'],'deleted':!![]}));})[_0xbe78('0x13')](function(){_0x494769[_0xbe78('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548911){return function(_0x2c9719){if(!_0x2c9719){_0x548911['sendStatus'](0x194);}return _0x2c9719;};}function handleError(_0x2ed724,_0x230c9e){_0x230c9e=_0x230c9e||0x1f4;return function(_0x579b60){logger[_0xbe78('0x19')](_0x579b60[_0xbe78('0x1a')]);if(_0x579b60['name']){delete _0x579b60[_0xbe78('0x1b')];}_0x2ed724[_0xbe78('0xb')](_0x230c9e)[_0xbe78('0x1c')](_0x579b60);};}exports[_0xbe78('0x1d')]=function(_0x383dc1,_0x28cafc){var _0x2b29a5={},_0x466232={},_0x12dda7={'count':0x0,'rows':[]};var _0x1e4214=_[_0xbe78('0x1e')](db[_0xbe78('0x1f')][_0xbe78('0x20')],function(_0xf09533){return{'name':_0xf09533['fieldName'],'type':_0xf09533[_0xbe78('0x21')][_0xbe78('0x22')]};});_0x466232[_0xbe78('0x23')]=_['map'](_0x1e4214,_0xbe78('0x1b'));_0x466232[_0xbe78('0x24')]=_[_0xbe78('0x25')](_0x383dc1['query']);_0x466232[_0xbe78('0x26')]=_['intersection'](_0x466232[_0xbe78('0x23')],_0x466232[_0xbe78('0x24')]);_0x2b29a5['attributes']=_[_0xbe78('0x27')](_0x466232[_0xbe78('0x23')],qs[_0xbe78('0x28')](_0x383dc1[_0xbe78('0x24')][_0xbe78('0x28')]));_0x2b29a5[_0xbe78('0x29')]=_0x2b29a5['attributes'][_0xbe78('0x2a')]?_0x2b29a5[_0xbe78('0x29')]:_0x466232[_0xbe78('0x23')];if(!_0x383dc1[_0xbe78('0x24')][_0xbe78('0x2b')](_0xbe78('0x2c'))){_0x2b29a5[_0xbe78('0xf')]=qs[_0xbe78('0xf')](_0x383dc1[_0xbe78('0x24')][_0xbe78('0xf')]);_0x2b29a5[_0xbe78('0xd')]=qs['offset'](_0x383dc1[_0xbe78('0x24')][_0xbe78('0xd')]);}_0x2b29a5[_0xbe78('0x2d')]=qs[_0xbe78('0x2e')](_0x383dc1['query'][_0xbe78('0x2e')]);_0x2b29a5[_0xbe78('0x2f')]=qs[_0xbe78('0x26')](_[_0xbe78('0x30')](_0x383dc1[_0xbe78('0x24')],_0x466232[_0xbe78('0x26')]),_0x1e4214);if(_0x383dc1[_0xbe78('0x24')][_0xbe78('0x31')]){_0x2b29a5['where']=_[_0xbe78('0x32')](_0x2b29a5['where'],{'$or':_[_0xbe78('0x1e')](_0x1e4214,function(_0x538b7){if(_0x538b7[_0xbe78('0x21')]!==_0xbe78('0x33')){var _0x3316c5={};_0x3316c5[_0x538b7[_0xbe78('0x1b')]]={'$like':'%'+_0x383dc1[_0xbe78('0x24')]['filter']+'%'};return _0x3316c5;}})});}_0x2b29a5=_[_0xbe78('0x32')]({},_0x2b29a5,_0x383dc1[_0xbe78('0x34')]);var _0x5a5669={'where':_0x2b29a5['where']};return db['SquareProject'][_0xbe78('0x10')](_0x5a5669)[_0xbe78('0x13')](function(_0x4e24bf){_0x12dda7[_0xbe78('0x10')]=_0x4e24bf;if(_0x383dc1[_0xbe78('0x24')]['includeAll']){_0x2b29a5['include']=[{'all':!![]}];}return db['SquareProject'][_0xbe78('0x35')](_0x2b29a5);})[_0xbe78('0x13')](function(_0x37f559){_0x12dda7['rows']=_0x37f559;return _0x12dda7;})[_0xbe78('0x13')](respondWithFilteredResult(_0x28cafc,_0x2b29a5))['catch'](handleError(_0x28cafc,null));};exports[_0xbe78('0x36')]=function(_0x19a2e0,_0x7d8dba){var _0x15ff8c={'raw':![],'where':{'id':_0x19a2e0['params']['id']}},_0x221ccc={};_0x221ccc[_0xbe78('0x23')]=_[_0xbe78('0x25')](db[_0xbe78('0x1f')][_0xbe78('0x20')]);_0x221ccc[_0xbe78('0x24')]=_[_0xbe78('0x25')](_0x19a2e0[_0xbe78('0x24')]);_0x221ccc[_0xbe78('0x26')]=_[_0xbe78('0x27')](_0x221ccc['model'],_0x221ccc['query']);_0x15ff8c[_0xbe78('0x29')]=_['intersection'](_0x221ccc[_0xbe78('0x23')],qs[_0xbe78('0x28')](_0x19a2e0[_0xbe78('0x24')][_0xbe78('0x28')]));_0x15ff8c['attributes']=_0x15ff8c[_0xbe78('0x29')][_0xbe78('0x2a')]?_0x15ff8c['attributes']:_0x221ccc[_0xbe78('0x23')];if(_0x19a2e0[_0xbe78('0x24')][_0xbe78('0x37')]){_0x15ff8c[_0xbe78('0x38')]=[{'all':!![]}];}_0x15ff8c=_[_0xbe78('0x32')]({},_0x15ff8c,_0x19a2e0[_0xbe78('0x34')]);return db['SquareProject'][_0xbe78('0x39')](_0x15ff8c)[_0xbe78('0x13')](handleEntityNotFound(_0x7d8dba,null))[_0xbe78('0x13')](respondWithResult(_0x7d8dba,null))[_0xbe78('0x3a')](handleError(_0x7d8dba,null));};exports['create']=function(_0x4df64d,_0x3dd62c){return db['SquareProject'][_0xbe78('0x3b')](_0x4df64d[_0xbe78('0x3c')],{})['then'](function(_0x416256){var _0x33b27f=_0x4df64d[_0xbe78('0x3d')][_0xbe78('0x15')]({'plain':!![]});if(!_0x33b27f)throw new Error(_0xbe78('0x3e'));if(_0x33b27f[_0xbe78('0x3f')]===_0xbe78('0x3d')){var _0x5cc838=_0x416256[_0xbe78('0x15')]({'plain':!![]});var _0x3e32de='SquareProjects';return db[_0xbe78('0x40')]['find']({'where':{'name':_0x3e32de,'userProfileId':_0x33b27f[_0xbe78('0x41')]},'raw':!![]})[_0xbe78('0x13')](function(_0x332045){if(_0x332045&&_0x332045[_0xbe78('0x42')]===0x0){return db[_0xbe78('0x43')][_0xbe78('0x3b')]({'name':_0x5cc838['name'],'resourceId':_0x5cc838['id'],'type':_0x332045[_0xbe78('0x1b')],'sectionId':_0x332045['id']},{})[_0xbe78('0x13')](function(){return _0x416256;});}else{return _0x416256;}})[_0xbe78('0x3a')](function(_0x1fd159){logger['error'](_0xbe78('0x44'),_0x1fd159);throw _0x1fd159;});}return _0x416256;})[_0xbe78('0x13')](respondWithResult(_0x3dd62c,0xc9))['catch'](handleError(_0x3dd62c,null));};exports['update']=function(_0x3ca493,_0x4a68fb){if(_0x3ca493['body']['id']){delete _0x3ca493[_0xbe78('0x3c')]['id'];}return db['SquareProject'][_0xbe78('0x39')]({'where':{'id':_0x3ca493['params']['id']}})[_0xbe78('0x13')](handleEntityNotFound(_0x4a68fb,null))[_0xbe78('0x13')](saveUpdates(_0x3ca493[_0xbe78('0x3c')],null))['then'](function(_0x31eed6){if(!_0x31eed6)return;var _0x10b2b7=_0x31eed6[_0xbe78('0x15')]({'plain':!![]});return _0x10b2b7;})[_0xbe78('0x13')](function(_0x24c962){var _0x1a199a=new Redis(config[_0xbe78('0x6')]);_0x1a199a[_0xbe78('0x17')]('agi',JSON[_0xbe78('0x45')](_[_0xbe78('0x30')](_0x24c962,['id','name',_0xbe78('0x46')])));return _0x24c962;})[_0xbe78('0x13')](respondWithResult(_0x4a68fb,null))['catch'](handleError(_0x4a68fb,null));};exports[_0xbe78('0x14')]=function(_0x5f0e19,_0xffaddf){return db[_0xbe78('0x1f')]['find']({'where':{'id':_0x5f0e19[_0xbe78('0x47')]['id']}})[_0xbe78('0x13')](handleEntityNotFound(_0xffaddf,null))[_0xbe78('0x13')](removeEntity(_0xffaddf,null))[_0xbe78('0x3a')](handleError(_0xffaddf,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b501b71..58ec398 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 _0x9411=['save','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners'];(function(_0xe5a050,_0x3ae6b6){var _0x5a9c62=function(_0x5d966b){while(--_0x5d966b){_0xe5a050['push'](_0xe5a050['shift']());}};_0x5a9c62(++_0x3ae6b6);}(_0x9411,0x1a4));var _0x1941=function(_0x2f4d6d,_0x383e9a){_0x2f4d6d=_0x2f4d6d-0x0;var _0x244efa=_0x9411[_0x2f4d6d];return _0x244efa;};'use strict';var EventEmitter=require(_0x1941('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x1941('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1941('0x2')](0x0);var events={'afterCreate':_0x1941('0x3'),'afterUpdate':'update','afterDestroy':_0x1941('0x4')};function emitEvent(_0x19bed1){return function(_0xbe4df9,_0x6f9c60,_0x152308){SquareProjectEvents['emit'](_0x19bed1+':'+_0xbe4df9['id'],_0xbe4df9);SquareProjectEvents[_0x1941('0x5')](_0x19bed1,_0xbe4df9);_0x152308(null);};}for(var e in events){if(events[_0x1941('0x6')](e)){var event=events[e];SquareProject[_0x1941('0x7')](e,emitEvent(event));}}module[_0x1941('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xa1a0=['events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x33c69c,_0x2c9690){var _0x57e345=function(_0x351eeb){while(--_0x351eeb){_0x33c69c['push'](_0x33c69c['shift']());}};_0x57e345(++_0x2c9690);}(_0xa1a0,0x190));var _0x0a1a=function(_0x107f87,_0x2fc1b3){_0x107f87=_0x107f87-0x0;var _0x1a18fe=_0xa1a0[_0x107f87];return _0x1a18fe;};'use strict';var EventEmitter=require(_0x0a1a('0x0'));var SquareProject=require(_0x0a1a('0x1'))['db'][_0x0a1a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0a1a('0x3')](0x0);var events={'afterCreate':_0x0a1a('0x4'),'afterUpdate':'update','afterDestroy':_0x0a1a('0x5')};function emitEvent(_0x57759e){return function(_0x1caa71,_0x45f703,_0x1bb936){SquareProjectEvents['emit'](_0x57759e+':'+_0x1caa71['id'],_0x1caa71);SquareProjectEvents[_0x0a1a('0x6')](_0x57759e,_0x1caa71);_0x1bb936(null);};}for(var e in events){if(events[_0x0a1a('0x7')](e)){var event=events[e];SquareProject[_0x0a1a('0x8')](e,emitEvent(event));}}module[_0x0a1a('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 2c5cb47..6119103 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 _0xaf89=['changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','SquareProject','square_projects'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xaf89,0xb6));var _0x9af8=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xaf89[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9af8('0x0'))(_0x9af8('0x1'));var moment=require(_0x9af8('0x2'));var BPromise=require(_0x9af8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9af8('0x4'));var config=require(_0x9af8('0x5'));var attributes=require('./squareProject.attributes');module[_0x9af8('0x6')]=function(_0xa9aaa2,_0x3a05bb){return _0xa9aaa2[_0x9af8('0x7')](_0x9af8('0x8'),attributes,{'tableName':_0x9af8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53fcb0,_0x8aed62,_0x475128){if(_0x53fcb0[_0x9af8('0xa')](_0x9af8('0xb'))){_0x53fcb0[_0x9af8('0xc')]=moment()['format'](_0x9af8('0xd'));}if(_0x53fcb0['changed'](_0x9af8('0xe'))){_0x53fcb0[_0x9af8('0xf')]=moment()['format'](_0x9af8('0xd'));}_0x475128(null,_0x53fcb0);}}});}; \ No newline at end of file +var _0x5d53=['format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction'];(function(_0x3f62ae,_0x43b968){var _0x3cf725=function(_0x220c5f){while(--_0x220c5f){_0x3f62ae['push'](_0x3f62ae['shift']());}};_0x3cf725(++_0x43b968);}(_0x5d53,0xe3));var _0x35d5=function(_0x5ebe63,_0x2956bc){_0x5ebe63=_0x5ebe63-0x0;var _0x1f91ee=_0x5d53[_0x5ebe63];return _0x1f91ee;};'use strict';var _=require(_0x35d5('0x0'));var util=require('util');var logger=require(_0x35d5('0x1'))(_0x35d5('0x2'));var moment=require(_0x35d5('0x3'));var BPromise=require(_0x35d5('0x4'));var rp=require(_0x35d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35d5('0x6'));var config=require(_0x35d5('0x7'));var attributes=require(_0x35d5('0x8'));module['exports']=function(_0x3cb5f7,_0x46935a){return _0x3cb5f7[_0x35d5('0x9')]('SquareProject',attributes,{'tableName':_0x35d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x596be2,_0x97cc9f,_0x52e358){if(_0x596be2[_0x35d5('0xb')](_0x35d5('0xc'))){_0x596be2['savedAt']=moment()[_0x35d5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x596be2['changed']('production')){_0x596be2[_0x35d5('0xe')]=moment()[_0x35d5('0xd')](_0x35d5('0xf'));}_0x52e358(null,_0x596be2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b48162a..bebdc7e 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 _0x82cd=['SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','message','error','find','ShowSquareProject','stringify','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x82cd,0x1f3));var _0xd82c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x82cd[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xd82c('0x0'));var Redis=require(_0xd82c('0x1'));var db=require(_0xd82c('0x2'))['db'];var logger=require(_0xd82c('0x3'))('rpc');var config=require(_0xd82c('0x4'));config[_0xd82c('0x5')]=_['defaults'](config[_0xd82c('0x5')],{'host':_0xd82c('0x6'),'port':0x18eb});var socket=require(_0xd82c('0x7'))(new Redis(config[_0xd82c('0x5')]));require(_0xd82c('0x8'))[_0xd82c('0x9')](socket);exports[_0xd82c('0xa')]=function(_0x1703ef){var _0x465076=this;return new Promise(function(_0x54aa61,_0x2f1cd1){return db[_0xd82c('0xb')][_0xd82c('0xc')]({'raw':_0x1703ef[_0xd82c('0xd')]?_0x1703ef[_0xd82c('0xd')][_0xd82c('0xe')]===undefined?!![]:![]:!![],'where':_0x1703ef[_0xd82c('0xd')]?_0x1703ef[_0xd82c('0xd')][_0xd82c('0xf')]||null:null,'attributes':_0x1703ef[_0xd82c('0xd')]?_0x1703ef[_0xd82c('0xd')][_0xd82c('0x10')]||null:null,'limit':_0x1703ef[_0xd82c('0xd')]?_0x1703ef['options'][_0xd82c('0x11')]||null:null,'include':_0x1703ef[_0xd82c('0xd')]?_0x1703ef[_0xd82c('0xd')][_0xd82c('0x12')]?_[_0xd82c('0x13')](_0x1703ef['options'][_0xd82c('0x12')],function(_0x4b037a){return{'model':db[_0x4b037a['model']],'as':_0x4b037a['as'],'attributes':_0x4b037a[_0xd82c('0x10')],'include':_0x4b037a[_0xd82c('0x12')]?_[_0xd82c('0x13')](_0x4b037a[_0xd82c('0x12')],function(_0x152d09){return{'model':db[_0x152d09['model']],'as':_0x152d09['as'],'attributes':_0x152d09[_0xd82c('0x10')],'include':_0x152d09[_0xd82c('0x12')]?_[_0xd82c('0x13')](_0x152d09[_0xd82c('0x12')],function(_0x16cfd1){return{'model':db[_0x16cfd1[_0xd82c('0x14')]],'as':_0x16cfd1['as'],'attributes':_0x16cfd1[_0xd82c('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd82c('0x15')](function(_0x3f99db){logger[_0xd82c('0x16')](_0xd82c('0xa'),_0x1703ef);logger[_0xd82c('0x17')](_0xd82c('0xa'),_0x1703ef,JSON['stringify'](_0x3f99db));_0x54aa61(_0x3f99db);})[_0xd82c('0x18')](function(_0x529514){logger['error'](_0xd82c('0xa'),_0x529514[_0xd82c('0x19')],_0x1703ef);_0x2f1cd1(_0x465076[_0xd82c('0x1a')](0x1f4,_0x529514[_0xd82c('0x19')]));});});};exports['ShowSquareProject']=function(_0x34b431){var _0x37912e=this;return new Promise(function(_0x44502a,_0x37627b){return db['SquareProject'][_0xd82c('0x1b')]({'raw':_0x34b431[_0xd82c('0xd')]?_0x34b431[_0xd82c('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x34b431[_0xd82c('0xd')]?_0x34b431['options'][_0xd82c('0xf')]||null:null,'attributes':_0x34b431[_0xd82c('0xd')]?_0x34b431[_0xd82c('0xd')][_0xd82c('0x10')]||null:null,'include':_0x34b431[_0xd82c('0xd')]?_0x34b431['options'][_0xd82c('0x12')]?_['map'](_0x34b431[_0xd82c('0xd')][_0xd82c('0x12')],function(_0x2e15c4){return{'model':db[_0x2e15c4[_0xd82c('0x14')]],'as':_0x2e15c4['as'],'attributes':_0x2e15c4['attributes'],'include':_0x2e15c4[_0xd82c('0x12')]?_[_0xd82c('0x13')](_0x2e15c4[_0xd82c('0x12')],function(_0x1a977f){return{'model':db[_0x1a977f[_0xd82c('0x14')]],'as':_0x1a977f['as'],'attributes':_0x1a977f[_0xd82c('0x10')],'include':_0x1a977f['include']?_[_0xd82c('0x13')](_0x1a977f[_0xd82c('0x12')],function(_0x26265b){return{'model':db[_0x26265b[_0xd82c('0x14')]],'as':_0x26265b['as'],'attributes':_0x26265b[_0xd82c('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17f07){logger[_0xd82c('0x16')](_0xd82c('0x1c'),_0x34b431);logger[_0xd82c('0x17')](_0xd82c('0x1c'),_0x34b431,JSON[_0xd82c('0x1d')](_0x17f07));_0x44502a(_0x17f07);})[_0xd82c('0x18')](function(_0x1a2f5c){logger[_0xd82c('0x1a')](_0xd82c('0x1c'),_0x1a2f5c[_0xd82c('0x19')],_0x34b431);_0x37627b(_0x37912e[_0xd82c('0x1a')](0x1f4,_0x1a2f5c[_0xd82c('0x19')]));});});}; \ No newline at end of file +var _0x0233=['raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x1ee6be,_0x5a40dd){var _0x5b95e4=function(_0xf4f846){while(--_0xf4f846){_0x1ee6be['push'](_0x1ee6be['shift']());}};_0x5b95e4(++_0x5a40dd);}(_0x0233,0xb7));var _0x3023=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0233[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x3023('0x0'));var Redis=require(_0x3023('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x3023('0x2'))('rpc');var config=require(_0x3023('0x3'));config[_0x3023('0x4')]=_[_0x3023('0x5')](config[_0x3023('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x3023('0x6'))(new Redis(config['redis']));require(_0x3023('0x7'))[_0x3023('0x8')](socket);exports[_0x3023('0x9')]=function(_0x11cb66){var _0x47163e=this;return new Promise(function(_0x1bd204,_0x216a7d){return db[_0x3023('0xa')][_0x3023('0xb')]({'raw':_0x11cb66[_0x3023('0xc')]?_0x11cb66[_0x3023('0xc')][_0x3023('0xd')]===undefined?!![]:![]:!![],'where':_0x11cb66[_0x3023('0xc')]?_0x11cb66[_0x3023('0xc')][_0x3023('0xe')]||null:null,'attributes':_0x11cb66[_0x3023('0xc')]?_0x11cb66[_0x3023('0xc')][_0x3023('0xf')]||null:null,'limit':_0x11cb66['options']?_0x11cb66[_0x3023('0xc')][_0x3023('0x10')]||null:null,'include':_0x11cb66[_0x3023('0xc')]?_0x11cb66[_0x3023('0xc')][_0x3023('0x11')]?_[_0x3023('0x12')](_0x11cb66[_0x3023('0xc')]['include'],function(_0x74f4b2){return{'model':db[_0x74f4b2[_0x3023('0x13')]],'as':_0x74f4b2['as'],'attributes':_0x74f4b2['attributes'],'include':_0x74f4b2[_0x3023('0x11')]?_[_0x3023('0x12')](_0x74f4b2['include'],function(_0x131a19){return{'model':db[_0x131a19[_0x3023('0x13')]],'as':_0x131a19['as'],'attributes':_0x131a19[_0x3023('0xf')],'include':_0x131a19[_0x3023('0x11')]?_[_0x3023('0x12')](_0x131a19['include'],function(_0x446662){return{'model':db[_0x446662[_0x3023('0x13')]],'as':_0x446662['as'],'attributes':_0x446662[_0x3023('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3023('0x14')](function(_0x45ff94){logger[_0x3023('0x15')](_0x3023('0x9'),_0x11cb66);logger[_0x3023('0x16')]('GetSquareProjects',_0x11cb66,JSON[_0x3023('0x17')](_0x45ff94));_0x1bd204(_0x45ff94);})[_0x3023('0x18')](function(_0x26f4f6){logger[_0x3023('0x19')]('GetSquareProjects',_0x26f4f6[_0x3023('0x1a')],_0x11cb66);_0x216a7d(_0x47163e[_0x3023('0x19')](0x1f4,_0x26f4f6[_0x3023('0x1a')]));});});};exports[_0x3023('0x1b')]=function(_0x58cb55){var _0x29071c=this;return new Promise(function(_0x1c7c86,_0x2b7dc4){return db[_0x3023('0xa')]['find']({'raw':_0x58cb55[_0x3023('0xc')]?_0x58cb55['options'][_0x3023('0xd')]===undefined?!![]:![]:!![],'where':_0x58cb55[_0x3023('0xc')]?_0x58cb55['options'][_0x3023('0xe')]||null:null,'attributes':_0x58cb55[_0x3023('0xc')]?_0x58cb55[_0x3023('0xc')][_0x3023('0xf')]||null:null,'include':_0x58cb55[_0x3023('0xc')]?_0x58cb55[_0x3023('0xc')][_0x3023('0x11')]?_[_0x3023('0x12')](_0x58cb55[_0x3023('0xc')][_0x3023('0x11')],function(_0x8bf698){return{'model':db[_0x8bf698[_0x3023('0x13')]],'as':_0x8bf698['as'],'attributes':_0x8bf698[_0x3023('0xf')],'include':_0x8bf698[_0x3023('0x11')]?_[_0x3023('0x12')](_0x8bf698[_0x3023('0x11')],function(_0x1e42e6){return{'model':db[_0x1e42e6[_0x3023('0x13')]],'as':_0x1e42e6['as'],'attributes':_0x1e42e6['attributes'],'include':_0x1e42e6[_0x3023('0x11')]?_[_0x3023('0x12')](_0x1e42e6[_0x3023('0x11')],function(_0x29f4eb){return{'model':db[_0x29f4eb[_0x3023('0x13')]],'as':_0x29f4eb['as'],'attributes':_0x29f4eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x3023('0x14')](function(_0x32e89b){logger['info'](_0x3023('0x1b'),_0x58cb55);logger[_0x3023('0x16')](_0x3023('0x1b'),_0x58cb55,JSON[_0x3023('0x17')](_0x32e89b));_0x1c7c86(_0x32e89b);})['catch'](function(_0x25074d){logger['error']('ShowSquareProject',_0x25074d[_0x3023('0x1a')],_0x58cb55);_0x2b7dc4(_0x29071c[_0x3023('0x19')](0x1f4,_0x25074d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fadad38..ccddd16 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 _0xb74b=['update','emit','removeListener','squareProject:','remove'];(function(_0x7fa68c,_0x15b930){var _0x5d3be2=function(_0x1fbc26){while(--_0x1fbc26){_0x7fa68c['push'](_0x7fa68c['shift']());}};_0x5d3be2(++_0x15b930);}(_0xb74b,0x171));var _0xbb74=function(_0x2e8b77,_0x5d473c){_0x2e8b77=_0x2e8b77-0x0;var _0xe01d2b=_0xb74b[_0x2e8b77];return _0xe01d2b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xbb74('0x0'),_0xbb74('0x1')];function createListener(_0x20ba3f,_0x5616db){return function(_0x24d83c){_0x5616db[_0xbb74('0x2')](_0x20ba3f,_0x24d83c);};}function removeListener(_0x5aa71b,_0xdb94f3){return function(){SquareProjectEvents[_0xbb74('0x3')](_0x5aa71b,_0xdb94f3);};}exports['register']=function(_0x24848f){for(var _0x695e12=0x0,_0x2906b6=events['length'];_0x695e12<_0x2906b6;_0x695e12++){var _0x40ec06=events[_0x695e12];var _0x3351f5=createListener(_0xbb74('0x4')+_0x40ec06,_0x24848f);SquareProjectEvents['on'](_0x40ec06,_0x3351f5);}}; \ No newline at end of file +var _0xcd1a=['update','removeListener','register','squareProject:','./squareProject.events','save','remove'];(function(_0x408631,_0x307b5d){var _0x574f62=function(_0x32a067){while(--_0x32a067){_0x408631['push'](_0x408631['shift']());}};_0x574f62(++_0x307b5d);}(_0xcd1a,0xf2));var _0xacd1=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcd1a[_0x17b6e3];return _0x3906f3;};'use strict';var SquareProjectEvents=require(_0xacd1('0x0'));var events=[_0xacd1('0x1'),_0xacd1('0x2'),_0xacd1('0x3')];function createListener(_0x415943,_0x335137){return function(_0xb35cb9){_0x335137['emit'](_0x415943,_0xb35cb9);};}function removeListener(_0x4b4c59,_0x4ece3e){return function(){SquareProjectEvents[_0xacd1('0x4')](_0x4b4c59,_0x4ece3e);};}exports[_0xacd1('0x5')]=function(_0x346216){for(var _0x1d50bf=0x0,_0x2e1425=events['length'];_0x1d50bf<_0x2e1425;_0x1d50bf++){var _0x274214=events[_0x1d50bf];var _0x3697c0=createListener(_0xacd1('0x6')+_0x274214,_0x346216);SquareProjectEvents['on'](_0x274214,_0x3697c0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 69fd3c3..70908fc 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x3be6b9,_0xdcccf3){var _0x565915=function(_0x3eafce){while(--_0x3eafce){_0x3be6b9['push'](_0x3be6b9['shift']());}};_0x565915(++_0xdcccf3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5d7eda,_0x5f737b){_0x5d7eda=_0x5d7eda-0x0;var _0x527626=_0x7fbe[_0x5d7eda];return _0x527626;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _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(_0x2d1fc5,_0x12b894){var _0x406fc5=function(_0x27fe4f){while(--_0x27fe4f){_0x2d1fc5['push'](_0x2d1fc5['shift']());}};_0x406fc5(++_0x12b894);}(_0x4975,0x86));var _0x5497=function(_0x5f4a1c,_0x1b908e){_0x5f4a1c=_0x5f4a1c-0x0;var _0x58f6ef=_0x4975[_0x5f4a1c];return _0x58f6ef;};'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 02a52c7..9dfd30e 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 _0xabce=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xabce,0x103));var _0xeabc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xabce[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'callerid':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'dnid':{'type':Sequelize[_0xeabc('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xeabc('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeabc('0x3')],'get':function(){var _0x52ede8='';var _0x3bdc29=this[_0xeabc('0x4')](_0xeabc('0x5'));if(_0x3bdc29){_0x52ede8=_0x3bdc29['substring'](_0x3bdc29[_0xeabc('0x6')]('.'));}return _0x52ede8;}}}; \ No newline at end of file +var _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x6dd6d9,_0x3e0758){var _0x306df7=function(_0x2da407){while(--_0x2da407){_0x6dd6d9['push'](_0x6dd6d9['shift']());}};_0x306df7(++_0x3e0758);}(_0x31f0,0xb7));var _0x031f=function(_0x4c1a2d,_0x5b6639){_0x4c1a2d=_0x4c1a2d-0x0;var _0x3539bd=_0x31f0[_0x4c1a2d];return _0x3539bd;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8c9abfd..5edcf62 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 _0x1a39=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','nolimit','sort','where','filter','merge','type','options','includeAll','include','SquareRecording','findAll','rows','show','keys','length','find','catch','create','body','update','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x1a39,0x15d));var _0x91a3=function(_0x2a6803,_0x5ab808){_0x2a6803=_0x2a6803-0x0;var _0x5291e7=_0x1a39[_0x2a6803];return _0x5291e7;};'use strict';var emlformat=require(_0x91a3('0x0'));var rimraf=require(_0x91a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91a3('0x2'));var rp=require('request-promise');var moment=require(_0x91a3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91a3('0x4'));var path=require(_0x91a3('0x5'));var sox=require(_0x91a3('0x6'));var csv=require('to-csv');var ejs=require(_0x91a3('0x7'));var fs=require('fs');var fs_extra=require(_0x91a3('0x8'));var _=require('lodash');var squel=require(_0x91a3('0x9'));var crypto=require(_0x91a3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x91a3('0xb'));var querystring=require(_0x91a3('0xc'));var Papa=require(_0x91a3('0xd'));var Redis=require('ioredis');var authService=require(_0x91a3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x91a3('0xf'));var hardwareService=require(_0x91a3('0x10'));var logger=require('../../config/logger')(_0x91a3('0x11'));var utils=require(_0x91a3('0x12'));var config=require(_0x91a3('0x13'));var licenseUtil=require(_0x91a3('0x14'));var db=require(_0x91a3('0x15'))['db'];function respondWithStatusCode(_0x4d1070,_0x2b35f9){_0x2b35f9=_0x2b35f9||0xcc;return function(_0xf05c5c){if(_0xf05c5c){return _0x4d1070['sendStatus'](_0x2b35f9);}return _0x4d1070[_0x91a3('0x16')](_0x2b35f9)[_0x91a3('0x17')]();};}function respondWithResult(_0x3fc7f6,_0x4f636f){_0x4f636f=_0x4f636f||0xc8;return function(_0x4bc2fe){if(_0x4bc2fe){return _0x3fc7f6[_0x91a3('0x16')](_0x4f636f)[_0x91a3('0x18')](_0x4bc2fe);}};}function respondWithFilteredResult(_0x3d7ff9,_0xecb582){return function(_0x37fcc1){if(_0x37fcc1){var _0x284a3a=typeof _0xecb582[_0x91a3('0x19')]===_0x91a3('0x1a')&&typeof _0xecb582[_0x91a3('0x1b')]===_0x91a3('0x1a');var _0x156cea=_0x37fcc1[_0x91a3('0x1c')];var _0x28e7a1=_0x284a3a?0x0:_0xecb582[_0x91a3('0x19')];var _0x38b452=_0x284a3a?_0x37fcc1['count']:_0xecb582['offset']+_0xecb582[_0x91a3('0x1b')];var _0x486ac2;if(_0x38b452>=_0x156cea){_0x38b452=_0x156cea;_0x486ac2=0xc8;}else{_0x486ac2=0xce;}_0x3d7ff9[_0x91a3('0x16')](_0x486ac2);return _0x3d7ff9[_0x91a3('0x1d')]('Content-Range',_0x28e7a1+'-'+_0x38b452+'/'+_0x156cea)[_0x91a3('0x18')](_0x37fcc1);}return null;};}function patchUpdates(_0x1f7ee5){return function(_0x3e2cad){try{jsonpatch[_0x91a3('0x1e')](_0x3e2cad,_0x1f7ee5,!![]);}catch(_0x5307f6){return BPromise[_0x91a3('0x1f')](_0x5307f6);}return _0x3e2cad[_0x91a3('0x20')]();};}function saveUpdates(_0x559ce2,_0x52b425){return function(_0x2b241e){if(_0x2b241e){return _0x2b241e['update'](_0x559ce2)[_0x91a3('0x21')](function(_0x371423){return _0x371423;});}return null;};}function removeEntity(_0x43bdb5,_0xcd7e36){return function(_0x433e04){if(_0x433e04){return _0x433e04['destroy']()[_0x91a3('0x21')](function(){_0x43bdb5[_0x91a3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x414dcf,_0x1e438a){return function(_0x48ccf7){if(!_0x48ccf7){_0x414dcf['sendStatus'](0x194);}return _0x48ccf7;};}function handleError(_0x1a3f76,_0x341d23){_0x341d23=_0x341d23||0x1f4;return function(_0x5d5ee1){logger[_0x91a3('0x22')](_0x5d5ee1['stack']);if(_0x5d5ee1[_0x91a3('0x23')]){delete _0x5d5ee1[_0x91a3('0x23')];}_0x1a3f76[_0x91a3('0x16')](_0x341d23)[_0x91a3('0x24')](_0x5d5ee1);};}exports[_0x91a3('0x25')]=function(_0x344192,_0x153aeb){var _0x31c73b={},_0x2ea11a={},_0x53bf1d={'count':0x0,'rows':[]};var _0x39edcb=_['map'](db['SquareRecording'][_0x91a3('0x26')],function(_0x2a6662){return{'name':_0x2a6662[_0x91a3('0x27')],'type':_0x2a6662['type'][_0x91a3('0x28')]};});_0x2ea11a['model']=_[_0x91a3('0x29')](_0x39edcb,'name');_0x2ea11a[_0x91a3('0x2a')]=_['keys'](_0x344192['query']);_0x2ea11a[_0x91a3('0x2b')]=_[_0x91a3('0x2c')](_0x2ea11a[_0x91a3('0x2d')],_0x2ea11a['query']);_0x31c73b[_0x91a3('0x2e')]=_[_0x91a3('0x2c')](_0x2ea11a[_0x91a3('0x2d')],qs[_0x91a3('0x2f')](_0x344192['query'][_0x91a3('0x2f')]));_0x31c73b[_0x91a3('0x2e')]=_0x31c73b[_0x91a3('0x2e')]['length']?_0x31c73b[_0x91a3('0x2e')]:_0x2ea11a[_0x91a3('0x2d')];if(!_0x344192[_0x91a3('0x2a')]['hasOwnProperty'](_0x91a3('0x30'))){_0x31c73b[_0x91a3('0x1b')]=qs[_0x91a3('0x1b')](_0x344192['query'][_0x91a3('0x1b')]);_0x31c73b['offset']=qs[_0x91a3('0x19')](_0x344192[_0x91a3('0x2a')][_0x91a3('0x19')]);}_0x31c73b['order']=qs[_0x91a3('0x31')](_0x344192[_0x91a3('0x2a')][_0x91a3('0x31')]);_0x31c73b[_0x91a3('0x32')]=qs[_0x91a3('0x2b')](_['pick'](_0x344192[_0x91a3('0x2a')],_0x2ea11a[_0x91a3('0x2b')]),_0x39edcb);if(_0x344192[_0x91a3('0x2a')][_0x91a3('0x33')]){_0x31c73b[_0x91a3('0x32')]=_[_0x91a3('0x34')](_0x31c73b[_0x91a3('0x32')],{'$or':_[_0x91a3('0x29')](_0x39edcb,function(_0x4c4383){if(_0x4c4383[_0x91a3('0x35')]!=='VIRTUAL'){var _0x280c84={};_0x280c84[_0x4c4383[_0x91a3('0x23')]]={'$like':'%'+_0x344192[_0x91a3('0x2a')][_0x91a3('0x33')]+'%'};return _0x280c84;}})});}_0x31c73b=_['merge']({},_0x31c73b,_0x344192[_0x91a3('0x36')]);var _0x3074d8={'where':_0x31c73b['where']};return db['SquareRecording'][_0x91a3('0x1c')](_0x3074d8)[_0x91a3('0x21')](function(_0x45abeb){_0x53bf1d[_0x91a3('0x1c')]=_0x45abeb;if(_0x344192[_0x91a3('0x2a')][_0x91a3('0x37')]){_0x31c73b[_0x91a3('0x38')]=[{'all':!![]}];}return db[_0x91a3('0x39')][_0x91a3('0x3a')](_0x31c73b);})[_0x91a3('0x21')](function(_0x3d82ab){_0x53bf1d[_0x91a3('0x3b')]=_0x3d82ab;return _0x53bf1d;})[_0x91a3('0x21')](respondWithFilteredResult(_0x153aeb,_0x31c73b))['catch'](handleError(_0x153aeb,null));};exports[_0x91a3('0x3c')]=function(_0x983713,_0x55ebc6){var _0x49442b={'raw':!![],'where':{'id':_0x983713['params']['id']}},_0xc3f072={};_0xc3f072[_0x91a3('0x2d')]=_[_0x91a3('0x3d')](db[_0x91a3('0x39')][_0x91a3('0x26')]);_0xc3f072['query']=_[_0x91a3('0x3d')](_0x983713[_0x91a3('0x2a')]);_0xc3f072[_0x91a3('0x2b')]=_[_0x91a3('0x2c')](_0xc3f072[_0x91a3('0x2d')],_0xc3f072['query']);_0x49442b[_0x91a3('0x2e')]=_[_0x91a3('0x2c')](_0xc3f072['model'],qs[_0x91a3('0x2f')](_0x983713[_0x91a3('0x2a')][_0x91a3('0x2f')]));_0x49442b[_0x91a3('0x2e')]=_0x49442b[_0x91a3('0x2e')][_0x91a3('0x3e')]?_0x49442b[_0x91a3('0x2e')]:_0xc3f072[_0x91a3('0x2d')];if(_0x983713[_0x91a3('0x2a')][_0x91a3('0x37')]){_0x49442b[_0x91a3('0x38')]=[{'all':!![]}];}_0x49442b=_['merge']({},_0x49442b,_0x983713[_0x91a3('0x36')]);return db['SquareRecording'][_0x91a3('0x3f')](_0x49442b)[_0x91a3('0x21')](handleEntityNotFound(_0x55ebc6,null))[_0x91a3('0x21')](respondWithResult(_0x55ebc6,null))[_0x91a3('0x40')](handleError(_0x55ebc6,null));};exports[_0x91a3('0x41')]=function(_0x4f2d88,_0x4681c1){return db[_0x91a3('0x39')][_0x91a3('0x41')](_0x4f2d88[_0x91a3('0x42')],{})[_0x91a3('0x21')](respondWithResult(_0x4681c1,0xc9))[_0x91a3('0x40')](handleError(_0x4681c1,null));};exports[_0x91a3('0x43')]=function(_0x30c5b1,_0x31197e){if(_0x30c5b1[_0x91a3('0x42')]['id']){delete _0x30c5b1[_0x91a3('0x42')]['id'];}return db[_0x91a3('0x39')]['find']({'where':{'id':_0x30c5b1[_0x91a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x31197e,null))[_0x91a3('0x21')](saveUpdates(_0x30c5b1['body'],null))[_0x91a3('0x21')](respondWithResult(_0x31197e,null))[_0x91a3('0x40')](handleError(_0x31197e,null));};exports[_0x91a3('0x45')]=function(_0x3fe9da,_0x367f19,_0x58f9c7){var _0x11ce1a=require(_0x91a3('0x46'));var _0x302407=![];var _0x3d27c0={};if(_0x3fe9da[_0x91a3('0x2a')][_0x91a3('0x35')]&&_0x3fe9da[_0x91a3('0x2a')]['type']===_0x91a3('0x47')){_0x3d27c0['uniqueid']=_0x3fe9da[_0x91a3('0x44')]['id'];}else{_0x3d27c0['id']=_0x3fe9da[_0x91a3('0x44')]['id'];}return db[_0x91a3('0x39')][_0x91a3('0x3f')]({'where':_0x3d27c0,'attributes':['id',_0x91a3('0x48'),_0x91a3('0x49')],'raw':!![]})[_0x91a3('0x21')](handleEntityNotFound(_0x367f19,null))[_0x91a3('0x21')](function(_0x4c6906){if(_0x4c6906){var _0x16a393=_0x4c6906[_0x91a3('0x48')];var _0x1fad5a=util[_0x91a3('0x4a')](_0x91a3('0x4b'),_0x16a393);if(fs[_0x91a3('0x4c')](_0x1fad5a)){_0x302407=!![];return _0x11ce1a['decryptFile'](_0x1fad5a,_0x16a393,config['secrets'][_0x91a3('0x4d')])[_0x91a3('0x21')](function(){return _0x4c6906;});}return _0x4c6906;}})[_0x91a3('0x21')](function(_0x43161b){if(_0x43161b){var _0x4287df=_0x43161b[_0x91a3('0x48')];if(!fs['existsSync'](_0x4287df)){throw new db[(_0x91a3('0x4e'))][(_0x91a3('0x4f'))](_0x91a3('0x50'));}if(_0x43161b['filename']){return _0x367f19[_0x91a3('0x45')](_0x4287df,_0x43161b['filename']+path['extname'](_0x4287df),function(){if(_0x302407){fs[_0x91a3('0x51')](_0x4287df);}});}else{return _0x367f19[_0x91a3('0x45')](_0x4287df,function(_0x17311d){if(_0x302407){fs[_0x91a3('0x51')](_0x4287df);}});}}})['catch'](function(_0x45a0d3){if(_0x45a0d3[_0x91a3('0x52')]===_0x91a3('0x50')){_0x367f19[_0x91a3('0x16')](0x194)['send'](_0x91a3('0x53'));}else{return handleError(_0x367f19,null);}});};exports[_0x91a3('0x54')]=function(_0x1e22a8,_0x2c341f){return db[_0x91a3('0x39')][_0x91a3('0x3f')]({'where':{'id':_0x1e22a8[_0x91a3('0x44')]['id']}})[_0x91a3('0x21')](function(_0xa2df3a){if(_[_0x91a3('0x55')](_0xa2df3a)){throw new ReferenceError('Entity\x20not\x20found');}return _0xa2df3a;})[_0x91a3('0x21')](function(_0x1ca8fc){var _0x51bf0c=_0x1ca8fc[_0x91a3('0x48')];logger[_0x91a3('0x56')](_0x91a3('0x57'),_0x51bf0c);if(!_[_0x91a3('0x55')](_0x1ca8fc[_0x91a3('0x48')])&&fs[_0x91a3('0x4c')](_0x51bf0c)){logger['info']('File:\x20\x22'+_0x51bf0c+_0x91a3('0x58'));fs['unlinkSync'](_0x51bf0c);}_0x51bf0c=_0x51bf0c+_0x91a3('0x59');if(!_[_0x91a3('0x55')](_0x1ca8fc[_0x91a3('0x48')])&&fs['existsSync'](_0x51bf0c)){logger['info'](_0x91a3('0x5a')+_0x51bf0c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x91a3('0x5b')](_0x51bf0c);}return _0x1ca8fc;})[_0x91a3('0x21')](function(_0x46918b){if(!_0x46918b)throw new InternalError();return _0x46918b[_0x91a3('0x54')]();})[_0x91a3('0x21')](function(){_0x2c341f['status'](0xcc)[_0x91a3('0x17')]();})[_0x91a3('0x40')](handleError(_0x2c341f,null));}; \ No newline at end of file +var _0xdef7=['message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','rows','show','params','catch','create','body','type','uniqueid','filename','savePath','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink'];(function(_0x31bca3,_0x209a1e){var _0x2f10ea=function(_0x248a36){while(--_0x248a36){_0x31bca3['push'](_0x31bca3['shift']());}};_0x2f10ea(++_0x209a1e);}(_0xdef7,0x68));var _0x7def=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdef7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7def('0x0'));var rimraf=require(_0x7def('0x1'));var zipdir=require(_0x7def('0x2'));var jsonpatch=require(_0x7def('0x3'));var rp=require(_0x7def('0x4'));var moment=require(_0x7def('0x5'));var BPromise=require(_0x7def('0x6'));var Mustache=require('mustache');var util=require(_0x7def('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7def('0x8'));var fs=require('fs');var fs_extra=require(_0x7def('0x9'));var _=require('lodash');var squel=require(_0x7def('0xa'));var crypto=require(_0x7def('0xb'));var jsforce=require(_0x7def('0xc'));var deskjs=require(_0x7def('0xd'));var toCsv=require(_0x7def('0xe'));var querystring=require(_0x7def('0xf'));var Papa=require('papaparse');var Redis=require(_0x7def('0x10'));var authService=require(_0x7def('0x11'));var qs=require(_0x7def('0x12'));var as=require(_0x7def('0x13'));var hardwareService=require(_0x7def('0x14'));var logger=require(_0x7def('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7def('0x16'));var db=require(_0x7def('0x17'))['db'];function respondWithStatusCode(_0x4887bc,_0x4f7559){_0x4f7559=_0x4f7559||0xcc;return function(_0x1b9d66){if(_0x1b9d66){return _0x4887bc[_0x7def('0x18')](_0x4f7559);}return _0x4887bc[_0x7def('0x19')](_0x4f7559)[_0x7def('0x1a')]();};}function respondWithResult(_0x93fde5,_0x245715){_0x245715=_0x245715||0xc8;return function(_0x5ea30a){if(_0x5ea30a){return _0x93fde5[_0x7def('0x19')](_0x245715)[_0x7def('0x1b')](_0x5ea30a);}};}function respondWithFilteredResult(_0x151e0b,_0x1ee9fa){return function(_0xa9798f){if(_0xa9798f){var _0x4d9e88=typeof _0x1ee9fa[_0x7def('0x1c')]==='undefined'&&typeof _0x1ee9fa[_0x7def('0x1d')]==='undefined';var _0x102c3f=_0xa9798f[_0x7def('0x1e')];var _0x560672=_0x4d9e88?0x0:_0x1ee9fa[_0x7def('0x1c')];var _0x1329b3=_0x4d9e88?_0xa9798f[_0x7def('0x1e')]:_0x1ee9fa[_0x7def('0x1c')]+_0x1ee9fa[_0x7def('0x1d')];var _0x813c1f;if(_0x1329b3>=_0x102c3f){_0x1329b3=_0x102c3f;_0x813c1f=0xc8;}else{_0x813c1f=0xce;}_0x151e0b[_0x7def('0x19')](_0x813c1f);return _0x151e0b[_0x7def('0x1f')]('Content-Range',_0x560672+'-'+_0x1329b3+'/'+_0x102c3f)[_0x7def('0x1b')](_0xa9798f);}return null;};}function patchUpdates(_0x58da94){return function(_0x177960){try{jsonpatch[_0x7def('0x20')](_0x177960,_0x58da94,!![]);}catch(_0x485987){return BPromise[_0x7def('0x21')](_0x485987);}return _0x177960['save']();};}function saveUpdates(_0x31a941,_0x82d2cf){return function(_0x40599d){if(_0x40599d){return _0x40599d['update'](_0x31a941)[_0x7def('0x22')](function(_0x2ae2fa){return _0x2ae2fa;});}return null;};}function removeEntity(_0x4df5f8,_0x3dc296){return function(_0x3cc277){if(_0x3cc277){return _0x3cc277[_0x7def('0x23')]()[_0x7def('0x22')](function(){_0x4df5f8[_0x7def('0x19')](0xcc)[_0x7def('0x1a')]();});}};}function handleEntityNotFound(_0x973f22,_0x2d914d){return function(_0xaede6b){if(!_0xaede6b){_0x973f22[_0x7def('0x18')](0x194);}return _0xaede6b;};}function handleError(_0x2da1b6,_0x575065){_0x575065=_0x575065||0x1f4;return function(_0x57f6a8){logger['error'](_0x57f6a8[_0x7def('0x24')]);if(_0x57f6a8[_0x7def('0x25')]){delete _0x57f6a8[_0x7def('0x25')];}_0x2da1b6[_0x7def('0x19')](_0x575065)[_0x7def('0x26')](_0x57f6a8);};}exports[_0x7def('0x27')]=function(_0x494dc8,_0xc79aad){var _0x5316a3={},_0x4cf83c={},_0x46b60e={'count':0x0,'rows':[]};var _0x3b6626=_[_0x7def('0x28')](db['SquareRecording'][_0x7def('0x29')],function(_0x31a3e){return{'name':_0x31a3e[_0x7def('0x2a')],'type':_0x31a3e['type'][_0x7def('0x2b')]};});_0x4cf83c[_0x7def('0x2c')]=_[_0x7def('0x28')](_0x3b6626,_0x7def('0x25'));_0x4cf83c[_0x7def('0x2d')]=_[_0x7def('0x2e')](_0x494dc8[_0x7def('0x2d')]);_0x4cf83c[_0x7def('0x2f')]=_[_0x7def('0x30')](_0x4cf83c[_0x7def('0x2c')],_0x4cf83c[_0x7def('0x2d')]);_0x5316a3['attributes']=_[_0x7def('0x30')](_0x4cf83c[_0x7def('0x2c')],qs[_0x7def('0x31')](_0x494dc8[_0x7def('0x2d')][_0x7def('0x31')]));_0x5316a3['attributes']=_0x5316a3['attributes'][_0x7def('0x32')]?_0x5316a3[_0x7def('0x33')]:_0x4cf83c[_0x7def('0x2c')];if(!_0x494dc8[_0x7def('0x2d')][_0x7def('0x34')](_0x7def('0x35'))){_0x5316a3[_0x7def('0x1d')]=qs['limit'](_0x494dc8[_0x7def('0x2d')][_0x7def('0x1d')]);_0x5316a3[_0x7def('0x1c')]=qs[_0x7def('0x1c')](_0x494dc8[_0x7def('0x2d')][_0x7def('0x1c')]);}_0x5316a3[_0x7def('0x36')]=qs[_0x7def('0x37')](_0x494dc8[_0x7def('0x2d')][_0x7def('0x37')]);_0x5316a3[_0x7def('0x38')]=qs[_0x7def('0x2f')](_['pick'](_0x494dc8[_0x7def('0x2d')],_0x4cf83c[_0x7def('0x2f')]),_0x3b6626);if(_0x494dc8[_0x7def('0x2d')][_0x7def('0x39')]){_0x5316a3['where']=_['merge'](_0x5316a3[_0x7def('0x38')],{'$or':_[_0x7def('0x28')](_0x3b6626,function(_0x492480){if(_0x492480['type']!==_0x7def('0x3a')){var _0x3b9066={};_0x3b9066[_0x492480[_0x7def('0x25')]]={'$like':'%'+_0x494dc8['query']['filter']+'%'};return _0x3b9066;}})});}_0x5316a3=_[_0x7def('0x3b')]({},_0x5316a3,_0x494dc8[_0x7def('0x3c')]);var _0x5a6221={'where':_0x5316a3[_0x7def('0x38')]};return db[_0x7def('0x3d')][_0x7def('0x1e')](_0x5a6221)[_0x7def('0x22')](function(_0x1fac78){_0x46b60e[_0x7def('0x1e')]=_0x1fac78;if(_0x494dc8[_0x7def('0x2d')][_0x7def('0x3e')]){_0x5316a3[_0x7def('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x7def('0x40')](_0x5316a3);})[_0x7def('0x22')](function(_0x1bfb49){_0x46b60e[_0x7def('0x41')]=_0x1bfb49;return _0x46b60e;})[_0x7def('0x22')](respondWithFilteredResult(_0xc79aad,_0x5316a3))['catch'](handleError(_0xc79aad,null));};exports[_0x7def('0x42')]=function(_0xfbc067,_0x292154){var _0x1d6b1c={'raw':!![],'where':{'id':_0xfbc067[_0x7def('0x43')]['id']}},_0x57e0bc={};_0x57e0bc[_0x7def('0x2c')]=_[_0x7def('0x2e')](db[_0x7def('0x3d')]['rawAttributes']);_0x57e0bc[_0x7def('0x2d')]=_[_0x7def('0x2e')](_0xfbc067[_0x7def('0x2d')]);_0x57e0bc[_0x7def('0x2f')]=_[_0x7def('0x30')](_0x57e0bc[_0x7def('0x2c')],_0x57e0bc[_0x7def('0x2d')]);_0x1d6b1c[_0x7def('0x33')]=_['intersection'](_0x57e0bc[_0x7def('0x2c')],qs[_0x7def('0x31')](_0xfbc067[_0x7def('0x2d')]['fields']));_0x1d6b1c[_0x7def('0x33')]=_0x1d6b1c[_0x7def('0x33')][_0x7def('0x32')]?_0x1d6b1c['attributes']:_0x57e0bc[_0x7def('0x2c')];if(_0xfbc067[_0x7def('0x2d')]['includeAll']){_0x1d6b1c[_0x7def('0x3f')]=[{'all':!![]}];}_0x1d6b1c=_[_0x7def('0x3b')]({},_0x1d6b1c,_0xfbc067[_0x7def('0x3c')]);return db[_0x7def('0x3d')]['find'](_0x1d6b1c)[_0x7def('0x22')](handleEntityNotFound(_0x292154,null))[_0x7def('0x22')](respondWithResult(_0x292154,null))[_0x7def('0x44')](handleError(_0x292154,null));};exports[_0x7def('0x45')]=function(_0x26b331,_0x598089){return db[_0x7def('0x3d')][_0x7def('0x45')](_0x26b331[_0x7def('0x46')],{})[_0x7def('0x22')](respondWithResult(_0x598089,0xc9))[_0x7def('0x44')](handleError(_0x598089,null));};exports['update']=function(_0x50f3f1,_0x3e9e3b){if(_0x50f3f1[_0x7def('0x46')]['id']){delete _0x50f3f1[_0x7def('0x46')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x50f3f1[_0x7def('0x43')]['id']}})[_0x7def('0x22')](handleEntityNotFound(_0x3e9e3b,null))['then'](saveUpdates(_0x50f3f1[_0x7def('0x46')],null))[_0x7def('0x22')](respondWithResult(_0x3e9e3b,null))['catch'](handleError(_0x3e9e3b,null));};exports['download']=function(_0x1eb760,_0x4976c5,_0x36429f){var _0x170d45=require('../../components/encryptor');var _0x3fac81=![];var _0xcac111={};if(_0x1eb760['query'][_0x7def('0x47')]&&_0x1eb760[_0x7def('0x2d')]['type']===_0x7def('0x48')){_0xcac111[_0x7def('0x48')]=_0x1eb760[_0x7def('0x43')]['id'];}else{_0xcac111['id']=_0x1eb760['params']['id'];}return db[_0x7def('0x3d')]['find']({'where':_0xcac111,'attributes':['id','savePath',_0x7def('0x49')],'raw':!![]})[_0x7def('0x22')](handleEntityNotFound(_0x4976c5,null))[_0x7def('0x22')](function(_0x4c7da0){if(_0x4c7da0){var _0x229ab7=_0x4c7da0[_0x7def('0x4a')];var _0x5c8466=util['format']('%s.cypher',_0x229ab7);if(fs['existsSync'](_0x5c8466)){_0x3fac81=!![];return _0x170d45[_0x7def('0x4b')](_0x5c8466,_0x229ab7,config['secrets'][_0x7def('0x4c')])[_0x7def('0x22')](function(){return _0x4c7da0;});}return _0x4c7da0;}})[_0x7def('0x22')](function(_0x347c88){if(_0x347c88){var _0x55e7ba=_0x347c88[_0x7def('0x4a')];if(!fs[_0x7def('0x4d')](_0x55e7ba)){throw new db[(_0x7def('0x4e'))][(_0x7def('0x4f'))](_0x7def('0x50'));}if(_0x347c88[_0x7def('0x49')]){return _0x4976c5[_0x7def('0x51')](_0x55e7ba,_0x347c88[_0x7def('0x49')]+path[_0x7def('0x52')](_0x55e7ba),function(){if(_0x3fac81){fs[_0x7def('0x53')](_0x55e7ba);}});}else{return _0x4976c5['download'](_0x55e7ba,function(_0x514caa){if(_0x3fac81){fs[_0x7def('0x53')](_0x55e7ba);}});}}})[_0x7def('0x44')](function(_0x3e1a1e){if(_0x3e1a1e[_0x7def('0x54')]===_0x7def('0x50')){_0x4976c5['status'](0x194)[_0x7def('0x26')](_0x7def('0x55'));}else{return handleError(_0x4976c5,null);}});};exports['destroy']=function(_0x4263f3,_0x113a49){return db[_0x7def('0x3d')]['find']({'where':{'id':_0x4263f3['params']['id']}})['then'](function(_0x3e76f1){if(_['isNil'](_0x3e76f1)){throw new ReferenceError(_0x7def('0x56'));}return _0x3e76f1;})[_0x7def('0x22')](function(_0x44e3ec){var _0x2e8033=_0x44e3ec[_0x7def('0x4a')];logger[_0x7def('0x57')](_0x7def('0x58'),_0x2e8033);if(!_[_0x7def('0x59')](_0x44e3ec[_0x7def('0x4a')])&&fs[_0x7def('0x4d')](_0x2e8033)){logger[_0x7def('0x57')](_0x7def('0x5a')+_0x2e8033+_0x7def('0x5b'));fs[_0x7def('0x5c')](_0x2e8033);}_0x2e8033=_0x2e8033+_0x7def('0x5d');if(!_[_0x7def('0x59')](_0x44e3ec[_0x7def('0x4a')])&&fs[_0x7def('0x4d')](_0x2e8033)){logger[_0x7def('0x57')]('File:\x20\x22'+_0x2e8033+_0x7def('0x5b'));fs[_0x7def('0x5c')](_0x2e8033);}return _0x44e3ec;})[_0x7def('0x22')](function(_0x1dc2f7){if(!_0x1dc2f7)throw new InternalError();return _0x1dc2f7['destroy']();})['then'](function(){_0x113a49[_0x7def('0x19')](0xcc)['end']();})[_0x7def('0x44')](handleError(_0x113a49,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3fc3b92..66cd86f 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 _0xc74c=['exports','SquareRecording','square_recordings','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x2068d0,_0x3f28de){var _0x42f026=function(_0x45eefb){while(--_0x45eefb){_0x2068d0['push'](_0x2068d0['shift']());}};_0x42f026(++_0x3f28de);}(_0xc74c,0x163));var _0xcc74=function(_0x51ee2c,_0x491d3a){_0x51ee2c=_0x51ee2c-0x0;var _0x2d83d6=_0xc74c[_0x51ee2c];return _0x2d83d6;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3646=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x5d6e05,_0x27bba3){var _0x1ac655=function(_0x16dc82){while(--_0x16dc82){_0x5d6e05['push'](_0x5d6e05['shift']());}};_0x1ac655(++_0x27bba3);}(_0x3646,0x15f));var _0x6364=function(_0x2191db,_0x4a1c65){_0x2191db=_0x2191db-0x0;var _0x474773=_0x3646[_0x2191db];return _0x474773;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var logger=require(_0x6364('0x2'))(_0x6364('0x3'));var moment=require('moment');var BPromise=require(_0x6364('0x4'));var rp=require(_0x6364('0x5'));var fs=require('fs');var path=require(_0x6364('0x6'));var rimraf=require(_0x6364('0x7'));var config=require(_0x6364('0x8'));var attributes=require(_0x6364('0x9'));module[_0x6364('0xa')]=function(_0x31f514,_0x165164){return _0x31f514[_0x6364('0xb')](_0x6364('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 73d9a69..715284e 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 _0x5c94=['body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','create'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x5c94,0xdb));var _0x45c9=function(_0x1bc6c8,_0x5d5b63){_0x1bc6c8=_0x1bc6c8-0x0;var _0x22fc6b=_0x5c94[_0x1bc6c8];return _0x22fc6b;};'use strict';var _=require(_0x45c9('0x0'));var util=require(_0x45c9('0x1'));var moment=require(_0x45c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x45c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45c9('0x4'))['db'];var utils=require(_0x45c9('0x5'));var logger=require(_0x45c9('0x6'))(_0x45c9('0x7'));var config=require(_0x45c9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45c9('0x9')][_0x45c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x518e59,_0x4fc1f8,_0x40bebf){return new BPromise(function(_0x2c589f,_0x5ee3d2){return client[_0x45c9('0xb')](_0x518e59,_0x40bebf)[_0x45c9('0xc')](function(_0x275ee3){logger[_0x45c9('0xd')](_0x45c9('0xe'),_0x4fc1f8,_0x45c9('0xf'));logger[_0x45c9('0x10')](_0x45c9('0x11'),_0x4fc1f8,_0x45c9('0xf'),JSON[_0x45c9('0x12')](_0x275ee3));if(_0x275ee3[_0x45c9('0x13')]){if(_0x275ee3[_0x45c9('0x13')]['code']===0x1f4){logger[_0x45c9('0x13')]('SquareRecording,\x20%s,\x20%s',_0x4fc1f8,_0x275ee3[_0x45c9('0x13')][_0x45c9('0x14')]);return _0x5ee3d2(_0x275ee3[_0x45c9('0x13')]['message']);}logger['error'](_0x45c9('0xe'),_0x4fc1f8,_0x275ee3[_0x45c9('0x13')][_0x45c9('0x14')]);return _0x2c589f(_0x275ee3['error'][_0x45c9('0x14')]);}else{logger[_0x45c9('0xd')](_0x45c9('0xe'),_0x4fc1f8,_0x45c9('0xf'));_0x2c589f(_0x275ee3['result']['message']);}})[_0x45c9('0x15')](function(_0x7d315b){logger[_0x45c9('0x13')]('SquareRecording,\x20%s,\x20%s',_0x4fc1f8,_0x7d315b);_0x5ee3d2(_0x7d315b);});});}exports[_0x45c9('0x16')]=function(_0x453286){var _0x146b75=this;return new Promise(function(_0x579386,_0x401bee){return db['SquareRecording'][_0x45c9('0x17')](_0x453286[_0x45c9('0x18')],{'raw':_0x453286[_0x45c9('0x19')]?_0x453286['options'][_0x45c9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x7496d1){logger[_0x45c9('0xd')]('CreateSquareRecording',_0x453286);logger[_0x45c9('0x10')](_0x45c9('0x16'),_0x453286,JSON[_0x45c9('0x12')](_0x7496d1));_0x579386(_0x7496d1);})['catch'](function(_0x442a8b){logger[_0x45c9('0x13')](_0x45c9('0x16'),_0x442a8b[_0x45c9('0x14')],_0x453286);_0x401bee(_0x146b75[_0x45c9('0x13')](0x1f4,_0x442a8b[_0x45c9('0x14')]));});});}; \ No newline at end of file +var _0xd8db=['http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xd8db,0x6b));var _0xbd8d=function(_0x27b4c7,_0xd847e6){_0x27b4c7=_0x27b4c7-0x0;var _0x3000b9=_0xd8db[_0x27b4c7];return _0x3000b9;};'use strict';var _=require(_0xbd8d('0x0'));var util=require('util');var moment=require(_0xbd8d('0x1'));var BPromise=require(_0xbd8d('0x2'));var rs=require(_0xbd8d('0x3'));var fs=require('fs');var Redis=require(_0xbd8d('0x4'));var db=require(_0xbd8d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd8d('0x6'));var config=require(_0xbd8d('0x7'));var jayson=require(_0xbd8d('0x8'));var client=jayson['client'][_0xbd8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58985a,_0x2e661f,_0x54803e){return new BPromise(function(_0x286e13,_0x663dce){return client[_0xbd8d('0xa')](_0x58985a,_0x54803e)['then'](function(_0x474ca6){logger['info'](_0xbd8d('0xb'),_0x2e661f,_0xbd8d('0xc'));logger[_0xbd8d('0xd')](_0xbd8d('0xe'),_0x2e661f,_0xbd8d('0xc'),JSON[_0xbd8d('0xf')](_0x474ca6));if(_0x474ca6[_0xbd8d('0x10')]){if(_0x474ca6[_0xbd8d('0x10')][_0xbd8d('0x11')]===0x1f4){logger[_0xbd8d('0x10')](_0xbd8d('0xb'),_0x2e661f,_0x474ca6[_0xbd8d('0x10')][_0xbd8d('0x12')]);return _0x663dce(_0x474ca6[_0xbd8d('0x10')][_0xbd8d('0x12')]);}logger['error'](_0xbd8d('0xb'),_0x2e661f,_0x474ca6[_0xbd8d('0x10')][_0xbd8d('0x12')]);return _0x286e13(_0x474ca6[_0xbd8d('0x10')][_0xbd8d('0x12')]);}else{logger[_0xbd8d('0x13')](_0xbd8d('0xb'),_0x2e661f,_0xbd8d('0xc'));_0x286e13(_0x474ca6[_0xbd8d('0x14')][_0xbd8d('0x12')]);}})[_0xbd8d('0x15')](function(_0x18eef1){logger[_0xbd8d('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2e661f,_0x18eef1);_0x663dce(_0x18eef1);});});}exports['CreateSquareRecording']=function(_0x4aa67a){var _0xe80fb9=this;return new Promise(function(_0x2516b3,_0x4c84db){return db[_0xbd8d('0x16')][_0xbd8d('0x17')](_0x4aa67a[_0xbd8d('0x18')],{'raw':_0x4aa67a[_0xbd8d('0x19')]?_0x4aa67a['options'][_0xbd8d('0x1a')]===undefined?!![]:![]:!![]})[_0xbd8d('0x1b')](function(_0x3f832d){logger[_0xbd8d('0x13')](_0xbd8d('0x1c'),_0x4aa67a);logger[_0xbd8d('0xd')](_0xbd8d('0x1c'),_0x4aa67a,JSON[_0xbd8d('0xf')](_0x3f832d));_0x2516b3(_0x3f832d);})[_0xbd8d('0x15')](function(_0x23cb45){logger[_0xbd8d('0x10')]('CreateSquareRecording',_0x23cb45[_0xbd8d('0x12')],_0x4aa67a);_0x4c84db(_0xe80fb9[_0xbd8d('0x10')](0x1f4,_0x23cb45[_0xbd8d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e2f13c0..b5a4ab8 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x376c1a,_0x2414d6){var _0x3b63f7=function(_0x1234b6){while(--_0x1234b6){_0x376c1a['push'](_0x376c1a['shift']());}};_0x3b63f7(++_0x2414d6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 291e81b..fba70fe 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 _0x88e3=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3ba056,_0x3f420a){var _0x329d07=function(_0x4fb353){while(--_0x4fb353){_0x3ba056['push'](_0x3ba056['shift']());}};_0x329d07(++_0x3f420a);}(_0x88e3,0x183));var _0x388e=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x88e3[_0x1aa3fe];return _0x163cee;};'use strict';var Sequelize=require(_0x388e('0x0'));module[_0x388e('0x1')]={'network':{'type':Sequelize[_0x388e('0x2')]},'network_script':{'type':Sequelize[_0x388e('0x2')]},'request':{'type':Sequelize[_0x388e('0x2')]},'channel':{'type':Sequelize[_0x388e('0x2')]},'language':{'type':Sequelize[_0x388e('0x2')]},'type':{'type':Sequelize[_0x388e('0x2')]},'uniqueid':{'type':Sequelize[_0x388e('0x2')]},'version':{'type':Sequelize[_0x388e('0x2')]},'callerid':{'type':Sequelize[_0x388e('0x2')]},'calleridname':{'type':Sequelize[_0x388e('0x2')]},'callingpres':{'type':Sequelize[_0x388e('0x2')]},'callingani2':{'type':Sequelize[_0x388e('0x2')]},'callington':{'type':Sequelize[_0x388e('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x388e('0x2')]},'rdnis':{'type':Sequelize[_0x388e('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x388e('0x2')]},'enhanced':{'type':Sequelize[_0x388e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x388e('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x388e('0x3')]},'leaveAt':{'type':Sequelize[_0x388e('0x3')]},'bot':{'type':Sequelize[_0x388e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x832a=['DATE','STRING'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x832a,0x155));var _0xa832=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0x832a[_0x3a6b78];return _0x4943d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xa832('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa832('0x0')]},'type':{'type':Sequelize[_0xa832('0x0')]},'uniqueid':{'type':Sequelize[_0xa832('0x0')]},'version':{'type':Sequelize[_0xa832('0x0')]},'callerid':{'type':Sequelize[_0xa832('0x0')]},'calleridname':{'type':Sequelize[_0xa832('0x0')]},'callingpres':{'type':Sequelize[_0xa832('0x0')]},'callingani2':{'type':Sequelize[_0xa832('0x0')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xa832('0x0')]},'rdnis':{'type':Sequelize[_0xa832('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa832('0x0')]},'priority':{'type':Sequelize[_0xa832('0x0')]},'enhanced':{'type':Sequelize[_0xa832('0x0')]},'accountcode':{'type':Sequelize[_0xa832('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa832('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa832('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8e3225c..362b627 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 _0x3c18=['then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','length','options','find','create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0xb63c5b,_0x2d4a23){var _0x15479f=function(_0x33eb05){while(--_0x33eb05){_0xb63c5b['push'](_0xb63c5b['shift']());}};_0x15479f(++_0x2d4a23);}(_0x3c18,0x182));var _0x83c1=function(_0x4e01f8,_0xcec95e){_0x4e01f8=_0x4e01f8-0x0;var _0x22114d=_0x3c18[_0x4e01f8];return _0x22114d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x83c1('0x0'));var jsonpatch=require(_0x83c1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x83c1('0x2'));var Mustache=require(_0x83c1('0x3'));var util=require(_0x83c1('0x4'));var path=require(_0x83c1('0x5'));var sox=require('sox');var csv=require(_0x83c1('0x6'));var ejs=require(_0x83c1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83c1('0x8'));var squel=require(_0x83c1('0x9'));var crypto=require(_0x83c1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x83c1('0xb'));var toCsv=require(_0x83c1('0x6'));var querystring=require('querystring');var Papa=require(_0x83c1('0xc'));var Redis=require(_0x83c1('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83c1('0xe'));var hardwareService=require(_0x83c1('0xf'));var logger=require(_0x83c1('0x10'))('api');var utils=require(_0x83c1('0x11'));var config=require(_0x83c1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x83c1('0x13'))['db'];function respondWithStatusCode(_0x5f31cd,_0x16b745){_0x16b745=_0x16b745||0xcc;return function(_0x61b167){if(_0x61b167){return _0x5f31cd[_0x83c1('0x14')](_0x16b745);}return _0x5f31cd[_0x83c1('0x15')](_0x16b745)[_0x83c1('0x16')]();};}function respondWithResult(_0x222b57,_0x4a8a67){_0x4a8a67=_0x4a8a67||0xc8;return function(_0x8f77f9){if(_0x8f77f9){return _0x222b57[_0x83c1('0x15')](_0x4a8a67)[_0x83c1('0x17')](_0x8f77f9);}};}function respondWithFilteredResult(_0x2f32de,_0x3e777d){return function(_0x36b311){if(_0x36b311){var _0x6adb97=typeof _0x3e777d[_0x83c1('0x18')]===_0x83c1('0x19')&&typeof _0x3e777d[_0x83c1('0x1a')]==='undefined';var _0x4ee92b=_0x36b311[_0x83c1('0x1b')];var _0x28baf8=_0x6adb97?0x0:_0x3e777d[_0x83c1('0x18')];var _0x5581f1=_0x6adb97?_0x36b311[_0x83c1('0x1b')]:_0x3e777d[_0x83c1('0x18')]+_0x3e777d['limit'];var _0x4502b8;if(_0x5581f1>=_0x4ee92b){_0x5581f1=_0x4ee92b;_0x4502b8=0xc8;}else{_0x4502b8=0xce;}_0x2f32de[_0x83c1('0x15')](_0x4502b8);return _0x2f32de[_0x83c1('0x1c')](_0x83c1('0x1d'),_0x28baf8+'-'+_0x5581f1+'/'+_0x4ee92b)[_0x83c1('0x17')](_0x36b311);}return null;};}function patchUpdates(_0x25611d){return function(_0x1d8546){try{jsonpatch[_0x83c1('0x1e')](_0x1d8546,_0x25611d,!![]);}catch(_0x50b689){return BPromise[_0x83c1('0x1f')](_0x50b689);}return _0x1d8546[_0x83c1('0x20')]();};}function saveUpdates(_0x8e182b,_0x565850){return function(_0x19db12){if(_0x19db12){return _0x19db12[_0x83c1('0x21')](_0x8e182b)[_0x83c1('0x22')](function(_0x219ead){return _0x219ead;});}return null;};}function removeEntity(_0x19754e,_0x5340a0){return function(_0x16743e){if(_0x16743e){return _0x16743e[_0x83c1('0x23')]()[_0x83c1('0x22')](function(){_0x19754e[_0x83c1('0x15')](0xcc)[_0x83c1('0x16')]();});}};}function handleEntityNotFound(_0x503206,_0x1ff19e){return function(_0x4a1548){if(!_0x4a1548){_0x503206[_0x83c1('0x14')](0x194);}return _0x4a1548;};}function handleError(_0x2cdede,_0x530af9){_0x530af9=_0x530af9||0x1f4;return function(_0x37e084){logger[_0x83c1('0x24')](_0x37e084[_0x83c1('0x25')]);if(_0x37e084[_0x83c1('0x26')]){delete _0x37e084[_0x83c1('0x26')];}_0x2cdede[_0x83c1('0x15')](_0x530af9)[_0x83c1('0x27')](_0x37e084);};}exports['index']=function(_0x4389cb,_0x55456d){var _0x206dcf={},_0x4fa435={},_0x1a2b84={'count':0x0,'rows':[]};var _0x59450d=_[_0x83c1('0x28')](db[_0x83c1('0x29')][_0x83c1('0x2a')],function(_0x26219b){return{'name':_0x26219b[_0x83c1('0x2b')],'type':_0x26219b[_0x83c1('0x2c')]['key']};});_0x4fa435[_0x83c1('0x2d')]=_['map'](_0x59450d,_0x83c1('0x26'));_0x4fa435['query']=_[_0x83c1('0x2e')](_0x4389cb[_0x83c1('0x2f')]);_0x4fa435[_0x83c1('0x30')]=_[_0x83c1('0x31')](_0x4fa435['model'],_0x4fa435[_0x83c1('0x2f')]);_0x206dcf['attributes']=_['intersection'](_0x4fa435[_0x83c1('0x2d')],qs[_0x83c1('0x32')](_0x4389cb['query']['fields']));_0x206dcf[_0x83c1('0x33')]=_0x206dcf['attributes']['length']?_0x206dcf['attributes']:_0x4fa435[_0x83c1('0x2d')];if(!_0x4389cb['query']['hasOwnProperty'](_0x83c1('0x34'))){_0x206dcf[_0x83c1('0x1a')]=qs[_0x83c1('0x1a')](_0x4389cb[_0x83c1('0x2f')][_0x83c1('0x1a')]);_0x206dcf[_0x83c1('0x18')]=qs[_0x83c1('0x18')](_0x4389cb['query'][_0x83c1('0x18')]);}_0x206dcf[_0x83c1('0x35')]=qs[_0x83c1('0x36')](_0x4389cb[_0x83c1('0x2f')][_0x83c1('0x36')]);_0x206dcf[_0x83c1('0x37')]=qs['filters'](_['pick'](_0x4389cb[_0x83c1('0x2f')],_0x4fa435[_0x83c1('0x30')]),_0x59450d);if(_0x4389cb[_0x83c1('0x2f')][_0x83c1('0x38')]){_0x206dcf[_0x83c1('0x37')]=_[_0x83c1('0x39')](_0x206dcf[_0x83c1('0x37')],{'$or':_[_0x83c1('0x28')](_0x59450d,function(_0x1ef5be){if(_0x1ef5be['type']!==_0x83c1('0x3a')){var _0x2f700a={};_0x2f700a[_0x1ef5be['name']]={'$like':'%'+_0x4389cb[_0x83c1('0x2f')][_0x83c1('0x38')]+'%'};return _0x2f700a;}})});}_0x206dcf=_[_0x83c1('0x39')]({},_0x206dcf,_0x4389cb['options']);var _0x2efcbd={'where':_0x206dcf[_0x83c1('0x37')]};return db[_0x83c1('0x29')][_0x83c1('0x1b')](_0x2efcbd)[_0x83c1('0x22')](function(_0x1a86ac){_0x1a2b84[_0x83c1('0x1b')]=_0x1a86ac;if(_0x4389cb[_0x83c1('0x2f')]['includeAll']){_0x206dcf[_0x83c1('0x3b')]=[{'all':!![]}];}return db[_0x83c1('0x29')]['findAll'](_0x206dcf);})[_0x83c1('0x22')](function(_0x4c4f45){_0x1a2b84[_0x83c1('0x3c')]=_0x4c4f45;return _0x1a2b84;})[_0x83c1('0x22')](respondWithFilteredResult(_0x55456d,_0x206dcf))[_0x83c1('0x3d')](handleError(_0x55456d,null));};exports[_0x83c1('0x3e')]=function(_0x4c91fe,_0x17df87){var _0x2b3e0c={'raw':!![],'where':{'id':_0x4c91fe[_0x83c1('0x3f')]['id']}},_0x35a28a={};_0x35a28a[_0x83c1('0x2d')]=_[_0x83c1('0x2e')](db['SquareReport'][_0x83c1('0x2a')]);_0x35a28a[_0x83c1('0x2f')]=_['keys'](_0x4c91fe[_0x83c1('0x2f')]);_0x35a28a[_0x83c1('0x30')]=_[_0x83c1('0x31')](_0x35a28a[_0x83c1('0x2d')],_0x35a28a['query']);_0x2b3e0c[_0x83c1('0x33')]=_[_0x83c1('0x31')](_0x35a28a['model'],qs['fields'](_0x4c91fe['query'][_0x83c1('0x32')]));_0x2b3e0c[_0x83c1('0x33')]=_0x2b3e0c[_0x83c1('0x33')][_0x83c1('0x40')]?_0x2b3e0c['attributes']:_0x35a28a[_0x83c1('0x2d')];if(_0x4c91fe['query']['includeAll']){_0x2b3e0c[_0x83c1('0x3b')]=[{'all':!![]}];}_0x2b3e0c=_[_0x83c1('0x39')]({},_0x2b3e0c,_0x4c91fe[_0x83c1('0x41')]);return db[_0x83c1('0x29')][_0x83c1('0x42')](_0x2b3e0c)[_0x83c1('0x22')](handleEntityNotFound(_0x17df87,null))[_0x83c1('0x22')](respondWithResult(_0x17df87,null))[_0x83c1('0x3d')](handleError(_0x17df87,null));};exports[_0x83c1('0x43')]=function(_0x570e69,_0x29a914){return db[_0x83c1('0x29')][_0x83c1('0x43')](_0x570e69[_0x83c1('0x44')],{})[_0x83c1('0x22')](respondWithResult(_0x29a914,0xc9))[_0x83c1('0x3d')](handleError(_0x29a914,null));};exports['update']=function(_0x156978,_0x4e81fb){if(_0x156978[_0x83c1('0x44')]['id']){delete _0x156978[_0x83c1('0x44')]['id'];}return db[_0x83c1('0x29')][_0x83c1('0x42')]({'where':{'id':_0x156978['params']['id']}})[_0x83c1('0x22')](handleEntityNotFound(_0x4e81fb,null))[_0x83c1('0x22')](saveUpdates(_0x156978[_0x83c1('0x44')],null))[_0x83c1('0x22')](respondWithResult(_0x4e81fb,null))['catch'](handleError(_0x4e81fb,null));};exports['destroy']=function(_0x5e15aa,_0x515f86){return db[_0x83c1('0x29')][_0x83c1('0x42')]({'where':{'id':_0x5e15aa[_0x83c1('0x3f')]['id']}})[_0x83c1('0x22')](handleEntityNotFound(_0x515f86,null))[_0x83c1('0x22')](removeEntity(_0x515f86,null))[_0x83c1('0x3d')](handleError(_0x515f86,null));};exports['describe']=function(_0x1b9cd8,_0x371a46){return db[_0x83c1('0x29')][_0x83c1('0x45')]()[_0x83c1('0x22')](respondWithResult(_0x371a46,null))[_0x83c1('0x3d')](handleError(_0x371a46,null));}; \ No newline at end of file +var _0x497c=['destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','options','SquareReport','include','findAll','rows','then','params','includeAll','catch','create','body','find'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x497c,0x1be));var _0xc497=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x497c[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0xc497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc497('0x1'));var jsonpatch=require(_0xc497('0x2'));var rp=require(_0xc497('0x3'));var moment=require('moment');var BPromise=require(_0xc497('0x4'));var Mustache=require(_0xc497('0x5'));var util=require(_0xc497('0x6'));var path=require(_0xc497('0x7'));var sox=require(_0xc497('0x8'));var csv=require('to-csv');var ejs=require(_0xc497('0x9'));var fs=require('fs');var fs_extra=require(_0xc497('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc497('0xb'));var jsforce=require(_0xc497('0xc'));var deskjs=require(_0xc497('0xd'));var toCsv=require(_0xc497('0xe'));var querystring=require('querystring');var Papa=require(_0xc497('0xf'));var Redis=require('ioredis');var authService=require(_0xc497('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc497('0x11'));var hardwareService=require(_0xc497('0x12'));var logger=require('../../config/logger')(_0xc497('0x13'));var utils=require(_0xc497('0x14'));var config=require(_0xc497('0x15'));var licenseUtil=require(_0xc497('0x16'));var db=require(_0xc497('0x17'))['db'];function respondWithStatusCode(_0x8cc56f,_0x1dbfdd){_0x1dbfdd=_0x1dbfdd||0xcc;return function(_0x4b8f17){if(_0x4b8f17){return _0x8cc56f['sendStatus'](_0x1dbfdd);}return _0x8cc56f[_0xc497('0x18')](_0x1dbfdd)[_0xc497('0x19')]();};}function respondWithResult(_0x2944ef,_0x330a28){_0x330a28=_0x330a28||0xc8;return function(_0x557c7e){if(_0x557c7e){return _0x2944ef[_0xc497('0x18')](_0x330a28)[_0xc497('0x1a')](_0x557c7e);}};}function respondWithFilteredResult(_0x120e8c,_0x934485){return function(_0x3ea27b){if(_0x3ea27b){var _0x553f72=typeof _0x934485[_0xc497('0x1b')]===_0xc497('0x1c')&&typeof _0x934485['limit']===_0xc497('0x1c');var _0x517801=_0x3ea27b['count'];var _0x36b2a4=_0x553f72?0x0:_0x934485[_0xc497('0x1b')];var _0x399c5f=_0x553f72?_0x3ea27b[_0xc497('0x1d')]:_0x934485[_0xc497('0x1b')]+_0x934485['limit'];var _0x313302;if(_0x399c5f>=_0x517801){_0x399c5f=_0x517801;_0x313302=0xc8;}else{_0x313302=0xce;}_0x120e8c[_0xc497('0x18')](_0x313302);return _0x120e8c[_0xc497('0x1e')]('Content-Range',_0x36b2a4+'-'+_0x399c5f+'/'+_0x517801)[_0xc497('0x1a')](_0x3ea27b);}return null;};}function patchUpdates(_0x31ded7){return function(_0x12529c){try{jsonpatch[_0xc497('0x1f')](_0x12529c,_0x31ded7,!![]);}catch(_0x2e4cd3){return BPromise[_0xc497('0x20')](_0x2e4cd3);}return _0x12529c[_0xc497('0x21')]();};}function saveUpdates(_0x260d78,_0x38a92d){return function(_0x5ca508){if(_0x5ca508){return _0x5ca508[_0xc497('0x22')](_0x260d78)['then'](function(_0x2c921c){return _0x2c921c;});}return null;};}function removeEntity(_0x1bcff3,_0x47048c){return function(_0x9beaa6){if(_0x9beaa6){return _0x9beaa6['destroy']()['then'](function(){_0x1bcff3['status'](0xcc)[_0xc497('0x19')]();});}};}function handleEntityNotFound(_0x4aa70e,_0x2d2388){return function(_0x555212){if(!_0x555212){_0x4aa70e[_0xc497('0x23')](0x194);}return _0x555212;};}function handleError(_0x22db82,_0x148b1d){_0x148b1d=_0x148b1d||0x1f4;return function(_0x59de18){logger[_0xc497('0x24')](_0x59de18['stack']);if(_0x59de18['name']){delete _0x59de18[_0xc497('0x25')];}_0x22db82[_0xc497('0x18')](_0x148b1d)[_0xc497('0x26')](_0x59de18);};}exports[_0xc497('0x27')]=function(_0x4faaa8,_0x3ee47f){var _0x1d9559={},_0xd0318e={},_0x376edd={'count':0x0,'rows':[]};var _0xdbd0be=_[_0xc497('0x28')](db['SquareReport'][_0xc497('0x29')],function(_0x339b90){return{'name':_0x339b90[_0xc497('0x2a')],'type':_0x339b90['type'][_0xc497('0x2b')]};});_0xd0318e[_0xc497('0x2c')]=_[_0xc497('0x28')](_0xdbd0be,_0xc497('0x25'));_0xd0318e[_0xc497('0x2d')]=_[_0xc497('0x2e')](_0x4faaa8[_0xc497('0x2d')]);_0xd0318e[_0xc497('0x2f')]=_[_0xc497('0x30')](_0xd0318e[_0xc497('0x2c')],_0xd0318e[_0xc497('0x2d')]);_0x1d9559['attributes']=_[_0xc497('0x30')](_0xd0318e[_0xc497('0x2c')],qs['fields'](_0x4faaa8[_0xc497('0x2d')][_0xc497('0x31')]));_0x1d9559['attributes']=_0x1d9559[_0xc497('0x32')][_0xc497('0x33')]?_0x1d9559['attributes']:_0xd0318e[_0xc497('0x2c')];if(!_0x4faaa8[_0xc497('0x2d')][_0xc497('0x34')]('nolimit')){_0x1d9559[_0xc497('0x35')]=qs[_0xc497('0x35')](_0x4faaa8[_0xc497('0x2d')][_0xc497('0x35')]);_0x1d9559[_0xc497('0x1b')]=qs['offset'](_0x4faaa8['query'][_0xc497('0x1b')]);}_0x1d9559[_0xc497('0x36')]=qs[_0xc497('0x37')](_0x4faaa8[_0xc497('0x2d')][_0xc497('0x37')]);_0x1d9559['where']=qs[_0xc497('0x2f')](_[_0xc497('0x38')](_0x4faaa8[_0xc497('0x2d')],_0xd0318e[_0xc497('0x2f')]),_0xdbd0be);if(_0x4faaa8['query'][_0xc497('0x39')]){_0x1d9559['where']=_[_0xc497('0x3a')](_0x1d9559[_0xc497('0x3b')],{'$or':_[_0xc497('0x28')](_0xdbd0be,function(_0x5c8a62){if(_0x5c8a62['type']!=='VIRTUAL'){var _0x28cbd2={};_0x28cbd2[_0x5c8a62[_0xc497('0x25')]]={'$like':'%'+_0x4faaa8[_0xc497('0x2d')]['filter']+'%'};return _0x28cbd2;}})});}_0x1d9559=_[_0xc497('0x3a')]({},_0x1d9559,_0x4faaa8[_0xc497('0x3c')]);var _0x1a99d1={'where':_0x1d9559[_0xc497('0x3b')]};return db[_0xc497('0x3d')][_0xc497('0x1d')](_0x1a99d1)['then'](function(_0x596bab){_0x376edd['count']=_0x596bab;if(_0x4faaa8[_0xc497('0x2d')]['includeAll']){_0x1d9559[_0xc497('0x3e')]=[{'all':!![]}];}return db[_0xc497('0x3d')][_0xc497('0x3f')](_0x1d9559);})['then'](function(_0x1d1a43){_0x376edd[_0xc497('0x40')]=_0x1d1a43;return _0x376edd;})[_0xc497('0x41')](respondWithFilteredResult(_0x3ee47f,_0x1d9559))['catch'](handleError(_0x3ee47f,null));};exports['show']=function(_0x194790,_0x463654){var _0x56948b={'raw':!![],'where':{'id':_0x194790[_0xc497('0x42')]['id']}},_0x2eb39f={};_0x2eb39f[_0xc497('0x2c')]=_[_0xc497('0x2e')](db[_0xc497('0x3d')][_0xc497('0x29')]);_0x2eb39f[_0xc497('0x2d')]=_[_0xc497('0x2e')](_0x194790[_0xc497('0x2d')]);_0x2eb39f[_0xc497('0x2f')]=_[_0xc497('0x30')](_0x2eb39f[_0xc497('0x2c')],_0x2eb39f[_0xc497('0x2d')]);_0x56948b[_0xc497('0x32')]=_[_0xc497('0x30')](_0x2eb39f[_0xc497('0x2c')],qs[_0xc497('0x31')](_0x194790[_0xc497('0x2d')][_0xc497('0x31')]));_0x56948b[_0xc497('0x32')]=_0x56948b['attributes']['length']?_0x56948b[_0xc497('0x32')]:_0x2eb39f[_0xc497('0x2c')];if(_0x194790[_0xc497('0x2d')][_0xc497('0x43')]){_0x56948b[_0xc497('0x3e')]=[{'all':!![]}];}_0x56948b=_[_0xc497('0x3a')]({},_0x56948b,_0x194790[_0xc497('0x3c')]);return db[_0xc497('0x3d')]['find'](_0x56948b)['then'](handleEntityNotFound(_0x463654,null))[_0xc497('0x41')](respondWithResult(_0x463654,null))[_0xc497('0x44')](handleError(_0x463654,null));};exports[_0xc497('0x45')]=function(_0x4d7256,_0x15fded){return db[_0xc497('0x3d')][_0xc497('0x45')](_0x4d7256[_0xc497('0x46')],{})[_0xc497('0x41')](respondWithResult(_0x15fded,0xc9))[_0xc497('0x44')](handleError(_0x15fded,null));};exports[_0xc497('0x22')]=function(_0x2ca239,_0x599eb2){if(_0x2ca239[_0xc497('0x46')]['id']){delete _0x2ca239[_0xc497('0x46')]['id'];}return db[_0xc497('0x3d')][_0xc497('0x47')]({'where':{'id':_0x2ca239[_0xc497('0x42')]['id']}})['then'](handleEntityNotFound(_0x599eb2,null))[_0xc497('0x41')](saveUpdates(_0x2ca239[_0xc497('0x46')],null))[_0xc497('0x41')](respondWithResult(_0x599eb2,null))[_0xc497('0x44')](handleError(_0x599eb2,null));};exports[_0xc497('0x48')]=function(_0x33e4f0,_0x4a2769){return db[_0xc497('0x3d')][_0xc497('0x47')]({'where':{'id':_0x33e4f0[_0xc497('0x42')]['id']}})[_0xc497('0x41')](handleEntityNotFound(_0x4a2769,null))[_0xc497('0x41')](removeEntity(_0x4a2769,null))['catch'](handleError(_0x4a2769,null));};exports[_0xc497('0x49')]=function(_0x5a3179,_0x51b5ab){return db['SquareReport'][_0xc497('0x49')]()[_0xc497('0x41')](respondWithResult(_0x51b5ab,null))[_0xc497('0x44')](handleError(_0x51b5ab,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b4ccb6a..3f778cf 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 _0x1b79=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1b79,0xa8));var _0x91b7=function(_0x58e768,_0x4de6e0){_0x58e768=_0x58e768-0x0;var _0x52b07d=_0x1b79[_0x58e768];return _0x52b07d;};'use strict';var _=require(_0x91b7('0x0'));var util=require(_0x91b7('0x1'));var logger=require(_0x91b7('0x2'))(_0x91b7('0x3'));var moment=require(_0x91b7('0x4'));var BPromise=require(_0x91b7('0x5'));var rp=require(_0x91b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91b7('0x7'));var config=require(_0x91b7('0x8'));var attributes=require(_0x91b7('0x9'));module[_0x91b7('0xa')]=function(_0x539624,_0x7473ba){return _0x539624[_0x91b7('0xb')](_0x91b7('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x91b7('0xd'),'fields':[_0x91b7('0xe'),_0x91b7('0xf')]},{'name':_0x91b7('0x10'),'fields':[_0x91b7('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbba=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbba,0x11c));var _0xacbb=function(_0x347a09,_0x35ce2e){_0x347a09=_0x347a09-0x0;var _0x5af898=_0xcbba[_0x347a09];return _0x5af898;};'use strict';var _=require(_0xacbb('0x0'));var util=require(_0xacbb('0x1'));var logger=require(_0xacbb('0x2'))(_0xacbb('0x3'));var moment=require(_0xacbb('0x4'));var BPromise=require(_0xacbb('0x5'));var rp=require(_0xacbb('0x6'));var fs=require('fs');var path=require(_0xacbb('0x7'));var rimraf=require(_0xacbb('0x8'));var config=require(_0xacbb('0x9'));var attributes=require(_0xacbb('0xa'));module[_0xacbb('0xb')]=function(_0x575416,_0x5220d7){return _0x575416['define'](_0xacbb('0xc'),attributes,{'tableName':_0xacbb('0xd'),'paranoid':![],'indexes':[{'name':_0xacbb('0xe'),'fields':['uniqueid',_0xacbb('0xf')]},{'name':'leaveAt','fields':[_0xacbb('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6a47fa2..4420105 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 _0xb700=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x314db7,_0x23c9b5){var _0x4cce50=function(_0x555bcb){while(--_0x555bcb){_0x314db7['push'](_0x314db7['shift']());}};_0x4cce50(++_0x23c9b5);}(_0xb700,0x83));var _0x0b70=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xb700[_0x272d90];return _0x2bf4a2;};'use strict';var _=require(_0x0b70('0x0'));var util=require(_0x0b70('0x1'));var moment=require('moment');var BPromise=require(_0x0b70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b70('0x3'));var db=require(_0x0b70('0x4'))['db'];var utils=require(_0x0b70('0x5'));var logger=require(_0x0b70('0x6'))(_0x0b70('0x7'));var config=require(_0x0b70('0x8'));var jayson=require(_0x0b70('0x9'));var client=jayson[_0x0b70('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ef960,_0x401400,_0x7dc882){return new BPromise(function(_0x4533b9,_0x1437e6){return client[_0x0b70('0xb')](_0x2ef960,_0x7dc882)[_0x0b70('0xc')](function(_0x49cbdd){logger['info'](_0x0b70('0xd'),_0x401400,_0x0b70('0xe'));logger[_0x0b70('0xf')](_0x0b70('0x10'),_0x401400,_0x0b70('0xe'),JSON[_0x0b70('0x11')](_0x49cbdd));if(_0x49cbdd[_0x0b70('0x12')]){if(_0x49cbdd['error'][_0x0b70('0x13')]===0x1f4){logger['error'](_0x0b70('0xd'),_0x401400,_0x49cbdd[_0x0b70('0x12')][_0x0b70('0x14')]);return _0x1437e6(_0x49cbdd[_0x0b70('0x12')][_0x0b70('0x14')]);}logger[_0x0b70('0x12')](_0x0b70('0xd'),_0x401400,_0x49cbdd[_0x0b70('0x12')][_0x0b70('0x14')]);return _0x4533b9(_0x49cbdd[_0x0b70('0x12')]['message']);}else{logger[_0x0b70('0x15')](_0x0b70('0xd'),_0x401400,_0x0b70('0xe'));_0x4533b9(_0x49cbdd[_0x0b70('0x16')][_0x0b70('0x14')]);}})[_0x0b70('0x17')](function(_0x15fc3f){logger[_0x0b70('0x12')]('SquareReport,\x20%s,\x20%s',_0x401400,_0x15fc3f);_0x1437e6(_0x15fc3f);});});}exports[_0x0b70('0x18')]=function(_0xb4679){var _0x437e05=this;return new Promise(function(_0x1d2c2a,_0x4bac4c){return db[_0x0b70('0x19')][_0x0b70('0x1a')](_0xb4679[_0x0b70('0x1b')],{'raw':_0xb4679[_0x0b70('0x1c')]?_0xb4679[_0x0b70('0x1c')][_0x0b70('0x1d')]===undefined?!![]:![]:!![]})[_0x0b70('0xc')](function(_0x26202f){logger['info'](_0x0b70('0x18'),_0xb4679);logger[_0x0b70('0xf')](_0x0b70('0x18'),_0xb4679,JSON[_0x0b70('0x11')](_0x26202f));_0x1d2c2a(_0x26202f);})[_0x0b70('0x17')](function(_0x390a7e){logger[_0x0b70('0x12')](_0x0b70('0x18'),_0x390a7e['message'],_0xb4679);_0x4bac4c(_0x437e05[_0x0b70('0x12')](0x1f4,_0x390a7e[_0x0b70('0x14')]));});});};exports[_0x0b70('0x1e')]=function(_0x92a636){var _0x1e740a=this;return new Promise(function(_0x57385e,_0x5ecd5a){return db['SquareReport'][_0x0b70('0x1f')](_0x92a636['body'],{'raw':_0x92a636[_0x0b70('0x1c')]?_0x92a636[_0x0b70('0x1c')][_0x0b70('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x92a636['options']?_0x92a636[_0x0b70('0x1c')]['where']||null:null,'attributes':_0x92a636[_0x0b70('0x1c')]?_0x92a636[_0x0b70('0x1c')][_0x0b70('0x20')]||null:null,'limit':_0x92a636[_0x0b70('0x1c')]?_0x92a636[_0x0b70('0x1c')][_0x0b70('0x21')]||null:null})[_0x0b70('0xc')](function(_0x447c80){logger[_0x0b70('0x15')](_0x0b70('0x1e'),_0x92a636);logger[_0x0b70('0xf')](_0x0b70('0x1e'),_0x92a636,JSON[_0x0b70('0x11')](_0x447c80));_0x57385e(_0x447c80);})[_0x0b70('0x17')](function(_0x181744){logger[_0x0b70('0x12')]('UpdateSquareReport',_0x181744['message'],_0x92a636);_0x5ecd5a(_0x1e740a['error'](0x1f4,_0x181744[_0x0b70('0x14')]));});});}; \ No newline at end of file +var _0x9d7b=['../../config/environment','jayson/promise','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','stringify','UpdateSquareReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9d7b,0x1d6));var _0xb9d7=function(_0x56c597,_0x3f249e){_0x56c597=_0x56c597-0x0;var _0x5ed9ac=_0x9d7b[_0x56c597];return _0x5ed9ac;};'use strict';var _=require(_0xb9d7('0x0'));var util=require(_0xb9d7('0x1'));var moment=require(_0xb9d7('0x2'));var BPromise=require(_0xb9d7('0x3'));var rs=require(_0xb9d7('0x4'));var fs=require('fs');var Redis=require(_0xb9d7('0x5'));var db=require(_0xb9d7('0x6'))['db'];var utils=require(_0xb9d7('0x7'));var logger=require(_0xb9d7('0x8'))(_0xb9d7('0x9'));var config=require(_0xb9d7('0xa'));var jayson=require(_0xb9d7('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fee17,_0x307b9d,_0x2f73e8){return new BPromise(function(_0x2eb152,_0x218445){return client['request'](_0x1fee17,_0x2f73e8)[_0xb9d7('0xc')](function(_0x338d00){logger[_0xb9d7('0xd')](_0xb9d7('0xe'),_0x307b9d,'request\x20sent');logger[_0xb9d7('0xf')](_0xb9d7('0x10'),_0x307b9d,_0xb9d7('0x11'),JSON['stringify'](_0x338d00));if(_0x338d00[_0xb9d7('0x12')]){if(_0x338d00[_0xb9d7('0x12')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x307b9d,_0x338d00[_0xb9d7('0x12')]['message']);return _0x218445(_0x338d00[_0xb9d7('0x12')][_0xb9d7('0x13')]);}logger[_0xb9d7('0x12')](_0xb9d7('0xe'),_0x307b9d,_0x338d00['error'][_0xb9d7('0x13')]);return _0x2eb152(_0x338d00[_0xb9d7('0x12')][_0xb9d7('0x13')]);}else{logger[_0xb9d7('0xd')](_0xb9d7('0xe'),_0x307b9d,_0xb9d7('0x11'));_0x2eb152(_0x338d00[_0xb9d7('0x14')][_0xb9d7('0x13')]);}})[_0xb9d7('0x15')](function(_0x29a6b9){logger[_0xb9d7('0x12')]('SquareReport,\x20%s,\x20%s',_0x307b9d,_0x29a6b9);_0x218445(_0x29a6b9);});});}exports[_0xb9d7('0x16')]=function(_0x473017){var _0x24a9a4=this;return new Promise(function(_0x52cb87,_0x4a5e6e){return db[_0xb9d7('0x17')][_0xb9d7('0x18')](_0x473017[_0xb9d7('0x19')],{'raw':_0x473017['options']?_0x473017[_0xb9d7('0x1a')][_0xb9d7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4d8871){logger[_0xb9d7('0xd')]('CreateSquareReport',_0x473017);logger[_0xb9d7('0xf')](_0xb9d7('0x16'),_0x473017,JSON[_0xb9d7('0x1c')](_0x4d8871));_0x52cb87(_0x4d8871);})[_0xb9d7('0x15')](function(_0x33a78d){logger['error']('CreateSquareReport',_0x33a78d['message'],_0x473017);_0x4a5e6e(_0x24a9a4[_0xb9d7('0x12')](0x1f4,_0x33a78d[_0xb9d7('0x13')]));});});};exports[_0xb9d7('0x1d')]=function(_0x2fc341){var _0x379f1a=this;return new Promise(function(_0x110e24,_0x487961){return db['SquareReport'][_0xb9d7('0x1e')](_0x2fc341['body'],{'raw':_0x2fc341[_0xb9d7('0x1a')]?_0x2fc341[_0xb9d7('0x1a')][_0xb9d7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc341['options']?_0x2fc341[_0xb9d7('0x1a')]['where']||null:null,'attributes':_0x2fc341[_0xb9d7('0x1a')]?_0x2fc341['options'][_0xb9d7('0x1f')]||null:null,'limit':_0x2fc341[_0xb9d7('0x1a')]?_0x2fc341[_0xb9d7('0x1a')]['limit']||null:null})[_0xb9d7('0xc')](function(_0x21ca0f){logger[_0xb9d7('0xd')]('UpdateSquareReport',_0x2fc341);logger[_0xb9d7('0xf')](_0xb9d7('0x1d'),_0x2fc341,JSON['stringify'](_0x21ca0f));_0x110e24(_0x21ca0f);})['catch'](function(_0x34a498){logger[_0xb9d7('0x12')](_0xb9d7('0x1d'),_0x34a498[_0xb9d7('0x13')],_0x2fc341);_0x487961(_0x379f1a[_0xb9d7('0x12')](0x1f4,_0x34a498[_0xb9d7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4246a0b..ff66c12 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 _0x7087=['isAuthenticated','index','/describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x2049a8,_0x5e8c8b){var _0x169758=function(_0x1e5ad2){while(--_0x1e5ad2){_0x2049a8['push'](_0x2049a8['shift']());}};_0x169758(++_0x5e8c8b);}(_0x7087,0x16e));var _0x7708=function(_0x1f1a4d,_0x456b0f){_0x1f1a4d=_0x1f1a4d-0x0;var _0x52b8d7=_0x7087[_0x1f1a4d];return _0x52b8d7;};'use strict';var multer=require(_0x7708('0x0'));var util=require(_0x7708('0x1'));var path=require(_0x7708('0x2'));var timeout=require(_0x7708('0x3'));var express=require(_0x7708('0x4'));var router=express[_0x7708('0x5')]();var fs_extra=require(_0x7708('0x6'));var auth=require(_0x7708('0x7'));var interaction=require(_0x7708('0x8'));var config=require(_0x7708('0x9'));var controller=require(_0x7708('0xa'));router[_0x7708('0xb')]('/',auth[_0x7708('0xc')](),controller[_0x7708('0xd')]);router['get'](_0x7708('0xe'),auth[_0x7708('0xc')](),controller['describe']);router['get'](_0x7708('0xf'),auth[_0x7708('0xc')](),controller[_0x7708('0x10')]);router['post']('/',auth[_0x7708('0xc')](),controller['create']);router[_0x7708('0x11')](_0x7708('0xf'),auth[_0x7708('0xc')](),controller['update']);router[_0x7708('0x12')]('/:id',auth[_0x7708('0xc')](),controller[_0x7708('0x13')]);module[_0x7708('0x14')]=router; \ No newline at end of file +var _0x5753=['multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x587501,_0x51d475){var _0x365e25=function(_0xc41c4d){while(--_0xc41c4d){_0x587501['push'](_0x587501['shift']());}};_0x365e25(++_0x51d475);}(_0x5753,0x17a));var _0x3575=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5753[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x3575('0x0'));var util=require('util');var path=require(_0x3575('0x1'));var timeout=require(_0x3575('0x2'));var express=require(_0x3575('0x3'));var router=express[_0x3575('0x4')]();var fs_extra=require(_0x3575('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3575('0x6'));var controller=require('./squareReportDetail.controller');router[_0x3575('0x7')]('/',auth[_0x3575('0x8')](),controller['index']);router[_0x3575('0x7')](_0x3575('0x9'),auth[_0x3575('0x8')](),controller['describe']);router[_0x3575('0x7')](_0x3575('0xa'),auth['isAuthenticated'](),controller[_0x3575('0xb')]);router[_0x3575('0xc')]('/',auth[_0x3575('0x8')](),controller[_0x3575('0xd')]);router[_0x3575('0xe')]('/:id',auth[_0x3575('0x8')](),controller[_0x3575('0xf')]);router['delete'](_0x3575('0xa'),auth[_0x3575('0x8')](),controller[_0x3575('0x10')]);module[_0x3575('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 755f35e..eef2ec4 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 _0xb462=['exports','STRING'];(function(_0x41e32c,_0x3760dc){var _0x15da71=function(_0x30b29c){while(--_0x30b29c){_0x41e32c['push'](_0x41e32c['shift']());}};_0x15da71(++_0x3760dc);}(_0xb462,0xa2));var _0x2b46=function(_0x28f9a2,_0x5db009){_0x28f9a2=_0x28f9a2-0x0;var _0x4129dd=_0xb462[_0x28f9a2];return _0x4129dd;};'use strict';var Sequelize=require('sequelize');module[_0x2b46('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x2b46('0x1')]},'application':{'type':Sequelize[_0x2b46('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x2b46('0x1')]},'callerid':{'type':Sequelize[_0x2b46('0x1')]}}; \ No newline at end of file +var _0x8053=['sequelize','exports','STRING','TEXT'];(function(_0x58428c,_0x435751){var _0x4bebd4=function(_0x27627e){while(--_0x27627e){_0x58428c['push'](_0x58428c['shift']());}};_0x4bebd4(++_0x435751);}(_0x8053,0x194));var _0x3805=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8053[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x3805('0x0'));module[_0x3805('0x1')]={'uniqueid':{'type':Sequelize[_0x3805('0x2')]},'node':{'type':Sequelize[_0x3805('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3805('0x3')]},'project_name':{'type':Sequelize[_0x3805('0x2')]},'callerid':{'type':Sequelize[_0x3805('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1c2f5f3..cca9d00 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 _0x1f25=['eml-format','rimraf','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','name','merge','includeAll','findAll','rows','catch','show','options','find','create','body','params','describe'];(function(_0x59ee10,_0x509db3){var _0x292693=function(_0x5413a3){while(--_0x5413a3){_0x59ee10['push'](_0x59ee10['shift']());}};_0x292693(++_0x509db3);}(_0x1f25,0x12c));var _0x51f2=function(_0x3b4e3b,_0x26f070){_0x3b4e3b=_0x3b4e3b-0x0;var _0x45531b=_0x1f25[_0x3b4e3b];return _0x45531b;};'use strict';var emlformat=require(_0x51f2('0x0'));var rimraf=require(_0x51f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51f2('0x2'));var moment=require(_0x51f2('0x3'));var BPromise=require(_0x51f2('0x4'));var Mustache=require(_0x51f2('0x5'));var util=require('util');var path=require(_0x51f2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51f2('0x7'));var _=require(_0x51f2('0x8'));var squel=require(_0x51f2('0x9'));var crypto=require(_0x51f2('0xa'));var jsforce=require(_0x51f2('0xb'));var deskjs=require(_0x51f2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51f2('0xd'));var Redis=require(_0x51f2('0xe'));var authService=require(_0x51f2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x51f2('0x10'));var hardwareService=require(_0x51f2('0x11'));var logger=require(_0x51f2('0x12'))(_0x51f2('0x13'));var utils=require(_0x51f2('0x14'));var config=require(_0x51f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265ab2,_0x51e5ea){_0x51e5ea=_0x51e5ea||0xcc;return function(_0x273b88){if(_0x273b88){return _0x265ab2[_0x51f2('0x16')](_0x51e5ea);}return _0x265ab2[_0x51f2('0x17')](_0x51e5ea)[_0x51f2('0x18')]();};}function respondWithResult(_0x5d5ae3,_0x27a7b7){_0x27a7b7=_0x27a7b7||0xc8;return function(_0x2ae0b2){if(_0x2ae0b2){return _0x5d5ae3['status'](_0x27a7b7)[_0x51f2('0x19')](_0x2ae0b2);}};}function respondWithFilteredResult(_0x305e47,_0x3b88a4){return function(_0x185e15){if(_0x185e15){var _0x3b9e8f=typeof _0x3b88a4[_0x51f2('0x1a')]===_0x51f2('0x1b')&&typeof _0x3b88a4[_0x51f2('0x1c')]===_0x51f2('0x1b');var _0xa2b7ec=_0x185e15['count'];var _0x4acd82=_0x3b9e8f?0x0:_0x3b88a4['offset'];var _0x326ec8=_0x3b9e8f?_0x185e15[_0x51f2('0x1d')]:_0x3b88a4[_0x51f2('0x1a')]+_0x3b88a4['limit'];var _0x2a5f82;if(_0x326ec8>=_0xa2b7ec){_0x326ec8=_0xa2b7ec;_0x2a5f82=0xc8;}else{_0x2a5f82=0xce;}_0x305e47[_0x51f2('0x17')](_0x2a5f82);return _0x305e47[_0x51f2('0x1e')](_0x51f2('0x1f'),_0x4acd82+'-'+_0x326ec8+'/'+_0xa2b7ec)[_0x51f2('0x19')](_0x185e15);}return null;};}function patchUpdates(_0x1dec06){return function(_0x32a7c8){try{jsonpatch[_0x51f2('0x20')](_0x32a7c8,_0x1dec06,!![]);}catch(_0x559cb0){return BPromise[_0x51f2('0x21')](_0x559cb0);}return _0x32a7c8[_0x51f2('0x22')]();};}function saveUpdates(_0x3a93bd,_0x4f13fe){return function(_0x4688e6){if(_0x4688e6){return _0x4688e6[_0x51f2('0x23')](_0x3a93bd)[_0x51f2('0x24')](function(_0x5910a9){return _0x5910a9;});}return null;};}function removeEntity(_0x21fea2,_0x445c7b){return function(_0x20e8e9){if(_0x20e8e9){return _0x20e8e9['destroy']()[_0x51f2('0x24')](function(){_0x21fea2[_0x51f2('0x17')](0xcc)[_0x51f2('0x18')]();});}};}function handleEntityNotFound(_0x1b9a93,_0x26f233){return function(_0x54e073){if(!_0x54e073){_0x1b9a93[_0x51f2('0x16')](0x194);}return _0x54e073;};}function handleError(_0x535990,_0x296f0c){_0x296f0c=_0x296f0c||0x1f4;return function(_0x632805){logger[_0x51f2('0x25')](_0x632805[_0x51f2('0x26')]);if(_0x632805['name']){delete _0x632805['name'];}_0x535990[_0x51f2('0x17')](_0x296f0c)[_0x51f2('0x27')](_0x632805);};}exports[_0x51f2('0x28')]=function(_0x45d0ee,_0x5cdb38){var _0x2e4cae={},_0x5c6613={},_0x14362b={'count':0x0,'rows':[]};var _0x1cdf09=_[_0x51f2('0x29')](db[_0x51f2('0x2a')][_0x51f2('0x2b')],function(_0x3f8f3c){return{'name':_0x3f8f3c[_0x51f2('0x2c')],'type':_0x3f8f3c[_0x51f2('0x2d')][_0x51f2('0x2e')]};});_0x5c6613[_0x51f2('0x2f')]=_[_0x51f2('0x29')](_0x1cdf09,'name');_0x5c6613[_0x51f2('0x30')]=_[_0x51f2('0x31')](_0x45d0ee[_0x51f2('0x30')]);_0x5c6613[_0x51f2('0x32')]=_[_0x51f2('0x33')](_0x5c6613['model'],_0x5c6613[_0x51f2('0x30')]);_0x2e4cae[_0x51f2('0x34')]=_[_0x51f2('0x33')](_0x5c6613['model'],qs['fields'](_0x45d0ee[_0x51f2('0x30')][_0x51f2('0x35')]));_0x2e4cae[_0x51f2('0x34')]=_0x2e4cae[_0x51f2('0x34')][_0x51f2('0x36')]?_0x2e4cae['attributes']:_0x5c6613[_0x51f2('0x2f')];if(!_0x45d0ee[_0x51f2('0x30')]['hasOwnProperty'](_0x51f2('0x37'))){_0x2e4cae[_0x51f2('0x1c')]=qs[_0x51f2('0x1c')](_0x45d0ee['query'][_0x51f2('0x1c')]);_0x2e4cae[_0x51f2('0x1a')]=qs[_0x51f2('0x1a')](_0x45d0ee[_0x51f2('0x30')][_0x51f2('0x1a')]);}_0x2e4cae[_0x51f2('0x38')]=qs[_0x51f2('0x39')](_0x45d0ee[_0x51f2('0x30')][_0x51f2('0x39')]);_0x2e4cae['where']=qs[_0x51f2('0x32')](_[_0x51f2('0x3a')](_0x45d0ee[_0x51f2('0x30')],_0x5c6613[_0x51f2('0x32')]),_0x1cdf09);if(_0x45d0ee['query'][_0x51f2('0x3b')]){_0x2e4cae[_0x51f2('0x3c')]=_['merge'](_0x2e4cae[_0x51f2('0x3c')],{'$or':_['map'](_0x1cdf09,function(_0x4a190a){if(_0x4a190a[_0x51f2('0x2d')]!==_0x51f2('0x3d')){var _0x3191f1={};_0x3191f1[_0x4a190a[_0x51f2('0x3e')]]={'$like':'%'+_0x45d0ee[_0x51f2('0x30')][_0x51f2('0x3b')]+'%'};return _0x3191f1;}})});}_0x2e4cae=_[_0x51f2('0x3f')]({},_0x2e4cae,_0x45d0ee['options']);var _0x24cd8e={'where':_0x2e4cae['where']};return db[_0x51f2('0x2a')][_0x51f2('0x1d')](_0x24cd8e)[_0x51f2('0x24')](function(_0x5257ea){_0x14362b[_0x51f2('0x1d')]=_0x5257ea;if(_0x45d0ee[_0x51f2('0x30')][_0x51f2('0x40')]){_0x2e4cae['include']=[{'all':!![]}];}return db[_0x51f2('0x2a')][_0x51f2('0x41')](_0x2e4cae);})['then'](function(_0x201b14){_0x14362b[_0x51f2('0x42')]=_0x201b14;return _0x14362b;})[_0x51f2('0x24')](respondWithFilteredResult(_0x5cdb38,_0x2e4cae))[_0x51f2('0x43')](handleError(_0x5cdb38,null));};exports[_0x51f2('0x44')]=function(_0x17a269,_0x4de314){var _0x3fcadc={'raw':!![],'where':{'id':_0x17a269['params']['id']}},_0x4b2fbd={};_0x4b2fbd[_0x51f2('0x2f')]=_['keys'](db['SquareDetailsReport'][_0x51f2('0x2b')]);_0x4b2fbd[_0x51f2('0x30')]=_[_0x51f2('0x31')](_0x17a269[_0x51f2('0x30')]);_0x4b2fbd['filters']=_[_0x51f2('0x33')](_0x4b2fbd[_0x51f2('0x2f')],_0x4b2fbd['query']);_0x3fcadc[_0x51f2('0x34')]=_['intersection'](_0x4b2fbd[_0x51f2('0x2f')],qs['fields'](_0x17a269[_0x51f2('0x30')][_0x51f2('0x35')]));_0x3fcadc[_0x51f2('0x34')]=_0x3fcadc[_0x51f2('0x34')]['length']?_0x3fcadc[_0x51f2('0x34')]:_0x4b2fbd[_0x51f2('0x2f')];if(_0x17a269[_0x51f2('0x30')][_0x51f2('0x40')]){_0x3fcadc['include']=[{'all':!![]}];}_0x3fcadc=_[_0x51f2('0x3f')]({},_0x3fcadc,_0x17a269[_0x51f2('0x45')]);return db['SquareDetailsReport'][_0x51f2('0x46')](_0x3fcadc)['then'](handleEntityNotFound(_0x4de314,null))[_0x51f2('0x24')](respondWithResult(_0x4de314,null))[_0x51f2('0x43')](handleError(_0x4de314,null));};exports[_0x51f2('0x47')]=function(_0x3a6084,_0x1c00cc){return db[_0x51f2('0x2a')][_0x51f2('0x47')](_0x3a6084[_0x51f2('0x48')],{})[_0x51f2('0x24')](respondWithResult(_0x1c00cc,0xc9))['catch'](handleError(_0x1c00cc,null));};exports[_0x51f2('0x23')]=function(_0x8257b9,_0x53f4f0){if(_0x8257b9[_0x51f2('0x48')]['id']){delete _0x8257b9[_0x51f2('0x48')]['id'];}return db[_0x51f2('0x2a')][_0x51f2('0x46')]({'where':{'id':_0x8257b9[_0x51f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x53f4f0,null))['then'](saveUpdates(_0x8257b9[_0x51f2('0x48')],null))[_0x51f2('0x24')](respondWithResult(_0x53f4f0,null))[_0x51f2('0x43')](handleError(_0x53f4f0,null));};exports['destroy']=function(_0x542c57,_0x52e9c5){return db[_0x51f2('0x2a')][_0x51f2('0x46')]({'where':{'id':_0x542c57['params']['id']}})['then'](handleEntityNotFound(_0x52e9c5,null))[_0x51f2('0x24')](removeEntity(_0x52e9c5,null))['catch'](handleError(_0x52e9c5,null));};exports[_0x51f2('0x4a')]=function(_0x3872be,_0x50448c){return db[_0x51f2('0x2a')][_0x51f2('0x4a')]()[_0x51f2('0x24')](respondWithResult(_0x50448c,null))[_0x51f2('0x43')](handleError(_0x50448c,null));}; \ No newline at end of file +var _0xc03b=['then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareDetailsReport','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0xc03b,0x18b));var _0xbc03=function(_0x4f0f6d,_0x28b6f4){_0x4f0f6d=_0x4f0f6d-0x0;var _0x2b2c98=_0xc03b[_0x4f0f6d];return _0x2b2c98;};'use strict';var emlformat=require(_0xbc03('0x0'));var rimraf=require(_0xbc03('0x1'));var zipdir=require(_0xbc03('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc03('0x3'));var moment=require('moment');var BPromise=require(_0xbc03('0x4'));var Mustache=require(_0xbc03('0x5'));var util=require('util');var path=require(_0xbc03('0x6'));var sox=require(_0xbc03('0x7'));var csv=require(_0xbc03('0x8'));var ejs=require(_0xbc03('0x9'));var fs=require('fs');var fs_extra=require(_0xbc03('0xa'));var _=require(_0xbc03('0xb'));var squel=require('squel');var crypto=require(_0xbc03('0xc'));var jsforce=require(_0xbc03('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbc03('0x8'));var querystring=require(_0xbc03('0xe'));var Papa=require('papaparse');var Redis=require(_0xbc03('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbc03('0x10'));var hardwareService=require(_0xbc03('0x11'));var logger=require('../../config/logger')(_0xbc03('0x12'));var utils=require(_0xbc03('0x13'));var config=require(_0xbc03('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc03('0x15'))['db'];function respondWithStatusCode(_0x137b13,_0x35ade8){_0x35ade8=_0x35ade8||0xcc;return function(_0x12159d){if(_0x12159d){return _0x137b13[_0xbc03('0x16')](_0x35ade8);}return _0x137b13[_0xbc03('0x17')](_0x35ade8)[_0xbc03('0x18')]();};}function respondWithResult(_0x91d233,_0x2c3f26){_0x2c3f26=_0x2c3f26||0xc8;return function(_0xef5178){if(_0xef5178){return _0x91d233['status'](_0x2c3f26)[_0xbc03('0x19')](_0xef5178);}};}function respondWithFilteredResult(_0x41e0ca,_0x153c87){return function(_0x2c8f64){if(_0x2c8f64){var _0x5d4534=typeof _0x153c87[_0xbc03('0x1a')]===_0xbc03('0x1b')&&typeof _0x153c87[_0xbc03('0x1c')]===_0xbc03('0x1b');var _0x4b6a7d=_0x2c8f64['count'];var _0x44fc8c=_0x5d4534?0x0:_0x153c87[_0xbc03('0x1a')];var _0x39f469=_0x5d4534?_0x2c8f64[_0xbc03('0x1d')]:_0x153c87[_0xbc03('0x1a')]+_0x153c87[_0xbc03('0x1c')];var _0xaffde7;if(_0x39f469>=_0x4b6a7d){_0x39f469=_0x4b6a7d;_0xaffde7=0xc8;}else{_0xaffde7=0xce;}_0x41e0ca[_0xbc03('0x17')](_0xaffde7);return _0x41e0ca[_0xbc03('0x1e')]('Content-Range',_0x44fc8c+'-'+_0x39f469+'/'+_0x4b6a7d)[_0xbc03('0x19')](_0x2c8f64);}return null;};}function patchUpdates(_0x43f0e2){return function(_0x44bcff){try{jsonpatch['apply'](_0x44bcff,_0x43f0e2,!![]);}catch(_0x5e3952){return BPromise['reject'](_0x5e3952);}return _0x44bcff['save']();};}function saveUpdates(_0x538cfe,_0x2fa6c7){return function(_0x1a1e5b){if(_0x1a1e5b){return _0x1a1e5b['update'](_0x538cfe)[_0xbc03('0x1f')](function(_0x65a1ba){return _0x65a1ba;});}return null;};}function removeEntity(_0x1ebf3b,_0x2ab76e){return function(_0x46846d){if(_0x46846d){return _0x46846d[_0xbc03('0x20')]()['then'](function(){_0x1ebf3b[_0xbc03('0x17')](0xcc)[_0xbc03('0x18')]();});}};}function handleEntityNotFound(_0xcfa750,_0x3b761a){return function(_0x1b5838){if(!_0x1b5838){_0xcfa750[_0xbc03('0x16')](0x194);}return _0x1b5838;};}function handleError(_0x43d8ea,_0x2e69e8){_0x2e69e8=_0x2e69e8||0x1f4;return function(_0x51204f){logger[_0xbc03('0x21')](_0x51204f[_0xbc03('0x22')]);if(_0x51204f[_0xbc03('0x23')]){delete _0x51204f['name'];}_0x43d8ea[_0xbc03('0x17')](_0x2e69e8)[_0xbc03('0x24')](_0x51204f);};}exports[_0xbc03('0x25')]=function(_0x2d446b,_0x3044c0){var _0x40b52b={},_0x3cd66c={},_0x747228={'count':0x0,'rows':[]};var _0x3c6ff8=_[_0xbc03('0x26')](db['SquareDetailsReport']['rawAttributes'],function(_0x5503d6){return{'name':_0x5503d6[_0xbc03('0x27')],'type':_0x5503d6[_0xbc03('0x28')][_0xbc03('0x29')]};});_0x3cd66c[_0xbc03('0x2a')]=_[_0xbc03('0x26')](_0x3c6ff8,_0xbc03('0x23'));_0x3cd66c[_0xbc03('0x2b')]=_[_0xbc03('0x2c')](_0x2d446b[_0xbc03('0x2b')]);_0x3cd66c[_0xbc03('0x2d')]=_[_0xbc03('0x2e')](_0x3cd66c[_0xbc03('0x2a')],_0x3cd66c['query']);_0x40b52b[_0xbc03('0x2f')]=_[_0xbc03('0x2e')](_0x3cd66c[_0xbc03('0x2a')],qs['fields'](_0x2d446b[_0xbc03('0x2b')][_0xbc03('0x30')]));_0x40b52b[_0xbc03('0x2f')]=_0x40b52b[_0xbc03('0x2f')][_0xbc03('0x31')]?_0x40b52b['attributes']:_0x3cd66c[_0xbc03('0x2a')];if(!_0x2d446b[_0xbc03('0x2b')]['hasOwnProperty'](_0xbc03('0x32'))){_0x40b52b[_0xbc03('0x1c')]=qs['limit'](_0x2d446b['query'][_0xbc03('0x1c')]);_0x40b52b[_0xbc03('0x1a')]=qs[_0xbc03('0x1a')](_0x2d446b['query']['offset']);}_0x40b52b[_0xbc03('0x33')]=qs[_0xbc03('0x34')](_0x2d446b[_0xbc03('0x2b')]['sort']);_0x40b52b[_0xbc03('0x35')]=qs[_0xbc03('0x2d')](_[_0xbc03('0x36')](_0x2d446b[_0xbc03('0x2b')],_0x3cd66c[_0xbc03('0x2d')]),_0x3c6ff8);if(_0x2d446b[_0xbc03('0x2b')]['filter']){_0x40b52b[_0xbc03('0x35')]=_['merge'](_0x40b52b[_0xbc03('0x35')],{'$or':_['map'](_0x3c6ff8,function(_0x2acd33){if(_0x2acd33[_0xbc03('0x28')]!==_0xbc03('0x37')){var _0x165570={};_0x165570[_0x2acd33[_0xbc03('0x23')]]={'$like':'%'+_0x2d446b[_0xbc03('0x2b')][_0xbc03('0x38')]+'%'};return _0x165570;}})});}_0x40b52b=_[_0xbc03('0x39')]({},_0x40b52b,_0x2d446b[_0xbc03('0x3a')]);var _0x503dba={'where':_0x40b52b[_0xbc03('0x35')]};return db[_0xbc03('0x3b')][_0xbc03('0x1d')](_0x503dba)[_0xbc03('0x1f')](function(_0x34db97){_0x747228[_0xbc03('0x1d')]=_0x34db97;if(_0x2d446b[_0xbc03('0x2b')]['includeAll']){_0x40b52b[_0xbc03('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xbc03('0x3d')](_0x40b52b);})[_0xbc03('0x1f')](function(_0x2f245c){_0x747228[_0xbc03('0x3e')]=_0x2f245c;return _0x747228;})['then'](respondWithFilteredResult(_0x3044c0,_0x40b52b))['catch'](handleError(_0x3044c0,null));};exports['show']=function(_0x2f24f9,_0x2a7299){var _0x52e639={'raw':!![],'where':{'id':_0x2f24f9[_0xbc03('0x3f')]['id']}},_0x4c986d={};_0x4c986d[_0xbc03('0x2a')]=_['keys'](db['SquareDetailsReport'][_0xbc03('0x40')]);_0x4c986d[_0xbc03('0x2b')]=_[_0xbc03('0x2c')](_0x2f24f9[_0xbc03('0x2b')]);_0x4c986d[_0xbc03('0x2d')]=_['intersection'](_0x4c986d[_0xbc03('0x2a')],_0x4c986d[_0xbc03('0x2b')]);_0x52e639['attributes']=_[_0xbc03('0x2e')](_0x4c986d[_0xbc03('0x2a')],qs[_0xbc03('0x30')](_0x2f24f9['query'][_0xbc03('0x30')]));_0x52e639['attributes']=_0x52e639['attributes'][_0xbc03('0x31')]?_0x52e639[_0xbc03('0x2f')]:_0x4c986d[_0xbc03('0x2a')];if(_0x2f24f9[_0xbc03('0x2b')][_0xbc03('0x41')]){_0x52e639[_0xbc03('0x3c')]=[{'all':!![]}];}_0x52e639=_[_0xbc03('0x39')]({},_0x52e639,_0x2f24f9[_0xbc03('0x3a')]);return db[_0xbc03('0x3b')][_0xbc03('0x42')](_0x52e639)[_0xbc03('0x1f')](handleEntityNotFound(_0x2a7299,null))[_0xbc03('0x1f')](respondWithResult(_0x2a7299,null))[_0xbc03('0x43')](handleError(_0x2a7299,null));};exports[_0xbc03('0x44')]=function(_0x112813,_0x4cfe2a){return db[_0xbc03('0x3b')][_0xbc03('0x44')](_0x112813[_0xbc03('0x45')],{})[_0xbc03('0x1f')](respondWithResult(_0x4cfe2a,0xc9))[_0xbc03('0x43')](handleError(_0x4cfe2a,null));};exports[_0xbc03('0x46')]=function(_0x2f90b4,_0x3edcba){if(_0x2f90b4[_0xbc03('0x45')]['id']){delete _0x2f90b4[_0xbc03('0x45')]['id'];}return db[_0xbc03('0x3b')]['find']({'where':{'id':_0x2f90b4[_0xbc03('0x3f')]['id']}})[_0xbc03('0x1f')](handleEntityNotFound(_0x3edcba,null))[_0xbc03('0x1f')](saveUpdates(_0x2f90b4[_0xbc03('0x45')],null))[_0xbc03('0x1f')](respondWithResult(_0x3edcba,null))[_0xbc03('0x43')](handleError(_0x3edcba,null));};exports['destroy']=function(_0xaf5961,_0x5b31e0){return db[_0xbc03('0x3b')][_0xbc03('0x42')]({'where':{'id':_0xaf5961['params']['id']}})[_0xbc03('0x1f')](handleEntityNotFound(_0x5b31e0,null))[_0xbc03('0x1f')](removeEntity(_0x5b31e0,null))[_0xbc03('0x43')](handleError(_0x5b31e0,null));};exports['describe']=function(_0x28d6d4,_0x5c451f){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x5c451f,null))[_0xbc03('0x43')](handleError(_0x5c451f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7077a2b..359911d 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 _0x20f3=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2c23ab,_0x3da84b){var _0x5320d6=function(_0x27a085){while(--_0x27a085){_0x2c23ab['push'](_0x2c23ab['shift']());}};_0x5320d6(++_0x3da84b);}(_0x20f3,0x157));var _0x320f=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x20f3[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0x320f('0x0'));var util=require(_0x320f('0x1'));var logger=require(_0x320f('0x2'))(_0x320f('0x3'));var moment=require(_0x320f('0x4'));var BPromise=require('bluebird');var rp=require(_0x320f('0x5'));var fs=require('fs');var path=require(_0x320f('0x6'));var rimraf=require(_0x320f('0x7'));var config=require(_0x320f('0x8'));var attributes=require(_0x320f('0x9'));module[_0x320f('0xa')]=function(_0x4254f4,_0x2631d4){return _0x4254f4[_0x320f('0xb')](_0x320f('0xc'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9012=['bluebird','request-promise','path','rimraf','../../config/environment','define','SquareDetailsReport','../../config/logger','api'];(function(_0x1b018a,_0x18a424){var _0x4b73f3=function(_0x2c0ee3){while(--_0x2c0ee3){_0x1b018a['push'](_0x1b018a['shift']());}};_0x4b73f3(++_0x18a424);}(_0x9012,0x6a));var _0x2901=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x9012[_0x1943d9];return _0x4b4f3f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2901('0x0'))(_0x2901('0x1'));var moment=require('moment');var BPromise=require(_0x2901('0x2'));var rp=require(_0x2901('0x3'));var fs=require('fs');var path=require(_0x2901('0x4'));var rimraf=require(_0x2901('0x5'));var config=require(_0x2901('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x49d93f,_0x3efa69){return _0x49d93f[_0x2901('0x7')](_0x2901('0x8'),attributes,{'tableName':'report_square_details','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 99fff9c..8ce764c 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 _0x7382=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','stringify','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x7382,0x111));var _0x2738=function(_0x3839f4,_0x1ef286){_0x3839f4=_0x3839f4-0x0;var _0x3888d9=_0x7382[_0x3839f4];return _0x3888d9;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});}; \ No newline at end of file +var _0x34b7=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x34b7,0x196));var _0x734b=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0x34b7[_0x1781de];return _0x48d7fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateSquareDetailsReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7fad40c..0ecc471 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 _0xdfd0=['/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','get'];(function(_0x5f2105,_0x47a4ca){var _0x7758d7=function(_0x3c57fd){while(--_0x3c57fd){_0x5f2105['push'](_0x5f2105['shift']());}};_0x7758d7(++_0x47a4ca);}(_0xdfd0,0x19a));var _0x0dfd=function(_0x31159f,_0x474997){_0x31159f=_0x31159f-0x0;var _0x120da2=_0xdfd0[_0x31159f];return _0x120da2;};'use strict';var express=require(_0x0dfd('0x0'));var router=express[_0x0dfd('0x1')]();var auth=require(_0x0dfd('0x2'));var controller=require(_0x0dfd('0x3'));router['get']('/',auth[_0x0dfd('0x4')](),controller['index']);router[_0x0dfd('0x5')](_0x0dfd('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0x0dfd('0x7')]=router; \ No newline at end of file +var _0xa4f1=['express','Router','../../components/auth/service','isAuthenticated','index','get','exports'];(function(_0x2cd97e,_0x2d24e1){var _0x1bfbc4=function(_0x5dc4ec){while(--_0x5dc4ec){_0x2cd97e['push'](_0x2cd97e['shift']());}};_0x1bfbc4(++_0x2d24e1);}(_0xa4f1,0x1ce));var _0x1a4f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa4f1[_0x27af45];return _0x18df21;};'use strict';var express=require(_0x1a4f('0x0'));var router=express[_0x1a4f('0x1')]();var auth=require(_0x1a4f('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0x1a4f('0x3')](),controller[_0x1a4f('0x4')]);router[_0x1a4f('0x5')]('/process/:pid/kill',auth[_0x1a4f('0x3')](),controller['killProcess']);module[_0x1a4f('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5f3c135..6cb8c1e 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 _0xe4aa=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','format','catch','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xe4aa,0xef));var _0xae4a=function(_0x2d27d5,_0x36ee88){_0x2d27d5=_0x2d27d5-0x0;var _0x510d35=_0xe4aa[_0x2d27d5];return _0x510d35;};'use strict';var info=require('systeminformation');var exec=require(_0xae4a('0x0'))[_0xae4a('0x1')];var logger=require(_0xae4a('0x2'))(_0xae4a('0x3'));var util=require(_0xae4a('0x4'));var BPromise=require(_0xae4a('0x5'));var _=require(_0xae4a('0x6'));function handleError(_0x2bce4f,_0x188199,_0x263aa4){_0x188199=_0x188199||0x1f4;return function(_0x23ec7b){logger['error'](_0xae4a('0x7'),_0x263aa4,_0x188199,util['inspect'](_0x23ec7b,{'showHidden':![],'depth':null}));delete _0x23ec7b[_0xae4a('0x8')];_0x2bce4f[_0xae4a('0x9')](_0x188199)[_0xae4a('0xa')](_0x23ec7b);};}exports[_0xae4a('0xb')]=function(_0x39c4b8,_0x3096df){return info[_0xae4a('0xc')]()[_0xae4a('0xd')](function(_0xa1271d){return _0x3096df['status'](0xc8)['json'](_0xa1271d);})['catch'](function(_0x12bbaf){return _0x3096df['status'](0x1f4)[_0xae4a('0xe')](_0x12bbaf);});};exports[_0xae4a('0xf')]=function(_0x36a0c0,_0x4c70d5){var _0x5157d7=[_0xae4a('0x10')];return new BPromise(function(_0x1fd9da,_0x3050b6){return exec(util['format'](_0xae4a('0x11'),_0x36a0c0[_0xae4a('0x12')][_0xae4a('0x13')]),function(_0x25bcdd,_0x150249,_0x4733e9){if(_0x25bcdd){return _0x3050b6(_0x25bcdd);}return _0x1fd9da(_0x150249);});})[_0xae4a('0xd')](function(_0x17cca7){var _0x2082f5=![];var _0x57f4ec=_0x17cca7[_0xae4a('0x14')](/\n/);for(var _0x28c91e=0x0,_0x2c3632=_0x5157d7[_0xae4a('0x15')];_0x28c91e<_0x2c3632,_0x2082f5===![];_0x28c91e+=0x1){if(_0x17cca7['indexOf'](_0x5157d7[_0x28c91e])>=0x0){_0x2082f5=!![];}}if(!_0x2082f5){throw new Error(util['format'](_0xae4a('0x16'),_0x36a0c0['params'][_0xae4a('0x13')]));}process['kill'](_0x36a0c0['params'][_0xae4a('0x13')],_0xae4a('0x17'));return _0x4c70d5[_0xae4a('0x9')](0xc8)['json']({'message':util[_0xae4a('0x18')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x36a0c0[_0xae4a('0x12')][_0xae4a('0x13')])});})[_0xae4a('0x19')](handleError(_0x4c70d5,null,'killProcess'));}; \ No newline at end of file +var _0xa925=['getAllData','then','status','catch','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','error','inspect','name','send','index'];(function(_0x2c18af,_0x30f01a){var _0x5d5146=function(_0x9c9ce8){while(--_0x9c9ce8){_0x2c18af['push'](_0x2c18af['shift']());}};_0x5d5146(++_0x30f01a);}(_0xa925,0x81));var _0x5a92=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa925[_0x424a9a];return _0xa7831c;};'use strict';var info=require(_0x5a92('0x0'));var exec=require(_0x5a92('0x1'))[_0x5a92('0x2')];var logger=require(_0x5a92('0x3'))(_0x5a92('0x4'));var util=require('util');var BPromise=require(_0x5a92('0x5'));var _=require('lodash');function handleError(_0x4327cc,_0x26bd4d,_0x2d5da3){_0x26bd4d=_0x26bd4d||0x1f4;return function(_0x22b735){logger[_0x5a92('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2d5da3,_0x26bd4d,util[_0x5a92('0x7')](_0x22b735,{'showHidden':![],'depth':null}));delete _0x22b735[_0x5a92('0x8')];_0x4327cc['status'](_0x26bd4d)[_0x5a92('0x9')](_0x22b735);};}exports[_0x5a92('0xa')]=function(_0x252f62,_0x441c23){return info[_0x5a92('0xb')]()[_0x5a92('0xc')](function(_0x57e6b4){return _0x441c23[_0x5a92('0xd')](0xc8)['json'](_0x57e6b4);})[_0x5a92('0xe')](function(_0x5e32e0){return _0x441c23[_0x5a92('0xd')](0x1f4)[_0x5a92('0xf')](_0x5e32e0);});};exports[_0x5a92('0x10')]=function(_0x3c500,_0x58b8ba){var _0x3763b5=['components/import/cm'];return new BPromise(function(_0x590701,_0x1ddde5){return exec(util[_0x5a92('0x11')](_0x5a92('0x12'),_0x3c500['params'][_0x5a92('0x13')]),function(_0x378c27,_0x5c5c19,_0x177be8){if(_0x378c27){return _0x1ddde5(_0x378c27);}return _0x590701(_0x5c5c19);});})[_0x5a92('0xc')](function(_0x1ecb58){var _0xc0c67e=![];var _0x159658=_0x1ecb58[_0x5a92('0x14')](/\n/);for(var _0x448fcd=0x0,_0x662b69=_0x3763b5[_0x5a92('0x15')];_0x448fcd<_0x662b69,_0xc0c67e===![];_0x448fcd+=0x1){if(_0x1ecb58[_0x5a92('0x16')](_0x3763b5[_0x448fcd])>=0x0){_0xc0c67e=!![];}}if(!_0xc0c67e){throw new Error(util[_0x5a92('0x11')](_0x5a92('0x17'),_0x3c500[_0x5a92('0x18')][_0x5a92('0x13')]));}process[_0x5a92('0x19')](_0x3c500[_0x5a92('0x18')]['pid'],_0x5a92('0x1a'));return _0x58b8ba[_0x5a92('0xd')](0xc8)[_0x5a92('0xf')]({'message':util[_0x5a92('0x11')](_0x5a92('0x1b'),_0x3c500[_0x5a92('0x18')]['pid'])});})[_0x5a92('0xe')](handleError(_0x58b8ba,null,_0x5a92('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 90cf80f..2716569 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 _0xce62=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x5c2bef,_0x16806e){var _0xd60cc1=function(_0x40e74a){while(--_0x40e74a){_0x5c2bef['push'](_0x5c2bef['shift']());}};_0xd60cc1(++_0x16806e);}(_0xce62,0x83));var _0x2ce6=function(_0x3ea055,_0x417051){_0x3ea055=_0x3ea055-0x0;var _0x49f289=_0xce62[_0x3ea055];return _0x49f289;};'use strict';var multer=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var path=require('path');var timeout=require(_0x2ce6('0x2'));var express=require(_0x2ce6('0x3'));var router=express[_0x2ce6('0x4')]();var fs_extra=require(_0x2ce6('0x5'));var auth=require(_0x2ce6('0x6'));var interaction=require(_0x2ce6('0x7'));var config=require('../../config/environment');var controller=require(_0x2ce6('0x8'));router[_0x2ce6('0x9')]('/',auth[_0x2ce6('0xa')](),controller[_0x2ce6('0xb')]);router[_0x2ce6('0x9')](_0x2ce6('0xc'),auth['isAuthenticated'](),controller[_0x2ce6('0xd')]);router[_0x2ce6('0xe')]('/',auth['isAuthenticated'](),controller[_0x2ce6('0xf')]);router[_0x2ce6('0x10')](_0x2ce6('0xc'),auth['isAuthenticated'](),controller[_0x2ce6('0x11')]);router['delete']('/:id',auth[_0x2ce6('0xa')](),controller['destroy']);module[_0x2ce6('0x12')]=router; \ No newline at end of file +var _0x6140=['show','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','/:id'];(function(_0x1c7589,_0x330f84){var _0x4327e3=function(_0x10373e){while(--_0x10373e){_0x1c7589['push'](_0x1c7589['shift']());}};_0x4327e3(++_0x330f84);}(_0x6140,0x125));var _0x0614=function(_0x36a72a,_0x1ce555){_0x36a72a=_0x36a72a-0x0;var _0x3bffb2=_0x6140[_0x36a72a];return _0x3bffb2;};'use strict';var multer=require(_0x0614('0x0'));var util=require('util');var path=require(_0x0614('0x1'));var timeout=require(_0x0614('0x2'));var express=require(_0x0614('0x3'));var router=express[_0x0614('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0614('0x5'));var config=require(_0x0614('0x6'));var controller=require(_0x0614('0x7'));router['get']('/',auth[_0x0614('0x8')](),controller[_0x0614('0x9')]);router['get'](_0x0614('0xa'),auth[_0x0614('0x8')](),controller[_0x0614('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0614('0xc')]);router[_0x0614('0xd')]('/:id',auth[_0x0614('0x8')](),controller['update']);router[_0x0614('0xe')](_0x0614('0xa'),auth[_0x0614('0x8')](),controller['destroy']);module[_0x0614('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b8d0d25..8b39618 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 _0xee4e=['STRING','#0091EA','sequelize','exports'];(function(_0x53d8df,_0x514c07){var _0x2a714e=function(_0x44d181){while(--_0x44d181){_0x53d8df['push'](_0x53d8df['shift']());}};_0x2a714e(++_0x514c07);}(_0xee4e,0x122));var _0xeee4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xee4e[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'name':{'type':Sequelize[_0xeee4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeee4('0x2')],'defaultValue':_0xeee4('0x3')},'description':{'type':Sequelize[_0xeee4('0x2')]}}; \ No newline at end of file +var _0x1a83=['STRING','sequelize','exports'];(function(_0x3784af,_0x52fd01){var _0x7be6b=function(_0x24f2d2){while(--_0x24f2d2){_0x3784af['push'](_0x3784af['shift']());}};_0x7be6b(++_0x52fd01);}(_0x1a83,0x1c0));var _0x31a8=function(_0x312896,_0x260369){_0x312896=_0x312896-0x0;var _0x2e5882=_0x1a83[_0x312896];return _0x2e5882;};'use strict';var Sequelize=require(_0x31a8('0x0'));module[_0x31a8('0x1')]={'name':{'type':Sequelize[_0x31a8('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x31a8('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x31a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b60586a..79df43e 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 _0xb43b=['rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','Tags','then','status','sendStatus','error','stack','name','send','index','Tag','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','params'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3233f7,_0x106774){_0x3233f7=_0x3233f7-0x0;var _0x1e5deb=_0xb43b[_0x3233f7];return _0x1e5deb;};'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(){var _0x53f0d5=_0x298ce2['get']({'plain':!![]});var _0x269ca5=_0xbb43('0x25');return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x269ca5,'resourceId':_0x53f0d5['id']}})[_0xbb43('0x26')](function(){return _0x298ce2;});})[_0xbb43('0x26')](function(){_0x4dfb7f[_0xbb43('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5342,_0x27fd7a){return function(_0x42800f){if(!_0x42800f){_0x4b5342[_0xbb43('0x28')](0x194);}return _0x42800f;};}function handleError(_0x8b3205,_0x510b05){_0x510b05=_0x510b05||0x1f4;return function(_0x40b04b){logger[_0xbb43('0x29')](_0x40b04b[_0xbb43('0x2a')]);if(_0x40b04b['name']){delete _0x40b04b[_0xbb43('0x2b')];}_0x8b3205['status'](_0x510b05)[_0xbb43('0x2c')](_0x40b04b);};}exports[_0xbb43('0x2d')]=function(_0x34f5b2,_0x1880cd){var _0x555b99={},_0x157d62={},_0x547a6f={'count':0x0,'rows':[]};var _0x5566cf=_['map'](db[_0xbb43('0x2e')]['rawAttributes'],function(_0xa7e144){return{'name':_0xa7e144[_0xbb43('0x2f')],'type':_0xa7e144[_0xbb43('0x30')]['key']};});_0x157d62[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x5566cf,_0xbb43('0x2b'));_0x157d62[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x34f5b2[_0xbb43('0x33')]);_0x157d62[_0xbb43('0x35')]=_[_0xbb43('0x36')](_0x157d62['model'],_0x157d62[_0xbb43('0x33')]);_0x555b99[_0xbb43('0x37')]=_[_0xbb43('0x36')](_0x157d62[_0xbb43('0x31')],qs[_0xbb43('0x38')](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x38')]));_0x555b99[_0xbb43('0x37')]=_0x555b99[_0xbb43('0x37')][_0xbb43('0x39')]?_0x555b99[_0xbb43('0x37')]:_0x157d62[_0xbb43('0x31')];if(!_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x3a')](_0xbb43('0x3b'))){_0x555b99[_0xbb43('0x1d')]=qs['limit'](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x1d')]);_0x555b99['offset']=qs[_0xbb43('0x1c')](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x1c')]);}_0x555b99['order']=qs['sort'](_0x34f5b2['query'][_0xbb43('0x3c')]);_0x555b99[_0xbb43('0x3d')]=qs['filters'](_['pick'](_0x34f5b2[_0xbb43('0x33')],_0x157d62[_0xbb43('0x35')]),_0x5566cf);if(_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x3e')]){_0x555b99[_0xbb43('0x3d')]=_['merge'](_0x555b99[_0xbb43('0x3d')],{'$or':_[_0xbb43('0x32')](_0x5566cf,function(_0x2cd8b8){if(_0x2cd8b8[_0xbb43('0x30')]!==_0xbb43('0x3f')){var _0x531d96={};_0x531d96[_0x2cd8b8[_0xbb43('0x2b')]]={'$like':'%'+_0x34f5b2['query'][_0xbb43('0x3e')]+'%'};return _0x531d96;}})});}_0x555b99=_[_0xbb43('0x40')]({},_0x555b99,_0x34f5b2['options']);var _0x4783fe={'where':_0x555b99['where']};return db[_0xbb43('0x2e')][_0xbb43('0x1b')](_0x4783fe)[_0xbb43('0x26')](function(_0xb84ece){_0x547a6f['count']=_0xb84ece;if(_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x41')]){_0x555b99['include']=[{'all':!![]}];}return db[_0xbb43('0x2e')]['findAll'](_0x555b99);})[_0xbb43('0x26')](function(_0x14285d){_0x547a6f[_0xbb43('0x42')]=_0x14285d;return _0x547a6f;})[_0xbb43('0x26')](respondWithFilteredResult(_0x1880cd,_0x555b99))[_0xbb43('0x43')](handleError(_0x1880cd,null));};exports[_0xbb43('0x44')]=function(_0x4bf8ed,_0x1beb2a){var _0x5686ee={'raw':!![],'where':{'id':_0x4bf8ed[_0xbb43('0x45')]['id']}},_0x307f1e={};_0x307f1e[_0xbb43('0x31')]=_[_0xbb43('0x34')](db['Tag'][_0xbb43('0x46')]);_0x307f1e[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x4bf8ed[_0xbb43('0x33')]);_0x307f1e[_0xbb43('0x35')]=_[_0xbb43('0x36')](_0x307f1e[_0xbb43('0x31')],_0x307f1e[_0xbb43('0x33')]);_0x5686ee['attributes']=_[_0xbb43('0x36')](_0x307f1e[_0xbb43('0x31')],qs['fields'](_0x4bf8ed[_0xbb43('0x33')]['fields']));_0x5686ee['attributes']=_0x5686ee['attributes']['length']?_0x5686ee[_0xbb43('0x37')]:_0x307f1e['model'];if(_0x4bf8ed[_0xbb43('0x33')]['includeAll']){_0x5686ee[_0xbb43('0x47')]=[{'all':!![]}];}_0x5686ee=_[_0xbb43('0x40')]({},_0x5686ee,_0x4bf8ed[_0xbb43('0x48')]);return db['Tag'][_0xbb43('0x49')](_0x5686ee)['then'](handleEntityNotFound(_0x1beb2a,null))[_0xbb43('0x26')](respondWithResult(_0x1beb2a,null))[_0xbb43('0x43')](handleError(_0x1beb2a,null));};exports[_0xbb43('0x4a')]=function(_0x29840e,_0x417ad9){return db[_0xbb43('0x2e')][_0xbb43('0x4a')](_0x29840e['body'],{})[_0xbb43('0x26')](function(_0x26ea59){var _0x202059=_0x29840e[_0xbb43('0x4b')]['get']({'plain':!![]});if(!_0x202059)throw new Error(_0xbb43('0x4c'));if(_0x202059[_0xbb43('0x4d')]===_0xbb43('0x4b')){var _0xb1883e=_0x26ea59['get']({'plain':!![]});var _0x3206c0=_0xbb43('0x25');return db[_0xbb43('0x4e')]['find']({'where':{'name':_0x3206c0,'userProfileId':_0x202059[_0xbb43('0x4f')]},'raw':!![]})[_0xbb43('0x26')](function(_0x73d4ce){if(_0x73d4ce&&_0x73d4ce[_0xbb43('0x50')]===0x0){return db[_0xbb43('0x51')]['create']({'name':_0xb1883e['name'],'resourceId':_0xb1883e['id'],'type':_0x73d4ce[_0xbb43('0x2b')],'sectionId':_0x73d4ce['id']},{})['then'](function(){return _0x26ea59;});}else{return _0x26ea59;}})[_0xbb43('0x43')](function(_0xe0cdba){logger['error'](_0xbb43('0x52'),_0xe0cdba);throw _0xe0cdba;});}return _0x26ea59;})[_0xbb43('0x26')](respondWithResult(_0x417ad9,0xc9))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x23')]=function(_0x1dfbb9,_0x5cb3c6){if(_0x1dfbb9[_0xbb43('0x53')]['id']){delete _0x1dfbb9['body']['id'];}return db['Tag'][_0xbb43('0x49')]({'where':{'id':_0x1dfbb9[_0xbb43('0x45')]['id']}})[_0xbb43('0x26')](handleEntityNotFound(_0x5cb3c6,null))[_0xbb43('0x26')](saveUpdates(_0x1dfbb9[_0xbb43('0x53')],null))['then'](respondWithResult(_0x5cb3c6,null))['catch'](handleError(_0x5cb3c6,null));};exports[_0xbb43('0x24')]=function(_0x157824,_0x3a84ad){return db[_0xbb43('0x2e')][_0xbb43('0x49')]({'where':{'id':_0x157824[_0xbb43('0x45')]['id']}})[_0xbb43('0x26')](handleEntityNotFound(_0x3a84ad,null))[_0xbb43('0x26')](removeEntity(_0x3a84ad,null))[_0xbb43('0x43')](handleError(_0x3a84ad,null));}; \ No newline at end of file +var _0x66fa=['status','offset','undefined','limit','count','Content-Range','reject','update','then','get','Tags','UserProfileResource','end','error','name','map','Tag','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x333426,_0x576bc2){var _0x26600f=function(_0x3af3fe){while(--_0x3af3fe){_0x333426['push'](_0x333426['shift']());}};_0x26600f(++_0x576bc2);}(_0x66fa,0x168));var _0xa66f=function(_0x187208,_0x363ec9){_0x187208=_0x187208-0x0;var _0x41f439=_0x66fa[_0x187208];return _0x41f439;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require(_0xa66f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var Mustache=require(_0xa66f('0x5'));var util=require(_0xa66f('0x6'));var path=require(_0xa66f('0x7'));var sox=require(_0xa66f('0x8'));var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var fs_extra=require(_0xa66f('0xb'));var _=require(_0xa66f('0xc'));var squel=require(_0xa66f('0xd'));var crypto=require('crypto');var jsforce=require(_0xa66f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa66f('0x9'));var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require(_0xa66f('0x11'));var qs=require(_0xa66f('0x12'));var as=require(_0xa66f('0x13'));var hardwareService=require(_0xa66f('0x14'));var logger=require(_0xa66f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa66f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x17'))['db'];function respondWithStatusCode(_0x6ad626,_0x1162c0){_0x1162c0=_0x1162c0||0xcc;return function(_0x4b0dad){if(_0x4b0dad){return _0x6ad626[_0xa66f('0x18')](_0x1162c0);}return _0x6ad626[_0xa66f('0x19')](_0x1162c0)['end']();};}function respondWithResult(_0xaa9ef5,_0x24423a){_0x24423a=_0x24423a||0xc8;return function(_0x263e64){if(_0x263e64){return _0xaa9ef5[_0xa66f('0x19')](_0x24423a)['json'](_0x263e64);}};}function respondWithFilteredResult(_0x3795cb,_0x27f04e){return function(_0x5685c4){if(_0x5685c4){var _0x2d9ec7=typeof _0x27f04e[_0xa66f('0x1a')]===_0xa66f('0x1b')&&typeof _0x27f04e[_0xa66f('0x1c')]===_0xa66f('0x1b');var _0x362988=_0x5685c4['count'];var _0x4d5e31=_0x2d9ec7?0x0:_0x27f04e[_0xa66f('0x1a')];var _0x16648b=_0x2d9ec7?_0x5685c4[_0xa66f('0x1d')]:_0x27f04e[_0xa66f('0x1a')]+_0x27f04e['limit'];var _0x1e448e;if(_0x16648b>=_0x362988){_0x16648b=_0x362988;_0x1e448e=0xc8;}else{_0x1e448e=0xce;}_0x3795cb[_0xa66f('0x19')](_0x1e448e);return _0x3795cb['set'](_0xa66f('0x1e'),_0x4d5e31+'-'+_0x16648b+'/'+_0x362988)['json'](_0x5685c4);}return null;};}function patchUpdates(_0x3f4977){return function(_0x32d0a9){try{jsonpatch['apply'](_0x32d0a9,_0x3f4977,!![]);}catch(_0x585208){return BPromise[_0xa66f('0x1f')](_0x585208);}return _0x32d0a9['save']();};}function saveUpdates(_0x5b2cf0,_0x59f7aa){return function(_0x535359){if(_0x535359){return _0x535359[_0xa66f('0x20')](_0x5b2cf0)[_0xa66f('0x21')](function(_0x1aeaf2){return _0x1aeaf2;});}return null;};}function removeEntity(_0x4cfec6,_0x20bf81){return function(_0xe5e0f1){if(_0xe5e0f1){return _0xe5e0f1['destroy']()[_0xa66f('0x21')](function(){var _0x473b00=_0xe5e0f1[_0xa66f('0x22')]({'plain':!![]});var _0x29dfe5=_0xa66f('0x23');return db[_0xa66f('0x24')]['destroy']({'where':{'type':_0x29dfe5,'resourceId':_0x473b00['id']}})['then'](function(){return _0xe5e0f1;});})[_0xa66f('0x21')](function(){_0x4cfec6['status'](0xcc)[_0xa66f('0x25')]();});}};}function handleEntityNotFound(_0x278531,_0x2cf4c9){return function(_0x49e1b3){if(!_0x49e1b3){_0x278531[_0xa66f('0x18')](0x194);}return _0x49e1b3;};}function handleError(_0x4ca0a4,_0x52c615){_0x52c615=_0x52c615||0x1f4;return function(_0x4c7b82){logger[_0xa66f('0x26')](_0x4c7b82['stack']);if(_0x4c7b82[_0xa66f('0x27')]){delete _0x4c7b82[_0xa66f('0x27')];}_0x4ca0a4[_0xa66f('0x19')](_0x52c615)['send'](_0x4c7b82);};}exports['index']=function(_0x3ad042,_0x416c25){var _0xb7a0a3={},_0x5583eb={},_0x46c525={'count':0x0,'rows':[]};var _0x56116a=_[_0xa66f('0x28')](db[_0xa66f('0x29')][_0xa66f('0x2a')],function(_0x36525b){return{'name':_0x36525b[_0xa66f('0x2b')],'type':_0x36525b[_0xa66f('0x2c')]['key']};});_0x5583eb[_0xa66f('0x2d')]=_[_0xa66f('0x28')](_0x56116a,'name');_0x5583eb[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x3ad042['query']);_0x5583eb['filters']=_[_0xa66f('0x30')](_0x5583eb[_0xa66f('0x2d')],_0x5583eb[_0xa66f('0x2e')]);_0xb7a0a3[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x5583eb[_0xa66f('0x2d')],qs['fields'](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x32')]));_0xb7a0a3[_0xa66f('0x31')]=_0xb7a0a3[_0xa66f('0x31')]['length']?_0xb7a0a3['attributes']:_0x5583eb[_0xa66f('0x2d')];if(!_0x3ad042['query'][_0xa66f('0x33')](_0xa66f('0x34'))){_0xb7a0a3[_0xa66f('0x1c')]=qs[_0xa66f('0x1c')](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x1c')]);_0xb7a0a3[_0xa66f('0x1a')]=qs[_0xa66f('0x1a')](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x1a')]);}_0xb7a0a3[_0xa66f('0x35')]=qs[_0xa66f('0x36')](_0x3ad042['query'][_0xa66f('0x36')]);_0xb7a0a3[_0xa66f('0x37')]=qs['filters'](_[_0xa66f('0x38')](_0x3ad042['query'],_0x5583eb[_0xa66f('0x39')]),_0x56116a);if(_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3a')]){_0xb7a0a3[_0xa66f('0x37')]=_['merge'](_0xb7a0a3[_0xa66f('0x37')],{'$or':_[_0xa66f('0x28')](_0x56116a,function(_0x1d68ae){if(_0x1d68ae[_0xa66f('0x2c')]!=='VIRTUAL'){var _0x111e80={};_0x111e80[_0x1d68ae['name']]={'$like':'%'+_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3a')]+'%'};return _0x111e80;}})});}_0xb7a0a3=_[_0xa66f('0x3b')]({},_0xb7a0a3,_0x3ad042[_0xa66f('0x3c')]);var _0x48c375={'where':_0xb7a0a3[_0xa66f('0x37')]};return db['Tag'][_0xa66f('0x1d')](_0x48c375)[_0xa66f('0x21')](function(_0x2f9b5f){_0x46c525[_0xa66f('0x1d')]=_0x2f9b5f;if(_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3d')]){_0xb7a0a3[_0xa66f('0x3e')]=[{'all':!![]}];}return db[_0xa66f('0x29')][_0xa66f('0x3f')](_0xb7a0a3);})[_0xa66f('0x21')](function(_0x324818){_0x46c525[_0xa66f('0x40')]=_0x324818;return _0x46c525;})[_0xa66f('0x21')](respondWithFilteredResult(_0x416c25,_0xb7a0a3))[_0xa66f('0x41')](handleError(_0x416c25,null));};exports[_0xa66f('0x42')]=function(_0x4f43e1,_0x2a2f46){var _0x3fe92d={'raw':!![],'where':{'id':_0x4f43e1['params']['id']}},_0x70f6da={};_0x70f6da[_0xa66f('0x2d')]=_['keys'](db[_0xa66f('0x29')][_0xa66f('0x2a')]);_0x70f6da[_0xa66f('0x2e')]=_['keys'](_0x4f43e1['query']);_0x70f6da[_0xa66f('0x39')]=_[_0xa66f('0x30')](_0x70f6da[_0xa66f('0x2d')],_0x70f6da[_0xa66f('0x2e')]);_0x3fe92d[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x70f6da['model'],qs[_0xa66f('0x32')](_0x4f43e1[_0xa66f('0x2e')]['fields']));_0x3fe92d['attributes']=_0x3fe92d[_0xa66f('0x31')][_0xa66f('0x43')]?_0x3fe92d[_0xa66f('0x31')]:_0x70f6da[_0xa66f('0x2d')];if(_0x4f43e1[_0xa66f('0x2e')]['includeAll']){_0x3fe92d[_0xa66f('0x3e')]=[{'all':!![]}];}_0x3fe92d=_[_0xa66f('0x3b')]({},_0x3fe92d,_0x4f43e1[_0xa66f('0x3c')]);return db[_0xa66f('0x29')][_0xa66f('0x44')](_0x3fe92d)['then'](handleEntityNotFound(_0x2a2f46,null))[_0xa66f('0x21')](respondWithResult(_0x2a2f46,null))[_0xa66f('0x41')](handleError(_0x2a2f46,null));};exports[_0xa66f('0x45')]=function(_0x2dc004,_0x35108c){return db['Tag']['create'](_0x2dc004[_0xa66f('0x46')],{})[_0xa66f('0x21')](function(_0x35d81f){var _0x312f1a=_0x2dc004[_0xa66f('0x47')][_0xa66f('0x22')]({'plain':!![]});if(!_0x312f1a)throw new Error(_0xa66f('0x48'));if(_0x312f1a[_0xa66f('0x49')]==='user'){var _0x396f4c=_0x35d81f[_0xa66f('0x22')]({'plain':!![]});var _0xb0c56=_0xa66f('0x23');return db[_0xa66f('0x4a')]['find']({'where':{'name':_0xb0c56,'userProfileId':_0x312f1a[_0xa66f('0x4b')]},'raw':!![]})[_0xa66f('0x21')](function(_0xc195b1){if(_0xc195b1&&_0xc195b1['autoAssociation']===0x0){return db['UserProfileResource'][_0xa66f('0x45')]({'name':_0x396f4c[_0xa66f('0x27')],'resourceId':_0x396f4c['id'],'type':_0xc195b1[_0xa66f('0x27')],'sectionId':_0xc195b1['id']},{})[_0xa66f('0x21')](function(){return _0x35d81f;});}else{return _0x35d81f;}})[_0xa66f('0x41')](function(_0x5b800e){logger[_0xa66f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b800e);throw _0x5b800e;});}return _0x35d81f;})[_0xa66f('0x21')](respondWithResult(_0x35108c,0xc9))[_0xa66f('0x41')](handleError(_0x35108c,null));};exports[_0xa66f('0x20')]=function(_0x4f3406,_0x11b725){if(_0x4f3406['body']['id']){delete _0x4f3406[_0xa66f('0x46')]['id'];}return db[_0xa66f('0x29')][_0xa66f('0x44')]({'where':{'id':_0x4f3406[_0xa66f('0x4c')]['id']}})[_0xa66f('0x21')](handleEntityNotFound(_0x11b725,null))[_0xa66f('0x21')](saveUpdates(_0x4f3406[_0xa66f('0x46')],null))['then'](respondWithResult(_0x11b725,null))['catch'](handleError(_0x11b725,null));};exports['destroy']=function(_0x1a057b,_0x334eca){return db[_0xa66f('0x29')][_0xa66f('0x44')]({'where':{'id':_0x1a057b[_0xa66f('0x4c')]['id']}})[_0xa66f('0x21')](handleEntityNotFound(_0x334eca,null))[_0xa66f('0x21')](removeEntity(_0x334eca,null))['catch'](handleError(_0x334eca,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index dca64fd..d05f323 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 _0x81a9=['moment','bluebird','request-promise','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','api'];(function(_0x15c0d0,_0x34a6ab){var _0xbd8ae=function(_0x13ee33){while(--_0x13ee33){_0x15c0d0['push'](_0x15c0d0['shift']());}};_0xbd8ae(++_0x34a6ab);}(_0x81a9,0x81));var _0x981a=function(_0x3984df,_0x372e53){_0x3984df=_0x3984df-0x0;var _0x3b7d61=_0x81a9[_0x3984df];return _0x3b7d61;};'use strict';var _=require(_0x981a('0x0'));var util=require('util');var logger=require(_0x981a('0x1'))(_0x981a('0x2'));var moment=require(_0x981a('0x3'));var BPromise=require(_0x981a('0x4'));var rp=require(_0x981a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x981a('0x6'));module[_0x981a('0x7')]=function(_0x561042,_0x41c223){return _0x561042[_0x981a('0x8')](_0x981a('0x9'),attributes,{'tableName':_0x981a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b19=['../../config/logger','bluebird','rimraf','../../config/environment','define','Tag','tools_tags','lodash'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x7b19,0x1df));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97b1('0x0'));var util=require('util');var logger=require(_0x97b1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x97b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97b1('0x3'));var config=require(_0x97b1('0x4'));var attributes=require('./tag.attributes');module['exports']=function(_0x277466,_0x27238){return _0x277466[_0x97b1('0x5')](_0x97b1('0x6'),attributes,{'tableName':_0x97b1('0x7'),'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 596f687..c29e295 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 _0x4ea3=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4ea3,0x70));var _0x34ea=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ea3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('Tag,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0xd58c=['jayson/promise','client','request','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','Tag,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2784ba,_0x4898b4){var _0x30247c=function(_0x26c7d4){while(--_0x26c7d4){_0x2784ba['push'](_0x2784ba['shift']());}};_0x30247c(++_0x4898b4);}(_0xd58c,0xb6));var _0xcd58=function(_0x4c167a,_0x1df785){_0x4c167a=_0x4c167a-0x0;var _0x4ebbc8=_0xd58c[_0x4c167a];return _0x4ebbc8;};'use strict';var _=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var moment=require(_0xcd58('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd58('0x5'))(_0xcd58('0x6'));var config=require(_0xcd58('0x7'));var jayson=require(_0xcd58('0x8'));var client=jayson[_0xcd58('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546187,_0x3f2c97,_0x31bf4e){return new BPromise(function(_0x43a501,_0x1ff4e9){return client[_0xcd58('0xa')](_0x546187,_0x31bf4e)['then'](function(_0x1ad5a1){logger[_0xcd58('0xb')]('Tag,\x20%s,\x20%s',_0x3f2c97,_0xcd58('0xc'));logger['debug'](_0xcd58('0xd'),_0x3f2c97,_0xcd58('0xc'),JSON[_0xcd58('0xe')](_0x1ad5a1));if(_0x1ad5a1['error']){if(_0x1ad5a1[_0xcd58('0xf')]['code']===0x1f4){logger[_0xcd58('0xf')]('Tag,\x20%s,\x20%s',_0x3f2c97,_0x1ad5a1[_0xcd58('0xf')][_0xcd58('0x10')]);return _0x1ff4e9(_0x1ad5a1[_0xcd58('0xf')][_0xcd58('0x10')]);}logger[_0xcd58('0xf')](_0xcd58('0x11'),_0x3f2c97,_0x1ad5a1[_0xcd58('0xf')][_0xcd58('0x10')]);return _0x43a501(_0x1ad5a1['error']['message']);}else{logger[_0xcd58('0xb')](_0xcd58('0x11'),_0x3f2c97,_0xcd58('0xc'));_0x43a501(_0x1ad5a1['result']['message']);}})[_0xcd58('0x12')](function(_0xeaee1f){logger[_0xcd58('0xf')]('Tag,\x20%s,\x20%s',_0x3f2c97,_0xeaee1f);_0x1ff4e9(_0xeaee1f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 82db054..b72a5f3 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 65e6fba..c96b656 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x475b08,_0x5e1cf3){var _0x540b75=function(_0x5ed79d){while(--_0x5ed79d){_0x475b08['push'](_0x475b08['shift']());}};_0x540b75(++_0x5e1cf3);}(_0xb10b,0x12a));var _0xbb10=function(_0x36fc1f,_0x27c1c8){_0x36fc1f=_0x36fc1f-0x0;var _0x371281=_0xb10b[_0x36fc1f];return _0x371281;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b450cbf..c2c7c48 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 _0xebb8=['to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','VoicePrefixId','end','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','order','addQueues','Queues','ids','removeQueues','findOne','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','removeAgents','Sms','Queue:remove','TeamVoicePrefix','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x48ab1f,_0x104e73){var _0xdb10e1=function(_0xc41671){while(--_0xc41671){_0x48ab1f['push'](_0x48ab1f['shift']());}};_0xdb10e1(++_0x104e73);}(_0xebb8,0x1d4));var _0x8ebb=function(_0x43fb15,_0x4b3f5b){_0x43fb15=_0x43fb15-0x0;var _0x42d47a=_0xebb8[_0x43fb15];return _0x42d47a;};'use strict';var emlformat=require(_0x8ebb('0x0'));var rimraf=require(_0x8ebb('0x1'));var zipdir=require(_0x8ebb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ebb('0x3'));var moment=require('moment');var BPromise=require(_0x8ebb('0x4'));var Mustache=require(_0x8ebb('0x5'));var util=require(_0x8ebb('0x6'));var path=require(_0x8ebb('0x7'));var sox=require(_0x8ebb('0x8'));var csv=require(_0x8ebb('0x9'));var ejs=require(_0x8ebb('0xa'));var fs=require('fs');var fs_extra=require(_0x8ebb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8ebb('0xc'));var deskjs=require(_0x8ebb('0xd'));var toCsv=require(_0x8ebb('0x9'));var querystring=require(_0x8ebb('0xe'));var Papa=require('papaparse');var Redis=require(_0x8ebb('0xf'));var authService=require(_0x8ebb('0x10'));var qs=require(_0x8ebb('0x11'));var as=require(_0x8ebb('0x12'));var hardwareService=require(_0x8ebb('0x13'));var logger=require(_0x8ebb('0x14'))(_0x8ebb('0x15'));var utils=require(_0x8ebb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ebb('0x17'));var db=require(_0x8ebb('0x18'))['db'];config[_0x8ebb('0x19')]=_['defaults'](config[_0x8ebb('0x19')],{'host':_0x8ebb('0x1a'),'port':0x18eb});var socket=require(_0x8ebb('0x1b'))(new Redis(config['redis']));require(_0x8ebb('0x1c'))[_0x8ebb('0x1d')](socket);function respondWithStatusCode(_0x30b62d,_0x698ba8){_0x698ba8=_0x698ba8||0xcc;return function(_0x43343e){if(_0x43343e){return _0x30b62d[_0x8ebb('0x1e')](_0x698ba8);}return _0x30b62d[_0x8ebb('0x1f')](_0x698ba8)['end']();};}function respondWithResult(_0x1266ff,_0x6999ff){_0x6999ff=_0x6999ff||0xc8;return function(_0xf32334){if(_0xf32334){return _0x1266ff['status'](_0x6999ff)[_0x8ebb('0x20')](_0xf32334);}};}function respondWithFilteredResult(_0x20371d,_0x4f2b76){return function(_0x376999){if(_0x376999){var _0x5e3630=typeof _0x4f2b76['offset']===_0x8ebb('0x21')&&typeof _0x4f2b76[_0x8ebb('0x22')]===_0x8ebb('0x21');var _0x2725ae=_0x376999[_0x8ebb('0x23')];var _0x43c54a=_0x5e3630?0x0:_0x4f2b76[_0x8ebb('0x24')];var _0x4c123b=_0x5e3630?_0x376999[_0x8ebb('0x23')]:_0x4f2b76['offset']+_0x4f2b76['limit'];var _0x6f0b20;if(_0x4c123b>=_0x2725ae){_0x4c123b=_0x2725ae;_0x6f0b20=0xc8;}else{_0x6f0b20=0xce;}_0x20371d['status'](_0x6f0b20);return _0x20371d['set'](_0x8ebb('0x25'),_0x43c54a+'-'+_0x4c123b+'/'+_0x2725ae)['json'](_0x376999);}return null;};}function patchUpdates(_0x9c6605){return function(_0x13b4a4){try{jsonpatch['apply'](_0x13b4a4,_0x9c6605,!![]);}catch(_0xe604da){return BPromise[_0x8ebb('0x26')](_0xe604da);}return _0x13b4a4[_0x8ebb('0x27')]();};}function saveUpdates(_0xabb8b4,_0x2a0a3d){return function(_0x48f554){if(_0x48f554){return _0x48f554['update'](_0xabb8b4)['then'](function(_0x217709){return _0x217709;});}return null;};}function handleEntityNotFound(_0xfb33fe,_0x369fd4){return function(_0x1f92db){if(!_0x1f92db){_0xfb33fe['sendStatus'](0x194);}return _0x1f92db;};}function handleError(_0x32287f,_0x184d16){_0x184d16=_0x184d16||0x1f4;return function(_0x13a209){logger[_0x8ebb('0x28')](_0x13a209[_0x8ebb('0x29')]);if(_0x13a209[_0x8ebb('0x2a')]){delete _0x13a209['name'];}_0x32287f[_0x8ebb('0x1f')](_0x184d16)[_0x8ebb('0x2b')](_0x13a209);};}exports[_0x8ebb('0x2c')]=function(_0x39d2c0,_0x3a41ee){var _0x415006={},_0x1bead9={},_0x39a10e={'count':0x0,'rows':[]};var _0x1d661a=_[_0x8ebb('0x2d')](db[_0x8ebb('0x2e')][_0x8ebb('0x2f')],function(_0x4d4a04){return{'name':_0x4d4a04[_0x8ebb('0x30')],'type':_0x4d4a04['type'][_0x8ebb('0x31')]};});_0x1bead9[_0x8ebb('0x32')]=_[_0x8ebb('0x2d')](_0x1d661a,_0x8ebb('0x2a'));_0x1bead9[_0x8ebb('0x33')]=_['keys'](_0x39d2c0[_0x8ebb('0x33')]);_0x1bead9['filters']=_[_0x8ebb('0x34')](_0x1bead9['model'],_0x1bead9['query']);_0x415006[_0x8ebb('0x35')]=_[_0x8ebb('0x34')](_0x1bead9[_0x8ebb('0x32')],qs[_0x8ebb('0x36')](_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x36')]));_0x415006[_0x8ebb('0x35')]=_0x415006[_0x8ebb('0x35')]['length']?_0x415006[_0x8ebb('0x35')]:_0x1bead9[_0x8ebb('0x32')];if(!_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x37')](_0x8ebb('0x38'))){_0x415006[_0x8ebb('0x22')]=qs[_0x8ebb('0x22')](_0x39d2c0['query']['limit']);_0x415006[_0x8ebb('0x24')]=qs[_0x8ebb('0x24')](_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x24')]);}_0x415006['order']=qs[_0x8ebb('0x39')](_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x39')]);_0x415006[_0x8ebb('0x3a')]=qs[_0x8ebb('0x3b')](_[_0x8ebb('0x3c')](_0x39d2c0[_0x8ebb('0x33')],_0x1bead9[_0x8ebb('0x3b')]),_0x1d661a);if(_0x39d2c0[_0x8ebb('0x33')]['filter']){_0x415006[_0x8ebb('0x3a')]=_['merge'](_0x415006[_0x8ebb('0x3a')],{'$or':_[_0x8ebb('0x2d')](_0x1d661a,function(_0x27b51a){if(_0x27b51a[_0x8ebb('0x3d')]!==_0x8ebb('0x3e')){var _0x1ce059={};_0x1ce059[_0x27b51a[_0x8ebb('0x2a')]]={'$like':'%'+_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x3f')]+'%'};return _0x1ce059;}})});}_0x415006=_[_0x8ebb('0x40')]({},_0x415006,_0x39d2c0[_0x8ebb('0x41')]);var _0x23ad3e={'where':_0x415006[_0x8ebb('0x3a')]};return db[_0x8ebb('0x2e')]['count'](_0x23ad3e)[_0x8ebb('0x42')](function(_0x40003e){_0x39a10e[_0x8ebb('0x23')]=_0x40003e;if(_0x39d2c0[_0x8ebb('0x33')][_0x8ebb('0x43')]){_0x415006[_0x8ebb('0x44')]=[{'all':!![]}];}return db[_0x8ebb('0x2e')][_0x8ebb('0x45')](_0x415006);})['then'](function(_0x1c172b){_0x39a10e[_0x8ebb('0x46')]=_0x1c172b;return _0x39a10e;})[_0x8ebb('0x42')](respondWithFilteredResult(_0x3a41ee,_0x415006))[_0x8ebb('0x47')](handleError(_0x3a41ee,null));};exports[_0x8ebb('0x48')]=function(_0x4de270,_0x43fd20){var _0x3a9c4f={'raw':![],'where':{'id':_0x4de270['params']['id']}},_0x399c40={};_0x399c40[_0x8ebb('0x32')]=_['keys'](db[_0x8ebb('0x2e')][_0x8ebb('0x2f')]);_0x399c40[_0x8ebb('0x33')]=_[_0x8ebb('0x49')](_0x4de270['query']);_0x399c40[_0x8ebb('0x3b')]=_[_0x8ebb('0x34')](_0x399c40[_0x8ebb('0x32')],_0x399c40[_0x8ebb('0x33')]);_0x3a9c4f[_0x8ebb('0x35')]=_[_0x8ebb('0x34')](_0x399c40[_0x8ebb('0x32')],qs['fields'](_0x4de270[_0x8ebb('0x33')][_0x8ebb('0x36')]));_0x3a9c4f[_0x8ebb('0x35')]=_0x3a9c4f[_0x8ebb('0x35')]['length']?_0x3a9c4f[_0x8ebb('0x35')]:_0x399c40[_0x8ebb('0x32')];if(_0x4de270[_0x8ebb('0x33')][_0x8ebb('0x43')]){_0x3a9c4f[_0x8ebb('0x44')]=[{'all':!![]}];}_0x3a9c4f=_[_0x8ebb('0x40')]({},_0x3a9c4f,_0x4de270[_0x8ebb('0x41')]);return db[_0x8ebb('0x2e')][_0x8ebb('0x4a')](_0x3a9c4f)[_0x8ebb('0x42')](handleEntityNotFound(_0x43fd20,null))['then'](respondWithResult(_0x43fd20,null))[_0x8ebb('0x47')](handleError(_0x43fd20,null));};exports['create']=function(_0x489623,_0x50f397){return db[_0x8ebb('0x2e')][_0x8ebb('0x4b')](_0x489623[_0x8ebb('0x4c')],{})[_0x8ebb('0x42')](function(_0x1c88f4){var _0x5641af=_0x489623[_0x8ebb('0x4d')][_0x8ebb('0x4e')]({'plain':!![]});if(!_0x5641af)throw new Error(_0x8ebb('0x4f'));if(_0x5641af[_0x8ebb('0x50')]===_0x8ebb('0x4d')){var _0x33d648=_0x1c88f4[_0x8ebb('0x4e')]({'plain':!![]});var _0x276664=_0x8ebb('0x51');return db[_0x8ebb('0x52')]['find']({'where':{'name':_0x276664,'userProfileId':_0x5641af[_0x8ebb('0x53')]},'raw':!![]})[_0x8ebb('0x42')](function(_0xb82c16){if(_0xb82c16&&_0xb82c16['autoAssociation']===0x0){return db[_0x8ebb('0x54')][_0x8ebb('0x4b')]({'name':_0x33d648[_0x8ebb('0x2a')],'resourceId':_0x33d648['id'],'type':_0xb82c16[_0x8ebb('0x2a')],'sectionId':_0xb82c16['id']},{})[_0x8ebb('0x42')](function(){return _0x1c88f4;});}else{return _0x1c88f4;}})['catch'](function(_0x51d491){logger[_0x8ebb('0x28')](_0x8ebb('0x55'),_0x51d491);throw _0x51d491;});}return _0x1c88f4;})[_0x8ebb('0x42')](respondWithResult(_0x50f397,0xc9))[_0x8ebb('0x47')](handleError(_0x50f397,null));};exports[_0x8ebb('0x56')]=function(_0x152e94,_0x2c9945){if(_0x152e94[_0x8ebb('0x4c')]['id']){delete _0x152e94[_0x8ebb('0x4c')]['id'];}return db[_0x8ebb('0x2e')][_0x8ebb('0x4a')]({'where':{'id':_0x152e94[_0x8ebb('0x57')]['id']}})[_0x8ebb('0x42')](handleEntityNotFound(_0x2c9945,null))[_0x8ebb('0x42')](saveUpdates(_0x152e94[_0x8ebb('0x4c')],null))[_0x8ebb('0x42')](respondWithResult(_0x2c9945,null))[_0x8ebb('0x47')](handleError(_0x2c9945,null));};exports[_0x8ebb('0x58')]=function(_0x5a55f4,_0x3dca38){var _0x5423e9=_0x5a55f4[_0x8ebb('0x57')]['id'];var _0x4085a7=[];return db[_0x8ebb('0x59')][_0x8ebb('0x5a')](function(_0x431ee1){var _0x4cbda9=_0x8ebb('0x5b')+_0x5423e9;return db[_0x8ebb('0x59')][_0x8ebb('0x33')](_0x4cbda9,{'type':db[_0x8ebb('0x5c')][_0x8ebb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x431ee1})[_0x8ebb('0x42')](function(_0x18ad53){_0x4085a7=_['map'](_0x18ad53,function(_0x71a325){return Number(_0x71a325[_0x8ebb('0x5e')]);});})[_0x8ebb('0x42')](function(){var _0x338f6b=_0x8ebb('0x5f')+_0x5423e9;return db['sequelize'][_0x8ebb('0x33')](_0x338f6b,{'type':db['Sequelize'][_0x8ebb('0x5d')][_0x8ebb('0x60')],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x5c553a){var _0x12a65f=_[_0x8ebb('0x2d')](_0x5c553a,function(_0x4f66a9){return Number(_0x4f66a9['VoiceQueueId']);});return db['UserVoiceQueue'][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'VoiceQueueId':{'$in':_0x12a65f}},'transaction':_0x431ee1});})['then'](function(){var _0x3f07c3=_0x8ebb('0x61')+_0x5423e9;return db[_0x8ebb('0x59')]['query'](_0x3f07c3,{'type':db[_0x8ebb('0x5c')][_0x8ebb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x526f49){var _0x8358e6=_[_0x8ebb('0x2d')](_0x526f49,function(_0x292dc5){return Number(_0x292dc5[_0x8ebb('0x62')]);});return db[_0x8ebb('0x63')][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'MailQueueId':{'$in':_0x8358e6}},'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(){var _0x1a3aff=_0x8ebb('0x64')+_0x5423e9;return db[_0x8ebb('0x59')]['query'](_0x1a3aff,{'type':db[_0x8ebb('0x5c')][_0x8ebb('0x5d')][_0x8ebb('0x60')],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x3afdbd){var _0x285613=_[_0x8ebb('0x2d')](_0x3afdbd,function(_0x4e9162){return Number(_0x4e9162[_0x8ebb('0x65')]);});return db[_0x8ebb('0x66')][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'SmsQueueId':{'$in':_0x285613}},'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(){var _0x2e3627=_0x8ebb('0x67')+_0x5423e9;return db[_0x8ebb('0x59')]['query'](_0x2e3627,{'type':db[_0x8ebb('0x5c')][_0x8ebb('0x5d')][_0x8ebb('0x60')],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x2b1774){var _0x5c55f2=_[_0x8ebb('0x2d')](_0x2b1774,function(_0x22548a){return Number(_0x22548a['ChatQueueId']);});return db[_0x8ebb('0x68')][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'ChatQueueId':{'$in':_0x5c55f2}},'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(){var _0x11225d=_0x8ebb('0x69')+_0x5423e9;return db[_0x8ebb('0x59')][_0x8ebb('0x33')](_0x11225d,{'type':db['Sequelize'][_0x8ebb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x2964ab){var _0x31f729=_[_0x8ebb('0x2d')](_0x2964ab,function(_0x315d99){return Number(_0x315d99['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x4085a7},'FaxQueueId':{'$in':_0x31f729}},'transaction':_0x431ee1});})['then'](function(){var _0x478838=_0x8ebb('0x6a')+_0x5423e9;return db[_0x8ebb('0x59')][_0x8ebb('0x33')](_0x478838,{'type':db[_0x8ebb('0x5c')][_0x8ebb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0xe359bc){var _0x3f9298=_[_0x8ebb('0x2d')](_0xe359bc,function(_0x404133){return Number(_0x404133['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'OpenchannelQueueId':{'$in':_0x3f9298}},'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(){var _0x57b5b5=_0x8ebb('0x6b')+_0x5423e9;return db[_0x8ebb('0x59')][_0x8ebb('0x33')](_0x57b5b5,{'type':db['Sequelize'][_0x8ebb('0x5d')][_0x8ebb('0x60')],'raw':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x4d24ba){var _0x33a0d0=_[_0x8ebb('0x2d')](_0x4d24ba,function(_0x2accd9){return Number(_0x2accd9[_0x8ebb('0x6c')]);});return db[_0x8ebb('0x6d')][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'WhatsappQueueId':{'$in':_0x33a0d0}},'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(){return db['TeamVoicePrefix'][_0x8ebb('0x4a')]({'where':{'TeamId':_0x5423e9}});})[_0x8ebb('0x42')](function(_0xacf5e2){if(_0xacf5e2===null){return;}return db['UserVoicePrefix'][_0x8ebb('0x58')]({'where':{'UserId':{'$in':_0x4085a7},'VoicePrefixId':_0xacf5e2[_0x8ebb('0x6e')]},'transaction':_0x431ee1});})['then'](function(){return db[_0x8ebb('0x2e')]['destroy']({'where':{'id':_0x5423e9},'cascade':!![],'transaction':_0x431ee1});})[_0x8ebb('0x42')](function(_0x4b8ee7){if(_0x4b8ee7===0x0){_0x3dca38[_0x8ebb('0x1e')](0x194);}else{return db[_0x8ebb('0x54')][_0x8ebb('0x58')]({'where':{'type':_0x8ebb('0x51'),'resourceId':_0x5423e9},'cascade':!![],'transaction':_0x431ee1})[_0x8ebb('0x42')](function(){_0x3dca38['status'](0xcc)[_0x8ebb('0x6f')]();});}})[_0x8ebb('0x47')](function(_0x5abc74){_0x3dca38[_0x8ebb('0x1f')](0x1f4)[_0x8ebb('0x2b')](_0x5abc74);});});};exports['getQueues']=function(_0x5c9ca4,_0x38d271,_0x5821ed){return db['Team']['findOne']({'where':{'id':_0x5c9ca4['params']['id']}})[_0x8ebb('0x42')](handleEntityNotFound(_0x38d271,null))['then'](function(_0xbd4aa6){if(!_0x5c9ca4['query'][_0x8ebb('0x70')]||!utils[_0x8ebb('0x71')](_0x5c9ca4[_0x8ebb('0x33')][_0x8ebb('0x70')])){throw new db[(_0x8ebb('0x5c'))][(_0x8ebb('0x72'))](_0x8ebb('0x73'));}var _0x582f35={};var _0x3204b6={};_0x3204b6[_0x8ebb('0x32')]=_[_0x8ebb('0x49')](db[_[_0x8ebb('0x74')](_0x5c9ca4[_0x8ebb('0x33')][_0x8ebb('0x70')][_0x8ebb('0x75')]())+_0x8ebb('0x76')][_0x8ebb('0x2f')]);_0x3204b6[_0x8ebb('0x33')]=_['keys'](_0x5c9ca4['query']);_0x3204b6[_0x8ebb('0x3b')]=_[_0x8ebb('0x34')](_0x3204b6[_0x8ebb('0x32')],_0x3204b6[_0x8ebb('0x33')]);_0x582f35['attributes']=_[_0x8ebb('0x34')](_0x3204b6[_0x8ebb('0x32')],qs[_0x8ebb('0x36')](_0x5c9ca4[_0x8ebb('0x33')][_0x8ebb('0x36')]));_0x582f35[_0x8ebb('0x35')]=_0x582f35[_0x8ebb('0x35')][_0x8ebb('0x77')]?_0x582f35[_0x8ebb('0x35')]:_0x3204b6[_0x8ebb('0x32')];_0x582f35['limit']=qs[_0x8ebb('0x22')](_0x5c9ca4[_0x8ebb('0x33')][_0x8ebb('0x22')]);_0x582f35['offset']=qs[_0x8ebb('0x24')](_0x5c9ca4['query'][_0x8ebb('0x24')]);_0x582f35[_0x8ebb('0x78')]=qs[_0x8ebb('0x39')](_0x5c9ca4['query']['sort']);_0x582f35[_0x8ebb('0x3a')]=qs[_0x8ebb('0x3b')](_[_0x8ebb('0x3c')](_0x5c9ca4[_0x8ebb('0x33')],_0x3204b6[_0x8ebb('0x3b')]));_0x582f35=_[_0x8ebb('0x40')]({},_0x582f35,_0x5c9ca4[_0x8ebb('0x41')]);return _0xbd4aa6[_0x8ebb('0x4e')+_[_0x8ebb('0x74')](_0x5c9ca4[_0x8ebb('0x33')][_0x8ebb('0x70')][_0x8ebb('0x75')]())+'Queues'](_0x582f35);})[_0x8ebb('0x42')](respondWithResult(_0x38d271,null))[_0x8ebb('0x47')](handleError(_0x38d271,null));};exports[_0x8ebb('0x79')]=function(_0x1c9773,_0x4cbdb1,_0x40832b){return db[_0x8ebb('0x2e')]['findOne']({'where':{'id':_0x1c9773[_0x8ebb('0x57')]['id']}})[_0x8ebb('0x42')](function(_0x43b6f7){if(_0x43b6f7){if(!_0x1c9773[_0x8ebb('0x4c')][_0x8ebb('0x70')]||!utils[_0x8ebb('0x71')](_0x1c9773[_0x8ebb('0x4c')]['channel'])){throw new db[(_0x8ebb('0x5c'))]['ValidationError'](_0x8ebb('0x73'));}return _0x43b6f7['add'+_['capitalize'](_0x1c9773[_0x8ebb('0x4c')][_0x8ebb('0x70')]['toLowerCase']())+_0x8ebb('0x7a')](_0x1c9773[_0x8ebb('0x4c')][_0x8ebb('0x7b')]);}return null;})[_0x8ebb('0x42')](handleEntityNotFound(_0x4cbdb1,null))[_0x8ebb('0x42')](respondWithStatusCode(_0x4cbdb1,null))[_0x8ebb('0x47')](handleError(_0x4cbdb1,null));};exports[_0x8ebb('0x7c')]=function(_0x557165,_0x5db250,_0x2be6b2){return db[_0x8ebb('0x2e')][_0x8ebb('0x7d')]({'where':{'id':_0x557165[_0x8ebb('0x57')]['id']}})[_0x8ebb('0x42')](function(_0x1866ef){if(_0x1866ef){if(!_0x557165[_0x8ebb('0x33')]['channel']||!utils['isValidChannel'](_0x557165[_0x8ebb('0x33')][_0x8ebb('0x70')])){throw new db[(_0x8ebb('0x5c'))]['ValidationError'](_0x8ebb('0x73'));}return _0x1866ef[_0x8ebb('0x7e')+_[_0x8ebb('0x74')](_0x557165[_0x8ebb('0x33')][_0x8ebb('0x70')][_0x8ebb('0x75')]())+_0x8ebb('0x7a')](_0x557165[_0x8ebb('0x33')][_0x8ebb('0x7b')]);}return null;})[_0x8ebb('0x42')](handleEntityNotFound(_0x5db250,null))[_0x8ebb('0x42')](respondWithStatusCode(_0x5db250,null))[_0x8ebb('0x47')](handleError(_0x5db250,null));};exports[_0x8ebb('0x7f')]=function(_0x586059,_0x57ab50){var _0x3992be=_[_0x8ebb('0x80')](_0x586059[_0x8ebb('0x4c')][_0x8ebb('0x7b')])?_0x586059[_0x8ebb('0x4c')][_0x8ebb('0x7b')]:[_0x586059['body'][_0x8ebb('0x7b')]];var _0xbe9099=_0x586059[_0x8ebb('0x57')]['id'];return db[_0x8ebb('0x2e')][_0x8ebb('0x4a')]({'where':{'id':_0xbe9099}})[_0x8ebb('0x42')](handleEntityNotFound(_0x57ab50,null))[_0x8ebb('0x42')](function(_0x55a220){if(_0x55a220){var _0x4be381=[_0x8ebb('0x81'),_0x8ebb('0x82'),_0x8ebb('0x83'),'Sms',_0x8ebb('0x84'),_0x8ebb('0x85'),_0x8ebb('0x86')];return db[_0x8ebb('0x59')]['transaction'](function(_0xad218f){var _0x45e196=_[_0x8ebb('0x2d')](_0x4be381,function(_0xd63eb2){var _0x51373d={'attributes':['id',_0x8ebb('0x2a')]};if(_0xd63eb2===_0x8ebb('0x81')){_0x51373d[_0x8ebb('0x87')]={'attributes':[_0x8ebb('0x88')]};}return _0x55a220['get'+_0xd63eb2+'Queues'](_0x51373d)[_0x8ebb('0x42')](function(_0x28e6a3){var _0x418aa8=_[_0x8ebb('0x2d')](_0x28e6a3,function(_0x43f6c6){var _0x1021fc=_[_0x8ebb('0x2d')](_0x3992be,function(_0x234dea){var _0x46f4af={'where':{'UserId':_0x234dea,[_0xd63eb2+_0x8ebb('0x89')]:_0x43f6c6['id']},'transaction':_0xad218f};if(_0xd63eb2==='Voice'){_0x46f4af[_0x8ebb('0x8a')]={'penalty':_0x43f6c6[_0x8ebb('0x8b')][_0x8ebb('0x88')]};}return db['User'+_0xd63eb2+'Queue'][_0x8ebb('0x8c')](_0x46f4af)['then'](function(){socket[_0x8ebb('0x8d')](_0x8ebb('0x4d')+_0xd63eb2+_0x8ebb('0x8e'),{'UserId':_0x234dea,[_0xd63eb2+'QueueId']:_0x43f6c6['id']});if(_0xd63eb2!=='Voice'){return;}return db[_0x8ebb('0x8f')]['findAll']({'where':{'id':_0x3992be,'online':0x1},'attributes':['id',_0x8ebb('0x2a'),_0x8ebb('0x90'),_0x8ebb('0x91'),_0x8ebb('0x92')],'raw':!![]})[_0x8ebb('0x42')](function(_0x1e4478){var _0x1a0df0=_[_0x8ebb('0x2d')](_0x1e4478,function(_0x119866){return db[_0x8ebb('0x93')][_0x8ebb('0x94')]({'membername':_0x119866[_0x8ebb('0x2a')],'UserId':_0x119866['id'],'queue_name':_0x43f6c6[_0x8ebb('0x2a')],'VoiceQueueId':_0x43f6c6['id'],'interface':_[_0x8ebb('0x95')](_0x119866[_0x8ebb('0x92')])?util[_0x8ebb('0x96')](_0x8ebb('0x97'),_0x119866[_0x8ebb('0x2a')]):_0x119866[_0x8ebb('0x92')],'paused':_0x119866[_0x8ebb('0x91')]||![],'penalty':_0x43f6c6[_0x8ebb('0x8b')]['penalty']},{'transaction':_0xad218f});});return Promise['all'](_0x1a0df0);});});});return Promise[_0x8ebb('0x98')](_0x1021fc);});return Promise[_0x8ebb('0x98')](_0x418aa8);})['then'](function(){return db['TeamVoicePrefix'][_0x8ebb('0x7d')]({'where':{'teamId':_0xbe9099}})[_0x8ebb('0x42')](function(_0xbf92d6){if(_0xbf92d6){var _0x208fef=_[_0x8ebb('0x2d')](_0x3992be,function(_0x3b74be){db['UserVoicePrefix'][_0x8ebb('0x94')]({'UserId':_0x3b74be,'VoicePrefixId':_0xbf92d6['VoicePrefixId']});});return Promise['all'](_0x208fef);}});});});return Promise[_0x8ebb('0x98')](_0x45e196)[_0x8ebb('0x42')](function(){return _0x55a220[_0x8ebb('0x7f')](_0x3992be,{'transaction':_0xad218f})['spread'](function(_0x25f5fb){return _0x25f5fb;});});});}})[_0x8ebb('0x42')](respondWithResult(_0x57ab50,null))[_0x8ebb('0x47')](handleError(_0x57ab50,null));};exports[_0x8ebb('0x99')]=function(_0x1c07ed,_0x4012cf){var _0xec1dc8=_['isArray'](_0x1c07ed['query'][_0x8ebb('0x7b')])?_0x1c07ed[_0x8ebb('0x33')][_0x8ebb('0x7b')]:[_0x1c07ed[_0x8ebb('0x33')]['ids']];var _0x58db6e=_0x1c07ed[_0x8ebb('0x57')]['id'];return db[_0x8ebb('0x2e')][_0x8ebb('0x4a')]({'where':{'id':_0x58db6e}})[_0x8ebb('0x42')](handleEntityNotFound(_0x4012cf,null))['then'](function(_0x4c1050){if(_0x4c1050){var _0x31353c=[_0x8ebb('0x81'),_0x8ebb('0x82'),'Mail',_0x8ebb('0x9a'),'Fax',_0x8ebb('0x85'),_0x8ebb('0x86')];return db['sequelize'][_0x8ebb('0x5a')](function(_0x17d235){var _0x5ef475=_[_0x8ebb('0x2d')](_0x31353c,function(_0x142b22){var _0x4f74c0={'attributes':['id',_0x8ebb('0x2a')]};return _0x4c1050[_0x8ebb('0x4e')+_0x142b22+_0x8ebb('0x7a')](_0x4f74c0)[_0x8ebb('0x42')](function(_0x497c87){var _0x5a94bc=_[_0x8ebb('0x2d')](_0x497c87,function(_0x483405){return _0x483405['removeAgents'](_0xec1dc8,{'transaction':_0x17d235})[_0x8ebb('0x42')](function(){var _0x406c9c=_[_0x8ebb('0x2d')](_0xec1dc8,function(_0x33da82){socket[_0x8ebb('0x8d')](_0x8ebb('0x4d')+_0x142b22+_0x8ebb('0x9b'),{'UserId':Number(_0x33da82),[_0x142b22+_0x8ebb('0x89')]:_0x483405['id']});if(_0x142b22!==_0x8ebb('0x81')){return;}return db[_0x8ebb('0x93')][_0x8ebb('0x58')]({'where':{'VoiceQueueId':_0x483405['id'],'UserId':_0x33da82},'transaction':_0x17d235});});return Promise[_0x8ebb('0x98')](_0x406c9c);});});return Promise['all'](_0x5a94bc);});});return Promise[_0x8ebb('0x98')](_0x5ef475)[_0x8ebb('0x42')](function(){return _0x4c1050[_0x8ebb('0x99')](_0xec1dc8,{'transaction':_0x17d235});})['then'](function(){return db[_0x8ebb('0x9c')][_0x8ebb('0x7d')]({'where':{'teamId':_0x58db6e}})[_0x8ebb('0x42')](function(_0x596b43){if(_0x596b43){var _0x1b63cb=_[_0x8ebb('0x2d')](_0xec1dc8,function(_0x33d78b){db[_0x8ebb('0x9d')][_0x8ebb('0x58')]({'where':{'UserId':_0x33d78b,'VoicePrefixId':_0x596b43[_0x8ebb('0x6e')]}});});return Promise[_0x8ebb('0x98')](_0x1b63cb);}});});});}})[_0x8ebb('0x42')](respondWithStatusCode(_0x4012cf,null))[_0x8ebb('0x47')](handleError(_0x4012cf,null));};exports[_0x8ebb('0x9e')]=function(_0x43730e,_0x2e6339,_0x3c5f4f){var _0x1852c3={};var _0x4bf493={};var _0x53163a;var _0x53d009;return db[_0x8ebb('0x2e')]['findOne']({'where':{'id':_0x43730e[_0x8ebb('0x57')]['id']}})['then'](handleEntityNotFound(_0x2e6339,null))[_0x8ebb('0x42')](function(_0x5f4651){if(_0x5f4651){_0x53163a=_0x5f4651;_0x4bf493[_0x8ebb('0x32')]=_['keys'](db[_0x8ebb('0x8f')][_0x8ebb('0x2f')]);_0x4bf493[_0x8ebb('0x33')]=_[_0x8ebb('0x49')](_0x43730e[_0x8ebb('0x33')]);_0x4bf493[_0x8ebb('0x3b')]=_[_0x8ebb('0x34')](_0x4bf493[_0x8ebb('0x32')],_0x4bf493[_0x8ebb('0x33')]);_0x1852c3['attributes']=_[_0x8ebb('0x34')](_0x4bf493[_0x8ebb('0x32')],qs[_0x8ebb('0x36')](_0x43730e[_0x8ebb('0x33')][_0x8ebb('0x36')]));_0x1852c3[_0x8ebb('0x35')]=_0x1852c3[_0x8ebb('0x35')][_0x8ebb('0x77')]?_0x1852c3[_0x8ebb('0x35')]:_0x4bf493['model'];_0x1852c3['order']=qs['sort'](_0x43730e[_0x8ebb('0x33')][_0x8ebb('0x39')]);_0x1852c3[_0x8ebb('0x3a')]=qs[_0x8ebb('0x3b')](_[_0x8ebb('0x3c')](_0x43730e['query'],_0x4bf493[_0x8ebb('0x3b')]));if(_0x43730e[_0x8ebb('0x33')][_0x8ebb('0x3f')]){_0x1852c3[_0x8ebb('0x3a')]=_[_0x8ebb('0x40')](_0x1852c3['where'],{'$or':_['map'](_0x1852c3[_0x8ebb('0x35')],function(_0x1f75a0){var _0x4c2e14={};_0x4c2e14[_0x1f75a0]={'$like':'%'+_0x43730e[_0x8ebb('0x33')][_0x8ebb('0x3f')]+'%'};return _0x4c2e14;})});}_0x1852c3=_['merge']({},_0x1852c3,_0x43730e[_0x8ebb('0x41')]);return _0x53163a[_0x8ebb('0x9e')](_0x1852c3);}})['then'](function(_0x3a9b66){if(_0x3a9b66){_0x53d009=_0x3a9b66[_0x8ebb('0x77')];if(!_0x43730e['query'][_0x8ebb('0x37')]('nolimit')){_0x1852c3[_0x8ebb('0x22')]=qs['limit'](_0x43730e['query'][_0x8ebb('0x22')]);_0x1852c3[_0x8ebb('0x24')]=qs[_0x8ebb('0x24')](_0x43730e['query']['offset']);}return _0x53163a[_0x8ebb('0x9e')](_0x1852c3);}})[_0x8ebb('0x42')](function(_0x293cb5){if(_0x293cb5){return _0x293cb5?{'count':_0x53d009,'rows':_0x293cb5}:null;}})[_0x8ebb('0x42')](respondWithResult(_0x2e6339,null))[_0x8ebb('0x47')](handleError(_0x2e6339,null));}; \ No newline at end of file +var _0xe4df=['UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','order','capitalize','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','UserVoicePrefix','spread','removeAgents','Mail','Queue:remove','getAgents','nolimit','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId'];(function(_0x342a63,_0x55318f){var _0x4c15c0=function(_0x461777){while(--_0x461777){_0x342a63['push'](_0x342a63['shift']());}};_0x4c15c0(++_0x55318f);}(_0xe4df,0x16b));var _0xfe4d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe4df[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xfe4d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe4d('0x1'));var rp=require('request-promise');var moment=require(_0xfe4d('0x2'));var BPromise=require(_0xfe4d('0x3'));var Mustache=require('mustache');var util=require(_0xfe4d('0x4'));var path=require(_0xfe4d('0x5'));var sox=require(_0xfe4d('0x6'));var csv=require(_0xfe4d('0x7'));var ejs=require(_0xfe4d('0x8'));var fs=require('fs');var fs_extra=require(_0xfe4d('0x9'));var _=require(_0xfe4d('0xa'));var squel=require(_0xfe4d('0xb'));var crypto=require(_0xfe4d('0xc'));var jsforce=require(_0xfe4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfe4d('0x7'));var querystring=require(_0xfe4d('0xe'));var Papa=require(_0xfe4d('0xf'));var Redis=require(_0xfe4d('0x10'));var authService=require(_0xfe4d('0x11'));var qs=require(_0xfe4d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe4d('0x13'));var logger=require(_0xfe4d('0x14'))('api');var utils=require(_0xfe4d('0x15'));var config=require(_0xfe4d('0x16'));var licenseUtil=require(_0xfe4d('0x17'));var db=require('../../mysqldb')['db'];config[_0xfe4d('0x18')]=_[_0xfe4d('0x19')](config[_0xfe4d('0x18')],{'host':_0xfe4d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe4d('0x18')]));require('./team.socket')[_0xfe4d('0x1b')](socket);function respondWithStatusCode(_0x563edc,_0x29538d){_0x29538d=_0x29538d||0xcc;return function(_0x4a2e3d){if(_0x4a2e3d){return _0x563edc[_0xfe4d('0x1c')](_0x29538d);}return _0x563edc[_0xfe4d('0x1d')](_0x29538d)['end']();};}function respondWithResult(_0x141f3c,_0x1e555d){_0x1e555d=_0x1e555d||0xc8;return function(_0x5eedfc){if(_0x5eedfc){return _0x141f3c['status'](_0x1e555d)[_0xfe4d('0x1e')](_0x5eedfc);}};}function respondWithFilteredResult(_0x400222,_0x2add){return function(_0x46150d){if(_0x46150d){var _0x37bcfb=typeof _0x2add[_0xfe4d('0x1f')]==='undefined'&&typeof _0x2add[_0xfe4d('0x20')]==='undefined';var _0x3f789f=_0x46150d['count'];var _0x3d19da=_0x37bcfb?0x0:_0x2add[_0xfe4d('0x1f')];var _0x39ef65=_0x37bcfb?_0x46150d[_0xfe4d('0x21')]:_0x2add[_0xfe4d('0x1f')]+_0x2add[_0xfe4d('0x20')];var _0x2f395c;if(_0x39ef65>=_0x3f789f){_0x39ef65=_0x3f789f;_0x2f395c=0xc8;}else{_0x2f395c=0xce;}_0x400222['status'](_0x2f395c);return _0x400222[_0xfe4d('0x22')](_0xfe4d('0x23'),_0x3d19da+'-'+_0x39ef65+'/'+_0x3f789f)[_0xfe4d('0x1e')](_0x46150d);}return null;};}function patchUpdates(_0x416847){return function(_0x2dbdb2){try{jsonpatch[_0xfe4d('0x24')](_0x2dbdb2,_0x416847,!![]);}catch(_0x33cba4){return BPromise[_0xfe4d('0x25')](_0x33cba4);}return _0x2dbdb2['save']();};}function saveUpdates(_0x4a522c,_0x573763){return function(_0x177be3){if(_0x177be3){return _0x177be3[_0xfe4d('0x26')](_0x4a522c)[_0xfe4d('0x27')](function(_0x2b9871){return _0x2b9871;});}return null;};}function handleEntityNotFound(_0x520362,_0x44d7db){return function(_0xc7a5a6){if(!_0xc7a5a6){_0x520362[_0xfe4d('0x1c')](0x194);}return _0xc7a5a6;};}function handleError(_0x14a16a,_0x4efc23){_0x4efc23=_0x4efc23||0x1f4;return function(_0x361add){logger[_0xfe4d('0x28')](_0x361add['stack']);if(_0x361add['name']){delete _0x361add[_0xfe4d('0x29')];}_0x14a16a['status'](_0x4efc23)[_0xfe4d('0x2a')](_0x361add);};}exports[_0xfe4d('0x2b')]=function(_0x3b8c31,_0x31b195){var _0x526892={},_0x526e47={},_0x288503={'count':0x0,'rows':[]};var _0x58758e=_[_0xfe4d('0x2c')](db[_0xfe4d('0x2d')][_0xfe4d('0x2e')],function(_0x249362){return{'name':_0x249362[_0xfe4d('0x2f')],'type':_0x249362[_0xfe4d('0x30')]['key']};});_0x526e47[_0xfe4d('0x31')]=_[_0xfe4d('0x2c')](_0x58758e,_0xfe4d('0x29'));_0x526e47[_0xfe4d('0x32')]=_[_0xfe4d('0x33')](_0x3b8c31[_0xfe4d('0x32')]);_0x526e47['filters']=_[_0xfe4d('0x34')](_0x526e47['model'],_0x526e47[_0xfe4d('0x32')]);_0x526892['attributes']=_[_0xfe4d('0x34')](_0x526e47[_0xfe4d('0x31')],qs[_0xfe4d('0x35')](_0x3b8c31['query']['fields']));_0x526892[_0xfe4d('0x36')]=_0x526892[_0xfe4d('0x36')][_0xfe4d('0x37')]?_0x526892['attributes']:_0x526e47[_0xfe4d('0x31')];if(!_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x38')]('nolimit')){_0x526892[_0xfe4d('0x20')]=qs[_0xfe4d('0x20')](_0x3b8c31['query'][_0xfe4d('0x20')]);_0x526892[_0xfe4d('0x1f')]=qs[_0xfe4d('0x1f')](_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x1f')]);}_0x526892['order']=qs[_0xfe4d('0x39')](_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x39')]);_0x526892['where']=qs[_0xfe4d('0x3a')](_[_0xfe4d('0x3b')](_0x3b8c31[_0xfe4d('0x32')],_0x526e47['filters']),_0x58758e);if(_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x3c')]){_0x526892[_0xfe4d('0x3d')]=_['merge'](_0x526892[_0xfe4d('0x3d')],{'$or':_[_0xfe4d('0x2c')](_0x58758e,function(_0x302f1a){if(_0x302f1a[_0xfe4d('0x30')]!==_0xfe4d('0x3e')){var _0x5e347b={};_0x5e347b[_0x302f1a[_0xfe4d('0x29')]]={'$like':'%'+_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x3c')]+'%'};return _0x5e347b;}})});}_0x526892=_[_0xfe4d('0x3f')]({},_0x526892,_0x3b8c31['options']);var _0x3baf58={'where':_0x526892[_0xfe4d('0x3d')]};return db[_0xfe4d('0x2d')][_0xfe4d('0x21')](_0x3baf58)['then'](function(_0x208110){_0x288503[_0xfe4d('0x21')]=_0x208110;if(_0x3b8c31[_0xfe4d('0x32')][_0xfe4d('0x40')]){_0x526892[_0xfe4d('0x41')]=[{'all':!![]}];}return db[_0xfe4d('0x2d')][_0xfe4d('0x42')](_0x526892);})['then'](function(_0x5ce1ef){_0x288503[_0xfe4d('0x43')]=_0x5ce1ef;return _0x288503;})['then'](respondWithFilteredResult(_0x31b195,_0x526892))[_0xfe4d('0x44')](handleError(_0x31b195,null));};exports['show']=function(_0x10b8f4,_0x5c7a2a){var _0x5353e9={'raw':![],'where':{'id':_0x10b8f4[_0xfe4d('0x45')]['id']}},_0x46c362={};_0x46c362['model']=_['keys'](db[_0xfe4d('0x2d')][_0xfe4d('0x2e')]);_0x46c362[_0xfe4d('0x32')]=_[_0xfe4d('0x33')](_0x10b8f4[_0xfe4d('0x32')]);_0x46c362['filters']=_['intersection'](_0x46c362[_0xfe4d('0x31')],_0x46c362[_0xfe4d('0x32')]);_0x5353e9[_0xfe4d('0x36')]=_[_0xfe4d('0x34')](_0x46c362[_0xfe4d('0x31')],qs['fields'](_0x10b8f4[_0xfe4d('0x32')][_0xfe4d('0x35')]));_0x5353e9['attributes']=_0x5353e9[_0xfe4d('0x36')][_0xfe4d('0x37')]?_0x5353e9[_0xfe4d('0x36')]:_0x46c362[_0xfe4d('0x31')];if(_0x10b8f4['query'][_0xfe4d('0x40')]){_0x5353e9[_0xfe4d('0x41')]=[{'all':!![]}];}_0x5353e9=_[_0xfe4d('0x3f')]({},_0x5353e9,_0x10b8f4[_0xfe4d('0x46')]);return db[_0xfe4d('0x2d')][_0xfe4d('0x47')](_0x5353e9)[_0xfe4d('0x27')](handleEntityNotFound(_0x5c7a2a,null))['then'](respondWithResult(_0x5c7a2a,null))['catch'](handleError(_0x5c7a2a,null));};exports[_0xfe4d('0x48')]=function(_0x29e9e8,_0x380a12){return db[_0xfe4d('0x2d')][_0xfe4d('0x48')](_0x29e9e8[_0xfe4d('0x49')],{})[_0xfe4d('0x27')](function(_0x402601){var _0x27dbe1=_0x29e9e8[_0xfe4d('0x4a')][_0xfe4d('0x4b')]({'plain':!![]});if(!_0x27dbe1)throw new Error(_0xfe4d('0x4c'));if(_0x27dbe1[_0xfe4d('0x4d')]===_0xfe4d('0x4a')){var _0x551c7f=_0x402601[_0xfe4d('0x4b')]({'plain':!![]});var _0xca9dfc=_0xfe4d('0x4e');return db['UserProfileSection'][_0xfe4d('0x47')]({'where':{'name':_0xca9dfc,'userProfileId':_0x27dbe1[_0xfe4d('0x4f')]},'raw':!![]})[_0xfe4d('0x27')](function(_0x586fd9){if(_0x586fd9&&_0x586fd9[_0xfe4d('0x50')]===0x0){return db[_0xfe4d('0x51')][_0xfe4d('0x48')]({'name':_0x551c7f[_0xfe4d('0x29')],'resourceId':_0x551c7f['id'],'type':_0x586fd9[_0xfe4d('0x29')],'sectionId':_0x586fd9['id']},{})[_0xfe4d('0x27')](function(){return _0x402601;});}else{return _0x402601;}})[_0xfe4d('0x44')](function(_0x18cb17){logger[_0xfe4d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18cb17);throw _0x18cb17;});}return _0x402601;})[_0xfe4d('0x27')](respondWithResult(_0x380a12,0xc9))[_0xfe4d('0x44')](handleError(_0x380a12,null));};exports['update']=function(_0x2eb36a,_0xe97b47){if(_0x2eb36a[_0xfe4d('0x49')]['id']){delete _0x2eb36a[_0xfe4d('0x49')]['id'];}return db['Team'][_0xfe4d('0x47')]({'where':{'id':_0x2eb36a[_0xfe4d('0x45')]['id']}})[_0xfe4d('0x27')](handleEntityNotFound(_0xe97b47,null))['then'](saveUpdates(_0x2eb36a[_0xfe4d('0x49')],null))[_0xfe4d('0x27')](respondWithResult(_0xe97b47,null))[_0xfe4d('0x44')](handleError(_0xe97b47,null));};exports[_0xfe4d('0x52')]=function(_0x42fd80,_0x27e945){var _0x49380a=_0x42fd80[_0xfe4d('0x45')]['id'];var _0x50b682=[];return db[_0xfe4d('0x53')][_0xfe4d('0x54')](function(_0x2abb1c){var _0x2828df='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x2828df,{'type':db[_0xfe4d('0x55')]['QueryTypes'][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c})[_0xfe4d('0x27')](function(_0x5952a8){_0x50b682=_[_0xfe4d('0x2c')](_0x5952a8,function(_0x1332d6){return Number(_0x1332d6['UserId']);});})[_0xfe4d('0x27')](function(){var _0x24dd70=_0xfe4d('0x57')+_0x49380a;return db['sequelize'][_0xfe4d('0x32')](_0x24dd70,{'type':db['Sequelize']['QueryTypes'][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(_0x57ecb3){var _0x26a435=_[_0xfe4d('0x2c')](_0x57ecb3,function(_0x443009){return Number(_0x443009[_0xfe4d('0x58')]);});return db[_0xfe4d('0x59')]['destroy']({'where':{'UserId':{'$in':_0x50b682},'VoiceQueueId':{'$in':_0x26a435}},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){var _0x58fc1d=_0xfe4d('0x5a')+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x58fc1d,{'type':db['Sequelize'][_0xfe4d('0x5b')][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(_0x383276){var _0x3cd16d=_[_0xfe4d('0x2c')](_0x383276,function(_0x254d9a){return Number(_0x254d9a[_0xfe4d('0x5c')]);});return db[_0xfe4d('0x5d')][_0xfe4d('0x52')]({'where':{'UserId':{'$in':_0x50b682},'MailQueueId':{'$in':_0x3cd16d}},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){var _0x4f35a5='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x4f35a5,{'type':db['Sequelize'][_0xfe4d('0x5b')][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(_0x377c2b){var _0x433aae=_[_0xfe4d('0x2c')](_0x377c2b,function(_0x1887fe){return Number(_0x1887fe['SmsQueueId']);});return db[_0xfe4d('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x50b682},'SmsQueueId':{'$in':_0x433aae}},'transaction':_0x2abb1c});})['then'](function(){var _0x15a8f9=_0xfe4d('0x5f')+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x15a8f9,{'type':db[_0xfe4d('0x55')][_0xfe4d('0x5b')][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})['then'](function(_0x1f7fb4){var _0x5ad22f=_[_0xfe4d('0x2c')](_0x1f7fb4,function(_0x503970){return Number(_0x503970[_0xfe4d('0x60')]);});return db[_0xfe4d('0x61')][_0xfe4d('0x52')]({'where':{'UserId':{'$in':_0x50b682},'ChatQueueId':{'$in':_0x5ad22f}},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){var _0x11a2ce='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x11a2ce,{'type':db['Sequelize'][_0xfe4d('0x5b')][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})['then'](function(_0x431d02){var _0x4a4b3a=_[_0xfe4d('0x2c')](_0x431d02,function(_0x36de9f){return Number(_0x36de9f[_0xfe4d('0x62')]);});return db[_0xfe4d('0x63')]['destroy']({'where':{'UserId':{'$in':_0x50b682},'FaxQueueId':{'$in':_0x4a4b3a}},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){var _0x259d47=_0xfe4d('0x64')+_0x49380a;return db['sequelize'][_0xfe4d('0x32')](_0x259d47,{'type':db[_0xfe4d('0x55')]['QueryTypes'][_0xfe4d('0x56')],'raw':!![],'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(_0x55d6ee){var _0x549559=_[_0xfe4d('0x2c')](_0x55d6ee,function(_0x168c5d){return Number(_0x168c5d[_0xfe4d('0x65')]);});return db[_0xfe4d('0x66')]['destroy']({'where':{'UserId':{'$in':_0x50b682},'OpenchannelQueueId':{'$in':_0x549559}},'transaction':_0x2abb1c});})['then'](function(){var _0x53752f='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x49380a;return db[_0xfe4d('0x53')][_0xfe4d('0x32')](_0x53752f,{'type':db['Sequelize'][_0xfe4d('0x5b')]['SELECT'],'raw':!![],'transaction':_0x2abb1c});})['then'](function(_0x3cdd7c){var _0x530287=_['map'](_0x3cdd7c,function(_0x4b07ee){return Number(_0x4b07ee[_0xfe4d('0x67')]);});return db[_0xfe4d('0x68')][_0xfe4d('0x52')]({'where':{'UserId':{'$in':_0x50b682},'WhatsappQueueId':{'$in':_0x530287}},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){return db[_0xfe4d('0x69')][_0xfe4d('0x47')]({'where':{'TeamId':_0x49380a}});})[_0xfe4d('0x27')](function(_0x384f47){if(_0x384f47===null){return;}return db['UserVoicePrefix'][_0xfe4d('0x52')]({'where':{'UserId':{'$in':_0x50b682},'VoicePrefixId':_0x384f47[_0xfe4d('0x6a')]},'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(){return db[_0xfe4d('0x2d')][_0xfe4d('0x52')]({'where':{'id':_0x49380a},'cascade':!![],'transaction':_0x2abb1c});})[_0xfe4d('0x27')](function(_0x4a46db){if(_0x4a46db===0x0){_0x27e945['sendStatus'](0x194);}else{return db[_0xfe4d('0x51')][_0xfe4d('0x52')]({'where':{'type':_0xfe4d('0x4e'),'resourceId':_0x49380a},'cascade':!![],'transaction':_0x2abb1c})[_0xfe4d('0x27')](function(){_0x27e945[_0xfe4d('0x1d')](0xcc)['end']();});}})[_0xfe4d('0x44')](function(_0x59ce44){_0x27e945[_0xfe4d('0x1d')](0x1f4)[_0xfe4d('0x2a')](_0x59ce44);});});};exports[_0xfe4d('0x6b')]=function(_0x595174,_0x3a7f79,_0x4d015e){return db[_0xfe4d('0x2d')][_0xfe4d('0x6c')]({'where':{'id':_0x595174[_0xfe4d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a7f79,null))['then'](function(_0x42d2af){if(!_0x595174[_0xfe4d('0x32')][_0xfe4d('0x6d')]||!utils[_0xfe4d('0x6e')](_0x595174[_0xfe4d('0x32')][_0xfe4d('0x6d')])){throw new db[(_0xfe4d('0x55'))][(_0xfe4d('0x6f'))](_0xfe4d('0x70'));}var _0x57451b={};var _0x50b32f={};_0x50b32f[_0xfe4d('0x31')]=_['keys'](db[_['capitalize'](_0x595174[_0xfe4d('0x32')]['channel'][_0xfe4d('0x71')]())+_0xfe4d('0x72')][_0xfe4d('0x2e')]);_0x50b32f[_0xfe4d('0x32')]=_[_0xfe4d('0x33')](_0x595174[_0xfe4d('0x32')]);_0x50b32f[_0xfe4d('0x3a')]=_[_0xfe4d('0x34')](_0x50b32f['model'],_0x50b32f[_0xfe4d('0x32')]);_0x57451b[_0xfe4d('0x36')]=_[_0xfe4d('0x34')](_0x50b32f[_0xfe4d('0x31')],qs[_0xfe4d('0x35')](_0x595174[_0xfe4d('0x32')][_0xfe4d('0x35')]));_0x57451b[_0xfe4d('0x36')]=_0x57451b[_0xfe4d('0x36')][_0xfe4d('0x37')]?_0x57451b[_0xfe4d('0x36')]:_0x50b32f[_0xfe4d('0x31')];_0x57451b[_0xfe4d('0x20')]=qs[_0xfe4d('0x20')](_0x595174['query'][_0xfe4d('0x20')]);_0x57451b[_0xfe4d('0x1f')]=qs[_0xfe4d('0x1f')](_0x595174[_0xfe4d('0x32')][_0xfe4d('0x1f')]);_0x57451b[_0xfe4d('0x73')]=qs[_0xfe4d('0x39')](_0x595174[_0xfe4d('0x32')][_0xfe4d('0x39')]);_0x57451b['where']=qs[_0xfe4d('0x3a')](_['pick'](_0x595174[_0xfe4d('0x32')],_0x50b32f[_0xfe4d('0x3a')]));_0x57451b=_['merge']({},_0x57451b,_0x595174['options']);return _0x42d2af[_0xfe4d('0x4b')+_[_0xfe4d('0x74')](_0x595174[_0xfe4d('0x32')]['channel'][_0xfe4d('0x71')]())+_0xfe4d('0x75')](_0x57451b);})[_0xfe4d('0x27')](respondWithResult(_0x3a7f79,null))['catch'](handleError(_0x3a7f79,null));};exports[_0xfe4d('0x76')]=function(_0x128cb2,_0x544f60,_0x14caf3){return db['Team']['findOne']({'where':{'id':_0x128cb2[_0xfe4d('0x45')]['id']}})[_0xfe4d('0x27')](function(_0x5c9284){if(_0x5c9284){if(!_0x128cb2[_0xfe4d('0x49')]['channel']||!utils[_0xfe4d('0x6e')](_0x128cb2[_0xfe4d('0x49')][_0xfe4d('0x6d')])){throw new db[(_0xfe4d('0x55'))]['ValidationError'](_0xfe4d('0x70'));}return _0x5c9284[_0xfe4d('0x77')+_['capitalize'](_0x128cb2[_0xfe4d('0x49')][_0xfe4d('0x6d')][_0xfe4d('0x71')]())+_0xfe4d('0x75')](_0x128cb2['body'][_0xfe4d('0x78')]);}return null;})[_0xfe4d('0x27')](handleEntityNotFound(_0x544f60,null))[_0xfe4d('0x27')](respondWithStatusCode(_0x544f60,null))[_0xfe4d('0x44')](handleError(_0x544f60,null));};exports[_0xfe4d('0x79')]=function(_0x37d6bf,_0x1f603c,_0x5ed31c){return db['Team']['findOne']({'where':{'id':_0x37d6bf[_0xfe4d('0x45')]['id']}})[_0xfe4d('0x27')](function(_0x56fa91){if(_0x56fa91){if(!_0x37d6bf[_0xfe4d('0x32')][_0xfe4d('0x6d')]||!utils[_0xfe4d('0x6e')](_0x37d6bf[_0xfe4d('0x32')][_0xfe4d('0x6d')])){throw new db['Sequelize']['ValidationError'](_0xfe4d('0x70'));}return _0x56fa91[_0xfe4d('0x7a')+_[_0xfe4d('0x74')](_0x37d6bf[_0xfe4d('0x32')][_0xfe4d('0x6d')][_0xfe4d('0x71')]())+_0xfe4d('0x75')](_0x37d6bf['query'][_0xfe4d('0x78')]);}return null;})[_0xfe4d('0x27')](handleEntityNotFound(_0x1f603c,null))[_0xfe4d('0x27')](respondWithStatusCode(_0x1f603c,null))[_0xfe4d('0x44')](handleError(_0x1f603c,null));};exports[_0xfe4d('0x7b')]=function(_0x27fe32,_0x583111){var _0x19cbba=_[_0xfe4d('0x7c')](_0x27fe32[_0xfe4d('0x49')][_0xfe4d('0x78')])?_0x27fe32[_0xfe4d('0x49')][_0xfe4d('0x78')]:[_0x27fe32[_0xfe4d('0x49')]['ids']];var _0x35713d=_0x27fe32[_0xfe4d('0x45')]['id'];return db[_0xfe4d('0x2d')][_0xfe4d('0x47')]({'where':{'id':_0x35713d}})[_0xfe4d('0x27')](handleEntityNotFound(_0x583111,null))[_0xfe4d('0x27')](function(_0x442c5f){if(_0x442c5f){var _0x1599df=[_0xfe4d('0x7d'),'Chat','Mail',_0xfe4d('0x7e'),_0xfe4d('0x7f'),_0xfe4d('0x80'),_0xfe4d('0x81')];return db['sequelize']['transaction'](function(_0x575f1c){var _0x1df44c=_[_0xfe4d('0x2c')](_0x1599df,function(_0x10c5a0){var _0x456045={'attributes':['id',_0xfe4d('0x29')]};if(_0x10c5a0===_0xfe4d('0x7d')){_0x456045[_0xfe4d('0x82')]={'attributes':[_0xfe4d('0x83')]};}return _0x442c5f[_0xfe4d('0x4b')+_0x10c5a0+_0xfe4d('0x75')](_0x456045)['then'](function(_0x5a3136){var _0x43c144=_[_0xfe4d('0x2c')](_0x5a3136,function(_0x472677){var _0xc930e7=_[_0xfe4d('0x2c')](_0x19cbba,function(_0x4e8909){var _0x52d600={'where':{'UserId':_0x4e8909,[_0x10c5a0+_0xfe4d('0x84')]:_0x472677['id']},'transaction':_0x575f1c};if(_0x10c5a0===_0xfe4d('0x7d')){_0x52d600[_0xfe4d('0x19')]={'penalty':_0x472677[_0xfe4d('0x85')][_0xfe4d('0x83')]};}return db[_0xfe4d('0x86')+_0x10c5a0+_0xfe4d('0x72')][_0xfe4d('0x87')](_0x52d600)[_0xfe4d('0x27')](function(){socket[_0xfe4d('0x88')](_0xfe4d('0x4a')+_0x10c5a0+_0xfe4d('0x89'),{'UserId':_0x4e8909,[_0x10c5a0+_0xfe4d('0x84')]:_0x472677['id']});if(_0x10c5a0!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x19cbba,'online':0x1},'attributes':['id','name','online',_0xfe4d('0x8a'),_0xfe4d('0x8b')],'raw':!![]})[_0xfe4d('0x27')](function(_0x44e6ba){var _0x23fc02=_[_0xfe4d('0x2c')](_0x44e6ba,function(_0x36349a){return db[_0xfe4d('0x8c')][_0xfe4d('0x8d')]({'membername':_0x36349a[_0xfe4d('0x29')],'UserId':_0x36349a['id'],'queue_name':_0x472677[_0xfe4d('0x29')],'VoiceQueueId':_0x472677['id'],'interface':_[_0xfe4d('0x8e')](_0x36349a[_0xfe4d('0x8b')])?util['format'](_0xfe4d('0x8f'),_0x36349a[_0xfe4d('0x29')]):_0x36349a[_0xfe4d('0x8b')],'paused':_0x36349a[_0xfe4d('0x8a')]||![],'penalty':_0x472677[_0xfe4d('0x85')][_0xfe4d('0x83')]},{'transaction':_0x575f1c});});return Promise[_0xfe4d('0x90')](_0x23fc02);});});});return Promise[_0xfe4d('0x90')](_0xc930e7);});return Promise['all'](_0x43c144);})[_0xfe4d('0x27')](function(){return db[_0xfe4d('0x69')][_0xfe4d('0x6c')]({'where':{'teamId':_0x35713d}})[_0xfe4d('0x27')](function(_0x4c412b){if(_0x4c412b){var _0x2225ba=_['map'](_0x19cbba,function(_0xc5d6b6){db[_0xfe4d('0x91')][_0xfe4d('0x8d')]({'UserId':_0xc5d6b6,'VoicePrefixId':_0x4c412b[_0xfe4d('0x6a')]});});return Promise['all'](_0x2225ba);}});});});return Promise[_0xfe4d('0x90')](_0x1df44c)[_0xfe4d('0x27')](function(){return _0x442c5f[_0xfe4d('0x7b')](_0x19cbba,{'transaction':_0x575f1c})[_0xfe4d('0x92')](function(_0x5be2cb){return _0x5be2cb;});});});}})[_0xfe4d('0x27')](respondWithResult(_0x583111,null))[_0xfe4d('0x44')](handleError(_0x583111,null));};exports[_0xfe4d('0x93')]=function(_0x47a0d8,_0x463b11){var _0x3cbe1d=_[_0xfe4d('0x7c')](_0x47a0d8['query'][_0xfe4d('0x78')])?_0x47a0d8[_0xfe4d('0x32')][_0xfe4d('0x78')]:[_0x47a0d8['query'][_0xfe4d('0x78')]];var _0x309728=_0x47a0d8['params']['id'];return db['Team']['find']({'where':{'id':_0x309728}})[_0xfe4d('0x27')](handleEntityNotFound(_0x463b11,null))['then'](function(_0x285fbf){if(_0x285fbf){var _0x3904c4=[_0xfe4d('0x7d'),'Chat',_0xfe4d('0x94'),_0xfe4d('0x7e'),_0xfe4d('0x7f'),'Openchannel',_0xfe4d('0x81')];return db[_0xfe4d('0x53')]['transaction'](function(_0x271eae){var _0x14ae82=_[_0xfe4d('0x2c')](_0x3904c4,function(_0x47597e){var _0x3e3cbf={'attributes':['id',_0xfe4d('0x29')]};return _0x285fbf['get'+_0x47597e+'Queues'](_0x3e3cbf)[_0xfe4d('0x27')](function(_0x3e4078){var _0x57b534=_[_0xfe4d('0x2c')](_0x3e4078,function(_0x5cef04){return _0x5cef04[_0xfe4d('0x93')](_0x3cbe1d,{'transaction':_0x271eae})[_0xfe4d('0x27')](function(){var _0x70b30a=_[_0xfe4d('0x2c')](_0x3cbe1d,function(_0x5f3a96){socket[_0xfe4d('0x88')](_0xfe4d('0x4a')+_0x47597e+_0xfe4d('0x95'),{'UserId':Number(_0x5f3a96),[_0x47597e+_0xfe4d('0x84')]:_0x5cef04['id']});if(_0x47597e!=='Voice'){return;}return db[_0xfe4d('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x5cef04['id'],'UserId':_0x5f3a96},'transaction':_0x271eae});});return Promise['all'](_0x70b30a);});});return Promise[_0xfe4d('0x90')](_0x57b534);});});return Promise[_0xfe4d('0x90')](_0x14ae82)[_0xfe4d('0x27')](function(){return _0x285fbf['removeAgents'](_0x3cbe1d,{'transaction':_0x271eae});})[_0xfe4d('0x27')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x309728}})['then'](function(_0xa1ffa7){if(_0xa1ffa7){var _0x9c033e=_[_0xfe4d('0x2c')](_0x3cbe1d,function(_0x1b0726){db[_0xfe4d('0x91')][_0xfe4d('0x52')]({'where':{'UserId':_0x1b0726,'VoicePrefixId':_0xa1ffa7[_0xfe4d('0x6a')]}});});return Promise[_0xfe4d('0x90')](_0x9c033e);}});});});}})[_0xfe4d('0x27')](respondWithStatusCode(_0x463b11,null))[_0xfe4d('0x44')](handleError(_0x463b11,null));};exports[_0xfe4d('0x96')]=function(_0x4c2af3,_0x5b9c77,_0x3881e2){var _0x29edf9={};var _0x391ff0={};var _0x2d0513;var _0x4262a3;return db[_0xfe4d('0x2d')][_0xfe4d('0x6c')]({'where':{'id':_0x4c2af3['params']['id']}})[_0xfe4d('0x27')](handleEntityNotFound(_0x5b9c77,null))[_0xfe4d('0x27')](function(_0x540894){if(_0x540894){_0x2d0513=_0x540894;_0x391ff0[_0xfe4d('0x31')]=_[_0xfe4d('0x33')](db[_0xfe4d('0x86')][_0xfe4d('0x2e')]);_0x391ff0['query']=_[_0xfe4d('0x33')](_0x4c2af3[_0xfe4d('0x32')]);_0x391ff0[_0xfe4d('0x3a')]=_[_0xfe4d('0x34')](_0x391ff0['model'],_0x391ff0[_0xfe4d('0x32')]);_0x29edf9[_0xfe4d('0x36')]=_[_0xfe4d('0x34')](_0x391ff0['model'],qs[_0xfe4d('0x35')](_0x4c2af3[_0xfe4d('0x32')][_0xfe4d('0x35')]));_0x29edf9[_0xfe4d('0x36')]=_0x29edf9['attributes'][_0xfe4d('0x37')]?_0x29edf9[_0xfe4d('0x36')]:_0x391ff0['model'];_0x29edf9[_0xfe4d('0x73')]=qs[_0xfe4d('0x39')](_0x4c2af3[_0xfe4d('0x32')]['sort']);_0x29edf9[_0xfe4d('0x3d')]=qs['filters'](_['pick'](_0x4c2af3[_0xfe4d('0x32')],_0x391ff0[_0xfe4d('0x3a')]));if(_0x4c2af3[_0xfe4d('0x32')]['filter']){_0x29edf9[_0xfe4d('0x3d')]=_['merge'](_0x29edf9[_0xfe4d('0x3d')],{'$or':_['map'](_0x29edf9[_0xfe4d('0x36')],function(_0x28e62d){var _0x383390={};_0x383390[_0x28e62d]={'$like':'%'+_0x4c2af3[_0xfe4d('0x32')]['filter']+'%'};return _0x383390;})});}_0x29edf9=_[_0xfe4d('0x3f')]({},_0x29edf9,_0x4c2af3[_0xfe4d('0x46')]);return _0x2d0513[_0xfe4d('0x96')](_0x29edf9);}})['then'](function(_0x581253){if(_0x581253){_0x4262a3=_0x581253[_0xfe4d('0x37')];if(!_0x4c2af3[_0xfe4d('0x32')][_0xfe4d('0x38')](_0xfe4d('0x97'))){_0x29edf9[_0xfe4d('0x20')]=qs[_0xfe4d('0x20')](_0x4c2af3[_0xfe4d('0x32')][_0xfe4d('0x20')]);_0x29edf9[_0xfe4d('0x1f')]=qs[_0xfe4d('0x1f')](_0x4c2af3[_0xfe4d('0x32')][_0xfe4d('0x1f')]);}return _0x2d0513['getAgents'](_0x29edf9);}})[_0xfe4d('0x27')](function(_0x2e09e5){if(_0x2e09e5){return _0x2e09e5?{'count':_0x4262a3,'rows':_0x2e09e5}:null;}})[_0xfe4d('0x27')](respondWithResult(_0x5b9c77,null))['catch'](handleError(_0x5b9c77,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 22b5688..29bc07e 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 _0x4e13=['hasOwnProperty','exports','events','../../mysqldb','Team','save','update','remove','emit'];(function(_0x5850b2,_0x3002e4){var _0x5da823=function(_0x1b21c0){while(--_0x1b21c0){_0x5850b2['push'](_0x5850b2['shift']());}};_0x5da823(++_0x3002e4);}(_0x4e13,0x158));var _0x34e1=function(_0x245e2d,_0x1515a6){_0x245e2d=_0x245e2d-0x0;var _0x2d1b6f=_0x4e13[_0x245e2d];return _0x2d1b6f;};'use strict';var EventEmitter=require(_0x34e1('0x0'));var Team=require(_0x34e1('0x1'))['db'][_0x34e1('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34e1('0x3'),'afterUpdate':_0x34e1('0x4'),'afterDestroy':_0x34e1('0x5')};function emitEvent(_0x2ce777){return function(_0x4572e7,_0x45422d,_0x51af28){TeamEvents[_0x34e1('0x6')](_0x2ce777+':'+_0x4572e7['id'],_0x4572e7);TeamEvents[_0x34e1('0x6')](_0x2ce777,_0x4572e7);_0x51af28(null);};}for(var e in events){if(events[_0x34e1('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x34e1('0x8')]=TeamEvents; \ No newline at end of file +var _0xa51c=['hook','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0xdd5c6,_0xcf5f5d){var _0x5a4424=function(_0x52d9c7){while(--_0x52d9c7){_0xdd5c6['push'](_0xdd5c6['shift']());}};_0x5a4424(++_0xcf5f5d);}(_0xa51c,0x103));var _0xca51=function(_0x2a1586,_0x30f4d7){_0x2a1586=_0x2a1586-0x0;var _0x181006=_0xa51c[_0x2a1586];return _0x181006;};'use strict';var EventEmitter=require(_0xca51('0x0'));var Team=require(_0xca51('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xca51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xca51('0x3')};function emitEvent(_0x4b8b19){return function(_0x7d6391,_0x516c90,_0x2fa074){TeamEvents[_0xca51('0x4')](_0x4b8b19+':'+_0x7d6391['id'],_0x7d6391);TeamEvents[_0xca51('0x4')](_0x4b8b19,_0x7d6391);_0x2fa074(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xca51('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 92a9060..89950a7 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 _0x83b2=['exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x83b2,0x1c5));var _0x283b=function(_0x2c0f49,_0x204a0e){_0x2c0f49=_0x2c0f49-0x0;var _0x28c55c=_0x83b2[_0x2c0f49];return _0x28c55c;};'use strict';var _=require(_0x283b('0x0'));var attributes=require(_0x283b('0x1'));function getQueuesByChannel(_0x22caf2,_0x54a37a){var _0x58563d=_0x283b('0x2')+_0x54a37a+_0x283b('0x3');return _0x22caf2[_0x58563d]()[_0x283b('0x4')](function(_0x592fea){return _[_0x283b('0x5')](_0x592fea,function(_0x363b1d){_0x363b1d[_0x283b('0x6')](_0x283b('0x7'),_0x54a37a);return _0x363b1d;});})[_0x283b('0x8')](function(_0x2d8204){throw _0x2d8204;});}module[_0x283b('0x9')]=function(_0x2687a1){return _0x2687a1[_0x283b('0xa')](_0x283b('0xb'),attributes,{'tableName':_0x283b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x9648d1=this;var _0x1f4eb0=[_0x283b('0xd'),_0x283b('0xe'),_0x283b('0xf'),_0x283b('0x10'),'Sms',_0x283b('0x11'),_0x283b('0x12')];return Promise[_0x283b('0x13')]()[_0x283b('0x4')](function(){var _0x5de67f=_['map'](_0x1f4eb0,function(_0x576783){return getQueuesByChannel(_0x9648d1,_0x576783);});return Promise[_0x283b('0x14')](_0x5de67f);})[_0x283b('0x8')](function(_0x513eee){throw _0x513eee;});}}});}; \ No newline at end of file +var _0x582e=['resolve','all','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','define','Team','Chat','Fax','Mail','Sms','Voice','Whatsapp'];(function(_0x5b0069,_0x546893){var _0x28d5c4=function(_0x10c257){while(--_0x10c257){_0x5b0069['push'](_0x5b0069['shift']());}};_0x28d5c4(++_0x546893);}(_0x582e,0x110));var _0xe582=function(_0x187266,_0x3f99df){_0x187266=_0x187266-0x0;var _0x1a83bc=_0x582e[_0x187266];return _0x1a83bc;};'use strict';var _=require('lodash');var attributes=require(_0xe582('0x0'));function getQueuesByChannel(_0x5e17cf,_0x32a801){var _0x302891=_0xe582('0x1')+_0x32a801+_0xe582('0x2');return _0x5e17cf[_0x302891]()[_0xe582('0x3')](function(_0x51a144){return _[_0xe582('0x4')](_0x51a144,function(_0x1d02b6){_0x1d02b6[_0xe582('0x5')](_0xe582('0x6'),_0x32a801);return _0x1d02b6;});})[_0xe582('0x7')](function(_0x2bb922){throw _0x2bb922;});}module['exports']=function(_0x2d7fd3){return _0x2d7fd3[_0xe582('0x8')](_0xe582('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3a36e8=this;var _0x42a2e2=[_0xe582('0xa'),_0xe582('0xb'),_0xe582('0xc'),'Openchannel',_0xe582('0xd'),_0xe582('0xe'),_0xe582('0xf')];return Promise[_0xe582('0x10')]()['then'](function(){var _0x8837f=_[_0xe582('0x4')](_0x42a2e2,function(_0xa0cb63){return getQueuesByChannel(_0x3a36e8,_0xa0cb63);});return Promise[_0xe582('0x11')](_0x8837f);})['catch'](function(_0x31d10f){throw _0x31d10f;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1e03036..c7e544f 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 _0x09e6=['code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','./team.socket','register','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x09e6,0xba));var _0x609e=function(_0x3a2c81,_0x356717){_0x3a2c81=_0x3a2c81-0x0;var _0x80c26c=_0x09e6[_0x3a2c81];return _0x80c26c;};'use strict';var _=require(_0x609e('0x0'));var util=require(_0x609e('0x1'));var moment=require(_0x609e('0x2'));var BPromise=require('bluebird');var rs=require(_0x609e('0x3'));var fs=require('fs');var Redis=require(_0x609e('0x4'));var db=require(_0x609e('0x5'))['db'];var utils=require(_0x609e('0x6'));var logger=require(_0x609e('0x7'))(_0x609e('0x8'));var config=require('../../config/environment');var jayson=require(_0x609e('0x9'));var client=jayson[_0x609e('0xa')]['http']({'port':0x232a});config[_0x609e('0xb')]=_[_0x609e('0xc')](config[_0x609e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x609e('0xd'))[_0x609e('0xe')](socket);function respondWithRpcPromise(_0x1b88dd,_0x5ee138,_0xa7c101){return new BPromise(function(_0x1c5f89,_0x5badac){return client['request'](_0x1b88dd,_0xa7c101)[_0x609e('0xf')](function(_0xa1177f){logger[_0x609e('0x10')]('Team,\x20%s,\x20%s',_0x5ee138,_0x609e('0x11'));logger[_0x609e('0x12')](_0x609e('0x13'),_0x5ee138,_0x609e('0x11'),JSON[_0x609e('0x14')](_0xa1177f));if(_0xa1177f['error']){if(_0xa1177f[_0x609e('0x15')][_0x609e('0x16')]===0x1f4){logger[_0x609e('0x15')](_0x609e('0x17'),_0x5ee138,_0xa1177f[_0x609e('0x15')]['message']);return _0x5badac(_0xa1177f[_0x609e('0x15')][_0x609e('0x18')]);}logger[_0x609e('0x15')](_0x609e('0x17'),_0x5ee138,_0xa1177f[_0x609e('0x15')][_0x609e('0x18')]);return _0x1c5f89(_0xa1177f[_0x609e('0x15')]['message']);}else{logger[_0x609e('0x10')]('Team,\x20%s,\x20%s',_0x5ee138,_0x609e('0x11'));_0x1c5f89(_0xa1177f['result'][_0x609e('0x18')]);}})[_0x609e('0x19')](function(_0x4e3a47){logger[_0x609e('0x15')](_0x609e('0x17'),_0x5ee138,_0x4e3a47);_0x5badac(_0x4e3a47);});});} \ No newline at end of file +var _0x804a=['stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x50962c,_0x272a0c){var _0x3ef2a3=function(_0x486513){while(--_0x486513){_0x50962c['push'](_0x50962c['shift']());}};_0x3ef2a3(++_0x272a0c);}(_0x804a,0x164));var _0xa804=function(_0x29b9ab,_0x24bcbf){_0x29b9ab=_0x29b9ab-0x0;var _0x11cc8a=_0x804a[_0x29b9ab];return _0x11cc8a;};'use strict';var _=require('lodash');var util=require(_0xa804('0x0'));var moment=require(_0xa804('0x1'));var BPromise=require('bluebird');var rs=require(_0xa804('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa804('0x3'))['db'];var utils=require(_0xa804('0x4'));var logger=require(_0xa804('0x5'))(_0xa804('0x6'));var config=require(_0xa804('0x7'));var jayson=require(_0xa804('0x8'));var client=jayson[_0xa804('0x9')][_0xa804('0xa')]({'port':0x232a});config[_0xa804('0xb')]=_[_0xa804('0xc')](config[_0xa804('0xb')],{'host':_0xa804('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa804('0xe'))[_0xa804('0xf')](socket);function respondWithRpcPromise(_0x50c22e,_0x5e7ba4,_0x135544){return new BPromise(function(_0x145441,_0x434f71){return client['request'](_0x50c22e,_0x135544)[_0xa804('0x10')](function(_0x11f425){logger[_0xa804('0x11')](_0xa804('0x12'),_0x5e7ba4,_0xa804('0x13'));logger[_0xa804('0x14')](_0xa804('0x15'),_0x5e7ba4,_0xa804('0x13'),JSON[_0xa804('0x16')](_0x11f425));if(_0x11f425[_0xa804('0x17')]){if(_0x11f425[_0xa804('0x17')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x5e7ba4,_0x11f425[_0xa804('0x17')][_0xa804('0x18')]);return _0x434f71(_0x11f425[_0xa804('0x17')][_0xa804('0x18')]);}logger[_0xa804('0x17')]('Team,\x20%s,\x20%s',_0x5e7ba4,_0x11f425[_0xa804('0x17')][_0xa804('0x18')]);return _0x145441(_0x11f425[_0xa804('0x17')][_0xa804('0x18')]);}else{logger['info'](_0xa804('0x12'),_0x5e7ba4,_0xa804('0x13'));_0x145441(_0x11f425[_0xa804('0x19')]['message']);}})[_0xa804('0x1a')](function(_0x2e2bbc){logger['error'](_0xa804('0x12'),_0x5e7ba4,_0x2e2bbc);_0x434f71(_0x2e2bbc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f6bce5a..7dddea7 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 _0xebb1=['save','remove','update','emit','removeListener','register','team:'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xebb1,0x1e3));var _0x1ebb=function(_0x375662,_0x2bdd94){_0x375662=_0x375662-0x0;var _0x136ffa=_0xebb1[_0x375662];return _0x136ffa;};'use strict';var TeamEvents=require('./team.events');var events=[_0x1ebb('0x0'),_0x1ebb('0x1'),_0x1ebb('0x2')];function createListener(_0x2db068,_0x3f5e50){return function(_0x19735f){_0x3f5e50[_0x1ebb('0x3')](_0x2db068,_0x19735f);};}function removeListener(_0x10a84c,_0x146501){return function(){TeamEvents[_0x1ebb('0x4')](_0x10a84c,_0x146501);};}exports[_0x1ebb('0x5')]=function(_0x58d76b){for(var _0x3628f2=0x0,_0x2d3115=events['length'];_0x3628f2<_0x2d3115;_0x3628f2++){var _0x5f4f64=events[_0x3628f2];var _0x5da402=createListener(_0x1ebb('0x6')+_0x5f4f64,_0x58d76b);TeamEvents['on'](_0x5f4f64,_0x5da402);}}; \ No newline at end of file +var _0xecd8=['length','team:','./team.events','remove','update','emit'];(function(_0x589cc6,_0xc4e10d){var _0x2320dc=function(_0x551dcb){while(--_0x551dcb){_0x589cc6['push'](_0x589cc6['shift']());}};_0x2320dc(++_0xc4e10d);}(_0xecd8,0x6e));var _0x8ecd=function(_0x1c5bf8,_0x378abf){_0x1c5bf8=_0x1c5bf8-0x0;var _0x53896f=_0xecd8[_0x1c5bf8];return _0x53896f;};'use strict';var TeamEvents=require(_0x8ecd('0x0'));var events=['save',_0x8ecd('0x1'),_0x8ecd('0x2')];function createListener(_0x2a051e,_0x3ad184){return function(_0x451a33){_0x3ad184[_0x8ecd('0x3')](_0x2a051e,_0x451a33);};}function removeListener(_0x530906,_0x4ee7e4){return function(){TeamEvents['removeListener'](_0x530906,_0x4ee7e4);};}exports['register']=function(_0x2f993e){for(var _0x4a866e=0x0,_0x23cb9b=events[_0x8ecd('0x4')];_0x4a866e<_0x23cb9b;_0x4a866e++){var _0x5bf5cc=events[_0x4a866e];var _0x2c7e69=createListener(_0x8ecd('0x5')+_0x5bf5cc,_0x2f993e);TeamEvents['on'](_0x5bf5cc,_0x2c7e69);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6d682cd..c7c8b4f 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 _0x9000=['sequelize','exports','INTEGER'];(function(_0x238d90,_0x55ab60){var _0x46388a=function(_0x1ea450){while(--_0x1ea450){_0x238d90['push'](_0x238d90['shift']());}};_0x46388a(++_0x55ab60);}(_0x9000,0x19e));var _0x0900=function(_0xffdd08,_0x5cfdbc){_0xffdd08=_0xffdd08-0x0;var _0x2cb77f=_0x9000[_0xffdd08];return _0x2cb77f;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0900('0x2')]}}; \ No newline at end of file +var _0x79e0=['exports','INTEGER','sequelize'];(function(_0x475eb0,_0xfb701c){var _0x4a010a=function(_0x959b76){while(--_0x959b76){_0x475eb0['push'](_0x475eb0['shift']());}};_0x4a010a(++_0xfb701c);}(_0x79e0,0x1f4));var _0x079e=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x79e0[_0x1177d5];return _0xc3ddc2;};'use strict';var Sequelize=require(_0x079e('0x0'));module[_0x079e('0x1')]={'TeamId':{'type':Sequelize[_0x079e('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e23da88..5405d79 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util'];(function(_0x4d16a2,_0x25fad8){var _0x4529f2=function(_0x31db05){while(--_0x31db05){_0x4d16a2['push'](_0x4d16a2['shift']());}};_0x4529f2(++_0x25fad8);}(_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 logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc06d=['bluebird','request-promise','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x5856e1,_0x30b0da){var _0x3ad97e=function(_0x10a904){while(--_0x10a904){_0x5856e1['push'](_0x5856e1['shift']());}};_0x3ad97e(++_0x30b0da);}(_0xc06d,0x15a));var _0xdc06=function(_0x1f1854,_0x1a2c27){_0x1f1854=_0x1f1854-0x0;var _0x3f0ebb=_0xc06d[_0x1f1854];return _0x3f0ebb;};'use strict';var _=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var logger=require(_0xdc06('0x2'))(_0xdc06('0x3'));var moment=require('moment');var BPromise=require(_0xdc06('0x4'));var rp=require(_0xdc06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc06('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xdc06('0x7')]=function(_0x2f7692,_0x5ce60c){return _0x2f7692['define'](_0xdc06('0x8'),attributes,{'tableName':_0xdc06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 86eab8f..20ed320 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x179b80,_0x440291){var _0x1e8d03=function(_0x466a71){while(--_0x466a71){_0x179b80['push'](_0x179b80['shift']());}};_0x1e8d03(++_0x440291);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x200be5,_0x29b3c9){var _0x75e39a=function(_0x22b226){while(--_0x22b226){_0x200be5['push'](_0x200be5['shift']());}};_0x75e39a(++_0x29b3c9);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e9d73,_0x5e581c){_0x1e9d73=_0x1e9d73-0x0;var _0x218d09=_0xedd9[_0x1e9d73];return _0x218d09;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index b6138ce..3363c32 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 _0xa43a=['exports','INTEGER','sequelize'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xa43a,0xe3));var _0xaa43=function(_0x1b2e8f,_0x16b226){_0x1b2e8f=_0x1b2e8f-0x0;var _0x37a55d=_0xa43a[_0x1b2e8f];return _0x37a55d;};'use strict';var Sequelize=require(_0xaa43('0x0'));module[_0xaa43('0x1')]={'penalty':{'type':Sequelize[_0xaa43('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8177=['exports','INTEGER'];(function(_0x2fd511,_0x4964e5){var _0x4d5219=function(_0x275cb9){while(--_0x275cb9){_0x2fd511['push'](_0x2fd511['shift']());}};_0x4d5219(++_0x4964e5);}(_0x8177,0x190));var _0x7817=function(_0x4c2037,_0x2acda5){_0x4c2037=_0x4c2037-0x0;var _0x5bda39=_0x8177[_0x4c2037];return _0x5bda39;};'use strict';var Sequelize=require('sequelize');module[_0x7817('0x0')]={'penalty':{'type':Sequelize[_0x7817('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 b0dc0dd..6b504ad 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 _0x2e35=['exports','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x45b29a,_0x2e9828){var _0x1e81c5=function(_0x30770c){while(--_0x30770c){_0x45b29a['push'](_0x45b29a['shift']());}};_0x1e81c5(++_0x2e9828);}(_0x2e35,0x1d0));var _0x52e3=function(_0x395c57,_0x1b6509){_0x395c57=_0x395c57-0x0;var _0x3008b7=_0x2e35[_0x395c57];return _0x3008b7;};'use strict';var _=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var logger=require(_0x52e3('0x2'))('api');var moment=require(_0x52e3('0x3'));var BPromise=require(_0x52e3('0x4'));var rp=require(_0x52e3('0x5'));var fs=require('fs');var path=require(_0x52e3('0x6'));var rimraf=require('rimraf');var config=require(_0x52e3('0x7'));var attributes=require(_0x52e3('0x8'));module[_0x52e3('0x9')]=function(_0x20d1bc,_0x5f117a){return _0x20d1bc['define']('TeamVoiceQueue',attributes,{'tableName':_0x52e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43f3=['team_has_voice_queues','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x43f3,0xab));var _0x343f=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x43f3[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require('lodash');var util=require(_0x343f('0x0'));var logger=require(_0x343f('0x1'))('api');var moment=require(_0x343f('0x2'));var BPromise=require('bluebird');var rp=require(_0x343f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x343f('0x4'));var config=require(_0x343f('0x5'));var attributes=require(_0x343f('0x6'));module['exports']=function(_0x2ec994,_0x693775){return _0x2ec994[_0x343f('0x7')](_0x343f('0x8'),attributes,{'tableName':_0x343f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index a947e6e..8a0ee2d 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 _0xb7dc=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0xb7dc,0xf9));var _0xcb7d=function(_0x445073,_0x4e00d2){_0x445073=_0x445073-0x0;var _0x46f81f=_0xb7dc[_0x445073];return _0x46f81f;};'use strict';var _=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var moment=require(_0xcb7d('0x2'));var BPromise=require(_0xcb7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcb7d('0x4'));var logger=require(_0xcb7d('0x5'))(_0xcb7d('0x6'));var config=require(_0xcb7d('0x7'));var jayson=require(_0xcb7d('0x8'));var client=jayson[_0xcb7d('0x9')][_0xcb7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193716,_0x55030f,_0x4e8ed5){return new BPromise(function(_0x51b16e,_0x5a54be){return client['request'](_0x193716,_0x4e8ed5)[_0xcb7d('0xb')](function(_0x20d7c8){logger['info'](_0xcb7d('0xc'),_0x55030f,_0xcb7d('0xd'));logger[_0xcb7d('0xe')](_0xcb7d('0xf'),_0x55030f,'request\x20sent',JSON[_0xcb7d('0x10')](_0x20d7c8));if(_0x20d7c8[_0xcb7d('0x11')]){if(_0x20d7c8[_0xcb7d('0x11')]['code']===0x1f4){logger[_0xcb7d('0x11')](_0xcb7d('0xc'),_0x55030f,_0x20d7c8['error']['message']);return _0x5a54be(_0x20d7c8[_0xcb7d('0x11')][_0xcb7d('0x12')]);}logger[_0xcb7d('0x11')](_0xcb7d('0xc'),_0x55030f,_0x20d7c8[_0xcb7d('0x11')][_0xcb7d('0x12')]);return _0x51b16e(_0x20d7c8['error'][_0xcb7d('0x12')]);}else{logger[_0xcb7d('0x13')](_0xcb7d('0xc'),_0x55030f,'request\x20sent');_0x51b16e(_0x20d7c8[_0xcb7d('0x14')]['message']);}})[_0xcb7d('0x15')](function(_0x166d1e){logger['error'](_0xcb7d('0xc'),_0x55030f,_0x166d1e);_0x5a54be(_0x166d1e);});});} \ No newline at end of file +var _0xa639=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3d773f,_0x3462b3){var _0x22bf3a=function(_0x2d295e){while(--_0x2d295e){_0x3d773f['push'](_0x3d773f['shift']());}};_0x22bf3a(++_0x3462b3);}(_0xa639,0x140));var _0x9a63=function(_0x176332,_0x402630){_0x176332=_0x176332-0x0;var _0x1112ef=_0xa639[_0x176332];return _0x1112ef;};'use strict';var _=require('lodash');var util=require(_0x9a63('0x0'));var moment=require(_0x9a63('0x1'));var BPromise=require(_0x9a63('0x2'));var rs=require(_0x9a63('0x3'));var fs=require('fs');var Redis=require(_0x9a63('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a63('0x5'));var logger=require('../../config/logger')(_0x9a63('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a63('0x7'));var client=jayson[_0x9a63('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x274868,_0x2e9e8a,_0x56e5c5){return new BPromise(function(_0x494d6d,_0x5189b0){return client[_0x9a63('0x9')](_0x274868,_0x56e5c5)[_0x9a63('0xa')](function(_0xc736fc){logger[_0x9a63('0xb')](_0x9a63('0xc'),_0x2e9e8a,_0x9a63('0xd'));logger[_0x9a63('0xe')](_0x9a63('0xf'),_0x2e9e8a,'request\x20sent',JSON[_0x9a63('0x10')](_0xc736fc));if(_0xc736fc['error']){if(_0xc736fc[_0x9a63('0x11')]['code']===0x1f4){logger['error'](_0x9a63('0xc'),_0x2e9e8a,_0xc736fc[_0x9a63('0x11')][_0x9a63('0x12')]);return _0x5189b0(_0xc736fc[_0x9a63('0x11')]['message']);}logger[_0x9a63('0x11')](_0x9a63('0xc'),_0x2e9e8a,_0xc736fc['error'][_0x9a63('0x12')]);return _0x494d6d(_0xc736fc[_0x9a63('0x11')][_0x9a63('0x12')]);}else{logger[_0x9a63('0xb')](_0x9a63('0xc'),_0x2e9e8a,_0x9a63('0xd'));_0x494d6d(_0xc736fc[_0x9a63('0x13')][_0x9a63('0x12')]);}})[_0x9a63('0x14')](function(_0x83738e){logger[_0x9a63('0x11')](_0x9a63('0xc'),_0x2e9e8a,_0x83738e);_0x5189b0(_0x83738e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 10ce145..3e7262a 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 _0x3cd0=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x3cd0,0x8a));var _0x03cd=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x3cd0[_0x23c73d];return _0x36ba47;};'use strict';var multer=require(_0x03cd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03cd('0x1'));var express=require('express');var router=express[_0x03cd('0x2')]();var fs_extra=require(_0x03cd('0x3'));var auth=require(_0x03cd('0x4'));var interaction=require(_0x03cd('0x5'));var config=require(_0x03cd('0x6'));var controller=require('./template.controller');router[_0x03cd('0x7')]('/',auth[_0x03cd('0x8')](),controller[_0x03cd('0x9')]);router[_0x03cd('0x7')](_0x03cd('0xa'),auth['isAuthenticated'](),controller[_0x03cd('0xb')]);router['post']('/',auth[_0x03cd('0x8')](),controller[_0x03cd('0xc')]);router[_0x03cd('0xd')](_0x03cd('0xa'),auth['isAuthenticated'](),controller[_0x03cd('0xe')]);router[_0x03cd('0xf')](_0x03cd('0xa'),auth[_0x03cd('0x8')](),controller[_0x03cd('0x10')]);module[_0x03cd('0x11')]=router; \ No newline at end of file +var _0x3d04=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x315790,_0x33194e){var _0x311348=function(_0x44bb77){while(--_0x44bb77){_0x315790['push'](_0x315790['shift']());}};_0x311348(++_0x33194e);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xd')]('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router[_0x43d0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x43d0('0x10')]);router['delete']('/:id',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);module[_0x43d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bd7742c..332ea32 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 _0x8cb5=['STRING','TEXT','exports'];(function(_0x79da9f,_0x54551a){var _0x402abd=function(_0x1e560a){while(--_0x1e560a){_0x79da9f['push'](_0x79da9f['shift']());}};_0x402abd(++_0x54551a);}(_0x8cb5,0x170));var _0x58cb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8cb5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x58cb('0x0')]={'name':{'type':Sequelize[_0x58cb('0x1')]},'description':{'type':Sequelize[_0x58cb('0x1')]},'html':{'type':Sequelize[_0x58cb('0x2')]}}; \ No newline at end of file +var _0xceac=['exports','STRING','TEXT','sequelize'];(function(_0xd912d5,_0xc47dcb){var _0x38dfdc=function(_0x207391){while(--_0x207391){_0xd912d5['push'](_0xd912d5['shift']());}};_0x38dfdc(++_0xc47dcb);}(_0xceac,0x9f));var _0xccea=function(_0x1211a1,_0x1ec2fe){_0x1211a1=_0x1211a1-0x0;var _0x420650=_0xceac[_0x1211a1];return _0x420650;};'use strict';var Sequelize=require(_0xccea('0x0'));module[_0xccea('0x1')]={'name':{'type':Sequelize[_0xccea('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xccea('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a1e053d..5fb0e90 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 _0xdaaa=['where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','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','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Template','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x3c77be,_0x3990ea){var _0x6cb6ea=function(_0x1ace5f){while(--_0x1ace5f){_0x3c77be['push'](_0x3c77be['shift']());}};_0x6cb6ea(++_0x3990ea);}(_0xdaaa,0x6e));var _0xadaa=function(_0x25abae,_0x570232){_0x25abae=_0x25abae-0x0;var _0x7e5ead=_0xdaaa[_0x25abae];return _0x7e5ead;};'use strict';var emlformat=require(_0xadaa('0x0'));var rimraf=require(_0xadaa('0x1'));var zipdir=require(_0xadaa('0x2'));var jsonpatch=require(_0xadaa('0x3'));var rp=require(_0xadaa('0x4'));var moment=require(_0xadaa('0x5'));var BPromise=require(_0xadaa('0x6'));var Mustache=require(_0xadaa('0x7'));var util=require(_0xadaa('0x8'));var path=require(_0xadaa('0x9'));var sox=require('sox');var csv=require(_0xadaa('0xa'));var ejs=require(_0xadaa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadaa('0xc'));var squel=require(_0xadaa('0xd'));var crypto=require(_0xadaa('0xe'));var jsforce=require(_0xadaa('0xf'));var deskjs=require(_0xadaa('0x10'));var toCsv=require(_0xadaa('0xa'));var querystring=require(_0xadaa('0x11'));var Papa=require(_0xadaa('0x12'));var Redis=require('ioredis');var authService=require(_0xadaa('0x13'));var qs=require(_0xadaa('0x14'));var as=require(_0xadaa('0x15'));var hardwareService=require(_0xadaa('0x16'));var logger=require('../../config/logger')(_0xadaa('0x17'));var utils=require(_0xadaa('0x18'));var config=require(_0xadaa('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xadaa('0x1a'))['db'];function respondWithStatusCode(_0x16d6d0,_0x4a934d){_0x4a934d=_0x4a934d||0xcc;return function(_0x56558c){if(_0x56558c){return _0x16d6d0['sendStatus'](_0x4a934d);}return _0x16d6d0[_0xadaa('0x1b')](_0x4a934d)[_0xadaa('0x1c')]();};}function respondWithResult(_0x2aba5e,_0x3ff264){_0x3ff264=_0x3ff264||0xc8;return function(_0x31b60d){if(_0x31b60d){return _0x2aba5e['status'](_0x3ff264)[_0xadaa('0x1d')](_0x31b60d);}};}function respondWithFilteredResult(_0x2afdb6,_0x80ce1c){return function(_0x102876){if(_0x102876){var _0x30446d=typeof _0x80ce1c[_0xadaa('0x1e')]===_0xadaa('0x1f')&&typeof _0x80ce1c[_0xadaa('0x20')]===_0xadaa('0x1f');var _0x36560d=_0x102876[_0xadaa('0x21')];var _0x36c06c=_0x30446d?0x0:_0x80ce1c[_0xadaa('0x1e')];var _0x11f39f=_0x30446d?_0x102876['count']:_0x80ce1c['offset']+_0x80ce1c[_0xadaa('0x20')];var _0x591848;if(_0x11f39f>=_0x36560d){_0x11f39f=_0x36560d;_0x591848=0xc8;}else{_0x591848=0xce;}_0x2afdb6[_0xadaa('0x1b')](_0x591848);return _0x2afdb6[_0xadaa('0x22')](_0xadaa('0x23'),_0x36c06c+'-'+_0x11f39f+'/'+_0x36560d)[_0xadaa('0x1d')](_0x102876);}return null;};}function patchUpdates(_0x16c8a4){return function(_0x7b0d83){try{jsonpatch[_0xadaa('0x24')](_0x7b0d83,_0x16c8a4,!![]);}catch(_0x55ea61){return BPromise[_0xadaa('0x25')](_0x55ea61);}return _0x7b0d83[_0xadaa('0x26')]();};}function saveUpdates(_0x4e57a7,_0x165622){return function(_0x4bc5a4){if(_0x4bc5a4){return _0x4bc5a4[_0xadaa('0x27')](_0x4e57a7)[_0xadaa('0x28')](function(_0x5927d9){return _0x5927d9;});}return null;};}function removeEntity(_0x2cd6f2,_0x529672){return function(_0x3a244e){if(_0x3a244e){return _0x3a244e['destroy']()[_0xadaa('0x28')](function(){var _0x5431c7=_0x3a244e[_0xadaa('0x29')]({'plain':!![]});var _0x47d095='Templates';return db[_0xadaa('0x2a')][_0xadaa('0x2b')]({'where':{'type':_0x47d095,'resourceId':_0x5431c7['id']}})[_0xadaa('0x28')](function(){return _0x3a244e;});})['then'](function(){_0x2cd6f2[_0xadaa('0x1b')](0xcc)[_0xadaa('0x1c')]();});}};}function handleEntityNotFound(_0x35a7a4,_0x1faf39){return function(_0x1ec801){if(!_0x1ec801){_0x35a7a4[_0xadaa('0x2c')](0x194);}return _0x1ec801;};}function handleError(_0x4557f9,_0x3e329d){_0x3e329d=_0x3e329d||0x1f4;return function(_0x574b67){logger[_0xadaa('0x2d')](_0x574b67[_0xadaa('0x2e')]);if(_0x574b67[_0xadaa('0x2f')]){delete _0x574b67[_0xadaa('0x2f')];}_0x4557f9[_0xadaa('0x1b')](_0x3e329d)['send'](_0x574b67);};}exports[_0xadaa('0x30')]=function(_0x3e6314,_0x18c191){var _0x3cd6ee={},_0x4118bf={},_0x211aa1={'count':0x0,'rows':[]};var _0xd0590d=_[_0xadaa('0x31')](db[_0xadaa('0x32')][_0xadaa('0x33')],function(_0xb332c){return{'name':_0xb332c['fieldName'],'type':_0xb332c['type'][_0xadaa('0x34')]};});_0x4118bf[_0xadaa('0x35')]=_[_0xadaa('0x31')](_0xd0590d,_0xadaa('0x2f'));_0x4118bf[_0xadaa('0x36')]=_['keys'](_0x3e6314['query']);_0x4118bf[_0xadaa('0x37')]=_[_0xadaa('0x38')](_0x4118bf['model'],_0x4118bf['query']);_0x3cd6ee[_0xadaa('0x39')]=_['intersection'](_0x4118bf[_0xadaa('0x35')],qs['fields'](_0x3e6314[_0xadaa('0x36')][_0xadaa('0x3a')]));_0x3cd6ee[_0xadaa('0x39')]=_0x3cd6ee[_0xadaa('0x39')][_0xadaa('0x3b')]?_0x3cd6ee[_0xadaa('0x39')]:_0x4118bf[_0xadaa('0x35')];if(!_0x3e6314[_0xadaa('0x36')][_0xadaa('0x3c')](_0xadaa('0x3d'))){_0x3cd6ee[_0xadaa('0x20')]=qs[_0xadaa('0x20')](_0x3e6314[_0xadaa('0x36')][_0xadaa('0x20')]);_0x3cd6ee[_0xadaa('0x1e')]=qs[_0xadaa('0x1e')](_0x3e6314[_0xadaa('0x36')]['offset']);}_0x3cd6ee[_0xadaa('0x3e')]=qs['sort'](_0x3e6314[_0xadaa('0x36')][_0xadaa('0x3f')]);_0x3cd6ee['where']=qs[_0xadaa('0x37')](_[_0xadaa('0x40')](_0x3e6314[_0xadaa('0x36')],_0x4118bf[_0xadaa('0x37')]),_0xd0590d);if(_0x3e6314['query'][_0xadaa('0x41')]){_0x3cd6ee[_0xadaa('0x42')]=_[_0xadaa('0x43')](_0x3cd6ee[_0xadaa('0x42')],{'$or':_[_0xadaa('0x31')](_0xd0590d,function(_0xb8e631){if(_0xb8e631['type']!=='VIRTUAL'){var _0x51cb0={};_0x51cb0[_0xb8e631['name']]={'$like':'%'+_0x3e6314[_0xadaa('0x36')]['filter']+'%'};return _0x51cb0;}})});}_0x3cd6ee=_[_0xadaa('0x43')]({},_0x3cd6ee,_0x3e6314[_0xadaa('0x44')]);var _0x20a593={'where':_0x3cd6ee[_0xadaa('0x42')]};return db[_0xadaa('0x32')][_0xadaa('0x21')](_0x20a593)[_0xadaa('0x28')](function(_0x55cfed){_0x211aa1[_0xadaa('0x21')]=_0x55cfed;if(_0x3e6314[_0xadaa('0x36')][_0xadaa('0x45')]){_0x3cd6ee[_0xadaa('0x46')]=[{'all':!![]}];}return db['Template'][_0xadaa('0x47')](_0x3cd6ee);})[_0xadaa('0x28')](function(_0x45c4c4){_0x211aa1[_0xadaa('0x48')]=_0x45c4c4;return _0x211aa1;})[_0xadaa('0x28')](respondWithFilteredResult(_0x18c191,_0x3cd6ee))[_0xadaa('0x49')](handleError(_0x18c191,null));};exports[_0xadaa('0x4a')]=function(_0x2bfbe5,_0x203fcc){var _0x33695f={'raw':!![],'where':{'id':_0x2bfbe5[_0xadaa('0x4b')]['id']}},_0x43411a={};_0x43411a[_0xadaa('0x35')]=_[_0xadaa('0x4c')](db[_0xadaa('0x32')][_0xadaa('0x33')]);_0x43411a[_0xadaa('0x36')]=_[_0xadaa('0x4c')](_0x2bfbe5[_0xadaa('0x36')]);_0x43411a[_0xadaa('0x37')]=_[_0xadaa('0x38')](_0x43411a[_0xadaa('0x35')],_0x43411a[_0xadaa('0x36')]);_0x33695f[_0xadaa('0x39')]=_[_0xadaa('0x38')](_0x43411a[_0xadaa('0x35')],qs[_0xadaa('0x3a')](_0x2bfbe5['query'][_0xadaa('0x3a')]));_0x33695f[_0xadaa('0x39')]=_0x33695f[_0xadaa('0x39')]['length']?_0x33695f[_0xadaa('0x39')]:_0x43411a[_0xadaa('0x35')];if(_0x2bfbe5[_0xadaa('0x36')][_0xadaa('0x45')]){_0x33695f['include']=[{'all':!![]}];}_0x33695f=_[_0xadaa('0x43')]({},_0x33695f,_0x2bfbe5[_0xadaa('0x44')]);return db['Template'][_0xadaa('0x4d')](_0x33695f)[_0xadaa('0x28')](handleEntityNotFound(_0x203fcc,null))[_0xadaa('0x28')](respondWithResult(_0x203fcc,null))[_0xadaa('0x49')](handleError(_0x203fcc,null));};exports[_0xadaa('0x4e')]=function(_0x12354c,_0x310821){return db[_0xadaa('0x32')]['create'](_0x12354c[_0xadaa('0x4f')],{})[_0xadaa('0x28')](function(_0x274a50){var _0x541003=_0x12354c[_0xadaa('0x50')]['get']({'plain':!![]});if(!_0x541003)throw new Error(_0xadaa('0x51'));if(_0x541003[_0xadaa('0x52')]===_0xadaa('0x50')){var _0x4bcfbe=_0x274a50[_0xadaa('0x29')]({'plain':!![]});var _0xb51269=_0xadaa('0x53');return db[_0xadaa('0x54')][_0xadaa('0x4d')]({'where':{'name':_0xb51269,'userProfileId':_0x541003[_0xadaa('0x55')]},'raw':!![]})[_0xadaa('0x28')](function(_0x2f2921){if(_0x2f2921&&_0x2f2921[_0xadaa('0x56')]===0x0){return db['UserProfileResource'][_0xadaa('0x4e')]({'name':_0x4bcfbe[_0xadaa('0x2f')],'resourceId':_0x4bcfbe['id'],'type':_0x2f2921[_0xadaa('0x2f')],'sectionId':_0x2f2921['id']},{})[_0xadaa('0x28')](function(){return _0x274a50;});}else{return _0x274a50;}})[_0xadaa('0x49')](function(_0x230808){logger[_0xadaa('0x2d')](_0xadaa('0x57'),_0x230808);throw _0x230808;});}return _0x274a50;})['then'](respondWithResult(_0x310821,0xc9))[_0xadaa('0x49')](handleError(_0x310821,null));};exports[_0xadaa('0x27')]=function(_0x4d33c8,_0x3242fa){if(_0x4d33c8[_0xadaa('0x4f')]['id']){delete _0x4d33c8[_0xadaa('0x4f')]['id'];}return db[_0xadaa('0x32')]['find']({'where':{'id':_0x4d33c8[_0xadaa('0x4b')]['id']}})[_0xadaa('0x28')](handleEntityNotFound(_0x3242fa,null))[_0xadaa('0x28')](saveUpdates(_0x4d33c8[_0xadaa('0x4f')],null))[_0xadaa('0x28')](respondWithResult(_0x3242fa,null))[_0xadaa('0x49')](handleError(_0x3242fa,null));};exports[_0xadaa('0x2b')]=function(_0x2aedaf,_0x526c22){return db[_0xadaa('0x32')][_0xadaa('0x4d')]({'where':{'id':_0x2aedaf[_0xadaa('0x4b')]['id']}})['then'](handleEntityNotFound(_0x526c22,null))[_0xadaa('0x28')](removeEntity(_0x526c22,null))[_0xadaa('0x49')](handleError(_0x526c22,null));}; \ No newline at end of file +var _0x0aa4=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x435b53,_0x279a3a){var _0x5ad91a=function(_0x4865ba){while(--_0x4865ba){_0x435b53['push'](_0x435b53['shift']());}};_0x5ad91a(++_0x279a3a);}(_0x0aa4,0x1bb));var _0x40aa=function(_0x1de111,_0x46e2fa){_0x1de111=_0x1de111-0x0;var _0x7a3ea6=_0x0aa4[_0x1de111];return _0x7a3ea6;};'use strict';var emlformat=require(_0x40aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40aa('0x2'));var Mustache=require('mustache');var util=require(_0x40aa('0x3'));var path=require(_0x40aa('0x4'));var sox=require(_0x40aa('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40aa('0x6'));var squel=require(_0x40aa('0x7'));var crypto=require('crypto');var jsforce=require(_0x40aa('0x8'));var deskjs=require(_0x40aa('0x9'));var toCsv=require(_0x40aa('0xa'));var querystring=require(_0x40aa('0xb'));var Papa=require(_0x40aa('0xc'));var Redis=require('ioredis');var authService=require(_0x40aa('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40aa('0xe'));var logger=require(_0x40aa('0xf'))(_0x40aa('0x10'));var utils=require(_0x40aa('0x11'));var config=require(_0x40aa('0x12'));var licenseUtil=require(_0x40aa('0x13'));var db=require(_0x40aa('0x14'))['db'];function respondWithStatusCode(_0x4e1f92,_0x4bfe45){_0x4bfe45=_0x4bfe45||0xcc;return function(_0x3c409f){if(_0x3c409f){return _0x4e1f92[_0x40aa('0x15')](_0x4bfe45);}return _0x4e1f92[_0x40aa('0x16')](_0x4bfe45)[_0x40aa('0x17')]();};}function respondWithResult(_0x815121,_0x24ecaf){_0x24ecaf=_0x24ecaf||0xc8;return function(_0x148ceb){if(_0x148ceb){return _0x815121[_0x40aa('0x16')](_0x24ecaf)['json'](_0x148ceb);}};}function respondWithFilteredResult(_0x4721db,_0x3d022f){return function(_0xd39b90){if(_0xd39b90){var _0x1ff02f=typeof _0x3d022f[_0x40aa('0x18')]===_0x40aa('0x19')&&typeof _0x3d022f[_0x40aa('0x1a')]==='undefined';var _0x1a3eba=_0xd39b90[_0x40aa('0x1b')];var _0x188383=_0x1ff02f?0x0:_0x3d022f[_0x40aa('0x18')];var _0x1d0066=_0x1ff02f?_0xd39b90[_0x40aa('0x1b')]:_0x3d022f[_0x40aa('0x18')]+_0x3d022f[_0x40aa('0x1a')];var _0x5e5288;if(_0x1d0066>=_0x1a3eba){_0x1d0066=_0x1a3eba;_0x5e5288=0xc8;}else{_0x5e5288=0xce;}_0x4721db['status'](_0x5e5288);return _0x4721db['set']('Content-Range',_0x188383+'-'+_0x1d0066+'/'+_0x1a3eba)[_0x40aa('0x1c')](_0xd39b90);}return null;};}function patchUpdates(_0x1bf2df){return function(_0x2a7541){try{jsonpatch[_0x40aa('0x1d')](_0x2a7541,_0x1bf2df,!![]);}catch(_0x473c94){return BPromise['reject'](_0x473c94);}return _0x2a7541['save']();};}function saveUpdates(_0x13ac36,_0x1776d0){return function(_0x54c80f){if(_0x54c80f){return _0x54c80f[_0x40aa('0x1e')](_0x13ac36)['then'](function(_0x52fa95){return _0x52fa95;});}return null;};}function removeEntity(_0x24b040,_0x2e5e97){return function(_0x389ec3){if(_0x389ec3){return _0x389ec3['destroy']()[_0x40aa('0x1f')](function(){var _0x5f5028=_0x389ec3[_0x40aa('0x20')]({'plain':!![]});var _0x1d8e47=_0x40aa('0x21');return db[_0x40aa('0x22')]['destroy']({'where':{'type':_0x1d8e47,'resourceId':_0x5f5028['id']}})[_0x40aa('0x1f')](function(){return _0x389ec3;});})['then'](function(){_0x24b040[_0x40aa('0x16')](0xcc)[_0x40aa('0x17')]();});}};}function handleEntityNotFound(_0x11a123,_0x422383){return function(_0x32f4a0){if(!_0x32f4a0){_0x11a123['sendStatus'](0x194);}return _0x32f4a0;};}function handleError(_0x517045,_0x58dcc1){_0x58dcc1=_0x58dcc1||0x1f4;return function(_0x2bb4bc){logger[_0x40aa('0x23')](_0x2bb4bc[_0x40aa('0x24')]);if(_0x2bb4bc['name']){delete _0x2bb4bc[_0x40aa('0x25')];}_0x517045[_0x40aa('0x16')](_0x58dcc1)[_0x40aa('0x26')](_0x2bb4bc);};}exports[_0x40aa('0x27')]=function(_0x53b0b3,_0xfbfe){var _0x146260={},_0x21a315={},_0x384174={'count':0x0,'rows':[]};var _0x1ba929=_[_0x40aa('0x28')](db[_0x40aa('0x29')][_0x40aa('0x2a')],function(_0x516fa2){return{'name':_0x516fa2[_0x40aa('0x2b')],'type':_0x516fa2[_0x40aa('0x2c')][_0x40aa('0x2d')]};});_0x21a315['model']=_[_0x40aa('0x28')](_0x1ba929,'name');_0x21a315[_0x40aa('0x2e')]=_['keys'](_0x53b0b3[_0x40aa('0x2e')]);_0x21a315[_0x40aa('0x2f')]=_[_0x40aa('0x30')](_0x21a315[_0x40aa('0x31')],_0x21a315[_0x40aa('0x2e')]);_0x146260['attributes']=_[_0x40aa('0x30')](_0x21a315[_0x40aa('0x31')],qs[_0x40aa('0x32')](_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x32')]));_0x146260[_0x40aa('0x33')]=_0x146260[_0x40aa('0x33')]['length']?_0x146260[_0x40aa('0x33')]:_0x21a315[_0x40aa('0x31')];if(!_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x34')](_0x40aa('0x35'))){_0x146260[_0x40aa('0x1a')]=qs[_0x40aa('0x1a')](_0x53b0b3[_0x40aa('0x2e')]['limit']);_0x146260[_0x40aa('0x18')]=qs[_0x40aa('0x18')](_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x18')]);}_0x146260[_0x40aa('0x36')]=qs['sort'](_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x37')]);_0x146260['where']=qs['filters'](_[_0x40aa('0x38')](_0x53b0b3[_0x40aa('0x2e')],_0x21a315[_0x40aa('0x2f')]),_0x1ba929);if(_0x53b0b3[_0x40aa('0x2e')]['filter']){_0x146260['where']=_[_0x40aa('0x39')](_0x146260['where'],{'$or':_[_0x40aa('0x28')](_0x1ba929,function(_0xfe5010){if(_0xfe5010['type']!==_0x40aa('0x3a')){var _0x11c2ba={};_0x11c2ba[_0xfe5010[_0x40aa('0x25')]]={'$like':'%'+_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x3b')]+'%'};return _0x11c2ba;}})});}_0x146260=_[_0x40aa('0x39')]({},_0x146260,_0x53b0b3[_0x40aa('0x3c')]);var _0xf10d3c={'where':_0x146260['where']};return db[_0x40aa('0x29')][_0x40aa('0x1b')](_0xf10d3c)[_0x40aa('0x1f')](function(_0x6c3b7e){_0x384174[_0x40aa('0x1b')]=_0x6c3b7e;if(_0x53b0b3[_0x40aa('0x2e')][_0x40aa('0x3d')]){_0x146260[_0x40aa('0x3e')]=[{'all':!![]}];}return db['Template']['findAll'](_0x146260);})['then'](function(_0x2e7711){_0x384174[_0x40aa('0x3f')]=_0x2e7711;return _0x384174;})[_0x40aa('0x1f')](respondWithFilteredResult(_0xfbfe,_0x146260))[_0x40aa('0x40')](handleError(_0xfbfe,null));};exports['show']=function(_0x5c14f4,_0x31dc7e){var _0x2126e1={'raw':!![],'where':{'id':_0x5c14f4[_0x40aa('0x41')]['id']}},_0x2a7c91={};_0x2a7c91[_0x40aa('0x31')]=_[_0x40aa('0x42')](db[_0x40aa('0x29')][_0x40aa('0x2a')]);_0x2a7c91[_0x40aa('0x2e')]=_[_0x40aa('0x42')](_0x5c14f4[_0x40aa('0x2e')]);_0x2a7c91[_0x40aa('0x2f')]=_[_0x40aa('0x30')](_0x2a7c91['model'],_0x2a7c91['query']);_0x2126e1['attributes']=_[_0x40aa('0x30')](_0x2a7c91[_0x40aa('0x31')],qs['fields'](_0x5c14f4[_0x40aa('0x2e')][_0x40aa('0x32')]));_0x2126e1['attributes']=_0x2126e1[_0x40aa('0x33')][_0x40aa('0x43')]?_0x2126e1[_0x40aa('0x33')]:_0x2a7c91[_0x40aa('0x31')];if(_0x5c14f4['query'][_0x40aa('0x3d')]){_0x2126e1[_0x40aa('0x3e')]=[{'all':!![]}];}_0x2126e1=_[_0x40aa('0x39')]({},_0x2126e1,_0x5c14f4['options']);return db[_0x40aa('0x29')][_0x40aa('0x44')](_0x2126e1)[_0x40aa('0x1f')](handleEntityNotFound(_0x31dc7e,null))['then'](respondWithResult(_0x31dc7e,null))[_0x40aa('0x40')](handleError(_0x31dc7e,null));};exports[_0x40aa('0x45')]=function(_0xfbdb0f,_0x466293){return db['Template']['create'](_0xfbdb0f[_0x40aa('0x46')],{})[_0x40aa('0x1f')](function(_0x249ccc){var _0x293d7b=_0xfbdb0f['user']['get']({'plain':!![]});if(!_0x293d7b)throw new Error(_0x40aa('0x47'));if(_0x293d7b['role']===_0x40aa('0x48')){var _0x39d97c=_0x249ccc[_0x40aa('0x20')]({'plain':!![]});var _0x19f3c6='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x19f3c6,'userProfileId':_0x293d7b[_0x40aa('0x49')]},'raw':!![]})[_0x40aa('0x1f')](function(_0x1e5028){if(_0x1e5028&&_0x1e5028[_0x40aa('0x4a')]===0x0){return db['UserProfileResource'][_0x40aa('0x45')]({'name':_0x39d97c['name'],'resourceId':_0x39d97c['id'],'type':_0x1e5028[_0x40aa('0x25')],'sectionId':_0x1e5028['id']},{})['then'](function(){return _0x249ccc;});}else{return _0x249ccc;}})[_0x40aa('0x40')](function(_0x2f795c){logger['error'](_0x40aa('0x4b'),_0x2f795c);throw _0x2f795c;});}return _0x249ccc;})[_0x40aa('0x1f')](respondWithResult(_0x466293,0xc9))[_0x40aa('0x40')](handleError(_0x466293,null));};exports[_0x40aa('0x1e')]=function(_0x505b14,_0x21fc5a){if(_0x505b14['body']['id']){delete _0x505b14[_0x40aa('0x46')]['id'];}return db[_0x40aa('0x29')][_0x40aa('0x44')]({'where':{'id':_0x505b14[_0x40aa('0x41')]['id']}})[_0x40aa('0x1f')](handleEntityNotFound(_0x21fc5a,null))[_0x40aa('0x1f')](saveUpdates(_0x505b14['body'],null))['then'](respondWithResult(_0x21fc5a,null))[_0x40aa('0x40')](handleError(_0x21fc5a,null));};exports['destroy']=function(_0x202c3c,_0x6e96ee){return db[_0x40aa('0x29')]['find']({'where':{'id':_0x202c3c[_0x40aa('0x41')]['id']}})[_0x40aa('0x1f')](handleEntityNotFound(_0x6e96ee,null))[_0x40aa('0x1f')](removeEntity(_0x6e96ee,null))[_0x40aa('0x40')](handleError(_0x6e96ee,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 274e24b..99e820a 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 _0x8219=['rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a7435,_0x4fe43d){var _0x1f861e=function(_0x89cadc){while(--_0x89cadc){_0x3a7435['push'](_0x3a7435['shift']());}};_0x1f861e(++_0x4fe43d);}(_0x8219,0x1b6));var _0x9821=function(_0x3c38c7,_0x14dd97){_0x3c38c7=_0x3c38c7-0x0;var _0x4aa4b1=_0x8219[_0x3c38c7];return _0x4aa4b1;};'use strict';var _=require(_0x9821('0x0'));var util=require('util');var logger=require(_0x9821('0x1'))(_0x9821('0x2'));var moment=require(_0x9821('0x3'));var BPromise=require(_0x9821('0x4'));var rp=require(_0x9821('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9821('0x6'));var config=require(_0x9821('0x7'));var attributes=require('./template.attributes');module[_0x9821('0x8')]=function(_0xc2edfe,_0x100ffc){return _0xc2edfe[_0x9821('0x9')](_0x9821('0xa'),attributes,{'tableName':_0x9821('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc4=['tools_templates','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Template'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x1cc4,0xb1));var _0x41cc=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x1cc4[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0x41cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41cc('0x1'));var moment=require(_0x41cc('0x2'));var BPromise=require(_0x41cc('0x3'));var rp=require(_0x41cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41cc('0x5'));var config=require(_0x41cc('0x6'));var attributes=require('./template.attributes');module[_0x41cc('0x7')]=function(_0x4c4c99,_0x1276b5){return _0x4c4c99[_0x41cc('0x8')](_0x41cc('0x9'),attributes,{'tableName':_0x41cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 3e23366..d4baf25 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 _0xcade=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTemplate','findAll','options','raw','attributes','limit','include','model','map','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x32e281,_0x3b0bfe){var _0x1d71ae=function(_0x3f6bf7){while(--_0x3f6bf7){_0x32e281['push'](_0x32e281['shift']());}};_0x1d71ae(++_0x3b0bfe);}(_0xcade,0xab));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xecad('0x0'));var moment=require('moment');var BPromise=require(_0xecad('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecad('0x2'))['db'];var utils=require(_0xecad('0x3'));var logger=require('../../config/logger')(_0xecad('0x4'));var config=require(_0xecad('0x5'));var jayson=require(_0xecad('0x6'));var client=jayson[_0xecad('0x7')][_0xecad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ea175,_0x2a9c6d,_0x11c219){return new BPromise(function(_0x30a5c7,_0x24570e){return client[_0xecad('0x9')](_0x4ea175,_0x11c219)[_0xecad('0xa')](function(_0x1018c1){logger[_0xecad('0xb')](_0xecad('0xc'),_0x2a9c6d,_0xecad('0xd'));logger[_0xecad('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x2a9c6d,_0xecad('0xd'),JSON[_0xecad('0xf')](_0x1018c1));if(_0x1018c1[_0xecad('0x10')]){if(_0x1018c1['error'][_0xecad('0x11')]===0x1f4){logger[_0xecad('0x10')]('Template,\x20%s,\x20%s',_0x2a9c6d,_0x1018c1[_0xecad('0x10')][_0xecad('0x12')]);return _0x24570e(_0x1018c1[_0xecad('0x10')][_0xecad('0x12')]);}logger[_0xecad('0x10')](_0xecad('0xc'),_0x2a9c6d,_0x1018c1['error'][_0xecad('0x12')]);return _0x30a5c7(_0x1018c1[_0xecad('0x10')]['message']);}else{logger[_0xecad('0xb')]('Template,\x20%s,\x20%s',_0x2a9c6d,'request\x20sent');_0x30a5c7(_0x1018c1[_0xecad('0x13')][_0xecad('0x12')]);}})['catch'](function(_0x4d3b73){logger[_0xecad('0x10')](_0xecad('0xc'),_0x2a9c6d,_0x4d3b73);_0x24570e(_0x4d3b73);});});}exports[_0xecad('0x14')]=function(_0x5cab86){var _0x3ae5b3=this;return new Promise(function(_0x2794e0,_0x2443fb){return db['Template'][_0xecad('0x15')]({'raw':_0x5cab86[_0xecad('0x16')]?_0x5cab86[_0xecad('0x16')][_0xecad('0x17')]===undefined?!![]:![]:!![],'where':_0x5cab86[_0xecad('0x16')]?_0x5cab86[_0xecad('0x16')]['where']||null:null,'attributes':_0x5cab86[_0xecad('0x16')]?_0x5cab86[_0xecad('0x16')][_0xecad('0x18')]||null:null,'limit':_0x5cab86['options']?_0x5cab86[_0xecad('0x16')][_0xecad('0x19')]||null:null,'include':_0x5cab86[_0xecad('0x16')]?_0x5cab86[_0xecad('0x16')][_0xecad('0x1a')]?_['map'](_0x5cab86[_0xecad('0x16')][_0xecad('0x1a')],function(_0x26c4c5){return{'model':db[_0x26c4c5[_0xecad('0x1b')]],'as':_0x26c4c5['as'],'attributes':_0x26c4c5[_0xecad('0x18')],'include':_0x26c4c5[_0xecad('0x1a')]?_[_0xecad('0x1c')](_0x26c4c5[_0xecad('0x1a')],function(_0x45d306){return{'model':db[_0x45d306['model']],'as':_0x45d306['as'],'attributes':_0x45d306[_0xecad('0x18')],'include':_0x45d306['include']?_[_0xecad('0x1c')](_0x45d306[_0xecad('0x1a')],function(_0x5e1e93){return{'model':db[_0x5e1e93[_0xecad('0x1b')]],'as':_0x5e1e93['as'],'attributes':_0x5e1e93['attributes']};}):[]};}):[]};}):[]:[]})[_0xecad('0xa')](function(_0x92f9db){logger[_0xecad('0xb')](_0xecad('0x14'),_0x5cab86);logger[_0xecad('0xe')](_0xecad('0x14'),_0x5cab86,JSON[_0xecad('0xf')](_0x92f9db));_0x2794e0(_0x92f9db);})[_0xecad('0x1d')](function(_0x58fab8){logger[_0xecad('0x10')]('GetTemplate',_0x58fab8['message'],_0x5cab86);_0x2443fb(_0x3ae5b3['error'](0x1f4,_0x58fab8[_0xecad('0x12')]));});});}; \ No newline at end of file +var _0xd398=['request\x20sent','error','message','catch','Template','options','raw','where','limit','map','include','attributes','model','GetTemplate','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x49c3c2,_0x2379d3){var _0x22eeb7=function(_0x30504a){while(--_0x30504a){_0x49c3c2['push'](_0x49c3c2['shift']());}};_0x22eeb7(++_0x2379d3);}(_0xd398,0x1dd));var _0x8d39=function(_0xef5946,_0x31e3f5){_0xef5946=_0xef5946-0x0;var _0x4b4ed4=_0xd398[_0xef5946];return _0x4b4ed4;};'use strict';var _=require(_0x8d39('0x0'));var util=require(_0x8d39('0x1'));var moment=require(_0x8d39('0x2'));var BPromise=require(_0x8d39('0x3'));var rs=require(_0x8d39('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d39('0x5'))['db'];var utils=require(_0x8d39('0x6'));var logger=require(_0x8d39('0x7'))(_0x8d39('0x8'));var config=require(_0x8d39('0x9'));var jayson=require(_0x8d39('0xa'));var client=jayson[_0x8d39('0xb')][_0x8d39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38dd94,_0x1d8081,_0x41fe53){return new BPromise(function(_0x3405f3,_0x4711c7){return client['request'](_0x38dd94,_0x41fe53)[_0x8d39('0xd')](function(_0x3392e3){logger[_0x8d39('0xe')](_0x8d39('0xf'),_0x1d8081,'request\x20sent');logger[_0x8d39('0x10')](_0x8d39('0x11'),_0x1d8081,_0x8d39('0x12'),JSON['stringify'](_0x3392e3));if(_0x3392e3[_0x8d39('0x13')]){if(_0x3392e3[_0x8d39('0x13')]['code']===0x1f4){logger['error'](_0x8d39('0xf'),_0x1d8081,_0x3392e3[_0x8d39('0x13')][_0x8d39('0x14')]);return _0x4711c7(_0x3392e3[_0x8d39('0x13')]['message']);}logger['error'](_0x8d39('0xf'),_0x1d8081,_0x3392e3[_0x8d39('0x13')][_0x8d39('0x14')]);return _0x3405f3(_0x3392e3[_0x8d39('0x13')]['message']);}else{logger[_0x8d39('0xe')](_0x8d39('0xf'),_0x1d8081,'request\x20sent');_0x3405f3(_0x3392e3['result'][_0x8d39('0x14')]);}})[_0x8d39('0x15')](function(_0x182980){logger[_0x8d39('0x13')](_0x8d39('0xf'),_0x1d8081,_0x182980);_0x4711c7(_0x182980);});});}exports['GetTemplate']=function(_0x1eabfa){var _0x295ae5=this;return new Promise(function(_0x1e5f95,_0x531e41){return db[_0x8d39('0x16')]['findAll']({'raw':_0x1eabfa[_0x8d39('0x17')]?_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x18')]===undefined?!![]:![]:!![],'where':_0x1eabfa['options']?_0x1eabfa['options'][_0x8d39('0x19')]||null:null,'attributes':_0x1eabfa[_0x8d39('0x17')]?_0x1eabfa[_0x8d39('0x17')]['attributes']||null:null,'limit':_0x1eabfa['options']?_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x1a')]||null:null,'include':_0x1eabfa['options']?_0x1eabfa['options']['include']?_[_0x8d39('0x1b')](_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x1c')],function(_0x170f1e){return{'model':db[_0x170f1e['model']],'as':_0x170f1e['as'],'attributes':_0x170f1e[_0x8d39('0x1d')],'include':_0x170f1e['include']?_['map'](_0x170f1e[_0x8d39('0x1c')],function(_0x7f887e){return{'model':db[_0x7f887e[_0x8d39('0x1e')]],'as':_0x7f887e['as'],'attributes':_0x7f887e[_0x8d39('0x1d')],'include':_0x7f887e['include']?_[_0x8d39('0x1b')](_0x7f887e[_0x8d39('0x1c')],function(_0x1c637d){return{'model':db[_0x1c637d[_0x8d39('0x1e')]],'as':_0x1c637d['as'],'attributes':_0x1c637d[_0x8d39('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d39('0xd')](function(_0x581555){logger['info'](_0x8d39('0x1f'),_0x1eabfa);logger[_0x8d39('0x10')](_0x8d39('0x1f'),_0x1eabfa,JSON[_0x8d39('0x20')](_0x581555));_0x1e5f95(_0x581555);})[_0x8d39('0x15')](function(_0x7f61a3){logger[_0x8d39('0x13')](_0x8d39('0x1f'),_0x7f61a3[_0x8d39('0x14')],_0x1eabfa);_0x531e41(_0x295ae5[_0x8d39('0x13')](0x1f4,_0x7f61a3['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index aa71060..6ce4c90 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 _0x58b6=['get','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./trigger.controller','index','/:id','isAuthenticated','show'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x58b6,0x138));var _0x658b=function(_0x6f12cd,_0x1bb44d){_0x6f12cd=_0x6f12cd-0x0;var _0x4c608f=_0x58b6[_0x6f12cd];return _0x4c608f;};'use strict';var multer=require(_0x658b('0x0'));var util=require(_0x658b('0x1'));var path=require(_0x658b('0x2'));var timeout=require(_0x658b('0x3'));var express=require(_0x658b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x658b('0x5'));var config=require(_0x658b('0x6'));var controller=require(_0x658b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x658b('0x8')]);router['get'](_0x658b('0x9'),auth[_0x658b('0xa')](),controller[_0x658b('0xb')]);router[_0x658b('0xc')](_0x658b('0xd'),auth['isAuthenticated'](),controller[_0x658b('0xe')]);router['get'](_0x658b('0xf'),auth[_0x658b('0xa')](),controller[_0x658b('0x10')]);router[_0x658b('0xc')](_0x658b('0x11'),auth['isAuthenticated'](),controller[_0x658b('0x12')]);router[_0x658b('0x13')]('/',auth[_0x658b('0xa')](),controller[_0x658b('0x14')]);router[_0x658b('0x13')]('/:id/all_conditions',auth[_0x658b('0xa')](),controller['addAllCondition']);router[_0x658b('0x13')](_0x658b('0xf'),auth['isAuthenticated'](),controller[_0x658b('0x15')]);router[_0x658b('0x13')](_0x658b('0x11'),auth[_0x658b('0xa')](),controller[_0x658b('0x16')]);router[_0x658b('0x17')](_0x658b('0x9'),auth[_0x658b('0xa')](),controller[_0x658b('0x18')]);router['delete'](_0x658b('0x9'),auth[_0x658b('0xa')](),controller[_0x658b('0x19')]);module[_0x658b('0x1a')]=router; \ No newline at end of file +var _0x3d3b=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x3d3b,0x1af));var _0xb3d3=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x3d3b[_0x21bfab];return _0x4db318;};'use strict';var multer=require(_0xb3d3('0x0'));var util=require('util');var path=require(_0xb3d3('0x1'));var timeout=require(_0xb3d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb3d3('0x3'));var auth=require(_0xb3d3('0x4'));var interaction=require(_0xb3d3('0x5'));var config=require(_0xb3d3('0x6'));var controller=require(_0xb3d3('0x7'));router['get']('/',auth[_0xb3d3('0x8')](),controller[_0xb3d3('0x9')]);router[_0xb3d3('0xa')](_0xb3d3('0xb'),auth[_0xb3d3('0x8')](),controller['show']);router['get'](_0xb3d3('0xc'),auth[_0xb3d3('0x8')](),controller[_0xb3d3('0xd')]);router[_0xb3d3('0xa')](_0xb3d3('0xe'),auth['isAuthenticated'](),controller[_0xb3d3('0xf')]);router[_0xb3d3('0xa')](_0xb3d3('0x10'),auth['isAuthenticated'](),controller[_0xb3d3('0x11')]);router[_0xb3d3('0x12')]('/',auth[_0xb3d3('0x8')](),controller[_0xb3d3('0x13')]);router[_0xb3d3('0x12')](_0xb3d3('0xc'),auth[_0xb3d3('0x8')](),controller[_0xb3d3('0x14')]);router[_0xb3d3('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xb3d3('0x15')]);router[_0xb3d3('0x12')]('/:id/actions',auth[_0xb3d3('0x8')](),controller[_0xb3d3('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb3d3('0x17')]);router[_0xb3d3('0x18')](_0xb3d3('0xb'),auth[_0xb3d3('0x8')](),controller[_0xb3d3('0x19')]);module[_0xb3d3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5b1fb37..a3a63b6 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 _0x4726=['sequelize','exports','STRING'];(function(_0x2eb8a8,_0x4669ff){var _0x7aada0=function(_0x20783e){while(--_0x20783e){_0x2eb8a8['push'](_0x2eb8a8['shift']());}};_0x7aada0(++_0x4669ff);}(_0x4726,0xf3));var _0x6472=function(_0x62e15e,_0x4eccc4){_0x62e15e=_0x62e15e-0x0;var _0x56a9ef=_0x4726[_0x62e15e];return _0x56a9ef;};'use strict';var Sequelize=require(_0x6472('0x0'));module[_0x6472('0x1')]={'name':{'type':Sequelize[_0x6472('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6472('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe1b7=['STRING','sequelize'];(function(_0xc77c8d,_0x332c35){var _0xea7841=function(_0xba3323){while(--_0xba3323){_0xc77c8d['push'](_0xc77c8d['shift']());}};_0xea7841(++_0x332c35);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0x350281,_0x7ad014){_0x350281=_0x350281-0x0;var _0x450069=_0xe1b7[_0x350281];return _0x450069;};'use strict';var Sequelize=require(_0x7e1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e1b('0x1')]},'channel':{'type':Sequelize[_0x7e1b('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 72d7064..86da540 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 _0x3002=['keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','addAllCondition','TriggerAllId','TriggerAnyId','Condition','findOne','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x2c6e22,_0x583370){var _0x46ae6c=function(_0x3ba989){while(--_0x3ba989){_0x2c6e22['push'](_0x2c6e22['shift']());}};_0x46ae6c(++_0x583370);}(_0x3002,0x134));var _0x2300=function(_0x292a43,_0x475dac){_0x292a43=_0x292a43-0x0;var _0x37f303=_0x3002[_0x292a43];return _0x37f303;};'use strict';var emlformat=require(_0x2300('0x0'));var rimraf=require(_0x2300('0x1'));var zipdir=require(_0x2300('0x2'));var jsonpatch=require(_0x2300('0x3'));var rp=require(_0x2300('0x4'));var moment=require('moment');var BPromise=require(_0x2300('0x5'));var Mustache=require('mustache');var util=require(_0x2300('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2300('0x7'));var ejs=require(_0x2300('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2300('0x9'));var squel=require(_0x2300('0xa'));var crypto=require(_0x2300('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2300('0xc'));var toCsv=require(_0x2300('0x7'));var querystring=require(_0x2300('0xd'));var Papa=require(_0x2300('0xe'));var Redis=require(_0x2300('0xf'));var authService=require(_0x2300('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2300('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2300('0x12'))(_0x2300('0x13'));var utils=require(_0x2300('0x14'));var config=require(_0x2300('0x15'));var licenseUtil=require(_0x2300('0x16'));var db=require(_0x2300('0x17'))['db'];function respondWithStatusCode(_0x3bf3be,_0x14d4f4){_0x14d4f4=_0x14d4f4||0xcc;return function(_0x47acac){if(_0x47acac){return _0x3bf3be['sendStatus'](_0x14d4f4);}return _0x3bf3be[_0x2300('0x18')](_0x14d4f4)[_0x2300('0x19')]();};}function respondWithResult(_0x18dff6,_0x2df680){_0x2df680=_0x2df680||0xc8;return function(_0xe789c5){if(_0xe789c5){return _0x18dff6['status'](_0x2df680)['json'](_0xe789c5);}};}function respondWithFilteredResult(_0x33e272,_0x142bda){return function(_0x3b109f){if(_0x3b109f){var _0x21d615=typeof _0x142bda[_0x2300('0x1a')]==='undefined'&&typeof _0x142bda[_0x2300('0x1b')]===_0x2300('0x1c');var _0x126856=_0x3b109f[_0x2300('0x1d')];var _0xbe8e7=_0x21d615?0x0:_0x142bda[_0x2300('0x1a')];var _0x45dcac=_0x21d615?_0x3b109f[_0x2300('0x1d')]:_0x142bda['offset']+_0x142bda[_0x2300('0x1b')];var _0x1ff49f;if(_0x45dcac>=_0x126856){_0x45dcac=_0x126856;_0x1ff49f=0xc8;}else{_0x1ff49f=0xce;}_0x33e272[_0x2300('0x18')](_0x1ff49f);return _0x33e272[_0x2300('0x1e')](_0x2300('0x1f'),_0xbe8e7+'-'+_0x45dcac+'/'+_0x126856)[_0x2300('0x20')](_0x3b109f);}return null;};}function patchUpdates(_0x173684){return function(_0x49bdb0){try{jsonpatch[_0x2300('0x21')](_0x49bdb0,_0x173684,!![]);}catch(_0x3b29b7){return BPromise[_0x2300('0x22')](_0x3b29b7);}return _0x49bdb0['save']();};}function saveUpdates(_0x15a89f,_0xb78e37){return function(_0x170296){if(_0x170296){return _0x170296[_0x2300('0x23')](_0x15a89f)[_0x2300('0x24')](function(_0x1a7d8a){return _0x1a7d8a;});}return null;};}function removeEntity(_0x4cc64f,_0x492751){return function(_0x4da802){if(_0x4da802){return _0x4da802[_0x2300('0x25')]()[_0x2300('0x24')](function(){var _0x4db0a8=_0x4da802['get']({'plain':!![]});var _0x5c4670=_0x2300('0x26');return db[_0x2300('0x27')][_0x2300('0x25')]({'where':{'type':_0x5c4670,'resourceId':_0x4db0a8['id']}})[_0x2300('0x24')](function(){return _0x4da802;});})['then'](function(){_0x4cc64f[_0x2300('0x18')](0xcc)[_0x2300('0x19')]();});}};}function handleEntityNotFound(_0x44a529,_0x46cb25){return function(_0x4451cf){if(!_0x4451cf){_0x44a529[_0x2300('0x28')](0x194);}return _0x4451cf;};}function handleError(_0x169eed,_0x2f2ce5){_0x2f2ce5=_0x2f2ce5||0x1f4;return function(_0x553a05){logger[_0x2300('0x29')](_0x553a05[_0x2300('0x2a')]);if(_0x553a05[_0x2300('0x2b')]){delete _0x553a05['name'];}_0x169eed[_0x2300('0x18')](_0x2f2ce5)[_0x2300('0x2c')](_0x553a05);};}exports[_0x2300('0x2d')]=function(_0x26a4d1,_0xf2413a){var _0x51bf24={},_0x5872aa={},_0x22be91={'count':0x0,'rows':[]};var _0x4ccc4f=_[_0x2300('0x2e')](db[_0x2300('0x2f')][_0x2300('0x30')],function(_0xe338cb){return{'name':_0xe338cb['fieldName'],'type':_0xe338cb[_0x2300('0x31')]['key']};});_0x5872aa['model']=_[_0x2300('0x2e')](_0x4ccc4f,_0x2300('0x2b'));_0x5872aa[_0x2300('0x32')]=_['keys'](_0x26a4d1['query']);_0x5872aa[_0x2300('0x33')]=_[_0x2300('0x34')](_0x5872aa[_0x2300('0x35')],_0x5872aa[_0x2300('0x32')]);_0x51bf24[_0x2300('0x36')]=_[_0x2300('0x34')](_0x5872aa['model'],qs[_0x2300('0x37')](_0x26a4d1[_0x2300('0x32')][_0x2300('0x37')]));_0x51bf24[_0x2300('0x36')]=_0x51bf24[_0x2300('0x36')]['length']?_0x51bf24['attributes']:_0x5872aa['model'];if(!_0x26a4d1[_0x2300('0x32')][_0x2300('0x38')]('nolimit')){_0x51bf24[_0x2300('0x1b')]=qs[_0x2300('0x1b')](_0x26a4d1[_0x2300('0x32')]['limit']);_0x51bf24[_0x2300('0x1a')]=qs[_0x2300('0x1a')](_0x26a4d1[_0x2300('0x32')]['offset']);}_0x51bf24[_0x2300('0x39')]=qs[_0x2300('0x3a')](_0x26a4d1[_0x2300('0x32')][_0x2300('0x3a')]);_0x51bf24[_0x2300('0x3b')]=qs[_0x2300('0x33')](_[_0x2300('0x3c')](_0x26a4d1[_0x2300('0x32')],_0x5872aa[_0x2300('0x33')]),_0x4ccc4f);if(_0x26a4d1['query'][_0x2300('0x3d')]){_0x51bf24['where']=_[_0x2300('0x3e')](_0x51bf24[_0x2300('0x3b')],{'$or':_[_0x2300('0x2e')](_0x4ccc4f,function(_0x366774){if(_0x366774[_0x2300('0x31')]!==_0x2300('0x3f')){var _0x2e166b={};_0x2e166b[_0x366774[_0x2300('0x2b')]]={'$like':'%'+_0x26a4d1[_0x2300('0x32')][_0x2300('0x3d')]+'%'};return _0x2e166b;}})});}_0x51bf24=_[_0x2300('0x3e')]({},_0x51bf24,_0x26a4d1[_0x2300('0x40')]);var _0xa5e0f5={'where':_0x51bf24['where']};return db[_0x2300('0x2f')][_0x2300('0x1d')](_0xa5e0f5)[_0x2300('0x24')](function(_0xafc40d){_0x22be91[_0x2300('0x1d')]=_0xafc40d;if(_0x26a4d1[_0x2300('0x32')][_0x2300('0x41')]){_0x51bf24[_0x2300('0x42')]=[{'all':!![]}];}return db[_0x2300('0x2f')][_0x2300('0x43')](_0x51bf24);})[_0x2300('0x24')](function(_0x3b1fb3){_0x22be91[_0x2300('0x44')]=_0x3b1fb3;return _0x22be91;})['then'](respondWithFilteredResult(_0xf2413a,_0x51bf24))[_0x2300('0x45')](handleError(_0xf2413a,null));};exports[_0x2300('0x46')]=function(_0x128ab5,_0x51aa71){var _0x45f604={'raw':![],'where':{'id':_0x128ab5[_0x2300('0x47')]['id']}},_0x3d897d={};_0x3d897d[_0x2300('0x35')]=_['keys'](db[_0x2300('0x2f')][_0x2300('0x30')]);_0x3d897d[_0x2300('0x32')]=_[_0x2300('0x48')](_0x128ab5[_0x2300('0x32')]);_0x3d897d[_0x2300('0x33')]=_[_0x2300('0x34')](_0x3d897d[_0x2300('0x35')],_0x3d897d['query']);_0x45f604[_0x2300('0x36')]=_['intersection'](_0x3d897d[_0x2300('0x35')],qs['fields'](_0x128ab5[_0x2300('0x32')][_0x2300('0x37')]));_0x45f604[_0x2300('0x36')]=_0x45f604[_0x2300('0x36')][_0x2300('0x49')]?_0x45f604[_0x2300('0x36')]:_0x3d897d[_0x2300('0x35')];if(_0x128ab5[_0x2300('0x32')][_0x2300('0x41')]){_0x45f604[_0x2300('0x42')]=[{'all':!![]}];}_0x45f604=_[_0x2300('0x3e')]({},_0x45f604,_0x128ab5[_0x2300('0x40')]);return db[_0x2300('0x2f')][_0x2300('0x4a')](_0x45f604)['then'](handleEntityNotFound(_0x51aa71,null))['then'](respondWithResult(_0x51aa71,null))[_0x2300('0x45')](handleError(_0x51aa71,null));};exports['create']=function(_0x4e2817,_0x4c9500){return db[_0x2300('0x2f')][_0x2300('0x4b')](_0x4e2817[_0x2300('0x4c')],{})['then'](function(_0x22bdb1){var _0x5ba767=_0x4e2817[_0x2300('0x4d')][_0x2300('0x4e')]({'plain':!![]});if(!_0x5ba767)throw new Error(_0x2300('0x4f'));if(_0x5ba767[_0x2300('0x50')]===_0x2300('0x4d')){var _0x458722=_0x22bdb1[_0x2300('0x4e')]({'plain':!![]});var _0x25cc3d=_0x2300('0x26');return db[_0x2300('0x51')][_0x2300('0x4a')]({'where':{'name':_0x25cc3d,'userProfileId':_0x5ba767['userProfileId']},'raw':!![]})[_0x2300('0x24')](function(_0xd7a980){if(_0xd7a980&&_0xd7a980[_0x2300('0x52')]===0x0){return db[_0x2300('0x27')][_0x2300('0x4b')]({'name':_0x458722['name'],'resourceId':_0x458722['id'],'type':_0xd7a980[_0x2300('0x2b')],'sectionId':_0xd7a980['id']},{})[_0x2300('0x24')](function(){return _0x22bdb1;});}else{return _0x22bdb1;}})[_0x2300('0x45')](function(_0x4cf306){logger[_0x2300('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf306);throw _0x4cf306;});}return _0x22bdb1;})[_0x2300('0x24')](respondWithResult(_0x4c9500,0xc9))[_0x2300('0x45')](handleError(_0x4c9500,null));};exports[_0x2300('0x23')]=function(_0x5edf0c,_0x13b049){if(_0x5edf0c['body']['id']){delete _0x5edf0c[_0x2300('0x4c')]['id'];}return db['Trigger'][_0x2300('0x4a')]({'where':{'id':_0x5edf0c['params']['id']}})[_0x2300('0x24')](handleEntityNotFound(_0x13b049,null))[_0x2300('0x24')](saveUpdates(_0x5edf0c[_0x2300('0x4c')],null))[_0x2300('0x24')](respondWithResult(_0x13b049,null))[_0x2300('0x45')](handleError(_0x13b049,null));};exports[_0x2300('0x25')]=function(_0x406edf,_0xe99a6){return db[_0x2300('0x2f')][_0x2300('0x4a')]({'where':{'id':_0x406edf[_0x2300('0x47')]['id']}})[_0x2300('0x24')](handleEntityNotFound(_0xe99a6,null))[_0x2300('0x24')](removeEntity(_0xe99a6,null))[_0x2300('0x45')](handleError(_0xe99a6,null));};exports[_0x2300('0x53')]=function(_0x1d3ec5,_0xd63bc8,_0xc291b3){if(_0x1d3ec5[_0x2300('0x4c')]['id']){delete _0x1d3ec5[_0x2300('0x4c')]['id'];}return db[_0x2300('0x2f')]['find']({'where':{'id':_0x1d3ec5[_0x2300('0x47')]['id']}})[_0x2300('0x24')](handleEntityNotFound(_0xd63bc8,null))['then'](function(_0x223179){if(_0x223179){_0x1d3ec5[_0x2300('0x4c')][_0x2300('0x54')]=_0x223179['id'];return db['Condition'][_0x2300('0x4b')](_0x1d3ec5['body']);}})['then'](respondWithResult(_0xd63bc8,null))[_0x2300('0x45')](handleError(_0xd63bc8,null));};exports['addAnyCondition']=function(_0x487fe9,_0x42cba7,_0x3449fd){if(_0x487fe9['body']['id']){delete _0x487fe9[_0x2300('0x4c')]['id'];}return db[_0x2300('0x2f')][_0x2300('0x4a')]({'where':{'id':_0x487fe9[_0x2300('0x47')]['id']}})[_0x2300('0x24')](handleEntityNotFound(_0x42cba7,null))[_0x2300('0x24')](function(_0x189fc7){if(_0x189fc7){_0x487fe9[_0x2300('0x4c')][_0x2300('0x55')]=_0x189fc7['id'];return db[_0x2300('0x56')][_0x2300('0x4b')](_0x487fe9['body']);}})[_0x2300('0x24')](respondWithResult(_0x42cba7,null))[_0x2300('0x45')](handleError(_0x42cba7,null));};exports['getAllConditions']=function(_0x44d9fd,_0x4b0ca1,_0x1f6ebd){var _0xe4b5b1={};var _0x194e32={};var _0x1d9004;var _0x2a0d1f;return db[_0x2300('0x2f')][_0x2300('0x57')]({'where':{'id':_0x44d9fd[_0x2300('0x47')]['id']}})[_0x2300('0x24')](handleEntityNotFound(_0x4b0ca1,null))[_0x2300('0x24')](function(_0x170e38){if(_0x170e38){_0x1d9004=_0x170e38;_0x194e32['model']=_[_0x2300('0x48')](db[_0x2300('0x56')][_0x2300('0x30')]);_0x194e32['query']=_[_0x2300('0x48')](_0x44d9fd[_0x2300('0x32')]);_0x194e32[_0x2300('0x33')]=_['intersection'](_0x194e32[_0x2300('0x35')],_0x194e32[_0x2300('0x32')]);_0xe4b5b1[_0x2300('0x36')]=_[_0x2300('0x34')](_0x194e32['model'],qs[_0x2300('0x37')](_0x44d9fd['query'][_0x2300('0x37')]));_0xe4b5b1[_0x2300('0x36')]=_0xe4b5b1[_0x2300('0x36')]['length']?_0xe4b5b1[_0x2300('0x36')]:_0x194e32['model'];_0xe4b5b1['order']=qs['sort'](_0x44d9fd[_0x2300('0x32')][_0x2300('0x3a')]);_0xe4b5b1[_0x2300('0x3b')]=qs['filters'](_[_0x2300('0x3c')](_0x44d9fd[_0x2300('0x32')],_0x194e32[_0x2300('0x33')]));if(_0x44d9fd[_0x2300('0x32')][_0x2300('0x3d')]){_0xe4b5b1[_0x2300('0x3b')]=_[_0x2300('0x3e')](_0xe4b5b1[_0x2300('0x3b')],{'$or':_[_0x2300('0x2e')](_0xe4b5b1[_0x2300('0x36')],function(_0x5ec14b){var _0x3c3022={};_0x3c3022[_0x5ec14b]={'$like':'%'+_0x44d9fd[_0x2300('0x32')][_0x2300('0x3d')]+'%'};return _0x3c3022;})});}_0xe4b5b1=_['merge']({},_0xe4b5b1,_0x44d9fd[_0x2300('0x40')]);return _0x1d9004[_0x2300('0x58')](_0xe4b5b1);}})[_0x2300('0x24')](function(_0x5cc857){if(_0x5cc857){_0x2a0d1f=_0x5cc857['length'];if(!_0x44d9fd['query'][_0x2300('0x38')](_0x2300('0x59'))){_0xe4b5b1[_0x2300('0x1b')]=qs[_0x2300('0x1b')](_0x44d9fd[_0x2300('0x32')][_0x2300('0x1b')]);_0xe4b5b1[_0x2300('0x1a')]=qs[_0x2300('0x1a')](_0x44d9fd['query'][_0x2300('0x1a')]);}return _0x1d9004[_0x2300('0x58')](_0xe4b5b1);}})[_0x2300('0x24')](function(_0x26844a){if(_0x26844a){return _0x26844a?{'count':_0x2a0d1f,'rows':_0x26844a}:null;}})[_0x2300('0x24')](respondWithResult(_0x4b0ca1,null))['catch'](handleError(_0x4b0ca1,null));};exports['getAnyConditions']=function(_0x3cf2cc,_0x10cf50,_0x441fb2){var _0x2fee27={};var _0x4b8a43={};var _0x17e6e7;var _0x461449;return db[_0x2300('0x2f')][_0x2300('0x57')]({'where':{'id':_0x3cf2cc[_0x2300('0x47')]['id']}})['then'](handleEntityNotFound(_0x10cf50,null))['then'](function(_0x35cecf){if(_0x35cecf){_0x17e6e7=_0x35cecf;_0x4b8a43[_0x2300('0x35')]=_[_0x2300('0x48')](db[_0x2300('0x56')]['rawAttributes']);_0x4b8a43['query']=_[_0x2300('0x48')](_0x3cf2cc['query']);_0x4b8a43[_0x2300('0x33')]=_[_0x2300('0x34')](_0x4b8a43[_0x2300('0x35')],_0x4b8a43[_0x2300('0x32')]);_0x2fee27[_0x2300('0x36')]=_[_0x2300('0x34')](_0x4b8a43[_0x2300('0x35')],qs[_0x2300('0x37')](_0x3cf2cc['query'][_0x2300('0x37')]));_0x2fee27[_0x2300('0x36')]=_0x2fee27['attributes']['length']?_0x2fee27[_0x2300('0x36')]:_0x4b8a43[_0x2300('0x35')];_0x2fee27[_0x2300('0x39')]=qs[_0x2300('0x3a')](_0x3cf2cc['query'][_0x2300('0x3a')]);_0x2fee27['where']=qs[_0x2300('0x33')](_[_0x2300('0x3c')](_0x3cf2cc['query'],_0x4b8a43['filters']));if(_0x3cf2cc[_0x2300('0x32')][_0x2300('0x3d')]){_0x2fee27['where']=_[_0x2300('0x3e')](_0x2fee27[_0x2300('0x3b')],{'$or':_[_0x2300('0x2e')](_0x2fee27[_0x2300('0x36')],function(_0x119809){var _0x6f7406={};_0x6f7406[_0x119809]={'$like':'%'+_0x3cf2cc[_0x2300('0x32')][_0x2300('0x3d')]+'%'};return _0x6f7406;})});}_0x2fee27=_[_0x2300('0x3e')]({},_0x2fee27,_0x3cf2cc[_0x2300('0x40')]);return _0x17e6e7[_0x2300('0x5a')](_0x2fee27);}})[_0x2300('0x24')](function(_0xec4bf5){if(_0xec4bf5){_0x461449=_0xec4bf5[_0x2300('0x49')];if(!_0x3cf2cc[_0x2300('0x32')]['hasOwnProperty']('nolimit')){_0x2fee27[_0x2300('0x1b')]=qs[_0x2300('0x1b')](_0x3cf2cc[_0x2300('0x32')][_0x2300('0x1b')]);_0x2fee27[_0x2300('0x1a')]=qs[_0x2300('0x1a')](_0x3cf2cc[_0x2300('0x32')][_0x2300('0x1a')]);}return _0x17e6e7[_0x2300('0x5a')](_0x2fee27);}})['then'](function(_0x1bc921){if(_0x1bc921){return _0x1bc921?{'count':_0x461449,'rows':_0x1bc921}:null;}})[_0x2300('0x24')](respondWithResult(_0x10cf50,null))[_0x2300('0x45')](handleError(_0x10cf50,null));};exports[_0x2300('0x5b')]=function(_0x1a47c6,_0x43ec73,_0x1840df){if(_0x1a47c6[_0x2300('0x4c')]['id']){delete _0x1a47c6['body']['id'];}return db[_0x2300('0x2f')][_0x2300('0x4a')]({'where':{'id':_0x1a47c6[_0x2300('0x47')]['id']}})['then'](handleEntityNotFound(_0x43ec73,null))[_0x2300('0x24')](function(_0xe7e758){if(_0xe7e758){_0x1a47c6[_0x2300('0x4c')][_0x2300('0x5c')]=_0xe7e758['id'];return db[_0x2300('0x5d')][_0x2300('0x4b')](_0x1a47c6[_0x2300('0x4c')]);}})['then'](respondWithResult(_0x43ec73,null))[_0x2300('0x45')](handleError(_0x43ec73,null));};exports[_0x2300('0x5e')]=function(_0x2034e1,_0x1bab96,_0x3839ea){var _0xaa548e={};var _0x2b9528={};var _0xd97ac8;var _0x5dd211;return db[_0x2300('0x2f')][_0x2300('0x57')]({'where':{'id':_0x2034e1['params']['id']}})[_0x2300('0x24')](handleEntityNotFound(_0x1bab96,null))[_0x2300('0x24')](function(_0x2195e3){if(_0x2195e3){_0xd97ac8=_0x2195e3;_0x2b9528['model']=_[_0x2300('0x48')](db[_0x2300('0x5d')]['rawAttributes']);_0x2b9528['query']=_['keys'](_0x2034e1['query']);_0x2b9528[_0x2300('0x33')]=_[_0x2300('0x34')](_0x2b9528[_0x2300('0x35')],_0x2b9528['query']);_0xaa548e[_0x2300('0x36')]=_[_0x2300('0x34')](_0x2b9528[_0x2300('0x35')],qs[_0x2300('0x37')](_0x2034e1[_0x2300('0x32')][_0x2300('0x37')]));_0xaa548e['attributes']=_0xaa548e[_0x2300('0x36')][_0x2300('0x49')]?_0xaa548e[_0x2300('0x36')]:_0x2b9528[_0x2300('0x35')];_0xaa548e[_0x2300('0x39')]=qs[_0x2300('0x3a')](_0x2034e1[_0x2300('0x32')]['sort']);_0xaa548e[_0x2300('0x3b')]=qs[_0x2300('0x33')](_[_0x2300('0x3c')](_0x2034e1[_0x2300('0x32')],_0x2b9528[_0x2300('0x33')]));if(_0x2034e1['query'][_0x2300('0x3d')]){_0xaa548e[_0x2300('0x3b')]=_[_0x2300('0x3e')](_0xaa548e['where'],{'$or':_[_0x2300('0x2e')](_0xaa548e[_0x2300('0x36')],function(_0x2fee20){var _0x5dd394={};_0x5dd394[_0x2fee20]={'$like':'%'+_0x2034e1[_0x2300('0x32')][_0x2300('0x3d')]+'%'};return _0x5dd394;})});}_0xaa548e=_['merge']({},_0xaa548e,_0x2034e1[_0x2300('0x40')]);return _0xd97ac8['getActions'](_0xaa548e);}})[_0x2300('0x24')](function(_0x23d3fa){if(_0x23d3fa){_0x5dd211=_0x23d3fa[_0x2300('0x49')];if(!_0x2034e1[_0x2300('0x32')][_0x2300('0x38')](_0x2300('0x59'))){_0xaa548e[_0x2300('0x1b')]=qs[_0x2300('0x1b')](_0x2034e1[_0x2300('0x32')][_0x2300('0x1b')]);_0xaa548e[_0x2300('0x1a')]=qs[_0x2300('0x1a')](_0x2034e1[_0x2300('0x32')][_0x2300('0x1a')]);}return _0xd97ac8['getActions'](_0xaa548e);}})[_0x2300('0x24')](function(_0x327248){if(_0x327248){return _0x327248?{'count':_0x5dd211,'rows':_0x327248}:null;}})['then'](respondWithResult(_0x1bab96,null))[_0x2300('0x45')](handleError(_0x1bab96,null));}; \ No newline at end of file +var _0x4d47=['intersection','includeAll','find','create','role','user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','mustache','path','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','show','params'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0x4d47,0x1ee));var _0x74d4=function(_0x3e5db0,_0x369dc2){_0x3e5db0=_0x3e5db0-0x0;var _0x3864d8=_0x4d47[_0x3e5db0];return _0x3864d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74d4('0x0'));var zipdir=require(_0x74d4('0x1'));var jsonpatch=require(_0x74d4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74d4('0x3'));var util=require('util');var path=require(_0x74d4('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74d4('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74d4('0x6'));var squel=require('squel');var crypto=require(_0x74d4('0x7'));var jsforce=require(_0x74d4('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x74d4('0x9'));var Redis=require(_0x74d4('0xa'));var authService=require(_0x74d4('0xb'));var qs=require(_0x74d4('0xc'));var as=require(_0x74d4('0xd'));var hardwareService=require(_0x74d4('0xe'));var logger=require(_0x74d4('0xf'))(_0x74d4('0x10'));var utils=require(_0x74d4('0x11'));var config=require(_0x74d4('0x12'));var licenseUtil=require(_0x74d4('0x13'));var db=require(_0x74d4('0x14'))['db'];function respondWithStatusCode(_0x332451,_0x5904de){_0x5904de=_0x5904de||0xcc;return function(_0x5b03a1){if(_0x5b03a1){return _0x332451[_0x74d4('0x15')](_0x5904de);}return _0x332451[_0x74d4('0x16')](_0x5904de)['end']();};}function respondWithResult(_0x17caa0,_0xf3ff31){_0xf3ff31=_0xf3ff31||0xc8;return function(_0xf81222){if(_0xf81222){return _0x17caa0[_0x74d4('0x16')](_0xf3ff31)[_0x74d4('0x17')](_0xf81222);}};}function respondWithFilteredResult(_0x4af309,_0xe893f4){return function(_0x4768f4){if(_0x4768f4){var _0x26f56c=typeof _0xe893f4[_0x74d4('0x18')]===_0x74d4('0x19')&&typeof _0xe893f4['limit']==='undefined';var _0x35ced6=_0x4768f4[_0x74d4('0x1a')];var _0x263d90=_0x26f56c?0x0:_0xe893f4['offset'];var _0x56782b=_0x26f56c?_0x4768f4['count']:_0xe893f4[_0x74d4('0x18')]+_0xe893f4[_0x74d4('0x1b')];var _0x38dacb;if(_0x56782b>=_0x35ced6){_0x56782b=_0x35ced6;_0x38dacb=0xc8;}else{_0x38dacb=0xce;}_0x4af309[_0x74d4('0x16')](_0x38dacb);return _0x4af309[_0x74d4('0x1c')]('Content-Range',_0x263d90+'-'+_0x56782b+'/'+_0x35ced6)['json'](_0x4768f4);}return null;};}function patchUpdates(_0x298358){return function(_0x37d108){try{jsonpatch[_0x74d4('0x1d')](_0x37d108,_0x298358,!![]);}catch(_0x4ad4a3){return BPromise[_0x74d4('0x1e')](_0x4ad4a3);}return _0x37d108[_0x74d4('0x1f')]();};}function saveUpdates(_0x2e0e40,_0x5bda59){return function(_0x39dc7c){if(_0x39dc7c){return _0x39dc7c['update'](_0x2e0e40)['then'](function(_0x3bb8d1){return _0x3bb8d1;});}return null;};}function removeEntity(_0x15576e,_0x1265c1){return function(_0x16e614){if(_0x16e614){return _0x16e614[_0x74d4('0x20')]()[_0x74d4('0x21')](function(){var _0x2c18a5=_0x16e614[_0x74d4('0x22')]({'plain':!![]});var _0x4a63e4=_0x74d4('0x23');return db[_0x74d4('0x24')][_0x74d4('0x20')]({'where':{'type':_0x4a63e4,'resourceId':_0x2c18a5['id']}})[_0x74d4('0x21')](function(){return _0x16e614;});})[_0x74d4('0x21')](function(){_0x15576e[_0x74d4('0x16')](0xcc)[_0x74d4('0x25')]();});}};}function handleEntityNotFound(_0xda0842,_0x53d0ee){return function(_0x3f1595){if(!_0x3f1595){_0xda0842[_0x74d4('0x15')](0x194);}return _0x3f1595;};}function handleError(_0x2fac30,_0x202d76){_0x202d76=_0x202d76||0x1f4;return function(_0xb43d60){logger[_0x74d4('0x26')](_0xb43d60[_0x74d4('0x27')]);if(_0xb43d60[_0x74d4('0x28')]){delete _0xb43d60[_0x74d4('0x28')];}_0x2fac30[_0x74d4('0x16')](_0x202d76)[_0x74d4('0x29')](_0xb43d60);};}exports[_0x74d4('0x2a')]=function(_0x4f9855,_0x4918bb){var _0x4d0ca5={},_0x56ce25={},_0x26d4d3={'count':0x0,'rows':[]};var _0x551875=_[_0x74d4('0x2b')](db[_0x74d4('0x2c')][_0x74d4('0x2d')],function(_0x172183){return{'name':_0x172183[_0x74d4('0x2e')],'type':_0x172183[_0x74d4('0x2f')][_0x74d4('0x30')]};});_0x56ce25[_0x74d4('0x31')]=_['map'](_0x551875,'name');_0x56ce25[_0x74d4('0x32')]=_[_0x74d4('0x33')](_0x4f9855[_0x74d4('0x32')]);_0x56ce25[_0x74d4('0x34')]=_['intersection'](_0x56ce25[_0x74d4('0x31')],_0x56ce25[_0x74d4('0x32')]);_0x4d0ca5[_0x74d4('0x35')]=_['intersection'](_0x56ce25['model'],qs[_0x74d4('0x36')](_0x4f9855[_0x74d4('0x32')][_0x74d4('0x36')]));_0x4d0ca5[_0x74d4('0x35')]=_0x4d0ca5[_0x74d4('0x35')][_0x74d4('0x37')]?_0x4d0ca5[_0x74d4('0x35')]:_0x56ce25[_0x74d4('0x31')];if(!_0x4f9855[_0x74d4('0x32')][_0x74d4('0x38')]('nolimit')){_0x4d0ca5[_0x74d4('0x1b')]=qs[_0x74d4('0x1b')](_0x4f9855[_0x74d4('0x32')][_0x74d4('0x1b')]);_0x4d0ca5[_0x74d4('0x18')]=qs[_0x74d4('0x18')](_0x4f9855[_0x74d4('0x32')][_0x74d4('0x18')]);}_0x4d0ca5[_0x74d4('0x39')]=qs[_0x74d4('0x3a')](_0x4f9855[_0x74d4('0x32')][_0x74d4('0x3a')]);_0x4d0ca5['where']=qs[_0x74d4('0x34')](_[_0x74d4('0x3b')](_0x4f9855['query'],_0x56ce25['filters']),_0x551875);if(_0x4f9855[_0x74d4('0x32')][_0x74d4('0x3c')]){_0x4d0ca5['where']=_[_0x74d4('0x3d')](_0x4d0ca5['where'],{'$or':_[_0x74d4('0x2b')](_0x551875,function(_0x3a5198){if(_0x3a5198[_0x74d4('0x2f')]!==_0x74d4('0x3e')){var _0x3088c4={};_0x3088c4[_0x3a5198[_0x74d4('0x28')]]={'$like':'%'+_0x4f9855[_0x74d4('0x32')][_0x74d4('0x3c')]+'%'};return _0x3088c4;}})});}_0x4d0ca5=_[_0x74d4('0x3d')]({},_0x4d0ca5,_0x4f9855[_0x74d4('0x3f')]);var _0x52402c={'where':_0x4d0ca5[_0x74d4('0x40')]};return db[_0x74d4('0x2c')][_0x74d4('0x1a')](_0x52402c)[_0x74d4('0x21')](function(_0x73e542){_0x26d4d3[_0x74d4('0x1a')]=_0x73e542;if(_0x4f9855[_0x74d4('0x32')]['includeAll']){_0x4d0ca5[_0x74d4('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x74d4('0x42')](_0x4d0ca5);})[_0x74d4('0x21')](function(_0x4e210b){_0x26d4d3[_0x74d4('0x43')]=_0x4e210b;return _0x26d4d3;})[_0x74d4('0x21')](respondWithFilteredResult(_0x4918bb,_0x4d0ca5))['catch'](handleError(_0x4918bb,null));};exports[_0x74d4('0x44')]=function(_0x349511,_0x2850dc){var _0x50a4b0={'raw':![],'where':{'id':_0x349511[_0x74d4('0x45')]['id']}},_0x303a62={};_0x303a62[_0x74d4('0x31')]=_[_0x74d4('0x33')](db['Trigger'][_0x74d4('0x2d')]);_0x303a62['query']=_[_0x74d4('0x33')](_0x349511[_0x74d4('0x32')]);_0x303a62[_0x74d4('0x34')]=_['intersection'](_0x303a62[_0x74d4('0x31')],_0x303a62[_0x74d4('0x32')]);_0x50a4b0[_0x74d4('0x35')]=_[_0x74d4('0x46')](_0x303a62[_0x74d4('0x31')],qs[_0x74d4('0x36')](_0x349511[_0x74d4('0x32')]['fields']));_0x50a4b0[_0x74d4('0x35')]=_0x50a4b0[_0x74d4('0x35')][_0x74d4('0x37')]?_0x50a4b0[_0x74d4('0x35')]:_0x303a62[_0x74d4('0x31')];if(_0x349511['query'][_0x74d4('0x47')]){_0x50a4b0[_0x74d4('0x41')]=[{'all':!![]}];}_0x50a4b0=_[_0x74d4('0x3d')]({},_0x50a4b0,_0x349511[_0x74d4('0x3f')]);return db[_0x74d4('0x2c')][_0x74d4('0x48')](_0x50a4b0)[_0x74d4('0x21')](handleEntityNotFound(_0x2850dc,null))[_0x74d4('0x21')](respondWithResult(_0x2850dc,null))['catch'](handleError(_0x2850dc,null));};exports[_0x74d4('0x49')]=function(_0x4bcec4,_0x2e3a14){return db[_0x74d4('0x2c')]['create'](_0x4bcec4['body'],{})['then'](function(_0x350e7c){var _0x397f5f=_0x4bcec4['user'][_0x74d4('0x22')]({'plain':!![]});if(!_0x397f5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397f5f[_0x74d4('0x4a')]===_0x74d4('0x4b')){var _0x358475=_0x350e7c[_0x74d4('0x22')]({'plain':!![]});var _0x4f5b4a='Triggers';return db[_0x74d4('0x4c')][_0x74d4('0x48')]({'where':{'name':_0x4f5b4a,'userProfileId':_0x397f5f['userProfileId']},'raw':!![]})[_0x74d4('0x21')](function(_0x4579f5){if(_0x4579f5&&_0x4579f5[_0x74d4('0x4d')]===0x0){return db[_0x74d4('0x24')]['create']({'name':_0x358475[_0x74d4('0x28')],'resourceId':_0x358475['id'],'type':_0x4579f5['name'],'sectionId':_0x4579f5['id']},{})['then'](function(){return _0x350e7c;});}else{return _0x350e7c;}})[_0x74d4('0x4e')](function(_0x2a8b4d){logger['error'](_0x74d4('0x4f'),_0x2a8b4d);throw _0x2a8b4d;});}return _0x350e7c;})[_0x74d4('0x21')](respondWithResult(_0x2e3a14,0xc9))[_0x74d4('0x4e')](handleError(_0x2e3a14,null));};exports[_0x74d4('0x50')]=function(_0x5dd5f6,_0x17881c){if(_0x5dd5f6['body']['id']){delete _0x5dd5f6[_0x74d4('0x51')]['id'];}return db[_0x74d4('0x2c')][_0x74d4('0x48')]({'where':{'id':_0x5dd5f6[_0x74d4('0x45')]['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x17881c,null))['then'](saveUpdates(_0x5dd5f6[_0x74d4('0x51')],null))['then'](respondWithResult(_0x17881c,null))[_0x74d4('0x4e')](handleError(_0x17881c,null));};exports[_0x74d4('0x20')]=function(_0x5affc5,_0x3ee6fc){return db[_0x74d4('0x2c')][_0x74d4('0x48')]({'where':{'id':_0x5affc5['params']['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x3ee6fc,null))['then'](removeEntity(_0x3ee6fc,null))[_0x74d4('0x4e')](handleError(_0x3ee6fc,null));};exports[_0x74d4('0x52')]=function(_0x21014b,_0x44c7a5,_0x421f8a){if(_0x21014b[_0x74d4('0x51')]['id']){delete _0x21014b[_0x74d4('0x51')]['id'];}return db['Trigger'][_0x74d4('0x48')]({'where':{'id':_0x21014b[_0x74d4('0x45')]['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x44c7a5,null))['then'](function(_0x2f5434){if(_0x2f5434){_0x21014b[_0x74d4('0x51')][_0x74d4('0x53')]=_0x2f5434['id'];return db[_0x74d4('0x54')][_0x74d4('0x49')](_0x21014b[_0x74d4('0x51')]);}})['then'](respondWithResult(_0x44c7a5,null))[_0x74d4('0x4e')](handleError(_0x44c7a5,null));};exports[_0x74d4('0x55')]=function(_0x1ce066,_0x124391,_0x3ed0aa){if(_0x1ce066[_0x74d4('0x51')]['id']){delete _0x1ce066[_0x74d4('0x51')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1ce066[_0x74d4('0x45')]['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x124391,null))[_0x74d4('0x21')](function(_0x5717b2){if(_0x5717b2){_0x1ce066[_0x74d4('0x51')][_0x74d4('0x56')]=_0x5717b2['id'];return db[_0x74d4('0x54')][_0x74d4('0x49')](_0x1ce066[_0x74d4('0x51')]);}})[_0x74d4('0x21')](respondWithResult(_0x124391,null))[_0x74d4('0x4e')](handleError(_0x124391,null));};exports[_0x74d4('0x57')]=function(_0x2ef719,_0x4c6874,_0x16ea2a){var _0x12b5b6={};var _0x49d5fe={};var _0x1db15d;var _0x3f96f9;return db[_0x74d4('0x2c')][_0x74d4('0x58')]({'where':{'id':_0x2ef719[_0x74d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c6874,null))['then'](function(_0xdf0ab7){if(_0xdf0ab7){_0x1db15d=_0xdf0ab7;_0x49d5fe[_0x74d4('0x31')]=_[_0x74d4('0x33')](db[_0x74d4('0x54')][_0x74d4('0x2d')]);_0x49d5fe[_0x74d4('0x32')]=_[_0x74d4('0x33')](_0x2ef719[_0x74d4('0x32')]);_0x49d5fe[_0x74d4('0x34')]=_[_0x74d4('0x46')](_0x49d5fe[_0x74d4('0x31')],_0x49d5fe[_0x74d4('0x32')]);_0x12b5b6[_0x74d4('0x35')]=_[_0x74d4('0x46')](_0x49d5fe[_0x74d4('0x31')],qs[_0x74d4('0x36')](_0x2ef719['query'][_0x74d4('0x36')]));_0x12b5b6[_0x74d4('0x35')]=_0x12b5b6[_0x74d4('0x35')][_0x74d4('0x37')]?_0x12b5b6[_0x74d4('0x35')]:_0x49d5fe[_0x74d4('0x31')];_0x12b5b6['order']=qs[_0x74d4('0x3a')](_0x2ef719[_0x74d4('0x32')]['sort']);_0x12b5b6[_0x74d4('0x40')]=qs[_0x74d4('0x34')](_['pick'](_0x2ef719[_0x74d4('0x32')],_0x49d5fe[_0x74d4('0x34')]));if(_0x2ef719[_0x74d4('0x32')][_0x74d4('0x3c')]){_0x12b5b6[_0x74d4('0x40')]=_[_0x74d4('0x3d')](_0x12b5b6[_0x74d4('0x40')],{'$or':_['map'](_0x12b5b6[_0x74d4('0x35')],function(_0x5cb2d5){var _0x194b61={};_0x194b61[_0x5cb2d5]={'$like':'%'+_0x2ef719['query']['filter']+'%'};return _0x194b61;})});}_0x12b5b6=_[_0x74d4('0x3d')]({},_0x12b5b6,_0x2ef719[_0x74d4('0x3f')]);return _0x1db15d['getAllConditions'](_0x12b5b6);}})[_0x74d4('0x21')](function(_0x12941a){if(_0x12941a){_0x3f96f9=_0x12941a[_0x74d4('0x37')];if(!_0x2ef719['query'][_0x74d4('0x38')](_0x74d4('0x59'))){_0x12b5b6[_0x74d4('0x1b')]=qs['limit'](_0x2ef719[_0x74d4('0x32')][_0x74d4('0x1b')]);_0x12b5b6[_0x74d4('0x18')]=qs[_0x74d4('0x18')](_0x2ef719['query'][_0x74d4('0x18')]);}return _0x1db15d['getAllConditions'](_0x12b5b6);}})[_0x74d4('0x21')](function(_0x4f07d6){if(_0x4f07d6){return _0x4f07d6?{'count':_0x3f96f9,'rows':_0x4f07d6}:null;}})[_0x74d4('0x21')](respondWithResult(_0x4c6874,null))['catch'](handleError(_0x4c6874,null));};exports['getAnyConditions']=function(_0x4cba8f,_0x4bbefa,_0x28d369){var _0x3db49a={};var _0x1b7e0d={};var _0x313703;var _0x23afaf;return db['Trigger'][_0x74d4('0x58')]({'where':{'id':_0x4cba8f[_0x74d4('0x45')]['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x4bbefa,null))['then'](function(_0x2c2610){if(_0x2c2610){_0x313703=_0x2c2610;_0x1b7e0d[_0x74d4('0x31')]=_[_0x74d4('0x33')](db[_0x74d4('0x54')][_0x74d4('0x2d')]);_0x1b7e0d[_0x74d4('0x32')]=_[_0x74d4('0x33')](_0x4cba8f[_0x74d4('0x32')]);_0x1b7e0d[_0x74d4('0x34')]=_[_0x74d4('0x46')](_0x1b7e0d[_0x74d4('0x31')],_0x1b7e0d[_0x74d4('0x32')]);_0x3db49a['attributes']=_[_0x74d4('0x46')](_0x1b7e0d[_0x74d4('0x31')],qs[_0x74d4('0x36')](_0x4cba8f[_0x74d4('0x32')][_0x74d4('0x36')]));_0x3db49a['attributes']=_0x3db49a[_0x74d4('0x35')][_0x74d4('0x37')]?_0x3db49a['attributes']:_0x1b7e0d[_0x74d4('0x31')];_0x3db49a[_0x74d4('0x39')]=qs[_0x74d4('0x3a')](_0x4cba8f[_0x74d4('0x32')]['sort']);_0x3db49a[_0x74d4('0x40')]=qs[_0x74d4('0x34')](_[_0x74d4('0x3b')](_0x4cba8f[_0x74d4('0x32')],_0x1b7e0d[_0x74d4('0x34')]));if(_0x4cba8f['query']['filter']){_0x3db49a['where']=_['merge'](_0x3db49a[_0x74d4('0x40')],{'$or':_[_0x74d4('0x2b')](_0x3db49a['attributes'],function(_0x39b871){var _0x44c282={};_0x44c282[_0x39b871]={'$like':'%'+_0x4cba8f['query'][_0x74d4('0x3c')]+'%'};return _0x44c282;})});}_0x3db49a=_[_0x74d4('0x3d')]({},_0x3db49a,_0x4cba8f[_0x74d4('0x3f')]);return _0x313703[_0x74d4('0x5a')](_0x3db49a);}})[_0x74d4('0x21')](function(_0x42aef2){if(_0x42aef2){_0x23afaf=_0x42aef2[_0x74d4('0x37')];if(!_0x4cba8f[_0x74d4('0x32')][_0x74d4('0x38')](_0x74d4('0x59'))){_0x3db49a[_0x74d4('0x1b')]=qs[_0x74d4('0x1b')](_0x4cba8f[_0x74d4('0x32')][_0x74d4('0x1b')]);_0x3db49a[_0x74d4('0x18')]=qs[_0x74d4('0x18')](_0x4cba8f[_0x74d4('0x32')][_0x74d4('0x18')]);}return _0x313703[_0x74d4('0x5a')](_0x3db49a);}})[_0x74d4('0x21')](function(_0x2e85d2){if(_0x2e85d2){return _0x2e85d2?{'count':_0x23afaf,'rows':_0x2e85d2}:null;}})[_0x74d4('0x21')](respondWithResult(_0x4bbefa,null))[_0x74d4('0x4e')](handleError(_0x4bbefa,null));};exports['addAction']=function(_0x36b5f9,_0x5a2de8,_0x4f5ed8){if(_0x36b5f9[_0x74d4('0x51')]['id']){delete _0x36b5f9[_0x74d4('0x51')]['id'];}return db[_0x74d4('0x2c')]['find']({'where':{'id':_0x36b5f9[_0x74d4('0x45')]['id']}})[_0x74d4('0x21')](handleEntityNotFound(_0x5a2de8,null))['then'](function(_0x31ac18){if(_0x31ac18){_0x36b5f9[_0x74d4('0x51')][_0x74d4('0x5b')]=_0x31ac18['id'];return db[_0x74d4('0x5c')]['create'](_0x36b5f9[_0x74d4('0x51')]);}})['then'](respondWithResult(_0x5a2de8,null))[_0x74d4('0x4e')](handleError(_0x5a2de8,null));};exports[_0x74d4('0x5d')]=function(_0x1b2d87,_0x1af456,_0x1e2135){var _0x5c09b1={};var _0x71e541={};var _0x2516d8;var _0x13d31d;return db[_0x74d4('0x2c')]['findOne']({'where':{'id':_0x1b2d87[_0x74d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1af456,null))[_0x74d4('0x21')](function(_0x52ee55){if(_0x52ee55){_0x2516d8=_0x52ee55;_0x71e541[_0x74d4('0x31')]=_[_0x74d4('0x33')](db['Action'][_0x74d4('0x2d')]);_0x71e541[_0x74d4('0x32')]=_[_0x74d4('0x33')](_0x1b2d87[_0x74d4('0x32')]);_0x71e541[_0x74d4('0x34')]=_[_0x74d4('0x46')](_0x71e541[_0x74d4('0x31')],_0x71e541['query']);_0x5c09b1[_0x74d4('0x35')]=_[_0x74d4('0x46')](_0x71e541['model'],qs[_0x74d4('0x36')](_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x36')]));_0x5c09b1['attributes']=_0x5c09b1[_0x74d4('0x35')][_0x74d4('0x37')]?_0x5c09b1[_0x74d4('0x35')]:_0x71e541['model'];_0x5c09b1['order']=qs[_0x74d4('0x3a')](_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x3a')]);_0x5c09b1[_0x74d4('0x40')]=qs[_0x74d4('0x34')](_[_0x74d4('0x3b')](_0x1b2d87['query'],_0x71e541[_0x74d4('0x34')]));if(_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x3c')]){_0x5c09b1[_0x74d4('0x40')]=_[_0x74d4('0x3d')](_0x5c09b1[_0x74d4('0x40')],{'$or':_[_0x74d4('0x2b')](_0x5c09b1[_0x74d4('0x35')],function(_0x42bf01){var _0x26314f={};_0x26314f[_0x42bf01]={'$like':'%'+_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x3c')]+'%'};return _0x26314f;})});}_0x5c09b1=_[_0x74d4('0x3d')]({},_0x5c09b1,_0x1b2d87['options']);return _0x2516d8[_0x74d4('0x5d')](_0x5c09b1);}})[_0x74d4('0x21')](function(_0x524a1e){if(_0x524a1e){_0x13d31d=_0x524a1e[_0x74d4('0x37')];if(!_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x38')](_0x74d4('0x59'))){_0x5c09b1['limit']=qs[_0x74d4('0x1b')](_0x1b2d87[_0x74d4('0x32')][_0x74d4('0x1b')]);_0x5c09b1[_0x74d4('0x18')]=qs['offset'](_0x1b2d87[_0x74d4('0x32')]['offset']);}return _0x2516d8[_0x74d4('0x5d')](_0x5c09b1);}})[_0x74d4('0x21')](function(_0x4b5ee6){if(_0x4b5ee6){return _0x4b5ee6?{'count':_0x13d31d,'rows':_0x4b5ee6}:null;}})[_0x74d4('0x21')](respondWithResult(_0x1af456,null))['catch'](handleError(_0x1af456,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f498d3d..49241cb 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 _0x3dd5=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','lodash','../../config/logger','api','moment','bluebird'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x3dd5,0x73));var _0x53dd=function(_0x98133,_0x4e3747){_0x98133=_0x98133-0x0;var _0xd037e1=_0x3dd5[_0x98133];return _0xd037e1;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var logger=require(_0x53dd('0x1'))(_0x53dd('0x2'));var moment=require(_0x53dd('0x3'));var BPromise=require(_0x53dd('0x4'));var rp=require(_0x53dd('0x5'));var fs=require('fs');var path=require(_0x53dd('0x6'));var rimraf=require(_0x53dd('0x7'));var config=require(_0x53dd('0x8'));var attributes=require(_0x53dd('0x9'));module['exports']=function(_0x3c8f9e,_0x26c218){return _0x3c8f9e[_0x53dd('0xa')](_0x53dd('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d4e=['exports','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0d4e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var logger=require(_0xe0d4('0x2'))(_0xe0d4('0x3'));var moment=require(_0xe0d4('0x4'));var BPromise=require(_0xe0d4('0x5'));var rp=require(_0xe0d4('0x6'));var fs=require('fs');var path=require(_0xe0d4('0x7'));var rimraf=require(_0xe0d4('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0d4('0x9'));module[_0xe0d4('0xa')]=function(_0x2cc782,_0x25bdbe){return _0x2cc782['define']('Trigger',attributes,{'tableName':_0xe0d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 48e555a..7291718 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 _0x1db7=['map','model','stringify','ShowTrigger','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include'];(function(_0x337314,_0x23d58b){var _0x3f4e59=function(_0x3248ec){while(--_0x3248ec){_0x337314['push'](_0x337314['shift']());}};_0x3f4e59(++_0x23d58b);}(_0x1db7,0x138));var _0x71db=function(_0x4b3523,_0x4f27c9){_0x4b3523=_0x4b3523-0x0;var _0x164424=_0x1db7[_0x4b3523];return _0x164424;};'use strict';var _=require(_0x71db('0x0'));var util=require(_0x71db('0x1'));var moment=require(_0x71db('0x2'));var BPromise=require(_0x71db('0x3'));var rs=require(_0x71db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71db('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71db('0x7')][_0x71db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31ce3d,_0x4efd9f,_0x4b94c8){return new BPromise(function(_0x159823,_0x563ccf){return client[_0x71db('0x9')](_0x31ce3d,_0x4b94c8)[_0x71db('0xa')](function(_0x53154f){logger[_0x71db('0xb')](_0x71db('0xc'),_0x4efd9f,_0x71db('0xd'));logger['debug'](_0x71db('0xe'),_0x4efd9f,_0x71db('0xd'),JSON['stringify'](_0x53154f));if(_0x53154f[_0x71db('0xf')]){if(_0x53154f[_0x71db('0xf')][_0x71db('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x4efd9f,_0x53154f['error']['message']);return _0x563ccf(_0x53154f[_0x71db('0xf')][_0x71db('0x11')]);}logger[_0x71db('0xf')](_0x71db('0xc'),_0x4efd9f,_0x53154f[_0x71db('0xf')][_0x71db('0x11')]);return _0x159823(_0x53154f[_0x71db('0xf')][_0x71db('0x11')]);}else{logger[_0x71db('0xb')]('Trigger,\x20%s,\x20%s',_0x4efd9f,_0x71db('0xd'));_0x159823(_0x53154f[_0x71db('0x12')][_0x71db('0x11')]);}})[_0x71db('0x13')](function(_0x47295d){logger[_0x71db('0xf')](_0x71db('0xc'),_0x4efd9f,_0x47295d);_0x563ccf(_0x47295d);});});}exports[_0x71db('0x14')]=function(_0x3083a7){var _0x2090ca=this;return new Promise(function(_0x56a2ff,_0x47b603){return db[_0x71db('0x15')][_0x71db('0x16')]({'raw':_0x3083a7['options']?_0x3083a7[_0x71db('0x17')][_0x71db('0x18')]===undefined?!![]:![]:!![],'where':_0x3083a7[_0x71db('0x17')]?_0x3083a7[_0x71db('0x17')][_0x71db('0x19')]||null:null,'attributes':_0x3083a7[_0x71db('0x17')]?_0x3083a7[_0x71db('0x17')][_0x71db('0x1a')]||null:null,'limit':_0x3083a7[_0x71db('0x17')]?_0x3083a7['options']['limit']||null:null,'include':_0x3083a7['options']?_0x3083a7[_0x71db('0x17')][_0x71db('0x1b')]?_[_0x71db('0x1c')](_0x3083a7[_0x71db('0x17')][_0x71db('0x1b')],function(_0x12f193){return{'model':db[_0x12f193[_0x71db('0x1d')]],'as':_0x12f193['as'],'attributes':_0x12f193[_0x71db('0x1a')],'include':_0x12f193['include']?_['map'](_0x12f193['include'],function(_0x4b6571){return{'model':db[_0x4b6571[_0x71db('0x1d')]],'as':_0x4b6571['as'],'attributes':_0x4b6571['attributes'],'include':_0x4b6571[_0x71db('0x1b')]?_[_0x71db('0x1c')](_0x4b6571['include'],function(_0xe9ac4f){return{'model':db[_0xe9ac4f[_0x71db('0x1d')]],'as':_0xe9ac4f['as'],'attributes':_0xe9ac4f[_0x71db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71db('0xa')](function(_0x4635bb){logger[_0x71db('0xb')](_0x71db('0x14'),_0x3083a7);logger['debug'](_0x71db('0x14'),_0x3083a7,JSON[_0x71db('0x1e')](_0x4635bb));_0x56a2ff(_0x4635bb);})['catch'](function(_0x364af2){logger[_0x71db('0xf')](_0x71db('0x14'),_0x364af2[_0x71db('0x11')],_0x3083a7);_0x47b603(_0x2090ca[_0x71db('0xf')](0x1f4,_0x364af2[_0x71db('0x11')]));});});};exports[_0x71db('0x1f')]=function(_0x167a61){var _0x31b67e=this;return new Promise(function(_0xed121c,_0x38b325){return db['Trigger'][_0x71db('0x20')]({'raw':_0x167a61[_0x71db('0x17')]?_0x167a61['options'][_0x71db('0x18')]===undefined?!![]:![]:!![],'where':_0x167a61[_0x71db('0x17')]?_0x167a61[_0x71db('0x17')][_0x71db('0x19')]||null:null,'attributes':_0x167a61[_0x71db('0x17')]?_0x167a61['options']['attributes']||null:null,'include':_0x167a61['options']?_0x167a61[_0x71db('0x17')][_0x71db('0x1b')]?_[_0x71db('0x1c')](_0x167a61[_0x71db('0x17')][_0x71db('0x1b')],function(_0x2f8354){return{'model':db[_0x2f8354[_0x71db('0x1d')]],'as':_0x2f8354['as'],'attributes':_0x2f8354['attributes'],'include':_0x2f8354[_0x71db('0x1b')]?_[_0x71db('0x1c')](_0x2f8354[_0x71db('0x1b')],function(_0x4d00cb){return{'model':db[_0x4d00cb[_0x71db('0x1d')]],'as':_0x4d00cb['as'],'attributes':_0x4d00cb[_0x71db('0x1a')],'include':_0x4d00cb['include']?_[_0x71db('0x1c')](_0x4d00cb[_0x71db('0x1b')],function(_0x1db185){return{'model':db[_0x1db185[_0x71db('0x1d')]],'as':_0x1db185['as'],'attributes':_0x1db185[_0x71db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71db('0xa')](function(_0x5989e5){logger[_0x71db('0xb')](_0x71db('0x1f'),_0x167a61);logger[_0x71db('0x21')](_0x71db('0x1f'),_0x167a61,JSON[_0x71db('0x1e')](_0x5989e5));_0xed121c(_0x5989e5);})[_0x71db('0x13')](function(_0x53a684){logger[_0x71db('0xf')](_0x71db('0x1f'),_0x53a684[_0x71db('0x11')],_0x167a61);_0x38b325(_0x31b67e[_0x71db('0xf')](0x1f4,_0x53a684[_0x71db('0x11')]));});});}; \ No newline at end of file +var _0xee61=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','options','raw','where','attributes','limit','map','model','include','then','stringify','catch','ShowTrigger','util','moment'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xee61,0x64));var _0x1ee6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee61[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x1ee6('0x0'));var moment=require(_0x1ee6('0x1'));var BPromise=require(_0x1ee6('0x2'));var rs=require(_0x1ee6('0x3'));var fs=require('fs');var Redis=require(_0x1ee6('0x4'));var db=require(_0x1ee6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ee6('0x6'))(_0x1ee6('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ee6('0x8'));var client=jayson['client'][_0x1ee6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38fce8,_0x2a77e8,_0x27f08c){return new BPromise(function(_0x21d6db,_0x573019){return client[_0x1ee6('0xa')](_0x38fce8,_0x27f08c)['then'](function(_0x3504ed){logger[_0x1ee6('0xb')]('Trigger,\x20%s,\x20%s',_0x2a77e8,_0x1ee6('0xc'));logger[_0x1ee6('0xd')](_0x1ee6('0xe'),_0x2a77e8,'request\x20sent',JSON['stringify'](_0x3504ed));if(_0x3504ed[_0x1ee6('0xf')]){if(_0x3504ed[_0x1ee6('0xf')][_0x1ee6('0x10')]===0x1f4){logger['error'](_0x1ee6('0x11'),_0x2a77e8,_0x3504ed[_0x1ee6('0xf')][_0x1ee6('0x12')]);return _0x573019(_0x3504ed[_0x1ee6('0xf')]['message']);}logger[_0x1ee6('0xf')]('Trigger,\x20%s,\x20%s',_0x2a77e8,_0x3504ed[_0x1ee6('0xf')][_0x1ee6('0x12')]);return _0x21d6db(_0x3504ed[_0x1ee6('0xf')][_0x1ee6('0x12')]);}else{logger['info'](_0x1ee6('0x11'),_0x2a77e8,_0x1ee6('0xc'));_0x21d6db(_0x3504ed[_0x1ee6('0x13')][_0x1ee6('0x12')]);}})['catch'](function(_0x502355){logger['error'](_0x1ee6('0x11'),_0x2a77e8,_0x502355);_0x573019(_0x502355);});});}exports[_0x1ee6('0x14')]=function(_0x5bb906){var _0x67e4cc=this;return new Promise(function(_0x4a36c,_0x2e32ae){return db[_0x1ee6('0x15')]['findAll']({'raw':_0x5bb906[_0x1ee6('0x16')]?_0x5bb906[_0x1ee6('0x16')][_0x1ee6('0x17')]===undefined?!![]:![]:!![],'where':_0x5bb906[_0x1ee6('0x16')]?_0x5bb906[_0x1ee6('0x16')][_0x1ee6('0x18')]||null:null,'attributes':_0x5bb906[_0x1ee6('0x16')]?_0x5bb906[_0x1ee6('0x16')][_0x1ee6('0x19')]||null:null,'limit':_0x5bb906[_0x1ee6('0x16')]?_0x5bb906[_0x1ee6('0x16')][_0x1ee6('0x1a')]||null:null,'include':_0x5bb906[_0x1ee6('0x16')]?_0x5bb906[_0x1ee6('0x16')]['include']?_[_0x1ee6('0x1b')](_0x5bb906[_0x1ee6('0x16')]['include'],function(_0x1103d4){return{'model':db[_0x1103d4[_0x1ee6('0x1c')]],'as':_0x1103d4['as'],'attributes':_0x1103d4[_0x1ee6('0x19')],'include':_0x1103d4[_0x1ee6('0x1d')]?_[_0x1ee6('0x1b')](_0x1103d4[_0x1ee6('0x1d')],function(_0x511f02){return{'model':db[_0x511f02[_0x1ee6('0x1c')]],'as':_0x511f02['as'],'attributes':_0x511f02[_0x1ee6('0x19')],'include':_0x511f02['include']?_['map'](_0x511f02[_0x1ee6('0x1d')],function(_0x1d734f){return{'model':db[_0x1d734f[_0x1ee6('0x1c')]],'as':_0x1d734f['as'],'attributes':_0x1d734f[_0x1ee6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1ee6('0x1e')](function(_0xd420ae){logger[_0x1ee6('0xb')]('GetTrigger',_0x5bb906);logger[_0x1ee6('0xd')](_0x1ee6('0x14'),_0x5bb906,JSON[_0x1ee6('0x1f')](_0xd420ae));_0x4a36c(_0xd420ae);})[_0x1ee6('0x20')](function(_0x5c3f5b){logger['error'](_0x1ee6('0x14'),_0x5c3f5b[_0x1ee6('0x12')],_0x5bb906);_0x2e32ae(_0x67e4cc[_0x1ee6('0xf')](0x1f4,_0x5c3f5b[_0x1ee6('0x12')]));});});};exports[_0x1ee6('0x21')]=function(_0x8290bd){var _0x442969=this;return new Promise(function(_0x3de54e,_0x595836){return db['Trigger']['find']({'raw':_0x8290bd['options']?_0x8290bd[_0x1ee6('0x16')][_0x1ee6('0x17')]===undefined?!![]:![]:!![],'where':_0x8290bd[_0x1ee6('0x16')]?_0x8290bd['options'][_0x1ee6('0x18')]||null:null,'attributes':_0x8290bd[_0x1ee6('0x16')]?_0x8290bd[_0x1ee6('0x16')]['attributes']||null:null,'include':_0x8290bd['options']?_0x8290bd['options'][_0x1ee6('0x1d')]?_[_0x1ee6('0x1b')](_0x8290bd[_0x1ee6('0x16')][_0x1ee6('0x1d')],function(_0x2d2ac4){return{'model':db[_0x2d2ac4[_0x1ee6('0x1c')]],'as':_0x2d2ac4['as'],'attributes':_0x2d2ac4['attributes'],'include':_0x2d2ac4[_0x1ee6('0x1d')]?_[_0x1ee6('0x1b')](_0x2d2ac4[_0x1ee6('0x1d')],function(_0x5fe999){return{'model':db[_0x5fe999[_0x1ee6('0x1c')]],'as':_0x5fe999['as'],'attributes':_0x5fe999[_0x1ee6('0x19')],'include':_0x5fe999[_0x1ee6('0x1d')]?_['map'](_0x5fe999[_0x1ee6('0x1d')],function(_0x5b346e){return{'model':db[_0x5b346e['model']],'as':_0x5b346e['as'],'attributes':_0x5b346e[_0x1ee6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1ee6('0x1e')](function(_0x1d4e94){logger[_0x1ee6('0xb')]('ShowTrigger',_0x8290bd);logger[_0x1ee6('0xd')](_0x1ee6('0x21'),_0x8290bd,JSON[_0x1ee6('0x1f')](_0x1d4e94));_0x3de54e(_0x1d4e94);})['catch'](function(_0x143eeb){logger[_0x1ee6('0xf')](_0x1ee6('0x21'),_0x143eeb[_0x1ee6('0x12')],_0x8290bd);_0x595836(_0x442969[_0x1ee6('0xf')](0x1f4,_0x143eeb[_0x1ee6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 343f79b..cc7b23c 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 _0x799d=['/:id','isAuthenticated','show','post','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x799d,0x105));var _0xd799=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x799d[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xd799('0x0'));var util=require(_0xd799('0x1'));var path=require(_0xd799('0x2'));var timeout=require(_0xd799('0x3'));var express=require(_0xd799('0x4'));var router=express[_0xd799('0x5')]();var fs_extra=require(_0xd799('0x6'));var auth=require(_0xd799('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd799('0x8'));var controller=require(_0xd799('0x9'));router[_0xd799('0xa')]('/',auth['isAuthenticated'](),controller[_0xd799('0xb')]);router[_0xd799('0xa')](_0xd799('0xc'),auth[_0xd799('0xd')](),controller[_0xd799('0xe')]);router[_0xd799('0xf')]('/:id/clone',auth[_0xd799('0xd')](),controller[_0xd799('0x10')]);router[_0xd799('0xf')]('/',auth[_0xd799('0xd')](),controller['create']);router[_0xd799('0x11')](_0xd799('0xc'),auth[_0xd799('0xd')](),controller['update']);router[_0xd799('0x12')](_0xd799('0xc'),auth[_0xd799('0xd')](),controller[_0xd799('0x13')]);module[_0xd799('0x14')]=router; \ No newline at end of file +var _0x9bc6=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','/:id/clone','clone','create','put','delete'];(function(_0x3c0569,_0x11da9f){var _0x142524=function(_0x59a41e){while(--_0x59a41e){_0x3c0569['push'](_0x3c0569['shift']());}};_0x142524(++_0x11da9f);}(_0x9bc6,0x132));var _0x69bc=function(_0xdbff26,_0xfc8995){_0xdbff26=_0xdbff26-0x0;var _0x4adb23=_0x9bc6[_0xdbff26];return _0x4adb23;};'use strict';var multer=require(_0x69bc('0x0'));var util=require(_0x69bc('0x1'));var path=require(_0x69bc('0x2'));var timeout=require(_0x69bc('0x3'));var express=require(_0x69bc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x69bc('0x5'));var config=require(_0x69bc('0x6'));var controller=require('./trunk.controller');router['get']('/',auth[_0x69bc('0x7')](),controller[_0x69bc('0x8')]);router[_0x69bc('0x9')](_0x69bc('0xa'),auth[_0x69bc('0x7')](),controller['show']);router[_0x69bc('0xb')](_0x69bc('0xc'),auth[_0x69bc('0x7')](),controller[_0x69bc('0xd')]);router[_0x69bc('0xb')]('/',auth[_0x69bc('0x7')](),controller[_0x69bc('0xe')]);router[_0x69bc('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x69bc('0x10')](_0x69bc('0xa'),auth[_0x69bc('0x7')](),controller[_0x69bc('0x11')]);module[_0x69bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ad4e5da..819deb0 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 _0xa83e=['sequelize','name','friend','user','STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','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','\x22\x22\x20<>','INTEGER','always','refuse','uac','uas','pai','active','actpass','update,nonat'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa83e,0x1f4));var _0xea83=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0xa83e[_0x1e03e4];return _0x4a887e;};'use strict';var Sequelize=require(_0xea83('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xea83('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xea83('0x2'),_0xea83('0x3'),'peer'),'allowNull':![],'defaultValue':_0xea83('0x2')},'context':{'type':Sequelize[_0xea83('0x4')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x6'),_0xea83('0x7'),_0xea83('0x8'),_0xea83('0x9'),_0xea83('0xa'),_0xea83('0xb'),_0xea83('0xc'),_0xea83('0xd'))},'deny':{'type':Sequelize[_0xea83('0x4')]},'permit':{'type':Sequelize[_0xea83('0x4')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xea83('0x4')]},'remotesecret':{'type':Sequelize[_0xea83('0x4')]},'transport':{'type':Sequelize[_0xea83('0x4')],'defaultValue':'udp','set':function(_0x22d3c1){this[_0xea83('0xe')]('transport',_0x22d3c1?_0x22d3c1['join'](','):null);},'get':function(){return this['getDataValue'](_0xea83('0xf'))?this[_0xea83('0x10')](_0xea83('0xf'))[_0xea83('0x11')](','):null;},'comment':_0xea83('0x12')},'dtmfmode':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x13'),_0xea83('0x14'),_0xea83('0x15'),_0xea83('0x16'),_0xea83('0x17')),'defaultValue':_0xea83('0x13')},'directmedia':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no',_0xea83('0x19'),_0xea83('0x1a'),_0xea83('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xea83('0x5')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xea83('0x4')]},'directmediadeny':{'type':Sequelize[_0xea83('0x4')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xea83('0x1c'),'set':function(_0x1f4c6d){this['setDataValue'](_0xea83('0x1d'),_0x1f4c6d?_0x1f4c6d['join'](','):null);},'get':function(){return this[_0xea83('0x10')](_0xea83('0x1d'))?this[_0xea83('0x10')](_0xea83('0x1d'))['split'](','):null;},'comment':_0xea83('0x1e')},'callgroup':{'type':Sequelize[_0xea83('0x4')]},'namedcallgroup':{'type':Sequelize[_0xea83('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xea83('0x4')]},'language':{'type':Sequelize[_0xea83('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xea83('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xea83('0x1f')},'allow':{'type':Sequelize[_0xea83('0x4')],'allowNull':![],'defaultValue':_0xea83('0x20'),'set':function(_0x2f0f23){this[_0xea83('0xe')](_0xea83('0x21'),_0x2f0f23?_0x2f0f23[_0xea83('0x22')](';'):_0xea83('0x20'));},'get':function(){return this[_0xea83('0x10')](_0xea83('0x21'))?this['getDataValue'](_0xea83('0x21'))[_0xea83('0x11')](';'):null;},'comment':_0xea83('0x23')},'autoframing':{'type':Sequelize[_0xea83('0x5')]('yes','no')},'insecure':{'type':Sequelize[_0xea83('0x4')],'defaultValue':_0xea83('0x24'),'set':function(_0x3e7fb4){this[_0xea83('0xe')](_0xea83('0x25'),_0x3e7fb4?_0x3e7fb4[_0xea83('0x22')](','):null);},'get':function(){return this[_0xea83('0x10')](_0xea83('0x25'))?this['getDataValue'](_0xea83('0x25'))[_0xea83('0x11')](','):null;},'comment':_0xea83('0x26')},'trustrpid':{'type':Sequelize[_0xea83('0x5')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no',_0xea83('0x27'))},'promiscredir':{'type':Sequelize[_0xea83('0x5')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xea83('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xea83('0x4')]},'callerid':{'type':Sequelize[_0xea83('0x4')],'defaultValue':_0xea83('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xea83('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xea83('0x5')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xea83('0x4')]},'template':{'type':Sequelize[_0xea83('0x4')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xea83('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xea83('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'mailbox':{'type':Sequelize[_0xea83('0x4')]},'session_timers':{'type':Sequelize[_0xea83('0x5')]('accept',_0xea83('0x2b'),'originate')},'session_expires':{'type':Sequelize[_0xea83('0x29')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x2c'),_0xea83('0x2d')),'defaultValue':_0xea83('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xea83('0x4')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xea83('0x4')]},'port':{'type':Sequelize[_0xea83('0x29')](0x5)},'qualify':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no'),'defaultValue':_0xea83('0x18')},'keepalive':{'type':Sequelize[_0xea83('0x29')](0xb)},'defaultip':{'type':Sequelize[_0xea83('0x4')]},'defaultuser':{'type':Sequelize[_0xea83('0x4')]},'rtptimeout':{'type':Sequelize[_0xea83('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xea83('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no',_0xea83('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xea83('0x4')]},'timert1':{'type':Sequelize[_0xea83('0x29')](0xb)},'timerb':{'type':Sequelize[_0xea83('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0xea83('0x29')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xea83('0x4')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xea83('0x4')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'force_avp':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'icesupport':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xea83('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xea83('0x4')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xea83('0x4')]},'dtlscafile':{'type':Sequelize[_0xea83('0x4')]},'dtlscapath':{'type':Sequelize[_0xea83('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xea83('0x2f'),'passive',_0xea83('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xea83('0x4')]},'usereqphone':{'type':Sequelize[_0xea83('0x5')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xea83('0x4')]},'recordofffeature':{'type':Sequelize[_0xea83('0x4')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xea83('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xea83('0x5')](_0xea83('0x18'),'no')},'vmexten':{'type':Sequelize[_0xea83('0x4')]},'mohinterpret':{'type':Sequelize[_0xea83('0x4')]},'mohsuggest':{'type':Sequelize[_0xea83('0x4')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea83('0x4')]},'host':{'type':Sequelize[_0xea83('0x4')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xea83('0x18'),'no',_0xea83('0x19'),'update',_0xea83('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xea83('0x4')]},'otherFields':{'type':Sequelize[_0xea83('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xea83('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x856e=['peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','nonat','yes','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user'];(function(_0x5725f2,_0x101f96){var _0x3661a2=function(_0x572dc1){while(--_0x572dc1){_0x5725f2['push'](_0x5725f2['shift']());}};_0x3661a2(++_0x101f96);}(_0x856e,0xc7));var _0xe856=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x856e[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe856('0x0')],'allowNull':![],'unique':_0xe856('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x3'),_0xe856('0x4'),_0xe856('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe856('0x0')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x6'),_0xe856('0x7'),'ALLOWED_FAILED_SCREEN',_0xe856('0x8'),'PROHIB_NOT_SCREENED',_0xe856('0x9'),_0xe856('0xa'),_0xe856('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xe856('0x0')]},'secret':{'type':Sequelize[_0xe856('0x0')]},'md5secret':{'type':Sequelize[_0xe856('0x0')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xe856('0xc'),'set':function(_0x37b0ad){this[_0xe856('0xd')]('transport',_0x37b0ad?_0x37b0ad[_0xe856('0xe')](','):null);},'get':function(){return this[_0xe856('0xf')](_0xe856('0x10'))?this[_0xe856('0xf')](_0xe856('0x10'))['split'](','):null;},'comment':_0xe856('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe856('0x12'),_0xe856('0x13'),'shortinfo','inband',_0xe856('0x14')),'defaultValue':_0xe856('0x12')},'directmedia':{'type':Sequelize[_0xe856('0x2')]('yes','no',_0xe856('0x15'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe856('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe856('0x0')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xe856('0x0')],'defaultValue':'force_rport,comedia','set':function(_0x3a377b){this[_0xe856('0xd')](_0xe856('0x17'),_0x3a377b?_0x3a377b[_0xe856('0xe')](','):null);},'get':function(){return this[_0xe856('0xf')](_0xe856('0x17'))?this['getDataValue'](_0xe856('0x17'))[_0xe856('0x18')](','):null;},'comment':_0xe856('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe856('0x0')]},'namedpickupgroup':{'type':Sequelize[_0xe856('0x0')]},'language':{'type':Sequelize[_0xe856('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe856('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe856('0x0')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe856('0x0')],'allowNull':![],'defaultValue':_0xe856('0x1a'),'set':function(_0x143752){this[_0xe856('0xd')]('allow',_0x143752?_0x143752[_0xe856('0xe')](';'):_0xe856('0x1a'));},'get':function(){return this['getDataValue'](_0xe856('0x1b'))?this['getDataValue'](_0xe856('0x1b'))[_0xe856('0x18')](';'):null;},'comment':_0xe856('0x1c')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xe856('0x0')],'defaultValue':_0xe856('0x1d'),'set':function(_0xa2a5cc){this[_0xe856('0xd')](_0xe856('0x1e'),_0xa2a5cc?_0xa2a5cc['join'](','):null);},'get':function(){return this['getDataValue'](_0xe856('0x1e'))?this[_0xe856('0xf')](_0xe856('0x1e'))[_0xe856('0x18')](','):null;},'comment':_0xe856('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0xe856('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xe856('0x16'),'no',_0xe856('0x20'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xe856('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xe856('0x21')](0xb)},'setvar':{'type':Sequelize[_0xe856('0x0')]},'callerid':{'type':Sequelize[_0xe856('0x0')],'defaultValue':_0xe856('0x22')},'amaflags':{'type':Sequelize[_0xe856('0x0')]},'callcounter':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no'),'defaultValue':_0xe856('0x16')},'busylevel':{'type':Sequelize[_0xe856('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xe856('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xe856('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xe856('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xe856('0x0')]},'template':{'type':Sequelize[_0xe856('0x0')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xe856('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe856('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xe856('0x0')]},'session_timers':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x24'),_0xe856('0x25'),_0xe856('0x26'))},'session_expires':{'type':Sequelize[_0xe856('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xe856('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x27'),_0xe856('0x28')),'defaultValue':_0xe856('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xe856('0x0')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe856('0x0')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe856('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xe856('0x0')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe856('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe856('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe856('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no',_0xe856('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe856('0x0')]},'callbackextension':{'type':Sequelize[_0xe856('0x0')]},'timert1':{'type':Sequelize[_0xe856('0x21')](0xb)},'timerb':{'type':Sequelize[_0xe856('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe856('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe856('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0xe856('0x0')]},'use_q850_reason':{'type':Sequelize[_0xe856('0x0')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xe856('0x16'),'no')},'icesupport':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xe856('0x2')]('yes','no',_0xe856('0x2a'),_0xe856('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xe856('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe856('0x0')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xe856('0x0')]},'dtlscafile':{'type':Sequelize[_0xe856('0x0')]},'dtlscapath':{'type':Sequelize[_0xe856('0x0')]},'dtlssetup':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x2c'),_0xe856('0x2d'),_0xe856('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe856('0x0')]},'recordofffeature':{'type':Sequelize[_0xe856('0x0')]},'call_limit':{'type':Sequelize[_0xe856('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe856('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xe856('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xe856('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe856('0x0')],'defaultValue':_0xe856('0x2f')},'canreinvite':{'type':Sequelize[_0xe856('0x2')](_0xe856('0x16'),'no',_0xe856('0x15'),_0xe856('0x30'),_0xe856('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe856('0x0')]},'otherFields':{'type':Sequelize[_0xe856('0x0')]},'active':{'type':Sequelize[_0xe856('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe856('0x0')],'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 faa3448..73942b7 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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x39f9e8,_0x4edccf){var _0x2d37f6=function(_0x533cca){while(--_0x533cca){_0x39f9e8['push'](_0x39f9e8['shift']());}};_0x2d37f6(++_0x4edccf);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2ec648,_0x296ecb){_0x2ec648=_0x2ec648-0x0;var _0x42ea6f=_0x8d0e[_0x2ec648];return _0x42ea6f;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file +var _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','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'];(function(_0x33d431,_0xf591fb){var _0xad1bc8=function(_0x3c0b5a){while(--_0x3c0b5a){_0x33d431['push'](_0x33d431['shift']());}};_0xad1bc8(++_0xf591fb);}(_0x84ab,0x12f));var _0xb84a=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x84ab[_0x57b432];return _0x2edf2a;};'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'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5b8feab..ddb79d9 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 _0xc667=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x7f55fb,_0x443206){var _0x101e63=function(_0x492555){while(--_0x492555){_0x7f55fb['push'](_0x7f55fb['shift']());}};_0x101e63(++_0x443206);}(_0xc667,0x8a));var _0x7c66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc667[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7c66('0x0'));var util=require(_0x7c66('0x1'));var logger=require(_0x7c66('0x2'))(_0x7c66('0x3'));var moment=require(_0x7c66('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c66('0x5'));var config=require(_0x7c66('0x6'));var attributes=require(_0x7c66('0x7'));module[_0x7c66('0x8')]=function(_0x220f83,_0x492d6f){return _0x220f83[_0x7c66('0x9')](_0x7c66('0xa'),attributes,{'tableName':_0x7c66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8b=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x4b8b,0xbe));var _0xb4b8=function(_0x553621,_0x18ff21){_0x553621=_0x553621-0x0;var _0x30d42f=_0x4b8b[_0x553621];return _0x30d42f;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var logger=require('../../config/logger')(_0xb4b8('0x2'));var moment=require(_0xb4b8('0x3'));var BPromise=require(_0xb4b8('0x4'));var rp=require(_0xb4b8('0x5'));var fs=require('fs');var path=require(_0xb4b8('0x6'));var rimraf=require(_0xb4b8('0x7'));var config=require(_0xb4b8('0x8'));var attributes=require(_0xb4b8('0x9'));module[_0xb4b8('0xa')]=function(_0x56731c,_0xb6eaf6){return _0x56731c[_0xb4b8('0xb')](_0xb4b8('0xc'),attributes,{'tableName':_0xb4b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2efb72c..388675c 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 _0x9bfa=['request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','options','raw','where','limit','include','map','model','attributes','then','catch','Trunk','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x45495a,_0x353d64){var _0xf6fb7c=function(_0x499820){while(--_0x499820){_0x45495a['push'](_0x45495a['shift']());}};_0xf6fb7c(++_0x353d64);}(_0x9bfa,0x167));var _0xa9bf=function(_0x238c4f,_0x2ba8a5){_0x238c4f=_0x238c4f-0x0;var _0x180e30=_0x9bfa[_0x238c4f];return _0x180e30;};'use strict';var _=require(_0xa9bf('0x0'));var util=require(_0xa9bf('0x1'));var moment=require('moment');var BPromise=require(_0xa9bf('0x2'));var rs=require(_0xa9bf('0x3'));var fs=require('fs');var Redis=require(_0xa9bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9bf('0x5'));var logger=require(_0xa9bf('0x6'))(_0xa9bf('0x7'));var config=require(_0xa9bf('0x8'));var jayson=require(_0xa9bf('0x9'));var client=jayson[_0xa9bf('0xa')][_0xa9bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b61e1,_0x5b6b02,_0x41e8f5){return new BPromise(function(_0x21d8b9,_0x1256f9){return client[_0xa9bf('0xc')](_0x2b61e1,_0x41e8f5)['then'](function(_0x1df72d){logger[_0xa9bf('0xd')]('Trunk,\x20%s,\x20%s',_0x5b6b02,'request\x20sent');logger[_0xa9bf('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b6b02,_0xa9bf('0xf'),JSON[_0xa9bf('0x10')](_0x1df72d));if(_0x1df72d['error']){if(_0x1df72d[_0xa9bf('0x11')][_0xa9bf('0x12')]===0x1f4){logger[_0xa9bf('0x11')](_0xa9bf('0x13'),_0x5b6b02,_0x1df72d[_0xa9bf('0x11')][_0xa9bf('0x14')]);return _0x1256f9(_0x1df72d[_0xa9bf('0x11')][_0xa9bf('0x14')]);}logger[_0xa9bf('0x11')](_0xa9bf('0x13'),_0x5b6b02,_0x1df72d[_0xa9bf('0x11')][_0xa9bf('0x14')]);return _0x21d8b9(_0x1df72d['error']['message']);}else{logger['info'](_0xa9bf('0x13'),_0x5b6b02,_0xa9bf('0xf'));_0x21d8b9(_0x1df72d[_0xa9bf('0x15')][_0xa9bf('0x14')]);}})['catch'](function(_0x683da9){logger[_0xa9bf('0x11')](_0xa9bf('0x13'),_0x5b6b02,_0x683da9);_0x1256f9(_0x683da9);});});}exports[_0xa9bf('0x16')]=function(_0x29cc45){var _0x54447e=this;return new Promise(function(_0x236425,_0x9c2df){return db['Trunk']['findAll']({'raw':_0x29cc45[_0xa9bf('0x17')]?_0x29cc45[_0xa9bf('0x17')][_0xa9bf('0x18')]===undefined?!![]:![]:!![],'where':_0x29cc45[_0xa9bf('0x17')]?_0x29cc45[_0xa9bf('0x17')][_0xa9bf('0x19')]||null:null,'attributes':_0x29cc45[_0xa9bf('0x17')]?_0x29cc45[_0xa9bf('0x17')]['attributes']||null:null,'limit':_0x29cc45['options']?_0x29cc45[_0xa9bf('0x17')][_0xa9bf('0x1a')]||null:null,'include':_0x29cc45[_0xa9bf('0x17')]?_0x29cc45['options'][_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0x29cc45[_0xa9bf('0x17')][_0xa9bf('0x1b')],function(_0xc331ce){return{'model':db[_0xc331ce[_0xa9bf('0x1d')]],'as':_0xc331ce['as'],'attributes':_0xc331ce[_0xa9bf('0x1e')],'include':_0xc331ce[_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0xc331ce[_0xa9bf('0x1b')],function(_0x296cd6){return{'model':db[_0x296cd6[_0xa9bf('0x1d')]],'as':_0x296cd6['as'],'attributes':_0x296cd6['attributes'],'include':_0x296cd6[_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0x296cd6[_0xa9bf('0x1b')],function(_0x587576){return{'model':db[_0x587576[_0xa9bf('0x1d')]],'as':_0x587576['as'],'attributes':_0x587576[_0xa9bf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa9bf('0x1f')](function(_0x37b01d){logger['info'](_0xa9bf('0x16'),_0x29cc45);logger[_0xa9bf('0xe')](_0xa9bf('0x16'),_0x29cc45,JSON['stringify'](_0x37b01d));_0x236425(_0x37b01d);})[_0xa9bf('0x20')](function(_0x4a1ef8){logger['error'](_0xa9bf('0x16'),_0x4a1ef8[_0xa9bf('0x14')],_0x29cc45);_0x9c2df(_0x54447e[_0xa9bf('0x11')](0x1f4,_0x4a1ef8[_0xa9bf('0x14')]));});});};exports['ShowTrunk']=function(_0x3ab79b){var _0x2e6bf8=this;return new Promise(function(_0x230bd6,_0x2421cb){return db[_0xa9bf('0x21')]['find']({'raw':_0x3ab79b['options']?_0x3ab79b[_0xa9bf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3ab79b[_0xa9bf('0x17')]?_0x3ab79b[_0xa9bf('0x17')][_0xa9bf('0x19')]||null:null,'attributes':_0x3ab79b['options']?_0x3ab79b[_0xa9bf('0x17')][_0xa9bf('0x1e')]||null:null,'include':_0x3ab79b[_0xa9bf('0x17')]?_0x3ab79b[_0xa9bf('0x17')][_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0x3ab79b['options'][_0xa9bf('0x1b')],function(_0x564507){return{'model':db[_0x564507['model']],'as':_0x564507['as'],'attributes':_0x564507['attributes'],'include':_0x564507[_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0x564507['include'],function(_0x3916e4){return{'model':db[_0x3916e4[_0xa9bf('0x1d')]],'as':_0x3916e4['as'],'attributes':_0x3916e4[_0xa9bf('0x1e')],'include':_0x3916e4[_0xa9bf('0x1b')]?_[_0xa9bf('0x1c')](_0x3916e4[_0xa9bf('0x1b')],function(_0x381d0d){return{'model':db[_0x381d0d['model']],'as':_0x381d0d['as'],'attributes':_0x381d0d['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9bf('0x1f')](function(_0x2eb264){logger['info']('ShowTrunk',_0x3ab79b);logger[_0xa9bf('0xe')]('ShowTrunk',_0x3ab79b,JSON[_0xa9bf('0x10')](_0x2eb264));_0x230bd6(_0x2eb264);})[_0xa9bf('0x20')](function(_0x29fce4){logger[_0xa9bf('0x11')]('ShowTrunk',_0x29fce4[_0xa9bf('0x14')],_0x3ab79b);_0x2421cb(_0x2e6bf8[_0xa9bf('0x11')](0x1f4,_0x29fce4[_0xa9bf('0x14')]));});});}; \ No newline at end of file +var _0x5236=['GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','attributes','ShowTrunk','find','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x30b4a0,_0x244ba2){var _0x4d3e26=function(_0x310087){while(--_0x310087){_0x30b4a0['push'](_0x30b4a0['shift']());}};_0x4d3e26(++_0x244ba2);}(_0x5236,0x17f));var _0x6523=function(_0x5e1e65,_0x234dea){_0x5e1e65=_0x5e1e65-0x0;var _0x9fd826=_0x5236[_0x5e1e65];return _0x9fd826;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var moment=require('moment');var BPromise=require(_0x6523('0x2'));var rs=require(_0x6523('0x3'));var fs=require('fs');var Redis=require(_0x6523('0x4'));var db=require(_0x6523('0x5'))['db'];var utils=require(_0x6523('0x6'));var logger=require(_0x6523('0x7'))('rpc');var config=require(_0x6523('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6523('0x9')][_0x6523('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23eb53,_0x2e90c8,_0x35ac38){return new BPromise(function(_0x12a0a4,_0x4916b6){return client[_0x6523('0xb')](_0x23eb53,_0x35ac38)[_0x6523('0xc')](function(_0x431afe){logger[_0x6523('0xd')](_0x6523('0xe'),_0x2e90c8,_0x6523('0xf'));logger[_0x6523('0x10')](_0x6523('0x11'),_0x2e90c8,_0x6523('0xf'),JSON[_0x6523('0x12')](_0x431afe));if(_0x431afe['error']){if(_0x431afe[_0x6523('0x13')][_0x6523('0x14')]===0x1f4){logger[_0x6523('0x13')]('Trunk,\x20%s,\x20%s',_0x2e90c8,_0x431afe[_0x6523('0x13')][_0x6523('0x15')]);return _0x4916b6(_0x431afe[_0x6523('0x13')]['message']);}logger[_0x6523('0x13')](_0x6523('0xe'),_0x2e90c8,_0x431afe['error'][_0x6523('0x15')]);return _0x12a0a4(_0x431afe['error'][_0x6523('0x15')]);}else{logger['info'](_0x6523('0xe'),_0x2e90c8,_0x6523('0xf'));_0x12a0a4(_0x431afe[_0x6523('0x16')][_0x6523('0x15')]);}})[_0x6523('0x17')](function(_0x35287e){logger[_0x6523('0x13')](_0x6523('0xe'),_0x2e90c8,_0x35287e);_0x4916b6(_0x35287e);});});}exports[_0x6523('0x18')]=function(_0x247413){var _0x1a1829=this;return new Promise(function(_0x2f9b33,_0xaa294){return db[_0x6523('0x19')][_0x6523('0x1a')]({'raw':_0x247413['options']?_0x247413[_0x6523('0x1b')][_0x6523('0x1c')]===undefined?!![]:![]:!![],'where':_0x247413[_0x6523('0x1b')]?_0x247413[_0x6523('0x1b')][_0x6523('0x1d')]||null:null,'attributes':_0x247413[_0x6523('0x1b')]?_0x247413[_0x6523('0x1b')]['attributes']||null:null,'limit':_0x247413[_0x6523('0x1b')]?_0x247413[_0x6523('0x1b')][_0x6523('0x1e')]||null:null,'include':_0x247413[_0x6523('0x1b')]?_0x247413[_0x6523('0x1b')][_0x6523('0x1f')]?_['map'](_0x247413[_0x6523('0x1b')][_0x6523('0x1f')],function(_0x41b1bf){return{'model':db[_0x41b1bf[_0x6523('0x20')]],'as':_0x41b1bf['as'],'attributes':_0x41b1bf[_0x6523('0x21')],'include':_0x41b1bf[_0x6523('0x1f')]?_['map'](_0x41b1bf[_0x6523('0x1f')],function(_0x4ff8b4){return{'model':db[_0x4ff8b4[_0x6523('0x20')]],'as':_0x4ff8b4['as'],'attributes':_0x4ff8b4[_0x6523('0x21')],'include':_0x4ff8b4[_0x6523('0x1f')]?_['map'](_0x4ff8b4['include'],function(_0x12ced6){return{'model':db[_0x12ced6[_0x6523('0x20')]],'as':_0x12ced6['as'],'attributes':_0x12ced6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb77b){logger['info'](_0x6523('0x18'),_0x247413);logger[_0x6523('0x10')](_0x6523('0x18'),_0x247413,JSON[_0x6523('0x12')](_0x4eb77b));_0x2f9b33(_0x4eb77b);})[_0x6523('0x17')](function(_0x241c19){logger[_0x6523('0x13')](_0x6523('0x18'),_0x241c19[_0x6523('0x15')],_0x247413);_0xaa294(_0x1a1829[_0x6523('0x13')](0x1f4,_0x241c19[_0x6523('0x15')]));});});};exports[_0x6523('0x22')]=function(_0x3775ac){var _0x2b0ef4=this;return new Promise(function(_0x3989c2,_0x29ba5c){return db['Trunk'][_0x6523('0x23')]({'raw':_0x3775ac[_0x6523('0x1b')]?_0x3775ac[_0x6523('0x1b')][_0x6523('0x1c')]===undefined?!![]:![]:!![],'where':_0x3775ac[_0x6523('0x1b')]?_0x3775ac['options'][_0x6523('0x1d')]||null:null,'attributes':_0x3775ac[_0x6523('0x1b')]?_0x3775ac['options']['attributes']||null:null,'include':_0x3775ac['options']?_0x3775ac[_0x6523('0x1b')]['include']?_[_0x6523('0x24')](_0x3775ac[_0x6523('0x1b')]['include'],function(_0x4ca821){return{'model':db[_0x4ca821['model']],'as':_0x4ca821['as'],'attributes':_0x4ca821[_0x6523('0x21')],'include':_0x4ca821[_0x6523('0x1f')]?_[_0x6523('0x24')](_0x4ca821[_0x6523('0x1f')],function(_0x26d842){return{'model':db[_0x26d842[_0x6523('0x20')]],'as':_0x26d842['as'],'attributes':_0x26d842[_0x6523('0x21')],'include':_0x26d842[_0x6523('0x1f')]?_[_0x6523('0x24')](_0x26d842[_0x6523('0x1f')],function(_0x570521){return{'model':db[_0x570521[_0x6523('0x20')]],'as':_0x570521['as'],'attributes':_0x570521[_0x6523('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6523('0xc')](function(_0x5aaa83){logger[_0x6523('0xd')]('ShowTrunk',_0x3775ac);logger[_0x6523('0x10')](_0x6523('0x22'),_0x3775ac,JSON[_0x6523('0x12')](_0x5aaa83));_0x3989c2(_0x5aaa83);})['catch'](function(_0x23cc6b){logger[_0x6523('0x13')]('ShowTrunk',_0x23cc6b[_0x6523('0x15')],_0x3775ac);_0x29ba5c(_0x2b0ef4[_0x6523('0x13')](0x1f4,_0x23cc6b['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index af69072..3c34711 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 _0xb486=['isAuthenticated','update','express','Router','./user-setting.controller','put','/:id'];(function(_0x21a2da,_0x9f4c2b){var _0x3ff5da=function(_0x216564){while(--_0x216564){_0x21a2da['push'](_0x21a2da['shift']());}};_0x3ff5da(++_0x9f4c2b);}(_0xb486,0x72));var _0x6b48=function(_0x1140ca,_0x362693){_0x1140ca=_0x1140ca-0x0;var _0x544c5d=_0xb486[_0x1140ca];return _0x544c5d;};'use strict';var express=require(_0x6b48('0x0'));var router=express[_0x6b48('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6b48('0x2'));router[_0x6b48('0x3')](_0x6b48('0x4'),auth[_0x6b48('0x5')](),controller[_0x6b48('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4f57=['isAuthenticated','update','exports','express','./user-setting.controller','put','/:id'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4f57,0x1ae));var _0x74f5=function(_0x5a9cba,_0x4fe504){_0x5a9cba=_0x5a9cba-0x0;var _0x2e368f=_0x4f57[_0x5a9cba];return _0x2e368f;};'use strict';var express=require(_0x74f5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x74f5('0x1'));router[_0x74f5('0x2')](_0x74f5('0x3'),auth[_0x74f5('0x4')](),controller[_0x74f5('0x5')]);module[_0x74f5('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 8bd85cd..ea9a9e1 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 _0xde2c=['DATE','INTEGER','error','debug','ENUM','TEXT'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0xde2c,0xfe));var _0xcde2=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xde2c[_0x1c5950];return _0x2b720a;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xcde2('0x0'),'warning','info',_0xcde2('0x1')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xcde2('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcde2('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcde2('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcde2('0x5')],'unique':'UserId'}}; \ No newline at end of file +var _0xddc6=['debug','exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0x49d234,_0x1e7488){var _0xefbcb3=function(_0x46de6c){while(--_0x46de6c){_0x49d234['push'](_0x49d234['shift']());}};_0xefbcb3(++_0x1e7488);}(_0xddc6,0xac));var _0x6ddc=function(_0x32d1af,_0x403f60){_0x32d1af=_0x32d1af-0x0;var _0xcfa14f=_0xddc6[_0x32d1af];return _0xcfa14f;};'use strict';var Sequelize=require(_0x6ddc('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6ddc('0x1'),_0x6ddc('0x2'),'info',_0x6ddc('0x3')];module[_0x6ddc('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6ddc('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6ddc('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6ddc('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ 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 396c754..363ef67 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 _0x7ec2=['stack','name','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7ec2,0x15c));var _0x27ec=function(_0x465879,_0xb9c424){_0x465879=_0x465879-0x0;var _0xc61910=_0x7ec2[_0x465879];return _0xc61910;};'use strict';var _=require(_0x27ec('0x0'));var Redis=require(_0x27ec('0x1'));var logger=require(_0x27ec('0x2'))('api');var config=require(_0x27ec('0x3'));var db=require(_0x27ec('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x27ec('0x5')]));require(_0x27ec('0x6'))[_0x27ec('0x7')](socket);config[_0x27ec('0x5')]=_[_0x27ec('0x8')](config[_0x27ec('0x5')],{'host':_0x27ec('0x9'),'port':0x18eb});function respondWithResult(_0x280cdb,_0x27b57c){_0x27b57c=_0x27b57c||0xc8;return function(_0x1ad634){if(_0x1ad634){return _0x280cdb[_0x27ec('0xa')](_0x27b57c)[_0x27ec('0xb')](_0x1ad634);}};}function saveUpdates(_0x247954){return function(_0x10e587){if(_0x10e587){return _0x10e587[_0x27ec('0xc')](_0x247954)[_0x27ec('0xd')](function(_0x13c5dc){return _0x13c5dc;});}return null;};}function handleEntityNotFound(_0x19c2d8){return function(_0x37faa8){if(!_0x37faa8){_0x19c2d8[_0x27ec('0xe')](0x194);}return _0x37faa8;};}function handleError(_0x3df870,_0x56c2af){_0x56c2af=_0x56c2af||0x1f4;return function(_0x21952a){logger[_0x27ec('0xf')](_0x21952a[_0x27ec('0x10')]);if(_0x21952a[_0x27ec('0x11')]){delete _0x21952a['name'];}_0x3df870[_0x27ec('0xa')](_0x56c2af)['send'](_0x21952a);};}exports[_0x27ec('0xc')]=function(_0x436fc5,_0x161909){if(_0x436fc5[_0x27ec('0x12')][_0x27ec('0x13')]!==_0x27ec('0x14'))throw new Error(_0x27ec('0x15'));if(isNaN(Number(_0x436fc5['params']['id'])))throw new Error(_0x27ec('0x16'));return db[_0x27ec('0x17')]['find']({'where':{'id':_0x436fc5['params']['id']}})[_0x27ec('0xd')](handleEntityNotFound(_0x161909,null))['then'](saveUpdates(_0x436fc5[_0x27ec('0x18')],null))[_0x27ec('0xd')](respondWithResult(_0x161909,null))[_0x27ec('0x19')](handleError(_0x161909,null));}; \ No newline at end of file +var _0x938c=['stack','name','status','send','user','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','api','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','update','sendStatus'];(function(_0x5ab11b,_0x5b2c4f){var _0x5514e5=function(_0x11d002){while(--_0x11d002){_0x5ab11b['push'](_0x5ab11b['shift']());}};_0x5514e5(++_0x5b2c4f);}(_0x938c,0x11f));var _0xc938=function(_0x4db77e,_0x3b29f7){_0x4db77e=_0x4db77e-0x0;var _0x12a4e6=_0x938c[_0x4db77e];return _0x12a4e6;};'use strict';var _=require(_0xc938('0x0'));var Redis=require(_0xc938('0x1'));var logger=require('../../config/logger')(_0xc938('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xc938('0x3'))(new Redis(config['redis']));require(_0xc938('0x4'))[_0xc938('0x5')](socket);config[_0xc938('0x6')]=_[_0xc938('0x7')](config[_0xc938('0x6')],{'host':_0xc938('0x8'),'port':0x18eb});function respondWithResult(_0x5c08fe,_0x384ff3){_0x384ff3=_0x384ff3||0xc8;return function(_0x6e8871){if(_0x6e8871){return _0x5c08fe['status'](_0x384ff3)[_0xc938('0x9')](_0x6e8871);}};}function saveUpdates(_0x378ba5){return function(_0x50ea38){if(_0x50ea38){return _0x50ea38[_0xc938('0xa')](_0x378ba5)['then'](function(_0x5c4957){return _0x5c4957;});}return null;};}function handleEntityNotFound(_0x7a17e4){return function(_0x47788a){if(!_0x47788a){_0x7a17e4[_0xc938('0xb')](0x194);}return _0x47788a;};}function handleError(_0x59f3f5,_0x83f94b){_0x83f94b=_0x83f94b||0x1f4;return function(_0x3fc197){logger['error'](_0x3fc197[_0xc938('0xc')]);if(_0x3fc197['name']){delete _0x3fc197[_0xc938('0xd')];}_0x59f3f5[_0xc938('0xe')](_0x83f94b)[_0xc938('0xf')](_0x3fc197);};}exports['update']=function(_0x19f0d9,_0x2c8b0c){if(_0x19f0d9[_0xc938('0x10')]['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x19f0d9[_0xc938('0x11')]['id'])))throw new Error(_0xc938('0x12'));return db[_0xc938('0x13')]['find']({'where':{'id':_0x19f0d9[_0xc938('0x11')]['id']}})['then'](handleEntityNotFound(_0x2c8b0c,null))[_0xc938('0x14')](saveUpdates(_0x19f0d9[_0xc938('0x15')],null))['then'](respondWithResult(_0x2c8b0c,null))[_0xc938('0x16')](handleError(_0x2c8b0c,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 ccada5c..5cd8cc0 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 _0xd94a=['hasOwnProperty','../../mysqldb','UserSetting','update','remove','emit'];(function(_0x3b2955,_0x8c8483){var _0x481de2=function(_0x5897f0){while(--_0x5897f0){_0x3b2955['push'](_0x3b2955['shift']());}};_0x481de2(++_0x8c8483);}(_0xd94a,0xdf));var _0xad94=function(_0x2302f5,_0x195210){_0x2302f5=_0x2302f5-0x0;var _0x4b5477=_0xd94a[_0x2302f5];return _0x4b5477;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xad94('0x0'))['db'][_0xad94('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad94('0x2'),'afterDestroy':_0xad94('0x3')};function emitEvent(_0x35b0e6){return function(_0x5777cf,_0x39c545,_0x3f966e){UserSettingEvents[_0xad94('0x4')](_0x35b0e6+':'+_0x5777cf['id'],_0x5777cf);UserSettingEvents[_0xad94('0x4')](_0x35b0e6,_0x5777cf);_0x3f966e(null);};}for(var e in events){if(events[_0xad94('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xd1c4=['hook','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xd1c4,0x7f));var _0x4d1c=function(_0x258b1e,_0x52eaba){_0x258b1e=_0x258b1e-0x0;var _0x20ea2c=_0xd1c4[_0x258b1e];return _0x20ea2c;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x4d1c('0x0'))['db'][_0x4d1c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4d1c('0x2')](0x0);var events={'afterCreate':_0x4d1c('0x3'),'afterUpdate':_0x4d1c('0x4'),'afterDestroy':_0x4d1c('0x5')};function emitEvent(_0x438db0){return function(_0x2b9433,_0x3c3691,_0x8d58ed){UserSettingEvents[_0x4d1c('0x6')](_0x438db0+':'+_0x2b9433['id'],_0x2b9433);UserSettingEvents[_0x4d1c('0x6')](_0x438db0,_0x2b9433);_0x8d58ed(null);};}for(var e in events){if(events[_0x4d1c('0x7')](e)){var event=events[e];UserSetting[_0x4d1c('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 7e70929..932d4dd 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 _0x2cbd=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x29dfa5,_0xd3078e){var _0x41c15a=function(_0x10802b){while(--_0x10802b){_0x29dfa5['push'](_0x29dfa5['shift']());}};_0x41c15a(++_0xd3078e);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2cbd[_0x3054be];return _0x3df150;};'use strict';var attributes=require(_0xd2cb('0x0'));module[_0xd2cb('0x1')]=function(_0x5dbb01){return _0x5dbb01[_0xd2cb('0x2')](_0xd2cb('0x3'),attributes,{'tableName':_0xd2cb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b1b3f){if(!_0x4b1b3f[_0xd2cb('0x5')])_0x4b1b3f[_0xd2cb('0x6')]=null;else if(_0x4b1b3f['clientSideLoggingEnabledSince']===null)_0x4b1b3f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x6cb4=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x266eec,_0x56062c){var _0x42d2c0=function(_0x387af4){while(--_0x387af4){_0x266eec['push'](_0x266eec['shift']());}};_0x42d2c0(++_0x56062c);}(_0x6cb4,0xff));var _0x46cb=function(_0x72c753,_0x19ac2e){_0x72c753=_0x72c753-0x0;var _0x5c6cf6=_0x6cb4[_0x72c753];return _0x5c6cf6;};'use strict';var attributes=require(_0x46cb('0x0'));module[_0x46cb('0x1')]=function(_0x205a8d){return _0x205a8d[_0x46cb('0x2')](_0x46cb('0x3'),attributes,{'tableName':_0x46cb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b8d70){if(!_0x2b8d70[_0x46cb('0x5')])_0x2b8d70[_0x46cb('0x6')]=null;else if(_0x2b8d70['clientSideLoggingEnabledSince']===null)_0x2b8d70[_0x46cb('0x6')]=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 f081a20..74d3f06 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 _0xbb1a=['register','length','user-setting:','./user-setting.events','remove','emit','user-setting:update:user-','UserId'];(function(_0x413c76,_0x140b4d){var _0x54e6cc=function(_0xa77a4c){while(--_0xa77a4c){_0x413c76['push'](_0x413c76['shift']());}};_0x54e6cc(++_0x140b4d);}(_0xbb1a,0x143));var _0xabb1=function(_0x2c3964,_0xd7070a){_0x2c3964=_0x2c3964-0x0;var _0x32ef29=_0xbb1a[_0x2c3964];return _0x32ef29;};'use strict';var UserSettingEvents=require(_0xabb1('0x0'));var events=['save',_0xabb1('0x1'),'update'];function createListener(_0x1aa9ac,_0x39e641){return function(_0x244d9c){_0x39e641['emit'](_0x1aa9ac,_0x244d9c);if(_0x1aa9ac==='user-setting:update'){_0x39e641[_0xabb1('0x2')](_0xabb1('0x3')+_0x244d9c[_0xabb1('0x4')],_0x244d9c);}};}exports[_0xabb1('0x5')]=function(_0x168a83){for(var _0x4e00e6=0x0,_0x30ea98=events[_0xabb1('0x6')];_0x4e00e6<_0x30ea98;_0x4e00e6++){var _0xcf8a46=events[_0x4e00e6];var _0x3d3ef4=createListener(_0xabb1('0x7')+_0xcf8a46,_0x168a83);UserSettingEvents['on'](_0xcf8a46,_0x3d3ef4);}}; \ No newline at end of file +var _0x4ed1=['user-setting:update','user-setting:update:user-','UserId','length','./user-setting.events','save','remove','emit'];(function(_0x389374,_0x15a375){var _0x537b8a=function(_0x2d303a){while(--_0x2d303a){_0x389374['push'](_0x389374['shift']());}};_0x537b8a(++_0x15a375);}(_0x4ed1,0xb4));var _0x14ed=function(_0x40ab2b,_0x16c45c){_0x40ab2b=_0x40ab2b-0x0;var _0x27627f=_0x4ed1[_0x40ab2b];return _0x27627f;};'use strict';var UserSettingEvents=require(_0x14ed('0x0'));var events=[_0x14ed('0x1'),_0x14ed('0x2'),'update'];function createListener(_0x156357,_0x39e529){return function(_0xc67bf7){_0x39e529[_0x14ed('0x3')](_0x156357,_0xc67bf7);if(_0x156357===_0x14ed('0x4')){_0x39e529[_0x14ed('0x3')](_0x14ed('0x5')+_0xc67bf7[_0x14ed('0x6')],_0xc67bf7);}};}exports['register']=function(_0x87a577){for(var _0x14045d=0x0,_0x224d0e=events[_0x14ed('0x7')];_0x14045d<_0x224d0e;_0x14045d++){var _0x15d819=events[_0x14045d];var _0x438fde=createListener('user-setting:'+_0x15d819,_0x87a577);UserSettingEvents['on'](_0x15d819,_0x438fde);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 79a3906..5a37163 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 _0xdfe2=['getGroups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','now','originalname','addAvatar','/:id/login','login','logout','/:id/pause','unpause','/:id/teams','addTeams','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','put','update','/:id/password','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','getVoiceQueuesRt'];(function(_0x59f670,_0x2a34aa){var _0x4ad264=function(_0x4a8709){while(--_0x4a8709){_0x59f670['push'](_0x59f670['shift']());}};_0x4ad264(++_0x2a34aa);}(_0xdfe2,0x1b1));var _0x2dfe=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xdfe2[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x2dfe('0x0'));var util=require(_0x2dfe('0x1'));var path=require(_0x2dfe('0x2'));var timeout=require(_0x2dfe('0x3'));var express=require(_0x2dfe('0x4'));var router=express[_0x2dfe('0x5')]();var fs_extra=require(_0x2dfe('0x6'));var auth=require(_0x2dfe('0x7'));var interaction=require(_0x2dfe('0x8'));var config=require(_0x2dfe('0x9'));var controller=require(_0x2dfe('0xa'));router[_0x2dfe('0xb')]('/',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0xd')]);router[_0x2dfe('0xb')](_0x2dfe('0xe'),auth['isAuthenticated'](),controller[_0x2dfe('0xf')]);router['get'](_0x2dfe('0x10'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x11')]);router[_0x2dfe('0xb')](_0x2dfe('0x12'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x13')]);router[_0x2dfe('0xb')](_0x2dfe('0x14'),auth[_0x2dfe('0xc')](),controller['show']);router[_0x2dfe('0xb')](_0x2dfe('0x15'),controller[_0x2dfe('0x16')]);router[_0x2dfe('0xb')](_0x2dfe('0x17'),auth[_0x2dfe('0xc')](),controller['getOpenTabs']);router[_0x2dfe('0xb')](_0x2dfe('0x18'),auth['isAuthenticated'](),controller[_0x2dfe('0x19')]);router['get']('/:id/queues',auth[_0x2dfe('0xc')](),controller['getQueues']);router[_0x2dfe('0xb')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x2dfe('0x1a')]);router[_0x2dfe('0xb')]('/:id/groups',auth['isAuthenticated'](),controller[_0x2dfe('0x1b')]);router['get'](_0x2dfe('0x1c'),auth[_0x2dfe('0xc')](),controller['getRecordings']);router[_0x2dfe('0xb')]('/:id/screen_recordings',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x1d')]);router[_0x2dfe('0xb')](_0x2dfe('0x1e'),auth['isAuthenticated'](),controller[_0x2dfe('0x1f')]);router['get'](_0x2dfe('0x20'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x2dfe('0xb')](_0x2dfe('0x21'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x22')]);router[_0x2dfe('0xb')]('/:id/sms/interactions',auth[_0x2dfe('0xc')](),controller['getSmsInteractions']);router[_0x2dfe('0xb')](_0x2dfe('0x23'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x24')]);router[_0x2dfe('0xb')]('/:id/whatsapp/interactions',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x25')]);router['get']('/:id/teams',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x26')]);router['get'](_0x2dfe('0x27'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x28')]);router[_0x2dfe('0xb')](_0x2dfe('0x29'),auth['isAuthenticated'](),controller[_0x2dfe('0x2a')]);router[_0x2dfe('0xb')]('/:id/prefixes',auth[_0x2dfe('0xc')](),controller['getVoicePrefixes']);router[_0x2dfe('0xb')](_0x2dfe('0x2b'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x2c')]);router[_0x2dfe('0xb')](_0x2dfe('0x2d'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x2e')]);router[_0x2dfe('0xb')](_0x2dfe('0x2f'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x30')]);router[_0x2dfe('0xb')](_0x2dfe('0x31'),auth['isAuthenticated'](),controller[_0x2dfe('0x32')]);router[_0x2dfe('0xb')](_0x2dfe('0x33'),auth['isAuthenticated'](),controller[_0x2dfe('0x34')]);router[_0x2dfe('0xb')](_0x2dfe('0x35'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x36')]);router[_0x2dfe('0xb')](_0x2dfe('0x37'),auth['isAuthenticated'](),controller[_0x2dfe('0x38')]);router[_0x2dfe('0xb')](_0x2dfe('0x39'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x3a')]);router[_0x2dfe('0x3b')](_0x2dfe('0x18'),auth['isAuthenticated'](),controller[_0x2dfe('0x3c')]);router[_0x2dfe('0x3b')]('/',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x3d')]);router[_0x2dfe('0x3b')](_0x2dfe('0x3e'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x3f')]);router[_0x2dfe('0x3b')]('/:id/queues',auth[_0x2dfe('0xc')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2dfe('0x40')]({'destination':function(_0xc548ed,_0x12b9d5,_0x12c5a5){_0x12c5a5(null,path['join'](config[_0x2dfe('0x41')],_0x2dfe('0x42')));},'filename':function(_0x1940de,_0xc3763b,_0x4c6f4b){_0x4c6f4b(null,util['format']('%s-%s',Date[_0x2dfe('0x43')](),_0xc3763b[_0x2dfe('0x44')]));}})});router[_0x2dfe('0x3b')]('/:id/avatar',upload['single']('file'),controller[_0x2dfe('0x45')]);router[_0x2dfe('0x3b')](_0x2dfe('0x46'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x47')]);router[_0x2dfe('0x3b')]('/:id/logout',auth['isAuthenticated'](),controller[_0x2dfe('0x48')]);router[_0x2dfe('0x3b')](_0x2dfe('0x49'),auth[_0x2dfe('0xc')](),controller['pause']);router['post']('/:id/unpause',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x4a')]);router[_0x2dfe('0x3b')](_0x2dfe('0x4b'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x4c')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x2dfe('0x4d'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x4e')]);router[_0x2dfe('0x3b')]('/:id/fax_interactions',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x4f')]);router['post'](_0x2dfe('0x50'),auth['isAuthenticated'](),controller[_0x2dfe('0x51')]);router[_0x2dfe('0x3b')]('/:id/openchannel_interactions',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x52')]);router[_0x2dfe('0x3b')](_0x2dfe('0x53'),auth[_0x2dfe('0xc')](),controller['addWhatsappInteractions']);router[_0x2dfe('0x3b')](_0x2dfe('0x2b'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x54')]);router['post'](_0x2dfe('0x2d'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x55')]);router['post']('/:id/openchannel_accounts',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x56')]);router[_0x2dfe('0x3b')]('/:id/sms_accounts',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x57')]);router[_0x2dfe('0x3b')]('/:id/chat_websites',auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x58')]);router[_0x2dfe('0x3b')](_0x2dfe('0x35'),auth[_0x2dfe('0xc')](),controller['addWhatsappAccounts']);router[_0x2dfe('0x3b')](_0x2dfe('0x39'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x2dfe('0x59')](_0x2dfe('0x14'),auth['isAuthenticated'](),controller[_0x2dfe('0x5a')]);router['put'](_0x2dfe('0x5b'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x5c')]);router[_0x2dfe('0x5d')](_0x2dfe('0x5e'),auth['isAuthenticated'](),controller[_0x2dfe('0x5f')]);router[_0x2dfe('0x5d')](_0x2dfe('0x4b'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x60')]);router[_0x2dfe('0x5d')](_0x2dfe('0x14'),auth['isAuthenticated'](),controller[_0x2dfe('0x61')]);router[_0x2dfe('0x5d')](_0x2dfe('0x62'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x63')]);router[_0x2dfe('0x5d')](_0x2dfe('0x4d'),auth['isAuthenticated'](),controller[_0x2dfe('0x64')]);router[_0x2dfe('0x5d')](_0x2dfe('0x65'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x66')]);router[_0x2dfe('0x5d')](_0x2dfe('0x50'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x67')]);router[_0x2dfe('0x5d')](_0x2dfe('0x68'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x69')]);router[_0x2dfe('0x5d')](_0x2dfe('0x53'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x6a')]);router[_0x2dfe('0x5d')](_0x2dfe('0x2b'),auth['isAuthenticated'](),controller[_0x2dfe('0x6b')]);router[_0x2dfe('0x5d')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x2dfe('0x6c')]);router['delete']('/:id/openchannel_accounts',auth[_0x2dfe('0xc')](),controller['removeOpenchannelAccounts']);router['delete'](_0x2dfe('0x31'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x6d')]);router[_0x2dfe('0x5d')](_0x2dfe('0x33'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x6e')]);router[_0x2dfe('0x5d')](_0x2dfe('0x35'),auth['isAuthenticated'](),controller[_0x2dfe('0x6f')]);router[_0x2dfe('0x5d')](_0x2dfe('0x39'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x70')]);router['post'](_0x2dfe('0x71'),auth[_0x2dfe('0xc')](),controller[_0x2dfe('0x72')]);module['exports']=router; \ No newline at end of file +var _0x214e=['/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','/describe','describe','/whoami','whoami','get','/presence','getPresence','/:id','isAuthenticated','/:id/avatar'];(function(_0x246cf4,_0x306858){var _0x2ac646=function(_0x482888){while(--_0x482888){_0x246cf4['push'](_0x246cf4['shift']());}};_0x2ac646(++_0x306858);}(_0x214e,0xda));var _0xe214=function(_0x41e17e,_0x6a4cf9){_0x41e17e=_0x41e17e-0x0;var _0x5e3cde=_0x214e[_0x41e17e];return _0x5e3cde;};'use strict';var multer=require(_0xe214('0x0'));var util=require(_0xe214('0x1'));var path=require(_0xe214('0x2'));var timeout=require(_0xe214('0x3'));var express=require(_0xe214('0x4'));var router=express[_0xe214('0x5')]();var fs_extra=require(_0xe214('0x6'));var auth=require(_0xe214('0x7'));var interaction=require(_0xe214('0x8'));var config=require(_0xe214('0x9'));var controller=require(_0xe214('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xe214('0xb')]);router['get'](_0xe214('0xc'),auth['isAuthenticated'](),controller[_0xe214('0xd')]);router['get'](_0xe214('0xe'),auth['isAuthenticated'](),controller[_0xe214('0xf')]);router[_0xe214('0x10')](_0xe214('0x11'),auth['isAuthenticated'](),controller[_0xe214('0x12')]);router[_0xe214('0x10')](_0xe214('0x13'),auth[_0xe214('0x14')](),controller['show']);router['get'](_0xe214('0x15'),controller['getAvatar']);router[_0xe214('0x10')](_0xe214('0x16'),auth[_0xe214('0x14')](),controller[_0xe214('0x17')]);router[_0xe214('0x10')](_0xe214('0x18'),auth[_0xe214('0x14')](),controller[_0xe214('0x19')]);router[_0xe214('0x10')](_0xe214('0x1a'),auth['isAuthenticated'](),controller[_0xe214('0x1b')]);router[_0xe214('0x10')](_0xe214('0x1c'),auth[_0xe214('0x14')](),controller[_0xe214('0x1d')]);router[_0xe214('0x10')]('/:id/groups',auth[_0xe214('0x14')](),controller[_0xe214('0x1e')]);router[_0xe214('0x10')]('/:id/recordings',auth[_0xe214('0x14')](),controller['getRecordings']);router[_0xe214('0x10')]('/:id/screen_recordings',auth[_0xe214('0x14')](),controller[_0xe214('0x1f')]);router['get'](_0xe214('0x20'),auth['isAuthenticated'](),controller[_0xe214('0x21')]);router[_0xe214('0x10')](_0xe214('0x22'),auth[_0xe214('0x14')](),controller[_0xe214('0x23')]);router[_0xe214('0x10')](_0xe214('0x24'),auth[_0xe214('0x14')](),controller[_0xe214('0x25')]);router[_0xe214('0x10')]('/:id/sms/interactions',auth[_0xe214('0x14')](),controller[_0xe214('0x26')]);router[_0xe214('0x10')]('/:id/fax/interactions',auth[_0xe214('0x14')](),controller[_0xe214('0x27')]);router[_0xe214('0x10')]('/:id/whatsapp/interactions',auth[_0xe214('0x14')](),controller[_0xe214('0x28')]);router[_0xe214('0x10')](_0xe214('0x29'),auth[_0xe214('0x14')](),controller['getTeams']);router['get'](_0xe214('0x2a'),auth[_0xe214('0x14')](),controller[_0xe214('0x2b')]);router[_0xe214('0x10')](_0xe214('0x2c'),auth[_0xe214('0x14')](),controller[_0xe214('0x2d')]);router[_0xe214('0x10')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xe214('0x2e')]);router[_0xe214('0x10')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe214('0x2f')]);router[_0xe214('0x10')](_0xe214('0x30'),auth[_0xe214('0x14')](),controller[_0xe214('0x31')]);router[_0xe214('0x10')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe214('0x32')]);router[_0xe214('0x10')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xe214('0x33')]);router[_0xe214('0x10')](_0xe214('0x34'),auth[_0xe214('0x14')](),controller[_0xe214('0x35')]);router[_0xe214('0x10')](_0xe214('0x36'),auth[_0xe214('0x14')](),controller[_0xe214('0x37')]);router[_0xe214('0x10')](_0xe214('0x38'),auth[_0xe214('0x14')](),controller[_0xe214('0x39')]);router[_0xe214('0x10')]('/:id/api_key',auth[_0xe214('0x14')](),controller[_0xe214('0x3a')]);router[_0xe214('0x3b')](_0xe214('0x18'),auth[_0xe214('0x14')](),controller[_0xe214('0x3c')]);router['post']('/',auth[_0xe214('0x14')](),controller[_0xe214('0x3d')]);router['post'](_0xe214('0x3e'),auth[_0xe214('0x14')](),controller[_0xe214('0x3f')]);router[_0xe214('0x3b')](_0xe214('0x1a'),auth[_0xe214('0x14')](),controller[_0xe214('0x40')]);var upload=multer({'storage':multer[_0xe214('0x41')]({'destination':function(_0x52c2bf,_0x4ad9e7,_0x5aa8dd){_0x5aa8dd(null,path[_0xe214('0x42')](config['root'],_0xe214('0x43')));},'filename':function(_0x54ee9a,_0x96e011,_0x281c6a){_0x281c6a(null,util[_0xe214('0x44')](_0xe214('0x45'),Date[_0xe214('0x46')](),_0x96e011[_0xe214('0x47')]));}})});router[_0xe214('0x3b')](_0xe214('0x15'),upload[_0xe214('0x48')](_0xe214('0x49')),controller[_0xe214('0x4a')]);router[_0xe214('0x3b')]('/:id/login',auth[_0xe214('0x14')](),controller['login']);router[_0xe214('0x3b')]('/:id/logout',auth[_0xe214('0x14')](),controller[_0xe214('0x4b')]);router['post'](_0xe214('0x4c'),auth[_0xe214('0x14')](),controller[_0xe214('0x4d')]);router[_0xe214('0x3b')](_0xe214('0x4e'),auth[_0xe214('0x14')](),controller[_0xe214('0x4f')]);router['post'](_0xe214('0x29'),auth[_0xe214('0x14')](),controller['addTeams']);router[_0xe214('0x3b')](_0xe214('0x50'),auth[_0xe214('0x14')](),controller[_0xe214('0x51')]);router[_0xe214('0x3b')](_0xe214('0x52'),auth[_0xe214('0x14')](),controller[_0xe214('0x53')]);router['post'](_0xe214('0x54'),auth[_0xe214('0x14')](),controller[_0xe214('0x55')]);router[_0xe214('0x3b')](_0xe214('0x56'),auth['isAuthenticated'](),controller[_0xe214('0x57')]);router[_0xe214('0x3b')](_0xe214('0x58'),auth['isAuthenticated'](),controller[_0xe214('0x59')]);router[_0xe214('0x3b')](_0xe214('0x5a'),auth[_0xe214('0x14')](),controller[_0xe214('0x5b')]);router['post'](_0xe214('0x5c'),auth[_0xe214('0x14')](),controller['addFaxAccounts']);router[_0xe214('0x3b')](_0xe214('0x30'),auth[_0xe214('0x14')](),controller[_0xe214('0x5d')]);router[_0xe214('0x3b')]('/:id/openchannel_accounts',auth[_0xe214('0x14')](),controller[_0xe214('0x5e')]);router['post'](_0xe214('0x5f'),auth[_0xe214('0x14')](),controller[_0xe214('0x60')]);router['post'](_0xe214('0x34'),auth['isAuthenticated'](),controller[_0xe214('0x61')]);router[_0xe214('0x3b')]('/:id/whatsapp_accounts',auth[_0xe214('0x14')](),controller[_0xe214('0x62')]);router[_0xe214('0x3b')](_0xe214('0x63'),auth['isAuthenticated'](),controller[_0xe214('0x64')]);router[_0xe214('0x65')](_0xe214('0x13'),auth[_0xe214('0x14')](),controller[_0xe214('0x66')]);router[_0xe214('0x65')](_0xe214('0x67'),auth[_0xe214('0x14')](),controller['changePassword']);router[_0xe214('0x68')](_0xe214('0x1a'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xe214('0x68')](_0xe214('0x29'),auth[_0xe214('0x14')](),controller[_0xe214('0x69')]);router[_0xe214('0x68')]('/:id',auth[_0xe214('0x14')](),controller['destroy']);router[_0xe214('0x68')](_0xe214('0x50'),auth['isAuthenticated'](),controller[_0xe214('0x6a')]);router[_0xe214('0x68')]('/:id/mail_interactions',auth[_0xe214('0x14')](),controller[_0xe214('0x6b')]);router[_0xe214('0x68')]('/:id/fax_interactions',auth[_0xe214('0x14')](),controller['removeFaxInteractions']);router[_0xe214('0x68')](_0xe214('0x56'),auth[_0xe214('0x14')](),controller[_0xe214('0x6c')]);router[_0xe214('0x68')]('/:id/openchannel_interactions',auth[_0xe214('0x14')](),controller[_0xe214('0x6d')]);router[_0xe214('0x68')](_0xe214('0x5a'),auth[_0xe214('0x14')](),controller['removeWhatsappInteractions']);router[_0xe214('0x68')]('/:id/fax_accounts',auth[_0xe214('0x14')](),controller[_0xe214('0x6e')]);router['delete'](_0xe214('0x30'),auth[_0xe214('0x14')](),controller[_0xe214('0x6f')]);router[_0xe214('0x68')](_0xe214('0x70'),auth[_0xe214('0x14')](),controller[_0xe214('0x71')]);router[_0xe214('0x68')](_0xe214('0x5f'),auth[_0xe214('0x14')](),controller[_0xe214('0x72')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe214('0x73')]);router[_0xe214('0x68')]('/:id/whatsapp_accounts',auth[_0xe214('0x14')](),controller['removeWhatsappAccounts']);router[_0xe214('0x68')](_0xe214('0x63'),auth[_0xe214('0x14')](),controller[_0xe214('0x74')]);router[_0xe214('0x3b')](_0xe214('0x75'),auth[_0xe214('0x14')](),controller[_0xe214('0x76')]);module[_0xe214('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0c462b9..7fff7da 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 _0xc961=['force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','nonat','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf'];(function(_0x66d46a,_0x304ea8){var _0x181123=function(_0x278f13){while(--_0x278f13){_0x66d46a['push'](_0x66d46a['shift']());}};_0x181123(++_0x304ea8);}(_0xc961,0x196));var _0x1c96=function(_0x820bf2,_0x5c6e3a){_0x820bf2=_0x820bf2-0x0;var _0x2962c1=_0xc961[_0x820bf2];return _0x2962c1;};'use strict';var Sequelize=require(_0x1c96('0x0'));var moment=require(_0x1c96('0x1'));var util=require(_0x1c96('0x2'));var _=require(_0x1c96('0x3'));module[_0x1c96('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x211dfa){this['setDataValue']('name',_0x211dfa);this[_0x1c96('0x5')](_0x1c96('0x6'),_0x211dfa);},'comment':_0x1c96('0x7')},'fullname':{'type':Sequelize[_0x1c96('0x8')],'allowNull':![],'set':function(_0x1d7655){this['setDataValue'](_0x1c96('0x9'),_0x1d7655);this[_0x1c96('0x5')](_0x1c96('0xa'),util[_0x1c96('0xb')](_0x1c96('0xc'),_0x1d7655,this[_0x1c96('0xd')](_0x1c96('0xe'))));}},'alias':{'type':Sequelize[_0x1c96('0x8')]},'email':{'type':Sequelize[_0x1c96('0x8')],'allowNull':![],'unique':_0x1c96('0xf'),'validate':{'isEmail':!![]},'set':function(_0x20cd5b){if(_0x20cd5b){this[_0x1c96('0x5')](_0x1c96('0xf'),_0x20cd5b[_0x1c96('0x10')]());}}},'role':{'type':Sequelize[_0x1c96('0x11')]('admin',_0x1c96('0x12'),_0x1c96('0x13'),_0x1c96('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x1c96('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1c96('0x8')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':![],'unique':_0x1c96('0xe'),'set':function(_0x224e8f){this['setDataValue'](_0x1c96('0xe'),_0x224e8f);this[_0x1c96('0x5')](_0x1c96('0x16'),_0x224e8f);this['setDataValue']('callerid',util['format'](_0x1c96('0xc'),this[_0x1c96('0xd')](_0x1c96('0x9')),_0x224e8f));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1c96('0x8')]},'mobile':{'type':Sequelize[_0x1c96('0x8')]},'address':{'type':Sequelize[_0x1c96('0x8')]},'zipcode':{'type':Sequelize[_0x1c96('0x8')]},'userpic':{'type':Sequelize[_0x1c96('0x8')]},'city':{'type':Sequelize[_0x1c96('0x8')]},'country':{'type':Sequelize[_0x1c96('0x8')]},'online':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1c96('0x18')]},'voicePause':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1c96('0x8')],'defaultValue':_0x1c96('0x19')},'lastPauseAt':{'type':Sequelize[_0x1c96('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1c96('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![],'defaultValue':_0x1c96('0x1a')},'ipaddr':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0x1c96('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x1b'),_0x1c96('0x12'),_0x1c96('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![],'defaultValue':_0x1c96('0x1d')},'callingpres':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x1e'),_0x1c96('0x1f'),_0x1c96('0x20'),_0x1c96('0x21'),_0x1c96('0x22'),_0x1c96('0x23'),_0x1c96('0x24'),_0x1c96('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1c96('0x26'),'set':function(_0x3fd83c){this[_0x1c96('0x5')](_0x1c96('0x27'),_0x3fd83c?_0x3fd83c[_0x1c96('0x28')](','):null);},'get':function(){return this[_0x1c96('0xd')](_0x1c96('0x27'))?this['getDataValue'](_0x1c96('0x27'))[_0x1c96('0x29')](','):null;},'comment':_0x1c96('0x2a')},'dtmfmode':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x2b'),'info',_0x1c96('0x2c'),_0x1c96('0x2d'),_0x1c96('0x2e')),'allowNull':!![],'defaultValue':_0x1c96('0x2b')},'directmedia':{'type':Sequelize[_0x1c96('0x11')]('yes','no','nonat',_0x1c96('0x2f'),_0x1c96('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![],'defaultValue':_0x1c96('0x32'),'set':function(_0x379fd3){this[_0x1c96('0x5')]('nat',_0x379fd3?_0x379fd3[_0x1c96('0x28')](','):null);},'get':function(){return this[_0x1c96('0xd')]('nat')?this['getDataValue'](_0x1c96('0x33'))['split'](','):null;},'comment':_0x1c96('0x34')},'callgroup':{'type':Sequelize[_0x1c96('0x8')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c96('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1c96('0x8')]},'disallow':{'type':Sequelize[_0x1c96('0x8')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c96('0x35'),'set':function(_0x48c11e){this['setDataValue'](_0x1c96('0x36'),_0x48c11e?_0x48c11e[_0x1c96('0x28')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1c96('0xd')](_0x1c96('0x36'))?this[_0x1c96('0xd')](_0x1c96('0x36'))[_0x1c96('0x29')](';'):null;},'comment':_0x1c96('0x37')},'autoframing':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![],'set':function(_0x69284d){this['setDataValue']('insecure',_0x69284d?_0x69284d[_0x1c96('0x28')](','):null);},'get':function(){return this[_0x1c96('0xd')](_0x1c96('0x38'))?this[_0x1c96('0xd')](_0x1c96('0x38'))['split'](','):null;},'comment':_0x1c96('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1c96('0x11')]('yes','no',_0x1c96('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1c96('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![],'defaultValue':_0x1c96('0x3b')},'amaflags':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':_0x1c96('0x31')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1c96('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no',_0x1c96('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x3d'),_0x1c96('0x3e'),_0x1c96('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x40'),'uas'),'allowNull':!![],'defaultValue':_0x1c96('0x41')},'t38pt_usertpsource':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':_0x1c96('0x31')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x1c96('0x31'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1c96('0x11')]('yes','no',_0x1c96('0x42'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x43'),_0x1c96('0x44'),_0x1c96('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1c96('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1c96('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1c96('0x11')]('yes','no',_0x1c96('0x46'),_0x1c96('0x2f'),_0x1c96('0x47')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1c96('0x48')]},'showWebBar':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0,'set':function(_0x52a875){this[_0x1c96('0x5')](_0x1c96('0x49'),_0x52a875);var _0x3e8429=this[_0x1c96('0x4a')]({'plain':!![]});switch(_0x52a875){case 0x0:case 0x1:var _0x12f167=_0x3e8429[_0x1c96('0x27')]?_[_0x1c96('0x4b')](_0x3e8429['transport'])?_0x3e8429['transport'][_0x1c96('0x28')]():_0x3e8429[_0x1c96('0x27')]:_0x1c96('0x26');if(_0x12f167===_0x1c96('0x4c')){_0x12f167=_0x1c96('0x26');}this[_0x1c96('0x5')](_0x1c96('0x27'),_0x12f167);this[_0x1c96('0x5')](_0x1c96('0x4d'),'no');this[_0x1c96('0x5')](_0x1c96('0x4e'),null);this['setDataValue'](_0x1c96('0x4f'),null);this[_0x1c96('0x5')](_0x1c96('0x50'),null);this[_0x1c96('0x5')](_0x1c96('0x51'),null);this[_0x1c96('0x5')](_0x1c96('0x52'),null);this[_0x1c96('0x5')]('dtlssetup',null);this[_0x1c96('0x5')](_0x1c96('0x53'),null);this['setDataValue'](_0x1c96('0x54'),null);this[_0x1c96('0x5')](_0x1c96('0x55'),'no');break;case 0x2:this['setDataValue']('transport',_0x1c96('0x4c'));this['setDataValue']('encryption',_0x1c96('0x31'));this[_0x1c96('0x5')]('avpf',_0x1c96('0x31'));this[_0x1c96('0x5')](_0x1c96('0x4f'),_0x1c96('0x31'));this[_0x1c96('0x5')](_0x1c96('0x50'),_0x1c96('0x31'));this[_0x1c96('0x5')](_0x1c96('0x51'),_0x1c96('0x31'));this[_0x1c96('0x5')]('dtlsverify','no');this[_0x1c96('0x5')]('dtlssetup',_0x1c96('0x45'));this['setDataValue']('dtlscertfile',_0x3e8429['dtlscertfile']||_0x1c96('0x56'));this[_0x1c96('0x5')](_0x1c96('0x54'),_0x3e8429[_0x1c96('0x54')]||_0x1c96('0x57'));this[_0x1c96('0x5')](_0x1c96('0x55'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x1c96('0x48')],'set':function(_0x577506){this['setDataValue'](_0x1c96('0x58'),_0x577506?_0x577506['join'](','):[]);},'get':function(){return this[_0x1c96('0xd')](_0x1c96('0x58'))?_[_0x1c96('0x59')](this[_0x1c96('0xd')](_0x1c96('0x58'))[_0x1c96('0x29')](','),function(_0x3d3e7c){return parseInt(_0x3d3e7c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1c96('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1c96('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1c96('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1c96('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1c96('0x11')](_0x1c96('0x31'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1c96('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1c96('0x5a')],'get':function(){return this[_0x1c96('0xd')](_0x1c96('0x5b'))?this[_0x1c96('0xd')](_0x1c96('0x5b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1c96('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1c96('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![],'set':function(_0x340a10){if(typeof _0x340a10===_0x1c96('0x5c')){var _0x375782=_0x340a10==='1'?!![]:_0x340a10==='0'?![]:_0x340a10==='true'?!![]:_0x340a10==='false'?![]:![];this[_0x1c96('0x5')](_0x1c96('0x5d'),_0x375782);}else{this[_0x1c96('0x5')]('screenrecording',_0x340a10);}}},'blocked':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![],'set':function(_0x4666b3){this[_0x1c96('0x5')]('blocked',_0x4666b3);if(_0x4666b3===!![]){this[_0x1c96('0x5')](_0x1c96('0x5e'),moment());this[_0x1c96('0x5')](_0x1c96('0x5f'),0x0);}else{this['setDataValue'](_0x1c96('0x5e'),null);}}},'blockedAt':{'type':Sequelize[_0x1c96('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1c96('0x15')](0x5)[_0x1c96('0x60')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1c96('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1c96('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x463a=['true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','email','toLowerCase','admin','user','agent','telephone','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','from-sip','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlsenable','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','string'];(function(_0x1a9730,_0xbb4703){var _0x1b66e6=function(_0x15c909){while(--_0x15c909){_0x1a9730['push'](_0x1a9730['shift']());}};_0x1b66e6(++_0xbb4703);}(_0x463a,0x1c9));var _0xa463=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x463a[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa463('0x0'));var util=require('util');var _=require('lodash');module[_0xa463('0x1')]={'name':{'type':Sequelize[_0xa463('0x2')],'allowNull':![],'unique':_0xa463('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x13d148){this[_0xa463('0x4')]('name',_0x13d148);this['setDataValue']('defaultuser',_0x13d148);},'comment':_0xa463('0x5')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5d894d){this[_0xa463('0x4')](_0xa463('0x6'),_0x5d894d);this[_0xa463('0x4')](_0xa463('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x5d894d,this[_0xa463('0x8')]('internal')));}},'alias':{'type':Sequelize[_0xa463('0x2')]},'email':{'type':Sequelize[_0xa463('0x2')],'allowNull':![],'unique':_0xa463('0x9'),'validate':{'isEmail':!![]},'set':function(_0x462b39){if(_0x462b39){this[_0xa463('0x4')](_0xa463('0x9'),_0x462b39[_0xa463('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0xa463('0xb'),_0xa463('0xc'),_0xa463('0xd'),_0xa463('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xa463('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa463('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':![],'unique':_0xa463('0x10'),'set':function(_0x21c39e){this[_0xa463('0x4')](_0xa463('0x10'),_0x21c39e);this['setDataValue'](_0xa463('0x11'),_0x21c39e);this['setDataValue'](_0xa463('0x7'),util['format'](_0xa463('0x12'),this['getDataValue'](_0xa463('0x6')),_0x21c39e));}},'salt':{'type':Sequelize[_0xa463('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xa463('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa463('0x2')]},'country':{'type':Sequelize[_0xa463('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xa463('0x14')},'lastPauseAt':{'type':Sequelize[_0xa463('0x15')]},'chatCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa463('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa463('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xa463('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa463('0x16'),_0xa463('0xc'),'peer'),'allowNull':!![],'defaultValue':_0xa463('0x16')},'context':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![],'defaultValue':_0xa463('0x17')},'callingpres':{'type':Sequelize[_0xa463('0x18')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xa463('0x19'),_0xa463('0x1a'),'PROHIB_NOT_SCREENED',_0xa463('0x1b'),_0xa463('0x1c'),_0xa463('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![],'defaultValue':_0xa463('0x1e'),'set':function(_0x378d67){this[_0xa463('0x4')](_0xa463('0x1f'),_0x378d67?_0x378d67[_0xa463('0x20')](','):null);},'get':function(){return this[_0xa463('0x8')](_0xa463('0x1f'))?this['getDataValue'](_0xa463('0x1f'))[_0xa463('0x21')](','):null;},'comment':_0xa463('0x22')},'dtmfmode':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x23'),'info',_0xa463('0x24'),'inband',_0xa463('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no',_0xa463('0x27'),_0xa463('0x28'),_0xa463('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x38224a){this[_0xa463('0x4')](_0xa463('0x2a'),_0x38224a?_0x38224a[_0xa463('0x20')](','):null);},'get':function(){return this[_0xa463('0x8')](_0xa463('0x2a'))?this[_0xa463('0x8')]('nat')[_0xa463('0x21')](','):null;},'comment':_0xa463('0x2b')},'callgroup':{'type':Sequelize[_0xa463('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa463('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xa463('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa463('0x2')],'allowNull':![],'defaultValue':_0xa463('0x2c')},'allow':{'type':Sequelize[_0xa463('0x2')],'allowNull':![],'defaultValue':_0xa463('0x2d'),'set':function(_0x19ce99){this[_0xa463('0x4')](_0xa463('0x2e'),_0x19ce99?_0x19ce99[_0xa463('0x20')](';'):_0xa463('0x2d'));},'get':function(){return this[_0xa463('0x8')](_0xa463('0x2e'))?this[_0xa463('0x8')](_0xa463('0x2e'))[_0xa463('0x21')](';'):null;},'comment':_0xa463('0x2f')},'autoframing':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x32af02){this['setDataValue'](_0xa463('0x30'),_0x32af02?_0x32af02[_0xa463('0x20')](','):null);},'get':function(){return this[_0xa463('0x8')]('insecure')?this[_0xa463('0x8')](_0xa463('0x30'))[_0xa463('0x21')](','):null;},'comment':_0xa463('0x31')},'trustrpid':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no',_0xa463('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![],'defaultValue':_0xa463('0x33')},'amaflags':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa463('0x18')]('yes','no'),'allowNull':!![],'defaultValue':_0xa463('0x26')},'busylevel':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa463('0x18')]('yes','no',_0xa463('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xa463('0x35'),_0xa463('0x36'),_0xa463('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x38'),_0xa463('0x39')),'allowNull':!![],'defaultValue':_0xa463('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xa463('0x26')},'keepalive':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no',_0xa463('0x3a'),_0xa463('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x3c'),_0xa463('0x3d'),_0xa463('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xa463('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa463('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xa463('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no','nonat',_0xa463('0x28'),_0xa463('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xa463('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa463('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4afc14){this['setDataValue'](_0xa463('0x41'),_0x4afc14);var _0xd5a03f=this[_0xa463('0x42')]({'plain':!![]});switch(_0x4afc14){case 0x0:case 0x1:var _0x3dfaf8=_0xd5a03f[_0xa463('0x1f')]?_[_0xa463('0x43')](_0xd5a03f[_0xa463('0x1f')])?_0xd5a03f[_0xa463('0x1f')][_0xa463('0x20')]():_0xd5a03f[_0xa463('0x1f')]:'udp';if(_0x3dfaf8===_0xa463('0x44')){_0x3dfaf8=_0xa463('0x1e');}this['setDataValue'](_0xa463('0x1f'),_0x3dfaf8);this[_0xa463('0x4')]('encryption','no');this[_0xa463('0x4')](_0xa463('0x45'),null);this[_0xa463('0x4')]('force_avp',null);this[_0xa463('0x4')](_0xa463('0x46'),null);this[_0xa463('0x4')]('dtlsenable',null);this[_0xa463('0x4')](_0xa463('0x47'),null);this['setDataValue']('dtlssetup',null);this[_0xa463('0x4')](_0xa463('0x48'),null);this['setDataValue'](_0xa463('0x49'),null);this[_0xa463('0x4')](_0xa463('0x4a'),'no');break;case 0x2:this[_0xa463('0x4')]('transport',_0xa463('0x44'));this[_0xa463('0x4')]('encryption','yes');this['setDataValue'](_0xa463('0x45'),_0xa463('0x26'));this[_0xa463('0x4')](_0xa463('0x4b'),_0xa463('0x26'));this[_0xa463('0x4')](_0xa463('0x46'),_0xa463('0x26'));this[_0xa463('0x4')](_0xa463('0x4c'),_0xa463('0x26'));this[_0xa463('0x4')](_0xa463('0x47'),'no');this[_0xa463('0x4')](_0xa463('0x4d'),_0xa463('0x3e'));this[_0xa463('0x4')](_0xa463('0x48'),_0xd5a03f[_0xa463('0x48')]||_0xa463('0x4e'));this[_0xa463('0x4')](_0xa463('0x49'),_0xd5a03f[_0xa463('0x49')]||'/etc/pki/tls/private/motion.key');this[_0xa463('0x4')](_0xa463('0x4a'),_0xa463('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2f258b){this['setDataValue'](_0xa463('0x4f'),_0x2f258b?_0x2f258b['join'](','):[]);},'get':function(){return this[_0xa463('0x8')](_0xa463('0x4f'))?_[_0xa463('0x50')](this[_0xa463('0x8')](_0xa463('0x4f'))[_0xa463('0x21')](','),function(_0x49d974){return parseInt(_0x49d974,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa463('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa463('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa463('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa463('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa463('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa463('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa463('0x18')](_0xa463('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa463('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0xa463('0x8')](_0xa463('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa463('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa463('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![],'set':function(_0x29b712){if(typeof _0x29b712===_0xa463('0x52')){var _0x25beda=_0x29b712==='1'?!![]:_0x29b712==='0'?![]:_0x29b712===_0xa463('0x53')?!![]:_0x29b712===_0xa463('0x54')?![]:![];this[_0xa463('0x4')](_0xa463('0x55'),_0x25beda);}else{this[_0xa463('0x4')](_0xa463('0x55'),_0x29b712);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4e2bf0){this[_0xa463('0x4')](_0xa463('0x56'),_0x4e2bf0);if(_0x4e2bf0===!![]){this[_0xa463('0x4')]('blockedAt',moment());this['setDataValue'](_0xa463('0x57'),0x0);}else{this[_0xa463('0x4')](_0xa463('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xa463('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa463('0xf')](0x5)[_0xa463('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa463('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa463('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa463('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa463('0xf')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa463('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a3c886d..da55e01 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 _0x3c8b=['queues','flatten','toString','lower','col','asc','desc','substring','orderBy','getRealtimeAgents','offline','unavailable','voiceStatus','slice','charAt','toUpperCase','QueryTypes','select','field','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','socket.io-emitter','redis','localhost','json','offset','undefined','limit','count','status','Content-Range','update','role','agent','emit','then','get','admin','Users','user','Agents','filter','value','find','name','UserProfileResource','destroy','end','sendStatus','error','stack','send','User','rawAttributes','map','fieldName','type','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','query','userSetting','UserSetting','attributes','push','rows','openTabs','length','chat','sms','fax','dataValues','mail','openchannel','whatsapp','all','catch','params','includeAll','include','true','merge','options','includes','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','password','max','isNil','min_internal','sequelize','SELECT','from','mailbox','VoiceMail','permissions','102','113','107','108','109','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','findAll','compact','changePassword','oldPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','newPassword','Setting','findOne','passwordHistoryLimit','validatePasswordHistory','addQueues','online','loginInPause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','voice','VoiceQueue','format','voicePause','upsert','removeQueues','channel','isValidChannel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','pick','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','openchannelPause','smsPause','whatsappPause','getTeams','Team','addTeams','resolve','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','CmHopper','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','phone','CmContact','Contact','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','teams'];(function(_0x5e722f,_0x329158){var _0x4957b9=function(_0x3e15c6){while(--_0x3e15c6){_0x5e722f['push'](_0x5e722f['shift']());}};_0x4957b9(++_0x329158);}(_0x3c8b,0x197));var _0xb3c8=function(_0xc89c67,_0xbc194e){_0xc89c67=_0xc89c67-0x0;var _0x3fcd44=_0x3c8b[_0xc89c67];return _0x3fcd44;};'use strict';var moment=require('moment');var util=require(_0xb3c8('0x0'));var path=require(_0xb3c8('0x1'));var fs=require('fs');var _=require(_0xb3c8('0x2'));var squel=require(_0xb3c8('0x3'));var Redis=require(_0xb3c8('0x4'));var authService=require(_0xb3c8('0x5'));var contacts=require(_0xb3c8('0x6'));var qs=require(_0xb3c8('0x7'));var rta=require(_0xb3c8('0x8'));var logger=require(_0xb3c8('0x9'))('api');var utils=require(_0xb3c8('0xa'));var config=require(_0xb3c8('0xb'));var licenseUtil=require(_0xb3c8('0xc'));var APIBadRequestError=require(_0xb3c8('0xd'))['APIBadRequestError'];var APINotFoundError=require(_0xb3c8('0xd'))[_0xb3c8('0xe')];var APIHandleError=require(_0xb3c8('0xd'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0xb3c8('0xf'))(new Redis(config['redis']));require('./user.socket')['register'](socket);config[_0xb3c8('0x10')]=_['defaults'](config['redis'],{'host':_0xb3c8('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x2ee939,_0x5ac847){_0x5ac847=_0x5ac847||0xcc;return function(_0x5c3775){if(_0x5c3775){return _0x2ee939['sendStatus'](_0x5ac847);}return _0x2ee939['status'](_0x5ac847)['end']();};}function respondWithResult(_0x18ac19,_0x535ff8){_0x535ff8=_0x535ff8||0xc8;return function(_0x5d83f9){if(_0x5d83f9){return _0x18ac19['status'](_0x535ff8)[_0xb3c8('0x12')](_0x5d83f9);}};}function respondWithFilteredResult(_0x4e1001,_0x18ee4c){return function(_0x28fedc){if(_0x28fedc){var _0x59a75f=typeof _0x18ee4c[_0xb3c8('0x13')]===_0xb3c8('0x14')&&typeof _0x18ee4c[_0xb3c8('0x15')]===_0xb3c8('0x14');var _0x40d9ea=_0x28fedc[_0xb3c8('0x16')];var _0x11ee1f=_0x59a75f?0x0:_0x18ee4c[_0xb3c8('0x13')];var _0x52a400=_0x59a75f?_0x28fedc[_0xb3c8('0x16')]:_0x18ee4c[_0xb3c8('0x13')]+_0x18ee4c[_0xb3c8('0x15')];var _0x1507a9;if(_0x52a400>=_0x40d9ea){_0x52a400=_0x40d9ea;_0x1507a9=0xc8;}else{_0x1507a9=0xce;}_0x4e1001[_0xb3c8('0x17')](_0x1507a9);return _0x4e1001['set'](_0xb3c8('0x18'),_0x11ee1f+'-'+_0x52a400+'/'+_0x40d9ea)['json'](_0x28fedc);}return null;};}function saveUpdates(_0x380967){return function(_0x29f688){if(_0x29f688){return _0x29f688[_0xb3c8('0x19')](_0x380967)['then'](function(_0x1c7955){if(_0x1c7955[_0xb3c8('0x1a')]===_0xb3c8('0x1b')){socket[_0xb3c8('0x1c')]('userNotification:recalc:'+_0x1c7955['id'],_0x1c7955);}return _0x1c7955;});}return null;};}function removeEntity(_0x347f3f){return function(_0x1a0bcf){if(_0x1a0bcf){return _0x1a0bcf['destroy']()[_0xb3c8('0x1d')](function(){var _0x421ea5=_0x1a0bcf[_0xb3c8('0x1e')]({'plain':!![]});if(_0x421ea5[_0xb3c8('0x1a')]===_0xb3c8('0x1f'))return;var _0x2dfa93=[{'name':_0xb3c8('0x20'),'value':_0xb3c8('0x21'),'ignore':!![]},{'name':_0xb3c8('0x22'),'value':_0xb3c8('0x1b'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x3d182c=_(_0x2dfa93)[_0xb3c8('0x23')]('ignore')['map']('value')[_0xb3c8('0x24')]();if(_['includes'](_0x3d182c,_0x421ea5[_0xb3c8('0x1a')])){return;}var _0x4d62b3=_[_0xb3c8('0x25')](_0x2dfa93,[_0xb3c8('0x24'),_0x421ea5[_0xb3c8('0x1a')]])[_0xb3c8('0x26')];return db[_0xb3c8('0x27')][_0xb3c8('0x28')]({'where':{'type':_0x4d62b3,'resourceId':_0x421ea5['id']}})[_0xb3c8('0x1d')](function(){return _0x1a0bcf;});})['then'](function(){_0x347f3f[_0xb3c8('0x17')](0xcc)[_0xb3c8('0x29')]();});}};}function handleEntityNotFound(_0x3c58a9){return function(_0x475801){if(!_0x475801){_0x3c58a9[_0xb3c8('0x2a')](0x194);}return _0x475801;};}function handleError(_0x21534a,_0x498b80){_0x498b80=_0x498b80||0x1f4;return function(_0x249e00){logger[_0xb3c8('0x2b')](_0x249e00[_0xb3c8('0x2c')]);if(_0x249e00['name']){delete _0x249e00[_0xb3c8('0x26')];}_0x21534a[_0xb3c8('0x17')](_0x498b80)[_0xb3c8('0x2d')](_0x249e00);};}function getUserAttributes(){return _(db[_0xb3c8('0x2e')][_0xb3c8('0x2f')])[_0xb3c8('0x30')](function(_0x548518){return{'name':_0x548518[_0xb3c8('0x31')],'type':_0x548518[_0xb3c8('0x32')]['key']};})['filter'](function(_0x25376e){return!['password',_0xb3c8('0x33'),_0xb3c8('0x34'),_0xb3c8('0x35'),_0xb3c8('0x36'),_0xb3c8('0x37')]['includes'](_0x25376e[_0xb3c8('0x26')]);})['value']();}exports[_0xb3c8('0x38')]=function(_0x4f8769,_0x5ccbf8){var _0x240e8f={},_0x2a99fe={'count':0x0,'rows':[]};var _0x297b3b=getUserAttributes();_0x240e8f=qs[_0xb3c8('0x39')](_0x297b3b,_0x4f8769);var _0x4c274e={'where':_0x240e8f[_0xb3c8('0x3a')]};return db[_0xb3c8('0x2e')]['count'](_0x4c274e)[_0xb3c8('0x1d')](function(_0x5a20de){_0x2a99fe['count']=_0x5a20de;if(_0x4f8769['query']['includeAll']){_0x240e8f['include']=[{'all':!![]}];}if(_0x4f8769[_0xb3c8('0x3b')][_0xb3c8('0x3c')]==='true'){_0x240e8f['include']=[{'model':db[_0xb3c8('0x3d')],'as':_0xb3c8('0x3c')}];}if(!_['includes'](_0x240e8f[_0xb3c8('0x3e')],'id')){_0x240e8f[_0xb3c8('0x3e')][_0xb3c8('0x3f')]('id');}return db[_0xb3c8('0x2e')]['findAll'](_0x240e8f);})[_0xb3c8('0x1d')](function(_0x1fc17c){_0x2a99fe[_0xb3c8('0x40')]=_0x1fc17c;if(_0x4f8769['query'][_0xb3c8('0x41')]==='true'){var _0x1298c3=[];for(var _0x10880a=0x0;_0x10880a<_0x2a99fe[_0xb3c8('0x40')][_0xb3c8('0x42')];_0x10880a++){_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x43'),_0x2a99fe[_0xb3c8('0x40')][_0x10880a]['dataValues']));_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x44'),_0x2a99fe['rows'][_0x10880a]['dataValues']));_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x45'),_0x2a99fe[_0xb3c8('0x40')][_0x10880a][_0xb3c8('0x46')]));_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x47'),_0x2a99fe[_0xb3c8('0x40')][_0x10880a]['dataValues']));_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x48'),_0x2a99fe['rows'][_0x10880a][_0xb3c8('0x46')]));_0x1298c3[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x49'),_0x2a99fe[_0xb3c8('0x40')][_0x10880a][_0xb3c8('0x46')]));}return Promise[_0xb3c8('0x4a')](_0x1298c3)[_0xb3c8('0x1d')](function(){return _0x2a99fe;});}else{return _0x2a99fe;}})[_0xb3c8('0x1d')](respondWithFilteredResult(_0x5ccbf8,_0x240e8f))[_0xb3c8('0x4b')](handleError(_0x5ccbf8,null));};exports['show']=function(_0x8da1e0,_0x4b88a4){var _0xa7a12d=getUserAttributes();_0x8da1e0[_0xb3c8('0x3b')]['id']=_0x8da1e0[_0xb3c8('0x4c')]['id'];var _0x1a20f5=qs[_0xb3c8('0x39')](_0xa7a12d,_0x8da1e0);if(_0x8da1e0[_0xb3c8('0x3b')][_0xb3c8('0x4d')]){_0x1a20f5[_0xb3c8('0x4e')]=[{'all':!![]}];}if(_0x8da1e0[_0xb3c8('0x3b')][_0xb3c8('0x3c')]===_0xb3c8('0x4f')){_0x1a20f5[_0xb3c8('0x4e')]=[{'model':db[_0xb3c8('0x3d')],'as':'userSetting'}];}_0x1a20f5=_[_0xb3c8('0x50')]({},_0x1a20f5,_0x8da1e0[_0xb3c8('0x51')]);if(!_[_0xb3c8('0x52')](_0x1a20f5[_0xb3c8('0x3e')],'id')){_0x1a20f5[_0xb3c8('0x3e')]['push']('id');}return db[_0xb3c8('0x2e')][_0xb3c8('0x25')](_0x1a20f5)[_0xb3c8('0x1d')](handleEntityNotFound(_0x4b88a4,null))[_0xb3c8('0x1d')](function(_0x270941){var _0x461db8=[];values=_0x270941;if(_0x8da1e0[_0xb3c8('0x3b')][_0xb3c8('0x41')]===_0xb3c8('0x4f')){_0x461db8[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x43'),_0x270941['dataValues']));_0x461db8['push'](get_open_tabs(_0xb3c8('0x44'),_0x270941[_0xb3c8('0x46')]));_0x461db8[_0xb3c8('0x3f')](get_open_tabs('openchannel',_0x270941[_0xb3c8('0x46')]));_0x461db8[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x49'),_0x270941[_0xb3c8('0x46')]));_0x461db8['push'](get_open_tabs('fax',_0x270941[_0xb3c8('0x46')]));_0x461db8[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x47'),_0x270941['dataValues']));return Promise[_0xb3c8('0x4a')](_0x461db8);}else{return values;}})[_0xb3c8('0x1d')](function(){return values;})[_0xb3c8('0x1d')](respondWithResult(_0x4b88a4,null))[_0xb3c8('0x4b')](handleError(_0x4b88a4,null));};exports[_0xb3c8('0x19')]=function(_0x1696f3,_0x335605){if(_0x1696f3['body']['id']){delete _0x1696f3['body']['id'];}delete _0x1696f3[_0xb3c8('0x53')][_0xb3c8('0x1a')];return db[_0xb3c8('0x2e')]['find']({'where':{'id':_0x1696f3[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x335605,null))[_0xb3c8('0x1d')](saveUpdates(_0x1696f3[_0xb3c8('0x53')],null))['then'](respondWithResult(_0x335605,null))['catch'](handleError(_0x335605,null));};exports[_0xb3c8('0x54')]=function(_0x5630f5,_0x25bf5e){return db[_0xb3c8('0x2e')][_0xb3c8('0x54')]()[_0xb3c8('0x1d')](respondWithResult(_0x25bf5e,null))[_0xb3c8('0x4b')](handleError(_0x25bf5e,null));};exports[_0xb3c8('0x55')]=function(_0x493ff7,_0x37a5db){return db[_0xb3c8('0x2e')]['find']({'where':{'id':_0x493ff7['params']['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x37a5db,null))[_0xb3c8('0x1d')](function(_0x14d601){if(_0x14d601){return _0x14d601[_0xb3c8('0x55')](_0x493ff7['body'][_0xb3c8('0x56')],_[_0xb3c8('0x57')](_0x493ff7[_0xb3c8('0x53')],[_0xb3c8('0x56'),'id'])||{});}})[_0xb3c8('0x1d')](respondWithResult(_0x37a5db,null))[_0xb3c8('0x4b')](handleError(_0x37a5db,null));};function validateUser(_0x21c5b1){return new Promise(function(_0x5a4179,_0x28600a){if(_0x21c5b1[_0xb3c8('0x58')])return _0x5a4179(_0x21c5b1);return db['Setting'][_0xb3c8('0x59')](0x1)['then'](function(_0x33a62c){if(_0x33a62c[_0xb3c8('0x5a')])authService[_0xb3c8('0x5b')](_0x21c5b1[_0xb3c8('0x5c')]);db[_0xb3c8('0x2e')][_0xb3c8('0x5d')]('internal')[_0xb3c8('0x1d')](function(_0x4e1faa){if(_[_0xb3c8('0x5e')](_0x4e1faa)){_0x21c5b1[_0xb3c8('0x58')]=_0x33a62c[_0xb3c8('0x5f')]||0x1;return;}if(_[_0xb3c8('0x5e')](_0x33a62c[_0xb3c8('0x5f')])||_0x33a62c['min_internal']===_0x4e1faa){_0x21c5b1[_0xb3c8('0x58')]=_0x4e1faa+0x1;return;}if(_0x33a62c[_0xb3c8('0x5f')]>_0x4e1faa){_0x21c5b1[_0xb3c8('0x58')]=_0x33a62c[_0xb3c8('0x5f')];return;}return db[_0xb3c8('0x60')][_0xb3c8('0x3b')]('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[_0xb3c8('0x60')]['QueryTypes'][_0xb3c8('0x61')]})[_0xb3c8('0x1d')](function(_0x56c3d6){if(_0x56c3d6&&_0x56c3d6[_0xb3c8('0x42')]){for(var _0x11949b=0x0,_0x13af4a=_0x56c3d6[_0xb3c8('0x42')];_0x11949b<_0x13af4a&&_[_0xb3c8('0x5e')](_0x21c5b1[_0xb3c8('0x58')]);_0x11949b++){if(_0x33a62c[_0xb3c8('0x5f')]<=_0x56c3d6[_0x11949b]['from']){_0x21c5b1[_0xb3c8('0x58')]=_0x56c3d6[_0x11949b]['from'];}else if(_0x33a62c['min_internal']>_0x56c3d6[_0x11949b][_0xb3c8('0x62')]&&_0x33a62c[_0xb3c8('0x5f')]<=_0x56c3d6[_0x11949b]['to']){_0x21c5b1[_0xb3c8('0x58')]=_0x33a62c['min_internal'];}}}if(_[_0xb3c8('0x5e')](_0x21c5b1['internal'])){_0x21c5b1[_0xb3c8('0x58')]=_0x4e1faa+0x1;}return _0x5a4179(_0x21c5b1);});});})['catch'](function(_0x3f223b){_0x28600a(_0x3f223b);});});}function updateUser(_0x5e9d88){return new Promise(function(_0x363ab8,_0x476f08){try{if(_0x5e9d88['voicemail']){_0x5e9d88[_0xb3c8('0x63')]=_0x5e9d88['internal'];_0x5e9d88[_0xb3c8('0x64')]={'mailbox':_0x5e9d88[_0xb3c8('0x58')],'password':_0x5e9d88[_0xb3c8('0x5c')],'fullname':_0x5e9d88['fullname'],'email':_0x5e9d88['email']};}if(_0x5e9d88['role']===_0xb3c8('0x1b')){if(!_0x5e9d88[_0xb3c8('0x65')])_0x5e9d88[_0xb3c8('0x65')]=['101',_0xb3c8('0x66'),'103',_0xb3c8('0x67'),'110','104','105','106',_0xb3c8('0x68'),_0xb3c8('0x69'),_0xb3c8('0x6a'),'100',_0xb3c8('0x6b'),_0xb3c8('0x6c'),_0xb3c8('0x6d')];}_0x363ab8(_0x5e9d88);}catch(_0x786ddc){_0x476f08(_0x786ddc);}});}exports[_0xb3c8('0x6e')]=function(_0x150d11,_0xef5808){if(_0x150d11[_0xb3c8('0x21')][_0xb3c8('0x1a')]===_0xb3c8('0x1b'))throw new Error(_0xb3c8('0x6f'));if(_0x150d11[_0xb3c8('0x53')]['role']===_0xb3c8('0x21')&&_0x150d11['user'][_0xb3c8('0x1a')]!==_0xb3c8('0x1f')){throw new Error(_0xb3c8('0x70'));}if(_0x150d11[_0xb3c8('0x53')][_0xb3c8('0x1a')]===_0xb3c8('0x1f')&&_0x150d11[_0xb3c8('0x21')]['role']!==_0xb3c8('0x1f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xb3c8('0x71')]([_0x150d11['body']])[_0xb3c8('0x1d')](function(){return validateUser(_0x150d11['body']);})[_0xb3c8('0x1d')](function(_0x4798c6){return updateUser(_0x4798c6)[_0xb3c8('0x1d')](function(_0x5f55bf){if(_0x5f55bf[_0xb3c8('0x1a')]===_0xb3c8('0x1f')){_0x5f55bf[_0xb3c8('0x72')]=_0x150d11[_0xb3c8('0x21')][_0xb3c8('0x72')];delete _0x5f55bf[_0xb3c8('0x73')];}return _0x5f55bf;});})[_0xb3c8('0x1d')](function(_0x2cfcbc){return db['User']['create'](_0x2cfcbc,{'include':[{'model':db[_0xb3c8('0x64')],'as':_0xb3c8('0x64')}]});})[_0xb3c8('0x1d')](function(_0x49c515){if(_0x150d11[_0xb3c8('0x53')]['role']==='user')return _0x49c515;if(_0x150d11[_0xb3c8('0x21')][_0xb3c8('0x1a')]!==_0xb3c8('0x21'))return _0x49c515;return db[_0xb3c8('0x74')][_0xb3c8('0x25')]({'where':{'name':_0x49c515[_0xb3c8('0x1a')]==='agent'?_0xb3c8('0x22'):_0xb3c8('0x75'),'userProfileId':_0x150d11[_0xb3c8('0x21')][_0xb3c8('0x73')]},'raw':!![]})[_0xb3c8('0x1d')](function(_0x26a43e){if(!_0x26a43e||_0x26a43e[_0xb3c8('0x76')]!=0x0)return _0x49c515;return db['UserProfileResource']['create']({'name':_0x49c515[_0xb3c8('0x26')],'resourceId':_0x49c515['id'],'type':_0x26a43e['name'],'sectionId':_0x26a43e['id']},{})['then'](function(){return _0x49c515;});})['catch'](function(_0x2b642d){logger[_0xb3c8('0x2b')](_0xb3c8('0x77'),_0x2b642d);throw _0x2b642d;});})[_0xb3c8('0x1d')](respondWithResult(_0xef5808,0xc9))[_0xb3c8('0x4b')](handleError(_0xef5808,null));};exports[_0xb3c8('0x78')]=function(_0x54c9f2,_0x5d2db2){var _0x2c90db=_0x54c9f2[_0xb3c8('0x53')];var _0x2a77c2=[];if(_0x54c9f2[_0xb3c8('0x21')]['role']===_0xb3c8('0x1b'))throw new Error('Unauthorized');if(_[_0xb3c8('0x79')](_0x2c90db,[_0xb3c8('0x1a'),_0xb3c8('0x21')])&&_0x54c9f2[_0xb3c8('0x21')][_0xb3c8('0x1a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x2c90db,[_0xb3c8('0x1a'),_0xb3c8('0x1f')])&&_0x54c9f2['user'][_0xb3c8('0x1a')]!=='admin'){throw new Error(_0xb3c8('0x7a'));}return licenseUtil[_0xb3c8('0x71')](_0x2c90db)[_0xb3c8('0x1d')](function(){return validateUser(_0x2c90db[0x0]);})[_0xb3c8('0x1d')](function(){for(var _0xfff47d=0x1;_0xfff47d<_0x2c90db[_0xb3c8('0x42')];_0xfff47d++){var _0x445fa3=_0x2c90db[_0xfff47d-0x1]['internal'];if(!_0x2c90db[_0xfff47d][_0xb3c8('0x58')])_0x2c90db[_0xfff47d][_0xb3c8('0x58')]=_0x445fa3+0x1;_0x2a77c2['push'](validateUser(_0x2c90db[_0xfff47d]));}return Promise['all'](_0x2a77c2);})['then'](function(){_0x2a77c2=[];for(var _0x1afee9=0x0;_0x1afee9<_0x2c90db[_0xb3c8('0x42')];_0x1afee9++){_0x2a77c2[_0xb3c8('0x3f')](updateUser(_0x2c90db[_0x1afee9]));}return Promise[_0xb3c8('0x4a')](_0x2a77c2);})[_0xb3c8('0x1d')](function(){_0x2a77c2=_0x2c90db['map'](function(_0x40119d){return db[_0xb3c8('0x2e')][_0xb3c8('0x6e')](_0x40119d,{'include':[{'model':db[_0xb3c8('0x64')],'as':'VoiceMail'}]})[_0xb3c8('0x1d')](function(_0xa40702){_0x40119d['id']=_0xa40702['id'];return _0x40119d;});});return Promise['all'](_0x2a77c2);})[_0xb3c8('0x1d')](function(_0x347930){if(_0x54c9f2[_0xb3c8('0x53')][_0xb3c8('0x1a')]===_0xb3c8('0x21'))return _0x347930;if(_0x54c9f2[_0xb3c8('0x21')][_0xb3c8('0x1a')]!==_0xb3c8('0x21'))return _0x347930;var _0x4fbf01=_[_0xb3c8('0x79')](_0x347930,function(_0x58472e){return _0x58472e[_0xb3c8('0x1a')]==='agent'||_0x58472e[_0xb3c8('0x1a')]===_0xb3c8('0x7b');});if(!_0x4fbf01)return _0x347930;return db['UserProfileSection'][_0xb3c8('0x7c')]({'where':{'name':{'$or':['Agents',_0xb3c8('0x75')]},'userProfileId':_0x54c9f2[_0xb3c8('0x21')][_0xb3c8('0x73')]},'raw':!![]})[_0xb3c8('0x1d')](function(_0x4f2134){if(_['isEmpty'](_0x4f2134)||!_[_0xb3c8('0x79')](_0x4f2134,[_0xb3c8('0x76'),0x0]))return _0x347930;_0x2a77c2=[];var _0x1a8d44=_(_0x4f2134)[_0xb3c8('0x30')](function(_0x40f097){if(_0x40f097[_0xb3c8('0x76')]===0x1)return;return _0x40f097[_0xb3c8('0x26')]===_0xb3c8('0x22')?_0xb3c8('0x1b'):_0xb3c8('0x7b');})[_0xb3c8('0x7d')]()['value']();for(var _0x4834fd=0x0;_0x4834fd<_0x347930[_0xb3c8('0x42')];_0x4834fd++){if(!_[_0xb3c8('0x52')](_0x1a8d44,_0x347930[_0x4834fd][_0xb3c8('0x1a')]))return;var _0x593003=_0x347930[_0x4834fd][_0xb3c8('0x1a')]==='agent'?'Agents':_0xb3c8('0x75');_0x2a77c2['push'](db[_0xb3c8('0x27')][_0xb3c8('0x6e')]({'name':_0x347930[_0x4834fd]['name'],'resourceId':_0x347930[_0x4834fd]['id'],'type':_0x593003,'sectionId':_[_0xb3c8('0x25')](_0x4f2134,['name',_0x593003])['id']},{}));}return Promise['all'](_0x2a77c2);});})[_0xb3c8('0x1d')](respondWithResult(_0x5d2db2,0xc9))[_0xb3c8('0x4b')](handleError(_0x5d2db2,null));};exports[_0xb3c8('0x7e')]=function(_0x1a3247,_0x103422){if(_0x1a3247['body']['id']){delete _0x1a3247[_0xb3c8('0x53')]['id'];}return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x1a3247[_0xb3c8('0x4c')]['id']}})['then'](function(_0x2eb5a6){if(!_0x2eb5a6)return null;if(_0x2eb5a6['id']===_0x1a3247[_0xb3c8('0x21')]['id']){if(!_0x1a3247[_0xb3c8('0x53')][_0xb3c8('0x7f')]||!_0x1a3247[_0xb3c8('0x53')]['newPassword']){throw new db[(_0xb3c8('0x80'))]['ValidationError'](_0xb3c8('0x81'));}if(!_0x2eb5a6['authenticate'](_0x1a3247['body'][_0xb3c8('0x7f')])){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x83'));}if(_0x1a3247[_0xb3c8('0x53')][_0xb3c8('0x7f')]===_0x1a3247[_0xb3c8('0x53')]['newPassword']){throw new db['Sequelize'][(_0xb3c8('0x82'))](_0xb3c8('0x84'));}}else if(_0x1a3247[_0xb3c8('0x21')][_0xb3c8('0x1a')]===_0xb3c8('0x1f')){if(!_0x1a3247[_0xb3c8('0x53')]['newPassword']){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x85'));}}else if(_0x1a3247[_0xb3c8('0x21')]['role']===_0xb3c8('0x21')){if(!_0x1a3247[_0xb3c8('0x53')][_0xb3c8('0x86')]){throw new db['Sequelize'][(_0xb3c8('0x82'))](_0xb3c8('0x85'));}if(_0x2eb5a6[_0xb3c8('0x1a')]!==_0xb3c8('0x1b')){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x6f'));}}else{throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x6f'));}return _0x2eb5a6;})[_0xb3c8('0x1d')](handleEntityNotFound(_0x103422,null))['then'](function(_0x1f3050){return db[_0xb3c8('0x87')][_0xb3c8('0x88')]({'attributes':['id',_0xb3c8('0x5a'),'enforcePasswordHistory',_0xb3c8('0x89')]})['then'](function(_0x173e7b){if(_0x173e7b['securePassword'])authService[_0xb3c8('0x5b')](_0x1a3247[_0xb3c8('0x53')][_0xb3c8('0x86')]);if(!_0x173e7b['enforcePasswordHistory']||!_0x1f3050[_0xb3c8('0x34')])return _0x1f3050;authService[_0xb3c8('0x8a')](_0x1a3247[_0xb3c8('0x53')]['newPassword'],_0x1f3050['previousPasswords'],_0x173e7b[_0xb3c8('0x89')]);return _0x1f3050;})['then'](saveUpdates({'password':_0x1a3247[_0xb3c8('0x53')][_0xb3c8('0x86')],'passwordResetAt':_0x1a3247[_0xb3c8('0x21')]['id']==_0x1a3247[_0xb3c8('0x4c')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1a3247[_0xb3c8('0x53')]['newPassword'],_0x1f3050[_0xb3c8('0x34')])},null));})[_0xb3c8('0x1d')](respondWithResult(_0x103422,null))['catch'](handleError(_0x103422,null));};exports[_0xb3c8('0x8b')]=function(_0x27fbee,_0x4ee356){var _0x26b51a=_0x27fbee[_0xb3c8('0x53')]['channel'];return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x27fbee['params']['id']},'attributes':['id',_0xb3c8('0x26'),'role',_0xb3c8('0x8c'),_0xb3c8('0x8d'),'voicePause',_0xb3c8('0x8e')]})[_0xb3c8('0x1d')](handleEntityNotFound(_0x4ee356,null))[_0xb3c8('0x1d')](function(_0x5accec){if(_0x5accec){if(!utils['isValidChannel'](_0x26b51a)){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x8f'));}return _0x5accec[_0xb3c8('0x90')+_[_0xb3c8('0x91')](_0x26b51a[_0xb3c8('0x92')]())+_0xb3c8('0x93')](_0x27fbee[_0xb3c8('0x53')][_0xb3c8('0x56')],{'penalty':_0x27fbee[_0xb3c8('0x53')][_0xb3c8('0x94')]||0x0})['spread'](function(_0x2d1e59){for(var _0x3e6b8f=0x0;_0x3e6b8f<_0x27fbee[_0xb3c8('0x53')]['ids']['length'];_0x3e6b8f+=0x1){var _0x4037c6={'UserId':Number(_0x27fbee['params']['id'])};_0x4037c6[_['capitalize'](_0x26b51a[_0xb3c8('0x92')]())+_0xb3c8('0x95')]=Number(_0x27fbee['body'][_0xb3c8('0x56')][_0x3e6b8f]);socket[_0xb3c8('0x1c')](_0xb3c8('0x21')+_[_0xb3c8('0x91')](_0x26b51a[_0xb3c8('0x92')]())+_0xb3c8('0x96'),_0x4037c6);}return _0x2d1e59;})[_0xb3c8('0x1d')](function(){if(_0x26b51a===_0xb3c8('0x97')){return db[_0xb3c8('0x98')][_0xb3c8('0x7c')]({'where':{'id':_0x27fbee[_0xb3c8('0x53')][_0xb3c8('0x56')]||[]},'raw':!![],'attributes':['id',_0xb3c8('0x26')]});}})['then'](function(_0x2ccd56){var _0x4abd2c=_0x5accec[_0xb3c8('0x1e')]({'plain':!![]});var _0x2db62f=[];if(_0x26b51a===_0xb3c8('0x97')&&_0x4abd2c[_0xb3c8('0x1a')]===_0xb3c8('0x1b')&&_0x4abd2c[_0xb3c8('0x8c')]){for(let _0x3c1a63=0x0;_0x3c1a63<_0x2ccd56[_0xb3c8('0x42')];_0x3c1a63+=0x1){_0x2db62f[_0xb3c8('0x3f')]({'membername':_0x4abd2c[_0xb3c8('0x26')],'UserId':_0x4abd2c['id'],'queue_name':_0x2ccd56[_0x3c1a63][_0xb3c8('0x26')],'VoiceQueueId':_0x2ccd56[_0x3c1a63]['id'],'interface':_[_0xb3c8('0x5e')](_0x4abd2c[_0xb3c8('0x8e')])?util[_0xb3c8('0x99')]('SIP/%s',_0x4abd2c[_0xb3c8('0x26')]):_0x4abd2c['interface'],'paused':_0x4abd2c[_0xb3c8('0x9a')]||![],'penalty':_0x27fbee[_0xb3c8('0x53')][_0xb3c8('0x94')]||0x0});}return Promise[_0xb3c8('0x4a')](_0x2db62f['map'](function(_0x3db61f){return db['UserVoiceQueueRt'][_0xb3c8('0x9b')](_0x3db61f);}));}return _0x5accec;});}})[_0xb3c8('0x1d')](respondWithStatusCode(_0x4ee356,null))[_0xb3c8('0x4b')](handleError(_0x4ee356,null));};exports[_0xb3c8('0x9c')]=function(_0x177548,_0x3a454b){var _0x18c3cf,_0x164fcf;return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x177548[_0xb3c8('0x4c')]['id']},'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x1a')]})['then'](handleEntityNotFound(_0x3a454b,null))[_0xb3c8('0x1d')](function(_0x8424bc){if(_0x8424bc){_0x18c3cf=_0x8424bc;if(!_0x177548['query'][_0xb3c8('0x9d')]||!utils[_0xb3c8('0x9e')](_0x177548[_0xb3c8('0x3b')]['channel'])){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))]('Unknown\x20channel');}return _0x8424bc[_0xb3c8('0x9f')+_[_0xb3c8('0x91')](_0x177548[_0xb3c8('0x3b')]['channel'][_0xb3c8('0x92')]())+_0xb3c8('0x93')](_0x177548['query'][_0xb3c8('0x56')]);}})['then'](function(_0x5ee74a){if(_[_0xb3c8('0xa0')](_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x56')])){for(var _0x2acfd1=0x0;_0x2acfd1<_0x177548['query']['ids'][_0xb3c8('0x42')];_0x2acfd1+=0x1){_0x164fcf={'UserId':Number(_0x177548[_0xb3c8('0x4c')]['id'])};_0x164fcf[_[_0xb3c8('0x91')](_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x9d')][_0xb3c8('0x92')]())+_0xb3c8('0x95')]=Number(_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x56')][_0x2acfd1]);socket[_0xb3c8('0x1c')]('user'+_[_0xb3c8('0x91')](_0x177548['query'][_0xb3c8('0x9d')][_0xb3c8('0x92')]())+_0xb3c8('0xa1'),_0x164fcf);}}else{_0x164fcf={'UserId':Number(_0x177548['params']['id'])};_0x164fcf[_[_0xb3c8('0x91')](_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x9d')][_0xb3c8('0x92')]())+_0xb3c8('0x95')]=Number(_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x56')]);socket[_0xb3c8('0x1c')]('user'+_[_0xb3c8('0x91')](_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x9d')][_0xb3c8('0x92')]())+'Queue:remove',_0x164fcf);}return _0x5ee74a;})[_0xb3c8('0x1d')](function(){if(_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x9d')]===_0xb3c8('0x97')){return db[_0xb3c8('0xa2')][_0xb3c8('0x28')]({'where':{'UserId':_0x177548[_0xb3c8('0x4c')]['id'],'VoiceQueueId':_0x177548[_0xb3c8('0x3b')][_0xb3c8('0x56')]},'individualHooks':!![]})['then'](function(){return _0x18c3cf;});}return _0x18c3cf;})[_0xb3c8('0x1d')](respondWithStatusCode(_0x3a454b,null))['catch'](handleError(_0x3a454b,null));};exports[_0xb3c8('0xa3')]=function(_0x4734dd,_0x49db70){_0x4734dd[_0xb3c8('0x53')]['userpic']=_0x4734dd[_0xb3c8('0xa4')][_0xb3c8('0xa5')];return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x4734dd['params']['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x49db70,null))[_0xb3c8('0x1d')](saveUpdates(_0x4734dd[_0xb3c8('0x53')],null))[_0xb3c8('0x1d')](respondWithResult(_0x49db70,null))[_0xb3c8('0x4b')](handleError(_0x49db70,null));};exports[_0xb3c8('0xa6')]=function(_0x1ecae2,_0x17731d){var _0x2bdceb=path[_0xb3c8('0xa7')](config[_0xb3c8('0xa8')],_0xb3c8('0xa9'));return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x1ecae2['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xb3c8('0x1d')](handleEntityNotFound(_0x17731d,null))[_0xb3c8('0x1d')](function(_0x131349){if(_0x131349){if(_[_0xb3c8('0x5e')](_0x131349[_0xb3c8('0xaa')])){return _0x17731d[_0xb3c8('0xab')](_0x2bdceb);}else{if(!fs[_0xb3c8('0xac')](path['join'](config[_0xb3c8('0xa8')],_0xb3c8('0xad'),_0x131349['userpic']))){return _0x17731d['download'](_0x2bdceb);}return _0x17731d[_0xb3c8('0xab')](path[_0xb3c8('0xa7')](config[_0xb3c8('0xa8')],_0xb3c8('0xad'),_0x131349[_0xb3c8('0xaa')]));}}})['catch'](handleError(_0x17731d,null));};exports['getOpenTabs']=function(_0x1e4e77,_0x21bf4c){return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x1e4e77[_0xb3c8('0x4c')]['id']},'attributes':['id']})[_0xb3c8('0x1d')](handleEntityNotFound(_0x21bf4c,null))[_0xb3c8('0x1d')](function(_0x527492){var _0x5ba742=[];values=_0x527492[_0xb3c8('0x46')];_0x5ba742['push'](get_open_tabs(_0xb3c8('0x43'),_0x527492[_0xb3c8('0x46')]));_0x5ba742['push'](get_open_tabs(_0xb3c8('0x44'),_0x527492['dataValues']));_0x5ba742['push'](get_open_tabs(_0xb3c8('0x48'),_0x527492[_0xb3c8('0x46')]));_0x5ba742[_0xb3c8('0x3f')](get_open_tabs(_0xb3c8('0x49'),_0x527492['dataValues']));_0x5ba742['push'](get_open_tabs(_0xb3c8('0x45'),_0x527492['dataValues']));_0x5ba742['push'](get_open_tabs('mail',_0x527492[_0xb3c8('0x46')]));return Promise['all'](_0x5ba742);})[_0xb3c8('0x1d')](function(_0x3b233b){if(_0x3b233b){var _0x185eae=_[_0xb3c8('0x30')](values[_0xb3c8('0xae')],function(_0x3f7e7b){return{'channel':_0xb3c8('0xaf'),'id':_0x3f7e7b['id'],'createdAt':_0x3f7e7b[_0xb3c8('0xb0')]};});var _0xb30ff5=_['map'](values[_0xb3c8('0xb1')],function(_0x305499){return{'channel':_0xb3c8('0xb2'),'id':_0x305499['id'],'createdAt':_0x305499[_0xb3c8('0xb0')]};});var _0x4ae73b=_['map'](values[_0xb3c8('0xb3')],function(_0xb0910f){return{'channel':'OPENCHANNEL','id':_0xb0910f['id'],'createdAt':_0xb0910f['createdAt']};});var _0x424951=_[_0xb3c8('0x30')](values[_0xb3c8('0xb4')],function(_0x37536c){return{'channel':_0xb3c8('0xb5'),'id':_0x37536c['id'],'createdAt':_0x37536c[_0xb3c8('0xb0')]};});var _0x491afb=_['map'](values[_0xb3c8('0xb6')],function(_0x4cc102){return{'channel':'SMS','id':_0x4cc102['id'],'createdAt':_0x4cc102[_0xb3c8('0xb0')]};});var _0x2bfd27=_[_0xb3c8('0x30')](values[_0xb3c8('0xb7')],function(_0x5a930b){return{'channel':_0xb3c8('0xb8'),'id':_0x5a930b['id'],'createdAt':_0x5a930b[_0xb3c8('0xb0')]};});var _0x506dc3=_[_0xb3c8('0xb9')](_0x185eae,_0xb30ff5,_0x4ae73b,_0x424951,_0x491afb,_0x2bfd27);var _0x1753d2={'count':_0x506dc3[_0xb3c8('0x42')],'rows':_0x506dc3};return _0x1753d2;}else return null;})['then'](respondWithResult(_0x21bf4c,null))['catch'](handleError(_0x21bf4c,null));};exports[_0xb3c8('0xba')]=function(_0x19de5b,_0x2f3d6d){var _0x3a4b82={};return db[_0xb3c8('0x2e')]['findOne']({'where':{'id':_0x19de5b[_0xb3c8('0x4c')]['id']}})['then'](function(_0x52cc9d){if(!_0x52cc9d){throw new APINotFoundError(util[_0xb3c8('0x99')](_0xb3c8('0xbb'),_0x19de5b[_0xb3c8('0x4c')]['id']));}return contacts['describe']();})[_0xb3c8('0x1d')](function(_0x23526b){_0x19de5b[_0xb3c8('0x3b')][_0xb3c8('0x2e')]=_0x19de5b[_0xb3c8('0x4c')]['id'];_0x3a4b82=qs[_0xb3c8('0x39')](_0x23526b,_0x19de5b);if(_0x19de5b[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0x4d'))){_0x3a4b82[_0xb3c8('0x4e')]=[{'model':db[_0xb3c8('0xbd')],'as':_0xb3c8('0xbe'),'required':![]},{'model':db[_0xb3c8('0xbf')],'as':_0xb3c8('0xc0'),'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0xc1')],'where':_0x19de5b[_0xb3c8('0x3b')]['tag']?{'id':_0x19de5b[_0xb3c8('0x3b')][_0xb3c8('0xc2')]}:undefined,'required':_0x19de5b[_0xb3c8('0x3b')][_0xb3c8('0xc2')]?!![]:![]}];}return contacts[_0xb3c8('0x7c')](_0x19de5b[_0xb3c8('0x3b')],_0x19de5b['user'],_0x3a4b82,_0x23526b);})['then'](respondWithFilteredResult(_0x2f3d6d,_0x3a4b82))['catch'](APIHandleError(_0x2f3d6d));};exports[_0xb3c8('0xc3')]=function(_0x56a0ba,_0x5a8fbf){var _0x414de0;var _0x399aa9={};var _0x35c63d;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x56a0ba['params']['id']},'attributes':['id',_0xb3c8('0x26'),'role']})[_0xb3c8('0x1d')](handleEntityNotFound(_0x5a8fbf,null))[_0xb3c8('0x1d')](function(_0x5389bb){if(!utils['isValidChannel'](_0x56a0ba[_0xb3c8('0x3b')]['channel'])){throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0x8f'));}_0x414de0=_0x5389bb;var _0x14898e={};_0x14898e[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db[_[_0xb3c8('0x91')](_0x56a0ba['query'][_0xb3c8('0x9d')])+_0xb3c8('0xc6')][_0xb3c8('0x2f')]);_0x14898e['query']=_[_0xb3c8('0xc5')](_0x56a0ba[_0xb3c8('0x3b')]);_0x14898e[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x14898e[_0xb3c8('0xc4')],_0x14898e['query']);_0x399aa9[_0xb3c8('0x3e')]=_[_0xb3c8('0xc8')](_0x14898e['model'],qs['fields'](_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x399aa9[_0xb3c8('0x3e')]=_0x399aa9[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x399aa9[_0xb3c8('0x3e')]:_0x14898e[_0xb3c8('0xc4')];_0x399aa9[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x56a0ba[_0xb3c8('0x3b')]['sort']);_0x399aa9['where']=qs['filters'](_['pick'](_0x56a0ba['query'],_0x14898e['filters']));if(_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0x23')]){_0x399aa9[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x399aa9[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x399aa9[_0xb3c8('0x3e')],function(_0xf03dc9){var _0x12fb03={};_0x12fb03[_0xf03dc9]={'$like':'%'+_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x12fb03;})});}_0x399aa9=_[_0xb3c8('0x50')]({},_0x399aa9,_0x56a0ba[_0xb3c8('0x51')]);switch(_0x414de0[_0xb3c8('0x1a')]){case _0xb3c8('0x1f'):return db[_[_0xb3c8('0x91')](_0x56a0ba[_0xb3c8('0x3b')]['channel'])+'Queue']['findAll'](_0x399aa9);case _0xb3c8('0x21'):case'agent':return _0x414de0[_0xb3c8('0x1e')+_[_0xb3c8('0x91')](_0x56a0ba[_0xb3c8('0x3b')]['channel'])+_0xb3c8('0x93')](_0x399aa9);default:throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0xcc'));}})['then'](function(_0x7eca2a){_0x35c63d=_0x7eca2a[_0xb3c8('0x42')];if(!_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0xcd'))){_0x399aa9[_0xb3c8('0x15')]=qs[_0xb3c8('0x15')](_0x56a0ba[_0xb3c8('0x3b')]['limit']);_0x399aa9[_0xb3c8('0x13')]=qs['offset'](_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}switch(_0x414de0['role']){case _0xb3c8('0x1f'):return db[_[_0xb3c8('0x91')](_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0x9d')])+_0xb3c8('0xc6')][_0xb3c8('0x7c')](_0x399aa9);case _0xb3c8('0x21'):case'agent':return _0x414de0[_0xb3c8('0x1e')+_['capitalize'](_0x56a0ba[_0xb3c8('0x3b')][_0xb3c8('0x9d')])+_0xb3c8('0x93')](_0x399aa9);}})[_0xb3c8('0x1d')](function(_0x3be75e){return{'count':_0x35c63d,'rows':_0x3be75e};})[_0xb3c8('0x1d')](respondWithResult(_0x5a8fbf,null))[_0xb3c8('0x4b')](handleError(_0x5a8fbf,null));};exports[_0xb3c8('0xce')]=function(_0xb481c9,_0x58e862){var _0x37f27a={};var _0x29be4c={};var _0x28a012;var _0xe1798;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0xb481c9['params']['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x58e862,null))['then'](function(_0x5a5af5){if(_0x5a5af5){_0x28a012=_0x5a5af5;_0x29be4c['model']=_[_0xb3c8('0xc5')](db['UserVoiceQueueRt'][_0xb3c8('0x2f')]);_0x29be4c[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0xb481c9[_0xb3c8('0x3b')]);_0x29be4c[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x29be4c[_0xb3c8('0xc4')],_0x29be4c['query']);_0x37f27a[_0xb3c8('0x3e')]=_['intersection'](_0x29be4c['model'],qs['fields'](_0xb481c9[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x37f27a[_0xb3c8('0x3e')]=_0x37f27a['attributes'][_0xb3c8('0x42')]?_0x37f27a[_0xb3c8('0x3e')]:_0x29be4c['model'];_0x37f27a['order']=qs[_0xb3c8('0xcb')](_0xb481c9['query'][_0xb3c8('0xcb')]);_0x37f27a[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_['pick'](_0xb481c9[_0xb3c8('0x3b')],_0x29be4c[_0xb3c8('0xc7')]));if(_0xb481c9['query']['filter']){_0x37f27a[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x37f27a[_0xb3c8('0x3a')],{'$or':_['map'](_0x37f27a[_0xb3c8('0x3e')],function(_0x31ee58){var _0x3cd7af={};_0x3cd7af[_0x31ee58]={'$like':'%'+_0xb481c9['query'][_0xb3c8('0x23')]+'%'};return _0x3cd7af;})});}_0x37f27a=_[_0xb3c8('0x50')]({},_0x37f27a,_0xb481c9[_0xb3c8('0x51')]);return _0x28a012[_0xb3c8('0xce')](_0x37f27a);}})[_0xb3c8('0x1d')](function(_0x24974c){if(_0x24974c){_0xe1798=_0x24974c['length'];if(!_0xb481c9[_0xb3c8('0x3b')][_0xb3c8('0xbc')]('nolimit')){_0x37f27a[_0xb3c8('0x15')]=qs[_0xb3c8('0x15')](_0xb481c9[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x37f27a['offset']=qs[_0xb3c8('0x13')](_0xb481c9[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}return _0x28a012[_0xb3c8('0xce')](_0x37f27a);}})['then'](function(_0x37d435){if(_0x37d435){return _0x37d435?{'count':_0xe1798,'rows':_0x37d435}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0x58e862,null))[_0xb3c8('0x4b')](handleError(_0x58e862,null));};exports[_0xb3c8('0xcf')]=function(_0x3d9238,_0xf4638d){var _0x37ad5a={};var _0x367ade={};var _0xa367c7;var _0x4b423b;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x3d9238[_0xb3c8('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf4638d,null))[_0xb3c8('0x1d')](function(_0x5f1fda){if(_0x5f1fda){_0xa367c7=_0x5f1fda;_0x367ade[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db['ChatGroup'][_0xb3c8('0x2f')]);_0x367ade['query']=_[_0xb3c8('0xc5')](_0x3d9238[_0xb3c8('0x3b')]);_0x367ade['filters']=_[_0xb3c8('0xc8')](_0x367ade[_0xb3c8('0xc4')],_0x367ade['query']);_0x37ad5a[_0xb3c8('0x3e')]=_[_0xb3c8('0xc8')](_0x367ade[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x3d9238['query'][_0xb3c8('0xc9')]));_0x37ad5a[_0xb3c8('0x3e')]=_0x37ad5a[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x37ad5a[_0xb3c8('0x3e')]:_0x367ade[_0xb3c8('0xc4')];_0x37ad5a[_0xb3c8('0xca')]=qs['sort'](_0x3d9238[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x37ad5a[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x3d9238[_0xb3c8('0x3b')],_0x367ade[_0xb3c8('0xc7')]));if(_0x3d9238['query'][_0xb3c8('0x23')]){_0x37ad5a[_0xb3c8('0x3a')]=_['merge'](_0x37ad5a['where'],{'$or':_[_0xb3c8('0x30')](_0x37ad5a[_0xb3c8('0x3e')],function(_0x176dd5){var _0x35c73c={};_0x35c73c[_0x176dd5]={'$like':'%'+_0x3d9238[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x35c73c;})});}_0x37ad5a=_[_0xb3c8('0x50')]({},_0x37ad5a,_0x3d9238[_0xb3c8('0x51')]);return _0xa367c7[_0xb3c8('0xcf')](_0x37ad5a);}})[_0xb3c8('0x1d')](function(_0xb2b40e){if(_0xb2b40e){_0x4b423b=_0xb2b40e[_0xb3c8('0x42')];if(!_0x3d9238[_0xb3c8('0x3b')][_0xb3c8('0xbc')]('nolimit')){_0x37ad5a['limit']=qs[_0xb3c8('0x15')](_0x3d9238[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x37ad5a[_0xb3c8('0x13')]=qs['offset'](_0x3d9238['query']['offset']);}return _0xa367c7[_0xb3c8('0xcf')](_0x37ad5a);}})[_0xb3c8('0x1d')](function(_0x1c44e7){if(_0x1c44e7){return _0x1c44e7?{'count':_0x4b423b,'rows':_0x1c44e7}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0xf4638d,null))[_0xb3c8('0x4b')](handleError(_0xf4638d,null));};exports[_0xb3c8('0xd1')]=function(_0x23726a,_0x165507){var _0x5ae9c5={'raw':!![],'where':{}};var _0x4ea655={};var _0x55a7fd={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x23726a[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x165507,null))[_0xb3c8('0x1d')](function(_0x295965){if(_0x295965){_0x4ea655['model']=_[_0xb3c8('0xc5')](db['VoiceRecording'][_0xb3c8('0x2f')]);_0x4ea655[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0x23726a['query']);_0x4ea655[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x4ea655[_0xb3c8('0xc4')],_0x4ea655[_0xb3c8('0x3b')]);_0x5ae9c5['attributes']=_[_0xb3c8('0xc8')](_0x4ea655[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x23726a['query']['fields']));_0x5ae9c5[_0xb3c8('0x3e')]=_0x5ae9c5[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x5ae9c5['attributes']:_0x4ea655[_0xb3c8('0xc4')];if(!_0x23726a[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0xcd'))){_0x5ae9c5['limit']=qs[_0xb3c8('0x15')](_0x23726a['query']['limit']);_0x5ae9c5['offset']=qs[_0xb3c8('0x13')](_0x23726a[_0xb3c8('0x3b')]['offset']);}_0x5ae9c5['order']=qs[_0xb3c8('0xcb')](_0x23726a[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x5ae9c5[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x23726a[_0xb3c8('0x3b')],_0x4ea655['filters']));_0x5ae9c5[_0xb3c8('0x3a')][_0xb3c8('0xd2')]=_0x295965['id'];if(_0x23726a['query'][_0xb3c8('0x23')]){_0x5ae9c5[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x5ae9c5[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x5ae9c5[_0xb3c8('0x3e')],function(_0x41ea31){var _0x9b3380={};_0x9b3380[_0x41ea31]={'$like':'%'+_0x23726a[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x9b3380;})});}_0x5ae9c5=_['merge']({},_0x5ae9c5,_0x23726a[_0xb3c8('0x51')]);return db[_0xb3c8('0xd3')]['count']({'where':_0x5ae9c5[_0xb3c8('0x3a')]})['then'](function(_0x148f2e){_0x55a7fd[_0xb3c8('0x16')]=_0x148f2e;if(_0x23726a[_0xb3c8('0x3b')]['includeAll']){_0x5ae9c5['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x5ae9c5);})[_0xb3c8('0x1d')](function(_0x42c067){_0x55a7fd[_0xb3c8('0x40')]=_0x42c067;return _0x55a7fd;});}})[_0xb3c8('0x1d')](respondWithFilteredResult(_0x165507,_0x5ae9c5))[_0xb3c8('0x4b')](handleError(_0x165507,null));};exports[_0xb3c8('0xd4')]=function(_0x134e5e,_0x121606){var _0x57f08e={'raw':!![],'where':{}};var _0x328d2a={};var _0x25650d={'count':0x0,'rows':[]};return db['User'][_0xb3c8('0x88')]({'where':{'id':_0x134e5e[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x121606,null))[_0xb3c8('0x1d')](function(_0xa99c20){if(_0xa99c20){_0x328d2a[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db['ScreenRecording'][_0xb3c8('0x2f')]);_0x328d2a['query']=_[_0xb3c8('0xc5')](_0x134e5e['query']);_0x328d2a[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x328d2a['model'],_0x328d2a['query']);_0x57f08e['attributes']=_[_0xb3c8('0xc8')](_0x328d2a[_0xb3c8('0xc4')],qs['fields'](_0x134e5e[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x57f08e['attributes']=_0x57f08e[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x57f08e['attributes']:_0x328d2a[_0xb3c8('0xc4')];if(!_0x134e5e[_0xb3c8('0x3b')][_0xb3c8('0xbc')]('nolimit')){_0x57f08e[_0xb3c8('0x15')]=qs[_0xb3c8('0x15')](_0x134e5e['query'][_0xb3c8('0x15')]);_0x57f08e[_0xb3c8('0x13')]=qs[_0xb3c8('0x13')](_0x134e5e[_0xb3c8('0x3b')]['offset']);}_0x57f08e[_0xb3c8('0xca')]=qs['sort'](_0x134e5e[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x57f08e['where']=qs[_0xb3c8('0xc7')](_['pick'](_0x134e5e['query'],_0x328d2a[_0xb3c8('0xc7')]));_0x57f08e['where'][_0xb3c8('0xd2')]=_0xa99c20['id'];if(_0x134e5e['query'][_0xb3c8('0x23')]){_0x57f08e['where']=_[_0xb3c8('0x50')](_0x57f08e[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x57f08e[_0xb3c8('0x3e')],function(_0x3e34da){var _0x4b3150={};_0x4b3150[_0x3e34da]={'$like':'%'+_0x134e5e[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x4b3150;})});}_0x57f08e=_[_0xb3c8('0x50')]({},_0x57f08e,_0x134e5e[_0xb3c8('0x51')]);return db['ScreenRecording'][_0xb3c8('0x16')]({'where':_0x57f08e[_0xb3c8('0x3a')]})['then'](function(_0x43cfe1){_0x25650d[_0xb3c8('0x16')]=_0x43cfe1;if(_0x134e5e['query']['includeAll']){_0x57f08e['include']=[{'all':!![]}];}return db[_0xb3c8('0xd5')]['findAll'](_0x57f08e);})[_0xb3c8('0x1d')](function(_0xb115ed){_0x25650d[_0xb3c8('0x40')]=_0xb115ed;return _0x25650d;});}})[_0xb3c8('0x1d')](respondWithFilteredResult(_0x121606,_0x57f08e))['catch'](handleError(_0x121606,null));};exports[_0xb3c8('0xd6')]=function(_0x37d235,_0x5e6702){var _0x225adf={};var _0x1ef6ec={};var _0x477724;var _0x2aaf80;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x37d235['params']['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x5e6702,null))[_0xb3c8('0x1d')](function(_0x3356e3){if(_0x3356e3){_0x477724=_0x3356e3;_0x1ef6ec[_0xb3c8('0xc4')]=_['keys'](db[_0xb3c8('0xd7')][_0xb3c8('0x2f')]);_0x1ef6ec['query']=_['keys'](_0x37d235[_0xb3c8('0x3b')]);_0x1ef6ec['filters']=_[_0xb3c8('0xc8')](_0x1ef6ec[_0xb3c8('0xc4')],_0x1ef6ec[_0xb3c8('0x3b')]);_0x225adf['attributes']=_[_0xb3c8('0xc8')](_0x1ef6ec[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x37d235['query'][_0xb3c8('0xc9')]));_0x225adf[_0xb3c8('0x3e')]=_0x225adf[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x225adf[_0xb3c8('0x3e')]:_0x1ef6ec[_0xb3c8('0xc4')];_0x225adf[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x37d235[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x225adf[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x37d235[_0xb3c8('0x3b')],_0x1ef6ec[_0xb3c8('0xc7')]));if(_0x37d235['query'][_0xb3c8('0x23')]){_0x225adf[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x225adf[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x225adf[_0xb3c8('0x3e')],function(_0x274427){var _0xa3f637={};_0xa3f637[_0x274427]={'$like':'%'+_0x37d235[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0xa3f637;})});}_0x225adf=_[_0xb3c8('0x50')]({},_0x225adf,_0x37d235[_0xb3c8('0x51')]);return _0x477724[_0xb3c8('0xd6')](_0x225adf);}})[_0xb3c8('0x1d')](function(_0x24d809){if(_0x24d809){_0x2aaf80=_0x24d809['length'];if(!_0x37d235[_0xb3c8('0x3b')]['hasOwnProperty'](_0xb3c8('0xcd'))){_0x225adf[_0xb3c8('0x15')]=qs[_0xb3c8('0x15')](_0x37d235[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x225adf[_0xb3c8('0x13')]=qs['offset'](_0x37d235['query'][_0xb3c8('0x13')]);}return _0x477724[_0xb3c8('0xd6')](_0x225adf);}})[_0xb3c8('0x1d')](function(_0x1c795){if(_0x1c795){return _0x1c795?{'count':_0x2aaf80,'rows':_0x1c795}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0x5e6702,null))[_0xb3c8('0x4b')](handleError(_0x5e6702,null));};exports[_0xb3c8('0xd8')]=function(_0x3fd9a0,_0x4f7fe5){var _0x109935={};var _0x4a404c={};var _0x45d312;var _0x431596;return db[_0xb3c8('0x2e')]['findOne']({'where':{'id':_0x3fd9a0[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x4f7fe5,null))[_0xb3c8('0x1d')](function(_0x4b8eec){if(_0x4b8eec){_0x45d312=_0x4b8eec;_0x4a404c[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db['OpenchannelInteraction']['rawAttributes']);_0x4a404c[_0xb3c8('0x3b')]=_['keys'](_0x3fd9a0[_0xb3c8('0x3b')]);_0x4a404c[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x4a404c['model'],_0x4a404c[_0xb3c8('0x3b')]);_0x109935['attributes']=_[_0xb3c8('0xc8')](_0x4a404c[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x3fd9a0[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x109935['attributes']=_0x109935[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x109935['attributes']:_0x4a404c[_0xb3c8('0xc4')];_0x109935[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x3fd9a0[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x109935[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x3fd9a0[_0xb3c8('0x3b')],_0x4a404c['filters']));if(_0x3fd9a0['query'][_0xb3c8('0x23')]){_0x109935[_0xb3c8('0x3a')]=_['merge'](_0x109935[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x109935[_0xb3c8('0x3e')],function(_0x40bcdd){var _0x49454c={};_0x49454c[_0x40bcdd]={'$like':'%'+_0x3fd9a0[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x49454c;})});}_0x109935=_['merge']({},_0x109935,_0x3fd9a0[_0xb3c8('0x51')]);return _0x45d312['getOpenchannelInteractions'](_0x109935);}})[_0xb3c8('0x1d')](function(_0x44934c){if(_0x44934c){_0x431596=_0x44934c[_0xb3c8('0x42')];if(!_0x3fd9a0[_0xb3c8('0x3b')]['hasOwnProperty'](_0xb3c8('0xcd'))){_0x109935['limit']=qs['limit'](_0x3fd9a0[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x109935[_0xb3c8('0x13')]=qs[_0xb3c8('0x13')](_0x3fd9a0[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}return _0x45d312[_0xb3c8('0xd8')](_0x109935);}})[_0xb3c8('0x1d')](function(_0x664555){if(_0x664555){return _0x664555?{'count':_0x431596,'rows':_0x664555}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0x4f7fe5,null))[_0xb3c8('0x4b')](handleError(_0x4f7fe5,null));};exports['getMailInteractions']=function(_0x3af3d4,_0x37b0bf){var _0x4ded46={'raw':!![],'where':{}};var _0x1817c2={};var _0x4e6af8={'count':0x0,'rows':[]};return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x3af3d4[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x37b0bf,null))[_0xb3c8('0x1d')](function(_0x899694){if(_0x899694){_0x1817c2['model']=_[_0xb3c8('0xc5')](db[_0xb3c8('0xd9')]['rawAttributes']);_0x1817c2['query']=_[_0xb3c8('0xc5')](_0x3af3d4[_0xb3c8('0x3b')]);_0x1817c2[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x1817c2[_0xb3c8('0xc4')],_0x1817c2[_0xb3c8('0x3b')]);_0x4ded46['attributes']=_[_0xb3c8('0xc8')](_0x1817c2[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x3af3d4[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x4ded46['attributes']=_0x4ded46[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x4ded46[_0xb3c8('0x3e')]:_0x1817c2[_0xb3c8('0xc4')];if(!_0x3af3d4['query']['hasOwnProperty']('nolimit')){_0x4ded46['limit']=qs[_0xb3c8('0x15')](_0x3af3d4[_0xb3c8('0x3b')]['limit']);_0x4ded46[_0xb3c8('0x13')]=qs['offset'](_0x3af3d4[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}_0x4ded46[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x3af3d4[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x4ded46['where']=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x3af3d4[_0xb3c8('0x3b')],_0x1817c2[_0xb3c8('0xc7')]));_0x4ded46[_0xb3c8('0x3a')][_0xb3c8('0xd2')]=_0x899694['id'];if(_0x3af3d4['query'][_0xb3c8('0x23')]){_0x4ded46[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x4ded46[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x4ded46[_0xb3c8('0x3e')],function(_0x340b1d){var _0x57261d={};_0x57261d[_0x340b1d]={'$like':'%'+_0x3af3d4[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x57261d;})});}_0x4ded46=_[_0xb3c8('0x50')]({},_0x4ded46,_0x3af3d4['options']);return db[_0xb3c8('0xd9')][_0xb3c8('0x16')]({'where':_0x4ded46[_0xb3c8('0x3a')]})[_0xb3c8('0x1d')](function(_0x2317a0){_0x4e6af8['count']=_0x2317a0;if(_0x3af3d4[_0xb3c8('0x3b')]['includeAll']){_0x4ded46[_0xb3c8('0x4e')]=[{'all':!![]}];}return db['MailInteraction'][_0xb3c8('0x7c')](_0x4ded46);})[_0xb3c8('0x1d')](function(_0x518189){_0x4e6af8[_0xb3c8('0x40')]=_0x518189;return _0x4e6af8;});}})[_0xb3c8('0x1d')](respondWithFilteredResult(_0x37b0bf,_0x4ded46))[_0xb3c8('0x4b')](handleError(_0x37b0bf,null));};exports[_0xb3c8('0xda')]=function(_0x2f43eb,_0x1c4874){var _0x5bcfe8={};var _0x30986c={};var _0x4f5332;var _0x2d72ab;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x2f43eb[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x1c4874,null))['then'](function(_0x4338ca){if(_0x4338ca){_0x4f5332=_0x4338ca;_0x30986c[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db['SmsInteraction'][_0xb3c8('0x2f')]);_0x30986c[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0x2f43eb[_0xb3c8('0x3b')]);_0x30986c[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x30986c['model'],_0x30986c[_0xb3c8('0x3b')]);_0x5bcfe8['attributes']=_[_0xb3c8('0xc8')](_0x30986c[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x2f43eb[_0xb3c8('0x3b')]['fields']));_0x5bcfe8[_0xb3c8('0x3e')]=_0x5bcfe8[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x5bcfe8[_0xb3c8('0x3e')]:_0x30986c[_0xb3c8('0xc4')];_0x5bcfe8[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x2f43eb[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x5bcfe8[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x2f43eb[_0xb3c8('0x3b')],_0x30986c[_0xb3c8('0xc7')]));if(_0x2f43eb['query'][_0xb3c8('0x23')]){_0x5bcfe8['where']=_['merge'](_0x5bcfe8[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x5bcfe8[_0xb3c8('0x3e')],function(_0x42cd1c){var _0x54534a={};_0x54534a[_0x42cd1c]={'$like':'%'+_0x2f43eb[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x54534a;})});}_0x5bcfe8=_[_0xb3c8('0x50')]({},_0x5bcfe8,_0x2f43eb[_0xb3c8('0x51')]);return _0x4f5332[_0xb3c8('0xda')](_0x5bcfe8);}})[_0xb3c8('0x1d')](function(_0x5c5558){if(_0x5c5558){_0x2d72ab=_0x5c5558['length'];if(!_0x2f43eb[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0xcd'))){_0x5bcfe8[_0xb3c8('0x15')]=qs['limit'](_0x2f43eb['query']['limit']);_0x5bcfe8[_0xb3c8('0x13')]=qs['offset'](_0x2f43eb['query'][_0xb3c8('0x13')]);}return _0x4f5332['getSmsInteractions'](_0x5bcfe8);}})[_0xb3c8('0x1d')](function(_0x3ca357){if(_0x3ca357){return _0x3ca357?{'count':_0x2d72ab,'rows':_0x3ca357}:null;}})['then'](respondWithResult(_0x1c4874,null))[_0xb3c8('0x4b')](handleError(_0x1c4874,null));};exports[_0xb3c8('0xdb')]=function(_0x146dd1,_0x51c6bf){var _0x12cc57={};var _0x56a710={};var _0x14920f;var _0x11641c;return db[_0xb3c8('0x2e')]['findOne']({'where':{'id':_0x146dd1[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x51c6bf,null))[_0xb3c8('0x1d')](function(_0x59b2c7){if(_0x59b2c7){_0x14920f=_0x59b2c7;_0x56a710[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db[_0xb3c8('0xdc')][_0xb3c8('0x2f')]);_0x56a710[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0x146dd1[_0xb3c8('0x3b')]);_0x56a710['filters']=_[_0xb3c8('0xc8')](_0x56a710['model'],_0x56a710[_0xb3c8('0x3b')]);_0x12cc57['attributes']=_[_0xb3c8('0xc8')](_0x56a710[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x12cc57[_0xb3c8('0x3e')]=_0x12cc57['attributes'][_0xb3c8('0x42')]?_0x12cc57[_0xb3c8('0x3e')]:_0x56a710[_0xb3c8('0xc4')];_0x12cc57['order']=qs['sort'](_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x12cc57[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x146dd1[_0xb3c8('0x3b')],_0x56a710['filters']));if(_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0x23')]){_0x12cc57[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x12cc57[_0xb3c8('0x3a')],{'$or':_[_0xb3c8('0x30')](_0x12cc57[_0xb3c8('0x3e')],function(_0x3a9204){var _0x264a86={};_0x264a86[_0x3a9204]={'$like':'%'+_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x264a86;})});}_0x12cc57=_['merge']({},_0x12cc57,_0x146dd1[_0xb3c8('0x51')]);return _0x14920f['getFaxInteractions'](_0x12cc57);}})['then'](function(_0x583b8f){if(_0x583b8f){_0x11641c=_0x583b8f[_0xb3c8('0x42')];if(!_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0xcd'))){_0x12cc57['limit']=qs[_0xb3c8('0x15')](_0x146dd1[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x12cc57['offset']=qs[_0xb3c8('0x13')](_0x146dd1[_0xb3c8('0x3b')]['offset']);}return _0x14920f[_0xb3c8('0xdb')](_0x12cc57);}})['then'](function(_0x3adaef){if(_0x3adaef){return _0x3adaef?{'count':_0x11641c,'rows':_0x3adaef}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0x51c6bf,null))['catch'](handleError(_0x51c6bf,null));};exports[_0xb3c8('0xdd')]=function(_0x466b1d,_0x7568fe){var _0x194e75={};var _0x806b20={};var _0x42372e;var _0x26b8b5;return db[_0xb3c8('0x2e')]['findOne']({'where':{'id':_0x466b1d[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x7568fe,null))[_0xb3c8('0x1d')](function(_0x1a3fd0){if(_0x1a3fd0){_0x42372e=_0x1a3fd0;_0x806b20['model']=_['keys'](db['WhatsappInteraction'][_0xb3c8('0x2f')]);_0x806b20['query']=_[_0xb3c8('0xc5')](_0x466b1d[_0xb3c8('0x3b')]);_0x806b20[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x806b20['model'],_0x806b20[_0xb3c8('0x3b')]);_0x194e75[_0xb3c8('0x3e')]=_['intersection'](_0x806b20[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x466b1d['query']['fields']));_0x194e75[_0xb3c8('0x3e')]=_0x194e75['attributes']['length']?_0x194e75[_0xb3c8('0x3e')]:_0x806b20[_0xb3c8('0xc4')];_0x194e75[_0xb3c8('0xca')]=qs['sort'](_0x466b1d[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x194e75[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_['pick'](_0x466b1d['query'],_0x806b20[_0xb3c8('0xc7')]));if(_0x466b1d[_0xb3c8('0x3b')]['filter']){_0x194e75[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x194e75[_0xb3c8('0x3a')],{'$or':_['map'](_0x194e75[_0xb3c8('0x3e')],function(_0x55b5a8){var _0x46e747={};_0x46e747[_0x55b5a8]={'$like':'%'+_0x466b1d[_0xb3c8('0x3b')]['filter']+'%'};return _0x46e747;})});}_0x194e75=_['merge']({},_0x194e75,_0x466b1d[_0xb3c8('0x51')]);return _0x42372e[_0xb3c8('0xdd')](_0x194e75);}})[_0xb3c8('0x1d')](function(_0x39db47){if(_0x39db47){_0x26b8b5=_0x39db47[_0xb3c8('0x42')];if(!_0x466b1d[_0xb3c8('0x3b')]['hasOwnProperty']('nolimit')){_0x194e75[_0xb3c8('0x15')]=qs[_0xb3c8('0x15')](_0x466b1d[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x194e75[_0xb3c8('0x13')]=qs[_0xb3c8('0x13')](_0x466b1d[_0xb3c8('0x3b')]['offset']);}return _0x42372e['getWhatsappInteractions'](_0x194e75);}})[_0xb3c8('0x1d')](function(_0x5c6e77){if(_0x5c6e77){return _0x5c6e77?{'count':_0x26b8b5,'rows':_0x5c6e77}:null;}})['then'](respondWithResult(_0x7568fe,null))['catch'](handleError(_0x7568fe,null));};exports[_0xb3c8('0xde')]=function(_0x4e3d8e,_0x508174,_0x697397){var _0x236ced;var _0xc73a28;var _0x120b60;var _0x449e5e=!_['isNil'](_0x4e3d8e[_0xb3c8('0x4c')]['id'])?_0x4e3d8e['params']['id']:!_[_0xb3c8('0x5e')](_0x4e3d8e[_0xb3c8('0x21')]['id'])?_0x4e3d8e[_0xb3c8('0x21')]['id']:null;return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x449e5e,'role':{'$or':[_0xb3c8('0x1f'),_0xb3c8('0x21'),_0xb3c8('0x1b')]}},'attributes':['id','name','phone',_0xb3c8('0xdf'),'role',_0xb3c8('0x58'),_0xb3c8('0x8d')]})[_0xb3c8('0x1d')](function(_0x514f75){if(_0x514f75){if(_0x514f75[_0xb3c8('0x1a')]===_0xb3c8('0x1b')){_0x236ced=_0x514f75;if(_0x4e3d8e[_0xb3c8('0x53')]['interface']){_0x120b60=util[_0xb3c8('0x99')](_0xb3c8('0xe0'),_0x236ced[_0x4e3d8e[_0xb3c8('0x53')][_0xb3c8('0x8e')]]);}else if(_0x4e3d8e[_0xb3c8('0x53')][_0xb3c8('0xe1')]){_0x120b60=util['format'](_0xb3c8('0xe2'),_0x4e3d8e[_0xb3c8('0x53')]['intrf']);}else{_0x120b60=util[_0xb3c8('0x99')]('SIP/%s',_0x236ced[_0xb3c8('0x26')]);}socket['to'](util[_0xb3c8('0x99')]('user:%s',_0x236ced[_0xb3c8('0x26')]))[_0xb3c8('0x1c')]('user:forcelogout',{'user':{'id':_0x236ced['id'],'name':_0x236ced[_0xb3c8('0x26')]},'ip':_0x4e3d8e[_0xb3c8('0xe3')][_0xb3c8('0xe4')]||_0x4e3d8e[_0xb3c8('0xe5')][_0xb3c8('0xe6')]||_0x4e3d8e[_0xb3c8('0xe7')][_0xb3c8('0xe6')]||_0x4e3d8e[_0xb3c8('0xe5')][_0xb3c8('0xe7')]['remoteAddress']});return db[_0xb3c8('0xa2')][_0xb3c8('0x28')]({'where':{'membername':_0x236ced[_0xb3c8('0x26')]},'individualHooks':!![]});}}else{throw new db[(_0xb3c8('0x80'))][(_0xb3c8('0x82'))](_0xb3c8('0xe8'));}})[_0xb3c8('0x1d')](function(){if(_0x236ced){return _0x236ced[_0xb3c8('0xe9')]({'raw':!![]});}})[_0xb3c8('0x1d')](function(_0x2704f6){if(_0x236ced){if(_0x2704f6){_0xc73a28=_0x2704f6;if(_0xc73a28[_0xb3c8('0x42')]){var _0x36b1b1=_0xc73a28[_0xb3c8('0x30')](function(_0x1e7eae){var _0x3d1505={'membername':_0x236ced['name'],'UserId':_0x236ced['id'],'queue_name':_0x1e7eae[_0xb3c8('0x26')],'VoiceQueueId':_0x1e7eae['id'],'interface':_0x120b60,'paused':_0x236ced[_0xb3c8('0x8d')]||![],'penalty':_0x1e7eae[_0xb3c8('0xea')]||0x0};return db['UserVoiceQueueRt'][_0xb3c8('0x9b')](_0x3d1505);});return Promise[_0xb3c8('0x4a')](_0x36b1b1);}}}})[_0xb3c8('0x1d')](function(){if(_0x236ced){return db[_0xb3c8('0xeb')][_0xb3c8('0x7c')]({'where':{'membername':_0x236ced[_0xb3c8('0x26')],'exitAt':null}});}})['then'](function(_0x2419a8){if(_0x236ced){var _0x25e49e=[];_0x2419a8[_0xb3c8('0xec')](function(_0x47c528){_0x25e49e[_0xb3c8('0x3f')](_0x47c528[_0xb3c8('0x19')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xb3c8('0x4a')](_0x25e49e);}})[_0xb3c8('0x1d')](function(){if(_0x236ced){var _0x4682d5=[];var _0x30bf74=[];var _0x1ffb06=utils[_0xb3c8('0xed')]();var _0xc5eae4={'membername':_0x236ced[_0xb3c8('0x26')],'interface':_0x120b60,'enterAt':moment()[_0xb3c8('0x99')](_0xb3c8('0xee')),'role':_0x236ced['role'],'internal':_0x236ced['internal']};_0x1ffb06[_0xb3c8('0xec')](function(_0x5ada64){_0x4682d5[_0xb3c8('0x3f')](_['merge']({'channel':_0x5ada64,'type':_0xb3c8('0xef'),'data1':_0x4e3d8e[_0xb3c8('0x53')][_0xb3c8('0xf0')],'data2':_0x120b60},_0xc5eae4));if(_0x236ced[_0xb3c8('0x8d')]){_0x30bf74[_0xb3c8('0x3f')](_['merge']({'channel':_0x5ada64,'type':_0xb3c8('0xf1'),'data1':_0xb3c8('0xf2')},_0xc5eae4));}});return db[_0xb3c8('0xeb')][_0xb3c8('0x78')](_0x4682d5[_0xb3c8('0xb9')](_0x30bf74),{'individualHooks':!![]});}})[_0xb3c8('0x1d')](function(){if(_0x236ced){return _0x236ced[_0xb3c8('0x19')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x236ced[_0xb3c8('0x8d')]||![],'mailPause':_0x236ced[_0xb3c8('0x8d')]||![],'chatPause':_0x236ced[_0xb3c8('0x8d')]||![],'faxPause':_0x236ced[_0xb3c8('0x8d')]||![],'smsPause':_0x236ced[_0xb3c8('0x8d')]||![],'openchannelPause':_0x236ced['loginInPause']||![],'whatsappPause':_0x236ced[_0xb3c8('0x8d')]||![],'pauseType':_0x236ced[_0xb3c8('0x8d')]?_0xb3c8('0xf2'):null,'interface':_0x120b60,'lastPauseAt':moment()['format'](_0xb3c8('0xee'))});}})[_0xb3c8('0x1d')](function(_0x12957e){if(_0x4e3d8e[_0xb3c8('0xf3')]){return _0x697397();}else{return Promise['resolve'](_0x12957e)['then'](respondWithResult(_0x508174,null));}})[_0xb3c8('0x4b')](handleError(_0x508174,null));};exports[_0xb3c8('0xf4')]=function(_0xd1afb3,_0x2606c2){var _0x13027e;return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0xd1afb3[_0xb3c8('0x4c')]['id'],'role':_0xb3c8('0x1b')},'attributes':['id',_0xb3c8('0x26'),'role']})['then'](handleEntityNotFound(_0x2606c2,null))[_0xb3c8('0x1d')](function(_0x5d53c8){if(_0x5d53c8){_0x13027e=_0x5d53c8;return db[_0xb3c8('0xa2')][_0xb3c8('0x28')]({'where':{'membername':_0x13027e['name']},'individualHooks':!![]});}})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0xeb')][_0xb3c8('0x7c')]({'where':{'membername':_0x13027e[_0xb3c8('0x26')],'exitAt':null}});})['then'](function(_0x2f6365){var _0x441592=[];_0x2f6365['forEach'](function(_0x2c55ba){_0x441592[_0xb3c8('0x3f')](_0x2c55ba[_0xb3c8('0x19')]({'exitAt':moment()[_0xb3c8('0x99')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xb3c8('0x4a')](_0x441592);})[_0xb3c8('0x1d')](function(){return _0x13027e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb3c8('0x1d')](respondWithResult(_0x2606c2,null))[_0xb3c8('0x4b')](handleError(_0x2606c2,null));};exports[_0xb3c8('0xf5')]=function(_0x2466ec,_0x4f0bed){var _0x519c76;return db[_0xb3c8('0xa2')][_0xb3c8('0x19')]({'paused':0x1},{'where':{'UserId':_0x2466ec['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x2466ec[_0xb3c8('0x4c')]['id'],'role':_0xb3c8('0x1b')},'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x1a'),_0xb3c8('0x58'),'interface',_0xb3c8('0x8c')]});})[_0xb3c8('0x1d')](handleEntityNotFound(_0x4f0bed,null))[_0xb3c8('0x1d')](function(_0x5b48d9){if(_0x5b48d9){_0x519c76=_0x5b48d9;return db[_0xb3c8('0xeb')][_0xb3c8('0x7c')]({'where':{'membername':_0x519c76[_0xb3c8('0x26')],'type':_0xb3c8('0xf1'),'exitAt':null}});}})[_0xb3c8('0x1d')](function(_0x2f4354){if(_0x2f4354[_0xb3c8('0x42')]){var _0x2a28ee=moment()[_0xb3c8('0x99')](_0xb3c8('0xee'));for(var _0x23833b=0x0,_0x405c7f=_0x2f4354[_0xb3c8('0x42')];_0x23833b<_0x405c7f;_0x23833b++){_0x2f4354[_0x23833b]['updateAttributes']({'exitAt':_0x2a28ee});}}})[_0xb3c8('0x1d')](function(){var _0x22854c=[];var _0x223f42=utils[_0xb3c8('0xed')]();_0x223f42[_0xb3c8('0xec')](function(_0x213d09){_0x22854c[_0xb3c8('0x3f')]({'channel':_0x213d09,'membername':_0x519c76[_0xb3c8('0x26')],'interface':_[_0xb3c8('0x5e')](_0x519c76[_0xb3c8('0x8e')])?util[_0xb3c8('0x99')](_0xb3c8('0xe2'),_0x519c76[_0xb3c8('0x26')]):_0x519c76[_0xb3c8('0x8e')],'type':_0xb3c8('0xf1'),'enterAt':moment()[_0xb3c8('0x99')](_0xb3c8('0xee')),'data1':_0x2466ec[_0xb3c8('0x53')][_0xb3c8('0x32')]||_0xb3c8('0xf6'),'role':_0x519c76[_0xb3c8('0x1a')],'internal':_0x519c76[_0xb3c8('0x58')]});});return db[_0xb3c8('0xeb')][_0xb3c8('0x78')](_0x22854c,{'individualHooks':!![]});})[_0xb3c8('0x1d')](function(){return _0x519c76['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2466ec[_0xb3c8('0x53')][_0xb3c8('0x32')]||_0xb3c8('0xf6'),'lastPauseAt':moment()[_0xb3c8('0x99')](_0xb3c8('0xee'))});})[_0xb3c8('0x1d')](respondWithResult(_0x4f0bed,null))['catch'](handleError(_0x4f0bed,null));};exports[_0xb3c8('0xf7')]=function(_0x1c953c,_0x43e19c){if(_0x1c953c[_0xb3c8('0x53')][_0xb3c8('0x9d')]&&!utils[_0xb3c8('0x9e')](_0x1c953c[_0xb3c8('0x53')][_0xb3c8('0x9d')])){throw new APIBadRequestError(util[_0xb3c8('0x99')](_0xb3c8('0xf8'),_0x1c953c[_0xb3c8('0x53')][_0xb3c8('0x9d')]));}return db[_0xb3c8('0x2e')][_0xb3c8('0x25')]({'where':{'id':_0x1c953c[_0xb3c8('0x4c')]['id']},'attributes':['id','name','role',_0xb3c8('0x58'),_0xb3c8('0x8e'),_0xb3c8('0x8c'),'voicePause',_0xb3c8('0xf9'),'chatPause','faxPause',_0xb3c8('0xfa'),_0xb3c8('0xfb'),_0xb3c8('0xfc'),'pauseType','lastPauseAt']})[_0xb3c8('0x1d')](function(_0x238343){if(!_0x238343){throw new APINotFoundError(util['format'](_0xb3c8('0xbb'),_0x1c953c[_0xb3c8('0x4c')]['id']));}return _0x238343[_0xb3c8('0xf7')](_0x1c953c[_0xb3c8('0x53')]['channel']);})['then'](respondWithResult(_0x43e19c,null))[_0xb3c8('0x4b')](APIHandleError(_0x43e19c));};exports[_0xb3c8('0xfd')]=function(_0x9b8aec,_0x376b0b){var _0x2a52b7={};var _0x34beed={};var _0x1c4fd7;var _0x787280;return db[_0xb3c8('0x2e')]['findOne']({'where':{'id':_0x9b8aec[_0xb3c8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x376b0b,null))['then'](function(_0xf161d9){if(_0xf161d9){_0x1c4fd7=_0xf161d9;_0x34beed[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db[_0xb3c8('0xfe')][_0xb3c8('0x2f')]);_0x34beed[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0x9b8aec[_0xb3c8('0x3b')]);_0x34beed[_0xb3c8('0xc7')]=_['intersection'](_0x34beed[_0xb3c8('0xc4')],_0x34beed[_0xb3c8('0x3b')]);_0x2a52b7[_0xb3c8('0x3e')]=_['intersection'](_0x34beed[_0xb3c8('0xc4')],qs[_0xb3c8('0xc9')](_0x9b8aec[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x2a52b7[_0xb3c8('0x3e')]=_0x2a52b7[_0xb3c8('0x3e')]['length']?_0x2a52b7[_0xb3c8('0x3e')]:_0x34beed['model'];_0x2a52b7[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x9b8aec[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x2a52b7[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x9b8aec[_0xb3c8('0x3b')],_0x34beed['filters']));if(_0x9b8aec['query'][_0xb3c8('0x23')]){_0x2a52b7['where']=_[_0xb3c8('0x50')](_0x2a52b7[_0xb3c8('0x3a')],{'$or':_['map'](_0x2a52b7[_0xb3c8('0x3e')],function(_0x7ed8c6){var _0x648009={};_0x648009[_0x7ed8c6]={'$like':'%'+_0x9b8aec[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x648009;})});}_0x2a52b7=_[_0xb3c8('0x50')]({},_0x2a52b7,_0x9b8aec[_0xb3c8('0x51')]);return _0x1c4fd7[_0xb3c8('0xfd')](_0x2a52b7);}})[_0xb3c8('0x1d')](function(_0x5aed65){if(_0x5aed65){_0x787280=_0x5aed65['length'];if(!_0x9b8aec[_0xb3c8('0x3b')]['hasOwnProperty'](_0xb3c8('0xcd'))){_0x2a52b7['limit']=qs[_0xb3c8('0x15')](_0x9b8aec['query'][_0xb3c8('0x15')]);_0x2a52b7['offset']=qs[_0xb3c8('0x13')](_0x9b8aec[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}return _0x1c4fd7[_0xb3c8('0xfd')](_0x2a52b7);}})[_0xb3c8('0x1d')](function(_0x4d9856){if(_0x4d9856){return _0x4d9856?{'count':_0x787280,'rows':_0x4d9856}:null;}})[_0xb3c8('0x1d')](respondWithResult(_0x376b0b,null))['catch'](handleError(_0x376b0b,null));};exports[_0xb3c8('0xff')]=function(_0x2310e3,_0xddbc79){var _0x5311f6=_0x2310e3[_0xb3c8('0x4c')]['id'];var _0x52c251=_0x2310e3['body']?_0x2310e3[_0xb3c8('0x53')][_0xb3c8('0x56')]:null;var _0x31d404=[];return Promise[_0xb3c8('0x100')]()[_0xb3c8('0x1d')](function(){if(!_0x52c251)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x5311f6}});})[_0xb3c8('0x1d')](function(_0x314828){if(!_0x314828)throw new APINotFoundError(util[_0xb3c8('0x99')](_0xb3c8('0xbb'),_0x2310e3['params']['id']));return db[_0xb3c8('0x60')][_0xb3c8('0x101')](function(_0x59f083){return _0x314828[_0xb3c8('0xff')](_0x52c251,{'transaction':_0x59f083})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0xfe')][_0xb3c8('0x7c')]({'where':{'id':{'$in':_0x52c251}}});})[_0xb3c8('0x1d')](function(_0x154181){var _0x24a065=_[_0xb3c8('0x30')](_0x154181,function(_0x4bde7c){return _0x4bde7c[_0xb3c8('0x102')]();});return Promise[_0xb3c8('0x4a')](_0x24a065);})[_0xb3c8('0x1d')](function(_0x1ac193){_0x31d404=_[_0xb3c8('0x103')](_0x1ac193);var _0x30faa2=_['map'](_0x31d404,function(_0x24c6a3){return _0x24c6a3[_0xb3c8('0x104')](_0x314828['id'],{'transaction':_0x59f083});});return Promise['all'](_0x30faa2);})[_0xb3c8('0x1d')](function(){if(!_0x314828[_0xb3c8('0x8c')])return;var _0x474e7e=_[_0xb3c8('0x23')](_0x31d404,function(_0x3b6121){return _0x3b6121[_0xb3c8('0x105')](_0xb3c8('0x9d'))===_0xb3c8('0x106');});var _0x3153af=_['map'](_0x474e7e,function(_0x5c5c27){return db[_0xb3c8('0xa2')][_0xb3c8('0x9b')]({'membername':_0x314828[_0xb3c8('0x26')],'UserId':_0x314828['id'],'queue_name':_0x5c5c27[_0xb3c8('0x26')],'VoiceQueueId':_0x5c5c27['id'],'interface':_['isNil'](_0x314828['interface'])?util[_0xb3c8('0x99')]('SIP/%s',_0x314828[_0xb3c8('0x26')]):_0x314828[_0xb3c8('0x8e')],'paused':_0x314828[_0xb3c8('0x9a')]||![],'penalty':_0x314828[_0xb3c8('0x94')]},{'transaction':_0x59f083});});return Promise[_0xb3c8('0x4a')](_0x3153af);})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0x107')][_0xb3c8('0x7c')]({'where':{'teamId':{'$in':_0x52c251}}});})[_0xb3c8('0x1d')](function(_0x245028){var _0x3ea086=_[_0xb3c8('0x30')](_0x245028,function(_0x48cda9){return db['UserVoicePrefix'][_0xb3c8('0x6e')]({'UserId':_0x314828['id'],'VoicePrefixId':_0x48cda9[_0xb3c8('0x108')]},{'transaction':_0x59f083});});return Promise['all'](_0x3ea086);});});})['then'](function(){for(var _0x36951b=0x0;_0x36951b<_0x31d404[_0xb3c8('0x42')];_0x36951b++){var _0xa02cd6=_0x31d404[_0x36951b]['getDataValue']('channel');var _0x169095=_0xa02cd6+_0xb3c8('0x95');socket[_0xb3c8('0x1c')]('user'+_0xa02cd6+_0xb3c8('0x96'),{'UserId':_0x5311f6,['queueField']:_0x31d404[_0x36951b]['id']});}})[_0xb3c8('0x1d')](respondWithStatusCode(_0xddbc79,null))[_0xb3c8('0x4b')](APIHandleError(_0xddbc79));};exports[_0xb3c8('0x109')]=function(_0x5d07d1,_0x116d14){var _0xfd0469=_0x5d07d1[_0xb3c8('0x4c')]['id'];var _0x572e60=null;if(_0x5d07d1['query'][_0xb3c8('0x56')]){_0x572e60=_['isArray'](_0x5d07d1[_0xb3c8('0x3b')][_0xb3c8('0x56')])?_0x5d07d1[_0xb3c8('0x3b')][_0xb3c8('0x56')]:[_0x5d07d1[_0xb3c8('0x3b')][_0xb3c8('0x56')]];}var _0x2690d7=[];return Promise[_0xb3c8('0x100')]()['then'](function(){if(!_0x572e60)throw new APIBadRequestError(_0xb3c8('0x10a'));})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0xfd0469}});})['then'](function(_0x2140cd){if(!_0x2140cd)throw new APINotFoundError(util[_0xb3c8('0x99')](_0xb3c8('0xbb'),_0x5d07d1[_0xb3c8('0x4c')]['id']));return db['sequelize']['transaction'](function(_0x4f5da3){return _0x2140cd[_0xb3c8('0x109')](_0x572e60,{'transaction':_0x4f5da3})[_0xb3c8('0x1d')](function(){return db[_0xb3c8('0xfe')][_0xb3c8('0x7c')]({'where':{'id':{'$in':_0x572e60}}});})[_0xb3c8('0x1d')](function(_0x5e760b){var _0x2d2932=_[_0xb3c8('0x30')](_0x5e760b,function(_0x2a921c){return _0x2a921c[_0xb3c8('0x102')]();});return Promise[_0xb3c8('0x4a')](_0x2d2932);})[_0xb3c8('0x1d')](function(_0xc09198){_0x2690d7=_[_0xb3c8('0x103')](_0xc09198);var _0x1cc3dd=_['map'](_0x2690d7,function(_0x52824c){return _0x52824c[_0xb3c8('0x10b')](_0x2140cd['id'],{'transaction':_0x4f5da3});});return Promise[_0xb3c8('0x4a')](_0x1cc3dd);})[_0xb3c8('0x1d')](function(){if(!_0x2140cd['online'])return;var _0x21f7f1=_['filter'](_0x2690d7,function(_0x311641){return _0x311641[_0xb3c8('0x105')](_0xb3c8('0x9d'))==='Voice';});var _0x2f50a2=_[_0xb3c8('0x30')](_0x21f7f1,function(_0x102644){return db[_0xb3c8('0xa2')][_0xb3c8('0x28')]({'where':{'VoiceQueueId':_0x102644['id'],'UserId':_0x2140cd['id']},'transaction':_0x4f5da3});});return Promise['all'](_0x2f50a2);})['then'](function(){return db[_0xb3c8('0x107')][_0xb3c8('0x7c')]({'where':{'teamId':{'$in':_0x572e60}}});})[_0xb3c8('0x1d')](function(_0x149efa){var _0x4fcad4=_[_0xb3c8('0x30')](_0x149efa,function(_0x2c49b7){return db['UserVoicePrefix'][_0xb3c8('0x28')]({'where':{'UserId':_0x2140cd['id'],'VoicePrefixId':_0x2c49b7['VoicePrefixId']}},{'transaction':_0x4f5da3});});return Promise['all'](_0x4fcad4);});});})[_0xb3c8('0x1d')](function(){for(var _0x5249a3=0x0;_0x5249a3<_0x2690d7[_0xb3c8('0x42')];_0x5249a3++){var _0x1a5048=_0x2690d7[_0x5249a3][_0xb3c8('0x105')](_0xb3c8('0x9d'));var _0x4b7446=_0x1a5048+'QueueId';socket['emit']('user'+_0x1a5048+'Queue:remove',{'UserId':_0xfd0469,['queueField']:_0x2690d7[_0x5249a3]['id']});}})[_0xb3c8('0x1d')](respondWithStatusCode(_0x116d14,null))[_0xb3c8('0x4b')](APIHandleError(_0x116d14));};exports[_0xb3c8('0x10c')]=function(_0x3a9827,_0x35358c){var _0x5a5c59={};var _0x5d990a={};var _0x2f6ede;var _0x21d5a4;return db[_0xb3c8('0x2e')][_0xb3c8('0x88')]({'where':{'id':_0x3a9827[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x35358c,null))[_0xb3c8('0x1d')](function(_0x1ce34c){if(_0x1ce34c){_0x2f6ede=_0x1ce34c;_0x5d990a[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db[_0xb3c8('0xbd')][_0xb3c8('0x2f')]);_0x5d990a['query']=_[_0xb3c8('0xc5')](_0x3a9827[_0xb3c8('0x3b')]);_0x5d990a['filters']=_['intersection'](_0x5d990a[_0xb3c8('0xc4')],_0x5d990a[_0xb3c8('0x3b')]);_0x5a5c59['attributes']=_[_0xb3c8('0xc8')](_0x5d990a[_0xb3c8('0xc4')],qs['fields'](_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x5a5c59[_0xb3c8('0x3e')]=_0x5a5c59[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x5a5c59[_0xb3c8('0x3e')]:_0x5d990a[_0xb3c8('0xc4')];_0x5a5c59[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x5a5c59['where']=qs[_0xb3c8('0xc7')](_['pick'](_0x3a9827['query'],_0x5d990a[_0xb3c8('0xc7')]));if(_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0x23')]){_0x5a5c59[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x5a5c59['where'],{'$or':_[_0xb3c8('0x30')](_0x5a5c59['attributes'],function(_0x2f3215){var _0x18b5a5={};_0x18b5a5[_0x2f3215]={'$like':'%'+_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0x23')]+'%'};return _0x18b5a5;})});}_0x5a5c59=_['merge']({},_0x5a5c59,_0x3a9827['options']);return _0x2f6ede['getLists'](_0x5a5c59);}})[_0xb3c8('0x1d')](function(_0x4e2926){if(_0x4e2926){_0x21d5a4=_0x4e2926[_0xb3c8('0x42')];if(!_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0xbc')](_0xb3c8('0xcd'))){_0x5a5c59[_0xb3c8('0x15')]=qs['limit'](_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0x15')]);_0x5a5c59['offset']=qs['offset'](_0x3a9827[_0xb3c8('0x3b')][_0xb3c8('0x13')]);}return _0x2f6ede['getLists'](_0x5a5c59);}})[_0xb3c8('0x1d')](function(_0x99ac82){if(_0x99ac82){return _0x99ac82?{'count':_0x21d5a4,'rows':_0x99ac82}:null;}})['then'](respondWithResult(_0x35358c,null))[_0xb3c8('0x4b')](handleError(_0x35358c,null));};exports[_0xb3c8('0x10d')]=function(_0x1561f7,_0x5ba362){var _0x2e11d5={};var _0x45c861={};var _0x3c8b18;return db['User'][_0xb3c8('0x88')]({'where':{'id':_0x1561f7[_0xb3c8('0x4c')]['id']}})[_0xb3c8('0x1d')](handleEntityNotFound(_0x5ba362,null))['then'](function(_0x3eb272){if(_0x3eb272){_0x3c8b18=_0x3eb272;_0x45c861[_0xb3c8('0xc4')]=_[_0xb3c8('0xc5')](db[_0xb3c8('0x2e')][_0xb3c8('0x2f')]);_0x45c861[_0xb3c8('0x3b')]=_[_0xb3c8('0xc5')](_0x1561f7[_0xb3c8('0x3b')]);_0x45c861[_0xb3c8('0xc7')]=_[_0xb3c8('0xc8')](_0x45c861[_0xb3c8('0xc4')],_0x45c861['query']);_0x2e11d5[_0xb3c8('0x3e')]=_[_0xb3c8('0xc8')](_0x45c861['model'],qs['fields'](_0x1561f7[_0xb3c8('0x3b')][_0xb3c8('0xc9')]));_0x2e11d5[_0xb3c8('0x3e')]=_0x2e11d5[_0xb3c8('0x3e')][_0xb3c8('0x42')]?_0x2e11d5[_0xb3c8('0x3e')]:_0x45c861[_0xb3c8('0xc4')];_0x2e11d5[_0xb3c8('0xca')]=qs[_0xb3c8('0xcb')](_0x1561f7[_0xb3c8('0x3b')][_0xb3c8('0xcb')]);_0x2e11d5[_0xb3c8('0x3a')]=qs[_0xb3c8('0xc7')](_[_0xb3c8('0xd0')](_0x1561f7[_0xb3c8('0x3b')],_0x45c861[_0xb3c8('0xc7')]));if(_0x1561f7[_0xb3c8('0x3b')][_0xb3c8('0x23')]){_0x2e11d5[_0xb3c8('0x3a')]=_[_0xb3c8('0x50')](_0x2e11d5['where'],{'$or':_[_0xb3c8('0x30')](_0x2e11d5['attributes'],function(_0x3cf563){var _0xe2fcb2={};_0xe2fcb2[_0x3cf563]={'$like':'%'+_0x1561f7[_0xb3c8('0x3b')]['filter']+'%'};return _0xe2fcb2;})});}_0x2e11d5['model']=db['User'];_0x2e11d5['as']=_0xb3c8('0x22');_0x2e11d5=_[_0xb3c8('0x50')]({},_0x2e11d5,_0x1561f7[_0xb3c8('0x51')]);return _0x3c8b18[_0xb3c8('0xe9')]({'include':[_0x2e11d5]});}})[_0xb3c8('0x1d')](function(_0x43d750){if(_0x43d750){var _0x30508a={},_0x10a9e1=[];for(var _0x43b649=0x0;_0x43b649<_0x43d750[_0xb3c8('0x42')];_0x43b649+=0x1){for(var _0xa35bd0=0x0,_0x36940c;_0xa35bd0<_0x43d750[_0x43b649][_0xb3c8('0x22')][_0xb3c8('0x42')];_0xa35bd0+=0x1){_0x36940c=_0x43d750[_0x43b649]['Agents'][_0xa35bd0][_0xb3c8('0x1e')]({'plain':!![]});_0x30508a[_0x36940c['id']]=_0x36940c;}}_0x30508a=_['values'](_0x30508a);for(var _0x54c012=qs[_0xb3c8('0x13')](_0x1561f7[_0xb3c8('0x3b')][_0xb3c8('0x13')]);_0x54c012<_0x30508a[_0xb3c8('0x42')]&&_0x10a9e1[_0xb3c8('0x42')]=_0x50f101){_0x443826=_0x50f101;_0x1f5979=0xc8;}else{_0x1f5979=0xce;}_0x246c1f['status'](_0x1f5979);return _0x246c1f[_0x83ac('0x1a')]('Content-Range',_0x2e40a4+'-'+_0x443826+'/'+_0x50f101)[_0x83ac('0x15')](_0x466389);}return null;};}function saveUpdates(_0x32ef9a){return function(_0x6951ee){if(_0x6951ee){return _0x6951ee['update'](_0x32ef9a)['then'](function(_0x2f6914){if(_0x2f6914[_0x83ac('0x1b')]==='agent'){socket[_0x83ac('0x1c')](_0x83ac('0x1d')+_0x2f6914['id'],_0x2f6914);}return _0x2f6914;});}return null;};}function removeEntity(_0x4562b9){return function(_0x578413){if(_0x578413){return _0x578413['destroy']()[_0x83ac('0x1e')](function(){var _0xe5278e=_0x578413[_0x83ac('0x1f')]({'plain':!![]});if(_0xe5278e[_0x83ac('0x1b')]===_0x83ac('0x20'))return;var _0x4670ea=[{'name':_0x83ac('0x21'),'value':'user','ignore':!![]},{'name':_0x83ac('0x22'),'value':_0x83ac('0x23'),'ignore':![]},{'name':_0x83ac('0x24'),'value':'telephone','ignore':![]}];var _0x2d7d47=_(_0x4670ea)[_0x83ac('0x25')](_0x83ac('0x26'))['map'](_0x83ac('0x27'))['value']();if(_['includes'](_0x2d7d47,_0xe5278e[_0x83ac('0x1b')])){return;}var _0x3201b7=_[_0x83ac('0x28')](_0x4670ea,[_0x83ac('0x27'),_0xe5278e['role']])['name'];return db[_0x83ac('0x29')]['destroy']({'where':{'type':_0x3201b7,'resourceId':_0xe5278e['id']}})[_0x83ac('0x1e')](function(){return _0x578413;});})[_0x83ac('0x1e')](function(){_0x4562b9[_0x83ac('0x13')](0xcc)[_0x83ac('0x14')]();});}};}function handleEntityNotFound(_0x20683e){return function(_0x5b16e8){if(!_0x5b16e8){_0x20683e[_0x83ac('0x2a')](0x194);}return _0x5b16e8;};}function handleError(_0x4515d7,_0x5ba546){_0x5ba546=_0x5ba546||0x1f4;return function(_0xf0035){logger[_0x83ac('0x2b')](_0xf0035[_0x83ac('0x2c')]);if(_0xf0035[_0x83ac('0x2d')]){delete _0xf0035[_0x83ac('0x2d')];}_0x4515d7['status'](_0x5ba546)['send'](_0xf0035);};}function getUserAttributes(){return _(db[_0x83ac('0x2e')][_0x83ac('0x2f')])[_0x83ac('0x30')](function(_0x16b518){return{'name':_0x16b518['fieldName'],'type':_0x16b518[_0x83ac('0x31')]['key']};})[_0x83ac('0x25')](function(_0x389823){return![_0x83ac('0x32'),'salt',_0x83ac('0x33'),_0x83ac('0x34'),_0x83ac('0x35'),_0x83ac('0x36')][_0x83ac('0x37')](_0x389823[_0x83ac('0x2d')]);})[_0x83ac('0x27')]();}exports[_0x83ac('0x38')]=function(_0x273a70,_0xd3e94c){var _0x42f776={},_0x186b85={'count':0x0,'rows':[]};var _0x9c4bd9=getUserAttributes();_0x42f776=qs[_0x83ac('0x39')](_0x9c4bd9,_0x273a70);var _0x1a8c55={'where':_0x42f776[_0x83ac('0x3a')]};return db['User'][_0x83ac('0x19')](_0x1a8c55)[_0x83ac('0x1e')](function(_0x4533ee){_0x186b85[_0x83ac('0x19')]=_0x4533ee;if(_0x273a70[_0x83ac('0x3b')][_0x83ac('0x3c')]){_0x42f776[_0x83ac('0x3d')]=[{'all':!![]}];}if(_0x273a70[_0x83ac('0x3b')][_0x83ac('0x3e')]===_0x83ac('0x3f')){_0x42f776[_0x83ac('0x3d')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x83ac('0x37')](_0x42f776[_0x83ac('0x40')],'id')){_0x42f776[_0x83ac('0x40')][_0x83ac('0x41')]('id');}return db[_0x83ac('0x2e')]['findAll'](_0x42f776);})['then'](function(_0x2a058d){_0x186b85['rows']=_0x2a058d;if(_0x273a70[_0x83ac('0x3b')][_0x83ac('0x42')]===_0x83ac('0x3f')){var _0x1875bc=[];for(var _0x599f94=0x0;_0x599f94<_0x186b85[_0x83ac('0x43')][_0x83ac('0x44')];_0x599f94++){_0x1875bc['push'](get_open_tabs('chat',_0x186b85['rows'][_0x599f94][_0x83ac('0x45')]));_0x1875bc[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x46'),_0x186b85[_0x83ac('0x43')][_0x599f94][_0x83ac('0x45')]));_0x1875bc[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x47'),_0x186b85[_0x83ac('0x43')][_0x599f94]['dataValues']));_0x1875bc[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x48'),_0x186b85[_0x83ac('0x43')][_0x599f94][_0x83ac('0x45')]));_0x1875bc['push'](get_open_tabs(_0x83ac('0x49'),_0x186b85['rows'][_0x599f94][_0x83ac('0x45')]));_0x1875bc[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x4a'),_0x186b85[_0x83ac('0x43')][_0x599f94][_0x83ac('0x45')]));}return Promise['all'](_0x1875bc)[_0x83ac('0x1e')](function(){return _0x186b85;});}else{return _0x186b85;}})[_0x83ac('0x1e')](respondWithFilteredResult(_0xd3e94c,_0x42f776))[_0x83ac('0x4b')](handleError(_0xd3e94c,null));};exports[_0x83ac('0x4c')]=function(_0x263a3c,_0xbfb831){var _0xda439a=getUserAttributes();_0x263a3c[_0x83ac('0x3b')]['id']=_0x263a3c[_0x83ac('0x4d')]['id'];var _0x21b035=qs[_0x83ac('0x39')](_0xda439a,_0x263a3c);if(_0x263a3c[_0x83ac('0x3b')][_0x83ac('0x3c')]){_0x21b035[_0x83ac('0x3d')]=[{'all':!![]}];}if(_0x263a3c['query'][_0x83ac('0x3e')]==='true'){_0x21b035[_0x83ac('0x3d')]=[{'model':db[_0x83ac('0x4e')],'as':_0x83ac('0x3e')}];}_0x21b035=_[_0x83ac('0x4f')]({},_0x21b035,_0x263a3c[_0x83ac('0x50')]);if(!_[_0x83ac('0x37')](_0x21b035['attributes'],'id')){_0x21b035[_0x83ac('0x40')][_0x83ac('0x41')]('id');}return db[_0x83ac('0x2e')][_0x83ac('0x28')](_0x21b035)['then'](handleEntityNotFound(_0xbfb831,null))[_0x83ac('0x1e')](function(_0x515e46){var _0x13b1ca=[];values=_0x515e46;if(_0x263a3c[_0x83ac('0x3b')][_0x83ac('0x42')]==='true'){_0x13b1ca[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x51'),_0x515e46[_0x83ac('0x45')]));_0x13b1ca['push'](get_open_tabs(_0x83ac('0x46'),_0x515e46[_0x83ac('0x45')]));_0x13b1ca[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x49'),_0x515e46[_0x83ac('0x45')]));_0x13b1ca['push'](get_open_tabs(_0x83ac('0x4a'),_0x515e46['dataValues']));_0x13b1ca[_0x83ac('0x41')](get_open_tabs('fax',_0x515e46[_0x83ac('0x45')]));_0x13b1ca[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x48'),_0x515e46[_0x83ac('0x45')]));return Promise['all'](_0x13b1ca);}else{return values;}})[_0x83ac('0x1e')](function(){return values;})[_0x83ac('0x1e')](respondWithResult(_0xbfb831,null))['catch'](handleError(_0xbfb831,null));};exports['update']=function(_0x1647d7,_0x4f1fb7){if(_0x1647d7[_0x83ac('0x52')]['id']){delete _0x1647d7[_0x83ac('0x52')]['id'];}delete _0x1647d7[_0x83ac('0x52')][_0x83ac('0x1b')];return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x1647d7['params']['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x4f1fb7,null))['then'](saveUpdates(_0x1647d7[_0x83ac('0x52')],null))[_0x83ac('0x1e')](respondWithResult(_0x4f1fb7,null))[_0x83ac('0x4b')](handleError(_0x4f1fb7,null));};exports[_0x83ac('0x53')]=function(_0x5b5e03,_0x3501e6){return db[_0x83ac('0x2e')][_0x83ac('0x53')]()[_0x83ac('0x1e')](respondWithResult(_0x3501e6,null))[_0x83ac('0x4b')](handleError(_0x3501e6,null));};exports[_0x83ac('0x54')]=function(_0x5e2670,_0x354a85){return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x5e2670[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x354a85,null))[_0x83ac('0x1e')](function(_0x13c075){if(_0x13c075){return _0x13c075[_0x83ac('0x54')](_0x5e2670[_0x83ac('0x52')][_0x83ac('0x55')],_[_0x83ac('0x56')](_0x5e2670[_0x83ac('0x52')],[_0x83ac('0x55'),'id'])||{});}})[_0x83ac('0x1e')](respondWithResult(_0x354a85,null))[_0x83ac('0x4b')](handleError(_0x354a85,null));};function validateUser(_0x57bfdf){return new Promise(function(_0x2036a4,_0x37f1a0){if(_0x57bfdf[_0x83ac('0x57')])return _0x2036a4(_0x57bfdf);return db[_0x83ac('0x58')][_0x83ac('0x59')](0x1)[_0x83ac('0x1e')](function(_0x5ca20e){if(_0x5ca20e['securePassword'])authService['validatePasswordPattern'](_0x57bfdf[_0x83ac('0x32')]);db['User'][_0x83ac('0x5a')](_0x83ac('0x57'))[_0x83ac('0x1e')](function(_0x39e2e9){if(_[_0x83ac('0x5b')](_0x39e2e9)){_0x57bfdf[_0x83ac('0x57')]=_0x5ca20e['min_internal']||0x1;return;}if(_[_0x83ac('0x5b')](_0x5ca20e[_0x83ac('0x5c')])||_0x5ca20e[_0x83ac('0x5c')]===_0x39e2e9){_0x57bfdf[_0x83ac('0x57')]=_0x39e2e9+0x1;return;}if(_0x5ca20e['min_internal']>_0x39e2e9){_0x57bfdf[_0x83ac('0x57')]=_0x5ca20e[_0x83ac('0x5c')];return;}return db['sequelize'][_0x83ac('0x3b')]('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[_0x83ac('0x5d')][_0x83ac('0x5e')][_0x83ac('0x5f')]})[_0x83ac('0x1e')](function(_0x2ce9a4){if(_0x2ce9a4&&_0x2ce9a4[_0x83ac('0x44')]){for(var _0x5a9cc0=0x0,_0x4fdf2b=_0x2ce9a4[_0x83ac('0x44')];_0x5a9cc0<_0x4fdf2b&&_[_0x83ac('0x5b')](_0x57bfdf[_0x83ac('0x57')]);_0x5a9cc0++){if(_0x5ca20e[_0x83ac('0x5c')]<=_0x2ce9a4[_0x5a9cc0][_0x83ac('0x60')]){_0x57bfdf[_0x83ac('0x57')]=_0x2ce9a4[_0x5a9cc0][_0x83ac('0x60')];}else if(_0x5ca20e[_0x83ac('0x5c')]>_0x2ce9a4[_0x5a9cc0][_0x83ac('0x60')]&&_0x5ca20e[_0x83ac('0x5c')]<=_0x2ce9a4[_0x5a9cc0]['to']){_0x57bfdf[_0x83ac('0x57')]=_0x5ca20e[_0x83ac('0x5c')];}}}if(_['isNil'](_0x57bfdf[_0x83ac('0x57')])){_0x57bfdf[_0x83ac('0x57')]=_0x39e2e9+0x1;}return _0x2036a4(_0x57bfdf);});});})[_0x83ac('0x4b')](function(_0x12d4bc){_0x37f1a0(_0x12d4bc);});});}function updateUser(_0x55ed48){return new Promise(function(_0x5b4daa,_0x2bdca7){try{if(_0x55ed48['voicemail']){_0x55ed48[_0x83ac('0x61')]=_0x55ed48[_0x83ac('0x57')];_0x55ed48[_0x83ac('0x62')]={'mailbox':_0x55ed48[_0x83ac('0x57')],'password':_0x55ed48['password'],'fullname':_0x55ed48[_0x83ac('0x63')],'email':_0x55ed48[_0x83ac('0x64')]};}if(_0x55ed48[_0x83ac('0x1b')]==='agent'){if(!_0x55ed48[_0x83ac('0x65')])_0x55ed48[_0x83ac('0x65')]=[_0x83ac('0x66'),_0x83ac('0x67'),'103','113',_0x83ac('0x68'),_0x83ac('0x69'),_0x83ac('0x6a'),'106',_0x83ac('0x6b'),'108',_0x83ac('0x6c'),_0x83ac('0x6d'),_0x83ac('0x6e'),'114',_0x83ac('0x6f')];}_0x5b4daa(_0x55ed48);}catch(_0x1e7c55){_0x2bdca7(_0x1e7c55);}});}exports[_0x83ac('0x70')]=function(_0x29b641,_0x3dddf3){if(_0x29b641['user'][_0x83ac('0x1b')]==='agent')throw new Error(_0x83ac('0x71'));if(_0x29b641[_0x83ac('0x52')][_0x83ac('0x1b')]===_0x83ac('0x72')&&_0x29b641['user']['role']!=='admin'){throw new Error(_0x83ac('0x73'));}if(_0x29b641['body']['role']===_0x83ac('0x20')&&_0x29b641[_0x83ac('0x72')][_0x83ac('0x1b')]!==_0x83ac('0x20')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x83ac('0x74')]([_0x29b641['body']])[_0x83ac('0x1e')](function(){return validateUser(_0x29b641[_0x83ac('0x52')]);})[_0x83ac('0x1e')](function(_0x34a2cb){return updateUser(_0x34a2cb)[_0x83ac('0x1e')](function(_0x7b41e){if(_0x7b41e[_0x83ac('0x1b')]===_0x83ac('0x20')){_0x7b41e['settingsEnabled']=_0x29b641[_0x83ac('0x72')]['settingsEnabled'];delete _0x7b41e[_0x83ac('0x75')];}return _0x7b41e;});})[_0x83ac('0x1e')](function(_0xd3419a){return db[_0x83ac('0x2e')][_0x83ac('0x70')](_0xd3419a,{'include':[{'model':db[_0x83ac('0x62')],'as':'VoiceMail'}]});})[_0x83ac('0x1e')](function(_0x426eb8){if(_0x29b641[_0x83ac('0x52')][_0x83ac('0x1b')]==='user')return _0x426eb8;if(_0x29b641[_0x83ac('0x72')][_0x83ac('0x1b')]!==_0x83ac('0x72'))return _0x426eb8;return db[_0x83ac('0x76')]['find']({'where':{'name':_0x426eb8[_0x83ac('0x1b')]==='agent'?'Agents':_0x83ac('0x24'),'userProfileId':_0x29b641[_0x83ac('0x72')][_0x83ac('0x75')]},'raw':!![]})[_0x83ac('0x1e')](function(_0x465138){if(!_0x465138||_0x465138['autoAssociation']!=0x0)return _0x426eb8;return db['UserProfileResource']['create']({'name':_0x426eb8[_0x83ac('0x2d')],'resourceId':_0x426eb8['id'],'type':_0x465138[_0x83ac('0x2d')],'sectionId':_0x465138['id']},{})['then'](function(){return _0x426eb8;});})[_0x83ac('0x4b')](function(_0x3d43c9){logger[_0x83ac('0x2b')](_0x83ac('0x77'),_0x3d43c9);throw _0x3d43c9;});})[_0x83ac('0x1e')](respondWithResult(_0x3dddf3,0xc9))[_0x83ac('0x4b')](handleError(_0x3dddf3,null));};exports[_0x83ac('0x78')]=function(_0x4048dc,_0x287fef){var _0x58930e=_0x4048dc['body'];var _0xf849c8=[];if(_0x4048dc[_0x83ac('0x72')][_0x83ac('0x1b')]===_0x83ac('0x23'))throw new Error('Unauthorized');if(_['some'](_0x58930e,[_0x83ac('0x1b'),_0x83ac('0x72')])&&_0x4048dc[_0x83ac('0x72')][_0x83ac('0x1b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x58930e,['role',_0x83ac('0x20')])&&_0x4048dc['user'][_0x83ac('0x1b')]!==_0x83ac('0x20')){throw new Error(_0x83ac('0x79'));}return licenseUtil['checkUserLimits'](_0x58930e)[_0x83ac('0x1e')](function(){return validateUser(_0x58930e[0x0]);})['then'](function(){for(var _0x2d5362=0x1;_0x2d5362<_0x58930e[_0x83ac('0x44')];_0x2d5362++){var _0x5abfdf=_0x58930e[_0x2d5362-0x1][_0x83ac('0x57')];if(!_0x58930e[_0x2d5362][_0x83ac('0x57')])_0x58930e[_0x2d5362][_0x83ac('0x57')]=_0x5abfdf+0x1;_0xf849c8[_0x83ac('0x41')](validateUser(_0x58930e[_0x2d5362]));}return Promise[_0x83ac('0x7a')](_0xf849c8);})['then'](function(){_0xf849c8=[];for(var _0x1e529f=0x0;_0x1e529f<_0x58930e[_0x83ac('0x44')];_0x1e529f++){_0xf849c8[_0x83ac('0x41')](updateUser(_0x58930e[_0x1e529f]));}return Promise['all'](_0xf849c8);})[_0x83ac('0x1e')](function(){_0xf849c8=_0x58930e[_0x83ac('0x30')](function(_0xaeb948){return db[_0x83ac('0x2e')]['create'](_0xaeb948,{'include':[{'model':db[_0x83ac('0x62')],'as':_0x83ac('0x62')}]})[_0x83ac('0x1e')](function(_0xd70e54){_0xaeb948['id']=_0xd70e54['id'];return _0xaeb948;});});return Promise[_0x83ac('0x7a')](_0xf849c8);})[_0x83ac('0x1e')](function(_0x418260){if(_0x4048dc[_0x83ac('0x52')][_0x83ac('0x1b')]===_0x83ac('0x72'))return _0x418260;if(_0x4048dc[_0x83ac('0x72')][_0x83ac('0x1b')]!==_0x83ac('0x72'))return _0x418260;var _0x41e047=_[_0x83ac('0x7b')](_0x418260,function(_0x30baa2){return _0x30baa2['role']===_0x83ac('0x23')||_0x30baa2['role']===_0x83ac('0x7c');});if(!_0x41e047)return _0x418260;return db[_0x83ac('0x76')][_0x83ac('0x7d')]({'where':{'name':{'$or':[_0x83ac('0x22'),_0x83ac('0x24')]},'userProfileId':_0x4048dc['user'][_0x83ac('0x75')]},'raw':!![]})['then'](function(_0x48904c){if(_['isEmpty'](_0x48904c)||!_[_0x83ac('0x7b')](_0x48904c,[_0x83ac('0x7e'),0x0]))return _0x418260;_0xf849c8=[];var _0x10131b=_(_0x48904c)[_0x83ac('0x30')](function(_0x5cde5e){if(_0x5cde5e[_0x83ac('0x7e')]===0x1)return;return _0x5cde5e['name']===_0x83ac('0x22')?_0x83ac('0x23'):'telephone';})[_0x83ac('0x7f')]()[_0x83ac('0x27')]();for(var _0x559da3=0x0;_0x559da3<_0x418260[_0x83ac('0x44')];_0x559da3++){if(!_[_0x83ac('0x37')](_0x10131b,_0x418260[_0x559da3][_0x83ac('0x1b')]))return;var _0x46570d=_0x418260[_0x559da3][_0x83ac('0x1b')]===_0x83ac('0x23')?_0x83ac('0x22'):'Telephones';_0xf849c8[_0x83ac('0x41')](db[_0x83ac('0x29')][_0x83ac('0x70')]({'name':_0x418260[_0x559da3][_0x83ac('0x2d')],'resourceId':_0x418260[_0x559da3]['id'],'type':_0x46570d,'sectionId':_[_0x83ac('0x28')](_0x48904c,['name',_0x46570d])['id']},{}));}return Promise['all'](_0xf849c8);});})['then'](respondWithResult(_0x287fef,0xc9))[_0x83ac('0x4b')](handleError(_0x287fef,null));};exports[_0x83ac('0x80')]=function(_0x1fa62b,_0x4314d1){if(_0x1fa62b['body']['id']){delete _0x1fa62b['body']['id'];}return db['User'][_0x83ac('0x28')]({'where':{'id':_0x1fa62b[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](function(_0x19f65a){if(!_0x19f65a)return null;if(_0x19f65a['id']===_0x1fa62b[_0x83ac('0x72')]['id']){if(!_0x1fa62b[_0x83ac('0x52')][_0x83ac('0x81')]||!_0x1fa62b['body']['newPassword']){throw new db[(_0x83ac('0x82'))][(_0x83ac('0x83'))](_0x83ac('0x84'));}if(!_0x19f65a[_0x83ac('0x85')](_0x1fa62b['body'][_0x83ac('0x81')])){throw new db[(_0x83ac('0x82'))]['ValidationError']('Wrong\x20credentials');}if(_0x1fa62b[_0x83ac('0x52')]['oldPassword']===_0x1fa62b['body']['newPassword']){throw new db[(_0x83ac('0x82'))][(_0x83ac('0x83'))](_0x83ac('0x86'));}}else if(_0x1fa62b[_0x83ac('0x72')][_0x83ac('0x1b')]===_0x83ac('0x20')){if(!_0x1fa62b[_0x83ac('0x52')][_0x83ac('0x87')]){throw new db[(_0x83ac('0x82'))]['ValidationError'](_0x83ac('0x88'));}}else if(_0x1fa62b[_0x83ac('0x72')]['role']===_0x83ac('0x72')){if(!_0x1fa62b['body'][_0x83ac('0x87')]){throw new db['Sequelize'][(_0x83ac('0x83'))](_0x83ac('0x88'));}if(_0x19f65a[_0x83ac('0x1b')]!==_0x83ac('0x23')){throw new db[(_0x83ac('0x82'))][(_0x83ac('0x83'))](_0x83ac('0x71'));}}else{throw new db['Sequelize'][(_0x83ac('0x83'))](_0x83ac('0x71'));}return _0x19f65a;})[_0x83ac('0x1e')](handleEntityNotFound(_0x4314d1,null))[_0x83ac('0x1e')](function(_0x342f34){return db[_0x83ac('0x58')][_0x83ac('0x89')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x83ac('0x1e')](function(_0x6cff37){if(_0x6cff37['securePassword'])authService['validatePasswordPattern'](_0x1fa62b[_0x83ac('0x52')][_0x83ac('0x87')]);if(!_0x6cff37[_0x83ac('0x8a')]||!_0x342f34[_0x83ac('0x33')])return _0x342f34;authService[_0x83ac('0x8b')](_0x1fa62b['body'][_0x83ac('0x87')],_0x342f34[_0x83ac('0x33')],_0x6cff37[_0x83ac('0x8c')]);return _0x342f34;})[_0x83ac('0x1e')](saveUpdates({'password':_0x1fa62b[_0x83ac('0x52')]['newPassword'],'passwordResetAt':_0x1fa62b['user']['id']==_0x1fa62b[_0x83ac('0x4d')]['id']?moment():null,'previousPasswords':authService[_0x83ac('0x8d')](_0x1fa62b[_0x83ac('0x52')]['newPassword'],_0x342f34[_0x83ac('0x33')])},null));})['then'](respondWithResult(_0x4314d1,null))[_0x83ac('0x4b')](handleError(_0x4314d1,null));};exports[_0x83ac('0x8e')]=function(_0x1430ff,_0x10a810){var _0x3af38b=_0x1430ff['body'][_0x83ac('0x8f')];return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x1430ff['params']['id']},'attributes':['id',_0x83ac('0x2d'),_0x83ac('0x1b'),_0x83ac('0x90'),'loginInPause','voicePause',_0x83ac('0x91')]})[_0x83ac('0x1e')](handleEntityNotFound(_0x10a810,null))[_0x83ac('0x1e')](function(_0x5e3282){if(_0x5e3282){if(!utils['isValidChannel'](_0x3af38b)){throw new db[(_0x83ac('0x82'))]['ValidationError'](_0x83ac('0x92'));}return _0x5e3282[_0x83ac('0x93')+_[_0x83ac('0x94')](_0x3af38b[_0x83ac('0x95')]())+_0x83ac('0x96')](_0x1430ff[_0x83ac('0x52')]['ids'],{'penalty':_0x1430ff['body'][_0x83ac('0x97')]||0x0})[_0x83ac('0x98')](function(_0x2b4bb6){for(var _0x17fd3d=0x0;_0x17fd3d<_0x1430ff[_0x83ac('0x52')]['ids']['length'];_0x17fd3d+=0x1){var _0x133624={'UserId':Number(_0x1430ff[_0x83ac('0x4d')]['id'])};_0x133624[_[_0x83ac('0x94')](_0x3af38b[_0x83ac('0x95')]())+_0x83ac('0x99')]=Number(_0x1430ff['body']['ids'][_0x17fd3d]);socket['emit'](_0x83ac('0x72')+_[_0x83ac('0x94')](_0x3af38b[_0x83ac('0x95')]())+'Queue:save',_0x133624);}return _0x2b4bb6;})[_0x83ac('0x1e')](function(){if(_0x3af38b===_0x83ac('0x9a')){return db[_0x83ac('0x9b')][_0x83ac('0x7d')]({'where':{'id':_0x1430ff[_0x83ac('0x52')][_0x83ac('0x55')]||[]},'raw':!![],'attributes':['id',_0x83ac('0x2d')]});}})[_0x83ac('0x1e')](function(_0x113f99){var _0x4d818d=_0x5e3282[_0x83ac('0x1f')]({'plain':!![]});var _0x4c3bd1=[];if(_0x3af38b===_0x83ac('0x9a')&&_0x4d818d[_0x83ac('0x1b')]==='agent'&&_0x4d818d[_0x83ac('0x90')]){for(let _0x2757b4=0x0;_0x2757b4<_0x113f99[_0x83ac('0x44')];_0x2757b4+=0x1){_0x4c3bd1[_0x83ac('0x41')]({'membername':_0x4d818d[_0x83ac('0x2d')],'UserId':_0x4d818d['id'],'queue_name':_0x113f99[_0x2757b4]['name'],'VoiceQueueId':_0x113f99[_0x2757b4]['id'],'interface':_[_0x83ac('0x5b')](_0x4d818d['interface'])?util[_0x83ac('0x9c')](_0x83ac('0x9d'),_0x4d818d['name']):_0x4d818d['interface'],'paused':_0x4d818d[_0x83ac('0x9e')]||![],'penalty':_0x1430ff['body']['penalty']||0x0});}return Promise[_0x83ac('0x7a')](_0x4c3bd1['map'](function(_0x3b2731){return db['UserVoiceQueueRt'][_0x83ac('0x9f')](_0x3b2731);}));}return _0x5e3282;});}})['then'](respondWithStatusCode(_0x10a810,null))[_0x83ac('0x4b')](handleError(_0x10a810,null));};exports['removeQueues']=function(_0x3d41a0,_0x498e94){var _0x21ed83,_0x290272;return db[_0x83ac('0x2e')]['find']({'where':{'id':_0x3d41a0['params']['id']},'attributes':['id',_0x83ac('0x2d'),_0x83ac('0x1b')]})['then'](handleEntityNotFound(_0x498e94,null))[_0x83ac('0x1e')](function(_0x57cc0b){if(_0x57cc0b){_0x21ed83=_0x57cc0b;if(!_0x3d41a0['query']['channel']||!utils['isValidChannel'](_0x3d41a0['query'][_0x83ac('0x8f')])){throw new db[(_0x83ac('0x82'))]['ValidationError'](_0x83ac('0x92'));}return _0x57cc0b[_0x83ac('0xa0')+_['capitalize'](_0x3d41a0['query'][_0x83ac('0x8f')][_0x83ac('0x95')]())+_0x83ac('0x96')](_0x3d41a0[_0x83ac('0x3b')]['ids']);}})[_0x83ac('0x1e')](function(_0x4ed353){if(_['isArray'](_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x55')])){for(var _0x5910f3=0x0;_0x5910f3<_0x3d41a0['query'][_0x83ac('0x55')]['length'];_0x5910f3+=0x1){_0x290272={'UserId':Number(_0x3d41a0['params']['id'])};_0x290272[_[_0x83ac('0x94')](_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x8f')][_0x83ac('0x95')]())+_0x83ac('0x99')]=Number(_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x55')][_0x5910f3]);socket['emit'](_0x83ac('0x72')+_[_0x83ac('0x94')](_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x8f')][_0x83ac('0x95')]())+_0x83ac('0xa1'),_0x290272);}}else{_0x290272={'UserId':Number(_0x3d41a0[_0x83ac('0x4d')]['id'])};_0x290272[_[_0x83ac('0x94')](_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x8f')][_0x83ac('0x95')]())+_0x83ac('0x99')]=Number(_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x55')]);socket['emit'](_0x83ac('0x72')+_[_0x83ac('0x94')](_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x8f')][_0x83ac('0x95')]())+'Queue:remove',_0x290272);}return _0x4ed353;})[_0x83ac('0x1e')](function(){if(_0x3d41a0['query']['channel']===_0x83ac('0x9a')){return db[_0x83ac('0xa2')][_0x83ac('0xa3')]({'where':{'UserId':_0x3d41a0[_0x83ac('0x4d')]['id'],'VoiceQueueId':_0x3d41a0[_0x83ac('0x3b')][_0x83ac('0x55')]},'individualHooks':!![]})[_0x83ac('0x1e')](function(){return _0x21ed83;});}return _0x21ed83;})['then'](respondWithStatusCode(_0x498e94,null))[_0x83ac('0x4b')](handleError(_0x498e94,null));};exports[_0x83ac('0xa4')]=function(_0x2c51d9,_0x29bcad){_0x2c51d9[_0x83ac('0x52')][_0x83ac('0xa5')]=_0x2c51d9[_0x83ac('0xa6')][_0x83ac('0xa7')];return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x2c51d9[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x29bcad,null))[_0x83ac('0x1e')](saveUpdates(_0x2c51d9[_0x83ac('0x52')],null))[_0x83ac('0x1e')](respondWithResult(_0x29bcad,null))[_0x83ac('0x4b')](handleError(_0x29bcad,null));};exports[_0x83ac('0xa8')]=function(_0xa9e488,_0x5a312e){var _0x59e1c7=path['join'](config['root'],_0x83ac('0xa9'));return db['User']['find']({'where':{'id':_0xa9e488['params']['id']},'attributes':['id',_0x83ac('0xa5')],'raw':!![]})[_0x83ac('0x1e')](handleEntityNotFound(_0x5a312e,null))['then'](function(_0xfc5490){if(_0xfc5490){if(_['isNil'](_0xfc5490['userpic'])){return _0x5a312e[_0x83ac('0xaa')](_0x59e1c7);}else{if(!fs[_0x83ac('0xab')](path[_0x83ac('0xac')](config['root'],'server/files/images/',_0xfc5490[_0x83ac('0xa5')]))){return _0x5a312e[_0x83ac('0xaa')](_0x59e1c7);}return _0x5a312e['download'](path['join'](config[_0x83ac('0xad')],_0x83ac('0xae'),_0xfc5490[_0x83ac('0xa5')]));}}})['catch'](handleError(_0x5a312e,null));};exports['getOpenTabs']=function(_0xd5d81e,_0x3332be){return db['User'][_0x83ac('0x28')]({'where':{'id':_0xd5d81e[_0x83ac('0x4d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3332be,null))['then'](function(_0x499a9e){var _0x44377a=[];values=_0x499a9e[_0x83ac('0x45')];_0x44377a['push'](get_open_tabs('chat',_0x499a9e[_0x83ac('0x45')]));_0x44377a['push'](get_open_tabs('sms',_0x499a9e[_0x83ac('0x45')]));_0x44377a[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x49'),_0x499a9e[_0x83ac('0x45')]));_0x44377a[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x4a'),_0x499a9e[_0x83ac('0x45')]));_0x44377a['push'](get_open_tabs(_0x83ac('0x47'),_0x499a9e['dataValues']));_0x44377a[_0x83ac('0x41')](get_open_tabs(_0x83ac('0x48'),_0x499a9e[_0x83ac('0x45')]));return Promise[_0x83ac('0x7a')](_0x44377a);})[_0x83ac('0x1e')](function(_0x240081){if(_0x240081){var _0x5d5014=_[_0x83ac('0x30')](values['ChatOpenTabs'],function(_0x136178){return{'channel':_0x83ac('0xaf'),'id':_0x136178['id'],'createdAt':_0x136178[_0x83ac('0xb0')]};});var _0x263133=_[_0x83ac('0x30')](values[_0x83ac('0xb1')],function(_0x49468f){return{'channel':_0x83ac('0xb2'),'id':_0x49468f['id'],'createdAt':_0x49468f[_0x83ac('0xb0')]};});var _0x4d05f9=_[_0x83ac('0x30')](values[_0x83ac('0xb3')],function(_0x169fe9){return{'channel':_0x83ac('0xb4'),'id':_0x169fe9['id'],'createdAt':_0x169fe9[_0x83ac('0xb0')]};});var _0x29d799=_[_0x83ac('0x30')](values[_0x83ac('0xb5')],function(_0x28b7ab){return{'channel':_0x83ac('0xb6'),'id':_0x28b7ab['id'],'createdAt':_0x28b7ab[_0x83ac('0xb0')]};});var _0x5efd0f=_[_0x83ac('0x30')](values['SmsOpenTabs'],function(_0x1e385b){return{'channel':'SMS','id':_0x1e385b['id'],'createdAt':_0x1e385b['createdAt']};});var _0x2f354c=_[_0x83ac('0x30')](values[_0x83ac('0xb7')],function(_0x4964fa){return{'channel':_0x83ac('0xb8'),'id':_0x4964fa['id'],'createdAt':_0x4964fa['createdAt']};});var _0x1b7045=_[_0x83ac('0xb9')](_0x5d5014,_0x263133,_0x4d05f9,_0x29d799,_0x5efd0f,_0x2f354c);var _0xb13d62={'count':_0x1b7045['length'],'rows':_0x1b7045};return _0xb13d62;}else return null;})['then'](respondWithResult(_0x3332be,null))['catch'](handleError(_0x3332be,null));};exports['getContacts']=function(_0x38d765,_0x38a880){var _0x5b23c8={};return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x38d765[_0x83ac('0x4d')]['id']}})['then'](function(_0x1fabbe){if(!_0x1fabbe){throw new APINotFoundError(util[_0x83ac('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x38d765['params']['id']));}return contacts[_0x83ac('0x53')]();})['then'](function(_0x224250){_0x38d765['query'][_0x83ac('0x2e')]=_0x38d765['params']['id'];_0x5b23c8=qs[_0x83ac('0x39')](_0x224250,_0x38d765);if(_0x38d765[_0x83ac('0x3b')]['hasOwnProperty'](_0x83ac('0x3c'))){_0x5b23c8[_0x83ac('0x3d')]=[{'model':db['CmList'],'as':_0x83ac('0xba'),'required':![]},{'model':db['Tag'],'as':_0x83ac('0xbb'),'attributes':['id',_0x83ac('0x2d'),_0x83ac('0xbc')],'where':_0x38d765['query'][_0x83ac('0xbd')]?{'id':_0x38d765[_0x83ac('0x3b')][_0x83ac('0xbd')]}:undefined,'required':_0x38d765[_0x83ac('0x3b')][_0x83ac('0xbd')]?!![]:![]}];}return contacts[_0x83ac('0x7d')](_0x38d765[_0x83ac('0x3b')],_0x38d765[_0x83ac('0x72')],_0x5b23c8,_0x224250);})[_0x83ac('0x1e')](respondWithFilteredResult(_0x38a880,_0x5b23c8))['catch'](APIHandleError(_0x38a880));};exports[_0x83ac('0xbe')]=function(_0x2d3dcf,_0x314433){var _0x222e08;var _0x2c3b60={};var _0x38f1ee;return db[_0x83ac('0x2e')]['findOne']({'where':{'id':_0x2d3dcf[_0x83ac('0x4d')]['id']},'attributes':['id','name',_0x83ac('0x1b')]})[_0x83ac('0x1e')](handleEntityNotFound(_0x314433,null))[_0x83ac('0x1e')](function(_0x2a45ed){if(!utils[_0x83ac('0xbf')](_0x2d3dcf[_0x83ac('0x3b')][_0x83ac('0x8f')])){throw new db[(_0x83ac('0x82'))]['ValidationError'](_0x83ac('0x92'));}_0x222e08=_0x2a45ed;var _0x5c948a={};_0x5c948a[_0x83ac('0xc0')]=_[_0x83ac('0xc1')](db[_[_0x83ac('0x94')](_0x2d3dcf['query'][_0x83ac('0x8f')])+_0x83ac('0xc2')][_0x83ac('0x2f')]);_0x5c948a['query']=_[_0x83ac('0xc1')](_0x2d3dcf[_0x83ac('0x3b')]);_0x5c948a[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x5c948a['model'],_0x5c948a[_0x83ac('0x3b')]);_0x2c3b60[_0x83ac('0x40')]=_['intersection'](_0x5c948a['model'],qs['fields'](_0x2d3dcf['query'][_0x83ac('0xc5')]));_0x2c3b60[_0x83ac('0x40')]=_0x2c3b60['attributes']['length']?_0x2c3b60[_0x83ac('0x40')]:_0x5c948a[_0x83ac('0xc0')];_0x2c3b60['order']=qs[_0x83ac('0xc6')](_0x2d3dcf[_0x83ac('0x3b')]['sort']);_0x2c3b60[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x2d3dcf[_0x83ac('0x3b')],_0x5c948a['filters']));if(_0x2d3dcf['query'][_0x83ac('0x25')]){_0x2c3b60[_0x83ac('0x3a')]=_['merge'](_0x2c3b60[_0x83ac('0x3a')],{'$or':_['map'](_0x2c3b60['attributes'],function(_0x52abf5){var _0x38ff60={};_0x38ff60[_0x52abf5]={'$like':'%'+_0x2d3dcf['query'][_0x83ac('0x25')]+'%'};return _0x38ff60;})});}_0x2c3b60=_[_0x83ac('0x4f')]({},_0x2c3b60,_0x2d3dcf[_0x83ac('0x50')]);switch(_0x222e08[_0x83ac('0x1b')]){case'admin':return db[_[_0x83ac('0x94')](_0x2d3dcf['query'][_0x83ac('0x8f')])+_0x83ac('0xc2')][_0x83ac('0x7d')](_0x2c3b60);case _0x83ac('0x72'):case _0x83ac('0x23'):return _0x222e08[_0x83ac('0x1f')+_['capitalize'](_0x2d3dcf['query'][_0x83ac('0x8f')])+_0x83ac('0x96')](_0x2c3b60);default:throw new db[(_0x83ac('0x82'))][(_0x83ac('0x83'))](_0x83ac('0xc8'));}})[_0x83ac('0x1e')](function(_0x467d71){_0x38f1ee=_0x467d71[_0x83ac('0x44')];if(!_0x2d3dcf[_0x83ac('0x3b')]['hasOwnProperty'](_0x83ac('0xc9'))){_0x2c3b60[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x2d3dcf[_0x83ac('0x3b')]['limit']);_0x2c3b60['offset']=qs[_0x83ac('0x16')](_0x2d3dcf[_0x83ac('0x3b')][_0x83ac('0x16')]);}switch(_0x222e08['role']){case _0x83ac('0x20'):return db[_['capitalize'](_0x2d3dcf[_0x83ac('0x3b')][_0x83ac('0x8f')])+_0x83ac('0xc2')]['findAll'](_0x2c3b60);case _0x83ac('0x72'):case'agent':return _0x222e08[_0x83ac('0x1f')+_[_0x83ac('0x94')](_0x2d3dcf['query'][_0x83ac('0x8f')])+'Queues'](_0x2c3b60);}})[_0x83ac('0x1e')](function(_0x1a2a71){return{'count':_0x38f1ee,'rows':_0x1a2a71};})[_0x83ac('0x1e')](respondWithResult(_0x314433,null))[_0x83ac('0x4b')](handleError(_0x314433,null));};exports[_0x83ac('0xca')]=function(_0x583a2e,_0x7a0120){var _0x34c27a={};var _0x1b4e31={};var _0x5a9b0a;var _0x77a49a;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x583a2e[_0x83ac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7a0120,null))[_0x83ac('0x1e')](function(_0x10f02d){if(_0x10f02d){_0x5a9b0a=_0x10f02d;_0x1b4e31[_0x83ac('0xc0')]=_[_0x83ac('0xc1')](db[_0x83ac('0xa2')][_0x83ac('0x2f')]);_0x1b4e31[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x583a2e[_0x83ac('0x3b')]);_0x1b4e31[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x1b4e31[_0x83ac('0xc0')],_0x1b4e31[_0x83ac('0x3b')]);_0x34c27a['attributes']=_[_0x83ac('0xc4')](_0x1b4e31['model'],qs[_0x83ac('0xc5')](_0x583a2e[_0x83ac('0x3b')]['fields']));_0x34c27a['attributes']=_0x34c27a[_0x83ac('0x40')][_0x83ac('0x44')]?_0x34c27a[_0x83ac('0x40')]:_0x1b4e31[_0x83ac('0xc0')];_0x34c27a[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x583a2e[_0x83ac('0x3b')]['sort']);_0x34c27a[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x583a2e[_0x83ac('0x3b')],_0x1b4e31[_0x83ac('0xc3')]));if(_0x583a2e[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x34c27a['where']=_[_0x83ac('0x4f')](_0x34c27a[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x34c27a[_0x83ac('0x40')],function(_0x26bb78){var _0x2edbd2={};_0x2edbd2[_0x26bb78]={'$like':'%'+_0x583a2e['query'][_0x83ac('0x25')]+'%'};return _0x2edbd2;})});}_0x34c27a=_[_0x83ac('0x4f')]({},_0x34c27a,_0x583a2e[_0x83ac('0x50')]);return _0x5a9b0a[_0x83ac('0xca')](_0x34c27a);}})[_0x83ac('0x1e')](function(_0x20c36b){if(_0x20c36b){_0x77a49a=_0x20c36b['length'];if(!_0x583a2e['query'][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x34c27a[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x583a2e['query']['limit']);_0x34c27a[_0x83ac('0x16')]=qs['offset'](_0x583a2e[_0x83ac('0x3b')][_0x83ac('0x16')]);}return _0x5a9b0a['getVoiceQueuesRt'](_0x34c27a);}})['then'](function(_0x1b82d2){if(_0x1b82d2){return _0x1b82d2?{'count':_0x77a49a,'rows':_0x1b82d2}:null;}})['then'](respondWithResult(_0x7a0120,null))[_0x83ac('0x4b')](handleError(_0x7a0120,null));};exports['getGroups']=function(_0x4dc8d7,_0x803aab){var _0x420ad0={};var _0x237bc7={};var _0x2db9cb;var _0x4695de;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x4dc8d7['params']['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x803aab,null))[_0x83ac('0x1e')](function(_0x3f7676){if(_0x3f7676){_0x2db9cb=_0x3f7676;_0x237bc7['model']=_['keys'](db[_0x83ac('0xcd')]['rawAttributes']);_0x237bc7[_0x83ac('0x3b')]=_['keys'](_0x4dc8d7[_0x83ac('0x3b')]);_0x237bc7['filters']=_[_0x83ac('0xc4')](_0x237bc7[_0x83ac('0xc0')],_0x237bc7['query']);_0x420ad0[_0x83ac('0x40')]=_['intersection'](_0x237bc7[_0x83ac('0xc0')],qs[_0x83ac('0xc5')](_0x4dc8d7[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x420ad0[_0x83ac('0x40')]=_0x420ad0[_0x83ac('0x40')][_0x83ac('0x44')]?_0x420ad0[_0x83ac('0x40')]:_0x237bc7[_0x83ac('0xc0')];_0x420ad0[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x4dc8d7[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x420ad0[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x4dc8d7[_0x83ac('0x3b')],_0x237bc7[_0x83ac('0xc3')]));if(_0x4dc8d7[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x420ad0[_0x83ac('0x3a')]=_[_0x83ac('0x4f')](_0x420ad0['where'],{'$or':_[_0x83ac('0x30')](_0x420ad0[_0x83ac('0x40')],function(_0xfcf7a){var _0x88fb76={};_0x88fb76[_0xfcf7a]={'$like':'%'+_0x4dc8d7['query'][_0x83ac('0x25')]+'%'};return _0x88fb76;})});}_0x420ad0=_[_0x83ac('0x4f')]({},_0x420ad0,_0x4dc8d7['options']);return _0x2db9cb[_0x83ac('0xce')](_0x420ad0);}})['then'](function(_0x1fcd84){if(_0x1fcd84){_0x4695de=_0x1fcd84[_0x83ac('0x44')];if(!_0x4dc8d7['query'][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x420ad0[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x4dc8d7[_0x83ac('0x3b')]['limit']);_0x420ad0[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x4dc8d7[_0x83ac('0x3b')]['offset']);}return _0x2db9cb[_0x83ac('0xce')](_0x420ad0);}})[_0x83ac('0x1e')](function(_0x26d665){if(_0x26d665){return _0x26d665?{'count':_0x4695de,'rows':_0x26d665}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x803aab,null))['catch'](handleError(_0x803aab,null));};exports[_0x83ac('0xcf')]=function(_0x5073ac,_0x4b2a9f){var _0x2f5195={'raw':!![],'where':{}};var _0x3bccdf={};var _0x85faff={'count':0x0,'rows':[]};return db[_0x83ac('0x2e')]['findOne']({'where':{'id':_0x5073ac[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x4b2a9f,null))[_0x83ac('0x1e')](function(_0x5490b7){if(_0x5490b7){_0x3bccdf[_0x83ac('0xc0')]=_[_0x83ac('0xc1')](db[_0x83ac('0xd0')]['rawAttributes']);_0x3bccdf[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x5073ac[_0x83ac('0x3b')]);_0x3bccdf['filters']=_[_0x83ac('0xc4')](_0x3bccdf[_0x83ac('0xc0')],_0x3bccdf[_0x83ac('0x3b')]);_0x2f5195['attributes']=_[_0x83ac('0xc4')](_0x3bccdf['model'],qs[_0x83ac('0xc5')](_0x5073ac[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x2f5195[_0x83ac('0x40')]=_0x2f5195[_0x83ac('0x40')]['length']?_0x2f5195['attributes']:_0x3bccdf[_0x83ac('0xc0')];if(!_0x5073ac[_0x83ac('0x3b')]['hasOwnProperty'](_0x83ac('0xc9'))){_0x2f5195[_0x83ac('0x18')]=qs['limit'](_0x5073ac[_0x83ac('0x3b')]['limit']);_0x2f5195[_0x83ac('0x16')]=qs['offset'](_0x5073ac[_0x83ac('0x3b')][_0x83ac('0x16')]);}_0x2f5195['order']=qs['sort'](_0x5073ac['query'][_0x83ac('0xc6')]);_0x2f5195[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x5073ac[_0x83ac('0x3b')],_0x3bccdf[_0x83ac('0xc3')]));_0x2f5195[_0x83ac('0x3a')][_0x83ac('0xd1')]=_0x5490b7['id'];if(_0x5073ac[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x2f5195[_0x83ac('0x3a')]=_[_0x83ac('0x4f')](_0x2f5195[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x2f5195[_0x83ac('0x40')],function(_0x1ad4ba){var _0x1a9be4={};_0x1a9be4[_0x1ad4ba]={'$like':'%'+_0x5073ac[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x1a9be4;})});}_0x2f5195=_[_0x83ac('0x4f')]({},_0x2f5195,_0x5073ac[_0x83ac('0x50')]);return db['VoiceRecording'][_0x83ac('0x19')]({'where':_0x2f5195[_0x83ac('0x3a')]})[_0x83ac('0x1e')](function(_0x3961b5){_0x85faff[_0x83ac('0x19')]=_0x3961b5;if(_0x5073ac[_0x83ac('0x3b')][_0x83ac('0x3c')]){_0x2f5195[_0x83ac('0x3d')]=[{'all':!![]}];}return db[_0x83ac('0xd0')][_0x83ac('0x7d')](_0x2f5195);})[_0x83ac('0x1e')](function(_0x42e785){_0x85faff[_0x83ac('0x43')]=_0x42e785;return _0x85faff;});}})[_0x83ac('0x1e')](respondWithFilteredResult(_0x4b2a9f,_0x2f5195))[_0x83ac('0x4b')](handleError(_0x4b2a9f,null));};exports[_0x83ac('0xd2')]=function(_0x4538e0,_0x5ca372){var _0x54d125={'raw':!![],'where':{}};var _0x3c73fa={};var _0x3e526f={'count':0x0,'rows':[]};return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x4538e0[_0x83ac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ca372,null))[_0x83ac('0x1e')](function(_0xb2a759){if(_0xb2a759){_0x3c73fa['model']=_['keys'](db['ScreenRecording'][_0x83ac('0x2f')]);_0x3c73fa[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x4538e0[_0x83ac('0x3b')]);_0x3c73fa['filters']=_['intersection'](_0x3c73fa[_0x83ac('0xc0')],_0x3c73fa[_0x83ac('0x3b')]);_0x54d125[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x3c73fa[_0x83ac('0xc0')],qs['fields'](_0x4538e0['query']['fields']));_0x54d125[_0x83ac('0x40')]=_0x54d125[_0x83ac('0x40')][_0x83ac('0x44')]?_0x54d125['attributes']:_0x3c73fa['model'];if(!_0x4538e0[_0x83ac('0x3b')][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x54d125['limit']=qs[_0x83ac('0x18')](_0x4538e0[_0x83ac('0x3b')][_0x83ac('0x18')]);_0x54d125[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x4538e0[_0x83ac('0x3b')]['offset']);}_0x54d125[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x4538e0['query'][_0x83ac('0xc6')]);_0x54d125['where']=qs['filters'](_[_0x83ac('0xc7')](_0x4538e0[_0x83ac('0x3b')],_0x3c73fa[_0x83ac('0xc3')]));_0x54d125['where'][_0x83ac('0xd1')]=_0xb2a759['id'];if(_0x4538e0[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x54d125['where']=_[_0x83ac('0x4f')](_0x54d125['where'],{'$or':_[_0x83ac('0x30')](_0x54d125[_0x83ac('0x40')],function(_0xbffbd0){var _0x202814={};_0x202814[_0xbffbd0]={'$like':'%'+_0x4538e0[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x202814;})});}_0x54d125=_[_0x83ac('0x4f')]({},_0x54d125,_0x4538e0[_0x83ac('0x50')]);return db['ScreenRecording'][_0x83ac('0x19')]({'where':_0x54d125[_0x83ac('0x3a')]})[_0x83ac('0x1e')](function(_0xae9401){_0x3e526f[_0x83ac('0x19')]=_0xae9401;if(_0x4538e0[_0x83ac('0x3b')]['includeAll']){_0x54d125[_0x83ac('0x3d')]=[{'all':!![]}];}return db[_0x83ac('0xd3')][_0x83ac('0x7d')](_0x54d125);})[_0x83ac('0x1e')](function(_0x2cd97c){_0x3e526f[_0x83ac('0x43')]=_0x2cd97c;return _0x3e526f;});}})[_0x83ac('0x1e')](respondWithFilteredResult(_0x5ca372,_0x54d125))[_0x83ac('0x4b')](handleError(_0x5ca372,null));};exports[_0x83ac('0xd4')]=function(_0x48d05d,_0x2177b4){var _0x190fbf={};var _0x5219e8={};var _0x26eb7d;var _0x5aa531;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x48d05d[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x2177b4,null))[_0x83ac('0x1e')](function(_0x12c1d7){if(_0x12c1d7){_0x26eb7d=_0x12c1d7;_0x5219e8[_0x83ac('0xc0')]=_[_0x83ac('0xc1')](db[_0x83ac('0xd5')][_0x83ac('0x2f')]);_0x5219e8[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x48d05d[_0x83ac('0x3b')]);_0x5219e8[_0x83ac('0xc3')]=_['intersection'](_0x5219e8['model'],_0x5219e8[_0x83ac('0x3b')]);_0x190fbf[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x5219e8['model'],qs['fields'](_0x48d05d['query']['fields']));_0x190fbf[_0x83ac('0x40')]=_0x190fbf['attributes'][_0x83ac('0x44')]?_0x190fbf[_0x83ac('0x40')]:_0x5219e8[_0x83ac('0xc0')];_0x190fbf['order']=qs['sort'](_0x48d05d['query']['sort']);_0x190fbf[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_['pick'](_0x48d05d[_0x83ac('0x3b')],_0x5219e8[_0x83ac('0xc3')]));if(_0x48d05d[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x190fbf[_0x83ac('0x3a')]=_[_0x83ac('0x4f')](_0x190fbf[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x190fbf[_0x83ac('0x40')],function(_0x6ddc54){var _0x3b315f={};_0x3b315f[_0x6ddc54]={'$like':'%'+_0x48d05d[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x3b315f;})});}_0x190fbf=_[_0x83ac('0x4f')]({},_0x190fbf,_0x48d05d[_0x83ac('0x50')]);return _0x26eb7d[_0x83ac('0xd4')](_0x190fbf);}})['then'](function(_0x1070c4){if(_0x1070c4){_0x5aa531=_0x1070c4[_0x83ac('0x44')];if(!_0x48d05d[_0x83ac('0x3b')][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x190fbf['limit']=qs[_0x83ac('0x18')](_0x48d05d[_0x83ac('0x3b')]['limit']);_0x190fbf[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x48d05d[_0x83ac('0x3b')]['offset']);}return _0x26eb7d[_0x83ac('0xd4')](_0x190fbf);}})[_0x83ac('0x1e')](function(_0x50c484){if(_0x50c484){return _0x50c484?{'count':_0x5aa531,'rows':_0x50c484}:null;}})['then'](respondWithResult(_0x2177b4,null))[_0x83ac('0x4b')](handleError(_0x2177b4,null));};exports[_0x83ac('0xd6')]=function(_0x3239dd,_0x3f50e0){var _0x27fabb={};var _0xd6b326={};var _0x4bd0a6;var _0x3b2e64;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x3239dd[_0x83ac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f50e0,null))[_0x83ac('0x1e')](function(_0x8fef9a){if(_0x8fef9a){_0x4bd0a6=_0x8fef9a;_0xd6b326['model']=_['keys'](db[_0x83ac('0xd7')][_0x83ac('0x2f')]);_0xd6b326[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x3239dd[_0x83ac('0x3b')]);_0xd6b326[_0x83ac('0xc3')]=_['intersection'](_0xd6b326[_0x83ac('0xc0')],_0xd6b326[_0x83ac('0x3b')]);_0x27fabb[_0x83ac('0x40')]=_['intersection'](_0xd6b326['model'],qs[_0x83ac('0xc5')](_0x3239dd['query'][_0x83ac('0xc5')]));_0x27fabb[_0x83ac('0x40')]=_0x27fabb[_0x83ac('0x40')]['length']?_0x27fabb[_0x83ac('0x40')]:_0xd6b326[_0x83ac('0xc0')];_0x27fabb[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x3239dd[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x27fabb[_0x83ac('0x3a')]=qs['filters'](_['pick'](_0x3239dd[_0x83ac('0x3b')],_0xd6b326[_0x83ac('0xc3')]));if(_0x3239dd[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x27fabb[_0x83ac('0x3a')]=_[_0x83ac('0x4f')](_0x27fabb[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x27fabb[_0x83ac('0x40')],function(_0x2d1bfe){var _0x3415f9={};_0x3415f9[_0x2d1bfe]={'$like':'%'+_0x3239dd[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x3415f9;})});}_0x27fabb=_[_0x83ac('0x4f')]({},_0x27fabb,_0x3239dd['options']);return _0x4bd0a6[_0x83ac('0xd6')](_0x27fabb);}})[_0x83ac('0x1e')](function(_0x44f6f1){if(_0x44f6f1){_0x3b2e64=_0x44f6f1[_0x83ac('0x44')];if(!_0x3239dd[_0x83ac('0x3b')][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x27fabb[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x3239dd['query'][_0x83ac('0x18')]);_0x27fabb[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x3239dd[_0x83ac('0x3b')][_0x83ac('0x16')]);}return _0x4bd0a6[_0x83ac('0xd6')](_0x27fabb);}})['then'](function(_0x2450ea){if(_0x2450ea){return _0x2450ea?{'count':_0x3b2e64,'rows':_0x2450ea}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x3f50e0,null))['catch'](handleError(_0x3f50e0,null));};exports['getMailInteractions']=function(_0xa9a31f,_0x595f6a){var _0x3d4b55={'raw':!![],'where':{}};var _0x463709={};var _0xce9db8={'count':0x0,'rows':[]};return db[_0x83ac('0x2e')]['findOne']({'where':{'id':_0xa9a31f[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x595f6a,null))[_0x83ac('0x1e')](function(_0x4aea17){if(_0x4aea17){_0x463709[_0x83ac('0xc0')]=_[_0x83ac('0xc1')](db['MailInteraction'][_0x83ac('0x2f')]);_0x463709[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0xa9a31f[_0x83ac('0x3b')]);_0x463709[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x463709[_0x83ac('0xc0')],_0x463709[_0x83ac('0x3b')]);_0x3d4b55[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x463709[_0x83ac('0xc0')],qs[_0x83ac('0xc5')](_0xa9a31f[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x3d4b55[_0x83ac('0x40')]=_0x3d4b55['attributes'][_0x83ac('0x44')]?_0x3d4b55[_0x83ac('0x40')]:_0x463709[_0x83ac('0xc0')];if(!_0xa9a31f[_0x83ac('0x3b')][_0x83ac('0xcc')]('nolimit')){_0x3d4b55['limit']=qs[_0x83ac('0x18')](_0xa9a31f['query'][_0x83ac('0x18')]);_0x3d4b55[_0x83ac('0x16')]=qs['offset'](_0xa9a31f[_0x83ac('0x3b')]['offset']);}_0x3d4b55['order']=qs[_0x83ac('0xc6')](_0xa9a31f['query'][_0x83ac('0xc6')]);_0x3d4b55[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0xa9a31f['query'],_0x463709['filters']));_0x3d4b55['where'][_0x83ac('0xd1')]=_0x4aea17['id'];if(_0xa9a31f['query']['filter']){_0x3d4b55[_0x83ac('0x3a')]=_['merge'](_0x3d4b55['where'],{'$or':_[_0x83ac('0x30')](_0x3d4b55[_0x83ac('0x40')],function(_0x20e783){var _0x3638e9={};_0x3638e9[_0x20e783]={'$like':'%'+_0xa9a31f['query'][_0x83ac('0x25')]+'%'};return _0x3638e9;})});}_0x3d4b55=_[_0x83ac('0x4f')]({},_0x3d4b55,_0xa9a31f[_0x83ac('0x50')]);return db[_0x83ac('0xd8')]['count']({'where':_0x3d4b55[_0x83ac('0x3a')]})['then'](function(_0x88a70e){_0xce9db8[_0x83ac('0x19')]=_0x88a70e;if(_0xa9a31f[_0x83ac('0x3b')][_0x83ac('0x3c')]){_0x3d4b55[_0x83ac('0x3d')]=[{'all':!![]}];}return db[_0x83ac('0xd8')][_0x83ac('0x7d')](_0x3d4b55);})[_0x83ac('0x1e')](function(_0x5a2f6f){_0xce9db8['rows']=_0x5a2f6f;return _0xce9db8;});}})[_0x83ac('0x1e')](respondWithFilteredResult(_0x595f6a,_0x3d4b55))['catch'](handleError(_0x595f6a,null));};exports[_0x83ac('0xd9')]=function(_0x4148d8,_0x45203e){var _0x5c4c4b={};var _0x505fc3={};var _0x32595;var _0x5421c9;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x4148d8[_0x83ac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45203e,null))['then'](function(_0x7f9f13){if(_0x7f9f13){_0x32595=_0x7f9f13;_0x505fc3[_0x83ac('0xc0')]=_['keys'](db['SmsInteraction'][_0x83ac('0x2f')]);_0x505fc3[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x4148d8[_0x83ac('0x3b')]);_0x505fc3[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x505fc3[_0x83ac('0xc0')],_0x505fc3[_0x83ac('0x3b')]);_0x5c4c4b[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x505fc3[_0x83ac('0xc0')],qs[_0x83ac('0xc5')](_0x4148d8[_0x83ac('0x3b')]['fields']));_0x5c4c4b[_0x83ac('0x40')]=_0x5c4c4b['attributes'][_0x83ac('0x44')]?_0x5c4c4b[_0x83ac('0x40')]:_0x505fc3[_0x83ac('0xc0')];_0x5c4c4b[_0x83ac('0xcb')]=qs['sort'](_0x4148d8[_0x83ac('0x3b')]['sort']);_0x5c4c4b['where']=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x4148d8[_0x83ac('0x3b')],_0x505fc3[_0x83ac('0xc3')]));if(_0x4148d8[_0x83ac('0x3b')]['filter']){_0x5c4c4b['where']=_['merge'](_0x5c4c4b[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x5c4c4b[_0x83ac('0x40')],function(_0x5ca526){var _0x2ee632={};_0x2ee632[_0x5ca526]={'$like':'%'+_0x4148d8[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x2ee632;})});}_0x5c4c4b=_[_0x83ac('0x4f')]({},_0x5c4c4b,_0x4148d8[_0x83ac('0x50')]);return _0x32595[_0x83ac('0xd9')](_0x5c4c4b);}})[_0x83ac('0x1e')](function(_0x298bea){if(_0x298bea){_0x5421c9=_0x298bea['length'];if(!_0x4148d8['query'][_0x83ac('0xcc')]('nolimit')){_0x5c4c4b['limit']=qs[_0x83ac('0x18')](_0x4148d8[_0x83ac('0x3b')][_0x83ac('0x18')]);_0x5c4c4b[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x4148d8['query']['offset']);}return _0x32595[_0x83ac('0xd9')](_0x5c4c4b);}})[_0x83ac('0x1e')](function(_0x32c53f){if(_0x32c53f){return _0x32c53f?{'count':_0x5421c9,'rows':_0x32c53f}:null;}})['then'](respondWithResult(_0x45203e,null))[_0x83ac('0x4b')](handleError(_0x45203e,null));};exports[_0x83ac('0xda')]=function(_0x1bb069,_0x483686){var _0x349ac3={};var _0xbf40d6={};var _0x3faba2;var _0x581b6c;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x1bb069[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x483686,null))[_0x83ac('0x1e')](function(_0x21b8cf){if(_0x21b8cf){_0x3faba2=_0x21b8cf;_0xbf40d6[_0x83ac('0xc0')]=_['keys'](db[_0x83ac('0xdb')][_0x83ac('0x2f')]);_0xbf40d6['query']=_[_0x83ac('0xc1')](_0x1bb069[_0x83ac('0x3b')]);_0xbf40d6[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0xbf40d6['model'],_0xbf40d6[_0x83ac('0x3b')]);_0x349ac3['attributes']=_[_0x83ac('0xc4')](_0xbf40d6['model'],qs['fields'](_0x1bb069[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x349ac3[_0x83ac('0x40')]=_0x349ac3[_0x83ac('0x40')]['length']?_0x349ac3[_0x83ac('0x40')]:_0xbf40d6[_0x83ac('0xc0')];_0x349ac3[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x1bb069[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x349ac3[_0x83ac('0x3a')]=qs['filters'](_[_0x83ac('0xc7')](_0x1bb069['query'],_0xbf40d6[_0x83ac('0xc3')]));if(_0x1bb069['query']['filter']){_0x349ac3[_0x83ac('0x3a')]=_['merge'](_0x349ac3[_0x83ac('0x3a')],{'$or':_['map'](_0x349ac3[_0x83ac('0x40')],function(_0x53a2ca){var _0x5895dd={};_0x5895dd[_0x53a2ca]={'$like':'%'+_0x1bb069[_0x83ac('0x3b')]['filter']+'%'};return _0x5895dd;})});}_0x349ac3=_['merge']({},_0x349ac3,_0x1bb069[_0x83ac('0x50')]);return _0x3faba2[_0x83ac('0xda')](_0x349ac3);}})[_0x83ac('0x1e')](function(_0x5eaa09){if(_0x5eaa09){_0x581b6c=_0x5eaa09[_0x83ac('0x44')];if(!_0x1bb069[_0x83ac('0x3b')]['hasOwnProperty'](_0x83ac('0xc9'))){_0x349ac3[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x1bb069[_0x83ac('0x3b')][_0x83ac('0x18')]);_0x349ac3[_0x83ac('0x16')]=qs['offset'](_0x1bb069['query'][_0x83ac('0x16')]);}return _0x3faba2['getFaxInteractions'](_0x349ac3);}})[_0x83ac('0x1e')](function(_0x20e55d){if(_0x20e55d){return _0x20e55d?{'count':_0x581b6c,'rows':_0x20e55d}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x483686,null))[_0x83ac('0x4b')](handleError(_0x483686,null));};exports[_0x83ac('0xdc')]=function(_0x526f1f,_0x5b259e){var _0x3757a4={};var _0x92a9e8={};var _0x4c4cee;var _0x3e69b1;return db[_0x83ac('0x2e')]['findOne']({'where':{'id':_0x526f1f['params']['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x5b259e,null))[_0x83ac('0x1e')](function(_0x1efcd7){if(_0x1efcd7){_0x4c4cee=_0x1efcd7;_0x92a9e8[_0x83ac('0xc0')]=_['keys'](db[_0x83ac('0xdd')]['rawAttributes']);_0x92a9e8[_0x83ac('0x3b')]=_['keys'](_0x526f1f[_0x83ac('0x3b')]);_0x92a9e8['filters']=_[_0x83ac('0xc4')](_0x92a9e8[_0x83ac('0xc0')],_0x92a9e8['query']);_0x3757a4['attributes']=_[_0x83ac('0xc4')](_0x92a9e8[_0x83ac('0xc0')],qs[_0x83ac('0xc5')](_0x526f1f['query'][_0x83ac('0xc5')]));_0x3757a4[_0x83ac('0x40')]=_0x3757a4[_0x83ac('0x40')][_0x83ac('0x44')]?_0x3757a4[_0x83ac('0x40')]:_0x92a9e8['model'];_0x3757a4[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x526f1f[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x3757a4[_0x83ac('0x3a')]=qs['filters'](_[_0x83ac('0xc7')](_0x526f1f[_0x83ac('0x3b')],_0x92a9e8[_0x83ac('0xc3')]));if(_0x526f1f[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x3757a4[_0x83ac('0x3a')]=_['merge'](_0x3757a4['where'],{'$or':_[_0x83ac('0x30')](_0x3757a4[_0x83ac('0x40')],function(_0x271d7c){var _0x199f06={};_0x199f06[_0x271d7c]={'$like':'%'+_0x526f1f['query']['filter']+'%'};return _0x199f06;})});}_0x3757a4=_[_0x83ac('0x4f')]({},_0x3757a4,_0x526f1f['options']);return _0x4c4cee[_0x83ac('0xdc')](_0x3757a4);}})['then'](function(_0x1df047){if(_0x1df047){_0x3e69b1=_0x1df047[_0x83ac('0x44')];if(!_0x526f1f['query'][_0x83ac('0xcc')]('nolimit')){_0x3757a4[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x526f1f[_0x83ac('0x3b')][_0x83ac('0x18')]);_0x3757a4[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x526f1f[_0x83ac('0x3b')]['offset']);}return _0x4c4cee['getWhatsappInteractions'](_0x3757a4);}})[_0x83ac('0x1e')](function(_0x1850d0){if(_0x1850d0){return _0x1850d0?{'count':_0x3e69b1,'rows':_0x1850d0}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x5b259e,null))[_0x83ac('0x4b')](handleError(_0x5b259e,null));};exports[_0x83ac('0xde')]=function(_0x65d5ab,_0x178c8e,_0x4f6a32){var _0x7be374;var _0xa4f9ae;var _0x44cf46;var _0x1f7a62=!_['isNil'](_0x65d5ab[_0x83ac('0x4d')]['id'])?_0x65d5ab['params']['id']:!_[_0x83ac('0x5b')](_0x65d5ab['user']['id'])?_0x65d5ab['user']['id']:null;return db['User']['find']({'where':{'id':_0x1f7a62,'role':{'$or':[_0x83ac('0x20'),'user',_0x83ac('0x23')]}},'attributes':['id',_0x83ac('0x2d'),_0x83ac('0xdf'),'mobile',_0x83ac('0x1b'),_0x83ac('0x57'),'loginInPause']})[_0x83ac('0x1e')](function(_0x47fbf8){if(_0x47fbf8){if(_0x47fbf8[_0x83ac('0x1b')]===_0x83ac('0x23')){_0x7be374=_0x47fbf8;if(_0x65d5ab[_0x83ac('0x52')][_0x83ac('0x91')]){_0x44cf46=util[_0x83ac('0x9c')](_0x83ac('0xe0'),_0x7be374[_0x65d5ab[_0x83ac('0x52')]['interface']]);}else if(_0x65d5ab[_0x83ac('0x52')][_0x83ac('0xe1')]){_0x44cf46=util[_0x83ac('0x9c')](_0x83ac('0x9d'),_0x65d5ab[_0x83ac('0x52')][_0x83ac('0xe1')]);}else{_0x44cf46=util[_0x83ac('0x9c')](_0x83ac('0x9d'),_0x7be374[_0x83ac('0x2d')]);}socket['to'](util[_0x83ac('0x9c')](_0x83ac('0xe2'),_0x7be374['name']))[_0x83ac('0x1c')](_0x83ac('0xe3'),{'user':{'id':_0x7be374['id'],'name':_0x7be374[_0x83ac('0x2d')]},'ip':_0x65d5ab[_0x83ac('0xe4')][_0x83ac('0xe5')]||_0x65d5ab['connection'][_0x83ac('0xe6')]||_0x65d5ab[_0x83ac('0xe7')][_0x83ac('0xe6')]||_0x65d5ab['connection'][_0x83ac('0xe7')][_0x83ac('0xe6')]});return db[_0x83ac('0xa2')][_0x83ac('0xa3')]({'where':{'membername':_0x7be374[_0x83ac('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0x83ac('0x82'))][(_0x83ac('0x83'))](_0x83ac('0xe8'));}})['then'](function(){if(_0x7be374){return _0x7be374[_0x83ac('0xe9')]({'raw':!![]});}})[_0x83ac('0x1e')](function(_0x1db6c5){if(_0x7be374){if(_0x1db6c5){_0xa4f9ae=_0x1db6c5;if(_0xa4f9ae[_0x83ac('0x44')]){var _0x51e342=_0xa4f9ae['map'](function(_0x4a98b5){var _0x4b1c07={'membername':_0x7be374[_0x83ac('0x2d')],'UserId':_0x7be374['id'],'queue_name':_0x4a98b5[_0x83ac('0x2d')],'VoiceQueueId':_0x4a98b5['id'],'interface':_0x44cf46,'paused':_0x7be374[_0x83ac('0xea')]||![],'penalty':_0x4a98b5[_0x83ac('0xeb')]||0x0};return db[_0x83ac('0xa2')][_0x83ac('0x9f')](_0x4b1c07);});return Promise[_0x83ac('0x7a')](_0x51e342);}}}})[_0x83ac('0x1e')](function(){if(_0x7be374){return db['MemberReport'][_0x83ac('0x7d')]({'where':{'membername':_0x7be374[_0x83ac('0x2d')],'exitAt':null}});}})[_0x83ac('0x1e')](function(_0x3f6768){if(_0x7be374){var _0x5af356=[];_0x3f6768['forEach'](function(_0x4d1d44){_0x5af356[_0x83ac('0x41')](_0x4d1d44[_0x83ac('0xec')]({'exitAt':moment()[_0x83ac('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x83ac('0x7a')](_0x5af356);}})[_0x83ac('0x1e')](function(){if(_0x7be374){var _0x4d7a3e=[];var _0x5b02c4=[];var _0x13bb04=utils[_0x83ac('0xed')]();var _0x502a7e={'membername':_0x7be374[_0x83ac('0x2d')],'interface':_0x44cf46,'enterAt':moment()[_0x83ac('0x9c')](_0x83ac('0xee')),'role':_0x7be374[_0x83ac('0x1b')],'internal':_0x7be374[_0x83ac('0x57')]};_0x13bb04[_0x83ac('0xef')](function(_0x117734){_0x4d7a3e[_0x83ac('0x41')](_[_0x83ac('0x4f')]({'channel':_0x117734,'type':_0x83ac('0xf0'),'data1':_0x65d5ab['body'][_0x83ac('0xf1')],'data2':_0x44cf46},_0x502a7e));if(_0x7be374[_0x83ac('0xea')]){_0x5b02c4[_0x83ac('0x41')](_[_0x83ac('0x4f')]({'channel':_0x117734,'type':_0x83ac('0xf2'),'data1':_0x83ac('0xf3')},_0x502a7e));}});return db[_0x83ac('0xf4')][_0x83ac('0x78')](_0x4d7a3e[_0x83ac('0xb9')](_0x5b02c4),{'individualHooks':!![]});}})['then'](function(){if(_0x7be374){return _0x7be374[_0x83ac('0xec')]({'online':!![],'lastLoginAt':moment()[_0x83ac('0x9c')](_0x83ac('0xee')),'voicePause':_0x7be374[_0x83ac('0xea')]||![],'mailPause':_0x7be374[_0x83ac('0xea')]||![],'chatPause':_0x7be374[_0x83ac('0xea')]||![],'faxPause':_0x7be374[_0x83ac('0xea')]||![],'smsPause':_0x7be374[_0x83ac('0xea')]||![],'openchannelPause':_0x7be374[_0x83ac('0xea')]||![],'whatsappPause':_0x7be374[_0x83ac('0xea')]||![],'pauseType':_0x7be374[_0x83ac('0xea')]?_0x83ac('0xf3'):null,'interface':_0x44cf46,'lastPauseAt':moment()[_0x83ac('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x83ac('0x1e')](function(_0x3d8416){if(_0x65d5ab[_0x83ac('0xf5')]){return _0x4f6a32();}else{return Promise[_0x83ac('0xf6')](_0x3d8416)[_0x83ac('0x1e')](respondWithResult(_0x178c8e,null));}})[_0x83ac('0x4b')](handleError(_0x178c8e,null));};exports[_0x83ac('0xf7')]=function(_0x559cdd,_0xb9220d){var _0x96817e;return db['User'][_0x83ac('0x28')]({'where':{'id':_0x559cdd[_0x83ac('0x4d')]['id'],'role':_0x83ac('0x23')},'attributes':['id',_0x83ac('0x2d'),'role']})[_0x83ac('0x1e')](handleEntityNotFound(_0xb9220d,null))[_0x83ac('0x1e')](function(_0x23a0dc){if(_0x23a0dc){_0x96817e=_0x23a0dc;return db[_0x83ac('0xa2')][_0x83ac('0xa3')]({'where':{'membername':_0x96817e[_0x83ac('0x2d')]},'individualHooks':!![]});}})[_0x83ac('0x1e')](function(){return db[_0x83ac('0xf4')][_0x83ac('0x7d')]({'where':{'membername':_0x96817e[_0x83ac('0x2d')],'exitAt':null}});})['then'](function(_0x43751b){var _0x1646b3=[];_0x43751b[_0x83ac('0xef')](function(_0x20fe7d){_0x1646b3[_0x83ac('0x41')](_0x20fe7d['update']({'exitAt':moment()[_0x83ac('0x9c')](_0x83ac('0xee'))}));});return Promise[_0x83ac('0x7a')](_0x1646b3);})[_0x83ac('0x1e')](function(){return _0x96817e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x83ac('0x1e')](respondWithResult(_0xb9220d,null))[_0x83ac('0x4b')](handleError(_0xb9220d,null));};exports[_0x83ac('0xf8')]=function(_0x4d62dd,_0x24bd06){var _0x3ae256;return db[_0x83ac('0xa2')][_0x83ac('0xec')]({'paused':0x1},{'where':{'UserId':_0x4d62dd[_0x83ac('0x4d')]['id']},'individualHooks':!![]})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x4d62dd[_0x83ac('0x4d')]['id'],'role':_0x83ac('0x23')},'attributes':['id',_0x83ac('0x2d'),_0x83ac('0x1b'),_0x83ac('0x57'),_0x83ac('0x91'),'online']});})[_0x83ac('0x1e')](handleEntityNotFound(_0x24bd06,null))['then'](function(_0x30f06c){if(_0x30f06c){_0x3ae256=_0x30f06c;return db[_0x83ac('0xf4')][_0x83ac('0x7d')]({'where':{'membername':_0x3ae256[_0x83ac('0x2d')],'type':_0x83ac('0xf2'),'exitAt':null}});}})[_0x83ac('0x1e')](function(_0x2f57f3){if(_0x2f57f3[_0x83ac('0x44')]){var _0x2f5f28=moment()[_0x83ac('0x9c')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x33ac53=0x0,_0x92c283=_0x2f57f3[_0x83ac('0x44')];_0x33ac53<_0x92c283;_0x33ac53++){_0x2f57f3[_0x33ac53][_0x83ac('0xf9')]({'exitAt':_0x2f5f28});}}})[_0x83ac('0x1e')](function(){var _0x20b9af=[];var _0x245230=utils[_0x83ac('0xed')]();_0x245230['forEach'](function(_0x18da03){_0x20b9af[_0x83ac('0x41')]({'channel':_0x18da03,'membername':_0x3ae256['name'],'interface':_['isNil'](_0x3ae256[_0x83ac('0x91')])?util['format']('SIP/%s',_0x3ae256[_0x83ac('0x2d')]):_0x3ae256[_0x83ac('0x91')],'type':'PAUSE','enterAt':moment()[_0x83ac('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4d62dd[_0x83ac('0x52')][_0x83ac('0x31')]||_0x83ac('0xfa'),'role':_0x3ae256['role'],'internal':_0x3ae256[_0x83ac('0x57')]});});return db[_0x83ac('0xf4')][_0x83ac('0x78')](_0x20b9af,{'individualHooks':!![]});})['then'](function(){return _0x3ae256[_0x83ac('0xec')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4d62dd[_0x83ac('0x52')]['type']||_0x83ac('0xfa'),'lastPauseAt':moment()[_0x83ac('0x9c')](_0x83ac('0xee'))});})['then'](respondWithResult(_0x24bd06,null))['catch'](handleError(_0x24bd06,null));};exports[_0x83ac('0xfb')]=function(_0x3b2d2d,_0x375231){if(_0x3b2d2d[_0x83ac('0x52')]['channel']&&!utils[_0x83ac('0xbf')](_0x3b2d2d[_0x83ac('0x52')][_0x83ac('0x8f')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3b2d2d[_0x83ac('0x52')]['channel']));}return db[_0x83ac('0x2e')][_0x83ac('0x28')]({'where':{'id':_0x3b2d2d[_0x83ac('0x4d')]['id']},'attributes':['id',_0x83ac('0x2d'),_0x83ac('0x1b'),_0x83ac('0x57'),_0x83ac('0x91'),_0x83ac('0x90'),_0x83ac('0x9e'),'mailPause',_0x83ac('0xfc'),_0x83ac('0xfd'),_0x83ac('0xfe'),_0x83ac('0xff'),_0x83ac('0x100'),_0x83ac('0x101'),_0x83ac('0x102')]})[_0x83ac('0x1e')](function(_0x553b6f){if(!_0x553b6f){throw new APINotFoundError(util['format'](_0x83ac('0x103'),_0x3b2d2d[_0x83ac('0x4d')]['id']));}return _0x553b6f['unpause'](_0x3b2d2d['body']['channel']);})[_0x83ac('0x1e')](respondWithResult(_0x375231,null))[_0x83ac('0x4b')](APIHandleError(_0x375231));};exports['getTeams']=function(_0x3e728b,_0x3c03d0){var _0x1ccbd3={};var _0x130640={};var _0xf768e4;var _0x489c69;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x3e728b[_0x83ac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c03d0,null))[_0x83ac('0x1e')](function(_0x5980c0){if(_0x5980c0){_0xf768e4=_0x5980c0;_0x130640[_0x83ac('0xc0')]=_['keys'](db[_0x83ac('0x104')]['rawAttributes']);_0x130640[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x3e728b[_0x83ac('0x3b')]);_0x130640[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x130640['model'],_0x130640[_0x83ac('0x3b')]);_0x1ccbd3[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x130640[_0x83ac('0xc0')],qs[_0x83ac('0xc5')](_0x3e728b[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x1ccbd3[_0x83ac('0x40')]=_0x1ccbd3['attributes']['length']?_0x1ccbd3[_0x83ac('0x40')]:_0x130640[_0x83ac('0xc0')];_0x1ccbd3['order']=qs[_0x83ac('0xc6')](_0x3e728b[_0x83ac('0x3b')]['sort']);_0x1ccbd3[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x3e728b[_0x83ac('0x3b')],_0x130640[_0x83ac('0xc3')]));if(_0x3e728b['query'][_0x83ac('0x25')]){_0x1ccbd3[_0x83ac('0x3a')]=_[_0x83ac('0x4f')](_0x1ccbd3[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x1ccbd3[_0x83ac('0x40')],function(_0x1e13dc){var _0x537de1={};_0x537de1[_0x1e13dc]={'$like':'%'+_0x3e728b[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x537de1;})});}_0x1ccbd3=_['merge']({},_0x1ccbd3,_0x3e728b['options']);return _0xf768e4['getTeams'](_0x1ccbd3);}})[_0x83ac('0x1e')](function(_0xf299a4){if(_0xf299a4){_0x489c69=_0xf299a4[_0x83ac('0x44')];if(!_0x3e728b[_0x83ac('0x3b')][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x1ccbd3[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x3e728b[_0x83ac('0x3b')]['limit']);_0x1ccbd3[_0x83ac('0x16')]=qs['offset'](_0x3e728b['query']['offset']);}return _0xf768e4[_0x83ac('0x105')](_0x1ccbd3);}})[_0x83ac('0x1e')](function(_0x2b9648){if(_0x2b9648){return _0x2b9648?{'count':_0x489c69,'rows':_0x2b9648}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x3c03d0,null))[_0x83ac('0x4b')](handleError(_0x3c03d0,null));};exports['addTeams']=function(_0x198d22,_0x1e39b7){var _0x45a4c4=_0x198d22[_0x83ac('0x4d')]['id'];var _0x2ea765=_0x198d22[_0x83ac('0x52')]?_0x198d22[_0x83ac('0x52')]['ids']:null;var _0x541e25=[];return Promise[_0x83ac('0xf6')]()[_0x83ac('0x1e')](function(){if(!_0x2ea765)throw new APIBadRequestError(_0x83ac('0x106'));})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x45a4c4}});})['then'](function(_0x4f6406){if(!_0x4f6406)throw new APINotFoundError(util['format'](_0x83ac('0x103'),_0x198d22[_0x83ac('0x4d')]['id']));return db[_0x83ac('0x5d')][_0x83ac('0x107')](function(_0x2fc03f){return _0x4f6406['addTeams'](_0x2ea765,{'transaction':_0x2fc03f})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x104')]['findAll']({'where':{'id':{'$in':_0x2ea765}}});})['then'](function(_0xf21708){var _0x21ddcc=_[_0x83ac('0x30')](_0xf21708,function(_0x1218e8){return _0x1218e8[_0x83ac('0x108')]();});return Promise[_0x83ac('0x7a')](_0x21ddcc);})[_0x83ac('0x1e')](function(_0x3383d2){_0x541e25=_[_0x83ac('0x109')](_0x3383d2);var _0xa7d014=_[_0x83ac('0x30')](_0x541e25,function(_0x10f5df){return _0x10f5df[_0x83ac('0x10a')](_0x4f6406['id'],{'transaction':_0x2fc03f});});return Promise['all'](_0xa7d014);})[_0x83ac('0x1e')](function(){if(!_0x4f6406[_0x83ac('0x90')])return;var _0xe77dfe=_['filter'](_0x541e25,function(_0x209884){return _0x209884[_0x83ac('0x10b')](_0x83ac('0x8f'))===_0x83ac('0x10c');});var _0x307efb=_[_0x83ac('0x30')](_0xe77dfe,function(_0x2b434f){return db[_0x83ac('0xa2')][_0x83ac('0x9f')]({'membername':_0x4f6406['name'],'UserId':_0x4f6406['id'],'queue_name':_0x2b434f[_0x83ac('0x2d')],'VoiceQueueId':_0x2b434f['id'],'interface':_[_0x83ac('0x5b')](_0x4f6406[_0x83ac('0x91')])?util[_0x83ac('0x9c')](_0x83ac('0x9d'),_0x4f6406[_0x83ac('0x2d')]):_0x4f6406[_0x83ac('0x91')],'paused':_0x4f6406[_0x83ac('0x9e')]||![],'penalty':_0x4f6406['penalty']},{'transaction':_0x2fc03f});});return Promise['all'](_0x307efb);})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x10d')]['findAll']({'where':{'teamId':{'$in':_0x2ea765}}});})['then'](function(_0x5bfaf7){var _0x7fd3eb=_[_0x83ac('0x30')](_0x5bfaf7,function(_0x20bf61){return db[_0x83ac('0x10e')][_0x83ac('0x70')]({'UserId':_0x4f6406['id'],'VoicePrefixId':_0x20bf61['VoicePrefixId']},{'transaction':_0x2fc03f});});return Promise[_0x83ac('0x7a')](_0x7fd3eb);});});})[_0x83ac('0x1e')](function(){for(var _0x58183f=0x0;_0x58183f<_0x541e25[_0x83ac('0x44')];_0x58183f++){var _0x7205f0=_0x541e25[_0x58183f]['getDataValue']('channel');var _0x55d77a=_0x7205f0+'QueueId';socket[_0x83ac('0x1c')](_0x83ac('0x72')+_0x7205f0+_0x83ac('0x10f'),{'UserId':_0x45a4c4,['queueField']:_0x541e25[_0x58183f]['id']});}})[_0x83ac('0x1e')](respondWithStatusCode(_0x1e39b7,null))[_0x83ac('0x4b')](APIHandleError(_0x1e39b7));};exports['removeTeams']=function(_0x2e8f98,_0x76bd56){var _0x1f2396=_0x2e8f98[_0x83ac('0x4d')]['id'];var _0x5546b6=null;if(_0x2e8f98['query']['ids']){_0x5546b6=_['isArray'](_0x2e8f98['query']['ids'])?_0x2e8f98['query'][_0x83ac('0x55')]:[_0x2e8f98[_0x83ac('0x3b')][_0x83ac('0x55')]];}var _0x549ec1=[];return Promise[_0x83ac('0xf6')]()[_0x83ac('0x1e')](function(){if(!_0x5546b6)throw new APIBadRequestError(_0x83ac('0x110'));})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x1f2396}});})['then'](function(_0x30a8cb){if(!_0x30a8cb)throw new APINotFoundError(util[_0x83ac('0x9c')](_0x83ac('0x103'),_0x2e8f98['params']['id']));return db[_0x83ac('0x5d')][_0x83ac('0x107')](function(_0xd02652){return _0x30a8cb['removeTeams'](_0x5546b6,{'transaction':_0xd02652})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x104')][_0x83ac('0x7d')]({'where':{'id':{'$in':_0x5546b6}}});})['then'](function(_0x2dcb66){var _0x154c77=_[_0x83ac('0x30')](_0x2dcb66,function(_0x34633e){return _0x34633e[_0x83ac('0x108')]();});return Promise['all'](_0x154c77);})[_0x83ac('0x1e')](function(_0x3532ca){_0x549ec1=_[_0x83ac('0x109')](_0x3532ca);var _0x1b65be=_[_0x83ac('0x30')](_0x549ec1,function(_0x30ff21){return _0x30ff21['removeAgent'](_0x30a8cb['id'],{'transaction':_0xd02652});});return Promise[_0x83ac('0x7a')](_0x1b65be);})['then'](function(){if(!_0x30a8cb[_0x83ac('0x90')])return;var _0x19acdf=_[_0x83ac('0x25')](_0x549ec1,function(_0x3efe6d){return _0x3efe6d[_0x83ac('0x10b')](_0x83ac('0x8f'))==='Voice';});var _0x5bdeba=_[_0x83ac('0x30')](_0x19acdf,function(_0x33431f){return db[_0x83ac('0xa2')]['destroy']({'where':{'VoiceQueueId':_0x33431f['id'],'UserId':_0x30a8cb['id']},'transaction':_0xd02652});});return Promise['all'](_0x5bdeba);})[_0x83ac('0x1e')](function(){return db[_0x83ac('0x10d')]['findAll']({'where':{'teamId':{'$in':_0x5546b6}}});})[_0x83ac('0x1e')](function(_0x3cb98a){var _0x214d0d=_[_0x83ac('0x30')](_0x3cb98a,function(_0x209a2e){return db[_0x83ac('0x10e')][_0x83ac('0xa3')]({'where':{'UserId':_0x30a8cb['id'],'VoicePrefixId':_0x209a2e[_0x83ac('0x111')]}},{'transaction':_0xd02652});});return Promise[_0x83ac('0x7a')](_0x214d0d);});});})['then'](function(){for(var _0x2b6621=0x0;_0x2b6621<_0x549ec1[_0x83ac('0x44')];_0x2b6621++){var _0x48942c=_0x549ec1[_0x2b6621][_0x83ac('0x10b')](_0x83ac('0x8f'));var _0xaea356=_0x48942c+'QueueId';socket['emit'](_0x83ac('0x72')+_0x48942c+_0x83ac('0xa1'),{'UserId':_0x1f2396,['queueField']:_0x549ec1[_0x2b6621]['id']});}})[_0x83ac('0x1e')](respondWithStatusCode(_0x76bd56,null))['catch'](APIHandleError(_0x76bd56));};exports[_0x83ac('0x112')]=function(_0x5657ee,_0x4f2805){var _0x1b110a={};var _0x2f32d8={};var _0x1dc798;var _0x4d33f6;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x5657ee[_0x83ac('0x4d')]['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x4f2805,null))[_0x83ac('0x1e')](function(_0x14026c){if(_0x14026c){_0x1dc798=_0x14026c;_0x2f32d8[_0x83ac('0xc0')]=_['keys'](db['CmList']['rawAttributes']);_0x2f32d8[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x5657ee[_0x83ac('0x3b')]);_0x2f32d8[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x2f32d8[_0x83ac('0xc0')],_0x2f32d8['query']);_0x1b110a[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x2f32d8['model'],qs[_0x83ac('0xc5')](_0x5657ee[_0x83ac('0x3b')][_0x83ac('0xc5')]));_0x1b110a['attributes']=_0x1b110a['attributes'][_0x83ac('0x44')]?_0x1b110a[_0x83ac('0x40')]:_0x2f32d8[_0x83ac('0xc0')];_0x1b110a[_0x83ac('0xcb')]=qs[_0x83ac('0xc6')](_0x5657ee[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x1b110a['where']=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x5657ee[_0x83ac('0x3b')],_0x2f32d8[_0x83ac('0xc3')]));if(_0x5657ee[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x1b110a['where']=_[_0x83ac('0x4f')](_0x1b110a[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x1b110a[_0x83ac('0x40')],function(_0x4d4590){var _0x32f7b2={};_0x32f7b2[_0x4d4590]={'$like':'%'+_0x5657ee[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x32f7b2;})});}_0x1b110a=_[_0x83ac('0x4f')]({},_0x1b110a,_0x5657ee[_0x83ac('0x50')]);return _0x1dc798['getLists'](_0x1b110a);}})[_0x83ac('0x1e')](function(_0x4f90a3){if(_0x4f90a3){_0x4d33f6=_0x4f90a3[_0x83ac('0x44')];if(!_0x5657ee[_0x83ac('0x3b')][_0x83ac('0xcc')](_0x83ac('0xc9'))){_0x1b110a[_0x83ac('0x18')]=qs[_0x83ac('0x18')](_0x5657ee['query'][_0x83ac('0x18')]);_0x1b110a[_0x83ac('0x16')]=qs[_0x83ac('0x16')](_0x5657ee[_0x83ac('0x3b')]['offset']);}return _0x1dc798[_0x83ac('0x112')](_0x1b110a);}})['then'](function(_0x4c7489){if(_0x4c7489){return _0x4c7489?{'count':_0x4d33f6,'rows':_0x4c7489}:null;}})[_0x83ac('0x1e')](respondWithResult(_0x4f2805,null))[_0x83ac('0x4b')](handleError(_0x4f2805,null));};exports['getAgents']=function(_0x26f6b3,_0x2c4821){var _0x4b3a33={};var _0x46162d={};var _0x516ef0;return db[_0x83ac('0x2e')][_0x83ac('0x89')]({'where':{'id':_0x26f6b3['params']['id']}})[_0x83ac('0x1e')](handleEntityNotFound(_0x2c4821,null))[_0x83ac('0x1e')](function(_0x102859){if(_0x102859){_0x516ef0=_0x102859;_0x46162d[_0x83ac('0xc0')]=_['keys'](db[_0x83ac('0x2e')]['rawAttributes']);_0x46162d[_0x83ac('0x3b')]=_[_0x83ac('0xc1')](_0x26f6b3[_0x83ac('0x3b')]);_0x46162d[_0x83ac('0xc3')]=_[_0x83ac('0xc4')](_0x46162d[_0x83ac('0xc0')],_0x46162d['query']);_0x4b3a33[_0x83ac('0x40')]=_[_0x83ac('0xc4')](_0x46162d[_0x83ac('0xc0')],qs['fields'](_0x26f6b3['query'][_0x83ac('0xc5')]));_0x4b3a33[_0x83ac('0x40')]=_0x4b3a33[_0x83ac('0x40')]['length']?_0x4b3a33['attributes']:_0x46162d[_0x83ac('0xc0')];_0x4b3a33['order']=qs[_0x83ac('0xc6')](_0x26f6b3[_0x83ac('0x3b')][_0x83ac('0xc6')]);_0x4b3a33[_0x83ac('0x3a')]=qs[_0x83ac('0xc3')](_[_0x83ac('0xc7')](_0x26f6b3['query'],_0x46162d[_0x83ac('0xc3')]));if(_0x26f6b3[_0x83ac('0x3b')][_0x83ac('0x25')]){_0x4b3a33['where']=_[_0x83ac('0x4f')](_0x4b3a33[_0x83ac('0x3a')],{'$or':_[_0x83ac('0x30')](_0x4b3a33[_0x83ac('0x40')],function(_0x59b164){var _0x209459={};_0x209459[_0x59b164]={'$like':'%'+_0x26f6b3[_0x83ac('0x3b')][_0x83ac('0x25')]+'%'};return _0x209459;})});}_0x4b3a33[_0x83ac('0xc0')]=db[_0x83ac('0x2e')];_0x4b3a33['as']='Agents';_0x4b3a33=_[_0x83ac('0x4f')]({},_0x4b3a33,_0x26f6b3[_0x83ac('0x50')]);return _0x516ef0[_0x83ac('0xe9')]({'include':[_0x4b3a33]});}})[_0x83ac('0x1e')](function(_0x21d85e){if(_0x21d85e){var _0xdff7fa={},_0x4c9389=[];for(var _0x3d79db=0x0;_0x3d79db<_0x21d85e[_0x83ac('0x44')];_0x3d79db+=0x1){for(var _0x38e3e4=0x0,_0x84989f;_0x38e3e4<_0x21d85e[_0x3d79db][_0x83ac('0x22')][_0x83ac('0x44')];_0x38e3e4+=0x1){_0x84989f=_0x21d85e[_0x3d79db][_0x83ac('0x22')][_0x38e3e4][_0x83ac('0x1f')]({'plain':!![]});_0xdff7fa[_0x84989f['id']]=_0x84989f;}}_0xdff7fa=_['values'](_0xdff7fa);for(var _0x2fb1e3=qs[_0x83ac('0x16')](_0x26f6b3[_0x83ac('0x3b')][_0x83ac('0x16')]);_0x2fb1e3<_0xdff7fa[_0x83ac('0x44')]&&_0x4c9389['length']=_0x4b430b[_0x090f('0x50')]){throw new Error(_0x090f('0x51'));}})[_0x090f('0x16')](function(){if(_0x43e3f5){return db[_0x090f('0x26')][_0x090f('0x47')]({'where':{'membername':_0x43e3f5[_0x090f('0x21')]},'individualHooks':!![]});}})[_0x090f('0x16')](function(){if(_0x43e3f5){return _0x43e3f5[_0x090f('0x52')]({'raw':!![]});}})['then'](function(_0x178fd2){if(_0x43e3f5){if(_0x178fd2){var _0x27c6fc=[];_0x3b8a29=_0x178fd2;if(_0x3b8a29['length']){for(var _0xcc7e6c=0x0;_0xcc7e6c<_0x3b8a29[_0x090f('0x2c')];_0xcc7e6c++){_0x27c6fc[_0x090f('0x2e')](db[_0x090f('0x26')]['upsert']({'membername':_0x43e3f5[_0x090f('0x21')],'UserId':_0x43e3f5['id'],'queue_name':_0x3b8a29[_0xcc7e6c][_0x090f('0x21')],'VoiceQueueId':_0x3b8a29[_0xcc7e6c]['id'],'interface':_0x7802c,'paused':_0x43e3f5[_0x090f('0x4c')]||![],'penalty':_0x3b8a29[_0xcc7e6c][_0x090f('0x53')]||0x0}));}return BPromise['all'](_0x27c6fc);}}}})['then'](function(){if(_0x43e3f5){return db[_0x090f('0x27')]['findAll']({'where':{'membername':_0x43e3f5[_0x090f('0x21')],'exitAt':null}});}})[_0x090f('0x16')](function(_0x9e9fb6){if(_0x43e3f5){if(_0x9e9fb6&&_0x9e9fb6[_0x090f('0x2c')]){var _0x2d6111=[];_0x9e9fb6[_0x090f('0x48')](function(_0x485774){_0x2d6111['push'](_0x485774[_0x090f('0x36')]({'exitAt':moment()[_0x090f('0x2a')](_0x090f('0x2b'))}));});return BPromise['all'](_0x2d6111);}}})[_0x090f('0x16')](function(){if(_0x43e3f5){var _0x20b751=[];var _0x48540b=[];var _0x5cfb4d=utils['getChannels']();var _0x1180b2={'membername':_0x43e3f5['name'],'interface':_0x7802c,'enterAt':moment()['format'](_0x090f('0x2b')),'role':_0x43e3f5[_0x090f('0x33')],'internal':_0x43e3f5[_0x090f('0x22')]};_0x5cfb4d[_0x090f('0x48')](function(_0x52416b){_0x20b751[_0x090f('0x2e')](_[_0x090f('0x54')]({'channel':_0x52416b,'type':_0x090f('0x55'),'data1':'callysquare','data2':_0x7802c},_0x1180b2));if(_0x43e3f5['loginInPause']){_0x48540b['push'](_[_0x090f('0x54')]({'channel':_0x52416b,'type':_0x090f('0x29'),'data1':_0x090f('0x56')},_0x1180b2));}});return db[_0x090f('0x27')][_0x090f('0x35')](_0x20b751[_0x090f('0x57')](_0x48540b),{'individualHooks':!![]});}})['then'](function(){if(_0x43e3f5){return _0x43e3f5[_0x090f('0x36')]({'online':!![],'lastLoginAt':moment()[_0x090f('0x2a')](_0x090f('0x2b')),'voicePause':_0x43e3f5[_0x090f('0x4c')]||![],'mailPause':_0x43e3f5[_0x090f('0x4c')]||![],'chatPause':_0x43e3f5[_0x090f('0x4c')]||![],'faxPause':_0x43e3f5['loginInPause']||![],'smsPause':_0x43e3f5[_0x090f('0x4c')]||![],'openchannelPause':_0x43e3f5[_0x090f('0x4c')]||![],'pauseType':_0x43e3f5[_0x090f('0x4c')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x090f('0x2a')](_0x090f('0x2b')),'interface':_0x7802c});}})[_0x090f('0x16')](function(_0x582b69){_0x5895e3(_0x582b69);})[_0x090f('0x1a')](function(_0x2c3f15){_0x216ba8(_0x3e479a[_0x090f('0x1b')](0x1f4,_0x2c3f15[_0x090f('0x1c')]));});});}; \ No newline at end of file +var _0x4987=['type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','role','online','chatPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','system','destroy','all','LoginUser','mobile','phone','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt','getVoiceQueues','upsert','loginInPause','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','include','map','model','attributes','then','info','debug','stringify','catch','error','message','ShowUser','PauseUser','find','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','PAUSE','length','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x4987,0x7e));var _0x7498=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4987[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7498('0x0'));var util=require(_0x7498('0x1'));var moment=require(_0x7498('0x2'));var BPromise=require(_0x7498('0x3'));var Redis=require(_0x7498('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7498('0x5'));var logger=require(_0x7498('0x6'))(_0x7498('0x7'));var config=require(_0x7498('0x8'));config[_0x7498('0x9')]=_[_0x7498('0xa')](config[_0x7498('0x9')],{'host':_0x7498('0xb'),'port':0x18eb});var socket=require(_0x7498('0xc'))(new Redis(config[_0x7498('0x9')]));require(_0x7498('0xd'))[_0x7498('0xe')](socket);exports[_0x7498('0xf')]=function(_0x2dec5a){var _0x383566=this;return new Promise(function(_0x1b856c,_0x1494cd){return db[_0x7498('0x10')][_0x7498('0x11')]({'raw':_0x2dec5a[_0x7498('0x12')]?_0x2dec5a[_0x7498('0x12')][_0x7498('0x13')]===undefined?!![]:![]:!![],'where':_0x2dec5a[_0x7498('0x12')]?_0x2dec5a[_0x7498('0x12')][_0x7498('0x14')]||null:null,'attributes':_0x2dec5a[_0x7498('0x12')]?_0x2dec5a[_0x7498('0x12')]['attributes']||null:null,'limit':_0x2dec5a[_0x7498('0x12')]?_0x2dec5a['options']['limit']||null:null,'include':_0x2dec5a[_0x7498('0x12')]?_0x2dec5a[_0x7498('0x12')][_0x7498('0x15')]?_[_0x7498('0x16')](_0x2dec5a['options']['include'],function(_0xa262c7){return{'model':db[_0xa262c7[_0x7498('0x17')]],'as':_0xa262c7['as'],'attributes':_0xa262c7[_0x7498('0x18')],'include':_0xa262c7[_0x7498('0x15')]?_[_0x7498('0x16')](_0xa262c7[_0x7498('0x15')],function(_0x4c0eb8){return{'model':db[_0x4c0eb8[_0x7498('0x17')]],'as':_0x4c0eb8['as'],'attributes':_0x4c0eb8[_0x7498('0x18')],'include':_0x4c0eb8[_0x7498('0x15')]?_[_0x7498('0x16')](_0x4c0eb8[_0x7498('0x15')],function(_0x544d20){return{'model':db[_0x544d20[_0x7498('0x17')]],'as':_0x544d20['as'],'attributes':_0x544d20[_0x7498('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7498('0x19')](function(_0x52d332){logger[_0x7498('0x1a')](_0x7498('0xf'),_0x2dec5a);logger[_0x7498('0x1b')]('GetUser',_0x2dec5a,JSON[_0x7498('0x1c')](_0x52d332));_0x1b856c(_0x52d332);})[_0x7498('0x1d')](function(_0x140d87){logger[_0x7498('0x1e')](_0x7498('0xf'),_0x140d87[_0x7498('0x1f')],_0x2dec5a);_0x1494cd(_0x383566['error'](0x1f4,_0x140d87[_0x7498('0x1f')]));});});};exports[_0x7498('0x20')]=function(_0x9b2f3){var _0x97348d=this;return new Promise(function(_0x50feb6,_0x245f26){return db[_0x7498('0x10')]['find']({'raw':_0x9b2f3[_0x7498('0x12')]?_0x9b2f3['options'][_0x7498('0x13')]===undefined?!![]:![]:!![],'where':_0x9b2f3['options']?_0x9b2f3['options'][_0x7498('0x14')]||null:null,'attributes':_0x9b2f3[_0x7498('0x12')]?_0x9b2f3['options']['attributes']||null:null,'include':_0x9b2f3['options']?_0x9b2f3[_0x7498('0x12')]['include']?_[_0x7498('0x16')](_0x9b2f3['options'][_0x7498('0x15')],function(_0x254edb){return{'model':db[_0x254edb[_0x7498('0x17')]],'as':_0x254edb['as'],'attributes':_0x254edb[_0x7498('0x18')],'include':_0x254edb[_0x7498('0x15')]?_[_0x7498('0x16')](_0x254edb[_0x7498('0x15')],function(_0xcf9a23){return{'model':db[_0xcf9a23[_0x7498('0x17')]],'as':_0xcf9a23['as'],'attributes':_0xcf9a23[_0x7498('0x18')],'include':_0xcf9a23[_0x7498('0x15')]?_[_0x7498('0x16')](_0xcf9a23[_0x7498('0x15')],function(_0x387eb6){return{'model':db[_0x387eb6[_0x7498('0x17')]],'as':_0x387eb6['as'],'attributes':_0x387eb6['attributes']};}):[]};}):[]};}):[]:[]})[_0x7498('0x19')](function(_0x378900){logger[_0x7498('0x1a')](_0x7498('0x20'),_0x9b2f3);logger[_0x7498('0x1b')]('ShowUser',_0x9b2f3,JSON[_0x7498('0x1c')](_0x378900));_0x50feb6(_0x378900);})[_0x7498('0x1d')](function(_0x3215e3){logger['error'](_0x7498('0x20'),_0x3215e3['message'],_0x9b2f3);_0x245f26(_0x97348d[_0x7498('0x1e')](0x1f4,_0x3215e3['message']));});});};exports[_0x7498('0x21')]=function(_0x167ae3){var _0x4f292b;return db[_0x7498('0x10')][_0x7498('0x22')]({'where':_0x167ae3[_0x7498('0x12')][_0x7498('0x14')]||{},'attributes':['id',_0x7498('0x23'),'role',_0x7498('0x24'),_0x7498('0x25')]})['then'](function(_0x1f8d11){if(!_0x1f8d11){throw new Error(util[_0x7498('0x26')](_0x7498('0x27'),_0x167ae3[_0x7498('0x28')]['id']));}_0x4f292b=_0x1f8d11;return db['UserVoiceQueueRt'][_0x7498('0x29')]({'paused':0x1},{'where':{'UserId':_0x4f292b['id']},'individualHooks':!![]});})[_0x7498('0x19')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x4f292b[_0x7498('0x23')],'type':_0x7498('0x2a'),'exitAt':null}});})[_0x7498('0x19')](function(_0x115562){if(_0x115562&&_0x115562[_0x7498('0x2b')]){var _0x1218d6=moment()[_0x7498('0x26')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x358436=0x0,_0x22cc69=_0x115562[_0x7498('0x2b')];_0x358436<_0x22cc69;_0x358436++){_0x115562[_0x358436][_0x7498('0x2c')]({'exitAt':_0x1218d6});}}})[_0x7498('0x19')](function(){var _0x590d70=[];var _0x295278=utils[_0x7498('0x2d')]();_0x295278[_0x7498('0x2e')](function(_0x1a6039){_0x590d70[_0x7498('0x2f')]({'channel':_0x1a6039,'membername':_0x4f292b[_0x7498('0x23')],'interface':_[_0x7498('0x30')](_0x4f292b[_0x7498('0x25')])?util['format'](_0x7498('0x31'),_0x4f292b['name']):_0x4f292b[_0x7498('0x25')],'type':_0x7498('0x2a'),'enterAt':moment()[_0x7498('0x26')](_0x7498('0x32')),'data1':_0x167ae3[_0x7498('0x33')][_0x7498('0x34')]||_0x7498('0x35'),'role':_0x4f292b['role'],'internal':_0x4f292b[_0x7498('0x24')],'uniqueid':_0x167ae3[_0x7498('0x33')][_0x7498('0x36')]||null});});return db[_0x7498('0x37')][_0x7498('0x38')](_0x590d70,{'individualHooks':!![]});})[_0x7498('0x19')](function(){return _0x4f292b[_0x7498('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x167ae3['body'][_0x7498('0x34')]||_0x7498('0x35'),'lastPauseAt':moment()[_0x7498('0x26')](_0x7498('0x32'))});})[_0x7498('0x1d')](function(_0x389f52){throw _0x389f52;});};exports[_0x7498('0x39')]=function(_0x182876){return Promise[_0x7498('0x3a')]()[_0x7498('0x19')](function(){if(_0x182876[_0x7498('0x33')]['channel']&&!utils[_0x7498('0x3b')](_0x182876[_0x7498('0x33')][_0x7498('0x3c')])){throw new Error(util['format'](_0x7498('0x3d'),_0x182876[_0x7498('0x33')][_0x7498('0x3c')]));}return db[_0x7498('0x10')][_0x7498('0x3e')]({'where':_0x182876[_0x7498('0x12')]['where']||{},'attributes':['id','name',_0x7498('0x3f'),'internal',_0x7498('0x25'),_0x7498('0x40'),'voicePause','mailPause',_0x7498('0x41'),'faxPause',_0x7498('0x42'),'smsPause',_0x7498('0x43'),_0x7498('0x44'),_0x7498('0x45')]});})[_0x7498('0x19')](function(_0x595ea9){if(!_0x595ea9){throw new Error(util[_0x7498('0x26')](_0x7498('0x27'),_0x182876[_0x7498('0x28')]['id']));}return _0x595ea9['unpause'](_0x182876['body'][_0x7498('0x3c')],_0x7498('0x46'));})[_0x7498('0x1d')](function(_0x348ab1){throw _0x348ab1;});};exports['LogoutUser']=function(_0x500d46){var _0x21c723=this;return new Promise(function(_0xe97fbc,_0x2c441a){var _0x2b54af;return db[_0x7498('0x10')][_0x7498('0x3e')]({'where':_0x500d46['options'][_0x7498('0x14')]||{},'attributes':['id','name']})[_0x7498('0x19')](function(_0x8211ea){if(_0x8211ea){_0x2b54af=_0x8211ea;return db['UserVoiceQueueRt'][_0x7498('0x47')]({'where':{'membername':_0x2b54af[_0x7498('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x2b54af){return db[_0x7498('0x37')]['findAll']({'where':{'membername':_0x2b54af[_0x7498('0x23')],'exitAt':null}});}})[_0x7498('0x19')](function(_0x274f1d){if(_0x2b54af){if(_0x274f1d&&_0x274f1d['length']){var _0x3b042a=[];_0x274f1d['forEach'](function(_0x3cfc2f){_0x3b042a['push'](_0x3cfc2f[_0x7498('0x29')]({'exitAt':moment()[_0x7498('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7498('0x48')](_0x3b042a);}}})['then'](function(){if(_0x2b54af){return _0x2b54af['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x4d3f28){_0xe97fbc(_0x4d3f28);})[_0x7498('0x1d')](function(_0x56dfcb){_0x2c441a(_0x21c723[_0x7498('0x1e')](0x1f4,_0x56dfcb[_0x7498('0x1f')]));});});};exports[_0x7498('0x49')]=function(_0x4ad186){var _0x5f1b9f=this;return new Promise(function(_0x4b2fd7,_0x315fa1){var _0x3ce29b;var _0x2e55b0;var _0x8a336e;var _0x56c28f;return db[_0x7498('0x10')][_0x7498('0x3e')]({'where':_0x4ad186['options'][_0x7498('0x14')]||{},'attributes':['id',_0x7498('0x23'),_0x7498('0x3f'),_0x7498('0x4a'),_0x7498('0x4b'),_0x7498('0x24'),'loginInPause','interface']})[_0x7498('0x19')](function(_0xd9045f){if(_0xd9045f){_0x3ce29b=_0xd9045f;_0x56c28f=_0x4ad186[_0x7498('0x33')][_0x7498('0x25')]?_0x4ad186[_0x7498('0x33')][_0x7498('0x25')]:util[_0x7498('0x26')](_0x7498('0x31'),_0x3ce29b[_0x7498('0x23')]);return db[_0x7498('0x10')]['count']({'where':{'role':_0x7498('0x4c'),'online':!![],'id':{'$ne':_0x3ce29b['id']}}});}})[_0x7498('0x19')](function(_0xa4e2fd){if(_0xa4e2fd){_0x8a336e=_0xa4e2fd;return require(_0x7498('0x4d'))['getLicense']();}})['then'](function(_0x5022c0){if(_0x5022c0&&_0x5022c0[_0x7498('0x4e')]&&_0x8a336e>=_0x5022c0[_0x7498('0x4e')]){throw new Error(_0x7498('0x4f'));}})[_0x7498('0x19')](function(){if(_0x3ce29b){return db[_0x7498('0x50')][_0x7498('0x47')]({'where':{'membername':_0x3ce29b[_0x7498('0x23')]},'individualHooks':!![]});}})[_0x7498('0x19')](function(){if(_0x3ce29b){return _0x3ce29b[_0x7498('0x51')]({'raw':!![]});}})[_0x7498('0x19')](function(_0x46fb56){if(_0x3ce29b){if(_0x46fb56){var _0x594f6d=[];_0x2e55b0=_0x46fb56;if(_0x2e55b0[_0x7498('0x2b')]){for(var _0x53f305=0x0;_0x53f305<_0x2e55b0[_0x7498('0x2b')];_0x53f305++){_0x594f6d[_0x7498('0x2f')](db['UserVoiceQueueRt'][_0x7498('0x52')]({'membername':_0x3ce29b[_0x7498('0x23')],'UserId':_0x3ce29b['id'],'queue_name':_0x2e55b0[_0x53f305][_0x7498('0x23')],'VoiceQueueId':_0x2e55b0[_0x53f305]['id'],'interface':_0x56c28f,'paused':_0x3ce29b[_0x7498('0x53')]||![],'penalty':_0x2e55b0[_0x53f305]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x594f6d);}}}})[_0x7498('0x19')](function(){if(_0x3ce29b){return db[_0x7498('0x37')][_0x7498('0x11')]({'where':{'membername':_0x3ce29b[_0x7498('0x23')],'exitAt':null}});}})[_0x7498('0x19')](function(_0x2d687d){if(_0x3ce29b){if(_0x2d687d&&_0x2d687d[_0x7498('0x2b')]){var _0x30fdfc=[];_0x2d687d[_0x7498('0x2e')](function(_0xfc3c4b){_0x30fdfc[_0x7498('0x2f')](_0xfc3c4b[_0x7498('0x29')]({'exitAt':moment()[_0x7498('0x26')](_0x7498('0x32'))}));});return BPromise[_0x7498('0x48')](_0x30fdfc);}}})['then'](function(){if(_0x3ce29b){var _0x393001=[];var _0x5b0194=[];var _0x493632=utils[_0x7498('0x2d')]();var _0x1f340f={'membername':_0x3ce29b[_0x7498('0x23')],'interface':_0x56c28f,'enterAt':moment()[_0x7498('0x26')](_0x7498('0x32')),'role':_0x3ce29b[_0x7498('0x3f')],'internal':_0x3ce29b[_0x7498('0x24')]};_0x493632[_0x7498('0x2e')](function(_0x38c91e){_0x393001[_0x7498('0x2f')](_[_0x7498('0x54')]({'channel':_0x38c91e,'type':_0x7498('0x55'),'data1':_0x7498('0x56'),'data2':_0x56c28f},_0x1f340f));if(_0x3ce29b[_0x7498('0x53')]){_0x5b0194['push'](_['merge']({'channel':_0x38c91e,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1f340f));}});return db[_0x7498('0x37')][_0x7498('0x38')](_0x393001[_0x7498('0x57')](_0x5b0194),{'individualHooks':!![]});}})['then'](function(){if(_0x3ce29b){return _0x3ce29b[_0x7498('0x29')]({'online':!![],'lastLoginAt':moment()[_0x7498('0x26')](_0x7498('0x32')),'voicePause':_0x3ce29b['loginInPause']||![],'mailPause':_0x3ce29b['loginInPause']||![],'chatPause':_0x3ce29b['loginInPause']||![],'faxPause':_0x3ce29b[_0x7498('0x53')]||![],'smsPause':_0x3ce29b[_0x7498('0x53')]||![],'openchannelPause':_0x3ce29b[_0x7498('0x53')]||![],'pauseType':_0x3ce29b['loginInPause']?_0x7498('0x58'):null,'lastPauseAt':moment()[_0x7498('0x26')](_0x7498('0x32')),'interface':_0x56c28f});}})['then'](function(_0x256607){_0x4b2fd7(_0x256607);})[_0x7498('0x1d')](function(_0x516535){_0x315fa1(_0x5f1b9f[_0x7498('0x1e')](0x1f4,_0x516535['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8cdcd7d..4cf6e7d 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 _0x791a=['remove','update','emit','length','user:','./user.events','save'];(function(_0x268509,_0x196d93){var _0x5de441=function(_0x5ef235){while(--_0x5ef235){_0x268509['push'](_0x268509['shift']());}};_0x5de441(++_0x196d93);}(_0x791a,0x163));var _0xa791=function(_0x1dd533,_0x4f758b){_0x1dd533=_0x1dd533-0x0;var _0x1029e5=_0x791a[_0x1dd533];return _0x1029e5;};'use strict';var UserEvents=require(_0xa791('0x0'));var events=[_0xa791('0x1'),_0xa791('0x2'),_0xa791('0x3')];function createListener(_0x2be82f,_0xa51200){return function(_0x49be4){_0xa51200[_0xa791('0x4')](_0x2be82f,_0x49be4);};}function removeListener(_0x3302c7,_0x36d059){return function(){UserEvents['removeListener'](_0x3302c7,_0x36d059);};}exports['register']=function(_0x1acc49){for(var _0x57c884=0x0,_0x5d4908=events[_0xa791('0x5')];_0x57c884<_0x5d4908;_0x57c884++){var _0x5e519d=events[_0x57c884];var _0x3db8f9=createListener(_0xa791('0x6')+_0x5e519d,_0x1acc49);UserEvents['on'](_0x5e519d,_0x3db8f9);}}; \ No newline at end of file +var _0x47af=['update','emit','removeListener','register','user:','./user.events','save'];(function(_0x5bcf60,_0x2bd443){var _0x5d3f29=function(_0x239e14){while(--_0x239e14){_0x5bcf60['push'](_0x5bcf60['shift']());}};_0x5d3f29(++_0x2bd443);}(_0x47af,0x98));var _0xf47a=function(_0x4ed9dc,_0x5d0e0e){_0x4ed9dc=_0x4ed9dc-0x0;var _0x23d18c=_0x47af[_0x4ed9dc];return _0x23d18c;};'use strict';var UserEvents=require(_0xf47a('0x0'));var events=[_0xf47a('0x1'),'remove',_0xf47a('0x2')];function createListener(_0x19c2cc,_0xb70307){return function(_0x5a1064){_0xb70307[_0xf47a('0x3')](_0x19c2cc,_0x5a1064);};}function removeListener(_0x5e9660,_0x157c3e){return function(){UserEvents[_0xf47a('0x4')](_0x5e9660,_0x157c3e);};}exports[_0xf47a('0x5')]=function(_0x22f1c9){for(var _0x4cecd0=0x0,_0x5e1610=events['length'];_0x4cecd0<_0x5e1610;_0x4cecd0++){var _0x3ce34b=events[_0x4cecd0];var _0x127382=createListener(_0xf47a('0x6')+_0x3ce34b,_0x22f1c9);UserEvents['on'](_0x3ce34b,_0x127382);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b8bcfff..b08ed54 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3495b7,_0x3054fd){var _0x55eff5=function(_0x401d35){while(--_0x401d35){_0x3495b7['push'](_0x3495b7['shift']());}};_0x55eff5(++_0x3054fd);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4fab6d,_0x244b72){var _0x1c454c=function(_0x1297ec){while(--_0x1297ec){_0x4fab6d['push'](_0x4fab6d['shift']());}};_0x1c454c(++_0x244b72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d18528f..6f17f6c 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 _0x0689=['exports'];(function(_0xdf957a,_0x5e3f30){var _0x3aa727=function(_0x5d471b){while(--_0x5d471b){_0xdf957a['push'](_0xdf957a['shift']());}};_0x3aa727(++_0x5e3f30);}(_0x0689,0x161));var _0x9068=function(_0x2d7d81,_0x58179c){_0x2d7d81=_0x2d7d81-0x0;var _0x26e6e6=_0x0689[_0x2d7d81];return _0x26e6e6;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa3ab=['INTEGER','sequelize','exports'];(function(_0x14562a,_0x4d3bed){var _0x1d1f9a=function(_0x373dee){while(--_0x373dee){_0x14562a['push'](_0x14562a['shift']());}};_0x1d1f9a(++_0x4d3bed);}(_0xa3ab,0x103));var _0xba3a=function(_0x37dded,_0x23e68e){_0x37dded=_0x37dded-0x0;var _0x25a30b=_0xa3ab[_0x37dded];return _0x25a30b;};'use strict';var Sequelize=require(_0xba3a('0x0'));module[_0xba3a('0x1')]={'penalty':{'type':Sequelize[_0xba3a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e35a8e0..5acd414 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 _0x88b6=['../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues','util','api','bluebird','request-promise','path'];(function(_0x11cbd2,_0x4da7c9){var _0x58643b=function(_0x268b15){while(--_0x268b15){_0x11cbd2['push'](_0x11cbd2['shift']());}};_0x58643b(++_0x4da7c9);}(_0x88b6,0x109));var _0x688b=function(_0x5014de,_0x2e5b19){_0x5014de=_0x5014de-0x0;var _0x19a5c4=_0x88b6[_0x5014de];return _0x19a5c4;};'use strict';var _=require('lodash');var util=require(_0x688b('0x0'));var logger=require('../../config/logger')(_0x688b('0x1'));var moment=require('moment');var BPromise=require(_0x688b('0x2'));var rp=require(_0x688b('0x3'));var fs=require('fs');var path=require(_0x688b('0x4'));var rimraf=require('rimraf');var config=require(_0x688b('0x5'));var attributes=require(_0x688b('0x6'));module[_0x688b('0x7')]=function(_0x32dbb9,_0x82ee96){return _0x32dbb9['define']('UserChatQueue',attributes,{'tableName':_0x688b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9395=['path','../../config/environment','./userChatQueue.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x9395,0x144));var _0x5939=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9395[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x5939('0x0'));var logger=require(_0x5939('0x1'))(_0x5939('0x2'));var moment=require(_0x5939('0x3'));var BPromise=require(_0x5939('0x4'));var rp=require(_0x5939('0x5'));var fs=require('fs');var path=require(_0x5939('0x6'));var rimraf=require('rimraf');var config=require(_0x5939('0x7'));var attributes=require(_0x5939('0x8'));module['exports']=function(_0x582e17,_0x2d8006){return _0x582e17[_0x5939('0x9')]('UserChatQueue',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 09dcf4c..0418118 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 _0x6fb3=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x20dd46,_0xbe15b4){var _0x2166ba=function(_0x4cc954){while(--_0x4cc954){_0x20dd46['push'](_0x20dd46['shift']());}};_0x2166ba(++_0xbe15b4);}(_0x6fb3,0xa3));var _0x36fb=function(_0x243624,_0x53494a){_0x243624=_0x243624-0x0;var _0x458ad1=_0x6fb3[_0x243624];return _0x458ad1;};'use strict';var _=require('lodash');var util=require(_0x36fb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36fb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x36fb('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x36fb('0x3'));var jayson=require(_0x36fb('0x4'));var client=jayson[_0x36fb('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x469cf3,_0x72c5af,_0x256cef){return new BPromise(function(_0x53a580,_0x1c677a){return client[_0x36fb('0x6')](_0x469cf3,_0x256cef)[_0x36fb('0x7')](function(_0x39ebbb){logger['info'](_0x36fb('0x8'),_0x72c5af,_0x36fb('0x9'));logger[_0x36fb('0xa')](_0x36fb('0xb'),_0x72c5af,_0x36fb('0x9'),JSON[_0x36fb('0xc')](_0x39ebbb));if(_0x39ebbb['error']){if(_0x39ebbb[_0x36fb('0xd')][_0x36fb('0xe')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x72c5af,_0x39ebbb[_0x36fb('0xd')][_0x36fb('0xf')]);return _0x1c677a(_0x39ebbb[_0x36fb('0xd')]['message']);}logger[_0x36fb('0xd')](_0x36fb('0x8'),_0x72c5af,_0x39ebbb[_0x36fb('0xd')]['message']);return _0x53a580(_0x39ebbb[_0x36fb('0xd')][_0x36fb('0xf')]);}else{logger[_0x36fb('0x10')](_0x36fb('0x8'),_0x72c5af,'request\x20sent');_0x53a580(_0x39ebbb[_0x36fb('0x11')]['message']);}})[_0x36fb('0x12')](function(_0x340c72){logger[_0x36fb('0xd')](_0x36fb('0x8'),_0x72c5af,_0x340c72);_0x1c677a(_0x340c72);});});} \ No newline at end of file +var _0xc647=['message','result','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s'];(function(_0x507e62,_0x12f09a){var _0x573d57=function(_0xca8637){while(--_0xca8637){_0x507e62['push'](_0x507e62['shift']());}};_0x573d57(++_0x12f09a);}(_0xc647,0x163));var _0x7c64=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xc647[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require('lodash');var util=require(_0x7c64('0x0'));var moment=require(_0x7c64('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c64('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c64('0x3'));var logger=require('../../config/logger')(_0x7c64('0x4'));var config=require(_0x7c64('0x5'));var jayson=require(_0x7c64('0x6'));var client=jayson[_0x7c64('0x7')][_0x7c64('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5599d7,_0x9c0e1d,_0x1a6ec1){return new BPromise(function(_0x3ad78f,_0x3643e4){return client[_0x7c64('0x9')](_0x5599d7,_0x1a6ec1)[_0x7c64('0xa')](function(_0x24025d){logger[_0x7c64('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x9c0e1d,_0x7c64('0xc'));logger[_0x7c64('0xd')](_0x7c64('0xe'),_0x9c0e1d,_0x7c64('0xc'),JSON[_0x7c64('0xf')](_0x24025d));if(_0x24025d['error']){if(_0x24025d[_0x7c64('0x10')][_0x7c64('0x11')]===0x1f4){logger[_0x7c64('0x10')](_0x7c64('0x12'),_0x9c0e1d,_0x24025d[_0x7c64('0x10')][_0x7c64('0x13')]);return _0x3643e4(_0x24025d[_0x7c64('0x10')]['message']);}logger[_0x7c64('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x9c0e1d,_0x24025d['error'][_0x7c64('0x13')]);return _0x3ad78f(_0x24025d[_0x7c64('0x10')][_0x7c64('0x13')]);}else{logger[_0x7c64('0xb')](_0x7c64('0x12'),_0x9c0e1d,_0x7c64('0xc'));_0x3ad78f(_0x24025d[_0x7c64('0x14')][_0x7c64('0x13')]);}})[_0x7c64('0x15')](function(_0x448eb7){logger[_0x7c64('0x10')](_0x7c64('0x12'),_0x9c0e1d,_0x448eb7);_0x3643e4(_0x448eb7);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cdbc8d5..55f683c 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x116325,_0x52796b){var _0x3ff66e=function(_0x5d61b5){while(--_0x5d61b5){_0x116325['push'](_0x116325['shift']());}};_0x3ff66e(++_0x52796b);}(_0xedd9,0xfc));var _0x9edd=function(_0x45b695,_0xa2c64f){_0x45b695=_0x45b695-0x0;var _0x3abe1e=_0xedd9[_0x45b695];return _0x3abe1e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1ecb76,_0x5b3537){var _0x10fd19=function(_0x1913c1){while(--_0x1913c1){_0x1ecb76['push'](_0x1ecb76['shift']());}};_0x10fd19(++_0x5b3537);}(_0x70e0,0x17b));var _0x070e=function(_0x1e6bcc,_0x17ffd8){_0x1e6bcc=_0x1e6bcc-0x0;var _0x1e6335=_0x70e0[_0x1e6bcc];return _0x1e6335;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 67141b3..d89b490 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 _0xf21b=['sequelize','INTEGER','STRING'];(function(_0x202067,_0x25e057){var _0x4c792e=function(_0xd90a73){while(--_0xd90a73){_0x202067['push'](_0x202067['shift']());}};_0x4c792e(++_0x25e057);}(_0xf21b,0xb4));var _0xbf21=function(_0xcfcb5a,_0x4d40c6){_0xcfcb5a=_0xcfcb5a-0x0;var _0x4503e0=_0xf21b[_0xcfcb5a];return _0x4503e0;};'use strict';var Sequelize=require(_0xbf21('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbf21('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbf21('0x2')]}}; \ No newline at end of file +var _0xde32=['sequelize','exports','INTEGER','STRING'];(function(_0x4ea9be,_0x46b27b){var _0x2c75a5=function(_0x2c334d){while(--_0x2c334d){_0x4ea9be['push'](_0x4ea9be['shift']());}};_0x2c75a5(++_0x46b27b);}(_0xde32,0xa8));var _0x2de3=function(_0x42eb9a,_0x5ade90){_0x42eb9a=_0x42eb9a-0x0;var _0x4f36d0=_0xde32[_0x42eb9a];return _0x4f36d0;};'use strict';var Sequelize=require(_0x2de3('0x0'));module[_0x2de3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2de3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2de3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index feda61d..000a60a 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 _0xddd4=['path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','moment','bluebird'];(function(_0x36c4fb,_0x20193c){var _0x13697a=function(_0x23e879){while(--_0x23e879){_0x36c4fb['push'](_0x36c4fb['shift']());}};_0x13697a(++_0x20193c);}(_0xddd4,0x16e));var _0x4ddd=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xddd4[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x4ddd('0x0'));var util=require(_0x4ddd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ddd('0x2'));var BPromise=require(_0x4ddd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ddd('0x4'));var rimraf=require(_0x4ddd('0x5'));var config=require(_0x4ddd('0x6'));var attributes=require(_0x4ddd('0x7'));module['exports']=function(_0x3fd222,_0x6296b1){return _0x3fd222[_0x4ddd('0x8')](_0x4ddd('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a62=['define','user_has_fax_queues','lodash','util','api','moment','path','./userFaxQueue.attributes','exports'];(function(_0x339b9a,_0x3f923d){var _0x52f54c=function(_0x1c03d1){while(--_0x1c03d1){_0x339b9a['push'](_0x339b9a['shift']());}};_0x52f54c(++_0x3f923d);}(_0x3a62,0x1a0));var _0x23a6=function(_0x521827,_0x5b58ae){_0x521827=_0x521827-0x0;var _0x375afa=_0x3a62[_0x521827];return _0x375afa;};'use strict';var _=require(_0x23a6('0x0'));var util=require(_0x23a6('0x1'));var logger=require('../../config/logger')(_0x23a6('0x2'));var moment=require(_0x23a6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x23a6('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23a6('0x5'));module[_0x23a6('0x6')]=function(_0x5f5623,_0x5b7ed3){return _0x5f5623[_0x23a6('0x7')]('UserFaxQueue',attributes,{'tableName':_0x23a6('0x8'),'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 3c2b343..e247a5c 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 _0xad16=['client','http','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4939c9,_0x31de19){var _0x4ac1b9=function(_0x4810bc){while(--_0x4810bc){_0x4939c9['push'](_0x4939c9['shift']());}};_0x4ac1b9(++_0x31de19);}(_0xad16,0x1c5));var _0x6ad1=function(_0x503691,_0x458a17){_0x503691=_0x503691-0x0;var _0x127999=_0xad16[_0x503691];return _0x127999;};'use strict';var _=require(_0x6ad1('0x0'));var util=require('util');var moment=require(_0x6ad1('0x1'));var BPromise=require(_0x6ad1('0x2'));var rs=require(_0x6ad1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ad1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ad1('0x5'))(_0x6ad1('0x6'));var config=require(_0x6ad1('0x7'));var jayson=require(_0x6ad1('0x8'));var client=jayson[_0x6ad1('0x9')][_0x6ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f1824,_0x21f361,_0x107c81){return new BPromise(function(_0x415864,_0x14462f){return client[_0x6ad1('0xb')](_0x3f1824,_0x107c81)['then'](function(_0x264372){logger[_0x6ad1('0xc')](_0x6ad1('0xd'),_0x21f361,'request\x20sent');logger[_0x6ad1('0xe')](_0x6ad1('0xf'),_0x21f361,'request\x20sent',JSON[_0x6ad1('0x10')](_0x264372));if(_0x264372[_0x6ad1('0x11')]){if(_0x264372[_0x6ad1('0x11')][_0x6ad1('0x12')]===0x1f4){logger[_0x6ad1('0x11')](_0x6ad1('0xd'),_0x21f361,_0x264372[_0x6ad1('0x11')][_0x6ad1('0x13')]);return _0x14462f(_0x264372[_0x6ad1('0x11')][_0x6ad1('0x13')]);}logger[_0x6ad1('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x21f361,_0x264372[_0x6ad1('0x11')][_0x6ad1('0x13')]);return _0x415864(_0x264372[_0x6ad1('0x11')][_0x6ad1('0x13')]);}else{logger[_0x6ad1('0xc')](_0x6ad1('0xd'),_0x21f361,'request\x20sent');_0x415864(_0x264372['result']['message']);}})[_0x6ad1('0x14')](function(_0x39b099){logger['error'](_0x6ad1('0xd'),_0x21f361,_0x39b099);_0x14462f(_0x39b099);});});} \ No newline at end of file +var _0xa1b1=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1b5c9f,_0x52ce38){var _0x24a388=function(_0x3bdafa){while(--_0x3bdafa){_0x1b5c9f['push'](_0x1b5c9f['shift']());}};_0x24a388(++_0x52ce38);}(_0xa1b1,0x1ee));var _0x1a1b=function(_0x12d034,_0x430f51){_0x12d034=_0x12d034-0x0;var _0x39d6e5=_0xa1b1[_0x12d034];return _0x39d6e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a1b('0x0'));var BPromise=require(_0x1a1b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a1b('0x2'));var db=require(_0x1a1b('0x3'))['db'];var utils=require(_0x1a1b('0x4'));var logger=require(_0x1a1b('0x5'))(_0x1a1b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a1b('0x7')][_0x1a1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x364031,_0x1681da,_0xcf1d43){return new BPromise(function(_0x2e4262,_0x426f84){return client[_0x1a1b('0x9')](_0x364031,_0xcf1d43)[_0x1a1b('0xa')](function(_0x30f16b){logger[_0x1a1b('0xb')](_0x1a1b('0xc'),_0x1681da,_0x1a1b('0xd'));logger['debug'](_0x1a1b('0xe'),_0x1681da,'request\x20sent',JSON[_0x1a1b('0xf')](_0x30f16b));if(_0x30f16b[_0x1a1b('0x10')]){if(_0x30f16b[_0x1a1b('0x10')]['code']===0x1f4){logger[_0x1a1b('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x1681da,_0x30f16b[_0x1a1b('0x10')][_0x1a1b('0x11')]);return _0x426f84(_0x30f16b[_0x1a1b('0x10')][_0x1a1b('0x11')]);}logger[_0x1a1b('0x10')](_0x1a1b('0xc'),_0x1681da,_0x30f16b[_0x1a1b('0x10')]['message']);return _0x2e4262(_0x30f16b['error'][_0x1a1b('0x11')]);}else{logger[_0x1a1b('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x1681da,'request\x20sent');_0x2e4262(_0x30f16b['result'][_0x1a1b('0x11')]);}})[_0x1a1b('0x12')](function(_0x3ab027){logger[_0x1a1b('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x1681da,_0x3ab027);_0x426f84(_0x3ab027);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 20b6ccb..104cc24 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c249a,_0x4a6096){var _0x3edb89=function(_0x46f832){while(--_0x46f832){_0x2c249a['push'](_0x2c249a['shift']());}};_0x3edb89(++_0x4a6096);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x10127d,_0x23904e){var _0x1be595=function(_0x5da6b1){while(--_0x5da6b1){_0x10127d['push'](_0x10127d['shift']());}};_0x1be595(++_0x23904e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xcb91[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 56cea89..649f1f1 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 _0x9a13=['INTEGER','sequelize','exports'];(function(_0x456066,_0x44930c){var _0x5a069a=function(_0x2ed314){while(--_0x2ed314){_0x456066['push'](_0x456066['shift']());}};_0x5a069a(++_0x44930c);}(_0x9a13,0x76));var _0x39a1=function(_0xc0bf1f,_0x38586e){_0xc0bf1f=_0xc0bf1f-0x0;var _0x216555=_0x9a13[_0xc0bf1f];return _0x216555;};'use strict';var Sequelize=require(_0x39a1('0x0'));module[_0x39a1('0x1')]={'penalty':{'type':Sequelize[_0x39a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee5c=['exports','sequelize'];(function(_0x44902f,_0xa0b006){var _0x54ccac=function(_0x5d8dec){while(--_0x5d8dec){_0x44902f['push'](_0x44902f['shift']());}};_0x54ccac(++_0xa0b006);}(_0xee5c,0xcd));var _0xcee5=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xee5c[_0x5e42a7];return _0x36d21b;};'use strict';var Sequelize=require(_0xcee5('0x0'));module[_0xcee5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 33f2f9e..3ce4445 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 _0xd720=['exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x30f6c7,_0x272ea6){var _0x145bc2=function(_0x4efc57){while(--_0x4efc57){_0x30f6c7['push'](_0x30f6c7['shift']());}};_0x145bc2(++_0x272ea6);}(_0xd720,0x1c0));var _0x0d72=function(_0x417634,_0x5c375a){_0x417634=_0x417634-0x0;var _0x219a87=_0xd720[_0x417634];return _0x219a87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d72('0x0'))(_0x0d72('0x1'));var moment=require(_0x0d72('0x2'));var BPromise=require(_0x0d72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d72('0x4'));var rimraf=require(_0x0d72('0x5'));var config=require(_0x0d72('0x6'));var attributes=require(_0x0d72('0x7'));module[_0x0d72('0x8')]=function(_0x4566,_0x32671a){return _0x4566[_0x0d72('0x9')](_0x0d72('0xa'),attributes,{'tableName':_0x0d72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc67c=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xc67c,0x95));var _0xcc67=function(_0x1cc753,_0x155be7){_0x1cc753=_0x1cc753-0x0;var _0x45d5e8=_0xc67c[_0x1cc753];return _0x45d5e8;};'use strict';var _=require(_0xcc67('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcc67('0x1'));var moment=require('moment');var BPromise=require(_0xcc67('0x2'));var rp=require(_0xcc67('0x3'));var fs=require('fs');var path=require(_0xcc67('0x4'));var rimraf=require(_0xcc67('0x5'));var config=require(_0xcc67('0x6'));var attributes=require(_0xcc67('0x7'));module[_0xcc67('0x8')]=function(_0xd7dca9,_0x54882f){return _0xd7dca9[_0xcc67('0x9')](_0xcc67('0xa'),attributes,{'tableName':_0xcc67('0xb'),'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 a9c6ba9..d291e8f 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x1bf702,_0x37164c){var _0x18a7eb=function(_0x574d7b){while(--_0x574d7b){_0x1bf702['push'](_0x1bf702['shift']());}};_0x18a7eb(++_0x37164c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4b84[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x179578,_0x26923f){var _0x5cb7bc=function(_0x3d161b){while(--_0x3d161b){_0x179578['push'](_0x179578['shift']());}};_0x5cb7bc(++_0x26923f);}(_0x55ca,0x126));var _0xa55c=function(_0x17d82f,_0x5d9172){_0x17d82f=_0x17d82f-0x0;var _0x58137b=_0x55ca[_0x17d82f];return _0x58137b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c4f2eca..a525c03 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 _0x36b7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','connect-timeout','Router'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x36b7,0x130));var _0x736b=function(_0x1353d4,_0x25013f){_0x1353d4=_0x1353d4-0x0;var _0xf0f13c=_0x36b7[_0x1353d4];return _0xf0f13c;};'use strict';var multer=require(_0x736b('0x0'));var util=require(_0x736b('0x1'));var path=require('path');var timeout=require(_0x736b('0x2'));var express=require('express');var router=express[_0x736b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x736b('0x4'));var interaction=require(_0x736b('0x5'));var config=require(_0x736b('0x6'));var controller=require(_0x736b('0x7'));router[_0x736b('0x8')]('/',auth[_0x736b('0x9')](),controller['sendUserNotification']);module[_0x736b('0xa')]=router; \ No newline at end of file +var _0x9abc=['../../components/auth/service','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1c9108,_0x26f835){var _0x1ee828=function(_0x3278f5){while(--_0x3278f5){_0x1c9108['push'](_0x1c9108['shift']());}};_0x1ee828(++_0x26f835);}(_0x9abc,0x185));var _0xc9ab=function(_0x4533bc,_0x2f221f){_0x4533bc=_0x4533bc-0x0;var _0x42028f=_0x9abc[_0x4533bc];return _0x42028f;};'use strict';var multer=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var path=require(_0xc9ab('0x2'));var timeout=require(_0xc9ab('0x3'));var express=require(_0xc9ab('0x4'));var router=express[_0xc9ab('0x5')]();var fs_extra=require(_0xc9ab('0x6'));var auth=require(_0xc9ab('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc9ab('0x8'));router[_0xc9ab('0x9')]('/',auth[_0xc9ab('0xa')](),controller['sendUserNotification']);module[_0xc9ab('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 9321c5d..8f5bbc7 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 _0x815c=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x313bb3,_0x5af89c){var _0x19ef94=function(_0x2b62f4){while(--_0x2b62f4){_0x313bb3['push'](_0x313bb3['shift']());}};_0x19ef94(++_0x5af89c);}(_0x815c,0x16a));var _0xc815=function(_0x42003f,_0x1ac84a){_0x42003f=_0x42003f-0x0;var _0x371c69=_0x815c[_0x42003f];return _0x371c69;};'use strict';var Sequelize=require(_0xc815('0x0'));module[_0xc815('0x1')]={'body':{'type':Sequelize[_0xc815('0x2')]},'senderName':{'type':Sequelize[_0xc815('0x3')]},'recipientsId':{'type':Sequelize[_0xc815('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xc815('0x4')]}}; \ No newline at end of file +var _0x892e=['exports','TEXT','STRING','sequelize'];(function(_0x42d510,_0x39dde0){var _0x3cc586=function(_0x2d1115){while(--_0x2d1115){_0x42d510['push'](_0x42d510['shift']());}};_0x3cc586(++_0x39dde0);}(_0x892e,0x19b));var _0xe892=function(_0x507552,_0xf25887){_0x507552=_0x507552-0x0;var _0x358510=_0x892e[_0x507552];return _0x358510;};'use strict';var Sequelize=require(_0xe892('0x0'));module[_0xe892('0x1')]={'body':{'type':Sequelize[_0xe892('0x2')]},'senderName':{'type':Sequelize[_0xe892('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3678d56..7f12901 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 _0x1f0d=['update','then','destroy','end','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','sequelize','transaction','UserNotification','forEach','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','model','User','union','replace','queue','Queue','ids','push','all','flatten','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f0d,0x107));var _0xd1f0=function(_0xdaae0b,_0x25fb65){_0xdaae0b=_0xdaae0b-0x0;var _0x5df895=_0x1f0d[_0xdaae0b];return _0x5df895;};'use strict';var emlformat=require(_0xd1f0('0x0'));var rimraf=require(_0xd1f0('0x1'));var zipdir=require(_0xd1f0('0x2'));var jsonpatch=require(_0xd1f0('0x3'));var rp=require('request-promise');var moment=require(_0xd1f0('0x4'));var BPromise=require(_0xd1f0('0x5'));var Mustache=require(_0xd1f0('0x6'));var util=require(_0xd1f0('0x7'));var path=require(_0xd1f0('0x8'));var sox=require('sox');var csv=require(_0xd1f0('0x9'));var ejs=require(_0xd1f0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1f0('0xb'));var squel=require(_0xd1f0('0xc'));var crypto=require(_0xd1f0('0xd'));var jsforce=require(_0xd1f0('0xe'));var deskjs=require(_0xd1f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd1f0('0x10'));var Papa=require(_0xd1f0('0x11'));var Redis=require('ioredis');var authService=require(_0xd1f0('0x12'));var qs=require(_0xd1f0('0x13'));var as=require(_0xd1f0('0x14'));var hardwareService=require(_0xd1f0('0x15'));var logger=require('../../config/logger')(_0xd1f0('0x16'));var utils=require(_0xd1f0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd1f0('0x18'));var db=require(_0xd1f0('0x19'))['db'];config[_0xd1f0('0x1a')]=_['defaults'](config[_0xd1f0('0x1a')],{'host':_0xd1f0('0x1b'),'port':0x18eb});var socket=require(_0xd1f0('0x1c'))(new Redis(config[_0xd1f0('0x1a')]));require('./userNotification.socket')[_0xd1f0('0x1d')](socket);function respondWithStatusCode(_0x228152,_0x13199a){_0x13199a=_0x13199a||0xcc;return function(_0x5d51c5){if(_0x5d51c5){return _0x228152[_0xd1f0('0x1e')](_0x13199a);}return _0x228152[_0xd1f0('0x1f')](_0x13199a)['end']();};}function respondWithResult(_0x154558,_0x2904e1){_0x2904e1=_0x2904e1||0xc8;return function(_0x4d9b0b){if(_0x4d9b0b){return _0x154558['status'](_0x2904e1)[_0xd1f0('0x20')](_0x4d9b0b);}};}function respondWithFilteredResult(_0xe17074,_0x202fa3){return function(_0x5dc253){if(_0x5dc253){var _0x4aa241=typeof _0x202fa3['offset']===_0xd1f0('0x21')&&typeof _0x202fa3['limit']===_0xd1f0('0x21');var _0x569b4e=_0x5dc253[_0xd1f0('0x22')];var _0x3c1737=_0x4aa241?0x0:_0x202fa3['offset'];var _0x2c10c3=_0x4aa241?_0x5dc253[_0xd1f0('0x22')]:_0x202fa3[_0xd1f0('0x23')]+_0x202fa3[_0xd1f0('0x24')];var _0x557936;if(_0x2c10c3>=_0x569b4e){_0x2c10c3=_0x569b4e;_0x557936=0xc8;}else{_0x557936=0xce;}_0xe17074['status'](_0x557936);return _0xe17074['set'](_0xd1f0('0x25'),_0x3c1737+'-'+_0x2c10c3+'/'+_0x569b4e)['json'](_0x5dc253);}return null;};}function patchUpdates(_0x5716ea){return function(_0xe6e3d1){try{jsonpatch['apply'](_0xe6e3d1,_0x5716ea,!![]);}catch(_0xf6aced){return BPromise[_0xd1f0('0x26')](_0xf6aced);}return _0xe6e3d1[_0xd1f0('0x27')]();};}function saveUpdates(_0x455935,_0x4008d9){return function(_0x2f8202){if(_0x2f8202){return _0x2f8202[_0xd1f0('0x28')](_0x455935)[_0xd1f0('0x29')](function(_0x4688fe){return _0x4688fe;});}return null;};}function removeEntity(_0x2947c9,_0x24fdad){return function(_0x374931){if(_0x374931){return _0x374931[_0xd1f0('0x2a')]()['then'](function(){_0x2947c9['status'](0xcc)[_0xd1f0('0x2b')]();});}};}function handleEntityNotFound(_0x3e9fb0,_0xff5443){return function(_0x2a28a4){if(!_0x2a28a4){_0x3e9fb0[_0xd1f0('0x1e')](0x194);}return _0x2a28a4;};}function handleError(_0x50736f,_0x1672d2){_0x1672d2=_0x1672d2||0x1f4;return function(_0x8f046a){logger[_0xd1f0('0x2c')](_0x8f046a[_0xd1f0('0x2d')]);if(_0x8f046a[_0xd1f0('0x2e')]){delete _0x8f046a['name'];}_0x50736f[_0xd1f0('0x1f')](_0x1672d2)[_0xd1f0('0x2f')](_0x8f046a);};}exports[_0xd1f0('0x30')]=function(_0x5d833f,_0x197753,_0x5d1884){if(!_0x5d833f[_0xd1f0('0x31')]['hasOwnProperty'](_0xd1f0('0x32'))&&!_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x33')](_0xd1f0('0x34'))){throw new db['Sequelize'][(_0xd1f0('0x35'))](_0xd1f0('0x36'));}else{if(_0x5d833f[_0xd1f0('0x31')]['hasOwnProperty'](_0xd1f0('0x34'))&&!_0x5d833f[_0xd1f0('0x31')]['hasOwnProperty']('view')){throw new db[(_0xd1f0('0x37'))][(_0xd1f0('0x35'))](_0xd1f0('0x38'));}if(!_0x5d833f['body'][_0xd1f0('0x33')](_0xd1f0('0x39'))){throw new db[(_0xd1f0('0x37'))][(_0xd1f0('0x35'))](_0xd1f0('0x3a'));}else{try{var _0x5e0a8c=JSON[_0xd1f0('0x3b')](_0x5d833f[_0xd1f0('0x31')]['recipients']);}catch(_0x24ae53){logger['error'](_0x24ae53);throw new db[(_0xd1f0('0x37'))][(_0xd1f0('0x35'))](_0xd1f0('0x3c'));}var _0x129838=['chatqueue',_0xd1f0('0x3d'),_0xd1f0('0x3e'),_0xd1f0('0x3f'),_0xd1f0('0x40'),_0xd1f0('0x41'),_0xd1f0('0x42'),'team',_0xd1f0('0x43')];if(_[_0xd1f0('0x44')](_0x5e0a8c,function(_0x27b628){return!_[_0xd1f0('0x45')](_0x129838,_0x27b628['model'][_0xd1f0('0x46')]());})){throw new db['Sequelize'][(_0xd1f0('0x35'))](_0xd1f0('0x47'));}}}var _0x1a45f4={};_0x1a45f4[_0xd1f0('0x48')]=_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x33')](_0xd1f0('0x48'))?_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x48')]:_0x5d833f[_0xd1f0('0x43')][_0xd1f0('0x49')];_0x1a45f4['recipientsDescription']=_[_0xd1f0('0x4a')](_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x4b')])?null:_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x4b')];_0x1a45f4[_0xd1f0('0x4c')]=_0x5d833f[_0xd1f0('0x31')][_0xd1f0('0x4c')]||![];_0x1a45f4['SenderId']=_0x5d833f[_0xd1f0('0x43')]['id'];return getContent(_0x5d833f[_0xd1f0('0x31')])[_0xd1f0('0x29')](function(_0x1ebbb5){_0x1a45f4[_0xd1f0('0x31')]=_0x1ebbb5;return getRecipients(_0x5e0a8c);})[_0xd1f0('0x29')](function(_0x3d75e9){_0x1a45f4[_0xd1f0('0x4d')]=_[_0xd1f0('0x4e')](_0x3d75e9)['join'](',');return db[_0xd1f0('0x4f')][_0xd1f0('0x50')](function(_0x5d28b4){return db[_0xd1f0('0x51')]['create'](_0x1a45f4,{'raw':!![],'transaction':_0x5d28b4})[_0xd1f0('0x29')](function(_0x1e719f){var _0x1e6143={'sender':_0x1a45f4['senderName'],'description':_0x1a45f4['recipientsDescription'],'content':_0x1a45f4[_0xd1f0('0x31')],'beep':_0x1a45f4[_0xd1f0('0x4c')]};_0x3d75e9[_0xd1f0('0x52')](function(_0x35f87a){_0x1e6143['recipient']=_0x35f87a;socket[_0xd1f0('0x53')]('userNotification:send',_0x1e6143);});return _0x1e719f;});});})[_0xd1f0('0x29')](respondWithResult(_0x197753,0xc9))[_0xd1f0('0x54')](handleError(_0x197753,null));};function getContent(_0xb16a4c){return new BPromise(function(_0x3ee4ac,_0x21efd1){if(_0xb16a4c[_0xd1f0('0x32')]){_0x3ee4ac(_0xb16a4c[_0xd1f0('0x32')]);return;}return db[_0xd1f0('0x55')][_0xd1f0('0x56')]({'attributes':[_0xd1f0('0x57')],'where':{'id':_0xb16a4c[_0xd1f0('0x34')]},'raw':!![]})[_0xd1f0('0x29')](function(_0x41bdf3){if(!_0x41bdf3)throw new db[(_0xd1f0('0x37'))]['ValidationError'](_0xd1f0('0x58'));var _0x3c44cf=Mustache[_0xd1f0('0x59')](_0x41bdf3[_0xd1f0('0x57')],_0xb16a4c[_0xd1f0('0x5a')]);_0x3ee4ac(_0x3c44cf);})[_0xd1f0('0x54')](function(_0x26c66f){_0x21efd1(_0x26c66f);});});}function getRecipients(_0x127341){return new BPromise(function(_0x4cf3da,_0x4578d0){var _0x638122=[];var _0x2163fb=[];_0x127341[_0xd1f0('0x52')](function(_0x2d65a3){var _0x10874a=_['startCase'](_0x2d65a3[_0xd1f0('0x5b')][_0xd1f0('0x46')]());if(_0x10874a===_0xd1f0('0x5c')){_0x638122=_[_0xd1f0('0x5d')](_0x638122,_0x2d65a3['ids']);}else{if(_[_0xd1f0('0x45')](_0x10874a,'queue'))_0x10874a=_0x10874a[_0xd1f0('0x5e')](_0xd1f0('0x5f'),_0xd1f0('0x60'));_0x2d65a3[_0xd1f0('0x61')]['forEach'](function(_0x240b6b){_0x2163fb[_0xd1f0('0x62')](getAgents(_0x10874a,_0x240b6b));});}});return BPromise[_0xd1f0('0x63')](_0x2163fb)[_0xd1f0('0x29')](function(_0x129c04){_0x638122=_['union'](_0x638122,_[_0xd1f0('0x64')](_0x129c04));_0x4cf3da(_0x638122);})['catch'](function(_0x5eecc0){_0x4578d0(_0x5eecc0);});});}function getAgents(_0x12320a,_0x59658f){return new BPromise(function(_0x4b721d,_0x59b8c3){return db[_0x12320a][_0xd1f0('0x56')]({'where':{'id':_0x59658f}})[_0xd1f0('0x29')](function(_0x520337){return _0x520337['getAgents']({'attributes':['id'],'raw':!![]})[_0xd1f0('0x29')](function(_0x1019b7){var _0x236dc8=_['map'](_0x1019b7,'id');_0x4b721d(_0x236dc8);});})[_0xd1f0('0x54')](function(_0x49351b){_0x59b8c3(_0x49351b);});});} \ No newline at end of file +var _0xa404=['sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','queue','replace','Queue','all','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa404,0x184));var _0x4a40=function(_0xffb4a2,_0x1e16da){_0xffb4a2=_0xffb4a2-0x0;var _0x4caeb8=_0xa404[_0xffb4a2];return _0x4caeb8;};'use strict';var emlformat=require(_0x4a40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a40('0x1'));var jsonpatch=require(_0x4a40('0x2'));var rp=require(_0x4a40('0x3'));var moment=require(_0x4a40('0x4'));var BPromise=require(_0x4a40('0x5'));var Mustache=require('mustache');var util=require(_0x4a40('0x6'));var path=require(_0x4a40('0x7'));var sox=require(_0x4a40('0x8'));var csv=require('to-csv');var ejs=require(_0x4a40('0x9'));var fs=require('fs');var fs_extra=require(_0x4a40('0xa'));var _=require('lodash');var squel=require(_0x4a40('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a40('0xc'));var toCsv=require(_0x4a40('0xd'));var querystring=require('querystring');var Papa=require(_0x4a40('0xe'));var Redis=require(_0x4a40('0xf'));var authService=require(_0x4a40('0x10'));var qs=require(_0x4a40('0x11'));var as=require(_0x4a40('0x12'));var hardwareService=require(_0x4a40('0x13'));var logger=require('../../config/logger')(_0x4a40('0x14'));var utils=require(_0x4a40('0x15'));var config=require(_0x4a40('0x16'));var licenseUtil=require(_0x4a40('0x17'));var db=require(_0x4a40('0x18'))['db'];config[_0x4a40('0x19')]=_[_0x4a40('0x1a')](config[_0x4a40('0x19')],{'host':_0x4a40('0x1b'),'port':0x18eb});var socket=require(_0x4a40('0x1c'))(new Redis(config[_0x4a40('0x19')]));require(_0x4a40('0x1d'))[_0x4a40('0x1e')](socket);function respondWithStatusCode(_0x1ca170,_0x623795){_0x623795=_0x623795||0xcc;return function(_0x58b7fe){if(_0x58b7fe){return _0x1ca170[_0x4a40('0x1f')](_0x623795);}return _0x1ca170['status'](_0x623795)['end']();};}function respondWithResult(_0x2f4900,_0x3ba738){_0x3ba738=_0x3ba738||0xc8;return function(_0x206858){if(_0x206858){return _0x2f4900[_0x4a40('0x20')](_0x3ba738)[_0x4a40('0x21')](_0x206858);}};}function respondWithFilteredResult(_0x1f77e7,_0x3d36ce){return function(_0x30931c){if(_0x30931c){var _0x31f17f=typeof _0x3d36ce[_0x4a40('0x22')]===_0x4a40('0x23')&&typeof _0x3d36ce['limit']===_0x4a40('0x23');var _0x4c9b02=_0x30931c[_0x4a40('0x24')];var _0x270000=_0x31f17f?0x0:_0x3d36ce[_0x4a40('0x22')];var _0x476ddc=_0x31f17f?_0x30931c[_0x4a40('0x24')]:_0x3d36ce['offset']+_0x3d36ce[_0x4a40('0x25')];var _0x3c0cad;if(_0x476ddc>=_0x4c9b02){_0x476ddc=_0x4c9b02;_0x3c0cad=0xc8;}else{_0x3c0cad=0xce;}_0x1f77e7[_0x4a40('0x20')](_0x3c0cad);return _0x1f77e7['set']('Content-Range',_0x270000+'-'+_0x476ddc+'/'+_0x4c9b02)[_0x4a40('0x21')](_0x30931c);}return null;};}function patchUpdates(_0x725f0f){return function(_0x3655b7){try{jsonpatch[_0x4a40('0x26')](_0x3655b7,_0x725f0f,!![]);}catch(_0x2c3bf6){return BPromise['reject'](_0x2c3bf6);}return _0x3655b7[_0x4a40('0x27')]();};}function saveUpdates(_0x57ea6f,_0x4a0f69){return function(_0x835b28){if(_0x835b28){return _0x835b28['update'](_0x57ea6f)[_0x4a40('0x28')](function(_0x53d354){return _0x53d354;});}return null;};}function removeEntity(_0x346ce7,_0x56d6f5){return function(_0x38de49){if(_0x38de49){return _0x38de49[_0x4a40('0x29')]()[_0x4a40('0x28')](function(){_0x346ce7[_0x4a40('0x20')](0xcc)[_0x4a40('0x2a')]();});}};}function handleEntityNotFound(_0xcd0228,_0x2410e5){return function(_0x26fae4){if(!_0x26fae4){_0xcd0228[_0x4a40('0x1f')](0x194);}return _0x26fae4;};}function handleError(_0x51c355,_0x4bc124){_0x4bc124=_0x4bc124||0x1f4;return function(_0x5532a6){logger[_0x4a40('0x2b')](_0x5532a6[_0x4a40('0x2c')]);if(_0x5532a6['name']){delete _0x5532a6[_0x4a40('0x2d')];}_0x51c355['status'](_0x4bc124)[_0x4a40('0x2e')](_0x5532a6);};}exports[_0x4a40('0x2f')]=function(_0x3ec6ab,_0x130a39,_0x22af15){if(!_0x3ec6ab[_0x4a40('0x30')][_0x4a40('0x31')]('text')&&!_0x3ec6ab[_0x4a40('0x30')][_0x4a40('0x31')](_0x4a40('0x32'))){throw new db['Sequelize'][(_0x4a40('0x33'))](_0x4a40('0x34'));}else{if(_0x3ec6ab['body']['hasOwnProperty'](_0x4a40('0x32'))&&!_0x3ec6ab['body'][_0x4a40('0x31')](_0x4a40('0x35'))){throw new db[(_0x4a40('0x36'))][(_0x4a40('0x33'))](_0x4a40('0x37'));}if(!_0x3ec6ab['body'][_0x4a40('0x31')](_0x4a40('0x38'))){throw new db[(_0x4a40('0x36'))]['ValidationError'](_0x4a40('0x39'));}else{try{var _0x7ff982=JSON[_0x4a40('0x3a')](_0x3ec6ab[_0x4a40('0x30')]['recipients']);}catch(_0x11e2b7){logger[_0x4a40('0x2b')](_0x11e2b7);throw new db[(_0x4a40('0x36'))][(_0x4a40('0x33'))](_0x4a40('0x3b'));}var _0x50de76=['chatqueue','faxqueue',_0x4a40('0x3c'),_0x4a40('0x3d'),_0x4a40('0x3e'),_0x4a40('0x3f'),_0x4a40('0x40'),_0x4a40('0x41'),'user'];if(_['some'](_0x7ff982,function(_0x58aa9d){return!_[_0x4a40('0x42')](_0x50de76,_0x58aa9d[_0x4a40('0x43')][_0x4a40('0x44')]());})){throw new db[(_0x4a40('0x36'))]['ValidationError'](_0x4a40('0x45'));}}}var _0x1b5e80={};_0x1b5e80[_0x4a40('0x46')]=_0x3ec6ab['body'][_0x4a40('0x31')](_0x4a40('0x46'))?_0x3ec6ab[_0x4a40('0x30')][_0x4a40('0x46')]:_0x3ec6ab[_0x4a40('0x47')][_0x4a40('0x48')];_0x1b5e80[_0x4a40('0x49')]=_['isEmpty'](_0x3ec6ab[_0x4a40('0x30')][_0x4a40('0x49')])?null:_0x3ec6ab[_0x4a40('0x30')][_0x4a40('0x49')];_0x1b5e80['beep']=_0x3ec6ab['body'][_0x4a40('0x4a')]||![];_0x1b5e80[_0x4a40('0x4b')]=_0x3ec6ab[_0x4a40('0x47')]['id'];return getContent(_0x3ec6ab[_0x4a40('0x30')])['then'](function(_0x34bd98){_0x1b5e80[_0x4a40('0x30')]=_0x34bd98;return getRecipients(_0x7ff982);})[_0x4a40('0x28')](function(_0x1169a5){_0x1b5e80['recipientsId']=_[_0x4a40('0x4c')](_0x1169a5)[_0x4a40('0x4d')](',');return db[_0x4a40('0x4e')][_0x4a40('0x4f')](function(_0x1aa39b){return db[_0x4a40('0x50')][_0x4a40('0x51')](_0x1b5e80,{'raw':!![],'transaction':_0x1aa39b})[_0x4a40('0x28')](function(_0x31fd78){var _0x49c2d6={'sender':_0x1b5e80['senderName'],'description':_0x1b5e80[_0x4a40('0x49')],'content':_0x1b5e80['body'],'beep':_0x1b5e80['beep']};_0x1169a5[_0x4a40('0x52')](function(_0x223ee9){_0x49c2d6[_0x4a40('0x53')]=_0x223ee9;socket['emit'](_0x4a40('0x54'),_0x49c2d6);});return _0x31fd78;});});})['then'](respondWithResult(_0x130a39,0xc9))[_0x4a40('0x55')](handleError(_0x130a39,null));};function getContent(_0x338aa8){return new BPromise(function(_0x38aac1,_0x34f912){if(_0x338aa8['text']){_0x38aac1(_0x338aa8['text']);return;}return db[_0x4a40('0x56')][_0x4a40('0x57')]({'attributes':[_0x4a40('0x58')],'where':{'id':_0x338aa8[_0x4a40('0x32')]},'raw':!![]})[_0x4a40('0x28')](function(_0x13110a){if(!_0x13110a)throw new db[(_0x4a40('0x36'))][(_0x4a40('0x33'))](_0x4a40('0x59'));var _0x32d967=Mustache[_0x4a40('0x5a')](_0x13110a[_0x4a40('0x58')],_0x338aa8[_0x4a40('0x35')]);_0x38aac1(_0x32d967);})[_0x4a40('0x55')](function(_0x3a30e6){_0x34f912(_0x3a30e6);});});}function getRecipients(_0x565561){return new BPromise(function(_0x11f369,_0x3a0f53){var _0x1c0189=[];var _0x28eb6d=[];_0x565561[_0x4a40('0x52')](function(_0x1ca753){var _0x13db04=_['startCase'](_0x1ca753[_0x4a40('0x43')][_0x4a40('0x44')]());if(_0x13db04===_0x4a40('0x5b')){_0x1c0189=_[_0x4a40('0x5c')](_0x1c0189,_0x1ca753[_0x4a40('0x5d')]);}else{if(_[_0x4a40('0x42')](_0x13db04,_0x4a40('0x5e')))_0x13db04=_0x13db04[_0x4a40('0x5f')](_0x4a40('0x5e'),_0x4a40('0x60'));_0x1ca753['ids'][_0x4a40('0x52')](function(_0x7a485){_0x28eb6d['push'](getAgents(_0x13db04,_0x7a485));});}});return BPromise[_0x4a40('0x61')](_0x28eb6d)[_0x4a40('0x28')](function(_0x3bc78){_0x1c0189=_[_0x4a40('0x5c')](_0x1c0189,_['flatten'](_0x3bc78));_0x11f369(_0x1c0189);})[_0x4a40('0x55')](function(_0x5e0e7e){_0x3a0f53(_0x5e0e7e);});});}function getAgents(_0x462f6b,_0x23235b){return new BPromise(function(_0x5c155b,_0x4e25da){return db[_0x462f6b][_0x4a40('0x57')]({'where':{'id':_0x23235b}})['then'](function(_0x40fa44){return _0x40fa44[_0x4a40('0x62')]({'attributes':['id'],'raw':!![]})[_0x4a40('0x28')](function(_0x588051){var _0x2c336b=_['map'](_0x588051,'id');_0x5c155b(_0x2c336b);});})[_0x4a40('0x55')](function(_0x54ae72){_0x4e25da(_0x54ae72);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2b35d10..bdca206 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 _0xce86=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xce86,0x1d8));var _0x6ce8=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xce86[_0x5774be];return _0x4914b4;};'use strict';var EventEmitter=require(_0x6ce8('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6ce8('0x1')](0x0);var events={'afterCreate':_0x6ce8('0x2'),'afterUpdate':_0x6ce8('0x3'),'afterDestroy':_0x6ce8('0x4')};function emitEvent(_0x3f016e){return function(_0x3db02d,_0x43c4e3,_0x138ef0){UserNotificationEvents[_0x6ce8('0x5')](_0x3f016e+':'+_0x3db02d['id'],_0x3db02d);UserNotificationEvents[_0x6ce8('0x5')](_0x3f016e,_0x3db02d);_0x138ef0(null);};}for(var e in events){if(events[_0x6ce8('0x6')](e)){var event=events[e];UserNotification[_0x6ce8('0x7')](e,emitEvent(event));}}module[_0x6ce8('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xf67e=['save','update','remove','emit','hook','exports','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf67e,0x164));var _0xef67=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf67e[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xef67('0x0')](0x0);var events={'afterCreate':_0xef67('0x1'),'afterUpdate':_0xef67('0x2'),'afterDestroy':_0xef67('0x3')};function emitEvent(_0x53ffd5){return function(_0x27aa66,_0x283adc,_0x592425){UserNotificationEvents['emit'](_0x53ffd5+':'+_0x27aa66['id'],_0x27aa66);UserNotificationEvents[_0xef67('0x4')](_0x53ffd5,_0x27aa66);_0x592425(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xef67('0x5')](e,emitEvent(event));}}module[_0xef67('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 a013b94..3566029 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 _0x4841=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4841,0x174));var _0x1484=function(_0x3c4654,_0x75bdad){_0x3c4654=_0x3c4654-0x0;var _0x404e78=_0x4841[_0x3c4654];return _0x404e78;};'use strict';var _=require(_0x1484('0x0'));var util=require(_0x1484('0x1'));var logger=require(_0x1484('0x2'))(_0x1484('0x3'));var moment=require(_0x1484('0x4'));var BPromise=require(_0x1484('0x5'));var rp=require(_0x1484('0x6'));var fs=require('fs');var path=require(_0x1484('0x7'));var rimraf=require(_0x1484('0x8'));var config=require(_0x1484('0x9'));var attributes=require(_0x1484('0xa'));module[_0x1484('0xb')]=function(_0x28bf87,_0x1fcc81){return _0x28bf87['define']('UserNotification',attributes,{'tableName':_0x1484('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1484('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1077=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications'];(function(_0xa44a66,_0x4dafca){var _0x35454c=function(_0x49a5b6){while(--_0x49a5b6){_0xa44a66['push'](_0xa44a66['shift']());}};_0x35454c(++_0x4dafca);}(_0x1077,0x10a));var _0x7107=function(_0x48839c,_0x1ebdec){_0x48839c=_0x48839c-0x0;var _0x37ff85=_0x1077[_0x48839c];return _0x37ff85;};'use strict';var _=require(_0x7107('0x0'));var util=require(_0x7107('0x1'));var logger=require('../../config/logger')(_0x7107('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7107('0x3'));var config=require(_0x7107('0x4'));var attributes=require(_0x7107('0x5'));module[_0x7107('0x6')]=function(_0x5321d7,_0x453e1f){return _0x5321d7[_0x7107('0x7')](_0x7107('0x8'),attributes,{'tableName':_0x7107('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7107('0xa'),'collate':_0x7107('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e914961..6f3c1ce 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 _0xa51c=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa51c,0x7f));var _0xca51=function(_0x3ab617,_0x2a25a6){_0x3ab617=_0x3ab617-0x0;var _0x4dc037=_0xa51c[_0x3ab617];return _0x4dc037;};'use strict';var _=require('lodash');var util=require(_0xca51('0x0'));var moment=require(_0xca51('0x1'));var BPromise=require(_0xca51('0x2'));var rs=require(_0xca51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca51('0x4'))['db'];var utils=require(_0xca51('0x5'));var logger=require(_0xca51('0x6'))(_0xca51('0x7'));var config=require(_0xca51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca51('0x9')][_0xca51('0xa')]({'port':0x232a});config[_0xca51('0xb')]=_[_0xca51('0xc')](config[_0xca51('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xca51('0xd'))(new Redis(config[_0xca51('0xb')]));require(_0xca51('0xe'))[_0xca51('0xf')](socket);function respondWithRpcPromise(_0x576284,_0x2d7b09,_0x3a01be){return new BPromise(function(_0x4c6553,_0x8571b8){return client[_0xca51('0x10')](_0x576284,_0x3a01be)[_0xca51('0x11')](function(_0x56b36b){logger[_0xca51('0x12')](_0xca51('0x13'),_0x2d7b09,_0xca51('0x14'));logger[_0xca51('0x15')](_0xca51('0x16'),_0x2d7b09,'request\x20sent',JSON[_0xca51('0x17')](_0x56b36b));if(_0x56b36b[_0xca51('0x18')]){if(_0x56b36b[_0xca51('0x18')]['code']===0x1f4){logger['error'](_0xca51('0x13'),_0x2d7b09,_0x56b36b[_0xca51('0x18')][_0xca51('0x19')]);return _0x8571b8(_0x56b36b[_0xca51('0x18')]['message']);}logger[_0xca51('0x18')](_0xca51('0x13'),_0x2d7b09,_0x56b36b[_0xca51('0x18')][_0xca51('0x19')]);return _0x4c6553(_0x56b36b[_0xca51('0x18')]['message']);}else{logger[_0xca51('0x12')]('UserNotification,\x20%s,\x20%s',_0x2d7b09,_0xca51('0x14'));_0x4c6553(_0x56b36b[_0xca51('0x1a')][_0xca51('0x19')]);}})['catch'](function(_0x167f5a){logger['error'](_0xca51('0x13'),_0x2d7b09,_0x167f5a);_0x8571b8(_0x167f5a);});});} \ No newline at end of file +var _0x8551=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','register','info','request\x20sent','debug','stringify','code','error','message','UserNotification,\x20%s,\x20%s','catch','lodash'];(function(_0x121b93,_0x498150){var _0x5338dc=function(_0x3a5b17){while(--_0x3a5b17){_0x121b93['push'](_0x121b93['shift']());}};_0x5338dc(++_0x498150);}(_0x8551,0x1af));var _0x1855=function(_0x2aefff,_0x26a24b){_0x2aefff=_0x2aefff-0x0;var _0x4e4534=_0x8551[_0x2aefff];return _0x4e4534;};'use strict';var _=require(_0x1855('0x0'));var util=require(_0x1855('0x1'));var moment=require(_0x1855('0x2'));var BPromise=require(_0x1855('0x3'));var rs=require(_0x1855('0x4'));var fs=require('fs');var Redis=require(_0x1855('0x5'));var db=require(_0x1855('0x6'))['db'];var utils=require(_0x1855('0x7'));var logger=require(_0x1855('0x8'))(_0x1855('0x9'));var config=require('../../config/environment');var jayson=require(_0x1855('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x1855('0xb')]=_[_0x1855('0xc')](config[_0x1855('0xb')],{'host':_0x1855('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x1855('0xe')](socket);function respondWithRpcPromise(_0x8e7c36,_0x22b4c8,_0x4ac99d){return new BPromise(function(_0x216c57,_0x119419){return client['request'](_0x8e7c36,_0x4ac99d)['then'](function(_0xeab7da){logger[_0x1855('0xf')]('UserNotification,\x20%s,\x20%s',_0x22b4c8,_0x1855('0x10'));logger[_0x1855('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x22b4c8,_0x1855('0x10'),JSON[_0x1855('0x12')](_0xeab7da));if(_0xeab7da['error']){if(_0xeab7da['error'][_0x1855('0x13')]===0x1f4){logger[_0x1855('0x14')]('UserNotification,\x20%s,\x20%s',_0x22b4c8,_0xeab7da[_0x1855('0x14')][_0x1855('0x15')]);return _0x119419(_0xeab7da[_0x1855('0x14')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x22b4c8,_0xeab7da[_0x1855('0x14')]['message']);return _0x216c57(_0xeab7da[_0x1855('0x14')][_0x1855('0x15')]);}else{logger[_0x1855('0xf')](_0x1855('0x16'),_0x22b4c8,_0x1855('0x10'));_0x216c57(_0xeab7da['result']['message']);}})[_0x1855('0x17')](function(_0x73de5e){logger[_0x1855('0x14')]('UserNotification,\x20%s,\x20%s',_0x22b4c8,_0x73de5e);_0x119419(_0x73de5e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index be17b3d..37893c8 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 _0x777e=['save','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x3d2b19,_0x349a5b){var _0x29769b=function(_0x5048ad){while(--_0x5048ad){_0x3d2b19['push'](_0x3d2b19['shift']());}};_0x29769b(++_0x349a5b);}(_0x777e,0x14f));var _0xe777=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0x777e[_0xd8f7bd];return _0x1bd5ee;};'use strict';var UserNotificationEvents=require(_0xe777('0x0'));var events=[_0xe777('0x1'),'remove',_0xe777('0x2')];function createListener(_0x1212de,_0x170ba8){return function(_0x51c0bd){_0x170ba8[_0xe777('0x3')](_0x1212de,_0x51c0bd);};}function removeListener(_0x1ef41c,_0x1107ff){return function(){UserNotificationEvents[_0xe777('0x4')](_0x1ef41c,_0x1107ff);};}exports[_0xe777('0x5')]=function(_0x93d12d){for(var _0x385c36=0x0,_0x5764a8=events[_0xe777('0x6')];_0x385c36<_0x5764a8;_0x385c36++){var _0x191a0b=events[_0x385c36];var _0x2b5b44=createListener(_0xe777('0x7')+_0x191a0b,_0x93d12d);UserNotificationEvents['on'](_0x191a0b,_0x2b5b44);}}; \ No newline at end of file +var _0x00bf=['userNotification:','./userNotification.events','remove','removeListener','length'];(function(_0x7af370,_0x50ee87){var _0x3d1b0e=function(_0x1699d0){while(--_0x1699d0){_0x7af370['push'](_0x7af370['shift']());}};_0x3d1b0e(++_0x50ee87);}(_0x00bf,0x15f));var _0xf00b=function(_0x13ed48,_0x115bd9){_0x13ed48=_0x13ed48-0x0;var _0x21e4e5=_0x00bf[_0x13ed48];return _0x21e4e5;};'use strict';var UserNotificationEvents=require(_0xf00b('0x0'));var events=['save',_0xf00b('0x1'),'update'];function createListener(_0x121237,_0x245822){return function(_0x33722e){_0x245822['emit'](_0x121237,_0x33722e);};}function removeListener(_0x1044f5,_0x2cc3d0){return function(){UserNotificationEvents[_0xf00b('0x2')](_0x1044f5,_0x2cc3d0);};}exports['register']=function(_0x50b0f8){for(var _0xee4ec1=0x0,_0x22e357=events[_0xf00b('0x3')];_0xee4ec1<_0x22e357;_0xee4ec1++){var _0x13b517=events[_0xee4ec1];var _0x28618a=createListener(_0xf00b('0x4')+_0x13b517,_0x50b0f8);UserNotificationEvents['on'](_0x13b517,_0x28618a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 6bf1b7f..8bf0a95 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x307306,_0x47728b){var _0x44a6d4=function(_0x311e73){while(--_0x311e73){_0x307306['push'](_0x307306['shift']());}};_0x44a6d4(++_0x47728b);}(_0x70e0,0x17b));var _0x070e=function(_0x1ce5d7,_0x4052e4){_0x1ce5d7=_0x1ce5d7-0x0;var _0x3b516a=_0x70e0[_0x1ce5d7];return _0x3b516a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x13f0f2,_0x2b3566){var _0xe733ed=function(_0x2c64e4){while(--_0x2c64e4){_0x13f0f2['push'](_0x13f0f2['shift']());}};_0xe733ed(++_0x2b3566);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fa6067a..c585a74 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 _0x79a1=['exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x79a1,0x1e2));var _0x179a=function(_0x885c76,_0x5a93d6){_0x885c76=_0x885c76-0x0;var _0xcaa37c=_0x79a1[_0x885c76];return _0xcaa37c;};'use strict';var Sequelize=require('sequelize');module[_0x179a('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0185=['INTEGER'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x0185,0x1ac));var _0x5018=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x0185[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5018('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0c7efc7..2500d1d 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 _0x0e9f=['./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x573413,_0x9dee23){var _0x5b7b2a=function(_0x3d25ba){while(--_0x3d25ba){_0x573413['push'](_0x573413['shift']());}};_0x5b7b2a(++_0x9dee23);}(_0x0e9f,0x176));var _0xf0e9=function(_0x219d8a,_0x27748a){_0x219d8a=_0x219d8a-0x0;var _0x2a0e9f=_0x0e9f[_0x219d8a];return _0x2a0e9f;};'use strict';var _=require('lodash');var util=require(_0xf0e9('0x0'));var logger=require(_0xf0e9('0x1'))(_0xf0e9('0x2'));var moment=require('moment');var BPromise=require(_0xf0e9('0x3'));var rp=require(_0xf0e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0e9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf0e9('0x6'));module[_0xf0e9('0x7')]=function(_0x2a7c08,_0x490815){return _0x2a7c08['define'](_0xf0e9('0x8'),attributes,{'tableName':_0xf0e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa16e=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xba5c73,_0x5494ff){var _0x5ead91=function(_0x49d4a8){while(--_0x49d4a8){_0xba5c73['push'](_0xba5c73['shift']());}};_0x5ead91(++_0x5494ff);}(_0xa16e,0x17e));var _0xea16=function(_0x4da807,_0x55812b){_0x4da807=_0x4da807-0x0;var _0x5d7533=_0xa16e[_0x4da807];return _0x5d7533;};'use strict';var _=require(_0xea16('0x0'));var util=require(_0xea16('0x1'));var logger=require(_0xea16('0x2'))('api');var moment=require(_0xea16('0x3'));var BPromise=require(_0xea16('0x4'));var rp=require(_0xea16('0x5'));var fs=require('fs');var path=require(_0xea16('0x6'));var rimraf=require(_0xea16('0x7'));var config=require(_0xea16('0x8'));var attributes=require(_0xea16('0x9'));module[_0xea16('0xa')]=function(_0xb91178,_0x12d86b){return _0xb91178[_0xea16('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xea16('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index cfe5b61..d442665 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 _0x3fe7=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3fe7,0x194));var _0x73fe=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x3fe7[_0x4a9a17];return _0x30e831;};'use strict';var _=require(_0x73fe('0x0'));var util=require(_0x73fe('0x1'));var moment=require(_0x73fe('0x2'));var BPromise=require(_0x73fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73fe('0x4'));var db=require(_0x73fe('0x5'))['db'];var utils=require(_0x73fe('0x6'));var logger=require('../../config/logger')(_0x73fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x73fe('0x8'));var client=jayson[_0x73fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57b60f,_0x1494b5,_0x44914e){return new BPromise(function(_0x12a84f,_0x49871d){return client['request'](_0x57b60f,_0x44914e)[_0x73fe('0xa')](function(_0x4a9ac5){logger[_0x73fe('0xb')](_0x73fe('0xc'),_0x1494b5,_0x73fe('0xd'));logger[_0x73fe('0xe')](_0x73fe('0xf'),_0x1494b5,_0x73fe('0xd'),JSON[_0x73fe('0x10')](_0x4a9ac5));if(_0x4a9ac5[_0x73fe('0x11')]){if(_0x4a9ac5['error'][_0x73fe('0x12')]===0x1f4){logger[_0x73fe('0x11')](_0x73fe('0xc'),_0x1494b5,_0x4a9ac5[_0x73fe('0x11')][_0x73fe('0x13')]);return _0x49871d(_0x4a9ac5[_0x73fe('0x11')][_0x73fe('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1494b5,_0x4a9ac5[_0x73fe('0x11')][_0x73fe('0x13')]);return _0x12a84f(_0x4a9ac5[_0x73fe('0x11')][_0x73fe('0x13')]);}else{logger[_0x73fe('0xb')](_0x73fe('0xc'),_0x1494b5,_0x73fe('0xd'));_0x12a84f(_0x4a9ac5[_0x73fe('0x14')]['message']);}})[_0x73fe('0x15')](function(_0x52beae){logger[_0x73fe('0x11')](_0x73fe('0xc'),_0x1494b5,_0x52beae);_0x49871d(_0x52beae);});});} \ No newline at end of file +var _0x524f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x539f44,_0x1c5baf){var _0x44a0d8=function(_0x353b10){while(--_0x353b10){_0x539f44['push'](_0x539f44['shift']());}};_0x44a0d8(++_0x1c5baf);}(_0x524f,0x1df));var _0xf524=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x524f[_0x3861f7];return _0x50879f;};'use strict';var _=require(_0xf524('0x0'));var util=require(_0xf524('0x1'));var moment=require(_0xf524('0x2'));var BPromise=require(_0xf524('0x3'));var rs=require(_0xf524('0x4'));var fs=require('fs');var Redis=require(_0xf524('0x5'));var db=require(_0xf524('0x6'))['db'];var utils=require(_0xf524('0x7'));var logger=require(_0xf524('0x8'))('rpc');var config=require(_0xf524('0x9'));var jayson=require(_0xf524('0xa'));var client=jayson[_0xf524('0xb')][_0xf524('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e2283,_0x2f63c9,_0x5d2c0b){return new BPromise(function(_0x2f9fa2,_0x431143){return client[_0xf524('0xd')](_0x2e2283,_0x5d2c0b)[_0xf524('0xe')](function(_0x1087e2){logger[_0xf524('0xf')](_0xf524('0x10'),_0x2f63c9,_0xf524('0x11'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2f63c9,_0xf524('0x11'),JSON[_0xf524('0x12')](_0x1087e2));if(_0x1087e2[_0xf524('0x13')]){if(_0x1087e2[_0xf524('0x13')][_0xf524('0x14')]===0x1f4){logger['error'](_0xf524('0x10'),_0x2f63c9,_0x1087e2[_0xf524('0x13')][_0xf524('0x15')]);return _0x431143(_0x1087e2[_0xf524('0x13')][_0xf524('0x15')]);}logger[_0xf524('0x13')](_0xf524('0x10'),_0x2f63c9,_0x1087e2[_0xf524('0x13')]['message']);return _0x2f9fa2(_0x1087e2['error'][_0xf524('0x15')]);}else{logger[_0xf524('0xf')](_0xf524('0x10'),_0x2f63c9,_0xf524('0x11'));_0x2f9fa2(_0x1087e2[_0xf524('0x16')]['message']);}})[_0xf524('0x17')](function(_0x5a9300){logger[_0xf524('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2f63c9,_0x5a9300);_0x431143(_0x5a9300);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a6df65b..3b3c405 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 _0xa3e9=['/:id/sections','getSections','/:id/resources','create','/:id/clone','clone','post','addSections','addResources','put','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x441b02,_0x4dd375){var _0x1d7fc9=function(_0x2b8318){while(--_0x2b8318){_0x441b02['push'](_0x441b02['shift']());}};_0x1d7fc9(++_0x4dd375);}(_0xa3e9,0xc2));var _0x9a3e=function(_0x4b70b4,_0x40961c){_0x4b70b4=_0x4b70b4-0x0;var _0x1295d9=_0xa3e9[_0x4b70b4];return _0x1295d9;};'use strict';var multer=require(_0x9a3e('0x0'));var util=require(_0x9a3e('0x1'));var path=require(_0x9a3e('0x2'));var timeout=require(_0x9a3e('0x3'));var express=require(_0x9a3e('0x4'));var router=express['Router']();var fs_extra=require(_0x9a3e('0x5'));var auth=require(_0x9a3e('0x6'));var interaction=require(_0x9a3e('0x7'));var config=require(_0x9a3e('0x8'));var controller=require(_0x9a3e('0x9'));router[_0x9a3e('0xa')]('/',auth[_0x9a3e('0xb')](),controller[_0x9a3e('0xc')]);router['get'](_0x9a3e('0xd'),auth['isAuthenticated'](),controller[_0x9a3e('0xe')]);router[_0x9a3e('0xa')](_0x9a3e('0xf'),auth[_0x9a3e('0xb')](),controller['show']);router['get'](_0x9a3e('0x10'),auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x11')]);router[_0x9a3e('0xa')](_0x9a3e('0x12'),auth[_0x9a3e('0xb')](),controller['getResources']);router['post']('/',auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x13')]);router['post'](_0x9a3e('0x14'),auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x15')]);router[_0x9a3e('0x16')](_0x9a3e('0x10'),auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x17')]);router[_0x9a3e('0x16')](_0x9a3e('0x12'),auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x18')]);router[_0x9a3e('0x19')](_0x9a3e('0xf'),auth[_0x9a3e('0xb')](),controller['update']);router[_0x9a3e('0x1a')](_0x9a3e('0xf'),auth[_0x9a3e('0xb')](),controller['destroy']);router['delete']('/:id/sections',auth[_0x9a3e('0xb')](),controller[_0x9a3e('0x1b')]);router['delete'](_0x9a3e('0x12'),auth['isAuthenticated'](),controller[_0x9a3e('0x1c')]);module[_0x9a3e('0x1d')]=router; \ No newline at end of file +var _0x77ac=['getSections','/:id/resources','post','/:id/clone','clone','addSections','addResources','delete','/:id/sections','removeSections','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x42e5d9,_0x39019f){var _0x553882=function(_0x2bcd6f){while(--_0x2bcd6f){_0x42e5d9['push'](_0x42e5d9['shift']());}};_0x553882(++_0x39019f);}(_0x77ac,0xa7));var _0xc77a=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x77ac[_0x435044];return _0x33d4c6;};'use strict';var multer=require(_0xc77a('0x0'));var util=require('util');var path=require(_0xc77a('0x1'));var timeout=require(_0xc77a('0x2'));var express=require(_0xc77a('0x3'));var router=express[_0xc77a('0x4')]();var fs_extra=require(_0xc77a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc77a('0x6'));var controller=require(_0xc77a('0x7'));router[_0xc77a('0x8')]('/',auth[_0xc77a('0x9')](),controller[_0xc77a('0xa')]);router[_0xc77a('0x8')](_0xc77a('0xb'),auth[_0xc77a('0x9')](),controller[_0xc77a('0xc')]);router[_0xc77a('0x8')](_0xc77a('0xd'),auth[_0xc77a('0x9')](),controller[_0xc77a('0xe')]);router[_0xc77a('0x8')]('/:id/sections',auth[_0xc77a('0x9')](),controller[_0xc77a('0xf')]);router[_0xc77a('0x8')](_0xc77a('0x10'),auth[_0xc77a('0x9')](),controller['getResources']);router[_0xc77a('0x11')]('/',auth[_0xc77a('0x9')](),controller['create']);router[_0xc77a('0x11')](_0xc77a('0x12'),auth[_0xc77a('0x9')](),controller[_0xc77a('0x13')]);router[_0xc77a('0x11')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc77a('0x14')]);router['post'](_0xc77a('0x10'),auth['isAuthenticated'](),controller[_0xc77a('0x15')]);router['put'](_0xc77a('0xd'),auth[_0xc77a('0x9')](),controller['update']);router[_0xc77a('0x16')](_0xc77a('0xd'),auth[_0xc77a('0x9')](),controller['destroy']);router['delete'](_0xc77a('0x17'),auth[_0xc77a('0x9')](),controller[_0xc77a('0x18')]);router[_0xc77a('0x16')](_0xc77a('0x10'),auth['isAuthenticated'](),controller['removeResources']);module[_0xc77a('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 976491d..43060ed 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 _0x27b4=['setDataValue','getDataValue','crudPermissions','BOOLEAN','exports','STRING','name'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x27b4,0x1b6));var _0x427b=function(_0x16c708,_0x2e58ca){_0x16c708=_0x16c708-0x0;var _0x13b3a4=_0x27b4[_0x16c708];return _0x13b3a4;};'use strict';var Sequelize=require('sequelize');module[_0x427b('0x0')]={'name':{'type':Sequelize[_0x427b('0x1')],'allowNull':![],'unique':_0x427b('0x2')},'crudPermissions':{'type':Sequelize[_0x427b('0x1')],'set':function(_0x2f6d05){this[_0x427b('0x3')]('crudPermissions',_0x2f6d05?_0x2f6d05['join'](''):[]);},'get':function(){return this[_0x427b('0x4')](_0x427b('0x5'))?this[_0x427b('0x4')](_0x427b('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x427b('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x427b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x211e=['split','BOOLEAN','sequelize','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x5717fa,_0x4c0526){var _0xcfcaa3=function(_0x239180){while(--_0x239180){_0x5717fa['push'](_0x5717fa['shift']());}};_0xcfcaa3(++_0x4c0526);}(_0x211e,0x192));var _0xe211=function(_0x18ba1f,_0x15ce9f){_0x18ba1f=_0x18ba1f-0x0;var _0x31186b=_0x211e[_0x18ba1f];return _0x31186b;};'use strict';var Sequelize=require(_0xe211('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe211('0x1')},'crudPermissions':{'type':Sequelize[_0xe211('0x2')],'set':function(_0x48d3be){this[_0xe211('0x3')](_0xe211('0x4'),_0x48d3be?_0x48d3be['join'](''):[]);},'get':function(){return this['getDataValue'](_0xe211('0x4'))?this[_0xe211('0x5')](_0xe211('0x4'))[_0xe211('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe211('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe211('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe211('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe211('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe211('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe211('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe211('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 20f63bd..5e82b8b 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 _0x421d=['moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','clone','createdAt','updatedAt','crudPermissions','transaction','get','UserProfileSection','findAll','autoAssociation','UserProfileResource','omit','userProfileId','Resources','describe','addSections','sequelize','each','push','removeSections','getSections','enabled','sectionId','isEmpty','subsections','includes','concat','findOne','Dashboard','forEach','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2406b5,_0x14cc18){var _0x107bc3=function(_0x464507){while(--_0x464507){_0x2406b5['push'](_0x2406b5['shift']());}};_0x107bc3(++_0x14cc18);}(_0x421d,0xe4));var _0xd421=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x421d[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd421('0x0'));var zipdir=require(_0xd421('0x1'));var jsonpatch=require(_0xd421('0x2'));var rp=require(_0xd421('0x3'));var moment=require(_0xd421('0x4'));var BPromise=require(_0xd421('0x5'));var Mustache=require(_0xd421('0x6'));var util=require(_0xd421('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd421('0x8'));var fs=require('fs');var fs_extra=require(_0xd421('0x9'));var _=require('lodash');var squel=require(_0xd421('0xa'));var crypto=require(_0xd421('0xb'));var jsforce=require(_0xd421('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd421('0xd'));var querystring=require(_0xd421('0xe'));var Papa=require('papaparse');var Redis=require(_0xd421('0xf'));var authService=require(_0xd421('0x10'));var qs=require(_0xd421('0x11'));var as=require(_0xd421('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd421('0x13'))(_0xd421('0x14'));var utils=require('../../config/utils');var config=require(_0xd421('0x15'));var licenseUtil=require(_0xd421('0x16'));var db=require('../../mysqldb')['db'];config[_0xd421('0x17')]=_[_0xd421('0x18')](config[_0xd421('0x17')],{'host':_0xd421('0x19'),'port':0x18eb});var socket=require(_0xd421('0x1a'))(new Redis(config['redis']));require(_0xd421('0x1b'))[_0xd421('0x1c')](socket);function respondWithStatusCode(_0x53fc44,_0x46d0ee){_0x46d0ee=_0x46d0ee||0xcc;return function(_0x1cfeef){if(_0x1cfeef){return _0x53fc44[_0xd421('0x1d')](_0x46d0ee);}return _0x53fc44[_0xd421('0x1e')](_0x46d0ee)[_0xd421('0x1f')]();};}function respondWithResult(_0x4855e9,_0x13d809){_0x13d809=_0x13d809||0xc8;return function(_0x346f4c){if(_0x346f4c){return _0x4855e9['status'](_0x13d809)[_0xd421('0x20')](_0x346f4c);}};}function respondWithFilteredResult(_0x357d13,_0x2d70b0){return function(_0x3b1bd2){if(_0x3b1bd2){var _0xc90458=typeof _0x2d70b0[_0xd421('0x21')]===_0xd421('0x22')&&typeof _0x2d70b0[_0xd421('0x23')]===_0xd421('0x22');var _0x1d382c=_0x3b1bd2['count'];var _0x54d68f=_0xc90458?0x0:_0x2d70b0['offset'];var _0xf80d4b=_0xc90458?_0x3b1bd2[_0xd421('0x24')]:_0x2d70b0['offset']+_0x2d70b0[_0xd421('0x23')];var _0x2f9ad8;if(_0xf80d4b>=_0x1d382c){_0xf80d4b=_0x1d382c;_0x2f9ad8=0xc8;}else{_0x2f9ad8=0xce;}_0x357d13['status'](_0x2f9ad8);return _0x357d13['set'](_0xd421('0x25'),_0x54d68f+'-'+_0xf80d4b+'/'+_0x1d382c)['json'](_0x3b1bd2);}return null;};}function patchUpdates(_0x2a94f8){return function(_0x4a4a3a){try{jsonpatch[_0xd421('0x26')](_0x4a4a3a,_0x2a94f8,!![]);}catch(_0xad8ec9){return BPromise[_0xd421('0x27')](_0xad8ec9);}return _0x4a4a3a[_0xd421('0x28')]();};}function saveUpdates(_0x2f032f,_0x503f52){return function(_0x31f952){if(_0x31f952){return _0x31f952[_0xd421('0x29')](_0x2f032f)[_0xd421('0x2a')](function(_0x510dc8){return _0x510dc8;});}return null;};}function removeEntity(_0x1dc5b4,_0x4a73e8){return function(_0x1ea92e){if(_0x1ea92e){return _0x1ea92e[_0xd421('0x2b')]()[_0xd421('0x2a')](function(){_0x1dc5b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x258622,_0x169ffb){return function(_0x46e187){if(!_0x46e187){_0x258622[_0xd421('0x1d')](0x194);}return _0x46e187;};}function handleError(_0x358ea3,_0x3f900b){_0x3f900b=_0x3f900b||0x1f4;return function(_0x582e9c){logger[_0xd421('0x2c')](_0x582e9c[_0xd421('0x2d')]);if(_0x582e9c[_0xd421('0x2e')]){delete _0x582e9c[_0xd421('0x2e')];}_0x358ea3[_0xd421('0x1e')](_0x3f900b)[_0xd421('0x2f')](_0x582e9c);};}exports[_0xd421('0x30')]=function(_0x537ea4,_0x271ac0){var _0x336f52={},_0x4f0ec2={},_0x26049d={'count':0x0,'rows':[]};var _0x4632ab=_[_0xd421('0x31')](db[_0xd421('0x32')][_0xd421('0x33')],function(_0x400d7e){return{'name':_0x400d7e[_0xd421('0x34')],'type':_0x400d7e[_0xd421('0x35')][_0xd421('0x36')]};});_0x4f0ec2[_0xd421('0x37')]=_[_0xd421('0x31')](_0x4632ab,_0xd421('0x2e'));_0x4f0ec2[_0xd421('0x38')]=_[_0xd421('0x39')](_0x537ea4[_0xd421('0x38')]);_0x4f0ec2['filters']=_[_0xd421('0x3a')](_0x4f0ec2['model'],_0x4f0ec2[_0xd421('0x38')]);_0x336f52[_0xd421('0x3b')]=_[_0xd421('0x3a')](_0x4f0ec2[_0xd421('0x37')],qs[_0xd421('0x3c')](_0x537ea4[_0xd421('0x38')][_0xd421('0x3c')]));_0x336f52[_0xd421('0x3b')]=_0x336f52[_0xd421('0x3b')][_0xd421('0x3d')]?_0x336f52[_0xd421('0x3b')]:_0x4f0ec2[_0xd421('0x37')];if(!_0x537ea4[_0xd421('0x38')][_0xd421('0x3e')](_0xd421('0x3f'))){_0x336f52[_0xd421('0x23')]=qs[_0xd421('0x23')](_0x537ea4[_0xd421('0x38')][_0xd421('0x23')]);_0x336f52[_0xd421('0x21')]=qs[_0xd421('0x21')](_0x537ea4[_0xd421('0x38')][_0xd421('0x21')]);}_0x336f52['order']=qs[_0xd421('0x40')](_0x537ea4[_0xd421('0x38')]['sort']);_0x336f52[_0xd421('0x41')]=qs[_0xd421('0x42')](_['pick'](_0x537ea4[_0xd421('0x38')],_0x4f0ec2[_0xd421('0x42')]),_0x4632ab);if(_0x537ea4['query'][_0xd421('0x43')]){_0x336f52[_0xd421('0x41')]=_[_0xd421('0x44')](_0x336f52[_0xd421('0x41')],{'$or':_[_0xd421('0x31')](_0x4632ab,function(_0x2a5034){if(_0x2a5034[_0xd421('0x35')]!==_0xd421('0x45')){var _0x472214={};_0x472214[_0x2a5034['name']]={'$like':'%'+_0x537ea4[_0xd421('0x38')][_0xd421('0x43')]+'%'};return _0x472214;}})});}_0x336f52=_['merge']({},_0x336f52,_0x537ea4[_0xd421('0x46')]);var _0x452e58={'where':_0x336f52[_0xd421('0x41')]};return db['UserProfile'][_0xd421('0x24')](_0x452e58)[_0xd421('0x2a')](function(_0xead06d){_0x26049d[_0xd421('0x24')]=_0xead06d;if(_0x537ea4[_0xd421('0x38')][_0xd421('0x47')]){_0x336f52[_0xd421('0x48')]=[{'all':!![]}];}return db[_0xd421('0x32')]['findAll'](_0x336f52);})['then'](function(_0x40e7e5){_0x26049d[_0xd421('0x49')]=_0x40e7e5;return _0x26049d;})[_0xd421('0x2a')](respondWithFilteredResult(_0x271ac0,_0x336f52))[_0xd421('0x4a')](handleError(_0x271ac0,null));};exports[_0xd421('0x4b')]=function(_0x39afa2,_0x442dcf){var _0x39f081={'raw':![],'where':{'id':_0x39afa2[_0xd421('0x4c')]['id']}},_0x22843c={};_0x22843c['model']=_['keys'](db[_0xd421('0x32')]['rawAttributes']);_0x22843c[_0xd421('0x38')]=_[_0xd421('0x39')](_0x39afa2['query']);_0x22843c[_0xd421('0x42')]=_[_0xd421('0x3a')](_0x22843c[_0xd421('0x37')],_0x22843c[_0xd421('0x38')]);_0x39f081['attributes']=_[_0xd421('0x3a')](_0x22843c[_0xd421('0x37')],qs['fields'](_0x39afa2[_0xd421('0x38')][_0xd421('0x3c')]));_0x39f081[_0xd421('0x3b')]=_0x39f081[_0xd421('0x3b')]['length']?_0x39f081['attributes']:_0x22843c[_0xd421('0x37')];if(_0x39afa2[_0xd421('0x38')][_0xd421('0x47')]){_0x39f081[_0xd421('0x48')]=[{'all':!![]}];}_0x39f081=_[_0xd421('0x44')]({},_0x39f081,_0x39afa2[_0xd421('0x46')]);return db['UserProfile'][_0xd421('0x4d')](_0x39f081)[_0xd421('0x2a')](handleEntityNotFound(_0x442dcf,null))[_0xd421('0x2a')](respondWithResult(_0x442dcf,null))[_0xd421('0x4a')](handleError(_0x442dcf,null));};exports[_0xd421('0x4e')]=function(_0x4aa1f8,_0x2ca5bf){return db[_0xd421('0x32')][_0xd421('0x4e')](_0x4aa1f8[_0xd421('0x4f')],{})['then'](respondWithResult(_0x2ca5bf,0xc9))['catch'](handleError(_0x2ca5bf,null));};exports[_0xd421('0x50')]=function(_0x7e0c6f,_0x48939a){var _0x3610ef={'where':{'id':_0x7e0c6f['params']['id']}},_0x134557={};_0x134557['model']=_[_0xd421('0x39')](db[_0xd421('0x32')][_0xd421('0x33')]);_0x3610ef['attributes']=_['intersection'](_0x134557[_0xd421('0x37')],qs['fields'](_0x7e0c6f['query'][_0xd421('0x3c')]));_0x3610ef['attributes']=_0x3610ef[_0xd421('0x3b')][_0xd421('0x3d')]?_0x3610ef[_0xd421('0x3b')]:_0x134557[_0xd421('0x37')];if(_0x7e0c6f[_0xd421('0x38')][_0xd421('0x47')]){_0x3610ef[_0xd421('0x48')]=[{'all':!![]}];}_0x3610ef=_['merge']({},_0x3610ef,_0x7e0c6f['options']);return db[_0xd421('0x32')][_0xd421('0x4d')](_0x3610ef)[_0xd421('0x2a')](handleEntityNotFound(_0x48939a,null))[_0xd421('0x2a')](function(_0x482f64){if(_0x482f64){var _0x4ef55d=_0x482f64['get']({'plain':!![]});_0x4ef55d=qs['omit'](_0x4ef55d,['id',_0xd421('0x51'),_0xd421('0x52'),_0xd421('0x53')]);_0x7e0c6f[_0xd421('0x4f')]=_['omit'](_0x7e0c6f['body'],['id','createdAt',_0xd421('0x52')]);return db['sequelize'][_0xd421('0x54')](function(_0x85ad72){return db[_0xd421('0x32')]['create'](_[_0xd421('0x44')](_0x4ef55d,_0x7e0c6f[_0xd421('0x4f')]),{'include':_0x7e0c6f[_0xd421('0x38')][_0xd421('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x85ad72})[_0xd421('0x2a')](function(_0x5114e3){var _0x3df73c=_0x5114e3[_0xd421('0x55')]({'plain':!![]});return db[_0xd421('0x56')][_0xd421('0x57')]({'where':{'userProfileId':_0x7e0c6f['params']['id']},'raw':!![]})['then'](function(_0x4173df){if(_0x4173df){return BPromise['each'](_0x4173df,function(_0x4cb584){return new BPromise(function(_0x4be284,_0x1aba65){if(_0x4cb584[_0xd421('0x58')]===null||_0x4cb584['autoAssociation']===0x1)_0x4be284(null);return db[_0xd421('0x59')]['findAll']({'where':{'sectionId':_0x4cb584['id']},'raw':!![]})[_0xd421('0x2a')](function(_0x15c013){var _0x54d267=_['map'](_0x15c013,function(_0x8a06f6){return qs[_0xd421('0x5a')](_0x8a06f6,['id',_0xd421('0x51'),_0xd421('0x52'),'sectionId']);});_0x4be284(_0x54d267);})[_0xd421('0x4a')](function(_0xfc4de1){_0x1aba65(_0xfc4de1);});})[_0xd421('0x2a')](function(_0x4bac46){var _0x20a7ff=qs[_0xd421('0x5a')](_0x4cb584,['id',_0xd421('0x51'),'updatedAt']);_0x20a7ff[_0xd421('0x5b')]=_0x3df73c['id'];if(_0x4bac46)_0x20a7ff[_0xd421('0x5c')]=_0x4bac46;return _0x20a7ff;})[_0xd421('0x2a')](function(_0x7eaa1c){return db[_0xd421('0x56')][_0xd421('0x4e')](_0x7eaa1c,{'include':[{'model':db['UserProfileResource'],'as':_0xd421('0x5c')}],'raw':!![],'transaction':_0x85ad72});});})['then'](function(){return _0x3df73c;});}});});});}})[_0xd421('0x2a')](respondWithResult(_0x48939a,0xc9))[_0xd421('0x4a')](handleError(_0x48939a,null));};exports['update']=function(_0x97c59e,_0x3730cd){if(_0x97c59e[_0xd421('0x4f')]['id']){delete _0x97c59e[_0xd421('0x4f')]['id'];}return db[_0xd421('0x32')]['find']({'where':{'id':_0x97c59e['params']['id']}})['then'](handleEntityNotFound(_0x3730cd,null))[_0xd421('0x2a')](saveUpdates(_0x97c59e[_0xd421('0x4f')],null))[_0xd421('0x2a')](respondWithResult(_0x3730cd,null))[_0xd421('0x4a')](handleError(_0x3730cd,null));};exports[_0xd421('0x2b')]=function(_0x49cbd8,_0x5a5241){return db[_0xd421('0x32')][_0xd421('0x4d')]({'where':{'id':_0x49cbd8[_0xd421('0x4c')]['id']}})[_0xd421('0x2a')](handleEntityNotFound(_0x5a5241,null))[_0xd421('0x2a')](removeEntity(_0x5a5241,null))[_0xd421('0x4a')](handleError(_0x5a5241,null));};exports[_0xd421('0x5d')]=function(_0x2199c2,_0x4b6a3f){return db[_0xd421('0x32')]['describe']()[_0xd421('0x2a')](respondWithResult(_0x4b6a3f,null))[_0xd421('0x4a')](handleError(_0x4b6a3f,null));};exports[_0xd421('0x5e')]=function(_0xc4c63d,_0x375152){var _0xe4c559=_0xc4c63d[_0xd421('0x4f')];return db[_0xd421('0x32')][_0xd421('0x4d')]({'where':{'id':_0xc4c63d[_0xd421('0x4c')]['id']}})[_0xd421('0x2a')](handleEntityNotFound(_0x375152,null))[_0xd421('0x2a')](function(_0x339b84){if(_0x339b84){return db[_0xd421('0x5f')]['transaction'](function(_0x31e03f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xc4c63d[_0xd421('0x4c')]['id'],'sectionId':_[_0xd421('0x31')](_0xe4c559,function(_0x38e3ae){return _0x38e3ae['sectionId'];})},'transaction':_0x31e03f})[_0xd421('0x2a')](function(){var _0x421e03=_[_0xd421('0x31')](_0xe4c559,function(_0x3d7937){_0x3d7937['userProfileId']=_0xc4c63d['params']['id'];return _0x3d7937;});var _0x5a8d60=[];return BPromise[_0xd421('0x60')](_0x421e03,function(_0x51544f){return db[_0xd421('0x56')][_0xd421('0x4e')](_0x51544f,{'include':[{'model':db[_0xd421('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x31e03f})[_0xd421('0x2a')](function(_0x2435e0){_0x5a8d60[_0xd421('0x61')](_0x2435e0[_0xd421('0x55')]({'plain':!![]}));});})['then'](function(){return _0x5a8d60;});});});}})[_0xd421('0x2a')](function(_0x195cb2){return _0x195cb2;})[_0xd421('0x2a')](respondWithResult(_0x375152,null))[_0xd421('0x4a')](handleError(_0x375152,null));};exports[_0xd421('0x62')]=function(_0x282d0e,_0x97479c){var _0x29db83;return db[_0xd421('0x32')][_0xd421('0x4d')]({'where':{'id':_0x282d0e[_0xd421('0x4c')]['id']},'attributes':['id',_0xd421('0x2e')]})[_0xd421('0x2a')](handleEntityNotFound(_0x97479c,null))[_0xd421('0x2a')](function(_0x282d19){if(_0x282d19){_0x29db83=_0x282d19;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x282d0e[_0xd421('0x4c')]['id'],'sectionId':_0x282d0e[_0xd421('0x38')]['ids']}});}})['then'](function(){return _0x29db83;})['then'](respondWithStatusCode(_0x97479c,null))[_0xd421('0x4a')](handleError(_0x97479c,null));};exports[_0xd421('0x63')]=function(_0x2843a5,_0x708ef6){var _0x289c27=[];var _0xd15df1=[];return db[_0xd421('0x56')]['findAll']({'where':{'userProfileId':_0x2843a5[_0xd421('0x4c')]['id']},'raw':!![]})[_0xd421('0x2a')](function(_0x1785d6){_0x289c27=_[_0xd421('0x43')](_0x1785d6,function(_0x1d33f8){return _0x1d33f8[_0xd421('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x1d33f8[_0xd421('0x65')]);});if(!_[_0xd421('0x66')](_0x289c27)){return _[_0xd421('0x31')](_0x289c27,function(_0x112528){return _0x112528[_0xd421('0x65')];});}else{return;}})['then'](function(_0x5e86e2){if(_0x5e86e2)_0xd15df1=_0x5e86e2;if(_['includes'](_0xd15df1,0x64)){var _0x376609=_['find'](_0x289c27,{'sectionId':0x64});return hasDefaultDashboard(_0x376609)[_0xd421('0x2a')](function(_0x27aaab){return _['map'](_0x289c27,function(_0x1075bb){if(_0x1075bb[_0xd421('0x65')]===0x64){_0x1075bb[_0xd421('0x67')]=_0x27aaab;}return _0x1075bb;});});}else{return;}})['then'](function(_0x59782f){if(_0x59782f)_0x289c27=_0x59782f;if(_[_0xd421('0x68')](_0xd15df1,0x3eb)){var _0x86cb0=_['find'](_0x289c27,{'sectionId':0x3eb});return getCustomDashboards(_0x86cb0)['then'](function(_0x3ea87d){return _[_0xd421('0x31')](_0x289c27,function(_0x45e010){if(_0x86cb0['enabled']){if(_0x45e010[_0xd421('0x65')]===0x3eb){_0x45e010[_0xd421('0x67')]=_0x3ea87d;}}else{if(_0x45e010['sectionId']===0x64){if(!_0x45e010[_0xd421('0x67')]){_0x45e010[_0xd421('0x67')]=[];}_0x45e010[_0xd421('0x67')]=_0x45e010['subsections'][_0xd421('0x69')](_0x3ea87d);}}return _0x45e010;});});}else{return;}})[_0xd421('0x2a')](function(_0x140026){if(_0x140026)_0x289c27=_0x140026;if(_[_0xd421('0x68')](_0xd15df1,0x709)){var _0x1945c0=_[_0xd421('0x4d')](_0x289c27,{'sectionId':0x709});return getPlugins(_0x1945c0)[_0xd421('0x2a')](function(_0x365d01){if(_0x1945c0['enabled']){return _[_0xd421('0x31')](_0x289c27,function(_0xa04a54){if(_0xa04a54[_0xd421('0x65')]===0x709){_0xa04a54[_0xd421('0x67')]=_0x365d01;}return _0xa04a54;});}else{var _0x5d5826={'sectionId':0x76c,'enabled':0x1,'subsections':_0x365d01};var _0x1a199b=_[_0xd421('0x31')](_0x289c27);_0x1a199b[_0xd421('0x61')](_0x5d5826);return _0x1a199b;}});}else{return;}})[_0xd421('0x2a')](function(_0x5a9334){if(_0x5a9334)_0x289c27=_0x5a9334;return _['filter'](_0x289c27,[_0xd421('0x64'),0x1]);})[_0xd421('0x2a')](respondWithResult(_0x708ef6,null))[_0xd421('0x4a')](handleError(_0x708ef6,null));};function hasDefaultDashboard(_0x39a057){var _0x35798e=[0x65];return new BPromise(function(_0x54abc7,_0x313f1f){try{if(_0x39a057[_0xd421('0x58')]){_0x54abc7(_0x35798e);}else{return db['UserProfileResource'][_0xd421('0x6a')]({'where':{'sectionId':_0x39a057['id']},'raw':!![]})['then'](function(_0x5c5965){_0x5c5965?_0x54abc7(_0x35798e):_0x54abc7();});}}catch(_0x465c64){_0x313f1f(_0x465c64);}});}function getCustomDashboards(_0x3c8602){var _0x2fbc04=[];return new BPromise(function(_0x614b7b,_0x3ded41){try{if(_0x3c8602[_0xd421('0x58')]){return db[_0xd421('0x6b')][_0xd421('0x57')]({'raw':!![]})[_0xd421('0x2a')](function(_0xccb2b0){_0xccb2b0[_0xd421('0x6c')](function(_0xe65587){_0x2fbc04[_0xd421('0x61')](_0xe65587['id']+0x1869f);});_0x614b7b(_0x2fbc04);});}else{return db['UserProfileResource'][_0xd421('0x57')]({'where':{'sectionId':_0x3c8602['id']},'raw':!![]})[_0xd421('0x2a')](function(_0x4858ae){_0x4858ae[_0xd421('0x6c')](function(_0x3218ab){_0x2fbc04[_0xd421('0x61')](_0x3218ab['resourceId']+0x1869f);});_0x614b7b(_0x2fbc04);});}}catch(_0x509285){_0x3ded41(_0x509285);}});}function getPlugins(_0x502b85){var _0x2146bb=[];return new BPromise(function(_0x5a9d42,_0x20021b){try{if(_0x502b85[_0xd421('0x58')]){return db['Plugin']['findAll']({'raw':!![]})[_0xd421('0x2a')](function(_0x276e55){_0x276e55[_0xd421('0x6c')](function(_0x6c4931){_0x2146bb['push'](_0x6c4931['id']+0x15b38);});_0x5a9d42(_0x2146bb);});}else{return db[_0xd421('0x59')][_0xd421('0x57')]({'where':{'sectionId':_0x502b85['id']},'raw':!![]})[_0xd421('0x2a')](function(_0xac7b13){_0xac7b13[_0xd421('0x6c')](function(_0x46d6a4){_0x2146bb[_0xd421('0x61')](_0x46d6a4['resourceId']+0x15b38);});_0x5a9d42(_0x2146bb);});}}catch(_0x40ad35){_0x20021b(_0x40ad35);}});}exports[_0xd421('0x6d')]=function(_0x22db02,_0xe9586b){return db[_0xd421('0x32')][_0xd421('0x4d')]({'where':{'id':_0x22db02[_0xd421('0x4c')]['id']}})[_0xd421('0x2a')](handleEntityNotFound(_0xe9586b,null))['then'](function(_0x2ea780){if(_0x2ea780){return db[_0xd421('0x5f')][_0xd421('0x54')](function(_0x466db1){return db[_0xd421('0x56')][_0xd421('0x57')]({'where':{'userProfileId':_0x22db02[_0xd421('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0xd421('0x2a')](function(_0x79e74e){if(_0x79e74e){return db[_0xd421('0x56')][_0xd421('0x2b')]({'where':{'userProfileId':_0x22db02['params']['id'],'id':_[_0xd421('0x31')](_0x79e74e,function(_0x25029c){return _0x25029c['id'];})},'transaction':_0x466db1});}})['then'](function(_0x55d26e){var _0xc926cb=_[_0xd421('0x31')](_0x22db02[_0xd421('0x4f')],function(_0x440022){_0x440022[_0xd421('0x5b')]=_0x22db02[_0xd421('0x4c')]['id'];return _0x440022;});return db[_0xd421('0x56')][_0xd421('0x6e')](_0xc926cb,{'raw':!![],'transaction':_0x466db1});})[_0xd421('0x2a')](function(_0x4a6a3a){var _0x16eafd=_[_0xd421('0x43')](_[_0xd421('0x31')](_0x4a6a3a,function(_0x346627){return _0x346627[_0xd421('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x16eafd){return db['UserProfileSection'][_0xd421('0x57')]({'where':{'userProfileId':_0x22db02[_0xd421('0x4c')]['id'],'sectionId':_[_0xd421('0x31')](_0x16eafd,function(_0x3abade){return _0x3abade[_0xd421('0x65')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd421('0x2a')](function(_0xe9913f){var _0x2d1aa6=_['map'](_0x22db02['body'],function(_0x2fdf18){_0x2fdf18[_0xd421('0x5b')]=_0x22db02[_0xd421('0x4c')]['id'];return _0x2fdf18;});return db['UserProfileResource']['bulkCreate'](_0x2d1aa6,{'raw':!![],'transaction':_0x466db1});});}})[_0xd421('0x4a')](handleError(_0xe9586b,null));});}})[_0xd421('0x2a')](function(_0x2546b7){var _0x514af2=_[_0xd421('0x31')](_0x2546b7,function(_0x34d597){return _0x34d597[_0xd421('0x55')]({'plain':!![]});});})[_0xd421('0x2a')](respondWithResult(_0xe9586b,null))['catch'](handleError(_0xe9586b,null));};exports[_0xd421('0x6f')]=function(_0x244aa2,_0x529684,_0x560c53){return db[_0xd421('0x32')]['find']({'where':{'id':_0x244aa2[_0xd421('0x4c')]['id']}})[_0xd421('0x2a')](handleEntityNotFound(_0x529684,null))['then'](function(_0x320d6e){if(_0x320d6e){return _0x320d6e[_0xd421('0x6f')](_0x244aa2[_0xd421('0x38')][_0xd421('0x70')]);}})[_0xd421('0x2a')](respondWithStatusCode(_0x529684,null))[_0xd421('0x4a')](handleError(_0x529684,null));};exports[_0xd421('0x71')]=function(_0x23fa5f,_0x5ddfe1){var _0x580e80={};if(!_0x23fa5f['query'][_0xd421('0x72')])throw new Error(_0xd421('0x73'));if(!_0x23fa5f[_0xd421('0x38')][_0xd421('0x3e')](_0xd421('0x3f'))){_0x580e80[_0xd421('0x23')]=qs['limit'](_0x23fa5f[_0xd421('0x38')][_0xd421('0x23')]);_0x580e80[_0xd421('0x21')]=qs['offset'](_0x23fa5f['query'][_0xd421('0x21')]);}return db[_0xd421('0x32')][_0xd421('0x4d')]({'where':{'id':_0x23fa5f[_0xd421('0x4c')]['id']}})[_0xd421('0x2a')](function(_0x159e45){if(!_0x159e45)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x23fa5f[_0xd421('0x4c')]['id']);return db[_0xd421('0x32')][_0xd421('0x71')](_0x23fa5f);})['then'](respondWithFilteredResult(_0x5ddfe1,_0x580e80))['catch'](handleError(_0x5ddfe1,null));}; \ No newline at end of file +var _0x6ba9=['addSections','removeSections','ids','getSections','includes','sectionId','isEmpty','subsections','concat','enabled','findOne','Dashboard','forEach','push','resourceId','bulkCreate','removeResources','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','includeAll','each','autoAssociation','userProfileId','UserProfileSection','UserProfileResource','Resources','destroy','describe'];(function(_0x7e323f,_0x301e25){var _0x154884=function(_0x36368e){while(--_0x36368e){_0x7e323f['push'](_0x7e323f['shift']());}};_0x154884(++_0x301e25);}(_0x6ba9,0x1e3));var _0x96ba=function(_0xd7cc41,_0x81d94c){_0xd7cc41=_0xd7cc41-0x0;var _0x8a77ac=_0x6ba9[_0xd7cc41];return _0x8a77ac;};'use strict';var emlformat=require(_0x96ba('0x0'));var rimraf=require(_0x96ba('0x1'));var zipdir=require(_0x96ba('0x2'));var jsonpatch=require(_0x96ba('0x3'));var rp=require(_0x96ba('0x4'));var moment=require(_0x96ba('0x5'));var BPromise=require(_0x96ba('0x6'));var Mustache=require(_0x96ba('0x7'));var util=require(_0x96ba('0x8'));var path=require(_0x96ba('0x9'));var sox=require(_0x96ba('0xa'));var csv=require(_0x96ba('0xb'));var ejs=require(_0x96ba('0xc'));var fs=require('fs');var fs_extra=require(_0x96ba('0xd'));var _=require('lodash');var squel=require(_0x96ba('0xe'));var crypto=require(_0x96ba('0xf'));var jsforce=require(_0x96ba('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x96ba('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x96ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x96ba('0x12'));var as=require(_0x96ba('0x13'));var hardwareService=require(_0x96ba('0x14'));var logger=require(_0x96ba('0x15'))(_0x96ba('0x16'));var utils=require('../../config/utils');var config=require(_0x96ba('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96ba('0x18'))['db'];config[_0x96ba('0x19')]=_[_0x96ba('0x1a')](config[_0x96ba('0x19')],{'host':_0x96ba('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96ba('0x19')]));require(_0x96ba('0x1c'))[_0x96ba('0x1d')](socket);function respondWithStatusCode(_0x2be2fa,_0x30f8b3){_0x30f8b3=_0x30f8b3||0xcc;return function(_0x1a1bc7){if(_0x1a1bc7){return _0x2be2fa[_0x96ba('0x1e')](_0x30f8b3);}return _0x2be2fa[_0x96ba('0x1f')](_0x30f8b3)[_0x96ba('0x20')]();};}function respondWithResult(_0x3e316a,_0x169f71){_0x169f71=_0x169f71||0xc8;return function(_0x18eb66){if(_0x18eb66){return _0x3e316a['status'](_0x169f71)[_0x96ba('0x21')](_0x18eb66);}};}function respondWithFilteredResult(_0xce40ac,_0x5e2d76){return function(_0x20291c){if(_0x20291c){var _0x30fbf0=typeof _0x5e2d76[_0x96ba('0x22')]===_0x96ba('0x23')&&typeof _0x5e2d76[_0x96ba('0x24')]===_0x96ba('0x23');var _0x5d3320=_0x20291c[_0x96ba('0x25')];var _0x3cf74d=_0x30fbf0?0x0:_0x5e2d76['offset'];var _0x4656c6=_0x30fbf0?_0x20291c[_0x96ba('0x25')]:_0x5e2d76[_0x96ba('0x22')]+_0x5e2d76[_0x96ba('0x24')];var _0x4afe06;if(_0x4656c6>=_0x5d3320){_0x4656c6=_0x5d3320;_0x4afe06=0xc8;}else{_0x4afe06=0xce;}_0xce40ac[_0x96ba('0x1f')](_0x4afe06);return _0xce40ac[_0x96ba('0x26')](_0x96ba('0x27'),_0x3cf74d+'-'+_0x4656c6+'/'+_0x5d3320)[_0x96ba('0x21')](_0x20291c);}return null;};}function patchUpdates(_0x3a95d0){return function(_0x2e749c){try{jsonpatch['apply'](_0x2e749c,_0x3a95d0,!![]);}catch(_0x4aebba){return BPromise[_0x96ba('0x28')](_0x4aebba);}return _0x2e749c[_0x96ba('0x29')]();};}function saveUpdates(_0x3174c7,_0x4f6577){return function(_0x62d534){if(_0x62d534){return _0x62d534['update'](_0x3174c7)[_0x96ba('0x2a')](function(_0xe483d0){return _0xe483d0;});}return null;};}function removeEntity(_0xf7203b,_0xd339a6){return function(_0x4242ce){if(_0x4242ce){return _0x4242ce['destroy']()['then'](function(){_0xf7203b[_0x96ba('0x1f')](0xcc)[_0x96ba('0x20')]();});}};}function handleEntityNotFound(_0x3d9ab2,_0x597cc0){return function(_0x31a54f){if(!_0x31a54f){_0x3d9ab2[_0x96ba('0x1e')](0x194);}return _0x31a54f;};}function handleError(_0x120651,_0x519217){_0x519217=_0x519217||0x1f4;return function(_0x5b761e){logger[_0x96ba('0x2b')](_0x5b761e[_0x96ba('0x2c')]);if(_0x5b761e['name']){delete _0x5b761e[_0x96ba('0x2d')];}_0x120651[_0x96ba('0x1f')](_0x519217)[_0x96ba('0x2e')](_0x5b761e);};}exports[_0x96ba('0x2f')]=function(_0x1cb467,_0x150f9a){var _0x5a5456={},_0x5ec54b={},_0x367f39={'count':0x0,'rows':[]};var _0x52b9b5=_[_0x96ba('0x30')](db[_0x96ba('0x31')][_0x96ba('0x32')],function(_0x397d61){return{'name':_0x397d61[_0x96ba('0x33')],'type':_0x397d61[_0x96ba('0x34')][_0x96ba('0x35')]};});_0x5ec54b[_0x96ba('0x36')]=_[_0x96ba('0x30')](_0x52b9b5,_0x96ba('0x2d'));_0x5ec54b['query']=_[_0x96ba('0x37')](_0x1cb467[_0x96ba('0x38')]);_0x5ec54b['filters']=_[_0x96ba('0x39')](_0x5ec54b[_0x96ba('0x36')],_0x5ec54b['query']);_0x5a5456[_0x96ba('0x3a')]=_[_0x96ba('0x39')](_0x5ec54b[_0x96ba('0x36')],qs[_0x96ba('0x3b')](_0x1cb467[_0x96ba('0x38')][_0x96ba('0x3b')]));_0x5a5456['attributes']=_0x5a5456['attributes'][_0x96ba('0x3c')]?_0x5a5456[_0x96ba('0x3a')]:_0x5ec54b[_0x96ba('0x36')];if(!_0x1cb467['query']['hasOwnProperty'](_0x96ba('0x3d'))){_0x5a5456[_0x96ba('0x24')]=qs[_0x96ba('0x24')](_0x1cb467[_0x96ba('0x38')][_0x96ba('0x24')]);_0x5a5456[_0x96ba('0x22')]=qs[_0x96ba('0x22')](_0x1cb467[_0x96ba('0x38')][_0x96ba('0x22')]);}_0x5a5456[_0x96ba('0x3e')]=qs['sort'](_0x1cb467[_0x96ba('0x38')][_0x96ba('0x3f')]);_0x5a5456[_0x96ba('0x40')]=qs['filters'](_[_0x96ba('0x41')](_0x1cb467[_0x96ba('0x38')],_0x5ec54b[_0x96ba('0x42')]),_0x52b9b5);if(_0x1cb467[_0x96ba('0x38')][_0x96ba('0x43')]){_0x5a5456[_0x96ba('0x40')]=_[_0x96ba('0x44')](_0x5a5456[_0x96ba('0x40')],{'$or':_[_0x96ba('0x30')](_0x52b9b5,function(_0x1714d2){if(_0x1714d2['type']!==_0x96ba('0x45')){var _0x2182f6={};_0x2182f6[_0x1714d2[_0x96ba('0x2d')]]={'$like':'%'+_0x1cb467[_0x96ba('0x38')]['filter']+'%'};return _0x2182f6;}})});}_0x5a5456=_[_0x96ba('0x44')]({},_0x5a5456,_0x1cb467[_0x96ba('0x46')]);var _0x580b57={'where':_0x5a5456[_0x96ba('0x40')]};return db['UserProfile']['count'](_0x580b57)[_0x96ba('0x2a')](function(_0x214452){_0x367f39['count']=_0x214452;if(_0x1cb467[_0x96ba('0x38')]['includeAll']){_0x5a5456[_0x96ba('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x96ba('0x48')](_0x5a5456);})[_0x96ba('0x2a')](function(_0x3be45b){_0x367f39[_0x96ba('0x49')]=_0x3be45b;return _0x367f39;})[_0x96ba('0x2a')](respondWithFilteredResult(_0x150f9a,_0x5a5456))[_0x96ba('0x4a')](handleError(_0x150f9a,null));};exports[_0x96ba('0x4b')]=function(_0x2d226f,_0x15b590){var _0x5eb728={'raw':![],'where':{'id':_0x2d226f[_0x96ba('0x4c')]['id']}},_0x35611f={};_0x35611f[_0x96ba('0x36')]=_[_0x96ba('0x37')](db['UserProfile'][_0x96ba('0x32')]);_0x35611f[_0x96ba('0x38')]=_[_0x96ba('0x37')](_0x2d226f[_0x96ba('0x38')]);_0x35611f['filters']=_['intersection'](_0x35611f['model'],_0x35611f['query']);_0x5eb728[_0x96ba('0x3a')]=_[_0x96ba('0x39')](_0x35611f[_0x96ba('0x36')],qs['fields'](_0x2d226f[_0x96ba('0x38')]['fields']));_0x5eb728[_0x96ba('0x3a')]=_0x5eb728[_0x96ba('0x3a')][_0x96ba('0x3c')]?_0x5eb728['attributes']:_0x35611f[_0x96ba('0x36')];if(_0x2d226f[_0x96ba('0x38')]['includeAll']){_0x5eb728[_0x96ba('0x47')]=[{'all':!![]}];}_0x5eb728=_[_0x96ba('0x44')]({},_0x5eb728,_0x2d226f[_0x96ba('0x46')]);return db[_0x96ba('0x31')][_0x96ba('0x4d')](_0x5eb728)[_0x96ba('0x2a')](handleEntityNotFound(_0x15b590,null))[_0x96ba('0x2a')](respondWithResult(_0x15b590,null))[_0x96ba('0x4a')](handleError(_0x15b590,null));};exports[_0x96ba('0x4e')]=function(_0xb24c6f,_0x3ee7f5){return db[_0x96ba('0x31')][_0x96ba('0x4e')](_0xb24c6f['body'],{})['then'](respondWithResult(_0x3ee7f5,0xc9))[_0x96ba('0x4a')](handleError(_0x3ee7f5,null));};exports[_0x96ba('0x4f')]=function(_0x933cbb,_0x40c918){var _0x51a300={'where':{'id':_0x933cbb[_0x96ba('0x4c')]['id']}},_0x4c5f01={};_0x4c5f01['model']=_[_0x96ba('0x37')](db[_0x96ba('0x31')][_0x96ba('0x32')]);_0x51a300[_0x96ba('0x3a')]=_[_0x96ba('0x39')](_0x4c5f01['model'],qs[_0x96ba('0x3b')](_0x933cbb[_0x96ba('0x38')][_0x96ba('0x3b')]));_0x51a300[_0x96ba('0x3a')]=_0x51a300[_0x96ba('0x3a')][_0x96ba('0x3c')]?_0x51a300[_0x96ba('0x3a')]:_0x4c5f01[_0x96ba('0x36')];if(_0x933cbb[_0x96ba('0x38')]['includeAll']){_0x51a300[_0x96ba('0x47')]=[{'all':!![]}];}_0x51a300=_[_0x96ba('0x44')]({},_0x51a300,_0x933cbb[_0x96ba('0x46')]);return db['UserProfile'][_0x96ba('0x4d')](_0x51a300)[_0x96ba('0x2a')](handleEntityNotFound(_0x40c918,null))[_0x96ba('0x2a')](function(_0x5298a5){if(_0x5298a5){var _0x331957=_0x5298a5[_0x96ba('0x50')]({'plain':!![]});_0x331957=qs[_0x96ba('0x51')](_0x331957,['id',_0x96ba('0x52'),_0x96ba('0x53'),_0x96ba('0x54')]);_0x933cbb[_0x96ba('0x55')]=_['omit'](_0x933cbb[_0x96ba('0x55')],['id',_0x96ba('0x52'),_0x96ba('0x53')]);return db[_0x96ba('0x56')][_0x96ba('0x57')](function(_0x485612){return db[_0x96ba('0x31')]['create'](_[_0x96ba('0x44')](_0x331957,_0x933cbb[_0x96ba('0x55')]),{'include':_0x933cbb[_0x96ba('0x38')][_0x96ba('0x58')]?[{'all':!![]}]:undefined,'transaction':_0x485612})[_0x96ba('0x2a')](function(_0x15bec3){var _0x2e4fc2=_0x15bec3[_0x96ba('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x96ba('0x48')]({'where':{'userProfileId':_0x933cbb[_0x96ba('0x4c')]['id']},'raw':!![]})[_0x96ba('0x2a')](function(_0xaa5c79){if(_0xaa5c79){return BPromise[_0x96ba('0x59')](_0xaa5c79,function(_0x3e2382){return new BPromise(function(_0x2e9e85,_0x3d05cd){if(_0x3e2382[_0x96ba('0x5a')]===null||_0x3e2382[_0x96ba('0x5a')]===0x1)_0x2e9e85(null);return db['UserProfileResource'][_0x96ba('0x48')]({'where':{'sectionId':_0x3e2382['id']},'raw':!![]})[_0x96ba('0x2a')](function(_0x3c91a9){var _0x39a03b=_[_0x96ba('0x30')](_0x3c91a9,function(_0xd2dea8){return qs[_0x96ba('0x51')](_0xd2dea8,['id','createdAt',_0x96ba('0x53'),'sectionId']);});_0x2e9e85(_0x39a03b);})[_0x96ba('0x4a')](function(_0x3af7e3){_0x3d05cd(_0x3af7e3);});})[_0x96ba('0x2a')](function(_0x405df2){var _0x315acd=qs[_0x96ba('0x51')](_0x3e2382,['id','createdAt',_0x96ba('0x53')]);_0x315acd[_0x96ba('0x5b')]=_0x2e4fc2['id'];if(_0x405df2)_0x315acd['Resources']=_0x405df2;return _0x315acd;})[_0x96ba('0x2a')](function(_0x3e295f){return db[_0x96ba('0x5c')][_0x96ba('0x4e')](_0x3e295f,{'include':[{'model':db[_0x96ba('0x5d')],'as':_0x96ba('0x5e')}],'raw':!![],'transaction':_0x485612});});})[_0x96ba('0x2a')](function(){return _0x2e4fc2;});}});});});}})[_0x96ba('0x2a')](respondWithResult(_0x40c918,0xc9))[_0x96ba('0x4a')](handleError(_0x40c918,null));};exports['update']=function(_0x1ee85f,_0x4d55b5){if(_0x1ee85f[_0x96ba('0x55')]['id']){delete _0x1ee85f[_0x96ba('0x55')]['id'];}return db[_0x96ba('0x31')][_0x96ba('0x4d')]({'where':{'id':_0x1ee85f[_0x96ba('0x4c')]['id']}})[_0x96ba('0x2a')](handleEntityNotFound(_0x4d55b5,null))['then'](saveUpdates(_0x1ee85f[_0x96ba('0x55')],null))[_0x96ba('0x2a')](respondWithResult(_0x4d55b5,null))['catch'](handleError(_0x4d55b5,null));};exports[_0x96ba('0x5f')]=function(_0x5c133a,_0x507776){return db[_0x96ba('0x31')]['find']({'where':{'id':_0x5c133a[_0x96ba('0x4c')]['id']}})[_0x96ba('0x2a')](handleEntityNotFound(_0x507776,null))[_0x96ba('0x2a')](removeEntity(_0x507776,null))['catch'](handleError(_0x507776,null));};exports[_0x96ba('0x60')]=function(_0x136c95,_0x175953){return db[_0x96ba('0x31')][_0x96ba('0x60')]()[_0x96ba('0x2a')](respondWithResult(_0x175953,null))[_0x96ba('0x4a')](handleError(_0x175953,null));};exports[_0x96ba('0x61')]=function(_0x29d449,_0x28040e){var _0x238e21=_0x29d449['body'];return db[_0x96ba('0x31')][_0x96ba('0x4d')]({'where':{'id':_0x29d449[_0x96ba('0x4c')]['id']}})[_0x96ba('0x2a')](handleEntityNotFound(_0x28040e,null))[_0x96ba('0x2a')](function(_0x1f20fa){if(_0x1f20fa){return db[_0x96ba('0x56')]['transaction'](function(_0x4ccf94){return db['UserProfileSection'][_0x96ba('0x5f')]({'where':{'userProfileId':_0x29d449['params']['id'],'sectionId':_[_0x96ba('0x30')](_0x238e21,function(_0x2848a5){return _0x2848a5['sectionId'];})},'transaction':_0x4ccf94})['then'](function(){var _0x13f6e1=_['map'](_0x238e21,function(_0x27f5a8){_0x27f5a8[_0x96ba('0x5b')]=_0x29d449[_0x96ba('0x4c')]['id'];return _0x27f5a8;});var _0x1d1735=[];return BPromise['each'](_0x13f6e1,function(_0x46287d){return db[_0x96ba('0x5c')]['create'](_0x46287d,{'include':[{'model':db['UserProfileResource'],'as':_0x96ba('0x5e')}],'raw':!![],'transaction':_0x4ccf94})[_0x96ba('0x2a')](function(_0x146279){_0x1d1735['push'](_0x146279[_0x96ba('0x50')]({'plain':!![]}));});})[_0x96ba('0x2a')](function(){return _0x1d1735;});});});}})[_0x96ba('0x2a')](function(_0x1d8a08){return _0x1d8a08;})[_0x96ba('0x2a')](respondWithResult(_0x28040e,null))[_0x96ba('0x4a')](handleError(_0x28040e,null));};exports[_0x96ba('0x62')]=function(_0x1d52b0,_0x40d515){var _0x8dca4a;return db['UserProfile'][_0x96ba('0x4d')]({'where':{'id':_0x1d52b0[_0x96ba('0x4c')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x40d515,null))[_0x96ba('0x2a')](function(_0xb3cc4c){if(_0xb3cc4c){_0x8dca4a=_0xb3cc4c;return db[_0x96ba('0x5c')]['destroy']({'where':{'userProfileId':_0x1d52b0[_0x96ba('0x4c')]['id'],'sectionId':_0x1d52b0[_0x96ba('0x38')][_0x96ba('0x63')]}});}})[_0x96ba('0x2a')](function(){return _0x8dca4a;})[_0x96ba('0x2a')](respondWithStatusCode(_0x40d515,null))[_0x96ba('0x4a')](handleError(_0x40d515,null));};exports[_0x96ba('0x64')]=function(_0x6abca3,_0x5785ea){var _0x80801f=[];var _0x4c7d33=[];return db[_0x96ba('0x5c')]['findAll']({'where':{'userProfileId':_0x6abca3['params']['id']},'raw':!![]})[_0x96ba('0x2a')](function(_0x51e09d){_0x80801f=_[_0x96ba('0x43')](_0x51e09d,function(_0x1e4695){return _0x1e4695['enabled']===0x1||_[_0x96ba('0x65')]([0x3eb,0x709],_0x1e4695[_0x96ba('0x66')]);});if(!_[_0x96ba('0x67')](_0x80801f)){return _['map'](_0x80801f,function(_0x5f41df){return _0x5f41df[_0x96ba('0x66')];});}else{return;}})[_0x96ba('0x2a')](function(_0x10482e){if(_0x10482e)_0x4c7d33=_0x10482e;if(_[_0x96ba('0x65')](_0x4c7d33,0x64)){var _0x170fb5=_['find'](_0x80801f,{'sectionId':0x64});return hasDefaultDashboard(_0x170fb5)[_0x96ba('0x2a')](function(_0x19bb7a){return _[_0x96ba('0x30')](_0x80801f,function(_0x46455f){if(_0x46455f['sectionId']===0x64){_0x46455f[_0x96ba('0x68')]=_0x19bb7a;}return _0x46455f;});});}else{return;}})['then'](function(_0x1b499c){if(_0x1b499c)_0x80801f=_0x1b499c;if(_[_0x96ba('0x65')](_0x4c7d33,0x3eb)){var _0x28b215=_['find'](_0x80801f,{'sectionId':0x3eb});return getCustomDashboards(_0x28b215)['then'](function(_0x5b355a){return _[_0x96ba('0x30')](_0x80801f,function(_0x516457){if(_0x28b215['enabled']){if(_0x516457[_0x96ba('0x66')]===0x3eb){_0x516457['subsections']=_0x5b355a;}}else{if(_0x516457[_0x96ba('0x66')]===0x64){if(!_0x516457['subsections']){_0x516457['subsections']=[];}_0x516457['subsections']=_0x516457[_0x96ba('0x68')][_0x96ba('0x69')](_0x5b355a);}}return _0x516457;});});}else{return;}})[_0x96ba('0x2a')](function(_0x9aca8b){if(_0x9aca8b)_0x80801f=_0x9aca8b;if(_[_0x96ba('0x65')](_0x4c7d33,0x709)){var _0x2d4d64=_[_0x96ba('0x4d')](_0x80801f,{'sectionId':0x709});return getPlugins(_0x2d4d64)[_0x96ba('0x2a')](function(_0x5ddd2d){if(_0x2d4d64[_0x96ba('0x6a')]){return _[_0x96ba('0x30')](_0x80801f,function(_0x7e9e19){if(_0x7e9e19[_0x96ba('0x66')]===0x709){_0x7e9e19[_0x96ba('0x68')]=_0x5ddd2d;}return _0x7e9e19;});}else{var _0x4699ed={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ddd2d};var _0x141c65=_[_0x96ba('0x30')](_0x80801f);_0x141c65['push'](_0x4699ed);return _0x141c65;}});}else{return;}})[_0x96ba('0x2a')](function(_0x6a2c37){if(_0x6a2c37)_0x80801f=_0x6a2c37;return _[_0x96ba('0x43')](_0x80801f,[_0x96ba('0x6a'),0x1]);})[_0x96ba('0x2a')](respondWithResult(_0x5785ea,null))[_0x96ba('0x4a')](handleError(_0x5785ea,null));};function hasDefaultDashboard(_0x5abb03){var _0x26bb8f=[0x65];return new BPromise(function(_0x30af52,_0x2b6863){try{if(_0x5abb03[_0x96ba('0x5a')]){_0x30af52(_0x26bb8f);}else{return db[_0x96ba('0x5d')][_0x96ba('0x6b')]({'where':{'sectionId':_0x5abb03['id']},'raw':!![]})[_0x96ba('0x2a')](function(_0x29f0ed){_0x29f0ed?_0x30af52(_0x26bb8f):_0x30af52();});}}catch(_0x46a015){_0x2b6863(_0x46a015);}});}function getCustomDashboards(_0x3022cb){var _0x1bd40b=[];return new BPromise(function(_0x336945,_0x4a9fe9){try{if(_0x3022cb[_0x96ba('0x5a')]){return db[_0x96ba('0x6c')][_0x96ba('0x48')]({'raw':!![]})[_0x96ba('0x2a')](function(_0x5b7262){_0x5b7262[_0x96ba('0x6d')](function(_0x3bad91){_0x1bd40b[_0x96ba('0x6e')](_0x3bad91['id']+0x1869f);});_0x336945(_0x1bd40b);});}else{return db[_0x96ba('0x5d')][_0x96ba('0x48')]({'where':{'sectionId':_0x3022cb['id']},'raw':!![]})['then'](function(_0xd5a8a2){_0xd5a8a2[_0x96ba('0x6d')](function(_0x4a9f8d){_0x1bd40b['push'](_0x4a9f8d[_0x96ba('0x6f')]+0x1869f);});_0x336945(_0x1bd40b);});}}catch(_0x460232){_0x4a9fe9(_0x460232);}});}function getPlugins(_0x3ddc00){var _0x6c9482=[];return new BPromise(function(_0x4f60cd,_0x476ead){try{if(_0x3ddc00[_0x96ba('0x5a')]){return db['Plugin'][_0x96ba('0x48')]({'raw':!![]})['then'](function(_0x170e0a){_0x170e0a[_0x96ba('0x6d')](function(_0x5b5de2){_0x6c9482['push'](_0x5b5de2['id']+0x15b38);});_0x4f60cd(_0x6c9482);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3ddc00['id']},'raw':!![]})['then'](function(_0x20fed0){_0x20fed0[_0x96ba('0x6d')](function(_0x2b39ba){_0x6c9482[_0x96ba('0x6e')](_0x2b39ba[_0x96ba('0x6f')]+0x15b38);});_0x4f60cd(_0x6c9482);});}}catch(_0x443dda){_0x476ead(_0x443dda);}});}exports['addResources']=function(_0x3ab406,_0x53dc40){return db['UserProfile'][_0x96ba('0x4d')]({'where':{'id':_0x3ab406[_0x96ba('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53dc40,null))[_0x96ba('0x2a')](function(_0x393b05){if(_0x393b05){return db[_0x96ba('0x56')][_0x96ba('0x57')](function(_0x458499){return db[_0x96ba('0x5c')][_0x96ba('0x48')]({'where':{'userProfileId':_0x3ab406[_0x96ba('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x96ba('0x2a')](function(_0x3301ba){if(_0x3301ba){return db['UserProfileSection'][_0x96ba('0x5f')]({'where':{'userProfileId':_0x3ab406[_0x96ba('0x4c')]['id'],'id':_[_0x96ba('0x30')](_0x3301ba,function(_0x4ccebc){return _0x4ccebc['id'];})},'transaction':_0x458499});}})[_0x96ba('0x2a')](function(_0x4b685c){var _0x54b68e=_[_0x96ba('0x30')](_0x3ab406[_0x96ba('0x55')],function(_0x30f6d7){_0x30f6d7[_0x96ba('0x5b')]=_0x3ab406[_0x96ba('0x4c')]['id'];return _0x30f6d7;});return db['UserProfileSection'][_0x96ba('0x70')](_0x54b68e,{'raw':!![],'transaction':_0x458499});})['then'](function(_0x2d6d14){var _0x592acb=_[_0x96ba('0x43')](_[_0x96ba('0x30')](_0x2d6d14,function(_0xc9a651){return _0xc9a651[_0x96ba('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x592acb){return db[_0x96ba('0x5c')][_0x96ba('0x48')]({'where':{'userProfileId':_0x3ab406[_0x96ba('0x4c')]['id'],'sectionId':_[_0x96ba('0x30')](_0x592acb,function(_0x4eb119){return _0x4eb119[_0x96ba('0x66')];})},'attributes':['id',_0x96ba('0x66')],'raw':!![]})[_0x96ba('0x2a')](function(_0x18bfaf){var _0x471c31=_[_0x96ba('0x30')](_0x3ab406[_0x96ba('0x55')],function(_0x3d3810){_0x3d3810[_0x96ba('0x5b')]=_0x3ab406[_0x96ba('0x4c')]['id'];return _0x3d3810;});return db['UserProfileResource'][_0x96ba('0x70')](_0x471c31,{'raw':!![],'transaction':_0x458499});});}})[_0x96ba('0x4a')](handleError(_0x53dc40,null));});}})[_0x96ba('0x2a')](function(_0x32db8d){var _0x8235a1=_[_0x96ba('0x30')](_0x32db8d,function(_0x2a3efa){return _0x2a3efa[_0x96ba('0x50')]({'plain':!![]});});})[_0x96ba('0x2a')](respondWithResult(_0x53dc40,null))['catch'](handleError(_0x53dc40,null));};exports[_0x96ba('0x71')]=function(_0x4d02ec,_0x56fc00,_0x4fd4a2){return db[_0x96ba('0x31')][_0x96ba('0x4d')]({'where':{'id':_0x4d02ec[_0x96ba('0x4c')]['id']}})[_0x96ba('0x2a')](handleEntityNotFound(_0x56fc00,null))[_0x96ba('0x2a')](function(_0x3a5c27){if(_0x3a5c27){return _0x3a5c27[_0x96ba('0x71')](_0x4d02ec[_0x96ba('0x38')]['ids']);}})[_0x96ba('0x2a')](respondWithStatusCode(_0x56fc00,null))['catch'](handleError(_0x56fc00,null));};exports['getResources']=function(_0x5ac72b,_0x1b8fef){var _0x28a063={};if(!_0x5ac72b[_0x96ba('0x38')]['section'])throw new Error(_0x96ba('0x72'));if(!_0x5ac72b['query']['hasOwnProperty'](_0x96ba('0x3d'))){_0x28a063[_0x96ba('0x24')]=qs[_0x96ba('0x24')](_0x5ac72b[_0x96ba('0x38')]['limit']);_0x28a063['offset']=qs[_0x96ba('0x22')](_0x5ac72b[_0x96ba('0x38')]['offset']);}return db[_0x96ba('0x31')][_0x96ba('0x4d')]({'where':{'id':_0x5ac72b[_0x96ba('0x4c')]['id']}})[_0x96ba('0x2a')](function(_0xd0274e){if(!_0xd0274e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5ac72b[_0x96ba('0x4c')]['id']);return db[_0x96ba('0x31')][_0x96ba('0x73')](_0x5ac72b);})['then'](respondWithFilteredResult(_0x1b8fef,_0x28a063))[_0x96ba('0x4a')](handleError(_0x1b8fef,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 31cb0e6..55996a5 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 _0x1574=['UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f8025,_0x12039f){var _0x98b163=function(_0x590c79){while(--_0x590c79){_0x2f8025['push'](_0x2f8025['shift']());}};_0x98b163(++_0x12039f);}(_0x1574,0x148));var _0x4157=function(_0x34990e,_0x6b0647){_0x34990e=_0x34990e-0x0;var _0x2740b5=_0x1574[_0x34990e];return _0x2740b5;};'use strict';var EventEmitter=require(_0x4157('0x0'));var UserProfile=require(_0x4157('0x1'))['db'][_0x4157('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4157('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4157('0x4'),'afterDestroy':_0x4157('0x5')};function emitEvent(_0xab8757){return function(_0x1759d6,_0x2f0766,_0x1c528e){UserProfileEvents[_0x4157('0x6')](_0xab8757+':'+_0x1759d6['id'],_0x1759d6);UserProfileEvents[_0x4157('0x6')](_0xab8757,_0x1759d6);_0x1c528e(null);};}for(var e in events){if(events[_0x4157('0x7')](e)){var event=events[e];UserProfile[_0x4157('0x8')](e,emitEvent(event));}}module[_0x4157('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x44ff=['hook','../../mysqldb','UserProfile','setMaxListeners','emit','hasOwnProperty'];(function(_0x1bf16d,_0x10974b){var _0x24cec7=function(_0xf73690){while(--_0xf73690){_0x1bf16d['push'](_0x1bf16d['shift']());}};_0x24cec7(++_0x10974b);}(_0x44ff,0x1c3));var _0xf44f=function(_0x4fda7,_0x8a0ea2){_0x4fda7=_0x4fda7-0x0;var _0xe1dab6=_0x44ff[_0x4fda7];return _0xe1dab6;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf44f('0x0'))['db'][_0xf44f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf44f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5908ce){return function(_0x1483ad,_0x672258,_0x53c286){UserProfileEvents['emit'](_0x5908ce+':'+_0x1483ad['id'],_0x1483ad);UserProfileEvents[_0xf44f('0x3')](_0x5908ce,_0x1483ad);_0x53c286(null);};}for(var e in events){if(events[_0xf44f('0x4')](e)){var event=events[e];UserProfile[_0xf44f('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f3226a5..4346069 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 _0x7112=['agents','telephones','Users','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','extractedreports','reportId','metrics','charAt','toUpperCase','slice','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','where','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','CmCompany','CmCustomField','chatqueues','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team'];(function(_0x5072ff,_0x3db870){var _0x1d1098=function(_0x25c946){while(--_0x25c946){_0x5072ff['push'](_0x5072ff['shift']());}};_0x1d1098(++_0x3db870);}(_0x7112,0x1da));var _0x2711=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7112[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var attributes=require(_0x2711('0x0'));var squel=require(_0x2711('0x1'));module[_0x2711('0x2')]=function(_0x3e46b6){var _0x444d43=_0x3e46b6[_0x2711('0x3')];function _0x466d5b(_0x32b755,_0x3dac0f){return new Promise(function(_0x4b4125,_0xab2ade){if(!_0x3dac0f)return _0x4b4125(null);var _0xcdd83b=_0x3dac0f[_0x2711('0x4')]?{[_0x3dac0f[_0x2711('0x4')][_0x2711('0x5')]]:_0x3dac0f[_0x2711('0x4')][_0x2711('0x6')]}:undefined;return _0x444d43[_0x32b755][_0x2711('0x7')]({'where':_0xcdd83b,'raw':!![]})[_0x2711('0x8')](function(_0x33c540){_0x3dac0f[_0x2711('0x9')]=_['map'](_0x33c540,'id');_0x4b4125(_0x3dac0f);})[_0x2711('0xa')](function(_0xbab9b0){_0xab2ade(_0xbab9b0);});});}function _0x570ef4(_0x161acc,_0x2924b3){return new Promise(function(_0x53f674,_0x4475b2){var _0x1d9023=_0x161acc['filter']?{[_0x161acc[_0x2711('0x4')][_0x2711('0x5')]]:_0x161acc[_0x2711('0x4')][_0x2711('0x6')]}:undefined;return _0x444d43[_0x161acc[_0x2711('0xb')]][_0x2711('0x7')]({'where':_0x1d9023,'raw':!![]})[_0x2711('0x8')](function(_0x1586f7){_0x2924b3[_0x2711('0x9')]=_[_0x2711('0xc')](_0x1586f7,function(_0x406829){return _0x406829[_0x2711('0xd')];});_0x53f674(_0x2924b3);})[_0x2711('0xa')](function(_0x39570f){_0x4475b2(_0x39570f);});});}function _0x3a0d91(_0x386577,_0x3bcbb5,_0x490436){if(!_0x3bcbb5)return Promise[_0x2711('0xe')](null);return new Promise(function(_0x3b6cdf,_0x529aaa){return _0x444d43[_0x2711('0xf')]['findAll']({'where':{'sectionId':_0x3bcbb5['id']},'raw':!![]})[_0x2711('0x8')](function(_0x77007c){if(_0x386577[_0x2711('0x5')]&&_0x386577[_0x2711('0x5')]!=='id'){_0x3bcbb5[_0x2711('0x9')]=_['map'](_0x77007c,function(_0x9d5f90){return _0x9d5f90[_0x386577[_0x2711('0x5')]];});}else{if(_0x490436===_0x2711('0x10')){_0x3bcbb5[_0x2711('0x9')]=_[_0x2711('0xc')](_0x77007c,function(_0x3ac55f){return{'id':_0x3ac55f[_0x2711('0x11')],'type':_0x3ac55f[_0x2711('0x12')]};});}else{_0x3bcbb5['associatedResources']=_[_0x2711('0xc')](_0x77007c,function(_0x333c53){return _0x333c53[_0x2711('0x11')];});}}_0x3b6cdf(_0x3bcbb5);})[_0x2711('0xa')](function(_0x556559){_0x529aaa(_0x556559);});});}function _0x5a6067(_0xabdb78,_0x1f1a31){var _0x42a1f4={'parentSections':[]};switch(_0xabdb78[_0x2711('0x13')]()){case'squareprojects':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x15');break;case'odbc':_0x42a1f4[_0x2711('0x14')]='SquareOdbc';break;case _0x2711('0x16'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x17');_0x42a1f4[_0x2711('0x18')]=[{'name':_0x2711('0x19'),'field':_0x2711('0xd'),'foreignKey':'projectName'}];break;case _0x2711('0x1a'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x1b');break;case'contacts':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x1c');_0x42a1f4[_0x2711('0x18')]=[{'name':_0x2711('0x1d'),'field':'id','foreignKey':_0x2711('0x1e')}];break;case _0x2711('0x1f'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x20');break;case'companies':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x21');break;case'globalcustomfields':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x22');break;case _0x2711('0x23'):_0x42a1f4[_0x2711('0x14')]='ChatQueue';break;case _0x2711('0x24'):_0x42a1f4[_0x2711('0x14')]='ChatWebsite';break;case _0x2711('0x25'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x26');break;case _0x2711('0x27'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x28');break;case _0x2711('0x29'):case _0x2711('0x2a'):case _0x2711('0x2b'):_0x42a1f4[_0x2711('0x14')]='VoiceExtension';break;case'contexts':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x2c');break;case _0x2711('0x2d'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x2e');break;case _0x2711('0x2f'):_0x42a1f4[_0x2711('0x14')]='VoiceRecording';_0x42a1f4[_0x2711('0x18')]=[{'name':'Agents','field':_0x2711('0xd'),'foreignKey':_0x2711('0x30'),'model':_0x2711('0x31'),'filter':{'field':_0x2711('0x32'),'value':[_0x2711('0x33')]}},{'name':_0x2711('0x34'),'field':'name','foreignKey':_0x2711('0x30'),'model':_0x2711('0x31'),'filter':{'field':_0x2711('0x32'),'value':[_0x2711('0x35')]}},{'name':_0x2711('0x36'),'field':_0x2711('0xd'),'foreignKey':_0x2711('0x37'),'model':_0x2711('0x38'),'filter':{'field':_0x2711('0x12'),'value':[_0x2711('0x39')]}},{'name':_0x2711('0x3a'),'field':_0x2711('0xd'),'foreignKey':'queue','model':_0x2711('0x38'),'filter':{'field':_0x2711('0x12'),'value':['outbound']}}];break;case'musiconholds':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x3b');break;case'chanspies':_0x42a1f4[_0x2711('0x14')]='VoiceChanSpy';break;case _0x2711('0x3c'):_0x42a1f4['childModel']='VoicePrefix';break;case _0x2711('0x3d'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x3e');break;case _0x2711('0x3f'):_0x42a1f4[_0x2711('0x14')]='MailQueue';break;case _0x2711('0x40'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x41');break;case _0x2711('0x42'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x43');break;case'openchannelqueues':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x44');break;case _0x2711('0x45'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x46');break;case _0x2711('0x47'):_0x42a1f4[_0x2711('0x14')]='SmsQueue';break;case _0x2711('0x48'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x49');break;case _0x2711('0x4a'):_0x42a1f4[_0x2711('0x14')]='WhatsappQueue';break;case _0x2711('0x4b'):_0x42a1f4['childModel']=_0x2711('0x4c');break;case'teams':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x4d');break;case'voicequeues':case'queuecampaigns':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x38');if(_0x1f1a31){_0x42a1f4[_0x2711('0x18')]=[{'name':_0x2711('0x36')},{'name':_0x2711('0x3a')}];}break;case'users':case _0x2711('0x4e'):case _0x2711('0x4f'):_0x42a1f4['childModel']=_0x2711('0x31');if(_0x1f1a31){_0x42a1f4[_0x2711('0x18')]=[{'name':_0x2711('0x50'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0x2711('0x51')},{'name':_0x2711('0x34')}];}break;case _0x2711('0x52'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x53');break;case _0x2711('0x54'):_0x42a1f4[_0x2711('0x14')]='SalesforceAccount';break;case _0x2711('0x55'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x56');break;case'sugarcrmaccounts':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x57');break;case'deskaccounts':_0x42a1f4['childModel']=_0x2711('0x58');break;case _0x2711('0x59'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x5a');break;case _0x2711('0x5b'):_0x42a1f4['childModel']=_0x2711('0x31');break;case _0x2711('0x5c'):_0x42a1f4['childModel']=_0x2711('0x5d');break;case _0x2711('0x5e'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x5f');break;case _0x2711('0x60'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x61');break;case'intervals':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x62');break;case _0x2711('0x63'):_0x42a1f4['childModel']=_0x2711('0x64');break;case _0x2711('0x65'):_0x42a1f4['childModel']='Schedule';break;case'sounds':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x66');break;case _0x2711('0x67'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x68');break;case _0x2711('0x69'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x6a');break;case'triggers':_0x42a1f4[_0x2711('0x14')]=_0x2711('0x6b');break;case _0x2711('0x6c'):_0x42a1f4[_0x2711('0x14')]=_0x2711('0x6d');break;case _0x2711('0x6e'):_0x42a1f4['childModel']=_0x2711('0x6f');break;case'plugins':_0x42a1f4[_0x2711('0x14')]='Plugin';break;case _0x2711('0x70'):_0x42a1f4['childModel']=_0x2711('0x10');_0x42a1f4['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x2711('0x71')}];break;case _0x2711('0x72'):_0x42a1f4['childModel']='AnalyticMetric';break;}return _0x42a1f4;}function _0x53b444(_0x3647ba,_0x241418){var _0x4ebd23=_0x3647ba[_0x2711('0x73')](0x0)[_0x2711('0x74')]()+_0x3647ba[_0x2711('0x75')](0x1);var _0x4b89ab={'type':_0x444d43['Sequelize']['QueryTypes'][_0x2711('0x76')],'raw':!![]};return new Promise(function(_0x3b8b66,_0x539e76){var _0x4a220d=squel[_0x2711('0x77')]()[_0x2711('0x5')]('ui.'+_0x4ebd23+_0x2711('0x78'),'id')[_0x2711('0x5')](_0x2711('0x79'))['from'](_0x2711('0x7a')+_0x3647ba+_0x2711('0x7b'),'ui')['where'](_0x2711('0x7c'),_0x241418['id']);return _0x444d43[_0x2711('0x7d')][_0x2711('0x7e')](_0x4a220d[_0x2711('0x7f')](),_0x4b89ab)[_0x2711('0x8')](function(_0x1230c8){_0x241418[_0x4ebd23+'OpenTabs']=_0x1230c8;_0x3b8b66(_0x1230c8);})[_0x2711('0xa')](function(_0x809c3c){_0x539e76(_0x809c3c);});});}return _0x3e46b6['define'](_0x2711('0x80'),attributes,{'tableName':_0x2711('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x554b4b){var _0x34f7d0=require(_0x2711('0x82'));var _0x3b973b={'raw':_0x554b4b[_0x2711('0x7e')][_0x2711('0x83')],'where':{}};var _0x5eb345={};var _0x478ef8={'count':0x0,'rows':[]};var _0x2e7419=_0x554b4b['query']['section'];var _0x5ca3c0=_0x554b4b[_0x2711('0x7e')][_0x2711('0x84')]||![];var _0x21c30c=_0x5a6067(_0x2e7419,_0x5ca3c0);if(!_0x21c30c[_0x2711('0x14')])throw new Error(_0x2711('0x85')+_0x2e7419+'\x27');var _0x43c017=[{'name':_0x2e7419}];if(!_[_0x2711('0x86')](_0x21c30c[_0x2711('0x18')]))_0x43c017=_0x21c30c[_0x2711('0x18')];var _0x1e8800=[];for(var _0x3be6b7=0x0;_0x3be6b7<_0x43c017[_0x2711('0x87')];_0x3be6b7++){_0x1e8800[_0x2711('0x88')](_0x444d43['UserProfileSection'][_0x2711('0x89')]({'where':{'userProfileId':_0x554b4b['params']['id'],'name':_0x43c017[_0x3be6b7][_0x2711('0xd')]},'raw':!![]}));}return Promise[_0x2711('0x8a')](_0x1e8800)[_0x2711('0x8')](function(_0x59dc77){var _0x4eb70e=_['filter'](_0x59dc77,function(_0x3ad2e4){return _0x3ad2e4?_0x3ad2e4:undefined;});var _0x52ebc0=_[_0x2711('0x4')](_0x43c017,[_0x2711('0x8b'),!![]]);var _0x116a1d=_[_0x2711('0x86')](_0x4eb70e)&&_[_0x2711('0x86')](_0x52ebc0)?null:_[_0x2711('0x8c')](_0x52ebc0,_0x4eb70e);if(!_0x116a1d)return null;var _0xd5a52b=[];for(var _0x5bcea1=0x0;_0x5bcea1<_0x116a1d[_0x2711('0x87')];_0x5bcea1++){var _0x3234f0=_[_0x2711('0x89')](_0x43c017,function(_0x3d53e2){return _0x116a1d[_0x5bcea1]?_0x3d53e2[_0x2711('0xd')]===_0x116a1d[_0x5bcea1][_0x2711('0xd')]:null;});if(_0x3234f0){if(_0x116a1d[_0x5bcea1][_0x2711('0x8b')]){_0xd5a52b[_0x2711('0x88')](_0x466d5b(_0x21c30c[_0x2711('0x14')],_0x116a1d[_0x5bcea1]));}else{if(!_0x116a1d[_0x5bcea1][_0x2711('0x8d')]){_0xd5a52b[_0x2711('0x88')](_0x3a0d91(_0x3234f0,_0x116a1d[_0x5bcea1],_0x21c30c['childModel']));}else{if(_0x3234f0['model']){_0xd5a52b['push'](_0x570ef4(_0x3234f0,_0x116a1d[_0x5bcea1]));}}}}}return Promise[_0x2711('0x8a')](_0xd5a52b);})[_0x2711('0x8')](function(_0x39d1b9){var _0x499e11=_0x39d1b9;var _0x4e8591=null;if(_0x499e11){_0x4e8591=_0x499e11[_0x2711('0x87')]===0x1?_0x499e11[0x0]:null;}if(!_0x4e8591&&!_0x499e11)return _0x478ef8;var _0x356fd1=_0x444d43[_0x21c30c['childModel']][_0x2711('0x8e')];_0x5eb345['model']=_[_0x2711('0x8f')](_0x356fd1);_0x5eb345['query']=_['keys'](_0x554b4b[_0x2711('0x7e')]);_0x5eb345[_0x2711('0x90')]=_[_0x2711('0x91')](_0x5eb345[_0x2711('0xb')],_0x5eb345[_0x2711('0x7e')]);_0x3b973b[_0x2711('0x92')]=_[_0x2711('0x91')](_0x5eb345[_0x2711('0xb')],_0x34f7d0[_0x2711('0x93')](_0x554b4b['query'][_0x2711('0x93')]));_0x3b973b['attributes']=_0x3b973b['attributes']['length']?_0x3b973b[_0x2711('0x92')]:_0x5eb345['model'];if(!_0x554b4b[_0x2711('0x7e')][_0x2711('0x94')]('nolimit')){_0x3b973b['limit']=_0x34f7d0[_0x2711('0x95')](_0x554b4b[_0x2711('0x7e')]['limit']);_0x3b973b[_0x2711('0x96')]=_0x34f7d0[_0x2711('0x96')](_0x554b4b['query']['offset']);}_0x3b973b[_0x2711('0x97')]=_0x34f7d0[_0x2711('0x98')](_0x554b4b[_0x2711('0x7e')]['sort']);_0x3b973b['where']=_0x34f7d0[_0x2711('0x90')](_[_0x2711('0x99')](_0x554b4b['query'],_0x5eb345[_0x2711('0x90')]));if(_0x554b4b['query']['filter']){_0x3b973b[_0x2711('0x9a')]=_['merge'](_0x3b973b['where'],{'$or':_[_0x2711('0xc')](_0x356fd1,function(_0x1776ca){if(_0x1776ca[_0x2711('0x12')][_0x2711('0x9b')]!==_0x2711('0x9c')){var _0x5bfbfa={};_0x5bfbfa[_0x1776ca[_0x2711('0x5')]]={'$like':'%'+_0x554b4b[_0x2711('0x7e')][_0x2711('0x4')]+'%'};return _0x5bfbfa;}})});}var _0x196267=[];var _0x274582=null;var _0x18962a={};if(_0x4e8591){_0x274582=_[_0x2711('0x89')](_0x43c017,['name',_0x4e8591['name']]);if(_0x274582[_0x2711('0x5')]){_0x18962a={};if(_0x21c30c[_0x2711('0x14')]===_0x2711('0x10')){_0x18962a[_0x274582[_0x2711('0x9d')]]=_[_0x2711('0xc')](_0x4e8591[_0x2711('0x9')],'id');}else{_0x18962a[_0x274582[_0x2711('0x9d')]]=_0x4e8591[_0x2711('0x9')];}_0x196267[_0x2711('0x88')](_0x18962a);}else{_0x3b973b[_0x2711('0x9a')]['id']=_0x4e8591[_0x2711('0x9')];}}else{for(var _0x42657d=0x0;_0x42657d<_0x499e11[_0x2711('0x87')];_0x42657d++){_0x274582=_[_0x2711('0x89')](_0x43c017,[_0x2711('0xd'),_0x499e11[_0x42657d][_0x2711('0xd')]]);if(_0x274582[_0x2711('0x5')]){_0x18962a={};_0x18962a[_0x274582[_0x2711('0x9d')]]=_0x499e11[_0x42657d]['associatedResources'];_0x196267[_0x2711('0x88')](_0x18962a);}else{if(!_0x3b973b[_0x2711('0x9a')]['id'])_0x3b973b[_0x2711('0x9a')]['id']=[];_0x499e11[_0x42657d][_0x2711('0x9')][_0x2711('0x9e')](function(_0x3f0992){_0x3b973b[_0x2711('0x9a')]['id']['push'](_0x3f0992);});}}}if(!_[_0x2711('0x86')](_0x196267)){_0x3b973b[_0x2711('0x9a')]=_[_0x2711('0x9f')](_0x3b973b[_0x2711('0x9a')],{'$and':{'$or':_0x196267}});}_0x3b973b=_[_0x2711('0x9f')]({},_0x3b973b,_0x554b4b[_0x2711('0xa0')]);if(_0x4e8591&&!_0x4e8591['autoAssociation']&&_0x21c30c[_0x2711('0x14')]===_0x2711('0x10')){if(_0x554b4b[_0x2711('0x7e')][_0x2711('0xa1')]){_0x3b973b[_0x2711('0xa2')]=[{'all':!![]}];}return _0x444d43[_0x21c30c['childModel']][_0x2711('0x7')](_0x3b973b)['then'](function(_0x140655){var _0xb1670c=[];_0x140655['forEach'](function(_0x3a37c9){var _0x9dda4a;switch(_0x3a37c9[_0x2711('0xa3')]){case _0x2711('0xa4'):_0x9dda4a=_[_0x2711('0x89')](_0x4e8591[_0x2711('0x9')],function(_0x183ff4){return _0x183ff4['id']===_0x3a37c9[_0x2711('0x71')]&&_0x183ff4[_0x2711('0x12')]===_0x2711('0xa5');});break;case _0x2711('0xa6'):_0x9dda4a=_[_0x2711('0x89')](_0x4e8591['associatedResources'],function(_0x4b875c){return _0x4b875c['id']===_0x3a37c9[_0x2711('0x71')]&&_0x4b875c[_0x2711('0x12')]===_0x2711('0xa7');});break;}if(_0x9dda4a)_0xb1670c[_0x2711('0x88')](_0x3a37c9);});_0x478ef8['count']=_0xb1670c['length'];_0x478ef8['rows']=_0xb1670c;return _0x478ef8;});}else{if(!_[_0x2711('0x86')](_0x554b4b[_0x2711('0x7e')][_0x2711('0xa8')])){_0x3b973b[_0x2711('0x9a')]['id']=_0x3b973b[_0x2711('0x9a')]['id']?_[_0x2711('0x91')](_0x3b973b[_0x2711('0x9a')]['id'],_0x554b4b[_0x2711('0x7e')][_0x2711('0xa8')]):_0x554b4b[_0x2711('0x7e')][_0x2711('0xa8')];if(_0x554b4b[_0x2711('0x7e')][_0x2711('0xa9')]){_0x3b973b[_0x2711('0x97')]=_0x554b4b[_0x2711('0x7e')][_0x2711('0xa9')];}}if(_0x554b4b['query']['extraQueryConditions']){_0x3b973b[_0x2711('0x9a')]=_[_0x2711('0x9f')](_0x3b973b[_0x2711('0x9a')],{'$and':_0x554b4b[_0x2711('0x7e')][_0x2711('0xaa')]});}return _0x444d43[_0x21c30c['childModel']][_0x2711('0xab')]({'where':_0x3b973b[_0x2711('0x9a')]})[_0x2711('0x8')](function(_0x5d5497){_0x478ef8['count']=_0x5d5497;if(_0x554b4b[_0x2711('0x7e')][_0x2711('0xa1')]){if(_0x21c30c[_0x2711('0x14')]===_0x2711('0x1c')){_0x3b973b[_0x2711('0xa2')]=[{'model':_0x444d43['Tag'],'as':'Tags','attributes':['id','name',_0x2711('0xac')],'required':_0x554b4b[_0x2711('0x7e')][_0x2711('0xad')]?!![]:![]},{'model':_0x444d43['Tag'],'as':_0x2711('0xae'),'attributes':['id',_0x2711('0xd'),_0x2711('0xac')],'through':_0x554b4b[_0x2711('0x7e')][_0x2711('0xad')]?{'attributes':[],'where':{'TagId':_0x554b4b['query']['tag']||undefined}}:{},'required':_0x554b4b[_0x2711('0x7e')][_0x2711('0xad')]?!![]:![]}];}else{_0x3b973b[_0x2711('0xa2')]=[{'all':!![]}];}}return _0x444d43[_0x21c30c[_0x2711('0x14')]][_0x2711('0x7')](_0x3b973b);})[_0x2711('0x8')](function(_0x291d07){_0x478ef8[_0x2711('0xaf')]=_0x291d07;if(_0x2e7419===_0x2711('0x51')&&_0x554b4b[_0x2711('0x7e')][_0x2711('0xb0')]===_0x2711('0xb1')){var _0x11af46=[];for(var _0x4465ec=0x0;_0x4465ec<_0x478ef8[_0x2711('0xaf')]['length'];_0x4465ec++){_0x11af46[_0x2711('0x88')](_0x53b444(_0x2711('0xb2'),_0x478ef8[_0x2711('0xaf')][_0x4465ec][_0x2711('0xb3')]));_0x11af46[_0x2711('0x88')](_0x53b444(_0x2711('0xb4'),_0x478ef8[_0x2711('0xaf')][_0x4465ec][_0x2711('0xb3')]));_0x11af46['push'](_0x53b444(_0x2711('0xb5'),_0x478ef8[_0x2711('0xaf')][_0x4465ec]['dataValues']));_0x11af46[_0x2711('0x88')](_0x53b444(_0x2711('0xb6'),_0x478ef8[_0x2711('0xaf')][_0x4465ec][_0x2711('0xb3')]));_0x11af46[_0x2711('0x88')](_0x53b444(_0x2711('0xb7'),_0x478ef8['rows'][_0x4465ec][_0x2711('0xb3')]));_0x11af46[_0x2711('0x88')](_0x53b444('whatsapp',_0x478ef8['rows'][_0x4465ec][_0x2711('0xb3')]));}return Promise[_0x2711('0x8a')](_0x11af46)[_0x2711('0x8')](function(){return _0x478ef8;});}return _0x478ef8;});}});}}});}; \ No newline at end of file +var _0x34f3=['salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','tags','Tag','templates','Template','triggers','Trunk','Variable','Plugin','extractedreports','reportId','AnalyticMetric','QueryTypes','SELECT','select','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','section','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','length','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','model','name','catch','UserProfileResource','AnalyticExtractedReport','type','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','VoiceQueues','telephones','admin','user','zendeskaccounts','ZendeskAccount'];(function(_0x217798,_0x26e2b4){var _0x51157a=function(_0x40a8ba){while(--_0x40a8ba){_0x217798['push'](_0x217798['shift']());}};_0x51157a(++_0x26e2b4);}(_0x34f3,0x1d7));var _0x334f=function(_0x5cd64,_0x380c72){_0x5cd64=_0x5cd64-0x0;var _0x138cea=_0x34f3[_0x5cd64];return _0x138cea;};'use strict';var _=require('lodash');var attributes=require(_0x334f('0x0'));var squel=require(_0x334f('0x1'));module[_0x334f('0x2')]=function(_0x232b0e){var _0x17db30=_0x232b0e[_0x334f('0x3')];function _0x42b9cc(_0x5f0b1a,_0xa0e40e){return new Promise(function(_0x71a35f,_0x2c1669){if(!_0xa0e40e)return _0x71a35f(null);var _0x336fb=_0xa0e40e[_0x334f('0x4')]?{[_0xa0e40e['filter'][_0x334f('0x5')]]:_0xa0e40e['filter'][_0x334f('0x6')]}:undefined;return _0x17db30[_0x5f0b1a][_0x334f('0x7')]({'where':_0x336fb,'raw':!![]})[_0x334f('0x8')](function(_0x99a981){_0xa0e40e[_0x334f('0x9')]=_[_0x334f('0xa')](_0x99a981,'id');_0x71a35f(_0xa0e40e);})['catch'](function(_0x4f9075){_0x2c1669(_0x4f9075);});});}function _0x4131b4(_0x2f7df6,_0x2d282f){return new Promise(function(_0x5f0008,_0x344720){var _0x4531b0=_0x2f7df6[_0x334f('0x4')]?{[_0x2f7df6[_0x334f('0x4')][_0x334f('0x5')]]:_0x2f7df6[_0x334f('0x4')][_0x334f('0x6')]}:undefined;return _0x17db30[_0x2f7df6[_0x334f('0xb')]][_0x334f('0x7')]({'where':_0x4531b0,'raw':!![]})[_0x334f('0x8')](function(_0x37c884){_0x2d282f[_0x334f('0x9')]=_[_0x334f('0xa')](_0x37c884,function(_0x3e05ad){return _0x3e05ad[_0x334f('0xc')];});_0x5f0008(_0x2d282f);})[_0x334f('0xd')](function(_0x40a41d){_0x344720(_0x40a41d);});});}function _0x340e02(_0xd38550,_0x405df1,_0x303c91){if(!_0x405df1)return Promise['resolve'](null);return new Promise(function(_0x3a1675,_0x58957d){return _0x17db30[_0x334f('0xe')][_0x334f('0x7')]({'where':{'sectionId':_0x405df1['id']},'raw':!![]})[_0x334f('0x8')](function(_0x2a6dfb){if(_0xd38550[_0x334f('0x5')]&&_0xd38550[_0x334f('0x5')]!=='id'){_0x405df1[_0x334f('0x9')]=_[_0x334f('0xa')](_0x2a6dfb,function(_0x29c320){return _0x29c320[_0xd38550['field']];});}else{if(_0x303c91===_0x334f('0xf')){_0x405df1['associatedResources']=_[_0x334f('0xa')](_0x2a6dfb,function(_0x4c0552){return{'id':_0x4c0552['resourceId'],'type':_0x4c0552[_0x334f('0x10')]};});}else{_0x405df1[_0x334f('0x9')]=_[_0x334f('0xa')](_0x2a6dfb,function(_0x7b5809){return _0x7b5809['resourceId'];});}}_0x3a1675(_0x405df1);})[_0x334f('0xd')](function(_0x7c4237){_0x58957d(_0x7c4237);});});}function _0x5e26e7(_0x9078b,_0x48c500){var _0x4decab={'parentSections':[]};switch(_0x9078b['toLowerCase']()){case _0x334f('0x11'):_0x4decab[_0x334f('0x12')]=_0x334f('0x13');break;case _0x334f('0x14'):_0x4decab[_0x334f('0x12')]='SquareOdbc';break;case _0x334f('0x15'):_0x4decab[_0x334f('0x12')]=_0x334f('0x16');_0x4decab[_0x334f('0x17')]=[{'name':'SquareProjects','field':_0x334f('0xc'),'foreignKey':'projectName'}];break;case _0x334f('0x18'):_0x4decab[_0x334f('0x12')]=_0x334f('0x19');break;case'contacts':_0x4decab['childModel']=_0x334f('0x1a');_0x4decab[_0x334f('0x17')]=[{'name':_0x334f('0x1b'),'field':'id','foreignKey':_0x334f('0x1c')}];break;case _0x334f('0x1d'):_0x4decab['childModel']=_0x334f('0x1e');break;case _0x334f('0x1f'):_0x4decab[_0x334f('0x12')]=_0x334f('0x20');break;case _0x334f('0x21'):_0x4decab[_0x334f('0x12')]=_0x334f('0x22');break;case'chatqueues':_0x4decab[_0x334f('0x12')]='ChatQueue';break;case _0x334f('0x23'):_0x4decab[_0x334f('0x12')]='ChatWebsite';break;case _0x334f('0x24'):_0x4decab[_0x334f('0x12')]=_0x334f('0x25');break;case _0x334f('0x26'):_0x4decab[_0x334f('0x12')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x334f('0x27'):_0x4decab['childModel']=_0x334f('0x28');break;case _0x334f('0x29'):_0x4decab[_0x334f('0x12')]=_0x334f('0x2a');break;case'voicemails':_0x4decab[_0x334f('0x12')]=_0x334f('0x2b');break;case _0x334f('0x2c'):_0x4decab[_0x334f('0x12')]=_0x334f('0x2d');_0x4decab[_0x334f('0x17')]=[{'name':_0x334f('0x2e'),'field':_0x334f('0xc'),'foreignKey':_0x334f('0x2f'),'model':_0x334f('0x30'),'filter':{'field':_0x334f('0x31'),'value':['agent']}},{'name':_0x334f('0x32'),'field':_0x334f('0xc'),'foreignKey':_0x334f('0x2f'),'model':_0x334f('0x30'),'filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':_0x334f('0xc'),'foreignKey':_0x334f('0x33'),'model':_0x334f('0x34'),'filter':{'field':_0x334f('0x10'),'value':[_0x334f('0x35')]}},{'name':_0x334f('0x36'),'field':_0x334f('0xc'),'foreignKey':'queue','model':_0x334f('0x34'),'filter':{'field':_0x334f('0x10'),'value':[_0x334f('0x37')]}}];break;case'musiconholds':_0x4decab[_0x334f('0x12')]=_0x334f('0x38');break;case _0x334f('0x39'):_0x4decab['childModel']=_0x334f('0x3a');break;case'voiceprefixes':_0x4decab['childModel']=_0x334f('0x3b');break;case _0x334f('0x3c'):_0x4decab[_0x334f('0x12')]=_0x334f('0x3d');break;case _0x334f('0x3e'):_0x4decab[_0x334f('0x12')]=_0x334f('0x3f');break;case _0x334f('0x40'):_0x4decab[_0x334f('0x12')]=_0x334f('0x41');break;case _0x334f('0x42'):_0x4decab[_0x334f('0x12')]=_0x334f('0x43');break;case'openchannelqueues':_0x4decab[_0x334f('0x12')]=_0x334f('0x44');break;case _0x334f('0x45'):_0x4decab['childModel']=_0x334f('0x46');break;case _0x334f('0x47'):_0x4decab[_0x334f('0x12')]=_0x334f('0x48');break;case'smsaccounts':_0x4decab['childModel']=_0x334f('0x49');break;case _0x334f('0x4a'):_0x4decab[_0x334f('0x12')]=_0x334f('0x4b');break;case _0x334f('0x4c'):_0x4decab['childModel']=_0x334f('0x4d');break;case _0x334f('0x4e'):_0x4decab[_0x334f('0x12')]=_0x334f('0x4f');break;case _0x334f('0x50'):case'queuecampaigns':_0x4decab[_0x334f('0x12')]=_0x334f('0x34');if(_0x48c500){_0x4decab[_0x334f('0x17')]=[{'name':_0x334f('0x51')},{'name':_0x334f('0x36')}];}break;case'users':case'agents':case _0x334f('0x52'):_0x4decab[_0x334f('0x12')]=_0x334f('0x30');if(_0x48c500){_0x4decab[_0x334f('0x17')]=[{'name':'Users','filter':{'field':_0x334f('0x31'),'value':[_0x334f('0x53'),_0x334f('0x54')]},'ignore':!![]},{'name':_0x334f('0x2e')},{'name':_0x334f('0x32')}];}break;case _0x334f('0x55'):_0x4decab[_0x334f('0x12')]=_0x334f('0x56');break;case _0x334f('0x57'):_0x4decab['childModel']=_0x334f('0x58');break;case _0x334f('0x59'):_0x4decab[_0x334f('0x12')]=_0x334f('0x5a');break;case _0x334f('0x5b'):_0x4decab[_0x334f('0x12')]='SugarcrmAccount';break;case _0x334f('0x5c'):_0x4decab[_0x334f('0x12')]=_0x334f('0x5d');break;case _0x334f('0x5e'):_0x4decab['childModel']=_0x334f('0x5f');break;case _0x334f('0x60'):_0x4decab['childModel']='User';break;case _0x334f('0x61'):_0x4decab['childModel']=_0x334f('0x62');break;case'dispositions':_0x4decab[_0x334f('0x12')]=_0x334f('0x63');break;case _0x334f('0x64'):_0x4decab[_0x334f('0x12')]=_0x334f('0x65');break;case _0x334f('0x66'):_0x4decab['childModel']=_0x334f('0x67');break;case _0x334f('0x68'):_0x4decab[_0x334f('0x12')]=_0x334f('0x69');break;case _0x334f('0x6a'):_0x4decab['childModel']='Schedule';break;case'sounds':_0x4decab['childModel']='Sound';break;case _0x334f('0x6b'):_0x4decab[_0x334f('0x12')]=_0x334f('0x6c');break;case _0x334f('0x6d'):_0x4decab[_0x334f('0x12')]=_0x334f('0x6e');break;case _0x334f('0x6f'):_0x4decab[_0x334f('0x12')]='Trigger';break;case'trunks':_0x4decab[_0x334f('0x12')]=_0x334f('0x70');break;case'variables':_0x4decab[_0x334f('0x12')]=_0x334f('0x71');break;case'plugins':_0x4decab[_0x334f('0x12')]=_0x334f('0x72');break;case _0x334f('0x73'):_0x4decab['childModel']=_0x334f('0xf');_0x4decab[_0x334f('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x334f('0x74')}];break;case'metrics':_0x4decab['childModel']=_0x334f('0x75');break;}return _0x4decab;}function _0x9b0318(_0x87cb1,_0x10fa2b){var _0x472332=_0x87cb1['charAt'](0x0)['toUpperCase']()+_0x87cb1['slice'](0x1);var _0x1202ec={'type':_0x17db30['Sequelize'][_0x334f('0x76')][_0x334f('0x77')],'raw':!![]};return new Promise(function(_0x4a4122,_0x573dc4){var _0x521e1d=squel[_0x334f('0x78')]()['field']('ui.'+_0x472332+'InteractionId','id')[_0x334f('0x5')](_0x334f('0x79'))[_0x334f('0x7a')]('user_has_'+_0x87cb1+_0x334f('0x7b'),'ui')[_0x334f('0x7c')](_0x334f('0x7d'),_0x10fa2b['id']);return _0x17db30[_0x334f('0x7e')]['query'](_0x521e1d[_0x334f('0x7f')](),_0x1202ec)[_0x334f('0x8')](function(_0x31e86f){_0x10fa2b[_0x472332+_0x334f('0x80')]=_0x31e86f;_0x4a4122(_0x31e86f);})[_0x334f('0xd')](function(_0x30f68e){_0x573dc4(_0x30f68e);});});}return _0x232b0e[_0x334f('0x81')]('UserProfile',attributes,{'tableName':_0x334f('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x360ca9){var _0x30eccb=require(_0x334f('0x83'));var _0x3c77f5={'raw':_0x360ca9[_0x334f('0x84')]['raw'],'where':{}};var _0x496c68={};var _0x3de76a={'count':0x0,'rows':[]};var _0xb3efc7=_0x360ca9[_0x334f('0x84')][_0x334f('0x85')];var _0x213d05=_0x360ca9[_0x334f('0x84')]['mergeResources']||![];var _0x53ea0b=_0x5e26e7(_0xb3efc7,_0x213d05);if(!_0x53ea0b[_0x334f('0x12')])throw new Error(_0x334f('0x86')+_0xb3efc7+'\x27');var _0x381e97=[{'name':_0xb3efc7}];if(!_[_0x334f('0x87')](_0x53ea0b[_0x334f('0x17')]))_0x381e97=_0x53ea0b[_0x334f('0x17')];var _0x3a9e5f=[];for(var _0x2b8d77=0x0;_0x2b8d77<_0x381e97['length'];_0x2b8d77++){_0x3a9e5f[_0x334f('0x88')](_0x17db30[_0x334f('0x89')][_0x334f('0x8a')]({'where':{'userProfileId':_0x360ca9[_0x334f('0x8b')]['id'],'name':_0x381e97[_0x2b8d77][_0x334f('0xc')]},'raw':!![]}));}return Promise[_0x334f('0x8c')](_0x3a9e5f)['then'](function(_0x59fe6b){var _0x42cb07=_['filter'](_0x59fe6b,function(_0x240b8e){return _0x240b8e?_0x240b8e:undefined;});var _0x52a1ab=_[_0x334f('0x4')](_0x381e97,[_0x334f('0x8d'),!![]]);var _0x30f41e=_[_0x334f('0x87')](_0x42cb07)&&_['isEmpty'](_0x52a1ab)?null:_['union'](_0x52a1ab,_0x42cb07);if(!_0x30f41e)return null;var _0x4c2c37=[];for(var _0x20472f=0x0;_0x20472f<_0x30f41e[_0x334f('0x8e')];_0x20472f++){var _0xc52afb=_[_0x334f('0x8a')](_0x381e97,function(_0x3c976b){return _0x30f41e[_0x20472f]?_0x3c976b['name']===_0x30f41e[_0x20472f]['name']:null;});if(_0xc52afb){if(_0x30f41e[_0x20472f][_0x334f('0x8d')]){_0x4c2c37[_0x334f('0x88')](_0x42b9cc(_0x53ea0b[_0x334f('0x12')],_0x30f41e[_0x20472f]));}else{if(!_0x30f41e[_0x20472f][_0x334f('0x8f')]){_0x4c2c37[_0x334f('0x88')](_0x340e02(_0xc52afb,_0x30f41e[_0x20472f],_0x53ea0b[_0x334f('0x12')]));}else{if(_0xc52afb[_0x334f('0xb')]){_0x4c2c37[_0x334f('0x88')](_0x4131b4(_0xc52afb,_0x30f41e[_0x20472f]));}}}}}return Promise['all'](_0x4c2c37);})['then'](function(_0x476212){var _0x5e216f=_0x476212;var _0x3307f9=null;if(_0x5e216f){_0x3307f9=_0x5e216f[_0x334f('0x8e')]===0x1?_0x5e216f[0x0]:null;}if(!_0x3307f9&&!_0x5e216f)return _0x3de76a;var _0x21ae69=_0x17db30[_0x53ea0b['childModel']][_0x334f('0x90')];_0x496c68['model']=_[_0x334f('0x91')](_0x21ae69);_0x496c68[_0x334f('0x84')]=_[_0x334f('0x91')](_0x360ca9[_0x334f('0x84')]);_0x496c68['filters']=_[_0x334f('0x92')](_0x496c68[_0x334f('0xb')],_0x496c68[_0x334f('0x84')]);_0x3c77f5[_0x334f('0x93')]=_[_0x334f('0x92')](_0x496c68[_0x334f('0xb')],_0x30eccb[_0x334f('0x94')](_0x360ca9[_0x334f('0x84')][_0x334f('0x94')]));_0x3c77f5[_0x334f('0x93')]=_0x3c77f5[_0x334f('0x93')]['length']?_0x3c77f5[_0x334f('0x93')]:_0x496c68[_0x334f('0xb')];if(!_0x360ca9[_0x334f('0x84')][_0x334f('0x95')]('nolimit')){_0x3c77f5[_0x334f('0x96')]=_0x30eccb[_0x334f('0x96')](_0x360ca9[_0x334f('0x84')]['limit']);_0x3c77f5[_0x334f('0x97')]=_0x30eccb[_0x334f('0x97')](_0x360ca9[_0x334f('0x84')][_0x334f('0x97')]);}_0x3c77f5[_0x334f('0x98')]=_0x30eccb[_0x334f('0x99')](_0x360ca9['query'][_0x334f('0x99')]);_0x3c77f5[_0x334f('0x7c')]=_0x30eccb[_0x334f('0x9a')](_[_0x334f('0x9b')](_0x360ca9[_0x334f('0x84')],_0x496c68[_0x334f('0x9a')]));if(_0x360ca9[_0x334f('0x84')][_0x334f('0x4')]){_0x3c77f5[_0x334f('0x7c')]=_[_0x334f('0x9c')](_0x3c77f5[_0x334f('0x7c')],{'$or':_[_0x334f('0xa')](_0x21ae69,function(_0x5147d1){if(_0x5147d1[_0x334f('0x10')][_0x334f('0x9d')]!=='VIRTUAL'){var _0x3d61a5={};_0x3d61a5[_0x5147d1[_0x334f('0x5')]]={'$like':'%'+_0x360ca9['query'][_0x334f('0x4')]+'%'};return _0x3d61a5;}})});}var _0x2934cc=[];var _0x166b4f=null;var _0x20e595={};if(_0x3307f9){_0x166b4f=_[_0x334f('0x8a')](_0x381e97,[_0x334f('0xc'),_0x3307f9['name']]);if(_0x166b4f[_0x334f('0x5')]){_0x20e595={};if(_0x53ea0b[_0x334f('0x12')]===_0x334f('0xf')){_0x20e595[_0x166b4f[_0x334f('0x9e')]]=_[_0x334f('0xa')](_0x3307f9[_0x334f('0x9')],'id');}else{_0x20e595[_0x166b4f[_0x334f('0x9e')]]=_0x3307f9[_0x334f('0x9')];}_0x2934cc[_0x334f('0x88')](_0x20e595);}else{_0x3c77f5[_0x334f('0x7c')]['id']=_0x3307f9['associatedResources'];}}else{for(var _0xf81a7d=0x0;_0xf81a7d<_0x5e216f[_0x334f('0x8e')];_0xf81a7d++){_0x166b4f=_[_0x334f('0x8a')](_0x381e97,[_0x334f('0xc'),_0x5e216f[_0xf81a7d][_0x334f('0xc')]]);if(_0x166b4f[_0x334f('0x5')]){_0x20e595={};_0x20e595[_0x166b4f[_0x334f('0x9e')]]=_0x5e216f[_0xf81a7d][_0x334f('0x9')];_0x2934cc[_0x334f('0x88')](_0x20e595);}else{if(!_0x3c77f5['where']['id'])_0x3c77f5[_0x334f('0x7c')]['id']=[];_0x5e216f[_0xf81a7d][_0x334f('0x9')][_0x334f('0x9f')](function(_0x299cac){_0x3c77f5[_0x334f('0x7c')]['id']['push'](_0x299cac);});}}}if(!_['isEmpty'](_0x2934cc)){_0x3c77f5[_0x334f('0x7c')]=_[_0x334f('0x9c')](_0x3c77f5[_0x334f('0x7c')],{'$and':{'$or':_0x2934cc}});}_0x3c77f5=_[_0x334f('0x9c')]({},_0x3c77f5,_0x360ca9[_0x334f('0xa0')]);if(_0x3307f9&&!_0x3307f9['autoAssociation']&&_0x53ea0b['childModel']==='AnalyticExtractedReport'){if(_0x360ca9[_0x334f('0x84')]['includeAll']){_0x3c77f5['include']=[{'all':!![]}];}return _0x17db30[_0x53ea0b[_0x334f('0x12')]][_0x334f('0x7')](_0x3c77f5)[_0x334f('0x8')](function(_0x1878d1){var _0x43f35a=[];_0x1878d1[_0x334f('0x9f')](function(_0x1178c5){var _0x2fb6d9;switch(_0x1178c5[_0x334f('0xa1')]){case _0x334f('0xa2'):_0x2fb6d9=_[_0x334f('0x8a')](_0x3307f9['associatedResources'],function(_0x236be9){return _0x236be9['id']===_0x1178c5[_0x334f('0x74')]&&_0x236be9[_0x334f('0x10')]===_0x334f('0xa3');});break;case _0x334f('0xa4'):_0x2fb6d9=_[_0x334f('0x8a')](_0x3307f9[_0x334f('0x9')],function(_0x696cc){return _0x696cc['id']===_0x1178c5[_0x334f('0x74')]&&_0x696cc[_0x334f('0x10')]===_0x334f('0xa5');});break;}if(_0x2fb6d9)_0x43f35a[_0x334f('0x88')](_0x1178c5);});_0x3de76a[_0x334f('0xa6')]=_0x43f35a[_0x334f('0x8e')];_0x3de76a[_0x334f('0xa7')]=_0x43f35a;return _0x3de76a;});}else{if(!_[_0x334f('0x87')](_0x360ca9[_0x334f('0x84')][_0x334f('0xa8')])){_0x3c77f5[_0x334f('0x7c')]['id']=_0x3c77f5[_0x334f('0x7c')]['id']?_[_0x334f('0x92')](_0x3c77f5['where']['id'],_0x360ca9[_0x334f('0x84')][_0x334f('0xa8')]):_0x360ca9[_0x334f('0x84')]['ids'];if(_0x360ca9[_0x334f('0x84')][_0x334f('0xa9')]){_0x3c77f5[_0x334f('0x98')]=_0x360ca9[_0x334f('0x84')]['customSorting'];}}if(_0x360ca9[_0x334f('0x84')][_0x334f('0xaa')]){_0x3c77f5[_0x334f('0x7c')]=_['merge'](_0x3c77f5['where'],{'$and':_0x360ca9[_0x334f('0x84')][_0x334f('0xaa')]});}return _0x17db30[_0x53ea0b[_0x334f('0x12')]]['count']({'where':_0x3c77f5['where']})['then'](function(_0x1650a7){_0x3de76a['count']=_0x1650a7;if(_0x360ca9[_0x334f('0x84')][_0x334f('0xab')]){if(_0x53ea0b['childModel']==='CmContact'){_0x3c77f5[_0x334f('0xac')]=[{'model':_0x17db30['Tag'],'as':_0x334f('0xad'),'attributes':['id',_0x334f('0xc'),_0x334f('0xae')],'required':_0x360ca9['query'][_0x334f('0xaf')]?!![]:![]},{'model':_0x17db30[_0x334f('0x6c')],'as':_0x334f('0xb0'),'attributes':['id','name',_0x334f('0xae')],'through':_0x360ca9['query'][_0x334f('0xaf')]?{'attributes':[],'where':{'TagId':_0x360ca9[_0x334f('0x84')]['tag']||undefined}}:{},'required':_0x360ca9['query'][_0x334f('0xaf')]?!![]:![]}];}else{_0x3c77f5[_0x334f('0xac')]=[{'all':!![]}];}}return _0x17db30[_0x53ea0b[_0x334f('0x12')]][_0x334f('0x7')](_0x3c77f5);})[_0x334f('0x8')](function(_0x16afa3){_0x3de76a[_0x334f('0xa7')]=_0x16afa3;if(_0xb3efc7===_0x334f('0x2e')&&_0x360ca9[_0x334f('0x84')][_0x334f('0xb1')]===_0x334f('0xb2')){var _0x48bf21=[];for(var _0x167278=0x0;_0x167278<_0x3de76a['rows'][_0x334f('0x8e')];_0x167278++){_0x48bf21[_0x334f('0x88')](_0x9b0318(_0x334f('0xb3'),_0x3de76a[_0x334f('0xa7')][_0x167278]['dataValues']));_0x48bf21['push'](_0x9b0318(_0x334f('0xb4'),_0x3de76a[_0x334f('0xa7')][_0x167278][_0x334f('0xb5')]));_0x48bf21[_0x334f('0x88')](_0x9b0318(_0x334f('0xb6'),_0x3de76a[_0x334f('0xa7')][_0x167278][_0x334f('0xb5')]));_0x48bf21['push'](_0x9b0318(_0x334f('0xb7'),_0x3de76a[_0x334f('0xa7')][_0x167278][_0x334f('0xb5')]));_0x48bf21['push'](_0x9b0318(_0x334f('0xb8'),_0x3de76a[_0x334f('0xa7')][_0x167278][_0x334f('0xb5')]));_0x48bf21[_0x334f('0x88')](_0x9b0318(_0x334f('0xb9'),_0x3de76a[_0x334f('0xa7')][_0x167278][_0x334f('0xb5')]));}return Promise[_0x334f('0x8c')](_0x48bf21)['then'](function(){return _0x3de76a;});}return _0x3de76a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5a98853..e9fd10d 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 _0x6337=['http','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x6337,0x18a));var _0x7633=function(_0x5ecaa8,_0x41361a){_0x5ecaa8=_0x5ecaa8-0x0;var _0x15f1f8=_0x6337[_0x5ecaa8];return _0x15f1f8;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require(_0x7633('0x3'));var fs=require('fs');var Redis=require(_0x7633('0x4'));var db=require(_0x7633('0x5'))['db'];var utils=require(_0x7633('0x6'));var logger=require(_0x7633('0x7'))(_0x7633('0x8'));var config=require('../../config/environment');var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});config['redis']=_[_0x7633('0xc')](config['redis'],{'host':_0x7633('0xd'),'port':0x18eb});var socket=require(_0x7633('0xe'))(new Redis(config['redis']));require(_0x7633('0xf'))['register'](socket);function respondWithRpcPromise(_0x35a196,_0x4c0f0a,_0x174d9f){return new BPromise(function(_0x2404e4,_0x59e518){return client[_0x7633('0x10')](_0x35a196,_0x174d9f)[_0x7633('0x11')](function(_0x332283){logger['info'](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));logger[_0x7633('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4c0f0a,_0x7633('0x13'),JSON[_0x7633('0x15')](_0x332283));if(_0x332283[_0x7633('0x16')]){if(_0x332283['error']['code']===0x1f4){logger['error'](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x59e518(_0x332283[_0x7633('0x16')][_0x7633('0x17')]);}logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x2404e4(_0x332283['error'][_0x7633('0x17')]);}else{logger[_0x7633('0x18')](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));_0x2404e4(_0x332283[_0x7633('0x19')]['message']);}})[_0x7633('0x1a')](function(_0x30b58b){logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x30b58b);_0x59e518(_0x30b58b);});});} \ No newline at end of file +var _0xca84=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','error','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca84,0xf5));var _0x4ca8=function(_0x2a568e,_0x4788b1){_0x2a568e=_0x2a568e-0x0;var _0xe1df87=_0xca84[_0x2a568e];return _0xe1df87;};'use strict';var _=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var moment=require(_0x4ca8('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ca8('0x3'));var fs=require('fs');var Redis=require(_0x4ca8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ca8('0x5'));var logger=require(_0x4ca8('0x6'))(_0x4ca8('0x7'));var config=require(_0x4ca8('0x8'));var jayson=require(_0x4ca8('0x9'));var client=jayson[_0x4ca8('0xa')][_0x4ca8('0xb')]({'port':0x232a});config[_0x4ca8('0xc')]=_[_0x4ca8('0xd')](config[_0x4ca8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ca8('0xe'))(new Redis(config['redis']));require(_0x4ca8('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f1198,_0x57db27,_0x41991d){return new BPromise(function(_0x53ffa,_0x3cc932){return client[_0x4ca8('0x10')](_0x2f1198,_0x41991d)[_0x4ca8('0x11')](function(_0x45e7d0){logger[_0x4ca8('0x12')]('UserProfile,\x20%s,\x20%s',_0x57db27,'request\x20sent');logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x57db27,_0x4ca8('0x13'),JSON['stringify'](_0x45e7d0));if(_0x45e7d0[_0x4ca8('0x14')]){if(_0x45e7d0[_0x4ca8('0x14')]['code']===0x1f4){logger['error'](_0x4ca8('0x15'),_0x57db27,_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);return _0x3cc932(_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);}logger[_0x4ca8('0x14')](_0x4ca8('0x15'),_0x57db27,_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);return _0x53ffa(_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);}else{logger[_0x4ca8('0x12')]('UserProfile,\x20%s,\x20%s',_0x57db27,_0x4ca8('0x13'));_0x53ffa(_0x45e7d0[_0x4ca8('0x17')][_0x4ca8('0x16')]);}})[_0x4ca8('0x18')](function(_0x28fe2b){logger['error'](_0x4ca8('0x15'),_0x57db27,_0x28fe2b);_0x3cc932(_0x28fe2b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index bce0100..681d68f 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 _0xb523=['save','remove','emit','removeListener','userProfile:','./userProfile.events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb523,0x19d));var _0x3b52=function(_0x23be66,_0x16d4b2){_0x23be66=_0x23be66-0x0;var _0x1bab88=_0xb523[_0x23be66];return _0x1bab88;};'use strict';var UserProfileEvents=require(_0x3b52('0x0'));var events=[_0x3b52('0x1'),_0x3b52('0x2'),'update'];function createListener(_0x315152,_0x43019d){return function(_0x5093fe){_0x43019d[_0x3b52('0x3')](_0x315152,_0x5093fe);};}function removeListener(_0x18c4ca,_0x174e6b){return function(){UserProfileEvents[_0x3b52('0x4')](_0x18c4ca,_0x174e6b);};}exports['register']=function(_0x4b964b){for(var _0x5d2f43=0x0,_0x5a77b4=events['length'];_0x5d2f43<_0x5a77b4;_0x5d2f43++){var _0xb5b6a5=events[_0x5d2f43];var _0x146323=createListener(_0x3b52('0x5')+_0xb5b6a5,_0x4b964b);UserProfileEvents['on'](_0xb5b6a5,_0x146323);}}; \ No newline at end of file +var _0x60c4=['update','emit','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x54e5da,_0xa15dc7){var _0x4136c5=function(_0x1b4e6a){while(--_0x1b4e6a){_0x54e5da['push'](_0x54e5da['shift']());}};_0x4136c5(++_0xa15dc7);}(_0x60c4,0x14d));var _0x460c=function(_0x466b69,_0x3f92ac){_0x466b69=_0x466b69-0x0;var _0x3624b9=_0x60c4[_0x466b69];return _0x3624b9;};'use strict';var UserProfileEvents=require(_0x460c('0x0'));var events=[_0x460c('0x1'),_0x460c('0x2'),_0x460c('0x3')];function createListener(_0x5e538c,_0x362d95){return function(_0x1f8b75){_0x362d95[_0x460c('0x4')](_0x5e538c,_0x1f8b75);};}function removeListener(_0x15d6b1,_0x430971){return function(){UserProfileEvents['removeListener'](_0x15d6b1,_0x430971);};}exports[_0x460c('0x5')]=function(_0x56fc06){for(var _0x44cafc=0x0,_0x4502b8=events[_0x460c('0x6')];_0x44cafc<_0x4502b8;_0x44cafc++){var _0x30a2a6=events[_0x44cafc];var _0x1e0301=createListener(_0x460c('0x7')+_0x30a2a6,_0x56fc06);UserProfileEvents['on'](_0x30a2a6,_0x1e0301);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6f3caab..8da0979 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 _0xb589=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','exports'];(function(_0x3ebbb7,_0x92ec16){var _0x54d44f=function(_0x33b25b){while(--_0x33b25b){_0x3ebbb7['push'](_0x3ebbb7['shift']());}};_0x54d44f(++_0x92ec16);}(_0xb589,0x1c8));var _0x9b58=function(_0x1ba4d1,_0x54fd0e){_0x1ba4d1=_0x1ba4d1-0x0;var _0x29a4a5=_0xb589[_0x1ba4d1];return _0x29a4a5;};'use strict';var multer=require(_0x9b58('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b58('0x1'));var express=require('express');var router=express[_0x9b58('0x2')]();var fs_extra=require(_0x9b58('0x3'));var auth=require(_0x9b58('0x4'));var interaction=require(_0x9b58('0x5'));var config=require('../../config/environment');var controller=require(_0x9b58('0x6'));router[_0x9b58('0x7')]('/',auth['isAuthenticated'](),controller[_0x9b58('0x8')]);router['get'](_0x9b58('0x9'),auth['isAuthenticated'](),controller[_0x9b58('0xa')]);router['get'](_0x9b58('0xb'),auth[_0x9b58('0xc')](),controller[_0x9b58('0xd')]);router[_0x9b58('0xe')]('/',auth[_0x9b58('0xc')](),controller['create']);router[_0x9b58('0xf')]('/:id',auth[_0x9b58('0xc')](),controller[_0x9b58('0x10')]);router[_0x9b58('0x11')](_0x9b58('0xb'),auth[_0x9b58('0xc')](),controller['destroy']);module[_0x9b58('0x12')]=router; \ No newline at end of file +var _0xd3a1=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x39875a,_0x353959){var _0x311ee2=function(_0x31200f){while(--_0x31200f){_0x39875a['push'](_0x39875a['shift']());}};_0x311ee2(++_0x353959);}(_0xd3a1,0x7e));var _0x1d3a=function(_0x316a7a,_0x2e8046){_0x316a7a=_0x316a7a-0x0;var _0x366254=_0xd3a1[_0x316a7a];return _0x366254;};'use strict';var multer=require(_0x1d3a('0x0'));var util=require(_0x1d3a('0x1'));var path=require(_0x1d3a('0x2'));var timeout=require(_0x1d3a('0x3'));var express=require(_0x1d3a('0x4'));var router=express[_0x1d3a('0x5')]();var fs_extra=require(_0x1d3a('0x6'));var auth=require(_0x1d3a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d3a('0x8'));var controller=require(_0x1d3a('0x9'));router[_0x1d3a('0xa')]('/',auth[_0x1d3a('0xb')](),controller[_0x1d3a('0xc')]);router[_0x1d3a('0xa')](_0x1d3a('0xd'),auth['isAuthenticated'](),controller[_0x1d3a('0xe')]);router[_0x1d3a('0xa')]('/:id',auth[_0x1d3a('0xb')](),controller[_0x1d3a('0xf')]);router[_0x1d3a('0x10')]('/',auth[_0x1d3a('0xb')](),controller[_0x1d3a('0x11')]);router[_0x1d3a('0x12')](_0x1d3a('0x13'),auth[_0x1d3a('0xb')](),controller[_0x1d3a('0x14')]);router[_0x1d3a('0x15')]('/:id',auth[_0x1d3a('0xb')](),controller[_0x1d3a('0x16')]);module[_0x1d3a('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f180ad1..b6c37e8 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 _0x8c6d=['INTEGER','sequelize','exports','STRING'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x8c6d,0x189));var _0xd8c6=function(_0x39a09b,_0x1d355e){_0x39a09b=_0x39a09b-0x0;var _0x4b8db4=_0x8c6d[_0x39a09b];return _0x4b8db4;};'use strict';var Sequelize=require(_0xd8c6('0x0'));module[_0xd8c6('0x1')]={'name':{'type':Sequelize[_0xd8c6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd8c6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd8c6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd0e5=['INTEGER','sequelize','exports','STRING'];(function(_0x3599b4,_0x390be0){var _0x6e522=function(_0x3821e5){while(--_0x3821e5){_0x3599b4['push'](_0x3599b4['shift']());}};_0x6e522(++_0x390be0);}(_0xd0e5,0x91));var _0x5d0e=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xd0e5[_0x515afd];return _0x536d53;};'use strict';var Sequelize=require(_0x5d0e('0x0'));module[_0x5d0e('0x1')]={'name':{'type':Sequelize[_0x5d0e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5d0e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5d0e('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 5809dc8..7f3f81e 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x346b9e,_0x212837){var _0x330b9f=function(_0x2aa7dc){while(--_0x2aa7dc){_0x346b9e['push'](_0x346b9e['shift']());}};_0x330b9f(++_0x212837);}(_0x4975,0x86));var _0x5497=function(_0x367618,_0x392942){_0x367618=_0x367618-0x0;var _0x512471=_0x4975[_0x367618];return _0x512471;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x687b,0x14a));var _0xb687=function(_0xd45112,_0x68c8b4){_0xd45112=_0xd45112-0x0;var _0x2cddb8=_0x687b[_0xd45112];return _0x2cddb8;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8561706..2cdd0a7 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 _0x67b3=['moment','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api'];(function(_0x3f7694,_0x4976c2){var _0x5db782=function(_0x24e7b6){while(--_0x24e7b6){_0x3f7694['push'](_0x3f7694['shift']());}};_0x5db782(++_0x4976c2);}(_0x67b3,0xb2));var _0x367b=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x67b3[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0x367b('0x0'));var logger=require('../../config/logger')(_0x367b('0x1'));var moment=require(_0x367b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x367b('0x3'));var rimraf=require(_0x367b('0x4'));var config=require(_0x367b('0x5'));var attributes=require(_0x367b('0x6'));module['exports']=function(_0x4383f6,_0x21a0fc){return _0x4383f6['define'](_0x367b('0x7'),attributes,{'tableName':_0x367b('0x8'),'paranoid':![],'indexes':[{'name':_0x367b('0x9'),'fields':[_0x367b('0xa'),_0x367b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x210e=['sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','compositeIndex','resourceId'];(function(_0x5d6c57,_0x383fbf){var _0x4ca305=function(_0x18f18b){while(--_0x18f18b){_0x5d6c57['push'](_0x5d6c57['shift']());}};_0x4ca305(++_0x383fbf);}(_0x210e,0x1ae));var _0xe210=function(_0x59481b,_0x4c7624){_0x59481b=_0x59481b-0x0;var _0x55e559=_0x210e[_0x59481b];return _0x55e559;};'use strict';var _=require('lodash');var util=require(_0xe210('0x0'));var logger=require(_0xe210('0x1'))(_0xe210('0x2'));var moment=require(_0xe210('0x3'));var BPromise=require(_0xe210('0x4'));var rp=require(_0xe210('0x5'));var fs=require('fs');var path=require(_0xe210('0x6'));var rimraf=require(_0xe210('0x7'));var config=require('../../config/environment');var attributes=require(_0xe210('0x8'));module[_0xe210('0x9')]=function(_0x5b3164,_0xdab797){return _0x5b3164['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe210('0xa'),'fields':[_0xe210('0xb'),_0xe210('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index db8beed..09f2ba5 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 _0x9612=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2d892a,_0x59e61a){var _0x367765=function(_0x1c9901){while(--_0x1c9901){_0x2d892a['push'](_0x2d892a['shift']());}};_0x367765(++_0x59e61a);}(_0x9612,0x152));var _0x2961=function(_0x4e17bc,_0x1e7f79){_0x4e17bc=_0x4e17bc-0x0;var _0x309bd9=_0x9612[_0x4e17bc];return _0x309bd9;};'use strict';var _=require(_0x2961('0x0'));var util=require(_0x2961('0x1'));var moment=require(_0x2961('0x2'));var BPromise=require(_0x2961('0x3'));var rs=require(_0x2961('0x4'));var fs=require('fs');var Redis=require(_0x2961('0x5'));var db=require(_0x2961('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2961('0x7'))(_0x2961('0x8'));var config=require('../../config/environment');var jayson=require(_0x2961('0x9'));var client=jayson[_0x2961('0xa')][_0x2961('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7490,_0x568970,_0x53ae5b){return new BPromise(function(_0x541aae,_0x2e0845){return client[_0x2961('0xc')](_0x3a7490,_0x53ae5b)[_0x2961('0xd')](function(_0x4a6999){logger[_0x2961('0xe')](_0x2961('0xf'),_0x568970,_0x2961('0x10'));logger[_0x2961('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x568970,_0x2961('0x10'),JSON[_0x2961('0x12')](_0x4a6999));if(_0x4a6999[_0x2961('0x13')]){if(_0x4a6999[_0x2961('0x13')][_0x2961('0x14')]===0x1f4){logger[_0x2961('0x13')](_0x2961('0xf'),_0x568970,_0x4a6999[_0x2961('0x13')][_0x2961('0x15')]);return _0x2e0845(_0x4a6999[_0x2961('0x13')][_0x2961('0x15')]);}logger[_0x2961('0x13')](_0x2961('0xf'),_0x568970,_0x4a6999[_0x2961('0x13')]['message']);return _0x541aae(_0x4a6999['error'][_0x2961('0x15')]);}else{logger[_0x2961('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x568970,_0x2961('0x10'));_0x541aae(_0x4a6999[_0x2961('0x16')]['message']);}})[_0x2961('0x17')](function(_0x4a30ad){logger[_0x2961('0x13')](_0x2961('0xf'),_0x568970,_0x4a30ad);_0x2e0845(_0x4a30ad);});});} \ No newline at end of file +var _0xd4df=['stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x382e13,_0x48e959){var _0x41b5cd=function(_0x4fd2e8){while(--_0x4fd2e8){_0x382e13['push'](_0x382e13['shift']());}};_0x41b5cd(++_0x48e959);}(_0xd4df,0x1a8));var _0xfd4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4df[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfd4d('0x0'));var util=require('util');var moment=require(_0xfd4d('0x1'));var BPromise=require(_0xfd4d('0x2'));var rs=require(_0xfd4d('0x3'));var fs=require('fs');var Redis=require(_0xfd4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd4d('0x5'))('rpc');var config=require(_0xfd4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd4d('0x7')][_0xfd4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x225576,_0x9b5085,_0x171451){return new BPromise(function(_0x45c4ae,_0x2ec57d){return client['request'](_0x225576,_0x171451)['then'](function(_0x107b0a){logger['info'](_0xfd4d('0x9'),_0x9b5085,_0xfd4d('0xa'));logger[_0xfd4d('0xb')](_0xfd4d('0xc'),_0x9b5085,'request\x20sent',JSON[_0xfd4d('0xd')](_0x107b0a));if(_0x107b0a[_0xfd4d('0xe')]){if(_0x107b0a['error'][_0xfd4d('0xf')]===0x1f4){logger['error'](_0xfd4d('0x9'),_0x9b5085,_0x107b0a[_0xfd4d('0xe')][_0xfd4d('0x10')]);return _0x2ec57d(_0x107b0a[_0xfd4d('0xe')][_0xfd4d('0x10')]);}logger['error'](_0xfd4d('0x9'),_0x9b5085,_0x107b0a[_0xfd4d('0xe')][_0xfd4d('0x10')]);return _0x45c4ae(_0x107b0a[_0xfd4d('0xe')][_0xfd4d('0x10')]);}else{logger[_0xfd4d('0x11')](_0xfd4d('0x9'),_0x9b5085,'request\x20sent');_0x45c4ae(_0x107b0a[_0xfd4d('0x12')]['message']);}})['catch'](function(_0x15aa42){logger[_0xfd4d('0xe')](_0xfd4d('0x9'),_0x9b5085,_0x15aa42);_0x2ec57d(_0x15aa42);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 756530d..9a0b733 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 _0xd4a3=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy'];(function(_0xf36008,_0x28e1aa){var _0x534b4c=function(_0x34ea90){while(--_0x34ea90){_0xf36008['push'](_0xf36008['shift']());}};_0x534b4c(++_0x28e1aa);}(_0xd4a3,0xa1));var _0x3d4a=function(_0x4b0b8c,_0x37022d){_0x4b0b8c=_0x4b0b8c-0x0;var _0x3f55a2=_0xd4a3[_0x4b0b8c];return _0x3f55a2;};'use strict';var multer=require(_0x3d4a('0x0'));var util=require(_0x3d4a('0x1'));var path=require('path');var timeout=require(_0x3d4a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d4a('0x3'));var auth=require(_0x3d4a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d4a('0x5'));var controller=require(_0x3d4a('0x6'));router[_0x3d4a('0x7')]('/',auth[_0x3d4a('0x8')](),controller[_0x3d4a('0x9')]);router['get'](_0x3d4a('0xa'),auth[_0x3d4a('0x8')](),controller[_0x3d4a('0xb')]);router[_0x3d4a('0x7')]('/:id',auth[_0x3d4a('0x8')](),controller[_0x3d4a('0xc')]);router['post']('/',auth[_0x3d4a('0x8')](),controller[_0x3d4a('0xd')]);router[_0x3d4a('0xe')](_0x3d4a('0xf'),auth[_0x3d4a('0x8')](),controller[_0x3d4a('0x10')]);router[_0x3d4a('0x11')](_0x3d4a('0xf'),auth[_0x3d4a('0x8')](),controller[_0x3d4a('0x12')]);module[_0x3d4a('0x13')]=router; \ No newline at end of file +var _0xe8a8=['describe','/:id','show','post','put','delete','destroy','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated'];(function(_0xd1c389,_0x4bf1bf){var _0x584457=function(_0x27f064){while(--_0x27f064){_0xd1c389['push'](_0xd1c389['shift']());}};_0x584457(++_0x4bf1bf);}(_0xe8a8,0x6d));var _0x8e8a=function(_0x27384a,_0x102ead){_0x27384a=_0x27384a-0x0;var _0x3856fe=_0xe8a8[_0x27384a];return _0x3856fe;};'use strict';var multer=require('multer');var util=require(_0x8e8a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e8a('0x1'));var router=express[_0x8e8a('0x2')]();var fs_extra=require(_0x8e8a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8e8a('0x4'));var config=require(_0x8e8a('0x5'));var controller=require(_0x8e8a('0x6'));router[_0x8e8a('0x7')]('/',auth['isAuthenticated'](),controller[_0x8e8a('0x8')]);router[_0x8e8a('0x7')]('/describe',auth[_0x8e8a('0x9')](),controller[_0x8e8a('0xa')]);router[_0x8e8a('0x7')](_0x8e8a('0xb'),auth[_0x8e8a('0x9')](),controller[_0x8e8a('0xc')]);router[_0x8e8a('0xd')]('/',auth[_0x8e8a('0x9')](),controller['create']);router[_0x8e8a('0xe')](_0x8e8a('0xb'),auth[_0x8e8a('0x9')](),controller['update']);router[_0x8e8a('0xf')](_0x8e8a('0xb'),auth['isAuthenticated'](),controller[_0x8e8a('0x10')]);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 2a2e1c4..b6985e6 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 _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xc9d64b,_0x134ecd){_0xc9d64b=_0xc9d64b-0x0;var _0x2e2e76=_0xd4f4[_0xc9d64b];return _0x2e2e76;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file +var _0xfef3=['sequelize','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x83531b,_0x5daca6){var _0x3696f2=function(_0x368b38){while(--_0x368b38){_0x83531b['push'](_0x83531b['shift']());}};_0x3696f2(++_0x5daca6);}(_0xfef3,0x118));var _0x3fef=function(_0x296b3c,_0x203828){_0x296b3c=_0x296b3c-0x0;var _0x53adfa=_0xfef3[_0x296b3c];return _0x53adfa;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3fef('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3fef('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3fef('0x1')],'set':function(_0x3b71e5){this['setDataValue'](_0x3fef('0x4'),_0x3b71e5?_0x3b71e5[_0x3fef('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3fef('0x4'))?this[_0x3fef('0x6')](_0x3fef('0x4'))[_0x3fef('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0962b0f..2ff18c3 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 _0xc482=['limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','UserProfileSection','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','keys','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4b9f92,_0x486261){var _0x4e9616=function(_0x598daa){while(--_0x598daa){_0x4b9f92['push'](_0x4b9f92['shift']());}};_0x4e9616(++_0x486261);}(_0xc482,0x10d));var _0x2c48=function(_0x426e82,_0x2e1758){_0x426e82=_0x426e82-0x0;var _0x3db1f0=_0xc482[_0x426e82];return _0x3db1f0;};'use strict';var emlformat=require(_0x2c48('0x0'));var rimraf=require(_0x2c48('0x1'));var zipdir=require(_0x2c48('0x2'));var jsonpatch=require(_0x2c48('0x3'));var rp=require(_0x2c48('0x4'));var moment=require('moment');var BPromise=require(_0x2c48('0x5'));var Mustache=require('mustache');var util=require(_0x2c48('0x6'));var path=require(_0x2c48('0x7'));var sox=require('sox');var csv=require(_0x2c48('0x8'));var ejs=require(_0x2c48('0x9'));var fs=require('fs');var fs_extra=require(_0x2c48('0xa'));var _=require('lodash');var squel=require(_0x2c48('0xb'));var crypto=require(_0x2c48('0xc'));var jsforce=require(_0x2c48('0xd'));var deskjs=require(_0x2c48('0xe'));var toCsv=require(_0x2c48('0x8'));var querystring=require(_0x2c48('0xf'));var Papa=require(_0x2c48('0x10'));var Redis=require(_0x2c48('0x11'));var authService=require(_0x2c48('0x12'));var qs=require(_0x2c48('0x13'));var as=require(_0x2c48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c48('0x15'))('api');var utils=require(_0x2c48('0x16'));var config=require(_0x2c48('0x17'));var licenseUtil=require(_0x2c48('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd8b8,_0x4bf5e8){_0x4bf5e8=_0x4bf5e8||0xcc;return function(_0x50ae3b){if(_0x50ae3b){return _0x3dd8b8[_0x2c48('0x19')](_0x4bf5e8);}return _0x3dd8b8[_0x2c48('0x1a')](_0x4bf5e8)[_0x2c48('0x1b')]();};}function respondWithResult(_0x46934b,_0x326418){_0x326418=_0x326418||0xc8;return function(_0x2e2b6d){if(_0x2e2b6d){return _0x46934b[_0x2c48('0x1a')](_0x326418)[_0x2c48('0x1c')](_0x2e2b6d);}};}function respondWithFilteredResult(_0xbe5647,_0xf60394){return function(_0x1a31f2){if(_0x1a31f2){var _0x36d435=typeof _0xf60394[_0x2c48('0x1d')]===_0x2c48('0x1e')&&typeof _0xf60394[_0x2c48('0x1f')]===_0x2c48('0x1e');var _0x1a9f4e=_0x1a31f2['count'];var _0x1caa71=_0x36d435?0x0:_0xf60394[_0x2c48('0x1d')];var _0xac0f0a=_0x36d435?_0x1a31f2[_0x2c48('0x20')]:_0xf60394[_0x2c48('0x1d')]+_0xf60394[_0x2c48('0x1f')];var _0x34bc51;if(_0xac0f0a>=_0x1a9f4e){_0xac0f0a=_0x1a9f4e;_0x34bc51=0xc8;}else{_0x34bc51=0xce;}_0xbe5647[_0x2c48('0x1a')](_0x34bc51);return _0xbe5647[_0x2c48('0x21')](_0x2c48('0x22'),_0x1caa71+'-'+_0xac0f0a+'/'+_0x1a9f4e)['json'](_0x1a31f2);}return null;};}function patchUpdates(_0x4f9262){return function(_0x39e354){try{jsonpatch[_0x2c48('0x23')](_0x39e354,_0x4f9262,!![]);}catch(_0x31ba0){return BPromise[_0x2c48('0x24')](_0x31ba0);}return _0x39e354[_0x2c48('0x25')]();};}function saveUpdates(_0x2bca0a,_0xcc7fb9){return function(_0x3dc84d){if(_0x3dc84d){return _0x3dc84d['update'](_0x2bca0a)[_0x2c48('0x26')](function(_0x5d1f7b){return _0x5d1f7b;});}return null;};}function removeEntity(_0x139b45,_0x38a740){return function(_0x403d4a){if(_0x403d4a){return _0x403d4a['destroy']()[_0x2c48('0x26')](function(){_0x139b45[_0x2c48('0x1a')](0xcc)[_0x2c48('0x1b')]();});}};}function handleEntityNotFound(_0x2f7d55,_0x5035b6){return function(_0x59ed8f){if(!_0x59ed8f){_0x2f7d55['sendStatus'](0x194);}return _0x59ed8f;};}function handleError(_0xc9d3c8,_0x4f200a){_0x4f200a=_0x4f200a||0x1f4;return function(_0x5a2c96){logger[_0x2c48('0x27')](_0x5a2c96[_0x2c48('0x28')]);if(_0x5a2c96[_0x2c48('0x29')]){delete _0x5a2c96[_0x2c48('0x29')];}_0xc9d3c8['status'](_0x4f200a)['send'](_0x5a2c96);};}exports['index']=function(_0x5a3c29,_0x1a0508){var _0x303d0c={},_0x1ed0d9={},_0x2e4613={'count':0x0,'rows':[]};var _0x2fff37=_['map'](db[_0x2c48('0x2a')][_0x2c48('0x2b')],function(_0xbebe6d){return{'name':_0xbebe6d[_0x2c48('0x2c')],'type':_0xbebe6d['type']['key']};});_0x1ed0d9[_0x2c48('0x2d')]=_[_0x2c48('0x2e')](_0x2fff37,_0x2c48('0x29'));_0x1ed0d9[_0x2c48('0x2f')]=_['keys'](_0x5a3c29[_0x2c48('0x2f')]);_0x1ed0d9[_0x2c48('0x30')]=_['intersection'](_0x1ed0d9[_0x2c48('0x2d')],_0x1ed0d9[_0x2c48('0x2f')]);_0x303d0c[_0x2c48('0x31')]=_[_0x2c48('0x32')](_0x1ed0d9[_0x2c48('0x2d')],qs[_0x2c48('0x33')](_0x5a3c29[_0x2c48('0x2f')][_0x2c48('0x33')]));_0x303d0c['attributes']=_0x303d0c[_0x2c48('0x31')][_0x2c48('0x34')]?_0x303d0c[_0x2c48('0x31')]:_0x1ed0d9[_0x2c48('0x2d')];if(!_0x5a3c29['query'][_0x2c48('0x35')](_0x2c48('0x36'))){_0x303d0c[_0x2c48('0x1f')]=qs[_0x2c48('0x1f')](_0x5a3c29[_0x2c48('0x2f')][_0x2c48('0x1f')]);_0x303d0c[_0x2c48('0x1d')]=qs['offset'](_0x5a3c29[_0x2c48('0x2f')][_0x2c48('0x1d')]);}_0x303d0c[_0x2c48('0x37')]=qs[_0x2c48('0x38')](_0x5a3c29['query']['sort']);_0x303d0c[_0x2c48('0x39')]=qs[_0x2c48('0x30')](_[_0x2c48('0x3a')](_0x5a3c29['query'],_0x1ed0d9[_0x2c48('0x30')]),_0x2fff37);if(_0x5a3c29[_0x2c48('0x2f')][_0x2c48('0x3b')]){_0x303d0c[_0x2c48('0x39')]=_[_0x2c48('0x3c')](_0x303d0c['where'],{'$or':_['map'](_0x2fff37,function(_0x1b511e){if(_0x1b511e[_0x2c48('0x3d')]!==_0x2c48('0x3e')){var _0x3bbd6a={};_0x3bbd6a[_0x1b511e['name']]={'$like':'%'+_0x5a3c29[_0x2c48('0x2f')]['filter']+'%'};return _0x3bbd6a;}})});}_0x303d0c=_[_0x2c48('0x3c')]({},_0x303d0c,_0x5a3c29['options']);var _0x22a0a5={'where':_0x303d0c['where']};return db['UserProfileSection'][_0x2c48('0x20')](_0x22a0a5)[_0x2c48('0x26')](function(_0x2322ed){_0x2e4613[_0x2c48('0x20')]=_0x2322ed;if(_0x5a3c29[_0x2c48('0x2f')]['includeAll']){_0x303d0c[_0x2c48('0x3f')]=[{'all':!![]}];}return db[_0x2c48('0x2a')]['findAll'](_0x303d0c);})[_0x2c48('0x26')](function(_0x34aad2){_0x2e4613[_0x2c48('0x40')]=_0x34aad2;return _0x2e4613;})[_0x2c48('0x26')](respondWithFilteredResult(_0x1a0508,_0x303d0c))[_0x2c48('0x41')](handleError(_0x1a0508,null));};exports[_0x2c48('0x42')]=function(_0x3041ec,_0x37eba7){var _0x11570e={'raw':![],'where':{'id':_0x3041ec[_0x2c48('0x43')]['id']}},_0x4cf5df={};_0x4cf5df['model']=_[_0x2c48('0x44')](db[_0x2c48('0x2a')][_0x2c48('0x2b')]);_0x4cf5df[_0x2c48('0x2f')]=_[_0x2c48('0x44')](_0x3041ec[_0x2c48('0x2f')]);_0x4cf5df[_0x2c48('0x30')]=_[_0x2c48('0x32')](_0x4cf5df[_0x2c48('0x2d')],_0x4cf5df['query']);_0x11570e[_0x2c48('0x31')]=_[_0x2c48('0x32')](_0x4cf5df[_0x2c48('0x2d')],qs[_0x2c48('0x33')](_0x3041ec['query'][_0x2c48('0x33')]));_0x11570e[_0x2c48('0x31')]=_0x11570e[_0x2c48('0x31')][_0x2c48('0x34')]?_0x11570e[_0x2c48('0x31')]:_0x4cf5df[_0x2c48('0x2d')];if(_0x3041ec[_0x2c48('0x2f')]['includeAll']){_0x11570e[_0x2c48('0x3f')]=[{'all':!![]}];}_0x11570e=_[_0x2c48('0x3c')]({},_0x11570e,_0x3041ec[_0x2c48('0x45')]);return db[_0x2c48('0x2a')][_0x2c48('0x46')](_0x11570e)[_0x2c48('0x26')](handleEntityNotFound(_0x37eba7,null))[_0x2c48('0x26')](respondWithResult(_0x37eba7,null))[_0x2c48('0x41')](handleError(_0x37eba7,null));};exports[_0x2c48('0x47')]=function(_0x2b2702,_0x15ecdf){return db[_0x2c48('0x2a')]['create'](_0x2b2702[_0x2c48('0x48')],{})['then'](respondWithResult(_0x15ecdf,0xc9))[_0x2c48('0x41')](handleError(_0x15ecdf,null));};exports[_0x2c48('0x49')]=function(_0x1541a9,_0x56e16f){if(_0x1541a9[_0x2c48('0x48')]['id']){delete _0x1541a9[_0x2c48('0x48')]['id'];}return db[_0x2c48('0x2a')]['find']({'where':{'id':_0x1541a9[_0x2c48('0x43')]['id']}})[_0x2c48('0x26')](handleEntityNotFound(_0x56e16f,null))[_0x2c48('0x26')](saveUpdates(_0x1541a9['body'],null))[_0x2c48('0x26')](respondWithResult(_0x56e16f,null))[_0x2c48('0x41')](handleError(_0x56e16f,null));};exports['destroy']=function(_0x51bc59,_0x367092){return db['UserProfileSection'][_0x2c48('0x46')]({'where':{'id':_0x51bc59[_0x2c48('0x43')]['id']}})['then'](handleEntityNotFound(_0x367092,null))[_0x2c48('0x26')](removeEntity(_0x367092,null))[_0x2c48('0x41')](handleError(_0x367092,null));};exports[_0x2c48('0x4a')]=function(_0x1d8345,_0x16d055){return db[_0x2c48('0x2a')][_0x2c48('0x4a')]()[_0x2c48('0x26')](respondWithResult(_0x16d055,null))[_0x2c48('0x41')](handleError(_0x16d055,null));}; \ No newline at end of file +var _0xe73f=['filter','merge','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','UserProfileSection','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x373338,_0x382ef5){var _0x2a3b06=function(_0x5b172d){while(--_0x5b172d){_0x373338['push'](_0x373338['shift']());}};_0x2a3b06(++_0x382ef5);}(_0xe73f,0x1a5));var _0xfe73=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe73f[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe73('0x0'));var zipdir=require(_0xfe73('0x1'));var jsonpatch=require(_0xfe73('0x2'));var rp=require(_0xfe73('0x3'));var moment=require(_0xfe73('0x4'));var BPromise=require(_0xfe73('0x5'));var Mustache=require(_0xfe73('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfe73('0x7'));var csv=require(_0xfe73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe73('0x9'));var _=require('lodash');var squel=require(_0xfe73('0xa'));var crypto=require(_0xfe73('0xb'));var jsforce=require(_0xfe73('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfe73('0x8'));var querystring=require(_0xfe73('0xd'));var Papa=require(_0xfe73('0xe'));var Redis=require(_0xfe73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfe73('0x10'));var as=require(_0xfe73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe73('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfe73('0x13'));var licenseUtil=require(_0xfe73('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cba0b,_0x10fff1){_0x10fff1=_0x10fff1||0xcc;return function(_0x51d8db){if(_0x51d8db){return _0x5cba0b[_0xfe73('0x15')](_0x10fff1);}return _0x5cba0b[_0xfe73('0x16')](_0x10fff1)[_0xfe73('0x17')]();};}function respondWithResult(_0x43ed2f,_0x565803){_0x565803=_0x565803||0xc8;return function(_0x1c76c5){if(_0x1c76c5){return _0x43ed2f['status'](_0x565803)[_0xfe73('0x18')](_0x1c76c5);}};}function respondWithFilteredResult(_0xa3df17,_0x3f0c32){return function(_0x2eb0ee){if(_0x2eb0ee){var _0x4fc321=typeof _0x3f0c32[_0xfe73('0x19')]===_0xfe73('0x1a')&&typeof _0x3f0c32[_0xfe73('0x1b')]===_0xfe73('0x1a');var _0x1dc9ee=_0x2eb0ee[_0xfe73('0x1c')];var _0x30bfc6=_0x4fc321?0x0:_0x3f0c32[_0xfe73('0x19')];var _0x2caaf3=_0x4fc321?_0x2eb0ee[_0xfe73('0x1c')]:_0x3f0c32[_0xfe73('0x19')]+_0x3f0c32[_0xfe73('0x1b')];var _0x35a3fe;if(_0x2caaf3>=_0x1dc9ee){_0x2caaf3=_0x1dc9ee;_0x35a3fe=0xc8;}else{_0x35a3fe=0xce;}_0xa3df17['status'](_0x35a3fe);return _0xa3df17[_0xfe73('0x1d')](_0xfe73('0x1e'),_0x30bfc6+'-'+_0x2caaf3+'/'+_0x1dc9ee)[_0xfe73('0x18')](_0x2eb0ee);}return null;};}function patchUpdates(_0x3271b0){return function(_0x2418d7){try{jsonpatch['apply'](_0x2418d7,_0x3271b0,!![]);}catch(_0xf351a3){return BPromise[_0xfe73('0x1f')](_0xf351a3);}return _0x2418d7['save']();};}function saveUpdates(_0x48e20e,_0x194429){return function(_0x13bdd4){if(_0x13bdd4){return _0x13bdd4[_0xfe73('0x20')](_0x48e20e)[_0xfe73('0x21')](function(_0x55391d){return _0x55391d;});}return null;};}function removeEntity(_0x41aa8c,_0x1ae3b9){return function(_0x3ef505){if(_0x3ef505){return _0x3ef505[_0xfe73('0x22')]()['then'](function(){_0x41aa8c[_0xfe73('0x16')](0xcc)[_0xfe73('0x17')]();});}};}function handleEntityNotFound(_0x36ba15,_0x3c3209){return function(_0xe3df6f){if(!_0xe3df6f){_0x36ba15[_0xfe73('0x15')](0x194);}return _0xe3df6f;};}function handleError(_0x3b85ca,_0x482438){_0x482438=_0x482438||0x1f4;return function(_0x32e5c9){logger[_0xfe73('0x23')](_0x32e5c9[_0xfe73('0x24')]);if(_0x32e5c9[_0xfe73('0x25')]){delete _0x32e5c9[_0xfe73('0x25')];}_0x3b85ca[_0xfe73('0x16')](_0x482438)[_0xfe73('0x26')](_0x32e5c9);};}exports['index']=function(_0x5005c6,_0x3be878){var _0x2f76f4={},_0x492ed2={},_0x520cdb={'count':0x0,'rows':[]};var _0x4cd756=_[_0xfe73('0x27')](db[_0xfe73('0x28')]['rawAttributes'],function(_0x5d0f0b){return{'name':_0x5d0f0b['fieldName'],'type':_0x5d0f0b[_0xfe73('0x29')]['key']};});_0x492ed2[_0xfe73('0x2a')]=_[_0xfe73('0x27')](_0x4cd756,_0xfe73('0x25'));_0x492ed2[_0xfe73('0x2b')]=_[_0xfe73('0x2c')](_0x5005c6['query']);_0x492ed2[_0xfe73('0x2d')]=_[_0xfe73('0x2e')](_0x492ed2['model'],_0x492ed2[_0xfe73('0x2b')]);_0x2f76f4[_0xfe73('0x2f')]=_[_0xfe73('0x2e')](_0x492ed2['model'],qs[_0xfe73('0x30')](_0x5005c6['query'][_0xfe73('0x30')]));_0x2f76f4[_0xfe73('0x2f')]=_0x2f76f4[_0xfe73('0x2f')][_0xfe73('0x31')]?_0x2f76f4[_0xfe73('0x2f')]:_0x492ed2[_0xfe73('0x2a')];if(!_0x5005c6['query'][_0xfe73('0x32')](_0xfe73('0x33'))){_0x2f76f4[_0xfe73('0x1b')]=qs['limit'](_0x5005c6['query'][_0xfe73('0x1b')]);_0x2f76f4[_0xfe73('0x19')]=qs[_0xfe73('0x19')](_0x5005c6[_0xfe73('0x2b')][_0xfe73('0x19')]);}_0x2f76f4['order']=qs['sort'](_0x5005c6['query'][_0xfe73('0x34')]);_0x2f76f4[_0xfe73('0x35')]=qs[_0xfe73('0x2d')](_[_0xfe73('0x36')](_0x5005c6[_0xfe73('0x2b')],_0x492ed2[_0xfe73('0x2d')]),_0x4cd756);if(_0x5005c6['query'][_0xfe73('0x37')]){_0x2f76f4[_0xfe73('0x35')]=_[_0xfe73('0x38')](_0x2f76f4[_0xfe73('0x35')],{'$or':_[_0xfe73('0x27')](_0x4cd756,function(_0x10325c){if(_0x10325c[_0xfe73('0x29')]!=='VIRTUAL'){var _0x48401e={};_0x48401e[_0x10325c[_0xfe73('0x25')]]={'$like':'%'+_0x5005c6[_0xfe73('0x2b')][_0xfe73('0x37')]+'%'};return _0x48401e;}})});}_0x2f76f4=_[_0xfe73('0x38')]({},_0x2f76f4,_0x5005c6[_0xfe73('0x39')]);var _0x2a6096={'where':_0x2f76f4[_0xfe73('0x35')]};return db[_0xfe73('0x28')][_0xfe73('0x1c')](_0x2a6096)[_0xfe73('0x21')](function(_0x3dcb71){_0x520cdb[_0xfe73('0x1c')]=_0x3dcb71;if(_0x5005c6['query'][_0xfe73('0x3a')]){_0x2f76f4['include']=[{'all':!![]}];}return db[_0xfe73('0x28')]['findAll'](_0x2f76f4);})['then'](function(_0x200c25){_0x520cdb['rows']=_0x200c25;return _0x520cdb;})[_0xfe73('0x21')](respondWithFilteredResult(_0x3be878,_0x2f76f4))[_0xfe73('0x3b')](handleError(_0x3be878,null));};exports[_0xfe73('0x3c')]=function(_0x41901c,_0x49546c){var _0x58e71b={'raw':![],'where':{'id':_0x41901c[_0xfe73('0x3d')]['id']}},_0x2da28b={};_0x2da28b['model']=_[_0xfe73('0x2c')](db[_0xfe73('0x28')][_0xfe73('0x3e')]);_0x2da28b['query']=_[_0xfe73('0x2c')](_0x41901c[_0xfe73('0x2b')]);_0x2da28b[_0xfe73('0x2d')]=_[_0xfe73('0x2e')](_0x2da28b[_0xfe73('0x2a')],_0x2da28b[_0xfe73('0x2b')]);_0x58e71b[_0xfe73('0x2f')]=_[_0xfe73('0x2e')](_0x2da28b[_0xfe73('0x2a')],qs[_0xfe73('0x30')](_0x41901c[_0xfe73('0x2b')][_0xfe73('0x30')]));_0x58e71b[_0xfe73('0x2f')]=_0x58e71b[_0xfe73('0x2f')][_0xfe73('0x31')]?_0x58e71b[_0xfe73('0x2f')]:_0x2da28b['model'];if(_0x41901c[_0xfe73('0x2b')]['includeAll']){_0x58e71b[_0xfe73('0x3f')]=[{'all':!![]}];}_0x58e71b=_['merge']({},_0x58e71b,_0x41901c['options']);return db['UserProfileSection'][_0xfe73('0x40')](_0x58e71b)[_0xfe73('0x21')](handleEntityNotFound(_0x49546c,null))[_0xfe73('0x21')](respondWithResult(_0x49546c,null))['catch'](handleError(_0x49546c,null));};exports[_0xfe73('0x41')]=function(_0x2f4543,_0x3b0a26){return db['UserProfileSection']['create'](_0x2f4543[_0xfe73('0x42')],{})[_0xfe73('0x21')](respondWithResult(_0x3b0a26,0xc9))[_0xfe73('0x3b')](handleError(_0x3b0a26,null));};exports[_0xfe73('0x20')]=function(_0xf3e1aa,_0x4c401d){if(_0xf3e1aa[_0xfe73('0x42')]['id']){delete _0xf3e1aa[_0xfe73('0x42')]['id'];}return db[_0xfe73('0x28')]['find']({'where':{'id':_0xf3e1aa[_0xfe73('0x3d')]['id']}})[_0xfe73('0x21')](handleEntityNotFound(_0x4c401d,null))['then'](saveUpdates(_0xf3e1aa[_0xfe73('0x42')],null))[_0xfe73('0x21')](respondWithResult(_0x4c401d,null))['catch'](handleError(_0x4c401d,null));};exports[_0xfe73('0x22')]=function(_0x1900a2,_0x42247b){return db['UserProfileSection'][_0xfe73('0x40')]({'where':{'id':_0x1900a2[_0xfe73('0x3d')]['id']}})[_0xfe73('0x21')](handleEntityNotFound(_0x42247b,null))[_0xfe73('0x21')](removeEntity(_0x42247b,null))[_0xfe73('0x3b')](handleError(_0x42247b,null));};exports[_0xfe73('0x43')]=function(_0xdea044,_0x230959){return db[_0xfe73('0x28')][_0xfe73('0x43')]()['then'](respondWithResult(_0x230959,null))['catch'](handleError(_0x230959,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 63111cd..86003ee 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 _0xd74f=['path','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','../../config/logger','moment','bluebird'];(function(_0x41197c,_0x1569ff){var _0x327fda=function(_0x95625e){while(--_0x95625e){_0x41197c['push'](_0x41197c['shift']());}};_0x327fda(++_0x1569ff);}(_0xd74f,0x17e));var _0xfd74=function(_0x2ba4e3,_0x3c376c){_0x2ba4e3=_0x2ba4e3-0x0;var _0x79cdde=_0xd74f[_0x2ba4e3];return _0x79cdde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd74('0x0'))('api');var moment=require(_0xfd74('0x1'));var BPromise=require(_0xfd74('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd74('0x3'));var rimraf=require('rimraf');var config=require(_0xfd74('0x4'));var attributes=require(_0xfd74('0x5'));module['exports']=function(_0x10ecc9,_0x4bdd01){return _0x10ecc9[_0xfd74('0x6')](_0xfd74('0x7'),attributes,{'tableName':_0xfd74('0x8'),'paranoid':![],'indexes':[{'name':_0xfd74('0x9'),'fields':['sectionId',_0xfd74('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d2f=['moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','api'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x4d2f,0xdb));var _0xf4d2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d2f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf4d2('0x0'));var logger=require('../../config/logger')(_0xf4d2('0x1'));var moment=require(_0xf4d2('0x2'));var BPromise=require(_0xf4d2('0x3'));var rp=require(_0xf4d2('0x4'));var fs=require('fs');var path=require(_0xf4d2('0x5'));var rimraf=require(_0xf4d2('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4d2('0x7'));module[_0xf4d2('0x8')]=function(_0x4b1d84,_0x7c5928){return _0x4b1d84['define'](_0xf4d2('0x9'),attributes,{'tableName':_0xf4d2('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf4d2('0xb'),_0xf4d2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ab9fd6e..d08042c 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 _0xff43=['client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x5ef12e,_0x59a72a){var _0xd8607=function(_0x4a71f8){while(--_0x4a71f8){_0x5ef12e['push'](_0x5ef12e['shift']());}};_0xd8607(++_0x59a72a);}(_0xff43,0x65));var _0x3ff4=function(_0x584f86,_0x5ec770){_0x584f86=_0x584f86-0x0;var _0x4f2807=_0xff43[_0x584f86];return _0x4f2807;};'use strict';var _=require('lodash');var util=require(_0x3ff4('0x0'));var moment=require(_0x3ff4('0x1'));var BPromise=require(_0x3ff4('0x2'));var rs=require(_0x3ff4('0x3'));var fs=require('fs');var Redis=require(_0x3ff4('0x4'));var db=require(_0x3ff4('0x5'))['db'];var utils=require(_0x3ff4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ff4('0x7'));var jayson=require(_0x3ff4('0x8'));var client=jayson[_0x3ff4('0x9')][_0x3ff4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf3b14c,_0x260334,_0x394fe6){return new BPromise(function(_0x50266b,_0x38b3c2){return client[_0x3ff4('0xb')](_0xf3b14c,_0x394fe6)[_0x3ff4('0xc')](function(_0x46da1e){logger[_0x3ff4('0xd')](_0x3ff4('0xe'),_0x260334,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x260334,_0x3ff4('0xf'),JSON[_0x3ff4('0x10')](_0x46da1e));if(_0x46da1e[_0x3ff4('0x11')]){if(_0x46da1e['error'][_0x3ff4('0x12')]===0x1f4){logger['error'](_0x3ff4('0xe'),_0x260334,_0x46da1e[_0x3ff4('0x11')]['message']);return _0x38b3c2(_0x46da1e[_0x3ff4('0x11')][_0x3ff4('0x13')]);}logger[_0x3ff4('0x11')](_0x3ff4('0xe'),_0x260334,_0x46da1e[_0x3ff4('0x11')][_0x3ff4('0x13')]);return _0x50266b(_0x46da1e[_0x3ff4('0x11')]['message']);}else{logger[_0x3ff4('0xd')](_0x3ff4('0xe'),_0x260334,_0x3ff4('0xf'));_0x50266b(_0x46da1e[_0x3ff4('0x14')][_0x3ff4('0x13')]);}})[_0x3ff4('0x15')](function(_0x1194b3){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x260334,_0x1194b3);_0x38b3c2(_0x1194b3);});});} \ No newline at end of file +var _0xefa8=['code','message','info','catch','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53e3c2,_0x90a8fd){var _0x10aa40=function(_0x535ead){while(--_0x535ead){_0x53e3c2['push'](_0x53e3c2['shift']());}};_0x10aa40(++_0x90a8fd);}(_0xefa8,0x1a2));var _0x8efa=function(_0x35c9c1,_0xa7abdd){_0x35c9c1=_0x35c9c1-0x0;var _0x2d13a7=_0xefa8[_0x35c9c1];return _0x2d13a7;};'use strict';var _=require('lodash');var util=require(_0x8efa('0x0'));var moment=require('moment');var BPromise=require(_0x8efa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8efa('0x2'));var logger=require('../../config/logger')(_0x8efa('0x3'));var config=require(_0x8efa('0x4'));var jayson=require(_0x8efa('0x5'));var client=jayson[_0x8efa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x671e0b,_0x2c3754,_0x11276b){return new BPromise(function(_0x3d44f1,_0x529c56){return client[_0x8efa('0x7')](_0x671e0b,_0x11276b)[_0x8efa('0x8')](function(_0x929d13){logger['info'](_0x8efa('0x9'),_0x2c3754,_0x8efa('0xa'));logger['debug'](_0x8efa('0xb'),_0x2c3754,_0x8efa('0xa'),JSON[_0x8efa('0xc')](_0x929d13));if(_0x929d13['error']){if(_0x929d13[_0x8efa('0xd')][_0x8efa('0xe')]===0x1f4){logger[_0x8efa('0xd')](_0x8efa('0x9'),_0x2c3754,_0x929d13[_0x8efa('0xd')]['message']);return _0x529c56(_0x929d13[_0x8efa('0xd')][_0x8efa('0xf')]);}logger[_0x8efa('0xd')](_0x8efa('0x9'),_0x2c3754,_0x929d13[_0x8efa('0xd')][_0x8efa('0xf')]);return _0x3d44f1(_0x929d13[_0x8efa('0xd')][_0x8efa('0xf')]);}else{logger[_0x8efa('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2c3754,_0x8efa('0xa'));_0x3d44f1(_0x929d13['result']['message']);}})[_0x8efa('0x11')](function(_0x37db19){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c3754,_0x37db19);_0x529c56(_0x37db19);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b97b02c..e1e7fd1 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28bdb5,_0x463268){var _0x31ad7b=function(_0x23915a){while(--_0x23915a){_0x28bdb5['push'](_0x28bdb5['shift']());}};_0x31ad7b(++_0x463268);}(_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(_0x35140e,_0x55c999){var _0x3b8f18=function(_0x5c1919){while(--_0x5c1919){_0x35140e['push'](_0x35140e['shift']());}};_0x3b8f18(++_0x55c999);}(_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 f9cd0cf..e1a49a2 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 _0x9611=['sequelize','exports'];(function(_0x544346,_0x12d37a){var _0x2fa5ba=function(_0x37e561){while(--_0x37e561){_0x544346['push'](_0x544346['shift']());}};_0x2fa5ba(++_0x12d37a);}(_0x9611,0xce));var _0x1961=function(_0x29ce4a,_0x929a79){_0x29ce4a=_0x29ce4a-0x0;var _0x4a842b=_0x9611[_0x29ce4a];return _0x4a842b;};'use strict';var Sequelize=require(_0x1961('0x0'));module[_0x1961('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6ac=['exports','INTEGER'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xb6ac,0x86));var _0xcb6a=function(_0x1cf3c4,_0xbab21b){_0x1cf3c4=_0x1cf3c4-0x0;var _0x3c4fef=_0xb6ac[_0x1cf3c4];return _0x3c4fef;};'use strict';var Sequelize=require('sequelize');module[_0xcb6a('0x0')]={'penalty':{'type':Sequelize[_0xcb6a('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 721244e..e36c874 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 _0x13f5=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x220d5b,_0x290a1f){var _0x54ce5f=function(_0x11b979){while(--_0x11b979){_0x220d5b['push'](_0x220d5b['shift']());}};_0x54ce5f(++_0x290a1f);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var logger=require(_0x513f('0x2'))(_0x513f('0x3'));var moment=require('moment');var BPromise=require(_0x513f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var attributes=require(_0x513f('0x7'));module[_0x513f('0x8')]=function(_0x8d019b,_0x579681){return _0x8d019b[_0x513f('0x9')](_0x513f('0xa'),attributes,{'tableName':_0x513f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2c835b,_0x3b2146){var _0x2f4775=function(_0x348750){while(--_0x348750){_0x2c835b['push'](_0x2c835b['shift']());}};_0x2f4775(++_0x3b2146);}(_0x90b1,0x1bb));var _0x190b=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0x90b1[_0x50f9ab];return _0x58dda4;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c1cb9f2..9497e5d 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 _0xe0e7=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xe0e7,0x12c));var _0x7e0e=function(_0x34b245,_0xfe65b4){_0x34b245=_0x34b245-0x0;var _0x3a8984=_0xe0e7[_0x34b245];return _0x3a8984;};'use strict';var _=require(_0x7e0e('0x0'));var util=require(_0x7e0e('0x1'));var moment=require(_0x7e0e('0x2'));var BPromise=require(_0x7e0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e0e('0x4'))['db'];var utils=require(_0x7e0e('0x5'));var logger=require(_0x7e0e('0x6'))(_0x7e0e('0x7'));var config=require(_0x7e0e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e0e('0x9')][_0x7e0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209f4d,_0x2a0b6a,_0x36b5a0){return new BPromise(function(_0x58cfd5,_0x1aa170){return client[_0x7e0e('0xb')](_0x209f4d,_0x36b5a0)[_0x7e0e('0xc')](function(_0x7da2ae){logger[_0x7e0e('0xd')](_0x7e0e('0xe'),_0x2a0b6a,_0x7e0e('0xf'));logger[_0x7e0e('0x10')](_0x7e0e('0x11'),_0x2a0b6a,'request\x20sent',JSON[_0x7e0e('0x12')](_0x7da2ae));if(_0x7da2ae['error']){if(_0x7da2ae['error'][_0x7e0e('0x13')]===0x1f4){logger['error'](_0x7e0e('0xe'),_0x2a0b6a,_0x7da2ae[_0x7e0e('0x14')][_0x7e0e('0x15')]);return _0x1aa170(_0x7da2ae[_0x7e0e('0x14')]['message']);}logger[_0x7e0e('0x14')](_0x7e0e('0xe'),_0x2a0b6a,_0x7da2ae['error'][_0x7e0e('0x15')]);return _0x58cfd5(_0x7da2ae['error'][_0x7e0e('0x15')]);}else{logger[_0x7e0e('0xd')](_0x7e0e('0xe'),_0x2a0b6a,_0x7e0e('0xf'));_0x58cfd5(_0x7da2ae[_0x7e0e('0x16')][_0x7e0e('0x15')]);}})[_0x7e0e('0x17')](function(_0x54676f){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2a0b6a,_0x54676f);_0x1aa170(_0x54676f);});});} \ No newline at end of file +var _0x6eb3=['client','http','request','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e799e,_0x1a2417){var _0xa69de1=function(_0x5b3397){while(--_0x5b3397){_0x2e799e['push'](_0x2e799e['shift']());}};_0xa69de1(++_0x1a2417);}(_0x6eb3,0x15e));var _0x36eb=function(_0x20dba6,_0x147c58){_0x20dba6=_0x20dba6-0x0;var _0x2ca15e=_0x6eb3[_0x20dba6];return _0x2ca15e;};'use strict';var _=require('lodash');var util=require(_0x36eb('0x0'));var moment=require('moment');var BPromise=require(_0x36eb('0x1'));var rs=require(_0x36eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x36eb('0x3'))(_0x36eb('0x4'));var config=require(_0x36eb('0x5'));var jayson=require(_0x36eb('0x6'));var client=jayson[_0x36eb('0x7')][_0x36eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x528dfb,_0x25331d,_0x53fbe4){return new BPromise(function(_0x5ceb98,_0x4ee7ff){return client[_0x36eb('0x9')](_0x528dfb,_0x53fbe4)['then'](function(_0x23bfb1){logger[_0x36eb('0xa')](_0x36eb('0xb'),_0x25331d,'request\x20sent');logger[_0x36eb('0xc')](_0x36eb('0xd'),_0x25331d,'request\x20sent',JSON[_0x36eb('0xe')](_0x23bfb1));if(_0x23bfb1[_0x36eb('0xf')]){if(_0x23bfb1[_0x36eb('0xf')][_0x36eb('0x10')]===0x1f4){logger['error'](_0x36eb('0xb'),_0x25331d,_0x23bfb1[_0x36eb('0xf')][_0x36eb('0x11')]);return _0x4ee7ff(_0x23bfb1['error']['message']);}logger[_0x36eb('0xf')](_0x36eb('0xb'),_0x25331d,_0x23bfb1[_0x36eb('0xf')]['message']);return _0x5ceb98(_0x23bfb1[_0x36eb('0xf')][_0x36eb('0x11')]);}else{logger[_0x36eb('0xa')](_0x36eb('0xb'),_0x25331d,_0x36eb('0x12'));_0x5ceb98(_0x23bfb1[_0x36eb('0x13')][_0x36eb('0x11')]);}})[_0x36eb('0x14')](function(_0x1c92c6){logger['error'](_0x36eb('0xb'),_0x25331d,_0x1c92c6);_0x4ee7ff(_0x1c92c6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 8b1a7a5..6499475 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 _0x32bf=['INTEGER','sequelize','exports'];(function(_0x186ffb,_0x39a322){var _0x529c26=function(_0x3d1496){while(--_0x3d1496){_0x186ffb['push'](_0x186ffb['shift']());}};_0x529c26(++_0x39a322);}(_0x32bf,0x103));var _0xf32b=function(_0x39479f,_0x1b52c7){_0x39479f=_0x39479f-0x0;var _0x50ca97=_0x32bf[_0x39479f];return _0x50ca97;};'use strict';var Sequelize=require(_0xf32b('0x0'));module[_0xf32b('0x1')]={'UserId':{'type':Sequelize[_0xf32b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf32b('0x2')]}}; \ No newline at end of file +var _0x3626=['exports','INTEGER','sequelize'];(function(_0x4ff27a,_0x18605a){var _0x1793e1=function(_0xc034b0){while(--_0xc034b0){_0x4ff27a['push'](_0x4ff27a['shift']());}};_0x1793e1(++_0x18605a);}(_0x3626,0x13a));var _0x6362=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3626[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x6362('0x0'));module[_0x6362('0x1')]={'UserId':{'type':Sequelize[_0x6362('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x6362('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b56eb2b..1f4f0cf 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(_0x1ff757,_0x52b941){var _0x570f1a=function(_0x3e64f4){while(--_0x3e64f4){_0x1ff757['push'](_0x1ff757['shift']());}};_0x570f1a(++_0x52b941);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x209daf,_0x3a575e){var _0x4ce6da=function(_0x55c731){while(--_0x55c731){_0x209daf['push'](_0x209daf['shift']());}};_0x4ce6da(++_0x3a575e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 21b39c7..83325e7 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x24e2b8,_0xd369a4){var _0x5e114f=function(_0x46f731){while(--_0x46f731){_0x24e2b8['push'](_0x24e2b8['shift']());}};_0x5e114f(++_0xd369a4);}(_0xe706,0xa3));var _0x6e70=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0xe706[_0x4f1da5];return _0xe972a8;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x26a515,_0x286339){var _0x314682=function(_0x501b51){while(--_0x501b51){_0x26a515['push'](_0x26a515['shift']());}};_0x314682(++_0x286339);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index fbaedb9..7798c8d 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 _0x8254=['sequelize','exports','INTEGER'];(function(_0x5b5c9e,_0x28b6c8){var _0xcd3a2e=function(_0x49c320){while(--_0x49c320){_0x5b5c9e['push'](_0x5b5c9e['shift']());}};_0xcd3a2e(++_0x28b6c8);}(_0x8254,0x15f));var _0x4825=function(_0x178a10,_0x21d099){_0x178a10=_0x178a10-0x0;var _0x2d10a0=_0x8254[_0x178a10];return _0x2d10a0;};'use strict';var Sequelize=require(_0x4825('0x0'));module[_0x4825('0x1')]={'penalty':{'type':Sequelize[_0x4825('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe4b6=['INTEGER','sequelize','exports'];(function(_0x28956f,_0x384c5a){var _0x67b06e=function(_0x3c3dd8){while(--_0x3c3dd8){_0x28956f['push'](_0x28956f['shift']());}};_0x67b06e(++_0x384c5a);}(_0xe4b6,0xfa));var _0x6e4b=function(_0x18f3bf,_0x2f81f0){_0x18f3bf=_0x18f3bf-0x0;var _0x88488a=_0xe4b6[_0x18f3bf];return _0x88488a;};'use strict';var Sequelize=require(_0x6e4b('0x0'));module[_0x6e4b('0x1')]={'penalty':{'type':Sequelize[_0x6e4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8df5cac..5cb9c40 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 _0xc965=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','path','../../config/environment'];(function(_0x4b7215,_0x152f22){var _0x269d2c=function(_0x1be0e7){while(--_0x1be0e7){_0x4b7215['push'](_0x4b7215['shift']());}};_0x269d2c(++_0x152f22);}(_0xc965,0x176));var _0x5c96=function(_0x366ce0,_0x4c3fad){_0x366ce0=_0x366ce0-0x0;var _0x5ae1c0=_0xc965[_0x366ce0];return _0x5ae1c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c96('0x0'))('api');var moment=require(_0x5c96('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c96('0x2'));var rimraf=require('rimraf');var config=require(_0x5c96('0x3'));var attributes=require(_0x5c96('0x4'));module[_0x5c96('0x5')]=function(_0x2e0a72,_0x49840a){return _0x2e0a72[_0x5c96('0x6')](_0x5c96('0x7'),attributes,{'tableName':_0x5c96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1194=['../../config/environment','exports','util','api','bluebird','request-promise','path','rimraf'];(function(_0x38c0b2,_0x6a67a5){var _0x283c00=function(_0x259f03){while(--_0x259f03){_0x38c0b2['push'](_0x38c0b2['shift']());}};_0x283c00(++_0x6a67a5);}(_0x1194,0x82));var _0x4119=function(_0x2a26da,_0x3dfca3){_0x2a26da=_0x2a26da-0x0;var _0x59fc7f=_0x1194[_0x2a26da];return _0x59fc7f;};'use strict';var _=require('lodash');var util=require(_0x4119('0x0'));var logger=require('../../config/logger')(_0x4119('0x1'));var moment=require('moment');var BPromise=require(_0x4119('0x2'));var rp=require(_0x4119('0x3'));var fs=require('fs');var path=require(_0x4119('0x4'));var rimraf=require(_0x4119('0x5'));var config=require(_0x4119('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x4119('0x7')]=function(_0x189d50,_0x467baf){return _0x189d50['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','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 e5e0990..b3068b0 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 _0xbb30=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xbb30,0x14c));var _0x0bb3=function(_0x3efcd5,_0x4a8d63){_0x3efcd5=_0x3efcd5-0x0;var _0x1b3333=_0xbb30[_0x3efcd5];return _0x1b3333;};'use strict';var _=require(_0x0bb3('0x0'));var util=require(_0x0bb3('0x1'));var moment=require(_0x0bb3('0x2'));var BPromise=require(_0x0bb3('0x3'));var rs=require(_0x0bb3('0x4'));var fs=require('fs');var Redis=require(_0x0bb3('0x5'));var db=require(_0x0bb3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bb3('0x7'))(_0x0bb3('0x8'));var config=require('../../config/environment');var jayson=require(_0x0bb3('0x9'));var client=jayson[_0x0bb3('0xa')][_0x0bb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f6bb3,_0x534f30,_0x53af6e){return new BPromise(function(_0xca1ebf,_0x173e08){return client[_0x0bb3('0xc')](_0x3f6bb3,_0x53af6e)[_0x0bb3('0xd')](function(_0x4b555c){logger[_0x0bb3('0xe')](_0x0bb3('0xf'),_0x534f30,_0x0bb3('0x10'));logger[_0x0bb3('0x11')](_0x0bb3('0x12'),_0x534f30,_0x0bb3('0x10'),JSON['stringify'](_0x4b555c));if(_0x4b555c['error']){if(_0x4b555c[_0x0bb3('0x13')][_0x0bb3('0x14')]===0x1f4){logger['error'](_0x0bb3('0xf'),_0x534f30,_0x4b555c[_0x0bb3('0x13')][_0x0bb3('0x15')]);return _0x173e08(_0x4b555c[_0x0bb3('0x13')][_0x0bb3('0x15')]);}logger[_0x0bb3('0x13')](_0x0bb3('0xf'),_0x534f30,_0x4b555c[_0x0bb3('0x13')][_0x0bb3('0x15')]);return _0xca1ebf(_0x4b555c[_0x0bb3('0x13')][_0x0bb3('0x15')]);}else{logger['info'](_0x0bb3('0xf'),_0x534f30,_0x0bb3('0x10'));_0xca1ebf(_0x4b555c['result'][_0x0bb3('0x15')]);}})[_0x0bb3('0x16')](function(_0x359d7f){logger[_0x0bb3('0x13')](_0x0bb3('0xf'),_0x534f30,_0x359d7f);_0x173e08(_0x359d7f);});});} \ No newline at end of file +var _0x18ec=['then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x5f22de,_0x4cd696){var _0x5c54a0=function(_0x2b64a3){while(--_0x2b64a3){_0x5f22de['push'](_0x5f22de['shift']());}};_0x5c54a0(++_0x4cd696);}(_0x18ec,0x75));var _0xc18e=function(_0x313323,_0x1160b6){_0x313323=_0x313323-0x0;var _0x43b296=_0x18ec[_0x313323];return _0x43b296;};'use strict';var _=require('lodash');var util=require(_0xc18e('0x0'));var moment=require(_0xc18e('0x1'));var BPromise=require(_0xc18e('0x2'));var rs=require(_0xc18e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc18e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc18e('0x5'))('rpc');var config=require(_0xc18e('0x6'));var jayson=require(_0xc18e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14f304,_0x5dd77c,_0x2840e8){return new BPromise(function(_0x44fc31,_0x16d613){return client[_0xc18e('0x8')](_0x14f304,_0x2840e8)[_0xc18e('0x9')](function(_0x1feaea){logger['info'](_0xc18e('0xa'),_0x5dd77c,_0xc18e('0xb'));logger[_0xc18e('0xc')](_0xc18e('0xd'),_0x5dd77c,_0xc18e('0xb'),JSON[_0xc18e('0xe')](_0x1feaea));if(_0x1feaea[_0xc18e('0xf')]){if(_0x1feaea[_0xc18e('0xf')][_0xc18e('0x10')]===0x1f4){logger[_0xc18e('0xf')](_0xc18e('0xa'),_0x5dd77c,_0x1feaea['error'][_0xc18e('0x11')]);return _0x16d613(_0x1feaea[_0xc18e('0xf')][_0xc18e('0x11')]);}logger[_0xc18e('0xf')](_0xc18e('0xa'),_0x5dd77c,_0x1feaea[_0xc18e('0xf')][_0xc18e('0x11')]);return _0x44fc31(_0x1feaea['error'][_0xc18e('0x11')]);}else{logger[_0xc18e('0x12')](_0xc18e('0xa'),_0x5dd77c,_0xc18e('0xb'));_0x44fc31(_0x1feaea[_0xc18e('0x13')][_0xc18e('0x11')]);}})[_0xc18e('0x14')](function(_0x460b8d){logger[_0xc18e('0xf')](_0xc18e('0xa'),_0x5dd77c,_0x460b8d);_0x16d613(_0x460b8d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 531071c..5b92d19 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x302633,_0x1db44e){var _0x2c88fb=function(_0x11c9b7){while(--_0x11c9b7){_0x302633['push'](_0x302633['shift']());}};_0x2c88fb(++_0x1db44e);}(_0x70e0,0x17b));var _0x070e=function(_0x420674,_0x4dea8b){_0x420674=_0x420674-0x0;var _0x502f8b=_0x70e0[_0x420674];return _0x502f8b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4c5a57,_0x1d51f3){var _0x4c5875=function(_0x21171e){while(--_0x21171e){_0x4c5a57['push'](_0x4c5a57['shift']());}};_0x4c5875(++_0x1d51f3);}(_0xe706,0xa3));var _0x6e70=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0xe706[_0x3b247d];return _0x131bcf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 95bfb82..ba5cbf6 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 _0xe7cc=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x57c136,_0x282611){var _0x4f95b8=function(_0x1e0c0b){while(--_0x1e0c0b){_0x57c136['push'](_0x57c136['shift']());}};_0x4f95b8(++_0x282611);}(_0xe7cc,0x83));var _0xce7c=function(_0x1e7665,_0x111f69){_0x1e7665=_0x1e7665-0x0;var _0x48eba0=_0xe7cc[_0x1e7665];return _0x48eba0;};'use strict';var Sequelize=require(_0xce7c('0x0'));module[_0xce7c('0x1')]={'uniqueid':{'type':Sequelize[_0xce7c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xce7c('0x3')],'allowNull':![],'comment':_0xce7c('0x4')},'UserId':{'type':Sequelize[_0xce7c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xce7c('0x3')],'allowNull':![],'unique':_0xce7c('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xce7c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xce7c('0x3')],'allowNull':![],'unique':_0xce7c('0x5'),'comment':_0xce7c('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xce7c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x8c52=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x6cee0d,_0x49c4e3){var _0x208a6d=function(_0xedf116){while(--_0xedf116){_0x6cee0d['push'](_0x6cee0d['shift']());}};_0x208a6d(++_0x49c4e3);}(_0x8c52,0x7e));var _0x28c5=function(_0x3e0558,_0x4818a4){_0x3e0558=_0x3e0558-0x0;var _0xfa1387=_0x8c52[_0x3e0558];return _0xfa1387;};'use strict';var Sequelize=require(_0x28c5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x28c5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x28c5('0x2')},'membername':{'type':Sequelize[_0x28c5('0x3')],'allowNull':![],'comment':_0x28c5('0x2')},'UserId':{'type':Sequelize[_0x28c5('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x28c5('0x3')],'allowNull':![],'unique':_0x28c5('0x4'),'comment':_0x28c5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x28c5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x28c5('0x3')],'allowNull':![],'unique':_0x28c5('0x4'),'comment':_0x28c5('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4f7a1e4..a9eb7fd 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 _0x3edd=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x328ac9,_0x2f7225){var _0x2b3a0a=function(_0x759e26){while(--_0x759e26){_0x328ac9['push'](_0x328ac9['shift']());}};_0x2b3a0a(++_0x2f7225);}(_0x3edd,0x8c));var _0xd3ed=function(_0xea88e6,_0x2f4d9f){_0xea88e6=_0xea88e6-0x0;var _0x1a0f99=_0x3edd[_0xea88e6];return _0x1a0f99;};'use strict';var EventEmitter=require(_0xd3ed('0x0'));var UserVoiceQueueRt=require(_0xd3ed('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd3ed('0x2')](0x0);var events={'afterCreate':_0xd3ed('0x3'),'afterUpdate':_0xd3ed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51c378){return function(_0x2631ec,_0x24d1fa,_0x526318){UserVoiceQueueRtEvents['emit'](_0x51c378+':'+_0x2631ec['id'],_0x2631ec);UserVoiceQueueRtEvents[_0xd3ed('0x5')](_0x51c378,_0x2631ec);_0x526318(null);};}for(var e in events){if(events[_0xd3ed('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xd3ed('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2327=['save','update','remove','emit','hook','UserVoiceQueueRt','setMaxListeners'];(function(_0xc87f03,_0x585d99){var _0xc275d5=function(_0x49fa5a){while(--_0x49fa5a){_0xc87f03['push'](_0xc87f03['shift']());}};_0xc275d5(++_0x585d99);}(_0x2327,0x98));var _0x7232=function(_0x1b7043,_0x2e35ff){_0x1b7043=_0x1b7043-0x0;var _0x17dd57=_0x2327[_0x1b7043];return _0x17dd57;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7232('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7232('0x1')](0x0);var events={'afterCreate':_0x7232('0x2'),'afterUpdate':_0x7232('0x3'),'afterDestroy':_0x7232('0x4')};function emitEvent(_0x9984b2){return function(_0x226c5a,_0x2148ea,_0xf33014){UserVoiceQueueRtEvents[_0x7232('0x5')](_0x9984b2+':'+_0x226c5a['id'],_0x226c5a);UserVoiceQueueRtEvents[_0x7232('0x5')](_0x9984b2,_0x226c5a);_0xf33014(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7232('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d07a57b..89fe77e 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 _0xda22=['./userVoiceQueueRt.attributes','UserVoiceQueueRt','lodash','util','path','rimraf','../../config/environment'];(function(_0xc58e33,_0x113136){var _0x4afd5b=function(_0x468025){while(--_0x468025){_0xc58e33['push'](_0xc58e33['shift']());}};_0x4afd5b(++_0x113136);}(_0xda22,0x6b));var _0x2da2=function(_0x5abb5a,_0x1198e2){_0x5abb5a=_0x5abb5a-0x0;var _0x4183e8=_0xda22[_0x5abb5a];return _0x4183e8;};'use strict';var _=require(_0x2da2('0x0'));var util=require(_0x2da2('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(_0x2da2('0x2'));var rimraf=require(_0x2da2('0x3'));var config=require(_0x2da2('0x4'));var attributes=require(_0x2da2('0x5'));module['exports']=function(_0x53befa,_0x45b819){return _0x53befa['define'](_0x2da2('0x6'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b1c=['bluebird','request-promise','path','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x5957bb,_0x320d51){var _0x44ae5b=function(_0x596b37){while(--_0x596b37){_0x5957bb['push'](_0x5957bb['shift']());}};_0x44ae5b(++_0x320d51);}(_0x8b1c,0xcc));var _0xc8b1=function(_0x59e66d,_0x54dfc6){_0x59e66d=_0x59e66d-0x0;var _0x4c295e=_0x8b1c[_0x59e66d];return _0x4c295e;};'use strict';var _=require(_0xc8b1('0x0'));var util=require(_0xc8b1('0x1'));var logger=require(_0xc8b1('0x2'))(_0xc8b1('0x3'));var moment=require(_0xc8b1('0x4'));var BPromise=require(_0xc8b1('0x5'));var rp=require(_0xc8b1('0x6'));var fs=require('fs');var path=require(_0xc8b1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xc8b1('0x8')]=function(_0x24ebdf,_0x74c666){return _0x24ebdf['define'](_0xc8b1('0x9'),attributes,{'tableName':_0xc8b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index c328844..12da5bb 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 _0x3f04=['COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','catch','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where'];(function(_0x1ac7f5,_0x1e9348){var _0x141dde=function(_0x4cef68){while(--_0x4cef68){_0x1ac7f5['push'](_0x1ac7f5['shift']());}};_0x141dde(++_0x1e9348);}(_0x3f04,0x6d));var _0x43f0=function(_0x2e02f5,_0x2cb87e){_0x2e02f5=_0x2e02f5-0x0;var _0x5091f7=_0x3f04[_0x2e02f5];return _0x5091f7;};'use strict';var _=require(_0x43f0('0x0'));var util=require(_0x43f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43f0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x43f0('0x3'))(_0x43f0('0x4'));var config=require('../../config/environment');var jayson=require(_0x43f0('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x43f0('0x6')],{'host':_0x43f0('0x7'),'port':0x18eb});var socket=require(_0x43f0('0x8'))(new Redis(config['redis']));require(_0x43f0('0x9'))['register'](socket);function respondWithRpcPromise(_0x47af6c,_0x399f87,_0x2e1965){return new BPromise(function(_0x37499a,_0x14efd0){return client[_0x43f0('0xa')](_0x47af6c,_0x2e1965)[_0x43f0('0xb')](function(_0x376e77){logger['info'](_0x43f0('0xc'),_0x399f87,_0x43f0('0xd'));logger[_0x43f0('0xe')](_0x43f0('0xf'),_0x399f87,_0x43f0('0xd'),JSON[_0x43f0('0x10')](_0x376e77));if(_0x376e77[_0x43f0('0x11')]){if(_0x376e77['error'][_0x43f0('0x12')]===0x1f4){logger[_0x43f0('0x11')](_0x43f0('0xc'),_0x399f87,_0x376e77[_0x43f0('0x11')][_0x43f0('0x13')]);return _0x14efd0(_0x376e77[_0x43f0('0x11')][_0x43f0('0x13')]);}logger[_0x43f0('0x11')](_0x43f0('0xc'),_0x399f87,_0x376e77[_0x43f0('0x11')][_0x43f0('0x13')]);return _0x37499a(_0x376e77['error'][_0x43f0('0x13')]);}else{logger['info'](_0x43f0('0xc'),_0x399f87,_0x43f0('0xd'));_0x37499a(_0x376e77[_0x43f0('0x14')]['message']);}})['catch'](function(_0x49c522){logger[_0x43f0('0x11')](_0x43f0('0xc'),_0x399f87,_0x49c522);_0x14efd0(_0x49c522);});});}exports[_0x43f0('0x15')]=function(_0x509f24){var _0x2564bf=this;return new Promise(function(_0x297255,_0xc96562){return db[_0x43f0('0x16')][_0x43f0('0x17')]({'raw':_0x509f24[_0x43f0('0x18')]?_0x509f24[_0x43f0('0x18')][_0x43f0('0x19')]===undefined?!![]:![]:!![],'where':_0x509f24[_0x43f0('0x18')]?_0x509f24['options'][_0x43f0('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0x43f0('0x1b'),db[_0x43f0('0x1c')]['fn']('IF',db['sequelize'][_0x43f0('0x1d')](_0x43f0('0x1e')))),_0x43f0('0x1f')]]})[_0x43f0('0xb')](function(_0x5752cb){logger[_0x43f0('0x20')](_0x43f0('0x15'),_0x509f24);logger[_0x43f0('0xe')](_0x43f0('0x15'),_0x509f24,JSON[_0x43f0('0x10')](_0x5752cb));_0x297255(_0x5752cb);})[_0x43f0('0x21')](function(_0x961a7f){logger[_0x43f0('0x11')](_0x43f0('0x15'),_0x961a7f[_0x43f0('0x13')],_0x509f24);_0xc96562(_0x2564bf[_0x43f0('0x11')](0x1f4,_0x961a7f[_0x43f0('0x13')]));});});}; \ No newline at end of file +var _0x39d9=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x38d181,_0x1ad540){var _0x44ca80=function(_0x14ae4d){while(--_0x14ae4d){_0x38d181['push'](_0x38d181['shift']());}};_0x44ca80(++_0x1ad540);}(_0x39d9,0x1df));var _0x939d=function(_0x968dca,_0x453a5f){_0x968dca=_0x968dca-0x0;var _0x22e036=_0x39d9[_0x968dca];return _0x22e036;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var moment=require(_0x939d('0x2'));var BPromise=require('bluebird');var rs=require(_0x939d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x939d('0x4'))['db'];var utils=require(_0x939d('0x5'));var logger=require(_0x939d('0x6'))(_0x939d('0x7'));var config=require(_0x939d('0x8'));var jayson=require(_0x939d('0x9'));var client=jayson['client'][_0x939d('0xa')]({'port':0x232a});config[_0x939d('0xb')]=_[_0x939d('0xc')](config[_0x939d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x939d('0xd'))(new Redis(config[_0x939d('0xb')]));require(_0x939d('0xe'))[_0x939d('0xf')](socket);function respondWithRpcPromise(_0x57314d,_0x3ad363,_0x20ce88){return new BPromise(function(_0x3c3ae5,_0x11cc8f){return client[_0x939d('0x10')](_0x57314d,_0x20ce88)[_0x939d('0x11')](function(_0x1627bd){logger[_0x939d('0x12')](_0x939d('0x13'),_0x3ad363,'request\x20sent');logger[_0x939d('0x14')](_0x939d('0x15'),_0x3ad363,'request\x20sent',JSON[_0x939d('0x16')](_0x1627bd));if(_0x1627bd[_0x939d('0x17')]){if(_0x1627bd['error'][_0x939d('0x18')]===0x1f4){logger[_0x939d('0x17')](_0x939d('0x13'),_0x3ad363,_0x1627bd[_0x939d('0x17')][_0x939d('0x19')]);return _0x11cc8f(_0x1627bd['error'][_0x939d('0x19')]);}logger[_0x939d('0x17')](_0x939d('0x13'),_0x3ad363,_0x1627bd[_0x939d('0x17')]['message']);return _0x3c3ae5(_0x1627bd[_0x939d('0x17')][_0x939d('0x19')]);}else{logger[_0x939d('0x12')](_0x939d('0x13'),_0x3ad363,'request\x20sent');_0x3c3ae5(_0x1627bd[_0x939d('0x1a')][_0x939d('0x19')]);}})[_0x939d('0x1b')](function(_0x1a6487){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ad363,_0x1a6487);_0x11cc8f(_0x1a6487);});});}exports[_0x939d('0x1c')]=function(_0x5854ed){var _0x23aed4=this;return new Promise(function(_0x4d5f1e,_0x118df6){return db[_0x939d('0x1d')][_0x939d('0x1e')]({'raw':_0x5854ed[_0x939d('0x1f')]?_0x5854ed[_0x939d('0x1f')][_0x939d('0x20')]===undefined?!![]:![]:!![],'where':_0x5854ed['options']?_0x5854ed[_0x939d('0x1f')][_0x939d('0x21')]||null:null,'attributes':[[db[_0x939d('0x22')]['fn'](_0x939d('0x23'),db[_0x939d('0x22')]['fn']('IF',db[_0x939d('0x22')][_0x939d('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x939d('0x25')]]})['then'](function(_0x3bba24){logger['info'](_0x939d('0x1c'),_0x5854ed);logger['debug'](_0x939d('0x1c'),_0x5854ed,JSON[_0x939d('0x16')](_0x3bba24));_0x4d5f1e(_0x3bba24);})[_0x939d('0x1b')](function(_0x548a0c){logger['error'](_0x939d('0x1c'),_0x548a0c[_0x939d('0x19')],_0x5854ed);_0x118df6(_0x23aed4[_0x939d('0x17')](0x1f4,_0x548a0c[_0x939d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 92a6934..017390f 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 _0x6299=['register','remove','update','emit','removeListener'];(function(_0x4e08ee,_0x241beb){var _0x516c31=function(_0x385a9d){while(--_0x385a9d){_0x4e08ee['push'](_0x4e08ee['shift']());}};_0x516c31(++_0x241beb);}(_0x6299,0x169));var _0x9629=function(_0x76a24f,_0x2d3ffd){_0x76a24f=_0x76a24f-0x0;var _0x12712b=_0x6299[_0x76a24f];return _0x12712b;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9629('0x0'),_0x9629('0x1')];function createListener(_0x3cf1e1,_0x35868a){return function(_0x3c3ab2){_0x35868a[_0x9629('0x2')](_0x3cf1e1,_0x3c3ab2);};}function removeListener(_0x55d4ce,_0x327ee9){return function(){UserVoiceQueueRtEvents[_0x9629('0x3')](_0x55d4ce,_0x327ee9);};}exports[_0x9629('0x4')]=function(_0x1edc13){for(var _0x1206bf=0x0,_0x5d5981=events['length'];_0x1206bf<_0x5d5981;_0x1206bf++){var _0x2c5ca5=events[_0x1206bf];var _0x1754e6=createListener('userVoiceQueueRt:'+_0x2c5ca5,_0x1edc13);UserVoiceQueueRtEvents['on'](_0x2c5ca5,_0x1754e6);}}; \ No newline at end of file +var _0xdcf6=['update','emit','removeListener','save','remove'];(function(_0x570553,_0x24465b){var _0xfe0875=function(_0xd8a2e){while(--_0xd8a2e){_0x570553['push'](_0x570553['shift']());}};_0xfe0875(++_0x24465b);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x18f869,_0x694862){_0x18f869=_0x18f869-0x0;var _0x1c6ca4=_0xdcf6[_0x18f869];return _0x1c6ca4;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x6dcf('0x0'),_0x6dcf('0x1'),_0x6dcf('0x2')];function createListener(_0x4402e7,_0x34db3b){return function(_0x17056c){_0x34db3b[_0x6dcf('0x3')](_0x4402e7,_0x17056c);};}function removeListener(_0x513bcb,_0x69f442){return function(){UserVoiceQueueRtEvents[_0x6dcf('0x4')](_0x513bcb,_0x69f442);};}exports['register']=function(_0x1ff8b6){for(var _0x3364bd=0x0,_0x5abd79=events['length'];_0x3364bd<_0x5abd79;_0x3364bd++){var _0x5766db=events[_0x3364bd];var _0x34517a=createListener('userVoiceQueueRt:'+_0x5766db,_0x1ff8b6);UserVoiceQueueRtEvents['on'](_0x5766db,_0x34517a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1f2c058..aa3fd02 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4884e4,_0x4ba6fd){var _0x10ef92=function(_0x29c4e5){while(--_0x29c4e5){_0x4884e4['push'](_0x4884e4['shift']());}};_0x10ef92(++_0x4ba6fd);}(_0x70e0,0x17b));var _0x070e=function(_0x5d34d5,_0x4f1b38){_0x5d34d5=_0x5d34d5-0x0;var _0xa0ac47=_0x70e0[_0x5d34d5];return _0xa0ac47;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3cfaea,_0x59581c){var _0x5131f6=function(_0x57deeb){while(--_0x57deeb){_0x3cfaea['push'](_0x3cfaea['shift']());}};_0x5131f6(++_0x59581c);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 38b0f3e..0290d52 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 _0xb41e=['sequelize','INTEGER'];(function(_0x14f5bb,_0x49669d){var _0x5865dc=function(_0x4b1cec){while(--_0x4b1cec){_0x14f5bb['push'](_0x14f5bb['shift']());}};_0x5865dc(++_0x49669d);}(_0xb41e,0x1f0));var _0xeb41=function(_0x267692,_0x229aaa){_0x267692=_0x267692-0x0;var _0x209905=_0xb41e[_0x267692];return _0x209905;};'use strict';var Sequelize=require(_0xeb41('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xeb41('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf41=['exports','INTEGER','sequelize'];(function(_0x27c581,_0x32a779){var _0xf94f08=function(_0x56c34a){while(--_0x56c34a){_0x27c581['push'](_0x27c581['shift']());}};_0xf94f08(++_0x32a779);}(_0xaf41,0x13d));var _0x1af4=function(_0x3b8b54,_0x4c691c){_0x3b8b54=_0x3b8b54-0x0;var _0x32137f=_0xaf41[_0x3b8b54];return _0x32137f;};'use strict';var Sequelize=require(_0x1af4('0x0'));module[_0x1af4('0x1')]={'penalty':{'type':Sequelize[_0x1af4('0x2')],'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 3eca2ed..9a0923f 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 _0xe396=['lodash','util','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x19905b,_0x8d7e99){var _0x44e679=function(_0x5b6c01){while(--_0x5b6c01){_0x19905b['push'](_0x19905b['shift']());}};_0x44e679(++_0x8d7e99);}(_0xe396,0xbb));var _0x6e39=function(_0x17534f,_0x33e0cb){_0x17534f=_0x17534f-0x0;var _0xb538fa=_0xe396[_0x17534f];return _0xb538fa;};'use strict';var _=require(_0x6e39('0x0'));var util=require(_0x6e39('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6e39('0x2'));var BPromise=require(_0x6e39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e39('0x4'));var rimraf=require(_0x6e39('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e39('0x6'));module[_0x6e39('0x7')]=function(_0x2263e3,_0x327599){return _0x2263e3[_0x6e39('0x8')](_0x6e39('0x9'),attributes,{'tableName':_0x6e39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x241b=['moment','bluebird','request-promise','rimraf','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x67fcae,_0x41356c){var _0x5e0302=function(_0x921054){while(--_0x921054){_0x67fcae['push'](_0x67fcae['shift']());}};_0x5e0302(++_0x41356c);}(_0x241b,0xe4));var _0xb241=function(_0x50c6cd,_0x2ebb05){_0x50c6cd=_0x50c6cd-0x0;var _0xd83972=_0x241b[_0x50c6cd];return _0xd83972;};'use strict';var _=require(_0xb241('0x0'));var util=require(_0xb241('0x1'));var logger=require(_0xb241('0x2'))('api');var moment=require(_0xb241('0x3'));var BPromise=require(_0xb241('0x4'));var rp=require(_0xb241('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb241('0x6'));var config=require(_0xb241('0x7'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x49f6d2,_0x38f506){return _0x49f6d2[_0xb241('0x8')](_0xb241('0x9'),attributes,{'tableName':_0xb241('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7720540..038d63b 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 _0xabd3=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c2aeb,_0x48433c){var _0x783379=function(_0x3e8820){while(--_0x3e8820){_0x1c2aeb['push'](_0x1c2aeb['shift']());}};_0x783379(++_0x48433c);}(_0xabd3,0x19b));var _0x3abd=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0xabd3[_0x136a0d];return _0x212ea5;};'use strict';var _=require(_0x3abd('0x0'));var util=require(_0x3abd('0x1'));var moment=require(_0x3abd('0x2'));var BPromise=require('bluebird');var rs=require(_0x3abd('0x3'));var fs=require('fs');var Redis=require(_0x3abd('0x4'));var db=require(_0x3abd('0x5'))['db'];var utils=require(_0x3abd('0x6'));var logger=require(_0x3abd('0x7'))(_0x3abd('0x8'));var config=require(_0x3abd('0x9'));var jayson=require(_0x3abd('0xa'));var client=jayson['client'][_0x3abd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x413e7a,_0x3bc9d1,_0x1d0f15){return new BPromise(function(_0xcf303d,_0x2e9f94){return client['request'](_0x413e7a,_0x1d0f15)[_0x3abd('0xc')](function(_0x4e1e5d){logger[_0x3abd('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3bc9d1,_0x3abd('0xe'));logger['debug'](_0x3abd('0xf'),_0x3bc9d1,_0x3abd('0xe'),JSON[_0x3abd('0x10')](_0x4e1e5d));if(_0x4e1e5d[_0x3abd('0x11')]){if(_0x4e1e5d[_0x3abd('0x11')][_0x3abd('0x12')]===0x1f4){logger['error'](_0x3abd('0x13'),_0x3bc9d1,_0x4e1e5d[_0x3abd('0x11')][_0x3abd('0x14')]);return _0x2e9f94(_0x4e1e5d[_0x3abd('0x11')][_0x3abd('0x14')]);}logger[_0x3abd('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3bc9d1,_0x4e1e5d[_0x3abd('0x11')][_0x3abd('0x14')]);return _0xcf303d(_0x4e1e5d[_0x3abd('0x11')][_0x3abd('0x14')]);}else{logger[_0x3abd('0xd')](_0x3abd('0x13'),_0x3bc9d1,_0x3abd('0xe'));_0xcf303d(_0x4e1e5d[_0x3abd('0x15')]['message']);}})['catch'](function(_0x4c5de7){logger[_0x3abd('0x11')](_0x3abd('0x13'),_0x3bc9d1,_0x4c5de7);_0x2e9f94(_0x4c5de7);});});} \ No newline at end of file +var _0x602a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x3a2540,_0x54c387){var _0x187425=function(_0x55cf11){while(--_0x55cf11){_0x3a2540['push'](_0x3a2540['shift']());}};_0x187425(++_0x54c387);}(_0x602a,0x163));var _0xa602=function(_0x1a93e6,_0x7cbb80){_0x1a93e6=_0x1a93e6-0x0;var _0x6a36b8=_0x602a[_0x1a93e6];return _0x6a36b8;};'use strict';var _=require(_0xa602('0x0'));var util=require(_0xa602('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa602('0x2'));var fs=require('fs');var Redis=require(_0xa602('0x3'));var db=require(_0xa602('0x4'))['db'];var utils=require(_0xa602('0x5'));var logger=require(_0xa602('0x6'))(_0xa602('0x7'));var config=require(_0xa602('0x8'));var jayson=require(_0xa602('0x9'));var client=jayson['client'][_0xa602('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f499e,_0x179b2c,_0x1790dc){return new BPromise(function(_0x29ed80,_0x32bf4b){return client['request'](_0x1f499e,_0x1790dc)[_0xa602('0xb')](function(_0x5b500e){logger['info'](_0xa602('0xc'),_0x179b2c,_0xa602('0xd'));logger['debug'](_0xa602('0xe'),_0x179b2c,_0xa602('0xd'),JSON[_0xa602('0xf')](_0x5b500e));if(_0x5b500e['error']){if(_0x5b500e[_0xa602('0x10')][_0xa602('0x11')]===0x1f4){logger[_0xa602('0x10')](_0xa602('0xc'),_0x179b2c,_0x5b500e['error']['message']);return _0x32bf4b(_0x5b500e[_0xa602('0x10')][_0xa602('0x12')]);}logger[_0xa602('0x10')](_0xa602('0xc'),_0x179b2c,_0x5b500e['error'][_0xa602('0x12')]);return _0x29ed80(_0x5b500e[_0xa602('0x10')][_0xa602('0x12')]);}else{logger[_0xa602('0x13')](_0xa602('0xc'),_0x179b2c,_0xa602('0xd'));_0x29ed80(_0x5b500e[_0xa602('0x14')][_0xa602('0x12')]);}})['catch'](function(_0x2b21a0){logger[_0xa602('0x10')](_0xa602('0xc'),_0x179b2c,_0x2b21a0);_0x32bf4b(_0x2b21a0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6c229df..e491280 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 _0x9cff=['index','/:id','show','post','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x4f45c0,_0xce273){_0x4f45c0=_0x4f45c0-0x0;var _0x584a1b=_0x9cff[_0x4f45c0];return _0x584a1b;};'use strict';var multer=require('multer');var util=require(_0xf9cf('0x0'));var path=require(_0xf9cf('0x1'));var timeout=require(_0xf9cf('0x2'));var express=require('express');var router=express[_0xf9cf('0x3')]();var fs_extra=require(_0xf9cf('0x4'));var auth=require(_0xf9cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9cf('0x6'));var controller=require(_0xf9cf('0x7'));router[_0xf9cf('0x8')]('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xa')]);router[_0xf9cf('0x8')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xc')]);router[_0xf9cf('0xd')]('/',auth[_0xf9cf('0x9')](),controller['create']);router[_0xf9cf('0xe')](_0xf9cf('0xb'),auth['isAuthenticated'](),controller[_0xf9cf('0xf')]);router['delete']('/:id',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8832=['fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','show','create','put','/:id','update','multer','util','express','Router'];(function(_0x50d3a7,_0x4cb01a){var _0x186943=function(_0x76517d){while(--_0x76517d){_0x50d3a7['push'](_0x50d3a7['shift']());}};_0x186943(++_0x4cb01a);}(_0x8832,0x1f4));var _0x2883=function(_0x5b461d,_0x117523){_0x5b461d=_0x5b461d-0x0;var _0x3b8049=_0x8832[_0x5b461d];return _0x3b8049;};'use strict';var multer=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2883('0x2'));var router=express[_0x2883('0x3')]();var fs_extra=require(_0x2883('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2883('0x5'));var config=require('../../config/environment');var controller=require(_0x2883('0x6'));router[_0x2883('0x7')]('/',auth[_0x2883('0x8')](),controller['index']);router[_0x2883('0x7')]('/:id',auth[_0x2883('0x8')](),controller[_0x2883('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2883('0xa')]);router[_0x2883('0xb')](_0x2883('0xc'),auth[_0x2883('0x8')](),controller[_0x2883('0xd')]);router['delete']('/:id',auth[_0x2883('0x8')](),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 d9ab36d..48eae6a 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 _0x0dec=['sequelize','exports','STRING','name'];(function(_0x21806f,_0x1ac9c0){var _0x8654d=function(_0x1fd7f2){while(--_0x1fd7f2){_0x21806f['push'](_0x21806f['shift']());}};_0x8654d(++_0x1ac9c0);}(_0x0dec,0x11c));var _0xc0de=function(_0x981537,_0x5c9405){_0x981537=_0x981537-0x0;var _0x2c71d4=_0x0dec[_0x981537];return _0x2c71d4;};'use strict';var Sequelize=require(_0xc0de('0x0'));module[_0xc0de('0x1')]={'name':{'type':Sequelize[_0xc0de('0x2')],'unique':_0xc0de('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x847f=['exports','STRING','sequelize'];(function(_0x4047e0,_0x13e1f6){var _0x17b612=function(_0x5b4954){while(--_0x5b4954){_0x4047e0['push'](_0x4047e0['shift']());}};_0x17b612(++_0x13e1f6);}(_0x847f,0x182));var _0xf847=function(_0x56de0b,_0x1c39c1){_0x56de0b=_0x56de0b-0x0;var _0x1c05f0=_0x847f[_0x56de0b];return _0x1c05f0;};'use strict';var Sequelize=require(_0xf847('0x0'));module[_0xf847('0x1')]={'name':{'type':Sequelize[_0xf847('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf847('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c0a6d12..157d47b 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 _0x2789=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','get','Variables','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','Variable','include','findAll','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2789,0x89));var _0x9278=function(_0xa8ac5a,_0x58bf27){_0xa8ac5a=_0xa8ac5a-0x0;var _0xeb35fa=_0x2789[_0xa8ac5a];return _0xeb35fa;};'use strict';var emlformat=require(_0x9278('0x0'));var rimraf=require(_0x9278('0x1'));var zipdir=require(_0x9278('0x2'));var jsonpatch=require(_0x9278('0x3'));var rp=require('request-promise');var moment=require(_0x9278('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9278('0x5'));var path=require(_0x9278('0x6'));var sox=require(_0x9278('0x7'));var csv=require(_0x9278('0x8'));var ejs=require(_0x9278('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9278('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9278('0xb'));var toCsv=require(_0x9278('0x8'));var querystring=require(_0x9278('0xc'));var Papa=require(_0x9278('0xd'));var Redis=require(_0x9278('0xe'));var authService=require(_0x9278('0xf'));var qs=require(_0x9278('0x10'));var as=require(_0x9278('0x11'));var hardwareService=require(_0x9278('0x12'));var logger=require('../../config/logger')(_0x9278('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8364,_0xd50be8){_0xd50be8=_0xd50be8||0xcc;return function(_0x6cca2){if(_0x6cca2){return _0x2a8364[_0x9278('0x14')](_0xd50be8);}return _0x2a8364['status'](_0xd50be8)[_0x9278('0x15')]();};}function respondWithResult(_0x5a8948,_0x3384a0){_0x3384a0=_0x3384a0||0xc8;return function(_0x1439ca){if(_0x1439ca){return _0x5a8948[_0x9278('0x16')](_0x3384a0)[_0x9278('0x17')](_0x1439ca);}};}function respondWithFilteredResult(_0x176b7a,_0x55430e){return function(_0x7be45b){if(_0x7be45b){var _0x4ff1c4=typeof _0x55430e[_0x9278('0x18')]===_0x9278('0x19')&&typeof _0x55430e['limit']==='undefined';var _0x204cfc=_0x7be45b[_0x9278('0x1a')];var _0x1af4cb=_0x4ff1c4?0x0:_0x55430e[_0x9278('0x18')];var _0x3d5313=_0x4ff1c4?_0x7be45b[_0x9278('0x1a')]:_0x55430e[_0x9278('0x18')]+_0x55430e['limit'];var _0x57886d;if(_0x3d5313>=_0x204cfc){_0x3d5313=_0x204cfc;_0x57886d=0xc8;}else{_0x57886d=0xce;}_0x176b7a['status'](_0x57886d);return _0x176b7a[_0x9278('0x1b')](_0x9278('0x1c'),_0x1af4cb+'-'+_0x3d5313+'/'+_0x204cfc)[_0x9278('0x17')](_0x7be45b);}return null;};}function patchUpdates(_0x59fade){return function(_0x284016){try{jsonpatch[_0x9278('0x1d')](_0x284016,_0x59fade,!![]);}catch(_0x18915f){return BPromise['reject'](_0x18915f);}return _0x284016[_0x9278('0x1e')]();};}function saveUpdates(_0xab147d,_0x3dadff){return function(_0x52634f){if(_0x52634f){return _0x52634f[_0x9278('0x1f')](_0xab147d)[_0x9278('0x20')](function(_0x593fd0){return _0x593fd0;});}return null;};}function removeEntity(_0x253081,_0x52e357){return function(_0x1415ec){if(_0x1415ec){return _0x1415ec['destroy']()[_0x9278('0x20')](function(){var _0x37e95f=_0x1415ec[_0x9278('0x21')]({'plain':!![]});var _0x4ee2a7=_0x9278('0x22');return db['UserProfileResource'][_0x9278('0x23')]({'where':{'type':_0x4ee2a7,'resourceId':_0x37e95f['id']}})[_0x9278('0x20')](function(){return _0x1415ec;});})[_0x9278('0x20')](function(){_0x253081[_0x9278('0x16')](0xcc)[_0x9278('0x15')]();});}};}function handleEntityNotFound(_0x24cdc8,_0xd6da24){return function(_0x357325){if(!_0x357325){_0x24cdc8['sendStatus'](0x194);}return _0x357325;};}function handleError(_0x59651b,_0x4ea8d1){_0x4ea8d1=_0x4ea8d1||0x1f4;return function(_0x81e98d){logger[_0x9278('0x24')](_0x81e98d[_0x9278('0x25')]);if(_0x81e98d[_0x9278('0x26')]){delete _0x81e98d[_0x9278('0x26')];}_0x59651b[_0x9278('0x16')](_0x4ea8d1)[_0x9278('0x27')](_0x81e98d);};}exports[_0x9278('0x28')]=function(_0x57c222,_0x11fd5f){var _0x507bab={},_0xff9e1d={},_0x42b4f1={'count':0x0,'rows':[]};var _0x370078=_[_0x9278('0x29')](db['Variable'][_0x9278('0x2a')],function(_0x4f582d){return{'name':_0x4f582d['fieldName'],'type':_0x4f582d[_0x9278('0x2b')][_0x9278('0x2c')]};});_0xff9e1d[_0x9278('0x2d')]=_[_0x9278('0x29')](_0x370078,'name');_0xff9e1d['query']=_[_0x9278('0x2e')](_0x57c222[_0x9278('0x2f')]);_0xff9e1d[_0x9278('0x30')]=_['intersection'](_0xff9e1d[_0x9278('0x2d')],_0xff9e1d[_0x9278('0x2f')]);_0x507bab['attributes']=_[_0x9278('0x31')](_0xff9e1d[_0x9278('0x2d')],qs[_0x9278('0x32')](_0x57c222[_0x9278('0x2f')][_0x9278('0x32')]));_0x507bab['attributes']=_0x507bab[_0x9278('0x33')][_0x9278('0x34')]?_0x507bab[_0x9278('0x33')]:_0xff9e1d[_0x9278('0x2d')];if(!_0x57c222[_0x9278('0x2f')][_0x9278('0x35')](_0x9278('0x36'))){_0x507bab[_0x9278('0x37')]=qs[_0x9278('0x37')](_0x57c222[_0x9278('0x2f')]['limit']);_0x507bab[_0x9278('0x18')]=qs[_0x9278('0x18')](_0x57c222[_0x9278('0x2f')][_0x9278('0x18')]);}_0x507bab[_0x9278('0x38')]=qs[_0x9278('0x39')](_0x57c222['query'][_0x9278('0x39')]);_0x507bab['where']=qs['filters'](_['pick'](_0x57c222[_0x9278('0x2f')],_0xff9e1d['filters']),_0x370078);if(_0x57c222[_0x9278('0x2f')][_0x9278('0x3a')]){_0x507bab[_0x9278('0x3b')]=_[_0x9278('0x3c')](_0x507bab[_0x9278('0x3b')],{'$or':_[_0x9278('0x29')](_0x370078,function(_0x367082){if(_0x367082[_0x9278('0x2b')]!==_0x9278('0x3d')){var _0x5d29de={};_0x5d29de[_0x367082[_0x9278('0x26')]]={'$like':'%'+_0x57c222[_0x9278('0x2f')]['filter']+'%'};return _0x5d29de;}})});}_0x507bab=_[_0x9278('0x3c')]({},_0x507bab,_0x57c222[_0x9278('0x3e')]);var _0x50dd9b={'where':_0x507bab[_0x9278('0x3b')]};return db[_0x9278('0x3f')][_0x9278('0x1a')](_0x50dd9b)[_0x9278('0x20')](function(_0x233f3b){_0x42b4f1[_0x9278('0x1a')]=_0x233f3b;if(_0x57c222[_0x9278('0x2f')]['includeAll']){_0x507bab[_0x9278('0x40')]=[{'all':!![]}];}return db[_0x9278('0x3f')][_0x9278('0x41')](_0x507bab);})['then'](function(_0x7c3aa8){_0x42b4f1['rows']=_0x7c3aa8;return _0x42b4f1;})['then'](respondWithFilteredResult(_0x11fd5f,_0x507bab))['catch'](handleError(_0x11fd5f,null));};exports[_0x9278('0x42')]=function(_0x419b93,_0x15c2f6){var _0x408d5d={'raw':!![],'where':{'id':_0x419b93[_0x9278('0x43')]['id']}},_0x59f323={};_0x59f323['model']=_[_0x9278('0x2e')](db[_0x9278('0x3f')][_0x9278('0x2a')]);_0x59f323['query']=_[_0x9278('0x2e')](_0x419b93[_0x9278('0x2f')]);_0x59f323[_0x9278('0x30')]=_['intersection'](_0x59f323['model'],_0x59f323['query']);_0x408d5d[_0x9278('0x33')]=_[_0x9278('0x31')](_0x59f323['model'],qs[_0x9278('0x32')](_0x419b93['query'][_0x9278('0x32')]));_0x408d5d[_0x9278('0x33')]=_0x408d5d['attributes'][_0x9278('0x34')]?_0x408d5d['attributes']:_0x59f323[_0x9278('0x2d')];if(_0x419b93[_0x9278('0x2f')][_0x9278('0x44')]){_0x408d5d[_0x9278('0x40')]=[{'all':!![]}];}_0x408d5d=_[_0x9278('0x3c')]({},_0x408d5d,_0x419b93[_0x9278('0x3e')]);return db[_0x9278('0x3f')][_0x9278('0x45')](_0x408d5d)[_0x9278('0x20')](handleEntityNotFound(_0x15c2f6,null))['then'](respondWithResult(_0x15c2f6,null))[_0x9278('0x46')](handleError(_0x15c2f6,null));};exports[_0x9278('0x47')]=function(_0x38a24e,_0x254b58){return db[_0x9278('0x3f')]['create'](_0x38a24e[_0x9278('0x48')],{})[_0x9278('0x20')](function(_0xc01693){var _0x5710f5=_0x38a24e['user'][_0x9278('0x21')]({'plain':!![]});if(!_0x5710f5)throw new Error(_0x9278('0x49'));if(_0x5710f5['role']==='user'){var _0x1059e0=_0xc01693[_0x9278('0x21')]({'plain':!![]});var _0x4f63f2='Variables';return db[_0x9278('0x4a')][_0x9278('0x45')]({'where':{'name':_0x4f63f2,'userProfileId':_0x5710f5['userProfileId']},'raw':!![]})[_0x9278('0x20')](function(_0x180e15){if(_0x180e15&&_0x180e15['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1059e0['name'],'resourceId':_0x1059e0['id'],'type':_0x180e15[_0x9278('0x26')],'sectionId':_0x180e15['id']},{})[_0x9278('0x20')](function(){return _0xc01693;});}else{return _0xc01693;}})[_0x9278('0x46')](function(_0x16befc){logger[_0x9278('0x24')](_0x9278('0x4b'),_0x16befc);throw _0x16befc;});}return _0xc01693;})[_0x9278('0x20')](respondWithResult(_0x254b58,0xc9))[_0x9278('0x46')](handleError(_0x254b58,null));};exports[_0x9278('0x1f')]=function(_0x11ec23,_0x4aa39e){if(_0x11ec23[_0x9278('0x48')]['id']){delete _0x11ec23[_0x9278('0x48')]['id'];}return db[_0x9278('0x3f')][_0x9278('0x45')]({'where':{'id':_0x11ec23[_0x9278('0x43')]['id']}})[_0x9278('0x20')](handleEntityNotFound(_0x4aa39e,null))[_0x9278('0x20')](saveUpdates(_0x11ec23[_0x9278('0x48')],null))[_0x9278('0x20')](respondWithResult(_0x4aa39e,null))[_0x9278('0x46')](handleError(_0x4aa39e,null));};exports[_0x9278('0x23')]=function(_0x49513b,_0x338207){return db['Variable'][_0x9278('0x45')]({'where':{'id':_0x49513b[_0x9278('0x43')]['id']}})['then'](handleEntityNotFound(_0x338207,null))[_0x9278('0x20')](removeEntity(_0x338207,null))[_0x9278('0x46')](handleError(_0x338207,null));}; \ No newline at end of file +var _0x1cd1=['name','index','map','Variable','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','include','catch','show','params','length','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','UserProfileResource','error','stack'];(function(_0x4dad9e,_0x143437){var _0x34d026=function(_0x18685a){while(--_0x18685a){_0x4dad9e['push'](_0x4dad9e['shift']());}};_0x34d026(++_0x143437);}(_0x1cd1,0x15c));var _0x11cd=function(_0x4f0b8e,_0x3e5432){_0x4f0b8e=_0x4f0b8e-0x0;var _0x376504=_0x1cd1[_0x4f0b8e];return _0x376504;};'use strict';var emlformat=require(_0x11cd('0x0'));var rimraf=require(_0x11cd('0x1'));var zipdir=require(_0x11cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11cd('0x3'));var moment=require('moment');var BPromise=require(_0x11cd('0x4'));var Mustache=require(_0x11cd('0x5'));var util=require(_0x11cd('0x6'));var path=require(_0x11cd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x11cd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x11cd('0x9'));var jsforce=require(_0x11cd('0xa'));var deskjs=require(_0x11cd('0xb'));var toCsv=require(_0x11cd('0xc'));var querystring=require(_0x11cd('0xd'));var Papa=require(_0x11cd('0xe'));var Redis=require('ioredis');var authService=require(_0x11cd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11cd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11cd('0x11'))('api');var utils=require(_0x11cd('0x12'));var config=require(_0x11cd('0x13'));var licenseUtil=require(_0x11cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41e6b5,_0x40659a){_0x40659a=_0x40659a||0xcc;return function(_0x5f426b){if(_0x5f426b){return _0x41e6b5[_0x11cd('0x15')](_0x40659a);}return _0x41e6b5[_0x11cd('0x16')](_0x40659a)[_0x11cd('0x17')]();};}function respondWithResult(_0x1de07c,_0x68f440){_0x68f440=_0x68f440||0xc8;return function(_0x4922fd){if(_0x4922fd){return _0x1de07c[_0x11cd('0x16')](_0x68f440)[_0x11cd('0x18')](_0x4922fd);}};}function respondWithFilteredResult(_0x23dae2,_0x20fe82){return function(_0x5582c0){if(_0x5582c0){var _0x25732e=typeof _0x20fe82[_0x11cd('0x19')]===_0x11cd('0x1a')&&typeof _0x20fe82['limit']==='undefined';var _0x2a3049=_0x5582c0['count'];var _0x4bb857=_0x25732e?0x0:_0x20fe82[_0x11cd('0x19')];var _0x442ebf=_0x25732e?_0x5582c0['count']:_0x20fe82[_0x11cd('0x19')]+_0x20fe82[_0x11cd('0x1b')];var _0xbe38e1;if(_0x442ebf>=_0x2a3049){_0x442ebf=_0x2a3049;_0xbe38e1=0xc8;}else{_0xbe38e1=0xce;}_0x23dae2[_0x11cd('0x16')](_0xbe38e1);return _0x23dae2[_0x11cd('0x1c')]('Content-Range',_0x4bb857+'-'+_0x442ebf+'/'+_0x2a3049)[_0x11cd('0x18')](_0x5582c0);}return null;};}function patchUpdates(_0x453030){return function(_0x52c57d){try{jsonpatch[_0x11cd('0x1d')](_0x52c57d,_0x453030,!![]);}catch(_0x97746d){return BPromise[_0x11cd('0x1e')](_0x97746d);}return _0x52c57d['save']();};}function saveUpdates(_0x588dd9,_0x1248e0){return function(_0x9a1f5){if(_0x9a1f5){return _0x9a1f5[_0x11cd('0x1f')](_0x588dd9)[_0x11cd('0x20')](function(_0xf1c1b2){return _0xf1c1b2;});}return null;};}function removeEntity(_0x275292,_0x2f9427){return function(_0x2949a7){if(_0x2949a7){return _0x2949a7[_0x11cd('0x21')]()[_0x11cd('0x20')](function(){var _0x2fbc4e=_0x2949a7['get']({'plain':!![]});var _0x18aa7b='Variables';return db[_0x11cd('0x22')]['destroy']({'where':{'type':_0x18aa7b,'resourceId':_0x2fbc4e['id']}})[_0x11cd('0x20')](function(){return _0x2949a7;});})[_0x11cd('0x20')](function(){_0x275292[_0x11cd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x301212,_0x1a1651){return function(_0x430103){if(!_0x430103){_0x301212[_0x11cd('0x15')](0x194);}return _0x430103;};}function handleError(_0x3b541c,_0x1a988e){_0x1a988e=_0x1a988e||0x1f4;return function(_0x309306){logger[_0x11cd('0x23')](_0x309306[_0x11cd('0x24')]);if(_0x309306[_0x11cd('0x25')]){delete _0x309306[_0x11cd('0x25')];}_0x3b541c[_0x11cd('0x16')](_0x1a988e)['send'](_0x309306);};}exports[_0x11cd('0x26')]=function(_0x210cec,_0x1190de){var _0x1abfda={},_0x115604={},_0x26ab40={'count':0x0,'rows':[]};var _0x1a21b0=_[_0x11cd('0x27')](db[_0x11cd('0x28')][_0x11cd('0x29')],function(_0x1019d1){return{'name':_0x1019d1['fieldName'],'type':_0x1019d1[_0x11cd('0x2a')]['key']};});_0x115604[_0x11cd('0x2b')]=_[_0x11cd('0x27')](_0x1a21b0,_0x11cd('0x25'));_0x115604['query']=_[_0x11cd('0x2c')](_0x210cec[_0x11cd('0x2d')]);_0x115604[_0x11cd('0x2e')]=_[_0x11cd('0x2f')](_0x115604[_0x11cd('0x2b')],_0x115604[_0x11cd('0x2d')]);_0x1abfda[_0x11cd('0x30')]=_[_0x11cd('0x2f')](_0x115604[_0x11cd('0x2b')],qs['fields'](_0x210cec[_0x11cd('0x2d')][_0x11cd('0x31')]));_0x1abfda[_0x11cd('0x30')]=_0x1abfda[_0x11cd('0x30')]['length']?_0x1abfda['attributes']:_0x115604[_0x11cd('0x2b')];if(!_0x210cec[_0x11cd('0x2d')][_0x11cd('0x32')](_0x11cd('0x33'))){_0x1abfda[_0x11cd('0x1b')]=qs['limit'](_0x210cec[_0x11cd('0x2d')][_0x11cd('0x1b')]);_0x1abfda[_0x11cd('0x19')]=qs[_0x11cd('0x19')](_0x210cec[_0x11cd('0x2d')][_0x11cd('0x19')]);}_0x1abfda[_0x11cd('0x34')]=qs[_0x11cd('0x35')](_0x210cec[_0x11cd('0x2d')][_0x11cd('0x35')]);_0x1abfda[_0x11cd('0x36')]=qs[_0x11cd('0x2e')](_[_0x11cd('0x37')](_0x210cec[_0x11cd('0x2d')],_0x115604[_0x11cd('0x2e')]),_0x1a21b0);if(_0x210cec['query'][_0x11cd('0x38')]){_0x1abfda['where']=_['merge'](_0x1abfda['where'],{'$or':_[_0x11cd('0x27')](_0x1a21b0,function(_0x31ef4b){if(_0x31ef4b[_0x11cd('0x2a')]!==_0x11cd('0x39')){var _0x22484a={};_0x22484a[_0x31ef4b[_0x11cd('0x25')]]={'$like':'%'+_0x210cec[_0x11cd('0x2d')][_0x11cd('0x38')]+'%'};return _0x22484a;}})});}_0x1abfda=_[_0x11cd('0x3a')]({},_0x1abfda,_0x210cec['options']);var _0x5e66cc={'where':_0x1abfda[_0x11cd('0x36')]};return db[_0x11cd('0x28')][_0x11cd('0x3b')](_0x5e66cc)['then'](function(_0x1c3547){_0x26ab40[_0x11cd('0x3b')]=_0x1c3547;if(_0x210cec[_0x11cd('0x2d')]['includeAll']){_0x1abfda[_0x11cd('0x3c')]=[{'all':!![]}];}return db[_0x11cd('0x28')]['findAll'](_0x1abfda);})[_0x11cd('0x20')](function(_0x110466){_0x26ab40['rows']=_0x110466;return _0x26ab40;})[_0x11cd('0x20')](respondWithFilteredResult(_0x1190de,_0x1abfda))[_0x11cd('0x3d')](handleError(_0x1190de,null));};exports[_0x11cd('0x3e')]=function(_0x50750a,_0x4f1dc5){var _0x38c7fa={'raw':!![],'where':{'id':_0x50750a[_0x11cd('0x3f')]['id']}},_0x1c571d={};_0x1c571d[_0x11cd('0x2b')]=_['keys'](db[_0x11cd('0x28')][_0x11cd('0x29')]);_0x1c571d[_0x11cd('0x2d')]=_[_0x11cd('0x2c')](_0x50750a[_0x11cd('0x2d')]);_0x1c571d[_0x11cd('0x2e')]=_['intersection'](_0x1c571d[_0x11cd('0x2b')],_0x1c571d[_0x11cd('0x2d')]);_0x38c7fa['attributes']=_[_0x11cd('0x2f')](_0x1c571d['model'],qs[_0x11cd('0x31')](_0x50750a[_0x11cd('0x2d')][_0x11cd('0x31')]));_0x38c7fa[_0x11cd('0x30')]=_0x38c7fa['attributes'][_0x11cd('0x40')]?_0x38c7fa[_0x11cd('0x30')]:_0x1c571d[_0x11cd('0x2b')];if(_0x50750a[_0x11cd('0x2d')][_0x11cd('0x41')]){_0x38c7fa['include']=[{'all':!![]}];}_0x38c7fa=_[_0x11cd('0x3a')]({},_0x38c7fa,_0x50750a['options']);return db[_0x11cd('0x28')]['find'](_0x38c7fa)[_0x11cd('0x20')](handleEntityNotFound(_0x4f1dc5,null))[_0x11cd('0x20')](respondWithResult(_0x4f1dc5,null))['catch'](handleError(_0x4f1dc5,null));};exports[_0x11cd('0x42')]=function(_0x57e487,_0x98df57){return db[_0x11cd('0x28')]['create'](_0x57e487['body'],{})[_0x11cd('0x20')](function(_0x18fdbd){var _0x331420=_0x57e487[_0x11cd('0x43')][_0x11cd('0x44')]({'plain':!![]});if(!_0x331420)throw new Error(_0x11cd('0x45'));if(_0x331420['role']===_0x11cd('0x43')){var _0x52191e=_0x18fdbd[_0x11cd('0x44')]({'plain':!![]});var _0x5e9780=_0x11cd('0x46');return db[_0x11cd('0x47')][_0x11cd('0x48')]({'where':{'name':_0x5e9780,'userProfileId':_0x331420[_0x11cd('0x49')]},'raw':!![]})['then'](function(_0x182fc6){if(_0x182fc6&&_0x182fc6[_0x11cd('0x4a')]===0x0){return db['UserProfileResource'][_0x11cd('0x42')]({'name':_0x52191e['name'],'resourceId':_0x52191e['id'],'type':_0x182fc6[_0x11cd('0x25')],'sectionId':_0x182fc6['id']},{})['then'](function(){return _0x18fdbd;});}else{return _0x18fdbd;}})[_0x11cd('0x3d')](function(_0x2c1c4b){logger[_0x11cd('0x23')](_0x11cd('0x4b'),_0x2c1c4b);throw _0x2c1c4b;});}return _0x18fdbd;})[_0x11cd('0x20')](respondWithResult(_0x98df57,0xc9))[_0x11cd('0x3d')](handleError(_0x98df57,null));};exports[_0x11cd('0x1f')]=function(_0x5155ee,_0x208260){if(_0x5155ee[_0x11cd('0x4c')]['id']){delete _0x5155ee[_0x11cd('0x4c')]['id'];}return db[_0x11cd('0x28')][_0x11cd('0x48')]({'where':{'id':_0x5155ee[_0x11cd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x208260,null))[_0x11cd('0x20')](saveUpdates(_0x5155ee[_0x11cd('0x4c')],null))[_0x11cd('0x20')](respondWithResult(_0x208260,null))[_0x11cd('0x3d')](handleError(_0x208260,null));};exports[_0x11cd('0x21')]=function(_0x7878fa,_0x3bca54){return db['Variable'][_0x11cd('0x48')]({'where':{'id':_0x7878fa[_0x11cd('0x3f')]['id']}})[_0x11cd('0x20')](handleEntityNotFound(_0x3bca54,null))[_0x11cd('0x20')](removeEntity(_0x3bca54,null))['catch'](handleError(_0x3bca54,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 19f1d2e..7970407 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 _0xb22e=['Variable','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0x548cfe,_0x867071){var _0x5dd279=function(_0x57d78d){while(--_0x57d78d){_0x548cfe['push'](_0x548cfe['shift']());}};_0x5dd279(++_0x867071);}(_0xb22e,0x90));var _0xeb22=function(_0xc8c103,_0x6a13ca){_0xc8c103=_0xc8c103-0x0;var _0x460998=_0xb22e[_0xc8c103];return _0x460998;};'use strict';var _=require(_0xeb22('0x0'));var util=require('util');var logger=require(_0xeb22('0x1'))(_0xeb22('0x2'));var moment=require(_0xeb22('0x3'));var BPromise=require(_0xeb22('0x4'));var rp=require(_0xeb22('0x5'));var fs=require('fs');var path=require(_0xeb22('0x6'));var rimraf=require(_0xeb22('0x7'));var config=require(_0xeb22('0x8'));var attributes=require(_0xeb22('0x9'));module[_0xeb22('0xa')]=function(_0xfc8eec,_0x3b1a9b){return _0xfc8eec[_0xeb22('0xb')](_0xeb22('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x956a=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash','util','../../config/logger','moment'];(function(_0x1589be,_0x1cf6a4){var _0x21219a=function(_0x2d33ae){while(--_0x2d33ae){_0x1589be['push'](_0x1589be['shift']());}};_0x21219a(++_0x1cf6a4);}(_0x956a,0xd4));var _0xa956=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x956a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa956('0x0'));var util=require(_0xa956('0x1'));var logger=require(_0xa956('0x2'))('api');var moment=require(_0xa956('0x3'));var BPromise=require(_0xa956('0x4'));var rp=require(_0xa956('0x5'));var fs=require('fs');var path=require(_0xa956('0x6'));var rimraf=require(_0xa956('0x7'));var config=require(_0xa956('0x8'));var attributes=require(_0xa956('0x9'));module[_0xa956('0xa')]=function(_0xaa69fd,_0x553b17){return _0xaa69fd['define']('Variable',attributes,{'tableName':_0xa956('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9ecd6f8..a8c33ee 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x8bca3f,_0x158cf8){var _0x448ab5=function(_0x5b5537){while(--_0x5b5537){_0x8bca3f['push'](_0x8bca3f['shift']());}};_0x448ab5(++_0x158cf8);}(_0x3e74,0x175));var _0x43e7=function(_0x10d1ea,_0xf5a45c){_0x10d1ea=_0x10d1ea-0x0;var _0x44c45e=_0x3e74[_0x10d1ea];return _0x44c45e;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x1ccf73,_0x16e65b){var _0x28a269=function(_0x2aaa99){while(--_0x2aaa99){_0x1ccf73['push'](_0x1ccf73['shift']());}};_0x28a269(++_0x16e65b);}(_0xabce,0x103));var _0xeabc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xabce[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2080cce..2812151 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 _0xb9cd=['migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','pull','/migrations'];(function(_0xbdd912,_0x5545a2){var _0x157d7f=function(_0x462248){while(--_0x462248){_0xbdd912['push'](_0xbdd912['shift']());}};_0x157d7f(++_0x5545a2);}(_0xb9cd,0x18e));var _0xdb9c=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0xb9cd[_0x11b8ae];return _0x35a448;};'use strict';var express=require(_0xdb9c('0x0'));var router=express['Router']();var auth=require(_0xdb9c('0x1'));var controller=require(_0xdb9c('0x2'));router[_0xdb9c('0x3')]('/',controller[_0xdb9c('0x4')]);router['get'](_0xdb9c('0x5'),auth[_0xdb9c('0x6')](),auth[_0xdb9c('0x7')](),controller['fetch']);router[_0xdb9c('0x3')]('/reset',auth[_0xdb9c('0x6')](),auth['canUpdate'](),controller['reset']);router[_0xdb9c('0x3')]('/pull',auth[_0xdb9c('0x6')](),auth[_0xdb9c('0x7')](),controller[_0xdb9c('0x8')]);router['get']('/restart',auth[_0xdb9c('0x6')](),controller['restart']);router[_0xdb9c('0x3')](_0xdb9c('0x9'),controller[_0xdb9c('0xa')]);module[_0xdb9c('0xb')]=router; \ No newline at end of file +var _0x6f63=['exports','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','migrations'];(function(_0x294e05,_0x39600f){var _0x274d68=function(_0x2f0127){while(--_0x2f0127){_0x294e05['push'](_0x294e05['shift']());}};_0x274d68(++_0x39600f);}(_0x6f63,0x178));var _0x36f6=function(_0x5bdad1,_0x26f47b){_0x5bdad1=_0x5bdad1-0x0;var _0x4e24ee=_0x6f63[_0x5bdad1];return _0x4e24ee;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x36f6('0x0'));var controller=require('./version.controller');router[_0x36f6('0x1')]('/',controller[_0x36f6('0x2')]);router['get'](_0x36f6('0x3'),auth[_0x36f6('0x4')](),auth[_0x36f6('0x5')](),controller[_0x36f6('0x6')]);router[_0x36f6('0x1')](_0x36f6('0x7'),auth['isAuthenticated'](),auth[_0x36f6('0x5')](),controller[_0x36f6('0x8')]);router[_0x36f6('0x1')](_0x36f6('0x9'),auth['isAuthenticated'](),auth[_0x36f6('0x5')](),controller[_0x36f6('0xa')]);router['get'](_0x36f6('0xb'),auth[_0x36f6('0x4')](),controller['restart']);router[_0x36f6('0x1')](_0x36f6('0xc'),controller[_0x36f6('0xd')]);module[_0x36f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f5c15b8..428e587 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 _0x9b77=['catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','error','info','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x9b77,0x102));var _0x79b7=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x9b77[_0x46401e];return _0x447cba;};'use strict';var Umzug=require(_0x79b7('0x0'));var path=require(_0x79b7('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x79b7('0x2'))(module,_0x79b7('0x3'));var compareVersions=require(_0x79b7('0x4'));var exec=require(_0x79b7('0x5'))[_0x79b7('0x6')];var db=require(_0x79b7('0x7'))['db'];var config=require(_0x79b7('0x8'));var pm2=require(_0x79b7('0x9'));var logger=require(_0x79b7('0xa'))(_0x79b7('0xb'));var git=require('simple-git')(config[_0x79b7('0xc')]);exports[_0x79b7('0xd')]=function(_0xb6c530,_0x588da9){var _0x7417bd={'current':module[_0x79b7('0xe')]['version'],'phonebar':0x2};if(_0xb6c530[_0x79b7('0xf')]&&_0xb6c530[_0x79b7('0xf')]['latest']){return git[_0x79b7('0x10')]()[_0x79b7('0x11')](function(_0x6c77a6,_0xf9fd9f){_0x7417bd[_0x79b7('0x12')]=(_0x6c77a6?module[_0x79b7('0xe')][_0x79b7('0x3')]:_0xf9fd9f[_0x79b7('0x12')])||_0x79b7('0x13');return _0x588da9[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')](_0x7417bd);});}else{return _0x588da9[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')](_0x7417bd);}};exports[_0x79b7('0x10')]=function(_0x317678,_0x621c69){return git[_0x79b7('0x10')]([_0x79b7('0x16'),'master'],function(_0x26664d){if(_0x26664d){logger['error'](_0x26664d);return _0x621c69['status'](0x1f4)['json'](_0x26664d);}logger['info']('git\x20fetch');return _0x621c69[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':_0x79b7('0x17')});});};exports[_0x79b7('0x18')]=function(_0x30aeb3,_0x59f13a){return git[_0x79b7('0x18')](['--hard',_0x79b7('0x19')],function(_0x14e7e7){if(_0x14e7e7){logger[_0x79b7('0x1a')](_0x14e7e7);return _0x59f13a[_0x79b7('0x14')](0x1f4)[_0x79b7('0x15')](_0x14e7e7);}logger[_0x79b7('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x59f13a[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x439f4a,_0x7b0240){exec(_0x79b7('0x1c'),function(_0x105b17,_0x4af384,_0x1d2a39){logger[_0x79b7('0x1b')](_0x4af384);logger['info'](_0x1d2a39);if(_0x105b17){logger['error'](_0x105b17);return _0x7b0240[_0x79b7('0x14')](0x1f4)[_0x79b7('0x15')](_0x105b17);}return _0x7b0240[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':_0x4af384});});};exports[_0x79b7('0x1d')]=function(_0x3aa991,_0x22e242){return pm2[_0x79b7('0x1d')](_0x79b7('0x1e'))['then'](function(_0x8fff1c){logger[_0x79b7('0x1b')]('pm2\x20restart\x20motion\x20%s',_0x8fff1c);return _0x22e242[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':_0x79b7('0x1f')});})['catch'](function(_0x3c9559){logger[_0x79b7('0x1a')](_0x3c9559);return _0x22e242[_0x79b7('0x14')](0x1f4)[_0x79b7('0x15')](_0x3c9559);});};exports[_0x79b7('0x20')]=function(_0x9d7146,_0x5566ed){var _0x3fa890=fs[_0x79b7('0x21')](path['join'](config[_0x79b7('0xc')],_0x79b7('0x22'),_0x79b7('0x20')));var _0x28c249=[];for(var _0x1f7e68=0x0;_0x1f7e68<_0x3fa890[_0x79b7('0x23')];_0x1f7e68++){var _0x56eab1=_0x3fa890[_0x1f7e68][_0x79b7('0x24')](_0x79b7('0x25'),'');if(compareVersions(module[_0x79b7('0xe')]['version'],_0x56eab1)===-0x1){_0x28c249['push'](_0x56eab1);}}if(_0x28c249[_0x79b7('0x23')]){var _0x592722=_0x28c249[_0x79b7('0x26')](compareVersions);var _0x3b70aa=new Umzug({'storage':_0x79b7('0x27'),'storageOptions':{'model':db[_0x79b7('0x28')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x79b7('0x27')][_0x79b7('0x29')](),db[_0x79b7('0x27')][_0x79b7('0x2a')],function(){throw new Error(_0x79b7('0x2b'));}],'path':path['join'](config[_0x79b7('0xc')],_0x79b7('0x22'),_0x79b7('0x20')),'pattern':/\.js$/}});_0x3b70aa['up']({'migrations':_['map'](_0x592722,function(_0x91a62b){return _0x91a62b+_0x79b7('0x25');})})['then'](function(){return _0x5566ed[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':_0x79b7('0x2c')+module[_0x79b7('0xe')][_0x79b7('0x3')]+_0x79b7('0x2d')+_[_0x79b7('0x2e')](_0x592722),'migrations':_[_0x79b7('0x2f')](_0x592722)});})[_0x79b7('0x30')](function(_0x18d103){if(_0x18d103 instanceof db['sequelize'][_0x79b7('0x31')]){return _0x5566ed['status'](0xc8)[_0x79b7('0x15')]({'output':_0x79b7('0x32')});}else{return _0x5566ed['status'](0x1f4)['json'](_0x18d103);}});}else{return _0x5566ed[_0x79b7('0x14')](0xc8)[_0x79b7('0x15')]({'output':_0x79b7('0x32')});}}; \ No newline at end of file +var _0xe1d4=['latest','tags','json','fetch','master','error','info','git\x20fetch','status','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','map','then','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','query'];(function(_0x59bc2e,_0x265bfd){var _0x2dd119=function(_0x16f563){while(--_0x16f563){_0x59bc2e['push'](_0x59bc2e['shift']());}};_0x2dd119(++_0x265bfd);}(_0xe1d4,0x1ee));var _0x4e1d=function(_0x52207e,_0x55115d){_0x52207e=_0x52207e-0x0;var _0x11c4e0=_0xe1d4[_0x52207e];return _0x11c4e0;};'use strict';var Umzug=require(_0x4e1d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x4e1d('0x1'));var pkginfo=require(_0x4e1d('0x2'))(module,'version');var compareVersions=require(_0x4e1d('0x3'));var exec=require(_0x4e1d('0x4'))[_0x4e1d('0x5')];var db=require(_0x4e1d('0x6'))['db'];var config=require(_0x4e1d('0x7'));var pm2=require(_0x4e1d('0x8'));var logger=require(_0x4e1d('0x9'))(_0x4e1d('0xa'));var git=require(_0x4e1d('0xb'))(config['root']);exports[_0x4e1d('0xc')]=function(_0x3bb6b7,_0x569eee){var _0x2acf8a={'current':module[_0x4e1d('0xd')][_0x4e1d('0xe')],'phonebar':0x2};if(_0x3bb6b7['query']&&_0x3bb6b7[_0x4e1d('0xf')][_0x4e1d('0x10')]){return git['fetch']()[_0x4e1d('0x11')](function(_0x4ccf7d,_0x3b8e0a){_0x2acf8a[_0x4e1d('0x10')]=(_0x4ccf7d?module[_0x4e1d('0xd')][_0x4e1d('0xe')]:_0x3b8e0a[_0x4e1d('0x10')])||'2.0.0';return _0x569eee['status'](0xc8)['json'](_0x2acf8a);});}else{return _0x569eee['status'](0xc8)[_0x4e1d('0x12')](_0x2acf8a);}};exports[_0x4e1d('0x13')]=function(_0x5e772c,_0x276579){return git[_0x4e1d('0x13')](['origin',_0x4e1d('0x14')],function(_0x7a25a1){if(_0x7a25a1){logger[_0x4e1d('0x15')](_0x7a25a1);return _0x276579['status'](0x1f4)[_0x4e1d('0x12')](_0x7a25a1);}logger[_0x4e1d('0x16')](_0x4e1d('0x17'));return _0x276579[_0x4e1d('0x18')](0xc8)[_0x4e1d('0x12')]({'output':_0x4e1d('0x19')});});};exports[_0x4e1d('0x1a')]=function(_0x207290,_0x1f9a39){return git[_0x4e1d('0x1a')]([_0x4e1d('0x1b'),'FETCH_HEAD'],function(_0x3cf8ed){if(_0x3cf8ed){logger[_0x4e1d('0x15')](_0x3cf8ed);return _0x1f9a39[_0x4e1d('0x18')](0x1f4)[_0x4e1d('0x12')](_0x3cf8ed);}logger[_0x4e1d('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1f9a39[_0x4e1d('0x18')](0xc8)[_0x4e1d('0x12')]({'output':_0x4e1d('0x1c')});});};exports[_0x4e1d('0x1d')]=function(_0x34a641,_0x554e97){exec('npm\x20install\x20--production',function(_0x159d6b,_0x2c2acf,_0xd26c7c){logger[_0x4e1d('0x16')](_0x2c2acf);logger['info'](_0xd26c7c);if(_0x159d6b){logger[_0x4e1d('0x15')](_0x159d6b);return _0x554e97[_0x4e1d('0x18')](0x1f4)['json'](_0x159d6b);}return _0x554e97[_0x4e1d('0x18')](0xc8)[_0x4e1d('0x12')]({'output':_0x2c2acf});});};exports[_0x4e1d('0x1e')]=function(_0x271181,_0x32dacf){return pm2[_0x4e1d('0x1e')](_0x4e1d('0x1f'))['then'](function(_0x589ecc){logger['info'](_0x4e1d('0x20'),_0x589ecc);return _0x32dacf[_0x4e1d('0x18')](0xc8)['json']({'output':_0x4e1d('0x21')});})[_0x4e1d('0x22')](function(_0x3e3783){logger[_0x4e1d('0x15')](_0x3e3783);return _0x32dacf[_0x4e1d('0x18')](0x1f4)[_0x4e1d('0x12')](_0x3e3783);});};exports[_0x4e1d('0x23')]=function(_0x5e59c1,_0xd12160){var _0x303aed=fs['readdirSync'](path[_0x4e1d('0x24')](config[_0x4e1d('0x25')],_0x4e1d('0x26'),_0x4e1d('0x23')));var _0xc7c9f5=[];for(var _0xf8a767=0x0;_0xf8a767<_0x303aed[_0x4e1d('0x27')];_0xf8a767++){var _0x50880a=_0x303aed[_0xf8a767][_0x4e1d('0x28')](_0x4e1d('0x29'),'');if(compareVersions(module[_0x4e1d('0xd')]['version'],_0x50880a)===-0x1){_0xc7c9f5['push'](_0x50880a);}}if(_0xc7c9f5[_0x4e1d('0x27')]){var _0x5efa31=_0xc7c9f5[_0x4e1d('0x2a')](compareVersions);var _0x5a9b90=new Umzug({'storage':_0x4e1d('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x4e1d('0x2c'),'columnName':_0x4e1d('0xe')},'migrations':{'params':[db[_0x4e1d('0x2b')][_0x4e1d('0x2d')](),db['sequelize'][_0x4e1d('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x4e1d('0x24')](config[_0x4e1d('0x25')],_0x4e1d('0x26'),_0x4e1d('0x23')),'pattern':/\.js$/}});_0x5a9b90['up']({'migrations':_[_0x4e1d('0x2f')](_0x5efa31,function(_0x189088){return _0x189088+'.js';})})[_0x4e1d('0x30')](function(){return _0xd12160[_0x4e1d('0x18')](0xc8)[_0x4e1d('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x4e1d('0xd')]['version']+'\x20to\x20'+_[_0x4e1d('0x31')](_0x5efa31),'migrations':_[_0x4e1d('0x24')](_0x5efa31)});})[_0x4e1d('0x22')](function(_0x5373ac){if(_0x5373ac instanceof db[_0x4e1d('0x2b')]['UniqueConstraintError']){return _0xd12160['status'](0xc8)['json']({'output':_0x4e1d('0x32')});}else{return _0xd12160[_0x4e1d('0x18')](0x1f4)['json'](_0x5373ac);}});}else{return _0xd12160[_0x4e1d('0x18')](0xc8)['json']({'output':_0x4e1d('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index edcfde4..369a28a 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 _0x401a=['get','isAuthenticated','index','/describe','describe','/:id','show','post','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29e669,_0x275d8e){var _0x4b7ba7=function(_0x26eac9){while(--_0x26eac9){_0x29e669['push'](_0x29e669['shift']());}};_0x4b7ba7(++_0x275d8e);}(_0x401a,0x83));var _0xa401=function(_0x3d6449,_0x2cfb57){_0x3d6449=_0x3d6449-0x0;var _0x10d0b3=_0x401a[_0x3d6449];return _0x10d0b3;};'use strict';var multer=require('multer');var util=require(_0xa401('0x0'));var path=require(_0xa401('0x1'));var timeout=require(_0xa401('0x2'));var express=require(_0xa401('0x3'));var router=express[_0xa401('0x4')]();var fs_extra=require(_0xa401('0x5'));var auth=require(_0xa401('0x6'));var interaction=require(_0xa401('0x7'));var config=require(_0xa401('0x8'));var controller=require('./voiceAgentReport.controller');router[_0xa401('0x9')]('/',auth[_0xa401('0xa')](),controller[_0xa401('0xb')]);router[_0xa401('0x9')](_0xa401('0xc'),auth[_0xa401('0xa')](),controller[_0xa401('0xd')]);router[_0xa401('0x9')](_0xa401('0xe'),auth[_0xa401('0xa')](),controller[_0xa401('0xf')]);router[_0xa401('0x10')]('/',auth[_0xa401('0xa')](),controller['create']);router['put']('/:id',auth[_0xa401('0xa')](),controller['update']);router[_0xa401('0x11')](_0xa401('0xe'),auth[_0xa401('0xa')](),controller[_0xa401('0x12')]);module[_0xa401('0x13')]=router; \ No newline at end of file +var _0xf71a=['update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x28cedb,_0x34b257){var _0x2a3926=function(_0x4019e0){while(--_0x4019e0){_0x28cedb['push'](_0x28cedb['shift']());}};_0x2a3926(++_0x34b257);}(_0xf71a,0xb7));var _0xaf71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf71a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xaf71('0x0'));var util=require('util');var path=require(_0xaf71('0x1'));var timeout=require(_0xaf71('0x2'));var express=require(_0xaf71('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf71('0x4'));var interaction=require(_0xaf71('0x5'));var config=require(_0xaf71('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xaf71('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaf71('0x7')](_0xaf71('0x8'),auth[_0xaf71('0x9')](),controller['describe']);router[_0xaf71('0x7')](_0xaf71('0xa'),auth[_0xaf71('0x9')](),controller[_0xaf71('0xb')]);router[_0xaf71('0xc')]('/',auth[_0xaf71('0x9')](),controller[_0xaf71('0xd')]);router[_0xaf71('0xe')](_0xaf71('0xa'),auth['isAuthenticated'](),controller[_0xaf71('0xf')]);router[_0xaf71('0x10')](_0xaf71('0xa'),auth[_0xaf71('0x9')](),controller['destroy']);module[_0xaf71('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f022aed..7a484ac 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 _0xd509=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xd250ec,_0x446153){var _0x108b01=function(_0x3ce68f){while(--_0x3ce68f){_0xd250ec['push'](_0xd250ec['shift']());}};_0x108b01(++_0x446153);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9d50('0x0')]},'uniqueid':{'type':Sequelize[_0x9d50('0x0')]},'calleridnum':{'type':Sequelize[_0x9d50('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9d50('0x0')]},'membername':{'type':Sequelize[_0x9d50('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x9d50('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x9d50('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x9d50('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x9d50('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9d50('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9d50('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9d50('0x2')]},'agentacw':{'type':Sequelize[_0x9d50('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9d50('0x2')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x9d50('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9d50('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9d50('0x0')]},'language':{'type':Sequelize[_0x9d50('0x0')]},'accountcode':{'type':Sequelize[_0x9d50('0x0')]},'context':{'type':Sequelize[_0x9d50('0x0')]},'exten':{'type':Sequelize[_0x9d50('0x0')]},'priority':{'type':Sequelize[_0x9d50('0x0')]},'destchannel':{'type':Sequelize[_0x9d50('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9d50('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9d50('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x9d50('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x9d50('0x0')]},'destlanguage':{'type':Sequelize[_0x9d50('0x0')]},'destaccountcode':{'type':Sequelize[_0x9d50('0x0')]},'destcontext':{'type':Sequelize[_0x9d50('0x0')]},'destexten':{'type':Sequelize[_0x9d50('0x0')]},'destpriority':{'type':Sequelize[_0x9d50('0x0')]},'destuniqueid':{'type':Sequelize[_0x9d50('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9d50('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x9d50('0x0')]},'transfer':{'type':Sequelize[_0x9d50('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9d50('0x4')},'transferexten':{'type':Sequelize[_0x9d50('0x0')]},'transferuniqueid':{'type':Sequelize[_0x9d50('0x0')]},'agententerreason':{'type':Sequelize[_0x9d50('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x117c=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE'];(function(_0x9dacf,_0xa1570c){var _0x231b30=function(_0x44651d){while(--_0x44651d){_0x9dacf['push'](_0x9dacf['shift']());}};_0x231b30(++_0xa1570c);}(_0x117c,0x71));var _0xc117=function(_0x1c0991,_0x4f22d2){_0x1c0991=_0x1c0991-0x0;var _0x5034de=_0x117c[_0x1c0991];return _0x5034de;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc117('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc117('0x0')]},'interface':{'type':Sequelize[_0xc117('0x0')]},'membername':{'type':Sequelize[_0xc117('0x0')]},'agentcalledAt':{'type':Sequelize[_0xc117('0x1')]},'agentconnectAt':{'type':Sequelize[_0xc117('0x1')]},'agentcompleteAt':{'type':Sequelize[_0xc117('0x1')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xc117('0x1')]},'holdtime':{'type':Sequelize[_0xc117('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc117('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc117('0x2')]},'agentacw':{'type':Sequelize[_0xc117('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc117('0x2')]},'reason':{'type':Sequelize[_0xc117('0x0')]},'lastevent':{'type':Sequelize[_0xc117('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc117('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc117('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc117('0x0')]},'accountcode':{'type':Sequelize[_0xc117('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc117('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc117('0x0')]},'destchannelstate':{'type':Sequelize[_0xc117('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc117('0x0')]},'destcalleridnum':{'type':Sequelize[_0xc117('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xc117('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc117('0x0')]},'destlanguage':{'type':Sequelize[_0xc117('0x0')]},'destaccountcode':{'type':Sequelize[_0xc117('0x0')]},'destcontext':{'type':Sequelize[_0xc117('0x0')]},'destexten':{'type':Sequelize[_0xc117('0x0')]},'destpriority':{'type':Sequelize[_0xc117('0x0')]},'destuniqueid':{'type':Sequelize[_0xc117('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc117('0x0')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc117('0x0')],'comment':_0xc117('0x4')},'transferexten':{'type':Sequelize[_0xc117('0x0')]},'transferuniqueid':{'type':Sequelize[_0xc117('0x0')]},'agententerreason':{'type':Sequelize[_0xc117('0x2')],'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 2154b3d..e0c3081 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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 2fd6aeb..d9e7451 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 _0x6753=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x6753,0xa1));var _0x3675=function(_0x1031e2,_0x5ee7a9){_0x1031e2=_0x1031e2-0x0;var _0x55408a=_0x6753[_0x1031e2];return _0x55408a;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3675('0xb'),_0x3675('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x434a6c,_0x270420){var _0x5f433b=function(_0x3b92f5){while(--_0x3b92f5){_0x434a6c['push'](_0x434a6c['shift']());}};_0x5f433b(++_0x270420);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x4ef7e2,_0x257e37){_0x4ef7e2=_0x4ef7e2-0x0;var _0x84fa8=_0x3d6d[_0x4ef7e2];return _0x84fa8;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var logger=require(_0xd3d6('0x2'))(_0xd3d6('0x3'));var moment=require(_0xd3d6('0x4'));var BPromise=require(_0xd3d6('0x5'));var rp=require(_0xd3d6('0x6'));var fs=require('fs');var path=require(_0xd3d6('0x7'));var rimraf=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var attributes=require(_0xd3d6('0xa'));module['exports']=function(_0x5400f8,_0x3f36){return _0x5400f8[_0xd3d6('0xb')](_0xd3d6('0xc'),attributes,{'tableName':_0xd3d6('0xd'),'paranoid':![],'indexes':[{'fields':[_0xd3d6('0xe'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f80a514..19128cd 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 _0x1264=['create','body','options','raw','catch','VoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport'];(function(_0x197683,_0x21df72){var _0x137639=function(_0x46b902){while(--_0x46b902){_0x197683['push'](_0x197683['shift']());}};_0x137639(++_0x21df72);}(_0x1264,0x102));var _0x4126=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x1264[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0x4126('0x0'));var util=require(_0x4126('0x1'));var moment=require(_0x4126('0x2'));var BPromise=require(_0x4126('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4126('0x4'));var logger=require('../../config/logger')(_0x4126('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4126('0x6')][_0x4126('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47f545,_0x4058d5,_0x1ae51a){return new BPromise(function(_0x4c65aa,_0x1a176b){return client[_0x4126('0x8')](_0x47f545,_0x1ae51a)[_0x4126('0x9')](function(_0x3c4f12){logger[_0x4126('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x4058d5,_0x4126('0xb'));logger[_0x4126('0xc')](_0x4126('0xd'),_0x4058d5,_0x4126('0xb'),JSON[_0x4126('0xe')](_0x3c4f12));if(_0x3c4f12[_0x4126('0xf')]){if(_0x3c4f12['error'][_0x4126('0x10')]===0x1f4){logger[_0x4126('0xf')](_0x4126('0x11'),_0x4058d5,_0x3c4f12[_0x4126('0xf')][_0x4126('0x12')]);return _0x1a176b(_0x3c4f12[_0x4126('0xf')]['message']);}logger[_0x4126('0xf')](_0x4126('0x11'),_0x4058d5,_0x3c4f12[_0x4126('0xf')][_0x4126('0x12')]);return _0x4c65aa(_0x3c4f12[_0x4126('0xf')]['message']);}else{logger[_0x4126('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x4058d5,_0x4126('0xb'));_0x4c65aa(_0x3c4f12[_0x4126('0x13')][_0x4126('0x12')]);}})['catch'](function(_0x123b15){logger[_0x4126('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x4058d5,_0x123b15);_0x1a176b(_0x123b15);});});}exports[_0x4126('0x14')]=function(_0x4baecc){var _0x47e05a=this;return new Promise(function(_0x124b84,_0x4e53fd){return db['VoiceAgentReport'][_0x4126('0x15')](_0x4baecc[_0x4126('0x16')],{'raw':_0x4baecc[_0x4126('0x17')]?_0x4baecc[_0x4126('0x17')][_0x4126('0x18')]===undefined?!![]:![]:!![]})[_0x4126('0x9')](function(_0x2c0216){logger[_0x4126('0xa')](_0x4126('0x14'),_0x4baecc);logger[_0x4126('0xc')]('CreateVoiceAgentReport',_0x4baecc,JSON[_0x4126('0xe')](_0x2c0216));_0x124b84(_0x2c0216);})[_0x4126('0x19')](function(_0x532b26){logger['error'](_0x4126('0x14'),_0x532b26['message'],_0x4baecc);_0x4e53fd(_0x47e05a['error'](0x1f4,_0x532b26[_0x4126('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x259e8f){var _0x4d8ad8=this;return new Promise(function(_0x105a9e,_0x55667d){return db[_0x4126('0x1a')]['update'](_0x259e8f[_0x4126('0x16')],{'raw':_0x259e8f[_0x4126('0x17')]?_0x259e8f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259e8f[_0x4126('0x17')]?_0x259e8f[_0x4126('0x17')][_0x4126('0x1b')]||null:null,'attributes':_0x259e8f[_0x4126('0x17')]?_0x259e8f[_0x4126('0x17')][_0x4126('0x1c')]||null:null,'limit':_0x259e8f['options']?_0x259e8f['options'][_0x4126('0x1d')]||null:null})[_0x4126('0x9')](function(_0x387418){logger[_0x4126('0xa')](_0x4126('0x1e'),_0x259e8f);logger[_0x4126('0xc')](_0x4126('0x1e'),_0x259e8f,JSON['stringify'](_0x387418));_0x105a9e(_0x387418);})['catch'](function(_0x61b35f){logger['error'](_0x4126('0x1e'),_0x61b35f[_0x4126('0x12')],_0x259e8f);_0x55667d(_0x4d8ad8['error'](0x1f4,_0x61b35f[_0x4126('0x12')]));});});}; \ No newline at end of file +var _0x7b82=['VoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateVoiceAgentReport'];(function(_0x592a14,_0x501be9){var _0x474307=function(_0x41eb14){while(--_0x41eb14){_0x592a14['push'](_0x592a14['shift']());}};_0x474307(++_0x501be9);}(_0x7b82,0xab));var _0x27b8=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7b82[_0x32b542];return _0x554d54;};'use strict';var _=require('lodash');var util=require(_0x27b8('0x0'));var moment=require('moment');var BPromise=require(_0x27b8('0x1'));var rs=require(_0x27b8('0x2'));var fs=require('fs');var Redis=require(_0x27b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27b8('0x4'));var logger=require(_0x27b8('0x5'))(_0x27b8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x27b8('0x7')][_0x27b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x984c24,_0x3dbb2d,_0x2eb106){return new BPromise(function(_0x248a8c,_0xbacee0){return client[_0x27b8('0x9')](_0x984c24,_0x2eb106)[_0x27b8('0xa')](function(_0x18bdd0){logger['info'](_0x27b8('0xb'),_0x3dbb2d,_0x27b8('0xc'));logger['debug'](_0x27b8('0xd'),_0x3dbb2d,_0x27b8('0xc'),JSON[_0x27b8('0xe')](_0x18bdd0));if(_0x18bdd0[_0x27b8('0xf')]){if(_0x18bdd0[_0x27b8('0xf')]['code']===0x1f4){logger[_0x27b8('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x3dbb2d,_0x18bdd0[_0x27b8('0xf')][_0x27b8('0x10')]);return _0xbacee0(_0x18bdd0[_0x27b8('0xf')][_0x27b8('0x10')]);}logger['error'](_0x27b8('0xb'),_0x3dbb2d,_0x18bdd0['error'][_0x27b8('0x10')]);return _0x248a8c(_0x18bdd0['error'][_0x27b8('0x10')]);}else{logger[_0x27b8('0x11')](_0x27b8('0xb'),_0x3dbb2d,_0x27b8('0xc'));_0x248a8c(_0x18bdd0[_0x27b8('0x12')][_0x27b8('0x10')]);}})[_0x27b8('0x13')](function(_0x1ff0ef){logger['error'](_0x27b8('0xb'),_0x3dbb2d,_0x1ff0ef);_0xbacee0(_0x1ff0ef);});});}exports[_0x27b8('0x14')]=function(_0x4210f1){var _0x4690e9=this;return new Promise(function(_0x525b76,_0x89b1de){return db[_0x27b8('0x15')][_0x27b8('0x16')](_0x4210f1[_0x27b8('0x17')],{'raw':_0x4210f1[_0x27b8('0x18')]?_0x4210f1['options'][_0x27b8('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x521c15){logger[_0x27b8('0x11')](_0x27b8('0x14'),_0x4210f1);logger[_0x27b8('0x1a')]('CreateVoiceAgentReport',_0x4210f1,JSON[_0x27b8('0xe')](_0x521c15));_0x525b76(_0x521c15);})['catch'](function(_0x57388d){logger['error']('CreateVoiceAgentReport',_0x57388d[_0x27b8('0x10')],_0x4210f1);_0x89b1de(_0x4690e9[_0x27b8('0xf')](0x1f4,_0x57388d[_0x27b8('0x10')]));});});};exports[_0x27b8('0x1b')]=function(_0x15a9ce){var _0x52e62e=this;return new Promise(function(_0x394598,_0x276d2b){return db[_0x27b8('0x15')][_0x27b8('0x1c')](_0x15a9ce[_0x27b8('0x17')],{'raw':_0x15a9ce[_0x27b8('0x18')]?_0x15a9ce[_0x27b8('0x18')][_0x27b8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15a9ce['options']?_0x15a9ce[_0x27b8('0x18')][_0x27b8('0x1d')]||null:null,'attributes':_0x15a9ce[_0x27b8('0x18')]?_0x15a9ce['options'][_0x27b8('0x1e')]||null:null,'limit':_0x15a9ce['options']?_0x15a9ce[_0x27b8('0x18')][_0x27b8('0x1f')]||null:null})[_0x27b8('0xa')](function(_0x22fe4d){logger[_0x27b8('0x11')]('UpdateVoiceAgentReport',_0x15a9ce);logger['debug']('UpdateVoiceAgentReport',_0x15a9ce,JSON[_0x27b8('0xe')](_0x22fe4d));_0x394598(_0x22fe4d);})[_0x27b8('0x13')](function(_0x5b93e9){logger['error'](_0x27b8('0x1b'),_0x5b93e9[_0x27b8('0x10')],_0x15a9ce);_0x276d2b(_0x52e62e['error'](0x1f4,_0x5b93e9[_0x27b8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 24dcbe3..54e7a62 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 _0xf69d=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf69d,0xd3));var _0xdf69=function(_0x51f454,_0x39e838){_0x51f454=_0x51f454-0x0;var _0x2ba9cb=_0xf69d[_0x51f454];return _0x2ba9cb;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x14')]);router[_0xdf69('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3c6c=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x3c0a03,_0x4ba498){var _0x169e51=function(_0x4eba41){while(--_0x4eba41){_0x3c0a03['push'](_0x3c0a03['shift']());}};_0x169e51(++_0x4ba498);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x5dcfdc,_0x52582e){_0x5dcfdc=_0x5dcfdc-0x0;var _0x104a02=_0x3c6c[_0x5dcfdc];return _0x104a02;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./voiceCallReport.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0xd')]('/',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router[_0xc3c6('0xf')]('/:id',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x10')]);router[_0xc3c6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc3c6('0x12')]);module[_0xc3c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c4e6117..89bc1ea 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 _0x696e=['INTEGER','sequelize','STRING','ENUM','internal','outbound','dialer','DATE'];(function(_0x149041,_0x140e26){var _0x4b99f6=function(_0x3dea54){while(--_0x3dea54){_0x149041['push'](_0x149041['shift']());}};_0x4b99f6(++_0x140e26);}(_0x696e,0x1d1));var _0xe696=function(_0x2a6817,_0x8c7aa3){_0x2a6817=_0x2a6817-0x0;var _0x294cf8=_0x696e[_0x2a6817];return _0x294cf8;};'use strict';var Sequelize=require(_0xe696('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe696('0x1')]},'type':{'type':Sequelize[_0xe696('0x2')]('inbound',_0xe696('0x3'),_0xe696('0x4'),'inbound-fax','outbound-fax',_0xe696('0x5'))},'tag':{'type':Sequelize[_0xe696('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xe696('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xe696('0x1')]},'callerid':{'type':Sequelize[_0xe696('0x1')]},'channel':{'type':Sequelize[_0xe696('0x1')]},'destinationchannel':{'type':Sequelize[_0xe696('0x1')]},'lastapplication':{'type':Sequelize[_0xe696('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe696('0x6')]},'systemanswertime':{'type':Sequelize[_0xe696('0x6')]},'answertime':{'type':Sequelize[_0xe696('0x6')]},'endtime':{'type':Sequelize[_0xe696('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe696('0x7')]},'mohtime':{'type':Sequelize[_0xe696('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xe696('0x1')]},'userfield':{'type':Sequelize[_0xe696('0x1')]},'userDisposition':{'type':Sequelize[_0xe696('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xe696('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xe696('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe696('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xe696('0x1')]}}; \ No newline at end of file +var _0x9a67=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','inbound-fax'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9a67,0x117));var _0x79a6=function(_0x793c45,_0x22a198){_0x793c45=_0x793c45-0x0;var _0x379aa7=_0x9a67[_0x793c45];return _0x379aa7;};'use strict';var Sequelize=require(_0x79a6('0x0'));module[_0x79a6('0x1')]={'uniqueid':{'type':Sequelize[_0x79a6('0x2')]},'type':{'type':Sequelize[_0x79a6('0x3')](_0x79a6('0x4'),_0x79a6('0x5'),'outbound',_0x79a6('0x6'),'outbound-fax',_0x79a6('0x7'))},'tag':{'type':Sequelize[_0x79a6('0x2')]},'accountcode':{'type':Sequelize[_0x79a6('0x2')]},'source':{'type':Sequelize[_0x79a6('0x2')]},'destination':{'type':Sequelize[_0x79a6('0x2')]},'destinationcontext':{'type':Sequelize[_0x79a6('0x2')]},'callerid':{'type':Sequelize[_0x79a6('0x2')]},'channel':{'type':Sequelize[_0x79a6('0x2')]},'destinationchannel':{'type':Sequelize[_0x79a6('0x2')]},'lastapplication':{'type':Sequelize[_0x79a6('0x2')]},'lastdata':{'type':Sequelize[_0x79a6('0x8')]},'starttime':{'type':Sequelize[_0x79a6('0x9')]},'systemanswertime':{'type':Sequelize[_0x79a6('0x9')]},'answertime':{'type':Sequelize[_0x79a6('0x9')]},'endtime':{'type':Sequelize[_0x79a6('0x9')]},'duration':{'type':Sequelize[_0x79a6('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x79a6('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x79a6('0x2')]},'userfield':{'type':Sequelize[_0x79a6('0x2')]},'userDisposition':{'type':Sequelize[_0x79a6('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x79a6('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x79a6('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x79a6('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x79a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 656d663..3e842d9 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2ef3,0xba));var _0x32ef=function(_0x59ca9e,_0x31074b){_0x59ca9e=_0x59ca9e-0x0;var _0x56e7ea=_0x2ef3[_0x59ca9e];return _0x56e7ea;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x2ef3,0xba));var _0x32ef=function(_0x11c8c5,_0x276cbc){_0x11c8c5=_0x11c8c5-0x0;var _0x5d47f4=_0x2ef3[_0x11c8c5];return _0x5d47f4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 88b5a29..06df33f 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 _0xdf6d=['report_call','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceCallReport'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdf6d,0x15e));var _0xddf6=function(_0x18cc69,_0x475ffa){_0x18cc69=_0x18cc69-0x0;var _0x5c0dfc=_0xdf6d[_0x18cc69];return _0x5c0dfc;};'use strict';var _=require(_0xddf6('0x0'));var util=require('util');var logger=require(_0xddf6('0x1'))(_0xddf6('0x2'));var moment=require(_0xddf6('0x3'));var BPromise=require(_0xddf6('0x4'));var rp=require(_0xddf6('0x5'));var fs=require('fs');var path=require(_0xddf6('0x6'));var rimraf=require(_0xddf6('0x7'));var config=require(_0xddf6('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x571842,_0x33fdfd){return _0x571842['define'](_0xddf6('0x9'),attributes,{'tableName':_0xddf6('0xa'),'paranoid':![],'indexes':[{'fields':[_0xddf6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c68=['request-promise','path','rimraf','./voiceCallReport.attributes','exports','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3165d6,_0xb8125c){var _0x3531b6=function(_0x14af7b){while(--_0x14af7b){_0x3165d6['push'](_0x3165d6['shift']());}};_0x3531b6(++_0xb8125c);}(_0x7c68,0x1d5));var _0x87c6=function(_0x393c52,_0x3e8cf7){_0x393c52=_0x393c52-0x0;var _0x438b53=_0x7c68[_0x393c52];return _0x438b53;};'use strict';var _=require(_0x87c6('0x0'));var util=require(_0x87c6('0x1'));var logger=require(_0x87c6('0x2'))(_0x87c6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x87c6('0x4'));var fs=require('fs');var path=require(_0x87c6('0x5'));var rimraf=require(_0x87c6('0x6'));var config=require('../../config/environment');var attributes=require(_0x87c6('0x7'));module[_0x87c6('0x8')]=function(_0x59bc18,_0x3cc9cf){return _0x59bc18['define']('VoiceCallReport',attributes,{'tableName':_0x87c6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x87c6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9547cda..d63f62f 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 _0x1b7a=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','raw','options','where','map','include','model','attributes','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','util','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b7a,0x15a));var _0xa1b7=function(_0x2506db,_0x3a490a){_0x2506db=_0x2506db-0x0;var _0x198518=_0x1b7a[_0x2506db];return _0x198518;};'use strict';var _=require('lodash');var util=require(_0xa1b7('0x0'));var moment=require('moment');var BPromise=require(_0xa1b7('0x1'));var rs=require(_0xa1b7('0x2'));var fs=require('fs');var Redis=require(_0xa1b7('0x3'));var db=require(_0xa1b7('0x4'))['db'];var utils=require(_0xa1b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa1b7('0x6'));var jayson=require(_0xa1b7('0x7'));var client=jayson[_0xa1b7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x396abc,_0x4368ce,_0x927a79){return new BPromise(function(_0x1b0d05,_0x3e8ff2){return client[_0xa1b7('0x9')](_0x396abc,_0x927a79)[_0xa1b7('0xa')](function(_0x5b1ebf){logger[_0xa1b7('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x4368ce,_0xa1b7('0xc'));logger[_0xa1b7('0xd')](_0xa1b7('0xe'),_0x4368ce,_0xa1b7('0xc'),JSON[_0xa1b7('0xf')](_0x5b1ebf));if(_0x5b1ebf[_0xa1b7('0x10')]){if(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x11')]===0x1f4){logger['error'](_0xa1b7('0x12'),_0x4368ce,_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);return _0x3e8ff2(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);}logger['error'](_0xa1b7('0x12'),_0x4368ce,_0x5b1ebf[_0xa1b7('0x10')]['message']);return _0x1b0d05(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);}else{logger[_0xa1b7('0xb')](_0xa1b7('0x12'),_0x4368ce,'request\x20sent');_0x1b0d05(_0x5b1ebf[_0xa1b7('0x14')][_0xa1b7('0x13')]);}})[_0xa1b7('0x15')](function(_0x1fba41){logger[_0xa1b7('0x10')](_0xa1b7('0x12'),_0x4368ce,_0x1fba41);_0x3e8ff2(_0x1fba41);});});}exports[_0xa1b7('0x16')]=function(_0x1322bf){var _0x28f55e=this;return new Promise(function(_0x57d2a0,_0x4ab00f){return db[_0xa1b7('0x17')]['findAll']({'raw':_0x1322bf['options']?_0x1322bf['options'][_0xa1b7('0x18')]===undefined?!![]:![]:!![],'where':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')][_0xa1b7('0x1a')]||null:null,'attributes':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['attributes']||null:null,'limit':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['limit']||null:null,'include':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['include']?_[_0xa1b7('0x1b')](_0x1322bf[_0xa1b7('0x19')][_0xa1b7('0x1c')],function(_0x58118a){return{'model':db[_0x58118a[_0xa1b7('0x1d')]],'as':_0x58118a['as'],'attributes':_0x58118a[_0xa1b7('0x1e')],'include':_0x58118a[_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x58118a[_0xa1b7('0x1c')],function(_0x3ebfce){return{'model':db[_0x3ebfce[_0xa1b7('0x1d')]],'as':_0x3ebfce['as'],'attributes':_0x3ebfce[_0xa1b7('0x1e')],'include':_0x3ebfce[_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x3ebfce['include'],function(_0x20c18f){return{'model':db[_0x20c18f[_0xa1b7('0x1d')]],'as':_0x20c18f['as'],'attributes':_0x20c18f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1b7('0xa')](function(_0x414d31){logger[_0xa1b7('0xb')](_0xa1b7('0x16'),_0x1322bf);logger[_0xa1b7('0xd')](_0xa1b7('0x16'),_0x1322bf,JSON[_0xa1b7('0xf')](_0x414d31));_0x57d2a0(_0x414d31);})['catch'](function(_0xb5d133){logger['error'](_0xa1b7('0x16'),_0xb5d133[_0xa1b7('0x13')],_0x1322bf);_0x4ab00f(_0x28f55e[_0xa1b7('0x10')](0x1f4,_0xb5d133[_0xa1b7('0x13')]));});});};exports[_0xa1b7('0x1f')]=function(_0x4defd){var _0x211a3c=this;return new Promise(function(_0xa0c5df,_0x4cf90e){return db['VoiceCallReport']['create'](_0x4defd['body'],{'raw':_0x4defd[_0xa1b7('0x19')]?_0x4defd['options'][_0xa1b7('0x18')]===undefined?!![]:![]:!![]})[_0xa1b7('0xa')](function(_0x552d35){logger[_0xa1b7('0xb')]('CreateVoiceCallReport',_0x4defd);logger[_0xa1b7('0xd')]('CreateVoiceCallReport',_0x4defd,JSON[_0xa1b7('0xf')](_0x552d35));_0xa0c5df(_0x552d35);})[_0xa1b7('0x15')](function(_0x20b217){logger[_0xa1b7('0x10')](_0xa1b7('0x1f'),_0x20b217['message'],_0x4defd);_0x4cf90e(_0x211a3c[_0xa1b7('0x10')](0x1f4,_0x20b217[_0xa1b7('0x13')]));});});};exports[_0xa1b7('0x20')]=function(_0x20b393){var _0xd1978d=this;return new Promise(function(_0xd2b397,_0x30ba7c){return db[_0xa1b7('0x17')][_0xa1b7('0x21')](_0x20b393['body'],{'raw':_0x20b393[_0xa1b7('0x19')]?_0x20b393['options'][_0xa1b7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b393[_0xa1b7('0x19')]?_0x20b393[_0xa1b7('0x19')][_0xa1b7('0x1a')]||null:null,'attributes':_0x20b393[_0xa1b7('0x19')]?_0x20b393['options']['attributes']||null:null,'limit':_0x20b393[_0xa1b7('0x19')]?_0x20b393[_0xa1b7('0x19')][_0xa1b7('0x22')]||null:null})[_0xa1b7('0xa')](function(_0xc03de0){logger[_0xa1b7('0xb')](_0xa1b7('0x20'),_0x20b393);logger[_0xa1b7('0xd')](_0xa1b7('0x20'),_0x20b393,JSON[_0xa1b7('0xf')](_0xc03de0));_0xd2b397(_0xc03de0);})[_0xa1b7('0x15')](function(_0x5ea8ce){logger[_0xa1b7('0x10')](_0xa1b7('0x20'),_0x5ea8ce[_0xa1b7('0x13')],_0x20b393);_0x30ba7c(_0xd1978d[_0xa1b7('0x10')](0x1f4,_0x5ea8ce[_0xa1b7('0x13')]));});});}; \ No newline at end of file +var _0x90ec=['model','attributes','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','body','limit','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','where','map','include'];(function(_0x538aa5,_0x58d414){var _0x4d9c0f=function(_0x53c1c7){while(--_0x53c1c7){_0x538aa5['push'](_0x538aa5['shift']());}};_0x4d9c0f(++_0x58d414);}(_0x90ec,0x7a));var _0xc90e=function(_0xf433cf,_0x5d30e9){_0xf433cf=_0xf433cf-0x0;var _0x4bae90=_0x90ec[_0xf433cf];return _0x4bae90;};'use strict';var _=require('lodash');var util=require(_0xc90e('0x0'));var moment=require('moment');var BPromise=require(_0xc90e('0x1'));var rs=require(_0xc90e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc90e('0x3'))['db'];var utils=require(_0xc90e('0x4'));var logger=require(_0xc90e('0x5'))(_0xc90e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc90e('0x7'));var client=jayson[_0xc90e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116d33,_0x1ac51a,_0x4d5377){return new BPromise(function(_0x2aec64,_0x54b410){return client[_0xc90e('0x9')](_0x116d33,_0x4d5377)[_0xc90e('0xa')](function(_0x23ab27){logger[_0xc90e('0xb')](_0xc90e('0xc'),_0x1ac51a,_0xc90e('0xd'));logger[_0xc90e('0xe')](_0xc90e('0xf'),_0x1ac51a,_0xc90e('0xd'),JSON['stringify'](_0x23ab27));if(_0x23ab27[_0xc90e('0x10')]){if(_0x23ab27[_0xc90e('0x10')][_0xc90e('0x11')]===0x1f4){logger[_0xc90e('0x10')](_0xc90e('0xc'),_0x1ac51a,_0x23ab27[_0xc90e('0x10')]['message']);return _0x54b410(_0x23ab27[_0xc90e('0x10')]['message']);}logger[_0xc90e('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1ac51a,_0x23ab27[_0xc90e('0x10')][_0xc90e('0x12')]);return _0x2aec64(_0x23ab27[_0xc90e('0x10')][_0xc90e('0x12')]);}else{logger[_0xc90e('0xb')](_0xc90e('0xc'),_0x1ac51a,_0xc90e('0xd'));_0x2aec64(_0x23ab27[_0xc90e('0x13')][_0xc90e('0x12')]);}})[_0xc90e('0x14')](function(_0x3daa05){logger[_0xc90e('0x10')](_0xc90e('0xc'),_0x1ac51a,_0x3daa05);_0x54b410(_0x3daa05);});});}exports['GetVoiceCallReport']=function(_0x38dc58){var _0x52c2cd=this;return new Promise(function(_0xbf1a3b,_0x593fc7){return db['VoiceCallReport'][_0xc90e('0x15')]({'raw':_0x38dc58[_0xc90e('0x16')]?_0x38dc58[_0xc90e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x38dc58[_0xc90e('0x16')]?_0x38dc58['options'][_0xc90e('0x17')]||null:null,'attributes':_0x38dc58[_0xc90e('0x16')]?_0x38dc58['options']['attributes']||null:null,'limit':_0x38dc58['options']?_0x38dc58[_0xc90e('0x16')]['limit']||null:null,'include':_0x38dc58[_0xc90e('0x16')]?_0x38dc58[_0xc90e('0x16')]['include']?_[_0xc90e('0x18')](_0x38dc58[_0xc90e('0x16')][_0xc90e('0x19')],function(_0x5dad04){return{'model':db[_0x5dad04[_0xc90e('0x1a')]],'as':_0x5dad04['as'],'attributes':_0x5dad04[_0xc90e('0x1b')],'include':_0x5dad04['include']?_[_0xc90e('0x18')](_0x5dad04[_0xc90e('0x19')],function(_0x138715){return{'model':db[_0x138715[_0xc90e('0x1a')]],'as':_0x138715['as'],'attributes':_0x138715[_0xc90e('0x1b')],'include':_0x138715[_0xc90e('0x19')]?_[_0xc90e('0x18')](_0x138715[_0xc90e('0x19')],function(_0x3b7faa){return{'model':db[_0x3b7faa[_0xc90e('0x1a')]],'as':_0x3b7faa['as'],'attributes':_0x3b7faa[_0xc90e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc90e('0xa')](function(_0x5edf73){logger['info'](_0xc90e('0x1c'),_0x38dc58);logger[_0xc90e('0xe')]('GetVoiceCallReport',_0x38dc58,JSON['stringify'](_0x5edf73));_0xbf1a3b(_0x5edf73);})[_0xc90e('0x14')](function(_0xa7cf52){logger[_0xc90e('0x10')](_0xc90e('0x1c'),_0xa7cf52[_0xc90e('0x12')],_0x38dc58);_0x593fc7(_0x52c2cd[_0xc90e('0x10')](0x1f4,_0xa7cf52[_0xc90e('0x12')]));});});};exports[_0xc90e('0x1d')]=function(_0xe2c37d){var _0x28e2cf=this;return new Promise(function(_0xd3cc80,_0x5c483d){return db[_0xc90e('0x1e')][_0xc90e('0x1f')](_0xe2c37d['body'],{'raw':_0xe2c37d[_0xc90e('0x16')]?_0xe2c37d[_0xc90e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc90e('0xa')](function(_0x5eb6e5){logger['info'](_0xc90e('0x1d'),_0xe2c37d);logger[_0xc90e('0xe')](_0xc90e('0x1d'),_0xe2c37d,JSON['stringify'](_0x5eb6e5));_0xd3cc80(_0x5eb6e5);})['catch'](function(_0x110602){logger[_0xc90e('0x10')](_0xc90e('0x1d'),_0x110602[_0xc90e('0x12')],_0xe2c37d);_0x5c483d(_0x28e2cf[_0xc90e('0x10')](0x1f4,_0x110602[_0xc90e('0x12')]));});});};exports[_0xc90e('0x20')]=function(_0x261474){var _0x140b04=this;return new Promise(function(_0x5ad2fb,_0x3b4260){return db[_0xc90e('0x1e')][_0xc90e('0x21')](_0x261474[_0xc90e('0x22')],{'raw':_0x261474['options']?_0x261474['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261474[_0xc90e('0x16')]?_0x261474[_0xc90e('0x16')][_0xc90e('0x17')]||null:null,'attributes':_0x261474[_0xc90e('0x16')]?_0x261474[_0xc90e('0x16')][_0xc90e('0x1b')]||null:null,'limit':_0x261474[_0xc90e('0x16')]?_0x261474[_0xc90e('0x16')][_0xc90e('0x23')]||null:null})[_0xc90e('0xa')](function(_0x23f7e7){logger[_0xc90e('0xb')](_0xc90e('0x20'),_0x261474);logger[_0xc90e('0xe')](_0xc90e('0x20'),_0x261474,JSON[_0xc90e('0x24')](_0x23f7e7));_0x5ad2fb(_0x23f7e7);})[_0xc90e('0x14')](function(_0x390957){logger[_0xc90e('0x10')]('UpdateVoiceCallReport',_0x390957['message'],_0x261474);_0x3b4260(_0x140b04[_0xc90e('0x10')](0x1f4,_0x390957[_0xc90e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3b59adf..cf186ce 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 _0x6c79=['update','delete','isAuthenticated','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','show','post','put'];(function(_0x54c191,_0x4a04ef){var _0x40ee4a=function(_0x200a79){while(--_0x200a79){_0x54c191['push'](_0x54c191['shift']());}};_0x40ee4a(++_0x4a04ef);}(_0x6c79,0x1d0));var _0x96c7=function(_0x165da7,_0x3d18ef){_0x165da7=_0x165da7-0x0;var _0xcd7f87=_0x6c79[_0x165da7];return _0xcd7f87;};'use strict';var multer=require(_0x96c7('0x0'));var util=require('util');var path=require(_0x96c7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96c7('0x2')]();var fs_extra=require(_0x96c7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96c7('0x4'));var config=require('../../config/environment');var controller=require(_0x96c7('0x5'));router[_0x96c7('0x6')]('/',auth['isAuthenticated'](),controller[_0x96c7('0x7')]);router[_0x96c7('0x6')](_0x96c7('0x8'),auth['isAuthenticated'](),controller[_0x96c7('0x9')]);router[_0x96c7('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x96c7('0xb')](_0x96c7('0x8'),auth['isAuthenticated'](),controller[_0x96c7('0xc')]);router[_0x96c7('0xd')]('/:id',auth[_0x96c7('0xe')](),controller[_0x96c7('0xf')]);module[_0x96c7('0x10')]=router; \ No newline at end of file +var _0x20f6=['connect-timeout','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2d13df,_0x234aa6){var _0x57ffb8=function(_0x4d6972){while(--_0x4d6972){_0x2d13df['push'](_0x2d13df['shift']());}};_0x57ffb8(++_0x234aa6);}(_0x20f6,0x82));var _0x620f=function(_0x3ea68d,_0x13e78f){_0x3ea68d=_0x3ea68d-0x0;var _0x167ffb=_0x20f6[_0x3ea68d];return _0x167ffb;};'use strict';var multer=require(_0x620f('0x0'));var util=require(_0x620f('0x1'));var path=require(_0x620f('0x2'));var timeout=require(_0x620f('0x3'));var express=require(_0x620f('0x4'));var router=express[_0x620f('0x5')]();var fs_extra=require(_0x620f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x620f('0x7'));var controller=require(_0x620f('0x8'));router[_0x620f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x620f('0x9')](_0x620f('0xa'),auth[_0x620f('0xb')](),controller[_0x620f('0xc')]);router[_0x620f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x620f('0xe')]('/:id',auth[_0x620f('0xb')](),controller[_0x620f('0xf')]);router[_0x620f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x620f('0x11')]);module[_0x620f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 54b63d5..8770429 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 _0x9de6=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x45c43e,_0x3f45fb){var _0x1db42f=function(_0x3a0d03){while(--_0x3a0d03){_0x45c43e['push'](_0x45c43e['shift']());}};_0x1db42f(++_0x3f45fb);}(_0x9de6,0x1ea));var _0x69de=function(_0x4a75f9,_0x1b5a42){_0x4a75f9=_0x4a75f9-0x0;var _0x2b4ced=_0x9de6[_0x4a75f9];return _0x2b4ced;};'use strict';var Sequelize=require(_0x69de('0x0'));module[_0x69de('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x69de('0x2')],'unique':_0x69de('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x37b423){this[_0x69de('0x4')]('options',_0x37b423?_0x37b423[_0x69de('0x5')](''):[]);},'get':function(){return this[_0x69de('0x6')]('options')?this[_0x69de('0x6')]('options')[_0x69de('0x7')](''):[];}},'auth':{'type':Sequelize[_0x69de('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x69de('0x2')]},'record':{'type':Sequelize[_0x69de('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x69de('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0c2=['exports','STRING','name','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x3fb6fc,_0x2427f4){var _0x4149b6=function(_0x624570){while(--_0x624570){_0x3fb6fc['push'](_0x3fb6fc['shift']());}};_0x4149b6(++_0x2427f4);}(_0xa0c2,0xd7));var _0x2a0c=function(_0xe43ba2,_0x4466e2){_0xe43ba2=_0xe43ba2-0x0;var _0x480182=_0xa0c2[_0xe43ba2];return _0x480182;};'use strict';var Sequelize=require(_0x2a0c('0x0'));module[_0x2a0c('0x1')]={'name':{'type':Sequelize[_0x2a0c('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x2a0c('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x40428c){this['setDataValue']('options',_0x40428c?_0x40428c['join'](''):[]);},'get':function(){return this[_0x2a0c('0x4')](_0x2a0c('0x5'))?this[_0x2a0c('0x4')](_0x2a0c('0x5'))[_0x2a0c('0x6')](''):[];}},'auth':{'type':Sequelize[_0x2a0c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x2a0c('0x2')]},'record':{'type':Sequelize[_0x2a0c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a0c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e91bbff..bb5b97b 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 _0xfb3f=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','name','send','VoiceChanSpy','rawAttributes','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x13a426,_0x1e285b){var _0x3ba455=function(_0x248a1a){while(--_0x248a1a){_0x13a426['push'](_0x13a426['shift']());}};_0x3ba455(++_0x1e285b);}(_0xfb3f,0xd9));var _0xffb3=function(_0x356594,_0x59c53c){_0x356594=_0x356594-0x0;var _0x1f85fd=_0xfb3f[_0x356594];return _0x1f85fd;};'use strict';var emlformat=require(_0xffb3('0x0'));var rimraf=require(_0xffb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffb3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xffb3('0x3'));var Mustache=require('mustache');var util=require(_0xffb3('0x4'));var path=require(_0xffb3('0x5'));var sox=require(_0xffb3('0x6'));var csv=require(_0xffb3('0x7'));var ejs=require(_0xffb3('0x8'));var fs=require('fs');var fs_extra=require(_0xffb3('0x9'));var _=require(_0xffb3('0xa'));var squel=require(_0xffb3('0xb'));var crypto=require('crypto');var jsforce=require(_0xffb3('0xc'));var deskjs=require(_0xffb3('0xd'));var toCsv=require(_0xffb3('0x7'));var querystring=require(_0xffb3('0xe'));var Papa=require(_0xffb3('0xf'));var Redis=require('ioredis');var authService=require(_0xffb3('0x10'));var qs=require(_0xffb3('0x11'));var as=require(_0xffb3('0x12'));var hardwareService=require(_0xffb3('0x13'));var logger=require(_0xffb3('0x14'))(_0xffb3('0x15'));var utils=require(_0xffb3('0x16'));var config=require(_0xffb3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xffb3('0x18'))['db'];function respondWithStatusCode(_0x40c953,_0x55192c){_0x55192c=_0x55192c||0xcc;return function(_0x21924a){if(_0x21924a){return _0x40c953[_0xffb3('0x19')](_0x55192c);}return _0x40c953[_0xffb3('0x1a')](_0x55192c)[_0xffb3('0x1b')]();};}function respondWithResult(_0x65ef59,_0x420156){_0x420156=_0x420156||0xc8;return function(_0x19ce6e){if(_0x19ce6e){return _0x65ef59[_0xffb3('0x1a')](_0x420156)[_0xffb3('0x1c')](_0x19ce6e);}};}function respondWithFilteredResult(_0x3183bd,_0x38daab){return function(_0x2c3ef7){if(_0x2c3ef7){var _0x4d3c48=typeof _0x38daab[_0xffb3('0x1d')]===_0xffb3('0x1e')&&typeof _0x38daab[_0xffb3('0x1f')]==='undefined';var _0x51f3bb=_0x2c3ef7[_0xffb3('0x20')];var _0x167ed7=_0x4d3c48?0x0:_0x38daab['offset'];var _0x3b35de=_0x4d3c48?_0x2c3ef7[_0xffb3('0x20')]:_0x38daab[_0xffb3('0x1d')]+_0x38daab['limit'];var _0x2dfb40;if(_0x3b35de>=_0x51f3bb){_0x3b35de=_0x51f3bb;_0x2dfb40=0xc8;}else{_0x2dfb40=0xce;}_0x3183bd[_0xffb3('0x1a')](_0x2dfb40);return _0x3183bd['set'](_0xffb3('0x21'),_0x167ed7+'-'+_0x3b35de+'/'+_0x51f3bb)[_0xffb3('0x1c')](_0x2c3ef7);}return null;};}function patchUpdates(_0x223ad5){return function(_0x21c9ad){try{jsonpatch[_0xffb3('0x22')](_0x21c9ad,_0x223ad5,!![]);}catch(_0x46858f){return BPromise[_0xffb3('0x23')](_0x46858f);}return _0x21c9ad['save']();};}function saveUpdates(_0x473cff,_0xe4c60e){return function(_0x5e0f48){if(_0x5e0f48){return _0x5e0f48[_0xffb3('0x24')](_0x473cff)['then'](function(_0x5b707a){return _0x5b707a;});}return null;};}function removeEntity(_0x24c502,_0x3d55e6){return function(_0x22bbea){if(_0x22bbea){return _0x22bbea[_0xffb3('0x25')]()[_0xffb3('0x26')](function(){var _0x146708=_0x22bbea['get']({'plain':!![]});var _0x796b8e='ChanSpies';return db[_0xffb3('0x27')][_0xffb3('0x25')]({'where':{'type':_0x796b8e,'resourceId':_0x146708['id']}})['then'](function(){return _0x22bbea;});})[_0xffb3('0x26')](function(){_0x24c502['status'](0xcc)[_0xffb3('0x1b')]();});}};}function handleEntityNotFound(_0x148ad8,_0x45522c){return function(_0x6ba942){if(!_0x6ba942){_0x148ad8['sendStatus'](0x194);}return _0x6ba942;};}function handleError(_0x5f2f3e,_0x4a3b8c){_0x4a3b8c=_0x4a3b8c||0x1f4;return function(_0x52fc8c){logger[_0xffb3('0x28')](_0x52fc8c['stack']);if(_0x52fc8c[_0xffb3('0x29')]){delete _0x52fc8c[_0xffb3('0x29')];}_0x5f2f3e[_0xffb3('0x1a')](_0x4a3b8c)[_0xffb3('0x2a')](_0x52fc8c);};}exports['index']=function(_0x282f46,_0x42fa8e){var _0x4d544d={},_0x474d85={},_0x39ca38={'count':0x0,'rows':[]};var _0x266d7c=_['map'](db[_0xffb3('0x2b')][_0xffb3('0x2c')],function(_0x2b4bac){return{'name':_0x2b4bac['fieldName'],'type':_0x2b4bac[_0xffb3('0x2d')][_0xffb3('0x2e')]};});_0x474d85['model']=_[_0xffb3('0x2f')](_0x266d7c,_0xffb3('0x29'));_0x474d85[_0xffb3('0x30')]=_[_0xffb3('0x31')](_0x282f46[_0xffb3('0x30')]);_0x474d85['filters']=_[_0xffb3('0x32')](_0x474d85[_0xffb3('0x33')],_0x474d85[_0xffb3('0x30')]);_0x4d544d['attributes']=_[_0xffb3('0x32')](_0x474d85[_0xffb3('0x33')],qs['fields'](_0x282f46[_0xffb3('0x30')][_0xffb3('0x34')]));_0x4d544d['attributes']=_0x4d544d[_0xffb3('0x35')][_0xffb3('0x36')]?_0x4d544d['attributes']:_0x474d85['model'];if(!_0x282f46['query'][_0xffb3('0x37')](_0xffb3('0x38'))){_0x4d544d['limit']=qs[_0xffb3('0x1f')](_0x282f46['query'][_0xffb3('0x1f')]);_0x4d544d[_0xffb3('0x1d')]=qs['offset'](_0x282f46[_0xffb3('0x30')]['offset']);}_0x4d544d[_0xffb3('0x39')]=qs[_0xffb3('0x3a')](_0x282f46['query'][_0xffb3('0x3a')]);_0x4d544d[_0xffb3('0x3b')]=qs[_0xffb3('0x3c')](_[_0xffb3('0x3d')](_0x282f46[_0xffb3('0x30')],_0x474d85[_0xffb3('0x3c')]),_0x266d7c);if(_0x282f46[_0xffb3('0x30')][_0xffb3('0x3e')]){_0x4d544d[_0xffb3('0x3b')]=_[_0xffb3('0x3f')](_0x4d544d[_0xffb3('0x3b')],{'$or':_[_0xffb3('0x2f')](_0x266d7c,function(_0x2f8bc0){if(_0x2f8bc0['type']!==_0xffb3('0x40')){var _0x282431={};_0x282431[_0x2f8bc0[_0xffb3('0x29')]]={'$like':'%'+_0x282f46['query'][_0xffb3('0x3e')]+'%'};return _0x282431;}})});}_0x4d544d=_['merge']({},_0x4d544d,_0x282f46[_0xffb3('0x41')]);var _0x30cd19={'where':_0x4d544d['where']};return db[_0xffb3('0x2b')][_0xffb3('0x20')](_0x30cd19)['then'](function(_0x596af5){_0x39ca38[_0xffb3('0x20')]=_0x596af5;if(_0x282f46[_0xffb3('0x30')]['includeAll']){_0x4d544d[_0xffb3('0x42')]=[{'all':!![]}];}return db[_0xffb3('0x2b')][_0xffb3('0x43')](_0x4d544d);})[_0xffb3('0x26')](function(_0x2e8564){_0x39ca38['rows']=_0x2e8564;return _0x39ca38;})[_0xffb3('0x26')](respondWithFilteredResult(_0x42fa8e,_0x4d544d))[_0xffb3('0x44')](handleError(_0x42fa8e,null));};exports[_0xffb3('0x45')]=function(_0x40a691,_0x3d56d7){var _0x567883={'raw':![],'where':{'id':_0x40a691[_0xffb3('0x46')]['id']}},_0x5d1890={};_0x5d1890[_0xffb3('0x33')]=_['keys'](db[_0xffb3('0x2b')][_0xffb3('0x2c')]);_0x5d1890[_0xffb3('0x30')]=_[_0xffb3('0x31')](_0x40a691['query']);_0x5d1890['filters']=_[_0xffb3('0x32')](_0x5d1890[_0xffb3('0x33')],_0x5d1890[_0xffb3('0x30')]);_0x567883[_0xffb3('0x35')]=_[_0xffb3('0x32')](_0x5d1890[_0xffb3('0x33')],qs['fields'](_0x40a691[_0xffb3('0x30')]['fields']));_0x567883[_0xffb3('0x35')]=_0x567883[_0xffb3('0x35')][_0xffb3('0x36')]?_0x567883[_0xffb3('0x35')]:_0x5d1890['model'];if(_0x40a691['query'][_0xffb3('0x47')]){_0x567883['include']=[{'all':!![]}];}_0x567883=_[_0xffb3('0x3f')]({},_0x567883,_0x40a691[_0xffb3('0x41')]);return db[_0xffb3('0x2b')]['find'](_0x567883)[_0xffb3('0x26')](handleEntityNotFound(_0x3d56d7,null))[_0xffb3('0x26')](respondWithResult(_0x3d56d7,null))[_0xffb3('0x44')](handleError(_0x3d56d7,null));};exports[_0xffb3('0x48')]=function(_0x2f99ed,_0x4b0fd3){return db[_0xffb3('0x2b')][_0xffb3('0x48')](_0x2f99ed[_0xffb3('0x49')],{})['then'](function(_0x21e9e0){var _0x641c4e=_0x2f99ed[_0xffb3('0x4a')]['get']({'plain':!![]});if(!_0x641c4e)throw new Error(_0xffb3('0x4b'));if(_0x641c4e[_0xffb3('0x4c')]===_0xffb3('0x4a')){var _0x1c179c=_0x21e9e0['get']({'plain':!![]});var _0x525ecf='ChanSpies';return db['UserProfileSection'][_0xffb3('0x4d')]({'where':{'name':_0x525ecf,'userProfileId':_0x641c4e['userProfileId']},'raw':!![]})['then'](function(_0x763c1c){if(_0x763c1c&&_0x763c1c[_0xffb3('0x4e')]===0x0){return db[_0xffb3('0x27')][_0xffb3('0x48')]({'name':_0x1c179c[_0xffb3('0x29')],'resourceId':_0x1c179c['id'],'type':_0x763c1c[_0xffb3('0x29')],'sectionId':_0x763c1c['id']},{})[_0xffb3('0x26')](function(){return _0x21e9e0;});}else{return _0x21e9e0;}})['catch'](function(_0x29ba96){logger[_0xffb3('0x28')](_0xffb3('0x4f'),_0x29ba96);throw _0x29ba96;});}return _0x21e9e0;})[_0xffb3('0x26')](respondWithResult(_0x4b0fd3,0xc9))[_0xffb3('0x44')](handleError(_0x4b0fd3,null));};exports[_0xffb3('0x24')]=function(_0x4cf832,_0x99ff99){if(_0x4cf832[_0xffb3('0x49')]['id']){delete _0x4cf832['body']['id'];}return db['VoiceChanSpy'][_0xffb3('0x4d')]({'where':{'id':_0x4cf832['params']['id']}})[_0xffb3('0x26')](handleEntityNotFound(_0x99ff99,null))[_0xffb3('0x26')](saveUpdates(_0x4cf832[_0xffb3('0x49')],null))['then'](respondWithResult(_0x99ff99,null))['catch'](handleError(_0x99ff99,null));};exports['destroy']=function(_0x2ec815,_0x5d9bda){return db['VoiceChanSpy']['find']({'where':{'id':_0x2ec815[_0xffb3('0x46')]['id']}})[_0xffb3('0x26')](handleEntityNotFound(_0x5d9bda,null))[_0xffb3('0x26')](removeEntity(_0x5d9bda,null))['catch'](handleError(_0x5d9bda,null));}; \ No newline at end of file +var _0x81a4=['find','body','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','type','merge','options','include','rows','catch','show','params','fields','includeAll','VoiceChanSpy'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x81a4,0x1a6));var _0x481a=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x81a4[_0x1780f8];return _0x33a410;};'use strict';var emlformat=require(_0x481a('0x0'));var rimraf=require(_0x481a('0x1'));var zipdir=require(_0x481a('0x2'));var jsonpatch=require(_0x481a('0x3'));var rp=require('request-promise');var moment=require(_0x481a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require(_0x481a('0x9'));var fs=require('fs');var fs_extra=require(_0x481a('0xa'));var _=require(_0x481a('0xb'));var squel=require('squel');var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var Redis=require('ioredis');var authService=require(_0x481a('0x11'));var qs=require(_0x481a('0x12'));var as=require(_0x481a('0x13'));var hardwareService=require(_0x481a('0x14'));var logger=require(_0x481a('0x15'))(_0x481a('0x16'));var utils=require(_0x481a('0x17'));var config=require(_0x481a('0x18'));var licenseUtil=require(_0x481a('0x19'));var db=require(_0x481a('0x1a'))['db'];function respondWithStatusCode(_0x507233,_0x5838af){_0x5838af=_0x5838af||0xcc;return function(_0x28a189){if(_0x28a189){return _0x507233[_0x481a('0x1b')](_0x5838af);}return _0x507233[_0x481a('0x1c')](_0x5838af)[_0x481a('0x1d')]();};}function respondWithResult(_0x44700a,_0x2e520b){_0x2e520b=_0x2e520b||0xc8;return function(_0x5637bd){if(_0x5637bd){return _0x44700a[_0x481a('0x1c')](_0x2e520b)['json'](_0x5637bd);}};}function respondWithFilteredResult(_0x238f3d,_0x1410c1){return function(_0x40f691){if(_0x40f691){var _0x507a5b=typeof _0x1410c1['offset']===_0x481a('0x1e')&&typeof _0x1410c1[_0x481a('0x1f')]===_0x481a('0x1e');var _0x152483=_0x40f691[_0x481a('0x20')];var _0x3186e3=_0x507a5b?0x0:_0x1410c1[_0x481a('0x21')];var _0x2e6d4e=_0x507a5b?_0x40f691[_0x481a('0x20')]:_0x1410c1[_0x481a('0x21')]+_0x1410c1['limit'];var _0x243883;if(_0x2e6d4e>=_0x152483){_0x2e6d4e=_0x152483;_0x243883=0xc8;}else{_0x243883=0xce;}_0x238f3d[_0x481a('0x1c')](_0x243883);return _0x238f3d[_0x481a('0x22')](_0x481a('0x23'),_0x3186e3+'-'+_0x2e6d4e+'/'+_0x152483)[_0x481a('0x24')](_0x40f691);}return null;};}function patchUpdates(_0x4a3a10){return function(_0x2e3549){try{jsonpatch[_0x481a('0x25')](_0x2e3549,_0x4a3a10,!![]);}catch(_0x248e88){return BPromise[_0x481a('0x26')](_0x248e88);}return _0x2e3549['save']();};}function saveUpdates(_0xce4b34,_0x1afd59){return function(_0x44673f){if(_0x44673f){return _0x44673f[_0x481a('0x27')](_0xce4b34)[_0x481a('0x28')](function(_0x17534e){return _0x17534e;});}return null;};}function removeEntity(_0x336ea1,_0x6a554b){return function(_0x56dc8f){if(_0x56dc8f){return _0x56dc8f[_0x481a('0x29')]()[_0x481a('0x28')](function(){var _0x49d1bf=_0x56dc8f[_0x481a('0x2a')]({'plain':!![]});var _0x4916fa=_0x481a('0x2b');return db[_0x481a('0x2c')][_0x481a('0x29')]({'where':{'type':_0x4916fa,'resourceId':_0x49d1bf['id']}})[_0x481a('0x28')](function(){return _0x56dc8f;});})['then'](function(){_0x336ea1[_0x481a('0x1c')](0xcc)[_0x481a('0x1d')]();});}};}function handleEntityNotFound(_0x285566,_0x2c978a){return function(_0x20aeb5){if(!_0x20aeb5){_0x285566[_0x481a('0x1b')](0x194);}return _0x20aeb5;};}function handleError(_0x4a89f6,_0x2e317f){_0x2e317f=_0x2e317f||0x1f4;return function(_0x33306a){logger[_0x481a('0x2d')](_0x33306a[_0x481a('0x2e')]);if(_0x33306a['name']){delete _0x33306a[_0x481a('0x2f')];}_0x4a89f6[_0x481a('0x1c')](_0x2e317f)[_0x481a('0x30')](_0x33306a);};}exports[_0x481a('0x31')]=function(_0x4cfc19,_0x5071f4){var _0x56275e={},_0x524911={},_0x673741={'count':0x0,'rows':[]};var _0x2acb51=_[_0x481a('0x32')](db['VoiceChanSpy'][_0x481a('0x33')],function(_0x46c71e){return{'name':_0x46c71e[_0x481a('0x34')],'type':_0x46c71e['type'][_0x481a('0x35')]};});_0x524911[_0x481a('0x36')]=_['map'](_0x2acb51,'name');_0x524911[_0x481a('0x37')]=_[_0x481a('0x38')](_0x4cfc19[_0x481a('0x37')]);_0x524911[_0x481a('0x39')]=_[_0x481a('0x3a')](_0x524911['model'],_0x524911[_0x481a('0x37')]);_0x56275e[_0x481a('0x3b')]=_[_0x481a('0x3a')](_0x524911[_0x481a('0x36')],qs['fields'](_0x4cfc19['query']['fields']));_0x56275e[_0x481a('0x3b')]=_0x56275e[_0x481a('0x3b')]['length']?_0x56275e[_0x481a('0x3b')]:_0x524911[_0x481a('0x36')];if(!_0x4cfc19['query'][_0x481a('0x3c')]('nolimit')){_0x56275e['limit']=qs['limit'](_0x4cfc19[_0x481a('0x37')]['limit']);_0x56275e[_0x481a('0x21')]=qs[_0x481a('0x21')](_0x4cfc19[_0x481a('0x37')][_0x481a('0x21')]);}_0x56275e['order']=qs[_0x481a('0x3d')](_0x4cfc19[_0x481a('0x37')][_0x481a('0x3d')]);_0x56275e[_0x481a('0x3e')]=qs[_0x481a('0x39')](_[_0x481a('0x3f')](_0x4cfc19['query'],_0x524911[_0x481a('0x39')]),_0x2acb51);if(_0x4cfc19[_0x481a('0x37')][_0x481a('0x40')]){_0x56275e['where']=_['merge'](_0x56275e[_0x481a('0x3e')],{'$or':_[_0x481a('0x32')](_0x2acb51,function(_0x20d9c0){if(_0x20d9c0[_0x481a('0x41')]!=='VIRTUAL'){var _0x4c4e07={};_0x4c4e07[_0x20d9c0['name']]={'$like':'%'+_0x4cfc19['query'][_0x481a('0x40')]+'%'};return _0x4c4e07;}})});}_0x56275e=_[_0x481a('0x42')]({},_0x56275e,_0x4cfc19[_0x481a('0x43')]);var _0x5b9d52={'where':_0x56275e[_0x481a('0x3e')]};return db['VoiceChanSpy'][_0x481a('0x20')](_0x5b9d52)['then'](function(_0x2f74ea){_0x673741[_0x481a('0x20')]=_0x2f74ea;if(_0x4cfc19[_0x481a('0x37')]['includeAll']){_0x56275e[_0x481a('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x56275e);})['then'](function(_0x1c77b7){_0x673741[_0x481a('0x45')]=_0x1c77b7;return _0x673741;})[_0x481a('0x28')](respondWithFilteredResult(_0x5071f4,_0x56275e))[_0x481a('0x46')](handleError(_0x5071f4,null));};exports[_0x481a('0x47')]=function(_0x3b3a3b,_0x24a507){var _0x4fc996={'raw':![],'where':{'id':_0x3b3a3b[_0x481a('0x48')]['id']}},_0x4a0d9f={};_0x4a0d9f[_0x481a('0x36')]=_[_0x481a('0x38')](db['VoiceChanSpy'][_0x481a('0x33')]);_0x4a0d9f[_0x481a('0x37')]=_[_0x481a('0x38')](_0x3b3a3b['query']);_0x4a0d9f['filters']=_[_0x481a('0x3a')](_0x4a0d9f[_0x481a('0x36')],_0x4a0d9f[_0x481a('0x37')]);_0x4fc996[_0x481a('0x3b')]=_[_0x481a('0x3a')](_0x4a0d9f[_0x481a('0x36')],qs[_0x481a('0x49')](_0x3b3a3b[_0x481a('0x37')][_0x481a('0x49')]));_0x4fc996['attributes']=_0x4fc996[_0x481a('0x3b')]['length']?_0x4fc996[_0x481a('0x3b')]:_0x4a0d9f['model'];if(_0x3b3a3b[_0x481a('0x37')][_0x481a('0x4a')]){_0x4fc996[_0x481a('0x44')]=[{'all':!![]}];}_0x4fc996=_[_0x481a('0x42')]({},_0x4fc996,_0x3b3a3b['options']);return db[_0x481a('0x4b')][_0x481a('0x4c')](_0x4fc996)['then'](handleEntityNotFound(_0x24a507,null))[_0x481a('0x28')](respondWithResult(_0x24a507,null))[_0x481a('0x46')](handleError(_0x24a507,null));};exports['create']=function(_0x5505dd,_0x35dff1){return db['VoiceChanSpy']['create'](_0x5505dd[_0x481a('0x4d')],{})[_0x481a('0x28')](function(_0x59e04c){var _0x272ce6=_0x5505dd[_0x481a('0x4e')]['get']({'plain':!![]});if(!_0x272ce6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x272ce6['role']==='user'){var _0x4de00c=_0x59e04c[_0x481a('0x2a')]({'plain':!![]});var _0xd6cbb='ChanSpies';return db['UserProfileSection'][_0x481a('0x4c')]({'where':{'name':_0xd6cbb,'userProfileId':_0x272ce6[_0x481a('0x4f')]},'raw':!![]})[_0x481a('0x28')](function(_0x2aa93b){if(_0x2aa93b&&_0x2aa93b[_0x481a('0x50')]===0x0){return db['UserProfileResource'][_0x481a('0x51')]({'name':_0x4de00c['name'],'resourceId':_0x4de00c['id'],'type':_0x2aa93b[_0x481a('0x2f')],'sectionId':_0x2aa93b['id']},{})[_0x481a('0x28')](function(){return _0x59e04c;});}else{return _0x59e04c;}})[_0x481a('0x46')](function(_0x10585b){logger['error'](_0x481a('0x52'),_0x10585b);throw _0x10585b;});}return _0x59e04c;})['then'](respondWithResult(_0x35dff1,0xc9))[_0x481a('0x46')](handleError(_0x35dff1,null));};exports['update']=function(_0x161924,_0x56a4bb){if(_0x161924[_0x481a('0x4d')]['id']){delete _0x161924[_0x481a('0x4d')]['id'];}return db[_0x481a('0x4b')][_0x481a('0x4c')]({'where':{'id':_0x161924[_0x481a('0x48')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x56a4bb,null))[_0x481a('0x28')](saveUpdates(_0x161924[_0x481a('0x4d')],null))[_0x481a('0x28')](respondWithResult(_0x56a4bb,null))[_0x481a('0x46')](handleError(_0x56a4bb,null));};exports[_0x481a('0x29')]=function(_0x16710e,_0x274294){return db[_0x481a('0x4b')][_0x481a('0x4c')]({'where':{'id':_0x16710e['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x274294,null))['then'](removeEntity(_0x274294,null))['catch'](handleError(_0x274294,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6487bb6..d20d529 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 _0x326a=['${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','exports','models','define','VoiceChanSpy','bulkCreate','VoiceExtension','destroy','catch','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor'];(function(_0x4410ff,_0x4bcef0){var _0x2504cb=function(_0xe955c8){while(--_0xe955c8){_0x4410ff['push'](_0x4410ff['shift']());}};_0x2504cb(++_0x4bcef0);}(_0x326a,0x161));var _0xa326=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x326a[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xa326('0x0'));var util=require(_0xa326('0x1'));var BPromise=require('bluebird');var attributes=require(_0xa326('0x2'));var getUserApplications=function(_0x2bfe50,_0x4845f2,_0x47391f){var _0x122e66=0x1;var _0x2f6302=[];var _0x548917={'context':_0x4845f2[_0xa326('0x3')]||_0xa326('0x4'),'exten':util[_0xa326('0x5')](_0xa326('0x6'),_0x2bfe50[_0xa326('0x7')],_0x47391f),'type':_0xa326('0x8'),'isApp':![],'ChanSpyId':_0x2bfe50['id'],'UserId':_0x4845f2['id']};_0x2f6302[_0xa326('0x9')](_[_0xa326('0xa')]({'app':_0xa326('0xb'),'appdata':util[_0xa326('0x5')](_0xa326('0xc'),_0xa326('0xd')),'priority':_0x122e66++},_0x548917));if(_0x2bfe50[_0xa326('0xe')]){_0x2f6302[_0xa326('0x9')](_['merge']({'app':_0xa326('0xf'),'appdata':util[_0xa326('0x5')](_0xa326('0x10'),_0x2bfe50[_0xa326('0x11')]),'priority':_0x122e66++},_0x548917));}if(_0x2bfe50[_0xa326('0x12')]){_0x2f6302['push'](_['merge']({'app':_0xa326('0x13'),'appdata':_0x2bfe50[_0xa326('0x14')],'priority':_0x122e66++},_0x548917));}_0x2f6302[_0xa326('0x9')](_[_0xa326('0xa')]({'app':_0xa326('0x15'),'appdata':util[_0xa326('0x5')](_0xa326('0x16'),_0x4845f2[_0xa326('0x17')],_0x2bfe50[_0xa326('0x18')]?_0x2bfe50['options'][_0xa326('0x19')](''):''),'priority':_0x122e66++},_0x548917));if(_0x2bfe50[_0xa326('0xe')]){_0x2f6302[_0xa326('0x9')](_[_0xa326('0xa')]({'app':_0xa326('0x1a'),'priority':_0x122e66++},_0x548917));}return _0x2f6302;};var getChanSpyApplications=function(_0x332276,_0x5a428f){var _0x1be96a=[];for(var _0x136df3=0x0,_0x554d23=0x1;_0x136df3<_0x5a428f[_0xa326('0x1b')];_0x136df3++,_0x554d23=0x1){_0x1be96a=_0x1be96a[_0xa326('0x1c')](getUserApplications(_0x332276,_0x5a428f[_0x136df3],_0x5a428f[_0x136df3][_0xa326('0x1d')]));if(_0x5a428f[_0x136df3]['internal']!=_0x5a428f[_0x136df3]['name']){_0x1be96a=_0x1be96a[_0xa326('0x1c')](getUserApplications(_0x332276,_0x5a428f[_0x136df3],_0x5a428f[_0x136df3]['name']));}}return _0x1be96a;};var getChanSpyPromise=function(_0x12d6e5,_0x3e77c5){return new BPromise(function(_0xf35434,_0x4f633e){return _0x12d6e5[_0xa326('0x1e')][_0xa326('0x1f')]({'attributes':['id',_0xa326('0x17'),_0xa326('0x1d')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xa326('0x20')](function(_0x11bcea){if(_0x11bcea){return _0xf35434(getChanSpyApplications(_0x3e77c5,_0x11bcea));}return _0xf35434([]);})['catch'](function(_0x1ab88d){_0x4f633e(_0x1ab88d);});});};module[_0xa326('0x21')]=function(_0x20fc31,_0x532fd1){var _0x482d43=_0x20fc31[_0xa326('0x22')];return _0x20fc31[_0xa326('0x23')](_0xa326('0x24'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e16e4,_0xe0e1a4,_0x3380df){return getChanSpyPromise(_0x482d43,_0x3e16e4)['then'](function(_0x4477cb){if(_0x4477cb&&_0x4477cb['length']){return _0x482d43['VoiceExtension'][_0xa326('0x25')](_0x4477cb);}})[_0xa326('0x20')](function(){_0x3380df();})['catch'](function(_0x2a4582){_0x3380df(_0x2a4582);});},'afterUpdate':function(_0x28d004,_0x593a9c,_0x533f24){return _0x482d43[_0xa326('0x26')]['destroy']({'where':{'ChanSpyId':_0x28d004['id']}})[_0xa326('0x20')](function(){return getChanSpyPromise(_0x482d43,_0x28d004);})[_0xa326('0x20')](function(_0xcb83fe){if(_0xcb83fe&&_0xcb83fe[_0xa326('0x1b')]){return _0x482d43[_0xa326('0x26')][_0xa326('0x25')](_0xcb83fe);}})['then'](function(){_0x533f24();})['catch'](function(_0x34ab67){_0x533f24(_0x34ab67);});},'afterDestroy':function(_0x2c4089,_0x52ff47,_0x32af9b){return _0x482d43[_0xa326('0x26')][_0xa326('0x27')]({'where':{'ChanSpyId':_0x2c4089['id']}})['then'](function(){_0x32af9b();})[_0xa326('0x28')](function(_0x445f68){_0x32af9b(_0x445f68);});}}});}; \ No newline at end of file +var _0x2a09=['join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','Set','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','name','options'];(function(_0x51c97b,_0x1671c1){var _0x3fcd55=function(_0x4f952c){while(--_0x4f952c){_0x51c97b['push'](_0x51c97b['shift']());}};_0x3fcd55(++_0x1671c1);}(_0x2a09,0x84));var _0x92a0=function(_0xa14370,_0x148b7d){_0xa14370=_0xa14370-0x0;var _0x2e0e9c=_0x2a09[_0xa14370];return _0x2e0e9c;};'use strict';var _=require(_0x92a0('0x0'));var util=require('util');var BPromise=require(_0x92a0('0x1'));var attributes=require(_0x92a0('0x2'));var getUserApplications=function(_0x517445,_0x208652,_0x14d71e){var _0x100c12=0x1;var _0x1ba874=[];var _0x1dc569={'context':_0x208652[_0x92a0('0x3')]||_0x92a0('0x4'),'exten':util[_0x92a0('0x5')](_0x92a0('0x6'),_0x517445['prefix'],_0x14d71e),'type':_0x92a0('0x7'),'isApp':![],'ChanSpyId':_0x517445['id'],'UserId':_0x208652['id']};_0x1ba874[_0x92a0('0x8')](_['merge']({'app':_0x92a0('0x9'),'appdata':util[_0x92a0('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x100c12++},_0x1dc569));if(_0x517445[_0x92a0('0xa')]){_0x1ba874['push'](_[_0x92a0('0xb')]({'app':_0x92a0('0xc'),'appdata':util[_0x92a0('0x5')](_0x92a0('0xd'),_0x517445[_0x92a0('0xe')]),'priority':_0x100c12++},_0x1dc569));}if(_0x517445['auth']){_0x1ba874['push'](_['merge']({'app':_0x92a0('0xf'),'appdata':_0x517445[_0x92a0('0x10')],'priority':_0x100c12++},_0x1dc569));}_0x1ba874[_0x92a0('0x8')](_[_0x92a0('0xb')]({'app':_0x92a0('0x11'),'appdata':util[_0x92a0('0x5')]('SIP/%s,%s',_0x208652[_0x92a0('0x12')],_0x517445[_0x92a0('0x13')]?_0x517445[_0x92a0('0x13')][_0x92a0('0x14')](''):''),'priority':_0x100c12++},_0x1dc569));if(_0x517445[_0x92a0('0xa')]){_0x1ba874[_0x92a0('0x8')](_[_0x92a0('0xb')]({'app':_0x92a0('0x15'),'priority':_0x100c12++},_0x1dc569));}return _0x1ba874;};var getChanSpyApplications=function(_0x49de79,_0x130433){var _0x18ed75=[];for(var _0xe97589=0x0,_0x222a03=0x1;_0xe97589<_0x130433[_0x92a0('0x16')];_0xe97589++,_0x222a03=0x1){_0x18ed75=_0x18ed75[_0x92a0('0x17')](getUserApplications(_0x49de79,_0x130433[_0xe97589],_0x130433[_0xe97589]['internal']));if(_0x130433[_0xe97589][_0x92a0('0x18')]!=_0x130433[_0xe97589][_0x92a0('0x12')]){_0x18ed75=_0x18ed75['concat'](getUserApplications(_0x49de79,_0x130433[_0xe97589],_0x130433[_0xe97589][_0x92a0('0x12')]));}}return _0x18ed75;};var getChanSpyPromise=function(_0x1e3e31,_0x53014b){return new BPromise(function(_0x33615f,_0x597158){return _0x1e3e31[_0x92a0('0x19')][_0x92a0('0x1a')]({'attributes':['id',_0x92a0('0x12'),_0x92a0('0x18')],'where':{'role':_0x92a0('0x1b'),'chanspy':!![]},'raw':!![]})[_0x92a0('0x1c')](function(_0x5397ab){if(_0x5397ab){return _0x33615f(getChanSpyApplications(_0x53014b,_0x5397ab));}return _0x33615f([]);})[_0x92a0('0x1d')](function(_0x361f84){_0x597158(_0x361f84);});});};module[_0x92a0('0x1e')]=function(_0x20225f,_0x499217){var _0x14117a=_0x20225f[_0x92a0('0x1f')];return _0x20225f[_0x92a0('0x20')](_0x92a0('0x21'),attributes,{'tableName':_0x92a0('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x302cc1,_0x4649cc,_0x377fe){return getChanSpyPromise(_0x14117a,_0x302cc1)[_0x92a0('0x1c')](function(_0x4b4f7b){if(_0x4b4f7b&&_0x4b4f7b[_0x92a0('0x16')]){return _0x14117a[_0x92a0('0x23')][_0x92a0('0x24')](_0x4b4f7b);}})['then'](function(){_0x377fe();})[_0x92a0('0x1d')](function(_0x271e1c){_0x377fe(_0x271e1c);});},'afterUpdate':function(_0x211337,_0x568341,_0x529653){return _0x14117a[_0x92a0('0x23')][_0x92a0('0x25')]({'where':{'ChanSpyId':_0x211337['id']}})['then'](function(){return getChanSpyPromise(_0x14117a,_0x211337);})[_0x92a0('0x1c')](function(_0x437132){if(_0x437132&&_0x437132['length']){return _0x14117a['VoiceExtension'][_0x92a0('0x24')](_0x437132);}})[_0x92a0('0x1c')](function(){_0x529653();})['catch'](function(_0x13a475){_0x529653(_0x13a475);});},'afterDestroy':function(_0x3a84a1,_0x3f5073,_0x2d405c){return _0x14117a['VoiceExtension'][_0x92a0('0x25')]({'where':{'ChanSpyId':_0x3a84a1['id']}})['then'](function(){_0x2d405c();})[_0x92a0('0x1d')](function(_0x29bfa6){_0x2d405c(_0x29bfa6);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index dde5c0e..852f6cf 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 _0x422f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x422f,0x1c7));var _0xf422=function(_0x4cf104,_0x470834){_0x4cf104=_0x4cf104-0x0;var _0xa32f24=_0x422f[_0x4cf104];return _0xa32f24;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});} \ No newline at end of file +var _0x80df=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x26ab77,_0x377b98){var _0x1b37cb=function(_0x25818f){while(--_0x25818f){_0x26ab77['push'](_0x26ab77['shift']());}};_0x1b37cb(++_0x377b98);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3db670e..ebb0099 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 _0x4400=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x4400,0xfc));var _0x0440=function(_0x2f22e0,_0x3a5483){_0x2f22e0=_0x2f22e0-0x0;var _0x314516=_0x4400[_0x2f22e0];return _0x314516;};'use strict';var multer=require(_0x0440('0x0'));var util=require(_0x0440('0x1'));var path=require(_0x0440('0x2'));var timeout=require(_0x0440('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0440('0x4'));var config=require(_0x0440('0x5'));var controller=require(_0x0440('0x6'));router[_0x0440('0x7')]('/',auth[_0x0440('0x8')](),controller[_0x0440('0x9')]);router[_0x0440('0x7')](_0x0440('0xa'),auth[_0x0440('0x8')](),controller[_0x0440('0xb')]);router[_0x0440('0xc')]('/',auth[_0x0440('0x8')](),controller[_0x0440('0xd')]);router[_0x0440('0xe')](_0x0440('0xa'),auth['isAuthenticated'](),controller[_0x0440('0xf')]);router[_0x0440('0x10')](_0x0440('0xa'),auth[_0x0440('0x8')](),controller[_0x0440('0x11')]);module[_0x0440('0x12')]=router; \ No newline at end of file +var _0xc150=['isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceContext.controller'];(function(_0x33f9d8,_0x1f347f){var _0x49e7bf=function(_0x429833){while(--_0x429833){_0x33f9d8['push'](_0x33f9d8['shift']());}};_0x49e7bf(++_0x1f347f);}(_0xc150,0x170));var _0x0c15=function(_0x3f231d,_0x32a423){_0x3f231d=_0x3f231d-0x0;var _0x192b3e=_0xc150[_0x3f231d];return _0x192b3e;};'use strict';var multer=require('multer');var util=require(_0x0c15('0x0'));var path=require('path');var timeout=require(_0x0c15('0x1'));var express=require('express');var router=express[_0x0c15('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0c15('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0c15('0x4'));var controller=require(_0x0c15('0x5'));router['get']('/',auth[_0x0c15('0x6')](),controller['index']);router[_0x0c15('0x7')](_0x0c15('0x8'),auth[_0x0c15('0x6')](),controller[_0x0c15('0x9')]);router[_0x0c15('0xa')]('/',auth[_0x0c15('0x6')](),controller[_0x0c15('0xb')]);router[_0x0c15('0xc')](_0x0c15('0x8'),auth[_0x0c15('0x6')](),controller[_0x0c15('0xd')]);router[_0x0c15('0xe')]('/:id',auth[_0x0c15('0x6')](),controller[_0x0c15('0xf')]);module[_0x0c15('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1f5ea51..109ca50 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 _0x6ce7=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x1aa368,_0x56c31d){var _0x3d9e29=function(_0x32c580){while(--_0x32c580){_0x1aa368['push'](_0x1aa368['shift']());}};_0x3d9e29(++_0x56c31d);}(_0x6ce7,0x110));var _0x76ce=function(_0x5df98e,_0x5aeb02){_0x5df98e=_0x5df98e-0x0;var _0x2fdcd9=_0x6ce7[_0x5df98e];return _0x2fdcd9;};'use strict';var Sequelize=require(_0x76ce('0x0'));module[_0x76ce('0x1')]={'name':{'type':Sequelize[_0x76ce('0x2')],'unique':_0x76ce('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x76ce('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0da=['exports','STRING','name','BOOLEAN'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xb0da,0x168));var _0xab0d=function(_0x765c55,_0xc3bca3){_0x765c55=_0x765c55-0x0;var _0x8a9c30=_0xb0da[_0x765c55];return _0x8a9c30;};'use strict';var Sequelize=require('sequelize');module[_0xab0d('0x0')]={'name':{'type':Sequelize[_0xab0d('0x1')],'unique':_0xab0d('0x2')},'description':{'type':Sequelize[_0xab0d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xab0d('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 7721669..e8a33ad 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 _0x314a=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','writeFileSync','params','root','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','limit','count','set','json','apply','reject','update','UserProfileResource','destroy','name','send','VoiceContext','type','query','intersection','attributes','model','fields'];(function(_0x15a158,_0x462479){var _0x3d31b8=function(_0x45aaf6){while(--_0x45aaf6){_0x15a158['push'](_0x15a158['shift']());}};_0x3d31b8(++_0x462479);}(_0x314a,0xee));var _0xa314=function(_0x2a0a38,_0x4a6de5){_0x2a0a38=_0x2a0a38-0x0;var _0x4a200e=_0x314a[_0x2a0a38];return _0x4a200e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa314('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa314('0x1'));var rp=require(_0xa314('0x2'));var moment=require('moment');var BPromise=require(_0xa314('0x3'));var Mustache=require(_0xa314('0x4'));var util=require(_0xa314('0x5'));var path=require(_0xa314('0x6'));var sox=require('sox');var csv=require(_0xa314('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa314('0x8'));var _=require(_0xa314('0x9'));var squel=require('squel');var crypto=require(_0xa314('0xa'));var jsforce=require(_0xa314('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa314('0x7'));var querystring=require(_0xa314('0xc'));var Papa=require(_0xa314('0xd'));var Redis=require(_0xa314('0xe'));var authService=require(_0xa314('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa314('0x10'));var hardwareService=require(_0xa314('0x11'));var logger=require(_0xa314('0x12'))(_0xa314('0x13'));var utils=require(_0xa314('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa314('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa314('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5afc84,_0x55bd21,_0x1539fd,_0x3caeff){return new BPromise(function(_0x231108,_0x1f04e3){var _0x31f45c=_0x3caeff||client;return _0x31f45c['request'](_0x5afc84,_0x1539fd)[_0xa314('0x17')](function(_0x4fcee7){logger[_0xa314('0x18')]('VoiceContext,\x20%s,\x20%s',_0x55bd21,_0xa314('0x19'));logger[_0xa314('0x1a')](_0xa314('0x1b'),_0x55bd21,_0xa314('0x19'),JSON[_0xa314('0x1c')](_0x4fcee7));if(_0x4fcee7[_0xa314('0x1d')]){if(_0x4fcee7[_0xa314('0x1d')]['code']===0x1f4){logger['error'](_0xa314('0x1e'),_0x55bd21,_0x4fcee7[_0xa314('0x1d')]['message']);return _0x1f04e3(_0x4fcee7[_0xa314('0x1d')][_0xa314('0x1f')]);}logger[_0xa314('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x55bd21,_0x4fcee7[_0xa314('0x1d')][_0xa314('0x1f')]);return _0x231108(_0x4fcee7[_0xa314('0x1d')]['message']);}else{logger[_0xa314('0x18')](_0xa314('0x1e'),_0x55bd21,_0xa314('0x19'));_0x231108(_0x4fcee7[_0xa314('0x20')][_0xa314('0x1f')]);}})[_0xa314('0x21')](function(_0x4d72c1){logger[_0xa314('0x1d')](_0xa314('0x1e'),_0x55bd21,_0x4d72c1);_0x1f04e3(_0x4d72c1);});});}function respondWithStatusCode(_0x2082a0,_0x5e3ed6){_0x5e3ed6=_0x5e3ed6||0xcc;return function(_0x2e68dc){if(_0x2e68dc){return _0x2082a0[_0xa314('0x22')](_0x5e3ed6);}return _0x2082a0['status'](_0x5e3ed6)[_0xa314('0x23')]();};}function respondWithResult(_0x51abdf,_0x3992eb){_0x3992eb=_0x3992eb||0xc8;return function(_0xa5f3f7){if(_0xa5f3f7){return _0x51abdf[_0xa314('0x24')](_0x3992eb)['json'](_0xa5f3f7);}};}function respondWithFilteredResult(_0x110df4,_0x46c299){return function(_0xa4818e){if(_0xa4818e){var _0x8e8b0d=typeof _0x46c299[_0xa314('0x25')]==='undefined'&&typeof _0x46c299[_0xa314('0x26')]==='undefined';var _0x4ed20c=_0xa4818e[_0xa314('0x27')];var _0x599d34=_0x8e8b0d?0x0:_0x46c299['offset'];var _0x50571a=_0x8e8b0d?_0xa4818e[_0xa314('0x27')]:_0x46c299[_0xa314('0x25')]+_0x46c299[_0xa314('0x26')];var _0x2597bb;if(_0x50571a>=_0x4ed20c){_0x50571a=_0x4ed20c;_0x2597bb=0xc8;}else{_0x2597bb=0xce;}_0x110df4[_0xa314('0x24')](_0x2597bb);return _0x110df4[_0xa314('0x28')]('Content-Range',_0x599d34+'-'+_0x50571a+'/'+_0x4ed20c)[_0xa314('0x29')](_0xa4818e);}return null;};}function patchUpdates(_0x54ce68){return function(_0x4cbb09){try{jsonpatch[_0xa314('0x2a')](_0x4cbb09,_0x54ce68,!![]);}catch(_0xb9c4b4){return BPromise[_0xa314('0x2b')](_0xb9c4b4);}return _0x4cbb09['save']();};}function saveUpdates(_0x4f2304,_0x181011){return function(_0x4bc288){if(_0x4bc288){return _0x4bc288[_0xa314('0x2c')](_0x4f2304)[_0xa314('0x17')](function(_0x1b2458){return _0x1b2458;});}return null;};}function removeEntity(_0x2e322c,_0x3ab381){return function(_0x5072ae){if(_0x5072ae){return _0x5072ae['destroy']()[_0xa314('0x17')](function(){var _0x122327=_0x5072ae['get']({'plain':!![]});var _0x36b024='Contexts';return db[_0xa314('0x2d')][_0xa314('0x2e')]({'where':{'type':_0x36b024,'resourceId':_0x122327['id']}})[_0xa314('0x17')](function(){return _0x5072ae;});})['then'](function(){_0x2e322c[_0xa314('0x24')](0xcc)[_0xa314('0x23')]();});}};}function handleEntityNotFound(_0x58298b,_0x3fb51a){return function(_0x2569c4){if(!_0x2569c4){_0x58298b[_0xa314('0x22')](0x194);}return _0x2569c4;};}function handleError(_0x3f8080,_0x3fb351){_0x3fb351=_0x3fb351||0x1f4;return function(_0x3415dc){logger[_0xa314('0x1d')](_0x3415dc['stack']);if(_0x3415dc[_0xa314('0x2f')]){delete _0x3415dc[_0xa314('0x2f')];}_0x3f8080[_0xa314('0x24')](_0x3fb351)[_0xa314('0x30')](_0x3415dc);};}exports['index']=function(_0x595895,_0x53e4fd){var _0xa36ced={},_0x215f1e={},_0x242637={'count':0x0,'rows':[]};var _0x3552f8=_['map'](db[_0xa314('0x31')]['rawAttributes'],function(_0x461cb2){return{'name':_0x461cb2['fieldName'],'type':_0x461cb2[_0xa314('0x32')]['key']};});_0x215f1e['model']=_['map'](_0x3552f8,_0xa314('0x2f'));_0x215f1e[_0xa314('0x33')]=_['keys'](_0x595895['query']);_0x215f1e['filters']=_[_0xa314('0x34')](_0x215f1e['model'],_0x215f1e[_0xa314('0x33')]);_0xa36ced[_0xa314('0x35')]=_[_0xa314('0x34')](_0x215f1e[_0xa314('0x36')],qs[_0xa314('0x37')](_0x595895[_0xa314('0x33')][_0xa314('0x37')]));_0xa36ced[_0xa314('0x35')]=_0xa36ced[_0xa314('0x35')][_0xa314('0x38')]?_0xa36ced[_0xa314('0x35')]:_0x215f1e[_0xa314('0x36')];if(!_0x595895[_0xa314('0x33')][_0xa314('0x39')](_0xa314('0x3a'))){_0xa36ced[_0xa314('0x26')]=qs['limit'](_0x595895[_0xa314('0x33')][_0xa314('0x26')]);_0xa36ced['offset']=qs[_0xa314('0x25')](_0x595895[_0xa314('0x33')][_0xa314('0x25')]);}_0xa36ced[_0xa314('0x3b')]=qs[_0xa314('0x3c')](_0x595895['query'][_0xa314('0x3c')]);_0xa36ced[_0xa314('0x3d')]=qs[_0xa314('0x3e')](_[_0xa314('0x3f')](_0x595895['query'],_0x215f1e['filters']),_0x3552f8);if(_0x595895[_0xa314('0x33')]['filter']){_0xa36ced[_0xa314('0x3d')]=_['merge'](_0xa36ced[_0xa314('0x3d')],{'$or':_[_0xa314('0x40')](_0x3552f8,function(_0x55984e){if(_0x55984e[_0xa314('0x32')]!==_0xa314('0x41')){var _0x52344b={};_0x52344b[_0x55984e[_0xa314('0x2f')]]={'$like':'%'+_0x595895[_0xa314('0x33')][_0xa314('0x42')]+'%'};return _0x52344b;}})});}_0xa36ced=_[_0xa314('0x43')]({},_0xa36ced,_0x595895[_0xa314('0x44')]);var _0x14a383={'where':_0xa36ced['where']};return db[_0xa314('0x31')]['count'](_0x14a383)[_0xa314('0x17')](function(_0x2c9cad){_0x242637[_0xa314('0x27')]=_0x2c9cad;if(_0x595895[_0xa314('0x33')][_0xa314('0x45')]){_0xa36ced[_0xa314('0x46')]=[{'all':!![]}];}return db[_0xa314('0x31')][_0xa314('0x47')](_0xa36ced);})[_0xa314('0x17')](function(_0xa00839){_0x242637[_0xa314('0x48')]=_0xa00839;return _0x242637;})[_0xa314('0x17')](respondWithFilteredResult(_0x53e4fd,_0xa36ced))[_0xa314('0x21')](handleError(_0x53e4fd,null));};exports[_0xa314('0x49')]=function(_0x3935e7,_0x467e36){var _0xfdd2f8={'raw':![],'where':{'id':_0x3935e7['params']['id']}},_0x429448={};_0x429448[_0xa314('0x36')]=_[_0xa314('0x4a')](db['VoiceContext'][_0xa314('0x4b')]);_0x429448[_0xa314('0x33')]=_[_0xa314('0x4a')](_0x3935e7[_0xa314('0x33')]);_0x429448[_0xa314('0x3e')]=_[_0xa314('0x34')](_0x429448[_0xa314('0x36')],_0x429448[_0xa314('0x33')]);_0xfdd2f8[_0xa314('0x35')]=_[_0xa314('0x34')](_0x429448['model'],qs[_0xa314('0x37')](_0x3935e7['query']['fields']));_0xfdd2f8[_0xa314('0x35')]=_0xfdd2f8['attributes']['length']?_0xfdd2f8[_0xa314('0x35')]:_0x429448[_0xa314('0x36')];if(_0x3935e7['query'][_0xa314('0x45')]){_0xfdd2f8[_0xa314('0x46')]=[{'all':!![]}];}_0xfdd2f8=_[_0xa314('0x43')]({},_0xfdd2f8,_0x3935e7[_0xa314('0x44')]);return db[_0xa314('0x31')][_0xa314('0x4c')](_0xfdd2f8)[_0xa314('0x17')](handleEntityNotFound(_0x467e36,null))[_0xa314('0x17')](respondWithResult(_0x467e36,null))['catch'](handleError(_0x467e36,null));};exports['create']=function(_0x4e319c,_0x2b2531,_0x1fd90c){var _0x3c104e;return db['VoiceContext'][_0xa314('0x4d')](_0x4e319c[_0xa314('0x4e')],{'raw':!![]})['then'](function(_0x21b0ca){_0x3c104e=_0x21b0ca;return db[_0xa314('0x31')][_0xa314('0x47')]({'raw':!![]});})[_0xa314('0x17')](function(_0xafa9ac){var _0x589aa8=fs[_0xa314('0x4f')](path[_0xa314('0x50')](config['root'],_0xa314('0x51')),_0xa314('0x52'));var _0x45493f=ejs[_0xa314('0x53')](_0x589aa8,{'contexts':_0xafa9ac||[]});fs['writeFileSync'](_0xa314('0x54'),_0x45493f);})[_0xa314('0x17')](function(){return respondWithRpcPromise(_0xa314('0x55'),_0xa314('0x4d'),{'module':_0xa314('0x56')});})['then'](function(){var _0x541beb=_0x4e319c[_0xa314('0x57')][_0xa314('0x58')]({'plain':!![]});if(!_0x541beb)throw new Error(_0xa314('0x59'));if(_0x541beb[_0xa314('0x5a')]===_0xa314('0x57')){var _0x46dffd=_0x3c104e[_0xa314('0x58')]({'plain':!![]});return db[_0xa314('0x5b')][_0xa314('0x4c')]({'where':{'name':_0xa314('0x5c'),'userProfileId':_0x541beb[_0xa314('0x5d')]},'raw':!![]})[_0xa314('0x17')](function(_0x10f233){if(_0x10f233&&_0x10f233[_0xa314('0x5e')]===0x0){return db[_0xa314('0x2d')]['create']({'name':_0x46dffd[_0xa314('0x2f')],'resourceId':_0x46dffd['id'],'type':_0x10f233[_0xa314('0x2f')],'sectionId':_0x10f233['id']},{})[_0xa314('0x17')](function(){return _0x3c104e;});}else{return _0x3c104e;}})[_0xa314('0x21')](function(_0x43f12f){logger[_0xa314('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43f12f);throw _0x43f12f;});}return _0x3c104e;})[_0xa314('0x17')](respondWithResult(_0x2b2531,0xc9))[_0xa314('0x21')](handleError(_0x2b2531,null));};exports['update']=function(_0x21c000,_0x77e92b,_0x4d10c4){var _0x2a943c;return db['VoiceContext'][_0xa314('0x4c')]({'where':{'id':_0x21c000['params']['id']}})[_0xa314('0x17')](handleEntityNotFound(_0x77e92b,null))[_0xa314('0x17')](saveUpdates(_0x21c000['body'],null))['then'](function(_0x43e9be){if(_0x43e9be){_0x2a943c=_0x43e9be;return db[_0xa314('0x31')]['findAll']({'raw':!![]});}})[_0xa314('0x17')](function(_0x33644a){var _0x528b7f=fs['readFileSync'](path[_0xa314('0x50')](config['root'],_0xa314('0x51')),'utf8');var _0xc3b216=ejs[_0xa314('0x53')](_0x528b7f,{'contexts':_0x33644a||[]});fs[_0xa314('0x5f')](_0xa314('0x54'),_0xc3b216);})[_0xa314('0x17')](function(){return respondWithRpcPromise(_0xa314('0x55'),_0xa314('0x2c'),{'module':_0xa314('0x56')});})[_0xa314('0x17')](function(){return _0x2a943c;})[_0xa314('0x17')](respondWithResult(_0x77e92b,null))[_0xa314('0x21')](handleError(_0x77e92b,null));};exports[_0xa314('0x2e')]=function(_0x379977,_0x1a43ca,_0x54ccf2){var _0x348763;return db['VoiceContext'][_0xa314('0x4c')]({'where':{'id':_0x379977[_0xa314('0x60')]['id']}})['then'](handleEntityNotFound(_0x1a43ca,null))[_0xa314('0x17')](removeEntity(_0x1a43ca,null))['then'](function(){return db['VoiceContext'][_0xa314('0x47')]({'raw':!![]});})['then'](function(_0x41af16){var _0x592d1a=fs[_0xa314('0x4f')](path[_0xa314('0x50')](config[_0xa314('0x61')],'server/files/templates/context.ejs'),'utf8');var _0x166140=ejs[_0xa314('0x53')](_0x592d1a,{'contexts':_0x41af16});fs[_0xa314('0x5f')](_0xa314('0x54'),_0x166140);return respondWithRpcPromise(_0xa314('0x55'),_0xa314('0x2e'),{'module':_0xa314('0x56')});})[_0xa314('0x21')](handleError(_0x1a43ca,null));}; \ No newline at end of file +var _0x5b9e=['util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','Contexts','UserProfileResource','sendStatus','name','send','index','map','VoiceContext','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','params','find','create','join','server/files/templates/context.ejs','utf8','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readFileSync','render','/etc/asterisk/extensions_xcally_contexts.conf','root','writeFileSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x5b9e,0x13b));var _0xe5b9=function(_0x30b638,_0x2e9c7e){_0x30b638=_0x30b638-0x0;var _0x507dad=_0x5b9e[_0x30b638];return _0x507dad;};'use strict';var emlformat=require(_0xe5b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5b9('0x1'));var jsonpatch=require(_0xe5b9('0x2'));var rp=require('request-promise');var moment=require(_0xe5b9('0x3'));var BPromise=require(_0xe5b9('0x4'));var Mustache=require(_0xe5b9('0x5'));var util=require(_0xe5b9('0x6'));var path=require(_0xe5b9('0x7'));var sox=require(_0xe5b9('0x8'));var csv=require('to-csv');var ejs=require(_0xe5b9('0x9'));var fs=require('fs');var fs_extra=require(_0xe5b9('0xa'));var _=require(_0xe5b9('0xb'));var squel=require(_0xe5b9('0xc'));var crypto=require(_0xe5b9('0xd'));var jsforce=require(_0xe5b9('0xe'));var deskjs=require(_0xe5b9('0xf'));var toCsv=require(_0xe5b9('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe5b9('0x11'));var authService=require(_0xe5b9('0x12'));var qs=require(_0xe5b9('0x13'));var as=require(_0xe5b9('0x14'));var hardwareService=require(_0xe5b9('0x15'));var logger=require(_0xe5b9('0x16'))(_0xe5b9('0x17'));var utils=require('../../config/utils');var config=require(_0xe5b9('0x18'));var licenseUtil=require(_0xe5b9('0x19'));var db=require(_0xe5b9('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe5b9('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10253f,_0x2100a4,_0x5b1f75,_0x4d32bf){return new BPromise(function(_0x3d1580,_0x332bd0){var _0x458ec5=_0x4d32bf||client;return _0x458ec5[_0xe5b9('0x1c')](_0x10253f,_0x5b1f75)['then'](function(_0x134a23){logger[_0xe5b9('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x2100a4,'request\x20sent');logger[_0xe5b9('0x1e')](_0xe5b9('0x1f'),_0x2100a4,_0xe5b9('0x20'),JSON[_0xe5b9('0x21')](_0x134a23));if(_0x134a23[_0xe5b9('0x22')]){if(_0x134a23[_0xe5b9('0x22')][_0xe5b9('0x23')]===0x1f4){logger[_0xe5b9('0x22')](_0xe5b9('0x24'),_0x2100a4,_0x134a23[_0xe5b9('0x22')]['message']);return _0x332bd0(_0x134a23[_0xe5b9('0x22')][_0xe5b9('0x25')]);}logger[_0xe5b9('0x22')](_0xe5b9('0x24'),_0x2100a4,_0x134a23['error'][_0xe5b9('0x25')]);return _0x3d1580(_0x134a23[_0xe5b9('0x22')]['message']);}else{logger[_0xe5b9('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x2100a4,_0xe5b9('0x20'));_0x3d1580(_0x134a23[_0xe5b9('0x26')][_0xe5b9('0x25')]);}})[_0xe5b9('0x27')](function(_0x37a606){logger[_0xe5b9('0x22')](_0xe5b9('0x24'),_0x2100a4,_0x37a606);_0x332bd0(_0x37a606);});});}function respondWithStatusCode(_0x2da338,_0x5868f8){_0x5868f8=_0x5868f8||0xcc;return function(_0x17dd34){if(_0x17dd34){return _0x2da338['sendStatus'](_0x5868f8);}return _0x2da338['status'](_0x5868f8)[_0xe5b9('0x28')]();};}function respondWithResult(_0xd1fd39,_0x266deb){_0x266deb=_0x266deb||0xc8;return function(_0x54016c){if(_0x54016c){return _0xd1fd39[_0xe5b9('0x29')](_0x266deb)[_0xe5b9('0x2a')](_0x54016c);}};}function respondWithFilteredResult(_0x48c62f,_0xb85844){return function(_0x1c7924){if(_0x1c7924){var _0x56a07b=typeof _0xb85844[_0xe5b9('0x2b')]===_0xe5b9('0x2c')&&typeof _0xb85844[_0xe5b9('0x2d')]===_0xe5b9('0x2c');var _0x516dbd=_0x1c7924['count'];var _0x29f498=_0x56a07b?0x0:_0xb85844[_0xe5b9('0x2b')];var _0x5dfbf4=_0x56a07b?_0x1c7924['count']:_0xb85844[_0xe5b9('0x2b')]+_0xb85844['limit'];var _0x151438;if(_0x5dfbf4>=_0x516dbd){_0x5dfbf4=_0x516dbd;_0x151438=0xc8;}else{_0x151438=0xce;}_0x48c62f['status'](_0x151438);return _0x48c62f[_0xe5b9('0x2e')](_0xe5b9('0x2f'),_0x29f498+'-'+_0x5dfbf4+'/'+_0x516dbd)['json'](_0x1c7924);}return null;};}function patchUpdates(_0x51cf32){return function(_0x1203c4){try{jsonpatch[_0xe5b9('0x30')](_0x1203c4,_0x51cf32,!![]);}catch(_0x541663){return BPromise[_0xe5b9('0x31')](_0x541663);}return _0x1203c4[_0xe5b9('0x32')]();};}function saveUpdates(_0x1c21b9,_0x3eff66){return function(_0x3df59d){if(_0x3df59d){return _0x3df59d[_0xe5b9('0x33')](_0x1c21b9)[_0xe5b9('0x34')](function(_0x453478){return _0x453478;});}return null;};}function removeEntity(_0x3c1301,_0x3dabf9){return function(_0x15ab85){if(_0x15ab85){return _0x15ab85[_0xe5b9('0x35')]()[_0xe5b9('0x34')](function(){var _0x86a337=_0x15ab85['get']({'plain':!![]});var _0xc70800=_0xe5b9('0x36');return db[_0xe5b9('0x37')]['destroy']({'where':{'type':_0xc70800,'resourceId':_0x86a337['id']}})[_0xe5b9('0x34')](function(){return _0x15ab85;});})['then'](function(){_0x3c1301[_0xe5b9('0x29')](0xcc)[_0xe5b9('0x28')]();});}};}function handleEntityNotFound(_0x18f2da,_0x1db135){return function(_0x469cef){if(!_0x469cef){_0x18f2da[_0xe5b9('0x38')](0x194);}return _0x469cef;};}function handleError(_0x3b4306,_0x5f50cd){_0x5f50cd=_0x5f50cd||0x1f4;return function(_0x31f63f){logger[_0xe5b9('0x22')](_0x31f63f['stack']);if(_0x31f63f[_0xe5b9('0x39')]){delete _0x31f63f[_0xe5b9('0x39')];}_0x3b4306['status'](_0x5f50cd)[_0xe5b9('0x3a')](_0x31f63f);};}exports[_0xe5b9('0x3b')]=function(_0x3121ed,_0x24d17d){var _0x3ceb55={},_0x2135cf={},_0x2663e3={'count':0x0,'rows':[]};var _0x48873e=_[_0xe5b9('0x3c')](db[_0xe5b9('0x3d')][_0xe5b9('0x3e')],function(_0x349d71){return{'name':_0x349d71[_0xe5b9('0x3f')],'type':_0x349d71['type']['key']};});_0x2135cf[_0xe5b9('0x40')]=_[_0xe5b9('0x3c')](_0x48873e,'name');_0x2135cf[_0xe5b9('0x41')]=_[_0xe5b9('0x42')](_0x3121ed[_0xe5b9('0x41')]);_0x2135cf[_0xe5b9('0x43')]=_[_0xe5b9('0x44')](_0x2135cf[_0xe5b9('0x40')],_0x2135cf[_0xe5b9('0x41')]);_0x3ceb55[_0xe5b9('0x45')]=_['intersection'](_0x2135cf[_0xe5b9('0x40')],qs[_0xe5b9('0x46')](_0x3121ed['query'][_0xe5b9('0x46')]));_0x3ceb55[_0xe5b9('0x45')]=_0x3ceb55[_0xe5b9('0x45')][_0xe5b9('0x47')]?_0x3ceb55[_0xe5b9('0x45')]:_0x2135cf[_0xe5b9('0x40')];if(!_0x3121ed[_0xe5b9('0x41')][_0xe5b9('0x48')](_0xe5b9('0x49'))){_0x3ceb55[_0xe5b9('0x2d')]=qs[_0xe5b9('0x2d')](_0x3121ed[_0xe5b9('0x41')]['limit']);_0x3ceb55[_0xe5b9('0x2b')]=qs['offset'](_0x3121ed['query'][_0xe5b9('0x2b')]);}_0x3ceb55[_0xe5b9('0x4a')]=qs['sort'](_0x3121ed[_0xe5b9('0x41')][_0xe5b9('0x4b')]);_0x3ceb55[_0xe5b9('0x4c')]=qs['filters'](_[_0xe5b9('0x4d')](_0x3121ed[_0xe5b9('0x41')],_0x2135cf[_0xe5b9('0x43')]),_0x48873e);if(_0x3121ed[_0xe5b9('0x41')][_0xe5b9('0x4e')]){_0x3ceb55[_0xe5b9('0x4c')]=_[_0xe5b9('0x4f')](_0x3ceb55[_0xe5b9('0x4c')],{'$or':_['map'](_0x48873e,function(_0x165b59){if(_0x165b59[_0xe5b9('0x50')]!==_0xe5b9('0x51')){var _0x14229a={};_0x14229a[_0x165b59[_0xe5b9('0x39')]]={'$like':'%'+_0x3121ed['query'][_0xe5b9('0x4e')]+'%'};return _0x14229a;}})});}_0x3ceb55=_[_0xe5b9('0x4f')]({},_0x3ceb55,_0x3121ed['options']);var _0x1fb459={'where':_0x3ceb55['where']};return db['VoiceContext'][_0xe5b9('0x52')](_0x1fb459)['then'](function(_0x167da7){_0x2663e3[_0xe5b9('0x52')]=_0x167da7;if(_0x3121ed[_0xe5b9('0x41')][_0xe5b9('0x53')]){_0x3ceb55[_0xe5b9('0x54')]=[{'all':!![]}];}return db[_0xe5b9('0x3d')][_0xe5b9('0x55')](_0x3ceb55);})[_0xe5b9('0x34')](function(_0x39ddc9){_0x2663e3[_0xe5b9('0x56')]=_0x39ddc9;return _0x2663e3;})[_0xe5b9('0x34')](respondWithFilteredResult(_0x24d17d,_0x3ceb55))['catch'](handleError(_0x24d17d,null));};exports['show']=function(_0x4154a3,_0x3eae62){var _0xb4930d={'raw':![],'where':{'id':_0x4154a3[_0xe5b9('0x57')]['id']}},_0x137b76={};_0x137b76['model']=_[_0xe5b9('0x42')](db[_0xe5b9('0x3d')][_0xe5b9('0x3e')]);_0x137b76['query']=_['keys'](_0x4154a3[_0xe5b9('0x41')]);_0x137b76[_0xe5b9('0x43')]=_[_0xe5b9('0x44')](_0x137b76[_0xe5b9('0x40')],_0x137b76[_0xe5b9('0x41')]);_0xb4930d[_0xe5b9('0x45')]=_[_0xe5b9('0x44')](_0x137b76[_0xe5b9('0x40')],qs[_0xe5b9('0x46')](_0x4154a3[_0xe5b9('0x41')][_0xe5b9('0x46')]));_0xb4930d[_0xe5b9('0x45')]=_0xb4930d[_0xe5b9('0x45')]['length']?_0xb4930d[_0xe5b9('0x45')]:_0x137b76[_0xe5b9('0x40')];if(_0x4154a3[_0xe5b9('0x41')][_0xe5b9('0x53')]){_0xb4930d[_0xe5b9('0x54')]=[{'all':!![]}];}_0xb4930d=_['merge']({},_0xb4930d,_0x4154a3['options']);return db[_0xe5b9('0x3d')][_0xe5b9('0x58')](_0xb4930d)[_0xe5b9('0x34')](handleEntityNotFound(_0x3eae62,null))[_0xe5b9('0x34')](respondWithResult(_0x3eae62,null))['catch'](handleError(_0x3eae62,null));};exports['create']=function(_0x200c68,_0x18d019,_0x27e4ad){var _0x33d620;return db[_0xe5b9('0x3d')][_0xe5b9('0x59')](_0x200c68['body'],{'raw':!![]})[_0xe5b9('0x34')](function(_0x5d3e50){_0x33d620=_0x5d3e50;return db[_0xe5b9('0x3d')][_0xe5b9('0x55')]({'raw':!![]});})[_0xe5b9('0x34')](function(_0x5871fb){var _0x503d6f=fs['readFileSync'](path[_0xe5b9('0x5a')](config['root'],_0xe5b9('0x5b')),_0xe5b9('0x5c'));var _0x34a035=ejs['render'](_0x503d6f,{'contexts':_0x5871fb||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x34a035);})[_0xe5b9('0x34')](function(){return respondWithRpcPromise(_0xe5b9('0x5d'),_0xe5b9('0x59'),{'module':_0xe5b9('0x5e')});})[_0xe5b9('0x34')](function(){var _0x4a31eb=_0x200c68[_0xe5b9('0x5f')][_0xe5b9('0x60')]({'plain':!![]});if(!_0x4a31eb)throw new Error(_0xe5b9('0x61'));if(_0x4a31eb[_0xe5b9('0x62')]===_0xe5b9('0x5f')){var _0x4508a6=_0x33d620[_0xe5b9('0x60')]({'plain':!![]});return db[_0xe5b9('0x63')][_0xe5b9('0x58')]({'where':{'name':'Contexts','userProfileId':_0x4a31eb[_0xe5b9('0x64')]},'raw':!![]})['then'](function(_0x53833c){if(_0x53833c&&_0x53833c[_0xe5b9('0x65')]===0x0){return db[_0xe5b9('0x37')][_0xe5b9('0x59')]({'name':_0x4508a6[_0xe5b9('0x39')],'resourceId':_0x4508a6['id'],'type':_0x53833c[_0xe5b9('0x39')],'sectionId':_0x53833c['id']},{})['then'](function(){return _0x33d620;});}else{return _0x33d620;}})[_0xe5b9('0x27')](function(_0x336637){logger[_0xe5b9('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x336637);throw _0x336637;});}return _0x33d620;})[_0xe5b9('0x34')](respondWithResult(_0x18d019,0xc9))[_0xe5b9('0x27')](handleError(_0x18d019,null));};exports[_0xe5b9('0x33')]=function(_0x5ec238,_0x500306,_0x845eb6){var _0x3b2e4f;return db[_0xe5b9('0x3d')]['find']({'where':{'id':_0x5ec238[_0xe5b9('0x57')]['id']}})[_0xe5b9('0x34')](handleEntityNotFound(_0x500306,null))['then'](saveUpdates(_0x5ec238['body'],null))[_0xe5b9('0x34')](function(_0x303d0a){if(_0x303d0a){_0x3b2e4f=_0x303d0a;return db[_0xe5b9('0x3d')]['findAll']({'raw':!![]});}})[_0xe5b9('0x34')](function(_0x4de603){var _0x31ecb0=fs[_0xe5b9('0x66')](path[_0xe5b9('0x5a')](config['root'],'server/files/templates/context.ejs'),_0xe5b9('0x5c'));var _0x10fc1b=ejs[_0xe5b9('0x67')](_0x31ecb0,{'contexts':_0x4de603||[]});fs['writeFileSync'](_0xe5b9('0x68'),_0x10fc1b);})[_0xe5b9('0x34')](function(){return respondWithRpcPromise('Reload',_0xe5b9('0x33'),{'module':_0xe5b9('0x5e')});})[_0xe5b9('0x34')](function(){return _0x3b2e4f;})[_0xe5b9('0x34')](respondWithResult(_0x500306,null))[_0xe5b9('0x27')](handleError(_0x500306,null));};exports[_0xe5b9('0x35')]=function(_0x2b6a2b,_0x4ced2b,_0xf9d731){var _0x214a8a;return db[_0xe5b9('0x3d')]['find']({'where':{'id':_0x2b6a2b[_0xe5b9('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ced2b,null))[_0xe5b9('0x34')](removeEntity(_0x4ced2b,null))[_0xe5b9('0x34')](function(){return db[_0xe5b9('0x3d')][_0xe5b9('0x55')]({'raw':!![]});})[_0xe5b9('0x34')](function(_0x347cb6){var _0x952187=fs[_0xe5b9('0x66')](path[_0xe5b9('0x5a')](config[_0xe5b9('0x69')],'server/files/templates/context.ejs'),_0xe5b9('0x5c'));var _0x1df6dd=ejs['render'](_0x952187,{'contexts':_0x347cb6});fs[_0xe5b9('0x6a')](_0xe5b9('0x68'),_0x1df6dd);return respondWithRpcPromise(_0xe5b9('0x5d'),_0xe5b9('0x35'),{'module':'chan_sip.so'});})[_0xe5b9('0x27')](handleError(_0x4ced2b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 74b7eb9..582069f 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 _0x0031=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x0031,0x6b));var _0x1003=function(_0x4529e0,_0x23a383){_0x4529e0=_0x4529e0-0x0;var _0x31bbc6=_0x0031[_0x4529e0];return _0x31bbc6;};'use strict';var _=require(_0x1003('0x0'));var util=require(_0x1003('0x1'));var logger=require(_0x1003('0x2'))(_0x1003('0x3'));var moment=require(_0x1003('0x4'));var BPromise=require(_0x1003('0x5'));var rp=require(_0x1003('0x6'));var fs=require('fs');var path=require(_0x1003('0x7'));var rimraf=require(_0x1003('0x8'));var config=require(_0x1003('0x9'));var attributes=require(_0x1003('0xa'));module[_0x1003('0xb')]=function(_0x1d444c,_0x176cdf){return _0x1d444c[_0x1003('0xc')](_0x1003('0xd'),attributes,{'tableName':_0x1003('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d7=['moment','request-promise','path','rimraf','exports','VoiceContext','lodash','util','../../config/logger','api'];(function(_0x3e71df,_0x146d45){var _0x4cf1c3=function(_0x56fab4){while(--_0x56fab4){_0x3e71df['push'](_0x3e71df['shift']());}};_0x4cf1c3(++_0x146d45);}(_0xb0d7,0x146));var _0x7b0d=function(_0x58f50a,_0x4b1e14){_0x58f50a=_0x58f50a-0x0;var _0x476081=_0xb0d7[_0x58f50a];return _0x476081;};'use strict';var _=require(_0x7b0d('0x0'));var util=require(_0x7b0d('0x1'));var logger=require(_0x7b0d('0x2'))(_0x7b0d('0x3'));var moment=require(_0x7b0d('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b0d('0x5'));var fs=require('fs');var path=require(_0x7b0d('0x6'));var rimraf=require(_0x7b0d('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x7b0d('0x8')]=function(_0x298e6f,_0x1f0dd3){return _0x298e6f['define'](_0x7b0d('0x9'),attributes,{'tableName':'voice_contexts','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 00a3d24..2f5ffb6 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 _0xd86f=['../../config/utils','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4053a8,_0xd8fd82){var _0x35a79b=function(_0x5ad4b2){while(--_0x5ad4b2){_0x4053a8['push'](_0x4053a8['shift']());}};_0x35a79b(++_0xd8fd82);}(_0xd86f,0xf6));var _0xfd86=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd86f[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xfd86('0x0'));var util=require(_0xfd86('0x1'));var moment=require(_0xfd86('0x2'));var BPromise=require(_0xfd86('0x3'));var rs=require(_0xfd86('0x4'));var fs=require('fs');var Redis=require(_0xfd86('0x5'));var db=require(_0xfd86('0x6'))['db'];var utils=require(_0xfd86('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd86('0x8'));var client=jayson[_0xfd86('0x9')][_0xfd86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52baeb,_0x4d1781,_0xa7cae3){return new BPromise(function(_0x5bf033,_0x4e5d6d){return client[_0xfd86('0xb')](_0x52baeb,_0xa7cae3)[_0xfd86('0xc')](function(_0x1a1932){logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,'request\x20sent');logger[_0xfd86('0xf')](_0xfd86('0x10'),_0x4d1781,'request\x20sent',JSON[_0xfd86('0x11')](_0x1a1932));if(_0x1a1932[_0xfd86('0x12')]){if(_0x1a1932[_0xfd86('0x12')]['code']===0x1f4){logger[_0xfd86('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4d1781,_0x1a1932['error'][_0xfd86('0x13')]);return _0x4e5d6d(_0x1a1932[_0xfd86('0x12')]['message']);}logger[_0xfd86('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4d1781,_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);return _0x5bf033(_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);}else{logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,_0xfd86('0x14'));_0x5bf033(_0x1a1932[_0xfd86('0x15')]['message']);}})[_0xfd86('0x16')](function(_0x23d34f){logger['error'](_0xfd86('0xe'),_0x4d1781,_0x23d34f);_0x4e5d6d(_0x23d34f);});});} \ No newline at end of file +var _0xdc15=['../../mysqldb','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x43fb75,_0x2a793f){var _0x8bedca=function(_0x343217){while(--_0x343217){_0x43fb75['push'](_0x43fb75['shift']());}};_0x8bedca(++_0x2a793f);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0xdc15[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require(_0x5dc1('0x1'));var BPromise=require(_0x5dc1('0x2'));var rs=require(_0x5dc1('0x3'));var fs=require('fs');var Redis=require(_0x5dc1('0x4'));var db=require(_0x5dc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ec95f,_0x22d677,_0x12abf9){return new BPromise(function(_0x1c90f6,_0x3e96c1){return client[_0x5dc1('0x8')](_0x2ec95f,_0x12abf9)[_0x5dc1('0x9')](function(_0x1f1293){logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');logger['debug'](_0x5dc1('0xc'),_0x22d677,_0x5dc1('0xd'),JSON['stringify'](_0x1f1293));if(_0x1f1293[_0x5dc1('0xe')]){if(_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0xf')]===0x1f4){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x3e96c1(_0x1f1293['error'][_0x5dc1('0x10')]);}logger[_0x5dc1('0xe')]('VoiceContext,\x20%s,\x20%s',_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x1c90f6(_0x1f1293['error'][_0x5dc1('0x10')]);}else{logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');_0x1c90f6(_0x1f1293[_0x5dc1('0x11')]['message']);}})['catch'](function(_0x17506b){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x17506b);_0x3e96c1(_0x17506b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4e7fcdb..aa11357 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 _0x8d7e=['Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','update','delete','exports','multer','path','express'];(function(_0x5a8bbc,_0x4ced07){var _0x5bc98c=function(_0x3b9a4f){while(--_0x3b9a4f){_0x5a8bbc['push'](_0x5a8bbc['shift']());}};_0x5bc98c(++_0x4ced07);}(_0x8d7e,0x7d));var _0xe8d7=function(_0x260cfc,_0x323f78){_0x260cfc=_0x260cfc-0x0;var _0xed1077=_0x8d7e[_0x260cfc];return _0xed1077;};'use strict';var multer=require(_0xe8d7('0x0'));var util=require('util');var path=require(_0xe8d7('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8d7('0x2'));var router=express[_0xe8d7('0x3')]();var fs_extra=require(_0xe8d7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8d7('0x5'));var controller=require(_0xe8d7('0x6'));router[_0xe8d7('0x7')]('/',auth['isAuthenticated'](),controller[_0xe8d7('0x8')]);router[_0xe8d7('0x7')](_0xe8d7('0x9'),auth[_0xe8d7('0xa')](),controller[_0xe8d7('0xb')]);router[_0xe8d7('0x7')](_0xe8d7('0xc'),auth[_0xe8d7('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe8d7('0xc'),auth[_0xe8d7('0xa')](),controller[_0xe8d7('0xd')]);router[_0xe8d7('0xe')](_0xe8d7('0xc'),auth[_0xe8d7('0xa')](),controller['destroy']);module[_0xe8d7('0xf')]=router; \ No newline at end of file +var _0xe0c0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x1c1af4,_0xe34176){var _0x58102b=function(_0x22b0c1){while(--_0x22b0c1){_0x1c1af4['push'](_0x1c1af4['shift']());}};_0x58102b(++_0xe34176);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x268a27,_0x509bb2){_0x268a27=_0x268a27-0x0;var _0xc2e5c6=_0xe0c0[_0x268a27];return _0xc2e5c6;};'use strict';var multer=require(_0x0e0c('0x0'));var util=require('util');var path=require(_0x0e0c('0x1'));var timeout=require(_0x0e0c('0x2'));var express=require(_0x0e0c('0x3'));var router=express[_0x0e0c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e0c('0x5'));var interaction=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var controller=require('./voiceDialReport.controller');router[_0x0e0c('0x8')]('/',auth[_0x0e0c('0x9')](),controller['index']);router[_0x0e0c('0x8')](_0x0e0c('0xa'),auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xb')]);router[_0x0e0c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e0c('0xc')]('/',auth['isAuthenticated'](),controller[_0x0e0c('0xd')]);router[_0x0e0c('0xe')](_0x0e0c('0xf'),auth[_0x0e0c('0x9')](),controller[_0x0e0c('0x10')]);router[_0x0e0c('0x11')](_0x0e0c('0xf'),auth[_0x0e0c('0x9')](),controller['destroy']);module[_0x0e0c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3e2a6fc..05adb08 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 _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x5bfad2,_0x64dd5b){var _0x56441b=function(_0x5a1da9){while(--_0x5a1da9){_0x5bfad2['push'](_0x5bfad2['shift']());}};_0x56441b(++_0x64dd5b);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x24ca[_0x4c5c97];return _0xd5d2cb;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3f9b11,_0x1a2419){var _0x1f3dfc=function(_0x428bba){while(--_0x428bba){_0x3f9b11['push'](_0x3f9b11['shift']());}};_0x1f3dfc(++_0x1a2419);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x24ca[_0x1ebeea];return _0x576465;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c1a5bd5..a1825cc 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 _0x9bef=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x22ce9c,_0x4d9ce0){var _0x5ed38e=function(_0x5b0782){while(--_0x5b0782){_0x22ce9c['push'](_0x22ce9c['shift']());}};_0x5ed38e(++_0x4d9ce0);}(_0x9bef,0x186));var _0xf9be=function(_0xd5faf0,_0x3e95cd){_0xd5faf0=_0xd5faf0-0x0;var _0x14c14e=_0x9bef[_0xd5faf0];return _0x14c14e;};'use strict';var emlformat=require(_0xf9be('0x0'));var rimraf=require(_0xf9be('0x1'));var zipdir=require(_0xf9be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9be('0x3'));var moment=require(_0xf9be('0x4'));var BPromise=require(_0xf9be('0x5'));var Mustache=require(_0xf9be('0x6'));var util=require(_0xf9be('0x7'));var path=require(_0xf9be('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf9be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9be('0xa'));var squel=require(_0xf9be('0xb'));var crypto=require(_0xf9be('0xc'));var jsforce=require(_0xf9be('0xd'));var deskjs=require(_0xf9be('0xe'));var toCsv=require(_0xf9be('0xf'));var querystring=require(_0xf9be('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf9be('0x11'));var qs=require(_0xf9be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9be('0x13'));var logger=require(_0xf9be('0x14'))(_0xf9be('0x15'));var utils=require(_0xf9be('0x16'));var config=require(_0xf9be('0x17'));var licenseUtil=require(_0xf9be('0x18'));var db=require(_0xf9be('0x19'))['db'];function respondWithStatusCode(_0x430972,_0x41d7f4){_0x41d7f4=_0x41d7f4||0xcc;return function(_0x3510e0){if(_0x3510e0){return _0x430972[_0xf9be('0x1a')](_0x41d7f4);}return _0x430972['status'](_0x41d7f4)['end']();};}function respondWithResult(_0x2de050,_0x195f72){_0x195f72=_0x195f72||0xc8;return function(_0x2fe527){if(_0x2fe527){return _0x2de050[_0xf9be('0x1b')](_0x195f72)[_0xf9be('0x1c')](_0x2fe527);}};}function respondWithFilteredResult(_0x3441e9,_0x402def){return function(_0x4d23c6){if(_0x4d23c6){var _0x4d3760=typeof _0x402def['offset']==='undefined'&&typeof _0x402def[_0xf9be('0x1d')]===_0xf9be('0x1e');var _0x9d2709=_0x4d23c6[_0xf9be('0x1f')];var _0x19e48e=_0x4d3760?0x0:_0x402def[_0xf9be('0x20')];var _0x36443d=_0x4d3760?_0x4d23c6[_0xf9be('0x1f')]:_0x402def[_0xf9be('0x20')]+_0x402def[_0xf9be('0x1d')];var _0x80b079;if(_0x36443d>=_0x9d2709){_0x36443d=_0x9d2709;_0x80b079=0xc8;}else{_0x80b079=0xce;}_0x3441e9[_0xf9be('0x1b')](_0x80b079);return _0x3441e9[_0xf9be('0x21')]('Content-Range',_0x19e48e+'-'+_0x36443d+'/'+_0x9d2709)[_0xf9be('0x1c')](_0x4d23c6);}return null;};}function patchUpdates(_0x4d8824){return function(_0x5c98e7){try{jsonpatch[_0xf9be('0x22')](_0x5c98e7,_0x4d8824,!![]);}catch(_0x3d3b2d){return BPromise[_0xf9be('0x23')](_0x3d3b2d);}return _0x5c98e7[_0xf9be('0x24')]();};}function saveUpdates(_0x4b5982,_0x2b4f81){return function(_0x4bba50){if(_0x4bba50){return _0x4bba50[_0xf9be('0x25')](_0x4b5982)[_0xf9be('0x26')](function(_0x3efbc0){return _0x3efbc0;});}return null;};}function removeEntity(_0x2233ea,_0x5056fe){return function(_0x48e9c2){if(_0x48e9c2){return _0x48e9c2[_0xf9be('0x27')]()['then'](function(){_0x2233ea[_0xf9be('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb0fc,_0x2f5ebc){return function(_0x2a2017){if(!_0x2a2017){_0x1eb0fc[_0xf9be('0x1a')](0x194);}return _0x2a2017;};}function handleError(_0x3ef734,_0x49eae7){_0x49eae7=_0x49eae7||0x1f4;return function(_0x2e4d85){logger['error'](_0x2e4d85[_0xf9be('0x28')]);if(_0x2e4d85[_0xf9be('0x29')]){delete _0x2e4d85[_0xf9be('0x29')];}_0x3ef734[_0xf9be('0x1b')](_0x49eae7)['send'](_0x2e4d85);};}exports[_0xf9be('0x2a')]=function(_0x4659d4,_0x52daa5){var _0x4ed5f3={},_0xa57f66={},_0x483be1={'count':0x0,'rows':[]};var _0x361841=_[_0xf9be('0x2b')](db[_0xf9be('0x2c')][_0xf9be('0x2d')],function(_0x3e14b1){return{'name':_0x3e14b1[_0xf9be('0x2e')],'type':_0x3e14b1[_0xf9be('0x2f')]['key']};});_0xa57f66[_0xf9be('0x30')]=_[_0xf9be('0x2b')](_0x361841,_0xf9be('0x29'));_0xa57f66['query']=_[_0xf9be('0x31')](_0x4659d4[_0xf9be('0x32')]);_0xa57f66[_0xf9be('0x33')]=_[_0xf9be('0x34')](_0xa57f66['model'],_0xa57f66[_0xf9be('0x32')]);_0x4ed5f3[_0xf9be('0x35')]=_[_0xf9be('0x34')](_0xa57f66[_0xf9be('0x30')],qs[_0xf9be('0x36')](_0x4659d4[_0xf9be('0x32')][_0xf9be('0x36')]));_0x4ed5f3[_0xf9be('0x35')]=_0x4ed5f3['attributes'][_0xf9be('0x37')]?_0x4ed5f3[_0xf9be('0x35')]:_0xa57f66[_0xf9be('0x30')];if(!_0x4659d4[_0xf9be('0x32')]['hasOwnProperty']('nolimit')){_0x4ed5f3[_0xf9be('0x1d')]=qs[_0xf9be('0x1d')](_0x4659d4['query'][_0xf9be('0x1d')]);_0x4ed5f3[_0xf9be('0x20')]=qs[_0xf9be('0x20')](_0x4659d4[_0xf9be('0x32')][_0xf9be('0x20')]);}_0x4ed5f3[_0xf9be('0x38')]=qs[_0xf9be('0x39')](_0x4659d4[_0xf9be('0x32')][_0xf9be('0x39')]);_0x4ed5f3[_0xf9be('0x3a')]=qs[_0xf9be('0x33')](_[_0xf9be('0x3b')](_0x4659d4[_0xf9be('0x32')],_0xa57f66[_0xf9be('0x33')]),_0x361841);if(_0x4659d4[_0xf9be('0x32')][_0xf9be('0x3c')]){_0x4ed5f3[_0xf9be('0x3a')]=_['merge'](_0x4ed5f3[_0xf9be('0x3a')],{'$or':_[_0xf9be('0x2b')](_0x361841,function(_0x3e1796){if(_0x3e1796[_0xf9be('0x2f')]!==_0xf9be('0x3d')){var _0x16ffd8={};_0x16ffd8[_0x3e1796[_0xf9be('0x29')]]={'$like':'%'+_0x4659d4[_0xf9be('0x32')]['filter']+'%'};return _0x16ffd8;}})});}_0x4ed5f3=_[_0xf9be('0x3e')]({},_0x4ed5f3,_0x4659d4[_0xf9be('0x3f')]);var _0x3a8fa5={'where':_0x4ed5f3[_0xf9be('0x3a')]};return db['VoiceDialReport'][_0xf9be('0x1f')](_0x3a8fa5)[_0xf9be('0x26')](function(_0x5d7d68){_0x483be1[_0xf9be('0x1f')]=_0x5d7d68;if(_0x4659d4[_0xf9be('0x32')][_0xf9be('0x40')]){_0x4ed5f3['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xf9be('0x41')](_0x4ed5f3);})[_0xf9be('0x26')](function(_0x430333){_0x483be1[_0xf9be('0x42')]=_0x430333;return _0x483be1;})[_0xf9be('0x26')](respondWithFilteredResult(_0x52daa5,_0x4ed5f3))[_0xf9be('0x43')](handleError(_0x52daa5,null));};exports[_0xf9be('0x44')]=function(_0x47091b,_0x17c903){var _0x20874d={'raw':!![],'where':{'id':_0x47091b[_0xf9be('0x45')]['id']}},_0x1e528c={};_0x1e528c['model']=_[_0xf9be('0x31')](db[_0xf9be('0x2c')][_0xf9be('0x2d')]);_0x1e528c[_0xf9be('0x32')]=_[_0xf9be('0x31')](_0x47091b[_0xf9be('0x32')]);_0x1e528c['filters']=_[_0xf9be('0x34')](_0x1e528c[_0xf9be('0x30')],_0x1e528c[_0xf9be('0x32')]);_0x20874d[_0xf9be('0x35')]=_[_0xf9be('0x34')](_0x1e528c[_0xf9be('0x30')],qs[_0xf9be('0x36')](_0x47091b['query'][_0xf9be('0x36')]));_0x20874d['attributes']=_0x20874d['attributes']['length']?_0x20874d[_0xf9be('0x35')]:_0x1e528c[_0xf9be('0x30')];if(_0x47091b[_0xf9be('0x32')][_0xf9be('0x40')]){_0x20874d[_0xf9be('0x46')]=[{'all':!![]}];}_0x20874d=_[_0xf9be('0x3e')]({},_0x20874d,_0x47091b[_0xf9be('0x3f')]);return db[_0xf9be('0x2c')][_0xf9be('0x47')](_0x20874d)[_0xf9be('0x26')](handleEntityNotFound(_0x17c903,null))['then'](respondWithResult(_0x17c903,null))['catch'](handleError(_0x17c903,null));};exports['create']=function(_0x252cef,_0x433027){return db[_0xf9be('0x2c')][_0xf9be('0x48')](_0x252cef['body'],{})['then'](respondWithResult(_0x433027,0xc9))['catch'](handleError(_0x433027,null));};exports[_0xf9be('0x25')]=function(_0x4e991f,_0x34f490){if(_0x4e991f[_0xf9be('0x49')]['id']){delete _0x4e991f[_0xf9be('0x49')]['id'];}return db[_0xf9be('0x2c')][_0xf9be('0x47')]({'where':{'id':_0x4e991f[_0xf9be('0x45')]['id']}})[_0xf9be('0x26')](handleEntityNotFound(_0x34f490,null))[_0xf9be('0x26')](saveUpdates(_0x4e991f[_0xf9be('0x49')],null))[_0xf9be('0x26')](respondWithResult(_0x34f490,null))[_0xf9be('0x43')](handleError(_0x34f490,null));};exports[_0xf9be('0x27')]=function(_0x1b9614,_0x573371){return db[_0xf9be('0x2c')][_0xf9be('0x47')]({'where':{'id':_0x1b9614[_0xf9be('0x45')]['id']}})[_0xf9be('0x26')](handleEntityNotFound(_0x573371,null))['then'](removeEntity(_0x573371,null))[_0xf9be('0x43')](handleError(_0x573371,null));};exports[_0xf9be('0x4a')]=function(_0x4cc14d,_0x12cdbf){return db[_0xf9be('0x2c')][_0xf9be('0x4a')]()[_0xf9be('0x26')](respondWithResult(_0x12cdbf,null))[_0xf9be('0x43')](handleError(_0x12cdbf,null));}; \ No newline at end of file +var _0x2737=['intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x2737,0x65));var _0x7273=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2737[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7273('0x0'));var zipdir=require(_0x7273('0x1'));var jsonpatch=require(_0x7273('0x2'));var rp=require(_0x7273('0x3'));var moment=require(_0x7273('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7273('0x5'));var util=require(_0x7273('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7273('0x7'));var ejs=require(_0x7273('0x8'));var fs=require('fs');var fs_extra=require(_0x7273('0x9'));var _=require('lodash');var squel=require(_0x7273('0xa'));var crypto=require(_0x7273('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7273('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7273('0xd'));var Papa=require(_0x7273('0xe'));var Redis=require(_0x7273('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7273('0x10'));var as=require(_0x7273('0x11'));var hardwareService=require(_0x7273('0x12'));var logger=require(_0x7273('0x13'))(_0x7273('0x14'));var utils=require(_0x7273('0x15'));var config=require(_0x7273('0x16'));var licenseUtil=require(_0x7273('0x17'));var db=require(_0x7273('0x18'))['db'];function respondWithStatusCode(_0x95fc3a,_0x1a0724){_0x1a0724=_0x1a0724||0xcc;return function(_0x12ff0d){if(_0x12ff0d){return _0x95fc3a[_0x7273('0x19')](_0x1a0724);}return _0x95fc3a['status'](_0x1a0724)[_0x7273('0x1a')]();};}function respondWithResult(_0x37601a,_0x1be109){_0x1be109=_0x1be109||0xc8;return function(_0x595454){if(_0x595454){return _0x37601a[_0x7273('0x1b')](_0x1be109)[_0x7273('0x1c')](_0x595454);}};}function respondWithFilteredResult(_0x5f3525,_0x134d47){return function(_0x4c9aa3){if(_0x4c9aa3){var _0x503e28=typeof _0x134d47[_0x7273('0x1d')]===_0x7273('0x1e')&&typeof _0x134d47[_0x7273('0x1f')]===_0x7273('0x1e');var _0x34dd21=_0x4c9aa3[_0x7273('0x20')];var _0x181f39=_0x503e28?0x0:_0x134d47[_0x7273('0x1d')];var _0x25520b=_0x503e28?_0x4c9aa3['count']:_0x134d47['offset']+_0x134d47['limit'];var _0x53eb47;if(_0x25520b>=_0x34dd21){_0x25520b=_0x34dd21;_0x53eb47=0xc8;}else{_0x53eb47=0xce;}_0x5f3525['status'](_0x53eb47);return _0x5f3525['set'](_0x7273('0x21'),_0x181f39+'-'+_0x25520b+'/'+_0x34dd21)[_0x7273('0x1c')](_0x4c9aa3);}return null;};}function patchUpdates(_0x7bf919){return function(_0x1026a1){try{jsonpatch[_0x7273('0x22')](_0x1026a1,_0x7bf919,!![]);}catch(_0x382119){return BPromise[_0x7273('0x23')](_0x382119);}return _0x1026a1[_0x7273('0x24')]();};}function saveUpdates(_0x5adfaf,_0x563774){return function(_0x3e5cd0){if(_0x3e5cd0){return _0x3e5cd0[_0x7273('0x25')](_0x5adfaf)[_0x7273('0x26')](function(_0x1adb9a){return _0x1adb9a;});}return null;};}function removeEntity(_0x11e748,_0x11f7a9){return function(_0x30ada3){if(_0x30ada3){return _0x30ada3[_0x7273('0x27')]()[_0x7273('0x26')](function(){_0x11e748['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x528f7d,_0x539eef){return function(_0x5e3d6f){if(!_0x5e3d6f){_0x528f7d[_0x7273('0x19')](0x194);}return _0x5e3d6f;};}function handleError(_0x42fc99,_0x4087ea){_0x4087ea=_0x4087ea||0x1f4;return function(_0x2f7e34){logger[_0x7273('0x28')](_0x2f7e34['stack']);if(_0x2f7e34[_0x7273('0x29')]){delete _0x2f7e34[_0x7273('0x29')];}_0x42fc99[_0x7273('0x1b')](_0x4087ea)['send'](_0x2f7e34);};}exports[_0x7273('0x2a')]=function(_0x16d749,_0x382952){var _0x2f5af5={},_0x2c5a5f={},_0x40dd5a={'count':0x0,'rows':[]};var _0x21729b=_[_0x7273('0x2b')](db[_0x7273('0x2c')][_0x7273('0x2d')],function(_0x535f44){return{'name':_0x535f44[_0x7273('0x2e')],'type':_0x535f44['type'][_0x7273('0x2f')]};});_0x2c5a5f['model']=_[_0x7273('0x2b')](_0x21729b,_0x7273('0x29'));_0x2c5a5f[_0x7273('0x30')]=_[_0x7273('0x31')](_0x16d749[_0x7273('0x30')]);_0x2c5a5f[_0x7273('0x32')]=_[_0x7273('0x33')](_0x2c5a5f['model'],_0x2c5a5f[_0x7273('0x30')]);_0x2f5af5[_0x7273('0x34')]=_[_0x7273('0x33')](_0x2c5a5f[_0x7273('0x35')],qs[_0x7273('0x36')](_0x16d749[_0x7273('0x30')][_0x7273('0x36')]));_0x2f5af5[_0x7273('0x34')]=_0x2f5af5['attributes'][_0x7273('0x37')]?_0x2f5af5[_0x7273('0x34')]:_0x2c5a5f[_0x7273('0x35')];if(!_0x16d749[_0x7273('0x30')][_0x7273('0x38')]('nolimit')){_0x2f5af5[_0x7273('0x1f')]=qs[_0x7273('0x1f')](_0x16d749[_0x7273('0x30')][_0x7273('0x1f')]);_0x2f5af5[_0x7273('0x1d')]=qs[_0x7273('0x1d')](_0x16d749[_0x7273('0x30')][_0x7273('0x1d')]);}_0x2f5af5[_0x7273('0x39')]=qs[_0x7273('0x3a')](_0x16d749['query'][_0x7273('0x3a')]);_0x2f5af5[_0x7273('0x3b')]=qs[_0x7273('0x32')](_[_0x7273('0x3c')](_0x16d749[_0x7273('0x30')],_0x2c5a5f['filters']),_0x21729b);if(_0x16d749[_0x7273('0x30')][_0x7273('0x3d')]){_0x2f5af5[_0x7273('0x3b')]=_[_0x7273('0x3e')](_0x2f5af5[_0x7273('0x3b')],{'$or':_[_0x7273('0x2b')](_0x21729b,function(_0xe46af5){if(_0xe46af5[_0x7273('0x3f')]!==_0x7273('0x40')){var _0x454e29={};_0x454e29[_0xe46af5[_0x7273('0x29')]]={'$like':'%'+_0x16d749[_0x7273('0x30')][_0x7273('0x3d')]+'%'};return _0x454e29;}})});}_0x2f5af5=_['merge']({},_0x2f5af5,_0x16d749[_0x7273('0x41')]);var _0x14f2ad={'where':_0x2f5af5[_0x7273('0x3b')]};return db[_0x7273('0x2c')][_0x7273('0x20')](_0x14f2ad)[_0x7273('0x26')](function(_0x313617){_0x40dd5a[_0x7273('0x20')]=_0x313617;if(_0x16d749['query'][_0x7273('0x42')]){_0x2f5af5[_0x7273('0x43')]=[{'all':!![]}];}return db[_0x7273('0x2c')]['findAll'](_0x2f5af5);})[_0x7273('0x26')](function(_0x19074c){_0x40dd5a[_0x7273('0x44')]=_0x19074c;return _0x40dd5a;})['then'](respondWithFilteredResult(_0x382952,_0x2f5af5))['catch'](handleError(_0x382952,null));};exports[_0x7273('0x45')]=function(_0x36d2cf,_0x15e5ce){var _0x58b288={'raw':!![],'where':{'id':_0x36d2cf[_0x7273('0x46')]['id']}},_0x1f4b38={};_0x1f4b38['model']=_['keys'](db[_0x7273('0x2c')][_0x7273('0x2d')]);_0x1f4b38[_0x7273('0x30')]=_[_0x7273('0x31')](_0x36d2cf[_0x7273('0x30')]);_0x1f4b38[_0x7273('0x32')]=_[_0x7273('0x33')](_0x1f4b38[_0x7273('0x35')],_0x1f4b38[_0x7273('0x30')]);_0x58b288['attributes']=_['intersection'](_0x1f4b38[_0x7273('0x35')],qs[_0x7273('0x36')](_0x36d2cf['query'][_0x7273('0x36')]));_0x58b288[_0x7273('0x34')]=_0x58b288['attributes'][_0x7273('0x37')]?_0x58b288[_0x7273('0x34')]:_0x1f4b38[_0x7273('0x35')];if(_0x36d2cf['query'][_0x7273('0x42')]){_0x58b288['include']=[{'all':!![]}];}_0x58b288=_[_0x7273('0x3e')]({},_0x58b288,_0x36d2cf[_0x7273('0x41')]);return db[_0x7273('0x2c')][_0x7273('0x47')](_0x58b288)[_0x7273('0x26')](handleEntityNotFound(_0x15e5ce,null))[_0x7273('0x26')](respondWithResult(_0x15e5ce,null))[_0x7273('0x48')](handleError(_0x15e5ce,null));};exports[_0x7273('0x49')]=function(_0x8466ce,_0x314598){return db['VoiceDialReport']['create'](_0x8466ce[_0x7273('0x4a')],{})[_0x7273('0x26')](respondWithResult(_0x314598,0xc9))['catch'](handleError(_0x314598,null));};exports['update']=function(_0xb6e75d,_0x3c8556){if(_0xb6e75d[_0x7273('0x4a')]['id']){delete _0xb6e75d[_0x7273('0x4a')]['id'];}return db[_0x7273('0x2c')][_0x7273('0x47')]({'where':{'id':_0xb6e75d[_0x7273('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c8556,null))[_0x7273('0x26')](saveUpdates(_0xb6e75d[_0x7273('0x4a')],null))[_0x7273('0x26')](respondWithResult(_0x3c8556,null))[_0x7273('0x48')](handleError(_0x3c8556,null));};exports[_0x7273('0x27')]=function(_0x369ef2,_0x1460ed){return db[_0x7273('0x2c')][_0x7273('0x47')]({'where':{'id':_0x369ef2[_0x7273('0x46')]['id']}})['then'](handleEntityNotFound(_0x1460ed,null))['then'](removeEntity(_0x1460ed,null))[_0x7273('0x48')](handleError(_0x1460ed,null));};exports[_0x7273('0x4b')]=function(_0x2b4030,_0x598c51){return db[_0x7273('0x2c')][_0x7273('0x4b')]()[_0x7273('0x26')](respondWithResult(_0x598c51,null))[_0x7273('0x48')](handleError(_0x598c51,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index dfe6d17..d213d13 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 _0xb761=['bluebird','request-promise','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb761,0x113));var _0x1b76=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xb761[_0x274638];return _0x5755df;};'use strict';var _=require(_0x1b76('0x0'));var util=require(_0x1b76('0x1'));var logger=require(_0x1b76('0x2'))(_0x1b76('0x3'));var moment=require(_0x1b76('0x4'));var BPromise=require(_0x1b76('0x5'));var rp=require(_0x1b76('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x284ec8,_0x1acca9){return _0x284ec8[_0x1b76('0x7')](_0x1b76('0x8'),attributes,{'tableName':_0x1b76('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2fa=['path','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x40d673,_0x366a81){var _0x17cc59=function(_0x1c1d3c){while(--_0x1c1d3c){_0x40d673['push'](_0x40d673['shift']());}};_0x17cc59(++_0x366a81);}(_0xf2fa,0x12f));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaf2f('0x0'));var util=require(_0xaf2f('0x1'));var logger=require(_0xaf2f('0x2'))(_0xaf2f('0x3'));var moment=require('moment');var BPromise=require(_0xaf2f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaf2f('0x6'));module[_0xaf2f('0x7')]=function(_0x8e01f6,_0x3119ff){return _0x8e01f6[_0xaf2f('0x8')]('VoiceDialReport',attributes,{'tableName':_0xaf2f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xaf2f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0e0d18a..eb8dfa6 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 _0xb179=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','create','options','raw','then','debug','UpdateVoiceDialReport','body','where','attributes','bluebird'];(function(_0x3f0d0d,_0x56df06){var _0x4f7095=function(_0xe0ee77){while(--_0xe0ee77){_0x3f0d0d['push'](_0x3f0d0d['shift']());}};_0x4f7095(++_0x56df06);}(_0xb179,0x1ef));var _0x9b17=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb179[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9b17('0x0'));var rs=require(_0x9b17('0x1'));var fs=require('fs');var Redis=require(_0x9b17('0x2'));var db=require(_0x9b17('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b17('0x4'))(_0x9b17('0x5'));var config=require(_0x9b17('0x6'));var jayson=require(_0x9b17('0x7'));var client=jayson[_0x9b17('0x8')][_0x9b17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1de0fd,_0x208bd4,_0x50cedd){return new BPromise(function(_0x1599b7,_0x3d3726){return client[_0x9b17('0xa')](_0x1de0fd,_0x50cedd)['then'](function(_0x20c5bf){logger['info'](_0x9b17('0xb'),_0x208bd4,'request\x20sent');logger['debug'](_0x9b17('0xc'),_0x208bd4,_0x9b17('0xd'),JSON[_0x9b17('0xe')](_0x20c5bf));if(_0x20c5bf['error']){if(_0x20c5bf[_0x9b17('0xf')][_0x9b17('0x10')]===0x1f4){logger[_0x9b17('0xf')](_0x9b17('0xb'),_0x208bd4,_0x20c5bf[_0x9b17('0xf')]['message']);return _0x3d3726(_0x20c5bf['error'][_0x9b17('0x11')]);}logger['error'](_0x9b17('0xb'),_0x208bd4,_0x20c5bf[_0x9b17('0xf')][_0x9b17('0x11')]);return _0x1599b7(_0x20c5bf[_0x9b17('0xf')][_0x9b17('0x11')]);}else{logger[_0x9b17('0x12')](_0x9b17('0xb'),_0x208bd4,'request\x20sent');_0x1599b7(_0x20c5bf[_0x9b17('0x13')][_0x9b17('0x11')]);}})[_0x9b17('0x14')](function(_0x1f5634){logger[_0x9b17('0xf')](_0x9b17('0xb'),_0x208bd4,_0x1f5634);_0x3d3726(_0x1f5634);});});}exports[_0x9b17('0x15')]=function(_0x5c6157){var _0x230b5e=this;return new Promise(function(_0x2cb50f,_0x520a4d){return db['VoiceDialReport'][_0x9b17('0x16')](_0x5c6157['body'],{'raw':_0x5c6157[_0x9b17('0x17')]?_0x5c6157[_0x9b17('0x17')][_0x9b17('0x18')]===undefined?!![]:![]:!![]})[_0x9b17('0x19')](function(_0xf9625d){logger['info'](_0x9b17('0x15'),_0x5c6157);logger[_0x9b17('0x1a')](_0x9b17('0x15'),_0x5c6157,JSON['stringify'](_0xf9625d));_0x2cb50f(_0xf9625d);})[_0x9b17('0x14')](function(_0x112c90){logger[_0x9b17('0xf')]('CreateVoiceDialReport',_0x112c90[_0x9b17('0x11')],_0x5c6157);_0x520a4d(_0x230b5e[_0x9b17('0xf')](0x1f4,_0x112c90[_0x9b17('0x11')]));});});};exports[_0x9b17('0x1b')]=function(_0x58e4d2){var _0x58def8=this;return new Promise(function(_0x184e8c,_0x26e775){return db['VoiceDialReport']['update'](_0x58e4d2[_0x9b17('0x1c')],{'raw':_0x58e4d2[_0x9b17('0x17')]?_0x58e4d2[_0x9b17('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e4d2[_0x9b17('0x17')]?_0x58e4d2['options'][_0x9b17('0x1d')]||null:null,'attributes':_0x58e4d2[_0x9b17('0x17')]?_0x58e4d2[_0x9b17('0x17')][_0x9b17('0x1e')]||null:null,'limit':_0x58e4d2[_0x9b17('0x17')]?_0x58e4d2[_0x9b17('0x17')]['limit']||null:null})[_0x9b17('0x19')](function(_0x34a572){logger[_0x9b17('0x12')]('UpdateVoiceDialReport',_0x58e4d2);logger['debug'](_0x9b17('0x1b'),_0x58e4d2,JSON[_0x9b17('0xe')](_0x34a572));_0x184e8c(_0x34a572);})['catch'](function(_0xc8515){logger[_0x9b17('0xf')]('UpdateVoiceDialReport',_0xc8515[_0x9b17('0x11')],_0x58e4d2);_0x26e775(_0x58def8[_0x9b17('0xf')](0x1f4,_0xc8515[_0x9b17('0x11')]));});});}; \ No newline at end of file +var _0x1d90=['then','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','info','result','catch','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x53d520,_0x35c166){var _0x488a7e=function(_0xa900a9){while(--_0xa900a9){_0x53d520['push'](_0x53d520['shift']());}};_0x488a7e(++_0x35c166);}(_0x1d90,0xa7));var _0x01d9=function(_0x2cd17f,_0x3e9c94){_0x2cd17f=_0x2cd17f-0x0;var _0x5bab50=_0x1d90[_0x2cd17f];return _0x5bab50;};'use strict';var _=require(_0x01d9('0x0'));var util=require('util');var moment=require(_0x01d9('0x1'));var BPromise=require(_0x01d9('0x2'));var rs=require(_0x01d9('0x3'));var fs=require('fs');var Redis=require(_0x01d9('0x4'));var db=require(_0x01d9('0x5'))['db'];var utils=require(_0x01d9('0x6'));var logger=require(_0x01d9('0x7'))(_0x01d9('0x8'));var config=require('../../config/environment');var jayson=require(_0x01d9('0x9'));var client=jayson[_0x01d9('0xa')][_0x01d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39d828,_0x31df4c,_0x2272ed){return new BPromise(function(_0x1244ff,_0x9ae3d){return client[_0x01d9('0xc')](_0x39d828,_0x2272ed)[_0x01d9('0xd')](function(_0x424cb2){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x31df4c,'request\x20sent');logger[_0x01d9('0xe')](_0x01d9('0xf'),_0x31df4c,_0x01d9('0x10'),JSON[_0x01d9('0x11')](_0x424cb2));if(_0x424cb2[_0x01d9('0x12')]){if(_0x424cb2[_0x01d9('0x12')][_0x01d9('0x13')]===0x1f4){logger[_0x01d9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x31df4c,_0x424cb2[_0x01d9('0x12')]['message']);return _0x9ae3d(_0x424cb2['error'][_0x01d9('0x14')]);}logger[_0x01d9('0x12')](_0x01d9('0x15'),_0x31df4c,_0x424cb2[_0x01d9('0x12')][_0x01d9('0x14')]);return _0x1244ff(_0x424cb2['error']['message']);}else{logger[_0x01d9('0x16')](_0x01d9('0x15'),_0x31df4c,_0x01d9('0x10'));_0x1244ff(_0x424cb2[_0x01d9('0x17')][_0x01d9('0x14')]);}})[_0x01d9('0x18')](function(_0x4c8397){logger['error'](_0x01d9('0x15'),_0x31df4c,_0x4c8397);_0x9ae3d(_0x4c8397);});});}exports['CreateVoiceDialReport']=function(_0x554f99){var _0xa2706e=this;return new Promise(function(_0x162934,_0x310607){return db['VoiceDialReport'][_0x01d9('0x19')](_0x554f99[_0x01d9('0x1a')],{'raw':_0x554f99['options']?_0x554f99[_0x01d9('0x1b')][_0x01d9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4cb3df){logger[_0x01d9('0x16')](_0x01d9('0x1d'),_0x554f99);logger[_0x01d9('0xe')]('CreateVoiceDialReport',_0x554f99,JSON[_0x01d9('0x11')](_0x4cb3df));_0x162934(_0x4cb3df);})[_0x01d9('0x18')](function(_0x4f2df3){logger['error']('CreateVoiceDialReport',_0x4f2df3[_0x01d9('0x14')],_0x554f99);_0x310607(_0xa2706e[_0x01d9('0x12')](0x1f4,_0x4f2df3[_0x01d9('0x14')]));});});};exports[_0x01d9('0x1e')]=function(_0x4567bd){var _0x5c668c=this;return new Promise(function(_0x4d1eb8,_0x502e06){return db[_0x01d9('0x1f')][_0x01d9('0x20')](_0x4567bd[_0x01d9('0x1a')],{'raw':_0x4567bd['options']?_0x4567bd[_0x01d9('0x1b')][_0x01d9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4567bd['options']?_0x4567bd['options'][_0x01d9('0x21')]||null:null,'attributes':_0x4567bd[_0x01d9('0x1b')]?_0x4567bd[_0x01d9('0x1b')][_0x01d9('0x22')]||null:null,'limit':_0x4567bd[_0x01d9('0x1b')]?_0x4567bd[_0x01d9('0x1b')][_0x01d9('0x23')]||null:null})[_0x01d9('0xd')](function(_0x849de5){logger[_0x01d9('0x16')](_0x01d9('0x1e'),_0x4567bd);logger[_0x01d9('0xe')](_0x01d9('0x1e'),_0x4567bd,JSON[_0x01d9('0x11')](_0x849de5));_0x4d1eb8(_0x849de5);})[_0x01d9('0x18')](function(_0x5050cd){logger[_0x01d9('0x12')](_0x01d9('0x1e'),_0x5050cd[_0x01d9('0x14')],_0x4567bd);_0x502e06(_0x5c668c[_0x01d9('0x12')](0x1f4,_0x5050cd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 4911e94..1f19246 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 _0x49fd=['express','Router','fs-extra','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','delete','exports','multer','path'];(function(_0x45e7c9,_0x241220){var _0x8f3a53=function(_0x2eace3){while(--_0x2eace3){_0x45e7c9['push'](_0x45e7c9['shift']());}};_0x8f3a53(++_0x241220);}(_0x49fd,0xbc));var _0xd49f=function(_0x1c644b,_0x174dcb){_0x1c644b=_0x1c644b-0x0;var _0x5b025a=_0x49fd[_0x1c644b];return _0x5b025a;};'use strict';var multer=require(_0xd49f('0x0'));var util=require('util');var path=require(_0xd49f('0x1'));var timeout=require('connect-timeout');var express=require(_0xd49f('0x2'));var router=express[_0xd49f('0x3')]();var fs_extra=require(_0xd49f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd49f('0x5'));var controller=require(_0xd49f('0x6'));router[_0xd49f('0x7')]('/',auth[_0xd49f('0x8')](),controller[_0xd49f('0x9')]);router['get']('/:id',auth[_0xd49f('0x8')](),controller[_0xd49f('0xa')]);router[_0xd49f('0xb')]('/',auth[_0xd49f('0x8')](),controller[_0xd49f('0xc')]);router['post'](_0xd49f('0xd'),auth['isAuthenticated'](),controller[_0xd49f('0xe')]);router[_0xd49f('0xf')](_0xd49f('0x10'),auth[_0xd49f('0x8')](),controller['update']);router[_0xd49f('0x11')](_0xd49f('0x10'),auth[_0xd49f('0x8')](),controller['destroy']);module[_0xd49f('0x12')]=router; \ No newline at end of file +var _0x96b5=['../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96b5,0xa1));var _0x596b=function(_0x4d50bc,_0x4b30b6){_0x4d50bc=_0x4d50bc-0x0;var _0x1339bc=_0x96b5[_0x4d50bc];return _0x1339bc;};'use strict';var multer=require(_0x596b('0x0'));var util=require(_0x596b('0x1'));var path=require('path');var timeout=require(_0x596b('0x2'));var express=require(_0x596b('0x3'));var router=express[_0x596b('0x4')]();var fs_extra=require(_0x596b('0x5'));var auth=require(_0x596b('0x6'));var interaction=require(_0x596b('0x7'));var config=require('../../config/environment');var controller=require(_0x596b('0x8'));router[_0x596b('0x9')]('/',auth[_0x596b('0xa')](),controller[_0x596b('0xb')]);router[_0x596b('0x9')](_0x596b('0xc'),auth[_0x596b('0xa')](),controller[_0x596b('0xd')]);router[_0x596b('0xe')]('/',auth[_0x596b('0xa')](),controller[_0x596b('0xf')]);router[_0x596b('0xe')](_0x596b('0x10'),auth[_0x596b('0xa')](),controller['addApplications']);router[_0x596b('0x11')](_0x596b('0xc'),auth[_0x596b('0xa')](),controller[_0x596b('0x12')]);router[_0x596b('0x13')]('/:id',auth[_0x596b('0xa')](),controller[_0x596b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b6b03a0..fd65daf 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 _0x869e=['INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0xf81435,_0x1a1f00){var _0x2c1b13=function(_0x10d178){while(--_0x10d178){_0xf81435['push'](_0xf81435['shift']());}};_0x2c1b13(++_0x1a1f00);}(_0x869e,0x104));var _0xe869=function(_0x165fd3,_0x3b6685){_0x165fd3=_0x165fd3-0x0;var _0x55688e=_0x869e[_0x165fd3];return _0x55688e;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'context':{'type':Sequelize[_0xe869('0x2')],'allowNull':![],'unique':_0xe869('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe869('0x2')],'allowNull':![],'unique':_0xe869('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xe869('0x3')},'tag':{'type':Sequelize[_0xe869('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xe869('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe869('0x4')](_0xe869('0x5'),_0xe869('0x6'),_0xe869('0x7'),_0xe869('0x8'),_0xe869('0x9'),_0xe869('0xa'),_0xe869('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xe869('0x2')]},'interval':{'type':Sequelize[_0xe869('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xe869('0xc')]},'isApp':{'type':Sequelize[_0xe869('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xe869('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xe869('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe869('0xc')]},'recordingFormat':{'type':Sequelize[_0xe869('0x2')],'defaultValue':_0xe869('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x162b02){return this[_0xe869('0xf')](_0xe869('0x10'));}},'alias':{'type':Sequelize[_0xe869('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3fdf=['BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','system','any','INTEGER'];(function(_0x2b91b1,_0x20fb9b){var _0x532110=function(_0x2c4b09){while(--_0x2c4b09){_0x2b91b1['push'](_0x2b91b1['shift']());}};_0x532110(++_0x20fb9b);}(_0x3fdf,0x1a4));var _0xf3fd=function(_0x1b6bf1,_0x521464){_0x1b6bf1=_0x1b6bf1-0x0;var _0x5e12f3=_0x3fdf[_0x1b6bf1];return _0x5e12f3;};'use strict';var Sequelize=require(_0xf3fd('0x0'));module[_0xf3fd('0x1')]={'context':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':![],'unique':_0xf3fd('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xf3fd('0x3')},'tag':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':![],'defaultValue':_0xf3fd('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf3fd('0x5')](_0xf3fd('0x6'),_0xf3fd('0x7'),'internal',_0xf3fd('0x8'),'outbound-fax',_0xf3fd('0x9'),_0xf3fd('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xf3fd('0x2')]},'interval':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xf3fd('0xb')]},'isApp':{'type':Sequelize[_0xf3fd('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xf3fd('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf3fd('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xf3fd('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x166baf){return this[_0xf3fd('0xe')](_0xf3fd('0xf'));}},'alias':{'type':Sequelize[_0xf3fd('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 6137868..e2b9463 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 _0xa5bb=['ioredis','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','outbound','InternalRoutes','ignore','map','value','includes','find','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','rows','catch','show','params','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','internal','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash'];(function(_0x23cb72,_0x458456){var _0x2a82bb=function(_0x548c7f){while(--_0x548c7f){_0x23cb72['push'](_0x23cb72['shift']());}};_0x2a82bb(++_0x458456);}(_0xa5bb,0x1cb));var _0xba5b=function(_0xa3ca1e,_0x14f547){_0xa3ca1e=_0xa3ca1e-0x0;var _0x224bac=_0xa5bb[_0xa3ca1e];return _0x224bac;};'use strict';var _=require(_0xba5b('0x0'));var Redis=require(_0xba5b('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xba5b('0x2'));var config=require(_0xba5b('0x3'));var db=require(_0xba5b('0x4'))['db'];config[_0xba5b('0x5')]=_[_0xba5b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba5b('0x7'))(new Redis(config[_0xba5b('0x5')]));require(_0xba5b('0x8'))['register'](socket);function respondWithStatusCode(_0x572ce2,_0x5b76c6){_0x5b76c6=_0x5b76c6||0xcc;return function(_0x394008){if(_0x394008){return _0x572ce2[_0xba5b('0x9')](_0x5b76c6);}return _0x572ce2[_0xba5b('0xa')](_0x5b76c6)[_0xba5b('0xb')]();};}function respondWithResult(_0xa32a61,_0x4f24ab){_0x4f24ab=_0x4f24ab||0xc8;return function(_0xe7aa94){if(_0xe7aa94){return _0xa32a61[_0xba5b('0xa')](_0x4f24ab)[_0xba5b('0xc')](_0xe7aa94);}};}function respondWithFilteredResult(_0x1c2d01,_0x130e18){return function(_0x5e3a70){if(_0x5e3a70){var _0x436021=typeof _0x130e18[_0xba5b('0xd')]===_0xba5b('0xe')&&typeof _0x130e18[_0xba5b('0xf')]===_0xba5b('0xe');var _0x4aa0ee=_0x5e3a70[_0xba5b('0x10')];var _0x11aa31=_0x436021?0x0:_0x130e18[_0xba5b('0xd')];var _0x5e8ca3=_0x436021?_0x5e3a70['count']:_0x130e18[_0xba5b('0xd')]+_0x130e18['limit'];var _0x357436;if(_0x5e8ca3>=_0x4aa0ee){_0x5e8ca3=_0x4aa0ee;_0x357436=0xc8;}else{_0x357436=0xce;}_0x1c2d01[_0xba5b('0xa')](_0x357436);return _0x1c2d01[_0xba5b('0x11')](_0xba5b('0x12'),_0x11aa31+'-'+_0x5e8ca3+'/'+_0x4aa0ee)[_0xba5b('0xc')](_0x5e3a70);}return null;};}function removeEntity(_0x1603e7){return function(_0x245acb){if(_0x245acb){return _0x245acb[_0xba5b('0x13')]()[_0xba5b('0x14')](function(){var _0x39988f=_0x245acb[_0xba5b('0x15')]({'plain':!![]});var _0x26d763=[{'name':_0xba5b('0x16'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xba5b('0x17'),'ignore':![]},{'name':_0xba5b('0x18'),'value':'internal','ignore':![]}];var _0x1d9f18=_(_0x26d763)['filter'](_0xba5b('0x19'))[_0xba5b('0x1a')]('value')[_0xba5b('0x1b')]();if(_[_0xba5b('0x1c')](_0x1d9f18,_0x39988f['type'])){return;}var _0x3c7ae1=_[_0xba5b('0x1d')](_0x26d763,[_0xba5b('0x1b'),_0x39988f[_0xba5b('0x1e')]])[_0xba5b('0x1f')];return db[_0xba5b('0x20')][_0xba5b('0x13')]({'where':{'type':_0x3c7ae1,'resourceId':_0x39988f['id']}})[_0xba5b('0x14')](function(){return _0x245acb;});})['then'](function(){_0x1603e7[_0xba5b('0xa')](0xcc)[_0xba5b('0xb')]();});}};}function handleEntityNotFound(_0x3b22ad){return function(_0x3f0c5b){if(!_0x3f0c5b){_0x3b22ad['sendStatus'](0x194);}return _0x3f0c5b;};}function handleError(_0x28021f,_0x51cfe1){_0x51cfe1=_0x51cfe1||0x1f4;return function(_0x55fc7d){logger['error'](_0x55fc7d[_0xba5b('0x21')]);if(_0x55fc7d[_0xba5b('0x1f')]){delete _0x55fc7d['name'];}_0x28021f[_0xba5b('0xa')](_0x51cfe1)[_0xba5b('0x22')](_0x55fc7d);};}exports[_0xba5b('0x23')]=function(_0x1038b0,_0x1ff8f6){var _0x1d6ebb={},_0x3e1142={},_0x2deec5={'count':0x0,'rows':[]};var _0x10a8eb=_[_0xba5b('0x1a')](db[_0xba5b('0x24')][_0xba5b('0x25')],function(_0x4b6e25){return{'name':_0x4b6e25[_0xba5b('0x26')],'type':_0x4b6e25[_0xba5b('0x1e')][_0xba5b('0x27')]};});_0x3e1142[_0xba5b('0x28')]=_[_0xba5b('0x1a')](_0x10a8eb,_0xba5b('0x1f'));_0x3e1142[_0xba5b('0x29')]=_[_0xba5b('0x2a')](_0x1038b0[_0xba5b('0x29')]);_0x3e1142[_0xba5b('0x2b')]=_['intersection'](_0x3e1142[_0xba5b('0x28')],_0x3e1142[_0xba5b('0x29')]);_0x1d6ebb[_0xba5b('0x2c')]=_[_0xba5b('0x2d')](_0x3e1142[_0xba5b('0x28')],qs[_0xba5b('0x2e')](_0x1038b0['query'][_0xba5b('0x2e')]));_0x1d6ebb['attributes']=_0x1d6ebb[_0xba5b('0x2c')][_0xba5b('0x2f')]?_0x1d6ebb[_0xba5b('0x2c')]:_0x3e1142[_0xba5b('0x28')];if(!_0x1038b0[_0xba5b('0x29')][_0xba5b('0x30')]('nolimit')){_0x1d6ebb['limit']=qs[_0xba5b('0xf')](_0x1038b0[_0xba5b('0x29')][_0xba5b('0xf')]);_0x1d6ebb[_0xba5b('0xd')]=qs[_0xba5b('0xd')](_0x1038b0[_0xba5b('0x29')][_0xba5b('0xd')]);}_0x1d6ebb['order']=qs[_0xba5b('0x31')](_0x1038b0[_0xba5b('0x29')][_0xba5b('0x31')]);_0x1d6ebb[_0xba5b('0x32')]=qs['filters'](_[_0xba5b('0x33')](_0x1038b0[_0xba5b('0x29')],_0x3e1142[_0xba5b('0x2b')]),_0x10a8eb);if(_0x1038b0[_0xba5b('0x29')]['filter']){_0x1d6ebb[_0xba5b('0x32')]=_[_0xba5b('0x34')](_0x1d6ebb[_0xba5b('0x32')],{'$or':_[_0xba5b('0x1a')](_0x10a8eb,function(_0x2158e8){if(_0x2158e8[_0xba5b('0x1e')]!=='VIRTUAL'){var _0x2671cc={};_0x2671cc[_0x2158e8['name']]={'$like':'%'+_0x1038b0[_0xba5b('0x29')][_0xba5b('0x35')]+'%'};return _0x2671cc;}})});}_0x1d6ebb=_['merge']({},_0x1d6ebb,_0x1038b0[_0xba5b('0x36')]);var _0x5a152a={'where':_0x1d6ebb['where']};return db[_0xba5b('0x24')][_0xba5b('0x10')](_0x5a152a)[_0xba5b('0x14')](function(_0x564c17){_0x2deec5[_0xba5b('0x10')]=_0x564c17;if(_0x1038b0[_0xba5b('0x29')][_0xba5b('0x37')]){_0x1d6ebb['include']=[{'all':!![]}];}return db[_0xba5b('0x24')]['findAll'](_0x1d6ebb);})['then'](function(_0x50f1c0){_0x2deec5[_0xba5b('0x38')]=_0x50f1c0;return _0x2deec5;})['then'](respondWithFilteredResult(_0x1ff8f6,_0x1d6ebb))[_0xba5b('0x39')](handleError(_0x1ff8f6,null));};exports[_0xba5b('0x3a')]=function(_0x930637,_0x3b0b24){var _0x3b1485={'raw':![],'where':{'id':_0x930637[_0xba5b('0x3b')]['id']}},_0x202c49={};_0x202c49[_0xba5b('0x28')]=_['keys'](db[_0xba5b('0x24')][_0xba5b('0x25')]);_0x202c49[_0xba5b('0x29')]=_[_0xba5b('0x2a')](_0x930637[_0xba5b('0x29')]);_0x202c49[_0xba5b('0x2b')]=_[_0xba5b('0x2d')](_0x202c49[_0xba5b('0x28')],_0x202c49['query']);_0x3b1485[_0xba5b('0x2c')]=_[_0xba5b('0x2d')](_0x202c49[_0xba5b('0x28')],qs['fields'](_0x930637['query']['fields']));_0x3b1485[_0xba5b('0x2c')]=_0x3b1485[_0xba5b('0x2c')][_0xba5b('0x2f')]?_0x3b1485[_0xba5b('0x2c')]:_0x202c49[_0xba5b('0x28')];if(_0x930637[_0xba5b('0x29')][_0xba5b('0x37')]){_0x3b1485[_0xba5b('0x3c')]=[{'all':!![]}];}_0x3b1485=_[_0xba5b('0x34')]({},_0x3b1485,_0x930637['options']);return db[_0xba5b('0x24')][_0xba5b('0x1d')](_0x3b1485)[_0xba5b('0x14')](handleEntityNotFound(_0x3b0b24,null))[_0xba5b('0x14')](respondWithResult(_0x3b0b24,null))['catch'](handleError(_0x3b0b24,null));};exports[_0xba5b('0x13')]=function(_0x554395,_0xc0f40c){return db['VoiceExtension'][_0xba5b('0x1d')]({'where':{'id':_0x554395[_0xba5b('0x3b')]['id']}})[_0xba5b('0x14')](handleEntityNotFound(_0xc0f40c,null))[_0xba5b('0x14')](removeEntity(_0xc0f40c,null))['catch'](handleError(_0xc0f40c,null));};exports[_0xba5b('0x3d')]=function(_0x3b2e50,_0x44a88a){if(_0x3b2e50[_0xba5b('0x3e')]['type']===_0xba5b('0x17')&&!_[_0xba5b('0x3f')](_0x3b2e50[_0xba5b('0x3e')]['exten'],'_')){_0x3b2e50[_0xba5b('0x3e')][_0xba5b('0x40')]='_'[_0xba5b('0x41')](_0x3b2e50['body'][_0xba5b('0x40')]);}return db[_0xba5b('0x24')][_0xba5b('0x3d')](_0x3b2e50[_0xba5b('0x3e')],{'raw':![]})[_0xba5b('0x14')](function(_0x220a2e){var _0x210372=_0x3b2e50[_0xba5b('0x42')][_0xba5b('0x15')]({'plain':!![]});if(!_0x210372)throw new Error(_0xba5b('0x43'));if(_0x210372['role']===_0xba5b('0x42')){var _0x56a12d=_0x220a2e[_0xba5b('0x15')]({'plain':!![]});var _0x447e95=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xba5b('0x44'),'value':_0xba5b('0x17')},{'name':_0xba5b('0x18'),'value':_0xba5b('0x45')}];var _0x5a88de=_[_0xba5b('0x1d')](_0x447e95,[_0xba5b('0x1b'),_0x56a12d[_0xba5b('0x1e')]])[_0xba5b('0x1f')];return db[_0xba5b('0x46')][_0xba5b('0x1d')]({'where':{'name':_0x5a88de,'userProfileId':_0x210372['userProfileId']},'raw':!![]})[_0xba5b('0x14')](function(_0x1b1a0d){if(_0x1b1a0d&&_0x1b1a0d[_0xba5b('0x47')]===0x0){return db[_0xba5b('0x20')][_0xba5b('0x3d')]({'name':_0x56a12d['name'],'resourceId':_0x56a12d['id'],'type':_0x1b1a0d[_0xba5b('0x1f')],'sectionId':_0x1b1a0d['id']},{})[_0xba5b('0x14')](function(){return _0x220a2e;});}else{return _0x220a2e;}})[_0xba5b('0x39')](function(_0x26d8a0){logger[_0xba5b('0x48')](_0xba5b('0x49'),_0x26d8a0);throw _0x26d8a0;});}return _0x220a2e;})[_0xba5b('0x14')](respondWithResult(_0x44a88a,0xc9))['catch'](handleError(_0x44a88a,null));};exports[_0xba5b('0x4a')]=function(_0x4bc765,_0x2d029b){if(_0x4bc765[_0xba5b('0x3e')]['id']){delete _0x4bc765[_0xba5b('0x3e')]['id'];}return db[_0xba5b('0x24')]['find']({'where':{'id':_0x4bc765[_0xba5b('0x3b')]['id']}})[_0xba5b('0x14')](handleEntityNotFound(_0x2d029b,null))[_0xba5b('0x14')](function(_0x12784d){if(_0x12784d){return db[_0xba5b('0x24')]['update'](_[_0xba5b('0x33')](_0x4bc765[_0xba5b('0x3e')],[_0xba5b('0x40'),_0xba5b('0x4b'),_0xba5b('0x4c'),_0xba5b('0x4d'),_0xba5b('0x4e'),'mandatoryDisposition',_0xba5b('0x4f')]),{'where':{'context':_0x12784d[_0xba5b('0x4b')],'exten':_0x12784d[_0xba5b('0x40')]},'individualHooks':!![]})[_0xba5b('0x14')](function(_0x3bce28){return _0x3bce28;});}return null;})[_0xba5b('0x14')](respondWithStatusCode(_0x2d029b,null))[_0xba5b('0x39')](handleError(_0x2d029b,null));};exports[_0xba5b('0x50')]=function(_0x2caaca,_0x4845ee){var _0x543442=_0x2caaca['params']['id'];var _0x1e5e92=_0x2caaca[_0xba5b('0x3e')];var _0x41bff6=0xc8;var _0x374b18=null;return db[_0xba5b('0x51')][_0xba5b('0x52')]({'isolationLevel':db[_0xba5b('0x51')][_0xba5b('0x53')][_0xba5b('0x54')]['READ_COMMITTED']},function(_0x21dece){return db[_0xba5b('0x24')][_0xba5b('0x55')]({'where':{'id':_0x543442},'transaction':_0x21dece})[_0xba5b('0x14')](function(_0x3509da){if(_0x3509da){return db[_0xba5b('0x24')][_0xba5b('0x13')]({'where':{'VoiceExtensionId':_0x543442},'transaction':_0x21dece})[_0xba5b('0x14')](function(){var _0x1aa636=_[_0xba5b('0x1a')](_0x1e5e92,function(_0x2b4311){_0x2b4311['VoiceExtensionId']=_0x543442;_0x2b4311[_0xba5b('0x56')]=!![];return _0x2b4311;});return _0x3509da[_0xba5b('0x57')](_0x1aa636);})[_0xba5b('0x14')](function(_0x4d9b5f){return db[_0xba5b('0x24')][_0xba5b('0x58')](_0x4d9b5f,{'transaction':_0x21dece});});}else{_0x41bff6=0x194;_0x374b18=[];}});})[_0xba5b('0x14')](function(){if(_0x41bff6!==0x194){return db[_0xba5b('0x24')][_0xba5b('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x543442},'order':_0xba5b('0x5a')})['then'](function(_0x1db73a){_0x374b18=_0x1db73a;});}})[_0xba5b('0x39')](function(_0x46108e){_0x41bff6=0x1f4;logger[_0xba5b('0x48')](_0x46108e[_0xba5b('0x21')]);if(_0x46108e[_0xba5b('0x1f')]){delete _0x46108e[_0xba5b('0x1f')];}_0x374b18=_0x46108e;})[_0xba5b('0x5b')](function(){if(_0x374b18===null){_0x4845ee[_0xba5b('0x9')](_0x41bff6);}else{if(_0x41bff6===0x1f4){_0x4845ee[_0xba5b('0xa')](_0x41bff6)[_0xba5b('0x22')](_0x374b18);}else{_0x4845ee[_0xba5b('0xa')](_0x41bff6)[_0xba5b('0xc')](_0x374b18);}}});}; \ No newline at end of file +var _0x9998=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','startsWith','exten','user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9998,0x194));var _0x8999=function(_0x5ac362,_0x5067a3){_0x5ac362=_0x5ac362-0x0;var _0x2baeb0=_0x9998[_0x5ac362];return _0x2baeb0;};'use strict';var _=require(_0x8999('0x0'));var Redis=require(_0x8999('0x1'));var qs=require(_0x8999('0x2'));var logger=require(_0x8999('0x3'))(_0x8999('0x4'));var config=require(_0x8999('0x5'));var db=require(_0x8999('0x6'))['db'];config[_0x8999('0x7')]=_['defaults'](config[_0x8999('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8999('0x8'))(new Redis(config[_0x8999('0x7')]));require('./voiceExtension.socket')[_0x8999('0x9')](socket);function respondWithStatusCode(_0x5f2eba,_0x2dc7a1){_0x2dc7a1=_0x2dc7a1||0xcc;return function(_0x4cd8ec){if(_0x4cd8ec){return _0x5f2eba[_0x8999('0xa')](_0x2dc7a1);}return _0x5f2eba['status'](_0x2dc7a1)['end']();};}function respondWithResult(_0x1151b4,_0x262898){_0x262898=_0x262898||0xc8;return function(_0x551fbe){if(_0x551fbe){return _0x1151b4[_0x8999('0xb')](_0x262898)[_0x8999('0xc')](_0x551fbe);}};}function respondWithFilteredResult(_0x1954c7,_0x461461){return function(_0x377a15){if(_0x377a15){var _0x5ae9e8=typeof _0x461461[_0x8999('0xd')]===_0x8999('0xe')&&typeof _0x461461[_0x8999('0xf')]===_0x8999('0xe');var _0x3b5edc=_0x377a15[_0x8999('0x10')];var _0x1efde8=_0x5ae9e8?0x0:_0x461461[_0x8999('0xd')];var _0x117a40=_0x5ae9e8?_0x377a15[_0x8999('0x10')]:_0x461461['offset']+_0x461461[_0x8999('0xf')];var _0x4317fd;if(_0x117a40>=_0x3b5edc){_0x117a40=_0x3b5edc;_0x4317fd=0xc8;}else{_0x4317fd=0xce;}_0x1954c7['status'](_0x4317fd);return _0x1954c7[_0x8999('0x11')]('Content-Range',_0x1efde8+'-'+_0x117a40+'/'+_0x3b5edc)[_0x8999('0xc')](_0x377a15);}return null;};}function removeEntity(_0x2de915){return function(_0x1c1950){if(_0x1c1950){return _0x1c1950[_0x8999('0x12')]()[_0x8999('0x13')](function(){var _0x246995=_0x1c1950[_0x8999('0x14')]({'plain':!![]});var _0xf01fd0=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x8999('0x15'),'value':_0x8999('0x16'),'ignore':![]},{'name':_0x8999('0x17'),'value':_0x8999('0x18'),'ignore':![]}];var _0x4c19d9=_(_0xf01fd0)[_0x8999('0x19')](_0x8999('0x1a'))[_0x8999('0x1b')](_0x8999('0x1c'))[_0x8999('0x1c')]();if(_[_0x8999('0x1d')](_0x4c19d9,_0x246995[_0x8999('0x1e')])){return;}var _0x1ce407=_[_0x8999('0x1f')](_0xf01fd0,[_0x8999('0x1c'),_0x246995[_0x8999('0x1e')]])[_0x8999('0x20')];return db[_0x8999('0x21')][_0x8999('0x12')]({'where':{'type':_0x1ce407,'resourceId':_0x246995['id']}})['then'](function(){return _0x1c1950;});})[_0x8999('0x13')](function(){_0x2de915[_0x8999('0xb')](0xcc)[_0x8999('0x22')]();});}};}function handleEntityNotFound(_0x801bc5){return function(_0x2ea1df){if(!_0x2ea1df){_0x801bc5[_0x8999('0xa')](0x194);}return _0x2ea1df;};}function handleError(_0x264f48,_0x4c7aa0){_0x4c7aa0=_0x4c7aa0||0x1f4;return function(_0x5b3233){logger[_0x8999('0x23')](_0x5b3233[_0x8999('0x24')]);if(_0x5b3233[_0x8999('0x20')]){delete _0x5b3233[_0x8999('0x20')];}_0x264f48[_0x8999('0xb')](_0x4c7aa0)[_0x8999('0x25')](_0x5b3233);};}exports[_0x8999('0x26')]=function(_0x29e86d,_0x1ce579){var _0xa866ec={},_0x4fa1e0={},_0x1f3f54={'count':0x0,'rows':[]};var _0x5918fa=_['map'](db[_0x8999('0x27')][_0x8999('0x28')],function(_0x47bf3b){return{'name':_0x47bf3b[_0x8999('0x29')],'type':_0x47bf3b['type']['key']};});_0x4fa1e0[_0x8999('0x2a')]=_[_0x8999('0x1b')](_0x5918fa,_0x8999('0x20'));_0x4fa1e0[_0x8999('0x2b')]=_[_0x8999('0x2c')](_0x29e86d['query']);_0x4fa1e0[_0x8999('0x2d')]=_[_0x8999('0x2e')](_0x4fa1e0[_0x8999('0x2a')],_0x4fa1e0[_0x8999('0x2b')]);_0xa866ec[_0x8999('0x2f')]=_[_0x8999('0x2e')](_0x4fa1e0['model'],qs[_0x8999('0x30')](_0x29e86d[_0x8999('0x2b')][_0x8999('0x30')]));_0xa866ec[_0x8999('0x2f')]=_0xa866ec['attributes'][_0x8999('0x31')]?_0xa866ec[_0x8999('0x2f')]:_0x4fa1e0[_0x8999('0x2a')];if(!_0x29e86d[_0x8999('0x2b')][_0x8999('0x32')](_0x8999('0x33'))){_0xa866ec[_0x8999('0xf')]=qs[_0x8999('0xf')](_0x29e86d['query'][_0x8999('0xf')]);_0xa866ec['offset']=qs[_0x8999('0xd')](_0x29e86d[_0x8999('0x2b')][_0x8999('0xd')]);}_0xa866ec[_0x8999('0x34')]=qs['sort'](_0x29e86d[_0x8999('0x2b')]['sort']);_0xa866ec['where']=qs[_0x8999('0x2d')](_[_0x8999('0x35')](_0x29e86d['query'],_0x4fa1e0[_0x8999('0x2d')]),_0x5918fa);if(_0x29e86d['query']['filter']){_0xa866ec[_0x8999('0x36')]=_[_0x8999('0x37')](_0xa866ec['where'],{'$or':_[_0x8999('0x1b')](_0x5918fa,function(_0x9cf37f){if(_0x9cf37f[_0x8999('0x1e')]!==_0x8999('0x38')){var _0x1df4ef={};_0x1df4ef[_0x9cf37f[_0x8999('0x20')]]={'$like':'%'+_0x29e86d[_0x8999('0x2b')][_0x8999('0x19')]+'%'};return _0x1df4ef;}})});}_0xa866ec=_['merge']({},_0xa866ec,_0x29e86d[_0x8999('0x39')]);var _0x13aee4={'where':_0xa866ec[_0x8999('0x36')]};return db[_0x8999('0x27')][_0x8999('0x10')](_0x13aee4)[_0x8999('0x13')](function(_0x3d1e32){_0x1f3f54[_0x8999('0x10')]=_0x3d1e32;if(_0x29e86d[_0x8999('0x2b')][_0x8999('0x3a')]){_0xa866ec[_0x8999('0x3b')]=[{'all':!![]}];}return db[_0x8999('0x27')][_0x8999('0x3c')](_0xa866ec);})[_0x8999('0x13')](function(_0x2ea274){_0x1f3f54[_0x8999('0x3d')]=_0x2ea274;return _0x1f3f54;})[_0x8999('0x13')](respondWithFilteredResult(_0x1ce579,_0xa866ec))[_0x8999('0x3e')](handleError(_0x1ce579,null));};exports['show']=function(_0x39960d,_0x29b10c){var _0x5ce5a5={'raw':![],'where':{'id':_0x39960d[_0x8999('0x3f')]['id']}},_0x5ec47b={};_0x5ec47b[_0x8999('0x2a')]=_[_0x8999('0x2c')](db['VoiceExtension'][_0x8999('0x28')]);_0x5ec47b['query']=_[_0x8999('0x2c')](_0x39960d[_0x8999('0x2b')]);_0x5ec47b['filters']=_[_0x8999('0x2e')](_0x5ec47b[_0x8999('0x2a')],_0x5ec47b[_0x8999('0x2b')]);_0x5ce5a5['attributes']=_['intersection'](_0x5ec47b[_0x8999('0x2a')],qs[_0x8999('0x30')](_0x39960d[_0x8999('0x2b')][_0x8999('0x30')]));_0x5ce5a5[_0x8999('0x2f')]=_0x5ce5a5[_0x8999('0x2f')][_0x8999('0x31')]?_0x5ce5a5[_0x8999('0x2f')]:_0x5ec47b[_0x8999('0x2a')];if(_0x39960d['query']['includeAll']){_0x5ce5a5[_0x8999('0x3b')]=[{'all':!![]}];}_0x5ce5a5=_['merge']({},_0x5ce5a5,_0x39960d[_0x8999('0x39')]);return db[_0x8999('0x27')][_0x8999('0x1f')](_0x5ce5a5)[_0x8999('0x13')](handleEntityNotFound(_0x29b10c,null))[_0x8999('0x13')](respondWithResult(_0x29b10c,null))[_0x8999('0x3e')](handleError(_0x29b10c,null));};exports[_0x8999('0x12')]=function(_0x498120,_0x8f6285){return db[_0x8999('0x27')]['find']({'where':{'id':_0x498120[_0x8999('0x3f')]['id']}})[_0x8999('0x13')](handleEntityNotFound(_0x8f6285,null))[_0x8999('0x13')](removeEntity(_0x8f6285,null))['catch'](handleError(_0x8f6285,null));};exports[_0x8999('0x40')]=function(_0x5725ad,_0x3d2ab5){if(_0x5725ad[_0x8999('0x41')][_0x8999('0x1e')]===_0x8999('0x16')&&!_[_0x8999('0x42')](_0x5725ad['body'][_0x8999('0x43')],'_')){_0x5725ad[_0x8999('0x41')][_0x8999('0x43')]='_'['concat'](_0x5725ad[_0x8999('0x41')][_0x8999('0x43')]);}return db['VoiceExtension']['create'](_0x5725ad['body'],{'raw':![]})[_0x8999('0x13')](function(_0x2517b0){var _0x18ebf7=_0x5725ad[_0x8999('0x44')][_0x8999('0x14')]({'plain':!![]});if(!_0x18ebf7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18ebf7['role']===_0x8999('0x44')){var _0x130ec5=_0x2517b0['get']({'plain':!![]});var _0x5a3028=[{'name':_0x8999('0x45'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x8999('0x16')},{'name':_0x8999('0x17'),'value':_0x8999('0x18')}];var _0x13183b=_[_0x8999('0x1f')](_0x5a3028,[_0x8999('0x1c'),_0x130ec5[_0x8999('0x1e')]])[_0x8999('0x20')];return db[_0x8999('0x46')][_0x8999('0x1f')]({'where':{'name':_0x13183b,'userProfileId':_0x18ebf7[_0x8999('0x47')]},'raw':!![]})[_0x8999('0x13')](function(_0x2783e2){if(_0x2783e2&&_0x2783e2[_0x8999('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x130ec5[_0x8999('0x20')],'resourceId':_0x130ec5['id'],'type':_0x2783e2[_0x8999('0x20')],'sectionId':_0x2783e2['id']},{})['then'](function(){return _0x2517b0;});}else{return _0x2517b0;}})['catch'](function(_0x263d31){logger[_0x8999('0x23')](_0x8999('0x49'),_0x263d31);throw _0x263d31;});}return _0x2517b0;})[_0x8999('0x13')](respondWithResult(_0x3d2ab5,0xc9))[_0x8999('0x3e')](handleError(_0x3d2ab5,null));};exports['update']=function(_0x2f00ee,_0x9232f4){if(_0x2f00ee[_0x8999('0x41')]['id']){delete _0x2f00ee[_0x8999('0x41')]['id'];}return db[_0x8999('0x27')][_0x8999('0x1f')]({'where':{'id':_0x2f00ee[_0x8999('0x3f')]['id']}})[_0x8999('0x13')](handleEntityNotFound(_0x9232f4,null))['then'](function(_0x4c5461){if(_0x4c5461){return db[_0x8999('0x27')][_0x8999('0x4a')](_[_0x8999('0x35')](_0x2f00ee[_0x8999('0x41')],[_0x8999('0x43'),_0x8999('0x4b'),_0x8999('0x4c'),_0x8999('0x4d'),_0x8999('0x4e'),_0x8999('0x4f'),_0x8999('0x50')]),{'where':{'context':_0x4c5461[_0x8999('0x4b')],'exten':_0x4c5461[_0x8999('0x43')]},'individualHooks':!![]})[_0x8999('0x13')](function(_0x35d8c1){return _0x35d8c1;});}return null;})[_0x8999('0x13')](respondWithStatusCode(_0x9232f4,null))['catch'](handleError(_0x9232f4,null));};exports['addApplications']=function(_0x1e5b26,_0x3032cf){var _0x36057c=_0x1e5b26[_0x8999('0x3f')]['id'];var _0x5d46ab=_0x1e5b26['body'];var _0x4cad63=0xc8;var _0x6a0f48=null;return db[_0x8999('0x51')][_0x8999('0x52')]({'isolationLevel':db['sequelize'][_0x8999('0x53')][_0x8999('0x54')]['READ_COMMITTED']},function(_0x5e3f3d){return db[_0x8999('0x27')][_0x8999('0x55')]({'where':{'id':_0x36057c},'transaction':_0x5e3f3d})['then'](function(_0x1606ff){if(_0x1606ff){return db[_0x8999('0x27')]['destroy']({'where':{'VoiceExtensionId':_0x36057c},'transaction':_0x5e3f3d})[_0x8999('0x13')](function(){var _0x2d739d=_[_0x8999('0x1b')](_0x5d46ab,function(_0x4eb47f){_0x4eb47f['VoiceExtensionId']=_0x36057c;_0x4eb47f['isApp']=!![];return _0x4eb47f;});return _0x1606ff[_0x8999('0x56')](_0x2d739d);})[_0x8999('0x13')](function(_0x363187){return db[_0x8999('0x27')][_0x8999('0x57')](_0x363187,{'transaction':_0x5e3f3d});});}else{_0x4cad63=0x194;_0x6a0f48=[];}});})[_0x8999('0x13')](function(){if(_0x4cad63!==0x194){return db[_0x8999('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x36057c},'order':_0x8999('0x58')})['then'](function(_0xa0919b){_0x6a0f48=_0xa0919b;});}})['catch'](function(_0x58ac9d){_0x4cad63=0x1f4;logger[_0x8999('0x23')](_0x58ac9d[_0x8999('0x24')]);if(_0x58ac9d[_0x8999('0x20')]){delete _0x58ac9d[_0x8999('0x20')];}_0x6a0f48=_0x58ac9d;})[_0x8999('0x59')](function(){if(_0x6a0f48===null){_0x3032cf[_0x8999('0xa')](_0x4cad63);}else{if(_0x4cad63===0x1f4){_0x3032cf[_0x8999('0xb')](_0x4cad63)[_0x8999('0x25')](_0x6a0f48);}else{_0x3032cf[_0x8999('0xb')](_0x4cad63)['json'](_0x6a0f48);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5f50cc7..f025214 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 _0x1242=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x317df8,_0x32fa6c){var _0x2ccfbf=function(_0x33e1d2){while(--_0x33e1d2){_0x317df8['push'](_0x317df8['shift']());}};_0x2ccfbf(++_0x32fa6c);}(_0x1242,0x115));var _0x2124=function(_0x310ae0,_0x2baa3a){_0x310ae0=_0x310ae0-0x0;var _0x4d6830=_0x1242[_0x310ae0];return _0x4d6830;};'use strict';var EventEmitter=require(_0x2124('0x0'));var VoiceExtension=require(_0x2124('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2124('0x2')](0x0);var events={'afterCreate':_0x2124('0x3'),'afterUpdate':_0x2124('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4341d3){return function(_0x2ada8f,_0x2d8873,_0x40bf7f){VoiceExtensionEvents[_0x2124('0x5')](_0x4341d3+':'+_0x2ada8f['id'],_0x2ada8f);VoiceExtensionEvents[_0x2124('0x5')](_0x4341d3,_0x2ada8f);_0x40bf7f(null);};}for(var e in events){if(events[_0x2124('0x6')](e)){var event=events[e];VoiceExtension[_0x2124('0x7')](e,emitEvent(event));}}module[_0x2124('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5c39=['hasOwnProperty','hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x186861,_0x2311c7){var _0x5be31f=function(_0x1fc988){while(--_0x1fc988){_0x186861['push'](_0x186861['shift']());}};_0x5be31f(++_0x2311c7);}(_0x5c39,0x1bb));var _0x95c3=function(_0xa37c4d,_0x31b0f9){_0xa37c4d=_0xa37c4d-0x0;var _0x596eac=_0x5c39[_0xa37c4d];return _0x596eac;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x95c3('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x95c3('0x1'),'afterUpdate':_0x95c3('0x2'),'afterDestroy':_0x95c3('0x3')};function emitEvent(_0x5449dd){return function(_0x48acdf,_0xe5af62,_0x16f010){VoiceExtensionEvents[_0x95c3('0x4')](_0x5449dd+':'+_0x48acdf['id'],_0x48acdf);VoiceExtensionEvents[_0x95c3('0x4')](_0x5449dd,_0x48acdf);_0x16f010(null);};}for(var e in events){if(events[_0x95c3('0x5')](e)){var event=events[e];VoiceExtension[_0x95c3('0x6')](e,emitEvent(event));}}module[_0x95c3('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 197384e..5bca31d 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 _0xceb1=['appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','NoOp','CDR(destination)=','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','options','url','split','name','phone','param','prefix','${EXTEN:','${EXTEN}','SIP','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','then','length','*,*,*,*','interval','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial'];(function(_0x54db65,_0x59a9aa){var _0x5b40eb=function(_0x496b38){while(--_0x496b38){_0x54db65['push'](_0x54db65['shift']());}};_0x5b40eb(++_0x59a9aa);}(_0xceb1,0x10a));var _0x1ceb=function(_0xbad108,_0x5d7a10){_0xbad108=_0xbad108-0x0;var _0x4f0c46=_0xceb1[_0xbad108];return _0x4f0c46;};'use strict';var _=require(_0x1ceb('0x0'));var attributes=require(_0x1ceb('0x1'));module[_0x1ceb('0x2')]=function(_0x168c12){var _0x2517e0=_0x168c12[_0x1ceb('0x3')];function _0x20678a(_0x14d917){var _0x1d1afc=0x2;var _0x440f72=[{'type':_0x14d917[_0x1ceb('0x4')],'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x6')+_0x14d917[_0x1ceb('0x4')],'context':_0x14d917[_0x1ceb('0x7')],'exten':_0x14d917[_0x1ceb('0x8')],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']},{'type':_0x14d917[_0x1ceb('0x4')],'app':_0x14d917[_0x1ceb('0x9')]?'Set':'NoOp','appdata':_0x14d917['alias']?_0x1ceb('0xa')+_0x14d917[_0x1ceb('0x9')]:_0x1ceb('0xb'),'context':_0x14d917['context'],'exten':_0x14d917['exten'],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']}];if(_0x14d917[_0x1ceb('0x4')]==='inbound'){_0x440f72['push']({'type':_0x1ceb('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x14d917['id'],'context':_0x14d917[_0x1ceb('0x7')],'exten':_0x14d917[_0x1ceb('0x8')],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']});}_0x440f72[_0x1ceb('0xd')]({'type':_0x14d917[_0x1ceb('0x4')],'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0xe'),'context':_0x14d917[_0x1ceb('0x7')],'exten':_0x14d917['exten'],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']},{'type':_0x14d917[_0x1ceb('0x4')],'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0xf'),'context':_0x14d917[_0x1ceb('0x7')],'exten':_0x14d917[_0x1ceb('0x8')],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']},{'type':_0x14d917['type'],'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x10'),'context':_0x14d917['context'],'exten':_0x14d917[_0x1ceb('0x8')],'priority':_0x1d1afc++,'VoiceExtensionId':_0x14d917['id']});return _0x440f72;}function _0x1236f4(_0xf304dd){var _0x5d64cf=0x2;var _0x1682b2=[{'type':'outbound','app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x11'),'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0xf304dd['alias']?'Set':_0x1ceb('0x13'),'appdata':_0xf304dd[_0x1ceb('0x9')]?'CDR(routeAlias)='+_0xf304dd[_0x1ceb('0x9')]:'No\x20alias\x20set','context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x14')+(_0xf304dd[_0x1ceb('0x15')]?'${EXTEN:'+_0xf304dd[_0x1ceb('0x15')]+'}':'${EXTEN}'),'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':'Set','appdata':'CDR(routeid)='+_0xf304dd['id'],'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d64cf+0x2)+_0x1ceb('0x17')+(_0x5d64cf+0x1)+')','context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x5'),'appdata':_0xf304dd['cutdigits']?_0x1ceb('0x18')+_0xf304dd['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd['exten'],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0xe'),'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd['exten'],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':'Set','appdata':_0x1ceb('0xf'),'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0xf304dd['context'],'exten':_0xf304dd['exten'],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':'outbound','app':'Set','appdata':_0x1ceb('0x19')+_0xf304dd['id'],'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']}];if(_0xf304dd[_0x1ceb('0x1a')]('recordingFormat')&&_0xf304dd['recordingFormat']!=='none'){_0x1682b2[_0x1ceb('0xd')]({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']},{'type':_0x1ceb('0x12'),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x1b')+_0xf304dd[_0x1ceb('0x1c')]||_0x1ceb('0x1d'),'context':_0xf304dd[_0x1ceb('0x7')],'exten':_0xf304dd[_0x1ceb('0x8')],'priority':_0x5d64cf++,'VoiceExtensionId':_0xf304dd['id']});}return _0x1682b2;}function _0x44d9dc(_0x52e5fe,_0x3945e9){var _0x7fad53=[{'name':_0x1ceb('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x1ceb('0x1f'),'param':0x2},{'name':_0x1ceb('0x20'),'param':0x3}];var _0x218e39={};var _0x1431b2=_0x3945e9[_0x1ceb('0x21')](',');var _0x5e2639=[];for(var _0x26a0ed=0x0;_0x26a0ed<_0x7fad53['length'];_0x26a0ed++){switch(_0x7fad53[_0x26a0ed][_0x1ceb('0x22')]){case _0x1ceb('0x1e'):_0x218e39[_0x1ceb('0x1e')]=_0x1431b2[_0x7fad53[_0x26a0ed]['param']][_0x1ceb('0x21')]('/')[0x1];_0x218e39[_0x1ceb('0x23')]=_0x1431b2[_0x7fad53[_0x26a0ed][_0x1ceb('0x24')]][_0x1ceb('0x21')]('/')[0x2];_0x218e39[_0x1ceb('0x25')]=_0x218e39[_0x1ceb('0x23')]?_0x218e39['phone'][_0x1ceb('0x21')]('$')[0x0]:undefined;_0x218e39[_0x1ceb('0x23')]=_0x52e5fe[_0x1ceb('0x15')]?(_0x218e39[_0x1ceb('0x25')]||'')+_0x1ceb('0x26')+_0x52e5fe[_0x1ceb('0x15')]+'}':(_0x218e39[_0x1ceb('0x25')]||'')+_0x1ceb('0x27');_0x5e2639[_0x7fad53[_0x26a0ed]['param']]=[_0x1ceb('0x28'),_0x218e39[_0x1ceb('0x1e')],_0x218e39[_0x1ceb('0x23')]]['join']('/');break;case'options':_0x218e39[_0x1ceb('0x1f')]=_0x1431b2[_0x7fad53[_0x26a0ed][_0x1ceb('0x24')]];if(_0x52e5fe[_0x1ceb('0x1c')]!=='none'){if(_0x218e39['options'][_0x1ceb('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x218e39[_0x1ceb('0x1f')]+=_0x1ceb('0x2a');}}else{_0x218e39[_0x1ceb('0x1f')]=_0x218e39[_0x1ceb('0x1f')][_0x1ceb('0x2b')](_0x1ceb('0x2a'),'');}_0x5e2639[_0x7fad53[_0x26a0ed][_0x1ceb('0x24')]]=_0x218e39[_0x1ceb('0x1f')];break;default:_0x5e2639[_0x7fad53[_0x26a0ed]['param']]=_0x1431b2[_0x7fad53[_0x26a0ed][_0x1ceb('0x24')]];}}return _0x5e2639['join'](',');}function _0x427799(_0x674ecd,_0x123abc,_0x2114b5){return new Promise(function(_0x1b4739,_0x45a226){var _0x4ef509=[];if(_['isEmpty'](_0x123abc))return _0x1b4739(_0x4ef509);_0x2517e0[_0x1ceb('0x2c')][_0x1ceb('0x2d')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x1ceb('0x2e')](function(_0x7ea77d){for(var _0x25c739=0x0,_0x1a5be6=0x0;_0x25c739<_0x123abc[_0x1ceb('0x2f')];_0x25c739++,_0x1a5be6=0x0){var _0x1528b5=_0x123abc[_0x25c739];var _0x4cef3d=[];var _0x2bd101=[];delete _0x1528b5['id'];if(_0x1528b5['interval']!==_0x1ceb('0x30')){_0x1528b5['intervals']=[_0x1528b5[_0x1ceb('0x31')]];}else{_0x1528b5[_0x1ceb('0x32')]=_0x1528b5['IntervalId']?_[_0x1ceb('0x33')](_[_0x1ceb('0x34')](_0x7ea77d,{'IntervalId':_0x1528b5['IntervalId']}),'interval'):[];}_0x1528b5['context']=_0x674ecd[_0x1ceb('0x7')];_0x1528b5[_0x1ceb('0x8')]=_0x674ecd[_0x1ceb('0x8')];if(_0x1528b5[_0x1ceb('0x4')])_0x1528b5[_0x1ceb('0x4')]=_0x1528b5['type'][_0x1ceb('0x35')]();if(_0x674ecd['type']===_0x1ceb('0x12')){if(_0x1528b5['hasOwnProperty']('tag')&&_0x1528b5['tag']&&_0x1528b5[_0x1ceb('0x36')]!=='--'){_0x4cef3d['push']({'type':_0x1528b5[_0x1ceb('0x4')][_0x1ceb('0x35')](),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x37')+_0x1528b5['tag'],'context':_0x674ecd[_0x1ceb('0x7')],'exten':_0x674ecd[_0x1ceb('0x8')],'priority':_0x1528b5['intervals'][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});}_0x4cef3d[_0x1ceb('0xd')]({'type':_0x1528b5[_0x1ceb('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x1ceb('0x38')+(_0x1528b5[_0x1ceb('0x39')]?_0x1ceb('0x3a')+_0x1528b5[_0x1ceb('0x39')]+')':_0x1ceb('0x3b')),'context':_0x674ecd[_0x1ceb('0x7')],'exten':_0x674ecd[_0x1ceb('0x8')],'priority':_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});}else{if(_0x1528b5[_0x1ceb('0x1a')](_0x1ceb('0x3c'))){if([_0x1ceb('0x3d'),_0x1ceb('0x3e')][_0x1ceb('0x3f')](_0x1528b5[_0x1ceb('0x40')][_0x1ceb('0x35')]())&&_0x1528b5[_0x1ceb('0x41')]!=='custom'){if(_0x1528b5[_0x1ceb('0x3c')]){_0x4cef3d[_0x1ceb('0xd')]({'type':_0x1528b5[_0x1ceb('0x4')][_0x1ceb('0x35')](),'app':_0x1ceb('0x16'),'appdata':_0x1ceb('0x42'),'context':_0x674ecd[_0x1ceb('0x7')],'exten':_0x674ecd['exten'],'priority':_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});_0x4cef3d['push']({'type':_0x1528b5[_0x1ceb('0x4')]['toLowerCase'](),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x43'),'context':_0x674ecd[_0x1ceb('0x7')],'exten':_0x674ecd['exten'],'priority':_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});}else{_0x4cef3d['push']({'type':_0x1528b5[_0x1ceb('0x4')]['toLowerCase'](),'app':_0x1ceb('0x16'),'appdata':_0x1ceb('0x44'),'context':_0x674ecd['context'],'exten':_0x674ecd[_0x1ceb('0x8')],'priority':_0x1528b5['intervals']['length']+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});_0x4cef3d[_0x1ceb('0xd')]({'type':_0x1528b5[_0x1ceb('0x4')][_0x1ceb('0x35')](),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x45'),'context':_0x674ecd['context'],'exten':_0x674ecd['exten'],'priority':_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});}}}}for(var _0xe94cb=0x0;_0xe94cb<_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')];_0xe94cb++){var _0x47e9e0=_0x2114b5+_0x1528b5['intervals'][_0x1ceb('0x2f')];var _0x449b31=_0xe94cb===_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]-0x1?_0x2114b5+_0x4cef3d['length']+_0x2bd101['length']+0x2:_0x2114b5+_0xe94cb+0x1;_0x4cef3d[_0x1ceb('0x46')](_0xe94cb,0x0,{'type':_0x674ecd[_0x1ceb('0x4')],'app':_0x1ceb('0x47'),'appdata':_0x1528b5[_0x1ceb('0x32')][_0xe94cb]+'?'+_0x674ecd[_0x1ceb('0x7')]+_0x1ceb('0x48')+_0x47e9e0+':'+_0x674ecd[_0x1ceb('0x7')]+_0x1ceb('0x48')+_0x449b31,'exten':_0x674ecd['exten'],'context':_0x674ecd[_0x1ceb('0x7')],'priority':_0x2114b5+_0xe94cb,'VoiceExtensionId':_0x674ecd['id']});}if(_0x1528b5[_0x1ceb('0x41')]===_0x1ceb('0x49')){_0x1528b5['appdata']=_0x44d9dc(_0x674ecd,_0x1528b5[_0x1ceb('0x4a')]);}if(_0x1528b5[_0x1ceb('0x41')]===_0x1ceb('0x4b')){_0x4cef3d[_0x1ceb('0xd')]({'type':_0x1528b5['type'][_0x1ceb('0x35')](),'app':_0x1ceb('0x5'),'appdata':_0x1ceb('0x4c'),'context':_0x674ecd[_0x1ceb('0x7')],'exten':_0x674ecd['exten'],'priority':_0x1528b5[_0x1ceb('0x32')][_0x1ceb('0x2f')]+_0x2114b5+_0x1a5be6++,'VoiceExtensionId':_0x674ecd['id']});}_0x1528b5[_0x1ceb('0x4d')]=_0x4cef3d[_0x1ceb('0x2f')]?_[_0x1ceb('0x4e')](_0x4cef3d)[_0x1ceb('0x4d')]+0x1:_0x2114b5;_0x4ef509=_[_0x1ceb('0x4f')](_0x4ef509,_0x4cef3d,[_0x1528b5],_0x2bd101);_0x2114b5=_[_0x1ceb('0x4e')](_0x4ef509)[_0x1ceb('0x4d')]+0x1;}return _0x1b4739(_0x4ef509);})[_0x1ceb('0x50')](function(_0x531545){_0x45a226(_0x531545);});});}return _0x168c12[_0x1ceb('0x51')](_0x1ceb('0x52'),attributes,{'tableName':_0x1ceb('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2446c2){var _0x488d17=this[_0x1ceb('0x54')]({'plain':!![]});var _0x1cb48f=_0x488d17['type']===_0x1ceb('0x12')?_0x1236f4(_0x488d17):_0x20678a(_0x488d17);return _0x427799(_0x488d17,_0x2446c2,_[_0x1ceb('0x4e')](_0x1cb48f)[_0x1ceb('0x4d')]+0x1)[_0x1ceb('0x2e')](function(_0x12ed88){var _0x25cfd0=_['concat'](_0x1cb48f,_0x12ed88);_0x25cfd0[_0x1ceb('0xd')]({'type':_0x488d17[_0x1ceb('0x4')],'app':'Hangup','exten':_0x488d17[_0x1ceb('0x8')],'context':_0x488d17[_0x1ceb('0x7')],'priority':_[_0x1ceb('0x4e')](_0x25cfd0)[_0x1ceb('0x4d')]+0x1,'VoiceExtensionId':_0x488d17['id']});return _0x25cfd0;});}}});}; \ No newline at end of file +var _0x5046=['SIP','join','options','none','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','filter','hasOwnProperty','tag','CDR(tag)=','toLowerCase','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','phone','param','prefix','${EXTEN}'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5046,0x7a));var _0x6504=function(_0x9da8eb,_0x546c94){_0x9da8eb=_0x9da8eb-0x0;var _0x21cab0=_0x5046[_0x9da8eb];return _0x21cab0;};'use strict';var _=require(_0x6504('0x0'));var attributes=require(_0x6504('0x1'));module[_0x6504('0x2')]=function(_0x1f3c19){var _0x55f8cc=_0x1f3c19['models'];function _0x12ef46(_0x1c5a8e){var _0x3b314e=0x2;var _0x537ec3=[{'type':_0x1c5a8e[_0x6504('0x3')],'app':_0x6504('0x4'),'appdata':_0x6504('0x5')+_0x1c5a8e['type'],'context':_0x1c5a8e[_0x6504('0x6')],'exten':_0x1c5a8e['exten'],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']},{'type':_0x1c5a8e[_0x6504('0x3')],'app':_0x1c5a8e[_0x6504('0x7')]?_0x6504('0x4'):_0x6504('0x8'),'appdata':_0x1c5a8e['alias']?_0x6504('0x9')+_0x1c5a8e[_0x6504('0x7')]:_0x6504('0xa'),'context':_0x1c5a8e[_0x6504('0x6')],'exten':_0x1c5a8e['exten'],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']}];if(_0x1c5a8e[_0x6504('0x3')]==='inbound'){_0x537ec3[_0x6504('0xb')]({'type':_0x6504('0xc'),'app':'Set','appdata':_0x6504('0xd')+_0x1c5a8e['id'],'context':_0x1c5a8e[_0x6504('0x6')],'exten':_0x1c5a8e[_0x6504('0xe')],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']});}_0x537ec3[_0x6504('0xb')]({'type':_0x1c5a8e['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1c5a8e['context'],'exten':_0x1c5a8e[_0x6504('0xe')],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']},{'type':_0x1c5a8e['type'],'app':_0x6504('0x4'),'appdata':_0x6504('0xf'),'context':_0x1c5a8e['context'],'exten':_0x1c5a8e[_0x6504('0xe')],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']},{'type':_0x1c5a8e[_0x6504('0x3')],'app':_0x6504('0x4'),'appdata':_0x6504('0x10'),'context':_0x1c5a8e[_0x6504('0x6')],'exten':_0x1c5a8e[_0x6504('0xe')],'priority':_0x3b314e++,'VoiceExtensionId':_0x1c5a8e['id']});return _0x537ec3;}function _0x343ce6(_0x2da322){var _0x537983=0x2;var _0x64983e=[{'type':_0x6504('0x11'),'app':_0x6504('0x4'),'appdata':_0x6504('0x12'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':_0x2da322[_0x6504('0x7')]?_0x6504('0x4'):_0x6504('0x8'),'appdata':_0x2da322[_0x6504('0x7')]?_0x6504('0x9')+_0x2da322[_0x6504('0x7')]:'No\x20alias\x20set','context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':'outbound','app':_0x6504('0x4'),'appdata':_0x6504('0x13')+(_0x2da322[_0x6504('0x14')]?_0x6504('0x15')+_0x2da322[_0x6504('0x14')]+'}':'${EXTEN}'),'context':_0x2da322['context'],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':_0x6504('0x4'),'appdata':_0x6504('0xd')+_0x2da322['id'],'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':_0x6504('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x537983+0x2)+'):Goto('+(_0x537983+0x1)+')','context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':'Set','appdata':_0x2da322[_0x6504('0x14')]?_0x6504('0x17')+_0x2da322['cutdigits']+'}':_0x6504('0x18'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322['exten'],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':_0x6504('0x4'),'appdata':_0x6504('0x19'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':'Set','appdata':_0x6504('0xf'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':'Set','appdata':_0x6504('0x10'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':_0x6504('0x11'),'app':'Set','appdata':_0x6504('0x1a')+_0x2da322['id'],'context':_0x2da322['context'],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']}];if(_0x2da322['hasOwnProperty'](_0x6504('0x1b'))&&_0x2da322[_0x6504('0x1b')]!=='none'){_0x64983e[_0x6504('0xb')]({'type':'outbound','app':_0x6504('0x4'),'appdata':_0x6504('0x1c'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']},{'type':'outbound','app':'Set','appdata':_0x6504('0x1d')+_0x2da322['recordingFormat']||_0x6504('0x1e'),'context':_0x2da322[_0x6504('0x6')],'exten':_0x2da322[_0x6504('0xe')],'priority':_0x537983++,'VoiceExtensionId':_0x2da322['id']});}return _0x64983e;}function _0x63df7e(_0x24c45e,_0xeee47d){var _0x9b8e55=[{'name':_0x6504('0x1f'),'param':0x0},{'name':_0x6504('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x6504('0x21'),'param':0x3}];var _0x4b4804={};var _0x5b63f3=_0xeee47d[_0x6504('0x22')](',');var _0x447406=[];for(var _0x5a5e13=0x0;_0x5a5e13<_0x9b8e55[_0x6504('0x23')];_0x5a5e13++){switch(_0x9b8e55[_0x5a5e13]['name']){case _0x6504('0x1f'):_0x4b4804[_0x6504('0x1f')]=_0x5b63f3[_0x9b8e55[_0x5a5e13]['param']][_0x6504('0x22')]('/')[0x1];_0x4b4804[_0x6504('0x24')]=_0x5b63f3[_0x9b8e55[_0x5a5e13][_0x6504('0x25')]][_0x6504('0x22')]('/')[0x2];_0x4b4804['prefix']=_0x4b4804[_0x6504('0x24')]?_0x4b4804[_0x6504('0x24')][_0x6504('0x22')]('$')[0x0]:undefined;_0x4b4804['phone']=_0x24c45e[_0x6504('0x14')]?(_0x4b4804[_0x6504('0x26')]||'')+_0x6504('0x15')+_0x24c45e[_0x6504('0x14')]+'}':(_0x4b4804[_0x6504('0x26')]||'')+_0x6504('0x27');_0x447406[_0x9b8e55[_0x5a5e13][_0x6504('0x25')]]=[_0x6504('0x28'),_0x4b4804['trunk'],_0x4b4804[_0x6504('0x24')]][_0x6504('0x29')]('/');break;case _0x6504('0x2a'):_0x4b4804['options']=_0x5b63f3[_0x9b8e55[_0x5a5e13][_0x6504('0x25')]];if(_0x24c45e['recordingFormat']!==_0x6504('0x2b')){if(_0x4b4804[_0x6504('0x2a')]['indexOf'](_0x6504('0x2c'))<0x0){_0x4b4804[_0x6504('0x2a')]+=_0x6504('0x2c');}}else{_0x4b4804[_0x6504('0x2a')]=_0x4b4804['options']['replace'](_0x6504('0x2c'),'');}_0x447406[_0x9b8e55[_0x5a5e13][_0x6504('0x25')]]=_0x4b4804['options'];break;default:_0x447406[_0x9b8e55[_0x5a5e13][_0x6504('0x25')]]=_0x5b63f3[_0x9b8e55[_0x5a5e13]['param']];}}return _0x447406[_0x6504('0x29')](',');}function _0x18d173(_0x597f2e,_0x3b1891,_0x35a647){return new Promise(function(_0x270b77,_0x4c8232){var _0x394894=[];if(_[_0x6504('0x2d')](_0x3b1891))return _0x270b77(_0x394894);_0x55f8cc[_0x6504('0x2e')][_0x6504('0x2f')]({'attributes':['id',_0x6504('0x30'),_0x6504('0x31')],'raw':!![]})[_0x6504('0x32')](function(_0x4caac3){for(var _0x2aebce=0x0,_0xe02fab=0x0;_0x2aebce<_0x3b1891[_0x6504('0x23')];_0x2aebce++,_0xe02fab=0x0){var _0x1b86f=_0x3b1891[_0x2aebce];var _0xa719b6=[];var _0x1d74e9=[];delete _0x1b86f['id'];if(_0x1b86f[_0x6504('0x30')]!=='*,*,*,*'){_0x1b86f[_0x6504('0x33')]=[_0x1b86f[_0x6504('0x30')]];}else{_0x1b86f[_0x6504('0x33')]=_0x1b86f[_0x6504('0x31')]?_['map'](_[_0x6504('0x34')](_0x4caac3,{'IntervalId':_0x1b86f[_0x6504('0x31')]}),'interval'):[];}_0x1b86f[_0x6504('0x6')]=_0x597f2e[_0x6504('0x6')];_0x1b86f[_0x6504('0xe')]=_0x597f2e[_0x6504('0xe')];if(_0x1b86f[_0x6504('0x3')])_0x1b86f[_0x6504('0x3')]=_0x1b86f[_0x6504('0x3')]['toLowerCase']();if(_0x597f2e[_0x6504('0x3')]===_0x6504('0x11')){if(_0x1b86f[_0x6504('0x35')](_0x6504('0x36'))&&_0x1b86f[_0x6504('0x36')]&&_0x1b86f[_0x6504('0x36')]!=='--'){_0xa719b6['push']({'type':_0x1b86f['type']['toLowerCase'](),'app':_0x6504('0x4'),'appdata':_0x6504('0x37')+_0x1b86f['tag'],'context':_0x597f2e['context'],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});}_0xa719b6['push']({'type':_0x1b86f['type'][_0x6504('0x38')](),'app':_0x6504('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1b86f['callerID']?_0x6504('0x39')+_0x1b86f[_0x6504('0x3a')]+')':_0x6504('0x3b')),'context':_0x597f2e[_0x6504('0x6')],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f['intervals'][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});}else{if(_0x1b86f[_0x6504('0x35')](_0x6504('0x3c'))){if([_0x6504('0x3d'),_0x6504('0x3e')][_0x6504('0x3f')](_0x1b86f['app'][_0x6504('0x38')]())&&_0x1b86f[_0x6504('0x40')]!=='custom'){if(_0x1b86f['answer']){_0xa719b6['push']({'type':_0x1b86f['type'][_0x6504('0x38')](),'app':_0x6504('0x16'),'appdata':_0x6504('0x41'),'context':_0x597f2e[_0x6504('0x6')],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f['intervals'][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});_0xa719b6[_0x6504('0xb')]({'type':_0x1b86f[_0x6504('0x3')][_0x6504('0x38')](),'app':_0x6504('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x597f2e[_0x6504('0x6')],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});}else{_0xa719b6[_0x6504('0xb')]({'type':_0x1b86f['type'][_0x6504('0x38')](),'app':_0x6504('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x597f2e[_0x6504('0x6')],'exten':_0x597f2e['exten'],'priority':_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});_0xa719b6['push']({'type':_0x1b86f[_0x6504('0x3')][_0x6504('0x38')](),'app':_0x6504('0x4'),'appdata':_0x6504('0x42'),'context':_0x597f2e[_0x6504('0x6')],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});}}}}for(var _0x2baa24=0x0;_0x2baa24<_0x1b86f['intervals'][_0x6504('0x23')];_0x2baa24++){var _0x197f8d=_0x35a647+_0x1b86f[_0x6504('0x33')][_0x6504('0x23')];var _0x3af61d=_0x2baa24===_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]-0x1?_0x35a647+_0xa719b6[_0x6504('0x23')]+_0x1d74e9[_0x6504('0x23')]+0x2:_0x35a647+_0x2baa24+0x1;_0xa719b6[_0x6504('0x43')](_0x2baa24,0x0,{'type':_0x597f2e['type'],'app':_0x6504('0x44'),'appdata':_0x1b86f['intervals'][_0x2baa24]+'?'+_0x597f2e['context']+_0x6504('0x45')+_0x197f8d+':'+_0x597f2e['context']+_0x6504('0x45')+_0x3af61d,'exten':_0x597f2e['exten'],'context':_0x597f2e['context'],'priority':_0x35a647+_0x2baa24,'VoiceExtensionId':_0x597f2e['id']});}if(_0x1b86f[_0x6504('0x40')]===_0x6504('0x46')){_0x1b86f[_0x6504('0x47')]=_0x63df7e(_0x597f2e,_0x1b86f[_0x6504('0x47')]);}if(_0x1b86f[_0x6504('0x40')]===_0x6504('0x48')){_0xa719b6['push']({'type':_0x1b86f[_0x6504('0x3')]['toLowerCase'](),'app':_0x6504('0x4'),'appdata':_0x6504('0x49'),'context':_0x597f2e['context'],'exten':_0x597f2e[_0x6504('0xe')],'priority':_0x1b86f[_0x6504('0x33')][_0x6504('0x23')]+_0x35a647+_0xe02fab++,'VoiceExtensionId':_0x597f2e['id']});}_0x1b86f['priority']=_0xa719b6[_0x6504('0x23')]?_[_0x6504('0x4a')](_0xa719b6)[_0x6504('0x4b')]+0x1:_0x35a647;_0x394894=_['concat'](_0x394894,_0xa719b6,[_0x1b86f],_0x1d74e9);_0x35a647=_[_0x6504('0x4a')](_0x394894)[_0x6504('0x4b')]+0x1;}return _0x270b77(_0x394894);})[_0x6504('0x4c')](function(_0x1dac2f){_0x4c8232(_0x1dac2f);});});}return _0x1f3c19[_0x6504('0x4d')](_0x6504('0x4e'),attributes,{'tableName':_0x6504('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4da1cf){var _0x2de5df=this[_0x6504('0x50')]({'plain':!![]});var _0x4717fe=_0x2de5df['type']===_0x6504('0x11')?_0x343ce6(_0x2de5df):_0x12ef46(_0x2de5df);return _0x18d173(_0x2de5df,_0x4da1cf,_['last'](_0x4717fe)[_0x6504('0x4b')]+0x1)['then'](function(_0x4d0926){var _0x3b60e4=_['concat'](_0x4717fe,_0x4d0926);_0x3b60e4[_0x6504('0xb')]({'type':_0x2de5df[_0x6504('0x3')],'app':'Hangup','exten':_0x2de5df[_0x6504('0xe')],'context':_0x2de5df[_0x6504('0x6')],'priority':_[_0x6504('0x4a')](_0x3b60e4)[_0x6504('0x4b')]+0x1,'VoiceExtensionId':_0x2de5df['id']});return _0x3b60e4;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 336471e..821e2e6 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 _0xcfef=['VoiceExtension','findAll','options','where','attributes','include','model','map','stringify','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension'];(function(_0x5e7f10,_0x10bd95){var _0x4a9170=function(_0x1391e9){while(--_0x1391e9){_0x5e7f10['push'](_0x5e7f10['shift']());}};_0x4a9170(++_0x10bd95);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x1a2c03,_0x535066){_0x1a2c03=_0x1a2c03-0x0;var _0x154218=_0xcfef[_0x1a2c03];return _0x154218;};'use strict';var _=require('lodash');var util=require(_0xfcfe('0x0'));var moment=require(_0xfcfe('0x1'));var BPromise=require(_0xfcfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcfe('0x3'))(_0xfcfe('0x4'));var config=require(_0xfcfe('0x5'));var jayson=require(_0xfcfe('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xfcfe('0x7')]=_['defaults'](config[_0xfcfe('0x7')],{'host':_0xfcfe('0x8'),'port':0x18eb});var socket=require(_0xfcfe('0x9'))(new Redis(config['redis']));require(_0xfcfe('0xa'))['register'](socket);function respondWithRpcPromise(_0x5c071e,_0x40015f,_0x5664fd){return new BPromise(function(_0x100607,_0x360c24){return client[_0xfcfe('0xb')](_0x5c071e,_0x5664fd)[_0xfcfe('0xc')](function(_0x30abb7){logger[_0xfcfe('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x40015f,_0xfcfe('0xe'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x40015f,_0xfcfe('0xe'),JSON['stringify'](_0x30abb7));if(_0x30abb7[_0xfcfe('0xf')]){if(_0x30abb7[_0xfcfe('0xf')][_0xfcfe('0x10')]===0x1f4){logger[_0xfcfe('0xf')](_0xfcfe('0x11'),_0x40015f,_0x30abb7[_0xfcfe('0xf')][_0xfcfe('0x12')]);return _0x360c24(_0x30abb7['error']['message']);}logger[_0xfcfe('0xf')](_0xfcfe('0x11'),_0x40015f,_0x30abb7[_0xfcfe('0xf')][_0xfcfe('0x12')]);return _0x100607(_0x30abb7['error']['message']);}else{logger[_0xfcfe('0xd')](_0xfcfe('0x11'),_0x40015f,_0xfcfe('0xe'));_0x100607(_0x30abb7['result'][_0xfcfe('0x12')]);}})['catch'](function(_0x20d6af){logger[_0xfcfe('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x40015f,_0x20d6af);_0x360c24(_0x20d6af);});});}exports[_0xfcfe('0x13')]=function(_0x561af9){var _0x360f3a=this;return new Promise(function(_0x19a650,_0x4331a7){return db[_0xfcfe('0x14')][_0xfcfe('0x15')]({'raw':_0x561af9['options']?_0x561af9[_0xfcfe('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x561af9['options']?_0x561af9[_0xfcfe('0x16')][_0xfcfe('0x17')]||null:null,'attributes':_0x561af9[_0xfcfe('0x16')]?_0x561af9[_0xfcfe('0x16')][_0xfcfe('0x18')]||null:null,'limit':_0x561af9['options']?_0x561af9[_0xfcfe('0x16')]['limit']||null:null,'include':_0x561af9[_0xfcfe('0x16')]?_0x561af9[_0xfcfe('0x16')][_0xfcfe('0x19')]?_['map'](_0x561af9[_0xfcfe('0x16')][_0xfcfe('0x19')],function(_0x115f23){return{'model':db[_0x115f23[_0xfcfe('0x1a')]],'as':_0x115f23['as'],'attributes':_0x115f23['attributes'],'include':_0x115f23[_0xfcfe('0x19')]?_[_0xfcfe('0x1b')](_0x115f23[_0xfcfe('0x19')],function(_0x141038){return{'model':db[_0x141038[_0xfcfe('0x1a')]],'as':_0x141038['as'],'attributes':_0x141038[_0xfcfe('0x18')],'include':_0x141038[_0xfcfe('0x19')]?_[_0xfcfe('0x1b')](_0x141038[_0xfcfe('0x19')],function(_0x1db844){return{'model':db[_0x1db844[_0xfcfe('0x1a')]],'as':_0x1db844['as'],'attributes':_0x1db844[_0xfcfe('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcfe('0xc')](function(_0x24d018){logger[_0xfcfe('0xd')](_0xfcfe('0x13'),_0x561af9);logger['debug'](_0xfcfe('0x13'),_0x561af9,JSON[_0xfcfe('0x1c')](_0x24d018));_0x19a650(_0x24d018);})[_0xfcfe('0x1d')](function(_0xa2c262){logger[_0xfcfe('0xf')](_0xfcfe('0x13'),_0xa2c262[_0xfcfe('0x12')],_0x561af9);_0x4331a7(_0x360f3a[_0xfcfe('0xf')](0x1f4,_0xa2c262[_0xfcfe('0x12')]));});});}; \ No newline at end of file +var _0x6c14=['raw','where','attributes','limit','include','map','model','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','VoiceExtension','findAll','options'];(function(_0xdab0c2,_0x41898f){var _0x1d5f15=function(_0x1e6eff){while(--_0x1e6eff){_0xdab0c2['push'](_0xdab0c2['shift']());}};_0x1d5f15(++_0x41898f);}(_0x6c14,0xd1));var _0x46c1=function(_0x3b3d88,_0x23c86b){_0x3b3d88=_0x3b3d88-0x0;var _0x3dc9b7=_0x6c14[_0x3b3d88];return _0x3dc9b7;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rs=require(_0x46c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c1('0x5'))['db'];var utils=require(_0x46c1('0x6'));var logger=require(_0x46c1('0x7'))('rpc');var config=require(_0x46c1('0x8'));var jayson=require(_0x46c1('0x9'));var client=jayson[_0x46c1('0xa')][_0x46c1('0xb')]({'port':0x232a});config[_0x46c1('0xc')]=_[_0x46c1('0xd')](config[_0x46c1('0xc')],{'host':_0x46c1('0xe'),'port':0x18eb});var socket=require(_0x46c1('0xf'))(new Redis(config['redis']));require(_0x46c1('0x10'))[_0x46c1('0x11')](socket);function respondWithRpcPromise(_0x28fae2,_0x5e999d,_0x42af02){return new BPromise(function(_0x3676e3,_0x2c718c){return client['request'](_0x28fae2,_0x42af02)[_0x46c1('0x12')](function(_0x2e9325){logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,'request\x20sent');logger[_0x46c1('0x15')](_0x46c1('0x16'),_0x5e999d,'request\x20sent',JSON['stringify'](_0x2e9325));if(_0x2e9325[_0x46c1('0x17')]){if(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x18')]===0x1f4){logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error'][_0x46c1('0x19')]);return _0x2c718c(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error']['message']);return _0x3676e3(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}else{logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,_0x46c1('0x1a'));_0x3676e3(_0x2e9325[_0x46c1('0x1b')][_0x46c1('0x19')]);}})['catch'](function(_0x247a8b){logger[_0x46c1('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5e999d,_0x247a8b);_0x2c718c(_0x247a8b);});});}exports['GetVoiceExtension']=function(_0x17ff1d){var _0x5a5d95=this;return new Promise(function(_0x5b5290,_0x301c0c){return db[_0x46c1('0x1c')][_0x46c1('0x1d')]({'raw':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x20')]||null:null,'attributes':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x21')]||null:null,'limit':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x22')]||null:null,'include':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x23')]?_[_0x46c1('0x24')](_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x23')],function(_0x2924b8){return{'model':db[_0x2924b8[_0x46c1('0x25')]],'as':_0x2924b8['as'],'attributes':_0x2924b8['attributes'],'include':_0x2924b8['include']?_[_0x46c1('0x24')](_0x2924b8[_0x46c1('0x23')],function(_0x54f5e3){return{'model':db[_0x54f5e3[_0x46c1('0x25')]],'as':_0x54f5e3['as'],'attributes':_0x54f5e3[_0x46c1('0x21')],'include':_0x54f5e3[_0x46c1('0x23')]?_[_0x46c1('0x24')](_0x54f5e3[_0x46c1('0x23')],function(_0x3fdaea){return{'model':db[_0x3fdaea['model']],'as':_0x3fdaea['as'],'attributes':_0x3fdaea[_0x46c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46c1('0x12')](function(_0x32f553){logger[_0x46c1('0x13')](_0x46c1('0x26'),_0x17ff1d);logger[_0x46c1('0x15')](_0x46c1('0x26'),_0x17ff1d,JSON['stringify'](_0x32f553));_0x5b5290(_0x32f553);})[_0x46c1('0x27')](function(_0x5448f4){logger[_0x46c1('0x17')](_0x46c1('0x26'),_0x5448f4[_0x46c1('0x19')],_0x17ff1d);_0x301c0c(_0x5a5d95[_0x46c1('0x17')](0x1f4,_0x5448f4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ba9f92e..c7ce2fe 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x1aff92,_0x3ad115){var _0x5e3296=function(_0x3149f1){while(--_0x3149f1){_0x1aff92['push'](_0x1aff92['shift']());}};_0x5e3296(++_0x3ad115);}(_0x0295,0x1f0));var _0x5029=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x0295[_0x6f1a87];return _0x2495c7;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x3eb5da,_0x12f382){var _0x2bbaea=function(_0x340b85){while(--_0x340b85){_0x3eb5da['push'](_0x3eb5da['shift']());}};_0x2bbaea(++_0x12f382);}(_0x326f,0xd1));var _0xf326=function(_0x3fefca,_0x3bf2cf){_0x3fefca=_0x3fefca-0x0;var _0x476344=_0x326f[_0x3fefca];return _0x476344;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 33d67b1..9dda584 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2bef02,_0x218a0a){_0x2bef02=_0x2bef02-0x0;var _0x501811=_0x5f2f[_0x2bef02];return _0x501811;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x0adf=['put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','post','create'];(function(_0xadd45d,_0x37d27e){var _0x81e77=function(_0x2742ff){while(--_0x2742ff){_0xadd45d['push'](_0xadd45d['shift']());}};_0x81e77(++_0x37d27e);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x5155cd,_0x404aa6){_0x5155cd=_0x5155cd-0x0;var _0xf9a766=_0x0adf[_0x5155cd];return _0xf9a766;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['getMessages']);router[_0xf0ad('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x12')]);router['delete']('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x13')]);module[_0xf0ad('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 92fefad..6bba9d4 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 _0x3bab=['from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING'];(function(_0x3a2b6e,_0x5ba75b){var _0x593ef1=function(_0x283dcc){while(--_0x283dcc){_0x3a2b6e['push'](_0x3a2b6e['shift']());}};_0x593ef1(++_0x5ba75b);}(_0x3bab,0x15d));var _0xb3ba=function(_0x219329,_0x4932b5){_0x219329=_0x219329-0x0;var _0x40c9b5=_0x3bab[_0x219329];return _0x40c9b5;};'use strict';var Sequelize=require(_0xb3ba('0x0'));module[_0xb3ba('0x1')]={'customer_id':{'type':Sequelize[_0xb3ba('0x2')]},'context':{'type':Sequelize[_0xb3ba('0x2')],'defaultValue':_0xb3ba('0x3'),'unique':_0xb3ba('0x4')},'mailbox':{'type':Sequelize[_0xb3ba('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb3ba('0x4')},'password':{'type':Sequelize[_0xb3ba('0x2')]},'fullname':{'type':Sequelize[_0xb3ba('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2ab3c2){this[_0xb3ba('0x5')](_0xb3ba('0x6'),typeof _0x2ab3c2==='string'&&_0x2ab3c2['trim']()?_0x2ab3c2[_0xb3ba('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xb3ba('0x2')],'defaultValue':_0xb3ba('0x8')},'attach':{'type':Sequelize[_0xb3ba('0x9')]('yes','no'),'defaultValue':_0xb3ba('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xb3ba('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xb3ba('0x2')]},'callback':{'type':Sequelize[_0xb3ba('0x2')]},'review':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb3ba('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb3ba('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xb3ba('0xa'),'no'),'defaultValue':_0xb3ba('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb3ba('0x9')](_0xb3ba('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xb3ba('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb3ba('0xc')],'get':function(){return this[_0xb3ba('0xd')](_0xb3ba('0xe'))+'\x20-\x20'+this['getDataValue'](_0xb3ba('0xf'));}}}; \ No newline at end of file +var _0x5b52=['central','ENUM','yes','TIMESTAMP','VIRTUAL','getDataValue','fullname','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x5b52,0xbe));var _0x25b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b52[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x25b5('0x0')]},'context':{'type':Sequelize[_0x25b5('0x0')],'defaultValue':_0x25b5('0x1'),'unique':_0x25b5('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x25b5('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x25b5('0x0')],'validate':{'isEmail':!![]},'set':function(_0x5e88de){this[_0x25b5('0x3')](_0x25b5('0x4'),typeof _0x5e88de==='string'&&_0x5e88de[_0x25b5('0x5')]()?_0x5e88de[_0x25b5('0x5')]():null);}},'pager':{'type':Sequelize[_0x25b5('0x0')]},'tz':{'type':Sequelize[_0x25b5('0x0')],'defaultValue':_0x25b5('0x6')},'attach':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x25b5('0x0')]},'callback':{'type':Sequelize[_0x25b5('0x0')]},'review':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x25b5('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x25b5('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':_0x25b5('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x25b5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x25b5('0x7')](_0x25b5('0x8'),'no'),'defaultValue':_0x25b5('0x8'),'allowNull':![]},'stamp':{'type':_0x25b5('0x9')},'emailsubject':{'type':Sequelize[_0x25b5('0x0')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x25b5('0xa')],'get':function(){return this[_0x25b5('0xb')](_0x25b5('0xc'))+'\x20-\x20'+this['getDataValue'](_0x25b5('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 45bc9f5..6df2719 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 _0xb7e7=['sort','where','pick','filter','options','show','params','keys','rawAttributes','intersection','includeAll','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','index','VoiceMail','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5e586f,_0x4d823e){var _0x430f35=function(_0xa2db18){while(--_0xa2db18){_0x5e586f['push'](_0x5e586f['shift']());}};_0x430f35(++_0x4d823e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb7e7[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Voicemails';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};var _0x33f9a1=_['map'](db[_0x7b7e('0x2d')]['rawAttributes'],function(_0x23a453){return{'name':_0x23a453[_0x7b7e('0x2e')],'type':_0x23a453[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x33f9a1,_0x7b7e('0x2a'));_0x35602a['query']=_['keys'](_0x5515ca[_0x7b7e('0x33')]);_0x35602a[_0x7b7e('0x34')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],_0x35602a[_0x7b7e('0x33')]);_0xe31336[_0x7b7e('0x35')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0xe31336[_0x7b7e('0x35')]=_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0xe31336[_0x7b7e('0x35')]:_0x35602a[_0x7b7e('0x31')];if(!_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1f')]);_0xe31336['offset']=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3b')]);_0xe31336[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x5515ca['query'],_0x35602a[_0x7b7e('0x34')]),_0x33f9a1);if(_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]){_0xe31336[_0x7b7e('0x3c')]=_['merge'](_0xe31336[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x32')](_0x33f9a1,function(_0x3d5280){if(_0x3d5280['type']!=='VIRTUAL'){var _0x22651e={};_0x22651e[_0x3d5280['name']]={'$like':'%'+_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x22651e;}})});}_0xe31336=_['merge']({},_0xe31336,_0x5515ca[_0x7b7e('0x3f')]);var _0x2074d1={'where':_0xe31336[_0x7b7e('0x3c')]};return db[_0x7b7e('0x2d')][_0x7b7e('0x20')](_0x2074d1)[_0x7b7e('0x26')](function(_0xc888e4){_0x326dd2[_0x7b7e('0x20')]=_0xc888e4;if(_0x5515ca[_0x7b7e('0x33')]['includeAll']){_0xe31336['include']=[{'all':!![]}];}return db[_0x7b7e('0x2d')]['findAll'](_0xe31336);})[_0x7b7e('0x26')](function(_0x5e8b5d){_0x326dd2['rows']=_0x5e8b5d;return _0x326dd2;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));};exports[_0x7b7e('0x40')]=function(_0x52051c,_0xa8521d){var _0x3e58be={'raw':!![],'where':{'id':_0x52051c[_0x7b7e('0x41')]['id']}},_0x7ea84c={};_0x7ea84c['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x2d')][_0x7b7e('0x43')]);_0x7ea84c[_0x7b7e('0x33')]=_[_0x7b7e('0x42')](_0x52051c[_0x7b7e('0x33')]);_0x7ea84c['filters']=_['intersection'](_0x7ea84c['model'],_0x7ea84c[_0x7b7e('0x33')]);_0x3e58be[_0x7b7e('0x35')]=_[_0x7b7e('0x44')](_0x7ea84c[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x52051c[_0x7b7e('0x33')]['fields']));_0x3e58be[_0x7b7e('0x35')]=_0x3e58be[_0x7b7e('0x35')]['length']?_0x3e58be['attributes']:_0x7ea84c[_0x7b7e('0x31')];if(_0x52051c[_0x7b7e('0x33')][_0x7b7e('0x45')]){_0x3e58be[_0x7b7e('0x46')]=[{'all':!![]}];}_0x3e58be=_[_0x7b7e('0x47')]({},_0x3e58be,_0x52051c[_0x7b7e('0x3f')]);return db['VoiceMail'][_0x7b7e('0x48')](_0x3e58be)['then'](handleEntityNotFound(_0xa8521d,null))[_0x7b7e('0x26')](respondWithResult(_0xa8521d,null))[_0x7b7e('0x49')](handleError(_0xa8521d,null));};exports[_0x7b7e('0x4a')]=function(_0x5874e2,_0x58e4e6){return db[_0x7b7e('0x2d')][_0x7b7e('0x4a')](_0x5874e2[_0x7b7e('0x4b')],{})[_0x7b7e('0x26')](function(_0x1f9d0f){var _0x5cce7c=_0x5874e2[_0x7b7e('0x4c')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x5cce7c)throw new Error(_0x7b7e('0x4d'));if(_0x5cce7c[_0x7b7e('0x4e')]===_0x7b7e('0x4c')){var _0x5a9697=_0x1f9d0f[_0x7b7e('0x27')]({'plain':!![]});var _0x29024e=_0x7b7e('0x4f');return db[_0x7b7e('0x50')][_0x7b7e('0x48')]({'where':{'name':_0x29024e,'userProfileId':_0x5cce7c[_0x7b7e('0x51')]},'raw':!![]})[_0x7b7e('0x26')](function(_0x4a7be0){if(_0x4a7be0&&_0x4a7be0[_0x7b7e('0x52')]===0x0){return db['UserProfileResource'][_0x7b7e('0x4a')]({'name':_0x5a9697[_0x7b7e('0x2a')],'resourceId':_0x5a9697['id'],'type':_0x4a7be0['name'],'sectionId':_0x4a7be0['id']},{})[_0x7b7e('0x26')](function(){return _0x1f9d0f;});}else{return _0x1f9d0f;}})[_0x7b7e('0x49')](function(_0x16c81d){logger[_0x7b7e('0x29')](_0x7b7e('0x53'),_0x16c81d);throw _0x16c81d;});}return _0x1f9d0f;})[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,0xc9))[_0x7b7e('0x49')](handleError(_0x58e4e6,null));};exports['update']=function(_0xbf044d,_0x3ff731){if(_0xbf044d[_0x7b7e('0x4b')]['id']){delete _0xbf044d[_0x7b7e('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0xbf044d['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3ff731,null))[_0x7b7e('0x26')](saveUpdates(_0xbf044d[_0x7b7e('0x4b')],null))['then'](respondWithResult(_0x3ff731,null))['catch'](handleError(_0x3ff731,null));};exports[_0x7b7e('0x28')]=function(_0x39efb5,_0x4fecf7){return db[_0x7b7e('0x2d')][_0x7b7e('0x48')]({'where':{'id':_0x39efb5[_0x7b7e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fecf7,null))[_0x7b7e('0x26')](removeEntity(_0x4fecf7,null))[_0x7b7e('0x49')](handleError(_0x4fecf7,null));};exports['getMessages']=function(_0x25c933,_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x2d')][_0x7b7e('0x54')]({'where':{'id':_0x25c933[_0x7b7e('0x41')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x26')](function(_0x45fff9){var _0x5509ad;var _0x29d0af={},_0x20108a={};_0x20108a['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x55')][_0x7b7e('0x43')]);_0x20108a['query']=_[_0x7b7e('0x42')](_0x25c933['query']);_0x20108a[_0x7b7e('0x34')]=_[_0x7b7e('0x44')](_0x20108a['model'],_0x20108a[_0x7b7e('0x33')]);_0x29d0af[_0x7b7e('0x35')]=_['intersection'](_0x20108a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0x29d0af['attributes']=_0x29d0af[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0x29d0af[_0x7b7e('0x35')]:_0x20108a[_0x7b7e('0x31')];if(!_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x29d0af[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x25c933[_0x7b7e('0x33')]['limit']);_0x29d0af[_0x7b7e('0x1d')]=qs['offset'](_0x25c933['query'][_0x7b7e('0x1d')]);}_0x29d0af[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x25c933[_0x7b7e('0x33')]['sort']);_0x29d0af[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x25c933[_0x7b7e('0x33')],_0x20108a[_0x7b7e('0x34')]));if(_0x25c933[_0x7b7e('0x33')]['filter']){_0x29d0af[_0x7b7e('0x3c')]=_['merge'](_0x29d0af['where'],{'$or':_[_0x7b7e('0x32')](_0x29d0af['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x4a2378;})});}_0x29d0af['where']=_[_0x7b7e('0x47')](_0x29d0af[_0x7b7e('0x3c')],{'mailboxuser':_0x45fff9['mailbox']});_0x29d0af=_[_0x7b7e('0x47')]({},_0x29d0af,_0x25c933[_0x7b7e('0x3f')]);return db[_0x7b7e('0x55')][_0x7b7e('0x56')](_0x29d0af)[_0x7b7e('0x26')](respondWithFilteredResult(_0x441c3c,_0x29d0af));})[_0x7b7e('0x49')](handleError(_0x441c3c,null));}; \ No newline at end of file +var _0x4024=['limit','count','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x46cc04,_0x5a6bef){var _0x400c05=function(_0x885527){while(--_0x885527){_0x46cc04['push'](_0x46cc04['shift']());}};_0x400c05(++_0x5a6bef);}(_0x4024,0x89));var _0x4402=function(_0x5d28c3,_0x565bb0){_0x5d28c3=_0x5d28c3-0x0;var _0x4d0956=_0x4024[_0x5d28c3];return _0x4d0956;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){var _0x4d6846=_0x289a3e[_0x4402('0x21')]({'plain':!![]});var _0x4e1c04=_0x4402('0x22');return db[_0x4402('0x23')][_0x4402('0x20')]({'where':{'type':_0x4e1c04,'resourceId':_0x4d6846['id']}})[_0x4402('0x1f')](function(){return _0x289a3e;});})['then'](function(){_0x258d10[_0x4402('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d52f,_0x1be54d){return function(_0x395e49){if(!_0x395e49){_0x59d52f[_0x4402('0x13')](0x194);}return _0x395e49;};}function handleError(_0xabf61b,_0x3eb796){_0x3eb796=_0x3eb796||0x1f4;return function(_0x514e41){logger[_0x4402('0x24')](_0x514e41['stack']);if(_0x514e41[_0x4402('0x25')]){delete _0x514e41[_0x4402('0x25')];}_0xabf61b[_0x4402('0x14')](_0x3eb796)['send'](_0x514e41);};}exports[_0x4402('0x26')]=function(_0x6c87f6,_0x316239){var _0x3f4bcb={},_0x2526d1={},_0x605702={'count':0x0,'rows':[]};var _0x1189b8=_[_0x4402('0x27')](db[_0x4402('0x28')][_0x4402('0x29')],function(_0xcea26b){return{'name':_0xcea26b['fieldName'],'type':_0xcea26b[_0x4402('0x2a')]['key']};});_0x2526d1[_0x4402('0x2b')]=_['map'](_0x1189b8,_0x4402('0x25'));_0x2526d1[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x6c87f6[_0x4402('0x2c')]);_0x2526d1[_0x4402('0x2e')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],_0x2526d1[_0x4402('0x2c')]);_0x3f4bcb[_0x4402('0x2f')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x6c87f6['query'][_0x4402('0x30')]));_0x3f4bcb[_0x4402('0x2f')]=_0x3f4bcb[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f4bcb[_0x4402('0x2f')]:_0x2526d1[_0x4402('0x2b')];if(!_0x6c87f6[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3f4bcb['limit']=qs[_0x4402('0x19')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x19')]);_0x3f4bcb['offset']=qs[_0x4402('0x17')](_0x6c87f6[_0x4402('0x2c')]['offset']);}_0x3f4bcb['order']=qs[_0x4402('0x34')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x34')]);_0x3f4bcb[_0x4402('0x35')]=qs['filters'](_['pick'](_0x6c87f6['query'],_0x2526d1[_0x4402('0x2e')]),_0x1189b8);if(_0x6c87f6[_0x4402('0x2c')][_0x4402('0x36')]){_0x3f4bcb[_0x4402('0x35')]=_['merge'](_0x3f4bcb[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x1189b8,function(_0x35f877){if(_0x35f877['type']!==_0x4402('0x37')){var _0x5aca7b={};_0x5aca7b[_0x35f877[_0x4402('0x25')]]={'$like':'%'+_0x6c87f6[_0x4402('0x2c')]['filter']+'%'};return _0x5aca7b;}})});}_0x3f4bcb=_[_0x4402('0x38')]({},_0x3f4bcb,_0x6c87f6['options']);var _0x423628={'where':_0x3f4bcb[_0x4402('0x35')]};return db['VoiceMail'][_0x4402('0x1a')](_0x423628)[_0x4402('0x1f')](function(_0x250f09){_0x605702[_0x4402('0x1a')]=_0x250f09;if(_0x6c87f6['query']['includeAll']){_0x3f4bcb[_0x4402('0x39')]=[{'all':!![]}];}return db['VoiceMail'][_0x4402('0x3a')](_0x3f4bcb);})[_0x4402('0x1f')](function(_0xb9cf85){_0x605702[_0x4402('0x3b')]=_0xb9cf85;return _0x605702;})[_0x4402('0x1f')](respondWithFilteredResult(_0x316239,_0x3f4bcb))[_0x4402('0x3c')](handleError(_0x316239,null));};exports[_0x4402('0x3d')]=function(_0x390169,_0x1f9b3e){var _0x42812b={'raw':!![],'where':{'id':_0x390169[_0x4402('0x3e')]['id']}},_0x486e43={};_0x486e43[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x28')][_0x4402('0x29')]);_0x486e43['query']=_[_0x4402('0x2d')](_0x390169[_0x4402('0x2c')]);_0x486e43[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],_0x486e43['query']);_0x42812b[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x390169[_0x4402('0x2c')][_0x4402('0x30')]));_0x42812b[_0x4402('0x2f')]=_0x42812b[_0x4402('0x2f')][_0x4402('0x31')]?_0x42812b[_0x4402('0x2f')]:_0x486e43[_0x4402('0x2b')];if(_0x390169['query'][_0x4402('0x40')]){_0x42812b['include']=[{'all':!![]}];}_0x42812b=_[_0x4402('0x38')]({},_0x42812b,_0x390169[_0x4402('0x41')]);return db['VoiceMail'][_0x4402('0x42')](_0x42812b)[_0x4402('0x1f')](handleEntityNotFound(_0x1f9b3e,null))[_0x4402('0x1f')](respondWithResult(_0x1f9b3e,null))[_0x4402('0x3c')](handleError(_0x1f9b3e,null));};exports[_0x4402('0x43')]=function(_0x2503eb,_0x5b094b){return db[_0x4402('0x28')][_0x4402('0x43')](_0x2503eb[_0x4402('0x44')],{})[_0x4402('0x1f')](function(_0x2b2ed3){var _0x24d51c=_0x2503eb[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0x24d51c)throw new Error(_0x4402('0x46'));if(_0x24d51c['role']==='user'){var _0x5ab12b=_0x2b2ed3['get']({'plain':!![]});var _0x257010=_0x4402('0x22');return db[_0x4402('0x47')][_0x4402('0x42')]({'where':{'name':_0x257010,'userProfileId':_0x24d51c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x12d6de){if(_0x12d6de&&_0x12d6de[_0x4402('0x48')]===0x0){return db[_0x4402('0x23')][_0x4402('0x43')]({'name':_0x5ab12b[_0x4402('0x25')],'resourceId':_0x5ab12b['id'],'type':_0x12d6de[_0x4402('0x25')],'sectionId':_0x12d6de['id']},{})['then'](function(){return _0x2b2ed3;});}else{return _0x2b2ed3;}})[_0x4402('0x3c')](function(_0x2a8085){logger[_0x4402('0x24')](_0x4402('0x49'),_0x2a8085);throw _0x2a8085;});}return _0x2b2ed3;})[_0x4402('0x1f')](respondWithResult(_0x5b094b,0xc9))[_0x4402('0x3c')](handleError(_0x5b094b,null));};exports['update']=function(_0xe8a8e9,_0x642ab4){if(_0xe8a8e9[_0x4402('0x44')]['id']){delete _0xe8a8e9[_0x4402('0x44')]['id'];}return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0xe8a8e9[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x642ab4,null))['then'](saveUpdates(_0xe8a8e9[_0x4402('0x44')],null))[_0x4402('0x1f')](respondWithResult(_0x642ab4,null))[_0x4402('0x3c')](handleError(_0x642ab4,null));};exports['destroy']=function(_0x5a076a,_0x258926){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x5a076a[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x258926,null))[_0x4402('0x1f')](removeEntity(_0x258926,null))[_0x4402('0x3c')](handleError(_0x258926,null));};exports[_0x4402('0x4a')]=function(_0x394ac9,_0x3f2599,_0x353679){return db[_0x4402('0x28')][_0x4402('0x4b')]({'where':{'id':_0x394ac9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3f2599,null))['then'](function(_0xe4530a){var _0x55922e;var _0x3fb9f0={},_0x1e5891={};_0x1e5891[_0x4402('0x2b')]=_[_0x4402('0x2d')](db[_0x4402('0x4c')][_0x4402('0x29')]);_0x1e5891['query']=_[_0x4402('0x2d')](_0x394ac9[_0x4402('0x2c')]);_0x1e5891[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],_0x1e5891['query']);_0x3fb9f0[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x394ac9[_0x4402('0x2c')][_0x4402('0x30')]));_0x3fb9f0[_0x4402('0x2f')]=_0x3fb9f0[_0x4402('0x2f')]['length']?_0x3fb9f0[_0x4402('0x2f')]:_0x1e5891[_0x4402('0x2b')];if(!_0x394ac9['query'][_0x4402('0x32')](_0x4402('0x33'))){_0x3fb9f0['limit']=qs['limit'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x19')]);_0x3fb9f0[_0x4402('0x17')]=qs['offset'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x17')]);}_0x3fb9f0[_0x4402('0x4d')]=qs['sort'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x34')]);_0x3fb9f0[_0x4402('0x35')]=qs['filters'](_[_0x4402('0x4e')](_0x394ac9[_0x4402('0x2c')],_0x1e5891['filters']));if(_0x394ac9['query'][_0x4402('0x36')]){_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'$or':_['map'](_0x3fb9f0['attributes'],function(_0x432c2e){var _0x42cdd6={};_0x42cdd6[_0x432c2e]={'$like':'%'+_0x394ac9[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x42cdd6;})});}_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'mailboxuser':_0xe4530a[_0x4402('0x4f')]});_0x3fb9f0=_[_0x4402('0x38')]({},_0x3fb9f0,_0x394ac9[_0x4402('0x41')]);return db[_0x4402('0x4c')][_0x4402('0x50')](_0x3fb9f0)['then'](respondWithFilteredResult(_0x3f2599,_0x3fb9f0));})[_0x4402('0x3c')](handleError(_0x3f2599,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d2f6d56..3d97606 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 _0x05c2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','VoiceMail','voice_voicemail','mailbox','context'];(function(_0x34b3bb,_0x531597){var _0x430797=function(_0x3a1c6c){while(--_0x3a1c6c){_0x34b3bb['push'](_0x34b3bb['shift']());}};_0x430797(++_0x531597);}(_0x05c2,0x186));var _0x205c=function(_0x1dc985,_0x5914c3){_0x1dc985=_0x1dc985-0x0;var _0x30ebf6=_0x05c2[_0x1dc985];return _0x30ebf6;};'use strict';var _=require(_0x205c('0x0'));var util=require(_0x205c('0x1'));var logger=require(_0x205c('0x2'))(_0x205c('0x3'));var moment=require(_0x205c('0x4'));var BPromise=require(_0x205c('0x5'));var rp=require(_0x205c('0x6'));var fs=require('fs');var path=require(_0x205c('0x7'));var rimraf=require('rimraf');var config=require(_0x205c('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x2b6538,_0x510a03){return _0x2b6538['define'](_0x205c('0x9'),attributes,{'tableName':_0x205c('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x205c('0xb'),_0x205c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc360=['moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','lodash','util','api'];(function(_0x556c31,_0x27f18a){var _0x954887=function(_0x58be32){while(--_0x58be32){_0x556c31['push'](_0x556c31['shift']());}};_0x954887(++_0x27f18a);}(_0xc360,0x1d1));var _0x0c36=function(_0x5bb8e0,_0x3f4030){_0x5bb8e0=_0x5bb8e0-0x0;var _0x254f79=_0xc360[_0x5bb8e0];return _0x254f79;};'use strict';var _=require(_0x0c36('0x0'));var util=require(_0x0c36('0x1'));var logger=require('../../config/logger')(_0x0c36('0x2'));var moment=require(_0x0c36('0x3'));var BPromise=require(_0x0c36('0x4'));var rp=require(_0x0c36('0x5'));var fs=require('fs');var path=require(_0x0c36('0x6'));var rimraf=require(_0x0c36('0x7'));var config=require('../../config/environment');var attributes=require(_0x0c36('0x8'));module['exports']=function(_0x335c7,_0x5a3f99){return _0x335c7['define'](_0x0c36('0x9'),attributes,{'tableName':_0x0c36('0xa'),'paranoid':![],'indexes':[{'name':_0x0c36('0xb'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ad75817..fc30e85 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 _0x59e9=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x59e9,0x9e));var _0x959e=function(_0x1a5c1f,_0x5e8b15){_0x1a5c1f=_0x1a5c1f-0x0;var _0x3da623=_0x59e9[_0x1a5c1f];return _0x3da623;};'use strict';var _=require(_0x959e('0x0'));var util=require('util');var moment=require(_0x959e('0x1'));var BPromise=require(_0x959e('0x2'));var rs=require(_0x959e('0x3'));var fs=require('fs');var Redis=require(_0x959e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x959e('0x5'));var logger=require(_0x959e('0x6'))(_0x959e('0x7'));var config=require(_0x959e('0x8'));var jayson=require(_0x959e('0x9'));var client=jayson['client'][_0x959e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278f23,_0x167757,_0x18d451){return new BPromise(function(_0x189b1f,_0x94cb7a){return client[_0x959e('0xb')](_0x278f23,_0x18d451)[_0x959e('0xc')](function(_0x48b096){logger['info'](_0x959e('0xd'),_0x167757,_0x959e('0xe'));logger[_0x959e('0xf')](_0x959e('0x10'),_0x167757,_0x959e('0xe'),JSON[_0x959e('0x11')](_0x48b096));if(_0x48b096['error']){if(_0x48b096[_0x959e('0x12')][_0x959e('0x13')]===0x1f4){logger[_0x959e('0x12')](_0x959e('0xd'),_0x167757,_0x48b096[_0x959e('0x12')][_0x959e('0x14')]);return _0x94cb7a(_0x48b096[_0x959e('0x12')]['message']);}logger[_0x959e('0x12')]('VoiceMail,\x20%s,\x20%s',_0x167757,_0x48b096['error']['message']);return _0x189b1f(_0x48b096[_0x959e('0x12')][_0x959e('0x14')]);}else{logger['info'](_0x959e('0xd'),_0x167757,_0x959e('0xe'));_0x189b1f(_0x48b096[_0x959e('0x15')][_0x959e('0x14')]);}})[_0x959e('0x16')](function(_0x11acc1){logger[_0x959e('0x12')](_0x959e('0xd'),_0x167757,_0x11acc1);_0x94cb7a(_0x11acc1);});});} \ No newline at end of file +var _0xc52d=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x18d43d,_0x6e2ee2){var _0x1b41d6=function(_0x5bcae6){while(--_0x5bcae6){_0x18d43d['push'](_0x18d43d['shift']());}};_0x1b41d6(++_0x6e2ee2);}(_0xc52d,0xf0));var _0xdc52=function(_0x523e59,_0x473b60){_0x523e59=_0x523e59-0x0;var _0x3c69a3=_0xc52d[_0x523e59];return _0x3c69a3;};'use strict';var _=require('lodash');var util=require(_0xdc52('0x0'));var moment=require(_0xdc52('0x1'));var BPromise=require(_0xdc52('0x2'));var rs=require(_0xdc52('0x3'));var fs=require('fs');var Redis=require(_0xdc52('0x4'));var db=require(_0xdc52('0x5'))['db'];var utils=require(_0xdc52('0x6'));var logger=require(_0xdc52('0x7'))(_0xdc52('0x8'));var config=require(_0xdc52('0x9'));var jayson=require(_0xdc52('0xa'));var client=jayson['client'][_0xdc52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566c72,_0x33759a,_0x1ea26b){return new BPromise(function(_0x2f04f7,_0x43a265){return client[_0xdc52('0xc')](_0x566c72,_0x1ea26b)[_0xdc52('0xd')](function(_0x242993){logger[_0xdc52('0xe')](_0xdc52('0xf'),_0x33759a,_0xdc52('0x10'));logger[_0xdc52('0x11')](_0xdc52('0x12'),_0x33759a,_0xdc52('0x10'),JSON['stringify'](_0x242993));if(_0x242993['error']){if(_0x242993['error'][_0xdc52('0x13')]===0x1f4){logger[_0xdc52('0x14')](_0xdc52('0xf'),_0x33759a,_0x242993[_0xdc52('0x14')][_0xdc52('0x15')]);return _0x43a265(_0x242993[_0xdc52('0x14')][_0xdc52('0x15')]);}logger[_0xdc52('0x14')](_0xdc52('0xf'),_0x33759a,_0x242993[_0xdc52('0x14')]['message']);return _0x2f04f7(_0x242993['error'][_0xdc52('0x15')]);}else{logger[_0xdc52('0xe')]('VoiceMail,\x20%s,\x20%s',_0x33759a,'request\x20sent');_0x2f04f7(_0x242993['result'][_0xdc52('0x15')]);}})[_0xdc52('0x16')](function(_0x3327be){logger[_0xdc52('0x14')]('VoiceMail,\x20%s,\x20%s',_0x33759a,_0x3327be);_0x43a265(_0x3327be);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 710b9a0..aa82b6e 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 _0x4380=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','download','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x1ea538,_0x3030f0){var _0x127e1d=function(_0x3ccbe9){while(--_0x3ccbe9){_0x1ea538['push'](_0x1ea538['shift']());}};_0x127e1d(++_0x3030f0);}(_0x4380,0x67));var _0x0438=function(_0x5e9aca,_0x1bfeeb){_0x5e9aca=_0x5e9aca-0x0;var _0x22b7c2=_0x4380[_0x5e9aca];return _0x22b7c2;};'use strict';var multer=require(_0x0438('0x0'));var util=require(_0x0438('0x1'));var path=require(_0x0438('0x2'));var timeout=require(_0x0438('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0438('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0438('0x5'));var config=require(_0x0438('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x0438('0x7')]('/',auth['isAuthenticated'](),controller[_0x0438('0x8')]);router[_0x0438('0x7')](_0x0438('0x9'),auth[_0x0438('0xa')](),controller[_0x0438('0xb')]);router['get']('/:id/download',auth[_0x0438('0xa')](),controller[_0x0438('0xc')]);router[_0x0438('0xd')]('/',auth[_0x0438('0xa')](),controller[_0x0438('0xe')]);router[_0x0438('0xf')](_0x0438('0x9'),auth[_0x0438('0xa')](),controller['update']);router[_0x0438('0x10')](_0x0438('0x9'),auth[_0x0438('0xa')](),controller[_0x0438('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5298=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','download','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2725df,_0x53c5e6){var _0xc586e9=function(_0x3d5a7d){while(--_0x3d5a7d){_0x2725df['push'](_0x2725df['shift']());}};_0xc586e9(++_0x53c5e6);}(_0x5298,0x14c));var _0x8529=function(_0x30c5d2,_0x264486){_0x30c5d2=_0x30c5d2-0x0;var _0x2969a6=_0x5298[_0x30c5d2];return _0x2969a6;};'use strict';var multer=require('multer');var util=require(_0x8529('0x0'));var path=require(_0x8529('0x1'));var timeout=require(_0x8529('0x2'));var express=require(_0x8529('0x3'));var router=express['Router']();var fs_extra=require(_0x8529('0x4'));var auth=require(_0x8529('0x5'));var interaction=require(_0x8529('0x6'));var config=require(_0x8529('0x7'));var controller=require(_0x8529('0x8'));router[_0x8529('0x9')]('/',auth[_0x8529('0xa')](),controller[_0x8529('0xb')]);router[_0x8529('0x9')](_0x8529('0xc'),auth[_0x8529('0xa')](),controller['show']);router[_0x8529('0x9')]('/:id/download',auth[_0x8529('0xa')](),controller[_0x8529('0xd')]);router[_0x8529('0xe')]('/',auth[_0x8529('0xa')](),controller[_0x8529('0xf')]);router[_0x8529('0x10')](_0x8529('0xc'),auth['isAuthenticated'](),controller[_0x8529('0x11')]);router[_0x8529('0x12')](_0x8529('0xc'),auth['isAuthenticated'](),controller[_0x8529('0x13')]);module[_0x8529('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9f0eb50..fd17d1d 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 _0x306b=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0xb3a2c0,_0x3ed55f){var _0x5d90c2=function(_0x71a1ca){while(--_0x71a1ca){_0xb3a2c0['push'](_0xb3a2c0['shift']());}};_0x5d90c2(++_0x3ed55f);}(_0x306b,0x84));var _0xb306=function(_0x329c16,_0x23a5e1){_0x329c16=_0x329c16-0x0;var _0x54d505=_0x306b[_0x329c16];return _0x54d505;};'use strict';var Sequelize=require(_0xb306('0x0'));module[_0xb306('0x1')]={'name':{'type':Sequelize[_0xb306('0x2')],'get':function(_0x9d55dd){return this[_0xb306('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb306('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xb306('0x6')](_0xb306('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb306('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xb306('0x8')](_0xb306('0x9'))}}; \ No newline at end of file +var _0x52b4=['INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x196d67,_0x433a72){var _0x4141d9=function(_0x5ba395){while(--_0x5ba395){_0x196d67['push'](_0x196d67['shift']());}};_0x4141d9(++_0x433a72);}(_0x52b4,0x6a));var _0x452b=function(_0x16196f,_0x5e240f){_0x16196f=_0x16196f-0x0;var _0xb220b9=_0x52b4[_0x16196f];return _0xb220b9;};'use strict';var Sequelize=require(_0x452b('0x0'));module[_0x452b('0x1')]={'name':{'type':Sequelize[_0x452b('0x2')],'get':function(_0x133170){return this[_0x452b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x452b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x452b('0x6')](_0x452b('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x452b('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x452b('0x8')](_0x452b('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e2a959e..e2aca40 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 _0x0d76=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1c443a,_0xecb71b){var _0x55a347=function(_0x349634){while(--_0x349634){_0x1c443a['push'](_0x1c443a['shift']());}};_0x55a347(++_0xecb71b);}(_0x0d76,0x96));var _0x60d7=function(_0x31379c,_0x52f29f){_0x31379c=_0x31379c-0x0;var _0x2ff709=_0x0d76[_0x31379c];return _0x2ff709;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60d7('0x1'));var rp=require('request-promise');var moment=require(_0x60d7('0x2'));var BPromise=require(_0x60d7('0x3'));var Mustache=require(_0x60d7('0x4'));var util=require('util');var path=require(_0x60d7('0x5'));var sox=require('sox');var csv=require(_0x60d7('0x6'));var ejs=require(_0x60d7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60d7('0x8'));var squel=require(_0x60d7('0x9'));var crypto=require(_0x60d7('0xa'));var jsforce=require(_0x60d7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x60d7('0xc'));var Papa=require(_0x60d7('0xd'));var Redis=require(_0x60d7('0xe'));var authService=require(_0x60d7('0xf'));var qs=require(_0x60d7('0x10'));var as=require(_0x60d7('0x11'));var hardwareService=require(_0x60d7('0x12'));var logger=require(_0x60d7('0x13'))('api');var utils=require(_0x60d7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x60d7('0x15'));var db=require(_0x60d7('0x16'))['db'];function respondWithStatusCode(_0x36958c,_0x1b6ac4){_0x1b6ac4=_0x1b6ac4||0xcc;return function(_0x2fc272){if(_0x2fc272){return _0x36958c[_0x60d7('0x17')](_0x1b6ac4);}return _0x36958c['status'](_0x1b6ac4)[_0x60d7('0x18')]();};}function respondWithResult(_0x111838,_0x100002){_0x100002=_0x100002||0xc8;return function(_0x104c31){if(_0x104c31){return _0x111838[_0x60d7('0x19')](_0x100002)[_0x60d7('0x1a')](_0x104c31);}};}function respondWithFilteredResult(_0x41b76f,_0x579a51){return function(_0x3b5705){if(_0x3b5705){var _0x16d99d=typeof _0x579a51[_0x60d7('0x1b')]===_0x60d7('0x1c')&&typeof _0x579a51[_0x60d7('0x1d')]===_0x60d7('0x1c');var _0x36068f=_0x3b5705[_0x60d7('0x1e')];var _0x9f541f=_0x16d99d?0x0:_0x579a51['offset'];var _0x2533fd=_0x16d99d?_0x3b5705[_0x60d7('0x1e')]:_0x579a51[_0x60d7('0x1b')]+_0x579a51['limit'];var _0x56594c;if(_0x2533fd>=_0x36068f){_0x2533fd=_0x36068f;_0x56594c=0xc8;}else{_0x56594c=0xce;}_0x41b76f[_0x60d7('0x19')](_0x56594c);return _0x41b76f[_0x60d7('0x1f')](_0x60d7('0x20'),_0x9f541f+'-'+_0x2533fd+'/'+_0x36068f)['json'](_0x3b5705);}return null;};}function patchUpdates(_0x32346a){return function(_0x52321f){try{jsonpatch[_0x60d7('0x21')](_0x52321f,_0x32346a,!![]);}catch(_0x4f0dcd){return BPromise[_0x60d7('0x22')](_0x4f0dcd);}return _0x52321f['save']();};}function saveUpdates(_0x500696,_0x6da0eb){return function(_0x43d34d){if(_0x43d34d){return _0x43d34d[_0x60d7('0x23')](_0x500696)[_0x60d7('0x24')](function(_0x4fa3de){return _0x4fa3de;});}return null;};}function removeEntity(_0x461b59,_0x1bc91e){return function(_0x520af2){if(_0x520af2){return _0x520af2[_0x60d7('0x25')]()['then'](function(){_0x461b59[_0x60d7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2ee26,_0x5405a0){return function(_0x34cf79){if(!_0x34cf79){_0xd2ee26[_0x60d7('0x17')](0x194);}return _0x34cf79;};}function handleError(_0x4b8fc0,_0xc60209){_0xc60209=_0xc60209||0x1f4;return function(_0x1ab0f0){logger[_0x60d7('0x26')](_0x1ab0f0[_0x60d7('0x27')]);if(_0x1ab0f0[_0x60d7('0x28')]){delete _0x1ab0f0[_0x60d7('0x28')];}_0x4b8fc0[_0x60d7('0x19')](_0xc60209)[_0x60d7('0x29')](_0x1ab0f0);};}exports[_0x60d7('0x2a')]=function(_0x36a144,_0x2239f7){var _0x34b5e3={},_0x2884b6={},_0x977e7e={'count':0x0,'rows':[]};var _0x2ae39d=_['map'](db[_0x60d7('0x2b')]['rawAttributes'],function(_0x58e48d){return{'name':_0x58e48d[_0x60d7('0x2c')],'type':_0x58e48d['type'][_0x60d7('0x2d')]};});_0x2884b6[_0x60d7('0x2e')]=_[_0x60d7('0x2f')](_[_0x60d7('0x30')](_0x2ae39d,_0x60d7('0x28')),['name']);_0x2884b6[_0x60d7('0x31')]=_[_0x60d7('0x32')](_0x36a144[_0x60d7('0x31')]);_0x2884b6[_0x60d7('0x33')]=_[_0x60d7('0x34')](_0x2884b6['model'],_0x2884b6[_0x60d7('0x31')]);_0x34b5e3[_0x60d7('0x35')]=_['intersection'](_0x2884b6[_0x60d7('0x2e')],qs[_0x60d7('0x36')](_0x36a144['query'][_0x60d7('0x36')]));_0x34b5e3['attributes']=_0x34b5e3[_0x60d7('0x35')]['length']?_0x34b5e3[_0x60d7('0x35')]:_0x2884b6[_0x60d7('0x2e')];if(!_0x36a144['query'][_0x60d7('0x37')]('nolimit')){_0x34b5e3[_0x60d7('0x1d')]=qs[_0x60d7('0x1d')](_0x36a144[_0x60d7('0x31')]['limit']);_0x34b5e3[_0x60d7('0x1b')]=qs[_0x60d7('0x1b')](_0x36a144['query'][_0x60d7('0x1b')]);}_0x34b5e3[_0x60d7('0x38')]=qs[_0x60d7('0x39')](_0x36a144['query']['sort']);_0x34b5e3[_0x60d7('0x3a')]=qs[_0x60d7('0x33')](_[_0x60d7('0x3b')](_0x36a144['query'],_0x2884b6[_0x60d7('0x33')]),_0x2ae39d);if(_0x36a144[_0x60d7('0x31')][_0x60d7('0x3c')]){_0x34b5e3[_0x60d7('0x3a')]=_[_0x60d7('0x3d')](_0x34b5e3['where'],{'$or':_[_0x60d7('0x30')](_0x2ae39d,function(_0x28a21f){if(_0x28a21f[_0x60d7('0x3e')]!=='VIRTUAL'){var _0x44e2c4={};_0x44e2c4[_0x28a21f[_0x60d7('0x28')]]={'$like':'%'+_0x36a144[_0x60d7('0x31')][_0x60d7('0x3c')]+'%'};return _0x44e2c4;}})});}_0x34b5e3=_[_0x60d7('0x3d')]({},_0x34b5e3,_0x36a144[_0x60d7('0x3f')]);var _0x3fb10b={'where':_0x34b5e3['where']};return db[_0x60d7('0x2b')][_0x60d7('0x1e')](_0x3fb10b)[_0x60d7('0x24')](function(_0x1fecbc){_0x977e7e['count']=_0x1fecbc;if(_0x36a144[_0x60d7('0x31')][_0x60d7('0x40')]){_0x34b5e3[_0x60d7('0x41')]=[{'all':!![]}];}return db[_0x60d7('0x2b')]['findAll'](_0x34b5e3);})[_0x60d7('0x24')](function(_0x10a77a){_0x977e7e[_0x60d7('0x42')]=_0x10a77a;return _0x977e7e;})[_0x60d7('0x24')](respondWithFilteredResult(_0x2239f7,_0x34b5e3))[_0x60d7('0x43')](handleError(_0x2239f7,null));};exports[_0x60d7('0x44')]=function(_0x4a131e,_0x95f328){var _0x42ccaa={'raw':!![],'where':{'id':_0x4a131e[_0x60d7('0x45')]['id']}},_0x1988d1={};_0x1988d1[_0x60d7('0x2e')]=_['keys'](db[_0x60d7('0x2b')][_0x60d7('0x46')]);_0x1988d1[_0x60d7('0x31')]=_['keys'](_0x4a131e[_0x60d7('0x31')]);_0x1988d1['filters']=_['intersection'](_0x1988d1['model'],_0x1988d1[_0x60d7('0x31')]);_0x42ccaa[_0x60d7('0x35')]=_[_0x60d7('0x34')](_0x1988d1[_0x60d7('0x2e')],qs[_0x60d7('0x36')](_0x4a131e[_0x60d7('0x31')][_0x60d7('0x36')]));_0x42ccaa[_0x60d7('0x35')]=_0x42ccaa[_0x60d7('0x35')][_0x60d7('0x47')]?_0x42ccaa[_0x60d7('0x35')]:_0x1988d1['model'];if(_0x4a131e[_0x60d7('0x31')][_0x60d7('0x40')]){_0x42ccaa[_0x60d7('0x41')]=[{'all':!![]}];}_0x42ccaa=_[_0x60d7('0x3d')]({},_0x42ccaa,_0x4a131e[_0x60d7('0x3f')]);return db['VoiceMailMessage'][_0x60d7('0x48')](_0x42ccaa)['then'](handleEntityNotFound(_0x95f328,null))[_0x60d7('0x24')](respondWithResult(_0x95f328,null))[_0x60d7('0x43')](handleError(_0x95f328,null));};exports[_0x60d7('0x49')]=function(_0x1da9a2,_0x4b6ac1){return db['VoiceMailMessage'][_0x60d7('0x49')](_0x1da9a2[_0x60d7('0x4a')],{})['then'](respondWithResult(_0x4b6ac1,0xc9))[_0x60d7('0x43')](handleError(_0x4b6ac1,null));};exports[_0x60d7('0x23')]=function(_0x460fba,_0x4f3ce9){if(_0x460fba['body']['id']){delete _0x460fba['body']['id'];}return db[_0x60d7('0x2b')]['find']({'where':{'id':_0x460fba['params']['id']}})[_0x60d7('0x24')](handleEntityNotFound(_0x4f3ce9,null))['then'](saveUpdates(_0x460fba['body'],null))['then'](respondWithResult(_0x4f3ce9,null))[_0x60d7('0x43')](handleError(_0x4f3ce9,null));};exports[_0x60d7('0x25')]=function(_0x54b86c,_0x5f2bc0){return db[_0x60d7('0x2b')][_0x60d7('0x48')]({'where':{'id':_0x54b86c[_0x60d7('0x45')]['id']}})[_0x60d7('0x24')](handleEntityNotFound(_0x5f2bc0,null))[_0x60d7('0x24')](removeEntity(_0x5f2bc0,null))[_0x60d7('0x43')](handleError(_0x5f2bc0,null));};exports[_0x60d7('0x4b')]=function(_0x5141cd,_0x565ae3,_0x549736){return db['VoiceMailMessage'][_0x60d7('0x48')]({'where':{'id':_0x5141cd['params']['id']},'attributes':['id',_0x60d7('0x4c'),_0x60d7('0x4d')]})[_0x60d7('0x24')](handleEntityNotFound(_0x565ae3,null))[_0x60d7('0x24')](function(_0x45b79c){if(_0x45b79c){if(!_0x45b79c[_0x60d7('0x4c')]){throw new db['Sequelize'][(_0x60d7('0x4e'))](_0x60d7('0x4f'));}var _0x2d493d={'Content-Type':_0x60d7('0x50'),'Content-Disposition':_0x60d7('0x51')};if(_0x45b79c[_0x60d7('0x4d')]){_0x2d493d[_0x60d7('0x52')]=_0x60d7('0x53')+_0x45b79c['msg_id']+_0x60d7('0x54');}_0x565ae3['set'](_0x2d493d);return _0x565ae3['send'](new Buffer(_0x45b79c[_0x60d7('0x4c')]));}})[_0x60d7('0x43')](handleError(_0x565ae3,null));}; \ No newline at end of file +var _0x233b=['attachment;\x20filename=\x22','msg_id','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','download','recording','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x233b,0xa9));var _0xb233=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x233b[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xb233('0x0'));var rimraf=require(_0xb233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb233('0x2'));var moment=require(_0xb233('0x3'));var BPromise=require(_0xb233('0x4'));var Mustache=require(_0xb233('0x5'));var util=require(_0xb233('0x6'));var path=require('path');var sox=require(_0xb233('0x7'));var csv=require(_0xb233('0x8'));var ejs=require(_0xb233('0x9'));var fs=require('fs');var fs_extra=require(_0xb233('0xa'));var _=require(_0xb233('0xb'));var squel=require('squel');var crypto=require(_0xb233('0xc'));var jsforce=require(_0xb233('0xd'));var deskjs=require(_0xb233('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb233('0xf'));var qs=require(_0xb233('0x10'));var as=require(_0xb233('0x11'));var hardwareService=require(_0xb233('0x12'));var logger=require('../../config/logger')(_0xb233('0x13'));var utils=require(_0xb233('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb233('0x15'))['db'];function respondWithStatusCode(_0x2edc41,_0x35c6d9){_0x35c6d9=_0x35c6d9||0xcc;return function(_0x4cf5ff){if(_0x4cf5ff){return _0x2edc41[_0xb233('0x16')](_0x35c6d9);}return _0x2edc41[_0xb233('0x17')](_0x35c6d9)[_0xb233('0x18')]();};}function respondWithResult(_0x10a0d7,_0x19c271){_0x19c271=_0x19c271||0xc8;return function(_0x45da21){if(_0x45da21){return _0x10a0d7[_0xb233('0x17')](_0x19c271)[_0xb233('0x19')](_0x45da21);}};}function respondWithFilteredResult(_0x26f4e3,_0xea92ae){return function(_0x5d2f85){if(_0x5d2f85){var _0x2406a0=typeof _0xea92ae[_0xb233('0x1a')]===_0xb233('0x1b')&&typeof _0xea92ae[_0xb233('0x1c')]===_0xb233('0x1b');var _0x15e34c=_0x5d2f85[_0xb233('0x1d')];var _0x1ff01f=_0x2406a0?0x0:_0xea92ae[_0xb233('0x1a')];var _0x155a5e=_0x2406a0?_0x5d2f85[_0xb233('0x1d')]:_0xea92ae[_0xb233('0x1a')]+_0xea92ae['limit'];var _0x362bb4;if(_0x155a5e>=_0x15e34c){_0x155a5e=_0x15e34c;_0x362bb4=0xc8;}else{_0x362bb4=0xce;}_0x26f4e3[_0xb233('0x17')](_0x362bb4);return _0x26f4e3[_0xb233('0x1e')](_0xb233('0x1f'),_0x1ff01f+'-'+_0x155a5e+'/'+_0x15e34c)[_0xb233('0x19')](_0x5d2f85);}return null;};}function patchUpdates(_0xf6ab57){return function(_0x9f4f20){try{jsonpatch[_0xb233('0x20')](_0x9f4f20,_0xf6ab57,!![]);}catch(_0x20023d){return BPromise[_0xb233('0x21')](_0x20023d);}return _0x9f4f20[_0xb233('0x22')]();};}function saveUpdates(_0x469ee9,_0x2ebd8b){return function(_0x281751){if(_0x281751){return _0x281751[_0xb233('0x23')](_0x469ee9)['then'](function(_0x366a07){return _0x366a07;});}return null;};}function removeEntity(_0x4560de,_0x5df986){return function(_0xd7c612){if(_0xd7c612){return _0xd7c612[_0xb233('0x24')]()[_0xb233('0x25')](function(){_0x4560de['status'](0xcc)[_0xb233('0x18')]();});}};}function handleEntityNotFound(_0x5d1588,_0x2485c0){return function(_0x4050a){if(!_0x4050a){_0x5d1588[_0xb233('0x16')](0x194);}return _0x4050a;};}function handleError(_0x474532,_0x332f8e){_0x332f8e=_0x332f8e||0x1f4;return function(_0x7079e3){logger[_0xb233('0x26')](_0x7079e3[_0xb233('0x27')]);if(_0x7079e3[_0xb233('0x28')]){delete _0x7079e3[_0xb233('0x28')];}_0x474532[_0xb233('0x17')](_0x332f8e)[_0xb233('0x29')](_0x7079e3);};}exports[_0xb233('0x2a')]=function(_0x5cdd58,_0x415eeb){var _0x220145={},_0x180893={},_0x44aabf={'count':0x0,'rows':[]};var _0x47a615=_[_0xb233('0x2b')](db[_0xb233('0x2c')][_0xb233('0x2d')],function(_0x19989b){return{'name':_0x19989b['fieldName'],'type':_0x19989b[_0xb233('0x2e')][_0xb233('0x2f')]};});_0x180893[_0xb233('0x30')]=_['differenceBy'](_[_0xb233('0x2b')](_0x47a615,'name'),[_0xb233('0x28')]);_0x180893['query']=_['keys'](_0x5cdd58[_0xb233('0x31')]);_0x180893[_0xb233('0x32')]=_[_0xb233('0x33')](_0x180893[_0xb233('0x30')],_0x180893[_0xb233('0x31')]);_0x220145[_0xb233('0x34')]=_[_0xb233('0x33')](_0x180893[_0xb233('0x30')],qs[_0xb233('0x35')](_0x5cdd58['query'][_0xb233('0x35')]));_0x220145[_0xb233('0x34')]=_0x220145[_0xb233('0x34')][_0xb233('0x36')]?_0x220145['attributes']:_0x180893[_0xb233('0x30')];if(!_0x5cdd58[_0xb233('0x31')][_0xb233('0x37')]('nolimit')){_0x220145['limit']=qs[_0xb233('0x1c')](_0x5cdd58[_0xb233('0x31')]['limit']);_0x220145[_0xb233('0x1a')]=qs[_0xb233('0x1a')](_0x5cdd58['query'][_0xb233('0x1a')]);}_0x220145[_0xb233('0x38')]=qs[_0xb233('0x39')](_0x5cdd58[_0xb233('0x31')][_0xb233('0x39')]);_0x220145[_0xb233('0x3a')]=qs[_0xb233('0x32')](_[_0xb233('0x3b')](_0x5cdd58[_0xb233('0x31')],_0x180893[_0xb233('0x32')]),_0x47a615);if(_0x5cdd58[_0xb233('0x31')][_0xb233('0x3c')]){_0x220145['where']=_[_0xb233('0x3d')](_0x220145['where'],{'$or':_[_0xb233('0x2b')](_0x47a615,function(_0x29a5f9){if(_0x29a5f9[_0xb233('0x2e')]!==_0xb233('0x3e')){var _0x1d6b22={};_0x1d6b22[_0x29a5f9['name']]={'$like':'%'+_0x5cdd58[_0xb233('0x31')][_0xb233('0x3c')]+'%'};return _0x1d6b22;}})});}_0x220145=_[_0xb233('0x3d')]({},_0x220145,_0x5cdd58[_0xb233('0x3f')]);var _0x1c4cc5={'where':_0x220145[_0xb233('0x3a')]};return db['VoiceMailMessage']['count'](_0x1c4cc5)[_0xb233('0x25')](function(_0x1c85d9){_0x44aabf[_0xb233('0x1d')]=_0x1c85d9;if(_0x5cdd58['query'][_0xb233('0x40')]){_0x220145[_0xb233('0x41')]=[{'all':!![]}];}return db[_0xb233('0x2c')][_0xb233('0x42')](_0x220145);})[_0xb233('0x25')](function(_0x5d373c){_0x44aabf[_0xb233('0x43')]=_0x5d373c;return _0x44aabf;})[_0xb233('0x25')](respondWithFilteredResult(_0x415eeb,_0x220145))[_0xb233('0x44')](handleError(_0x415eeb,null));};exports[_0xb233('0x45')]=function(_0xb37443,_0x180082){var _0x150a1f={'raw':!![],'where':{'id':_0xb37443[_0xb233('0x46')]['id']}},_0x1c1d08={};_0x1c1d08[_0xb233('0x30')]=_[_0xb233('0x47')](db['VoiceMailMessage'][_0xb233('0x2d')]);_0x1c1d08[_0xb233('0x31')]=_[_0xb233('0x47')](_0xb37443[_0xb233('0x31')]);_0x1c1d08[_0xb233('0x32')]=_[_0xb233('0x33')](_0x1c1d08[_0xb233('0x30')],_0x1c1d08[_0xb233('0x31')]);_0x150a1f[_0xb233('0x34')]=_[_0xb233('0x33')](_0x1c1d08[_0xb233('0x30')],qs[_0xb233('0x35')](_0xb37443['query']['fields']));_0x150a1f[_0xb233('0x34')]=_0x150a1f[_0xb233('0x34')][_0xb233('0x36')]?_0x150a1f[_0xb233('0x34')]:_0x1c1d08[_0xb233('0x30')];if(_0xb37443[_0xb233('0x31')][_0xb233('0x40')]){_0x150a1f['include']=[{'all':!![]}];}_0x150a1f=_[_0xb233('0x3d')]({},_0x150a1f,_0xb37443[_0xb233('0x3f')]);return db[_0xb233('0x2c')]['find'](_0x150a1f)[_0xb233('0x25')](handleEntityNotFound(_0x180082,null))[_0xb233('0x25')](respondWithResult(_0x180082,null))[_0xb233('0x44')](handleError(_0x180082,null));};exports[_0xb233('0x48')]=function(_0x11a18e,_0x495d8c){return db['VoiceMailMessage'][_0xb233('0x48')](_0x11a18e[_0xb233('0x49')],{})[_0xb233('0x25')](respondWithResult(_0x495d8c,0xc9))['catch'](handleError(_0x495d8c,null));};exports[_0xb233('0x23')]=function(_0x47a9c3,_0x5b400c){if(_0x47a9c3[_0xb233('0x49')]['id']){delete _0x47a9c3[_0xb233('0x49')]['id'];}return db['VoiceMailMessage'][_0xb233('0x4a')]({'where':{'id':_0x47a9c3['params']['id']}})['then'](handleEntityNotFound(_0x5b400c,null))[_0xb233('0x25')](saveUpdates(_0x47a9c3['body'],null))[_0xb233('0x25')](respondWithResult(_0x5b400c,null))[_0xb233('0x44')](handleError(_0x5b400c,null));};exports[_0xb233('0x24')]=function(_0x1262c3,_0x4b7a5c){return db[_0xb233('0x2c')][_0xb233('0x4a')]({'where':{'id':_0x1262c3[_0xb233('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b7a5c,null))[_0xb233('0x25')](removeEntity(_0x4b7a5c,null))[_0xb233('0x44')](handleError(_0x4b7a5c,null));};exports[_0xb233('0x4b')]=function(_0x54efd5,_0x5c99ae,_0x3ba6d9){return db['VoiceMailMessage'][_0xb233('0x4a')]({'where':{'id':_0x54efd5[_0xb233('0x46')]['id']},'attributes':['id',_0xb233('0x4c'),'msg_id']})[_0xb233('0x25')](handleEntityNotFound(_0x5c99ae,null))[_0xb233('0x25')](function(_0x58e9f9){if(_0x58e9f9){if(!_0x58e9f9[_0xb233('0x4c')]){throw new db['Sequelize']['ValidationError'](_0xb233('0x4d'));}var _0x27426c={'Content-Type':'audio/wav','Content-Disposition':_0xb233('0x4e')};if(_0x58e9f9['msg_id']){_0x27426c[_0xb233('0x4f')]=_0xb233('0x50')+_0x58e9f9[_0xb233('0x51')]+_0xb233('0x52');}_0x5c99ae['set'](_0x27426c);return _0x5c99ae['send'](new Buffer(_0x58e9f9['recording']));}})['catch'](handleError(_0x5c99ae,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 94f3e28..0587aaa 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 _0x9c15=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash'];(function(_0x4b6042,_0x33edf2){var _0x25bb10=function(_0x243c2c){while(--_0x243c2c){_0x4b6042['push'](_0x4b6042['shift']());}};_0x25bb10(++_0x33edf2);}(_0x9c15,0x11d));var _0x59c1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9c15[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x59c1('0x0'));var util=require(_0x59c1('0x1'));var logger=require(_0x59c1('0x2'))(_0x59c1('0x3'));var moment=require(_0x59c1('0x4'));var BPromise=require(_0x59c1('0x5'));var rp=require(_0x59c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59c1('0x7'));var config=require(_0x59c1('0x8'));var attributes=require(_0x59c1('0x9'));module['exports']=function(_0x5b144c,_0x575908){return _0x5b144c[_0x59c1('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x59c1('0xb'),'paranoid':![],'indexes':[{'name':_0x59c1('0xc'),'fields':[_0x59c1('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x187f=['bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x187f,0xdc));var _0xf187=function(_0x27a204,_0x32d832){_0x27a204=_0x27a204-0x0;var _0x39d686=_0x187f[_0x27a204];return _0x39d686;};'use strict';var _=require(_0xf187('0x0'));var util=require(_0xf187('0x1'));var logger=require(_0xf187('0x2'))('api');var moment=require(_0xf187('0x3'));var BPromise=require(_0xf187('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf187('0x5'));var rimraf=require(_0xf187('0x6'));var config=require(_0xf187('0x7'));var attributes=require(_0xf187('0x8'));module[_0xf187('0x9')]=function(_0x3afc25,_0x46d8eb){return _0x3afc25[_0xf187('0xa')](_0xf187('0xb'),attributes,{'tableName':_0xf187('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xf187('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ad50679..3f7b4e8 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 _0x47a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x47a5,0x1d0));var _0x547a=function(_0x54e8f1,_0x4f0751){_0x54e8f1=_0x54e8f1-0x0;var _0xca216f=_0x47a5[_0x54e8f1];return _0xca216f;};'use strict';var _=require(_0x547a('0x0'));var util=require(_0x547a('0x1'));var moment=require('moment');var BPromise=require(_0x547a('0x2'));var rs=require(_0x547a('0x3'));var fs=require('fs');var Redis=require(_0x547a('0x4'));var db=require(_0x547a('0x5'))['db'];var utils=require(_0x547a('0x6'));var logger=require(_0x547a('0x7'))(_0x547a('0x8'));var config=require(_0x547a('0x9'));var jayson=require(_0x547a('0xa'));var client=jayson[_0x547a('0xb')][_0x547a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x146c08,_0x221c8d,_0x54203e){return new BPromise(function(_0x5a75b1,_0x4aa231){return client[_0x547a('0xd')](_0x146c08,_0x54203e)[_0x547a('0xe')](function(_0x2d650a){logger[_0x547a('0xf')](_0x547a('0x10'),_0x221c8d,_0x547a('0x11'));logger[_0x547a('0x12')](_0x547a('0x13'),_0x221c8d,'request\x20sent',JSON[_0x547a('0x14')](_0x2d650a));if(_0x2d650a[_0x547a('0x15')]){if(_0x2d650a['error'][_0x547a('0x16')]===0x1f4){logger[_0x547a('0x15')](_0x547a('0x10'),_0x221c8d,_0x2d650a[_0x547a('0x15')][_0x547a('0x17')]);return _0x4aa231(_0x2d650a['error'][_0x547a('0x17')]);}logger[_0x547a('0x15')](_0x547a('0x10'),_0x221c8d,_0x2d650a[_0x547a('0x15')]['message']);return _0x5a75b1(_0x2d650a['error'][_0x547a('0x17')]);}else{logger[_0x547a('0xf')](_0x547a('0x10'),_0x221c8d,_0x547a('0x11'));_0x5a75b1(_0x2d650a[_0x547a('0x18')][_0x547a('0x17')]);}})[_0x547a('0x19')](function(_0x253b40){logger[_0x547a('0x15')](_0x547a('0x10'),_0x221c8d,_0x253b40);_0x4aa231(_0x253b40);});});} \ No newline at end of file +var _0xcb8a=['ioredis','../../mysqldb','../../config/environment','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xc3d4f7,_0x378bd7){var _0x3a4e7b=function(_0x4af732){while(--_0x4af732){_0xc3d4f7['push'](_0xc3d4f7['shift']());}};_0x3a4e7b(++_0x378bd7);}(_0xcb8a,0x103));var _0xacb8=function(_0x1944ea,_0x4cdd1b){_0x1944ea=_0x1944ea-0x0;var _0x36cc12=_0xcb8a[_0x1944ea];return _0x36cc12;};'use strict';var _=require(_0xacb8('0x0'));var util=require(_0xacb8('0x1'));var moment=require(_0xacb8('0x2'));var BPromise=require(_0xacb8('0x3'));var rs=require(_0xacb8('0x4'));var fs=require('fs');var Redis=require(_0xacb8('0x5'));var db=require(_0xacb8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacb8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xacb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x563b73,_0x4f9cc9,_0x5221f2){return new BPromise(function(_0x582707,_0x55583e){return client[_0xacb8('0x9')](_0x563b73,_0x5221f2)[_0xacb8('0xa')](function(_0x20d874){logger[_0xacb8('0xb')](_0xacb8('0xc'),_0x4f9cc9,'request\x20sent');logger[_0xacb8('0xd')](_0xacb8('0xe'),_0x4f9cc9,_0xacb8('0xf'),JSON[_0xacb8('0x10')](_0x20d874));if(_0x20d874[_0xacb8('0x11')]){if(_0x20d874[_0xacb8('0x11')][_0xacb8('0x12')]===0x1f4){logger['error'](_0xacb8('0xc'),_0x4f9cc9,_0x20d874[_0xacb8('0x11')][_0xacb8('0x13')]);return _0x55583e(_0x20d874['error'][_0xacb8('0x13')]);}logger[_0xacb8('0x11')](_0xacb8('0xc'),_0x4f9cc9,_0x20d874[_0xacb8('0x11')][_0xacb8('0x13')]);return _0x582707(_0x20d874[_0xacb8('0x11')][_0xacb8('0x13')]);}else{logger[_0xacb8('0xb')](_0xacb8('0xc'),_0x4f9cc9,'request\x20sent');_0x582707(_0x20d874[_0xacb8('0x14')][_0xacb8('0x13')]);}})[_0xacb8('0x15')](function(_0x2227b3){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4f9cc9,_0x2227b3);_0x55583e(_0x2227b3);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4ad2e33..92c8d20 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 _0x6899=['update','destroy','delete','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','create','post','addSound','put'];(function(_0x422890,_0x434494){var _0x202cf0=function(_0x10e9f0){while(--_0x10e9f0){_0x422890['push'](_0x422890['shift']());}};_0x202cf0(++_0x434494);}(_0x6899,0x1cd));var _0x9689=function(_0x4577b5,_0x306a8f){_0x4577b5=_0x4577b5-0x0;var _0x2d7596=_0x6899[_0x4577b5];return _0x2d7596;};'use strict';var multer=require(_0x9689('0x0'));var util=require(_0x9689('0x1'));var path=require('path');var timeout=require(_0x9689('0x2'));var express=require(_0x9689('0x3'));var router=express[_0x9689('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9689('0x5'));var interaction=require(_0x9689('0x6'));var config=require(_0x9689('0x7'));var controller=require(_0x9689('0x8'));router[_0x9689('0x9')]('/',auth[_0x9689('0xa')](),controller[_0x9689('0xb')]);router['get'](_0x9689('0xc'),auth[_0x9689('0xa')](),controller['show']);router['get'](_0x9689('0xd'),auth[_0x9689('0xa')](),controller[_0x9689('0xe')]);router['post']('/',auth[_0x9689('0xa')](),controller[_0x9689('0xf')]);router[_0x9689('0x10')](_0x9689('0xd'),auth[_0x9689('0xa')](),controller[_0x9689('0x11')]);router[_0x9689('0x12')](_0x9689('0xc'),auth[_0x9689('0xa')](),controller[_0x9689('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9689('0x14')]);router[_0x9689('0x15')](_0x9689('0x16'),auth[_0x9689('0xa')](),controller['removeSound']);module[_0x9689('0x17')]=router; \ No newline at end of file +var _0xf26b=['/:id/sounds','getSounds','post','create','put','update','destroy','delete','/:id/sounds/:id2','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0xf26b,0x163));var _0xbf26=function(_0x390657,_0x158f6d){_0x390657=_0x390657-0x0;var _0x25c86f=_0xf26b[_0x390657];return _0x25c86f;};'use strict';var multer=require(_0xbf26('0x0'));var util=require('util');var path=require(_0xbf26('0x1'));var timeout=require(_0xbf26('0x2'));var express=require(_0xbf26('0x3'));var router=express['Router']();var fs_extra=require(_0xbf26('0x4'));var auth=require(_0xbf26('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf26('0x6'));var controller=require(_0xbf26('0x7'));router['get']('/',auth[_0xbf26('0x8')](),controller[_0xbf26('0x9')]);router[_0xbf26('0xa')](_0xbf26('0xb'),auth[_0xbf26('0x8')](),controller[_0xbf26('0xc')]);router['get'](_0xbf26('0xd'),auth[_0xbf26('0x8')](),controller[_0xbf26('0xe')]);router[_0xbf26('0xf')]('/',auth['isAuthenticated'](),controller[_0xbf26('0x10')]);router[_0xbf26('0xf')](_0xbf26('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0xbf26('0x11')]('/:id',auth[_0xbf26('0x8')](),controller[_0xbf26('0x12')]);router['delete'](_0xbf26('0xb'),auth[_0xbf26('0x8')](),controller[_0xbf26('0x13')]);router[_0xbf26('0x14')](_0xbf26('0x15'),auth[_0xbf26('0x8')](),controller['removeSound']);module[_0xbf26('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 e4cf3f0..9915f7e 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 _0x97bf=['exports','ENUM','files','quietmp3nb','quietmp3','STRING','TIMESTAMP','sequelize'];(function(_0x43e7c4,_0x24fb15){var _0x4685d9=function(_0x223a94){while(--_0x223a94){_0x43e7c4['push'](_0x43e7c4['shift']());}};_0x4685d9(++_0x24fb15);}(_0x97bf,0x1b7));var _0xf97b=function(_0x5966ef,_0x5bdaef){_0x5966ef=_0x5966ef-0x0;var _0x313b0b=_0x97bf[_0x5966ef];return _0x313b0b;};'use strict';var Sequelize=require(_0xf97b('0x0'));module[_0xf97b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf97b('0x2')]('custom',_0xf97b('0x3'),'mp3nb',_0xf97b('0x4'),_0xf97b('0x5'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xf97b('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0xf97b('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf97b('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf97b('0x6')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf97b('0x6')],'allowNull':!![]},'stamp':{'type':_0xf97b('0x7')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc7be=['quietmp3nb','quietmp3','alpha','BOOLEAN','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x158db9,_0x5a075f){var _0x2cd4ba=function(_0x372d8a){while(--_0x372d8a){_0x158db9['push'](_0x158db9['shift']());}};_0x2cd4ba(++_0x5a075f);}(_0xc7be,0x158));var _0xec7b=function(_0x4b3f08,_0x1706f9){_0x4b3f08=_0x4b3f08-0x0;var _0x4a5d59=_0xc7be[_0x4b3f08];return _0x4a5d59;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec7b('0x0')],'allowNull':![],'unique':_0xec7b('0x1')},'mode':{'type':Sequelize[_0xec7b('0x2')](_0xec7b('0x3'),_0xec7b('0x4'),_0xec7b('0x5'),_0xec7b('0x6'),_0xec7b('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xec7b('0x4')},'directory':{'type':Sequelize[_0xec7b('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xec7b('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xec7b('0x0')],'allowNull':!![],'defaultValue':_0xec7b('0x8')},'format':{'type':Sequelize[_0xec7b('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xec7b('0x9')],'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 d4aa691..8a5dc29 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 _0x51aa=['format','extname','symlinkSync','removeSound','id2','createdAt','%s.%s','getSounds','Sound','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','attributes','body','find','sequelize','files','join','root','server/files/moh','create','mode','directory','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','server/files/sounds/converted'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0x51aa,0x166));var _0xa51a=function(_0x1ea3bd,_0x506c52){_0x1ea3bd=_0x1ea3bd-0x0;var _0x47787f=_0x51aa[_0x1ea3bd];return _0x47787f;};'use strict';var emlformat=require(_0xa51a('0x0'));var rimraf=require(_0xa51a('0x1'));var zipdir=require(_0xa51a('0x2'));var jsonpatch=require(_0xa51a('0x3'));var rp=require(_0xa51a('0x4'));var moment=require(_0xa51a('0x5'));var BPromise=require(_0xa51a('0x6'));var Mustache=require('mustache');var util=require(_0xa51a('0x7'));var path=require(_0xa51a('0x8'));var sox=require(_0xa51a('0x9'));var csv=require(_0xa51a('0xa'));var ejs=require(_0xa51a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa51a('0xc'));var squel=require(_0xa51a('0xd'));var crypto=require('crypto');var jsforce=require(_0xa51a('0xe'));var deskjs=require(_0xa51a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa51a('0x10'));var Redis=require(_0xa51a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa51a('0x12'));var as=require(_0xa51a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa51a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa51a('0x15'));var licenseUtil=require(_0xa51a('0x16'));var db=require(_0xa51a('0x17'))['db'];function respondWithStatusCode(_0x264bcb,_0x5f2578){_0x5f2578=_0x5f2578||0xcc;return function(_0x2dbdb9){if(_0x2dbdb9){return _0x264bcb[_0xa51a('0x18')](_0x5f2578);}return _0x264bcb['status'](_0x5f2578)[_0xa51a('0x19')]();};}function respondWithResult(_0x2b511d,_0x43f579){_0x43f579=_0x43f579||0xc8;return function(_0x367cfe){if(_0x367cfe){return _0x2b511d[_0xa51a('0x1a')](_0x43f579)['json'](_0x367cfe);}};}function respondWithFilteredResult(_0x3706c4,_0x24b8fc){return function(_0x460c88){if(_0x460c88){var _0x4bfdb1=typeof _0x24b8fc[_0xa51a('0x1b')]==='undefined'&&typeof _0x24b8fc[_0xa51a('0x1c')]===_0xa51a('0x1d');var _0x362494=_0x460c88[_0xa51a('0x1e')];var _0x40dc5d=_0x4bfdb1?0x0:_0x24b8fc['offset'];var _0x2502b9=_0x4bfdb1?_0x460c88[_0xa51a('0x1e')]:_0x24b8fc['offset']+_0x24b8fc[_0xa51a('0x1c')];var _0x2aa940;if(_0x2502b9>=_0x362494){_0x2502b9=_0x362494;_0x2aa940=0xc8;}else{_0x2aa940=0xce;}_0x3706c4[_0xa51a('0x1a')](_0x2aa940);return _0x3706c4[_0xa51a('0x1f')](_0xa51a('0x20'),_0x40dc5d+'-'+_0x2502b9+'/'+_0x362494)[_0xa51a('0x21')](_0x460c88);}return null;};}function patchUpdates(_0x49f06c){return function(_0x40ed0f){try{jsonpatch[_0xa51a('0x22')](_0x40ed0f,_0x49f06c,!![]);}catch(_0x2e037e){return BPromise[_0xa51a('0x23')](_0x2e037e);}return _0x40ed0f[_0xa51a('0x24')]();};}function saveUpdates(_0x307c3c,_0x4e19ca){return function(_0x4c8bb9){if(_0x4c8bb9){return _0x4c8bb9[_0xa51a('0x25')](_0x307c3c)['then'](function(_0x2d2a82){return _0x2d2a82;});}return null;};}function removeEntity(_0x469a58,_0x59f874){return function(_0x4d0c87){if(_0x4d0c87){return _0x4d0c87[_0xa51a('0x26')]()[_0xa51a('0x27')](function(){var _0x43bbc7=_0x4d0c87[_0xa51a('0x28')]({'plain':!![]});var _0x447421=_0xa51a('0x29');return db['UserProfileResource'][_0xa51a('0x26')]({'where':{'type':_0x447421,'resourceId':_0x43bbc7['id']}})[_0xa51a('0x27')](function(){return _0x4d0c87;});})[_0xa51a('0x27')](function(){_0x469a58[_0xa51a('0x1a')](0xcc)[_0xa51a('0x19')]();});}};}function handleEntityNotFound(_0x5307c0,_0x2016eb){return function(_0x518c3f){if(!_0x518c3f){_0x5307c0[_0xa51a('0x18')](0x194);}return _0x518c3f;};}function handleError(_0x8aa4a8,_0x18b8c5){_0x18b8c5=_0x18b8c5||0x1f4;return function(_0x36ac34){logger[_0xa51a('0x2a')](_0x36ac34[_0xa51a('0x2b')]);if(_0x36ac34[_0xa51a('0x2c')]){delete _0x36ac34['name'];}_0x8aa4a8[_0xa51a('0x1a')](_0x18b8c5)[_0xa51a('0x2d')](_0x36ac34);};}exports[_0xa51a('0x2e')]=function(_0x5eb97b,_0x4418f1){var _0x5c15a={},_0x4147b1={},_0x7add51={'count':0x0,'rows':[]};var _0x41dc3f=_[_0xa51a('0x2f')](db[_0xa51a('0x30')][_0xa51a('0x31')],function(_0x372827){return{'name':_0x372827[_0xa51a('0x32')],'type':_0x372827[_0xa51a('0x33')][_0xa51a('0x34')]};});_0x4147b1['model']=_[_0xa51a('0x2f')](_0x41dc3f,_0xa51a('0x2c'));_0x4147b1['query']=_[_0xa51a('0x35')](_0x5eb97b['query']);_0x4147b1[_0xa51a('0x36')]=_[_0xa51a('0x37')](_0x4147b1[_0xa51a('0x38')],_0x4147b1[_0xa51a('0x39')]);_0x5c15a['attributes']=_[_0xa51a('0x37')](_0x4147b1['model'],qs[_0xa51a('0x3a')](_0x5eb97b['query']['fields']));_0x5c15a['attributes']=_0x5c15a['attributes'][_0xa51a('0x3b')]?_0x5c15a['attributes']:_0x4147b1[_0xa51a('0x38')];if(!_0x5eb97b['query'][_0xa51a('0x3c')](_0xa51a('0x3d'))){_0x5c15a[_0xa51a('0x1c')]=qs['limit'](_0x5eb97b[_0xa51a('0x39')]['limit']);_0x5c15a[_0xa51a('0x1b')]=qs['offset'](_0x5eb97b[_0xa51a('0x39')][_0xa51a('0x1b')]);}_0x5c15a[_0xa51a('0x3e')]=qs[_0xa51a('0x3f')](_0x5eb97b[_0xa51a('0x39')][_0xa51a('0x3f')]);delete _0x5eb97b[_0xa51a('0x39')]['sort'];_0x5c15a[_0xa51a('0x40')]=qs[_0xa51a('0x36')](_['pick'](_0x5eb97b[_0xa51a('0x39')],_0x4147b1[_0xa51a('0x36')]),_0x41dc3f);if(_0x5eb97b[_0xa51a('0x39')][_0xa51a('0x41')]){_0x5c15a[_0xa51a('0x40')]=_[_0xa51a('0x42')](_0x5c15a[_0xa51a('0x40')],{'$or':_[_0xa51a('0x2f')](_0x41dc3f,function(_0x3b2be1){if(_0x3b2be1[_0xa51a('0x33')]!==_0xa51a('0x43')){var _0x1782f2={};_0x1782f2[_0x3b2be1[_0xa51a('0x2c')]]={'$like':'%'+_0x5eb97b['query'][_0xa51a('0x41')]+'%'};return _0x1782f2;}})});}_0x5c15a=_[_0xa51a('0x42')]({},_0x5c15a,_0x5eb97b[_0xa51a('0x44')]);var _0x4f1d1d={'where':_0x5c15a['where']};return db['VoiceMusicOnHold']['count'](_0x4f1d1d)[_0xa51a('0x27')](function(_0x574434){_0x7add51[_0xa51a('0x1e')]=_0x574434;if(_0x5eb97b[_0xa51a('0x39')][_0xa51a('0x45')]){_0x5c15a[_0xa51a('0x46')]=[{'all':!![]}];}return db[_0xa51a('0x30')][_0xa51a('0x47')](_0x5c15a);})[_0xa51a('0x27')](function(_0x15accf){_0x7add51[_0xa51a('0x48')]=_0x15accf;return _0x7add51;})[_0xa51a('0x27')](respondWithFilteredResult(_0x4418f1,_0x5c15a))[_0xa51a('0x49')](handleError(_0x4418f1,null));};exports['show']=function(_0x211ffe,_0x148f61){var _0x63c30a={'raw':![],'where':{'id':_0x211ffe[_0xa51a('0x4a')]['id']}},_0x50b332={};_0x50b332[_0xa51a('0x38')]=_['keys'](db[_0xa51a('0x30')][_0xa51a('0x31')]);_0x50b332['query']=_[_0xa51a('0x35')](_0x211ffe['query']);_0x50b332[_0xa51a('0x36')]=_['intersection'](_0x50b332[_0xa51a('0x38')],_0x50b332[_0xa51a('0x39')]);_0x63c30a[_0xa51a('0x4b')]=_[_0xa51a('0x37')](_0x50b332[_0xa51a('0x38')],qs[_0xa51a('0x3a')](_0x211ffe['query'][_0xa51a('0x3a')]));_0x63c30a[_0xa51a('0x4b')]=_0x63c30a['attributes']['length']?_0x63c30a[_0xa51a('0x4b')]:_0x50b332['model'];if(_0x211ffe[_0xa51a('0x39')]['includeAll']){_0x63c30a[_0xa51a('0x46')]=[{'all':!![]}];}_0x63c30a=_[_0xa51a('0x42')]({},_0x63c30a,_0x211ffe[_0xa51a('0x44')]);return db['VoiceMusicOnHold']['find'](_0x63c30a)[_0xa51a('0x27')](handleEntityNotFound(_0x148f61,null))[_0xa51a('0x27')](respondWithResult(_0x148f61,null))[_0xa51a('0x49')](handleError(_0x148f61,null));};exports[_0xa51a('0x25')]=function(_0x9bbc13,_0x21901d){if(_0x9bbc13['body']['id']){delete _0x9bbc13[_0xa51a('0x4c')]['id'];}return db['VoiceMusicOnHold'][_0xa51a('0x4d')]({'where':{'id':_0x9bbc13['params']['id']}})[_0xa51a('0x27')](handleEntityNotFound(_0x21901d,null))[_0xa51a('0x27')](saveUpdates(_0x9bbc13[_0xa51a('0x4c')],null))[_0xa51a('0x27')](respondWithResult(_0x21901d,null))[_0xa51a('0x49')](handleError(_0x21901d,null));};exports['create']=function(_0x1b8487,_0xa41127,_0x2c894f){return db[_0xa51a('0x4e')]['transaction'](function(_0x53e382){if(_0x1b8487[_0xa51a('0x4c')]['mode']===_0xa51a('0x4f')){_0x1b8487[_0xa51a('0x4c')]['directory']=path[_0xa51a('0x50')](config[_0xa51a('0x51')],_0xa51a('0x52'),_0x1b8487[_0xa51a('0x4c')]['name']);}return db[_0xa51a('0x30')][_0xa51a('0x53')](_0x1b8487[_0xa51a('0x4c')],{'transaction':_0x53e382})[_0xa51a('0x27')](function(_0x16750b){if(_0x1b8487[_0xa51a('0x4c')][_0xa51a('0x54')]==='files'){fs['mkdirSync'](_0x16750b[_0xa51a('0x55')],parseInt('0777',0x8));}var _0x591aa8=_0x1b8487['user'][_0xa51a('0x28')]({'plain':!![]});if(!_0x591aa8)throw new Error(_0xa51a('0x56'));if(_0x591aa8[_0xa51a('0x57')]===_0xa51a('0x58')){var _0x44b3b5=_0x16750b[_0xa51a('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xa51a('0x4d')]({'where':{'name':_0xa51a('0x29'),'userProfileId':_0x591aa8[_0xa51a('0x59')]},'raw':!![]})['then'](function(_0x3f7763){if(_0x3f7763&&_0x3f7763[_0xa51a('0x5a')]===0x0){return db[_0xa51a('0x5b')][_0xa51a('0x53')]({'name':_0x44b3b5[_0xa51a('0x2c')],'resourceId':_0x44b3b5['id'],'type':_0x3f7763[_0xa51a('0x2c')],'sectionId':_0x3f7763['id']},{})['then'](function(){return _0x16750b;});}else{return _0x16750b;}})[_0xa51a('0x49')](function(_0x1f5224){logger[_0xa51a('0x2a')](_0xa51a('0x5c'),_0x1f5224);});}return _0x16750b;});})['then'](respondWithResult(_0xa41127,0xc9))[_0xa51a('0x49')](handleError(_0xa41127,null));};exports[_0xa51a('0x26')]=function(_0x408b84,_0x55b2ae,_0x40bfc2){var _0x5dcef9;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x408b84[_0xa51a('0x4a')]['id']}})[_0xa51a('0x27')](function(_0x40f402){if(_0x40f402){return db[_0xa51a('0x4e')][_0xa51a('0x5d')](function(_0x258016){return _0x40f402[_0xa51a('0x26')]({'transaction':_0x258016,'raw':!![]})[_0xa51a('0x27')](function(_0x33b22){if(_0x33b22[_0xa51a('0x55')]){fs[_0xa51a('0x5e')](_0x33b22['directory'])[_0xa51a('0x5f')](function(_0x5befe8){fs[_0xa51a('0x60')](path[_0xa51a('0x50')](_0x33b22[_0xa51a('0x55')],_0x5befe8));});fs[_0xa51a('0x61')](_0x33b22['directory']);}return _0x33b22;});})[_0xa51a('0x49')](function(_0x5eadcd){throw new db[(_0xa51a('0x62'))][(_0xa51a('0x63'))](_0x5eadcd[_0xa51a('0x64')]);});}})[_0xa51a('0x27')](handleEntityNotFound(_0x55b2ae,null))[_0xa51a('0x27')](removeEntity(_0x55b2ae,null))[_0xa51a('0x49')](handleError(_0x55b2ae,null));};exports['addSound']=function(_0x530e85,_0x522850,_0x55187e){return db[_0xa51a('0x4e')][_0xa51a('0x5d')](function(_0x18361c){var _0x595a67;return db[_0xa51a('0x30')][_0xa51a('0x4d')]({'where':{'id':_0x530e85[_0xa51a('0x4a')]['id']}})[_0xa51a('0x27')](function(_0x41254c){if(_0x41254c){_0x595a67=_0x41254c;return _0x41254c[_0xa51a('0x65')](_0x530e85[_0xa51a('0x4c')]['id'],{'transaction':_0x18361c});}})[_0xa51a('0x27')](function(_0x3c67be){if(_0x3c67be){return db['Sound'][_0xa51a('0x66')]({'where':{'id':_0x530e85[_0xa51a('0x4c')]['id']},'attributes':['id',_0xa51a('0x2c'),_0xa51a('0x67'),_0xa51a('0x68'),'createdAt'],'raw':!![]});}})[_0xa51a('0x27')](function(_0x328fd9){if(_0x328fd9){var _0x22c335=path[_0xa51a('0x50')](config['root'],_0xa51a('0x69'),util[_0xa51a('0x6a')]('%s.%s',path['basename'](_0x328fd9['save_name'],path[_0xa51a('0x6b')](_0x328fd9[_0xa51a('0x67')])),_0x328fd9[_0xa51a('0x68')]));var _0x4fefda=path[_0xa51a('0x50')](config[_0xa51a('0x51')],_0xa51a('0x52'),_0x595a67['name'],util['format']('%s.%s',_0x328fd9['name'],_0x328fd9[_0xa51a('0x68')]));fs[_0xa51a('0x6c')](_0x22c335,_0x4fefda);return _0x328fd9;}})['catch'](function(_0x290007){throw new db['Sequelize'][(_0xa51a('0x63'))](_0x290007[_0xa51a('0x64')]);});})[_0xa51a('0x27')](handleEntityNotFound(_0x522850,null))[_0xa51a('0x27')](respondWithResult(_0x522850,0xc9))[_0xa51a('0x49')](handleError(_0x522850,null));};exports['removeSound']=function(_0x2e0621,_0x16ed5b,_0x5a12d4){return db['sequelize'][_0xa51a('0x5d')](function(_0x38b7d1){var _0x4d02cd;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x2e0621[_0xa51a('0x4a')]['id']}})[_0xa51a('0x27')](handleEntityNotFound(_0x16ed5b,null))[_0xa51a('0x27')](function(_0x49fede){if(_0x49fede){_0x4d02cd=_0x49fede;return _0x49fede[_0xa51a('0x6d')](_0x2e0621[_0xa51a('0x4a')][_0xa51a('0x6e')]);}})[_0xa51a('0x27')](function(_0x1ffbc3){if(_0x1ffbc3){return db['Sound'][_0xa51a('0x66')]({'where':{'id':_0x2e0621[_0xa51a('0x4a')][_0xa51a('0x6e')]},'attributes':['id','name',_0xa51a('0x67'),_0xa51a('0x68'),_0xa51a('0x6f')],'raw':!![]});}})['then'](function(_0x586b65){if(_0x586b65){fs[_0xa51a('0x60')](path[_0xa51a('0x50')](_0x4d02cd[_0xa51a('0x55')],util['format'](_0xa51a('0x70'),_0x586b65[_0xa51a('0x2c')],_0x586b65[_0xa51a('0x68')])));return _0x586b65;}})[_0xa51a('0x49')](function(_0x1db716){throw new db[(_0xa51a('0x62'))]['ValidationError'](_0x1db716[_0xa51a('0x64')]);});})[_0xa51a('0x27')](handleEntityNotFound(_0x16ed5b,null))[_0xa51a('0x27')](respondWithStatusCode(_0x16ed5b,0xcc))[_0xa51a('0x49')](handleError(_0x16ed5b,null));};exports[_0xa51a('0x71')]=function(_0x1a1746,_0xd60f5d,_0x4ec163){var _0x36f8f6={};var _0x2eb817={};var _0x59db04;var _0x2b29e9;return db[_0xa51a('0x30')][_0xa51a('0x66')]({'where':{'id':_0x1a1746[_0xa51a('0x4a')]['id']}})[_0xa51a('0x27')](handleEntityNotFound(_0xd60f5d,null))[_0xa51a('0x27')](function(_0x5c2bfb){if(_0x5c2bfb){_0x59db04=_0x5c2bfb;_0x2eb817[_0xa51a('0x38')]=_[_0xa51a('0x35')](db[_0xa51a('0x72')][_0xa51a('0x31')]);_0x2eb817['query']=_[_0xa51a('0x35')](_0x1a1746[_0xa51a('0x39')]);_0x2eb817['filters']=_['intersection'](_0x2eb817[_0xa51a('0x38')],_0x2eb817['query']);_0x36f8f6['attributes']=_[_0xa51a('0x37')](_0x2eb817['model'],qs[_0xa51a('0x3a')](_0x1a1746[_0xa51a('0x39')]['fields']));_0x36f8f6['attributes']=_0x36f8f6['attributes'][_0xa51a('0x3b')]?_0x36f8f6['attributes']:_0x2eb817['model'];_0x36f8f6[_0xa51a('0x3e')]=qs['sort'](_0x1a1746[_0xa51a('0x39')]['sort']);_0x36f8f6[_0xa51a('0x40')]=qs[_0xa51a('0x36')](_[_0xa51a('0x73')](_0x1a1746[_0xa51a('0x39')],_0x2eb817[_0xa51a('0x36')]));if(_0x1a1746[_0xa51a('0x39')][_0xa51a('0x41')]){_0x36f8f6['where']=_[_0xa51a('0x42')](_0x36f8f6[_0xa51a('0x40')],{'$or':_[_0xa51a('0x2f')](_0x36f8f6[_0xa51a('0x4b')],function(_0x21efdf){var _0x30553f={};_0x30553f[_0x21efdf]={'$like':'%'+_0x1a1746['query'][_0xa51a('0x41')]+'%'};return _0x30553f;})});}_0x36f8f6=_[_0xa51a('0x42')]({},_0x36f8f6,_0x1a1746[_0xa51a('0x44')]);return _0x59db04[_0xa51a('0x71')](_0x36f8f6);}})[_0xa51a('0x27')](function(_0x25aa54){if(_0x25aa54){_0x2b29e9=_0x25aa54[_0xa51a('0x3b')];if(!_0x1a1746[_0xa51a('0x39')][_0xa51a('0x3c')](_0xa51a('0x3d'))){_0x36f8f6[_0xa51a('0x1c')]=qs[_0xa51a('0x1c')](_0x1a1746[_0xa51a('0x39')][_0xa51a('0x1c')]);_0x36f8f6[_0xa51a('0x1b')]=qs['offset'](_0x1a1746[_0xa51a('0x39')]['offset']);}return _0x59db04['getSounds'](_0x36f8f6);}})[_0xa51a('0x27')](function(_0xd2fc19){if(_0xd2fc19){return _0xd2fc19?{'count':_0x2b29e9,'rows':_0xd2fc19}:null;}})[_0xa51a('0x27')](respondWithResult(_0xd60f5d,null))[_0xa51a('0x49')](handleError(_0xd60f5d,null));}; \ No newline at end of file +var _0xede4=['show','params','rawAttributes','fields','options','catch','update','body','find','create','sequelize','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','Sequelize','removeSound','id2','Sound','getSounds','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','destroy','get','UserProfileResource','then','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','VoiceMusicOnHold','includeAll','include','findAll'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xede4,0x1f3));var _0x4ede=function(_0x42b121,_0x52e2f0){_0x42b121=_0x42b121-0x0;var _0x320575=_0xede4[_0x42b121];return _0x320575;};'use strict';var emlformat=require(_0x4ede('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ede('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ede('0x2'));var moment=require(_0x4ede('0x3'));var BPromise=require(_0x4ede('0x4'));var Mustache=require(_0x4ede('0x5'));var util=require(_0x4ede('0x6'));var path=require(_0x4ede('0x7'));var sox=require(_0x4ede('0x8'));var csv=require(_0x4ede('0x9'));var ejs=require(_0x4ede('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ede('0xb'));var squel=require(_0x4ede('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4ede('0x9'));var querystring=require('querystring');var Papa=require(_0x4ede('0xd'));var Redis=require(_0x4ede('0xe'));var authService=require(_0x4ede('0xf'));var qs=require(_0x4ede('0x10'));var as=require(_0x4ede('0x11'));var hardwareService=require(_0x4ede('0x12'));var logger=require(_0x4ede('0x13'))(_0x4ede('0x14'));var utils=require(_0x4ede('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ede('0x16'))['db'];function respondWithStatusCode(_0x3e1fc7,_0x5129f5){_0x5129f5=_0x5129f5||0xcc;return function(_0x86ac88){if(_0x86ac88){return _0x3e1fc7[_0x4ede('0x17')](_0x5129f5);}return _0x3e1fc7[_0x4ede('0x18')](_0x5129f5)[_0x4ede('0x19')]();};}function respondWithResult(_0x39e942,_0x24ffce){_0x24ffce=_0x24ffce||0xc8;return function(_0xd4d351){if(_0xd4d351){return _0x39e942[_0x4ede('0x18')](_0x24ffce)[_0x4ede('0x1a')](_0xd4d351);}};}function respondWithFilteredResult(_0x50a5bf,_0x2fb9d9){return function(_0x2dc9c9){if(_0x2dc9c9){var _0x5eba2f=typeof _0x2fb9d9[_0x4ede('0x1b')]==='undefined'&&typeof _0x2fb9d9['limit']===_0x4ede('0x1c');var _0x10d613=_0x2dc9c9[_0x4ede('0x1d')];var _0x1140cf=_0x5eba2f?0x0:_0x2fb9d9[_0x4ede('0x1b')];var _0x4af53a=_0x5eba2f?_0x2dc9c9[_0x4ede('0x1d')]:_0x2fb9d9[_0x4ede('0x1b')]+_0x2fb9d9[_0x4ede('0x1e')];var _0x23e916;if(_0x4af53a>=_0x10d613){_0x4af53a=_0x10d613;_0x23e916=0xc8;}else{_0x23e916=0xce;}_0x50a5bf[_0x4ede('0x18')](_0x23e916);return _0x50a5bf[_0x4ede('0x1f')]('Content-Range',_0x1140cf+'-'+_0x4af53a+'/'+_0x10d613)[_0x4ede('0x1a')](_0x2dc9c9);}return null;};}function patchUpdates(_0x597fbf){return function(_0x1f3e8b){try{jsonpatch[_0x4ede('0x20')](_0x1f3e8b,_0x597fbf,!![]);}catch(_0x226e84){return BPromise[_0x4ede('0x21')](_0x226e84);}return _0x1f3e8b['save']();};}function saveUpdates(_0x24c4c3,_0x48ed08){return function(_0x7059b9){if(_0x7059b9){return _0x7059b9['update'](_0x24c4c3)['then'](function(_0x2e56dd){return _0x2e56dd;});}return null;};}function removeEntity(_0x64ac29,_0x45f68f){return function(_0x510cb5){if(_0x510cb5){return _0x510cb5[_0x4ede('0x22')]()['then'](function(){var _0x141d1c=_0x510cb5[_0x4ede('0x23')]({'plain':!![]});var _0x50fcb7='MusicOnHolds';return db[_0x4ede('0x24')]['destroy']({'where':{'type':_0x50fcb7,'resourceId':_0x141d1c['id']}})[_0x4ede('0x25')](function(){return _0x510cb5;});})[_0x4ede('0x25')](function(){_0x64ac29[_0x4ede('0x18')](0xcc)[_0x4ede('0x19')]();});}};}function handleEntityNotFound(_0x46d5d9,_0x2f6c44){return function(_0x44037b){if(!_0x44037b){_0x46d5d9['sendStatus'](0x194);}return _0x44037b;};}function handleError(_0xaf5a75,_0x5ac8a3){_0x5ac8a3=_0x5ac8a3||0x1f4;return function(_0x424f08){logger[_0x4ede('0x26')](_0x424f08[_0x4ede('0x27')]);if(_0x424f08[_0x4ede('0x28')]){delete _0x424f08[_0x4ede('0x28')];}_0xaf5a75[_0x4ede('0x18')](_0x5ac8a3)[_0x4ede('0x29')](_0x424f08);};}exports['index']=function(_0x460618,_0x2e61f5){var _0x1386a9={},_0x3fcba3={},_0x15fc5={'count':0x0,'rows':[]};var _0x5de601=_[_0x4ede('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x56680a){return{'name':_0x56680a[_0x4ede('0x2b')],'type':_0x56680a[_0x4ede('0x2c')][_0x4ede('0x2d')]};});_0x3fcba3[_0x4ede('0x2e')]=_[_0x4ede('0x2a')](_0x5de601,_0x4ede('0x28'));_0x3fcba3['query']=_[_0x4ede('0x2f')](_0x460618[_0x4ede('0x30')]);_0x3fcba3[_0x4ede('0x31')]=_[_0x4ede('0x32')](_0x3fcba3[_0x4ede('0x2e')],_0x3fcba3[_0x4ede('0x30')]);_0x1386a9[_0x4ede('0x33')]=_[_0x4ede('0x32')](_0x3fcba3[_0x4ede('0x2e')],qs['fields'](_0x460618['query']['fields']));_0x1386a9[_0x4ede('0x33')]=_0x1386a9[_0x4ede('0x33')][_0x4ede('0x34')]?_0x1386a9[_0x4ede('0x33')]:_0x3fcba3['model'];if(!_0x460618[_0x4ede('0x30')][_0x4ede('0x35')](_0x4ede('0x36'))){_0x1386a9[_0x4ede('0x1e')]=qs[_0x4ede('0x1e')](_0x460618[_0x4ede('0x30')]['limit']);_0x1386a9['offset']=qs[_0x4ede('0x1b')](_0x460618[_0x4ede('0x30')][_0x4ede('0x1b')]);}_0x1386a9[_0x4ede('0x37')]=qs[_0x4ede('0x38')](_0x460618[_0x4ede('0x30')][_0x4ede('0x38')]);delete _0x460618[_0x4ede('0x30')][_0x4ede('0x38')];_0x1386a9[_0x4ede('0x39')]=qs[_0x4ede('0x31')](_[_0x4ede('0x3a')](_0x460618[_0x4ede('0x30')],_0x3fcba3[_0x4ede('0x31')]),_0x5de601);if(_0x460618['query'][_0x4ede('0x3b')]){_0x1386a9[_0x4ede('0x39')]=_['merge'](_0x1386a9[_0x4ede('0x39')],{'$or':_[_0x4ede('0x2a')](_0x5de601,function(_0x253c0a){if(_0x253c0a[_0x4ede('0x2c')]!==_0x4ede('0x3c')){var _0x418073={};_0x418073[_0x253c0a[_0x4ede('0x28')]]={'$like':'%'+_0x460618['query']['filter']+'%'};return _0x418073;}})});}_0x1386a9=_[_0x4ede('0x3d')]({},_0x1386a9,_0x460618['options']);var _0x497442={'where':_0x1386a9[_0x4ede('0x39')]};return db[_0x4ede('0x3e')][_0x4ede('0x1d')](_0x497442)[_0x4ede('0x25')](function(_0x560a16){_0x15fc5[_0x4ede('0x1d')]=_0x560a16;if(_0x460618[_0x4ede('0x30')][_0x4ede('0x3f')]){_0x1386a9[_0x4ede('0x40')]=[{'all':!![]}];}return db[_0x4ede('0x3e')][_0x4ede('0x41')](_0x1386a9);})[_0x4ede('0x25')](function(_0x1f16a9){_0x15fc5['rows']=_0x1f16a9;return _0x15fc5;})[_0x4ede('0x25')](respondWithFilteredResult(_0x2e61f5,_0x1386a9))['catch'](handleError(_0x2e61f5,null));};exports[_0x4ede('0x42')]=function(_0x45aa35,_0x58dd04){var _0x10bc9d={'raw':![],'where':{'id':_0x45aa35[_0x4ede('0x43')]['id']}},_0x590db7={};_0x590db7['model']=_[_0x4ede('0x2f')](db['VoiceMusicOnHold'][_0x4ede('0x44')]);_0x590db7['query']=_[_0x4ede('0x2f')](_0x45aa35['query']);_0x590db7['filters']=_[_0x4ede('0x32')](_0x590db7['model'],_0x590db7[_0x4ede('0x30')]);_0x10bc9d[_0x4ede('0x33')]=_[_0x4ede('0x32')](_0x590db7[_0x4ede('0x2e')],qs[_0x4ede('0x45')](_0x45aa35[_0x4ede('0x30')][_0x4ede('0x45')]));_0x10bc9d[_0x4ede('0x33')]=_0x10bc9d[_0x4ede('0x33')]['length']?_0x10bc9d[_0x4ede('0x33')]:_0x590db7[_0x4ede('0x2e')];if(_0x45aa35[_0x4ede('0x30')][_0x4ede('0x3f')]){_0x10bc9d[_0x4ede('0x40')]=[{'all':!![]}];}_0x10bc9d=_['merge']({},_0x10bc9d,_0x45aa35[_0x4ede('0x46')]);return db[_0x4ede('0x3e')]['find'](_0x10bc9d)['then'](handleEntityNotFound(_0x58dd04,null))['then'](respondWithResult(_0x58dd04,null))[_0x4ede('0x47')](handleError(_0x58dd04,null));};exports[_0x4ede('0x48')]=function(_0x3010d1,_0x396ab3){if(_0x3010d1[_0x4ede('0x49')]['id']){delete _0x3010d1[_0x4ede('0x49')]['id'];}return db[_0x4ede('0x3e')][_0x4ede('0x4a')]({'where':{'id':_0x3010d1[_0x4ede('0x43')]['id']}})['then'](handleEntityNotFound(_0x396ab3,null))[_0x4ede('0x25')](saveUpdates(_0x3010d1[_0x4ede('0x49')],null))['then'](respondWithResult(_0x396ab3,null))[_0x4ede('0x47')](handleError(_0x396ab3,null));};exports[_0x4ede('0x4b')]=function(_0x2ec33f,_0x327b93,_0x6a9a26){return db[_0x4ede('0x4c')]['transaction'](function(_0x29d682){if(_0x2ec33f[_0x4ede('0x49')][_0x4ede('0x4d')]==='files'){_0x2ec33f[_0x4ede('0x49')][_0x4ede('0x4e')]=path[_0x4ede('0x4f')](config[_0x4ede('0x50')],_0x4ede('0x51'),_0x2ec33f[_0x4ede('0x49')][_0x4ede('0x28')]);}return db[_0x4ede('0x3e')][_0x4ede('0x4b')](_0x2ec33f['body'],{'transaction':_0x29d682})['then'](function(_0x481a01){if(_0x2ec33f['body'][_0x4ede('0x4d')]===_0x4ede('0x52')){fs[_0x4ede('0x53')](_0x481a01['directory'],parseInt(_0x4ede('0x54'),0x8));}var _0x4dbf0c=_0x2ec33f[_0x4ede('0x55')][_0x4ede('0x23')]({'plain':!![]});if(!_0x4dbf0c)throw new Error(_0x4ede('0x56'));if(_0x4dbf0c[_0x4ede('0x57')]===_0x4ede('0x55')){var _0x3c3495=_0x481a01[_0x4ede('0x23')]({'plain':!![]});return db[_0x4ede('0x58')][_0x4ede('0x4a')]({'where':{'name':_0x4ede('0x59'),'userProfileId':_0x4dbf0c[_0x4ede('0x5a')]},'raw':!![]})[_0x4ede('0x25')](function(_0x3d83d3){if(_0x3d83d3&&_0x3d83d3['autoAssociation']===0x0){return db[_0x4ede('0x24')][_0x4ede('0x4b')]({'name':_0x3c3495[_0x4ede('0x28')],'resourceId':_0x3c3495['id'],'type':_0x3d83d3['name'],'sectionId':_0x3d83d3['id']},{})[_0x4ede('0x25')](function(){return _0x481a01;});}else{return _0x481a01;}})[_0x4ede('0x47')](function(_0x2ae4f3){logger[_0x4ede('0x26')](_0x4ede('0x5b'),_0x2ae4f3);});}return _0x481a01;});})['then'](respondWithResult(_0x327b93,0xc9))['catch'](handleError(_0x327b93,null));};exports['destroy']=function(_0x21c225,_0x748d1c,_0x41a8da){var _0x536d6c;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x21c225[_0x4ede('0x43')]['id']}})[_0x4ede('0x25')](function(_0x1951df){if(_0x1951df){return db[_0x4ede('0x4c')][_0x4ede('0x5c')](function(_0x5bdf1f){return _0x1951df[_0x4ede('0x22')]({'transaction':_0x5bdf1f,'raw':!![]})['then'](function(_0x1a6193){if(_0x1a6193[_0x4ede('0x4e')]){fs[_0x4ede('0x5d')](_0x1a6193[_0x4ede('0x4e')])[_0x4ede('0x5e')](function(_0x534b2e){fs[_0x4ede('0x5f')](path[_0x4ede('0x4f')](_0x1a6193[_0x4ede('0x4e')],_0x534b2e));});fs['rmdirSync'](_0x1a6193[_0x4ede('0x4e')]);}return _0x1a6193;});})[_0x4ede('0x47')](function(_0x5eee38){throw new db['Sequelize'][(_0x4ede('0x60'))](_0x5eee38[_0x4ede('0x61')]);});}})[_0x4ede('0x25')](handleEntityNotFound(_0x748d1c,null))[_0x4ede('0x25')](removeEntity(_0x748d1c,null))[_0x4ede('0x47')](handleError(_0x748d1c,null));};exports[_0x4ede('0x62')]=function(_0x83772f,_0x387f5f,_0x110cc0){return db[_0x4ede('0x4c')][_0x4ede('0x5c')](function(_0x39257c){var _0x276463;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x83772f['params']['id']}})[_0x4ede('0x25')](function(_0x5cce9c){if(_0x5cce9c){_0x276463=_0x5cce9c;return _0x5cce9c[_0x4ede('0x62')](_0x83772f[_0x4ede('0x49')]['id'],{'transaction':_0x39257c});}})[_0x4ede('0x25')](function(_0x44bb27){if(_0x44bb27){return db['Sound'][_0x4ede('0x63')]({'where':{'id':_0x83772f[_0x4ede('0x49')]['id']},'attributes':['id',_0x4ede('0x28'),_0x4ede('0x64'),'converted_format',_0x4ede('0x65')],'raw':!![]});}})[_0x4ede('0x25')](function(_0x3ea9b8){if(_0x3ea9b8){var _0x407151=path[_0x4ede('0x4f')](config[_0x4ede('0x50')],_0x4ede('0x66'),util[_0x4ede('0x67')](_0x4ede('0x68'),path[_0x4ede('0x69')](_0x3ea9b8[_0x4ede('0x64')],path['extname'](_0x3ea9b8[_0x4ede('0x64')])),_0x3ea9b8[_0x4ede('0x6a')]));var _0x5cbf6d=path[_0x4ede('0x4f')](config['root'],_0x4ede('0x51'),_0x276463[_0x4ede('0x28')],util['format'](_0x4ede('0x68'),_0x3ea9b8[_0x4ede('0x28')],_0x3ea9b8[_0x4ede('0x6a')]));fs[_0x4ede('0x6b')](_0x407151,_0x5cbf6d);return _0x3ea9b8;}})[_0x4ede('0x47')](function(_0x2db07d){throw new db[(_0x4ede('0x6c'))]['ValidationError'](_0x2db07d['message']);});})[_0x4ede('0x25')](handleEntityNotFound(_0x387f5f,null))['then'](respondWithResult(_0x387f5f,0xc9))[_0x4ede('0x47')](handleError(_0x387f5f,null));};exports[_0x4ede('0x6d')]=function(_0x58ba04,_0x44d113,_0x4d8709){return db[_0x4ede('0x4c')][_0x4ede('0x5c')](function(_0x3a24a8){var _0x2075ff;return db[_0x4ede('0x3e')]['findOne']({'where':{'id':_0x58ba04[_0x4ede('0x43')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x44d113,null))['then'](function(_0x2ecd72){if(_0x2ecd72){_0x2075ff=_0x2ecd72;return _0x2ecd72[_0x4ede('0x6d')](_0x58ba04[_0x4ede('0x43')][_0x4ede('0x6e')]);}})[_0x4ede('0x25')](function(_0xd7e8b2){if(_0xd7e8b2){return db[_0x4ede('0x6f')][_0x4ede('0x63')]({'where':{'id':_0x58ba04[_0x4ede('0x43')][_0x4ede('0x6e')]},'attributes':['id','name',_0x4ede('0x64'),'converted_format',_0x4ede('0x65')],'raw':!![]});}})[_0x4ede('0x25')](function(_0xa79a6f){if(_0xa79a6f){fs['unlinkSync'](path[_0x4ede('0x4f')](_0x2075ff[_0x4ede('0x4e')],util['format'](_0x4ede('0x68'),_0xa79a6f[_0x4ede('0x28')],_0xa79a6f[_0x4ede('0x6a')])));return _0xa79a6f;}})['catch'](function(_0x23a5cc){throw new db[(_0x4ede('0x6c'))][(_0x4ede('0x60'))](_0x23a5cc[_0x4ede('0x61')]);});})[_0x4ede('0x25')](handleEntityNotFound(_0x44d113,null))[_0x4ede('0x25')](respondWithStatusCode(_0x44d113,0xcc))[_0x4ede('0x47')](handleError(_0x44d113,null));};exports[_0x4ede('0x70')]=function(_0x46af26,_0x136194,_0x5a9eb0){var _0x44bbf1={};var _0x5c11d6={};var _0x9bb767;var _0x2e5dd3;return db[_0x4ede('0x3e')]['findOne']({'where':{'id':_0x46af26[_0x4ede('0x43')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x136194,null))[_0x4ede('0x25')](function(_0x10b030){if(_0x10b030){_0x9bb767=_0x10b030;_0x5c11d6[_0x4ede('0x2e')]=_['keys'](db[_0x4ede('0x6f')][_0x4ede('0x44')]);_0x5c11d6[_0x4ede('0x30')]=_[_0x4ede('0x2f')](_0x46af26[_0x4ede('0x30')]);_0x5c11d6[_0x4ede('0x31')]=_[_0x4ede('0x32')](_0x5c11d6[_0x4ede('0x2e')],_0x5c11d6['query']);_0x44bbf1[_0x4ede('0x33')]=_['intersection'](_0x5c11d6['model'],qs[_0x4ede('0x45')](_0x46af26['query'][_0x4ede('0x45')]));_0x44bbf1['attributes']=_0x44bbf1[_0x4ede('0x33')][_0x4ede('0x34')]?_0x44bbf1[_0x4ede('0x33')]:_0x5c11d6[_0x4ede('0x2e')];_0x44bbf1['order']=qs[_0x4ede('0x38')](_0x46af26[_0x4ede('0x30')]['sort']);_0x44bbf1['where']=qs[_0x4ede('0x31')](_[_0x4ede('0x3a')](_0x46af26['query'],_0x5c11d6[_0x4ede('0x31')]));if(_0x46af26[_0x4ede('0x30')][_0x4ede('0x3b')]){_0x44bbf1[_0x4ede('0x39')]=_[_0x4ede('0x3d')](_0x44bbf1['where'],{'$or':_[_0x4ede('0x2a')](_0x44bbf1[_0x4ede('0x33')],function(_0x5c55fb){var _0x7d6d00={};_0x7d6d00[_0x5c55fb]={'$like':'%'+_0x46af26[_0x4ede('0x30')]['filter']+'%'};return _0x7d6d00;})});}_0x44bbf1=_['merge']({},_0x44bbf1,_0x46af26['options']);return _0x9bb767[_0x4ede('0x70')](_0x44bbf1);}})['then'](function(_0x3c6992){if(_0x3c6992){_0x2e5dd3=_0x3c6992[_0x4ede('0x34')];if(!_0x46af26['query'][_0x4ede('0x35')](_0x4ede('0x36'))){_0x44bbf1[_0x4ede('0x1e')]=qs[_0x4ede('0x1e')](_0x46af26[_0x4ede('0x30')][_0x4ede('0x1e')]);_0x44bbf1[_0x4ede('0x1b')]=qs[_0x4ede('0x1b')](_0x46af26[_0x4ede('0x30')][_0x4ede('0x1b')]);}return _0x9bb767[_0x4ede('0x70')](_0x44bbf1);}})[_0x4ede('0x25')](function(_0x4984ae){if(_0x4984ae){return _0x4984ae?{'count':_0x2e5dd3,'rows':_0x4984ae}:null;}})['then'](respondWithResult(_0x136194,null))['catch'](handleError(_0x136194,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d042f25..a17ca08 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 _0x6ed1=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6ed1,0x85));var _0x16ed=function(_0x4342f0,_0x3009c8){_0x4342f0=_0x4342f0-0x0;var _0x5ce9f0=_0x6ed1[_0x4342f0];return _0x5ce9f0;};'use strict';var _=require('lodash');var util=require(_0x16ed('0x0'));var logger=require(_0x16ed('0x1'))(_0x16ed('0x2'));var moment=require(_0x16ed('0x3'));var BPromise=require(_0x16ed('0x4'));var rp=require(_0x16ed('0x5'));var fs=require('fs');var path=require(_0x16ed('0x6'));var rimraf=require(_0x16ed('0x7'));var config=require(_0x16ed('0x8'));var attributes=require(_0x16ed('0x9'));module[_0x16ed('0xa')]=function(_0x4c24aa,_0x5b7aeb){return _0x4c24aa[_0x16ed('0xb')](_0x16ed('0xc'),attributes,{'tableName':_0x16ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f78=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird'];(function(_0x57d676,_0x18d6e4){var _0x12a95e=function(_0x37fa21){while(--_0x37fa21){_0x57d676['push'](_0x57d676['shift']());}};_0x12a95e(++_0x18d6e4);}(_0x8f78,0x14b));var _0x88f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8f78[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x88f7('0x0'));var util=require(_0x88f7('0x1'));var logger=require('../../config/logger')(_0x88f7('0x2'));var moment=require(_0x88f7('0x3'));var BPromise=require(_0x88f7('0x4'));var rp=require(_0x88f7('0x5'));var fs=require('fs');var path=require(_0x88f7('0x6'));var rimraf=require(_0x88f7('0x7'));var config=require(_0x88f7('0x8'));var attributes=require(_0x88f7('0x9'));module[_0x88f7('0xa')]=function(_0x555a06,_0x1d782){return _0x555a06[_0x88f7('0xb')](_0x88f7('0xc'),attributes,{'tableName':_0x88f7('0xd'),'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 c20ff18..797c459 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 _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(_0x5861eb,_0x1a1176){var _0x4d4d0e=function(_0x290d46){while(--_0x290d46){_0x5861eb['push'](_0x5861eb['shift']());}};_0x4d4d0e(++_0x1a1176);}(_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 +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1a41a1,_0x3ffc42){var _0x7901f1=function(_0x2951f6){while(--_0x2951f6){_0x1a41a1['push'](_0x1a41a1['shift']());}};_0x7901f1(++_0x3ffc42);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3f6e328..b401ea9 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 _0x867f=['get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','create','post','addAgents','addTeams','put','/:id','update','destroy','delete','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','./voicePrefix.controller'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x867f,0x7f));var _0xf867=function(_0x2fdee1,_0x466858){_0x2fdee1=_0x2fdee1-0x0;var _0x2c5533=_0x867f[_0x2fdee1];return _0x2c5533;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var fs_extra=require(_0xf867('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf867('0x7'));router[_0xf867('0x8')]('/',auth[_0xf867('0x9')](),controller[_0xf867('0xa')]);router['get'](_0xf867('0xb'),auth[_0xf867('0x9')](),controller[_0xf867('0xc')]);router[_0xf867('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf867('0xd')]);router[_0xf867('0x8')](_0xf867('0xe'),auth['isAuthenticated'](),controller[_0xf867('0xf')]);router['get'](_0xf867('0x10'),auth[_0xf867('0x9')](),controller['getTeams']);router['post']('/',auth[_0xf867('0x9')](),controller[_0xf867('0x11')]);router[_0xf867('0x12')]('/:id/users',auth[_0xf867('0x9')](),controller[_0xf867('0x13')]);router[_0xf867('0x12')](_0xf867('0x10'),auth[_0xf867('0x9')](),controller[_0xf867('0x14')]);router[_0xf867('0x15')](_0xf867('0x16'),auth['isAuthenticated'](),controller[_0xf867('0x17')]);router['delete'](_0xf867('0x16'),auth[_0xf867('0x9')](),controller[_0xf867('0x18')]);router[_0xf867('0x19')]('/:id/users',auth[_0xf867('0x9')](),controller['removeAgents']);router[_0xf867('0x19')]('/:id/teams',auth[_0xf867('0x9')](),controller[_0xf867('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xae24=['post','/:id/users','addAgents','addTeams','put','delete','/:id','destroy','removeAgents','removeTeams','exports','multer','path','express','Router','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','show','getAgents','/:id/teams','getTeams'];(function(_0x1898db,_0x5e6855){var _0x8312b7=function(_0x45e8ab){while(--_0x45e8ab){_0x1898db['push'](_0x1898db['shift']());}};_0x8312b7(++_0x5e6855);}(_0xae24,0x182));var _0x4ae2=function(_0x4906ae,_0x65f283){_0x4906ae=_0x4906ae-0x0;var _0x17155d=_0xae24[_0x4906ae];return _0x17155d;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x4ae2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xa')]);router[_0x4ae2('0x6')]('/:id/users',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0x6')](_0x4ae2('0xc'),auth['isAuthenticated'](),controller[_0x4ae2('0xd')]);router[_0x4ae2('0xe')]('/',auth[_0x4ae2('0x7')](),controller['create']);router[_0x4ae2('0xe')](_0x4ae2('0xf'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x10')]);router[_0x4ae2('0xe')](_0x4ae2('0xc'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x11')]);router[_0x4ae2('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4ae2('0x13')](_0x4ae2('0x14'),auth['isAuthenticated'](),controller[_0x4ae2('0x15')]);router[_0x4ae2('0x13')](_0x4ae2('0xf'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x16')]);router[_0x4ae2('0x13')](_0x4ae2('0xc'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x17')]);module[_0x4ae2('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4e3f3e0..6f6d0ed 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 _0x90d9=['system-','getDataValue','INTEGER','exports','STRING','name'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0x90d9,0xdb));var _0x990d=function(_0x1605ca,_0x3efd44){_0x1605ca=_0x1605ca-0x0;var _0x29812c=_0x90d9[_0x1605ca];return _0x29812c;};'use strict';var Sequelize=require('sequelize');module[_0x990d('0x0')]={'name':{'type':Sequelize[_0x990d('0x1')],'allowNull':![],'unique':_0x990d('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x21d0b7){return _0x990d('0x3')+this[_0x990d('0x4')](_0x990d('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x990d('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x990d('0x5')]}}; \ No newline at end of file +var _0xa6f6=['VIRTUAL','INTEGER','sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6f6,0x182));var _0x6a6f=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xa6f6[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x6a6f('0x0'));module[_0x6a6f('0x1')]={'name':{'type':Sequelize[_0x6a6f('0x2')],'allowNull':![],'unique':_0x6a6f('0x3')},'prefix':{'type':Sequelize[_0x6a6f('0x4')],'get':function(_0x53203c){return'system-'+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x6a6f('0x2')]},'callerIdAll':{'type':Sequelize[_0x6a6f('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x6a6f('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9215d50..3791f78 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 _0x1893=['compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','includeAll','findAll','rows','show','length','options','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','body','system-','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','pick','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1893,0xa2));var _0x3189=function(_0x699049,_0x51d7d6){_0x699049=_0x699049-0x0;var _0x5e25e4=_0x1893[_0x699049];return _0x5e25e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];config['redis']=_[_0x3189('0x19')](config[_0x3189('0x1a')],{'host':_0x3189('0x1b'),'port':0x18eb});var socket=require(_0x3189('0x1c'))(new Redis(config[_0x3189('0x1a')]));require(_0x3189('0x1d'))[_0x3189('0x1e')](socket);function respondWithStatusCode(_0x25a917,_0x5521bb){_0x5521bb=_0x5521bb||0xcc;return function(_0x220b18){if(_0x220b18){return _0x25a917[_0x3189('0x1f')](_0x5521bb);}return _0x25a917[_0x3189('0x20')](_0x5521bb)[_0x3189('0x21')]();};}function respondWithResult(_0x486dd2,_0x40195d){_0x40195d=_0x40195d||0xc8;return function(_0x5f2e82){if(_0x5f2e82){return _0x486dd2['status'](_0x40195d)[_0x3189('0x22')](_0x5f2e82);}};}function respondWithFilteredResult(_0x49b1bc,_0x42c3a3){return function(_0xf8aed7){if(_0xf8aed7){var _0x22c7ba=typeof _0x42c3a3[_0x3189('0x23')]==='undefined'&&typeof _0x42c3a3[_0x3189('0x24')]===_0x3189('0x25');var _0x16edd7=_0xf8aed7['count'];var _0x561265=_0x22c7ba?0x0:_0x42c3a3[_0x3189('0x23')];var _0x306ed3=_0x22c7ba?_0xf8aed7[_0x3189('0x26')]:_0x42c3a3[_0x3189('0x23')]+_0x42c3a3['limit'];var _0x1771a8;if(_0x306ed3>=_0x16edd7){_0x306ed3=_0x16edd7;_0x1771a8=0xc8;}else{_0x1771a8=0xce;}_0x49b1bc[_0x3189('0x20')](_0x1771a8);return _0x49b1bc[_0x3189('0x27')]('Content-Range',_0x561265+'-'+_0x306ed3+'/'+_0x16edd7)[_0x3189('0x22')](_0xf8aed7);}return null;};}function patchUpdates(_0x47abb4){return function(_0x4bfc03){try{jsonpatch[_0x3189('0x28')](_0x4bfc03,_0x47abb4,!![]);}catch(_0x200f16){return BPromise[_0x3189('0x29')](_0x200f16);}return _0x4bfc03[_0x3189('0x2a')]();};}function saveUpdates(_0x393fcb,_0x5a08dc){return function(_0x4b03ad){if(_0x4b03ad){return _0x4b03ad[_0x3189('0x2b')](_0x393fcb)[_0x3189('0x2c')](function(_0x1dc1c8){return _0x1dc1c8;});}return null;};}function removeEntity(_0x3cc1e5,_0x103de4){return function(_0x3f4789){if(_0x3f4789){return _0x3f4789[_0x3189('0x2d')]()[_0x3189('0x2c')](function(){var _0x17b540=_0x3f4789[_0x3189('0x2e')]({'plain':!![]});var _0x5ce5f5='VoicePrefixes';return db['UserProfileResource'][_0x3189('0x2d')]({'where':{'type':_0x5ce5f5,'resourceId':_0x17b540['id']}})[_0x3189('0x2c')](function(){return _0x3f4789;});})[_0x3189('0x2c')](function(){_0x3cc1e5[_0x3189('0x20')](0xcc)[_0x3189('0x21')]();});}};}function handleEntityNotFound(_0x2f7504,_0x4d453a){return function(_0x1ab94b){if(!_0x1ab94b){_0x2f7504[_0x3189('0x1f')](0x194);}return _0x1ab94b;};}function handleError(_0x4bd677,_0x173f18){_0x173f18=_0x173f18||0x1f4;return function(_0x3744ff){logger[_0x3189('0x2f')](_0x3744ff['stack']);if(_0x3744ff[_0x3189('0x30')]){delete _0x3744ff[_0x3189('0x30')];}_0x4bd677[_0x3189('0x20')](_0x173f18)['send'](_0x3744ff);};}exports[_0x3189('0x31')]=function(_0x47f7a7,_0x51ce54){var _0x32ca90={},_0x34007b={},_0x374f23={'count':0x0,'rows':[]};var _0x3bdc84=_[_0x3189('0x32')](db['VoicePrefix']['rawAttributes'],function(_0x7d7745){return{'name':_0x7d7745['fieldName'],'type':_0x7d7745[_0x3189('0x33')][_0x3189('0x34')]};});_0x34007b[_0x3189('0x35')]=_[_0x3189('0x32')](_0x3bdc84,_0x3189('0x30'));_0x34007b[_0x3189('0x36')]=_[_0x3189('0x37')](_0x47f7a7[_0x3189('0x36')]);_0x34007b[_0x3189('0x38')]=_['intersection'](_0x34007b[_0x3189('0x35')],_0x34007b[_0x3189('0x36')]);_0x32ca90[_0x3189('0x39')]=_[_0x3189('0x3a')](_0x34007b[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x47f7a7[_0x3189('0x36')]['fields']));_0x32ca90['attributes']=_0x32ca90[_0x3189('0x39')]['length']?_0x32ca90[_0x3189('0x39')]:_0x34007b[_0x3189('0x35')];if(!_0x47f7a7['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x32ca90[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x47f7a7['query'][_0x3189('0x24')]);_0x32ca90['offset']=qs['offset'](_0x47f7a7[_0x3189('0x36')][_0x3189('0x23')]);}_0x32ca90[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x47f7a7[_0x3189('0x36')][_0x3189('0x3f')]);_0x32ca90[_0x3189('0x40')]=qs[_0x3189('0x38')](_['pick'](_0x47f7a7['query'],_0x34007b[_0x3189('0x38')]),_0x3bdc84);if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]){_0x32ca90[_0x3189('0x40')]=_[_0x3189('0x42')](_0x32ca90[_0x3189('0x40')],{'$or':_['map'](_0x3bdc84,function(_0x280146){if(_0x280146[_0x3189('0x33')]!==_0x3189('0x43')){var _0xaf76f1={};_0xaf76f1[_0x280146['name']]={'$like':'%'+_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]+'%'};return _0xaf76f1;}})});}_0x32ca90=_['merge']({},_0x32ca90,_0x47f7a7['options']);var _0x1ef1b2={'where':_0x32ca90['where']};return db[_0x3189('0x44')][_0x3189('0x26')](_0x1ef1b2)[_0x3189('0x2c')](function(_0x9593f3){_0x374f23['count']=_0x9593f3;if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x45')]){_0x32ca90['include']=[{'all':!![]}];}return db[_0x3189('0x44')][_0x3189('0x46')](_0x32ca90);})[_0x3189('0x2c')](function(_0x3a6a36){_0x374f23[_0x3189('0x47')]=_0x3a6a36;return _0x374f23;})['then'](respondWithFilteredResult(_0x51ce54,_0x32ca90))['catch'](handleError(_0x51ce54,null));};exports[_0x3189('0x48')]=function(_0x5ca360,_0x44e45f){var _0xf095fe={'raw':![],'where':{'id':_0x5ca360['params']['id']}},_0x1a3e51={};_0x1a3e51[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x44')]['rawAttributes']);_0x1a3e51[_0x3189('0x36')]=_[_0x3189('0x37')](_0x5ca360[_0x3189('0x36')]);_0x1a3e51[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x1a3e51[_0x3189('0x35')],_0x1a3e51['query']);_0xf095fe['attributes']=_[_0x3189('0x3a')](_0x1a3e51['model'],qs['fields'](_0x5ca360[_0x3189('0x36')]['fields']));_0xf095fe[_0x3189('0x39')]=_0xf095fe[_0x3189('0x39')][_0x3189('0x49')]?_0xf095fe['attributes']:_0x1a3e51[_0x3189('0x35')];if(_0x5ca360['query'][_0x3189('0x45')]){_0xf095fe['include']=[{'all':!![]}];}_0xf095fe=_['merge']({},_0xf095fe,_0x5ca360[_0x3189('0x4a')]);return db['VoicePrefix'][_0x3189('0x4b')](_0xf095fe)['then'](handleEntityNotFound(_0x44e45f,null))['then'](respondWithResult(_0x44e45f,null))[_0x3189('0x4c')](handleError(_0x44e45f,null));};exports[_0x3189('0x2d')]=function(_0x4373f6,_0x35cb23){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4373f6['params']['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x35cb23,null))['then'](removeEntity(_0x35cb23,null))['catch'](handleError(_0x35cb23,null));};exports[_0x3189('0x4d')]=function(_0x4f641a,_0xd90868){return db[_0x3189('0x44')][_0x3189('0x4d')]()[_0x3189('0x2c')](respondWithResult(_0xd90868,null))['catch'](handleError(_0xd90868,null));};exports[_0x3189('0x4e')]=function(_0x4ad892,_0x35fdb2){var _0x242ec4;return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x4f41e5){return db[_0x3189('0x44')][_0x3189('0x4e')](_0x4ad892['body'],{'transaction':_0x4f41e5})[_0x3189('0x2c')](function(_0xbf07c5){_0x242ec4=_0xbf07c5[_0x3189('0x2e')]({'plain':!![]});return db[_0x3189('0x51')]['find']({'where':{'id':_0x242ec4[_0x3189('0x52')]},'raw':!![]})['then'](function(_0x1ebb0d){return createVoicePrefixExtensions(_0x242ec4,_0x1ebb0d,_0x4f41e5);});});})['then'](function(){var _0x460c6e=_0x4ad892[_0x3189('0x53')]['get']({'plain':!![]});if(!_0x460c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460c6e['role']===_0x3189('0x53')){var _0x5b14ac=_0x242ec4;return db[_0x3189('0x54')][_0x3189('0x4b')]({'where':{'name':_0x3189('0x55'),'userProfileId':_0x460c6e[_0x3189('0x56')]},'raw':!![]})[_0x3189('0x2c')](function(_0x40623f){if(_0x40623f&&_0x40623f[_0x3189('0x57')]===0x0){return db[_0x3189('0x58')][_0x3189('0x4e')]({'name':_0x5b14ac['name'],'resourceId':_0x5b14ac['id'],'type':_0x40623f[_0x3189('0x30')],'sectionId':_0x40623f['id']},{})[_0x3189('0x2c')](function(){return _0x242ec4;});}else{return _0x242ec4;}})[_0x3189('0x4c')](function(_0x429de3){logger[_0x3189('0x2f')](_0x3189('0x59'),_0x429de3);throw _0x429de3;});}return _0x242ec4;})[_0x3189('0x2c')](respondWithResult(_0x35fdb2,null))[_0x3189('0x4c')](handleError(_0x35fdb2,null));};function Extension(_0xa1316a,_0x68de3c,_0x187877,_0x3a2fe6){this['context']='from-sip';this[_0x3189('0x5a')]=_0xa1316a;this[_0x3189('0x5b')]=_0x187877;this[_0x3189('0x33')]=_0x3189('0x5c');this[_0x3189('0x5d')]=_0x3189('0x5e');this[_0x3189('0x5f')]=_0x68de3c;this[_0x3189('0x60')]=_0x3a2fe6;}function createVoicePrefixExtensions(_0x120a8a,_0x1472b6,_0xd45395){return new BPromise(function(_0x4f0ccb,_0x5b31dd){var _0x57aae5=new Extension(formatPrefixName(_0x120a8a[_0x3189('0x61')]),0x1,_0x3189('0x62'),'Voice\x20Prefix');_0x57aae5[_0x3189('0x63')]=_0x120a8a['id'];return db[_0x3189('0x51')][_0x3189('0x4e')](_0x57aae5,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x26fdf2){var _0x4875a2=_0x26fdf2[_0x3189('0x2e')]({'plain':!![]});var _0x35a4d1=_[_0x3189('0x32')](addVoicePrefixExtensions(_0x120a8a,_0x1472b6),function(_0x228dfc){_0x228dfc['VoiceExtensionId']=_0x4875a2['id'];_0x228dfc[_0x3189('0x63')]=_0x120a8a['id'];return _0x228dfc;});return db[_0x3189('0x51')][_0x3189('0x64')](_0x35a4d1,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x4a7172){if(!_0x4a7172){return _0x5b31dd(_0x3189('0x65'));}else{return _0x4f0ccb(_0x4a7172);}})['catch'](function(_0x1d7a44){return _0x5b31dd(_0x1d7a44);});});;});};function addVoicePrefixExtensions(_0x448635,_0x10fe1b){var _0xb02b4f=[];var _0x55bcf0=formatPrefixName(_0x448635[_0x3189('0x61')]);_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x2,_0x3189('0x67'),_0x3189('0x68')+_0x448635[_0x3189('0x30')]));if(_0x448635[_0x3189('0x69')]){_0xb02b4f['push'](new Extension(_0x55bcf0,0x3,_0x3189('0x67'),_0x3189('0x6a')+_0x448635[_0x3189('0x69')]));}else{_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x3,_0x3189('0x62'),'No\x20callerid\x20available'));}_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x4,'goto',_0x10fe1b[_0x3189('0x6b')]+','+_0x3189('0x6c')+(0x8+_0x448635[_0x3189('0x30')][_0x3189('0x49')])+'}'+','+0x1));return _0xb02b4f;}function formatPrefixName(_0x46faac){var _0x458db9='_';for(var _0x403d31=0x0;_0x403d31<_0x46faac[_0x3189('0x49')];_0x403d31++){if(_0x46faac['charAt'](_0x403d31)=='-'){_0x458db9+=_0x46faac[_0x3189('0x6d')](_0x403d31);}else{_0x458db9+='['+_0x46faac['charAt'](_0x403d31)+']';}}_0x458db9+='.';return _0x458db9;}exports[_0x3189('0x2b')]=function(_0x2eedf4,_0xf740b0,_0x1e08f4){var _0x3d11ac=_0x2eedf4[_0x3189('0x6e')];_0x3d11ac['prefix']=_0x3189('0x6f')+_0x3d11ac[_0x3189('0x30')]+'-';return db['sequelize'][_0x3189('0x50')](function(_0x50438f){return db[_0x3189('0x44')][_0x3189('0x2b')](_0x3d11ac,{'where':{'id':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db[_0x3189('0x51')][_0x3189('0x4b')]({'where':{'id':_0x3d11ac['VoiceExtensionId']},'raw':!![]})[_0x3189('0x2c')](function(_0x285b0d){return createVoicePrefixExtensions(_0x3d11ac,_0x285b0d,_0x50438f);});});});})['then'](function(){return db[_0x3189('0x44')][_0x3189('0x70')](_0x3d11ac['id']);})[_0x3189('0x2c')](respondWithResult(_0xf740b0,null))['catch'](handleError(_0xf740b0,null));};exports[_0x3189('0x71')]=function(_0x28bbe6,_0x3ab88e,_0x5d3478){return db['VoicePrefix'][_0x3189('0x4b')]({'where':{'id':_0x28bbe6[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x3ab88e,null))['then'](function(_0x1f57c7){if(_0x1f57c7){return _0x1f57c7[_0x3189('0x71')](_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')],_[_0x3189('0x74')](_0x28bbe6[_0x3189('0x6e')],[_0x3189('0x73'),'id'])||{})[_0x3189('0x75')](function(_0x2c110e){for(var _0x41d415=0x0;_0x41d415<_0x28bbe6['body'][_0x3189('0x73')][_0x3189('0x49')];_0x41d415+=0x1){socket[_0x3189('0x76')](_0x3189('0x77'),{'UserId':Number(_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')][_0x41d415]),'VoicePrefixId':Number(_0x28bbe6[_0x3189('0x72')]['id'])});}return _0x2c110e;});}})[_0x3189('0x2c')](respondWithResult(_0x3ab88e,null))['catch'](handleError(_0x3ab88e,null));};exports[_0x3189('0x78')]=function(_0x4861ba,_0x226a58,_0x176c44){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4861ba['params']['id']}})['then'](handleEntityNotFound(_0x226a58,null))[_0x3189('0x2c')](function(_0x2c0e85){if(_0x2c0e85){return _0x2c0e85[_0x3189('0x78')](_0x4861ba[_0x3189('0x36')]['ids'])[_0x3189('0x2c')](function(){if(_[_0x3189('0x79')](_0x4861ba['query'][_0x3189('0x73')])){for(var _0x65c13f=0x0;_0x65c13f<_0x4861ba['query'][_0x3189('0x73')][_0x3189('0x49')];_0x65c13f+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4861ba[_0x3189('0x36')]['ids'][_0x65c13f]),'VoicePrefixId':Number(_0x4861ba[_0x3189('0x72')]['id'])});}}else{socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':Number(_0x4861ba[_0x3189('0x36')][_0x3189('0x73')]),'VoicePrefixId':Number(_0x4861ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x226a58,null))[_0x3189('0x4c')](handleError(_0x226a58,null));};exports['getAgents']=function(_0x33b271,_0x5c138a,_0x583d35){var _0x51303a={};var _0x278553={};var _0x4917e3;var _0x2d3d78;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x33b271[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5c138a,null))[_0x3189('0x2c')](function(_0x4d3554){if(_0x4d3554){_0x4917e3=_0x4d3554;_0x278553[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x7c')][_0x3189('0x7d')]);_0x278553[_0x3189('0x36')]=_['keys'](_0x33b271[_0x3189('0x36')]);_0x278553[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],_0x278553[_0x3189('0x36')]);_0x51303a['attributes']=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x33b271[_0x3189('0x36')][_0x3189('0x3b')]));_0x51303a[_0x3189('0x39')]=_0x51303a[_0x3189('0x39')][_0x3189('0x49')]?_0x51303a[_0x3189('0x39')]:_0x278553[_0x3189('0x35')];_0x51303a['order']=qs[_0x3189('0x3f')](_0x33b271[_0x3189('0x36')][_0x3189('0x3f')]);_0x51303a[_0x3189('0x40')]=qs[_0x3189('0x38')](_[_0x3189('0x7e')](_0x33b271['query'],_0x278553[_0x3189('0x38')]));if(_0x33b271['query'][_0x3189('0x41')]){_0x51303a['where']=_[_0x3189('0x42')](_0x51303a['where'],{'$or':_[_0x3189('0x32')](_0x51303a['attributes'],function(_0x3a84e8){var _0x17b46a={};_0x17b46a[_0x3a84e8]={'$like':'%'+_0x33b271['query'][_0x3189('0x41')]+'%'};return _0x17b46a;})});}_0x51303a=_[_0x3189('0x42')]({},_0x51303a,_0x33b271[_0x3189('0x4a')]);return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x549bbd){if(_0x549bbd){_0x2d3d78=_0x549bbd['length'];if(!_0x33b271[_0x3189('0x36')][_0x3189('0x3c')](_0x3189('0x3d'))){_0x51303a[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x33b271[_0x3189('0x36')]['limit']);_0x51303a[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x33b271['query'][_0x3189('0x23')]);}return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x5d10f8){if(_0x5d10f8){return _0x5d10f8?{'count':_0x2d3d78,'rows':_0x5d10f8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5c138a,null))[_0x3189('0x4c')](handleError(_0x5c138a,null));};exports[_0x3189('0x80')]=function(_0x24fec5,_0x5a7cf4,_0x2ef30c){var _0x14cecc={};var _0x2165f1={};var _0x1b8666;var _0x5bbf36;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x24fec5[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5a7cf4,null))['then'](function(_0x4371b7){if(_0x4371b7){_0x1b8666=_0x4371b7;_0x2165f1[_0x3189('0x35')]=_[_0x3189('0x37')](db['Team'][_0x3189('0x7d')]);_0x2165f1['query']=_[_0x3189('0x37')](_0x24fec5['query']);_0x2165f1[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],_0x2165f1[_0x3189('0x36')]);_0x14cecc['attributes']=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3b')]));_0x14cecc[_0x3189('0x39')]=_0x14cecc['attributes']['length']?_0x14cecc[_0x3189('0x39')]:_0x2165f1[_0x3189('0x35')];_0x14cecc['order']=qs[_0x3189('0x3f')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3f')]);_0x14cecc[_0x3189('0x40')]=qs['filters'](_[_0x3189('0x7e')](_0x24fec5[_0x3189('0x36')],_0x2165f1[_0x3189('0x38')]));if(_0x24fec5[_0x3189('0x36')]['filter']){_0x14cecc[_0x3189('0x40')]=_[_0x3189('0x42')](_0x14cecc['where'],{'$or':_[_0x3189('0x32')](_0x14cecc[_0x3189('0x39')],function(_0x5eeb3d){var _0xe94bda={};_0xe94bda[_0x5eeb3d]={'$like':'%'+_0x24fec5[_0x3189('0x36')]['filter']+'%'};return _0xe94bda;})});}_0x14cecc=_[_0x3189('0x42')]({},_0x14cecc,_0x24fec5[_0x3189('0x4a')]);return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})[_0x3189('0x2c')](function(_0x23d34e){if(_0x23d34e){_0x5bbf36=_0x23d34e[_0x3189('0x49')];if(!_0x24fec5['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x14cecc[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x24fec5[_0x3189('0x36')][_0x3189('0x24')]);_0x14cecc[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x24fec5['query'][_0x3189('0x23')]);}return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})['then'](function(_0x418ef8){if(_0x418ef8){return _0x418ef8?{'count':_0x5bbf36,'rows':_0x418ef8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5a7cf4,null))['catch'](handleError(_0x5a7cf4,null));};exports[_0x3189('0x81')]=function(_0x85c195,_0x4917ee,_0x2a8f73){var _0x464843=_0x85c195[_0x3189('0x6e')][_0x3189('0x73')];var _0x429bc1;return db[_0x3189('0x82')]['findAll']({'where':{'id':_0x464843},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id','name',_0x3189('0x84'),_0x3189('0x85'),'interface'],'raw':!![]}]})['then'](function(_0x158199){if(_0x158199){_0x429bc1=_0x158199;var _0x431e68=_[_0x3189('0x86')](_0x158199,function(_0x18d525){var _0x5e565c=_0x18d525['get']({'plain':!![]});return _0x5e565c[_0x3189('0x83')];});return db[_0x3189('0x44')]['find']({'where':{'id':_0x85c195[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x36262a){return db['sequelize'][_0x3189('0x50')](function(_0xd24f4a){return _0x36262a[_0x3189('0x81')](_0x464843,{'transaction':_0xd24f4a})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x429bc1,function(_0x33f64c){return db['TeamVoicePrefix'][_0x3189('0x88')]({'TeamId':_0x33f64c['id'],'VoicePrefixId':_0x85c195['params']['id']},{'transaction':_0xd24f4a});});})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x431e68,function(_0x1c919f){return db['UserVoicePrefix'][_0x3189('0x89')]({'where':{'UserId':_0x1c919f['id'],'VoicePrefixId':_0x85c195[_0x3189('0x72')]['id']},'transaction':_0xd24f4a});});})['then'](function(){_0x431e68[_0x3189('0x8a')](function(_0x2bab94){socket['emit'](_0x3189('0x77'),{'UserId':_0x2bab94['id'],'VoicePrefixId':_0x36262a['id']});});});});});}})[_0x3189('0x2c')](respondWithStatusCode(_0x4917ee,null))[_0x3189('0x4c')](handleError(_0x4917ee,null));};exports[_0x3189('0x8b')]=function(_0x39fe89,_0x4f564d,_0x341e23){return db['Team'][_0x3189('0x46')]({'where':{'id':_0x39fe89[_0x3189('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id'],'raw':!![]}]})[_0x3189('0x2c')](handleEntityNotFound(_0x4f564d,null))['then'](function(_0x4fb475){var _0x522aa5=_[_0x3189('0x32')](_0x4fb475,'id');var _0x1f0c98=[];var _0x3f5cf9=[];var _0x47ce18=squel['select']();_0x47ce18[_0x3189('0x8c')](_0x3189('0x8d'))[_0x3189('0x8e')](_0x3189('0x8f'),'tq')[_0x3189('0x90')]('user_has_teams','ut',_0x3189('0x91'))['where'](_0x3189('0x92'),_0x39fe89['params']['id']);for(var _0x241a67=0x0;_0x241a67<_0x4fb475[_0x3189('0x49')];_0x241a67+=0x1){let _0x51913c=_0x4fb475[_0x241a67];for(var _0x1a07d7=0x0;_0x1a07d7<_0x51913c[_0x3189('0x83')][_0x3189('0x49')];_0x1a07d7+=0x1){let _0x36602c=_0x51913c['Agents'][_0x1a07d7];var _0x1f9018=_0x47ce18[_0x3189('0x93')]();_0x1f9018[_0x3189('0x40')]('ut.UserId\x20=\x20?',_0x36602c['id']);_0x3f5cf9[_0x3189('0x66')](db[_0x3189('0x4f')][_0x3189('0x36')](_0x1f9018[_0x3189('0x94')](),{'type':db['sequelize'][_0x3189('0x95')][_0x3189('0x96')]})[_0x3189('0x2c')](function(_0x13fc9f){if(_0x13fc9f[_0x3189('0x49')]===0x1){return _0x36602c['id'];}else{var _0x516164=_[_0x3189('0x97')](_['map'](_0x13fc9f,_0x3189('0x98')),function(_0x1f506c){return _[_0x3189('0x99')](_0x522aa5,_0x1f506c);});if(_0x516164){return _0x36602c['id'];}}}));}}return BPromise[_0x3189('0x9a')](_0x3f5cf9)[_0x3189('0x2c')](function(_0x48835c){_0x1f0c98=_(_0x1f0c98)[_0x3189('0x9b')](_0x48835c)[_0x3189('0x9c')]()[_0x3189('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x39fe89[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x4c19e2){return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x5d89ec){return _0x4c19e2[_0x3189('0x8b')](_0x39fe89[_0x3189('0x36')][_0x3189('0x73')],{'transaction':_0x5d89ec})['then'](function(){if(!_[_0x3189('0x9e')](_0x1f0c98)){return _0x4c19e2[_0x3189('0x78')](_0x1f0c98,{'transaction':_0x5d89ec});}})['then'](function(){_0x1f0c98[_0x3189('0x8a')](function(_0xab746c){socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':_0xab746c,'VoicePrefixId':_0x4c19e2['id']});});});});});});})[_0x3189('0x2c')](respondWithStatusCode(_0x4f564d,null))[_0x3189('0x4c')](handleError(_0x4f564d,null));}; \ No newline at end of file +var _0x056b=['forEach','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','undefined','count','set','apply','reject','update','destroy','then','get','VoicePrefixes','UserProfileResource','status','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','NoOp','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x056b,0xb6));var _0xb056=function(_0x1a0cfe,_0x300d70){_0x1a0cfe=_0x1a0cfe-0x0;var _0x35fdfd=_0x056b[_0x1a0cfe];return _0x35fdfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];config['redis']=_['defaults'](config[_0xb056('0x1b')],{'host':_0xb056('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb056('0x1b')]));require(_0xb056('0x1d'))[_0xb056('0x1e')](socket);function respondWithStatusCode(_0x1197e5,_0x10dd19){_0x10dd19=_0x10dd19||0xcc;return function(_0x3776a1){if(_0x3776a1){return _0x1197e5[_0xb056('0x1f')](_0x10dd19);}return _0x1197e5['status'](_0x10dd19)[_0xb056('0x20')]();};}function respondWithResult(_0x43565e,_0x9e2eed){_0x9e2eed=_0x9e2eed||0xc8;return function(_0x65d7ca){if(_0x65d7ca){return _0x43565e['status'](_0x9e2eed)[_0xb056('0x21')](_0x65d7ca);}};}function respondWithFilteredResult(_0x4e501a,_0x2daffc){return function(_0x311eb9){if(_0x311eb9){var _0x48e140=typeof _0x2daffc[_0xb056('0x22')]==='undefined'&&typeof _0x2daffc[_0xb056('0x23')]===_0xb056('0x24');var _0x5e4bd9=_0x311eb9[_0xb056('0x25')];var _0x48cdaf=_0x48e140?0x0:_0x2daffc[_0xb056('0x22')];var _0x225081=_0x48e140?_0x311eb9[_0xb056('0x25')]:_0x2daffc[_0xb056('0x22')]+_0x2daffc['limit'];var _0x1db585;if(_0x225081>=_0x5e4bd9){_0x225081=_0x5e4bd9;_0x1db585=0xc8;}else{_0x1db585=0xce;}_0x4e501a['status'](_0x1db585);return _0x4e501a[_0xb056('0x26')]('Content-Range',_0x48cdaf+'-'+_0x225081+'/'+_0x5e4bd9)[_0xb056('0x21')](_0x311eb9);}return null;};}function patchUpdates(_0x40ac2d){return function(_0x1de11b){try{jsonpatch[_0xb056('0x27')](_0x1de11b,_0x40ac2d,!![]);}catch(_0x36e539){return BPromise[_0xb056('0x28')](_0x36e539);}return _0x1de11b['save']();};}function saveUpdates(_0x1016da,_0x18a3f2){return function(_0x341544){if(_0x341544){return _0x341544[_0xb056('0x29')](_0x1016da)['then'](function(_0x44a14f){return _0x44a14f;});}return null;};}function removeEntity(_0x10b9b3,_0x5c39db){return function(_0x6d0483){if(_0x6d0483){return _0x6d0483[_0xb056('0x2a')]()[_0xb056('0x2b')](function(){var _0x1d2c66=_0x6d0483[_0xb056('0x2c')]({'plain':!![]});var _0x4024d7=_0xb056('0x2d');return db[_0xb056('0x2e')]['destroy']({'where':{'type':_0x4024d7,'resourceId':_0x1d2c66['id']}})[_0xb056('0x2b')](function(){return _0x6d0483;});})['then'](function(){_0x10b9b3[_0xb056('0x2f')](0xcc)[_0xb056('0x20')]();});}};}function handleEntityNotFound(_0x294874,_0x488185){return function(_0xd53267){if(!_0xd53267){_0x294874[_0xb056('0x1f')](0x194);}return _0xd53267;};}function handleError(_0x4ba5f8,_0x3a9e7d){_0x3a9e7d=_0x3a9e7d||0x1f4;return function(_0x43aa63){logger[_0xb056('0x30')](_0x43aa63[_0xb056('0x31')]);if(_0x43aa63[_0xb056('0x32')]){delete _0x43aa63['name'];}_0x4ba5f8[_0xb056('0x2f')](_0x3a9e7d)[_0xb056('0x33')](_0x43aa63);};}exports[_0xb056('0x34')]=function(_0x248473,_0x103482){var _0x559c34={},_0x16bbd2={},_0x290807={'count':0x0,'rows':[]};var _0x16c1d6=_[_0xb056('0x35')](db[_0xb056('0x36')][_0xb056('0x37')],function(_0x19f277){return{'name':_0x19f277[_0xb056('0x38')],'type':_0x19f277['type'][_0xb056('0x39')]};});_0x16bbd2['model']=_[_0xb056('0x35')](_0x16c1d6,'name');_0x16bbd2['query']=_[_0xb056('0x3a')](_0x248473[_0xb056('0x3b')]);_0x16bbd2[_0xb056('0x3c')]=_[_0xb056('0x3d')](_0x16bbd2[_0xb056('0x3e')],_0x16bbd2[_0xb056('0x3b')]);_0x559c34[_0xb056('0x3f')]=_['intersection'](_0x16bbd2[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x248473['query']['fields']));_0x559c34[_0xb056('0x3f')]=_0x559c34[_0xb056('0x3f')][_0xb056('0x41')]?_0x559c34['attributes']:_0x16bbd2[_0xb056('0x3e')];if(!_0x248473[_0xb056('0x3b')][_0xb056('0x42')](_0xb056('0x43'))){_0x559c34[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x248473[_0xb056('0x3b')][_0xb056('0x23')]);_0x559c34[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x248473[_0xb056('0x3b')][_0xb056('0x22')]);}_0x559c34['order']=qs[_0xb056('0x44')](_0x248473['query'][_0xb056('0x44')]);_0x559c34[_0xb056('0x45')]=qs[_0xb056('0x3c')](_[_0xb056('0x46')](_0x248473[_0xb056('0x3b')],_0x16bbd2[_0xb056('0x3c')]),_0x16c1d6);if(_0x248473[_0xb056('0x3b')][_0xb056('0x47')]){_0x559c34['where']=_[_0xb056('0x48')](_0x559c34[_0xb056('0x45')],{'$or':_[_0xb056('0x35')](_0x16c1d6,function(_0x4c2b1e){if(_0x4c2b1e[_0xb056('0x49')]!=='VIRTUAL'){var _0x39b861={};_0x39b861[_0x4c2b1e[_0xb056('0x32')]]={'$like':'%'+_0x248473[_0xb056('0x3b')][_0xb056('0x47')]+'%'};return _0x39b861;}})});}_0x559c34=_[_0xb056('0x48')]({},_0x559c34,_0x248473[_0xb056('0x4a')]);var _0x57da48={'where':_0x559c34[_0xb056('0x45')]};return db['VoicePrefix'][_0xb056('0x25')](_0x57da48)[_0xb056('0x2b')](function(_0x21d98e){_0x290807[_0xb056('0x25')]=_0x21d98e;if(_0x248473[_0xb056('0x3b')][_0xb056('0x4b')]){_0x559c34[_0xb056('0x4c')]=[{'all':!![]}];}return db[_0xb056('0x36')][_0xb056('0x4d')](_0x559c34);})[_0xb056('0x2b')](function(_0x4fa3c5){_0x290807[_0xb056('0x4e')]=_0x4fa3c5;return _0x290807;})[_0xb056('0x2b')](respondWithFilteredResult(_0x103482,_0x559c34))[_0xb056('0x4f')](handleError(_0x103482,null));};exports['show']=function(_0x2bf4dd,_0x505cad){var _0x49597d={'raw':![],'where':{'id':_0x2bf4dd[_0xb056('0x50')]['id']}},_0x5821e1={};_0x5821e1[_0xb056('0x3e')]=_[_0xb056('0x3a')](db[_0xb056('0x36')]['rawAttributes']);_0x5821e1['query']=_['keys'](_0x2bf4dd['query']);_0x5821e1['filters']=_['intersection'](_0x5821e1[_0xb056('0x3e')],_0x5821e1['query']);_0x49597d[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x5821e1[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x2bf4dd[_0xb056('0x3b')][_0xb056('0x40')]));_0x49597d[_0xb056('0x3f')]=_0x49597d[_0xb056('0x3f')]['length']?_0x49597d[_0xb056('0x3f')]:_0x5821e1[_0xb056('0x3e')];if(_0x2bf4dd['query'][_0xb056('0x4b')]){_0x49597d[_0xb056('0x4c')]=[{'all':!![]}];}_0x49597d=_[_0xb056('0x48')]({},_0x49597d,_0x2bf4dd[_0xb056('0x4a')]);return db[_0xb056('0x36')][_0xb056('0x51')](_0x49597d)['then'](handleEntityNotFound(_0x505cad,null))[_0xb056('0x2b')](respondWithResult(_0x505cad,null))['catch'](handleError(_0x505cad,null));};exports[_0xb056('0x2a')]=function(_0x3e4a14,_0xde5564){return db[_0xb056('0x36')][_0xb056('0x51')]({'where':{'id':_0x3e4a14[_0xb056('0x50')]['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0xde5564,null))[_0xb056('0x2b')](removeEntity(_0xde5564,null))['catch'](handleError(_0xde5564,null));};exports[_0xb056('0x52')]=function(_0x472a91,_0x5927c7){return db[_0xb056('0x36')][_0xb056('0x52')]()[_0xb056('0x2b')](respondWithResult(_0x5927c7,null))[_0xb056('0x4f')](handleError(_0x5927c7,null));};exports[_0xb056('0x53')]=function(_0x4a9968,_0x122ed7){var _0xc0be0d;return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x1a5170){return db[_0xb056('0x36')]['create'](_0x4a9968[_0xb056('0x56')],{'transaction':_0x1a5170})[_0xb056('0x2b')](function(_0x30ba6e){_0xc0be0d=_0x30ba6e['get']({'plain':!![]});return db[_0xb056('0x57')]['find']({'where':{'id':_0xc0be0d[_0xb056('0x58')]},'raw':!![]})[_0xb056('0x2b')](function(_0x2a064f){return createVoicePrefixExtensions(_0xc0be0d,_0x2a064f,_0x1a5170);});});})[_0xb056('0x2b')](function(){var _0x58c533=_0x4a9968[_0xb056('0x59')][_0xb056('0x2c')]({'plain':!![]});if(!_0x58c533)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58c533[_0xb056('0x5a')]===_0xb056('0x59')){var _0x1d3cdd=_0xc0be0d;return db[_0xb056('0x5b')][_0xb056('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x58c533[_0xb056('0x5c')]},'raw':!![]})[_0xb056('0x2b')](function(_0x10681b){if(_0x10681b&&_0x10681b[_0xb056('0x5d')]===0x0){return db[_0xb056('0x2e')][_0xb056('0x53')]({'name':_0x1d3cdd[_0xb056('0x32')],'resourceId':_0x1d3cdd['id'],'type':_0x10681b[_0xb056('0x32')],'sectionId':_0x10681b['id']},{})[_0xb056('0x2b')](function(){return _0xc0be0d;});}else{return _0xc0be0d;}})[_0xb056('0x4f')](function(_0x1b4a0d){logger[_0xb056('0x30')](_0xb056('0x5e'),_0x1b4a0d);throw _0x1b4a0d;});}return _0xc0be0d;})[_0xb056('0x2b')](respondWithResult(_0x122ed7,null))[_0xb056('0x4f')](handleError(_0x122ed7,null));};function Extension(_0x282c31,_0x28fc90,_0x435fe9,_0x39765e){this[_0xb056('0x5f')]=_0xb056('0x60');this['exten']=_0x282c31;this[_0xb056('0x61')]=_0x435fe9;this[_0xb056('0x49')]=_0xb056('0x62');this[_0xb056('0x63')]=_0xb056('0x64');this[_0xb056('0x65')]=_0x28fc90;this[_0xb056('0x66')]=_0x39765e;}function createVoicePrefixExtensions(_0x55808b,_0x5b03df,_0x30441e){return new BPromise(function(_0x388817,_0x1205cc){var _0x7b81c7=new Extension(formatPrefixName(_0x55808b[_0xb056('0x67')]),0x1,'NoOp',_0xb056('0x68'));_0x7b81c7[_0xb056('0x69')]=_0x55808b['id'];return db[_0xb056('0x57')][_0xb056('0x53')](_0x7b81c7,{'transaction':_0x30441e})['then'](function(_0x405108){var _0x24b037=_0x405108[_0xb056('0x2c')]({'plain':!![]});var _0x5e419e=_[_0xb056('0x35')](addVoicePrefixExtensions(_0x55808b,_0x5b03df),function(_0x2e02d5){_0x2e02d5[_0xb056('0x58')]=_0x24b037['id'];_0x2e02d5['VoicePrefixId']=_0x55808b['id'];return _0x2e02d5;});return db[_0xb056('0x57')][_0xb056('0x6a')](_0x5e419e,{'transaction':_0x30441e})[_0xb056('0x2b')](function(_0x5bf8ce){if(!_0x5bf8ce){return _0x1205cc(_0xb056('0x6b'));}else{return _0x388817(_0x5bf8ce);}})['catch'](function(_0x2d555d){return _0x1205cc(_0x2d555d);});});;});};function addVoicePrefixExtensions(_0x3e18c1,_0x103ff2){var _0x556a93=[];var _0x45d347=formatPrefixName(_0x3e18c1[_0xb056('0x67')]);_0x556a93['push'](new Extension(_0x45d347,0x2,_0xb056('0x6c'),_0xb056('0x6d')+_0x3e18c1[_0xb056('0x32')]));if(_0x3e18c1[_0xb056('0x6e')]){_0x556a93[_0xb056('0x6f')](new Extension(_0x45d347,0x3,'Set','PREFIX-CALLERIDALL='+_0x3e18c1[_0xb056('0x6e')]));}else{_0x556a93['push'](new Extension(_0x45d347,0x3,_0xb056('0x70'),'No\x20callerid\x20available'));}_0x556a93[_0xb056('0x6f')](new Extension(_0x45d347,0x4,_0xb056('0x71'),_0x103ff2[_0xb056('0x5f')]+','+_0xb056('0x72')+(0x8+_0x3e18c1['name']['length'])+'}'+','+0x1));return _0x556a93;}function formatPrefixName(_0xe6caf7){var _0x1e14e1='_';for(var _0x3b3bbf=0x0;_0x3b3bbf<_0xe6caf7[_0xb056('0x41')];_0x3b3bbf++){if(_0xe6caf7['charAt'](_0x3b3bbf)=='-'){_0x1e14e1+=_0xe6caf7[_0xb056('0x73')](_0x3b3bbf);}else{_0x1e14e1+='['+_0xe6caf7['charAt'](_0x3b3bbf)+']';}}_0x1e14e1+='.';return _0x1e14e1;}exports[_0xb056('0x29')]=function(_0x5f0278,_0x2129c5,_0x56bab7){var _0x432501=_0x5f0278[_0xb056('0x56')];_0x432501[_0xb056('0x67')]=_0xb056('0x74')+_0x432501['name']+'-';return db[_0xb056('0x54')]['transaction'](function(_0x227ab0){return db[_0xb056('0x36')][_0xb056('0x29')](_0x432501,{'where':{'id':_0x432501['id']},'transaction':_0x227ab0})[_0xb056('0x2b')](function(){return db[_0xb056('0x57')][_0xb056('0x2a')]({'where':{'VoicePrefixId':_0x432501['id']},'transaction':_0x227ab0})[_0xb056('0x2b')](function(){return db[_0xb056('0x57')][_0xb056('0x51')]({'where':{'id':_0x432501[_0xb056('0x58')]},'raw':!![]})[_0xb056('0x2b')](function(_0x3f6e2f){return createVoicePrefixExtensions(_0x432501,_0x3f6e2f,_0x227ab0);});});});})['then'](function(){return db['VoicePrefix'][_0xb056('0x75')](_0x432501['id']);})['then'](respondWithResult(_0x2129c5,null))[_0xb056('0x4f')](handleError(_0x2129c5,null));};exports['addAgents']=function(_0x208696,_0x5df962,_0x5f4b72){return db['VoicePrefix'][_0xb056('0x51')]({'where':{'id':_0x208696['params']['id']}})['then'](handleEntityNotFound(_0x5df962,null))[_0xb056('0x2b')](function(_0xb6fd9b){if(_0xb6fd9b){return _0xb6fd9b[_0xb056('0x76')](_0x208696['body']['ids'],_['omit'](_0x208696[_0xb056('0x56')],[_0xb056('0x77'),'id'])||{})[_0xb056('0x78')](function(_0x13bd5f){for(var _0x9185c=0x0;_0x9185c<_0x208696[_0xb056('0x56')][_0xb056('0x77')][_0xb056('0x41')];_0x9185c+=0x1){socket[_0xb056('0x79')](_0xb056('0x7a'),{'UserId':Number(_0x208696[_0xb056('0x56')][_0xb056('0x77')][_0x9185c]),'VoicePrefixId':Number(_0x208696[_0xb056('0x50')]['id'])});}return _0x13bd5f;});}})[_0xb056('0x2b')](respondWithResult(_0x5df962,null))['catch'](handleError(_0x5df962,null));};exports['removeAgents']=function(_0x18feb4,_0x5ef886,_0x11ef5f){return db[_0xb056('0x36')][_0xb056('0x51')]({'where':{'id':_0x18feb4[_0xb056('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ef886,null))['then'](function(_0x2e027a){if(_0x2e027a){return _0x2e027a[_0xb056('0x7b')](_0x18feb4[_0xb056('0x3b')]['ids'])['then'](function(){if(_[_0xb056('0x7c')](_0x18feb4[_0xb056('0x3b')]['ids'])){for(var _0x345cf9=0x0;_0x345cf9<_0x18feb4[_0xb056('0x3b')][_0xb056('0x77')][_0xb056('0x41')];_0x345cf9+=0x1){socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':Number(_0x18feb4[_0xb056('0x3b')][_0xb056('0x77')][_0x345cf9]),'VoicePrefixId':Number(_0x18feb4[_0xb056('0x50')]['id'])});}}else{socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':Number(_0x18feb4['query'][_0xb056('0x77')]),'VoicePrefixId':Number(_0x18feb4[_0xb056('0x50')]['id'])});}});}})[_0xb056('0x2b')](respondWithStatusCode(_0x5ef886,null))['catch'](handleError(_0x5ef886,null));};exports[_0xb056('0x7e')]=function(_0x4dc495,_0x489233,_0x1b0bbb){var _0x3a2f2f={};var _0x2d7c96={};var _0x56578e;var _0x493d0d;return db[_0xb056('0x36')][_0xb056('0x7f')]({'where':{'id':_0x4dc495['params']['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0x489233,null))['then'](function(_0x3b0f93){if(_0x3b0f93){_0x56578e=_0x3b0f93;_0x2d7c96[_0xb056('0x3e')]=_['keys'](db['User'][_0xb056('0x37')]);_0x2d7c96[_0xb056('0x3b')]=_['keys'](_0x4dc495[_0xb056('0x3b')]);_0x2d7c96['filters']=_['intersection'](_0x2d7c96[_0xb056('0x3e')],_0x2d7c96[_0xb056('0x3b')]);_0x3a2f2f[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x2d7c96[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x4dc495['query'][_0xb056('0x40')]));_0x3a2f2f['attributes']=_0x3a2f2f[_0xb056('0x3f')][_0xb056('0x41')]?_0x3a2f2f['attributes']:_0x2d7c96[_0xb056('0x3e')];_0x3a2f2f[_0xb056('0x80')]=qs['sort'](_0x4dc495[_0xb056('0x3b')]['sort']);_0x3a2f2f[_0xb056('0x45')]=qs['filters'](_[_0xb056('0x46')](_0x4dc495[_0xb056('0x3b')],_0x2d7c96['filters']));if(_0x4dc495[_0xb056('0x3b')]['filter']){_0x3a2f2f[_0xb056('0x45')]=_[_0xb056('0x48')](_0x3a2f2f[_0xb056('0x45')],{'$or':_[_0xb056('0x35')](_0x3a2f2f[_0xb056('0x3f')],function(_0x100a52){var _0x1bac84={};_0x1bac84[_0x100a52]={'$like':'%'+_0x4dc495[_0xb056('0x3b')]['filter']+'%'};return _0x1bac84;})});}_0x3a2f2f=_[_0xb056('0x48')]({},_0x3a2f2f,_0x4dc495['options']);return _0x56578e['getAgents'](_0x3a2f2f);}})['then'](function(_0x2ea984){if(_0x2ea984){_0x493d0d=_0x2ea984[_0xb056('0x41')];if(!_0x4dc495[_0xb056('0x3b')][_0xb056('0x42')]('nolimit')){_0x3a2f2f[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x4dc495[_0xb056('0x3b')][_0xb056('0x23')]);_0x3a2f2f[_0xb056('0x22')]=qs['offset'](_0x4dc495[_0xb056('0x3b')][_0xb056('0x22')]);}return _0x56578e[_0xb056('0x7e')](_0x3a2f2f);}})['then'](function(_0x526035){if(_0x526035){return _0x526035?{'count':_0x493d0d,'rows':_0x526035}:null;}})['then'](respondWithResult(_0x489233,null))['catch'](handleError(_0x489233,null));};exports['getTeams']=function(_0x5021d2,_0x41532c,_0x1f5c6d){var _0xd82e9={};var _0x2b62f1={};var _0x38b119;var _0xcdd8d6;return db['VoicePrefix'][_0xb056('0x7f')]({'where':{'id':_0x5021d2[_0xb056('0x50')]['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0x41532c,null))[_0xb056('0x2b')](function(_0x1ff1e7){if(_0x1ff1e7){_0x38b119=_0x1ff1e7;_0x2b62f1[_0xb056('0x3e')]=_[_0xb056('0x3a')](db[_0xb056('0x81')][_0xb056('0x37')]);_0x2b62f1[_0xb056('0x3b')]=_['keys'](_0x5021d2['query']);_0x2b62f1['filters']=_[_0xb056('0x3d')](_0x2b62f1['model'],_0x2b62f1[_0xb056('0x3b')]);_0xd82e9[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x2b62f1[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x40')]));_0xd82e9[_0xb056('0x3f')]=_0xd82e9[_0xb056('0x3f')]['length']?_0xd82e9[_0xb056('0x3f')]:_0x2b62f1[_0xb056('0x3e')];_0xd82e9[_0xb056('0x80')]=qs[_0xb056('0x44')](_0x5021d2['query']['sort']);_0xd82e9[_0xb056('0x45')]=qs[_0xb056('0x3c')](_[_0xb056('0x46')](_0x5021d2[_0xb056('0x3b')],_0x2b62f1[_0xb056('0x3c')]));if(_0x5021d2[_0xb056('0x3b')][_0xb056('0x47')]){_0xd82e9['where']=_[_0xb056('0x48')](_0xd82e9['where'],{'$or':_[_0xb056('0x35')](_0xd82e9[_0xb056('0x3f')],function(_0x5ba4b4){var _0x13ea6a={};_0x13ea6a[_0x5ba4b4]={'$like':'%'+_0x5021d2['query'][_0xb056('0x47')]+'%'};return _0x13ea6a;})});}_0xd82e9=_[_0xb056('0x48')]({},_0xd82e9,_0x5021d2[_0xb056('0x4a')]);return _0x38b119[_0xb056('0x82')](_0xd82e9);}})[_0xb056('0x2b')](function(_0x48dbfb){if(_0x48dbfb){_0xcdd8d6=_0x48dbfb[_0xb056('0x41')];if(!_0x5021d2[_0xb056('0x3b')][_0xb056('0x42')](_0xb056('0x43'))){_0xd82e9[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x23')]);_0xd82e9[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x22')]);}return _0x38b119[_0xb056('0x82')](_0xd82e9);}})[_0xb056('0x2b')](function(_0x3837af){if(_0x3837af){return _0x3837af?{'count':_0xcdd8d6,'rows':_0x3837af}:null;}})[_0xb056('0x2b')](respondWithResult(_0x41532c,null))[_0xb056('0x4f')](handleError(_0x41532c,null));};exports[_0xb056('0x83')]=function(_0x1a8d5b,_0x341a86,_0x506e61){var _0x263bbe=_0x1a8d5b[_0xb056('0x56')][_0xb056('0x77')];var _0x3de775;return db[_0xb056('0x81')][_0xb056('0x4d')]({'where':{'id':_0x263bbe},'attributes':['id'],'include':[{'model':db[_0xb056('0x84')],'as':_0xb056('0x85'),'attributes':['id',_0xb056('0x32'),_0xb056('0x86'),_0xb056('0x87'),'interface'],'raw':!![]}]})['then'](function(_0x330dd3){if(_0x330dd3){_0x3de775=_0x330dd3;var _0x5e5b65=_[_0xb056('0x88')](_0x330dd3,function(_0x88e59f){var _0x2b36b0=_0x88e59f['get']({'plain':!![]});return _0x2b36b0[_0xb056('0x85')];});return db[_0xb056('0x36')]['find']({'where':{'id':_0x1a8d5b['params']['id']}})[_0xb056('0x2b')](function(_0x3f80ab){return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x11276e){return _0x3f80ab['addTeams'](_0x263bbe,{'transaction':_0x11276e})['then'](function(){return BPromise[_0xb056('0x89')](_0x3de775,function(_0x587fcc){return db[_0xb056('0x8a')][_0xb056('0x8b')]({'TeamId':_0x587fcc['id'],'VoicePrefixId':_0x1a8d5b[_0xb056('0x50')]['id']},{'transaction':_0x11276e});});})[_0xb056('0x2b')](function(){return BPromise['each'](_0x5e5b65,function(_0x31fc76){return db[_0xb056('0x8c')][_0xb056('0x8d')]({'where':{'UserId':_0x31fc76['id'],'VoicePrefixId':_0x1a8d5b[_0xb056('0x50')]['id']},'transaction':_0x11276e});});})[_0xb056('0x2b')](function(){_0x5e5b65[_0xb056('0x8e')](function(_0x221269){socket['emit'](_0xb056('0x7a'),{'UserId':_0x221269['id'],'VoicePrefixId':_0x3f80ab['id']});});});});});}})[_0xb056('0x2b')](respondWithStatusCode(_0x341a86,null))[_0xb056('0x4f')](handleError(_0x341a86,null));};exports[_0xb056('0x8f')]=function(_0x38c9fd,_0x3d277a,_0x3803bc){return db['Team'][_0xb056('0x4d')]({'where':{'id':_0x38c9fd[_0xb056('0x3b')][_0xb056('0x77')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb056('0x2b')](handleEntityNotFound(_0x3d277a,null))['then'](function(_0x59020b){var _0x158f35=_[_0xb056('0x35')](_0x59020b,'id');var _0x18ee53=[];var _0xc4c8b4=[];var _0x1cca4d=squel[_0xb056('0x90')]();_0x1cca4d[_0xb056('0x91')](_0xb056('0x92'))['from']('team_has_voice_prefixes','tq')[_0xb056('0x93')](_0xb056('0x94'),'ut',_0xb056('0x95'))[_0xb056('0x45')](_0xb056('0x96'),_0x38c9fd[_0xb056('0x50')]['id']);for(var _0x5a7549=0x0;_0x5a7549<_0x59020b['length'];_0x5a7549+=0x1){let _0x4c9894=_0x59020b[_0x5a7549];for(var _0x2b75e4=0x0;_0x2b75e4<_0x4c9894['Agents'][_0xb056('0x41')];_0x2b75e4+=0x1){let _0x505f0d=_0x4c9894[_0xb056('0x85')][_0x2b75e4];var _0x462eb8=_0x1cca4d[_0xb056('0x97')]();_0x462eb8[_0xb056('0x45')](_0xb056('0x98'),_0x505f0d['id']);_0xc4c8b4[_0xb056('0x6f')](db[_0xb056('0x54')]['query'](_0x462eb8[_0xb056('0x99')](),{'type':db[_0xb056('0x54')][_0xb056('0x9a')][_0xb056('0x9b')]})[_0xb056('0x2b')](function(_0x499233){if(_0x499233[_0xb056('0x41')]===0x1){return _0x505f0d['id'];}else{var _0x391783=_[_0xb056('0x9c')](_[_0xb056('0x35')](_0x499233,_0xb056('0x9d')),function(_0x2f08e1){return _[_0xb056('0x9e')](_0x158f35,_0x2f08e1);});if(_0x391783){return _0x505f0d['id'];}}}));}}return BPromise[_0xb056('0x9f')](_0xc4c8b4)[_0xb056('0x2b')](function(_0x42b105){_0x18ee53=_(_0x18ee53)[_0xb056('0xa0')](_0x42b105)['compact']()[_0xb056('0xa1')]();return db[_0xb056('0x36')]['find']({'where':{'id':_0x38c9fd['params']['id']}})['then'](function(_0x512997){return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x2f7ca9){return _0x512997[_0xb056('0x8f')](_0x38c9fd[_0xb056('0x3b')][_0xb056('0x77')],{'transaction':_0x2f7ca9})[_0xb056('0x2b')](function(){if(!_['isEmpty'](_0x18ee53)){return _0x512997[_0xb056('0x7b')](_0x18ee53,{'transaction':_0x2f7ca9});}})['then'](function(){_0x18ee53['forEach'](function(_0x33b1ad){socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':_0x33b1ad,'VoicePrefixId':_0x512997['id']});});});});});});})[_0xb056('0x2b')](respondWithStatusCode(_0x3d277a,null))[_0xb056('0x4f')](handleError(_0x3d277a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ff8efb7..7ac77ac 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 _0x8d73=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x3e76d8,_0x35c413){var _0x42c25b=function(_0x4396bc){while(--_0x4396bc){_0x3e76d8['push'](_0x3e76d8['shift']());}};_0x42c25b(++_0x35c413);}(_0x8d73,0x17a));var _0x38d7=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0x8d73[_0x3246b4];return _0x34b3d7;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x38d7('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x38d7('0x1'),'afterUpdate':_0x38d7('0x2'),'afterDestroy':_0x38d7('0x3')};function emitEvent(_0x5bfba3){return function(_0x54ed5e,_0xacc5a3,_0x3129b6){VoicePrefixEvents[_0x38d7('0x4')](_0x5bfba3+':'+_0x54ed5e['id'],_0x54ed5e);VoicePrefixEvents[_0x38d7('0x4')](_0x5bfba3,_0x54ed5e);_0x3129b6(null);};}for(var e in events){if(events[_0x38d7('0x5')](e)){var event=events[e];VoicePrefix[_0x38d7('0x6')](e,emitEvent(event));}}module[_0x38d7('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xf3ae=['events','VoicePrefix','update','remove','emit','hasOwnProperty','hook'];(function(_0x5ab297,_0x1540aa){var _0x565b16=function(_0x3bd02a){while(--_0x3bd02a){_0x5ab297['push'](_0x5ab297['shift']());}};_0x565b16(++_0x1540aa);}(_0xf3ae,0x1c7));var _0xef3a=function(_0x3b4598,_0xd5c321){_0x3b4598=_0x3b4598-0x0;var _0x493289=_0xf3ae[_0x3b4598];return _0x493289;};'use strict';var EventEmitter=require(_0xef3a('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xef3a('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xef3a('0x2'),'afterDestroy':_0xef3a('0x3')};function emitEvent(_0x9e32e1){return function(_0x25e83b,_0x2de66b,_0x23bc89){VoicePrefixEvents['emit'](_0x9e32e1+':'+_0x25e83b['id'],_0x25e83b);VoicePrefixEvents[_0xef3a('0x4')](_0x9e32e1,_0x25e83b);_0x23bc89(null);};}for(var e in events){if(events[_0xef3a('0x5')](e)){var event=events[e];VoicePrefix[_0xef3a('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a9a9422..68602ac 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 _0xefc0=['api','moment','bluebird','request-promise','path','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xefc0,0x148));var _0x0efc=function(_0x381bdf,_0x2d1279){_0x381bdf=_0x381bdf-0x0;var _0x1d482a=_0xefc0[_0x381bdf];return _0x1d482a;};'use strict';var _=require(_0x0efc('0x0'));var util=require('util');var logger=require(_0x0efc('0x1'))(_0x0efc('0x2'));var moment=require(_0x0efc('0x3'));var BPromise=require(_0x0efc('0x4'));var rp=require(_0x0efc('0x5'));var fs=require('fs');var path=require(_0x0efc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0efc('0x7'));module[_0x0efc('0x8')]=function(_0x13fcdf,_0x5e569a){return _0x13fcdf['define'](_0x0efc('0x9'),attributes,{'tableName':_0x0efc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45f2=['util','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','define','voice_prefixes','lodash'];(function(_0x3dee12,_0x2a6eaa){var _0x202a4a=function(_0x41ce2c){while(--_0x41ce2c){_0x3dee12['push'](_0x3dee12['shift']());}};_0x202a4a(++_0x2a6eaa);}(_0x45f2,0xc5));var _0x245f=function(_0x93368c,_0x5075d3){_0x93368c=_0x93368c-0x0;var _0x1e9b49=_0x45f2[_0x93368c];return _0x1e9b49;};'use strict';var _=require(_0x245f('0x0'));var util=require(_0x245f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x245f('0x2'));var rp=require(_0x245f('0x3'));var fs=require('fs');var path=require(_0x245f('0x4'));var rimraf=require(_0x245f('0x5'));var config=require('../../config/environment');var attributes=require(_0x245f('0x6'));module['exports']=function(_0x576609,_0x103eba){return _0x576609[_0x245f('0x7')]('VoicePrefix',attributes,{'tableName':_0x245f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 5001cb2..bb03861 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 _0x8b52=['http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x293f4a,_0x2cfcdd){var _0x4648de=function(_0x149dc9){while(--_0x149dc9){_0x293f4a['push'](_0x293f4a['shift']());}};_0x4648de(++_0x2cfcdd);}(_0x8b52,0x151));var _0x28b5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8b52[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x28b5('0x0'));var util=require(_0x28b5('0x1'));var moment=require(_0x28b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x28b5('0x3'));var fs=require('fs');var Redis=require(_0x28b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28b5('0x5'));var logger=require(_0x28b5('0x6'))(_0x28b5('0x7'));var config=require(_0x28b5('0x8'));var jayson=require(_0x28b5('0x9'));var client=jayson[_0x28b5('0xa')][_0x28b5('0xb')]({'port':0x232a});config[_0x28b5('0xc')]=_[_0x28b5('0xd')](config['redis'],{'host':_0x28b5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x28b5('0xf'))[_0x28b5('0x10')](socket);function respondWithRpcPromise(_0x4f2a41,_0xd8f394,_0x315ed6){return new BPromise(function(_0x4d3d4e,_0x10d2b5){return client[_0x28b5('0x11')](_0x4f2a41,_0x315ed6)[_0x28b5('0x12')](function(_0x6b22a8){logger['info'](_0x28b5('0x13'),_0xd8f394,'request\x20sent');logger[_0x28b5('0x14')](_0x28b5('0x15'),_0xd8f394,'request\x20sent',JSON[_0x28b5('0x16')](_0x6b22a8));if(_0x6b22a8['error']){if(_0x6b22a8[_0x28b5('0x17')]['code']===0x1f4){logger['error'](_0x28b5('0x13'),_0xd8f394,_0x6b22a8[_0x28b5('0x17')]['message']);return _0x10d2b5(_0x6b22a8[_0x28b5('0x17')][_0x28b5('0x18')]);}logger[_0x28b5('0x17')](_0x28b5('0x13'),_0xd8f394,_0x6b22a8[_0x28b5('0x17')]['message']);return _0x4d3d4e(_0x6b22a8[_0x28b5('0x17')]['message']);}else{logger[_0x28b5('0x19')](_0x28b5('0x13'),_0xd8f394,_0x28b5('0x1a'));_0x4d3d4e(_0x6b22a8[_0x28b5('0x1b')]['message']);}})[_0x28b5('0x1c')](function(_0x1396cf){logger[_0x28b5('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xd8f394,_0x1396cf);_0x10d2b5(_0x1396cf);});});} \ No newline at end of file +var _0x94ff=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring','ioredis'];(function(_0x5b5a8e,_0x31b46e){var _0x57a65e=function(_0x37033e){while(--_0x37033e){_0x5b5a8e['push'](_0x5b5a8e['shift']());}};_0x57a65e(++_0x31b46e);}(_0x94ff,0xc3));var _0xf94f=function(_0x578737,_0x144beb){_0x578737=_0x578737-0x0;var _0x2f0222=_0x94ff[_0x578737];return _0x2f0222;};'use strict';var _=require(_0xf94f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf94f('0x1'));var fs=require('fs');var Redis=require(_0xf94f('0x2'));var db=require(_0xf94f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf94f('0x4'))(_0xf94f('0x5'));var config=require('../../config/environment');var jayson=require(_0xf94f('0x6'));var client=jayson[_0xf94f('0x7')]['http']({'port':0x232a});config[_0xf94f('0x8')]=_['defaults'](config[_0xf94f('0x8')],{'host':_0xf94f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94f('0x8')]));require(_0xf94f('0xa'))[_0xf94f('0xb')](socket);function respondWithRpcPromise(_0x57b900,_0x5c518f,_0x510972){return new BPromise(function(_0x2d3ea6,_0x234f34){return client[_0xf94f('0xc')](_0x57b900,_0x510972)[_0xf94f('0xd')](function(_0x18a8a6){logger[_0xf94f('0xe')](_0xf94f('0xf'),_0x5c518f,_0xf94f('0x10'));logger['debug'](_0xf94f('0x11'),_0x5c518f,_0xf94f('0x10'),JSON[_0xf94f('0x12')](_0x18a8a6));if(_0x18a8a6[_0xf94f('0x13')]){if(_0x18a8a6['error'][_0xf94f('0x14')]===0x1f4){logger[_0xf94f('0x13')](_0xf94f('0xf'),_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x234f34(_0x18a8a6[_0xf94f('0x13')]['message']);}logger[_0xf94f('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x2d3ea6(_0x18a8a6['error']['message']);}else{logger['info'](_0xf94f('0xf'),_0x5c518f,'request\x20sent');_0x2d3ea6(_0x18a8a6['result'][_0xf94f('0x15')]);}})['catch'](function(_0x33defc){logger['error'](_0xf94f('0xf'),_0x5c518f,_0x33defc);_0x234f34(_0x33defc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0e10410..1bcfa6e 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 _0x99b7=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x24a26b,_0x49c278){var _0x3ebfd0=function(_0x2f1f9c){while(--_0x2f1f9c){_0x24a26b['push'](_0x24a26b['shift']());}};_0x3ebfd0(++_0x49c278);}(_0x99b7,0x14e));var _0x799b=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x99b7[_0xfbdff6];return _0x4cb9be;};'use strict';var VoicePrefixEvents=require(_0x799b('0x0'));var events=['save',_0x799b('0x1'),'update'];function createListener(_0x5ae2c3,_0x58056f){return function(_0x41135c){_0x58056f[_0x799b('0x2')](_0x5ae2c3,_0x41135c);};}function removeListener(_0x43adef,_0x4cafd5){return function(){VoicePrefixEvents[_0x799b('0x3')](_0x43adef,_0x4cafd5);};}exports[_0x799b('0x4')]=function(_0x3959ed){for(var _0x70f082=0x0,_0xfd685a=events[_0x799b('0x5')];_0x70f082<_0xfd685a;_0x70f082++){var _0x4b901a=events[_0x70f082];var _0x418a70=createListener(_0x799b('0x6')+_0x4b901a,_0x3959ed);VoicePrefixEvents['on'](_0x4b901a,_0x418a70);}}; \ No newline at end of file +var _0x9181=['length','./voicePrefix.events','save','remove','update','removeListener','register'];(function(_0x548796,_0x4979b0){var _0x6b4a3e=function(_0x2d584d){while(--_0x2d584d){_0x548796['push'](_0x548796['shift']());}};_0x6b4a3e(++_0x4979b0);}(_0x9181,0x182));var _0x1918=function(_0x21ac6b,_0x94a519){_0x21ac6b=_0x21ac6b-0x0;var _0x47fc34=_0x9181[_0x21ac6b];return _0x47fc34;};'use strict';var VoicePrefixEvents=require(_0x1918('0x0'));var events=[_0x1918('0x1'),_0x1918('0x2'),_0x1918('0x3')];function createListener(_0x14f2f5,_0x5e59d9){return function(_0x2c0e9b){_0x5e59d9['emit'](_0x14f2f5,_0x2c0e9b);};}function removeListener(_0x32e178,_0x5d37ed){return function(){VoicePrefixEvents[_0x1918('0x4')](_0x32e178,_0x5d37ed);};}exports[_0x1918('0x5')]=function(_0x424951){for(var _0x4106d7=0x0,_0x4cf696=events[_0x1918('0x6')];_0x4106d7<_0x4cf696;_0x4106d7++){var _0x54a715=events[_0x4106d7];var _0x434acb=createListener('voicePrefix:'+_0x54a715,_0x424951);VoicePrefixEvents['on'](_0x54a715,_0x434acb);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7e5b99a..678752c 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 _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(_0x384c23,_0x30cd65){var _0x1fdf67=function(_0x21d205){while(--_0x21d205){_0x384c23['push'](_0x384c23['shift']());}};_0x1fdf67(++_0x30cd65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 +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(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xb10b,0x12a));var _0xbb10=function(_0xd745e9,_0x537598){_0xd745e9=_0xd745e9-0x0;var _0x5f02a2=_0xb10b[_0xd745e9];return _0x5f02a2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 7bed55a..ca1c82a 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 _0xe54a=['BOOLEAN','progressive','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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\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,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','setDataValue','getDataValue','type','dialMethod','strategy','preview','roundrobin','INTEGER','yes','all','once','TEXT','join','periodic_announce','joinempty','leavewhenempty','split'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0xe54a,0x1b5));var _0xae54=function(_0x3d22b1,_0x25ec59){_0x3d22b1=_0x3d22b1-0x0;var _0x1e99e7=_0xe54a[_0x3d22b1];return _0x1e99e7;};'use strict';var Sequelize=require(_0xae54('0x0'));module[_0xae54('0x1')]={'name':{'type':Sequelize[_0xae54('0x2')],'allowNull':![],'unique':_0xae54('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x5'),_0xae54('0x6')),'allowNull':![],'defaultValue':_0xae54('0x5')},'musiconhold':{'type':Sequelize[_0xae54('0x2')],'defaultValue':_0xae54('0x7')},'announce':{'type':Sequelize[_0xae54('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xae54('0x4')]('rr',_0xae54('0x8'),_0xae54('0x9'),'fewestcalls',_0xae54('0xa'),_0xae54('0xb'),_0xae54('0xc'),_0xae54('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0xae54('0x8'),'set':function(_0x4d9eb8){this[_0xae54('0xe')]('strategy',_0x4d9eb8?_0x4d9eb8:_0xae54('0xb'));},'get':function(){var _0x2ad65c=this[_0xae54('0xf')](_0xae54('0x10'));var _0x227d54=this[_0xae54('0xf')](_0xae54('0x11'));var _0x28bd95=this[_0xae54('0xf')](_0xae54('0x12'));if(_0x2ad65c===_0xae54('0x6')){if(_0x227d54===_0xae54('0x13')){return null;}if(_0x227d54==='booked'&&!['rrmemory',_0xae54('0x14')]['includes'](_0x28bd95)){this['setDataValue'](_0xae54('0x12'),'rrmemory');}}return _0x28bd95;}},'servicelevel':{'type':Sequelize[_0xae54('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xae54('0x15')](0xb)},'timeout':{'type':Sequelize[_0xae54('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xae54('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xae54('0x2')]},'weight':{'type':Sequelize[_0xae54('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xae54('0x16')},'autopause':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no',_0xae54('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xae54('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xae54('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xae54('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xae54('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xae54('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xae54('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xae54('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':_0xae54('0x16')},'announce_holdtime':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no',_0xae54('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xae54('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xae54('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xae54('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xae54('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xae54('0x2')]},'queue_youarenext':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xae54('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xae54('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xae54('0x19')],'set':function(_0x3038b0){this['setDataValue']('periodic_announce',_0x3038b0?_0x3038b0[_0xae54('0x1a')](','):[]);},'get':function(){return this[_0xae54('0xf')](_0xae54('0x1b'))?this[_0xae54('0xf')](_0xae54('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4edafa){this[_0xae54('0xe')](_0xae54('0x1c'),_0x4edafa?_0x4edafa[_0xae54('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xae54('0x1c'))?this[_0xae54('0xf')](_0xae54('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xae54('0x2')],'defaultValue':'no','set':function(_0x38221e){this['setDataValue'](_0xae54('0x1d'),_0x38221e?_0x38221e['join'](','):undefined);},'get':function(){return this[_0xae54('0xf')](_0xae54('0x1d'))?this[_0xae54('0xf')](_0xae54('0x1d'))[_0xae54('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xae54('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xae54('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xae54('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xae54('0x1f')],'defaultValue':0x0,'set':function(_0x5bb2a6){this[_0xae54('0xe')]('acw',_0x5bb2a6);if(_0x5bb2a6){if(this[_0xae54('0xf')]('wrapuptime')<0x2){this[_0xae54('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xae54('0x13'),_0xae54('0x20'),'power',_0xae54('0x21'),_0xae54('0x22')),'defaultValue':_0xae54('0x20'),'comment':_0xae54('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xae54('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae54('0x25')},'dialLimitQueue':{'type':Sequelize[_0xae54('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae54('0x26')},'dialPowerLevel':{'type':Sequelize[_0xae54('0x27')](0x2)[_0xae54('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xae54('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xae54('0x29'),'dropRate'),'defaultValue':_0xae54('0x2a'),'comment':_0xae54('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xae54('0x27')](0x2)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xae54('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xae54('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xae54('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xae54('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xae54('0x2')],'defaultValue':_0xae54('0x2e'),'comment':_0xae54('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae54('0x30')},'dialQueueProject':{'type':Sequelize[_0xae54('0x2')],'comment':_0xae54('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'comment':_0xae54('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xae54('0x36')},'dialTimezone':{'type':Sequelize[_0xae54('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xae54('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':_0xae54('0x38')},'dialAMDActive':{'type':Sequelize[_0xae54('0x1f')],'defaultValue':0x0,'comment':_0xae54('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae54('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xae54('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xae54('0x15')](0x9)[_0xae54('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xae54('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae54('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xae54('0x15')](0x9)[_0xae54('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xae54('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xae54('0x15')](0x9)[_0xae54('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xae54('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xae54('0x15')](0x9)[_0xae54('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xae54('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xae54('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xae54('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xae54('0x15')](0x9)[_0xae54('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xae54('0x15')](0x5)[_0xae54('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xae54('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xae54('0x1f')],'defaultValue':0x0,'comment':_0xae54('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0xae54('0x4')](_0xae54('0x42'),_0xae54('0x43')),'defaultValue':_0xae54('0x42')},'dialQueueProject2':{'type':Sequelize[_0xae54('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xae54('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xae54('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae54('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae54('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)[_0xae54('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae54('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xae54('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae54('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xae54('0x15')](0x5)[_0xae54('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae54('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae54('0x15')],'allowNull':!![],'comment':_0xae54('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae54('0x4c'),'set':function(_0x5b46a4){if(!_0x5b46a4)this[_0xae54('0xe')](_0xae54('0x4d'),null);this[_0xae54('0xe')]('mandatoryDisposition',_0x5b46a4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xae54('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xae54('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xae54('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xae54('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb51=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','name','ENUM','inbound','outbound','STRING','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','dialMethod','getDataValue','preview','booked','includes','strategy','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0xfb51,0xfb));var _0x1fb5=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0xfb51[_0x51bdda];return _0x998aab;};'use strict';var Sequelize=require(_0x1fb5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1fb5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x3'),_0x1fb5('0x4')),'allowNull':![],'defaultValue':_0x1fb5('0x3')},'musiconhold':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1fb5('0x6'),_0x1fb5('0x7'),_0x1fb5('0x8'),_0x1fb5('0x9'),_0x1fb5('0xa'),_0x1fb5('0xb'),_0x1fb5('0xc')),'allowNull':![],'defaultValue':_0x1fb5('0xd'),'set':function(_0x4e6d12){this[_0x1fb5('0xe')]('strategy',_0x4e6d12?_0x4e6d12:_0x1fb5('0x9'));},'get':function(){var _0x3bc3d3=this['getDataValue']('type');var _0x2120ff=this['getDataValue'](_0x1fb5('0xf'));var _0x2e12d6=this[_0x1fb5('0x10')]('strategy');if(_0x3bc3d3===_0x1fb5('0x4')){if(_0x2120ff===_0x1fb5('0x11')){return null;}if(_0x2120ff===_0x1fb5('0x12')&&![_0x1fb5('0x9'),'roundrobin'][_0x1fb5('0x13')](_0x2e12d6)){this['setDataValue'](_0x1fb5('0x14'),'rrmemory');}}return _0x2e12d6;}},'servicelevel':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1fb5('0x15')](0xb)},'timeout':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1fb5('0x5')]},'weight':{'type':Sequelize[_0x1fb5('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x1fb5('0x16'),'no'),'defaultValue':_0x1fb5('0x16')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x1fb5('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1fb5('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1fb5('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1fb5('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1fb5('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1fb5('0x2')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no',_0x1fb5('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1fb5('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1fb5('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1fb5('0x5')]},'queue_quantity1':{'type':Sequelize[_0x1fb5('0x5')]},'queue_quantity2':{'type':Sequelize[_0x1fb5('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x1fb5('0x5')]},'queue_less_than':{'type':Sequelize[_0x1fb5('0x5')]},'periodic_announce':{'type':Sequelize[_0x1fb5('0x19')],'set':function(_0x1d6cdb){this[_0x1fb5('0xe')]('periodic_announce',_0x1d6cdb?_0x1d6cdb[_0x1fb5('0x1a')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x1fb5('0x10')](_0x1fb5('0x1b'))[_0x1fb5('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':_0x1fb5('0x16'),'set':function(_0x450406){this[_0x1fb5('0xe')]('joinempty',_0x450406?_0x450406[_0x1fb5('0x1a')](','):undefined);},'get':function(){return this[_0x1fb5('0x10')](_0x1fb5('0x1d'))?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1a987b){this[_0x1fb5('0xe')]('leavewhenempty',_0x1a987b?_0x1a987b[_0x1fb5('0x1a')](','):undefined);},'get':function(){return this[_0x1fb5('0x10')](_0x1fb5('0x1e'))?this[_0x1fb5('0x10')](_0x1fb5('0x1e'))[_0x1fb5('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1fb5('0x5')]},'acw':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':0x0,'set':function(_0x3cbdb2){this[_0x1fb5('0xe')]('acw',_0x3cbdb2);if(_0x3cbdb2){if(this[_0x1fb5('0x10')](_0x1fb5('0x20'))<0x2){this[_0x1fb5('0xe')](_0x1fb5('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1fb5('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':0x0,'comment':_0x1fb5('0x21')},'dialMethod':{'type':Sequelize[_0x1fb5('0x2')](_0x1fb5('0x11'),'progressive',_0x1fb5('0x22'),'predictive',_0x1fb5('0x12')),'defaultValue':'progressive','comment':_0x1fb5('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1fb5('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1fb5('0x25')},'dialLimitQueue':{'type':Sequelize[_0x1fb5('0x15')](0x4)[_0x1fb5('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1fb5('0x26')},'dialPowerLevel':{'type':Sequelize[_0x1fb5('0x27')](0x2)[_0x1fb5('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1fb5('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1fb5('0x29'),_0x1fb5('0x2a')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1fb5('0x27')](0x2)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1fb5('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1fb5('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':_0x1fb5('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'comment':_0x1fb5('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1fb5('0x33')},'dialTimezone':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x1fb5('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x1fb5('0x34'),_0x1fb5('0x35')),'defaultValue':_0x1fb5('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1fb5('0x15')](0x9)[_0x1fb5('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1fb5('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1fb5('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1fb5('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1fb5('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1fb5('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1fb5('0x15')](0x9)[_0x1fb5('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1fb5('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x1fb5('0x15')](0x9)[_0x1fb5('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1fb5('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1fb5('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1fb5('0x15')](0x9)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1fb5('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1fb5('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1fb5('0x15')](0x9)[_0x1fb5('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1fb5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1fb5('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1fb5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1fb5('0x2')]('DESC',_0x1fb5('0x41')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1fb5('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1fb5('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1fb5('0x43')},'dialCutDigit':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1fb5('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1fb5('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1fb5('0x15')](0x5)[_0x1fb5('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1fb5('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1fb5('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x55e3f0){if(!_0x55e3f0)this[_0x1fb5('0xe')]('mandatoryDispositionPauseId',null);this[_0x1fb5('0xe')](_0x1fb5('0x4d'),_0x55e3f0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1fb5('0x15')](0x3)[_0x1fb5('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1fb5('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0983c39..9e35f98 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 _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x41b58a,_0x2c8e4a){var _0x5c9819=function(_0x33ad04){while(--_0x33ad04){_0x41b58a['push'](_0x41b58a['shift']());}};_0x5c9819(++_0x2c8e4a);}(_0xa41a,0x6b));var _0xaa41=function(_0x5e271c,_0x125cee){_0x5e271c=_0x5e271c-0x0;var _0x3bf784=_0xa41a[_0x5e271c];return _0x3bf784;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x365525,_0x5100df){var _0x25e46a=function(_0x584807){while(--_0x584807){_0x365525['push'](_0x365525['shift']());}};_0x25e46a(++_0x5100df);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x36a997,_0x288f0b){_0x36a997=_0x36a997-0x0;var _0x561b1b=_0x7fbe[_0x36a997];return _0x561b1b;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 308ab41..be8ec83 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 _0xe2a5=['hook','exports','events','../../mysqldb','VoiceQueue','save','update','hasOwnProperty'];(function(_0x1bf768,_0x2c4769){var _0x34d6e0=function(_0x2a7258){while(--_0x2a7258){_0x1bf768['push'](_0x1bf768['shift']());}};_0x34d6e0(++_0x2c4769);}(_0xe2a5,0x1da));var _0x5e2a=function(_0x173e96,_0x5cffd7){_0x173e96=_0x173e96-0x0;var _0x2d0cdb=_0xe2a5[_0x173e96];return _0x2d0cdb;};'use strict';var EventEmitter=require(_0x5e2a('0x0'));var VoiceQueue=require(_0x5e2a('0x1'))['db'][_0x5e2a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e2a('0x3'),'afterUpdate':_0x5e2a('0x4'),'afterDestroy':'remove'};function emitEvent(_0xabb0e2){return function(_0x18536d,_0x15c1f9,_0x4932db){VoiceQueueEvents['emit'](_0xabb0e2+':'+_0x18536d['id'],_0x18536d);VoiceQueueEvents['emit'](_0xabb0e2,_0x18536d);_0x4932db(null);};}for(var e in events){if(events[_0x5e2a('0x5')](e)){var event=events[e];VoiceQueue[_0x5e2a('0x6')](e,emitEvent(event));}}module[_0x5e2a('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xc261=['hook','exports','events','VoiceQueue','save','update','remove','emit'];(function(_0x8ef4e9,_0x4ef148){var _0x52a070=function(_0x495417){while(--_0x495417){_0x8ef4e9['push'](_0x8ef4e9['shift']());}};_0x52a070(++_0x4ef148);}(_0xc261,0xea));var _0x1c26=function(_0x3a9a4c,_0x17e065){_0x3a9a4c=_0x3a9a4c-0x0;var _0x397fb3=_0xc261[_0x3a9a4c];return _0x397fb3;};'use strict';var EventEmitter=require(_0x1c26('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x1c26('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c26('0x2'),'afterUpdate':_0x1c26('0x3'),'afterDestroy':_0x1c26('0x4')};function emitEvent(_0x3a7cc2){return function(_0xa1c13d,_0x1fa77b,_0x58ee13){VoiceQueueEvents[_0x1c26('0x5')](_0x3a7cc2+':'+_0xa1c13d['id'],_0xa1c13d);VoiceQueueEvents['emit'](_0x3a7cc2,_0xa1c13d);_0x58ee13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x1c26('0x6')](e,emitEvent(event));}}module[_0x1c26('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 a985dd8..c1eb9d7 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x25b314,_0x2af525){var _0x2f267f=function(_0x38061b){while(--_0x38061b){_0x25b314['push'](_0x25b314['shift']());}};_0x2f267f(++_0x2af525);}(_0x3e74,0x175));var _0x43e7=function(_0x3c6100,_0x16ce8b){_0x3c6100=_0x3c6100-0x0;var _0x5bd99b=_0x3e74[_0x3c6100];return _0x5bd99b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x70e0,0x17b));var _0x070e=function(_0x4fb819,_0x44f42a){_0x4fb819=_0x4fb819-0x0;var _0x2ff634=_0x70e0[_0x4fb819];return _0x2ff634;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 64424fa..c81601c 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 _0x4926=['attributes','include','map','model','GetVoiceQueue','debug','ShowVoiceQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','VoiceQueue','findAll','options','where'];(function(_0x4de74d,_0x154c5f){var _0x259706=function(_0x237371){while(--_0x237371){_0x4de74d['push'](_0x4de74d['shift']());}};_0x259706(++_0x154c5f);}(_0x4926,0xd6));var _0x6492=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x4926[_0x14363e];return _0x17c56d;};'use strict';var _=require(_0x6492('0x0'));var util=require('util');var moment=require(_0x6492('0x1'));var BPromise=require(_0x6492('0x2'));var rs=require(_0x6492('0x3'));var fs=require('fs');var Redis=require(_0x6492('0x4'));var db=require(_0x6492('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6492('0x6'))(_0x6492('0x7'));var config=require(_0x6492('0x8'));var jayson=require(_0x6492('0x9'));var client=jayson['client'][_0x6492('0xa')]({'port':0x232a});config[_0x6492('0xb')]=_[_0x6492('0xc')](config[_0x6492('0xb')],{'host':_0x6492('0xd'),'port':0x18eb});var socket=require(_0x6492('0xe'))(new Redis(config[_0x6492('0xb')]));require(_0x6492('0xf'))[_0x6492('0x10')](socket);function respondWithRpcPromise(_0x5dc856,_0x471b1c,_0x1d8f74){return new BPromise(function(_0x474acb,_0x517c2d){return client[_0x6492('0x11')](_0x5dc856,_0x1d8f74)[_0x6492('0x12')](function(_0x2ff986){logger['info'](_0x6492('0x13'),_0x471b1c,_0x6492('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x471b1c,'request\x20sent',JSON[_0x6492('0x15')](_0x2ff986));if(_0x2ff986['error']){if(_0x2ff986['error'][_0x6492('0x16')]===0x1f4){logger[_0x6492('0x17')](_0x6492('0x13'),_0x471b1c,_0x2ff986[_0x6492('0x17')][_0x6492('0x18')]);return _0x517c2d(_0x2ff986[_0x6492('0x17')][_0x6492('0x18')]);}logger[_0x6492('0x17')](_0x6492('0x13'),_0x471b1c,_0x2ff986[_0x6492('0x17')]['message']);return _0x474acb(_0x2ff986['error'][_0x6492('0x18')]);}else{logger[_0x6492('0x19')](_0x6492('0x13'),_0x471b1c,'request\x20sent');_0x474acb(_0x2ff986[_0x6492('0x1a')][_0x6492('0x18')]);}})[_0x6492('0x1b')](function(_0x256c50){logger[_0x6492('0x17')](_0x6492('0x13'),_0x471b1c,_0x256c50);_0x517c2d(_0x256c50);});});}exports['GetVoiceQueue']=function(_0x484b9b){var _0x326682=this;return new Promise(function(_0x17f178,_0x545226){return db[_0x6492('0x1c')][_0x6492('0x1d')]({'raw':_0x484b9b[_0x6492('0x1e')]?_0x484b9b[_0x6492('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x484b9b['options']?_0x484b9b[_0x6492('0x1e')][_0x6492('0x1f')]||null:null,'attributes':_0x484b9b['options']?_0x484b9b['options'][_0x6492('0x20')]||null:null,'limit':_0x484b9b[_0x6492('0x1e')]?_0x484b9b[_0x6492('0x1e')]['limit']||null:null,'include':_0x484b9b[_0x6492('0x1e')]?_0x484b9b[_0x6492('0x1e')][_0x6492('0x21')]?_[_0x6492('0x22')](_0x484b9b[_0x6492('0x1e')][_0x6492('0x21')],function(_0x4160db){return{'model':db[_0x4160db[_0x6492('0x23')]],'as':_0x4160db['as'],'attributes':_0x4160db[_0x6492('0x20')],'include':_0x4160db[_0x6492('0x21')]?_[_0x6492('0x22')](_0x4160db['include'],function(_0x17c5e1){return{'model':db[_0x17c5e1[_0x6492('0x23')]],'as':_0x17c5e1['as'],'attributes':_0x17c5e1['attributes'],'include':_0x17c5e1['include']?_[_0x6492('0x22')](_0x17c5e1['include'],function(_0x41164f){return{'model':db[_0x41164f[_0x6492('0x23')]],'as':_0x41164f['as'],'attributes':_0x41164f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6492('0x12')](function(_0x27c3a1){logger[_0x6492('0x19')](_0x6492('0x24'),_0x484b9b);logger[_0x6492('0x25')](_0x6492('0x24'),_0x484b9b,JSON['stringify'](_0x27c3a1));_0x17f178(_0x27c3a1);})['catch'](function(_0x550692){logger[_0x6492('0x17')](_0x6492('0x24'),_0x550692[_0x6492('0x18')],_0x484b9b);_0x545226(_0x326682[_0x6492('0x17')](0x1f4,_0x550692['message']));});});};exports[_0x6492('0x26')]=function(_0x3b626b){var _0x518b29=this;return new Promise(function(_0x2d620d,_0x3ca6cc){return db['VoiceQueue'][_0x6492('0x27')]({'raw':_0x3b626b[_0x6492('0x1e')]?_0x3b626b[_0x6492('0x1e')][_0x6492('0x28')]===undefined?!![]:![]:!![],'where':_0x3b626b['options']?_0x3b626b[_0x6492('0x1e')][_0x6492('0x1f')]||null:null,'attributes':_0x3b626b[_0x6492('0x1e')]?_0x3b626b[_0x6492('0x1e')][_0x6492('0x20')]||null:null,'include':_0x3b626b[_0x6492('0x1e')]?_0x3b626b[_0x6492('0x1e')][_0x6492('0x21')]?_[_0x6492('0x22')](_0x3b626b[_0x6492('0x1e')][_0x6492('0x21')],function(_0x56f485){return{'model':db[_0x56f485[_0x6492('0x23')]],'as':_0x56f485['as'],'attributes':_0x56f485[_0x6492('0x20')],'include':_0x56f485[_0x6492('0x21')]?_[_0x6492('0x22')](_0x56f485[_0x6492('0x21')],function(_0x119bd2){return{'model':db[_0x119bd2[_0x6492('0x23')]],'as':_0x119bd2['as'],'attributes':_0x119bd2[_0x6492('0x20')],'include':_0x119bd2[_0x6492('0x21')]?_['map'](_0x119bd2[_0x6492('0x21')],function(_0x9174f2){return{'model':db[_0x9174f2['model']],'as':_0x9174f2['as'],'attributes':_0x9174f2[_0x6492('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6492('0x12')](function(_0x4825f9){logger[_0x6492('0x19')](_0x6492('0x26'),_0x3b626b);logger['debug'](_0x6492('0x26'),_0x3b626b,JSON[_0x6492('0x15')](_0x4825f9));_0x2d620d(_0x4825f9);})[_0x6492('0x1b')](function(_0x6f14c0){logger[_0x6492('0x17')]('ShowVoiceQueue',_0x6f14c0[_0x6492('0x18')],_0x3b626b);_0x3ca6cc(_0x518b29[_0x6492('0x17')](0x1f4,_0x6f14c0[_0x6492('0x18')]));});});}; \ No newline at end of file +var _0xb221=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','limit','include','model','then','ShowVoiceQueue','map','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0xa66be4,_0x1b2845){var _0x199af6=function(_0x116479){while(--_0x116479){_0xa66be4['push'](_0xa66be4['shift']());}};_0x199af6(++_0x1b2845);}(_0xb221,0x181));var _0x1b22=function(_0x462f1b,_0x4dba85){_0x462f1b=_0x462f1b-0x0;var _0x40b92c=_0xb221[_0x462f1b];return _0x40b92c;};'use strict';var _=require(_0x1b22('0x0'));var util=require('util');var moment=require(_0x1b22('0x1'));var BPromise=require(_0x1b22('0x2'));var rs=require(_0x1b22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b22('0x4'))['db'];var utils=require(_0x1b22('0x5'));var logger=require('../../config/logger')(_0x1b22('0x6'));var config=require(_0x1b22('0x7'));var jayson=require(_0x1b22('0x8'));var client=jayson['client'][_0x1b22('0x9')]({'port':0x232a});config[_0x1b22('0xa')]=_[_0x1b22('0xb')](config['redis'],{'host':_0x1b22('0xc'),'port':0x18eb});var socket=require(_0x1b22('0xd'))(new Redis(config[_0x1b22('0xa')]));require(_0x1b22('0xe'))[_0x1b22('0xf')](socket);function respondWithRpcPromise(_0x12c3c8,_0x441bc1,_0x3a2a6d){return new BPromise(function(_0x24d1c0,_0x5ad7f3){return client[_0x1b22('0x10')](_0x12c3c8,_0x3a2a6d)['then'](function(_0x41bab3){logger[_0x1b22('0x11')](_0x1b22('0x12'),_0x441bc1,'request\x20sent');logger[_0x1b22('0x13')](_0x1b22('0x14'),_0x441bc1,_0x1b22('0x15'),JSON['stringify'](_0x41bab3));if(_0x41bab3[_0x1b22('0x16')]){if(_0x41bab3[_0x1b22('0x16')]['code']===0x1f4){logger[_0x1b22('0x16')](_0x1b22('0x12'),_0x441bc1,_0x41bab3[_0x1b22('0x16')][_0x1b22('0x17')]);return _0x5ad7f3(_0x41bab3[_0x1b22('0x16')][_0x1b22('0x17')]);}logger[_0x1b22('0x16')](_0x1b22('0x12'),_0x441bc1,_0x41bab3[_0x1b22('0x16')]['message']);return _0x24d1c0(_0x41bab3[_0x1b22('0x16')][_0x1b22('0x17')]);}else{logger[_0x1b22('0x11')](_0x1b22('0x12'),_0x441bc1,_0x1b22('0x15'));_0x24d1c0(_0x41bab3[_0x1b22('0x18')][_0x1b22('0x17')]);}})[_0x1b22('0x19')](function(_0x574b22){logger[_0x1b22('0x16')](_0x1b22('0x12'),_0x441bc1,_0x574b22);_0x5ad7f3(_0x574b22);});});}exports[_0x1b22('0x1a')]=function(_0x540a0e){var _0xed78ec=this;return new Promise(function(_0x363118,_0x1928d3){return db[_0x1b22('0x1b')][_0x1b22('0x1c')]({'raw':_0x540a0e['options']?_0x540a0e['options'][_0x1b22('0x1d')]===undefined?!![]:![]:!![],'where':_0x540a0e['options']?_0x540a0e[_0x1b22('0x1e')][_0x1b22('0x1f')]||null:null,'attributes':_0x540a0e['options']?_0x540a0e[_0x1b22('0x1e')][_0x1b22('0x20')]||null:null,'limit':_0x540a0e[_0x1b22('0x1e')]?_0x540a0e[_0x1b22('0x1e')][_0x1b22('0x21')]||null:null,'include':_0x540a0e[_0x1b22('0x1e')]?_0x540a0e[_0x1b22('0x1e')][_0x1b22('0x22')]?_['map'](_0x540a0e[_0x1b22('0x1e')][_0x1b22('0x22')],function(_0x1e3d6a){return{'model':db[_0x1e3d6a[_0x1b22('0x23')]],'as':_0x1e3d6a['as'],'attributes':_0x1e3d6a[_0x1b22('0x20')],'include':_0x1e3d6a[_0x1b22('0x22')]?_['map'](_0x1e3d6a[_0x1b22('0x22')],function(_0x7de4b7){return{'model':db[_0x7de4b7[_0x1b22('0x23')]],'as':_0x7de4b7['as'],'attributes':_0x7de4b7[_0x1b22('0x20')],'include':_0x7de4b7['include']?_['map'](_0x7de4b7[_0x1b22('0x22')],function(_0x32b5dd){return{'model':db[_0x32b5dd['model']],'as':_0x32b5dd['as'],'attributes':_0x32b5dd[_0x1b22('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1b22('0x24')](function(_0x16871a){logger[_0x1b22('0x11')](_0x1b22('0x1a'),_0x540a0e);logger[_0x1b22('0x13')]('GetVoiceQueue',_0x540a0e,JSON['stringify'](_0x16871a));_0x363118(_0x16871a);})[_0x1b22('0x19')](function(_0x597694){logger[_0x1b22('0x16')](_0x1b22('0x1a'),_0x597694[_0x1b22('0x17')],_0x540a0e);_0x1928d3(_0xed78ec[_0x1b22('0x16')](0x1f4,_0x597694[_0x1b22('0x17')]));});});};exports[_0x1b22('0x25')]=function(_0x25bc7c){var _0x3ddfc6=this;return new Promise(function(_0x44d4fc,_0x550c5e){return db[_0x1b22('0x1b')]['find']({'raw':_0x25bc7c[_0x1b22('0x1e')]?_0x25bc7c[_0x1b22('0x1e')][_0x1b22('0x1d')]===undefined?!![]:![]:!![],'where':_0x25bc7c[_0x1b22('0x1e')]?_0x25bc7c['options'][_0x1b22('0x1f')]||null:null,'attributes':_0x25bc7c[_0x1b22('0x1e')]?_0x25bc7c[_0x1b22('0x1e')][_0x1b22('0x20')]||null:null,'include':_0x25bc7c[_0x1b22('0x1e')]?_0x25bc7c['options'][_0x1b22('0x22')]?_[_0x1b22('0x26')](_0x25bc7c[_0x1b22('0x1e')][_0x1b22('0x22')],function(_0x3268b9){return{'model':db[_0x3268b9[_0x1b22('0x23')]],'as':_0x3268b9['as'],'attributes':_0x3268b9[_0x1b22('0x20')],'include':_0x3268b9['include']?_[_0x1b22('0x26')](_0x3268b9[_0x1b22('0x22')],function(_0x240df4){return{'model':db[_0x240df4[_0x1b22('0x23')]],'as':_0x240df4['as'],'attributes':_0x240df4[_0x1b22('0x20')],'include':_0x240df4['include']?_[_0x1b22('0x26')](_0x240df4['include'],function(_0x19f34c){return{'model':db[_0x19f34c[_0x1b22('0x23')]],'as':_0x19f34c['as'],'attributes':_0x19f34c[_0x1b22('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1b22('0x24')](function(_0x35fdd8){logger[_0x1b22('0x11')]('ShowVoiceQueue',_0x25bc7c);logger[_0x1b22('0x13')](_0x1b22('0x25'),_0x25bc7c,JSON['stringify'](_0x35fdd8));_0x44d4fc(_0x35fdd8);})['catch'](function(_0x77602a){logger[_0x1b22('0x16')]('ShowVoiceQueue',_0x77602a[_0x1b22('0x17')],_0x25bc7c);_0x550c5e(_0x3ddfc6[_0x1b22('0x16')](0x1f4,_0x77602a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f2ebf37..90069eb 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 _0xc7a7=['removeListener','length','./voiceQueue.events','save','update','emit'];(function(_0x33c6e5,_0xcf8dc3){var _0x1a893a=function(_0x1e08cc){while(--_0x1e08cc){_0x33c6e5['push'](_0x33c6e5['shift']());}};_0x1a893a(++_0xcf8dc3);}(_0xc7a7,0x1b2));var _0x7c7a=function(_0x1b3391,_0xf0f02a){_0x1b3391=_0x1b3391-0x0;var _0x88073d=_0xc7a7[_0x1b3391];return _0x88073d;};'use strict';var VoiceQueueEvents=require(_0x7c7a('0x0'));var events=[_0x7c7a('0x1'),'remove',_0x7c7a('0x2')];function createListener(_0x226273,_0x168d2f){return function(_0x546b4e){_0x168d2f[_0x7c7a('0x3')](_0x226273,_0x546b4e);};}function removeListener(_0x544f78,_0x1d076b){return function(){VoiceQueueEvents[_0x7c7a('0x4')](_0x544f78,_0x1d076b);};}exports['register']=function(_0x4f23fb){for(var _0x320657=0x0,_0x1eae5b=events[_0x7c7a('0x5')];_0x320657<_0x1eae5b;_0x320657++){var _0x153db=events[_0x320657];var _0x4fc946=createListener('voiceQueue:'+_0x153db,_0x4f23fb);VoiceQueueEvents['on'](_0x153db,_0x4fc946);}}; \ No newline at end of file +var _0x0f4c=['./voiceQueue.events','save','remove','emit','length'];(function(_0x3b5e2d,_0x43b2e8){var _0x35e0e0=function(_0x143e25){while(--_0x143e25){_0x3b5e2d['push'](_0x3b5e2d['shift']());}};_0x35e0e0(++_0x43b2e8);}(_0x0f4c,0xaa));var _0xc0f4=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x0f4c[_0x36909d];return _0x1fd29d;};'use strict';var VoiceQueueEvents=require(_0xc0f4('0x0'));var events=[_0xc0f4('0x1'),_0xc0f4('0x2'),'update'];function createListener(_0x582196,_0x11c210){return function(_0x2b4737){_0x11c210[_0xc0f4('0x3')](_0x582196,_0x2b4737);};}function removeListener(_0x42e87d,_0x4483a1){return function(){VoiceQueueEvents['removeListener'](_0x42e87d,_0x4483a1);};}exports['register']=function(_0x5dc230){for(var _0x50a538=0x0,_0x7f0c19=events[_0xc0f4('0x4')];_0x50a538<_0x7f0c19;_0x50a538++){var _0xc875e2=events[_0x50a538];var _0x2e0b4d=createListener('voiceQueue:'+_0xc875e2,_0x5dc230);VoiceQueueEvents['on'](_0xc875e2,_0x2e0b4d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ae57f32..9857688 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 _0x2cc0=['./voiceQueueReport.controller','isAuthenticated','get','describe','/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ae621,_0x1867c7){var _0x137ad0=function(_0x3709ab){while(--_0x3709ab){_0x5ae621['push'](_0x5ae621['shift']());}};_0x137ad0(++_0x1867c7);}(_0x2cc0,0xdf));var _0x02cc=function(_0x195ac2,_0x4557d7){_0x195ac2=_0x195ac2-0x0;var _0x83cb5a=_0x2cc0[_0x195ac2];return _0x83cb5a;};'use strict';var multer=require(_0x02cc('0x0'));var util=require('util');var path=require(_0x02cc('0x1'));var timeout=require('connect-timeout');var express=require(_0x02cc('0x2'));var router=express[_0x02cc('0x3')]();var fs_extra=require(_0x02cc('0x4'));var auth=require(_0x02cc('0x5'));var interaction=require(_0x02cc('0x6'));var config=require(_0x02cc('0x7'));var controller=require(_0x02cc('0x8'));router['get']('/',auth[_0x02cc('0x9')](),controller['index']);router[_0x02cc('0xa')]('/describe',auth[_0x02cc('0x9')](),controller[_0x02cc('0xb')]);router[_0x02cc('0xa')](_0x02cc('0xc'),auth[_0x02cc('0x9')](),controller[_0x02cc('0xd')]);router[_0x02cc('0xa')](_0x02cc('0xe'),auth[_0x02cc('0x9')](),controller[_0x02cc('0xf')]);router[_0x02cc('0x10')]('/',auth[_0x02cc('0x9')](),controller['create']);router[_0x02cc('0x11')](_0x02cc('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x02cc('0x12')]('/:id',auth[_0x02cc('0x9')](),controller[_0x02cc('0x13')]);module[_0x02cc('0x14')]=router; \ No newline at end of file +var _0xf41f=['exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','create','put','/:id','destroy'];(function(_0x202f3a,_0x481a5d){var _0x1ac040=function(_0xcec826){while(--_0xcec826){_0x202f3a['push'](_0x202f3a['shift']());}};_0x1ac040(++_0x481a5d);}(_0xf41f,0x79));var _0xff41=function(_0x11453a,_0x4f1639){_0x11453a=_0x11453a-0x0;var _0x4b6e92=_0xf41f[_0x11453a];return _0x4b6e92;};'use strict';var multer=require('multer');var util=require(_0xff41('0x0'));var path=require(_0xff41('0x1'));var timeout=require(_0xff41('0x2'));var express=require(_0xff41('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xff41('0x4'));var config=require(_0xff41('0x5'));var controller=require(_0xff41('0x6'));router[_0xff41('0x7')]('/',auth[_0xff41('0x8')](),controller[_0xff41('0x9')]);router[_0xff41('0x7')](_0xff41('0xa'),auth['isAuthenticated'](),controller[_0xff41('0xb')]);router[_0xff41('0x7')](_0xff41('0xc'),auth['isAuthenticated'](),controller[_0xff41('0xd')]);router[_0xff41('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xff41('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff41('0xf')]);router[_0xff41('0x10')](_0xff41('0x11'),auth[_0xff41('0x8')](),controller['update']);router['delete'](_0xff41('0x11'),auth[_0xff41('0x8')](),controller[_0xff41('0x12')]);module[_0xff41('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 313c73b..049c546 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 _0x7fd9=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','getDataValue','queuecallerjoinAt','format','seconds'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x7fd9,0x102));var _0x97fd=function(_0x2bf66e,_0xfb08f0){_0x2bf66e=_0x2bf66e-0x0;var _0x10179b=_0x7fd9[_0x2bf66e];return _0x10179b;};'use strict';var Sequelize=require(_0x97fd('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x97fd('0x1')]},'calleridnum':{'type':Sequelize[_0x97fd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x97fd('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x10f362){var _0xd574f7=moment(_0x10f362);var _0x240441=moment(this[_0x97fd('0x2')](_0x97fd('0x3')))[_0x97fd('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0xd33697=_0xd574f7['diff'](_0x240441,_0x97fd('0x5'));this['setDataValue'](_0x97fd('0x6'),_0x10f362);this['setDataValue'](_0x97fd('0x7'),_0xd33697||null);}},'position':{'type':Sequelize[_0x97fd('0x8')]},'count':{'type':Sequelize[_0x97fd('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x97fd('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x97fd('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x97fd('0x1')],'comment':_0x97fd('0xa')},'originalposition':{'type':Sequelize[_0x97fd('0x8')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x97fd('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x97fd('0x1')]},'exten':{'type':Sequelize[_0x97fd('0x1')]},'priority':{'type':Sequelize[_0x97fd('0x1')]},'holdtime':{'type':Sequelize[_0x97fd('0x8')]},'mohtime':{'type':Sequelize[_0x97fd('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x97fd('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x97fd('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x97fd('0x1')],'comment':_0x97fd('0xb')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x97fd('0x1')]},'disposition':{'type':Sequelize[_0x97fd('0x1')]},'secondDisposition':{'type':Sequelize[_0x97fd('0x1')]},'thirdDisposition':{'type':Sequelize[_0x97fd('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x97fd('0x8')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc3f1=['DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','moment','exports','STRING'];(function(_0x2f9cbc,_0x42cf1b){var _0xd91e8=function(_0x183a29){while(--_0x183a29){_0x2f9cbc['push'](_0x2f9cbc['shift']());}};_0xd91e8(++_0x42cf1b);}(_0xc3f1,0xbd));var _0x1c3f=function(_0x31e84e,_0x1af216){_0x31e84e=_0x31e84e-0x0;var _0x172318=_0xc3f1[_0x31e84e];return _0x172318;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1c3f('0x0'));module[_0x1c3f('0x1')]={'type':{'type':Sequelize[_0x1c3f('0x2')]},'uniqueid':{'type':Sequelize[_0x1c3f('0x2')]},'calleridnum':{'type':Sequelize[_0x1c3f('0x2')]},'calleridname':{'type':Sequelize[_0x1c3f('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x1c3f('0x3')],'set':function(_0x20dde8){var _0x407e71=moment(_0x20dde8);var _0x3fd6b1=moment(this[_0x1c3f('0x4')]('queuecallerjoinAt'))['format'](_0x1c3f('0x5'));var _0x312b05=_0x407e71[_0x1c3f('0x6')](_0x3fd6b1,_0x1c3f('0x7'));this[_0x1c3f('0x8')]('queuecallerleaveAt',_0x20dde8);this['setDataValue'](_0x1c3f('0x9'),_0x312b05||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x1c3f('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x1c3f('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1c3f('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x1c3f('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x1c3f('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1c3f('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1c3f('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x1c3f('0xa')]},'channel':{'type':Sequelize[_0x1c3f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1c3f('0x2')]},'connectedlinename':{'type':Sequelize[_0x1c3f('0x2')]},'accountcode':{'type':Sequelize[_0x1c3f('0x2')]},'context':{'type':Sequelize[_0x1c3f('0x2')]},'exten':{'type':Sequelize[_0x1c3f('0x2')]},'priority':{'type':Sequelize[_0x1c3f('0x2')]},'holdtime':{'type':Sequelize[_0x1c3f('0xa')]},'mohtime':{'type':Sequelize[_0x1c3f('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1c3f('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1c3f('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1c3f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1c3f('0x2')]},'disposition':{'type':Sequelize[_0x1c3f('0x2')]},'secondDisposition':{'type':Sequelize[_0x1c3f('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x1c3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ef9e506..dcbcac6 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 _0x2911=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','VoiceQueueReport','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getVoiceQueuesReport','rawAttributes','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse'];(function(_0x22419f,_0x1ea160){var _0x1e1b68=function(_0x3bb649){while(--_0x3bb649){_0x22419f['push'](_0x22419f['shift']());}};_0x1e1b68(++_0x1ea160);}(_0x2911,0x147));var _0x1291=function(_0x12f52d,_0x2b3b28){_0x12f52d=_0x12f52d-0x0;var _0x2c796e=_0x2911[_0x12f52d];return _0x2c796e;};'use strict';var emlformat=require(_0x1291('0x0'));var rimraf=require(_0x1291('0x1'));var zipdir=require(_0x1291('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1291('0x3'));var moment=require(_0x1291('0x4'));var BPromise=require(_0x1291('0x5'));var Mustache=require(_0x1291('0x6'));var util=require('util');var path=require(_0x1291('0x7'));var sox=require(_0x1291('0x8'));var csv=require('to-csv');var ejs=require(_0x1291('0x9'));var fs=require('fs');var fs_extra=require(_0x1291('0xa'));var _=require(_0x1291('0xb'));var squel=require(_0x1291('0xc'));var crypto=require('crypto');var jsforce=require(_0x1291('0xd'));var deskjs=require(_0x1291('0xe'));var toCsv=require(_0x1291('0xf'));var querystring=require('querystring');var Papa=require(_0x1291('0x10'));var Redis=require(_0x1291('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1291('0x12'));var as=require(_0x1291('0x13'));var hardwareService=require(_0x1291('0x14'));var logger=require(_0x1291('0x15'))(_0x1291('0x16'));var utils=require(_0x1291('0x17'));var config=require(_0x1291('0x18'));var licenseUtil=require(_0x1291('0x19'));var db=require(_0x1291('0x1a'))['db'];config[_0x1291('0x1b')]=_[_0x1291('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1291('0x1d'))(new Redis(config['redis']));require(_0x1291('0x1e'))[_0x1291('0x1f')](socket);function respondWithStatusCode(_0x30e025,_0x4a02f1){_0x4a02f1=_0x4a02f1||0xcc;return function(_0xbf8221){if(_0xbf8221){return _0x30e025[_0x1291('0x20')](_0x4a02f1);}return _0x30e025[_0x1291('0x21')](_0x4a02f1)['end']();};}function respondWithResult(_0x471a26,_0x953590){_0x953590=_0x953590||0xc8;return function(_0x55b11b){if(_0x55b11b){return _0x471a26[_0x1291('0x21')](_0x953590)[_0x1291('0x22')](_0x55b11b);}};}function respondWithFilteredResult(_0x6cfdf7,_0x358f79){return function(_0x172855){if(_0x172855){var _0x27be4f=typeof _0x358f79['offset']===_0x1291('0x23')&&typeof _0x358f79[_0x1291('0x24')]===_0x1291('0x23');var _0x34f178=_0x172855[_0x1291('0x25')];var _0x490793=_0x27be4f?0x0:_0x358f79['offset'];var _0x2e11ae=_0x27be4f?_0x172855[_0x1291('0x25')]:_0x358f79[_0x1291('0x26')]+_0x358f79[_0x1291('0x24')];var _0x43ab73;if(_0x2e11ae>=_0x34f178){_0x2e11ae=_0x34f178;_0x43ab73=0xc8;}else{_0x43ab73=0xce;}_0x6cfdf7[_0x1291('0x21')](_0x43ab73);return _0x6cfdf7[_0x1291('0x27')]('Content-Range',_0x490793+'-'+_0x2e11ae+'/'+_0x34f178)[_0x1291('0x22')](_0x172855);}return null;};}function patchUpdates(_0x5c94a1){return function(_0x27010f){try{jsonpatch[_0x1291('0x28')](_0x27010f,_0x5c94a1,!![]);}catch(_0x401f20){return BPromise[_0x1291('0x29')](_0x401f20);}return _0x27010f[_0x1291('0x2a')]();};}function saveUpdates(_0x10beb5,_0x1bbafd){return function(_0x1f552c){if(_0x1f552c){return _0x1f552c[_0x1291('0x2b')](_0x10beb5)[_0x1291('0x2c')](function(_0x4b74c2){return _0x4b74c2;});}return null;};}function removeEntity(_0x552f93,_0x5e3c17){return function(_0x2739b7){if(_0x2739b7){return _0x2739b7[_0x1291('0x2d')]()[_0x1291('0x2c')](function(){_0x552f93[_0x1291('0x21')](0xcc)[_0x1291('0x2e')]();});}};}function handleEntityNotFound(_0x21bac6,_0x5a2edf){return function(_0x58d3eb){if(!_0x58d3eb){_0x21bac6[_0x1291('0x20')](0x194);}return _0x58d3eb;};}function handleError(_0xe6f7a3,_0x30bb23){_0x30bb23=_0x30bb23||0x1f4;return function(_0x228434){logger[_0x1291('0x2f')](_0x228434[_0x1291('0x30')]);if(_0x228434[_0x1291('0x31')]){delete _0x228434[_0x1291('0x31')];}_0xe6f7a3['status'](_0x30bb23)[_0x1291('0x32')](_0x228434);};}exports[_0x1291('0x33')]=function(_0x48afb2,_0x9dbb78){var _0x34927c={},_0x173ada={},_0x273e60={'count':0x0,'rows':[]};var _0x1ad03d=_['map'](db[_0x1291('0x34')]['rawAttributes'],function(_0x37a41a){return{'name':_0x37a41a['fieldName'],'type':_0x37a41a[_0x1291('0x35')][_0x1291('0x36')]};});_0x173ada['model']=_[_0x1291('0x37')](_0x1ad03d,_0x1291('0x31'));_0x173ada['query']=_[_0x1291('0x38')](_0x48afb2['query']);_0x173ada[_0x1291('0x39')]=_[_0x1291('0x3a')](_0x173ada[_0x1291('0x3b')],_0x173ada[_0x1291('0x3c')]);_0x34927c[_0x1291('0x3d')]=_['intersection'](_0x173ada[_0x1291('0x3b')],qs[_0x1291('0x3e')](_0x48afb2[_0x1291('0x3c')][_0x1291('0x3e')]));_0x34927c[_0x1291('0x3d')]=_0x34927c[_0x1291('0x3d')][_0x1291('0x3f')]?_0x34927c['attributes']:_0x173ada[_0x1291('0x3b')];if(!_0x48afb2['query'][_0x1291('0x40')](_0x1291('0x41'))){_0x34927c['limit']=qs[_0x1291('0x24')](_0x48afb2['query']['limit']);_0x34927c['offset']=qs[_0x1291('0x26')](_0x48afb2['query'][_0x1291('0x26')]);}_0x34927c[_0x1291('0x42')]=qs[_0x1291('0x43')](_0x48afb2['query'][_0x1291('0x43')]);_0x34927c['where']=qs[_0x1291('0x39')](_[_0x1291('0x44')](_0x48afb2[_0x1291('0x3c')],_0x173ada[_0x1291('0x39')]),_0x1ad03d);if(_0x48afb2['query'][_0x1291('0x45')]){_0x34927c[_0x1291('0x46')]=_['merge'](_0x34927c[_0x1291('0x46')],{'$or':_[_0x1291('0x37')](_0x1ad03d,function(_0xd81076){if(_0xd81076['type']!==_0x1291('0x47')){var _0x49305f={};_0x49305f[_0xd81076['name']]={'$like':'%'+_0x48afb2[_0x1291('0x3c')]['filter']+'%'};return _0x49305f;}})});}_0x34927c=_[_0x1291('0x48')]({},_0x34927c,_0x48afb2['options']);var _0x14be9f={'where':_0x34927c['where']};return db['VoiceQueueReport'][_0x1291('0x25')](_0x14be9f)[_0x1291('0x2c')](function(_0x1c2d40){_0x273e60[_0x1291('0x25')]=_0x1c2d40;if(_0x48afb2[_0x1291('0x3c')][_0x1291('0x49')]){_0x34927c[_0x1291('0x4a')]=[{'all':!![]}];}return db[_0x1291('0x34')][_0x1291('0x4b')](_0x34927c);})[_0x1291('0x2c')](function(_0x4e1703){_0x273e60[_0x1291('0x4c')]=_0x4e1703;return _0x273e60;})[_0x1291('0x2c')](respondWithFilteredResult(_0x9dbb78,_0x34927c))[_0x1291('0x4d')](handleError(_0x9dbb78,null));};exports[_0x1291('0x4e')]=function(_0x4caa37,_0x383fff){var _0x1272c6={'raw':![],'where':{'id':_0x4caa37[_0x1291('0x4f')]['id']}},_0x2142c7={};_0x2142c7['model']=_[_0x1291('0x38')](db[_0x1291('0x34')]['rawAttributes']);_0x2142c7['query']=_[_0x1291('0x38')](_0x4caa37[_0x1291('0x3c')]);_0x2142c7[_0x1291('0x39')]=_[_0x1291('0x3a')](_0x2142c7[_0x1291('0x3b')],_0x2142c7['query']);_0x1272c6[_0x1291('0x3d')]=_[_0x1291('0x3a')](_0x2142c7['model'],qs[_0x1291('0x3e')](_0x4caa37['query'][_0x1291('0x3e')]));_0x1272c6[_0x1291('0x3d')]=_0x1272c6[_0x1291('0x3d')]['length']?_0x1272c6[_0x1291('0x3d')]:_0x2142c7[_0x1291('0x3b')];if(_0x4caa37[_0x1291('0x3c')][_0x1291('0x49')]){_0x1272c6[_0x1291('0x4a')]=[{'all':!![]}];}_0x1272c6=_[_0x1291('0x48')]({},_0x1272c6,_0x4caa37[_0x1291('0x50')]);return db[_0x1291('0x34')][_0x1291('0x51')](_0x1272c6)[_0x1291('0x2c')](handleEntityNotFound(_0x383fff,null))[_0x1291('0x2c')](respondWithResult(_0x383fff,null))[_0x1291('0x4d')](handleError(_0x383fff,null));};exports['create']=function(_0x348d8d,_0x4139af){return db['VoiceQueueReport'][_0x1291('0x52')](_0x348d8d[_0x1291('0x53')],{})['then'](respondWithResult(_0x4139af,0xc9))[_0x1291('0x4d')](handleError(_0x4139af,null));};exports[_0x1291('0x2b')]=function(_0xfa768a,_0x58c349){if(_0xfa768a[_0x1291('0x53')]['id']){delete _0xfa768a[_0x1291('0x53')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0xfa768a[_0x1291('0x4f')]['id']}})[_0x1291('0x2c')](handleEntityNotFound(_0x58c349,null))[_0x1291('0x2c')](saveUpdates(_0xfa768a[_0x1291('0x53')],null))[_0x1291('0x2c')](respondWithResult(_0x58c349,null))[_0x1291('0x4d')](handleError(_0x58c349,null));};exports[_0x1291('0x2d')]=function(_0x2228ea,_0x2a9e5b){return db[_0x1291('0x34')]['find']({'where':{'id':_0x2228ea[_0x1291('0x4f')]['id']}})[_0x1291('0x2c')](handleEntityNotFound(_0x2a9e5b,null))['then'](removeEntity(_0x2a9e5b,null))[_0x1291('0x4d')](handleError(_0x2a9e5b,null));};exports['describe']=function(_0x3949dc,_0x9e33b){return db[_0x1291('0x34')]['describe']()[_0x1291('0x2c')](respondWithResult(_0x9e33b,null))['catch'](handleError(_0x9e33b,null));};exports[_0x1291('0x54')]=function(_0x451452,_0x47bd2e){var _0x298271={},_0x45f3e5={},_0xa179a={'count':0x0,'rows':[]};_0x45f3e5[_0x1291('0x3b')]=_[_0x1291('0x38')](db[_0x1291('0x34')][_0x1291('0x55')]);_0x45f3e5[_0x1291('0x3c')]=_[_0x1291('0x38')](_0x451452[_0x1291('0x3c')]);_0x45f3e5[_0x1291('0x39')]=_[_0x1291('0x3a')](_0x45f3e5[_0x1291('0x3b')],_0x45f3e5['query']);_0x298271['attributes']=_[_0x1291('0x3a')](_0x45f3e5['model'],qs['fields'](_0x451452[_0x1291('0x3c')][_0x1291('0x3e')]));_0x298271[_0x1291('0x3d')]=_0x298271[_0x1291('0x3d')][_0x1291('0x3f')]?_0x298271[_0x1291('0x3d')]:_0x45f3e5[_0x1291('0x3b')];if(!_0x451452['query'][_0x1291('0x40')]('nolimit')){_0x298271[_0x1291('0x24')]=qs[_0x1291('0x24')](_0x451452['query'][_0x1291('0x24')]);_0x298271[_0x1291('0x26')]=qs[_0x1291('0x26')](_0x451452[_0x1291('0x3c')]['offset']);}_0x298271[_0x1291('0x42')]=qs['sort'](_0x451452[_0x1291('0x3c')][_0x1291('0x43')]);_0x298271[_0x1291('0x46')]=qs[_0x1291('0x39')](_['pick'](_0x451452[_0x1291('0x3c')],_0x45f3e5['filters']));if(_0x451452[_0x1291('0x3c')][_0x1291('0x45')]){_0x298271[_0x1291('0x46')]=_[_0x1291('0x48')](_0x298271[_0x1291('0x46')],{'$or':_[_0x1291('0x37')](_0x298271['attributes'],function(_0x5f4974){var _0x433bd0={};_0x433bd0[_0x5f4974]={'$like':'%'+_0x451452[_0x1291('0x3c')][_0x1291('0x45')]+'%'};return _0x433bd0;})});}_0x298271=_[_0x1291('0x48')]({},_0x298271,_0x451452[_0x1291('0x50')]);var _0x4846cb={'where':_0x298271[_0x1291('0x46')]};return db[_0x1291('0x34')][_0x1291('0x25')](_0x4846cb)[_0x1291('0x2c')](function(_0x371fa3){_0xa179a[_0x1291('0x25')]=_0x371fa3;if(_0x451452['query']['includeAll']){_0x298271['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x1291('0x4b')](_0x298271);})[_0x1291('0x2c')](function(_0x1a0e74){_0xa179a[_0x1291('0x4c')]=_0x1a0e74;return _0xa179a;})[_0x1291('0x2c')](respondWithFilteredResult(_0x47bd2e,_0x298271,_0x1291('0x54')))['catch'](handleError(_0x47bd2e,null,_0x1291('0x54')));}; \ No newline at end of file +var _0x7aef=['jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','getVoiceQueuesReport','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x4a1446,_0x170e92){var _0xc1876e=function(_0x53c9de){while(--_0x53c9de){_0x4a1446['push'](_0x4a1446['shift']());}};_0xc1876e(++_0x170e92);}(_0x7aef,0x132));var _0xf7ae=function(_0x4ba94c,_0x4b7e77){_0x4ba94c=_0x4ba94c-0x0;var _0x205a9d=_0x7aef[_0x4ba94c];return _0x205a9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7ae('0x0'));var zipdir=require(_0xf7ae('0x1'));var jsonpatch=require(_0xf7ae('0x2'));var rp=require(_0xf7ae('0x3'));var moment=require(_0xf7ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7ae('0x5'));var util=require(_0xf7ae('0x6'));var path=require(_0xf7ae('0x7'));var sox=require(_0xf7ae('0x8'));var csv=require(_0xf7ae('0x9'));var ejs=require(_0xf7ae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7ae('0xb'));var squel=require(_0xf7ae('0xc'));var crypto=require(_0xf7ae('0xd'));var jsforce=require(_0xf7ae('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf7ae('0x9'));var querystring=require(_0xf7ae('0xf'));var Papa=require(_0xf7ae('0x10'));var Redis=require('ioredis');var authService=require(_0xf7ae('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7ae('0x12'));var logger=require(_0xf7ae('0x13'))(_0xf7ae('0x14'));var utils=require(_0xf7ae('0x15'));var config=require(_0xf7ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7ae('0x17'))['db'];config[_0xf7ae('0x18')]=_[_0xf7ae('0x19')](config[_0xf7ae('0x18')],{'host':_0xf7ae('0x1a'),'port':0x18eb});var socket=require(_0xf7ae('0x1b'))(new Redis(config[_0xf7ae('0x18')]));require(_0xf7ae('0x1c'))[_0xf7ae('0x1d')](socket);function respondWithStatusCode(_0x2a0a5d,_0x37ea04){_0x37ea04=_0x37ea04||0xcc;return function(_0x3fab8a){if(_0x3fab8a){return _0x2a0a5d['sendStatus'](_0x37ea04);}return _0x2a0a5d[_0xf7ae('0x1e')](_0x37ea04)['end']();};}function respondWithResult(_0x2b83d7,_0x3fb102){_0x3fb102=_0x3fb102||0xc8;return function(_0x3d801e){if(_0x3d801e){return _0x2b83d7[_0xf7ae('0x1e')](_0x3fb102)[_0xf7ae('0x1f')](_0x3d801e);}};}function respondWithFilteredResult(_0x1fbdba,_0x28c07b){return function(_0x2fb52c){if(_0x2fb52c){var _0x2861a3=typeof _0x28c07b[_0xf7ae('0x20')]===_0xf7ae('0x21')&&typeof _0x28c07b[_0xf7ae('0x22')]==='undefined';var _0x5377d9=_0x2fb52c['count'];var _0x35bc47=_0x2861a3?0x0:_0x28c07b['offset'];var _0x493643=_0x2861a3?_0x2fb52c[_0xf7ae('0x23')]:_0x28c07b[_0xf7ae('0x20')]+_0x28c07b[_0xf7ae('0x22')];var _0x223b2e;if(_0x493643>=_0x5377d9){_0x493643=_0x5377d9;_0x223b2e=0xc8;}else{_0x223b2e=0xce;}_0x1fbdba[_0xf7ae('0x1e')](_0x223b2e);return _0x1fbdba['set'](_0xf7ae('0x24'),_0x35bc47+'-'+_0x493643+'/'+_0x5377d9)[_0xf7ae('0x1f')](_0x2fb52c);}return null;};}function patchUpdates(_0x27854f){return function(_0x45716d){try{jsonpatch[_0xf7ae('0x25')](_0x45716d,_0x27854f,!![]);}catch(_0xa825f7){return BPromise[_0xf7ae('0x26')](_0xa825f7);}return _0x45716d['save']();};}function saveUpdates(_0x1ef4ed,_0x37da5e){return function(_0x48aa3f){if(_0x48aa3f){return _0x48aa3f[_0xf7ae('0x27')](_0x1ef4ed)[_0xf7ae('0x28')](function(_0x2dc2b8){return _0x2dc2b8;});}return null;};}function removeEntity(_0x4368c1,_0x19d717){return function(_0xab4664){if(_0xab4664){return _0xab4664[_0xf7ae('0x29')]()[_0xf7ae('0x28')](function(){_0x4368c1['status'](0xcc)[_0xf7ae('0x2a')]();});}};}function handleEntityNotFound(_0x37ff92,_0x4112fb){return function(_0x53f09b){if(!_0x53f09b){_0x37ff92['sendStatus'](0x194);}return _0x53f09b;};}function handleError(_0x2b9e94,_0xd9fbd7){_0xd9fbd7=_0xd9fbd7||0x1f4;return function(_0xf14ef0){logger[_0xf7ae('0x2b')](_0xf14ef0['stack']);if(_0xf14ef0[_0xf7ae('0x2c')]){delete _0xf14ef0[_0xf7ae('0x2c')];}_0x2b9e94['status'](_0xd9fbd7)[_0xf7ae('0x2d')](_0xf14ef0);};}exports[_0xf7ae('0x2e')]=function(_0x42215d,_0x1625d3){var _0x82881f={},_0x327721={},_0x1c5ccd={'count':0x0,'rows':[]};var _0xb62c82=_[_0xf7ae('0x2f')](db['VoiceQueueReport'][_0xf7ae('0x30')],function(_0x371b01){return{'name':_0x371b01['fieldName'],'type':_0x371b01[_0xf7ae('0x31')]['key']};});_0x327721[_0xf7ae('0x32')]=_[_0xf7ae('0x2f')](_0xb62c82,_0xf7ae('0x2c'));_0x327721['query']=_[_0xf7ae('0x33')](_0x42215d[_0xf7ae('0x34')]);_0x327721[_0xf7ae('0x35')]=_[_0xf7ae('0x36')](_0x327721[_0xf7ae('0x32')],_0x327721[_0xf7ae('0x34')]);_0x82881f[_0xf7ae('0x37')]=_[_0xf7ae('0x36')](_0x327721[_0xf7ae('0x32')],qs[_0xf7ae('0x38')](_0x42215d[_0xf7ae('0x34')]['fields']));_0x82881f[_0xf7ae('0x37')]=_0x82881f[_0xf7ae('0x37')][_0xf7ae('0x39')]?_0x82881f[_0xf7ae('0x37')]:_0x327721[_0xf7ae('0x32')];if(!_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x3a')]('nolimit')){_0x82881f[_0xf7ae('0x22')]=qs[_0xf7ae('0x22')](_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x22')]);_0x82881f['offset']=qs[_0xf7ae('0x20')](_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x20')]);}_0x82881f['order']=qs[_0xf7ae('0x3b')](_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x3b')]);_0x82881f[_0xf7ae('0x3c')]=qs['filters'](_[_0xf7ae('0x3d')](_0x42215d['query'],_0x327721['filters']),_0xb62c82);if(_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x3e')]){_0x82881f[_0xf7ae('0x3c')]=_[_0xf7ae('0x3f')](_0x82881f['where'],{'$or':_['map'](_0xb62c82,function(_0x3650d3){if(_0x3650d3[_0xf7ae('0x31')]!==_0xf7ae('0x40')){var _0x1d354a={};_0x1d354a[_0x3650d3[_0xf7ae('0x2c')]]={'$like':'%'+_0x42215d[_0xf7ae('0x34')][_0xf7ae('0x3e')]+'%'};return _0x1d354a;}})});}_0x82881f=_[_0xf7ae('0x3f')]({},_0x82881f,_0x42215d[_0xf7ae('0x41')]);var _0x32bacf={'where':_0x82881f[_0xf7ae('0x3c')]};return db[_0xf7ae('0x42')][_0xf7ae('0x23')](_0x32bacf)[_0xf7ae('0x28')](function(_0x50264c){_0x1c5ccd[_0xf7ae('0x23')]=_0x50264c;if(_0x42215d[_0xf7ae('0x34')]['includeAll']){_0x82881f[_0xf7ae('0x43')]=[{'all':!![]}];}return db[_0xf7ae('0x42')][_0xf7ae('0x44')](_0x82881f);})['then'](function(_0x3c0abb){_0x1c5ccd[_0xf7ae('0x45')]=_0x3c0abb;return _0x1c5ccd;})[_0xf7ae('0x28')](respondWithFilteredResult(_0x1625d3,_0x82881f))['catch'](handleError(_0x1625d3,null));};exports[_0xf7ae('0x46')]=function(_0x1f9b47,_0x4ef873){var _0x33530b={'raw':![],'where':{'id':_0x1f9b47[_0xf7ae('0x47')]['id']}},_0x12483e={};_0x12483e['model']=_[_0xf7ae('0x33')](db[_0xf7ae('0x42')][_0xf7ae('0x30')]);_0x12483e[_0xf7ae('0x34')]=_[_0xf7ae('0x33')](_0x1f9b47[_0xf7ae('0x34')]);_0x12483e['filters']=_[_0xf7ae('0x36')](_0x12483e[_0xf7ae('0x32')],_0x12483e[_0xf7ae('0x34')]);_0x33530b[_0xf7ae('0x37')]=_[_0xf7ae('0x36')](_0x12483e[_0xf7ae('0x32')],qs['fields'](_0x1f9b47['query'][_0xf7ae('0x38')]));_0x33530b[_0xf7ae('0x37')]=_0x33530b['attributes']['length']?_0x33530b['attributes']:_0x12483e['model'];if(_0x1f9b47[_0xf7ae('0x34')][_0xf7ae('0x48')]){_0x33530b['include']=[{'all':!![]}];}_0x33530b=_[_0xf7ae('0x3f')]({},_0x33530b,_0x1f9b47[_0xf7ae('0x41')]);return db[_0xf7ae('0x42')][_0xf7ae('0x49')](_0x33530b)[_0xf7ae('0x28')](handleEntityNotFound(_0x4ef873,null))[_0xf7ae('0x28')](respondWithResult(_0x4ef873,null))[_0xf7ae('0x4a')](handleError(_0x4ef873,null));};exports[_0xf7ae('0x4b')]=function(_0x51217a,_0x13aef3){return db[_0xf7ae('0x42')][_0xf7ae('0x4b')](_0x51217a[_0xf7ae('0x4c')],{})[_0xf7ae('0x28')](respondWithResult(_0x13aef3,0xc9))[_0xf7ae('0x4a')](handleError(_0x13aef3,null));};exports[_0xf7ae('0x27')]=function(_0x5db5a0,_0x4f3989){if(_0x5db5a0[_0xf7ae('0x4c')]['id']){delete _0x5db5a0[_0xf7ae('0x4c')]['id'];}return db[_0xf7ae('0x42')][_0xf7ae('0x49')]({'where':{'id':_0x5db5a0['params']['id']}})[_0xf7ae('0x28')](handleEntityNotFound(_0x4f3989,null))[_0xf7ae('0x28')](saveUpdates(_0x5db5a0[_0xf7ae('0x4c')],null))['then'](respondWithResult(_0x4f3989,null))[_0xf7ae('0x4a')](handleError(_0x4f3989,null));};exports[_0xf7ae('0x29')]=function(_0x2cb24b,_0x51419d){return db[_0xf7ae('0x42')][_0xf7ae('0x49')]({'where':{'id':_0x2cb24b[_0xf7ae('0x47')]['id']}})[_0xf7ae('0x28')](handleEntityNotFound(_0x51419d,null))[_0xf7ae('0x28')](removeEntity(_0x51419d,null))[_0xf7ae('0x4a')](handleError(_0x51419d,null));};exports['describe']=function(_0x1b110e,_0xee1d15){return db['VoiceQueueReport'][_0xf7ae('0x4d')]()[_0xf7ae('0x28')](respondWithResult(_0xee1d15,null))[_0xf7ae('0x4a')](handleError(_0xee1d15,null));};exports[_0xf7ae('0x4e')]=function(_0x3443e9,_0x34ba5d){var _0x301e0c={},_0x138662={},_0x439dff={'count':0x0,'rows':[]};_0x138662[_0xf7ae('0x32')]=_[_0xf7ae('0x33')](db[_0xf7ae('0x42')][_0xf7ae('0x30')]);_0x138662[_0xf7ae('0x34')]=_[_0xf7ae('0x33')](_0x3443e9['query']);_0x138662[_0xf7ae('0x35')]=_[_0xf7ae('0x36')](_0x138662[_0xf7ae('0x32')],_0x138662[_0xf7ae('0x34')]);_0x301e0c[_0xf7ae('0x37')]=_['intersection'](_0x138662[_0xf7ae('0x32')],qs[_0xf7ae('0x38')](_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x38')]));_0x301e0c[_0xf7ae('0x37')]=_0x301e0c[_0xf7ae('0x37')]['length']?_0x301e0c[_0xf7ae('0x37')]:_0x138662['model'];if(!_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x3a')](_0xf7ae('0x4f'))){_0x301e0c[_0xf7ae('0x22')]=qs[_0xf7ae('0x22')](_0x3443e9['query'][_0xf7ae('0x22')]);_0x301e0c['offset']=qs['offset'](_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x20')]);}_0x301e0c['order']=qs['sort'](_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x3b')]);_0x301e0c[_0xf7ae('0x3c')]=qs['filters'](_[_0xf7ae('0x3d')](_0x3443e9['query'],_0x138662['filters']));if(_0x3443e9['query'][_0xf7ae('0x3e')]){_0x301e0c['where']=_[_0xf7ae('0x3f')](_0x301e0c[_0xf7ae('0x3c')],{'$or':_[_0xf7ae('0x2f')](_0x301e0c[_0xf7ae('0x37')],function(_0x47242b){var _0x1ac533={};_0x1ac533[_0x47242b]={'$like':'%'+_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x3e')]+'%'};return _0x1ac533;})});}_0x301e0c=_['merge']({},_0x301e0c,_0x3443e9[_0xf7ae('0x41')]);var _0x3a291f={'where':_0x301e0c[_0xf7ae('0x3c')]};return db[_0xf7ae('0x42')][_0xf7ae('0x23')](_0x3a291f)[_0xf7ae('0x28')](function(_0x2f0c9c){_0x439dff['count']=_0x2f0c9c;if(_0x3443e9[_0xf7ae('0x34')][_0xf7ae('0x48')]){_0x301e0c[_0xf7ae('0x43')]=[{'all':!![]}];}return db[_0xf7ae('0x42')]['findAll'](_0x301e0c);})[_0xf7ae('0x28')](function(_0x3149b3){_0x439dff[_0xf7ae('0x45')]=_0x3149b3;return _0x439dff;})[_0xf7ae('0x28')](respondWithFilteredResult(_0x34ba5d,_0x301e0c,_0xf7ae('0x4e')))['catch'](handleError(_0x34ba5d,null,_0xf7ae('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index be6b4b3..def235d 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 _0x082e=['emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x16d3c7,_0x82a2c4){var _0x1f6edc=function(_0x3719a8){while(--_0x3719a8){_0x16d3c7['push'](_0x16d3c7['shift']());}};_0x1f6edc(++_0x82a2c4);}(_0x082e,0x1a1));var _0xe082=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x082e[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xe082('0x0'))['db'][_0xe082('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe082('0x2')](0x0);var events={'afterCreate':_0xe082('0x3'),'afterUpdate':_0xe082('0x4'),'afterDestroy':_0xe082('0x5')};function emitEvent(_0xa7402c){return function(_0x385342,_0x27b99e,_0x604975){VoiceQueueReportEvents[_0xe082('0x6')](_0xa7402c+':'+_0x385342['id'],_0x385342);VoiceQueueReportEvents[_0xe082('0x6')](_0xa7402c,_0x385342);_0x604975(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe082('0x7')](e,emitEvent(event));}}module[_0xe082('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x40f3=['../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x204106,_0x31e827){var _0x287420=function(_0x1c64c1){while(--_0x1c64c1){_0x204106['push'](_0x204106['shift']());}};_0x287420(++_0x31e827);}(_0x40f3,0x6b));var _0x340f=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x40f3[_0xcf5436];return _0xc4f5c8;};'use strict';var EventEmitter=require(_0x340f('0x0'));var VoiceQueueReport=require(_0x340f('0x1'))['db'][_0x340f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x340f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x340f('0x4')};function emitEvent(_0x5cffc8){return function(_0x53f876,_0x2243fc,_0xe8f69d){VoiceQueueReportEvents['emit'](_0x5cffc8+':'+_0x53f876['id'],_0x53f876);VoiceQueueReportEvents[_0x340f('0x5')](_0x5cffc8,_0x53f876);_0xe8f69d(null);};}for(var e in events){if(events[_0x340f('0x6')](e)){var event=events[e];VoiceQueueReport[_0x340f('0x7')](e,emitEvent(event));}}module[_0x340f('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b7ae240..e99f964 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 _0xc37b=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','lodash'];(function(_0x4b621c,_0x122fa7){var _0x11719a=function(_0xcac626){while(--_0xcac626){_0x4b621c['push'](_0x4b621c['shift']());}};_0x11719a(++_0x122fa7);}(_0xc37b,0x15b));var _0xbc37=function(_0x98834f,_0x38aa2e){_0x98834f=_0x98834f-0x0;var _0x5974a4=_0xc37b[_0x98834f];return _0x5974a4;};'use strict';var _=require(_0xbc37('0x0'));var util=require(_0xbc37('0x1'));var logger=require(_0xbc37('0x2'))('api');var moment=require(_0xbc37('0x3'));var BPromise=require(_0xbc37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc37('0x5'));var config=require(_0xbc37('0x6'));var attributes=require(_0xbc37('0x7'));module['exports']=function(_0x2f2fe4,_0x294950){return _0x2f2fe4[_0xbc37('0x8')](_0xbc37('0x9'),attributes,{'tableName':_0xbc37('0xa'),'paranoid':![],'indexes':[{'fields':[_0xbc37('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x97e9=['../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','util','moment','path','rimraf'];(function(_0x4c0ed7,_0x51ad04){var _0x26f35a=function(_0x4b58a0){while(--_0x4b58a0){_0x4c0ed7['push'](_0x4c0ed7['shift']());}};_0x26f35a(++_0x51ad04);}(_0x97e9,0x1a3));var _0x997e=function(_0x258c4e,_0x35af98){_0x258c4e=_0x258c4e-0x0;var _0x2ba8c3=_0x97e9[_0x258c4e];return _0x2ba8c3;};'use strict';var _=require('lodash');var util=require(_0x997e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x997e('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x997e('0x2'));var rimraf=require(_0x997e('0x3'));var config=require(_0x997e('0x4'));var attributes=require(_0x997e('0x5'));module[_0x997e('0x6')]=function(_0x19e4b7,_0x2bb546){return _0x19e4b7['define'](_0x997e('0x7'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x997e('0x8')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 573f78a..8d592d4 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 _0x7905=['UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','stringify','body','CreateVoiceQueueReport'];(function(_0x5483f8,_0x565060){var _0x32e7f0=function(_0x3c891c){while(--_0x3c891c){_0x5483f8['push'](_0x5483f8['shift']());}};_0x32e7f0(++_0x565060);}(_0x7905,0xf2));var _0x5790=function(_0x1a6f42,_0x5b921f){_0x1a6f42=_0x1a6f42-0x0;var _0x4afe1e=_0x7905[_0x1a6f42];return _0x4afe1e;};'use strict';var _=require(_0x5790('0x0'));var util=require(_0x5790('0x1'));var moment=require(_0x5790('0x2'));var BPromise=require(_0x5790('0x3'));var rs=require(_0x5790('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5790('0x5'));var jayson=require(_0x5790('0x6'));var client=jayson[_0x5790('0x7')][_0x5790('0x8')]({'port':0x232a});config[_0x5790('0x9')]=_['defaults'](config[_0x5790('0x9')],{'host':_0x5790('0xa'),'port':0x18eb});var socket=require(_0x5790('0xb'))(new Redis(config['redis']));require(_0x5790('0xc'))[_0x5790('0xd')](socket);function respondWithRpcPromise(_0x4b0746,_0x93c17b,_0x5e347e){return new BPromise(function(_0x2f72e0,_0x44f6ea){return client[_0x5790('0xe')](_0x4b0746,_0x5e347e)[_0x5790('0xf')](function(_0xbd136a){logger[_0x5790('0x10')](_0x5790('0x11'),_0x93c17b,_0x5790('0x12'));logger[_0x5790('0x13')](_0x5790('0x14'),_0x93c17b,_0x5790('0x12'),JSON['stringify'](_0xbd136a));if(_0xbd136a[_0x5790('0x15')]){if(_0xbd136a[_0x5790('0x15')]['code']===0x1f4){logger[_0x5790('0x15')](_0x5790('0x11'),_0x93c17b,_0xbd136a[_0x5790('0x15')][_0x5790('0x16')]);return _0x44f6ea(_0xbd136a[_0x5790('0x15')]['message']);}logger[_0x5790('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x93c17b,_0xbd136a[_0x5790('0x15')][_0x5790('0x16')]);return _0x2f72e0(_0xbd136a[_0x5790('0x15')][_0x5790('0x16')]);}else{logger[_0x5790('0x10')](_0x5790('0x11'),_0x93c17b,_0x5790('0x12'));_0x2f72e0(_0xbd136a['result'][_0x5790('0x16')]);}})[_0x5790('0x17')](function(_0x5c8551){logger[_0x5790('0x15')](_0x5790('0x11'),_0x93c17b,_0x5c8551);_0x44f6ea(_0x5c8551);});});}exports['GetVoiceQueueReport']=function(_0x5c1ffc){var _0x282cf2=this;return new Promise(function(_0x27aab7,_0x3904de){return db[_0x5790('0x18')][_0x5790('0x19')]({'raw':_0x5c1ffc[_0x5790('0x1a')]?_0x5c1ffc[_0x5790('0x1a')][_0x5790('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c1ffc['options']?_0x5c1ffc['options'][_0x5790('0x1c')]||null:null,'attributes':_0x5c1ffc[_0x5790('0x1a')]?_0x5c1ffc['options']['attributes']||null:null,'limit':_0x5c1ffc[_0x5790('0x1a')]?_0x5c1ffc['options'][_0x5790('0x1d')]||null:null,'include':_0x5c1ffc[_0x5790('0x1a')]?_0x5c1ffc[_0x5790('0x1a')][_0x5790('0x1e')]?_[_0x5790('0x1f')](_0x5c1ffc[_0x5790('0x1a')][_0x5790('0x1e')],function(_0x13ee3d){return{'model':db[_0x13ee3d[_0x5790('0x20')]],'as':_0x13ee3d['as'],'attributes':_0x13ee3d[_0x5790('0x21')],'include':_0x13ee3d[_0x5790('0x1e')]?_[_0x5790('0x1f')](_0x13ee3d[_0x5790('0x1e')],function(_0x3f7de7){return{'model':db[_0x3f7de7[_0x5790('0x20')]],'as':_0x3f7de7['as'],'attributes':_0x3f7de7[_0x5790('0x21')],'include':_0x3f7de7['include']?_['map'](_0x3f7de7['include'],function(_0x2469d0){return{'model':db[_0x2469d0[_0x5790('0x20')]],'as':_0x2469d0['as'],'attributes':_0x2469d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5790('0xf')](function(_0x14ee19){logger[_0x5790('0x10')](_0x5790('0x22'),_0x5c1ffc);logger[_0x5790('0x13')](_0x5790('0x22'),_0x5c1ffc,JSON[_0x5790('0x23')](_0x14ee19));_0x27aab7(_0x14ee19);})[_0x5790('0x17')](function(_0x172a31){logger[_0x5790('0x15')](_0x5790('0x22'),_0x172a31[_0x5790('0x16')],_0x5c1ffc);_0x3904de(_0x282cf2[_0x5790('0x15')](0x1f4,_0x172a31[_0x5790('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x5c9fd2){var _0x31943d=this;return new Promise(function(_0x14c3c6,_0x3bf40b){return db['VoiceQueueReport']['create'](_0x5c9fd2[_0x5790('0x24')],{'raw':_0x5c9fd2[_0x5790('0x1a')]?_0x5c9fd2[_0x5790('0x1a')][_0x5790('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xf5e3ac){logger[_0x5790('0x10')](_0x5790('0x25'),_0x5c9fd2);logger[_0x5790('0x13')](_0x5790('0x25'),_0x5c9fd2,JSON[_0x5790('0x23')](_0xf5e3ac));_0x14c3c6(_0xf5e3ac);})[_0x5790('0x17')](function(_0x2b9735){logger[_0x5790('0x15')](_0x5790('0x25'),_0x2b9735['message'],_0x5c9fd2);_0x3bf40b(_0x31943d['error'](0x1f4,_0x2b9735['message']));});});};exports[_0x5790('0x26')]=function(_0x319db0){var _0x9701af=this;return new Promise(function(_0x37f802,_0x4f7922){return db[_0x5790('0x18')][_0x5790('0x27')](_0x319db0[_0x5790('0x24')],{'raw':_0x319db0[_0x5790('0x1a')]?_0x319db0[_0x5790('0x1a')][_0x5790('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319db0['options']?_0x319db0[_0x5790('0x1a')]['where']||null:null,'attributes':_0x319db0[_0x5790('0x1a')]?_0x319db0[_0x5790('0x1a')]['attributes']||null:null,'limit':_0x319db0[_0x5790('0x1a')]?_0x319db0[_0x5790('0x1a')][_0x5790('0x1d')]||null:null})[_0x5790('0xf')](function(_0x35010d){logger['info'](_0x5790('0x26'),_0x319db0);logger[_0x5790('0x13')](_0x5790('0x26'),_0x319db0,JSON['stringify'](_0x35010d));_0x37f802(_0x35010d);})[_0x5790('0x17')](function(_0x3ed944){logger[_0x5790('0x15')](_0x5790('0x26'),_0x3ed944['message'],_0x319db0);_0x4f7922(_0x9701af['error'](0x1f4,_0x3ed944[_0x5790('0x16')]));});});}; \ No newline at end of file +var _0x344a=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','include','model','attributes','catch','CreateVoiceQueueReport','create','body','raw','info','update','UpdateVoiceQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x142ba8,_0x2c3265){var _0x4dc848=function(_0x331a51){while(--_0x331a51){_0x142ba8['push'](_0x142ba8['shift']());}};_0x4dc848(++_0x2c3265);}(_0x344a,0x191));var _0xa344=function(_0xf1d0af,_0x5e4ddf){_0xf1d0af=_0xf1d0af-0x0;var _0xdabf6=_0x344a[_0xf1d0af];return _0xdabf6;};'use strict';var _=require('lodash');var util=require(_0xa344('0x0'));var moment=require('moment');var BPromise=require(_0xa344('0x1'));var rs=require(_0xa344('0x2'));var fs=require('fs');var Redis=require(_0xa344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa344('0x4'));var logger=require(_0xa344('0x5'))('rpc');var config=require(_0xa344('0x6'));var jayson=require(_0xa344('0x7'));var client=jayson[_0xa344('0x8')]['http']({'port':0x232a});config['redis']=_[_0xa344('0x9')](config[_0xa344('0xa')],{'host':_0xa344('0xb'),'port':0x18eb});var socket=require(_0xa344('0xc'))(new Redis(config[_0xa344('0xa')]));require(_0xa344('0xd'))['register'](socket);function respondWithRpcPromise(_0x493a81,_0x3029b7,_0x359a5d){return new BPromise(function(_0x5e57af,_0xc58762){return client[_0xa344('0xe')](_0x493a81,_0x359a5d)[_0xa344('0xf')](function(_0x28aba8){logger['info'](_0xa344('0x10'),_0x3029b7,_0xa344('0x11'));logger[_0xa344('0x12')](_0xa344('0x13'),_0x3029b7,_0xa344('0x11'),JSON[_0xa344('0x14')](_0x28aba8));if(_0x28aba8[_0xa344('0x15')]){if(_0x28aba8[_0xa344('0x15')][_0xa344('0x16')]===0x1f4){logger[_0xa344('0x15')](_0xa344('0x10'),_0x3029b7,_0x28aba8[_0xa344('0x15')][_0xa344('0x17')]);return _0xc58762(_0x28aba8['error'][_0xa344('0x17')]);}logger[_0xa344('0x15')](_0xa344('0x10'),_0x3029b7,_0x28aba8['error'][_0xa344('0x17')]);return _0x5e57af(_0x28aba8[_0xa344('0x15')][_0xa344('0x17')]);}else{logger['info'](_0xa344('0x10'),_0x3029b7,_0xa344('0x11'));_0x5e57af(_0x28aba8[_0xa344('0x18')][_0xa344('0x17')]);}})['catch'](function(_0x79349c){logger['error'](_0xa344('0x10'),_0x3029b7,_0x79349c);_0xc58762(_0x79349c);});});}exports[_0xa344('0x19')]=function(_0x513d06){var _0x405715=this;return new Promise(function(_0x5820ea,_0x222e24){return db[_0xa344('0x1a')][_0xa344('0x1b')]({'raw':_0x513d06[_0xa344('0x1c')]?_0x513d06[_0xa344('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x513d06[_0xa344('0x1c')]?_0x513d06[_0xa344('0x1c')][_0xa344('0x1d')]||null:null,'attributes':_0x513d06[_0xa344('0x1c')]?_0x513d06[_0xa344('0x1c')]['attributes']||null:null,'limit':_0x513d06[_0xa344('0x1c')]?_0x513d06[_0xa344('0x1c')][_0xa344('0x1e')]||null:null,'include':_0x513d06[_0xa344('0x1c')]?_0x513d06['options'][_0xa344('0x1f')]?_['map'](_0x513d06[_0xa344('0x1c')][_0xa344('0x1f')],function(_0x31c7d4){return{'model':db[_0x31c7d4[_0xa344('0x20')]],'as':_0x31c7d4['as'],'attributes':_0x31c7d4[_0xa344('0x21')],'include':_0x31c7d4[_0xa344('0x1f')]?_['map'](_0x31c7d4[_0xa344('0x1f')],function(_0x2a4812){return{'model':db[_0x2a4812[_0xa344('0x20')]],'as':_0x2a4812['as'],'attributes':_0x2a4812[_0xa344('0x21')],'include':_0x2a4812['include']?_['map'](_0x2a4812[_0xa344('0x1f')],function(_0x170700){return{'model':db[_0x170700[_0xa344('0x20')]],'as':_0x170700['as'],'attributes':_0x170700[_0xa344('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x164f4b){logger['info'](_0xa344('0x19'),_0x513d06);logger[_0xa344('0x12')](_0xa344('0x19'),_0x513d06,JSON[_0xa344('0x14')](_0x164f4b));_0x5820ea(_0x164f4b);})[_0xa344('0x22')](function(_0x3ad99e){logger[_0xa344('0x15')](_0xa344('0x19'),_0x3ad99e['message'],_0x513d06);_0x222e24(_0x405715['error'](0x1f4,_0x3ad99e['message']));});});};exports[_0xa344('0x23')]=function(_0x5934f8){var _0x5e7cb5=this;return new Promise(function(_0x39de6d,_0x5a07e4){return db['VoiceQueueReport'][_0xa344('0x24')](_0x5934f8[_0xa344('0x25')],{'raw':_0x5934f8['options']?_0x5934f8[_0xa344('0x1c')][_0xa344('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x13b955){logger[_0xa344('0x27')](_0xa344('0x23'),_0x5934f8);logger['debug'](_0xa344('0x23'),_0x5934f8,JSON[_0xa344('0x14')](_0x13b955));_0x39de6d(_0x13b955);})['catch'](function(_0x1e0911){logger[_0xa344('0x15')]('CreateVoiceQueueReport',_0x1e0911['message'],_0x5934f8);_0x5a07e4(_0x5e7cb5['error'](0x1f4,_0x1e0911[_0xa344('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x53e2db){var _0x1d0eb9=this;return new Promise(function(_0x44aec4,_0x100d2d){return db[_0xa344('0x1a')][_0xa344('0x28')](_0x53e2db[_0xa344('0x25')],{'raw':_0x53e2db[_0xa344('0x1c')]?_0x53e2db['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e2db['options']?_0x53e2db[_0xa344('0x1c')][_0xa344('0x1d')]||null:null,'attributes':_0x53e2db[_0xa344('0x1c')]?_0x53e2db['options'][_0xa344('0x21')]||null:null,'limit':_0x53e2db[_0xa344('0x1c')]?_0x53e2db[_0xa344('0x1c')][_0xa344('0x1e')]||null:null})['then'](function(_0xcb779f){logger['info'](_0xa344('0x29'),_0x53e2db);logger[_0xa344('0x12')](_0xa344('0x29'),_0x53e2db,JSON[_0xa344('0x14')](_0xcb779f));_0x44aec4(_0xcb779f);})[_0xa344('0x22')](function(_0x24ee15){logger[_0xa344('0x15')](_0xa344('0x29'),_0x24ee15['message'],_0x53e2db);_0x100d2d(_0x1d0eb9['error'](0x1f4,_0x24ee15[_0xa344('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8ffcc4d..7da3091 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 _0x383d=['register','length','remove','update','emit','removeListener'];(function(_0x43d8fb,_0x3db3b4){var _0x10d700=function(_0x12364f){while(--_0x12364f){_0x43d8fb['push'](_0x43d8fb['shift']());}};_0x10d700(++_0x3db3b4);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xd383('0x0'),_0xd383('0x1')];function createListener(_0x35486e,_0x559dd3){return function(_0x7554ef){_0x559dd3[_0xd383('0x2')](_0x35486e,_0x7554ef);};}function removeListener(_0x319f67,_0x3439dd){return function(){VoiceQueueReportEvents[_0xd383('0x3')](_0x319f67,_0x3439dd);};}exports[_0xd383('0x4')]=function(_0x5a0b1d){for(var _0xc64e9b=0x0,_0x30ba82=events[_0xd383('0x5')];_0xc64e9b<_0x30ba82;_0xc64e9b++){var _0x470d8d=events[_0xc64e9b];var _0xffa778=createListener('voiceQueueReport:'+_0x470d8d,_0x5a0b1d);VoiceQueueReportEvents['on'](_0x470d8d,_0xffa778);}}; \ No newline at end of file +var _0xcee8=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0xff746d,_0x1c4b9b){var _0x434810=function(_0x2a40e5){while(--_0x2a40e5){_0xff746d['push'](_0xff746d['shift']());}};_0x434810(++_0x1c4b9b);}(_0xcee8,0xb1));var _0x8cee=function(_0x1e3cd1,_0x5cd264){_0x1e3cd1=_0x1e3cd1-0x0;var _0x50a01a=_0xcee8[_0x1e3cd1];return _0x50a01a;};'use strict';var VoiceQueueReportEvents=require(_0x8cee('0x0'));var events=[_0x8cee('0x1'),_0x8cee('0x2'),_0x8cee('0x3')];function createListener(_0x1c570c,_0x6608db){return function(_0x5b82bd){_0x6608db[_0x8cee('0x4')](_0x1c570c,_0x5b82bd);};}function removeListener(_0x4e4143,_0xffd42d){return function(){VoiceQueueReportEvents[_0x8cee('0x5')](_0x4e4143,_0xffd42d);};}exports['register']=function(_0x295471){for(var _0xfea4e3=0x0,_0x4f57f1=events['length'];_0xfea4e3<_0x4f57f1;_0xfea4e3++){var _0x341c63=events[_0xfea4e3];var _0x49a070=createListener(_0x8cee('0x6')+_0x341c63,_0x295471);VoiceQueueReportEvents['on'](_0x341c63,_0x49a070);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e41da70..17c4eb3 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 _0x0ed3=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x1aba44,_0xe368cf){var _0x3179fc=function(_0x515055){while(--_0x515055){_0x1aba44['push'](_0x1aba44['shift']());}};_0x3179fc(++_0xe368cf);}(_0x0ed3,0x91));var _0x30ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ed3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x30ed('0x0'));var util=require(_0x30ed('0x1'));var path=require(_0x30ed('0x2'));var timeout=require('connect-timeout');var express=require(_0x30ed('0x3'));var router=express[_0x30ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30ed('0x6'));var controller=require(_0x30ed('0x7'));router[_0x30ed('0x8')]('/',auth[_0x30ed('0x9')](),controller[_0x30ed('0xa')]);router[_0x30ed('0x8')](_0x30ed('0xb'),auth[_0x30ed('0x9')](),controller['show']);router['post']('/',auth[_0x30ed('0x9')](),controller[_0x30ed('0xc')]);router[_0x30ed('0xd')](_0x30ed('0xb'),auth['isAuthenticated'](),controller[_0x30ed('0xe')]);router[_0x30ed('0xf')](_0x30ed('0xb'),auth['isAuthenticated'](),controller[_0x30ed('0x10')]);module[_0x30ed('0x11')]=router; \ No newline at end of file +var _0xf65f=['isAuthenticated','show','post','create','put','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0x51e5bd,_0x3c2cf1){var _0x250aed=function(_0x17120c){while(--_0x17120c){_0x51e5bd['push'](_0x51e5bd['shift']());}};_0x250aed(++_0x3c2cf1);}(_0xf65f,0xe0));var _0xff65=function(_0x7d7bf9,_0x4cfd22){_0x7d7bf9=_0x7d7bf9-0x0;var _0x39845f=_0xf65f[_0x7d7bf9];return _0x39845f;};'use strict';var multer=require('multer');var util=require(_0xff65('0x0'));var path=require(_0xff65('0x1'));var timeout=require(_0xff65('0x2'));var express=require(_0xff65('0x3'));var router=express[_0xff65('0x4')]();var fs_extra=require(_0xff65('0x5'));var auth=require(_0xff65('0x6'));var interaction=require(_0xff65('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xff65('0x8')]);router[_0xff65('0x9')]('/:id',auth[_0xff65('0xa')](),controller[_0xff65('0xb')]);router[_0xff65('0xc')]('/',auth['isAuthenticated'](),controller[_0xff65('0xd')]);router[_0xff65('0xe')]('/:id',auth[_0xff65('0xa')](),controller['update']);router['delete'](_0xff65('0xf'),auth[_0xff65('0xa')](),controller[_0xff65('0x10')]);module[_0xff65('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6916373..40b1602 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 _0x9a62=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','STRING','DATE','literal'];(function(_0x322246,_0x21d668){var _0x3b29f4=function(_0x3cdf8a){while(--_0x3cdf8a){_0x322246['push'](_0x322246['shift']());}};_0x3b29f4(++_0x21d668);}(_0x9a62,0x1c1));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x29a6('0x0')]},'callid':{'type':Sequelize[_0x29a6('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x29a6('0x0')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x29a6('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x29a6('0x0')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x29a6('0x0')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x29a6('0x1')],'allowNull':![],'defaultValue':Sequelize[_0x29a6('0x2')](_0x29a6('0x3'))}}; \ No newline at end of file +var _0xf157=['STRING','DATE','literal','sequelize','moment','exports'];(function(_0x1a9ec9,_0xc160ef){var _0x3e2565=function(_0xc5fd9b){while(--_0xc5fd9b){_0x1a9ec9['push'](_0x1a9ec9['shift']());}};_0x3e2565(++_0xc160ef);}(_0xf157,0x8d));var _0x7f15=function(_0x51ed42,_0x3de668){_0x51ed42=_0x51ed42-0x0;var _0x5dc7a2=_0xf157[_0x51ed42];return _0x5dc7a2;};'use strict';var Sequelize=require(_0x7f15('0x0'));var moment=require(_0x7f15('0x1'));module[_0x7f15('0x2')]={'time':{'type':Sequelize[_0x7f15('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7f15('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7f15('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7f15('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 216a160..b5481b4 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 _0x4ac3=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','VoiceQueuesLog','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1c3633,_0x250f92){var _0x50935a=function(_0x208aeb){while(--_0x208aeb){_0x1c3633['push'](_0x1c3633['shift']());}};_0x50935a(++_0x250f92);}(_0x4ac3,0x18d));var _0x34ac=function(_0x205a87,_0x4c3854){_0x205a87=_0x205a87-0x0;var _0x2107e8=_0x4ac3[_0x205a87];return _0x2107e8;};'use strict';var emlformat=require(_0x34ac('0x0'));var rimraf=require(_0x34ac('0x1'));var zipdir=require(_0x34ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34ac('0x3'));var moment=require(_0x34ac('0x4'));var BPromise=require(_0x34ac('0x5'));var Mustache=require(_0x34ac('0x6'));var util=require(_0x34ac('0x7'));var path=require(_0x34ac('0x8'));var sox=require(_0x34ac('0x9'));var csv=require(_0x34ac('0xa'));var ejs=require(_0x34ac('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34ac('0xc'));var squel=require(_0x34ac('0xd'));var crypto=require(_0x34ac('0xe'));var jsforce=require(_0x34ac('0xf'));var deskjs=require(_0x34ac('0x10'));var toCsv=require(_0x34ac('0xa'));var querystring=require(_0x34ac('0x11'));var Papa=require(_0x34ac('0x12'));var Redis=require(_0x34ac('0x13'));var authService=require(_0x34ac('0x14'));var qs=require(_0x34ac('0x15'));var as=require(_0x34ac('0x16'));var hardwareService=require(_0x34ac('0x17'));var logger=require(_0x34ac('0x18'))(_0x34ac('0x19'));var utils=require('../../config/utils');var config=require(_0x34ac('0x1a'));var licenseUtil=require(_0x34ac('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a6552,_0xfd8587){_0xfd8587=_0xfd8587||0xcc;return function(_0x1c580e){if(_0x1c580e){return _0x3a6552[_0x34ac('0x1c')](_0xfd8587);}return _0x3a6552[_0x34ac('0x1d')](_0xfd8587)[_0x34ac('0x1e')]();};}function respondWithResult(_0x470e0a,_0x36ff0f){_0x36ff0f=_0x36ff0f||0xc8;return function(_0x43a58d){if(_0x43a58d){return _0x470e0a['status'](_0x36ff0f)[_0x34ac('0x1f')](_0x43a58d);}};}function respondWithFilteredResult(_0x3e3376,_0x28920c){return function(_0x3b746c){if(_0x3b746c){var _0x5be90d=typeof _0x28920c[_0x34ac('0x20')]===_0x34ac('0x21')&&typeof _0x28920c[_0x34ac('0x22')]===_0x34ac('0x21');var _0x6f9ea2=_0x3b746c[_0x34ac('0x23')];var _0x15992e=_0x5be90d?0x0:_0x28920c[_0x34ac('0x20')];var _0x11bfa8=_0x5be90d?_0x3b746c[_0x34ac('0x23')]:_0x28920c['offset']+_0x28920c[_0x34ac('0x22')];var _0x1f9d18;if(_0x11bfa8>=_0x6f9ea2){_0x11bfa8=_0x6f9ea2;_0x1f9d18=0xc8;}else{_0x1f9d18=0xce;}_0x3e3376[_0x34ac('0x1d')](_0x1f9d18);return _0x3e3376['set'](_0x34ac('0x24'),_0x15992e+'-'+_0x11bfa8+'/'+_0x6f9ea2)[_0x34ac('0x1f')](_0x3b746c);}return null;};}function patchUpdates(_0x37e731){return function(_0x64e8bd){try{jsonpatch[_0x34ac('0x25')](_0x64e8bd,_0x37e731,!![]);}catch(_0x821d37){return BPromise[_0x34ac('0x26')](_0x821d37);}return _0x64e8bd['save']();};}function saveUpdates(_0x114cc3,_0x5cc5c5){return function(_0x102f43){if(_0x102f43){return _0x102f43[_0x34ac('0x27')](_0x114cc3)['then'](function(_0x354dcd){return _0x354dcd;});}return null;};}function removeEntity(_0x56d577,_0x180e14){return function(_0x1928c5){if(_0x1928c5){return _0x1928c5['destroy']()[_0x34ac('0x28')](function(){_0x56d577['status'](0xcc)[_0x34ac('0x1e')]();});}};}function handleEntityNotFound(_0x8c0de5,_0x134682){return function(_0x4996f5){if(!_0x4996f5){_0x8c0de5[_0x34ac('0x1c')](0x194);}return _0x4996f5;};}function handleError(_0x4b5a58,_0x3eea18){_0x3eea18=_0x3eea18||0x1f4;return function(_0x586bb6){logger['error'](_0x586bb6[_0x34ac('0x29')]);if(_0x586bb6[_0x34ac('0x2a')]){delete _0x586bb6[_0x34ac('0x2a')];}_0x4b5a58['status'](_0x3eea18)[_0x34ac('0x2b')](_0x586bb6);};}exports['index']=function(_0x5004d0,_0x17f2f2){var _0x59ab82={},_0x450d8e={},_0x4e1c34={'count':0x0,'rows':[]};var _0x491676=_['map'](db[_0x34ac('0x2c')]['rawAttributes'],function(_0x265605){return{'name':_0x265605['fieldName'],'type':_0x265605[_0x34ac('0x2d')][_0x34ac('0x2e')]};});_0x450d8e[_0x34ac('0x2f')]=_[_0x34ac('0x30')](_0x491676,_0x34ac('0x2a'));_0x450d8e['query']=_[_0x34ac('0x31')](_0x5004d0[_0x34ac('0x32')]);_0x450d8e[_0x34ac('0x33')]=_[_0x34ac('0x34')](_0x450d8e[_0x34ac('0x2f')],_0x450d8e['query']);_0x59ab82[_0x34ac('0x35')]=_[_0x34ac('0x34')](_0x450d8e['model'],qs['fields'](_0x5004d0[_0x34ac('0x32')][_0x34ac('0x36')]));_0x59ab82['attributes']=_0x59ab82[_0x34ac('0x35')][_0x34ac('0x37')]?_0x59ab82[_0x34ac('0x35')]:_0x450d8e[_0x34ac('0x2f')];if(!_0x5004d0['query'][_0x34ac('0x38')]('nolimit')){_0x59ab82[_0x34ac('0x22')]=qs[_0x34ac('0x22')](_0x5004d0[_0x34ac('0x32')][_0x34ac('0x22')]);_0x59ab82[_0x34ac('0x20')]=qs['offset'](_0x5004d0[_0x34ac('0x32')][_0x34ac('0x20')]);}_0x59ab82['order']=qs['sort'](_0x5004d0['query']['sort']);_0x59ab82['where']=qs['filters'](_['pick'](_0x5004d0[_0x34ac('0x32')],_0x450d8e[_0x34ac('0x33')]),_0x491676);if(_0x5004d0['query'][_0x34ac('0x39')]){_0x59ab82[_0x34ac('0x3a')]=_['merge'](_0x59ab82['where'],{'$or':_[_0x34ac('0x30')](_0x491676,function(_0x4f872d){if(_0x4f872d[_0x34ac('0x2d')]!==_0x34ac('0x3b')){var _0x4b0690={};_0x4b0690[_0x4f872d[_0x34ac('0x2a')]]={'$like':'%'+_0x5004d0['query'][_0x34ac('0x39')]+'%'};return _0x4b0690;}})});}_0x59ab82=_[_0x34ac('0x3c')]({},_0x59ab82,_0x5004d0[_0x34ac('0x3d')]);var _0x7a32b7={'where':_0x59ab82[_0x34ac('0x3a')]};return db[_0x34ac('0x2c')][_0x34ac('0x23')](_0x7a32b7)[_0x34ac('0x28')](function(_0x1b51fc){_0x4e1c34['count']=_0x1b51fc;if(_0x5004d0[_0x34ac('0x32')][_0x34ac('0x3e')]){_0x59ab82[_0x34ac('0x3f')]=[{'all':!![]}];}return db[_0x34ac('0x2c')][_0x34ac('0x40')](_0x59ab82);})['then'](function(_0x1a386f){_0x4e1c34['rows']=_0x1a386f;return _0x4e1c34;})['then'](respondWithFilteredResult(_0x17f2f2,_0x59ab82))[_0x34ac('0x41')](handleError(_0x17f2f2,null));};exports[_0x34ac('0x42')]=function(_0x2fa200,_0x53a8f5){var _0x31024c={'raw':!![],'where':{'id':_0x2fa200[_0x34ac('0x43')]['id']}},_0x450458={};_0x450458[_0x34ac('0x2f')]=_[_0x34ac('0x31')](db[_0x34ac('0x2c')]['rawAttributes']);_0x450458[_0x34ac('0x32')]=_[_0x34ac('0x31')](_0x2fa200['query']);_0x450458[_0x34ac('0x33')]=_[_0x34ac('0x34')](_0x450458[_0x34ac('0x2f')],_0x450458['query']);_0x31024c['attributes']=_['intersection'](_0x450458[_0x34ac('0x2f')],qs[_0x34ac('0x36')](_0x2fa200[_0x34ac('0x32')][_0x34ac('0x36')]));_0x31024c[_0x34ac('0x35')]=_0x31024c['attributes'][_0x34ac('0x37')]?_0x31024c['attributes']:_0x450458[_0x34ac('0x2f')];if(_0x2fa200[_0x34ac('0x32')]['includeAll']){_0x31024c[_0x34ac('0x3f')]=[{'all':!![]}];}_0x31024c=_[_0x34ac('0x3c')]({},_0x31024c,_0x2fa200['options']);return db[_0x34ac('0x2c')][_0x34ac('0x44')](_0x31024c)[_0x34ac('0x28')](handleEntityNotFound(_0x53a8f5,null))[_0x34ac('0x28')](respondWithResult(_0x53a8f5,null))[_0x34ac('0x41')](handleError(_0x53a8f5,null));};exports[_0x34ac('0x45')]=function(_0x123242,_0x1dec99){return db['VoiceQueuesLog'][_0x34ac('0x45')](_0x123242[_0x34ac('0x46')],{})[_0x34ac('0x28')](respondWithResult(_0x1dec99,0xc9))['catch'](handleError(_0x1dec99,null));};exports['update']=function(_0xa2b305,_0x3e1721){if(_0xa2b305['body']['id']){delete _0xa2b305[_0x34ac('0x46')]['id'];}return db[_0x34ac('0x2c')][_0x34ac('0x44')]({'where':{'id':_0xa2b305[_0x34ac('0x43')]['id']}})[_0x34ac('0x28')](handleEntityNotFound(_0x3e1721,null))['then'](saveUpdates(_0xa2b305['body'],null))['then'](respondWithResult(_0x3e1721,null))[_0x34ac('0x41')](handleError(_0x3e1721,null));};exports['destroy']=function(_0x36798d,_0x1917d7){return db[_0x34ac('0x2c')][_0x34ac('0x44')]({'where':{'id':_0x36798d[_0x34ac('0x43')]['id']}})[_0x34ac('0x28')](handleEntityNotFound(_0x1917d7,null))[_0x34ac('0x28')](removeEntity(_0x1917d7,null))['catch'](handleError(_0x1917d7,null));}; \ No newline at end of file +var _0xbc06=['includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x3017e7,_0x19002a){var _0x341d0b=function(_0x4a12a8){while(--_0x4a12a8){_0x3017e7['push'](_0x3017e7['shift']());}};_0x341d0b(++_0x19002a);}(_0xbc06,0xeb));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6bc0('0x0'));var rimraf=require(_0x6bc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6bc0('0x2'));var Mustache=require(_0x6bc0('0x3'));var util=require('util');var path=require(_0x6bc0('0x4'));var sox=require('sox');var csv=require(_0x6bc0('0x5'));var ejs=require(_0x6bc0('0x6'));var fs=require('fs');var fs_extra=require(_0x6bc0('0x7'));var _=require(_0x6bc0('0x8'));var squel=require('squel');var crypto=require(_0x6bc0('0x9'));var jsforce=require(_0x6bc0('0xa'));var deskjs=require(_0x6bc0('0xb'));var toCsv=require(_0x6bc0('0x5'));var querystring=require('querystring');var Papa=require(_0x6bc0('0xc'));var Redis=require(_0x6bc0('0xd'));var authService=require(_0x6bc0('0xe'));var qs=require(_0x6bc0('0xf'));var as=require(_0x6bc0('0x10'));var hardwareService=require(_0x6bc0('0x11'));var logger=require(_0x6bc0('0x12'))('api');var utils=require(_0x6bc0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6bc0('0x14'));var db=require(_0x6bc0('0x15'))['db'];function respondWithStatusCode(_0x5f398c,_0x20aa8e){_0x20aa8e=_0x20aa8e||0xcc;return function(_0x1d6c10){if(_0x1d6c10){return _0x5f398c[_0x6bc0('0x16')](_0x20aa8e);}return _0x5f398c[_0x6bc0('0x17')](_0x20aa8e)[_0x6bc0('0x18')]();};}function respondWithResult(_0x472661,_0x271add){_0x271add=_0x271add||0xc8;return function(_0x50a2d7){if(_0x50a2d7){return _0x472661[_0x6bc0('0x17')](_0x271add)['json'](_0x50a2d7);}};}function respondWithFilteredResult(_0x13d6fc,_0x5e38ca){return function(_0x2556a0){if(_0x2556a0){var _0x4b7bb9=typeof _0x5e38ca[_0x6bc0('0x19')]===_0x6bc0('0x1a')&&typeof _0x5e38ca[_0x6bc0('0x1b')]===_0x6bc0('0x1a');var _0x1e0ad6=_0x2556a0[_0x6bc0('0x1c')];var _0x470232=_0x4b7bb9?0x0:_0x5e38ca[_0x6bc0('0x19')];var _0x4ee119=_0x4b7bb9?_0x2556a0[_0x6bc0('0x1c')]:_0x5e38ca['offset']+_0x5e38ca[_0x6bc0('0x1b')];var _0xed063;if(_0x4ee119>=_0x1e0ad6){_0x4ee119=_0x1e0ad6;_0xed063=0xc8;}else{_0xed063=0xce;}_0x13d6fc[_0x6bc0('0x17')](_0xed063);return _0x13d6fc[_0x6bc0('0x1d')](_0x6bc0('0x1e'),_0x470232+'-'+_0x4ee119+'/'+_0x1e0ad6)[_0x6bc0('0x1f')](_0x2556a0);}return null;};}function patchUpdates(_0x59b30f){return function(_0x5aee7e){try{jsonpatch[_0x6bc0('0x20')](_0x5aee7e,_0x59b30f,!![]);}catch(_0x56d208){return BPromise[_0x6bc0('0x21')](_0x56d208);}return _0x5aee7e[_0x6bc0('0x22')]();};}function saveUpdates(_0x507b7c,_0x269e46){return function(_0x2c77ff){if(_0x2c77ff){return _0x2c77ff[_0x6bc0('0x23')](_0x507b7c)[_0x6bc0('0x24')](function(_0x343d20){return _0x343d20;});}return null;};}function removeEntity(_0x5cd3f4,_0x43b57d){return function(_0x3fa497){if(_0x3fa497){return _0x3fa497[_0x6bc0('0x25')]()[_0x6bc0('0x24')](function(){_0x5cd3f4[_0x6bc0('0x17')](0xcc)[_0x6bc0('0x18')]();});}};}function handleEntityNotFound(_0x4d4bd3,_0x5b5264){return function(_0x38d7f9){if(!_0x38d7f9){_0x4d4bd3[_0x6bc0('0x16')](0x194);}return _0x38d7f9;};}function handleError(_0x438083,_0x4986fa){_0x4986fa=_0x4986fa||0x1f4;return function(_0xc18dfe){logger[_0x6bc0('0x26')](_0xc18dfe[_0x6bc0('0x27')]);if(_0xc18dfe[_0x6bc0('0x28')]){delete _0xc18dfe[_0x6bc0('0x28')];}_0x438083['status'](_0x4986fa)[_0x6bc0('0x29')](_0xc18dfe);};}exports[_0x6bc0('0x2a')]=function(_0x50ef6e,_0x22f1d9){var _0x1df481={},_0x3bf91a={},_0x529750={'count':0x0,'rows':[]};var _0x1fcbae=_['map'](db[_0x6bc0('0x2b')][_0x6bc0('0x2c')],function(_0xe8de1f){return{'name':_0xe8de1f[_0x6bc0('0x2d')],'type':_0xe8de1f[_0x6bc0('0x2e')][_0x6bc0('0x2f')]};});_0x3bf91a[_0x6bc0('0x30')]=_['map'](_0x1fcbae,_0x6bc0('0x28'));_0x3bf91a[_0x6bc0('0x31')]=_[_0x6bc0('0x32')](_0x50ef6e[_0x6bc0('0x31')]);_0x3bf91a[_0x6bc0('0x33')]=_[_0x6bc0('0x34')](_0x3bf91a[_0x6bc0('0x30')],_0x3bf91a[_0x6bc0('0x31')]);_0x1df481['attributes']=_['intersection'](_0x3bf91a[_0x6bc0('0x30')],qs[_0x6bc0('0x35')](_0x50ef6e[_0x6bc0('0x31')][_0x6bc0('0x35')]));_0x1df481[_0x6bc0('0x36')]=_0x1df481[_0x6bc0('0x36')][_0x6bc0('0x37')]?_0x1df481[_0x6bc0('0x36')]:_0x3bf91a[_0x6bc0('0x30')];if(!_0x50ef6e[_0x6bc0('0x31')][_0x6bc0('0x38')](_0x6bc0('0x39'))){_0x1df481[_0x6bc0('0x1b')]=qs[_0x6bc0('0x1b')](_0x50ef6e[_0x6bc0('0x31')][_0x6bc0('0x1b')]);_0x1df481[_0x6bc0('0x19')]=qs[_0x6bc0('0x19')](_0x50ef6e[_0x6bc0('0x31')][_0x6bc0('0x19')]);}_0x1df481['order']=qs[_0x6bc0('0x3a')](_0x50ef6e[_0x6bc0('0x31')]['sort']);_0x1df481[_0x6bc0('0x3b')]=qs[_0x6bc0('0x33')](_[_0x6bc0('0x3c')](_0x50ef6e['query'],_0x3bf91a[_0x6bc0('0x33')]),_0x1fcbae);if(_0x50ef6e['query'][_0x6bc0('0x3d')]){_0x1df481[_0x6bc0('0x3b')]=_[_0x6bc0('0x3e')](_0x1df481[_0x6bc0('0x3b')],{'$or':_[_0x6bc0('0x3f')](_0x1fcbae,function(_0x3c26b5){if(_0x3c26b5[_0x6bc0('0x2e')]!==_0x6bc0('0x40')){var _0x954277={};_0x954277[_0x3c26b5[_0x6bc0('0x28')]]={'$like':'%'+_0x50ef6e['query'][_0x6bc0('0x3d')]+'%'};return _0x954277;}})});}_0x1df481=_[_0x6bc0('0x3e')]({},_0x1df481,_0x50ef6e['options']);var _0x4bed12={'where':_0x1df481[_0x6bc0('0x3b')]};return db[_0x6bc0('0x2b')][_0x6bc0('0x1c')](_0x4bed12)['then'](function(_0x3cc4db){_0x529750['count']=_0x3cc4db;if(_0x50ef6e['query'][_0x6bc0('0x41')]){_0x1df481[_0x6bc0('0x42')]=[{'all':!![]}];}return db[_0x6bc0('0x2b')][_0x6bc0('0x43')](_0x1df481);})[_0x6bc0('0x24')](function(_0x4e1e1b){_0x529750[_0x6bc0('0x44')]=_0x4e1e1b;return _0x529750;})['then'](respondWithFilteredResult(_0x22f1d9,_0x1df481))[_0x6bc0('0x45')](handleError(_0x22f1d9,null));};exports[_0x6bc0('0x46')]=function(_0x4bbdbb,_0xc2f8e6){var _0x5be31e={'raw':!![],'where':{'id':_0x4bbdbb[_0x6bc0('0x47')]['id']}},_0x2c9181={};_0x2c9181['model']=_[_0x6bc0('0x32')](db[_0x6bc0('0x2b')][_0x6bc0('0x2c')]);_0x2c9181[_0x6bc0('0x31')]=_[_0x6bc0('0x32')](_0x4bbdbb['query']);_0x2c9181[_0x6bc0('0x33')]=_[_0x6bc0('0x34')](_0x2c9181[_0x6bc0('0x30')],_0x2c9181[_0x6bc0('0x31')]);_0x5be31e[_0x6bc0('0x36')]=_[_0x6bc0('0x34')](_0x2c9181[_0x6bc0('0x30')],qs[_0x6bc0('0x35')](_0x4bbdbb['query'][_0x6bc0('0x35')]));_0x5be31e['attributes']=_0x5be31e[_0x6bc0('0x36')]['length']?_0x5be31e['attributes']:_0x2c9181[_0x6bc0('0x30')];if(_0x4bbdbb['query'][_0x6bc0('0x41')]){_0x5be31e[_0x6bc0('0x42')]=[{'all':!![]}];}_0x5be31e=_[_0x6bc0('0x3e')]({},_0x5be31e,_0x4bbdbb['options']);return db[_0x6bc0('0x2b')][_0x6bc0('0x48')](_0x5be31e)[_0x6bc0('0x24')](handleEntityNotFound(_0xc2f8e6,null))[_0x6bc0('0x24')](respondWithResult(_0xc2f8e6,null))[_0x6bc0('0x45')](handleError(_0xc2f8e6,null));};exports[_0x6bc0('0x49')]=function(_0x374bb4,_0x54c8e3){return db[_0x6bc0('0x2b')][_0x6bc0('0x49')](_0x374bb4[_0x6bc0('0x4a')],{})[_0x6bc0('0x24')](respondWithResult(_0x54c8e3,0xc9))['catch'](handleError(_0x54c8e3,null));};exports[_0x6bc0('0x23')]=function(_0x13479e,_0x577a15){if(_0x13479e['body']['id']){delete _0x13479e['body']['id'];}return db[_0x6bc0('0x2b')][_0x6bc0('0x48')]({'where':{'id':_0x13479e[_0x6bc0('0x47')]['id']}})[_0x6bc0('0x24')](handleEntityNotFound(_0x577a15,null))['then'](saveUpdates(_0x13479e[_0x6bc0('0x4a')],null))[_0x6bc0('0x24')](respondWithResult(_0x577a15,null))[_0x6bc0('0x45')](handleError(_0x577a15,null));};exports[_0x6bc0('0x25')]=function(_0x33489a,_0x1dfd78){return db[_0x6bc0('0x2b')][_0x6bc0('0x48')]({'where':{'id':_0x33489a[_0x6bc0('0x47')]['id']}})[_0x6bc0('0x24')](handleEntityNotFound(_0x1dfd78,null))[_0x6bc0('0x24')](removeEntity(_0x1dfd78,null))[_0x6bc0('0x45')](handleError(_0x1dfd78,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f6d9e60..ed07298 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 _0xecfd=['voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define'];(function(_0x3c4782,_0xedb792){var _0x14abd6=function(_0x290f8b){while(--_0x290f8b){_0x3c4782['push'](_0x3c4782['shift']());}};_0x14abd6(++_0xedb792);}(_0xecfd,0x6c));var _0xdecf=function(_0x2e10bd,_0x5ece63){_0x2e10bd=_0x2e10bd-0x0;var _0x441b4c=_0xecfd[_0x2e10bd];return _0x441b4c;};'use strict';var _=require(_0xdecf('0x0'));var util=require(_0xdecf('0x1'));var logger=require(_0xdecf('0x2'))(_0xdecf('0x3'));var moment=require(_0xdecf('0x4'));var BPromise=require(_0xdecf('0x5'));var rp=require(_0xdecf('0x6'));var fs=require('fs');var path=require(_0xdecf('0x7'));var rimraf=require(_0xdecf('0x8'));var config=require('../../config/environment');var attributes=require(_0xdecf('0x9'));module[_0xdecf('0xa')]=function(_0x1ac946,_0x572caf){return _0x1ac946[_0xdecf('0xb')]('VoiceQueuesLog',attributes,{'tableName':_0xdecf('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xdecf('0xd'),_0xdecf('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb0bf=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x5382c6,_0x15b39c){var _0x3a2beb=function(_0x24caae){while(--_0x24caae){_0x5382c6['push'](_0x5382c6['shift']());}};_0x3a2beb(++_0x15b39c);}(_0xb0bf,0x69));var _0xfb0b=function(_0x157759,_0x398eec){_0x157759=_0x157759-0x0;var _0xadc7ad=_0xb0bf[_0x157759];return _0xadc7ad;};'use strict';var _=require(_0xfb0b('0x0'));var util=require('util');var logger=require(_0xfb0b('0x1'))(_0xfb0b('0x2'));var moment=require(_0xfb0b('0x3'));var BPromise=require(_0xfb0b('0x4'));var rp=require(_0xfb0b('0x5'));var fs=require('fs');var path=require(_0xfb0b('0x6'));var rimraf=require('rimraf');var config=require(_0xfb0b('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xfb0b('0x8')]=function(_0x2faa08,_0x30bbe5){return _0x2faa08[_0xfb0b('0x9')](_0xfb0b('0xa'),attributes,{'tableName':_0xfb0b('0xb'),'paranoid':![],'indexes':[{'name':_0xfb0b('0xc'),'fields':[_0xfb0b('0xd'),_0xfb0b('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fe400d8..404f1d4 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 _0x3d76=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3d76,0x13c));var _0x63d7=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0x3d76[_0x57643b];return _0x53a35b;};'use strict';var _=require(_0x63d7('0x0'));var util=require(_0x63d7('0x1'));var moment=require(_0x63d7('0x2'));var BPromise=require(_0x63d7('0x3'));var rs=require(_0x63d7('0x4'));var fs=require('fs');var Redis=require(_0x63d7('0x5'));var db=require(_0x63d7('0x6'))['db'];var utils=require(_0x63d7('0x7'));var logger=require(_0x63d7('0x8'))(_0x63d7('0x9'));var config=require('../../config/environment');var jayson=require(_0x63d7('0xa'));var client=jayson[_0x63d7('0xb')][_0x63d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28b1fa,_0x1fba14,_0x10dfda){return new BPromise(function(_0x55d510,_0x4183dd){return client[_0x63d7('0xd')](_0x28b1fa,_0x10dfda)['then'](function(_0x3f7b6b){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x1fba14,_0x63d7('0xe'));logger[_0x63d7('0xf')](_0x63d7('0x10'),_0x1fba14,_0x63d7('0xe'),JSON['stringify'](_0x3f7b6b));if(_0x3f7b6b['error']){if(_0x3f7b6b[_0x63d7('0x11')][_0x63d7('0x12')]===0x1f4){logger[_0x63d7('0x11')](_0x63d7('0x13'),_0x1fba14,_0x3f7b6b[_0x63d7('0x11')][_0x63d7('0x14')]);return _0x4183dd(_0x3f7b6b['error'][_0x63d7('0x14')]);}logger[_0x63d7('0x11')](_0x63d7('0x13'),_0x1fba14,_0x3f7b6b[_0x63d7('0x11')][_0x63d7('0x14')]);return _0x55d510(_0x3f7b6b[_0x63d7('0x11')][_0x63d7('0x14')]);}else{logger['info'](_0x63d7('0x13'),_0x1fba14,_0x63d7('0xe'));_0x55d510(_0x3f7b6b[_0x63d7('0x15')][_0x63d7('0x14')]);}})['catch'](function(_0x44f94a){logger[_0x63d7('0x11')](_0x63d7('0x13'),_0x1fba14,_0x44f94a);_0x4183dd(_0x44f94a);});});} \ No newline at end of file +var _0x0298=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x4a80c7,_0x36a966){var _0x1c8780=function(_0x3960de){while(--_0x3960de){_0x4a80c7['push'](_0x4a80c7['shift']());}};_0x1c8780(++_0x36a966);}(_0x0298,0x74));var _0x8029=function(_0x1f9e17,_0x127015){_0x1f9e17=_0x1f9e17-0x0;var _0x4fda50=_0x0298[_0x1f9e17];return _0x4fda50;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var moment=require('moment');var BPromise=require(_0x8029('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8029('0x3'));var db=require(_0x8029('0x4'))['db'];var utils=require(_0x8029('0x5'));var logger=require(_0x8029('0x6'))(_0x8029('0x7'));var config=require(_0x8029('0x8'));var jayson=require(_0x8029('0x9'));var client=jayson[_0x8029('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd7497e,_0x24ddfa,_0x1ac95a){return new BPromise(function(_0xc61637,_0x29688f){return client[_0x8029('0xb')](_0xd7497e,_0x1ac95a)[_0x8029('0xc')](function(_0x5a0ddc){logger[_0x8029('0xd')](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));logger[_0x8029('0x10')](_0x8029('0x11'),_0x24ddfa,_0x8029('0xf'),JSON[_0x8029('0x12')](_0x5a0ddc));if(_0x5a0ddc[_0x8029('0x13')]){if(_0x5a0ddc['error'][_0x8029('0x14')]===0x1f4){logger[_0x8029('0x13')](_0x8029('0xe'),_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0x29688f(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0xc61637(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}else{logger['info'](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));_0xc61637(_0x5a0ddc['result'][_0x8029('0x15')]);}})['catch'](function(_0xaa28da){logger[_0x8029('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x24ddfa,_0xaa28da);_0x29688f(_0xaa28da);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f8dcff6..c852326 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 _0xdd9c=['update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdd9c,0x12e));var _0xcdd9=function(_0x5c64ae,_0x463dcb){_0x5c64ae=_0x5c64ae-0x0;var _0x422e59=_0xdd9c[_0x5c64ae];return _0x422e59;};'use strict';var multer=require('multer');var util=require(_0xcdd9('0x0'));var path=require(_0xcdd9('0x1'));var timeout=require(_0xcdd9('0x2'));var express=require('express');var router=express[_0xcdd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdd9('0x5'));var controller=require('./voiceRecording.controller');router[_0xcdd9('0x6')]('/',auth[_0xcdd9('0x7')](),controller['index']);router[_0xcdd9('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xcdd9('0x8')]);router['get'](_0xcdd9('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xcdd9('0xa'),auth[_0xcdd9('0x7')](),controller[_0xcdd9('0xb')]);router[_0xcdd9('0x6')](_0xcdd9('0xc'),controller[_0xcdd9('0xd')]);router[_0xcdd9('0x6')]('/:id/transcribe',auth[_0xcdd9('0x7')](),controller[_0xcdd9('0xe')]);router[_0xcdd9('0xf')]('/',auth['isAuthenticated'](),controller[_0xcdd9('0x10')]);router[_0xcdd9('0xf')](_0xcdd9('0x11'),auth[_0xcdd9('0x7')](),controller[_0xcdd9('0x12')]);router[_0xcdd9('0x13')](_0xcdd9('0x9'),auth['isAuthenticated'](),controller[_0xcdd9('0x14')]);router[_0xcdd9('0x15')](_0xcdd9('0x9'),auth[_0xcdd9('0x7')](),controller[_0xcdd9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa1b7=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x429aea,_0x147481){var _0x117751=function(_0x49dca0){while(--_0x49dca0){_0x429aea['push'](_0x429aea['shift']());}};_0x117751(++_0x147481);}(_0xa1b7,0x127));var _0x7a1b=function(_0x4ac9e5,_0x5be580){_0x4ac9e5=_0x4ac9e5-0x0;var _0x581158=_0xa1b7[_0x4ac9e5];return _0x581158;};'use strict';var multer=require(_0x7a1b('0x0'));var util=require(_0x7a1b('0x1'));var path=require(_0x7a1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a1b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7a1b('0x4'));var interaction=require(_0x7a1b('0x5'));var config=require(_0x7a1b('0x6'));var controller=require(_0x7a1b('0x7'));router[_0x7a1b('0x8')]('/',auth[_0x7a1b('0x9')](),controller[_0x7a1b('0xa')]);router[_0x7a1b('0x8')]('/describe',auth[_0x7a1b('0x9')](),controller['describe']);router[_0x7a1b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7a1b('0xb')]);router[_0x7a1b('0x8')](_0x7a1b('0xc'),auth['isAuthenticated'](),controller[_0x7a1b('0xd')]);router['get']('/:id/downloads',controller[_0x7a1b('0xe')]);router[_0x7a1b('0x8')](_0x7a1b('0xf'),auth[_0x7a1b('0x9')](),controller[_0x7a1b('0x10')]);router[_0x7a1b('0x11')]('/',auth[_0x7a1b('0x9')](),controller['create']);router[_0x7a1b('0x11')]('/:id/transcribe',auth[_0x7a1b('0x9')](),controller[_0x7a1b('0x12')]);router[_0x7a1b('0x13')]('/:id',auth[_0x7a1b('0x9')](),controller[_0x7a1b('0x14')]);router[_0x7a1b('0x15')](_0x7a1b('0x16'),auth['isAuthenticated'](),controller[_0x7a1b('0x17')]);module[_0x7a1b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fa9922b..b470c1a 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(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var 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 6f11238..b07c61c 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 _0x16aa=['findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','differenceBy','format','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','include','catch','create','body','find','params','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','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)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe'];(function(_0x1c4600,_0x42813e){var _0x5d8cf6=function(_0x12b7a0){while(--_0x12b7a0){_0x1c4600['push'](_0x1c4600['shift']());}};_0x5d8cf6(++_0x42813e);}(_0x16aa,0x157));var _0xa16a=function(_0x1265ed,_0xb94851){_0x1265ed=_0x1265ed-0x0;var _0x2b5565=_0x16aa[_0x1265ed];return _0x2b5565;};'use strict';var emlformat=require(_0xa16a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa16a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa16a('0x2'));var util=require(_0xa16a('0x3'));var path=require(_0xa16a('0x4'));var sox=require(_0xa16a('0x5'));var csv=require(_0xa16a('0x6'));var ejs=require(_0xa16a('0x7'));var fs=require('fs');var fs_extra=require(_0xa16a('0x8'));var _=require(_0xa16a('0x9'));var squel=require(_0xa16a('0xa'));var crypto=require(_0xa16a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa16a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa16a('0xd'));var Papa=require('papaparse');var AWS=require(_0xa16a('0xe'));var uuidv4=require(_0xa16a('0xf'));var Redis=require(_0xa16a('0x10'));var authService=require(_0xa16a('0x11'));var qs=require(_0xa16a('0x12'));var as=require(_0xa16a('0x13'));var hardwareService=require(_0xa16a('0x14'));var logger=require(_0xa16a('0x15'))(_0xa16a('0x16'));var utils=require(_0xa16a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa16a('0x18'))['db'];function respondWithStatusCode(_0xae5b37,_0x50f4c9){_0x50f4c9=_0x50f4c9||0xcc;return function(_0x3aadbf){if(_0x3aadbf){return _0xae5b37[_0xa16a('0x19')](_0x50f4c9);}return _0xae5b37[_0xa16a('0x1a')](_0x50f4c9)['end']();};}function respondWithResult(_0xa27a3c,_0xf0ec05){_0xf0ec05=_0xf0ec05||0xc8;return function(_0x1d87a3){if(_0x1d87a3){return _0xa27a3c[_0xa16a('0x1a')](_0xf0ec05)[_0xa16a('0x1b')](_0x1d87a3);}};}function respondWithFilteredResult(_0x4fffc1,_0x6e5574){return function(_0x4f50bd){if(_0x4f50bd){var _0xa74546=typeof _0x6e5574[_0xa16a('0x1c')]===_0xa16a('0x1d')&&typeof _0x6e5574['limit']===_0xa16a('0x1d');var _0x123b35=_0x4f50bd[_0xa16a('0x1e')];var _0x4fd1de=_0xa74546?0x0:_0x6e5574[_0xa16a('0x1c')];var _0x14cddb=_0xa74546?_0x4f50bd[_0xa16a('0x1e')]:_0x6e5574[_0xa16a('0x1c')]+_0x6e5574[_0xa16a('0x1f')];var _0xb89e57;if(_0x14cddb>=_0x123b35){_0x14cddb=_0x123b35;_0xb89e57=0xc8;}else{_0xb89e57=0xce;}_0x4fffc1[_0xa16a('0x1a')](_0xb89e57);return _0x4fffc1[_0xa16a('0x20')](_0xa16a('0x21'),_0x4fd1de+'-'+_0x14cddb+'/'+_0x123b35)[_0xa16a('0x1b')](_0x4f50bd);}return null;};}function patchUpdates(_0x2aa931){return function(_0x459596){try{jsonpatch[_0xa16a('0x22')](_0x459596,_0x2aa931,!![]);}catch(_0x400562){return BPromise[_0xa16a('0x23')](_0x400562);}return _0x459596[_0xa16a('0x24')]();};}function saveUpdates(_0x61b7f9,_0x352415){return function(_0x511e81){if(_0x511e81){return _0x511e81[_0xa16a('0x25')](_0x61b7f9)[_0xa16a('0x26')](function(_0x2ccd3e){return _0x2ccd3e;});}return null;};}function removeEntity(_0x53e24d,_0x4cac19){return function(_0x91b2ca){if(_0x91b2ca){return _0x91b2ca[_0xa16a('0x27')]()[_0xa16a('0x26')](function(){_0x53e24d[_0xa16a('0x1a')](0xcc)[_0xa16a('0x28')]();});}};}function handleEntityNotFound(_0x196088,_0x34c4a2){return function(_0x13b436){if(!_0x13b436){_0x196088['sendStatus'](0x194);}return _0x13b436;};}function handleError(_0x2fa178,_0x2c5b16){_0x2c5b16=_0x2c5b16||0x1f4;return function(_0x314ff7){logger[_0xa16a('0x29')](_0x314ff7[_0xa16a('0x2a')]);if(_0x314ff7[_0xa16a('0x2b')]){delete _0x314ff7[_0xa16a('0x2b')];}_0x2fa178[_0xa16a('0x1a')](_0x2c5b16)[_0xa16a('0x2c')](_0x314ff7);};}exports[_0xa16a('0x2d')]=function(_0x480717,_0x5439ae){var _0x290990={},_0x3f4341={},_0x34a58c={'count':0x0,'rows':[]};var _0x5888e3=_[_0xa16a('0x2e')](db[_0xa16a('0x2f')][_0xa16a('0x30')],function(_0x3ec887){return{'name':_0x3ec887['fieldName'],'type':_0x3ec887[_0xa16a('0x31')][_0xa16a('0x32')]};});_0x3f4341['model']=_[_0xa16a('0x33')](_[_0xa16a('0x2e')](_0x5888e3,_0xa16a('0x2b')),[_0xa16a('0x34')]);_0x3f4341[_0xa16a('0x35')]=_[_0xa16a('0x36')](_0x480717[_0xa16a('0x35')]);_0x3f4341[_0xa16a('0x37')]=_[_0xa16a('0x38')](_0x3f4341['model'],_0x3f4341['query']);_0x290990[_0xa16a('0x39')]=_[_0xa16a('0x38')](_0x3f4341[_0xa16a('0x3a')],qs['fields'](_0x480717[_0xa16a('0x35')][_0xa16a('0x3b')]));_0x290990[_0xa16a('0x39')]=_0x290990[_0xa16a('0x39')][_0xa16a('0x3c')]?_0x290990[_0xa16a('0x39')]:_0x3f4341[_0xa16a('0x3a')];if(!_0x480717[_0xa16a('0x35')]['hasOwnProperty'](_0xa16a('0x3d'))){_0x290990[_0xa16a('0x1f')]=qs[_0xa16a('0x1f')](_0x480717[_0xa16a('0x35')]['limit']);_0x290990['offset']=qs[_0xa16a('0x1c')](_0x480717[_0xa16a('0x35')][_0xa16a('0x1c')]);}_0x290990[_0xa16a('0x3e')]=qs[_0xa16a('0x3f')](_0x480717[_0xa16a('0x35')]['sort']);_0x290990['where']=qs[_0xa16a('0x37')](_[_0xa16a('0x40')](_0x480717['query'],_0x3f4341[_0xa16a('0x37')]),_0x5888e3);if(_0x480717[_0xa16a('0x35')][_0xa16a('0x41')]){_0x290990[_0xa16a('0x42')]=_[_0xa16a('0x43')](_0x290990['where'],{'$or':_[_0xa16a('0x2e')](_0x5888e3,function(_0x2b9b99){if(_0x2b9b99[_0xa16a('0x31')]!=='VIRTUAL'){var _0x3338d1={};_0x3338d1[_0x2b9b99[_0xa16a('0x2b')]]={'$like':'%'+_0x480717[_0xa16a('0x35')][_0xa16a('0x41')]+'%'};return _0x3338d1;}})});}_0x290990=_['merge']({},_0x290990,_0x480717[_0xa16a('0x44')]);var _0x341a5d={'where':_0x290990[_0xa16a('0x42')]};return db[_0xa16a('0x2f')]['count'](_0x341a5d)['then'](function(_0x3c17b6){_0x34a58c[_0xa16a('0x1e')]=_0x3c17b6;if(_0x480717[_0xa16a('0x35')][_0xa16a('0x45')]){_0x290990['include']=[{'all':!![]}];}return db[_0xa16a('0x2f')][_0xa16a('0x46')](_0x290990);})[_0xa16a('0x26')](function(_0xc8d1ce){_0x34a58c[_0xa16a('0x47')]=_0xc8d1ce;return _0x34a58c;})[_0xa16a('0x26')](respondWithFilteredResult(_0x5439ae,_0x290990))['catch'](handleError(_0x5439ae,null));};exports[_0xa16a('0x48')]=function(_0x3b37de,_0x262a4f){var _0xde79c={'raw':![],'where':{'id':_0x3b37de['params']['id']}},_0x35db4f={};_0x35db4f[_0xa16a('0x3a')]=_[_0xa16a('0x36')](db['VoiceRecording'][_0xa16a('0x30')]);_0x35db4f[_0xa16a('0x35')]=_[_0xa16a('0x36')](_0x3b37de[_0xa16a('0x35')]);_0x35db4f[_0xa16a('0x37')]=_[_0xa16a('0x38')](_0x35db4f[_0xa16a('0x3a')],_0x35db4f[_0xa16a('0x35')]);_0xde79c[_0xa16a('0x39')]=_[_0xa16a('0x38')](_0x35db4f[_0xa16a('0x3a')],qs[_0xa16a('0x3b')](_0x3b37de['query'][_0xa16a('0x3b')]));_0xde79c[_0xa16a('0x39')]=_0xde79c[_0xa16a('0x39')][_0xa16a('0x3c')]?_0xde79c[_0xa16a('0x39')]:_0x35db4f[_0xa16a('0x3a')];if(_0x3b37de[_0xa16a('0x35')]['includeAll']){_0xde79c[_0xa16a('0x49')]=[{'all':!![]}];}_0xde79c=_[_0xa16a('0x43')]({},_0xde79c,_0x3b37de[_0xa16a('0x44')]);return db[_0xa16a('0x2f')]['find'](_0xde79c)['then'](handleEntityNotFound(_0x262a4f,null))[_0xa16a('0x26')](respondWithResult(_0x262a4f,null))[_0xa16a('0x4a')](handleError(_0x262a4f,null));};exports[_0xa16a('0x4b')]=function(_0x14da5b,_0x4038f9){return db[_0xa16a('0x2f')][_0xa16a('0x4b')](_0x14da5b['body'],{})[_0xa16a('0x26')](respondWithResult(_0x4038f9,0xc9))[_0xa16a('0x4a')](handleError(_0x4038f9,null));};exports[_0xa16a('0x25')]=function(_0x2ee14f,_0xf00aea){if(_0x2ee14f[_0xa16a('0x4c')]['id']){delete _0x2ee14f[_0xa16a('0x4c')]['id'];}return db[_0xa16a('0x2f')][_0xa16a('0x4d')]({'where':{'id':_0x2ee14f[_0xa16a('0x4e')]['id']}})['then'](handleEntityNotFound(_0xf00aea,null))[_0xa16a('0x26')](saveUpdates(_0x2ee14f[_0xa16a('0x4c')],null))[_0xa16a('0x26')](respondWithResult(_0xf00aea,null))[_0xa16a('0x4a')](handleError(_0xf00aea,null));};exports[_0xa16a('0x4f')]=function(_0x3ae2ac,_0x42418b){return db[_0xa16a('0x2f')][_0xa16a('0x4f')]()[_0xa16a('0x26')](respondWithResult(_0x42418b,null))[_0xa16a('0x4a')](handleError(_0x42418b,null));};exports[_0xa16a('0x50')]=function(_0x320169,_0x26bd3f,_0x2360c5){var _0x34facc=require('../../components/encryptor');var _0x259abf=![];var _0x22e5b3={};if(_0x320169[_0xa16a('0x35')][_0xa16a('0x31')]&&_0x320169[_0xa16a('0x35')]['type']===_0xa16a('0x51')){_0x22e5b3[_0xa16a('0x51')]=_0x320169[_0xa16a('0x4e')]['id'];}else{_0x22e5b3['id']=_0x320169['params']['id'];}return db[_0xa16a('0x2f')][_0xa16a('0x4d')]({'where':_0x22e5b3,'attributes':['id',_0xa16a('0x52')],'raw':!![]})[_0xa16a('0x26')](handleEntityNotFound(_0x26bd3f,null))[_0xa16a('0x26')](function(_0x553c4e){if(_0x553c4e){var _0x533a48=_0x553c4e[_0xa16a('0x52')];var _0x41a213=util[_0xa16a('0x34')](_0xa16a('0x53'),_0x533a48);if(fs[_0xa16a('0x54')](_0x41a213)){_0x259abf=!![];return _0x34facc[_0xa16a('0x55')](_0x41a213,_0x533a48,config[_0xa16a('0x56')][_0xa16a('0x57')])['then'](function(){return _0x553c4e;});}return _0x553c4e;}})[_0xa16a('0x26')](function(_0x5dfece){if(_0x5dfece){var _0x3f4d05=_0x5dfece[_0xa16a('0x52')];if(!fs[_0xa16a('0x54')](_0x3f4d05)){throw new db[(_0xa16a('0x58'))][(_0xa16a('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x5dfece[_0xa16a('0x5a')]){return _0x26bd3f['download'](_0x3f4d05,_0x5dfece['filename']+path[_0xa16a('0x5b')](_0x3f4d05),function(){if(_0x259abf){fs[_0xa16a('0x5c')](_0x3f4d05);}});}else{return _0x26bd3f[_0xa16a('0x50')](_0x3f4d05,function(_0x212738){if(_0x259abf){fs['unlink'](_0x3f4d05);}});}}})[_0xa16a('0x4a')](function(_0x2b6fe4){if(_0x2b6fe4[_0xa16a('0x5d')]===_0xa16a('0x5e')){_0x26bd3f[_0xa16a('0x1a')](0x194)['send'](_0xa16a('0x5f'));}else{return handleError(_0x26bd3f,null);}});};exports[_0xa16a('0x60')]=function(_0x40ad18,_0x489ea6,_0x3f823e){var _0x21cc25=require(_0xa16a('0x61'));var _0x5be80d=![];var _0x1ec60b={'$and':[db[_0xa16a('0x62')][_0xa16a('0x42')](db[_0xa16a('0x62')]['fn'](_0xa16a('0x63'),db[_0xa16a('0x62')][_0xa16a('0x64')]('uniqueid')),_0x40ad18[_0xa16a('0x35')][_0xa16a('0x65')])]};if(_0x40ad18[_0xa16a('0x35')][_0xa16a('0x31')]&&_0x40ad18['query'][_0xa16a('0x31')]===_0xa16a('0x51')){_0x1ec60b[_0xa16a('0x66')]['push']({'uniqueid':_0x40ad18[_0xa16a('0x4e')]['id']});}else{_0x1ec60b[_0xa16a('0x66')]['push']({'id':_0x40ad18[_0xa16a('0x4e')]['id']});}return db[_0xa16a('0x2f')][_0xa16a('0x4d')]({'where':_0x1ec60b,'attributes':['id',_0xa16a('0x52')],'raw':!![]})[_0xa16a('0x26')](handleEntityNotFound(_0x489ea6,null))[_0xa16a('0x26')](function(_0x23fa73){if(_0x23fa73){var _0x476cf9=util['format'](_0xa16a('0x53'),_0x23fa73[_0xa16a('0x52')]);if(fs[_0xa16a('0x54')](_0x476cf9)){_0x5be80d=!![];return _0x21cc25['decryptFile'](_0x476cf9,_0x23fa73[_0xa16a('0x52')],config[_0xa16a('0x56')]['recording'])['then'](function(){return _0x23fa73;});}return _0x23fa73;}})[_0xa16a('0x26')](function(_0x1e9e81){if(_0x1e9e81){if(!fs[_0xa16a('0x54')](_0x1e9e81[_0xa16a('0x52')])){throw new db[(_0xa16a('0x58'))]['ValidationError'](_0xa16a('0x5e'));}if(_0x1e9e81['filename']){return _0x489ea6[_0xa16a('0x50')](_0x1e9e81[_0xa16a('0x52')],_0x1e9e81[_0xa16a('0x5a')]+path['extname'](_0x1e9e81['value']),function(){if(_0x5be80d){fs[_0xa16a('0x5c')](_0x1e9e81[_0xa16a('0x52')]);}});}else{return _0x489ea6[_0xa16a('0x50')](_0x1e9e81[_0xa16a('0x52')],function(_0xbd1f71){if(_0x5be80d){fs[_0xa16a('0x5c')](_0x1e9e81['value']);}});}}})[_0xa16a('0x4a')](handleError(_0x489ea6,null));};exports['destroy']=function(_0x2145e2,_0xc39b15){return db[_0xa16a('0x2f')][_0xa16a('0x4d')]({'where':{'id':_0x2145e2[_0xa16a('0x4e')]['id']}})['then'](function(_0x5bd7de){if(_[_0xa16a('0x67')](_0x5bd7de)){throw new ReferenceError(_0xa16a('0x68'));}return _0x5bd7de;})[_0xa16a('0x26')](function(_0x16d309){var _0x185a10=_0x16d309[_0xa16a('0x52')];logger[_0xa16a('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x185a10);if(!_[_0xa16a('0x67')](_0x16d309[_0xa16a('0x52')])&&fs[_0xa16a('0x54')](_0x185a10)){logger[_0xa16a('0x69')](_0xa16a('0x6a')+_0x185a10+_0xa16a('0x6b'));fs['unlinkSync'](_0x185a10);}_0x185a10=_0x185a10+_0xa16a('0x6c');if(!_[_0xa16a('0x67')](_0x16d309[_0xa16a('0x52')])&&fs['existsSync'](_0x185a10)){logger['info'](_0xa16a('0x6a')+_0x185a10+_0xa16a('0x6b'));fs['unlinkSync'](_0x185a10);}return _0x16d309;})[_0xa16a('0x26')](function(_0x1c620d){if(!_0x1c620d)throw new InternalError();return _0x1c620d[_0xa16a('0x27')]();})[_0xa16a('0x26')](function(){_0xc39b15['status'](0xcc)[_0xa16a('0x28')]();})[_0xa16a('0x4a')](handleError(_0xc39b15,null));};function getBucketslist(_0x37fac3,_0x50f248,_0x2ecc30){return new Promise(function(_0x3dc989,_0x1e941a){var _0x420c08=new AWS['S3']({'accessKeyId':_0x50f248,'secretAccessKey':_0x37fac3,'region':_0x2ecc30});_0x420c08['listBuckets']({},function(_0x2e73b1,_0x5cba90){if(_0x2e73b1){return _0x1e941a(_0x2e73b1);}else{return _0x3dc989(_0x5cba90);}});});}function createBucket(_0x3366f7,_0x303336,_0x2ec378,_0x3fb032){return new Promise(function(_0x5a5d5e,_0x19fcc7){var _0x59e5e2=new AWS['S3']({'accessKeyId':_0x303336,'secretAccessKey':_0x3366f7,'region':_0x2ec378});_0x59e5e2[_0xa16a('0x6d')]({'Bucket':_0x3fb032},function(_0x57dcae,_0x43b7da){if(_0x57dcae){return _0x19fcc7(_0x57dcae);}else{return _0x5a5d5e(_0x43b7da);}});});}function uploadFile(_0x3b4219,_0x399b26,_0x401fca,_0x597a65,_0x198b5d,_0x41d8db){return new Promise(function(_0x569f2e,_0x39e815){var _0x1e2b13=new AWS['S3']({'accessKeyId':_0x399b26,'secretAccessKey':_0x3b4219,'region':_0x401fca});_0x1e2b13[_0xa16a('0x6e')]({'Bucket':_0x597a65,'Key':_0x198b5d,'Body':_0x41d8db},function(_0x5f5319,_0x2ab89b){if(_0x5f5319){return _0x39e815(_0x5f5319);}else{return _0x569f2e(_0x2ab89b);}});});}function startTranscribe(_0x1afa9a,_0x13d392,_0x1a2311,_0x1527db,_0x503619,_0x49da80){return new Promise(function(_0x2f6ee1,_0x3a77e6){var _0x4235cc=new AWS[(_0xa16a('0x6f'))]({'accessKeyId':_0x13d392,'secretAccessKey':_0x1afa9a,'region':_0x1a2311});_0x4235cc[_0xa16a('0x70')]({'TranscriptionJobName':_0x1527db,'LanguageCode':_0x503619,'Media':{'MediaFileUri':_0x49da80}},function(_0xe1057b,_0xb132d3){if(_0xe1057b){return _0x3a77e6(_0xe1057b);}else{return _0x2f6ee1(_0xb132d3);}});});}function transcribe(_0x4186b2,_0x580ce5,_0x51f635,_0x367fed,_0x876606,_0x452ee5,_0x37b514){return new Promise(function(_0x455664,_0x231a3c){var _0x4fb71f={};logger[_0xa16a('0x69')](util[_0xa16a('0x34')](_0xa16a('0x71'),_0x4186b2,_0x876606));return uploadFile(_0x580ce5,_0x51f635,_0x367fed,_0x876606,path[_0xa16a('0x72')](_0x452ee5),fs[_0xa16a('0x73')](_0x452ee5))[_0xa16a('0x26')](function(_0x15e9fb){logger[_0xa16a('0x69')](util[_0xa16a('0x34')](_0xa16a('0x74'),_0x4186b2,_0x876606,_0x15e9fb['Location']));_0x4fb71f[_0xa16a('0x75')]=_0x15e9fb[_0xa16a('0x76')];_0x4fb71f[_0xa16a('0x77')]=_0x15e9fb[_0xa16a('0x78')];logger[_0xa16a('0x69')](util[_0xa16a('0x34')](_0xa16a('0x79'),_0x4186b2));return startTranscribe(_0x580ce5,_0x51f635,_0x367fed,uuidv4(),_0x37b514,_0x15e9fb[_0xa16a('0x78')]);})[_0xa16a('0x26')](function(_0x580caf){logger['info'](util[_0xa16a('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4186b2,_0x580caf['TranscriptionJob'][_0xa16a('0x7a')]));_0x4fb71f[_0xa16a('0x7b')]=_0x580caf[_0xa16a('0x7c')][_0xa16a('0x7a')];_0x4fb71f[_0xa16a('0x7d')]=_0x580caf[_0xa16a('0x7c')][_0xa16a('0x7e')];return _0x455664(_0x4fb71f);})[_0xa16a('0x4a')](function(_0x1acacf){return _0x231a3c(_0x1acacf);});});}exports[_0xa16a('0x7f')]=function(_0x4593b6,_0x4cc98c,_0x4ec011){var _0x37a7ae;var _0x396603;var _0x2ad560;var _0x21b848=require(_0xa16a('0x61'));return db[_0xa16a('0x2f')][_0xa16a('0x80')]({'where':{'id':_0x4593b6['params']['id']}})[_0xa16a('0x26')](function(_0x39d6f3){if(_0x39d6f3){var _0x150f77=util['format'](_0xa16a('0x53'),_0x39d6f3[_0xa16a('0x52')]);if(fs[_0xa16a('0x54')](_0x150f77)){cypher=!![];return _0x21b848[_0xa16a('0x55')](_0x150f77,_0x39d6f3[_0xa16a('0x52')],config['secrets'][_0xa16a('0x57')])[_0xa16a('0x26')](function(){return _0x39d6f3;});}return _0x39d6f3;}})['then'](function(_0x494c35){if(!_0x494c35){throw new db['Sequelize'][(_0xa16a('0x59'))](_0xa16a('0x81'));}_0x396603=_0x494c35;return db[_0xa16a('0x82')][_0xa16a('0x80')]({'where':{'id':0x1}});})[_0xa16a('0x26')](handleEntityNotFound(_0x4cc98c,null))[_0xa16a('0x26')](function(_0x348cb3){if(_0x348cb3){_0x37a7ae=_0x348cb3;if(!_0x37a7ae['transcribe']||!_0x37a7ae['transcribeAccountId']||!_0x37a7ae[_0xa16a('0x83')]||!_0x37a7ae[_0xa16a('0x84')]||!_0x37a7ae['bucket']){throw new db[(_0xa16a('0x58'))][(_0xa16a('0x59'))](_0xa16a('0x85'));}if(_0x4593b6['body'][_0xa16a('0x86')]&&(!_0x37a7ae[_0xa16a('0x87')]||!_0x37a7ae['sentimentAccountId']||!_0x37a7ae[_0xa16a('0x88')]||!_0x37a7ae['language']||!_0x37a7ae[_0xa16a('0x75')])){throw new db[(_0xa16a('0x58'))][(_0xa16a('0x59'))](_0xa16a('0x89'));}return db[_0xa16a('0x8a')][_0xa16a('0x80')]({'where':{'id':_0x37a7ae[_0xa16a('0x8b')]}});}})[_0xa16a('0x26')](function(_0x38c03a){if(!_0x38c03a){throw new db['Sequelize'][(_0xa16a('0x59'))](_0xa16a('0x8c'));}if(!_0x38c03a['data1']||!_0x38c03a[_0xa16a('0x8d')]){throw new db[(_0xa16a('0x58'))][(_0xa16a('0x59'))](_0xa16a('0x8e'));}_0x2ad560=_0x38c03a;return getBucketslist(_0x2ad560['data1'],_0x2ad560[_0xa16a('0x8d')],_0x37a7ae[_0xa16a('0x83')]);})['then'](function(_0x286194){if(_0x286194&&_0x286194[_0xa16a('0x8f')]){var _0x1e230d=_['find'](_0x286194['Buckets'],function(_0x30bcfa){return _0x30bcfa[_0xa16a('0x90')]===_0x37a7ae[_0xa16a('0x75')];});if(!_0x1e230d){logger[_0xa16a('0x69')](util[_0xa16a('0x34')](_0xa16a('0x91'),_0x4593b6[_0xa16a('0x4e')]['id'],_0x37a7ae[_0xa16a('0x75')]));return createBucket(_0x2ad560[_0xa16a('0x92')],_0x2ad560[_0xa16a('0x8d')],_0x37a7ae[_0xa16a('0x83')],_0x37a7ae['bucket']);}logger[_0xa16a('0x69')](util['format'](_0xa16a('0x93'),_0x4593b6[_0xa16a('0x4e')]['id'],_0x37a7ae[_0xa16a('0x75')]));return;}})[_0xa16a('0x26')](function(_0x401279){if(_0x396603['transcribeStatus']==='NEW'){return transcribe(_0x4593b6[_0xa16a('0x4e')]['id'],_0x2ad560[_0xa16a('0x92')],_0x2ad560['data2'],_0x37a7ae['transcribeRegion'],_0x37a7ae[_0xa16a('0x75')],_0x396603[_0xa16a('0x52')],_0x37a7ae[_0xa16a('0x84')]);}else{logger[_0xa16a('0x69')](util[_0xa16a('0x34')](_0xa16a('0x94'),_0x4593b6[_0xa16a('0x4e')]['id']));return{'transcribeStatus':_0xa16a('0x95')};}})['then'](function(_0x1b630e){if(_0x1b630e){_0x1b630e['tempSentiment']=_0x4593b6[_0xa16a('0x4c')][_0xa16a('0x86')];return _0x396603[_0xa16a('0x96')](_0x1b630e);}})[_0xa16a('0x26')](respondWithResult(_0x4cc98c,null))[_0xa16a('0x4a')](handleError(_0x4cc98c,null));};function writeFile(_0x4a47b6,_0x55e90e){return new Promise(function(_0x53475e,_0x13f7d2){fs[_0xa16a('0x97')](_0x55e90e,_0x4a47b6,function(_0x4678c4,_0x2318a9){if(_0x4678c4){return _0x13f7d2(_0x4678c4);}else{return _0x53475e(_0x2318a9);}});});}exports[_0xa16a('0x98')]=function(_0x1ff929,_0x44c9bd,_0x13469e){return db[_0xa16a('0x2f')][_0xa16a('0x80')]({'where':{'id':_0x1ff929['params']['id']}})[_0xa16a('0x26')](handleEntityNotFound(_0x44c9bd))[_0xa16a('0x26')](function(_0x5051ac){if(_0x5051ac&&_0x5051ac[_0xa16a('0x99')]){var _0x4379ab=_0x5051ac[_0xa16a('0x99')];var _0x2bba30=config[_0xa16a('0x9a')]+'/server/files/transcribes/transcribe_'+_0x5051ac['id']+_0xa16a('0x9b');if(fs[_0xa16a('0x54')](_0x2bba30)){return _0x2bba30;}return writeFile(_0x4379ab,_0x2bba30)[_0xa16a('0x26')](function(){return _0x2bba30;});}else{throw new db[(_0xa16a('0x58'))]['ValidationError'](_0xa16a('0x9c'));}})[_0xa16a('0x26')](function(_0x63dc64){return _0x44c9bd[_0xa16a('0x50')](_0x63dc64);})[_0xa16a('0x4a')](handleError(_0x44c9bd));}; \ No newline at end of file +var _0xd2a3=['language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','keys','model','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','filename','unlink','message','downloads','sequelize','MD5','col','push','extname','Entity\x20not\x20found','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','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','runSentiment','sentiment','sentimentAccountId'];(function(_0x25ea0f,_0x28aa4e){var _0x39cfb6=function(_0x1bd80f){while(--_0x1bd80f){_0x25ea0f['push'](_0x25ea0f['shift']());}};_0x39cfb6(++_0x28aa4e);}(_0xd2a3,0x144));var _0x3d2a=function(_0x42da09,_0x21ad9a){_0x42da09=_0x42da09-0x0;var _0x253924=_0xd2a3[_0x42da09];return _0x253924;};'use strict';var emlformat=require(_0x3d2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d2a('0x1'));var jsonpatch=require(_0x3d2a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d2a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3d2a('0x4'));var csv=require(_0x3d2a('0x5'));var ejs=require(_0x3d2a('0x6'));var fs=require('fs');var fs_extra=require(_0x3d2a('0x7'));var _=require(_0x3d2a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d2a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3d2a('0x5'));var querystring=require(_0x3d2a('0xa'));var Papa=require(_0x3d2a('0xb'));var AWS=require(_0x3d2a('0xc'));var uuidv4=require(_0x3d2a('0xd'));var Redis=require(_0x3d2a('0xe'));var authService=require(_0x3d2a('0xf'));var qs=require(_0x3d2a('0x10'));var as=require(_0x3d2a('0x11'));var hardwareService=require(_0x3d2a('0x12'));var logger=require('../../config/logger')(_0x3d2a('0x13'));var utils=require(_0x3d2a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3d2a('0x15'));var db=require(_0x3d2a('0x16'))['db'];function respondWithStatusCode(_0x1c8293,_0x32c61e){_0x32c61e=_0x32c61e||0xcc;return function(_0x3cabcd){if(_0x3cabcd){return _0x1c8293[_0x3d2a('0x17')](_0x32c61e);}return _0x1c8293[_0x3d2a('0x18')](_0x32c61e)[_0x3d2a('0x19')]();};}function respondWithResult(_0x20d72e,_0x442700){_0x442700=_0x442700||0xc8;return function(_0x22edea){if(_0x22edea){return _0x20d72e[_0x3d2a('0x18')](_0x442700)[_0x3d2a('0x1a')](_0x22edea);}};}function respondWithFilteredResult(_0x3c4e3c,_0xbb93bb){return function(_0x39fa0b){if(_0x39fa0b){var _0x4abf9e=typeof _0xbb93bb['offset']==='undefined'&&typeof _0xbb93bb['limit']===_0x3d2a('0x1b');var _0x41b6fd=_0x39fa0b[_0x3d2a('0x1c')];var _0x277a8f=_0x4abf9e?0x0:_0xbb93bb[_0x3d2a('0x1d')];var _0x32a575=_0x4abf9e?_0x39fa0b['count']:_0xbb93bb[_0x3d2a('0x1d')]+_0xbb93bb[_0x3d2a('0x1e')];var _0x3eed6a;if(_0x32a575>=_0x41b6fd){_0x32a575=_0x41b6fd;_0x3eed6a=0xc8;}else{_0x3eed6a=0xce;}_0x3c4e3c['status'](_0x3eed6a);return _0x3c4e3c[_0x3d2a('0x1f')](_0x3d2a('0x20'),_0x277a8f+'-'+_0x32a575+'/'+_0x41b6fd)[_0x3d2a('0x1a')](_0x39fa0b);}return null;};}function patchUpdates(_0x523714){return function(_0x26ebc1){try{jsonpatch[_0x3d2a('0x21')](_0x26ebc1,_0x523714,!![]);}catch(_0x1a1356){return BPromise[_0x3d2a('0x22')](_0x1a1356);}return _0x26ebc1['save']();};}function saveUpdates(_0x1b7a44,_0x155103){return function(_0x466579){if(_0x466579){return _0x466579[_0x3d2a('0x23')](_0x1b7a44)[_0x3d2a('0x24')](function(_0x4b041c){return _0x4b041c;});}return null;};}function removeEntity(_0x504f47,_0x3581af){return function(_0x213010){if(_0x213010){return _0x213010[_0x3d2a('0x25')]()[_0x3d2a('0x24')](function(){_0x504f47['status'](0xcc)[_0x3d2a('0x19')]();});}};}function handleEntityNotFound(_0x3c4465,_0x4c7c40){return function(_0x4e1384){if(!_0x4e1384){_0x3c4465['sendStatus'](0x194);}return _0x4e1384;};}function handleError(_0x2a77a2,_0x3800d0){_0x3800d0=_0x3800d0||0x1f4;return function(_0x3618bb){logger[_0x3d2a('0x26')](_0x3618bb[_0x3d2a('0x27')]);if(_0x3618bb['name']){delete _0x3618bb[_0x3d2a('0x28')];}_0x2a77a2['status'](_0x3800d0)[_0x3d2a('0x29')](_0x3618bb);};}exports[_0x3d2a('0x2a')]=function(_0x1653bd,_0x15ec7e){var _0x3d68a9={},_0x411b2d={},_0x4620b7={'count':0x0,'rows':[]};var _0x570d73=_[_0x3d2a('0x2b')](db[_0x3d2a('0x2c')][_0x3d2a('0x2d')],function(_0x32532f){return{'name':_0x32532f[_0x3d2a('0x2e')],'type':_0x32532f['type'][_0x3d2a('0x2f')]};});_0x411b2d['model']=_[_0x3d2a('0x30')](_[_0x3d2a('0x2b')](_0x570d73,_0x3d2a('0x28')),[_0x3d2a('0x31')]);_0x411b2d['query']=_[_0x3d2a('0x32')](_0x1653bd['query']);_0x411b2d['filters']=_['intersection'](_0x411b2d[_0x3d2a('0x33')],_0x411b2d['query']);_0x3d68a9[_0x3d2a('0x34')]=_[_0x3d2a('0x35')](_0x411b2d[_0x3d2a('0x33')],qs[_0x3d2a('0x36')](_0x1653bd[_0x3d2a('0x37')][_0x3d2a('0x36')]));_0x3d68a9[_0x3d2a('0x34')]=_0x3d68a9['attributes'][_0x3d2a('0x38')]?_0x3d68a9[_0x3d2a('0x34')]:_0x411b2d[_0x3d2a('0x33')];if(!_0x1653bd[_0x3d2a('0x37')][_0x3d2a('0x39')](_0x3d2a('0x3a'))){_0x3d68a9['limit']=qs[_0x3d2a('0x1e')](_0x1653bd[_0x3d2a('0x37')][_0x3d2a('0x1e')]);_0x3d68a9['offset']=qs[_0x3d2a('0x1d')](_0x1653bd[_0x3d2a('0x37')]['offset']);}_0x3d68a9['order']=qs[_0x3d2a('0x3b')](_0x1653bd[_0x3d2a('0x37')]['sort']);_0x3d68a9[_0x3d2a('0x3c')]=qs[_0x3d2a('0x3d')](_[_0x3d2a('0x3e')](_0x1653bd[_0x3d2a('0x37')],_0x411b2d[_0x3d2a('0x3d')]),_0x570d73);if(_0x1653bd[_0x3d2a('0x37')]['filter']){_0x3d68a9[_0x3d2a('0x3c')]=_[_0x3d2a('0x3f')](_0x3d68a9[_0x3d2a('0x3c')],{'$or':_[_0x3d2a('0x2b')](_0x570d73,function(_0x38dbb9){if(_0x38dbb9[_0x3d2a('0x40')]!==_0x3d2a('0x41')){var _0x5513fb={};_0x5513fb[_0x38dbb9[_0x3d2a('0x28')]]={'$like':'%'+_0x1653bd[_0x3d2a('0x37')][_0x3d2a('0x42')]+'%'};return _0x5513fb;}})});}_0x3d68a9=_[_0x3d2a('0x3f')]({},_0x3d68a9,_0x1653bd[_0x3d2a('0x43')]);var _0x10ba87={'where':_0x3d68a9['where']};return db[_0x3d2a('0x2c')][_0x3d2a('0x1c')](_0x10ba87)[_0x3d2a('0x24')](function(_0x40cea1){_0x4620b7[_0x3d2a('0x1c')]=_0x40cea1;if(_0x1653bd[_0x3d2a('0x37')][_0x3d2a('0x44')]){_0x3d68a9[_0x3d2a('0x45')]=[{'all':!![]}];}return db['VoiceRecording'][_0x3d2a('0x46')](_0x3d68a9);})[_0x3d2a('0x24')](function(_0xae96e5){_0x4620b7[_0x3d2a('0x47')]=_0xae96e5;return _0x4620b7;})[_0x3d2a('0x24')](respondWithFilteredResult(_0x15ec7e,_0x3d68a9))[_0x3d2a('0x48')](handleError(_0x15ec7e,null));};exports[_0x3d2a('0x49')]=function(_0x52caac,_0x4afa65){var _0x46d1be={'raw':![],'where':{'id':_0x52caac[_0x3d2a('0x4a')]['id']}},_0x1ba686={};_0x1ba686[_0x3d2a('0x33')]=_['keys'](db[_0x3d2a('0x2c')][_0x3d2a('0x2d')]);_0x1ba686[_0x3d2a('0x37')]=_[_0x3d2a('0x32')](_0x52caac['query']);_0x1ba686[_0x3d2a('0x3d')]=_[_0x3d2a('0x35')](_0x1ba686[_0x3d2a('0x33')],_0x1ba686[_0x3d2a('0x37')]);_0x46d1be[_0x3d2a('0x34')]=_[_0x3d2a('0x35')](_0x1ba686['model'],qs[_0x3d2a('0x36')](_0x52caac['query'][_0x3d2a('0x36')]));_0x46d1be['attributes']=_0x46d1be[_0x3d2a('0x34')][_0x3d2a('0x38')]?_0x46d1be[_0x3d2a('0x34')]:_0x1ba686[_0x3d2a('0x33')];if(_0x52caac[_0x3d2a('0x37')][_0x3d2a('0x44')]){_0x46d1be[_0x3d2a('0x45')]=[{'all':!![]}];}_0x46d1be=_[_0x3d2a('0x3f')]({},_0x46d1be,_0x52caac['options']);return db[_0x3d2a('0x2c')][_0x3d2a('0x4b')](_0x46d1be)[_0x3d2a('0x24')](handleEntityNotFound(_0x4afa65,null))[_0x3d2a('0x24')](respondWithResult(_0x4afa65,null))[_0x3d2a('0x48')](handleError(_0x4afa65,null));};exports[_0x3d2a('0x4c')]=function(_0x2e229f,_0x2a4201){return db[_0x3d2a('0x2c')][_0x3d2a('0x4c')](_0x2e229f[_0x3d2a('0x4d')],{})[_0x3d2a('0x24')](respondWithResult(_0x2a4201,0xc9))[_0x3d2a('0x48')](handleError(_0x2a4201,null));};exports['update']=function(_0x4bc149,_0x1756c1){if(_0x4bc149[_0x3d2a('0x4d')]['id']){delete _0x4bc149[_0x3d2a('0x4d')]['id'];}return db[_0x3d2a('0x2c')][_0x3d2a('0x4b')]({'where':{'id':_0x4bc149[_0x3d2a('0x4a')]['id']}})[_0x3d2a('0x24')](handleEntityNotFound(_0x1756c1,null))[_0x3d2a('0x24')](saveUpdates(_0x4bc149[_0x3d2a('0x4d')],null))[_0x3d2a('0x24')](respondWithResult(_0x1756c1,null))[_0x3d2a('0x48')](handleError(_0x1756c1,null));};exports[_0x3d2a('0x4e')]=function(_0x32097b,_0x2960e7){return db[_0x3d2a('0x2c')][_0x3d2a('0x4e')]()[_0x3d2a('0x24')](respondWithResult(_0x2960e7,null))[_0x3d2a('0x48')](handleError(_0x2960e7,null));};exports['download']=function(_0x3241f0,_0x20df2b,_0x2f27d2){var _0x3941a2=require(_0x3d2a('0x4f'));var _0x5ba395=![];var _0x35b315={};if(_0x3241f0['query'][_0x3d2a('0x40')]&&_0x3241f0[_0x3d2a('0x37')][_0x3d2a('0x40')]===_0x3d2a('0x50')){_0x35b315[_0x3d2a('0x50')]=_0x3241f0[_0x3d2a('0x4a')]['id'];}else{_0x35b315['id']=_0x3241f0['params']['id'];}return db[_0x3d2a('0x2c')][_0x3d2a('0x4b')]({'where':_0x35b315,'attributes':['id',_0x3d2a('0x51')],'raw':!![]})[_0x3d2a('0x24')](handleEntityNotFound(_0x20df2b,null))['then'](function(_0x507bc5){if(_0x507bc5){var _0xfc01a7=_0x507bc5[_0x3d2a('0x51')];var _0x1a39fc=util[_0x3d2a('0x31')](_0x3d2a('0x52'),_0xfc01a7);if(fs[_0x3d2a('0x53')](_0x1a39fc)){_0x5ba395=!![];return _0x3941a2[_0x3d2a('0x54')](_0x1a39fc,_0xfc01a7,config[_0x3d2a('0x55')][_0x3d2a('0x56')])[_0x3d2a('0x24')](function(){return _0x507bc5;});}return _0x507bc5;}})['then'](function(_0x5e0c94){if(_0x5e0c94){var _0x187fca=_0x5e0c94[_0x3d2a('0x51')];if(!fs[_0x3d2a('0x53')](_0x187fca)){throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))](_0x3d2a('0x59'));}if(_0x5e0c94['filename']){return _0x20df2b[_0x3d2a('0x5a')](_0x187fca,_0x5e0c94[_0x3d2a('0x5b')]+path['extname'](_0x187fca),function(){if(_0x5ba395){fs[_0x3d2a('0x5c')](_0x187fca);}});}else{return _0x20df2b['download'](_0x187fca,function(_0x53c6fc){if(_0x5ba395){fs[_0x3d2a('0x5c')](_0x187fca);}});}}})[_0x3d2a('0x48')](function(_0x579524){if(_0x579524[_0x3d2a('0x5d')]===_0x3d2a('0x59')){_0x20df2b[_0x3d2a('0x18')](0x194)[_0x3d2a('0x29')]('Not\x20found');}else{return handleError(_0x20df2b,null);}});};exports[_0x3d2a('0x5e')]=function(_0xf914d,_0x5e3004,_0x2af0ba){var _0xd5f918=require('../../components/encryptor');var _0x3ffe90=![];var _0xd01934={'$and':[db[_0x3d2a('0x5f')][_0x3d2a('0x3c')](db['sequelize']['fn'](_0x3d2a('0x60'),db[_0x3d2a('0x5f')][_0x3d2a('0x61')](_0x3d2a('0x50'))),_0xf914d[_0x3d2a('0x37')]['token'])]};if(_0xf914d[_0x3d2a('0x37')][_0x3d2a('0x40')]&&_0xf914d['query'][_0x3d2a('0x40')]===_0x3d2a('0x50')){_0xd01934['$and'][_0x3d2a('0x62')]({'uniqueid':_0xf914d[_0x3d2a('0x4a')]['id']});}else{_0xd01934['$and']['push']({'id':_0xf914d['params']['id']});}return db[_0x3d2a('0x2c')][_0x3d2a('0x4b')]({'where':_0xd01934,'attributes':['id','value'],'raw':!![]})[_0x3d2a('0x24')](handleEntityNotFound(_0x5e3004,null))[_0x3d2a('0x24')](function(_0x3ab254){if(_0x3ab254){var _0x44f402=util[_0x3d2a('0x31')](_0x3d2a('0x52'),_0x3ab254[_0x3d2a('0x51')]);if(fs['existsSync'](_0x44f402)){_0x3ffe90=!![];return _0xd5f918[_0x3d2a('0x54')](_0x44f402,_0x3ab254[_0x3d2a('0x51')],config[_0x3d2a('0x55')][_0x3d2a('0x56')])[_0x3d2a('0x24')](function(){return _0x3ab254;});}return _0x3ab254;}})[_0x3d2a('0x24')](function(_0x3c9805){if(_0x3c9805){if(!fs[_0x3d2a('0x53')](_0x3c9805[_0x3d2a('0x51')])){throw new db[(_0x3d2a('0x57'))]['ValidationError'](_0x3d2a('0x59'));}if(_0x3c9805[_0x3d2a('0x5b')]){return _0x5e3004['download'](_0x3c9805[_0x3d2a('0x51')],_0x3c9805[_0x3d2a('0x5b')]+path[_0x3d2a('0x63')](_0x3c9805[_0x3d2a('0x51')]),function(){if(_0x3ffe90){fs[_0x3d2a('0x5c')](_0x3c9805['value']);}});}else{return _0x5e3004[_0x3d2a('0x5a')](_0x3c9805[_0x3d2a('0x51')],function(_0xe12c8a){if(_0x3ffe90){fs['unlink'](_0x3c9805[_0x3d2a('0x51')]);}});}}})['catch'](handleError(_0x5e3004,null));};exports[_0x3d2a('0x25')]=function(_0x4583ac,_0x447df6){return db['VoiceRecording'][_0x3d2a('0x4b')]({'where':{'id':_0x4583ac['params']['id']}})['then'](function(_0x2edb87){if(_['isNil'](_0x2edb87)){throw new ReferenceError(_0x3d2a('0x64'));}return _0x2edb87;})[_0x3d2a('0x24')](function(_0x56f868){var _0x2b00ff=_0x56f868[_0x3d2a('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2b00ff);if(!_[_0x3d2a('0x65')](_0x56f868[_0x3d2a('0x51')])&&fs[_0x3d2a('0x53')](_0x2b00ff)){logger['info'](_0x3d2a('0x66')+_0x2b00ff+_0x3d2a('0x67'));fs[_0x3d2a('0x68')](_0x2b00ff);}_0x2b00ff=_0x2b00ff+_0x3d2a('0x69');if(!_[_0x3d2a('0x65')](_0x56f868['value'])&&fs['existsSync'](_0x2b00ff)){logger[_0x3d2a('0x6a')](_0x3d2a('0x66')+_0x2b00ff+_0x3d2a('0x67'));fs[_0x3d2a('0x68')](_0x2b00ff);}return _0x56f868;})[_0x3d2a('0x24')](function(_0x33c497){if(!_0x33c497)throw new InternalError();return _0x33c497[_0x3d2a('0x25')]();})[_0x3d2a('0x24')](function(){_0x447df6['status'](0xcc)[_0x3d2a('0x19')]();})[_0x3d2a('0x48')](handleError(_0x447df6,null));};function getBucketslist(_0x5654a4,_0x350cbe,_0x46b76c){return new Promise(function(_0x53950b,_0x3ebd59){var _0x2bb930=new AWS['S3']({'accessKeyId':_0x350cbe,'secretAccessKey':_0x5654a4,'region':_0x46b76c});_0x2bb930[_0x3d2a('0x6b')]({},function(_0x4c4ae6,_0x1dd942){if(_0x4c4ae6){return _0x3ebd59(_0x4c4ae6);}else{return _0x53950b(_0x1dd942);}});});}function createBucket(_0x1004a0,_0x55b463,_0x1448a1,_0x2b9ead){return new Promise(function(_0x52c7c4,_0xf01a45){var _0x194e21=new AWS['S3']({'accessKeyId':_0x55b463,'secretAccessKey':_0x1004a0,'region':_0x1448a1});_0x194e21['createBucket']({'Bucket':_0x2b9ead},function(_0x4514fa,_0x3d8a32){if(_0x4514fa){return _0xf01a45(_0x4514fa);}else{return _0x52c7c4(_0x3d8a32);}});});}function uploadFile(_0x11b664,_0x3763b1,_0x24a2de,_0x23832f,_0x38dbec,_0x26afc2){return new Promise(function(_0x303051,_0x21ceb8){var _0x1fa5d9=new AWS['S3']({'accessKeyId':_0x3763b1,'secretAccessKey':_0x11b664,'region':_0x24a2de});_0x1fa5d9[_0x3d2a('0x6c')]({'Bucket':_0x23832f,'Key':_0x38dbec,'Body':_0x26afc2},function(_0x304175,_0x41bf6e){if(_0x304175){return _0x21ceb8(_0x304175);}else{return _0x303051(_0x41bf6e);}});});}function startTranscribe(_0x2f067a,_0x3adf67,_0x198fa5,_0x49b5ef,_0x47f642,_0x5eded6){return new Promise(function(_0x7255a6,_0x3f30de){var _0x3cbef5=new AWS['TranscribeService']({'accessKeyId':_0x3adf67,'secretAccessKey':_0x2f067a,'region':_0x198fa5});_0x3cbef5[_0x3d2a('0x6d')]({'TranscriptionJobName':_0x49b5ef,'LanguageCode':_0x47f642,'Media':{'MediaFileUri':_0x5eded6}},function(_0x1470ac,_0x5941bc){if(_0x1470ac){return _0x3f30de(_0x1470ac);}else{return _0x7255a6(_0x5941bc);}});});}function transcribe(_0x597b3d,_0x424808,_0xaeb901,_0x182333,_0x564830,_0xe6be4d,_0x5590d3){return new Promise(function(_0x1c2725,_0x1e1b78){var _0x498285={};logger[_0x3d2a('0x6a')](util[_0x3d2a('0x31')](_0x3d2a('0x6e'),_0x597b3d,_0x564830));return uploadFile(_0x424808,_0xaeb901,_0x182333,_0x564830,path[_0x3d2a('0x6f')](_0xe6be4d),fs['readFileSync'](_0xe6be4d))[_0x3d2a('0x24')](function(_0x4bba0c){logger[_0x3d2a('0x6a')](util[_0x3d2a('0x31')](_0x3d2a('0x70'),_0x597b3d,_0x564830,_0x4bba0c[_0x3d2a('0x71')]));_0x498285[_0x3d2a('0x72')]=_0x4bba0c['Bucket'];_0x498285[_0x3d2a('0x73')]=_0x4bba0c[_0x3d2a('0x71')];logger[_0x3d2a('0x6a')](util[_0x3d2a('0x31')](_0x3d2a('0x74'),_0x597b3d));return startTranscribe(_0x424808,_0xaeb901,_0x182333,uuidv4(),_0x5590d3,_0x4bba0c[_0x3d2a('0x71')]);})[_0x3d2a('0x24')](function(_0x4f9a68){logger[_0x3d2a('0x6a')](util[_0x3d2a('0x31')](_0x3d2a('0x75'),_0x597b3d,_0x4f9a68[_0x3d2a('0x76')][_0x3d2a('0x77')]));_0x498285[_0x3d2a('0x78')]=_0x4f9a68[_0x3d2a('0x76')][_0x3d2a('0x77')];_0x498285[_0x3d2a('0x79')]=_0x4f9a68[_0x3d2a('0x76')][_0x3d2a('0x7a')];return _0x1c2725(_0x498285);})[_0x3d2a('0x48')](function(_0x2c2731){return _0x1e1b78(_0x2c2731);});});}exports[_0x3d2a('0x7b')]=function(_0x408a33,_0x24101b,_0x5141cf){var _0x1d2e9e;var _0x3e53a1;var _0x2c8b92;var _0x5524f0=require(_0x3d2a('0x4f'));return db[_0x3d2a('0x2c')][_0x3d2a('0x7c')]({'where':{'id':_0x408a33[_0x3d2a('0x4a')]['id']}})[_0x3d2a('0x24')](function(_0x2caf90){if(_0x2caf90){var _0x4a2199=util[_0x3d2a('0x31')](_0x3d2a('0x52'),_0x2caf90[_0x3d2a('0x51')]);if(fs['existsSync'](_0x4a2199)){cypher=!![];return _0x5524f0[_0x3d2a('0x54')](_0x4a2199,_0x2caf90['value'],config[_0x3d2a('0x55')][_0x3d2a('0x56')])[_0x3d2a('0x24')](function(){return _0x2caf90;});}return _0x2caf90;}})[_0x3d2a('0x24')](function(_0xc9a013){if(!_0xc9a013){throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))](_0x3d2a('0x7d'));}_0x3e53a1=_0xc9a013;return db[_0x3d2a('0x7e')][_0x3d2a('0x7c')]({'where':{'id':0x1}});})[_0x3d2a('0x24')](handleEntityNotFound(_0x24101b,null))['then'](function(_0xaff32f){if(_0xaff32f){_0x1d2e9e=_0xaff32f;if(!_0x1d2e9e[_0x3d2a('0x7f')]||!_0x1d2e9e[_0x3d2a('0x80')]||!_0x1d2e9e['transcribeRegion']||!_0x1d2e9e['language']||!_0x1d2e9e[_0x3d2a('0x72')]){throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))]('Transcribe\x20not\x20configured');}if(_0x408a33[_0x3d2a('0x4d')][_0x3d2a('0x81')]&&(!_0x1d2e9e[_0x3d2a('0x82')]||!_0x1d2e9e[_0x3d2a('0x83')]||!_0x1d2e9e['sentimentRegion']||!_0x1d2e9e[_0x3d2a('0x84')]||!_0x1d2e9e['bucket'])){throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))](_0x3d2a('0x85'));}return db[_0x3d2a('0x86')]['findOne']({'where':{'id':_0x1d2e9e[_0x3d2a('0x80')]}});}})[_0x3d2a('0x24')](function(_0x5c6f94){if(!_0x5c6f94){throw new db[(_0x3d2a('0x57'))]['ValidationError'](_0x3d2a('0x87'));}if(!_0x5c6f94[_0x3d2a('0x88')]||!_0x5c6f94[_0x3d2a('0x89')]){throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))](_0x3d2a('0x8a'));}_0x2c8b92=_0x5c6f94;return getBucketslist(_0x2c8b92[_0x3d2a('0x88')],_0x2c8b92['data2'],_0x1d2e9e[_0x3d2a('0x8b')]);})[_0x3d2a('0x24')](function(_0x3cf8eb){if(_0x3cf8eb&&_0x3cf8eb['Buckets']){var _0x1cec5e=_['find'](_0x3cf8eb[_0x3d2a('0x8c')],function(_0xf0977c){return _0xf0977c[_0x3d2a('0x8d')]===_0x1d2e9e[_0x3d2a('0x72')];});if(!_0x1cec5e){logger[_0x3d2a('0x6a')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x408a33['params']['id'],_0x1d2e9e['bucket']));return createBucket(_0x2c8b92[_0x3d2a('0x88')],_0x2c8b92[_0x3d2a('0x89')],_0x1d2e9e[_0x3d2a('0x8b')],_0x1d2e9e['bucket']);}logger[_0x3d2a('0x6a')](util['format'](_0x3d2a('0x8e'),_0x408a33[_0x3d2a('0x4a')]['id'],_0x1d2e9e[_0x3d2a('0x72')]));return;}})[_0x3d2a('0x24')](function(_0xd2d4ec){if(_0x3e53a1[_0x3d2a('0x79')]===_0x3d2a('0x8f')){return transcribe(_0x408a33[_0x3d2a('0x4a')]['id'],_0x2c8b92[_0x3d2a('0x88')],_0x2c8b92['data2'],_0x1d2e9e[_0x3d2a('0x8b')],_0x1d2e9e[_0x3d2a('0x72')],_0x3e53a1[_0x3d2a('0x51')],_0x1d2e9e[_0x3d2a('0x84')]);}else{logger[_0x3d2a('0x6a')](util[_0x3d2a('0x31')](_0x3d2a('0x90'),_0x408a33[_0x3d2a('0x4a')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x3d2a('0x24')](function(_0x29590a){if(_0x29590a){_0x29590a[_0x3d2a('0x91')]=_0x408a33[_0x3d2a('0x4d')][_0x3d2a('0x81')];return _0x3e53a1[_0x3d2a('0x92')](_0x29590a);}})[_0x3d2a('0x24')](respondWithResult(_0x24101b,null))['catch'](handleError(_0x24101b,null));};function writeFile(_0x271ddc,_0x2b345b){return new Promise(function(_0x11d3eb,_0x2840e0){fs[_0x3d2a('0x93')](_0x2b345b,_0x271ddc,function(_0x160cbd,_0xcf6bc0){if(_0x160cbd){return _0x2840e0(_0x160cbd);}else{return _0x11d3eb(_0xcf6bc0);}});});}exports['downloadTranscribe']=function(_0x3edbd9,_0x275a43,_0xe38049){return db[_0x3d2a('0x2c')][_0x3d2a('0x7c')]({'where':{'id':_0x3edbd9['params']['id']}})[_0x3d2a('0x24')](handleEntityNotFound(_0x275a43))['then'](function(_0x1b0b39){if(_0x1b0b39&&_0x1b0b39[_0x3d2a('0x94')]){var _0x220111=_0x1b0b39[_0x3d2a('0x94')];var _0x1e57ef=config[_0x3d2a('0x95')]+_0x3d2a('0x96')+_0x1b0b39['id']+_0x3d2a('0x97');if(fs[_0x3d2a('0x53')](_0x1e57ef)){return _0x1e57ef;}return writeFile(_0x220111,_0x1e57ef)[_0x3d2a('0x24')](function(){return _0x1e57ef;});}else{throw new db[(_0x3d2a('0x57'))][(_0x3d2a('0x58'))]('Transcript\x20not\x20available');}})[_0x3d2a('0x24')](function(_0x4290b7){return _0x275a43[_0x3d2a('0x5a')](_0x4290b7);})[_0x3d2a('0x48')](handleError(_0x275a43));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 03eeeb9..25b63ce 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 _0x65f4=['uniqueid','transcribeStatus','define'];(function(_0x512c0d,_0x492745){var _0x12c1ea=function(_0x3127d1){while(--_0x3127d1){_0x512c0d['push'](_0x512c0d['shift']());}};_0x12c1ea(++_0x492745);}(_0x65f4,0x19a));var _0x465f=function(_0x32b413,_0x5e536e){_0x32b413=_0x32b413-0x0;var _0x31d9d3=_0x65f4[_0x32b413];return _0x31d9d3;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x39de85,_0x73a81e){return _0x39de85[_0x465f('0x0')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x465f('0x1'),'fields':[_0x465f('0x1')]},{'name':_0x465f('0x2'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x769c=['uniqueid','transcribeStatus','./voiceRecording.attributes','voice_recordings'];(function(_0x387b71,_0x22510b){var _0x47efc6=function(_0x1a97b3){while(--_0x1a97b3){_0x387b71['push'](_0x387b71['shift']());}};_0x47efc6(++_0x22510b);}(_0x769c,0x96));var _0xc769=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x769c[_0x178e48];return _0x440d7e;};'use strict';var attributes=require(_0xc769('0x0'));module['exports']=function(_0x2bcf3f,_0x463db3){return _0x2bcf3f['define']('VoiceRecording',attributes,{'tableName':_0xc769('0x1'),'paranoid':![],'indexes':[{'name':_0xc769('0x2'),'fields':[_0xc769('0x2')]},{'name':_0xc769('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 48055fd..6eba746 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 _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x440d57,_0x45d82b){var _0x4a342e=function(_0x11b8e3){while(--_0x11b8e3){_0x440d57['push'](_0x440d57['shift']());}};_0x4a342e(++_0x45d82b);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file +var _0x0598=['catch','UpdateVoiceRecording','VoiceRecording','body','options','where','limit','then','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x0598,0x92));var _0x8059=function(_0x36baad,_0x503c97){_0x36baad=_0x36baad-0x0;var _0x2dbb0f=_0x0598[_0x36baad];return _0x2dbb0f;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['update'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55['options'][_0x8059('0x13')]||null:null,'attributes':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55[_0x8059('0x12')]['attributes']||null:null,'limit':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')][_0x8059('0x14')]||null:null})[_0x8059('0x15')](function(_0x1585a3){logger['info'](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON['stringify'](_0x1585a3));_0x2bb670(_0x1585a3);})[_0x8059('0xe')](function(_0x2256b1){logger[_0x8059('0xc')](_0x8059('0xf'),_0x2256b1['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x2256b1[_0x8059('0xd')]));});});};exports[_0x8059('0x16')]=function(_0x3e2d2b){var _0x202b30=this;return new Promise(function(_0x54b88b,_0x387350){var _0x19b95a=require(_0x8059('0x17'));var _0x4a294f;return db['Setting']['findOne']({'attributes':['id',_0x8059('0x18')],'where':{'id':0x1},'raw':!![]})[_0x8059('0x15')](function(_0xc32b1f){_0x4a294f=_0xc32b1f;return db[_0x8059('0x10')]['create'](_0x3e2d2b[_0x8059('0x11')]);})['then'](function(_0x2f887c){if(_0x4a294f[_0x8059('0x18')]&&fs['existsSync'](_0x2f887c[_0x8059('0x19')])){var _0x1aead2=util[_0x8059('0x1a')](_0x8059('0x1b'),_0x2f887c[_0x8059('0x19')]);return _0x19b95a[_0x8059('0x1c')](_0x2f887c[_0x8059('0x19')],_0x1aead2,config[_0x8059('0x1d')]['recording'])[_0x8059('0x15')](function(){fs[_0x8059('0x1e')](_0x2f887c[_0x8059('0x19')]);logger[_0x8059('0x7')](_0x8059('0x1f'));return _0x2f887c;});}return _0x2f887c;})['then'](function(_0x39f1c4){logger[_0x8059('0x7')](_0x8059('0x16'),_0x3e2d2b);logger[_0x8059('0xa')](_0x8059('0x16'),_0x3e2d2b,JSON[_0x8059('0xb')](_0x39f1c4));_0x54b88b(_0x39f1c4);})[_0x8059('0xe')](function(_0x175d57){logger[_0x8059('0xc')](_0x8059('0x16'),_0x175d57['message'],_0x3e2d2b);_0x387350(_0x202b30[_0x8059('0xc')](0x1f4,_0x175d57['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 07e4628..02272d1 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 _0xdced=['get','isAuthenticated','/describe','describe','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller'];(function(_0x263ba9,_0x45e341){var _0x50777a=function(_0x7ea5ee){while(--_0x7ea5ee){_0x263ba9['push'](_0x263ba9['shift']());}};_0x50777a(++_0x45e341);}(_0xdced,0x1ac));var _0xddce=function(_0x5e4424,_0xf1d263){_0x5e4424=_0x5e4424-0x0;var _0xc88ea9=_0xdced[_0x5e4424];return _0xc88ea9;};'use strict';var multer=require(_0xddce('0x0'));var util=require(_0xddce('0x1'));var path=require(_0xddce('0x2'));var timeout=require(_0xddce('0x3'));var express=require(_0xddce('0x4'));var router=express['Router']();var fs_extra=require(_0xddce('0x5'));var auth=require(_0xddce('0x6'));var interaction=require(_0xddce('0x7'));var config=require('../../config/environment');var controller=require(_0xddce('0x8'));router[_0xddce('0x9')]('/',auth[_0xddce('0xa')](),controller['index']);router['get'](_0xddce('0xb'),auth[_0xddce('0xa')](),controller[_0xddce('0xc')]);router[_0xddce('0x9')]('/:id',auth[_0xddce('0xa')](),controller['show']);router[_0xddce('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xddce('0xe')](_0xddce('0xf'),auth[_0xddce('0xa')](),controller[_0xddce('0x10')]);router['delete'](_0xddce('0xf'),auth[_0xddce('0xa')](),controller[_0xddce('0x11')]);module[_0xddce('0x12')]=router; \ No newline at end of file +var _0x3c8a=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x4f280a,_0x13e64d){var _0x1db611=function(_0x1ffaa3){while(--_0x1ffaa3){_0x4f280a['push'](_0x4f280a['shift']());}};_0x1db611(++_0x13e64d);}(_0x3c8a,0x1a5));var _0xa3c8=function(_0x44b91c,_0x483ee5){_0x44b91c=_0x44b91c-0x0;var _0x2a3356=_0x3c8a[_0x44b91c];return _0x2a3356;};'use strict';var multer=require(_0xa3c8('0x0'));var util=require(_0xa3c8('0x1'));var path=require(_0xa3c8('0x2'));var timeout=require(_0xa3c8('0x3'));var express=require(_0xa3c8('0x4'));var router=express[_0xa3c8('0x5')]();var fs_extra=require(_0xa3c8('0x6'));var auth=require(_0xa3c8('0x7'));var interaction=require(_0xa3c8('0x8'));var config=require(_0xa3c8('0x9'));var controller=require(_0xa3c8('0xa'));router[_0xa3c8('0xb')]('/',auth[_0xa3c8('0xc')](),controller[_0xa3c8('0xd')]);router[_0xa3c8('0xb')](_0xa3c8('0xe'),auth[_0xa3c8('0xc')](),controller[_0xa3c8('0xf')]);router[_0xa3c8('0xb')](_0xa3c8('0x10'),auth[_0xa3c8('0xc')](),controller[_0xa3c8('0x11')]);router[_0xa3c8('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3c8('0x13')](_0xa3c8('0x10'),auth[_0xa3c8('0xc')](),controller[_0xa3c8('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index df048da..7d47122 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 _0xdc45=['attended','STRING','Yes','exports','ENUM'];(function(_0xdb040b,_0x54e23e){var _0xaedb0b=function(_0x35aa3d){while(--_0x35aa3d){_0xdb040b['push'](_0xdb040b['shift']());}};_0xaedb0b(++_0x54e23e);}(_0xdc45,0xc1));var _0x5dc4=function(_0x22b3a3,_0x567578){_0x22b3a3=_0x22b3a3-0x0;var _0x11508e=_0xdc45[_0x22b3a3];return _0x11508e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5dc4('0x0')]={'type':{'type':Sequelize[_0x5dc4('0x1')]('blind',_0x5dc4('0x2'))},'result':{'type':Sequelize[_0x5dc4('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x5dc4('0x3')]},'transferercalleridname':{'type':Sequelize[_0x5dc4('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5dc4('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x5dc4('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x5dc4('0x3')]},'transferercontext':{'type':Sequelize[_0x5dc4('0x3')]},'transfererexten':{'type':Sequelize[_0x5dc4('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x5dc4('0x3')]},'transfereechannel':{'type':Sequelize[_0x5dc4('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x5dc4('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x5dc4('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5dc4('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5dc4('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x5dc4('0x1')](_0x5dc4('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5dc4('0x3')]}}; \ No newline at end of file +var _0x0111=['Yes','moment','exports','ENUM','blind','STRING'];(function(_0x220a7c,_0x4e1ea7){var _0x5e2a28=function(_0x2106ae){while(--_0x2106ae){_0x220a7c['push'](_0x220a7c['shift']());}};_0x5e2a28(++_0x4e1ea7);}(_0x0111,0x16f));var _0x1011=function(_0x3f0e5b,_0x2e73d0){_0x3f0e5b=_0x3f0e5b-0x0;var _0x90ecc6=_0x0111[_0x3f0e5b];return _0x90ecc6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1011('0x0'));module[_0x1011('0x1')]={'type':{'type':Sequelize[_0x1011('0x2')](_0x1011('0x3'),'attended')},'result':{'type':Sequelize[_0x1011('0x4')]},'transfererchannel':{'type':Sequelize[_0x1011('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1011('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1011('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1011('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x1011('0x4')]},'transferercontext':{'type':Sequelize[_0x1011('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1011('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1011('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1011('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1011('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1011('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1011('0x4')]},'transfereecontext':{'type':Sequelize[_0x1011('0x4')]},'transfereeexten':{'type':Sequelize[_0x1011('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x1011('0x4')]},'isexternal':{'type':Sequelize[_0x1011('0x2')](_0x1011('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x1011('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9562f66..72cc14c 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 _0x441d=['rows','show','params','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','error','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','findAll'];(function(_0x30d341,_0x107f86){var _0x30ab6b=function(_0x459911){while(--_0x459911){_0x30d341['push'](_0x30d341['shift']());}};_0x30ab6b(++_0x107f86);}(_0x441d,0x145));var _0xd441=function(_0x5acb9c,_0x36a761){_0x5acb9c=_0x5acb9c-0x0;var _0x543439=_0x441d[_0x5acb9c];return _0x543439;};'use strict';var emlformat=require(_0xd441('0x0'));var rimraf=require(_0xd441('0x1'));var zipdir=require(_0xd441('0x2'));var jsonpatch=require(_0xd441('0x3'));var rp=require(_0xd441('0x4'));var moment=require(_0xd441('0x5'));var BPromise=require(_0xd441('0x6'));var Mustache=require(_0xd441('0x7'));var util=require(_0xd441('0x8'));var path=require(_0xd441('0x9'));var sox=require(_0xd441('0xa'));var csv=require('to-csv');var ejs=require(_0xd441('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd441('0xc'));var squel=require(_0xd441('0xd'));var crypto=require(_0xd441('0xe'));var jsforce=require(_0xd441('0xf'));var deskjs=require(_0xd441('0x10'));var toCsv=require(_0xd441('0x11'));var querystring=require('querystring');var Papa=require(_0xd441('0x12'));var Redis=require(_0xd441('0x13'));var authService=require(_0xd441('0x14'));var qs=require(_0xd441('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd441('0x16'));var logger=require(_0xd441('0x17'))(_0xd441('0x18'));var utils=require(_0xd441('0x19'));var config=require(_0xd441('0x1a'));var licenseUtil=require(_0xd441('0x1b'));var db=require(_0xd441('0x1c'))['db'];function respondWithStatusCode(_0xf91d78,_0x41c7ff){_0x41c7ff=_0x41c7ff||0xcc;return function(_0x27b145){if(_0x27b145){return _0xf91d78[_0xd441('0x1d')](_0x41c7ff);}return _0xf91d78[_0xd441('0x1e')](_0x41c7ff)[_0xd441('0x1f')]();};}function respondWithResult(_0x408796,_0x1d2180){_0x1d2180=_0x1d2180||0xc8;return function(_0x5f5d5b){if(_0x5f5d5b){return _0x408796[_0xd441('0x1e')](_0x1d2180)['json'](_0x5f5d5b);}};}function respondWithFilteredResult(_0x3b15e9,_0x33f5b5){return function(_0x20f272){if(_0x20f272){var _0x1b6490=typeof _0x33f5b5[_0xd441('0x20')]===_0xd441('0x21')&&typeof _0x33f5b5[_0xd441('0x22')]===_0xd441('0x21');var _0x2cd083=_0x20f272[_0xd441('0x23')];var _0x1de0f3=_0x1b6490?0x0:_0x33f5b5[_0xd441('0x20')];var _0x3e54f5=_0x1b6490?_0x20f272['count']:_0x33f5b5[_0xd441('0x20')]+_0x33f5b5[_0xd441('0x22')];var _0x100f06;if(_0x3e54f5>=_0x2cd083){_0x3e54f5=_0x2cd083;_0x100f06=0xc8;}else{_0x100f06=0xce;}_0x3b15e9['status'](_0x100f06);return _0x3b15e9[_0xd441('0x24')](_0xd441('0x25'),_0x1de0f3+'-'+_0x3e54f5+'/'+_0x2cd083)['json'](_0x20f272);}return null;};}function patchUpdates(_0x16d918){return function(_0x2c0c3f){try{jsonpatch[_0xd441('0x26')](_0x2c0c3f,_0x16d918,!![]);}catch(_0x1acc2a){return BPromise['reject'](_0x1acc2a);}return _0x2c0c3f[_0xd441('0x27')]();};}function saveUpdates(_0x20fb15,_0x407b19){return function(_0x2419ba){if(_0x2419ba){return _0x2419ba['update'](_0x20fb15)['then'](function(_0x57b92f){return _0x57b92f;});}return null;};}function removeEntity(_0x2b3c78,_0x5d6925){return function(_0x1095d4){if(_0x1095d4){return _0x1095d4[_0xd441('0x28')]()['then'](function(){_0x2b3c78[_0xd441('0x1e')](0xcc)[_0xd441('0x1f')]();});}};}function handleEntityNotFound(_0x37a3a5,_0x3dcac0){return function(_0x2a6cce){if(!_0x2a6cce){_0x37a3a5['sendStatus'](0x194);}return _0x2a6cce;};}function handleError(_0x1b2de6,_0x820752){_0x820752=_0x820752||0x1f4;return function(_0x38a960){logger[_0xd441('0x29')](_0x38a960[_0xd441('0x2a')]);if(_0x38a960[_0xd441('0x2b')]){delete _0x38a960[_0xd441('0x2b')];}_0x1b2de6[_0xd441('0x1e')](_0x820752)[_0xd441('0x2c')](_0x38a960);};}exports['index']=function(_0x77274,_0x4cb33c){var _0x492441={},_0x3906a2={},_0xf02a9e={'count':0x0,'rows':[]};var _0x25bd79=_['map'](db[_0xd441('0x2d')][_0xd441('0x2e')],function(_0xfa7161){return{'name':_0xfa7161[_0xd441('0x2f')],'type':_0xfa7161['type'][_0xd441('0x30')]};});_0x3906a2[_0xd441('0x31')]=_[_0xd441('0x32')](_0x25bd79,_0xd441('0x2b'));_0x3906a2[_0xd441('0x33')]=_[_0xd441('0x34')](_0x77274['query']);_0x3906a2[_0xd441('0x35')]=_['intersection'](_0x3906a2['model'],_0x3906a2['query']);_0x492441['attributes']=_[_0xd441('0x36')](_0x3906a2[_0xd441('0x31')],qs['fields'](_0x77274[_0xd441('0x33')][_0xd441('0x37')]));_0x492441[_0xd441('0x38')]=_0x492441['attributes'][_0xd441('0x39')]?_0x492441[_0xd441('0x38')]:_0x3906a2[_0xd441('0x31')];if(!_0x77274[_0xd441('0x33')][_0xd441('0x3a')](_0xd441('0x3b'))){_0x492441[_0xd441('0x22')]=qs['limit'](_0x77274[_0xd441('0x33')][_0xd441('0x22')]);_0x492441['offset']=qs['offset'](_0x77274['query'][_0xd441('0x20')]);}_0x492441[_0xd441('0x3c')]=qs['sort'](_0x77274[_0xd441('0x33')][_0xd441('0x3d')]);_0x492441[_0xd441('0x3e')]=qs['filters'](_['pick'](_0x77274['query'],_0x3906a2[_0xd441('0x35')]),_0x25bd79);if(_0x77274[_0xd441('0x33')][_0xd441('0x3f')]){_0x492441[_0xd441('0x3e')]=_[_0xd441('0x40')](_0x492441[_0xd441('0x3e')],{'$or':_['map'](_0x25bd79,function(_0x50a986){if(_0x50a986['type']!=='VIRTUAL'){var _0x499dd0={};_0x499dd0[_0x50a986[_0xd441('0x2b')]]={'$like':'%'+_0x77274['query'][_0xd441('0x3f')]+'%'};return _0x499dd0;}})});}_0x492441=_[_0xd441('0x40')]({},_0x492441,_0x77274[_0xd441('0x41')]);var _0x496b90={'where':_0x492441[_0xd441('0x3e')]};return db[_0xd441('0x2d')][_0xd441('0x23')](_0x496b90)[_0xd441('0x42')](function(_0x5b3ab6){_0xf02a9e['count']=_0x5b3ab6;if(_0x77274['query'][_0xd441('0x43')]){_0x492441[_0xd441('0x44')]=[{'all':!![]}];}return db[_0xd441('0x2d')][_0xd441('0x45')](_0x492441);})['then'](function(_0x700a20){_0xf02a9e[_0xd441('0x46')]=_0x700a20;return _0xf02a9e;})[_0xd441('0x42')](respondWithFilteredResult(_0x4cb33c,_0x492441))['catch'](handleError(_0x4cb33c,null));};exports[_0xd441('0x47')]=function(_0x2530f9,_0x41de40){var _0x4a0d6a={'raw':!![],'where':{'id':_0x2530f9[_0xd441('0x48')]['id']}},_0x5038e5={};_0x5038e5[_0xd441('0x31')]=_[_0xd441('0x34')](db[_0xd441('0x2d')][_0xd441('0x2e')]);_0x5038e5[_0xd441('0x33')]=_[_0xd441('0x34')](_0x2530f9[_0xd441('0x33')]);_0x5038e5[_0xd441('0x35')]=_[_0xd441('0x36')](_0x5038e5[_0xd441('0x31')],_0x5038e5[_0xd441('0x33')]);_0x4a0d6a[_0xd441('0x38')]=_['intersection'](_0x5038e5[_0xd441('0x31')],qs[_0xd441('0x37')](_0x2530f9['query'][_0xd441('0x37')]));_0x4a0d6a[_0xd441('0x38')]=_0x4a0d6a[_0xd441('0x38')][_0xd441('0x39')]?_0x4a0d6a[_0xd441('0x38')]:_0x5038e5[_0xd441('0x31')];if(_0x2530f9[_0xd441('0x33')][_0xd441('0x43')]){_0x4a0d6a[_0xd441('0x44')]=[{'all':!![]}];}_0x4a0d6a=_[_0xd441('0x40')]({},_0x4a0d6a,_0x2530f9['options']);return db[_0xd441('0x2d')][_0xd441('0x49')](_0x4a0d6a)[_0xd441('0x42')](handleEntityNotFound(_0x41de40,null))[_0xd441('0x42')](respondWithResult(_0x41de40,null))[_0xd441('0x4a')](handleError(_0x41de40,null));};exports[_0xd441('0x4b')]=function(_0x499f54,_0x44814d){return db[_0xd441('0x2d')]['create'](_0x499f54['body'],{})[_0xd441('0x42')](respondWithResult(_0x44814d,0xc9))[_0xd441('0x4a')](handleError(_0x44814d,null));};exports[_0xd441('0x4c')]=function(_0x190690,_0x681cba){if(_0x190690[_0xd441('0x4d')]['id']){delete _0x190690[_0xd441('0x4d')]['id'];}return db[_0xd441('0x2d')][_0xd441('0x49')]({'where':{'id':_0x190690[_0xd441('0x48')]['id']}})[_0xd441('0x42')](handleEntityNotFound(_0x681cba,null))['then'](saveUpdates(_0x190690[_0xd441('0x4d')],null))['then'](respondWithResult(_0x681cba,null))[_0xd441('0x4a')](handleError(_0x681cba,null));};exports['destroy']=function(_0x66d20b,_0x7a471a){return db[_0xd441('0x2d')][_0xd441('0x49')]({'where':{'id':_0x66d20b[_0xd441('0x48')]['id']}})['then'](handleEntityNotFound(_0x7a471a,null))['then'](removeEntity(_0x7a471a,null))[_0xd441('0x4a')](handleError(_0x7a471a,null));};exports[_0xd441('0x4e')]=function(_0x49e515,_0xf76cfe){return db[_0xd441('0x2d')][_0xd441('0x4e')]()[_0xd441('0x42')](respondWithResult(_0xf76cfe,null))[_0xd441('0x4a')](handleError(_0xf76cfe,null));}; \ No newline at end of file +var _0x207d=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','VoiceTransferReport','includeAll','rows','catch','show','params','rawAttributes','include','create','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0xd24621,_0x2b1a81){var _0xce69c6=function(_0x45f1ea){while(--_0x45f1ea){_0xd24621['push'](_0xd24621['shift']());}};_0xce69c6(++_0x2b1a81);}(_0x207d,0x1b6));var _0xd207=function(_0x3e4a29,_0x40b8e8){_0x3e4a29=_0x3e4a29-0x0;var _0x29b23b=_0x207d[_0x3e4a29];return _0x29b23b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd207('0x0'));var zipdir=require(_0xd207('0x1'));var jsonpatch=require(_0xd207('0x2'));var rp=require(_0xd207('0x3'));var moment=require(_0xd207('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd207('0x5'));var util=require(_0xd207('0x6'));var path=require(_0xd207('0x7'));var sox=require(_0xd207('0x8'));var csv=require('to-csv');var ejs=require(_0xd207('0x9'));var fs=require('fs');var fs_extra=require(_0xd207('0xa'));var _=require(_0xd207('0xb'));var squel=require('squel');var crypto=require(_0xd207('0xc'));var jsforce=require(_0xd207('0xd'));var deskjs=require(_0xd207('0xe'));var toCsv=require(_0xd207('0xf'));var querystring=require(_0xd207('0x10'));var Papa=require(_0xd207('0x11'));var Redis=require('ioredis');var authService=require(_0xd207('0x12'));var qs=require(_0xd207('0x13'));var as=require(_0xd207('0x14'));var hardwareService=require(_0xd207('0x15'));var logger=require(_0xd207('0x16'))(_0xd207('0x17'));var utils=require('../../config/utils');var config=require(_0xd207('0x18'));var licenseUtil=require(_0xd207('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17bd2f,_0x37c63d){_0x37c63d=_0x37c63d||0xcc;return function(_0x21e87){if(_0x21e87){return _0x17bd2f[_0xd207('0x1a')](_0x37c63d);}return _0x17bd2f[_0xd207('0x1b')](_0x37c63d)[_0xd207('0x1c')]();};}function respondWithResult(_0x5c9640,_0x378087){_0x378087=_0x378087||0xc8;return function(_0x8b25a8){if(_0x8b25a8){return _0x5c9640[_0xd207('0x1b')](_0x378087)[_0xd207('0x1d')](_0x8b25a8);}};}function respondWithFilteredResult(_0x29c973,_0x78207c){return function(_0x3bcd0b){if(_0x3bcd0b){var _0x449764=typeof _0x78207c[_0xd207('0x1e')]===_0xd207('0x1f')&&typeof _0x78207c[_0xd207('0x20')]===_0xd207('0x1f');var _0x24d4e1=_0x3bcd0b[_0xd207('0x21')];var _0xf9ff0f=_0x449764?0x0:_0x78207c[_0xd207('0x1e')];var _0x26f26c=_0x449764?_0x3bcd0b[_0xd207('0x21')]:_0x78207c['offset']+_0x78207c[_0xd207('0x20')];var _0x462c26;if(_0x26f26c>=_0x24d4e1){_0x26f26c=_0x24d4e1;_0x462c26=0xc8;}else{_0x462c26=0xce;}_0x29c973[_0xd207('0x1b')](_0x462c26);return _0x29c973[_0xd207('0x22')](_0xd207('0x23'),_0xf9ff0f+'-'+_0x26f26c+'/'+_0x24d4e1)[_0xd207('0x1d')](_0x3bcd0b);}return null;};}function patchUpdates(_0x2e54c4){return function(_0x5d8c67){try{jsonpatch[_0xd207('0x24')](_0x5d8c67,_0x2e54c4,!![]);}catch(_0x5ccb4e){return BPromise['reject'](_0x5ccb4e);}return _0x5d8c67[_0xd207('0x25')]();};}function saveUpdates(_0x598f98,_0x514484){return function(_0x5bd5c3){if(_0x5bd5c3){return _0x5bd5c3[_0xd207('0x26')](_0x598f98)[_0xd207('0x27')](function(_0x4c4765){return _0x4c4765;});}return null;};}function removeEntity(_0x132a13,_0x53582d){return function(_0x3d184a){if(_0x3d184a){return _0x3d184a[_0xd207('0x28')]()['then'](function(){_0x132a13[_0xd207('0x1b')](0xcc)[_0xd207('0x1c')]();});}};}function handleEntityNotFound(_0x2940de,_0x43b68d){return function(_0x263a9b){if(!_0x263a9b){_0x2940de['sendStatus'](0x194);}return _0x263a9b;};}function handleError(_0x17ec4c,_0x7009ba){_0x7009ba=_0x7009ba||0x1f4;return function(_0x2016f6){logger[_0xd207('0x29')](_0x2016f6['stack']);if(_0x2016f6[_0xd207('0x2a')]){delete _0x2016f6[_0xd207('0x2a')];}_0x17ec4c[_0xd207('0x1b')](_0x7009ba)[_0xd207('0x2b')](_0x2016f6);};}exports[_0xd207('0x2c')]=function(_0x1aeda7,_0x12ffac){var _0x5bfaea={},_0x49e779={},_0x3ad242={'count':0x0,'rows':[]};var _0x531a2d=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x289dc7){return{'name':_0x289dc7['fieldName'],'type':_0x289dc7[_0xd207('0x2d')][_0xd207('0x2e')]};});_0x49e779[_0xd207('0x2f')]=_[_0xd207('0x30')](_0x531a2d,_0xd207('0x2a'));_0x49e779[_0xd207('0x31')]=_[_0xd207('0x32')](_0x1aeda7['query']);_0x49e779[_0xd207('0x33')]=_[_0xd207('0x34')](_0x49e779[_0xd207('0x2f')],_0x49e779['query']);_0x5bfaea[_0xd207('0x35')]=_[_0xd207('0x34')](_0x49e779[_0xd207('0x2f')],qs[_0xd207('0x36')](_0x1aeda7['query'][_0xd207('0x36')]));_0x5bfaea['attributes']=_0x5bfaea[_0xd207('0x35')][_0xd207('0x37')]?_0x5bfaea[_0xd207('0x35')]:_0x49e779[_0xd207('0x2f')];if(!_0x1aeda7['query'][_0xd207('0x38')](_0xd207('0x39'))){_0x5bfaea[_0xd207('0x20')]=qs[_0xd207('0x20')](_0x1aeda7[_0xd207('0x31')][_0xd207('0x20')]);_0x5bfaea[_0xd207('0x1e')]=qs[_0xd207('0x1e')](_0x1aeda7[_0xd207('0x31')][_0xd207('0x1e')]);}_0x5bfaea[_0xd207('0x3a')]=qs[_0xd207('0x3b')](_0x1aeda7[_0xd207('0x31')][_0xd207('0x3b')]);_0x5bfaea['where']=qs[_0xd207('0x33')](_['pick'](_0x1aeda7['query'],_0x49e779['filters']),_0x531a2d);if(_0x1aeda7['query'][_0xd207('0x3c')]){_0x5bfaea[_0xd207('0x3d')]=_['merge'](_0x5bfaea[_0xd207('0x3d')],{'$or':_[_0xd207('0x30')](_0x531a2d,function(_0x5a0039){if(_0x5a0039[_0xd207('0x2d')]!==_0xd207('0x3e')){var _0x1ae357={};_0x1ae357[_0x5a0039['name']]={'$like':'%'+_0x1aeda7[_0xd207('0x31')][_0xd207('0x3c')]+'%'};return _0x1ae357;}})});}_0x5bfaea=_['merge']({},_0x5bfaea,_0x1aeda7[_0xd207('0x3f')]);var _0x1f4ec8={'where':_0x5bfaea['where']};return db[_0xd207('0x40')][_0xd207('0x21')](_0x1f4ec8)[_0xd207('0x27')](function(_0x4c9745){_0x3ad242[_0xd207('0x21')]=_0x4c9745;if(_0x1aeda7[_0xd207('0x31')][_0xd207('0x41')]){_0x5bfaea['include']=[{'all':!![]}];}return db[_0xd207('0x40')]['findAll'](_0x5bfaea);})[_0xd207('0x27')](function(_0x68c934){_0x3ad242[_0xd207('0x42')]=_0x68c934;return _0x3ad242;})['then'](respondWithFilteredResult(_0x12ffac,_0x5bfaea))[_0xd207('0x43')](handleError(_0x12ffac,null));};exports[_0xd207('0x44')]=function(_0x39f5d7,_0x132351){var _0x419a32={'raw':!![],'where':{'id':_0x39f5d7[_0xd207('0x45')]['id']}},_0x8c657={};_0x8c657[_0xd207('0x2f')]=_[_0xd207('0x32')](db[_0xd207('0x40')][_0xd207('0x46')]);_0x8c657[_0xd207('0x31')]=_[_0xd207('0x32')](_0x39f5d7['query']);_0x8c657[_0xd207('0x33')]=_[_0xd207('0x34')](_0x8c657[_0xd207('0x2f')],_0x8c657[_0xd207('0x31')]);_0x419a32[_0xd207('0x35')]=_[_0xd207('0x34')](_0x8c657[_0xd207('0x2f')],qs['fields'](_0x39f5d7[_0xd207('0x31')]['fields']));_0x419a32[_0xd207('0x35')]=_0x419a32[_0xd207('0x35')][_0xd207('0x37')]?_0x419a32[_0xd207('0x35')]:_0x8c657[_0xd207('0x2f')];if(_0x39f5d7['query']['includeAll']){_0x419a32[_0xd207('0x47')]=[{'all':!![]}];}_0x419a32=_['merge']({},_0x419a32,_0x39f5d7[_0xd207('0x3f')]);return db[_0xd207('0x40')]['find'](_0x419a32)[_0xd207('0x27')](handleEntityNotFound(_0x132351,null))['then'](respondWithResult(_0x132351,null))[_0xd207('0x43')](handleError(_0x132351,null));};exports[_0xd207('0x48')]=function(_0x22da59,_0x19b4d5){return db['VoiceTransferReport'][_0xd207('0x48')](_0x22da59['body'],{})[_0xd207('0x27')](respondWithResult(_0x19b4d5,0xc9))[_0xd207('0x43')](handleError(_0x19b4d5,null));};exports[_0xd207('0x26')]=function(_0x1cea35,_0x2580f7){if(_0x1cea35['body']['id']){delete _0x1cea35['body']['id'];}return db[_0xd207('0x40')][_0xd207('0x49')]({'where':{'id':_0x1cea35['params']['id']}})[_0xd207('0x27')](handleEntityNotFound(_0x2580f7,null))[_0xd207('0x27')](saveUpdates(_0x1cea35['body'],null))[_0xd207('0x27')](respondWithResult(_0x2580f7,null))['catch'](handleError(_0x2580f7,null));};exports[_0xd207('0x28')]=function(_0x1b4535,_0x152489){return db[_0xd207('0x40')]['find']({'where':{'id':_0x1b4535[_0xd207('0x45')]['id']}})[_0xd207('0x27')](handleEntityNotFound(_0x152489,null))[_0xd207('0x27')](removeEntity(_0x152489,null))[_0xd207('0x43')](handleError(_0x152489,null));};exports[_0xd207('0x4a')]=function(_0x56ca94,_0x2063bf){return db['VoiceTransferReport'][_0xd207('0x4a')]()[_0xd207('0x27')](respondWithResult(_0x2063bf,null))[_0xd207('0x43')](handleError(_0x2063bf,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 912a1fd..ce4940f 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 _0x46a8=['../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','path','rimraf'];(function(_0x4200d1,_0x724d52){var _0x616187=function(_0x4409ce){while(--_0x4409ce){_0x4200d1['push'](_0x4200d1['shift']());}};_0x616187(++_0x724d52);}(_0x46a8,0x11d));var _0x846a=function(_0x3a5d2f,_0xfec304){_0x3a5d2f=_0x3a5d2f-0x0;var _0x5ac002=_0x46a8[_0x3a5d2f];return _0x5ac002;};'use strict';var _=require('lodash');var util=require(_0x846a('0x0'));var logger=require(_0x846a('0x1'))(_0x846a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x846a('0x3'));var rimraf=require(_0x846a('0x4'));var config=require(_0x846a('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x846a('0x6')]=function(_0x15a165,_0x4a6098){return _0x15a165[_0x846a('0x7')](_0x846a('0x8'),attributes,{'tableName':_0x846a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd66d=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x81a697,_0x58a1c9){var _0x350b4f=function(_0x1210ef){while(--_0x1210ef){_0x81a697['push'](_0x81a697['shift']());}};_0x350b4f(++_0x58a1c9);}(_0xd66d,0x6c));var _0xdd66=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xd66d[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xdd66('0x0'));var util=require(_0xdd66('0x1'));var logger=require(_0xdd66('0x2'))(_0xdd66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd66('0x4'));var fs=require('fs');var path=require(_0xdd66('0x5'));var rimraf=require(_0xdd66('0x6'));var config=require(_0xdd66('0x7'));var attributes=require(_0xdd66('0x8'));module[_0xdd66('0x9')]=function(_0x5ab04c,_0x3c9d42){return _0x5ab04c[_0xdd66('0xa')](_0xdd66('0xb'),attributes,{'tableName':_0xdd66('0xc'),'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 219958c..0939c52 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 _0x3b1a=['jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x255777,_0xd75713){var _0x3a312b=function(_0x18927e){while(--_0x18927e){_0x255777['push'](_0x255777['shift']());}};_0x3a312b(++_0xd75713);}(_0x3b1a,0x122));var _0xa3b1=function(_0x4b6f5c,_0x56f7ce){_0x4b6f5c=_0x4b6f5c-0x0;var _0x55548b=_0x3b1a[_0x4b6f5c];return _0x55548b;};'use strict';var _=require('lodash');var util=require(_0xa3b1('0x0'));var moment=require('moment');var BPromise=require(_0xa3b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3b1('0x2'));var db=require(_0xa3b1('0x3'))['db'];var utils=require(_0xa3b1('0x4'));var logger=require(_0xa3b1('0x5'))('rpc');var config=require(_0xa3b1('0x6'));var jayson=require(_0xa3b1('0x7'));var client=jayson[_0xa3b1('0x8')][_0xa3b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c677,_0x59b564,_0x4f2a0e){return new BPromise(function(_0x32f0b6,_0x5d4e1f){return client[_0xa3b1('0xa')](_0x49c677,_0x4f2a0e)[_0xa3b1('0xb')](function(_0x437f04){logger['info'](_0xa3b1('0xc'),_0x59b564,'request\x20sent');logger[_0xa3b1('0xd')](_0xa3b1('0xe'),_0x59b564,_0xa3b1('0xf'),JSON[_0xa3b1('0x10')](_0x437f04));if(_0x437f04[_0xa3b1('0x11')]){if(_0x437f04[_0xa3b1('0x11')]['code']===0x1f4){logger['error'](_0xa3b1('0xc'),_0x59b564,_0x437f04[_0xa3b1('0x11')][_0xa3b1('0x12')]);return _0x5d4e1f(_0x437f04['error'][_0xa3b1('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x59b564,_0x437f04[_0xa3b1('0x11')][_0xa3b1('0x12')]);return _0x32f0b6(_0x437f04[_0xa3b1('0x11')][_0xa3b1('0x12')]);}else{logger[_0xa3b1('0x13')](_0xa3b1('0xc'),_0x59b564,_0xa3b1('0xf'));_0x32f0b6(_0x437f04[_0xa3b1('0x14')][_0xa3b1('0x12')]);}})['catch'](function(_0x17248c){logger['error'](_0xa3b1('0xc'),_0x59b564,_0x17248c);_0x5d4e1f(_0x17248c);});});}exports['CreateVoiceTransferReport']=function(_0x1128b4){var _0x3dd6ee=this;return new Promise(function(_0x5e08c1,_0x7b2d1f){return db[_0xa3b1('0x15')]['create'](_0x1128b4[_0xa3b1('0x16')],{'raw':_0x1128b4['options']?_0x1128b4[_0xa3b1('0x17')][_0xa3b1('0x18')]===undefined?!![]:![]:!![]})[_0xa3b1('0xb')](function(_0x37dbab){logger['info'](_0xa3b1('0x19'),_0x1128b4);logger[_0xa3b1('0xd')](_0xa3b1('0x19'),_0x1128b4,JSON[_0xa3b1('0x10')](_0x37dbab));_0x5e08c1(_0x37dbab);})[_0xa3b1('0x1a')](function(_0x168d3a){logger[_0xa3b1('0x11')](_0xa3b1('0x19'),_0x168d3a['message'],_0x1128b4);_0x7b2d1f(_0x3dd6ee[_0xa3b1('0x11')](0x1f4,_0x168d3a[_0xa3b1('0x12')]));});});}; \ No newline at end of file +var _0xdf63=['CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xdf63,0x9c));var _0x3df6=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xdf63[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0x3df6('0x0'));var util=require(_0x3df6('0x1'));var moment=require(_0x3df6('0x2'));var BPromise=require(_0x3df6('0x3'));var rs=require(_0x3df6('0x4'));var fs=require('fs');var Redis=require(_0x3df6('0x5'));var db=require(_0x3df6('0x6'))['db'];var utils=require(_0x3df6('0x7'));var logger=require(_0x3df6('0x8'))(_0x3df6('0x9'));var config=require(_0x3df6('0xa'));var jayson=require(_0x3df6('0xb'));var client=jayson[_0x3df6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52af69,_0x49b3c0,_0x5c492c){return new BPromise(function(_0x2e633f,_0x506b70){return client['request'](_0x52af69,_0x5c492c)[_0x3df6('0xd')](function(_0x46f370){logger[_0x3df6('0xe')](_0x3df6('0xf'),_0x49b3c0,_0x3df6('0x10'));logger[_0x3df6('0x11')](_0x3df6('0x12'),_0x49b3c0,_0x3df6('0x10'),JSON[_0x3df6('0x13')](_0x46f370));if(_0x46f370[_0x3df6('0x14')]){if(_0x46f370[_0x3df6('0x14')][_0x3df6('0x15')]===0x1f4){logger[_0x3df6('0x14')](_0x3df6('0xf'),_0x49b3c0,_0x46f370[_0x3df6('0x14')][_0x3df6('0x16')]);return _0x506b70(_0x46f370[_0x3df6('0x14')]['message']);}logger[_0x3df6('0x14')](_0x3df6('0xf'),_0x49b3c0,_0x46f370[_0x3df6('0x14')]['message']);return _0x2e633f(_0x46f370['error']['message']);}else{logger[_0x3df6('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x49b3c0,_0x3df6('0x10'));_0x2e633f(_0x46f370[_0x3df6('0x17')]['message']);}})[_0x3df6('0x18')](function(_0x3dbfaa){logger[_0x3df6('0x14')](_0x3df6('0xf'),_0x49b3c0,_0x3dbfaa);_0x506b70(_0x3dbfaa);});});}exports['CreateVoiceTransferReport']=function(_0x550134){var _0x38d892=this;return new Promise(function(_0x4dd3db,_0x47bb0b){return db[_0x3df6('0x19')][_0x3df6('0x1a')](_0x550134[_0x3df6('0x1b')],{'raw':_0x550134[_0x3df6('0x1c')]?_0x550134[_0x3df6('0x1c')][_0x3df6('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x185eb4){logger[_0x3df6('0xe')]('CreateVoiceTransferReport',_0x550134);logger[_0x3df6('0x11')](_0x3df6('0x1e'),_0x550134,JSON[_0x3df6('0x13')](_0x185eb4));_0x4dd3db(_0x185eb4);})[_0x3df6('0x18')](function(_0x308803){logger[_0x3df6('0x14')](_0x3df6('0x1e'),_0x308803['message'],_0x550134);_0x47bb0b(_0x38d892[_0x3df6('0x14')](0x1f4,_0x308803['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 05f0f9e..f5977b7 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 _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x541389,_0x15f173){var _0x5eaa0a=function(_0x555f3c){while(--_0x555f3c){_0x541389['push'](_0x541389['shift']());}};_0x5eaa0a(++_0x15f173);}(_0xaa88,0x137));var _0x8aa8=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xaa88[_0x387dc1];return _0x17567c;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xcb91[_0x386525];return _0x14d015;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b0f4f41..316b93d 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 _0xc874=['filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','info','format','webbar:originate','originate\x20executed!','hangup','validate','webbar:hangup','hangup\x20executed!','answer','entityFound:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','error','stack','name','send','status','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels'];(function(_0x1ba567,_0x33cfa0){var _0x21cd0a=function(_0xfb04dc){while(--_0xfb04dc){_0x1ba567['push'](_0x1ba567['shift']());}};_0x21cd0a(++_0x33cfa0);}(_0xc874,0x154));var _0x4c87=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xc874[_0x146a97];return _0x259d5c;};'use strict';var path=require(_0x4c87('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4c87('0x1'))['db'];var config=require(_0x4c87('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x4c87('0x3'));var amiClient=jayson[_0x4c87('0x4')][_0x4c87('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x4c87('0x6'));var Redis=require(_0x4c87('0x7'));config['redis']=_[_0x4c87('0x8')](config[_0x4c87('0x9')],{'host':_0x4c87('0xa'),'port':0x18eb});var io=require(_0x4c87('0xb'))(new Redis(config[_0x4c87('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0xe')]},'callerId':{'type':_0x4c87('0xd')},'callbackUrl':{'type':_0x4c87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0x10')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x27abb9,_0x3c32cc,_0x585705){logger['info'](_0x27abb9,_0x3c32cc,JSON[_0x4c87('0x11')](_0x585705));io['to'](_0x27abb9)[_0x4c87('0x12')](_0x3c32cc,_0x585705);}function handleError(_0x2b55fa){return function(_0x547d92){console[_0x4c87('0x13')]('handleError:',_0x547d92,_0x547d92 instanceof RangeError);logger[_0x4c87('0x14')](_0x547d92[_0x4c87('0x15')]);if(_0x547d92 instanceof RangeError){if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa['status'](0x194)[_0x4c87('0x17')](_0x547d92);}else{if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa[_0x4c87('0x18')](0x1f4)[_0x4c87('0x17')](_0x547d92);}};}function checkError(){return function(_0x22fac7){if(!_0x22fac7){throw new RangeError(_0x4c87('0x19'));}return _0x22fac7;};}function respondWithRpcPromise(_0x9da0d6,_0x50289b){return new BPromise(function(_0x353ac9,_0x33aafd){var _0x5cc15d=amiClient;return _0x5cc15d[_0x4c87('0x1a')](_0x9da0d6,_0x50289b)[_0x4c87('0x1b')](function(_0x5a9496){if(_0x5a9496[_0x4c87('0x14')]){if(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1c')]===0x1f4){return _0x33aafd(_0x5a9496[_0x4c87('0x14')]['message']);}return _0x353ac9(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1d')]);}else{_0x353ac9(_0x5a9496[_0x4c87('0x1e')]);}})[_0x4c87('0x1f')](function(_0x637dbc){_0x33aafd(_0x637dbc);});});}function getAgent(_0x3eb09e){return db[_0x4c87('0x20')][_0x4c87('0x21')]({'where':{'id':_0x3eb09e,'role':'agent'}})[_0x4c87('0x1b')](checkError());}function getAgentCheckSession(_0x47ef54,_0x27f13d){return new BPromise(function(_0x381af7,_0x3a9520){var _0x1f246e=respondWithRpcPromise(_0x4c87('0x22'));var _0x583371=getAgent(_0x47ef54);Promise['all']([_0x1f246e,_0x583371])[_0x4c87('0x1b')](function(_0x23483e){var _0x2e3549=_0x23483e[0x0];var _0x106121=_0x23483e[0x1];var _0xa7eb3=_[_0x4c87('0x23')](_0x2e3549[_0x4c87('0x24')],function(_0x10aea2){return _0x10aea2[_0x4c87('0x25')]==_0x106121['id']&&_0x10aea2[_0x4c87('0x26')]==_0x27f13d;});if(_0xa7eb3[_0x4c87('0x27')]==0x1){_0x381af7(_0x106121);}else{_0x3a9520(new RangeError(_0x4c87('0x28')+_0x27f13d+_0x4c87('0x29')));}});});}exports[_0x4c87('0x2a')]=function(_0x3a1aaf,_0x185590){logger['info'](_0x4c87('0x2b'),_0x3a1aaf['body']);var _0x110b84=originateValidation['validate'](_0x3a1aaf[_0x4c87('0x2c')]);if(_0x110b84[_0x4c87('0x27')]>0x0){return _0x185590[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x110b84);}var _0x58eb98=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2f307a=_0x3a1aaf[_0x4c87('0x2c')]['callNumber'];var _0x2060f8=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2f')];var _0x30fdba=_0x3a1aaf['body'][_0x4c87('0x30')];return getAgent(_0x58eb98)[_0x4c87('0x1b')](function(_0x5fb196){logger[_0x4c87('0x31')]('entityFound:',_0x5fb196['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5fb196[_0x4c87('0x16')]),_0x4c87('0x33'),{'callNumber':_0x2f307a,'callerId':_0x2060f8,'callbackUrl':_0x30fdba});return _0x185590[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x34')});})['catch'](handleError(_0x185590));};exports[_0x4c87('0x35')]=function(_0x11a632,_0xcc73b5){logger['info']('hangup\x20fired:',_0x11a632[_0x4c87('0x2c')]);var _0x2da03f=hangupValidation[_0x4c87('0x36')](_0x11a632['body']);if(_0x2da03f[_0x4c87('0x27')]>0x0){return _0xcc73b5['status'](0x190)['json'](_0x2da03f);}var _0x5bbd35=_0x11a632[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2de50d=_0x11a632['body'][_0x4c87('0x26')];return getAgent(_0x5bbd35)[_0x4c87('0x1b')](function(_0x5de7b1){logger[_0x4c87('0x31')]('entityFound:',_0x5de7b1['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5de7b1[_0x4c87('0x16')]),_0x4c87('0x37'),{'sessionId':_0x2de50d});return _0xcc73b5['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x38')});})['catch'](handleError(_0xcc73b5));};exports[_0x4c87('0x39')]=function(_0x5a70b7,_0x521944){logger[_0x4c87('0x31')]('answer\x20fired:',_0x5a70b7['body']);var _0x35c74b=answerValidation[_0x4c87('0x36')](_0x5a70b7['body']);if(_0x35c74b[_0x4c87('0x27')]>0x0){return _0x521944[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x35c74b);}var _0x45b950=_0x5a70b7['body'][_0x4c87('0x2e')];var _0x448208=_0x5a70b7[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x45b950)['then'](function(_0x33716e){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x33716e['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x33716e[_0x4c87('0x16')]),_0x4c87('0x3c'),{'sessionId':_0x448208});return _0x521944['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x3d')});})[_0x4c87('0x1f')](handleError(_0x521944));};exports['hold']=function(_0x507686,_0x41cfe9){logger[_0x4c87('0x31')](_0x4c87('0x3e'),_0x507686[_0x4c87('0x2c')]);var _0x52bac1=holdValidation['validate'](_0x507686[_0x4c87('0x2c')]);if(_0x52bac1[_0x4c87('0x27')]>0x0){return _0x41cfe9[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x52bac1);}var _0x2c7eef=_0x507686[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x290761=_0x507686[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x2c7eef)['then'](function(_0x20f4f2){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20f4f2[_0x4c87('0x16')]);emit(util['format'](_0x4c87('0x3b'),_0x20f4f2[_0x4c87('0x16')]),_0x4c87('0x3f'),{'sessionId':_0x290761});return _0x41cfe9['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x40')});})[_0x4c87('0x1f')](handleError(_0x41cfe9));};exports['unhold']=function(_0x31f23a,_0x1b5843){logger[_0x4c87('0x31')]('unhold\x20fired:',_0x31f23a['body']);var _0x578b39=unholdValidation['validate'](_0x31f23a['body']);if(_0x578b39[_0x4c87('0x27')]>0x0){return _0x1b5843[_0x4c87('0x18')](0x190)['json'](_0x578b39);}var _0x59545c=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x205419=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x59545c)[_0x4c87('0x1b')](function(_0x64642a){logger[_0x4c87('0x31')]('entityFound:',_0x64642a['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x64642a[_0x4c87('0x16')]),_0x4c87('0x41'),{'sessionId':_0x205419});return _0x1b5843[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x42')});})[_0x4c87('0x1f')](handleError(_0x1b5843));};exports[_0x4c87('0x43')]=function(_0x2a4bf1,_0x4aa6e3){logger['info'](_0x4c87('0x44'),_0x4aa6e3['body']);var _0x3fae0d=callsValidation[_0x4c87('0x36')](_0x2a4bf1[_0x4c87('0x2c')]);if(_0x3fae0d['length']>0x0){return _0x4aa6e3[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x3fae0d);}var _0x3d407a=_0x2a4bf1[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x67c32d=respondWithRpcPromise(_0x4c87('0x22'));var _0x4e552a=getAgent(_0x3d407a);return Promise['all']([_0x67c32d,_0x4e552a])[_0x4c87('0x1b')](function(_0x2fb4a){var _0x253e8b=_0x2fb4a[0x0];var _0x197c0d=_0x2fb4a[0x1];var _0x16be71=_[_0x4c87('0x23')](_0x253e8b[_0x4c87('0x24')],function(_0x1f7b9b){return _0x1f7b9b[_0x4c87('0x25')]==_0x197c0d['id'];});return _0x4aa6e3[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'count':_0x16be71[_0x4c87('0x27')],'rows':_0x16be71});})[_0x4c87('0x1f')](handleError(_0x4aa6e3));};exports['conference']=function(_0x37b319,_0x24c52a){logger[_0x4c87('0x31')](_0x4c87('0x45'),_0x37b319[_0x4c87('0x2c')]);var _0x1d71e5=conferenceValidation[_0x4c87('0x36')](_0x37b319['body']);if(_0x1d71e5['length']>0x0){return _0x24c52a[_0x4c87('0x18')](0x190)['json'](_0x1d71e5);}var _0x53e6ba=_0x37b319['body'][_0x4c87('0x2e')];return getAgent(_0x53e6ba)[_0x4c87('0x1b')](function(_0x20c0b6){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20c0b6['name']);emit(util['format'](_0x4c87('0x3b'),_0x20c0b6['name']),'webbar:conference');return _0x24c52a['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x46')});})[_0x4c87('0x1f')](handleError(_0x24c52a));};exports[_0x4c87('0x47')]=function(_0x44a2c7,_0x4ed555){logger['info'](_0x4c87('0x48'),_0x44a2c7[_0x4c87('0x2c')]);var _0xdf24be=transferValidation[_0x4c87('0x36')](_0x44a2c7['body']);if(_0xdf24be['length']>0x0){return _0x4ed555[_0x4c87('0x18')](0x190)['json'](_0xdf24be);}var _0x30773f=_0x44a2c7[_0x4c87('0x2c')]['userId'];var _0x10b898=_0x44a2c7['body'][_0x4c87('0x26')];var _0x38dfad=_0x44a2c7[_0x4c87('0x2c')][_0x4c87('0x49')];return getAgent(_0x30773f)['then'](function(_0x44a493){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x44a493[_0x4c87('0x16')]);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x44a493['name']),'webbar:transfer',{'sessionId':_0x10b898,'transferNumber':_0x38dfad});return _0x4ed555[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x4a')});})['catch'](handleError(_0x4ed555));}; \ No newline at end of file +var _0xad95=['send','NotFound','request','message','result','catch','findOne','then','VoiceChannels','filter','UserId','sessionId','length','originate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','rows','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','../../config/logger','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status'];(function(_0x18fed6,_0x2a9377){var _0x5984bd=function(_0x36ed1d){while(--_0x36ed1d){_0x18fed6['push'](_0x18fed6['shift']());}};_0x5984bd(++_0x2a9377);}(_0xad95,0x70));var _0x5ad9=function(_0x1a8d31,_0x11c9e1){_0x1a8d31=_0x1a8d31-0x0;var _0x4bcca6=_0xad95[_0x1a8d31];return _0x4bcca6;};'use strict';var path=require(_0x5ad9('0x0'));var fs=require('fs');var _=require(_0x5ad9('0x1'));var db=require(_0x5ad9('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x5ad9('0x3'));var jayson=require(_0x5ad9('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x5ad9('0x5'))('webbarapi');var Redis=require('ioredis');config['redis']=_['defaults'](config[_0x5ad9('0x6')],{'host':_0x5ad9('0x7'),'port':0x18eb});var io=require(_0x5ad9('0x8'))(new Redis(config[_0x5ad9('0x6')]));var Schema=require(_0x5ad9('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ad9('0xa')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5ad9('0xb')},'callbackUrl':{'type':_0x5ad9('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5ad9('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5ad9('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],_0x5ad9('0xa')]},'sessionId':{'type':_0x5ad9('0xb'),'required':[!![],_0x5ad9('0xd')]},'transferNumber':{'type':_0x5ad9('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5ad9('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5ad9('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],_0x5ad9('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5ad9('0xc'),'required':[!![],_0x5ad9('0xa')]}});function emit(_0x32b0bd,_0x112d44,_0x321c78){logger[_0x5ad9('0xe')](_0x32b0bd,_0x112d44,JSON[_0x5ad9('0xf')](_0x321c78));io['to'](_0x32b0bd)['emit'](_0x112d44,_0x321c78);}function handleError(_0x1c0b8e){return function(_0x54f392){console[_0x5ad9('0x10')](_0x5ad9('0x11'),_0x54f392,_0x54f392 instanceof RangeError);logger[_0x5ad9('0x12')](_0x54f392[_0x5ad9('0x13')]);if(_0x54f392 instanceof RangeError){if(_0x54f392[_0x5ad9('0x14')]){delete _0x54f392[_0x5ad9('0x14')];}_0x1c0b8e[_0x5ad9('0x15')](0x194)['send'](_0x54f392);}else{if(_0x54f392[_0x5ad9('0x14')]){delete _0x54f392['name'];}_0x1c0b8e['status'](0x1f4)[_0x5ad9('0x16')](_0x54f392);}};}function checkError(){return function(_0x545268){if(!_0x545268){throw new RangeError(_0x5ad9('0x17'));}return _0x545268;};}function respondWithRpcPromise(_0x36a2e9,_0x13e38c){return new BPromise(function(_0xebbe63,_0x1274f7){var _0x57b2ba=amiClient;return _0x57b2ba[_0x5ad9('0x18')](_0x36a2e9,_0x13e38c)['then'](function(_0x807b05){if(_0x807b05['error']){if(_0x807b05['error']['code']===0x1f4){return _0x1274f7(_0x807b05[_0x5ad9('0x12')][_0x5ad9('0x19')]);}return _0xebbe63(_0x807b05[_0x5ad9('0x12')][_0x5ad9('0x19')]);}else{_0xebbe63(_0x807b05[_0x5ad9('0x1a')]);}})[_0x5ad9('0x1b')](function(_0x11d919){_0x1274f7(_0x11d919);});});}function getAgent(_0x4fd73e){return db['User'][_0x5ad9('0x1c')]({'where':{'id':_0x4fd73e,'role':'agent'}})[_0x5ad9('0x1d')](checkError());}function getAgentCheckSession(_0x584de3,_0x346f35){return new BPromise(function(_0x55a0e4,_0x58a156){var _0x243f82=respondWithRpcPromise(_0x5ad9('0x1e'));var _0x49b3df=getAgent(_0x584de3);Promise['all']([_0x243f82,_0x49b3df])[_0x5ad9('0x1d')](function(_0x129804){var _0x1b6faf=_0x129804[0x0];var _0x2ad078=_0x129804[0x1];var _0xe06a1d=_[_0x5ad9('0x1f')](_0x1b6faf['rows'],function(_0x132ec6){return _0x132ec6[_0x5ad9('0x20')]==_0x2ad078['id']&&_0x132ec6[_0x5ad9('0x21')]==_0x346f35;});if(_0xe06a1d[_0x5ad9('0x22')]==0x1){_0x55a0e4(_0x2ad078);}else{_0x58a156(new RangeError('sessionId\x20'+_0x346f35+'\x20not\x20found!'));}});});}exports[_0x5ad9('0x23')]=function(_0xe044cf,_0x4afceb){logger['info']('originate\x20fired:',_0xe044cf[_0x5ad9('0x24')]);var _0x15365b=originateValidation['validate'](_0xe044cf[_0x5ad9('0x24')]);if(_0x15365b[_0x5ad9('0x22')]>0x0){return _0x4afceb[_0x5ad9('0x15')](0x190)[_0x5ad9('0x25')](_0x15365b);}var _0x4daf7b=_0xe044cf['body'][_0x5ad9('0x26')];var _0x433728=_0xe044cf[_0x5ad9('0x24')][_0x5ad9('0x27')];var _0x211426=_0xe044cf['body'][_0x5ad9('0x28')];var _0x4091b8=_0xe044cf[_0x5ad9('0x24')][_0x5ad9('0x29')];return getAgent(_0x4daf7b)[_0x5ad9('0x1d')](function(_0x1f67d4){logger['info'](_0x5ad9('0x2a'),_0x1f67d4[_0x5ad9('0x14')]);emit(util['format'](_0x5ad9('0x2b'),_0x1f67d4[_0x5ad9('0x14')]),'webbar:originate',{'callNumber':_0x433728,'callerId':_0x211426,'callbackUrl':_0x4091b8});return _0x4afceb[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'error':![],'message':_0x5ad9('0x2c')});})['catch'](handleError(_0x4afceb));};exports[_0x5ad9('0x2d')]=function(_0x1815cc,_0x1f8b9b){logger[_0x5ad9('0xe')]('hangup\x20fired:',_0x1815cc[_0x5ad9('0x24')]);var _0xf3301a=hangupValidation[_0x5ad9('0x9')](_0x1815cc[_0x5ad9('0x24')]);if(_0xf3301a[_0x5ad9('0x22')]>0x0){return _0x1f8b9b[_0x5ad9('0x15')](0x190)[_0x5ad9('0x25')](_0xf3301a);}var _0x9219c6=_0x1815cc[_0x5ad9('0x24')]['userId'];var _0x46fc19=_0x1815cc[_0x5ad9('0x24')][_0x5ad9('0x21')];return getAgent(_0x9219c6)[_0x5ad9('0x1d')](function(_0x2a9e3b){logger['info'](_0x5ad9('0x2a'),_0x2a9e3b[_0x5ad9('0x14')]);emit(util[_0x5ad9('0x2e')]('user:%s',_0x2a9e3b[_0x5ad9('0x14')]),_0x5ad9('0x2f'),{'sessionId':_0x46fc19});return _0x1f8b9b[_0x5ad9('0x15')](0xc8)['json']({'error':![],'message':_0x5ad9('0x30')});})['catch'](handleError(_0x1f8b9b));};exports['answer']=function(_0x77689e,_0x34d201){logger[_0x5ad9('0xe')](_0x5ad9('0x31'),_0x77689e['body']);var _0x526fda=answerValidation[_0x5ad9('0x9')](_0x77689e['body']);if(_0x526fda[_0x5ad9('0x22')]>0x0){return _0x34d201['status'](0x190)[_0x5ad9('0x25')](_0x526fda);}var _0x5c5a7a=_0x77689e[_0x5ad9('0x24')][_0x5ad9('0x26')];var _0x6b2fa7=_0x77689e[_0x5ad9('0x24')][_0x5ad9('0x21')];return getAgent(_0x5c5a7a)[_0x5ad9('0x1d')](function(_0x76e642){logger[_0x5ad9('0xe')](_0x5ad9('0x2a'),_0x76e642['name']);emit(util[_0x5ad9('0x2e')](_0x5ad9('0x2b'),_0x76e642[_0x5ad9('0x14')]),_0x5ad9('0x32'),{'sessionId':_0x6b2fa7});return _0x34d201[_0x5ad9('0x15')](0xc8)['json']({'error':![],'message':_0x5ad9('0x33')});})['catch'](handleError(_0x34d201));};exports['hold']=function(_0x4cccab,_0x2c094c){logger[_0x5ad9('0xe')](_0x5ad9('0x34'),_0x4cccab['body']);var _0x39db4b=holdValidation[_0x5ad9('0x9')](_0x4cccab[_0x5ad9('0x24')]);if(_0x39db4b[_0x5ad9('0x22')]>0x0){return _0x2c094c['status'](0x190)[_0x5ad9('0x25')](_0x39db4b);}var _0x420677=_0x4cccab[_0x5ad9('0x24')][_0x5ad9('0x26')];var _0x4fdbb6=_0x4cccab[_0x5ad9('0x24')][_0x5ad9('0x21')];return getAgent(_0x420677)[_0x5ad9('0x1d')](function(_0x1e03f){logger[_0x5ad9('0xe')](_0x5ad9('0x2a'),_0x1e03f[_0x5ad9('0x14')]);emit(util['format'](_0x5ad9('0x2b'),_0x1e03f['name']),_0x5ad9('0x35'),{'sessionId':_0x4fdbb6});return _0x2c094c[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'error':![],'message':_0x5ad9('0x36')});})[_0x5ad9('0x1b')](handleError(_0x2c094c));};exports[_0x5ad9('0x37')]=function(_0xa0f426,_0x2c3945){logger[_0x5ad9('0xe')](_0x5ad9('0x38'),_0xa0f426[_0x5ad9('0x24')]);var _0x2457aa=unholdValidation[_0x5ad9('0x9')](_0xa0f426[_0x5ad9('0x24')]);if(_0x2457aa[_0x5ad9('0x22')]>0x0){return _0x2c3945['status'](0x190)[_0x5ad9('0x25')](_0x2457aa);}var _0x349d5f=_0xa0f426[_0x5ad9('0x24')][_0x5ad9('0x26')];var _0x1c4f6e=_0xa0f426[_0x5ad9('0x24')][_0x5ad9('0x21')];return getAgent(_0x349d5f)[_0x5ad9('0x1d')](function(_0x518072){logger[_0x5ad9('0xe')]('entityFound:',_0x518072[_0x5ad9('0x14')]);emit(util[_0x5ad9('0x2e')](_0x5ad9('0x2b'),_0x518072['name']),_0x5ad9('0x39'),{'sessionId':_0x1c4f6e});return _0x2c3945[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'error':![],'message':'unhold\x20executed!'});})[_0x5ad9('0x1b')](handleError(_0x2c3945));};exports['calls']=function(_0x4e2bbb,_0x4071aa){logger[_0x5ad9('0xe')]('calls\x20fired:',_0x4071aa['body']);var _0xbda89a=callsValidation[_0x5ad9('0x9')](_0x4e2bbb[_0x5ad9('0x24')]);if(_0xbda89a[_0x5ad9('0x22')]>0x0){return _0x4071aa[_0x5ad9('0x15')](0x190)[_0x5ad9('0x25')](_0xbda89a);}var _0x23bddf=_0x4e2bbb[_0x5ad9('0x24')][_0x5ad9('0x26')];var _0x5b5997=respondWithRpcPromise(_0x5ad9('0x1e'));var _0x3b233f=getAgent(_0x23bddf);return Promise['all']([_0x5b5997,_0x3b233f])[_0x5ad9('0x1d')](function(_0x3f3121){var _0x375af6=_0x3f3121[0x0];var _0x574260=_0x3f3121[0x1];var _0x2f3d04=_[_0x5ad9('0x1f')](_0x375af6[_0x5ad9('0x3a')],function(_0x8030a9){return _0x8030a9[_0x5ad9('0x20')]==_0x574260['id'];});return _0x4071aa[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'count':_0x2f3d04[_0x5ad9('0x22')],'rows':_0x2f3d04});})['catch'](handleError(_0x4071aa));};exports[_0x5ad9('0x3b')]=function(_0x4305b5,_0x1e9658){logger[_0x5ad9('0xe')](_0x5ad9('0x3c'),_0x4305b5[_0x5ad9('0x24')]);var _0x313205=conferenceValidation[_0x5ad9('0x9')](_0x4305b5[_0x5ad9('0x24')]);if(_0x313205[_0x5ad9('0x22')]>0x0){return _0x1e9658[_0x5ad9('0x15')](0x190)[_0x5ad9('0x25')](_0x313205);}var _0x515d96=_0x4305b5[_0x5ad9('0x24')][_0x5ad9('0x26')];return getAgent(_0x515d96)[_0x5ad9('0x1d')](function(_0x2bc55c){logger['info'](_0x5ad9('0x2a'),_0x2bc55c['name']);emit(util[_0x5ad9('0x2e')](_0x5ad9('0x2b'),_0x2bc55c[_0x5ad9('0x14')]),'webbar:conference');return _0x1e9658[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'error':![],'message':_0x5ad9('0x3d')});})[_0x5ad9('0x1b')](handleError(_0x1e9658));};exports[_0x5ad9('0x3e')]=function(_0x196bf8,_0x5f53aa){logger[_0x5ad9('0xe')](_0x5ad9('0x3f'),_0x196bf8['body']);var _0x12e253=transferValidation[_0x5ad9('0x9')](_0x196bf8['body']);if(_0x12e253[_0x5ad9('0x22')]>0x0){return _0x5f53aa[_0x5ad9('0x15')](0x190)['json'](_0x12e253);}var _0x2899b4=_0x196bf8[_0x5ad9('0x24')][_0x5ad9('0x26')];var _0x5ac26f=_0x196bf8[_0x5ad9('0x24')][_0x5ad9('0x21')];var _0x32f972=_0x196bf8[_0x5ad9('0x24')][_0x5ad9('0x40')];return getAgent(_0x2899b4)['then'](function(_0x5152aa){logger['info']('entityFound:',_0x5152aa['name']);emit(util['format']('user:%s',_0x5152aa[_0x5ad9('0x14')]),_0x5ad9('0x41'),{'sessionId':_0x5ac26f,'transferNumber':_0x32f972});return _0x5f53aa[_0x5ad9('0x15')](0xc8)[_0x5ad9('0x25')]({'error':![],'message':_0x5ad9('0x42')});})[_0x5ad9('0x1b')](handleError(_0x5f53aa));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6008c45..99d3941 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 _0xb770=['create','addDisposition','post','/:id/canned_answers','addAnswer','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','isAuthenticated','describe','get','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xb770,0x14a));var _0x0b77=function(_0x2aaf4d,_0x3169ee){_0x2aaf4d=_0x2aaf4d-0x0;var _0x3f3f44=_0xb770[_0x2aaf4d];return _0x3f3f44;};'use strict';var multer=require(_0x0b77('0x0'));var util=require(_0x0b77('0x1'));var path=require('path');var timeout=require(_0x0b77('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b77('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0b77('0x4'));var config=require(_0x0b77('0x5'));var controller=require(_0x0b77('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0b77('0x7')]);router['get']('/describe',auth[_0x0b77('0x8')](),controller[_0x0b77('0x9')]);router[_0x0b77('0xa')](_0x0b77('0xb'),auth[_0x0b77('0x8')](),controller[_0x0b77('0xc')]);router[_0x0b77('0xa')](_0x0b77('0xd'),auth[_0x0b77('0x8')](),controller[_0x0b77('0xe')]);router[_0x0b77('0xa')]('/:id/canned_answers',auth[_0x0b77('0x8')](),controller[_0x0b77('0xf')]);router['get'](_0x0b77('0x10'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x11')]);router[_0x0b77('0xa')](_0x0b77('0x12'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x13')]);router['post']('/',auth[_0x0b77('0x8')](),controller[_0x0b77('0x14')]);router['post'](_0x0b77('0xd'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x15')]);router[_0x0b77('0x16')](_0x0b77('0x17'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x18')]);router[_0x0b77('0x16')](_0x0b77('0x10'),auth[_0x0b77('0x8')](),controller['addAgents']);router[_0x0b77('0x16')](_0x0b77('0x12'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x19')]);router[_0x0b77('0x16')]('/:id/notify',controller[_0x0b77('0x1a')]);router[_0x0b77('0x16')](_0x0b77('0x1b'),auth[_0x0b77('0x8')](),controller[_0x0b77('0x1c')]);router[_0x0b77('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x0b77('0x1e')]);router[_0x0b77('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x0b77('0x20')]);router[_0x0b77('0x1f')]('/:id/dispositions',auth[_0x0b77('0x8')](),controller['removeDispositions']);router['delete'](_0x0b77('0x17'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x0b77('0x1f')]('/:id/users',auth[_0x0b77('0x8')](),controller[_0x0b77('0x21')]);module[_0x0b77('0x22')]=router; \ No newline at end of file +var _0x24b7=['/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','delete','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents'];(function(_0x48914a,_0x108527){var _0x3929dc=function(_0x72941c){while(--_0x72941c){_0x48914a['push'](_0x48914a['shift']());}};_0x3929dc(++_0x108527);}(_0x24b7,0x1ca));var _0x724b=function(_0xc295b4,_0x5b4436){_0xc295b4=_0xc295b4-0x0;var _0x1f9934=_0x24b7[_0xc295b4];return _0x1f9934;};'use strict';var multer=require('multer');var util=require(_0x724b('0x0'));var path=require('path');var timeout=require(_0x724b('0x1'));var express=require(_0x724b('0x2'));var router=express[_0x724b('0x3')]();var fs_extra=require(_0x724b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x724b('0x5'));var config=require('../../config/environment');var controller=require(_0x724b('0x6'));router['get']('/',auth[_0x724b('0x7')](),controller[_0x724b('0x8')]);router[_0x724b('0x9')](_0x724b('0xa'),auth[_0x724b('0x7')](),controller[_0x724b('0xb')]);router[_0x724b('0x9')](_0x724b('0xc'),auth[_0x724b('0x7')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x724b('0xd')]);router[_0x724b('0x9')](_0x724b('0xe'),auth[_0x724b('0x7')](),controller[_0x724b('0xf')]);router[_0x724b('0x9')](_0x724b('0x10'),auth['isAuthenticated'](),controller[_0x724b('0x11')]);router[_0x724b('0x9')](_0x724b('0x12'),auth[_0x724b('0x7')](),controller[_0x724b('0x13')]);router[_0x724b('0x14')]('/',auth['isAuthenticated'](),controller[_0x724b('0x15')]);router[_0x724b('0x14')](_0x724b('0x16'),auth['isAuthenticated'](),controller[_0x724b('0x17')]);router[_0x724b('0x14')](_0x724b('0xe'),auth['isAuthenticated'](),controller[_0x724b('0x18')]);router[_0x724b('0x14')](_0x724b('0x10'),auth[_0x724b('0x7')](),controller['addAgents']);router[_0x724b('0x14')](_0x724b('0x12'),auth[_0x724b('0x7')](),controller[_0x724b('0x19')]);router[_0x724b('0x14')](_0x724b('0x1a'),controller[_0x724b('0x1b')]);router[_0x724b('0x14')]('/:id/send',auth[_0x724b('0x7')](),controller[_0x724b('0x1c')]);router[_0x724b('0x1d')](_0x724b('0xc'),auth[_0x724b('0x7')](),controller['update']);router[_0x724b('0x1e')](_0x724b('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x724b('0x1e')]('/:id/dispositions',auth[_0x724b('0x7')](),controller['removeDispositions']);router[_0x724b('0x1e')](_0x724b('0xe'),auth[_0x724b('0x7')](),controller[_0x724b('0x1f')]);router['delete'](_0x724b('0x10'),auth['isAuthenticated'](),controller[_0x724b('0x20')]);module[_0x724b('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d96a8b9..b074bb0 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 _0x028a=['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','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x028a,0x1c0));var _0xa028=function(_0x1dfdb9,_0x5965e3){_0x1dfdb9=_0x1dfdb9-0x0;var _0x30c307=_0x028a[_0x1dfdb9];return _0x30c307;};'use strict';var Sequelize=require(_0xa028('0x0'));var rs=require(_0xa028('0x1'));module[_0xa028('0x2')]={'name':{'type':Sequelize[_0xa028('0x3')],'unique':_0xa028('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa028('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa028('0x3')],'defaultValue':function(){return rs[_0xa028('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa028('0x6')](_0xa028('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0xa028('0x3')]},'baseUrl':{'type':Sequelize[_0xa028('0x3')]},'authToken':{'type':Sequelize[_0xa028('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa028('0x8')],'defaultValue':function(){return _0xa028('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa028('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa028('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa028('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa028('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa028('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa028('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xa028('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x21c682){if(!_0x21c682){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xa028('0xd')](_0xa028('0xe'),_0x21c682);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88ba=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x80b801,_0x394fe4){var _0x225e7c=function(_0xb20710){while(--_0xb20710){_0x80b801['push'](_0x80b801['shift']());}};_0x225e7c(++_0x394fe4);}(_0x88ba,0xa9));var _0xa88b=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x88ba[_0x350343];return _0x9afc1c;};'use strict';var Sequelize=require(_0xa88b('0x0'));var rs=require(_0xa88b('0x1'));module[_0xa88b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xa88b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa88b('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xa88b('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xa88b('0x4')],'defaultValue':function(){return rs[_0xa88b('0x5')]();}},'phone':{'type':Sequelize[_0xa88b('0x4')]},'type':{'type':Sequelize[_0xa88b('0x6')](_0xa88b('0x7'),_0xa88b('0x8'))},'accountSid':{'type':Sequelize[_0xa88b('0x4')]},'baseUrl':{'type':Sequelize[_0xa88b('0x4')]},'authToken':{'type':Sequelize[_0xa88b('0x4')]},'notificationTemplate':{'type':Sequelize[_0xa88b('0x9')],'defaultValue':function(){return _0xa88b('0xa');}},'notificationSound':{'type':Sequelize[_0xa88b('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa88b('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa88b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa88b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa88b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa88b('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa88b('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xa88b('0xb')],'defaultValue':![],'comment':_0xa88b('0xe'),'set':function(_0x5648fc){if(!_0x5648fc){this[_0xa88b('0xf')](_0xa88b('0x10'),null);}this['setDataValue'](_0xa88b('0x11'),_0x5648fc);}},'description':{'type':Sequelize[_0xa88b('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 274e047..fc1edf5 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 _0x42cd=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','json','undefined','count','offset','limit','status','set','reject','save','update','destroy','get','WhatsappAccounts','name','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','mandatoryDispositionPause','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','addDisposition','WhatsappAccountId','getDispositions','findOne','options','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','account','sinch','state','read','WhatsappMessage','statuses','applications','orderBy','Applications','asc','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','message_id','isNil','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','unmanaged','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x313820,_0x28a767){var _0x1047ad=function(_0x339b78){while(--_0x339b78){_0x313820['push'](_0x313820['shift']());}};_0x1047ad(++_0x28a767);}(_0x42cd,0x17f));var _0xd42c=function(_0x24f3f9,_0x538f12){_0x24f3f9=_0x24f3f9-0x0;var _0x1e1ace=_0x42cd[_0x24f3f9];return _0x1e1ace;};'use strict';var emlformat=require(_0xd42c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd42c('0x1'));var jsonpatch=require(_0xd42c('0x2'));var rp=require(_0xd42c('0x3'));var moment=require(_0xd42c('0x4'));var BPromise=require(_0xd42c('0x5'));var Mustache=require(_0xd42c('0x6'));var util=require(_0xd42c('0x7'));var path=require(_0xd42c('0x8'));var sox=require(_0xd42c('0x9'));var csv=require(_0xd42c('0xa'));var ejs=require(_0xd42c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd42c('0xc'));var squel=require(_0xd42c('0xd'));var crypto=require(_0xd42c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd42c('0xf'));var toCsv=require(_0xd42c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd42c('0x10'));var authService=require(_0xd42c('0x11'));var qs=require(_0xd42c('0x12'));var as=require(_0xd42c('0x13'));var hardwareService=require(_0xd42c('0x14'));var logger=require(_0xd42c('0x15'))(_0xd42c('0x16'));var utils=require(_0xd42c('0x17'));var config=require(_0xd42c('0x18'));var licenseUtil=require(_0xd42c('0x19'));var db=require(_0xd42c('0x1a'))['db'];config['redis']=_[_0xd42c('0x1b')](config[_0xd42c('0x1c')],{'host':_0xd42c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd42c('0x1c')]));require(_0xd42c('0x1e'))[_0xd42c('0x1f')](socket);var jayson=require(_0xd42c('0x20'));var client=jayson[_0xd42c('0x21')][_0xd42c('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x42e78f,_0x187e3b,_0x4fd128,_0x4dead2){return new BPromise(function(_0x37c728,_0x44d99c){var _0x44de78=_0x4dead2||client;return _0x44de78[_0xd42c('0x23')](_0x42e78f,_0x4fd128)[_0xd42c('0x24')](function(_0x118d6b){logger['info'](_0xd42c('0x25'),_0x187e3b,_0xd42c('0x26'));logger[_0xd42c('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x187e3b,_0xd42c('0x26'),JSON[_0xd42c('0x28')](_0x118d6b));if(_0x118d6b[_0xd42c('0x29')]){if(_0x118d6b[_0xd42c('0x29')]['code']===0x1f4){logger['error'](_0xd42c('0x25'),_0x187e3b,_0x118d6b[_0xd42c('0x29')]['message']);return _0x44d99c(_0x118d6b[_0xd42c('0x29')][_0xd42c('0x2a')]);}logger[_0xd42c('0x29')](_0xd42c('0x25'),_0x187e3b,_0x118d6b[_0xd42c('0x29')]['message']);return _0x37c728(_0x118d6b[_0xd42c('0x29')]['message']);}else{logger['info'](_0xd42c('0x25'),_0x187e3b,_0xd42c('0x26'));_0x37c728(_0x118d6b[_0xd42c('0x2b')]['message']);}})[_0xd42c('0x2c')](function(_0x48d052){logger['error'](_0xd42c('0x25'),_0x187e3b,_0x48d052);_0x44d99c(_0x48d052);});});}function respondWithStatusCode(_0x50ced2,_0xb37dd){_0xb37dd=_0xb37dd||0xcc;return function(_0x9f891a){if(_0x9f891a){return _0x50ced2[_0xd42c('0x2d')](_0xb37dd);}return _0x50ced2['status'](_0xb37dd)[_0xd42c('0x2e')]();};}function respondWithResult(_0x30d785,_0x36a815){_0x36a815=_0x36a815||0xc8;return function(_0x39bc88){if(_0x39bc88){return _0x30d785['status'](_0x36a815)[_0xd42c('0x2f')](_0x39bc88);}};}function respondWithFilteredResult(_0x5ba5b5,_0xac3ce4){return function(_0xf3c3f3){if(_0xf3c3f3){var _0x2ea7be=typeof _0xac3ce4['offset']===_0xd42c('0x30')&&typeof _0xac3ce4['limit']===_0xd42c('0x30');var _0x70215b=_0xf3c3f3['count'];var _0x1f586b=_0x2ea7be?0x0:_0xac3ce4['offset'];var _0x51b040=_0x2ea7be?_0xf3c3f3[_0xd42c('0x31')]:_0xac3ce4[_0xd42c('0x32')]+_0xac3ce4[_0xd42c('0x33')];var _0x461f81;if(_0x51b040>=_0x70215b){_0x51b040=_0x70215b;_0x461f81=0xc8;}else{_0x461f81=0xce;}_0x5ba5b5[_0xd42c('0x34')](_0x461f81);return _0x5ba5b5[_0xd42c('0x35')]('Content-Range',_0x1f586b+'-'+_0x51b040+'/'+_0x70215b)[_0xd42c('0x2f')](_0xf3c3f3);}return null;};}function patchUpdates(_0x759dca){return function(_0x2e0d3b){try{jsonpatch['apply'](_0x2e0d3b,_0x759dca,!![]);}catch(_0x2af0b0){return BPromise[_0xd42c('0x36')](_0x2af0b0);}return _0x2e0d3b[_0xd42c('0x37')]();};}function saveUpdates(_0x146db3,_0x7b5203){return function(_0x30b51f){if(_0x30b51f){return _0x30b51f[_0xd42c('0x38')](_0x146db3)[_0xd42c('0x24')](function(_0x2e0a0f){return _0x2e0a0f;});}return null;};}function removeEntity(_0x27b9d6,_0x205493){return function(_0x10aed6){if(_0x10aed6){return _0x10aed6[_0xd42c('0x39')]()[_0xd42c('0x24')](function(){var _0x2cf14d=_0x10aed6[_0xd42c('0x3a')]({'plain':!![]});var _0x5737ae=_0xd42c('0x3b');return db['UserProfileResource'][_0xd42c('0x39')]({'where':{'type':_0x5737ae,'resourceId':_0x2cf14d['id']}})['then'](function(){return _0x10aed6;});})[_0xd42c('0x24')](function(){_0x27b9d6['status'](0xcc)[_0xd42c('0x2e')]();});}};}function handleEntityNotFound(_0x3d75ba,_0x45d604){return function(_0x499a51){if(!_0x499a51){_0x3d75ba[_0xd42c('0x2d')](0x194);}return _0x499a51;};}function handleError(_0x12b02e,_0x83098){_0x83098=_0x83098||0x1f4;return function(_0x28e9a1){logger[_0xd42c('0x29')](_0x28e9a1['stack']);if(_0x28e9a1[_0xd42c('0x3c')]){delete _0x28e9a1[_0xd42c('0x3c')];}_0x12b02e[_0xd42c('0x34')](_0x83098)['send'](_0x28e9a1);};}exports[_0xd42c('0x3d')]=function(_0x37f125,_0x2d9781){var _0x1b2d9a={'include':[{'model':db[_0xd42c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4e4653={},_0x3a5d33={'count':0x0,'rows':[]};var _0x51b3e9=_[_0xd42c('0x3f')](db[_0xd42c('0x40')][_0xd42c('0x41')],function(_0x285c6b){return{'name':_0x285c6b[_0xd42c('0x42')],'type':_0x285c6b[_0xd42c('0x43')][_0xd42c('0x44')]};});_0x4e4653[_0xd42c('0x45')]=_[_0xd42c('0x3f')](_0x51b3e9,_0xd42c('0x3c'));_0x4e4653[_0xd42c('0x46')]=_[_0xd42c('0x47')](_0x37f125[_0xd42c('0x46')]);_0x4e4653[_0xd42c('0x48')]=_['intersection'](_0x4e4653[_0xd42c('0x45')],_0x4e4653[_0xd42c('0x46')]);_0x1b2d9a[_0xd42c('0x49')]=_[_0xd42c('0x4a')](_0x4e4653[_0xd42c('0x45')],qs['fields'](_0x37f125['query']['fields']));_0x1b2d9a[_0xd42c('0x49')]=_0x1b2d9a['attributes'][_0xd42c('0x4b')]?_0x1b2d9a[_0xd42c('0x49')]:_0x4e4653['model'];if(!_0x37f125[_0xd42c('0x46')][_0xd42c('0x4c')]('nolimit')){_0x1b2d9a[_0xd42c('0x33')]=qs[_0xd42c('0x33')](_0x37f125['query']['limit']);_0x1b2d9a[_0xd42c('0x32')]=qs[_0xd42c('0x32')](_0x37f125[_0xd42c('0x46')][_0xd42c('0x32')]);}_0x1b2d9a[_0xd42c('0x4d')]=qs[_0xd42c('0x4e')](_0x37f125[_0xd42c('0x46')]['sort']);_0x1b2d9a[_0xd42c('0x4f')]=qs[_0xd42c('0x48')](_[_0xd42c('0x50')](_0x37f125[_0xd42c('0x46')],_0x4e4653[_0xd42c('0x48')]),_0x51b3e9);if(_0x37f125[_0xd42c('0x46')][_0xd42c('0x51')]){_0x1b2d9a['where']=_[_0xd42c('0x52')](_0x1b2d9a[_0xd42c('0x4f')],{'$or':_[_0xd42c('0x3f')](_0x51b3e9,function(_0x1009bb){if(_0x1009bb[_0xd42c('0x43')]!==_0xd42c('0x53')){var _0xe8fc94={};_0xe8fc94[_0x1009bb[_0xd42c('0x3c')]]={'$like':'%'+_0x37f125[_0xd42c('0x46')][_0xd42c('0x51')]+'%'};return _0xe8fc94;}})});}_0x1b2d9a=_[_0xd42c('0x52')]({},_0x1b2d9a,_0x37f125['options']);var _0x3cf89e={'where':_0x1b2d9a[_0xd42c('0x4f')]};return db[_0xd42c('0x40')][_0xd42c('0x31')](_0x3cf89e)['then'](function(_0x10fc46){_0x3a5d33[_0xd42c('0x31')]=_0x10fc46;if(_0x37f125[_0xd42c('0x46')][_0xd42c('0x54')]){_0x1b2d9a['include']=[{'all':!![]}];}return db[_0xd42c('0x40')][_0xd42c('0x55')](_0x1b2d9a);})[_0xd42c('0x24')](function(_0x5ea92f){_0x3a5d33['rows']=_0x5ea92f;return _0x3a5d33;})[_0xd42c('0x24')](respondWithFilteredResult(_0x2d9781,_0x1b2d9a))['catch'](handleError(_0x2d9781,null));};exports[_0xd42c('0x56')]=function(_0x5b22d5,_0x5be203){var _0x408264={'raw':![],'where':{'id':_0x5b22d5[_0xd42c('0x57')]['id']},'include':[{'model':db[_0xd42c('0x3e')],'as':_0xd42c('0x58')}]},_0x3647d2={};_0x3647d2[_0xd42c('0x45')]=_[_0xd42c('0x47')](db[_0xd42c('0x40')][_0xd42c('0x41')]);_0x3647d2[_0xd42c('0x46')]=_[_0xd42c('0x47')](_0x5b22d5[_0xd42c('0x46')]);_0x3647d2['filters']=_[_0xd42c('0x4a')](_0x3647d2['model'],_0x3647d2[_0xd42c('0x46')]);_0x408264['attributes']=_[_0xd42c('0x4a')](_0x3647d2[_0xd42c('0x45')],qs[_0xd42c('0x59')](_0x5b22d5['query'][_0xd42c('0x59')]));_0x408264[_0xd42c('0x49')]=_0x408264['attributes'][_0xd42c('0x4b')]?_0x408264[_0xd42c('0x49')]:_0x3647d2[_0xd42c('0x45')];if(_0x5b22d5[_0xd42c('0x46')][_0xd42c('0x54')]){_0x408264[_0xd42c('0x5a')]=[{'all':!![]}];}_0x408264=_['merge']({},_0x408264,_0x5b22d5['options']);return db[_0xd42c('0x40')][_0xd42c('0x5b')](_0x408264)[_0xd42c('0x24')](handleEntityNotFound(_0x5be203,null))['then'](respondWithResult(_0x5be203,null))[_0xd42c('0x2c')](handleError(_0x5be203,null));};exports['create']=function(_0xa5ec40,_0x7be7e7){return db['WhatsappAccount'][_0xd42c('0x5c')](_0xa5ec40[_0xd42c('0x5d')],{})[_0xd42c('0x24')](function(_0x204397){var _0x56d2cc=_0xa5ec40[_0xd42c('0x5e')]['get']({'plain':!![]});if(!_0x56d2cc)throw new Error(_0xd42c('0x5f'));if(_0x56d2cc[_0xd42c('0x60')]==='user'){var _0x55abb3=_0x204397[_0xd42c('0x3a')]({'plain':!![]});var _0x4e144f='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x4e144f,'userProfileId':_0x56d2cc[_0xd42c('0x61')]},'raw':!![]})[_0xd42c('0x24')](function(_0x253a7c){if(_0x253a7c&&_0x253a7c[_0xd42c('0x62')]===0x0){return db[_0xd42c('0x63')][_0xd42c('0x5c')]({'name':_0x55abb3[_0xd42c('0x3c')],'resourceId':_0x55abb3['id'],'type':_0x253a7c['name'],'sectionId':_0x253a7c['id']},{})[_0xd42c('0x24')](function(){return _0x204397;});}else{return _0x204397;}})[_0xd42c('0x2c')](function(_0x3ff3a9){logger[_0xd42c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ff3a9);throw _0x3ff3a9;});}return _0x204397;})['then'](respondWithResult(_0x7be7e7,0xc9))[_0xd42c('0x2c')](handleError(_0x7be7e7,null));};exports[_0xd42c('0x38')]=function(_0x55f0e4,_0x260306){if(_0x55f0e4[_0xd42c('0x5d')]['id']){delete _0x55f0e4[_0xd42c('0x5d')]['id'];}return db['WhatsappAccount'][_0xd42c('0x5b')]({'where':{'id':_0x55f0e4[_0xd42c('0x57')]['id']},'include':[{'model':db[_0xd42c('0x3e')],'as':_0xd42c('0x58')}]})['then'](handleEntityNotFound(_0x260306,null))[_0xd42c('0x24')](saveUpdates(_0x55f0e4[_0xd42c('0x5d')],null))[_0xd42c('0x24')](respondWithResult(_0x260306,null))[_0xd42c('0x2c')](handleError(_0x260306,null));};exports[_0xd42c('0x39')]=function(_0x4037de,_0x181e95){return db['WhatsappAccount'][_0xd42c('0x5b')]({'where':{'id':_0x4037de[_0xd42c('0x57')]['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x181e95,null))[_0xd42c('0x24')](removeEntity(_0x181e95,null))[_0xd42c('0x2c')](handleError(_0x181e95,null));};exports['describe']=function(_0xf40c9d,_0x310272){return db[_0xd42c('0x40')]['describe']()[_0xd42c('0x24')](respondWithResult(_0x310272,null))[_0xd42c('0x2c')](handleError(_0x310272,null));};exports[_0xd42c('0x64')]=function(_0x599816,_0xeb35fe,_0x1102a0){if(_0x599816[_0xd42c('0x5d')]['id']){delete _0x599816[_0xd42c('0x5d')]['id'];}return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x599816[_0xd42c('0x57')]['id']}})['then'](handleEntityNotFound(_0xeb35fe,null))[_0xd42c('0x24')](function(_0x3fe1f2){if(_0x3fe1f2){_0x599816['body'][_0xd42c('0x65')]=_0x3fe1f2['id'];return db['Disposition'][_0xd42c('0x5c')](_0x599816[_0xd42c('0x5d')]);}})[_0xd42c('0x24')](respondWithResult(_0xeb35fe,null))[_0xd42c('0x2c')](handleError(_0xeb35fe,null));};exports[_0xd42c('0x66')]=function(_0x240e29,_0x4a9996,_0x2f7ed2){var _0x534bf6={'raw':![],'where':{}};var _0x2bcd0d={};var _0x55e0a7={'count':0x0,'rows':[]};return db[_0xd42c('0x40')][_0xd42c('0x67')]({'where':{'id':_0x240e29[_0xd42c('0x57')]['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x4a9996,null))[_0xd42c('0x24')](function(_0x2daec8){if(_0x2daec8){_0x2bcd0d['model']=_['keys'](db['Disposition'][_0xd42c('0x41')]);_0x2bcd0d[_0xd42c('0x46')]=_[_0xd42c('0x47')](_0x240e29['query']);_0x2bcd0d[_0xd42c('0x48')]=_[_0xd42c('0x4a')](_0x2bcd0d[_0xd42c('0x45')],_0x2bcd0d[_0xd42c('0x46')]);_0x534bf6[_0xd42c('0x49')]=_[_0xd42c('0x4a')](_0x2bcd0d[_0xd42c('0x45')],qs[_0xd42c('0x59')](_0x240e29['query'][_0xd42c('0x59')]));_0x534bf6[_0xd42c('0x49')]=_0x534bf6[_0xd42c('0x49')][_0xd42c('0x4b')]?_0x534bf6['attributes']:_0x2bcd0d[_0xd42c('0x45')];if(!_0x240e29[_0xd42c('0x46')][_0xd42c('0x4c')]('nolimit')){_0x534bf6[_0xd42c('0x33')]=qs[_0xd42c('0x33')](_0x240e29[_0xd42c('0x46')][_0xd42c('0x33')]);_0x534bf6['offset']=qs[_0xd42c('0x32')](_0x240e29[_0xd42c('0x46')][_0xd42c('0x32')]);}_0x534bf6[_0xd42c('0x4d')]=qs['sort'](_0x240e29[_0xd42c('0x46')][_0xd42c('0x4e')]);_0x534bf6['where']=qs[_0xd42c('0x48')](_[_0xd42c('0x50')](_0x240e29['query'],_0x2bcd0d[_0xd42c('0x48')]));_0x534bf6[_0xd42c('0x4f')][_0xd42c('0x65')]=_0x2daec8['id'];if(_0x240e29['query']['filter']){_0x534bf6[_0xd42c('0x4f')]=_[_0xd42c('0x52')](_0x534bf6[_0xd42c('0x4f')],{'$or':_[_0xd42c('0x3f')](_0x534bf6[_0xd42c('0x49')],function(_0x240b15){var _0x13d9b4={};_0x13d9b4[_0x240b15]={'$like':'%'+_0x240e29[_0xd42c('0x46')][_0xd42c('0x51')]+'%'};return _0x13d9b4;})});}_0x534bf6=_['merge']({},_0x534bf6,_0x240e29[_0xd42c('0x68')]);return db['Disposition'][_0xd42c('0x31')]({'where':_0x534bf6[_0xd42c('0x4f')]})[_0xd42c('0x24')](function(_0x12545f){_0x55e0a7[_0xd42c('0x31')]=_0x12545f;if(_0x240e29['query'][_0xd42c('0x54')]){_0x534bf6['include']=[{'all':!![]}];}return db[_0xd42c('0x69')][_0xd42c('0x55')](_0x534bf6);})[_0xd42c('0x24')](function(_0x151804){_0x55e0a7[_0xd42c('0x6a')]=_0x151804;return _0x55e0a7;});}})['then'](respondWithFilteredResult(_0x4a9996,_0x534bf6))['catch'](handleError(_0x4a9996,null));};exports[_0xd42c('0x6b')]=function(_0x1dce4a,_0x2ad5df,_0x84d0bd){return db['WhatsappAccount'][_0xd42c('0x5b')]({'where':{'id':_0x1dce4a['params']['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x2ad5df,null))[_0xd42c('0x24')](function(_0x1ffce7){if(_0x1ffce7){return _0x1ffce7[_0xd42c('0x6b')](_0x1dce4a['query'][_0xd42c('0x6c')]);}})['then'](respondWithStatusCode(_0x2ad5df,null))[_0xd42c('0x2c')](handleError(_0x2ad5df,null));};exports[_0xd42c('0x6d')]=function(_0x29a511,_0xcbff14,_0x2e3e61){if(_0x29a511[_0xd42c('0x5d')]['id']){delete _0x29a511['body']['id'];}return db[_0xd42c('0x40')]['find']({'where':{'id':_0x29a511[_0xd42c('0x57')]['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0xcbff14,null))[_0xd42c('0x24')](function(_0x444fe5){if(_0x444fe5){_0x29a511[_0xd42c('0x5d')][_0xd42c('0x65')]=_0x444fe5['id'];return db[_0xd42c('0x6e')][_0xd42c('0x5c')](_0x29a511[_0xd42c('0x5d')]);}})[_0xd42c('0x24')](respondWithResult(_0xcbff14,null))[_0xd42c('0x2c')](handleError(_0xcbff14,null));};exports[_0xd42c('0x6f')]=function(_0xe794dc,_0x52d478,_0x34f56e){var _0x52b4ca={'raw':![],'where':{}};var _0x1d5431={};var _0x19f37f={'count':0x0,'rows':[]};return db[_0xd42c('0x40')][_0xd42c('0x67')]({'where':{'id':_0xe794dc[_0xd42c('0x57')]['id']}})['then'](handleEntityNotFound(_0x52d478,null))[_0xd42c('0x24')](function(_0x548cb0){if(_0x548cb0){_0x1d5431[_0xd42c('0x45')]=_[_0xd42c('0x47')](db[_0xd42c('0x6e')]['rawAttributes']);_0x1d5431['query']=_[_0xd42c('0x47')](_0xe794dc[_0xd42c('0x46')]);_0x1d5431[_0xd42c('0x48')]=_[_0xd42c('0x4a')](_0x1d5431[_0xd42c('0x45')],_0x1d5431['query']);_0x52b4ca[_0xd42c('0x49')]=_[_0xd42c('0x4a')](_0x1d5431['model'],qs[_0xd42c('0x59')](_0xe794dc[_0xd42c('0x46')][_0xd42c('0x59')]));_0x52b4ca[_0xd42c('0x49')]=_0x52b4ca[_0xd42c('0x49')][_0xd42c('0x4b')]?_0x52b4ca[_0xd42c('0x49')]:_0x1d5431['model'];if(!_0xe794dc[_0xd42c('0x46')]['hasOwnProperty'](_0xd42c('0x70'))){_0x52b4ca[_0xd42c('0x33')]=qs[_0xd42c('0x33')](_0xe794dc[_0xd42c('0x46')][_0xd42c('0x33')]);_0x52b4ca['offset']=qs[_0xd42c('0x32')](_0xe794dc[_0xd42c('0x46')][_0xd42c('0x32')]);}_0x52b4ca[_0xd42c('0x4d')]=qs[_0xd42c('0x4e')](_0xe794dc[_0xd42c('0x46')]['sort']);_0x52b4ca['where']=qs['filters'](_['pick'](_0xe794dc[_0xd42c('0x46')],_0x1d5431['filters']));_0x52b4ca[_0xd42c('0x4f')][_0xd42c('0x65')]=_0x548cb0['id'];if(_0xe794dc[_0xd42c('0x46')][_0xd42c('0x51')]){_0x52b4ca['where']=_[_0xd42c('0x52')](_0x52b4ca[_0xd42c('0x4f')],{'$or':_['map'](_0x52b4ca[_0xd42c('0x49')],function(_0x2eae50){var _0xe6b14a={};_0xe6b14a[_0x2eae50]={'$like':'%'+_0xe794dc[_0xd42c('0x46')][_0xd42c('0x51')]+'%'};return _0xe6b14a;})});}_0x52b4ca=_['merge']({},_0x52b4ca,_0xe794dc[_0xd42c('0x68')]);return db['CannedAnswer']['count']({'where':_0x52b4ca[_0xd42c('0x4f')]})[_0xd42c('0x24')](function(_0x2451c1){_0x19f37f[_0xd42c('0x31')]=_0x2451c1;if(_0xe794dc[_0xd42c('0x46')][_0xd42c('0x54')]){_0x52b4ca['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd42c('0x55')](_0x52b4ca);})['then'](function(_0x1ca8fd){_0x19f37f['rows']=_0x1ca8fd;return _0x19f37f;});}})[_0xd42c('0x24')](respondWithFilteredResult(_0x52d478,_0x52b4ca))['catch'](handleError(_0x52d478,null));};exports['removeAnswers']=function(_0x56d0eb,_0x506826,_0x4cfeeb){return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x56d0eb['params']['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x506826,null))[_0xd42c('0x24')](function(_0x1ad259){if(_0x1ad259){return _0x1ad259[_0xd42c('0x71')](_0x56d0eb[_0xd42c('0x46')]['ids']);}})[_0xd42c('0x24')](respondWithStatusCode(_0x506826,null))['catch'](handleError(_0x506826,null));};exports['addAgents']=function(_0x1d8e99,_0x357456,_0xfa916f){return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x1d8e99[_0xd42c('0x57')]['id']}})['then'](handleEntityNotFound(_0x357456,null))[_0xd42c('0x24')](function(_0x90480f){if(_0x90480f){return _0x90480f[_0xd42c('0x72')](_0x1d8e99[_0xd42c('0x5d')][_0xd42c('0x6c')],_[_0xd42c('0x73')](_0x1d8e99['body'],[_0xd42c('0x6c'),'id'])||{})[_0xd42c('0x74')](function(_0x28b2a7){for(var _0x1b9a15=0x0;_0x1b9a15<_0x1d8e99['body'][_0xd42c('0x6c')]['length'];_0x1b9a15+=0x1){socket['emit'](_0xd42c('0x75'),{'UserId':Number(_0x1d8e99[_0xd42c('0x5d')]['ids'][_0x1b9a15]),'WhatsappAccountId':Number(_0x1d8e99[_0xd42c('0x57')]['id'])});}return _0x28b2a7;});}})[_0xd42c('0x24')](respondWithResult(_0x357456,null))[_0xd42c('0x2c')](handleError(_0x357456,null));};exports['removeAgents']=function(_0x4ab061,_0x409207,_0x10ef0b){return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x4ab061[_0xd42c('0x57')]['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x409207,null))['then'](function(_0x63c092){if(_0x63c092){return _0x63c092['removeAgents'](_0x4ab061[_0xd42c('0x46')][_0xd42c('0x6c')])[_0xd42c('0x24')](function(){if(_[_0xd42c('0x76')](_0x4ab061['query']['ids'])){for(var _0x466028=0x0;_0x466028<_0x4ab061[_0xd42c('0x46')][_0xd42c('0x6c')]['length'];_0x466028+=0x1){socket[_0xd42c('0x77')](_0xd42c('0x78'),{'UserId':Number(_0x4ab061[_0xd42c('0x46')]['ids'][_0x466028]),'WhatsappAccountId':Number(_0x4ab061[_0xd42c('0x57')]['id'])});}}else{socket['emit'](_0xd42c('0x78'),{'UserId':Number(_0x4ab061[_0xd42c('0x46')][_0xd42c('0x6c')]),'WhatsappAccountId':Number(_0x4ab061[_0xd42c('0x57')]['id'])});}});}})[_0xd42c('0x24')](respondWithStatusCode(_0x409207,null))['catch'](handleError(_0x409207,null));};exports[_0xd42c('0x79')]=function(_0x1a64c6,_0x3c2f28,_0x5de8f3){var _0x197108={};var _0x2a9516={};var _0x329abf;var _0x253ecf;return db['WhatsappAccount'][_0xd42c('0x67')]({'where':{'id':_0x1a64c6[_0xd42c('0x57')]['id']}})[_0xd42c('0x24')](handleEntityNotFound(_0x3c2f28,null))['then'](function(_0x41bf20){if(_0x41bf20){_0x329abf=_0x41bf20;_0x2a9516[_0xd42c('0x45')]=_[_0xd42c('0x47')](db[_0xd42c('0x7a')][_0xd42c('0x41')]);_0x2a9516[_0xd42c('0x46')]=_[_0xd42c('0x47')](_0x1a64c6[_0xd42c('0x46')]);_0x2a9516['filters']=_[_0xd42c('0x4a')](_0x2a9516['model'],_0x2a9516[_0xd42c('0x46')]);_0x197108['attributes']=_[_0xd42c('0x4a')](_0x2a9516[_0xd42c('0x45')],qs[_0xd42c('0x59')](_0x1a64c6[_0xd42c('0x46')][_0xd42c('0x59')]));_0x197108[_0xd42c('0x49')]=_0x197108[_0xd42c('0x49')][_0xd42c('0x4b')]?_0x197108['attributes']:_0x2a9516[_0xd42c('0x45')];_0x197108[_0xd42c('0x4d')]=qs['sort'](_0x1a64c6[_0xd42c('0x46')]['sort']);_0x197108[_0xd42c('0x4f')]=qs['filters'](_['pick'](_0x1a64c6[_0xd42c('0x46')],_0x2a9516[_0xd42c('0x48')]));if(_0x1a64c6[_0xd42c('0x46')][_0xd42c('0x51')]){_0x197108[_0xd42c('0x4f')]=_[_0xd42c('0x52')](_0x197108[_0xd42c('0x4f')],{'$or':_[_0xd42c('0x3f')](_0x197108[_0xd42c('0x49')],function(_0x5e5ff6){var _0x3ff8be={};_0x3ff8be[_0x5e5ff6]={'$like':'%'+_0x1a64c6['query'][_0xd42c('0x51')]+'%'};return _0x3ff8be;})});}_0x197108=_[_0xd42c('0x52')]({},_0x197108,_0x1a64c6[_0xd42c('0x68')]);return _0x329abf[_0xd42c('0x79')](_0x197108);}})[_0xd42c('0x24')](function(_0x19ed55){if(_0x19ed55){_0x253ecf=_0x19ed55['length'];if(!_0x1a64c6['query'][_0xd42c('0x4c')](_0xd42c('0x70'))){_0x197108[_0xd42c('0x33')]=qs[_0xd42c('0x33')](_0x1a64c6[_0xd42c('0x46')][_0xd42c('0x33')]);_0x197108[_0xd42c('0x32')]=qs[_0xd42c('0x32')](_0x1a64c6[_0xd42c('0x46')]['offset']);}return _0x329abf[_0xd42c('0x79')](_0x197108);}})['then'](function(_0x5c46c8){if(_0x5c46c8){return _0x5c46c8?{'count':_0x253ecf,'rows':_0x5c46c8}:null;}})[_0xd42c('0x24')](respondWithResult(_0x3c2f28,null))[_0xd42c('0x2c')](handleError(_0x3c2f28,null));};exports[_0xd42c('0x7b')]=function(_0x50aa30,_0x30878a){var _0x2bbe5d=_0x50aa30[_0xd42c('0x57')]['id'];var _0x5e0ead=_0x50aa30[_0xd42c('0x5d')];var _0x42155d=0xc8;var _0x45414c=null;return db[_0xd42c('0x7c')][_0xd42c('0x7d')]({'isolationLevel':db[_0xd42c('0x7c')][_0xd42c('0x7e')][_0xd42c('0x7f')][_0xd42c('0x80')]},function(_0x580f62){return db['WhatsappAccount'][_0xd42c('0x67')]({'where':{'id':_0x2bbe5d},'transaction':_0x580f62})[_0xd42c('0x24')](function(_0x5f4343){if(_0x5f4343){return db[_0xd42c('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x2bbe5d},'transaction':_0x580f62})['then'](function(){var _0x3897aa=_[_0xd42c('0x3f')](_0x5e0ead,function(_0x456fa1){_0x456fa1[_0xd42c('0x65')]=_0x2bbe5d;return _0x456fa1;});return db[_0xd42c('0x81')][_0xd42c('0x82')](_0x3897aa,{'transaction':_0x580f62});});}else{_0x42155d=0x194;_0x45414c=[];}});})[_0xd42c('0x24')](function(){if(_0x42155d!==0x194){return db[_0xd42c('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2bbe5d},'order':_0xd42c('0x83')})[_0xd42c('0x24')](function(_0x5bf99c){_0x45414c=_0x5bf99c;});}})[_0xd42c('0x2c')](function(_0x14b102){_0x42155d=0x1f4;logger[_0xd42c('0x29')](_0x14b102['stack']);if(_0x14b102['name']){delete _0x14b102[_0xd42c('0x3c')];}_0x45414c=_0x14b102;})[_0xd42c('0x84')](function(){if(_0x45414c===null){_0x30878a[_0xd42c('0x2d')](_0x42155d);}else{if(_0x42155d===0x1f4){_0x30878a[_0xd42c('0x34')](_0x42155d)[_0xd42c('0x85')](_0x45414c);}else{_0x30878a[_0xd42c('0x34')](_0x42155d)[_0xd42c('0x2f')](_0x45414c);}}});};exports[_0xd42c('0x86')]=function(_0x4c9161,_0x49afdb,_0x230093){var _0x466d32={};var _0x481492={};var _0x54d4a1;var _0x5d293d;return db[_0xd42c('0x40')][_0xd42c('0x67')]({'where':{'id':_0x4c9161[_0xd42c('0x57')]['id']}})['then'](handleEntityNotFound(_0x49afdb,null))[_0xd42c('0x24')](function(_0xb186e0){if(_0xb186e0){_0x54d4a1=_0xb186e0;_0x481492[_0xd42c('0x45')]=_['keys'](db[_0xd42c('0x81')][_0xd42c('0x41')]);_0x481492[_0xd42c('0x46')]=_[_0xd42c('0x47')](_0x4c9161[_0xd42c('0x46')]);_0x481492[_0xd42c('0x48')]=_['intersection'](_0x481492[_0xd42c('0x45')],_0x481492[_0xd42c('0x46')]);_0x466d32[_0xd42c('0x49')]=_[_0xd42c('0x4a')](_0x481492[_0xd42c('0x45')],qs[_0xd42c('0x59')](_0x4c9161['query'][_0xd42c('0x59')]));_0x466d32[_0xd42c('0x49')]=_0x466d32[_0xd42c('0x49')][_0xd42c('0x4b')]?_0x466d32[_0xd42c('0x49')]:_0x481492[_0xd42c('0x45')];_0x466d32[_0xd42c('0x4d')]=qs['sort'](_0x4c9161[_0xd42c('0x46')][_0xd42c('0x4e')]);_0x466d32[_0xd42c('0x4f')]=qs[_0xd42c('0x48')](_[_0xd42c('0x50')](_0x4c9161[_0xd42c('0x46')],_0x481492['filters']));if(_0x4c9161[_0xd42c('0x46')][_0xd42c('0x51')]){_0x466d32[_0xd42c('0x4f')]=_[_0xd42c('0x52')](_0x466d32[_0xd42c('0x4f')],{'$or':_[_0xd42c('0x3f')](_0x466d32[_0xd42c('0x49')],function(_0x46fae1){var _0x26d7e6={};_0x26d7e6[_0x46fae1]={'$like':'%'+_0x4c9161[_0xd42c('0x46')][_0xd42c('0x51')]+'%'};return _0x26d7e6;})});}_0x466d32=_[_0xd42c('0x52')]({},_0x466d32,_0x4c9161[_0xd42c('0x68')]);return _0x54d4a1['getApplications'](_0x466d32);}})[_0xd42c('0x24')](function(_0x327437){if(_0x327437){_0x5d293d=_0x327437['length'];if(!_0x4c9161['query'][_0xd42c('0x4c')](_0xd42c('0x70'))){_0x466d32['limit']=qs[_0xd42c('0x33')](_0x4c9161['query']['limit']);_0x466d32[_0xd42c('0x32')]=qs['offset'](_0x4c9161[_0xd42c('0x46')]['offset']);}return _0x54d4a1[_0xd42c('0x86')](_0x466d32);}})[_0xd42c('0x24')](function(_0x1127f4){if(_0x1127f4){return _0x1127f4?{'count':_0x5d293d,'rows':_0x1127f4}:null;}})[_0xd42c('0x24')](respondWithResult(_0x49afdb,null))[_0xd42c('0x2c')](handleError(_0x49afdb,null));};exports[_0xd42c('0x87')]=function(_0x4eb395,_0x662b5c,_0x16d55c){var _0x255bda={'channel':'whatsapp'};var _0x5e24e5=[];var _0x17021f=[];var _0x10e557={};return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x4eb395['params']['id']},'include':[{'model':db[_0xd42c('0x81')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x662b5c,null))[_0xd42c('0x24')](function(_0x5a3864){_0x255bda[_0xd42c('0x88')]=_0x5a3864;if(_0x255bda[_0xd42c('0x88')]&&_0x255bda[_0xd42c('0x88')][_0xd42c('0x43')]===_0xd42c('0x89')&&_0x4eb395[_0xd42c('0x5d')]['statuses']){if(_0x4eb395[_0xd42c('0x5d')]['statuses'][_0xd42c('0x4b')]===0x0)return;if(_0x4eb395['body']['statuses'][0x0][_0xd42c('0x8a')]!==_0xd42c('0x8b'))return;return db[_0xd42c('0x8c')][_0xd42c('0x38')]({'read':!![],'readAt':_0x4eb395['body'][_0xd42c('0x8d')][0x0]['timestamp']},{'where':{'messageId':_0x4eb395[_0xd42c('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x329ea9){return _0x662b5c['status'](0xc8)['json'](_0x329ea9);});}_0x255bda[_0xd42c('0x8e')]=_[_0xd42c('0x8f')](_0x5a3864[_0xd42c('0x90')],[_0xd42c('0x83')],[_0xd42c('0x91')]);if(_0x255bda[_0xd42c('0x88')][_0xd42c('0x90')]){delete _0x255bda[_0xd42c('0x88')][_0xd42c('0x90')];}return db[_0xd42c('0x92')][_0xd42c('0x93')]()[_0xd42c('0x24')](function(_0x4dee66){if(!_0x4dee66){throw new db[(_0xd42c('0x94'))][(_0xd42c('0x95'))]('no\x20available\x20attributes');}_0x5e24e5=_[_0xd42c('0x96')](_[_0xd42c('0x47')](_0x4dee66),[_0xd42c('0x97'),_0xd42c('0x98')]);_0x17021f=_[_0xd42c('0x96')](_['keys'](_0x4dee66),[_0xd42c('0x97'),_0xd42c('0x98'),_0xd42c('0x99'),_0xd42c('0x9a')]);_0x255bda[_0xd42c('0x5d')]={'mapKey':'mobile'};if(_0x255bda['account']&&_0x255bda[_0xd42c('0x88')]['type']===_0xd42c('0x9b')){_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')]=_0x4eb395['body'][_0xd42c('0x9d')][_0xd42c('0x9e')](_0xd42c('0x9f'),'');_0x255bda[_0xd42c('0x5d')][_0xd42c('0x5d')]=_0x4eb395[_0xd42c('0x5d')][_0xd42c('0xa0')];_0x255bda[_0xd42c('0x5d')][_0xd42c('0xa1')]=_0x4eb395[_0xd42c('0x5d')]['MessageSid'];}if(_0x255bda[_0xd42c('0x88')]&&_0x255bda[_0xd42c('0x88')][_0xd42c('0x43')]==='sinch'){_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')]=_0x4eb395[_0xd42c('0x5d')][_0xd42c('0xa2')][0x0][_0xd42c('0x9c')];_0x255bda[_0xd42c('0x5d')]['body']=_0x4eb395['body']['notifications'][0x0][_0xd42c('0x2a')]['body'];_0x255bda[_0xd42c('0x5d')][_0xd42c('0xa1')]=_0x4eb395[_0xd42c('0x5d')][_0xd42c('0xa2')][0x0][_0xd42c('0xa3')];}if(_0x255bda['body']['id']){delete _0x255bda[_0xd42c('0x5d')]['id'];}if(_[_0xd42c('0xa4')](_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')])){throw new db[(_0xd42c('0x94'))]['ValidationError'](_0xd42c('0xa5'));}if(_['isNil'](_0x255bda[_0xd42c('0x5d')][_0xd42c('0x5d')])||_0x255bda[_0xd42c('0x5d')]['body']===''){throw new db[(_0xd42c('0x94'))][(_0xd42c('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd42c('0xa4')](_0x255bda[_0xd42c('0x5d')]['mapKey'])){throw new db[(_0xd42c('0x94'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17021f);}if(!_[_0xd42c('0xa6')](_0x17021f,_0x255bda[_0xd42c('0x5d')][_0xd42c('0xa7')])){throw new db[(_0xd42c('0x94'))][(_0xd42c('0x95'))](_0xd42c('0xa8')+_0x17021f);}_0x10e557[_0x255bda[_0xd42c('0x5d')][_0xd42c('0xa7')]]=_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')];return db[_0xd42c('0xa9')][_0xd42c('0x5b')]({'where':{'id':_0x255bda[_0xd42c('0x88')][_0xd42c('0x9a')]},'include':[{'model':db['CmContact'],'as':_0xd42c('0xaa'),'where':_0x10e557,'limit':0x1,'order':[['updatedAt',_0xd42c('0xab')]]}]});})[_0xd42c('0x24')](handleEntityNotFound(_0x662b5c,null))['then'](function(_0x4dd8f0){if(_0x4dd8f0){_0x255bda[_0xd42c('0xac')]=_[_0xd42c('0x73')](_0x4dd8f0,[_0xd42c('0xaa')]);if(_0x4dd8f0['Contacts']['length']){return _0x4dd8f0[_0xd42c('0xaa')][0x0];}var _0x4c1355=_[_0xd42c('0x1b')](_0x255bda['body'],{'firstName':_0x255bda['body']['from'],'ListId':_0x4dd8f0['id']});_0x4c1355[_0x255bda['body'][_0xd42c('0xa7')]]=_0x255bda['body'][_0xd42c('0x9c')];return db[_0xd42c('0x92')]['create'](_0x4c1355,{'fields':_0x5e24e5,'raw':!![]});}})[_0xd42c('0x24')](handleEntityNotFound(_0x662b5c,null))['then'](function(_0x2791bf){if(_0x2791bf){_0x255bda[_0xd42c('0xad')]=_0x2791bf;var _0x177474={'ContactId':_0x2791bf['id'],'phone':_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')],'WhatsappAccountId':_0x4eb395['params']['id']};var _0x4f6789={'ContactId':_0x2791bf['id'],'WhatsappAccountId':_0x4eb395[_0xd42c('0x57')]['id'],'closed':![]};return db[_0xd42c('0xae')]['find']({'where':_0x4f6789})[_0xd42c('0x24')](function(_0x3797c5){if(_0x3797c5){return[_0x3797c5,![]];}return db[_0xd42c('0xae')]['create'](_0x177474)[_0xd42c('0x24')](function(_0x266a77){return[_0x266a77,!![]];});});}})[_0xd42c('0x74')](function(_0x3ca30d,_0x1ec88b){_0x255bda[_0xd42c('0xaf')]=_0x3ca30d['get']({'plain':!![]});_0x255bda[_0xd42c('0xaf')][_0xd42c('0xb0')]=![];if(_0x1ec88b){if(_0x255bda[_0xd42c('0x88')]['autoclose']){_0x255bda['applications'][_0xd42c('0xb1')]({'id':0x0,'priority':_0x255bda[_0xd42c('0x8e')][_0xd42c('0x4b')]+0x1,'app':'close','appdata':_0xd42c('0xb2'),'interval':'*,*,*,*'});}_0x255bda['interaction'][_0xd42c('0xb0')]=!![];}return db[_0xd42c('0x8c')][_0xd42c('0x5c')]({'phone':_0x255bda[_0xd42c('0x5d')][_0xd42c('0x9c')],'messageId':_0x255bda[_0xd42c('0x5d')][_0xd42c('0xa1')],'body':_0x255bda['body'][_0xd42c('0x5d')],'WhatsappAccountId':_0x4eb395['params']['id'],'WhatsappInteractionId':_0x3ca30d['id'],'direction':'in','ContactId':_0x3ca30d['ContactId'],'AttachmentId':_0x255bda['body'][_0xd42c('0xb3')]});})[_0xd42c('0x24')](function(_0x5a3d07){_0x255bda[_0xd42c('0x2a')]=_0x5a3d07;if(!_0x255bda[_0xd42c('0xaf')][_0xd42c('0xb4')])return;return db[_0xd42c('0x7a')][_0xd42c('0x5b')]({'attributes':['id',_0xd42c('0x3c')],'where':{'id':_0x255bda[_0xd42c('0xaf')]['UserId']}});})['then'](function(_0x18a908){if(_0x18a908){_0x255bda['applications'][_0xd42c('0xb5')]({'id':0x0,'priority':0x0,'app':_0xd42c('0xb6'),'appdata':_0x18a908[_0xd42c('0x3c')]+','+(_0x255bda[_0xd42c('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0xd42c('0xb7')});}if(!_0x255bda[_0xd42c('0xaf')][_0xd42c('0xb8')])return;return db[_0xd42c('0xb9')][_0xd42c('0x5b')]({'attributes':['id',_0xd42c('0x3c')],'where':{'id':_0x255bda['interaction'][_0xd42c('0xb8')]}});})[_0xd42c('0x24')](function(_0x30a9f9){if(_0x30a9f9){_0x255bda[_0xd42c('0x8e')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd42c('0xba'),'appdata':_0x30a9f9[_0xd42c('0x3c')]+','+(_0x255bda[_0xd42c('0x88')][_0xd42c('0xbb')]||0x12c),'interval':_0xd42c('0xb7')});}return respondWithRpcPromise(_0xd42c('0xbc'),'startRouting',_0x255bda);})[_0xd42c('0x24')](function(_0xc88cd4){if(_0xc88cd4){var _0x52b475=0xc8;var _0x39d4fe=_0xd42c('0xbd');logger[_0xd42c('0xbe')](_0xd42c('0xbf'),_0x39d4fe,_0x52b475,_0xd42c('0xc0'));logger['debug'](_0xd42c('0xc1'),_0x39d4fe,_0x52b475,_0xd42c('0xc0'),JSON['stringify'](_0xc88cd4));if(_0x255bda[_0xd42c('0x88')][_0xd42c('0x43')]===_0xd42c('0x9b')){return _0x662b5c['status'](_0x52b475)['set'](_0xd42c('0xc2'),_0xd42c('0xc3'))['send'](_0xd42c('0xc4'));}else{return _0x662b5c[_0xd42c('0x34')](_0x52b475)[_0xd42c('0x2f')](_0xc88cd4);}}});})[_0xd42c('0x2c')](handleError(_0x662b5c,null));};exports[_0xd42c('0x85')]=function(_0x2bb169,_0x57b125,_0x26baee){var _0x234f50,_0xde3afe,_0x48fa5d;if(_['isNil'](_0x2bb169['body']['body'])||_0x2bb169[_0xd42c('0x5d')][_0xd42c('0x5d')]===''){throw new db[(_0xd42c('0x94'))]['ValidationError'](_0xd42c('0xc5'));}if(_[_0xd42c('0xa4')](_0x2bb169['body']['to'])){throw new db[(_0xd42c('0x94'))][(_0xd42c('0x95'))](_0xd42c('0xc6'));}_0x234f50=_0x2bb169[_0xd42c('0x5d')]['to'];return db[_0xd42c('0x40')][_0xd42c('0x5b')]({'where':{'id':_0x2bb169[_0xd42c('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd42c('0x92')],'as':_0xd42c('0xaa'),'where':{'mobile':_0x234f50},'limit':0x1,'order':[[_0xd42c('0x98'),_0xd42c('0xab')]]}]}]})[_0xd42c('0x24')](handleEntityNotFound(_0x57b125,null))['then'](function(_0x52bba7){if(_0x52bba7&&_0x52bba7['List']){_0xde3afe=_0x52bba7[_0xd42c('0x3a')]({'plain':!![]});if(_0xde3afe[_0xd42c('0xc7')]&&_0xde3afe[_0xd42c('0xc7')][_0xd42c('0xaa')][_0xd42c('0x4b')]){return _0xde3afe[_0xd42c('0xc7')][_0xd42c('0xaa')][0x0];}return db[_0xd42c('0x92')][_0xd42c('0x5c')](_[_0xd42c('0x1b')](_0x2bb169[_0xd42c('0x5d')],{'firstName':_0x234f50,'mobile':_0x234f50,'phone':_0x234f50,'ListId':_0xde3afe['ListId']}));}})[_0xd42c('0x24')](handleEntityNotFound(_0x57b125,null))[_0xd42c('0x24')](function(_0x335222){if(_0x335222){_0x48fa5d=_0x335222;return db[_0xd42c('0xae')]['find']({'where':{'ContactId':_0x48fa5d['id'],'closed':![],'WhatsappAccountId':_0xde3afe['id']}})['then'](function(_0x208606){if(_0x208606){return[_0x208606,![]];}return db[_0xd42c('0xae')][_0xd42c('0x5c')]({'UserId':_0x2bb169[_0xd42c('0x5e')]['id'],'ContactId':_0x48fa5d['id'],'WhatsappAccountId':_0xde3afe['id'],'phone':_0x234f50,'firstMsgDirection':_0xd42c('0xc8'),'Messages':[_[_0xd42c('0x52')](_0x2bb169[_0xd42c('0x5d')],{'read':![],'body':_0x2bb169[_0xd42c('0x5d')][_0xd42c('0x5d')],'phone':_0x234f50,'WhatsappAccountId':_0xde3afe['id'],'UserId':_0x2bb169[_0xd42c('0x5e')]['id'],'ContactId':_0x48fa5d['id']})]},{'include':[{'model':db[_0xd42c('0x8c')],'as':_0xd42c('0xc9')}]})[_0xd42c('0x24')](function(_0x139c9f){return[_0x139c9f,!![]];});});}})[_0xd42c('0x74')](function(_0x34d195,_0x2dc546){if(_0x2dc546){return _0x34d195;}return db['WhatsappMessage'][_0xd42c('0x5c')](_['merge'](_0x2bb169[_0xd42c('0x5d')],{'read':![],'body':_0x2bb169[_0xd42c('0x5d')]['body'],'phone':_0x234f50,'WhatsappAccountId':_0xde3afe['id'],'WhatsappInteractionId':_0x34d195['id'],'UserId':_0x2bb169[_0xd42c('0x5e')]['id'],'ContactId':_0x48fa5d['id']}))[_0xd42c('0x24')](function(_0xa6e1c8){_0x34d195['dataValues'][_0xd42c('0xc9')]=[];_0x34d195[_0xd42c('0xca')][_0xd42c('0xc9')][_0xd42c('0xb1')](_0xa6e1c8[_0xd42c('0xca')]);return _0x34d195;});})[_0xd42c('0x24')](respondWithResult(_0x57b125,null))[_0xd42c('0x2c')](handleError(_0x57b125,null));}; \ No newline at end of file +var _0x3b31=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','ids','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','read','timestamp','message_id','applications','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','list','interaction','created','autoclose','push','unmanaged','WhatsappMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','eml-format','rimraf','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5e4df1,_0x4b1516){var _0x51a3bc=function(_0x2e0600){while(--_0x2e0600){_0x5e4df1['push'](_0x5e4df1['shift']());}};_0x51a3bc(++_0x4b1516);}(_0x3b31,0x64));var _0x13b3=function(_0x3ccd46,_0x49ccc1){_0x3ccd46=_0x3ccd46-0x0;var _0x367eab=_0x3b31[_0x3ccd46];return _0x367eab;};'use strict';var emlformat=require(_0x13b3('0x0'));var rimraf=require(_0x13b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13b3('0x3'));var util=require(_0x13b3('0x4'));var path=require(_0x13b3('0x5'));var sox=require('sox');var csv=require(_0x13b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13b3('0x7'));var squel=require(_0x13b3('0x8'));var crypto=require(_0x13b3('0x9'));var jsforce=require(_0x13b3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x13b3('0x6'));var querystring=require(_0x13b3('0xb'));var Papa=require(_0x13b3('0xc'));var Redis=require(_0x13b3('0xd'));var authService=require(_0x13b3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13b3('0xf'));var logger=require(_0x13b3('0x10'))(_0x13b3('0x11'));var utils=require(_0x13b3('0x12'));var config=require(_0x13b3('0x13'));var licenseUtil=require(_0x13b3('0x14'));var db=require(_0x13b3('0x15'))['db'];config['redis']=_[_0x13b3('0x16')](config[_0x13b3('0x17')],{'host':_0x13b3('0x18'),'port':0x18eb});var socket=require(_0x13b3('0x19'))(new Redis(config[_0x13b3('0x17')]));require('./whatsappAccount.socket')[_0x13b3('0x1a')](socket);var jayson=require(_0x13b3('0x1b'));var client=jayson['client'][_0x13b3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2d40c2,_0x2326ed,_0x92a17d,_0x3dbe7a){return new BPromise(function(_0x3c4834,_0x416ebb){var _0x1cd762=_0x3dbe7a||client;return _0x1cd762[_0x13b3('0x1d')](_0x2d40c2,_0x92a17d)[_0x13b3('0x1e')](function(_0x1703c5){logger[_0x13b3('0x1f')](_0x13b3('0x20'),_0x2326ed,'request\x20sent');logger[_0x13b3('0x21')](_0x13b3('0x22'),_0x2326ed,_0x13b3('0x23'),JSON[_0x13b3('0x24')](_0x1703c5));if(_0x1703c5[_0x13b3('0x25')]){if(_0x1703c5['error'][_0x13b3('0x26')]===0x1f4){logger[_0x13b3('0x25')](_0x13b3('0x20'),_0x2326ed,_0x1703c5[_0x13b3('0x25')]['message']);return _0x416ebb(_0x1703c5[_0x13b3('0x25')][_0x13b3('0x27')]);}logger[_0x13b3('0x25')](_0x13b3('0x20'),_0x2326ed,_0x1703c5['error'][_0x13b3('0x27')]);return _0x3c4834(_0x1703c5[_0x13b3('0x25')]['message']);}else{logger[_0x13b3('0x1f')](_0x13b3('0x20'),_0x2326ed,_0x13b3('0x23'));_0x3c4834(_0x1703c5[_0x13b3('0x28')]['message']);}})['catch'](function(_0x582505){logger['error'](_0x13b3('0x20'),_0x2326ed,_0x582505);_0x416ebb(_0x582505);});});}function respondWithStatusCode(_0x385854,_0x23d5ad){_0x23d5ad=_0x23d5ad||0xcc;return function(_0x28fdaf){if(_0x28fdaf){return _0x385854[_0x13b3('0x29')](_0x23d5ad);}return _0x385854[_0x13b3('0x2a')](_0x23d5ad)[_0x13b3('0x2b')]();};}function respondWithResult(_0x592740,_0x5e8d82){_0x5e8d82=_0x5e8d82||0xc8;return function(_0x301079){if(_0x301079){return _0x592740[_0x13b3('0x2a')](_0x5e8d82)[_0x13b3('0x2c')](_0x301079);}};}function respondWithFilteredResult(_0x3f38c5,_0x25a269){return function(_0x563443){if(_0x563443){var _0x429dcf=typeof _0x25a269[_0x13b3('0x2d')]==='undefined'&&typeof _0x25a269[_0x13b3('0x2e')]===_0x13b3('0x2f');var _0x3ee56c=_0x563443[_0x13b3('0x30')];var _0x5babdc=_0x429dcf?0x0:_0x25a269[_0x13b3('0x2d')];var _0x43d4b4=_0x429dcf?_0x563443['count']:_0x25a269[_0x13b3('0x2d')]+_0x25a269[_0x13b3('0x2e')];var _0x2f3a10;if(_0x43d4b4>=_0x3ee56c){_0x43d4b4=_0x3ee56c;_0x2f3a10=0xc8;}else{_0x2f3a10=0xce;}_0x3f38c5[_0x13b3('0x2a')](_0x2f3a10);return _0x3f38c5[_0x13b3('0x31')]('Content-Range',_0x5babdc+'-'+_0x43d4b4+'/'+_0x3ee56c)[_0x13b3('0x2c')](_0x563443);}return null;};}function patchUpdates(_0x15d140){return function(_0x326bed){try{jsonpatch[_0x13b3('0x32')](_0x326bed,_0x15d140,!![]);}catch(_0x745ea9){return BPromise['reject'](_0x745ea9);}return _0x326bed['save']();};}function saveUpdates(_0x4f1142,_0xe7db7b){return function(_0x14906d){if(_0x14906d){return _0x14906d[_0x13b3('0x33')](_0x4f1142)[_0x13b3('0x1e')](function(_0x553321){return _0x553321;});}return null;};}function removeEntity(_0x55b3e2,_0x31feba){return function(_0x2fddc7){if(_0x2fddc7){return _0x2fddc7['destroy']()[_0x13b3('0x1e')](function(){var _0x178193=_0x2fddc7[_0x13b3('0x34')]({'plain':!![]});var _0x138589=_0x13b3('0x35');return db[_0x13b3('0x36')][_0x13b3('0x37')]({'where':{'type':_0x138589,'resourceId':_0x178193['id']}})[_0x13b3('0x1e')](function(){return _0x2fddc7;});})[_0x13b3('0x1e')](function(){_0x55b3e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x152fa5,_0x18df8b){return function(_0x397fe3){if(!_0x397fe3){_0x152fa5['sendStatus'](0x194);}return _0x397fe3;};}function handleError(_0x4459dd,_0x5a594b){_0x5a594b=_0x5a594b||0x1f4;return function(_0x492cb4){logger[_0x13b3('0x25')](_0x492cb4[_0x13b3('0x38')]);if(_0x492cb4[_0x13b3('0x39')]){delete _0x492cb4[_0x13b3('0x39')];}_0x4459dd[_0x13b3('0x2a')](_0x5a594b)[_0x13b3('0x3a')](_0x492cb4);};}exports['index']=function(_0x5bbcfc,_0x16039d){var _0x404858={'include':[{'model':db[_0x13b3('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4b6058={},_0x310c15={'count':0x0,'rows':[]};var _0x8fe834=_[_0x13b3('0x3c')](db[_0x13b3('0x3d')][_0x13b3('0x3e')],function(_0x3d6ec7){return{'name':_0x3d6ec7['fieldName'],'type':_0x3d6ec7[_0x13b3('0x3f')][_0x13b3('0x40')]};});_0x4b6058[_0x13b3('0x41')]=_[_0x13b3('0x3c')](_0x8fe834,_0x13b3('0x39'));_0x4b6058['query']=_[_0x13b3('0x42')](_0x5bbcfc[_0x13b3('0x43')]);_0x4b6058[_0x13b3('0x44')]=_[_0x13b3('0x45')](_0x4b6058[_0x13b3('0x41')],_0x4b6058['query']);_0x404858['attributes']=_[_0x13b3('0x45')](_0x4b6058[_0x13b3('0x41')],qs['fields'](_0x5bbcfc[_0x13b3('0x43')]['fields']));_0x404858[_0x13b3('0x46')]=_0x404858[_0x13b3('0x46')][_0x13b3('0x47')]?_0x404858[_0x13b3('0x46')]:_0x4b6058[_0x13b3('0x41')];if(!_0x5bbcfc[_0x13b3('0x43')][_0x13b3('0x48')](_0x13b3('0x49'))){_0x404858[_0x13b3('0x2e')]=qs[_0x13b3('0x2e')](_0x5bbcfc['query'][_0x13b3('0x2e')]);_0x404858[_0x13b3('0x2d')]=qs[_0x13b3('0x2d')](_0x5bbcfc[_0x13b3('0x43')]['offset']);}_0x404858[_0x13b3('0x4a')]=qs['sort'](_0x5bbcfc[_0x13b3('0x43')][_0x13b3('0x4b')]);_0x404858[_0x13b3('0x4c')]=qs[_0x13b3('0x44')](_['pick'](_0x5bbcfc[_0x13b3('0x43')],_0x4b6058[_0x13b3('0x44')]),_0x8fe834);if(_0x5bbcfc['query'][_0x13b3('0x4d')]){_0x404858[_0x13b3('0x4c')]=_[_0x13b3('0x4e')](_0x404858[_0x13b3('0x4c')],{'$or':_[_0x13b3('0x3c')](_0x8fe834,function(_0x5cd9b5){if(_0x5cd9b5[_0x13b3('0x3f')]!==_0x13b3('0x4f')){var _0x29b9a9={};_0x29b9a9[_0x5cd9b5[_0x13b3('0x39')]]={'$like':'%'+_0x5bbcfc[_0x13b3('0x43')][_0x13b3('0x4d')]+'%'};return _0x29b9a9;}})});}_0x404858=_['merge']({},_0x404858,_0x5bbcfc[_0x13b3('0x50')]);var _0xa97642={'where':_0x404858['where']};return db[_0x13b3('0x3d')][_0x13b3('0x30')](_0xa97642)[_0x13b3('0x1e')](function(_0x3e8079){_0x310c15[_0x13b3('0x30')]=_0x3e8079;if(_0x5bbcfc['query'][_0x13b3('0x51')]){_0x404858[_0x13b3('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x13b3('0x53')](_0x404858);})[_0x13b3('0x1e')](function(_0x22aab4){_0x310c15[_0x13b3('0x54')]=_0x22aab4;return _0x310c15;})[_0x13b3('0x1e')](respondWithFilteredResult(_0x16039d,_0x404858))['catch'](handleError(_0x16039d,null));};exports[_0x13b3('0x55')]=function(_0x3d6ed7,_0x11b4bf){var _0x54b46f={'raw':![],'where':{'id':_0x3d6ed7[_0x13b3('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x13b3('0x57')}]},_0x45a406={};_0x45a406[_0x13b3('0x41')]=_[_0x13b3('0x42')](db[_0x13b3('0x3d')][_0x13b3('0x3e')]);_0x45a406[_0x13b3('0x43')]=_['keys'](_0x3d6ed7[_0x13b3('0x43')]);_0x45a406['filters']=_[_0x13b3('0x45')](_0x45a406[_0x13b3('0x41')],_0x45a406[_0x13b3('0x43')]);_0x54b46f[_0x13b3('0x46')]=_[_0x13b3('0x45')](_0x45a406[_0x13b3('0x41')],qs[_0x13b3('0x58')](_0x3d6ed7['query'][_0x13b3('0x58')]));_0x54b46f[_0x13b3('0x46')]=_0x54b46f[_0x13b3('0x46')][_0x13b3('0x47')]?_0x54b46f[_0x13b3('0x46')]:_0x45a406[_0x13b3('0x41')];if(_0x3d6ed7[_0x13b3('0x43')][_0x13b3('0x51')]){_0x54b46f['include']=[{'all':!![]}];}_0x54b46f=_[_0x13b3('0x4e')]({},_0x54b46f,_0x3d6ed7[_0x13b3('0x50')]);return db[_0x13b3('0x3d')]['find'](_0x54b46f)[_0x13b3('0x1e')](handleEntityNotFound(_0x11b4bf,null))[_0x13b3('0x1e')](respondWithResult(_0x11b4bf,null))[_0x13b3('0x59')](handleError(_0x11b4bf,null));};exports[_0x13b3('0x5a')]=function(_0x207508,_0x2e0d37){return db[_0x13b3('0x3d')][_0x13b3('0x5a')](_0x207508[_0x13b3('0x5b')],{})[_0x13b3('0x1e')](function(_0xb2f334){var _0x6959cd=_0x207508[_0x13b3('0x5c')][_0x13b3('0x34')]({'plain':!![]});if(!_0x6959cd)throw new Error(_0x13b3('0x5d'));if(_0x6959cd['role']===_0x13b3('0x5c')){var _0x32183f=_0xb2f334[_0x13b3('0x34')]({'plain':!![]});var _0x1424f2='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x1424f2,'userProfileId':_0x6959cd['userProfileId']},'raw':!![]})['then'](function(_0x4bd2f6){if(_0x4bd2f6&&_0x4bd2f6[_0x13b3('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x32183f[_0x13b3('0x39')],'resourceId':_0x32183f['id'],'type':_0x4bd2f6['name'],'sectionId':_0x4bd2f6['id']},{})[_0x13b3('0x1e')](function(){return _0xb2f334;});}else{return _0xb2f334;}})[_0x13b3('0x59')](function(_0x442205){logger[_0x13b3('0x25')](_0x13b3('0x5f'),_0x442205);throw _0x442205;});}return _0xb2f334;})[_0x13b3('0x1e')](respondWithResult(_0x2e0d37,0xc9))['catch'](handleError(_0x2e0d37,null));};exports[_0x13b3('0x33')]=function(_0x1cdb27,_0x57d8bb){if(_0x1cdb27['body']['id']){delete _0x1cdb27['body']['id'];}return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x1cdb27[_0x13b3('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x13b3('0x57')}]})[_0x13b3('0x1e')](handleEntityNotFound(_0x57d8bb,null))[_0x13b3('0x1e')](saveUpdates(_0x1cdb27['body'],null))['then'](respondWithResult(_0x57d8bb,null))[_0x13b3('0x59')](handleError(_0x57d8bb,null));};exports['destroy']=function(_0x3afe10,_0x1cae1d){return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x3afe10[_0x13b3('0x56')]['id']}})['then'](handleEntityNotFound(_0x1cae1d,null))[_0x13b3('0x1e')](removeEntity(_0x1cae1d,null))['catch'](handleError(_0x1cae1d,null));};exports[_0x13b3('0x61')]=function(_0xd3de2b,_0x596d63){return db[_0x13b3('0x3d')][_0x13b3('0x61')]()[_0x13b3('0x1e')](respondWithResult(_0x596d63,null))[_0x13b3('0x59')](handleError(_0x596d63,null));};exports[_0x13b3('0x62')]=function(_0x476390,_0x39a37d,_0x3e1d62){if(_0x476390[_0x13b3('0x5b')]['id']){delete _0x476390[_0x13b3('0x5b')]['id'];}return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x476390[_0x13b3('0x56')]['id']}})['then'](handleEntityNotFound(_0x39a37d,null))[_0x13b3('0x1e')](function(_0x43192d){if(_0x43192d){_0x476390[_0x13b3('0x5b')][_0x13b3('0x63')]=_0x43192d['id'];return db[_0x13b3('0x64')][_0x13b3('0x5a')](_0x476390[_0x13b3('0x5b')]);}})[_0x13b3('0x1e')](respondWithResult(_0x39a37d,null))[_0x13b3('0x59')](handleError(_0x39a37d,null));};exports[_0x13b3('0x65')]=function(_0x2d5759,_0x1d7351,_0x870c00){var _0x2cc13c={'raw':![],'where':{}};var _0x2cf7a9={};var _0x53a223={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x13b3('0x66')]({'where':{'id':_0x2d5759[_0x13b3('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d7351,null))[_0x13b3('0x1e')](function(_0x29ba8d){if(_0x29ba8d){_0x2cf7a9[_0x13b3('0x41')]=_[_0x13b3('0x42')](db[_0x13b3('0x64')][_0x13b3('0x3e')]);_0x2cf7a9[_0x13b3('0x43')]=_[_0x13b3('0x42')](_0x2d5759['query']);_0x2cf7a9[_0x13b3('0x44')]=_[_0x13b3('0x45')](_0x2cf7a9['model'],_0x2cf7a9[_0x13b3('0x43')]);_0x2cc13c['attributes']=_[_0x13b3('0x45')](_0x2cf7a9['model'],qs['fields'](_0x2d5759[_0x13b3('0x43')]['fields']));_0x2cc13c[_0x13b3('0x46')]=_0x2cc13c[_0x13b3('0x46')]['length']?_0x2cc13c[_0x13b3('0x46')]:_0x2cf7a9[_0x13b3('0x41')];if(!_0x2d5759['query']['hasOwnProperty'](_0x13b3('0x49'))){_0x2cc13c['limit']=qs[_0x13b3('0x2e')](_0x2d5759[_0x13b3('0x43')]['limit']);_0x2cc13c[_0x13b3('0x2d')]=qs[_0x13b3('0x2d')](_0x2d5759[_0x13b3('0x43')][_0x13b3('0x2d')]);}_0x2cc13c[_0x13b3('0x4a')]=qs['sort'](_0x2d5759['query'][_0x13b3('0x4b')]);_0x2cc13c[_0x13b3('0x4c')]=qs[_0x13b3('0x44')](_[_0x13b3('0x67')](_0x2d5759[_0x13b3('0x43')],_0x2cf7a9[_0x13b3('0x44')]));_0x2cc13c[_0x13b3('0x4c')]['WhatsappAccountId']=_0x29ba8d['id'];if(_0x2d5759['query'][_0x13b3('0x4d')]){_0x2cc13c[_0x13b3('0x4c')]=_[_0x13b3('0x4e')](_0x2cc13c['where'],{'$or':_[_0x13b3('0x3c')](_0x2cc13c[_0x13b3('0x46')],function(_0x5e565a){var _0x41f576={};_0x41f576[_0x5e565a]={'$like':'%'+_0x2d5759[_0x13b3('0x43')][_0x13b3('0x4d')]+'%'};return _0x41f576;})});}_0x2cc13c=_[_0x13b3('0x4e')]({},_0x2cc13c,_0x2d5759['options']);return db[_0x13b3('0x64')]['count']({'where':_0x2cc13c[_0x13b3('0x4c')]})['then'](function(_0x5eb4ee){_0x53a223[_0x13b3('0x30')]=_0x5eb4ee;if(_0x2d5759[_0x13b3('0x43')][_0x13b3('0x51')]){_0x2cc13c['include']=[{'all':!![]}];}return db[_0x13b3('0x64')][_0x13b3('0x53')](_0x2cc13c);})[_0x13b3('0x1e')](function(_0x43ff56){_0x53a223['rows']=_0x43ff56;return _0x53a223;});}})['then'](respondWithFilteredResult(_0x1d7351,_0x2cc13c))[_0x13b3('0x59')](handleError(_0x1d7351,null));};exports['removeDispositions']=function(_0x2e45ef,_0x579ea7,_0x1003a1){return db['WhatsappAccount'][_0x13b3('0x60')]({'where':{'id':_0x2e45ef[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x579ea7,null))[_0x13b3('0x1e')](function(_0x3bbcd2){if(_0x3bbcd2){return _0x3bbcd2[_0x13b3('0x68')](_0x2e45ef[_0x13b3('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x579ea7,null))['catch'](handleError(_0x579ea7,null));};exports[_0x13b3('0x69')]=function(_0xd145f4,_0xa1c32d,_0x4bb245){if(_0xd145f4[_0x13b3('0x5b')]['id']){delete _0xd145f4['body']['id'];}return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0xd145f4[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0xa1c32d,null))[_0x13b3('0x1e')](function(_0xce75f0){if(_0xce75f0){_0xd145f4[_0x13b3('0x5b')][_0x13b3('0x63')]=_0xce75f0['id'];return db[_0x13b3('0x6a')][_0x13b3('0x5a')](_0xd145f4[_0x13b3('0x5b')]);}})['then'](respondWithResult(_0xa1c32d,null))['catch'](handleError(_0xa1c32d,null));};exports[_0x13b3('0x6b')]=function(_0x1af2e2,_0x259163,_0x2771b7){var _0x11da63={'raw':![],'where':{}};var _0x545dfe={};var _0xf16fde={'count':0x0,'rows':[]};return db[_0x13b3('0x3d')]['findOne']({'where':{'id':_0x1af2e2[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x259163,null))['then'](function(_0x19e7b0){if(_0x19e7b0){_0x545dfe[_0x13b3('0x41')]=_[_0x13b3('0x42')](db['CannedAnswer'][_0x13b3('0x3e')]);_0x545dfe[_0x13b3('0x43')]=_[_0x13b3('0x42')](_0x1af2e2[_0x13b3('0x43')]);_0x545dfe[_0x13b3('0x44')]=_[_0x13b3('0x45')](_0x545dfe[_0x13b3('0x41')],_0x545dfe['query']);_0x11da63['attributes']=_[_0x13b3('0x45')](_0x545dfe['model'],qs[_0x13b3('0x58')](_0x1af2e2[_0x13b3('0x43')][_0x13b3('0x58')]));_0x11da63[_0x13b3('0x46')]=_0x11da63[_0x13b3('0x46')][_0x13b3('0x47')]?_0x11da63['attributes']:_0x545dfe[_0x13b3('0x41')];if(!_0x1af2e2[_0x13b3('0x43')][_0x13b3('0x48')](_0x13b3('0x49'))){_0x11da63[_0x13b3('0x2e')]=qs[_0x13b3('0x2e')](_0x1af2e2[_0x13b3('0x43')][_0x13b3('0x2e')]);_0x11da63[_0x13b3('0x2d')]=qs[_0x13b3('0x2d')](_0x1af2e2['query']['offset']);}_0x11da63[_0x13b3('0x4a')]=qs[_0x13b3('0x4b')](_0x1af2e2['query']['sort']);_0x11da63['where']=qs[_0x13b3('0x44')](_[_0x13b3('0x67')](_0x1af2e2['query'],_0x545dfe[_0x13b3('0x44')]));_0x11da63[_0x13b3('0x4c')][_0x13b3('0x63')]=_0x19e7b0['id'];if(_0x1af2e2[_0x13b3('0x43')][_0x13b3('0x4d')]){_0x11da63['where']=_[_0x13b3('0x4e')](_0x11da63[_0x13b3('0x4c')],{'$or':_[_0x13b3('0x3c')](_0x11da63[_0x13b3('0x46')],function(_0x48f526){var _0x5c25e4={};_0x5c25e4[_0x48f526]={'$like':'%'+_0x1af2e2[_0x13b3('0x43')]['filter']+'%'};return _0x5c25e4;})});}_0x11da63=_[_0x13b3('0x4e')]({},_0x11da63,_0x1af2e2[_0x13b3('0x50')]);return db[_0x13b3('0x6a')][_0x13b3('0x30')]({'where':_0x11da63['where']})[_0x13b3('0x1e')](function(_0x185c07){_0xf16fde[_0x13b3('0x30')]=_0x185c07;if(_0x1af2e2[_0x13b3('0x43')]['includeAll']){_0x11da63['include']=[{'all':!![]}];}return db[_0x13b3('0x6a')][_0x13b3('0x53')](_0x11da63);})['then'](function(_0x8d257d){_0xf16fde[_0x13b3('0x54')]=_0x8d257d;return _0xf16fde;});}})['then'](respondWithFilteredResult(_0x259163,_0x11da63))['catch'](handleError(_0x259163,null));};exports[_0x13b3('0x6c')]=function(_0xd9151,_0x2b9e74,_0x3740dc){return db[_0x13b3('0x3d')]['find']({'where':{'id':_0xd9151['params']['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x2b9e74,null))[_0x13b3('0x1e')](function(_0x46f7d2){if(_0x46f7d2){return _0x46f7d2[_0x13b3('0x6c')](_0xd9151[_0x13b3('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x2b9e74,null))['catch'](handleError(_0x2b9e74,null));};exports['addAgents']=function(_0x5a8386,_0x50bcbf,_0x12db38){return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x5a8386[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x50bcbf,null))[_0x13b3('0x1e')](function(_0x4a082c){if(_0x4a082c){return _0x4a082c[_0x13b3('0x6d')](_0x5a8386[_0x13b3('0x5b')]['ids'],_[_0x13b3('0x6e')](_0x5a8386[_0x13b3('0x5b')],[_0x13b3('0x6f'),'id'])||{})[_0x13b3('0x70')](function(_0x3e3325){for(var _0x284a3a=0x0;_0x284a3a<_0x5a8386[_0x13b3('0x5b')]['ids'][_0x13b3('0x47')];_0x284a3a+=0x1){socket['emit'](_0x13b3('0x71'),{'UserId':Number(_0x5a8386[_0x13b3('0x5b')][_0x13b3('0x6f')][_0x284a3a]),'WhatsappAccountId':Number(_0x5a8386[_0x13b3('0x56')]['id'])});}return _0x3e3325;});}})[_0x13b3('0x1e')](respondWithResult(_0x50bcbf,null))[_0x13b3('0x59')](handleError(_0x50bcbf,null));};exports[_0x13b3('0x72')]=function(_0x47d957,_0x429bab,_0x1b2a63){return db[_0x13b3('0x3d')]['find']({'where':{'id':_0x47d957[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x429bab,null))[_0x13b3('0x1e')](function(_0x8e26ef){if(_0x8e26ef){return _0x8e26ef[_0x13b3('0x72')](_0x47d957['query'][_0x13b3('0x6f')])['then'](function(){if(_[_0x13b3('0x73')](_0x47d957[_0x13b3('0x43')][_0x13b3('0x6f')])){for(var _0xaae371=0x0;_0xaae371<_0x47d957[_0x13b3('0x43')][_0x13b3('0x6f')][_0x13b3('0x47')];_0xaae371+=0x1){socket[_0x13b3('0x74')](_0x13b3('0x75'),{'UserId':Number(_0x47d957[_0x13b3('0x43')][_0x13b3('0x6f')][_0xaae371]),'WhatsappAccountId':Number(_0x47d957[_0x13b3('0x56')]['id'])});}}else{socket[_0x13b3('0x74')](_0x13b3('0x75'),{'UserId':Number(_0x47d957[_0x13b3('0x43')][_0x13b3('0x6f')]),'WhatsappAccountId':Number(_0x47d957[_0x13b3('0x56')]['id'])});}});}})[_0x13b3('0x1e')](respondWithStatusCode(_0x429bab,null))[_0x13b3('0x59')](handleError(_0x429bab,null));};exports[_0x13b3('0x76')]=function(_0x291795,_0x329071,_0x4ced13){var _0x413a13={};var _0x337bc5={};var _0x46899b;var _0xa75f7e;return db['WhatsappAccount']['findOne']({'where':{'id':_0x291795[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x329071,null))['then'](function(_0x410579){if(_0x410579){_0x46899b=_0x410579;_0x337bc5[_0x13b3('0x41')]=_[_0x13b3('0x42')](db['User']['rawAttributes']);_0x337bc5[_0x13b3('0x43')]=_[_0x13b3('0x42')](_0x291795['query']);_0x337bc5[_0x13b3('0x44')]=_[_0x13b3('0x45')](_0x337bc5[_0x13b3('0x41')],_0x337bc5[_0x13b3('0x43')]);_0x413a13[_0x13b3('0x46')]=_[_0x13b3('0x45')](_0x337bc5['model'],qs[_0x13b3('0x58')](_0x291795[_0x13b3('0x43')][_0x13b3('0x58')]));_0x413a13[_0x13b3('0x46')]=_0x413a13[_0x13b3('0x46')]['length']?_0x413a13[_0x13b3('0x46')]:_0x337bc5['model'];_0x413a13[_0x13b3('0x4a')]=qs[_0x13b3('0x4b')](_0x291795[_0x13b3('0x43')][_0x13b3('0x4b')]);_0x413a13[_0x13b3('0x4c')]=qs['filters'](_[_0x13b3('0x67')](_0x291795[_0x13b3('0x43')],_0x337bc5[_0x13b3('0x44')]));if(_0x291795[_0x13b3('0x43')][_0x13b3('0x4d')]){_0x413a13[_0x13b3('0x4c')]=_[_0x13b3('0x4e')](_0x413a13[_0x13b3('0x4c')],{'$or':_[_0x13b3('0x3c')](_0x413a13[_0x13b3('0x46')],function(_0x34930c){var _0x5c3b72={};_0x5c3b72[_0x34930c]={'$like':'%'+_0x291795[_0x13b3('0x43')]['filter']+'%'};return _0x5c3b72;})});}_0x413a13=_['merge']({},_0x413a13,_0x291795[_0x13b3('0x50')]);return _0x46899b[_0x13b3('0x76')](_0x413a13);}})[_0x13b3('0x1e')](function(_0xcb1769){if(_0xcb1769){_0xa75f7e=_0xcb1769[_0x13b3('0x47')];if(!_0x291795[_0x13b3('0x43')][_0x13b3('0x48')]('nolimit')){_0x413a13[_0x13b3('0x2e')]=qs[_0x13b3('0x2e')](_0x291795[_0x13b3('0x43')][_0x13b3('0x2e')]);_0x413a13[_0x13b3('0x2d')]=qs['offset'](_0x291795[_0x13b3('0x43')]['offset']);}return _0x46899b['getAgents'](_0x413a13);}})[_0x13b3('0x1e')](function(_0x20b563){if(_0x20b563){return _0x20b563?{'count':_0xa75f7e,'rows':_0x20b563}:null;}})[_0x13b3('0x1e')](respondWithResult(_0x329071,null))['catch'](handleError(_0x329071,null));};exports['addApplications']=function(_0x4629eb,_0x63ccc6){var _0x3aded8=_0x4629eb[_0x13b3('0x56')]['id'];var _0x18b920=_0x4629eb['body'];var _0xe27908=0xc8;var _0x565aec=null;return db[_0x13b3('0x77')][_0x13b3('0x78')]({'isolationLevel':db[_0x13b3('0x77')][_0x13b3('0x79')][_0x13b3('0x7a')][_0x13b3('0x7b')]},function(_0x644e7){return db[_0x13b3('0x3d')]['findOne']({'where':{'id':_0x3aded8},'transaction':_0x644e7})[_0x13b3('0x1e')](function(_0x44311d){if(_0x44311d){return db[_0x13b3('0x7c')][_0x13b3('0x37')]({'where':{'WhatsappAccountId':_0x3aded8},'transaction':_0x644e7})['then'](function(){var _0x1106f4=_[_0x13b3('0x3c')](_0x18b920,function(_0x17b014){_0x17b014[_0x13b3('0x63')]=_0x3aded8;return _0x17b014;});return db[_0x13b3('0x7c')][_0x13b3('0x7d')](_0x1106f4,{'transaction':_0x644e7});});}else{_0xe27908=0x194;_0x565aec=[];}});})[_0x13b3('0x1e')](function(){if(_0xe27908!==0x194){return db['WhatsappApplication'][_0x13b3('0x7e')]({'where':{'WhatsappAccountId':_0x3aded8},'order':_0x13b3('0x7f')})['then'](function(_0x438c1f){_0x565aec=_0x438c1f;});}})[_0x13b3('0x59')](function(_0x35d2c6){_0xe27908=0x1f4;logger[_0x13b3('0x25')](_0x35d2c6['stack']);if(_0x35d2c6[_0x13b3('0x39')]){delete _0x35d2c6[_0x13b3('0x39')];}_0x565aec=_0x35d2c6;})[_0x13b3('0x80')](function(){if(_0x565aec===null){_0x63ccc6[_0x13b3('0x29')](_0xe27908);}else{if(_0xe27908===0x1f4){_0x63ccc6[_0x13b3('0x2a')](_0xe27908)[_0x13b3('0x3a')](_0x565aec);}else{_0x63ccc6[_0x13b3('0x2a')](_0xe27908)[_0x13b3('0x2c')](_0x565aec);}}});};exports[_0x13b3('0x81')]=function(_0x4c6a0b,_0x3fd822,_0x528d72){var _0x42ed99={};var _0x1e4789={};var _0x1700cd;var _0x3fbef0;return db[_0x13b3('0x3d')][_0x13b3('0x66')]({'where':{'id':_0x4c6a0b[_0x13b3('0x56')]['id']}})[_0x13b3('0x1e')](handleEntityNotFound(_0x3fd822,null))[_0x13b3('0x1e')](function(_0x29bda3){if(_0x29bda3){_0x1700cd=_0x29bda3;_0x1e4789[_0x13b3('0x41')]=_[_0x13b3('0x42')](db[_0x13b3('0x7c')][_0x13b3('0x3e')]);_0x1e4789[_0x13b3('0x43')]=_[_0x13b3('0x42')](_0x4c6a0b[_0x13b3('0x43')]);_0x1e4789[_0x13b3('0x44')]=_[_0x13b3('0x45')](_0x1e4789[_0x13b3('0x41')],_0x1e4789[_0x13b3('0x43')]);_0x42ed99[_0x13b3('0x46')]=_['intersection'](_0x1e4789[_0x13b3('0x41')],qs[_0x13b3('0x58')](_0x4c6a0b[_0x13b3('0x43')][_0x13b3('0x58')]));_0x42ed99[_0x13b3('0x46')]=_0x42ed99[_0x13b3('0x46')]['length']?_0x42ed99[_0x13b3('0x46')]:_0x1e4789[_0x13b3('0x41')];_0x42ed99['order']=qs[_0x13b3('0x4b')](_0x4c6a0b[_0x13b3('0x43')][_0x13b3('0x4b')]);_0x42ed99['where']=qs['filters'](_['pick'](_0x4c6a0b['query'],_0x1e4789[_0x13b3('0x44')]));if(_0x4c6a0b[_0x13b3('0x43')][_0x13b3('0x4d')]){_0x42ed99[_0x13b3('0x4c')]=_['merge'](_0x42ed99[_0x13b3('0x4c')],{'$or':_[_0x13b3('0x3c')](_0x42ed99['attributes'],function(_0x4772f7){var _0x32a38a={};_0x32a38a[_0x4772f7]={'$like':'%'+_0x4c6a0b['query'][_0x13b3('0x4d')]+'%'};return _0x32a38a;})});}_0x42ed99=_['merge']({},_0x42ed99,_0x4c6a0b[_0x13b3('0x50')]);return _0x1700cd[_0x13b3('0x81')](_0x42ed99);}})[_0x13b3('0x1e')](function(_0x3a40b6){if(_0x3a40b6){_0x3fbef0=_0x3a40b6['length'];if(!_0x4c6a0b[_0x13b3('0x43')][_0x13b3('0x48')](_0x13b3('0x49'))){_0x42ed99[_0x13b3('0x2e')]=qs[_0x13b3('0x2e')](_0x4c6a0b[_0x13b3('0x43')][_0x13b3('0x2e')]);_0x42ed99[_0x13b3('0x2d')]=qs['offset'](_0x4c6a0b[_0x13b3('0x43')]['offset']);}return _0x1700cd['getApplications'](_0x42ed99);}})[_0x13b3('0x1e')](function(_0x5066f0){if(_0x5066f0){return _0x5066f0?{'count':_0x3fbef0,'rows':_0x5066f0}:null;}})[_0x13b3('0x1e')](respondWithResult(_0x3fd822,null))[_0x13b3('0x59')](handleError(_0x3fd822,null));};exports['notify']=function(_0x12d9d4,_0x30d64b,_0x4b8836){var _0x300cc6={'channel':_0x13b3('0x82')};var _0x69ac62=[];var _0x55de77=[];var _0x4dcb6e={};return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x12d9d4[_0x13b3('0x56')]['id']},'include':[{'model':db[_0x13b3('0x7c')],'as':_0x13b3('0x83')}]})[_0x13b3('0x1e')](handleEntityNotFound(_0x30d64b,null))['then'](function(_0x3a8160){_0x300cc6[_0x13b3('0x84')]=_0x3a8160;if(_0x300cc6[_0x13b3('0x84')]&&_0x300cc6[_0x13b3('0x84')][_0x13b3('0x3f')]===_0x13b3('0x85')&&_0x12d9d4[_0x13b3('0x5b')]['statuses']){if(_0x12d9d4[_0x13b3('0x5b')][_0x13b3('0x86')][_0x13b3('0x47')]===0x0)return;if(_0x12d9d4[_0x13b3('0x5b')][_0x13b3('0x86')][0x0]['state']!==_0x13b3('0x87'))return;return db['WhatsappMessage'][_0x13b3('0x33')]({'read':!![],'readAt':_0x12d9d4['body']['statuses'][0x0][_0x13b3('0x88')]},{'where':{'messageId':_0x12d9d4['body'][_0x13b3('0x86')][0x0][_0x13b3('0x89')]},'individualHooks':!![]})[_0x13b3('0x1e')](function(_0x237f63){return _0x30d64b[_0x13b3('0x2a')](0xc8)[_0x13b3('0x2c')](_0x237f63);});}_0x300cc6[_0x13b3('0x8a')]=_[_0x13b3('0x8b')](_0x3a8160['Applications'],[_0x13b3('0x7f')],[_0x13b3('0x8c')]);if(_0x300cc6[_0x13b3('0x84')]['Applications']){delete _0x300cc6['account'][_0x13b3('0x83')];}return db['CmContact'][_0x13b3('0x61')]()[_0x13b3('0x1e')](function(_0x4a60cc){if(!_0x4a60cc){throw new db[(_0x13b3('0x8d'))]['ValidationError'](_0x13b3('0x8e'));}_0x69ac62=_[_0x13b3('0x8f')](_['keys'](_0x4a60cc),['createdAt',_0x13b3('0x90')]);_0x55de77=_[_0x13b3('0x8f')](_[_0x13b3('0x42')](_0x4a60cc),[_0x13b3('0x91'),_0x13b3('0x90'),_0x13b3('0x92'),_0x13b3('0x93')]);_0x300cc6[_0x13b3('0x5b')]={'mapKey':_0x13b3('0x94')};if(_0x300cc6['account']&&_0x300cc6[_0x13b3('0x84')][_0x13b3('0x3f')]==='twilio'){_0x300cc6['body']['from']=_0x12d9d4[_0x13b3('0x5b')]['From']['replace'](_0x13b3('0x95'),'');_0x300cc6['body']['body']=_0x12d9d4[_0x13b3('0x5b')][_0x13b3('0x96')];_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x97')]=_0x12d9d4[_0x13b3('0x5b')][_0x13b3('0x98')];}if(_0x300cc6['account']&&_0x300cc6[_0x13b3('0x84')]['type']===_0x13b3('0x85')){_0x300cc6[_0x13b3('0x5b')]['from']=_0x12d9d4[_0x13b3('0x5b')]['notifications'][0x0]['from'];_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x5b')]=_0x12d9d4[_0x13b3('0x5b')][_0x13b3('0x99')][0x0]['message']['body'];_0x300cc6[_0x13b3('0x5b')]['messageId']=_0x12d9d4['body'][_0x13b3('0x99')][0x0][_0x13b3('0x89')];}if(_0x300cc6[_0x13b3('0x5b')]['id']){delete _0x300cc6['body']['id'];}if(_[_0x13b3('0x9a')](_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x9b')])){throw new db[(_0x13b3('0x8d'))][(_0x13b3('0x9c'))]('from\x20is\x20mandatory');}if(_[_0x13b3('0x9a')](_0x300cc6[_0x13b3('0x5b')]['body'])||_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x5b')]===''){throw new db[(_0x13b3('0x8d'))]['ValidationError'](_0x13b3('0x9d'));}if(_[_0x13b3('0x9a')](_0x300cc6['body']['mapKey'])){throw new db[(_0x13b3('0x8d'))]['ValidationError'](_0x13b3('0x9e')+_0x55de77);}if(!_[_0x13b3('0x9f')](_0x55de77,_0x300cc6[_0x13b3('0x5b')]['mapKey'])){throw new db[(_0x13b3('0x8d'))][(_0x13b3('0x9c'))](_0x13b3('0xa0')+_0x55de77);}_0x4dcb6e[_0x300cc6[_0x13b3('0x5b')][_0x13b3('0xa1')]]=_0x300cc6['body']['from'];return db[_0x13b3('0xa2')][_0x13b3('0x60')]({'where':{'id':_0x300cc6[_0x13b3('0x84')][_0x13b3('0x93')]},'include':[{'model':db[_0x13b3('0xa3')],'as':_0x13b3('0xa4'),'where':_0x4dcb6e,'limit':0x1,'order':[[_0x13b3('0x90'),'DESC']]}]});})[_0x13b3('0x1e')](handleEntityNotFound(_0x30d64b,null))[_0x13b3('0x1e')](function(_0x4dbeb8){if(_0x4dbeb8){_0x300cc6[_0x13b3('0xa5')]=_[_0x13b3('0x6e')](_0x4dbeb8,[_0x13b3('0xa4')]);if(_0x4dbeb8[_0x13b3('0xa4')][_0x13b3('0x47')]){return _0x4dbeb8[_0x13b3('0xa4')][0x0];}var _0x4ebfc5=_['defaults'](_0x300cc6[_0x13b3('0x5b')],{'firstName':_0x300cc6[_0x13b3('0x5b')]['from'],'ListId':_0x4dbeb8['id']});_0x4ebfc5[_0x300cc6[_0x13b3('0x5b')][_0x13b3('0xa1')]]=_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x9b')];return db[_0x13b3('0xa3')]['create'](_0x4ebfc5,{'fields':_0x69ac62,'raw':!![]});}})[_0x13b3('0x1e')](handleEntityNotFound(_0x30d64b,null))['then'](function(_0x3bac1c){if(_0x3bac1c){_0x300cc6['contact']=_0x3bac1c;var _0x708486={'ContactId':_0x3bac1c['id'],'phone':_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x9b')],'WhatsappAccountId':_0x12d9d4[_0x13b3('0x56')]['id']};var _0x16c104={'ContactId':_0x3bac1c['id'],'WhatsappAccountId':_0x12d9d4[_0x13b3('0x56')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x16c104})[_0x13b3('0x1e')](function(_0x10a37c){if(_0x10a37c){return[_0x10a37c,![]];}return db['WhatsappInteraction'][_0x13b3('0x5a')](_0x708486)[_0x13b3('0x1e')](function(_0x453854){return[_0x453854,!![]];});});}})[_0x13b3('0x70')](function(_0x2e603b,_0xd8ae4a){_0x300cc6['interaction']=_0x2e603b[_0x13b3('0x34')]({'plain':!![]});_0x300cc6[_0x13b3('0xa6')][_0x13b3('0xa7')]=![];if(_0xd8ae4a){if(_0x300cc6[_0x13b3('0x84')][_0x13b3('0xa8')]){_0x300cc6['applications'][_0x13b3('0xa9')]({'id':0x0,'priority':_0x300cc6['applications'][_0x13b3('0x47')]+0x1,'app':'close','appdata':_0x13b3('0xaa'),'interval':'*,*,*,*'});}_0x300cc6[_0x13b3('0xa6')][_0x13b3('0xa7')]=!![];}return db[_0x13b3('0xab')][_0x13b3('0x5a')]({'phone':_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x9b')],'messageId':_0x300cc6[_0x13b3('0x5b')][_0x13b3('0x97')],'body':_0x300cc6['body'][_0x13b3('0x5b')],'WhatsappAccountId':_0x12d9d4[_0x13b3('0x56')]['id'],'WhatsappInteractionId':_0x2e603b['id'],'direction':'in','ContactId':_0x2e603b['ContactId'],'AttachmentId':_0x300cc6['body'][_0x13b3('0xac')]});})[_0x13b3('0x1e')](function(_0x15a047){_0x300cc6[_0x13b3('0x27')]=_0x15a047;if(!_0x300cc6[_0x13b3('0xa6')]['UserId'])return;return db[_0x13b3('0xad')][_0x13b3('0x60')]({'attributes':['id',_0x13b3('0x39')],'where':{'id':_0x300cc6[_0x13b3('0xa6')][_0x13b3('0xae')]}});})[_0x13b3('0x1e')](function(_0x4c1875){if(_0x4c1875){_0x300cc6[_0x13b3('0x8a')][_0x13b3('0xaf')]({'id':0x0,'priority':0x0,'app':_0x13b3('0xb0'),'appdata':_0x4c1875['name']+','+(_0x300cc6[_0x13b3('0x84')][_0x13b3('0xb1')]||0xa),'interval':_0x13b3('0xb2')});}if(!_0x300cc6[_0x13b3('0xa6')][_0x13b3('0xb3')])return;return db[_0x13b3('0xb4')][_0x13b3('0x60')]({'attributes':['id',_0x13b3('0x39')],'where':{'id':_0x300cc6[_0x13b3('0xa6')][_0x13b3('0xb3')]}});})[_0x13b3('0x1e')](function(_0x53aac4){if(_0x53aac4){_0x300cc6['applications'][_0x13b3('0xaf')]({'id':0x0,'priority':0x1,'app':_0x13b3('0xb5'),'appdata':_0x53aac4['name']+','+(_0x300cc6[_0x13b3('0x84')][_0x13b3('0xb6')]||0x12c),'interval':_0x13b3('0xb2')});}return respondWithRpcPromise('Start',_0x13b3('0xb7'),_0x300cc6);})[_0x13b3('0x1e')](function(_0x463cae){if(_0x463cae){var _0x57ff71=0xc8;var _0x53a751=_0x13b3('0xb8');logger[_0x13b3('0x1f')](_0x13b3('0x22'),_0x53a751,_0x57ff71,_0x13b3('0xb9'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x53a751,_0x57ff71,_0x13b3('0xb9'),JSON['stringify'](_0x463cae));if(_0x300cc6[_0x13b3('0x84')][_0x13b3('0x3f')]===_0x13b3('0xba')){return _0x30d64b[_0x13b3('0x2a')](_0x57ff71)['set'](_0x13b3('0xbb'),'text/xml')[_0x13b3('0x3a')]('\x0a');}else{return _0x30d64b[_0x13b3('0x2a')](_0x57ff71)[_0x13b3('0x2c')](_0x463cae);}}});})[_0x13b3('0x59')](handleError(_0x30d64b,null));};exports['send']=function(_0x16c5e9,_0x2b22b6,_0x87fc49){var _0x5ca390,_0x8af4fa,_0x4fa56f;if(_['isNil'](_0x16c5e9[_0x13b3('0x5b')][_0x13b3('0x5b')])||_0x16c5e9[_0x13b3('0x5b')][_0x13b3('0x5b')]===''){throw new db[(_0x13b3('0x8d'))]['ValidationError'](_0x13b3('0x9d'));}if(_['isNil'](_0x16c5e9['body']['to'])){throw new db[(_0x13b3('0x8d'))][(_0x13b3('0x9c'))](_0x13b3('0xbc'));}_0x5ca390=_0x16c5e9[_0x13b3('0x5b')]['to'];return db[_0x13b3('0x3d')][_0x13b3('0x60')]({'where':{'id':_0x16c5e9[_0x13b3('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x13b3('0xa3')],'as':_0x13b3('0xa4'),'where':{'mobile':_0x5ca390},'limit':0x1,'order':[[_0x13b3('0x90'),_0x13b3('0xbd')]]}]}]})[_0x13b3('0x1e')](handleEntityNotFound(_0x2b22b6,null))[_0x13b3('0x1e')](function(_0x4a8a8a){if(_0x4a8a8a&&_0x4a8a8a[_0x13b3('0xbe')]){_0x8af4fa=_0x4a8a8a[_0x13b3('0x34')]({'plain':!![]});if(_0x8af4fa[_0x13b3('0xbe')]&&_0x8af4fa[_0x13b3('0xbe')][_0x13b3('0xa4')]['length']){return _0x8af4fa[_0x13b3('0xbe')][_0x13b3('0xa4')][0x0];}return db[_0x13b3('0xa3')][_0x13b3('0x5a')](_[_0x13b3('0x16')](_0x16c5e9[_0x13b3('0x5b')],{'firstName':_0x5ca390,'mobile':_0x5ca390,'phone':_0x5ca390,'ListId':_0x8af4fa[_0x13b3('0x93')]}));}})[_0x13b3('0x1e')](handleEntityNotFound(_0x2b22b6,null))[_0x13b3('0x1e')](function(_0x3692ef){if(_0x3692ef){_0x4fa56f=_0x3692ef;return db['WhatsappInteraction'][_0x13b3('0x60')]({'where':{'ContactId':_0x4fa56f['id'],'closed':![],'WhatsappAccountId':_0x8af4fa['id']}})[_0x13b3('0x1e')](function(_0x41eeca){if(_0x41eeca){return[_0x41eeca,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x16c5e9['user']['id'],'ContactId':_0x4fa56f['id'],'WhatsappAccountId':_0x8af4fa['id'],'phone':_0x5ca390,'firstMsgDirection':_0x13b3('0xbf'),'Messages':[_[_0x13b3('0x4e')](_0x16c5e9[_0x13b3('0x5b')],{'read':![],'body':_0x16c5e9[_0x13b3('0x5b')][_0x13b3('0x5b')],'phone':_0x5ca390,'WhatsappAccountId':_0x8af4fa['id'],'UserId':_0x16c5e9['user']['id'],'ContactId':_0x4fa56f['id']})]},{'include':[{'model':db[_0x13b3('0xab')],'as':_0x13b3('0xc0')}]})[_0x13b3('0x1e')](function(_0x411e91){return[_0x411e91,!![]];});});}})[_0x13b3('0x70')](function(_0x1025dd,_0x317a69){if(_0x317a69){return _0x1025dd;}return db[_0x13b3('0xab')]['create'](_[_0x13b3('0x4e')](_0x16c5e9[_0x13b3('0x5b')],{'read':![],'body':_0x16c5e9[_0x13b3('0x5b')][_0x13b3('0x5b')],'phone':_0x5ca390,'WhatsappAccountId':_0x8af4fa['id'],'WhatsappInteractionId':_0x1025dd['id'],'UserId':_0x16c5e9[_0x13b3('0x5c')]['id'],'ContactId':_0x4fa56f['id']}))[_0x13b3('0x1e')](function(_0x1a293c){_0x1025dd['dataValues'][_0x13b3('0xc0')]=[];_0x1025dd[_0x13b3('0xc1')][_0x13b3('0xc0')][_0x13b3('0xa9')](_0x1a293c[_0x13b3('0xc1')]);return _0x1025dd;});})[_0x13b3('0x1e')](respondWithResult(_0x2b22b6,null))['catch'](handleError(_0x2b22b6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0fc3fa1..786733c 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 _0x8e3c=['remove','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x8e3c,0x1aa));var _0xc8e3=function(_0x701ad0,_0x406c52){_0x701ad0=_0x701ad0-0x0;var _0x2264a6=_0x8e3c[_0x701ad0];return _0x2264a6;};'use strict';var EventEmitter=require(_0xc8e3('0x0'));var WhatsappAccount=require(_0xc8e3('0x1'))['db'][_0xc8e3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc8e3('0x3')](0x0);var events={'afterCreate':_0xc8e3('0x4'),'afterUpdate':_0xc8e3('0x5'),'afterDestroy':_0xc8e3('0x6')};function emitEvent(_0x3e899c){return function(_0x1d18c0,_0x15efaa,_0x1e75b7){WhatsappAccountEvents['emit'](_0x3e899c+':'+_0x1d18c0['id'],_0x1d18c0);WhatsappAccountEvents['emit'](_0x3e899c,_0x1d18c0);_0x1e75b7(null);};}for(var e in events){if(events[_0xc8e3('0x7')](e)){var event=events[e];WhatsappAccount[_0xc8e3('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x34c7=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x34c7,0xb8));var _0x734c=function(_0x41673c,_0x290fce){_0x41673c=_0x41673c-0x0;var _0x55228f=_0x34c7[_0x41673c];return _0x55228f;};'use strict';var EventEmitter=require(_0x734c('0x0'));var WhatsappAccount=require(_0x734c('0x1'))['db'][_0x734c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x734c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x734c('0x4'),'afterDestroy':_0x734c('0x5')};function emitEvent(_0x27ae59){return function(_0x516b25,_0x16e020,_0x53f7fa){WhatsappAccountEvents[_0x734c('0x6')](_0x27ae59+':'+_0x516b25['id'],_0x516b25);WhatsappAccountEvents['emit'](_0x27ae59,_0x516b25);_0x53f7fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x734c('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c420f04..a47a863 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 _0x55d4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55d4,0x99));var _0x455d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55d4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x455d('0x0'));var util=require(_0x455d('0x1'));var logger=require(_0x455d('0x2'))('api');var moment=require(_0x455d('0x3'));var BPromise=require(_0x455d('0x4'));var rp=require(_0x455d('0x5'));var fs=require('fs');var path=require(_0x455d('0x6'));var rimraf=require(_0x455d('0x7'));var config=require(_0x455d('0x8'));var attributes=require(_0x455d('0x9'));module[_0x455d('0xa')]=function(_0x1ae831,_0x5dbc89){return _0x1ae831[_0x455d('0xb')](_0x455d('0xc'),attributes,{'tableName':_0x455d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc808=['exports','define','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappAccount.attributes'];(function(_0x204a83,_0x794714){var _0x205a5e=function(_0x1b6391){while(--_0x1b6391){_0x204a83['push'](_0x204a83['shift']());}};_0x205a5e(++_0x794714);}(_0xc808,0x179));var _0x8c80=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0xc808[_0x788a54];return _0x8b73a4;};'use strict';var _=require(_0x8c80('0x0'));var util=require('util');var logger=require(_0x8c80('0x1'))(_0x8c80('0x2'));var moment=require(_0x8c80('0x3'));var BPromise=require(_0x8c80('0x4'));var rp=require(_0x8c80('0x5'));var fs=require('fs');var path=require(_0x8c80('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c80('0x7'));module[_0x8c80('0x8')]=function(_0x44b867,_0x3574f1){return _0x44b867[_0x8c80('0x9')]('WhatsappAccount',attributes,{'tableName':_0x8c80('0xa'),'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 20444a1..bbd9f09 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 _0xd7cc=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','options','where','attributes','map','model','include','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info'];(function(_0x256d9a,_0x1dc479){var _0x705ca4=function(_0x237e82){while(--_0x237e82){_0x256d9a['push'](_0x256d9a['shift']());}};_0x705ca4(++_0x1dc479);}(_0xd7cc,0x131));var _0xcd7c=function(_0x14e8fb,_0x26d132){_0x14e8fb=_0x14e8fb-0x0;var _0x47db51=_0xd7cc[_0x14e8fb];return _0x47db51;};'use strict';var _=require(_0xcd7c('0x0'));var util=require(_0xcd7c('0x1'));var moment=require(_0xcd7c('0x2'));var BPromise=require(_0xcd7c('0x3'));var rs=require(_0xcd7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd7c('0x5'))(_0xcd7c('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd7c('0x7'));var client=jayson[_0xcd7c('0x8')][_0xcd7c('0x9')]({'port':0x232a});config[_0xcd7c('0xa')]=_[_0xcd7c('0xb')](config['redis'],{'host':_0xcd7c('0xc'),'port':0x18eb});var socket=require(_0xcd7c('0xd'))(new Redis(config['redis']));require(_0xcd7c('0xe'))[_0xcd7c('0xf')](socket);function respondWithRpcPromise(_0x27ab28,_0x7598b3,_0x5e6b18){return new BPromise(function(_0x50cafc,_0x125a39){return client[_0xcd7c('0x10')](_0x27ab28,_0x5e6b18)[_0xcd7c('0x11')](function(_0x3b6572){logger[_0xcd7c('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x7598b3,_0xcd7c('0x13'));logger[_0xcd7c('0x14')](_0xcd7c('0x15'),_0x7598b3,_0xcd7c('0x13'),JSON[_0xcd7c('0x16')](_0x3b6572));if(_0x3b6572[_0xcd7c('0x17')]){if(_0x3b6572[_0xcd7c('0x17')][_0xcd7c('0x18')]===0x1f4){logger[_0xcd7c('0x17')](_0xcd7c('0x19'),_0x7598b3,_0x3b6572[_0xcd7c('0x17')][_0xcd7c('0x1a')]);return _0x125a39(_0x3b6572[_0xcd7c('0x17')][_0xcd7c('0x1a')]);}logger[_0xcd7c('0x17')](_0xcd7c('0x19'),_0x7598b3,_0x3b6572[_0xcd7c('0x17')][_0xcd7c('0x1a')]);return _0x50cafc(_0x3b6572[_0xcd7c('0x17')][_0xcd7c('0x1a')]);}else{logger[_0xcd7c('0x12')](_0xcd7c('0x19'),_0x7598b3,'request\x20sent');_0x50cafc(_0x3b6572[_0xcd7c('0x1b')][_0xcd7c('0x1a')]);}})['catch'](function(_0x10792b){logger[_0xcd7c('0x17')](_0xcd7c('0x19'),_0x7598b3,_0x10792b);_0x125a39(_0x10792b);});});}exports[_0xcd7c('0x1c')]=function(_0x59e6a5){var _0x483a1d=this;return new Promise(function(_0xdd4f9c,_0x52e187){return db['WhatsappAccount']['find']({'raw':_0x59e6a5[_0xcd7c('0x1d')]?_0x59e6a5[_0xcd7c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x59e6a5[_0xcd7c('0x1d')]?_0x59e6a5['options'][_0xcd7c('0x1e')]||null:null,'attributes':_0x59e6a5[_0xcd7c('0x1d')]?_0x59e6a5[_0xcd7c('0x1d')][_0xcd7c('0x1f')]||null:null,'include':_0x59e6a5[_0xcd7c('0x1d')]?_0x59e6a5[_0xcd7c('0x1d')]['include']?_[_0xcd7c('0x20')](_0x59e6a5[_0xcd7c('0x1d')]['include'],function(_0x2084e6){return{'model':db[_0x2084e6[_0xcd7c('0x21')]],'as':_0x2084e6['as'],'attributes':_0x2084e6[_0xcd7c('0x1f')],'include':_0x2084e6[_0xcd7c('0x22')]?_[_0xcd7c('0x20')](_0x2084e6[_0xcd7c('0x22')],function(_0xe63008){return{'model':db[_0xe63008[_0xcd7c('0x21')]],'as':_0xe63008['as'],'attributes':_0xe63008['attributes'],'include':_0xe63008[_0xcd7c('0x22')]?_[_0xcd7c('0x20')](_0xe63008[_0xcd7c('0x22')],function(_0x37a47e){return{'model':db[_0x37a47e[_0xcd7c('0x21')]],'as':_0x37a47e['as'],'attributes':_0x37a47e[_0xcd7c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd7c('0x11')](function(_0x405a75){logger[_0xcd7c('0x12')](_0xcd7c('0x1c'),_0x59e6a5);logger['debug'](_0xcd7c('0x1c'),_0x59e6a5,JSON['stringify'](_0x405a75));_0xdd4f9c(_0x405a75);})[_0xcd7c('0x23')](function(_0xf7bf8a){logger[_0xcd7c('0x17')](_0xcd7c('0x1c'),_0xf7bf8a['message'],_0x59e6a5);_0x52e187(_0x483a1d[_0xcd7c('0x17')](0x1f4,_0xf7bf8a[_0xcd7c('0x1a')]));});});}; \ No newline at end of file +var _0xd904=['./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappAccount','find','options','where','attributes','include','map','model','ShowWhatsappAccount','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter'];(function(_0x19330e,_0x15f8f2){var _0x1a3c28=function(_0x5de7e6){while(--_0x5de7e6){_0x19330e['push'](_0x19330e['shift']());}};_0x1a3c28(++_0x15f8f2);}(_0xd904,0x84));var _0x4d90=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd904[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x4d90('0x0'));var moment=require(_0x4d90('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d90('0x3'))['db'];var utils=require(_0x4d90('0x4'));var logger=require(_0x4d90('0x5'))(_0x4d90('0x6'));var config=require(_0x4d90('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d90('0x8')]({'port':0x232a});config[_0x4d90('0x9')]=_['defaults'](config[_0x4d90('0x9')],{'host':_0x4d90('0xa'),'port':0x18eb});var socket=require(_0x4d90('0xb'))(new Redis(config[_0x4d90('0x9')]));require(_0x4d90('0xc'))[_0x4d90('0xd')](socket);function respondWithRpcPromise(_0x4425cd,_0x537bcf,_0x13e599){return new BPromise(function(_0xec9d4,_0x2ba113){return client[_0x4d90('0xe')](_0x4425cd,_0x13e599)[_0x4d90('0xf')](function(_0x4e9ab5){logger['info'](_0x4d90('0x10'),_0x537bcf,_0x4d90('0x11'));logger[_0x4d90('0x12')](_0x4d90('0x13'),_0x537bcf,'request\x20sent',JSON[_0x4d90('0x14')](_0x4e9ab5));if(_0x4e9ab5[_0x4d90('0x15')]){if(_0x4e9ab5['error'][_0x4d90('0x16')]===0x1f4){logger[_0x4d90('0x15')](_0x4d90('0x10'),_0x537bcf,_0x4e9ab5[_0x4d90('0x15')][_0x4d90('0x17')]);return _0x2ba113(_0x4e9ab5[_0x4d90('0x15')][_0x4d90('0x17')]);}logger[_0x4d90('0x15')](_0x4d90('0x10'),_0x537bcf,_0x4e9ab5[_0x4d90('0x15')][_0x4d90('0x17')]);return _0xec9d4(_0x4e9ab5['error'][_0x4d90('0x17')]);}else{logger[_0x4d90('0x18')](_0x4d90('0x10'),_0x537bcf,_0x4d90('0x11'));_0xec9d4(_0x4e9ab5[_0x4d90('0x19')][_0x4d90('0x17')]);}})[_0x4d90('0x1a')](function(_0x95e7fa){logger[_0x4d90('0x15')](_0x4d90('0x10'),_0x537bcf,_0x95e7fa);_0x2ba113(_0x95e7fa);});});}exports['ShowWhatsappAccount']=function(_0x3131b2){var _0x65e429=this;return new Promise(function(_0x13b885,_0xea0c9a){return db[_0x4d90('0x1b')][_0x4d90('0x1c')]({'raw':_0x3131b2[_0x4d90('0x1d')]?_0x3131b2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3131b2[_0x4d90('0x1d')]?_0x3131b2[_0x4d90('0x1d')][_0x4d90('0x1e')]||null:null,'attributes':_0x3131b2[_0x4d90('0x1d')]?_0x3131b2[_0x4d90('0x1d')][_0x4d90('0x1f')]||null:null,'include':_0x3131b2[_0x4d90('0x1d')]?_0x3131b2['options'][_0x4d90('0x20')]?_[_0x4d90('0x21')](_0x3131b2[_0x4d90('0x1d')][_0x4d90('0x20')],function(_0x30908d){return{'model':db[_0x30908d[_0x4d90('0x22')]],'as':_0x30908d['as'],'attributes':_0x30908d[_0x4d90('0x1f')],'include':_0x30908d[_0x4d90('0x20')]?_[_0x4d90('0x21')](_0x30908d['include'],function(_0x2c226e){return{'model':db[_0x2c226e['model']],'as':_0x2c226e['as'],'attributes':_0x2c226e[_0x4d90('0x1f')],'include':_0x2c226e[_0x4d90('0x20')]?_[_0x4d90('0x21')](_0x2c226e[_0x4d90('0x20')],function(_0x7db00e){return{'model':db[_0x7db00e['model']],'as':_0x7db00e['as'],'attributes':_0x7db00e[_0x4d90('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4d90('0xf')](function(_0xf652ed){logger[_0x4d90('0x18')](_0x4d90('0x23'),_0x3131b2);logger[_0x4d90('0x12')](_0x4d90('0x23'),_0x3131b2,JSON[_0x4d90('0x14')](_0xf652ed));_0x13b885(_0xf652ed);})[_0x4d90('0x1a')](function(_0x57068f){logger['error'](_0x4d90('0x23'),_0x57068f[_0x4d90('0x17')],_0x3131b2);_0xea0c9a(_0x65e429['error'](0x1f4,_0x57068f[_0x4d90('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5dd0aac..c22cc24 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 _0x3c76=['./whatsappAccount.events','remove','emit','removeListener'];(function(_0x47f6f3,_0x5b0a81){var _0x3a2ae6=function(_0x11c29d){while(--_0x11c29d){_0x47f6f3['push'](_0x47f6f3['shift']());}};_0x3a2ae6(++_0x5b0a81);}(_0x3c76,0xb4));var _0x63c7=function(_0x378811,_0x42643c){_0x378811=_0x378811-0x0;var _0x33da6f=_0x3c76[_0x378811];return _0x33da6f;};'use strict';var WhatsappAccountEvents=require(_0x63c7('0x0'));var events=['save',_0x63c7('0x1'),'update'];function createListener(_0x4220a6,_0x18b05b){return function(_0x15bf45){_0x18b05b[_0x63c7('0x2')](_0x4220a6,_0x15bf45);};}function removeListener(_0x10ff92,_0x2696e5){return function(){WhatsappAccountEvents[_0x63c7('0x3')](_0x10ff92,_0x2696e5);};}exports['register']=function(_0x14d77f){for(var _0x507071=0x0,_0x1c76f3=events['length'];_0x507071<_0x1c76f3;_0x507071++){var _0x27b361=events[_0x507071];var _0x3a7b6d=createListener('whatsappAccount:'+_0x27b361,_0x14d77f);WhatsappAccountEvents['on'](_0x27b361,_0x3a7b6d);}}; \ No newline at end of file +var _0xd218=['remove','update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xd218,0x116));var _0x8d21=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xd218[_0x220dbb];return _0x2b77de;};'use strict';var WhatsappAccountEvents=require(_0x8d21('0x0'));var events=[_0x8d21('0x1'),_0x8d21('0x2'),_0x8d21('0x3')];function createListener(_0x5de7c2,_0x267408){return function(_0x512d31){_0x267408[_0x8d21('0x4')](_0x5de7c2,_0x512d31);};}function removeListener(_0x419eb4,_0x1aa154){return function(){WhatsappAccountEvents[_0x8d21('0x5')](_0x419eb4,_0x1aa154);};}exports[_0x8d21('0x6')]=function(_0x35e1aa){for(var _0x3f15dd=0x0,_0x308ced=events['length'];_0x3f15dd<_0x308ced;_0x3f15dd++){var _0x105605=events[_0x3f15dd];var _0x56946c=createListener(_0x8d21('0x7')+_0x105605,_0x35e1aa);WhatsappAccountEvents['on'](_0x105605,_0x56946c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 673a1af..864c303 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 _0xd324=['destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update','delete'];(function(_0x2d85f9,_0x1add32){var _0x2e0f3f=function(_0x58102d){while(--_0x58102d){_0x2d85f9['push'](_0x2d85f9['shift']());}};_0x2e0f3f(++_0x1add32);}(_0xd324,0x121));var _0x4d32=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xd324[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x4d32('0x0'));var util=require('util');var path=require(_0x4d32('0x1'));var timeout=require(_0x4d32('0x2'));var express=require('express');var router=express[_0x4d32('0x3')]();var fs_extra=require(_0x4d32('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4d32('0x5'));var config=require(_0x4d32('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x4d32('0x7')](),controller[_0x4d32('0x8')]);router[_0x4d32('0x9')](_0x4d32('0xa'),auth[_0x4d32('0x7')](),controller['show']);router[_0x4d32('0xb')]('/',auth['isAuthenticated'](),controller[_0x4d32('0xc')]);router['put'](_0x4d32('0xa'),auth[_0x4d32('0x7')](),controller[_0x4d32('0xd')]);router[_0x4d32('0xe')](_0x4d32('0xa'),auth['isAuthenticated'](),controller[_0x4d32('0xf')]);module['exports']=router; \ No newline at end of file +var _0xaab6=['get','/:id','isAuthenticated','show','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller'];(function(_0x3fd112,_0x4c3700){var _0x398f59=function(_0x58da6a){while(--_0x58da6a){_0x3fd112['push'](_0x3fd112['shift']());}};_0x398f59(++_0x4c3700);}(_0xaab6,0x19f));var _0x6aab=function(_0x58b603,_0x450f6d){_0x58b603=_0x58b603-0x0;var _0xf76126=_0xaab6[_0x58b603];return _0xf76126;};'use strict';var multer=require(_0x6aab('0x0'));var util=require(_0x6aab('0x1'));var path=require(_0x6aab('0x2'));var timeout=require(_0x6aab('0x3'));var express=require(_0x6aab('0x4'));var router=express[_0x6aab('0x5')]();var fs_extra=require(_0x6aab('0x6'));var auth=require(_0x6aab('0x7'));var interaction=require(_0x6aab('0x8'));var config=require('../../config/environment');var controller=require(_0x6aab('0x9'));router[_0x6aab('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6aab('0xa')](_0x6aab('0xb'),auth[_0x6aab('0xc')](),controller[_0x6aab('0xd')]);router['post']('/',auth[_0x6aab('0xc')](),controller['create']);router[_0x6aab('0xe')](_0x6aab('0xb'),auth['isAuthenticated'](),controller[_0x6aab('0xf')]);router['delete'](_0x6aab('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6aab('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 94164e8..e11f48c 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 _0xa3bb=['sequelize','exports','STRING','noop','TEXT'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xa3bb,0xd2));var _0xba3b=function(_0xca5c04,_0x3a5a54){_0xca5c04=_0xca5c04-0x0;var _0x382460=_0xa3bb[_0xca5c04];return _0x382460;};'use strict';var Sequelize=require(_0xba3b('0x0'));module[_0xba3b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xba3b('0x2')],'allowNull':![],'defaultValue':_0xba3b('0x3')},'appdata':{'type':Sequelize[_0xba3b('0x4')]()},'description':{'type':Sequelize[_0xba3b('0x2')]},'interval':{'type':Sequelize[_0xba3b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xab7c=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0xab7c,0x66));var _0xcab7=function(_0x33bddf,_0x1f2206){_0x33bddf=_0x33bddf-0x0;var _0x22dae3=_0xab7c[_0x33bddf];return _0x22dae3;};'use strict';var Sequelize=require(_0xcab7('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcab7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcab7('0x2')],'allowNull':![],'defaultValue':_0xcab7('0x3')},'appdata':{'type':Sequelize[_0xcab7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcab7('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 09d833a..36e3447 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 _0xf0f4=['options','include','findAll','rows','show','params','find','create','catch','body','destroy','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','WhatsappApplication','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0f4,0x182));var _0x4f0f=function(_0x503444,_0x35bf4d){_0x503444=_0x503444-0x0;var _0x5dd68c=_0xf0f4[_0x503444];return _0x5dd68c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f0f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f0f('0x1'));var moment=require(_0x4f0f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f0f('0x3'));var util=require(_0x4f0f('0x4'));var path=require(_0x4f0f('0x5'));var sox=require(_0x4f0f('0x6'));var csv=require(_0x4f0f('0x7'));var ejs=require(_0x4f0f('0x8'));var fs=require('fs');var fs_extra=require(_0x4f0f('0x9'));var _=require('lodash');var squel=require(_0x4f0f('0xa'));var crypto=require(_0x4f0f('0xb'));var jsforce=require(_0x4f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f0f('0x7'));var querystring=require(_0x4f0f('0xd'));var Papa=require(_0x4f0f('0xe'));var Redis=require(_0x4f0f('0xf'));var authService=require(_0x4f0f('0x10'));var qs=require(_0x4f0f('0x11'));var as=require(_0x4f0f('0x12'));var hardwareService=require(_0x4f0f('0x13'));var logger=require('../../config/logger')(_0x4f0f('0x14'));var utils=require(_0x4f0f('0x15'));var config=require(_0x4f0f('0x16'));var licenseUtil=require(_0x4f0f('0x17'));var db=require(_0x4f0f('0x18'))['db'];function respondWithStatusCode(_0x1a1b94,_0x123845){_0x123845=_0x123845||0xcc;return function(_0x11749b){if(_0x11749b){return _0x1a1b94[_0x4f0f('0x19')](_0x123845);}return _0x1a1b94[_0x4f0f('0x1a')](_0x123845)[_0x4f0f('0x1b')]();};}function respondWithResult(_0x4e1e26,_0xebecc0){_0xebecc0=_0xebecc0||0xc8;return function(_0x447238){if(_0x447238){return _0x4e1e26[_0x4f0f('0x1a')](_0xebecc0)[_0x4f0f('0x1c')](_0x447238);}};}function respondWithFilteredResult(_0x51a713,_0xd9ad12){return function(_0x46d7cf){if(_0x46d7cf){var _0x5783=typeof _0xd9ad12[_0x4f0f('0x1d')]===_0x4f0f('0x1e')&&typeof _0xd9ad12['limit']===_0x4f0f('0x1e');var _0x1942cf=_0x46d7cf[_0x4f0f('0x1f')];var _0x566049=_0x5783?0x0:_0xd9ad12[_0x4f0f('0x1d')];var _0x86186f=_0x5783?_0x46d7cf[_0x4f0f('0x1f')]:_0xd9ad12['offset']+_0xd9ad12[_0x4f0f('0x20')];var _0x2455f9;if(_0x86186f>=_0x1942cf){_0x86186f=_0x1942cf;_0x2455f9=0xc8;}else{_0x2455f9=0xce;}_0x51a713[_0x4f0f('0x1a')](_0x2455f9);return _0x51a713[_0x4f0f('0x21')](_0x4f0f('0x22'),_0x566049+'-'+_0x86186f+'/'+_0x1942cf)[_0x4f0f('0x1c')](_0x46d7cf);}return null;};}function patchUpdates(_0x537074){return function(_0x276387){try{jsonpatch['apply'](_0x276387,_0x537074,!![]);}catch(_0x3a6f22){return BPromise[_0x4f0f('0x23')](_0x3a6f22);}return _0x276387['save']();};}function saveUpdates(_0x4e4b28,_0x1bdfb4){return function(_0x55d318){if(_0x55d318){return _0x55d318[_0x4f0f('0x24')](_0x4e4b28)[_0x4f0f('0x25')](function(_0x18abde){return _0x18abde;});}return null;};}function removeEntity(_0x17f10c,_0x454720){return function(_0x17a9e9){if(_0x17a9e9){return _0x17a9e9['destroy']()[_0x4f0f('0x25')](function(){_0x17f10c[_0x4f0f('0x1a')](0xcc)[_0x4f0f('0x1b')]();});}};}function handleEntityNotFound(_0x3bc77d,_0xe969c7){return function(_0x3e6b72){if(!_0x3e6b72){_0x3bc77d[_0x4f0f('0x19')](0x194);}return _0x3e6b72;};}function handleError(_0x419986,_0x17cf17){_0x17cf17=_0x17cf17||0x1f4;return function(_0xb20be9){logger[_0x4f0f('0x26')](_0xb20be9[_0x4f0f('0x27')]);if(_0xb20be9[_0x4f0f('0x28')]){delete _0xb20be9['name'];}_0x419986[_0x4f0f('0x1a')](_0x17cf17)[_0x4f0f('0x29')](_0xb20be9);};}exports[_0x4f0f('0x2a')]=function(_0x58ec43,_0xa8a240){var _0x4e5f0d={},_0x449788={},_0x1f4e1d={'count':0x0,'rows':[]};var _0x5ada54=_['map'](db[_0x4f0f('0x2b')]['rawAttributes'],function(_0x1a005e){return{'name':_0x1a005e[_0x4f0f('0x2c')],'type':_0x1a005e['type'][_0x4f0f('0x2d')]};});_0x449788[_0x4f0f('0x2e')]=_[_0x4f0f('0x2f')](_0x5ada54,_0x4f0f('0x28'));_0x449788['query']=_[_0x4f0f('0x30')](_0x58ec43[_0x4f0f('0x31')]);_0x449788[_0x4f0f('0x32')]=_[_0x4f0f('0x33')](_0x449788['model'],_0x449788[_0x4f0f('0x31')]);_0x4e5f0d[_0x4f0f('0x34')]=_[_0x4f0f('0x33')](_0x449788['model'],qs[_0x4f0f('0x35')](_0x58ec43[_0x4f0f('0x31')]['fields']));_0x4e5f0d[_0x4f0f('0x34')]=_0x4e5f0d[_0x4f0f('0x34')][_0x4f0f('0x36')]?_0x4e5f0d[_0x4f0f('0x34')]:_0x449788['model'];if(!_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x37')](_0x4f0f('0x38'))){_0x4e5f0d[_0x4f0f('0x20')]=qs[_0x4f0f('0x20')](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x20')]);_0x4e5f0d[_0x4f0f('0x1d')]=qs['offset'](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x1d')]);}_0x4e5f0d[_0x4f0f('0x39')]=qs[_0x4f0f('0x3a')](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x3a')]);_0x4e5f0d[_0x4f0f('0x3b')]=qs['filters'](_[_0x4f0f('0x3c')](_0x58ec43[_0x4f0f('0x31')],_0x449788[_0x4f0f('0x32')]),_0x5ada54);if(_0x58ec43['query'][_0x4f0f('0x3d')]){_0x4e5f0d['where']=_[_0x4f0f('0x3e')](_0x4e5f0d['where'],{'$or':_[_0x4f0f('0x2f')](_0x5ada54,function(_0x27b5bf){if(_0x27b5bf['type']!==_0x4f0f('0x3f')){var _0x2d58b0={};_0x2d58b0[_0x27b5bf[_0x4f0f('0x28')]]={'$like':'%'+_0x58ec43['query'][_0x4f0f('0x3d')]+'%'};return _0x2d58b0;}})});}_0x4e5f0d=_[_0x4f0f('0x3e')]({},_0x4e5f0d,_0x58ec43[_0x4f0f('0x40')]);var _0x1b91d7={'where':_0x4e5f0d[_0x4f0f('0x3b')]};return db[_0x4f0f('0x2b')][_0x4f0f('0x1f')](_0x1b91d7)[_0x4f0f('0x25')](function(_0x2659b0){_0x1f4e1d[_0x4f0f('0x1f')]=_0x2659b0;if(_0x58ec43[_0x4f0f('0x31')]['includeAll']){_0x4e5f0d[_0x4f0f('0x41')]=[{'all':!![]}];}return db[_0x4f0f('0x2b')][_0x4f0f('0x42')](_0x4e5f0d);})[_0x4f0f('0x25')](function(_0x419cb4){_0x1f4e1d[_0x4f0f('0x43')]=_0x419cb4;return _0x1f4e1d;})[_0x4f0f('0x25')](respondWithFilteredResult(_0xa8a240,_0x4e5f0d))['catch'](handleError(_0xa8a240,null));};exports[_0x4f0f('0x44')]=function(_0x2e30d6,_0x1d8017){var _0x2bf0b3={'raw':!![],'where':{'id':_0x2e30d6[_0x4f0f('0x45')]['id']}},_0x1744f9={};_0x1744f9['model']=_[_0x4f0f('0x30')](db[_0x4f0f('0x2b')]['rawAttributes']);_0x1744f9['query']=_[_0x4f0f('0x30')](_0x2e30d6[_0x4f0f('0x31')]);_0x1744f9[_0x4f0f('0x32')]=_['intersection'](_0x1744f9[_0x4f0f('0x2e')],_0x1744f9['query']);_0x2bf0b3['attributes']=_[_0x4f0f('0x33')](_0x1744f9[_0x4f0f('0x2e')],qs[_0x4f0f('0x35')](_0x2e30d6[_0x4f0f('0x31')][_0x4f0f('0x35')]));_0x2bf0b3[_0x4f0f('0x34')]=_0x2bf0b3['attributes']['length']?_0x2bf0b3[_0x4f0f('0x34')]:_0x1744f9[_0x4f0f('0x2e')];if(_0x2e30d6[_0x4f0f('0x31')]['includeAll']){_0x2bf0b3[_0x4f0f('0x41')]=[{'all':!![]}];}_0x2bf0b3=_[_0x4f0f('0x3e')]({},_0x2bf0b3,_0x2e30d6[_0x4f0f('0x40')]);return db['WhatsappApplication'][_0x4f0f('0x46')](_0x2bf0b3)['then'](handleEntityNotFound(_0x1d8017,null))[_0x4f0f('0x25')](respondWithResult(_0x1d8017,null))['catch'](handleError(_0x1d8017,null));};exports[_0x4f0f('0x47')]=function(_0x3f2c6e,_0x2b0d3e){return db[_0x4f0f('0x2b')][_0x4f0f('0x47')](_0x3f2c6e['body'],{})['then'](respondWithResult(_0x2b0d3e,0xc9))[_0x4f0f('0x48')](handleError(_0x2b0d3e,null));};exports['update']=function(_0x12e587,_0x32d298){if(_0x12e587[_0x4f0f('0x49')]['id']){delete _0x12e587[_0x4f0f('0x49')]['id'];}return db[_0x4f0f('0x2b')][_0x4f0f('0x46')]({'where':{'id':_0x12e587[_0x4f0f('0x45')]['id']}})[_0x4f0f('0x25')](handleEntityNotFound(_0x32d298,null))['then'](saveUpdates(_0x12e587[_0x4f0f('0x49')],null))[_0x4f0f('0x25')](respondWithResult(_0x32d298,null))[_0x4f0f('0x48')](handleError(_0x32d298,null));};exports[_0x4f0f('0x4a')]=function(_0x355517,_0x3262a6){return db[_0x4f0f('0x2b')][_0x4f0f('0x46')]({'where':{'id':_0x355517[_0x4f0f('0x45')]['id']}})[_0x4f0f('0x25')](handleEntityNotFound(_0x3262a6,null))['then'](removeEntity(_0x3262a6,null))[_0x4f0f('0x48')](handleError(_0x3262a6,null));}; \ No newline at end of file +var _0xee8f=['create','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','rows','catch','show','params','find'];(function(_0x35e290,_0x207655){var _0x217d26=function(_0x192b8d){while(--_0x192b8d){_0x35e290['push'](_0x35e290['shift']());}};_0x217d26(++_0x207655);}(_0xee8f,0x1ed));var _0xfee8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xee8f[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfee8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfee8('0x1'));var rp=require(_0xfee8('0x2'));var moment=require(_0xfee8('0x3'));var BPromise=require(_0xfee8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfee8('0x5'));var csv=require(_0xfee8('0x6'));var ejs=require(_0xfee8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfee8('0x8'));var squel=require(_0xfee8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfee8('0xa'));var toCsv=require(_0xfee8('0x6'));var querystring=require(_0xfee8('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfee8('0xc'));var qs=require(_0xfee8('0xd'));var as=require(_0xfee8('0xe'));var hardwareService=require(_0xfee8('0xf'));var logger=require(_0xfee8('0x10'))(_0xfee8('0x11'));var utils=require(_0xfee8('0x12'));var config=require(_0xfee8('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55023b,_0x3fb040){_0x3fb040=_0x3fb040||0xcc;return function(_0x4493a5){if(_0x4493a5){return _0x55023b[_0xfee8('0x14')](_0x3fb040);}return _0x55023b['status'](_0x3fb040)['end']();};}function respondWithResult(_0x16364d,_0x36230a){_0x36230a=_0x36230a||0xc8;return function(_0x11aeb6){if(_0x11aeb6){return _0x16364d[_0xfee8('0x15')](_0x36230a)[_0xfee8('0x16')](_0x11aeb6);}};}function respondWithFilteredResult(_0x1f85c2,_0x1c285f){return function(_0xc8de11){if(_0xc8de11){var _0x53f517=typeof _0x1c285f[_0xfee8('0x17')]===_0xfee8('0x18')&&typeof _0x1c285f[_0xfee8('0x19')]==='undefined';var _0x4cca60=_0xc8de11[_0xfee8('0x1a')];var _0xe87d73=_0x53f517?0x0:_0x1c285f['offset'];var _0x2c0d1e=_0x53f517?_0xc8de11[_0xfee8('0x1a')]:_0x1c285f['offset']+_0x1c285f[_0xfee8('0x19')];var _0x587c14;if(_0x2c0d1e>=_0x4cca60){_0x2c0d1e=_0x4cca60;_0x587c14=0xc8;}else{_0x587c14=0xce;}_0x1f85c2['status'](_0x587c14);return _0x1f85c2[_0xfee8('0x1b')](_0xfee8('0x1c'),_0xe87d73+'-'+_0x2c0d1e+'/'+_0x4cca60)[_0xfee8('0x16')](_0xc8de11);}return null;};}function patchUpdates(_0x10babd){return function(_0x48e051){try{jsonpatch[_0xfee8('0x1d')](_0x48e051,_0x10babd,!![]);}catch(_0x3308e5){return BPromise[_0xfee8('0x1e')](_0x3308e5);}return _0x48e051[_0xfee8('0x1f')]();};}function saveUpdates(_0x2e9e1b,_0x2401a3){return function(_0xe48425){if(_0xe48425){return _0xe48425[_0xfee8('0x20')](_0x2e9e1b)[_0xfee8('0x21')](function(_0x507656){return _0x507656;});}return null;};}function removeEntity(_0x347787,_0x51d263){return function(_0x21d42c){if(_0x21d42c){return _0x21d42c['destroy']()[_0xfee8('0x21')](function(){_0x347787[_0xfee8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e9a0,_0x3fd4cc){return function(_0x57aca6){if(!_0x57aca6){_0x30e9a0[_0xfee8('0x14')](0x194);}return _0x57aca6;};}function handleError(_0x42c44d,_0x23b063){_0x23b063=_0x23b063||0x1f4;return function(_0x343458){logger[_0xfee8('0x22')](_0x343458['stack']);if(_0x343458[_0xfee8('0x23')]){delete _0x343458[_0xfee8('0x23')];}_0x42c44d[_0xfee8('0x15')](_0x23b063)[_0xfee8('0x24')](_0x343458);};}exports[_0xfee8('0x25')]=function(_0x426cdd,_0x452730){var _0x20aa37={},_0x3f5914={},_0x4fdfb3={'count':0x0,'rows':[]};var _0x180f83=_[_0xfee8('0x26')](db['WhatsappApplication'][_0xfee8('0x27')],function(_0x38c28b){return{'name':_0x38c28b['fieldName'],'type':_0x38c28b[_0xfee8('0x28')]['key']};});_0x3f5914['model']=_[_0xfee8('0x26')](_0x180f83,_0xfee8('0x23'));_0x3f5914[_0xfee8('0x29')]=_[_0xfee8('0x2a')](_0x426cdd[_0xfee8('0x29')]);_0x3f5914[_0xfee8('0x2b')]=_['intersection'](_0x3f5914[_0xfee8('0x2c')],_0x3f5914[_0xfee8('0x29')]);_0x20aa37[_0xfee8('0x2d')]=_[_0xfee8('0x2e')](_0x3f5914['model'],qs['fields'](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x2f')]));_0x20aa37[_0xfee8('0x2d')]=_0x20aa37[_0xfee8('0x2d')][_0xfee8('0x30')]?_0x20aa37[_0xfee8('0x2d')]:_0x3f5914[_0xfee8('0x2c')];if(!_0x426cdd[_0xfee8('0x29')][_0xfee8('0x31')](_0xfee8('0x32'))){_0x20aa37['limit']=qs[_0xfee8('0x19')](_0x426cdd['query']['limit']);_0x20aa37['offset']=qs[_0xfee8('0x17')](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x17')]);}_0x20aa37[_0xfee8('0x33')]=qs['sort'](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x34')]);_0x20aa37[_0xfee8('0x35')]=qs[_0xfee8('0x2b')](_[_0xfee8('0x36')](_0x426cdd[_0xfee8('0x29')],_0x3f5914[_0xfee8('0x2b')]),_0x180f83);if(_0x426cdd['query'][_0xfee8('0x37')]){_0x20aa37[_0xfee8('0x35')]=_[_0xfee8('0x38')](_0x20aa37[_0xfee8('0x35')],{'$or':_[_0xfee8('0x26')](_0x180f83,function(_0x1b2531){if(_0x1b2531[_0xfee8('0x28')]!==_0xfee8('0x39')){var _0x528666={};_0x528666[_0x1b2531['name']]={'$like':'%'+_0x426cdd[_0xfee8('0x29')][_0xfee8('0x37')]+'%'};return _0x528666;}})});}_0x20aa37=_[_0xfee8('0x38')]({},_0x20aa37,_0x426cdd[_0xfee8('0x3a')]);var _0x1550a0={'where':_0x20aa37[_0xfee8('0x35')]};return db[_0xfee8('0x3b')]['count'](_0x1550a0)['then'](function(_0xbd818c){_0x4fdfb3[_0xfee8('0x1a')]=_0xbd818c;if(_0x426cdd[_0xfee8('0x29')][_0xfee8('0x3c')]){_0x20aa37[_0xfee8('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x20aa37);})[_0xfee8('0x21')](function(_0x31c6b3){_0x4fdfb3[_0xfee8('0x3e')]=_0x31c6b3;return _0x4fdfb3;})[_0xfee8('0x21')](respondWithFilteredResult(_0x452730,_0x20aa37))[_0xfee8('0x3f')](handleError(_0x452730,null));};exports[_0xfee8('0x40')]=function(_0x283617,_0x5cbdb8){var _0x270e29={'raw':!![],'where':{'id':_0x283617[_0xfee8('0x41')]['id']}},_0x52febc={};_0x52febc[_0xfee8('0x2c')]=_[_0xfee8('0x2a')](db[_0xfee8('0x3b')][_0xfee8('0x27')]);_0x52febc[_0xfee8('0x29')]=_[_0xfee8('0x2a')](_0x283617['query']);_0x52febc[_0xfee8('0x2b')]=_['intersection'](_0x52febc[_0xfee8('0x2c')],_0x52febc['query']);_0x270e29[_0xfee8('0x2d')]=_[_0xfee8('0x2e')](_0x52febc[_0xfee8('0x2c')],qs[_0xfee8('0x2f')](_0x283617['query'][_0xfee8('0x2f')]));_0x270e29[_0xfee8('0x2d')]=_0x270e29[_0xfee8('0x2d')][_0xfee8('0x30')]?_0x270e29[_0xfee8('0x2d')]:_0x52febc['model'];if(_0x283617[_0xfee8('0x29')]['includeAll']){_0x270e29[_0xfee8('0x3d')]=[{'all':!![]}];}_0x270e29=_['merge']({},_0x270e29,_0x283617[_0xfee8('0x3a')]);return db[_0xfee8('0x3b')][_0xfee8('0x42')](_0x270e29)[_0xfee8('0x21')](handleEntityNotFound(_0x5cbdb8,null))[_0xfee8('0x21')](respondWithResult(_0x5cbdb8,null))[_0xfee8('0x3f')](handleError(_0x5cbdb8,null));};exports[_0xfee8('0x43')]=function(_0x38e1c8,_0x37bec7){return db[_0xfee8('0x3b')][_0xfee8('0x43')](_0x38e1c8[_0xfee8('0x44')],{})[_0xfee8('0x21')](respondWithResult(_0x37bec7,0xc9))[_0xfee8('0x3f')](handleError(_0x37bec7,null));};exports[_0xfee8('0x20')]=function(_0x464c8f,_0x9b136b){if(_0x464c8f[_0xfee8('0x44')]['id']){delete _0x464c8f['body']['id'];}return db[_0xfee8('0x3b')][_0xfee8('0x42')]({'where':{'id':_0x464c8f['params']['id']}})[_0xfee8('0x21')](handleEntityNotFound(_0x9b136b,null))[_0xfee8('0x21')](saveUpdates(_0x464c8f[_0xfee8('0x44')],null))[_0xfee8('0x21')](respondWithResult(_0x9b136b,null))[_0xfee8('0x3f')](handleError(_0x9b136b,null));};exports[_0xfee8('0x45')]=function(_0x127536,_0x175cfa){return db[_0xfee8('0x3b')][_0xfee8('0x42')]({'where':{'id':_0x127536[_0xfee8('0x41')]['id']}})[_0xfee8('0x21')](handleEntityNotFound(_0x175cfa,null))[_0xfee8('0x21')](removeEntity(_0x175cfa,null))['catch'](handleError(_0x175cfa,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c8edf8e..79a2368 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 _0xed1f=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed1f,0x6a));var _0xfed1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xed1f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfed1('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x39a4aa,_0x47898a){var _0x569d1b=function(_0x106f88){while(--_0x106f88){_0x39a4aa['push'](_0x39a4aa['shift']());}};_0x569d1b(++_0x47898a);}(_0x9649,0x19f));var _0x9964=function(_0x3e82af,_0x5efcca){_0x3e82af=_0x3e82af-0x0;var _0xd593c7=_0x9649[_0x3e82af];return _0xd593c7;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9964('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 189389e..b0fa67d 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 _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xeec6,0x1c2));var _0x6eec=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0xeec6[_0x39d6a8];return _0x93f3db;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3e2301,_0x2e3a8d){var _0x2eded3=function(_0x4a600d){while(--_0x4a600d){_0x3e2301['push'](_0x3e2301['shift']());}};_0x2eded3(++_0x2e3a8d);}(_0xa41a,0x6b));var _0xaa41=function(_0xb2a4e2,_0x50b441){_0xb2a4e2=_0xb2a4e2-0x0;var _0x70e8d4=_0xa41a[_0xb2a4e2];return _0x70e8d4;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 11a6185..f3d50dd 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 _0x8d0a=['whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp'];(function(_0x1c6f8,_0x18af22){var _0xc47f94=function(_0x280668){while(--_0x280668){_0x1c6f8['push'](_0x1c6f8['shift']());}};_0xc47f94(++_0x18af22);}(_0x8d0a,0x65));var _0xa8d0=function(_0x2673c6,_0x1f211f){_0x2673c6=_0x2673c6-0x0;var _0x21cf0d=_0x8d0a[_0x2673c6];return _0x21cf0d;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['get']('/:id/messages',auth[_0xa8d0('0xa')](),controller['getMessages']);router[_0xa8d0('0xc')](_0xa8d0('0xf'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')]('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);router[_0xa8d0('0x11')](_0xa8d0('0x13'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x14')]);router['post'](_0xa8d0('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xa8d0('0x16'),_0xa8d0('0x17')),controller['addTags']);router[_0xa8d0('0x18')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),_0xa8d0('0x1a')),controller['update']);router[_0xa8d0('0x1b')](_0xa8d0('0xe'),auth['isAuthenticated'](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),'whatsappinteraction:destroy'),controller[_0xa8d0('0x1c')]);router[_0xa8d0('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa8d0('0x1d')]);module[_0xa8d0('0x1e')]=router; \ No newline at end of file +var _0x7ee1=['whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5ccbe0,_0x13dbc6){_0x5ccbe0=_0x5ccbe0-0x0;var _0xc938f6=_0x7ee1[_0x5ccbe0];return _0xc938f6;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/describe',auth[_0x17ee('0x9')](),controller['describe']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0x17ee('0x9')](),controller['getMessages']);router[_0x17ee('0x7')](_0x17ee('0xb'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x9')](),controller['create']);router[_0x17ee('0xd')](_0x17ee('0xe'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xf')]);router[_0x17ee('0xd')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')](_0x17ee('0x12'),_0x17ee('0x13')),controller[_0x17ee('0x14')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x17ee('0x12'),_0x17ee('0x15')),controller[_0x17ee('0x16')]);router[_0x17ee('0x17')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')]('whatsapp',_0x17ee('0x18')),controller[_0x17ee('0x19')]);router[_0x17ee('0x17')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),controller['removeTags']);module[_0x17ee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 61fa201..56dee90 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 _0xf7d9=['out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x395039,_0x30b465){var _0x37e26e=function(_0x4d4fca){while(--_0x4d4fca){_0x395039['push'](_0x395039['shift']());}};_0x37e26e(++_0x30b465);}(_0xf7d9,0x122));var _0x9f7d=function(_0x53f940,_0x5c9124){_0x53f940=_0x53f940-0x0;var _0x368a8f=_0xf7d9[_0x53f940];return _0x368a8f;};'use strict';var Sequelize=require(_0x9f7d('0x0'));var moment=require(_0x9f7d('0x1'));module[_0x9f7d('0x2')]={'closed':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9f7d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9f7d('0x4')]},'phone':{'type':Sequelize[_0x9f7d('0x4')]},'read1stAt':{'type':Sequelize[_0x9f7d('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9f7d('0x6')]('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9f7d('0x8')]}}; \ No newline at end of file +var _0x0ffc=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','moment','exports'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x9d9843,_0x2c8703){_0x9d9843=_0x9d9843-0x0;var _0x65594f=_0x0ffc[_0x9d9843];return _0x65594f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc0ff('0x0'));module[_0xc0ff('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc0ff('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc0ff('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc0ff('0x3')]},'note':{'type':Sequelize[_0xc0ff('0x3')]},'phone':{'type':Sequelize[_0xc0ff('0x3')]},'read1stAt':{'type':Sequelize[_0xc0ff('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc0ff('0x4')]('in',_0xc0ff('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc0ff('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc0ff('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc0ff('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc0ff('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 73d2b43..4991a98 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 _0x47f2=['format','include','rows','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','createdAt','direction','read','WhatsappAccount','get','Whatsapp','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','ejs','lodash','ioredis','../../config/logger','../../config/environment','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','catch','show','params','keys','attributes','intersection','fields','length','model','includeAll','options','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','order','sort','where','pick','filter','merge','$gte','split'];(function(_0x4fe373,_0x5bb94e){var _0x3ce795=function(_0x4b5426){while(--_0x4b5426){_0x4fe373['push'](_0x4fe373['shift']());}};_0x3ce795(++_0x5bb94e);}(_0x47f2,0xb6));var _0x247f=function(_0x4b9cf6,_0xe2338a){_0x4b9cf6=_0x4b9cf6-0x0;var _0xb9eb5d=_0x47f2[_0x4b9cf6];return _0xb9eb5d;};'use strict';var rimraf=require(_0x247f('0x0'));var zipdir=require(_0x247f('0x1'));var moment=require('moment');var BPromise=require(_0x247f('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x247f('0x3'));var fs=require('fs');var _=require(_0x247f('0x4'));var Redis=require(_0x247f('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x247f('0x6'))('api');var config=require(_0x247f('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x247f('0x8')](config[_0x247f('0x9')],{'host':_0x247f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x247f('0x9')]));require(_0x247f('0xb'))[_0x247f('0xc')](socket);function respondWithStatusCode(_0x4ff09b,_0x5073f1){_0x5073f1=_0x5073f1||0xcc;return function(_0xa5a536){if(_0xa5a536){return _0x4ff09b[_0x247f('0xd')](_0x5073f1);}return _0x4ff09b[_0x247f('0xe')](_0x5073f1)[_0x247f('0xf')]();};}function respondWithResult(_0x346ae0,_0x3c93fb){_0x3c93fb=_0x3c93fb||0xc8;return function(_0x38a4e2){if(_0x38a4e2){return _0x346ae0['status'](_0x3c93fb)[_0x247f('0x10')](_0x38a4e2);}};}function respondWithFilteredResult(_0x398146,_0x289ee7){return function(_0x1eda8d){if(_0x1eda8d){var _0x43b0a4=typeof _0x289ee7[_0x247f('0x11')]===_0x247f('0x12')&&typeof _0x289ee7[_0x247f('0x13')]===_0x247f('0x12');var _0xa984fc=_0x1eda8d[_0x247f('0x14')];var _0x1babcf=_0x43b0a4?0x0:_0x289ee7[_0x247f('0x11')];var _0x5c9578=_0x43b0a4?_0x1eda8d[_0x247f('0x14')]:_0x289ee7[_0x247f('0x11')]+_0x289ee7[_0x247f('0x13')];var _0x53f99b;if(_0x5c9578>=_0xa984fc){_0x5c9578=_0xa984fc;_0x53f99b=0xc8;}else{_0x53f99b=0xce;}_0x398146[_0x247f('0xe')](_0x53f99b);return _0x398146[_0x247f('0x15')](_0x247f('0x16'),_0x1babcf+'-'+_0x5c9578+'/'+_0xa984fc)[_0x247f('0x10')](_0x1eda8d);}return null;};}function saveUpdates(_0x45e418){return function(_0x2a702f){if(_0x2a702f){return _0x2a702f[_0x247f('0x17')](_0x45e418)['then'](function(_0x350b04){return _0x350b04;});}return null;};}function removeEntity(_0x5e406b){return function(_0x3df745){if(_0x3df745){return _0x3df745[_0x247f('0x18')]()[_0x247f('0x19')](function(){_0x5e406b[_0x247f('0xe')](0xcc)[_0x247f('0xf')]();});}};}function handleEntityNotFound(_0x10befd){return function(_0x19c60b){if(!_0x19c60b){_0x10befd[_0x247f('0xd')](0x194);}return _0x19c60b;};}function handleError(_0x1f57cd,_0x592435){_0x592435=_0x592435||0x1f4;return function(_0x3a20c1){logger['error'](_0x3a20c1[_0x247f('0x1a')]);if(_0x3a20c1[_0x247f('0x1b')]){delete _0x3a20c1[_0x247f('0x1b')];}_0x1f57cd['status'](_0x592435)[_0x247f('0x1c')](_0x3a20c1);};}exports[_0x247f('0x1d')]=function(_0x2ef2e0,_0xdcb597){var _0xcb0729={};var _0xa4a7a2=_[_0x247f('0x1e')](db[_0x247f('0x1f')][_0x247f('0x20')],function(_0x56fe25){return{'name':_0x56fe25[_0x247f('0x21')],'type':_0x56fe25[_0x247f('0x22')][_0x247f('0x23')]};});_0xcb0729=qs['getOptions'](_0xa4a7a2,_0x2ef2e0);return interaction[_0x247f('0x24')](_0x247f('0x25'),_0x2ef2e0[_0x247f('0x26')],_0x2ef2e0['user'],_0xcb0729,_0xa4a7a2)['then'](respondWithFilteredResult(_0xdcb597,_0xcb0729))[_0x247f('0x27')](handleError(_0xdcb597,null));};exports[_0x247f('0x28')]=function(_0x7c9fa4,_0x4ce15c){var _0x5aa039={'raw':![],'where':{'id':_0x7c9fa4[_0x247f('0x29')]['id']}},_0x2336bf={};_0x2336bf['model']=_[_0x247f('0x2a')](db[_0x247f('0x1f')]['rawAttributes']);_0x2336bf['query']=_[_0x247f('0x2a')](_0x7c9fa4['query']);_0x2336bf['filters']=_['intersection'](_0x2336bf['model'],_0x2336bf[_0x247f('0x26')]);_0x5aa039[_0x247f('0x2b')]=_[_0x247f('0x2c')](_0x2336bf['model'],qs[_0x247f('0x2d')](_0x7c9fa4['query'][_0x247f('0x2d')]));_0x5aa039['attributes']=_0x5aa039[_0x247f('0x2b')][_0x247f('0x2e')]?_0x5aa039[_0x247f('0x2b')]:_0x2336bf[_0x247f('0x2f')];if(_0x7c9fa4[_0x247f('0x26')][_0x247f('0x30')]){_0x5aa039['include']=[{'all':!![]}];}_0x5aa039=_['merge']({},_0x5aa039,_0x7c9fa4[_0x247f('0x31')]);return db[_0x247f('0x1f')]['find'](_0x5aa039)[_0x247f('0x19')](handleEntityNotFound(_0x4ce15c,null))[_0x247f('0x19')](respondWithResult(_0x4ce15c,null))[_0x247f('0x27')](handleError(_0x4ce15c,null));};exports[_0x247f('0x32')]=function(_0x25b3bd,_0x45cab0){return db['WhatsappInteraction'][_0x247f('0x32')](_0x25b3bd[_0x247f('0x33')],{})[_0x247f('0x19')](respondWithResult(_0x45cab0,0xc9))[_0x247f('0x27')](handleError(_0x45cab0,null));};exports[_0x247f('0x17')]=function(_0x4c8d7a,_0x10937f){if(_0x4c8d7a[_0x247f('0x33')]['id']){delete _0x4c8d7a[_0x247f('0x33')]['id'];}return db[_0x247f('0x1f')][_0x247f('0x34')]({'where':{'id':_0x4c8d7a[_0x247f('0x29')]['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x10937f,null))[_0x247f('0x19')](saveUpdates(_0x4c8d7a[_0x247f('0x33')],null))[_0x247f('0x19')](respondWithResult(_0x10937f,null))['catch'](handleError(_0x10937f,null));};exports[_0x247f('0x18')]=function(_0x4ecd96,_0x9e16e4){return db[_0x247f('0x1f')][_0x247f('0x34')]({'where':{'id':_0x4ecd96[_0x247f('0x29')]['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x9e16e4,null))['then'](removeEntity(_0x9e16e4,null))[_0x247f('0x27')](handleError(_0x9e16e4,null));};exports[_0x247f('0x35')]=function(_0x31f262,_0x63896f){return db[_0x247f('0x1f')][_0x247f('0x35')]()[_0x247f('0x19')](respondWithResult(_0x63896f,null))[_0x247f('0x27')](handleError(_0x63896f,null));};exports[_0x247f('0x36')]=function(_0x321b10,_0x5e6485){return db[_0x247f('0x37')][_0x247f('0x34')]({'where':{'id':_0x321b10[_0x247f('0x29')]['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x5e6485,null))[_0x247f('0x19')](function(_0x2226a7){if(_0x2226a7){return _0x2226a7['addMessage'](_0x321b10['body'][_0x247f('0x38')],_[_0x247f('0x39')](_0x321b10['body'],['ids','id'])||{});}})[_0x247f('0x19')](respondWithResult(_0x5e6485,null))[_0x247f('0x27')](handleError(_0x5e6485,null));};exports[_0x247f('0x3a')]=function(_0x32a4d6,_0x541d0a){var _0x10c29a={'raw':![],'where':{}};var _0x33a61c={};var _0x39e24c={'count':0x0,'rows':[]};return db[_0x247f('0x1f')][_0x247f('0x3b')]({'where':{'id':_0x32a4d6[_0x247f('0x29')]['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x541d0a,null))[_0x247f('0x19')](function(_0xb1b6a9){if(_0xb1b6a9){_0x33a61c['model']=_['keys'](db[_0x247f('0x37')][_0x247f('0x20')]);_0x33a61c['query']=_[_0x247f('0x2a')](_0x32a4d6[_0x247f('0x26')]);_0x33a61c[_0x247f('0x3c')]=_[_0x247f('0x2c')](_0x33a61c[_0x247f('0x2f')],_0x33a61c[_0x247f('0x26')]);_0x10c29a['attributes']=_['intersection'](_0x33a61c[_0x247f('0x2f')],qs[_0x247f('0x2d')](_0x32a4d6['query'][_0x247f('0x2d')]));_0x10c29a['attributes']=_0x10c29a[_0x247f('0x2b')]['length']?_0x10c29a[_0x247f('0x2b')]:_0x33a61c[_0x247f('0x2f')];if(!_0x32a4d6[_0x247f('0x26')][_0x247f('0x3d')]('nolimit')){_0x10c29a['limit']=qs[_0x247f('0x13')](_0x32a4d6[_0x247f('0x26')]['limit']);_0x10c29a['offset']=qs[_0x247f('0x11')](_0x32a4d6[_0x247f('0x26')][_0x247f('0x11')]);}_0x10c29a[_0x247f('0x3e')]=qs['sort'](_0x32a4d6['query'][_0x247f('0x3f')]);_0x10c29a[_0x247f('0x40')]=qs[_0x247f('0x3c')](_[_0x247f('0x41')](_0x32a4d6[_0x247f('0x26')],_0x33a61c[_0x247f('0x3c')]));_0x10c29a[_0x247f('0x40')]['WhatsappInteractionId']=_0xb1b6a9['id'];if(_0x32a4d6[_0x247f('0x26')][_0x247f('0x42')]){_0x10c29a[_0x247f('0x40')]=_[_0x247f('0x43')](_0x10c29a[_0x247f('0x40')],{'$or':_[_0x247f('0x1e')](_0x10c29a['attributes'],function(_0x3fdd7c){var _0x36fb1a={};_0x36fb1a[_0x3fdd7c]={'$like':'%'+_0x32a4d6[_0x247f('0x26')]['filter']+'%'};return _0x36fb1a;})});}if(_0x32a4d6['query'][_0x247f('0x44')]){var _0x1303c9=_0x32a4d6[_0x247f('0x26')][_0x247f('0x44')][_0x247f('0x45')](',');var _0x1fbc66={};_0x1fbc66[_0x1303c9[0x0]]={'$gte':moment(_0x1303c9[0x1])[_0x247f('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10c29a[_0x247f('0x40')]=_['merge'](_0x10c29a[_0x247f('0x40')],_0x1fbc66);}_0x10c29a=_[_0x247f('0x43')]({},_0x10c29a,_0x32a4d6[_0x247f('0x31')]);return db['WhatsappMessage'][_0x247f('0x14')]({'where':_0x10c29a[_0x247f('0x40')]})[_0x247f('0x19')](function(_0x5f2d55){_0x39e24c[_0x247f('0x14')]=_0x5f2d55;if(_0x32a4d6['query'][_0x247f('0x30')]){_0x10c29a[_0x247f('0x47')]=[{'all':!![]}];}return db[_0x247f('0x37')][_0x247f('0x24')](_0x10c29a);})[_0x247f('0x19')](function(_0x569091){_0x39e24c[_0x247f('0x48')]=_0x569091;return _0x39e24c;});}})[_0x247f('0x19')](respondWithFilteredResult(_0x541d0a,_0x10c29a))[_0x247f('0x27')](handleError(_0x541d0a,null));};exports['addTags']=function(_0x587796,_0x3876cf){return db[_0x247f('0x1f')][_0x247f('0x34')]({'where':{'id':_0x587796['params']['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x3876cf,null))[_0x247f('0x19')](function(_0x2638e4){if(_0x2638e4){return _0x2638e4['setTags'](_0x587796[_0x247f('0x33')]['ids'],_[_0x247f('0x39')](_0x587796[_0x247f('0x33')],[_0x247f('0x38'),'id'])||{})[_0x247f('0x49')](function(){return db[_0x247f('0x4a')][_0x247f('0x24')]({'attributes':['id',_0x247f('0x1b'),'color'],'where':{'id':_0x587796[_0x247f('0x33')][_0x247f('0x38')]}});})[_0x247f('0x19')](function(_0x4cf8a2){socket[_0x247f('0x4b')](_0x247f('0x4c'),{'id':Number(_0x587796['params']['id']),'tags':_0x4cf8a2||[]});return{'id':Number(_0x587796['params']['id']),'tags':_0x4cf8a2||[]};});}})[_0x247f('0x19')](respondWithResult(_0x3876cf,null))['catch'](handleError(_0x3876cf,null));};exports[_0x247f('0x4d')]=function(_0xbbe65b,_0x2a249b){return db[_0x247f('0x1f')]['find']({'where':{'id':_0xbbe65b[_0x247f('0x29')]['id']}})[_0x247f('0x19')](handleEntityNotFound(_0x2a249b,null))[_0x247f('0x19')](function(_0x570ddb){if(_0x570ddb){return _0x570ddb['removeTags'](_0xbbe65b['query'][_0x247f('0x38')]);}})['then'](respondWithStatusCode(_0x2a249b,null))['catch'](handleError(_0x2a249b,null));};exports[_0x247f('0x4e')]=function(_0x27dd22,_0x14e439){var _0x27035b=moment()[_0x247f('0x4f')]()[_0x247f('0x50')]();var _0x2a825b=path[_0x247f('0x51')](config['root'],_0x247f('0x52'),_0x247f('0x53'),_0x247f('0x54'));var _0x4e49a4=path[_0x247f('0x51')](config[_0x247f('0x55')],_0x247f('0x52'),_0x247f('0x53'),_0x247f('0x56'));var _0x5a5254=path['join'](_0x2a825b,_0x27035b);var _0x5a8ca1=util[_0x247f('0x46')](_0x247f('0x57'),_0x27dd22[_0x247f('0x29')]['id'],_0x27035b);var _0x19d88c=path[_0x247f('0x51')](_0x2a825b,_0x5a8ca1);var _0x4d28cb=[];_0x4d28cb[_0x247f('0x58')]({'model':db[_0x247f('0x59')],'as':_0x247f('0x59'),'attributes':['id',_0x247f('0x5a')],'raw':!![]});_0x4d28cb[_0x247f('0x58')]({'model':db[_0x247f('0x5b')],'as':_0x247f('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x27dd22[_0x247f('0x26')][_0x247f('0x56')]){_0x4d28cb[_0x247f('0x58')]({'model':db[_0x247f('0x5d')],'as':_0x247f('0x5d'),'raw':!![]});}var _0x8c254=[{'model':db['WhatsappMessage'],'as':_0x247f('0x5e'),'attributes':['id','body',_0x247f('0x5f'),_0x247f('0x60'),'secret',_0x247f('0x61')],'include':_0x4d28cb}];_0x8c254[_0x247f('0x58')]({'model':db[_0x247f('0x62')],'as':'Account','attributes':['id',_0x247f('0x1b')]});_0x8c254[_0x247f('0x58')]({'model':db['User'],'as':'Owner','attributes':['id',_0x247f('0x5a')]});return db[_0x247f('0x1f')][_0x247f('0x34')]({'where':{'id':_0x27dd22[_0x247f('0x29')]['id']},'include':_0x8c254})[_0x247f('0x19')](handleEntityNotFound(_0x14e439,null))[_0x247f('0x19')](function(_0x4430de){if(_0x4430de){var _0x4eac40=_0x4430de[_0x247f('0x63')]({'plain':!![]});fs['mkdirSync'](_0x5a5254);var _0x258f7c={'channel':_0x247f('0x64'),'account':_0x4eac40[_0x247f('0x65')][_0x247f('0x1b')],'agent':_0x4eac40[_0x247f('0x66')]?_0x4eac40['Owner']['fullname']:_0x247f('0x67'),'createdAt':moment(_0x4eac40[_0x247f('0x5f')])['format'](_0x247f('0x68'))[_0x247f('0x50')](),'closedAt':_0x4eac40[_0x247f('0x69')]?moment(_0x4eac40[_0x247f('0x6a')])[_0x247f('0x46')](_0x247f('0x68'))['toString']():'','disposition':_0x4eac40[_0x247f('0x6b')],'messages':_(_0x4eac40['Messages'])[_0x247f('0x42')]({'secret':![]})[_0x247f('0x1e')](function(_0x26c51f){if(_0x26c51f['Attachment']){var _0x30b56e=path['join'](_0x4e49a4,_0x26c51f[_0x247f('0x5d')][_0x247f('0x6c')]);if(fs[_0x247f('0x6d')](_0x30b56e)){fs[_0x247f('0x6e')](_0x30b56e)[_0x247f('0x6f')](fs[_0x247f('0x70')](path[_0x247f('0x51')](_0x5a5254,_0x26c51f[_0x247f('0x5d')]['basename'])));}}return{'date':moment(_0x26c51f['createdAt'])[_0x247f('0x46')](_0x247f('0x68'))[_0x247f('0x50')](),'sender':_0x26c51f['direction']===_0x247f('0x71')?_0x26c51f[_0x247f('0x59')]?_0x26c51f[_0x247f('0x59')][_0x247f('0x5a')]:_0x247f('0x72'):_0x26c51f[_0x247f('0x5c')][_0x247f('0x73')]+(_0x26c51f[_0x247f('0x5c')][_0x247f('0x74')]?'\x20'+_0x26c51f['Contact'][_0x247f('0x74')]:''),'body':_0x26c51f[_0x247f('0x5d')]?_0x26c51f[_0x247f('0x5d')][_0x247f('0x6c')]:_0x26c51f[_0x247f('0x33')],'direction':_0x26c51f[_0x247f('0x60')]==='out'?'A':'C','secret':_0x26c51f[_0x247f('0x75')],'read':_0x26c51f[_0x247f('0x61')],'attachment':_0x26c51f[_0x247f('0x5d')]};})[_0x247f('0x76')]()};return ejs[_0x247f('0x77')](path[_0x247f('0x51')](config['root'],_0x247f('0x52'),'views',_0x247f('0x78')),{'interaction':_0x258f7c})[_0x247f('0x19')](function(_0x238367){var _0x74c3f1=path[_0x247f('0x51')](_0x5a5254,_0x247f('0x79')+_0x4eac40['id']+'-'+_0x27035b+_0x247f('0x7a'));var _0x1aa301={'path':_0x74c3f1,'channel':'Whatsapp','interactionId':_0x4eac40['id']};return pdf[_0x247f('0x7b')](_0x238367,_0x1aa301);})[_0x247f('0x19')](function(){return new BPromise(function(_0x1294eb,_0x836c38){zipdir(_0x5a5254,{'saveTo':_0x19d88c},function(_0x478c6e,_0x2f573f){if(_0x478c6e)return _0x836c38(_0x478c6e);return _0x1294eb(_0x2f573f);});})['then'](function(){return new BPromise(function(_0x15316c,_0x11fa3e){rimraf(_0x5a5254,function(_0x32272a){if(_0x32272a)_0x11fa3e(_0x32272a);return _0x15316c();});});})[_0x247f('0x19')](function(){return _0x14e439[_0x247f('0x4e')](_0x19d88c,_0x5a8ca1,function(_0x25a5d3){if(_0x25a5d3){console[_0x247f('0x7c')](_0x247f('0x7d'),_0x25a5d3);}else{fs['unlinkSync'](_0x19d88c);}});});});}else{return _0x14e439[_0x247f('0xd')](0xc8);}})[_0x247f('0x27')](handleError(_0x14e439,null));}; \ No newline at end of file +var _0x3b33=['merge','options','find','catch','create','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','nolimit','sort','where','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','Owner','get','mkdirSync','Whatsapp','Account','fullname','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','System','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','key','findAll','whatsapp','show','params','model','keys','query','filters','intersection','attributes','fields','length','include'];(function(_0x12f092,_0x4ab1d9){var _0x2d35a8=function(_0xd87bb0){while(--_0xd87bb0){_0x12f092['push'](_0x12f092['shift']());}};_0x2d35a8(++_0x4ab1d9);}(_0x3b33,0x13c));var _0x33b3=function(_0x31e985,_0x59253b){_0x31e985=_0x31e985-0x0;var _0x33bfc9=_0x3b33[_0x31e985];return _0x33bfc9;};'use strict';var rimraf=require(_0x33b3('0x0'));var zipdir=require(_0x33b3('0x1'));var moment=require(_0x33b3('0x2'));var BPromise=require('bluebird');var util=require(_0x33b3('0x3'));var path=require(_0x33b3('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x33b3('0x5'));var Redis=require(_0x33b3('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x33b3('0x7'));var pdf=require(_0x33b3('0x8'));var logger=require(_0x33b3('0x9'))('api');var config=require(_0x33b3('0xa'));var db=require('../../mysqldb')['db'];config[_0x33b3('0xb')]=_[_0x33b3('0xc')](config['redis'],{'host':_0x33b3('0xd'),'port':0x18eb});var socket=require(_0x33b3('0xe'))(new Redis(config['redis']));require(_0x33b3('0xf'))['register'](socket);function respondWithStatusCode(_0x1f0df0,_0x488570){_0x488570=_0x488570||0xcc;return function(_0x5a29bd){if(_0x5a29bd){return _0x1f0df0[_0x33b3('0x10')](_0x488570);}return _0x1f0df0['status'](_0x488570)[_0x33b3('0x11')]();};}function respondWithResult(_0x5674da,_0x54ee0e){_0x54ee0e=_0x54ee0e||0xc8;return function(_0x35024c){if(_0x35024c){return _0x5674da['status'](_0x54ee0e)[_0x33b3('0x12')](_0x35024c);}};}function respondWithFilteredResult(_0x381201,_0xb294c1){return function(_0x6fa6be){if(_0x6fa6be){var _0x4384b1=typeof _0xb294c1[_0x33b3('0x13')]===_0x33b3('0x14')&&typeof _0xb294c1[_0x33b3('0x15')]===_0x33b3('0x14');var _0x48716d=_0x6fa6be['count'];var _0x3e269a=_0x4384b1?0x0:_0xb294c1[_0x33b3('0x13')];var _0x295e5e=_0x4384b1?_0x6fa6be['count']:_0xb294c1[_0x33b3('0x13')]+_0xb294c1['limit'];var _0x1d4447;if(_0x295e5e>=_0x48716d){_0x295e5e=_0x48716d;_0x1d4447=0xc8;}else{_0x1d4447=0xce;}_0x381201[_0x33b3('0x16')](_0x1d4447);return _0x381201[_0x33b3('0x17')](_0x33b3('0x18'),_0x3e269a+'-'+_0x295e5e+'/'+_0x48716d)['json'](_0x6fa6be);}return null;};}function saveUpdates(_0x3368ba){return function(_0x15069a){if(_0x15069a){return _0x15069a[_0x33b3('0x19')](_0x3368ba)['then'](function(_0x4e3ca7){return _0x4e3ca7;});}return null;};}function removeEntity(_0x357eb0){return function(_0x22d998){if(_0x22d998){return _0x22d998[_0x33b3('0x1a')]()[_0x33b3('0x1b')](function(){_0x357eb0[_0x33b3('0x16')](0xcc)[_0x33b3('0x11')]();});}};}function handleEntityNotFound(_0x513962){return function(_0x2f1835){if(!_0x2f1835){_0x513962['sendStatus'](0x194);}return _0x2f1835;};}function handleError(_0x28a1b0,_0x118748){_0x118748=_0x118748||0x1f4;return function(_0xba993e){logger[_0x33b3('0x1c')](_0xba993e[_0x33b3('0x1d')]);if(_0xba993e['name']){delete _0xba993e[_0x33b3('0x1e')];}_0x28a1b0[_0x33b3('0x16')](_0x118748)[_0x33b3('0x1f')](_0xba993e);};}exports[_0x33b3('0x20')]=function(_0x134f31,_0x3da7c3){var _0x5c14fb={};var _0x3b77fa=_[_0x33b3('0x21')](db[_0x33b3('0x22')][_0x33b3('0x23')],function(_0x36fc96){return{'name':_0x36fc96['fieldName'],'type':_0x36fc96['type'][_0x33b3('0x24')]};});_0x5c14fb=qs['getOptions'](_0x3b77fa,_0x134f31);return interaction[_0x33b3('0x25')](_0x33b3('0x26'),_0x134f31['query'],_0x134f31['user'],_0x5c14fb,_0x3b77fa)['then'](respondWithFilteredResult(_0x3da7c3,_0x5c14fb))['catch'](handleError(_0x3da7c3,null));};exports[_0x33b3('0x27')]=function(_0x42a377,_0x577a34){var _0x418cc3={'raw':![],'where':{'id':_0x42a377[_0x33b3('0x28')]['id']}},_0x3cb6fe={};_0x3cb6fe[_0x33b3('0x29')]=_[_0x33b3('0x2a')](db[_0x33b3('0x22')][_0x33b3('0x23')]);_0x3cb6fe['query']=_[_0x33b3('0x2a')](_0x42a377[_0x33b3('0x2b')]);_0x3cb6fe[_0x33b3('0x2c')]=_[_0x33b3('0x2d')](_0x3cb6fe['model'],_0x3cb6fe[_0x33b3('0x2b')]);_0x418cc3[_0x33b3('0x2e')]=_[_0x33b3('0x2d')](_0x3cb6fe[_0x33b3('0x29')],qs[_0x33b3('0x2f')](_0x42a377[_0x33b3('0x2b')][_0x33b3('0x2f')]));_0x418cc3[_0x33b3('0x2e')]=_0x418cc3[_0x33b3('0x2e')][_0x33b3('0x30')]?_0x418cc3[_0x33b3('0x2e')]:_0x3cb6fe[_0x33b3('0x29')];if(_0x42a377[_0x33b3('0x2b')]['includeAll']){_0x418cc3[_0x33b3('0x31')]=[{'all':!![]}];}_0x418cc3=_[_0x33b3('0x32')]({},_0x418cc3,_0x42a377[_0x33b3('0x33')]);return db[_0x33b3('0x22')][_0x33b3('0x34')](_0x418cc3)[_0x33b3('0x1b')](handleEntityNotFound(_0x577a34,null))['then'](respondWithResult(_0x577a34,null))[_0x33b3('0x35')](handleError(_0x577a34,null));};exports['create']=function(_0x532be2,_0x49ae45){return db[_0x33b3('0x22')][_0x33b3('0x36')](_0x532be2[_0x33b3('0x37')],{})['then'](respondWithResult(_0x49ae45,0xc9))[_0x33b3('0x35')](handleError(_0x49ae45,null));};exports[_0x33b3('0x19')]=function(_0x3dc3c6,_0x440e36){if(_0x3dc3c6['body']['id']){delete _0x3dc3c6['body']['id'];}return db[_0x33b3('0x22')][_0x33b3('0x34')]({'where':{'id':_0x3dc3c6['params']['id']}})['then'](handleEntityNotFound(_0x440e36,null))[_0x33b3('0x1b')](saveUpdates(_0x3dc3c6[_0x33b3('0x37')],null))[_0x33b3('0x1b')](respondWithResult(_0x440e36,null))[_0x33b3('0x35')](handleError(_0x440e36,null));};exports[_0x33b3('0x1a')]=function(_0x29e262,_0x159955){return db[_0x33b3('0x22')][_0x33b3('0x34')]({'where':{'id':_0x29e262['params']['id']}})[_0x33b3('0x1b')](handleEntityNotFound(_0x159955,null))[_0x33b3('0x1b')](removeEntity(_0x159955,null))['catch'](handleError(_0x159955,null));};exports[_0x33b3('0x38')]=function(_0x17b2d7,_0x54a58e){return db[_0x33b3('0x22')][_0x33b3('0x38')]()[_0x33b3('0x1b')](respondWithResult(_0x54a58e,null))[_0x33b3('0x35')](handleError(_0x54a58e,null));};exports[_0x33b3('0x39')]=function(_0x212917,_0x479f91){return db[_0x33b3('0x3a')][_0x33b3('0x34')]({'where':{'id':_0x212917[_0x33b3('0x28')]['id']}})[_0x33b3('0x1b')](handleEntityNotFound(_0x479f91,null))[_0x33b3('0x1b')](function(_0x15a8b5){if(_0x15a8b5){return _0x15a8b5[_0x33b3('0x39')](_0x212917[_0x33b3('0x37')]['ids'],_[_0x33b3('0x3b')](_0x212917[_0x33b3('0x37')],[_0x33b3('0x3c'),'id'])||{});}})[_0x33b3('0x1b')](respondWithResult(_0x479f91,null))[_0x33b3('0x35')](handleError(_0x479f91,null));};exports[_0x33b3('0x3d')]=function(_0x40b9f2,_0x4dbb76){var _0x34de96={'raw':![],'where':{}};var _0x2d6bf3={};var _0x4d4066={'count':0x0,'rows':[]};return db[_0x33b3('0x22')][_0x33b3('0x3e')]({'where':{'id':_0x40b9f2[_0x33b3('0x28')]['id']}})[_0x33b3('0x1b')](handleEntityNotFound(_0x4dbb76,null))[_0x33b3('0x1b')](function(_0xb9d9b1){if(_0xb9d9b1){_0x2d6bf3['model']=_['keys'](db[_0x33b3('0x3a')][_0x33b3('0x23')]);_0x2d6bf3[_0x33b3('0x2b')]=_['keys'](_0x40b9f2[_0x33b3('0x2b')]);_0x2d6bf3[_0x33b3('0x2c')]=_['intersection'](_0x2d6bf3[_0x33b3('0x29')],_0x2d6bf3[_0x33b3('0x2b')]);_0x34de96[_0x33b3('0x2e')]=_['intersection'](_0x2d6bf3['model'],qs[_0x33b3('0x2f')](_0x40b9f2[_0x33b3('0x2b')][_0x33b3('0x2f')]));_0x34de96[_0x33b3('0x2e')]=_0x34de96[_0x33b3('0x2e')]['length']?_0x34de96[_0x33b3('0x2e')]:_0x2d6bf3[_0x33b3('0x29')];if(!_0x40b9f2['query']['hasOwnProperty'](_0x33b3('0x3f'))){_0x34de96['limit']=qs[_0x33b3('0x15')](_0x40b9f2['query'][_0x33b3('0x15')]);_0x34de96[_0x33b3('0x13')]=qs[_0x33b3('0x13')](_0x40b9f2[_0x33b3('0x2b')][_0x33b3('0x13')]);}_0x34de96['order']=qs['sort'](_0x40b9f2[_0x33b3('0x2b')][_0x33b3('0x40')]);_0x34de96[_0x33b3('0x41')]=qs[_0x33b3('0x2c')](_['pick'](_0x40b9f2['query'],_0x2d6bf3[_0x33b3('0x2c')]));_0x34de96['where'][_0x33b3('0x42')]=_0xb9d9b1['id'];if(_0x40b9f2[_0x33b3('0x2b')]['filter']){_0x34de96[_0x33b3('0x41')]=_[_0x33b3('0x32')](_0x34de96[_0x33b3('0x41')],{'$or':_[_0x33b3('0x21')](_0x34de96[_0x33b3('0x2e')],function(_0x50d472){var _0xc52899={};_0xc52899[_0x50d472]={'$like':'%'+_0x40b9f2[_0x33b3('0x2b')]['filter']+'%'};return _0xc52899;})});}if(_0x40b9f2[_0x33b3('0x2b')]['$gte']){var _0x54afc1=_0x40b9f2['query'][_0x33b3('0x43')]['split'](',');var _0x5efae5={};_0x5efae5[_0x54afc1[0x0]]={'$gte':moment(_0x54afc1[0x1])[_0x33b3('0x44')](_0x33b3('0x45'))};_0x34de96['where']=_['merge'](_0x34de96['where'],_0x5efae5);}_0x34de96=_[_0x33b3('0x32')]({},_0x34de96,_0x40b9f2[_0x33b3('0x33')]);return db[_0x33b3('0x3a')][_0x33b3('0x46')]({'where':_0x34de96[_0x33b3('0x41')]})[_0x33b3('0x1b')](function(_0x2c7811){_0x4d4066[_0x33b3('0x46')]=_0x2c7811;if(_0x40b9f2[_0x33b3('0x2b')][_0x33b3('0x47')]){_0x34de96['include']=[{'all':!![]}];}return db[_0x33b3('0x3a')][_0x33b3('0x25')](_0x34de96);})[_0x33b3('0x1b')](function(_0x13a43c){_0x4d4066[_0x33b3('0x48')]=_0x13a43c;return _0x4d4066;});}})[_0x33b3('0x1b')](respondWithFilteredResult(_0x4dbb76,_0x34de96))['catch'](handleError(_0x4dbb76,null));};exports[_0x33b3('0x49')]=function(_0x5e7cc3,_0x10c609){return db[_0x33b3('0x22')][_0x33b3('0x34')]({'where':{'id':_0x5e7cc3['params']['id']}})['then'](handleEntityNotFound(_0x10c609,null))[_0x33b3('0x1b')](function(_0x2484c5){if(_0x2484c5){return _0x2484c5[_0x33b3('0x4a')](_0x5e7cc3['body'][_0x33b3('0x3c')],_[_0x33b3('0x3b')](_0x5e7cc3[_0x33b3('0x37')],[_0x33b3('0x3c'),'id'])||{})['spread'](function(){return db[_0x33b3('0x4b')][_0x33b3('0x25')]({'attributes':['id','name',_0x33b3('0x4c')],'where':{'id':_0x5e7cc3[_0x33b3('0x37')][_0x33b3('0x3c')]}});})[_0x33b3('0x1b')](function(_0x5522f4){socket[_0x33b3('0x4d')](_0x33b3('0x4e'),{'id':Number(_0x5e7cc3[_0x33b3('0x28')]['id']),'tags':_0x5522f4||[]});return{'id':Number(_0x5e7cc3[_0x33b3('0x28')]['id']),'tags':_0x5522f4||[]};});}})[_0x33b3('0x1b')](respondWithResult(_0x10c609,null))[_0x33b3('0x35')](handleError(_0x10c609,null));};exports[_0x33b3('0x4f')]=function(_0x1d4544,_0x5617b3){return db['WhatsappInteraction'][_0x33b3('0x34')]({'where':{'id':_0x1d4544[_0x33b3('0x28')]['id']}})['then'](handleEntityNotFound(_0x5617b3,null))['then'](function(_0xde1781){if(_0xde1781){return _0xde1781['removeTags'](_0x1d4544['query'][_0x33b3('0x3c')]);}})['then'](respondWithStatusCode(_0x5617b3,null))[_0x33b3('0x35')](handleError(_0x5617b3,null));};exports[_0x33b3('0x50')]=function(_0x235434,_0xef6406){var _0x2f099a=moment()['unix']()[_0x33b3('0x51')]();var _0x3c786e=path[_0x33b3('0x52')](config[_0x33b3('0x53')],_0x33b3('0x54'),_0x33b3('0x55'),_0x33b3('0x56'));var _0x2a2e61=path[_0x33b3('0x52')](config[_0x33b3('0x53')],'server','files','attachments');var _0x1830d5=path[_0x33b3('0x52')](_0x3c786e,_0x2f099a);var _0x2586bd=util[_0x33b3('0x44')](_0x33b3('0x57'),_0x235434[_0x33b3('0x28')]['id'],_0x2f099a);var _0x17353b=path[_0x33b3('0x52')](_0x3c786e,_0x2586bd);var _0x1518f0=[];_0x1518f0[_0x33b3('0x58')]({'model':db[_0x33b3('0x59')],'as':_0x33b3('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x1518f0[_0x33b3('0x58')]({'model':db[_0x33b3('0x5a')],'as':_0x33b3('0x5b'),'attributes':['id',_0x33b3('0x5c'),'lastName'],'raw':!![]});if(_0x235434[_0x33b3('0x2b')][_0x33b3('0x5d')]){_0x1518f0[_0x33b3('0x58')]({'model':db[_0x33b3('0x5e')],'as':_0x33b3('0x5e'),'raw':!![]});}var _0x38fcc0=[{'model':db[_0x33b3('0x3a')],'as':_0x33b3('0x5f'),'attributes':['id','body',_0x33b3('0x60'),_0x33b3('0x61'),_0x33b3('0x62'),'read'],'include':_0x1518f0}];_0x38fcc0[_0x33b3('0x58')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x33b3('0x1e')]});_0x38fcc0[_0x33b3('0x58')]({'model':db[_0x33b3('0x59')],'as':_0x33b3('0x63'),'attributes':['id','fullname']});return db[_0x33b3('0x22')][_0x33b3('0x34')]({'where':{'id':_0x235434[_0x33b3('0x28')]['id']},'include':_0x38fcc0})[_0x33b3('0x1b')](handleEntityNotFound(_0xef6406,null))['then'](function(_0x365381){if(_0x365381){var _0xa471c4=_0x365381[_0x33b3('0x64')]({'plain':!![]});fs[_0x33b3('0x65')](_0x1830d5);var _0x585fa8={'channel':_0x33b3('0x66'),'account':_0xa471c4[_0x33b3('0x67')][_0x33b3('0x1e')],'agent':_0xa471c4[_0x33b3('0x63')]?_0xa471c4['Owner'][_0x33b3('0x68')]:'N.A.','createdAt':moment(_0xa471c4[_0x33b3('0x60')])[_0x33b3('0x44')](_0x33b3('0x45'))[_0x33b3('0x51')](),'closedAt':_0xa471c4[_0x33b3('0x69')]?moment(_0xa471c4[_0x33b3('0x6a')])['format'](_0x33b3('0x45'))[_0x33b3('0x51')]():'','disposition':_0xa471c4[_0x33b3('0x6b')],'messages':_(_0xa471c4[_0x33b3('0x5f')])['filter']({'secret':![]})['map'](function(_0x3afb25){if(_0x3afb25[_0x33b3('0x5e')]){var _0x1ca2c2=path[_0x33b3('0x52')](_0x2a2e61,_0x3afb25[_0x33b3('0x5e')]['basename']);if(fs[_0x33b3('0x6c')](_0x1ca2c2)){fs[_0x33b3('0x6d')](_0x1ca2c2)[_0x33b3('0x6e')](fs['createWriteStream'](path[_0x33b3('0x52')](_0x1830d5,_0x3afb25['Attachment'][_0x33b3('0x6f')])));}}return{'date':moment(_0x3afb25[_0x33b3('0x60')])['format'](_0x33b3('0x45'))['toString'](),'sender':_0x3afb25['direction']===_0x33b3('0x70')?_0x3afb25[_0x33b3('0x59')]?_0x3afb25['User'][_0x33b3('0x68')]:_0x33b3('0x71'):_0x3afb25['Contact'][_0x33b3('0x5c')]+(_0x3afb25[_0x33b3('0x5b')]['lastName']?'\x20'+_0x3afb25[_0x33b3('0x5b')][_0x33b3('0x72')]:''),'body':_0x3afb25[_0x33b3('0x5e')]?_0x3afb25[_0x33b3('0x5e')][_0x33b3('0x6f')]:_0x3afb25[_0x33b3('0x37')],'direction':_0x3afb25[_0x33b3('0x61')]===_0x33b3('0x70')?'A':'C','secret':_0x3afb25[_0x33b3('0x62')],'read':_0x3afb25[_0x33b3('0x73')],'attachment':_0x3afb25[_0x33b3('0x5e')]};})[_0x33b3('0x74')]()};return ejs[_0x33b3('0x75')](path[_0x33b3('0x52')](config[_0x33b3('0x53')],_0x33b3('0x54'),_0x33b3('0x76'),_0x33b3('0x77')),{'interaction':_0x585fa8})[_0x33b3('0x1b')](function(_0x28e43b){var _0x27e372=path[_0x33b3('0x52')](_0x1830d5,_0x33b3('0x78')+_0xa471c4['id']+'-'+_0x2f099a+_0x33b3('0x79'));var _0x37423d={'path':_0x27e372,'channel':_0x33b3('0x66'),'interactionId':_0xa471c4['id']};return pdf['createPdfFromHTML'](_0x28e43b,_0x37423d);})[_0x33b3('0x1b')](function(){return new BPromise(function(_0x4964c7,_0x48ff12){zipdir(_0x1830d5,{'saveTo':_0x17353b},function(_0x5980a8,_0x200633){if(_0x5980a8)return _0x48ff12(_0x5980a8);return _0x4964c7(_0x200633);});})['then'](function(){return new BPromise(function(_0x42522c,_0x14a545){rimraf(_0x1830d5,function(_0x2e11d8){if(_0x2e11d8)_0x14a545(_0x2e11d8);return _0x42522c();});});})[_0x33b3('0x1b')](function(){return _0xef6406[_0x33b3('0x50')](_0x17353b,_0x2586bd,function(_0x5f34fc){if(_0x5f34fc){console['log']('err',_0x5f34fc);}else{fs['unlinkSync'](_0x17353b);}});});});}else{return _0xef6406[_0x33b3('0x10')](0xc8);}})[_0x33b3('0x35')](handleError(_0xef6406,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 84f7a31..7f5d870 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 _0xbee3=['emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x51e4c4,_0x2f8017){var _0x3f59c6=function(_0x322619){while(--_0x322619){_0x51e4c4['push'](_0x51e4c4['shift']());}};_0x3f59c6(++_0x2f8017);}(_0xbee3,0xd5));var _0x3bee=function(_0x501f36,_0x62dc5b){_0x501f36=_0x501f36-0x0;var _0x21b79b=_0xbee3[_0x501f36];return _0x21b79b;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x3bee('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x3bee('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3bee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bee('0x3'),'afterDestroy':_0x3bee('0x4')};function emitEvent(_0x1cf379){return function(_0x507c6a,_0x33fd9b,_0x3baf77){_0x507c6a['getUsers']({'attributes':['id'],'raw':!![]})[_0x3bee('0x5')](function(_0x28d912){_0x507c6a[_0x3bee('0x6')](_0x3bee('0x7'),_0x28d912[_0x3bee('0x8')](function(_0x9aab05){return{'id':_0x9aab05['id']};}));return WhatsappMessage[_0x3bee('0x9')]({'where':{'WhatsappInteractionId':_0x507c6a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x34cd74){_0x507c6a[_0x3bee('0x6')](_0x3bee('0xa'),_0x34cd74[_0x3bee('0xb')]);WhatsappInteractionEvents[_0x3bee('0xc')](_0x1cf379+':'+_0x507c6a['id'],_0x507c6a);WhatsappInteractionEvents[_0x3bee('0xc')](_0x1cf379,_0x507c6a);_0x3baf77(null);})['catch'](_0x3baf77(null));};}for(var e in events){if(events[_0x3bee('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x3bee('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x74f4=['events','../../mysqldb','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x45adb4,_0x2abb06){var _0x137296=function(_0x552ec9){while(--_0x552ec9){_0x45adb4['push'](_0x45adb4['shift']());}};_0x137296(++_0x2abb06);}(_0x74f4,0xaa));var _0x474f=function(_0x2b1d0e,_0x5c6073){_0x2b1d0e=_0x2b1d0e-0x0;var _0x4a8e9a=_0x74f4[_0x2b1d0e];return _0x4a8e9a;};'use strict';var EventEmitter=require(_0x474f('0x0'));var WhatsappInteraction=require(_0x474f('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x474f('0x1'))['db'][_0x474f('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x474f('0x3'),'afterUpdate':'update','afterDestroy':_0x474f('0x4')};function emitEvent(_0x978477){return function(_0x301664,_0x503ad4,_0x5b6d20){_0x301664[_0x474f('0x5')]({'attributes':['id'],'raw':!![]})[_0x474f('0x6')](function(_0x23c5ce){_0x301664[_0x474f('0x7')](_0x474f('0x8'),_0x23c5ce[_0x474f('0x9')](function(_0x3b06be){return{'id':_0x3b06be['id']};}));return WhatsappMessage[_0x474f('0xa')]({'where':{'WhatsappInteractionId':_0x301664['id'],'direction':'in','read':![]},'raw':!![]});})[_0x474f('0x6')](function(_0x403d67){_0x301664['setDataValue'](_0x474f('0xb'),_0x403d67[_0x474f('0xc')]);WhatsappInteractionEvents[_0x474f('0xd')](_0x978477+':'+_0x301664['id'],_0x301664);WhatsappInteractionEvents['emit'](_0x978477,_0x301664);_0x5b6d20(null);})[_0x474f('0xe')](_0x5b6d20(null));};}for(var e in events){if(events[_0x474f('0xf')](e)){var event=events[e];WhatsappInteraction[_0x474f('0x10')](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 ad7696c..886309a 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 _0x369d=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format'];(function(_0x1b0dfc,_0x5a696f){var _0x22a11b=function(_0xc179a6){while(--_0xc179a6){_0x1b0dfc['push'](_0x1b0dfc['shift']());}};_0x22a11b(++_0x5a696f);}(_0x369d,0x166));var _0xd369=function(_0x4287b4,_0xc3d5e3){_0x4287b4=_0x4287b4-0x0;var _0x108ef3=_0x369d[_0x4287b4];return _0x108ef3;};'use strict';var _=require(_0xd369('0x0'));var util=require(_0xd369('0x1'));var logger=require(_0xd369('0x2'))('api');var moment=require(_0xd369('0x3'));var BPromise=require(_0xd369('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd369('0x5'));var rimraf=require(_0xd369('0x6'));var config=require(_0xd369('0x7'));var attributes=require(_0xd369('0x8'));module[_0xd369('0x9')]=function(_0xc7e189,_0x34fbdf){return _0xc7e189[_0xd369('0xa')](_0xd369('0xb'),attributes,{'tableName':_0xd369('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fcdaf,_0x4138d6,_0x49e764){if(_0x2fcdaf[_0xd369('0xd')]('closed')){_0x2fcdaf[_0xd369('0xe')]=moment()[_0xd369('0xf')](_0xd369('0x10'));}_0x49e764(null,_0x2fcdaf);}}});}; \ No newline at end of file +var _0xf597=['whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf597,0xfc));var _0x7f59=function(_0x5c2b91,_0x291d14){_0x5c2b91=_0x5c2b91-0x0;var _0x10bed3=_0xf597[_0x5c2b91];return _0x10bed3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7f59('0x0'));var moment=require(_0x7f59('0x1'));var BPromise=require(_0x7f59('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f59('0x3'));var rimraf=require(_0x7f59('0x4'));var config=require('../../config/environment');var attributes=require(_0x7f59('0x5'));module[_0x7f59('0x6')]=function(_0x59116b,_0x5884f4){return _0x59116b['define'](_0x7f59('0x7'),attributes,{'tableName':_0x7f59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x549aa3,_0x39b593,_0x1f3eda){if(_0x549aa3['changed'](_0x7f59('0x9'))){_0x549aa3[_0x7f59('0xa')]=moment()[_0x7f59('0xb')](_0x7f59('0xc'));}_0x1f3eda(null,_0x549aa3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c4c98be..fad947c 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 _0x93d4=['raw','where','attributes','limit','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options'];(function(_0x47dff5,_0x136e4a){var _0x1b739b=function(_0x14adb6){while(--_0x14adb6){_0x47dff5['push'](_0x47dff5['shift']());}};_0x1b739b(++_0x136e4a);}(_0x93d4,0xab));var _0x493d=function(_0x5e8208,_0x124ea7){_0x5e8208=_0x5e8208-0x0;var _0x3c8a5b=_0x93d4[_0x5e8208];return _0x3c8a5b;};'use strict';var _=require(_0x493d('0x0'));var util=require(_0x493d('0x1'));var moment=require(_0x493d('0x2'));var BPromise=require(_0x493d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x493d('0x4'));var db=require(_0x493d('0x5'))['db'];var utils=require(_0x493d('0x6'));var logger=require(_0x493d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x493d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x493d('0x9')]=_[_0x493d('0xa')](config[_0x493d('0x9')],{'host':_0x493d('0xb'),'port':0x18eb});var socket=require(_0x493d('0xc'))(new Redis(config[_0x493d('0x9')]));require(_0x493d('0xd'))['register'](socket);function respondWithRpcPromise(_0xa12c08,_0x53211a,_0x455471){return new BPromise(function(_0x4f353a,_0x56b351){return client[_0x493d('0xe')](_0xa12c08,_0x455471)[_0x493d('0xf')](function(_0x97cf19){logger[_0x493d('0x10')](_0x493d('0x11'),_0x53211a,_0x493d('0x12'));logger[_0x493d('0x13')](_0x493d('0x14'),_0x53211a,_0x493d('0x12'),JSON[_0x493d('0x15')](_0x97cf19));if(_0x97cf19[_0x493d('0x16')]){if(_0x97cf19['error']['code']===0x1f4){logger['error'](_0x493d('0x11'),_0x53211a,_0x97cf19[_0x493d('0x16')][_0x493d('0x17')]);return _0x56b351(_0x97cf19[_0x493d('0x16')][_0x493d('0x17')]);}logger['error'](_0x493d('0x11'),_0x53211a,_0x97cf19[_0x493d('0x16')][_0x493d('0x17')]);return _0x4f353a(_0x97cf19[_0x493d('0x16')]['message']);}else{logger[_0x493d('0x10')](_0x493d('0x11'),_0x53211a,_0x493d('0x12'));_0x4f353a(_0x97cf19['result'][_0x493d('0x17')]);}})[_0x493d('0x18')](function(_0xcb8513){logger[_0x493d('0x16')](_0x493d('0x11'),_0x53211a,_0xcb8513);_0x56b351(_0xcb8513);});});}exports[_0x493d('0x19')]=function(_0x1159ef){var _0x55687d=this;return new Promise(function(_0x570f48,_0x5eb28f){return db[_0x493d('0x1a')][_0x493d('0x1b')](_0x1159ef['body'],{'raw':_0x1159ef[_0x493d('0x1c')]?_0x1159ef[_0x493d('0x1c')][_0x493d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1159ef[_0x493d('0x1c')]?_0x1159ef[_0x493d('0x1c')][_0x493d('0x1e')]||null:null,'attributes':_0x1159ef['options']?_0x1159ef[_0x493d('0x1c')][_0x493d('0x1f')]||null:null,'limit':_0x1159ef['options']?_0x1159ef['options'][_0x493d('0x20')]||null:null})['then'](function(_0x5585e1){logger[_0x493d('0x10')](_0x493d('0x19'),_0x1159ef);logger[_0x493d('0x13')]('UpdateWhatsappInteraction',_0x1159ef,JSON[_0x493d('0x15')](_0x5585e1));_0x570f48(_0x5585e1);})[_0x493d('0x18')](function(_0x410af0){logger[_0x493d('0x16')](_0x493d('0x19'),_0x410af0[_0x493d('0x17')],_0x1159ef);_0x5eb28f(_0x55687d[_0x493d('0x16')](0x1f4,_0x410af0['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0xe1e79e){return new Promise(function(_0x3ddd68,_0x2cad1a){return db[_0x493d('0x1a')][_0x493d('0x21')]({'where':_0xe1e79e[_0x493d('0x1c')]?_0xe1e79e[_0x493d('0x1c')][_0x493d('0x1e')]||null:null})[_0x493d('0xf')](function(_0x4f09b2){if(_0x4f09b2){return _0x4f09b2[_0x493d('0x22')](_0xe1e79e[_0x493d('0x23')][_0x493d('0x24')],_[_0x493d('0x25')](_0xe1e79e[_0x493d('0x23')],[_0x493d('0x24'),'id'])||{});}})[_0x493d('0x26')](function(_0x50e2be){logger['info'](_0x493d('0x27'),_0xe1e79e);logger[_0x493d('0x13')]('AddTags',_0xe1e79e,JSON[_0x493d('0x15')](_0x50e2be));_0x3ddd68(_0x50e2be);})['catch'](function(_0x32930a){logger[_0x493d('0x16')](_0x493d('0x27'),_0x32930a[_0x493d('0x17')],_0xe1e79e);_0x2cad1a(_this[_0x493d('0x16')](0x1f4,_0x32930a[_0x493d('0x17')]));});});}; \ No newline at end of file +var _0xde3f=['rpc','jayson/promise','client','http','redis','defaults','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xde3f,0x92));var _0xfde3=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xde3f[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xfde3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde3('0x1'));var rs=require(_0xfde3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde3('0x3'))['db'];var utils=require(_0xfde3('0x4'));var logger=require(_0xfde3('0x5'))(_0xfde3('0x6'));var config=require('../../config/environment');var jayson=require(_0xfde3('0x7'));var client=jayson[_0xfde3('0x8')][_0xfde3('0x9')]({'port':0x232a});config[_0xfde3('0xa')]=_[_0xfde3('0xb')](config[_0xfde3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfde3('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x232704,_0x16d98e,_0x2c7c02){return new BPromise(function(_0x3b3271,_0x198371){return client[_0xfde3('0xc')](_0x232704,_0x2c7c02)[_0xfde3('0xd')](function(_0x5b59a1){logger[_0xfde3('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x16d98e,_0xfde3('0xf'));logger['debug'](_0xfde3('0x10'),_0x16d98e,'request\x20sent',JSON[_0xfde3('0x11')](_0x5b59a1));if(_0x5b59a1[_0xfde3('0x12')]){if(_0x5b59a1[_0xfde3('0x12')]['code']===0x1f4){logger[_0xfde3('0x12')](_0xfde3('0x13'),_0x16d98e,_0x5b59a1[_0xfde3('0x12')]['message']);return _0x198371(_0x5b59a1[_0xfde3('0x12')][_0xfde3('0x14')]);}logger[_0xfde3('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x16d98e,_0x5b59a1[_0xfde3('0x12')][_0xfde3('0x14')]);return _0x3b3271(_0x5b59a1[_0xfde3('0x12')][_0xfde3('0x14')]);}else{logger[_0xfde3('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x16d98e,'request\x20sent');_0x3b3271(_0x5b59a1['result'][_0xfde3('0x14')]);}})[_0xfde3('0x15')](function(_0x4ce668){logger[_0xfde3('0x12')](_0xfde3('0x13'),_0x16d98e,_0x4ce668);_0x198371(_0x4ce668);});});}exports[_0xfde3('0x16')]=function(_0x3f3c73){var _0x28134a=this;return new Promise(function(_0x5745d1,_0xf97374){return db[_0xfde3('0x17')][_0xfde3('0x18')](_0x3f3c73[_0xfde3('0x19')],{'raw':_0x3f3c73[_0xfde3('0x1a')]?_0x3f3c73[_0xfde3('0x1a')][_0xfde3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3c73[_0xfde3('0x1a')]?_0x3f3c73['options'][_0xfde3('0x1c')]||null:null,'attributes':_0x3f3c73[_0xfde3('0x1a')]?_0x3f3c73['options'][_0xfde3('0x1d')]||null:null,'limit':_0x3f3c73[_0xfde3('0x1a')]?_0x3f3c73[_0xfde3('0x1a')][_0xfde3('0x1e')]||null:null})[_0xfde3('0xd')](function(_0x5d9576){logger[_0xfde3('0xe')](_0xfde3('0x16'),_0x3f3c73);logger['debug'](_0xfde3('0x16'),_0x3f3c73,JSON[_0xfde3('0x11')](_0x5d9576));_0x5745d1(_0x5d9576);})[_0xfde3('0x15')](function(_0x252fcf){logger[_0xfde3('0x12')](_0xfde3('0x16'),_0x252fcf[_0xfde3('0x14')],_0x3f3c73);_0xf97374(_0x28134a[_0xfde3('0x12')](0x1f4,_0x252fcf[_0xfde3('0x14')]));});});};exports[_0xfde3('0x1f')]=function(_0x1edc2d){return new Promise(function(_0x47d72e,_0x3bc107){return db[_0xfde3('0x17')][_0xfde3('0x20')]({'where':_0x1edc2d[_0xfde3('0x1a')]?_0x1edc2d['options'][_0xfde3('0x1c')]||null:null})[_0xfde3('0xd')](function(_0x2581cb){if(_0x2581cb){return _0x2581cb[_0xfde3('0x21')](_0x1edc2d['body']['ids'],_['omit'](_0x1edc2d[_0xfde3('0x19')],[_0xfde3('0x22'),'id'])||{});}})[_0xfde3('0x23')](function(_0x5e9256){logger[_0xfde3('0xe')](_0xfde3('0x24'),_0x1edc2d);logger[_0xfde3('0x25')](_0xfde3('0x24'),_0x1edc2d,JSON[_0xfde3('0x11')](_0x5e9256));_0x47d72e(_0x5e9256);})[_0xfde3('0x15')](function(_0x1093be){logger['error'](_0xfde3('0x24'),_0x1093be[_0xfde3('0x14')],_0x1edc2d);_0x3bc107(_this['error'](0x1f4,_0x1093be['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3ee2f47..f1a52d1 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 _0x9a1b=['emit','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0x9a1b,0x13e));var _0xb9a1=function(_0x3f3a31,_0x5c5f9e){_0x3f3a31=_0x3f3a31-0x0;var _0x4ecc75=_0x9a1b[_0x3f3a31];return _0x4ecc75;};'use strict';var WhatsappInteractionEvents=require(_0xb9a1('0x0'));var events=[_0xb9a1('0x1'),_0xb9a1('0x2'),_0xb9a1('0x3')];function createListener(_0x199822,_0x4fca17){return function(_0x12d1ba){_0x4fca17[_0xb9a1('0x4')](_0x199822,_0x12d1ba);};}function removeListener(_0x19ddc9,_0x2c800f){return function(){WhatsappInteractionEvents['removeListener'](_0x19ddc9,_0x2c800f);};}exports[_0xb9a1('0x5')]=function(_0x3ac788){for(var _0x3b171a=0x0,_0x4aa4bb=events['length'];_0x3b171a<_0x4aa4bb;_0x3b171a++){var _0x2574dc=events[_0x3b171a];var _0x448a87=createListener(_0xb9a1('0x6')+_0x2574dc,_0x3ac788);WhatsappInteractionEvents['on'](_0x2574dc,_0x448a87);}}; \ No newline at end of file +var _0x77bb=['remove','update','emit','removeListener','register','./whatsappInteraction.events','save'];(function(_0x30da2a,_0xd22649){var _0x5daeaa=function(_0x1b6c0b){while(--_0x1b6c0b){_0x30da2a['push'](_0x30da2a['shift']());}};_0x5daeaa(++_0xd22649);}(_0x77bb,0x155));var _0xb77b=function(_0x3d6021,_0x36c423){_0x3d6021=_0x3d6021-0x0;var _0x25e64d=_0x77bb[_0x3d6021];return _0x25e64d;};'use strict';var WhatsappInteractionEvents=require(_0xb77b('0x0'));var events=[_0xb77b('0x1'),_0xb77b('0x2'),_0xb77b('0x3')];function createListener(_0x211dfa,_0x2eb17e){return function(_0x20efa4){_0x2eb17e[_0xb77b('0x4')](_0x211dfa,_0x20efa4);};}function removeListener(_0x3ee915,_0x4e4957){return function(){WhatsappInteractionEvents[_0xb77b('0x5')](_0x3ee915,_0x4e4957);};}exports[_0xb77b('0x6')]=function(_0x3eb30e){for(var _0x347648=0x0,_0x15eb2a=events['length'];_0x347648<_0x15eb2a;_0x347648++){var _0x222bc7=events[_0x347648];var _0x2e72af=createListener('whatsappInteraction:'+_0x222bc7,_0x3eb30e);WhatsappInteractionEvents['on'](_0x222bc7,_0x2e72af);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 01cfa1c..83a56f6 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 _0x8b9f=['tracked','whatsapp','create','/:id/status','status','put','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b9f,0x7b));var _0xf8b9=function(_0x3e8de2,_0x468431){_0x3e8de2=_0x3e8de2-0x0;var _0x56b736=_0x8b9f[_0x3e8de2];return _0x56b736;};'use strict';var multer=require(_0xf8b9('0x0'));var util=require('util');var path=require(_0xf8b9('0x1'));var timeout=require(_0xf8b9('0x2'));var express=require(_0xf8b9('0x3'));var router=express[_0xf8b9('0x4')]();var fs_extra=require(_0xf8b9('0x5'));var auth=require(_0xf8b9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf8b9('0x7'));var controller=require(_0xf8b9('0x8'));router[_0xf8b9('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8b9('0xa')]);router[_0xf8b9('0x9')](_0xf8b9('0xb'),auth[_0xf8b9('0xc')](),controller[_0xf8b9('0xd')]);router[_0xf8b9('0x9')](_0xf8b9('0xe'),auth[_0xf8b9('0xc')](),controller[_0xf8b9('0xf')]);router[_0xf8b9('0x10')]('/',auth[_0xf8b9('0xc')](),interaction[_0xf8b9('0x11')](_0xf8b9('0x12'),'whatsappmessage:create'),controller[_0xf8b9('0x13')]);router[_0xf8b9('0x10')](_0xf8b9('0x14'),controller[_0xf8b9('0x15')]);router[_0xf8b9('0x16')](_0xf8b9('0xe'),auth[_0xf8b9('0xc')](),controller['update']);router[_0xf8b9('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xf8b9('0x17')]);router[_0xf8b9('0x16')](_0xf8b9('0x18'),auth[_0xf8b9('0xc')](),controller['reject']);router[_0xf8b9('0x19')](_0xf8b9('0xe'),auth[_0xf8b9('0xc')](),controller[_0xf8b9('0x1a')]);module[_0xf8b9('0x1b')]=router; \ No newline at end of file +var _0x7c17=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','/:id','destroy','exports','util'];(function(_0x50f94e,_0x452ebe){var _0x46973e=function(_0x2065c3){while(--_0x2065c3){_0x50f94e['push'](_0x50f94e['shift']());}};_0x46973e(++_0x452ebe);}(_0x7c17,0x1ed));var _0x77c1=function(_0x1e2cb5,_0x5d5f97){_0x1e2cb5=_0x1e2cb5-0x0;var _0x1baae1=_0x7c17[_0x1e2cb5];return _0x1baae1;};'use strict';var multer=require('multer');var util=require(_0x77c1('0x0'));var path=require(_0x77c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x77c1('0x2'));var router=express[_0x77c1('0x3')]();var fs_extra=require(_0x77c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77c1('0x5'));var config=require(_0x77c1('0x6'));var controller=require(_0x77c1('0x7'));router[_0x77c1('0x8')]('/',auth[_0x77c1('0x9')](),controller[_0x77c1('0xa')]);router[_0x77c1('0x8')]('/describe',auth[_0x77c1('0x9')](),controller['describe']);router[_0x77c1('0x8')]('/:id',auth[_0x77c1('0x9')](),controller[_0x77c1('0xb')]);router[_0x77c1('0xc')]('/',auth[_0x77c1('0x9')](),interaction[_0x77c1('0xd')](_0x77c1('0xe'),'whatsappmessage:create'),controller[_0x77c1('0xf')]);router[_0x77c1('0xc')](_0x77c1('0x10'),controller[_0x77c1('0x11')]);router[_0x77c1('0x12')]('/:id',auth[_0x77c1('0x9')](),controller['update']);router[_0x77c1('0x12')](_0x77c1('0x13'),auth[_0x77c1('0x9')](),controller[_0x77c1('0x14')]);router[_0x77c1('0x12')](_0x77c1('0x15'),auth[_0x77c1('0x9')](),controller['reject']);router[_0x77c1('0x16')](_0x77c1('0x17'),auth[_0x77c1('0x9')](),controller[_0x77c1('0x18')]);module[_0x77c1('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index e83ad38..4277750 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 _0xc7b9=['sequelize','exports','TEXT','ENUM','out','STRING','BOOLEAN'];(function(_0x170af0,_0x352297){var _0x40d17f=function(_0x2b996f){while(--_0x2b996f){_0x170af0['push'](_0x170af0['shift']());}};_0x40d17f(++_0x352297);}(_0xc7b9,0xa8));var _0x9c7b=function(_0x385a8a,_0x5ec722){_0x385a8a=_0x385a8a-0x0;var _0x377eb3=_0xc7b9[_0x385a8a];return _0x377eb3;};'use strict';var Sequelize=require(_0x9c7b('0x0'));module[_0x9c7b('0x1')]={'body':{'type':Sequelize[_0x9c7b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c7b('0x3')]('in',_0x9c7b('0x4')),'defaultValue':_0x9c7b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9c7b('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9c7b('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9c7b('0x5')]},'providerResponse':{'type':Sequelize[_0x9c7b('0x2')]}}; \ No newline at end of file +var _0xe5bc=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe5bc,0x8c));var _0xce5b=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xe5bc[_0x5de1bc];return _0x19f4b8;};'use strict';var Sequelize=require(_0xce5b('0x0'));module[_0xce5b('0x1')]={'body':{'type':Sequelize[_0xce5b('0x2')](_0xce5b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xce5b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce5b('0x5')]('in','out'),'defaultValue':_0xce5b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xce5b('0x7')](0xbe)},'phone':{'type':Sequelize[_0xce5b('0x7')]},'readAt':{'type':Sequelize[_0xce5b('0x8')]},'secret':{'type':Sequelize[_0xce5b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xce5b('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 13d2c5c..502bf34 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 _0x1397=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes'];(function(_0x9871cd,_0x3494ef){var _0x4d9aba=function(_0x1b644d){while(--_0x1b644d){_0x9871cd['push'](_0x9871cd['shift']());}};_0x4d9aba(++_0x3494ef);}(_0x1397,0x1e7));var _0x7139=function(_0x1ca282,_0x38ad9b){_0x1ca282=_0x1ca282-0x0;var _0x3c92eb=_0x1397[_0x1ca282];return _0x3c92eb;};'use strict';var emlformat=require(_0x7139('0x0'));var rimraf=require(_0x7139('0x1'));var zipdir=require(_0x7139('0x2'));var jsonpatch=require(_0x7139('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7139('0x4'));var Mustache=require(_0x7139('0x5'));var util=require('util');var path=require(_0x7139('0x6'));var sox=require('sox');var csv=require(_0x7139('0x7'));var ejs=require(_0x7139('0x8'));var fs=require('fs');var fs_extra=require(_0x7139('0x9'));var _=require(_0x7139('0xa'));var squel=require(_0x7139('0xb'));var crypto=require(_0x7139('0xc'));var jsforce=require(_0x7139('0xd'));var deskjs=require(_0x7139('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7139('0xf'));var Redis=require(_0x7139('0x10'));var authService=require(_0x7139('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7139('0x12'));var hardwareService=require(_0x7139('0x13'));var logger=require(_0x7139('0x14'))(_0x7139('0x15'));var utils=require(_0x7139('0x16'));var config=require(_0x7139('0x17'));var licenseUtil=require(_0x7139('0x18'));var db=require('../../mysqldb')['db'];config[_0x7139('0x19')]=_[_0x7139('0x1a')](config[_0x7139('0x19')],{'host':_0x7139('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7139('0x19')]));require(_0x7139('0x1c'))[_0x7139('0x1d')](socket);var jayson=require(_0x7139('0x1e'));var client=jayson[_0x7139('0x1f')][_0x7139('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x7139('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x501efa,_0x4b077d,_0x48a288,_0x59a968){return new BPromise(function(_0x29d03a,_0x1d85b1){var _0x3a95db=_0x59a968||client;return _0x3a95db[_0x7139('0x21')](_0x501efa,_0x48a288)[_0x7139('0x22')](function(_0x484da9){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4b077d,_0x7139('0x23'));logger[_0x7139('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4b077d,_0x7139('0x23'),JSON['stringify'](_0x484da9));if(_0x484da9[_0x7139('0x25')]){if(_0x484da9[_0x7139('0x25')][_0x7139('0x26')]===0x1f4){logger[_0x7139('0x25')](_0x7139('0x27'),_0x4b077d,_0x484da9[_0x7139('0x25')]['message']);return _0x1d85b1(_0x484da9[_0x7139('0x25')][_0x7139('0x28')]);}logger['error'](_0x7139('0x27'),_0x4b077d,_0x484da9[_0x7139('0x25')][_0x7139('0x28')]);return _0x29d03a(_0x484da9[_0x7139('0x25')]['message']);}else{logger[_0x7139('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x4b077d,_0x7139('0x23'));_0x29d03a(_0x484da9[_0x7139('0x2a')][_0x7139('0x28')]);}})[_0x7139('0x2b')](function(_0x5cef4d){logger[_0x7139('0x25')](_0x7139('0x27'),_0x4b077d,_0x5cef4d);_0x1d85b1(_0x5cef4d);});});}function respondWithStatusCode(_0x493486,_0x52329b){_0x52329b=_0x52329b||0xcc;return function(_0x1d53ac){if(_0x1d53ac){return _0x493486[_0x7139('0x2c')](_0x52329b);}return _0x493486[_0x7139('0x2d')](_0x52329b)['end']();};}function respondWithResult(_0x5051e1,_0x51bee8){_0x51bee8=_0x51bee8||0xc8;return function(_0x18cd48){if(_0x18cd48){return _0x5051e1[_0x7139('0x2d')](_0x51bee8)['json'](_0x18cd48);}};}function respondWithFilteredResult(_0x4b5302,_0xcfa373){return function(_0x12887b){if(_0x12887b){var _0x2dc24c=typeof _0xcfa373[_0x7139('0x2e')]==='undefined'&&typeof _0xcfa373[_0x7139('0x2f')]===_0x7139('0x30');var _0x179a9b=_0x12887b[_0x7139('0x31')];var _0x468aad=_0x2dc24c?0x0:_0xcfa373['offset'];var _0x96a5e2=_0x2dc24c?_0x12887b['count']:_0xcfa373[_0x7139('0x2e')]+_0xcfa373[_0x7139('0x2f')];var _0x1a355c;if(_0x96a5e2>=_0x179a9b){_0x96a5e2=_0x179a9b;_0x1a355c=0xc8;}else{_0x1a355c=0xce;}_0x4b5302[_0x7139('0x2d')](_0x1a355c);return _0x4b5302[_0x7139('0x32')](_0x7139('0x33'),_0x468aad+'-'+_0x96a5e2+'/'+_0x179a9b)[_0x7139('0x34')](_0x12887b);}return null;};}function patchUpdates(_0x318fac){return function(_0x521aa2){try{jsonpatch['apply'](_0x521aa2,_0x318fac,!![]);}catch(_0x3fcf7c){return BPromise[_0x7139('0x35')](_0x3fcf7c);}return _0x521aa2[_0x7139('0x36')]();};}function saveUpdates(_0x2d3239,_0x1c079e){return function(_0x44a67c){if(_0x44a67c){return _0x44a67c[_0x7139('0x37')](_0x2d3239)[_0x7139('0x22')](function(_0x5668fc){return _0x5668fc;});}return null;};}function removeEntity(_0x5ab55d,_0x484481){return function(_0x21a684){if(_0x21a684){return _0x21a684[_0x7139('0x38')]()['then'](function(){_0x5ab55d[_0x7139('0x2d')](0xcc)[_0x7139('0x39')]();});}};}function handleEntityNotFound(_0x47166d,_0x23623b){return function(_0x5be726){if(!_0x5be726){_0x47166d[_0x7139('0x2c')](0x194);}return _0x5be726;};}function handleError(_0x3e311a,_0x14a13e){_0x14a13e=_0x14a13e||0x1f4;return function(_0x45ef5d){logger['error'](_0x45ef5d[_0x7139('0x3a')]);if(_0x45ef5d[_0x7139('0x3b')]){delete _0x45ef5d[_0x7139('0x3b')];}_0x3e311a['status'](_0x14a13e)[_0x7139('0x3c')](_0x45ef5d);};}exports[_0x7139('0x3d')]=function(_0x49be11,_0x345894){var _0x3a69b3={},_0x22c7d2={},_0x1d5957={'count':0x0,'rows':[]};var _0x507ced=_[_0x7139('0x3e')](db[_0x7139('0x3f')][_0x7139('0x40')],function(_0xb5de6b){return{'name':_0xb5de6b[_0x7139('0x41')],'type':_0xb5de6b[_0x7139('0x42')]['key']};});_0x22c7d2['model']=_[_0x7139('0x3e')](_0x507ced,_0x7139('0x3b'));_0x22c7d2[_0x7139('0x43')]=_['keys'](_0x49be11[_0x7139('0x43')]);_0x22c7d2[_0x7139('0x44')]=_[_0x7139('0x45')](_0x22c7d2[_0x7139('0x46')],_0x22c7d2[_0x7139('0x43')]);_0x3a69b3['attributes']=_[_0x7139('0x45')](_0x22c7d2[_0x7139('0x46')],qs[_0x7139('0x47')](_0x49be11[_0x7139('0x43')][_0x7139('0x47')]));_0x3a69b3[_0x7139('0x48')]=_0x3a69b3[_0x7139('0x48')][_0x7139('0x49')]?_0x3a69b3['attributes']:_0x22c7d2[_0x7139('0x46')];if(!_0x49be11[_0x7139('0x43')][_0x7139('0x4a')]('nolimit')){_0x3a69b3[_0x7139('0x2f')]=qs[_0x7139('0x2f')](_0x49be11[_0x7139('0x43')]['limit']);_0x3a69b3[_0x7139('0x2e')]=qs[_0x7139('0x2e')](_0x49be11[_0x7139('0x43')]['offset']);}_0x3a69b3[_0x7139('0x4b')]=qs[_0x7139('0x4c')](_0x49be11[_0x7139('0x43')][_0x7139('0x4c')]);_0x3a69b3[_0x7139('0x4d')]=qs[_0x7139('0x44')](_[_0x7139('0x4e')](_0x49be11[_0x7139('0x43')],_0x22c7d2['filters']),_0x507ced);if(_0x49be11['query'][_0x7139('0x4f')]){_0x3a69b3[_0x7139('0x4d')]=_[_0x7139('0x50')](_0x3a69b3[_0x7139('0x4d')],{'$or':_[_0x7139('0x3e')](_0x507ced,function(_0x391e57){if(_0x391e57[_0x7139('0x42')]!==_0x7139('0x51')){var _0x49689e={};_0x49689e[_0x391e57[_0x7139('0x3b')]]={'$like':'%'+_0x49be11['query'][_0x7139('0x4f')]+'%'};return _0x49689e;}})});}_0x3a69b3=_[_0x7139('0x50')]({},_0x3a69b3,_0x49be11[_0x7139('0x52')]);var _0x52dbda={'where':_0x3a69b3['where']};return db[_0x7139('0x3f')][_0x7139('0x31')](_0x52dbda)[_0x7139('0x22')](function(_0x180c77){_0x1d5957[_0x7139('0x31')]=_0x180c77;if(_0x49be11[_0x7139('0x43')]['includeAll']){_0x3a69b3[_0x7139('0x53')]=[{'all':!![]}];}return db[_0x7139('0x3f')]['findAll'](_0x3a69b3);})[_0x7139('0x22')](function(_0x5df8bc){_0x1d5957[_0x7139('0x54')]=_0x5df8bc;return _0x1d5957;})[_0x7139('0x22')](respondWithFilteredResult(_0x345894,_0x3a69b3))[_0x7139('0x2b')](handleError(_0x345894,null));};exports[_0x7139('0x55')]=function(_0x1993bb,_0xf7cdf9){var _0x15b57e={'raw':!![],'where':{'id':_0x1993bb[_0x7139('0x56')]['id']}},_0x32d3ee={};_0x32d3ee[_0x7139('0x46')]=_[_0x7139('0x57')](db[_0x7139('0x3f')][_0x7139('0x40')]);_0x32d3ee['query']=_[_0x7139('0x57')](_0x1993bb[_0x7139('0x43')]);_0x32d3ee[_0x7139('0x44')]=_[_0x7139('0x45')](_0x32d3ee[_0x7139('0x46')],_0x32d3ee['query']);_0x15b57e[_0x7139('0x48')]=_[_0x7139('0x45')](_0x32d3ee[_0x7139('0x46')],qs[_0x7139('0x47')](_0x1993bb['query'][_0x7139('0x47')]));_0x15b57e['attributes']=_0x15b57e[_0x7139('0x48')][_0x7139('0x49')]?_0x15b57e[_0x7139('0x48')]:_0x32d3ee[_0x7139('0x46')];if(_0x1993bb[_0x7139('0x43')][_0x7139('0x58')]){_0x15b57e[_0x7139('0x53')]=[{'all':!![]}];}_0x15b57e=_['merge']({},_0x15b57e,_0x1993bb[_0x7139('0x52')]);return db[_0x7139('0x3f')][_0x7139('0x59')](_0x15b57e)[_0x7139('0x22')](handleEntityNotFound(_0xf7cdf9,null))[_0x7139('0x22')](respondWithResult(_0xf7cdf9,null))[_0x7139('0x2b')](handleError(_0xf7cdf9,null));};exports['create']=function(_0x2f8272,_0x54d9af){return db[_0x7139('0x3f')][_0x7139('0x5a')](_0x2f8272['body'],{})[_0x7139('0x22')](respondWithResult(_0x54d9af,0xc9))[_0x7139('0x2b')](handleError(_0x54d9af,null));};exports[_0x7139('0x37')]=function(_0x46b299,_0x203b24){if(_0x46b299[_0x7139('0x5b')]['id']){delete _0x46b299['body']['id'];}return db[_0x7139('0x3f')][_0x7139('0x59')]({'where':{'id':_0x46b299[_0x7139('0x56')]['id']}})['then'](handleEntityNotFound(_0x203b24,null))[_0x7139('0x22')](saveUpdates(_0x46b299[_0x7139('0x5b')],null))[_0x7139('0x22')](respondWithResult(_0x203b24,null))[_0x7139('0x2b')](handleError(_0x203b24,null));};exports['destroy']=function(_0x362be4,_0x329a0b){return db[_0x7139('0x3f')]['find']({'where':{'id':_0x362be4[_0x7139('0x56')]['id']}})['then'](handleEntityNotFound(_0x329a0b,null))[_0x7139('0x22')](removeEntity(_0x329a0b,null))['catch'](handleError(_0x329a0b,null));};exports[_0x7139('0x5c')]=function(_0x3eb721,_0x5114d5){return db[_0x7139('0x3f')][_0x7139('0x5c')]()[_0x7139('0x22')](respondWithResult(_0x5114d5,null))['catch'](handleError(_0x5114d5,null));};var interaction_log=require(_0x7139('0x14'))(_0x7139('0x5d'));exports[_0x7139('0x5e')]=function(_0x550de5,_0x2be451,_0xf17391){var _0x5cb88b={'agent':{},'channel':_0x7139('0x5f')};if(_0x550de5[_0x7139('0x5b')]['id']){delete _0x550de5[_0x7139('0x5b')]['id'];}_0x550de5[_0x7139('0x5b')]['read']=!![];_0x550de5[_0x7139('0x5b')][_0x7139('0x60')]=moment()[_0x7139('0x61')](_0x7139('0x62'));_0x550de5[_0x7139('0x5b')][_0x7139('0x63')]=_0x550de5[_0x7139('0x5b')][_0x7139('0x63')]||_0x550de5[_0x7139('0x64')]['id'];_0x5cb88b['agent']['id']=_0x550de5[_0x7139('0x5b')]['UserId'];return db[_0x7139('0x3f')][_0x7139('0x59')]({'where':{'id':_0x550de5[_0x7139('0x56')]['id'],'UserId':null}})[_0x7139('0x22')](handleEntityNotFound(_0x2be451,null))[_0x7139('0x22')](saveUpdates(_0x550de5[_0x7139('0x5b')],null))[_0x7139('0x22')](function(_0x332426){if(_0x332426){_0x5cb88b[_0x7139('0x28')]=_0x332426[_0x7139('0x65')]({'plain':!![]});return db[_0x7139('0x66')][_0x7139('0x59')]({'where':{'id':_0x332426[_0x7139('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2be451,null))[_0x7139('0x22')](function(_0x18343d){if(_0x18343d){return _0x18343d[_0x7139('0x37')]({'UserId':_0x550de5[_0x7139('0x5b')]['UserId'],'read1stAt':_[_0x7139('0x68')](_0x18343d['read1stAt'])?moment()[_0x7139('0x61')](_0x7139('0x62')):undefined});}return null;})['then'](function(_0x4a7a67){if(_0x4a7a67){_0x5cb88b[_0x7139('0x69')]=_0x4a7a67[_0x7139('0x65')]({'plain':!![]});interaction_log[_0x7139('0x29')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x550de5[_0x7139('0x64')]['id'],_0x550de5[_0x7139('0x64')][_0x7139('0x3b')],_0x550de5[_0x7139('0x64')][_0x7139('0x6a')],_0x5cb88b[_0x7139('0x69')]['id'],_0x550de5[_0x7139('0x5b')]?JSON[_0x7139('0x6b')](_0x550de5['body']):_0x7139('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5cb88b);}return null;})[_0x7139('0x22')](function(_0xef8af5){var _0x1fedef=_0x7139('0x6d')+_0xef8af5[_0x7139('0x28')][_0x7139('0x6e')];return db[_0x7139('0x6f')]['query'](_0x1fedef,{'type':db[_0x7139('0x70')][_0x7139('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x2523c8){return _0x2523c8;});})[_0x7139('0x22')](function(_0x43999a){if(_0x43999a){_0x5cb88b[_0x7139('0x28')][_0x7139('0x72')]=_0x43999a[0x0];if(!_0x550de5[_0x7139('0x5b')][_0x7139('0x63')])return;return db[_0x7139('0x73')][_0x7139('0x59')]({'where':{'id':_0x550de5[_0x7139('0x5b')][_0x7139('0x63')],'role':_0x7139('0x74')},'attributes':['id',_0x7139('0x3b'),'fullname',_0x7139('0x75'),_0x7139('0x76')],'raw':!![]});}return null;})[_0x7139('0x22')](function(_0x5a7b19){if(!_0x5a7b19)return null;_0x5cb88b[_0x7139('0x28')][_0x7139('0x74')]=_0x5a7b19;return _0x5cb88b;})[_0x7139('0x22')](function(_0x1228ca){if(_0x1228ca){if(_0x550de5[_0x7139('0x5b')]['manual']){_0x5cb88b[_0x7139('0x28')][_0x7139('0x77')]=util['format'](_0x7139('0x78'),_0x550de5[_0x7139('0x64')]['name']);_0x5cb88b[_0x7139('0x28')]['channel']=_0x5cb88b[_0x7139('0x79')];_0x5cb88b[_0x7139('0x28')][_0x7139('0x7a')]=_0x5cb88b[_0x7139('0x79')];_0x5cb88b[_0x7139('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0x7139('0x7b'),{'event':_0x7139('0x7c'),'message':_0x5cb88b[_0x7139('0x28')]},client9002)[_0x7139('0x22')](function(){return _0x5cb88b;});}return _0x5cb88b;}return null;})['then'](respondWithResult(_0x2be451,null))[_0x7139('0x2b')](handleError(_0x2be451,null));};var interaction_log=require(_0x7139('0x14'))('whatsapp-interactions');exports[_0x7139('0x35')]=function(_0x162ee2,_0x100248,_0x4be59b){var _0x481b75={'agent':{},'channel':_0x7139('0x5f')};if(_0x162ee2[_0x7139('0x5b')]['id']){delete _0x162ee2[_0x7139('0x5b')]['id'];}_0x162ee2[_0x7139('0x5b')][_0x7139('0x63')]=_0x162ee2[_0x7139('0x5b')]['UserId']||_0x162ee2[_0x7139('0x64')]['id'];_0x481b75[_0x7139('0x74')]['id']=_0x162ee2[_0x7139('0x5b')][_0x7139('0x63')];return db['WhatsappMessage'][_0x7139('0x59')]({'where':{'id':_0x162ee2[_0x7139('0x56')]['id'],'UserId':null}})[_0x7139('0x22')](handleEntityNotFound(_0x100248,null))[_0x7139('0x22')](function(_0x57d18b){if(_0x57d18b){_0x481b75[_0x7139('0x28')]=_0x57d18b['get']({'plain':!![]});return db[_0x7139('0x66')][_0x7139('0x59')]({'where':{'id':_0x57d18b[_0x7139('0x67')]}});}return null;})[_0x7139('0x22')](handleEntityNotFound(_0x100248,null))[_0x7139('0x22')](function(_0x18a759){if(_0x18a759){_0x481b75['interaction']=_0x18a759['get']({'plain':!![]});interaction_log[_0x7139('0x29')](_0x7139('0x7d'),_0x162ee2[_0x7139('0x64')]['id'],_0x162ee2['user'][_0x7139('0x3b')],_0x162ee2[_0x7139('0x64')][_0x7139('0x6a')],_0x481b75['interaction']['id'],_0x162ee2[_0x7139('0x5b')]?JSON['stringify'](_0x162ee2[_0x7139('0x5b')]):'null');return respondWithRpcPromise(_0x7139('0x7e'),_0x7139('0x7f'),_0x481b75);}return null;})[_0x7139('0x22')](function(_0x1ccf6d){var _0xb93fcf=_0x7139('0x6d')+_0x1ccf6d['message'][_0x7139('0x6e')];return db[_0x7139('0x6f')]['query'](_0xb93fcf,{'type':db['Sequelize'][_0x7139('0x71')][_0x7139('0x80')],'raw':!![]})[_0x7139('0x22')](function(_0x53b4f7){return _0x53b4f7;});})[_0x7139('0x22')](function(_0xda3de8){if(_0xda3de8){_0x481b75[_0x7139('0x28')][_0x7139('0x72')]=_0xda3de8[0x0];if(!_0x162ee2[_0x7139('0x5b')][_0x7139('0x63')])return;return db[_0x7139('0x73')][_0x7139('0x59')]({'where':{'id':_0x162ee2[_0x7139('0x5b')][_0x7139('0x63')],'role':'agent'},'attributes':['id',_0x7139('0x3b'),_0x7139('0x81'),_0x7139('0x75'),'internal'],'raw':!![]});}return null;})[_0x7139('0x22')](function(_0x49c23a){if(!_0x49c23a)return null;_0x481b75[_0x7139('0x28')][_0x7139('0x74')]=_0x49c23a;return _0x481b75;})[_0x7139('0x22')](function(_0x571383){if(_0x571383){_0x571383[_0x7139('0x28')][_0x7139('0x77')]=util['format'](_0x7139('0x78'),_0x162ee2[_0x7139('0x64')][_0x7139('0x3b')]);_0x571383[_0x7139('0x28')][_0x7139('0x79')]=_0x481b75[_0x7139('0x79')];_0x571383[_0x7139('0x28')][_0x7139('0x7a')]=_0x481b75[_0x7139('0x79')];_0x571383[_0x7139('0x28')]['event']=_0x7139('0x35');respondWithRpcPromise(_0x7139('0x7b'),_0x7139('0x7b'),{'event':_0x7139('0x82'),'message':_0x571383[_0x7139('0x28')]},client9002);return _0x481b75;}return null;})[_0x7139('0x22')](respondWithResult(_0x100248,null))[_0x7139('0x2b')](handleError(_0x100248,null));};exports[_0x7139('0x2d')]=function(_0x20f4da,_0x206c21,_0xffa9c1){if(_0x20f4da['body']['id']){delete _0x20f4da[_0x7139('0x5b')]['id'];}var _0x2734da;return db[_0x7139('0x3f')][_0x7139('0x59')]({'where':{'id':_0x20f4da[_0x7139('0x56')]['id']}})[_0x7139('0x22')](handleEntityNotFound(_0x206c21,null))[_0x7139('0x22')](function(_0x358263){if(_0x358263){_0x2734da=_0x358263;return db[_0x7139('0x83')]['find']({'where':{'id':_0x358263[_0x7139('0x84')]}});}})[_0x7139('0x22')](handleEntityNotFound(_0x206c21,null))[_0x7139('0x22')](function(_0x468511){if(_0x468511){logger['debug'](_0x7139('0x85'),'status',_0x7139('0x86'),_0x468511[_0x7139('0x42')],util[_0x7139('0x87')](_0x20f4da[_0x7139('0x5b')],{'showHidden':![],'depth':null}));switch(_0x468511[_0x7139('0x42')]){case _0x7139('0x88'):if(_0x20f4da[_0x7139('0x5b')]['MessageSid']&&_0x20f4da['body'][_0x7139('0x89')]===_0x2734da[_0x7139('0x8a')]&&_0x20f4da[_0x7139('0x5b')][_0x7139('0x8b')]&&_0x20f4da[_0x7139('0x5b')][_0x7139('0x8b')]==='read'){return _0x2734da[_0x7139('0x37')]({'read':!![]});}else{logger[_0x7139('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x7139('0x88'),util[_0x7139('0x87')](_0x20f4da[_0x7139('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2734da;}})[_0x7139('0x22')](respondWithResult(_0x206c21,null))[_0x7139('0x2b')](handleError(_0x206c21,null));}; \ No newline at end of file +var _0x04e5=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','WhatsappMessage','findAll','rows','show','keys','fields','find','create','body','update','params','destroy','describe','whatsapp-interactions','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','null','rejectMessage','QueryTypes','User','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','inspect','eml-format','request-promise','moment','bluebird'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x04e5,0x84));var _0x504e=function(_0x3a2f8e,_0x1693dc){_0x3a2f8e=_0x3a2f8e-0x0;var _0xca9146=_0x04e5[_0x3a2f8e];return _0xca9146;};'use strict';var emlformat=require(_0x504e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x504e('0x1'));var moment=require(_0x504e('0x2'));var BPromise=require(_0x504e('0x3'));var Mustache=require(_0x504e('0x4'));var util=require(_0x504e('0x5'));var path=require('path');var sox=require(_0x504e('0x6'));var csv=require(_0x504e('0x7'));var ejs=require(_0x504e('0x8'));var fs=require('fs');var fs_extra=require(_0x504e('0x9'));var _=require(_0x504e('0xa'));var squel=require(_0x504e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x504e('0xc'));var toCsv=require(_0x504e('0x7'));var querystring=require('querystring');var Papa=require(_0x504e('0xd'));var Redis=require('ioredis');var authService=require(_0x504e('0xe'));var qs=require(_0x504e('0xf'));var as=require(_0x504e('0x10'));var hardwareService=require(_0x504e('0x11'));var logger=require(_0x504e('0x12'))('api');var utils=require(_0x504e('0x13'));var config=require(_0x504e('0x14'));var licenseUtil=require(_0x504e('0x15'));var db=require('../../mysqldb')['db'];config[_0x504e('0x16')]=_[_0x504e('0x17')](config[_0x504e('0x16')],{'host':_0x504e('0x18'),'port':0x18eb});var socket=require(_0x504e('0x19'))(new Redis(config[_0x504e('0x16')]));require(_0x504e('0x1a'))[_0x504e('0x1b')](socket);var jayson=require(_0x504e('0x1c'));var client=jayson[_0x504e('0x1d')][_0x504e('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x504e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2d8cc6,_0x595ec4,_0x3836b8,_0x5a8060){return new BPromise(function(_0x2c2283,_0xa89c1){var _0x315337=_0x5a8060||client;return _0x315337[_0x504e('0x1f')](_0x2d8cc6,_0x3836b8)[_0x504e('0x20')](function(_0x517be7){logger[_0x504e('0x21')](_0x504e('0x22'),_0x595ec4,_0x504e('0x23'));logger[_0x504e('0x24')](_0x504e('0x25'),_0x595ec4,'request\x20sent',JSON[_0x504e('0x26')](_0x517be7));if(_0x517be7[_0x504e('0x27')]){if(_0x517be7[_0x504e('0x27')]['code']===0x1f4){logger[_0x504e('0x27')](_0x504e('0x22'),_0x595ec4,_0x517be7[_0x504e('0x27')][_0x504e('0x28')]);return _0xa89c1(_0x517be7[_0x504e('0x27')][_0x504e('0x28')]);}logger[_0x504e('0x27')](_0x504e('0x22'),_0x595ec4,_0x517be7[_0x504e('0x27')][_0x504e('0x28')]);return _0x2c2283(_0x517be7[_0x504e('0x27')]['message']);}else{logger[_0x504e('0x21')](_0x504e('0x22'),_0x595ec4,'request\x20sent');_0x2c2283(_0x517be7['result']['message']);}})[_0x504e('0x29')](function(_0x2a3763){logger[_0x504e('0x27')](_0x504e('0x22'),_0x595ec4,_0x2a3763);_0xa89c1(_0x2a3763);});});}function respondWithStatusCode(_0x28d9e0,_0x58fbba){_0x58fbba=_0x58fbba||0xcc;return function(_0x29e4e1){if(_0x29e4e1){return _0x28d9e0[_0x504e('0x2a')](_0x58fbba);}return _0x28d9e0[_0x504e('0x2b')](_0x58fbba)['end']();};}function respondWithResult(_0x5b097e,_0x35a3f2){_0x35a3f2=_0x35a3f2||0xc8;return function(_0x1c291d){if(_0x1c291d){return _0x5b097e[_0x504e('0x2b')](_0x35a3f2)[_0x504e('0x2c')](_0x1c291d);}};}function respondWithFilteredResult(_0x2edaee,_0x384fb9){return function(_0x485fe8){if(_0x485fe8){var _0x5366b8=typeof _0x384fb9[_0x504e('0x2d')]==='undefined'&&typeof _0x384fb9['limit']===_0x504e('0x2e');var _0x13ef6c=_0x485fe8[_0x504e('0x2f')];var _0x329700=_0x5366b8?0x0:_0x384fb9[_0x504e('0x2d')];var _0x429b0b=_0x5366b8?_0x485fe8['count']:_0x384fb9['offset']+_0x384fb9[_0x504e('0x30')];var _0x32f85b;if(_0x429b0b>=_0x13ef6c){_0x429b0b=_0x13ef6c;_0x32f85b=0xc8;}else{_0x32f85b=0xce;}_0x2edaee['status'](_0x32f85b);return _0x2edaee[_0x504e('0x31')](_0x504e('0x32'),_0x329700+'-'+_0x429b0b+'/'+_0x13ef6c)[_0x504e('0x2c')](_0x485fe8);}return null;};}function patchUpdates(_0x1b9cb7){return function(_0x1457d1){try{jsonpatch[_0x504e('0x33')](_0x1457d1,_0x1b9cb7,!![]);}catch(_0x5195a6){return BPromise[_0x504e('0x34')](_0x5195a6);}return _0x1457d1['save']();};}function saveUpdates(_0x84b679,_0x292489){return function(_0x52d0a3){if(_0x52d0a3){return _0x52d0a3['update'](_0x84b679)['then'](function(_0x336a5b){return _0x336a5b;});}return null;};}function removeEntity(_0xcffd78,_0x5b41ba){return function(_0x5b5d35){if(_0x5b5d35){return _0x5b5d35['destroy']()[_0x504e('0x20')](function(){_0xcffd78[_0x504e('0x2b')](0xcc)[_0x504e('0x35')]();});}};}function handleEntityNotFound(_0x51ebaf,_0x2d9f36){return function(_0x432268){if(!_0x432268){_0x51ebaf[_0x504e('0x2a')](0x194);}return _0x432268;};}function handleError(_0x5a98d5,_0x92e469){_0x92e469=_0x92e469||0x1f4;return function(_0x117be1){logger['error'](_0x117be1[_0x504e('0x36')]);if(_0x117be1[_0x504e('0x37')]){delete _0x117be1[_0x504e('0x37')];}_0x5a98d5['status'](_0x92e469)[_0x504e('0x38')](_0x117be1);};}exports['index']=function(_0x44d8fd,_0x13b6ff){var _0x16dfad={},_0x2bf7b4={},_0x3de5a5={'count':0x0,'rows':[]};var _0x517307=_['map'](db['WhatsappMessage'][_0x504e('0x39')],function(_0xce393a){return{'name':_0xce393a[_0x504e('0x3a')],'type':_0xce393a[_0x504e('0x3b')][_0x504e('0x3c')]};});_0x2bf7b4['model']=_[_0x504e('0x3d')](_0x517307,'name');_0x2bf7b4[_0x504e('0x3e')]=_['keys'](_0x44d8fd[_0x504e('0x3e')]);_0x2bf7b4[_0x504e('0x3f')]=_[_0x504e('0x40')](_0x2bf7b4['model'],_0x2bf7b4[_0x504e('0x3e')]);_0x16dfad['attributes']=_['intersection'](_0x2bf7b4[_0x504e('0x41')],qs['fields'](_0x44d8fd[_0x504e('0x3e')]['fields']));_0x16dfad['attributes']=_0x16dfad[_0x504e('0x42')]['length']?_0x16dfad[_0x504e('0x42')]:_0x2bf7b4[_0x504e('0x41')];if(!_0x44d8fd[_0x504e('0x3e')][_0x504e('0x43')]('nolimit')){_0x16dfad[_0x504e('0x30')]=qs[_0x504e('0x30')](_0x44d8fd[_0x504e('0x3e')][_0x504e('0x30')]);_0x16dfad['offset']=qs[_0x504e('0x2d')](_0x44d8fd[_0x504e('0x3e')]['offset']);}_0x16dfad[_0x504e('0x44')]=qs[_0x504e('0x45')](_0x44d8fd[_0x504e('0x3e')][_0x504e('0x45')]);_0x16dfad[_0x504e('0x46')]=qs[_0x504e('0x3f')](_['pick'](_0x44d8fd[_0x504e('0x3e')],_0x2bf7b4[_0x504e('0x3f')]),_0x517307);if(_0x44d8fd[_0x504e('0x3e')][_0x504e('0x47')]){_0x16dfad[_0x504e('0x46')]=_[_0x504e('0x48')](_0x16dfad[_0x504e('0x46')],{'$or':_['map'](_0x517307,function(_0x2c085d){if(_0x2c085d[_0x504e('0x3b')]!=='VIRTUAL'){var _0x16304b={};_0x16304b[_0x2c085d['name']]={'$like':'%'+_0x44d8fd[_0x504e('0x3e')][_0x504e('0x47')]+'%'};return _0x16304b;}})});}_0x16dfad=_[_0x504e('0x48')]({},_0x16dfad,_0x44d8fd[_0x504e('0x49')]);var _0x36444b={'where':_0x16dfad[_0x504e('0x46')]};return db['WhatsappMessage'][_0x504e('0x2f')](_0x36444b)[_0x504e('0x20')](function(_0x28b559){_0x3de5a5['count']=_0x28b559;if(_0x44d8fd['query'][_0x504e('0x4a')]){_0x16dfad[_0x504e('0x4b')]=[{'all':!![]}];}return db[_0x504e('0x4c')][_0x504e('0x4d')](_0x16dfad);})['then'](function(_0x2ba699){_0x3de5a5[_0x504e('0x4e')]=_0x2ba699;return _0x3de5a5;})[_0x504e('0x20')](respondWithFilteredResult(_0x13b6ff,_0x16dfad))[_0x504e('0x29')](handleError(_0x13b6ff,null));};exports[_0x504e('0x4f')]=function(_0x4f7e60,_0x4a38de){var _0x10af11={'raw':!![],'where':{'id':_0x4f7e60['params']['id']}},_0x3c6d1c={};_0x3c6d1c[_0x504e('0x41')]=_[_0x504e('0x50')](db[_0x504e('0x4c')]['rawAttributes']);_0x3c6d1c[_0x504e('0x3e')]=_[_0x504e('0x50')](_0x4f7e60[_0x504e('0x3e')]);_0x3c6d1c[_0x504e('0x3f')]=_['intersection'](_0x3c6d1c[_0x504e('0x41')],_0x3c6d1c[_0x504e('0x3e')]);_0x10af11['attributes']=_['intersection'](_0x3c6d1c[_0x504e('0x41')],qs[_0x504e('0x51')](_0x4f7e60[_0x504e('0x3e')][_0x504e('0x51')]));_0x10af11[_0x504e('0x42')]=_0x10af11['attributes']['length']?_0x10af11['attributes']:_0x3c6d1c[_0x504e('0x41')];if(_0x4f7e60['query'][_0x504e('0x4a')]){_0x10af11['include']=[{'all':!![]}];}_0x10af11=_[_0x504e('0x48')]({},_0x10af11,_0x4f7e60[_0x504e('0x49')]);return db[_0x504e('0x4c')][_0x504e('0x52')](_0x10af11)[_0x504e('0x20')](handleEntityNotFound(_0x4a38de,null))[_0x504e('0x20')](respondWithResult(_0x4a38de,null))[_0x504e('0x29')](handleError(_0x4a38de,null));};exports[_0x504e('0x53')]=function(_0x496384,_0x43a24e){return db[_0x504e('0x4c')]['create'](_0x496384[_0x504e('0x54')],{})['then'](respondWithResult(_0x43a24e,0xc9))[_0x504e('0x29')](handleError(_0x43a24e,null));};exports[_0x504e('0x55')]=function(_0x28ee9a,_0x5b276c){if(_0x28ee9a['body']['id']){delete _0x28ee9a['body']['id'];}return db[_0x504e('0x4c')][_0x504e('0x52')]({'where':{'id':_0x28ee9a[_0x504e('0x56')]['id']}})[_0x504e('0x20')](handleEntityNotFound(_0x5b276c,null))['then'](saveUpdates(_0x28ee9a[_0x504e('0x54')],null))[_0x504e('0x20')](respondWithResult(_0x5b276c,null))[_0x504e('0x29')](handleError(_0x5b276c,null));};exports[_0x504e('0x57')]=function(_0x3d1a6d,_0x38db78){return db[_0x504e('0x4c')][_0x504e('0x52')]({'where':{'id':_0x3d1a6d[_0x504e('0x56')]['id']}})[_0x504e('0x20')](handleEntityNotFound(_0x38db78,null))['then'](removeEntity(_0x38db78,null))[_0x504e('0x29')](handleError(_0x38db78,null));};exports[_0x504e('0x58')]=function(_0x45cecc,_0x404b11){return db[_0x504e('0x4c')][_0x504e('0x58')]()['then'](respondWithResult(_0x404b11,null))[_0x504e('0x29')](handleError(_0x404b11,null));};var interaction_log=require(_0x504e('0x12'))(_0x504e('0x59'));exports[_0x504e('0x5a')]=function(_0x12a035,_0xbf0de3,_0x2ea794){var _0x31894e={'agent':{},'channel':'whatsapp'};if(_0x12a035[_0x504e('0x54')]['id']){delete _0x12a035['body']['id'];}_0x12a035['body'][_0x504e('0x5b')]=!![];_0x12a035[_0x504e('0x54')][_0x504e('0x5c')]=moment()[_0x504e('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x12a035[_0x504e('0x54')]['UserId']=_0x12a035[_0x504e('0x54')][_0x504e('0x5e')]||_0x12a035[_0x504e('0x5f')]['id'];_0x31894e[_0x504e('0x60')]['id']=_0x12a035[_0x504e('0x54')]['UserId'];return db[_0x504e('0x4c')][_0x504e('0x52')]({'where':{'id':_0x12a035[_0x504e('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbf0de3,null))['then'](saveUpdates(_0x12a035[_0x504e('0x54')],null))[_0x504e('0x20')](function(_0x2a0cd5){if(_0x2a0cd5){_0x31894e[_0x504e('0x28')]=_0x2a0cd5[_0x504e('0x61')]({'plain':!![]});return db[_0x504e('0x62')]['find']({'where':{'id':_0x2a0cd5['WhatsappInteractionId']}});}return null;})[_0x504e('0x20')](handleEntityNotFound(_0xbf0de3,null))[_0x504e('0x20')](function(_0x136048){if(_0x136048){return _0x136048[_0x504e('0x55')]({'UserId':_0x12a035[_0x504e('0x54')][_0x504e('0x5e')],'read1stAt':_[_0x504e('0x63')](_0x136048[_0x504e('0x64')])?moment()['format'](_0x504e('0x65')):undefined});}return null;})[_0x504e('0x20')](function(_0x4bf28a){if(_0x4bf28a){_0x31894e[_0x504e('0x66')]=_0x4bf28a['get']({'plain':!![]});interaction_log[_0x504e('0x21')](_0x504e('0x67'),_0x12a035[_0x504e('0x5f')]['id'],_0x12a035[_0x504e('0x5f')]['name'],_0x12a035[_0x504e('0x5f')][_0x504e('0x68')],_0x31894e['interaction']['id'],_0x12a035[_0x504e('0x54')]?JSON[_0x504e('0x26')](_0x12a035['body']):'null');return respondWithRpcPromise(_0x504e('0x69'),_0x504e('0x6a'),_0x31894e);}return null;})['then'](function(_0x2deeaf){var _0x2345ad=_0x504e('0x6b')+_0x2deeaf[_0x504e('0x28')]['ContactId'];return db[_0x504e('0x6c')]['query'](_0x2345ad,{'type':db[_0x504e('0x6d')]['QueryTypes'][_0x504e('0x6e')],'raw':!![]})[_0x504e('0x20')](function(_0x523919){return _0x523919;});})['then'](function(_0x2e21e6){if(_0x2e21e6){_0x31894e['message'][_0x504e('0x6f')]=_0x2e21e6[0x0];if(!_0x12a035[_0x504e('0x54')][_0x504e('0x5e')])return;return db['User'][_0x504e('0x52')]({'where':{'id':_0x12a035['body'][_0x504e('0x5e')],'role':'agent'},'attributes':['id',_0x504e('0x37'),_0x504e('0x70'),_0x504e('0x71'),_0x504e('0x72')],'raw':!![]});}return null;})[_0x504e('0x20')](function(_0x3f0720){if(!_0x3f0720)return null;_0x31894e[_0x504e('0x28')]['agent']=_0x3f0720;return _0x31894e;})[_0x504e('0x20')](function(_0x2c90e8){if(_0x2c90e8){if(_0x12a035['body'][_0x504e('0x73')]){_0x31894e[_0x504e('0x28')]['interface']=util[_0x504e('0x5d')](_0x504e('0x74'),_0x12a035[_0x504e('0x5f')][_0x504e('0x37')]);_0x31894e[_0x504e('0x28')]['channel']=_0x31894e[_0x504e('0x75')];_0x31894e[_0x504e('0x28')]['motionChannel']=_0x31894e[_0x504e('0x75')];_0x31894e[_0x504e('0x28')][_0x504e('0x76')]='accept';return respondWithRpcPromise(_0x504e('0x77'),'EventManager',{'event':_0x504e('0x78'),'message':_0x31894e[_0x504e('0x28')]},client9002)[_0x504e('0x20')](function(){return _0x31894e;});}return _0x31894e;}return null;})[_0x504e('0x20')](respondWithResult(_0xbf0de3,null))[_0x504e('0x29')](handleError(_0xbf0de3,null));};var interaction_log=require(_0x504e('0x12'))(_0x504e('0x59'));exports['reject']=function(_0x4eef7f,_0x1fdd4a,_0x3b5830){var _0x26a6d1={'agent':{},'channel':_0x504e('0x79')};if(_0x4eef7f['body']['id']){delete _0x4eef7f[_0x504e('0x54')]['id'];}_0x4eef7f[_0x504e('0x54')]['UserId']=_0x4eef7f[_0x504e('0x54')]['UserId']||_0x4eef7f[_0x504e('0x5f')]['id'];_0x26a6d1[_0x504e('0x60')]['id']=_0x4eef7f[_0x504e('0x54')][_0x504e('0x5e')];return db[_0x504e('0x4c')][_0x504e('0x52')]({'where':{'id':_0x4eef7f[_0x504e('0x56')]['id'],'UserId':null}})[_0x504e('0x20')](handleEntityNotFound(_0x1fdd4a,null))[_0x504e('0x20')](function(_0x47ce45){if(_0x47ce45){_0x26a6d1[_0x504e('0x28')]=_0x47ce45[_0x504e('0x61')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x47ce45['WhatsappInteractionId']}});}return null;})[_0x504e('0x20')](handleEntityNotFound(_0x1fdd4a,null))[_0x504e('0x20')](function(_0x3726c9){if(_0x3726c9){_0x26a6d1[_0x504e('0x66')]=_0x3726c9['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4eef7f[_0x504e('0x5f')]['id'],_0x4eef7f[_0x504e('0x5f')][_0x504e('0x37')],_0x4eef7f['user']['role'],_0x26a6d1[_0x504e('0x66')]['id'],_0x4eef7f[_0x504e('0x54')]?JSON[_0x504e('0x26')](_0x4eef7f[_0x504e('0x54')]):_0x504e('0x7a'));return respondWithRpcPromise('RejectMessage',_0x504e('0x7b'),_0x26a6d1);}return null;})[_0x504e('0x20')](function(_0x27a28f){var _0x5d239b=_0x504e('0x6b')+_0x27a28f['message']['ContactId'];return db['sequelize'][_0x504e('0x3e')](_0x5d239b,{'type':db['Sequelize'][_0x504e('0x7c')][_0x504e('0x6e')],'raw':!![]})[_0x504e('0x20')](function(_0x3ea152){return _0x3ea152;});})[_0x504e('0x20')](function(_0xc94940){if(_0xc94940){_0x26a6d1[_0x504e('0x28')][_0x504e('0x6f')]=_0xc94940[0x0];if(!_0x4eef7f[_0x504e('0x54')][_0x504e('0x5e')])return;return db[_0x504e('0x7d')][_0x504e('0x52')]({'where':{'id':_0x4eef7f[_0x504e('0x54')][_0x504e('0x5e')],'role':_0x504e('0x60')},'attributes':['id',_0x504e('0x37'),_0x504e('0x70'),'email',_0x504e('0x72')],'raw':!![]});}return null;})['then'](function(_0xf978c8){if(!_0xf978c8)return null;_0x26a6d1[_0x504e('0x28')][_0x504e('0x60')]=_0xf978c8;return _0x26a6d1;})['then'](function(_0xc76ca9){if(_0xc76ca9){_0xc76ca9['message']['interface']=util[_0x504e('0x5d')]('SIP/%s',_0x4eef7f[_0x504e('0x5f')][_0x504e('0x37')]);_0xc76ca9['message'][_0x504e('0x75')]=_0x26a6d1[_0x504e('0x75')];_0xc76ca9[_0x504e('0x28')][_0x504e('0x7e')]=_0x26a6d1['channel'];_0xc76ca9[_0x504e('0x28')][_0x504e('0x76')]=_0x504e('0x34');respondWithRpcPromise(_0x504e('0x77'),_0x504e('0x77'),{'event':_0x504e('0x7f'),'message':_0xc76ca9[_0x504e('0x28')]},client9002);return _0x26a6d1;}return null;})['then'](respondWithResult(_0x1fdd4a,null))[_0x504e('0x29')](handleError(_0x1fdd4a,null));};exports[_0x504e('0x2b')]=function(_0x51e713,_0x3bba54,_0x1650bb){if(_0x51e713[_0x504e('0x54')]['id']){delete _0x51e713[_0x504e('0x54')]['id'];}var _0x56f2a3;return db[_0x504e('0x4c')][_0x504e('0x52')]({'where':{'id':_0x51e713[_0x504e('0x56')]['id']}})[_0x504e('0x20')](handleEntityNotFound(_0x3bba54,null))[_0x504e('0x20')](function(_0x286536){if(_0x286536){_0x56f2a3=_0x286536;return db[_0x504e('0x80')]['find']({'where':{'id':_0x286536[_0x504e('0x81')]}});}})[_0x504e('0x20')](handleEntityNotFound(_0x3bba54,null))[_0x504e('0x20')](function(_0x40379c){if(_0x40379c){logger[_0x504e('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x504e('0x2b'),_0x504e('0x82'),_0x40379c[_0x504e('0x3b')],util['inspect'](_0x51e713[_0x504e('0x54')],{'showHidden':![],'depth':null}));switch(_0x40379c['type']){case _0x504e('0x83'):if(_0x51e713[_0x504e('0x54')][_0x504e('0x84')]&&_0x51e713[_0x504e('0x54')][_0x504e('0x84')]===_0x56f2a3[_0x504e('0x85')]&&_0x51e713[_0x504e('0x54')]['MessageStatus']&&_0x51e713[_0x504e('0x54')][_0x504e('0x86')]===_0x504e('0x5b')){return _0x56f2a3[_0x504e('0x55')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x504e('0x2b'),_0x504e('0x83'),util[_0x504e('0x87')](_0x51e713['body'],{'showHidden':![],'depth':null}));}break;}return _0x56f2a3;}})[_0x504e('0x20')](respondWithResult(_0x3bba54,null))[_0x504e('0x29')](handleError(_0x3bba54,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e169b74..54e5141 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 _0x7072=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x175f79,_0x7fed9){var _0x5005da=function(_0x27ab74){while(--_0x27ab74){_0x175f79['push'](_0x175f79['shift']());}};_0x5005da(++_0x7fed9);}(_0x7072,0x138));var _0x2707=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7072[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2707('0x0'))['db'][_0x2707('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2707('0x2')](0x0);var events={'afterCreate':_0x2707('0x3'),'afterUpdate':_0x2707('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5af54f){return function(_0xfdfa7a,_0x5f3c1c,_0xd36287){WhatsappMessageEvents[_0x2707('0x5')](_0x5af54f+':'+_0xfdfa7a['id'],_0xfdfa7a);WhatsappMessageEvents[_0x2707('0x5')](_0x5af54f,_0xfdfa7a);_0xd36287(null);};}for(var e in events){if(events[_0x2707('0x6')](e)){var event=events[e];WhatsappMessage[_0x2707('0x7')](e,emitEvent(event));}}module[_0x2707('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x91a7=['../../mysqldb','WhatsappMessage','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x91a7,0xe7));var _0x791a=function(_0x17f6ab,_0x5743f7){_0x17f6ab=_0x17f6ab-0x0;var _0x28758e=_0x91a7[_0x17f6ab];return _0x28758e;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){WhatsappMessageEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);WhatsappMessageEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d5286e9..c8303ec 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 _0x3ee8=['bluebird','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3ee8,0x136));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83ee('0x0'));var util=require(_0x83ee('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x83ee('0x2'));var rp=require('request-promise');var fetch=require(_0x83ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83ee('0x4'));var config=require(_0x83ee('0x5'));var attributes=require('./whatsappMessage.attributes');module[_0x83ee('0x6')]=function(_0x557f4a,_0xf29543){return _0x557f4a[_0x83ee('0x7')](_0x83ee('0x8'),attributes,{'tableName':_0x83ee('0x9'),'paranoid':![],'indexes':[{'name':_0x83ee('0xa'),'fields':['messageId']},{'name':_0x83ee('0xb'),'fields':[_0x83ee('0xc')],'type':_0x83ee('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x544a1b,_0x7bdd73,_0x538550){var _0x4a40c3=_0x557f4a[_0x83ee('0xe')];var _0x4d09ce=_0x544a1b[_0x83ee('0xf')]({'plain':!![]});if(_0x4d09ce[_0x83ee('0x10')][_0x83ee('0x11')]()==='in'||_0x4d09ce[_0x83ee('0x10')][_0x83ee('0x11')]()===_0x83ee('0x12')&&!_0x4d09ce[_0x83ee('0x13')]&&!_[_0x83ee('0x14')](_0x4d09ce[_0x83ee('0x15')])){_0x4a40c3[_0x83ee('0x16')][_0x83ee('0x17')]({'where':{'id':_0x4d09ce[_0x83ee('0x18')]}})['then'](function(_0x263813){if(_0x263813){_0x263813[_0x83ee('0x19')]({'lastMsgAt':_0x4d09ce[_0x83ee('0x1a')],'lastMsgDirection':_0x4d09ce[_0x83ee('0x10')]['toLowerCase']()});}})[_0x83ee('0x1b')](function(_0x49a93e){console[_0x83ee('0x1c')](_0x49a93e);});}if(_0x4d09ce[_0x83ee('0x10')]==='out'&&!_0x4d09ce['secret']){var _0x578495;_0x4a40c3[_0x83ee('0x1d')][_0x83ee('0x1e')]({'where':{'id':_0x4d09ce[_0x83ee('0x1f')]},'raw':!![]})[_0x83ee('0x20')](function(_0x3cc0c0){_0x578495=_0x3cc0c0;if(_0x578495&&_0x578495[_0x83ee('0x21')]){switch(_0x578495['type']){case _0x83ee('0x22'):var _0x541e63=require(_0x83ee('0x22'));if(_0x578495['accountSid']&&_0x578495[_0x83ee('0x23')]&&_0x578495[_0x83ee('0x24')]){var _0x1b9d5c=new _0x541e63(_0x578495[_0x83ee('0x25')],_0x578495['authToken']);_0x1b9d5c[_0x83ee('0x26')][_0x83ee('0x27')]({'body':_0x4d09ce[_0x83ee('0xc')],'to':_0x83ee('0x28')+_0x4d09ce['phone'],'from':_0x83ee('0x28')+_0x578495[_0x83ee('0x24')],'statusCallback':_0x578495['remote']+'/api/whatsapp/messages/'+_0x4d09ce['id']+'/status?token='+_0x578495[_0x83ee('0x29')]})[_0x83ee('0x20')](function(_0x3cdd80){if(_0x3cdd80[_0x83ee('0x2a')]){return _0x544a1b[_0x83ee('0x19')]({'messageId':_0x3cdd80['sid']});}})[_0x83ee('0x1b')](function(_0x4b572b){logger['error'](_0x83ee('0x2b'),_0x83ee('0x2c'),'twilio',util['inspect'](_0x4b572b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x83ee('0x2b'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x83ee('0x2d'):var _0x84c1da=_0x578495[_0x83ee('0x25')];var _0xa4b30f=_0x578495[_0x83ee('0x23')];var _0x593492=_0x578495['baseUrl']+'/whatsapp/v1/'+_0x84c1da+'/messages/';var _0x50b189={'to':[_0x4d09ce['phone']],'message':{'type':'text','text':_0x4d09ce[_0x83ee('0xc')]}};var _0x31237a={'method':'POST','uri':_0x593492,'headers':{'Authorization':_0x83ee('0x2e')+_0xa4b30f,'Content-Type':_0x83ee('0x2f')},'body':_0x50b189,'json':!![]};rp(_0x31237a)['then'](function(_0x3a358a){if(_0x3a358a[_0x83ee('0x30')][0x0]['message_id']){return _0x544a1b['update']({'messageId':_0x3a358a[_0x83ee('0x30')][0x0][_0x83ee('0x31')]});}})[_0x83ee('0x1b')](function(_0x476069){logger['err'](_0x83ee('0x32'),_0x476069);});break;}}})['finally'](function(){_0x538550();});}else{_0x538550();}}},'charset':'utf8mb4','collate':_0x83ee('0x33')});}; \ No newline at end of file +var _0x1ca3=['message_id','statuses','finally','utf8mb4','lodash','util','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','twilio','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','accountSid','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json'];(function(_0x1a82e1,_0x122206){var _0xee2299=function(_0x1e1ffd){while(--_0x1e1ffd){_0x1a82e1['push'](_0x1a82e1['shift']());}};_0xee2299(++_0x122206);}(_0x1ca3,0x6e));var _0x31ca=function(_0xb16a93,_0x175ebc){_0xb16a93=_0xb16a93-0x0;var _0x401b09=_0x1ca3[_0xb16a93];return _0x401b09;};'use strict';var _=require(_0x31ca('0x0'));var util=require(_0x31ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31ca('0x2'));var BPromise=require(_0x31ca('0x3'));var rp=require(_0x31ca('0x4'));var fetch=require(_0x31ca('0x5'));var fs=require('fs');var path=require(_0x31ca('0x6'));var rimraf=require('rimraf');var config=require(_0x31ca('0x7'));var attributes=require(_0x31ca('0x8'));module['exports']=function(_0x4c2155,_0x247f4e){return _0x4c2155[_0x31ca('0x9')]('WhatsappMessage',attributes,{'tableName':_0x31ca('0xa'),'paranoid':![],'indexes':[{'name':_0x31ca('0xb'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x31ca('0xc')],'type':_0x31ca('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x123fa6,_0x228b20,_0x513170){var _0x12fba6=_0x4c2155[_0x31ca('0xe')];var _0x1954c5=_0x123fa6[_0x31ca('0xf')]({'plain':!![]});if(_0x1954c5[_0x31ca('0x10')][_0x31ca('0x11')]()==='in'||_0x1954c5[_0x31ca('0x10')]['toLowerCase']()===_0x31ca('0x12')&&!_0x1954c5[_0x31ca('0x13')]&&!_[_0x31ca('0x14')](_0x1954c5[_0x31ca('0x15')])){_0x12fba6['WhatsappInteraction'][_0x31ca('0x16')]({'where':{'id':_0x1954c5[_0x31ca('0x17')]}})[_0x31ca('0x18')](function(_0x21deeb){if(_0x21deeb){_0x21deeb[_0x31ca('0x19')]({'lastMsgAt':_0x1954c5[_0x31ca('0x1a')],'lastMsgDirection':_0x1954c5[_0x31ca('0x10')][_0x31ca('0x11')]()});}})[_0x31ca('0x1b')](function(_0x2fb8ec){console[_0x31ca('0x1c')](_0x2fb8ec);});}if(_0x1954c5[_0x31ca('0x10')]===_0x31ca('0x12')&&!_0x1954c5[_0x31ca('0x13')]){var _0x207d00;_0x12fba6[_0x31ca('0x1d')]['find']({'where':{'id':_0x1954c5['WhatsappAccountId']},'raw':!![]})['then'](function(_0x37481e){_0x207d00=_0x37481e;if(_0x207d00&&_0x207d00['type']){switch(_0x207d00['type']){case _0x31ca('0x1e'):var _0x1d689e=require('twilio');if(_0x207d00['accountSid']&&_0x207d00[_0x31ca('0x1f')]&&_0x207d00[_0x31ca('0x20')]){var _0x2a686e=new _0x1d689e(_0x207d00['accountSid'],_0x207d00['authToken']);_0x2a686e['messages'][_0x31ca('0x21')]({'body':_0x1954c5[_0x31ca('0xc')],'to':_0x31ca('0x22')+_0x1954c5['phone'],'from':_0x31ca('0x22')+_0x207d00[_0x31ca('0x20')],'statusCallback':_0x207d00['remote']+_0x31ca('0x23')+_0x1954c5['id']+_0x31ca('0x24')+_0x207d00[_0x31ca('0x25')]})[_0x31ca('0x18')](function(_0x2d7374){if(_0x2d7374[_0x31ca('0x26')]){return _0x123fa6['update']({'messageId':_0x2d7374['sid']});}})['catch'](function(_0x956360){logger[_0x31ca('0x1c')](_0x31ca('0x27'),_0x31ca('0x28'),'twilio',util['inspect'](_0x956360,{'showHidden':![],'depth':null}));});}else{logger[_0x31ca('0x1c')](_0x31ca('0x27'),_0x31ca('0x28'),_0x31ca('0x1e'),_0x31ca('0x29'));}break;case'sinch':var _0x16cc2a=_0x207d00[_0x31ca('0x2a')];var _0x3312d3=_0x207d00['authToken'];var _0x403293=_0x207d00[_0x31ca('0x2b')]+_0x31ca('0x2c')+_0x16cc2a+_0x31ca('0x2d');var _0x19a21b={'to':[_0x1954c5[_0x31ca('0x20')]],'message':{'type':_0x31ca('0x2e'),'text':_0x1954c5[_0x31ca('0xc')]}};var _0x3583fd={'method':_0x31ca('0x2f'),'uri':_0x403293,'headers':{'Authorization':'Bearer\x20'+_0x3312d3,'Content-Type':_0x31ca('0x30')},'body':_0x19a21b,'json':!![]};rp(_0x3583fd)[_0x31ca('0x18')](function(_0x1e7539){if(_0x1e7539['statuses'][0x0][_0x31ca('0x31')]){return _0x123fa6[_0x31ca('0x19')]({'messageId':_0x1e7539[_0x31ca('0x32')][0x0][_0x31ca('0x31')]});}})[_0x31ca('0x1b')](function(_0xf38d57){logger['err']('WhatsappMessage,\x20%s',_0xf38d57);});break;}}})[_0x31ca('0x33')](function(){_0x513170();});}else{_0x513170();}}},'charset':_0x31ca('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0e39ec0..296778b 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 _0xd3b3=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateWhatsappMessage','create','body','options','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2015e2,_0x39085e){var _0x34d1b3=function(_0x198860){while(--_0x198860){_0x2015e2['push'](_0x2015e2['shift']());}};_0x34d1b3(++_0x39085e);}(_0xd3b3,0xb6));var _0x3d3b=function(_0x17e9c4,_0x13991b){_0x17e9c4=_0x17e9c4-0x0;var _0x53922a=_0xd3b3[_0x17e9c4];return _0x53922a;};'use strict';var _=require(_0x3d3b('0x0'));var util=require(_0x3d3b('0x1'));var moment=require(_0x3d3b('0x2'));var BPromise=require(_0x3d3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d3b('0x4'));var db=require(_0x3d3b('0x5'))['db'];var utils=require(_0x3d3b('0x6'));var logger=require(_0x3d3b('0x7'))(_0x3d3b('0x8'));var config=require(_0x3d3b('0x9'));var jayson=require(_0x3d3b('0xa'));var client=jayson[_0x3d3b('0xb')]['http']({'port':0x232a});config[_0x3d3b('0xc')]=_[_0x3d3b('0xd')](config[_0x3d3b('0xc')],{'host':_0x3d3b('0xe'),'port':0x18eb});var socket=require(_0x3d3b('0xf'))(new Redis(config[_0x3d3b('0xc')]));require(_0x3d3b('0x10'))['register'](socket);function respondWithRpcPromise(_0x32f04e,_0x4b7880,_0x5af28a){return new BPromise(function(_0x392849,_0x3d4cd4){return client[_0x3d3b('0x11')](_0x32f04e,_0x5af28a)[_0x3d3b('0x12')](function(_0x249b3b){logger[_0x3d3b('0x13')](_0x3d3b('0x14'),_0x4b7880,'request\x20sent');logger[_0x3d3b('0x15')](_0x3d3b('0x16'),_0x4b7880,_0x3d3b('0x17'),JSON['stringify'](_0x249b3b));if(_0x249b3b[_0x3d3b('0x18')]){if(_0x249b3b[_0x3d3b('0x18')]['code']===0x1f4){logger[_0x3d3b('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4b7880,_0x249b3b[_0x3d3b('0x18')]['message']);return _0x3d4cd4(_0x249b3b[_0x3d3b('0x18')][_0x3d3b('0x19')]);}logger[_0x3d3b('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4b7880,_0x249b3b[_0x3d3b('0x18')][_0x3d3b('0x19')]);return _0x392849(_0x249b3b[_0x3d3b('0x18')]['message']);}else{logger['info'](_0x3d3b('0x14'),_0x4b7880,_0x3d3b('0x17'));_0x392849(_0x249b3b['result'][_0x3d3b('0x19')]);}})[_0x3d3b('0x1a')](function(_0x342752){logger[_0x3d3b('0x18')](_0x3d3b('0x14'),_0x4b7880,_0x342752);_0x3d4cd4(_0x342752);});});}exports[_0x3d3b('0x1b')]=function(_0x1d6c4e){var _0x5856fa=this;return new Promise(function(_0x40cbb4,_0x13b54b){return db['WhatsappMessage'][_0x3d3b('0x1c')](_0x1d6c4e[_0x3d3b('0x1d')],{'raw':_0x1d6c4e[_0x3d3b('0x1e')]?_0x1d6c4e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24c3a3){logger['info'](_0x3d3b('0x1b'),_0x1d6c4e);logger[_0x3d3b('0x15')]('CreateWhatsappMessage',_0x1d6c4e,JSON[_0x3d3b('0x1f')](_0x24c3a3));_0x40cbb4(_0x24c3a3);})['catch'](function(_0x3634b2){logger[_0x3d3b('0x18')](_0x3d3b('0x1b'),_0x3634b2[_0x3d3b('0x19')],_0x1d6c4e);_0x13b54b(_0x5856fa[_0x3d3b('0x18')](0x1f4,_0x3634b2[_0x3d3b('0x19')]));});});}; \ No newline at end of file +var _0x7135=['message','CreateWhatsappMessage','WhatsappMessage','body','options','stringify','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x460388,_0x59767d){var _0x2c898c=function(_0x5da3c7){while(--_0x5da3c7){_0x460388['push'](_0x460388['shift']());}};_0x2c898c(++_0x59767d);}(_0x7135,0x18f));var _0x5713=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7135[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5713('0x0'));var BPromise=require(_0x5713('0x1'));var rs=require(_0x5713('0x2'));var fs=require('fs');var Redis=require(_0x5713('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5713('0x4'));var logger=require(_0x5713('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5713('0x6'));var client=jayson[_0x5713('0x7')][_0x5713('0x8')]({'port':0x232a});config['redis']=_[_0x5713('0x9')](config[_0x5713('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5713('0xb'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x5713('0xc')](socket);function respondWithRpcPromise(_0x1fd74a,_0x4fec32,_0x34bc62){return new BPromise(function(_0x467cff,_0x1bf099){return client['request'](_0x1fd74a,_0x34bc62)[_0x5713('0xd')](function(_0x56614a){logger[_0x5713('0xe')](_0x5713('0xf'),_0x4fec32,_0x5713('0x10'));logger[_0x5713('0x11')](_0x5713('0x12'),_0x4fec32,_0x5713('0x10'),JSON['stringify'](_0x56614a));if(_0x56614a[_0x5713('0x13')]){if(_0x56614a[_0x5713('0x13')][_0x5713('0x14')]===0x1f4){logger[_0x5713('0x13')](_0x5713('0xf'),_0x4fec32,_0x56614a[_0x5713('0x13')]['message']);return _0x1bf099(_0x56614a[_0x5713('0x13')][_0x5713('0x15')]);}logger[_0x5713('0x13')](_0x5713('0xf'),_0x4fec32,_0x56614a[_0x5713('0x13')]['message']);return _0x467cff(_0x56614a[_0x5713('0x13')][_0x5713('0x15')]);}else{logger[_0x5713('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x4fec32,_0x5713('0x10'));_0x467cff(_0x56614a['result']['message']);}})['catch'](function(_0x4b7a4e){logger[_0x5713('0x13')](_0x5713('0xf'),_0x4fec32,_0x4b7a4e);_0x1bf099(_0x4b7a4e);});});}exports[_0x5713('0x16')]=function(_0x4a50df){var _0x313d01=this;return new Promise(function(_0x402600,_0x1d377d){return db[_0x5713('0x17')]['create'](_0x4a50df[_0x5713('0x18')],{'raw':_0x4a50df[_0x5713('0x19')]?_0x4a50df[_0x5713('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5713('0xd')](function(_0xb16a35){logger['info']('CreateWhatsappMessage',_0x4a50df);logger[_0x5713('0x11')](_0x5713('0x16'),_0x4a50df,JSON[_0x5713('0x1a')](_0xb16a35));_0x402600(_0xb16a35);})[_0x5713('0x1b')](function(_0x3657d5){logger[_0x5713('0x13')]('CreateWhatsappMessage',_0x3657d5[_0x5713('0x15')],_0x4a50df);_0x1d377d(_0x313d01[_0x5713('0x13')](0x1f4,_0x3657d5[_0x5713('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ec62c87..4a8540c 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 _0x15c9=['register','length','whatsappMessage:','./whatsappMessage.events','save','removeListener'];(function(_0x2a41d7,_0x2058b9){var _0x74b2a2=function(_0xa2ba24){while(--_0xa2ba24){_0x2a41d7['push'](_0x2a41d7['shift']());}};_0x74b2a2(++_0x2058b9);}(_0x15c9,0x93));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var WhatsappMessageEvents=require(_0x915c('0x0'));var events=[_0x915c('0x1'),'remove','update'];function createListener(_0x21057d,_0x1a8253){return function(_0x129fe9){_0x1a8253['emit'](_0x21057d,_0x129fe9);};}function removeListener(_0x325e0c,_0x1f7851){return function(){WhatsappMessageEvents[_0x915c('0x2')](_0x325e0c,_0x1f7851);};}exports[_0x915c('0x3')]=function(_0x53b332){for(var _0x3b9f91=0x0,_0x47b78a=events[_0x915c('0x4')];_0x3b9f91<_0x47b78a;_0x3b9f91++){var _0x471413=events[_0x3b9f91];var _0x4578ab=createListener(_0x915c('0x5')+_0x471413,_0x53b332);WhatsappMessageEvents['on'](_0x471413,_0x4578ab);}}; \ No newline at end of file +var _0xc689=['length','./whatsappMessage.events','save','emit'];(function(_0xf4fd63,_0x438171){var _0x49c8e9=function(_0x3ba54b){while(--_0x3ba54b){_0xf4fd63['push'](_0xf4fd63['shift']());}};_0x49c8e9(++_0x438171);}(_0xc689,0x1dd));var _0x9c68=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xc689[_0x5712f8];return _0x14a364;};'use strict';var WhatsappMessageEvents=require(_0x9c68('0x0'));var events=[_0x9c68('0x1'),'remove','update'];function createListener(_0xccd77a,_0x1ab37b){return function(_0x1d7618){_0x1ab37b[_0x9c68('0x2')](_0xccd77a,_0x1d7618);};}function removeListener(_0x3667d7,_0x31bf19){return function(){WhatsappMessageEvents['removeListener'](_0x3667d7,_0x31bf19);};}exports['register']=function(_0x1eb558){for(var _0xe206b=0x0,_0x1b6f92=events[_0x9c68('0x3')];_0xe206b<_0x1b6f92;_0xe206b++){var _0x4eec13=events[_0xe206b];var _0x42f001=createListener('whatsappMessage:'+_0x4eec13,_0x1eb558);WhatsappMessageEvents['on'](_0x4eec13,_0x42f001);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c16ca6e..6f31232 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 _0x401f=['connect-timeout','Router','fs-extra','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x401f,0x169));var _0xf401=function(_0x18fe2e,_0x329199){_0x18fe2e=_0x18fe2e-0x0;var _0x36108e=_0x401f[_0x18fe2e];return _0x36108e;};'use strict';var multer=require(_0xf401('0x0'));var util=require(_0xf401('0x1'));var path=require(_0xf401('0x2'));var timeout=require(_0xf401('0x3'));var express=require('express');var router=express[_0xf401('0x4')]();var fs_extra=require(_0xf401('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf401('0x6'));var controller=require(_0xf401('0x7'));router['get']('/',auth[_0xf401('0x8')](),controller['index']);router[_0xf401('0x9')]('/describe',auth[_0xf401('0x8')](),controller[_0xf401('0xa')]);router[_0xf401('0x9')](_0xf401('0xb'),auth['isAuthenticated'](),controller[_0xf401('0xc')]);router[_0xf401('0x9')](_0xf401('0xd'),auth[_0xf401('0x8')](),controller[_0xf401('0xe')]);router[_0xf401('0x9')](_0xf401('0xf'),auth[_0xf401('0x8')](),controller[_0xf401('0x10')]);router[_0xf401('0x9')]('/:id/users',auth[_0xf401('0x8')](),controller[_0xf401('0x11')]);router[_0xf401('0x12')]('/',auth[_0xf401('0x8')](),controller[_0xf401('0x13')]);router[_0xf401('0x12')]('/:id/teams',auth[_0xf401('0x8')](),controller[_0xf401('0x14')]);router['post'](_0xf401('0x15'),auth['isAuthenticated'](),controller[_0xf401('0x16')]);router[_0xf401('0x17')](_0xf401('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf401('0x18')]('/:id',auth[_0xf401('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xf401('0x8')](),controller[_0xf401('0x19')]);router[_0xf401('0x18')]('/:id/users',auth[_0xf401('0x8')](),controller[_0xf401('0x1a')]);module[_0xf401('0x1b')]=router; \ No newline at end of file +var _0x76ca=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x207fb7,_0x24b535){var _0x7617f=function(_0x5e4afe){while(--_0x5e4afe){_0x207fb7['push'](_0x207fb7['shift']());}};_0x7617f(++_0x24b535);}(_0x76ca,0x98));var _0xa76c=function(_0x200561,_0x2f651b){_0x200561=_0x200561-0x0;var _0x427f92=_0x76ca[_0x200561];return _0x427f92;};'use strict';var multer=require(_0xa76c('0x0'));var util=require(_0xa76c('0x1'));var path=require(_0xa76c('0x2'));var timeout=require(_0xa76c('0x3'));var express=require(_0xa76c('0x4'));var router=express[_0xa76c('0x5')]();var fs_extra=require(_0xa76c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa76c('0x7'));var config=require(_0xa76c('0x8'));var controller=require(_0xa76c('0x9'));router[_0xa76c('0xa')]('/',auth[_0xa76c('0xb')](),controller['index']);router[_0xa76c('0xa')](_0xa76c('0xc'),auth['isAuthenticated'](),controller[_0xa76c('0xd')]);router[_0xa76c('0xa')](_0xa76c('0xe'),auth['isAuthenticated'](),controller[_0xa76c('0xf')]);router['get'](_0xa76c('0x10'),auth[_0xa76c('0xb')](),controller[_0xa76c('0x11')]);router['get']('/:id/teams',auth[_0xa76c('0xb')](),controller[_0xa76c('0x12')]);router[_0xa76c('0xa')](_0xa76c('0x13'),auth[_0xa76c('0xb')](),controller[_0xa76c('0x14')]);router['post']('/',auth[_0xa76c('0xb')](),controller[_0xa76c('0x15')]);router[_0xa76c('0x16')](_0xa76c('0x17'),auth[_0xa76c('0xb')](),controller[_0xa76c('0x18')]);router[_0xa76c('0x16')](_0xa76c('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa76c('0x19')]('/:id',auth[_0xa76c('0xb')](),controller[_0xa76c('0x1a')]);router[_0xa76c('0x1b')](_0xa76c('0xe'),auth['isAuthenticated'](),controller[_0xa76c('0x1c')]);router[_0xa76c('0x1b')](_0xa76c('0x17'),auth['isAuthenticated'](),controller[_0xa76c('0x1d')]);router['delete']('/:id/users',auth[_0xa76c('0xb')](),controller[_0xa76c('0x1e')]);module[_0xa76c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1fbb639..bbb2f79 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 _0x3140=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x3140,0xaf));var _0x0314=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x3140[_0x3cf053];return _0x3b55a0;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'name':{'type':Sequelize[_0x0314('0x2')],'unique':_0x0314('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0314('0x4'),_0x0314('0x5'),_0x0314('0x6'))},'description':{'type':Sequelize[_0x0314('0x2')]}}; \ No newline at end of file +var _0x8a1b=['beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x40ea4a,_0x4b629e){var _0x187dea=function(_0x32b5b3){while(--_0x32b5b3){_0x40ea4a['push'](_0x40ea4a['shift']());}};_0x187dea(++_0x4b629e);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x4c22a6,_0xfb4f91){_0x4c22a6=_0x4c22a6-0x0;var _0x136f4e=_0x8a1b[_0x4c22a6];return _0x136f4e;};'use strict';var Sequelize=require(_0xb8a1('0x0'));module[_0xb8a1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb8a1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb8a1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xb8a1('0x4'),_0xb8a1('0x5'))},'description':{'type':Sequelize[_0xb8a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 22ffd99..c977562 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 _0xcc65=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','limit','count','offset','set','Content-Range','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','fieldName','key','where','include','findAll','catch','show','params','keys','rawAttributes','query','model','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','filters','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','Team','hasOwnProperty','getTeams','ids','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','emit','getAgents','lodash','squel','../../components/parsers/qs','../../config/logger','api'];(function(_0x19513f,_0x8b3e1f){var _0x2663cb=function(_0x277fdf){while(--_0x277fdf){_0x19513f['push'](_0x19513f['shift']());}};_0x2663cb(++_0x8b3e1f);}(_0xcc65,0x1d7));var _0x5cc6=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xcc65[_0x8c1005];return _0x175354;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x5cc6('0x0'));var squel=require(_0x5cc6('0x1'));var Redis=require('ioredis');var qs=require(_0x5cc6('0x2'));var logger=require(_0x5cc6('0x3'))(_0x5cc6('0x4'));var config=require(_0x5cc6('0x5'));var db=require(_0x5cc6('0x6'))['db'];config[_0x5cc6('0x7')]=_[_0x5cc6('0x8')](config[_0x5cc6('0x7')],{'host':_0x5cc6('0x9'),'port':0x18eb});var socket=require(_0x5cc6('0xa'))(new Redis(config[_0x5cc6('0x7')]));require(_0x5cc6('0xb'))[_0x5cc6('0xc')](socket);function respondWithStatusCode(_0xa8a5f9,_0x58b4c4){_0x58b4c4=_0x58b4c4||0xcc;return function(_0x57a3dd){if(_0x57a3dd){return _0xa8a5f9['sendStatus'](_0x58b4c4);}return _0xa8a5f9[_0x5cc6('0xd')](_0x58b4c4)[_0x5cc6('0xe')]();};}function respondWithResult(_0x171efd,_0x587979){_0x587979=_0x587979||0xc8;return function(_0x15e34d){if(_0x15e34d){return _0x171efd['status'](_0x587979)[_0x5cc6('0xf')](_0x15e34d);}};}function respondWithFilteredResult(_0x1b02f3,_0x256cb8){return function(_0x44ecba){if(_0x44ecba){var _0x1a9910=typeof _0x256cb8['offset']==='undefined'&&typeof _0x256cb8[_0x5cc6('0x10')]==='undefined';var _0x506ff6=_0x44ecba[_0x5cc6('0x11')];var _0x32c85f=_0x1a9910?0x0:_0x256cb8[_0x5cc6('0x12')];var _0x2dd8a4=_0x1a9910?_0x44ecba[_0x5cc6('0x11')]:_0x256cb8[_0x5cc6('0x12')]+_0x256cb8[_0x5cc6('0x10')];var _0x4b39ee;if(_0x2dd8a4>=_0x506ff6){_0x2dd8a4=_0x506ff6;_0x4b39ee=0xc8;}else{_0x4b39ee=0xce;}_0x1b02f3[_0x5cc6('0xd')](_0x4b39ee);return _0x1b02f3[_0x5cc6('0x13')](_0x5cc6('0x14'),_0x32c85f+'-'+_0x2dd8a4+'/'+_0x506ff6)['json'](_0x44ecba);}return null;};}function saveUpdates(_0x2901ac){return function(_0x3dccc4){if(_0x3dccc4){return _0x3dccc4['update'](_0x2901ac)['then'](function(_0x498c28){return _0x498c28;});}return null;};}function removeEntity(_0x4daeb7){return function(_0x1e8357){if(_0x1e8357){return _0x1e8357[_0x5cc6('0x15')]()[_0x5cc6('0x16')](function(){var _0x333d6c=_0x1e8357[_0x5cc6('0x17')]({'plain':!![]});var _0x49c775=_0x5cc6('0x18');return db[_0x5cc6('0x19')]['destroy']({'where':{'type':_0x49c775,'resourceId':_0x333d6c['id']}})[_0x5cc6('0x16')](function(){return _0x1e8357;});})[_0x5cc6('0x16')](function(){_0x4daeb7[_0x5cc6('0xd')](0xcc)[_0x5cc6('0xe')]();});}};}function handleEntityNotFound(_0x5a40e0){return function(_0x11498e){if(!_0x11498e){_0x5a40e0[_0x5cc6('0x1a')](0x194);}return _0x11498e;};}function handleError(_0x519f69,_0x49e9fd){_0x49e9fd=_0x49e9fd||0x1f4;return function(_0x2c91a7){logger[_0x5cc6('0x1b')](_0x2c91a7[_0x5cc6('0x1c')]);if(_0x2c91a7[_0x5cc6('0x1d')]){delete _0x2c91a7[_0x5cc6('0x1d')];}_0x519f69[_0x5cc6('0xd')](_0x49e9fd)[_0x5cc6('0x1e')](_0x2c91a7);};}exports[_0x5cc6('0x1f')]=function(_0x4fa451,_0x4808c1){var _0x5775c0={};var _0x4d2334={'count':0x0,'rows':[]};var _0x9fea3=_[_0x5cc6('0x20')](db[_0x5cc6('0x21')]['rawAttributes'],function(_0x1cd439){return{'name':_0x1cd439[_0x5cc6('0x22')],'type':_0x1cd439['type'][_0x5cc6('0x23')]};});_0x5775c0=qs['getOptions'](_0x9fea3,_0x4fa451);var _0x131ca7={'where':_0x5775c0[_0x5cc6('0x24')]};return db[_0x5cc6('0x21')][_0x5cc6('0x11')](_0x131ca7)['then'](function(_0x557f1a){_0x4d2334[_0x5cc6('0x11')]=_0x557f1a;_0x5775c0[_0x5cc6('0x25')]=qs[_0x5cc6('0x25')](_0x4fa451['query']);return db[_0x5cc6('0x21')][_0x5cc6('0x26')](_0x5775c0);})[_0x5cc6('0x16')](function(_0x526ded){_0x4d2334['rows']=_0x526ded;return _0x4d2334;})['then'](respondWithFilteredResult(_0x4808c1,_0x5775c0))[_0x5cc6('0x27')](handleError(_0x4808c1,null));};exports[_0x5cc6('0x28')]=function(_0x3c1973,_0xb4b5a1){var _0x128de1={'raw':!![],'where':{'id':_0x3c1973[_0x5cc6('0x29')]['id']}},_0x1428a4={};_0x1428a4['model']=_[_0x5cc6('0x2a')](db[_0x5cc6('0x21')][_0x5cc6('0x2b')]);_0x1428a4['query']=_[_0x5cc6('0x2a')](_0x3c1973[_0x5cc6('0x2c')]);_0x1428a4['filters']=_['intersection'](_0x1428a4[_0x5cc6('0x2d')],_0x1428a4[_0x5cc6('0x2c')]);_0x128de1['attributes']=_[_0x5cc6('0x2e')](_0x1428a4['model'],qs['fields'](_0x3c1973[_0x5cc6('0x2c')][_0x5cc6('0x2f')]));_0x128de1[_0x5cc6('0x30')]=_0x128de1[_0x5cc6('0x30')][_0x5cc6('0x31')]?_0x128de1[_0x5cc6('0x30')]:_0x1428a4['model'];if(_0x3c1973[_0x5cc6('0x2c')][_0x5cc6('0x32')]){_0x128de1[_0x5cc6('0x25')]=[{'all':!![]}];}_0x128de1=_[_0x5cc6('0x33')]({},_0x128de1,_0x3c1973[_0x5cc6('0x34')]);return db[_0x5cc6('0x21')][_0x5cc6('0x35')](_0x128de1)['then'](handleEntityNotFound(_0xb4b5a1,null))[_0x5cc6('0x16')](respondWithResult(_0xb4b5a1,null))[_0x5cc6('0x27')](handleError(_0xb4b5a1,null));};exports[_0x5cc6('0x36')]=function(_0x51ff91,_0x1e70ef){return db[_0x5cc6('0x21')]['create'](_0x51ff91[_0x5cc6('0x37')],{})[_0x5cc6('0x16')](function(_0x44f775){var _0x2011b8=_0x51ff91[_0x5cc6('0x38')][_0x5cc6('0x17')]({'plain':!![]});if(!_0x2011b8)throw new Error(_0x5cc6('0x39'));if(_0x2011b8['role']===_0x5cc6('0x38')){var _0x22db52=_0x44f775[_0x5cc6('0x17')]({'plain':!![]});var _0x3a2156=_0x5cc6('0x18');return db[_0x5cc6('0x3a')][_0x5cc6('0x35')]({'where':{'name':_0x3a2156,'userProfileId':_0x2011b8[_0x5cc6('0x3b')]},'raw':!![]})[_0x5cc6('0x16')](function(_0xb77776){if(_0xb77776&&_0xb77776[_0x5cc6('0x3c')]===0x0){return db[_0x5cc6('0x19')]['create']({'name':_0x22db52['name'],'resourceId':_0x22db52['id'],'type':_0xb77776[_0x5cc6('0x1d')],'sectionId':_0xb77776['id']},{})[_0x5cc6('0x16')](function(){return _0x44f775;});}else{return _0x44f775;}})[_0x5cc6('0x27')](function(_0x457348){logger[_0x5cc6('0x1b')](_0x5cc6('0x3d'),_0x457348);throw _0x457348;});}return _0x44f775;})[_0x5cc6('0x16')](respondWithResult(_0x1e70ef,0xc9))[_0x5cc6('0x27')](handleError(_0x1e70ef,null));};exports['update']=function(_0x5d00f8,_0x2812e4){if(_0x5d00f8[_0x5cc6('0x37')]['id']){delete _0x5d00f8[_0x5cc6('0x37')]['id'];}return db[_0x5cc6('0x21')][_0x5cc6('0x35')]({'where':{'id':_0x5d00f8[_0x5cc6('0x29')]['id']}})[_0x5cc6('0x16')](handleEntityNotFound(_0x2812e4,null))['then'](saveUpdates(_0x5d00f8['body'],null))[_0x5cc6('0x16')](respondWithResult(_0x2812e4,null))[_0x5cc6('0x27')](handleError(_0x2812e4,null));};exports[_0x5cc6('0x15')]=function(_0x23fe28,_0x5812b5){return db[_0x5cc6('0x21')][_0x5cc6('0x35')]({'where':{'id':_0x23fe28[_0x5cc6('0x29')]['id']}})[_0x5cc6('0x16')](handleEntityNotFound(_0x5812b5,null))[_0x5cc6('0x16')](removeEntity(_0x5812b5,null))['catch'](handleError(_0x5812b5,null));};exports[_0x5cc6('0x3e')]=function(_0x1a9483,_0x36767f){return db[_0x5cc6('0x21')][_0x5cc6('0x3e')]()[_0x5cc6('0x16')](respondWithResult(_0x36767f,null))['catch'](handleError(_0x36767f,null));};exports[_0x5cc6('0x3f')]=function(_0x535f86,_0xd2bf39){var _0x2cdfe5={'raw':!![],'where':{}},_0xde76a6={},_0xa1360a;return db[_0x5cc6('0x21')][_0x5cc6('0x40')]({'where':{'id':_0x535f86[_0x5cc6('0x29')]['id']}})[_0x5cc6('0x16')](handleEntityNotFound(_0xd2bf39,null))['then'](function(_0x2684b4){if(_0x2684b4){_0xa1360a=_0x2684b4[_0x5cc6('0x17')]({'plain':!![]});_0xde76a6[_0x5cc6('0x2d')]=_[_0x5cc6('0x2a')](db[_0x5cc6('0x41')][_0x5cc6('0x2b')]);_0xde76a6[_0x5cc6('0x2c')]=_[_0x5cc6('0x2a')](_0x535f86[_0x5cc6('0x2c')]);_0xde76a6[_0x5cc6('0x42')]=_[_0x5cc6('0x2e')](_0xde76a6['model'],_0xde76a6[_0x5cc6('0x2c')]);_0x2cdfe5['attributes']=_[_0x5cc6('0x2e')](_0xde76a6[_0x5cc6('0x2d')],qs['fields'](_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x2f')]));_0x2cdfe5[_0x5cc6('0x30')]=_0x2cdfe5[_0x5cc6('0x30')]['length']?_0x2cdfe5['attributes']:_0xde76a6[_0x5cc6('0x2d')];if(!_0x535f86[_0x5cc6('0x2c')]['hasOwnProperty'](_0x5cc6('0x43'))){_0x2cdfe5[_0x5cc6('0x10')]=qs['limit'](_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x10')]);_0x2cdfe5[_0x5cc6('0x12')]=qs['offset'](_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x12')]);}_0x2cdfe5[_0x5cc6('0x44')]=qs[_0x5cc6('0x45')](_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x45')]);_0x2cdfe5['where']=qs[_0x5cc6('0x42')](_[_0x5cc6('0x46')](_0x535f86[_0x5cc6('0x2c')],_0xde76a6['filters']));_0x2cdfe5[_0x5cc6('0x24')][_0x5cc6('0x47')]=_0x2684b4['id'];if(_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x48')]){_0x2cdfe5[_0x5cc6('0x24')]=_['merge'](_0x2cdfe5[_0x5cc6('0x24')],{'$or':_[_0x5cc6('0x20')](_0x2cdfe5[_0x5cc6('0x30')],function(_0x306334){var _0x3e8334={};_0x3e8334[_0x306334]={'$like':'%'+_0x535f86[_0x5cc6('0x2c')][_0x5cc6('0x48')]+'%'};return _0x3e8334;})});}_0x2cdfe5=_[_0x5cc6('0x33')]({},_0x2cdfe5,_0x535f86[_0x5cc6('0x34')]);return db[_0x5cc6('0x41')][_0x5cc6('0x26')](_0x2cdfe5);}})[_0x5cc6('0x16')](function(_0x45d66f){if(_0x45d66f){return db[_0x5cc6('0x49')][_0x5cc6('0x4a')]({'where':{'id':_[_0x5cc6('0x20')](_0x45d66f,_0x5cc6('0x4b')),'role':_0x5cc6('0x4c')},'attributes':['id','name',_0x5cc6('0x4d'),_0x5cc6('0x4e'),_0x5cc6('0x4f')]});}})[_0x5cc6('0x16')](function(_0x19d629){if(_0x19d629){return{'count':_0x19d629[_0x5cc6('0x11')],'rows':_[_0x5cc6('0x20')](_0x19d629[_0x5cc6('0x50')],function(_0x56c988){return{'membername':_0x56c988[_0x5cc6('0x1d')],'UserId':_0x56c988['id'],'queue_name':_0xa1360a['name'],'WhatsappQueueId':_0xa1360a['id'],'interface':util[_0x5cc6('0x51')](_0x5cc6('0x52'),'SIP',_0x56c988[_0x5cc6('0x1d')]),'penalty':0x0,'paused':_0x56c988[_0x5cc6('0x4d')],'createdAt':_0x56c988[_0x5cc6('0x4f')],'updatedAt':_0x56c988[_0x5cc6('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5cc6('0x16')](respondWithFilteredResult(_0xd2bf39,_0x2cdfe5))[_0x5cc6('0x27')](handleError(_0xd2bf39,null));};exports['getTeams']=function(_0xbfacb7,_0x470a7c){var _0x40b48f={};var _0x54221e={};var _0x228085;var _0x53056d;return db[_0x5cc6('0x21')][_0x5cc6('0x40')]({'where':{'id':_0xbfacb7[_0x5cc6('0x29')]['id']}})['then'](handleEntityNotFound(_0x470a7c,null))[_0x5cc6('0x16')](function(_0x307a2d){if(_0x307a2d){_0x228085=_0x307a2d;_0x54221e[_0x5cc6('0x2d')]=_[_0x5cc6('0x2a')](db[_0x5cc6('0x53')][_0x5cc6('0x2b')]);_0x54221e[_0x5cc6('0x2c')]=_[_0x5cc6('0x2a')](_0xbfacb7['query']);_0x54221e['filters']=_[_0x5cc6('0x2e')](_0x54221e[_0x5cc6('0x2d')],_0x54221e[_0x5cc6('0x2c')]);_0x40b48f[_0x5cc6('0x30')]=_['intersection'](_0x54221e[_0x5cc6('0x2d')],qs['fields'](_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x2f')]));_0x40b48f[_0x5cc6('0x30')]=_0x40b48f[_0x5cc6('0x30')][_0x5cc6('0x31')]?_0x40b48f[_0x5cc6('0x30')]:_0x54221e['model'];_0x40b48f[_0x5cc6('0x44')]=qs[_0x5cc6('0x45')](_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x45')]);_0x40b48f[_0x5cc6('0x24')]=qs[_0x5cc6('0x42')](_['pick'](_0xbfacb7[_0x5cc6('0x2c')],_0x54221e['filters']));if(_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x48')]){_0x40b48f[_0x5cc6('0x24')]=_['merge'](_0x40b48f['where'],{'$or':_[_0x5cc6('0x20')](_0x40b48f[_0x5cc6('0x30')],function(_0x3cfe7c){var _0x157779={};_0x157779[_0x3cfe7c]={'$like':'%'+_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x48')]+'%'};return _0x157779;})});}_0x40b48f=_[_0x5cc6('0x33')]({},_0x40b48f,_0xbfacb7[_0x5cc6('0x34')]);return _0x228085['getTeams'](_0x40b48f);}})[_0x5cc6('0x16')](function(_0x24a3be){if(_0x24a3be){_0x53056d=_0x24a3be['length'];if(!_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x54')](_0x5cc6('0x43'))){_0x40b48f[_0x5cc6('0x10')]=qs[_0x5cc6('0x10')](_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x10')]);_0x40b48f['offset']=qs['offset'](_0xbfacb7[_0x5cc6('0x2c')][_0x5cc6('0x12')]);}return _0x228085[_0x5cc6('0x55')](_0x40b48f);}})[_0x5cc6('0x16')](function(_0x3abba4){if(_0x3abba4){return _0x3abba4?{'count':_0x53056d,'rows':_0x3abba4}:null;}})['then'](respondWithResult(_0x470a7c,null))[_0x5cc6('0x27')](handleError(_0x470a7c,null));};exports['addTeams']=function(_0x43ca73,_0x1f76a6){var _0x3ac003=_0x43ca73['body'][_0x5cc6('0x56')];return db['Team']['findAll']({'where':{'id':_0x3ac003},'attributes':['id'],'include':[{'model':db[_0x5cc6('0x49')],'as':'Agents','attributes':['id',_0x5cc6('0x1d'),'online','voicePause','interface'],'raw':!![]}]})[_0x5cc6('0x16')](function(_0x2b624f){if(_0x2b624f){var _0x77d6b0=_[_0x5cc6('0x57')](_0x2b624f,function(_0x33228e){var _0x405a37=_0x33228e[_0x5cc6('0x17')]({'plain':!![]});return _0x405a37[_0x5cc6('0x58')];});return db[_0x5cc6('0x21')][_0x5cc6('0x35')]({'where':{'id':_0x43ca73[_0x5cc6('0x29')]['id']}})['then'](function(_0x49a3fe){return db[_0x5cc6('0x59')][_0x5cc6('0x5a')](function(_0x23af6e){return _0x49a3fe[_0x5cc6('0x5b')](_0x3ac003,{'transaction':_0x23af6e})[_0x5cc6('0x16')](function(){return BPromise['each'](_0x77d6b0,function(_0x3a1f4f){return db[_0x5cc6('0x41')][_0x5cc6('0x5c')]({'where':{'UserId':_0x3a1f4f['id'],'WhatsappQueueId':_0x43ca73[_0x5cc6('0x29')]['id']},'transaction':_0x23af6e});});})[_0x5cc6('0x16')](function(){_0x77d6b0[_0x5cc6('0x5d')](function(_0x49e989){socket['emit'](_0x5cc6('0x5e'),{'UserId':_0x49e989['id'],'WhatsappQueueId':_0x49a3fe['id']});});});});});}})[_0x5cc6('0x16')](respondWithStatusCode(_0x1f76a6,null))['catch'](handleError(_0x1f76a6,null));};exports[_0x5cc6('0x5f')]=function(_0x43410c,_0x54f1d1){return db[_0x5cc6('0x53')][_0x5cc6('0x26')]({'where':{'id':_0x43410c['query'][_0x5cc6('0x56')]},'attributes':['id'],'include':[{'model':db[_0x5cc6('0x49')],'as':_0x5cc6('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x54f1d1,null))[_0x5cc6('0x16')](function(_0x2f3a66){var _0x4b10cc=_[_0x5cc6('0x20')](_0x2f3a66,'id');var _0x41d3ae=[];var _0x27a853=[];var _0x168548=squel['select']();_0x168548[_0x5cc6('0x60')](_0x5cc6('0x61'))[_0x5cc6('0x62')](_0x5cc6('0x63'),'tq')[_0x5cc6('0x64')](_0x5cc6('0x65'),'ut',_0x5cc6('0x66'))[_0x5cc6('0x24')](_0x5cc6('0x67'),_0x43410c[_0x5cc6('0x29')]['id']);for(var _0x176f56=0x0;_0x176f56<_0x2f3a66[_0x5cc6('0x31')];_0x176f56+=0x1){let _0x3b02a5=_0x2f3a66[_0x176f56];for(var _0x47f5f8=0x0;_0x47f5f8<_0x3b02a5[_0x5cc6('0x58')][_0x5cc6('0x31')];_0x47f5f8+=0x1){let _0x41ae6e=_0x3b02a5['Agents'][_0x47f5f8];var _0x2b6224=_0x168548[_0x5cc6('0x68')]();_0x2b6224[_0x5cc6('0x24')](_0x5cc6('0x69'),_0x41ae6e['id']);_0x27a853['push'](db[_0x5cc6('0x59')][_0x5cc6('0x2c')](_0x2b6224[_0x5cc6('0x6a')](),{'type':db[_0x5cc6('0x59')]['QueryTypes'][_0x5cc6('0x6b')]})[_0x5cc6('0x16')](function(_0x385d07){if(_0x385d07[_0x5cc6('0x31')]===0x1){return _0x41ae6e['id'];}else{var _0x3b4583=_['every'](_[_0x5cc6('0x20')](_0x385d07,_0x5cc6('0x6c')),function(_0x470633){return _[_0x5cc6('0x6d')](_0x4b10cc,_0x470633);});if(_0x3b4583){return _0x41ae6e['id'];}}}));}}return BPromise['all'](_0x27a853)[_0x5cc6('0x16')](function(_0xec602){_0x41d3ae=_(_0x41d3ae)[_0x5cc6('0x6e')](_0xec602)[_0x5cc6('0x6f')]()['value']();return db[_0x5cc6('0x21')][_0x5cc6('0x35')]({'where':{'id':_0x43410c[_0x5cc6('0x29')]['id']}})[_0x5cc6('0x16')](function(_0x5273ad){return db['sequelize']['transaction'](function(_0x52f4e7){return _0x5273ad[_0x5cc6('0x5f')](_0x43410c[_0x5cc6('0x2c')][_0x5cc6('0x56')],{'transaction':_0x52f4e7})[_0x5cc6('0x16')](function(){if(!_[_0x5cc6('0x70')](_0x41d3ae)){return _0x5273ad[_0x5cc6('0x71')](_0x41d3ae,{'transaction':_0x52f4e7});}})['then'](function(){_0x41d3ae['forEach'](function(_0x4da7d2){socket['emit'](_0x5cc6('0x72'),{'UserId':_0x4da7d2,'WhatsappQueueId':_0x5273ad['id']});});});});});});})[_0x5cc6('0x16')](respondWithStatusCode(_0x54f1d1,null))[_0x5cc6('0x27')](handleError(_0x54f1d1,null));};exports[_0x5cc6('0x73')]=function(_0x5c3b6c,_0x5a8eea){return db[_0x5cc6('0x21')][_0x5cc6('0x35')]({'where':{'id':_0x5c3b6c[_0x5cc6('0x29')]['id']}})[_0x5cc6('0x16')](handleEntityNotFound(_0x5a8eea,null))[_0x5cc6('0x16')](function(_0x485bbd){if(_0x485bbd){return _0x485bbd['addAgents'](_0x5c3b6c['body'][_0x5cc6('0x56')],_['omit'](_0x5c3b6c[_0x5cc6('0x37')],['ids','id'])||{})[_0x5cc6('0x74')](function(_0x2e9086){for(var _0x389727=0x0;_0x389727<_0x5c3b6c[_0x5cc6('0x37')][_0x5cc6('0x56')][_0x5cc6('0x31')];_0x389727+=0x1){socket[_0x5cc6('0x75')](_0x5cc6('0x5e'),{'UserId':Number(_0x5c3b6c[_0x5cc6('0x37')][_0x5cc6('0x56')][_0x389727]),'WhatsappQueueId':Number(_0x5c3b6c[_0x5cc6('0x29')]['id'])});}return _0x2e9086;});}})[_0x5cc6('0x16')](respondWithResult(_0x5a8eea,null))[_0x5cc6('0x27')](handleError(_0x5a8eea,null));};exports['removeAgents']=function(_0x53b339,_0x168ceb){return db[_0x5cc6('0x21')]['find']({'where':{'id':_0x53b339['params']['id']}})['then'](handleEntityNotFound(_0x168ceb,null))[_0x5cc6('0x16')](function(_0x575ced){if(_0x575ced){return _0x575ced[_0x5cc6('0x71')](_0x53b339[_0x5cc6('0x2c')][_0x5cc6('0x56')])[_0x5cc6('0x16')](function(){if(_['isArray'](_0x53b339['query'][_0x5cc6('0x56')])){for(var _0xcd15b7=0x0;_0xcd15b7<_0x53b339[_0x5cc6('0x2c')][_0x5cc6('0x56')][_0x5cc6('0x31')];_0xcd15b7+=0x1){socket[_0x5cc6('0x75')](_0x5cc6('0x72'),{'UserId':Number(_0x53b339[_0x5cc6('0x2c')][_0x5cc6('0x56')][_0xcd15b7]),'WhatsappQueueId':Number(_0x53b339['params']['id'])});}}else{socket[_0x5cc6('0x75')]('userWhatsappQueue:remove',{'UserId':Number(_0x53b339[_0x5cc6('0x2c')][_0x5cc6('0x56')]),'WhatsappQueueId':Number(_0x53b339['params']['id'])});}});}})[_0x5cc6('0x16')](respondWithStatusCode(_0x168ceb,null))[_0x5cc6('0x27')](handleError(_0x168ceb,null));};exports['getAgents']=function(_0x5cdb8b,_0x2f446b){var _0x4766c9={};var _0x2e0676={};var _0x25206e;var _0x442a8e;return db[_0x5cc6('0x21')]['findOne']({'where':{'id':_0x5cdb8b['params']['id']}})[_0x5cc6('0x16')](handleEntityNotFound(_0x2f446b,null))[_0x5cc6('0x16')](function(_0x1da641){if(_0x1da641){_0x25206e=_0x1da641;_0x2e0676[_0x5cc6('0x2d')]=_[_0x5cc6('0x2a')](db[_0x5cc6('0x49')]['rawAttributes']);_0x2e0676['query']=_['keys'](_0x5cdb8b['query']);_0x2e0676[_0x5cc6('0x42')]=_[_0x5cc6('0x2e')](_0x2e0676['model'],_0x2e0676[_0x5cc6('0x2c')]);_0x4766c9[_0x5cc6('0x30')]=_['intersection'](_0x2e0676[_0x5cc6('0x2d')],qs[_0x5cc6('0x2f')](_0x5cdb8b[_0x5cc6('0x2c')][_0x5cc6('0x2f')]));_0x4766c9[_0x5cc6('0x30')]=_0x4766c9[_0x5cc6('0x30')]['length']?_0x4766c9[_0x5cc6('0x30')]:_0x2e0676['model'];_0x4766c9[_0x5cc6('0x44')]=qs[_0x5cc6('0x45')](_0x5cdb8b[_0x5cc6('0x2c')]['sort']);_0x4766c9[_0x5cc6('0x24')]=qs['filters'](_['pick'](_0x5cdb8b[_0x5cc6('0x2c')],_0x2e0676['filters']));if(_0x5cdb8b[_0x5cc6('0x2c')]['filter']){_0x4766c9[_0x5cc6('0x24')]=_[_0x5cc6('0x33')](_0x4766c9[_0x5cc6('0x24')],{'$or':_[_0x5cc6('0x20')](_0x4766c9['attributes'],function(_0x591866){var _0x5cc452={};_0x5cc452[_0x591866]={'$like':'%'+_0x5cdb8b['query'][_0x5cc6('0x48')]+'%'};return _0x5cc452;})});}_0x4766c9=_[_0x5cc6('0x33')]({},_0x4766c9,_0x5cdb8b['options']);return _0x25206e[_0x5cc6('0x76')](_0x4766c9);}})[_0x5cc6('0x16')](function(_0x315d0f){if(_0x315d0f){_0x442a8e=_0x315d0f[_0x5cc6('0x31')];if(!_0x5cdb8b[_0x5cc6('0x2c')]['hasOwnProperty'](_0x5cc6('0x43'))){_0x4766c9[_0x5cc6('0x10')]=qs[_0x5cc6('0x10')](_0x5cdb8b[_0x5cc6('0x2c')][_0x5cc6('0x10')]);_0x4766c9[_0x5cc6('0x12')]=qs[_0x5cc6('0x12')](_0x5cdb8b['query'][_0x5cc6('0x12')]);}return _0x25206e[_0x5cc6('0x76')](_0x4766c9);}})[_0x5cc6('0x16')](function(_0x5079dd){if(_0x5079dd){return _0x5079dd?{'count':_0x442a8e,'rows':_0x5079dd}:null;}})[_0x5cc6('0x16')](respondWithResult(_0x2f446b,null))['catch'](handleError(_0x2f446b,null));}; \ No newline at end of file +var _0xf23b=['push','sequelize','QueryTypes','SELECT','every','TeamId','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','update','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','User','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x176ff3,_0x1d51e5){var _0x7adaf2=function(_0x2b6832){while(--_0x2b6832){_0x176ff3['push'](_0x176ff3['shift']());}};_0x7adaf2(++_0x1d51e5);}(_0xf23b,0x16b));var _0xbf23=function(_0x4b17de,_0x296d5f){_0x4b17de=_0x4b17de-0x0;var _0x52f268=_0xf23b[_0x4b17de];return _0x52f268;};'use strict';var BPromise=require(_0xbf23('0x0'));var util=require('util');var _=require(_0xbf23('0x1'));var squel=require(_0xbf23('0x2'));var Redis=require(_0xbf23('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbf23('0x4'))(_0xbf23('0x5'));var config=require(_0xbf23('0x6'));var db=require(_0xbf23('0x7'))['db'];config[_0xbf23('0x8')]=_[_0xbf23('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf23('0x8')]));require('./whatsappQueue.socket')[_0xbf23('0xa')](socket);function respondWithStatusCode(_0x563f15,_0x282b67){_0x282b67=_0x282b67||0xcc;return function(_0x431e07){if(_0x431e07){return _0x563f15[_0xbf23('0xb')](_0x282b67);}return _0x563f15[_0xbf23('0xc')](_0x282b67)[_0xbf23('0xd')]();};}function respondWithResult(_0x29948a,_0x2326ab){_0x2326ab=_0x2326ab||0xc8;return function(_0x437857){if(_0x437857){return _0x29948a[_0xbf23('0xc')](_0x2326ab)[_0xbf23('0xe')](_0x437857);}};}function respondWithFilteredResult(_0x598b9e,_0x5c3093){return function(_0x3e528c){if(_0x3e528c){var _0x1553e9=typeof _0x5c3093[_0xbf23('0xf')]===_0xbf23('0x10')&&typeof _0x5c3093[_0xbf23('0x11')]==='undefined';var _0x44df7f=_0x3e528c[_0xbf23('0x12')];var _0x4db163=_0x1553e9?0x0:_0x5c3093[_0xbf23('0xf')];var _0x3a01cf=_0x1553e9?_0x3e528c[_0xbf23('0x12')]:_0x5c3093['offset']+_0x5c3093[_0xbf23('0x11')];var _0x4786ff;if(_0x3a01cf>=_0x44df7f){_0x3a01cf=_0x44df7f;_0x4786ff=0xc8;}else{_0x4786ff=0xce;}_0x598b9e['status'](_0x4786ff);return _0x598b9e[_0xbf23('0x13')](_0xbf23('0x14'),_0x4db163+'-'+_0x3a01cf+'/'+_0x44df7f)[_0xbf23('0xe')](_0x3e528c);}return null;};}function saveUpdates(_0x5d8dc3){return function(_0x5a0302){if(_0x5a0302){return _0x5a0302['update'](_0x5d8dc3)[_0xbf23('0x15')](function(_0x2720cf){return _0x2720cf;});}return null;};}function removeEntity(_0x1a30ef){return function(_0x4f4ba4){if(_0x4f4ba4){return _0x4f4ba4[_0xbf23('0x16')]()[_0xbf23('0x15')](function(){var _0x5a353b=_0x4f4ba4[_0xbf23('0x17')]({'plain':!![]});var _0x3603a8='WhatsappQueues';return db[_0xbf23('0x18')][_0xbf23('0x16')]({'where':{'type':_0x3603a8,'resourceId':_0x5a353b['id']}})[_0xbf23('0x15')](function(){return _0x4f4ba4;});})[_0xbf23('0x15')](function(){_0x1a30ef[_0xbf23('0xc')](0xcc)[_0xbf23('0xd')]();});}};}function handleEntityNotFound(_0x13a1b2){return function(_0x5a9d59){if(!_0x5a9d59){_0x13a1b2[_0xbf23('0xb')](0x194);}return _0x5a9d59;};}function handleError(_0x32c0ea,_0xe70cb8){_0xe70cb8=_0xe70cb8||0x1f4;return function(_0x18788e){logger[_0xbf23('0x19')](_0x18788e[_0xbf23('0x1a')]);if(_0x18788e[_0xbf23('0x1b')]){delete _0x18788e[_0xbf23('0x1b')];}_0x32c0ea[_0xbf23('0xc')](_0xe70cb8)[_0xbf23('0x1c')](_0x18788e);};}exports[_0xbf23('0x1d')]=function(_0x19fff4,_0x38d783){var _0xcebdd9={};var _0x1b69b6={'count':0x0,'rows':[]};var _0x465afd=_[_0xbf23('0x1e')](db[_0xbf23('0x1f')][_0xbf23('0x20')],function(_0x10e25c){return{'name':_0x10e25c[_0xbf23('0x21')],'type':_0x10e25c[_0xbf23('0x22')][_0xbf23('0x23')]};});_0xcebdd9=qs[_0xbf23('0x24')](_0x465afd,_0x19fff4);var _0x2e54d8={'where':_0xcebdd9['where']};return db['WhatsappQueue']['count'](_0x2e54d8)[_0xbf23('0x15')](function(_0x5a063b){_0x1b69b6[_0xbf23('0x12')]=_0x5a063b;_0xcebdd9[_0xbf23('0x25')]=qs['include'](_0x19fff4[_0xbf23('0x26')]);return db[_0xbf23('0x1f')][_0xbf23('0x27')](_0xcebdd9);})[_0xbf23('0x15')](function(_0x256dfe){_0x1b69b6[_0xbf23('0x28')]=_0x256dfe;return _0x1b69b6;})['then'](respondWithFilteredResult(_0x38d783,_0xcebdd9))['catch'](handleError(_0x38d783,null));};exports[_0xbf23('0x29')]=function(_0x3fa93a,_0x286332){var _0x53454f={'raw':!![],'where':{'id':_0x3fa93a[_0xbf23('0x2a')]['id']}},_0x4ab34c={};_0x4ab34c[_0xbf23('0x2b')]=_[_0xbf23('0x2c')](db['WhatsappQueue'][_0xbf23('0x20')]);_0x4ab34c['query']=_['keys'](_0x3fa93a[_0xbf23('0x26')]);_0x4ab34c[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0x4ab34c['model'],_0x4ab34c[_0xbf23('0x26')]);_0x53454f[_0xbf23('0x2f')]=_[_0xbf23('0x2e')](_0x4ab34c[_0xbf23('0x2b')],qs[_0xbf23('0x30')](_0x3fa93a[_0xbf23('0x26')]['fields']));_0x53454f['attributes']=_0x53454f[_0xbf23('0x2f')][_0xbf23('0x31')]?_0x53454f[_0xbf23('0x2f')]:_0x4ab34c['model'];if(_0x3fa93a[_0xbf23('0x26')][_0xbf23('0x32')]){_0x53454f[_0xbf23('0x25')]=[{'all':!![]}];}_0x53454f=_[_0xbf23('0x33')]({},_0x53454f,_0x3fa93a['options']);return db[_0xbf23('0x1f')][_0xbf23('0x34')](_0x53454f)[_0xbf23('0x15')](handleEntityNotFound(_0x286332,null))[_0xbf23('0x15')](respondWithResult(_0x286332,null))[_0xbf23('0x35')](handleError(_0x286332,null));};exports[_0xbf23('0x36')]=function(_0x39f323,_0x339d0a){return db['WhatsappQueue'][_0xbf23('0x36')](_0x39f323[_0xbf23('0x37')],{})[_0xbf23('0x15')](function(_0x4f5324){var _0x3eb793=_0x39f323[_0xbf23('0x38')]['get']({'plain':!![]});if(!_0x3eb793)throw new Error(_0xbf23('0x39'));if(_0x3eb793['role']===_0xbf23('0x38')){var _0x5d877f=_0x4f5324['get']({'plain':!![]});var _0x2bfb6d='WhatsappQueues';return db[_0xbf23('0x3a')][_0xbf23('0x34')]({'where':{'name':_0x2bfb6d,'userProfileId':_0x3eb793[_0xbf23('0x3b')]},'raw':!![]})[_0xbf23('0x15')](function(_0x54a32b){if(_0x54a32b&&_0x54a32b['autoAssociation']===0x0){return db[_0xbf23('0x18')][_0xbf23('0x36')]({'name':_0x5d877f[_0xbf23('0x1b')],'resourceId':_0x5d877f['id'],'type':_0x54a32b[_0xbf23('0x1b')],'sectionId':_0x54a32b['id']},{})[_0xbf23('0x15')](function(){return _0x4f5324;});}else{return _0x4f5324;}})[_0xbf23('0x35')](function(_0x477128){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x477128);throw _0x477128;});}return _0x4f5324;})['then'](respondWithResult(_0x339d0a,0xc9))['catch'](handleError(_0x339d0a,null));};exports[_0xbf23('0x3c')]=function(_0x539760,_0x1ed6d2){if(_0x539760['body']['id']){delete _0x539760['body']['id'];}return db[_0xbf23('0x1f')][_0xbf23('0x34')]({'where':{'id':_0x539760[_0xbf23('0x2a')]['id']}})[_0xbf23('0x15')](handleEntityNotFound(_0x1ed6d2,null))[_0xbf23('0x15')](saveUpdates(_0x539760[_0xbf23('0x37')],null))[_0xbf23('0x15')](respondWithResult(_0x1ed6d2,null))[_0xbf23('0x35')](handleError(_0x1ed6d2,null));};exports['destroy']=function(_0x2b983f,_0x359bbf){return db[_0xbf23('0x1f')]['find']({'where':{'id':_0x2b983f[_0xbf23('0x2a')]['id']}})['then'](handleEntityNotFound(_0x359bbf,null))[_0xbf23('0x15')](removeEntity(_0x359bbf,null))['catch'](handleError(_0x359bbf,null));};exports['describe']=function(_0x14c7b6,_0x3a145d){return db['WhatsappQueue']['describe']()[_0xbf23('0x15')](respondWithResult(_0x3a145d,null))[_0xbf23('0x35')](handleError(_0x3a145d,null));};exports[_0xbf23('0x3d')]=function(_0xe5094d,_0x184d98){var _0x20074d={'raw':!![],'where':{}},_0x5e50f7={},_0x300d2b;return db[_0xbf23('0x1f')][_0xbf23('0x3e')]({'where':{'id':_0xe5094d[_0xbf23('0x2a')]['id']}})['then'](handleEntityNotFound(_0x184d98,null))['then'](function(_0x49286a){if(_0x49286a){_0x300d2b=_0x49286a['get']({'plain':!![]});_0x5e50f7[_0xbf23('0x2b')]=_[_0xbf23('0x2c')](db[_0xbf23('0x3f')][_0xbf23('0x20')]);_0x5e50f7[_0xbf23('0x26')]=_['keys'](_0xe5094d[_0xbf23('0x26')]);_0x5e50f7[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0x5e50f7[_0xbf23('0x2b')],_0x5e50f7[_0xbf23('0x26')]);_0x20074d['attributes']=_['intersection'](_0x5e50f7[_0xbf23('0x2b')],qs[_0xbf23('0x30')](_0xe5094d[_0xbf23('0x26')][_0xbf23('0x30')]));_0x20074d['attributes']=_0x20074d[_0xbf23('0x2f')]['length']?_0x20074d['attributes']:_0x5e50f7['model'];if(!_0xe5094d[_0xbf23('0x26')][_0xbf23('0x40')](_0xbf23('0x41'))){_0x20074d[_0xbf23('0x11')]=qs[_0xbf23('0x11')](_0xe5094d[_0xbf23('0x26')][_0xbf23('0x11')]);_0x20074d[_0xbf23('0xf')]=qs[_0xbf23('0xf')](_0xe5094d[_0xbf23('0x26')][_0xbf23('0xf')]);}_0x20074d[_0xbf23('0x42')]=qs[_0xbf23('0x43')](_0xe5094d[_0xbf23('0x26')][_0xbf23('0x43')]);_0x20074d[_0xbf23('0x44')]=qs['filters'](_[_0xbf23('0x45')](_0xe5094d[_0xbf23('0x26')],_0x5e50f7[_0xbf23('0x2d')]));_0x20074d[_0xbf23('0x44')]['WhatsappQueueId']=_0x49286a['id'];if(_0xe5094d[_0xbf23('0x26')][_0xbf23('0x46')]){_0x20074d[_0xbf23('0x44')]=_[_0xbf23('0x33')](_0x20074d[_0xbf23('0x44')],{'$or':_[_0xbf23('0x1e')](_0x20074d[_0xbf23('0x2f')],function(_0x21534d){var _0x1cb46d={};_0x1cb46d[_0x21534d]={'$like':'%'+_0xe5094d['query']['filter']+'%'};return _0x1cb46d;})});}_0x20074d=_['merge']({},_0x20074d,_0xe5094d[_0xbf23('0x47')]);return db[_0xbf23('0x3f')][_0xbf23('0x27')](_0x20074d);}})['then'](function(_0x4464ff){if(_0x4464ff){return db[_0xbf23('0x48')]['findAndCountAll']({'where':{'id':_[_0xbf23('0x1e')](_0x4464ff,'UserId'),'role':_0xbf23('0x49')},'attributes':['id',_0xbf23('0x1b'),_0xbf23('0x4a'),_0xbf23('0x4b'),_0xbf23('0x4c')]});}})[_0xbf23('0x15')](function(_0x2271db){if(_0x2271db){return{'count':_0x2271db[_0xbf23('0x12')],'rows':_[_0xbf23('0x1e')](_0x2271db[_0xbf23('0x28')],function(_0x4a5fa9){return{'membername':_0x4a5fa9['name'],'UserId':_0x4a5fa9['id'],'queue_name':_0x300d2b[_0xbf23('0x1b')],'WhatsappQueueId':_0x300d2b['id'],'interface':util['format'](_0xbf23('0x4d'),_0xbf23('0x4e'),_0x4a5fa9[_0xbf23('0x1b')]),'penalty':0x0,'paused':_0x4a5fa9['whatsappPause'],'createdAt':_0x4a5fa9[_0xbf23('0x4c')],'updatedAt':_0x4a5fa9[_0xbf23('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf23('0x15')](respondWithFilteredResult(_0x184d98,_0x20074d))[_0xbf23('0x35')](handleError(_0x184d98,null));};exports['getTeams']=function(_0x5e2e9e,_0x348793){var _0x3b5e82={};var _0x55e74b={};var _0x125e0b;var _0x26da34;return db[_0xbf23('0x1f')][_0xbf23('0x3e')]({'where':{'id':_0x5e2e9e[_0xbf23('0x2a')]['id']}})[_0xbf23('0x15')](handleEntityNotFound(_0x348793,null))[_0xbf23('0x15')](function(_0x281e76){if(_0x281e76){_0x125e0b=_0x281e76;_0x55e74b[_0xbf23('0x2b')]=_[_0xbf23('0x2c')](db['Team'][_0xbf23('0x20')]);_0x55e74b['query']=_[_0xbf23('0x2c')](_0x5e2e9e[_0xbf23('0x26')]);_0x55e74b[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0x55e74b[_0xbf23('0x2b')],_0x55e74b[_0xbf23('0x26')]);_0x3b5e82['attributes']=_['intersection'](_0x55e74b['model'],qs['fields'](_0x5e2e9e[_0xbf23('0x26')][_0xbf23('0x30')]));_0x3b5e82[_0xbf23('0x2f')]=_0x3b5e82['attributes'][_0xbf23('0x31')]?_0x3b5e82[_0xbf23('0x2f')]:_0x55e74b[_0xbf23('0x2b')];_0x3b5e82[_0xbf23('0x42')]=qs[_0xbf23('0x43')](_0x5e2e9e[_0xbf23('0x26')]['sort']);_0x3b5e82[_0xbf23('0x44')]=qs['filters'](_['pick'](_0x5e2e9e[_0xbf23('0x26')],_0x55e74b[_0xbf23('0x2d')]));if(_0x5e2e9e[_0xbf23('0x26')][_0xbf23('0x46')]){_0x3b5e82[_0xbf23('0x44')]=_['merge'](_0x3b5e82[_0xbf23('0x44')],{'$or':_[_0xbf23('0x1e')](_0x3b5e82[_0xbf23('0x2f')],function(_0x52d97d){var _0x1227ba={};_0x1227ba[_0x52d97d]={'$like':'%'+_0x5e2e9e[_0xbf23('0x26')]['filter']+'%'};return _0x1227ba;})});}_0x3b5e82=_[_0xbf23('0x33')]({},_0x3b5e82,_0x5e2e9e[_0xbf23('0x47')]);return _0x125e0b['getTeams'](_0x3b5e82);}})[_0xbf23('0x15')](function(_0x4b6a71){if(_0x4b6a71){_0x26da34=_0x4b6a71[_0xbf23('0x31')];if(!_0x5e2e9e[_0xbf23('0x26')][_0xbf23('0x40')](_0xbf23('0x41'))){_0x3b5e82[_0xbf23('0x11')]=qs[_0xbf23('0x11')](_0x5e2e9e['query']['limit']);_0x3b5e82[_0xbf23('0xf')]=qs[_0xbf23('0xf')](_0x5e2e9e['query'][_0xbf23('0xf')]);}return _0x125e0b[_0xbf23('0x4f')](_0x3b5e82);}})[_0xbf23('0x15')](function(_0x323595){if(_0x323595){return _0x323595?{'count':_0x26da34,'rows':_0x323595}:null;}})[_0xbf23('0x15')](respondWithResult(_0x348793,null))[_0xbf23('0x35')](handleError(_0x348793,null));};exports[_0xbf23('0x50')]=function(_0x130127,_0x641ea){var _0x222b6a=_0x130127[_0xbf23('0x37')][_0xbf23('0x51')];return db[_0xbf23('0x52')]['findAll']({'where':{'id':_0x222b6a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbf23('0x53'),'attributes':['id','name',_0xbf23('0x54'),_0xbf23('0x55'),_0xbf23('0x56')],'raw':!![]}]})[_0xbf23('0x15')](function(_0x7a012c){if(_0x7a012c){var _0x1a430d=_['flatMap'](_0x7a012c,function(_0x3f7a66){var _0x24bd9d=_0x3f7a66[_0xbf23('0x17')]({'plain':!![]});return _0x24bd9d[_0xbf23('0x53')];});return db[_0xbf23('0x1f')]['find']({'where':{'id':_0x130127[_0xbf23('0x2a')]['id']}})['then'](function(_0x438acb){return db['sequelize'][_0xbf23('0x57')](function(_0x4f7100){return _0x438acb[_0xbf23('0x50')](_0x222b6a,{'transaction':_0x4f7100})[_0xbf23('0x15')](function(){return BPromise['each'](_0x1a430d,function(_0x29f6a4){return db['UserWhatsappQueue'][_0xbf23('0x58')]({'where':{'UserId':_0x29f6a4['id'],'WhatsappQueueId':_0x130127['params']['id']},'transaction':_0x4f7100});});})[_0xbf23('0x15')](function(){_0x1a430d[_0xbf23('0x59')](function(_0x5c8675){socket[_0xbf23('0x5a')](_0xbf23('0x5b'),{'UserId':_0x5c8675['id'],'WhatsappQueueId':_0x438acb['id']});});});});});}})[_0xbf23('0x15')](respondWithStatusCode(_0x641ea,null))['catch'](handleError(_0x641ea,null));};exports[_0xbf23('0x5c')]=function(_0x5baf5c,_0x11509d){return db[_0xbf23('0x52')][_0xbf23('0x27')]({'where':{'id':_0x5baf5c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbf23('0x53'),'attributes':['id'],'raw':!![]}]})[_0xbf23('0x15')](handleEntityNotFound(_0x11509d,null))[_0xbf23('0x15')](function(_0x3f0e0b){var _0x54b169=_[_0xbf23('0x1e')](_0x3f0e0b,'id');var _0x2f1c36=[];var _0x4efa56=[];var _0x40c5df=squel[_0xbf23('0x5d')]();_0x40c5df['field'](_0xbf23('0x5e'))[_0xbf23('0x5f')]('team_has_whatsapp_queues','tq')[_0xbf23('0x60')]('user_has_teams','ut',_0xbf23('0x61'))[_0xbf23('0x44')](_0xbf23('0x62'),_0x5baf5c['params']['id']);for(var _0x32f33b=0x0;_0x32f33b<_0x3f0e0b[_0xbf23('0x31')];_0x32f33b+=0x1){let _0xf4d544=_0x3f0e0b[_0x32f33b];for(var _0x100aaf=0x0;_0x100aaf<_0xf4d544[_0xbf23('0x53')][_0xbf23('0x31')];_0x100aaf+=0x1){let _0x4ab6a2=_0xf4d544[_0xbf23('0x53')][_0x100aaf];var _0x12b891=_0x40c5df[_0xbf23('0x63')]();_0x12b891[_0xbf23('0x44')](_0xbf23('0x64'),_0x4ab6a2['id']);_0x4efa56[_0xbf23('0x65')](db[_0xbf23('0x66')][_0xbf23('0x26')](_0x12b891['toString'](),{'type':db[_0xbf23('0x66')][_0xbf23('0x67')][_0xbf23('0x68')]})[_0xbf23('0x15')](function(_0x28714b){if(_0x28714b[_0xbf23('0x31')]===0x1){return _0x4ab6a2['id'];}else{var _0x4ebd9c=_[_0xbf23('0x69')](_[_0xbf23('0x1e')](_0x28714b,_0xbf23('0x6a')),function(_0x536659){return _['includes'](_0x54b169,_0x536659);});if(_0x4ebd9c){return _0x4ab6a2['id'];}}}));}}return BPromise['all'](_0x4efa56)[_0xbf23('0x15')](function(_0x9b63de){_0x2f1c36=_(_0x2f1c36)[_0xbf23('0x6b')](_0x9b63de)['compact']()[_0xbf23('0x6c')]();return db[_0xbf23('0x1f')][_0xbf23('0x34')]({'where':{'id':_0x5baf5c['params']['id']}})[_0xbf23('0x15')](function(_0x526afc){return db[_0xbf23('0x66')][_0xbf23('0x57')](function(_0x695e9d){return _0x526afc[_0xbf23('0x5c')](_0x5baf5c[_0xbf23('0x26')]['ids'],{'transaction':_0x695e9d})['then'](function(){if(!_[_0xbf23('0x6d')](_0x2f1c36)){return _0x526afc[_0xbf23('0x6e')](_0x2f1c36,{'transaction':_0x695e9d});}})[_0xbf23('0x15')](function(){_0x2f1c36[_0xbf23('0x59')](function(_0x3bda76){socket[_0xbf23('0x5a')](_0xbf23('0x6f'),{'UserId':_0x3bda76,'WhatsappQueueId':_0x526afc['id']});});});});});});})['then'](respondWithStatusCode(_0x11509d,null))['catch'](handleError(_0x11509d,null));};exports[_0xbf23('0x70')]=function(_0x8b5552,_0x347b5d){return db[_0xbf23('0x1f')][_0xbf23('0x34')]({'where':{'id':_0x8b5552[_0xbf23('0x2a')]['id']}})[_0xbf23('0x15')](handleEntityNotFound(_0x347b5d,null))[_0xbf23('0x15')](function(_0x30270e){if(_0x30270e){return _0x30270e[_0xbf23('0x70')](_0x8b5552['body']['ids'],_[_0xbf23('0x71')](_0x8b5552[_0xbf23('0x37')],[_0xbf23('0x51'),'id'])||{})[_0xbf23('0x72')](function(_0x50019d){for(var _0x9541cf=0x0;_0x9541cf<_0x8b5552[_0xbf23('0x37')][_0xbf23('0x51')]['length'];_0x9541cf+=0x1){socket[_0xbf23('0x5a')](_0xbf23('0x5b'),{'UserId':Number(_0x8b5552[_0xbf23('0x37')][_0xbf23('0x51')][_0x9541cf]),'WhatsappQueueId':Number(_0x8b5552['params']['id'])});}return _0x50019d;});}})[_0xbf23('0x15')](respondWithResult(_0x347b5d,null))[_0xbf23('0x35')](handleError(_0x347b5d,null));};exports[_0xbf23('0x6e')]=function(_0x524aa0,_0x297700){return db[_0xbf23('0x1f')][_0xbf23('0x34')]({'where':{'id':_0x524aa0[_0xbf23('0x2a')]['id']}})[_0xbf23('0x15')](handleEntityNotFound(_0x297700,null))[_0xbf23('0x15')](function(_0xf09541){if(_0xf09541){return _0xf09541['removeAgents'](_0x524aa0[_0xbf23('0x26')]['ids'])[_0xbf23('0x15')](function(){if(_['isArray'](_0x524aa0[_0xbf23('0x26')][_0xbf23('0x51')])){for(var _0x483190=0x0;_0x483190<_0x524aa0['query'][_0xbf23('0x51')][_0xbf23('0x31')];_0x483190+=0x1){socket['emit'](_0xbf23('0x6f'),{'UserId':Number(_0x524aa0[_0xbf23('0x26')][_0xbf23('0x51')][_0x483190]),'WhatsappQueueId':Number(_0x524aa0[_0xbf23('0x2a')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x524aa0[_0xbf23('0x26')][_0xbf23('0x51')]),'WhatsappQueueId':Number(_0x524aa0['params']['id'])});}});}})[_0xbf23('0x15')](respondWithStatusCode(_0x297700,null))[_0xbf23('0x35')](handleError(_0x297700,null));};exports[_0xbf23('0x73')]=function(_0x1351e2,_0x409725){var _0x2681e7={};var _0xc6ae70={};var _0x52e957;var _0x4cb2ef;return db[_0xbf23('0x1f')][_0xbf23('0x3e')]({'where':{'id':_0x1351e2[_0xbf23('0x2a')]['id']}})['then'](handleEntityNotFound(_0x409725,null))[_0xbf23('0x15')](function(_0x3b583e){if(_0x3b583e){_0x52e957=_0x3b583e;_0xc6ae70[_0xbf23('0x2b')]=_['keys'](db['User'][_0xbf23('0x20')]);_0xc6ae70[_0xbf23('0x26')]=_[_0xbf23('0x2c')](_0x1351e2['query']);_0xc6ae70[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0xc6ae70[_0xbf23('0x2b')],_0xc6ae70[_0xbf23('0x26')]);_0x2681e7[_0xbf23('0x2f')]=_[_0xbf23('0x2e')](_0xc6ae70['model'],qs['fields'](_0x1351e2['query'][_0xbf23('0x30')]));_0x2681e7['attributes']=_0x2681e7[_0xbf23('0x2f')][_0xbf23('0x31')]?_0x2681e7['attributes']:_0xc6ae70[_0xbf23('0x2b')];_0x2681e7[_0xbf23('0x42')]=qs[_0xbf23('0x43')](_0x1351e2[_0xbf23('0x26')][_0xbf23('0x43')]);_0x2681e7[_0xbf23('0x44')]=qs[_0xbf23('0x2d')](_[_0xbf23('0x45')](_0x1351e2[_0xbf23('0x26')],_0xc6ae70['filters']));if(_0x1351e2['query'][_0xbf23('0x46')]){_0x2681e7[_0xbf23('0x44')]=_[_0xbf23('0x33')](_0x2681e7[_0xbf23('0x44')],{'$or':_['map'](_0x2681e7[_0xbf23('0x2f')],function(_0x234d9b){var _0xdc6c07={};_0xdc6c07[_0x234d9b]={'$like':'%'+_0x1351e2[_0xbf23('0x26')]['filter']+'%'};return _0xdc6c07;})});}_0x2681e7=_[_0xbf23('0x33')]({},_0x2681e7,_0x1351e2[_0xbf23('0x47')]);return _0x52e957[_0xbf23('0x73')](_0x2681e7);}})['then'](function(_0x11b097){if(_0x11b097){_0x4cb2ef=_0x11b097[_0xbf23('0x31')];if(!_0x1351e2['query'][_0xbf23('0x40')](_0xbf23('0x41'))){_0x2681e7[_0xbf23('0x11')]=qs[_0xbf23('0x11')](_0x1351e2[_0xbf23('0x26')][_0xbf23('0x11')]);_0x2681e7[_0xbf23('0xf')]=qs[_0xbf23('0xf')](_0x1351e2[_0xbf23('0x26')]['offset']);}return _0x52e957[_0xbf23('0x73')](_0x2681e7);}})[_0xbf23('0x15')](function(_0x37199b){if(_0x37199b){return _0x37199b?{'count':_0x4cb2ef,'rows':_0x37199b}:null;}})[_0xbf23('0x15')](respondWithResult(_0x409725,null))['catch'](handleError(_0x409725,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2afb4a1..2e4ef20 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 _0x7cde=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x2594ef,_0xeeffc0){var _0x1faa38=function(_0x4a6502){while(--_0x4a6502){_0x2594ef['push'](_0x2594ef['shift']());}};_0x1faa38(++_0xeeffc0);}(_0x7cde,0x10a));var _0xe7cd=function(_0x3a290d,_0x1a363b){_0x3a290d=_0x3a290d-0x0;var _0x2533cc=_0x7cde[_0x3a290d];return _0x2533cc;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xe7cd('0x0'))['db'][_0xe7cd('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe7cd('0x2')](0x0);var events={'afterCreate':_0xe7cd('0x3'),'afterUpdate':_0xe7cd('0x4'),'afterDestroy':_0xe7cd('0x5')};function emitEvent(_0x136683){return function(_0x483f52,_0x33336b,_0x53c8d7){WhatsappQueueEvents[_0xe7cd('0x6')](_0x136683+':'+_0x483f52['id'],_0x483f52);WhatsappQueueEvents[_0xe7cd('0x6')](_0x136683,_0x483f52);_0x53c8d7(null);};}for(var e in events){if(events[_0xe7cd('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xe7cd('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x388e=['hook','exports','events','WhatsappQueue','save','update','emit','hasOwnProperty'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x388e,0x1aa));var _0xe388=function(_0xc79d2e,_0x2e17f9){_0xc79d2e=_0xc79d2e-0x0;var _0x5675a7=_0x388e[_0xc79d2e];return _0x5675a7;};'use strict';var EventEmitter=require(_0xe388('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xe388('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe388('0x2'),'afterUpdate':_0xe388('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d9ae5){return function(_0x173cd3,_0x2d50da,_0x3ab055){WhatsappQueueEvents[_0xe388('0x4')](_0x3d9ae5+':'+_0x173cd3['id'],_0x173cd3);WhatsappQueueEvents['emit'](_0x3d9ae5,_0x173cd3);_0x3ab055(null);};}for(var e in events){if(events[_0xe388('0x5')](e)){var event=events[e];WhatsappQueue[_0xe388('0x6')](e,emitEvent(event));}}module[_0xe388('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 41b6541..d6f5235 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 _0x2f7d=['define','WhatsappQueue','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x2f7d,0x86));var _0xd2f7=function(_0x18ccbe,_0xb67456){_0x18ccbe=_0x18ccbe-0x0;var _0xd98f57=_0x2f7d[_0x18ccbe];return _0xd98f57;};'use strict';var _=require(_0xd2f7('0x0'));var util=require(_0xd2f7('0x1'));var logger=require(_0xd2f7('0x2'))('api');var moment=require(_0xd2f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2f7('0x5'));var config=require(_0xd2f7('0x6'));var attributes=require(_0xd2f7('0x7'));module[_0xd2f7('0x8')]=function(_0x12c55e,_0x5373ae){return _0x12c55e[_0xd2f7('0x9')](_0xd2f7('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44eb=['define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes'];(function(_0x157f67,_0x3d10da){var _0x298cc2=function(_0x553bdf){while(--_0x553bdf){_0x157f67['push'](_0x157f67['shift']());}};_0x298cc2(++_0x3d10da);}(_0x44eb,0x7b));var _0xb44e=function(_0x5a5aca,_0x368fbb){_0x5a5aca=_0x5a5aca-0x0;var _0x1cb523=_0x44eb[_0x5a5aca];return _0x1cb523;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb44e('0x0'))(_0xb44e('0x1'));var moment=require(_0xb44e('0x2'));var BPromise=require(_0xb44e('0x3'));var rp=require(_0xb44e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb44e('0x5'));var attributes=require(_0xb44e('0x6'));module['exports']=function(_0x4789c5,_0x13b10c){return _0x4789c5[_0xb44e('0x7')](_0xb44e('0x8'),attributes,{'tableName':_0xb44e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9d4bd9a..278cd78 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 _0xb360=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','model','map','find','raw','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x284c9c,_0x1f0cf2){var _0x15fc20=function(_0x183101){while(--_0x183101){_0x284c9c['push'](_0x284c9c['shift']());}};_0x15fc20(++_0x1f0cf2);}(_0xb360,0x9e));var _0x0b36=function(_0x42e25c,_0x505425){_0x42e25c=_0x42e25c-0x0;var _0x2f6dc2=_0xb360[_0x42e25c];return _0x2f6dc2;};'use strict';var _=require(_0x0b36('0x0'));var util=require(_0x0b36('0x1'));var moment=require(_0x0b36('0x2'));var BPromise=require(_0x0b36('0x3'));var rs=require(_0x0b36('0x4'));var fs=require('fs');var Redis=require(_0x0b36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b36('0x6'));var logger=require(_0x0b36('0x7'))(_0x0b36('0x8'));var config=require(_0x0b36('0x9'));var jayson=require(_0x0b36('0xa'));var client=jayson[_0x0b36('0xb')]['http']({'port':0x232a});config['redis']=_[_0x0b36('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0b36('0xd'))(new Redis(config[_0x0b36('0xe')]));require('./whatsappQueue.socket')[_0x0b36('0xf')](socket);function respondWithRpcPromise(_0x36e333,_0x2417dc,_0x14e080){return new BPromise(function(_0x158095,_0x516197){return client[_0x0b36('0x10')](_0x36e333,_0x14e080)[_0x0b36('0x11')](function(_0x54df7e){logger[_0x0b36('0x12')](_0x0b36('0x13'),_0x2417dc,_0x0b36('0x14'));logger[_0x0b36('0x15')](_0x0b36('0x16'),_0x2417dc,'request\x20sent',JSON[_0x0b36('0x17')](_0x54df7e));if(_0x54df7e[_0x0b36('0x18')]){if(_0x54df7e['error'][_0x0b36('0x19')]===0x1f4){logger[_0x0b36('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x2417dc,_0x54df7e['error'][_0x0b36('0x1a')]);return _0x516197(_0x54df7e[_0x0b36('0x18')][_0x0b36('0x1a')]);}logger['error'](_0x0b36('0x13'),_0x2417dc,_0x54df7e['error']['message']);return _0x158095(_0x54df7e[_0x0b36('0x18')]['message']);}else{logger[_0x0b36('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2417dc,_0x0b36('0x14'));_0x158095(_0x54df7e[_0x0b36('0x1b')][_0x0b36('0x1a')]);}})[_0x0b36('0x1c')](function(_0x2cff2d){logger[_0x0b36('0x18')](_0x0b36('0x13'),_0x2417dc,_0x2cff2d);_0x516197(_0x2cff2d);});});}exports[_0x0b36('0x1d')]=function(_0x6e66c5){var _0x566425=this;return new Promise(function(_0x557cc3,_0x52bbf2){return db[_0x0b36('0x1e')]['findAll']({'raw':_0x6e66c5[_0x0b36('0x1f')]?_0x6e66c5[_0x0b36('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x6e66c5[_0x0b36('0x1f')]?_0x6e66c5[_0x0b36('0x1f')][_0x0b36('0x20')]||null:null,'attributes':_0x6e66c5[_0x0b36('0x1f')]?_0x6e66c5[_0x0b36('0x1f')][_0x0b36('0x21')]||null:null,'limit':_0x6e66c5[_0x0b36('0x1f')]?_0x6e66c5[_0x0b36('0x1f')][_0x0b36('0x22')]||null:null,'include':_0x6e66c5[_0x0b36('0x1f')]?_0x6e66c5['options'][_0x0b36('0x23')]?_['map'](_0x6e66c5[_0x0b36('0x1f')]['include'],function(_0x1b0649){return{'model':db[_0x1b0649[_0x0b36('0x24')]],'as':_0x1b0649['as'],'attributes':_0x1b0649[_0x0b36('0x21')],'include':_0x1b0649['include']?_[_0x0b36('0x25')](_0x1b0649['include'],function(_0x52e6e0){return{'model':db[_0x52e6e0['model']],'as':_0x52e6e0['as'],'attributes':_0x52e6e0['attributes'],'include':_0x52e6e0['include']?_[_0x0b36('0x25')](_0x52e6e0[_0x0b36('0x23')],function(_0x283967){return{'model':db[_0x283967[_0x0b36('0x24')]],'as':_0x283967['as'],'attributes':_0x283967['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b36('0x11')](function(_0x1c61bd){logger['info'](_0x0b36('0x1d'),_0x6e66c5);logger[_0x0b36('0x15')](_0x0b36('0x1d'),_0x6e66c5,JSON[_0x0b36('0x17')](_0x1c61bd));_0x557cc3(_0x1c61bd);})[_0x0b36('0x1c')](function(_0x265e00){logger[_0x0b36('0x18')](_0x0b36('0x1d'),_0x265e00[_0x0b36('0x1a')],_0x6e66c5);_0x52bbf2(_0x566425[_0x0b36('0x18')](0x1f4,_0x265e00[_0x0b36('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x55e6a0){var _0x7958e1=this;return new Promise(function(_0x154d8c,_0x4c763f){return db[_0x0b36('0x1e')][_0x0b36('0x26')]({'raw':_0x55e6a0[_0x0b36('0x1f')]?_0x55e6a0[_0x0b36('0x1f')][_0x0b36('0x27')]===undefined?!![]:![]:!![],'where':_0x55e6a0[_0x0b36('0x1f')]?_0x55e6a0[_0x0b36('0x1f')][_0x0b36('0x20')]||null:null,'attributes':_0x55e6a0[_0x0b36('0x1f')]?_0x55e6a0['options']['attributes']||null:null,'include':_0x55e6a0[_0x0b36('0x1f')]?_0x55e6a0[_0x0b36('0x1f')][_0x0b36('0x23')]?_['map'](_0x55e6a0[_0x0b36('0x1f')]['include'],function(_0x4b5bce){return{'model':db[_0x4b5bce['model']],'as':_0x4b5bce['as'],'attributes':_0x4b5bce[_0x0b36('0x21')],'include':_0x4b5bce[_0x0b36('0x23')]?_[_0x0b36('0x25')](_0x4b5bce[_0x0b36('0x23')],function(_0x312b65){return{'model':db[_0x312b65[_0x0b36('0x24')]],'as':_0x312b65['as'],'attributes':_0x312b65['attributes'],'include':_0x312b65['include']?_[_0x0b36('0x25')](_0x312b65[_0x0b36('0x23')],function(_0x242f60){return{'model':db[_0x242f60[_0x0b36('0x24')]],'as':_0x242f60['as'],'attributes':_0x242f60[_0x0b36('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x503077){logger[_0x0b36('0x12')](_0x0b36('0x28'),_0x55e6a0);logger['debug'](_0x0b36('0x28'),_0x55e6a0,JSON[_0x0b36('0x17')](_0x503077));_0x154d8c(_0x503077);})[_0x0b36('0x1c')](function(_0x51709a){logger[_0x0b36('0x18')](_0x0b36('0x28'),_0x51709a[_0x0b36('0x1a')],_0x55e6a0);_0x4c763f(_0x7958e1[_0x0b36('0x18')](0x1f4,_0x51709a[_0x0b36('0x1a')]));});});}; \ No newline at end of file +var _0x8879=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','attributes','include','model','map','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1ee2ae,_0x17c0eb){var _0x1780e5=function(_0x5c592b){while(--_0x5c592b){_0x1ee2ae['push'](_0x1ee2ae['shift']());}};_0x1780e5(++_0x17c0eb);}(_0x8879,0x8d));var _0x9887=function(_0x45d0f4,_0x2d7bd4){_0x45d0f4=_0x45d0f4-0x0;var _0x19b544=_0x8879[_0x45d0f4];return _0x19b544;};'use strict';var _=require(_0x9887('0x0'));var util=require(_0x9887('0x1'));var moment=require(_0x9887('0x2'));var BPromise=require(_0x9887('0x3'));var rs=require(_0x9887('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9887('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9887('0x6'))(_0x9887('0x7'));var config=require(_0x9887('0x8'));var jayson=require(_0x9887('0x9'));var client=jayson[_0x9887('0xa')][_0x9887('0xb')]({'port':0x232a});config[_0x9887('0xc')]=_[_0x9887('0xd')](config['redis'],{'host':_0x9887('0xe'),'port':0x18eb});var socket=require(_0x9887('0xf'))(new Redis(config[_0x9887('0xc')]));require(_0x9887('0x10'))[_0x9887('0x11')](socket);function respondWithRpcPromise(_0x58096e,_0x1bfc73,_0x468f40){return new BPromise(function(_0x4b0660,_0x2f2faa){return client[_0x9887('0x12')](_0x58096e,_0x468f40)[_0x9887('0x13')](function(_0x122968){logger[_0x9887('0x14')](_0x9887('0x15'),_0x1bfc73,_0x9887('0x16'));logger[_0x9887('0x17')](_0x9887('0x18'),_0x1bfc73,_0x9887('0x16'),JSON[_0x9887('0x19')](_0x122968));if(_0x122968[_0x9887('0x1a')]){if(_0x122968['error'][_0x9887('0x1b')]===0x1f4){logger[_0x9887('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x1bfc73,_0x122968[_0x9887('0x1a')][_0x9887('0x1c')]);return _0x2f2faa(_0x122968[_0x9887('0x1a')][_0x9887('0x1c')]);}logger[_0x9887('0x1a')](_0x9887('0x15'),_0x1bfc73,_0x122968[_0x9887('0x1a')][_0x9887('0x1c')]);return _0x4b0660(_0x122968[_0x9887('0x1a')][_0x9887('0x1c')]);}else{logger[_0x9887('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x1bfc73,'request\x20sent');_0x4b0660(_0x122968[_0x9887('0x1d')][_0x9887('0x1c')]);}})[_0x9887('0x1e')](function(_0x224149){logger[_0x9887('0x1a')](_0x9887('0x15'),_0x1bfc73,_0x224149);_0x2f2faa(_0x224149);});});}exports['GetWhatsappQueue']=function(_0x563b40){var _0x1e3af1=this;return new Promise(function(_0x5a5cec,_0x5d539b){return db[_0x9887('0x1f')][_0x9887('0x20')]({'raw':_0x563b40['options']?_0x563b40[_0x9887('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x563b40[_0x9887('0x21')]?_0x563b40[_0x9887('0x21')]['where']||null:null,'attributes':_0x563b40[_0x9887('0x21')]?_0x563b40[_0x9887('0x21')][_0x9887('0x22')]||null:null,'limit':_0x563b40[_0x9887('0x21')]?_0x563b40[_0x9887('0x21')]['limit']||null:null,'include':_0x563b40['options']?_0x563b40[_0x9887('0x21')][_0x9887('0x23')]?_['map'](_0x563b40[_0x9887('0x21')][_0x9887('0x23')],function(_0x361b25){return{'model':db[_0x361b25[_0x9887('0x24')]],'as':_0x361b25['as'],'attributes':_0x361b25[_0x9887('0x22')],'include':_0x361b25[_0x9887('0x23')]?_[_0x9887('0x25')](_0x361b25['include'],function(_0x2e4203){return{'model':db[_0x2e4203[_0x9887('0x24')]],'as':_0x2e4203['as'],'attributes':_0x2e4203['attributes'],'include':_0x2e4203[_0x9887('0x23')]?_[_0x9887('0x25')](_0x2e4203[_0x9887('0x23')],function(_0x58ed42){return{'model':db[_0x58ed42[_0x9887('0x24')]],'as':_0x58ed42['as'],'attributes':_0x58ed42[_0x9887('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9887('0x13')](function(_0x58e23){logger[_0x9887('0x14')]('GetWhatsappQueue',_0x563b40);logger[_0x9887('0x17')]('GetWhatsappQueue',_0x563b40,JSON['stringify'](_0x58e23));_0x5a5cec(_0x58e23);})[_0x9887('0x1e')](function(_0x1f75d3){logger[_0x9887('0x1a')]('GetWhatsappQueue',_0x1f75d3[_0x9887('0x1c')],_0x563b40);_0x5d539b(_0x1e3af1[_0x9887('0x1a')](0x1f4,_0x1f75d3[_0x9887('0x1c')]));});});};exports[_0x9887('0x26')]=function(_0x5f02cd){var _0x1922de=this;return new Promise(function(_0xfc547b,_0x1bdf68){return db[_0x9887('0x1f')][_0x9887('0x27')]({'raw':_0x5f02cd[_0x9887('0x21')]?_0x5f02cd[_0x9887('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5f02cd['options']?_0x5f02cd['options'][_0x9887('0x28')]||null:null,'attributes':_0x5f02cd[_0x9887('0x21')]?_0x5f02cd[_0x9887('0x21')][_0x9887('0x22')]||null:null,'include':_0x5f02cd[_0x9887('0x21')]?_0x5f02cd[_0x9887('0x21')]['include']?_[_0x9887('0x25')](_0x5f02cd[_0x9887('0x21')]['include'],function(_0x55bc0e){return{'model':db[_0x55bc0e[_0x9887('0x24')]],'as':_0x55bc0e['as'],'attributes':_0x55bc0e['attributes'],'include':_0x55bc0e[_0x9887('0x23')]?_[_0x9887('0x25')](_0x55bc0e[_0x9887('0x23')],function(_0x59afbc){return{'model':db[_0x59afbc[_0x9887('0x24')]],'as':_0x59afbc['as'],'attributes':_0x59afbc[_0x9887('0x22')],'include':_0x59afbc['include']?_[_0x9887('0x25')](_0x59afbc[_0x9887('0x23')],function(_0x901624){return{'model':db[_0x901624['model']],'as':_0x901624['as'],'attributes':_0x901624[_0x9887('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eb8b){logger[_0x9887('0x14')](_0x9887('0x26'),_0x5f02cd);logger[_0x9887('0x17')](_0x9887('0x26'),_0x5f02cd,JSON[_0x9887('0x19')](_0x5eb8b));_0xfc547b(_0x5eb8b);})[_0x9887('0x1e')](function(_0x1cca28){logger['error'](_0x9887('0x26'),_0x1cca28[_0x9887('0x1c')],_0x5f02cd);_0x1bdf68(_0x1922de[_0x9887('0x1a')](0x1f4,_0x1cca28['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ad61b32..cb5f1ae 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 _0x2f33=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','update','emit'];(function(_0x884098,_0x17873b){var _0x1c5456=function(_0x3b9055){while(--_0x3b9055){_0x884098['push'](_0x884098['shift']());}};_0x1c5456(++_0x17873b);}(_0x2f33,0xc4));var _0x32f3=function(_0x274223,_0x5c0236){_0x274223=_0x274223-0x0;var _0x20f9dc=_0x2f33[_0x274223];return _0x20f9dc;};'use strict';var WhatsappQueueEvents=require(_0x32f3('0x0'));var events=[_0x32f3('0x1'),'remove',_0x32f3('0x2')];function createListener(_0x16a651,_0x14eb9f){return function(_0x1819e9){_0x14eb9f[_0x32f3('0x3')](_0x16a651,_0x1819e9);};}function removeListener(_0x3d4792,_0x2233dd){return function(){WhatsappQueueEvents[_0x32f3('0x4')](_0x3d4792,_0x2233dd);};}exports[_0x32f3('0x5')]=function(_0x1a2f53){for(var _0x4d1113=0x0,_0x3819be=events[_0x32f3('0x6')];_0x4d1113<_0x3819be;_0x4d1113++){var _0x1ee1d1=events[_0x4d1113];var _0x9861eb=createListener(_0x32f3('0x7')+_0x1ee1d1,_0x1a2f53);WhatsappQueueEvents['on'](_0x1ee1d1,_0x9861eb);}}; \ No newline at end of file +var _0x9cea=['remove','update','emit','removeListener','length','./whatsappQueue.events'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x9cea,0x14f));var _0xa9ce=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x9cea[_0x13b8f3];return _0x1a6d06;};'use strict';var WhatsappQueueEvents=require(_0xa9ce('0x0'));var events=['save',_0xa9ce('0x1'),_0xa9ce('0x2')];function createListener(_0x267024,_0x15ffbb){return function(_0x18e32f){_0x15ffbb[_0xa9ce('0x3')](_0x267024,_0x18e32f);};}function removeListener(_0x377e5f,_0x5c68dc){return function(){WhatsappQueueEvents[_0xa9ce('0x4')](_0x377e5f,_0x5c68dc);};}exports['register']=function(_0x57187d){for(var _0x32fbc0=0x0,_0x15605a=events[_0xa9ce('0x5')];_0x32fbc0<_0x15605a;_0x32fbc0++){var _0x432606=events[_0x32fbc0];var _0x20b9cd=createListener('whatsappQueue:'+_0x432606,_0x57187d);WhatsappQueueEvents['on'](_0x432606,_0x20b9cd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8fd4748..9e096c1 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 _0x5e7f=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e7f,0xb3));var _0xf5e7=function(_0x39954a,_0x601a95){_0x39954a=_0x39954a-0x0;var _0x134f26=_0x5e7f[_0x39954a];return _0x134f26;};'use strict';var multer=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var path=require(_0xf5e7('0x2'));var timeout=require(_0xf5e7('0x3'));var express=require(_0xf5e7('0x4'));var router=express['Router']();var fs_extra=require(_0xf5e7('0x5'));var auth=require(_0xf5e7('0x6'));var interaction=require(_0xf5e7('0x7'));var config=require(_0xf5e7('0x8'));var controller=require(_0xf5e7('0x9'));router['get']('/',auth[_0xf5e7('0xa')](),controller[_0xf5e7('0xb')]);router['get'](_0xf5e7('0xc'),auth[_0xf5e7('0xa')](),controller[_0xf5e7('0xd')]);router['get']('/:id',auth[_0xf5e7('0xa')](),controller[_0xf5e7('0xe')]);router['post']('/',auth[_0xf5e7('0xa')](),controller['create']);router[_0xf5e7('0xf')](_0xf5e7('0x10'),auth[_0xf5e7('0xa')](),controller[_0xf5e7('0x11')]);router[_0xf5e7('0x12')](_0xf5e7('0x10'),auth[_0xf5e7('0xa')](),controller[_0xf5e7('0x13')]);module[_0xf5e7('0x14')]=router; \ No newline at end of file +var _0x1bb7=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','util'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0x1bb7,0x109));var _0x71bb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1bb7[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x71bb('0x0'));var path=require(_0x71bb('0x1'));var timeout=require(_0x71bb('0x2'));var express=require(_0x71bb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x71bb('0x4'));var config=require(_0x71bb('0x5'));var controller=require(_0x71bb('0x6'));router[_0x71bb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x71bb('0x8'),auth[_0x71bb('0x9')](),controller[_0x71bb('0xa')]);router[_0x71bb('0x7')](_0x71bb('0xb'),auth['isAuthenticated'](),controller[_0x71bb('0xc')]);router[_0x71bb('0xd')]('/',auth[_0x71bb('0x9')](),controller[_0x71bb('0xe')]);router[_0x71bb('0xf')](_0x71bb('0xb'),auth[_0x71bb('0x9')](),controller['update']);router[_0x71bb('0x10')](_0x71bb('0xb'),auth[_0x71bb('0x9')](),controller[_0x71bb('0x11')]);module[_0x71bb('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a647dcc..643edfe 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(_0x338e0b,_0x3620d6){var _0x2e69a0=function(_0x9276ea){while(--_0x9276ea){_0x338e0b['push'](_0x338e0b['shift']());}};_0x2e69a0(++_0x3620d6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x45d29c,_0x452b92){var _0x208499=function(_0x3080fe){while(--_0x3080fe){_0x45d29c['push'](_0x45d29c['shift']());}};_0x208499(++_0x452b92);}(_0x7a54,0x106));var _0x47a5=function(_0x3d43f6,_0x2744d4){_0x3d43f6=_0x3d43f6-0x0;var _0x4b561b=_0x7a54[_0x3d43f6];return _0x4b561b;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 87c8771..41d2d04 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 _0xd914=['util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1f5595,_0x20b2c2){var _0x2b736f=function(_0x1ab8f0){while(--_0x1ab8f0){_0x1f5595['push'](_0x1f5595['shift']());}};_0x2b736f(++_0x20b2c2);}(_0xd914,0x17f));var _0x4d91=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0xd914[_0x1bb812];return _0x372adb;};'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(){_0x9cb864['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee6b3,_0x112923){return function(_0x3bed98){if(!_0x3bed98){_0x1ee6b3[_0x4d91('0x28')](0x194);}return _0x3bed98;};}function handleError(_0x472f3a,_0x2c7d7a){_0x2c7d7a=_0x2c7d7a||0x1f4;return function(_0x14bdb4){logger['error'](_0x14bdb4[_0x4d91('0x29')]);if(_0x14bdb4[_0x4d91('0x2a')]){delete _0x14bdb4[_0x4d91('0x2a')];}_0x472f3a['status'](_0x2c7d7a)['send'](_0x14bdb4);};}exports[_0x4d91('0x2b')]=function(_0x470079,_0x5ed948){var _0x50fe76={},_0x42d5a0={},_0x2d6981={'count':0x0,'rows':[]};var _0x43371e=_[_0x4d91('0x2c')](db['WhatsappQueueReport'][_0x4d91('0x2d')],function(_0x31bbf8){return{'name':_0x31bbf8[_0x4d91('0x2e')],'type':_0x31bbf8[_0x4d91('0x2f')][_0x4d91('0x30')]};});_0x42d5a0[_0x4d91('0x31')]=_[_0x4d91('0x2c')](_0x43371e,'name');_0x42d5a0[_0x4d91('0x32')]=_['keys'](_0x470079['query']);_0x42d5a0[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x42d5a0['model'],_0x42d5a0[_0x4d91('0x32')]);_0x50fe76[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x42d5a0[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x470079['query'][_0x4d91('0x36')]));_0x50fe76[_0x4d91('0x35')]=_0x50fe76[_0x4d91('0x35')][_0x4d91('0x37')]?_0x50fe76[_0x4d91('0x35')]:_0x42d5a0[_0x4d91('0x31')];if(!_0x470079['query'][_0x4d91('0x38')](_0x4d91('0x39'))){_0x50fe76['limit']=qs[_0x4d91('0x3a')](_0x470079[_0x4d91('0x32')][_0x4d91('0x3a')]);_0x50fe76['offset']=qs[_0x4d91('0x1e')](_0x470079[_0x4d91('0x32')][_0x4d91('0x1e')]);}_0x50fe76[_0x4d91('0x3b')]=qs['sort'](_0x470079[_0x4d91('0x32')][_0x4d91('0x3c')]);_0x50fe76[_0x4d91('0x3d')]=qs[_0x4d91('0x33')](_['pick'](_0x470079['query'],_0x42d5a0[_0x4d91('0x33')]),_0x43371e);if(_0x470079[_0x4d91('0x32')]['filter']){_0x50fe76[_0x4d91('0x3d')]=_[_0x4d91('0x3e')](_0x50fe76[_0x4d91('0x3d')],{'$or':_[_0x4d91('0x2c')](_0x43371e,function(_0x5d93c1){if(_0x5d93c1[_0x4d91('0x2f')]!==_0x4d91('0x3f')){var _0x571a0c={};_0x571a0c[_0x5d93c1[_0x4d91('0x2a')]]={'$like':'%'+_0x470079['query'][_0x4d91('0x40')]+'%'};return _0x571a0c;}})});}_0x50fe76=_['merge']({},_0x50fe76,_0x470079[_0x4d91('0x41')]);var _0x49742b={'where':_0x50fe76[_0x4d91('0x3d')]};return db[_0x4d91('0x42')][_0x4d91('0x20')](_0x49742b)[_0x4d91('0x26')](function(_0x4f6576){_0x2d6981['count']=_0x4f6576;if(_0x470079[_0x4d91('0x32')]['includeAll']){_0x50fe76[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x42')]['findAll'](_0x50fe76);})[_0x4d91('0x26')](function(_0x2ae356){_0x2d6981[_0x4d91('0x44')]=_0x2ae356;return _0x2d6981;})[_0x4d91('0x26')](respondWithFilteredResult(_0x5ed948,_0x50fe76))[_0x4d91('0x45')](handleError(_0x5ed948,null));};exports[_0x4d91('0x46')]=function(_0x23902f,_0x4f6254){var _0x1e4c6d={'raw':!![],'where':{'id':_0x23902f[_0x4d91('0x47')]['id']}},_0x4c70af={};_0x4c70af[_0x4d91('0x31')]=_[_0x4d91('0x48')](db[_0x4d91('0x42')][_0x4d91('0x2d')]);_0x4c70af[_0x4d91('0x32')]=_['keys'](_0x23902f['query']);_0x4c70af[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x4c70af['model'],_0x4c70af[_0x4d91('0x32')]);_0x1e4c6d[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x4c70af[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x23902f[_0x4d91('0x32')][_0x4d91('0x36')]));_0x1e4c6d[_0x4d91('0x35')]=_0x1e4c6d[_0x4d91('0x35')]['length']?_0x1e4c6d['attributes']:_0x4c70af[_0x4d91('0x31')];if(_0x23902f['query'][_0x4d91('0x49')]){_0x1e4c6d[_0x4d91('0x43')]=[{'all':!![]}];}_0x1e4c6d=_[_0x4d91('0x3e')]({},_0x1e4c6d,_0x23902f[_0x4d91('0x41')]);return db['WhatsappQueueReport'][_0x4d91('0x4a')](_0x1e4c6d)['then'](handleEntityNotFound(_0x4f6254,null))['then'](respondWithResult(_0x4f6254,null))[_0x4d91('0x45')](handleError(_0x4f6254,null));};exports[_0x4d91('0x4b')]=function(_0x18073d,_0xa03d75){return db[_0x4d91('0x42')][_0x4d91('0x4b')](_0x18073d['body'],{})[_0x4d91('0x26')](respondWithResult(_0xa03d75,0xc9))[_0x4d91('0x45')](handleError(_0xa03d75,null));};exports[_0x4d91('0x25')]=function(_0x449dd8,_0x106e5b){if(_0x449dd8[_0x4d91('0x4c')]['id']){delete _0x449dd8[_0x4d91('0x4c')]['id'];}return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x449dd8[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x106e5b,null))['then'](saveUpdates(_0x449dd8[_0x4d91('0x4c')],null))['then'](respondWithResult(_0x106e5b,null))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x27')]=function(_0x195e65,_0x386935){return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x195e65[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x386935,null))['then'](removeEntity(_0x386935,null))[_0x4d91('0x45')](handleError(_0x386935,null));};exports[_0x4d91('0x4d')]=function(_0x3fe9ee,_0x2bba43){return db[_0x4d91('0x42')][_0x4d91('0x4d')]()[_0x4d91('0x26')](respondWithResult(_0x2bba43,null))['catch'](handleError(_0x2bba43,null));}; \ No newline at end of file +var _0xb58b=['save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x186077,_0x14a4a1){var _0x21f1a8=function(_0x21d200){while(--_0x21d200){_0x186077['push'](_0x186077['shift']());}};_0x21f1a8(++_0x14a4a1);}(_0xb58b,0x1f1));var _0xbb58=function(_0x13009e,_0xb64397){_0x13009e=_0x13009e-0x0;var _0x31e9df=_0xb58b[_0x13009e];return _0x31e9df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x2d556a,_0x15e4c5){return function(_0x4e0303){if(!_0x4e0303){_0x2d556a[_0xbb58('0x18')](0x194);}return _0x4e0303;};}function handleError(_0x3bd550,_0x1be0ae){_0x1be0ae=_0x1be0ae||0x1f4;return function(_0x129094){logger[_0xbb58('0x27')](_0x129094[_0xbb58('0x28')]);if(_0x129094[_0xbb58('0x29')]){delete _0x129094[_0xbb58('0x29')];}_0x3bd550[_0xbb58('0x19')](_0x1be0ae)[_0xbb58('0x2a')](_0x129094);};}exports[_0xbb58('0x2b')]=function(_0x28b3a3,_0x2a0481){var _0x4157c4={},_0x3559b6={},_0x573cca={'count':0x0,'rows':[]};var _0x2b0f73=_[_0xbb58('0x2c')](db[_0xbb58('0x2d')][_0xbb58('0x2e')],function(_0x3304b9){return{'name':_0x3304b9[_0xbb58('0x2f')],'type':_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')]};});_0x3559b6[_0xbb58('0x32')]=_['map'](_0x2b0f73,_0xbb58('0x29'));_0x3559b6[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x28b3a3[_0xbb58('0x33')]);_0x3559b6[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],_0x3559b6[_0xbb58('0x33')]);_0x4157c4[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x28b3a3[_0xbb58('0x33')]['fields']));_0x4157c4['attributes']=_0x4157c4['attributes'][_0xbb58('0x39')]?_0x4157c4[_0xbb58('0x37')]:_0x3559b6[_0xbb58('0x32')];if(!_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3a')](_0xbb58('0x3b'))){_0x4157c4[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x28b3a3['query'][_0xbb58('0x1e')]);_0x4157c4[_0xbb58('0x1c')]=qs['offset'](_0x28b3a3[_0xbb58('0x33')]['offset']);}_0x4157c4[_0xbb58('0x3c')]=qs['sort'](_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3d')]);_0x4157c4['where']=qs[_0xbb58('0x35')](_[_0xbb58('0x3e')](_0x28b3a3[_0xbb58('0x33')],_0x3559b6[_0xbb58('0x35')]),_0x2b0f73);if(_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3f')]){_0x4157c4[_0xbb58('0x40')]=_[_0xbb58('0x41')](_0x4157c4['where'],{'$or':_[_0xbb58('0x2c')](_0x2b0f73,function(_0x31aa4b){if(_0x31aa4b[_0xbb58('0x30')]!=='VIRTUAL'){var _0x4dbd5e={};_0x4dbd5e[_0x31aa4b[_0xbb58('0x29')]]={'$like':'%'+_0x28b3a3['query'][_0xbb58('0x3f')]+'%'};return _0x4dbd5e;}})});}_0x4157c4=_[_0xbb58('0x41')]({},_0x4157c4,_0x28b3a3[_0xbb58('0x42')]);var _0x560911={'where':_0x4157c4['where']};return db[_0xbb58('0x2d')][_0xbb58('0x1d')](_0x560911)[_0xbb58('0x26')](function(_0x24d82d){_0x573cca[_0xbb58('0x1d')]=_0x24d82d;if(_0x28b3a3[_0xbb58('0x33')]['includeAll']){_0x4157c4[_0xbb58('0x43')]=[{'all':!![]}];}return db[_0xbb58('0x2d')][_0xbb58('0x44')](_0x4157c4);})[_0xbb58('0x26')](function(_0x1185b3){_0x573cca[_0xbb58('0x45')]=_0x1185b3;return _0x573cca;})['then'](respondWithFilteredResult(_0x2a0481,_0x4157c4))[_0xbb58('0x46')](handleError(_0x2a0481,null));};exports['show']=function(_0x22f1c3,_0x285ad4){var _0x29fb1c={'raw':!![],'where':{'id':_0x22f1c3['params']['id']}},_0x45817f={};_0x45817f[_0xbb58('0x32')]=_[_0xbb58('0x34')](db[_0xbb58('0x2d')][_0xbb58('0x2e')]);_0x45817f['query']=_[_0xbb58('0x34')](_0x22f1c3['query']);_0x45817f[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],_0x45817f[_0xbb58('0x33')]);_0x29fb1c[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x22f1c3[_0xbb58('0x33')][_0xbb58('0x38')]));_0x29fb1c[_0xbb58('0x37')]=_0x29fb1c[_0xbb58('0x37')][_0xbb58('0x39')]?_0x29fb1c['attributes']:_0x45817f[_0xbb58('0x32')];if(_0x22f1c3['query']['includeAll']){_0x29fb1c[_0xbb58('0x43')]=[{'all':!![]}];}_0x29fb1c=_[_0xbb58('0x41')]({},_0x29fb1c,_0x22f1c3[_0xbb58('0x42')]);return db[_0xbb58('0x2d')][_0xbb58('0x47')](_0x29fb1c)[_0xbb58('0x26')](handleEntityNotFound(_0x285ad4,null))[_0xbb58('0x26')](respondWithResult(_0x285ad4,null))[_0xbb58('0x46')](handleError(_0x285ad4,null));};exports[_0xbb58('0x48')]=function(_0x39995e,_0x440fb3){return db['WhatsappQueueReport'][_0xbb58('0x48')](_0x39995e[_0xbb58('0x49')],{})['then'](respondWithResult(_0x440fb3,0xc9))[_0xbb58('0x46')](handleError(_0x440fb3,null));};exports[_0xbb58('0x24')]=function(_0xf94897,_0xdb0ff7){if(_0xf94897['body']['id']){delete _0xf94897[_0xbb58('0x49')]['id'];}return db['WhatsappQueueReport'][_0xbb58('0x47')]({'where':{'id':_0xf94897[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0xdb0ff7,null))['then'](saveUpdates(_0xf94897[_0xbb58('0x49')],null))[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,null))['catch'](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x25')]=function(_0x4ca201,_0x28301d){return db[_0xbb58('0x2d')][_0xbb58('0x47')]({'where':{'id':_0x4ca201[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x28301d,null))[_0xbb58('0x26')](removeEntity(_0x28301d,null))[_0xbb58('0x46')](handleError(_0x28301d,null));};exports['describe']=function(_0x449088,_0x1fd892){return db['WhatsappQueueReport'][_0xbb58('0x4b')]()[_0xbb58('0x26')](respondWithResult(_0x1fd892,null))['catch'](handleError(_0x1fd892,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2d040b6..239fa4e 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 _0x8d03=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x152405,_0x5e8952){var _0x46647a=function(_0x4608b5){while(--_0x4608b5){_0x152405['push'](_0x152405['shift']());}};_0x46647a(++_0x5e8952);}(_0x8d03,0xc5));var _0x38d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8d03[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x38d0('0x0'));var logger=require(_0x38d0('0x1'))('api');var moment=require(_0x38d0('0x2'));var BPromise=require(_0x38d0('0x3'));var rp=require(_0x38d0('0x4'));var fs=require('fs');var path=require(_0x38d0('0x5'));var rimraf=require('rimraf');var config=require(_0x38d0('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x38d0('0x7')]=function(_0x528a1b,_0x91f303){return _0x528a1b[_0x38d0('0x8')](_0x38d0('0x9'),attributes,{'tableName':_0x38d0('0xa'),'paranoid':![],'indexes':[{'name':_0x38d0('0xb'),'fields':[_0x38d0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7472=['moment','bluebird','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x3da199,_0x4a4cac){var _0x37afe4=function(_0x513488){while(--_0x513488){_0x3da199['push'](_0x3da199['shift']());}};_0x37afe4(++_0x4a4cac);}(_0x7472,0x7f));var _0x2747=function(_0x265a5,_0x57fea9){_0x265a5=_0x265a5-0x0;var _0x3e681a=_0x7472[_0x265a5];return _0x3e681a;};'use strict';var _=require(_0x2747('0x0'));var util=require('util');var logger=require(_0x2747('0x1'))(_0x2747('0x2'));var moment=require(_0x2747('0x3'));var BPromise=require(_0x2747('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2747('0x5'));var rimraf=require(_0x2747('0x6'));var config=require('../../config/environment');var attributes=require(_0x2747('0x7'));module[_0x2747('0x8')]=function(_0x508fae,_0x516b94){return _0x508fae[_0x2747('0x9')](_0x2747('0xa'),attributes,{'tableName':_0x2747('0xb'),'paranoid':![],'indexes':[{'name':_0x2747('0xc'),'fields':[_0x2747('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 678b7cb..19f0735 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 _0x09bd=['jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','info','debug','attributes','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x09bd,0x11f));var _0xd09b=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0x09bd[_0x5880d8];return _0x88264a;};'use strict';var _=require(_0xd09b('0x0'));var util=require(_0xd09b('0x1'));var moment=require(_0xd09b('0x2'));var BPromise=require(_0xd09b('0x3'));var rs=require(_0xd09b('0x4'));var fs=require('fs');var Redis=require(_0xd09b('0x5'));var db=require(_0xd09b('0x6'))['db'];var utils=require(_0xd09b('0x7'));var logger=require('../../config/logger')(_0xd09b('0x8'));var config=require(_0xd09b('0x9'));var jayson=require(_0xd09b('0xa'));var client=jayson[_0xd09b('0xb')][_0xd09b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a1905,_0x5639d4,_0x813c45){return new BPromise(function(_0x52509f,_0x2579c4){return client[_0xd09b('0xd')](_0x1a1905,_0x813c45)[_0xd09b('0xe')](function(_0x48acaf){logger['info'](_0xd09b('0xf'),_0x5639d4,_0xd09b('0x10'));logger['debug'](_0xd09b('0x11'),_0x5639d4,_0xd09b('0x10'),JSON[_0xd09b('0x12')](_0x48acaf));if(_0x48acaf['error']){if(_0x48acaf[_0xd09b('0x13')]['code']===0x1f4){logger[_0xd09b('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5639d4,_0x48acaf['error'][_0xd09b('0x14')]);return _0x2579c4(_0x48acaf[_0xd09b('0x13')][_0xd09b('0x14')]);}logger[_0xd09b('0x13')](_0xd09b('0xf'),_0x5639d4,_0x48acaf[_0xd09b('0x13')][_0xd09b('0x14')]);return _0x52509f(_0x48acaf[_0xd09b('0x13')][_0xd09b('0x14')]);}else{logger['info'](_0xd09b('0xf'),_0x5639d4,_0xd09b('0x10'));_0x52509f(_0x48acaf[_0xd09b('0x15')][_0xd09b('0x14')]);}})[_0xd09b('0x16')](function(_0x1d418b){logger[_0xd09b('0x13')](_0xd09b('0xf'),_0x5639d4,_0x1d418b);_0x2579c4(_0x1d418b);});});}exports[_0xd09b('0x17')]=function(_0x3ecb44){var _0x2b747b=this;return new Promise(function(_0x2f7ee0,_0x2513b2){return db[_0xd09b('0x18')][_0xd09b('0x19')](_0x3ecb44[_0xd09b('0x1a')],{'raw':_0x3ecb44['options']?_0x3ecb44[_0xd09b('0x1b')][_0xd09b('0x1c')]===undefined?!![]:![]:!![]})[_0xd09b('0xe')](function(_0x2fb079){logger[_0xd09b('0x1d')](_0xd09b('0x17'),_0x3ecb44);logger[_0xd09b('0x1e')](_0xd09b('0x17'),_0x3ecb44,JSON[_0xd09b('0x12')](_0x2fb079));_0x2f7ee0(_0x2fb079);})['catch'](function(_0x1cefeb){logger[_0xd09b('0x13')](_0xd09b('0x17'),_0x1cefeb['message'],_0x3ecb44);_0x2513b2(_0x2b747b[_0xd09b('0x13')](0x1f4,_0x1cefeb['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x22b4bb){var _0x510e42=this;return new Promise(function(_0x428288,_0x37e992){return db['WhatsappQueueReport']['update'](_0x22b4bb[_0xd09b('0x1a')],{'raw':_0x22b4bb[_0xd09b('0x1b')]?_0x22b4bb[_0xd09b('0x1b')][_0xd09b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b4bb[_0xd09b('0x1b')]?_0x22b4bb[_0xd09b('0x1b')]['where']||null:null,'attributes':_0x22b4bb[_0xd09b('0x1b')]?_0x22b4bb['options'][_0xd09b('0x1f')]||null:null,'limit':_0x22b4bb[_0xd09b('0x1b')]?_0x22b4bb[_0xd09b('0x1b')]['limit']||null:null})[_0xd09b('0xe')](function(_0x14320c){logger['info'](_0xd09b('0x20'),_0x22b4bb);logger[_0xd09b('0x1e')]('UpdateWhatsappQueueReport',_0x22b4bb,JSON[_0xd09b('0x12')](_0x14320c));_0x428288(_0x14320c);})[_0xd09b('0x16')](function(_0x135812){logger[_0xd09b('0x13')](_0xd09b('0x20'),_0x135812[_0xd09b('0x14')],_0x22b4bb);_0x37e992(_0x510e42[_0xd09b('0x13')](0x1f4,_0x135812[_0xd09b('0x14')]));});});}; \ No newline at end of file +var _0xc1b4=['body','options','raw','catch','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x3ea8ef,_0x27e2b2){var _0x48afa4=function(_0x385844){while(--_0x385844){_0x3ea8ef['push'](_0x3ea8ef['shift']());}};_0x48afa4(++_0x27e2b2);}(_0xc1b4,0x65));var _0x4c1b=function(_0x2e125f,_0x46b512){_0x2e125f=_0x2e125f-0x0;var _0xe80ed2=_0xc1b4[_0x2e125f];return _0xe80ed2;};'use strict';var _=require(_0x4c1b('0x0'));var util=require(_0x4c1b('0x1'));var moment=require(_0x4c1b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c1b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c1b('0x4'))('rpc');var config=require(_0x4c1b('0x5'));var jayson=require(_0x4c1b('0x6'));var client=jayson[_0x4c1b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421c91,_0x25eb1f,_0x1f8a8d){return new BPromise(function(_0x1041cb,_0x49f246){return client[_0x4c1b('0x8')](_0x421c91,_0x1f8a8d)[_0x4c1b('0x9')](function(_0xe7fba2){logger[_0x4c1b('0xa')](_0x4c1b('0xb'),_0x25eb1f,_0x4c1b('0xc'));logger[_0x4c1b('0xd')](_0x4c1b('0xe'),_0x25eb1f,_0x4c1b('0xc'),JSON[_0x4c1b('0xf')](_0xe7fba2));if(_0xe7fba2[_0x4c1b('0x10')]){if(_0xe7fba2[_0x4c1b('0x10')][_0x4c1b('0x11')]===0x1f4){logger[_0x4c1b('0x10')](_0x4c1b('0xb'),_0x25eb1f,_0xe7fba2['error'][_0x4c1b('0x12')]);return _0x49f246(_0xe7fba2['error'][_0x4c1b('0x12')]);}logger['error'](_0x4c1b('0xb'),_0x25eb1f,_0xe7fba2[_0x4c1b('0x10')][_0x4c1b('0x12')]);return _0x1041cb(_0xe7fba2['error'][_0x4c1b('0x12')]);}else{logger[_0x4c1b('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25eb1f,_0x4c1b('0xc'));_0x1041cb(_0xe7fba2[_0x4c1b('0x13')][_0x4c1b('0x12')]);}})['catch'](function(_0x43a670){logger[_0x4c1b('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25eb1f,_0x43a670);_0x49f246(_0x43a670);});});}exports[_0x4c1b('0x14')]=function(_0x569a5a){var _0x2dcde7=this;return new Promise(function(_0x2dc822,_0x1657f8){return db[_0x4c1b('0x15')][_0x4c1b('0x16')](_0x569a5a[_0x4c1b('0x17')],{'raw':_0x569a5a[_0x4c1b('0x18')]?_0x569a5a[_0x4c1b('0x18')][_0x4c1b('0x19')]===undefined?!![]:![]:!![]})[_0x4c1b('0x9')](function(_0x5ea357){logger[_0x4c1b('0xa')](_0x4c1b('0x14'),_0x569a5a);logger[_0x4c1b('0xd')](_0x4c1b('0x14'),_0x569a5a,JSON[_0x4c1b('0xf')](_0x5ea357));_0x2dc822(_0x5ea357);})[_0x4c1b('0x1a')](function(_0x2d9f9e){logger[_0x4c1b('0x10')]('CreateWhatsappQueueReport',_0x2d9f9e[_0x4c1b('0x12')],_0x569a5a);_0x1657f8(_0x2dcde7[_0x4c1b('0x10')](0x1f4,_0x2d9f9e[_0x4c1b('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x244e94){var _0x2b69ce=this;return new Promise(function(_0x28eb4b,_0x52a7c3){return db[_0x4c1b('0x15')]['update'](_0x244e94[_0x4c1b('0x17')],{'raw':_0x244e94[_0x4c1b('0x18')]?_0x244e94[_0x4c1b('0x18')][_0x4c1b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244e94[_0x4c1b('0x18')]?_0x244e94[_0x4c1b('0x18')][_0x4c1b('0x1b')]||null:null,'attributes':_0x244e94[_0x4c1b('0x18')]?_0x244e94['options'][_0x4c1b('0x1c')]||null:null,'limit':_0x244e94[_0x4c1b('0x18')]?_0x244e94[_0x4c1b('0x18')][_0x4c1b('0x1d')]||null:null})[_0x4c1b('0x9')](function(_0x47b78c){logger['info'](_0x4c1b('0x1e'),_0x244e94);logger[_0x4c1b('0xd')]('UpdateWhatsappQueueReport',_0x244e94,JSON[_0x4c1b('0xf')](_0x47b78c));_0x28eb4b(_0x47b78c);})['catch'](function(_0x1b855c){logger[_0x4c1b('0x10')](_0x4c1b('0x1e'),_0x1b855c[_0x4c1b('0x12')],_0x244e94);_0x52a7c3(_0x2b69ce[_0x4c1b('0x10')](0x1f4,_0x1b855c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 449543b..15063c5 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 _0xeafb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x1d8ebe,_0x614ae9){var _0x4baa5d=function(_0x320297){while(--_0x320297){_0x1d8ebe['push'](_0x1d8ebe['shift']());}};_0x4baa5d(++_0x614ae9);}(_0xeafb,0x140));var _0xbeaf=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0xeafb[_0x1e62b8];return _0x2ab271;};'use strict';var multer=require(_0xbeaf('0x0'));var util=require(_0xbeaf('0x1'));var path=require('path');var timeout=require(_0xbeaf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeaf('0x3'));var auth=require(_0xbeaf('0x4'));var interaction=require(_0xbeaf('0x5'));var config=require(_0xbeaf('0x6'));var controller=require(_0xbeaf('0x7'));router['get']('/',auth[_0xbeaf('0x8')](),controller[_0xbeaf('0x9')]);router[_0xbeaf('0xa')]('/describe',auth[_0xbeaf('0x8')](),controller['describe']);router[_0xbeaf('0xa')](_0xbeaf('0xb'),auth[_0xbeaf('0x8')](),controller[_0xbeaf('0xc')]);router[_0xbeaf('0xd')]('/',auth[_0xbeaf('0x8')](),controller[_0xbeaf('0xe')]);router[_0xbeaf('0xf')](_0xbeaf('0xb'),auth[_0xbeaf('0x8')](),controller[_0xbeaf('0x10')]);router[_0xbeaf('0x11')](_0xbeaf('0xb'),auth[_0xbeaf('0x8')](),controller['destroy']);module[_0xbeaf('0x12')]=router; \ No newline at end of file +var _0x67a6=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0x1d3a8a,_0x367a7f){var _0x474719=function(_0x3fa38e){while(--_0x3fa38e){_0x1d3a8a['push'](_0x1d3a8a['shift']());}};_0x474719(++_0x367a7f);}(_0x67a6,0x159));var _0x667a=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x67a6[_0x5d4f12];return _0x4eb577;};'use strict';var multer=require(_0x667a('0x0'));var util=require(_0x667a('0x1'));var path=require(_0x667a('0x2'));var timeout=require(_0x667a('0x3'));var express=require(_0x667a('0x4'));var router=express[_0x667a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x667a('0x6'));var config=require(_0x667a('0x7'));var controller=require(_0x667a('0x8'));router[_0x667a('0x9')]('/',auth[_0x667a('0xa')](),controller[_0x667a('0xb')]);router[_0x667a('0x9')]('/describe',auth[_0x667a('0xa')](),controller[_0x667a('0xc')]);router[_0x667a('0x9')](_0x667a('0xd'),auth[_0x667a('0xa')](),controller['show']);router[_0x667a('0xe')]('/',auth['isAuthenticated'](),controller[_0x667a('0xf')]);router[_0x667a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x667a('0x11')]);router['delete'](_0x667a('0xd'),auth[_0x667a('0xa')](),controller[_0x667a('0x12')]);module[_0x667a('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c9ab636..9406692 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 _0xb350=['ENUM','agent','DATE','sequelize','exports','STRING'];(function(_0x3f6ffb,_0x951ee){var _0x8ce764=function(_0x35ff2c){while(--_0x35ff2c){_0x3f6ffb['push'](_0x3f6ffb['shift']());}};_0x8ce764(++_0x951ee);}(_0xb350,0x6f));var _0x0b35=function(_0x4c61d2,_0x5a6b62){_0x4c61d2=_0x4c61d2-0x0;var _0x401bd4=_0xb350[_0x4c61d2];return _0x401bd4;};'use strict';var Sequelize=require(_0x0b35('0x0'));module[_0x0b35('0x1')]={'uniqueid':{'type':Sequelize[_0x0b35('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0b35('0x3')]('account',_0x0b35('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0b35('0x5')]}}; \ No newline at end of file +var _0x49aa=['sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x29925e,_0x30ca70){var _0x2455da=function(_0x56bb32){while(--_0x56bb32){_0x29925e['push'](_0x29925e['shift']());}};_0x2455da(++_0x30ca70);}(_0x49aa,0x173));var _0xa49a=function(_0x289ddb,_0x508f45){_0x289ddb=_0x289ddb-0x0;var _0x32c0e5=_0x49aa[_0x289ddb];return _0x32c0e5;};'use strict';var Sequelize=require(_0xa49a('0x0'));module[_0xa49a('0x1')]={'uniqueid':{'type':Sequelize[_0xa49a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa49a('0x3'),_0xa49a('0x4'),_0xa49a('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa49a('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1548274..20acec0 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 _0x7b22=['error','name','send','index','map','WhatsappTransferReport','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus'];(function(_0x461c81,_0x213767){var _0x467cba=function(_0x3b64ef){while(--_0x3b64ef){_0x461c81['push'](_0x461c81['shift']());}};_0x467cba(++_0x213767);}(_0x7b22,0x1e6));var _0x27b2=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x7b22[_0x30033a];return _0x5e3518;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27b2('0x0'));var zipdir=require(_0x27b2('0x1'));var jsonpatch=require(_0x27b2('0x2'));var rp=require('request-promise');var moment=require(_0x27b2('0x3'));var BPromise=require(_0x27b2('0x4'));var Mustache=require(_0x27b2('0x5'));var util=require(_0x27b2('0x6'));var path=require(_0x27b2('0x7'));var sox=require('sox');var csv=require(_0x27b2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27b2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x27b2('0xa'));var jsforce=require(_0x27b2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x27b2('0x8'));var querystring=require(_0x27b2('0xc'));var Papa=require(_0x27b2('0xd'));var Redis=require(_0x27b2('0xe'));var authService=require(_0x27b2('0xf'));var qs=require(_0x27b2('0x10'));var as=require(_0x27b2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27b2('0x12'))(_0x27b2('0x13'));var utils=require(_0x27b2('0x14'));var config=require(_0x27b2('0x15'));var licenseUtil=require(_0x27b2('0x16'));var db=require(_0x27b2('0x17'))['db'];function respondWithStatusCode(_0x15b690,_0xcae601){_0xcae601=_0xcae601||0xcc;return function(_0xa5048d){if(_0xa5048d){return _0x15b690['sendStatus'](_0xcae601);}return _0x15b690['status'](_0xcae601)[_0x27b2('0x18')]();};}function respondWithResult(_0x2e740f,_0x598747){_0x598747=_0x598747||0xc8;return function(_0x34cf75){if(_0x34cf75){return _0x2e740f[_0x27b2('0x19')](_0x598747)['json'](_0x34cf75);}};}function respondWithFilteredResult(_0x212d17,_0x38de62){return function(_0x26d4e1){if(_0x26d4e1){var _0x523753=typeof _0x38de62['offset']===_0x27b2('0x1a')&&typeof _0x38de62[_0x27b2('0x1b')]===_0x27b2('0x1a');var _0x2044f3=_0x26d4e1[_0x27b2('0x1c')];var _0xd21d3b=_0x523753?0x0:_0x38de62[_0x27b2('0x1d')];var _0x113991=_0x523753?_0x26d4e1['count']:_0x38de62[_0x27b2('0x1d')]+_0x38de62[_0x27b2('0x1b')];var _0x2131f1;if(_0x113991>=_0x2044f3){_0x113991=_0x2044f3;_0x2131f1=0xc8;}else{_0x2131f1=0xce;}_0x212d17[_0x27b2('0x19')](_0x2131f1);return _0x212d17[_0x27b2('0x1e')](_0x27b2('0x1f'),_0xd21d3b+'-'+_0x113991+'/'+_0x2044f3)['json'](_0x26d4e1);}return null;};}function patchUpdates(_0x3e82c4){return function(_0x557727){try{jsonpatch[_0x27b2('0x20')](_0x557727,_0x3e82c4,!![]);}catch(_0x14062c){return BPromise[_0x27b2('0x21')](_0x14062c);}return _0x557727[_0x27b2('0x22')]();};}function saveUpdates(_0x4ba2b0,_0x599f4c){return function(_0x2d3cd4){if(_0x2d3cd4){return _0x2d3cd4[_0x27b2('0x23')](_0x4ba2b0)['then'](function(_0x20174e){return _0x20174e;});}return null;};}function removeEntity(_0x210349,_0x5510bc){return function(_0x5199b0){if(_0x5199b0){return _0x5199b0[_0x27b2('0x24')]()[_0x27b2('0x25')](function(){_0x210349[_0x27b2('0x19')](0xcc)[_0x27b2('0x18')]();});}};}function handleEntityNotFound(_0x425486,_0x199ad4){return function(_0x161f9d){if(!_0x161f9d){_0x425486[_0x27b2('0x26')](0x194);}return _0x161f9d;};}function handleError(_0x598336,_0x4adabf){_0x4adabf=_0x4adabf||0x1f4;return function(_0x140f5d){logger[_0x27b2('0x27')](_0x140f5d['stack']);if(_0x140f5d[_0x27b2('0x28')]){delete _0x140f5d[_0x27b2('0x28')];}_0x598336[_0x27b2('0x19')](_0x4adabf)[_0x27b2('0x29')](_0x140f5d);};}exports[_0x27b2('0x2a')]=function(_0x5e0e55,_0x19b7f7){var _0x3c45a4={},_0xb32ab4={},_0x5602cd={'count':0x0,'rows':[]};var _0x17df1e=_[_0x27b2('0x2b')](db[_0x27b2('0x2c')]['rawAttributes'],function(_0x24ff9c){return{'name':_0x24ff9c['fieldName'],'type':_0x24ff9c[_0x27b2('0x2d')][_0x27b2('0x2e')]};});_0xb32ab4['model']=_[_0x27b2('0x2b')](_0x17df1e,_0x27b2('0x28'));_0xb32ab4[_0x27b2('0x2f')]=_[_0x27b2('0x30')](_0x5e0e55[_0x27b2('0x2f')]);_0xb32ab4[_0x27b2('0x31')]=_[_0x27b2('0x32')](_0xb32ab4['model'],_0xb32ab4[_0x27b2('0x2f')]);_0x3c45a4[_0x27b2('0x33')]=_[_0x27b2('0x32')](_0xb32ab4[_0x27b2('0x34')],qs[_0x27b2('0x35')](_0x5e0e55[_0x27b2('0x2f')][_0x27b2('0x35')]));_0x3c45a4[_0x27b2('0x33')]=_0x3c45a4[_0x27b2('0x33')][_0x27b2('0x36')]?_0x3c45a4['attributes']:_0xb32ab4['model'];if(!_0x5e0e55[_0x27b2('0x2f')][_0x27b2('0x37')](_0x27b2('0x38'))){_0x3c45a4['limit']=qs[_0x27b2('0x1b')](_0x5e0e55[_0x27b2('0x2f')][_0x27b2('0x1b')]);_0x3c45a4['offset']=qs[_0x27b2('0x1d')](_0x5e0e55[_0x27b2('0x2f')][_0x27b2('0x1d')]);}_0x3c45a4['order']=qs[_0x27b2('0x39')](_0x5e0e55[_0x27b2('0x2f')]['sort']);_0x3c45a4[_0x27b2('0x3a')]=qs[_0x27b2('0x31')](_[_0x27b2('0x3b')](_0x5e0e55[_0x27b2('0x2f')],_0xb32ab4[_0x27b2('0x31')]),_0x17df1e);if(_0x5e0e55[_0x27b2('0x2f')][_0x27b2('0x3c')]){_0x3c45a4[_0x27b2('0x3a')]=_[_0x27b2('0x3d')](_0x3c45a4[_0x27b2('0x3a')],{'$or':_[_0x27b2('0x2b')](_0x17df1e,function(_0x43824b){if(_0x43824b['type']!==_0x27b2('0x3e')){var _0x4e65b7={};_0x4e65b7[_0x43824b[_0x27b2('0x28')]]={'$like':'%'+_0x5e0e55[_0x27b2('0x2f')]['filter']+'%'};return _0x4e65b7;}})});}_0x3c45a4=_[_0x27b2('0x3d')]({},_0x3c45a4,_0x5e0e55[_0x27b2('0x3f')]);var _0x11c84a={'where':_0x3c45a4[_0x27b2('0x3a')]};return db[_0x27b2('0x2c')][_0x27b2('0x1c')](_0x11c84a)[_0x27b2('0x25')](function(_0x414a29){_0x5602cd[_0x27b2('0x1c')]=_0x414a29;if(_0x5e0e55['query'][_0x27b2('0x40')]){_0x3c45a4[_0x27b2('0x41')]=[{'all':!![]}];}return db[_0x27b2('0x2c')][_0x27b2('0x42')](_0x3c45a4);})[_0x27b2('0x25')](function(_0x49a26a){_0x5602cd['rows']=_0x49a26a;return _0x5602cd;})[_0x27b2('0x25')](respondWithFilteredResult(_0x19b7f7,_0x3c45a4))[_0x27b2('0x43')](handleError(_0x19b7f7,null));};exports[_0x27b2('0x44')]=function(_0x8f1c60,_0x28b2bc){var _0x3645eb={'raw':!![],'where':{'id':_0x8f1c60[_0x27b2('0x45')]['id']}},_0x38cef4={};_0x38cef4['model']=_[_0x27b2('0x30')](db[_0x27b2('0x2c')][_0x27b2('0x46')]);_0x38cef4[_0x27b2('0x2f')]=_[_0x27b2('0x30')](_0x8f1c60[_0x27b2('0x2f')]);_0x38cef4[_0x27b2('0x31')]=_[_0x27b2('0x32')](_0x38cef4['model'],_0x38cef4['query']);_0x3645eb['attributes']=_[_0x27b2('0x32')](_0x38cef4[_0x27b2('0x34')],qs[_0x27b2('0x35')](_0x8f1c60[_0x27b2('0x2f')][_0x27b2('0x35')]));_0x3645eb[_0x27b2('0x33')]=_0x3645eb['attributes']['length']?_0x3645eb[_0x27b2('0x33')]:_0x38cef4['model'];if(_0x8f1c60[_0x27b2('0x2f')]['includeAll']){_0x3645eb[_0x27b2('0x41')]=[{'all':!![]}];}_0x3645eb=_[_0x27b2('0x3d')]({},_0x3645eb,_0x8f1c60[_0x27b2('0x3f')]);return db['WhatsappTransferReport'][_0x27b2('0x47')](_0x3645eb)['then'](handleEntityNotFound(_0x28b2bc,null))[_0x27b2('0x25')](respondWithResult(_0x28b2bc,null))[_0x27b2('0x43')](handleError(_0x28b2bc,null));};exports[_0x27b2('0x48')]=function(_0x2abc6a,_0x5031e1){return db['WhatsappTransferReport'][_0x27b2('0x48')](_0x2abc6a[_0x27b2('0x49')],{})[_0x27b2('0x25')](respondWithResult(_0x5031e1,0xc9))[_0x27b2('0x43')](handleError(_0x5031e1,null));};exports['update']=function(_0xb4be8,_0x4d8ddc){if(_0xb4be8[_0x27b2('0x49')]['id']){delete _0xb4be8[_0x27b2('0x49')]['id'];}return db[_0x27b2('0x2c')][_0x27b2('0x47')]({'where':{'id':_0xb4be8[_0x27b2('0x45')]['id']}})[_0x27b2('0x25')](handleEntityNotFound(_0x4d8ddc,null))[_0x27b2('0x25')](saveUpdates(_0xb4be8['body'],null))[_0x27b2('0x25')](respondWithResult(_0x4d8ddc,null))[_0x27b2('0x43')](handleError(_0x4d8ddc,null));};exports[_0x27b2('0x24')]=function(_0x115ac7,_0x522e6b){return db[_0x27b2('0x2c')]['find']({'where':{'id':_0x115ac7[_0x27b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x522e6b,null))[_0x27b2('0x25')](removeEntity(_0x522e6b,null))[_0x27b2('0x43')](handleError(_0x522e6b,null));};exports[_0x27b2('0x4a')]=function(_0x43f635,_0x210d48){return db[_0x27b2('0x2c')][_0x27b2('0x4a')]()[_0x27b2('0x25')](respondWithResult(_0x210d48,null))[_0x27b2('0x43')](handleError(_0x210d48,null));}; \ No newline at end of file +var _0x1afc=['lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','catch','show','options','find','body','params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1d44ff,_0x2f589b){var _0xb17b17=function(_0x4337f5){while(--_0x4337f5){_0x1d44ff['push'](_0x1d44ff['shift']());}};_0xb17b17(++_0x2f589b);}(_0x1afc,0x167));var _0xc1af=function(_0x3a047f,_0x38094d){_0x3a047f=_0x3a047f-0x0;var _0x541660=_0x1afc[_0x3a047f];return _0x541660;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1af('0x0'));var jsonpatch=require(_0xc1af('0x1'));var rp=require('request-promise');var moment=require(_0xc1af('0x2'));var BPromise=require(_0xc1af('0x3'));var Mustache=require(_0xc1af('0x4'));var util=require(_0xc1af('0x5'));var path=require(_0xc1af('0x6'));var sox=require(_0xc1af('0x7'));var csv=require(_0xc1af('0x8'));var ejs=require(_0xc1af('0x9'));var fs=require('fs');var fs_extra=require(_0xc1af('0xa'));var _=require(_0xc1af('0xb'));var squel=require('squel');var crypto=require(_0xc1af('0xc'));var jsforce=require(_0xc1af('0xd'));var deskjs=require(_0xc1af('0xe'));var toCsv=require(_0xc1af('0x8'));var querystring=require('querystring');var Papa=require(_0xc1af('0xf'));var Redis=require(_0xc1af('0x10'));var authService=require(_0xc1af('0x11'));var qs=require(_0xc1af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1af('0x13'))(_0xc1af('0x14'));var utils=require(_0xc1af('0x15'));var config=require(_0xc1af('0x16'));var licenseUtil=require(_0xc1af('0x17'));var db=require(_0xc1af('0x18'))['db'];function respondWithStatusCode(_0x313823,_0x250f93){_0x250f93=_0x250f93||0xcc;return function(_0x5de74b){if(_0x5de74b){return _0x313823[_0xc1af('0x19')](_0x250f93);}return _0x313823[_0xc1af('0x1a')](_0x250f93)['end']();};}function respondWithResult(_0xb60883,_0x1864f1){_0x1864f1=_0x1864f1||0xc8;return function(_0x58ab1e){if(_0x58ab1e){return _0xb60883[_0xc1af('0x1a')](_0x1864f1)[_0xc1af('0x1b')](_0x58ab1e);}};}function respondWithFilteredResult(_0x3ed051,_0x3e6855){return function(_0x4c6c82){if(_0x4c6c82){var _0x11f5c6=typeof _0x3e6855['offset']==='undefined'&&typeof _0x3e6855[_0xc1af('0x1c')]==='undefined';var _0x245622=_0x4c6c82[_0xc1af('0x1d')];var _0x5882b0=_0x11f5c6?0x0:_0x3e6855[_0xc1af('0x1e')];var _0x835fff=_0x11f5c6?_0x4c6c82['count']:_0x3e6855[_0xc1af('0x1e')]+_0x3e6855[_0xc1af('0x1c')];var _0x4a20ac;if(_0x835fff>=_0x245622){_0x835fff=_0x245622;_0x4a20ac=0xc8;}else{_0x4a20ac=0xce;}_0x3ed051[_0xc1af('0x1a')](_0x4a20ac);return _0x3ed051[_0xc1af('0x1f')](_0xc1af('0x20'),_0x5882b0+'-'+_0x835fff+'/'+_0x245622)[_0xc1af('0x1b')](_0x4c6c82);}return null;};}function patchUpdates(_0x158090){return function(_0xa5d271){try{jsonpatch[_0xc1af('0x21')](_0xa5d271,_0x158090,!![]);}catch(_0x139ef3){return BPromise[_0xc1af('0x22')](_0x139ef3);}return _0xa5d271['save']();};}function saveUpdates(_0x3107e8,_0x5a47d5){return function(_0x5401a0){if(_0x5401a0){return _0x5401a0[_0xc1af('0x23')](_0x3107e8)['then'](function(_0x1caf8c){return _0x1caf8c;});}return null;};}function removeEntity(_0x3ccd67,_0x177f1e){return function(_0x2e0fac){if(_0x2e0fac){return _0x2e0fac[_0xc1af('0x24')]()['then'](function(){_0x3ccd67[_0xc1af('0x1a')](0xcc)[_0xc1af('0x25')]();});}};}function handleEntityNotFound(_0x4242ca,_0x3dcbe3){return function(_0x3d08d6){if(!_0x3d08d6){_0x4242ca[_0xc1af('0x19')](0x194);}return _0x3d08d6;};}function handleError(_0x105670,_0x2af1d6){_0x2af1d6=_0x2af1d6||0x1f4;return function(_0x542982){logger['error'](_0x542982[_0xc1af('0x26')]);if(_0x542982[_0xc1af('0x27')]){delete _0x542982[_0xc1af('0x27')];}_0x105670['status'](_0x2af1d6)[_0xc1af('0x28')](_0x542982);};}exports['index']=function(_0x127ec9,_0x39f243){var _0x2ea1ee={},_0x456c9b={},_0x4b3af4={'count':0x0,'rows':[]};var _0x6449e7=_[_0xc1af('0x29')](db[_0xc1af('0x2a')][_0xc1af('0x2b')],function(_0x2281f6){return{'name':_0x2281f6[_0xc1af('0x2c')],'type':_0x2281f6[_0xc1af('0x2d')][_0xc1af('0x2e')]};});_0x456c9b['model']=_[_0xc1af('0x29')](_0x6449e7,_0xc1af('0x27'));_0x456c9b[_0xc1af('0x2f')]=_[_0xc1af('0x30')](_0x127ec9['query']);_0x456c9b['filters']=_[_0xc1af('0x31')](_0x456c9b[_0xc1af('0x32')],_0x456c9b[_0xc1af('0x2f')]);_0x2ea1ee[_0xc1af('0x33')]=_['intersection'](_0x456c9b[_0xc1af('0x32')],qs[_0xc1af('0x34')](_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x34')]));_0x2ea1ee['attributes']=_0x2ea1ee['attributes']['length']?_0x2ea1ee['attributes']:_0x456c9b[_0xc1af('0x32')];if(!_0x127ec9['query'][_0xc1af('0x35')]('nolimit')){_0x2ea1ee[_0xc1af('0x1c')]=qs['limit'](_0x127ec9['query']['limit']);_0x2ea1ee[_0xc1af('0x1e')]=qs[_0xc1af('0x1e')](_0x127ec9['query'][_0xc1af('0x1e')]);}_0x2ea1ee[_0xc1af('0x36')]=qs[_0xc1af('0x37')](_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x37')]);_0x2ea1ee[_0xc1af('0x38')]=qs['filters'](_[_0xc1af('0x39')](_0x127ec9[_0xc1af('0x2f')],_0x456c9b[_0xc1af('0x3a')]),_0x6449e7);if(_0x127ec9['query']['filter']){_0x2ea1ee[_0xc1af('0x38')]=_['merge'](_0x2ea1ee[_0xc1af('0x38')],{'$or':_[_0xc1af('0x29')](_0x6449e7,function(_0xbb7718){if(_0xbb7718['type']!==_0xc1af('0x3b')){var _0x19f742={};_0x19f742[_0xbb7718[_0xc1af('0x27')]]={'$like':'%'+_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x3c')]+'%'};return _0x19f742;}})});}_0x2ea1ee=_[_0xc1af('0x3d')]({},_0x2ea1ee,_0x127ec9['options']);var _0x1b6a64={'where':_0x2ea1ee[_0xc1af('0x38')]};return db[_0xc1af('0x2a')]['count'](_0x1b6a64)[_0xc1af('0x3e')](function(_0x1f5a39){_0x4b3af4[_0xc1af('0x1d')]=_0x1f5a39;if(_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x3f')]){_0x2ea1ee[_0xc1af('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xc1af('0x41')](_0x2ea1ee);})['then'](function(_0x4643a4){_0x4b3af4[_0xc1af('0x42')]=_0x4643a4;return _0x4b3af4;})[_0xc1af('0x3e')](respondWithFilteredResult(_0x39f243,_0x2ea1ee))[_0xc1af('0x43')](handleError(_0x39f243,null));};exports[_0xc1af('0x44')]=function(_0xb2d6c,_0x1eb245){var _0x443b1a={'raw':!![],'where':{'id':_0xb2d6c['params']['id']}},_0x42cdc5={};_0x42cdc5['model']=_['keys'](db['WhatsappTransferReport'][_0xc1af('0x2b')]);_0x42cdc5[_0xc1af('0x2f')]=_[_0xc1af('0x30')](_0xb2d6c[_0xc1af('0x2f')]);_0x42cdc5[_0xc1af('0x3a')]=_[_0xc1af('0x31')](_0x42cdc5[_0xc1af('0x32')],_0x42cdc5[_0xc1af('0x2f')]);_0x443b1a[_0xc1af('0x33')]=_[_0xc1af('0x31')](_0x42cdc5[_0xc1af('0x32')],qs[_0xc1af('0x34')](_0xb2d6c['query']['fields']));_0x443b1a[_0xc1af('0x33')]=_0x443b1a[_0xc1af('0x33')]['length']?_0x443b1a['attributes']:_0x42cdc5[_0xc1af('0x32')];if(_0xb2d6c['query'][_0xc1af('0x3f')]){_0x443b1a[_0xc1af('0x40')]=[{'all':!![]}];}_0x443b1a=_[_0xc1af('0x3d')]({},_0x443b1a,_0xb2d6c[_0xc1af('0x45')]);return db[_0xc1af('0x2a')][_0xc1af('0x46')](_0x443b1a)[_0xc1af('0x3e')](handleEntityNotFound(_0x1eb245,null))[_0xc1af('0x3e')](respondWithResult(_0x1eb245,null))[_0xc1af('0x43')](handleError(_0x1eb245,null));};exports['create']=function(_0x1b809d,_0x8b7d73){return db[_0xc1af('0x2a')]['create'](_0x1b809d[_0xc1af('0x47')],{})[_0xc1af('0x3e')](respondWithResult(_0x8b7d73,0xc9))[_0xc1af('0x43')](handleError(_0x8b7d73,null));};exports[_0xc1af('0x23')]=function(_0x50c1eb,_0x1300c8){if(_0x50c1eb[_0xc1af('0x47')]['id']){delete _0x50c1eb['body']['id'];}return db[_0xc1af('0x2a')][_0xc1af('0x46')]({'where':{'id':_0x50c1eb[_0xc1af('0x48')]['id']}})['then'](handleEntityNotFound(_0x1300c8,null))[_0xc1af('0x3e')](saveUpdates(_0x50c1eb[_0xc1af('0x47')],null))[_0xc1af('0x3e')](respondWithResult(_0x1300c8,null))[_0xc1af('0x43')](handleError(_0x1300c8,null));};exports[_0xc1af('0x24')]=function(_0x456252,_0x36b468){return db[_0xc1af('0x2a')]['find']({'where':{'id':_0x456252[_0xc1af('0x48')]['id']}})[_0xc1af('0x3e')](handleEntityNotFound(_0x36b468,null))['then'](removeEntity(_0x36b468,null))[_0xc1af('0x43')](handleError(_0x36b468,null));};exports[_0xc1af('0x49')]=function(_0x628a03,_0x5ae502){return db[_0xc1af('0x2a')]['describe']()[_0xc1af('0x3e')](respondWithResult(_0x5ae502,null))['catch'](handleError(_0x5ae502,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 234e5fe..36550df 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 _0x166f=['bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment'];(function(_0x530bb8,_0x504b57){var _0x140fca=function(_0x16e565){while(--_0x16e565){_0x530bb8['push'](_0x530bb8['shift']());}};_0x140fca(++_0x504b57);}(_0x166f,0x80));var _0xf166=function(_0x497601,_0x2f25c8){_0x497601=_0x497601-0x0;var _0x2475cc=_0x166f[_0x497601];return _0x2475cc;};'use strict';var _=require(_0xf166('0x0'));var util=require(_0xf166('0x1'));var logger=require('../../config/logger')(_0xf166('0x2'));var moment=require(_0xf166('0x3'));var BPromise=require(_0xf166('0x4'));var rp=require(_0xf166('0x5'));var fs=require('fs');var path=require(_0xf166('0x6'));var rimraf=require(_0xf166('0x7'));var config=require('../../config/environment');var attributes=require(_0xf166('0x8'));module['exports']=function(_0x9240ec,_0x12e4f7){return _0x9240ec['define'](_0xf166('0x9'),attributes,{'tableName':_0xf166('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf166('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3833=['request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','bluebird'];(function(_0x4a73a4,_0x2c64a9){var _0x230aae=function(_0x3acdf7){while(--_0x3acdf7){_0x4a73a4['push'](_0x4a73a4['shift']());}};_0x230aae(++_0x2c64a9);}(_0x3833,0x1c0));var _0x3383=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x3833[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x3383('0x0'));var util=require('util');var logger=require(_0x3383('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3383('0x2'));var rp=require(_0x3383('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3383('0x4'));var config=require('../../config/environment');var attributes=require(_0x3383('0x5'));module[_0x3383('0x6')]=function(_0x452f9f,_0x38201f){return _0x452f9f[_0x3383('0x7')](_0x3383('0x8'),attributes,{'tableName':_0x3383('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3383('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c234df1..f73df9a 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 _0xa68b=['catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xf56e6f,_0x35950e){var _0x5d25a0=function(_0x4b869c){while(--_0x4b869c){_0xf56e6f['push'](_0xf56e6f['shift']());}};_0x5d25a0(++_0x35950e);}(_0xa68b,0xd9));var _0xba68=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xa68b[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0xba68('0x0'));var moment=require('moment');var BPromise=require(_0xba68('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba68('0x2'));var db=require(_0xba68('0x3'))['db'];var utils=require(_0xba68('0x4'));var logger=require(_0xba68('0x5'))(_0xba68('0x6'));var config=require('../../config/environment');var jayson=require(_0xba68('0x7'));var client=jayson[_0xba68('0x8')][_0xba68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x361a05,_0x54be9c,_0x52e771){return new BPromise(function(_0x2bf14f,_0x1456ad){return client['request'](_0x361a05,_0x52e771)['then'](function(_0x100a74){logger[_0xba68('0xa')](_0xba68('0xb'),_0x54be9c,_0xba68('0xc'));logger[_0xba68('0xd')](_0xba68('0xe'),_0x54be9c,_0xba68('0xc'),JSON['stringify'](_0x100a74));if(_0x100a74['error']){if(_0x100a74['error']['code']===0x1f4){logger[_0xba68('0xf')](_0xba68('0xb'),_0x54be9c,_0x100a74[_0xba68('0xf')][_0xba68('0x10')]);return _0x1456ad(_0x100a74[_0xba68('0xf')][_0xba68('0x10')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x54be9c,_0x100a74[_0xba68('0xf')][_0xba68('0x10')]);return _0x2bf14f(_0x100a74[_0xba68('0xf')][_0xba68('0x10')]);}else{logger[_0xba68('0xa')](_0xba68('0xb'),_0x54be9c,'request\x20sent');_0x2bf14f(_0x100a74['result'][_0xba68('0x10')]);}})[_0xba68('0x11')](function(_0x2012ef){logger[_0xba68('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x54be9c,_0x2012ef);_0x1456ad(_0x2012ef);});});} \ No newline at end of file +var _0xdf7e=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x34775f,_0x4e27f1){var _0x42efd1=function(_0x352130){while(--_0x352130){_0x34775f['push'](_0x34775f['shift']());}};_0x42efd1(++_0x4e27f1);}(_0xdf7e,0x190));var _0xedf7=function(_0x44218f,_0x26e22f){_0x44218f=_0x44218f-0x0;var _0x2ff500=_0xdf7e[_0x44218f];return _0x2ff500;};'use strict';var _=require('lodash');var util=require(_0xedf7('0x0'));var moment=require(_0xedf7('0x1'));var BPromise=require(_0xedf7('0x2'));var rs=require(_0xedf7('0x3'));var fs=require('fs');var Redis=require(_0xedf7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xedf7('0x5'));var config=require(_0xedf7('0x6'));var jayson=require(_0xedf7('0x7'));var client=jayson['client'][_0xedf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3491d1,_0x2e87f8,_0x36ab66){return new BPromise(function(_0x159da2,_0x39515b){return client[_0xedf7('0x9')](_0x3491d1,_0x36ab66)[_0xedf7('0xa')](function(_0x5d8e48){logger[_0xedf7('0xb')](_0xedf7('0xc'),_0x2e87f8,'request\x20sent');logger[_0xedf7('0xd')](_0xedf7('0xe'),_0x2e87f8,_0xedf7('0xf'),JSON[_0xedf7('0x10')](_0x5d8e48));if(_0x5d8e48[_0xedf7('0x11')]){if(_0x5d8e48[_0xedf7('0x11')][_0xedf7('0x12')]===0x1f4){logger[_0xedf7('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2e87f8,_0x5d8e48[_0xedf7('0x11')]['message']);return _0x39515b(_0x5d8e48[_0xedf7('0x11')][_0xedf7('0x13')]);}logger[_0xedf7('0x11')](_0xedf7('0xc'),_0x2e87f8,_0x5d8e48['error']['message']);return _0x159da2(_0x5d8e48['error'][_0xedf7('0x13')]);}else{logger[_0xedf7('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2e87f8,'request\x20sent');_0x159da2(_0x5d8e48[_0xedf7('0x14')]['message']);}})[_0xedf7('0x15')](function(_0x1b7bef){logger[_0xedf7('0x11')](_0xedf7('0xc'),_0x2e87f8,_0x1b7bef);_0x39515b(_0x1b7bef);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b722029..722366b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22ed=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','None','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','info','start'];(function(_0x3eb39f,_0x53fded){var _0xc02de7=function(_0x569258){while(--_0x569258){_0x3eb39f['push'](_0x3eb39f['shift']());}};_0xc02de7(++_0x53fded);}(_0x22ed,0x1a9));var _0xd22e=function(_0x51eb9d,_0x1e9a02){_0x51eb9d=_0x51eb9d-0x0;var _0x1fb227=_0x22ed[_0x51eb9d];return _0x1fb227;};'use strict';var _=require(_0xd22e('0x0'));var db=require(_0xd22e('0x1'))['db'];var seedDb=require(_0xd22e('0x2'));var checkLicense=require(_0xd22e('0x3'));var rpc=require(_0xd22e('0x4'));var config=require(_0xd22e('0x5'));var logger=require(_0xd22e('0x6'))(_0xd22e('0x7'));var pm2=require(_0xd22e('0x8'));var pm2Config=require(_0xd22e('0x9'));var schedule=require(_0xd22e('0xa'));var chat=require(_0xd22e('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd22e('0xc'));var provider=require(_0xd22e('0xd'));function main(){return db['sequelize'][_0xd22e('0xe')]()[_0xd22e('0xf')](function(){if(config['seedDB']){return seedDb[_0xd22e('0x10')]();}})['then'](function(){return checkLicense['default']();})[_0xd22e('0xf')](function(){return rpc['listen']();})['then'](function(_0x54c27d){logger[_0xd22e('0x11')](_0x54c27d);return chat[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return whatsapp[_0xd22e('0x12')]();})['then'](function(){return schedule[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return transcribe[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return provider[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(_0x5d36cb){logger[_0xd22e('0x11')](_0x5d36cb);return pm2[_0xd22e('0x12')](pm2Config);})[_0xd22e('0xf')](function(_0x5b6d95){var _0x3b06e2=_0x5b6d95['filter'](function(_0x3525b5){return typeof _0x3525b5[_0xd22e('0x13')]===_0xd22e('0x14')&&_0x3525b5[_0xd22e('0x13')]>=0x0;});if(_0x3b06e2[_0xd22e('0x15')]>0x0){throw new Error(_0x3b06e2[_0xd22e('0x15')]+_0xd22e('0x16')+_[_0xd22e('0x17')](_0x3b06e2,function(_0x57f44f){return'\x22'+_0x57f44f[_0xd22e('0x18')][_0xd22e('0x19')]+'\x22';}));}logger[_0xd22e('0x11')](_0xd22e('0x1a'),_[_0xd22e('0x17')](_[_0xd22e('0x1b')](_0x5b6d95,{'status':'online'}),_0xd22e('0x19'))['join']());logger[_0xd22e('0x11')]('Offline\x20apps:',_['map'](_[_0xd22e('0x1b')](_0x5b6d95,function(_0x47b008){return _0x47b008['status']!==_0xd22e('0x1c');}),_0xd22e('0x19'))[_0xd22e('0x1d')]()||_0xd22e('0x1e'));console['log'](_0xd22e('0x1f'));})[_0xd22e('0x20')](function(_0x28f5b7){console['log'](_0xd22e('0x21'),_0x28f5b7);logger[_0xd22e('0x22')](_0xd22e('0x23'),_0x28f5b7);process[_0xd22e('0x24')](0x1);});}main(); \ No newline at end of file +var _0x21d1=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','Offline\x20apps:','status','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number'];(function(_0x35f5ee,_0x16b168){var _0x56f4a5=function(_0x27ef6e){while(--_0x27ef6e){_0x35f5ee['push'](_0x35f5ee['shift']());}};_0x56f4a5(++_0x16b168);}(_0x21d1,0x1c9));var _0x121d=function(_0x20c7e5,_0x4b259e){_0x20c7e5=_0x20c7e5-0x0;var _0x3a91eb=_0x21d1[_0x20c7e5];return _0x3a91eb;};'use strict';var _=require(_0x121d('0x0'));var db=require(_0x121d('0x1'))['db'];var seedDb=require(_0x121d('0x2'));var checkLicense=require(_0x121d('0x3'));var rpc=require(_0x121d('0x4'));var config=require(_0x121d('0x5'));var logger=require('./config/logger')('app');var pm2=require(_0x121d('0x6'));var pm2Config=require(_0x121d('0x7'));var schedule=require(_0x121d('0x8'));var chat=require(_0x121d('0x9'));var whatsapp=require(_0x121d('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x121d('0xb'));function main(){return db[_0x121d('0xc')][_0x121d('0xd')]()[_0x121d('0xe')](function(){if(config[_0x121d('0xf')]){return seedDb[_0x121d('0x10')]();}})[_0x121d('0xe')](function(){return checkLicense[_0x121d('0x10')]();})[_0x121d('0xe')](function(){return rpc[_0x121d('0x11')]();})['then'](function(_0x1f1201){logger[_0x121d('0x12')](_0x1f1201);return chat[_0x121d('0x13')]();})['then'](function(){return whatsapp['start']();})[_0x121d('0xe')](function(){return schedule[_0x121d('0x13')]();})[_0x121d('0xe')](function(){return transcribe['start']();})['then'](function(){return provider[_0x121d('0x13')]();})['then'](function(_0x1bb2cb){logger[_0x121d('0x12')](_0x1bb2cb);return pm2[_0x121d('0x13')](pm2Config);})['then'](function(_0x224e01){var _0x10786c=_0x224e01[_0x121d('0x14')](function(_0x8dec86){return typeof _0x8dec86[_0x121d('0x15')]===_0x121d('0x16')&&_0x8dec86[_0x121d('0x15')]>=0x0;});if(_0x10786c[_0x121d('0x17')]>0x0){throw new Error(_0x10786c[_0x121d('0x17')]+_0x121d('0x18')+_[_0x121d('0x19')](_0x10786c,function(_0x15eac4){return'\x22'+_0x15eac4[_0x121d('0x1a')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x121d('0x19')](_[_0x121d('0x14')](_0x224e01,{'status':'online'}),_0x121d('0x1b'))[_0x121d('0x1c')]());logger[_0x121d('0x12')](_0x121d('0x1d'),_[_0x121d('0x19')](_[_0x121d('0x14')](_0x224e01,function(_0x477485){return _0x477485[_0x121d('0x1e')]!==_0x121d('0x1f');}),_0x121d('0x1b'))[_0x121d('0x1c')]()||_0x121d('0x20'));console[_0x121d('0x21')](_0x121d('0x22'));})[_0x121d('0x23')](function(_0x115e47){console[_0x121d('0x21')](_0x121d('0x24'),_0x115e47);logger[_0x121d('0x25')](_0x121d('0x26'),_0x115e47);process[_0x121d('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1ef4a08..a9386fe 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 _0xd8b0=['cookie','motion.token','send','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','session','payload','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','moment','secrets','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswerDelay','use','user','ChatInteraction','findOne','params','closed','then','status','unmanaged','json','disposition','Forbidden.','catch','isAuthenticated','authorization','headers','Basic','name','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','Setting','allowedLoginAttempts','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x4ad5b8,_0x4073de){var _0x4f1fe8=function(_0x474b28){while(--_0x474b28){_0x4ad5b8['push'](_0x4ad5b8['shift']());}};_0x4f1fe8(++_0x4073de);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var db=require(_0x0d8b('0x0'))['db'];var config=require(_0x0d8b('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0d8b('0x2'));var jwt=require(_0x0d8b('0x3'));var expressJwt=require(_0x0d8b('0x4'));var compose=require(_0x0d8b('0x5'));var basicAuth=require(_0x0d8b('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x0d8b('0x7'));var moment=require(_0x0d8b('0x8'));var validateJwt=expressJwt({'secret':config[_0x0d8b('0x9')]['session']});var userAttributes=['id',_0x0d8b('0xa'),_0x0d8b('0xb'),'name',_0x0d8b('0xc'),_0x0d8b('0xd'),_0x0d8b('0xe'),_0x0d8b('0xf'),_0x0d8b('0x10'),_0x0d8b('0x11'),_0x0d8b('0x12'),_0x0d8b('0x13'),'faxPause',_0x0d8b('0x14'),'openchannelPause',_0x0d8b('0x15'),_0x0d8b('0x16'),_0x0d8b('0x17'),_0x0d8b('0x18'),_0x0d8b('0x19'),_0x0d8b('0x1a'),_0x0d8b('0x1b'),_0x0d8b('0x1c'),_0x0d8b('0x1d'),_0x0d8b('0x1e'),_0x0d8b('0x1f'),_0x0d8b('0x20'),_0x0d8b('0x21'),_0x0d8b('0x22'),'phoneBarExpires',_0x0d8b('0x23'),_0x0d8b('0x24'),_0x0d8b('0x25'),_0x0d8b('0x26'),_0x0d8b('0x27'),'userProfileId',_0x0d8b('0x28'),_0x0d8b('0x29'),_0x0d8b('0x2a'),_0x0d8b('0x2b'),_0x0d8b('0x2c'),_0x0d8b('0x2d'),_0x0d8b('0x2e'),_0x0d8b('0x2f'),'chatAutoanswer',_0x0d8b('0x30'),_0x0d8b('0x31'),_0x0d8b('0x32'),_0x0d8b('0x33'),_0x0d8b('0x34'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x37'),'faxAutoanswerDelay','whatsappAutoanswer',_0x0d8b('0x38'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0d8b('0x39')](function(_0x2b924f,_0x214778,_0x38efc8){if(_0x2b924f[_0x0d8b('0x3a')]){_0x38efc8();}else{return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')]({'where':{'id':_0x2b924f[_0x0d8b('0x3d')]['id']},'attributes':['id',_0x0d8b('0x3e'),'disposition'],'raw':!![]})[_0x0d8b('0x3f')](function(_0x4463ee){if(_0x4463ee&&_0x4463ee['closed']){return _0x214778[_0x0d8b('0x40')](_0x4463ee['disposition']===_0x0d8b('0x41')?0x195:0x193)[_0x0d8b('0x42')]({'message':_0x4463ee[_0x0d8b('0x43')]==='unmanaged'?'Unmanaged.':_0x0d8b('0x44')});}else{_0x38efc8();}})[_0x0d8b('0x45')](function(_0x4c05ee){_0x38efc8(_0x4c05ee);});}});};exports[_0x0d8b('0x46')]=function isAuthenticated(_0x59aa83){return compose()[_0x0d8b('0x39')](function(_0x4b59e5,_0x97050a,_0x48f24f){var _0x2ab00d;if(_0x4b59e5['headers'][_0x0d8b('0x47')]){if(_['startsWith'](_0x4b59e5[_0x0d8b('0x48')][_0x0d8b('0x47')],_0x0d8b('0x49'))){var _0x56120a=basicAuth(_0x4b59e5);db['User']['find']({'where':{'name':_0x56120a[_0x0d8b('0x4a')]}})['then'](function(_0x3cdf3c){if(!_0x3cdf3c||!_0x3cdf3c['authenticate'](_0x56120a['pass'])){return _0x97050a[_0x0d8b('0x40')](0x191)[_0x0d8b('0x42')]({'message':_0x0d8b('0x4b')});}_0x4b59e5[_0x0d8b('0x3a')]={'id':_0x3cdf3c['id']};_0x48f24f();})[_0x0d8b('0x45')](function(_0xeaa769){_0x48f24f(_0xeaa769);});}else if(_[_0x0d8b('0x4c')](_0x4b59e5[_0x0d8b('0x48')]['authorization'],_0x0d8b('0x4d'))){validateJwt(_0x4b59e5,_0x97050a,_0x48f24f);}else{if(_0x59aa83){_0x48f24f();}else{return _0x97050a[_0x0d8b('0x40')](0x193)['json']({'message':_0x0d8b('0x4e')});}}}else if(_0x4b59e5[_0x0d8b('0x4f')][_0x0d8b('0x50')]){try{var _0x4f2ed2={'audience':hardwareConf[_0x0d8b('0x51')](),'issuer':hardwareConf[_0x0d8b('0x51')]()};verifyJwt(_0x4b59e5[_0x0d8b('0x4f')][_0x0d8b('0x50')],_0x4f2ed2)[_0x0d8b('0x3f')](function(_0x55d742){return db[_0x0d8b('0x52')][_0x0d8b('0x53')]({'where':{'id':_0x55d742['sub']}})[_0x0d8b('0x3f')](function(_0x3cc3ee){_0x2ab00d=_0x3cc3ee;return db[_0x0d8b('0x54')][_0x0d8b('0x3c')]({'where':{'id':0x1},'attributes':[_0x0d8b('0x55'),'blockDuration'],'raw':!![]});})['then'](function(_0x41b4f9){if(!_0x2ab00d||!_['isEqual'](_0x2ab00d['apiKeyNonce'],_0x55d742[_0x0d8b('0x56')])){return _0x97050a[_0x0d8b('0x40')](0x191)[_0x0d8b('0x42')]({'message':_0x0d8b('0x57')});}if(_0x2ab00d[_0x0d8b('0x58')]){return _0x97050a[_0x0d8b('0x40')](0x191)['json']({'message':_0x0d8b('0x59')});}if(_0x2ab00d[_0x0d8b('0x5a')]){if(_0x41b4f9[_0x0d8b('0x5b')]>0x0){if(moment(_0x2ab00d[_0x0d8b('0x5c')])[_0x0d8b('0x5d')](_0x41b4f9[_0x0d8b('0x5b')],_0x0d8b('0x5e'))>moment()){return _0x97050a['status'](0x191)[_0x0d8b('0x42')]({'message':_0x0d8b('0x59')});}}else{return _0x97050a[_0x0d8b('0x40')](0x191)[_0x0d8b('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4b59e5[_0x0d8b('0x3a')]={'id':_0x2ab00d['id']};_0x48f24f();});})['catch'](function(){return _0x97050a[_0x0d8b('0x40')](0x191)[_0x0d8b('0x42')]({'message':_0x0d8b('0x59')});});}catch(_0x26ac10){_0x48f24f(_0x26ac10);}}else if(_0x59aa83){_0x48f24f();}else{return _0x97050a[_0x0d8b('0x40')](0x193)[_0x0d8b('0x42')]({'message':_0x0d8b('0x4e')});}})[_0x0d8b('0x39')](function(_0x89ab0d,_0x2c3c84,_0x482069){if(_0x89ab0d['user']){db['User']['find']({'where':{'id':_0x89ab0d['user']['id']},'attributes':userAttributes})[_0x0d8b('0x3f')](function(_0x402fe0){if(!_0x402fe0){return _0x2c3c84[_0x0d8b('0x40')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x89ab0d[_0x0d8b('0x3a')]=_0x402fe0;_0x482069();})[_0x0d8b('0x45')](function(_0x344278){_0x482069(_0x344278);});}else if(_0x59aa83){_0x482069();}else{return _0x2c3c84['status'](0x194)[_0x0d8b('0x42')]({'message':_0x0d8b('0x5f')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x372740,_0x495870,_0x1e22e5){return licenseUtil['getLicense']()['then'](function(_0x30ccee){if(_0x30ccee[_0x0d8b('0x60')]){_0x1e22e5();}else{return _0x495870['status'](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x374d40){_0x1e22e5(_0x374d40);});});};exports[_0x0d8b('0x61')]=function isWebrtcLicence(){return compose()[_0x0d8b('0x39')](function(_0x490eda,_0xb0910e,_0x1afe8a){return licenseUtil[_0x0d8b('0x62')]()[_0x0d8b('0x3f')](function(_0x423ecd){if(_0x423ecd[_0x0d8b('0x63')]){_0x1afe8a();}else{return _0xb0910e[_0x0d8b('0x40')](0x193)[_0x0d8b('0x42')]({'message':_0x0d8b('0x64')});}})[_0x0d8b('0x45')](function(_0x44d54b){_0x1afe8a(_0x44d54b);});});};exports[_0x0d8b('0x65')]=function(_0x84ef1c,_0x3e569b,_0x570af8){_0x84ef1c[_0x0d8b('0x65')]=!![];return _0x570af8();};exports[_0x0d8b('0x66')]=function signToken(_0x1e162c){return signJwt(_0x1e162c);};exports[_0x0d8b('0x67')]=function(_0x574b90,_0x371fa0){if(!_0x574b90['user']){return _0x371fa0['status'](0x194)[_0x0d8b('0x42')]({'message':_0x0d8b('0x68')});}var _0x3f943a={'payload':{'id':_0x574b90[_0x0d8b('0x3a')]['id'],'role':_0x574b90['user'][_0x0d8b('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3f943a)[_0x0d8b('0x3f')](function(_0x386074){_0x371fa0[_0x0d8b('0x69')](_0x0d8b('0x6a'),_0x386074);_0x371fa0['redirect']('/dashboards/general');})['catch'](function(_0x573f4f){return _0x371fa0[_0x0d8b('0x40')](0x1f4)[_0x0d8b('0x6b')](_0x573f4f);});};exports['retrieveApiKey']=function(_0x4950a8){if(_[_0x0d8b('0x6c')](_0x4950a8[_0x0d8b('0x6d')])||_['isNil'](_0x4950a8['apiKeyIat'])){return null;}else{return createJwt(_0x4950a8);}};exports[_0x0d8b('0x6e')]=function(_0xeeefd4){_0xeeefd4[_0x0d8b('0x6d')]=generateNonce();_0xeeefd4[_0x0d8b('0x6f')]=generateIssuedAt();return createJwt(_0xeeefd4);};exports[_0x0d8b('0x70')]=function(_0x506a79,_0x2de903){var _0x2afe34=_0x506a79['query']['apikey'];if(_0x2afe34){var _0xf6a773={'nonce':_0x2de903[_0x0d8b('0x6d')],'iat':_0x2de903['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0d8b('0x51')]()};return verifyJwt(_0x2afe34,_0xf6a773)[_0x0d8b('0x3f')](function(){return generateApiKey(_0x2de903);});}else{throw{'message':_0x0d8b('0x71')};}};exports[_0x0d8b('0x72')]=function(_0x4a2989){var _0x356b3d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x356b3d['test'](_0x4a2989))throw new db['Sequelize'][(_0x0d8b('0x73'))](_0x0d8b('0x74'));return;};exports['validatePasswordHistory']=function(_0x4a8f33,_0x44ed23,_0x3d7161){var _0xccc2a9=encryptor[_0x0d8b('0x75')](_0x44ed23)[_0x0d8b('0x76')](',');for(var _0xb66e76=0x0;_0xb66e76<_0x3d7161;_0xb66e76++){if(!_0xccc2a9[_0xb66e76])break;if(_0x4a8f33[_0x0d8b('0x77')]()===_0xccc2a9[_0xb66e76][_0x0d8b('0x77')]()){var _0x5418d8=util[_0x0d8b('0x78')](_0x0d8b('0x79'),_0x3d7161);if(_0x3d7161===0x1){_0x5418d8=_0x0d8b('0x7a');}throw new db[(_0x0d8b('0x7b'))][(_0x0d8b('0x73'))](_0x5418d8);}}return;};exports[_0x0d8b('0x7c')]=function(_0x70c8c4,_0x1c78b6){var _0x375684=_0x1c78b6?encryptor['decryptString'](_0x1c78b6)[_0x0d8b('0x76')](','):[];if(_0x375684[_0x0d8b('0x7d')]===0x5){_0x375684[_0x0d8b('0x7e')](-0x1,0x1);}_0x375684[_0x0d8b('0x7f')](_0x70c8c4);return encryptor[_0x0d8b('0x80')](_0x375684['join'](','));};function signJwt(_0x1e1dce){var _0x2d6284=BPromise[_0x0d8b('0x81')](jwt[_0x0d8b('0x82')],{'context':jwt});var _0x1d6cd4=_0x1e1dce['secret']||config['secrets'][_0x0d8b('0x83')];return new BPromise(function(_0x291b83,_0x3e4a41){_0x2d6284(_0x1e1dce[_0x0d8b('0x84')],_0x1d6cd4,_0x1e1dce['options'])[_0x0d8b('0x3f')](function(_0x12aef7){_0x291b83(_0x12aef7);})[_0x0d8b('0x45')](function(_0x5952dd){_0x3e4a41(_0x5952dd);});});}function verifyJwt(_0x2f19f4,_0x532a85,_0x2fce07){var _0x3ed63e=BPromise[_0x0d8b('0x81')](jwt[_0x0d8b('0x85')],{'context':jwt});var _0x2b6eb6=_0x2fce07||config[_0x0d8b('0x9')]['session'];return new BPromise(function(_0x382d2e,_0x4c074d){_0x3ed63e(_0x2f19f4,_0x2b6eb6,_0x532a85)[_0x0d8b('0x3f')](function(_0x4577c8){_0x382d2e(_0x4577c8);})[_0x0d8b('0x45')](function(_0x33a614){_0x4c074d(_0x33a614);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x0d8b('0x86')](_0x0d8b('0x87'));}function generateIssuedAt(){return Math[_0x0d8b('0x88')](Date[_0x0d8b('0x89')]()/0x3e8)[_0x0d8b('0x86')]();}function createJwt(_0x273aef){var _0x223fd8={'payload':{'iat':_0x273aef[_0x0d8b('0x6f')],'nonce':_0x273aef[_0x0d8b('0x6d')]},'options':{'algorithm':_0x0d8b('0x8a'),'subject':_0x273aef['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x0d8b('0x51')]()}};return signJwt(_0x223fd8)[_0x0d8b('0x3f')](function(_0x53e399){return{'iat':_0x273aef[_0x0d8b('0x6f')],'nonce':_0x273aef['apiKeyNonce'],'token':_0x53e399};});} \ No newline at end of file +var _0xea28=['getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','/dashboards/general','send','retrieveApiKey','apiKeyIat','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','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','disposition','then','json','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','status','Bearer','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.'];(function(_0x48670a,_0x1addfb){var _0x7770a3=function(_0x35fd5f){while(--_0x35fd5f){_0x48670a['push'](_0x48670a['shift']());}};_0x7770a3(++_0x1addfb);}(_0xea28,0x13a));var _0x8ea2=function(_0x226d0e,_0x52107){_0x226d0e=_0x226d0e-0x0;var _0x2c2001=_0xea28[_0x226d0e];return _0x2c2001;};'use strict';var db=require(_0x8ea2('0x0'))['db'];var config=require(_0x8ea2('0x1'));var hardwareConf=require(_0x8ea2('0x2'));var licenseUtil=require(_0x8ea2('0x3'));var encryptor=require(_0x8ea2('0x4'));var _=require(_0x8ea2('0x5'));var jwt=require(_0x8ea2('0x6'));var expressJwt=require(_0x8ea2('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x8ea2('0x8'));var crypto=require(_0x8ea2('0x9'));var BPromise=require(_0x8ea2('0xa'));var util=require('util');var moment=require(_0x8ea2('0xb'));var validateJwt=expressJwt({'secret':config[_0x8ea2('0xc')][_0x8ea2('0xd')]});var userAttributes=['id',_0x8ea2('0xe'),_0x8ea2('0xf'),_0x8ea2('0x10'),_0x8ea2('0x11'),_0x8ea2('0x12'),_0x8ea2('0x13'),_0x8ea2('0x14'),_0x8ea2('0x15'),_0x8ea2('0x16'),'chatPause','mailPause',_0x8ea2('0x17'),_0x8ea2('0x18'),_0x8ea2('0x19'),'pauseType',_0x8ea2('0x1a'),_0x8ea2('0x1b'),_0x8ea2('0x1c'),_0x8ea2('0x1d'),_0x8ea2('0x1e'),'passwordResetAt',_0x8ea2('0x1f'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x8ea2('0x20'),_0x8ea2('0x21'),_0x8ea2('0x22'),_0x8ea2('0x23'),_0x8ea2('0x24'),_0x8ea2('0x25'),_0x8ea2('0x26'),_0x8ea2('0x27'),_0x8ea2('0x28'),_0x8ea2('0x29'),_0x8ea2('0x2a'),_0x8ea2('0x2b'),_0x8ea2('0x2c'),_0x8ea2('0x2d'),_0x8ea2('0x2e'),_0x8ea2('0x2f'),_0x8ea2('0x30'),_0x8ea2('0x31'),_0x8ea2('0x32'),_0x8ea2('0x33'),_0x8ea2('0x34'),_0x8ea2('0x35'),'emailAutoanswerDelay','smsAutoanswer',_0x8ea2('0x36'),_0x8ea2('0x37'),_0x8ea2('0x38'),'faxAutoanswer',_0x8ea2('0x39'),_0x8ea2('0x3a'),'whatsappAutoanswerDelay',_0x8ea2('0x3b')];exports[_0x8ea2('0x3c')]=function(){return this[_0x8ea2('0x3d')](!![])[_0x8ea2('0x3e')](function(_0x199c11,_0xe5c943,_0x199417){if(_0x199c11[_0x8ea2('0x3f')]){_0x199417();}else{return db[_0x8ea2('0x40')]['findOne']({'where':{'id':_0x199c11[_0x8ea2('0x41')]['id']},'attributes':['id','closed',_0x8ea2('0x42')],'raw':!![]})[_0x8ea2('0x43')](function(_0x29b38f){if(_0x29b38f&&_0x29b38f['closed']){return _0xe5c943['status'](_0x29b38f[_0x8ea2('0x42')]==='unmanaged'?0x195:0x193)[_0x8ea2('0x44')]({'message':_0x29b38f['disposition']===_0x8ea2('0x45')?_0x8ea2('0x46'):_0x8ea2('0x47')});}else{_0x199417();}})[_0x8ea2('0x48')](function(_0x4e1b90){_0x199417(_0x4e1b90);});}});};exports['isAuthenticated']=function isAuthenticated(_0xacaa6c){return compose()['use'](function(_0x4a9875,_0x287078,_0x24f187){var _0x41f482;if(_0x4a9875[_0x8ea2('0x49')][_0x8ea2('0x4a')]){if(_[_0x8ea2('0x4b')](_0x4a9875[_0x8ea2('0x49')][_0x8ea2('0x4a')],_0x8ea2('0x4c'))){var _0x56d914=basicAuth(_0x4a9875);db['User'][_0x8ea2('0x4d')]({'where':{'name':_0x56d914[_0x8ea2('0x10')]}})['then'](function(_0x4a110f){if(!_0x4a110f||!_0x4a110f[_0x8ea2('0x4e')](_0x56d914['pass'])){return _0x287078[_0x8ea2('0x4f')](0x191)[_0x8ea2('0x44')]({'message':'Wrong\x20credentials.'});}_0x4a9875[_0x8ea2('0x3f')]={'id':_0x4a110f['id']};_0x24f187();})[_0x8ea2('0x48')](function(_0x33abc8){_0x24f187(_0x33abc8);});}else if(_['startsWith'](_0x4a9875['headers']['authorization'],_0x8ea2('0x50'))){validateJwt(_0x4a9875,_0x287078,_0x24f187);}else{if(_0xacaa6c){_0x24f187();}else{return _0x287078[_0x8ea2('0x4f')](0x193)[_0x8ea2('0x44')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4a9875[_0x8ea2('0x51')][_0x8ea2('0x52')]){try{var _0x3d5bf0={'audience':hardwareConf[_0x8ea2('0x53')](),'issuer':hardwareConf[_0x8ea2('0x53')]()};verifyJwt(_0x4a9875[_0x8ea2('0x51')][_0x8ea2('0x52')],_0x3d5bf0)[_0x8ea2('0x43')](function(_0x5e9b1f){return db[_0x8ea2('0x54')][_0x8ea2('0x4d')]({'where':{'id':_0x5e9b1f[_0x8ea2('0x55')]}})[_0x8ea2('0x43')](function(_0x4eebc1){_0x41f482=_0x4eebc1;return db[_0x8ea2('0x56')]['findOne']({'where':{'id':0x1},'attributes':[_0x8ea2('0x57'),_0x8ea2('0x58')],'raw':!![]});})[_0x8ea2('0x43')](function(_0x1496ae){if(!_0x41f482||!_['isEqual'](_0x41f482[_0x8ea2('0x59')],_0x5e9b1f['nonce'])){return _0x287078['status'](0x191)[_0x8ea2('0x44')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x41f482[_0x8ea2('0x5a')]){return _0x287078[_0x8ea2('0x4f')](0x191)[_0x8ea2('0x44')]({'message':_0x8ea2('0x5b')});}if(_0x41f482[_0x8ea2('0x5c')]){if(_0x1496ae['blockDuration']>0x0){if(moment(_0x41f482[_0x8ea2('0x5d')])['add'](_0x1496ae[_0x8ea2('0x58')],_0x8ea2('0x5e'))>moment()){return _0x287078[_0x8ea2('0x4f')](0x191)[_0x8ea2('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x287078[_0x8ea2('0x4f')](0x191)['json']({'message':_0x8ea2('0x5b')});}}_0x4a9875['user']={'id':_0x41f482['id']};_0x24f187();});})[_0x8ea2('0x48')](function(){return _0x287078[_0x8ea2('0x4f')](0x191)[_0x8ea2('0x44')]({'message':_0x8ea2('0x5b')});});}catch(_0x373a70){_0x24f187(_0x373a70);}}else if(_0xacaa6c){_0x24f187();}else{return _0x287078[_0x8ea2('0x4f')](0x193)[_0x8ea2('0x44')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x1d7496,_0x53455a,_0x4b03fa){if(_0x1d7496['user']){db[_0x8ea2('0x54')]['find']({'where':{'id':_0x1d7496[_0x8ea2('0x3f')]['id']},'attributes':userAttributes})[_0x8ea2('0x43')](function(_0x39c944){if(!_0x39c944){return _0x53455a[_0x8ea2('0x4f')](0x194)[_0x8ea2('0x44')]({'message':_0x8ea2('0x5f')});}_0x1d7496[_0x8ea2('0x3f')]=_0x39c944;_0x4b03fa();})[_0x8ea2('0x48')](function(_0x5352b9){_0x4b03fa(_0x5352b9);});}else if(_0xacaa6c){_0x4b03fa();}else{return _0x53455a[_0x8ea2('0x4f')](0x194)[_0x8ea2('0x44')]({'message':_0x8ea2('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x8ea2('0x3e')](function(_0x17df7b,_0x8005f9,_0x320cb4){return licenseUtil[_0x8ea2('0x61')]()['then'](function(_0x3e6541){if(_0x3e6541[_0x8ea2('0x62')]){_0x320cb4();}else{return _0x8005f9[_0x8ea2('0x4f')](0x193)['json']({'message':_0x8ea2('0x63')});}})[_0x8ea2('0x48')](function(_0x402fc1){_0x320cb4(_0x402fc1);});});};exports[_0x8ea2('0x64')]=function isWebrtcLicence(){return compose()[_0x8ea2('0x3e')](function(_0x3ca1c8,_0x3f51ae,_0x26e2d5){return licenseUtil[_0x8ea2('0x61')]()[_0x8ea2('0x43')](function(_0x46e1ad){if(_0x46e1ad[_0x8ea2('0x65')]){_0x26e2d5();}else{return _0x3f51ae[_0x8ea2('0x4f')](0x193)[_0x8ea2('0x44')]({'message':'Forbidden'});}})[_0x8ea2('0x48')](function(_0x256748){_0x26e2d5(_0x256748);});});};exports[_0x8ea2('0x66')]=function(_0x6ed85a,_0x182a46,_0x1daa25){_0x6ed85a[_0x8ea2('0x66')]=!![];return _0x1daa25();};exports[_0x8ea2('0x67')]=function signToken(_0x52df67){return signJwt(_0x52df67);};exports[_0x8ea2('0x68')]=function(_0x37a1cf,_0x24dddb){if(!_0x37a1cf['user']){return _0x24dddb['status'](0x194)[_0x8ea2('0x44')]({'message':_0x8ea2('0x69')});}var _0x7ffa4e={'payload':{'id':_0x37a1cf['user']['id'],'role':_0x37a1cf[_0x8ea2('0x3f')][_0x8ea2('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x7ffa4e)[_0x8ea2('0x43')](function(_0x11d7ea){_0x24dddb[_0x8ea2('0x6a')]('motion.token',_0x11d7ea);_0x24dddb['redirect'](_0x8ea2('0x6b'));})[_0x8ea2('0x48')](function(_0x1b8c4b){return _0x24dddb['status'](0x1f4)[_0x8ea2('0x6c')](_0x1b8c4b);});};exports[_0x8ea2('0x6d')]=function(_0x442dce){if(_['isNil'](_0x442dce['apiKeyNonce'])||_['isNil'](_0x442dce['apiKeyIat'])){return null;}else{return createJwt(_0x442dce);}};exports['generateApiKey']=function(_0x424f29){_0x424f29[_0x8ea2('0x59')]=generateNonce();_0x424f29['apiKeyIat']=generateIssuedAt();return createJwt(_0x424f29);};exports['regenerateApiKey']=function(_0x1a7a75,_0x12c0db){var _0x43c794=_0x1a7a75['query'][_0x8ea2('0x52')];if(_0x43c794){var _0x30ebd3={'nonce':_0x12c0db['apiKeyNonce'],'iat':_0x12c0db[_0x8ea2('0x6e')],'audience':hardwareConf[_0x8ea2('0x53')](),'issuer':hardwareConf[_0x8ea2('0x53')]()};return verifyJwt(_0x43c794,_0x30ebd3)[_0x8ea2('0x43')](function(){return generateApiKey(_0x12c0db);});}else{throw{'message':_0x8ea2('0x6f')};}};exports['validatePasswordPattern']=function(_0x4a8326){var _0x577049=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x577049[_0x8ea2('0x70')](_0x4a8326))throw new db[(_0x8ea2('0x71'))][(_0x8ea2('0x72'))](_0x8ea2('0x73'));return;};exports[_0x8ea2('0x74')]=function(_0x3836c3,_0x36fda3,_0x5265e7){var _0x480ed2=encryptor['decryptString'](_0x36fda3)[_0x8ea2('0x75')](',');for(var _0x45386c=0x0;_0x45386c<_0x5265e7;_0x45386c++){if(!_0x480ed2[_0x45386c])break;if(_0x3836c3[_0x8ea2('0x76')]()===_0x480ed2[_0x45386c][_0x8ea2('0x76')]()){var _0x57720d=util[_0x8ea2('0x77')](_0x8ea2('0x78'),_0x5265e7);if(_0x5265e7===0x1){_0x57720d='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x8ea2('0x71'))][(_0x8ea2('0x72'))](_0x57720d);}}return;};exports[_0x8ea2('0x79')]=function(_0xf78d1d,_0x3de1a2){var _0x48c1de=_0x3de1a2?encryptor['decryptString'](_0x3de1a2)['split'](','):[];if(_0x48c1de[_0x8ea2('0x7a')]===0x5){_0x48c1de[_0x8ea2('0x7b')](-0x1,0x1);}_0x48c1de[_0x8ea2('0x7c')](_0xf78d1d);return encryptor[_0x8ea2('0x7d')](_0x48c1de[_0x8ea2('0x7e')](','));};function signJwt(_0x491d3d){var _0x461d32=BPromise[_0x8ea2('0x7f')](jwt[_0x8ea2('0x80')],{'context':jwt});var _0x2e1104=_0x491d3d['secret']||config[_0x8ea2('0xc')]['session'];return new BPromise(function(_0x38d972,_0x57728a){_0x461d32(_0x491d3d[_0x8ea2('0x81')],_0x2e1104,_0x491d3d[_0x8ea2('0x82')])['then'](function(_0x549c71){_0x38d972(_0x549c71);})[_0x8ea2('0x48')](function(_0x4ebd43){_0x57728a(_0x4ebd43);});});}function verifyJwt(_0x197453,_0x31a56f,_0x1c5489){var _0x23185e=BPromise['promisify'](jwt[_0x8ea2('0x83')],{'context':jwt});var _0x2eae97=_0x1c5489||config[_0x8ea2('0xc')][_0x8ea2('0xd')];return new BPromise(function(_0xdde79,_0x212c16){_0x23185e(_0x197453,_0x2eae97,_0x31a56f)[_0x8ea2('0x43')](function(_0x3a78c9){_0xdde79(_0x3a78c9);})[_0x8ea2('0x48')](function(_0x461aa4){_0x212c16(_0x461aa4);});});}function generateNonce(){return crypto[_0x8ea2('0x84')](0x10)[_0x8ea2('0x85')]('hex');}function generateIssuedAt(){return Math[_0x8ea2('0x86')](Date[_0x8ea2('0x87')]()/0x3e8)[_0x8ea2('0x85')]();}function createJwt(_0x4346f3){var _0x456e16={'payload':{'iat':_0x4346f3[_0x8ea2('0x6e')],'nonce':_0x4346f3[_0x8ea2('0x59')]},'options':{'algorithm':_0x8ea2('0x88'),'subject':_0x4346f3['id'][_0x8ea2('0x85')](),'issuer':hardwareConf[_0x8ea2('0x53')](),'audience':hardwareConf[_0x8ea2('0x53')]()}};return signJwt(_0x456e16)[_0x8ea2('0x43')](function(_0x56b905){return{'iat':_0x4346f3[_0x8ea2('0x6e')],'nonce':_0x4346f3[_0x8ea2('0x59')],'token':_0x56b905};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 81f160f..5370d52 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 _0xac83=['getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','fields','where','filter','user','clause','tags','checkListsRestrictions','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','startsWith','cf_','map','CmCustomField','findOne','all','length','type','keys','./sql-utils','../../mysqldb','findAll','resolve'];(function(_0x1d701b,_0x267344){var _0x32f0fd=function(_0x302838){while(--_0x302838){_0x1d701b['push'](_0x1d701b['shift']());}};_0x32f0fd(++_0x267344);}(_0xac83,0x194));var _0x3ac8=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xac83[_0x412b2a];return _0x5872e3;};'use strict';var _=require('lodash');var sqlUtils=require(_0x3ac8('0x0'));var db=require(_0x3ac8('0x1'))['db'];exports[_0x3ac8('0x2')]=function(_0x131d43,_0x104739,_0x2276e9,_0x46b667){var _0x215355={'count':0x0,'rows':[]};var _0x2ea265=sqlUtils['skipContactsQuery'](_0x104739,_0x131d43);if(_0x2ea265){return Promise[_0x3ac8('0x3')](_0x215355);}var _0x40fc3f=sqlUtils[_0x3ac8('0x4')]();var _0x3d9dff={};var _0x1544a4=![];var _0x5ce171=![];return Promise[_0x3ac8('0x3')]()[_0x3ac8('0x5')](function(){if(_0x131d43[_0x3ac8('0x6')]){return sqlUtils[_0x3ac8('0x7')](_0x131d43[_0x3ac8('0x6')],_0x46b667);}else{return sqlUtils[_0x3ac8('0x8')](_0x131d43,_0x46b667);}})[_0x3ac8('0x5')](function(_0x2bf244){_0x40fc3f['where'](_0x2bf244[_0x3ac8('0x9')]);_0x40fc3f['where'](_0x2bf244[_0x3ac8('0xa')]);_0x40fc3f[_0x3ac8('0xb')](_0x2bf244[_0x3ac8('0xc')]);_0x40fc3f[_0x3ac8('0xb')](_0x2bf244[_0x3ac8('0xd')][_0x3ac8('0xe')]);_0x3d9dff=_0x2bf244[_0x3ac8('0xf')];_0x5ce171=_0x2bf244[_0x3ac8('0xd')]['skip'];return sqlUtils[_0x3ac8('0x10')](_0x104739,_0x131d43,_0x5ce171);})[_0x3ac8('0x5')](function(_0x55fd74){_0x40fc3f[_0x3ac8('0xb')](_0x55fd74);var _0x434e12=_0x131d43['search']?_0x3d9dff['ids']:_0x131d43[_0x3ac8('0x11')];_0x1544a4=_0x434e12?!![]:![];return sqlUtils[_0x3ac8('0x12')](_0x40fc3f,_0x434e12);})[_0x3ac8('0x5')](function(_0x5adda6){_0x215355[_0x3ac8('0x13')]=_0x5adda6;if(_0x215355[_0x3ac8('0x13')]===0x0){return;}if(_0x131d43['User']){_0x5ce171=!![];}return sqlUtils[_0x3ac8('0x14')](_0x40fc3f,_0x131d43['fields'],_0x2276e9,_0x1544a4,_0x3d9dff['clause'],_0x5ce171);})[_0x3ac8('0x5')](function(_0x224f65){if(!_0x224f65){return[];}return sqlUtils[_0x3ac8('0x15')](_0x224f65,_0x131d43,_0x2276e9);})[_0x3ac8('0x5')](function(_0x453a0d){_0x215355['rows']=_0x453a0d;return _0x215355;})[_0x3ac8('0x16')](function(_0xbd102){throw _0xbd102;});};exports[_0x3ac8('0x17')]=function(){var _0x47dc5e={};var _0x613eca=[];return db[_0x3ac8('0x18')]['describe']()[_0x3ac8('0x5')](function(_0x2491f7){_0x47dc5e=_0x2491f7;var _0x255c5b=Object['keys'](_0x47dc5e)['filter'](function(_0x51d300){return _[_0x3ac8('0x19')](_0x51d300,_0x3ac8('0x1a'))?_0x51d300:undefined;});var _0xbde636=_0x255c5b[_0x3ac8('0x1b')](function(_0x34f88a){return db[_0x3ac8('0x1c')][_0x3ac8('0x1d')]({'where':{'id':_0x34f88a['slice'](0x3)},'raw':!![]});});return Promise[_0x3ac8('0x1e')](_0xbde636);})[_0x3ac8('0x5')](function(_0xf9b10e){for(var _0x3b9ca3=0x0;_0x3b9ca3<_0xf9b10e[_0x3ac8('0x1f')];_0x3b9ca3++){if(_0xf9b10e[_0x3b9ca3]){var _0x4bc4e0=_0x3ac8('0x1a')+_0xf9b10e[_0x3b9ca3]['id'];_0x47dc5e[_0x4bc4e0]['fieldType']=_0xf9b10e[_0x3b9ca3][_0x3ac8('0x20')];}}_0x613eca=_[_0x3ac8('0x1b')](Object[_0x3ac8('0x21')](_0x47dc5e),function(_0x2caa75){return{'name':_0x2caa75,'type':_0x47dc5e[_0x2caa75]['type']};});return _0x613eca;})['catch'](function(_0x20db6b){throw _0x20db6b;});}; \ No newline at end of file +var _0x0696=['describe','keys','startsWith','map','CmCustomField','findOne','cf_','fieldType','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','clause','tags','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','fields','getFilteredContacts','CmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0696,0x13b));var _0x6069=function(_0xe7281f,_0x2d77c3){_0xe7281f=_0xe7281f-0x0;var _0x90dc99=_0x0696[_0xe7281f];return _0x90dc99;};'use strict';var _=require(_0x6069('0x0'));var sqlUtils=require(_0x6069('0x1'));var db=require(_0x6069('0x2'))['db'];exports[_0x6069('0x3')]=function(_0x793fe7,_0x200b23,_0x1137b2,_0x5148b2){var _0x3cc3af={'count':0x0,'rows':[]};var _0x44285d=sqlUtils[_0x6069('0x4')](_0x200b23,_0x793fe7);if(_0x44285d){return Promise[_0x6069('0x5')](_0x3cc3af);}var _0x2ea2b7=sqlUtils[_0x6069('0x6')]();var _0x300b9e={};var _0x36ec15=![];var _0x27232a=![];return Promise['resolve']()[_0x6069('0x7')](function(){if(_0x793fe7[_0x6069('0x8')]){return sqlUtils[_0x6069('0x9')](_0x793fe7['search'],_0x5148b2);}else{return sqlUtils[_0x6069('0xa')](_0x793fe7,_0x5148b2);}})[_0x6069('0x7')](function(_0x5c1be8){_0x2ea2b7['where'](_0x5c1be8[_0x6069('0xb')]);_0x2ea2b7[_0x6069('0xc')](_0x5c1be8['fields']);_0x2ea2b7[_0x6069('0xc')](_0x5c1be8[_0x6069('0xd')]);_0x2ea2b7[_0x6069('0xc')](_0x5c1be8['user'][_0x6069('0xe')]);_0x300b9e=_0x5c1be8[_0x6069('0xf')];_0x27232a=_0x5c1be8['user']['skip'];return sqlUtils[_0x6069('0x10')](_0x200b23,_0x793fe7,_0x27232a);})['then'](function(_0x10b2f0){_0x2ea2b7['where'](_0x10b2f0);var _0x2fb420=_0x793fe7['search']?_0x300b9e[_0x6069('0x11')]:_0x793fe7[_0x6069('0x12')];_0x36ec15=_0x2fb420?!![]:![];return sqlUtils['countFilteredContacts'](_0x2ea2b7,_0x2fb420);})[_0x6069('0x7')](function(_0x303078){_0x3cc3af[_0x6069('0x13')]=_0x303078;if(_0x3cc3af[_0x6069('0x13')]===0x0){return;}if(_0x793fe7[_0x6069('0x14')]){_0x27232a=!![];}return sqlUtils[_0x6069('0x15')](_0x2ea2b7,_0x793fe7[_0x6069('0x16')],_0x1137b2,_0x36ec15,_0x300b9e[_0x6069('0xe')],_0x27232a);})[_0x6069('0x7')](function(_0xdaa0c){if(!_0xdaa0c){return[];}return sqlUtils[_0x6069('0x17')](_0xdaa0c,_0x793fe7,_0x1137b2);})['then'](function(_0x5e6a11){_0x3cc3af['rows']=_0x5e6a11;return _0x3cc3af;})['catch'](function(_0x16b34a){throw _0x16b34a;});};exports['describe']=function(){var _0x1a0bd5={};var _0x3667ae=[];return db[_0x6069('0x18')][_0x6069('0x19')]()['then'](function(_0x3b5b20){_0x1a0bd5=_0x3b5b20;var _0x4cb056=Object[_0x6069('0x1a')](_0x1a0bd5)[_0x6069('0xd')](function(_0x1f0827){return _[_0x6069('0x1b')](_0x1f0827,'cf_')?_0x1f0827:undefined;});var _0x2963f0=_0x4cb056[_0x6069('0x1c')](function(_0x254ed7){return db[_0x6069('0x1d')][_0x6069('0x1e')]({'where':{'id':_0x254ed7['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x2963f0);})[_0x6069('0x7')](function(_0x148e13){for(var _0x405ece=0x0;_0x405ece<_0x148e13['length'];_0x405ece++){if(_0x148e13[_0x405ece]){var _0x4688ea=_0x6069('0x1f')+_0x148e13[_0x405ece]['id'];_0x1a0bd5[_0x4688ea][_0x6069('0x20')]=_0x148e13[_0x405ece]['type'];}}_0x3667ae=_[_0x6069('0x1c')](Object['keys'](_0x1a0bd5),function(_0x5b618b){return{'name':_0x5b618b,'type':_0x1a0bd5[_0x5b618b]['type']};});return _0x3667ae;})[_0x6069('0x21')](function(_0x508d3a){throw _0x508d3a;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 457f537..cd3eb96 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 _0x6f03=['uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','order','DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','toString','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','query','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','true','select','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','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?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','sqlOperator','conditions','find','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','user','skip','keys','some','name','Contact','push','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6f03,0x1c9));var _0x36f0=function(_0x3ca509,_0x2147fd){_0x3ca509=_0x3ca509-0x0;var _0xe3defe=_0x6f03[_0x3ca509];return _0xe3defe;};'use strict';var _=require('lodash');var squel=require(_0x36f0('0x0'));var as=require(_0x36f0('0x1'));var qs=require(_0x36f0('0x2'));var utils=require(_0x36f0('0x3'));var db=require(_0x36f0('0x4'))['db'];function skipContactsQuery(_0x567451,_0x5757b2){var _0x1af42f=![];if(_0x567451['role']===_0x36f0('0x5')&&!_0x5757b2[_0x36f0('0x6')]&&!_0x5757b2['ListId']&&_0x5757b2['autocomplete']!==_0x36f0('0x7')){_0x1af42f=!![];}return _0x1af42f;}function getContactsSubquery(){return squel[_0x36f0('0x8')]()['from']('cm_contacts','c')[_0x36f0('0x9')](_0x36f0('0xa'));}function applyJoinClauses(_0x3672b2,_0x4e8577){var _0x1b9cb4=_0x4e8577?'c':_0x36f0('0xb');_0x3672b2[_0x36f0('0xc')](_0x36f0('0xd'),'uc',_0x36f0('0xe')+_0x1b9cb4+_0x36f0('0xf'))[_0x36f0('0xc')]('cm_contact_has_tags','ct',_0x36f0('0x10')+_0x1b9cb4+_0x36f0('0xf'))[_0x36f0('0xc')](_0x36f0('0x11'),'t',_0x36f0('0x12'));return _0x3672b2;}function addFieldsToQuery(_0x49327d,_0x1903cc,_0x2d14ba,_0x4caf13,_0x112267){var _0x150e3d=_0x112267?'c':_0x36f0('0xb');if(!_0x1903cc){_0x1903cc=['id','firstName',_0x36f0('0x13'),_0x36f0('0x14'),_0x36f0('0x15'),'fax','email',_0x36f0('0x16'),_0x36f0('0x17'),_0x36f0('0x18'),'updatedAt',_0x36f0('0x19'),_0x36f0('0x1a')];}else if(!_0x1903cc[_0x36f0('0x1b')]('id')){_0x1903cc['push']('id');}var _0x5cd24c=_0x2d14ba&&_0x112267||!_0x2d14ba&&!_0x112267;if(_0x4caf13){_0x5cd24c=_0x4caf13&&_0x112267||!_0x4caf13&&!_0x112267;}_0x1903cc[_0x36f0('0x1c')](function(_0x17d6f7){if(_0x17d6f7===_0x36f0('0x1a')){if(_0x5cd24c){_0x49327d[_0x36f0('0x1d')](_0x36f0('0x1e'),_0x17d6f7);}else if(_0x2d14ba||_0x4caf13){_0x49327d[_0x36f0('0x1d')](_0x150e3d+'.'+_0x17d6f7);}}else{_0x49327d[_0x36f0('0x1d')](_0x150e3d+'.'+_0x17d6f7);}});return _0x49327d;}function getSqlClauses(){var _0x792ba={'default':squel[_0x36f0('0x1f')](),'fields':squel[_0x36f0('0x1f')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x36f0('0x1f')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x792ba;}function parseTagParameter(_0x29c6c8){var _0x27db52=squel[_0x36f0('0x1f')]();if(_0x29c6c8){var _0x419952=utils['getSelectedTags'](_0x29c6c8);_0x419952['forEach'](function(_0x2aa640){_0x27db52['or'](_0x36f0('0x20'),'%,'+_0x2aa640+',%');});}return _0x27db52;}function parseSearchFilter(_0x167d1e){var _0x4ace05=squel['expr']();if(_0x167d1e){var _0x47a25e=_0x167d1e[_0x36f0('0x21')]('\x5c','\x5c\x5c')[_0x36f0('0x21')](/'/g,'\x27\x27');if(_0x47a25e[_0x36f0('0x22')]('\x20')[_0x36f0('0x23')]>0x1){_0x4ace05['or'](_0x36f0('0x24'),qs[_0x36f0('0x25')](_0x47a25e,!![]),null);}else{if(qs['isNumeric'](_0x47a25e)){_0x4ace05['or'](_0x36f0('0x26'),_0x47a25e+'%');_0x4ace05['or'](_0x36f0('0x27'),_0x47a25e+'%');_0x4ace05['or'](_0x36f0('0x28'),_0x47a25e+'%');_0x4ace05['or']('c.fax\x20LIKE\x20?',_0x47a25e+'%');}else if(qs[_0x36f0('0x29')](_0x47a25e)){_0x4ace05['or']('c.email\x20LIKE\x20?',_0x47a25e+'%');}else{_0x4ace05['or'](_0x36f0('0x2a'),'%'+_0x47a25e+'%');_0x4ace05['or'](_0x36f0('0x2b'),'%'+_0x47a25e+'%');_0x4ace05['or'](_0x36f0('0x2c'),'%'+_0x47a25e+'%');}}}return _0x4ace05;}function parseAdvancedSearchFilter(_0x58cf1a,_0x53edf6){var _0x23b193=getSqlClauses();var _0x23af97=as['parseSearch'](_0x58cf1a);var _0xec0468=_0x23af97[_0x36f0('0x2d')];for(var _0x3305f0=0x0;_0x3305f0<_0x23af97[_0x36f0('0x2e')][_0x36f0('0x23')];_0x3305f0++){var _0x1fe913=_0x23af97[_0x36f0('0x2e')][_0x3305f0];var _0x5f13c5='c';var _0x457b82=_[_0x36f0('0x2f')](_0x53edf6,['name',_0x1fe913[_0x36f0('0x1d')]]);if(_0x457b82){if(_0x1fe913[_0x36f0('0x1d')]==='dateOfBirth'||_0x457b82[_0x36f0('0x30')]===_0x36f0('0x31')){_0x1fe913[_0x36f0('0x32')]='DATE';}var _0x4daf5a=as[_0x36f0('0x33')](_0x5f13c5,_0x457b82[_0x36f0('0x34')],_0x1fe913);_0x23b193[_0x36f0('0x35')][_0xec0468](_0x4daf5a[_0x36f0('0x36')],_0x4daf5a[_0x36f0('0x37')][_0x36f0('0x38')],_0x4daf5a[_0x36f0('0x37')][_0x36f0('0x39')]);}else{if(_0x1fe913[_0x36f0('0x1d')]===_0x36f0('0x3a')){var _0x25177d=_0x1fe913[_0x36f0('0x37')][_0x36f0('0x22')](',')[_0x36f0('0x3b')](function(_0x1f7282){return Number(_0x1f7282);});var _0x9dc673=parseTagParameter(_0x25177d);_0x23b193[_0x36f0('0x3c')][_0x36f0('0x3d')][_0x36f0('0x3e')](_0x9dc673);_0x23b193[_0x36f0('0x3c')][_0x36f0('0x3f')]=_0x25177d;}else if(_0x1fe913[_0x36f0('0x1d')]==='User'){_0x23b193[_0x36f0('0x40')]['clause'][_0x36f0('0x3e')]('uc.UserId\x20=\x20?',_0x1fe913[_0x36f0('0x37')]);_0x23b193[_0x36f0('0x40')][_0x36f0('0x41')]=!![];}}}return _0x23b193;}function parseModelFields(_0x530139,_0x5a464b){var _0x3fb690=squel[_0x36f0('0x1f')]();var _0x295f48=_(_0x530139)[_0x36f0('0x42')]()['map'](function(_0x5a0de5){return _[_0x36f0('0x43')](_0x5a464b,[_0x36f0('0x44'),_0x5a0de5])?_0x5a0de5:undefined;})['compact']()['value']();if(_0x530139[_0x36f0('0x45')]){_0x295f48[_0x36f0('0x46')](_0x36f0('0x45'));}if(_0x530139['User']){_0x295f48[_0x36f0('0x46')]('User');}if(_0x295f48[_0x36f0('0x23')]>0x0){_0x295f48['forEach'](function(_0x1a6db9){if(_0x1a6db9===_0x36f0('0x16')){_0x3fb690[_0x36f0('0x3e')](_0x36f0('0x47'),[]['concat'](_0x530139[_0x1a6db9]));}else if(_0x1a6db9===_0x36f0('0x45')){var _0x204d41='%'+_0x530139[_0x1a6db9]+'%';_0x3fb690['and'](_0x36f0('0x48'),_0x204d41);}else if(_0x1a6db9==='User'){_0x3fb690[_0x36f0('0x3e')](_0x36f0('0x49'),_0x530139[_0x1a6db9]);}else{_0x3fb690[_0x36f0('0x3e')]('c.'+_0x1a6db9+_0x36f0('0x4a'),_0x530139[_0x1a6db9]);}});}return _0x3fb690;}function parseQueryParameters(_0x10cc32,_0x2a8266){var _0x212ac8=getSqlClauses();return Promise[_0x36f0('0x4b')]()[_0x36f0('0x4c')](function(){return parseModelFields(_0x10cc32,_0x2a8266);})['then'](function(_0x15747e){_0x212ac8['fields'][_0x36f0('0x3e')](_0x15747e);return parseTagParameter(_0x10cc32[_0x36f0('0x4d')]);})['then'](function(_0x10be2c){_0x212ac8[_0x36f0('0x3c')][_0x36f0('0x3d')]['and'](_0x10be2c);return parseSearchFilter(_0x10cc32[_0x36f0('0x4e')]);})[_0x36f0('0x4c')](function(_0x2dfadf){_0x212ac8[_0x36f0('0x4e')]=_0x2dfadf;return _0x212ac8;});}function checkListsRestrictions(_0x402052,_0x592918,_0x3cfbcb){var _0x3bdcb8=squel[_0x36f0('0x1f')]();return Promise['resolve']()[_0x36f0('0x4c')](function(){if(_0x592918[_0x36f0('0x6')]&&_0x402052[_0x36f0('0x4f')]===_0x36f0('0x5')&&!_0x3cfbcb){return _0x402052[_0x36f0('0x50')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3e2a80){if(_0x3e2a80){if(_0x3e2a80[_0x36f0('0x23')]===0x0){_0x3bdcb8['and'](_0x36f0('0x51'));}else{_0x3bdcb8[_0x36f0('0x3e')](_0x36f0('0x47'),_[_0x36f0('0x3b')](_0x3e2a80,'id'));}}})[_0x36f0('0x4c')](function(){return _0x3bdcb8;});}function buildContactsQuery(_0x27f2c8,_0x319466,_0x3ad3e9,_0x5a19b4,_0x58c52e,_0x4b634c){if(_0x319466){_0x319466=_0x3ad3e9[_0x36f0('0x52')];}_0x27f2c8=addFieldsToQuery(_0x27f2c8,_0x319466,_0x5a19b4,_0x4b634c,!![]);var _0x470799=squel[_0x36f0('0x8')]();_0x470799=addFieldsToQuery(_0x470799,_0x319466,_0x5a19b4,_0x4b634c,![]);if(_0x5a19b4||_0x4b634c){_0x27f2c8=applyJoinClauses(_0x27f2c8,!![]);_0x27f2c8['group'](_0x36f0('0x53'));if(_0x3ad3e9['limit']){_0x470799['limit'](_0x3ad3e9[_0x36f0('0x54')]);}if(_0x3ad3e9[_0x36f0('0x55')]){_0x470799['offset'](_0x3ad3e9['offset']);}}else{_0x470799=applyJoinClauses(_0x470799,![]);_0x470799[_0x36f0('0x56')](_0x36f0('0x57'));if(_0x3ad3e9[_0x36f0('0x54')]){_0x27f2c8[_0x36f0('0x54')](_0x3ad3e9[_0x36f0('0x54')]);}if(_0x3ad3e9['offset']){_0x27f2c8[_0x36f0('0x55')](_0x3ad3e9[_0x36f0('0x55')]);}}_0x470799['having'](_0x58c52e);if(_0x3ad3e9[_0x36f0('0x58')]){_0x3ad3e9[_0x36f0('0x58')][_0x36f0('0x1c')](function(_0xb91fc1){_0x27f2c8[_0x36f0('0x58')]('c.'+_0xb91fc1[0x0],_0xb91fc1[0x1]===_0x36f0('0x59')?![]:!![]);_0x470799[_0x36f0('0x58')](_0x36f0('0x5a')+_0xb91fc1[0x0],_0xb91fc1[0x1]==='DESC'?![]:!![]);});}_0x470799[_0x36f0('0x5b')](_0x27f2c8,_0x36f0('0xb'));return _0x470799;}function getFilteredContacts(_0xa8c636){var _0x6b8e0f=[];return db[_0x36f0('0x3a')]['findAll']({'attributes':['id','name',_0x36f0('0x5c')],'raw':!![]})[_0x36f0('0x4c')](function(_0x25cf02){_0x6b8e0f=_[_0x36f0('0x5d')](_0x25cf02,'id');var _0x4260c2={'type':db[_0x36f0('0x5e')][_0x36f0('0x5f')][_0x36f0('0x60')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x36f0('0x61')]['query'](_0xa8c636[_0x36f0('0x62')](),_0x4260c2);})[_0x36f0('0x4c')](function(_0x3ba731){_0x3ba731['forEach'](function(_0x19f68b){if(_0x19f68b['TagIds']){_0x19f68b[_0x36f0('0x63')]=[];_0x19f68b[_0x36f0('0x1a')]['split'](',')[_0x36f0('0x1c')](function(_0x1a22a){_0x19f68b['Tags'][_0x36f0('0x46')](_0x6b8e0f[_0x1a22a]);});}delete _0x19f68b['TagIds'];});return _0x3ba731;});}function countFilteredContacts(_0x1941ee,_0x384f48){var _0x472892=_0x1941ee[_0x36f0('0x64')]();_0x472892[_0x36f0('0x1d')](_0x36f0('0x65'));_0x472892=applyJoinClauses(_0x472892,!![]);_0x1941ee['group'](_0x36f0('0x53'));var _0x509578=utils[_0x36f0('0x66')](_0x384f48);if(!_[_0x36f0('0x67')](_0x509578)){_0x472892[_0x36f0('0x9')]('t.id\x20IN\x20?',_0x509578);}var _0x4f076c={'type':db[_0x36f0('0x5e')][_0x36f0('0x5f')][_0x36f0('0x60')],'raw':!![]};return db[_0x36f0('0x61')][_0x36f0('0x68')](_0x472892[_0x36f0('0x62')](),_0x4f076c)['then'](function(_0x488fe1){return _0x488fe1[0x0]['COUNT(*)'];});}module[_0x36f0('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe7ce=['find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','value','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','compact','Contact','concat','\x20=\x20?','then','filter','resolve','search','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','limit','offset','group','subqry.id','having','order','DESC','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xe7ce,0x1eb));var _0xee7c=function(_0x17a320,_0x25f610){_0x17a320=_0x17a320-0x0;var _0x1177de=_0xe7ce[_0x17a320];return _0x1177de;};'use strict';var _=require(_0xee7c('0x0'));var squel=require(_0xee7c('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xee7c('0x2'));var utils=require(_0xee7c('0x3'));var db=require(_0xee7c('0x4'))['db'];function skipContactsQuery(_0x2e39c8,_0x35fa8c){var _0x205678=![];if(_0x2e39c8[_0xee7c('0x5')]===_0xee7c('0x6')&&!_0x35fa8c['search']&&!_0x35fa8c[_0xee7c('0x7')]&&_0x35fa8c[_0xee7c('0x8')]!==_0xee7c('0x9')){_0x205678=!![];}return _0x205678;}function getContactsSubquery(){return squel[_0xee7c('0xa')]()[_0xee7c('0xb')](_0xee7c('0xc'),'c')[_0xee7c('0xd')](_0xee7c('0xe'));}function applyJoinClauses(_0x584ade,_0x54d183){var _0x170a26=_0x54d183?'c':_0xee7c('0xf');_0x584ade[_0xee7c('0x10')](_0xee7c('0x11'),'uc',_0xee7c('0x12')+_0x170a26+_0xee7c('0x13'))['left_join'](_0xee7c('0x14'),'ct',_0xee7c('0x15')+_0x170a26+'.id')[_0xee7c('0x10')](_0xee7c('0x16'),'t',_0xee7c('0x17'));return _0x584ade;}function addFieldsToQuery(_0x14e4e4,_0x114749,_0x5b91cb,_0x340384,_0x68fb3d){var _0x41aa99=_0x68fb3d?'c':'subqry';if(!_0x114749){_0x114749=['id',_0xee7c('0x18'),_0xee7c('0x19'),_0xee7c('0x1a'),_0xee7c('0x1b'),_0xee7c('0x1c'),'email',_0xee7c('0x7'),'CompanyId',_0xee7c('0x1d'),_0xee7c('0x1e'),_0xee7c('0x1f'),_0xee7c('0x20')];}else if(!_0x114749[_0xee7c('0x21')]('id')){_0x114749[_0xee7c('0x22')]('id');}var _0x52adb2=_0x5b91cb&&_0x68fb3d||!_0x5b91cb&&!_0x68fb3d;if(_0x340384){_0x52adb2=_0x340384&&_0x68fb3d||!_0x340384&&!_0x68fb3d;}_0x114749[_0xee7c('0x23')](function(_0x10f94d){if(_0x10f94d===_0xee7c('0x20')){if(_0x52adb2){_0x14e4e4['field'](_0xee7c('0x24'),_0x10f94d);}else if(_0x5b91cb||_0x340384){_0x14e4e4[_0xee7c('0x25')](_0x41aa99+'.'+_0x10f94d);}}else{_0x14e4e4[_0xee7c('0x25')](_0x41aa99+'.'+_0x10f94d);}});return _0x14e4e4;}function getSqlClauses(){var _0xfafa1d={'default':squel[_0xee7c('0x26')](),'fields':squel[_0xee7c('0x26')](),'filter':squel[_0xee7c('0x26')](),'tags':{'clause':squel[_0xee7c('0x26')](),'ids':null},'user':{'clause':squel[_0xee7c('0x26')](),'skip':![]}};return _0xfafa1d;}function parseTagParameter(_0x5b083f){var _0x521f86=squel[_0xee7c('0x26')]();if(_0x5b083f){var _0x1d78f0=utils['getSelectedTags'](_0x5b083f);_0x1d78f0['forEach'](function(_0x58ce6b){_0x521f86['or'](_0xee7c('0x27'),'%,'+_0x58ce6b+',%');});}return _0x521f86;}function parseSearchFilter(_0xb532b3){var _0x4e7bca=squel[_0xee7c('0x26')]();if(_0xb532b3){var _0x449ab7=_0xb532b3[_0xee7c('0x28')]('\x5c','\x5c\x5c')[_0xee7c('0x28')](/'/g,'\x27\x27');if(_0x449ab7[_0xee7c('0x29')]('\x20')[_0xee7c('0x2a')]>0x1){_0x4e7bca['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee7c('0x2b')](_0x449ab7,!![]),null);}else{if(qs['isNumeric'](_0x449ab7)){_0x4e7bca['or'](_0xee7c('0x2c'),_0x449ab7+'%');_0x4e7bca['or'](_0xee7c('0x2d'),_0x449ab7+'%');_0x4e7bca['or'](_0xee7c('0x2e'),_0x449ab7+'%');_0x4e7bca['or'](_0xee7c('0x2f'),_0x449ab7+'%');}else if(qs[_0xee7c('0x30')](_0x449ab7)){_0x4e7bca['or']('c.email\x20LIKE\x20?',_0x449ab7+'%');}else{_0x4e7bca['or'](_0xee7c('0x31'),'%'+_0x449ab7+'%');_0x4e7bca['or']('c.lastName\x20LIKE\x20?','%'+_0x449ab7+'%');_0x4e7bca['or'](_0xee7c('0x32'),'%'+_0x449ab7+'%');}}}return _0x4e7bca;}function parseAdvancedSearchFilter(_0xe7a968,_0x314bd4){var _0x150e32=getSqlClauses();var _0x7055d9=as[_0xee7c('0x33')](_0xe7a968);var _0x115095=_0x7055d9[_0xee7c('0x34')];for(var _0x2211e7=0x0;_0x2211e7<_0x7055d9[_0xee7c('0x35')][_0xee7c('0x2a')];_0x2211e7++){var _0x3c8c13=_0x7055d9[_0xee7c('0x35')][_0x2211e7];var _0x565aeb='c';var _0x5680f0=_[_0xee7c('0x36')](_0x314bd4,[_0xee7c('0x37'),_0x3c8c13['field']]);if(_0x5680f0){if(_0x3c8c13['field']===_0xee7c('0x38')||_0x5680f0['fieldType']===_0xee7c('0x39')){_0x3c8c13[_0xee7c('0x3a')]=_0xee7c('0x3b');}var _0x13b477=as[_0xee7c('0x3c')](_0x565aeb,_0x5680f0[_0xee7c('0x3d')],_0x3c8c13);_0x150e32[_0xee7c('0x3e')][_0x115095](_0x13b477[_0xee7c('0x3f')],_0x13b477['value']['start'],_0x13b477[_0xee7c('0x40')][_0xee7c('0x41')]);}else{if(_0x3c8c13[_0xee7c('0x25')]===_0xee7c('0x42')){var _0x4a4195=_0x3c8c13['value']['split'](',')[_0xee7c('0x43')](function(_0xe4aac5){return Number(_0xe4aac5);});var _0x2b26a2=parseTagParameter(_0x4a4195);_0x150e32[_0xee7c('0x44')][_0xee7c('0x45')][_0xee7c('0x46')](_0x2b26a2);_0x150e32['tags'][_0xee7c('0x47')]=_0x4a4195;}else if(_0x3c8c13[_0xee7c('0x25')]===_0xee7c('0x48')){_0x150e32[_0xee7c('0x49')][_0xee7c('0x45')]['and'](_0xee7c('0x4a'),_0x3c8c13['value']);_0x150e32[_0xee7c('0x49')][_0xee7c('0x4b')]=!![];}}}return _0x150e32;}function parseModelFields(_0x2c71a1,_0x786ede){var _0x51e234=squel[_0xee7c('0x26')]();var _0x5b82aa=_(_0x2c71a1)[_0xee7c('0x4c')]()[_0xee7c('0x43')](function(_0x29393b){return _['some'](_0x786ede,[_0xee7c('0x37'),_0x29393b])?_0x29393b:undefined;})[_0xee7c('0x4d')]()[_0xee7c('0x40')]();if(_0x2c71a1[_0xee7c('0x4e')]){_0x5b82aa[_0xee7c('0x22')](_0xee7c('0x4e'));}if(_0x2c71a1['User']){_0x5b82aa[_0xee7c('0x22')](_0xee7c('0x48'));}if(_0x5b82aa[_0xee7c('0x2a')]>0x0){_0x5b82aa['forEach'](function(_0x135c46){if(_0x135c46===_0xee7c('0x7')){_0x51e234[_0xee7c('0x46')]('c.ListId\x20IN\x20?',[][_0xee7c('0x4f')](_0x2c71a1[_0x135c46]));}else if(_0x135c46===_0xee7c('0x4e')){var _0x2d6d48='%'+_0x2c71a1[_0x135c46]+'%';_0x51e234['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x2d6d48);}else if(_0x135c46===_0xee7c('0x48')){_0x51e234[_0xee7c('0x46')](_0xee7c('0x4a'),_0x2c71a1[_0x135c46]);}else{_0x51e234['and']('c.'+_0x135c46+_0xee7c('0x50'),_0x2c71a1[_0x135c46]);}});}return _0x51e234;}function parseQueryParameters(_0x2655d9,_0x51ef2b){var _0x56cfc0=getSqlClauses();return Promise['resolve']()[_0xee7c('0x51')](function(){return parseModelFields(_0x2655d9,_0x51ef2b);})['then'](function(_0x3362f4){_0x56cfc0['fields'][_0xee7c('0x46')](_0x3362f4);return parseTagParameter(_0x2655d9['tag']);})[_0xee7c('0x51')](function(_0x5e195b){_0x56cfc0[_0xee7c('0x44')][_0xee7c('0x45')]['and'](_0x5e195b);return parseSearchFilter(_0x2655d9[_0xee7c('0x52')]);})[_0xee7c('0x51')](function(_0x19387e){_0x56cfc0[_0xee7c('0x52')]=_0x19387e;return _0x56cfc0;});}function checkListsRestrictions(_0x225a91,_0x3c2a8b,_0x1627d6){var _0x590563=squel['expr']();return Promise[_0xee7c('0x53')]()['then'](function(){if(_0x3c2a8b[_0xee7c('0x54')]&&_0x225a91[_0xee7c('0x5')]==='agent'&&!_0x1627d6){return _0x225a91[_0xee7c('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xee7c('0x51')](function(_0x2dbb94){if(_0x2dbb94){if(_0x2dbb94['length']===0x0){_0x590563[_0xee7c('0x46')](_0xee7c('0x56'));}else{_0x590563[_0xee7c('0x46')](_0xee7c('0x57'),_[_0xee7c('0x43')](_0x2dbb94,'id'));}}})[_0xee7c('0x51')](function(){return _0x590563;});}function buildContactsQuery(_0x4f5f4e,_0x56ca1a,_0x5cab43,_0x53d0ec,_0xd15efb,_0x1f9d77){if(_0x56ca1a){_0x56ca1a=_0x5cab43[_0xee7c('0x58')];}_0x4f5f4e=addFieldsToQuery(_0x4f5f4e,_0x56ca1a,_0x53d0ec,_0x1f9d77,!![]);var _0x4235af=squel['select']();_0x4235af=addFieldsToQuery(_0x4235af,_0x56ca1a,_0x53d0ec,_0x1f9d77,![]);if(_0x53d0ec||_0x1f9d77){_0x4f5f4e=applyJoinClauses(_0x4f5f4e,!![]);_0x4f5f4e['group']('c.id');if(_0x5cab43[_0xee7c('0x59')]){_0x4235af[_0xee7c('0x59')](_0x5cab43[_0xee7c('0x59')]);}if(_0x5cab43[_0xee7c('0x5a')]){_0x4235af[_0xee7c('0x5a')](_0x5cab43[_0xee7c('0x5a')]);}}else{_0x4235af=applyJoinClauses(_0x4235af,![]);_0x4235af[_0xee7c('0x5b')](_0xee7c('0x5c'));if(_0x5cab43[_0xee7c('0x59')]){_0x4f5f4e['limit'](_0x5cab43['limit']);}if(_0x5cab43[_0xee7c('0x5a')]){_0x4f5f4e[_0xee7c('0x5a')](_0x5cab43[_0xee7c('0x5a')]);}}_0x4235af[_0xee7c('0x5d')](_0xd15efb);if(_0x5cab43[_0xee7c('0x5e')]){_0x5cab43[_0xee7c('0x5e')][_0xee7c('0x23')](function(_0xa66922){_0x4f5f4e[_0xee7c('0x5e')]('c.'+_0xa66922[0x0],_0xa66922[0x1]==='DESC'?![]:!![]);_0x4235af[_0xee7c('0x5e')]('subqry.'+_0xa66922[0x0],_0xa66922[0x1]===_0xee7c('0x5f')?![]:!![]);});}_0x4235af[_0xee7c('0xb')](_0x4f5f4e,'subqry');return _0x4235af;}function getFilteredContacts(_0xeb49b5){var _0x55ac72=[];return db[_0xee7c('0x42')]['findAll']({'attributes':['id',_0xee7c('0x37'),_0xee7c('0x60')],'raw':!![]})[_0xee7c('0x51')](function(_0x5cd7a2){_0x55ac72=_[_0xee7c('0x61')](_0x5cd7a2,'id');var _0x58a10e={'type':db[_0xee7c('0x62')][_0xee7c('0x63')]['SELECT'],'model':db[_0xee7c('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xee7c('0x65')][_0xee7c('0x66')](_0xeb49b5[_0xee7c('0x67')](),_0x58a10e);})[_0xee7c('0x51')](function(_0x3e5523){_0x3e5523['forEach'](function(_0x46d165){if(_0x46d165['TagIds']){_0x46d165[_0xee7c('0x68')]=[];_0x46d165['TagIds']['split'](',')['forEach'](function(_0x43c397){_0x46d165[_0xee7c('0x68')]['push'](_0x55ac72[_0x43c397]);});}delete _0x46d165[_0xee7c('0x20')];});return _0x3e5523;});}function countFilteredContacts(_0x496ade,_0x355a66){var _0x322f21=_0x496ade[_0xee7c('0x69')]();_0x322f21[_0xee7c('0x25')](_0xee7c('0x6a'));_0x322f21=applyJoinClauses(_0x322f21,!![]);_0x496ade[_0xee7c('0x5b')]('c.id');var _0x322767=utils['getSelectedTags'](_0x355a66);if(!_[_0xee7c('0x6b')](_0x322767)){_0x322f21[_0xee7c('0xd')]('t.id\x20IN\x20?',_0x322767);}var _0x4bd20e={'type':db[_0xee7c('0x62')][_0xee7c('0x63')]['SELECT'],'raw':!![]};return db[_0xee7c('0x65')][_0xee7c('0x66')](_0x322f21['toString'](),_0x4bd20e)['then'](function(_0x159100){return _0x159100[0x0][_0xee7c('0x6a')];});}module[_0xee7c('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 65cd555..46640c8 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 _0x6cf1=['secret','utf8','base64','crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','createDecipher','final','unlink','encryptString'];(function(_0x52ed34,_0xea2f1a){var _0x379be8=function(_0x10249c){while(--_0x10249c){_0x52ed34['push'](_0x52ed34['shift']());}};_0x379be8(++_0xea2f1a);}(_0x6cf1,0x11b));var _0x16cf=function(_0x56d0b4,_0x206b02){_0x56d0b4=_0x56d0b4-0x0;var _0x509de8=_0x6cf1[_0x56d0b4];return _0x509de8;};'use strict';var crypto=require(_0x16cf('0x0'));var fs=require('fs');var BPromise=require(_0x16cf('0x1'));var _=require('lodash');var config=require(_0x16cf('0x2'));var logger=require('../../config/logger')(_0x16cf('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x16cf('0x4')][_0x16cf('0x5')],'algorithm':_0x16cf('0x6')};const fileOptions={'algorithm':_0x16cf('0x7')};if(config['encrypt']&&config[_0x16cf('0x8')][_0x16cf('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x16cf('0x9')]);if(isSupported){fileOptions[_0x16cf('0x9')]=config[_0x16cf('0x8')][_0x16cf('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x16cf('0xa')](',\x20');logger[_0x16cf('0xb')](config[_0x16cf('0x8')][_0x16cf('0x9')],_0x16cf('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x25c70e){return AES_SUPPORTED_RX[_0x16cf('0xd')](_0x25c70e);}function getSupportedCiphers(){return crypto[_0x16cf('0xe')]()[_0x16cf('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x5bea1b){return getSupportedCiphers()[_0x16cf('0x10')](_0x5bea1b)>-0x1;}function combineOptions(_0x299ea9){var _0x2d6083={};for(var _0x3873df in fileOptions){if(fileOptions[_0x16cf('0x11')](_0x3873df)){_0x2d6083[_0x3873df]=fileOptions[_0x3873df];}}if(_0x299ea9){for(var _0xe8bf2a in _0x299ea9){if(_0x299ea9[_0x16cf('0x11')](_0xe8bf2a)){_0x2d6083[_0xe8bf2a]=_0x299ea9[_0xe8bf2a];}}}return _0x2d6083;}exports[_0x16cf('0x12')]=function(_0x70fb96,_0xc480f6,_0x3180b9,_0x45b827){return new BPromise(function(_0x144dd5,_0x3c0117){_0x45b827=combineOptions(_0x45b827);var _0x3909b4=new Buffer(_0x3180b9);var _0x2aac64=fs[_0x16cf('0x13')](_0x70fb96);var _0x3a93e4=fs[_0x16cf('0x14')](_0xc480f6);var _0x256dd2=crypto[_0x16cf('0x15')](_0x45b827[_0x16cf('0x9')],_0x3909b4);_0x2aac64['on'](_0x16cf('0x16'),function(_0x36e5bc){var _0x5b3166=new Buffer(_0x256dd2[_0x16cf('0x17')](_0x36e5bc),_0x16cf('0x18'));_0x3a93e4[_0x16cf('0x19')](_0x5b3166);});_0x2aac64['on']('end',function(){try{var _0x2a6831=new Buffer(_0x256dd2['final'](_0x16cf('0x18')),_0x16cf('0x18'));_0x3a93e4['write'](_0x2a6831);_0x3a93e4[_0x16cf('0x1a')]();_0x3a93e4['on'](_0x16cf('0x1b'),function(){return _0x144dd5(_0xc480f6);});}catch(_0x4d572c){fs['unlink'](_0xc480f6);return _0x3c0117(_0x4d572c);}});});};exports['decryptFile']=function(_0x532899,_0x2cfc9f,_0x5cf47a,_0x43ef83){return new BPromise(function(_0x2cd4f4,_0x10f6ef){_0x43ef83=combineOptions(_0x43ef83);var _0x160abe=new Buffer(_0x5cf47a);var _0x1635e1=fs['createReadStream'](_0x532899);var _0x475f5c=fs['createWriteStream'](_0x2cfc9f);var _0x327f4b=crypto[_0x16cf('0x1c')](_0x43ef83[_0x16cf('0x9')],_0x160abe);_0x1635e1['on']('data',function(_0x46a785){var _0x41e883=new Buffer(_0x327f4b[_0x16cf('0x17')](_0x46a785),_0x16cf('0x18'));_0x475f5c[_0x16cf('0x19')](_0x41e883);});_0x1635e1['on'](_0x16cf('0x1a'),function(){try{var _0x326851=new Buffer(_0x327f4b[_0x16cf('0x1d')](_0x16cf('0x18')),'binary');_0x475f5c[_0x16cf('0x19')](_0x326851);_0x475f5c[_0x16cf('0x1a')]();_0x475f5c['on'](_0x16cf('0x1b'),function(){return _0x2cd4f4(_0x2cfc9f);});}catch(_0xc17d3f){fs[_0x16cf('0x1e')](_0x2cfc9f);return _0x10f6ef(_0xc17d3f);}});});};exports[_0x16cf('0x1f')]=function(_0x28f645,_0x2caa3f,_0x322da9){var _0x203a96=_0x322da9||stringOptions['algorithm'];var _0x54efb6=_0x2caa3f||stringOptions[_0x16cf('0x20')];var _0x91a3c6=crypto[_0x16cf('0x15')](_0x203a96,_0x54efb6);var _0x4c2953=_0x91a3c6[_0x16cf('0x17')](_0x28f645,_0x16cf('0x21'),'base64');_0x4c2953+=_0x91a3c6['final'](_0x16cf('0x22'));return _0x4c2953;};exports['decryptString']=function(_0x171d2f,_0x3f2d06,_0xb01d73){var _0x2845af=_0xb01d73||stringOptions[_0x16cf('0x9')];var _0x461ede=_0x3f2d06||stringOptions[_0x16cf('0x20')];var _0x5dda11=crypto['createDecipher'](_0x2845af,_0x461ede);var _0xd201c=_0x5dda11[_0x16cf('0x17')](_0x171d2f,_0x16cf('0x22'),_0x16cf('0x21'));_0xd201c+=_0x5dda11['final'](_0x16cf('0x21'));return _0xd201c;}; \ No newline at end of file +var _0x626e=['aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','write','end','final','close','unlink','decryptFile','createDecipher','data','binary','encryptString','secret','update','utf8','base64','crypto','../../config/logger','secrets'];(function(_0xf69ea2,_0x4b0d5c){var _0x2c88ec=function(_0x25c12f){while(--_0x25c12f){_0xf69ea2['push'](_0xf69ea2['shift']());}};_0x2c88ec(++_0x4b0d5c);}(_0x626e,0xb7));var _0xe626=function(_0x44872a,_0x2e659d){_0x44872a=_0x44872a-0x0;var _0x13254a=_0x626e[_0x44872a];return _0x13254a;};'use strict';var crypto=require(_0xe626('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xe626('0x1'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe626('0x2')]['session'],'algorithm':_0xe626('0x3')};const fileOptions={'algorithm':_0xe626('0x4')};if(config[_0xe626('0x5')]&&config[_0xe626('0x5')][_0xe626('0x6')]){var isSupported=isAlgorithmSupported(config[_0xe626('0x5')]['algorithm']);if(isSupported){fileOptions[_0xe626('0x6')]=config[_0xe626('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe626('0x7')](',\x20');logger[_0xe626('0x8')](config[_0xe626('0x5')]['algorithm'],_0xe626('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x908a67){return AES_SUPPORTED_RX[_0xe626('0xa')](_0x908a67);}function getSupportedCiphers(){return crypto[_0xe626('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xadaefd){return getSupportedCiphers()[_0xe626('0xc')](_0xadaefd)>-0x1;}function combineOptions(_0x3ec509){var _0x299570={};for(var _0x5ecf7c in fileOptions){if(fileOptions[_0xe626('0xd')](_0x5ecf7c)){_0x299570[_0x5ecf7c]=fileOptions[_0x5ecf7c];}}if(_0x3ec509){for(var _0xd5e475 in _0x3ec509){if(_0x3ec509['hasOwnProperty'](_0xd5e475)){_0x299570[_0xd5e475]=_0x3ec509[_0xd5e475];}}}return _0x299570;}exports[_0xe626('0xe')]=function(_0x28a0f9,_0x5366af,_0x347880,_0x4a353c){return new BPromise(function(_0x38dfcf,_0x5df4e2){_0x4a353c=combineOptions(_0x4a353c);var _0x5a15a6=new Buffer(_0x347880);var _0x20b8aa=fs[_0xe626('0xf')](_0x28a0f9);var _0x21438c=fs[_0xe626('0x10')](_0x5366af);var _0xfd8afd=crypto['createCipher'](_0x4a353c[_0xe626('0x6')],_0x5a15a6);_0x20b8aa['on']('data',function(_0x1a27ee){var _0x28cdb9=new Buffer(_0xfd8afd['update'](_0x1a27ee),'binary');_0x21438c[_0xe626('0x11')](_0x28cdb9);});_0x20b8aa['on'](_0xe626('0x12'),function(){try{var _0x27399c=new Buffer(_0xfd8afd[_0xe626('0x13')]('binary'),'binary');_0x21438c[_0xe626('0x11')](_0x27399c);_0x21438c[_0xe626('0x12')]();_0x21438c['on'](_0xe626('0x14'),function(){return _0x38dfcf(_0x5366af);});}catch(_0x1e0382){fs[_0xe626('0x15')](_0x5366af);return _0x5df4e2(_0x1e0382);}});});};exports[_0xe626('0x16')]=function(_0x2733cc,_0x16b022,_0x32f685,_0x46afc2){return new BPromise(function(_0x55eea7,_0x5a1dac){_0x46afc2=combineOptions(_0x46afc2);var _0x484df7=new Buffer(_0x32f685);var _0x343dcc=fs[_0xe626('0xf')](_0x2733cc);var _0x57af0e=fs[_0xe626('0x10')](_0x16b022);var _0x40ed5b=crypto[_0xe626('0x17')](_0x46afc2[_0xe626('0x6')],_0x484df7);_0x343dcc['on'](_0xe626('0x18'),function(_0x55f18c){var _0x59d413=new Buffer(_0x40ed5b['update'](_0x55f18c),_0xe626('0x19'));_0x57af0e[_0xe626('0x11')](_0x59d413);});_0x343dcc['on'](_0xe626('0x12'),function(){try{var _0x99a533=new Buffer(_0x40ed5b[_0xe626('0x13')]('binary'),_0xe626('0x19'));_0x57af0e[_0xe626('0x11')](_0x99a533);_0x57af0e[_0xe626('0x12')]();_0x57af0e['on'](_0xe626('0x14'),function(){return _0x55eea7(_0x16b022);});}catch(_0x32cb2c){fs['unlink'](_0x16b022);return _0x5a1dac(_0x32cb2c);}});});};exports[_0xe626('0x1a')]=function(_0x56764e,_0x3be2b2,_0x1697ec){var _0x475c7d=_0x1697ec||stringOptions[_0xe626('0x6')];var _0x51539e=_0x3be2b2||stringOptions[_0xe626('0x1b')];var _0x4be7cf=crypto['createCipher'](_0x475c7d,_0x51539e);var _0x5254e4=_0x4be7cf[_0xe626('0x1c')](_0x56764e,_0xe626('0x1d'),'base64');_0x5254e4+=_0x4be7cf[_0xe626('0x13')](_0xe626('0x1e'));return _0x5254e4;};exports['decryptString']=function(_0x22dada,_0x55b8f8,_0x50c8ab){var _0x264853=_0x50c8ab||stringOptions['algorithm'];var _0x110c67=_0x55b8f8||stringOptions[_0xe626('0x1b')];var _0x39e2f4=crypto[_0xe626('0x17')](_0x264853,_0x110c67);var _0x4b80e8=_0x39e2f4[_0xe626('0x1c')](_0x22dada,_0xe626('0x1e'),_0xe626('0x1d'));_0x4b80e8+=_0x39e2f4[_0xe626('0x13')](_0xe626('0x1d'));return _0x4b80e8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7aa60f5..a87eb74 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 _0xe04e=['SELECT','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','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','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe04e,0x1f2));var _0xee04=function(_0x4c1a2f,_0x3aef7b){_0x4c1a2f=_0x4c1a2f-0x0;var _0x20ba0c=_0xe04e[_0x4c1a2f];return _0x20ba0c;};'use strict';var util=require(_0xee04('0x0'));var path=require('path');var _=require(_0xee04('0x1'));var csv=require(_0xee04('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xee04('0x3'));var rimraf=require(_0xee04('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xee04('0x5')];var logger=require(_0xee04('0x6'))(_0xee04('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xee04('0x8')][0x2]);var QUERY=process[_0xee04('0x8')][0x3];var PATH=process[_0xee04('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a78c4,_0x3b5f0f){var _0x4ab7cf={'status':_0x3a78c4};var _0x2d7940={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b5f0f){_0x4ab7cf[_0xee04('0x9')]=_0x3b5f0f;}return db[_0xee04('0xa')][_0xee04('0xb')](_0x4ab7cf,_0x2d7940);}function main(){var _0x256e67=0x1388;var _0xe18b82;logger[_0xee04('0xc')](util[_0xee04('0xd')](_0xee04('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xee04('0xf')][_0xee04('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee04('0x11'),_0xee04('0x12')]})['then'](function(_0x14d962){if(_0x14d962){_0xe18b82=_0x14d962;_0x256e67=_0xe18b82[_0xee04('0x12')]||0x1388;}})[_0xee04('0x13')](function(){return dbH[_0xee04('0x14')]['query'](util['format'](_0xee04('0x15'),QUERY),{'type':dbH[_0xee04('0x14')][_0xee04('0x16')]['SELECT']});})['then'](function(_0x2cc9da){if(!_0x2cc9da[0x0][_0xee04('0x17')]){return analyticExtractedReport(_0xee04('0x18'));}var _0x29d0a6=[];var _0x1ab141=0x0;if(_0xe18b82['split']){if(_0x2cc9da&&_0x2cc9da[_0xee04('0x19')]){var _0x277327=_[_0xee04('0x1a')](_0x2cc9da[0x0][_0xee04('0x17')]/_0x256e67);var _0x22c353=Number[_0xee04('0x1b')](_0x2cc9da[0x0][_0xee04('0x17')]/_0x256e67)?_0x2cc9da[0x0][_0xee04('0x17')]%_0x256e67:0x0;_0x277327[_0xee04('0x1c')](function(_0x21092d){if(_0x21092d>0x0){_0x1ab141+=_0x256e67;}_0x29d0a6[_0xee04('0x1d')](dbH[_0xee04('0x14')][_0xee04('0x1e')](util[_0xee04('0xd')](_0xee04('0x1f'),QUERY,_0x256e67,_0x1ab141),{'type':dbH[_0xee04('0x14')][_0xee04('0x16')][_0xee04('0x20')]}));});if(_0x22c353>0x0){_0x1ab141+=_0x256e67;_0x29d0a6['push'](dbH[_0xee04('0x14')][_0xee04('0x1e')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x22c353,_0x1ab141),{'type':dbH[_0xee04('0x14')][_0xee04('0x16')]['SELECT']}));}}}else{_0x29d0a6[_0xee04('0x1d')](dbH[_0xee04('0x14')]['query'](QUERY,{'type':dbH[_0xee04('0x14')][_0xee04('0x16')][_0xee04('0x20')]}));}var _0x14cb15=path[_0xee04('0x21')](PATH);var _0x4623cb=path[_0xee04('0x22')](PATH,_0xee04('0x23'));var _0x419ca9=_0xe18b82[_0xee04('0x11')]&&_0x29d0a6[_0xee04('0x19')]>0x1;var _0x407f38=[];if(!fs[_0xee04('0x24')](path[_0xee04('0x25')](_0x14cb15,_0x4623cb))&&_0x419ca9){fs['mkdirSync'](path[_0xee04('0x25')](_0x14cb15,_0x4623cb));}return BPromise[_0xee04('0x26')](_0x29d0a6,function(_0x1ceebd){_0x407f38[_0xee04('0x1d')](_0x1ceebd);})[_0xee04('0x13')](function(){for(var _0x2d7177=0x0;_0x2d7177<_0x407f38[_0xee04('0x19')];_0x2d7177+=0x1){var _0x4fb9b8;var _0x4b76b2=_0x407f38[_0x2d7177];if(_0x419ca9){_0x4fb9b8=path[_0xee04('0x25')](_0x14cb15,_0x4623cb,util[_0xee04('0xd')](_0xee04('0x27'),_0x4623cb,_0x2d7177,_0xee04('0x28')));}else{_0x4fb9b8=path['join'](_0x14cb15,util[_0xee04('0xd')](_0xee04('0x29'),_0x4623cb,_0xee04('0x28')));}fs[_0xee04('0x2a')](_0x4fb9b8,csv(_0x4b76b2));}})['then'](function(){if(_0x419ca9){return new Promise(function(_0x1529bb){zipdir(path[_0xee04('0x25')](_0x14cb15,_0x4623cb),{'saveTo':path[_0xee04('0x25')](_0x14cb15,util[_0xee04('0xd')](_0xee04('0x29'),_0x4623cb,_0xee04('0x2b')))},function(_0x2391ec,_0x3c9ece){rimraf(path['join'](_0x14cb15,_0x4623cb),function(){});_0x1529bb(_0xee04('0x2c'));});});}})[_0xee04('0x13')](function(){logger[_0xee04('0xc')](util['format'](_0xee04('0x2d'),EXTRACTED_REPORT_ID,_0xee04('0x2e')));return analyticExtractedReport(_0xee04('0x2f'),_0x419ca9?util[_0xee04('0xd')](_0xee04('0x29'),_0x4623cb,_0x419ca9?_0xee04('0x2b'):_0xee04('0x28')):null);});})[_0xee04('0x30')](function(_0x472d6d){logger[_0xee04('0xc')](util['format'](_0xee04('0x31'),EXTRACTED_REPORT_ID,_0xee04('0x2e')),util['inspect'](_0x472d6d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xee04('0x32'));})[_0xee04('0x33')](function(){process[_0xee04('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x01b6=['%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','range','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync'];(function(_0x37bc50,_0x136b0){var _0x4b1449=function(_0x46c1c9){while(--_0x46c1c9){_0x37bc50['push'](_0x37bc50['shift']());}};_0x4b1449(++_0x136b0);}(_0x01b6,0x6a));var _0x601b=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x01b6[_0x1667df];return _0x341abf;};'use strict';var util=require('util');var path=require(_0x601b('0x0'));var _=require(_0x601b('0x1'));var csv=require(_0x601b('0x2'));var fs=require('fs');var BPromise=require(_0x601b('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x601b('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x601b('0x5'))[_0x601b('0x6')];var logger=require(_0x601b('0x7'))(_0x601b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x601b('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x601b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x51ca00,_0x2e9465){var _0x4034ed={'status':_0x51ca00};var _0x4ae440={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e9465){_0x4034ed[_0x601b('0xa')]=_0x2e9465;}return db['AnalyticExtractedReport'][_0x601b('0xb')](_0x4034ed,_0x4ae440);}function main(){var _0x36231d=0x1388;var _0x1b32ad;logger[_0x601b('0xc')](util[_0x601b('0xd')](_0x601b('0xe'),EXTRACTED_REPORT_ID,_0x601b('0xf')));return db['Setting'][_0x601b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x601b('0x11')]})[_0x601b('0x12')](function(_0x4995f2){if(_0x4995f2){_0x1b32ad=_0x4995f2;_0x36231d=_0x1b32ad[_0x601b('0x11')]||0x1388;}})[_0x601b('0x12')](function(){return dbH['sequelize'][_0x601b('0x13')](util[_0x601b('0xd')](_0x601b('0x14'),QUERY),{'type':dbH['sequelize'][_0x601b('0x15')][_0x601b('0x16')]});})[_0x601b('0x12')](function(_0x5547a0){if(!_0x5547a0[0x0]['num']){return analyticExtractedReport(_0x601b('0x17'));}var _0x425688=[];var _0x42f47f=0x0;if(_0x1b32ad[_0x601b('0x18')]){if(_0x5547a0&&_0x5547a0[_0x601b('0x19')]){var _0xb2939f=_[_0x601b('0x1a')](_0x5547a0[0x0]['num']/_0x36231d);var _0x3da6c4=Number['isInteger'](_0x5547a0[0x0]['num']/_0x36231d)?_0x5547a0[0x0]['num']%_0x36231d:0x0;_0xb2939f['forEach'](function(_0x25ef84){if(_0x25ef84>0x0){_0x42f47f+=_0x36231d;}_0x425688[_0x601b('0x1b')](dbH[_0x601b('0x1c')][_0x601b('0x13')](util[_0x601b('0xd')](_0x601b('0x1d'),QUERY,_0x36231d,_0x42f47f),{'type':dbH[_0x601b('0x1c')][_0x601b('0x15')][_0x601b('0x16')]}));});if(_0x3da6c4>0x0){_0x42f47f+=_0x36231d;_0x425688[_0x601b('0x1b')](dbH[_0x601b('0x1c')]['query'](util[_0x601b('0xd')](_0x601b('0x1d'),QUERY,_0x3da6c4,_0x42f47f),{'type':dbH[_0x601b('0x1c')][_0x601b('0x15')][_0x601b('0x16')]}));}}}else{_0x425688[_0x601b('0x1b')](dbH[_0x601b('0x1c')][_0x601b('0x13')](QUERY,{'type':dbH['sequelize'][_0x601b('0x15')][_0x601b('0x16')]}));}var _0x563a14=path['dirname'](PATH);var _0x245729=path[_0x601b('0x1e')](PATH,_0x601b('0x1f'));var _0x9cb69c=_0x1b32ad[_0x601b('0x18')]&&_0x425688[_0x601b('0x19')]>0x1;var _0x5f07de=[];if(!fs[_0x601b('0x20')](path[_0x601b('0x21')](_0x563a14,_0x245729))&&_0x9cb69c){fs[_0x601b('0x22')](path[_0x601b('0x21')](_0x563a14,_0x245729));}return BPromise['each'](_0x425688,function(_0x377ac4){_0x5f07de['push'](_0x377ac4);})[_0x601b('0x12')](function(){for(var _0xd4cc72=0x0;_0xd4cc72<_0x5f07de[_0x601b('0x19')];_0xd4cc72+=0x1){var _0x31c8a8;var _0x45f483=_0x5f07de[_0xd4cc72];if(_0x9cb69c){_0x31c8a8=path['join'](_0x563a14,_0x245729,util[_0x601b('0xd')](_0x601b('0x23'),_0x245729,_0xd4cc72,_0x601b('0x24')));}else{_0x31c8a8=path[_0x601b('0x21')](_0x563a14,util['format'](_0x601b('0x25'),_0x245729,_0x601b('0x24')));}fs[_0x601b('0x26')](_0x31c8a8,csv(_0x45f483));}})['then'](function(){if(_0x9cb69c){return new Promise(function(_0x13d48b){zipdir(path[_0x601b('0x21')](_0x563a14,_0x245729),{'saveTo':path[_0x601b('0x21')](_0x563a14,util[_0x601b('0xd')](_0x601b('0x25'),_0x245729,_0x601b('0x27')))},function(_0x588a21,_0x3efe52){rimraf(path[_0x601b('0x21')](_0x563a14,_0x245729),function(){});_0x13d48b(_0x601b('0x28'));});});}})['then'](function(){logger[_0x601b('0xc')](util[_0x601b('0xd')](_0x601b('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x9cb69c?util[_0x601b('0xd')](_0x601b('0x25'),_0x245729,_0x9cb69c?_0x601b('0x27'):_0x601b('0x24')):null);});})['catch'](function(_0x3a01a8){logger[_0x601b('0xc')](util[_0x601b('0xd')](_0x601b('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0x601b('0x2b')](_0x3a01a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x601b('0x2c'));})[_0x601b('0x2d')](function(){process[_0x601b('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c187997..1dadaaa 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 _0xe47a=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','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','finish','error','createPdfFromHTML','lodash','util','path','moment','zip-dir','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','toString','value','fill','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','before','margin','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','split','splitSizePdf','then','num','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xe47a,0x1dc));var _0xae47=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe47a[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae47('0x0'));var fs=require('fs');var util=require(_0xae47('0x1'));var path=require(_0xae47('0x2'));var moment=require(_0xae47('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xae47('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xae47('0x5'))[_0xae47('0x6')];var window=new JSDOM('')[_0xae47('0x7')];var BPromise=require(_0xae47('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xae47('0x9')];var logger=require(_0xae47('0xa'))(_0xae47('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xae47('0xc')][0x3];var PATH=process[_0xae47('0xc')][0x4];var NAME=process[_0xae47('0xc')][0x5];var FORMAT=_0xae47('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe09f32,_0x4b03c8){var _0x5e05a4={'status':_0xe09f32};var _0x29aca7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b03c8){_0x5e05a4[_0xae47('0xe')]=_0x4b03c8;}return db[_0xae47('0xf')][_0xae47('0x10')](_0x5e05a4,_0x29aca7);}function getHeaders(_0x3b72c1){return _['map'](_0x3b72c1,function(_0x4868de){return{'text':_0x4868de,'style':_0xae47('0x11')};});}function getRows(_0x273451,_0x29784e){return _['map'](_0x29784e,function(_0x7a6f81){return _(_0x7a6f81)[_0xae47('0x12')](_0x273451)['map'](function(_0x3588ae){return _0x3588ae?_[_0xae47('0x13')](_0x3588ae):'';})[_0xae47('0x14')]();});}function createTable(_0x48bb75,_0x2d872c){var _0x6bfb4a={'widths':_[_0xae47('0x15')](Array(_0x48bb75['length']),0x91),'heights':function(_0xc63f58){return _0xc63f58===0x0?_0xae47('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xf418a5=getHeaders(_0x48bb75);_0x6bfb4a[_0xae47('0x17')]['push'](_0xf418a5);var _0x1b4fe3=getRows(_0x48bb75,_0x2d872c);_0x6bfb4a[_0xae47('0x17')]=_0x6bfb4a['body'][_0xae47('0x18')](_0x1b4fe3);return _0x6bfb4a;}function createTables(_0x2a38fb){var _0x1c4796=[];var _0x479c49=_[_0xae47('0x19')](Object[_0xae47('0x1a')](_0x2a38fb[0x0]),0x5);_0x479c49['forEach'](function(_0x10d0c3){_0x1c4796[_0xae47('0x1b')](createTable(_0x10d0c3,_0x2a38fb));});return _0x1c4796;}function getPDFDocDefinition(_0x74a265){var _0x34d9ad=util[_0xae47('0x1c')](_0xae47('0x1d'),NAME,EXTRACTED_REPORT[_0xae47('0x1e')],moment(EXTRACTED_REPORT[_0xae47('0x1f')])[_0xae47('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xae47('0x20')])[_0xae47('0x1c')](FORMAT));var _0x4b98ad=[];for(var _0x4d7d4a=0x0;_0x4d7d4a<_0x74a265[_0xae47('0x21')];_0x4d7d4a++){var _0x12b0b3=[];if(_0x4d7d4a===0x0){_0x12b0b3[_0xae47('0x1b')]({'text':_0x34d9ad,'style':_0xae47('0x22')});}var _0x3d12d0={'table':_0x74a265[_0x4d7d4a]};if(_0x4d7d4a>0x0){_0x3d12d0['pageBreak']=_0xae47('0x23');_0x3d12d0[_0xae47('0x24')]=[0x0,0x46,0x0,0x0];}_0x12b0b3[_0xae47('0x1b')](_0x3d12d0);_0x4b98ad['push'](_0x12b0b3);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4b98ad,'footer':function(_0x313995,_0x3cf2d8){return{'text':_0x313995['toString']()+_0xae47('0x25')+_0x3cf2d8,'style':_0xae47('0x26')};},'defaultStyle':{'font':_0xae47('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xae47('0x28')},'footer':{'alignment':_0xae47('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2ac02f){var _0x37cc70=0x1388;var _0x26a351;if(!_0x2ac02f[0x0]['num']){return analyticExtractedReport(_0xae47('0x2a'));}return db[_0xae47('0x2b')][_0xae47('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xae47('0x2d'),_0xae47('0x2e')]})['then'](function(_0xb1d851){if(_0xb1d851){_0x26a351=_0xb1d851;_0x37cc70=_0x26a351[_0xae47('0x2e')]||0x3e8;}})[_0xae47('0x2f')](function(){var _0x2ff263=[];var _0xf2228c=0x0;if(_0x26a351[_0xae47('0x2d')]){if(_0x2ac02f&&_0x2ac02f['length']){var _0x22c46f=_['range'](_0x2ac02f[0x0]['num']/_0x37cc70);var _0x5147f3=Number['isInteger'](_0x2ac02f[0x0]['num']/_0x37cc70)?_0x2ac02f[0x0][_0xae47('0x30')]%_0x37cc70:0x0;_0x22c46f[_0xae47('0x31')](function(_0x25baf8){if(_0x25baf8>0x0){_0xf2228c+=_0x37cc70;}_0x2ff263[_0xae47('0x1b')](dbH[_0xae47('0x32')][_0xae47('0x33')](util['format'](_0xae47('0x34'),QUERY,_0x37cc70,_0xf2228c),{'type':dbH['sequelize'][_0xae47('0x35')][_0xae47('0x36')]}));});if(_0x5147f3>0x0){_0xf2228c+=_0x37cc70;_0x2ff263['push'](dbH[_0xae47('0x32')][_0xae47('0x33')](util['format'](_0xae47('0x34'),QUERY,_0x5147f3,_0xf2228c),{'type':dbH[_0xae47('0x32')][_0xae47('0x35')][_0xae47('0x36')]}));}}}else{_0x2ff263[_0xae47('0x1b')](dbH[_0xae47('0x32')][_0xae47('0x33')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xae47('0x36')]}));}var _0x3a26bf=path[_0xae47('0x37')](PATH);var _0x513880=path[_0xae47('0x38')](PATH,_0xae47('0x39'));var _0x6a546=_0x26a351[_0xae47('0x2d')]&&_0x2ff263[_0xae47('0x21')]>0x1;var _0x34b7f0=[];if(!fs[_0xae47('0x3a')](path['join'](_0x3a26bf,_0x513880))&&_0x6a546){fs[_0xae47('0x3b')](path[_0xae47('0x3c')](_0x3a26bf,_0x513880));}return BPromise[_0xae47('0x3d')](_0x2ff263,function(_0x42c284){_0x34b7f0['push'](_0x42c284);})['then'](function(){var _0x4461c9=[];for(var _0x346d8f=0x0;_0x346d8f<_0x34b7f0[_0xae47('0x21')];_0x346d8f+=0x1){var _0x5e797a=_0x34b7f0[_0x346d8f];var _0x489419=createTables(_[_0xae47('0x3e')](_0x5e797a));var _0x37c511;var _0x14a573=getPDFDocDefinition(_0x489419);var _0xa1107d=getPDFPrinter();var _0x7565a0=_0xa1107d[_0xae47('0x3f')](_0x14a573);if(_0x6a546){_0x37c511=path[_0xae47('0x3c')](_0x3a26bf,_0x513880,util[_0xae47('0x1c')](_0xae47('0x40'),_0x513880,_0x346d8f,_0xae47('0x41')));}else{_0x37c511=path[_0xae47('0x3c')](_0x3a26bf,util[_0xae47('0x1c')](_0xae47('0x42'),_0x513880,_0xae47('0x41')));}_0x4461c9[_0xae47('0x1b')](writePDFDocument(_0x7565a0,_0x37c511));}return Promise[_0xae47('0x43')](_0x4461c9);})[_0xae47('0x2f')](function(){if(_0x6a546){return new Promise(function(_0x5b68f8){zipdir(path['join'](_0x3a26bf,_0x513880),{'saveTo':path['join'](_0x3a26bf,util[_0xae47('0x1c')](_0xae47('0x42'),_0x513880,_0xae47('0x44')))},function(){rimraf(path[_0xae47('0x3c')](_0x3a26bf,_0x513880),function(){});_0x5b68f8(_0xae47('0x45'));});});}})[_0xae47('0x2f')](function(){if(!_0x6a546)return;rimraf(path[_0xae47('0x3c')](_0x3a26bf,_0x513880),function(){});})['then'](function(){logger[_0xae47('0x46')](util['format'](_0xae47('0x47'),EXTRACTED_REPORT_ID,_0xae47('0x48')));return analyticExtractedReport('Completed',_0x6a546?util[_0xae47('0x1c')](_0xae47('0x42'),_0x513880,_0x6a546?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xae47('0x1c')](_0xae47('0x49'),EXTRACTED_REPORT_ID,_0xae47('0x48')));return db[_0xae47('0xf')][_0xae47('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xae47('0x2f')](function(_0x5da003){EXTRACTED_REPORT=_0x5da003;return dbH[_0xae47('0x32')]['query'](util[_0xae47('0x1c')](_0xae47('0x4b'),QUERY),{'type':dbH[_0xae47('0x32')][_0xae47('0x35')][_0xae47('0x36')]});})['then'](extractReport)[_0xae47('0x4c')](function(_0x33a00c){logger[_0xae47('0x46')](util[_0xae47('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xae47('0x48')),util['inspect'](_0x33a00c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xae47('0x4d'));})[_0xae47('0x4e')](function(){process[_0xae47('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4ee03e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xae47('0x50'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xae47('0x51')}});return _0x4ee03e;}function getPDFDocDefinitionFromHTML(_0x184f30,_0x257394){var _0x40533a=util[_0xae47('0x1c')]('%s\x20#%d',_0x257394['channel'],_0x257394[_0xae47('0x52')]);var _0x5e668e=moment()[_0xae47('0x1c')](_0xae47('0x53'))['toString']();var _0x2993fd=htmlToPdfmake(_0x184f30,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2993fd],'defaultStyle':{'font':_0xae47('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xae47('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xae47('0x54')}},'header':function(){return[{'text':_0xae47('0x55'),'style':_0xae47('0x22')}];},'footer':function(_0x418055,_0x36e0cf){return[{'text':util[_0xae47('0x1c')](_0xae47('0x56'),_0x40533a,_0x418055,_0x36e0cf,_0x5e668e),'style':_0xae47('0x26')}];}};}function writePDFDocument(_0x1fb7c2,_0x5d472c){return new Promise(function(_0x4d4f58,_0x1490ae){var _0x384e2b=_0x1fb7c2[_0xae47('0x57')](fs['createWriteStream'](_0x5d472c));_0x384e2b['on'](_0xae47('0x58'),function(){_0x4d4f58(_0xae47('0x58'));});_0x384e2b['on'](_0xae47('0x59'),function(_0x3e0dd2){_0x1490ae(_0x3e0dd2);});_0x1fb7c2['end']();});}exports[_0xae47('0x5a')]=function(_0x8eb9fc,_0x136bd0){var _0x446823=getPDFPrinter();var _0x11a7c6=getPDFDocDefinitionFromHTML(_0x8eb9fc,_0x136bd0);var _0x4a1368=_0x446823[_0xae47('0x3f')](_0x11a7c6);return writePDFDocument(_0x4a1368,_0x136bd0[_0xae47('0x2')])[_0xae47('0x4c')](function(_0x1ca281){throw _0x1ca281;});}; \ No newline at end of file +var _0xf882=['length','auto','body','push','concat','chunk','forEach','format','name','startDate','endDate','header','pageBreak','before','landscape','footer','Arial','black','right','num','Empty','split','splitSizePdf','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','then','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','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','createPdfKitDocument','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill'];(function(_0xa8bac1,_0x399c33){var _0x15ffcf=function(_0x79f9f8){while(--_0x79f9f8){_0xa8bac1['push'](_0xa8bac1['shift']());}};_0x15ffcf(++_0x399c33);}(_0xf882,0x14d));var _0x2f88=function(_0x2c7819,_0x169eb9){_0x2c7819=_0x2c7819-0x0;var _0x69e8c4=_0xf882[_0x2c7819];return _0x69e8c4;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x2f88('0x0'));var path=require(_0x2f88('0x1'));var moment=require(_0x2f88('0x2'));var htmlToPdfmake=require(_0x2f88('0x3'));var PdfPrinter=require(_0x2f88('0x4'));var zipdir=require(_0x2f88('0x5'));var rimraf=require(_0x2f88('0x6'));var JSDOM=require('jsdom')[_0x2f88('0x7')];var window=new JSDOM('')[_0x2f88('0x8')];var BPromise=require(_0x2f88('0x9'));var db=require(_0x2f88('0xa'))['db'];var dbH=require(_0x2f88('0xa'))['dbH'];var logger=require(_0x2f88('0xb'))(_0x2f88('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2f88('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x2f88('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x10a611,_0x1acaeb){var _0x5ee6b5={'status':_0x10a611};var _0x3c76b0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1acaeb){_0x5ee6b5[_0x2f88('0xf')]=_0x1acaeb;}return db['AnalyticExtractedReport'][_0x2f88('0x10')](_0x5ee6b5,_0x3c76b0);}function getHeaders(_0x4b9fe3){return _[_0x2f88('0x11')](_0x4b9fe3,function(_0x1996ed){return{'text':_0x1996ed,'style':_0x2f88('0x12')};});}function getRows(_0x3291ed,_0xda1f5f){return _['map'](_0xda1f5f,function(_0x2bf831){return _(_0x2bf831)[_0x2f88('0x13')](_0x3291ed)[_0x2f88('0x11')](function(_0x528209){return _0x528209?_[_0x2f88('0x14')](_0x528209):'';})[_0x2f88('0x15')]();});}function createTable(_0xa84eb3,_0x3a1622){var _0xde5e9={'widths':_[_0x2f88('0x16')](Array(_0xa84eb3[_0x2f88('0x17')]),0x91),'heights':function(_0x2ac34a){return _0x2ac34a===0x0?_0x2f88('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4a87ca=getHeaders(_0xa84eb3);_0xde5e9[_0x2f88('0x19')][_0x2f88('0x1a')](_0x4a87ca);var _0x18022d=getRows(_0xa84eb3,_0x3a1622);_0xde5e9[_0x2f88('0x19')]=_0xde5e9[_0x2f88('0x19')][_0x2f88('0x1b')](_0x18022d);return _0xde5e9;}function createTables(_0x9d9fdf){var _0x53c5d8=[];var _0x3133ee=_[_0x2f88('0x1c')](Object['keys'](_0x9d9fdf[0x0]),0x5);_0x3133ee[_0x2f88('0x1d')](function(_0x13b37b){_0x53c5d8[_0x2f88('0x1a')](createTable(_0x13b37b,_0x9d9fdf));});return _0x53c5d8;}function getPDFDocDefinition(_0x130edc){var _0x259e90=util[_0x2f88('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x2f88('0x1f')],moment(EXTRACTED_REPORT[_0x2f88('0x20')])[_0x2f88('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x2f88('0x21')])[_0x2f88('0x1e')](FORMAT));var _0x50731b=[];for(var _0x5e5a0b=0x0;_0x5e5a0b<_0x130edc[_0x2f88('0x17')];_0x5e5a0b++){var _0x4b860e=[];if(_0x5e5a0b===0x0){_0x4b860e['push']({'text':_0x259e90,'style':_0x2f88('0x22')});}var _0x2ea4c1={'table':_0x130edc[_0x5e5a0b]};if(_0x5e5a0b>0x0){_0x2ea4c1[_0x2f88('0x23')]=_0x2f88('0x24');_0x2ea4c1['margin']=[0x0,0x46,0x0,0x0];}_0x4b860e[_0x2f88('0x1a')](_0x2ea4c1);_0x50731b[_0x2f88('0x1a')](_0x4b860e);}return{'pageSize':'A4','pageOrientation':_0x2f88('0x25'),'content':_0x50731b,'footer':function(_0x35181b,_0x280a6c){return{'text':_0x35181b[_0x2f88('0x14')]()+'\x20/\x20'+_0x280a6c,'style':_0x2f88('0x26')};},'defaultStyle':{'font':_0x2f88('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2f88('0x28')},'footer':{'alignment':_0x2f88('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1d721d){var _0x17b9ea=0x1388;var _0x2d79ea;if(!_0x1d721d[0x0][_0x2f88('0x2a')]){return analyticExtractedReport(_0x2f88('0x2b'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f88('0x2c'),_0x2f88('0x2d')]})['then'](function(_0x58dba4){if(_0x58dba4){_0x2d79ea=_0x58dba4;_0x17b9ea=_0x2d79ea[_0x2f88('0x2d')]||0x3e8;}})['then'](function(){var _0x208dd7=[];var _0x5d1708=0x0;if(_0x2d79ea[_0x2f88('0x2c')]){if(_0x1d721d&&_0x1d721d[_0x2f88('0x17')]){var _0x1afec4=_['range'](_0x1d721d[0x0][_0x2f88('0x2a')]/_0x17b9ea);var _0x300d2a=Number['isInteger'](_0x1d721d[0x0]['num']/_0x17b9ea)?_0x1d721d[0x0]['num']%_0x17b9ea:0x0;_0x1afec4[_0x2f88('0x1d')](function(_0x1b8b31){if(_0x1b8b31>0x0){_0x5d1708+=_0x17b9ea;}_0x208dd7[_0x2f88('0x1a')](dbH[_0x2f88('0x2e')][_0x2f88('0x2f')](util['format'](_0x2f88('0x30'),QUERY,_0x17b9ea,_0x5d1708),{'type':dbH[_0x2f88('0x2e')][_0x2f88('0x31')]['SELECT']}));});if(_0x300d2a>0x0){_0x5d1708+=_0x17b9ea;_0x208dd7[_0x2f88('0x1a')](dbH['sequelize']['query'](util[_0x2f88('0x1e')](_0x2f88('0x30'),QUERY,_0x300d2a,_0x5d1708),{'type':dbH['sequelize']['QueryTypes'][_0x2f88('0x32')]}));}}}else{_0x208dd7[_0x2f88('0x1a')](dbH[_0x2f88('0x2e')]['query'](QUERY,{'type':dbH['sequelize'][_0x2f88('0x31')][_0x2f88('0x32')]}));}var _0x573319=path[_0x2f88('0x33')](PATH);var _0x3f000a=path[_0x2f88('0x34')](PATH,_0x2f88('0x35'));var _0x4d745f=_0x2d79ea[_0x2f88('0x2c')]&&_0x208dd7[_0x2f88('0x17')]>0x1;var _0xdd4707=[];if(!fs[_0x2f88('0x36')](path[_0x2f88('0x37')](_0x573319,_0x3f000a))&&_0x4d745f){fs['mkdirSync'](path[_0x2f88('0x37')](_0x573319,_0x3f000a));}return BPromise[_0x2f88('0x38')](_0x208dd7,function(_0x2895ab){_0xdd4707[_0x2f88('0x1a')](_0x2895ab);})[_0x2f88('0x39')](function(){var _0x3d5b42=[];for(var _0x12fb7b=0x0;_0x12fb7b<_0xdd4707[_0x2f88('0x17')];_0x12fb7b+=0x1){var _0x150d7c=_0xdd4707[_0x12fb7b];var _0x33c889=createTables(_['flatten'](_0x150d7c));var _0x3eda86;var _0x4db3a6=getPDFDocDefinition(_0x33c889);var _0x4c5be4=getPDFPrinter();var _0x30d9c0=_0x4c5be4['createPdfKitDocument'](_0x4db3a6);if(_0x4d745f){_0x3eda86=path[_0x2f88('0x37')](_0x573319,_0x3f000a,util['format'](_0x2f88('0x3a'),_0x3f000a,_0x12fb7b,_0x2f88('0x3b')));}else{_0x3eda86=path[_0x2f88('0x37')](_0x573319,util['format'](_0x2f88('0x3c'),_0x3f000a,_0x2f88('0x3b')));}_0x3d5b42['push'](writePDFDocument(_0x30d9c0,_0x3eda86));}return Promise[_0x2f88('0x3d')](_0x3d5b42);})[_0x2f88('0x39')](function(){if(_0x4d745f){return new Promise(function(_0x393f17){zipdir(path[_0x2f88('0x37')](_0x573319,_0x3f000a),{'saveTo':path[_0x2f88('0x37')](_0x573319,util[_0x2f88('0x1e')]('%s.%s',_0x3f000a,_0x2f88('0x3e')))},function(){rimraf(path[_0x2f88('0x37')](_0x573319,_0x3f000a),function(){});_0x393f17(_0x2f88('0x3f'));});});}})[_0x2f88('0x39')](function(){if(!_0x4d745f)return;rimraf(path['join'](_0x573319,_0x3f000a),function(){});})[_0x2f88('0x39')](function(){logger[_0x2f88('0x40')](util[_0x2f88('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2f88('0x41')));return analyticExtractedReport(_0x2f88('0x42'),_0x4d745f?util[_0x2f88('0x1e')](_0x2f88('0x3c'),_0x3f000a,_0x4d745f?_0x2f88('0x3e'):_0x2f88('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x2f88('0x1e')](_0x2f88('0x43'),EXTRACTED_REPORT_ID,_0x2f88('0x41')));return db[_0x2f88('0x44')][_0x2f88('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x53a276){EXTRACTED_REPORT=_0x53a276;return dbH[_0x2f88('0x2e')][_0x2f88('0x2f')](util[_0x2f88('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2f88('0x2e')][_0x2f88('0x31')][_0x2f88('0x32')]});})['then'](extractReport)[_0x2f88('0x46')](function(_0x57ac92){logger[_0x2f88('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x2f88('0x47')](_0x57ac92,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f88('0x48'));})['finally'](function(){process[_0x2f88('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xd42b4=new PdfPrinter({'Arial':{'normal':__dirname+_0x2f88('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x2f88('0x4b'),'bolditalics':__dirname+_0x2f88('0x4c')}});return _0xd42b4;}function getPDFDocDefinitionFromHTML(_0x3766d7,_0x13e29b){var _0x37db0c=util['format'](_0x2f88('0x4d'),_0x13e29b[_0x2f88('0x4e')],_0x13e29b[_0x2f88('0x4f')]);var _0x584129=moment()[_0x2f88('0x1e')]('YYYY-MM-DD')['toString']();var _0x36fb65=htmlToPdfmake(_0x3766d7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x36fb65],'defaultStyle':{'font':_0x2f88('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2f88('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x2f88('0x51'),'style':'header'}];},'footer':function(_0x4b972e,_0x25d193){return[{'text':util['format'](_0x2f88('0x52'),_0x37db0c,_0x4b972e,_0x25d193,_0x584129),'style':'footer'}];}};}function writePDFDocument(_0x527c3b,_0x364ce3){return new Promise(function(_0x3e7cd5,_0x58261e){var _0x3aebe6=_0x527c3b[_0x2f88('0x53')](fs[_0x2f88('0x54')](_0x364ce3));_0x3aebe6['on']('finish',function(){_0x3e7cd5(_0x2f88('0x55'));});_0x3aebe6['on'](_0x2f88('0x56'),function(_0x15e036){_0x58261e(_0x15e036);});_0x527c3b['end']();});}exports[_0x2f88('0x57')]=function(_0xdaabdf,_0x1e9e31){var _0x50b211=getPDFPrinter();var _0x23e39c=getPDFDocDefinitionFromHTML(_0xdaabdf,_0x1e9e31);var _0x449a6a=_0x50b211[_0x2f88('0x58')](_0x23e39c);return writePDFDocument(_0x449a6a,_0x1e9e31[_0x2f88('0x1')])[_0x2f88('0x46')](function(_0x457c9b){throw _0x457c9b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1b975c4..9b05fea 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 _0x2dd8=['path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2dd8,0x143));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x82dd('0x0'));var path=require(_0x82dd('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x82dd('0x2'));var zipdir=require(_0x82dd('0x3'));var rimraf=require(_0x82dd('0x4'));var db=require(_0x82dd('0x5'))['db'];var dbH=require(_0x82dd('0x5'))[_0x82dd('0x6')];var logger=require(_0x82dd('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x82dd('0x8')][0x2]);var QUERY=process[_0x82dd('0x8')][0x3];var PATH=process[_0x82dd('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e9d89,_0x54fb28){var _0x21ebb8={'status':_0x2e9d89};var _0x3e8516={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54fb28){_0x21ebb8[_0x82dd('0x9')]=_0x54fb28;}return db[_0x82dd('0xa')]['update'](_0x21ebb8,_0x3e8516);}function main(){var _0x4a2fa6=0x1388;var _0x332c36;logger['info'](util[_0x82dd('0xb')](_0x82dd('0xc'),EXTRACTED_REPORT_ID,_0x82dd('0xd')));return db[_0x82dd('0xe')][_0x82dd('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x82dd('0x10')]})[_0x82dd('0x11')](function(_0x348f79){if(_0x348f79){_0x332c36=_0x348f79;_0x4a2fa6=_0x332c36[_0x82dd('0x10')]||0x1388;}})[_0x82dd('0x11')](function(){return dbH['sequelize']['query'](util[_0x82dd('0xb')](_0x82dd('0x12'),QUERY),{'type':dbH[_0x82dd('0x13')][_0x82dd('0x14')][_0x82dd('0x15')]});})[_0x82dd('0x11')](function(_0x31b9c1){if(!_0x31b9c1[0x0][_0x82dd('0x16')]){return analyticExtractedReport(_0x82dd('0x17'));}var _0x1b90e0=[];var _0x3d7664=0x0;if(_0x332c36[_0x82dd('0x18')]){if(_0x31b9c1&&_0x31b9c1[_0x82dd('0x19')]){var _0x51d2a9=_[_0x82dd('0x1a')](_0x31b9c1[0x0][_0x82dd('0x16')]/_0x4a2fa6);var _0x34d991=Number[_0x82dd('0x1b')](_0x31b9c1[0x0][_0x82dd('0x16')]/_0x4a2fa6)?_0x31b9c1[0x0][_0x82dd('0x16')]%_0x4a2fa6:0x0;_0x51d2a9[_0x82dd('0x1c')](function(_0x1e8ea2){if(_0x1e8ea2>0x0){_0x3d7664+=_0x4a2fa6;}_0x1b90e0[_0x82dd('0x1d')](dbH[_0x82dd('0x13')][_0x82dd('0x1e')](util[_0x82dd('0xb')](_0x82dd('0x1f'),QUERY,_0x4a2fa6,_0x3d7664),{'type':dbH['sequelize'][_0x82dd('0x14')][_0x82dd('0x15')]}));});if(_0x34d991>0x0){_0x3d7664+=_0x4a2fa6;_0x1b90e0[_0x82dd('0x1d')](dbH[_0x82dd('0x13')][_0x82dd('0x1e')](util[_0x82dd('0xb')](_0x82dd('0x1f'),QUERY,_0x34d991,_0x3d7664),{'type':dbH[_0x82dd('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x1b90e0[_0x82dd('0x1d')](dbH[_0x82dd('0x13')]['query'](QUERY,{'type':dbH['sequelize'][_0x82dd('0x14')][_0x82dd('0x15')]}));}var _0x3b0740=path[_0x82dd('0x20')](PATH);var _0x4609c1=path[_0x82dd('0x21')](PATH,_0x82dd('0x22'));var _0x1374e3=_0x332c36[_0x82dd('0x18')]&&_0x1b90e0[_0x82dd('0x19')]>0x1;var _0xe6aacd=[];if(!fs[_0x82dd('0x23')](path[_0x82dd('0x24')](_0x3b0740,_0x4609c1))&&_0x1374e3){fs[_0x82dd('0x25')](path['join'](_0x3b0740,_0x4609c1));}return BPromise[_0x82dd('0x26')](_0x1b90e0,function(_0x3abff0){_0xe6aacd[_0x82dd('0x1d')](_0x3abff0);})['then'](function(){for(var _0x15da13=0x0;_0x15da13<_0xe6aacd['length'];_0x15da13+=0x1){var _0x15f31f;var _0x93fd00=_0xe6aacd[_0x15da13];if(_0x1374e3){_0x15f31f=path[_0x82dd('0x24')](_0x3b0740,_0x4609c1,util['format'](_0x82dd('0x27'),_0x4609c1,_0x15da13,_0x82dd('0x28')));}else{_0x15f31f=path['join'](_0x3b0740,util['format'](_0x82dd('0x29'),_0x4609c1,_0x82dd('0x28')));}fs['writeFileSync'](_0x15f31f,json2xls(_0x93fd00),_0x82dd('0x2a'));}})[_0x82dd('0x11')](function(){if(_0x1374e3){return new Promise(function(_0x2d2b7b){zipdir(path['join'](_0x3b0740,_0x4609c1),{'saveTo':path[_0x82dd('0x24')](_0x3b0740,util[_0x82dd('0xb')]('%s.%s',_0x4609c1,'zip'))},function(_0x1b3c04,_0x225cf1){rimraf(path['join'](_0x3b0740,_0x4609c1),function(){});_0x2d2b7b(_0x82dd('0x2b'));});});}})[_0x82dd('0x11')](function(){logger[_0x82dd('0x2c')](util[_0x82dd('0xb')](_0x82dd('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x82dd('0x2e'),_0x1374e3?util[_0x82dd('0xb')]('%s.%s',_0x4609c1,_0x1374e3?_0x82dd('0x2f'):_0x82dd('0x28')):null);});})[_0x82dd('0x30')](function(_0xffb16c){logger['info'](util[_0x82dd('0xb')](_0x82dd('0x31'),EXTRACTED_REPORT_ID,_0x82dd('0xd')),util[_0x82dd('0x32')](_0xffb16c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x82dd('0x33'));})[_0x82dd('0x34')](function(){process[_0x82dd('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc468=['inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','Empty','length','range','num','isInteger','forEach','push','dirname','basename','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x4d4c63,_0x33ac30){var _0x383b63=function(_0x2520c6){while(--_0x2520c6){_0x4d4c63['push'](_0x4d4c63['shift']());}};_0x383b63(++_0x33ac30);}(_0xc468,0xd0));var _0x8c46=function(_0x2cd62d,_0x510739){_0x2cd62d=_0x2cd62d-0x0;var _0x3c2210=_0xc468[_0x2cd62d];return _0x3c2210;};'use strict';var util=require(_0x8c46('0x0'));var path=require('path');var _=require(_0x8c46('0x1'));var fs=require('fs');var json2xls=require(_0x8c46('0x2'));var BPromise=require(_0x8c46('0x3'));var zipdir=require(_0x8c46('0x4'));var rimraf=require(_0x8c46('0x5'));var db=require(_0x8c46('0x6'))['db'];var dbH=require(_0x8c46('0x6'))[_0x8c46('0x7')];var logger=require(_0x8c46('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8c46('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8c46('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x404497,_0x32271){var _0x29e42c={'status':_0x404497};var _0x546f67={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x32271){_0x29e42c[_0x8c46('0xa')]=_0x32271;}return db[_0x8c46('0xb')][_0x8c46('0xc')](_0x29e42c,_0x546f67);}function main(){var _0x5a3a4a=0x1388;var _0x1799e5;logger[_0x8c46('0xd')](util[_0x8c46('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8c46('0xf')));return db[_0x8c46('0x10')][_0x8c46('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8c46('0x12'),'splitSizeXlsx']})['then'](function(_0x705f8){if(_0x705f8){_0x1799e5=_0x705f8;_0x5a3a4a=_0x1799e5['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x8c46('0x13')][_0x8c46('0x14')](util[_0x8c46('0xe')](_0x8c46('0x15'),QUERY),{'type':dbH[_0x8c46('0x13')][_0x8c46('0x16')][_0x8c46('0x17')]});})[_0x8c46('0x18')](function(_0x59395f){if(!_0x59395f[0x0]['num']){return analyticExtractedReport(_0x8c46('0x19'));}var _0x3d74b9=[];var _0x2cf6ae=0x0;if(_0x1799e5[_0x8c46('0x12')]){if(_0x59395f&&_0x59395f[_0x8c46('0x1a')]){var _0x3371fc=_[_0x8c46('0x1b')](_0x59395f[0x0][_0x8c46('0x1c')]/_0x5a3a4a);var _0x167855=Number[_0x8c46('0x1d')](_0x59395f[0x0][_0x8c46('0x1c')]/_0x5a3a4a)?_0x59395f[0x0][_0x8c46('0x1c')]%_0x5a3a4a:0x0;_0x3371fc[_0x8c46('0x1e')](function(_0x45e862){if(_0x45e862>0x0){_0x2cf6ae+=_0x5a3a4a;}_0x3d74b9[_0x8c46('0x1f')](dbH[_0x8c46('0x13')][_0x8c46('0x14')](util[_0x8c46('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a3a4a,_0x2cf6ae),{'type':dbH[_0x8c46('0x13')][_0x8c46('0x16')][_0x8c46('0x17')]}));});if(_0x167855>0x0){_0x2cf6ae+=_0x5a3a4a;_0x3d74b9[_0x8c46('0x1f')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x167855,_0x2cf6ae),{'type':dbH[_0x8c46('0x13')][_0x8c46('0x16')][_0x8c46('0x17')]}));}}}else{_0x3d74b9[_0x8c46('0x1f')](dbH[_0x8c46('0x13')][_0x8c46('0x14')](QUERY,{'type':dbH[_0x8c46('0x13')][_0x8c46('0x16')]['SELECT']}));}var _0x31a36c=path[_0x8c46('0x20')](PATH);var _0x2a583f=path[_0x8c46('0x21')](PATH,'.xlsx');var _0x23f498=_0x1799e5[_0x8c46('0x12')]&&_0x3d74b9[_0x8c46('0x1a')]>0x1;var _0x28dda8=[];if(!fs[_0x8c46('0x22')](path['join'](_0x31a36c,_0x2a583f))&&_0x23f498){fs[_0x8c46('0x23')](path[_0x8c46('0x24')](_0x31a36c,_0x2a583f));}return BPromise[_0x8c46('0x25')](_0x3d74b9,function(_0x42d325){_0x28dda8[_0x8c46('0x1f')](_0x42d325);})[_0x8c46('0x18')](function(){for(var _0x14de73=0x0;_0x14de73<_0x28dda8['length'];_0x14de73+=0x1){var _0x467871;var _0x3ce18b=_0x28dda8[_0x14de73];if(_0x23f498){_0x467871=path[_0x8c46('0x24')](_0x31a36c,_0x2a583f,util[_0x8c46('0xe')](_0x8c46('0x26'),_0x2a583f,_0x14de73,_0x8c46('0x27')));}else{_0x467871=path[_0x8c46('0x24')](_0x31a36c,util[_0x8c46('0xe')]('%s.%s',_0x2a583f,_0x8c46('0x27')));}fs[_0x8c46('0x28')](_0x467871,json2xls(_0x3ce18b),_0x8c46('0x29'));}})[_0x8c46('0x18')](function(){if(_0x23f498){return new Promise(function(_0x30d4db){zipdir(path['join'](_0x31a36c,_0x2a583f),{'saveTo':path[_0x8c46('0x24')](_0x31a36c,util['format'](_0x8c46('0x2a'),_0x2a583f,_0x8c46('0x2b')))},function(_0x2a76b0,_0x331407){rimraf(path[_0x8c46('0x24')](_0x31a36c,_0x2a583f),function(){});_0x30d4db('zip\x20finished');});});}})[_0x8c46('0x18')](function(){logger[_0x8c46('0xd')](util[_0x8c46('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x8c46('0x2c'),_0x23f498?util[_0x8c46('0xe')](_0x8c46('0x2a'),_0x2a583f,_0x23f498?_0x8c46('0x2b'):_0x8c46('0x27')):null);});})[_0x8c46('0x2d')](function(_0x54c9ea){logger['info'](util[_0x8c46('0xe')](_0x8c46('0x2e'),EXTRACTED_REPORT_ID,_0x8c46('0xf')),util[_0x8c46('0x2f')](_0x54c9ea,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8c46('0x30'));})[_0x8c46('0x31')](function(){process[_0x8c46('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3249bff..5b11996 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 _0xff1e=['interval','IntervalId','hasOwnProperty','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','filter','groupBy','exten','queue','playback','extensions','extension','find','push','type','Set','CDR(type)=%s','priority','VoiceExtensionId','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xff1e,0xef));var _0xeff1=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xff1e[_0x86b219];return _0x1f320c;};'use strict';var _=require('lodash');var util=require(_0xeff1('0x0'));function rewrite(_0xd7f1ae,_0x9889f3){var _0x2a201a=this;return _0xd7f1ae[_0xeff1('0x1')][_0xeff1('0x2')][_0xeff1('0x3')]({'raw':!![]})[_0xeff1('0x4')](function(_0x3b8bc0){_0x2a201a[_0xeff1('0x5')]=_0x3b8bc0;return _0xd7f1ae[_0xeff1('0x1')][_0xeff1('0x6')]['findAll']({'where':{'IntervalId':_0x9889f3['IntervalId']},'raw':!![]});})['then'](function(_0x1bb09d){return _0xd7f1ae[_0xeff1('0x1')][_0xeff1('0x6')][_0xeff1('0x3')]({'where':{'exten':{'$in':_[_0xeff1('0x7')](_[_0xeff1('0x8')](_0x1bb09d,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x590239){var _0xe4a458=_['filter'](_0x590239,{'priority':'1'});var _0xf7b07e=_[_0xeff1('0x9')](_0x590239,{'isApp':0x1});var _0x2980b4=_[_0xeff1('0xa')](_0xf7b07e,_0xeff1('0xb'));var _0x3a911b=[_0xeff1('0xc'),_0xeff1('0xd')];var _0x3ddfc4=[];var _0x408d93=[];for(var _0xc1162f in _0x2980b4){if(_0x2980b4['hasOwnProperty'](_0xc1162f)){_0x2a201a['priority']=0x2;_0x2a201a[_0xeff1('0xe')]=[];_0x2a201a[_0xeff1('0xf')]=_[_0xeff1('0x10')](_0xe4a458,{'exten':_0x2980b4[_0xc1162f][0x0]['exten']});_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':util['format'](_0xeff1('0x14'),_0x2980b4[_0xc1162f][0x0]['type']),'context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});if(_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')]==='inbound'){_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')],'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0]['VoiceExtensionId']});}else if(_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')]===_0xeff1('0x18')){if(_0x2a201a[_0xeff1('0xf')]){_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x19')+(_0x2a201a[_0xeff1('0xf')]['cutdigits']?_0xeff1('0x1a')+_0x2a201a[_0xeff1('0xf')][_0xeff1('0x1b')]+'}':'${EXTEN}'),'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});}_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x1c')+_0x2980b4[_0xc1162f][0x0]['VoiceExtensionId'],'context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});var _0x57b6fc=_0x2a201a[_0xeff1('0x15')]++;_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':'ExecIf','appdata':_0xeff1('0x1d')+(_0x57b6fc+0x2)+_0xeff1('0x1e')+(_0x57b6fc+0x1)+')','context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x57b6fc,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});if(_0x2a201a['extension']){_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0x2a201a[_0xeff1('0xf')]['cutdigits']?_0xeff1('0x1f')+_0x2a201a[_0xeff1('0xf')][_0xeff1('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a['priority']++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});}_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x20')+_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')],'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0]['exten'],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});if(_0x2a201a[_0xeff1('0xf')]&&_0x2a201a[_0xeff1('0xf')]['hasOwnProperty']('recordingFormat')&&_0x2a201a[_0xeff1('0xf')][_0xeff1('0x21')]!==_0xeff1('0x22')){_0x2a201a['extensions'][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x23'),'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0]['exten'],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0]['VoiceExtensionId']});_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x24')+_0x2a201a[_0xeff1('0xf')]['recordingFormat']||_0xeff1('0x25'),'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});}}_0x2a201a['extensions']['push']({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x26'),'context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0]['type'],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x27'),'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a['priority']++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});_0x2a201a[_0xeff1('0xe')][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x28'),'context':_0x2980b4[_0xc1162f][0x0]['context'],'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'priority':_0x2a201a[_0xeff1('0x15')]++,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0]['VoiceExtensionId']});for(var _0x17288d=0x0,_0x1b6a8a=0x0;_0x17288d<_0x2980b4[_0xc1162f][_0xeff1('0x29')];_0x17288d+=0x1,_0x1b6a8a=0x0){var _0x42e8cc=_0x2980b4[_0xc1162f][_0x17288d];if(_0x42e8cc[_0xeff1('0x12')]){_0x42e8cc[_0xeff1('0x12')]=_0x42e8cc['type'][_0xeff1('0x2a')]();}var _0xa61905=[];var _0x5e6016=[];delete _0x42e8cc['id'];delete _0x42e8cc[_0xeff1('0x2b')];delete _0x42e8cc[_0xeff1('0x2c')];var _0x33b298=_0x42e8cc['interval']!=='*,*,*,*'?[_0x42e8cc[_0xeff1('0x2d')]]:_0x42e8cc[_0xeff1('0x2e')]?_['map'](_[_0xeff1('0x9')](_0x2a201a['intervals'],{'IntervalId':_0x42e8cc[_0xeff1('0x2e')]}),_0xeff1('0x2d')):[];if(_0x42e8cc[_0xeff1('0x2f')]('tag')){if(_0x42e8cc[_0xeff1('0x30')]&&_0x42e8cc[_0xeff1('0x30')]!=='--'){_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc[_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x31')+_0x42e8cc[_0xeff1('0x30')],'context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc[_0xeff1('0xb')],'priority':_0x33b298[_0xeff1('0x29')]+_0x2a201a[_0xeff1('0x15')]+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});}}if(_0x42e8cc[_0xeff1('0x12')]===_0xeff1('0x18')&&_0x42e8cc[_0xeff1('0x2f')](_0xeff1('0x32'))){if(_0x42e8cc[_0xeff1('0x32')]){_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc[_0xeff1('0x12')],'app':_0xeff1('0x33'),'appdata':_0xeff1('0x34')+_0x42e8cc['callerID']+')','context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc['exten'],'priority':_0x33b298['length']+_0x2a201a[_0xeff1('0x15')]+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});}else{_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc['type'],'app':'ExecIf','appdata':_0xeff1('0x35'),'context':_0x42e8cc['context'],'exten':_0x42e8cc[_0xeff1('0xb')],'priority':_0x33b298['length']+_0x2a201a[_0xeff1('0x15')]+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});}}if(_0x42e8cc[_0xeff1('0x2f')](_0xeff1('0x36'))){if(_0x3a911b['indexOf'](_0x42e8cc[_0xeff1('0x37')][_0xeff1('0x2a')]())>=0x0&&_0x42e8cc[_0xeff1('0x38')]!==_0xeff1('0x39')){if(_0x42e8cc[_0xeff1('0x36')]){_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc[_0xeff1('0x12')],'app':_0xeff1('0x33'),'appdata':_0xeff1('0x3a'),'context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc['exten'],'priority':_0x33b298[_0xeff1('0x29')]+_0x2a201a[_0xeff1('0x15')]+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc[_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':_0xeff1('0x3b'),'context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc[_0xeff1('0xb')],'priority':_0x33b298['length']+_0x2a201a['priority']+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});}else{_0xa61905[_0xeff1('0x11')]({'type':_0x42e8cc[_0xeff1('0x12')],'app':'ExecIf','appdata':_0xeff1('0x3c'),'context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc[_0xeff1('0xb')],'priority':_0x33b298[_0xeff1('0x29')]+_0x2a201a['priority']+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});_0xa61905['push']({'type':_0x42e8cc[_0xeff1('0x12')],'app':_0xeff1('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x42e8cc[_0xeff1('0x17')],'exten':_0x42e8cc[_0xeff1('0xb')],'priority':_0x33b298['length']+_0x2a201a[_0xeff1('0x15')]+_0x1b6a8a++,'VoiceExtensionId':_0x42e8cc[_0xeff1('0x16')]});}}}for(var _0x2d96b8=0x0;_0x2d96b8<_0x33b298['length'];_0x2d96b8+=0x1){var _0x356ffa=_0x2a201a['priority']+_0x33b298[_0xeff1('0x29')];var _0x23cc53=_0x2d96b8===_0x33b298['length']-0x1?_0x2a201a[_0xeff1('0x15')]+_0xa61905['length']+_0x5e6016[_0xeff1('0x29')]+0x2:_0x2a201a[_0xeff1('0x15')]+_0x2d96b8+0x1;_0xa61905[_0xeff1('0x3d')](_0x2d96b8,0x0,{'type':_0x42e8cc['type'],'app':'GotoIfTime','appdata':_0x33b298[_0x2d96b8]+'?'+_0x42e8cc['context']+',${EXTEN},'+_0x356ffa+':'+_0x42e8cc[_0xeff1('0x17')]+_0xeff1('0x3e')+_0x23cc53,'exten':_0x42e8cc[_0xeff1('0xb')],'context':_0x42e8cc[_0xeff1('0x17')],'priority':_0x2a201a[_0xeff1('0x15')]+_0x2d96b8,'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});}_0x42e8cc[_0xeff1('0x15')]=_0xa61905[_0xeff1('0x29')]?_[_0xeff1('0x3f')](_0xa61905)[_0xeff1('0x15')]+0x1:_0x2a201a['priority'];_0x2a201a[_0xeff1('0x15')]=(_0x5e6016[_0xeff1('0x29')]?_[_0xeff1('0x3f')](_0x5e6016)[_0xeff1('0x15')]:_0x42e8cc['priority'])+0x1;_0x2a201a[_0xeff1('0xe')]=_[_0xeff1('0x40')](_0x2a201a[_0xeff1('0xe')],_0xa61905,[_0x42e8cc],_0x5e6016);}_0x2a201a['extensions'][_0xeff1('0x11')]({'type':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x12')],'app':_0xeff1('0x41'),'exten':_0x2980b4[_0xc1162f][0x0][_0xeff1('0xb')],'context':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x17')],'priority':_0x2a201a['priority'],'VoiceExtensionId':_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]});_0x3ddfc4['push'](_0x2980b4[_0xc1162f][0x0][_0xeff1('0x16')]);_0x408d93=_['concat'](_0x408d93,_0x2a201a[_0xeff1('0xe')]);}}return _0xd7f1ae['transaction'](function(_0x556500){return _0xd7f1ae['models'][_0xeff1('0x6')][_0xeff1('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3ddfc4}},'transaction':_0x556500})[_0xeff1('0x4')](function(_0x29d616){return _0xd7f1ae[_0xeff1('0x1')][_0xeff1('0x6')][_0xeff1('0x43')](_[_0xeff1('0x44')](_0x408d93,_0xeff1('0x15')),{'transaction':_0x556500});});});})['catch'](function(_0x384fe6){console[_0xeff1('0x45')](_0x384fe6);});}exports[_0xeff1('0x46')]=rewrite; \ No newline at end of file +var _0x97ae=['*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','last','concat','Hangup','sortBy','catch','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt'];(function(_0x1bb9c6,_0x31276f){var _0x20f374=function(_0x6bd9cd){while(--_0x6bd9cd){_0x1bb9c6['push'](_0x1bb9c6['shift']());}};_0x20f374(++_0x31276f);}(_0x97ae,0x146));var _0xe97a=function(_0x339970,_0x9e32c0){_0x339970=_0x339970-0x0;var _0xb69daa=_0x97ae[_0x339970];return _0xb69daa;};'use strict';var _=require('lodash');var util=require(_0xe97a('0x0'));function rewrite(_0xab686e,_0x5d0783){var _0x230d43=this;return _0xab686e[_0xe97a('0x1')][_0xe97a('0x2')][_0xe97a('0x3')]({'raw':!![]})[_0xe97a('0x4')](function(_0x34cf3c){_0x230d43[_0xe97a('0x5')]=_0x34cf3c;return _0xab686e[_0xe97a('0x1')][_0xe97a('0x6')]['findAll']({'where':{'IntervalId':_0x5d0783[_0xe97a('0x7')]},'raw':!![]});})[_0xe97a('0x4')](function(_0x310395){return _0xab686e[_0xe97a('0x1')][_0xe97a('0x6')][_0xe97a('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xe97a('0x8')](_0x310395,_0xe97a('0x9')))}},'order':[{'raw':_0xe97a('0xa')}],'raw':!![]});})[_0xe97a('0x4')](function(_0x346961){var _0x55c345=_[_0xe97a('0xb')](_0x346961,{'priority':'1'});var _0x250d80=_[_0xe97a('0xb')](_0x346961,{'isApp':0x1});var _0x5390ba=_['groupBy'](_0x250d80,_0xe97a('0x9'));var _0x4af16f=['queue',_0xe97a('0xc')];var _0x318dee=[];var _0x4dedcf=[];for(var _0x2aa67c in _0x5390ba){if(_0x5390ba[_0xe97a('0xd')](_0x2aa67c)){_0x230d43[_0xe97a('0xe')]=0x2;_0x230d43[_0xe97a('0xf')]=[];_0x230d43[_0xe97a('0x10')]=_[_0xe97a('0x11')](_0x55c345,{'exten':_0x5390ba[_0x2aa67c][0x0]['exten']});_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':util[_0xe97a('0x15')](_0xe97a('0x16'),_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')]),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0]['exten'],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});if(_0x5390ba[_0x2aa67c][0x0]['type']===_0xe97a('0x18')){_0x230d43['extensions'][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x19')+_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId'],'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43['priority']++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});}else if(_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')]===_0xe97a('0x1a')){if(_0x230d43[_0xe97a('0x10')]){_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x1b')+(_0x230d43[_0xe97a('0x10')][_0xe97a('0x1c')]?_0xe97a('0x1d')+_0x230d43[_0xe97a('0x10')][_0xe97a('0x1c')]+'}':_0xe97a('0x1e')),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});}_0x230d43[_0xe97a('0xf')]['push']({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x19')+_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')],'context':_0x5390ba[_0x2aa67c][0x0]['context'],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});var _0x398b6c=_0x230d43['priority']++;_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x20'),'appdata':_0xe97a('0x21')+(_0x398b6c+0x2)+'):Goto('+(_0x398b6c+0x1)+')','context':_0x5390ba[_0x2aa67c][0x0]['context'],'exten':_0x5390ba[_0x2aa67c][0x0]['exten'],'priority':_0x398b6c,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});if(_0x230d43[_0xe97a('0x10')]){_0x230d43[_0xe97a('0xf')]['push']({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0x230d43[_0xe97a('0x10')][_0xe97a('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x230d43['extension'][_0xe97a('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});}_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId'],'context':_0x5390ba[_0x2aa67c][0x0]['context'],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43['priority']++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});if(_0x230d43[_0xe97a('0x10')]&&_0x230d43[_0xe97a('0x10')]['hasOwnProperty']('recordingFormat')&&_0x230d43['extension'][_0xe97a('0x22')]!==_0xe97a('0x23')){_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x24'),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0]['exten'],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});_0x230d43['extensions']['push']({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x25')+_0x230d43[_0xe97a('0x10')]['recordingFormat']||_0xe97a('0x26'),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0]['exten'],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});}}_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x27'),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});_0x230d43['extensions']['push']({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':'Set','appdata':_0xe97a('0x28'),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43[_0xe97a('0xe')]++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0]['type'],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x29'),'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'priority':_0x230d43['priority']++,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x1f')]});for(var _0x3bf00a=0x0,_0x4e0b0d=0x0;_0x3bf00a<_0x5390ba[_0x2aa67c][_0xe97a('0x2a')];_0x3bf00a+=0x1,_0x4e0b0d=0x0){var _0x479492=_0x5390ba[_0x2aa67c][_0x3bf00a];if(_0x479492[_0xe97a('0x13')]){_0x479492[_0xe97a('0x13')]=_0x479492[_0xe97a('0x13')][_0xe97a('0x2b')]();}var _0x5dbda8=[];var _0x5ee6fc=[];delete _0x479492['id'];delete _0x479492[_0xe97a('0x2c')];delete _0x479492[_0xe97a('0x2d')];var _0x4a5d42=_0x479492['interval']!==_0xe97a('0x2e')?[_0x479492['interval']]:_0x479492[_0xe97a('0x7')]?_[_0xe97a('0x8')](_['filter'](_0x230d43['intervals'],{'IntervalId':_0x479492[_0xe97a('0x7')]}),_0xe97a('0x2f')):[];if(_0x479492[_0xe97a('0xd')](_0xe97a('0x30'))){if(_0x479492[_0xe97a('0x30')]&&_0x479492[_0xe97a('0x30')]!=='--'){_0x5dbda8['push']({'type':_0x479492[_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x31')+_0x479492['tag'],'context':_0x479492[_0xe97a('0x17')],'exten':_0x479492['exten'],'priority':_0x4a5d42[_0xe97a('0x2a')]+_0x230d43[_0xe97a('0xe')]+_0x4e0b0d++,'VoiceExtensionId':_0x479492[_0xe97a('0x1f')]});}}if(_0x479492[_0xe97a('0x13')]==='outbound'&&_0x479492[_0xe97a('0xd')](_0xe97a('0x32'))){if(_0x479492[_0xe97a('0x32')]){_0x5dbda8[_0xe97a('0x12')]({'type':_0x479492[_0xe97a('0x13')],'app':_0xe97a('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x479492[_0xe97a('0x32')]+')','context':_0x479492[_0xe97a('0x17')],'exten':_0x479492['exten'],'priority':_0x4a5d42[_0xe97a('0x2a')]+_0x230d43['priority']+_0x4e0b0d++,'VoiceExtensionId':_0x479492[_0xe97a('0x1f')]});}else{_0x5dbda8[_0xe97a('0x12')]({'type':_0x479492['type'],'app':'ExecIf','appdata':_0xe97a('0x33'),'context':_0x479492[_0xe97a('0x17')],'exten':_0x479492[_0xe97a('0x9')],'priority':_0x4a5d42[_0xe97a('0x2a')]+_0x230d43[_0xe97a('0xe')]+_0x4e0b0d++,'VoiceExtensionId':_0x479492['VoiceExtensionId']});}}if(_0x479492['hasOwnProperty'](_0xe97a('0x34'))){if(_0x4af16f['indexOf'](_0x479492[_0xe97a('0x35')]['toLowerCase']())>=0x0&&_0x479492['appType']!=='custom'){if(_0x479492[_0xe97a('0x34')]){_0x5dbda8[_0xe97a('0x12')]({'type':_0x479492[_0xe97a('0x13')],'app':_0xe97a('0x20'),'appdata':_0xe97a('0x36'),'context':_0x479492[_0xe97a('0x17')],'exten':_0x479492[_0xe97a('0x9')],'priority':_0x4a5d42[_0xe97a('0x2a')]+_0x230d43[_0xe97a('0xe')]+_0x4e0b0d++,'VoiceExtensionId':_0x479492[_0xe97a('0x1f')]});_0x5dbda8['push']({'type':_0x479492[_0xe97a('0x13')],'app':_0xe97a('0x14'),'appdata':_0xe97a('0x37'),'context':_0x479492[_0xe97a('0x17')],'exten':_0x479492['exten'],'priority':_0x4a5d42['length']+_0x230d43[_0xe97a('0xe')]+_0x4e0b0d++,'VoiceExtensionId':_0x479492[_0xe97a('0x1f')]});}else{_0x5dbda8[_0xe97a('0x12')]({'type':_0x479492[_0xe97a('0x13')],'app':_0xe97a('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x479492[_0xe97a('0x17')],'exten':_0x479492[_0xe97a('0x9')],'priority':_0x4a5d42[_0xe97a('0x2a')]+_0x230d43['priority']+_0x4e0b0d++,'VoiceExtensionId':_0x479492[_0xe97a('0x1f')]});_0x5dbda8[_0xe97a('0x12')]({'type':_0x479492['type'],'app':_0xe97a('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x479492[_0xe97a('0x17')],'exten':_0x479492[_0xe97a('0x9')],'priority':_0x4a5d42['length']+_0x230d43['priority']+_0x4e0b0d++,'VoiceExtensionId':_0x479492['VoiceExtensionId']});}}}for(var _0x43699f=0x0;_0x43699f<_0x4a5d42[_0xe97a('0x2a')];_0x43699f+=0x1){var _0x2971b0=_0x230d43[_0xe97a('0xe')]+_0x4a5d42[_0xe97a('0x2a')];var _0x4b079c=_0x43699f===_0x4a5d42['length']-0x1?_0x230d43[_0xe97a('0xe')]+_0x5dbda8[_0xe97a('0x2a')]+_0x5ee6fc['length']+0x2:_0x230d43[_0xe97a('0xe')]+_0x43699f+0x1;_0x5dbda8[_0xe97a('0x38')](_0x43699f,0x0,{'type':_0x479492[_0xe97a('0x13')],'app':'GotoIfTime','appdata':_0x4a5d42[_0x43699f]+'?'+_0x479492[_0xe97a('0x17')]+',${EXTEN},'+_0x2971b0+':'+_0x479492[_0xe97a('0x17')]+',${EXTEN},'+_0x4b079c,'exten':_0x479492[_0xe97a('0x9')],'context':_0x479492[_0xe97a('0x17')],'priority':_0x230d43[_0xe97a('0xe')]+_0x43699f,'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});}_0x479492['priority']=_0x5dbda8['length']?_[_0xe97a('0x39')](_0x5dbda8)[_0xe97a('0xe')]+0x1:_0x230d43[_0xe97a('0xe')];_0x230d43[_0xe97a('0xe')]=(_0x5ee6fc[_0xe97a('0x2a')]?_[_0xe97a('0x39')](_0x5ee6fc)[_0xe97a('0xe')]:_0x479492[_0xe97a('0xe')])+0x1;_0x230d43[_0xe97a('0xf')]=_[_0xe97a('0x3a')](_0x230d43[_0xe97a('0xf')],_0x5dbda8,[_0x479492],_0x5ee6fc);}_0x230d43[_0xe97a('0xf')][_0xe97a('0x12')]({'type':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x13')],'app':_0xe97a('0x3b'),'exten':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x9')],'context':_0x5390ba[_0x2aa67c][0x0][_0xe97a('0x17')],'priority':_0x230d43[_0xe97a('0xe')],'VoiceExtensionId':_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']});_0x318dee[_0xe97a('0x12')](_0x5390ba[_0x2aa67c][0x0]['VoiceExtensionId']);_0x4dedcf=_[_0xe97a('0x3a')](_0x4dedcf,_0x230d43[_0xe97a('0xf')]);}}return _0xab686e['transaction'](function(_0x5c7639){return _0xab686e[_0xe97a('0x1')][_0xe97a('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x318dee}},'transaction':_0x5c7639})[_0xe97a('0x4')](function(_0x110641){return _0xab686e['models'][_0xe97a('0x6')]['bulkCreate'](_[_0xe97a('0x3c')](_0x4dedcf,'priority'),{'transaction':_0x5c7639});});});})[_0xe97a('0x3d')](function(_0x5b7e50){console['error'](_0x5b7e50);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6f3256f..8ed669b 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 _0x4f93=['lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','Missing\x20filepath\x20parameter!','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','CmList','BlackLists','Campaign','get','CampaignId','all','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','SIGINT','info','resolve','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x4f93,0x1c2));var _0x34f9=function(_0x3e24f6,_0x375d27){_0x3e24f6=_0x3e24f6-0x0;var _0x46d9f4=_0x4f93[_0x3e24f6];return _0x46d9f4;};'use strict';var BPromise=require(_0x34f9('0x0'));var util=require(_0x34f9('0x1'));var _=require(_0x34f9('0x2'));var fs=require('fs');var squel=require(_0x34f9('0x3'));var Papa=require('papaparse');var Redis=require(_0x34f9('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x34f9('0x5'));var logger=require(_0x34f9('0x6'))(_0x34f9('0x7'));config['redis']=_[_0x34f9('0x8')](config[_0x34f9('0x9')],{'host':_0x34f9('0xa'),'port':0x18eb});var socket=require(_0x34f9('0xb'))(new Redis(config[_0x34f9('0x9')]));require(_0x34f9('0xc'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x34f9('0xd')][0x2]==='undefined'||process[_0x34f9('0xd')][0x2]==='null'){throw new Error(_0x34f9('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x34f9('0xd')][0x3]===_0x34f9('0xf')||process[_0x34f9('0xd')][0x3]==='null'||!process['argv'][0x4]||process[_0x34f9('0xd')][0x4]===_0x34f9('0xf')||process[_0x34f9('0xd')][0x4]===_0x34f9('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x34f9('0x11')](process[_0x34f9('0xd')][0x3][_0x34f9('0x12')](','),process[_0x34f9('0xd')][0x4]['split'](','));if(!process[_0x34f9('0xd')][0x5]||process[_0x34f9('0xd')][0x5]==='undefined'||process[_0x34f9('0xd')][0x5]==='null'){throw new Error(_0x34f9('0x13'));}var LISTID=process[_0x34f9('0xd')][0x5];var COMPANYID=process[_0x34f9('0xd')][0x6]&&process[_0x34f9('0xd')][0x6]!==_0x34f9('0xf')&&process[_0x34f9('0xd')][0x6]!==_0x34f9('0x10')?process[_0x34f9('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x34f9('0xf')&&process['argv'][0x7]!==_0x34f9('0x10')?process['argv'][0x7]:null;if(!process[_0x34f9('0xd')][0x8]||process[_0x34f9('0xd')][0x8]===_0x34f9('0xf')||process[_0x34f9('0xd')][0x8]==='null'){throw new Error(_0x34f9('0x14'));}var SOCKET_TIMESTAMP=process[_0x34f9('0xd')][0x8];}catch(_0x431dcc){logger[_0x34f9('0x15')](_0x431dcc);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(_0x398b7b,_0x43bd8a,_0x482d19,_0x1c9cef){var _0x4221ec={'message':_0x43bd8a};_0x4221ec[_0x398b7b]=!![];if(_0x482d19){_0x4221ec['contact']=_0x482d19;}if(_0x1c9cef){_0x4221ec[_0x34f9('0x16')]=_0x1c9cef;}return _0x4221ec;}function isEmail(_0xbff014){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'](_0xbff014);}function checkRow(_0x5b82ba,_0x1a6768,_0xaadfb7){return new BPromise(function(_0x35d61a,_0x24bc69){if(_[_0x34f9('0x17')](_0x5b82ba)){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),_0x34f9('0x18'),null,_0xaadfb7));}if(_0x5b82ba[_0x34f9('0x19')]&&_0x5b82ba[_0x34f9('0x19')]['length']){var _0x4a5c3c=_[_0x34f9('0x1a')](_0x5b82ba[_0x34f9('0x19')],'message')[_0x34f9('0x1b')](';');return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),_0x4a5c3c,null,_0xaadfb7));}var _0x50b79a={};for(var _0x34035d in FIELDS){if(FIELDS[_0x34f9('0x1c')](_0x34035d)&&FIELDS[_0x34035d]){_0x50b79a[_0x34035d]=_0x5b82ba[_0x34f9('0x1d')][0x0][FIELDS[_0x34035d]]||_0x5b82ba[_0x34f9('0x1d')][0x0]['\ufeff'+FIELDS[_0x34035d]];}}if(!_0x50b79a[_0x34f9('0x1e')]){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),_0x34f9('0x1f'),null,_0xaadfb7));}if(!_0x50b79a[_0x34f9('0x20')]){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),_0x34f9('0x21'),null,_0xaadfb7));}if(_0x50b79a['birthDate']){var _0x57f84c=moment(_0x50b79a[_0x34f9('0x22')],_0x34f9('0x23'));if(!_0x57f84c[_0x34f9('0x24')]()){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xaadfb7));}}if(_0x50b79a[_0x34f9('0x25')]){if(!isEmail(_0x50b79a[_0x34f9('0x25')])){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),_0x34f9('0x26'),null,_0xaadfb7));}}_0x50b79a[_0x34f9('0x27')]=LISTID;_0x50b79a[_0x34f9('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x34f9('0x29')]&&_0x1a6768){var _0x32cf3d={};for(var _0x3c64ed=0x0,_0x51b9f0=DUPLICATES['length'];_0x3c64ed<_0x51b9f0;_0x3c64ed+=0x1){_0x32cf3d[DUPLICATES[_0x3c64ed]]=_0x50b79a[DUPLICATES[_0x3c64ed]];}var _0x20b930=_[_0x34f9('0x2a')](_0x1a6768,_0x32cf3d);if(_0x20b930){return _0x24bc69(handleCheckRowError(_0x34f9('0x2b'),_0x34f9('0x2c'),_0x20b930,_0xaadfb7));}}return db[_0x34f9('0x2d')][_0x34f9('0x2e')](_0x50b79a,{'raw':!![],'hooks':![],'fields':_[_0x34f9('0x2f')](_0x50b79a)})[_0x34f9('0x30')](function(_0x18b693){if(DUPLICATES&&DUPLICATES[_0x34f9('0x29')]&&_0x1a6768){_0x1a6768[_0x34f9('0x31')](_[_0x34f9('0x32')](_0x50b79a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18b693['id'];return _0x35d61a();})[_0x34f9('0x33')](function(_0x26a0c8){return _0x24bc69(handleCheckRowError(_0x34f9('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26a0c8[_0x34f9('0x34')]||JSON[_0x34f9('0x35')](_0x26a0c8)),null,_0xaadfb7));});});}function checkHopper(){function _0x2f6d23(){return function(_0x2af7a6){logger[_0x34f9('0x15')](_0x34f9('0x36'),_0x34f9('0x37'),util[_0x34f9('0x38')](_0x2af7a6,{'showHidden':![],'depth':null}));};}var _0xce52da=function(_0x41f5b1,_0x10dbd5){var _0x41e1cb=squel[_0x34f9('0x39')]()[_0x34f9('0x3a')](_0x34f9('0x3b'))[_0x34f9('0x3c')]([_0x34f9('0x20'),_0x34f9('0x3d'),_0x34f9('0x3e'),'ListId',_0x10dbd5,_0x34f9('0x3f'),_0x34f9('0x40')],squel[_0x34f9('0x41')]()[_0x34f9('0x42')](_0x34f9('0x20'),_0x34f9('0x20'))[_0x34f9('0x42')]('NOW()','scheduledAt')[_0x34f9('0x42')]('id',_0x34f9('0x3e'))['field'](LISTID[_0x34f9('0x43')](),'ListId')['field'](_0x41f5b1['id']['toString'](),_0x10dbd5)[_0x34f9('0x42')](_0x34f9('0x44'),_0x34f9('0x3f'))['field'](_0x34f9('0x44'),_0x34f9('0x40'))[_0x34f9('0x45')](_0x34f9('0x46'))[_0x34f9('0x47')](_0x34f9('0x48'))[_0x34f9('0x47')](_0x34f9('0x49'),LISTID[_0x34f9('0x43')]())[_0x34f9('0x47')](_0x34f9('0x4a'))[_0x34f9('0x47')](_0x34f9('0x4b'),squel['select']()[_0x34f9('0x42')]('phone')[_0x34f9('0x45')]('cm_hopper')[_0x34f9('0x47')](_0x10dbd5+_0x34f9('0x4c'),_0x41f5b1['id'][_0x34f9('0x43')]())))[_0x34f9('0x43')]();return _0x41e1cb;};var _0x313071=function(_0x4d161b,_0x3196a1){var _0x4251e8=squel[_0x34f9('0x39')]()['into'](_0x34f9('0x3b'))[_0x34f9('0x3c')]([_0x34f9('0x20'),_0x34f9('0x3d'),_0x34f9('0x3e'),'ListId',_0x3196a1,_0x34f9('0x3f'),_0x34f9('0x40')],squel[_0x34f9('0x41')]()[_0x34f9('0x42')](_0x34f9('0x20'),'phone')[_0x34f9('0x42')]('NOW()','scheduledAt')[_0x34f9('0x42')]('id',_0x34f9('0x3e'))[_0x34f9('0x42')](LISTID[_0x34f9('0x43')](),_0x34f9('0x27'))[_0x34f9('0x42')](_0x4d161b['id'][_0x34f9('0x43')](),_0x3196a1)[_0x34f9('0x42')](_0x34f9('0x44'),_0x34f9('0x3f'))[_0x34f9('0x42')]('NOW()','updatedAt')[_0x34f9('0x45')](_0x34f9('0x46'))['where'](_0x34f9('0x48'))[_0x34f9('0x47')](_0x34f9('0x49'),LISTID['toString']())[_0x34f9('0x47')](_0x34f9('0x4d'),squel[_0x34f9('0x4e')](hopperContacts))['where'](_0x34f9('0x4a'))['where'](_0x34f9('0x4b'),squel[_0x34f9('0x41')]()['field'](_0x34f9('0x4f'))[_0x34f9('0x45')](_0x34f9('0x50'))[_0x34f9('0x47')](_0x3196a1+'\x20=\x20?',_0x4d161b['id'][_0x34f9('0x43')]()))[_0x34f9('0x47')](_0x34f9('0x4b'),squel[_0x34f9('0x41')]()['field']('phone')['from'](_0x34f9('0x3b'))[_0x34f9('0x47')](_0x3196a1+'\x20=\x20?',_0x4d161b['id'][_0x34f9('0x43')]())))[_0x34f9('0x43')]();return _0x4251e8;};function _0x33b5aa(_0xace384,_0x4cad9a){var _0x14f02d=squel[_0x34f9('0x39')]()[_0x34f9('0x3a')](_0x34f9('0x3b'))['fromQuery']([_0x34f9('0x20'),'scheduledAt',_0x34f9('0x3e'),_0x34f9('0x27'),_0x4cad9a,'createdAt',_0x34f9('0x40')],squel[_0x34f9('0x41')]()[_0x34f9('0x42')](_0x34f9('0x20'),_0x34f9('0x20'))[_0x34f9('0x42')](_0x34f9('0x44'),'scheduledAt')[_0x34f9('0x42')]('id','ContactId')[_0x34f9('0x42')](LISTID[_0x34f9('0x43')](),_0x34f9('0x27'))[_0x34f9('0x42')](_0xace384['id'][_0x34f9('0x43')](),_0x4cad9a)[_0x34f9('0x42')](_0x34f9('0x44'),_0x34f9('0x3f'))[_0x34f9('0x42')](_0x34f9('0x44'),'updatedAt')['from'](_0x34f9('0x46'))[_0x34f9('0x47')](_0x34f9('0x48'))['where'](_0x34f9('0x49'),LISTID[_0x34f9('0x43')]())[_0x34f9('0x47')](_0x34f9('0x4d'),squel['str'](hopperContacts))[_0x34f9('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x34f9('0x43')]();return _0x14f02d;}function _0x1cfca6(_0x29fe13,_0x5d5a09){var _0x4a3f55=squel['insert']()[_0x34f9('0x3a')](_0x34f9('0x51'))['fromQuery']([_0x34f9('0x20'),_0x34f9('0x3e'),_0x34f9('0x27'),_0x5d5a09,_0x34f9('0x3f'),_0x34f9('0x40')],squel['select']()[_0x34f9('0x42')]('phone',_0x34f9('0x20'))[_0x34f9('0x42')]('id',_0x34f9('0x3e'))[_0x34f9('0x42')](LISTID[_0x34f9('0x43')](),_0x34f9('0x27'))[_0x34f9('0x42')](_0x29fe13['id']['toString'](),_0x5d5a09)['field'](_0x34f9('0x44'),_0x34f9('0x3f'))[_0x34f9('0x42')](_0x34f9('0x44'),_0x34f9('0x40'))[_0x34f9('0x45')](_0x34f9('0x46'))['where']('deletedAt\x20IS\x20NULL')[_0x34f9('0x47')](_0x34f9('0x49'),LISTID[_0x34f9('0x43')]())[_0x34f9('0x47')](_0x34f9('0x4d'),squel[_0x34f9('0x4e')](hopperContacts))[_0x34f9('0x47')](_0x34f9('0x4a')))[_0x34f9('0x43')]();return _0x4a3f55;}return db[_0x34f9('0x52')][_0x34f9('0x53')]({'where':{'type':_0x34f9('0x54')},'attributes':['id',_0x34f9('0x55')],'include':[{'model':db['CmList'],'as':_0x34f9('0x56'),'where':{'id':LISTID}}]})[_0x34f9('0x30')](function(_0x35738b){var _0x31cc1f=[];if(_0x35738b){var _0x2af758;for(var _0x2bcd93=0x0,_0x4a4e96;_0x2bcd93<_0x35738b[_0x34f9('0x29')];_0x2bcd93+=0x1){_0x4a4e96=_0x35738b[_0x2bcd93]['get']({'plain':!![]});switch(_0x4a4e96[_0x34f9('0x55')]){case _0x34f9('0x57'):_0x31cc1f[_0x34f9('0x31')](db['sequelize'][_0x34f9('0x58')](_0x313071(_0x4a4e96,_0x34f9('0x59')))[_0x34f9('0x30')](function(){})[_0x34f9('0x33')](_0x2f6d23()));break;case _0x34f9('0x5a'):_0x31cc1f[_0x34f9('0x31')](db['sequelize'][_0x34f9('0x58')](_0xce52da(_0x4a4e96,'VoiceQueueId'))[_0x34f9('0x30')](function(){})[_0x34f9('0x33')](_0x2f6d23()));break;default:_0x31cc1f['push'](db[_0x34f9('0x5b')][_0x34f9('0x58')](_0x33b5aa(_0x4a4e96,'VoiceQueueId'))[_0x34f9('0x30')](function(){})[_0x34f9('0x33')](_0x2f6d23()));}}}return _0x31cc1f;})['all']()[_0x34f9('0x30')](function(){return db[_0x34f9('0x52')][_0x34f9('0x53')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x34f9('0x5c')],'as':_0x34f9('0x5d'),'where':{'id':LISTID}}]})[_0x34f9('0x30')](function(_0xd95723){var _0x27c1d9=[];if(_0xd95723){var _0x36bb17;for(var _0x5256ca=0x0,_0x4e8ea6;_0x5256ca<_0xd95723[_0x34f9('0x29')];_0x5256ca+=0x1){_0x4e8ea6=_0xd95723[_0x5256ca]['get']({'plain':!![]});_0x27c1d9[_0x34f9('0x31')](db['sequelize'][_0x34f9('0x58')](_0x1cfca6(_0x4e8ea6,'VoiceQueueId'))[_0x34f9('0x30')](function(){})['catch'](_0x2f6d23()));}}return _0x27c1d9;})['all']();})['then'](function(){return db[_0x34f9('0x5e')][_0x34f9('0x53')]({'attributes':['id',_0x34f9('0x55')],'include':[{'model':db['CmList'],'as':_0x34f9('0x56'),'where':{'id':LISTID}}]})[_0x34f9('0x30')](function(_0x4df51b){var _0x2e96ba=[];if(_0x4df51b){for(var _0x5be178=0x0,_0x33bab7;_0x5be178<_0x4df51b[_0x34f9('0x29')];_0x5be178+=0x1){_0x33bab7=_0x4df51b[_0x5be178][_0x34f9('0x5f')]({'plain':!![]});switch(_0x33bab7[_0x34f9('0x55')]){case _0x34f9('0x57'):_0x2e96ba['push'](db[_0x34f9('0x5b')][_0x34f9('0x58')](_0x313071(_0x33bab7,'CampaignId'))[_0x34f9('0x30')](function(){})[_0x34f9('0x33')](_0x2f6d23()));break;case _0x34f9('0x5a'):_0x2e96ba[_0x34f9('0x31')](db[_0x34f9('0x5b')][_0x34f9('0x58')](_0xce52da(_0x33bab7,_0x34f9('0x60')))['then'](function(){})[_0x34f9('0x33')](_0x2f6d23()));break;default:_0x2e96ba[_0x34f9('0x31')](db[_0x34f9('0x5b')][_0x34f9('0x58')](_0x33b5aa(_0x33bab7,_0x34f9('0x60')))[_0x34f9('0x30')](function(){})['catch'](_0x2f6d23()));}}}return _0x2e96ba;})[_0x34f9('0x61')]();})['then'](function(){return db['Campaign'][_0x34f9('0x53')]({'attributes':['id'],'include':[{'model':db[_0x34f9('0x5c')],'as':_0x34f9('0x5d'),'where':{'id':LISTID}}]})['then'](function(_0x7f6dae){var _0x1695e1=[];if(_0x7f6dae){for(var _0x41ba23=0x0,_0x20bd79;_0x41ba23<_0x7f6dae[_0x34f9('0x29')];_0x41ba23+=0x1){_0x20bd79=_0x7f6dae[_0x41ba23][_0x34f9('0x5f')]({'plain':!![]});_0x1695e1[_0x34f9('0x31')](db[_0x34f9('0x5b')][_0x34f9('0x58')](_0x1cfca6(_0x20bd79,'CampaignId'))[_0x34f9('0x30')](function(){})[_0x34f9('0x33')](_0x2f6d23()));}}return _0x1695e1;})[_0x34f9('0x61')]();})['catch'](function(_0x4312b3){logger[_0x34f9('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4312b3['message']);});}var processPromises=function(_0x367993){return BPromise[_0x34f9('0x61')](promises)[_0x34f9('0x30')](function(_0x28dd3c){})[_0x34f9('0x33')](function(_0x406cba){logger[_0x34f9('0x15')](_0x34f9('0x62'),JSON[_0x34f9('0x35')](_0x406cba));})[_0x34f9('0x63')](function(){socket[_0x34f9('0x64')](_0x34f9('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x367993){return _0x367993[_0x34f9('0x66')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x34f9('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x34f9('0x30')](function(){socket['emit'](_0x34f9('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x34f9('0x67')](FILEPATH);}catch(_0xcfdb83){logger[_0x34f9('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x34f9('0x35')](_0xcfdb83));}finally{process[_0x34f9('0x68')](0x0);}});};process['on'](_0x34f9('0x69'),function(){logger[_0x34f9('0x6a')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x34f9('0x6b')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x34f9('0x2d')][_0x34f9('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x32796d){var _0x132ec6=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x34f9('0x6c')](_0x132ec6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x45b5ef,_0x4304e7){total+=0x1;var _0x424ba5=total;promises[_0x34f9('0x31')](checkRow(_0x45b5ef,_0x32796d,_0x424ba5)[_0x34f9('0x30')](function(){success+=0x1;})['catch'](function(_0x2a7389){if(_0x2a7389['error']){errors+=0x1;delete _0x2a7389[_0x34f9('0x15')];}else if(_0x2a7389['duplicate']){duplicates+=0x1;delete _0x2a7389[_0x34f9('0x2b')];}rows[_0x34f9('0x31')](_0x2a7389);}));if(total%0xc8===0x0){_0x4304e7[_0x34f9('0x6d')]();return processPromises(_0x4304e7);}},'complete':function(){return processPromises()[_0x34f9('0x30')](function(){logger[_0x34f9('0x6a')](_0x34f9('0x6e'));endCsv();});},'error':function(_0x1d97da,_0x2b5639){logger[_0x34f9('0x6a')](_0x34f9('0x6f'),JSON['stringify'](_0x1d97da));endCsv();}});})['catch'](function(_0x36188c){logger['error'](_0x34f9('0x70'),JSON[_0x34f9('0x35')](_0x36188c));});}main(); \ No newline at end of file +var _0x778a=['exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','errors','length','map','message','join','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','fromQuery','phone','ContactId','updatedAt','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','ListId','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','VoiceQueue','BlackLists','Campaign','CampaignId','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x2503b6,_0x57e9e9){var _0x4ca1ed=function(_0x5b7826){while(--_0x5b7826){_0x2503b6['push'](_0x2503b6['shift']());}};_0x4ca1ed(++_0x57e9e9);}(_0x778a,0xe3));var _0xa778=function(_0xa2ac9,_0xf07f28){_0xa2ac9=_0xa2ac9-0x0;var _0x690e9b=_0x778a[_0xa2ac9];return _0x690e9b;};'use strict';var BPromise=require(_0xa778('0x0'));var util=require('util');var _=require(_0xa778('0x1'));var fs=require('fs');var squel=require(_0xa778('0x2'));var Papa=require(_0xa778('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xa778('0x4'));var logger=require(_0xa778('0x5'))(_0xa778('0x6'));config['redis']=_['defaults'](config[_0xa778('0x7')],{'host':_0xa778('0x8'),'port':0x18eb});var socket=require(_0xa778('0x9'))(new Redis(config[_0xa778('0x7')]));require(_0xa778('0xa'))[_0xa778('0xb')](socket);try{if(!process[_0xa778('0xc')][0x2]||process[_0xa778('0xc')][0x2]===_0xa778('0xd')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xa778('0xc')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xa778('0xd')||process[_0xa778('0xc')][0x3]===_0xa778('0xe')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0xa778('0xc')][0x4]==='null'){throw new Error(_0xa778('0xf'));}var FIELDS=_[_0xa778('0x10')](process[_0xa778('0xc')][0x3][_0xa778('0x11')](','),process[_0xa778('0xc')][0x4][_0xa778('0x11')](','));if(!process['argv'][0x5]||process[_0xa778('0xc')][0x5]===_0xa778('0xd')||process['argv'][0x5]===_0xa778('0xe')){throw new Error(_0xa778('0x12'));}var LISTID=process[_0xa778('0xc')][0x5];var COMPANYID=process[_0xa778('0xc')][0x6]&&process[_0xa778('0xc')][0x6]!==_0xa778('0xd')&&process[_0xa778('0xc')][0x6]!==_0xa778('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa778('0xc')][0x7]&&process[_0xa778('0xc')][0x7]!==_0xa778('0xd')&&process[_0xa778('0xc')][0x7]!==_0xa778('0xe')?process[_0xa778('0xc')][0x7]:null;if(!process[_0xa778('0xc')][0x8]||process['argv'][0x8]===_0xa778('0xd')||process[_0xa778('0xc')][0x8]===_0xa778('0xe')){throw new Error(_0xa778('0x13'));}var SOCKET_TIMESTAMP=process[_0xa778('0xc')][0x8];}catch(_0x14f06a){logger['error'](_0x14f06a);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(_0x1e30df,_0x2aa653,_0x5743ea,_0x383b1b){var _0x237d8d={'message':_0x2aa653};_0x237d8d[_0x1e30df]=!![];if(_0x5743ea){_0x237d8d[_0xa778('0x14')]=_0x5743ea;}if(_0x383b1b){_0x237d8d[_0xa778('0x15')]=_0x383b1b;}return _0x237d8d;}function isEmail(_0x4117d9){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))*$/[_0xa778('0x16')](_0x4117d9);}function checkRow(_0x460bba,_0x28f1b2,_0x34118e){return new BPromise(function(_0x105d93,_0x5c09f1){if(_['isNil'](_0x460bba)){return _0x5c09f1(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x34118e));}if(_0x460bba[_0xa778('0x17')]&&_0x460bba[_0xa778('0x17')][_0xa778('0x18')]){var _0x275bb5=_[_0xa778('0x19')](_0x460bba[_0xa778('0x17')],_0xa778('0x1a'))[_0xa778('0x1b')](';');return _0x5c09f1(handleCheckRowError(_0xa778('0x1c'),_0x275bb5,null,_0x34118e));}var _0x15742e={};for(var _0x4a8f8c in FIELDS){if(FIELDS[_0xa778('0x1d')](_0x4a8f8c)&&FIELDS[_0x4a8f8c]){_0x15742e[_0x4a8f8c]=_0x460bba[_0xa778('0x1e')][0x0][FIELDS[_0x4a8f8c]]||_0x460bba[_0xa778('0x1e')][0x0]['\ufeff'+FIELDS[_0x4a8f8c]];}}if(!_0x15742e[_0xa778('0x1f')]){return _0x5c09f1(handleCheckRowError(_0xa778('0x1c'),_0xa778('0x20'),null,_0x34118e));}if(!_0x15742e['phone']){return _0x5c09f1(handleCheckRowError(_0xa778('0x1c'),_0xa778('0x21'),null,_0x34118e));}if(_0x15742e[_0xa778('0x22')]){var _0x273dfb=moment(_0x15742e[_0xa778('0x22')],_0xa778('0x23'));if(!_0x273dfb['isValid']()){return _0x5c09f1(handleCheckRowError(_0xa778('0x1c'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x34118e));}}if(_0x15742e[_0xa778('0x24')]){if(!isEmail(_0x15742e[_0xa778('0x24')])){return _0x5c09f1(handleCheckRowError('error',_0xa778('0x25'),null,_0x34118e));}}_0x15742e['ListId']=LISTID;_0x15742e[_0xa778('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa778('0x18')]&&_0x28f1b2){var _0x2179be={};for(var _0x369d8c=0x0,_0x99a3d3=DUPLICATES[_0xa778('0x18')];_0x369d8c<_0x99a3d3;_0x369d8c+=0x1){_0x2179be[DUPLICATES[_0x369d8c]]=_0x15742e[DUPLICATES[_0x369d8c]];}var _0x2df719=_[_0xa778('0x27')](_0x28f1b2,_0x2179be);if(_0x2df719){return _0x5c09f1(handleCheckRowError(_0xa778('0x28'),_0xa778('0x29'),_0x2df719,_0x34118e));}}return db[_0xa778('0x2a')][_0xa778('0x2b')](_0x15742e,{'raw':!![],'hooks':![],'fields':_[_0xa778('0x2c')](_0x15742e)})[_0xa778('0x2d')](function(_0x150c73){if(DUPLICATES&&DUPLICATES[_0xa778('0x18')]&&_0x28f1b2){_0x28f1b2[_0xa778('0x2e')](_[_0xa778('0x2f')](_0x15742e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x150c73['id'];return _0x105d93();})[_0xa778('0x30')](function(_0x41ecbd){return _0x5c09f1(handleCheckRowError(_0xa778('0x1c'),_0xa778('0x31')+(_0x41ecbd[_0xa778('0x1a')]||JSON[_0xa778('0x32')](_0x41ecbd)),null,_0x34118e));});});}function checkHopper(){function _0x13e72e(){return function(_0x35096a){logger['error'](_0xa778('0x33'),'checkHopper',util[_0xa778('0x34')](_0x35096a,{'showHidden':![],'depth':null}));};}var _0x26ba24=function(_0x490be1,_0x4116db){var _0x38e792=squel[_0xa778('0x35')]()[_0xa778('0x36')]('cm_hopper')[_0xa778('0x37')]([_0xa778('0x38'),'scheduledAt',_0xa778('0x39'),'ListId',_0x4116db,'createdAt',_0xa778('0x3a')],squel['select']()[_0xa778('0x3b')]('phone',_0xa778('0x38'))['field'](_0xa778('0x3c'),_0xa778('0x3d'))[_0xa778('0x3b')]('id','ContactId')[_0xa778('0x3b')](LISTID[_0xa778('0x3e')](),'ListId')[_0xa778('0x3b')](_0x490be1['id'][_0xa778('0x3e')](),_0x4116db)[_0xa778('0x3b')](_0xa778('0x3c'),'createdAt')[_0xa778('0x3b')](_0xa778('0x3c'),_0xa778('0x3a'))[_0xa778('0x3f')](_0xa778('0x40'))[_0xa778('0x41')](_0xa778('0x42'))[_0xa778('0x41')]('ListId\x20=\x20?',LISTID['toString']())[_0xa778('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xa778('0x41')](_0xa778('0x43'),squel[_0xa778('0x44')]()['field'](_0xa778('0x38'))[_0xa778('0x3f')](_0xa778('0x45'))[_0xa778('0x41')](_0x4116db+'\x20=\x20?',_0x490be1['id']['toString']())))[_0xa778('0x3e')]();return _0x38e792;};var _0x42c32f=function(_0x12d6ea,_0x30f18d){var _0xa85f14=squel['insert']()['into']('cm_hopper')[_0xa778('0x37')]([_0xa778('0x38'),_0xa778('0x3d'),_0xa778('0x39'),_0xa778('0x46'),_0x30f18d,'createdAt',_0xa778('0x3a')],squel[_0xa778('0x44')]()['field'](_0xa778('0x38'),_0xa778('0x38'))['field'](_0xa778('0x3c'),'scheduledAt')[_0xa778('0x3b')]('id',_0xa778('0x39'))[_0xa778('0x3b')](LISTID[_0xa778('0x3e')](),_0xa778('0x46'))[_0xa778('0x3b')](_0x12d6ea['id']['toString'](),_0x30f18d)[_0xa778('0x3b')](_0xa778('0x3c'),_0xa778('0x47'))[_0xa778('0x3b')]('NOW()','updatedAt')[_0xa778('0x3f')]('cm_contacts')[_0xa778('0x41')](_0xa778('0x42'))[_0xa778('0x41')](_0xa778('0x48'),LISTID['toString']())[_0xa778('0x41')](_0xa778('0x49'),squel[_0xa778('0x4a')](hopperContacts))['where'](_0xa778('0x4b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa778('0x44')]()[_0xa778('0x3b')](_0xa778('0x4c'))[_0xa778('0x3f')](_0xa778('0x4d'))[_0xa778('0x41')](_0x30f18d+'\x20=\x20?',_0x12d6ea['id'][_0xa778('0x3e')]()))[_0xa778('0x41')](_0xa778('0x43'),squel[_0xa778('0x44')]()['field'](_0xa778('0x38'))[_0xa778('0x3f')](_0xa778('0x45'))[_0xa778('0x41')](_0x30f18d+_0xa778('0x4e'),_0x12d6ea['id'][_0xa778('0x3e')]())))[_0xa778('0x3e')]();return _0xa85f14;};function _0x49113b(_0x59675f,_0x1c9d00){var _0x33d2cb=squel[_0xa778('0x35')]()[_0xa778('0x36')](_0xa778('0x45'))['fromQuery'](['phone',_0xa778('0x3d'),'ContactId','ListId',_0x1c9d00,_0xa778('0x47'),_0xa778('0x3a')],squel[_0xa778('0x44')]()['field']('phone',_0xa778('0x38'))[_0xa778('0x3b')]('NOW()',_0xa778('0x3d'))[_0xa778('0x3b')]('id',_0xa778('0x39'))[_0xa778('0x3b')](LISTID['toString'](),_0xa778('0x46'))[_0xa778('0x3b')](_0x59675f['id'][_0xa778('0x3e')](),_0x1c9d00)[_0xa778('0x3b')](_0xa778('0x3c'),'createdAt')[_0xa778('0x3b')](_0xa778('0x3c'),'updatedAt')[_0xa778('0x3f')](_0xa778('0x40'))[_0xa778('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0xa778('0x48'),LISTID[_0xa778('0x3e')]())['where'](_0xa778('0x49'),squel[_0xa778('0x4a')](hopperContacts))[_0xa778('0x41')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x33d2cb;}function _0x119c76(_0x6c4720,_0x3261e1){var _0x2477bb=squel['insert']()['into'](_0xa778('0x4f'))['fromQuery']([_0xa778('0x38'),_0xa778('0x39'),'ListId',_0x3261e1,'createdAt','updatedAt'],squel['select']()[_0xa778('0x3b')](_0xa778('0x38'),_0xa778('0x38'))['field']('id',_0xa778('0x39'))[_0xa778('0x3b')](LISTID[_0xa778('0x3e')](),_0xa778('0x46'))[_0xa778('0x3b')](_0x6c4720['id'][_0xa778('0x3e')](),_0x3261e1)[_0xa778('0x3b')](_0xa778('0x3c'),_0xa778('0x47'))[_0xa778('0x3b')]('NOW()',_0xa778('0x3a'))['from'](_0xa778('0x40'))['where'](_0xa778('0x42'))[_0xa778('0x41')](_0xa778('0x48'),LISTID[_0xa778('0x3e')]())[_0xa778('0x41')](_0xa778('0x49'),squel[_0xa778('0x4a')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x2477bb;}return db['VoiceQueue'][_0xa778('0x50')]({'where':{'type':_0xa778('0x51')},'attributes':['id',_0xa778('0x52')],'include':[{'model':db[_0xa778('0x53')],'as':'Lists','where':{'id':LISTID}}]})[_0xa778('0x2d')](function(_0x5d23be){var _0x2716b5=[];if(_0x5d23be){var _0x54711c;for(var _0x4dd220=0x0,_0x49b8a6;_0x4dd220<_0x5d23be[_0xa778('0x18')];_0x4dd220+=0x1){_0x49b8a6=_0x5d23be[_0x4dd220][_0xa778('0x54')]({'plain':!![]});switch(_0x49b8a6[_0xa778('0x52')]){case _0xa778('0x55'):_0x2716b5[_0xa778('0x2e')](db[_0xa778('0x56')][_0xa778('0x57')](_0x42c32f(_0x49b8a6,'VoiceQueueId'))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));break;case _0xa778('0x58'):_0x2716b5[_0xa778('0x2e')](db[_0xa778('0x56')][_0xa778('0x57')](_0x26ba24(_0x49b8a6,_0xa778('0x59')))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));break;default:_0x2716b5['push'](db[_0xa778('0x56')][_0xa778('0x57')](_0x49113b(_0x49b8a6,_0xa778('0x59')))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));}}}return _0x2716b5;})[_0xa778('0x5a')]()[_0xa778('0x2d')](function(){return db[_0xa778('0x5b')][_0xa778('0x50')]({'where':{'type':_0xa778('0x51')},'attributes':['id'],'include':[{'model':db[_0xa778('0x53')],'as':_0xa778('0x5c'),'where':{'id':LISTID}}]})[_0xa778('0x2d')](function(_0x89b034){var _0x1f5ea0=[];if(_0x89b034){var _0x4b7d31;for(var _0x463f65=0x0,_0x8b63ac;_0x463f65<_0x89b034[_0xa778('0x18')];_0x463f65+=0x1){_0x8b63ac=_0x89b034[_0x463f65][_0xa778('0x54')]({'plain':!![]});_0x1f5ea0[_0xa778('0x2e')](db[_0xa778('0x56')]['query'](_0x119c76(_0x8b63ac,_0xa778('0x59')))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));}}return _0x1f5ea0;})['all']();})[_0xa778('0x2d')](function(){return db[_0xa778('0x5d')][_0xa778('0x50')]({'attributes':['id',_0xa778('0x52')],'include':[{'model':db[_0xa778('0x53')],'as':'Lists','where':{'id':LISTID}}]})[_0xa778('0x2d')](function(_0x5d93f9){var _0x34be21=[];if(_0x5d93f9){for(var _0x5a6b78=0x0,_0x42b68f;_0x5a6b78<_0x5d93f9[_0xa778('0x18')];_0x5a6b78+=0x1){_0x42b68f=_0x5d93f9[_0x5a6b78][_0xa778('0x54')]({'plain':!![]});switch(_0x42b68f[_0xa778('0x52')]){case'always':_0x34be21[_0xa778('0x2e')](db[_0xa778('0x56')][_0xa778('0x57')](_0x42c32f(_0x42b68f,_0xa778('0x5e')))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));break;case _0xa778('0x58'):_0x34be21[_0xa778('0x2e')](db['sequelize']['query'](_0x26ba24(_0x42b68f,_0xa778('0x5e')))['then'](function(){})[_0xa778('0x30')](_0x13e72e()));break;default:_0x34be21[_0xa778('0x2e')](db[_0xa778('0x56')][_0xa778('0x57')](_0x49113b(_0x42b68f,_0xa778('0x5e')))['then'](function(){})[_0xa778('0x30')](_0x13e72e()));}}}return _0x34be21;})[_0xa778('0x5a')]();})[_0xa778('0x2d')](function(){return db[_0xa778('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa778('0x53')],'as':_0xa778('0x5c'),'where':{'id':LISTID}}]})[_0xa778('0x2d')](function(_0x447c60){var _0x47a73e=[];if(_0x447c60){for(var _0x377e8d=0x0,_0x217d54;_0x377e8d<_0x447c60[_0xa778('0x18')];_0x377e8d+=0x1){_0x217d54=_0x447c60[_0x377e8d][_0xa778('0x54')]({'plain':!![]});_0x47a73e[_0xa778('0x2e')](db[_0xa778('0x56')][_0xa778('0x57')](_0x119c76(_0x217d54,_0xa778('0x5e')))[_0xa778('0x2d')](function(){})[_0xa778('0x30')](_0x13e72e()));}}return _0x47a73e;})[_0xa778('0x5a')]();})['catch'](function(_0x4dc6e8){logger['error']('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4dc6e8[_0xa778('0x1a')]);});}var processPromises=function(_0x1eea9f){return BPromise[_0xa778('0x5a')](promises)[_0xa778('0x2d')](function(_0x19ffee){})[_0xa778('0x30')](function(_0x2d283a){logger[_0xa778('0x1c')]('Error\x20processing\x20rows\x20block:',JSON[_0xa778('0x32')](_0x2d283a));})['finally'](function(){socket[_0xa778('0x5f')](_0xa778('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1eea9f){return _0x1eea9f[_0xa778('0x61')]();}});};var endCsv=function(){return BPromise[_0xa778('0x62')]()[_0xa778('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0xa778('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xb8eaa3){logger[_0xa778('0x1c')](_0xa778('0x63'),JSON['stringify'](_0xb8eaa3));}finally{process[_0xa778('0x64')](0x0);}});};process['on'](_0xa778('0x65'),function(){logger[_0xa778('0x66')](_0xa778('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xa778('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa778('0x2a')][_0xa778('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa778('0x2d')](function(_0x206955){var _0x239cb1=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa778('0x68')](_0x239cb1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x165f08,_0x9ce3f1){total+=0x1;var _0x1ee4e7=total;promises[_0xa778('0x2e')](checkRow(_0x165f08,_0x206955,_0x1ee4e7)[_0xa778('0x2d')](function(){success+=0x1;})[_0xa778('0x30')](function(_0x300aaf){if(_0x300aaf['error']){errors+=0x1;delete _0x300aaf[_0xa778('0x1c')];}else if(_0x300aaf[_0xa778('0x28')]){duplicates+=0x1;delete _0x300aaf['duplicate'];}rows[_0xa778('0x2e')](_0x300aaf);}));if(total%0xc8===0x0){_0x9ce3f1[_0xa778('0x69')]();return processPromises(_0x9ce3f1);}},'complete':function(){return processPromises()[_0xa778('0x2d')](function(){logger['info'](_0xa778('0x6a'));endCsv();});},'error':function(_0x1a31d4,_0x441b80){logger['info'](_0xa778('0x6b'),JSON['stringify'](_0x1a31d4));endCsv();}});})[_0xa778('0x30')](function(_0x5df68c){logger[_0xa778('0x1c')](_0xa778('0x6c'),JSON[_0xa778('0x32')](_0x5df68c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 64ed5f0..3858be4 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 _0x97ed=['campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','send','start','binding','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','createReadStream','data','find','hasOwnProperty','trim','replace','isNaN','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','firstName','itemTypeId','description','SystemRow','appendFileSync','rows','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','voice_queues','affectedRows','emit','unlink','exit','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','all','split','push','isNil','CmContactHasItem','findOne','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','fields','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','fromQuery','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','scheduledAt','min_id','Received\x20SIGINT','error','message','errors','code','info','sequelize','query','spread','catch'];(function(_0x84aa0d,_0x1dea7c){var _0x172f95=function(_0x60930f){while(--_0x60930f){_0x84aa0d['push'](_0x84aa0d['shift']());}};_0x172f95(++_0x1dea7c);}(_0x97ed,0x1a3));var _0xd97e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x97ed[_0x46698a];return _0x356db0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xd97e('0x0'));var Papa=require('papaparse');var util=require(_0xd97e('0x1'));var BPromise=require(_0xd97e('0x2'));var moment=require(_0xd97e('0x3'));var squel=require(_0xd97e('0x4'));var Redis=require(_0xd97e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xd97e('0x6'));var shared=require(_0xd97e('0x7'));var logger=require(_0xd97e('0x8'))(_0xd97e('0x9'));config[_0xd97e('0xa')]=_[_0xd97e('0xb')](config[_0xd97e('0xa')],{'host':_0xd97e('0xc'),'port':0x18eb});var socket=require(_0xd97e('0xd'))(new Redis(config[_0xd97e('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd97e('0xe')](_0xd97e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd97e('0xe')](_0xd97e('0xf'));function isEmail(_0x42eee6){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))*$/[_0xd97e('0x10')](_0x42eee6);}function selectNotIn(_0x5e0ee5,_0x3f1298,_0x2399c7,_0x48ae83,_0x53b425){return squel[_0xd97e('0x11')]()[_0xd97e('0x12')](_0xd97e('0x13'))[_0xd97e('0x14')](_0x48ae83)[_0xd97e('0x15')](_0x3f1298,null,_0x3f1298+_0xd97e('0x16')+_0x48ae83+'.'+_0x2399c7)['where'](_0x48ae83+'.'+_0x2399c7+_0xd97e('0x17')+_0x5e0ee5+'.'+_0x2399c7)[_0xd97e('0x18')](_0x3f1298+_0xd97e('0x19')+_0x53b425[_0xd97e('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x183495,_0x20d8e2){promisesAdditionalPhones=[];return db['CmContact'][_0xd97e('0x1a')]({'raw':!![],'attributes':['id',_0xd97e('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd97e('0x1c')](function(_0x59a536){if(_0x59a536!==null){var _0xa98268=[];for(var _0x236e6b=0x0;_0x236e6b<_0x59a536[_0xd97e('0x1d')];_0x236e6b++){var _0x27b7db=_0x59a536[_0x236e6b];_0xa98268['push'](insertAdditionalPhones(_0x27b7db));}}Promise[_0xd97e('0x1e')](_0xa98268)[_0xd97e('0x1c')](function(){_0x183495({'val':0x1});});});});}function insertAdditionalPhones(_0x3591da){return new Promise(function(_0x8bf06d,_0x176432){var _0x385b99=_0x3591da[_0xd97e('0x1b')];var _0x3939c7=_0x385b99[_0xd97e('0x1f')](';');var _0x4c3423=[];orderBy=0x0;for(var _0x4baa25=0x0;_0x4baa25<_0x3939c7[_0xd97e('0x1d')];_0x4baa25++){_0x4c3423[_0xd97e('0x20')](splitAdditionalPhone(_0x3591da['id'],_0x3939c7[_0x4baa25]));}Promise[_0xd97e('0x1e')](_0x4c3423)['then'](function(){_0x8bf06d({'val':_0x3939c7[_0xd97e('0x1d')]});});});}function splitAdditionalPhone(_0xed2ea,_0x4ac7c0){return new Promise(function(_0x2ecec1,_0xbf8e08){var _0x1d6f0d=_0x4ac7c0['split'](':');var _0x34471b=_0x1d6f0d[0x0];var _0x497dbb=_0x1d6f0d[0x1];if(!_[_0xd97e('0x21')](_0x497dbb)){var _0x3b9e69=_0x497dbb[_0xd97e('0x1f')]('|');var _0x3cd7f2=[];for(var _0xa6366b=0x0;_0xa6366b<_0x3b9e69[_0xd97e('0x1d')];_0xa6366b++){if(_0x3b9e69[_0xa6366b]!==''){var _0x28a2ed=_['filter'](promisesAdditionalPhones,{'contactId':_0xed2ea,'phone':_0x3b9e69[_0xa6366b]});if(_0x28a2ed['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd97e('0x20')]({'contactId':_0xed2ea,'contactTypeId':_0x34471b,'phone':_0x3b9e69[_0xa6366b],'orderBy':orderBy});}}}_0x2ecec1({'ok':0x1});}else _0x2ecec1({'res':0x0});});}function createAdditionalPhone(_0x33b4b8,_0x3e52d2,_0x1690f5,_0x1ccddb){var _0x3d25b7='';var _0x52d52d='';var _0x3f3db5=_0x1690f5[_0xd97e('0x1f')]('§');_0x3d25b7=_0x3f3db5[0x0];if(_0x3f3db5[_0xd97e('0x1d')]==0x2)_0x52d52d=_0x3f3db5[0x1];return new Promise(function(_0x301a1c,_0x21a6e1){return db[_0xd97e('0x22')][_0xd97e('0x23')]({'where':{'CmContactId':_0x33b4b8,'item':_0x3d25b7}})[_0xd97e('0x1c')](function(_0x8a3063){if(_0x8a3063){return db[_0xd97e('0x22')][_0xd97e('0x24')]({'ItemTypeId':_0x3e52d2,'description':_0x52d52d,'OrderBy':_0x1ccddb},{'where':{'CmContactId':_0x33b4b8,'item':_0x3d25b7}})['then'](function(_0x3a94ab){_0x301a1c({'res':_0xd97e('0x25')});});}else{return db[_0xd97e('0x22')]['create']({'CmContactId':_0x33b4b8,'item':_0x3d25b7,'description':_0x52d52d,'ItemTypeId':_0x3e52d2,'OrderBy':_0x1ccddb,'ItemClass':'PHONE'})['then'](function(_0xe4ca22){_0x301a1c({'res':_0xd97e('0x26')});});}});});}function insertCmHopper(_0x2900e9,_0x57f598,_0x15c002,_0x1f1030,_0x57da48){var _0x143e96=[_0xd97e('0x27'),_0xd97e('0x28'),_0xd97e('0x29'),_0xd97e('0x2a'),_0x57f598+'.'+_0x1f1030,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xd97e('0x2b'),_0xd97e('0x2c'),'\x22'+_0x57da48+'\x22'];return squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')]('cm_hopper')['fromQuery'](['phone',_0xd97e('0x2f'),_0xd97e('0x30'),_0xd97e('0x31'),_0x1f1030,_0xd97e('0x32'),_0xd97e('0x33'),_0xd97e('0x34'),_0xd97e('0x35'),_0xd97e('0x36')],squel[_0xd97e('0x11')]()['fields'](_0x143e96)['from'](_0x57f598)['join'](_0xd97e('0x37'),null,_0xd97e('0x38')+_0x57f598+_0xd97e('0x39'))[_0xd97e('0x15')](_0x15c002,null,_0x15c002+_0xd97e('0x16')+_0x57f598+'.'+_0x1f1030)['where'](_0x57f598+_0xd97e('0x3a'),_0x2900e9)['where'](_0xd97e('0x3b'),NOW)[_0xd97e('0x18')](_0xd97e('0x3c'),selectNotIn(_0x57f598,_0x15c002,_0x1f1030,_0xd97e('0x3d'),[_0xd97e('0x3e'),_0xd97e('0x3f')]))[_0xd97e('0x18')](_0xd97e('0x3c'),selectNotIn(_0x57f598,_0x15c002,_0x1f1030,_0xd97e('0x3d'),['\x22always\x22'])))[_0xd97e('0x40')]();}function insertCmHopperBlack(_0x2a4e62,_0x18ce53,_0x419e22,_0x40a227){var _0x10873d=['cm_contacts.phone',_0xd97e('0x29'),_0xd97e('0x2a'),_0x18ce53+'.'+_0x40a227,_0xd97e('0x41'),_0xd97e('0x42')];return squel['insert']()[_0xd97e('0x2e')](_0xd97e('0x43'))['fromQuery']([_0xd97e('0x13'),_0xd97e('0x30'),_0xd97e('0x31'),_0x40a227,_0xd97e('0x32'),_0xd97e('0x33')],squel[_0xd97e('0x11')]()[_0xd97e('0x44')](_0x10873d)['from'](_0x18ce53)['join'](_0xd97e('0x37'),null,_0xd97e('0x38')+_0x18ce53+_0xd97e('0x39'))[_0xd97e('0x15')](_0x419e22,null,_0x419e22+_0xd97e('0x16')+_0x18ce53+'.'+_0x40a227)[_0xd97e('0x18')](_0x18ce53+_0xd97e('0x3a'),_0x2a4e62)['where'](_0xd97e('0x3b'),NOW)[_0xd97e('0x18')](_0xd97e('0x3c'),squel[_0xd97e('0x11')]()[_0xd97e('0x12')](_0xd97e('0x13'))[_0xd97e('0x14')]('cm_hopper_black')[_0xd97e('0x18')](_0xd97e('0x45'),_0x2a4e62)[_0xd97e('0x18')](_0x40a227+_0xd97e('0x17')+_0x18ce53+'.'+_0x40a227)))['toString']();}function insertTzCmHopper(_0x39a5ee,_0x3f80ad,_0x4a9eb1,_0x3991bf,_0x57b44c,_0x2414e5){var _0x32d07c=[_0xd97e('0x27'),_0xd97e('0x46')+_0x2414e5+_0xd97e('0x47'),'cm_contacts.id','cm_contacts.ListId',_0x3f80ad+'.'+_0x3991bf,_0xd97e('0x41'),'cm_contacts.updatedAt',_0xd97e('0x2b'),_0xd97e('0x2c'),'\x22'+_0x57b44c+'\x22'];var _0xd75821=squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')](_0xd97e('0x3d'))[_0xd97e('0x48')](['phone',_0xd97e('0x2f'),_0xd97e('0x30'),_0xd97e('0x31'),_0x3991bf,_0xd97e('0x32'),_0xd97e('0x33'),_0xd97e('0x34'),_0xd97e('0x35'),'recallme'],squel['select']()[_0xd97e('0x44')](_0x32d07c)[_0xd97e('0x14')](_0x3f80ad)[_0xd97e('0x15')](_0xd97e('0x37'),null,_0xd97e('0x38')+_0x3f80ad+'.CmListId')[_0xd97e('0x15')](_0x4a9eb1,null,_0x4a9eb1+'.id\x20=\x20'+_0x3f80ad+'.'+_0x3991bf)['join'](_0x2414e5,null,_0x2414e5+_0xd97e('0x16')+_0x3f80ad+'.'+_0x3991bf)[_0xd97e('0x18')](_0x3f80ad+_0xd97e('0x3a'),_0x39a5ee)['where'](_0xd97e('0x3b'),NOW)[_0xd97e('0x18')](_0xd97e('0x3c'),selectNotIn(_0x3f80ad,_0x4a9eb1,_0x3991bf,_0xd97e('0x3d'),[_0xd97e('0x3e'),_0xd97e('0x3f')]))['where'](_0xd97e('0x3c'),selectNotIn(_0x3f80ad,_0x4a9eb1,_0x3991bf,'cm_hopper',[_0xd97e('0x3e')])))[_0xd97e('0x40')]();return _0xd75821;}function insertTzCmHopperBlack(_0x210e3b,_0xf79e60,_0x4e69b5,_0x52b6a4){var _0x4d72c7=['cm_contacts.phone',_0xd97e('0x29'),_0xd97e('0x2a'),_0xf79e60+'.'+_0x52b6a4,'cm_contacts.createdAt',_0xd97e('0x42')];return squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')](_0xd97e('0x43'))['fromQuery'](['phone','ContactId',_0xd97e('0x31'),_0x52b6a4,_0xd97e('0x32'),'updatedAt'],squel[_0xd97e('0x11')]()['fields'](_0x4d72c7)[_0xd97e('0x14')](_0xf79e60)[_0xd97e('0x15')](_0xd97e('0x37'),null,_0xd97e('0x38')+_0xf79e60+'.CmListId')[_0xd97e('0x15')](_0x4e69b5,null,_0x4e69b5+_0xd97e('0x16')+_0xf79e60+'.'+_0x52b6a4)[_0xd97e('0x18')](_0xf79e60+'.CmListId\x20=\x20?',_0x210e3b)[_0xd97e('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd97e('0x18')](_0xd97e('0x3c'),squel['select']()[_0xd97e('0x12')]('phone')[_0xd97e('0x14')]('cm_hopper_black')[_0xd97e('0x18')](_0xd97e('0x45'),_0x210e3b)['where'](_0x52b6a4+_0xd97e('0x17')+_0xf79e60+'.'+_0x52b6a4)))[_0xd97e('0x40')]();}function insertCmHopperAdditionalPhones(_0x630b3){var _0x5d4caf=[_0xd97e('0x49'),'cm_contact_has_items.item',_0xd97e('0x4a'),_0xd97e('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')](_0xd97e('0x4c'))['fromQuery']([_0xd97e('0x4d'),_0xd97e('0x13'),_0xd97e('0x4e'),_0xd97e('0x32'),_0xd97e('0x33')],squel['select']()['fields'](_0x5d4caf)['from'](_0xd97e('0x3d'))[_0xd97e('0x15')](_0xd97e('0x37'),null,_0xd97e('0x4f'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xd97e('0x18')]('cm_hopper.ListId\x20=\x20?',_0x630b3)['where'](_0xd97e('0x3b'),NOW))[_0xd97e('0x40')]();}function insertCmContact(_0x3c98c9,_0x4acd93,_0x157b71,_0x493b4e){var _0x3604be=_[_0xd97e('0x50')](_[_0xd97e('0x51')](_0x493b4e),[_0xd97e('0x31'),'CompanyId',_0xd97e('0x32'),'updatedAt',_0xd97e('0x52')]);return squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')](_0xd97e('0x37'))[_0xd97e('0x48')](_0x3604be,squel['select']()[_0xd97e('0x44')](_0x3604be)[_0xd97e('0x14')](_0x4acd93)['where']('('+_0x157b71[_0xd97e('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xd97e('0x11')]()[_0xd97e('0x44')](_0x157b71)[_0xd97e('0x14')]('cm_contacts')['where'](_0xd97e('0x45'),_0x3c98c9)[_0xd97e('0x18')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0xd97e('0x11')]()['field']('MIN(id)',_0xd97e('0x53'))[_0xd97e('0x14')](_0x4acd93)['group'](_0x157b71[_0xd97e('0x15')](','))))['toString']();}function handleStop(){logger['info'](_0xd97e('0x54'));stopped=!![];}function handleUncaughtException(_0x587de1){logger[_0xd97e('0x55')](_0x587de1[_0xd97e('0x56')]);process['exit'](0x1);}function handleError(_0x34ca70,_0x392923){stats[_0xd97e('0x57')][_0xd97e('0x20')]({'name':_0x392923[_0xd97e('0x58')],'message':_0x392923[_0xd97e('0x56')],'row':_0x34ca70});}function handleQuery(_0x33f404){logger[_0xd97e('0x59')](_0x33f404);return db[_0xd97e('0x5a')][_0xd97e('0x5b')](_0x33f404)[_0xd97e('0x5c')](function(_0x382656){results[_0xd97e('0x20')](_0x382656);})[_0xd97e('0x5d')](function(_0x22ee35){logger['error'](_0x22ee35[_0xd97e('0x56')]);});}function updateTzCampaigns(_0x1e3ca2){return new Promise(function(_0xc035e2,_0x109c50){var _0x57d0e4=squel[_0xd97e('0x11')]()[_0xd97e('0x44')]([_0xd97e('0x5e'),'campaigns.dialTimezone'])[_0xd97e('0x14')](_0xd97e('0x5f'))[_0xd97e('0x15')](_0xd97e('0x60'),null,_0xd97e('0x61'))[_0xd97e('0x18')]('campaigns_has_cm_lists.CmListId='+_0x1e3ca2);db[_0xd97e('0x5a')][_0xd97e('0x5b')](_0x57d0e4[_0xd97e('0x40')]())[_0xd97e('0x5c')](function(_0x5c696c){var _0x4d00e7=[];for(var _0x3ebef7=0x0;_0x3ebef7<_0x5c696c[_0xd97e('0x1d')];_0x3ebef7++){_0x4d00e7[_0xd97e('0x20')](getTimezoneData(_0x5c696c[_0x3ebef7],tmp_campaigns));}BPromise[_0xd97e('0x1e')](_0x4d00e7)[_0xd97e('0x1c')](function(){_0xc035e2({'val':0x1});});})[_0xd97e('0x5d')](function(_0x426b75){logger[_0xd97e('0x55')](_0x426b75[_0xd97e('0x56')]);_0xc035e2({'val':0x0});});});}function updateTzVoiceQueues(_0x218c73){return new Promise(function(_0x219254,_0x2da917){var _0x243f85=squel['select']()['fields'](['voice_queues.id',_0xd97e('0x62')])[_0xd97e('0x14')]('voice_queues')[_0xd97e('0x15')](_0xd97e('0x63'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xd97e('0x64')+_0x218c73);db['sequelize'][_0xd97e('0x5b')](_0x243f85['toString']())[_0xd97e('0x5c')](function(_0x960b8){var _0x265651=[];for(var _0x38e8e5=0x0;_0x38e8e5<_0x960b8[_0xd97e('0x1d')];_0x38e8e5++){_0x265651[_0xd97e('0x20')](getTimezoneData(_0x960b8[_0x38e8e5],tmp_voice_queues));}BPromise['all'](_0x265651)['then'](function(){_0x219254({'val':0x1});});})[_0xd97e('0x5d')](function(_0x5c5b9c){logger['error'](_0x5c5b9c[_0xd97e('0x56')]);_0x219254({'val':0x0});});});}function getTimezoneData(_0x268d26,_0x45c605){return new Promise(function(_0x42d9fa,_0x2027e7){var _0x3e8a75=shared[_0xd97e('0x65')];var _0x40a697=_0x3e8a75[_0x268d26['dialTimezone']];if(_[_0xd97e('0x21')](_0x40a697)){_0x42d9fa({'ret':0x1});}else{var _0x37e524=_0x40a697[_0xd97e('0x66')];var _0x4c1af9=squel[_0xd97e('0x2d')]()[_0xd97e('0x2e')](_0x45c605)['set']('id',_0x268d26['id'])[_0xd97e('0x67')](_0xd97e('0x68'),_0x37e524)[_0xd97e('0x67')](_0xd97e('0x69'),_0x268d26[_0xd97e('0x69')])[_0xd97e('0x40')]();return db[_0xd97e('0x5a')][_0xd97e('0x5b')](_0x4c1af9)[_0xd97e('0x5c')](function(_0x466a34){_0x42d9fa({'ret':0x1});})[_0xd97e('0x5d')](function(_0x2f749c){logger[_0xd97e('0x55')](_0x2f749c['message']);_0x2027e7({'ret':0x1});});}});}function handleTZQuery(_0x35d96f){logger[_0xd97e('0x59')](_0x35d96f);return db[_0xd97e('0x5a')][_0xd97e('0x5b')](_0x35d96f)[_0xd97e('0x5c')](function(_0x2d0dfa){})[_0xd97e('0x5d')](function(_0x66ecc6){logger[_0xd97e('0x55')](_0x66ecc6['message']);});}function main(_0x1d1cbe,_0x4fdf5d,_0x3ef248,_0x4e9755){logger[_0xd97e('0x59')]('main',_0x1d1cbe,JSON['stringify'](_0x4fdf5d));process[_0xd97e('0x6a')](_0xd97e('0x6b'));var _0x2e851c=_0x4fdf5d[_0xd97e('0x6c')];var _0x19276a=_['clone'](_0x2e851c);var _0x7551e8=_0x4fdf5d[_0xd97e('0x6d')];var _0x31df44=path[_0xd97e('0x15')](config['root'],_0xd97e('0x6e'),_0x7551e8+_0xd97e('0x6f'));hasTZ=_['keys'](_0x2e851c)[_0xd97e('0x70')](_0xd97e('0x69'));var _0x20ec87=_['keys'](_0x2e851c)[_0xd97e('0x15')]();logger[_0xd97e('0x59')](_0xd97e('0x71'),_0x20ec87);db[_0xd97e('0x72')][_0xd97e('0x1a')]({'raw':!![],'attributes':['id','name']})[_0xd97e('0x1c')](function(_0x24d09f){for(var _0x19b942=0x0;_0x19b942<_0x24d09f[_0xd97e('0x1d')];_0x19b942++){if(_0x24d09f[_0x19b942][_0xd97e('0x73')]in _0x2e851c){contactItemTypes[_0xd97e('0x20')](_0x24d09f[_0x19b942]);delete _0x19276a[_0x24d09f[_0x19b942][_0xd97e('0x73')]];hasAdditionalPhones=!![];}for(var _0xf7e930 in _0x2e851c){if(_0x24d09f[_0x19b942][_0xd97e('0x73')]+_0xd97e('0x74')===_0xf7e930){phoneDescriptions[_0xd97e('0x20')]({'itemTypeId':_0x24d09f[_0x19b942]['id'],'description':_0xf7e930});delete _0x19276a[_0xf7e930];}}}if(hasAdditionalPhones)_0x19276a[_0xd97e('0x1b')]='';var _0x868caa=_[_0xd97e('0x51')](_0x19276a)['join']();logger['info'](_0xd97e('0x71'),_0x868caa);fs['writeFileSync'](_0x31df44,_0x868caa+'\x0a');Papa[_0xd97e('0x75')](fs[_0xd97e('0x76')](_0x1d1cbe),{'header':!![],'skipEmptyLines':!![],'step':function(_0xea5439,_0x421491){try{for(var _0x89ace7=0x0,_0xc4dc21=[];_0x89ace7<_0xea5439[_0xd97e('0x77')]['length'];_0x89ace7++){stats['rows']+=0x1;if(_0xea5439[_0xd97e('0x57')][_0x89ace7]){handleError(_0xea5439[_0xd97e('0x77')][_0x89ace7],_0xea5439[_0xd97e('0x57')][_0x89ace7]);}else{var _0x51b5d5=[];var _0x1ecb3d=[];var _0x19fb53={};for(var _0x1d341c in _0x2e851c){let _0x238337=contactItemTypes['find'](_0x36a24b=>_0x36a24b[_0xd97e('0x73')]===_0x1d341c);let _0x3ecc9a=contactItemTypes[_0xd97e('0x78')](_0x241dd7=>_0x241dd7[_0xd97e('0x73')]+_0xd97e('0x74')===_0x1d341c);if(_['isNil'](_0x238337)&&_[_0xd97e('0x21')](_0x3ecc9a)){if(_0x2e851c[_0xd97e('0x79')](_0x1d341c)){if(_0xea5439['data'][_0x89ace7][_0x2e851c[_0x1d341c]]){var _0x20bb80=_[_0xd97e('0x7a')](_0xea5439['data'][_0x89ace7][_0x2e851c[_0x1d341c]][_0xd97e('0x7b')](/"/g,'\x27'));switch(_0x1d341c){case'scheduledat':var _0x2c391c=moment(_0x20bb80,_0xd97e('0xf'),!![]);if(_0x2c391c['isValid']()){_0xc4dc21['push']('\x22'+_0x20bb80+'\x22');}else{_0x51b5d5[_0xd97e('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3a5b73=parseInt(_0x20bb80);_0x20bb80=_[_0xd97e('0x7c')](_0x3a5b73)||_0x3a5b73<0x0||_0x3a5b73>0x4?_0x4e9755?0x3:0x2:_0x3a5b73;_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x20bb80+'\x22');break;case _0xd97e('0x35'):var _0x12ebb2=parseInt(_0x20bb80);if(_[_0xd97e('0x7d')](_0x12ebb2)&&_[_0xd97e('0x70')](_0x3ef248,_0x12ebb2)){_0xc4dc21['push']('\x22'+_0x12ebb2+'\x22');}else{_0x51b5d5[_0xd97e('0x20')](_0xd97e('0x7e'));}break;case _0xd97e('0x7f'):if(isEmail(_0x20bb80)){_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x20bb80+'\x22');}else{_0x51b5d5[_0xd97e('0x20')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x939466=moment(_0x20bb80,_0xd97e('0x80'),!![]);if(_0x939466[_0xd97e('0x81')]()){_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x20bb80+'\x22');}else{_0x51b5d5[_0xd97e('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xd97e('0x69'):var _0x28fec8=shared[_0xd97e('0x65')];var _0xcd2dba=_0x28fec8[_0x20bb80];if(!_[_0xd97e('0x21')](_0xcd2dba)){var _0x2ca4c7=_0xcd2dba[_0xd97e('0x66')];_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x20bb80+'\x22');_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x2ca4c7+'\x22');}break;default:_0xc4dc21['push']('\x22'+_0x20bb80+'\x22');}}else{switch(_0x1d341c){case _0xd97e('0x82'):case'phone':_0x51b5d5[_0xd97e('0x20')](_0x1d341c+'\x20not\x20specified');break;default:_0xc4dc21[_0xd97e('0x20')]('\x22\x22');}}}}else{var _0x182bc2='';if(!_[_0xd97e('0x21')](_0x238337)){if(!_0x19fb53[_0xd97e('0x79')](_0x238337['id'])){if(!_[_0xd97e('0x21')](_0xea5439['data'][_0x89ace7][_0x2e851c[_0x1d341c]])){var _0x20bb80=_[_0xd97e('0x7a')](_0xea5439[_0xd97e('0x77')][_0x89ace7][_0x2e851c[_0x1d341c]][_0xd97e('0x7b')](/"/g,'\x27'));var _0x2fb696=phoneDescriptions['find'](_0x43ff36=>_0x43ff36[_0xd97e('0x83')]===_0x238337['id']);if(!_[_0xd97e('0x21')](_0x2fb696)){var _0x34e48d=_[_0xd97e('0x7a')](_0xea5439[_0xd97e('0x77')][_0x89ace7][_0x2e851c[_0x2fb696[_0xd97e('0x84')]]][_0xd97e('0x7b')](/"/g,'\x27'));if(!_[_0xd97e('0x21')](_0x34e48d))_0x20bb80=_0x20bb80+'§'+_0x34e48d;}if(_0x182bc2=='')_0x182bc2=_0x20bb80;else _0x182bc2+='|'+_0x20bb80;}_0x1ecb3d[_0xd97e('0x20')](_0x238337['id']+':'+_0x182bc2);_0x19fb53[_0x238337['id']]=0x1;}}}}if(hasAdditionalPhones){_0xc4dc21[_0xd97e('0x20')]('\x22'+_0x1ecb3d[_0xd97e('0x15')](';')+'\x22');}if(_0x51b5d5[_0xd97e('0x1d')]){handleError(_0xea5439[_0xd97e('0x77')][_0x89ace7],{'code':_0xd97e('0x85'),'message':_0x51b5d5[_0xd97e('0x15')]()});}else{fs[_0xd97e('0x86')](_0x31df44,_0xc4dc21[_0xd97e('0x15')]()+'\x0a');}_0xc4dc21=[];}if(!(stats[_0xd97e('0x87')]%0xc8)){socket['emit']('contact:import:'+_0x7551e8,stats);stats[_0xd97e('0x57')]=[];}}if(stopped){logger[_0xd97e('0x59')]('Abort\x20parser');_0x421491[_0xd97e('0x88')]();}}catch(_0x1f5fe0){handleError(_0xea5439[_0xd97e('0x77')][_0x89ace7],{'code':_0xd97e('0x89'),'message':_0x1f5fe0[_0xd97e('0x56')]});logger[_0xd97e('0x55')](_0xd97e('0x8a'),_0x1f5fe0[_0xd97e('0x56')]);}},'complete':function(){try{var _0x27b9a5=[];var _0x3619f1=[];var _0x584746=_0xd97e('0x37');if(_0x4fdf5d[_0xd97e('0x8b')]&&_0x4fdf5d[_0xd97e('0x8b')][_0xd97e('0x1d')]){_0x584746=_0xd97e('0x8c')+_0x7551e8;_0x27b9a5[_0xd97e('0x20')](_0xd97e('0x8d')+_0x584746+_0xd97e('0x8e'));}tmp_campaigns=_0xd97e('0x8f')+_0x7551e8;tmp_voice_queues='voice_queues_'+_0x7551e8;_0x3619f1['push'](_0xd97e('0x8d')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x3619f1[_0xd97e('0x20')](_0xd97e('0x8d')+tmp_voice_queues+_0xd97e('0x90'));BPromise[_0xd97e('0x91')](_0x3619f1,handleTZQuery)['then'](function(_0x43383f){updateTzCampaigns(_0x4fdf5d[_0xd97e('0x31')])[_0xd97e('0x1c')](function(_0x44e98c){updateTzVoiceQueues(_0x4fdf5d[_0xd97e('0x31')])[_0xd97e('0x1c')](function(_0x426571){if(hasTZ)_0x868caa=_0x868caa[_0xd97e('0x7b')]('dialTimezone','dialTimezone,utcOffset');var _0x44d58d=util['format'](_0xd97e('0x92'),_0x31df44,_0x584746,_0x868caa,_0x4fdf5d[_0xd97e('0x31')],_0x4fdf5d[_0xd97e('0x93')]||null,NOW,NOW);if(_[_0xd97e('0x21')](_0x2e851c['scheduledat'])){_0x44d58d+=_0xd97e('0x94');}_0x27b9a5[_0xd97e('0x20')](_0x44d58d);if(_0x4fdf5d[_0xd97e('0x8b')]&&_0x4fdf5d[_0xd97e('0x8b')][_0xd97e('0x1d')]){_0x27b9a5[_0xd97e('0x20')](insertCmContact(_0x4fdf5d[_0xd97e('0x31')],_0x584746,_0x4fdf5d['duplicates'],_0x2e851c));_0x27b9a5[_0xd97e('0x20')](_0xd97e('0x95')+_0x584746+';');}BPromise[_0xd97e('0x91')](_0x27b9a5,handleQuery)[_0xd97e('0x1c')](function(_0x33c9ba){BPromise[_0xd97e('0x1e')]([handleAdditionalPhones()])[_0xd97e('0x1c')](function(){_0x27b9a5=[];for(var _0x31db4e=0x0;_0x31db4e\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','ioredis','../../../mysqldb','../../../config/environment/shared','import','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','join','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','insert','cm_hopper_black','fromQuery','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.ListId\x20=\x20','toString','.CmListId','cm_hopper.id','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','exit','code','info','sequelize','query','spread','catch','error','message','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','main'];(function(_0x32f64f,_0x53ff85){var _0x176d88=function(_0x58b7cc){while(--_0x58b7cc){_0x32f64f['push'](_0x32f64f['shift']());}};_0x176d88(++_0x53ff85);}(_0xa8d5,0x1b0));var _0x5a8d=function(_0x49f610,_0x10f825){_0x49f610=_0x49f610-0x0;var _0x1d2ea1=_0xa8d5[_0x49f610];return _0x1d2ea1;};'use strict';var fs=require('fs');var path=require(_0x5a8d('0x0'));var _=require(_0x5a8d('0x1'));var Papa=require(_0x5a8d('0x2'));var util=require('util');var BPromise=require(_0x5a8d('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x5a8d('0x4'));var db=require(_0x5a8d('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x5a8d('0x6'));var logger=require('../../../config/logger')(_0x5a8d('0x7'));config['redis']=_[_0x5a8d('0x8')](config['redis'],{'host':_0x5a8d('0x9'),'port':0x18eb});var socket=require(_0x5a8d('0xa'))(new Redis(config[_0x5a8d('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5a8d('0xc')](_0x5a8d('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5a8d('0xc')](_0x5a8d('0xd'));function isEmail(_0x57c8b8){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))*$/[_0x5a8d('0xe')](_0x57c8b8);}function selectNotIn(_0x1e1408,_0x4091d0,_0x2e8e0e,_0x8b27cc,_0x3b7d1e){return squel[_0x5a8d('0xf')]()[_0x5a8d('0x10')](_0x5a8d('0x11'))['from'](_0x8b27cc)['join'](_0x4091d0,null,_0x4091d0+_0x5a8d('0x12')+_0x8b27cc+'.'+_0x2e8e0e)[_0x5a8d('0x13')](_0x8b27cc+'.'+_0x2e8e0e+_0x5a8d('0x14')+_0x1e1408+'.'+_0x2e8e0e)['where'](_0x4091d0+_0x5a8d('0x15')+_0x3b7d1e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x16059d,_0x23d3c8){promisesAdditionalPhones=[];return db[_0x5a8d('0x16')]['findAll']({'raw':!![],'attributes':['id',_0x5a8d('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5a8d('0x18')](function(_0x16b93d){if(_0x16b93d!==null){var _0x5b6914=[];for(var _0x3ccd70=0x0;_0x3ccd70<_0x16b93d[_0x5a8d('0x19')];_0x3ccd70++){var _0x4aba59=_0x16b93d[_0x3ccd70];_0x5b6914[_0x5a8d('0x1a')](insertAdditionalPhones(_0x4aba59));}}Promise[_0x5a8d('0x1b')](_0x5b6914)[_0x5a8d('0x18')](function(){_0x16059d({'val':0x1});});});});}function insertAdditionalPhones(_0x3c09c8){return new Promise(function(_0x4d4ef9,_0x108bde){var _0x4de26c=_0x3c09c8[_0x5a8d('0x17')];var _0x23aad3=_0x4de26c[_0x5a8d('0x1c')](';');var _0x551175=[];orderBy=0x0;for(var _0x2967f6=0x0;_0x2967f6<_0x23aad3[_0x5a8d('0x19')];_0x2967f6++){_0x551175[_0x5a8d('0x1a')](splitAdditionalPhone(_0x3c09c8['id'],_0x23aad3[_0x2967f6]));}Promise[_0x5a8d('0x1b')](_0x551175)[_0x5a8d('0x18')](function(){_0x4d4ef9({'val':_0x23aad3['length']});});});}function splitAdditionalPhone(_0x2730fc,_0x16fa09){return new Promise(function(_0x1ea620,_0x3e7ebc){var _0x22d9d4=_0x16fa09['split'](':');var _0x2e7004=_0x22d9d4[0x0];var _0x47aff2=_0x22d9d4[0x1];if(!_[_0x5a8d('0x1d')](_0x47aff2)){var _0x2a6eaa=_0x47aff2[_0x5a8d('0x1c')]('|');var _0xce6738=[];for(var _0x478c67=0x0;_0x478c67<_0x2a6eaa[_0x5a8d('0x19')];_0x478c67++){if(_0x2a6eaa[_0x478c67]!==''){var _0x399849=_[_0x5a8d('0x1e')](promisesAdditionalPhones,{'contactId':_0x2730fc,'phone':_0x2a6eaa[_0x478c67]});if(_0x399849[_0x5a8d('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x5a8d('0x1a')]({'contactId':_0x2730fc,'contactTypeId':_0x2e7004,'phone':_0x2a6eaa[_0x478c67],'orderBy':orderBy});}}}_0x1ea620({'ok':0x1});}else _0x1ea620({'res':0x0});});}function createAdditionalPhone(_0x3ec595,_0x43f099,_0x2e5d58,_0x1f8dc3){var _0x3f785e='';var _0x299282='';var _0x3ef1af=_0x2e5d58[_0x5a8d('0x1c')]('§');_0x3f785e=_0x3ef1af[0x0];if(_0x3ef1af[_0x5a8d('0x19')]==0x2)_0x299282=_0x3ef1af[0x1];return new Promise(function(_0x2bab15,_0x68286a){return db[_0x5a8d('0x1f')][_0x5a8d('0x20')]({'where':{'CmContactId':_0x3ec595,'item':_0x3f785e}})[_0x5a8d('0x18')](function(_0x157c08){if(_0x157c08){return db[_0x5a8d('0x1f')][_0x5a8d('0x21')]({'ItemTypeId':_0x43f099,'description':_0x299282,'OrderBy':_0x1f8dc3},{'where':{'CmContactId':_0x3ec595,'item':_0x3f785e}})[_0x5a8d('0x18')](function(_0x4da1e7){_0x2bab15({'res':_0x5a8d('0x22')});});}else{return db[_0x5a8d('0x1f')]['create']({'CmContactId':_0x3ec595,'item':_0x3f785e,'description':_0x299282,'ItemTypeId':_0x43f099,'OrderBy':_0x1f8dc3,'ItemClass':'PHONE'})[_0x5a8d('0x18')](function(_0x1b449c){_0x2bab15({'res':'inserted'});});}});});}function insertCmHopper(_0xcb8fe7,_0x2d12dd,_0x14df1c,_0x2292dd,_0xf7b1ef){var _0xcb2818=[_0x5a8d('0x23'),_0x5a8d('0x24'),_0x5a8d('0x25'),_0x5a8d('0x26'),_0x2d12dd+'.'+_0x2292dd,_0x5a8d('0x27'),_0x5a8d('0x28'),_0x5a8d('0x29'),_0x5a8d('0x2a'),'\x22'+_0xf7b1ef+'\x22'];return squel['insert']()[_0x5a8d('0x2b')](_0x5a8d('0x2c'))['fromQuery']([_0x5a8d('0x11'),_0x5a8d('0x2d'),_0x5a8d('0x2e'),_0x5a8d('0x2f'),_0x2292dd,_0x5a8d('0x30'),_0x5a8d('0x31'),_0x5a8d('0x32'),_0x5a8d('0x33'),_0x5a8d('0x34')],squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](_0xcb2818)[_0x5a8d('0x36')](_0x2d12dd)[_0x5a8d('0x37')](_0x5a8d('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x2d12dd+'.CmListId')[_0x5a8d('0x37')](_0x14df1c,null,_0x14df1c+'.id\x20=\x20'+_0x2d12dd+'.'+_0x2292dd)[_0x5a8d('0x13')](_0x2d12dd+_0x5a8d('0x39'),_0xcb8fe7)[_0x5a8d('0x13')](_0x5a8d('0x3a'),NOW)[_0x5a8d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2d12dd,_0x14df1c,_0x2292dd,'cm_hopper',[_0x5a8d('0x3b'),_0x5a8d('0x3c')]))[_0x5a8d('0x13')](_0x5a8d('0x3d'),selectNotIn(_0x2d12dd,_0x14df1c,_0x2292dd,_0x5a8d('0x2c'),[_0x5a8d('0x3b')])))['toString']();}function insertCmHopperBlack(_0x47a439,_0x320f66,_0x588b30,_0x16ad88){var _0x57b148=[_0x5a8d('0x23'),_0x5a8d('0x25'),_0x5a8d('0x26'),_0x320f66+'.'+_0x16ad88,_0x5a8d('0x27'),_0x5a8d('0x28')];return squel[_0x5a8d('0x3e')]()[_0x5a8d('0x2b')](_0x5a8d('0x3f'))[_0x5a8d('0x40')]([_0x5a8d('0x11'),_0x5a8d('0x2e'),_0x5a8d('0x2f'),_0x16ad88,_0x5a8d('0x30'),_0x5a8d('0x31')],squel[_0x5a8d('0xf')]()['fields'](_0x57b148)[_0x5a8d('0x36')](_0x320f66)['join'](_0x5a8d('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x320f66+'.CmListId')[_0x5a8d('0x37')](_0x588b30,null,_0x588b30+_0x5a8d('0x12')+_0x320f66+'.'+_0x16ad88)[_0x5a8d('0x13')](_0x320f66+_0x5a8d('0x39'),_0x47a439)[_0x5a8d('0x13')](_0x5a8d('0x3a'),NOW)[_0x5a8d('0x13')](_0x5a8d('0x3d'),squel[_0x5a8d('0xf')]()[_0x5a8d('0x10')](_0x5a8d('0x11'))[_0x5a8d('0x36')](_0x5a8d('0x3f'))[_0x5a8d('0x13')](_0x5a8d('0x41'),_0x47a439)[_0x5a8d('0x13')](_0x16ad88+'\x20=\x20'+_0x320f66+'.'+_0x16ad88)))['toString']();}function insertTzCmHopper(_0x4fdbe1,_0x18cd78,_0x468d40,_0x36fc0,_0x2b69df,_0x301ef8){var _0x45511=[_0x5a8d('0x23'),_0x5a8d('0x42')+_0x301ef8+'.offset-cm_contacts.utcOffset\x20minute)',_0x5a8d('0x25'),_0x5a8d('0x26'),_0x18cd78+'.'+_0x36fc0,_0x5a8d('0x27'),_0x5a8d('0x28'),_0x5a8d('0x29'),'cm_contacts.UserId','\x22'+_0x2b69df+'\x22'];var _0x150f7c=squel[_0x5a8d('0x3e')]()[_0x5a8d('0x2b')](_0x5a8d('0x2c'))[_0x5a8d('0x40')]([_0x5a8d('0x11'),_0x5a8d('0x2d'),_0x5a8d('0x2e'),_0x5a8d('0x2f'),_0x36fc0,_0x5a8d('0x30'),'updatedAt',_0x5a8d('0x32'),_0x5a8d('0x33'),'recallme'],squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](_0x45511)[_0x5a8d('0x36')](_0x18cd78)[_0x5a8d('0x37')](_0x5a8d('0x38'),null,_0x5a8d('0x43')+_0x18cd78+'.CmListId')[_0x5a8d('0x37')](_0x468d40,null,_0x468d40+_0x5a8d('0x12')+_0x18cd78+'.'+_0x36fc0)[_0x5a8d('0x37')](_0x301ef8,null,_0x301ef8+_0x5a8d('0x12')+_0x18cd78+'.'+_0x36fc0)['where'](_0x18cd78+_0x5a8d('0x39'),_0x4fdbe1)['where'](_0x5a8d('0x3a'),NOW)['where'](_0x5a8d('0x3d'),selectNotIn(_0x18cd78,_0x468d40,_0x36fc0,'cm_hopper',[_0x5a8d('0x3b'),_0x5a8d('0x3c')]))[_0x5a8d('0x13')](_0x5a8d('0x3d'),selectNotIn(_0x18cd78,_0x468d40,_0x36fc0,_0x5a8d('0x2c'),['\x22always\x22'])))[_0x5a8d('0x44')]();return _0x150f7c;}function insertTzCmHopperBlack(_0x12830b,_0x2fc768,_0x16ddb6,_0x14d341){var _0x3c14c1=[_0x5a8d('0x23'),'cm_contacts.id',_0x5a8d('0x26'),_0x2fc768+'.'+_0x14d341,'cm_contacts.createdAt',_0x5a8d('0x28')];return squel[_0x5a8d('0x3e')]()[_0x5a8d('0x2b')]('cm_hopper_black')[_0x5a8d('0x40')]([_0x5a8d('0x11'),_0x5a8d('0x2e'),_0x5a8d('0x2f'),_0x14d341,_0x5a8d('0x30'),_0x5a8d('0x31')],squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](_0x3c14c1)[_0x5a8d('0x36')](_0x2fc768)[_0x5a8d('0x37')](_0x5a8d('0x38'),null,_0x5a8d('0x43')+_0x2fc768+_0x5a8d('0x45'))[_0x5a8d('0x37')](_0x16ddb6,null,_0x16ddb6+_0x5a8d('0x12')+_0x2fc768+'.'+_0x14d341)[_0x5a8d('0x13')](_0x2fc768+_0x5a8d('0x39'),_0x12830b)[_0x5a8d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5a8d('0x13')](_0x5a8d('0x3d'),squel[_0x5a8d('0xf')]()[_0x5a8d('0x10')]('phone')[_0x5a8d('0x36')](_0x5a8d('0x3f'))[_0x5a8d('0x13')](_0x5a8d('0x41'),_0x12830b)[_0x5a8d('0x13')](_0x14d341+_0x5a8d('0x14')+_0x2fc768+'.'+_0x14d341)))[_0x5a8d('0x44')]();}function insertCmHopperAdditionalPhones(_0x4da292){var _0x5d6b94=[_0x5a8d('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x5a8d('0x47'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x5a8d('0x2b')](_0x5a8d('0x48'))['fromQuery']([_0x5a8d('0x49'),_0x5a8d('0x11'),'OrderBy',_0x5a8d('0x30'),_0x5a8d('0x31')],squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](_0x5d6b94)[_0x5a8d('0x36')](_0x5a8d('0x2c'))[_0x5a8d('0x37')](_0x5a8d('0x38'),null,_0x5a8d('0x4a'))[_0x5a8d('0x37')](_0x5a8d('0x4b'),null,_0x5a8d('0x4c'))['where'](_0x5a8d('0x4d'),_0x4da292)[_0x5a8d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x5a8d('0x44')]();}function insertCmContact(_0x1f4317,_0x21a229,_0x128bde,_0x2cead1){var _0x115bb3=_[_0x5a8d('0x4e')](_[_0x5a8d('0x4f')](_0x2cead1),[_0x5a8d('0x2f'),_0x5a8d('0x50'),_0x5a8d('0x30'),'updatedAt',_0x5a8d('0x51')]);return squel[_0x5a8d('0x3e')]()[_0x5a8d('0x2b')]('cm_contacts')['fromQuery'](_0x115bb3,squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](_0x115bb3)[_0x5a8d('0x36')](_0x21a229)[_0x5a8d('0x13')]('('+_0x128bde[_0x5a8d('0x37')](',')+')\x20NOT\x20IN\x20?',squel[_0x5a8d('0xf')]()['fields'](_0x128bde)['from'](_0x5a8d('0x38'))[_0x5a8d('0x13')](_0x5a8d('0x41'),_0x1f4317)[_0x5a8d('0x13')](_0x5a8d('0x52')))['where'](_0x5a8d('0x53'),squel[_0x5a8d('0xf')]()[_0x5a8d('0x10')]('MIN(id)',_0x5a8d('0x54'))['from'](_0x21a229)[_0x5a8d('0x55')](_0x128bde[_0x5a8d('0x37')](','))))['toString']();}function handleStop(){logger['info'](_0x5a8d('0x56'));stopped=!![];}function handleUncaughtException(_0x29f8ec){logger['error'](_0x29f8ec['message']);process[_0x5a8d('0x57')](0x1);}function handleError(_0x11a733,_0x12f539){stats['errors']['push']({'name':_0x12f539[_0x5a8d('0x58')],'message':_0x12f539['message'],'row':_0x11a733});}function handleQuery(_0x2838f6){logger[_0x5a8d('0x59')](_0x2838f6);return db[_0x5a8d('0x5a')][_0x5a8d('0x5b')](_0x2838f6)[_0x5a8d('0x5c')](function(_0x427bf9){results[_0x5a8d('0x1a')](_0x427bf9);})[_0x5a8d('0x5d')](function(_0x5e384d){logger[_0x5a8d('0x5e')](_0x5e384d[_0x5a8d('0x5f')]);});}function updateTzCampaigns(_0x5ebb3d){return new Promise(function(_0x9c2492,_0x5d698c){var _0xaa759b=squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')](['campaigns.id',_0x5a8d('0x60')])[_0x5a8d('0x36')](_0x5a8d('0x61'))[_0x5a8d('0x37')]('campaigns_has_cm_lists',null,_0x5a8d('0x62'))[_0x5a8d('0x13')](_0x5a8d('0x63')+_0x5ebb3d);db[_0x5a8d('0x5a')][_0x5a8d('0x5b')](_0xaa759b[_0x5a8d('0x44')]())[_0x5a8d('0x5c')](function(_0x42417a){var _0x19a539=[];for(var _0x1c402b=0x0;_0x1c402b<_0x42417a['length'];_0x1c402b++){_0x19a539[_0x5a8d('0x1a')](getTimezoneData(_0x42417a[_0x1c402b],tmp_campaigns));}BPromise[_0x5a8d('0x1b')](_0x19a539)[_0x5a8d('0x18')](function(){_0x9c2492({'val':0x1});});})['catch'](function(_0x4b6ead){logger[_0x5a8d('0x5e')](_0x4b6ead[_0x5a8d('0x5f')]);_0x9c2492({'val':0x0});});});}function updateTzVoiceQueues(_0x39198d){return new Promise(function(_0x4ff97a,_0x6a4c31){var _0x1e7b3c=squel[_0x5a8d('0xf')]()[_0x5a8d('0x35')]([_0x5a8d('0x64'),_0x5a8d('0x65')])[_0x5a8d('0x36')](_0x5a8d('0x66'))[_0x5a8d('0x37')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x5a8d('0x67')+_0x39198d);db[_0x5a8d('0x5a')][_0x5a8d('0x5b')](_0x1e7b3c['toString']())['spread'](function(_0x2cf099){var _0x56afb8=[];for(var _0x55bee1=0x0;_0x55bee1<_0x2cf099[_0x5a8d('0x19')];_0x55bee1++){_0x56afb8['push'](getTimezoneData(_0x2cf099[_0x55bee1],tmp_voice_queues));}BPromise[_0x5a8d('0x1b')](_0x56afb8)[_0x5a8d('0x18')](function(){_0x4ff97a({'val':0x1});});})[_0x5a8d('0x5d')](function(_0x4458a7){logger['error'](_0x4458a7['message']);_0x4ff97a({'val':0x0});});});}function getTimezoneData(_0x1e8877,_0x2ac3df){return new Promise(function(_0x3005b1,_0x350fae){var _0x4ee03e=shared['timezones'];var _0x37247a=_0x4ee03e[_0x1e8877[_0x5a8d('0x68')]];if(_[_0x5a8d('0x1d')](_0x37247a)){_0x3005b1({'ret':0x1});}else{var _0x5ab575=_0x37247a[_0x5a8d('0x69')];var _0x33ef22=squel['insert']()[_0x5a8d('0x2b')](_0x2ac3df)['set']('id',_0x1e8877['id'])[_0x5a8d('0x6a')]('offset',_0x5ab575)[_0x5a8d('0x6a')](_0x5a8d('0x68'),_0x1e8877[_0x5a8d('0x68')])[_0x5a8d('0x44')]();return db[_0x5a8d('0x5a')][_0x5a8d('0x5b')](_0x33ef22)['spread'](function(_0x42eac4){_0x3005b1({'ret':0x1});})[_0x5a8d('0x5d')](function(_0xd5b5cb){logger['error'](_0xd5b5cb[_0x5a8d('0x5f')]);_0x350fae({'ret':0x1});});}});}function handleTZQuery(_0x3b7e5d){logger['info'](_0x3b7e5d);return db[_0x5a8d('0x5a')]['query'](_0x3b7e5d)[_0x5a8d('0x5c')](function(_0x34d320){})[_0x5a8d('0x5d')](function(_0x17a032){logger[_0x5a8d('0x5e')](_0x17a032[_0x5a8d('0x5f')]);});}function main(_0x588783,_0x2c2278,_0x151d3b,_0x5b554b){logger[_0x5a8d('0x59')](_0x5a8d('0x6b'),_0x588783,JSON['stringify'](_0x2c2278));process[_0x5a8d('0x6c')](_0x5a8d('0x6d'));var _0x2a0a0c=_0x2c2278[_0x5a8d('0x6e')];var _0x57d45e=_[_0x5a8d('0x6f')](_0x2a0a0c);var _0x342c0c=_0x2c2278[_0x5a8d('0x70')];var _0x5b5596=path[_0x5a8d('0x37')](config[_0x5a8d('0x71')],_0x5a8d('0x72'),_0x342c0c+'.csv');hasTZ=_[_0x5a8d('0x4f')](_0x2a0a0c)[_0x5a8d('0x73')](_0x5a8d('0x68'));var _0x41c0af=_[_0x5a8d('0x4f')](_0x2a0a0c)[_0x5a8d('0x37')]();logger[_0x5a8d('0x59')](_0x5a8d('0x74'),_0x41c0af);db[_0x5a8d('0x75')][_0x5a8d('0x76')]({'raw':!![],'attributes':['id',_0x5a8d('0x77')]})[_0x5a8d('0x18')](function(_0x5b3eb2){for(var _0xd8bd9=0x0;_0xd8bd9<_0x5b3eb2[_0x5a8d('0x19')];_0xd8bd9++){if(_0x5b3eb2[_0xd8bd9]['name']in _0x2a0a0c){contactItemTypes[_0x5a8d('0x1a')](_0x5b3eb2[_0xd8bd9]);delete _0x57d45e[_0x5b3eb2[_0xd8bd9][_0x5a8d('0x77')]];hasAdditionalPhones=!![];}for(var _0x2caf08 in _0x2a0a0c){if(_0x5b3eb2[_0xd8bd9][_0x5a8d('0x77')]+_0x5a8d('0x78')===_0x2caf08){phoneDescriptions[_0x5a8d('0x1a')]({'itemTypeId':_0x5b3eb2[_0xd8bd9]['id'],'description':_0x2caf08});delete _0x57d45e[_0x2caf08];}}}if(hasAdditionalPhones)_0x57d45e['AdditionalPhones']='';var _0x17e7c3=_[_0x5a8d('0x4f')](_0x57d45e)[_0x5a8d('0x37')]();logger['info'](_0x5a8d('0x74'),_0x17e7c3);fs[_0x5a8d('0x79')](_0x5b5596,_0x17e7c3+'\x0a');Papa['parse'](fs['createReadStream'](_0x588783),{'header':!![],'skipEmptyLines':!![],'step':function(_0x39eeb5,_0xe4e908){try{for(var _0x29accc=0x0,_0x30d3dd=[];_0x29accc<_0x39eeb5[_0x5a8d('0x7a')][_0x5a8d('0x19')];_0x29accc++){stats[_0x5a8d('0x7b')]+=0x1;if(_0x39eeb5[_0x5a8d('0x7c')][_0x29accc]){handleError(_0x39eeb5[_0x5a8d('0x7a')][_0x29accc],_0x39eeb5[_0x5a8d('0x7c')][_0x29accc]);}else{var _0x2b7225=[];var _0x4bde30=[];var _0x39dbfd={};for(var _0x5495cc in _0x2a0a0c){let _0x194fdd=contactItemTypes[_0x5a8d('0x7d')](_0x46a89c=>_0x46a89c[_0x5a8d('0x77')]===_0x5495cc);let _0x25b2f3=contactItemTypes[_0x5a8d('0x7d')](_0x54b82a=>_0x54b82a[_0x5a8d('0x77')]+_0x5a8d('0x78')===_0x5495cc);if(_['isNil'](_0x194fdd)&&_[_0x5a8d('0x1d')](_0x25b2f3)){if(_0x2a0a0c[_0x5a8d('0x7e')](_0x5495cc)){if(_0x39eeb5[_0x5a8d('0x7a')][_0x29accc][_0x2a0a0c[_0x5495cc]]){var _0x5ed71d=_['trim'](_0x39eeb5['data'][_0x29accc][_0x2a0a0c[_0x5495cc]][_0x5a8d('0x7f')](/"/g,'\x27'));switch(_0x5495cc){case'scheduledat':var _0x82d187=moment(_0x5ed71d,_0x5a8d('0xd'),!![]);if(_0x82d187[_0x5a8d('0x80')]()){_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x5ed71d+'\x22');}else{_0x2b7225[_0x5a8d('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5a8d('0x32'):var _0x4670a7=parseInt(_0x5ed71d);_0x5ed71d=_[_0x5a8d('0x81')](_0x4670a7)||_0x4670a7<0x0||_0x4670a7>0x4?_0x5b554b?0x3:0x2:_0x4670a7;_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x5ed71d+'\x22');break;case'UserId':var _0x4be990=parseInt(_0x5ed71d);if(_[_0x5a8d('0x82')](_0x4be990)&&_[_0x5a8d('0x73')](_0x151d3b,_0x4be990)){_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x4be990+'\x22');}else{_0x2b7225[_0x5a8d('0x1a')](_0x5a8d('0x83'));}break;case'email':if(isEmail(_0x5ed71d)){_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x5ed71d+'\x22');}else{_0x2b7225[_0x5a8d('0x1a')](_0x5a8d('0x84'));}break;case _0x5a8d('0x85'):var _0x3b76cc=moment(_0x5ed71d,'YYYY-MM-DD',!![]);if(_0x3b76cc[_0x5a8d('0x80')]()){_0x30d3dd['push']('\x22'+_0x5ed71d+'\x22');}else{_0x2b7225[_0x5a8d('0x1a')](_0x5a8d('0x86'));}break;case _0x5a8d('0x68'):var _0x1fdc88=shared['timezones'];var _0x32fa67=_0x1fdc88[_0x5ed71d];if(!_[_0x5a8d('0x1d')](_0x32fa67)){var _0x47decc=_0x32fa67['utcOffset'];_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x5ed71d+'\x22');_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x47decc+'\x22');}break;default:_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x5ed71d+'\x22');}}else{switch(_0x5495cc){case'firstName':case'phone':_0x2b7225[_0x5a8d('0x1a')](_0x5495cc+_0x5a8d('0x87'));break;default:_0x30d3dd[_0x5a8d('0x1a')]('\x22\x22');}}}}else{var _0x3889fd='';if(!_[_0x5a8d('0x1d')](_0x194fdd)){if(!_0x39dbfd[_0x5a8d('0x7e')](_0x194fdd['id'])){if(!_[_0x5a8d('0x1d')](_0x39eeb5['data'][_0x29accc][_0x2a0a0c[_0x5495cc]])){var _0x5ed71d=_['trim'](_0x39eeb5[_0x5a8d('0x7a')][_0x29accc][_0x2a0a0c[_0x5495cc]]['replace'](/"/g,'\x27'));var _0x5905cc=phoneDescriptions[_0x5a8d('0x7d')](_0x48b1a6=>_0x48b1a6[_0x5a8d('0x88')]===_0x194fdd['id']);if(!_['isNil'](_0x5905cc)){var _0x4604da=_[_0x5a8d('0x89')](_0x39eeb5['data'][_0x29accc][_0x2a0a0c[_0x5905cc['description']]][_0x5a8d('0x7f')](/"/g,'\x27'));if(!_[_0x5a8d('0x1d')](_0x4604da))_0x5ed71d=_0x5ed71d+'§'+_0x4604da;}if(_0x3889fd=='')_0x3889fd=_0x5ed71d;else _0x3889fd+='|'+_0x5ed71d;}_0x4bde30[_0x5a8d('0x1a')](_0x194fdd['id']+':'+_0x3889fd);_0x39dbfd[_0x194fdd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x30d3dd[_0x5a8d('0x1a')]('\x22'+_0x4bde30['join'](';')+'\x22');}if(_0x2b7225[_0x5a8d('0x19')]){handleError(_0x39eeb5[_0x5a8d('0x7a')][_0x29accc],{'code':_0x5a8d('0x8a'),'message':_0x2b7225[_0x5a8d('0x37')]()});}else{fs[_0x5a8d('0x8b')](_0x5b5596,_0x30d3dd[_0x5a8d('0x37')]()+'\x0a');}_0x30d3dd=[];}if(!(stats[_0x5a8d('0x7b')]%0xc8)){socket[_0x5a8d('0x8c')](_0x5a8d('0x8d')+_0x342c0c,stats);stats[_0x5a8d('0x7c')]=[];}}if(stopped){logger[_0x5a8d('0x59')](_0x5a8d('0x8e'));_0xe4e908[_0x5a8d('0x8f')]();}}catch(_0x55af48){handleError(_0x39eeb5[_0x5a8d('0x7a')][_0x29accc],{'code':_0x5a8d('0x90'),'message':_0x55af48[_0x5a8d('0x5f')]});logger['error'](_0x5a8d('0x91'),_0x55af48[_0x5a8d('0x5f')]);}},'complete':function(){try{var _0x243770=[];var _0x642f92=[];var _0x2406d6=_0x5a8d('0x38');if(_0x2c2278[_0x5a8d('0x92')]&&_0x2c2278[_0x5a8d('0x92')]['length']){_0x2406d6=_0x5a8d('0x93')+_0x342c0c;_0x243770[_0x5a8d('0x1a')](_0x5a8d('0x94')+_0x2406d6+_0x5a8d('0x95'));}tmp_campaigns='campaigns_'+_0x342c0c;tmp_voice_queues='voice_queues_'+_0x342c0c;_0x642f92[_0x5a8d('0x1a')](_0x5a8d('0x94')+tmp_campaigns+_0x5a8d('0x96'));_0x642f92[_0x5a8d('0x1a')](_0x5a8d('0x94')+tmp_voice_queues+_0x5a8d('0x96'));BPromise['each'](_0x642f92,handleTZQuery)[_0x5a8d('0x18')](function(_0x2f3f75){updateTzCampaigns(_0x2c2278[_0x5a8d('0x2f')])[_0x5a8d('0x18')](function(_0x23229d){updateTzVoiceQueues(_0x2c2278[_0x5a8d('0x2f')])['then'](function(_0xfa216e){if(hasTZ)_0x17e7c3=_0x17e7c3[_0x5a8d('0x7f')](_0x5a8d('0x68'),_0x5a8d('0x97'));var _0x3fca7f=util[_0x5a8d('0xc')](_0x5a8d('0x98'),_0x5b5596,_0x2406d6,_0x17e7c3,_0x2c2278[_0x5a8d('0x2f')],_0x2c2278[_0x5a8d('0x50')]||null,NOW,NOW);if(_[_0x5a8d('0x1d')](_0x2a0a0c[_0x5a8d('0x2d')])){_0x3fca7f+=_0x5a8d('0x99');}_0x243770[_0x5a8d('0x1a')](_0x3fca7f);if(_0x2c2278[_0x5a8d('0x92')]&&_0x2c2278[_0x5a8d('0x92')]['length']){_0x243770[_0x5a8d('0x1a')](insertCmContact(_0x2c2278[_0x5a8d('0x2f')],_0x2406d6,_0x2c2278[_0x5a8d('0x92')],_0x2a0a0c));_0x243770['push']('DROP\x20TABLE\x20'+_0x2406d6+';');}BPromise[_0x5a8d('0x9a')](_0x243770,handleQuery)['then'](function(_0x2788eb){BPromise[_0x5a8d('0x1b')]([handleAdditionalPhones()])[_0x5a8d('0x18')](function(){_0x243770=[];for(var _0x41b611=0x0;_0x41b611_0x479ab3[_0x5b4e('0x66')]===_0x5a0962);let _0x3f55b0=contactItemTypes[_0x5b4e('0x6a')](_0x10a976=>_0x10a976[_0x5b4e('0x66')]+_0x5b4e('0x6b')===_0x5a0962);if(_[_0x5b4e('0x1d')](_0x147484)&&_[_0x5b4e('0x1d')](_0x3f55b0)){if(_0x30b167[_0x5b4e('0x6c')](_0x5a0962)){if(_0x14e9fa[_0x5b4e('0x68')][_0x2e64e4][_0x30b167[_0x5a0962]]){var _0x5ac807=_[_0x5b4e('0x6d')](_0x14e9fa[_0x5b4e('0x68')][_0x2e64e4][_0x30b167[_0x5a0962]][_0x5b4e('0x6e')](/"/g,'\x27'));switch(_0x5a0962){case _0x5b4e('0x36'):var _0x30d11f=moment(_0x5ac807,_0x5b4e('0xd'),!![]);if(_0x30d11f[_0x5b4e('0x6f')]()){_0x3582de[_0x5b4e('0x1f')]('\x22'+_0x5ac807+'\x22');}else{_0x43e38b['push'](_0x5b4e('0x70'));}break;case _0x5b4e('0x71'):var _0x535098=parseInt(_0x5ac807);_0x5ac807=_[_0x5b4e('0x72')](_0x535098)||_0x535098<0x0||_0x535098>0x4?_0x291565?0x3:0x2:_0x535098;_0x3582de['push']('\x22'+_0x5ac807+'\x22');break;case _0x5b4e('0x73'):var _0x54f973=parseInt(_0x5ac807);if(_[_0x5b4e('0x74')](_0x54f973)&&_[_0x5b4e('0x75')](_0x19ac43,_0x54f973)){_0x3582de[_0x5b4e('0x1f')]('\x22'+_0x54f973+'\x22');}else{_0x43e38b['push'](_0x5b4e('0x76'));}break;case _0x5b4e('0x77'):if(isEmail(_0x5ac807)){_0x3582de[_0x5b4e('0x1f')]('\x22'+_0x5ac807+'\x22');}else{_0x43e38b[_0x5b4e('0x1f')](_0x5b4e('0x78'));}break;case'dateOfBirth':var _0x162507=moment(_0x5ac807,_0x5b4e('0x79'),!![]);if(_0x162507[_0x5b4e('0x6f')]()){_0x3582de['push']('\x22'+_0x5ac807+'\x22');}else{_0x43e38b[_0x5b4e('0x1f')](_0x5b4e('0x7a'));}break;default:_0x3582de['push']('\x22'+_0x5ac807+'\x22');}}else{switch(_0x5a0962){case _0x5b4e('0x7b'):case'phone':_0x43e38b[_0x5b4e('0x1f')](_0x5a0962+_0x5b4e('0x7c'));break;default:_0x3582de[_0x5b4e('0x1f')]('\x22\x22');}}}}else{var _0xb3c678='';if(!_[_0x5b4e('0x1d')](_0x147484)){if(!_0x504ab6[_0x5b4e('0x6c')](_0x147484['id'])){for(var _0x2b35c1=0x0;_0x2b35c1<_0x30b167[_0x5a0962]['length'];_0x2b35c1++){var _0x5ac807=_['trim'](_0x14e9fa[_0x5b4e('0x68')][_0x2e64e4][_0x30b167[_0x5a0962][_0x2b35c1]][_0x5b4e('0x6e')](/"/g,'\x27'));var _0x1a1a0e=phoneDescriptions[_0x5b4e('0x6a')](_0x3bbf12=>_0x3bbf12[_0x5b4e('0x7d')]===_0x147484['id']);if(!_[_0x5b4e('0x1d')](_0x1a1a0e)){var _0x497c18=_[_0x5b4e('0x6d')](_0x14e9fa['data'][_0x2e64e4][_0x30b167[_0x1a1a0e[_0x5b4e('0x7e')]][0x0]][_0x5b4e('0x6e')](/"/g,'\x27'));if(!_[_0x5b4e('0x1d')](_0x497c18))_0x5ac807=_0x5ac807+'§'+_0x497c18;}if(_0xb3c678=='')_0xb3c678=_0x5ac807;else _0xb3c678+='|'+_0x5ac807;}_0x22d968[_0x5b4e('0x1f')](_0x147484['id']+':'+_0xb3c678);_0x504ab6[_0x147484['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3582de['push']('\x22'+_0x22d968['join'](';')+'\x22');}if(_0x43e38b['length']){handleError(_0x14e9fa[_0x5b4e('0x68')][_0x2e64e4],{'code':_0x5b4e('0x7f'),'message':_0x43e38b[_0x5b4e('0x15')]()});}else{fs[_0x5b4e('0x80')](_0x419a89,_0x3582de[_0x5b4e('0x15')]()+'\x0a');}_0x3582de=[];}if(!(stats['rows']%0xc8)){socket[_0x5b4e('0x81')](_0x5b4e('0x82')+_0x47c0a9,stats);stats[_0x5b4e('0x59')]=[];}}if(stopped){logger[_0x5b4e('0x5b')]('Abort\x20parser');_0x26db4c[_0x5b4e('0x83')]();}}catch(_0x2d4bef){handleError(_0x14e9fa['data'][_0x2e64e4],{'code':_0x5b4e('0x84'),'message':_0x2d4bef[_0x5b4e('0x23')]});logger['error'](_0x5b4e('0x85'),_0x2d4bef[_0x5b4e('0x23')]);}},'complete':function(){try{var _0x92fbdb=[];var _0x12f1e2=tempTableName;_0x92fbdb[_0x5b4e('0x1f')](_0x5b4e('0x86')+_0x12f1e2+_0x5b4e('0x87'));logger[_0x5b4e('0x5b')](_0x5b4e('0x88'),contactItemTypes[_0x5b4e('0x1c')]);var _0x18480e=util[_0x5b4e('0xc')](_0x5b4e('0x89'),_0x419a89,_0x12f1e2,_0x172e73,_0x1eb1e0['ListId'],_0x1eb1e0[_0x5b4e('0x53')]||null,NOW,NOW);if(_[_0x5b4e('0x1d')](_0x30b167[_0x5b4e('0x36')])){_0x18480e+=_0x5b4e('0x8a');}_0x92fbdb[_0x5b4e('0x1f')](_0x18480e);BPromise[_0x5b4e('0x8b')](_0x92fbdb,handleQuery)[_0x5b4e('0x26')](function(_0x5de2a7){BPromise[_0x5b4e('0x20')]([handleAdditionalPhones()])[_0x5b4e('0x26')](function(){_0x92fbdb=[];for(var _0x3ef6ee=0x0;_0x3ef6ee\x20\x20');}var _0x2dd06c=path[_0x5b4e('0x15')](config['root'],_0x5b4e('0x61'),process[_0x5b4e('0x93')][0x2]);if(!fs[_0x5b4e('0x94')](_0x2dd06c)){throw new Error(_0x5b4e('0x95'));}var _0x180af4={};try{_0x180af4=JSON['parse'](process[_0x5b4e('0x93')][0x3]);if(!_0x180af4[_0x5b4e('0x96')]){throw new Error(_0x5b4e('0x97'));}var _0xf8a126=0x0;if(_0x180af4[_0x5b4e('0x96')][_0x5b4e('0x73')]){_0xf8a126=0x1;}if(!_0x180af4['ListId']){throw new Error(_0x5b4e('0x98'));}}catch(_0x658e3b){throw new Error('body\x20id\x20mandatory');}var _0x1dc716=[];try{_0x1dc716=_[_0x5b4e('0x99')](JSON['parse'](process[_0x5b4e('0x93')][0x4]),'id');}catch(_0x539259){logger[_0x5b4e('0x5b')](_0x5b4e('0x9a'));}main(_0x2dd06c,_0x180af4,_0x1dc716,_0xf8a126);}validate();process['on'](_0x5b4e('0x9b'),handleStop);process['on'](_0x5b4e('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x7d87=['.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','email','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','CIS\x20len','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','then','filter','CmContactHasItem','updated','create','PHONE','CmContact','update','CmHopper','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','into','cm_hopper_black','updatedAt','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','exit','errors','code','main','send','binding','clone','socket_timestamp','root'];(function(_0x3c3842,_0x24d84d){var _0x1f5ddc=function(_0x557836){while(--_0x557836){_0x3c3842['push'](_0x3c3842['shift']());}};_0x1f5ddc(++_0x24d84d);}(_0x7d87,0x178));var _0x77d8=function(_0x13ca07,_0x22b8ef){_0x13ca07=_0x13ca07-0x0;var _0x48782e=_0x7d87[_0x13ca07];return _0x48782e;};'use strict';var fs=require('fs');var path=require(_0x77d8('0x0'));var _=require('lodash');var Papa=require(_0x77d8('0x1'));var util=require(_0x77d8('0x2'));var BPromise=require(_0x77d8('0x3'));var moment=require(_0x77d8('0x4'));var squel=require(_0x77d8('0x5'));var Redis=require(_0x77d8('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x77d8('0x7'));var logger=require(_0x77d8('0x8'))(_0x77d8('0x9'));config[_0x77d8('0xa')]=_[_0x77d8('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x77d8('0xc'))(new Redis(config[_0x77d8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x77d8('0xd')](_0x77d8('0xe'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0x77d8('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xccf71){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))*$/[_0x77d8('0x10')](_0xccf71);}function selectNotIn(_0x2befb6,_0x4a3fc2,_0x360c78,_0x27a359,_0x113215){return squel[_0x77d8('0x11')]()[_0x77d8('0x12')](_0x77d8('0x13'))[_0x77d8('0x14')](_0x27a359)[_0x77d8('0x15')](_0x4a3fc2,null,_0x4a3fc2+_0x77d8('0x16')+_0x27a359+'.'+_0x360c78)[_0x77d8('0x17')](_0x27a359+'.'+_0x360c78+_0x77d8('0x18')+_0x2befb6+'.'+_0x360c78)[_0x77d8('0x17')](_0x4a3fc2+_0x77d8('0x19')+_0x113215[_0x77d8('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2aa5da,_0x2684fb){promisesAdditionalPhones=[];promisesContact=[];return db[_0x77d8('0x1a')][_0x77d8('0x1b')](_0x77d8('0x1c')+tempTableName)[_0x77d8('0x1d')](function(_0x15949a){if(_0x15949a!==null){var _0x10c526=[];for(var _0x2a7c6d=0x0;_0x2a7c6d<_0x15949a[_0x77d8('0x1e')];_0x2a7c6d++){var _0x400908=_0x15949a[_0x2a7c6d];if(!_[_0x77d8('0x1f')](_0x400908[_0x77d8('0x13')])){if(!_['isNil'](_0x400908[_0x77d8('0x20')]))_0x10c526[_0x77d8('0x21')](insertAdditionalPhones(_0x400908));promisesContact[_0x77d8('0x21')]({'contact':_0x400908});}}}Promise[_0x77d8('0x22')](_0x10c526)['then'](function(){_0x2aa5da({'val':0x1});});})[_0x77d8('0x23')](function(_0x518f57){logger[_0x77d8('0x24')](_0x518f57[_0x77d8('0x25')]);});});}function insertAdditionalPhones(_0x408c8e){return new Promise(function(_0x25f528,_0x52031a){var _0x4ef397=_0x408c8e['AdditionalPhones'];if(_[_0x77d8('0x1f')](_0x4ef397))_0x52031a({'val':0x0});else{var _0x28cd52=_0x4ef397[_0x77d8('0x26')](';');var _0x56593=[];orderBy=0x0;for(var _0x50a226=0x0;_0x50a226<_0x28cd52['length'];_0x50a226++){_0x56593[_0x77d8('0x21')](splitAdditionalPhone(_0x408c8e['id'],_0x28cd52[_0x50a226]));}Promise[_0x77d8('0x22')](_0x56593)[_0x77d8('0x27')](function(){_0x25f528({'val':_0x28cd52['length']});});}});}function splitAdditionalPhone(_0x353578,_0x2fc364){return new Promise(function(_0x14238c,_0x226bcb){var _0x5ce1f7=_0x2fc364[_0x77d8('0x26')](':');var _0x188001=_0x5ce1f7[0x0];var _0x11a847=_0x5ce1f7[0x1];if(_0x11a847!==''){var _0x4540ee=_0x11a847[_0x77d8('0x26')]('|');var _0xf3193f=[];for(var _0x29edd9=0x0;_0x29edd9<_0x4540ee[_0x77d8('0x1e')];_0x29edd9++){if(_0x4540ee[_0x29edd9]!==''){var _0xf9bb00=_[_0x77d8('0x28')](promisesAdditionalPhones,{'contactId':_0x353578,'phone':_0x4540ee[_0x29edd9]});if(_0xf9bb00[_0x77d8('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x77d8('0x21')]({'contactId':_0x353578,'contactTypeId':_0x188001,'phone':_0x4540ee[_0x29edd9],'orderBy':orderBy});}}}_0x14238c({'ok':0x1});}else _0x14238c({'res':0x0});});}function createAdditionalPhone(_0x104512,_0x3843bf,_0x3116ef,_0x3f555b){var _0x43e8a8='';var _0x22ca93='';var _0x2c22cc=_0x3116ef['split']('§');_0x43e8a8=_0x2c22cc[0x0];if(_0x2c22cc['length']==0x2)_0x22ca93=_0x2c22cc[0x1];return new Promise(function(_0x1139cc,_0x2db673){return db[_0x77d8('0x29')]['findOne']({'where':{'CmContactId':_0x104512,'item':_0x43e8a8}})[_0x77d8('0x27')](function(_0x4b83ac){if(_0x4b83ac){return db['CmContactHasItem']['update']({'ItemTypeId':_0x3843bf,'description':_0x22ca93,'OrderBy':_0x3f555b},{'where':{'CmContactId':_0x104512,'item':_0x43e8a8}})[_0x77d8('0x27')](function(_0x166e7e){_0x1139cc({'res':_0x77d8('0x2a')});});}else{return db[_0x77d8('0x29')][_0x77d8('0x2b')]({'CmContactId':_0x104512,'item':_0x43e8a8,'ItemTypeId':_0x3843bf,'description':_0x22ca93,'OrderBy':_0x3f555b,'ItemClass':_0x77d8('0x2c')})[_0x77d8('0x27')](function(_0x11c87f){_0x1139cc({'res':'inserted'});});}});});}function updateContact(_0x263563){return new Promise(function(_0x423b6e,_0x83fb31){var _0x1be98b=_0x263563['id'];delete _0x263563['id'];return db[_0x77d8('0x2d')][_0x77d8('0x2e')](_0x263563,{'where':{'id':_0x1be98b}})[_0x77d8('0x27')](function(_0x2dc1b9){updatedRows+=0x1;return db[_0x77d8('0x2f')][_0x77d8('0x2e')]({'phone':_0x263563[_0x77d8('0x13')]},{'where':{'ContactId':_0x1be98b}})[_0x77d8('0x27')](function(_0x18daa6){_0x423b6e({'ret':'OK'});});});});}function insertCmHopper(_0x57d999,_0x5dd478,_0x1e5d76,_0x3d59a5,_0x56cc2c){var _0x2b227d=['cm_contacts.phone',_0x77d8('0x30'),'cm_contacts.id',_0x77d8('0x31'),_0x5dd478+'.'+_0x3d59a5,_0x77d8('0x32'),'cm_contacts.updatedAt',_0x77d8('0x33'),_0x77d8('0x34'),'\x22'+_0x56cc2c+'\x22'];return squel[_0x77d8('0x35')]()['into'](_0x77d8('0x36'))[_0x77d8('0x37')](['phone','scheduledat',_0x77d8('0x38'),_0x77d8('0x39'),_0x3d59a5,_0x77d8('0x3a'),'updatedAt','priority',_0x77d8('0x3b'),_0x77d8('0x3c')],squel[_0x77d8('0x11')]()[_0x77d8('0x3d')](_0x2b227d)[_0x77d8('0x14')](_0x5dd478)[_0x77d8('0x15')](_0x77d8('0x3e'),null,_0x77d8('0x3f')+_0x5dd478+_0x77d8('0x40'))['join'](_0x1e5d76,null,_0x1e5d76+_0x77d8('0x16')+_0x5dd478+'.'+_0x3d59a5)[_0x77d8('0x17')](_0x5dd478+_0x77d8('0x41'),_0x57d999)['where'](_0x77d8('0x42'),NOW)[_0x77d8('0x17')](_0x77d8('0x43'),selectNotIn(_0x5dd478,_0x1e5d76,_0x3d59a5,_0x77d8('0x36'),[_0x77d8('0x44'),_0x77d8('0x45')]))['where'](_0x77d8('0x43'),selectNotIn(_0x5dd478,_0x1e5d76,_0x3d59a5,_0x77d8('0x36'),[_0x77d8('0x44')])))['toString']();}function insertCmHopperBlack(_0x2b9959,_0x4c82fa,_0x133b48,_0x58ec11){var _0x3e4320=[_0x77d8('0x46'),_0x77d8('0x47'),_0x77d8('0x31'),_0x4c82fa+'.'+_0x58ec11,_0x77d8('0x32'),_0x77d8('0x48')];return squel['insert']()[_0x77d8('0x49')](_0x77d8('0x4a'))['fromQuery'](['phone',_0x77d8('0x38'),_0x77d8('0x39'),_0x58ec11,_0x77d8('0x3a'),_0x77d8('0x4b')],squel[_0x77d8('0x11')]()[_0x77d8('0x3d')](_0x3e4320)[_0x77d8('0x14')](_0x4c82fa)[_0x77d8('0x15')]('cm_contacts',null,_0x77d8('0x3f')+_0x4c82fa+_0x77d8('0x40'))[_0x77d8('0x15')](_0x133b48,null,_0x133b48+'.id\x20=\x20'+_0x4c82fa+'.'+_0x58ec11)[_0x77d8('0x17')](_0x4c82fa+'.CmListId\x20=\x20?',_0x2b9959)[_0x77d8('0x17')](_0x77d8('0x42'),NOW)[_0x77d8('0x17')](_0x77d8('0x43'),squel['select']()[_0x77d8('0x12')](_0x77d8('0x13'))[_0x77d8('0x14')](_0x77d8('0x4a'))[_0x77d8('0x17')]('ListId\x20=\x20?',_0x2b9959)[_0x77d8('0x17')](_0x58ec11+_0x77d8('0x4c'),_0x4c82fa+'.'+_0x58ec11)))[_0x77d8('0x4d')]();}function insertCmHopperAdditionalPhones(_0x4b9944){var _0x5c82bc=['cm_hopper.id',_0x77d8('0x4e'),_0x77d8('0x4f'),'cm_contact_has_items.createdAt',_0x77d8('0x50')];return squel['insert']()[_0x77d8('0x49')](_0x77d8('0x51'))['fromQuery']([_0x77d8('0x52'),'phone','OrderBy',_0x77d8('0x3a'),'updatedAt'],squel[_0x77d8('0x11')]()[_0x77d8('0x3d')](_0x5c82bc)[_0x77d8('0x14')](_0x77d8('0x36'))[_0x77d8('0x15')]('cm_contacts',null,_0x77d8('0x53'))[_0x77d8('0x15')](_0x77d8('0x54'),null,_0x77d8('0x55'))[_0x77d8('0x17')](_0x77d8('0x56'),_0x4b9944)[_0x77d8('0x17')](_0x77d8('0x42'),NOW))[_0x77d8('0x4d')]();}function insertCmContact(_0x42e1d5,_0x29dc98,_0x1015ff,_0xae98e8){var _0x40fd5c=_['concat'](_[_0x77d8('0x57')](_0xae98e8),['ListId','CompanyId',_0x77d8('0x3a'),_0x77d8('0x4b')]);return squel[_0x77d8('0x35')]()[_0x77d8('0x49')](_0x77d8('0x3e'))['fromQuery'](_0x40fd5c,squel[_0x77d8('0x11')]()[_0x77d8('0x3d')](_0x40fd5c)[_0x77d8('0x14')](_0x29dc98)[_0x77d8('0x17')]('('+_0x1015ff[_0x77d8('0x15')](',')+_0x77d8('0x58'),squel[_0x77d8('0x11')]()[_0x77d8('0x3d')](_0x1015ff)[_0x77d8('0x14')]('cm_contacts')[_0x77d8('0x17')](_0x77d8('0x59'),_0x42e1d5))[_0x77d8('0x17')](_0x77d8('0x5a'),squel['select']()[_0x77d8('0x12')](_0x77d8('0x5b'),'min_id')[_0x77d8('0x14')](_0x29dc98)[_0x77d8('0x5c')](_0x1015ff[_0x77d8('0x15')](','))))[_0x77d8('0x4d')]();}function handleStop(){logger[_0x77d8('0x5d')](_0x77d8('0x5e'));stopped=!![];}function handleUncaughtException(_0x8cc2fc){logger[_0x77d8('0x24')](_0x8cc2fc[_0x77d8('0x25')]);process[_0x77d8('0x5f')](0x1);}function handleError(_0x4646cd,_0x56e2ee){stats[_0x77d8('0x60')][_0x77d8('0x21')]({'name':_0x56e2ee[_0x77d8('0x61')],'message':_0x56e2ee['message'],'row':_0x4646cd});}function handleQuery(_0xe413a5){logger[_0x77d8('0x5d')](_0xe413a5);return db['sequelize'][_0x77d8('0x1b')](_0xe413a5)['spread'](function(_0x3ed983){results['push'](_0x3ed983);})[_0x77d8('0x23')](function(_0x6081b5){logger['error'](_0x6081b5[_0x77d8('0x25')]);});}function main(_0x5c1b14,_0x379b7e,_0x4fcff3,_0x5412a9){logger[_0x77d8('0x5d')](_0x77d8('0x62'),_0x5c1b14,JSON['stringify'](_0x379b7e));process[_0x77d8('0x63')]('start');var _0x36b06d=_0x379b7e[_0x77d8('0x64')];var _0x36bff1=_[_0x77d8('0x65')](_0x36b06d);var _0x1118ae=_0x379b7e[_0x77d8('0x66')];var _0x214fe7=path[_0x77d8('0x15')](config[_0x77d8('0x67')],'server/files/tmp',_0x1118ae+_0x77d8('0x68'));logger['info'](_0x77d8('0x69'),_0x379b7e);db[_0x77d8('0x6a')][_0x77d8('0x6b')]({'raw':!![],'attributes':['id',_0x77d8('0x6c')]})[_0x77d8('0x27')](function(_0x36060f){for(var _0x3f476c=0x0;_0x3f476c<_0x36060f[_0x77d8('0x1e')];_0x3f476c++){if(_0x36060f[_0x3f476c][_0x77d8('0x6c')]in _0x36b06d){contactItemTypes[_0x77d8('0x21')](_0x36060f[_0x3f476c]);delete _0x36bff1[_0x36060f[_0x3f476c][_0x77d8('0x6c')]];hasAdditionalPhones=!![];}for(var _0x498215 in _0x36b06d){if(_0x36060f[_0x3f476c]['name']+_0x77d8('0x6d')===_0x498215){phoneDescriptions['push']({'itemTypeId':_0x36060f[_0x3f476c]['id'],'description':_0x498215});delete _0x36bff1[_0x498215];}}}if(hasAdditionalPhones)_0x36bff1[_0x77d8('0x20')]='';var _0x39ed4f=_[_0x77d8('0x57')](_0x36bff1)[_0x77d8('0x15')]();logger['info'](_0x77d8('0x6e'),_0x39ed4f);fs[_0x77d8('0x6f')](_0x214fe7,_0x39ed4f+'\x0a');Papa[_0x77d8('0x70')](fs[_0x77d8('0x71')](_0x5c1b14),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3199f5,_0x3cc0df){try{for(var _0x18cd67=0x0,_0x516318=[];_0x18cd67<_0x3199f5[_0x77d8('0x72')][_0x77d8('0x1e')];_0x18cd67++){stats['rows']+=0x1;if(_0x3199f5['errors'][_0x18cd67]){handleError(_0x3199f5[_0x77d8('0x72')][_0x18cd67],_0x3199f5[_0x77d8('0x60')][_0x18cd67]);}else{var _0x3d4464=[];var _0x96eb05=[];var _0x398053={};for(var _0x21e514 in _0x36b06d){let _0x5aabfb=contactItemTypes[_0x77d8('0x73')](_0x6f010=>_0x6f010[_0x77d8('0x6c')]===_0x21e514);let _0x5f1d05=contactItemTypes[_0x77d8('0x73')](_0x5b7085=>_0x5b7085['name']+_0x77d8('0x6d')===_0x21e514);if(_['isNil'](_0x5aabfb)&&_['isNil'](_0x5f1d05)){if(_0x36b06d[_0x77d8('0x74')](_0x21e514)){if(_0x3199f5[_0x77d8('0x72')][_0x18cd67][_0x36b06d[_0x21e514]]){var _0x363e7d=_[_0x77d8('0x75')](_0x3199f5['data'][_0x18cd67][_0x36b06d[_0x21e514]][_0x77d8('0x76')](/"/g,'\x27'));switch(_0x21e514){case _0x77d8('0x77'):var _0x3f875f=moment(_0x363e7d,_0x77d8('0xe'),!![]);if(_0x3f875f[_0x77d8('0x78')]()){_0x516318[_0x77d8('0x21')]('\x22'+_0x363e7d+'\x22');}else{_0x3d4464['push'](_0x77d8('0x79'));}break;case _0x77d8('0x7a'):var _0x5087f2=parseInt(_0x363e7d);_0x363e7d=_[_0x77d8('0x7b')](_0x5087f2)||_0x5087f2<0x0||_0x5087f2>0x4?_0x5412a9?0x3:0x2:_0x5087f2;_0x516318[_0x77d8('0x21')]('\x22'+_0x363e7d+'\x22');break;case _0x77d8('0x3b'):var _0x385d9a=parseInt(_0x363e7d);if(_[_0x77d8('0x7c')](_0x385d9a)&&_['includes'](_0x4fcff3,_0x385d9a)){_0x516318['push']('\x22'+_0x385d9a+'\x22');}else{_0x3d4464[_0x77d8('0x21')]('agent\x20not\x20exists');}break;case _0x77d8('0x7d'):if(isEmail(_0x363e7d)){_0x516318[_0x77d8('0x21')]('\x22'+_0x363e7d+'\x22');}else{_0x3d4464[_0x77d8('0x21')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1c8db0=moment(_0x363e7d,'YYYY-MM-DD',!![]);if(_0x1c8db0[_0x77d8('0x78')]()){_0x516318[_0x77d8('0x21')]('\x22'+_0x363e7d+'\x22');}else{_0x3d4464['push'](_0x77d8('0x7e'));}break;default:_0x516318[_0x77d8('0x21')]('\x22'+_0x363e7d+'\x22');}}else{switch(_0x21e514){case _0x77d8('0x7f'):case _0x77d8('0x13'):_0x3d4464[_0x77d8('0x21')](_0x21e514+_0x77d8('0x80'));break;default:_0x516318['push']('\x22\x22');}}}}else{var _0x272f44='';if(!_[_0x77d8('0x1f')](_0x5aabfb)){if(!_0x398053[_0x77d8('0x74')](_0x5aabfb['id'])){for(var _0x2cbdd9=0x0;_0x2cbdd9<_0x36b06d[_0x21e514][_0x77d8('0x1e')];_0x2cbdd9++){var _0x363e7d=_['trim'](_0x3199f5[_0x77d8('0x72')][_0x18cd67][_0x36b06d[_0x21e514][_0x2cbdd9]][_0x77d8('0x76')](/"/g,'\x27'));var _0x1e9497=phoneDescriptions[_0x77d8('0x73')](_0x5a8d5a=>_0x5a8d5a['itemTypeId']===_0x5aabfb['id']);if(!_[_0x77d8('0x1f')](_0x1e9497)){var _0x193dab=_[_0x77d8('0x75')](_0x3199f5[_0x77d8('0x72')][_0x18cd67][_0x36b06d[_0x1e9497[_0x77d8('0x81')]][0x0]][_0x77d8('0x76')](/"/g,'\x27'));if(!_[_0x77d8('0x1f')](_0x193dab))_0x363e7d=_0x363e7d+'§'+_0x193dab;}if(_0x272f44=='')_0x272f44=_0x363e7d;else _0x272f44+='|'+_0x363e7d;}_0x96eb05[_0x77d8('0x21')](_0x5aabfb['id']+':'+_0x272f44);_0x398053[_0x5aabfb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x516318['push']('\x22'+_0x96eb05[_0x77d8('0x15')](';')+'\x22');}if(_0x3d4464[_0x77d8('0x1e')]){handleError(_0x3199f5['data'][_0x18cd67],{'code':_0x77d8('0x82'),'message':_0x3d4464[_0x77d8('0x15')]()});}else{fs['appendFileSync'](_0x214fe7,_0x516318['join']()+'\x0a');}_0x516318=[];}if(!(stats[_0x77d8('0x83')]%0xc8)){socket[_0x77d8('0x84')](_0x77d8('0x85')+_0x1118ae,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x77d8('0x86'));_0x3cc0df[_0x77d8('0x87')]();}}catch(_0x237268){handleError(_0x3199f5[_0x77d8('0x72')][_0x18cd67],{'code':_0x77d8('0x88'),'message':_0x237268[_0x77d8('0x25')]});logger['error']('step',_0x237268[_0x77d8('0x25')]);}},'complete':function(){try{var _0x280ba6=[];var _0x4d6f79=tempTableName;_0x280ba6[_0x77d8('0x21')](_0x77d8('0x89')+_0x4d6f79+'\x20LIKE\x20cm_contacts;');logger[_0x77d8('0x5d')](_0x77d8('0x8a'),contactItemTypes['length']);var _0x51591c=util[_0x77d8('0xd')]('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',_0x214fe7,_0x4d6f79,_0x39ed4f,_0x379b7e[_0x77d8('0x39')],_0x379b7e[_0x77d8('0x8b')]||null,NOW,NOW);if(_[_0x77d8('0x1f')](_0x36b06d['scheduledat'])){_0x51591c+=_0x77d8('0x8c');}_0x280ba6[_0x77d8('0x21')](_0x51591c);BPromise[_0x77d8('0x8d')](_0x280ba6,handleQuery)[_0x77d8('0x27')](function(_0x560d3f){BPromise[_0x77d8('0x22')]([handleAdditionalPhones()])[_0x77d8('0x27')](function(){_0x280ba6=[];for(var _0x3dafc9=0x0;_0x3dafc9\x20\x20');}var _0x1d759b=path[_0x77d8('0x15')](config[_0x77d8('0x67')],_0x77d8('0x98'),process[_0x77d8('0x97')][0x2]);if(!fs['existsSync'](_0x1d759b)){throw new Error(_0x77d8('0x99'));}var _0x1c00b9={};try{_0x1c00b9=JSON['parse'](process[_0x77d8('0x97')][0x3]);if(!_0x1c00b9[_0x77d8('0x64')]){throw new Error(_0x77d8('0x9a'));}var _0xbc99a9=0x0;if(_0x1c00b9[_0x77d8('0x64')]['UserId']){_0xbc99a9=0x1;}if(!_0x1c00b9['ListId']){throw new Error(_0x77d8('0x9b'));}}catch(_0x519e3b){throw new Error(_0x77d8('0x9c'));}var _0x37f892=[];try{_0x37f892=_[_0x77d8('0x9d')](JSON[_0x77d8('0x70')](process[_0x77d8('0x97')][0x4]),'id');}catch(_0x3ae34d){logger['info'](_0x77d8('0x9e'));}main(_0x1d759b,_0x1c00b9,_0x37f892,_0xbc99a9);}validate();process['on']('SIGINT',handleStop);process['on'](_0x77d8('0x9f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 15a4cd4..e05268d 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x956c=['getDescriptions','toLowerCase','inbound','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','voice','push','variable','calleridnum','outbound','destcalleridnum'];(function(_0x9fd42f,_0x57080f){var _0x11f7b6=function(_0xaacd91){while(--_0xaacd91){_0x9fd42f['push'](_0x9fd42f['shift']());}};_0x11f7b6(++_0x57080f);}(_0x956c,0x17b));var _0xc956=function(_0x460da5,_0x4d8fae){_0x460da5=_0x460da5-0x0;var _0xc23582=_0x956c[_0x460da5];return _0xc23582;};'use strict';exports['getSubjects']=function(_0x3409e8,_0x2209eb){var _0x5b7449=[{'type':_0xc956('0x0'),'content':_0xc956('0x1'),'variableName':null}];switch(_0x3409e8['toLowerCase']()){case _0xc956('0x2'):switch(_0x2209eb['toLowerCase']()){case'inbound':_0x5b7449[_0xc956('0x3')]({'type':_0xc956('0x4'),'content':'','variableName':'queue'});_0x5b7449[_0xc956('0x3')]({'type':_0xc956('0x4'),'content':'','variableName':_0xc956('0x5')});break;case _0xc956('0x6'):_0x5b7449['push']({'type':_0xc956('0x0'),'content':'Outbound\x20Call','variableName':null});_0x5b7449[_0xc956('0x3')]({'type':_0xc956('0x4'),'content':'','variableName':_0xc956('0x7')});break;}}return _0x5b7449;};exports[_0xc956('0x8')]=function(_0x2bb77b,_0x271d6b){var _0x2cbf7e=[];switch(_0x2bb77b[_0xc956('0x9')]()){case _0xc956('0x2'):switch(_0x271d6b[_0xc956('0x9')]()){case _0xc956('0xa'):_0x2cbf7e=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xc956('0xb'),'keyType':_0xc956('0x4'),'variableName':_0xc956('0x5')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0xd'),'keyType':_0xc956('0x4'),'variableName':'calleridname'},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0xe'),'keyType':_0xc956('0x4'),'variableName':'destexten'},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0xf'),'keyType':_0xc956('0x4'),'variableName':_0xc956('0x10')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x11'),'keyType':_0xc956('0x4'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xc956('0x12'),'keyType':_0xc956('0x4'),'variableName':_0xc956('0x13')},{'type':_0xc956('0x0'),'content':_0xc956('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xc956('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xc956('0x4'),'variableName':_0xc956('0x15')},{'type':'keyValue','content':'','key':_0xc956('0x16'),'keyType':_0xc956('0x4'),'variableName':_0xc956('0x7')},{'type':_0xc956('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x17'),'keyType':_0xc956('0x4'),'variableName':'agentcalledAt'},{'type':_0xc956('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0xc956('0x18')},{'type':'keyValue','content':'','key':_0xc956('0x19'),'keyType':'variable','variableName':_0xc956('0x1a')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x1b'),'keyType':_0xc956('0x4'),'variableName':_0xc956('0x1c')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x1d'),'keyType':_0xc956('0x4'),'variableName':'talktime'}];break;case _0xc956('0x6'):_0x2cbf7e=[{'type':_0xc956('0x0'),'content':_0xc956('0x1e'),'variableName':null},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x1f'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x7')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x20'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x21')},{'type':'keyValue','content':'','key':_0xc956('0x11'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x22')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x12'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x23')},{'type':_0xc956('0x0'),'content':_0xc956('0x24')},{'type':_0xc956('0xc'),'content':'','key':_0xc956('0x25'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0xc956('0x26'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x27')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x28')},{'type':'keyValue','content':'','key':_0xc956('0x29'),'keyType':_0xc956('0x4'),'keyContent':'','variableName':_0xc956('0x2a')}];break;}}return _0x2cbf7e;}; \ No newline at end of file +var _0x62bf=['toLowerCase','voice','inbound','push','variable','queue','calleridnum','string','destcalleridnum','getDescriptions','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','outbound','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x62bf,0x139));var _0xf62b=function(_0x251043,_0x3768b0){_0x251043=_0x251043-0x0;var _0x3c2ede=_0x62bf[_0x251043];return _0x3c2ede;};'use strict';exports[_0xf62b('0x0')]=function(_0x21e65c,_0xb6db66){var _0x262296=[{'type':'string','content':_0xf62b('0x1'),'variableName':null}];switch(_0x21e65c[_0xf62b('0x2')]()){case _0xf62b('0x3'):switch(_0xb6db66['toLowerCase']()){case _0xf62b('0x4'):_0x262296[_0xf62b('0x5')]({'type':_0xf62b('0x6'),'content':'','variableName':_0xf62b('0x7')});_0x262296[_0xf62b('0x5')]({'type':_0xf62b('0x6'),'content':'','variableName':_0xf62b('0x8')});break;case'outbound':_0x262296['push']({'type':_0xf62b('0x9'),'content':'Outbound\x20Call','variableName':null});_0x262296[_0xf62b('0x5')]({'type':'variable','content':'','variableName':_0xf62b('0xa')});break;}}return _0x262296;};exports[_0xf62b('0xb')]=function(_0xa0ad8d,_0x3290c2){var _0x18ea98=[];switch(_0xa0ad8d['toLowerCase']()){case _0xf62b('0x3'):switch(_0x3290c2[_0xf62b('0x2')]()){case _0xf62b('0x4'):_0x18ea98=[{'type':_0xf62b('0x9'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf62b('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x8')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0xd'),'keyType':'variable','variableName':_0xf62b('0xe')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0xf'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x10')},{'type':_0xf62b('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':_0xf62b('0x7')},{'type':'keyValue','content':'','key':_0xf62b('0x11'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x12')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x13'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x14')},{'type':_0xf62b('0x9'),'content':_0xf62b('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf62b('0x16'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x17')},{'type':_0xf62b('0xc'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xf62b('0xa')},{'type':_0xf62b('0x9'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf62b('0x18'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x14')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x19'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x1a')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x1b'),'keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x1c')},{'type':_0xf62b('0xc'),'content':'','key':'Hold\x20Time','keyType':_0xf62b('0x6'),'variableName':_0xf62b('0x1d')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0xf62b('0x1e')}];break;case _0xf62b('0x1f'):_0x18ea98=[{'type':'string','content':_0xf62b('0x20'),'variableName':null},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x21'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0xa')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x22'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x23')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x11'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x12')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x13'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x24')},{'type':_0xf62b('0x9'),'content':_0xf62b('0x25')},{'type':_0xf62b('0xc'),'content':'','key':_0xf62b('0x26'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x27')},{'type':'keyValue','content':'','key':_0xf62b('0x28'),'keyType':'variable','keyContent':'','variableName':_0xf62b('0x29')},{'type':'keyValue','content':'','key':_0xf62b('0x2a'),'keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x2b')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xf62b('0x6'),'keyContent':'','variableName':_0xf62b('0x2c')}];break;}}return _0x18ea98;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index a97b5a8..f1963f5 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11b0=['closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','user','query','omit','html','phone','updateUser','lodash','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','parseAdvancedSearchFilter','parseQueryParameters','body','where','contact','default','fields','tags','checkAccountsRestrictions','search','ids','tag','countFilteredInteractions','count','length','having','order','forEach','contactName'];(function(_0x309a5e,_0x1ec246){var _0x1d21f1=function(_0x1d902d){while(--_0x1d902d){_0x309a5e['push'](_0x309a5e['shift']());}};_0x1d21f1(++_0x1ec246);}(_0x11b0,0xa0));var _0x011b=function(_0x345711,_0x1a7438){_0x345711=_0x345711-0x0;var _0x3a8554=_0x11b0[_0x345711];return _0x3a8554;};'use strict';var _=require(_0x011b('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0x011b('0x1')]=function(_0x10c97f,_0x1a734c,_0x57bc01,_0x3dc024,_0xbeec15){var _0x271136={'count':0x0,'rows':[]};var _0x241a5b=sqlUtils[_0x011b('0x2')](_0x10c97f,_0x57bc01,_0x1a734c);if(_0x241a5b){return Promise[_0x011b('0x3')](_0x271136);}var _0x5a3c20=sqlUtils[_0x011b('0x4')](_0x10c97f);var _0x27d712={};return Promise[_0x011b('0x3')]()[_0x011b('0x5')](function(){if(_0x1a734c['search']){return sqlUtils[_0x011b('0x6')](_0x1a734c['search'],_0xbeec15);}else{return sqlUtils[_0x011b('0x7')](_0x10c97f,_0x1a734c,_0xbeec15);}})[_0x011b('0x5')](function(_0x243d1e){_0x5a3c20['where'](_0x243d1e[_0x011b('0x8')]);_0x5a3c20[_0x011b('0x9')](_0x243d1e[_0x011b('0xa')]);_0x5a3c20[_0x011b('0x9')](_0x243d1e[_0x011b('0xb')]);_0x5a3c20[_0x011b('0x9')](_0x243d1e[_0x011b('0xc')]);_0x5a3c20[_0x011b('0x9')](_0x243d1e['filter']);_0x5a3c20[_0x011b('0x9')](_0x243d1e['user']);_0x5a3c20['having'](_0x243d1e['read']);_0x27d712=_0x243d1e[_0x011b('0xd')];return sqlUtils[_0x011b('0xe')](_0x10c97f,_0x57bc01,_0x1a734c);})[_0x011b('0x5')](function(_0x3c34c4){_0x5a3c20[_0x011b('0x9')](_0x3c34c4);_0x5a3c20['group']('i.id');var _0x3c3277=_0x1a734c[_0x011b('0xf')]?_0x27d712[_0x011b('0x10')]:_0x1a734c[_0x011b('0x11')];return sqlUtils[_0x011b('0x12')](_0x5a3c20,_0x3c3277);})[_0x011b('0x5')](function(_0x1af931){_0x271136[_0x011b('0x13')]=_0x1af931[_0x011b('0x14')];if(_0x271136['count']===0x0){return[];}_0x5a3c20[_0x011b('0x15')](_0x27d712['clause']);if(_0x3dc024['order']){_0x3dc024[_0x011b('0x16')][_0x011b('0x17')](function(_0x57836a){var _0x28af42=_0x57836a[0x0]===_0x011b('0x18')?_0x57836a[0x0]:'i.'+_0x57836a[0x0];_0x5a3c20['order'](_0x28af42,_0x57836a[0x1]==='DESC'?![]:!![]);if(_0x57836a[0x0]===_0x011b('0x19')){var _0x466340=sqlUtils[_0x011b('0x1a')](_0x10c97f,_0x1a734c);_0x5a3c20['order'](_0x466340,_0x57836a[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x011b('0x1b')](_0x10c97f,_0x5a3c20,_0x1a734c,_0x3dc024);})[_0x011b('0x5')](function(_0x4816b6){_0x271136[_0x011b('0x1c')]=_0x4816b6;return _0x271136;})[_0x011b('0x1d')](function(_0x21e85f){throw _0x21e85f;});};exports[_0x011b('0x1e')]=function(_0x59769a,_0x31e58d){return function(_0x53fa73,_0x576f75,_0x4fdf1f){var _0x2af442=_0x53fa73[_0x011b('0x1f')];var _0x426e2f={};var _0x4c5ac8=_0x53fa73[_0x011b('0x20')];if(_0x426e2f){_0x426e2f=_['clone'](_0x53fa73['body']);_0x426e2f=_[_0x011b('0x21')](_0x426e2f,[_0x011b('0x8'),_0x011b('0x22'),_0x011b('0x23'),'fax','mobile']);}utils[_0x011b('0x24')](_0x2af442,_0x426e2f,_0x4c5ac8,_0x59769a,_0x31e58d);_0x4fdf1f(null);};}; \ No newline at end of file +var _0x5523=['catch','tracked','query','clone','body','fax','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','then','where','contact','default','fields','filter','user','read','ids','count','length','having','order','forEach','contactName','DESC','getClosedOrderClause','getFilteredInteractions','rows'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x5523,0x139));var _0x3552=function(_0x4a6f45,_0x5a43b3){_0x4a6f45=_0x4a6f45-0x0;var _0x9b83d6=_0x5523[_0x4a6f45];return _0x9b83d6;};'use strict';var _=require(_0x3552('0x0'));var sqlUtils=require(_0x3552('0x1'));var utils=require(_0x3552('0x2'));exports[_0x3552('0x3')]=function(_0x3ca501,_0xc35833,_0x3125c0,_0x3c57c1,_0x204567){var _0x38d07f={'count':0x0,'rows':[]};var _0x1ee971=sqlUtils[_0x3552('0x4')](_0x3ca501,_0x3125c0,_0xc35833);if(_0x1ee971){return Promise[_0x3552('0x5')](_0x38d07f);}var _0x44bf29=sqlUtils[_0x3552('0x6')](_0x3ca501);var _0x56aa54={};return Promise['resolve']()['then'](function(){if(_0xc35833['search']){return sqlUtils['parseAdvancedSearchFilter'](_0xc35833[_0x3552('0x7')],_0x204567);}else{return sqlUtils['parseQueryParameters'](_0x3ca501,_0xc35833,_0x204567);}})[_0x3552('0x8')](function(_0x5c062c){_0x44bf29[_0x3552('0x9')](_0x5c062c['body']);_0x44bf29[_0x3552('0x9')](_0x5c062c[_0x3552('0xa')]);_0x44bf29[_0x3552('0x9')](_0x5c062c[_0x3552('0xb')]);_0x44bf29[_0x3552('0x9')](_0x5c062c[_0x3552('0xc')]);_0x44bf29[_0x3552('0x9')](_0x5c062c[_0x3552('0xd')]);_0x44bf29[_0x3552('0x9')](_0x5c062c[_0x3552('0xe')]);_0x44bf29['having'](_0x5c062c[_0x3552('0xf')]);_0x56aa54=_0x5c062c['tags'];return sqlUtils['checkAccountsRestrictions'](_0x3ca501,_0x3125c0,_0xc35833);})[_0x3552('0x8')](function(_0x95c05b){_0x44bf29[_0x3552('0x9')](_0x95c05b);_0x44bf29['group']('i.id');var _0x9115eb=_0xc35833[_0x3552('0x7')]?_0x56aa54[_0x3552('0x10')]:_0xc35833['tag'];return sqlUtils['countFilteredInteractions'](_0x44bf29,_0x9115eb);})['then'](function(_0x831f70){_0x38d07f[_0x3552('0x11')]=_0x831f70[_0x3552('0x12')];if(_0x38d07f['count']===0x0){return[];}_0x44bf29[_0x3552('0x13')](_0x56aa54['clause']);if(_0x3c57c1[_0x3552('0x14')]){_0x3c57c1[_0x3552('0x14')][_0x3552('0x15')](function(_0x5686ce){var _0x10a21c=_0x5686ce[0x0]===_0x3552('0x16')?_0x5686ce[0x0]:'i.'+_0x5686ce[0x0];_0x44bf29[_0x3552('0x14')](_0x10a21c,_0x5686ce[0x1]===_0x3552('0x17')?![]:!![]);if(_0x5686ce[0x0]==='closed'){var _0x453b64=sqlUtils[_0x3552('0x18')](_0x3ca501,_0xc35833);_0x44bf29[_0x3552('0x14')](_0x453b64,_0x5686ce[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x3552('0x19')](_0x3ca501,_0x44bf29,_0xc35833,_0x3c57c1);})[_0x3552('0x8')](function(_0x105ce3){_0x38d07f[_0x3552('0x1a')]=_0x105ce3;return _0x38d07f;})[_0x3552('0x1b')](function(_0xe7e80d){throw _0xe7e80d;});};exports[_0x3552('0x1c')]=function(_0x4b08ce,_0x2f38d8){return function(_0x2f54a3,_0x4068ef,_0x1d3bab){var _0x4a3c64=_0x2f54a3[_0x3552('0xe')];var _0x540cd1={};var _0x4a850a=_0x2f54a3[_0x3552('0x1d')];if(_0x540cd1){_0x540cd1=_[_0x3552('0x1e')](_0x2f54a3[_0x3552('0x1f')]);_0x540cd1=_['omit'](_0x540cd1,[_0x3552('0x1f'),'html','phone',_0x3552('0x20'),'mobile']);}utils[_0x3552('0x21')](_0x4a3c64,_0x540cd1,_0x4a850a,_0x4b08ce,_0x2f38d8);_0x1d3bab(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 3a496e7..d5eb650 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc03c=['fax','i.fax\x20LIKE\x20?','openchannel','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)','parseSearch','sqlOperator','conditions','find','buildExpression','type','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','map','tags','clause','ids','User','user','UserId','body','plainBody','keys','some','compact','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','capitalize','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','closed','i.substatus','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.thirdDisposition','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','contactName','c.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/qs','./update-interaction','./utils','../../mysqldb','role','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','getInteractionsTables','getAccountFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xc03c,0x1c4));var _0xcc03=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xc03c[_0x119280];return _0x481797;};'use strict';var _=require('lodash');var squel=require(_0xcc03('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xcc03('0x1'));var updateInteraction=require(_0xcc03('0x2'))['updateInteraction'];var utils=require(_0xcc03('0x3'));var db=require(_0xcc03('0x4'))['db'];function skipInteractionsQuery(_0x8dc381,_0x80f20,_0x4e6cbf){var _0x550773=![];var _0x19ea42=utils['getAccountFK'](_0x8dc381);if(_0x80f20[_0xcc03('0x5')]===_0xcc03('0x6')&&!_0x4e6cbf['search']&&!_0x4e6cbf[_0x19ea42]){_0x550773=!![];}return _0x550773;}function getTagsQuery(){return squel[_0xcc03('0x7')]()[_0xcc03('0x8')]('id')[_0xcc03('0x8')](_0xcc03('0x9'))[_0xcc03('0x8')](_0xcc03('0xa'))['from'](_0xcc03('0xb'));}function getUsersQuery(_0x4617d6,_0x11bcb3){var _0x4d8035=utils[_0xcc03('0xc')](_0x4617d6);var _0x5b0f60=_0xcc03('0xd')+_0x4617d6+_0xcc03('0xe');var _0x52d2f3=squel[_0xcc03('0x7')]()[_0xcc03('0x8')](_0xcc03('0xf'))[_0xcc03('0x8')](_0xcc03('0x10'))[_0xcc03('0x8')]('ui.'+_0x4d8035)[_0xcc03('0x11')](_0x5b0f60,'ui')[_0xcc03('0x12')](_0xcc03('0x13'),'u',_0xcc03('0x14'));if(_0x11bcb3[_0xcc03('0x15')]>0x0){_0x52d2f3[_0xcc03('0x16')](_0xcc03('0x17')+_0x4d8035+_0xcc03('0x18'),_['map'](_0x11bcb3,'id'));}return _0x52d2f3;}function getInteractionsQuery(_0x11862e){var _0x163d4c=utils[_0xcc03('0x19')](_0x11862e);var _0x3fe066=utils[_0xcc03('0x1a')](_0x11862e);var _0x11b8bd=utils['getInteractionFK'](_0x11862e);return squel[_0xcc03('0x7')]()[_0xcc03('0x11')](_0x163d4c[_0xcc03('0x1b')],'i')[_0xcc03('0x12')](_0xcc03('0x1c'),'c',_0xcc03('0x1d'))['left_join']('users','o',_0xcc03('0x1e'))[_0xcc03('0x12')](_0x163d4c[_0xcc03('0x1f')],'a',_0xcc03('0x20')+_0x3fe066)[_0xcc03('0x12')](_0x163d4c['messages'],'me',_0xcc03('0x21')+_0x11b8bd+_0xcc03('0x22'))[_0xcc03('0x12')](_0x163d4c['interactionsTags'],'it',_0xcc03('0x23')+_0x11b8bd+'\x20=\x20i.id')[_0xcc03('0x12')](_0xcc03('0xb'),'t',_0xcc03('0x24'));}function getSqlClauses(){var _0x26a926={'body':squel[_0xcc03('0x25')](),'contact':squel[_0xcc03('0x25')](),'default':squel[_0xcc03('0x25')](),'fields':squel[_0xcc03('0x25')](),'filter':squel[_0xcc03('0x25')](),'read':squel[_0xcc03('0x25')](),'tags':{'clause':squel[_0xcc03('0x25')](),'ids':null},'user':squel['expr']()};return _0x26a926;}function parseTagParameter(_0x2e4991){var _0x25cd7b=squel[_0xcc03('0x25')]();if(_0x2e4991){var _0x5ba8b1=utils['getSelectedTags'](_0x2e4991);_0x5ba8b1[_0xcc03('0x26')](function(_0x3b39aa){_0x25cd7b['or'](_0xcc03('0x27'),'%,'+_0x3b39aa+',%');});}return _0x25cd7b;}function parseReadParameter(_0x555b11){var _0x5c85ab='';if(_0x555b11){_0x5c85ab=_0xcc03('0x28');if(_0x555b11==='1'){_0x5c85ab=_0x5c85ab[_0xcc03('0x29')]('{OPERATOR}','=');}else{_0x5c85ab=_0x5c85ab['replace'](_0xcc03('0x2a'),'>');}}return _0x5c85ab;}function parseSearchFilter(_0x3b1094,_0x4b47c9){var _0x3712c8=squel[_0xcc03('0x25')]();if(_0x4b47c9){var _0x374178=_0x4b47c9['replace']('\x5c','\x5c\x5c')[_0xcc03('0x29')](/'/g,'\x27\x27');if(qs[_0xcc03('0x2b')](_0x374178)){_0x3712c8['or'](_0xcc03('0x2c'),_0x374178+'%');if([_0xcc03('0x2d'),_0xcc03('0x2e')][_0xcc03('0x2f')](_0x3b1094)){_0x3712c8['or'](_0xcc03('0x30'),_0x374178+'%');}else if(_0x3b1094===_0xcc03('0x31')){_0x3712c8['or'](_0xcc03('0x32'),_0x374178+'%');}else if(_0x3b1094===_0xcc03('0x33')){_0x3712c8['or']('i.from\x20LIKE\x20?',_0x374178+'%');}}else if(_0x3b1094===_0xcc03('0x34')&&qs[_0xcc03('0x35')](_0x374178)){_0x3712c8['or'](_0xcc03('0x36'),_0x374178+'%');}else{if(_0x3b1094==='mail'){_0x3712c8['or'](_0xcc03('0x37'),qs[_0xcc03('0x38')](_0x374178,!![]))['or'](_0xcc03('0x39'),qs[_0xcc03('0x38')](_0x374178));}else if(_0x3b1094!=='fax'){_0x3712c8['or'](_0xcc03('0x3a'),qs[_0xcc03('0x38')](_0x374178));}_0x3712c8['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc03('0x38')](_0x374178,!![]),null);}}return _0x3712c8;}function parseAdvancedSearchFilter(_0x1301ad,_0x1f7791){var _0x443796=getSqlClauses();var _0x76b90=as[_0xcc03('0x3b')](_0x1301ad);var _0x617793=_0x76b90[_0xcc03('0x3c')];for(var _0x4237c4=0x0;_0x4237c4<_0x76b90[_0xcc03('0x3d')][_0xcc03('0x15')];_0x4237c4++){var _0x39ada7=_0x76b90['conditions'][_0x4237c4];var _0x5e8c29='i';var _0xf65869=_[_0xcc03('0x3e')](_0x1f7791,[_0xcc03('0x9'),_0x39ada7[_0xcc03('0x8')]]);if(_0xf65869){var _0x3e7a83=as[_0xcc03('0x3f')](_0x5e8c29,_0xf65869[_0xcc03('0x40')],_0x39ada7);_0x443796['default'][_0x617793](_0x3e7a83['text'],_0x3e7a83['value']['start'],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x42')]);}else{switch(_0x39ada7[_0xcc03('0x8')]){case _0xcc03('0x43'):var _0x4f078a=parseReadParameter(_0x39ada7['value']);_0x443796[_0xcc03('0x44')][_0xcc03('0x45')](_0x4f078a);break;case _0xcc03('0x46'):if(_0x39ada7[_0xcc03('0x47')]===_0xcc03('0x48')){if(_0x39ada7[_0xcc03('0x41')][_0xcc03('0x49')]('\x20')[_0xcc03('0x15')]>0x1){_0x443796[_0xcc03('0x4a')][_0x617793](_0xcc03('0x4b'),qs[_0xcc03('0x38')](_0x39ada7[_0xcc03('0x41')],!![]),null);}else{var _0x2f7b5c='%'+_0x39ada7[_0xcc03('0x41')]+'%';_0x443796[_0xcc03('0x4a')][_0x617793](_0xcc03('0x4c'),_0x2f7b5c,_0x2f7b5c,_0x2f7b5c);}}else{_0xf65869=_[_0xcc03('0x3e')](_0x1f7791,[_0xcc03('0x9'),_0xcc03('0x4d')]);_0x39ada7['field']='ContactId';_0x3e7a83=as[_0xcc03('0x3f')](_0x5e8c29,_0xf65869[_0xcc03('0x40')],_0x39ada7);_0x443796['contact'][_0x617793](_0x3e7a83[_0xcc03('0x4e')],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x4f')],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x42')]);}break;case'Tag':var _0x41774a=_0x39ada7['value'][_0xcc03('0x49')](',')[_0xcc03('0x50')](function(_0x18a6e1){return Number(_0x18a6e1);});var _0x91a36a=parseTagParameter(_0x41774a);_0x443796[_0xcc03('0x51')][_0xcc03('0x52')][_0xcc03('0x45')](_0x91a36a);_0x443796[_0xcc03('0x51')][_0xcc03('0x53')]=_0x41774a;break;case _0xcc03('0x54'):if(_0x39ada7[_0xcc03('0x47')]===_0xcc03('0x48')){_0x443796[_0xcc03('0x55')][_0x617793]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x39ada7['value']+'%',null);}else{_0xf65869=_[_0xcc03('0x3e')](_0x1f7791,[_0xcc03('0x9'),_0xcc03('0x56')]);_0x39ada7[_0xcc03('0x8')]=_0xcc03('0x56');_0x3e7a83=as[_0xcc03('0x3f')](_0x5e8c29,_0xf65869[_0xcc03('0x40')],_0x39ada7);_0x443796[_0xcc03('0x55')][_0x617793](_0x3e7a83[_0xcc03('0x4e')],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x4f')],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x42')]);}break;case _0xcc03('0x57'):case _0xcc03('0x58'):_0x3e7a83=as['buildExpression']('me',null,_0x39ada7);_0x443796[_0xcc03('0x57')][_0x617793](_0x3e7a83[_0xcc03('0x4e')],_0x3e7a83[_0xcc03('0x41')][_0xcc03('0x4f')],_0x3e7a83[_0xcc03('0x41')]['end']);break;}}}return _0x443796;}function parseModelFields(_0x4483d8,_0x2f3443,_0x547f5b){var _0x3f1707=utils['getAccountFK'](_0x4483d8);var _0xbbd357=squel[_0xcc03('0x25')]();var _0x1e60be=_(_0x2f3443)[_0xcc03('0x59')]()[_0xcc03('0x50')](function(_0x2e736f){return _[_0xcc03('0x5a')](_0x547f5b,[_0xcc03('0x9'),_0x2e736f])?_0x2e736f:undefined;})[_0xcc03('0x5b')]()[_0xcc03('0x41')]();if(_0x1e60be[_0xcc03('0x15')]>0x0){_0x1e60be[_0xcc03('0x26')](function(_0x35c041){if(_0x35c041===_0x3f1707){_0xbbd357['and']('i.'+_0x3f1707+_0xcc03('0x18'),[]['concat'](_0x2f3443[_0x35c041]));}else if(_0x35c041==='createdAt'){var _0x3b264b=JSON['parse'](_0x2f3443[_0x35c041])['$gte'];var _0x2fb87b=JSON[_0xcc03('0x5c')](_0x2f3443[_0x35c041])['$lte'];_0xbbd357['and'](_0xcc03('0x5d'),_0x3b264b,_0x2fb87b);}else{if(_0x2f3443[_0x35c041]===_0xcc03('0x5e')){_0xbbd357[_0xcc03('0x45')]('i.'+_0x35c041+_0xcc03('0x5f'));}else{_0xbbd357[_0xcc03('0x45')]('i.'+_0x35c041+_0xcc03('0x60'),_0x2f3443[_0x35c041]);}}});}return _0xbbd357;}function parseQueryParameters(_0x261b72,_0x2aa59c,_0x1dcd50){var _0x3c0439=getSqlClauses();return Promise['resolve']()[_0xcc03('0x61')](function(){return parseModelFields(_0x261b72,_0x2aa59c,_0x1dcd50);})[_0xcc03('0x61')](function(_0x39b5f6){_0x3c0439[_0xcc03('0x62')]['and'](_0x39b5f6);return parseReadParameter(_0x2aa59c[_0xcc03('0x44')]);})[_0xcc03('0x61')](function(_0x2bac39){_0x3c0439['read'][_0xcc03('0x45')](_0x2bac39);return parseTagParameter(_0x2aa59c[_0xcc03('0x63')]);})['then'](function(_0x304dd8){_0x3c0439[_0xcc03('0x51')]['clause'][_0xcc03('0x45')](_0x304dd8);return parseSearchFilter(_0x261b72,_0x2aa59c[_0xcc03('0x64')]);})[_0xcc03('0x61')](function(_0x2c3577){_0x3c0439[_0xcc03('0x64')]=_0x2c3577;return _0x3c0439;});}function checkAccountsRestrictions(_0x1db611,_0x5c5bff,_0x598784){var _0x5afde3=utils[_0xcc03('0x1a')](_0x1db611);var _0x32707a='get'+_[_0xcc03('0x65')](_0x1db611)+(_0x1db611==='chat'?_0xcc03('0x66'):_0xcc03('0x67'));var _0x1355fc=squel[_0xcc03('0x25')]();return Promise[_0xcc03('0x68')]()[_0xcc03('0x61')](function(){if(_0x598784['search']&&_0x5c5bff[_0xcc03('0x5')]==='agent'){return _0x5c5bff[_0x32707a]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x318b17){if(_0x318b17){if(_0x318b17['length']===0x0){_0x1355fc[_0xcc03('0x45')]('i.'+_0x5afde3+_0xcc03('0x5f'));}else{_0x1355fc[_0xcc03('0x45')]('i.'+_0x5afde3+_0xcc03('0x18'),_[_0xcc03('0x50')](_0x318b17,'id'));}}else if(!_0x598784[_0x5afde3]){_0x1355fc['and']('i.'+_0x5afde3+_0xcc03('0x69'));}})[_0xcc03('0x61')](function(){return _0x1355fc;});}function getClosedOrderClause(_0x1ce06e,_0x1164a1){var _0x256673='';var _0x444e9d=['i.thirdDisposition',_0xcc03('0x6a'),_0xcc03('0x6b')];if(_0x1ce06e===_0xcc03('0x34')){_0x444e9d['unshift']('i.substatus');}if(_0x1164a1[_0xcc03('0x6c')]==='0'&&_0x1ce06e===_0xcc03('0x34')){_0x256673=_0xcc03('0x6d');}else{if(_0x1164a1['closed']==='1'){_0x444e9d['shift']();}_0x256673=_0xcc03('0x6e')+_0x444e9d[_0xcc03('0x6f')](',\x20')+')';}return _0x256673;}function getFilteredInteractions(_0x30d4de,_0x10e2da,_0x346d59,_0x3e5732){var _0x56e98b=utils[_0xcc03('0xc')](_0x30d4de);var _0x2596ed=_[_0xcc03('0x65')](_0x30d4de)+_0xcc03('0x70');var _0x55b4b5=[];var _0x3d5c50=getTagsQuery();var _0x8bdeb3={'type':db[_0xcc03('0x71')][_0xcc03('0x72')][_0xcc03('0x73')],'raw':!![]};var _0x4c6018=[];var _0x455e60=[];return db[_0xcc03('0x74')][_0xcc03('0x75')](_0x3d5c50[_0xcc03('0x76')](),_0x8bdeb3)[_0xcc03('0x61')](function(_0x5e44b1){_0x55b4b5=_[_0xcc03('0x77')](_0x5e44b1,'id');_0x8bdeb3=_[_0xcc03('0x78')](_0x8bdeb3,{'model':db[_0x2596ed],'mapToModel':!![],'nest':!![]});if(_0x346d59['fields']){_0x3e5732['attributes'][_0xcc03('0x26')](function(_0x3527b1){_0x10e2da['field']('i.'+_0x3527b1);});}else{_0x10e2da[_0xcc03('0x8')](_0xcc03('0x79'),_0xcc03('0x43'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x7a'),_0xcc03('0x7b'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x7c'),_0xcc03('0x7d'));if(_0x30d4de==='mail'){_0x10e2da[_0xcc03('0x8')](_0xcc03('0x7e'),_0xcc03('0x7f'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x80'),'contactName');_0x10e2da[_0xcc03('0x8')]('i.id');_0x10e2da['field'](_0xcc03('0x81'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x82'));_0x10e2da['field'](_0xcc03('0x83'));_0x10e2da['field'](_0xcc03('0x84'));_0x10e2da['field'](_0xcc03('0x85'));_0x10e2da['field']('i.lastMsgAt');_0x10e2da[_0xcc03('0x8')](_0xcc03('0x86'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x87'));_0x10e2da[_0xcc03('0x8')]('i.disposition');_0x10e2da[_0xcc03('0x8')](_0xcc03('0x6a'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x88'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x6d'));_0x10e2da['field']('i.to');_0x10e2da[_0xcc03('0x8')](_0xcc03('0x89'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x8a'));_0x10e2da['field'](_0xcc03('0x8b'));}else if(_0x30d4de==='openchannel'){_0x10e2da[_0xcc03('0x8')](_0xcc03('0x8c'),_0xcc03('0x8d'));}else{_0x10e2da[_0xcc03('0x8')]('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',_0xcc03('0x8d'));}if(_0x30d4de!==_0xcc03('0x34')){_0x10e2da[_0xcc03('0x8')]('i.*');}_0x10e2da['field'](_0xcc03('0x8e'),'Contact.firstName');_0x10e2da[_0xcc03('0x8')]('c.lastName',_0xcc03('0x8f'));_0x10e2da[_0xcc03('0x8')]('c.email',_0xcc03('0x90'));_0x10e2da[_0xcc03('0x8')]('c.phone',_0xcc03('0x91'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x92'),_0xcc03('0x93'));_0x10e2da[_0xcc03('0x8')]('c.fax','Contact.fax');_0x10e2da[_0xcc03('0x8')](_0xcc03('0x94'),_0xcc03('0x95'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x96'),_0xcc03('0x97'));_0x10e2da[_0xcc03('0x8')](_0xcc03('0x98'),_0xcc03('0x99'));}if(_0x3e5732[_0xcc03('0x9a')]){_0x10e2da[_0xcc03('0x9a')](_0x3e5732[_0xcc03('0x9a')]);}if(_0x3e5732[_0xcc03('0x9b')]){_0x10e2da[_0xcc03('0x9b')](_0x3e5732[_0xcc03('0x9b')]);}return db[_0xcc03('0x74')][_0xcc03('0x75')](_0x10e2da['toString'](),_0x8bdeb3);})[_0xcc03('0x61')](function(_0x502a1f){_0x4c6018=_0x502a1f;var _0x556302=getUsersQuery(_0x30d4de,_0x4c6018);return db[_0xcc03('0x74')][_0xcc03('0x75')](_0x556302[_0xcc03('0x76')](),_0x8bdeb3);})[_0xcc03('0x61')](function(_0x3c408a){_0x455e60=_[_0xcc03('0x9c')](_0x3c408a,_0x56e98b);if(_0x30d4de===_0xcc03('0x34')){return db[_0xcc03('0x9d')][_0xcc03('0x9e')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xcc03('0x61')](function(_0x493771){var _0x1ef045=_0x493771?_0x493771[_0xcc03('0x9f')]:undefined;var _0x16287a=_0x4c6018[_0xcc03('0x50')](function(_0x49ed7b){return updateInteraction(_0x49ed7b,_0x55b4b5,_0x455e60,_0x1ef045);});return Promise[_0xcc03('0xa0')](_0x16287a);});}function countFilteredInteractions(_0x26e5c6,_0x301012){var _0x327275=_0x26e5c6[_0xcc03('0xa1')]();_0x327275[_0xcc03('0x8')](_0xcc03('0xa2'));_0x327275[_0xcc03('0x8')](_0xcc03('0x79'),_0xcc03('0x43'));var _0x14da61=utils[_0xcc03('0xa3')](_0x301012);if(!_[_0xcc03('0xa4')](_0x14da61)){_0x327275[_0xcc03('0x16')](_0xcc03('0xa5'),_0x14da61);}var _0x581d58={'type':db[_0xcc03('0x71')][_0xcc03('0x72')][_0xcc03('0x73')],'raw':!![]};return db['sequelize']['query'](_0x327275[_0xcc03('0x76')](),_0x581d58);}module[_0xcc03('0xa6')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf81f=['buildExpression','type','default','value','start','unreadMessages','read','and','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','contact','text','end','Tag','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','getAccountFK','keys','compact','\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.substatus','closed','shift','join','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.disposition','i.to','i.ContactId','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','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','findOne','enableEmailPreview','clone','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','role','agent','search','select','field','name','color','tools_tags','user_has_','_interactions','u.id','u.fullname','from','users','u.id\x20=\x20ui.UserId','where','ui.','map','getInteractionFK','interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','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','sqlOperator','conditions','length','find'];(function(_0x4c7d82,_0x4a0fcf){var _0x3913c=function(_0x46f5aa){while(--_0x46f5aa){_0x4c7d82['push'](_0x4c7d82['shift']());}};_0x3913c(++_0x4a0fcf);}(_0xf81f,0x1b6));var _0xff81=function(_0x5eaf87,_0x296ba0){_0x5eaf87=_0x5eaf87-0x0;var _0x4f4a7f=_0xf81f[_0x5eaf87];return _0x4f4a7f;};'use strict';var _=require(_0xff81('0x0'));var squel=require(_0xff81('0x1'));var as=require(_0xff81('0x2'));var qs=require(_0xff81('0x3'));var updateInteraction=require('./update-interaction')[_0xff81('0x4')];var utils=require(_0xff81('0x5'));var db=require(_0xff81('0x6'))['db'];function skipInteractionsQuery(_0x19b632,_0x75ad17,_0x1f45c6){var _0xb358a2=![];var _0xcc0458=utils['getAccountFK'](_0x19b632);if(_0x75ad17[_0xff81('0x7')]===_0xff81('0x8')&&!_0x1f45c6[_0xff81('0x9')]&&!_0x1f45c6[_0xcc0458]){_0xb358a2=!![];}return _0xb358a2;}function getTagsQuery(){return squel[_0xff81('0xa')]()[_0xff81('0xb')]('id')[_0xff81('0xb')](_0xff81('0xc'))['field'](_0xff81('0xd'))['from'](_0xff81('0xe'));}function getUsersQuery(_0x1096b4,_0xb7079d){var _0x17e561=utils['getInteractionFK'](_0x1096b4);var _0x3aa719=_0xff81('0xf')+_0x1096b4+_0xff81('0x10');var _0x26c21a=squel[_0xff81('0xa')]()[_0xff81('0xb')](_0xff81('0x11'))[_0xff81('0xb')](_0xff81('0x12'))[_0xff81('0xb')]('ui.'+_0x17e561)[_0xff81('0x13')](_0x3aa719,'ui')['left_join'](_0xff81('0x14'),'u',_0xff81('0x15'));if(_0xb7079d['length']>0x0){_0x26c21a[_0xff81('0x16')](_0xff81('0x17')+_0x17e561+'\x20IN\x20?',_[_0xff81('0x18')](_0xb7079d,'id'));}return _0x26c21a;}function getInteractionsQuery(_0x5732b0){var _0x3b41a3=utils['getInteractionsTables'](_0x5732b0);var _0x5abe55=utils['getAccountFK'](_0x5732b0);var _0x43a804=utils[_0xff81('0x19')](_0x5732b0);return squel[_0xff81('0xa')]()['from'](_0x3b41a3[_0xff81('0x1a')],'i')[_0xff81('0x1b')]('cm_contacts','c',_0xff81('0x1c'))[_0xff81('0x1b')](_0xff81('0x14'),'o','o.id\x20=\x20i.UserId')[_0xff81('0x1b')](_0x3b41a3[_0xff81('0x1d')],'a',_0xff81('0x1e')+_0x5abe55)[_0xff81('0x1b')](_0x3b41a3[_0xff81('0x1f')],'me',_0xff81('0x20')+_0x43a804+'\x20=\x20i.id')[_0xff81('0x1b')](_0x3b41a3[_0xff81('0x21')],'it','it.'+_0x43a804+'\x20=\x20i.id')[_0xff81('0x1b')](_0xff81('0xe'),'t',_0xff81('0x22'));}function getSqlClauses(){var _0x420945={'body':squel[_0xff81('0x23')](),'contact':squel['expr'](),'default':squel[_0xff81('0x23')](),'fields':squel[_0xff81('0x23')](),'filter':squel[_0xff81('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0xff81('0x23')](),'ids':null},'user':squel['expr']()};return _0x420945;}function parseTagParameter(_0x158c9c){var _0x34627d=squel[_0xff81('0x23')]();if(_0x158c9c){var _0x2be3cc=utils[_0xff81('0x24')](_0x158c9c);_0x2be3cc['forEach'](function(_0x316c09){_0x34627d['or'](_0xff81('0x25'),'%,'+_0x316c09+',%');});}return _0x34627d;}function parseReadParameter(_0x476ca8){var _0x16fcdb='';if(_0x476ca8){_0x16fcdb=_0xff81('0x26');if(_0x476ca8==='1'){_0x16fcdb=_0x16fcdb['replace'](_0xff81('0x27'),'=');}else{_0x16fcdb=_0x16fcdb[_0xff81('0x28')]('{OPERATOR}','>');}}return _0x16fcdb;}function parseSearchFilter(_0x342915,_0x186e86){var _0x4bdc1f=squel['expr']();if(_0x186e86){var _0x31e0c2=_0x186e86['replace']('\x5c','\x5c\x5c')[_0xff81('0x28')](/'/g,'\x27\x27');if(qs[_0xff81('0x29')](_0x31e0c2)){_0x4bdc1f['or'](_0xff81('0x2a'),_0x31e0c2+'%');if([_0xff81('0x2b'),_0xff81('0x2c')][_0xff81('0x2d')](_0x342915)){_0x4bdc1f['or']('i.phone\x20LIKE\x20?',_0x31e0c2+'%');}else if(_0x342915===_0xff81('0x2e')){_0x4bdc1f['or'](_0xff81('0x2f'),_0x31e0c2+'%');}else if(_0x342915===_0xff81('0x30')){_0x4bdc1f['or'](_0xff81('0x31'),_0x31e0c2+'%');}}else if(_0x342915===_0xff81('0x32')&&qs[_0xff81('0x33')](_0x31e0c2)){_0x4bdc1f['or'](_0xff81('0x34'),_0x31e0c2+'%');}else{if(_0x342915===_0xff81('0x32')){_0x4bdc1f['or'](_0xff81('0x35'),qs[_0xff81('0x36')](_0x31e0c2,!![]))['or'](_0xff81('0x37'),qs['getFullTextValue'](_0x31e0c2));}else if(_0x342915!=='fax'){_0x4bdc1f['or'](_0xff81('0x38'),qs[_0xff81('0x36')](_0x31e0c2));}_0x4bdc1f['or'](_0xff81('0x39'),qs[_0xff81('0x36')](_0x31e0c2,!![]),null);}}return _0x4bdc1f;}function parseAdvancedSearchFilter(_0x5958e9,_0xa0c7eb){var _0x14c3ea=getSqlClauses();var _0xdcc841=as[_0xff81('0x3a')](_0x5958e9);var _0xe7ac54=_0xdcc841[_0xff81('0x3b')];for(var _0x5725da=0x0;_0x5725da<_0xdcc841[_0xff81('0x3c')][_0xff81('0x3d')];_0x5725da++){var _0x250fe9=_0xdcc841[_0xff81('0x3c')][_0x5725da];var _0x2d7953='i';var _0x57970e=_[_0xff81('0x3e')](_0xa0c7eb,['name',_0x250fe9[_0xff81('0xb')]]);if(_0x57970e){var _0x1284a6=as[_0xff81('0x3f')](_0x2d7953,_0x57970e[_0xff81('0x40')],_0x250fe9);_0x14c3ea[_0xff81('0x41')][_0xe7ac54](_0x1284a6['text'],_0x1284a6[_0xff81('0x42')][_0xff81('0x43')],_0x1284a6[_0xff81('0x42')]['end']);}else{switch(_0x250fe9[_0xff81('0xb')]){case _0xff81('0x44'):var _0x21bd04=parseReadParameter(_0x250fe9['value']);_0x14c3ea[_0xff81('0x45')][_0xff81('0x46')](_0x21bd04);break;case'Contact':if(_0x250fe9[_0xff81('0x47')]===_0xff81('0x48')){if(_0x250fe9[_0xff81('0x42')][_0xff81('0x49')]('\x20')['length']>0x1){_0x14c3ea['contact'][_0xe7ac54]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xff81('0x36')](_0x250fe9[_0xff81('0x42')],!![]),null);}else{var _0x930f4='%'+_0x250fe9[_0xff81('0x42')]+'%';_0x14c3ea['contact'][_0xe7ac54](_0xff81('0x4a'),_0x930f4,_0x930f4,_0x930f4);}}else{_0x57970e=_['find'](_0xa0c7eb,[_0xff81('0xc'),_0xff81('0x4b')]);_0x250fe9['field']=_0xff81('0x4b');_0x1284a6=as[_0xff81('0x3f')](_0x2d7953,_0x57970e[_0xff81('0x40')],_0x250fe9);_0x14c3ea[_0xff81('0x4c')][_0xe7ac54](_0x1284a6[_0xff81('0x4d')],_0x1284a6['value'][_0xff81('0x43')],_0x1284a6[_0xff81('0x42')][_0xff81('0x4e')]);}break;case _0xff81('0x4f'):var _0x5c70ef=_0x250fe9[_0xff81('0x42')][_0xff81('0x49')](',')[_0xff81('0x18')](function(_0x20767d){return Number(_0x20767d);});var _0x575b96=parseTagParameter(_0x5c70ef);_0x14c3ea[_0xff81('0x50')][_0xff81('0x51')]['and'](_0x575b96);_0x14c3ea[_0xff81('0x50')]['ids']=_0x5c70ef;break;case _0xff81('0x52'):if(_0x250fe9[_0xff81('0x47')]===_0xff81('0x48')){_0x14c3ea[_0xff81('0x53')][_0xe7ac54](_0xff81('0x54'),'%'+_0x250fe9['value']+'%',null);}else{_0x57970e=_[_0xff81('0x3e')](_0xa0c7eb,[_0xff81('0xc'),_0xff81('0x55')]);_0x250fe9['field']=_0xff81('0x55');_0x1284a6=as[_0xff81('0x3f')](_0x2d7953,_0x57970e[_0xff81('0x40')],_0x250fe9);_0x14c3ea[_0xff81('0x53')][_0xe7ac54](_0x1284a6['text'],_0x1284a6[_0xff81('0x42')]['start'],_0x1284a6[_0xff81('0x42')]['end']);}break;case _0xff81('0x56'):case _0xff81('0x57'):_0x1284a6=as[_0xff81('0x3f')]('me',null,_0x250fe9);_0x14c3ea['body'][_0xe7ac54](_0x1284a6[_0xff81('0x4d')],_0x1284a6[_0xff81('0x42')][_0xff81('0x43')],_0x1284a6[_0xff81('0x42')][_0xff81('0x4e')]);break;}}}return _0x14c3ea;}function parseModelFields(_0x9bed26,_0x56dcd8,_0x563fd4){var _0x10f4e1=utils[_0xff81('0x58')](_0x9bed26);var _0x3aeebe=squel['expr']();var _0x44bd88=_(_0x56dcd8)[_0xff81('0x59')]()[_0xff81('0x18')](function(_0x2dbd57){return _['some'](_0x563fd4,[_0xff81('0xc'),_0x2dbd57])?_0x2dbd57:undefined;})[_0xff81('0x5a')]()['value']();if(_0x44bd88[_0xff81('0x3d')]>0x0){_0x44bd88['forEach'](function(_0x4deb93){if(_0x4deb93===_0x10f4e1){_0x3aeebe[_0xff81('0x46')]('i.'+_0x10f4e1+_0xff81('0x5b'),[][_0xff81('0x5c')](_0x56dcd8[_0x4deb93]));}else if(_0x4deb93==='createdAt'){var _0x148c1d=JSON[_0xff81('0x5d')](_0x56dcd8[_0x4deb93])[_0xff81('0x5e')];var _0x19fa8b=JSON[_0xff81('0x5d')](_0x56dcd8[_0x4deb93])[_0xff81('0x5f')];_0x3aeebe[_0xff81('0x46')](_0xff81('0x60'),_0x148c1d,_0x19fa8b);}else{if(_0x56dcd8[_0x4deb93]===_0xff81('0x61')){_0x3aeebe[_0xff81('0x46')]('i.'+_0x4deb93+_0xff81('0x62'));}else{_0x3aeebe['and']('i.'+_0x4deb93+'\x20=\x20?',_0x56dcd8[_0x4deb93]);}}});}return _0x3aeebe;}function parseQueryParameters(_0x1be2c4,_0x11eb91,_0x35b4d2){var _0x428e93=getSqlClauses();return Promise[_0xff81('0x63')]()[_0xff81('0x64')](function(){return parseModelFields(_0x1be2c4,_0x11eb91,_0x35b4d2);})['then'](function(_0x4b22f2){_0x428e93[_0xff81('0x65')][_0xff81('0x46')](_0x4b22f2);return parseReadParameter(_0x11eb91[_0xff81('0x45')]);})[_0xff81('0x64')](function(_0x58c1f2){_0x428e93[_0xff81('0x45')]['and'](_0x58c1f2);return parseTagParameter(_0x11eb91[_0xff81('0x66')]);})[_0xff81('0x64')](function(_0x32940c){_0x428e93['tags'][_0xff81('0x51')][_0xff81('0x46')](_0x32940c);return parseSearchFilter(_0x1be2c4,_0x11eb91['filter']);})[_0xff81('0x64')](function(_0x55248f){_0x428e93[_0xff81('0x67')]=_0x55248f;return _0x428e93;});}function checkAccountsRestrictions(_0x4729c5,_0x1d1389,_0x3831f1){var _0x4e25df=utils['getAccountFK'](_0x4729c5);var _0x58cafc=_0xff81('0x68')+_[_0xff81('0x69')](_0x4729c5)+(_0x4729c5===_0xff81('0x6a')?_0xff81('0x6b'):_0xff81('0x6c'));var _0x189425=squel[_0xff81('0x23')]();return Promise['resolve']()[_0xff81('0x64')](function(){if(_0x3831f1['search']&&_0x1d1389[_0xff81('0x7')]===_0xff81('0x8')){return _0x1d1389[_0x58cafc]({'attributes':['id'],'raw':!![]});}})[_0xff81('0x64')](function(_0x5d6277){if(_0x5d6277){if(_0x5d6277[_0xff81('0x3d')]===0x0){_0x189425[_0xff81('0x46')]('i.'+_0x4e25df+'\x20IS\x20NULL');}else{_0x189425['and']('i.'+_0x4e25df+'\x20IN\x20?',_[_0xff81('0x18')](_0x5d6277,'id'));}}else if(!_0x3831f1[_0x4e25df]){_0x189425[_0xff81('0x46')]('i.'+_0x4e25df+_0xff81('0x6d'));}})[_0xff81('0x64')](function(){return _0x189425;});}function getClosedOrderClause(_0x5630dc,_0x581395){var _0xf48e1b='';var _0x1325d6=['i.thirdDisposition',_0xff81('0x6e'),'i.disposition'];if(_0x5630dc===_0xff81('0x32')){_0x1325d6['unshift'](_0xff81('0x6f'));}if(_0x581395['closed']==='0'&&_0x5630dc==='mail'){_0xf48e1b='i.substatus';}else{if(_0x581395[_0xff81('0x70')]==='1'){_0x1325d6[_0xff81('0x71')]();}_0xf48e1b='CONCAT_WS(\x27\x27,\x20'+_0x1325d6[_0xff81('0x72')](',\x20')+')';}return _0xf48e1b;}function getFilteredInteractions(_0x297ab6,_0x33e141,_0x228983,_0x4c9de4){var _0x43d9eb=utils[_0xff81('0x19')](_0x297ab6);var _0x87c77e=_[_0xff81('0x69')](_0x297ab6)+_0xff81('0x73');var _0x5e84d6=[];var _0x2955b6=getTagsQuery();var _0x2dc08f={'type':db[_0xff81('0x74')][_0xff81('0x75')][_0xff81('0x76')],'raw':!![]};var _0xb11698=[];var _0x5294f4=[];return db['sequelize'][_0xff81('0x77')](_0x2955b6[_0xff81('0x78')](),_0x2dc08f)['then'](function(_0x506ee5){_0x5e84d6=_[_0xff81('0x79')](_0x506ee5,'id');_0x2dc08f=_[_0xff81('0x7a')](_0x2dc08f,{'model':db[_0x87c77e],'mapToModel':!![],'nest':!![]});if(_0x228983[_0xff81('0x65')]){_0x4c9de4[_0xff81('0x7b')][_0xff81('0x7c')](function(_0x9dea5a){_0x33e141[_0xff81('0xb')]('i.'+_0x9dea5a);});}else{_0x33e141[_0xff81('0xb')](_0xff81('0x7d'),_0xff81('0x44'));_0x33e141[_0xff81('0xb')](_0xff81('0x7e'),_0xff81('0x7f'));_0x33e141[_0xff81('0xb')]('a.mandatoryDisposition',_0xff81('0x80'));if(_0x297ab6==='mail'){_0x33e141[_0xff81('0xb')](_0xff81('0x81'),'Account.email');_0x33e141['field'](_0xff81('0x82'),_0xff81('0x83'));_0x33e141[_0xff81('0xb')]('i.id');_0x33e141[_0xff81('0xb')](_0xff81('0x84'));_0x33e141[_0xff81('0xb')](_0xff81('0x85'));_0x33e141[_0xff81('0xb')](_0xff81('0x86'));_0x33e141['field'](_0xff81('0x87'));_0x33e141[_0xff81('0xb')]('i.attach');_0x33e141[_0xff81('0xb')](_0xff81('0x88'));_0x33e141['field']('i.lastMsgDirection');_0x33e141[_0xff81('0xb')]('i.subject');_0x33e141['field'](_0xff81('0x89'));_0x33e141[_0xff81('0xb')](_0xff81('0x6e'));_0x33e141[_0xff81('0xb')]('i.thirdDisposition');_0x33e141[_0xff81('0xb')](_0xff81('0x6f'));_0x33e141[_0xff81('0xb')](_0xff81('0x8a'));_0x33e141['field'](_0xff81('0x8b'));_0x33e141[_0xff81('0xb')]('i.MailAccountId');_0x33e141['field'](_0xff81('0x8c'));}else if(_0x297ab6===_0xff81('0x30')){_0x33e141[_0xff81('0xb')](_0xff81('0x8d'),_0xff81('0x83'));}else{_0x33e141[_0xff81('0xb')](_0xff81('0x8e'),'contactName');}if(_0x297ab6!==_0xff81('0x32')){_0x33e141['field'](_0xff81('0x8f'));}_0x33e141[_0xff81('0xb')](_0xff81('0x90'),_0xff81('0x91'));_0x33e141[_0xff81('0xb')](_0xff81('0x92'),'Contact.lastName');_0x33e141[_0xff81('0xb')](_0xff81('0x93'),_0xff81('0x94'));_0x33e141[_0xff81('0xb')](_0xff81('0x95'),'Contact.phone');_0x33e141['field'](_0xff81('0x96'),_0xff81('0x97'));_0x33e141[_0xff81('0xb')](_0xff81('0x98'),_0xff81('0x99'));_0x33e141['field'](_0xff81('0x9a'),_0xff81('0x9b'));_0x33e141['field']('o.internal',_0xff81('0x9c'));_0x33e141['field'](_0xff81('0x9d'),_0xff81('0x9e'));}if(_0x4c9de4[_0xff81('0x9f')]){_0x33e141[_0xff81('0x9f')](_0x4c9de4[_0xff81('0x9f')]);}if(_0x4c9de4[_0xff81('0xa0')]){_0x33e141['offset'](_0x4c9de4[_0xff81('0xa0')]);}return db[_0xff81('0xa1')][_0xff81('0x77')](_0x33e141[_0xff81('0x78')](),_0x2dc08f);})[_0xff81('0x64')](function(_0x2c4ce4){_0xb11698=_0x2c4ce4;var _0x21895b=getUsersQuery(_0x297ab6,_0xb11698);return db[_0xff81('0xa1')][_0xff81('0x77')](_0x21895b[_0xff81('0x78')](),_0x2dc08f);})['then'](function(_0x2274de){_0x5294f4=_['groupBy'](_0x2274de,_0x43d9eb);if(_0x297ab6==='mail'){return db['Setting'][_0xff81('0xa2')]({'attributes':[_0xff81('0xa3')],'raw':!![]});}})[_0xff81('0x64')](function(_0x570fee){var _0x420d89=_0x570fee?_0x570fee['enableEmailPreview']:undefined;var _0x54e8e4=_0xb11698['map'](function(_0x150a40){return updateInteraction(_0x150a40,_0x5e84d6,_0x5294f4,_0x420d89);});return Promise['all'](_0x54e8e4);});}function countFilteredInteractions(_0x315a76,_0x1c049f){var _0x2bb259=_0x315a76[_0xff81('0xa4')]();_0x2bb259[_0xff81('0xb')]('COUNT(*)');_0x2bb259[_0xff81('0xb')](_0xff81('0x7d'),_0xff81('0x44'));var _0x5e70c8=utils[_0xff81('0x24')](_0x1c049f);if(!_[_0xff81('0xa5')](_0x5e70c8)){_0x2bb259[_0xff81('0x16')]('t.id\x20IN\x20?',_0x5e70c8);}var _0x91ef34={'type':db[_0xff81('0x74')][_0xff81('0x75')][_0xff81('0x76')],'raw':!![]};return db[_0xff81('0xa1')]['query'](_0x2bb259[_0xff81('0x78')](),_0x91ef34);}module[_0xff81('0xa6')]={'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 000c060..ec1dfde 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 _0x4e78=['disposition','UserId','talking','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','../../mysqldb','map','fullname','split','forEach','push','waiting','answered','abandoned','total','closed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e78,0x139));var _0x84e7=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4e78[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var db=require(_0x84e7('0x0'))['db'];function getInteractionUsers(_0x2057ed,_0x380dc4){return new Promise(function(_0x514a18,_0x3120bb){try{var _0x38a058=[];if(_0x380dc4[_0x2057ed]){_0x38a058=_0x380dc4[_0x2057ed][_0x84e7('0x1')](function(_0x3800c9){return{'id':_0x3800c9['id'],'fullname':_0x3800c9[_0x84e7('0x2')]};});}return _0x514a18(_0x38a058);}catch(_0xd2c41){_0x3120bb(_0xd2c41);}});}function getInteractionTags(_0x1cda0e,_0x3fd6d5){var _0xd92c07=[];if(_0x1cda0e){_0x1cda0e[_0x84e7('0x3')](',')[_0x84e7('0x4')](function(_0x4d97cb){_0xd92c07[_0x84e7('0x5')](_0x3fd6d5[_0x4d97cb]);});}return _0xd92c07;}function updateWaitingCounter(_0x178e23){if(_0x178e23['waiting']){_0x178e23[_0x84e7('0x6')]-=0x1;}}function updateInteractionCounters(_0x4deb72){_0x4deb72[_0x84e7('0x6')]=0x0;_0x4deb72['talking']=0x0;_0x4deb72[_0x84e7('0x7')]=0x0;_0x4deb72['unmanaged']=0x0;_0x4deb72[_0x84e7('0x8')]=0x0;_0x4deb72[_0x84e7('0x9')]=0x0;if(_0x4deb72[_0x84e7('0xa')]){if(_0x4deb72[_0x84e7('0xb')]===_0x84e7('0x8')){_0x4deb72['abandoned']+=0x1;updateWaitingCounter(_0x4deb72);}if(_0x4deb72[_0x84e7('0xc')]){_0x4deb72[_0x84e7('0x7')]+=0x1;if(_0x4deb72[_0x84e7('0xd')]){_0x4deb72[_0x84e7('0xd')]-=0x1;}}else{if(_0x4deb72[_0x84e7('0xb')]){_0x4deb72[_0x84e7('0xe')]+=0x1;updateWaitingCounter(_0x4deb72);}}}else{if(!_0x4deb72[_0x84e7('0xc')]){_0x4deb72[_0x84e7('0x6')]+=0x1;}if(_0x4deb72['UserId']){_0x4deb72['talking']+=0x1;updateWaitingCounter(_0x4deb72);}}_0x4deb72[_0x84e7('0x9')]+=0x1;return _0x4deb72;}function getLastMessageText(_0x2e997b){return db[_0x84e7('0xf')][_0x84e7('0x10')]({'where':{'$and':[{'MailInteractionId':_0x2e997b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x84e7('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x84e7('0x12')],'order':_0x84e7('0x13'),'raw':!![]})[_0x84e7('0x14')](function(_0x56b79f){if(_0x56b79f&&_0x56b79f[_0x84e7('0x12')]){_0x2e997b[_0x84e7('0x15')]=_[_0x84e7('0x16')](_0x56b79f[_0x84e7('0x12')]);}return _0x2e997b;})[_0x84e7('0x17')](function(_0xfa3ba3){throw _0xfa3ba3;});}exports[_0x84e7('0x18')]=function(_0x6bc059,_0x3cc541,_0x56e25b,_0x1de2d6){return new Promise(function(_0x476984,_0x22cab9){return getInteractionUsers(_0x6bc059['id'],_0x56e25b)['then'](function(_0x17986f){_0x6bc059[_0x84e7('0x19')]=_0x17986f;return getInteractionTags(_0x6bc059[_0x84e7('0x1a')],_0x3cc541);})[_0x84e7('0x14')](function(_0x419b5f){_0x6bc059['Tags']=_0x419b5f;delete _0x6bc059[_0x84e7('0x1a')];return updateInteractionCounters(_0x6bc059);})[_0x84e7('0x14')](function(_0x115013){if(_0x1de2d6){return getLastMessageText(_0x115013);}else{return _0x115013;}})[_0x84e7('0x14')](function(_0x1a0682){_0x476984(_0x1a0682);})[_0x84e7('0x17')](function(_0x19b9f1){_0x22cab9(_0x19b9f1);});});}; \ No newline at end of file +var _0x5542=['updateInteraction','then','TagIds','Tags','../../mysqldb','map','fullname','split','push','waiting','talking','unmanaged','total','disposition','abandoned','UserId','findOne','-id','plainBody','trimStart','catch'];(function(_0x1b5e1e,_0x5b657d){var _0x550594=function(_0x2da675){while(--_0x2da675){_0x1b5e1e['push'](_0x1b5e1e['shift']());}};_0x550594(++_0x5b657d);}(_0x5542,0x1a8));var _0x2554=function(_0x182cbd,_0x3b513a){_0x182cbd=_0x182cbd-0x0;var _0x48ade4=_0x5542[_0x182cbd];return _0x48ade4;};'use strict';var _=require('lodash');var db=require(_0x2554('0x0'))['db'];function getInteractionUsers(_0xb0a4be,_0x46df29){return new Promise(function(_0x28cdd7,_0x3e84fe){try{var _0x119640=[];if(_0x46df29[_0xb0a4be]){_0x119640=_0x46df29[_0xb0a4be][_0x2554('0x1')](function(_0x3ee032){return{'id':_0x3ee032['id'],'fullname':_0x3ee032[_0x2554('0x2')]};});}return _0x28cdd7(_0x119640);}catch(_0x32b4b2){_0x3e84fe(_0x32b4b2);}});}function getInteractionTags(_0x2a08d0,_0xafce53){var _0xc0979a=[];if(_0x2a08d0){_0x2a08d0[_0x2554('0x3')](',')['forEach'](function(_0x206ecb){_0xc0979a[_0x2554('0x4')](_0xafce53[_0x206ecb]);});}return _0xc0979a;}function updateWaitingCounter(_0x85e5f2){if(_0x85e5f2[_0x2554('0x5')]){_0x85e5f2[_0x2554('0x5')]-=0x1;}}function updateInteractionCounters(_0x1b9dfc){_0x1b9dfc['waiting']=0x0;_0x1b9dfc[_0x2554('0x6')]=0x0;_0x1b9dfc['answered']=0x0;_0x1b9dfc[_0x2554('0x7')]=0x0;_0x1b9dfc['abandoned']=0x0;_0x1b9dfc[_0x2554('0x8')]=0x0;if(_0x1b9dfc['closed']){if(_0x1b9dfc[_0x2554('0x9')]===_0x2554('0xa')){_0x1b9dfc[_0x2554('0xa')]+=0x1;updateWaitingCounter(_0x1b9dfc);}if(_0x1b9dfc[_0x2554('0xb')]){_0x1b9dfc['answered']+=0x1;if(_0x1b9dfc[_0x2554('0x6')]){_0x1b9dfc[_0x2554('0x6')]-=0x1;}}else{if(_0x1b9dfc[_0x2554('0x9')]){_0x1b9dfc[_0x2554('0x7')]+=0x1;updateWaitingCounter(_0x1b9dfc);}}}else{if(!_0x1b9dfc[_0x2554('0xb')]){_0x1b9dfc['waiting']+=0x1;}if(_0x1b9dfc[_0x2554('0xb')]){_0x1b9dfc[_0x2554('0x6')]+=0x1;updateWaitingCounter(_0x1b9dfc);}}_0x1b9dfc['total']+=0x1;return _0x1b9dfc;}function getLastMessageText(_0x3271fd){return db['MailMessage'][_0x2554('0xc')]({'where':{'$and':[{'MailInteractionId':_0x3271fd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2554('0xd'),'raw':!![]})['then'](function(_0x3b1073){if(_0x3b1073&&_0x3b1073[_0x2554('0xe')]){_0x3271fd['lastMsgText']=_[_0x2554('0xf')](_0x3b1073[_0x2554('0xe')]);}return _0x3271fd;})[_0x2554('0x10')](function(_0x3d1034){throw _0x3d1034;});}exports[_0x2554('0x11')]=function(_0x23397c,_0x3d9972,_0x7ad47f,_0x23fc99){return new Promise(function(_0x3fdfcc,_0x3255bc){return getInteractionUsers(_0x23397c['id'],_0x7ad47f)[_0x2554('0x12')](function(_0x537e2d){_0x23397c['Users']=_0x537e2d;return getInteractionTags(_0x23397c[_0x2554('0x13')],_0x3d9972);})['then'](function(_0x33ba3a){_0x23397c[_0x2554('0x14')]=_0x33ba3a;delete _0x23397c[_0x2554('0x13')];return updateInteractionCounters(_0x23397c);})[_0x2554('0x12')](function(_0x2115f7){if(_0x23fc99){return getLastMessageText(_0x2115f7);}else{return _0x2115f7;}})['then'](function(_0x9014b6){_0x3fdfcc(_0x9014b6);})[_0x2554('0x10')](function(_0x1f34fd){_0x3255bc(_0x1f34fd);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 11c1d0a..95db383 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 _0x67d8=['websites','_interactions','_interaction_has_tags','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x67d8,0x109));var _0x867d=function(_0x2267ee,_0x2eabf){_0x2267ee=_0x2267ee-0x0;var _0xdf3559=_0x67d8[_0x2267ee];return _0xdf3559;};'use strict';var _=require(_0x867d('0x0'));var db=require(_0x867d('0x1'))['db'];var loggers={'openchannel':require(_0x867d('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x867d('0x3')),'fax':require(_0x867d('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0x867d('0x4')),'chat':require(_0x867d('0x2'))(_0x867d('0x5')),'whatsapp':require('../../config/logger')(_0x867d('0x6'))};function getAccountFK(_0x3fb6ac){return _[_0x867d('0x7')](_0x3fb6ac)+(_0x3fb6ac==='chat'?_0x867d('0x8'):_0x867d('0x9'))+'Id';}function getInteractionFK(_0x2d9d30){return _[_0x867d('0x7')](_0x2d9d30)+_0x867d('0xa');}function getInteractionId(_0x30ec1d,_0x18d816,_0x4413f4){if(_0x30ec1d&&_0x30ec1d[_[_0x867d('0xb')](_0x4413f4)+_0x867d('0xa')]){return _0x30ec1d[_[_0x867d('0xb')](_0x4413f4)+_0x867d('0xa')];}else if(_0x30ec1d&&_0x30ec1d['id']){return _0x30ec1d['id'];}else if(_0x18d816&&_0x18d816['id']){return _0x18d816['id'];}else{return _0x867d('0xc');}}function getInteractionsTables(_0x5d9b4e){return{'accounts':_0x5d9b4e+'_'+(_0x5d9b4e===_0x867d('0xd')?_0x867d('0xe'):'accounts'),'interactions':_0x5d9b4e+_0x867d('0xf'),'interactionsTags':_0x5d9b4e+_0x867d('0x10'),'messages':_0x5d9b4e+'_messages','userInteractions':_0x867d('0x11')+_0x5d9b4e+_0x867d('0xf')};}function getSelectedTags(_0x37bc71){var _0x2df76b=[];if(_0x37bc71){_0x2df76b=Array['isArray'](_0x37bc71)?_0x37bc71:[_0x37bc71];}return _0x2df76b;}function log(_0x48d77e,_0x943165,_0x575b99,_0xadff43,_0x2b5423,_0x19b5af){loggers[_0x2b5423[_0x867d('0x12')]()][_0x48d77e](_0x867d('0x13'),_0x19b5af['toUpperCase'](),_0x943165?_0x943165['id']:null,_0x943165?_0x943165[_0x867d('0x14')]:null,_0x943165?_0x943165[_0x867d('0x15')]:null,getInteractionId(_0x575b99,_0xadff43,_0x2b5423),_0x575b99?JSON[_0x867d('0x16')](_0x575b99):_0x867d('0x17'));}function updateUser(_0x3d9c79,_0x5463b2,_0x4fbe3e,_0x43e95b,_0x513b5e){db[_['upperFirst'](_0x43e95b)+'Interaction'][_0x867d('0x18')]({'where':{'id':getInteractionId(_0x5463b2,_0x4fbe3e,_0x43e95b)}})[_0x867d('0x19')](function(_0x3f468d){if(_0x3f468d){return _0x3f468d[_0x867d('0x1a')]({'UserId':_0x3d9c79?_0x3d9c79['id']:null});}})[_0x867d('0x19')](function(_0x2e9dc8){if(_0x2e9dc8){log(_0x867d('0x1b'),_0x3d9c79,_0x5463b2,_0x4fbe3e,_0x43e95b,_0x513b5e);}})[_0x867d('0x1c')](function(){log(_0x867d('0x1d'),_0x3d9c79,_0x5463b2,_0x4fbe3e,_0x43e95b,_0x513b5e);});}module[_0x867d('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xec02=['chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','chat','websites','_interactions','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xec02,0x1ad));var _0x2ec0=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xec02[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x2ec0('0x0'));var db=require(_0x2ec0('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2ec0('0x2')),'mail':require(_0x2ec0('0x3'))(_0x2ec0('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x2ec0('0x3'))(_0x2ec0('0x5')),'chat':require(_0x2ec0('0x3'))(_0x2ec0('0x6')),'whatsapp':require(_0x2ec0('0x3'))(_0x2ec0('0x7'))};function getAccountFK(_0x10bfe1){return _['capitalize'](_0x10bfe1)+(_0x10bfe1==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x176d6a){return _['capitalize'](_0x176d6a)+_0x2ec0('0x8');}function getInteractionId(_0x191b65,_0x151c5f,_0x4f56ff){if(_0x191b65&&_0x191b65[_['upperFirst'](_0x4f56ff)+_0x2ec0('0x8')]){return _0x191b65[_[_0x2ec0('0x9')](_0x4f56ff)+_0x2ec0('0x8')];}else if(_0x191b65&&_0x191b65['id']){return _0x191b65['id'];}else if(_0x151c5f&&_0x151c5f['id']){return _0x151c5f['id'];}else{return _0x2ec0('0xa');}}function getInteractionsTables(_0x186f67){return{'accounts':_0x186f67+'_'+(_0x186f67===_0x2ec0('0xb')?_0x2ec0('0xc'):'accounts'),'interactions':_0x186f67+_0x2ec0('0xd'),'interactionsTags':_0x186f67+'_interaction_has_tags','messages':_0x186f67+'_messages','userInteractions':_0x2ec0('0xe')+_0x186f67+_0x2ec0('0xd')};}function getSelectedTags(_0x54219d){var _0x4d79f1=[];if(_0x54219d){_0x4d79f1=Array[_0x2ec0('0xf')](_0x54219d)?_0x54219d:[_0x54219d];}return _0x4d79f1;}function log(_0xb2b3f3,_0x3a4eb7,_0x1a4528,_0x4cca14,_0x2b5cbc,_0x290346){loggers[_0x2b5cbc[_0x2ec0('0x10')]()][_0xb2b3f3](_0x2ec0('0x11'),_0x290346[_0x2ec0('0x12')](),_0x3a4eb7?_0x3a4eb7['id']:null,_0x3a4eb7?_0x3a4eb7['name']:null,_0x3a4eb7?_0x3a4eb7['role']:null,getInteractionId(_0x1a4528,_0x4cca14,_0x2b5cbc),_0x1a4528?JSON[_0x2ec0('0x13')](_0x1a4528):_0x2ec0('0x14'));}function updateUser(_0x520d20,_0x1ec9f8,_0x1a1a4f,_0x2eb233,_0x15aad3){db[_[_0x2ec0('0x9')](_0x2eb233)+_0x2ec0('0x15')][_0x2ec0('0x16')]({'where':{'id':getInteractionId(_0x1ec9f8,_0x1a1a4f,_0x2eb233)}})[_0x2ec0('0x17')](function(_0x4c08c4){if(_0x4c08c4){return _0x4c08c4[_0x2ec0('0x18')]({'UserId':_0x520d20?_0x520d20['id']:null});}})[_0x2ec0('0x17')](function(_0x5b359f){if(_0x5b359f){log(_0x2ec0('0x19'),_0x520d20,_0x1ec9f8,_0x1a1a4f,_0x2eb233,_0x15aad3);}})[_0x2ec0('0x1a')](function(){log(_0x2ec0('0x1b'),_0x520d20,_0x1ec9f8,_0x1a1a4f,_0x2eb233,_0x15aad3);});}module[_0x2ec0('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 40d8eda..99bf67e 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 _0xaa54=['format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','composable-middleware','../../config/environment','license','data1','split','aes-256-ctr'];(function(_0x472166,_0x4d08e8){var _0x11f0ba=function(_0x4ec411){while(--_0x4ec411){_0x472166['push'](_0x472166['shift']());}};_0x11f0ba(++_0x4d08e8);}(_0xaa54,0xb7));var _0x4aa5=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xaa54[_0xe73080];return _0x12cbc4;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x4aa5('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x4aa5('0x1'));function getValueFromLicense(_0x183705,_0xdce8c3){if(_0x183705&&_0xdce8c3){if(_0xdce8c3['data1']&&_0xdce8c3[_0x4aa5('0x2')]){var _0x54d652=_0xdce8c3[_0x4aa5('0x3')];var _0x222eb9=_0xdce8c3[_0x4aa5('0x2')];var _0x2ee085=_0x54d652[_0x4aa5('0x4')]('-')[0x4];var _0x4e5c65=_0x54d652['split']('-')[0x0];var _0x56a15d=crypto['createDecipher'](_0x4aa5('0x5'),util[_0x4aa5('0x6')](_0x4aa5('0x7'),_0x2ee085,_0x54d652,_0x4e5c65));var _0x3b241f=_0x56a15d[_0x4aa5('0x8')](_0x222eb9,_0x4aa5('0x9'),_0x4aa5('0xa'));_0x3b241f+=_0x56a15d[_0x4aa5('0xb')](_0x4aa5('0xa'));var _0x56df36=JSON[_0x4aa5('0xc')](_0x3b241f);return _0x56df36[_0x4aa5('0xd')](_0x183705)?_0x56df36[_0x183705]:null;}}return null;}function isLimit(_0x4d5a14,_0x11b291,_0x1cf02e,_0x1d6112){var _0x220d75=_0x11b291;return compose()['use'](function(_0x2009e8,_0x454950,_0x5f099f){return db[_0x4aa5('0xe')][_0x4aa5('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x4aa5('0x10')](function(_0x1fe18f){var _0x2630a0=getValueFromLicense(_0x4d5a14,_0x1fe18f);return _0x2630a0?_0x2630a0:_0x220d75;})['then'](function(_0x59d2fb){_0x220d75=_0x59d2fb;return _0x1cf02e[_0x4aa5('0x11')](_0x1d6112);})[_0x4aa5('0x10')](function(_0xf7c8c4){if(_0xf7c8c4>=_0x220d75){return _0x454950[_0x4aa5('0x12')](0x193)[_0x4aa5('0x13')]({'message':util['format'](_0x4aa5('0x14'),_0x4d5a14)});}_0x5f099f();})[_0x4aa5('0x15')](function(_0x485a35){_0x5f099f(_0x485a35);});});}function isUserLimit(){return isLimit(_0x4aa5('0x16'),0x1,db[_0x4aa5('0x17')],{'where':{'$or':[{'role':_0x4aa5('0x18')},{'role':_0x4aa5('0x19')}]}});}exports[_0x4aa5('0x1a')]=isUserLimit; \ No newline at end of file +var _0x4b8f=['createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b8f,0x1f1));var _0xf4b8=function(_0x3d4257,_0x7c5823){_0x3d4257=_0x3d4257-0x0;var _0x11b58c=_0x4b8f[_0x3d4257];return _0x11b58c;};'use strict';var crypto=require(_0xf4b8('0x0'));var util=require(_0xf4b8('0x1'));var compose=require(_0xf4b8('0x2'));var db=require(_0xf4b8('0x3'))['db'];var config=require(_0xf4b8('0x4'));function getValueFromLicense(_0xca373a,_0x31dafb){if(_0xca373a&&_0x31dafb){if(_0x31dafb['data1']&&_0x31dafb[_0xf4b8('0x5')]){var _0x1cb344=_0x31dafb['data1'];var _0x216198=_0x31dafb['license'];var _0x520c43=_0x1cb344[_0xf4b8('0x6')]('-')[0x4];var _0x1ee651=_0x1cb344[_0xf4b8('0x6')]('-')[0x0];var _0x2b495c=crypto[_0xf4b8('0x7')](_0xf4b8('0x8'),util[_0xf4b8('0x9')](_0xf4b8('0xa'),_0x520c43,_0x1cb344,_0x1ee651));var _0x984f1a=_0x2b495c['update'](_0x216198,_0xf4b8('0xb'),_0xf4b8('0xc'));_0x984f1a+=_0x2b495c[_0xf4b8('0xd')](_0xf4b8('0xc'));var _0x4a9b5d=JSON[_0xf4b8('0xe')](_0x984f1a);return _0x4a9b5d[_0xf4b8('0xf')](_0xca373a)?_0x4a9b5d[_0xca373a]:null;}}return null;}function isLimit(_0x231c27,_0x239552,_0x59c1a4,_0x2db5da){var _0x2f9b2e=_0x239552;return compose()[_0xf4b8('0x10')](function(_0x22c3f8,_0x433236,_0x71f9a9){return db[_0xf4b8('0x11')][_0xf4b8('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xf4b8('0x13')](function(_0x1741e8){var _0x2ab257=getValueFromLicense(_0x231c27,_0x1741e8);return _0x2ab257?_0x2ab257:_0x2f9b2e;})[_0xf4b8('0x13')](function(_0x4b6ce2){_0x2f9b2e=_0x4b6ce2;return _0x59c1a4[_0xf4b8('0x14')](_0x2db5da);})[_0xf4b8('0x13')](function(_0x174b83){if(_0x174b83>=_0x2f9b2e){return _0x433236[_0xf4b8('0x15')](0x193)[_0xf4b8('0x16')]({'message':util[_0xf4b8('0x9')](_0xf4b8('0x17'),_0x231c27)});}_0x71f9a9();})[_0xf4b8('0x18')](function(_0x23ebb3){_0x71f9a9(_0x23ebb3);});});}function isUserLimit(){return isLimit(_0xf4b8('0x19'),0x1,db[_0xf4b8('0x1a')],{'where':{'$or':[{'role':_0xf4b8('0x1b')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5e1fd14..bc62d89 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 _0x3e1e=['add','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','forEach','shift','match','filter','map','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','$in','IN\x20?','$notIn','=\x20?','<>\x20?','$substring','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$startsWith','$endsWith','pop','hours'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x3e1e,0x1a2));var _0xe3e1=function(_0x54e895,_0x559be1){_0x54e895=_0x54e895-0x0;var _0x4df4e8=_0x3e1e[_0x54e895];return _0x4df4e8;};'use strict';var _=require(_0xe3e1('0x0'));var moment=require(_0xe3e1('0x1'));exports[_0xe3e1('0x2')]=function(_0x1e0f97){var _0x503293={'conditions':[]};_0x503293[_0xe3e1('0x3')]=_[_0xe3e1('0x4')](_0x1e0f97,'[$or]')?'or':_0xe3e1('0x5');var _0x1935fd=_0x1e0f97[_0xe3e1('0x6')]('[$and]','')['replace'](_0xe3e1('0x7'),'')[_0xe3e1('0x8')]('||');for(var _0x1974bf=0x0;_0x1974bf<_0x1935fd[_0xe3e1('0x9')];_0x1974bf++){var _0x6fe582=_0x1935fd[_0x1974bf]['split'](':=');var _0x56a27b=_0x6fe582[0x0];var _0x191e51=_0x6fe582['slice'](0x1);_0x191e51[_0xe3e1('0xa')](function(_0x422174){var _0x49ce99=_0x422174[_0xe3e1('0x8')]('[')[_0xe3e1('0xb')]();var _0x32bfc0=_0x422174[_0xe3e1('0xc')](/\[(.*?)\]/g);_0x32bfc0[_0xe3e1('0xa')](function(_0x1bf0c6){var _0x449b76=_0x1bf0c6[_0xe3e1('0x8')]('[')[_0xe3e1('0xd')](function(_0x53be90){return _0x53be90['indexOf'](']')>-0x1;})[_0xe3e1('0xe')](function(_0x894b11){return _0x894b11['split'](']')[0x0];})[0x0];_0x503293['conditions']['push']({'field':_0x56a27b,'operator':_0x49ce99,'value':_0x449b76});});});}return _0x503293;};exports[_0xe3e1('0xf')]=function(_0x14c29f,_0x214669,_0x205e46){var _0x27037c={};if(_0x214669===_0xe3e1('0x10')){if(_0x205e46[_0xe3e1('0x11')]===_0xe3e1('0x12')){_0x205e46['operator']=_0xe3e1('0x13');_0x205e46[_0xe3e1('0x14')]+=','+_0x205e46[_0xe3e1('0x14')];}else if(_[_0xe3e1('0x15')]([_0xe3e1('0x16'),_0xe3e1('0x17')],_0x205e46[_0xe3e1('0x11')])){_0x205e46['value']=moment(_0x205e46['value'])['add'](0x1,'days')[_0xe3e1('0x18')](_0xe3e1('0x19'));}}if(_0x205e46[_0xe3e1('0x1a')]){_0x214669=_0x205e46[_0xe3e1('0x1a')];_0x27037c[_0xe3e1('0x1b')]=_0xe3e1('0x1c')+_0x14c29f+'.'+_0x205e46[_0xe3e1('0x1d')]+_0xe3e1('0x1e')+_0x205e46[_0xe3e1('0x1a')]+')\x20'+parseOperator(_0x205e46['operator']);}else{_0x27037c[_0xe3e1('0x1b')]=_0x14c29f+'.'+_0x205e46[_0xe3e1('0x1d')]+'\x20'+parseOperator(_0x205e46['operator']);}if(_[_0xe3e1('0x15')]([_0xe3e1('0x1f'),'$notIn'],_0x205e46[_0xe3e1('0x11')]))_0x27037c[_0xe3e1('0x1b')]='('+_0x27037c[_0xe3e1('0x1b')]+_0xe3e1('0x20')+_0x14c29f+'.'+_0x205e46[_0xe3e1('0x1d')]+'\x20IS\x20NULL)';_0x27037c['value']=parseValue(_0x214669,_0x205e46[_0xe3e1('0x11')],_0x205e46['value']);return _0x27037c;};function parseOperator(_0x19ce9d){var _0x4eeb9c;switch(_0x19ce9d){case _0xe3e1('0x21'):_0x4eeb9c=_0xe3e1('0x22');break;case _0xe3e1('0x23'):_0x4eeb9c='NOT\x20IN\x20?';break;case'$eq':_0x4eeb9c=_0xe3e1('0x24');break;case _0xe3e1('0x1f'):_0x4eeb9c=_0xe3e1('0x25');break;case _0xe3e1('0x26'):case'$startsWith':case'$endsWith':_0x4eeb9c='LIKE\x20?';break;case _0xe3e1('0x27'):_0x4eeb9c=_0xe3e1('0x28');break;case'$gt':_0x4eeb9c=_0xe3e1('0x29');break;case _0xe3e1('0x17'):_0x4eeb9c=_0xe3e1('0x2a');break;case _0xe3e1('0x2b'):_0x4eeb9c=_0xe3e1('0x2c');break;case _0xe3e1('0x13'):_0x4eeb9c='BETWEEN\x20?\x20AND\x20?';break;}return _0x4eeb9c;}function parseValue(_0x1849b3,_0x1b4816,_0x251e08){var _0x49db6e={'start':undefined,'end':undefined};switch(_0x1b4816){case'$in':case'$notIn':_0x49db6e[_0xe3e1('0x2d')]=_0x251e08[_0xe3e1('0x8')](',');break;case _0xe3e1('0x26'):_0x49db6e['start']='%'+_0x251e08+'%';break;case _0xe3e1('0x2e'):_0x49db6e[_0xe3e1('0x2d')]=_0x251e08+'%';break;case _0xe3e1('0x2f'):_0x49db6e['start']='%'+_0x251e08;break;case _0xe3e1('0x13'):var _0x111d9a=_0x251e08['split'](',');var _0x251e08=_0x111d9a['shift']();var _0x1200d0=_0x111d9a[_0xe3e1('0x30')]();if(_0x1849b3===_0xe3e1('0x10')){_0x251e08=moment(_0x251e08)['utcOffset'](0x0,!![])[_0xe3e1('0x18')]();_0x1200d0=moment(_0x1200d0)['utcOffset'](0x0,!![])['add'](0x17,_0xe3e1('0x31'))['add'](0x3b,'minutes')[_0xe3e1('0x32')](0x3b,_0xe3e1('0x33'))['format']();}_0x49db6e={'start':_0x251e08,'end':_0x1200d0};break;default:_0x49db6e[_0xe3e1('0x2d')]=_0x251e08;break;}return _0x49db6e;} \ No newline at end of file +var _0xd3ba=['value','add','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','format','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','shift','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','$between','includes','$gt','$lte'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3ba,0x92));var _0xad3b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xd3ba[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var moment=require(_0xad3b('0x0'));exports[_0xad3b('0x1')]=function(_0x13cc13){var _0x20adfe={'conditions':[]};_0x20adfe[_0xad3b('0x2')]=_[_0xad3b('0x3')](_0x13cc13,_0xad3b('0x4'))?'or':_0xad3b('0x5');var _0x41dd65=_0x13cc13[_0xad3b('0x6')](_0xad3b('0x7'),'')[_0xad3b('0x6')](_0xad3b('0x4'),'')[_0xad3b('0x8')]('||');for(var _0x578774=0x0;_0x578774<_0x41dd65['length'];_0x578774++){var _0x3c5aed=_0x41dd65[_0x578774][_0xad3b('0x8')](':=');var _0x56714f=_0x3c5aed[0x0];var _0x13bfd2=_0x3c5aed[_0xad3b('0x9')](0x1);_0x13bfd2['forEach'](function(_0x113bf6){var _0xe7bd92=_0x113bf6[_0xad3b('0x8')]('[')[_0xad3b('0xa')]();var _0x5de0a4=_0x113bf6['match'](/\[(.*?)\]/g);_0x5de0a4[_0xad3b('0xb')](function(_0x5b03d7){var _0x3f6a84=_0x5b03d7['split']('[')[_0xad3b('0xc')](function(_0x2f82e5){return _0x2f82e5[_0xad3b('0xd')](']')>-0x1;})[_0xad3b('0xe')](function(_0x590aad){return _0x590aad['split'](']')[0x0];})[0x0];_0x20adfe[_0xad3b('0xf')][_0xad3b('0x10')]({'field':_0x56714f,'operator':_0xe7bd92,'value':_0x3f6a84});});});}return _0x20adfe;};exports[_0xad3b('0x11')]=function(_0x47d5fe,_0x583bb1,_0x2a503d){var _0x2cc96e={};if(_0x583bb1===_0xad3b('0x12')){if(_0x2a503d['operator']===_0xad3b('0x13')){_0x2a503d[_0xad3b('0x14')]=_0xad3b('0x15');_0x2a503d['value']+=','+_0x2a503d['value'];}else if(_[_0xad3b('0x16')]([_0xad3b('0x17'),_0xad3b('0x18')],_0x2a503d[_0xad3b('0x14')])){_0x2a503d[_0xad3b('0x19')]=moment(_0x2a503d[_0xad3b('0x19')])[_0xad3b('0x1a')](0x1,_0xad3b('0x1b'))['format']('YYYY-MM-DD');}}if(_0x2a503d['castTo']){_0x583bb1=_0x2a503d[_0xad3b('0x1c')];_0x2cc96e[_0xad3b('0x1d')]=_0xad3b('0x1e')+_0x47d5fe+'.'+_0x2a503d[_0xad3b('0x1f')]+_0xad3b('0x20')+_0x2a503d[_0xad3b('0x1c')]+')\x20'+parseOperator(_0x2a503d['operator']);}else{_0x2cc96e[_0xad3b('0x1d')]=_0x47d5fe+'.'+_0x2a503d[_0xad3b('0x1f')]+'\x20'+parseOperator(_0x2a503d[_0xad3b('0x14')]);}if(_[_0xad3b('0x16')]([_0xad3b('0x21'),_0xad3b('0x22')],_0x2a503d[_0xad3b('0x14')]))_0x2cc96e[_0xad3b('0x1d')]='('+_0x2cc96e[_0xad3b('0x1d')]+_0xad3b('0x23')+_0x47d5fe+'.'+_0x2a503d[_0xad3b('0x1f')]+_0xad3b('0x24');_0x2cc96e[_0xad3b('0x19')]=parseValue(_0x583bb1,_0x2a503d[_0xad3b('0x14')],_0x2a503d[_0xad3b('0x19')]);return _0x2cc96e;};function parseOperator(_0x391f04){var _0x21c5c0;switch(_0x391f04){case _0xad3b('0x25'):_0x21c5c0=_0xad3b('0x26');break;case _0xad3b('0x22'):_0x21c5c0=_0xad3b('0x27');break;case _0xad3b('0x13'):_0x21c5c0='=\x20?';break;case _0xad3b('0x21'):_0x21c5c0=_0xad3b('0x28');break;case _0xad3b('0x29'):case _0xad3b('0x2a'):case _0xad3b('0x2b'):_0x21c5c0='LIKE\x20?';break;case _0xad3b('0x2c'):_0x21c5c0=_0xad3b('0x2d');break;case _0xad3b('0x17'):_0x21c5c0=_0xad3b('0x2e');break;case _0xad3b('0x18'):_0x21c5c0='<=\x20?';break;case _0xad3b('0x2f'):_0x21c5c0=_0xad3b('0x30');break;case _0xad3b('0x15'):_0x21c5c0=_0xad3b('0x31');break;}return _0x21c5c0;}function parseValue(_0x467475,_0x5e1d6c,_0x46cb92){var _0x51c061={'start':undefined,'end':undefined};switch(_0x5e1d6c){case _0xad3b('0x25'):case _0xad3b('0x22'):_0x51c061['start']=_0x46cb92[_0xad3b('0x8')](',');break;case'$substring':_0x51c061[_0xad3b('0x32')]='%'+_0x46cb92+'%';break;case _0xad3b('0x2a'):_0x51c061['start']=_0x46cb92+'%';break;case _0xad3b('0x2b'):_0x51c061['start']='%'+_0x46cb92;break;case'$between':var _0x432c45=_0x46cb92[_0xad3b('0x8')](',');var _0x46cb92=_0x432c45[_0xad3b('0xa')]();var _0x596d68=_0x432c45[_0xad3b('0x33')]();if(_0x467475===_0xad3b('0x12')){_0x46cb92=moment(_0x46cb92)[_0xad3b('0x34')](0x0,!![])[_0xad3b('0x35')]();_0x596d68=moment(_0x596d68)[_0xad3b('0x34')](0x0,!![])[_0xad3b('0x1a')](0x17,_0xad3b('0x36'))[_0xad3b('0x1a')](0x3b,_0xad3b('0x37'))['add'](0x3b,_0xad3b('0x38'))[_0xad3b('0x35')]();}_0x51c061={'start':_0x46cb92,'end':_0x596d68};break;default:_0x51c061[_0xad3b('0x32')]=_0x46cb92;break;}return _0x51c061;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 262536f..0968b00 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 _0x2056=['../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','isEmpty','forOwn','type','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','offset','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','isNumeric','match','isEmail','getFullTextValue','{EXPR}','forEach','replace','join','getOptions','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','object','columns','value','merge','VIRTUAL','lower','options','include','includeAll','push','moment'];(function(_0x6f27a5,_0x487389){var _0x4e3c04=function(_0x2b326e){while(--_0x2b326e){_0x6f27a5['push'](_0x6f27a5['shift']());}};_0x4e3c04(++_0x487389);}(_0x2056,0x107));var _0x6205=function(_0x36a786,_0x1f112a){_0x36a786=_0x36a786-0x0;var _0x371498=_0x2056[_0x36a786];return _0x371498;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x6205('0x0'));var db=require(_0x6205('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1d6202){var _0x3580a1=['ne'];try{var _0x2198ce=JSON[_0x6205('0x2')](_0x1d6202);var _0x2f3052=Object[_0x6205('0x3')](_0x2198ce)[0x0];return _0x3580a1[_0x6205('0x4')](_0x2f3052);}catch(_0x5398fe){return![];}}function getOperatorValue(_0x45afa8){var _0x2c555d=JSON[_0x6205('0x2')](_0x45afa8);var _0x446132=Object[_0x6205('0x3')](_0x2c555d)[0x0];var _0x556d20=_0x2c555d[_0x446132];return{['$'+_0x446132]:_0x556d20};}function parseIncludeModel(_0x1b7091){var _0xfefdec=JSON[_0x6205('0x2')](_0x1b7091);return{'model':db[_0xfefdec[_0x6205('0x5')]],'as':_0xfefdec[_0x6205('0x6')],'attributes':_0xfefdec[_0x6205('0x7')],'raw':_0xfefdec['raw']};}exports[_0x6205('0x7')]=function(_0x5a391b){var _0xecd9ff=null;if(_0x5a391b){_0xecd9ff=_0x5a391b[_0x6205('0x8')](',');}return _0xecd9ff;};exports[_0x6205('0x9')]=function(_0x3c8996,_0x3d1525){var _0x4ed8b1={};if(!_[_0x6205('0xa')](_0x3c8996)){_[_0x6205('0xb')](_0x3c8996,function(_0x5a2d36,_0x30503d){try{if(_0x3d1525){var _0x1dbb81=_['find'](_0x3d1525,{'name':_0x30503d})||{};if(hasSequelizeOperator(_0x5a2d36)){_0x4ed8b1[_0x30503d]=getOperatorValue(_0x5a2d36);}else if(_0x1dbb81[_0x6205('0xc')]==='DATE'&&_['isPlainObject'](_0x5a2d36)){var _0x4d6685=JSON[_0x6205('0x2')](_0x5a2d36);var _0x7ab1f1={'$gte':moment(moment(_0x4d6685[_0x6205('0xd')])[_0x6205('0xe')](_0x6205('0xf')))[_0x6205('0x10')]()['format'](),'$lte':moment(moment(_0x4d6685['$lte'])[_0x6205('0xe')]('YYYY-MM-DD'))[_0x6205('0x10')]()[_0x6205('0x11')](0x1,'s')[_0x6205('0xe')]()};_0x4ed8b1[_0x30503d]=_0x7ab1f1;}else if(_0x1dbb81[_0x6205('0x12')]===_0x6205('0x13')){_0x4ed8b1[_0x30503d]=_0x5a2d36;}else{_0x4ed8b1[_0x30503d]=_['isArray'](_0x5a2d36)?_0x5a2d36:JSON['parse'](_0x5a2d36);}}else{_0x4ed8b1[_0x30503d]=_[_0x6205('0x14')](_0x5a2d36)?_0x5a2d36:JSON['parse'](_0x5a2d36);}}catch(_0x5dafa6){_0x4ed8b1[_0x30503d]=_0x5a2d36[_0x6205('0x8')](',');}});}return _0x4ed8b1;};exports['limit']=function(_0x4ddefb){_0x4ddefb=parseInt(_0x4ddefb,0xa);if(!_0x4ddefb||_0x4ddefb<0x0){_0x4ddefb=LIMIT_VALUE;}return _0x4ddefb;};exports[_0x6205('0x15')]=function(_0x16c499){_0x16c499=parseInt(_0x16c499,0xa);if(!_0x16c499||_0x16c499<0x0){_0x16c499=0x0;}return _0x16c499;};exports['sort']=function(_0x339be2){var _0x55da51,_0x285e43=null;if(_0x339be2){_0x55da51=_0x339be2[_0x6205('0x8')](',');_0x285e43=_[_0x6205('0x16')](_0x55da51,function(_0x47ec88){if(_0x47ec88[_0x6205('0x17')]('-')===0x0){return[_0x47ec88===_0x6205('0x18')?sequelize['cast'](sequelize[_0x6205('0x19')]('priority'),_0x6205('0x1a')):_0x47ec88[_0x6205('0x1b')](0x1),_0x6205('0x1c')];}else{return[_0x47ec88===_0x6205('0x18')?sequelize[_0x6205('0x1d')](sequelize[_0x6205('0x19')](_0x6205('0x18')),_0x6205('0x1a')):_0x47ec88,_0x6205('0x1e')];}});}return _0x285e43;};exports[_0x6205('0x1f')]=function(_0x3596d9,_0x9abdaa){if(_[_0x6205('0xa')](_0x3596d9)){return _0x3596d9;}if(_[_0x6205('0x14')](_0x3596d9)){for(var _0x5df61b=0x0;_0x5df61b<_0x3596d9[_0x6205('0x20')];_0x5df61b+=0x1){_0x3596d9[_0x5df61b]=this['omit'](_0x3596d9[_0x5df61b],_0x9abdaa);}return _0x3596d9;}if(!_[_0x6205('0x21')](_0x3596d9)){return _0x3596d9;}if(_[_0x6205('0x22')](_0x9abdaa)){_0x9abdaa=[_0x9abdaa];}if(!_[_0x6205('0x14')](_0x9abdaa)){return _0x3596d9;}for(var _0x268fce=0x0;_0x268fce<_0x9abdaa['length'];_0x268fce+=0x1){_[_0x6205('0x23')](_0x3596d9,_0x9abdaa[_0x268fce]);}for(var _0x4c647d in _0x3596d9){if(_0x3596d9['hasOwnProperty'](_0x4c647d)){_0x3596d9[_0x4c647d]=this[_0x6205('0x1f')](_0x3596d9[_0x4c647d],_0x9abdaa);}}return _0x3596d9;};exports[_0x6205('0x24')]=function(_0x4fbc1e){return _0x4fbc1e[_0x6205('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x6205('0x26')]=function(_0xd9f8b5){return _0xd9f8b5[_0x6205('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x6205('0x27')]=function(_0x36ce52,_0x20f3cb){var _0x158b3e=[];var _0x156e80=/[ `!@#$%^&*()_\-?~]/;var _0x3f119b=_0x20f3cb?'\x22{EXPR}\x22':_0x6205('0x28');_0x36ce52[_0x6205('0x8')](/[ ,]+/)[_0x6205('0x29')](function(_0x538d55){_0x538d55=_0x538d55['replace'](/([^:]")"+/g,'$1');_0x538d55='+'+_0x538d55+'*';var _0x472d15=_0x538d55['match'](_0x156e80);if(_0x472d15){_0x538d55='\x22'+_0x538d55+'\x22';}_0x158b3e['push'](_0x538d55);});_0x3f119b=_0x3f119b[_0x6205('0x2a')](_0x6205('0x28'),_0x158b3e[_0x6205('0x2b')]('\x20'));return _0x3f119b;};exports[_0x6205('0x2c')]=function(_0x49e6d2,_0x446f91,_0x332597){var _0x58d1c9={},_0x31cacc={};if(_0x446f91[_0x6205('0x2d')][_0x6205('0x2e')]){_0x446f91[_0x6205('0x2d')]['id']=_0x446f91['query']['$id'];delete _0x446f91['query'][_0x6205('0x2e')];}_0x58d1c9[_0x6205('0x5')]=_[_0x6205('0x16')](_0x49e6d2,_0x6205('0x12'));_0x58d1c9[_0x6205('0x2d')]=_[_0x6205('0x3')](_0x446f91[_0x6205('0x2d')]);_0x58d1c9[_0x6205('0x9')]=_[_0x6205('0x2f')](_0x58d1c9[_0x6205('0x5')],_0x58d1c9[_0x6205('0x2d')]);_0x31cacc[_0x6205('0x30')]=_[_0x6205('0x2f')](_0x58d1c9['model'],this[_0x6205('0x7')](_0x446f91[_0x6205('0x2d')][_0x6205('0x7')]));_0x31cacc['attributes']=_0x31cacc[_0x6205('0x30')]['length']?_0x31cacc[_0x6205('0x30')]:_0x58d1c9[_0x6205('0x5')];if(!_0x446f91[_0x6205('0x2d')][_0x6205('0x31')](_0x6205('0x32'))){_0x31cacc[_0x6205('0x33')]=this[_0x6205('0x33')](_0x446f91[_0x6205('0x2d')][_0x6205('0x33')]);_0x31cacc['offset']=this[_0x6205('0x15')](_0x446f91[_0x6205('0x2d')][_0x6205('0x15')]);}_0x31cacc[_0x6205('0x34')]=this[_0x6205('0x35')](_0x446f91[_0x6205('0x2d')][_0x6205('0x35')]);_0x31cacc[_0x6205('0x36')]=this[_0x6205('0x9')](_['pick'](_0x446f91[_0x6205('0x2d')],_0x58d1c9[_0x6205('0x9')]),_0x49e6d2);if(_0x446f91[_0x6205('0x2d')][_0x6205('0x37')]){var _0x3c16b8=_0x49e6d2;var _0x15de48=_0x446f91[_0x6205('0x2d')][_0x6205('0x37')];if(typeof _0x15de48===_0x6205('0x38')){_0x3c16b8=_['filter'](_0x49e6d2,function(_0x4ef4c7){return _[_0x6205('0x4')](_0x15de48[_0x6205('0x39')],_0x4ef4c7['name']);});_0x15de48=_0x15de48[_0x6205('0x3a')];}_0x31cacc[_0x6205('0x36')]=_[_0x6205('0x3b')](_0x31cacc['where'],{'$or':_['map'](_0x3c16b8,function(_0x570137){if(_0x570137[_0x6205('0xc')]!==_0x6205('0x3c')){if(_0x332597){return sequelize[_0x6205('0x36')](sequelize['fn'](_0x6205('0x3d'),sequelize['col'](_0x570137[_0x6205('0x12')])),{'$like':sequelize['fn'](_0x6205('0x3d'),'%'+_0x446f91['query'][_0x6205('0x37')]+'%')});}else{var _0x90e0ea={};_0x90e0ea[_0x570137[_0x6205('0x12')]]={'$like':'%'+_0x446f91[_0x6205('0x2d')]['filter']+'%'};return _0x90e0ea;}}})});}_0x31cacc=_[_0x6205('0x3b')]({},_0x31cacc,_0x446f91[_0x6205('0x3e')]);return _0x31cacc;};exports[_0x6205('0x3f')]=function(_0x1ce4ea){var _0x21168b=[];if(_0x1ce4ea[_0x6205('0x40')]){_0x21168b[_0x6205('0x41')]({'all':!![]});}else if(_0x1ce4ea[_0x6205('0x3f')]){if(Array[_0x6205('0x14')](_0x1ce4ea['include'])){_0x21168b=Object[_0x6205('0x3')](_0x1ce4ea[_0x6205('0x3f')])[_0x6205('0x16')](function(_0x1265e7){return parseIncludeModel(_0x1ce4ea[_0x6205('0x3f')][_0x1265e7]);});}else{var _0x3d523e=parseIncludeModel(_0x1ce4ea[_0x6205('0x3f')]);_0x21168b[_0x6205('0x41')](_0x3d523e);}}return _0x21168b;}; \ No newline at end of file +var _0x7617=['length','isObject','unset','hasOwnProperty','isNumeric','match','\x22{EXPR}\x22','{EXPR}','push','join','$id','query','intersection','attributes','nolimit','order','where','pick','filter','object','columns','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','../../mysqldb','keys','includes','parse','model','alias','raw','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','format','name','uniqueid','isArray','split','limit','offset','sort','map','priority','cast','unsigned','substr','DESC','col','omit'];(function(_0x2c57d8,_0x16654e){var _0x14d58e=function(_0x5dde61){while(--_0x5dde61){_0x2c57d8['push'](_0x2c57d8['shift']());}};_0x14d58e(++_0x16654e);}(_0x7617,0x1cd));var _0x7761=function(_0x4c03ea,_0x5b6ca8){_0x4c03ea=_0x4c03ea-0x0;var _0x511076=_0x7617[_0x4c03ea];return _0x511076;};'use strict';var _=require(_0x7761('0x0'));var sequelize=require(_0x7761('0x1'));var moment=require('moment');var db=require(_0x7761('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x496b2e){var _0x3e0ce8=['ne'];try{var _0x5562d4=JSON['parse'](_0x496b2e);var _0x5f013f=Object[_0x7761('0x3')](_0x5562d4)[0x0];return _0x3e0ce8[_0x7761('0x4')](_0x5f013f);}catch(_0x3b813e){return![];}}function getOperatorValue(_0xd3d23b){var _0xf4855=JSON[_0x7761('0x5')](_0xd3d23b);var _0x58597a=Object['keys'](_0xf4855)[0x0];var _0x1e95a6=_0xf4855[_0x58597a];return{['$'+_0x58597a]:_0x1e95a6};}function parseIncludeModel(_0x1192f4){var _0x204330=JSON[_0x7761('0x5')](_0x1192f4);return{'model':db[_0x204330[_0x7761('0x6')]],'as':_0x204330[_0x7761('0x7')],'attributes':_0x204330['fields'],'raw':_0x204330[_0x7761('0x8')]};}exports[_0x7761('0x9')]=function(_0x43b7a8){var _0x12a55d=null;if(_0x43b7a8){_0x12a55d=_0x43b7a8['split'](',');}return _0x12a55d;};exports[_0x7761('0xa')]=function(_0x1eeb18,_0xdf7d8){var _0x33ff41={};if(!_[_0x7761('0xb')](_0x1eeb18)){_[_0x7761('0xc')](_0x1eeb18,function(_0x546734,_0x1624f7){try{if(_0xdf7d8){var _0x1938e7=_[_0x7761('0xd')](_0xdf7d8,{'name':_0x1624f7})||{};if(hasSequelizeOperator(_0x546734)){_0x33ff41[_0x1624f7]=getOperatorValue(_0x546734);}else if(_0x1938e7[_0x7761('0xe')]===_0x7761('0xf')&&_[_0x7761('0x10')](_0x546734)){var _0x292f1b=JSON['parse'](_0x546734);var _0x265e6c={'$gte':moment(moment(_0x292f1b[_0x7761('0x11')])['format'](_0x7761('0x12')))['utc']()[_0x7761('0x13')](),'$lte':moment(moment(_0x292f1b['$lte'])[_0x7761('0x13')](_0x7761('0x12')))['utc']()['subtract'](0x1,'s')[_0x7761('0x13')]()};_0x33ff41[_0x1624f7]=_0x265e6c;}else if(_0x1938e7[_0x7761('0x14')]===_0x7761('0x15')){_0x33ff41[_0x1624f7]=_0x546734;}else{_0x33ff41[_0x1624f7]=_[_0x7761('0x16')](_0x546734)?_0x546734:JSON['parse'](_0x546734);}}else{_0x33ff41[_0x1624f7]=_[_0x7761('0x16')](_0x546734)?_0x546734:JSON[_0x7761('0x5')](_0x546734);}}catch(_0xc68bf8){_0x33ff41[_0x1624f7]=_0x546734[_0x7761('0x17')](',');}});}return _0x33ff41;};exports[_0x7761('0x18')]=function(_0x21a1c0){_0x21a1c0=parseInt(_0x21a1c0,0xa);if(!_0x21a1c0||_0x21a1c0<0x0){_0x21a1c0=LIMIT_VALUE;}return _0x21a1c0;};exports[_0x7761('0x19')]=function(_0x3d26c8){_0x3d26c8=parseInt(_0x3d26c8,0xa);if(!_0x3d26c8||_0x3d26c8<0x0){_0x3d26c8=0x0;}return _0x3d26c8;};exports[_0x7761('0x1a')]=function(_0x5c3e8a){var _0x2cc05b,_0x482ecf=null;if(_0x5c3e8a){_0x2cc05b=_0x5c3e8a[_0x7761('0x17')](',');_0x482ecf=_[_0x7761('0x1b')](_0x2cc05b,function(_0x1b7732){if(_0x1b7732['indexOf']('-')===0x0){return[_0x1b7732===_0x7761('0x1c')?sequelize[_0x7761('0x1d')](sequelize['col'](_0x7761('0x1c')),_0x7761('0x1e')):_0x1b7732[_0x7761('0x1f')](0x1),_0x7761('0x20')];}else{return[_0x1b7732===_0x7761('0x1c')?sequelize[_0x7761('0x1d')](sequelize[_0x7761('0x21')](_0x7761('0x1c')),_0x7761('0x1e')):_0x1b7732,'ASC'];}});}return _0x482ecf;};exports[_0x7761('0x22')]=function(_0x34676e,_0x42b3fe){if(_[_0x7761('0xb')](_0x34676e)){return _0x34676e;}if(_['isArray'](_0x34676e)){for(var _0x48f059=0x0;_0x48f059<_0x34676e[_0x7761('0x23')];_0x48f059+=0x1){_0x34676e[_0x48f059]=this[_0x7761('0x22')](_0x34676e[_0x48f059],_0x42b3fe);}return _0x34676e;}if(!_[_0x7761('0x24')](_0x34676e)){return _0x34676e;}if(_['isString'](_0x42b3fe)){_0x42b3fe=[_0x42b3fe];}if(!_[_0x7761('0x16')](_0x42b3fe)){return _0x34676e;}for(var _0x423487=0x0;_0x423487<_0x42b3fe[_0x7761('0x23')];_0x423487+=0x1){_[_0x7761('0x25')](_0x34676e,_0x42b3fe[_0x423487]);}for(var _0x4be900 in _0x34676e){if(_0x34676e[_0x7761('0x26')](_0x4be900)){_0x34676e[_0x4be900]=this[_0x7761('0x22')](_0x34676e[_0x4be900],_0x42b3fe);}}return _0x34676e;};exports[_0x7761('0x27')]=function(_0x2f86fc){return _0x2f86fc['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x2d3471){return _0x2d3471[_0x7761('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x249f7d,_0x185bb4){var _0x404fba=[];var _0x58ad52=/[ `!@#$%^&*()_\-?~]/;var _0x4b1066=_0x185bb4?_0x7761('0x29'):_0x7761('0x2a');_0x249f7d[_0x7761('0x17')](/[ ,]+/)['forEach'](function(_0xe95751){_0xe95751=_0xe95751['replace'](/([^:]")"+/g,'$1');_0xe95751='+'+_0xe95751+'*';var _0x18d076=_0xe95751[_0x7761('0x28')](_0x58ad52);if(_0x18d076){_0xe95751='\x22'+_0xe95751+'\x22';}_0x404fba[_0x7761('0x2b')](_0xe95751);});_0x4b1066=_0x4b1066['replace'](_0x7761('0x2a'),_0x404fba[_0x7761('0x2c')]('\x20'));return _0x4b1066;};exports['getOptions']=function(_0x547f33,_0x16fb24,_0x54b605){var _0x1f821b={},_0x4d738e={};if(_0x16fb24['query'][_0x7761('0x2d')]){_0x16fb24['query']['id']=_0x16fb24[_0x7761('0x2e')][_0x7761('0x2d')];delete _0x16fb24[_0x7761('0x2e')][_0x7761('0x2d')];}_0x1f821b['model']=_[_0x7761('0x1b')](_0x547f33,_0x7761('0x14'));_0x1f821b[_0x7761('0x2e')]=_['keys'](_0x16fb24[_0x7761('0x2e')]);_0x1f821b[_0x7761('0xa')]=_[_0x7761('0x2f')](_0x1f821b['model'],_0x1f821b[_0x7761('0x2e')]);_0x4d738e[_0x7761('0x30')]=_[_0x7761('0x2f')](_0x1f821b[_0x7761('0x6')],this['fields'](_0x16fb24[_0x7761('0x2e')][_0x7761('0x9')]));_0x4d738e[_0x7761('0x30')]=_0x4d738e[_0x7761('0x30')]['length']?_0x4d738e['attributes']:_0x1f821b[_0x7761('0x6')];if(!_0x16fb24[_0x7761('0x2e')][_0x7761('0x26')](_0x7761('0x31'))){_0x4d738e[_0x7761('0x18')]=this[_0x7761('0x18')](_0x16fb24['query'][_0x7761('0x18')]);_0x4d738e['offset']=this[_0x7761('0x19')](_0x16fb24[_0x7761('0x2e')][_0x7761('0x19')]);}_0x4d738e[_0x7761('0x32')]=this[_0x7761('0x1a')](_0x16fb24[_0x7761('0x2e')]['sort']);_0x4d738e[_0x7761('0x33')]=this[_0x7761('0xa')](_[_0x7761('0x34')](_0x16fb24[_0x7761('0x2e')],_0x1f821b[_0x7761('0xa')]),_0x547f33);if(_0x16fb24[_0x7761('0x2e')]['filter']){var _0x422316=_0x547f33;var _0x275833=_0x16fb24[_0x7761('0x2e')][_0x7761('0x35')];if(typeof _0x275833===_0x7761('0x36')){_0x422316=_['filter'](_0x547f33,function(_0xc11441){return _[_0x7761('0x4')](_0x275833[_0x7761('0x37')],_0xc11441['name']);});_0x275833=_0x275833['value'];}_0x4d738e['where']=_[_0x7761('0x38')](_0x4d738e['where'],{'$or':_[_0x7761('0x1b')](_0x422316,function(_0xcc1641){if(_0xcc1641[_0x7761('0xe')]!==_0x7761('0x39')){if(_0x54b605){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x7761('0x21')](_0xcc1641[_0x7761('0x14')])),{'$like':sequelize['fn'](_0x7761('0x3a'),'%'+_0x16fb24[_0x7761('0x2e')][_0x7761('0x35')]+'%')});}else{var _0x4c294a={};_0x4c294a[_0xcc1641[_0x7761('0x14')]]={'$like':'%'+_0x16fb24[_0x7761('0x2e')][_0x7761('0x35')]+'%'};return _0x4c294a;}}})});}_0x4d738e=_[_0x7761('0x38')]({},_0x4d738e,_0x16fb24[_0x7761('0x3b')]);return _0x4d738e;};exports[_0x7761('0x3c')]=function(_0x53f9be){var _0x3c55be=[];if(_0x53f9be[_0x7761('0x3d')]){_0x3c55be[_0x7761('0x2b')]({'all':!![]});}else if(_0x53f9be[_0x7761('0x3c')]){if(Array[_0x7761('0x16')](_0x53f9be['include'])){_0x3c55be=Object[_0x7761('0x3')](_0x53f9be[_0x7761('0x3c')])[_0x7761('0x1b')](function(_0x106494){return parseIncludeModel(_0x53f9be[_0x7761('0x3c')][_0x106494]);});}else{var _0x5a580d=parseIncludeModel(_0x53f9be[_0x7761('0x3c')]);_0x3c55be['push'](_0x5a580d);}}return _0x3c55be;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index f76f062..2f1b1b6 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 _0x26d8=['sort','toLowerCase','sortAgentsByStatus','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByStatus','includes','User','findAll','pauseType','find','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','fullname','internal'];(function(_0x4cd31e,_0x186fd0){var _0x18fd4d=function(_0xf483c8){while(--_0xf483c8){_0x4cd31e['push'](_0x4cd31e['shift']());}};_0x18fd4d(++_0x186fd0);}(_0x26d8,0x194));var _0x826d=function(_0x4db764,_0x3d2900){_0x4db764=_0x4db764-0x0;var _0x11eca4=_0x26d8[_0x4db764];return _0x11eca4;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x826d('0x0'))['db'];var amiClient=jayson[_0x826d('0x1')][_0x826d('0x2')]({'port':0x232a});var routingClient=jayson[_0x826d('0x1')][_0x826d('0x2')]({'port':0x232c});function isAgentPaused(_0x593c89,_0x3728f4){var _0x3bd357=[_0x593c89[_0x826d('0x3')],_0x593c89[_0x826d('0x4')],_0x593c89[_0x826d('0x5')],_0x593c89[_0x826d('0x6')],_0x593c89[_0x826d('0x7')],_0x593c89[_0x826d('0x8')],_0x593c89[_0x826d('0x9')]];if(!_0x3728f4)return _[_0x826d('0xa')](_0x3bd357);var _0x14a54f=_[_0x826d('0xb')](_0x3bd357);return _0x14a54f[_0x826d('0xc')]>0x0&&_0x14a54f['length']<_0x3bd357[_0x826d('0xc')]?!![]:![];}function isIdle(_0x41ebfe){return _0x41ebfe===_0x826d('0xd')||_0x41ebfe===_0x826d('0xe')||_0x41ebfe===_0x826d('0xf')||_0x41ebfe===_0x826d('0x10')||_['isNil'](_0x41ebfe);}function isAgentIdle(_0x3b4f9e){if(_0x3b4f9e['voiceStatus']!==_0x826d('0xd')&&_0x3b4f9e[_0x826d('0x8')]){_0x3b4f9e[_0x826d('0x11')]=_0x826d('0x12');return![];}return _[_0x826d('0xa')]([_0x3b4f9e[_0x826d('0x13')],_0x3b4f9e['faxStatus'],_0x3b4f9e['mailStatus'],_0x3b4f9e[_0x826d('0x14')],_0x3b4f9e[_0x826d('0x15')],_0x3b4f9e[_0x826d('0x11')],_0x3b4f9e[_0x826d('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x826d('0x17')](_0x826d('0x18'),{})[_0x826d('0x19')](function(_0x7664ff){if(_0x7664ff[_0x826d('0x1a')]){throw new Error(_0x826d('0x1b'));}var _0x4c388c=_0x7664ff[_0x826d('0x1c')];return routingClient[_0x826d('0x17')](_0x826d('0x18'),{})[_0x826d('0x19')](function(_0x488765){if(_0x488765['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0xf01dbb=_0x488765[_0x826d('0x1c')];return _[_0x826d('0x1d')]({},_0x4c388c,_0xf01dbb);});})[_0x826d('0x1e')](function(_0x8a197){throw _0x8a197;});}exports[_0x826d('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x4ddbc8){var _0x2d37ed=_0x826d('0xe');if(isAgentPaused(_0x4ddbc8))_0x2d37ed=_0x826d('0x12');else if(isAgentPaused(_0x4ddbc8,!![]))_0x2d37ed=_0x826d('0x20');else if(isAgentIdle(_0x4ddbc8))_0x2d37ed=_0x826d('0xd');else _0x2d37ed=_0x826d('0x21');return _0x2d37ed;}exports[_0x826d('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0xd2da95,_0x574c21){var _0x127e4c=_['isArray'](_0xd2da95)?_0xd2da95:[_0xd2da95];var _0x1831fd=_[_0x826d('0x23')](_0x574c21)+_0x826d('0x24');var _0x573665=_[_0x826d('0x25')](_0x127e4c,function(_0x250dfe){return db[_0x1831fd][_0x826d('0x26')]({'where':{'id':_0x250dfe}})[_0x826d('0x19')](function(_0x401af2){if(!_0x401af2)return[];return _0x401af2[_0x826d('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x826d('0x28')](_0x573665)['then'](function(_0x3af14b){var _0x55cc57=_(_0x3af14b)[_0x826d('0x29')]()['map']('id')[_0x826d('0x2a')]()[_0x826d('0x2b')]();return _0x55cc57;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x39478b,_0x140284,_0x5ab743){try{if(_0x140284['length']>0x0){_0x39478b=_0x39478b[_0x826d('0xb')](function(_0x986969){return _0x140284['includes'](_0x986969['id']);});}var _0x361210=_0x39478b[_0x826d('0xb')](function(_0x29c663){var _0x28d2c9=_0x826d('0x21');if(isAgentIdle(_0x29c663)){_0x28d2c9=_0x826d('0xd');}return _0x28d2c9===_0x5ab743;});return _[_0x826d('0x25')](_0x361210,'id');}catch(_0x19841b){throw _0x19841b;}}exports[_0x826d('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1040a1,_0x5002be,_0x4128ed){return Promise['resolve']()[_0x826d('0x19')](function(){if(_0x5002be[_0x826d('0xc')]>0x0){_0x1040a1=_0x1040a1[_0x826d('0xb')](function(_0x4afae5){return _0x5002be[_0x826d('0x2d')](_0x4afae5['id']);});}return _0x1040a1;})[_0x826d('0x19')](function(){return db[_0x826d('0x2e')][_0x826d('0x2f')]({'attributes':['id','name','fullname',_0x826d('0x3'),_0x826d('0x4'),_0x826d('0x5'),_0x826d('0x6'),_0x826d('0x7'),'voicePause',_0x826d('0x9'),_0x826d('0x30')],'where':{'id':{'$in':_[_0x826d('0x25')](_0x1040a1,'id')}},'raw':!![]});})['then'](function(_0x253fb6){return _0x253fb6['map'](function(_0x46ade7){var _0x21a1dc=_[_0x826d('0x31')](_0x1040a1,['id',_0x46ade7['id']]);var _0x3ea8ce=filterAgentAttributes(_0x21a1dc);_[_0x826d('0x1d')](_0x46ade7,_0x3ea8ce);_0x46ade7['globalStatus']=getAgentStatus(_0x46ade7);return _0x46ade7;});})[_0x826d('0x19')](function(_0x599f01){var _0x2acae8=sortAgentsByStatus(_0x599f01,_0x4128ed);return _[_0x826d('0x25')](_0x2acae8,'id');})[_0x826d('0x1e')](function(_0x24dddc){throw _0x24dddc;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3c53cf){var _0x195b48={'fields':[],'order':null};var _0x551ddf=_0x3c53cf[_0x826d('0x32')](',');_0x195b48[_0x826d('0x33')]=_[_0x826d('0xb')](_0x551ddf,function(_0x10ba5d){if(!_0x10ba5d['includes'](_0x826d('0x34'))){return!![];}_0x195b48[_0x826d('0x35')]=_[_0x826d('0x36')](_0x10ba5d,'-')?_0x826d('0x37'):_0x826d('0x38');return![];});return _0x195b48;}exports[_0x826d('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x4641db){if(!_0x4641db){_0x4641db=_0x826d('0x3a');}if(_0x4641db[_0x826d('0x2d')](_0x826d('0x3b'))&&!_0x4641db[_0x826d('0x2d')](_0x826d('0x3c'))){var _0x10731f=_0x4641db['substring'](0x0,_0x4641db['indexOf'](_0x826d('0x3b')));_0x4641db+=','+_0x10731f+'internal';}return _0x4641db;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x4def04,_0xbf5a33){var _0x4e91f3=_0x4def04[_0x826d('0x3d')](function(_0x445185,_0x9644f9){if(_0x445185[_0x826d('0x34')]===_0x9644f9[_0x826d('0x34')]){if(_0x445185[_0x826d('0x34')]===_0x826d('0x12')){if(_0xbf5a33===_0x826d('0x37')){return(_0x445185['pauseType']||'')<(_0x9644f9[_0x826d('0x30')]||'')||_0x445185[_0x826d('0x3b')]['toLowerCase']()>_0x9644f9['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x445185[_0x826d('0x30')]||'')<(_0x9644f9['pauseType']||'')||_0x445185[_0x826d('0x3b')][_0x826d('0x3e')]()>_0x9644f9[_0x826d('0x3b')][_0x826d('0x3e')]()?-0x1:0x1;}}else{if(_0xbf5a33==='DESC'){return _0x445185[_0x826d('0x3b')]['toLowerCase']()<_0x9644f9[_0x826d('0x3b')]['toLowerCase']()?0x1:-0x1;}else{return _0x445185['fullname'][_0x826d('0x3e')]()<_0x9644f9[_0x826d('0x3b')][_0x826d('0x3e')]()?-0x1:0x1;}}}else{if(_0xbf5a33===_0x826d('0x37')){return _0x445185['globalStatus']<_0x9644f9[_0x826d('0x34')]?0x1:-0x1;}else{return _0x445185[_0x826d('0x34')]<_0x9644f9[_0x826d('0x34')]?-0x1:0x1;}}});return _0x4e91f3;}exports[_0x826d('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x4fa4ff){var _0x15ea4d=['userpic',_0x826d('0x40'),'lastLoginAt',_0x826d('0x41'),_0x826d('0x30'),'lastPauseAt',_0x826d('0x3c'),_0x826d('0x42'),_0x826d('0x3'),_0x826d('0x6'),'mailPause',_0x826d('0x7'),_0x826d('0x9'),_0x826d('0x4'),'voicePause',_0x826d('0x43'),_0x826d('0x44'),_0x826d('0x45'),_0x826d('0x46'),_0x826d('0x47'),_0x826d('0x48'),_0x826d('0x49'),_0x826d('0x4a'),_0x826d('0x4b'),'smsCurrentCapacity',_0x826d('0x4c'),'faxCurrentCapacity','chatStatus',_0x826d('0x14'),_0x826d('0x4d'),'smsStatus',_0x826d('0x16'),_0x826d('0x4e'),_0x826d('0x11'),_0x826d('0x4f'),_0x826d('0x50'),'mailStatusTime',_0x826d('0x51'),_0x826d('0x52'),_0x826d('0x53'),_0x826d('0x54'),_0x826d('0x55'),_0x826d('0x56'),'screenrecording',_0x826d('0x57'),_0x826d('0x58'),_0x826d('0x59')];var _0x2377e4=[_0x826d('0x3'),_0x826d('0x6'),_0x826d('0x5'),'smsPause','whatsappPause','faxPause',_0x826d('0x8'),_0x826d('0x40')];var _0x41155f=_(_0x4fa4ff)[_0x826d('0x5a')](_0x2377e4)[_0x826d('0x5b')](_0x15ea4d)['value']();return _0x41155f;}exports[_0x826d('0x5c')]=filterAgentAttributes; \ No newline at end of file +var _0x991d=['fullname,internal','internal','indexOf','validateSortParameter','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','filterAgentAttributes','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByStatus','resolve','includes','findAll','name','fullname','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions'];(function(_0x4ebadb,_0xc1e9de){var _0x5aa021=function(_0x10ade1){while(--_0x10ade1){_0x4ebadb['push'](_0x4ebadb['shift']());}};_0x5aa021(++_0xc1e9de);}(_0x991d,0x1ec));var _0xd991=function(_0x55f9c0,_0x4f353e){_0x55f9c0=_0x55f9c0-0x0;var _0x591678=_0x991d[_0x55f9c0];return _0x591678;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0xd991('0x0'))['db'];var amiClient=jayson[_0xd991('0x1')][_0xd991('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xd991('0x2')]({'port':0x232c});function isAgentPaused(_0x4bf370,_0x13be5c){var _0x1447d3=[_0x4bf370[_0xd991('0x3')],_0x4bf370[_0xd991('0x4')],_0x4bf370[_0xd991('0x5')],_0x4bf370[_0xd991('0x6')],_0x4bf370[_0xd991('0x7')],_0x4bf370[_0xd991('0x8')],_0x4bf370[_0xd991('0x9')]];if(!_0x13be5c)return _[_0xd991('0xa')](_0x1447d3);var _0x4f7958=_[_0xd991('0xb')](_0x1447d3);return _0x4f7958[_0xd991('0xc')]>0x0&&_0x4f7958[_0xd991('0xc')]<_0x1447d3[_0xd991('0xc')]?!![]:![];}function isIdle(_0x30b5eb){return _0x30b5eb===_0xd991('0xd')||_0x30b5eb===_0xd991('0xe')||_0x30b5eb===_0xd991('0xf')||_0x30b5eb===_0xd991('0x10')||_['isNil'](_0x30b5eb);}function isAgentIdle(_0x2b8b55){if(_0x2b8b55['voiceStatus']!==_0xd991('0xd')&&_0x2b8b55[_0xd991('0x8')]){_0x2b8b55[_0xd991('0x11')]='pause';return![];}return _[_0xd991('0xa')]([_0x2b8b55[_0xd991('0x12')],_0x2b8b55[_0xd991('0x13')],_0x2b8b55[_0xd991('0x14')],_0x2b8b55['openchannelStatus'],_0x2b8b55[_0xd991('0x15')],_0x2b8b55[_0xd991('0x11')],_0x2b8b55['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xd991('0x16')](_0xd991('0x17'),{})[_0xd991('0x18')](function(_0x43b65b){if(_0x43b65b[_0xd991('0x19')]){throw new Error(_0xd991('0x1a'));}var _0x49128d=_0x43b65b[_0xd991('0x1b')];return routingClient[_0xd991('0x16')]('Agents',{})[_0xd991('0x18')](function(_0x267557){if(_0x267557[_0xd991('0x19')]){throw new Error(_0xd991('0x1c'));}var _0xed83de=_0x267557['result'];return _['merge']({},_0x49128d,_0xed83de);});})[_0xd991('0x1d')](function(_0x24288b){throw _0x24288b;});}exports[_0xd991('0x1e')]=getRealtimeAgents;function getAgentStatus(_0xff4f7){var _0x3c4ee7=_0xd991('0xe');if(isAgentPaused(_0xff4f7))_0x3c4ee7=_0xd991('0x1f');else if(isAgentPaused(_0xff4f7,!![]))_0x3c4ee7=_0xd991('0x20');else if(isAgentIdle(_0xff4f7))_0x3c4ee7=_0xd991('0xd');else _0x3c4ee7=_0xd991('0x21');return _0x3c4ee7;}exports[_0xd991('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x5ec758,_0x557098){var _0x258538=_[_0xd991('0x23')](_0x5ec758)?_0x5ec758:[_0x5ec758];var _0x841ed7=_['startCase'](_0x557098)+_0xd991('0x24');var _0x338c87=_[_0xd991('0x25')](_0x258538,function(_0x44500a){return db[_0x841ed7][_0xd991('0x26')]({'where':{'id':_0x44500a}})[_0xd991('0x18')](function(_0x2818b6){if(!_0x2818b6)return[];return _0x2818b6[_0xd991('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x338c87)[_0xd991('0x18')](function(_0x2f2d4e){var _0x13b812=_(_0x2f2d4e)[_0xd991('0x28')]()[_0xd991('0x25')]('id')[_0xd991('0x29')]()[_0xd991('0x2a')]();return _0x13b812;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x36efab,_0x233d0a,_0x3020ca){try{if(_0x233d0a[_0xd991('0xc')]>0x0){_0x36efab=_0x36efab[_0xd991('0xb')](function(_0x3f5431){return _0x233d0a['includes'](_0x3f5431['id']);});}var _0x47a8bf=_0x36efab['filter'](function(_0x555460){var _0x57fece=_0xd991('0x21');if(isAgentIdle(_0x555460)){_0x57fece=_0xd991('0xd');}return _0x57fece===_0x3020ca;});return _[_0xd991('0x25')](_0x47a8bf,'id');}catch(_0x430d0b){throw _0x430d0b;}}exports[_0xd991('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x387d0a,_0x1514a,_0xb2666e){return Promise[_0xd991('0x2c')]()[_0xd991('0x18')](function(){if(_0x1514a[_0xd991('0xc')]>0x0){_0x387d0a=_0x387d0a[_0xd991('0xb')](function(_0x5e21ab){return _0x1514a[_0xd991('0x2d')](_0x5e21ab['id']);});}return _0x387d0a;})['then'](function(){return db['User'][_0xd991('0x2e')]({'attributes':['id',_0xd991('0x2f'),_0xd991('0x30'),'chatPause',_0xd991('0x4'),_0xd991('0x5'),_0xd991('0x6'),'smsPause',_0xd991('0x8'),'whatsappPause','pauseType'],'where':{'id':{'$in':_['map'](_0x387d0a,'id')}},'raw':!![]});})['then'](function(_0x24c60a){return _0x24c60a[_0xd991('0x25')](function(_0x248fb3){var _0x5e5dfd=_[_0xd991('0x31')](_0x387d0a,['id',_0x248fb3['id']]);var _0xecf3e7=filterAgentAttributes(_0x5e5dfd);_[_0xd991('0x32')](_0x248fb3,_0xecf3e7);_0x248fb3[_0xd991('0x33')]=getAgentStatus(_0x248fb3);return _0x248fb3;});})[_0xd991('0x18')](function(_0x5b34cc){var _0x11e716=sortAgentsByStatus(_0x5b34cc,_0xb2666e);return _[_0xd991('0x25')](_0x11e716,'id');})[_0xd991('0x1d')](function(_0x4571ae){throw _0x4571ae;});}exports[_0xd991('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x14255f){var _0x1d3e6f={'fields':[],'order':null};var _0x369770=_0x14255f[_0xd991('0x35')](',');_0x1d3e6f[_0xd991('0x36')]=_['filter'](_0x369770,function(_0x4ce3c7){if(!_0x4ce3c7[_0xd991('0x2d')](_0xd991('0x33'))){return!![];}_0x1d3e6f[_0xd991('0x37')]=_[_0xd991('0x38')](_0x4ce3c7,'-')?_0xd991('0x39'):_0xd991('0x3a');return![];});return _0x1d3e6f;}exports[_0xd991('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x18dff6){if(!_0x18dff6){_0x18dff6=_0xd991('0x3c');}if(_0x18dff6[_0xd991('0x2d')](_0xd991('0x30'))&&!_0x18dff6[_0xd991('0x2d')](_0xd991('0x3d'))){var _0x354779=_0x18dff6['substring'](0x0,_0x18dff6[_0xd991('0x3e')](_0xd991('0x30')));_0x18dff6+=','+_0x354779+'internal';}return _0x18dff6;}exports[_0xd991('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x31cff3,_0x5b7510){var _0x1cb7b3=_0x31cff3['sort'](function(_0x474c9d,_0x2ba9e7){if(_0x474c9d[_0xd991('0x33')]===_0x2ba9e7[_0xd991('0x33')]){if(_0x474c9d[_0xd991('0x33')]===_0xd991('0x1f')){if(_0x5b7510===_0xd991('0x39')){return(_0x474c9d[_0xd991('0x40')]||'')<(_0x2ba9e7['pauseType']||'')||_0x474c9d[_0xd991('0x30')][_0xd991('0x41')]()>_0x2ba9e7[_0xd991('0x30')]['toLowerCase']()?0x1:-0x1;}else{return(_0x474c9d[_0xd991('0x40')]||'')<(_0x2ba9e7[_0xd991('0x40')]||'')||_0x474c9d[_0xd991('0x30')][_0xd991('0x41')]()>_0x2ba9e7[_0xd991('0x30')][_0xd991('0x41')]()?-0x1:0x1;}}else{if(_0x5b7510===_0xd991('0x39')){return _0x474c9d[_0xd991('0x30')]['toLowerCase']()<_0x2ba9e7['fullname'][_0xd991('0x41')]()?0x1:-0x1;}else{return _0x474c9d['fullname'][_0xd991('0x41')]()<_0x2ba9e7[_0xd991('0x30')][_0xd991('0x41')]()?-0x1:0x1;}}}else{if(_0x5b7510===_0xd991('0x39')){return _0x474c9d[_0xd991('0x33')]<_0x2ba9e7[_0xd991('0x33')]?0x1:-0x1;}else{return _0x474c9d[_0xd991('0x33')]<_0x2ba9e7[_0xd991('0x33')]?-0x1:0x1;}}});return _0x1cb7b3;}exports[_0xd991('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x9653ab){var _0x3bc0de=[_0xd991('0x43'),_0xd991('0x44'),'lastLoginAt',_0xd991('0x45'),_0xd991('0x40'),_0xd991('0x45'),_0xd991('0x3d'),'address',_0xd991('0x3'),'openchannelPause',_0xd991('0x5'),_0xd991('0x7'),_0xd991('0x9'),_0xd991('0x4'),'voicePause','chatCapacity','openchannelCapacity',_0xd991('0x46'),_0xd991('0x47'),_0xd991('0x48'),_0xd991('0x49'),_0xd991('0x4a'),_0xd991('0x4b'),_0xd991('0x4c'),_0xd991('0x4d'),_0xd991('0x4e'),_0xd991('0x4f'),_0xd991('0x12'),_0xd991('0x50'),'mailStatus','smsStatus',_0xd991('0x51'),_0xd991('0x13'),_0xd991('0x11'),'chatStatusTime',_0xd991('0x52'),_0xd991('0x53'),_0xd991('0x54'),'whatsappStatusTime','faxStatusTime',_0xd991('0x55'),_0xd991('0x56'),_0xd991('0x57'),_0xd991('0x58'),_0xd991('0x59'),'phoneBarEnableAutomaticScreenRecording','routealias'];var _0xa7b79c=[_0xd991('0x3'),_0xd991('0x6'),'mailPause','smsPause','whatsappPause',_0xd991('0x4'),'voicePause',_0xd991('0x44')];var _0x55f943=_(_0x9653ab)[_0xd991('0x5a')](_0xa7b79c)['pick'](_0x3bc0de)[_0xd991('0x2a')]();return _0x55f943;}exports[_0xd991('0x5b')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 1a1f61f..77adee9 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 _0x1aa6=['ringing','ringInUse','talking','unavailable','pTalking','message','dialActive','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','concat','outbound','map','get','originated','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold'];(function(_0x5365ad,_0x41ec9b){var _0x365519=function(_0x5f0cd2){while(--_0x5f0cd2){_0x5365ad['push'](_0x5365ad['shift']());}};_0x365519(++_0x41ec9b);}(_0x1aa6,0x1f0));var _0x61aa=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x1aa6[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0x61aa('0x0'));var jayson=require(_0x61aa('0x1'));var util=require(_0x61aa('0x2'));var amiClient=jayson[_0x61aa('0x3')][_0x61aa('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x61aa('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x61aa('0x5'),'loggedIn',_0x61aa('0x6'),_0x61aa('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x61aa('0x8'),_0x61aa('0x9'),_0x61aa('0xa'),_0x61aa('0xb'),_0x61aa('0xc'),_0x61aa('0xd'),_0x61aa('0xe'),_0x61aa('0xf'),_0x61aa('0x10'),_0x61aa('0x11'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x61aa('0x12'),'originated',_0x61aa('0x13'),'statusMessage',_0x61aa('0x14'),_0x61aa('0x15'),_0x61aa('0x16'),'startPredictive','startProgressive',_0x61aa('0x17'),_0x61aa('0x18'),_0x61aa('0x19'),'erlangBusyFactor',_0x61aa('0x1a'),_0x61aa('0x1b'),'dialPredictiveIntervalMinThreshold',_0x61aa('0x1c'),_0x61aa('0x1d'),_0x61aa('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x61aa('0x1f'),_0x61aa('0x20'),_0x61aa('0x21')];function getRealtimeQueues(_0x2659fd,_0x148264){var _0x549784=_0x148264===_0x61aa('0x22')?amiClient:routingClient;return _0x549784[_0x61aa('0x23')](_[_0x61aa('0x24')](_0x148264)+_0x61aa('0x25'),_0x2659fd)['then'](function(_0x356d99){if(_0x356d99[_0x61aa('0x26')])throw new Error(util[_0x61aa('0x27')](_0x61aa('0x28'),_0x148264));return _0x356d99['result'];})[_0x61aa('0x29')](function(_0x455979){throw _0x455979;});}exports[_0x61aa('0x2a')]=getRealtimeQueues;function initializeQueues(_0x30140b,_0x4d81d8,_0x5f0768,_0x2ffaec){var _0x1508d5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5f0768===_0x61aa('0x22')){if(_0x2ffaec==='inbound'){_0x1508d5=_0x1508d5[_0x61aa('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2ffaec===_0x61aa('0x2c')){_0x1508d5=_0x1508d5[_0x61aa('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x30140b[_0x61aa('0x2d')](function(_0x1e259d){var _0x48e77e=_0x1e259d[_0x61aa('0x2e')]({'plain':!![]});_0x48e77e[_0x61aa('0x6')]=0x0;_0x48e77e[_0x61aa('0xb')]=0x0;_0x48e77e['loggedIn']=0x0;_0x48e77e['available']=0x0;_0x48e77e[_0x61aa('0x7')]=0x0;if(_0x5f0768===_0x61aa('0x22')){_0x48e77e[_0x61aa('0x10')]=0x0;_0x48e77e[_0x61aa('0x8')]=0x0;if(_0x2ffaec===_0x61aa('0x2c')){_0x48e77e['pTalking']=0x0;_0x48e77e[_0x61aa('0x2f')]=0x0;}}var _0x277482=_[_0x61aa('0x30')](_0x4d81d8,['id',_0x48e77e['id']]);if(_0x277482){_[_0x61aa('0x31')](_0x48e77e,_['pick'](_0x277482,_0x1508d5));}return _0x48e77e;});}exports[_0x61aa('0x32')]=initializeQueues; \ No newline at end of file +var _0x8479=['unknown','pTalking','message','statusMessage','dialMethod','Trunk','startProgressive','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','voice','request','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','talking','originated','find','merge','pick','initializeQueues','lodash','util','client','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable'];(function(_0x3262b1,_0x4da836){var _0x11c184=function(_0x543116){while(--_0x543116){_0x3262b1['push'](_0x3262b1['shift']());}};_0x11c184(++_0x4da836);}(_0x8479,0x1a0));var _0x9847=function(_0x230e88,_0x4c390b){_0x230e88=_0x230e88-0x0;var _0x2f299f=_0x8479[_0x230e88];return _0x2f299f;};'use strict';var _=require(_0x9847('0x0'));var jayson=require('jayson/promise');var util=require(_0x9847('0x1'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x9847('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9847('0x3'),_0x9847('0x4'),_0x9847('0x5'),_0x9847('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x9847('0x7'),_0x9847('0x8'),_0x9847('0x9'),_0x9847('0xa'),_0x9847('0xb'),_0x9847('0xc'),_0x9847('0xd'),_0x9847('0xe'),'talking',_0x9847('0xf'),_0x9847('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9847('0x11'),'originated',_0x9847('0x12'),_0x9847('0x13'),'dialActive',_0x9847('0x14'),_0x9847('0x15'),'startPredictive',_0x9847('0x16'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x9847('0x17'),'dialPredictiveInterval',_0x9847('0x18'),_0x9847('0x19'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x9847('0x1a'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x9847('0x1b'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3acfa9,_0xed50dc){var _0x461789=_0xed50dc===_0x9847('0x1c')?amiClient:routingClient;return _0x461789[_0x9847('0x1d')](_['startCase'](_0xed50dc)+_0x9847('0x1e'),_0x3acfa9)[_0x9847('0x1f')](function(_0xfcee70){if(_0xfcee70[_0x9847('0x20')])throw new Error(util['format'](_0x9847('0x21'),_0xed50dc));return _0xfcee70[_0x9847('0x22')];})[_0x9847('0x23')](function(_0x5f0ef2){throw _0x5f0ef2;});}exports[_0x9847('0x24')]=getRealtimeQueues;function initializeQueues(_0x37611d,_0x18c5d3,_0x1b4265,_0x37b9ab){var _0x242a8e=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1b4265===_0x9847('0x1c')){if(_0x37b9ab===_0x9847('0x25')){_0x242a8e=_0x242a8e[_0x9847('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x37b9ab===_0x9847('0x27')){_0x242a8e=_0x242a8e['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x37611d[_0x9847('0x28')](function(_0x2b24e6){var _0x30d2c8=_0x2b24e6[_0x9847('0x29')]({'plain':!![]});_0x30d2c8[_0x9847('0x5')]=0x0;_0x30d2c8['loggedInDb']=0x0;_0x30d2c8['loggedIn']=0x0;_0x30d2c8[_0x9847('0x3')]=0x0;_0x30d2c8[_0x9847('0x6')]=0x0;if(_0x1b4265===_0x9847('0x1c')){_0x30d2c8[_0x9847('0x2a')]=0x0;_0x30d2c8['busy']=0x0;if(_0x37b9ab==='outbound'){_0x30d2c8[_0x9847('0x11')]=0x0;_0x30d2c8[_0x9847('0x2b')]=0x0;}}var _0x5939ad=_[_0x9847('0x2c')](_0x18c5d3,['id',_0x30d2c8['id']]);if(_0x5939ad){_[_0x9847('0x2d')](_0x30d2c8,_[_0x9847('0x2e')](_0x5939ad,_0x242a8e));}return _0x30d2c8;});}exports[_0x9847('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index adf91e3..40c8c29 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x223734,_0x15c460){var _0x2705e4=function(_0x623605){while(--_0x623605){_0x223734['push'](_0x223734['shift']());}};_0x2705e4(++_0x15c460);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ae4c3aa..78f71ed 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 _0xed34=['ipAddress','substring','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','test','win32','utf8','hostname'];(function(_0x34326b,_0x126058){var _0x594547=function(_0x563733){while(--_0x563733){_0x34326b['push'](_0x34326b['shift']());}};_0x594547(++_0x126058);}(_0xed34,0x1f2));var _0x4ed3=function(_0x15498,_0x8880e){_0x15498=_0x15498-0x0;var _0x530e85=_0xed34[_0x15498];return _0x530e85;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x4ed3('0x0'));var machine=require(_0x4ed3('0x1'));var exec=require(_0x4ed3('0x2'))['execSync'];var config=require(_0x4ed3('0x3'));function getInterfaces(){var _0x2ce90a=[];var _0x58c8ec=os[_0x4ed3('0x4')]();var _0x25b28d=_[_0x4ed3('0x5')](_[_0x4ed3('0x6')](_0x58c8ec));for(var _0x25af75=0x0;_0x25af75<_0x25b28d[_0x4ed3('0x7')];_0x25af75++){var _0x18b3b0=_0x58c8ec[_0x25b28d[_0x25af75]][_0x4ed3('0x8')](function(_0x20ff48){return _0x20ff48['family']===_0x4ed3('0x9')&&_0x20ff48[_0x4ed3('0xa')]===![];});_0x2ce90a=_0x2ce90a[_0x4ed3('0xb')](_0x18b3b0);}return _0x2ce90a;}function getFirstInterface(){var _0x1476bb=_['head'](getInterfaces());return{'macAddress':_0x1476bb&&_0x1476bb[_0x4ed3('0xc')]?_0x1476bb[_0x4ed3('0xc')]:'00:00:00:00:00:00','ipAddress':_0x1476bb&&_0x1476bb[_0x4ed3('0xd')]?_0x1476bb[_0x4ed3('0xd')]:_0x4ed3('0xe')};}exports[_0x4ed3('0xf')]=getFirstInterface;function getCPUhash(){var _0x506f5f=_[_0x4ed3('0x5')](os[_0x4ed3('0x10')]()[_0x4ed3('0x11')](function(_0x50841c){return _0x50841c[_0x4ed3('0x12')];}))[_0x4ed3('0x13')](':');return crypto[_0x4ed3('0x14')](_0x4ed3('0x15'))[_0x4ed3('0x16')](_0x506f5f)[_0x4ed3('0x17')](_0x4ed3('0x18'));}exports['getUuid']=function(){var _0x7cd487=os['platform']();var _0x493c6a=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x493c6a[_0x4ed3('0x19')](config['licenseToken'])){return config['licenseToken'];}else if(_0x7cd487===_0x4ed3('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4ed3('0x1b')})['replace']('\x0d\x0a','');}else{var _0x80a1ee=getFirstInterface();var _0x4b2f95=getCPUhash();var _0x550bdb=_0x4b2f95+'|'+os[_0x4ed3('0x1c')]()+'|'+_0x80a1ee['macAddress']+'|'+_0x80a1ee[_0x4ed3('0x1d')];var _0x491113=crypto[_0x4ed3('0x14')](_0x4ed3('0x15'))[_0x4ed3('0x16')](_0x550bdb)[_0x4ed3('0x17')]('hex');return _0x491113[_0x4ed3('0x1e')](0x0,0x8)+'-'+_0x491113[_0x4ed3('0x1e')](0x8,0xc)+'-'+_0x491113[_0x4ed3('0x1e')](0xc,0x10)+'-'+_0x491113[_0x4ed3('0x1e')](0x10,0x14)+'-'+_0x491113[_0x4ed3('0x1e')](0x14);}}; \ No newline at end of file +var _0x966b=['getFirstInterface','orderBy','model','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0x966b,0xcd));var _0xb966=function(_0x3d300b,_0xf5472f){_0x3d300b=_0x3d300b-0x0;var _0x593625=_0x966b[_0x3d300b];return _0x593625;};'use strict';var _=require(_0xb966('0x0'));var os=require('os');var crypto=require(_0xb966('0x1'));var machine=require(_0xb966('0x2'));var exec=require(_0xb966('0x3'))[_0xb966('0x4')];var config=require('../environment');function getInterfaces(){var _0x14768f=[];var _0xbc0a15=os[_0xb966('0x5')]();var _0x3baa7b=_['orderBy'](_[_0xb966('0x6')](_0xbc0a15));for(var _0x5ac893=0x0;_0x5ac893<_0x3baa7b[_0xb966('0x7')];_0x5ac893++){var _0x35b799=_0xbc0a15[_0x3baa7b[_0x5ac893]]['filter'](function(_0x17960f){return _0x17960f[_0xb966('0x8')]===_0xb966('0x9')&&_0x17960f[_0xb966('0xa')]===![];});_0x14768f=_0x14768f[_0xb966('0xb')](_0x35b799);}return _0x14768f;}function getFirstInterface(){var _0x364873=_[_0xb966('0xc')](getInterfaces());return{'macAddress':_0x364873&&_0x364873[_0xb966('0xd')]?_0x364873['mac']:_0xb966('0xe'),'ipAddress':_0x364873&&_0x364873['address']?_0x364873[_0xb966('0xf')]:_0xb966('0x10')};}exports[_0xb966('0x11')]=getFirstInterface;function getCPUhash(){var _0x2763af=_[_0xb966('0x12')](os['cpus']()['map'](function(_0x344232){return _0x344232[_0xb966('0x13')];}))[_0xb966('0x14')](':');return crypto[_0xb966('0x15')](_0xb966('0x16'))[_0xb966('0x17')](_0x2763af)[_0xb966('0x18')]('hex');}exports[_0xb966('0x19')]=function(){var _0x9b6d9d=os[_0xb966('0x1a')]();var _0x1c9696=/[0-9a-f-]{36}/;if(config[_0xb966('0x1b')]&&_0x1c9696[_0xb966('0x1c')](config[_0xb966('0x1b')])){return config['licenseToken'];}else if(_0x9b6d9d===_0xb966('0x1d')){return exec(_0xb966('0x1e'),{'encoding':_0xb966('0x1f')})[_0xb966('0x20')]('\x0d\x0a','');}else{var _0x18ba68=getFirstInterface();var _0x3bf50c=getCPUhash();var _0xbb678b=_0x3bf50c+'|'+os[_0xb966('0x21')]()+'|'+_0x18ba68[_0xb966('0x22')]+'|'+_0x18ba68['ipAddress'];var _0xfa342d=crypto[_0xb966('0x15')](_0xb966('0x16'))[_0xb966('0x17')](_0xbb678b)['digest'](_0xb966('0x23'));return _0xfa342d['substring'](0x0,0x8)+'-'+_0xfa342d['substring'](0x8,0xc)+'-'+_0xfa342d['substring'](0xc,0x10)+'-'+_0xfa342d[_0xb966('0x24')](0x10,0x14)+'-'+_0xfa342d[_0xb966('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index aedfbfe..0b5a949 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 _0x58f3=['getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','request-promise','bluebird','pkginfo','version','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','diff','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','finally'];(function(_0x532278,_0x56cd84){var _0x2881c9=function(_0x24e9ea){while(--_0x24e9ea){_0x532278['push'](_0x532278['shift']());}};_0x2881c9(++_0x56cd84);}(_0x58f3,0xf7));var _0x358f=function(_0x2dc059,_0x1db81d){_0x2dc059=_0x2dc059-0x0;var _0x28b419=_0x58f3[_0x2dc059];return _0x28b419;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x358f('0x0'));var BPromise=require(_0x358f('0x1'));var pkginfo=require(_0x358f('0x2'))(module,_0x358f('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x358f('0x4'));var logger=require(_0x358f('0x5'))(_0x358f('0x6'));var HOST=_0x358f('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x30f53f){return new BPromise(function(_0x1f6e6c,_0x6a8d2){var _0xe23d65=util['format'](_0x358f('0x8'),HOST,_0x30f53f,module['exports'][_0x358f('0x3')]);if(oldToken){_0xe23d65=util[_0x358f('0x9')](_0x358f('0xa'),HOST,_0x30f53f,module[_0x358f('0xb')]['version'],oldToken);}var _0x576ea9={'uri':_0xe23d65,'method':_0x358f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x576ea9)[_0x358f('0xd')](function(_0x5c374b){_0x1f6e6c(_0x5c374b);})['catch'](function(_0x37ec15){_0x6a8d2(_0x37ec15);});});}function manageLicense(_0x1cb092,_0x5ed856){var _0x4f89a9=_0x5ed856['get']({'plain':!![]});if(!isOldTokenSent&&_0x4f89a9[_0x358f('0xe')]!==_0x1cb092&&!_0x4f89a9[_0x358f('0xf')]){oldToken=_0x4f89a9[_0x358f('0xe')];}httpRequest(_0x1cb092)['then'](function(_0x2bc181){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2bc181[_0x358f('0x10')]){isOldTokenSent=![];if(!_0x4f89a9['license']&&_0x4f89a9[_0x358f('0x6')]!=_0x2bc181['license']||_0x4f89a9[_0x358f('0x6')]&&_0x4f89a9[_0x358f('0xf')]){logger[_0x358f('0x11')](_0x358f('0x12'));}if(_0x4f89a9[_0x358f('0x6')]&&!_0x4f89a9['data2']&&_0x4f89a9[_0x358f('0x6')]!=_0x2bc181[_0x358f('0x6')]){logger[_0x358f('0x11')](_0x358f('0x13'));}if(_0x4f89a9[_0x358f('0x6')]&&!_0x4f89a9[_0x358f('0xf')]&&_0x4f89a9[_0x358f('0x6')]==_0x2bc181['license']){return _0x5ed856;}return _0x5ed856['update']({'data1':_0x1cb092,'data2':null,'license':_0x2bc181['license']});}else{if(_0x2bc181[_0x358f('0x6')]||_0x4f89a9['license']){if(!_0x4f89a9[_0x358f('0xf')]){if(_0x4f89a9['data1']==_0x1cb092){GRAY_PERIOD_REASON=_0x358f('0x14');logger[_0x358f('0x11')](_0x358f('0x15'));}else{GRAY_PERIOD_REASON=_0x358f('0x16');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4f89a9['data1'],_0x1cb092);}logger[_0x358f('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x358f('0x17')](),moment()[_0x358f('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x5ed856['update']({'data2':encryptor['encryptString'](moment()[_0x358f('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x358f('0x18')](encryptor['decryptString'](_0x4f89a9[_0x358f('0xf')]),_0x358f('0x19'))>DAYS){logger[_0x358f('0x11')](_0x358f('0x1a'),moment()['format'](_0x358f('0x1b')));isOldTokenSent=![];return _0x5ed856[_0x358f('0x1c')]({'data1':_0x1cb092,'data2':null,'license':null});}}}else{if(_0x4f89a9[_0x358f('0xe')]!=_0x1cb092){logger['info'](_0x358f('0x1d'),_0x4f89a9[_0x358f('0xe')],_0x1cb092);return _0x5ed856[_0x358f('0x1c')]({'data1':_0x1cb092,'data2':null,'license':null});}}}return _0x5ed856;})[_0x358f('0xd')](function(_0x1874c1){_0x5ed856=_0x1874c1;})[_0x358f('0x1e')](function(_0x39e55d){logger[_0x358f('0x1f')](_0x39e55d['message']);})[_0x358f('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x358f('0x21')](),_0x5ed856);},TIME);});}function defaultLicense(){var _0x3c64d7=hardware[_0x358f('0x21')]();if(_0x3c64d7){return db[_0x358f('0x22')][_0x358f('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3c64d7}})[_0x358f('0x24')](function(_0xbd7619,_0x1ba449){logger[_0x358f('0x11')](_0x358f('0x25'),_0x3c64d7);manageLicense(_0x3c64d7,_0xbd7619);})[_0x358f('0x1e')](function(_0x4a138a){logger[_0x358f('0x1f')](_0x4a138a[_0x358f('0x26')]);});}}exports[_0x358f('0x27')]=defaultLicense; \ No newline at end of file +var _0x1ed8=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','update','error','message','finally','getUuid','License','findOrCreate','spread','catch','default','util','moment','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','get','data2','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x2e2b18,_0x126993){var _0x3baecc=function(_0x5a8942){while(--_0x5a8942){_0x2e2b18['push'](_0x2e2b18['shift']());}};_0x3baecc(++_0x126993);}(_0x1ed8,0x66));var _0x81ed=function(_0x4d0956,_0x20747b){_0x4d0956=_0x4d0956-0x0;var _0x57b9bf=_0x1ed8[_0x4d0956];return _0x57b9bf;};'use strict';var util=require(_0x81ed('0x0'));var moment=require(_0x81ed('0x1'));var rp=require('request-promise');var BPromise=require(_0x81ed('0x2'));var pkginfo=require(_0x81ed('0x3'))(module,'version');var db=require(_0x81ed('0x4'))['db'];var encryptor=require(_0x81ed('0x5'));var hardware=require(_0x81ed('0x6'));var logger=require(_0x81ed('0x7'))(_0x81ed('0x8'));var HOST=_0x81ed('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x328b04){return new BPromise(function(_0x3417c5,_0x5df07a){var _0x48f9d2=util[_0x81ed('0xa')](_0x81ed('0xb'),HOST,_0x328b04,module[_0x81ed('0xc')][_0x81ed('0xd')]);if(oldToken){_0x48f9d2=util[_0x81ed('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x328b04,module[_0x81ed('0xc')][_0x81ed('0xd')],oldToken);}var _0x213306={'uri':_0x48f9d2,'method':_0x81ed('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x213306)['then'](function(_0x175d7c){_0x3417c5(_0x175d7c);})['catch'](function(_0x3b1a8a){_0x5df07a(_0x3b1a8a);});});}function manageLicense(_0x5bfd8a,_0xc1eb6a){var _0xc6c697=_0xc1eb6a[_0x81ed('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0xc6c697['data1']!==_0x5bfd8a&&!_0xc6c697[_0x81ed('0x10')]){oldToken=_0xc6c697[_0x81ed('0x11')];}httpRequest(_0x5bfd8a)['then'](function(_0xa24f5d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xa24f5d['active']){isOldTokenSent=![];if(!_0xc6c697[_0x81ed('0x8')]&&_0xc6c697[_0x81ed('0x8')]!=_0xa24f5d[_0x81ed('0x8')]||_0xc6c697[_0x81ed('0x8')]&&_0xc6c697[_0x81ed('0x10')]){logger['info'](_0x81ed('0x12'));}if(_0xc6c697['license']&&!_0xc6c697[_0x81ed('0x10')]&&_0xc6c697[_0x81ed('0x8')]!=_0xa24f5d[_0x81ed('0x8')]){logger[_0x81ed('0x13')](_0x81ed('0x14'));}if(_0xc6c697[_0x81ed('0x8')]&&!_0xc6c697[_0x81ed('0x10')]&&_0xc6c697[_0x81ed('0x8')]==_0xa24f5d['license']){return _0xc1eb6a;}return _0xc1eb6a['update']({'data1':_0x5bfd8a,'data2':null,'license':_0xa24f5d[_0x81ed('0x8')]});}else{if(_0xa24f5d['license']||_0xc6c697[_0x81ed('0x8')]){if(!_0xc6c697[_0x81ed('0x10')]){if(_0xc6c697['data1']==_0x5bfd8a){GRAY_PERIOD_REASON=_0x81ed('0x15');logger[_0x81ed('0x13')](_0x81ed('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x81ed('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc6c697[_0x81ed('0x11')],_0x5bfd8a);}logger[_0x81ed('0x13')](_0x81ed('0x17'),GRAY_PERIOD_REASON[_0x81ed('0x18')](),moment()['format'](_0x81ed('0x19')));return _0xc1eb6a['update']({'data2':encryptor[_0x81ed('0x1a')](moment()[_0x81ed('0xa')](_0x81ed('0x19')))});}else{if(moment()[_0x81ed('0x1b')](encryptor[_0x81ed('0x1c')](_0xc6c697['data2']),_0x81ed('0x1d'))>DAYS){logger['info'](_0x81ed('0x1e'),moment()[_0x81ed('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xc1eb6a[_0x81ed('0x1f')]({'data1':_0x5bfd8a,'data2':null,'license':null});}}}else{if(_0xc6c697[_0x81ed('0x11')]!=_0x5bfd8a){logger[_0x81ed('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc6c697['data1'],_0x5bfd8a);return _0xc1eb6a[_0x81ed('0x1f')]({'data1':_0x5bfd8a,'data2':null,'license':null});}}}return _0xc1eb6a;})['then'](function(_0x1686cf){_0xc1eb6a=_0x1686cf;})['catch'](function(_0x163e6a){logger[_0x81ed('0x20')](_0x163e6a[_0x81ed('0x21')]);})[_0x81ed('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x81ed('0x23')](),_0xc1eb6a);},TIME);});}function defaultLicense(){var _0x492578=hardware['getUuid']();if(_0x492578){return db[_0x81ed('0x24')][_0x81ed('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x492578}})[_0x81ed('0x26')](function(_0x2ce4d8,_0x189b2e){logger[_0x81ed('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x492578);manageLicense(_0x492578,_0x2ce4d8);})[_0x81ed('0x27')](function(_0x1588b8){logger[_0x81ed('0x20')](_0x1588b8[_0x81ed('0x21')]);});}}exports[_0x81ed('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2839c44..2360405 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 _0x88e9=['isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','parse','demo','uuid','machineUuid','decryptString','deadline','days','grayReason','disabled','message','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','license'];(function(_0x18a95d,_0x4669d5){var _0x153c40=function(_0x356252){while(--_0x356252){_0x18a95d['push'](_0x18a95d['shift']());}};_0x153c40(++_0x4669d5);}(_0x88e9,0x1e1));var _0x988e=function(_0x4abe9e,_0x58820f){_0x4abe9e=_0x4abe9e-0x0;var _0x28788d=_0x88e9[_0x4abe9e];return _0x28788d;};'use strict';var util=require(_0x988e('0x0'));var _=require('lodash');var moment=require(_0x988e('0x1'));var BPromise=require(_0x988e('0x2'));var hardware=require(_0x988e('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x988e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x988e('0x5'),'machineUuid':hardware[_0x988e('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x988e('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x988e('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1897a9){return new BPromise(function(_0x4062be,_0x228054){return db[_0x988e('0x9')][_0x988e('0xa')](_['defaults'](_0x1897a9,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x24fdc6){return checkLicense(_0x24fdc6,null);})[_0x988e('0xb')](function(_0x1fd847){_0x4062be(_0x1fd847);return;})[_0x988e('0xc')](function(_0x114110){_0x228054(_0x114110);});});}function checkLicense(_0x4f3afd,_0x139c47){if(!_0x4f3afd){demoLicense['uuid']=_0x4f3afd['data1'];return demoLicense;}try{var _0x20db40=_0x139c47||_0x4f3afd[_0x988e('0xd')];if(_[_0x988e('0xe')](_0x20db40)){throw new Error(_0x988e('0xf'));}var _0x2426b5=_0x4f3afd[_0x988e('0x10')];var _0x4a7a14=_0x4f3afd[_0x988e('0x11')];var _0x18fe20=_0x2426b5['split']('-')[0x4];var _0x3f4539=_0x2426b5[_0x988e('0x12')]('-')[0x0];var _0x3b29e8=encryptor['decryptString'](_0x20db40,util[_0x988e('0x13')]('%s:%s:%s',_0x18fe20,_0x2426b5,_0x3f4539));var _0x39d260=JSON[_0x988e('0x14')](_0x3b29e8);_0x39d260[_0x988e('0x15')]=![];_0x39d260[_0x988e('0x16')]=_0x2426b5;_0x39d260[_0x988e('0x17')]=hardware[_0x988e('0x6')]();if(_0x4a7a14){var _0x56e7ec=encryptor[_0x988e('0x18')](_0x4a7a14);_0x39d260['gray']=_0x56e7ec;_0x39d260[_0x988e('0x19')]=moment(_0x56e7ec)['add'](0x7,_0x988e('0x1a'))[_0x988e('0x13')]();_0x39d260[_0x988e('0x1b')]=_0x39d260[_0x988e('0x16')]!=_0x39d260[_0x988e('0x17')]?'changed':_0x988e('0x1c');}return _0x39d260;}catch(_0x516fa5){breakingLicense[_0x988e('0x16')]=_0x4f3afd[_0x988e('0x10')];breakingLicense[_0x988e('0x1d')]=_0x516fa5[_0x988e('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x29018f,_0x2457b6){getLicense()[_0x988e('0xb')](function(_0x37b164){return db['User'][_0x988e('0x1e')]({'attributes':[_0x988e('0x1f'),[db[_0x988e('0x20')]['fn'](_0x988e('0x21'),db[_0x988e('0x20')][_0x988e('0x22')](_0x988e('0x1f'))),'count']],'group':_0x988e('0x1f'),'where':{'role':{'$or':[_0x988e('0x23'),_0x988e('0x24'),_0x988e('0x25')]}},'raw':!![]})[_0x988e('0xb')](function(_0x31a5fb){var _0x436986={'user':_0x37b164[_0x988e('0x26')]||0x0,'telephone':_0x37b164['telephones']||0x0};_0x31a5fb[_0x988e('0x27')](function(_0x19ec66){var _0x3397bb=_0x19ec66[_0x988e('0x1f')]===_0x988e('0x23')?'user':_0x19ec66[_0x988e('0x1f')];_0x436986[_0x3397bb]-=_0x19ec66['count'];if(_0x436986[_0x3397bb]<0x0)_0x436986[_0x3397bb]=0x0;});_0x29018f(_0x436986);return;});})[_0x988e('0xc')](function(_0x400e13){_0x2457b6(_0x400e13);});});}function checkUserLimits(_0x44782b){return new BPromise(function(_0x508b1f,_0xd07a0d){getLimits()[_0x988e('0xb')](function(_0x15c228){var _0x38736e=_[_0x988e('0x28')](_[_0x988e('0x29')](_0x44782b,_0x988e('0x1f')),[_0x988e('0x23'),_0x988e('0x24'),_0x988e('0x25')]);var _0x3f16df=(_0x38736e[_0x988e('0x23')]||0x0)+(_0x38736e['user']||0x0);var _0x610ba1=_0x38736e[_0x988e('0x25')]||0x0;if(_0x3f16df>_0x15c228['user'])return _0xd07a0d(_0x988e('0x2a'));if(_0x610ba1>_0x15c228[_0x988e('0x25')])return _0xd07a0d(_0x988e('0x2b'));return _0x508b1f();})['catch'](function(_0x27815c){_0xd07a0d(_0x27815c);});});}module[_0x988e('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xefcf=['grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','role','count','user','users','telephones','forEach','admin','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','split','decryptString','format','parse','demo','machineUuid','deadline','days'];(function(_0x1e1daf,_0x52a2bf){var _0x83f451=function(_0x179043){while(--_0x179043){_0x1e1daf['push'](_0x1e1daf['shift']());}};_0x83f451(++_0x52a2bf);}(_0xefcf,0x1c2));var _0xfefc=function(_0xf1a516,_0x4b7594){_0xf1a516=_0xf1a516-0x0;var _0x6792d2=_0xefcf[_0xf1a516];return _0x6792d2;};'use strict';var util=require(_0xfefc('0x0'));var _=require('lodash');var moment=require(_0xfefc('0x1'));var BPromise=require(_0xfefc('0x2'));var hardware=require(_0xfefc('0x3'));var encryptor=require(_0xfefc('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xfefc('0x5'),'machineUuid':hardware[_0xfefc('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xfefc('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x53d531){return new BPromise(function(_0x1545af,_0x4a0abb){return db['License'][_0xfefc('0x8')](_[_0xfefc('0x9')](_0x53d531,{'raw':!![],'where':{'id':0x1}}))[_0xfefc('0xa')](function(_0x30e5f0){return checkLicense(_0x30e5f0,null);})[_0xfefc('0xa')](function(_0x307595){_0x1545af(_0x307595);return;})[_0xfefc('0xb')](function(_0xd4b5b6){_0x4a0abb(_0xd4b5b6);});});}function checkLicense(_0x7f712e,_0xb5d1e){if(!_0x7f712e){demoLicense[_0xfefc('0xc')]=_0x7f712e[_0xfefc('0xd')];return demoLicense;}try{var _0x10752d=_0xb5d1e||_0x7f712e[_0xfefc('0xe')];if(_['isEmpty'](_0x10752d)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3ce37f=_0x7f712e[_0xfefc('0xd')];var _0x26b96a=_0x7f712e['data2'];var _0x44606c=_0x3ce37f[_0xfefc('0xf')]('-')[0x4];var _0x5d1127=_0x3ce37f[_0xfefc('0xf')]('-')[0x0];var _0x15276d=encryptor[_0xfefc('0x10')](_0x10752d,util[_0xfefc('0x11')]('%s:%s:%s',_0x44606c,_0x3ce37f,_0x5d1127));var _0xacbcdd=JSON[_0xfefc('0x12')](_0x15276d);_0xacbcdd[_0xfefc('0x13')]=![];_0xacbcdd[_0xfefc('0xc')]=_0x3ce37f;_0xacbcdd[_0xfefc('0x14')]=hardware['getUuid']();if(_0x26b96a){var _0x41a055=encryptor[_0xfefc('0x10')](_0x26b96a);_0xacbcdd['gray']=_0x41a055;_0xacbcdd[_0xfefc('0x15')]=moment(_0x41a055)['add'](0x7,_0xfefc('0x16'))[_0xfefc('0x11')]();_0xacbcdd[_0xfefc('0x17')]=_0xacbcdd[_0xfefc('0xc')]!=_0xacbcdd[_0xfefc('0x14')]?_0xfefc('0x18'):_0xfefc('0x19');}return _0xacbcdd;}catch(_0x27b3df){breakingLicense[_0xfefc('0xc')]=_0x7f712e['data1'];breakingLicense[_0xfefc('0x1a')]=_0x27b3df[_0xfefc('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xff6606,_0x6fba5e){getLicense()['then'](function(_0x209e5e){return db[_0xfefc('0x1b')][_0xfefc('0x1c')]({'attributes':['role',[db[_0xfefc('0x1d')]['fn'](_0xfefc('0x1e'),db['sequelize']['col'](_0xfefc('0x1f'))),_0xfefc('0x20')]],'group':_0xfefc('0x1f'),'where':{'role':{'$or':['admin',_0xfefc('0x21'),'telephone']}},'raw':!![]})[_0xfefc('0xa')](function(_0xc39f0){var _0x52fa9e={'user':_0x209e5e[_0xfefc('0x22')]||0x0,'telephone':_0x209e5e[_0xfefc('0x23')]||0x0};_0xc39f0[_0xfefc('0x24')](function(_0x3d0dda){var _0x3205e2=_0x3d0dda[_0xfefc('0x1f')]===_0xfefc('0x25')?'user':_0x3d0dda[_0xfefc('0x1f')];_0x52fa9e[_0x3205e2]-=_0x3d0dda[_0xfefc('0x20')];if(_0x52fa9e[_0x3205e2]<0x0)_0x52fa9e[_0x3205e2]=0x0;});_0xff6606(_0x52fa9e);return;});})[_0xfefc('0xb')](function(_0x19e42e){_0x6fba5e(_0x19e42e);});});}function checkUserLimits(_0x27acb1){return new BPromise(function(_0x271b19,_0x1ddc20){getLimits()[_0xfefc('0xa')](function(_0x46f5a8){var _0x9c61ad=_[_0xfefc('0x26')](_['countBy'](_0x27acb1,_0xfefc('0x1f')),[_0xfefc('0x25'),_0xfefc('0x21'),_0xfefc('0x27')]);var _0xbacdcb=(_0x9c61ad['admin']||0x0)+(_0x9c61ad[_0xfefc('0x21')]||0x0);var _0x18dd11=_0x9c61ad['telephone']||0x0;if(_0xbacdcb>_0x46f5a8[_0xfefc('0x21')])return _0x1ddc20(_0xfefc('0x28'));if(_0x18dd11>_0x46f5a8[_0xfefc('0x27')])return _0x1ddc20(_0xfefc('0x29'));return _0x271b19();})[_0xfefc('0xb')](function(_0x1c63e7){_0x1ddc20(_0x1c63e7);});});}module[_0xfefc('0x2a')]={'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 91f71b7..1fd37db 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 _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x4cf0a4,_0x4bd739){var _0x3c3869=function(_0xd239e8){while(--_0xd239e8){_0x4cf0a4['push'](_0x4cf0a4['shift']());}};_0x3c3869(++_0x4bd739);}(_0x1a85,0x178));var _0x51a8=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0x1a85[_0x1ca9a0];return _0x4a80d6;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x1c9a=['myappanuglar-secret','secret','exports'];(function(_0x5343e0,_0x571fd8){var _0x14236a=function(_0x5de186){while(--_0x5de186){_0x5343e0['push'](_0x5343e0['shift']());}};_0x14236a(++_0x571fd8);}(_0x1c9a,0x98));var _0xa1c9=function(_0x20bd50,_0x4b374f){_0x20bd50=_0x20bd50-0x0;var _0x54a091=_0x1c9a[_0x20bd50];return _0x54a091;};'use strict';module[_0xa1c9('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xa1c9('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa1c9('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8f8f375..a655196 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa96e=['exports','../utils/loggers'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa96e,0x101));var _0xea96=function(_0x503c09,_0xb59e68){_0x503c09=_0x503c09-0x0;var _0x5606c5=_0xa96e[_0x503c09];return _0x5606c5;};'use strict';var fileLogger=require(_0xea96('0x0'))['fileLogger'];module[_0xea96('0x1')]=fileLogger; \ No newline at end of file +var _0xa5b7=['../utils/loggers','fileLogger','exports'];(function(_0x2551b5,_0x51e99d){var _0x3028cb=function(_0x209503){while(--_0x209503){_0x2551b5['push'](_0x2551b5['shift']());}};_0x3028cb(++_0x51e99d);}(_0xa5b7,0x14d));var _0x7a5b=function(_0x3e96dd,_0x25674a){_0x3e96dd=_0x3e96dd-0x0;var _0x450060=_0xa5b7[_0x3e96dd];return _0x450060;};'use strict';var fileLogger=require(_0x7a5b('0x0'))[_0x7a5b('0x1')];module[_0x7a5b('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a16a6d7..5fad20f 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 _0xe3bc=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','root','legacy-libs','express','join'];(function(_0x4bebc8,_0x434441){var _0x4efdc9=function(_0x14749a){while(--_0x14749a){_0x4bebc8['push'](_0x4bebc8['shift']());}};_0x4efdc9(++_0x434441);}(_0xe3bc,0x1bb));var _0xce3b=function(_0x3612d9,_0x186308){_0x3612d9=_0x3612d9-0x0;var _0x513eb6=_0xe3bc[_0x3612d9];return _0x513eb6;};'use strict';var path=require(_0xce3b('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0xce3b('0x1')],_0xce3b('0x2')))};var pm2config={'apps':[{'name':_0xce3b('0x3'),'script':path[_0xce3b('0x4')](__dirname,_0xce3b('0x5')),'env':env},{'name':_0xce3b('0x6'),'script':path[_0xce3b('0x4')](__dirname,_0xce3b('0x7')),'env':env},{'name':_0xce3b('0x8'),'script':path[_0xce3b('0x4')](__dirname,_0xce3b('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,_0xce3b('0xa')),'env':env},{'name':_0xce3b('0xb'),'script':path[_0xce3b('0x4')](__dirname,_0xce3b('0xc')),'env':env},{'name':_0xce3b('0xd'),'script':path[_0xce3b('0x4')](__dirname,_0xce3b('0xe')),'env':env}]};module[_0xce3b('0xf')]=pm2config; \ No newline at end of file +var _0x749c=['../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','resolve','join','legacy-libs'];(function(_0x20574f,_0x2b5c0c){var _0x41760b=function(_0x118727){while(--_0x118727){_0x20574f['push'](_0x20574f['shift']());}};_0x41760b(++_0x2b5c0c);}(_0x749c,0x130));var _0xc749=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x749c[_0x173441];return _0x2423a8;};'use strict';var path=require(_0xc749('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xc749('0x1')](path[_0xc749('0x2')](cfg['root'],_0xc749('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0xc749('0x2')](__dirname,_0xc749('0x4')),'env':env},{'name':_0xc749('0x5'),'script':path[_0xc749('0x2')](__dirname,_0xc749('0x6')),'env':env},{'name':_0xc749('0x7'),'script':path[_0xc749('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xc749('0x8'),'script':path[_0xc749('0x2')](__dirname,_0xc749('0x9')),'env':env},{'name':_0xc749('0xa'),'script':path[_0xc749('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xc749('0xb'),'script':path[_0xc749('0x2')](__dirname,_0xc749('0xc')),'env':env}]};module[_0xc749('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 11820c4..27481d6 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 _0x7f66=['connected','start','stop','disconnect','restart','then','list','describe','delete','dump','saved','pm2','./config','connect'];(function(_0x59c8e9,_0x5c5682){var _0x8323e2=function(_0x4e61ef){while(--_0x4e61ef){_0x59c8e9['push'](_0x59c8e9['shift']());}};_0x8323e2(++_0x5c5682);}(_0x7f66,0x89));var _0x67f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7f66[_0x17d9e3];return _0x14192d;};'use strict';var pm2=require(_0x67f6('0x0'));var BPromise=require('bluebird');var config=require(_0x67f6('0x1'));function connect(){return new BPromise(function(_0x23642d,_0x4f3f93){return pm2[_0x67f6('0x2')](function(_0x278ab6){if(_0x278ab6){return _0x4f3f93(_0x278ab6);}return _0x23642d(_0x67f6('0x3'));});});};exports['start']=function(_0x3772d9){return connect()['then'](function(){return new BPromise(function(_0x4f77b9,_0x3b10ba){return pm2[_0x67f6('0x4')](_0x3772d9,function(_0x41a29c,_0x3bf20f){if(_0x41a29c){return _0x3b10ba(_0x41a29c);}pm2['disconnect']();return _0x4f77b9(_0x3bf20f);});});});};exports['stop']=function(_0x5d7eba){return connect()['then'](function(){return new BPromise(function(_0x4195b4,_0x458847){return pm2[_0x67f6('0x5')](_0x5d7eba,function(_0x1ef1c0,_0x3bad29){if(_0x1ef1c0){return _0x458847(_0x1ef1c0);}pm2[_0x67f6('0x6')]();return _0x4195b4(_0x3bad29);});});});};exports[_0x67f6('0x7')]=function(_0x328386){return connect()[_0x67f6('0x8')](function(){return new BPromise(function(_0x57b268,_0x155936){return pm2[_0x67f6('0x7')](_0x328386,function(_0x174016,_0x11671b){if(_0x174016){return _0x155936(_0x174016);}pm2[_0x67f6('0x6')]();return _0x57b268(_0x11671b);});});});};exports[_0x67f6('0x9')]=function(){return connect()[_0x67f6('0x8')](function(){return new BPromise(function(_0x458c42,_0x273fb4){return pm2[_0x67f6('0x9')](function(_0x4a4f61,_0x283196){if(_0x4a4f61){return _0x273fb4(_0x4a4f61);}pm2[_0x67f6('0x6')]();return _0x458c42(_0x283196);});});});};exports['describe']=function(_0x1bdf88){return connect()[_0x67f6('0x8')](function(){return new BPromise(function(_0x2ea2a7,_0x108870){return pm2[_0x67f6('0xa')](_0x1bdf88,function(_0x41d245,_0x17d946){if(_0x41d245){return _0x108870(_0x41d245);}pm2['disconnect']();return _0x2ea2a7(_0x17d946);});});});};exports[_0x67f6('0xb')]=function(_0x1ff98c){return connect()[_0x67f6('0x8')](function(){return new BPromise(function(_0xfe3b19,_0x5cd827){return pm2[_0x67f6('0xb')](_0x1ff98c,function(_0x54e07b,_0x3431ed){if(_0x54e07b){return _0x5cd827(_0x54e07b);}pm2[_0x67f6('0x6')]();return _0xfe3b19(_0x3431ed);});});});};exports['dump']=function(){return connect()[_0x67f6('0x8')](function(){return new BPromise(function(_0x179cce,_0xd96c6f){return pm2[_0x67f6('0xc')](function(_0x192208){if(_0x192208){return _0xd96c6f(_0x192208);}return _0x179cce(_0x67f6('0xd'));});});});}; \ No newline at end of file +var _0x08e8=['connect','connected','then','start','disconnect','stop','list','describe','delete','dump','pm2'];(function(_0x3cb138,_0x4eefe5){var _0x3bc69d=function(_0x4478ba){while(--_0x4478ba){_0x3cb138['push'](_0x3cb138['shift']());}};_0x3bc69d(++_0x4eefe5);}(_0x08e8,0x11d));var _0x808e=function(_0x1e3700,_0x2067ea){_0x1e3700=_0x1e3700-0x0;var _0x27026d=_0x08e8[_0x1e3700];return _0x27026d;};'use strict';var pm2=require(_0x808e('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1edcdf,_0x3ab7dd){return pm2[_0x808e('0x1')](function(_0x8c48af){if(_0x8c48af){return _0x3ab7dd(_0x8c48af);}return _0x1edcdf(_0x808e('0x2'));});});};exports['start']=function(_0x25a4b4){return connect()[_0x808e('0x3')](function(){return new BPromise(function(_0x4d0387,_0x48b6b5){return pm2[_0x808e('0x4')](_0x25a4b4,function(_0x381789,_0x50205d){if(_0x381789){return _0x48b6b5(_0x381789);}pm2[_0x808e('0x5')]();return _0x4d0387(_0x50205d);});});});};exports[_0x808e('0x6')]=function(_0x286cbe){return connect()[_0x808e('0x3')](function(){return new BPromise(function(_0x2a922c,_0x2497ba){return pm2[_0x808e('0x6')](_0x286cbe,function(_0x247d7f,_0x2124a4){if(_0x247d7f){return _0x2497ba(_0x247d7f);}pm2[_0x808e('0x5')]();return _0x2a922c(_0x2124a4);});});});};exports['restart']=function(_0x4a9189){return connect()[_0x808e('0x3')](function(){return new BPromise(function(_0x527caf,_0x1b309f){return pm2['restart'](_0x4a9189,function(_0x1d5049,_0x4204d8){if(_0x1d5049){return _0x1b309f(_0x1d5049);}pm2[_0x808e('0x5')]();return _0x527caf(_0x4204d8);});});});};exports[_0x808e('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x406c37,_0x304b49){return pm2[_0x808e('0x7')](function(_0x22e153,_0x59ce1){if(_0x22e153){return _0x304b49(_0x22e153);}pm2[_0x808e('0x5')]();return _0x406c37(_0x59ce1);});});});};exports['describe']=function(_0x4d134e){return connect()['then'](function(){return new BPromise(function(_0x565389,_0x4468ff){return pm2[_0x808e('0x8')](_0x4d134e,function(_0x46e1c0,_0x10a59a){if(_0x46e1c0){return _0x4468ff(_0x46e1c0);}pm2[_0x808e('0x5')]();return _0x565389(_0x10a59a);});});});};exports[_0x808e('0x9')]=function(_0x104015){return connect()[_0x808e('0x3')](function(){return new BPromise(function(_0x309673,_0x55f5d9){return pm2[_0x808e('0x9')](_0x104015,function(_0x5ee64b,_0x38b79b){if(_0x5ee64b){return _0x55f5d9(_0x5ee64b);}pm2[_0x808e('0x5')]();return _0x309673(_0x38b79b);});});});};exports[_0x808e('0xa')]=function(){return connect()[_0x808e('0x3')](function(){return new BPromise(function(_0x3355c2,_0x2c079f){return pm2['dump'](function(_0x59686e){if(_0x59686e){return _0x2c079f(_0x59686e);}return _0x3355c2('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 83549eb..5beb36f 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 _0x9b33=['error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','redis','localhost','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0x262511,_0x29f73f){var _0x2148c6=function(_0x215ec4){while(--_0x215ec4){_0x262511['push'](_0x262511['shift']());}};_0x2148c6(++_0x29f73f);}(_0x9b33,0x7b));var _0x39b3=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x9b33[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x39b3('0x0'));var moment=require(_0x39b3('0x1'));var Redis=require('ioredis');var util=require(_0x39b3('0x2'));var config=require(_0x39b3('0x3'));var db=require(_0x39b3('0x4'))['db'];var logger=require(_0x39b3('0x5'))('schedule');config[_0x39b3('0x6')]=_['defaults'](config['redis'],{'host':_0x39b3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x39b3('0x6')]));function closeInteractions(){var _0x30c618=0x0;var _0x398a57=[];return db[_0x39b3('0x8')]['find']({'raw':!![],'attributes':['id',_0x39b3('0x9')],'where':{'id':0x1}})[_0x39b3('0xa')](function(_0x395d96){_0x30c618=_0x395d96['chatTimeout'];if(_0x30c618){return db[_0x39b3('0xb')][_0x39b3('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x39b3('0xd')](_0x395d96[_0x39b3('0x9')],_0x39b3('0xe'))}}});}else{return[];}})[_0x39b3('0xa')](function(_0x2a6a2b){if(_0x2a6a2b&&_0x2a6a2b['length']){_0x398a57=_['map'](_0x2a6a2b||[],'id');logger[_0x39b3('0xf')](_0x39b3('0x10'),_0x398a57['join']());return db[_0x39b3('0xb')][_0x39b3('0x11')]({'closeReason':_0x39b3('0x12'),'disposition':_0x39b3('0x13'),'closed':!![],'closedAt':moment()[_0x39b3('0x14')](_0x39b3('0x15'))},{'where':{'id':_0x398a57}});}})[_0x39b3('0xa')](function(){if(_0x398a57&&_0x398a57[_0x39b3('0x16')]){logger[_0x39b3('0xf')](_0x39b3('0x17'),_0x398a57['join']());for(var _0x345fa8=0x0;_0x345fa8<_0x398a57[_0x39b3('0x16')];_0x345fa8++){io[_0x39b3('0x18')](_0x39b3('0x19'),{'id':_0x398a57[_0x345fa8],'closed':!![]});}}})[_0x39b3('0x1a')](function(_0x359ff2){logger[_0x39b3('0x1b')](_0x39b3('0x1c'),_0x359ff2?util['inspect'](_0x359ff2,{'showHidden':![],'depth':null}):'');});}exports[_0x39b3('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x76b6=['Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0x2c6198,_0x1c6b70){var _0x5e0fad=function(_0x1c547a){while(--_0x1c547a){_0x2c6198['push'](_0x2c6198['shift']());}};_0x5e0fad(++_0x1c6b70);}(_0x76b6,0xb5));var _0x676b=function(_0x52987f,_0x2e4f86){_0x52987f=_0x52987f-0x0;var _0x414dcd=_0x76b6[_0x52987f];return _0x414dcd;};'use strict';var _=require('lodash');var moment=require(_0x676b('0x0'));var Redis=require(_0x676b('0x1'));var util=require(_0x676b('0x2'));var config=require(_0x676b('0x3'));var db=require(_0x676b('0x4'))['db'];var logger=require(_0x676b('0x5'))(_0x676b('0x6'));config[_0x676b('0x7')]=_[_0x676b('0x8')](config[_0x676b('0x7')],{'host':_0x676b('0x9'),'port':0x18eb});var io=require(_0x676b('0xa'))(new Redis(config[_0x676b('0x7')]));function closeInteractions(){var _0x14cf43=0x0;var _0xefa091=[];return db[_0x676b('0xb')]['find']({'raw':!![],'attributes':['id',_0x676b('0xc')],'where':{'id':0x1}})[_0x676b('0xd')](function(_0x5720ea){_0x14cf43=_0x5720ea['chatTimeout'];if(_0x14cf43){return db[_0x676b('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x676b('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x676b('0x10')](_0x5720ea[_0x676b('0xc')],_0x676b('0x11'))}}});}else{return[];}})[_0x676b('0xd')](function(_0x205766){if(_0x205766&&_0x205766[_0x676b('0x12')]){_0xefa091=_[_0x676b('0x13')](_0x205766||[],'id');logger[_0x676b('0x14')](_0x676b('0x15'),_0xefa091['join']());return db['ChatInteraction'][_0x676b('0x16')]({'closeReason':_0x676b('0x17'),'disposition':_0x676b('0x18'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xefa091}});}})[_0x676b('0xd')](function(){if(_0xefa091&&_0xefa091[_0x676b('0x12')]){logger[_0x676b('0x14')](_0x676b('0x19'),_0xefa091[_0x676b('0x1a')]());for(var _0x410e6c=0x0;_0x410e6c<_0xefa091[_0x676b('0x12')];_0x410e6c++){io[_0x676b('0x1b')]('chatInteraction:update',{'id':_0xefa091[_0x410e6c],'closed':!![]});}}})[_0x676b('0x1c')](function(_0x11cea){logger[_0x676b('0x1d')](_0x676b('0x1e'),_0x11cea?util[_0x676b('0x1f')](_0x11cea,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 9774614..e598034 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ad=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0x55ad,0xa5));var _0xd55a=function(_0x9df81e,_0x29f594){_0x9df81e=_0x9df81e-0x0;var _0x4bb554=_0x55ad[_0x9df81e];return _0x4bb554;};'use strict';function start(){var _0x19d38f=require(_0xd55a('0x0'));return _0x19d38f['startAllRefreshIntervals']();}module[_0xd55a('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf230=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xf230,0xc8));var _0x0f23=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf230[_0x3ab51d];return _0x29a04e;};'use strict';function start(){var _0x1e64b2=require(_0x0f23('0x0'));return _0x1e64b2[_0x0f23('0x1')]();}module[_0x0f23('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 2fbd100..6f7f57b 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 _0x550c=['email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keyBy','toString','difference','intersection','exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','stop','active','update\x20cron','stop\x20cron','run','start','util','lodash','moment','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','stringify'];(function(_0x37c4d6,_0x2cd9f3){var _0x9ddcff=function(_0x6e908e){while(--_0x6e908e){_0x37c4d6['push'](_0x37c4d6['shift']());}};_0x9ddcff(++_0x2cd9f3);}(_0x550c,0x183));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0xc550('0x0'));var path=require('path');var _=require(_0xc550('0x1'));var moment=require(_0xc550('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xc550('0x3'));var logger=require('../logger')(_0xc550('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xc550('0x5'));var analyticDefaultReportController=require(_0xc550('0x6'));var client=jayson[_0xc550('0x7')][_0xc550('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x103ee7,_0x1fc570){return function(){logger[_0xc550('0x9')](_0xc550('0xa'),_0x103ee7[_0xc550('0xb')]);var _0x41f0b9=!![];var _0xfc3514=_0x103ee7['MailAccount'][_0xc550('0xc')]();var _0x44a268={'account':_0xfc3514,'message':{'from':util[_0xc550('0xd')](_0xc550('0xe'),_0x103ee7[_0xc550('0xf')][_0xc550('0x10')],_0x103ee7[_0xc550('0xf')][_0xc550('0xb')]||_0x103ee7[_0xc550('0xf')]['Smtp'][_0xc550('0x11')]),'to':_0x103ee7[_0xc550('0xb')],'cc':_0x103ee7['cc'],'bcc':_0x103ee7[_0xc550('0x12')],'subject':util[_0xc550('0xd')](_0xc550('0x13'),_0x1fc570['name'],_0x103ee7[_0xc550('0x14')],_0x103ee7[_0xc550('0x15')])}};var _0xff048d=path[_0xc550('0x16')](__dirname,_0xc550('0x17'));var _0x429f6c=_0x1fc570[_0xc550('0x18')];var _0x460d13=util[_0xc550('0xd')](_0xc550('0x19'),path[_0xc550('0x1a')](_0x1fc570[_0xc550('0x18')],path[_0xc550('0x1b')](_0x1fc570[_0xc550('0x18')])),_0xc550('0x1c'));var _0x420f38=path[_0xc550('0x16')](_0xff048d,_0x429f6c);var _0x5070f3=path['join'](_0xff048d,_0x460d13);if(fs[_0xc550('0x1d')](_0x420f38)){_0x1fc570['status']=_0xc550('0x1e');_0x44a268[_0xc550('0x1f')][_0xc550('0x20')]=[{'filename':_0x429f6c,'path':_0x420f38}];_0x44a268[_0xc550('0x1f')][_0xc550('0x21')]=util['format'](_0xc550('0x22'),JSON['stringify'](_0x1fc570,null,0x2));}else if(fs[_0xc550('0x1d')](_0x5070f3)){_0x1fc570[_0xc550('0x23')]=_0xc550('0x1e');_0x44a268[_0xc550('0x1f')][_0xc550('0x20')]=[{'filename':_0x460d13,'path':_0x5070f3}];}else{_0x44a268[_0xc550('0x1f')][_0xc550('0x21')]=_0xc550('0x24');if(!_0x103ee7['sendIfEmpty']){_0x41f0b9=![];logger[_0xc550('0x9')](_0xc550('0x25'));}}if(_0x41f0b9){return client[_0xc550('0x26')](_0xc550('0x27'),_0x44a268)['then'](function(_0xcb18a){if(_0xcb18a[_0xc550('0x28')]){return logger[_0xc550('0x28')](_0xc550('0x29'),JSON[_0xc550('0x2a')](_0xcb18a));}return logger[_0xc550('0x9')](_0xc550('0x2b'));})[_0xc550('0x2c')](function(_0x4a9f73){return logger[_0xc550('0x28')](_0xc550('0x29'),JSON[_0xc550('0x2a')](_0x4a9f73));});}};}function handleError(){return function(_0x2a322d){return logger[_0xc550('0x28')](JSON['stringify'](_0x2a322d));};}function handleResult(_0x2e803b){return function(_0x1fc40d){logger['info'](_0xc550('0x2d'),JSON[_0xc550('0x2a')](_0x1fc40d));if(_0x2e803b[_0xc550('0xf')]&&_0x2e803b[_0xc550('0xf')][_0xc550('0x2e')]&&!_[_0xc550('0x2f')](_0x2e803b[_0xc550('0xb')])){setTimeout(handleSendEmail(_0x2e803b,_0x1fc40d),0x3c*0x3e8);}};}function handleJob(_0xa294e5){return function(){try{if(_[_0xc550('0x2f')](_0xa294e5['subtractNumber'])){return logger[_0xc550('0x9')](_0xc550('0x30'));}if(_[_0xc550('0x2f')](_0xa294e5[_0xc550('0x15')])){return logger['info'](_0xc550('0x31'));}var _0x35d58d={'startDate':moment()[_0xc550('0x32')](_0xa294e5[_0xc550('0x14')],_0xa294e5[_0xc550('0x15')])[_0xc550('0xd')](_0xc550('0x33')),'endDate':moment()[_0xc550('0xd')](_0xc550('0x33')),'type':_0xc550('0x34'),'output':_0xa294e5[_0xc550('0x35')],'name':_0xa294e5[_0xc550('0x10')]};if(!_['isNil'](_0xa294e5['DefaultReportId'])){logger[_0xc550('0x9')](_0xc550('0x36'),_0xa294e5[_0xc550('0x37')]);return analyticDefaultReportController[_0xc550('0x38')]({'id':_0xa294e5[_0xc550('0x37')]},_0x35d58d)[_0xc550('0x39')](handleResult(_0xa294e5))['catch'](handleError());}if(!_['isNil'](_0xa294e5[_0xc550('0x3a')])){logger[_0xc550('0x9')](_0xc550('0x3b'),_0xa294e5[_0xc550('0x3a')]);return analyticCustomReportController[_0xc550('0x38')]({'id':_0xa294e5['CustomReportId']},_0x35d58d)[_0xc550('0x39')](handleResult(_0xa294e5))[_0xc550('0x2c')](handleError());}}catch(_0x5cae1e){logger['error'](JSON[_0xc550('0x2a')](_0x5cae1e));}return logger[_0xc550('0x9')](_0xc550('0x3c'));};}function getJobs(_0x2598f8){var _0x279a7e={};if(_0x2598f8){_0x279a7e['id']=_0x2598f8;}return db['Schedule'][_0xc550('0x3d')]({'where':_0x279a7e,'include':[{'model':db[_0xc550('0xf')],'attributes':['id',_0xc550('0x10'),_0xc550('0xb')],'include':[{'model':db[_0xc550('0x3e')],'as':_0xc550('0x2e'),'include':[{'model':db[_0xc550('0x3f')],'as':_0xc550('0x3f')}]}]}]})['then'](function(_0x33653f){var _0xf01d9f=_['keys'](manager['jobs']);var _0x2ad523=_['map'](_0x33653f,function(_0xec814c){return _0xec814c['id']['toString']();});var _0x390911=_[_0xc550('0x40')](_0x33653f,function(_0x4a042e){return _0x4a042e['id'][_0xc550('0x41')]();});var _0xfaab9=_0x2598f8?_0x2ad523:_[_0xc550('0x42')](_0x2ad523,_0xf01d9f);var _0x2ca865=_[_0xc550('0x43')](_0x2ad523,_0xf01d9f);var _0x294b26=_['difference'](_0xf01d9f,_0x2ad523);var _0x2d9c82;var _0x20c654;for(_0x2d9c82=0x0;_0x2d9c82<_0x294b26['length']&&!_0x2598f8;_0x2d9c82+=0x1){_0x20c654=_0x294b26[_0x2d9c82][_0xc550('0x41')]();if(manager[_0xc550('0x44')](_0x20c654)){manager['stop'](_0x20c654);manager[_0xc550('0x45')](_0x20c654);logger['info']('delete\x20cron',_0x20c654);}}logger['info'](_0xc550('0x46'),JSON[_0xc550('0x2a')](_0xfaab9));for(_0x2d9c82=0x0;_0x2d9c82<_0xfaab9['length'];_0x2d9c82+=0x1){_0x20c654=_0xfaab9[_0x2d9c82][_0xc550('0x41')]();logger['info'](_0xc550('0x47'),_0x20c654);if(_0x2598f8){logger[_0xc550('0x9')](_0xc550('0x48'),_0x2598f8);logger[_0xc550('0x9')](JSON[_0xc550('0x2a')](_0x390911[_0x20c654]));BPromise[_0xc550('0x49')]()['then'](handleJob(_0x390911[_0x20c654]));logger[_0xc550('0x9')](_0xc550('0x4a'),_0x390911[_0x20c654][_0xc550('0x10')],_0x390911[_0x20c654][_0xc550('0x4b')]);}else if(_0x390911[_0x20c654][_0xc550('0x4b')]&&_0x390911[_0x20c654]['active']&&moment()[_0xc550('0x4c')](_0x390911[_0x20c654][_0xc550('0x4d')],_0x390911[_0x20c654][_0xc550('0x4e')])){manager[_0xc550('0x4f')](_0x20c654,_0x390911[_0x20c654]['cron'],handleJob(_0x390911[_0x20c654]));manager['start'](_0x20c654);logger[_0xc550('0x9')]('add\x20cron',_0x390911[_0x20c654][_0xc550('0x10')],_0x390911[_0x20c654][_0xc550('0x4b')]);}else if(manager[_0xc550('0x44')](_0x20c654)){manager[_0xc550('0x50')](_0x20c654);manager[_0xc550('0x45')](_0x20c654);logger['info']('stop\x20cron',_0x390911[_0x20c654][_0xc550('0x10')],_0x390911[_0x20c654][_0xc550('0x4b')]);}}for(_0x2d9c82=0x0,_0x20c654;_0x2d9c82<_0x2ca865['length']&&!_0x2598f8;_0x2d9c82+=0x1){_0x20c654=_0x2ca865[_0x2d9c82][_0xc550('0x41')]();if(manager[_0xc550('0x44')](_0x20c654)){if(_0x390911[_0x20c654][_0xc550('0x4b')]&&_0x390911[_0x20c654][_0xc550('0x51')]&&moment()[_0xc550('0x4c')](_0x390911[_0x20c654]['startAt'],_0x390911[_0x20c654][_0xc550('0x4e')])){manager['update'](_0x20c654,_0x390911[_0x20c654][_0xc550('0x4b')],handleJob(_0x390911[_0x20c654]));logger[_0xc550('0x9')](_0xc550('0x52'),_0x390911[_0x20c654]['name'],_0x390911[_0x20c654][_0xc550('0x4b')]);}else{manager[_0xc550('0x50')](_0x20c654);manager[_0xc550('0x45')](_0x20c654);logger[_0xc550('0x9')](_0xc550('0x53'),_0x390911[_0x20c654][_0xc550('0x10')],_0x390911[_0x20c654][_0xc550('0x4b')]);}}}})[_0xc550('0x2c')](function(_0x2a03f7){logger[_0xc550('0x28')](JSON[_0xc550('0x2a')](_0x2a03f7));});}exports[_0xc550('0x54')]=function(_0x31b30b){return getJobs(_0x31b30b);};exports[_0xc550('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xfb9a=['exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','stop','isBetween','update\x20cron','start','path','lodash','moment','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','email','bcc','format','name','subtractNumber','join','../../files/reports','%s.%s','basename','savename','zip','status','Sent','attachments','message','text','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','catch','error\x20mail','info','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length'];(function(_0xd37461,_0x3d81e1){var _0x2d5936=function(_0x6cfcfa){while(--_0x6cfcfa){_0xd37461['push'](_0xd37461['shift']());}};_0x2d5936(++_0x3d81e1);}(_0xfb9a,0xb0));var _0xafb9=function(_0x189d1a,_0x45b6eb){_0x189d1a=_0x189d1a-0x0;var _0x43565f=_0xfb9a[_0x189d1a];return _0x43565f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xafb9('0x0'));var _=require(_0xafb9('0x1'));var moment=require(_0xafb9('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xafb9('0x3'));var logger=require('../logger')(_0xafb9('0x4'));var db=require(_0xafb9('0x5'))['db'];var analyticCustomReportController=require(_0xafb9('0x6'));var analyticDefaultReportController=require(_0xafb9('0x7'));var client=jayson[_0xafb9('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3d049d,_0x425d58){return function(){logger['info'](_0xafb9('0x9'),_0x3d049d['email']);var _0x22fdf2=!![];var _0x3bab28=_0x3d049d[_0xafb9('0xa')][_0xafb9('0xb')]();var _0x10de18={'account':_0x3bab28,'message':{'from':util['format'](_0xafb9('0xc'),_0x3d049d[_0xafb9('0xa')]['name'],_0x3d049d[_0xafb9('0xa')]['email']||_0x3d049d[_0xafb9('0xa')][_0xafb9('0xd')]['user']),'to':_0x3d049d[_0xafb9('0xe')],'cc':_0x3d049d['cc'],'bcc':_0x3d049d[_0xafb9('0xf')],'subject':util[_0xafb9('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x425d58[_0xafb9('0x11')],_0x3d049d[_0xafb9('0x12')],_0x3d049d['subtractUnit'])}};var _0x2e3f70=path[_0xafb9('0x13')](__dirname,_0xafb9('0x14'));var _0x23676b=_0x425d58['savename'];var _0x7c9c=util['format'](_0xafb9('0x15'),path[_0xafb9('0x16')](_0x425d58[_0xafb9('0x17')],path['extname'](_0x425d58[_0xafb9('0x17')])),_0xafb9('0x18'));var _0x32a657=path[_0xafb9('0x13')](_0x2e3f70,_0x23676b);var _0x413e7d=path['join'](_0x2e3f70,_0x7c9c);if(fs['existsSync'](_0x32a657)){_0x425d58[_0xafb9('0x19')]=_0xafb9('0x1a');_0x10de18['message'][_0xafb9('0x1b')]=[{'filename':_0x23676b,'path':_0x32a657}];_0x10de18[_0xafb9('0x1c')][_0xafb9('0x1d')]=util[_0xafb9('0x10')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xafb9('0x1e')](_0x425d58,null,0x2));}else if(fs[_0xafb9('0x1f')](_0x413e7d)){_0x425d58[_0xafb9('0x19')]=_0xafb9('0x1a');_0x10de18[_0xafb9('0x1c')][_0xafb9('0x1b')]=[{'filename':_0x7c9c,'path':_0x413e7d}];}else{_0x10de18[_0xafb9('0x1c')][_0xafb9('0x1d')]=_0xafb9('0x20');if(!_0x3d049d['sendIfEmpty']){_0x22fdf2=![];logger['info'](_0xafb9('0x21'));}}if(_0x22fdf2){return client[_0xafb9('0x22')](_0xafb9('0x23'),_0x10de18)[_0xafb9('0x24')](function(_0x4b6e60){if(_0x4b6e60[_0xafb9('0x25')]){return logger[_0xafb9('0x25')]('error\x20mail',JSON[_0xafb9('0x1e')](_0x4b6e60));}return logger['info']('email\x20sent');})[_0xafb9('0x26')](function(_0x3f1149){return logger[_0xafb9('0x25')](_0xafb9('0x27'),JSON[_0xafb9('0x1e')](_0x3f1149));});}};}function handleError(){return function(_0x5b3d07){return logger[_0xafb9('0x25')](JSON[_0xafb9('0x1e')](_0x5b3d07));};}function handleResult(_0xd86413){return function(_0x3b29f3){logger[_0xafb9('0x28')]('data',JSON[_0xafb9('0x1e')](_0x3b29f3));if(_0xd86413[_0xafb9('0xa')]&&_0xd86413[_0xafb9('0xa')][_0xafb9('0xd')]&&!_[_0xafb9('0x29')](_0xd86413[_0xafb9('0xe')])){setTimeout(handleSendEmail(_0xd86413,_0x3b29f3),0x3c*0x3e8);}};}function handleJob(_0x10039f){return function(){try{if(_[_0xafb9('0x29')](_0x10039f[_0xafb9('0x12')])){return logger[_0xafb9('0x28')](_0xafb9('0x2a'));}if(_['isNil'](_0x10039f[_0xafb9('0x2b')])){return logger[_0xafb9('0x28')](_0xafb9('0x2c'));}var _0x1fe39d={'startDate':moment()[_0xafb9('0x2d')](_0x10039f[_0xafb9('0x12')],_0x10039f['subtractUnit'])[_0xafb9('0x10')](_0xafb9('0x2e')),'endDate':moment()[_0xafb9('0x10')](_0xafb9('0x2e')),'type':'scheduled','output':_0x10039f[_0xafb9('0x2f')],'name':_0x10039f['name']};if(!_[_0xafb9('0x29')](_0x10039f[_0xafb9('0x30')])){logger['info'](_0xafb9('0x31'),_0x10039f[_0xafb9('0x30')]);return analyticDefaultReportController['runReport']({'id':_0x10039f[_0xafb9('0x30')]},_0x1fe39d)[_0xafb9('0x24')](handleResult(_0x10039f))[_0xafb9('0x26')](handleError());}if(!_['isNil'](_0x10039f['CustomReportId'])){logger[_0xafb9('0x28')](_0xafb9('0x32'),_0x10039f[_0xafb9('0x33')]);return analyticCustomReportController['runReport']({'id':_0x10039f[_0xafb9('0x33')]},_0x1fe39d)['then'](handleResult(_0x10039f))['catch'](handleError());}}catch(_0x712de1){logger[_0xafb9('0x25')](JSON[_0xafb9('0x1e')](_0x712de1));}return logger[_0xafb9('0x28')](_0xafb9('0x34'));};}function getJobs(_0x2e4cf1){var _0x3dcb90={};if(_0x2e4cf1){_0x3dcb90['id']=_0x2e4cf1;}return db['Schedule'][_0xafb9('0x35')]({'where':_0x3dcb90,'include':[{'model':db[_0xafb9('0xa')],'attributes':['id','name',_0xafb9('0xe')],'include':[{'model':db[_0xafb9('0x36')],'as':_0xafb9('0xd'),'include':[{'model':db[_0xafb9('0x37')],'as':_0xafb9('0x37')}]}]}]})[_0xafb9('0x24')](function(_0x3eabec){var _0x584f11=_[_0xafb9('0x38')](manager[_0xafb9('0x39')]);var _0xc1620a=_[_0xafb9('0x3a')](_0x3eabec,function(_0x17f473){return _0x17f473['id']['toString']();});var _0x16661f=_[_0xafb9('0x3b')](_0x3eabec,function(_0x1b3d85){return _0x1b3d85['id'][_0xafb9('0x3c')]();});var _0x44fa96=_0x2e4cf1?_0xc1620a:_[_0xafb9('0x3d')](_0xc1620a,_0x584f11);var _0xc3255e=_[_0xafb9('0x3e')](_0xc1620a,_0x584f11);var _0x33b32f=_[_0xafb9('0x3d')](_0x584f11,_0xc1620a);var _0x275f49;var _0xe11c9c;for(_0x275f49=0x0;_0x275f49<_0x33b32f[_0xafb9('0x3f')]&&!_0x2e4cf1;_0x275f49+=0x1){_0xe11c9c=_0x33b32f[_0x275f49][_0xafb9('0x3c')]();if(manager[_0xafb9('0x40')](_0xe11c9c)){manager['stop'](_0xe11c9c);manager[_0xafb9('0x41')](_0xe11c9c);logger[_0xafb9('0x28')]('delete\x20cron',_0xe11c9c);}}logger[_0xafb9('0x28')](_0xafb9('0x42'),JSON[_0xafb9('0x1e')](_0x44fa96));for(_0x275f49=0x0;_0x275f49<_0x44fa96[_0xafb9('0x3f')];_0x275f49+=0x1){_0xe11c9c=_0x44fa96[_0x275f49]['toString']();logger[_0xafb9('0x28')](_0xafb9('0x43'),_0xe11c9c);if(_0x2e4cf1){logger[_0xafb9('0x28')](_0xafb9('0x44'),_0x2e4cf1);logger[_0xafb9('0x28')](JSON[_0xafb9('0x1e')](_0x16661f[_0xe11c9c]));BPromise[_0xafb9('0x45')]()['then'](handleJob(_0x16661f[_0xe11c9c]));logger['info'](_0xafb9('0x46'),_0x16661f[_0xe11c9c]['name'],_0x16661f[_0xe11c9c][_0xafb9('0x47')]);}else if(_0x16661f[_0xe11c9c]['cron']&&_0x16661f[_0xe11c9c][_0xafb9('0x48')]&&moment()['isBetween'](_0x16661f[_0xe11c9c][_0xafb9('0x49')],_0x16661f[_0xe11c9c][_0xafb9('0x4a')])){manager[_0xafb9('0x4b')](_0xe11c9c,_0x16661f[_0xe11c9c][_0xafb9('0x47')],handleJob(_0x16661f[_0xe11c9c]));manager['start'](_0xe11c9c);logger[_0xafb9('0x28')]('add\x20cron',_0x16661f[_0xe11c9c][_0xafb9('0x11')],_0x16661f[_0xe11c9c][_0xafb9('0x47')]);}else if(manager[_0xafb9('0x40')](_0xe11c9c)){manager[_0xafb9('0x4c')](_0xe11c9c);manager[_0xafb9('0x41')](_0xe11c9c);logger[_0xafb9('0x28')]('stop\x20cron',_0x16661f[_0xe11c9c][_0xafb9('0x11')],_0x16661f[_0xe11c9c]['cron']);}}for(_0x275f49=0x0,_0xe11c9c;_0x275f49<_0xc3255e[_0xafb9('0x3f')]&&!_0x2e4cf1;_0x275f49+=0x1){_0xe11c9c=_0xc3255e[_0x275f49][_0xafb9('0x3c')]();if(manager[_0xafb9('0x40')](_0xe11c9c)){if(_0x16661f[_0xe11c9c]['cron']&&_0x16661f[_0xe11c9c]['active']&&moment()[_0xafb9('0x4d')](_0x16661f[_0xe11c9c]['startAt'],_0x16661f[_0xe11c9c]['endAt'])){manager['update'](_0xe11c9c,_0x16661f[_0xe11c9c][_0xafb9('0x47')],handleJob(_0x16661f[_0xe11c9c]));logger[_0xafb9('0x28')](_0xafb9('0x4e'),_0x16661f[_0xe11c9c][_0xafb9('0x11')],_0x16661f[_0xe11c9c][_0xafb9('0x47')]);}else{manager['stop'](_0xe11c9c);manager['deleteJob'](_0xe11c9c);logger[_0xafb9('0x28')]('stop\x20cron',_0x16661f[_0xe11c9c]['name'],_0x16661f[_0xe11c9c][_0xafb9('0x47')]);}}}})[_0xafb9('0x26')](function(_0x50c496){logger[_0xafb9('0x25')](JSON[_0xafb9('0x1e')](_0x50c496));});}exports['run']=function(_0x39dc0f){return getJobs(_0x39dc0f);};exports[_0xafb9('0x4f')]=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 a6dea5b..73d1771 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 _0x6c50=['resolve','sentiment','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Negative','Neutral','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','findOne','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','catch','name','inspect','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','info','format','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason'];(function(_0x3873bf,_0x1c0241){var _0x9e86c9=function(_0x880895){while(--_0x880895){_0x3873bf['push'](_0x3873bf['shift']());}};_0x9e86c9(++_0x1c0241);}(_0x6c50,0xa4));var _0x06c5=function(_0x598d13,_0x3ad231){_0x598d13=_0x598d13-0x0;var _0x3dfd38=_0x6c50[_0x598d13];return _0x3dfd38;};var _=require(_0x06c5('0x0'));var AWS=require(_0x06c5('0x1'));var rp=require(_0x06c5('0x2'));var util=require(_0x06c5('0x3'));var BPromise=require('bluebird');var db=require(_0x06c5('0x4'))['db'];var logger=require('../../config/logger')(_0x06c5('0x5'));function getTranscriptionJob(_0x2853be,_0x434003,_0x443043,_0x3c050f){return new Promise(function(_0x463f4f,_0x3f5b56){var _0x427dd6=new AWS[(_0x06c5('0x6'))]({'accessKeyId':_0x434003,'secretAccessKey':_0x2853be,'region':_0x443043});_0x427dd6[_0x06c5('0x7')]({'TranscriptionJobName':_0x3c050f},function(_0x154b0a,_0x546ae5){if(_0x154b0a){return _0x3f5b56(_0x154b0a);}else{return _0x463f4f(_0x546ae5);}});});}function sentiment(_0xe263a,_0x222e05,_0x3010af,_0x18f1e9,_0x4e863c){return new Promise(function(_0x510444,_0x5ea57c){var _0x1dc67b=new AWS['Comprehend']({'accessKeyId':_0x222e05,'secretAccessKey':_0xe263a,'region':_0x3010af});_0x1dc67b['detectSentiment']({'Text':_0x18f1e9,'LanguageCode':_0x4e863c['substring'](0x0,0x2)},function(_0x236104,_0x5613a8){if(_0x236104){return _0x5ea57c(_0x236104);}else{return _0x510444(_0x5613a8);}});});}function checkTranscribeJob(_0x319710,_0x2d7502,_0x68194e){var _0x4ce581;return new BPromise(function(_0x6546e3,_0x3cb963){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x319710['id'],_0x319710['transcribeName']));return getTranscriptionJob(_0x68194e[_0x06c5('0xa')],_0x68194e[_0x06c5('0xb')],_0x2d7502[_0x06c5('0xc')],_0x319710['transcribeName'])[_0x06c5('0xd')](function(_0x117371){logger['info'](util[_0x06c5('0x9')](_0x06c5('0xe'),_0x319710['id'],_0x319710[_0x06c5('0xf')],_0x117371[_0x06c5('0x10')][_0x06c5('0x11')]));if(!_0x319710[_0x06c5('0x12')]){switch(_0x117371[_0x06c5('0x10')][_0x06c5('0x11')]){case _0x06c5('0x13'):var _0x2b93ba={'transcribeStatus':_0x117371[_0x06c5('0x10')][_0x06c5('0x11')],'fileUri':_0x117371[_0x06c5('0x10')][_0x06c5('0x14')][_0x06c5('0x15')]};logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x319710['id']));return rp({'uri':_0x117371[_0x06c5('0x10')][_0x06c5('0x14')][_0x06c5('0x15')],'json':!![]})[_0x06c5('0xd')](function(_0xa3659b){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x319710['id']));if(_0xa3659b&&_0xa3659b[_0x06c5('0x16')]&&_0xa3659b[_0x06c5('0x16')][_0x06c5('0x17')]&&_0xa3659b[_0x06c5('0x16')][_0x06c5('0x17')][_0x06c5('0x18')]){_0x2b93ba[_0x06c5('0x12')]='';for(var _0x51f2a6=0x0;_0x51f2a6<_0xa3659b[_0x06c5('0x16')]['transcripts']['length'];_0x51f2a6++){_0x2b93ba['fileText']+=_0xa3659b['results'][_0x06c5('0x17')][_0x51f2a6][_0x06c5('0x19')]+'';}}return _0x319710[_0x06c5('0x1a')](_0x2b93ba);})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util['format'](_0x06c5('0x1b'),_0x319710['id']));if(!_0x319710[_0x06c5('0x1c')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x1f'));}if(!_0x2d7502['sentiment']||!_0x2d7502[_0x06c5('0x20')]||!_0x2d7502[_0x06c5('0x21')]||!_0x2d7502[_0x06c5('0x22')]||!_0x2d7502['bucket']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x23'));}if(!_0x2b93ba['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2d7502['sentimentAccountId']===_0x68194e['id']){return _0x68194e;}else{return db[_0x06c5('0x24')]['findOne']({'where':{'id':_settings[_0x06c5('0x20')]}});}})['then'](function(_0xb849b5){if(!_0xb849b5){throw new db['Sequelize'][(_0x06c5('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xb849b5['data1']||!_0xb849b5[_0x06c5('0xb')]){throw new db['Sequelize']['ValidationError'](_0x06c5('0x25'));}_0x4ce581=_0xb849b5;logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x26'),_0x319710['id']));return sentiment(_0x4ce581[_0x06c5('0xa')],_0x4ce581[_0x06c5('0xb')],_0x2d7502[_0x06c5('0x21')],_0x2b93ba['fileText'],_0x2d7502[_0x06c5('0x22')]);})['then'](function(_0x49d825){logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x27'),_0x319710['id']));return _0x319710[_0x06c5('0x1a')]({'sentiment':_0x49d825[_0x06c5('0x28')],'sPositive':_0x49d825[_0x06c5('0x29')][_0x06c5('0x2a')],'sNegative':_0x49d825['SentimentScore']['Negative'],'sMixed':_0x49d825[_0x06c5('0x29')][_0x06c5('0x2b')],'sNeutral':_0x49d825['SentimentScore']['Neutral']});})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x319710['id']));_0x6546e3();});case _0x06c5('0x2c'):return _0x319710[_0x06c5('0x1a')]({'transcribeStatus':_0x06c5('0x2c'),'failureReason':_0x117371['TranscriptionJob'][_0x06c5('0x2d')]})[_0x06c5('0xd')](function(){logger['info'](util['format'](_0x06c5('0x1b'),_0x319710['id']));_0x6546e3();});default:logger['info'](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x319710['id']));break;}}else{return BPromise[_0x06c5('0x2e')]()[_0x06c5('0xd')](function(){if(!_0x319710[_0x06c5('0x1c')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x1f'));}if(!_0x2d7502[_0x06c5('0x2f')]||!_0x2d7502['sentimentAccountId']||!_0x2d7502[_0x06c5('0x21')]||!_0x2d7502['language']||!_0x2d7502['bucket']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x23'));}if(!_0x319710[_0x06c5('0x12')]){throw new Error(_0x06c5('0x30'));}if(_0x2d7502[_0x06c5('0x20')]===_0x68194e['id']){return _0x68194e;}else{return db[_0x06c5('0x24')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2dd49b){if(!_0x2dd49b){throw new db['Sequelize'][(_0x06c5('0x1e'))](_0x06c5('0x31'));}if(!_0x2dd49b[_0x06c5('0xa')]||!_0x2dd49b['data2']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x25'));}_0x4ce581=_0x2dd49b;logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x319710['id']));return sentiment(_0x4ce581[_0x06c5('0xa')],_0x4ce581[_0x06c5('0xb')],_0x2d7502[_0x06c5('0x21')],_0x319710['fileText'],_0x2d7502[_0x06c5('0x22')]);})[_0x06c5('0xd')](function(_0x560156){logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x27'),_0x319710['id']));return _0x319710['update']({'sentiment':_0x560156[_0x06c5('0x28')],'sPositive':_0x560156[_0x06c5('0x29')][_0x06c5('0x2a')],'sNegative':_0x560156[_0x06c5('0x29')][_0x06c5('0x32')],'sMixed':_0x560156['SentimentScore'][_0x06c5('0x2b')],'sNeutral':_0x560156[_0x06c5('0x29')][_0x06c5('0x33')],'transcribeStatus':_0x06c5('0x13')});})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util['format'](_0x06c5('0x1b'),_0x319710['id']));_0x6546e3();});}})['catch'](function(_0x2a228f){if(_0x2a228f){if(!_0x2a228f['name']||_0x2a228f['name']!==_0x06c5('0x34')){logger[_0x06c5('0x35')](util['format'](_0x06c5('0x36'),_0x319710['id']),util['inspect'](_0x2a228f,{'showHidden':![],'depth':null}));}}_0x6546e3();});});}function checkTranscribe(){var _0x536b44;var _0x364a2e;var _0x26a491;return db[_0x06c5('0x37')][_0x06c5('0x38')]({'where':{'transcribeStatus':_0x06c5('0x39')}})[_0x06c5('0xd')](function(_0x3865a0){if(!_0x3865a0||!_0x3865a0[_0x06c5('0x18')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x3a'));}_0x536b44=_0x3865a0;return db['Setting'][_0x06c5('0x3b')]({'where':{'id':0x1}});})[_0x06c5('0xd')](function(_0x5c4dff){if(!_0x5c4dff){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x3c'));}_0x364a2e=_0x5c4dff;if(!_0x364a2e[_0x06c5('0x5')]||!_0x364a2e['transcribeAccountId']||!_0x364a2e[_0x06c5('0xc')]||!_0x364a2e['language']||!_0x364a2e[_0x06c5('0x3d')]){throw new db['Sequelize']['ValidationError'](_0x06c5('0x3e'));}return db[_0x06c5('0x24')][_0x06c5('0x3b')]({'where':{'id':_0x364a2e[_0x06c5('0x3f')]}});})[_0x06c5('0xd')](function(_0x5cfac8){if(!_0x5cfac8){throw new db[(_0x06c5('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5cfac8[_0x06c5('0xa')]||!_0x5cfac8['data2']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x25'));}_0x26a491=_0x5cfac8;var _0x478d58=[];_0x536b44[_0x06c5('0x40')](function(_0x5af034){_0x478d58['push'](checkTranscribeJob(_0x5af034,_0x364a2e,_0x26a491));});return BPromise[_0x06c5('0x41')](_0x478d58);})[_0x06c5('0x42')](function(_0x45b493){if(_0x45b493){if(!_0x45b493[_0x06c5('0x43')]||_0x45b493[_0x06c5('0x43')]!==_0x06c5('0x34')){logger[_0x06c5('0x35')](util[_0x06c5('0x44')](_0x45b493,{'showHidden':![],'depth':null}));}}});}exports[_0x06c5('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd05a=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','tempSentiment','sentiment','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2'];(function(_0x57203c,_0x18e12f){var _0x3e6bac=function(_0x2af343){while(--_0x2af343){_0x57203c['push'](_0x57203c['shift']());}};_0x3e6bac(++_0x18e12f);}(_0xd05a,0x143));var _0xad05=function(_0x26763e,_0x1fcffb){_0x26763e=_0x26763e-0x0;var _0xa17e9f=_0xd05a[_0x26763e];return _0xa17e9f;};var _=require('lodash');var AWS=require(_0xad05('0x0'));var rp=require(_0xad05('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xad05('0x2'));function getTranscriptionJob(_0x1a25cb,_0x11bbc4,_0x275d04,_0x41aed3){return new Promise(function(_0x520f44,_0x50254e){var _0x39ddaf=new AWS[(_0xad05('0x3'))]({'accessKeyId':_0x11bbc4,'secretAccessKey':_0x1a25cb,'region':_0x275d04});_0x39ddaf[_0xad05('0x4')]({'TranscriptionJobName':_0x41aed3},function(_0x565f85,_0x17ec26){if(_0x565f85){return _0x50254e(_0x565f85);}else{return _0x520f44(_0x17ec26);}});});}function sentiment(_0xc0ae2b,_0xe48ce1,_0x573acb,_0x580196,_0x33ea15){return new Promise(function(_0x527d92,_0x237e7a){var _0x3ec191=new AWS[(_0xad05('0x5'))]({'accessKeyId':_0xe48ce1,'secretAccessKey':_0xc0ae2b,'region':_0x573acb});_0x3ec191[_0xad05('0x6')]({'Text':_0x580196,'LanguageCode':_0x33ea15[_0xad05('0x7')](0x0,0x2)},function(_0x469553,_0xc243cc){if(_0x469553){return _0x237e7a(_0x469553);}else{return _0x527d92(_0xc243cc);}});});}function checkTranscribeJob(_0x200eed,_0x144310,_0x4281b7){var _0x4c8813;return new BPromise(function(_0x2d672d,_0x5189dd){logger[_0xad05('0x8')](util['format'](_0xad05('0x9'),_0x200eed['id'],_0x200eed[_0xad05('0xa')]));return getTranscriptionJob(_0x4281b7[_0xad05('0xb')],_0x4281b7['data2'],_0x144310[_0xad05('0xc')],_0x200eed['transcribeName'])[_0xad05('0xd')](function(_0x2bf8e9){logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0xf'),_0x200eed['id'],_0x200eed[_0xad05('0xa')],_0x2bf8e9['TranscriptionJob'][_0xad05('0x10')]));if(!_0x200eed[_0xad05('0x11')]){switch(_0x2bf8e9[_0xad05('0x12')][_0xad05('0x10')]){case _0xad05('0x13'):var _0x472174={'transcribeStatus':_0x2bf8e9[_0xad05('0x12')][_0xad05('0x10')],'fileUri':_0x2bf8e9[_0xad05('0x12')][_0xad05('0x14')][_0xad05('0x15')]};logger['info'](util[_0xad05('0xe')](_0xad05('0x16'),_0x200eed['id']));return rp({'uri':_0x2bf8e9[_0xad05('0x12')]['Transcript'][_0xad05('0x15')],'json':!![]})['then'](function(_0x385f01){logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x17'),_0x200eed['id']));if(_0x385f01&&_0x385f01[_0xad05('0x18')]&&_0x385f01[_0xad05('0x18')][_0xad05('0x19')]&&_0x385f01[_0xad05('0x18')][_0xad05('0x19')][_0xad05('0x1a')]){_0x472174['fileText']='';for(var _0x320a9c=0x0;_0x320a9c<_0x385f01[_0xad05('0x18')][_0xad05('0x19')][_0xad05('0x1a')];_0x320a9c++){_0x472174['fileText']+=_0x385f01[_0xad05('0x18')][_0xad05('0x19')][_0x320a9c][_0xad05('0x1b')]+'';}}return _0x200eed[_0xad05('0x1c')](_0x472174);})[_0xad05('0xd')](function(){logger[_0xad05('0x8')](util[_0xad05('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x200eed['id']));if(!_0x200eed['tempSentiment']){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))](_0xad05('0x1f'));}if(!_0x144310['sentiment']||!_0x144310['sentimentAccountId']||!_0x144310[_0xad05('0x20')]||!_0x144310[_0xad05('0x21')]||!_0x144310[_0xad05('0x22')]){throw new db['Sequelize'][(_0xad05('0x1e'))](_0xad05('0x23'));}if(!_0x472174['fileText']){throw new Error(_0xad05('0x24'));}if(_0x144310[_0xad05('0x25')]===_0x4281b7['id']){return _0x4281b7;}else{return db[_0xad05('0x26')][_0xad05('0x27')]({'where':{'id':_settings[_0xad05('0x25')]}});}})[_0xad05('0xd')](function(_0x3aa25d){if(!_0x3aa25d){throw new db['Sequelize'][(_0xad05('0x1e'))](_0xad05('0x28'));}if(!_0x3aa25d['data1']||!_0x3aa25d[_0xad05('0x29')]){throw new db[(_0xad05('0x1d'))]['ValidationError'](_0xad05('0x2a'));}_0x4c8813=_0x3aa25d;logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x2b'),_0x200eed['id']));return sentiment(_0x4c8813[_0xad05('0xb')],_0x4c8813[_0xad05('0x29')],_0x144310[_0xad05('0x20')],_0x472174[_0xad05('0x11')],_0x144310[_0xad05('0x21')]);})[_0xad05('0xd')](function(_0x4780a7){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x200eed['id']));return _0x200eed['update']({'sentiment':_0x4780a7[_0xad05('0x2c')],'sPositive':_0x4780a7[_0xad05('0x2d')][_0xad05('0x2e')],'sNegative':_0x4780a7[_0xad05('0x2d')]['Negative'],'sMixed':_0x4780a7[_0xad05('0x2d')][_0xad05('0x2f')],'sNeutral':_0x4780a7[_0xad05('0x2d')][_0xad05('0x30')]});})['then'](function(){logger[_0xad05('0x8')](util['format'](_0xad05('0x31'),_0x200eed['id']));_0x2d672d();});case _0xad05('0x32'):return _0x200eed[_0xad05('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x2bf8e9[_0xad05('0x12')][_0xad05('0x33')]})[_0xad05('0xd')](function(){logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x31'),_0x200eed['id']));_0x2d672d();});default:logger[_0xad05('0x8')](util[_0xad05('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x200eed['id']));break;}}else{return BPromise[_0xad05('0x34')]()[_0xad05('0xd')](function(){if(!_0x200eed[_0xad05('0x35')]){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))](_0xad05('0x1f'));}if(!_0x144310[_0xad05('0x36')]||!_0x144310[_0xad05('0x25')]||!_0x144310[_0xad05('0x20')]||!_0x144310['language']||!_0x144310[_0xad05('0x22')]){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))](_0xad05('0x23'));}if(!_0x200eed[_0xad05('0x11')]){throw new Error(_0xad05('0x24'));}if(_0x144310[_0xad05('0x25')]===_0x4281b7['id']){return _0x4281b7;}else{return db[_0xad05('0x26')]['findOne']({'where':{'id':_settings[_0xad05('0x25')]}});}})[_0xad05('0xd')](function(_0x56495e){if(!_0x56495e){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x56495e[_0xad05('0xb')]||!_0x56495e[_0xad05('0x29')]){throw new db[(_0xad05('0x1d'))]['ValidationError'](_0xad05('0x2a'));}_0x4c8813=_0x56495e;logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x2b'),_0x200eed['id']));return sentiment(_0x4c8813['data1'],_0x4c8813[_0xad05('0x29')],_0x144310[_0xad05('0x20')],_0x200eed[_0xad05('0x11')],_0x144310[_0xad05('0x21')]);})[_0xad05('0xd')](function(_0x47a817){logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x37'),_0x200eed['id']));return _0x200eed['update']({'sentiment':_0x47a817[_0xad05('0x2c')],'sPositive':_0x47a817[_0xad05('0x2d')][_0xad05('0x2e')],'sNegative':_0x47a817[_0xad05('0x2d')][_0xad05('0x38')],'sMixed':_0x47a817[_0xad05('0x2d')][_0xad05('0x2f')],'sNeutral':_0x47a817['SentimentScore'][_0xad05('0x30')],'transcribeStatus':'COMPLETED'});})[_0xad05('0xd')](function(){logger[_0xad05('0x8')](util[_0xad05('0xe')](_0xad05('0x31'),_0x200eed['id']));_0x2d672d();});}})[_0xad05('0x39')](function(_0x249e90){if(_0x249e90){if(!_0x249e90[_0xad05('0x3a')]||_0x249e90[_0xad05('0x3a')]!==_0xad05('0x3b')){logger[_0xad05('0x3c')](util[_0xad05('0xe')](_0xad05('0x3d'),_0x200eed['id']),util[_0xad05('0x3e')](_0x249e90,{'showHidden':![],'depth':null}));}}_0x2d672d();});});}function checkTranscribe(){var _0x1bc26b;var _0x3ada0f;var _0x56d036;return db[_0xad05('0x3f')][_0xad05('0x40')]({'where':{'transcribeStatus':_0xad05('0x41')}})[_0xad05('0xd')](function(_0x437932){if(!_0x437932||!_0x437932['length']){throw new db[(_0xad05('0x1d'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x1bc26b=_0x437932;return db[_0xad05('0x42')]['findOne']({'where':{'id':0x1}});})[_0xad05('0xd')](function(_0x5a0d82){if(!_0x5a0d82){throw new db['Sequelize']['ValidationError'](_0xad05('0x43'));}_0x3ada0f=_0x5a0d82;if(!_0x3ada0f['transcribe']||!_0x3ada0f[_0xad05('0x44')]||!_0x3ada0f[_0xad05('0xc')]||!_0x3ada0f[_0xad05('0x21')]||!_0x3ada0f['bucket']){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))]('Transcribe\x20not\x20configured');}return db[_0xad05('0x26')][_0xad05('0x27')]({'where':{'id':_0x3ada0f['transcribeAccountId']}});})[_0xad05('0xd')](function(_0x502f66){if(!_0x502f66){throw new db['Sequelize'][(_0xad05('0x1e'))](_0xad05('0x28'));}if(!_0x502f66[_0xad05('0xb')]||!_0x502f66[_0xad05('0x29')]){throw new db[(_0xad05('0x1d'))][(_0xad05('0x1e'))](_0xad05('0x2a'));}_0x56d036=_0x502f66;var _0x21883b=[];_0x1bc26b[_0xad05('0x45')](function(_0x1cae80){_0x21883b[_0xad05('0x46')](checkTranscribeJob(_0x1cae80,_0x3ada0f,_0x56d036));});return BPromise[_0xad05('0x47')](_0x21883b);})[_0xad05('0x39')](function(_0x496122){if(_0x496122){if(!_0x496122[_0xad05('0x3a')]||_0x496122[_0xad05('0x3a')]!=='SequelizeValidationError'){logger[_0xad05('0x3c')](util['inspect'](_0x496122,{'showHidden':![],'depth':null}));}}});}exports[_0xad05('0x48')]=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 db91e08..5b09520 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 _0x8c7a=['inspect','start','lodash','moment','ioredis','util','../../config/environment','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x8c7a,0x197));var _0xa8c7=function(_0x16a760,_0x463f7f){_0x16a760=_0x16a760-0x0;var _0x223248=_0x8c7a[_0x16a760];return _0x223248;};'use strict';var _=require(_0xa8c7('0x0'));var moment=require(_0xa8c7('0x1'));var Redis=require(_0xa8c7('0x2'));var util=require(_0xa8c7('0x3'));var config=require(_0xa8c7('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0xa8c7('0x5')]=_[_0xa8c7('0x6')](config[_0xa8c7('0x5')],{'host':_0xa8c7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa8c7('0x5')]));function closeInteractions(){var _0x373404=[];return db[_0xa8c7('0x8')][_0xa8c7('0x9')]({'raw':!![],'attributes':['id',_0xa8c7('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xa8c7('0xb'))}}})[_0xa8c7('0xc')](function(_0x19d302){if(_0x19d302&&_0x19d302[_0xa8c7('0xd')]){_0x373404=_[_0xa8c7('0xe')](_0x19d302||[],'id');logger[_0xa8c7('0xf')](_0xa8c7('0x10'),_0x373404[_0xa8c7('0x11')]());return db[_0xa8c7('0x8')][_0xa8c7('0x12')]({'closeReason':_0xa8c7('0x13'),'disposition':_0xa8c7('0x14'),'closed':!![],'closedAt':moment()['format'](_0xa8c7('0x15'))},{'where':{'id':_0x373404}});}})['then'](function(){if(_0x373404&&_0x373404[_0xa8c7('0xd')]){logger['info'](_0xa8c7('0x16'),_0x373404['join']());for(var _0x3496cb=0x0;_0x3496cb<_0x373404['length'];_0x3496cb++){io['emit']('whatsappInteraction:update',{'id':_0x373404[_0x3496cb],'closed':!![]});}}})['catch'](function(_0xb8cd05){logger[_0xa8c7('0x17')](_0xa8c7('0x18'),_0xb8cd05?util[_0xa8c7('0x19')](_0xb8cd05,{'showHidden':![],'depth':null}):'');});}exports[_0xa8c7('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6725=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error'];(function(_0x2eb0c4,_0x3abfe2){var _0x1ec827=function(_0x3a8f8f){while(--_0x3a8f8f){_0x2eb0c4['push'](_0x2eb0c4['shift']());}};_0x1ec827(++_0x3abfe2);}(_0x6725,0x1e3));var _0x5672=function(_0x204ee7,_0x2054a7){_0x204ee7=_0x204ee7-0x0;var _0x3eea1c=_0x6725[_0x204ee7];return _0x3eea1c;};'use strict';var _=require(_0x5672('0x0'));var moment=require(_0x5672('0x1'));var Redis=require('ioredis');var util=require(_0x5672('0x2'));var config=require(_0x5672('0x3'));var db=require(_0x5672('0x4'))['db'];var logger=require(_0x5672('0x5'))(_0x5672('0x6'));config[_0x5672('0x7')]=_[_0x5672('0x8')](config[_0x5672('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5672('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x126d66=[];return db[_0x5672('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x5672('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5672('0xc')](0x18,_0x5672('0xd'))}}})[_0x5672('0xe')](function(_0x2b811e){if(_0x2b811e&&_0x2b811e[_0x5672('0xf')]){_0x126d66=_[_0x5672('0x10')](_0x2b811e||[],'id');logger[_0x5672('0x11')](_0x5672('0x12'),_0x126d66[_0x5672('0x13')]());return db[_0x5672('0xa')][_0x5672('0x14')]({'closeReason':_0x5672('0x15'),'disposition':_0x5672('0x16'),'closed':!![],'closedAt':moment()[_0x5672('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x126d66}});}})['then'](function(){if(_0x126d66&&_0x126d66[_0x5672('0xf')]){logger[_0x5672('0x11')](_0x5672('0x18'),_0x126d66[_0x5672('0x13')]());for(var _0x482dfb=0x0;_0x482dfb<_0x126d66[_0x5672('0xf')];_0x482dfb++){io[_0x5672('0x19')](_0x5672('0x1a'),{'id':_0x126d66[_0x482dfb],'closed':!![]});}}})[_0x5672('0x1b')](function(_0x7eeec7){logger[_0x5672('0x1c')](_0x5672('0x1d'),_0x7eeec7?util[_0x5672('0x1e')](_0x7eeec7,{'showHidden':![],'depth':null}):'');});}exports[_0x5672('0x1f')]=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 fb4b1d6..863a320 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x809c=['now','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x809c,0xe8));var _0xc809=function(_0x17ef77,_0x2c091a){_0x17ef77=_0x17ef77-0x0;var _0x428621=_0x809c[_0x17ef77];return _0x428621;};'use strict';var util=require(_0xc809('0x0'));var db=require(_0xc809('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc809('0x2')]({'id':i,'firstName':_0xc809('0x3')+i,'lastName':_0xc809('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc809('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xc809('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc809('0x6')](),'updatedAt':Date[_0xc809('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc809('0x2')]({'id':i,'firstName':_0xc809('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc809('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc809('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc809('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc809('0x6')](),'updatedAt':Date['now']()});}db[_0xc809('0x7')][_0xc809('0x8')]({'where':{}})[_0xc809('0x9')](function(){return db[_0xc809('0x7')][_0xc809('0xa')](contacts);})['then'](function(){console['log']('finished\x20populating',_0xc809('0xb'));return db['CmHopper'][_0xc809('0x8')]({'where':{}});})[_0xc809('0x9')](function(){return db[_0xc809('0xc')][_0xc809('0xa')](hopper);})[_0xc809('0x9')](function(){console[_0xc809('0xd')](_0xc809('0xe'),'hopper1');return db[_0xc809('0x7')][_0xc809('0xa')](contacts2);})[_0xc809('0x9')](function(){console[_0xc809('0xd')](_0xc809('0xe'),_0xc809('0xf'));return db[_0xc809('0xc')][_0xc809('0xa')](hopper2);})['then'](function(){console[_0xc809('0xd')](_0xc809('0xe'),_0xc809('0x10'));})['catch'](function(_0x26c059){console[_0xc809('0xd')](_0x26c059);}); \ No newline at end of file +var _0x7f56=['Innocenzo','Biondo','CmContact','destroy','then','log','contacts1','CmHopper','finished\x20populating','bulkCreate','hopper2','catch','util','push','innocenzo.biondo','@xcally.com','now'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x7f56,0x14f));var _0x67f5=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x7f56[_0xbf5e16];return _0x5975a5;};'use strict';var util=require(_0x67f5('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x67f5('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x67f5('0x2')+i+_0x67f5('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x67f5('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x67f5('0x5')+i,'lastName':_0x67f5('0x6')+i,'phone':0xf879fb460+i,'email':_0x67f5('0x2')+i+_0x67f5('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x67f5('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x67f5('0x7')][_0x67f5('0x8')]({'where':{}})[_0x67f5('0x9')](function(){return db[_0x67f5('0x7')]['bulkCreate'](contacts);})[_0x67f5('0x9')](function(){console[_0x67f5('0xa')]('finished\x20populating',_0x67f5('0xb'));return db[_0x67f5('0xc')][_0x67f5('0x8')]({'where':{}});})[_0x67f5('0x9')](function(){return db[_0x67f5('0xc')]['bulkCreate'](hopper);})[_0x67f5('0x9')](function(){console[_0x67f5('0xa')](_0x67f5('0xd'),'hopper1');return db['CmContact'][_0x67f5('0xe')](contacts2);})[_0x67f5('0x9')](function(){console[_0x67f5('0xa')](_0x67f5('0xd'),'contacts2');return db[_0x67f5('0xc')][_0x67f5('0xe')](hopper2);})[_0x67f5('0x9')](function(){console[_0x67f5('0xa')](_0x67f5('0xd'),_0x67f5('0xf'));})[_0x67f5('0x10')](function(_0x3fe320){console['log'](_0x3fe320);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index abb9a02..3d31369 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ed7=['format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','../mysqldb','push'];(function(_0x4bc0f3,_0x3912b4){var _0x54788c=function(_0x616380){while(--_0x616380){_0x4bc0f3['push'](_0x4bc0f3['shift']());}};_0x54788c(++_0x3912b4);}(_0x0ed7,0x9e));var _0x70ed=function(_0x4e7af4,_0x758572){_0x4e7af4=_0x4e7af4-0x0;var _0x2548f1=_0x0ed7[_0x4e7af4];return _0x2548f1;};'use strict';var util=require('util');var db=require(_0x70ed('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x70ed('0x1')]({'name':util[_0x70ed('0x2')](_0x70ed('0x3'),_0x70ed('0x4'),i),'fullname':util[_0x70ed('0x2')](_0x70ed('0x3'),'agent',i),'email':util[_0x70ed('0x2')](_0x70ed('0x5'),'agent',i),'role':_0x70ed('0x4'),'password':_0x70ed('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x70ed('0x7'),'ws',_0x70ed('0x8')],'disallow':[_0x70ed('0x9')],'allow':['ulaw'],'defaultuser':util[_0x70ed('0x2')](_0x70ed('0x3'),_0x70ed('0x4'),i),'encryption':_0x70ed('0xa'),'avpf':_0x70ed('0xa'),'force_avp':'yes','icesupport':_0x70ed('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x70ed('0xb'),'dtlsprivatekey':_0x70ed('0xc'),'dtlssetup':_0x70ed('0xd'),'callerid':util['format'](_0x70ed('0xe'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0x70ed('0xf')][_0x70ed('0x10')](users)[_0x70ed('0x11')](function(){console[_0x70ed('0x12')](_0x70ed('0x13'));})['catch'](function(_0x26ba18){console[_0x70ed('0x12')](_0x26ba18);}); \ No newline at end of file +var _0x2139=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','format','%s%s','agent','%s%s@xcally.com','password','friend','udp'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x2139,0x184));var _0x9213=function(_0x57862e,_0x2c787f){_0x57862e=_0x57862e-0x0;var _0x1f44ba=_0x2139[_0x57862e];return _0x1f44ba;};'use strict';var util=require(_0x9213('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x9213('0x1')](_0x9213('0x2'),_0x9213('0x3'),i),'fullname':util['format'](_0x9213('0x2'),_0x9213('0x3'),i),'email':util['format'](_0x9213('0x4'),'agent',i),'role':'agent','password':_0x9213('0x5'),'internal':0xfa0+i,'type':_0x9213('0x6'),'transport':[_0x9213('0x7'),'ws',_0x9213('0x8')],'disallow':[_0x9213('0x9')],'allow':[_0x9213('0xa')],'defaultuser':util[_0x9213('0x1')](_0x9213('0x2'),'agent',i),'encryption':_0x9213('0xb'),'avpf':_0x9213('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x9213('0xb'),'dtlsverify':'no','dtlscertfile':_0x9213('0xc'),'dtlsprivatekey':_0x9213('0xd'),'dtlssetup':_0x9213('0xe'),'callerid':util[_0x9213('0x1')](_0x9213('0xf'),util[_0x9213('0x1')](_0x9213('0x2'),_0x9213('0x3'),i),0xfa0+i)});}db[_0x9213('0x10')][_0x9213('0x11')](users)[_0x9213('0x12')](function(){console[_0x9213('0x13')](_0x9213('0x14'));})[_0x9213('0x15')](function(_0x42d51e){console[_0x9213('0x13')](_0x42d51e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6980a6d..8f2e618 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c99=['VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','map','where','Campaign','format','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','user','voice:outbound','FaxQueue','SmsQueues','WhatsappQueue','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','leave','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','bluebird','Agents','User','role','agent','telephone','name','type','ivr','UserProfileSection','findOne','then'];(function(_0x315180,_0x1178c7){var _0x10194a=function(_0x2cbc56){while(--_0x2cbc56){_0x315180['push'](_0x315180['shift']());}};_0x10194a(++_0x1178c7);}(_0x4c99,0x1ec));var _0x94c9=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4c99[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var BPromise=require(_0x94c9('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x94c9('0x2'),'model':db[_0x94c9('0x3')],'attributes':['id','name',_0x94c9('0x4')],'raw':!![],'where':{'role':_0x94c9('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x94c9('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x94c9('0x7'),_0x94c9('0x8')],'where':{'type':_0x94c9('0x9')}};function getAssociatedResources(_0x53bd2d,_0xecc387,_0x1c0983){return db[_0x94c9('0xa')][_0x94c9('0xb')]({'where':{'name':_0x53bd2d,'userProfileId':_0xecc387},'raw':!![]})[_0x94c9('0xc')](function(_0x284f39){if(_0x284f39){if(_0x284f39['autoAssociation']){switch(_0x53bd2d){case _0x94c9('0xd'):case _0x94c9('0xe'):case _0x94c9('0xf'):case'SmsQueues':case _0x94c9('0x10'):case _0x94c9('0x11'):case _0x94c9('0x12'):return db[_0x1c0983][_0x94c9('0x13')](queryQueues);case _0x94c9('0x14'):return db[_0x1c0983][_0x94c9('0x13')](queryTelephones);case _0x94c9('0x15'):return db[_0x1c0983][_0x94c9('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x1c0983]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x94c9('0x13')]({'attributes':[_0x94c9('0x16')],'where':{'sectionId':_0x284f39['id']},'raw':!![]})['then'](function(_0x210709){if(_0x210709){var _0x3abfa5={'where':{'id':_[_0x94c9('0x17')](_0x210709,'resourceId')},'raw':!![]};switch(_0x1c0983){case'User':_0x3abfa5[_0x94c9('0x18')][_0x94c9('0x4')]=_0x94c9('0x6');break;case _0x94c9('0x19'):_0x3abfa5['where'][_0x94c9('0x8')]=_0x94c9('0x9');break;}return db[_0x1c0983][_0x94c9('0x13')](_0x3abfa5);}else{return[];}});}}else{return[];}})[_0x94c9('0xc')](function(_0x30a237){return _0x30a237;});}function joinOrLeaveQueues(_0xf48950,_0x443d7d,_0x564c99,_0x256614){_0xf48950[_0x443d7d](util[_0x94c9('0x1a')]('%s:queue:%s',_0x564c99,_0x256614[_0x94c9('0x7')]));if(_0x256614[_0x94c9('0x2')]){for(var _0x114828=0x0;_0x114828<_0x256614[_0x94c9('0x2')][_0x94c9('0x1b')];_0x114828+=0x1){_0xf48950[_0x443d7d](util[_0x94c9('0x1a')](_0x94c9('0x1c'),_0x256614[_0x94c9('0x2')][_0x114828][_0x94c9('0x7')]));}}}function joinOrLeave(_0x39890b,_0x553196,_0x2f20bd){var _0x50ee41;if(_0x39890b[_0x94c9('0x1d')]['query']['id']){db[_0x94c9('0x3')][_0x94c9('0x1e')]({'attributes':['id',_0x94c9('0x7'),_0x94c9('0x4'),_0x94c9('0x1f')],'where':{'id':_0x39890b[_0x94c9('0x1d')]['query']['id']},'include':[{'model':db[_0x94c9('0x20')],'as':_0x94c9('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x94c9('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x94c9('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x94c9('0x24')],'as':_0x94c9('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x94c9('0x26')],'as':_0x94c9('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x94c9('0x28')],'as':_0x94c9('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x3ab136){if(_0x3ab136){_0x50ee41=_0x3ab136;_0x39890b[_0x553196](util[_0x94c9('0x1a')](_0x94c9('0x1c'),_0x3ab136['name']));var _0x3df4d6=[];switch(_0x3ab136[_0x94c9('0x4')]){case _0x94c9('0x2a'):_0x39890b[_0x553196](_0x94c9('0x2b'));_0x39890b[_0x553196]('voice:outbound');if(queryQueues[_0x94c9('0x2c')](_0x94c9('0x2d'))){delete queryQueues['include'];}_0x3df4d6[_0x94c9('0x2e')](db[_0x94c9('0x2f')][_0x94c9('0x13')](queryQueues));_0x3df4d6[_0x94c9('0x2e')](db[_0x94c9('0x30')][_0x94c9('0x13')](queryQueues));_0x3df4d6[_0x94c9('0x2e')](db['FaxQueue'][_0x94c9('0x13')](queryQueues));_0x3df4d6[_0x94c9('0x2e')](db[_0x94c9('0x31')][_0x94c9('0x13')](queryQueues));_0x3df4d6['push'](db[_0x94c9('0x32')][_0x94c9('0x13')](queryQueues));_0x3df4d6['push'](db[_0x94c9('0x33')][_0x94c9('0x13')](queryQueues));_0x3df4d6[_0x94c9('0x2e')](db['WhatsappQueue'][_0x94c9('0x13')](queryQueues));_0x3df4d6[_0x94c9('0x2e')](db['User'][_0x94c9('0x13')](queryTelephones));_0x3df4d6['push'](db['Trunk'][_0x94c9('0x13')](queryTrunks));_0x3df4d6['push'](db[_0x94c9('0x19')][_0x94c9('0x13')](queryCampaigns));_0x3df4d6[_0x94c9('0x2e')](db[_0x94c9('0x3')][_0x94c9('0x13')](queryAgents));break;case _0x94c9('0x34'):_0x39890b[_0x553196]('voice:inbound');_0x39890b[_0x553196](_0x94c9('0x35'));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0xd'),_0x3ab136[_0x94c9('0x1f')],'VoiceQueue'));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0xe'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x30')));_0x3df4d6['push'](getAssociatedResources(_0x94c9('0xf'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x36')));_0x3df4d6['push'](getAssociatedResources(_0x94c9('0x37'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x31')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x10'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x32')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x11'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x33')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x12'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x38')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x14'),_0x3ab136[_0x94c9('0x1f')],_0x94c9('0x3')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x15'),_0x3ab136['userProfileId'],_0x94c9('0x39')));_0x3df4d6[_0x94c9('0x2e')](getAssociatedResources(_0x94c9('0x3a'),_0x3ab136['userProfileId'],_0x94c9('0x19')));_0x3df4d6['push'](db[_0x94c9('0x3')][_0x94c9('0x13')](queryAgents));break;case _0x94c9('0x5'):_0x39890b[_0x553196]('voice:inbound');_0x39890b[_0x553196](_0x94c9('0x35'));_0x3df4d6['push'](_0x3ab136[_0x94c9('0x3b')]({'attributes':['id',_0x94c9('0x7')]}));_0x3df4d6[_0x94c9('0x2e')](_0x3ab136[_0x94c9('0x3c')]({'attributes':['id',_0x94c9('0x7')]}));_0x3df4d6[_0x94c9('0x2e')](_0x3ab136['getFaxQueues']({'attributes':['id','name']}));_0x3df4d6['push'](_0x3ab136[_0x94c9('0x3d')]({'attributes':['id',_0x94c9('0x7')]}));_0x3df4d6[_0x94c9('0x2e')](_0x3ab136['getMailQueues']({'attributes':['id',_0x94c9('0x7')]}));_0x3df4d6['push'](_0x3ab136[_0x94c9('0x3e')]({'attributes':['id',_0x94c9('0x7')]}));_0x3df4d6[_0x94c9('0x2e')](_0x3ab136[_0x94c9('0x3f')]({'attributes':['id',_0x94c9('0x7')]}));break;}return BPromise[_0x94c9('0x40')](_0x3df4d6);}})[_0x94c9('0xc')](function(_0x52ca34){if(_0x52ca34&&_0x52ca34[_0x94c9('0x1b')]){for(var _0x4b68c5=0x0;_0x4b68c5<_0x52ca34[_0x94c9('0x1b')];_0x4b68c5+=0x1){for(var _0x3abb40=0x0;_0x3abb40<_0x52ca34[_0x4b68c5][_0x94c9('0x1b')];_0x3abb40+=0x1){switch(_0x4b68c5){case 0x0:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x41'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x1:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x42'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x2:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x43'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x3:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x44'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x4:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x45'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x5:joinOrLeaveQueues(_0x39890b,_0x553196,'openchannel',_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x6:joinOrLeaveQueues(_0x39890b,_0x553196,_0x94c9('0x46'),_0x52ca34[_0x4b68c5][_0x3abb40]);break;case 0x7:if(_0x50ee41[_0x94c9('0x4')]!==_0x94c9('0x5'))_0x39890b[_0x553196](util[_0x94c9('0x1a')](_0x94c9('0x47'),_0x52ca34[_0x4b68c5][_0x3abb40]['name']));break;case 0x8:if(_0x50ee41[_0x94c9('0x4')]!==_0x94c9('0x5'))_0x39890b[_0x553196](util['format'](_0x94c9('0x48'),_0x52ca34[_0x4b68c5][_0x3abb40]['name']));break;case 0x9:if(_0x50ee41[_0x94c9('0x4')]!=='agent')_0x39890b[_0x553196](util['format'](_0x94c9('0x49'),_0x52ca34[_0x4b68c5][_0x3abb40]['type'],_0x52ca34[_0x4b68c5][_0x3abb40][_0x94c9('0x7')]));break;case 0xa:_0x39890b[_0x553196](util['format'](_0x94c9('0x1c'),_0x52ca34[_0x4b68c5][_0x3abb40][_0x94c9('0x7')]));break;}}}}})[_0x94c9('0xc')](function(){if(_0x553196==='leave'){var _0x1651c6=_[_0x94c9('0x17')](_0x50ee41[_0x94c9('0x21')],'id');return _0x50ee41[_0x94c9('0x4a')](_0x1651c6)[_0x94c9('0xc')](function(){for(var _0x4de9b6=0x0;_0x4de9b6<_0x1651c6['length'];_0x4de9b6+=0x1){_0x2f20bd[_0x94c9('0x4b')](_0x94c9('0x4c'),{'ChatInteractionId':Number(_0x1651c6[_0x4de9b6]),'UserId':Number(_0x50ee41['id'])});}});}})[_0x94c9('0xc')](function(){if(_0x553196==='leave'){var _0x433b6e=_[_0x94c9('0x17')](_0x50ee41[_0x94c9('0x4d')],'id');return _0x50ee41['removeMailInteractions'](_0x433b6e)[_0x94c9('0xc')](function(){for(var _0x866e9b=0x0;_0x866e9b<_0x433b6e[_0x94c9('0x1b')];_0x866e9b+=0x1){_0x2f20bd[_0x94c9('0x4b')](_0x94c9('0x4e'),{'MailInteractionId':Number(_0x433b6e[_0x866e9b]),'UserId':Number(_0x50ee41['id'])});}});}})[_0x94c9('0xc')](function(){if(_0x553196===_0x94c9('0x4f')){var _0x658223=_['map'](_0x50ee41[_0x94c9('0x50')],'id');return _0x50ee41[_0x94c9('0x51')](_0x658223)[_0x94c9('0xc')](function(){for(var _0x58fee3=0x0;_0x58fee3<_0x658223['length'];_0x58fee3+=0x1){_0x2f20bd['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x658223[_0x58fee3]),'UserId':Number(_0x50ee41['id'])});}});}})['then'](function(){if(_0x553196===_0x94c9('0x4f')){var _0x262bc1=_[_0x94c9('0x17')](_0x50ee41[_0x94c9('0x25')],'id');return _0x50ee41[_0x94c9('0x52')](_0x262bc1)['then'](function(){for(var _0xe9cc6a=0x0;_0xe9cc6a<_0x262bc1[_0x94c9('0x1b')];_0xe9cc6a+=0x1){_0x2f20bd[_0x94c9('0x4b')](_0x94c9('0x53'),{'SmsInteractionId':Number(_0x262bc1[_0xe9cc6a]),'UserId':Number(_0x50ee41['id'])});}});}})[_0x94c9('0xc')](function(){if(_0x553196==='leave'){var _0x4a31b9=_['map'](_0x50ee41[_0x94c9('0x27')],'id');return _0x50ee41['removeOpenchannelInteractions'](_0x4a31b9)[_0x94c9('0xc')](function(){for(var _0x10c453=0x0;_0x10c453<_0x4a31b9[_0x94c9('0x1b')];_0x10c453+=0x1){_0x2f20bd[_0x94c9('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4a31b9[_0x10c453]),'UserId':Number(_0x50ee41['id'])});}});}})[_0x94c9('0xc')](function(){if(_0x553196===_0x94c9('0x4f')){var _0xeb01fb=_[_0x94c9('0x17')](_0x50ee41[_0x94c9('0x29')],'id');return _0x50ee41[_0x94c9('0x54')](_0xeb01fb)[_0x94c9('0xc')](function(){for(var _0x20b881=0x0;_0x20b881<_0xeb01fb[_0x94c9('0x1b')];_0x20b881+=0x1){_0x2f20bd[_0x94c9('0x4b')](_0x94c9('0x55'),{'WhatsappInteractionId':Number(_0xeb01fb[_0x20b881]),'UserId':Number(_0x50ee41['id'])});}});}})[_0x94c9('0x56')](function(_0x226d18){_0x39890b[_0x94c9('0x57')](_0x226d18);});}}function onDisconnect(_0x189c3d,_0x535b43){joinOrLeave(_0x189c3d,_0x94c9('0x4f'),_0x535b43);}function onConnect(_0x7f4eb8){joinOrLeave(_0x7f4eb8,_0x94c9('0x58'));}exports[_0x94c9('0x59')]=function(_0x4728c0){_0x4728c0['on'](_0x94c9('0x5a'),function(_0x37b808){_0x37b808[_0x94c9('0x5b')](0x0);_0x37b808[_0x94c9('0x5c')]=_0x37b808[_0x94c9('0x5d')][_0x94c9('0x5a')][_0x94c9('0x5e')]+':'+_0x37b808[_0x94c9('0x5d')][_0x94c9('0x5a')][_0x94c9('0x5f')];_0x37b808[_0x94c9('0x60')]=new Date();_0x37b808['log']=function(_0x449592){console[_0x94c9('0x57')](_0x94c9('0x61')+_0x37b808[_0x94c9('0x62')]['name']+'['+_0x37b808['address']+']',_0x449592);};_0x37b808['on'](_0x94c9('0x63'),function(){onDisconnect(_0x37b808,_0x4728c0);_0x37b808[_0x94c9('0x57')](_0x94c9('0x64'));});onConnect(_0x37b808);_0x37b808[_0x94c9('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x1a2a=['address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','agent','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','format','length','user:%s','handshake','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueue','ChatQueue','OpenchannelQueue','voice:outbound','getVoiceQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners'];(function(_0x45bdad,_0x51ae19){var _0x5fa0ce=function(_0x4ed76a){while(--_0x4ed76a){_0x45bdad['push'](_0x45bdad['shift']());}};_0x5fa0ce(++_0x51ae19);}(_0x1a2a,0xd3));var _0xa1a2=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x1a2a[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0xa1a2('0x0'));var util=require(_0xa1a2('0x1'));var BPromise=require(_0xa1a2('0x2'));var db=require(_0xa1a2('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xa1a2('0x4')],'include':[{'as':_0xa1a2('0x5'),'model':db['User'],'attributes':['id',_0xa1a2('0x4'),_0xa1a2('0x6')],'raw':!![],'where':{'role':_0xa1a2('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa1a2('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xa1a2('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa1a2('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xa1a2('0x8')],'where':{'type':_0xa1a2('0x9')}};function getAssociatedResources(_0x30c8ff,_0x238546,_0x26f003){return db[_0xa1a2('0xa')]['findOne']({'where':{'name':_0x30c8ff,'userProfileId':_0x238546},'raw':!![]})[_0xa1a2('0xb')](function(_0x3436e4){if(_0x3436e4){if(_0x3436e4[_0xa1a2('0xc')]){switch(_0x30c8ff){case _0xa1a2('0xd'):case _0xa1a2('0xe'):case _0xa1a2('0xf'):case _0xa1a2('0x10'):case _0xa1a2('0x11'):case _0xa1a2('0x12'):case'WhatsappQueues':return db[_0x26f003][_0xa1a2('0x13')](queryQueues);case _0xa1a2('0x14'):return db[_0x26f003][_0xa1a2('0x13')](queryTelephones);case _0xa1a2('0x15'):return db[_0x26f003][_0xa1a2('0x13')](queryTrunks);case _0xa1a2('0x16'):return db[_0x26f003][_0xa1a2('0x13')](queryCampaigns);}}else{return db[_0xa1a2('0x17')][_0xa1a2('0x13')]({'attributes':[_0xa1a2('0x18')],'where':{'sectionId':_0x3436e4['id']},'raw':!![]})['then'](function(_0x29084a){if(_0x29084a){var _0x2c494c={'where':{'id':_['map'](_0x29084a,'resourceId')},'raw':!![]};switch(_0x26f003){case _0xa1a2('0x19'):_0x2c494c[_0xa1a2('0x1a')][_0xa1a2('0x6')]='telephone';break;case _0xa1a2('0x1b'):_0x2c494c[_0xa1a2('0x1a')]['type']=_0xa1a2('0x9');break;}return db[_0x26f003][_0xa1a2('0x13')](_0x2c494c);}else{return[];}});}}else{return[];}})[_0xa1a2('0xb')](function(_0x2d38e0){return _0x2d38e0;});}function joinOrLeaveQueues(_0x40fe8e,_0x45a131,_0x130701,_0x6d63ea){_0x40fe8e[_0x45a131](util[_0xa1a2('0x1c')]('%s:queue:%s',_0x130701,_0x6d63ea[_0xa1a2('0x4')]));if(_0x6d63ea[_0xa1a2('0x5')]){for(var _0x24c007=0x0;_0x24c007<_0x6d63ea[_0xa1a2('0x5')][_0xa1a2('0x1d')];_0x24c007+=0x1){_0x40fe8e[_0x45a131](util[_0xa1a2('0x1c')](_0xa1a2('0x1e'),_0x6d63ea['Agents'][_0x24c007]['name']));}}}function joinOrLeave(_0x2ff9f8,_0x4e3a36,_0x1b8e7b){var _0x184e6b;if(_0x2ff9f8[_0xa1a2('0x1f')]['query']['id']){db[_0xa1a2('0x19')][_0xa1a2('0x20')]({'attributes':['id',_0xa1a2('0x4'),'role',_0xa1a2('0x21')],'where':{'id':_0x2ff9f8[_0xa1a2('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xa1a2('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1a2('0x23')],'as':_0xa1a2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1a2('0x25')],'as':_0xa1a2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1a2('0x27')],'as':_0xa1a2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1a2('0x29')],'as':_0xa1a2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1a2('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xa1a2('0xb')](function(_0x4f801d){if(_0x4f801d){_0x184e6b=_0x4f801d;_0x2ff9f8[_0x4e3a36](util['format']('user:%s',_0x4f801d[_0xa1a2('0x4')]));var _0x25bbc0=[];switch(_0x4f801d[_0xa1a2('0x6')]){case _0xa1a2('0x2c'):_0x2ff9f8[_0x4e3a36]('voice:inbound');_0x2ff9f8[_0x4e3a36]('voice:outbound');if(queryQueues[_0xa1a2('0x2d')](_0xa1a2('0x2e'))){delete queryQueues[_0xa1a2('0x2e')];}_0x25bbc0[_0xa1a2('0x2f')](db['VoiceQueue'][_0xa1a2('0x13')](queryQueues));_0x25bbc0['push'](db['ChatQueue']['findAll'](queryQueues));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x30')][_0xa1a2('0x13')](queryQueues));_0x25bbc0['push'](db[_0xa1a2('0x31')]['findAll'](queryQueues));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x32')]['findAll'](queryQueues));_0x25bbc0[_0xa1a2('0x2f')](db['OpenchannelQueue']['findAll'](queryQueues));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x33')][_0xa1a2('0x13')](queryQueues));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x19')][_0xa1a2('0x13')](queryTelephones));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x34')][_0xa1a2('0x13')](queryTrunks));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x1b')]['findAll'](queryCampaigns));_0x25bbc0[_0xa1a2('0x2f')](db[_0xa1a2('0x19')][_0xa1a2('0x13')](queryAgents));break;case _0xa1a2('0x35'):_0x2ff9f8[_0x4e3a36](_0xa1a2('0x36'));_0x2ff9f8[_0x4e3a36]('voice:outbound');_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0xd'),_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x37')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0xe'),_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x38')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0xf'),_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x30')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0x10'),_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x31')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources('MailQueues',_0x4f801d['userProfileId'],_0xa1a2('0x32')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources('OpenchannelQueues',_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x39')));_0x25bbc0['push'](getAssociatedResources('WhatsappQueues',_0x4f801d['userProfileId'],_0xa1a2('0x33')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0x14'),_0x4f801d[_0xa1a2('0x21')],'User'));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0x15'),_0x4f801d[_0xa1a2('0x21')],_0xa1a2('0x34')));_0x25bbc0[_0xa1a2('0x2f')](getAssociatedResources(_0xa1a2('0x16'),_0x4f801d['userProfileId'],'Campaign'));_0x25bbc0['push'](db['User'][_0xa1a2('0x13')](queryAgents));break;case _0xa1a2('0x7'):_0x2ff9f8[_0x4e3a36]('voice:inbound');_0x2ff9f8[_0x4e3a36](_0xa1a2('0x3a'));_0x25bbc0['push'](_0x4f801d[_0xa1a2('0x3b')]({'attributes':['id','name']}));_0x25bbc0[_0xa1a2('0x2f')](_0x4f801d['getChatQueues']({'attributes':['id',_0xa1a2('0x4')]}));_0x25bbc0[_0xa1a2('0x2f')](_0x4f801d[_0xa1a2('0x3c')]({'attributes':['id','name']}));_0x25bbc0['push'](_0x4f801d[_0xa1a2('0x3d')]({'attributes':['id',_0xa1a2('0x4')]}));_0x25bbc0[_0xa1a2('0x2f')](_0x4f801d['getMailQueues']({'attributes':['id','name']}));_0x25bbc0[_0xa1a2('0x2f')](_0x4f801d['getOpenchannelQueues']({'attributes':['id','name']}));_0x25bbc0['push'](_0x4f801d[_0xa1a2('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0xa1a2('0x3f')](_0x25bbc0);}})['then'](function(_0x3d4cb8){if(_0x3d4cb8&&_0x3d4cb8['length']){for(var _0x19f2e4=0x0;_0x19f2e4<_0x3d4cb8[_0xa1a2('0x1d')];_0x19f2e4+=0x1){for(var _0x5206da=0x0;_0x5206da<_0x3d4cb8[_0x19f2e4][_0xa1a2('0x1d')];_0x5206da+=0x1){switch(_0x19f2e4){case 0x0:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x40'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x1:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x41'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x2:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x42'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x3:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x43'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x4:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x44'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x5:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,'openchannel',_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x6:joinOrLeaveQueues(_0x2ff9f8,_0x4e3a36,_0xa1a2('0x45'),_0x3d4cb8[_0x19f2e4][_0x5206da]);break;case 0x7:if(_0x184e6b['role']!==_0xa1a2('0x7'))_0x2ff9f8[_0x4e3a36](util['format'](_0xa1a2('0x46'),_0x3d4cb8[_0x19f2e4][_0x5206da][_0xa1a2('0x4')]));break;case 0x8:if(_0x184e6b[_0xa1a2('0x6')]!==_0xa1a2('0x7'))_0x2ff9f8[_0x4e3a36](util[_0xa1a2('0x1c')]('trunk:%s',_0x3d4cb8[_0x19f2e4][_0x5206da][_0xa1a2('0x4')]));break;case 0x9:if(_0x184e6b[_0xa1a2('0x6')]!=='agent')_0x2ff9f8[_0x4e3a36](util[_0xa1a2('0x1c')]('campaign:%s:%s',_0x3d4cb8[_0x19f2e4][_0x5206da]['type'],_0x3d4cb8[_0x19f2e4][_0x5206da][_0xa1a2('0x4')]));break;case 0xa:_0x2ff9f8[_0x4e3a36](util[_0xa1a2('0x1c')](_0xa1a2('0x1e'),_0x3d4cb8[_0x19f2e4][_0x5206da][_0xa1a2('0x4')]));break;}}}}})['then'](function(){if(_0x4e3a36===_0xa1a2('0x47')){var _0x55cfbb=_[_0xa1a2('0x48')](_0x184e6b[_0xa1a2('0x22')],'id');return _0x184e6b[_0xa1a2('0x49')](_0x55cfbb)[_0xa1a2('0xb')](function(){for(var _0x491284=0x0;_0x491284<_0x55cfbb[_0xa1a2('0x1d')];_0x491284+=0x1){_0x1b8e7b['emit'](_0xa1a2('0x4a'),{'ChatInteractionId':Number(_0x55cfbb[_0x491284]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0xb')](function(){if(_0x4e3a36===_0xa1a2('0x47')){var _0x14fe6c=_['map'](_0x184e6b[_0xa1a2('0x24')],'id');return _0x184e6b[_0xa1a2('0x4b')](_0x14fe6c)[_0xa1a2('0xb')](function(){for(var _0x30bbe0=0x0;_0x30bbe0<_0x14fe6c[_0xa1a2('0x1d')];_0x30bbe0+=0x1){_0x1b8e7b[_0xa1a2('0x4c')](_0xa1a2('0x4d'),{'MailInteractionId':Number(_0x14fe6c[_0x30bbe0]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0xb')](function(){if(_0x4e3a36==='leave'){var _0x231dfa=_[_0xa1a2('0x48')](_0x184e6b['FaxInteractions'],'id');return _0x184e6b[_0xa1a2('0x4e')](_0x231dfa)[_0xa1a2('0xb')](function(){for(var _0x57284f=0x0;_0x57284f<_0x231dfa['length'];_0x57284f+=0x1){_0x1b8e7b['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x231dfa[_0x57284f]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0xb')](function(){if(_0x4e3a36==='leave'){var _0x2ab557=_['map'](_0x184e6b['SmsInteractions'],'id');return _0x184e6b[_0xa1a2('0x4f')](_0x2ab557)['then'](function(){for(var _0x2e738f=0x0;_0x2e738f<_0x2ab557['length'];_0x2e738f+=0x1){_0x1b8e7b[_0xa1a2('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2ab557[_0x2e738f]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0xb')](function(){if(_0x4e3a36==='leave'){var _0x34ad26=_[_0xa1a2('0x48')](_0x184e6b['OpenchannelInteractions'],'id');return _0x184e6b[_0xa1a2('0x50')](_0x34ad26)[_0xa1a2('0xb')](function(){for(var _0x3352a4=0x0;_0x3352a4<_0x34ad26[_0xa1a2('0x1d')];_0x3352a4+=0x1){_0x1b8e7b['emit'](_0xa1a2('0x51'),{'OpenchannelInteractionId':Number(_0x34ad26[_0x3352a4]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0xb')](function(){if(_0x4e3a36===_0xa1a2('0x47')){var _0x1a1d16=_[_0xa1a2('0x48')](_0x184e6b[_0xa1a2('0x52')],'id');return _0x184e6b[_0xa1a2('0x53')](_0x1a1d16)[_0xa1a2('0xb')](function(){for(var _0x324de1=0x0;_0x324de1<_0x1a1d16['length'];_0x324de1+=0x1){_0x1b8e7b[_0xa1a2('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1a1d16[_0x324de1]),'UserId':Number(_0x184e6b['id'])});}});}})[_0xa1a2('0x54')](function(_0xd11dc7){_0x2ff9f8['log'](_0xd11dc7);});}}function onDisconnect(_0x2b4b77,_0x55adf9){joinOrLeave(_0x2b4b77,_0xa1a2('0x47'),_0x55adf9);}function onConnect(_0x436764){joinOrLeave(_0x436764,_0xa1a2('0x55'));}exports[_0xa1a2('0x56')]=function(_0x5e1351){_0x5e1351['on'](_0xa1a2('0x57'),function(_0x4da7e7){_0x4da7e7[_0xa1a2('0x58')](0x0);_0x4da7e7[_0xa1a2('0x59')]=_0x4da7e7[_0xa1a2('0x5a')]['connection'][_0xa1a2('0x5b')]+':'+_0x4da7e7[_0xa1a2('0x5a')][_0xa1a2('0x57')][_0xa1a2('0x5c')];_0x4da7e7[_0xa1a2('0x5d')]=new Date();_0x4da7e7[_0xa1a2('0x5e')]=function(_0x9189c1){console['log'](_0xa1a2('0x5f')+_0x4da7e7[_0xa1a2('0x60')][_0xa1a2('0x4')]+'['+_0x4da7e7[_0xa1a2('0x59')]+']',_0x9189c1);};_0x4da7e7['on'](_0xa1a2('0x61'),function(){onDisconnect(_0x4da7e7,_0x5e1351);_0x4da7e7['log'](_0xa1a2('0x62'));});onConnect(_0x4da7e7);_0x4da7e7[_0xa1a2('0x5e')](_0xa1a2('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 28b2b76..fd8779c 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 _0x1e41=['WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','name','channel','outgoingmessage','AfterCreateMessage','event','offlineMessage','agent','closed','substatus','contact','interface','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','../../mysqldb','../logger','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsMessage','Whatsapp','WhatsappInteraction'];(function(_0x56fc8,_0x5e0f03){var _0x4c6156=function(_0x5d2a9b){while(--_0x5d2a9b){_0x56fc8['push'](_0x56fc8['shift']());}};_0x4c6156(++_0x5e0f03);}(_0x1e41,0x7c));var _0x11e4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1e41[_0x432682];return _0x463d05;};'use strict';var util=require('util');var db=require(_0x11e4('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x11e4('0x1'))(_0x11e4('0x2'));var client=jayson['client'][_0x11e4('0x3')]({'port':0x232a});var triggers=[{'channel':_0x11e4('0x4'),'model':_0x11e4('0x5'),'event':_0x11e4('0x6'),'condition':_0x11e4('0x7'),'callback':afterCreate},{'channel':_0x11e4('0x4'),'model':_0x11e4('0x5'),'event':_0x11e4('0x8'),'condition':_0x11e4('0x9'),'callback':afterUpdate},{'channel':_0x11e4('0x4'),'model':_0x11e4('0xa'),'event':'afterCreate','condition':_0x11e4('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0x11e4('0x6'),'condition':_0x11e4('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x11e4('0xc'),'model':'SmsInteraction','event':_0x11e4('0x6'),'condition':_0x11e4('0x7'),'callback':afterCreate},{'channel':_0x11e4('0xc'),'model':'SmsInteraction','event':_0x11e4('0x8'),'condition':_0x11e4('0x9'),'callback':afterUpdate},{'channel':_0x11e4('0xc'),'model':_0x11e4('0xd'),'event':_0x11e4('0x6'),'condition':_0x11e4('0xb'),'callback':afterCreateMessage},{'channel':_0x11e4('0xe'),'model':'WhatsappInteraction','event':_0x11e4('0x6'),'condition':_0x11e4('0x7'),'callback':afterCreate},{'channel':_0x11e4('0xe'),'model':_0x11e4('0xf'),'event':_0x11e4('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x11e4('0xe'),'model':_0x11e4('0x10'),'event':_0x11e4('0x6'),'condition':_0x11e4('0xb'),'callback':afterCreateMessage},{'channel':_0x11e4('0x11'),'model':_0x11e4('0x12'),'event':_0x11e4('0x6'),'condition':_0x11e4('0x7'),'callback':afterCreate},{'channel':_0x11e4('0x11'),'model':'FaxInteraction','event':_0x11e4('0x8'),'condition':_0x11e4('0x9'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x11e4('0x6'),'condition':_0x11e4('0xb'),'callback':afterCreateMessage},{'channel':_0x11e4('0x13'),'model':_0x11e4('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x11e4('0x13'),'model':_0x11e4('0x14'),'event':_0x11e4('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x11e4('0x13'),'model':_0x11e4('0x15'),'event':_0x11e4('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x11e4('0x16'),'event':_0x11e4('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x11e4('0x17'),'model':_0x11e4('0x16'),'event':_0x11e4('0x8'),'condition':_0x11e4('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x11e4('0x18'),'event':_0x11e4('0x6'),'condition':_0x11e4('0xb'),'callback':afterCreateMessage}];function request(_0x51cca4){return client['request'](_0x11e4('0x19'),_0x51cca4)[_0x11e4('0x1a')](function(_0x308171){logger[_0x11e4('0x1b')](_0x11e4('0x1c'),_0x11e4('0x19'),_0x308171);if(_0x308171[_0x11e4('0x1d')]){if(_0x308171[_0x11e4('0x1d')][_0x11e4('0x1e')]===0x1f4){logger[_0x11e4('0x1d')](_0x11e4('0x1c'),'EventManager',_0x308171[_0x11e4('0x1d')]);}}})[_0x11e4('0x1f')](function(_0x176302){logger['error']('Trigger,\x20%s',_0x11e4('0x19'),_0x176302);});}function afterCreateMessage(_0x578cd1){return function(_0x3bf32d){_0x3bf32d=_0x3bf32d[_0x11e4('0x20')]({'plain':!![]});_0x3bf32d['channel']=_0x578cd1;_0x3bf32d[_0x11e4('0x21')]=_0x578cd1;_0x3bf32d['event']=_0x3bf32d[_0x11e4('0x22')];Promise[_0x11e4('0x23')]()[_0x11e4('0x1a')](function(){if(typeof _0x3bf32d[_0x11e4('0x24')]===_0x11e4('0x25'))return null;var _0x2994b2=_0x11e4('0x26')+_0x3bf32d[_0x11e4('0x24')];return db[_0x11e4('0x27')][_0x11e4('0x28')](_0x2994b2,{'type':db[_0x11e4('0x29')][_0x11e4('0x2a')][_0x11e4('0x2b')],'raw':!![]});})[_0x11e4('0x1a')](function(_0x17290e){if(_0x17290e){_0x3bf32d['contact']=_0x17290e[0x0];}if(typeof _0x3bf32d[_0x11e4('0x2c')]===_0x11e4('0x25'))return;return getAgent(_0x3bf32d[_0x11e4('0x2c')]);})[_0x11e4('0x1a')](function(_0x43be23){if(_0x43be23){_0x3bf32d['interface']=util[_0x11e4('0x2d')](_0x11e4('0x2e'),_0x43be23[_0x11e4('0x2f')]);_0x3bf32d['agent']=_0x43be23;_0x3bf32d[_0x11e4('0x30')]=_0x578cd1;return request({'event':'incomingmessage','message':_0x3bf32d});}else{return request({'event':_0x11e4('0x31'),'message':_0x3bf32d});}})[_0x11e4('0x1f')](function(_0x44b0c6){logger['error'](_0x11e4('0x1c'),_0x11e4('0x32'),_0x44b0c6);});};}function afterCreateOfflineMessage(_0x4f0090){return function(_0x105da6){_0x105da6=_0x105da6['get']({'plain':!![]});_0x105da6[_0x11e4('0x30')]=_0x4f0090;_0x105da6[_0x11e4('0x21')]=_0x4f0090;_0x105da6[_0x11e4('0x33')]=_0x11e4('0x34');return request({'event':_0x105da6[_0x11e4('0x33')],'message':_0x105da6});};}function afterCreate(_0x537751,_0x83a1ec){return function(_0x3a7319){_0x3a7319=_0x3a7319[_0x11e4('0x20')]({'plain':!![]});_0x3a7319[_0x11e4('0x30')]=_0x537751;_0x3a7319['motionChannel']=_0x537751;_0x3a7319[_0x11e4('0x33')]='opened';Promise['resolve']()[_0x11e4('0x1a')](function(){var _0xf183c=_0x11e4('0x26')+_0x3a7319[_0x11e4('0x24')];return db[_0x11e4('0x27')][_0x11e4('0x28')](_0xf183c,{'type':db[_0x11e4('0x29')][_0x11e4('0x2a')]['SELECT'],'raw':!![]});})[_0x11e4('0x1a')](function(_0x9cce59){if(_0x9cce59){_0x3a7319['contact']=_0x9cce59[0x0];}if(typeof _0x3a7319[_0x11e4('0x2c')]===_0x11e4('0x25'))return;return getAgent(_0x3a7319[_0x11e4('0x2c')]);})['then'](function(_0x328aa7){if(_0x328aa7){_0x3a7319['interface']=util[_0x11e4('0x2d')](_0x11e4('0x2e'),_0x328aa7['name']);_0x3a7319[_0x11e4('0x35')]=_0x328aa7;}return request({'event':_0x83a1ec,'message':_0x3a7319});})[_0x11e4('0x1f')](function(_0x1fb593){logger[_0x11e4('0x1d')](_0x11e4('0x1c'),'AfterCreate',_0x1fb593);});};}function afterUpdate(_0x43204f){return function(_0x38e194){var _0x93620d=_0x38e194['changed'](_0x11e4('0x36'))&&_0x38e194[_0x11e4('0x36')];var _0x47064c=_0x38e194['changed'](_0x11e4('0x37'));if(_0x93620d||_0x47064c){var _0x5b1782=_0x93620d?_0x11e4('0x9'):_0x11e4('0x37');var _0x475a43=_0x38e194['get']({'plain':!![]});_0x475a43['channel']=_0x43204f;_0x475a43[_0x11e4('0x21')]=_0x43204f;_0x475a43[_0x11e4('0x33')]=_0x93620d?_0x11e4('0x36'):_0x11e4('0x37');var _0x2743dd=_0x11e4('0x26')+_0x475a43[_0x11e4('0x24')];return db[_0x11e4('0x27')][_0x11e4('0x28')](_0x2743dd,{'type':db[_0x11e4('0x29')]['QueryTypes'][_0x11e4('0x2b')],'raw':!![]})['then'](function(_0x2d65a1){if(_0x2d65a1){_0x475a43[_0x11e4('0x38')]=_0x2d65a1[0x0];}if(typeof _0x475a43['UserId']===_0x11e4('0x25'))return;return getAgent(_0x475a43['UserId']);})[_0x11e4('0x1a')](function(_0x30bc00){if(_0x30bc00){_0x475a43[_0x11e4('0x39')]=util[_0x11e4('0x2d')](_0x11e4('0x2e'),_0x30bc00[_0x11e4('0x2f')]);_0x475a43[_0x11e4('0x35')]=_0x30bc00;}return request({'event':_0x5b1782,'message':_0x475a43});})[_0x11e4('0x1f')](function(_0x3358fc){logger[_0x11e4('0x1d')](_0x11e4('0x1c'),_0x11e4('0x3a'),_0x3358fc);});}};}function getAgent(_0x7cbaca){return db[_0x11e4('0x3b')][_0x11e4('0x3c')]({'where':{'id':_0x7cbaca},'attributes':['id',_0x11e4('0x2f'),_0x11e4('0x3d'),'email',_0x11e4('0x3e')],'raw':!![]})[_0x11e4('0x1a')](function(_0x2d9d16){return _0x2d9d16;});}exports[_0x11e4('0x3f')]=function(){for(var _0x4d873b=0x0;_0x4d873b=_0x5e0804['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x49410e(_0x4c0ae0);})['catch'](function(_0x46e968){_0x3d5509(_0x46e968);});});}; \ No newline at end of file +var _0x8ad7=['whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','./license/util','voice','chat','fax','sms'];(function(_0x541952,_0x213812){var _0x40ffc5=function(_0x3bd994){while(--_0x3bd994){_0x541952['push'](_0x541952['shift']());}};_0x40ffc5(++_0x213812);}(_0x8ad7,0x174));var _0x78ad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8ad7[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var BPromise=require(_0x78ad('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x78ad('0x1'));var channels=[_0x78ad('0x2'),'mail',_0x78ad('0x3'),_0x78ad('0x4'),_0x78ad('0x5'),_0x78ad('0x6'),_0x78ad('0x7')];exports[_0x78ad('0x8')]=function(){return channels;};exports[_0x78ad('0x9')]=function(_0xfdcb1a){_0xfdcb1a=_0xfdcb1a[_0x78ad('0xa')]();return _[_0x78ad('0xb')](channels,_0xfdcb1a);};exports['clearBlockUser']=function(_0x376efd,_0x1a9cc8,_0x7a64da,_0x4c32ad){var _0xbc5893={'loginAttempts':_0x1a9cc8,'blocked':_0x7a64da};if(!_[_0x78ad('0xc')](_0x4c32ad)){_0xbc5893[_0x78ad('0xd')]=_0x4c32ad;}return _0x376efd[_0x78ad('0xe')](_0xbc5893);};exports[_0x78ad('0xf')]=function(_0x39f7a2){return new BPromise(function(_0x54192c,_0x582945){var _0x448a19=0x0;if(_0x39f7a2['role']!==_0x78ad('0x10')){_0x54192c(_0x39f7a2);}db['User'][_0x78ad('0x11')]({'where':{'role':_0x78ad('0x10'),'online':!![],'id':{'$ne':_0x39f7a2['id']}}})[_0x78ad('0x12')](function(_0x3d2b4c){_0x448a19=_0x3d2b4c;return util[_0x78ad('0xf')]();})[_0x78ad('0x12')](function(_0x4c01b7){if(_0x4c01b7&&_0x4c01b7[_0x78ad('0x13')]&&_0x448a19>=_0x4c01b7[_0x78ad('0x13')]){throw Error(_0x78ad('0x14'));}_0x54192c(_0x39f7a2);})['catch'](function(_0x309181){_0x582945(_0x309181);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index ff352cc..d41948b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0xdbe16,_0x36dab3){var _0x57a920=function(_0x5c91c4){while(--_0x5c91c4){_0xdbe16['push'](_0xdbe16['shift']());}};_0x57a920(++_0x36dab3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x423f00,_0x2f8597){var _0x5da4cc=function(_0x5aacd8){while(--_0x5aacd8){_0x423f00['push'](_0x423f00['shift']());}};_0x5da4cc(++_0x2f8597);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 45ddc18..e4570bf 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf725=['404','status','send','exports'];(function(_0x137c1f,_0x118e7f){var _0x1d0f69=function(_0x363401){while(--_0x363401){_0x137c1f['push'](_0x137c1f['shift']());}};_0x1d0f69(++_0x118e7f);}(_0xf725,0x14f));var _0x5f72=function(_0x342c8,_0xbabf26){_0x342c8=_0x342c8-0x0;var _0x3e909d=_0xf725[_0x342c8];return _0x3e909d;};'use strict';module[_0x5f72('0x0')][0x194]=function pageNotFound(_0x427de8,_0x1a4f3c){var _0x14719d=_0x5f72('0x1');var _0x116110=0x194;var _0x424ac6={'status':_0x116110};_0x1a4f3c['status'](_0x424ac6[_0x5f72('0x2')]);_0x1a4f3c['render'](_0x14719d,{},function(_0x1edc48,_0x3b09f7){if(_0x1edc48){return _0x1a4f3c[_0x5f72('0x2')](_0x424ac6[_0x5f72('0x2')])['json'](_0x424ac6);}_0x1a4f3c[_0x5f72('0x3')](_0x3b09f7);});}; \ No newline at end of file +var _0xcd92=['status','json','send','exports'];(function(_0x15f97d,_0x2ab8d9){var _0x5402e9=function(_0x58efd4){while(--_0x58efd4){_0x15f97d['push'](_0x15f97d['shift']());}};_0x5402e9(++_0x2ab8d9);}(_0xcd92,0xb3));var _0x2cd9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcd92[_0x413feb];return _0x40ee88;};'use strict';module[_0x2cd9('0x0')][0x194]=function pageNotFound(_0x2816ff,_0x33412a){var _0xc04cb7='404';var _0x56ac4d=0x194;var _0xbbfbea={'status':_0x56ac4d};_0x33412a[_0x2cd9('0x1')](_0xbbfbea[_0x2cd9('0x1')]);_0x33412a['render'](_0xc04cb7,{},function(_0x58da9d,_0x257f20){if(_0x58da9d){return _0x33412a['status'](_0xbbfbea[_0x2cd9('0x1')])[_0x2cd9('0x2')](_0xbbfbea);}_0x33412a[_0x2cd9('0x3')](_0x257f20);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index eb88bc1..451b1ca 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f2c913e..cc660d6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f94=['/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./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/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareProject','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/faxTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','3.5.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9f94,0x1e7));var _0x49f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f94[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x49f9('0x0'));var express=require(_0x49f9('0x1'));var errors=require(_0x49f9('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x49f9('0x3')];var clientSideLogs=require(_0x49f9('0x4'));exports[_0x49f9('0x5')]=function(_0x375856){return setupLoggers(_0x375856)[_0x49f9('0x6')](function(){_0x375856['use'](_0x49f9('0x7'),require(_0x49f9('0x8')));_0x375856[_0x49f9('0x9')](_0x49f9('0xa'),require(_0x49f9('0xb')));_0x375856[_0x49f9('0x9')](_0x49f9('0xc'),require(_0x49f9('0xd')));_0x375856['use']('/api/voice/extensions',require(_0x49f9('0xe')));_0x375856['use'](_0x49f9('0xf'),require(_0x49f9('0x10')));_0x375856[_0x49f9('0x9')]('/api/voice/queues',require(_0x49f9('0x11')));_0x375856['use'](_0x49f9('0x12'),require(_0x49f9('0x13')));_0x375856[_0x49f9('0x9')](_0x49f9('0x14'),require('./api/screenRecording'));_0x375856['use'](_0x49f9('0x15'),require(_0x49f9('0x16')));_0x375856[_0x49f9('0x9')](_0x49f9('0x17'),require('./api/voiceMailMessage'));_0x375856['use']('/api/voice/calls/reports',require(_0x49f9('0x18')));_0x375856['use'](_0x49f9('0x19'),require('./api/voiceDialReport'));_0x375856[_0x49f9('0x9')](_0x49f9('0x1a'),require('./api/voiceAgentReport'));_0x375856[_0x49f9('0x9')](_0x49f9('0x1b'),require(_0x49f9('0x1c')));_0x375856[_0x49f9('0x9')](_0x49f9('0x1d'),require(_0x49f9('0x1e')));_0x375856[_0x49f9('0x9')](_0x49f9('0x1f'),require(_0x49f9('0x20')));_0x375856[_0x49f9('0x9')](_0x49f9('0x21'),require(_0x49f9('0x22')));_0x375856[_0x49f9('0x9')](_0x49f9('0x23'),require(_0x49f9('0x24')));_0x375856['use']('/api/mail/accounts',require(_0x49f9('0x25')));_0x375856['use'](_0x49f9('0x26'),require('./api/mailQueue'));_0x375856['use'](_0x49f9('0x27'),require(_0x49f9('0x28')));_0x375856['use'](_0x49f9('0x29'),require('./api/mailInteraction'));_0x375856['use'](_0x49f9('0x2a'),require(_0x49f9('0x2b')));_0x375856['use'](_0x49f9('0x2c'),require(_0x49f9('0x2d')));_0x375856['use'](_0x49f9('0x2e'),require(_0x49f9('0x2f')));_0x375856[_0x49f9('0x9')](_0x49f9('0x30'),require('./api/dashboard'));_0x375856[_0x49f9('0x9')](_0x49f9('0x31'),require(_0x49f9('0x32')));_0x375856[_0x49f9('0x9')](_0x49f9('0x33'),require(_0x49f9('0x34')));_0x375856[_0x49f9('0x9')]('/api/fax/applications',require('./api/faxApplication'));_0x375856[_0x49f9('0x9')](_0x49f9('0x35'),require(_0x49f9('0x36')));_0x375856[_0x49f9('0x9')](_0x49f9('0x37'),require(_0x49f9('0x38')));_0x375856[_0x49f9('0x9')](_0x49f9('0x39'),require('./api/faxQueue'));_0x375856[_0x49f9('0x9')]('/api/fax/reports/queue',require(_0x49f9('0x3a')));_0x375856[_0x49f9('0x9')](_0x49f9('0x3b'),require('./api/smsAccount'));_0x375856[_0x49f9('0x9')](_0x49f9('0x3c'),require(_0x49f9('0x3d')));_0x375856[_0x49f9('0x9')](_0x49f9('0x3e'),require(_0x49f9('0x3f')));_0x375856[_0x49f9('0x9')](_0x49f9('0x40'),require(_0x49f9('0x41')));_0x375856[_0x49f9('0x9')](_0x49f9('0x42'),require(_0x49f9('0x43')));_0x375856[_0x49f9('0x9')](_0x49f9('0x44'),require(_0x49f9('0x45')));_0x375856[_0x49f9('0x9')](_0x49f9('0x46'),require('./api/openchannelApplication'));_0x375856[_0x49f9('0x9')](_0x49f9('0x47'),require(_0x49f9('0x48')));_0x375856[_0x49f9('0x9')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x375856[_0x49f9('0x9')]('/api/openchannel/queues',require(_0x49f9('0x49')));_0x375856[_0x49f9('0x9')](_0x49f9('0x4a'),require(_0x49f9('0x4b')));_0x375856[_0x49f9('0x9')](_0x49f9('0x4c'),require(_0x49f9('0x4d')));_0x375856['use'](_0x49f9('0x4e'),require(_0x49f9('0x4f')));_0x375856['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x375856[_0x49f9('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x375856[_0x49f9('0x9')](_0x49f9('0x50'),require(_0x49f9('0x51')));_0x375856[_0x49f9('0x9')]('/api/chat/queues',require(_0x49f9('0x52')));_0x375856['use'](_0x49f9('0x53'),require(_0x49f9('0x54')));_0x375856[_0x49f9('0x9')](_0x49f9('0x55'),require(_0x49f9('0x56')));_0x375856[_0x49f9('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x375856[_0x49f9('0x9')](_0x49f9('0x57'),require(_0x49f9('0x58')));_0x375856['use'](_0x49f9('0x59'),require(_0x49f9('0x5a')));_0x375856['use']('/api/cm/hopper_black',require(_0x49f9('0x5b')));_0x375856[_0x49f9('0x9')](_0x49f9('0x5c'),require(_0x49f9('0x5d')));_0x375856['use'](_0x49f9('0x5e'),require('./api/cmHopperHistory'));_0x375856[_0x49f9('0x9')](_0x49f9('0x5f'),require(_0x49f9('0x60')));_0x375856[_0x49f9('0x9')](_0x49f9('0x61'),require(_0x49f9('0x62')));_0x375856[_0x49f9('0x9')](_0x49f9('0x63'),require('./api/automation'));_0x375856[_0x49f9('0x9')](_0x49f9('0x64'),require(_0x49f9('0x65')));_0x375856[_0x49f9('0x9')](_0x49f9('0x66'),require(_0x49f9('0x67')));_0x375856[_0x49f9('0x9')]('/api/conditions',require(_0x49f9('0x68')));_0x375856['use'](_0x49f9('0x69'),require(_0x49f9('0x6a')));_0x375856['use'](_0x49f9('0x6b'),require(_0x49f9('0x6c')));_0x375856['use'](_0x49f9('0x6d'),require(_0x49f9('0x6e')));_0x375856['use'](_0x49f9('0x6f'),require(_0x49f9('0x70')));_0x375856[_0x49f9('0x9')](_0x49f9('0x71'),require(_0x49f9('0x72')));_0x375856[_0x49f9('0x9')]('/api/sounds',require(_0x49f9('0x73')));_0x375856['use'](_0x49f9('0x74'),require(_0x49f9('0x75')));_0x375856['use'](_0x49f9('0x76'),require(_0x49f9('0x77')));_0x375856[_0x49f9('0x9')](_0x49f9('0x78'),require(_0x49f9('0x79')));_0x375856[_0x49f9('0x9')](_0x49f9('0x7a'),require(_0x49f9('0x7b')));_0x375856[_0x49f9('0x9')](_0x49f9('0x7c'),require(_0x49f9('0x7d')));_0x375856['use']('/api/triggers',require(_0x49f9('0x7e')));_0x375856[_0x49f9('0x9')](_0x49f9('0x7f'),require(_0x49f9('0x80')));_0x375856[_0x49f9('0x9')](_0x49f9('0x81'),require(_0x49f9('0x82')));_0x375856['use'](_0x49f9('0x83'),require(_0x49f9('0x84')));_0x375856[_0x49f9('0x9')](_0x49f9('0x85'),require(_0x49f9('0x86')));_0x375856['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x375856[_0x49f9('0x9')](_0x49f9('0x87'),require(_0x49f9('0x88')));_0x375856[_0x49f9('0x9')](_0x49f9('0x89'),require(_0x49f9('0x8a')));_0x375856['use'](_0x49f9('0x8b'),require('./api/analyticFieldReport'));_0x375856[_0x49f9('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x375856[_0x49f9('0x9')]('/api/integrations/salesforce/accounts',require(_0x49f9('0x8c')));_0x375856[_0x49f9('0x9')](_0x49f9('0x8d'),require(_0x49f9('0x8e')));_0x375856[_0x49f9('0x9')](_0x49f9('0x8f'),require('./api/intSalesforceField'));_0x375856[_0x49f9('0x9')](_0x49f9('0x90'),require(_0x49f9('0x91')));_0x375856[_0x49f9('0x9')](_0x49f9('0x92'),require(_0x49f9('0x93')));_0x375856[_0x49f9('0x9')](_0x49f9('0x94'),require('./api/intSugarcrmField'));_0x375856[_0x49f9('0x9')]('/api/integrations/desk/accounts',require(_0x49f9('0x95')));_0x375856[_0x49f9('0x9')](_0x49f9('0x96'),require(_0x49f9('0x97')));_0x375856[_0x49f9('0x9')]('/api/integrations/desk/fields',require(_0x49f9('0x98')));_0x375856[_0x49f9('0x9')](_0x49f9('0x99'),require('./api/intZohoAccount'));_0x375856[_0x49f9('0x9')]('/api/integrations/zoho/configurations',require(_0x49f9('0x9a')));_0x375856[_0x49f9('0x9')](_0x49f9('0x9b'),require(_0x49f9('0x9c')));_0x375856['use'](_0x49f9('0x9d'),require('./api/intZendeskAccount'));_0x375856['use'](_0x49f9('0x9e'),require(_0x49f9('0x9f')));_0x375856[_0x49f9('0x9')](_0x49f9('0xa0'),require(_0x49f9('0xa1')));_0x375856[_0x49f9('0x9')](_0x49f9('0xa2'),require(_0x49f9('0xa3')));_0x375856[_0x49f9('0x9')](_0x49f9('0xa4'),require('./api/intFreshdeskConfiguration'));_0x375856[_0x49f9('0x9')](_0x49f9('0xa5'),require('./api/intFreshdeskField'));_0x375856[_0x49f9('0x9')](_0x49f9('0xa6'),require(_0x49f9('0xa7')));_0x375856[_0x49f9('0x9')](_0x49f9('0xa8'),require(_0x49f9('0xa9')));_0x375856['use'](_0x49f9('0xaa'),require(_0x49f9('0xab')));_0x375856[_0x49f9('0x9')](_0x49f9('0xac'),require(_0x49f9('0xad')));_0x375856[_0x49f9('0x9')](_0x49f9('0xae'),require(_0x49f9('0xaf')));_0x375856[_0x49f9('0x9')](_0x49f9('0xb0'),require(_0x49f9('0xb1')));_0x375856[_0x49f9('0x9')](_0x49f9('0xb2'),require(_0x49f9('0xb3')));_0x375856[_0x49f9('0x9')](_0x49f9('0xb4'),require(_0x49f9('0xb5')));_0x375856['use'](_0x49f9('0xb6'),require('./api/intDynamics365Field'));_0x375856['use'](_0x49f9('0xb7'),require(_0x49f9('0xb8')));_0x375856[_0x49f9('0x9')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x375856[_0x49f9('0x9')](_0x49f9('0xb9'),require(_0x49f9('0xba')));_0x375856['use'](_0x49f9('0xbb'),require(_0x49f9('0xbc')));_0x375856[_0x49f9('0x9')](_0x49f9('0xbd'),require('./api/chatQueueReport'));_0x375856[_0x49f9('0x9')]('/api/chat/internal/messages',require(_0x49f9('0xbe')));_0x375856[_0x49f9('0x9')](_0x49f9('0xbf'),require(_0x49f9('0xc0')));_0x375856[_0x49f9('0x9')]('/api/jscripty/questions/reports',require(_0x49f9('0xc1')));_0x375856[_0x49f9('0x9')]('/api/jscripty/sessions/reports',require(_0x49f9('0xc2')));_0x375856[_0x49f9('0x9')](_0x49f9('0xc3'),require(_0x49f9('0xc4')));_0x375856['use'](_0x49f9('0xc5'),require('./api/squareReport'));_0x375856[_0x49f9('0x9')](_0x49f9('0xc6'),require(_0x49f9('0xc7')));_0x375856[_0x49f9('0x9')](_0x49f9('0xc8'),require(_0x49f9('0xc9')));_0x375856[_0x49f9('0x9')](_0x49f9('0xca'),require('./api/setting'));_0x375856[_0x49f9('0x9')](_0x49f9('0xcb'),require('./api/squareOdbc'));_0x375856[_0x49f9('0x9')]('/api/square/projects',require(_0x49f9('0xcc')));_0x375856[_0x49f9('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x375856['use']('/api/square/messages',require(_0x49f9('0xcd')));_0x375856[_0x49f9('0x9')]('/api/teams',require(_0x49f9('0xce')));_0x375856['use']('/api/license',require(_0x49f9('0xcf')));_0x375856['use'](_0x49f9('0xd0'),require(_0x49f9('0xd1')));_0x375856['use']('/api/migrations',require('./api/migration'));_0x375856['use']('/api/attachments',require(_0x49f9('0xd2')));_0x375856[_0x49f9('0x9')]('/api/plugins',require(_0x49f9('0xd3')));_0x375856['use'](_0x49f9('0xd4'),require(_0x49f9('0xd5')));_0x375856[_0x49f9('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x375856[_0x49f9('0x9')]('/api/fax/reports/transfer',require(_0x49f9('0xd6')));_0x375856[_0x49f9('0x9')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x375856[_0x49f9('0x9')]('/api/sms/reports/transfer',require(_0x49f9('0xd7')));_0x375856[_0x49f9('0x9')](_0x49f9('0xd8'),require(_0x49f9('0xd9')));_0x375856['use'](_0x49f9('0xda'),require(_0x49f9('0xdb')));_0x375856[_0x49f9('0x9')](_0x49f9('0xdc'),require('./api/userProfile'));_0x375856[_0x49f9('0x9')](_0x49f9('0xdd'),require(_0x49f9('0xde')));_0x375856[_0x49f9('0x9')](_0x49f9('0xdf'),require('./api/userProfileResource'));_0x375856['use'](_0x49f9('0xe0'),require(_0x49f9('0xe1')));_0x375856[_0x49f9('0x9')](_0x49f9('0xe2'),require(_0x49f9('0xe3')));_0x375856[_0x49f9('0x9')](_0x49f9('0xe4'),require(_0x49f9('0xe5')));_0x375856[_0x49f9('0x9')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x375856['use'](_0x49f9('0xe6'),require(_0x49f9('0xe7')));_0x375856['use'](_0x49f9('0xe8'),require('./api/whatsappQueueReport'));_0x375856['use'](_0x49f9('0xe9'),require(_0x49f9('0xea')));_0x375856[_0x49f9('0x9')](_0x49f9('0xeb'),require(_0x49f9('0xec')));_0x375856[_0x49f9('0x9')](_0x49f9('0xed'),require(_0x49f9('0xee')));_0x375856[_0x49f9('0x9')](_0x49f9('0xef'),require(_0x49f9('0xf0')));_0x375856[_0x49f9('0x9')](_0x49f9('0xf1'),require('./api/user-setting'));_0x375856[_0x49f9('0x9')](_0x49f9('0xf2'),require(_0x49f9('0xf3')));_0x375856[_0x49f9('0x9')](_0x49f9('0xf4'),require('./api/authGoogle'));_0x375856[_0x49f9('0x9')](_0x49f9('0xf5'),require('./api/authActiveDirectory'));_0x375856['use']('/api/jira',require(_0x49f9('0xf6')));_0x375856[_0x49f9('0x9')](_0x49f9('0xf7'),require(_0x49f9('0xf8')));_0x375856[_0x49f9('0x9')](_0x49f9('0xf9'),require(_0x49f9('0xfa')));_0x375856[_0x49f9('0x9')]('/api/system',require(_0x49f9('0xfb')));_0x375856['use'](_0x49f9('0xfc'),require('./api/pm2'));_0x375856['use'](_0x49f9('0xfd'),require(_0x49f9('0xfe')));_0x375856[_0x49f9('0x9')](_0x49f9('0xff'),clientSideLogs);_0x375856['use'](_0x49f9('0x100'),express[_0x49f9('0x101')](path['join'](config['root'],'/apidoc')));_0x375856['use']('/www',express[_0x49f9('0x101')](path[_0x49f9('0x102')](config[_0x49f9('0x103')],_0x49f9('0x104'))));_0x375856[_0x49f9('0x9')]('/demo',express[_0x49f9('0x101')](path[_0x49f9('0x102')](config[_0x49f9('0x103')],_0x49f9('0x105'))));_0x375856[_0x49f9('0x9')]('/snippet',express['static'](path[_0x49f9('0x102')](config['root'],'snippet',_0x49f9('0x106'))));_0x375856[_0x49f9('0x9')]('/plugins',express['static'](path[_0x49f9('0x102')](config[_0x49f9('0x103')],_0x49f9('0x107'))));_0x375856[_0x49f9('0x108')](_0x49f9('0x109'))[_0x49f9('0x10a')](errors[0x194]);_0x375856['route']('/*')[_0x49f9('0x10a')](function(_0x8b6230,_0x3fdc4c){_0x3fdc4c[_0x49f9('0x10b')](path['resolve'](_0x375856[_0x49f9('0x10a')](_0x49f9('0x10c'))+'/index.html'));});return _0x375856;});}; \ No newline at end of file +var _0xbd50=['./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/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/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/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/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./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/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','./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/actions','/api/automations','./api/automation','/api/conditions','/api/intervals','./api/interval','/api/pauses','/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/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields'];(function(_0x784e31,_0x51f0f1){var _0x221db5=function(_0x18c42c){while(--_0x18c42c){_0x784e31['push'](_0x784e31['shift']());}};_0x221db5(++_0x51f0f1);}(_0xbd50,0x196));var _0x0bd5=function(_0x3ee7a9,_0x548054){_0x3ee7a9=_0x3ee7a9-0x0;var _0x4c1219=_0xbd50[_0x3ee7a9];return _0x4c1219;};'use strict';var path=require(_0x0bd5('0x0'));var express=require(_0x0bd5('0x1'));var errors=require(_0x0bd5('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x0bd5('0x3'))[_0x0bd5('0x4')];var clientSideLogs=require(_0x0bd5('0x5'));exports[_0x0bd5('0x6')]=function(_0x15620d){return setupLoggers(_0x15620d)['then'](function(){_0x15620d['use']('/api/users',require(_0x0bd5('0x7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x9'),require(_0x0bd5('0xa')));_0x15620d[_0x0bd5('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb'),require(_0x0bd5('0xc')));_0x15620d['use'](_0x0bd5('0xd'),require(_0x0bd5('0xe')));_0x15620d['use'](_0x0bd5('0xf'),require(_0x0bd5('0x10')));_0x15620d['use'](_0x0bd5('0x11'),require(_0x0bd5('0x12')));_0x15620d[_0x0bd5('0x8')]('/api/screen/recordings',require(_0x0bd5('0x13')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x14'),require(_0x0bd5('0x15')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x16'),require(_0x0bd5('0x17')));_0x15620d[_0x0bd5('0x8')]('/api/voice/calls/reports',require(_0x0bd5('0x18')));_0x15620d[_0x0bd5('0x8')]('/api/voice/dials/reports',require(_0x0bd5('0x19')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x1a'),require(_0x0bd5('0x1b')));_0x15620d['use'](_0x0bd5('0x1c'),require(_0x0bd5('0x1d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x1e'),require(_0x0bd5('0x1f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x20'),require(_0x0bd5('0x21')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x22'),require(_0x0bd5('0x23')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x24'),require(_0x0bd5('0x25')));_0x15620d['use']('/api/mail/accounts',require('./api/mailAccount'));_0x15620d['use']('/api/mail/queues',require(_0x0bd5('0x26')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x27'),require(_0x0bd5('0x28')));_0x15620d[_0x0bd5('0x8')]('/api/mail/interactions',require(_0x0bd5('0x29')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2a'),require('./api/mailMessage'));_0x15620d[_0x0bd5('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2b'),require(_0x0bd5('0x2c')));_0x15620d['use'](_0x0bd5('0x2d'),require('./api/dashboard'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2e'),require(_0x0bd5('0x2f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x30'),require(_0x0bd5('0x31')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x32'),require(_0x0bd5('0x33')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x34'),require(_0x0bd5('0x35')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x36'),require('./api/faxMessage'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x37'),require('./api/faxQueue'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x38'),require('./api/faxQueueReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x39'),require(_0x0bd5('0x3a')));_0x15620d[_0x0bd5('0x8')]('/api/sms/applications',require(_0x0bd5('0x3b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x3c'),require(_0x0bd5('0x3d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x3e'),require('./api/smsMessage'));_0x15620d[_0x0bd5('0x8')]('/api/sms/queues',require(_0x0bd5('0x3f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x40'),require(_0x0bd5('0x41')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x42'),require(_0x0bd5('0x43')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x44'),require(_0x0bd5('0x45')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x46'),require(_0x0bd5('0x47')));_0x15620d['use'](_0x0bd5('0x48'),require(_0x0bd5('0x49')));_0x15620d['use']('/api/chat/websites',require(_0x0bd5('0x4a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4b'),require(_0x0bd5('0x4c')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4d'),require(_0x0bd5('0x4e')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4f'),require(_0x0bd5('0x50')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x51'),require(_0x0bd5('0x52')));_0x15620d['use'](_0x0bd5('0x53'),require('./api/chatOfflineMessage'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x54'),require(_0x0bd5('0x55')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x56'),require(_0x0bd5('0x57')));_0x15620d['use'](_0x0bd5('0x58'),require(_0x0bd5('0x59')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x5a'),require(_0x0bd5('0x5b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x5c'),require(_0x0bd5('0x5d')));_0x15620d[_0x0bd5('0x8')]('/api/cm/hopper',require(_0x0bd5('0x5e')));_0x15620d['use'](_0x0bd5('0x5f'),require(_0x0bd5('0x60')));_0x15620d['use'](_0x0bd5('0x61'),require(_0x0bd5('0x62')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x63'),require(_0x0bd5('0x64')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x65'),require('./api/cmCustomField'));_0x15620d['use'](_0x0bd5('0x66'),require('./api/action'));_0x15620d['use'](_0x0bd5('0x67'),require(_0x0bd5('0x68')));_0x15620d['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x15620d[_0x0bd5('0x8')]('/api/dispositions',require('./api/disposition'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x69'),require('./api/condition'));_0x15620d['use'](_0x0bd5('0x6a'),require(_0x0bd5('0x6b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6c'),require('./api/pause'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6d'),require(_0x0bd5('0x6e')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6f'),require(_0x0bd5('0x70')));_0x15620d['use'](_0x0bd5('0x71'),require(_0x0bd5('0x72')));_0x15620d[_0x0bd5('0x8')]('/api/sounds',require(_0x0bd5('0x73')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x74'),require('./api/tag'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x75'),require(_0x0bd5('0x76')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x77'),require('./api/cmContactHasItem'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x78'),require('./api/cmHopperAdditionalPhone'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x79'),require(_0x0bd5('0x7a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7b'),require('./api/trigger'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7c'),require('./api/variable'));_0x15620d[_0x0bd5('0x8')]('/api/integrations',require(_0x0bd5('0x7d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7e'),require(_0x0bd5('0x7f')));_0x15620d['use'](_0x0bd5('0x80'),require('./api/analyticCustomReport'));_0x15620d['use'](_0x0bd5('0x81'),require(_0x0bd5('0x82')));_0x15620d[_0x0bd5('0x8')]('/api/analytics/extracted_reports',require(_0x0bd5('0x83')));_0x15620d['use'](_0x0bd5('0x84'),require(_0x0bd5('0x85')));_0x15620d[_0x0bd5('0x8')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x15620d['use'](_0x0bd5('0x86'),require(_0x0bd5('0x87')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/salesforce/accounts',require(_0x0bd5('0x88')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/salesforce/configurations',require(_0x0bd5('0x89')));_0x15620d['use']('/api/integrations/salesforce/fields',require(_0x0bd5('0x8a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x8b'),require(_0x0bd5('0x8c')));_0x15620d['use'](_0x0bd5('0x8d'),require(_0x0bd5('0x8e')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/sugarcrm/fields',require(_0x0bd5('0x8f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x90'),require('./api/intDeskAccount'));_0x15620d['use'](_0x0bd5('0x91'),require('./api/intDeskConfiguration'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x92'),require(_0x0bd5('0x93')));_0x15620d['use'](_0x0bd5('0x94'),require(_0x0bd5('0x95')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x96'),require('./api/intZohoConfiguration'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x97'),require(_0x0bd5('0x98')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x99'),require('./api/intZendeskAccount'));_0x15620d[_0x0bd5('0x8')]('/api/integrations/zendesk/configurations',require(_0x0bd5('0x9a')));_0x15620d['use']('/api/integrations/zendesk/fields',require(_0x0bd5('0x9b')));_0x15620d['use'](_0x0bd5('0x9c'),require(_0x0bd5('0x9d')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/freshdesk/configurations',require(_0x0bd5('0x9e')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/freshdesk/fields',require(_0x0bd5('0x9f')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/vtiger/accounts',require(_0x0bd5('0xa0')));_0x15620d['use'](_0x0bd5('0xa1'),require(_0x0bd5('0xa2')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa3'),require(_0x0bd5('0xa4')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa5'),require('./api/intServicenowAccount'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa6'),require(_0x0bd5('0xa7')));_0x15620d['use']('/api/integrations/servicenow/fields',require(_0x0bd5('0xa8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa9'),require(_0x0bd5('0xaa')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xab'),require(_0x0bd5('0xac')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xad'),require(_0x0bd5('0xae')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xaf'),require(_0x0bd5('0xb0')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb1'),require(_0x0bd5('0xb2')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb3'),require('./api/intFreshsalesField'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb4'),require('./api/network'));_0x15620d[_0x0bd5('0x8')]('/api/chat/reports/queue',require(_0x0bd5('0xb5')));_0x15620d[_0x0bd5('0x8')]('/api/chat/internal/messages',require(_0x0bd5('0xb6')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb7'),require(_0x0bd5('0xb8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb9'),require(_0x0bd5('0xba')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbb'),require('./api/jscriptySessionReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbc'),require('./api/smsQueueReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbd'),require('./api/squareReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbe'),require('./api/squareReportDetail'));_0x15620d[_0x0bd5('0x8')]('/api/jscripty/projects',require(_0x0bd5('0xbf')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc0'),require(_0x0bd5('0xc1')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc2'),require(_0x0bd5('0xc3')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc4'),require(_0x0bd5('0xc5')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc6'),require(_0x0bd5('0xc7')));_0x15620d[_0x0bd5('0x8')]('/api/square/messages',require(_0x0bd5('0xc8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc9'),require(_0x0bd5('0xca')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xcb'),require('./api/license'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xcc'),require(_0x0bd5('0xcd')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xce'),require(_0x0bd5('0xcf')));_0x15620d[_0x0bd5('0x8')]('/api/attachments',require('./api/attachment'));_0x15620d['use'](_0x0bd5('0xd0'),require(_0x0bd5('0xd1')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xd2'),require(_0x0bd5('0xd3')));_0x15620d['use'](_0x0bd5('0xd4'),require(_0x0bd5('0xd5')));_0x15620d['use'](_0x0bd5('0xd6'),require(_0x0bd5('0xd7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xd8'),require(_0x0bd5('0xd9')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xda'),require(_0x0bd5('0xdb')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xdc'),require(_0x0bd5('0xdd')));_0x15620d['use'](_0x0bd5('0xde'),require(_0x0bd5('0xdf')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe0'),require(_0x0bd5('0xe1')));_0x15620d['use'](_0x0bd5('0xe2'),require(_0x0bd5('0xe3')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe4'),require(_0x0bd5('0xe5')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe6'),require(_0x0bd5('0xe7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe8'),require(_0x0bd5('0xe9')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xea'),require(_0x0bd5('0xeb')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xec'),require(_0x0bd5('0xed')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xee'),require('./api/whatsappMessage'));_0x15620d['use'](_0x0bd5('0xef'),require(_0x0bd5('0xf0')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf1'),require(_0x0bd5('0xf2')));_0x15620d['use'](_0x0bd5('0xf3'),require(_0x0bd5('0xf4')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf5'),require(_0x0bd5('0xf6')));_0x15620d['use'](_0x0bd5('0xf7'),require(_0x0bd5('0xf8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf9'),require(_0x0bd5('0xfa')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xfb'),require(_0x0bd5('0xfc')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xfd'),require(_0x0bd5('0xfe')));_0x15620d['use'](_0x0bd5('0xff'),require(_0x0bd5('0x100')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x101'),require(_0x0bd5('0x102')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x103'),require(_0x0bd5('0x104')));_0x15620d['use'](_0x0bd5('0x105'),require(_0x0bd5('0x106')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x107'),require(_0x0bd5('0x108')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x109'),require(_0x0bd5('0x10a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x10b'),require(_0x0bd5('0x10c')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x10d'),clientSideLogs);_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x10e'),express[_0x0bd5('0x10f')](path['join'](config[_0x0bd5('0x110')],_0x0bd5('0x10e'))));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x111'),express[_0x0bd5('0x10f')](path[_0x0bd5('0x112')](config[_0x0bd5('0x110')],_0x0bd5('0x111'))));_0x15620d[_0x0bd5('0x8')]('/demo',express[_0x0bd5('0x10f')](path[_0x0bd5('0x112')](config[_0x0bd5('0x110')],'/demo')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x113'),express[_0x0bd5('0x10f')](path[_0x0bd5('0x112')](config[_0x0bd5('0x110')],_0x0bd5('0x114'),'3.5.0')));_0x15620d[_0x0bd5('0x8')]('/plugins',express[_0x0bd5('0x10f')](path['join'](config['root'],_0x0bd5('0x115'))));_0x15620d[_0x0bd5('0x116')](_0x0bd5('0x117'))[_0x0bd5('0x118')](errors[0x194]);_0x15620d['route']('/*')[_0x0bd5('0x118')](function(_0x342f99,_0x5bdae9){_0x5bdae9[_0x0bd5('0x119')](path[_0x0bd5('0x11a')](_0x15620d[_0x0bd5('0x118')](_0x0bd5('0x11b'))+_0x0bd5('0x11c')));});return _0x15620d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 13e6a1a..2b0b5f5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e9=['../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22e9,0x10e));var _0x922e=function(_0x4ff939,_0x5f54ea){_0x4ff939=_0x4ff939-0x0;var _0x3f8ba8=_0x22e9[_0x4ff939];return _0x3f8ba8;};'use strict';var jayson=require(_0x922e('0x0'));var _=require(_0x922e('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x102b3b,_0x4ad6c8){var _0x1d8a6f={};_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x4')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x5')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x6')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x7')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x8')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x9')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0xa')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0xb')));_0x1d8a6f=_['merge'](_0x1d8a6f,require('../api/trunk/trunk.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0xc')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0xd')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0xe')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0xf')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x10')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x11')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x12')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x13')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x14')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x15')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x16')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/faxMessage/faxMessage.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x17')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x18')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x19')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x1a')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x1b')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x1c')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x1d')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x1e')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x1f')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x20')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x21')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x22')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/chatMessage/chatMessage.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x23')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x24')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x25')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x26')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x27')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x28')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x29')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/interval/interval.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2a')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2b')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2c')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2d')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2e')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x2f')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x30')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x31')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x32')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x33')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x34')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x35')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x36')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x37')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x38')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x39')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3a')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3b')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3c')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x3d')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/squareOdbc/squareOdbc.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3e')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x3f')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x40')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x41')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x42')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x43')));_0x1d8a6f=_['merge'](_0x1d8a6f,require(_0x922e('0x44')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x45')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x46')));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1d8a6f=_[_0x922e('0x2')](_0x1d8a6f,require(_0x922e('0x47')));var _0x196a95=jayson['server'](_0x1d8a6f)[_0x922e('0x48')]();var _0x30c019=config[_0x922e('0x49')][_0x922e('0x4a')]||config['port']+0x1;var _0x21e89d=config[_0x922e('0x49')]['ip']||_0x922e('0x4b');_0x196a95['on'](_0x922e('0x4c'),function(_0x1a0b6e){return _0x4ad6c8(_0x1a0b6e);});_0x196a95[_0x922e('0x4d')](_0x30c019,_0x21e89d,function(){console[_0x922e('0x4e')](_0x922e('0x4f'),_0x21e89d,_0x30c019);require(_0x922e('0x50'))[_0x922e('0x51')]();return _0x102b3b(_0x922e('0x52')+_0x21e89d+':'+_0x30c019);});});}; \ No newline at end of file +var _0x4489=['../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','listen','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','merge','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.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/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.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/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc'];(function(_0x38ee62,_0x425393){var _0x247e58=function(_0x3b7734){while(--_0x3b7734){_0x38ee62['push'](_0x38ee62['shift']());}};_0x247e58(++_0x425393);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x9448('0x0'));var _=require(_0x9448('0x1'));var config=require('../config/environment');exports[_0x9448('0x2')]=function(){return new Promise(function(_0x12e7d8,_0x2856c8){var _0x2d1cf2={};_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/user/user.rpc'));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/voiceExtension/voiceExtension.rpc'));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x3')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x4')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x5')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x7')));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x8')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x9')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0xa')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0xb')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0xc')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0xd')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0xe')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/mailQueue/mailQueue.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/mailInteraction/mailInteraction.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0xf')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x10')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x11')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x12')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x13')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/faxInteraction/faxInteraction.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/faxMessage/faxMessage.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x14')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x15')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x16')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x17')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x18')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x19')));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1a')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/chatInteraction/chatInteraction.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1b')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1c')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1d')));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/cmHopper/cmHopper.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1e')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x1f')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x20')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/pause/pause.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x21')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x22')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x23')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x24')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/variable/variable.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x25')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x26')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x27')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x28')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x29')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x2a')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x2b')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x2c')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x2d')));_0x2d1cf2=_['merge'](_0x2d1cf2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x2e')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x2f')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x30')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x31')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x32')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x33')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x34')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x35')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x36')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x37')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x38')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x39')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x3a')));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2d1cf2=_[_0x9448('0x6')](_0x2d1cf2,require(_0x9448('0x3b')));_0x2d1cf2=_['merge'](_0x2d1cf2,require(_0x9448('0x3c')));var _0x3d0985=jayson[_0x9448('0x3d')](_0x2d1cf2)[_0x9448('0x3e')]();var _0x4958ae=config[_0x9448('0x3f')][_0x9448('0x40')]||config[_0x9448('0x40')]+0x1;var _0x2d363a=config[_0x9448('0x3f')]['ip']||'localhost';_0x3d0985['on'](_0x9448('0x41'),function(_0x26a60a){return _0x2856c8(_0x26a60a);});_0x3d0985[_0x9448('0x2')](_0x4958ae,_0x2d363a,function(){console['log'](_0x9448('0x42'),_0x2d363a,_0x4958ae);require(_0x9448('0x43'))['default']();return _0x12e7d8('RPC\x20listening\x20on\x20'+_0x2d363a+':'+_0x4958ae);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 472d756..3c98f8a 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 _0x71d5=['close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','sendRequest','command','prototype','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','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR'];(function(_0x193191,_0x108cfa){var _0x593a9e=function(_0x56c70b){while(--_0x56c70b){_0x193191['push'](_0x193191['shift']());}};_0x593a9e(++_0x108cfa);}(_0x71d5,0x109));var _0x571d=function(_0x1b1dff,_0x4c2de2){_0x1b1dff=_0x1b1dff-0x0;var _0x280d9d=_0x71d5[_0x1b1dff];return _0x280d9d;};'use strict';var util=require(_0x571d('0x0'));var _=require(_0x571d('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x571d('0x2'));var AGIError=require(_0x571d('0x3'));function AGIChannel(_0x99d7c1){var _0x35cc55=this,_0x342aea=new AGIReply(),_0x43309c=![],_0x249173={};EventEmitter[_0x571d('0x4')](_0x35cc55);_0x99d7c1[_0x571d('0x5')]('utf8');_0x99d7c1[_0x571d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x342aea[_0x571d('0x5')](_0x571d('0x7'));_0x342aea['on'](_0x571d('0x8'),function(_0x18506e){for(var _0x2e8c89 in _0x18506e){_0x35cc55[_0x2e8c89]=_0x18506e[_0x2e8c89];}_0x35cc55[_0x571d('0x9')](_0x571d('0xa'));});_0x342aea['on'](_0x571d('0xb'),function(_0x1f564b){if(_0x1f564b['toLowerCase']()==_0x571d('0xc')){_0x35cc55[_0x571d('0x9')](_0x571d('0xc'));return;}if(_0x1f564b['substring'](0x0,0xb)==_0x571d('0xd')){_0x43309c=!![];}if(_0x43309c){_0x249173['rx']+=_0x1f564b+'\x0a';if(_0x1f564b['search'](_0x571d('0xe'))!=-0x1){_0x43309c=![];}}else{_0x249173['rx']=_0x1f564b;}if(_0x43309c){return;}if(typeof _0x249173['cb']==_0x571d('0xf')){var _0x1b8237=_0x249173['rx'][_0x571d('0x10')](0x0,0x3),_0x377392=null,_0x141828=null;_0x1b8237=parseInt(_0x1b8237);if(isNaN(_0x1b8237)){_0x249173['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x571d('0x11')});return;}if(_0x1b8237!=0xc8){_0x249173['cb'](null,{'code':_0x1b8237,'result':-0x1,'extra':'KO'});return;}_0x377392=_0x249173['rx'][_0x571d('0x10')](0x4)[_0x571d('0x12')](_0x571d('0x13'),'');if(_0x377392[_0x571d('0x14')]('\x20')!=-0x1){_0x377392=_0x377392['substr'](0x0,_0x377392[_0x571d('0x14')]('\x20'));}if(_[_0x571d('0x15')](_0x377392,'-1')){_0x377392=parseInt(_0x377392);}_0x141828=_0x249173['rx'][_0x571d('0x16')]('\x20');if(_0x141828[_0x571d('0x17')]==0x3){_0x141828=_0x141828[0x2][_0x571d('0x10')](0x1,_0x141828[0x2][_0x571d('0x17')]-0x1);}else if(_0x141828[_0x571d('0x17')]>0x3){var _0x49f2d6=/\((.+)\)/;var _0x70f187=_0x249173['rx'][_0x571d('0x18')](_0x49f2d6);if(_0x70f187){_0x141828=_0x70f187[0x1];}else{_0x141828=null;}}else{_0x141828=null;}_0x249173['cb'](null,{'code':_0x1b8237,'result':_0x377392,'extra':_0x141828});}});_0x99d7c1['on'](_0x571d('0x19'),function(_0x37b006){_0x35cc55['emit'](_0x571d('0x19'),new AGIError(_0x571d('0x1a'),_0x37b006['code']));});_0x99d7c1['on'](_0x571d('0x1b'),function(){_0x35cc55[_0x571d('0x9')](_0x571d('0x1b'),new AGIError(_0x571d('0x1c')));});_0x99d7c1['on'](_0x571d('0x1d'),function(){_0x35cc55[_0x571d('0x9')](_0x571d('0x1d'),new AGIError(_0x571d('0x1e')));_0x99d7c1[_0x571d('0x1f')]();});_0x99d7c1[_0x571d('0x20')](_0x342aea);this['command']=function(_0x595660,_0x5d710b){var _0x595660=_0x595660||'',_0x5d710b=typeof _0x5d710b=='function'?_0x5d710b:new Function();_0x249173={'tx':_0x595660,'rx':'','cb':_0x5d710b};_0x99d7c1[_0x571d('0x21')](_0x595660+'\x0a');},this['close']=function(){_0x99d7c1[_0x571d('0x1f')]();};}util[_0x571d('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x571d('0x23')]=function(_0x1daa30){return this[_0x571d('0x24')]['sync'](this,_0x1daa30);};AGIChannel[_0x571d('0x25')][_0x571d('0x26')]=function(){return this[_0x571d('0x23')]('ANSWER');};AGIChannel['prototype'][_0x571d('0x27')]=function(_0x53e5d1,_0x573b5e,_0x5cfdf6){_0x53e5d1=_0x53e5d1===undefined?_0x571d('0x28'):_0x53e5d1;_0x573b5e=_0x573b5e===undefined?'5':_0x573b5e;_0x5cfdf6=_0x5cfdf6===undefined?'1':_0x5cfdf6;return this[_0x571d('0x23')](util[_0x571d('0x29')](_0x571d('0x2a'),_0x53e5d1,_0x573b5e*0x3e8,_0x5cfdf6));};AGIChannel['prototype'][_0x571d('0x2b')]=function(_0x2a6764){_0x2a6764=_0x2a6764||_0x571d('0x2c');return this[_0x571d('0x23')](util['format'](_0x571d('0x2d'),_0x2a6764));};AGIChannel[_0x571d('0x25')][_0x571d('0x2e')]=function(_0x20dfdd,_0x529cb5){if(_[_0x571d('0x2f')](_0x529cb5)){return this[_0x571d('0x23')](util[_0x571d('0x29')](_0x571d('0x30'),_0x20dfdd,_0x529cb5['join'](',')));}return this[_0x571d('0x23')](util['format'](_0x571d('0x30'),_0x20dfdd,_0x529cb5));};AGIChannel[_0x571d('0x25')][_0x571d('0x31')]=function(_0x22e59e){return this[_0x571d('0x23')](util[_0x571d('0x29')]('SET\x20CONTEXT\x20%s',_0x22e59e));};AGIChannel[_0x571d('0x25')][_0x571d('0x32')]=function(_0x1f3d36){return this[_0x571d('0x23')](util[_0x571d('0x29')]('SET\x20EXTENSION\x20%s',_0x1f3d36));};AGIChannel[_0x571d('0x25')][_0x571d('0x33')]=function(_0x25e4a4){return this[_0x571d('0x23')](util[_0x571d('0x29')](_0x571d('0x34'),_0x25e4a4));};AGIChannel['prototype'][_0x571d('0xc')]=function(){return this['sendRequest'](_0x571d('0x35'));};AGIChannel[_0x571d('0x25')][_0x571d('0x36')]=function(_0x1bcbd0,_0x54cd21){var _0x3a447c=_[_0x571d('0x37')](_0x54cd21)||_[_0x571d('0x38')](_0x54cd21)?_0x54cd21['toString']():_0x54cd21;return this['sendRequest'](util[_0x571d('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1bcbd0,_0x3a447c?_0x3a447c[_0x571d('0x39')]()[_0x571d('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x571d('0x25')][_0x571d('0x3a')]=function(_0x44bd0d,_0x5041de){return this[_0x571d('0x23')](util['format'](_0x571d('0x3b'),_0x44bd0d,_0x5041de));};AGIChannel[_0x571d('0x25')][_0x571d('0x3c')]=function(_0x58cb55,_0x349b0c){return this[_0x571d('0x23')](util[_0x571d('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x58cb55,_0x349b0c));};AGIChannel[_0x571d('0x25')][_0x571d('0x3d')]=function(_0x2b621e,_0x53fb1b){return this['sendRequest'](util[_0x571d('0x29')](_0x571d('0x3e'),_0x2b621e,_0x53fb1b));};AGIChannel[_0x571d('0x25')]['continueAt']=function(_0x325a77,_0x67ef44,_0x4db8fc){_0x67ef44=_0x67ef44||this['extension'];_0x4db8fc=_0x4db8fc||0x1;this['setContext'](_0x325a77);this[_0x571d('0x32')](_0x67ef44);this[_0x571d('0x33')](_0x4db8fc);return this[_0x571d('0x2b')](util[_0x571d('0x29')](_0x571d('0x3f'),_0x325a77,_0x67ef44,_0x4db8fc));};AGIChannel['prototype'][_0x571d('0x40')]=function(_0x286a42){return this['sendRequest'](util[_0x571d('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0x286a42));};AGIChannel['prototype'][_0x571d('0x41')]=function(_0x3f83dc,_0x231026,_0x49b6dc,_0x39f2d6,_0x462306,_0x40cc91){_0x231026=_0x231026||'wav';_0x49b6dc=_0x49b6dc||'';_0x39f2d6=_0x39f2d6===undefined?-0x1:_0x39f2d6==='-1'?-0x1:_0x39f2d6*0x3e8;_0x462306=_0x462306===undefined?'':'s='+_0x462306;_0x40cc91=_0x40cc91?'BEEP':'';return this[_0x571d('0x23')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3f83dc,_0x231026,_0x49b6dc,_0x39f2d6,_0x40cc91,_0x462306));};AGIChannel['prototype'][_0x571d('0x42')]=function(_0x16aeb3,_0x4cdfba){_0x4cdfba=_0x4cdfba||'';return this[_0x571d('0x23')](util[_0x571d('0x29')](_0x571d('0x43'),_0x16aeb3,_0x4cdfba));};AGIChannel['prototype'][_0x571d('0x44')]=function(_0xa060d1){return this[_0x571d('0x2e')]('AGI',_0xa060d1);};AGIChannel[_0x571d('0x25')][_0x571d('0x45')]=function(_0x32568b){return this[_0x571d('0x2e')](_0x571d('0x46'),_0x32568b);};AGIChannel[_0x571d('0x25')][_0x571d('0x19')]=function(_0xb0d4de,_0x23dccf){this[_0x571d('0x2b')](util['format'](_0x571d('0x47'),_0xb0d4de['id'],_0xb0d4de['label'],_0x23dccf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x571d('0x48')]=AGIChannel; \ No newline at end of file +var _0x8cc2=['wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','ready','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','inherits','prototype','sendRequest','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','setExtension','SET\x20EXTENSION\x20%s','setPriority','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8cc2,0x1cb));var _0x28cc=function(_0x532d25,_0x9c9ca3){_0x532d25=_0x532d25-0x0;var _0x1f3cdb=_0x8cc2[_0x532d25];return _0x1f3cdb;};'use strict';var util=require('util');var _=require(_0x28cc('0x0'));var EventEmitter=require('events')[_0x28cc('0x1')];var AGIReply=require(_0x28cc('0x2'));var AGIError=require(_0x28cc('0x3'));function AGIChannel(_0x215e52){var _0x364630=this,_0x44eae2=new AGIReply(),_0x560705=![],_0x387c1e={};EventEmitter[_0x28cc('0x4')](_0x364630);_0x215e52[_0x28cc('0x5')](_0x28cc('0x6'));_0x215e52['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x44eae2[_0x28cc('0x5')](_0x28cc('0x6'));_0x44eae2['on'](_0x28cc('0x7'),function(_0x4f6813){for(var _0x400763 in _0x4f6813){_0x364630[_0x400763]=_0x4f6813[_0x400763];}_0x364630['emit'](_0x28cc('0x8'));});_0x44eae2['on']('line',function(_0x418650){if(_0x418650[_0x28cc('0x9')]()==_0x28cc('0xa')){_0x364630[_0x28cc('0xb')](_0x28cc('0xa'));return;}if(_0x418650[_0x28cc('0xc')](0x0,0xb)==_0x28cc('0xd')){_0x560705=!![];}if(_0x560705){_0x387c1e['rx']+=_0x418650+'\x0a';if(_0x418650[_0x28cc('0xe')](_0x28cc('0xf'))!=-0x1){_0x560705=![];}}else{_0x387c1e['rx']=_0x418650;}if(_0x560705){return;}if(typeof _0x387c1e['cb']=='function'){var _0xaf8ef1=_0x387c1e['rx'][_0x28cc('0xc')](0x0,0x3),_0x38ddc3=null,_0x21e748=null;_0xaf8ef1=parseInt(_0xaf8ef1);if(isNaN(_0xaf8ef1)){_0x387c1e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x28cc('0x10')});return;}if(_0xaf8ef1!=0xc8){_0x387c1e['cb'](null,{'code':_0xaf8ef1,'result':-0x1,'extra':'KO'});return;}_0x38ddc3=_0x387c1e['rx'][_0x28cc('0xc')](0x4)[_0x28cc('0x11')](_0x28cc('0x12'),'');if(_0x38ddc3[_0x28cc('0x13')]('\x20')!=-0x1){_0x38ddc3=_0x38ddc3[_0x28cc('0x14')](0x0,_0x38ddc3[_0x28cc('0x13')]('\x20'));}if(_[_0x28cc('0x15')](_0x38ddc3,'-1')){_0x38ddc3=parseInt(_0x38ddc3);}_0x21e748=_0x387c1e['rx'][_0x28cc('0x16')]('\x20');if(_0x21e748[_0x28cc('0x17')]==0x3){_0x21e748=_0x21e748[0x2][_0x28cc('0xc')](0x1,_0x21e748[0x2][_0x28cc('0x17')]-0x1);}else if(_0x21e748[_0x28cc('0x17')]>0x3){var _0x5b5d3a=/\((.+)\)/;var _0x49487c=_0x387c1e['rx']['match'](_0x5b5d3a);if(_0x49487c){_0x21e748=_0x49487c[0x1];}else{_0x21e748=null;}}else{_0x21e748=null;}_0x387c1e['cb'](null,{'code':_0xaf8ef1,'result':_0x38ddc3,'extra':_0x21e748});}});_0x215e52['on'](_0x28cc('0x18'),function(_0x188288){_0x364630[_0x28cc('0xb')](_0x28cc('0x18'),new AGIError(_0x28cc('0x19'),_0x188288[_0x28cc('0x1a')]));});_0x215e52['on'](_0x28cc('0x1b'),function(){_0x364630[_0x28cc('0xb')]('close',new AGIError(_0x28cc('0x1c')));});_0x215e52['on']('timeout',function(){_0x364630[_0x28cc('0xb')](_0x28cc('0x1d'),new AGIError(_0x28cc('0x1e')));_0x215e52[_0x28cc('0x1f')]();});_0x215e52[_0x28cc('0x20')](_0x44eae2);this[_0x28cc('0x21')]=function(_0x1dc054,_0x3c839e){var _0x1dc054=_0x1dc054||'',_0x3c839e=typeof _0x3c839e==_0x28cc('0x22')?_0x3c839e:new Function();_0x387c1e={'tx':_0x1dc054,'rx':'','cb':_0x3c839e};_0x215e52['write'](_0x1dc054+'\x0a');},this[_0x28cc('0x1b')]=function(){_0x215e52[_0x28cc('0x1f')]();};}util[_0x28cc('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x28cc('0x24')][_0x28cc('0x25')]=function(_0x8e5944){return this[_0x28cc('0x21')]['sync'](this,_0x8e5944);};AGIChannel[_0x28cc('0x24')][_0x28cc('0x26')]=function(){return this[_0x28cc('0x25')](_0x28cc('0x27'));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x28')]=function(_0x2b8c57,_0x2b80ae,_0x595f4a){_0x2b8c57=_0x2b8c57===undefined?_0x28cc('0x29'):_0x2b8c57;_0x2b80ae=_0x2b80ae===undefined?'5':_0x2b80ae;_0x595f4a=_0x595f4a===undefined?'1':_0x595f4a;return this['sendRequest'](util[_0x28cc('0x2a')](_0x28cc('0x2b'),_0x2b8c57,_0x2b80ae*0x3e8,_0x595f4a));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x2c')]=function(_0x486064){_0x486064=_0x486064||_0x28cc('0x2d');return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x2e'),_0x486064));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x2f')]=function(_0xd7c16,_0x232fb2){if(_[_0x28cc('0x30')](_0x232fb2)){return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x31'),_0xd7c16,_0x232fb2[_0x28cc('0x32')](',')));}return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x31'),_0xd7c16,_0x232fb2));};AGIChannel['prototype']['setContext']=function(_0x37da10){return this['sendRequest'](util[_0x28cc('0x2a')]('SET\x20CONTEXT\x20%s',_0x37da10));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x33')]=function(_0x4975c2){return this['sendRequest'](util['format'](_0x28cc('0x34'),_0x4975c2));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x35')]=function(_0x1b49d6){return this[_0x28cc('0x25')](util[_0x28cc('0x2a')]('SET\x20PRIORITY\x20%s',_0x1b49d6));};AGIChannel['prototype']['hangup']=function(){return this[_0x28cc('0x25')]('HANGUP');};AGIChannel[_0x28cc('0x24')]['setVariable']=function(_0x8de45d,_0xe38930){var _0x31d32b=_[_0x28cc('0x36')](_0xe38930)||_['isNumber'](_0xe38930)?_0xe38930[_0x28cc('0x37')]():_0xe38930;return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x38'),_0x8de45d,_0x31d32b?_0x31d32b[_0x28cc('0x37')]()[_0x28cc('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x39')]=function(_0x57ac42,_0x3884b1){return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x3a'),_0x57ac42,_0x3884b1));};AGIChannel[_0x28cc('0x24')]['sayDigits']=function(_0x1c6497,_0x3a1d7d){return this['sendRequest'](util['format'](_0x28cc('0x3b'),_0x1c6497,_0x3a1d7d));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x3c')]=function(_0x681f2e,_0x39c360){return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x3d'),_0x681f2e,_0x39c360));};AGIChannel['prototype']['continueAt']=function(_0xdc3cce,_0x1f37c0,_0x3604c6){_0x1f37c0=_0x1f37c0||this[_0x28cc('0x3e')];_0x3604c6=_0x3604c6||0x1;this['setContext'](_0xdc3cce);this[_0x28cc('0x33')](_0x1f37c0);this[_0x28cc('0x35')](_0x3604c6);return this['noop'](util[_0x28cc('0x2a')](_0x28cc('0x3f'),_0xdc3cce,_0x1f37c0,_0x3604c6));};AGIChannel['prototype'][_0x28cc('0x40')]=function(_0x383159){return this['sendRequest'](util[_0x28cc('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x383159));};AGIChannel['prototype'][_0x28cc('0x41')]=function(_0x545319,_0xc34b34,_0x4cd729,_0x3814a4,_0x49cb76,_0x311323){_0xc34b34=_0xc34b34||_0x28cc('0x42');_0x4cd729=_0x4cd729||'';_0x3814a4=_0x3814a4===undefined?-0x1:_0x3814a4==='-1'?-0x1:_0x3814a4*0x3e8;_0x49cb76=_0x49cb76===undefined?'':'s='+_0x49cb76;_0x311323=_0x311323?_0x28cc('0x43'):'';return this[_0x28cc('0x25')](util[_0x28cc('0x2a')](_0x28cc('0x44'),_0x545319,_0xc34b34,_0x4cd729,_0x3814a4,_0x311323,_0x49cb76));};AGIChannel[_0x28cc('0x24')][_0x28cc('0x45')]=function(_0x42cf0c,_0x27b2d2){_0x27b2d2=_0x27b2d2||'';return this['sendRequest'](util[_0x28cc('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x42cf0c,_0x27b2d2));};AGIChannel[_0x28cc('0x24')]['agi']=function(_0x7f660f){return this[_0x28cc('0x2f')](_0x28cc('0x46'),_0x7f660f);};AGIChannel[_0x28cc('0x24')][_0x28cc('0x47')]=function(_0x164084){return this['exec']('WAIT',_0x164084);};AGIChannel['prototype'][_0x28cc('0x18')]=function(_0x3329b1,_0x91b860){this['noop'](util[_0x28cc('0x2a')](_0x28cc('0x48'),_0x3329b1['id'],_0x3329b1[_0x28cc('0x49')],_0x91b860));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x28cc('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index fc480df..6ddffb5 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 _0xfa8b=['message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply'];(function(_0x5b0da7,_0x52fc20){var _0x5075f1=function(_0x3c5429){while(--_0x3c5429){_0x5b0da7['push'](_0x5b0da7['shift']());}};_0x5075f1(++_0x52fc20);}(_0xfa8b,0x135));var _0xbfa8=function(_0x28e304,_0x56d96a){_0x28e304=_0x28e304-0x0;var _0x97f8b8=_0xfa8b[_0x28e304];return _0x97f8b8;};'use strict';var util=require(_0xbfa8('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xbfa8('0x1'),'E_AGI_SERVER_ERROR':_0xbfa8('0x2'),'E_AGI_SERVER_CLOSE':_0xbfa8('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xbfa8('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xbfa8('0x5'),'E_AGI_SOCKET_ERROR':_0xbfa8('0x6'),'E_AGI_SOCKET_CLOSE':_0xbfa8('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xbfa8('0x8'),'E_AGI_COMMAND_EMPTY':_0xbfa8('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbfa8('0xa'),'E_AGI_IVR_ENTRY':_0xbfa8('0xb')};function AGIError(_0x13569c){var _0x13569c=_0x13569c||null,_0x156e14=_0x156e14||[],_0x471e7a=0x1,_0x11ba95='';if(!error[_0x13569c]){_0x13569c=_0xbfa8('0xc');}_0x156e14['push'](error[_0x13569c]);while(arguments[_0x471e7a]){_0x156e14[_0xbfa8('0xd')](arguments[_0x471e7a]);_0x471e7a++;}_0x11ba95=util['format'][_0xbfa8('0xe')](util,_0x156e14);this[_0xbfa8('0xf')]=_0x11ba95;this[_0xbfa8('0x10')]=_0x13569c;}module[_0xbfa8('0x11')]=AGIError; \ No newline at end of file +var _0x2e01=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x241e67,_0x3b6513){var _0x28feee=function(_0x1ad2a6){while(--_0x1ad2a6){_0x241e67['push'](_0x241e67['shift']());}};_0x28feee(++_0x3b6513);}(_0x2e01,0xfe));var _0x12e0=function(_0x254702,_0x346d18){_0x254702=_0x254702-0x0;var _0x304f8c=_0x2e01[_0x254702];return _0x304f8c;};'use strict';var util=require(_0x12e0('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x12e0('0x1'),'E_AGI_SERVER_ERROR':_0x12e0('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x12e0('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x12e0('0x4'),'E_AGI_SOCKET_CLOSE':_0x12e0('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x12e0('0x6'),'E_AGI_COMMAND_EMPTY':_0x12e0('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x12e0('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x360c8c){var _0x360c8c=_0x360c8c||null,_0x288cf8=_0x288cf8||[],_0x5ef7c0=0x1,_0x4263a8='';if(!error[_0x360c8c]){_0x360c8c=_0x12e0('0x9');}_0x288cf8['push'](error[_0x360c8c]);while(arguments[_0x5ef7c0]){_0x288cf8[_0x12e0('0xa')](arguments[_0x5ef7c0]);_0x5ef7c0++;}_0x4263a8=util['format']['apply'](util,_0x288cf8);this[_0x12e0('0xb')]=_0x4263a8;this[_0x12e0('0xc')]=_0x360c8c;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index bfb7f45..dd0511e 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 _0xb969=['message','parse','emit','projectUpdate','error','lodash','events','EventEmitter','../../config/environment','redis','localhost','subscribe','agi','E_AGI_SERVER_ERROR'];(function(_0x2578dc,_0x1cc29f){var _0x6c6c9d=function(_0x27819d){while(--_0x27819d){_0x2578dc['push'](_0x2578dc['shift']());}};_0x6c6c9d(++_0x1cc29f);}(_0xb969,0x171));var _0x9b96=function(_0x6da70f,_0x4d05ce){_0x6da70f=_0x6da70f-0x0;var _0x95c51d=_0xb969[_0x6da70f];return _0x95c51d;};'use strict';var _=require(_0x9b96('0x0'));var EventEmitter=require(_0x9b96('0x1'))[_0x9b96('0x2')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x9b96('0x3'));config[_0x9b96('0x4')]=_['defaults'](config['redis'],{'host':_0x9b96('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x9b96('0x6')](_0x9b96('0x7'),function(_0x207cba){if(_0x207cba)return eventEmitter['emit']('error',new AGIError(_0x9b96('0x8'),_0x207cba));});sub['on'](_0x9b96('0x9'),function(_0x11197a,_0x2fd463){if(_0x11197a!==_0x9b96('0x7'))return;try{var _0x5bf8cb=JSON[_0x9b96('0xa')](_0x2fd463);eventEmitter[_0x9b96('0xb')](_0x9b96('0xc'),_0x5bf8cb);}catch(_0xcc30b2){eventEmitter[_0x9b96('0xb')](_0x9b96('0xd'),new AGIError(_0x9b96('0x8'),_0xcc30b2));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x5bf2=['./error','../../config/environment','redis','localhost','subscribe','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','exports','lodash','events','ioredis'];(function(_0x5ec0aa,_0x614ad9){var _0x47daf3=function(_0x1bf5b9){while(--_0x1bf5b9){_0x5ec0aa['push'](_0x5ec0aa['shift']());}};_0x47daf3(++_0x614ad9);}(_0x5bf2,0x75));var _0x25bf=function(_0x311e46,_0x398150){_0x311e46=_0x311e46-0x0;var _0x1ed1f8=_0x5bf2[_0x311e46];return _0x1ed1f8;};'use strict';var _=require(_0x25bf('0x0'));var EventEmitter=require(_0x25bf('0x1'))['EventEmitter'];var Redis=require(_0x25bf('0x2'));var AGIError=require(_0x25bf('0x3'));var config=require(_0x25bf('0x4'));config[_0x25bf('0x5')]=_['defaults'](config[_0x25bf('0x5')],{'host':_0x25bf('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x25bf('0x5')]);sub[_0x25bf('0x7')]('agi',function(_0x44b707){if(_0x44b707)return eventEmitter['emit'](_0x25bf('0x8'),new AGIError(_0x25bf('0x9'),_0x44b707));});sub['on'](_0x25bf('0xa'),function(_0x16e47e,_0x45ebd4){if(_0x16e47e!=='agi')return;try{var _0x21a334=JSON[_0x25bf('0xb')](_0x45ebd4);eventEmitter[_0x25bf('0xc')](_0x25bf('0xd'),_0x21a334);}catch(_0xa83461){eventEmitter[_0x25bf('0xc')](_0x25bf('0x8'),new AGIError(_0x25bf('0x9'),_0xa83461));}});module[_0x25bf('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 e0753c7..9705f3e 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 _0x8bff=['vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand'];(function(_0xdaf48b,_0x36a245){var _0x32feef=function(_0x19eb8a){while(--_0x19eb8a){_0xdaf48b['push'](_0xdaf48b['shift']());}};_0x32feef(++_0x36a245);}(_0x8bff,0xbc));var _0xf8bf=function(_0x367dba,_0x35821e){_0x367dba=_0x367dba-0x0;var _0x4b5908=_0x8bff[_0x367dba];return _0x4b5908;};'use strict';var _=require(_0xf8bf('0x0'));var logger=require(_0xf8bf('0x1'))(_0xf8bf('0x2'));var verticesWithRetry=[_0xf8bf('0x3'),_0xf8bf('0x4'),_0xf8bf('0x5')];var Graph=function(){this[_0xf8bf('0x6')]={};this[_0xf8bf('0x7')]={};this[_0xf8bf('0x8')]=0x0;};Graph[_0xf8bf('0x9')]['addVertex']=function(_0x40da40){this[_0xf8bf('0x6')][_0x40da40['id']]=_0x40da40;this[_0xf8bf('0x7')][_0x40da40['id']]=[];};Graph['prototype'][_0xf8bf('0xa')]=function(_0x47e71c,_0xde6b6d,_0x121bae){this[_0xf8bf('0x7')][_0x47e71c][_0xf8bf('0xb')]({'target':_0xde6b6d,'condition':_0x121bae});this[_0xf8bf('0x8')]+=0x1;};Graph[_0xf8bf('0x9')]['size']=function(){return _[_0xf8bf('0xc')](this[_0xf8bf('0x6')]);};Graph[_0xf8bf('0x9')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xf8bf('0x9')][_0xf8bf('0xd')]=function(_0x2e91cc){return this[_0xf8bf('0x6')][_0x2e91cc];};Graph[_0xf8bf('0x9')][_0xf8bf('0xe')]=function(_0x21885b,_0x12e8d2){if(!this['vertices'][_0x21885b]){return logger[_0xf8bf('0xf')]('no\x20vertex\x20found');}var _0x5ee050=_0x12e8d2(this[_0xf8bf('0x6')][_0x21885b]);if(!_0x5ee050){return logger[_0xf8bf('0xf')](_0xf8bf('0x10'));}if(this[_0xf8bf('0x7')][_0x21885b][_0xf8bf('0x11')]===0x0){return logger[_0xf8bf('0xf')](_0xf8bf('0x12'));}for(var _0x1c5eea=0x0,_0x4fed25=[],_0x2bba93=![];_0x1c5eea\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','createSquareReport','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','find','handleNotFound','production','handleUnpublished'];(function(_0x379396,_0x4353ae){var _0x391ba7=function(_0x5f5812){while(--_0x5f5812){_0x379396['push'](_0x379396['shift']());}};_0x391ba7(++_0x4353ae);}(_0x2387,0xf6));var _0x7238=function(_0x1d5928,_0x2eeeac){_0x1d5928=_0x1d5928-0x0;var _0xaef838=_0x2387[_0x1d5928];return _0xaef838;};'use strict';var _=require(_0x7238('0x0'));var syncho=require(_0x7238('0x1'));var util=require(_0x7238('0x2'));var config=require(_0x7238('0x3'));var logger=require(_0x7238('0x4'))(_0x7238('0x5'));var utilLicense=require(_0x7238('0x6'));var rpc=require(_0x7238('0x7'));var Project=require(_0x7238('0x8'));var AGIEmitter=require(_0x7238('0x9'))['EventEmitter'];var projects=[];config[_0x7238('0x5')]=_[_0x7238('0xa')](config[_0x7238('0x5')],{'ip':_0x7238('0xb'),'port':0x11dd});AGIEmitter['on'](_0x7238('0xc'),projectUpdateHandler);function connectionHandler(_0x3cab80){process[_0x7238('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3cab80);agiHandler(_0x3cab80);}catch(_0x15ff13){logger[_0x7238('0xe')](_0x15ff13[_0x7238('0xf')]);}});});}function projectUpdateHandler(_0x515b40){try{var _0x422efd=_[_0x7238('0x10')](projects,['id',_0x515b40['id']]);if(_0x422efd>-0x1){if(_0x515b40[_0x7238('0x11')]===!![]){projects['splice'](_0x422efd,0x1);}else{projects[_0x422efd]=_0x515b40;}}else{projects[_0x7238('0x12')](_0x515b40);}}catch(_0x5a8db4){logger[_0x7238('0xe')](_0x5a8db4['stack']);}}function listeningHandler(){console[_0x7238('0x13')](_0x7238('0x14'),config[_0x7238('0x5')]['port']);logger[_0x7238('0x15')](util[_0x7238('0x16')](_0x7238('0x17'),config[_0x7238('0x5')]['ip'],config[_0x7238('0x5')][_0x7238('0x18')]));}function errorHandler(_0xcae1){if(_0xcae1&&_0xcae1[_0x7238('0x19')]&&_0xcae1[_0x7238('0x1a')]){logger[_0x7238('0xe')](util[_0x7238('0x16')]('[%s]\x20%s',_0xcae1[_0x7238('0x19')],_0xcae1['message']));}else{logger[_0x7238('0xe')](util[_0x7238('0x16')]('[ERROR]\x20%s',_0xcae1[_0x7238('0xf')]));}}function closeHandler(){logger[_0x7238('0x15')](util['format'](_0x7238('0x1b'),this[_0x7238('0x1c')],this[_0x7238('0x1d')],this[_0x7238('0x1e')],this[_0x7238('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5b9d89){logger[_0x7238('0xe')](_0x5b9d89['stack']);}}function timeoutHandler(){logger[_0x7238('0x15')](util[_0x7238('0x16')](_0x7238('0x20'),this[_0x7238('0x1c')],this['calleridname'],this['callerid'],this[_0x7238('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x7238('0x15')](util[_0x7238('0x16')](_0x7238('0x21'),this[_0x7238('0x1c')],this['calleridname'],this[_0x7238('0x1e')],this[_0x7238('0x1f')],this[_0x7238('0x22')]));this[_0x7238('0x23')]=!![];}function createSquareReport(_0x41bdd4,_0x3b33dd){rpc[_0x7238('0x24')](_0x41bdd4)['then'](function(_0x2a305d){if(_0x3b33dd){_0x3b33dd(null,_0x2a305d);}})['catch'](function(_0x375dcd){if(_0x3b33dd){_0x3b33dd(null,_0x375dcd);}});}function setChannelVariables(_0x11f6e6){for(var _0x55fcb9 in _0x11f6e6){if(_0x11f6e6[_0x7238('0x25')](_0x55fcb9)){if(_0x55fcb9[_0x7238('0x26')](_0x7238('0x27'))===0x0){_0x11f6e6[_0x55fcb9[_0x7238('0x28')](0x4)]=_0x11f6e6[_0x55fcb9];delete _0x11f6e6[_0x55fcb9];}}}}function agiHandler(_0x4ff8fa){logger['debug'](_0x7238('0x29'),JSON[_0x7238('0x2a')](_0x4ff8fa,null,0x2));logger[_0x7238('0x15')](util[_0x7238('0x16')](_0x7238('0x2b'),_0x4ff8fa[_0x7238('0x1c')],_0x4ff8fa[_0x7238('0x1d')],_0x4ff8fa[_0x7238('0x1e')],_0x4ff8fa[_0x7238('0x1f')],_0x4ff8fa[_0x7238('0x22')]));_0x4ff8fa['on'](_0x7238('0xe'),errorHandler);_0x4ff8fa['on']('close',closeHandler);_0x4ff8fa['on']('timeout',timeoutHandler);_0x4ff8fa[_0x7238('0x23')]=![];_0x4ff8fa['on'](_0x7238('0x2c'),hangupHandler);var _0x7cd91b=_[_0x7238('0x2d')](projects,[_0x7238('0x19'),_0x4ff8fa[_0x7238('0x1c')]]);if(!_0x7cd91b)return Project[_0x7238('0x2e')](_0x4ff8fa);if(!_0x7cd91b[_0x7238('0x2f')])return Project[_0x7238('0x30')](_0x4ff8fa);return Project[_0x7238('0x31')](_0x7cd91b,_0x4ff8fa);}function main(){var _0x39807f;return utilLicense['getLicense']()[_0x7238('0x32')](function(_0x113d82){if(!_0x113d82)return;if(_0x113d82[_0x7238('0x33')]){if(_0x113d82[_0x7238('0x34')]&&_0x113d82[_0x7238('0x34')]>0x0){logger[_0x7238('0x15')](util[_0x7238('0x16')]('[LICENSE]\x20CHANNELS:\x20%s',_0x113d82[_0x7238('0x34')]));_0x39807f=_0x113d82['callysquare'];}else{logger[_0x7238('0x15')](_0x7238('0x35'));}}else{logger['info'](_0x7238('0x36'));_0x39807f=-0x1;}})[_0x7238('0x32')](function(){return Project[_0x7238('0x37')]();})['then'](function(_0x275aa3){projects=_0x275aa3;return;})['catch'](function(_0x293f3f){logger['error'](_0x7238('0x38'),_0x293f3f['stack']);})['finally'](function(){var _0x3a087e=require('./server')(config['agi'][_0x7238('0x18')],config[_0x7238('0x5')]['ip'],_0x39807f);_0x3a087e['on'](_0x7238('0xe'),errorHandler);_0x3a087e['on']('listening',listeningHandler);_0x3a087e['on'](_0x7238('0x39'),connectionHandler);_0x3a087e['on'](_0x7238('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0xe06a=['defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','info','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','close','lodash','syncho','../../config/environment','agi','../../config/license/util','./rpc','./project','EventEmitter'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0xe06a,0x6e));var _0xae06=function(_0x3449c3,_0x19852f){_0x3449c3=_0x3449c3-0x0;var _0x3a2901=_0xe06a[_0x3449c3];return _0x3a2901;};'use strict';var _=require(_0xae06('0x0'));var syncho=require(_0xae06('0x1'));var util=require('util');var config=require(_0xae06('0x2'));var logger=require('../../config/logger')(_0xae06('0x3'));var utilLicense=require(_0xae06('0x4'));var rpc=require(_0xae06('0x5'));var Project=require(_0xae06('0x6'));var AGIEmitter=require('./events')[_0xae06('0x7')];var projects=[];config[_0xae06('0x3')]=_[_0xae06('0x8')](config['agi'],{'ip':_0xae06('0x9'),'port':0x11dd});AGIEmitter['on'](_0xae06('0xa'),projectUpdateHandler);function connectionHandler(_0x359957){process[_0xae06('0xb')](function(){syncho(function(){try{setChannelVariables(_0x359957);agiHandler(_0x359957);}catch(_0x58a982){logger[_0xae06('0xc')](_0x58a982[_0xae06('0xd')]);}});});}function projectUpdateHandler(_0x324063){try{var _0x166499=_[_0xae06('0xe')](projects,['id',_0x324063['id']]);if(_0x166499>-0x1){if(_0x324063[_0xae06('0xf')]===!![]){projects['splice'](_0x166499,0x1);}else{projects[_0x166499]=_0x324063;}}else{projects[_0xae06('0x10')](_0x324063);}}catch(_0x24f3e6){logger[_0xae06('0xc')](_0x24f3e6[_0xae06('0xd')]);}}function listeningHandler(){console[_0xae06('0x11')](_0xae06('0x12'),config[_0xae06('0x3')][_0xae06('0x13')]);logger['info'](util[_0xae06('0x14')](_0xae06('0x15'),config[_0xae06('0x3')]['ip'],config['agi']['port']));}function errorHandler(_0x53f416){if(_0x53f416&&_0x53f416[_0xae06('0x16')]&&_0x53f416[_0xae06('0x17')]){logger[_0xae06('0xc')](util[_0xae06('0x14')]('[%s]\x20%s',_0x53f416[_0xae06('0x16')],_0x53f416[_0xae06('0x17')]));}else{logger[_0xae06('0xc')](util[_0xae06('0x14')]('[ERROR]\x20%s',_0x53f416['stack']));}}function closeHandler(){logger['info'](util[_0xae06('0x14')](_0xae06('0x18'),this[_0xae06('0x19')],this[_0xae06('0x1a')],this['callerid'],this[_0xae06('0x1b')],this[_0xae06('0x1c')]));try{createSquareReport(this);}catch(_0x53ee8){logger['error'](_0x53ee8['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0xae06('0x1d'),this[_0xae06('0x19')],this['calleridname'],this[_0xae06('0x1e')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xae06('0x1f')](util[_0xae06('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xae06('0x19')],this[_0xae06('0x1a')],this[_0xae06('0x1e')],this[_0xae06('0x1b')],this[_0xae06('0x1c')]));this[_0xae06('0x20')]=!![];}function createSquareReport(_0x4fb154,_0x4011fb){rpc[_0xae06('0x21')](_0x4fb154)[_0xae06('0x22')](function(_0x34d94b){if(_0x4011fb){_0x4011fb(null,_0x34d94b);}})[_0xae06('0x23')](function(_0x2ea46a){if(_0x4011fb){_0x4011fb(null,_0x2ea46a);}});}function setChannelVariables(_0x19ddfc){for(var _0x50c329 in _0x19ddfc){if(_0x19ddfc[_0xae06('0x24')](_0x50c329)){if(_0x50c329[_0xae06('0x25')](_0xae06('0x26'))===0x0){_0x19ddfc[_0x50c329[_0xae06('0x27')](0x4)]=_0x19ddfc[_0x50c329];delete _0x19ddfc[_0x50c329];}}}}function agiHandler(_0x134b7f){logger[_0xae06('0x28')](_0xae06('0x29'),JSON[_0xae06('0x2a')](_0x134b7f,null,0x2));logger[_0xae06('0x1f')](util[_0xae06('0x14')](_0xae06('0x2b'),_0x134b7f[_0xae06('0x19')],_0x134b7f['calleridname'],_0x134b7f[_0xae06('0x1e')],_0x134b7f['dnid'],_0x134b7f[_0xae06('0x1c')]));_0x134b7f['on']('error',errorHandler);_0x134b7f['on']('close',closeHandler);_0x134b7f['on'](_0xae06('0x2c'),timeoutHandler);_0x134b7f[_0xae06('0x20')]=![];_0x134b7f['on']('hangup',hangupHandler);var _0x3e50c6=_['find'](projects,['name',_0x134b7f['arg_1']]);if(!_0x3e50c6)return Project['handleNotFound'](_0x134b7f);if(!_0x3e50c6[_0xae06('0x2d')])return Project[_0xae06('0x2e')](_0x134b7f);return Project[_0xae06('0x2f')](_0x3e50c6,_0x134b7f);}function main(){var _0x1e1bac;return utilLicense[_0xae06('0x30')]()['then'](function(_0x18881f){if(!_0x18881f)return;if(_0x18881f[_0xae06('0x31')]){if(_0x18881f[_0xae06('0x32')]&&_0x18881f['callysquare']>0x0){logger[_0xae06('0x1f')](util[_0xae06('0x14')](_0xae06('0x33'),_0x18881f[_0xae06('0x32')]));_0x1e1bac=_0x18881f[_0xae06('0x32')];}else{logger['info'](_0xae06('0x34'));}}else{logger[_0xae06('0x1f')](_0xae06('0x35'));_0x1e1bac=-0x1;}})['then'](function(){return Project[_0xae06('0x36')]();})['then'](function(_0x3494cd){projects=_0x3494cd;return;})[_0xae06('0x23')](function(_0x299108){logger[_0xae06('0xc')](_0xae06('0x37'),_0x299108['stack']);})[_0xae06('0x38')](function(){var _0x4a316b=require(_0xae06('0x39'))(config['agi']['port'],config[_0xae06('0x3')]['ip'],_0x1e1bac);_0x4a316b['on'](_0xae06('0xc'),errorHandler);_0x4a316b['on']('listening',listeningHandler);_0x4a316b['on']('connection',connectionHandler);_0x4a316b['on'](_0xae06('0x3a'),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 dd85df4..6f59059 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 _0x2bae=['SendMail','bluebird','jayson/promise','request','then','error','message','result','catch','sendMailMessage'];(function(_0x755816,_0x417c18){var _0x97892e=function(_0x26dc10){while(--_0x26dc10){_0x755816['push'](_0x755816['shift']());}};_0x97892e(++_0x417c18);}(_0x2bae,0x141));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xe2ba('0x0'));var jayson=require(_0xe2ba('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x3f09c3,_0x468536){return new BPromise(function(_0x301a9e,_0x146f35){return client[_0xe2ba('0x2')](_0x3f09c3,_0x468536)[_0xe2ba('0x3')](function(_0x13edde){if(_0x13edde[_0xe2ba('0x4')]){return _0x146f35(_0x13edde[_0xe2ba('0x4')][_0xe2ba('0x5')]);}else{return _0x301a9e(_0x13edde[_0xe2ba('0x6')]);}})[_0xe2ba('0x7')](function(_0x4fd9d7){return _0x146f35(_0x4fd9d7);});});}exports[_0xe2ba('0x8')]=function(_0x1d1c5a,_0x2f4e48){return request(_0xe2ba('0x9'),{'account':_0x1d1c5a,'message':_0x2f4e48});}; \ No newline at end of file +var _0xb2a4=['error','message','result','catch','sendMailMessage','SendMail','bluebird','client','request','then'];(function(_0x4d5179,_0x1275a1){var _0xe7d4d1=function(_0x482148){while(--_0x482148){_0x4d5179['push'](_0x4d5179['shift']());}};_0xe7d4d1(++_0x1275a1);}(_0xb2a4,0xba));var _0x4b2a=function(_0x518778,_0x3824d6){_0x518778=_0x518778-0x0;var _0x1bf830=_0xb2a4[_0x518778];return _0x1bf830;};'use strict';var BPromise=require(_0x4b2a('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x4b2a('0x1')]['http']({'port':0x232b});function request(_0x1eb8b1,_0x576cf1){return new BPromise(function(_0x49d248,_0x29abce){return client[_0x4b2a('0x2')](_0x1eb8b1,_0x576cf1)[_0x4b2a('0x3')](function(_0x3bc110){if(_0x3bc110[_0x4b2a('0x4')]){return _0x29abce(_0x3bc110[_0x4b2a('0x4')][_0x4b2a('0x5')]);}else{return _0x49d248(_0x3bc110[_0x4b2a('0x6')]);}})[_0x4b2a('0x7')](function(_0xaf96d4){return _0x29abce(_0xaf96d4);});});}exports[_0x4b2a('0x8')]=function(_0x43479a,_0x197d47){return request(_0x4b2a('0x9'),{'account':_0x43479a,'message':_0x197d47});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index fc63cc0..22db8c6 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 _0x6ab9=['[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','addEdge','source','target','value','mxGraphModel','root','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally'];(function(_0x8697,_0x85c015){var _0x36f90b=function(_0x349aa0){while(--_0x349aa0){_0x8697['push'](_0x8697['shift']());}};_0x36f90b(++_0x85c015);}(_0x6ab9,0x109));var _0x96ab=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x6ab9[_0x39e283];return _0x7de89f;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require('xml2json');var util=require(_0x96ab('0x0'));var logger=require(_0x96ab('0x1'))(_0x96ab('0x2'));var rpc=require(_0x96ab('0x3'));var mailRpc=require(_0x96ab('0x4'));var Graph=require(_0x96ab('0x5'));var Vertices=require(_0x96ab('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x96ab('0x7')]()[_0x96ab('0x8')](function(_0x499861){logger[_0x96ab('0x9')](_0x96ab('0xa'),_0x499861[_0x96ab('0xb')]);return[];});}function addVertex(_0x898f19,_0x317452,_0x210fc8){_0x317452[_0x96ab('0xc')]=_0x210fc8;if(_0x317452['hasOwnProperty'](_0x96ab('0xd'))){_0x317452[_0x96ab('0xe')]=parseInt(_0x317452[_0x96ab('0xd')],0xa);}_0x898f19[_0x96ab('0xf')](_[_0x96ab('0x10')](_0x317452,_0x96ab('0x11')));}function initGraph(_0x2b8349,_0x1113fd){var _0xce30a9=new Graph();for(var _0x8e4a29 in _0x2b8349){if(_0x2b8349[_0x96ab('0x12')](_0x8e4a29)){if(_[_0x96ab('0x13')](_0x2b8349[_0x8e4a29])){for(var _0x49b20e=0x0;_0x49b20e<_0x2b8349[_0x8e4a29][_0x96ab('0x14')];_0x49b20e+=0x1){addVertex(_0xce30a9,_0x2b8349[_0x8e4a29][_0x49b20e],_0x8e4a29);}}else{addVertex(_0xce30a9,_0x2b8349[_0x8e4a29],_0x8e4a29);}}}for(var _0x5d3a7f=0x0;_0x5d3a7f<_0x1113fd[_0x96ab('0x14')];_0x5d3a7f+=0x1){if(_0x1113fd[_0x5d3a7f]['source']&&_0x1113fd[_0x5d3a7f]['target']){_0xce30a9[_0x96ab('0x15')](_0x1113fd[_0x5d3a7f][_0x96ab('0x16')],_0x1113fd[_0x5d3a7f][_0x96ab('0x17')],_0x1113fd[_0x5d3a7f][_0x96ab('0x18')]);}}return _0xce30a9;}function getRoot(_0x4b0c1e){return parser['toJson'](_0x4b0c1e,{'object':!![]})[_0x96ab('0x19')][_0x96ab('0x1a')];}function inspect(_0x56a9ee){return util['inspect'](_0x56a9ee,{'showHidden':![],'depth':null});}function initialize(_0x55c803,_0x14a333){var _0xbcfafb=getRoot(_0x55c803[_0x96ab('0x1b')]);if(!_0xbcfafb||!_0xbcfafb[_0x96ab('0x1c')])return;var _0x2c1f8e,_0x358549,_0x5d9b72;logger[_0x96ab('0x1d')](_0x96ab('0x1a'),JSON[_0x96ab('0x1e')](_0xbcfafb,null,0x2));_0x14a333[_0x96ab('0x1f')]=moment()['format'](_0x96ab('0x20'));_0x2c1f8e=initGraph(_['omit'](_0xbcfafb,'mxCell'),_0xbcfafb['mxCell']);_0x358549=new Vertices(_0x14a333,rpc,mailRpc);logger['info'](util[_0x96ab('0x21')](_0x96ab('0x22'),_0x14a333['arg_1'],_0x14a333[_0x96ab('0x23')],_0x14a333[_0x96ab('0x24')],_0x14a333[_0x96ab('0x25')],_0x14a333['uniqueid']));_0x2c1f8e[_0x96ab('0x26')](_0xbcfafb['start']['id'],function(_0x3553f4){try{_0x3553f4=_0x358549[_0x96ab('0x27')](_0x3553f4);logger[_0x96ab('0x1d')](_0x96ab('0x28'),JSON[_0x96ab('0x1e')](_0x3553f4,null,0x2));if(_0x3553f4[_0x96ab('0xc')]===_0x96ab('0x29')){logger[_0x96ab('0x2a')](_0x96ab('0x2b'));_0x14a333['context']=_0x3553f4[_0x96ab('0x2c')]||_0x14a333[_0x96ab('0x2c')];_0x14a333[_0x96ab('0x2d')]=_0x3553f4['extension'];_0x14a333[_0x96ab('0x2e')]=_0x3553f4[_0x96ab('0x2e')]?_0x3553f4['priority']-0x1:0x1;return null;}else if(_0x3553f4&&_0x358549[_0x3553f4['agicommand']]){_0x5d9b72=_0x358549[_0x3553f4[_0x96ab('0xc')]](_0x3553f4);logger['info'](_0x96ab('0x2f'),JSON[_0x96ab('0x1e')](_0x5d9b72,null,0x2));if(_0x5d9b72&&_0x5d9b72[_0x96ab('0x30')]===AGI_CODE_SUCCESS&&_0x5d9b72[_0x96ab('0x31')]!==AGI_RESULT_ERROR&&!_0x14a333[_0x96ab('0x32')]){logger[_0x96ab('0x1d')](_0x96ab('0x2f'),inspect(_0x5d9b72));return _[_0x96ab('0x33')](_0x5d9b72[_0x96ab('0x31')])?null:_0x5d9b72[_0x96ab('0x31')][_0x96ab('0x34')]();}else{logger[_0x96ab('0x9')](_0x96ab('0x2f'),inspect(_0x5d9b72));return null;}}else{logger[_0x96ab('0x9')](_0x96ab('0x35'));return null;}}catch(_0x1e6cef){logger['error'](_0x1e6cef[_0x96ab('0xb')]);return null;}});if(_0xbcfafb[_0x96ab('0x36')]){logger[_0x96ab('0x2a')](util[_0x96ab('0x21')](_0x96ab('0x37'),_0x14a333[_0x96ab('0x38')],_0x14a333[_0x96ab('0x23')],_0x14a333[_0x96ab('0x24')],_0x14a333[_0x96ab('0x25')],_0x14a333[_0x96ab('0x39')]));_0x2c1f8e['traverseBFS'](_0xbcfafb[_0x96ab('0x36')]['id'],function(_0x53b658){try{_0x53b658=_0x358549[_0x96ab('0x27')](_0x53b658);logger[_0x96ab('0x1d')](_0x96ab('0x28'),JSON[_0x96ab('0x1e')](_0x53b658,null,0x2));if(_0x53b658&&_0x358549[_0x53b658[_0x96ab('0xc')]]){_0x5d9b72=_0x358549[_0x53b658[_0x96ab('0xc')]](_0x53b658);if(_0x5d9b72){logger['debug'](_0x96ab('0x2f'),inspect(_0x5d9b72));return _[_0x96ab('0x33')](_0x5d9b72[_0x96ab('0x31')])?null:_0x5d9b72[_0x96ab('0x31')][_0x96ab('0x34')]();}else{logger[_0x96ab('0x9')](_0x96ab('0x2f'),inspect(_0x5d9b72));return null;}}else{logger[_0x96ab('0x9')](_0x96ab('0x35'));return null;}}catch(_0x1a112e){logger[_0x96ab('0x9')](_0x1a112e[_0x96ab('0xb')]);return null;}});}logger['info'](util[_0x96ab('0x21')](_0x96ab('0x3a'),_0x14a333[_0x96ab('0x38')],_0x14a333['calleridname'],_0x14a333[_0x96ab('0x24')],_0x14a333[_0x96ab('0x25')],_0x14a333['uniqueid']));logger[_0x96ab('0x2a')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x14a333[_0x96ab('0x2c')],_0x14a333[_0x96ab('0x2d')],parseInt(_0x14a333[_0x96ab('0x2e')],0xa)+0x1));_0x14a333['continueAt'](_0x14a333[_0x96ab('0x2c')],_0x14a333[_0x96ab('0x2d')],parseInt(_0x14a333[_0x96ab('0x2e')],0xa)+0x1);_0x14a333[_0x96ab('0x3b')]();}function handleNotFound(_0x3fe932){logger[_0x96ab('0x9')](util[_0x96ab('0x21')](_0x96ab('0x3c'),_0x3fe932[_0x96ab('0x38')]));_0x3fe932[_0x96ab('0x3d')](_0x3fe932[_0x96ab('0x2c')],_0x3fe932['extension'],parseInt(_0x3fe932['priority'],0xa)+0x1);_0x3fe932[_0x96ab('0x3b')]();}function handleUnpublished(_0x148ee1){logger[_0x96ab('0x9')](util[_0x96ab('0x21')](_0x96ab('0x3e'),_0x148ee1[_0x96ab('0x38')]));_0x148ee1[_0x96ab('0x3d')](_0x148ee1[_0x96ab('0x2c')],_0x148ee1['extension'],parseInt(_0x148ee1[_0x96ab('0x2e')],0xa)+0x1);_0x148ee1['close']();}module[_0x96ab('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x3989=['util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','production','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json'];(function(_0x4609b2,_0x54426a){var _0x19ab84=function(_0x14f580){while(--_0x14f580){_0x4609b2['push'](_0x4609b2['shift']());}};_0x19ab84(++_0x54426a);}(_0x3989,0x1d2));var _0x9398=function(_0x459fd8,_0xda83d9){_0x459fd8=_0x459fd8-0x0;var _0x2aff82=_0x3989[_0x459fd8];return _0x2aff82;};'use strict';var _=require(_0x9398('0x0'));var moment=require(_0x9398('0x1'));var parser=require(_0x9398('0x2'));var util=require(_0x9398('0x3'));var logger=require(_0x9398('0x4'))(_0x9398('0x5'));var rpc=require(_0x9398('0x6'));var mailRpc=require(_0x9398('0x7'));var Graph=require(_0x9398('0x8'));var Vertices=require(_0x9398('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9398('0xa')]()[_0x9398('0xb')](function(_0x50d91c){logger[_0x9398('0xc')](_0x9398('0xd'),_0x50d91c[_0x9398('0xe')]);return[];});}function addVertex(_0x287ea9,_0x151f96,_0x9199ae){_0x151f96[_0x9398('0xf')]=_0x9199ae;if(_0x151f96[_0x9398('0x10')](_0x9398('0x11'))){_0x151f96[_0x9398('0x12')]=parseInt(_0x151f96[_0x9398('0x11')],0xa);}_0x287ea9[_0x9398('0x13')](_[_0x9398('0x14')](_0x151f96,_0x9398('0x15')));}function initGraph(_0x58931e,_0x1c70d8){var _0x1f0e5c=new Graph();for(var _0x2f2266 in _0x58931e){if(_0x58931e[_0x9398('0x10')](_0x2f2266)){if(_[_0x9398('0x16')](_0x58931e[_0x2f2266])){for(var _0x493c5e=0x0;_0x493c5e<_0x58931e[_0x2f2266][_0x9398('0x17')];_0x493c5e+=0x1){addVertex(_0x1f0e5c,_0x58931e[_0x2f2266][_0x493c5e],_0x2f2266);}}else{addVertex(_0x1f0e5c,_0x58931e[_0x2f2266],_0x2f2266);}}}for(var _0x29c9cc=0x0;_0x29c9cc<_0x1c70d8[_0x9398('0x17')];_0x29c9cc+=0x1){if(_0x1c70d8[_0x29c9cc][_0x9398('0x18')]&&_0x1c70d8[_0x29c9cc][_0x9398('0x19')]){_0x1f0e5c['addEdge'](_0x1c70d8[_0x29c9cc][_0x9398('0x18')],_0x1c70d8[_0x29c9cc][_0x9398('0x19')],_0x1c70d8[_0x29c9cc][_0x9398('0x1a')]);}}return _0x1f0e5c;}function getRoot(_0x5ecf84){return parser[_0x9398('0x1b')](_0x5ecf84,{'object':!![]})[_0x9398('0x1c')][_0x9398('0x1d')];}function inspect(_0x32315d){return util['inspect'](_0x32315d,{'showHidden':![],'depth':null});}function initialize(_0x59914a,_0x392db8){var _0x45f273=getRoot(_0x59914a[_0x9398('0x1e')]);if(!_0x45f273||!_0x45f273['start'])return;var _0x243c49,_0x694436,_0x215dfe;logger[_0x9398('0x1f')](_0x9398('0x1d'),JSON[_0x9398('0x20')](_0x45f273,null,0x2));_0x392db8[_0x9398('0x21')]=moment()['format'](_0x9398('0x22'));_0x243c49=initGraph(_['omit'](_0x45f273,_0x9398('0x15')),_0x45f273[_0x9398('0x15')]);_0x694436=new Vertices(_0x392db8,rpc,mailRpc);logger[_0x9398('0x23')](util[_0x9398('0x24')](_0x9398('0x25'),_0x392db8[_0x9398('0x26')],_0x392db8[_0x9398('0x27')],_0x392db8[_0x9398('0x28')],_0x392db8[_0x9398('0x29')],_0x392db8[_0x9398('0x2a')]));_0x243c49[_0x9398('0x2b')](_0x45f273[_0x9398('0x2c')]['id'],function(_0x1a9287){try{_0x1a9287=_0x694436[_0x9398('0x2d')](_0x1a9287);logger['debug'](_0x9398('0x2e'),JSON['stringify'](_0x1a9287,null,0x2));if(_0x1a9287[_0x9398('0xf')]===_0x9398('0x2f')){logger['info'](_0x9398('0x30'));_0x392db8[_0x9398('0x31')]=_0x1a9287['context']||_0x392db8[_0x9398('0x31')];_0x392db8['extension']=_0x1a9287[_0x9398('0x32')];_0x392db8[_0x9398('0x33')]=_0x1a9287[_0x9398('0x33')]?_0x1a9287[_0x9398('0x33')]-0x1:0x1;return null;}else if(_0x1a9287&&_0x694436[_0x1a9287[_0x9398('0xf')]]){_0x215dfe=_0x694436[_0x1a9287[_0x9398('0xf')]](_0x1a9287);logger[_0x9398('0x23')](_0x9398('0x34'),JSON[_0x9398('0x20')](_0x215dfe,null,0x2));if(_0x215dfe&&_0x215dfe[_0x9398('0x35')]===AGI_CODE_SUCCESS&&_0x215dfe[_0x9398('0x36')]!==AGI_RESULT_ERROR&&!_0x392db8[_0x9398('0x37')]){logger[_0x9398('0x1f')](_0x9398('0x34'),inspect(_0x215dfe));return _[_0x9398('0x38')](_0x215dfe[_0x9398('0x36')])?null:_0x215dfe[_0x9398('0x36')][_0x9398('0x39')]();}else{logger[_0x9398('0xc')](_0x9398('0x34'),inspect(_0x215dfe));return null;}}else{logger['error'](_0x9398('0x3a'));return null;}}catch(_0x45ca9){logger[_0x9398('0xc')](_0x45ca9[_0x9398('0xe')]);return null;}});if(_0x45f273[_0x9398('0x3b')]){logger[_0x9398('0x23')](util['format'](_0x9398('0x3c'),_0x392db8[_0x9398('0x26')],_0x392db8['calleridname'],_0x392db8['callerid'],_0x392db8[_0x9398('0x29')],_0x392db8[_0x9398('0x2a')]));_0x243c49[_0x9398('0x2b')](_0x45f273[_0x9398('0x3b')]['id'],function(_0x28ba29){try{_0x28ba29=_0x694436[_0x9398('0x2d')](_0x28ba29);logger[_0x9398('0x1f')]('vertex',JSON[_0x9398('0x20')](_0x28ba29,null,0x2));if(_0x28ba29&&_0x694436[_0x28ba29[_0x9398('0xf')]]){_0x215dfe=_0x694436[_0x28ba29[_0x9398('0xf')]](_0x28ba29);if(_0x215dfe){logger[_0x9398('0x1f')]('response',inspect(_0x215dfe));return _[_0x9398('0x38')](_0x215dfe[_0x9398('0x36')])?null:_0x215dfe[_0x9398('0x36')][_0x9398('0x39')]();}else{logger[_0x9398('0xc')](_0x9398('0x34'),inspect(_0x215dfe));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x33b6ae){logger[_0x9398('0xc')](_0x33b6ae[_0x9398('0xe')]);return null;}});}logger['info'](util[_0x9398('0x24')](_0x9398('0x3d'),_0x392db8['arg_1'],_0x392db8[_0x9398('0x27')],_0x392db8[_0x9398('0x28')],_0x392db8['dnid'],_0x392db8['uniqueid']));logger[_0x9398('0x23')](util[_0x9398('0x24')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x392db8['context'],_0x392db8[_0x9398('0x32')],parseInt(_0x392db8[_0x9398('0x33')],0xa)+0x1));_0x392db8['continueAt'](_0x392db8[_0x9398('0x31')],_0x392db8[_0x9398('0x32')],parseInt(_0x392db8[_0x9398('0x33')],0xa)+0x1);_0x392db8['close']();}function handleNotFound(_0x1d1fe5){logger[_0x9398('0xc')](util[_0x9398('0x24')](_0x9398('0x3e'),_0x1d1fe5[_0x9398('0x26')]));_0x1d1fe5[_0x9398('0x3f')](_0x1d1fe5[_0x9398('0x31')],_0x1d1fe5[_0x9398('0x32')],parseInt(_0x1d1fe5[_0x9398('0x33')],0xa)+0x1);_0x1d1fe5[_0x9398('0x40')]();}function handleUnpublished(_0xeaf37e){logger[_0x9398('0xc')](util[_0x9398('0x24')](_0x9398('0x41'),_0xeaf37e[_0x9398('0x26')]));_0xeaf37e[_0x9398('0x3f')](_0xeaf37e[_0x9398('0x31')],_0xeaf37e[_0x9398('0x32')],parseInt(_0xeaf37e[_0x9398('0x33')],0xa)+0x1);_0xeaf37e[_0x9398('0x40')]();}module[_0x9398('0x42')]={'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 abc504f..4b1dcc0 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 _0x07eb=['substring','length','split','slice','trim','emit','headers','line','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf'];(function(_0x194542,_0x1b0ebe){var _0x322ada=function(_0x301931){while(--_0x301931){_0x194542['push'](_0x194542['shift']());}};_0x322ada(++_0x1b0ebe);}(_0x07eb,0x74));var _0xb07e=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x07eb[_0x3e25c1];return _0x52e7f2;};'use strict';var util=require('util');var Transform=require(_0xb07e('0x0'))[_0xb07e('0x1')];function AGIReply(_0x32bb8e){Transform[_0xb07e('0x2')](this,_0x32bb8e);this[_0xb07e('0x3')]='';this[_0xb07e('0x4')]=![];}util[_0xb07e('0x5')](AGIReply,Transform);AGIReply[_0xb07e('0x6')][_0xb07e('0x7')]=function(_0x16a2ac,_0x5c2e7a,_0x4c43d3){var _0x2815c0='\x0a',_0x3579f2=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x9ab3b8=-0x1,_0x4f9e54=-0x1,_0x2a7c3='',_0x8b1b80=0x0,_0x13fabf='',_0x25ddbc='';this[_0xb07e('0x3')]+=_0x16a2ac[_0xb07e('0x8')]();_0x13fabf=this[_0xb07e('0x3')];if(!this['_inBody']){_0x8b1b80=0x0;while(_0x3579f2[_0x8b1b80]){while((_0x4f9e54=_0x13fabf[_0xb07e('0x9')](_0x3579f2[_0x8b1b80]))!=-0x1){_0x2a7c3=_0x3579f2[_0x8b1b80];_0x25ddbc=_0x13fabf[_0xb07e('0xa')](0x0,_0x4f9e54);_0x13fabf=_0x13fabf[_0xb07e('0xa')](_0x4f9e54+_0x2a7c3[_0xb07e('0xb')]);var _0x130e20=_0x25ddbc[_0xb07e('0xc')](_0x2815c0),_0x205298=0x0,_0x1b8bea={},_0x499e8c='',_0x22a522='',_0x2b2efb=-0x1;while(_0x130e20[_0x205298]){_0x2b2efb=_0x130e20[_0x205298][_0xb07e('0x9')](':');if(_0x2b2efb!=-0x1){_0x499e8c=_0x130e20[_0x205298][_0xb07e('0xd')](0x0,_0x2b2efb)[_0xb07e('0xe')]();_0x22a522=_0x130e20[_0x205298][_0xb07e('0xd')](_0x2b2efb+0x1)[_0xb07e('0xe')]();if(_0x499e8c[_0xb07e('0xb')]>0x0){_0x1b8bea[_0x499e8c]=_0x22a522;}}else{}_0x205298++;}this[_0xb07e('0xf')](_0xb07e('0x10'),_0x1b8bea);this[_0xb07e('0x4')]=!![];}_0x8b1b80++;}this['_localBuffer']=_0x13fabf;}else{while((_0x9ab3b8=_0x13fabf['indexOf'](_0x2815c0))!=-0x1){_0x25ddbc=_0x13fabf[_0xb07e('0xa')](0x0,_0x9ab3b8);this['emit'](_0xb07e('0x11'),_0x25ddbc);_0x13fabf=_0x13fabf[_0xb07e('0xa')](_0x9ab3b8+_0x2815c0['length']);}this['_localBuffer']=_0x13fabf;}_0x4c43d3();};module['exports']=AGIReply; \ No newline at end of file +var _0x2b88=['headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','substring','length','split','indexOf','slice','trim','emit'];(function(_0x37b2fd,_0x1dfd78){var _0x39d3c8=function(_0x473b7c){while(--_0x473b7c){_0x37b2fd['push'](_0x37b2fd['shift']());}};_0x39d3c8(++_0x1dfd78);}(_0x2b88,0xc1));var _0x82b8=function(_0x423f1c,_0x2adb8c){_0x423f1c=_0x423f1c-0x0;var _0xebed4c=_0x2b88[_0x423f1c];return _0xebed4c;};'use strict';var util=require(_0x82b8('0x0'));var Transform=require(_0x82b8('0x1'))[_0x82b8('0x2')];function AGIReply(_0x442bb1){Transform[_0x82b8('0x3')](this,_0x442bb1);this[_0x82b8('0x4')]='';this[_0x82b8('0x5')]=![];}util[_0x82b8('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x82b8('0x7')]=function(_0x1e6bcb,_0x354d4d,_0x173fe1){var _0x1d9b33='\x0a',_0x14dfa8=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x192f3d=-0x1,_0x10beb=-0x1,_0x18b6f0='',_0x4e0dd5=0x0,_0x772118='',_0x23ba77='';this['_localBuffer']+=_0x1e6bcb[_0x82b8('0x8')]();_0x772118=this[_0x82b8('0x4')];if(!this['_inBody']){_0x4e0dd5=0x0;while(_0x14dfa8[_0x4e0dd5]){while((_0x10beb=_0x772118['indexOf'](_0x14dfa8[_0x4e0dd5]))!=-0x1){_0x18b6f0=_0x14dfa8[_0x4e0dd5];_0x23ba77=_0x772118['substring'](0x0,_0x10beb);_0x772118=_0x772118[_0x82b8('0x9')](_0x10beb+_0x18b6f0[_0x82b8('0xa')]);var _0x41d368=_0x23ba77[_0x82b8('0xb')](_0x1d9b33),_0x8d0c83=0x0,_0x214f2b={},_0x5a8877='',_0x3d8b1e='',_0x32b1bd=-0x1;while(_0x41d368[_0x8d0c83]){_0x32b1bd=_0x41d368[_0x8d0c83][_0x82b8('0xc')](':');if(_0x32b1bd!=-0x1){_0x5a8877=_0x41d368[_0x8d0c83][_0x82b8('0xd')](0x0,_0x32b1bd)[_0x82b8('0xe')]();_0x3d8b1e=_0x41d368[_0x8d0c83][_0x82b8('0xd')](_0x32b1bd+0x1)[_0x82b8('0xe')]();if(_0x5a8877[_0x82b8('0xa')]>0x0){_0x214f2b[_0x5a8877]=_0x3d8b1e;}}else{}_0x8d0c83++;}this[_0x82b8('0xf')](_0x82b8('0x10'),_0x214f2b);this[_0x82b8('0x5')]=!![];}_0x4e0dd5++;}this[_0x82b8('0x4')]=_0x772118;}else{while((_0x192f3d=_0x772118[_0x82b8('0xc')](_0x1d9b33))!=-0x1){_0x23ba77=_0x772118[_0x82b8('0x9')](0x0,_0x192f3d);this[_0x82b8('0xf')](_0x82b8('0x11'),_0x23ba77);_0x772118=_0x772118['substring'](_0x192f3d+_0x1d9b33['length']);}this[_0x82b8('0x4')]=_0x772118;}_0x173fe1();};module[_0x82b8('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6a2b3ee..0297f36 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 _0x3164=['CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','then','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x1790f2,_0x2f375f){var _0x3f5a01=function(_0x12151e){while(--_0x12151e){_0x1790f2['push'](_0x1790f2['shift']());}};_0x3f5a01(++_0x2f375f);}(_0x3164,0x182));var _0x4316=function(_0x6186a8,_0x5385c4){_0x6186a8=_0x6186a8-0x0;var _0xf72248=_0x3164[_0x6186a8];return _0xf72248;};'use strict';var _=require(_0x4316('0x0'));var moment=require(_0x4316('0x1'));var jayson=require(_0x4316('0x2'));var client=jayson[_0x4316('0x3')][_0x4316('0x4')]({'port':0x2329});function request(_0x588480,_0x2534d3){return new Promise(function(_0x2355a6,_0x1235d9){return client['request'](_0x588480,_0x2534d3)['then'](function(_0x27bfc8){if(_0x27bfc8[_0x4316('0x5')]){return _0x1235d9(_0x27bfc8[_0x4316('0x5')][_0x4316('0x6')]);}else{return _0x2355a6(_0x27bfc8[_0x4316('0x7')]);}})[_0x4316('0x8')](function(_0x1bcd38){return _0x1235d9(_0x1bcd38);});});}exports[_0x4316('0x9')]=function(){return request(_0x4316('0xa'),{'options':{'raw':![],'attributes':['id',_0x4316('0xb'),_0x4316('0xc')]}});};exports[_0x4316('0xd')]=function(_0xb370dc){return request(_0x4316('0xe'),{'options':{'raw':![],'where':{'name':_0xb370dc},'attributes':['production']}});};exports[_0x4316('0xf')]=function(_0x446361){return request(_0x4316('0x10'),{'options':{'raw':![],'where':{'id':_0x446361},'include':[{'model':_0x4316('0x11'),'as':'Smtp','include':[{'model':_0x4316('0x12'),'as':_0x4316('0x12')}]}],'attributes':['id',_0x4316('0xb'),_0x4316('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2fdbee){return request('ShowSquareProject',{'options':{'where':{'id':_0x2fdbee},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x266777){return request(_0x4316('0x14'),{'options':{'where':{'id':_0x266777},'attributes':['name']}});};exports[_0x4316('0x15')]=function(_0x486a64){return request(_0x4316('0x16'),{'options':{'where':{'id':_0x486a64},'attributes':[_0x4316('0xb')]}});};exports[_0x4316('0x17')]=function(_0x1caa59){return request(_0x4316('0x18'),{'options':{'where':{'id':_0x1caa59},'attributes':[_0x4316('0x19')]}});};exports[_0x4316('0x1a')]=function(_0x38e68c){return request(_0x4316('0x1b'),{'options':{'where':{'id':_0x38e68c},'attributes':[_0x4316('0xb')]}});};exports['getContactByPhone']=function(_0x43069f){return request(_0x4316('0x1c'),{'options':{'where':{'phone':_0x43069f['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x40f660){return request(_0x4316('0x1d'),{'options':{'where':{'id':_0x40f660},'attributes':[_0x4316('0xb')]}});};exports[_0x4316('0x1e')]=function(_0x247866){return request('ShowSound',{'options':{'where':{'id':_0x247866},'attributes':[_0x4316('0x1f')]}});};exports[_0x4316('0x20')]=function(_0x599c48){return request(_0x4316('0x21'),{'options':{'raw':![],'where':{'id':_0x599c48},'include':[{'model':_0x4316('0x22'),'as':_0x4316('0x23')}]}});};exports['getSmsAccountById']=function(_0x1736d0){return request(_0x4316('0x24'),{'options':{'where':{'id':_0x1736d0},'attributes':['id',_0x4316('0xb')]}});};exports['createSmsMessage']=function(_0x3b994a){return request(_0x4316('0x25'),{'body':_0x3b994a});};exports[_0x4316('0x26')]=function(_0x2d2bda){return request(_0x4316('0x27'),{'body':_0x2d2bda});};exports[_0x4316('0x28')]=function(_0x1f7e8d){return request(_0x4316('0x29'),{'body':_[_0x4316('0x2a')](_0x1f7e8d,{'project_name':_0x1f7e8d[_0x4316('0x2b')],'prev_project_name':_0x1f7e8d[_0x4316('0x2c')]||'','is_subproject':_0x1f7e8d[_0x4316('0x2c')]?!![]:![],'leaveAt':moment()[_0x4316('0x2d')](_0x4316('0x2e'))})});};exports[_0x4316('0x2f')]=function(_0x31cd5f){return request(_0x4316('0x30'),{'body':_0x31cd5f});};exports['createSquareMessage']=function(_0x522ced){return request(_0x4316('0x31'),{'body':_0x522ced});};exports[_0x4316('0x32')]=function(_0xa8dd01){return request(_0x4316('0x33'),{'options':{'raw':![],'where':{'phone':_0xa8dd01[_0x4316('0x34')],'ListId':_0xa8dd01['ListId']}}})[_0x4316('0x35')](function(_0x4b13aa){if(_0x4b13aa){return _0x4b13aa;}return request(_0x4316('0x36'),{'body':_0xa8dd01});});};exports['getPauseById']=function(_0x46df48){return request('ShowPause',{'options':{'where':{'id':_0x46df48},'attributes':[_0x4316('0xb')]}});};exports[_0x4316('0x37')]=function(_0x4f88a2,_0x22eedf){return request('LoginUser',{'body':{'interface':_0x22eedf},'options':{'where':_0x4f88a2}});};exports[_0x4316('0x38')]=function(_0x1b3db9,_0x2d7e64,_0x261908){return request(_0x4316('0x39'),{'body':{'type':_0x2d7e64,'uniqueid':_0x261908},'options':{'where':_0x1b3db9}});};exports[_0x4316('0x3a')]=function(_0x3bcbee){return request(_0x4316('0x3b'),{'body':{},'options':{'where':_0x3bcbee}});};exports['agentLogout']=function(_0x9bf1ff){return request(_0x4316('0x3c'),{'body':{},'options':{'where':_0x9bf1ff}});}; \ No newline at end of file +var _0xf987=['CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport'];(function(_0x2250e0,_0x5f025c){var _0x3eee1a=function(_0x1308b4){while(--_0x1308b4){_0x2250e0['push'](_0x2250e0['shift']());}};_0x3eee1a(++_0x5f025c);}(_0xf987,0x18a));var _0x7f98=function(_0x3e1b0d,_0x668a4c){_0x3e1b0d=_0x3e1b0d-0x0;var _0x4104ce=_0xf987[_0x3e1b0d];return _0x4104ce;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x7f98('0x0'));var client=jayson[_0x7f98('0x1')]['http']({'port':0x2329});function request(_0x46c60f,_0x13b552){return new Promise(function(_0xce9e6c,_0x1229f9){return client[_0x7f98('0x2')](_0x46c60f,_0x13b552)[_0x7f98('0x3')](function(_0xc72f22){if(_0xc72f22[_0x7f98('0x4')]){return _0x1229f9(_0xc72f22[_0x7f98('0x4')][_0x7f98('0x5')]);}else{return _0xce9e6c(_0xc72f22[_0x7f98('0x6')]);}})[_0x7f98('0x7')](function(_0x5bb41e){return _0x1229f9(_0x5bb41e);});});}exports[_0x7f98('0x8')]=function(){return request(_0x7f98('0x9'),{'options':{'raw':![],'attributes':['id',_0x7f98('0xa'),_0x7f98('0xb')]}});};exports[_0x7f98('0xc')]=function(_0x5c6389){return request(_0x7f98('0xd'),{'options':{'raw':![],'where':{'name':_0x5c6389},'attributes':['production']}});};exports['getMailAccountById']=function(_0x2b425d){return request(_0x7f98('0xe'),{'options':{'raw':![],'where':{'id':_0x2b425d},'include':[{'model':_0x7f98('0xf'),'as':_0x7f98('0x10'),'include':[{'model':'CloudProvider','as':_0x7f98('0x11')}]}],'attributes':['id','name',_0x7f98('0x12')],'smtp':!![]}});};exports[_0x7f98('0x13')]=function(_0x40ca0a){return request(_0x7f98('0xd'),{'options':{'where':{'id':_0x40ca0a},'attributes':[_0x7f98('0xa')]}});};exports[_0x7f98('0x14')]=function(_0x33108e){return request(_0x7f98('0x15'),{'options':{'where':{'id':_0x33108e},'attributes':[_0x7f98('0xa')]}});};exports[_0x7f98('0x16')]=function(_0x2d366a){return request(_0x7f98('0x17'),{'options':{'where':{'id':_0x2d366a},'attributes':['name']}});};exports[_0x7f98('0x18')]=function(_0x4de314){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4de314},'attributes':[_0x7f98('0x19')]}});};exports[_0x7f98('0x1a')]=function(_0x585a1a){return request('ShowUser',{'options':{'where':{'id':_0x585a1a},'attributes':['name']}});};exports['getContactByPhone']=function(_0x111385){return request(_0x7f98('0x1b'),{'options':{'where':{'phone':_0x111385['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x4f3ac0){return request(_0x7f98('0x1c'),{'options':{'where':{'id':_0x4f3ac0},'attributes':['name']}});};exports[_0x7f98('0x1d')]=function(_0x1f1cb5){return request(_0x7f98('0x1e'),{'options':{'where':{'id':_0x1f1cb5},'attributes':[_0x7f98('0x1f')]}});};exports[_0x7f98('0x20')]=function(_0x1f2e6c){return request(_0x7f98('0x21'),{'options':{'raw':![],'where':{'id':_0x1f2e6c},'include':[{'model':_0x7f98('0x22'),'as':_0x7f98('0x23')}]}});};exports['getSmsAccountById']=function(_0x55189b){return request(_0x7f98('0x24'),{'options':{'where':{'id':_0x55189b},'attributes':['id','name']}});};exports[_0x7f98('0x25')]=function(_0x2d9e09){return request('CreateSmsMessage',{'body':_0x2d9e09});};exports[_0x7f98('0x26')]=function(_0xe03ec4){return request('CreateSquareDetailsReport',{'body':_0xe03ec4});};exports[_0x7f98('0x27')]=function(_0x32bc48){return request(_0x7f98('0x28'),{'body':_[_0x7f98('0x29')](_0x32bc48,{'project_name':_0x32bc48[_0x7f98('0x2a')],'prev_project_name':_0x32bc48[_0x7f98('0x2b')]||'','is_subproject':_0x32bc48[_0x7f98('0x2b')]?!![]:![],'leaveAt':moment()[_0x7f98('0x2c')](_0x7f98('0x2d'))})});};exports[_0x7f98('0x2e')]=function(_0xbce59a){return request(_0x7f98('0x2f'),{'body':_0xbce59a});};exports[_0x7f98('0x30')]=function(_0x51cf96){return request('CreateSquareMessage',{'body':_0x51cf96});};exports[_0x7f98('0x31')]=function(_0x2122f4){return request(_0x7f98('0x32'),{'options':{'raw':![],'where':{'phone':_0x2122f4[_0x7f98('0x33')],'ListId':_0x2122f4[_0x7f98('0x34')]}}})[_0x7f98('0x3')](function(_0x20ff8d){if(_0x20ff8d){return _0x20ff8d;}return request(_0x7f98('0x35'),{'body':_0x2122f4});});};exports[_0x7f98('0x36')]=function(_0x367f1b){return request('ShowPause',{'options':{'where':{'id':_0x367f1b},'attributes':[_0x7f98('0xa')]}});};exports[_0x7f98('0x37')]=function(_0x51aba3,_0x244462){return request(_0x7f98('0x38'),{'body':{'interface':_0x244462},'options':{'where':_0x51aba3}});};exports[_0x7f98('0x39')]=function(_0x4e86fd,_0x23acb7,_0x5182d9){return request(_0x7f98('0x3a'),{'body':{'type':_0x23acb7,'uniqueid':_0x5182d9},'options':{'where':_0x4e86fd}});};exports['agentUnpause']=function(_0x42aa49){return request(_0x7f98('0x3b'),{'body':{},'options':{'where':_0x42aa49}});};exports[_0x7f98('0x3c')]=function(_0x185a02){return request(_0x7f98('0x3d'),{'body':{},'options':{'where':_0x185a02}});}; \ 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 f20a594..d762f4c 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 _0x9b8e=['./polly','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9b8e,0x158));var _0xe9b8=function(_0x4743a7,_0xac271c){_0x4743a7=_0x4743a7-0x0;var _0x341564=_0x9b8e[_0x4743a7];return _0x341564;};var polly=require(_0xe9b8('0x0'));var lex=require('./lex');module[_0xe9b8('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc569=['./polly','./lex','exports'];(function(_0x4e9e0d,_0xd86384){var _0x514622=function(_0xe6b57b){while(--_0xe6b57b){_0x4e9e0d['push'](_0x4e9e0d['shift']());}};_0x514622(++_0xd86384);}(_0xc569,0x159));var _0x9c56=function(_0x39a11b,_0x392666){_0x39a11b=_0x39a11b-0x0;var _0x572ad1=_0xc569[_0x39a11b];return _0x572ad1;};var polly=require(_0x9c56('0x0'));var lex=require(_0x9c56('0x1'));module[_0x9c56('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 04936c4..b38fdb4 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 _0x3c81=['./lib/api','exports'];(function(_0x3ee883,_0xf98b0c){var _0x13f6f9=function(_0x6eb3bb){while(--_0x6eb3bb){_0x3ee883['push'](_0x3ee883['shift']());}};_0x13f6f9(++_0xf98b0c);}(_0x3c81,0x102));var _0x13c8=function(_0xb03198,_0x40233c){_0xb03198=_0xb03198-0x0;var _0x3e27c9=_0x3c81[_0xb03198];return _0x3e27c9;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ No newline at end of file +var _0x750a=['exports'];(function(_0xf29ad2,_0x3c5fd9){var _0x5e0e15=function(_0xc943da){while(--_0xc943da){_0xf29ad2['push'](_0xf29ad2['shift']());}};_0x5e0e15(++_0x3c5fd9);}(_0x750a,0x140));var _0xa750=function(_0x5e4285,_0x4ddff1){_0x5e4285=_0x5e4285-0x0;var _0x127e41=_0x750a[_0x5e4285];return _0x127e41;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ 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 48721ec..02858e5 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(_0x5c536f,_0x47d86b){var _0x212833=function(_0x1bffd2){while(--_0x1bffd2){_0x5c536f['push'](_0x5c536f['shift']());}};_0x212833(++_0x47d86b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x2c9b00,_0x296b2f){var _0x359859=function(_0x113471){while(--_0x113471){_0x2c9b00['push'](_0x2c9b00['shift']());}};_0x359859(++_0x296b2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 030d3e2..ff6fd96 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 _0xdae2=['exports','./lib/api'];(function(_0x37f073,_0x3e088e){var _0xea49d=function(_0x40320c){while(--_0x40320c){_0x37f073['push'](_0x37f073['shift']());}};_0xea49d(++_0x3e088e);}(_0xdae2,0x187));var _0x2dae=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xdae2[_0x26462c];return _0x509a42;};'use strict';var polly=require(_0x2dae('0x0'));module[_0x2dae('0x1')]=function(_0x567606,_0x46a004,_0x1053f4,_0x3adaf3,_0x3892b8,_0x19ee8c,_0x530464){return polly(_0x567606,_0x46a004,_0x1053f4,_0x3adaf3,_0x3892b8,_0x19ee8c,_0x530464);}; \ No newline at end of file +var _0xfaf5=['./lib/api','exports'];(function(_0x479dce,_0xc1932c){var _0x556858=function(_0xd768ab){while(--_0xd768ab){_0x479dce['push'](_0x479dce['shift']());}};_0x556858(++_0xc1932c);}(_0xfaf5,0x1ca));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0x5faf('0x0'));module[_0x5faf('0x1')]=function(_0x4ff23e,_0xc2cdca,_0x56ef02,_0x3728ef,_0x2d2ceb,_0x1bf46c,_0x5f6b69){return polly(_0x4ff23e,_0xc2cdca,_0x56ef02,_0x3728ef,_0x2d2ceb,_0x1bf46c,_0x5f6b69);}; \ 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 e28c6d4..65ba389 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 _0x7ca2=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x2815b3,_0x5e085a){var _0x4c6510=function(_0x41d68d){while(--_0x41d68d){_0x2815b3['push'](_0x2815b3['shift']());}};_0x4c6510(++_0x5e085a);}(_0x7ca2,0x104));var _0x27ca=function(_0x1cd997,_0x1185b4){_0x1cd997=_0x1cd997-0x0;var _0x88f4ba=_0x7ca2[_0x1cd997];return _0x88f4ba;};'use strict';var fs=require('fs');var path=require(_0x27ca('0x0'));var BPromise=require(_0x27ca('0x1'));var rs=require(_0x27ca('0x2'));var AWS=require(_0x27ca('0x3'));function pollyResult(_0x49901f,_0xc7f70e,_0x371201){return new BPromise(function(_0x400a92,_0x247702){_0x49901f[_0x27ca('0x4')](_0xc7f70e,function(_0x24dbb8,_0x59b0b4){if(_0x24dbb8){_0x247702(_0x24dbb8);}else if(_0x59b0b4){if(_0x59b0b4['AudioStream']instanceof Buffer){fs['writeFile'](_0x371201,_0x59b0b4[_0x27ca('0x5')],function(_0x540712){if(_0x540712){_0x247702(_0x540712);}else{_0x400a92();}});}else{_0x247702(new Error(_0x27ca('0x6')));}}else{_0x247702(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x45c2c0,_0x4641bf,_0x330704,_0x444552,_0xdff3b6,_0x3fb3ea,_0x13c2a3){var _0x400447=new AWS[(_0x27ca('0x7'))]({'accessKeyId':_0x45c2c0,'secretAccessKey':_0x4641bf,'region':_0x330704});var _0x163481={'Text':_0xdff3b6,'TextType':_0x3fb3ea||_0x27ca('0x8'),'OutputFormat':_0x27ca('0x9'),'VoiceId':_0x444552};return pollyResult(_0x400447,_0x163481,_0x13c2a3);}; \ No newline at end of file +var _0x7f28=['Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5889e6,_0x5758c7){var _0x42eef9=function(_0x194a0d){while(--_0x194a0d){_0x5889e6['push'](_0x5889e6['shift']());}};_0x42eef9(++_0x5758c7);}(_0x7f28,0x1c6));var _0x87f2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7f28[_0x3e5086];return _0xfeb102;};'use strict';var fs=require('fs');var path=require(_0x87f2('0x0'));var BPromise=require(_0x87f2('0x1'));var rs=require(_0x87f2('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x55c62a,_0x4eb894,_0x13a6c1){return new BPromise(function(_0x2c39ae,_0x17cfed){_0x55c62a[_0x87f2('0x3')](_0x4eb894,function(_0x519d1f,_0x51b753){if(_0x519d1f){_0x17cfed(_0x519d1f);}else if(_0x51b753){if(_0x51b753[_0x87f2('0x4')]instanceof Buffer){fs[_0x87f2('0x5')](_0x13a6c1,_0x51b753[_0x87f2('0x4')],function(_0x5a801e){if(_0x5a801e){_0x17cfed(_0x5a801e);}else{_0x2c39ae();}});}else{_0x17cfed(new Error(_0x87f2('0x6')));}}else{_0x17cfed(new Error(_0x87f2('0x7')));}});});}module['exports']=function(_0x316298,_0x166d69,_0x15f165,_0x9a3ea6,_0x5da684,_0x2156b3,_0x39de7d){var _0x2a8c5d=new AWS[(_0x87f2('0x8'))]({'accessKeyId':_0x316298,'secretAccessKey':_0x166d69,'region':_0x15f165});var _0x4b2f0b={'Text':_0x5da684,'TextType':_0x2156b3||_0x87f2('0x9'),'OutputFormat':_0x87f2('0xa'),'VoiceId':_0x9a3ea6};return pollyResult(_0x2a8c5d,_0x4b2f0b,_0x39de7d);}; \ 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 dc56774..25c3c87 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 _0x2c1d=['exports'];(function(_0x2d3045,_0x5c25da){var _0x5386fa=function(_0x2416d0){while(--_0x2416d0){_0x2d3045['push'](_0x2d3045['shift']());}};_0x5386fa(++_0x5c25da);}(_0x2c1d,0x18b));var _0xd2c1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2c1d[_0x4a9fb1];return _0x348672;};'use strict';var asr=require('./lib/api');module[_0xd2c1('0x0')]=function(_0x4d4596,_0x11c736,_0x4e810a,_0x1dd49d){return asr(_0x4d4596,_0x11c736,_0x4e810a);}; \ No newline at end of file +var _0x70cc=['exports','./lib/api'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x70cc,0x177));var _0xc70c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x70cc[_0x9dfc10];return _0x4f938a;};'use strict';var asr=require(_0xc70c('0x0'));module[_0xc70c('0x1')]=function(_0x1945d9,_0x190437,_0x532047,_0x16cd98){return asr(_0x1945d9,_0x190437,_0x532047);}; \ 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 a719774..0480171 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 _0x87f8=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','exports','string'];(function(_0x4b2b7d,_0xc090b6){var _0x41b383=function(_0x43cb18){while(--_0x43cb18){_0x4b2b7d['push'](_0x4b2b7d['shift']());}};_0x41b383(++_0xc090b6);}(_0x87f8,0x152));var _0x887f=function(_0x57108b,_0x66d9b6){_0x57108b=_0x57108b-0x0;var _0x26f272=_0x87f8[_0x57108b];return _0x26f272;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x887f('0x0')]=function(_0x13309f,_0x5be12b,_0x28ce3c){return new BPromise(function(_0x591ca0,_0x46a51e){var _0x3ce88c;if(typeof _0x13309f!==_0x887f('0x1')||_0x13309f[_0x887f('0x2')]===0x0){return _0x46a51e('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5be12b!==_0x887f('0x1')||_0x5be12b[_0x887f('0x2')]===0x0){return _0x46a51e(_0x887f('0x3'));}if(typeof _0x28ce3c!==_0x887f('0x4')&&(typeof _0x28ce3c!==_0x887f('0x1')||_0x28ce3c[_0x887f('0x2')]===0x0)){return _0x46a51e(_0x887f('0x5'));}try{_0x3ce88c=fs['readFileSync'](_0x13309f)[_0x887f('0x6')]('base64');}catch(_0x130293){return _0x46a51e(_0x130293);}return _0x591ca0({'method':_0x887f('0x7'),'uri':host+_0x887f('0x8')+_0x5be12b,'body':{'config':{'encoding':_0x887f('0x9'),'sampleRateHertz':'8000','languageCode':_0x28ce3c},'audio':{'content':_0x3ce88c}},'json':!![]});});}; \ No newline at end of file +var _0x01fe=['exports','length','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x01fe,0x102));var _0xe01f=function(_0x23fc20,_0x4c944f){_0x23fc20=_0x23fc20-0x0;var _0x42473c=_0x01fe[_0x23fc20];return _0x42473c;};'use strict';var url=require(_0xe01f('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe01f('0x1');module[_0xe01f('0x2')]=function(_0x4a9e90,_0x577c82,_0x15f6ba){return new BPromise(function(_0x1212f6,_0x9505fa){var _0x92b885;if(typeof _0x4a9e90!=='string'||_0x4a9e90[_0xe01f('0x3')]===0x0){return _0x9505fa('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x577c82!==_0xe01f('0x4')||_0x577c82[_0xe01f('0x3')]===0x0){return _0x9505fa(_0xe01f('0x5'));}if(typeof _0x15f6ba!==_0xe01f('0x6')&&(typeof _0x15f6ba!==_0xe01f('0x4')||_0x15f6ba['length']===0x0)){return _0x9505fa(_0xe01f('0x7'));}try{_0x92b885=fs[_0xe01f('0x8')](_0x4a9e90)['toString'](_0xe01f('0x9'));}catch(_0x54334d){return _0x9505fa(_0x54334d);}return _0x1212f6({'method':_0xe01f('0xa'),'uri':host+_0xe01f('0xb')+_0x577c82,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xe01f('0xc'),'languageCode':_0x15f6ba},'audio':{'content':_0x92b885}},'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 202e2bf..8f8b729 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 _0x8134=['exports','./asr'];(function(_0x5a1d9f,_0x1fff2a){var _0x55ca03=function(_0xcb32d){while(--_0xcb32d){_0x5a1d9f['push'](_0x5a1d9f['shift']());}};_0x55ca03(++_0x1fff2a);}(_0x8134,0x75));var _0x4813=function(_0x3f5d54,_0x2ab409){_0x3f5d54=_0x3f5d54-0x0;var _0x33d497=_0x8134[_0x3f5d54];return _0x33d497;};var asr=require(_0x4813('0x0'));module[_0x4813('0x1')]={'asr':asr}; \ No newline at end of file +var _0x665f=['./asr'];(function(_0x2d3b61,_0x56de9d){var _0x31c968=function(_0x1ef7b9){while(--_0x1ef7b9){_0x2d3b61['push'](_0x2d3b61['shift']());}};_0x31c968(++_0x56de9d);}(_0x665f,0xb6));var _0xf665=function(_0x541348,_0x1afbe1){_0x541348=_0x541348-0x0;var _0x453b72=_0x665f[_0x541348];return _0x453b72;};var asr=require(_0xf665('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 701f37a..42aa81e 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 _0x8fbd=['asr','uri','alternatives','transcript','results','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','channelData','CustomAction','AudioFromTts','audiofile','dirName','bluebird','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','../../../config/logger','protocol','https:','host','WHAT_EVER','get','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','error','unlink','download\x20error','pipe','statusCode','data','end','transcode','error\x20convert','finish\x20to\x20convert','tmp','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','resolve','.mp3','from','writeFile','777','generate','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path'];(function(_0x4460d1,_0x113046){var _0x52f94f=function(_0x3a4e5e){while(--_0x3a4e5e){_0x4460d1['push'](_0x4460d1['shift']());}};_0x52f94f(++_0x113046);}(_0x8fbd,0x14d));var _0xd8fb=function(_0x347be8,_0x156165){_0x347be8=_0x347be8-0x0;var _0x402d98=_0x8fbd[_0x347be8];return _0x402d98;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xd8fb('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xd8fb('0x1'));var https=require(_0xd8fb('0x2'));var md5=require(_0xd8fb('0x3'));var path=require(_0xd8fb('0x4'));var querystring=require(_0xd8fb('0x5'));var rp=require('request-promise');var rs=require(_0xd8fb('0x6'));var sox=require(_0xd8fb('0x7'));var tts=require(_0xd8fb('0x8'));var urlParse=require(_0xd8fb('0x9'))[_0xd8fb('0xa')];var util=require(_0xd8fb('0xb'));var aws=require('./aws');var google=require(_0xd8fb('0xc'));var sestek=require(_0xd8fb('0xd'));var tilde=require('./tilde');var logger=require(_0xd8fb('0xe'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x419669,_0x49059f){return new BPromise(function(_0x2ad743,_0x523bc4){var _0x3089e9=urlParse(_0x419669);var _0x163b2c=_0x3089e9[_0xd8fb('0xf')]===_0xd8fb('0x10')?https:http;var _0x1533c1={'host':_0x3089e9[_0xd8fb('0x11')],'path':_0x3089e9[_0xd8fb('0x4')],'headers':{'user-agent':_0xd8fb('0x12')}};_0x163b2c[_0xd8fb('0x13')](_0x1533c1,function(_0x2dc444){if(_0x2dc444['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0x419669+'\x20failed,\x20status\x20code\x20=\x20'+_0x2dc444['statusCode']+'\x20('+_0x2dc444[_0xd8fb('0x14')]+')');_0x523bc4(new Error(_0xd8fb('0x15')+_0x419669+_0xd8fb('0x16')+_0x2dc444['statusCode']+'\x20('+_0x2dc444[_0xd8fb('0x14')]+')'));return;}var _0xa078ca=fs[_0xd8fb('0x17')](_0x49059f);_0xa078ca['on'](_0xd8fb('0x18'),function(){logger[_0xd8fb('0x19')]('finish\x20download\x20file');_0xa078ca[_0xd8fb('0x1a')](_0x2ad743);});_0xa078ca['on'](_0xd8fb('0x1b'),function(_0x55fce1){fs[_0xd8fb('0x1c')](_0x49059f);logger[_0xd8fb('0x1b')](_0xd8fb('0x1d'),_0x55fce1);_0x523bc4(_0x55fce1);});_0x2dc444[_0xd8fb('0x1e')](_0xa078ca);})['on'](_0xd8fb('0x1b'),function(_0x3f35cc){logger[_0xd8fb('0x1b')](_0x3f35cc);_0x523bc4(_0x3f35cc);})['end']();});}function uploadFile(_0x4b6a20){return new BPromise(function(_0x2b967b,_0x2bad34){var _0x5abb09=urlParse(_0x4b6a20);var _0xa1ce89=_0x5abb09['protocol']===_0xd8fb('0x10')?https:http;var _0x570d75={'host':_0x5abb09[_0xd8fb('0x11')],'path':_0x5abb09[_0xd8fb('0x4')],'headers':{'user-agent':_0xd8fb('0x12')}};_0xa1ce89['get'](_0x570d75,function(_0x5064a9){if(_0x5064a9['statusCode']!==0xc8){_0x2bad34(new Error(_0xd8fb('0x15')+_0x4b6a20+_0xd8fb('0x16')+_0x5064a9[_0xd8fb('0x1f')]+'\x20('+_0x5064a9['statusMessage']+')'));return;}var _0x2487e8='';_0x5064a9['on'](_0xd8fb('0x20'),function(_0x26d534){_0x2487e8+=_0x26d534;});_0x5064a9['on']('end',function(){_0x2b967b(_0x2487e8);});})['on']('error',function(_0x2b9548){_0x2bad34(_0x2b9548);})[_0xd8fb('0x21')]();});}function convertFile(_0x51c2fd,_0x154c06){return new BPromise(function(_0x333463,_0x3183b6){var _0x238507=sox[_0xd8fb('0x22')](_0x51c2fd,_0x154c06,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x238507['on'](_0xd8fb('0x1b'),function(_0x312323){logger[_0xd8fb('0x1b')](_0xd8fb('0x23'),_0x312323);_0x3183b6(_0x312323);});_0x238507['on'](_0xd8fb('0x21'),function(){logger[_0xd8fb('0x19')](_0xd8fb('0x24'));_0x333463();});_0x238507['start']();});}function base64Decode(_0x34493b,_0xfb1a27){var _0x3ed05b=path['resolve'](__dirname,_0xd8fb('0x25'),rs['generate'](0x4)+'.wav');fs[_0xd8fb('0x26')](_0x3ed05b,_0x34493b,_0xd8fb('0x27'));return convertFile(_0x3ed05b,_0xfb1a27)[_0xd8fb('0x28')](function(){try{fs['unlink'](_0x3ed05b);fs[_0xd8fb('0x29')](_0xfb1a27,'777');}catch(_0x5617b0){logger[_0xd8fb('0x1b')](_0x5617b0);}return _0xfb1a27[_0xd8fb('0x2a')]('.')[0x0];});}function base64Encode(_0x23b3bd){var _0x583945=fs[_0xd8fb('0x2b')](_0x23b3bd);return new Buffer(_0x583945)[_0xd8fb('0x2c')](_0xd8fb('0x27'));}exports[_0xd8fb('0x2d')]=function(_0x548c96,_0x1b1f12,_0x4080b3,_0x38c76c,_0x3a49a3,_0x257ea0){var _0x7aaeb6,_0x1cd01b;var _0x5b7ca0=_0xd8fb('0x2e');var _0x32926c=_0xd8fb('0x2f')+_0x548c96;var _0x5ce670={};if(_0x1b1f12===_0xd8fb('0x30')){_0x5ce670[_0xd8fb('0x31')]={'ssml':_0x4080b3};}else{_0x5ce670['input']={'text':_0x4080b3};};_0x5ce670[_0xd8fb('0x32')]={'languageCode':_0x38c76c,'ssmlGender':_0x3a49a3};_0x5ce670['audioConfig']={'audioEncoding':_0xd8fb('0x33'),'sampleRateHertz':0x1f40};var _0x4808c3={'url':_0x5b7ca0+'text:synthesize'+_0x32926c,'method':_0xd8fb('0x34'),'json':!![],'body':_0x5ce670};return rp(_0x4808c3)[_0xd8fb('0x28')](function(_0x4d5b8e){return new BPromise(function(_0x27139f,_0x2bd6d0){_0x7aaeb6=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs['generate'](0x4)+_0xd8fb('0x36'));var _0x484026=Buffer[_0xd8fb('0x37')](_0x4d5b8e['audioContent'],_0xd8fb('0x27'));return fs[_0xd8fb('0x38')](_0x7aaeb6,_0x484026,function(_0x1a228b){_0x2bd6d0(_0x1a228b);},function(_0x260b66){fs[_0xd8fb('0x29')](_0x7aaeb6,_0xd8fb('0x39'));_0x27139f(_0x260b66);});});})[_0xd8fb('0x28')](function(_0xd24d14){_0x1cd01b=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x3b'));return convertFile(_0x7aaeb6,_0x1cd01b);})[_0xd8fb('0x28')](function(){try{fs['unlink'](_0x7aaeb6);fs['chmodSync'](_0x1cd01b,_0xd8fb('0x39'));}catch(_0x167c84){logger[_0xd8fb('0x1b')](_0x167c84);}logger[_0xd8fb('0x19')](_0xd8fb('0x3c'),_0x1cd01b[_0xd8fb('0x2a')]('.')[0x0]);return _0x1cd01b[_0xd8fb('0x2a')]('.')[0x0];});};exports[_0xd8fb('0x3d')]=function(_0x563a0c,_0x5c5692){var _0x3e9c20=_0xd8fb('0x3e');var _0x32dd14,_0x59a970;var _0x2bceda;var _0x45b27b={'encoding':_0xd8fb('0x3f'),'method':_0xd8fb('0x34'),'timeout':0x2710,'url':_0x3e9c20,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xd8fb('0x40'),JSON[_0xd8fb('0x41')]([_0x563a0c,_0x5c5692||'en',![],_0xd8fb('0x42')]),null,_0xd8fb('0x43')]]]))};return rp(_0x45b27b)[_0xd8fb('0x28')](function(_0x4d62e8){try{_0x2bceda=eval(_0x4d62e8['slice'](0x5))[0x0][0x2];}catch(_0x1cf7cd){throw new Error(_0xd8fb('0x44')+_0x4d62e8['data']);}if(!_0x2bceda){if(_0x563a0c['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd8fb('0x45')+_0x5c5692+_0xd8fb('0x46'));}}try{_0x2bceda=eval(_0x2bceda)[0x0];}catch(_0x24eca3){throw new Error(_0xd8fb('0x44')+res[_0xd8fb('0x20')]);}const _0xda7316=_0x2bceda;_0x32dd14=path['resolve'](__dirname,'tmp',rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x36'));fs[_0xd8fb('0x26')](_0x32dd14,_0x2bceda,{'encoding':_0xd8fb('0x27')});_0x59a970=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x3b'));return convertFile(_0x32dd14,_0x59a970);})[_0xd8fb('0x28')](function(){try{fs[_0xd8fb('0x1c')](_0x32dd14);fs['chmodSync'](_0x59a970,'777');}catch(_0x478d2a){logger[_0xd8fb('0x1b')](_0x478d2a);}logger[_0xd8fb('0x19')](_0xd8fb('0x47'),_0x59a970[_0xd8fb('0x2a')]('.')[0x0]);return _0x59a970[_0xd8fb('0x2a')]('.')[0x0];});};exports['googleASR']=function(_0x4b89ba,_0x5979c7,_0x586f8b){return google[_0xd8fb('0x48')](_0x4b89ba,_0x5979c7,_0x586f8b)[_0xd8fb('0x28')](function(_0x4220e5){logger[_0xd8fb('0x19')](_0x4220e5[_0xd8fb('0x49')]);return rp(_0x4220e5);})['then'](function(_0x2df913){var _0x4ec8cc='';var _0x4fffdc=0x0;try{fs['unlink'](_0x4b89ba);}catch(_0x2fe1af){logger[_0xd8fb('0x1b')](_0x2fe1af);}if(_0x2df913&&_0x2df913['results']){_0x4ec8cc=_0x2df913['results']['map'](function(_0x4630e8){return _0x4630e8&&_0x4630e8['alternatives'][0x0]&&_0x4630e8[_0xd8fb('0x4a')][0x0][_0xd8fb('0x4b')]?_0x4630e8[_0xd8fb('0x4a')][0x0][_0xd8fb('0x4b')]:'';})['join']('\x0a');_0x4fffdc=_0x2df913[_0xd8fb('0x4c')]['map'](function(_0x593d90){return _0x593d90&&_0x593d90[_0xd8fb('0x4a')][0x0]&&_0x593d90[_0xd8fb('0x4a')][0x0][_0xd8fb('0x4d')]?_0x593d90[_0xd8fb('0x4a')][0x0][_0xd8fb('0x4d')]:0x0;})[_0xd8fb('0x4e')]('\x0a');}logger[_0xd8fb('0x19')](_0xd8fb('0x4f'),_0x4ec8cc);logger[_0xd8fb('0x19')](_0xd8fb('0x50'),_0x4fffdc);return{'transcript':_0x4ec8cc,'confidence':_0x4fffdc};})[_0xd8fb('0x51')](function(_0xee7ddc){logger[_0xd8fb('0x1b')](_0xd8fb('0x52'),_0xee7ddc['statusCode'],_0xee7ddc[_0xd8fb('0x53')],_0xee7ddc['message']);});};exports[_0xd8fb('0x54')]=function(_0x54ae4e,_0x305e63,_0x1d433d,_0x2ef9d8){var _0x27a410=apiai(_0x305e63,{'language':_0x2ef9d8||'en'});return _0x27a410[_0xd8fb('0x55')](_0x1d433d,{'sessionId':md5(_0x54ae4e)})[_0xd8fb('0x28')](function(_0x23a7b7){logger[_0xd8fb('0x19')](JSON['stringify'](_0x23a7b7));return{'source':_0x23a7b7[_0xd8fb('0x56')][_0xd8fb('0x57')],'resolvedQuery':_0x23a7b7[_0xd8fb('0x56')][_0xd8fb('0x58')],'action':_0x23a7b7[_0xd8fb('0x56')][_0xd8fb('0x59')],'actionIncomplete':_0x23a7b7['result'][_0xd8fb('0x5a')],'speech':_0x23a7b7['result'][_0xd8fb('0x5b')][_0xd8fb('0x5c')],'score':_0x23a7b7[_0xd8fb('0x56')][_0xd8fb('0x5d')],'statusCode':_0x23a7b7[_0xd8fb('0x5e')][_0xd8fb('0x5f')],'endConversation':_0x23a7b7[_0xd8fb('0x56')][_0xd8fb('0x60')][_0xd8fb('0x61')]||![],'isFallbackIntent':_0x23a7b7['result'][_0xd8fb('0x60')]['isFallbackIntent']};});};exports[_0xd8fb('0x62')]=function(_0x54c6ef,_0x71adfc,_0x3ee11f,_0x28e1e6,_0x27106c,_0x142dbb){var _0x85b4e3=_0x28e1e6[_0xd8fb('0x63')](/\\n/g,'\x0a');var _0x2c3aa5={'credentials':{'private_key':_0x85b4e3,'client_email':_0x3ee11f}};var _0x18ce20=new dialogflow[(_0xd8fb('0x64'))](_0x2c3aa5);var _0x234807=_0x18ce20['sessionPath'](_0x71adfc,md5(_0x54c6ef));var _0x45bfc8={'session':_0x234807,'queryInput':{'text':{'text':_0x27106c,'languageCode':_0x142dbb}}};return _0x18ce20[_0xd8fb('0x65')](_0x45bfc8)[_0xd8fb('0x28')](function(_0x23b5bd){if(_0x23b5bd&&_0x23b5bd[_0xd8fb('0x66')]){logger[_0xd8fb('0x19')](_0xd8fb('0x67'),JSON[_0xd8fb('0x41')](_0x23b5bd));var _0xde6664=_0x23b5bd[0x0];if(_0xde6664){var _0x5b7868={'action':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x59')],'allRequiredParamsPresent':_0xde6664['queryResult'][_0xd8fb('0x69')],'endConversation':_0xde6664['queryResult'][_0xd8fb('0x6a')]&&_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6a')][_0xd8fb('0x6b')]?_0xde6664['queryResult'][_0xd8fb('0x6a')][_0xd8fb('0x6b')][_0xd8fb('0x6c')]['boolValue']:![],'fulfillmentText':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6d')],'intentName':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6e')][_0xd8fb('0x53')],'intentDisplayName':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6e')][_0xd8fb('0x6f')],'isFallbackIntent':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6e')][_0xd8fb('0x70')],'languageCode':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x71')],'queryText':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x72')],'responseId':_0xde6664['responseId'],'score':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x73')],'speech':_0xde6664[_0xd8fb('0x68')][_0xd8fb('0x6d')],'providerResponse':JSON[_0xd8fb('0x41')](_0x23b5bd)};return _0x5b7868;}}});};exports[_0xd8fb('0x74')]=function(_0x10f34c,_0x418ef3,_0x553f34,_0x465a8a){return tilde['asr'](_0x10f34c,_0x418ef3,_0x553f34,_0x465a8a)['then'](function(_0x15d699){try{fs[_0xd8fb('0x1c')](_0x10f34c);}catch(_0x2c18ee){logger[_0xd8fb('0x1b')](_0x2c18ee);}logger['info']('Tilde\x20ASR\x20transcription',_0x15d699[_0xd8fb('0x4b')]);logger[_0xd8fb('0x19')](_0xd8fb('0x75'),_0x15d699[_0xd8fb('0x4d')]);return _0x15d699;});};exports[_0xd8fb('0x76')]=function(_0x3c4939,_0x4b434a,_0x48c1c1,_0x578bc5,_0x3c1b26,_0x53be59){var _0x2c4f54=path['resolve'](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x36'));var _0x367d64;return aws[_0xd8fb('0x77')](_0x3c4939,_0x4b434a,_0x48c1c1,_0x578bc5,_0x3c1b26,_0x53be59,_0x2c4f54)[_0xd8fb('0x28')](function(){_0x367d64=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x3b'));return convertFile(_0x2c4f54,_0x367d64);})['then'](function(){try{fs[_0xd8fb('0x1c')](_0x2c4f54);fs[_0xd8fb('0x29')](_0x367d64,_0xd8fb('0x39'));}catch(_0x2c11d0){logger[_0xd8fb('0x1b')](_0x2c11d0);}return _0x367d64[_0xd8fb('0x2a')]('.')[0x0];});};exports[_0xd8fb('0x78')]=function(_0x39b71c,_0x225f23,_0x2becf3,_0x4df841,_0x3a4d13,_0x2a3f4e){return aws[_0xd8fb('0x79')](_0x39b71c,_0x225f23,_0x2becf3,_0x4df841,_0x3a4d13,_0x2a3f4e)[_0xd8fb('0x28')](function(_0x225a79){logger[_0xd8fb('0x19')](JSON['stringify'](_0x225a79));return _0x225a79;});};exports[_0xd8fb('0x7a')]=function(_0x396f83,_0x3159c3,_0xe36f6d,_0xf3cc80){var _0x542cb1=util[_0xd8fb('0x7b')](_0xd8fb('0x7c'),ISPEECH_API,_0x396f83,encodeURIComponent(_0x3159c3),_0xe36f6d,_0xf3cc80);var _0x511c77=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x36'));var _0x5bf6f5;return downloadFile(_0x542cb1,_0x511c77)['then'](function(){_0x5bf6f5=path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs['generate'](0x4)+_0xd8fb('0x3b'));return convertFile(_0x511c77,_0x5bf6f5);})[_0xd8fb('0x28')](function(){try{fs[_0xd8fb('0x1c')](_0x511c77);fs['chmodSync'](_0x5bf6f5,'777');}catch(_0xbc728e){logger[_0xd8fb('0x1b')](_0xbc728e);}return _0x5bf6f5['split']('.')[0x0];});};exports[_0xd8fb('0x7d')]=function(_0x4e984e,_0x4abbf,_0xbefe95,_0x32ae9e){var _0x2908b8=util['format'](_0xd8fb('0x7e'),ISPEECH_API,_0x4abbf,_0xbefe95,base64Encode(_0x4e984e),_0x32ae9e?util[_0xd8fb('0x7b')](_0xd8fb('0x7f'),encodeURIComponent(_0x32ae9e)):'freeform=3');return uploadFile(_0x2908b8)['then'](function(_0x27c6a3){return querystring[_0xd8fb('0xa')](_0x27c6a3);});};exports[_0xd8fb('0x80')]=function(_0x5e6593,_0x34d98b){return sestek[_0xd8fb('0x81')](_0x5e6593,_0x34d98b)[_0xd8fb('0x28')](function(_0x5b4870){logger[_0xd8fb('0x19')](JSON['stringify'](_0x5b4870));var _0x38d943={'speech':_0x5b4870['text'],'action':_0x5b4870['channelData']?_0x5b4870[_0xd8fb('0x82')][_0xd8fb('0x83')]:undefined,'actiondata':_0x5b4870['channelData']?_0x5b4870[_0xd8fb('0x82')]['CustomActionData']:undefined};if(_0x5b4870[_0xd8fb('0x82')]&&_0x5b4870[_0xd8fb('0x82')][_0xd8fb('0x84')]){return base64Decode(_0x5b4870[_0xd8fb('0x82')][_0xd8fb('0x84')]['Data'],path[_0xd8fb('0x35')](__dirname,_0xd8fb('0x25'),rs[_0xd8fb('0x3a')](0x4)+_0xd8fb('0x3b')))['then'](function(_0x37e4ca){_0x38d943[_0xd8fb('0x85')]=_0x37e4ca;return _0x38d943;});}return _0x38d943;});};exports[_0xd8fb('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xec84=['lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fulfillmentText','intent','displayName','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','dialogflow','md5','path','querystring','request-promise','url','parse','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','host','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','777','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','generate','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length'];(function(_0x2bea50,_0x4400cb){var _0x99fdb0=function(_0x3ad3c1){while(--_0x3ad3c1){_0x2bea50['push'](_0x2bea50['shift']());}};_0x99fdb0(++_0x4400cb);}(_0xec84,0x1a9));var _0x4ec8=function(_0x1a96d6,_0x2ace51){_0x1a96d6=_0x1a96d6-0x0;var _0x505671=_0xec84[_0x1a96d6];return _0x505671;};'use strict';var apiai=require(_0x4ec8('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x4ec8('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x4ec8('0x2'));var path=require(_0x4ec8('0x3'));var querystring=require(_0x4ec8('0x4'));var rp=require(_0x4ec8('0x5'));var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x4ec8('0x6'))[_0x4ec8('0x7')];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require(_0x4ec8('0x8'));var tilde=require('./tilde');var logger=require(_0x4ec8('0x9'))('agi');var ISPEECH_API=_0x4ec8('0xa');function downloadFile(_0x1a0b7e,_0x3dbf81){return new BPromise(function(_0xe97ded,_0x56d85d){var _0x151ec3=urlParse(_0x1a0b7e);var _0x3bf706=_0x151ec3['protocol']===_0x4ec8('0xb')?https:http;var _0x5311db={'host':_0x151ec3['host'],'path':_0x151ec3['path'],'headers':{'user-agent':_0x4ec8('0xc')}};_0x3bf706[_0x4ec8('0xd')](_0x5311db,function(_0x9bd823){if(_0x9bd823[_0x4ec8('0xe')]!==0xc8){logger[_0x4ec8('0xf')](_0x4ec8('0x10')+_0x1a0b7e+_0x4ec8('0x11')+_0x9bd823[_0x4ec8('0xe')]+'\x20('+_0x9bd823[_0x4ec8('0x12')]+')');_0x56d85d(new Error(_0x4ec8('0x10')+_0x1a0b7e+_0x4ec8('0x11')+_0x9bd823[_0x4ec8('0xe')]+'\x20('+_0x9bd823['statusMessage']+')'));return;}var _0x491331=fs[_0x4ec8('0x13')](_0x3dbf81);_0x491331['on'](_0x4ec8('0x14'),function(){logger[_0x4ec8('0x15')](_0x4ec8('0x16'));_0x491331[_0x4ec8('0x17')](_0xe97ded);});_0x491331['on'](_0x4ec8('0xf'),function(_0x3b7614){fs[_0x4ec8('0x18')](_0x3dbf81);logger[_0x4ec8('0xf')](_0x4ec8('0x19'),_0x3b7614);_0x56d85d(_0x3b7614);});_0x9bd823[_0x4ec8('0x1a')](_0x491331);})['on'](_0x4ec8('0xf'),function(_0x12ef83){logger[_0x4ec8('0xf')](_0x12ef83);_0x56d85d(_0x12ef83);})[_0x4ec8('0x1b')]();});}function uploadFile(_0x4ede9d){return new BPromise(function(_0x14074c,_0x2dbdbd){var _0x47e5ed=urlParse(_0x4ede9d);var _0x88d292=_0x47e5ed[_0x4ec8('0x1c')]==='https:'?https:http;var _0x69fc57={'host':_0x47e5ed[_0x4ec8('0x1d')],'path':_0x47e5ed['path'],'headers':{'user-agent':_0x4ec8('0xc')}};_0x88d292[_0x4ec8('0xd')](_0x69fc57,function(_0x48e96d){if(_0x48e96d[_0x4ec8('0xe')]!==0xc8){_0x2dbdbd(new Error('request\x20to\x20'+_0x4ede9d+_0x4ec8('0x11')+_0x48e96d[_0x4ec8('0xe')]+'\x20('+_0x48e96d[_0x4ec8('0x12')]+')'));return;}var _0x423d94='';_0x48e96d['on'](_0x4ec8('0x1e'),function(_0x542b9d){_0x423d94+=_0x542b9d;});_0x48e96d['on'](_0x4ec8('0x1b'),function(){_0x14074c(_0x423d94);});})['on'](_0x4ec8('0xf'),function(_0xb8f6f9){_0x2dbdbd(_0xb8f6f9);})['end']();});}function convertFile(_0x1136fb,_0x358672){return new BPromise(function(_0x5dc196,_0x1534ed){var _0x358f4e=sox[_0x4ec8('0x1f')](_0x1136fb,_0x358672,{'sampleRate':0x1f40,'format':_0x4ec8('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x358f4e['on'](_0x4ec8('0xf'),function(_0x16b0fa){logger[_0x4ec8('0xf')](_0x4ec8('0x21'),_0x16b0fa);_0x1534ed(_0x16b0fa);});_0x358f4e['on'](_0x4ec8('0x1b'),function(){logger[_0x4ec8('0x15')](_0x4ec8('0x22'));_0x5dc196();});_0x358f4e[_0x4ec8('0x23')]();});}function base64Decode(_0x4e6a34,_0x4b36a9){var _0x5a4a67=path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs['generate'](0x4)+_0x4ec8('0x26'));fs[_0x4ec8('0x27')](_0x5a4a67,_0x4e6a34,'base64');return convertFile(_0x5a4a67,_0x4b36a9)[_0x4ec8('0x28')](function(){try{fs[_0x4ec8('0x18')](_0x5a4a67);fs['chmodSync'](_0x4b36a9,_0x4ec8('0x29'));}catch(_0x26deb8){logger[_0x4ec8('0xf')](_0x26deb8);}return _0x4b36a9['split']('.')[0x0];});}function base64Encode(_0x36dc11){var _0x38b420=fs[_0x4ec8('0x2a')](_0x36dc11);return new Buffer(_0x38b420)[_0x4ec8('0x2b')](_0x4ec8('0x2c'));}exports[_0x4ec8('0x2d')]=function(_0x3a3bbe,_0x3da2c7,_0x1393a4,_0x1a3f30,_0x468765,_0x43969e){var _0x18e179,_0x3674a0;var _0x482ec1=_0x4ec8('0x2e');var _0x28cb1c=_0x4ec8('0x2f')+_0x3a3bbe;var _0x1312b0={};if(_0x3da2c7==='ssml'){_0x1312b0[_0x4ec8('0x30')]={'ssml':_0x1393a4};}else{_0x1312b0[_0x4ec8('0x30')]={'text':_0x1393a4};};_0x1312b0[_0x4ec8('0x31')]={'languageCode':_0x1a3f30,'ssmlGender':_0x468765};_0x1312b0['audioConfig']={'audioEncoding':_0x4ec8('0x32'),'sampleRateHertz':0x1f40};var _0x4a830e={'url':_0x482ec1+_0x4ec8('0x33')+_0x28cb1c,'method':_0x4ec8('0x34'),'json':!![],'body':_0x1312b0};return rp(_0x4a830e)['then'](function(_0x57a424){return new BPromise(function(_0x1e40a7,_0x33facb){_0x18e179=path['resolve'](__dirname,_0x4ec8('0x25'),rs[_0x4ec8('0x35')](0x4)+'.mp3');var _0x44188f=Buffer[_0x4ec8('0x36')](_0x57a424[_0x4ec8('0x37')],'base64');return fs[_0x4ec8('0x38')](_0x18e179,_0x44188f,function(_0x8189eb){_0x33facb(_0x8189eb);},function(_0xd0c715){fs[_0x4ec8('0x39')](_0x18e179,_0x4ec8('0x29'));_0x1e40a7(_0xd0c715);});});})[_0x4ec8('0x28')](function(_0x363a35){_0x3674a0=path[_0x4ec8('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x4ec8('0x26'));return convertFile(_0x18e179,_0x3674a0);})[_0x4ec8('0x28')](function(){try{fs['unlink'](_0x18e179);fs[_0x4ec8('0x39')](_0x3674a0,_0x4ec8('0x29'));}catch(_0x58406e){logger[_0x4ec8('0xf')](_0x58406e);}logger[_0x4ec8('0x15')](_0x4ec8('0x3a'),_0x3674a0['split']('.')[0x0]);return _0x3674a0[_0x4ec8('0x3b')]('.')[0x0];});};exports['googleTTS']=function(_0x52b456,_0x569573){var _0x2db126=_0x4ec8('0x3c');var _0x4756d5,_0x147174;var _0x41bcbe;var _0x3f86c9={'encoding':'utf8','method':_0x4ec8('0x34'),'timeout':0x2710,'url':_0x2db126,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x4ec8('0x3d')]([[[_0x4ec8('0x3e'),JSON[_0x4ec8('0x3d')]([_0x52b456,_0x569573||'en',![],_0x4ec8('0x3f')]),null,_0x4ec8('0x40')]]]))};return rp(_0x3f86c9)[_0x4ec8('0x28')](function(_0xcc4a09){try{_0x41bcbe=eval(_0xcc4a09['slice'](0x5))[0x0][0x2];}catch(_0x592788){throw new Error(_0x4ec8('0x41')+_0xcc4a09[_0x4ec8('0x1e')]);}if(!_0x41bcbe){if(_0x52b456[_0x4ec8('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x4ec8('0x43')+_0x569573+_0x4ec8('0x44'));}}try{_0x41bcbe=eval(_0x41bcbe)[0x0];}catch(_0x417b92){throw new Error(_0x4ec8('0x41')+res[_0x4ec8('0x1e')]);}const _0x4dd291=_0x41bcbe;_0x4756d5=path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs['generate'](0x4)+_0x4ec8('0x45'));fs[_0x4ec8('0x27')](_0x4756d5,_0x41bcbe,{'encoding':_0x4ec8('0x2c')});_0x147174=path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs[_0x4ec8('0x35')](0x4)+_0x4ec8('0x26'));return convertFile(_0x4756d5,_0x147174);})[_0x4ec8('0x28')](function(){try{fs[_0x4ec8('0x18')](_0x4756d5);fs['chmodSync'](_0x147174,'777');}catch(_0x4ad88a){logger[_0x4ec8('0xf')](_0x4ad88a);}logger[_0x4ec8('0x15')](_0x4ec8('0x46'),_0x147174[_0x4ec8('0x3b')]('.')[0x0]);return _0x147174[_0x4ec8('0x3b')]('.')[0x0];});};exports[_0x4ec8('0x47')]=function(_0x1cef78,_0x57abb3,_0x1ecd2e){return google[_0x4ec8('0x48')](_0x1cef78,_0x57abb3,_0x1ecd2e)['then'](function(_0x136d4e){logger[_0x4ec8('0x15')](_0x136d4e[_0x4ec8('0x49')]);return rp(_0x136d4e);})[_0x4ec8('0x28')](function(_0x16d199){var _0x4389fe='';var _0x31258b=0x0;try{fs[_0x4ec8('0x18')](_0x1cef78);}catch(_0xf2efbe){logger['error'](_0xf2efbe);}if(_0x16d199&&_0x16d199[_0x4ec8('0x4a')]){_0x4389fe=_0x16d199[_0x4ec8('0x4a')][_0x4ec8('0x4b')](function(_0x4c8dba){return _0x4c8dba&&_0x4c8dba['alternatives'][0x0]&&_0x4c8dba[_0x4ec8('0x4c')][0x0]['transcript']?_0x4c8dba[_0x4ec8('0x4c')][0x0][_0x4ec8('0x4d')]:'';})['join']('\x0a');_0x31258b=_0x16d199['results']['map'](function(_0x39fc2c){return _0x39fc2c&&_0x39fc2c[_0x4ec8('0x4c')][0x0]&&_0x39fc2c[_0x4ec8('0x4c')][0x0]['confidence']?_0x39fc2c[_0x4ec8('0x4c')][0x0]['confidence']:0x0;})[_0x4ec8('0x4e')]('\x0a');}logger['info']('googleASR\x20transcription',_0x4389fe);logger['info'](_0x4ec8('0x4f'),_0x31258b);return{'transcript':_0x4389fe,'confidence':_0x31258b};})[_0x4ec8('0x50')](function(_0x5188f2){logger[_0x4ec8('0xf')]('[%s]\x20%s:%s',_0x5188f2[_0x4ec8('0xe')],_0x5188f2[_0x4ec8('0x51')],_0x5188f2[_0x4ec8('0x52')]);});};exports[_0x4ec8('0x53')]=function(_0x3ecc2e,_0x3b5c85,_0x4eb4e1,_0x1c0eb6){var _0x4a4b5b=apiai(_0x3b5c85,{'language':_0x1c0eb6||'en'});return _0x4a4b5b[_0x4ec8('0x54')](_0x4eb4e1,{'sessionId':md5(_0x3ecc2e)})['then'](function(_0x1c9da3){logger[_0x4ec8('0x15')](JSON[_0x4ec8('0x3d')](_0x1c9da3));return{'source':_0x1c9da3[_0x4ec8('0x55')][_0x4ec8('0x56')],'resolvedQuery':_0x1c9da3['result'][_0x4ec8('0x57')],'action':_0x1c9da3['result'][_0x4ec8('0x58')],'actionIncomplete':_0x1c9da3['result'][_0x4ec8('0x59')],'speech':_0x1c9da3[_0x4ec8('0x55')]['fulfillment']['speech'],'score':_0x1c9da3[_0x4ec8('0x55')]['score'],'statusCode':_0x1c9da3['status'][_0x4ec8('0x5a')],'endConversation':_0x1c9da3[_0x4ec8('0x55')]['metadata'][_0x4ec8('0x5b')]||![],'isFallbackIntent':_0x1c9da3['result'][_0x4ec8('0x5c')][_0x4ec8('0x5d')]};});};exports[_0x4ec8('0x5e')]=function(_0x646a99,_0x31c41a,_0x4e0abd,_0x9bd75b,_0x510186,_0x55a840){var _0x29c3f5=_0x9bd75b[_0x4ec8('0x5f')](/\\n/g,'\x0a');var _0x5cd78d={'credentials':{'private_key':_0x29c3f5,'client_email':_0x4e0abd}};var _0x343ddf=new dialogflow['SessionsClient'](_0x5cd78d);var _0x43d6b6=_0x343ddf['sessionPath'](_0x31c41a,md5(_0x646a99));var _0x440db3={'session':_0x43d6b6,'queryInput':{'text':{'text':_0x510186,'languageCode':_0x55a840}}};return _0x343ddf['detectIntent'](_0x440db3)['then'](function(_0x323325){if(_0x323325&&_0x323325[_0x4ec8('0x42')]){logger[_0x4ec8('0x15')](_0x4ec8('0x60'),JSON[_0x4ec8('0x3d')](_0x323325));var _0x3a0842=_0x323325[0x0];if(_0x3a0842){var _0x3bc66c={'action':_0x3a0842[_0x4ec8('0x61')]['action'],'allRequiredParamsPresent':_0x3a0842[_0x4ec8('0x61')]['allRequiredParamsPresent'],'endConversation':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x62')]&&_0x3a0842[_0x4ec8('0x61')]['diagnosticInfo']['fields']?_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x62')]['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x63')],'intentName':_0x3a0842[_0x4ec8('0x61')]['intent'][_0x4ec8('0x51')],'intentDisplayName':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x64')][_0x4ec8('0x65')],'isFallbackIntent':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x64')][_0x4ec8('0x66')],'languageCode':_0x3a0842[_0x4ec8('0x61')]['languageCode'],'queryText':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x67')],'responseId':_0x3a0842['responseId'],'score':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x68')],'speech':_0x3a0842[_0x4ec8('0x61')][_0x4ec8('0x63')],'providerResponse':JSON[_0x4ec8('0x3d')](_0x323325)};return _0x3bc66c;}}});};exports[_0x4ec8('0x69')]=function(_0x402b5a,_0x49d734,_0x52467a,_0x1ff0bb){return tilde[_0x4ec8('0x48')](_0x402b5a,_0x49d734,_0x52467a,_0x1ff0bb)[_0x4ec8('0x28')](function(_0x11c115){try{fs[_0x4ec8('0x18')](_0x402b5a);}catch(_0x3aa91f){logger[_0x4ec8('0xf')](_0x3aa91f);}logger[_0x4ec8('0x15')](_0x4ec8('0x6a'),_0x11c115[_0x4ec8('0x4d')]);logger[_0x4ec8('0x15')](_0x4ec8('0x6b'),_0x11c115[_0x4ec8('0x6c')]);return _0x11c115;});};exports[_0x4ec8('0x6d')]=function(_0x81eeb9,_0x2c2830,_0x543504,_0x54def5,_0x550ef3,_0x4a1be0){var _0x4e8809=path[_0x4ec8('0x24')](__dirname,'tmp',rs[_0x4ec8('0x35')](0x4)+_0x4ec8('0x45'));var _0x33cd01;return aws[_0x4ec8('0x6e')](_0x81eeb9,_0x2c2830,_0x543504,_0x54def5,_0x550ef3,_0x4a1be0,_0x4e8809)['then'](function(){_0x33cd01=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x4e8809,_0x33cd01);})[_0x4ec8('0x28')](function(){try{fs[_0x4ec8('0x18')](_0x4e8809);fs[_0x4ec8('0x39')](_0x33cd01,_0x4ec8('0x29'));}catch(_0x4b7b5f){logger['error'](_0x4b7b5f);}return _0x33cd01[_0x4ec8('0x3b')]('.')[0x0];});};exports[_0x4ec8('0x6f')]=function(_0x3c08dd,_0x17d9a7,_0x513d74,_0x1a342d,_0x4c82c9,_0x1457d3){return aws['lex'](_0x3c08dd,_0x17d9a7,_0x513d74,_0x1a342d,_0x4c82c9,_0x1457d3)[_0x4ec8('0x28')](function(_0x5718f8){logger[_0x4ec8('0x15')](JSON[_0x4ec8('0x3d')](_0x5718f8));return _0x5718f8;});};exports[_0x4ec8('0x70')]=function(_0x45ee17,_0x16a494,_0x89b693,_0x3b8fba){var _0x57c31b=util[_0x4ec8('0x71')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x45ee17,encodeURIComponent(_0x16a494),_0x89b693,_0x3b8fba);var _0x28790d=path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs[_0x4ec8('0x35')](0x4)+_0x4ec8('0x45'));var _0xa88bf7;return downloadFile(_0x57c31b,_0x28790d)[_0x4ec8('0x28')](function(){_0xa88bf7=path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs[_0x4ec8('0x35')](0x4)+_0x4ec8('0x26'));return convertFile(_0x28790d,_0xa88bf7);})[_0x4ec8('0x28')](function(){try{fs['unlink'](_0x28790d);fs['chmodSync'](_0xa88bf7,_0x4ec8('0x29'));}catch(_0x24a4a8){logger[_0x4ec8('0xf')](_0x24a4a8);}return _0xa88bf7[_0x4ec8('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0x26a4a2,_0x489e2,_0x3a238d,_0x22b290){var _0x2c365b=util[_0x4ec8('0x71')](_0x4ec8('0x72'),ISPEECH_API,_0x489e2,_0x3a238d,base64Encode(_0x26a4a2),_0x22b290?util[_0x4ec8('0x71')]('model=%s',encodeURIComponent(_0x22b290)):_0x4ec8('0x73'));return uploadFile(_0x2c365b)[_0x4ec8('0x28')](function(_0x2997d6){return querystring[_0x4ec8('0x7')](_0x2997d6);});};exports[_0x4ec8('0x74')]=function(_0x3f9387,_0x4003c9){return sestek[_0x4ec8('0x75')](_0x3f9387,_0x4003c9)[_0x4ec8('0x28')](function(_0xd76111){logger[_0x4ec8('0x15')](JSON[_0x4ec8('0x3d')](_0xd76111));var _0x1927b6={'speech':_0xd76111['text'],'action':_0xd76111[_0x4ec8('0x76')]?_0xd76111['channelData'][_0x4ec8('0x77')]:undefined,'actiondata':_0xd76111[_0x4ec8('0x76')]?_0xd76111['channelData']['CustomActionData']:undefined};if(_0xd76111['channelData']&&_0xd76111['channelData'][_0x4ec8('0x78')]){return base64Decode(_0xd76111[_0x4ec8('0x76')][_0x4ec8('0x78')][_0x4ec8('0x79')],path[_0x4ec8('0x24')](__dirname,_0x4ec8('0x25'),rs[_0x4ec8('0x35')](0x4)+'.wav'))[_0x4ec8('0x28')](function(_0x3cb679){_0x1927b6['audiofile']=_0x3cb679;return _0x1927b6;});}return _0x1927b6;});};exports[_0x4ec8('0x7a')]=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 0cc655e..962b3f3 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 _0x128c=['exports','./nda'];(function(_0x12a315,_0x5bfa29){var _0x3e57db=function(_0x3da526){while(--_0x3da526){_0x12a315['push'](_0x12a315['shift']());}};_0x3e57db(++_0x5bfa29);}(_0x128c,0x71));var _0xc128=function(_0x4482ca,_0x42eabd){_0x4482ca=_0x4482ca-0x0;var _0xa7b9fb=_0x128c[_0x4482ca];return _0xa7b9fb;};var nda=require(_0xc128('0x0'));module[_0xc128('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3ea5=['./nda','exports'];(function(_0x4a05f0,_0x7a28be){var _0x299982=function(_0x287ad2){while(--_0x287ad2){_0x4a05f0['push'](_0x4a05f0['shift']());}};_0x299982(++_0x7a28be);}(_0x3ea5,0x6e));var _0x53ea=function(_0x6e5434,_0x590f46){_0x6e5434=_0x6e5434-0x0;var _0x5d0298=_0x3ea5[_0x6e5434];return _0x5d0298;};var nda=require(_0x53ea('0x0'));module[_0x53ea('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 44d3f26..12c68f6 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 _0xc4dd=['text','body','channelData','ProjectName','ndagenerate_audio','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','exports','POST','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','dnid'];(function(_0x54bc1c,_0x269933){var _0x10569c=function(_0x5c0eac){while(--_0x5c0eac){_0x54bc1c['push'](_0x54bc1c['shift']());}};_0x10569c(++_0x269933);}(_0xc4dd,0xad));var _0xdc4d=function(_0x3c8980,_0x5a6c30){_0x3c8980=_0x3c8980-0x0;var _0x57c950=_0xc4dd[_0x3c8980];return _0x57c950;};'use strict';var rp=require(_0xdc4d('0x0'));var url=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))('agi');module[_0xdc4d('0x3')]=function(_0x44ba4b,_0x3a5aec){var _0x43f85e={'method':_0xdc4d('0x4'),'uri':url['resolve'](_0x3a5aec['ndauth_url'],_0xdc4d('0x5')),'form':{'grant_type':_0xdc4d('0x6'),'username':_0x3a5aec['username'],'password':_0x3a5aec[_0xdc4d('0x6')]},'json':!![]};return rp(_0x43f85e)[_0xdc4d('0x7')](function(_0x566564){var _0x1c2e51={'method':_0xdc4d('0x4'),'uri':url[_0xdc4d('0x8')](_0x3a5aec[_0xdc4d('0x9')],_0xdc4d('0xa')),'body':{'type':_0x3a5aec[_0xdc4d('0xb')]||_0xdc4d('0xc'),'channelId':'Nda','conversation':{'id':_0x44ba4b[_0xdc4d('0xd')]},'from':{'id':_0x44ba4b[_0xdc4d('0xe')],'name':_0x44ba4b['calleridname']},'recipient':{'id':_0x44ba4b[_0xdc4d('0xf')],'name':_0x44ba4b['extension']},'text':_0x3a5aec[_0xdc4d('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x566564['access_token']},'json':!![]};if(_0x3a5aec['project']){_0x1c2e51[_0xdc4d('0x11')][_0xdc4d('0x12')][_0xdc4d('0x13')]=_0x3a5aec['project'];}if(_0x3a5aec[_0xdc4d('0x14')]=='1'){_0x1c2e51[_0xdc4d('0x11')][_0xdc4d('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdc4d('0x15')};}if(_0x3a5aec['custom_action']){_0x1c2e51['body'][_0xdc4d('0x12')][_0xdc4d('0x16')]=_0x3a5aec[_0xdc4d('0x17')];if(_0x3a5aec[_0xdc4d('0x18')]){_0x1c2e51['body'][_0xdc4d('0x12')][_0xdc4d('0x19')]=_0x3a5aec[_0xdc4d('0x18')];}}logger[_0xdc4d('0x1a')](JSON['stringify'](_0x1c2e51));return rp(_0x1c2e51);});}; \ No newline at end of file +var _0x720c=['body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndaactivity_type','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','project'];(function(_0x2a268d,_0x18c9ba){var _0x7c6629=function(_0x17193f){while(--_0x17193f){_0x2a268d['push'](_0x2a268d['shift']());}};_0x7c6629(++_0x18c9ba);}(_0x720c,0x154));var _0xc720=function(_0x1210ab,_0x301fb6){_0x1210ab=_0x1210ab-0x0;var _0x5d75e4=_0x720c[_0x1210ab];return _0x5d75e4;};'use strict';var rp=require(_0xc720('0x0'));var url=require('url');var logger=require(_0xc720('0x1'))(_0xc720('0x2'));module[_0xc720('0x3')]=function(_0x127edb,_0x5e0261){var _0x3863fa={'method':_0xc720('0x4'),'uri':url[_0xc720('0x5')](_0x5e0261[_0xc720('0x6')],_0xc720('0x7')),'form':{'grant_type':_0xc720('0x8'),'username':_0x5e0261[_0xc720('0x9')],'password':_0x5e0261['password']},'json':!![]};return rp(_0x3863fa)[_0xc720('0xa')](function(_0x8a01fc){var _0x10a2c8={'method':_0xc720('0x4'),'uri':url[_0xc720('0x5')](_0x5e0261['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5e0261[_0xc720('0xb')]||'message','channelId':_0xc720('0xc'),'conversation':{'id':_0x127edb[_0xc720('0xd')]},'from':{'id':_0x127edb['callerid'],'name':_0x127edb[_0xc720('0xe')]},'recipient':{'id':_0x127edb[_0xc720('0xf')],'name':_0x127edb[_0xc720('0x10')]},'text':_0x5e0261[_0xc720('0x11')],'channelData':{}},'headers':{'Authorization':_0xc720('0x12')+_0x8a01fc['access_token']},'json':!![]};if(_0x5e0261[_0xc720('0x13')]){_0x10a2c8[_0xc720('0x14')][_0xc720('0x15')][_0xc720('0x16')]=_0x5e0261['project'];}if(_0x5e0261[_0xc720('0x17')]=='1'){_0x10a2c8[_0xc720('0x14')][_0xc720('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc720('0x18')};}if(_0x5e0261[_0xc720('0x19')]){_0x10a2c8[_0xc720('0x14')][_0xc720('0x15')][_0xc720('0x1a')]=_0x5e0261['custom_action'];if(_0x5e0261['custom_action_data']){_0x10a2c8[_0xc720('0x14')]['channelData'][_0xc720('0x1b')]=_0x5e0261[_0xc720('0x1c')];}}logger['info'](JSON[_0xc720('0x1d')](_0x10a2c8));return rp(_0x10a2c8);});}; \ 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 0669b5a..64690a0 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 _0xcbb1=['exports'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x17f73a,_0x367a44){_0x17f73a=_0x17f73a-0x0;var _0x2f6b83=_0xcbb1[_0x17f73a];return _0x2f6b83;};'use strict';var asr=require('./lib/api');module[_0x1cbb('0x0')]=function(_0x5a19f2,_0x570b71,_0x2aa546,_0x2d2719){return asr(_0x5a19f2,_0x570b71,_0x2aa546,_0x2d2719);}; \ No newline at end of file +var _0x6c0d=['./lib/api','exports'];(function(_0x3b3f36,_0x52a412){var _0x188751=function(_0x5d9133){while(--_0x5d9133){_0x3b3f36['push'](_0x3b3f36['shift']());}};_0x188751(++_0x52a412);}(_0x6c0d,0xd2));var _0xd6c0=function(_0x5c23a3,_0x2468b5){_0x5c23a3=_0x5c23a3-0x0;var _0x5eb8f8=_0x6c0d[_0x5c23a3];return _0x5eb8f8;};'use strict';var asr=require(_0xd6c0('0x0'));module[_0xd6c0('0x1')]=function(_0x5126c6,_0xd2e8d1,_0x1f3291,_0x4942e5){return asr(_0x5126c6,_0xd2e8d1,_0x1f3291,_0x4942e5);}; \ 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 b8df448..a4b0e06 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 _0xa0cd=['open','message','bluebird','lodash','moment','crypto','../../../../../../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','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','isNil','isObject'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0xa0cd,0x19c));var _0xda0c=function(_0x26439d,_0x19e1ae){_0x26439d=_0x26439d-0x0;var _0xe2adde=_0xa0cd[_0x26439d];return _0xe2adde;};'use strict';var BPromise=require(_0xda0c('0x0'));var _=require(_0xda0c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xda0c('0x2'));var crypto=require(_0xda0c('0x3'));var logger=require(_0xda0c('0x4'))(_0xda0c('0x5'));module[_0xda0c('0x6')]=function(_0x4c5727,_0x1ab106,_0x337fc4,_0x1d0165){return new BPromise(function(_0x2c8c67,_0x5610e5){logger[_0xda0c('0x7')](_0xda0c('0x8'),_0x1d0165||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3092a1=new WebSocket(_0x1d0165||_0xda0c('0x9'),{'perMessageDeflate':![]});var _0x27bf02='';var _0x154eda='0';var _0x143147='1';var _0x2688ad=_0xda0c('0xa');function _0x390814(_0x223a0c){var _0x415bb5=crypto[_0xda0c('0xb')](_0xda0c('0xc'));_0x415bb5[_0xda0c('0xd')](_0x223a0c);return _0x415bb5['digest'](_0xda0c('0xe'));}function _0x1d3e1e(){try{logger['info'](_0xda0c('0xf'));var _0x24fc33=moment()[_0xda0c('0x10')]();var _0x3e100b=_0x390814(_0x24fc33+_0x1ab106+_0x337fc4);_0x3092a1[_0xda0c('0x11')](JSON['stringify']({'appID':_0x1ab106,'timestamp':_0x24fc33,'appKey':_0x3e100b}));var _0x243058=fs['createReadStream'](_0x4c5727);_0x243058['on'](_0xda0c('0x12'),function(_0x20e181){_0x3092a1[_0xda0c('0x11')](_0x20e181);});_0x243058['on'](_0xda0c('0x13'),function(){_0x3092a1[_0xda0c('0x11')](_0xda0c('0x14'));});}catch(_0x3316d3){logger['error'](_0xda0c('0x15'),JSON[_0xda0c('0x16')](_0x3316d3));_0x3092a1[_0xda0c('0x17')]();}}function _0x18c5f2(_0x312d29){try{if(_0x312d29){var _0x529562=JSON[_0xda0c('0x18')](_0x312d29);switch(_0x529562['status']){case 0x0:if(_0x529562[_0xda0c('0x19')]){if(_0x529562['result'][_0xda0c('0x1a')]){logger[_0xda0c('0x7')](_0xda0c('0x1b'),JSON[_0xda0c('0x16')](_0x529562['result'][_0xda0c('0x1c')]));_0x27bf02=_0x529562[_0xda0c('0x19')][_0xda0c('0x1c')][0x0][_0xda0c('0x1d')];_0x154eda=_0x529562[_0xda0c('0x19')]['hypotheses'][0x0][_0xda0c('0x1e')];_0x143147='0';_0x2688ad=_0xda0c('0x1f');_0x3092a1[_0xda0c('0x17')]();}}break;case 0x1:logger['info'](_0xda0c('0xa'));_0x143147='1';_0x2688ad='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xda0c('0x7')](_0xda0c('0x20'));_0x143147='2';_0x2688ad='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x143147='9';_0x2688ad=_0xda0c('0x21');break;case 0xa:logger['info'](_0xda0c('0x22'));_0x143147='10';_0x2688ad=_0xda0c('0x22');break;case 0xb:logger['info'](_0xda0c('0x23'));_0x143147='11';_0x2688ad=_0xda0c('0x23');}}}catch(_0x5418d9){logger[_0xda0c('0x24')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xda0c('0x16')](_0x5418d9));_0x3092a1[_0xda0c('0x17')]();}}function _0x967e23(){logger[_0xda0c('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x2c8c67({'transcript':_0x27bf02,'confidence':_0x154eda,'status':_0x143147,'status_message':_0x2688ad});}function _0x2463b8(_0x1d13fc){logger[_0xda0c('0x24')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xda0c('0x25')](_0x1d13fc)){logger[_0xda0c('0x24')](_[_0xda0c('0x26')](_0x1d13fc)?JSON[_0xda0c('0x16')](_0x1d13fc):_0x1d13fc);}}_0x3092a1['on'](_0xda0c('0x27'),_0x1d3e1e);_0x3092a1['on'](_0xda0c('0x28'),_0x18c5f2);_0x3092a1['on'](_0xda0c('0x13'),_0x967e23);_0x3092a1['on'](_0xda0c('0x24'),_0x2463b8);});}; \ No newline at end of file +var _0xdbd3=['isNil','isObject','open','message','lodash','moment','crypto','../../../../../../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','sha1','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket'];(function(_0x39099e,_0x24f102){var _0x3d0ae3=function(_0x38445f){while(--_0x38445f){_0x39099e['push'](_0x39099e['shift']());}};_0x3d0ae3(++_0x24f102);}(_0xdbd3,0x19e));var _0x3dbd=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0xdbd3[_0x3f1710];return _0x528458;};'use strict';var BPromise=require('bluebird');var _=require(_0x3dbd('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3dbd('0x1'));var crypto=require(_0x3dbd('0x2'));var logger=require(_0x3dbd('0x3'))(_0x3dbd('0x4'));module[_0x3dbd('0x5')]=function(_0xb7904b,_0x52bf3f,_0x4400f0,_0x59dff6){return new BPromise(function(_0xb107e5,_0x10ec62){logger[_0x3dbd('0x6')](_0x3dbd('0x7'),_0x59dff6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x250161=new WebSocket(_0x59dff6||_0x3dbd('0x8'),{'perMessageDeflate':![]});var _0x182b85='';var _0x182dcc='0';var _0x366d72='1';var _0x5b52d6=_0x3dbd('0x9');function _0x8e9dcd(_0x251ddb){var _0x1ad550=crypto[_0x3dbd('0xa')](_0x3dbd('0xb'));_0x1ad550['update'](_0x251ddb);return _0x1ad550['digest'](_0x3dbd('0xc'));}function _0x231fe3(){try{logger[_0x3dbd('0x6')](_0x3dbd('0xd'));var _0x5496eb=moment()[_0x3dbd('0xe')]();var _0x452064=_0x8e9dcd(_0x5496eb+_0x52bf3f+_0x4400f0);_0x250161[_0x3dbd('0xf')](JSON[_0x3dbd('0x10')]({'appID':_0x52bf3f,'timestamp':_0x5496eb,'appKey':_0x452064}));var _0x488ccc=fs[_0x3dbd('0x11')](_0xb7904b);_0x488ccc['on'](_0x3dbd('0x12'),function(_0x3bf4a4){_0x250161[_0x3dbd('0xf')](_0x3bf4a4);});_0x488ccc['on'](_0x3dbd('0x13'),function(){_0x250161[_0x3dbd('0xf')](_0x3dbd('0x14'));});}catch(_0xbea659){logger[_0x3dbd('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0x3dbd('0x10')](_0xbea659));_0x250161[_0x3dbd('0x16')]();}}function _0x3ddfc3(_0x258b71){try{if(_0x258b71){var _0x5dd156=JSON['parse'](_0x258b71);switch(_0x5dd156[_0x3dbd('0x17')]){case 0x0:if(_0x5dd156['result']){if(_0x5dd156['result'][_0x3dbd('0x18')]){logger[_0x3dbd('0x6')](_0x3dbd('0x19'),JSON[_0x3dbd('0x10')](_0x5dd156[_0x3dbd('0x1a')][_0x3dbd('0x1b')]));_0x182b85=_0x5dd156[_0x3dbd('0x1a')]['hypotheses'][0x0][_0x3dbd('0x1c')];_0x182dcc=_0x5dd156[_0x3dbd('0x1a')][_0x3dbd('0x1b')][0x0][_0x3dbd('0x1d')];_0x366d72='0';_0x5b52d6=_0x3dbd('0x1e');_0x250161[_0x3dbd('0x16')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x366d72='1';_0x5b52d6=_0x3dbd('0x9');break;case 0x2:logger['info'](_0x3dbd('0x1f'));_0x366d72='2';_0x5b52d6=_0x3dbd('0x1f');break;case 0x9:logger[_0x3dbd('0x6')](_0x3dbd('0x20'));_0x366d72='9';_0x5b52d6=_0x3dbd('0x20');break;case 0xa:logger['info'](_0x3dbd('0x21'));_0x366d72='10';_0x5b52d6=_0x3dbd('0x21');break;case 0xb:logger[_0x3dbd('0x6')](_0x3dbd('0x22'));_0x366d72='11';_0x5b52d6=_0x3dbd('0x22');}}}catch(_0x2e7d2f){logger[_0x3dbd('0x15')](_0x3dbd('0x23'),JSON['stringify'](_0x2e7d2f));_0x250161[_0x3dbd('0x16')]();}}function _0x4037fd(){logger[_0x3dbd('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0xb107e5({'transcript':_0x182b85,'confidence':_0x182dcc,'status':_0x366d72,'status_message':_0x5b52d6});}function _0x6d0df9(_0x620965){logger[_0x3dbd('0x15')](_0x3dbd('0x24'));if(!_[_0x3dbd('0x25')](_0x620965)){logger[_0x3dbd('0x15')](_[_0x3dbd('0x26')](_0x620965)?JSON[_0x3dbd('0x10')](_0x620965):_0x620965);}}_0x250161['on'](_0x3dbd('0x27'),_0x231fe3);_0x250161['on'](_0x3dbd('0x28'),_0x3ddfc3);_0x250161['on'](_0x3dbd('0x13'),_0x4037fd);_0x250161['on'](_0x3dbd('0x15'),_0x6d0df9);});}; \ 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 a56967a..963ea69 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 _0xdff8=['exports'];(function(_0x17551f,_0x3d44dc){var _0x3e7c59=function(_0x4dfdb2){while(--_0x4dfdb2){_0x17551f['push'](_0x17551f['shift']());}};_0x3e7c59(++_0x3d44dc);}(_0xdff8,0x1d1));var _0x8dff=function(_0x21f88f,_0x48cfba){_0x21f88f=_0x21f88f-0x0;var _0x3b9ff5=_0xdff8[_0x21f88f];return _0x3b9ff5;};var asr=require('./asr');module[_0x8dff('0x0')]={'asr':asr}; \ No newline at end of file +var _0x3f0d=['./asr'];(function(_0x13c217,_0xa8c627){var _0xa128a0=function(_0x62d620){while(--_0x62d620){_0x13c217['push'](_0x13c217['shift']());}};_0xa128a0(++_0xa8c627);}(_0x3f0d,0x1d4));var _0xd3f0=function(_0x4a606f,_0x2b432a){_0x4a606f=_0x4a606f-0x0;var _0x165eed=_0x3f0d[_0x4a606f];return _0x165eed;};var asr=require(_0xd3f0('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 017ecd8..ff56701 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(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0xe706,0xa3));var _0x6e70=function(_0x11fd4e,_0x1a32ec){_0x11fd4e=_0x11fd4e-0x0;var _0x324371=_0xe706[_0x11fd4e];return _0x324371;};'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 _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(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xe706,0xa3));var _0x6e70=function(_0x15185f,_0x2003a5){_0x15185f=_0x15185f-0x0;var _0x3c9c47=_0xe706[_0x15185f];return _0x3c9c47;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4a76cd5..4473f28 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 _0x06f4=['replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','response','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','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','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','escape_digits','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','email','Smtp','user','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','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','arg_1','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','odbc','randomstring','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','getsecretdigits','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','rpc','getVoiceQueueById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','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','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','text','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','PUT','method','toUpperCase','body','headers','rawHeaders','parse','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','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x06f4,0x136));var _0x406f=function(_0x257e1c,_0x1e8d1a){_0x257e1c=_0x257e1c-0x0;var _0x3580e1=_0x06f4[_0x257e1c];return _0x3580e1;};'use strict';var fs=require('fs');var util=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var sh=require('shelljs');var odbc=require(_0x406f('0x2'))();var rs=require(_0x406f('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var scripts=require(_0x406f('0x7'));var FILES_PATH=_0x406f('0x8');var recursiveMapAttributes=['rawHeaders',_0x406f('0x9')];var verticesWithRetry=['menu',_0x406f('0xa'),_0x406f('0xb')];var AGIVertices=function(_0xc2f682,_0x54eb68,_0x407936){this['channel']=_0xc2f682;this['rpc']=_0x54eb68;this[_0x406f('0xc')]=_0x407936;};AGIVertices['prototype'][_0x406f('0xd')]=function(_0x4e0e96,_0x18eb6f){this['rpc'][_0x406f('0xe')](_0x4e0e96)[_0x406f('0xf')](function(_0x506f9f){_0x18eb6f(null,_0x506f9f?_0x506f9f[_0x406f('0x10')]:![]);})[_0x406f('0x11')](function(_0x451592){_0x18eb6f(_0x451592);});};AGIVertices[_0x406f('0x12')][_0x406f('0x13')]=function(_0x21c376,_0x29aef9){this[_0x406f('0x14')][_0x406f('0x15')](_0x21c376)[_0x406f('0xf')](function(_0x2a3f3e){_0x29aef9(null,_0x2a3f3e?_0x2a3f3e['name']:![]);})[_0x406f('0x11')](function(_0x28fda6){_0x29aef9(_0x28fda6);});};AGIVertices[_0x406f('0x12')]['getSquareProject']=function(_0x18ffbb,_0x14b838){this['rpc']['getSquareProjectById'](_0x18ffbb)[_0x406f('0xf')](function(_0x4357e3){_0x14b838(null,_0x4357e3?_0x4357e3['name']:![]);})[_0x406f('0x11')](function(_0x57d93a){_0x14b838(_0x57d93a);});};AGIVertices[_0x406f('0x12')][_0x406f('0x16')]=function(_0x1da473,_0x12bb0f){this['rpc']['getSquareOdbcById'](_0x1da473)[_0x406f('0xf')](function(_0x5476d2){_0x12bb0f(null,_0x5476d2?_0x5476d2[_0x406f('0x17')]:![]);})['catch'](function(_0x38254b){_0x12bb0f(_0x38254b);});};AGIVertices[_0x406f('0x12')][_0x406f('0x18')]=function(_0x5201fb,_0x58c0d3){this['rpc'][_0x406f('0x19')](_0x5201fb)[_0x406f('0xf')](function(_0x1e3b13){_0x58c0d3(null,_0x1e3b13?_0x1e3b13['name']:![]);})[_0x406f('0x11')](function(_0x5961cc){_0x58c0d3(_0x5961cc);});};AGIVertices[_0x406f('0x12')][_0x406f('0x1a')]=function(_0x3bc17d,_0x2d9aea){this[_0x406f('0x14')]['getTrunkById'](_0x3bc17d)['then'](function(_0x81589c){_0x2d9aea(null,_0x81589c?_0x81589c['name']:![]);})[_0x406f('0x11')](function(_0xa240d8){_0x2d9aea(_0xa240d8);});};AGIVertices['prototype']['getSound']=function(_0x1b837d,_0x484f7c){var _0x377cb9=this;this[_0x406f('0x14')][_0x406f('0x1b')](_0x1b837d)[_0x406f('0xf')](function(_0x2c439b){_0x484f7c(null,_0x2c439b?_0x377cb9[_0x406f('0x1c')](_0x2c439b[_0x406f('0x1d')]):![]);})[_0x406f('0x11')](function(_0x5ec2ed){_0x484f7c(_0x5ec2ed);});};AGIVertices['prototype'][_0x406f('0x1e')]=function(_0x1a4567,_0x1ae022){this[_0x406f('0x14')]['getMailAccountById'](_0x1a4567)['then'](function(_0x504ce9){_0x1ae022(null,_0x504ce9?_0x504ce9:![]);})[_0x406f('0x11')](function(_0x4fb304){_0x1ae022(_0x4fb304);});};AGIVertices['prototype'][_0x406f('0x1f')]=function(_0x378cc3,_0x2e42fa,_0x2b8a15){this[_0x406f('0xc')][_0x406f('0x1f')](_0x378cc3,_0x2e42fa)[_0x406f('0xf')](function(){_0x2b8a15(null);})[_0x406f('0x11')](function(_0x29360b){_0x2b8a15(_0x29360b);});};AGIVertices[_0x406f('0x12')][_0x406f('0x20')]=function(_0x449c79,_0x23efaa){this['rpc'][_0x406f('0x21')](_0x449c79)[_0x406f('0xf')](function(_0x13fb61){if(_0x13fb61){if(_0x13fb61[_0x406f('0x22')]){_0x23efaa(null,[_0x13fb61[_0x406f('0x23')]]);}else{_0x23efaa(null,_[_0x406f('0x24')](_0x13fb61[_0x406f('0x25')],_0x406f('0x23')));}}else{_0x23efaa(null,![]);}})[_0x406f('0x11')](function(_0x3fdc25){_0x23efaa(_0x3fdc25);});};AGIVertices['prototype'][_0x406f('0x1c')]=function(_0x1062ef){return util[_0x406f('0x26')](_0x406f('0x27'),FILES_PATH,_0x1062ef);};AGIVertices[_0x406f('0x12')][_0x406f('0x28')]=function(_0x58108b,_0x52f878,_0x44c63a){odbc[_0x406f('0x29')](_0x58108b,function(_0x5be3de){if(_0x5be3de){logger[_0x406f('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5be3de);_0x44c63a(_0x5be3de);}else{logger[_0x406f('0x2b')](_0x406f('0x2c'));odbc[_0x406f('0x2d')](_0x52f878,function(_0x5f2a29,_0x14ca94){if(_0x5f2a29){logger[_0x406f('0x2b')](_0x406f('0x2e'),_0x52f878);_0x44c63a(_0x5f2a29);}else{logger[_0x406f('0x2b')](_0x406f('0x2f'),_0x52f878);odbc[_0x406f('0x30')](function(_0x7bcff3){if(_0x7bcff3){logger[_0x406f('0x2a')](_0x406f('0x31'),_0x7bcff3);}_0x44c63a(null,_0x14ca94);});}});}});};AGIVertices[_0x406f('0x12')][_0x406f('0x32')]=function(_0x37c4d2,_0x279e9e){this[_0x406f('0x14')][_0x406f('0x33')](_0x37c4d2)['then'](function(_0x55c759){_0x279e9e(null,_0x55c759?_0x55c759:![]);})['catch'](function(_0x2f67c1){_0x279e9e(_0x2f67c1);});};AGIVertices[_0x406f('0x12')][_0x406f('0x34')]=function(_0x4aef8f,_0x172c5c){this[_0x406f('0x14')][_0x406f('0x34')](_0x4aef8f)[_0x406f('0xf')](function(_0x1c079a){_0x172c5c(null,_0x1c079a);})[_0x406f('0x11')](function(_0x4e28b4){_0x172c5c(_0x4e28b4);});};AGIVertices[_0x406f('0x12')][_0x406f('0x35')]=function(_0x494a8f,_0xe4a559,_0x53fb67){this['rpc'][_0x406f('0x35')]({'uniqueid':this[_0x406f('0x36')][_0x406f('0x37')],'node':_0x494a8f[_0x406f('0x38')],'application':_0x494a8f[_0x406f('0x39')],'data':_0xe4a559||null,'project_name':this[_0x406f('0x36')]['arg_1'],'callerid':this['channel'][_0x406f('0x3a')]})[_0x406f('0xf')](function(_0x45c0c6){if(_0x53fb67){_0x53fb67(null,_0x45c0c6);}})[_0x406f('0x11')](function(_0x453289){if(_0x53fb67){_0x53fb67(_0x453289);}});};AGIVertices[_0x406f('0x12')][_0x406f('0x3b')]=function(_0x508a38,_0x146056,_0xda1e26,_0x351044){this[_0x406f('0x14')][_0x406f('0x3b')]({'uniqueid':this[_0x406f('0x36')][_0x406f('0x37')],'callerid':this[_0x406f('0x36')][_0x406f('0x3a')],'calleridname':this[_0x406f('0x36')][_0x406f('0x3c')],'context':this['channel'][_0x406f('0x3d')],'extension':this[_0x406f('0x36')]['extension'],'priority':this['channel'][_0x406f('0x3e')],'accountcode':this[_0x406f('0x36')][_0x406f('0x3f')],'dnid':this[_0x406f('0x36')]['dnid'],'projectName':this[_0x406f('0x36')]['arg_1'],'saveName':_0x146056,'filename':_0x508a38[_0x406f('0x40')]||_0x146056,'savePath':_0xda1e26})[_0x406f('0xf')](function(_0x5b1143){_0x351044(null,_0x5b1143);})['catch'](function(_0x1bdb59){_0x351044(_0x1bdb59);});};AGIVertices[_0x406f('0x12')][_0x406f('0x41')]=function(_0x3e09b7,_0x56339a,_0x331485,_0x35619c,_0x8ef14b){this[_0x406f('0x14')]['createSquareMessage']({'uniqueid':this['channel'][_0x406f('0x37')],'body':_0x3e09b7,'direction':_0x56339a,'providerName':_0x331485,'providerResponse':_0x35619c})[_0x406f('0xf')](function(_0x8a17e0){if(_0x8ef14b){_0x8ef14b(null,_0x8a17e0);}})[_0x406f('0x11')](function(_0x2a9a61){if(_0x8ef14b){_0x8ef14b(_0x2a9a61);}});};AGIVertices['prototype'][_0x406f('0x42')]=function(_0x23026d,_0x4a5a01){this['rpc'][_0x406f('0x42')]({'firstName':_[_0x406f('0x43')](_0x23026d[_0x406f('0x10')])||_['isNil'](_0x23026d[_0x406f('0x10')])?_0x406f('0x44')+Math[_0x406f('0x45')]():_0x23026d[_0x406f('0x10')],'lastName':_[_0x406f('0x43')](_0x23026d[_0x406f('0x46')])||_[_0x406f('0x47')](_0x23026d[_0x406f('0x46')])?null:_0x23026d[_0x406f('0x46')],'phone':_0x23026d['phone'],'ListId':_0x23026d['list_id'],'scheduledat':_0x23026d[_0x406f('0x48')],'callbackUniqueid':this[_0x406f('0x36')][_0x406f('0x37')],'tags':_0x406f('0x49'),'description':_0x406f('0x4a')+_0x23026d[_0x406f('0x48')][_0x406f('0x4b')](),'priority':_0x23026d[_0x406f('0x4c')]})[_0x406f('0xf')](function(_0x1bd758){_0x4a5a01(null,_0x1bd758);})['catch'](function(_0x5ef690){_0x4a5a01(_0x5ef690);});};AGIVertices[_0x406f('0x12')][_0x406f('0x4d')]=function(_0x3039a4,_0x17a796){this[_0x406f('0x14')][_0x406f('0x4e')](_0x3039a4)['then'](function(_0x1faac1){_0x17a796(null,_0x1faac1?_0x1faac1[_0x406f('0x10')]:![]);})[_0x406f('0x11')](function(_0x6e2d0b){_0x17a796(_0x6e2d0b);});};AGIVertices[_0x406f('0x12')][_0x406f('0x4f')]=function(_0x14d61c,_0x10db69,_0x573265){var _0x319cdb={'role':'agent'};_0x319cdb[_0x14d61c]=this[_0x406f('0x36')][_0x406f('0x3a')];this[_0x406f('0x14')]['agentPause'](_0x319cdb,_0x10db69,this[_0x406f('0x36')]['uniqueid'])['then'](function(_0x299ff4){_0x573265(null,_[_0x406f('0x47')](_0x299ff4)?![]:!![]);})['catch'](function(_0x30e4eb){logger['error'](_0x30e4eb);_0x573265(null,![]);});};AGIVertices[_0x406f('0x12')]['agentUnpause']=function(_0x2c3881,_0x48bca4){var _0x313eed={'role':_0x406f('0x50')};_0x313eed[_0x2c3881]=this['channel']['callerid'];this[_0x406f('0x14')][_0x406f('0x51')](_0x313eed)[_0x406f('0xf')](function(_0x34254b){_0x48bca4(null,_['isNil'](_0x34254b)?![]:!![]);})[_0x406f('0x11')](function(_0x3a41d3){logger[_0x406f('0x2a')](_0x3a41d3);_0x48bca4(null,![]);});};AGIVertices[_0x406f('0x12')][_0x406f('0x52')]=function(_0x13302b,_0x36bd31){var _0x5c1a91={'role':_0x406f('0x50')};_0x5c1a91[_0x13302b]=this['channel'][_0x406f('0x3a')];this[_0x406f('0x14')][_0x406f('0x52')](_0x5c1a91)['then'](function(_0x3b2bff){_0x36bd31(null,_[_0x406f('0x47')](_0x3b2bff)?![]:!![]);})['catch'](function(_0x5b11ae){logger[_0x406f('0x2a')](_0x5b11ae);_0x36bd31(null,![]);});};AGIVertices[_0x406f('0x12')]['agentLogin']=function(_0x5d6604,_0x4c0597){var _0x1b3935={'role':_0x406f('0x50')};_0x1b3935[_0x5d6604]=this[_0x406f('0x36')]['callerid'];var _0x54a066=_0x5d6604!=_0x406f('0x53')?util[_0x406f('0x26')](_0x406f('0x54'),_0x406f('0x55'),this[_0x406f('0x36')]['callerid']):undefined;this[_0x406f('0x14')][_0x406f('0x56')](_0x1b3935,_0x54a066)[_0x406f('0xf')](function(_0x3ce218){_0x4c0597(null,_[_0x406f('0x47')](_0x3ce218)?![]:!![]);})[_0x406f('0x11')](function(_0x62f317){logger[_0x406f('0x2a')](_0x62f317);_0x4c0597(null,![]);});};AGIVertices[_0x406f('0x12')][_0x406f('0x57')]=function(_0x44ca9a,_0x387941){sh[_0x406f('0x58')](_[_0x406f('0x59')](_0x44ca9a),function(_0x1283f2,_0x230267){var _0x2cac38=_0x230267['replace'](/(\r\n|\n|\r)/gm,'');_0x387941(null,_0x2cac38);});};AGIVertices[_0x406f('0x12')][_0x406f('0x5a')]=function(_0x2c7971,_0x58a0d0){scripts[_0x406f('0x5a')](_0x2c7971[_0x406f('0x5b')],_0x2c7971['google_cloud_tts_text_type']||_0x406f('0x5c'),_0x2c7971['text'],_0x2c7971['languageCode']||_0x406f('0x5d'),_0x2c7971[_0x406f('0x5e')]||'MALE',_0x2c7971[_0x406f('0x5f')]||'MP3')[_0x406f('0xf')](function(_0x3b1baa){_0x58a0d0(null,_0x3b1baa);})[_0x406f('0x11')](function(_0x35657d){_0x58a0d0(_0x35657d);});};AGIVertices[_0x406f('0x12')][_0x406f('0x60')]=function(_0x2543a3,_0x103780){scripts[_0x406f('0x60')](_0x2543a3['text'],_0x2543a3[_0x406f('0x61')]||'en',0x1)['then'](function(_0x3356c4){_0x103780(null,_0x3356c4);})['catch'](function(_0x5b989a){_0x103780(_0x5b989a);});};AGIVertices['prototype'][_0x406f('0x62')]=function(_0x3f0e29,_0x2bb105){var _0x156fa5={'uri':_0x3f0e29[_0x406f('0x63')],'method':_0x3f0e29['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3f0e29['timeout'])==='number'&&parseInt(_0x3f0e29[_0x406f('0x64')])>=0x1?parseInt(_0x3f0e29['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x406f('0x65')]([_0x406f('0x66'),_0x406f('0x67')],_0x156fa5[_0x406f('0x68')][_0x406f('0x69')]())){try{_0x156fa5[_0x406f('0x6a')]=_0x3f0e29['rawBody']?JSON['parse'](_0x3f0e29[_0x406f('0x9')]):{};}catch(_0x33a98b){logger[_0x406f('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x33a98b);}}try{_0x156fa5[_0x406f('0x6b')]=_0x3f0e29[_0x406f('0x6c')]?JSON[_0x406f('0x6d')](_0x3f0e29[_0x406f('0x6c')]):{};}catch(_0x8d2b9f){logger['error'](_0x406f('0x6e'),_0x8d2b9f);}if(_0x3f0e29[_0x406f('0x6f')]){try{var _0x67200a=require(_0x3f0e29[_0x406f('0x6f')])[_0x406f('0x70')](this,_0x156fa5);_0x156fa5[_0x406f('0x71')]=Mustache[_0x406f('0x72')](_0x3f0e29[_0x406f('0x63')],_0x67200a,{},['$$','$$']);if(_0x156fa5['headers']){_0x156fa5['headers']=JSON['parse'](Mustache[_0x406f('0x72')](JSON['stringify'](_0x156fa5['headers']),_0x67200a,{},['$$','$$']));}if(_0x156fa5[_0x406f('0x6a')]){_0x156fa5[_0x406f('0x6a')]=JSON[_0x406f('0x6d')](Mustache[_0x406f('0x72')](JSON[_0x406f('0x73')](_0x156fa5['body']),_0x67200a,{},['$$','$$']));}}catch(_0x58206a){logger[_0x406f('0x2a')](_0x406f('0x74'),_0x58206a);}}rp(_0x156fa5)['then'](function(_0x3acdf3){var _0x4fbc53={'statusCode':_0x3acdf3[_0x406f('0x75')]||0xc8,'statusMessage':_0x3acdf3[_0x406f('0x76')]||'OK','headers':_0x3acdf3['headers']||{},'body':_0x3acdf3[_0x406f('0x6a')]||{}};_0x2bb105(null,_0x4fbc53);})[_0x406f('0x11')](function(_0x4c200a){var _0x1168bc={'statusCode':_0x4c200a[_0x406f('0x75')]||0x1f4,'statusMessage':_0x4c200a[_0x406f('0x77')]||_0x406f('0x78'),'headers':_0x4c200a[_0x406f('0x79')][_0x406f('0x6b')]||{},'body':_0x4c200a[_0x406f('0x79')][_0x406f('0x6a')]||{}};_0x2bb105(null,_0x1168bc);});};AGIVertices['prototype'][_0x406f('0x7a')]=function(_0x16791a,_0x169662){scripts[_0x406f('0x7a')](this[_0x406f('0x36')][_0x406f('0x37')],_0x16791a[_0x406f('0x7b')],_0x16791a[_0x406f('0x5c')],_0x16791a[_0x406f('0x7c')]||'en')['then'](function(_0x37a270){_0x169662(null,_0x37a270);})[_0x406f('0x11')](function(_0x517840){_0x169662(_0x517840);});};AGIVertices[_0x406f('0x12')][_0x406f('0x7d')]=function(_0x39fe38,_0x42a297){scripts[_0x406f('0x7d')](this[_0x406f('0x36')]['uniqueid'],_0x39fe38[_0x406f('0x7e')],_0x39fe38[_0x406f('0x7f')],_0x39fe38['private_key'],_0x39fe38[_0x406f('0x5c')],_0x39fe38['dialogflowV2_language']||'en')[_0x406f('0xf')](function(_0x436d0d){_0x42a297(null,_0x436d0d);})[_0x406f('0x11')](function(_0x24f19f){_0x42a297(_0x24f19f);});};AGIVertices[_0x406f('0x12')][_0x406f('0x80')]=function(_0x16940e,_0x11638c){scripts['sestekNDA'](this[_0x406f('0x36')],_0x16940e)[_0x406f('0xf')](function(_0x58a1aa){_0x11638c(null,_0x58a1aa);})[_0x406f('0x11')](function(_0x4f21cf){_0x11638c(_0x4f21cf);});};AGIVertices[_0x406f('0x12')]['ispeechTTS']=function(_0x170a34,_0x27d9ed){scripts[_0x406f('0x81')](_0x170a34[_0x406f('0x7b')],_0x170a34['text'],_0x170a34[_0x406f('0x82')]||_0x406f('0x5d'),_0x170a34[_0x406f('0x83')])[_0x406f('0xf')](function(_0x3752f2){_0x27d9ed(null,_0x3752f2);})['catch'](function(_0x4a237b){_0x27d9ed(_0x4a237b);});};AGIVertices[_0x406f('0x12')][_0x406f('0x84')]=function(_0x53f10f,_0xf69a70,_0x14b1ea){scripts['ispeechASR'](_0xf69a70,_0x53f10f['key'],_0x53f10f[_0x406f('0x85')]||_0x406f('0x5d'),this[_0x406f('0x86')](_0x53f10f[_0x406f('0x87')])?_0x53f10f[_0x406f('0x87')]:undefined)[_0x406f('0xf')](function(_0x1b9890){_0x14b1ea(null,_0x1b9890);})['catch'](function(_0x13478a){_0x14b1ea(_0x13478a);});};AGIVertices[_0x406f('0x12')][_0x406f('0x88')]=function(_0x2ade04,_0x1bc3a4){scripts[_0x406f('0x88')](_0x2ade04['aws_access_key_id'],_0x2ade04[_0x406f('0x89')],_0x2ade04[_0x406f('0x8a')],_0x2ade04[_0x406f('0x8b')]||_0x406f('0x8c'),_0x2ade04[_0x406f('0x5c')],_0x2ade04[_0x406f('0x8d')]||_0x406f('0x5c'))[_0x406f('0xf')](function(_0x4a7792){_0x1bc3a4(null,_0x4a7792);})[_0x406f('0x11')](function(_0x1fbbba){_0x1bc3a4(_0x1fbbba);});};AGIVertices[_0x406f('0x12')][_0x406f('0x8e')]=function(_0x5708bd,_0x249e39){scripts['awsLex'](this['channel'][_0x406f('0x37')],_0x5708bd[_0x406f('0x8f')],_0x5708bd[_0x406f('0x89')],_0x5708bd[_0x406f('0x90')],_0x5708bd[_0x406f('0x5c')],_0x5708bd['aws_bot_name'])[_0x406f('0xf')](function(_0x5cc431){_0x249e39(null,_0x5cc431);})['catch'](function(_0x1023fc){_0x249e39(_0x1023fc);});};AGIVertices['prototype'][_0x406f('0x91')]=function(_0x169e25,_0x38dc34,_0x59f6a2){scripts['googleASR'](_0x38dc34,_0x169e25[_0x406f('0x7b')],_0x169e25[_0x406f('0x92')]||'en-US')[_0x406f('0xf')](function(_0x5e80f9){_0x59f6a2(null,_0x5e80f9);})['catch'](function(_0x206caa){_0x59f6a2(_0x206caa);});};AGIVertices['prototype'][_0x406f('0x93')]=function(_0x1be2dd,_0x35d17d,_0x708018){scripts[_0x406f('0x93')](_0x35d17d,_0x1be2dd[_0x406f('0x94')],_0x1be2dd[_0x406f('0x95')],_0x1be2dd[_0x406f('0x71')])[_0x406f('0xf')](function(_0x5acfca){_0x708018(null,_0x5acfca);})[_0x406f('0x11')](function(_0x133504){_0x708018(_0x133504);});};AGIVertices[_0x406f('0x12')][_0x406f('0x96')]=function(_0x43fa25){var _0x12f400=_[_0x406f('0x65')](verticesWithRetry,_0x43fa25[_0x406f('0x39')])?_0x43fa25:_[_0x406f('0x97')](_0x43fa25);for(var _0x2055c3 in _0x12f400){if(_0x12f400['hasOwnProperty'](_0x2055c3)){if(_0x12f400[_0x2055c3]&&_['isString'](_0x12f400[_0x2055c3])){if(_[_0x406f('0x65')](recursiveMapAttributes,_0x2055c3)){_0x12f400[_0x2055c3]=this[_0x406f('0x98')](_0x12f400[_0x2055c3]);}else{_0x12f400[_0x2055c3]=this[_0x406f('0x99')](_0x12f400[_0x2055c3]);}}}}return _0x12f400;};AGIVertices[_0x406f('0x12')][_0x406f('0x9a')]=function(_0x22d24d){for(var _0x1d5c2f in _0x22d24d){if(_0x22d24d['hasOwnProperty'](_0x1d5c2f)){if(_['isPlainObject'](_0x22d24d[_0x1d5c2f])){this['recursiveNodeIndex'](_0x22d24d[_0x1d5c2f]);}else if(_[_0x406f('0x9b')](_0x22d24d[_0x1d5c2f])){for(var _0x42c11e=0x0;_0x42c11e<_0x22d24d[_0x1d5c2f][_0x406f('0x9c')];_0x42c11e++){this[_0x406f('0x9a')](_0x22d24d[_0x1d5c2f][_0x42c11e]);}}else if(_[_0x406f('0x9d')](_0x22d24d[_0x1d5c2f])){_0x22d24d[_0x1d5c2f]=this[_0x406f('0x99')](_0x22d24d[_0x1d5c2f]);}}}};AGIVertices[_0x406f('0x12')][_0x406f('0x9e')]=function(_0x207413,_0x2a772d){for(var _0x698c04 in _0x207413){if(_0x207413[_0x406f('0x9f')](_0x698c04)){if(_['isPlainObject'](_0x207413[_0x698c04])){if(!_[_0x406f('0x43')](_0x207413[_0x698c04])){this['saveRestApiResult'](_0x207413[_0x698c04],util[_0x406f('0x26')]('%s.%s',_0x2a772d,_0x698c04));}}else if(_[_0x406f('0x9b')](_0x207413[_0x698c04])){for(var _0x45d0a8=0x0;_0x45d0a8<_0x207413[_0x698c04][_0x406f('0x9c')];_0x45d0a8++){this[_0x406f('0x9e')](_0x207413[_0x698c04][_0x45d0a8],util[_0x406f('0x26')](_0x406f('0xa0'),_0x2a772d,_0x698c04+'['+_0x45d0a8+']'));}}else{if(!_[_0x406f('0x47')](_0x207413[_0x698c04])){this['channel'][_0x406f('0xa1')](util[_0x406f('0x26')]('%s.%s',_0x2a772d,_0x698c04),_0x207413[_0x698c04]);}}}}};AGIVertices[_0x406f('0x12')][_0x406f('0x98')]=function(_0x3312bf){try{var _0x28c144=JSON['parse'](_0x3312bf);this[_0x406f('0x9a')](_0x28c144);return JSON[_0x406f('0x73')](_0x28c144);}catch(_0x3c0747){return this['replaceAllVariables'](_0x3312bf);}};AGIVertices[_0x406f('0x12')][_0x406f('0x99')]=function(_0x3c7062){var _0x145a41=_0x3c7062[_0x406f('0xa2')]('{');for(var _0x414614=0x1;_0x414614<_0x145a41[_0x406f('0x9c')];_0x414614+=0x1){var _0xc958c9=_0x145a41[_0x414614]['split']('}');if(_0xc958c9['length']>0x1){_0x3c7062=_0x3c7062[_0x406f('0xa3')]('{'+_0xc958c9[0x0]+'}',this[_0x406f('0x36')][_0x406f('0xd')](_0xc958c9[0x0])[_0x406f('0xa4')]||_0xc958c9[0x0]);}}if(_0x145a41['length']===0x1){return _0x3c7062[_0x406f('0x4b')]();}return this[_0x406f('0x99')](_0x3c7062);};AGIVertices[_0x406f('0x12')][_0x406f('0xa5')]=function(_0x320910,_0x198e04){var _0x18a154=this[_0x406f('0x36')][_0x406f('0xd')](_0x320910);if(_0x18a154['result']===-0x1){return _0x18a154;}logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xa6'),_0x198e04,_0x18a154[_0x406f('0xa4')]));return this[_0x406f('0x36')][_0x406f('0xa1')](_0x198e04,_0x18a154[_0x406f('0xa4')]);};AGIVertices[_0x406f('0x12')][_0x406f('0x86')]=function(_0x5bc700){return _0x5bc700&&_0x5bc700!=='0'&&_0x5bc700!=='-1'&&_0x5bc700!=='';};AGIVertices[_0x406f('0x12')]['maxRetry']=function(_0x302696){this[_0x406f('0x35')][_0x406f('0x70')](this,_0x302696,'-');_0x302696[_0x406f('0xa7')]=_0x302696[_0x406f('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x406f('0x12')]['mrcpsynth']=function(_0x6c05ee){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x6c05ee[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x6c05ee[_0x406f('0x5c')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}var _0x460797='\x22'+_0x6c05ee[_0x406f('0x5c')]+'\x22';if(this[_0x406f('0x86')](_0x6c05ee[_0x406f('0x79')])){_0x460797+=','+_0x6c05ee[_0x406f('0x79')];}var _0xdf7793=this[_0x406f('0x36')]['exec']('MRCPSynth',_0x460797);if(_0xdf7793[_0x406f('0xab')]===-0x1){return _0xdf7793;}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xac'),_0x460797));};AGIVertices['prototype'][_0x406f('0xad')]=function(_0x2fa198){logger['info'](util[_0x406f('0x26')](_0x406f('0xae'),_0x2fa198[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x2fa198[_0x406f('0xaf')])){return this[_0x406f('0x36')]['noop'](_0x406f('0xb0'));}var _0x29b39e=_0x2fa198['grammar'];if(this[_0x406f('0x86')](_0x2fa198[_0x406f('0x79')])){_0x29b39e+=','+_0x2fa198[_0x406f('0x79')];}var _0x3aaa13=this[_0x406f('0x36')]['exec'](_0x406f('0xb1'),_0x29b39e);if(_0x3aaa13[_0x406f('0xab')]===-0x1){return _0x3aaa13;}var _0x3ca82b=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x406f('0xb2'));if(_0x3ca82b[_0x406f('0xab')]===-0x1){return _0x3ca82b;}var _0x146e51=this[_0x406f('0xa5')](_0x406f('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x146e51['result']===-0x1){return _0x146e51;}var _0x4bc335=this['getAndSetVariable'](_0x406f('0xb4'),'MRCP_RECOG_INSTANCE');if(_0x4bc335[_0x406f('0xab')]===-0x1){return _0x4bc335;}return this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0xb5'),_0x29b39e));};AGIVertices[_0x406f('0x12')][_0x406f('0x5')]=function(_0x5c9a82){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xb6'),_0x5c9a82['label']));return this[_0x406f('0x36')]['agi']([_0x5c9a82[_0x406f('0xb7')],_0x5c9a82['args']]);};AGIVertices[_0x406f('0x12')][_0x406f('0xb8')]=function(_0x2e4a43){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xb9'),_0x2e4a43[_0x406f('0x38')]));if(this[_0x406f('0x86')](_0x2e4a43[_0x406f('0x64')])){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xba'),_0x2e4a43[_0x406f('0x64')]));var _0x147817=this[_0x406f('0x36')]['wait'](_0x2e4a43['timeout']);if(_0x147817[_0x406f('0xab')]===-0x1){return _0x147817;}}return this[_0x406f('0x36')][_0x406f('0xb8')]();};AGIVertices[_0x406f('0x12')]['callback']=function(_0x8d5961){logger[_0x406f('0x2b')](util['format'](_0x406f('0xbb'),_0x8d5961[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x8d5961[_0x406f('0xbc')])){return this['channel'][_0x406f('0x2a')](_0x8d5961,_0x406f('0xbd'));}_0x8d5961['scheduledAt']=moment();if(this['isConfigured'](_0x8d5961[_0x406f('0xbe')])){_0x8d5961[_0x406f('0x48')]=moment()[_0x406f('0xbf')](_0x8d5961[_0x406f('0xbe')],_0x406f('0xc0'));}if(!this[_0x406f('0x86')](_0x8d5961[_0x406f('0x4c')])){_0x8d5961['callback_priority']=0x2;}this[_0x406f('0x42')]['sync'](this,_0x8d5961);return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xc1'),_0x8d5961[_0x406f('0xc2')],_0x8d5961[_0x406f('0xbc')],_0x8d5961[_0x406f('0x48')]));};AGIVertices[_0x406f('0x12')][_0x406f('0xc3')]=function(_0x41feb2){logger[_0x406f('0x2b')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x41feb2[_0x406f('0x38')]));var _0x2e0169=this[_0x406f('0x36')]['exec'](_0x41feb2[_0x406f('0xc4')],_0x41feb2['options']);if(_0x2e0169[_0x406f('0xab')]===-0x1){return _0x2e0169;}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xc5'),_0x41feb2['application'],_0x41feb2['options']));};AGIVertices[_0x406f('0x12')][_0x406f('0xc6')]=function(_0x17aa1f){logger['info'](util[_0x406f('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x17aa1f[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x17aa1f['text'])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}var _0x5b2ccd='\x22'+_0x17aa1f[_0x406f('0x5c')]+'\x22';if(this['isConfigured'](_0x17aa1f['options'])){_0x5b2ccd+=','+_0x17aa1f[_0x406f('0x79')];}var _0x3eabdd=this[_0x406f('0x36')][_0x406f('0x58')](_0x406f('0xc7'),_0x5b2ccd);if(_0x3eabdd['result']===-0x1){return _0x3eabdd;}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xac'),_0x5b2ccd));};AGIVertices[_0x406f('0x12')][_0x406f('0xc8')]=function(_0x370ed2){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xc9'),_0x370ed2[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x370ed2[_0x406f('0x5c')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}var _0x372616='\x22'+_0x370ed2['text']+'\x22';if(this[_0x406f('0x86')](_0x370ed2[_0x406f('0x79')])){_0x372616+=','+_0x370ed2[_0x406f('0x79')];}var _0x3b6d0e=this[_0x406f('0x36')][_0x406f('0x58')](_0x406f('0xc7'),_0x372616);if(_0x3b6d0e[_0x406f('0xab')]===-0x1){return _0x3b6d0e;}return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x372616));};AGIVertices[_0x406f('0x12')]['lumenvoxasr']=function(_0x37e25e){logger['info'](util['format'](_0x406f('0xca'),_0x37e25e[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x37e25e['grammar'])){return this[_0x406f('0x36')][_0x406f('0xa9')]('no\x20grammar\x20configured');}var _0x1470cb=_0x37e25e[_0x406f('0xaf')];if(this['isConfigured'](_0x37e25e[_0x406f('0x79')])){_0x1470cb+=','+_0x37e25e[_0x406f('0x79')];}var _0x10a8d9=this[_0x406f('0x36')]['exec']('MRCPRecog',_0x1470cb);if(_0x10a8d9['result']===-0x1){return _0x10a8d9;}var _0x15554d=this['getAndSetVariable'](_0x406f('0xcb'),_0x406f('0xcc'));if(_0x15554d['result']===-0x1){return _0x15554d;}var _0x4e5e6e=this['getAndSetVariable'](_0x406f('0xb3'),_0x406f('0xcd'));if(_0x4e5e6e[_0x406f('0xab')]===-0x1){return _0x4e5e6e;}var _0x4b6e1b=this[_0x406f('0xa5')](_0x406f('0xb4'),_0x406f('0xce'));if(_0x4b6e1b[_0x406f('0xab')]===-0x1){return _0x4b6e1b;}return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xb5'),_0x1470cb));};AGIVertices[_0x406f('0x12')][_0x406f('0xcf')]=function(_0xc5de5e){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xc5de5e[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0xc5de5e[_0x406f('0xaf')])){return this[_0x406f('0x36')][_0x406f('0xa9')]('no\x20grammar\x20configured');}var _0x2d04fc=_0xc5de5e[_0x406f('0xaf')];if(this[_0x406f('0x86')](_0xc5de5e['options'])){_0x2d04fc+=','+_0xc5de5e[_0x406f('0x79')];}var _0x44c61e=this['channel'][_0x406f('0x58')](_0x406f('0xb1'),_0x2d04fc);if(_0x44c61e[_0x406f('0xab')]===-0x1){return _0x44c61e;}var _0x385821=this[_0x406f('0xa5')](_0x406f('0xcb'),_0x406f('0xd0'));if(_0x385821['result']===-0x1){return _0x385821;}var _0x2c6bea=this[_0x406f('0xa5')]('RECOG_INPUT()',_0x406f('0xd1'));if(_0x2c6bea[_0x406f('0xab')]===-0x1){return _0x2c6bea;}var _0x4dcbff=this[_0x406f('0xa5')](_0x406f('0xb4'),_0x406f('0xd2'));if(_0x4dcbff[_0x406f('0xab')]===-0x1){return _0x4dcbff;}return this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0xb5'),_0x2d04fc));};AGIVertices[_0x406f('0x12')][_0x406f('0xd3')]=function(_0x1666dd){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xd4'),_0x1666dd['label']));if(!this[_0x406f('0x86')](_0x1666dd[_0x406f('0xd5')])){return this[_0x406f('0x36')]['error'](_0x1666dd,'no\x20database\x20selected');}var _0x5e91f5=this[_0x406f('0x16')][_0x406f('0x70')](this,_0x1666dd[_0x406f('0xd5')]);if(!_0x5e91f5){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x1666dd,'no\x20odbc\x20database\x20found');}if(!this[_0x406f('0x86')](_0x1666dd[_0x406f('0x2d')])){return this['channel']['error'](_0x1666dd,_0x406f('0xd6'));}var _0x3bc583=_0x1666dd[_0x406f('0x2d')][_0x406f('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0xd8'),_0x3bc583));var _0x54fa56=this['getQueryOdbc']['sync'](this,_0x5e91f5,_0x3bc583);this['createSquareDetailsReport'][_0x406f('0x70')](this,_0x1666dd,_0x3bc583);if(!this['isConfigured'](_0x1666dd[_0x406f('0xd9')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xda'));}var _0x3bb5d8=this[_0x406f('0xd')][_0x406f('0x70')](this,_0x1666dd[_0x406f('0xd9')]);if(!_0x3bb5d8){return this[_0x406f('0x36')]['error'](_0x1666dd,_0x406f('0xdb'));}var _0x25cc38=this;_0x54fa56[_0x406f('0xdc')](function(_0xb580d4,_0x3a5bbf){Object['keys'](_0xb580d4)['forEach'](function(_0x4d391d){_0x25cc38[_0x406f('0x36')][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0xdd'),_0x3bb5d8,_0x3a5bbf,_0x4d391d),_0xb580d4[_0x4d391d]);});});this['channel'][_0x406f('0xa1')](util[_0x406f('0x26')]('%s_ROWS_COUNT',_0x3bb5d8),_0x54fa56[_0x406f('0x9c')]);return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xde'),_0x3bb5d8));};AGIVertices[_0x406f('0x12')]['dial']=function(_0x13f100){logger['debug'](util[_0x406f('0x26')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x13f100[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x13f100[_0x406f('0xdf')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x13f100,'no\x20user\x20selected');}var _0x1eea2b=this[_0x406f('0x18')]['sync'](this,_0x13f100['sip_id']);if(!_0x1eea2b){return this[_0x406f('0x36')]['error'](_0x13f100,_0x406f('0xe0'));}var _0x3dc244=this[_0x406f('0x36')]['exec']('DIAL',[util['format'](_0x406f('0xe1'),_0x1eea2b),_0x13f100['timeout'],_0x13f100[_0x406f('0xe2')],_0x13f100[_0x406f('0x63')]]);if(_0x3dc244[_0x406f('0xab')]===-0x1){return _0x3dc244;}return this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0xe3'),_0x406f('0xe4')));};AGIVertices[_0x406f('0x12')][_0x406f('0xe5')]=function(_0xb0f097){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xe6'),_0xb0f097['label']));if(!this[_0x406f('0x86')](_0xb0f097[_0x406f('0x7b')])){return this['channel'][_0x406f('0xa9')](_0x406f('0xe7'));}if(!this['isConfigured'](_0xb0f097[_0x406f('0x5c')])){return this[_0x406f('0x36')]['noop'](_0x406f('0xaa'));}this[_0x406f('0x36')]['bot']=!![];this[_0x406f('0x35')](_0xb0f097);this['createSquareMessage'](_0xb0f097[_0x406f('0x5c')],'in','','');this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('Trying\x20Dialogflow:\x20%s',_0xb0f097[_0x406f('0x5c')]));var _0x27e5f3=this[_0x406f('0x7a')][_0x406f('0x70')](this,_0xb0f097);if(_0x27e5f3){for(var _0x3d66f6 in _0x27e5f3){if(_0x27e5f3[_0x406f('0x9f')](_0x3d66f6)){this[_0x406f('0x36')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x3d66f6[_0x406f('0x69')]()),_0x27e5f3[_0x3d66f6]);}}this[_0x406f('0x41')](_0x27e5f3[_0x406f('0xe8')],_0x406f('0xe9'),_0x406f('0xe5'),'');return this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0xea'),_0x27e5f3[_0x406f('0xe8')]));}return this[_0x406f('0x36')][_0x406f('0x2a')](_0xb0f097,_0x406f('0xeb'));};AGIVertices['prototype'][_0x406f('0xec')]=function(_0x974b40){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0xed'),_0x974b40[_0x406f('0x38')]));if(!this['isConfigured'](_0x974b40[_0x406f('0x7e')])){return this['channel']['noop'](_0x406f('0xee'));}if(!this[_0x406f('0x86')](_0x974b40[_0x406f('0x7f')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xef'));}if(!this['isConfigured'](_0x974b40[_0x406f('0xf0')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x406f('0x86')](_0x974b40['dialogflowV2_language'])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xf1'));}if(!this['isConfigured'](_0x974b40[_0x406f('0x5c')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}this['channel'][_0x406f('0xf2')]=!![];this[_0x406f('0x35')](_0x974b40);this[_0x406f('0x41')](_0x974b40[_0x406f('0x5c')],'in','','');this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0xf3'),_0x974b40['text']));var _0x32dae4=this[_0x406f('0x7d')][_0x406f('0x70')](this,_0x974b40);if(_0x32dae4){for(var _0x770c44 in _0x32dae4){if(_0x32dae4[_0x406f('0x9f')](_0x770c44)){if(_0x770c44!==_0x406f('0xf4')){this['channel'][_0x406f('0xa1')](util['format'](_0x406f('0xf5'),_0x770c44[_0x406f('0x69')]()),_0x32dae4[_0x770c44]);}}}this[_0x406f('0x41')](_0x32dae4[_0x406f('0xe8')],_0x406f('0xe9'),_0x406f('0xec'),_0x32dae4[_0x406f('0xf4')]);return this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0xf6'),_0x32dae4[_0x406f('0xe8')]));}return this[_0x406f('0x36')]['error'](_0x974b40,_0x406f('0xf7'));};AGIVertices[_0x406f('0x12')][_0x406f('0xf8')]=function(_0x5238a7){logger['info'](util[_0x406f('0x26')](_0x406f('0xf9'),_0x5238a7[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x5238a7[_0x406f('0xfa')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xfb'));}if(!this[_0x406f('0x86')](_0x5238a7[_0x406f('0xfc')])){return this[_0x406f('0x36')]['noop'](_0x406f('0xfd'));}if(!this[_0x406f('0x86')](_0x5238a7[_0x406f('0xfe')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xff'));}if(!this[_0x406f('0x86')](_0x5238a7[_0x406f('0x100')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}this[_0x406f('0x36')][_0x406f('0xf2')]=!![];this[_0x406f('0x35')](_0x5238a7);this[_0x406f('0x41')](_0x5238a7[_0x406f('0x5c')],'in','','');this[_0x406f('0x36')][_0x406f('0xa9')](util['format']('Trying\x20SestekNDA:\x20%s',_0x5238a7[_0x406f('0x5c')]));var _0xee6868=this[_0x406f('0x80')][_0x406f('0x70')](this,_0x5238a7);if(_0xee6868){for(var _0x4961e3 in _0xee6868){if(_0xee6868[_0x406f('0x9f')](_0x4961e3)){this[_0x406f('0x36')][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x101'),_0x4961e3['toUpperCase']()),_0xee6868[_0x4961e3]);}}this[_0x406f('0x41')](_0xee6868[_0x406f('0xe8')],'out','sesteknda','');if(_0xee6868[_0x406f('0x102')]){this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x103'),_0xee6868['audiofile']));var _0x3936b8=this[_0x406f('0x36')][_0x406f('0x104')](_0xee6868[_0x406f('0x102')]);try{fs['unlink'](_0xee6868[_0x406f('0x102')]+_0x406f('0x105'));}catch(_0x4837ab){logger[_0x406f('0x2a')](_0x4837ab);}return _0x3936b8;}else{return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x106'),_0xee6868[_0x406f('0xe8')]));}}return this[_0x406f('0x36')][_0x406f('0x2a')](_0x5238a7,_0x406f('0x107'));};AGIVertices['prototype']['end']=function(_0x11467d){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x108'),_0x11467d[_0x406f('0x38')]));return this[_0x406f('0x36')]['noop'](_0x406f('0x109'));};AGIVertices[_0x406f('0x12')]['ext_dial']=function(_0x2b3899){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x10a'),_0x2b3899['label']));var _0x355c97='';if(_0x2b3899[_0x406f('0x10b')]){if(!this[_0x406f('0x86')](_0x2b3899[_0x406f('0x10b')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x2b3899,_0x406f('0x10c'));}else{var _0x2198fa=parseInt(_0x2b3899[_0x406f('0x10b')],0xa);if(isNaN(_0x2198fa)){_0x355c97=_0x2b3899[_0x406f('0x10b')];}else{_0x355c97=this[_0x406f('0x1a')][_0x406f('0x70')](this,_0x2b3899['trunk_id']);if(!_0x355c97){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x2b3899,_0x406f('0x10d'));}}}}else if(_0x2b3899[_0x406f('0x10e')]){_0x355c97=_0x2b3899[_0x406f('0x10e')];}else{return this[_0x406f('0x36')][_0x406f('0x2a')](_0x2b3899,'no\x20trunk\x20selected');}var _0x781636=this['channel'][_0x406f('0x58')](_0x406f('0xe4'),[util[_0x406f('0x26')](_0x406f('0x10f'),_0x355c97,_0x2b3899[_0x406f('0xc2')]),_0x2b3899['timeout'],_0x2b3899[_0x406f('0xe2')],_0x2b3899[_0x406f('0x63')]]);if(_0x781636[_0x406f('0xab')]===-0x1){return _0x781636;}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('Executed\x20command\x20%s',_0x406f('0xe4')));};AGIVertices['prototype'][_0x406f('0x110')]=function(_0xb1c96c){logger[_0x406f('0x2b')](util['format'](_0x406f('0x111'),_0xb1c96c[_0x406f('0x38')]));return this['channel'][_0x406f('0xa9')](_0x406f('0x110'));};AGIVertices['prototype'][_0x406f('0xa')]=function(_0x164339){logger[_0x406f('0x2b')](util['format'](_0x406f('0x112'),_0x164339[_0x406f('0x38')]));if(_0x164339[_0x406f('0xa7')]===0x0){return this[_0x406f('0xa8')](_0x164339);}_0x164339[_0x406f('0xa7')]-=0x1;if(!this[_0x406f('0x86')](_0x164339['file_id'])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x164339,_0x406f('0x113'));}var _0x2fdc27=this[_0x406f('0x114')][_0x406f('0x70')](this,_0x164339[_0x406f('0x115')]);if(!_0x2fdc27){return this['channel'][_0x406f('0x2a')](_0x164339,_0x406f('0x116'));}if(!this[_0x406f('0x86')](_0x164339['variable_id'])){return this['channel'][_0x406f('0x2a')](_0x406f('0xda'));}var _0x1cd7c9=this[_0x406f('0x36')]['getData'](_0x2fdc27,_0x164339[_0x406f('0x117')],_0x164339['maxdigit']);var _0xfd5120=_0x1cd7c9[_0x406f('0xab')]?_0x1cd7c9[_0x406f('0xab')]['toString']():'';logger[_0x406f('0x2b')]('test',JSON[_0x406f('0x73')](_0x1cd7c9));if(_0x1cd7c9['result']===-0x1){this[_0x406f('0x35')][_0x406f('0x70')](this,_0x164339,_0xfd5120);return _0x1cd7c9;}else if(_0x1cd7c9[_0x406f('0xa4')]==='timeout'){_0x1cd7c9['result']=_0xfd5120[_0x406f('0x9c')]>=parseInt(_0x164339[_0x406f('0x118')])?'x':'i';}else{_0x1cd7c9['result']=_0xfd5120[_0x406f('0x9c')]>=parseInt(_0x164339[_0x406f('0x118')])&&_0xfd5120[_0x406f('0x9c')]<=parseInt(_0x164339[_0x406f('0x119')])?'x':'i';}var _0x325a6d=this['getVariable'][_0x406f('0x70')](this,_0x164339[_0x406f('0xd9')]);if(!_0x325a6d){return this['channel']['error'](_0x164339,_0x406f('0xdb'));}this['channel'][_0x406f('0xa1')](_0x325a6d,_0xfd5120);if(this['isConfigured'](_0x164339[_0x406f('0x11a')])){var _0x2be2e2=parseInt(_0x164339[_0x406f('0x11a')],0xa);var _0x53a724=rs['generate']({'charset':'*','length':_0x2be2e2});var _0x3bd7af=_0xfd5120['length'];if(_0x3bd7af>0x0){if(_0x3bd7af>_0x2be2e2){this[_0x406f('0x35')][_0x406f('0x70')](this,_0x164339,_0x164339[_0x406f('0x11b')]===_0x406f('0x11c')?_0x53a724+_0xfd5120[_0x406f('0x11d')](_0x2be2e2):_0xfd5120[_0x406f('0x11d')](0x0,_0x3bd7af-_0x2be2e2)+_0x53a724);}else{this[_0x406f('0x35')][_0x406f('0x70')](this,_0x164339,rs[_0x406f('0x11e')]({'charset':'*','length':_0x3bd7af}));}}else{this[_0x406f('0x35')]['sync'](this,_0x164339,'');}}else{this[_0x406f('0x35')][_0x406f('0x70')](this,_0x164339,_0xfd5120);}return _0x1cd7c9;};AGIVertices[_0x406f('0x12')]['getsecretdigits']=function(_0x25e8e3){logger['info'](util[_0x406f('0x26')](_0x406f('0x11f'),_0x25e8e3['label']));return this[_0x406f('0xa')](_0x25e8e3);};AGIVertices[_0x406f('0x12')]['goal']=function(_0x4a26c4){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4a26c4[_0x406f('0x38')]));this[_0x406f('0x35')][_0x406f('0x70')](this,_0x4a26c4,_0x4a26c4[_0x406f('0x120')]);return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x121'),_0x4a26c4[_0x406f('0x120')]));};AGIVertices[_0x406f('0x12')][_0x406f('0x122')]=function(_0x57f68){logger['info'](util[_0x406f('0x26')](_0x406f('0x123'),_0x57f68['label']));if(!this['isConfigured'](_0x57f68['aws_access_key_id'])||!this['isConfigured'](_0x57f68[_0x406f('0x89')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0x124'));}if(!this[_0x406f('0x86')](_0x57f68[_0x406f('0x5c')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xaa'));}this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0x125'),_0x57f68[_0x406f('0x5c')]));var _0x268c18=this[_0x406f('0x88')][_0x406f('0x70')](this,_0x57f68);if(_0x268c18){this[_0x406f('0x36')]['noop'](util['format'](_0x406f('0x126'),_0x268c18));var _0x2a6d31=this[_0x406f('0x36')][_0x406f('0x104')](_0x268c18);try{fs[_0x406f('0x127')](_0x268c18+'.wav');}catch(_0x27f246){logger[_0x406f('0x2a')](_0x27f246);}return _0x2a6d31;}return this[_0x406f('0x36')][_0x406f('0x2a')](_0x57f68,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x406f('0x12')]['awslex']=function(_0x4f6170){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4f6170[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x4f6170[_0x406f('0x8f')])||!this[_0x406f('0x86')](_0x4f6170['aws_secret_access_key'])){return this[_0x406f('0x36')]['noop'](_0x406f('0x124'));}if(!this[_0x406f('0x86')](_0x4f6170[_0x406f('0x128')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0x129'));}if(!this[_0x406f('0x86')](_0x4f6170[_0x406f('0x5c')])){return this[_0x406f('0x36')]['noop']('no\x20text\x20configured');}this[_0x406f('0x36')][_0x406f('0xf2')]=!![];this[_0x406f('0x35')](_0x4f6170);this['createSquareMessage'](_0x4f6170[_0x406f('0x5c')],'in','','');this['channel'][_0x406f('0xa9')](util['format'](_0x406f('0x12a'),_0x4f6170[_0x406f('0x5c')]));var _0x5dbe34=this['awsLex']['sync'](this,_0x4f6170);if(_0x5dbe34){for(var _0x6b3c70 in _0x5dbe34){if(_0x5dbe34[_0x406f('0x9f')](_0x6b3c70)&&_[_0x406f('0x9d')](_0x5dbe34[_0x6b3c70])){this[_0x406f('0x36')][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x12b'),_0x6b3c70[_0x406f('0x69')]()),_0x5dbe34[_0x6b3c70]);}}if(_[_0x406f('0x47')](_0x5dbe34[_0x406f('0x77')])){return this[_0x406f('0x36')]['noop'](_0x406f('0x12c'));}else{this[_0x406f('0x41')](_0x5dbe34[_0x406f('0x77')],_0x406f('0xe9'),_0x406f('0x12d'),'');return this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')]('Amazon\x20Lex\x20Result\x20%s',_0x5dbe34['message']));}}return this['channel']['error'](_0x4f6170,_0x406f('0x12e'));};AGIVertices[_0x406f('0x12')][_0x406f('0x12f')]=function(_0x214518){logger['info'](util[_0x406f('0x26')](_0x406f('0x130'),_0x214518[_0x406f('0x38')],_0x214518[_0x406f('0x64')]));if(!this[_0x406f('0x86')](_0x214518[_0x406f('0x7b')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xe7'));}var _0x11362b='wav';var _0x17da58=util['format'](_0x406f('0x131'),FILES_PATH,rs[_0x406f('0x11e')](0x4));var _0x2999ac=util[_0x406f('0x26')](_0x406f('0xa0'),_0x17da58,_0x11362b);var _0x5582fb=!![];if(_0x214518[_0x406f('0x132')]===_0x406f('0x133')){_0x5582fb=![];}var _0x425927=this[_0x406f('0x36')][_0x406f('0x134')](_0x17da58,_0x11362b,_0x214518['intKey'],_0x214518[_0x406f('0x64')],undefined,_0x5582fb);if(_0x425927[_0x406f('0xab')]!==-0x1){this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x135'),_0x2999ac));var _0x353124=this[_0x406f('0x91')][_0x406f('0x70')](this,_0x214518,_0x2999ac);if(_0x353124){for(var _0x362105 in _0x353124){if(_0x353124[_0x406f('0x9f')](_0x362105)){this[_0x406f('0x36')][_0x406f('0xa1')](util['format'](_0x406f('0x136'),_0x362105[_0x406f('0x69')]()),_0x353124[_0x362105]);}}return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x137'),JSON[_0x406f('0x73')](_0x353124)));}}return _0x425927;};AGIVertices[_0x406f('0x12')]['tildeasr']=function(_0x502255){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x138'),_0x502255[_0x406f('0x38')]));if(!this['isConfigured'](_0x502255['appid'])){return this[_0x406f('0x36')]['noop'](_0x406f('0x139'));}if(!this[_0x406f('0x86')](_0x502255[_0x406f('0x95')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0x13a'));}var _0x3174bb=_0x406f('0x13b');var _0x4e1234=util[_0x406f('0x26')](_0x406f('0x131'),FILES_PATH,rs[_0x406f('0x11e')](0x4));var _0x592947=util['format'](_0x406f('0xa0'),_0x4e1234,_0x3174bb);var _0x548768=!![];if(_0x502255[_0x406f('0x132')]===_0x406f('0x133')){_0x548768=![];}var _0x44aae7=this[_0x406f('0x36')][_0x406f('0x134')](_0x4e1234,_0x3174bb,_0x502255[_0x406f('0x13c')],_0x502255[_0x406f('0x64')],undefined,_0x548768);if(_0x44aae7[_0x406f('0xab')]!==-0x1){this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x13d'),_0x592947));var _0x48e4e5=this[_0x406f('0x93')][_0x406f('0x70')](this,_0x502255,_0x592947);if(_0x48e4e5){for(var _0x2dd858 in _0x48e4e5){if(_0x48e4e5['hasOwnProperty'](_0x2dd858)){this[_0x406f('0x36')][_0x406f('0xa1')](util['format'](_0x406f('0x13e'),_0x2dd858[_0x406f('0x69')]()),_0x48e4e5[_0x2dd858]);}}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x13f'),JSON[_0x406f('0x73')](_0x48e4e5)));}}return _0x44aae7;};AGIVertices[_0x406f('0x12')]['gotoc']=function(_0x24eff1){logger['info'](util[_0x406f('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x24eff1[_0x406f('0x38')]));return this[_0x406f('0x36')]['continueAt'](_0x24eff1[_0x406f('0x3d')],_0x24eff1[_0x406f('0x140')],_0x24eff1['priority']);};AGIVertices[_0x406f('0x12')][_0x406f('0x141')]=function(_0x362142){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x142'),_0x362142['label']));if(!this[_0x406f('0x86')](_0x362142['condition'])){return this['channel'][_0x406f('0x2a')](_0x362142,_0x406f('0x143'));}try{var _0x7709bc=eval(_0x362142[_0x406f('0x144')])?_0x406f('0x145'):'false';this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x146'),_0x362142['condition'],_0x7709bc));return{'code':0xc8,'result':_0x7709bc};}catch(_0x494d52){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x406f('0x12')][_0x406f('0x147')]=function(_0x356f47){logger['info'](util[_0x406f('0x26')](_0x406f('0x148'),_0x356f47[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x356f47[_0x406f('0x149')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x356f47,_0x406f('0x14a'));}var _0x2393fd=this['getIntervals'][_0x406f('0x70')](this,_0x356f47[_0x406f('0x149')]);if(!_0x2393fd){return this[_0x406f('0x36')]['error'](_0x356f47,_0x406f('0x14b'));}for(var _0x4db19f=0x0;_0x4db19f<_0x2393fd[_0x406f('0x9c')];_0x4db19f+=0x1){var _0x528b93=this[_0x406f('0x36')][_0x406f('0xd')](util[_0x406f('0x26')]('IFTIME(%s?true:false)',_0x2393fd[_0x4db19f]));if(_0x528b93[_0x406f('0xab')]===-0x1){return _0x528b93;}logger['info'](util[_0x406f('0x26')](_0x406f('0x14c'),_0x2393fd[_0x4db19f],_0x528b93[_0x406f('0xa4')]));if(_0x528b93[_0x406f('0xa4')]===_0x406f('0x145')){logger[_0x406f('0x2b')](util['format'](_0x406f('0x14c'),_0x2393fd[_0x4db19f],'true'));this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x14c'),_0x2393fd[_0x4db19f],_0x406f('0x145')));return{'code':0xc8,'result':_0x406f('0x145')};}else{logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x14c'),_0x2393fd[_0x4db19f],_0x406f('0x14d')));this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x14c'),_0x2393fd[_0x4db19f],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x406f('0x14e')]=function(_0x50db2f){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x14f'),_0x50db2f[_0x406f('0x38')]));return this[_0x406f('0x36')]['hangup']();};AGIVertices[_0x406f('0x12')][_0x406f('0x150')]=function(_0x5cb44f){logger['info'](util[_0x406f('0x26')](_0x406f('0x151'),_0x5cb44f[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x5cb44f[_0x406f('0x7b')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xe7'));}var _0x251156='wav';var _0x2da145=util[_0x406f('0x26')](_0x406f('0x131'),FILES_PATH,rs[_0x406f('0x11e')](0x4));var _0x107765=util[_0x406f('0x26')](_0x406f('0xa0'),_0x2da145,_0x251156);var _0x3ec33c=!![];if(_0x5cb44f[_0x406f('0x132')]===_0x406f('0x133')){_0x3ec33c=![];}var _0x1e902a=this[_0x406f('0x36')][_0x406f('0x134')](_0x2da145,_0x251156,_0x5cb44f[_0x406f('0x13c')],_0x5cb44f[_0x406f('0x64')],undefined,_0x3ec33c);if(_0x1e902a[_0x406f('0xab')]!==-0x1){this['channel']['noop'](util[_0x406f('0x26')](_0x406f('0x152'),_0x107765));var _0x56b72d=this[_0x406f('0x84')][_0x406f('0x70')](this,_0x5cb44f,_0x107765);if(_0x56b72d){for(var _0x55864c in _0x56b72d){if(_0x56b72d[_0x406f('0x9f')](_0x55864c)){this['channel'][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x153'),_0x55864c['toUpperCase']()),_0x56b72d[_0x55864c]);}}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x154'),JSON['stringify'](_0x56b72d)));}}return _0x1e902a;};AGIVertices[_0x406f('0x12')][_0x406f('0x155')]=function(_0xd99da2){logger[_0x406f('0x2b')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xd99da2['label']));if(!this[_0x406f('0x86')](_0xd99da2[_0x406f('0x7b')])){return this[_0x406f('0x36')][_0x406f('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0xd99da2['text'])){return this[_0x406f('0x36')]['noop']('no\x20text\x20configured');}this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0xd99da2['text']));var _0x1096c9=this[_0x406f('0x81')]['sync'](this,_0xd99da2);if(_0x1096c9){this[_0x406f('0x36')][_0x406f('0xa9')](util['format']('ispeech\x20%s\x20file\x20created',_0x1096c9));var _0x1f2d2f=this[_0x406f('0x36')][_0x406f('0x104')](_0x1096c9,_0xd99da2[_0x406f('0x13c')]);try{fs[_0x406f('0x127')](_0x1096c9+_0x406f('0x105'));}catch(_0x166ca9){logger[_0x406f('0x2a')](_0x166ca9);}return _0x1f2d2f;}return this[_0x406f('0x36')][_0x406f('0x2a')](_0xd99da2,_0x406f('0x156'));};AGIVertices[_0x406f('0x12')][_0x406f('0x157')]=function(_0x1a1d63){logger['info'](util[_0x406f('0x26')](_0x406f('0x158'),_0x1a1d63[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x1a1d63[_0x406f('0x159')])){return this['channel'][_0x406f('0x2a')](_0x1a1d63,'no\x20find\x20by\x20configured');}logger[_0x406f('0x2b')](util['format'](_0x406f('0x15a'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x1a1d63[_0x406f('0x159')]));var _0x5e72bf=this[_0x406f('0x56')][_0x406f('0x70')](this,_0x1a1d63[_0x406f('0x159')]);if(_0x5e72bf){logger['info'](util['format'](_0x406f('0x15b'),this[_0x406f('0x36')]['callerid'],_0x1a1d63[_0x406f('0x159')]));this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0x15b'),this['channel'][_0x406f('0x3a')],_0x1a1d63['findBy']));return{'code':0xc8,'result':_0x406f('0x15c')};}else{logger[_0x406f('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x406f('0x36')][_0x406f('0x3a')],_0x1a1d63[_0x406f('0x159')]));this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x15d'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x1a1d63[_0x406f('0x159')]));return{'code':0xc8,'result':_0x406f('0x15e')};}};AGIVertices['prototype'][_0x406f('0x15f')]=function(_0xdcfb4a){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x160'),_0xdcfb4a['label']));if(!this[_0x406f('0x86')](_0xdcfb4a[_0x406f('0x159')])){return this[_0x406f('0x36')]['error'](_0xdcfb4a,_0x406f('0x161'));}logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x15a'),this[_0x406f('0x36')][_0x406f('0x3a')],_0xdcfb4a['findBy']));var _0x38ca6c=this[_0x406f('0x52')][_0x406f('0x70')](this,_0xdcfb4a[_0x406f('0x159')]);if(_0x38ca6c){logger['info'](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0xdcfb4a[_0x406f('0x159')]));this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0xdcfb4a[_0x406f('0x159')]));return{'code':0xc8,'result':_0x406f('0x15c')};}else{logger[_0x406f('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0xdcfb4a[_0x406f('0x159')]));this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x15d'),this[_0x406f('0x36')][_0x406f('0x3a')],_0xdcfb4a['findBy']));return{'code':0xc8,'result':_0x406f('0x15e')};}};AGIVertices[_0x406f('0x12')][_0x406f('0x162')]=function(_0x163a35){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x163'),_0x163a35[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x163a35[_0x406f('0x164')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x163a35,'no\x20operation\x20configured');}this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x165'),_0x163a35[_0x406f('0x164')]));var _0x16faf7=eval(_0x163a35[_0x406f('0x164')]);if(!this['isConfigured'](_0x163a35[_0x406f('0xd9')])){return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xda'));}var _0x5c9b64=this['getVariable'][_0x406f('0x70')](this,_0x163a35[_0x406f('0xd9')]);if(!_0x5c9b64){return this[_0x406f('0x36')]['error'](_0x163a35,_0x406f('0xdb'));}if(_['isArray'](_0x16faf7)){var _0x5e35f9=this;_0x16faf7['forEach'](function(_0x1e12ef,_0x4b7b2a){_0x5e35f9[_0x406f('0x36')][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x166'),_0x5c9b64,_0x4b7b2a),_0x1e12ef);});return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('variable\x20%s[key]\x20set',_0x5c9b64));}else{return this[_0x406f('0x36')]['setVariable'](_0x5c9b64,_0x16faf7);}};AGIVertices['prototype'][_0x406f('0x167')]=function(_0x1eabdd){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x168'),_0x1eabdd[_0x406f('0x38')]));if(_0x1eabdd['retry']===0x0){return this[_0x406f('0xa8')](_0x1eabdd);}_0x1eabdd['retry']-=0x1;if(!this[_0x406f('0x86')](_0x1eabdd[_0x406f('0x115')])){return this[_0x406f('0x36')]['error'](_0x1eabdd,'no\x20file\x20audio\x20selected');}var _0xca4a9=this[_0x406f('0x114')]['sync'](this,_0x1eabdd[_0x406f('0x115')]);if(!_0xca4a9){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x1eabdd,_0x406f('0x116'));}var _0x230249=this[_0x406f('0x36')][_0x406f('0x169')](_0xca4a9,_0x1eabdd[_0x406f('0x117')],_0x1eabdd[_0x406f('0x16a')]);var _0x5ac6ff=_0x230249[_0x406f('0xab')];if(_0x230249[_0x406f('0xab')]===-0x1){this[_0x406f('0x35')][_0x406f('0x70')](this,_0x1eabdd,'-1');return _0x230249;}else if(_0x230249['extra']===_0x406f('0x64')){_0x230249['result']=_0x230249[_0x406f('0xab')]['length']>0x0?_0x230249[_0x406f('0xab')]:'t';}else if(_['isEmpty'](_0x230249[_0x406f('0xab')])){_0x230249['result']='#';_0x5ac6ff='#';}if(!this[_0x406f('0x86')](_0x1eabdd[_0x406f('0xd9')])){this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0xda'));}else{var _0x4312f6=this[_0x406f('0xd')]['sync'](this,_0x1eabdd[_0x406f('0xd9')]);if(!_0x4312f6){return this['channel'][_0x406f('0x2a')](_0x1eabdd,'no\x20variable\x20found');}this['channel'][_0x406f('0xa1')](_0x4312f6,_0x5ac6ff);}this['createSquareDetailsReport'][_0x406f('0x70')](this,_0x1eabdd,_0x5ac6ff);return _0x230249;};AGIVertices[_0x406f('0x12')]['noop']=function(_0x31b438){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x31b438[_0x406f('0x38')]));return this[_0x406f('0x36')][_0x406f('0xa9')](_0x31b438[_0x406f('0x16b')]||_0x31b438[_0x406f('0x38')]);};AGIVertices['prototype'][_0x406f('0x16c')]=function(_0x342e20){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x16d'),_0x342e20[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x342e20[_0x406f('0x159')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x342e20,_0x406f('0x161'));}logger[_0x406f('0x2b')](util['format'](_0x406f('0x15a'),this[_0x406f('0x36')]['callerid'],_0x342e20[_0x406f('0x159')]));var _0x4a2288=this[_0x406f('0x4d')][_0x406f('0x70')](this,_0x342e20[_0x406f('0x16e')]);var _0x302580=this[_0x406f('0x4f')][_0x406f('0x70')](this,_0x342e20[_0x406f('0x159')],_0x4a2288);if(_0x302580){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x15b'),this['channel'][_0x406f('0x3a')],_0x342e20[_0x406f('0x159')]));this[_0x406f('0x36')]['noop'](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x342e20['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x15d'),this[_0x406f('0x36')]['callerid'],_0x342e20[_0x406f('0x159')]));this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x342e20[_0x406f('0x159')]));return{'code':0xc8,'result':_0x406f('0x15e')};}};AGIVertices[_0x406f('0x12')][_0x406f('0x16f')]=function(_0x4e5774){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x170'),_0x4e5774['label']));if(!this['isConfigured'](_0x4e5774[_0x406f('0x115')])){return this['channel'][_0x406f('0x2a')](_0x4e5774,_0x406f('0x113'));}var _0x2ecf86=this[_0x406f('0x114')][_0x406f('0x70')](this,_0x4e5774['file_id']);if(!_0x2ecf86){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x4e5774,_0x406f('0x116'));}var _0xc89359=this['channel'][_0x406f('0x58')]('PLAYBACK',[_0x2ecf86,_0x4e5774['opts']]);if(_0xc89359[_0x406f('0xab')]===-0x1){return _0xc89359;}return this[_0x406f('0x36')][_0x406f('0xa9')](util['format'](_0x406f('0xc5'),_0x406f('0x171'),_0x2ecf86));};AGIVertices[_0x406f('0x12')][_0x406f('0x172')]=function(_0x17feb6){logger[_0x406f('0x2b')](util[_0x406f('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x17feb6['label']));if(!this[_0x406f('0x86')](_0x17feb6['queue_id'])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x17feb6,_0x406f('0x173'));}var _0x5e6248='';var _0x4d9fc7=parseInt(_0x17feb6[_0x406f('0x174')],0xa);if(isNaN(_0x4d9fc7)){_0x5e6248=_0x17feb6[_0x406f('0x174')];}else{_0x5e6248=this[_0x406f('0x13')][_0x406f('0x70')](this,_0x17feb6[_0x406f('0x174')]);if(!_0x5e6248){return this['channel'][_0x406f('0x2a')](_0x17feb6,_0x406f('0x175'));}}var _0x4bc003='';if(this[_0x406f('0x86')](_0x17feb6['file_id'])){var _0x509181=this['getSound'][_0x406f('0x70')](this,_0x17feb6[_0x406f('0x115')]);if(_0x509181){_0x4bc003=_0x509181;}}this['createSquareDetailsReport'][_0x406f('0x70')](this,_0x17feb6,_0x5e6248);if(_0x17feb6[_0x406f('0xe2')][_0x406f('0x176')]('x')<0x0){_0x17feb6[_0x406f('0xe2')]+='x';}if(_0x17feb6['opts'][_0x406f('0x176')]('X')<0x0){_0x17feb6['opts']+='X';}this['channel']['setVariable'](_0x406f('0x177'),_0x5e6248?_0x5e6248[_0x406f('0x178')]():'');var _0x4f6bb9=this['channel'][_0x406f('0x58')](_0x406f('0x179'),[_0x5e6248,_0x17feb6[_0x406f('0xe2')],_0x17feb6[_0x406f('0x63')],_0x4bc003,_0x17feb6[_0x406f('0x64')],_0x17feb6[_0x406f('0x5')],_0x17feb6['macro'],_0x17feb6['gosub'],'',_0x17feb6[_0x406f('0x17a')]]);if(_0x4f6bb9[_0x406f('0xab')]===-0x1){return _0x4f6bb9;}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xc5'),_0x406f('0x179'),_0x5e6248));};AGIVertices[_0x406f('0x12')][_0x406f('0x17b')]=function(_0x2e7e11){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x17c'),_0x2e7e11['label']));var _0xbbe325=_0x2e7e11[_0x406f('0x17d')]||'wav';var _0x2be3bc=util[_0x406f('0x26')](_0x406f('0x17e'),this[_0x406f('0x36')]['uniqueid'],rs['generate'](0x5));var _0x54470a=util[_0x406f('0x26')](_0x406f('0x17f'),FILES_PATH,_0x2be3bc,_0xbbe325);var _0x2eb010=util[_0x406f('0x26')](_0x406f('0x131'),FILES_PATH,_0x2be3bc);this[_0x406f('0x3b')]['sync'](this,_0x2e7e11,_0x2be3bc,_0x54470a);this[_0x406f('0x36')][_0x406f('0xa1')](_0x406f('0x180'),_0x2be3bc);logger[_0x406f('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x2eb010,_0xbbe325,_0x2e7e11['escape_digits'],_0x2e7e11[_0x406f('0x64')]);return this[_0x406f('0x36')][_0x406f('0x134')](_0x2eb010,_0xbbe325,_0x2e7e11['escape_digits'],_0x2e7e11['timeout'],undefined,!![]);};AGIVertices[_0x406f('0x12')][_0x406f('0x181')]=function(_0x3e72e6){logger[_0x406f('0x2b')](util['format'](_0x406f('0x182'),_0x3e72e6[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x3e72e6['url'])){return this[_0x406f('0x36')]['noop'](_0x406f('0x183'));}var _0x1f3a60=this[_0x406f('0x62')][_0x406f('0x70')](this,_0x3e72e6);logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x184'),util[_0x406f('0x185')](_0x1f3a60,{'showHidden':![],'depth':null})));if(!this[_0x406f('0x86')](_0x3e72e6[_0x406f('0xd9')])){return this['channel'][_0x406f('0xa9')](_0x406f('0x186'));}var _0x26c4ee=this['getVariable']['sync'](this,_0x3e72e6[_0x406f('0xd9')]);if(!_0x26c4ee){return this[_0x406f('0x36')]['error'](_0x3e72e6,'no\x20variable\x20found');}this[_0x406f('0x36')][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x187'),_0x26c4ee),_0x1f3a60[_0x406f('0x75')]?_0x1f3a60[_0x406f('0x75')]:'200');this['channel'][_0x406f('0xa1')](util[_0x406f('0x26')](_0x406f('0x188'),_0x26c4ee),_0x1f3a60[_0x406f('0x76')]?_0x1f3a60[_0x406f('0x76')]:'OK');if(_0x1f3a60['body']){try{this[_0x406f('0x9e')](_0x1f3a60[_0x406f('0x6a')],_0x26c4ee);}catch(_0x596fad){logger[_0x406f('0x2a')](util[_0x406f('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x26c4ee));}}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xde'),_0x26c4ee));};AGIVertices[_0x406f('0x12')][_0x406f('0x189')]=function(_0x3be4b1){logger[_0x406f('0x2b')](util['format'](_0x406f('0x18a'),_0x3be4b1[_0x406f('0x38')]));return this['channel'][_0x406f('0x18b')](_0x3be4b1[_0x406f('0x18c')][_0x406f('0xd7')](/\s+/g,''),_0x3be4b1['escape_digits']);};AGIVertices[_0x406f('0x12')][_0x406f('0x18d')]=function(_0x5db1fe){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x18e'),_0x5db1fe['label']));return this[_0x406f('0x36')][_0x406f('0x18f')](_0x5db1fe[_0x406f('0x190')]['replace'](/\s+/g,''),_0x5db1fe['escape_digits']);};AGIVertices[_0x406f('0x12')][_0x406f('0x191')]=function(_0x260f94){logger[_0x406f('0x2b')](util['format'](_0x406f('0x192'),_0x260f94[_0x406f('0x38')]));return this[_0x406f('0x36')]['sayPhonetic'](_0x260f94['text'],_0x260f94[_0x406f('0x193')]);};AGIVertices['prototype'][_0x406f('0x194')]=function(_0x1b215e){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x195'),_0x1b215e[_0x406f('0x38')]));if(!this['isConfigured'](_0x1b215e['account_id'])){return this[_0x406f('0x36')][_0x406f('0xa9')]('no\x20mail\x20account\x20configured');}var _0x712cf1=this['getMailAccount'][_0x406f('0x70')](this,_0x1b215e[_0x406f('0x196')]);if(!_0x712cf1||!_0x712cf1['Smtp']){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x1b215e,_0x406f('0x197'));}var _0x5b90c5={'from':util[_0x406f('0x26')]('\x22%s\x22\x20<%s>',_0x712cf1[_0x406f('0x10')],_0x712cf1[_0x406f('0x198')]||_0x712cf1[_0x406f('0x199')][_0x406f('0x19a')]),'to':_0x1b215e['to']||'','cc':_0x1b215e['cc']||'','bcc':_0x1b215e['bcc']||'','subject':_0x1b215e[_0x406f('0x19b')],'html':_0x1b215e[_0x406f('0x5c')],'text':_0x1b215e[_0x406f('0x5c')]};if(this['isConfigured'](_0x1b215e[_0x406f('0x19c')])){}logger[_0x406f('0x19d')]('sendMail\x20message',JSON[_0x406f('0x73')](_0x5b90c5));this[_0x406f('0x35')][_0x406f('0x70')](this,_0x1b215e,_0x1b215e[_0x406f('0x196')]);this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x19e'),_0x712cf1[_0x406f('0x10')]));this[_0x406f('0x1f')]['sync'](this,_0x712cf1['smtpOptions'],_0x5b90c5);return this[_0x406f('0x36')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x406f('0x12')][_0x406f('0x19f')]=function(_0x3c491e){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1a0'),_0x3c491e[_0x406f('0x38')]));return this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0x1a1'));};AGIVertices[_0x406f('0x12')][_0x406f('0x1a2')]=function(_0x2a7d8e){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1a3'),_0x2a7d8e[_0x406f('0x38')]));if(!this['isConfigured'](_0x2a7d8e[_0x406f('0x1a4')])){return this[_0x406f('0x36')]['noop']('no\x20sms\x20account\x20configured');}var _0x383f27=this[_0x406f('0x32')][_0x406f('0x70')](this,_0x2a7d8e['sms_account_id']);if(!_0x383f27){return this['channel'][_0x406f('0x2a')](_0x2a7d8e,'no\x20sms\x20account\x20found');}var _0x4e810a={'body':_0x2a7d8e['sms_text'],'phone':_0x2a7d8e['to']||'','SmsAccountId':_0x383f27['id']};logger[_0x406f('0x19d')](_0x406f('0x1a5'),JSON[_0x406f('0x73')](_0x4e810a));this[_0x406f('0x35')][_0x406f('0x70')](this,_0x2a7d8e,_0x2a7d8e[_0x406f('0x1a4')]);this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x383f27[_0x406f('0x10')]));this[_0x406f('0x34')]['sync'](this,_0x4e810a);return this[_0x406f('0x36')]['noop'](_0x406f('0x1a6'));};AGIVertices[_0x406f('0x12')]['set']=function(_0x376de8){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1a7'),_0x376de8[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x376de8[_0x406f('0xd9')])){return this[_0x406f('0x36')]['error'](_0x376de8,'no\x20variable\x20selected');}var _0x47b812=this[_0x406f('0xd')][_0x406f('0x70')](this,_0x376de8[_0x406f('0xd9')]);if(!_0x47b812){return this['channel'][_0x406f('0x2a')](_0x376de8,'no\x20variable\x20found');}return this['channel'][_0x406f('0xa1')](_0x47b812,_0x376de8[_0x406f('0x1a8')]);};AGIVertices[_0x406f('0x12')][_0x406f('0x1a9')]=function(_0x51fbd2){logger[_0x406f('0x2b')](util['format'](_0x406f('0x1aa'),_0x51fbd2['label']));this[_0x406f('0x36')]['noop'](_0x406f('0x1ab'));var _0x4a966e=this[_0x406f('0x36')][_0x406f('0xd')](_0x406f('0x1ac'));if(!_[_0x406f('0x43')](_0x4a966e['extra'])){this[_0x406f('0x36')][_0x406f('0x37')]=_0x4a966e['extra'];}if(_0x51fbd2[_0x406f('0xb8')]===_0x406f('0x1ad')){this[_0x406f('0x36')][_0x406f('0xa9')](_0x406f('0x1ae'));return this['channel'][_0x406f('0xb8')]();}return this[_0x406f('0x36')]['noop'](_0x406f('0x1af'));};AGIVertices[_0x406f('0x12')][_0x406f('0x1b0')]=function(_0x156d91){logger['info'](util[_0x406f('0x26')](_0x406f('0x1b1'),_0x156d91['label']));if(!this['isConfigured'](_0x156d91[_0x406f('0x1b2')])){return this[_0x406f('0x36')]['error'](_0x156d91,_0x406f('0x1b3'));}var _0x31b949=this['getSquareProject'][_0x406f('0x70')](this,_0x156d91[_0x406f('0x1b2')]);if(!this['isConfigured'](_0x31b949)){return this['channel']['error'](_0x156d91,util['format'](_0x406f('0x1b4'),_0x156d91[_0x406f('0x1b2')]));}if(_0x31b949===this[_0x406f('0x36')][_0x406f('0x1b5')]){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x156d91,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x406f('0x35')][_0x406f('0x70')](this,_0x156d91,_0x31b949);var _0x6ab4e9=this[_0x406f('0x36')][_0x406f('0x58')](_0x406f('0x1b6'),util[_0x406f('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x406f('0x5')][_0x406f('0x1b7')]||_0x406f('0x1b8'),_0x31b949,this[_0x406f('0x36')][_0x406f('0x1b5')]));if(_0x6ab4e9[_0x406f('0xab')]===-0x1){return _0x6ab4e9;}return this['channel']['noop'](util['format'](_0x406f('0xc5'),'AGI',_0x31b949));};AGIVertices[_0x406f('0x12')][_0x406f('0x1b9')]=function(_0x17ecfa){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1ba'),_0x17ecfa[_0x406f('0x38')]));var _0x101b27=this[_0x406f('0x57')]['sync'](this,_0x17ecfa[_0x406f('0xb7')]);this['createSquareDetailsReport'][_0x406f('0x70')](this,_0x17ecfa,_0x17ecfa[_0x406f('0xb7')]);if(this['isConfigured'](_0x17ecfa[_0x406f('0xd9')])){var _0x46b67f=this['getVariable'][_0x406f('0x70')](this,_0x17ecfa[_0x406f('0xd9')]);if(_0x46b67f){this[_0x406f('0x36')][_0x406f('0xa1')](_0x46b67f,_0x101b27);return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x17ecfa[_0x406f('0xb7')],_0x46b67f));}}return this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x1bb'),_0x17ecfa[_0x406f('0xb7')]));};AGIVertices['prototype'][_0x406f('0x1bc')]=function(_0x273eb4){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1bd'),_0x273eb4['label']));_0x273eb4[_0x406f('0x5c')]=_0x273eb4[_0x406f('0x5c')][_0x406f('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x273eb4[_0x406f('0x5b')])){return this[_0x406f('0x36')]['noop'](_0x406f('0x1be'));}if(!this[_0x406f('0x86')](_0x273eb4[_0x406f('0x5c')])){return this[_0x406f('0x36')][_0x406f('0xa9')]('no\x20text\x20configured');}this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x1bf'),_0x273eb4[_0x406f('0x5c')]));var _0x1cfdb0=this[_0x406f('0x5a')][_0x406f('0x70')](this,_0x273eb4);if(_0x1cfdb0){this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x1c0'),_0x1cfdb0));var _0x4b2a8d=this[_0x406f('0x36')][_0x406f('0x104')](_0x1cfdb0);try{fs[_0x406f('0x127')](_0x1cfdb0+_0x406f('0x105'));}catch(_0x442b63){logger[_0x406f('0x2a')](_0x442b63);}return _0x4b2a8d;}return this[_0x406f('0x36')][_0x406f('0x2a')](_0x273eb4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x406f('0x12')][_0x406f('0x1c1')]=function(_0x34cb51){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1c2'),_0x34cb51[_0x406f('0x38')]));_0x34cb51[_0x406f('0x5c')]=_0x34cb51[_0x406f('0x5c')][_0x406f('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x406f('0x86')](_0x34cb51[_0x406f('0x5c')])){return this['channel'][_0x406f('0xa9')](_0x406f('0xaa'));}this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x1c3'),_0x34cb51['text']));var _0x25e964=this['googleTTS'][_0x406f('0x70')](this,_0x34cb51);if(_0x25e964){this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x25e964));var _0xc28483=this['channel'][_0x406f('0x104')](_0x25e964);try{fs[_0x406f('0x127')](_0x25e964+_0x406f('0x105'));}catch(_0x1c0d35){logger[_0x406f('0x2a')](_0x1c0d35);}return _0xc28483;}return this[_0x406f('0x36')][_0x406f('0x2a')](_0x34cb51,_0x406f('0x1c4'));};AGIVertices[_0x406f('0x12')][_0x406f('0x1c5')]=function(_0x292fea){logger['info'](util[_0x406f('0x26')](_0x406f('0x1c6'),_0x292fea[_0x406f('0x38')]));if(!this['isConfigured'](_0x292fea['findBy'])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x292fea,_0x406f('0x161'));}logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x15a'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x292fea[_0x406f('0x159')]));var _0x4c17da=this[_0x406f('0x51')][_0x406f('0x70')](this,_0x292fea[_0x406f('0x159')]);if(_0x4c17da){logger['info'](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x292fea[_0x406f('0x159')]));this[_0x406f('0x36')][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0x15b'),this[_0x406f('0x36')][_0x406f('0x3a')],_0x292fea[_0x406f('0x159')]));return{'code':0xc8,'result':_0x406f('0x15c')};}else{logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x15d'),this['channel'][_0x406f('0x3a')],_0x292fea[_0x406f('0x159')]));this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x406f('0x36')][_0x406f('0x3a')],_0x292fea['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x406f('0x12')]['voicemail']=function(_0xae121d){logger[_0x406f('0x2b')](util['format'](_0x406f('0x1c7'),_0xae121d['label']));var _0x175d09=this[_0x406f('0x36')][_0x406f('0x58')](_0x406f('0x1c8'),[_0xae121d[_0x406f('0x1c9')],_0xae121d[_0x406f('0x79')]]);if(_0x175d09[_0x406f('0xab')]===-0x1){return _0x175d09;}return this['channel'][_0x406f('0xa9')](util[_0x406f('0x26')](_0x406f('0xc5'),'VOICEMAIL',_0xae121d[_0x406f('0x1c9')]));};AGIVertices[_0x406f('0x12')][_0x406f('0x1ca')]=function(_0x1ea90a){logger[_0x406f('0x2b')](util[_0x406f('0x26')](_0x406f('0x1cb'),_0x1ea90a[_0x406f('0x38')]));if(!this[_0x406f('0x86')](_0x1ea90a[_0x406f('0xd9')])){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x1ea90a,_0x406f('0x1cc'));}var _0x172199=this[_0x406f('0xd')][_0x406f('0x70')](this,_0x1ea90a[_0x406f('0xd9')]);if(!_0x172199){return this[_0x406f('0x36')][_0x406f('0x2a')](_0x1ea90a,_0x406f('0xdb'));}var _0x5c15b0=this['channel'][_0x406f('0xd')](_0x172199);return{'code':0xc8,'result':_0x5c15b0[_0x406f('0xa4')]?_0x5c15b0[_0x406f('0xa4')]:'-'};};String[_0x406f('0x12')][_0x406f('0xa3')]=function(_0xc8d7e2,_0x475c53){return this['split'](_0xc8d7e2)[_0x406f('0x1cd')](_0x475c53);};module[_0x406f('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xc3b5=['ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','sayNumber','sayphonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','name','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPauseById','agentPause','agent','agentUnpause','agentLogout','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','parse','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','Amy','awsLex','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','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','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','no\x20trunk\x20selected','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','variable_id','getData','response','toString','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','aws_access_key_id','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','TILDE_ASR_%s','gotoc','continueAt','gotoif','no\x20condition\x20configured','condition','true','false','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','intKey','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created'];(function(_0x5b9deb,_0x49d869){var _0x250096=function(_0x284695){while(--_0x284695){_0x5b9deb['push'](_0x5b9deb['shift']());}};_0x250096(++_0x49d869);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x5a9d89,_0x54a325){_0x5a9d89=_0x5a9d89-0x0;var _0x40fb4e=_0xc3b5[_0x5a9d89];return _0x40fb4e;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x5c3b('0x0'));var odbc=require(_0x5c3b('0x1'))();var rs=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var Mustache=require(_0x5c3b('0x4'));var rp=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var scripts=require(_0x5c3b('0x8'));var FILES_PATH=_0x5c3b('0x9');var recursiveMapAttributes=['rawHeaders',_0x5c3b('0xa')];var verticesWithRetry=[_0x5c3b('0xb'),_0x5c3b('0xc'),_0x5c3b('0xd')];var AGIVertices=function(_0x5be9ee,_0x1c68a5,_0x438255){this[_0x5c3b('0xe')]=_0x5be9ee;this[_0x5c3b('0xf')]=_0x1c68a5;this['mailRpc']=_0x438255;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x11')]=function(_0x30ceca,_0x2e894a){this[_0x5c3b('0xf')]['getVariableById'](_0x30ceca)[_0x5c3b('0x12')](function(_0xb1c77b){_0x2e894a(null,_0xb1c77b?_0xb1c77b['name']:![]);})[_0x5c3b('0x13')](function(_0x3b953d){_0x2e894a(_0x3b953d);});};AGIVertices['prototype'][_0x5c3b('0x14')]=function(_0xbff1cc,_0x3e24bd){this[_0x5c3b('0xf')][_0x5c3b('0x15')](_0xbff1cc)[_0x5c3b('0x12')](function(_0x27965f){_0x3e24bd(null,_0x27965f?_0x27965f['name']:![]);})[_0x5c3b('0x13')](function(_0x5b55be){_0x3e24bd(_0x5b55be);});};AGIVertices['prototype'][_0x5c3b('0x16')]=function(_0x945338,_0x18757e){this['rpc'][_0x5c3b('0x17')](_0x945338)[_0x5c3b('0x12')](function(_0x5b5810){_0x18757e(null,_0x5b5810?_0x5b5810['name']:![]);})[_0x5c3b('0x13')](function(_0x34144d){_0x18757e(_0x34144d);});};AGIVertices['prototype'][_0x5c3b('0x18')]=function(_0x4658ce,_0x2b2307){this[_0x5c3b('0xf')][_0x5c3b('0x19')](_0x4658ce)[_0x5c3b('0x12')](function(_0x1915c8){_0x2b2307(null,_0x1915c8?_0x1915c8[_0x5c3b('0x1a')]:![]);})[_0x5c3b('0x13')](function(_0x1138b0){_0x2b2307(_0x1138b0);});};AGIVertices['prototype']['getUser']=function(_0x319f0c,_0x143022){this['rpc'][_0x5c3b('0x1b')](_0x319f0c)['then'](function(_0x832a1c){_0x143022(null,_0x832a1c?_0x832a1c[_0x5c3b('0x1c')]:![]);})[_0x5c3b('0x13')](function(_0xe9261d){_0x143022(_0xe9261d);});};AGIVertices['prototype'][_0x5c3b('0x1d')]=function(_0x365318,_0x54ab06){this[_0x5c3b('0xf')][_0x5c3b('0x1e')](_0x365318)[_0x5c3b('0x12')](function(_0x3c3991){_0x54ab06(null,_0x3c3991?_0x3c3991['name']:![]);})[_0x5c3b('0x13')](function(_0x20469d){_0x54ab06(_0x20469d);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1f')]=function(_0x28dfbc,_0x2a293d){var _0x511963=this;this['rpc']['getSoundById'](_0x28dfbc)[_0x5c3b('0x12')](function(_0x3e6832){_0x2a293d(null,_0x3e6832?_0x511963['getSoundPath'](_0x3e6832[_0x5c3b('0x20')]):![]);})[_0x5c3b('0x13')](function(_0x421d96){_0x2a293d(_0x421d96);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x21')]=function(_0x35b48e,_0x356f46){this[_0x5c3b('0xf')][_0x5c3b('0x22')](_0x35b48e)[_0x5c3b('0x12')](function(_0x4765b3){_0x356f46(null,_0x4765b3?_0x4765b3:![]);})[_0x5c3b('0x13')](function(_0x5a5d9e){_0x356f46(_0x5a5d9e);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x23')]=function(_0x3b80c9,_0xa108e2,_0x23e55f){this[_0x5c3b('0x24')][_0x5c3b('0x23')](_0x3b80c9,_0xa108e2)[_0x5c3b('0x12')](function(){_0x23e55f(null);})[_0x5c3b('0x13')](function(_0x1d9492){_0x23e55f(_0x1d9492);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x25')]=function(_0x173383,_0x68ec02){this[_0x5c3b('0xf')][_0x5c3b('0x26')](_0x173383)[_0x5c3b('0x12')](function(_0x4cfe1b){if(_0x4cfe1b){if(_0x4cfe1b[_0x5c3b('0x27')]){_0x68ec02(null,[_0x4cfe1b[_0x5c3b('0x28')]]);}else{_0x68ec02(null,_[_0x5c3b('0x29')](_0x4cfe1b[_0x5c3b('0x2a')],'interval'));}}else{_0x68ec02(null,![]);}})[_0x5c3b('0x13')](function(_0x39c159){_0x68ec02(_0x39c159);});};AGIVertices['prototype'][_0x5c3b('0x2b')]=function(_0x31440b){return util[_0x5c3b('0x2c')](_0x5c3b('0x2d'),FILES_PATH,_0x31440b);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x2e')]=function(_0x27b34d,_0x22fe25,_0x1fa1df){odbc['open'](_0x27b34d,function(_0x128f2e){if(_0x128f2e){logger[_0x5c3b('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x128f2e);_0x1fa1df(_0x128f2e);}else{logger['info'](_0x5c3b('0x30'));odbc[_0x5c3b('0x31')](_0x22fe25,function(_0xe2951c,_0x3cfc4d){if(_0xe2951c){logger[_0x5c3b('0x32')](_0x5c3b('0x33'),_0x22fe25);_0x1fa1df(_0xe2951c);}else{logger[_0x5c3b('0x32')]('Query\x20executed\x20correctly\x20%s',_0x22fe25);odbc['close'](function(_0x3a641e){if(_0x3a641e){logger[_0x5c3b('0x2f')](_0x5c3b('0x34'),_0x3a641e);}_0x1fa1df(null,_0x3cfc4d);});}});}});};AGIVertices[_0x5c3b('0x10')]['getSmsAccount']=function(_0x16400b,_0x4b9a81){this[_0x5c3b('0xf')][_0x5c3b('0x35')](_0x16400b)[_0x5c3b('0x12')](function(_0xea3ae1){_0x4b9a81(null,_0xea3ae1?_0xea3ae1:![]);})[_0x5c3b('0x13')](function(_0x359d3d){_0x4b9a81(_0x359d3d);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x36')]=function(_0x62b6a2,_0x546827){this['rpc'][_0x5c3b('0x36')](_0x62b6a2)[_0x5c3b('0x12')](function(_0x40d270){_0x546827(null,_0x40d270);})[_0x5c3b('0x13')](function(_0x2c2a25){_0x546827(_0x2c2a25);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x37')]=function(_0x1d9427,_0x29ffdc,_0x56a53e){this[_0x5c3b('0xf')][_0x5c3b('0x37')]({'uniqueid':this[_0x5c3b('0xe')]['uniqueid'],'node':_0x1d9427[_0x5c3b('0x38')],'application':_0x1d9427[_0x5c3b('0x39')],'data':_0x29ffdc||null,'project_name':this[_0x5c3b('0xe')][_0x5c3b('0x3a')],'callerid':this[_0x5c3b('0xe')][_0x5c3b('0x3b')]})[_0x5c3b('0x12')](function(_0x33fb97){if(_0x56a53e){_0x56a53e(null,_0x33fb97);}})[_0x5c3b('0x13')](function(_0x28c68a){if(_0x56a53e){_0x56a53e(_0x28c68a);}});};AGIVertices[_0x5c3b('0x10')]['createSquareRecording']=function(_0x437aaf,_0x568c0c,_0x3b795e,_0x1eb247){this['rpc'][_0x5c3b('0x3c')]({'uniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'callerid':this['channel'][_0x5c3b('0x3b')],'calleridname':this['channel'][_0x5c3b('0x3e')],'context':this[_0x5c3b('0xe')][_0x5c3b('0x3f')],'extension':this[_0x5c3b('0xe')][_0x5c3b('0x40')],'priority':this[_0x5c3b('0xe')][_0x5c3b('0x41')],'accountcode':this[_0x5c3b('0xe')][_0x5c3b('0x42')],'dnid':this[_0x5c3b('0xe')][_0x5c3b('0x43')],'projectName':this['channel'][_0x5c3b('0x3a')],'saveName':_0x568c0c,'filename':_0x437aaf['file']||_0x568c0c,'savePath':_0x3b795e})[_0x5c3b('0x12')](function(_0x11bf0a){_0x1eb247(null,_0x11bf0a);})[_0x5c3b('0x13')](function(_0x4b85c1){_0x1eb247(_0x4b85c1);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x44')]=function(_0x5c9e2d,_0x200da6,_0x7f0100,_0x17f038,_0x2744cd){this[_0x5c3b('0xf')][_0x5c3b('0x44')]({'uniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'body':_0x5c9e2d,'direction':_0x200da6,'providerName':_0x7f0100,'providerResponse':_0x17f038})[_0x5c3b('0x12')](function(_0x1b5e30){if(_0x2744cd){_0x2744cd(null,_0x1b5e30);}})[_0x5c3b('0x13')](function(_0x5a9c88){if(_0x2744cd){_0x2744cd(_0x5a9c88);}});};AGIVertices['prototype']['createCmContact']=function(_0x434c28,_0x203ae2){this['rpc'][_0x5c3b('0x45')]({'firstName':_[_0x5c3b('0x46')](_0x434c28[_0x5c3b('0x1c')])||_[_0x5c3b('0x47')](_0x434c28['name'])?_0x5c3b('0x48')+Math[_0x5c3b('0x49')]():_0x434c28['name'],'lastName':_[_0x5c3b('0x46')](_0x434c28[_0x5c3b('0x4a')])||_[_0x5c3b('0x47')](_0x434c28[_0x5c3b('0x4a')])?null:_0x434c28[_0x5c3b('0x4a')],'phone':_0x434c28[_0x5c3b('0x4b')],'ListId':_0x434c28[_0x5c3b('0x4c')],'scheduledat':_0x434c28[_0x5c3b('0x4d')],'callbackUniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'tags':_0x5c3b('0x4e'),'description':_0x5c3b('0x4f')+_0x434c28[_0x5c3b('0x4d')]['toString'](),'priority':_0x434c28['callback_priority']})[_0x5c3b('0x12')](function(_0x393073){_0x203ae2(null,_0x393073);})[_0x5c3b('0x13')](function(_0x5276d3){_0x203ae2(_0x5276d3);});};AGIVertices['prototype']['getPause']=function(_0x281438,_0x536a6b){this[_0x5c3b('0xf')][_0x5c3b('0x50')](_0x281438)[_0x5c3b('0x12')](function(_0x3d5218){_0x536a6b(null,_0x3d5218?_0x3d5218[_0x5c3b('0x1c')]:![]);})['catch'](function(_0x23d7cb){_0x536a6b(_0x23d7cb);});};AGIVertices['prototype'][_0x5c3b('0x51')]=function(_0x5e55e4,_0x411c7b,_0x87f956){var _0x4080c8={'role':_0x5c3b('0x52')};_0x4080c8[_0x5e55e4]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x51')](_0x4080c8,_0x411c7b,this[_0x5c3b('0xe')][_0x5c3b('0x3d')])[_0x5c3b('0x12')](function(_0x54c01a){_0x87f956(null,_['isNil'](_0x54c01a)?![]:!![]);})['catch'](function(_0x320895){logger[_0x5c3b('0x2f')](_0x320895);_0x87f956(null,![]);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x53')]=function(_0x532120,_0x4edba0){var _0x3ce7af={'role':'agent'};_0x3ce7af[_0x532120]=this['channel'][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x53')](_0x3ce7af)[_0x5c3b('0x12')](function(_0x3eda5e){_0x4edba0(null,_[_0x5c3b('0x47')](_0x3eda5e)?![]:!![]);})[_0x5c3b('0x13')](function(_0x13043b){logger[_0x5c3b('0x2f')](_0x13043b);_0x4edba0(null,![]);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x54')]=function(_0x2c335f,_0x50bb3f){var _0x3faa19={'role':'agent'};_0x3faa19[_0x2c335f]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x54')](_0x3faa19)[_0x5c3b('0x12')](function(_0x22f6f1){_0x50bb3f(null,_[_0x5c3b('0x47')](_0x22f6f1)?![]:!![]);})[_0x5c3b('0x13')](function(_0x57175a){logger[_0x5c3b('0x2f')](_0x57175a);_0x50bb3f(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x404844,_0x2fc946){var _0xaa3e19={'role':'agent'};_0xaa3e19[_0x404844]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];var _0x2ec0a9=_0x404844!='internal'?util[_0x5c3b('0x2c')]('%s/%s@from-sip/n',_0x5c3b('0x55'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')]):undefined;this['rpc'][_0x5c3b('0x56')](_0xaa3e19,_0x2ec0a9)['then'](function(_0x22ba96){_0x2fc946(null,_[_0x5c3b('0x47')](_0x22ba96)?![]:!![]);})[_0x5c3b('0x13')](function(_0x5b1028){logger[_0x5c3b('0x2f')](_0x5b1028);_0x2fc946(null,![]);});};AGIVertices['prototype'][_0x5c3b('0x57')]=function(_0x2dd9c4,_0x3a6a23){sh[_0x5c3b('0x58')](_[_0x5c3b('0x59')](_0x2dd9c4),function(_0x2e6cb4,_0x86b55e){var _0x51a1c3=_0x86b55e[_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'');_0x3a6a23(null,_0x51a1c3);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x5b')]=function(_0x445217,_0x467427){scripts['googleCloudTTS'](_0x445217[_0x5c3b('0x5c')],_0x445217[_0x5c3b('0x5d')]||'text',_0x445217[_0x5c3b('0x5e')],_0x445217[_0x5c3b('0x5f')]||_0x5c3b('0x60'),_0x445217[_0x5c3b('0x61')]||_0x5c3b('0x62'),_0x445217[_0x5c3b('0x63')]||_0x5c3b('0x64'))[_0x5c3b('0x12')](function(_0x348fc4){_0x467427(null,_0x348fc4);})['catch'](function(_0x4c94cb){_0x467427(_0x4c94cb);});};AGIVertices['prototype']['googleTTS']=function(_0x5ac5dd,_0x274b66){scripts[_0x5c3b('0x65')](_0x5ac5dd[_0x5c3b('0x5e')],_0x5ac5dd['google_tts_language']||'en',0x1)[_0x5c3b('0x12')](function(_0x4bafa5){_0x274b66(null,_0x4bafa5);})[_0x5c3b('0x13')](function(_0x1aa23c){_0x274b66(_0x1aa23c);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x66')]=function(_0x3419db,_0xbc0e51){var _0x183fa9={'uri':_0x3419db[_0x5c3b('0x67')],'method':_0x3419db[_0x5c3b('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3419db[_0x5c3b('0x69')])===_0x5c3b('0x6a')&&parseInt(_0x3419db[_0x5c3b('0x69')])>=0x1?parseInt(_0x3419db['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x5c3b('0x6b')]([_0x5c3b('0x6c'),_0x5c3b('0x6d')],_0x183fa9[_0x5c3b('0x68')][_0x5c3b('0x6e')]())){try{_0x183fa9[_0x5c3b('0x6f')]=_0x3419db['rawBody']?JSON['parse'](_0x3419db[_0x5c3b('0xa')]):{};}catch(_0x30063d){logger['error'](_0x5c3b('0x70'),_0x30063d);}}try{_0x183fa9[_0x5c3b('0x71')]=_0x3419db[_0x5c3b('0x72')]?JSON['parse'](_0x3419db[_0x5c3b('0x72')]):{};}catch(_0x1ca6cb){logger[_0x5c3b('0x2f')](_0x5c3b('0x73'),_0x1ca6cb);}if(_0x3419db['computedVariables']){try{var _0x4ba6a0=require(_0x3419db[_0x5c3b('0x74')])[_0x5c3b('0x75')](this,_0x183fa9);_0x183fa9[_0x5c3b('0x76')]=Mustache[_0x5c3b('0x77')](_0x3419db[_0x5c3b('0x67')],_0x4ba6a0,{},['$$','$$']);if(_0x183fa9[_0x5c3b('0x71')]){_0x183fa9[_0x5c3b('0x71')]=JSON[_0x5c3b('0x78')](Mustache[_0x5c3b('0x77')](JSON['stringify'](_0x183fa9[_0x5c3b('0x71')]),_0x4ba6a0,{},['$$','$$']));}if(_0x183fa9[_0x5c3b('0x6f')]){_0x183fa9[_0x5c3b('0x6f')]=JSON[_0x5c3b('0x78')](Mustache[_0x5c3b('0x77')](JSON[_0x5c3b('0x79')](_0x183fa9[_0x5c3b('0x6f')]),_0x4ba6a0,{},['$$','$$']));}}catch(_0x36c6cd){logger[_0x5c3b('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36c6cd);}}rp(_0x183fa9)[_0x5c3b('0x12')](function(_0x7a2d52){var _0x2d71b4={'statusCode':_0x7a2d52[_0x5c3b('0x7a')]||0xc8,'statusMessage':_0x7a2d52['statusMessage']||'OK','headers':_0x7a2d52['headers']||{},'body':_0x7a2d52['body']||{}};_0xbc0e51(null,_0x2d71b4);})[_0x5c3b('0x13')](function(_0x4059a7){var _0x32bac3={'statusCode':_0x4059a7['statusCode']||0x1f4,'statusMessage':_0x4059a7[_0x5c3b('0x7b')]||_0x5c3b('0x7c'),'headers':_0x4059a7[_0x5c3b('0x7d')]['headers']||{},'body':_0x4059a7[_0x5c3b('0x7d')][_0x5c3b('0x6f')]||{}};_0xbc0e51(null,_0x32bac3);});};AGIVertices[_0x5c3b('0x10')]['googleDialogflow']=function(_0x3b91e6,_0x3e272a){scripts[_0x5c3b('0x7e')](this[_0x5c3b('0xe')][_0x5c3b('0x3d')],_0x3b91e6['key'],_0x3b91e6[_0x5c3b('0x5e')],_0x3b91e6[_0x5c3b('0x7f')]||'en')['then'](function(_0x5bbee5){_0x3e272a(null,_0x5bbee5);})['catch'](function(_0x90be8a){_0x3e272a(_0x90be8a);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x80')]=function(_0x3a44c4,_0x57f7b3){scripts[_0x5c3b('0x80')](this[_0x5c3b('0xe')][_0x5c3b('0x3d')],_0x3a44c4[_0x5c3b('0x81')],_0x3a44c4[_0x5c3b('0x82')],_0x3a44c4[_0x5c3b('0x83')],_0x3a44c4[_0x5c3b('0x5e')],_0x3a44c4[_0x5c3b('0x84')]||'en')[_0x5c3b('0x12')](function(_0x26d64e){_0x57f7b3(null,_0x26d64e);})['catch'](function(_0x565724){_0x57f7b3(_0x565724);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x85')]=function(_0x3cc0df,_0x3abf4b){scripts[_0x5c3b('0x85')](this['channel'],_0x3cc0df)[_0x5c3b('0x12')](function(_0x927af7){_0x3abf4b(null,_0x927af7);})[_0x5c3b('0x13')](function(_0x158800){_0x3abf4b(_0x158800);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x86')]=function(_0x4a0e05,_0x5b20b1){scripts[_0x5c3b('0x86')](_0x4a0e05[_0x5c3b('0x87')],_0x4a0e05['text'],_0x4a0e05[_0x5c3b('0x88')]||_0x5c3b('0x60'),_0x4a0e05['speed'])[_0x5c3b('0x12')](function(_0x46b08c){_0x5b20b1(null,_0x46b08c);})[_0x5c3b('0x13')](function(_0x115b84){_0x5b20b1(_0x115b84);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x89')]=function(_0x479cae,_0x992c8,_0x3e90d3){scripts[_0x5c3b('0x89')](_0x992c8,_0x479cae[_0x5c3b('0x87')],_0x479cae[_0x5c3b('0x8a')]||'en-US',this[_0x5c3b('0x8b')](_0x479cae[_0x5c3b('0x8c')])?_0x479cae[_0x5c3b('0x8c')]:undefined)[_0x5c3b('0x12')](function(_0x5ef311){_0x3e90d3(null,_0x5ef311);})[_0x5c3b('0x13')](function(_0x5613ec){_0x3e90d3(_0x5613ec);});};AGIVertices[_0x5c3b('0x10')]['awsPolly']=function(_0x314d17,_0xa93c90){scripts[_0x5c3b('0x8d')](_0x314d17['aws_access_key_id'],_0x314d17['aws_secret_access_key'],_0x314d17[_0x5c3b('0x8e')],_0x314d17['aws_polly_voice']||_0x5c3b('0x8f'),_0x314d17[_0x5c3b('0x5e')],_0x314d17['aws_text_type']||_0x5c3b('0x5e'))['then'](function(_0x70117){_0xa93c90(null,_0x70117);})[_0x5c3b('0x13')](function(_0x458015){_0xa93c90(_0x458015);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x90')]=function(_0x26a10a,_0x225f6e){scripts[_0x5c3b('0x90')](this[_0x5c3b('0xe')]['uniqueid'],_0x26a10a['aws_access_key_id'],_0x26a10a['aws_secret_access_key'],_0x26a10a['aws_lex_region'],_0x26a10a[_0x5c3b('0x5e')],_0x26a10a['aws_bot_name'])[_0x5c3b('0x12')](function(_0x613269){_0x225f6e(null,_0x613269);})[_0x5c3b('0x13')](function(_0x20f7c3){_0x225f6e(_0x20f7c3);});};AGIVertices['prototype']['googleASR']=function(_0x4d4ff9,_0x1d8803,_0x92aff4){scripts[_0x5c3b('0x91')](_0x1d8803,_0x4d4ff9['key'],_0x4d4ff9[_0x5c3b('0x92')]||_0x5c3b('0x60'))[_0x5c3b('0x12')](function(_0x7f1b21){_0x92aff4(null,_0x7f1b21);})[_0x5c3b('0x13')](function(_0x2d1d5d){_0x92aff4(_0x2d1d5d);});};AGIVertices['prototype'][_0x5c3b('0x93')]=function(_0x92ae7c,_0x3c4abb,_0x385f08){scripts['tildeASR'](_0x3c4abb,_0x92ae7c['appid'],_0x92ae7c[_0x5c3b('0x94')],_0x92ae7c[_0x5c3b('0x76')])['then'](function(_0x1b198a){_0x385f08(null,_0x1b198a);})[_0x5c3b('0x13')](function(_0x1b2c12){_0x385f08(_0x1b2c12);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x95')]=function(_0x5567b3){var _0x171d26=_[_0x5c3b('0x6b')](verticesWithRetry,_0x5567b3[_0x5c3b('0x39')])?_0x5567b3:_[_0x5c3b('0x96')](_0x5567b3);for(var _0x1e7f2c in _0x171d26){if(_0x171d26[_0x5c3b('0x97')](_0x1e7f2c)){if(_0x171d26[_0x1e7f2c]&&_[_0x5c3b('0x98')](_0x171d26[_0x1e7f2c])){if(_['includes'](recursiveMapAttributes,_0x1e7f2c)){_0x171d26[_0x1e7f2c]=this[_0x5c3b('0x99')](_0x171d26[_0x1e7f2c]);}else{_0x171d26[_0x1e7f2c]=this[_0x5c3b('0x9a')](_0x171d26[_0x1e7f2c]);}}}}return _0x171d26;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9b')]=function(_0x1d0326){for(var _0x5d048f in _0x1d0326){if(_0x1d0326['hasOwnProperty'](_0x5d048f)){if(_['isPlainObject'](_0x1d0326[_0x5d048f])){this[_0x5c3b('0x9b')](_0x1d0326[_0x5d048f]);}else if(_[_0x5c3b('0x9c')](_0x1d0326[_0x5d048f])){for(var _0x2f3e01=0x0;_0x2f3e01<_0x1d0326[_0x5d048f][_0x5c3b('0x9d')];_0x2f3e01++){this[_0x5c3b('0x9b')](_0x1d0326[_0x5d048f][_0x2f3e01]);}}else if(_['isString'](_0x1d0326[_0x5d048f])){_0x1d0326[_0x5d048f]=this[_0x5c3b('0x9a')](_0x1d0326[_0x5d048f]);}}}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9e')]=function(_0x1a0d5e,_0x17b47a){for(var _0x1f7366 in _0x1a0d5e){if(_0x1a0d5e[_0x5c3b('0x97')](_0x1f7366)){if(_['isPlainObject'](_0x1a0d5e[_0x1f7366])){if(!_[_0x5c3b('0x46')](_0x1a0d5e[_0x1f7366])){this[_0x5c3b('0x9e')](_0x1a0d5e[_0x1f7366],util[_0x5c3b('0x2c')](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366));}}else if(_[_0x5c3b('0x9c')](_0x1a0d5e[_0x1f7366])){for(var _0x449035=0x0;_0x449035<_0x1a0d5e[_0x1f7366][_0x5c3b('0x9d')];_0x449035++){this[_0x5c3b('0x9e')](_0x1a0d5e[_0x1f7366][_0x449035],util['format'](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366+'['+_0x449035+']'));}}else{if(!_['isNil'](_0x1a0d5e[_0x1f7366])){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366),_0x1a0d5e[_0x1f7366]);}}}}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x99')]=function(_0x2f71eb){try{var _0x4ad2e7=JSON['parse'](_0x2f71eb);this[_0x5c3b('0x9b')](_0x4ad2e7);return JSON['stringify'](_0x4ad2e7);}catch(_0x5bc982){return this['replaceAllVariables'](_0x2f71eb);}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9a')]=function(_0x32535c){var _0x35cffb=_0x32535c[_0x5c3b('0xa1')]('{');for(var _0x5590ad=0x1;_0x5590ad<_0x35cffb[_0x5c3b('0x9d')];_0x5590ad+=0x1){var _0x314db2=_0x35cffb[_0x5590ad][_0x5c3b('0xa1')]('}');if(_0x314db2[_0x5c3b('0x9d')]>0x1){_0x32535c=_0x32535c[_0x5c3b('0xa2')]('{'+_0x314db2[0x0]+'}',this[_0x5c3b('0xe')][_0x5c3b('0x11')](_0x314db2[0x0])['extra']||_0x314db2[0x0]);}}if(_0x35cffb[_0x5c3b('0x9d')]===0x1){return _0x32535c['toString']();}return this[_0x5c3b('0x9a')](_0x32535c);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xa3')]=function(_0x45d1da,_0x362fb5){var _0x28be41=this[_0x5c3b('0xe')]['getVariable'](_0x45d1da);if(_0x28be41[_0x5c3b('0xa4')]===-0x1){return _0x28be41;}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xa5'),_0x362fb5,_0x28be41[_0x5c3b('0xa6')]));return this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x362fb5,_0x28be41[_0x5c3b('0xa6')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x8b')]=function(_0x1f4286){return _0x1f4286&&_0x1f4286!=='0'&&_0x1f4286!=='-1'&&_0x1f4286!=='';};AGIVertices[_0x5c3b('0x10')]['maxRetry']=function(_0x28bbca){this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x28bbca,'-');_0x28bbca[_0x5c3b('0xa7')]=_0x28bbca[_0x5c3b('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xa9')]=function(_0x4bb221){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xaa'),_0x4bb221['label']));if(!this['isConfigured'](_0x4bb221[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20text\x20configured');}var _0x4473ce='\x22'+_0x4bb221[_0x5c3b('0x5e')]+'\x22';if(this[_0x5c3b('0x8b')](_0x4bb221[_0x5c3b('0x7d')])){_0x4473ce+=','+_0x4bb221['options'];}var _0x470f0d=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xac'),_0x4473ce);if(_0x470f0d[_0x5c3b('0xa4')]===-0x1){return _0x470f0d;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xad'),_0x4473ce));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xae')]=function(_0xafb31b){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xaf'),_0xafb31b[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0xafb31b[_0x5c3b('0xb0')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xb1'));}var _0x1a6ba8=_0xafb31b['grammar'];if(this[_0x5c3b('0x8b')](_0xafb31b[_0x5c3b('0x7d')])){_0x1a6ba8+=','+_0xafb31b[_0x5c3b('0x7d')];}var _0x49ddc2=this['channel'][_0x5c3b('0x58')]('MRCPRecog',_0x1a6ba8);if(_0x49ddc2['result']===-0x1){return _0x49ddc2;}var _0x18d580=this['getAndSetVariable'](_0x5c3b('0xb2'),_0x5c3b('0xb3'));if(_0x18d580[_0x5c3b('0xa4')]===-0x1){return _0x18d580;}var _0x13916f=this[_0x5c3b('0xa3')](_0x5c3b('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x13916f['result']===-0x1){return _0x13916f;}var _0x4174ab=this[_0x5c3b('0xa3')](_0x5c3b('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x4174ab['result']===-0x1){return _0x4174ab;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1a6ba8));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x7')]=function(_0x1f01f1){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xb6'),_0x1f01f1['label']));return this[_0x5c3b('0xe')][_0x5c3b('0x7')]([_0x1f01f1[_0x5c3b('0xb7')],_0x1f01f1[_0x5c3b('0xb8')]]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xb9')]=function(_0x278f8c){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xba'),_0x278f8c[_0x5c3b('0x38')]));if(this[_0x5c3b('0x8b')](_0x278f8c['timeout'])){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x278f8c[_0x5c3b('0x69')]));var _0x2e2b23=this[_0x5c3b('0xe')][_0x5c3b('0xbb')](_0x278f8c[_0x5c3b('0x69')]);if(_0x2e2b23[_0x5c3b('0xa4')]===-0x1){return _0x2e2b23;}}return this[_0x5c3b('0xe')][_0x5c3b('0xb9')]();};AGIVertices['prototype']['callback']=function(_0x2ecdd5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xbc'),_0x2ecdd5['label']));if(!this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0x4c')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2ecdd5,_0x5c3b('0xbd'));}_0x2ecdd5[_0x5c3b('0x4d')]=moment();if(this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0xbe')])){_0x2ecdd5[_0x5c3b('0x4d')]=moment()['add'](_0x2ecdd5['delay'],_0x5c3b('0xbf'));}if(!this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0xc0')])){_0x2ecdd5[_0x5c3b('0xc0')]=0x2;}this[_0x5c3b('0x45')]['sync'](this,_0x2ecdd5);return this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0xc1'),_0x2ecdd5[_0x5c3b('0x4b')],_0x2ecdd5[_0x5c3b('0x4c')],_0x2ecdd5[_0x5c3b('0x4d')]));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc2')]=function(_0x2b7326){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2b7326[_0x5c3b('0x38')]));var _0x550097=this[_0x5c3b('0xe')]['exec'](_0x2b7326['application'],_0x2b7326[_0x5c3b('0x7d')]);if(_0x550097[_0x5c3b('0xa4')]===-0x1){return _0x550097;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x2b7326['application'],_0x2b7326[_0x5c3b('0x7d')]));};AGIVertices['prototype'][_0x5c3b('0xc4')]=function(_0x3dfe8a){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xc5'),_0x3dfe8a[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x3dfe8a[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xc6'));}var _0x33b48a='\x22'+_0x3dfe8a[_0x5c3b('0x5e')]+'\x22';if(this[_0x5c3b('0x8b')](_0x3dfe8a[_0x5c3b('0x7d')])){_0x33b48a+=','+_0x3dfe8a[_0x5c3b('0x7d')];}var _0x598678=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xac'),_0x33b48a);if(_0x598678[_0x5c3b('0xa4')]===-0x1){return _0x598678;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xad'),_0x33b48a));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc7')]=function(_0x1013c9){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xc8'),_0x1013c9[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1013c9[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20text\x20configured');}var _0x48c0ef='\x22'+_0x1013c9['text']+'\x22';if(this[_0x5c3b('0x8b')](_0x1013c9['options'])){_0x48c0ef+=','+_0x1013c9[_0x5c3b('0x7d')];}var _0x37ea39=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xac'),_0x48c0ef);if(_0x37ea39[_0x5c3b('0xa4')]===-0x1){return _0x37ea39;}return this['channel']['noop'](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x48c0ef));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc9')]=function(_0x59450c){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xca'),_0x59450c[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x59450c['grammar'])){return this[_0x5c3b('0xe')]['noop']('no\x20grammar\x20configured');}var _0x338dd3=_0x59450c[_0x5c3b('0xb0')];if(this['isConfigured'](_0x59450c['options'])){_0x338dd3+=','+_0x59450c[_0x5c3b('0x7d')];}var _0x3e9fb6=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xcb'),_0x338dd3);if(_0x3e9fb6[_0x5c3b('0xa4')]===-0x1){return _0x3e9fb6;}var _0x3178aa=this[_0x5c3b('0xa3')](_0x5c3b('0xb2'),_0x5c3b('0xcc'));if(_0x3178aa[_0x5c3b('0xa4')]===-0x1){return _0x3178aa;}var _0x373abf=this[_0x5c3b('0xa3')](_0x5c3b('0xb4'),_0x5c3b('0xcd'));if(_0x373abf[_0x5c3b('0xa4')]===-0x1){return _0x373abf;}var _0x7d50ce=this['getAndSetVariable'](_0x5c3b('0xb5'),_0x5c3b('0xce'));if(_0x7d50ce[_0x5c3b('0xa4')]===-0x1){return _0x7d50ce;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x338dd3));};AGIVertices['prototype'][_0x5c3b('0xcf')]=function(_0x2cb19f){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xd0'),_0x2cb19f['label']));if(!this[_0x5c3b('0x8b')](_0x2cb19f[_0x5c3b('0xb0')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xb1'));}var _0xd36cc7=_0x2cb19f[_0x5c3b('0xb0')];if(this[_0x5c3b('0x8b')](_0x2cb19f['options'])){_0xd36cc7+=','+_0x2cb19f[_0x5c3b('0x7d')];}var _0x5042a8=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xcb'),_0xd36cc7);if(_0x5042a8[_0x5c3b('0xa4')]===-0x1){return _0x5042a8;}var _0x109666=this['getAndSetVariable'](_0x5c3b('0xb2'),_0x5c3b('0xd1'));if(_0x109666[_0x5c3b('0xa4')]===-0x1){return _0x109666;}var _0x188b60=this['getAndSetVariable'](_0x5c3b('0xb4'),_0x5c3b('0xd2'));if(_0x188b60[_0x5c3b('0xa4')]===-0x1){return _0x188b60;}var _0x3e3eaf=this[_0x5c3b('0xa3')](_0x5c3b('0xb5'),_0x5c3b('0xd3'));if(_0x3e3eaf[_0x5c3b('0xa4')]===-0x1){return _0x3e3eaf;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xd4'),_0xd36cc7));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xd5')]=function(_0x23f2b0){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x23f2b0[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x23f2b0['odbc_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x23f2b0,_0x5c3b('0xd6'));}var _0x475c02=this[_0x5c3b('0x18')][_0x5c3b('0x75')](this,_0x23f2b0['odbc_id']);if(!_0x475c02){return this['channel'][_0x5c3b('0x2f')](_0x23f2b0,_0x5c3b('0xd7'));}if(!this[_0x5c3b('0x8b')](_0x23f2b0['query'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x23f2b0,'no\x20query\x20configured');}var _0x3db045=_0x23f2b0[_0x5c3b('0x31')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xd8'),_0x3db045));var _0x503b0b=this[_0x5c3b('0x2e')]['sync'](this,_0x475c02,_0x3db045);this[_0x5c3b('0x37')]['sync'](this,_0x23f2b0,_0x3db045);if(!this[_0x5c3b('0x8b')](_0x23f2b0['variable_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xd9'));}var _0x2c6ef3=this[_0x5c3b('0x11')]['sync'](this,_0x23f2b0['variable_id']);if(!_0x2c6ef3){return this[_0x5c3b('0xe')]['error'](_0x23f2b0,_0x5c3b('0xda'));}var _0x2e7eeb=this;_0x503b0b[_0x5c3b('0xdb')](function(_0x8ec582,_0x1545b6){Object[_0x5c3b('0xdc')](_0x8ec582)[_0x5c3b('0xdb')](function(_0x5d8908){_0x2e7eeb[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0xdd'),_0x2c6ef3,_0x1545b6,_0x5d8908),_0x8ec582[_0x5d8908]);});});this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')]('%s_ROWS_COUNT',_0x2c6ef3),_0x503b0b[_0x5c3b('0x9d')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xde'),_0x2c6ef3));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xdf')]=function(_0x1b96a3){logger['debug'](util['format'](_0x5c3b('0xe0'),_0x1b96a3[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1b96a3[_0x5c3b('0xe1')])){return this[_0x5c3b('0xe')]['error'](_0x1b96a3,_0x5c3b('0xe2'));}var _0x4ff854=this[_0x5c3b('0xe3')][_0x5c3b('0x75')](this,_0x1b96a3['sip_id']);if(!_0x4ff854){return this['channel'][_0x5c3b('0x2f')](_0x1b96a3,_0x5c3b('0xe4'));}var _0x52fd43=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xe5'),[util['format']('SIP/%s',_0x4ff854),_0x1b96a3['timeout'],_0x1b96a3[_0x5c3b('0xe6')],_0x1b96a3[_0x5c3b('0x67')]]);if(_0x52fd43[_0x5c3b('0xa4')]===-0x1){return _0x52fd43;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xe7')]=function(_0x534b31){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xe8'),_0x534b31['label']));if(!this[_0x5c3b('0x8b')](_0x534b31[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xe9'));}if(!this[_0x5c3b('0x8b')](_0x534b31[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x534b31);this[_0x5c3b('0x44')](_0x534b31['text'],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xeb'),_0x534b31[_0x5c3b('0x5e')]));var _0x235644=this[_0x5c3b('0x7e')][_0x5c3b('0x75')](this,_0x534b31);if(_0x235644){for(var _0x7604aa in _0x235644){if(_0x235644['hasOwnProperty'](_0x7604aa)){this[_0x5c3b('0xe')]['setVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0xec'),_0x7604aa['toUpperCase']()),_0x235644[_0x7604aa]);}}this[_0x5c3b('0x44')](_0x235644[_0x5c3b('0xed')],_0x5c3b('0xee'),'dialogflow','');return this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xef'),_0x235644['speech']));}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x534b31,_0x5c3b('0xf0'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xf1')]=function(_0x3f273b){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3f273b[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x3f273b[_0x5c3b('0x81')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xf2'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x82')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xf3'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x83')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f273b[_0x5c3b('0x84')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xf4'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x3f273b);this[_0x5c3b('0x44')](_0x3f273b['text'],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xf5'),_0x3f273b[_0x5c3b('0x5e')]));var _0x4dfccb=this[_0x5c3b('0x80')][_0x5c3b('0x75')](this,_0x3f273b);if(_0x4dfccb){for(var _0x2266ee in _0x4dfccb){if(_0x4dfccb[_0x5c3b('0x97')](_0x2266ee)){if(_0x2266ee!==_0x5c3b('0xf6')){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0xec'),_0x2266ee[_0x5c3b('0x6e')]()),_0x4dfccb[_0x2266ee]);}}}this['createSquareMessage'](_0x4dfccb[_0x5c3b('0xed')],'out',_0x5c3b('0xf1'),_0x4dfccb[_0x5c3b('0xf6')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xf7'),_0x4dfccb[_0x5c3b('0xed')]));}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x3f273b,_0x5c3b('0xf8'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xf9')]=function(_0x6603b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xfa'),_0x6603b8['label']));if(!this[_0x5c3b('0x8b')](_0x6603b8['ndauth_url'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xfb'));}if(!this[_0x5c3b('0x8b')](_0x6603b8['username'])){return this['channel'][_0x5c3b('0xab')]('no\x20username\x20configured');}if(!this[_0x5c3b('0x8b')](_0x6603b8[_0x5c3b('0xfc')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xfd'));}if(!this[_0x5c3b('0x8b')](_0x6603b8['ndassistant_url'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')]['bot']=!![];this[_0x5c3b('0x37')](_0x6603b8);this[_0x5c3b('0x44')](_0x6603b8[_0x5c3b('0x5e')],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xfe'),_0x6603b8[_0x5c3b('0x5e')]));var _0x4896d2=this[_0x5c3b('0x85')][_0x5c3b('0x75')](this,_0x6603b8);if(_0x4896d2){for(var _0x5d7f80 in _0x4896d2){if(_0x4896d2[_0x5c3b('0x97')](_0x5d7f80)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0xff'),_0x5d7f80[_0x5c3b('0x6e')]()),_0x4896d2[_0x5d7f80]);}}this['createSquareMessage'](_0x4896d2[_0x5c3b('0xed')],_0x5c3b('0xee'),'sesteknda','');if(_0x4896d2[_0x5c3b('0x100')]){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x4896d2['audiofile']));var _0x25384f=this[_0x5c3b('0xe')]['streamFile'](_0x4896d2[_0x5c3b('0x100')]);try{fs[_0x5c3b('0x101')](_0x4896d2[_0x5c3b('0x100')]+_0x5c3b('0x102'));}catch(_0x272740){logger['error'](_0x272740);}return _0x25384f;}else{return this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0x103'),_0x4896d2[_0x5c3b('0xed')]));}}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x6603b8,_0x5c3b('0x104'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x105')]=function(_0x117c27){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x106'),_0x117c27[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0x105'));};AGIVertices[_0x5c3b('0x10')]['ext_dial']=function(_0x2a7477){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2a7477[_0x5c3b('0x38')]));var _0x2316d4='';if(_0x2a7477[_0x5c3b('0x107')]){if(!this[_0x5c3b('0x8b')](_0x2a7477[_0x5c3b('0x107')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2a7477,'no\x20trunk\x20selected');}else{var _0x1447b0=parseInt(_0x2a7477[_0x5c3b('0x107')],0xa);if(isNaN(_0x1447b0)){_0x2316d4=_0x2a7477[_0x5c3b('0x107')];}else{_0x2316d4=this[_0x5c3b('0x1d')][_0x5c3b('0x75')](this,_0x2a7477[_0x5c3b('0x107')]);if(!_0x2316d4){return this['channel'][_0x5c3b('0x2f')](_0x2a7477,_0x5c3b('0x108'));}}}}else if(_0x2a7477['trunk_name']){_0x2316d4=_0x2a7477['trunk_name'];}else{return this[_0x5c3b('0xe')]['error'](_0x2a7477,_0x5c3b('0x109'));}var _0x416305=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xe5'),[util[_0x5c3b('0x2c')]('SIP/%s/%s',_0x2316d4,_0x2a7477[_0x5c3b('0x4b')]),_0x2a7477['timeout'],_0x2a7477[_0x5c3b('0xe6')],_0x2a7477[_0x5c3b('0x67')]]);if(_0x416305[_0x5c3b('0xa4')]===-0x1){return _0x416305;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x10a'),_0x5c3b('0xe5')));};AGIVertices['prototype'][_0x5c3b('0x10b')]=function(_0xb1ef21){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x10c'),_0xb1ef21[_0x5c3b('0x38')]));return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x10b'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc')]=function(_0x457b22){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x457b22[_0x5c3b('0x38')]));if(_0x457b22[_0x5c3b('0xa7')]===0x0){return this['maxRetry'](_0x457b22);}_0x457b22[_0x5c3b('0xa7')]-=0x1;if(!this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x10d')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x457b22,_0x5c3b('0x10e'));}var _0x4cb411=this['getSound'][_0x5c3b('0x75')](this,_0x457b22[_0x5c3b('0x10d')]);if(!_0x4cb411){return this['channel'][_0x5c3b('0x2f')](_0x457b22,'no\x20file\x20audio\x20found');}if(!this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x10f')])){return this['channel'][_0x5c3b('0x2f')](_0x5c3b('0xd9'));}var _0x4ede76=this['channel'][_0x5c3b('0x110')](_0x4cb411,_0x457b22[_0x5c3b('0x111')],_0x457b22['maxdigit']);var _0x2f4cc9=_0x4ede76['result']?_0x4ede76[_0x5c3b('0xa4')][_0x5c3b('0x112')]():'';logger[_0x5c3b('0x32')](_0x5c3b('0x113'),JSON[_0x5c3b('0x79')](_0x4ede76));if(_0x4ede76[_0x5c3b('0xa4')]===-0x1){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x2f4cc9);return _0x4ede76;}else if(_0x4ede76[_0x5c3b('0xa6')]==='timeout'){_0x4ede76[_0x5c3b('0xa4')]=_0x2f4cc9[_0x5c3b('0x9d')]>=parseInt(_0x457b22[_0x5c3b('0x114')])?'x':'i';}else{_0x4ede76['result']=_0x2f4cc9[_0x5c3b('0x9d')]>=parseInt(_0x457b22[_0x5c3b('0x114')])&&_0x2f4cc9[_0x5c3b('0x9d')]<=parseInt(_0x457b22[_0x5c3b('0x115')])?'x':'i';}var _0x489b75=this[_0x5c3b('0x11')]['sync'](this,_0x457b22['variable_id']);if(!_0x489b75){return this['channel'][_0x5c3b('0x2f')](_0x457b22,_0x5c3b('0xda'));}this['channel'][_0x5c3b('0xa0')](_0x489b75,_0x2f4cc9);if(this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x116')])){var _0x219b51=parseInt(_0x457b22[_0x5c3b('0x116')],0xa);var _0xed16d7=rs[_0x5c3b('0x117')]({'charset':'*','length':_0x219b51});var _0x1f68e0=_0x2f4cc9[_0x5c3b('0x9d')];if(_0x1f68e0>0x0){if(_0x1f68e0>_0x219b51){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x457b22[_0x5c3b('0x118')]===_0x5c3b('0x119')?_0xed16d7+_0x2f4cc9['substr'](_0x219b51):_0x2f4cc9[_0x5c3b('0x11a')](0x0,_0x1f68e0-_0x219b51)+_0xed16d7);}else{this[_0x5c3b('0x37')]['sync'](this,_0x457b22,rs[_0x5c3b('0x117')]({'charset':'*','length':_0x1f68e0}));}}else{this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x457b22,'');}}else{this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x2f4cc9);}return _0x4ede76;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xd')]=function(_0x294412){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x294412[_0x5c3b('0x38')]));return this[_0x5c3b('0xc')](_0x294412);};AGIVertices[_0x5c3b('0x10')]['goal']=function(_0x62db8d){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x11b'),_0x62db8d['label']));this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x62db8d,_0x62db8d[_0x5c3b('0x11c')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x11d'),_0x62db8d[_0x5c3b('0x11c')]));};AGIVertices[_0x5c3b('0x10')]['awspolly']=function(_0x2e1060){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2e1060[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x11e')])||!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x11f')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x120'));}if(!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x121'),_0x2e1060[_0x5c3b('0x5e')]));var _0x445823=this[_0x5c3b('0x8d')]['sync'](this,_0x2e1060);if(_0x445823){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x122'),_0x445823));var _0x1c9142=this[_0x5c3b('0xe')][_0x5c3b('0x123')](_0x445823);try{fs[_0x5c3b('0x101')](_0x445823+'.wav');}catch(_0x4a41b4){logger[_0x5c3b('0x2f')](_0x4a41b4);}return _0x1c9142;}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2e1060,_0x5c3b('0x124'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x125')]=function(_0x59069b){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x126'),_0x59069b[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x11e')])||!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x11f')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x120'));}if(!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x127')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x128'));}if(!this[_0x5c3b('0x8b')](_0x59069b['text'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x59069b);this[_0x5c3b('0x44')](_0x59069b[_0x5c3b('0x5e')],'in','','');this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x129'),_0x59069b[_0x5c3b('0x5e')]));var _0x2e5be3=this[_0x5c3b('0x90')][_0x5c3b('0x75')](this,_0x59069b);if(_0x2e5be3){for(var _0x2e27ec in _0x2e5be3){if(_0x2e5be3[_0x5c3b('0x97')](_0x2e27ec)&&_[_0x5c3b('0x98')](_0x2e5be3[_0x2e27ec])){this['channel']['setVariable'](util[_0x5c3b('0x2c')]('AWS_LEX_%s',_0x2e27ec[_0x5c3b('0x6e')]()),_0x2e5be3[_0x2e27ec]);}}if(_[_0x5c3b('0x47')](_0x2e5be3['message'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x12a'));}else{this[_0x5c3b('0x44')](_0x2e5be3[_0x5c3b('0x7b')],_0x5c3b('0xee'),_0x5c3b('0x12b'),'');return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x12c'),_0x2e5be3[_0x5c3b('0x7b')]));}}return this[_0x5c3b('0xe')]['error'](_0x59069b,_0x5c3b('0x12d'));};AGIVertices[_0x5c3b('0x10')]['googleasr']=function(_0x47b3e5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x12e'),_0x47b3e5[_0x5c3b('0x38')],_0x47b3e5[_0x5c3b('0x69')]));if(!this['isConfigured'](_0x47b3e5[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20key\x20configured');}var _0x4ad6b0='wav';var _0x53e152=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x2600cb=util[_0x5c3b('0x2c')](_0x5c3b('0x9f'),_0x53e152,_0x4ad6b0);var _0x5c7d43=!![];if(_0x47b3e5[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0x5c7d43=![];}var _0xbbbc54=this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x53e152,_0x4ad6b0,_0x47b3e5['intKey'],_0x47b3e5[_0x5c3b('0x69')],undefined,_0x5c7d43);if(_0xbbbc54[_0x5c3b('0xa4')]!==-0x1){this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x133'),_0x2600cb));var _0x2cc728=this[_0x5c3b('0x91')]['sync'](this,_0x47b3e5,_0x2600cb);if(_0x2cc728){for(var _0x3b634c in _0x2cc728){if(_0x2cc728[_0x5c3b('0x97')](_0x3b634c)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')]('GOOGLE_ASR_%s',_0x3b634c[_0x5c3b('0x6e')]()),_0x2cc728[_0x3b634c]);}}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x134'),JSON[_0x5c3b('0x79')](_0x2cc728)));}}return _0xbbbc54;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x135')]=function(_0x501b65){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x136'),_0x501b65[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x501b65[_0x5c3b('0x137')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x138'));}if(!this[_0x5c3b('0x8b')](_0x501b65[_0x5c3b('0x94')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x139'));}var _0x1c3d0a=_0x5c3b('0x13a');var _0x1b7bc2=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs[_0x5c3b('0x117')](0x4));var _0x5ce30d=util['format']('%s.%s',_0x1b7bc2,_0x1c3d0a);var _0xdc488b=!![];if(_0x501b65[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0xdc488b=![];}var _0x251eee=this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x1b7bc2,_0x1c3d0a,_0x501b65['intKey'],_0x501b65['timeout'],undefined,_0xdc488b);if(_0x251eee[_0x5c3b('0xa4')]!==-0x1){this['channel']['noop'](util[_0x5c3b('0x2c')]('tilde\x20%s\x20file\x20created',_0x5ce30d));var _0x4faec6=this['tildeASR']['sync'](this,_0x501b65,_0x5ce30d);if(_0x4faec6){for(var _0x5a9768 in _0x4faec6){if(_0x4faec6['hasOwnProperty'](_0x5a9768)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0x13b'),_0x5a9768[_0x5c3b('0x6e')]()),_0x4faec6[_0x5a9768]);}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x5c3b('0x79')](_0x4faec6)));}}return _0x251eee;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x13c')]=function(_0x594962){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x594962[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')][_0x5c3b('0x13d')](_0x594962[_0x5c3b('0x3f')],_0x594962[_0x5c3b('0x40')],_0x594962['priority']);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x13e')]=function(_0x2f0d53){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2f0d53[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x2f0d53['condition'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2f0d53,_0x5c3b('0x13f'));}try{var _0xed4304=eval(_0x2f0d53[_0x5c3b('0x140')])?_0x5c3b('0x141'):_0x5c3b('0x142');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2f0d53['condition'],_0xed4304));return{'code':0xc8,'result':_0xed4304};}catch(_0x5c7cba){return{'code':0xc8,'result':_0x5c3b('0x142')};}};AGIVertices[_0x5c3b('0x10')]['gotoiftime']=function(_0x1808c4){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1808c4[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1808c4[_0x5c3b('0x143')])){return this['channel']['error'](_0x1808c4,'no\x20interval\x20configured');}var _0x16854e=this['getIntervals'][_0x5c3b('0x75')](this,_0x1808c4[_0x5c3b('0x143')]);if(!_0x16854e){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x1808c4,_0x5c3b('0x144'));}for(var _0x177199=0x0;_0x177199<_0x16854e[_0x5c3b('0x9d')];_0x177199+=0x1){var _0x3c7e74=this[_0x5c3b('0xe')]['getVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0x145'),_0x16854e[_0x177199]));if(_0x3c7e74['result']===-0x1){return _0x3c7e74;}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x3c7e74[_0x5c3b('0xa6')]));if(_0x3c7e74[_0x5c3b('0xa6')]===_0x5c3b('0x141')){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x141')));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('IFTIME\x20%s\x20%s',_0x16854e[_0x177199],'true'));return{'code':0xc8,'result':_0x5c3b('0x141')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x142')));this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x142')));}}return{'code':0xc8,'result':_0x5c3b('0x142')};};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x147')]=function(_0x3851d8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x148'),_0x3851d8['label']));return this[_0x5c3b('0xe')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x108f79){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x108f79[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x108f79[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xe9'));}var _0x424311='wav';var _0x41c6f2=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs[_0x5c3b('0x117')](0x4));var _0x2a090f=util['format']('%s.%s',_0x41c6f2,_0x424311);var _0x48ea9c=!![];if(_0x108f79[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0x48ea9c=![];}var _0x142510=this['channel'][_0x5c3b('0x132')](_0x41c6f2,_0x424311,_0x108f79[_0x5c3b('0x149')],_0x108f79[_0x5c3b('0x69')],undefined,_0x48ea9c);if(_0x142510[_0x5c3b('0xa4')]!==-0x1){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('ispeech\x20%s\x20file\x20created',_0x2a090f));var _0x2afa41=this['ispeechASR'][_0x5c3b('0x75')](this,_0x108f79,_0x2a090f);if(_0x2afa41){for(var _0x43d1d8 in _0x2afa41){if(_0x2afa41[_0x5c3b('0x97')](_0x43d1d8)){this['channel']['setVariable'](util[_0x5c3b('0x2c')]('ISPEECH_ASR_%s',_0x43d1d8[_0x5c3b('0x6e')]()),_0x2afa41[_0x43d1d8]);}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x2afa41)));}}return _0x142510;};AGIVertices[_0x5c3b('0x10')]['ispeechtts']=function(_0x329154){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x14a'),_0x329154['label']));if(!this[_0x5c3b('0x8b')](_0x329154[_0x5c3b('0x87')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x5c3b('0x8b')](_0x329154[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x329154[_0x5c3b('0x5e')]));var _0x1d8a78=this[_0x5c3b('0x86')][_0x5c3b('0x75')](this,_0x329154);if(_0x1d8a78){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x14b'),_0x1d8a78));var _0x494278=this[_0x5c3b('0xe')][_0x5c3b('0x123')](_0x1d8a78,_0x329154['intKey']);try{fs[_0x5c3b('0x101')](_0x1d8a78+'.wav');}catch(_0x54f850){logger['error'](_0x54f850);}return _0x494278;}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x329154,_0x5c3b('0x14c'));};AGIVertices['prototype'][_0x5c3b('0x14d')]=function(_0x19fd30){logger[_0x5c3b('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x19fd30[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x19fd30[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x19fd30,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x19fd30['findBy']));var _0x420b29=this[_0x5c3b('0x56')][_0x5c3b('0x75')](this,_0x19fd30[_0x5c3b('0x14e')]);if(_0x420b29){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0x150'),this['channel'][_0x5c3b('0x3b')],_0x19fd30[_0x5c3b('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x5c3b('0x152')]=function(_0x3dfa02){logger[_0x5c3b('0x32')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3dfa02['label']));if(!this['isConfigured'](_0x3dfa02[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x3dfa02,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x153'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));var _0xe5348f=this['agentLogout'][_0x5c3b('0x75')](this,_0x3dfa02[_0x5c3b('0x14e')]);if(_0xe5348f){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02['findBy']));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x156')]=function(_0x5614b5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5614b5[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x5614b5[_0x5c3b('0x157')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5614b5,_0x5c3b('0x158'));}this[_0x5c3b('0xe')]['noop'](util['format']('math\x20%s',_0x5614b5[_0x5c3b('0x157')]));var _0xf13a64=eval(_0x5614b5['operation']);if(!this[_0x5c3b('0x8b')](_0x5614b5[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xd9'));}var _0xa11287=this['getVariable']['sync'](this,_0x5614b5['variable_id']);if(!_0xa11287){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5614b5,_0x5c3b('0xda'));}if(_[_0x5c3b('0x9c')](_0xf13a64)){var _0x2d2641=this;_0xf13a64['forEach'](function(_0x156015,_0x2af607){_0x2d2641['channel'][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0x159'),_0xa11287,_0x2af607),_0x156015);});return this['channel'][_0x5c3b('0xab')](util['format'](_0x5c3b('0x15a'),_0xa11287));}else{return this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0xa11287,_0xf13a64);}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xb')]=function(_0xc487a0){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x15b'),_0xc487a0[_0x5c3b('0x38')]));if(_0xc487a0['retry']===0x0){return this[_0x5c3b('0xa8')](_0xc487a0);}_0xc487a0[_0x5c3b('0xa7')]-=0x1;if(!this[_0x5c3b('0x8b')](_0xc487a0['file_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xc487a0,_0x5c3b('0x10e'));}var _0xaafa8b=this['getSound'][_0x5c3b('0x75')](this,_0xc487a0[_0x5c3b('0x10d')]);if(!_0xaafa8b){return this[_0x5c3b('0xe')]['error'](_0xc487a0,_0x5c3b('0x15c'));}var _0x1c66f4=this[_0x5c3b('0xe')][_0x5c3b('0x110')](_0xaafa8b,_0xc487a0[_0x5c3b('0x111')],_0xc487a0[_0x5c3b('0x15d')]);var _0x344f47=_0x1c66f4[_0x5c3b('0xa4')];if(_0x1c66f4[_0x5c3b('0xa4')]===-0x1){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0xc487a0,'-1');return _0x1c66f4;}else if(_0x1c66f4['extra']===_0x5c3b('0x69')){_0x1c66f4[_0x5c3b('0xa4')]=_0x1c66f4[_0x5c3b('0xa4')][_0x5c3b('0x9d')]>0x0?_0x1c66f4['result']:'t';}else if(_[_0x5c3b('0x46')](_0x1c66f4[_0x5c3b('0xa4')])){_0x1c66f4[_0x5c3b('0xa4')]='#';_0x344f47='#';}if(!this[_0x5c3b('0x8b')](_0xc487a0['variable_id'])){this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xd9'));}else{var _0x1ff3d6=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0xc487a0[_0x5c3b('0x10f')]);if(!_0x1ff3d6){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xc487a0,_0x5c3b('0xda'));}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x1ff3d6,_0x344f47);}this['createSquareDetailsReport']['sync'](this,_0xc487a0,_0x344f47);return _0x1c66f4;};AGIVertices['prototype'][_0x5c3b('0xab')]=function(_0x2c160e){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x15e'),_0x2c160e[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['noop'](_0x2c160e['output']||_0x2c160e[_0x5c3b('0x38')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x15f')]=function(_0x1b43b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1b43b8['label']));if(!this[_0x5c3b('0x8b')](_0x1b43b8[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x1b43b8,'no\x20find\x20by\x20configured');}logger[_0x5c3b('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8[_0x5c3b('0x14e')]));var _0x472259=this[_0x5c3b('0x160')][_0x5c3b('0x75')](this,_0x1b43b8[_0x5c3b('0x161')]);var _0x42831b=this[_0x5c3b('0x51')][_0x5c3b('0x75')](this,_0x1b43b8[_0x5c3b('0x14e')],_0x472259);if(_0x42831b){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x1b43b8[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x1b43b8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8['findBy']));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x162')]=function(_0x556eb3){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x163'),_0x556eb3[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x556eb3['file_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x556eb3,_0x5c3b('0x10e'));}var _0x4057ea=this['getSound'][_0x5c3b('0x75')](this,_0x556eb3[_0x5c3b('0x10d')]);if(!_0x4057ea){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x556eb3,_0x5c3b('0x15c'));}var _0x149282=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0x164'),[_0x4057ea,_0x556eb3['opts']]);if(_0x149282[_0x5c3b('0xa4')]===-0x1){return _0x149282;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20%s\x20%s',_0x5c3b('0x164'),_0x4057ea));};AGIVertices['prototype']['queue']=function(_0x52359b){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x165'),_0x52359b['label']));if(!this[_0x5c3b('0x8b')](_0x52359b[_0x5c3b('0x166')])){return this['channel'][_0x5c3b('0x2f')](_0x52359b,_0x5c3b('0x167'));}var _0x5e0ff0='';var _0x9634b4=parseInt(_0x52359b[_0x5c3b('0x166')],0xa);if(isNaN(_0x9634b4)){_0x5e0ff0=_0x52359b[_0x5c3b('0x166')];}else{_0x5e0ff0=this['getVoiceQueue'][_0x5c3b('0x75')](this,_0x52359b[_0x5c3b('0x166')]);if(!_0x5e0ff0){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x52359b,'no\x20queue\x20found');}}var _0xdb8f78='';if(this['isConfigured'](_0x52359b[_0x5c3b('0x10d')])){var _0x41d242=this[_0x5c3b('0x1f')][_0x5c3b('0x75')](this,_0x52359b[_0x5c3b('0x10d')]);if(_0x41d242){_0xdb8f78=_0x41d242;}}this[_0x5c3b('0x37')]['sync'](this,_0x52359b,_0x5e0ff0);if(_0x52359b['opts'][_0x5c3b('0x168')]('x')<0x0){_0x52359b[_0x5c3b('0xe6')]+='x';}if(_0x52359b[_0x5c3b('0xe6')]['indexOf']('X')<0x0){_0x52359b[_0x5c3b('0xe6')]+='X';}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x5c3b('0x169'),_0x5e0ff0?_0x5e0ff0[_0x5c3b('0x16a')]():'');var _0x1eef37=this['channel'][_0x5c3b('0x58')](_0x5c3b('0x16b'),[_0x5e0ff0,_0x52359b[_0x5c3b('0xe6')],_0x52359b[_0x5c3b('0x67')],_0xdb8f78,_0x52359b[_0x5c3b('0x69')],_0x52359b[_0x5c3b('0x7')],_0x52359b[_0x5c3b('0x16c')],_0x52359b[_0x5c3b('0x16d')],'',_0x52359b[_0x5c3b('0x16e')]]);if(_0x1eef37[_0x5c3b('0xa4')]===-0x1){return _0x1eef37;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0x5c3b('0x16b'),_0x5e0ff0));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x16f')]=function(_0x1fb5a2){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x170'),_0x1fb5a2[_0x5c3b('0x38')]));var _0x50f23e=_0x1fb5a2[_0x5c3b('0x171')]||'wav';var _0x226055=util[_0x5c3b('0x2c')](_0x5c3b('0x172'),this['channel']['uniqueid'],rs[_0x5c3b('0x117')](0x5));var _0x2d10a2=util[_0x5c3b('0x2c')](_0x5c3b('0x173'),FILES_PATH,_0x226055,_0x50f23e);var _0x175da3=util[_0x5c3b('0x2c')]('%s/recordings/%s',FILES_PATH,_0x226055);this[_0x5c3b('0x3c')][_0x5c3b('0x75')](this,_0x1fb5a2,_0x226055,_0x2d10a2);this[_0x5c3b('0xe')]['setVariable'](_0x5c3b('0x174'),_0x226055);logger[_0x5c3b('0x32')](_0x5c3b('0x175'),_0x175da3,_0x50f23e,_0x1fb5a2[_0x5c3b('0x176')],_0x1fb5a2[_0x5c3b('0x69')]);return this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x175da3,_0x50f23e,_0x1fb5a2[_0x5c3b('0x176')],_0x1fb5a2[_0x5c3b('0x69')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x185c36){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x185c36[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x185c36[_0x5c3b('0x67')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0x177'));}var _0x1bba96=this['restAPI'][_0x5c3b('0x75')](this,_0x185c36);logger['info'](util[_0x5c3b('0x2c')]('Response:',util['inspect'](_0x1bba96,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x185c36['variable_id'])){return this['channel']['noop'](_0x5c3b('0x178'));}var _0x4a4864=this['getVariable'][_0x5c3b('0x75')](this,_0x185c36[_0x5c3b('0x10f')]);if(!_0x4a4864){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x185c36,_0x5c3b('0xda'));}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format']('%s_STATUS_CODE',_0x4a4864),_0x1bba96[_0x5c3b('0x7a')]?_0x1bba96[_0x5c3b('0x7a')]:_0x5c3b('0x179'));this['channel']['setVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0x17a'),_0x4a4864),_0x1bba96['statusMessage']?_0x1bba96[_0x5c3b('0x17b')]:'OK');if(_0x1bba96[_0x5c3b('0x6f')]){try{this[_0x5c3b('0x9e')](_0x1bba96[_0x5c3b('0x6f')],_0x4a4864);}catch(_0x2cac40){logger[_0x5c3b('0x2f')](util[_0x5c3b('0x2c')](_0x5c3b('0x17c'),_0x4a4864));}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('variable\x20%s\x20set',_0x4a4864));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x17d')]=function(_0x2d84cb){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x17e'),_0x2d84cb['label']));return this[_0x5c3b('0xe')][_0x5c3b('0x17f')](_0x2d84cb['digits'][_0x5c3b('0x5a')](/\s+/g,''),_0x2d84cb[_0x5c3b('0x176')]);};AGIVertices['prototype']['saynumber']=function(_0x10e2a9){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x10e2a9['label']));return this['channel'][_0x5c3b('0x180')](_0x10e2a9['number']['replace'](/\s+/g,''),_0x10e2a9['escape_digits']);};AGIVertices['prototype'][_0x5c3b('0x181')]=function(_0x28f043){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x28f043[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['sayPhonetic'](_0x28f043['text'],_0x28f043[_0x5c3b('0x176')]);};AGIVertices['prototype'][_0x5c3b('0x182')]=function(_0xe069bc){logger['info'](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xe069bc[_0x5c3b('0x38')]));if(!this['isConfigured'](_0xe069bc[_0x5c3b('0x183')])){return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x184'));}var _0x568abc=this['getMailAccount'][_0x5c3b('0x75')](this,_0xe069bc['account_id']);if(!_0x568abc||!_0x568abc[_0x5c3b('0x185')]){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xe069bc,_0x5c3b('0x186'));}var _0x463a0f={'from':util[_0x5c3b('0x2c')]('\x22%s\x22\x20<%s>',_0x568abc['name'],_0x568abc['email']||_0x568abc[_0x5c3b('0x185')][_0x5c3b('0x187')]),'to':_0xe069bc['to']||'','cc':_0xe069bc['cc']||'','bcc':_0xe069bc[_0x5c3b('0x188')]||'','subject':_0xe069bc[_0x5c3b('0x189')],'html':_0xe069bc[_0x5c3b('0x5e')],'text':_0xe069bc['text']};if(this[_0x5c3b('0x8b')](_0xe069bc[_0x5c3b('0x18a')])){}logger['debug'](_0x5c3b('0x18b'),JSON['stringify'](_0x463a0f));this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0xe069bc,_0xe069bc[_0x5c3b('0x183')]);this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x18c'),_0x568abc['name']));this[_0x5c3b('0x23')][_0x5c3b('0x75')](this,_0x568abc['smtpOptions'],_0x463a0f);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x18d')]=function(_0x4f462a){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x18e'),_0x4f462a[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x18f')]=function(_0xda477){logger['info'](util['format'](_0x5c3b('0x190'),_0xda477['label']));if(!this[_0x5c3b('0x8b')](_0xda477[_0x5c3b('0x191')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20sms\x20account\x20configured');}var _0x221883=this[_0x5c3b('0x192')][_0x5c3b('0x75')](this,_0xda477[_0x5c3b('0x191')]);if(!_0x221883){return this[_0x5c3b('0xe')]['error'](_0xda477,'no\x20sms\x20account\x20found');}var _0x2b2915={'body':_0xda477[_0x5c3b('0x193')],'phone':_0xda477['to']||'','SmsAccountId':_0x221883['id']};logger[_0x5c3b('0x194')](_0x5c3b('0x195'),JSON[_0x5c3b('0x79')](_0x2b2915));this[_0x5c3b('0x37')]['sync'](this,_0xda477,_0xda477[_0x5c3b('0x191')]);this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x196'),_0x221883[_0x5c3b('0x1c')]));this[_0x5c3b('0x36')]['sync'](this,_0x2b2915);return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x5c3b('0x197')]=function(_0x22a3aa){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x198'),_0x22a3aa[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x22a3aa[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x22a3aa,_0x5c3b('0x199'));}var _0xee3e54=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0x22a3aa['variable_id']);if(!_0xee3e54){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x22a3aa,_0x5c3b('0xda'));}return this[_0x5c3b('0xe')]['setVariable'](_0xee3e54,_0x22a3aa[_0x5c3b('0x19a')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x19b')]=function(_0x2fc40c){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x19c'),_0x2fc40c[_0x5c3b('0x38')]));this['channel'][_0x5c3b('0xab')](_0x5c3b('0x19d'));var _0x3ee9bd=this[_0x5c3b('0xe')]['getVariable']('XMCS-UNIQUEID');if(!_['isEmpty'](_0x3ee9bd[_0x5c3b('0xa6')])){this['channel'][_0x5c3b('0x3d')]=_0x3ee9bd[_0x5c3b('0xa6')];}if(_0x2fc40c['answer']===_0x5c3b('0x19e')){this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x19f'));return this[_0x5c3b('0xe')][_0x5c3b('0xb9')]();}return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x1a0'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1a1')]=function(_0x5603e5){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5603e5[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x5603e5[_0x5c3b('0x1a2')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5603e5,_0x5c3b('0x1a3'));}var _0x49fbe3=this[_0x5c3b('0x16')][_0x5c3b('0x75')](this,_0x5603e5[_0x5c3b('0x1a2')]);if(!this[_0x5c3b('0x8b')](_0x49fbe3)){return this['channel'][_0x5c3b('0x2f')](_0x5603e5,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5603e5[_0x5c3b('0x1a2')]));}if(_0x49fbe3===this[_0x5c3b('0xe')][_0x5c3b('0x3a')]){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5603e5,_0x5c3b('0x1a4'));}this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x5603e5,_0x49fbe3);var _0x42b2fc=this['channel'][_0x5c3b('0x58')](_0x5c3b('0x1a5'),util[_0x5c3b('0x2c')](_0x5c3b('0x1a6'),config[_0x5c3b('0x7')][_0x5c3b('0x1a7')]||_0x5c3b('0x1a8'),_0x49fbe3,this['channel'][_0x5c3b('0x3a')]));if(_0x42b2fc[_0x5c3b('0xa4')]===-0x1){return _0x42b2fc;}return this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x5c3b('0x1a5'),_0x49fbe3));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1a9')]=function(_0x40f1c1){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x1aa'),_0x40f1c1[_0x5c3b('0x38')]));var _0x3847ea=this[_0x5c3b('0x57')][_0x5c3b('0x75')](this,_0x40f1c1[_0x5c3b('0xb7')]);this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x40f1c1,_0x40f1c1[_0x5c3b('0xb7')]);if(this[_0x5c3b('0x8b')](_0x40f1c1[_0x5c3b('0x10f')])){var _0xa75377=this[_0x5c3b('0x11')]['sync'](this,_0x40f1c1['variable_id']);if(_0xa75377){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0xa75377,_0x3847ea);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x1ab'),_0x40f1c1[_0x5c3b('0xb7')],_0xa75377));}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x40f1c1[_0x5c3b('0xb7')]));};AGIVertices['prototype'][_0x5c3b('0x1ac')]=function(_0x4a67b7){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x1ad'),_0x4a67b7['label']));_0x4a67b7[_0x5c3b('0x5e')]=_0x4a67b7[_0x5c3b('0x5e')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5c3b('0x8b')](_0x4a67b7[_0x5c3b('0x5c')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x1ae'));}if(!this['isConfigured'](_0x4a67b7[_0x5c3b('0x5e')])){return this['channel'][_0x5c3b('0xab')]('no\x20text\x20configured');}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x1af'),_0x4a67b7[_0x5c3b('0x5e')]));var _0x39aebf=this[_0x5c3b('0x5b')][_0x5c3b('0x75')](this,_0x4a67b7);if(_0x39aebf){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x39aebf));var _0x11ae71=this[_0x5c3b('0xe')]['streamFile'](_0x39aebf);try{fs[_0x5c3b('0x101')](_0x39aebf+_0x5c3b('0x102'));}catch(_0x114716){logger['error'](_0x114716);}return _0x11ae71;}return this[_0x5c3b('0xe')]['error'](_0x4a67b7,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b0')]=function(_0x2059b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x1b1'),_0x2059b8[_0x5c3b('0x38')]));_0x2059b8[_0x5c3b('0x5e')]=_0x2059b8[_0x5c3b('0x5e')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5c3b('0x8b')](_0x2059b8[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b2'),_0x2059b8['text']));var _0x1a976b=this['googleTTS']['sync'](this,_0x2059b8);if(_0x1a976b){this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b3'),_0x1a976b));var _0x22f466=this[_0x5c3b('0xe')]['streamFile'](_0x1a976b);try{fs['unlink'](_0x1a976b+_0x5c3b('0x102'));}catch(_0x193905){logger[_0x5c3b('0x2f')](_0x193905);}return _0x22f466;}return this['channel']['error'](_0x2059b8,_0x5c3b('0x1b4'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b5')]=function(_0x491db8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x491db8['label']));if(!this[_0x5c3b('0x8b')](_0x491db8[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x491db8,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x153'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));var _0x56f8d6=this['agentUnpause'][_0x5c3b('0x75')](this,_0x491db8[_0x5c3b('0x14e')]);if(_0x56f8d6){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x150'),this['channel']['callerid'],_0x491db8[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x491db8['findBy']));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));this['channel']['noop'](util['format'](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b6')]=function(_0x2e276e){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b7'),_0x2e276e['label']));var _0x3ed01c=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0x1b8'),[_0x2e276e[_0x5c3b('0x1b9')],_0x2e276e[_0x5c3b('0x7d')]]);if(_0x3ed01c[_0x5c3b('0xa4')]===-0x1){return _0x3ed01c;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x5c3b('0x1b8'),_0x2e276e[_0x5c3b('0x1b9')]));};AGIVertices[_0x5c3b('0x10')]['vswitch']=function(_0x140d70){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x140d70[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x140d70[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')]['error'](_0x140d70,_0x5c3b('0x199'));}var _0x33e781=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0x140d70[_0x5c3b('0x10f')]);if(!_0x33e781){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x140d70,_0x5c3b('0xda'));}var _0x52ce01=this[_0x5c3b('0xe')][_0x5c3b('0x11')](_0x33e781);return{'code':0xc8,'result':_0x52ce01[_0x5c3b('0xa6')]?_0x52ce01['extra']:'-'};};String[_0x5c3b('0x10')][_0x5c3b('0xa2')]=function(_0x22e314,_0x569d0){return this['split'](_0x22e314)[_0x5c3b('0x1ba')](_0x569d0);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 720452b..f296986 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 _0xc4aa=['moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','message','stopAcw','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash'];(function(_0x47b1a9,_0x14e74f){var _0x1be6e2=function(_0x8c39be){while(--_0x8c39be){_0x47b1a9['push'](_0x47b1a9['shift']());}};_0x1be6e2(++_0x14e74f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var moment=require(_0xac4a('0x1'));var ami=require(_0xac4a('0x2'));var logger=require(_0xac4a('0x3'))(_0xac4a('0x4'));var RpcUser=require(_0xac4a('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5cda73){this['voiceQueues']=_0x5cda73[_0xac4a('0x6')];this[_0xac4a('0x7')]=_0x5cda73[_0xac4a('0x7')];this[_0xac4a('0x8')]=_0x5cda73[_0xac4a('0x8')];this[_0xac4a('0x9')]={};ami['on'](_0xac4a('0xa'),this[_0xac4a('0xb')]['bind'](this));ami['on']('hanguprequest',this[_0xac4a('0xc')][_0xac4a('0xd')](this));ami['on'](_0xac4a('0xe'),this['syncHangup'][_0xac4a('0xd')](this));ami['on'](_0xac4a('0xf'),this[_0xac4a('0x10')]['bind'](this));ami['on'](_0xac4a('0x11'),this['syncAttendedTransfer'][_0xac4a('0xd')](this));ami['on']('blindtransfer',this[_0xac4a('0x12')][_0xac4a('0xd')](this));ami['on'](_0xac4a('0x13'),this['syncAgentConnectPreview'][_0xac4a('0xd')](this));}function getDiff(_0x68424a){var _0x247b78=moment()[_0xac4a('0x14')](0x0);var _0x1b4313=moment(_0x68424a)[_0xac4a('0x14')](0x0);return _0x247b78[_0xac4a('0x15')](_0x1b4313,_0xac4a('0x16'));}Acw[_0xac4a('0x17')][_0xac4a('0x18')]=function(_0x11e101,_0x26dbb8){var _0x4a2119=this;var _0x402fff=getDiff(_0x4a2119[_0xac4a('0x8')][_0x11e101][_0xac4a('0x19')]);clearTimeout(_0x4a2119[_0xac4a('0x8')][_0x11e101][_0xac4a('0x1a')]);_0x4a2119[_0xac4a('0x8')][_0x11e101][_0xac4a('0x1a')]=![];return RpcVoiceAgentReport[_0xac4a('0x1b')]({'acwtime':_0x402fff},_0x4a2119['timers'][_0x11e101]['uniqueid'],_0x11e101)[_0xac4a('0x1c')](function(_0x13c8eb){logger[_0xac4a('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x26dbb8,_0x402fff,_0x13c8eb);})[_0xac4a('0x1e')](function(_0x15c223){logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x26dbb8,_0x15c223);})[_0xac4a('0x21')](function(){delete _0x4a2119[_0xac4a('0x8')][_0x11e101];});};Acw[_0xac4a('0x17')][_0xac4a('0x22')]=function(_0x534092){try{var _0x3d8f0a=this;var _0x3204ad=this['channels'][_0x534092][_0xac4a('0x23')];var _0x4169c0=this[_0xac4a('0x9')][_0x534092][_0xac4a('0x24')];var _0x4d2d6c=this[_0xac4a('0x6')][_0x4169c0];var _0x2503d8=![];var _0x15435c=_0xac4a('0x25');if(_0x4d2d6c[_0xac4a('0x26')]&&_0x4d2d6c[_0xac4a('0x27')][_0xac4a('0x28')]){_0x2503d8=!![];_0x15435c=_0x4d2d6c[_0xac4a('0x27')][_0xac4a('0x28')];}if(!_0x3d8f0a[_0xac4a('0x7')][_0x3204ad]){return Promise[_0xac4a('0x29')]();}return RpcUser[_0xac4a('0x2a')](_0x3d8f0a[_0xac4a('0x7')][_0x3204ad]['id'])[_0xac4a('0x1c')](function(_0x1c13dc){if(!_0x1c13dc||_0x1c13dc[_0xac4a('0x2b')]){logger['info'](_0xac4a('0x2c'),_0x534092,_0x3204ad,_0x4169c0);return;}logger[_0xac4a('0x1d')](_0xac4a('0x2d'),_0x534092,_0x3204ad,_0x4169c0);var _0x2772fe=_0x3d8f0a[_0xac4a('0x9')][_0x534092]['attended']&&_0x3d8f0a['channels'][_0x534092][_0xac4a('0x2e')]?_0x3d8f0a[_0xac4a('0x9')][_0x534092][_0xac4a('0x2e')]:_0x534092;return RpcUser['savePause'](_0x3d8f0a['agents'][_0x3204ad],_0x15435c,_0x2772fe);})[_0xac4a('0x1c')](function(_0x2896bc){if(_0x2503d8||!_0x2896bc){return;}_0x3d8f0a[_0xac4a('0x8')][_0x3204ad]={};logger[_0xac4a('0x1d')](_0xac4a('0x2f'),_0x534092,_0x3d8f0a['voiceQueues'][_0x4169c0][_0xac4a('0x30')],_0x3204ad,_0x4169c0);_0x3d8f0a['timers'][_0x3204ad][_0xac4a('0x1a')]=setTimeout(_0x3d8f0a['stopAcw'][_0xac4a('0xd')](_0x3d8f0a,_0x3204ad),_0x3d8f0a[_0xac4a('0x6')][_0x4169c0][_0xac4a('0x30')]*0x3e8);_0x3d8f0a[_0xac4a('0x8')][_0x3204ad][_0xac4a('0x19')]=moment()[_0xac4a('0x31')](_0xac4a('0x32'));_0x3d8f0a[_0xac4a('0x8')][_0x3204ad][_0xac4a('0x33')]=_0x534092;_0x3d8f0a[_0xac4a('0x8')][_0x3204ad][_0xac4a('0x24')]=_0x4169c0;_0x3d8f0a[_0xac4a('0x8')][_0x3204ad][_0xac4a('0x18')]=_0x3d8f0a[_0xac4a('0x18')]['bind'](_0x3d8f0a,_0x3204ad,_0x534092);})[_0xac4a('0x1e')](function(){logger[_0xac4a('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x534092,_0x3d8f0a[_0xac4a('0x6')][_0x4169c0][_0xac4a('0x30')],_0x3204ad,_0x4169c0);})['finally'](function(){delete _0x3d8f0a['channels'][_0x534092];});}catch(_0x11f0be){logger[_0xac4a('0x1f')](_0xac4a('0x34'),_0x11f0be[_0xac4a('0x35')]);}};Acw['prototype'][_0xac4a('0x36')]=function(_0x2e56c6){try{var _0x4e7630=this;if(_0x4e7630[_0xac4a('0x8')][_0x2e56c6]){_0x4e7630[_0xac4a('0x8')][_0x2e56c6][_0xac4a('0x1a')]=![];var _0x5f0eb8=_0x4e7630[_0xac4a('0x8')][_0x2e56c6][_0xac4a('0x33')];var _0x1b5427=_0x4e7630['timers'][_0x2e56c6][_0xac4a('0x24')];var _0x2e76e3=_0x4e7630['voiceQueues'][_0x1b5427]['acwTimeout'];logger[_0xac4a('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x5f0eb8,_0x2e56c6);RpcUser['saveUnpause'](this['agents'][_0x2e56c6]);RpcVoiceAgentReport['update']({'acwtime':_0x2e76e3,'agentacw':!![]},_0x5f0eb8,_0x2e56c6)[_0xac4a('0x1c')](function(_0x2bf8e8){logger[_0xac4a('0x1d')](_0xac4a('0x37'),_0x5f0eb8,_0x2e76e3,_0x2bf8e8);})[_0xac4a('0x1e')](function(_0x415f31){logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x5f0eb8,_0x415f31);});}else{logger[_0xac4a('0x1f')](_0xac4a('0x38'),_0x2e56c6);if(_0x4e7630[_0xac4a('0x8')]){logger[_0xac4a('0x1d')]('[ACW][TIMERS]',JSON['stringify'](_0x4e7630['timers']));}}}catch(_0x1e1cc5){logger[_0xac4a('0x1f')](_0xac4a('0x39'),_0x1e1cc5[_0xac4a('0x35')]);}};Acw[_0xac4a('0x17')][_0xac4a('0xb')]=function(_0x8febf0){try{if(this[_0xac4a('0x6')][_0x8febf0[_0xac4a('0x24')]]&&(this[_0xac4a('0x6')][_0x8febf0['queue']][_0xac4a('0x4')]||this[_0xac4a('0x6')][_0x8febf0[_0xac4a('0x24')]][_0xac4a('0x26')])){if(this[_0xac4a('0x7')][_0x8febf0['interface']]){this[_0xac4a('0x9')][_0x8febf0[_0xac4a('0x33')]]={'queue':_0x8febf0['queue'],'interface':_0x8febf0[_0xac4a('0x23')],'destlinkedid':_0x8febf0['destlinkedid']};}}}catch(_0x3dd0f8){logger[_0xac4a('0x1f')](_0xac4a('0x3a'),_0x3dd0f8[_0xac4a('0x35')]);}};Acw[_0xac4a('0x17')][_0xac4a('0x3b')]=function(_0xe54edf){try{if(this[_0xac4a('0x6')][_0xe54edf[_0xac4a('0x24')]]&&(this[_0xac4a('0x6')][_0xe54edf[_0xac4a('0x24')]][_0xac4a('0x4')]||this['voiceQueues'][_0xe54edf[_0xac4a('0x24')]][_0xac4a('0x26')])){if(this[_0xac4a('0x7')][_0xe54edf['interface']]){this[_0xac4a('0x9')][_0xe54edf[_0xac4a('0x33')]]={'queue':_0xe54edf['queue'],'interface':_0xe54edf[_0xac4a('0x23')]};}}}catch(_0x5a7f6e){logger[_0xac4a('0x1f')](_0xac4a('0x3c'),_0x5a7f6e[_0xac4a('0x35')]);}};Acw['prototype']['syncHangupRequest']=function(_0x42fd9d){try{if(this['channels'][_0x42fd9d[_0xac4a('0x33')]]&&_['isUndefined'](this[_0xac4a('0x9')][_0x42fd9d['uniqueid']][_0xac4a('0x3d')])){logger[_0xac4a('0x1d')](_0xac4a('0x3e'),_0x42fd9d[_0xac4a('0x33')]);this['startAcw'](_0x42fd9d[_0xac4a('0x33')]);}else if(this[_0xac4a('0x9')][_0x42fd9d[_0xac4a('0x3f')]]&&_[_0xac4a('0x40')](this[_0xac4a('0x9')][_0x42fd9d[_0xac4a('0x3f')]][_0xac4a('0x3d')])){logger['info'](_0xac4a('0x41'),_0x42fd9d[_0xac4a('0x3f')]);this['startAcw'](_0x42fd9d[_0xac4a('0x3f')]);}}catch(_0x44dcb8){logger[_0xac4a('0x1f')](_0xac4a('0x42'),_0x44dcb8['message']);}};Acw[_0xac4a('0x17')][_0xac4a('0x43')]=function(_0x2d8db8){try{if(this[_0xac4a('0x9')][_0x2d8db8[_0xac4a('0x33')]]&&this['channels'][_0x2d8db8[_0xac4a('0x33')]]['attended']){logger[_0xac4a('0x1d')](_0xac4a('0x44'),_0x2d8db8['uniqueid']);this['startAcw'](_0x2d8db8[_0xac4a('0x33')]);}else if(this[_0xac4a('0x9')][_0x2d8db8['linkedid']]&&this[_0xac4a('0x9')][_0x2d8db8[_0xac4a('0x3f')]][_0xac4a('0x3d')]){logger[_0xac4a('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2d8db8[_0xac4a('0x3f')]);this[_0xac4a('0x22')](_0x2d8db8[_0xac4a('0x3f')]);}}catch(_0xb5897b){logger[_0xac4a('0x1f')](_0xac4a('0x45'),_0xb5897b[_0xac4a('0x35')]);}};Acw['prototype'][_0xac4a('0x46')]=function(_0xef51d0){try{if(!_[_0xac4a('0x47')](this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x48')]])){this[_0xac4a('0x22')](_0xef51d0[_0xac4a('0x48')]);if(this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x49')]]){this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x49')]][_0xac4a('0x3d')]=!![];this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x4a')]]=this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x49')]];delete this['channels'][_0xef51d0[_0xac4a('0x49')]];}}else if(!_['isNil'](this[_0xac4a('0x9')][_0xef51d0['transfertargetuniqueid']])){this[_0xac4a('0x22')](_0xef51d0['transfertargetuniqueid']);if(this[_0xac4a('0x9')][_0xef51d0['origtransfereruniqueid']]){this['channels'][_0xef51d0[_0xac4a('0x4b')]][_0xac4a('0x3d')]=!![];this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x48')]]=this[_0xac4a('0x9')][_0xef51d0[_0xac4a('0x4b')]];delete this['channels'][_0xef51d0[_0xac4a('0x4b')]];}}}catch(_0x50dece){logger[_0xac4a('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x50dece[_0xac4a('0x35')]);}};Acw[_0xac4a('0x17')][_0xac4a('0x12')]=function(_0x1306c5){try{if(this[_0xac4a('0x9')][_0x1306c5[_0xac4a('0x4c')]]){logger[_0xac4a('0x1d')](_0xac4a('0x4d'),JSON[_0xac4a('0x4e')](_0x1306c5[_0xac4a('0x4c')]));this[_0xac4a('0x22')](_0x1306c5[_0xac4a('0x4c')]);}else if(this[_0xac4a('0x9')][_0x1306c5[_0xac4a('0x4f')]]){logger[_0xac4a('0x1d')](_0xac4a('0x50'),JSON[_0xac4a('0x4e')](_0x1306c5['transfererlinkedid']));this[_0xac4a('0x22')](_0x1306c5[_0xac4a('0x4f')]);}}catch(_0x4fb812){logger[_0xac4a('0x1f')](_0xac4a('0x51'),_0x4fb812[_0xac4a('0x35')]);}};Acw[_0xac4a('0x17')][_0xac4a('0x10')]=function(_0x4d1440){try{if(this['voiceQueues'][_0x4d1440[_0xac4a('0x24')]]&&this[_0xac4a('0x6')][_0x4d1440[_0xac4a('0x24')]][_0xac4a('0x52')]===_0xac4a('0x53')){if(this[_0xac4a('0x7')][_0x4d1440[_0xac4a('0x23')]]){logger[_0xac4a('0x1d')](_0xac4a('0x54'),_0x4d1440[_0xac4a('0x33')],_0x4d1440[_0xac4a('0x23')],_0x4d1440['queue']);return RpcUser['savePause'](this[_0xac4a('0x7')][_0x4d1440[_0xac4a('0x23')]],_0xac4a('0x55'),_0x4d1440[_0xac4a('0x33')]);}}}catch(_0x663a97){logger[_0xac4a('0x1f')](_0xac4a('0x56'),_0x663a97[_0xac4a('0x35')]);}};module[_0xac4a('0x57')]=Acw; \ No newline at end of file +var _0x292c=['isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','interface','syncAgentConnectPreview'];(function(_0x1ced88,_0x477e93){var _0x4eafbd=function(_0xc92d8e){while(--_0xc92d8e){_0x1ced88['push'](_0x1ced88['shift']());}};_0x4eafbd(++_0x477e93);}(_0x292c,0x66));var _0xc292=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x292c[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0xc292('0x0'));var moment=require('moment');var ami=require(_0xc292('0x1'));var logger=require(_0xc292('0x2'))(_0xc292('0x3'));var RpcUser=require(_0xc292('0x4'));var RpcVoiceAgentReport=require(_0xc292('0x5'));function Acw(_0x50b478){this[_0xc292('0x6')]=_0x50b478['voiceQueues'];this['agents']=_0x50b478[_0xc292('0x7')];this[_0xc292('0x8')]=_0x50b478[_0xc292('0x8')];this[_0xc292('0x9')]={};ami['on'](_0xc292('0xa'),this[_0xc292('0xb')][_0xc292('0xc')](this));ami['on'](_0xc292('0xd'),this[_0xc292('0xe')][_0xc292('0xc')](this));ami['on']('hangup',this[_0xc292('0xf')][_0xc292('0xc')](this));ami['on'](_0xc292('0x10'),this[_0xc292('0x11')][_0xc292('0xc')](this));ami['on']('attendedtransfer',this[_0xc292('0x12')][_0xc292('0xc')](this));ami['on'](_0xc292('0x13'),this[_0xc292('0x14')][_0xc292('0xc')](this));ami['on'](_0xc292('0x15'),this['syncAgentConnectPreview'][_0xc292('0xc')](this));}function getDiff(_0x3e12ad){var _0x2a3a0a=moment()[_0xc292('0x16')](0x0);var _0x38c865=moment(_0x3e12ad)['milliseconds'](0x0);return _0x2a3a0a['diff'](_0x38c865,_0xc292('0x17'));}Acw[_0xc292('0x18')]['updateAcw']=function(_0x290138,_0x53a23e){var _0x5e765a=this;var _0x3f762b=getDiff(_0x5e765a['timers'][_0x290138][_0xc292('0x19')]);clearTimeout(_0x5e765a[_0xc292('0x8')][_0x290138][_0xc292('0x1a')]);_0x5e765a['timers'][_0x290138][_0xc292('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x3f762b},_0x5e765a['timers'][_0x290138][_0xc292('0x1b')],_0x290138)[_0xc292('0x1c')](function(_0x5808f1){logger[_0xc292('0x1d')](_0xc292('0x1e'),_0x53a23e,_0x3f762b,_0x5808f1);})[_0xc292('0x1f')](function(_0x5a9873){logger['error'](_0xc292('0x20'),_0x53a23e,_0x5a9873);})[_0xc292('0x21')](function(){delete _0x5e765a[_0xc292('0x8')][_0x290138];});};Acw[_0xc292('0x18')][_0xc292('0x22')]=function(_0x14d94c){try{var _0x17bafc=this;var _0x2a4618=this[_0xc292('0x9')][_0x14d94c]['interface'];var _0x5b3562=this[_0xc292('0x9')][_0x14d94c][_0xc292('0x23')];var _0x4ba9e3=this[_0xc292('0x6')][_0x5b3562];var _0x7c33dd=![];var _0x351907='ACW';if(_0x4ba9e3[_0xc292('0x24')]&&_0x4ba9e3[_0xc292('0x25')]['name']){_0x7c33dd=!![];_0x351907=_0x4ba9e3['mandatoryDispositionPause'][_0xc292('0x26')];}if(!_0x17bafc[_0xc292('0x7')][_0x2a4618]){return Promise['resolve']();}return RpcUser['getAgent'](_0x17bafc['agents'][_0x2a4618]['id'])[_0xc292('0x1c')](function(_0x10b77e){if(!_0x10b77e||_0x10b77e['voicePause']){logger[_0xc292('0x1d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x14d94c,_0x2a4618,_0x5b3562);return;}logger[_0xc292('0x1d')](_0xc292('0x27'),_0x14d94c,_0x2a4618,_0x5b3562);var _0x4ae177=_0x17bafc['channels'][_0x14d94c][_0xc292('0x28')]&&_0x17bafc[_0xc292('0x9')][_0x14d94c]['destlinkedid']?_0x17bafc['channels'][_0x14d94c][_0xc292('0x29')]:_0x14d94c;return RpcUser['savePause'](_0x17bafc[_0xc292('0x7')][_0x2a4618],_0x351907,_0x4ae177);})[_0xc292('0x1c')](function(_0x2f7735){if(_0x7c33dd||!_0x2f7735){return;}_0x17bafc['timers'][_0x2a4618]={};logger[_0xc292('0x1d')](_0xc292('0x2a'),_0x14d94c,_0x17bafc[_0xc292('0x6')][_0x5b3562][_0xc292('0x2b')],_0x2a4618,_0x5b3562);_0x17bafc[_0xc292('0x8')][_0x2a4618]['timer']=setTimeout(_0x17bafc[_0xc292('0x2c')][_0xc292('0xc')](_0x17bafc,_0x2a4618),_0x17bafc[_0xc292('0x6')][_0x5b3562][_0xc292('0x2b')]*0x3e8);_0x17bafc['timers'][_0x2a4618]['lastPauseAt']=moment()[_0xc292('0x2d')](_0xc292('0x2e'));_0x17bafc[_0xc292('0x8')][_0x2a4618][_0xc292('0x1b')]=_0x14d94c;_0x17bafc[_0xc292('0x8')][_0x2a4618][_0xc292('0x23')]=_0x5b3562;_0x17bafc['timers'][_0x2a4618]['updateAcw']=_0x17bafc[_0xc292('0x2f')][_0xc292('0xc')](_0x17bafc,_0x2a4618,_0x14d94c);})['catch'](function(){logger[_0xc292('0x30')](_0xc292('0x2a'),_0x14d94c,_0x17bafc[_0xc292('0x6')][_0x5b3562][_0xc292('0x2b')],_0x2a4618,_0x5b3562);})[_0xc292('0x21')](function(){delete _0x17bafc['channels'][_0x14d94c];});}catch(_0x36b146){logger[_0xc292('0x30')](_0xc292('0x31'),_0x36b146[_0xc292('0x32')]);}};Acw[_0xc292('0x18')][_0xc292('0x2c')]=function(_0x56604b){try{var _0x1d0572=this;if(_0x1d0572[_0xc292('0x8')][_0x56604b]){_0x1d0572[_0xc292('0x8')][_0x56604b][_0xc292('0x1a')]=![];var _0x19dafd=_0x1d0572['timers'][_0x56604b][_0xc292('0x1b')];var _0x2986cc=_0x1d0572[_0xc292('0x8')][_0x56604b][_0xc292('0x23')];var _0x29e53e=_0x1d0572['voiceQueues'][_0x2986cc]['acwTimeout'];logger[_0xc292('0x1d')](_0xc292('0x33'),_0x19dafd,_0x56604b);RpcUser['saveUnpause'](this[_0xc292('0x7')][_0x56604b]);RpcVoiceAgentReport[_0xc292('0x34')]({'acwtime':_0x29e53e,'agentacw':!![]},_0x19dafd,_0x56604b)['then'](function(_0x2f6df7){logger[_0xc292('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x19dafd,_0x29e53e,_0x2f6df7);})[_0xc292('0x1f')](function(_0x375cb3){logger[_0xc292('0x30')](_0xc292('0x20'),_0x19dafd,_0x375cb3);});}else{logger[_0xc292('0x30')](_0xc292('0x35'),_0x56604b);if(_0x1d0572['timers']){logger[_0xc292('0x1d')](_0xc292('0x36'),JSON[_0xc292('0x37')](_0x1d0572['timers']));}}}catch(_0x1ebc6e){logger['error']('[ACW][STOP]\x20%s',_0x1ebc6e[_0xc292('0x32')]);}};Acw[_0xc292('0x18')][_0xc292('0xb')]=function(_0x49a10c){try{if(this[_0xc292('0x6')][_0x49a10c['queue']]&&(this[_0xc292('0x6')][_0x49a10c[_0xc292('0x23')]][_0xc292('0x3')]||this['voiceQueues'][_0x49a10c['queue']][_0xc292('0x24')])){if(this[_0xc292('0x7')][_0x49a10c['interface']]){this['channels'][_0x49a10c[_0xc292('0x1b')]]={'queue':_0x49a10c[_0xc292('0x23')],'interface':_0x49a10c[_0xc292('0x38')],'destlinkedid':_0x49a10c['destlinkedid']};}}}catch(_0x659ed2){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x659ed2[_0xc292('0x32')]);}};Acw['prototype'][_0xc292('0x39')]=function(_0x4a9630){try{if(this[_0xc292('0x6')][_0x4a9630[_0xc292('0x23')]]&&(this[_0xc292('0x6')][_0x4a9630[_0xc292('0x23')]][_0xc292('0x3')]||this[_0xc292('0x6')][_0x4a9630['queue']][_0xc292('0x24')])){if(this[_0xc292('0x7')][_0x4a9630['interface']]){this[_0xc292('0x9')][_0x4a9630[_0xc292('0x1b')]]={'queue':_0x4a9630[_0xc292('0x23')],'interface':_0x4a9630[_0xc292('0x38')]};}}}catch(_0x21968e){logger[_0xc292('0x30')]('[ACW][syncAgentConnectPreview]\x20%s',_0x21968e[_0xc292('0x32')]);}};Acw[_0xc292('0x18')][_0xc292('0xe')]=function(_0x317b35){try{if(this[_0xc292('0x9')][_0x317b35[_0xc292('0x1b')]]&&_[_0xc292('0x3a')](this[_0xc292('0x9')][_0x317b35[_0xc292('0x1b')]][_0xc292('0x28')])){logger[_0xc292('0x1d')](_0xc292('0x3b'),_0x317b35[_0xc292('0x1b')]);this[_0xc292('0x22')](_0x317b35[_0xc292('0x1b')]);}else if(this[_0xc292('0x9')][_0x317b35['linkedid']]&&_[_0xc292('0x3a')](this[_0xc292('0x9')][_0x317b35[_0xc292('0x3c')]][_0xc292('0x28')])){logger['info'](_0xc292('0x3d'),_0x317b35[_0xc292('0x3c')]);this[_0xc292('0x22')](_0x317b35[_0xc292('0x3c')]);}}catch(_0x16e531){logger['error'](_0xc292('0x3e'),_0x16e531['message']);}};Acw[_0xc292('0x18')][_0xc292('0xf')]=function(_0x1def69){try{if(this[_0xc292('0x9')][_0x1def69[_0xc292('0x1b')]]&&this[_0xc292('0x9')][_0x1def69['uniqueid']][_0xc292('0x28')]){logger['info'](_0xc292('0x3f'),_0x1def69[_0xc292('0x1b')]);this[_0xc292('0x22')](_0x1def69['uniqueid']);}else if(this['channels'][_0x1def69['linkedid']]&&this[_0xc292('0x9')][_0x1def69['linkedid']]['attended']){logger[_0xc292('0x1d')](_0xc292('0x40'),_0x1def69['linkedid']);this[_0xc292('0x22')](_0x1def69['linkedid']);}}catch(_0x9b4bff){logger[_0xc292('0x30')](_0xc292('0x41'),_0x9b4bff[_0xc292('0x32')]);}};Acw[_0xc292('0x18')]['syncAttendedTransfer']=function(_0x550332){try{if(!_['isNil'](this['channels'][_0x550332['transfereeuniqueid']])){this[_0xc292('0x22')](_0x550332[_0xc292('0x42')]);if(this['channels'][_0x550332[_0xc292('0x43')]]){this[_0xc292('0x9')][_0x550332[_0xc292('0x43')]][_0xc292('0x28')]=!![];this[_0xc292('0x9')][_0x550332[_0xc292('0x44')]]=this['channels'][_0x550332['secondtransfereruniqueid']];delete this[_0xc292('0x9')][_0x550332[_0xc292('0x43')]];}}else if(!_['isNil'](this[_0xc292('0x9')][_0x550332[_0xc292('0x44')]])){this[_0xc292('0x22')](_0x550332[_0xc292('0x44')]);if(this[_0xc292('0x9')][_0x550332[_0xc292('0x45')]]){this[_0xc292('0x9')][_0x550332[_0xc292('0x45')]][_0xc292('0x28')]=!![];this['channels'][_0x550332[_0xc292('0x42')]]=this[_0xc292('0x9')][_0x550332[_0xc292('0x45')]];delete this[_0xc292('0x9')][_0x550332[_0xc292('0x45')]];}}}catch(_0x3b2295){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3b2295[_0xc292('0x32')]);}};Acw[_0xc292('0x18')]['syncBlindTransfer']=function(_0x493599){try{if(this[_0xc292('0x9')][_0x493599[_0xc292('0x46')]]){logger['info'](_0xc292('0x47'),JSON[_0xc292('0x37')](_0x493599[_0xc292('0x46')]));this[_0xc292('0x22')](_0x493599[_0xc292('0x46')]);}else if(this[_0xc292('0x9')][_0x493599[_0xc292('0x48')]]){logger[_0xc292('0x1d')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xc292('0x37')](_0x493599[_0xc292('0x48')]));this[_0xc292('0x22')](_0x493599[_0xc292('0x48')]);}}catch(_0x444f5c){logger[_0xc292('0x30')](_0xc292('0x49'),_0x444f5c[_0xc292('0x32')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x73fe31){try{if(this[_0xc292('0x6')][_0x73fe31[_0xc292('0x23')]]&&this[_0xc292('0x6')][_0x73fe31['queue']][_0xc292('0x4a')]===_0xc292('0x4b')){if(this[_0xc292('0x7')][_0x73fe31[_0xc292('0x38')]]){logger[_0xc292('0x1d')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x73fe31[_0xc292('0x1b')],_0x73fe31[_0xc292('0x38')],_0x73fe31[_0xc292('0x23')]);return RpcUser[_0xc292('0x4c')](this[_0xc292('0x7')][_0x73fe31[_0xc292('0x38')]],_0xc292('0x4d'),_0x73fe31['uniqueid']);}}}catch(_0x24bfcc){logger[_0xc292('0x30')](_0xc292('0x4e'),_0x24bfcc['message']);}};module[_0xc292('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 04daa54..b0910cd 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 _0x00df=['[ami.js][fullybooted]','once','close','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','username','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','catch'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x00df,0x19b));var _0xf00d=function(_0x456df5,_0x215a5b){_0x456df5=_0x456df5-0x0;var _0x48adfd=_0x00df[_0x456df5];return _0x48adfd;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xf00d('0x0'));var util=require(_0xf00d('0x1'));var logger=require(_0xf00d('0x2'))(_0xf00d('0x3'));var config=require(_0xf00d('0x4'));var ami=new Manager(config['asterisk'][_0xf00d('0x5')],config[_0xf00d('0x6')]['ip'],config[_0xf00d('0x6')][_0xf00d('0x7')],config[_0xf00d('0x6')]['password'],!![]);ami[_0xf00d('0x8')]();ami['Action']=BPromise[_0xf00d('0x9')](ami[_0xf00d('0xa')]);function error(_0x3add53){logger[_0xf00d('0xb')](util[_0xf00d('0xc')](_0xf00d('0xd'),config[_0xf00d('0x6')]['username'],config[_0xf00d('0x6')]['ip'],config[_0xf00d('0x6')][_0xf00d('0x5')],util[_0xf00d('0xe')](_0x3add53,![],null)));}function close(){logger[_0xf00d('0xb')](util['format'](_0xf00d('0xf'),config[_0xf00d('0x6')][_0xf00d('0x7')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0xf00d('0x10')]=function(){return function(){return ami[_0xf00d('0x11')]({'action':_0xf00d('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xf00d('0x11')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xf00d('0x11')]({'action':'sippeerstatus'});};};ami[_0xf00d('0x13')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xf00d('0x14')]=function(){return function(){return ami[_0xf00d('0x11')]({'action':_0xf00d('0x15')});};};function connect(){logger[_0xf00d('0x16')](util[_0xf00d('0xc')](_0xf00d('0x17'),config['asterisk'][_0xf00d('0x7')],config[_0xf00d('0x6')]['ip'],config['asterisk'][_0xf00d('0x5')]));ami['once']('error',error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0xf00d('0x18'),function(_0xdabe07){logger['info'](util[_0xf00d('0xc')](_0xf00d('0x19'),config[_0xf00d('0x6')][_0xf00d('0x7')],config[_0xf00d('0x6')]['ip'],config[_0xf00d('0x6')][_0xf00d('0x5')],util['inspect'](_0xdabe07,![],null)));});ami['on'](_0xf00d('0x1a'),function(){logger['info'](util['format'](_0xf00d('0x1b'),config[_0xf00d('0x6')][_0xf00d('0x7')],config[_0xf00d('0x6')]['ip'],config[_0xf00d('0x6')][_0xf00d('0x5')]));return Promise['resolve']()[_0xf00d('0x1c')](ami['actionSipShowRegistry']())[_0xf00d('0x1c')](ami[_0xf00d('0x1d')]())['then'](ami['actionSipPeerStatus']())[_0xf00d('0x1c')](ami[_0xf00d('0x13')]())[_0xf00d('0x1c')](ami[_0xf00d('0x14')]())[_0xf00d('0x1e')](function(_0x543503){logger[_0xf00d('0xb')](_0xf00d('0x1f'),util[_0xf00d('0xe')](_0x543503,{'showHidden':![],'depth':null}));});});ami[_0xf00d('0x20')](_0xf00d('0xb'),error);ami[_0xf00d('0x20')](_0xf00d('0x21'),close);module['exports']=ami; \ No newline at end of file +var _0x4c7e=['once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info'];(function(_0x363855,_0x30a668){var _0x1c5798=function(_0x25fb3a){while(--_0x25fb3a){_0x363855['push'](_0x363855['shift']());}};_0x1c5798(++_0x30a668);}(_0x4c7e,0x110));var _0xe4c7=function(_0x467bb0,_0x1ee3f4){_0x467bb0=_0x467bb0-0x0;var _0x2dea67=_0x4c7e[_0x467bb0];return _0x2dea67;};'use strict';var Manager=require(_0xe4c7('0x0'));var BPromise=require(_0xe4c7('0x1'));var util=require(_0xe4c7('0x2'));var logger=require('../../config/logger')(_0xe4c7('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xe4c7('0x4')][_0xe4c7('0x5')],config[_0xe4c7('0x4')]['ip'],config[_0xe4c7('0x4')]['username'],config[_0xe4c7('0x4')][_0xe4c7('0x6')],!![]);ami[_0xe4c7('0x7')]();ami[_0xe4c7('0x8')]=BPromise['promisify'](ami[_0xe4c7('0x9')]);function error(_0x4e853c){logger[_0xe4c7('0xa')](util[_0xe4c7('0xb')](_0xe4c7('0xc'),config[_0xe4c7('0x4')][_0xe4c7('0xd')],config[_0xe4c7('0x4')]['ip'],config[_0xe4c7('0x4')][_0xe4c7('0x5')],util[_0xe4c7('0xe')](_0x4e853c,![],null)));}function close(){logger[_0xe4c7('0xa')](util['format'](_0xe4c7('0xf'),config[_0xe4c7('0x4')][_0xe4c7('0xd')],config[_0xe4c7('0x4')]['ip'],config[_0xe4c7('0x4')][_0xe4c7('0x5')]));}ami[_0xe4c7('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xe4c7('0x11')]=function(){return function(){return ami[_0xe4c7('0x8')]({'action':'devicestatelist'});};};ami[_0xe4c7('0x12')]=function(){return function(){return ami[_0xe4c7('0x8')]({'action':_0xe4c7('0x13')});};};ami[_0xe4c7('0x14')]=function(){return function(){return ami[_0xe4c7('0x8')]({'action':_0xe4c7('0x15')});};};ami[_0xe4c7('0x16')]=function(){return function(){return ami[_0xe4c7('0x8')]({'action':_0xe4c7('0x17')});};};function connect(){logger[_0xe4c7('0x18')](util[_0xe4c7('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xe4c7('0x4')][_0xe4c7('0xd')],config[_0xe4c7('0x4')]['ip'],config[_0xe4c7('0x4')]['port']));ami['once'](_0xe4c7('0xa'),error);ami[_0xe4c7('0x19')](_0xe4c7('0x1a'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x2f050b){logger['info'](util[_0xe4c7('0xb')](_0xe4c7('0x1b'),config[_0xe4c7('0x4')][_0xe4c7('0xd')],config['asterisk']['ip'],config[_0xe4c7('0x4')][_0xe4c7('0x5')],util['inspect'](_0x2f050b,![],null)));});ami['on'](_0xe4c7('0x1c'),function(){logger['info'](util[_0xe4c7('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe4c7('0x4')]['username'],config[_0xe4c7('0x4')]['ip'],config[_0xe4c7('0x4')]['port']));return Promise['resolve']()[_0xe4c7('0x1d')](ami[_0xe4c7('0x10')]())[_0xe4c7('0x1d')](ami[_0xe4c7('0x11')]())[_0xe4c7('0x1d')](ami[_0xe4c7('0x12')]())[_0xe4c7('0x1d')](ami[_0xe4c7('0x14')]())[_0xe4c7('0x1d')](ami[_0xe4c7('0x16')]())[_0xe4c7('0x1e')](function(_0x118081){logger['error'](_0xe4c7('0x1f'),util[_0xe4c7('0xe')](_0x118081,{'showHidden':![],'depth':null}));});});ami[_0xe4c7('0x19')](_0xe4c7('0xa'),error);ami[_0xe4c7('0x19')](_0xe4c7('0x1a'),close);module[_0xe4c7('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 76d5f14..fed8272 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x417b30,_0x2546e2){var _0x39eac5=function(_0x8c7a00){while(--_0x8c7a00){_0x417b30['push'](_0x417b30['shift']());}};_0x39eac5(++_0x2546e2);}(_0xaa88,0x137));var _0x8aa8=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0xaa88[_0x58ae8a];return _0x2f0b6b;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x19276a,_0x3f442e){var _0x12e91c=function(_0x282889){while(--_0x282889){_0x19276a['push'](_0x19276a['shift']());}};_0x12e91c(++_0x3f442e);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d76e290..5c19e5b 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 _0x3218=['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','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','startPredictive','name','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','format','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','indexOf','true','catch','content','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','campaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','callAdditionalPhoneAfterMin','state','additional','dialDropMaxRetry','rescheduleContact','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','voiceQueue','dialAbandonedMaxRetry','add','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','rrmemory','actionid','locked','stateinterface','isNil','idHopper','paused','strategy','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact]','queueCallerAbandonCreateState','handleIvr','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','trim','dialCutDigit','dialPrefix','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','dropRate','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','[getDataPredictive]','erlangCallToSecond','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','util','uuid','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','debug','inspect','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------'];(function(_0x11269e,_0x60b611){var _0x7f8716=function(_0x3b8ef5){while(--_0x3b8ef5){_0x11269e['push'](_0x11269e['shift']());}};_0x7f8716(++_0x60b611);}(_0x3218,0x1cd));var _0x8321=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x3218[_0x2d9e27];return _0xd35381;};'use strict';var util=require(_0x8321('0x0'));var _=require('lodash');var uuid=require(_0x8321('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0x8321('0x2'));var config=require(_0x8321('0x3'));var logger=require(_0x8321('0x4'))(_0x8321('0x5'));var loggerBooked=require(_0x8321('0x4'))(_0x8321('0x6'));var loggerPredictive=require(_0x8321('0x4'))(_0x8321('0x7'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x8321('0x8'));var ami=require('../ami');config[_0x8321('0x9')]=_['defaults'](config[_0x8321('0x9')],{'host':_0x8321('0xa'),'port':0x18eb});var io=require(_0x8321('0xb'))(new Redis(config[_0x8321('0x9')]));var cmHopper=require(_0x8321('0xc'));var voiceQueueRt=require(_0x8321('0xd'));var RpcSetting=require(_0x8321('0xe'));var Interval=require(_0x8321('0xf'));var Action=require(_0x8321('0x10'));var History=require('./models/history');var Final=require(_0x8321('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x8321('0x12'));var Hangup=require(_0x8321('0x13'));var ipAgi=process[_0x8321('0x14')][_0x8321('0x15')]||_0x8321('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8321('0x17')][_0x8321('0x18')]=function(_0x106e07){this['tail']=this[_0x8321('0x19')]?this[_0x8321('0x19')][_0x8321('0x1a')](_0x106e07):_0x106e07();};function Dialer(_0x3b823e,_0x2f3dad){this[_0x8321('0x1b')]=new Sequence();this[_0x8321('0x1c')]=_0x2f3dad;this['voiceQueues']=_0x3b823e[_0x8321('0x1d')];this['campaigns']=_0x3b823e['campaigns'];this[_0x8321('0x1e')]=_0x3b823e[_0x8321('0x1e')];this['trunks']=_0x3b823e[_0x8321('0x1f')];this[_0x8321('0x20')]=config[_0x8321('0x20')]||0x2;this[_0x8321('0x21')]={};this['actions']={};this['contactsId']={};this[_0x8321('0x22')]={};this[_0x8321('0x23')]={};this['startPredictive']={};this[_0x8321('0x24')]={};this[_0x8321('0x25')]={};this[_0x8321('0x26')]={};this[_0x8321('0x27')]={};this[_0x8321('0x28')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x8321('0x29')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x8321('0x29')](this));ami['on'](_0x8321('0x2a'),this[_0x8321('0x2b')][_0x8321('0x29')](this));ami['on'](_0x8321('0x2c'),this[_0x8321('0x2d')][_0x8321('0x29')](this));ami['on'](_0x8321('0x2e'),this[_0x8321('0x8')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x8321('0x2f')][_0x8321('0x29')](this));ami['on']('hangup',this[_0x8321('0x30')]['bind'](this));ami['on'](_0x8321('0x31'),this['syncNewExten'][_0x8321('0x29')](this));ami['on'](_0x8321('0x32'),this[_0x8321('0x33')][_0x8321('0x29')](this));ami['on'](_0x8321('0x34'),this[_0x8321('0x35')][_0x8321('0x29')](this));ami['on']('queuestatuscomplete',this[_0x8321('0x36')][_0x8321('0x29')](this));this[_0x8321('0x37')]();this[_0x8321('0x38')]();RpcSetting[_0x8321('0x39')]()[_0x8321('0x3a')](function(_0x2fbbba){previewRecallmeReminderInterval=_0x2fbbba['previewRecallmeReminderInterval'];});}function isNotNull(_0x11a74d){return _0x11a74d!==null&&!_[_0x8321('0x3b')](_0x11a74d);}function msgResponse(_0x564b62,_0x4296a6,_0x4b8539){return{'action':_0x564b62,'response':_0x4296a6,'message':_0x4b8539,'stack':_0x4b8539};}function emit(_0x18ab3e,_0x4abc83,_0xc27a9c){io['to'](_0x18ab3e)[_0x8321('0x3c')](_0x4abc83,_0xc27a9c);}function emitOutboundVoiceQueueSummary(_0x10788a){if(_0x10788a[_0x8321('0x3d')]==='outbound'){logger[_0x8321('0x3e')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x8321('0x3f')](_0x10788a,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x10788a['name']),_0x8321('0x40'),_0x10788a);}}function checkGetDataPredictive(_0x1e7460){if(isNotNull(_0x1e7460)&&!_[_0x8321('0x41')](_0x1e7460)){loggerPredictive['info'](_0x8321('0x42'));loggerPredictive['info'](_0x8321('0x43'),_0x1e7460[_0x8321('0x44')]);loggerPredictive['info'](_0x8321('0x45'),_0x1e7460[_0x8321('0x46')]);loggerPredictive[_0x8321('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e7460['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x8321('0x47')](_0x8321('0x48'),_0x1e7460[_0x8321('0x49')]);loggerPredictive['info'](_0x8321('0x4a'),_0x1e7460[_0x8321('0x4b')]);loggerPredictive[_0x8321('0x47')](_0x8321('0x4c'),_0x1e7460['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8321('0x47')](_0x8321('0x4d'));if(_0x1e7460[_0x8321('0x44')]>0x0){if(!_['isUndefined'](_0x1e7460['predictiveIntervalAvgTalktime'])&&_0x1e7460[_0x8321('0x4e')]>0x0){return!![];}loggerPredictive[_0x8321('0x47')](_0x8321('0x4f'));if(!_[_0x8321('0x3b')](_0x1e7460[_0x8321('0x4b')])&&_0x1e7460[_0x8321('0x4b')]>0x0){return!![];}loggerPredictive[_0x8321('0x47')](_0x8321('0x50'));}else{loggerPredictive[_0x8321('0x47')](_0x8321('0x51'));}}else{loggerPredictive[_0x8321('0x47')](_0x8321('0x52'));}return![];}function mergeDataErlangB(_0x1034fb){return function(_0x3a994c){loggerPredictive['info'](_0x8321('0x53'));loggerPredictive[_0x8321('0x47')](_0x8321('0x54'),_0x3a994c[_0x8321('0x55')]);loggerPredictive[_0x8321('0x47')](_0x8321('0x56'),_0x3a994c['erlangCallToSecond']);loggerPredictive[_0x8321('0x47')](_0x8321('0x57'),_0x3a994c[_0x8321('0x58')]);loggerPredictive['info'](_0x8321('0x59'),_0x3a994c[_0x8321('0x5a')]);loggerPredictive[_0x8321('0x47')](_0x8321('0x57'),_0x3a994c[_0x8321('0x58')]);loggerPredictive[_0x8321('0x47')]('---------------------------');_[_0x8321('0x5b')](_0x1034fb,_0x3a994c);};}function ifInterval(_0x22ceff,_0x11bcd5){if(_[_0x8321('0x3b')](_0x11bcd5)){return![];}return utils['getSeconds'](undefined,_0x11bcd5)<_0x22ceff*0x3c;}function clearPredictiveAttributes(_0x1a94f9){if(_0x1a94f9[_0x8321('0x24')]){_0x1a94f9[_0x8321('0x24')]=undefined;loggerPredictive[_0x8321('0x3e')](_0x1a94f9['name'],_0x8321('0x5c'));}if(_0x1a94f9['startPredictive']){_0x1a94f9[_0x8321('0x5d')]=undefined;loggerPredictive['debug'](_0x1a94f9[_0x8321('0x5e')],'startPredictive\x20value\x20cleared');}if(_0x1a94f9['handlePredictive']){clearInterval(_0x1a94f9[_0x8321('0x5f')]);_0x1a94f9[_0x8321('0x5f')]=undefined;loggerPredictive['debug'](_0x1a94f9[_0x8321('0x5e')],_0x8321('0x60'));}}function loggerCatchPredictive(_0x45ff24,_0x5f02d4){return function(_0x3d76a3){loggerPredictive[_0x8321('0x61')](_0x5f02d4['name'],_0x45ff24);loggerPredictive[_0x8321('0x61')](_0x3d76a3[_0x8321('0x62')]);clearPredictiveAttributes(_0x5f02d4);};}function loggerCatch(_0x36bc4d){return function(_0x3a760f){logger[_0x8321('0x61')](_0x36bc4d,util['inspect'](_0x3a760f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x51793b,_0x48a362,_0x17b1ad){return function(_0x4b0924){utils['checkContactLowerLimitOriginate'](_0x48a362,_0x17b1ad,0x0);_0x48a362['temp']=0x0;logger[_0x8321('0x61')](_0x51793b,util[_0x8321('0x3f')](_0x4b0924,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x49bd4c){return function(_0x3c6180){if(isNotNull(_0x3c6180)&&isNotNull(_0x3c6180[0x0])){if(_0x3c6180[0x0][_0x8321('0x63')]>0x0){_0x49bd4c[_0x8321('0x64')]=utils['CAMPAIGN_STATUS'][_0x8321('0x65')];logger[_0x8321('0x47')](_0x8321('0x66')+_0x49bd4c[_0x8321('0x5e')],_0x3c6180[0x0][_0x8321('0x63')],_0x8321('0x67'));}else{_0x49bd4c['message']=utils[_0x8321('0x68')]['NO_AVAILABLE_CONTACTS'];logger[_0x8321('0x47')]('[getContactDialer2][Empty]'+_0x49bd4c[_0x8321('0x5e')]);}}};}function createObjHistory(_0x386d07,_0x1d7e9c,_0x5e87e8,_0x24d0ae,_0x2e43c5){_0x386d07[_0x8321('0x64')]=_0x5e87e8;var _0x2a4196=new Action(_0x386d07,_0x1d7e9c);var _0x355ea6=new History(_0x2a4196);_0x355ea6['state']=_0x24d0ae;_0x355ea6[_0x8321('0x69')]=_0x2e43c5;_0x355ea6[_0x8321('0x6a')]=_0x2a4196[_0x8321('0x6b')];return _0x355ea6;}function unlockQueueStatus(_0x1c0bea,_0x5d3371){setTimeout(function(){if(_[_0x8321('0x3b')](_0x1c0bea[_0x8321('0x6c')])){loggerBooked[_0x8321('0x61')](_0x8321('0x6d'),_0x5d3371);}_0x1c0bea[_0x8321('0x6c')]=!![];loggerBooked['info'](_0x8321('0x6e'),_0x5d3371,JSON[_0x8321('0x6f')](_[_0x8321('0x70')](_0x1c0bea,[_0x8321('0x5e'),_0x8321('0x6c')])));},0x1f3);}function checkInterval(_0x52a1d8){return function(){if(!isNotNull(_0x52a1d8[_0x8321('0x71')])){_0x52a1d8[_0x8321('0x64')]=utils[_0x8321('0x68')][_0x8321('0x72')];throw _0x52a1d8[_0x8321('0x5e')]+_0x8321('0x73');}if(!isNotNull(_0x52a1d8[_0x8321('0x71')][_0x8321('0x74')])){_0x52a1d8[_0x8321('0x64')]=utils[_0x8321('0x68')][_0x8321('0x72')];throw _0x52a1d8[_0x8321('0x5e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x52a1d8[_0x8321('0x71')][_0x8321('0x74')]))){_0x52a1d8[_0x8321('0x64')]=utils[_0x8321('0x68')]['NULL_INTERVAL'];throw _0x52a1d8[_0x8321('0x5e')]+_0x8321('0x73');}};}function checkIsIVRCampaignActive(_0x50f0c7){return function(){if(!utils['isIVRCampaignActive'](_0x50f0c7)){_0x50f0c7[_0x8321('0x64')]=utils['CAMPAIGN_STATUS'][_0x8321('0x75')];throw _0x50f0c7[_0x8321('0x5e')]+_0x8321('0x76');}};}function emitCampaignSummary(_0x4764ef){if(utils[_0x8321('0x77')](_0x4764ef)){emit(util['format'](_0x8321('0x78'),_0x4764ef[_0x8321('0x5e')]),_0x8321('0x79'),_0x4764ef);}}function loggerCatchQueueSummary(_0xcdae4b,_0xb8a95b){return function(_0x9cb036){clearPredictiveAttributes(_0xb8a95b);emitCampaignSummary(_0xb8a95b);loggerSyncQueueSummary[_0x8321('0x3e')](_0xcdae4b,util[_0x8321('0x3f')](_0x9cb036,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x6434b3){if(_0x6434b3[_0x8321('0x7a')]){if(_0x6434b3[_0x8321('0x7b')]===0x0){_0x6434b3[_0x8321('0x7a')]=![];_0x6434b3['message']=utils[_0x8321('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x6434b3['name'],_0x8321('0x7c'));}else{_0x6434b3['message']=utils[_0x8321('0x68')][_0x8321('0x7d')];loggerSyncQueueSummary['debug'](_0x8321('0x7e'),_0x6434b3['name'],_0x8321('0x7f'));}emitCampaignSummary(_0x6434b3);}}function myreject(_0x2bcf6d){return function(_0x5f4149){return _0x2bcf6d(msgResponse(_0x8321('0x80'),_0x8321('0x81'),JSON[_0x8321('0x6f')](_0x5f4149)));};}Dialer[_0x8321('0x17')][_0x8321('0x82')]=function(_0x5ea4ea){return!_['isUndefined'](_0x5ea4ea)&&_0x5ea4ea&&!_[_0x8321('0x3b')](_0x5ea4ea['name'])&&!_[_0x8321('0x3b')](_0x5ea4ea[_0x8321('0x83')])&&_0x5ea4ea[_0x8321('0x83')]&&(this['trunks'][util[_0x8321('0x84')](_0x8321('0x85'),_0x5ea4ea[_0x8321('0x5e')])][_0x8321('0x86')]===_0x8321('0x87')||this[_0x8321('0x1f')][util['format'](_0x8321('0x85'),_0x5ea4ea['name'])]['status']===_0x8321('0x88'));};Dialer[_0x8321('0x17')][_0x8321('0x89')]=function(_0x1760f7){var _0x4b1958=this;return function(){if(!_0x4b1958[_0x8321('0x82')](_0x1760f7[_0x8321('0x8a')])){if(!_0x4b1958[_0x8321('0x82')](_0x1760f7['TrunkBackup'])){_0x1760f7[_0x8321('0x64')]=utils[_0x8321('0x68')][_0x8321('0x8b')];throw _0x1760f7['name']+_0x8321('0x8c');}}};};Dialer[_0x8321('0x17')][_0x8321('0x8d')]=function(_0x18d262,_0x41059b,_0x33a09a,_0x2ee856){var _0x3f126c=this;return function(){var _0x3e7ae1=!![];return _0x3f126c['ifTimeIvr'](_0x18d262,_0x41059b,_0x33a09a,_0x2ee856,_0x3e7ae1);};};Dialer[_0x8321('0x17')][_0x8321('0x8e')]=function(_0x3db185,_0x2e1910,_0x33a634,_0x34980a){var _0x2d6757=this;return function(){var _0xc86f5c=![];return _0x2d6757[_0x8321('0x8f')](_0x3db185[_0x8321('0x74')],_0x2e1910,_0x33a634,_0x34980a,_0xc86f5c);};};Dialer[_0x8321('0x17')][_0x8321('0x8f')]=function(_0x52034c,_0x4508f8,_0x20fec3,_0x58815e,_0x25a06b){var _0x41cd46=[];return new Promise(function(_0x157c20,_0x5dadb0){if(!isNotNull(_0x52034c)){_0x58815e[_0x8321('0x64')]=utils[_0x8321('0x68')]['NULL_INTERVAL'];return _0x5dadb0(msgResponse(_0x8321('0x90'),_0x8321('0x91'),_0x20fec3+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x52034c)){_0x58815e['message']=utils[_0x8321('0x68')][_0x8321('0x92')];return _0x5dadb0(msgResponse('ifTime',_0x8321('0x91'),_0x20fec3+'\x20Intervals\x20is\x20empty\x20'));}if(_0x4508f8&&_['isUndefined'](config[_0x8321('0x93')][_0x4508f8])){_0x58815e['message']=utils[_0x8321('0x68')][_0x8321('0x94')];return _0x5dadb0(msgResponse('ifTime',_0x8321('0x91'),_0x20fec3+'\x20Timezone\x20unknow\x20'+_0x4508f8));}if(_[_0x8321('0x95')](_0x52034c)){for(var _0x528b5c=0x0;_0x528b5c<_0x52034c[_0x8321('0x96')];_0x528b5c+=0x1){_0x41cd46[_0x8321('0x97')](ami[_0x8321('0x98')]({'action':_0x8321('0x99'),'command':util['format'](_0x8321('0x9a'),_0x52034c[_0x528b5c]['interval'],!_['isUndefined'](config[_0x8321('0x93')][_0x4508f8])?_0x4508f8:'')})[_0x8321('0x3a')](function(_0x13ead7){return _0x13ead7['content'][_0x8321('0x9b')](_0x8321('0x9c'))>=0x0;})[_0x8321('0x9d')](myreject(_0x5dadb0)));}}else{_0x41cd46[_0x8321('0x97')](ami[_0x8321('0x98')]({'action':_0x8321('0x99'),'command':util[_0x8321('0x84')](_0x8321('0x9a'),_0x52034c,!_[_0x8321('0x3b')](config[_0x8321('0x93')][_0x4508f8])?_0x4508f8:'')})[_0x8321('0x3a')](function(_0x32ebcf){return _0x32ebcf[_0x8321('0x9e')][_0x8321('0x9b')](_0x8321('0x9c'))>=0x0;})['catch'](myreject(_0x5dadb0)));}Promise[_0x8321('0x9f')](_0x41cd46)['then'](function(_0x35ebda){var _0x56e08a=_['some'](_0x35ebda);if(_0x56e08a){return _0x157c20(_0x56e08a);}else{_0x58815e[_0x8321('0x64')]=_0x25a06b?utils[_0x8321('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8321('0x68')][_0x8321('0xa0')];return _0x5dadb0(msgResponse(_0x8321('0xa1'),_0x8321('0x91'),_0x8321('0xa2')+_0x25a06b+'\x20'+_0x20fec3+_0x8321('0xa3')+util[_0x8321('0x3f')](_0x52034c,{'showHidden':![],'depth':null})+_0x8321('0xa4')+_0x4508f8));}})[_0x8321('0x9d')](function(_0x21082f){return _0x5dadb0(msgResponse(_0x8321('0x90'),_0x8321('0x91'),JSON[_0x8321('0x6f')](_0x21082f)));});});};Dialer[_0x8321('0x17')][_0x8321('0x37')]=function(){var _0x3c70e5=this;return cmHopper[_0x8321('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x8321('0x3a')](function(){setInterval(function(){_0x3c70e5[_0x8321('0xa6')]();},0x3e8);});};Dialer[_0x8321('0x17')]['syncCampaigns']=function(){var _0x3a4e33=this;var _0x20b556;for(var _0x3a673b in this[_0x8321('0xa7')]){if(typeof this['campaigns'][_0x3a673b]!==_0x8321('0xa8')){_0x20b556=this[_0x8321('0xa7')][_0x3a673b];if(utils[_0x8321('0x77')](_0x20b556)&&utils[_0x8321('0xa9')](_0x20b556)){_0x20b556[_0x8321('0x7a')]=!![];Promise[_0x8321('0xaa')]()['then'](checkIsIVRCampaignActive(_0x20b556))['then'](checkInterval(_0x20b556))[_0x8321('0x3a')](_0x3a4e33[_0x8321('0x89')](_0x20b556))[_0x8321('0x3a')](_0x3a4e33[_0x8321('0x8d')](_0x20b556[_0x8321('0xab')],_0x20b556['dialTimezone'],_0x20b556[_0x8321('0x5e')],_0x20b556))[_0x8321('0x3a')](_0x3a4e33[_0x8321('0x8e')](_0x20b556[_0x8321('0x71')],_0x20b556[_0x8321('0xac')],_0x20b556[_0x8321('0x5e')],_0x20b556))['then'](_0x3a4e33[_0x8321('0xad')](_0x20b556))[_0x8321('0x9d')](loggerCatchQueueSummary(_0x8321('0xae'),_0x20b556));}else{notSendMessagesCampaign(_0x20b556);}}}};Dialer['prototype'][_0x8321('0xaf')]=function(_0x1e4a80){if(_0x1e4a80[_0x8321('0xb0')]!==_0x8321('0x7')){clearPredictiveAttributes(_0x1e4a80);}switch(_0x1e4a80[_0x8321('0xb0')]){case _0x8321('0xb1'):this[_0x8321('0xb2')](_0x1e4a80,0x1);break;case _0x8321('0xb3'):this[_0x8321('0xb2')](_0x1e4a80,_0x1e4a80[_0x8321('0xb4')]);break;case _0x8321('0x7'):this[_0x8321('0x7')](_0x1e4a80);break;case _0x8321('0x6'):this['handlePower'](_0x1e4a80,0x1);break;default:logger[_0x8321('0x61')]('Queue',_0x1e4a80[_0x8321('0x5e')],'method\x20not\x20recognized');}};Dialer['prototype'][_0x8321('0x90')]=function(_0x26d5a6,_0x27dfa6){var _0x30f441=_0x26d5a6[_0x8321('0xac')];var _0x47f017=_0x27dfa6?_0x26d5a6[_0x8321('0xab')]:_0x26d5a6[_0x8321('0x71')][_0x8321('0x74')];logger['silly']('Dialer::ifTime()',_0x47f017,_0x30f441,_0x26d5a6[_0x8321('0x5e')],util[_0x8321('0x84')]('Voice\x20Queue\x20%s\x20$s',_0x26d5a6['name'],_0x26d5a6['id']));var _0x1713d0=null;return Interval['intervalIftime'](_0x47f017,_0x30f441)[_0x8321('0x3a')](function(_0x29c60f){if(_0x29c60f===!![]){return _0x29c60f;}else{_0x26d5a6[_0x8321('0x64')]=_0x27dfa6?utils[_0x8321('0x68')][_0x8321('0xb5')]:utils[_0x8321('0x68')][_0x8321('0xa0')];_0x1713d0=msgResponse(_0x8321('0xa1'),'Failure',_0x8321('0xa2')+_0x27dfa6+'\x20'+_0x26d5a6[_0x8321('0x5e')]+_0x8321('0xa3')+util[_0x8321('0x3f')](_0x47f017,{'showHidden':![],'depth':null})+_0x8321('0xa4')+_0x30f441);}if(_0x1713d0!==null){logger[_0x8321('0xb6')](_0x8321('0xb7'),_0x1713d0);_0x1713d0[_0x8321('0xb8')]=_0x27dfa6;throw _0x1713d0;}})[_0x8321('0x9d')](function(_0x155187){logger[_0x8321('0x61')]('AMI\x20IfTime',_0x155187);throw msgResponse(_0x8321('0x80'),'Error',util[_0x8321('0x3f')](_0x155187,{'showHidden':![],'depth':null}));});};Dialer[_0x8321('0x17')]['syncAgentConnect']=function(_0x2044a9){if(this[_0x8321('0x1d')][_0x2044a9[_0x8321('0xb9')]]){if(this[_0x8321('0x22')][_0x2044a9[_0x8321('0xba')]]&&this[_0x8321('0x22')][_0x2044a9[_0x8321('0xba')]]['type']!==_0x8321('0xbb')){this['updateOriginated'](this[_0x8321('0x1d')][_0x2044a9[_0x8321('0xb9')]]);this['uniqueId'][_0x2044a9['uniqueid']][_0x8321('0xbc')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));}}};Dialer[_0x8321('0x17')][_0x8321('0x2d')]=function(_0x512889){var _0x16c485=this['uniqueId'][_0x512889[_0x8321('0xba')]];if(this['voiceQueues'][_0x512889[_0x8321('0xb9')]]){if(_0x16c485&&_0x16c485['type']!==_0x8321('0xbb')){delete this['uniqueId'][_0x512889['uniqueid']];this['voiceQueues'][_0x512889[_0x8321('0xb9')]][_0x8321('0xbe')]+=0x1;var _0x13e2c8=new AgentComplete(_0x16c485,_0x512889);if(_0x512889[_0x8321('0xbf')]===_0x8321('0xc0')){_0x13e2c8['agiafterat']=this[_0x8321('0x1d')][_0x512889[_0x8321('0xb9')]]['dialQueueProject2']&&this[_0x8321('0x1d')][_0x512889[_0x8321('0xb9')]][_0x8321('0xc1')]?moment()[_0x8321('0x84')](_0x8321('0xbd')):undefined;}hopperUtils[_0x8321('0xc2')](_0x13e2c8)[_0x8321('0x9d')](loggerCatch(_0x8321('0xc3')));hopperUtils[_0x8321('0xc4')](_0x13e2c8)[_0x8321('0x9d')](loggerCatch(_0x8321('0xc5')));}}};Dialer['prototype'][_0x8321('0xc6')]=function(_0x468e9a){var _0x57ff78=this[_0x8321('0x22')][_0x468e9a['uniqueid']];var _0x20f0d6=this;var _0x42be6d=![];var _0x595f92;var _0x584269;if(this[_0x8321('0x1d')][_0x468e9a['queue']]){if(_0x57ff78&&_0x57ff78[_0x8321('0x3d')]!=='ivr'){delete this['uniqueId'][_0x468e9a[_0x8321('0xba')]];this[_0x8321('0xc7')](this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]]);_0x57ff78[_0x8321('0xc8')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));var _0xa643ea=new QueueCallerAbandon(_0x57ff78,_0x468e9a);if(utils[_0x8321('0xc9')](_0x57ff78[_0x8321('0xc8')],_0x57ff78[_0x8321('0xca')])>=_0x57ff78[_0x8321('0xcb')]){this[_0x8321('0x1d')][_0x468e9a['queue']][_0x8321('0xcc')]+=0x1;this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x468e9a[_0x8321('0xb9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xa643ea['state']=0xa;_0xa643ea['statedesc']=_0x8321('0xcd');_0xa643ea[_0x8321('0xce')]=_0x8321('0xcf');_0xa643ea['agiafterat']=this[_0x8321('0x1d')][_0x468e9a['queue']][_0x8321('0xd0')]?moment()[_0x8321('0x84')](_0x8321('0xbd')):undefined;_0xa643ea[_0x8321('0xd1')]+=0x1;_0xa643ea[_0x8321('0xd2')]+=0x1;_0x595f92=this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]]['dialDropRetryFrequency'];_0x584269=this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xd3')];hopperUtils['verifyAdditionalPhones'](_0xa643ea,_0xa643ea[_0x8321('0xd4')],_0x57ff78['voiceQueue'])[_0x8321('0x3a')](function(_0x35b95c){_0x42be6d=_0x35b95c[_0x8321('0xd5')]==0x1;if(_0xa643ea[_0x8321('0xd1')]>=_0x20f0d6[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xd6')]){_0x20f0d6['queueCallerAbandonCreateState'](_0xa643ea,_0x35b95c[_0x8321('0xd5')]);}else{hopperUtils[_0x8321('0xd7')]({'active':![],'countdropretry':_0xa643ea[_0x8321('0xd1')],'scheduledat':moment()['add'](_0x20f0d6[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xd8')],_0x8321('0xd9'))[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x57ff78[_0x8321('0xda')],'ListId':_0x57ff78[_0x8321('0xdb')],'VoiceQueueId':_0x57ff78[_0x8321('0xdc')]||undefined,'CampaignId':_0x57ff78[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch('[rescheduleContact][Drop]'));var _0x1f6d4f=new History(_0xa643ea);_0x1f6d4f['state']=0xa;_0x1f6d4f[_0x8321('0x69')]=_0x8321('0xcd');_0x1f6d4f[_0x8321('0x6b')]=moment()['format'](_0x8321('0xbd'));_0x1f6d4f[_0x8321('0x6a')]=_0x1f6d4f['starttime'];_0x1f6d4f[_0x8321('0xde')]=_0xa643ea['calleridname'];_0x1f6d4f[_0x8321('0xdf')]=_0xa643ea['calleridnum'];hopperUtils[_0x8321('0xc2')](_0x1f6d4f)[_0x8321('0x9d')](loggerCatch(_0x8321('0xe0')));}})[_0x8321('0x3a')](function(){if(_0x42be6d)hopperUtils[_0x8321('0xe1')](_0xa643ea,_0x595f92,_0x584269)[_0x8321('0x3a')](function(){return 0x1;});});}else{this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]]['outboundDropCallsDayCallersExit']+=0x1;_0xa643ea['state']=0xb;_0xa643ea[_0x8321('0x69')]=_0x8321('0xe2');_0xa643ea['dropreason']=_0x8321('0xe3');_0xa643ea[_0x8321('0xe4')]+=0x1;_0xa643ea['countglobal']+=0x1;_0x595f92=this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xe5')];_0x584269=this[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xd3')];hopperUtils[_0x8321('0xe6')](_0xa643ea,_0xa643ea[_0x8321('0xd4')],_0x57ff78[_0x8321('0xe7')])[_0x8321('0x3a')](function(_0x29d956){if(_0xa643ea['countabandonedretry']>=_0x20f0d6[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xe8')]){_0x20f0d6['queueCallerAbandonCreateState'](_0xa643ea,_0x29d956[_0x8321('0xd5')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xa643ea['countabandonedretry'],'scheduledat':moment()[_0x8321('0xe9')](_0x20f0d6[_0x8321('0x1d')][_0x468e9a[_0x8321('0xb9')]][_0x8321('0xe5')],_0x8321('0xd9'))['format'](_0x8321('0xbd')),'ContactId':_0x57ff78[_0x8321('0xda')],'ListId':_0x57ff78[_0x8321('0xdb')],'VoiceQueueId':_0x57ff78[_0x8321('0xdc')]||undefined,'CampaignId':_0x57ff78[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0xea')));var _0x1a239f=new History(_0xa643ea);_0x1a239f[_0x8321('0xd4')]=0xb;_0x1a239f[_0x8321('0x69')]=_0x8321('0xe2');_0x1a239f[_0x8321('0x6b')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));_0x1a239f[_0x8321('0x6a')]=_0x1a239f['starttime'];_0x1a239f[_0x8321('0xde')]=_0xa643ea['calleridname'];_0x1a239f[_0x8321('0xdf')]=_0xa643ea[_0x8321('0xdf')];hopperUtils['createHistory'](_0x1a239f)[_0x8321('0x9d')](loggerCatch(_0x8321('0xeb')));}})[_0x8321('0x3a')](function(){if(_0x42be6d)hopperUtils[_0x8321('0xe1')](_0xa643ea,_0x595f92,_0x584269)[_0x8321('0x3a')](function(){return 0x1;});});}}}};Dialer[_0x8321('0x17')][_0x8321('0xec')]=function(_0x713d55){if(this[_0x8321('0xed')][_0x713d55[_0x8321('0xba')]]){this[_0x8321('0xed')][_0x713d55[_0x8321('0xba')]][_0x8321('0xee')]=_0x713d55[_0x8321('0xee')];}if(this[_0x8321('0x22')][_0x713d55[_0x8321('0xba')]]){this[_0x8321('0x22')][_0x713d55[_0x8321('0xba')]][_0x8321('0xee')]=_0x713d55[_0x8321('0xee')];}};Dialer[_0x8321('0x17')][_0x8321('0x35')]=function(_0x3ca947){if(!this[_0x8321('0xed')][_0x3ca947['actionid']]){return;}var _0x94939f=this[_0x8321('0x1d')][this[_0x8321('0xed')][_0x3ca947['actionid']][_0x8321('0xb9')]]['strategy']||_0x8321('0xef');if(_0x94939f==='roundrobin'){if(this[_0x8321('0xed')][_0x3ca947[_0x8321('0xf0')]]&&_['isNil'](this[_0x8321('0xed')][_0x3ca947['actionid']][_0x8321('0xf1')])&&_0x3ca947[_0x8321('0x86')]==='1'&&_0x3ca947['paused']==='0'){if(this[_0x8321('0x1e')][_0x3ca947[_0x8321('0xf2')]]){if(!this['agents'][_0x3ca947[_0x8321('0xf2')]][_0x8321('0xf1')]){this[_0x8321('0x1e')][_0x3ca947['stateinterface']][_0x8321('0xf1')]=!![];this['actions'][_0x3ca947[_0x8321('0xf0')]]['locked']=!![];this[_0x8321('0xed')][_0x3ca947[_0x8321('0xf0')]][_0x8321('0xf2')]=_0x3ca947[_0x8321('0xf2')];}}}}else if(_0x94939f===_0x8321('0xef')){if(this[_0x8321('0xed')][_0x3ca947[_0x8321('0xf0')]]){if(this[_0x8321('0x1e')][_0x3ca947['stateinterface']]){this[_0x8321('0xed')][_0x3ca947[_0x8321('0xf0')]][_0x8321('0xf2')]=_0x3ca947['stateinterface'];if(_[_0x8321('0xf3')](this[_0x8321('0x26')][this[_0x8321('0xed')][_0x3ca947[_0x8321('0xf0')]][_0x8321('0xb9')]])){this['queueBooked'][this['actions'][_0x3ca947[_0x8321('0xf0')]][_0x8321('0xb9')]]=[];}this['queueBooked'][this[_0x8321('0xed')][_0x3ca947['actionid']][_0x8321('0xb9')]][_0x8321('0x97')](_['merge'](_[_0x8321('0x70')](this[_0x8321('0xed')][_0x3ca947['actionid']],[_0x8321('0xf4'),_0x8321('0xf2')]),{'status':_0x3ca947[_0x8321('0x86')],'paused':_0x3ca947[_0x8321('0xf5')]}));}}}};Dialer[_0x8321('0x17')][_0x8321('0x36')]=function(_0x4f42bb){if(!this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]){return;}var _0x502843=this;var _0x1ddffc=this['voiceQueues'][this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['queue']];var _0x561ce7=_0x1ddffc[_0x8321('0xf6')]||_0x8321('0xef');if(_0x561ce7===_0x8321('0xf7')){if(this['actions'][_0x4f42bb[_0x8321('0xf0')]]&&this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['stateinterface']){this[_0x8321('0x1c')][_0x8321('0xf8')](this['actions'][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xf4')],this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['stateinterface'])[_0x8321('0x9d')](function(_0x2410df){logger[_0x8321('0x61')](_0x8321('0xf9'),util[_0x8321('0x3f')](_0x2410df,{'showHidden':![],'depth':null}));})[_0x8321('0x1a')](function(){_0x502843[_0x8321('0xc7')](_0x502843[_0x8321('0x1d')][_0x502843[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xb9')]]);_0x502843[_0x8321('0x1e')][_0x502843[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xf2')]][_0x8321('0xf1')]=![];delete _0x502843['actions'][_0x4f42bb['actionid']];unlockQueueStatus(_0x1ddffc);});}else{this[_0x8321('0xc7')](this['voiceQueues'][this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x8321('0xed')][_0x4f42bb['actionid']][_0x8321('0xda')],'ListId':this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xdb')],'VoiceQueueId':this[_0x8321('0xed')][_0x4f42bb['actionid']][_0x8321('0xdc')]||undefined,'CampaignId':this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['CampaignId']||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0xfa')));delete this['actions'][_0x4f42bb[_0x8321('0xf0')]];unlockQueueStatus(_0x1ddffc);}}else if(_0x561ce7===_0x8321('0xef')){var _0x33e9d8;if(this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]&&!_['isEmpty'](this[_0x8321('0x26')][this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]]['queue']])){if(this['queueBookedRR'][_0x502843['actions'][_0x4f42bb['actionid']]['queue']]){this[_0x8321('0x27')][_0x502843[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xb9')]]=this['queueBookedRR'][this[_0x8321('0xed')][_0x4f42bb['actionid']][_0x8321('0xb9')]]?this[_0x8321('0x27')][this[_0x8321('0xed')][_0x4f42bb['actionid']][_0x8321('0xb9')]]:this['queueBooked'][this[_0x8321('0xed')][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xb9')]]?this[_0x8321('0x26')][this['actions'][_0x4f42bb[_0x8321('0xf0')]][_0x8321('0xb9')]][_0x8321('0xfb')]||0x0:0x0;}this[_0x8321('0x26')][this['actions'][_0x4f42bb['actionid']]['queue']][_0x8321('0xfb')]=this[_0x8321('0x27')][this['actions'][_0x4f42bb[_0x8321('0xf0')]]['queue']];for(var _0x530d6f=0x0;_0x530d6f=_0x59b47f[_0x8321('0x123')]){_0x5a4ec5[_0x8321('0x124')](_0x557a69,_0x55d8ac,_0x20e4dc,_0x8321('0x125'));}else{if(_0x557a69[_0x8321('0x11e')]>=_0x59b47f[_0x8321('0x126')]){_0x5a4ec5[_0x8321('0x127')](_0x557a69,_0x55d8ac,_0x20e4dc,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x557a69[_0x8321('0x11e')],'scheduledat':moment()['add'](_0x59b47f['dialMachineRetryFrequency'],'minutes')[_0x8321('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x557a69[_0x8321('0xda')],'ListId':_0x557a69[_0x8321('0xdb')],'VoiceQueueId':_0x557a69[_0x8321('0xdc')]||undefined,'CampaignId':_0x557a69[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch('[rescheduleContact][Machine]'));_0x55d8ac({'reschedule':0x1});}}});}if(_0x483717[_0x8321('0x3d')]===_0x8321('0xbb')&&this[_0x8321('0xa7')][_0x483717[_0x8321('0xb9')]][_0x8321('0x10f')]&&_0x102f94[_0x8321('0x110')]===_0x8321('0x111')){delete this['uniqueId'][_0x102f94['uniqueid']];this[_0x8321('0xc7')](this[_0x8321('0xa7')][_0x483717[_0x8321('0xb9')]]);_0x4831ba=new Hangup(_0x483717,_0x102f94);_0x4831ba['state']=0x12;_0x4831ba['statedesc']='HangupInAMD';_0x4831ba[_0x8321('0x114')]='AMD';ami[_0x8321('0x3c')](_0x8321('0x116'),ut[_0x8321('0x117')](_0x4831ba,_0x8321('0x118')));this['saveInDb'](_0x4831ba,'[syncHangupInAMDIvr][createHistory]',_0x8321('0x128'));}if(_0x483717[_0x8321('0x3d')]===_0x8321('0xbb')&&this['campaigns'][_0x483717[_0x8321('0xb9')]][_0x8321('0x10f')]&&_0x102f94[_0x8321('0x110')]===_0x8321('0x11c')){return new Promise(function(_0x1f03a2,_0x121756){delete _0x5a4ec5[_0x8321('0x22')][_0x102f94['uniqueid']];_0x5a4ec5[_0x8321('0xc7')](_0x5a4ec5[_0x8321('0xa7')][_0x483717['queue']]);_0x5a4ec5[_0x8321('0xa7')][_0x483717[_0x8321('0xb9')]][_0x8321('0xbe')]+=0x1;_0x5a4ec5[_0x8321('0xa7')][_0x483717[_0x8321('0xb9')]][_0x8321('0x112')]+=0x1;var _0x539dfb=_0x5a4ec5[_0x8321('0xa7')][_0x483717['queue']];var _0x546c3c=new Hangup(_0x483717,_0x102f94);_0x546c3c[_0x8321('0xd4')]=0x13;_0x546c3c['statedesc']=_0x8321('0x11d');_0x546c3c['membername']='AMD';_0x546c3c[_0x8321('0x11e')]+=0x1;_0x546c3c[_0x8321('0xd2')]+=0x1;_0x546c3c[_0x8321('0x118')]=!![];ami[_0x8321('0x3c')](_0x8321('0x116'),ut[_0x8321('0x117')](_0x546c3c,_0x8321('0x118')));hopperUtils[_0x8321('0xc2')](_0x546c3c)[_0x8321('0x9d')](loggerCatch(_0x8321('0x129')));if(_0x546c3c[_0x8321('0x11f')]+_0x546c3c['countcongestionretry']+_0x546c3c[_0x8321('0x12a')]+_0x546c3c[_0x8321('0x121')]+_0x546c3c[_0x8321('0xd1')]+_0x546c3c[_0x8321('0xe4')]+_0x546c3c[_0x8321('0x11e')]+_0x546c3c[_0x8321('0x122')]>=_0x539dfb['dialGlobalMaxRetry']){_0x5a4ec5[_0x8321('0x124')](_0x546c3c,_0x1f03a2,_0x121756,_0x8321('0x125'));}else{if(_0x546c3c['countmachineretry']>=_0x539dfb[_0x8321('0x126')]){_0x5a4ec5[_0x8321('0x127')](_0x546c3c,_0x1f03a2,_0x121756,_0x8321('0x12b'));}else{hopperUtils[_0x8321('0xd7')]({'active':![],'countmachineretry':_0x546c3c['countmachineretry'],'scheduledat':moment()['add'](_0x539dfb['dialMachineRetryFrequency'],_0x8321('0xd9'))[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x546c3c[_0x8321('0xda')],'ListId':_0x546c3c[_0x8321('0xdb')],'VoiceQueueId':_0x546c3c[_0x8321('0xdc')]||undefined,'CampaignId':_0x546c3c[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x12c')));_0x1f03a2({'reschedule':0x1});}}});}}};Dialer[_0x8321('0x17')][_0x8321('0x30')]=function(_0x42da2c){var _0x581914=this[_0x8321('0x22')][_0x42da2c[_0x8321('0xba')]];var _0x75d941;if(_0x581914&&_0x581914[_0x8321('0x3d')]==='ivr'){delete this[_0x8321('0x22')][_0x42da2c[_0x8321('0xba')]];this[_0x8321('0xc7')](this[_0x8321('0xa7')][_0x581914[_0x8321('0xb9')]]);this[_0x8321('0xa7')][_0x581914[_0x8321('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x75d941=new Hangup(_0x581914,_0x42da2c);hopperUtils[_0x8321('0xc2')](_0x75d941)[_0x8321('0x9d')](loggerCatch(_0x8321('0x12d')));hopperUtils[_0x8321('0xc4')](_0x75d941)[_0x8321('0x9d')](loggerCatch(_0x8321('0x12e')));}if(_0x581914&&_0x581914['type']!=='ivr'&&isNotNull(this[_0x8321('0x1d')][_0x581914['queue']][_0x8321('0x12f')])){delete this['uniqueId'][_0x42da2c[_0x8321('0xba')]];this['updateOriginated'](this['voiceQueues'][_0x581914['queue']]);this['voiceQueues'][_0x581914['queue']][_0x8321('0xbe')]+=0x1;this[_0x8321('0x1d')][_0x581914[_0x8321('0xb9')]][_0x8321('0x112')]+=0x1;_0x75d941=new Hangup(_0x581914,_0x42da2c);_0x75d941[_0x8321('0xd4')]=0x10;_0x75d941[_0x8321('0x69')]=_0x8321('0x130');_0x75d941[_0x8321('0x114')]=_0x8321('0x131');hopperUtils[_0x8321('0xc2')](_0x75d941)[_0x8321('0x9d')](loggerCatch(_0x8321('0x12d')));hopperUtils[_0x8321('0xc4')](_0x75d941)[_0x8321('0x9d')](loggerCatch(_0x8321('0x12e')));}if(_0x581914&&_0x581914[_0x8321('0x3d')]!=='ivr'&&!isNotNull(this[_0x8321('0x1d')][_0x581914[_0x8321('0xb9')]][_0x8321('0x12f')])){delete this['uniqueId'][_0x42da2c[_0x8321('0xba')]];this['updateOriginated'](this[_0x8321('0x1d')][_0x581914['queue']]);this[_0x8321('0x1d')][_0x581914[_0x8321('0xb9')]][_0x8321('0x132')]+=0x1;_0x75d941=new Hangup(_0x581914,_0x42da2c);_0x75d941['state']=0xc;_0x75d941[_0x8321('0x69')]=_0x42da2c[_0x8321('0x133')];_0x75d941[_0x8321('0x114')]='Unknow';hopperUtils['createHistory'](_0x75d941)[_0x8321('0x9d')](loggerCatch(_0x8321('0x12d')));hopperUtils[_0x8321('0xc4')](_0x75d941)[_0x8321('0x9d')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x8321('0x17')][_0x8321('0x8')]=function(_0x484d4a){var _0x5b60f8=this;if(!_0x5b60f8[_0x8321('0x28')][_0x484d4a[_0x8321('0x5e')]]){_0x5b60f8[_0x8321('0x28')][_0x484d4a[_0x8321('0x5e')]]={'running':![]};}else if(_0x5b60f8[_0x8321('0x28')][_0x484d4a[_0x8321('0x5e')]]['running']===!![]){return;}else if(_0x5b60f8['queuesSummary'][_0x484d4a[_0x8321('0x5e')]][_0x8321('0x134')]===![]){_0x5b60f8[_0x8321('0x28')][_0x484d4a['name']][_0x8321('0x134')]=!![];}var _0x56a28d=_0x5b60f8[_0x8321('0x1d')][_0x484d4a[_0x8321('0x5e')]];var _0x5d2f52=_0x56a28d[_0x8321('0x64')]!==utils[_0x8321('0x68')][_0x8321('0x75')];var _0x1266bf=utils[_0x8321('0x135')](_0x56a28d);_0x56a28d['statusMessage']=utils[_0x8321('0x136')](_0x56a28d,_0x5b60f8[_0x8321('0x1f')]);Promise[_0x8321('0xaa')]()[_0x8321('0x3a')](function(){if(_0x56a28d[_0x8321('0x137')]===utils[_0x8321('0x68')][_0x8321('0x75')]){if(_0x5d2f52){clearPredictiveAttributes(_0x56a28d);_0x484d4a['startPredictive']=undefined;_0x484d4a[_0x8321('0x24')]=undefined;}if(_0x56a28d[_0x8321('0x137')]===utils[_0x8321('0x68')]['INACTIVE']){_0x484d4a['available']=0x0;_0x484d4a[_0x8321('0xf5')]=0x0;_0x484d4a[_0x8321('0x138')]=0x0;_0x484d4a[_0x8321('0x139')]=0x0;_0x484d4a[_0x8321('0x13a')]=0x0;}}else if(_0x56a28d['statusMessage']===utils[_0x8321('0x68')][_0x8321('0x13b')]&&!_0x1266bf){return _0x5b60f8[_0x8321('0x90')](_0x56a28d,!![])[_0x8321('0x3a')](function(){return _0x5b60f8[_0x8321('0x90')](_0x56a28d,![]);})[_0x8321('0x3a')](function(){return _0x5b60f8[_0x8321('0xaf')](_0x56a28d);})[_0x8321('0x9d')](function(_0x26d2bd){loggerSyncQueueSummary['debug'](_0x8321('0x13c'),util[_0x8321('0x3f')](_0x26d2bd,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x56a28d);});}else{clearPredictiveAttributes(_0x56a28d);}})['then'](function(){var _0x218450=_0x484d4a['compareToOutboundQueue'](_0x56a28d);if(_0x218450||_0x56a28d[_0x8321('0x13d')]){_0x56a28d[_0x8321('0x13d')]=![];_0x484d4a['updateReportFromOutboundQueue'](_0x56a28d);Object[_0x8321('0x13e')](_0x56a28d,_0x484d4a);emitOutboundVoiceQueueSummary(_0x484d4a);}_0x5b60f8[_0x8321('0x28')][_0x56a28d[_0x8321('0x5e')]][_0x8321('0x134')]=![];})[_0x8321('0x9d')](function(_0x3c8035){logger[_0x8321('0x61')](_0x8321('0x13c'),util[_0x8321('0x3f')](_0x3c8035,{'showHidden':![],'depth':null}));_0x5b60f8[_0x8321('0x28')][_0x56a28d['name']][_0x8321('0x134')]=![];});};Dialer[_0x8321('0x17')][_0x8321('0x2f')]=_[_0x8321('0x13f')](function(){var _0x453c94=_[_0x8321('0x140')](this['voiceQueues'],function(_0x3e1cb0){return _0x3e1cb0[_0x8321('0x141')];});var _0x42ba11=_[_0x8321('0x140')](this[_0x8321('0x1e')],function(_0x8dbbab){return _0x8dbbab['online']&&_0x8dbbab[_0x8321('0x86')]==='reachable';});if(_0x453c94['length']>0x0&&_0x42ba11[_0x8321('0x96')]>0x0){return Promise[_0x8321('0xaa')]()[_0x8321('0x3a')](cmHopper[_0x8321('0x142')](_[_0x8321('0x143')](_0x453c94,'id'),previewRecallmeReminderInterval,_[_0x8321('0x143')](_0x42ba11,'id')))[_0x8321('0x3a')](function(_0x80d84b){for(var _0x1eddf4=0x0;_0x1eddf4<_0x80d84b[_0x8321('0x96')];_0x1eddf4++){var _0x41120a=_0x80d84b[_0x1eddf4][_0x8321('0x144')][_0x8321('0x5e')];if(_0x41120a)io['to'](util[_0x8321('0x84')](_0x8321('0x145'),_0x41120a))[_0x8321('0x3c')](_0x8321('0x146'),{'hopper':_0x80d84b[_0x1eddf4]});}})[_0x8321('0x9d')](function(_0x360e72){logger['error'](_0x8321('0x147'),_0x360e72);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8321('0x17')][_0x8321('0x38')]=function(){var _0x432180=this;setInterval(function(){_0x432180[_0x8321('0x148')](_0x432180[_0x8321('0x22')],_0x8321('0x149'));_0x432180[_0x8321('0x148')](_0x432180[_0x8321('0xed')],_0x8321('0x14a'));},0x32c8);};Dialer[_0x8321('0x17')]['clearZombieChannels']=function(_0x5d99e1,_0xc58f99){var _0xdd38e9=this;for(var _0x45e405 in _0x5d99e1){if(typeof _0x5d99e1[_0x45e405]!=='undefined'){this[_0x8321('0x1b')][_0x8321('0x18')](function(){if(!_[_0x8321('0xf3')](_0x5d99e1[_0x45e405])){return ami[_0x8321('0x98')]({'action':_0x8321('0x86'),'channel':_0x5d99e1[_0x45e405][_0x8321('0xee')]})[_0x8321('0x9d')](function(_0x235cd5){if(_0x235cd5[_0x8321('0x64')]===_0x8321('0x14b')){setTimeout(function(){if(_0x5d99e1[_0x45e405]&&_0x5d99e1[_0x45e405][_0x8321('0x3d')]!==_0x8321('0xbb')){_0xdd38e9[_0x8321('0xc7')](_0xdd38e9['voiceQueues'][_0x5d99e1[_0x45e405][_0x8321('0xb9')]]);logger[_0x8321('0x61')](_0x8321('0x14c'),_0xc58f99,_0x45e405,_0x5d99e1[_0x45e405][_0x8321('0xb9')]);delete _0x5d99e1[_0x45e405];}if(_0x5d99e1[_0x45e405]&&_0x5d99e1[_0x45e405][_0x8321('0x3d')]===_0x8321('0xbb')){_0xdd38e9[_0x8321('0xc7')](_0xdd38e9[_0x8321('0xa7')][_0x5d99e1[_0x45e405][_0x8321('0xb9')]]);logger['error'](_0x8321('0x14d'),_0xc58f99,_0x45e405,_0x5d99e1[_0x45e405]['queue']);delete _0x5d99e1[_0x45e405];}},0x2328);}});}});}}};Dialer[_0x8321('0x17')]['getVoiceQueueRtPauses']=function(_0xfe5365){return Promise[_0x8321('0xaa')]()[_0x8321('0x3a')](voiceQueueRt[_0x8321('0x14e')](_0xfe5365))[_0x8321('0x9d')](loggerCatch(_0x8321('0x14f')));};Dialer[_0x8321('0x17')][_0x8321('0xc7')]=function(_0x54d722){if(!_[_0x8321('0x3b')](_0x54d722)&&_0x54d722!==null){if(typeof _0x54d722[_0x8321('0x7b')]!==_0x8321('0xa8')){if(_0x54d722['originated']>0x0){_0x54d722[_0x8321('0x7b')]-=0x1;}else{logger[_0x8321('0x61')](_0x8321('0x150'));}}}else{logger[_0x8321('0x61')](_0x8321('0x151'));}};Dialer[_0x8321('0x17')][_0x8321('0x152')]=function(_0x555b02,_0x61edcb){var _0x5f19e1=this;return function(_0x2957e1){_0x5f19e1[_0x8321('0xc7')](_0x61edcb);logger[_0x8321('0x61')](_0x555b02,util[_0x8321('0x3f')](_0x2957e1,{'showHidden':![],'depth':null}));};};Dialer[_0x8321('0x17')][_0x8321('0x153')]=function(_0x3e6beb,_0x9d8afd,_0x1bd43b){var _0x190311={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x9d8afd);this[_0x8321('0x119')](_[_0x8321('0x5b')](_0x190311,_['pick'](_0x1bd43b,[_0x8321('0xda'),_0x8321('0xdb'),_0x8321('0x154'),_0x8321('0xdc'),_0x8321('0xdd')])),'[emptyContact][createHistory]',_0x8321('0x155'));logger[_0x8321('0x61')](_0x3e6beb);};Dialer[_0x8321('0x17')][_0x8321('0x119')]=function(_0x2c8654,_0x5597cb,_0xb9c97){hopperUtils[_0x8321('0xc2')](_0x2c8654)[_0x8321('0x9d')](loggerCatch(_0x5597cb));hopperUtils[_0x8321('0xc4')](_0x2c8654)[_0x8321('0x9d')](loggerCatch(_0xb9c97));};Dialer['prototype'][_0x8321('0x156')]=function(_0x3c64bf,_0x5877c8){hopperUtils[_0x8321('0xc2')](_0x3c64bf)[_0x8321('0x9d')](loggerCatch(_0x8321('0xc3')));if(_0x5877c8==0x0){hopperUtils[_0x8321('0xc4')](_0x3c64bf)[_0x8321('0x9d')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x8321('0x17')][_0x8321('0x147')]=function(_0x2b7850){return Promise['resolve']()[_0x8321('0x3a')](cmHopper[_0x8321('0x142')](_0x2b7850['id'],previewRecallmeReminderInterval))[_0x8321('0x3a')](function(_0x2b731a){for(var _0x1ff915=0x0;_0x1ff915<_0x2b731a[_0x8321('0x96')];_0x1ff915++){var _0x2034cf=_0x2b731a[_0x1ff915][_0x8321('0x144')][_0x8321('0x5e')];if(_0x2034cf)io['to'](util[_0x8321('0x84')]('user:%s',_0x2034cf))[_0x8321('0x3c')](_0x8321('0x146'),{'hopper':_0x2b731a[_0x1ff915]});}})['catch'](function(){});};Dialer[_0x8321('0x17')]['launchHandleIvr']=function(_0x214c92){var _0x4fa077=this;return function(){_0x4fa077[_0x8321('0x157')](_0x214c92);};};Dialer['prototype']['actionOriginate']=function(_0x5c3933,_0x46aa4e){var _0x30137c=this;var _0x4f96c4=uuid['v4']();this[_0x8321('0xed')][_0x4f96c4]=new Action(_0x5c3933,_0x46aa4e,_0x4f96c4);return new Promise(function(_0x220d4a,_0x4527ac){if(_[_0x8321('0x3b')](_0x5c3933)&&typeof _0x5c3933!==_0x8321('0x158')){return _0x4527ac(msgResponse('originate',_0x8321('0x91'),_0x8321('0x159')));}if(_[_0x8321('0x3b')](_0x46aa4e[_0x8321('0x15a')])||_0x46aa4e['phone']===null){return _0x4527ac(msgResponse(_0x8321('0x15b'),_0x8321('0x91'),_0x8321('0x15c')));}var _0x2f5876={'XMD-CALLERID':_0x30137c[_0x8321('0xed')][_0x4f96c4][_0x8321('0x15d')](),'XMD-AGI':_0x5c3933[_0x8321('0x12f')]?util[_0x8321('0x84')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5c3933[_0x8321('0x12f')]):_0x8321('0x15e'),'XMD-AGIAFTER':_0x5c3933[_0x8321('0xd0')]?util[_0x8321('0x84')](_0x8321('0x15f'),ipAgi,_0x5c3933[_0x8321('0xd0')]):_0x8321('0x15e'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5c3933)?util[_0x8321('0x84')]('\x22%s,%s%s,,,%s\x22',_0x5c3933[_0x8321('0x5e')],_0x5c3933[_0x8321('0x160')]||'',_0x5c3933[_0x8321('0xc1')]?'c':'',_0x5c3933[_0x8321('0xcb')]||0x3):'NONE','XMD-CONTACTID':_0x46aa4e[_0x8321('0xda')],'XMD-CDRTYPE':_0x8321('0x5'),'CALLERID(all)':_0x30137c[_0x8321('0xed')][_0x4f96c4]['getCaller'](),'XMD-AMD':_0x5c3933[_0x8321('0x10f')]?_0x8321('0x13b'):'NONE','XMD-DESTINATION':_0x8321('0x10e')};if(_0x5c3933[_0x8321('0x10f')]){_0x2f5876[_0x8321('0x161')]=_0x5c3933[_0x8321('0x162')]||0x9c4;_0x2f5876[_0x8321('0x163')]=_0x5c3933[_0x8321('0x164')]||0x5dc;_0x2f5876[_0x8321('0x165')]=_0x5c3933[_0x8321('0x166')]||0x320;_0x2f5876[_0x8321('0x167')]=_0x5c3933['dialAMDTotalAnalysisTime']||0x1388;_0x2f5876['XMD-AMDMINWORDLENGTH']=_0x5c3933['dialAMDMinWordLength']||0x64;_0x2f5876[_0x8321('0x168')]=_0x5c3933[_0x8321('0x169')]||0x32;_0x2f5876[_0x8321('0x16a')]=_0x5c3933[_0x8321('0x16b')]||0x3;_0x2f5876[_0x8321('0x16c')]=_0x5c3933[_0x8321('0x16d')]||0x100;_0x2f5876[_0x8321('0x16e')]=_0x5c3933['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x5c3933)){_0x2f5876[_0x8321('0x16f')]=_0x46aa4e['VoiceQueueId'];}else{_0x2f5876[_0x8321('0x170')]=_0x46aa4e[_0x8321('0xdd')];}var _0x2ffcdf=utils[_0x8321('0x171')](_0x46aa4e[_0x8321('0x172')]);Object['assign'](_0x2f5876,_0x2ffcdf);var _0x2567b3=_0x30137c[_0x8321('0x82')](_0x5c3933[_0x8321('0x8a')])?utils['getCallerId'](_0x5c3933[_0x8321('0x8a')][_0x8321('0x173')],_0x5c3933[_0x8321('0x174')],_0x5c3933[_0x8321('0x175')]>0x0?utils[_0x8321('0x176')](_0x5c3933[_0x8321('0x177')],_0x5c3933[_0x8321('0x175')]):_0x5c3933[_0x8321('0x177')]):utils[_0x8321('0x178')](_['isNil'](_0x5c3933['TrunkBackup'])?_0x5c3933[_0x8321('0x8a')]['callerid']:_0x5c3933[_0x8321('0x179')]['callerid'],_0x5c3933[_0x8321('0x174')],_0x5c3933['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x8321('0x176')](_0x5c3933[_0x8321('0x177')],_0x5c3933[_0x8321('0x175')]):_0x5c3933['dialOriginateCallerIdNumber']);if(_0x2567b3){_0x2f5876['XMD-ORIGINATECALLERIDNAME']=_0x30137c[_0x8321('0xed')][_0x4f96c4][_0x8321('0x17a')]=utils[_0x8321('0x17b')](_0x2567b3);_0x2f5876[_0x8321('0x17c')]=_0x46aa4e[_0x8321('0x15a')];}_0x5c3933[_0x8321('0x17d')]=_0x2f5876;return ami['Action']({'actionid':_0x4f96c4,'action':_0x8321('0x15b'),'channel':_0x30137c['isTrunkReachable'](_0x5c3933['Trunk'])?util['format']('SIP/%s/%s%s',_0x5c3933['Trunk'][_0x8321('0x5e')],isNotNull(_0x5c3933['dialPrefix'])?_0x5c3933['dialPrefix'][_0x8321('0x17e')]()||'':'',_0x5c3933[_0x8321('0x17f')]>0x0?_0x46aa4e[_0x8321('0x15a')]['substring'](_0x5c3933[_0x8321('0x17f')]):_0x46aa4e[_0x8321('0x15a')]):util['format']('SIP/%s/%s%s',_[_0x8321('0xf3')](_0x5c3933['TrunkBackup'])?_0x5c3933[_0x8321('0x8a')]['name']:_0x5c3933['TrunkBackup']['name'],isNotNull(_0x5c3933[_0x8321('0x180')])?_0x5c3933[_0x8321('0x180')][_0x8321('0x17e')]()||'':'',_0x5c3933['dialCutDigit']>0x0?_0x46aa4e[_0x8321('0x15a')]['substring'](_0x5c3933[_0x8321('0x17f')]):_0x46aa4e[_0x8321('0x15a')]),'callerid':_0x2567b3,'Exten':_0x8321('0x10e'),'Context':'from-sip','Priority':'1','variable':_0x2f5876,'timeout':(_0x5c3933[_0x8321('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f96c4})[_0x8321('0x3a')](function(_0x1131af){return _0x220d4a(_0x1131af);})[_0x8321('0x9d')](function(_0x49831d){_0x5c3933[_0x8321('0x182')]+=0x1;var _0x25936c=new History(_0x30137c[_0x8321('0xed')][_0x4f96c4]);logger[_0x8321('0x61')](util[_0x8321('0x84')](_0x8321('0x183'),JSON[_0x8321('0x6f')](_0x49831d)));_0x25936c[_0x8321('0xd4')]=0xe;_0x25936c[_0x8321('0x69')]=_0x8321('0x184');_0x25936c['starttime']=moment()[_0x8321('0x84')]('YYYY-MM-DD\x20HH:mm:ss');_0x25936c[_0x8321('0x6a')]=_0x25936c['starttime'];hopperUtils[_0x8321('0xc2')](_0x25936c)['catch'](loggerCatch(_0x8321('0x185')));_0x30137c['moveContactManagedDialer'](_0x25936c)[_0x8321('0x9d')](loggerCatch(_0x8321('0x185')))[_0x8321('0x1a')](function(){delete _0x30137c[_0x8321('0xed')][_0x4f96c4];return _0x4527ac(msgResponse('originate',_0x8321('0x81'),_0x8321('0x186')));});});});};Dialer[_0x8321('0x17')]['checkRetriveMax']=function(_0x443b49,_0x5cbe21,_0x4ead77){var _0x1546f2=new History(_0x5cbe21);if(_0x1546f2['countbusyretry']+_0x1546f2['countcongestionretry']+_0x1546f2[_0x8321('0x12a')]+_0x1546f2[_0x8321('0x121')]+_0x1546f2['countdropretry']+_0x1546f2[_0x8321('0xe4')]+_0x1546f2[_0x8321('0x11e')]+_0x1546f2[_0x8321('0x122')]>=_0x4ead77[_0x8321('0x123')]-0x1){return!![];}switch(_0x443b49){case 0x3:if(_0x1546f2['countnoanswerretry']>=_0x4ead77[_0x8321('0x187')]-0x1){return!![];}hopperUtils[_0x8321('0xd7')]({'active':![],'countnoanswerretry':_0x1546f2[_0x8321('0x12a')]+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77['dialNoAnswerRetryFrequency'],_0x8321('0xd9'))[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x1546f2['ContactId'],'ListId':_0x1546f2['ListId'],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2[_0x8321('0xdd')]||undefined})['catch'](loggerCatch(_0x8321('0x188')));break;case 0x5:if(_0x1546f2[_0x8321('0x11f')]>=_0x4ead77[_0x8321('0x189')]-0x1){return!![];}hopperUtils[_0x8321('0xd7')]({'active':![],'countbusyretry':_0x1546f2[_0x8321('0x11f')]+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77[_0x8321('0x18a')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1546f2[_0x8321('0xda')],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x18b')));break;case 0x8:if(_0x1546f2[_0x8321('0x120')]>=_0x4ead77[_0x8321('0x18c')]-0x1){return!![];}hopperUtils[_0x8321('0xd7')]({'active':![],'countcongestionretry':_0x1546f2[_0x8321('0x120')]+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77['dialCongestionRetryFrequency'],'minutes')[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x1546f2[_0x8321('0xda')],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2['CampaignId']||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x18d')));break;case 0x0:if(_0x1546f2[_0x8321('0x121')]>=_0x4ead77[_0x8321('0x18e')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1546f2[_0x8321('0x121')]+=0x1,'scheduledat':moment()['add'](_0x4ead77[_0x8321('0x18f')],_0x8321('0xd9'))[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x1546f2['ContactId'],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2[_0x8321('0xdd')]||undefined})['catch'](loggerCatch(_0x8321('0x190')));}break;case 0xa:if(_0x1546f2['countdropretry']>=_0x4ead77[_0x8321('0xd6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1546f2[_0x8321('0xd1')]+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77['dialDropRetryFrequency'],'minutes')[_0x8321('0x84')](_0x8321('0xbd')),'ContactId':_0x1546f2['ContactId'],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2[_0x8321('0xdd')]||undefined})['catch'](loggerCatch(_0x8321('0x191')));break;case 0xb:if(_0x1546f2[_0x8321('0xe4')]>=_0x4ead77['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x8321('0xd7')]({'active':![],'countabandonedretry':_0x1546f2['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77[_0x8321('0xe5')],_0x8321('0xd9'))[_0x8321('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1546f2[_0x8321('0xda')],'ListId':_0x1546f2['ListId'],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2['CampaignId']||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0xea')));break;case 0x13:if(_0x1546f2[_0x8321('0x11e')]>=_0x4ead77[_0x8321('0x126')]-0x1){return!![];}hopperUtils[_0x8321('0xd7')]({'active':![],'countmachineretry':_0x1546f2[_0x8321('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x4ead77[_0x8321('0x192')],_0x8321('0xd9'))['format'](_0x8321('0xbd')),'ContactId':_0x1546f2[_0x8321('0xda')],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x12c')));break;case 0x14:if(_0x1546f2[_0x8321('0x122')]>=_0x4ead77[_0x8321('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1546f2['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x8321('0xe9')](_0x4ead77[_0x8321('0x194')],_0x8321('0xd9'))[_0x8321('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1546f2['ContactId'],'ListId':_0x1546f2[_0x8321('0xdb')],'VoiceQueueId':_0x1546f2[_0x8321('0xdc')]||undefined,'CampaignId':_0x1546f2['CampaignId']||undefined})[_0x8321('0x9d')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0xea73c8,_0x3c2e85,_0x161521){var _0x5cf3d0=this;var _0xb8ce31=new History(_0xea73c8);var _0x3494d6=![];var _0x522565;var _0x2eeb29;return new Promise(function(_0x1fce25,_0x322302){if(_['isUndefined'](_0x3c2e85)&&typeof _0x3c2e85!==_0x8321('0x158')){return _0x322302(msgResponse(_0x8321('0x195'),_0x8321('0x91'),_0x8321('0x196')));}if(_['isUndefined'](_0x161521)&&typeof _0x161521!=='object'){return _0x322302(msgResponse('[callProgressDetecting]',_0x8321('0x91'),_0x8321('0x197')));}hopperUtils[_0x8321('0xe6')](_0xb8ce31,_0x161521[_0x8321('0xbf')],_0x3c2e85)[_0x8321('0x3a')](function(_0x2ea34a){if(_0x2ea34a['additional']==0x1)_0x3494d6=!![];switch(_0x161521[_0x8321('0xbf')]){case'0':_0x3c2e85['outboundNoSuchCallsDay']+=0x1;_0xb8ce31[_0x8321('0xd4')]=0x0;_0xb8ce31[_0x8321('0x69')]=_0x8321('0x198');_0xb8ce31[_0x8321('0x121')]+=0x1;_0xb8ce31[_0x8321('0xd2')]+=0x1;ami[_0x8321('0x3c')](_0x8321('0x199'),ut[_0x8321('0x117')](_0xea73c8,_0x8321('0x19a')));_0x522565=_0x3c2e85['dialNoSuchNumberRetryFrequency'];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];hopperUtils['createHistory'](_0xb8ce31)['catch'](loggerCatch(_0x8321('0x129')));if(_0x5cf3d0[_0x8321('0x19b')](0x0,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0x121')]>=_0x3c2e85[_0x8321('0x18e')]){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x19c'));}else{_0x5cf3d0[_0x8321('0x124')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x19c'));}}break;case'3':_0x3c2e85[_0x8321('0x19d')]+=0x1;_0xb8ce31[_0x8321('0xd4')]=0x3;_0xb8ce31[_0x8321('0x69')]=_0x8321('0x19e');_0xb8ce31[_0x8321('0x12a')]+=0x1;_0xb8ce31[_0x8321('0xd2')]+=0x1;var _0xd4b5b9=ut['buildNoAnswerEventPayload'](_0xea73c8,_0x3c2e85);ami[_0x8321('0x3c')](_0x8321('0x19f'),_0xd4b5b9);_0x522565=_0x3c2e85[_0x8321('0x1a0')];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];hopperUtils[_0x8321('0xc2')](_0xb8ce31)['catch'](loggerCatch(_0x8321('0x1a1')));if(_0x5cf3d0[_0x8321('0x19b')](0x3,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0x12a')]>=_0x3c2e85['dialNoAnswerMaxRetry']){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1a2'));}else{_0x5cf3d0['stateGlobal'](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1a2'));}}break;case'5':_0x3c2e85[_0x8321('0x1a3')]+=0x1;_0xb8ce31['state']=0x5;_0xb8ce31[_0x8321('0x69')]=_0x8321('0x1a4');_0xb8ce31[_0x8321('0x11f')]+=0x1;_0xb8ce31['countglobal']+=0x1;ami[_0x8321('0x3c')]('custom:agentbusy',ut[_0x8321('0x117')](_0xea73c8,_0x8321('0x1a5')));_0x522565=_0x3c2e85['dialBusyRetryFrequency'];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];hopperUtils[_0x8321('0xc2')](_0xb8ce31)['catch'](loggerCatch(_0x8321('0x1a6')));if(_0x5cf3d0['checkRetriveMax'](0x5,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31['countbusyretry']>=_0x3c2e85[_0x8321('0x189')]){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1a7'));}else{_0x5cf3d0['stateGlobal'](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1a7'));}}break;case'8':_0x3c2e85[_0x8321('0x1a8')]+=0x1;_0xb8ce31[_0x8321('0xd4')]=0x8;_0xb8ce31[_0x8321('0x69')]=_0x8321('0x1a9');_0xb8ce31[_0x8321('0x120')]+=0x1;_0xb8ce31[_0x8321('0xd2')]+=0x1;_0x522565=_0x3c2e85[_0x8321('0x1aa')];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];ami[_0x8321('0x3c')](_0x8321('0x1ab'),ut['buildObj'](_0xea73c8,_0x8321('0x1ac')));hopperUtils[_0x8321('0xc2')](_0xb8ce31)[_0x8321('0x9d')](loggerCatch(_0x8321('0x1ad')));if(_0x5cf3d0[_0x8321('0x19b')](0x8,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0x120')]>=_0x3c2e85['dialCongestionMaxRetry']){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1ae'));}else{_0x5cf3d0[_0x8321('0x124')](_0xb8ce31,_0x1fce25,_0x322302,'reason\x208\x20congestion');}}break;case'11':_0x3c2e85[_0x8321('0x1af')]+=0x1;_0xb8ce31['state']=0xb;_0xb8ce31[_0x8321('0x69')]='Abandoned';_0xb8ce31[_0x8321('0xe4')]+=0x1;_0xb8ce31[_0x8321('0xd2')]+=0x1;_0x522565=_0x3c2e85['dialAbandonedRetryFrequency'];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];hopperUtils[_0x8321('0xc2')](_0xb8ce31)[_0x8321('0x9d')](loggerCatch(_0x8321('0xeb')));if(_0x5cf3d0['checkRetriveMax'](0xb,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0xe4')]>=_0x3c2e85['dialAbandonedMaxRetry']){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1b0'));}else{_0x5cf3d0[_0x8321('0x124')](_0xb8ce31,_0x1fce25,_0x322302,'reason\x2011\x20abandoned');}}break;case'20':_0x3c2e85[_0x8321('0x1b1')]+=0x1;_0xb8ce31[_0x8321('0xd4')]=0x14;_0xb8ce31['statedesc']=_0x8321('0x1b2');_0xb8ce31[_0x8321('0x122')]+=0x1;_0xb8ce31[_0x8321('0xd2')]+=0x1;_0x522565=_0x3c2e85[_0x8321('0x194')];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];ami[_0x8321('0x3c')](_0x8321('0x1b3'),ut[_0x8321('0x117')](_0xea73c8,_0x8321('0x1b4')));hopperUtils['createHistory'](_0xb8ce31)[_0x8321('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5cf3d0[_0x8321('0x19b')](0x14,_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0x122')]>=_0x3c2e85[_0x8321('0x193')]){_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1b5'));}else{_0x5cf3d0[_0x8321('0x124')](_0xb8ce31,_0x1fce25,_0x322302,_0x8321('0x1b5'));}}break;default:_0x3c2e85[_0x8321('0x132')]+=0x1;_0xb8ce31[_0x8321('0xd4')]=0xc;_0xb8ce31['statedesc']=_0x161521[_0x8321('0xbf')];_0x522565=_0x3c2e85[_0x8321('0x194')];_0x2eeb29=_0x3c2e85[_0x8321('0xd3')];hopperUtils[_0x8321('0xc2')](_0xb8ce31)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5cf3d0[_0x8321('0x19b')](_0x161521[_0x8321('0xbf')],_0xea73c8,_0x3c2e85)&&!_0x3494d6){if(_0xb8ce31[_0x8321('0x11f')]+_0xb8ce31[_0x8321('0x120')]+_0xb8ce31[_0x8321('0x12a')]+_0xb8ce31[_0x8321('0x121')]+_0xb8ce31[_0x8321('0xd1')]+_0xb8ce31[_0x8321('0xe4')]+_0xb8ce31[_0x8321('0x11e')]+_0xb8ce31[_0x8321('0x122')]>=_0x3c2e85[_0x8321('0x123')]){_0x5cf3d0['stateGlobal'](_0xb8ce31,_0x1fce25,_0x322302,_0x161521['reason']);}else{_0x5cf3d0[_0x8321('0x127')](_0xb8ce31,_0x1fce25,_0x322302,_0x161521[_0x8321('0xbf')]);}}}})[_0x8321('0x3a')](function(){if(_0x3494d6){hopperUtils[_0x8321('0xe1')](_0xb8ce31,_0x522565,_0x2eeb29)[_0x8321('0x3a')](function(){return _0x1fce25(0x1);});}});});};Dialer[_0x8321('0x17')][_0x8321('0x124')]=function(_0x46f547,_0x29af04,_0x29b965,_0xa2cf29){var _0x3dab29=new Final(_0x46f547);_0x3dab29['state']=0xf;_0x3dab29[_0x8321('0x69')]=_0x8321('0x1b6');this['createStateFinal'](_0x3dab29,_0x29af04,_0x29b965,_0xa2cf29);};Dialer[_0x8321('0x17')][_0x8321('0x127')]=function(_0x4958d8,_0x1be062,_0x44516f,_0x9e9de2){hopperUtils[_0x8321('0xc4')](_0x4958d8)[_0x8321('0x3a')](function(){return _0x1be062(msgResponse(_0x8321('0x195'),'Success',_0x9e9de2));})[_0x8321('0x9d')](function(){return _0x44516f(msgResponse(_0x8321('0x1b7'),_0x8321('0x91'),'contact\x20not\x20moved'));});};Dialer[_0x8321('0x17')][_0x8321('0x7')]=function(_0x485ece){var _0x2e0504=_0x485ece[_0x8321('0x1b8')]/0x64;var _0xc84b50=_0x485ece[_0x8321('0x1b9')]/(_0x485ece[_0x8321('0x1b9')]+_0x485ece[_0x8321('0xbe')]);var _0x4bcf91=Math['round'](_0x485ece[_0x8321('0x1ba')]*(_0x485ece['predictiveIntervalMaxThreshold']/0x64));var _0x1eea4c=Math[_0x8321('0x1bb')](_0x485ece[_0x8321('0x1ba')]*(_0x485ece[_0x8321('0x1bc')]/0x64));var _0x50b47c=_0x485ece[_0x8321('0x1bd')]+_0x485ece[_0x8321('0x139')];var _0x3e7392=Math[_0x8321('0x1be')](_0x485ece['erlangCalls']*_0x485ece[_0x8321('0x58')]*_0x485ece['predictiveIntervalHitRate']*_0x485ece['predictiveIntervalMultiplicativeFactor']);if(_[_0x8321('0x3b')](_0x485ece[_0x8321('0x24')])){if(!_[_0x8321('0x3b')](_0x485ece[_0x8321('0x5d')])){_0x485ece['startPredictive']=undefined;loggerPredictive[_0x8321('0x61')](_0x8321('0x1bf'),_0x8321('0x1c0'));}if(!_['isUndefined'](_0x485ece[_0x8321('0x5f')])){loggerPredictive[_0x8321('0x61')](_0x8321('0x1bf'),_0x8321('0x1c1'));clearInterval(_0x485ece[_0x8321('0x5f')]);_0x485ece[_0x8321('0x5f')]=undefined;}_0x485ece[_0x8321('0x24')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));loggerPredictive[_0x8321('0x47')](_0x485ece[_0x8321('0x5e')],_0x8321('0x1c2'),_0x485ece['startProgressive']);this[_0x8321('0xb2')](_0x485ece,0x1);}else if(ifInterval(_0x485ece['dialPredictiveInterval'],_0x485ece[_0x8321('0x24')])){this[_0x8321('0xb2')](_0x485ece,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x485ece[_0x8321('0x24')],_0x485ece['name']);_0x485ece[_0x8321('0x55')]=0x0;_0x485ece['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2e0504<_0xc84b50&&_0x485ece['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x485ece);loggerPredictive[_0x8321('0x47')](_0x8321('0x1c3'),'Dropped\x20calls\x20day',_0xc84b50,_0x8321('0x24'),_0x485ece[_0x8321('0x5e')]);}else if(_0x3e7392<_0x485ece[_0x8321('0x1c4')]&&_0x485ece[_0x8321('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x485ece);loggerPredictive[_0x8321('0x47')](_0x8321('0x1c6'),_0x8321('0x1c7'),_0x3e7392,_0x8321('0x1c8'),_0x485ece[_0x8321('0x1c4')],_0x8321('0x24'),_0x485ece[_0x8321('0x5e')]);}else if(!ifInterval(_0x485ece[_0x8321('0x1c9')],_0x485ece[_0x8321('0x24')])&&_['isUndefined'](_0x485ece['startPredictive'])&&!_[_0x8321('0x3b')](_0x485ece['startProgressive'])){_0x485ece[_0x8321('0x5d')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));loggerPredictive[_0x8321('0x47')](_0x485ece['name'],_0x8321('0x1ca'),_0x485ece['startPredictive']);hopperUtils[_0x8321('0x1cb')](_0x485ece[_0x8321('0x1c9')])[_0x8321('0x3a')](this[_0x8321('0x1cc')](_0x485ece))[_0x8321('0x3a')](mergeDataErlangB(_0x485ece))[_0x8321('0x3a')](this['startMethodPredictive'](_0x485ece))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x485ece));}else if(!ifInterval(_0x485ece[_0x8321('0x1c9')],_0x485ece[_0x8321('0x5d')])){_0x485ece[_0x8321('0x1c4')]=0x0;_0x485ece[_0x8321('0x5d')]=moment()[_0x8321('0x84')](_0x8321('0xbd'));loggerPredictive['info'](_0x485ece['name'],_0x8321('0x1cd'),_0x485ece[_0x8321('0x5d')]);clearInterval(_0x485ece[_0x8321('0x5f')]);_0x485ece[_0x8321('0x5f')]=undefined;hopperUtils[_0x8321('0x1cb')](_0x485ece['dialPredictiveInterval'])[_0x8321('0x3a')](this[_0x8321('0x1cc')](_0x485ece))[_0x8321('0x3a')](mergeDataErlangB(_0x485ece))[_0x8321('0x3a')](this[_0x8321('0x1ce')](_0x485ece))[_0x8321('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x485ece));}else if(_0x485ece[_0x8321('0x1ba')]&&_0x50b47c<_0x485ece[_0x8321('0x1ba')]-_0x1eea4c){clearPredictiveAttributes(_0x485ece);loggerPredictive['info'](_0x485ece[_0x8321('0x5e')],_0x8321('0x1cf'),_0x50b47c,_0x8321('0x1d0'),_0x485ece[_0x8321('0x1ba')],'-',_0x1eea4c,'=',_0x485ece['predictiveIntervalAvailable']-_0x1eea4c,')');}else if(_0x485ece['predictiveIntervalAvailable']&&_0x50b47c>_0x485ece['predictiveIntervalAvailable']+_0x4bcf91){clearPredictiveAttributes(_0x485ece);loggerPredictive[_0x8321('0x47')](_0x485ece['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x50b47c,')\x20are\x20more\x20than\x20threshold\x20(',_0x485ece[_0x8321('0x1ba')],'+',_0x4bcf91,'=',_0x485ece[_0x8321('0x1ba')]+_0x4bcf91,')');}};Dialer[_0x8321('0x17')][_0x8321('0x1cc')]=function(_0x12f740){var _0x117dde=this;return function(_0x14d7cc){return new Promise(function(_0x362d51,_0x372f4d){_[_0x8321('0x5b')](_0x12f740,_0x14d7cc[0x0]);if(checkGetDataPredictive(_0x14d7cc[0x0])){var _0x466cd7=_0x12f740[_0x8321('0x1ba')]=_0x12f740[_0x8321('0x139')]+_0x12f740['available'];var _0x4bd7d2=_0x12f740[_0x8321('0x1c9')]*0x3c;var _0x220d32=_0x14d7cc[0x0]['predictiveIntervalAvgTalktime']+_0x14d7cc[0x0]['predictiveIntervalAvgHoldtime'];var _0x2f1522=(_0x14d7cc[0x0][_0x8321('0x46')]+_0x14d7cc[0x0][_0x8321('0xcc')]+_0x14d7cc[0x0][_0x8321('0x49')])/_0x14d7cc[0x0][_0x8321('0x44')];_0x12f740[_0x8321('0x1d1')]=_0x2f1522>0x0?_0x2f1522:0x1;switch(_0x12f740[_0x8321('0x1c5')]){case _0x8321('0x1d2'):var _0x4d5fad=_0x12f740[_0x8321('0x1b8')]/0x64;return _0x117dde[_0x8321('0x1d3')](_0x466cd7,_0x4bd7d2,_0x220d32,_0x2f1522,_0x4d5fad)[_0x8321('0x3a')](function(_0x3f1873){return _0x362d51(_0x3f1873);});case _0x8321('0x1d4'):var _0x1d4dae=_0x12f740['dialPredictiveOptimizationPercentage']/0x64;return _0x117dde['busyFactor'](_0x466cd7,_0x4bd7d2,_0x220d32,_0x2f1522,_0x1d4dae)[_0x8321('0x3a')](function(_0x45c337){return _0x362d51(_0x45c337);});default:return _0x372f4d(msgResponse('[getDataPredictive]',_0x8321('0x91'),_0x8321('0x1d5')));}}else{return _0x372f4d(msgResponse('[getDataPredictive]',_0x8321('0x91'),_0x8321('0x1d6')));}});};};Dialer[_0x8321('0x17')]['getDataPredictiveOld']=function(_0x52f95f){var _0x1b3a51=this;return function(_0x128ff1){return new Promise(function(_0x40cdd2,_0x8a84f0){_[_0x8321('0x5b')](_0x52f95f,_0x128ff1[0x0]);if(checkGetDataPredictive(_0x128ff1[0x0])){loggerPredictive[_0x8321('0x47')](JSON[_0x8321('0x6f')](_0x128ff1[0x0]));if(_0x52f95f[_0x8321('0x1c5')]==='dropRate'){return _0x1b3a51[_0x8321('0x14e')](_0x52f95f['id'])[_0x8321('0x3a')](function(_0x2b05f2){var _0x1745d4=_0x52f95f[_0x8321('0x1d7')]-_0x2b05f2[0x0]['outboundQueuePauses'];var _0xe8803e=_0x52f95f[_0x8321('0x1c9')]*0x3c;var _0x5236c6=_0x128ff1[0x0][_0x8321('0x4e')]+_0x128ff1[0x0][_0x8321('0x4b')];var _0x5a31b1=(_0x128ff1[0x0][_0x8321('0x46')]+_0x128ff1[0x0][_0x8321('0xcc')]+_0x128ff1[0x0][_0x8321('0x49')])/_0x128ff1[0x0]['predictiveIntervalTotalCalls'];var _0x4a4e2d=_0x52f95f[_0x8321('0x1b8')]/0x64;_0x52f95f['predictiveIntervalPauses']=_0x2b05f2[0x0][_0x8321('0x1d8')]||0x0;_0x52f95f[_0x8321('0x1d1')]=_0x5a31b1>0x0?_0x5a31b1:0x1;return _0x1b3a51[_0x8321('0x1d3')](_0x1745d4,_0xe8803e,_0x5236c6,_0x5a31b1,_0x4a4e2d);})[_0x8321('0x3a')](function(_0x596fb2){return _0x40cdd2(_0x596fb2);})[_0x8321('0x9d')](function(_0x48fa3c){return _0x8a84f0(msgResponse(_0x8321('0x1d9'),_0x8321('0x91'),JSON[_0x8321('0x6f')](_0x48fa3c)));});}if(_0x52f95f['dialPredictiveOptimization']===_0x8321('0x1d4')){return _0x1b3a51[_0x8321('0x14e')](_0x52f95f['id'])[_0x8321('0x3a')](function(_0x5ca4fc){var _0x501dbb=_0x52f95f['loggedIn']-_0x5ca4fc[0x0][_0x8321('0x1d8')];var _0x41fb2d=_0x52f95f[_0x8321('0x1c9')]*0x3c;var _0x5bdab9=_0x128ff1[0x0][_0x8321('0x4e')]+_0x128ff1[0x0][_0x8321('0x4b')];var _0x2efe9b=(_0x128ff1[0x0][_0x8321('0x46')]+_0x128ff1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x128ff1[0x0][_0x8321('0x49')])/_0x128ff1[0x0][_0x8321('0x44')];var _0x29a875=_0x52f95f[_0x8321('0x1b8')]/0x64;_0x52f95f[_0x8321('0x1da')]=_0x5ca4fc[0x0]['outboundQueuePauses']||0x0;_0x52f95f[_0x8321('0x1d1')]=_0x2efe9b>0x0?_0x2efe9b:0x1;return _0x1b3a51['busyFactor'](_0x501dbb,_0x41fb2d,_0x5bdab9,_0x2efe9b,_0x29a875);})[_0x8321('0x3a')](function(_0x2200b5){return _0x40cdd2(_0x2200b5);})['catch'](function(_0x1aad5d){return _0x8a84f0(msgResponse(_0x8321('0x1d9'),'Failure',JSON[_0x8321('0x6f')](_0x1aad5d)));});}}else{return _0x8a84f0(msgResponse(_0x8321('0x1db'),_0x8321('0x91'),'check\x20failure'));}});};};Dialer[_0x8321('0x17')][_0x8321('0x1ce')]=function(_0x5219d7){var _0x34b1eb=this;return function(){var _0x3a528c=0x0;var _0x1db701=Math[_0x8321('0x1be')](_0x5219d7[_0x8321('0x1dc')]*0x3e8);if(_0x1db701>0x0){_0x1db701=_0x1db701<0x64?0x64:_0x1db701;loggerPredictive[_0x8321('0x47')](_0x5219d7['name'],'one\x20call\x20every:',_0x1db701,'milliseconds');_0x5219d7[_0x8321('0x5f')]=setInterval(function(){_0x34b1eb[_0x8321('0x5f')](_0x5219d7);loggerPredictiveCalls[_0x8321('0x47')](_0x8321('0x1dd'),_0x3a528c+=0x1);},_0x1db701);}else{loggerPredictive[_0x8321('0x47')](_0x5219d7['name'],_0x8321('0x1de'));}};};Dialer[_0x8321('0x17')][_0x8321('0x1df')]=function(_0x9c89ff,_0x363268){var _0x4ba091=this;return function(_0x4c7f25){if(_['isEmpty'](_0x4c7f25)){if(_[_0x8321('0xf3')](_0x363268[_0x8321('0x154')])||!_0x363268[_0x8321('0x1e0')]){if(_0x9c89ff[_0x8321('0xb0')]===_0x8321('0x6')){_0x9c89ff[_0x8321('0x6c')]=_['isUndefined'](_0x9c89ff[_0x8321('0x6c')])?!![]:_0x9c89ff['queueStatusComplete'];var _0x65f61f=uuid['v4']();_0x4ba091['actions'][_0x65f61f]=new Action(_0x9c89ff,_0x363268,_0x65f61f);loggerBooked[_0x8321('0x47')](_0x8321('0x1e1'),_0x65f61f,_0x8321('0x1e2'),JSON[_0x8321('0x6f')](_0x9c89ff[_0x8321('0x6c')]),_0x8321('0x1e3'),_0x9c89ff[_0x8321('0x5e')]);if(_0x9c89ff[_0x8321('0x6c')]){_0x9c89ff[_0x8321('0x6c')]=![];_0x4ba091[_0x8321('0x26')][_0x4ba091[_0x8321('0xed')][_0x65f61f]['queue']]=[];ami[_0x8321('0x98')]({'actionid':_0x65f61f,'action':'queuestatus','queue':_0x9c89ff[_0x8321('0x5e')]})['catch'](function(){_0x4ba091[_0x8321('0xc7')](_0x9c89ff);hopperUtils[_0x8321('0xd7')]({'active':![],'ContactId':_0x4ba091[_0x8321('0xed')][_0x65f61f]['ContactId'],'ListId':_0x4ba091[_0x8321('0xed')][_0x65f61f][_0x8321('0xdb')],'VoiceQueueId':_0x4ba091[_0x8321('0xed')][_0x65f61f][_0x8321('0xdc')]||undefined,'CampaignId':_0x4ba091[_0x8321('0xed')][_0x65f61f]['CampaignId']||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x1e4')));delete _0x4ba091[_0x8321('0xed')][_0x65f61f];});}else{loggerBooked[_0x8321('0x47')](_0x8321('0x1e5'),JSON[_0x8321('0x6f')](_0x9c89ff[_0x8321('0x6c')]),_0x8321('0x1e3'),_0x9c89ff['name']);_0x4ba091[_0x8321('0xc7')](_0x9c89ff);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4ba091[_0x8321('0xed')][_0x65f61f][_0x8321('0xda')],'ListId':_0x4ba091[_0x8321('0xed')][_0x65f61f][_0x8321('0xdb')],'VoiceQueueId':_0x4ba091['actions'][_0x65f61f]['VoiceQueueId']||undefined,'CampaignId':_0x4ba091[_0x8321('0xed')][_0x65f61f][_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4ba091[_0x8321('0xed')][_0x65f61f];}}else{return _0x4ba091[_0x8321('0x1e6')](_0x9c89ff,_0x363268);}}else{if(utils[_0x8321('0xc9')](undefined,_0x363268[_0x8321('0x1e7')])<_0x9c89ff[_0x8321('0x1e8')]*0x3c){if(_0x363268[_0x8321('0x144')]&&!_0x363268[_0x8321('0x144')]['voicePause']){_0x4ba091[_0x8321('0x1c')][_0x8321('0xf8')](_0x363268['id'])[_0x8321('0x1a')](function(){_0x4ba091[_0x8321('0xc7')](_0x9c89ff);});}else{hopperUtils[_0x8321('0x1e9')]({'active':![]},_0x363268['id'],0x1)[_0x8321('0x1a')](function(){_0x4ba091['updateOriginated'](_0x9c89ff);});}}else{_0x9c89ff[_0x8321('0x1ea')]+=0x1;_0x4ba091[_0x8321('0xc7')](_0x9c89ff);if(_0x9c89ff[_0x8321('0x1eb')]){hopperUtils[_0x8321('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x363268[_0x8321('0xda')],'ListId':_0x363268[_0x8321('0xdb')],'VoiceQueueId':_0x363268[_0x8321('0xdc')]||undefined,'CampaignId':_0x363268[_0x8321('0xdd')]||undefined})[_0x8321('0x9d')](loggerCatch(_0x8321('0x1ec')));hopperUtils[_0x8321('0xc2')](createObjHistory(_0x9c89ff,_0x363268,utils[_0x8321('0x68')][_0x8321('0x1ed')],0x17,'RecallInQueue'))[_0x8321('0x9d')](loggerCatch(_0x8321('0x1ee')));}else{_0x4ba091['saveInDb'](createObjHistory(_0x9c89ff,_0x363268,utils[_0x8321('0x68')]['RECALL_TIMEOUT'],0x16,_0x8321('0x1ef')),_0x8321('0x1f0'),_0x8321('0x1f1'));}}}}else{_0x9c89ff[_0x8321('0x1f2')]+=0x1;_0x4ba091[_0x8321('0x119')](createObjHistory(_0x9c89ff,_0x363268,utils[_0x8321('0x68')]['BLACKLIST'],0xd,_0x8321('0x1f3')),_0x8321('0x1f4'),_0x8321('0x1f5'));throw _0x8321('0x1f6');}};};Dialer['prototype'][_0x8321('0x157')]=function(_0x200b4e){var _0x33e778=this;var _0x1a7317=_0x200b4e[_0x8321('0x1f7')]-_0x200b4e[_0x8321('0x7b')];emitCampaignSummary(_0x200b4e);if(_0x1a7317>0x0&&_0x200b4e[_0x8321('0x1f8')]==0x0){if(_0x1a7317>this['maxNumberOriginate']){_0x1a7317=this[_0x8321('0x20')];}_0x200b4e[_0x8321('0x1f8')]=0x1;hopperUtils['getContactDialerIvr'](_0x200b4e,_0x1a7317)['then'](function(_0xb5f663){_0x200b4e[_0x8321('0x1f8')]=0x0;if(_0xb5f663){if(!utils[_0x8321('0x1f9')](_0xb5f663)){_0x200b4e[_0x8321('0x64')]=utils['CAMPAIGN_STATUS'][_0x8321('0x1fa')];logger[_0x8321('0x47')](_0x8321('0x1fb')+_0x200b4e[_0x8321('0x5e')]);}else{_0x200b4e[_0x8321('0x7b')]+=_0xb5f663[_0x8321('0x96')];_0x200b4e[_0x8321('0x64')]=utils[_0x8321('0x68')]['RUNNING'];for(var _0x297fe9=0x0;_0x297fe9<_0xb5f663['length'];_0x297fe9+=0x1){_0x200b4e[_0x8321('0x1fc')]+=0x1;if(_[_0x8321('0xf3')](_0xb5f663[_0x297fe9])||_[_0x8321('0xf3')](_0xb5f663[_0x297fe9][_0x8321('0x172')])||_[_0x8321('0xf3')](_0xb5f663[_0x297fe9][_0x8321('0x15a')])){_0x33e778[_0x8321('0x153')](_0x8321('0x1fd'),_0x200b4e,_0xb5f663[_0x297fe9]);}else{hopperUtils[_0x8321('0x1fe')](_[_0x8321('0x70')](_0xb5f663[_0x297fe9],['CampaignId',_0x8321('0x15a')]))[_0x8321('0x3a')](_0x33e778[_0x8321('0x1df')](_0x200b4e,_0xb5f663[_0x297fe9]))[_0x8321('0x9d')](_0x33e778[_0x8321('0x152')](_0x8321('0x1ff'),_0x200b4e));}}}}})[_0x8321('0x9d')](loggerGetContactDialer(_0x8321('0x200'),_0x200b4e,_0x1a7317));}};Dialer['prototype'][_0x8321('0xb2')]=function(_0x45ac60,_0x219093){var _0x8e679b=this;var _0x411253=[];if(_0x219093<0x1||_0x45ac60[_0x8321('0xb0')]===_0x8321('0x6')){_0x219093=0x1;}var _0x379468=Math[_0x8321('0x1be')](_0x45ac60[_0x8321('0x1bd')]*_0x219093)-_0x45ac60[_0x8321('0x7b')];if(_0x45ac60[_0x8321('0x201')]>0x0){var _0x3cd21c=_0x45ac60[_0x8321('0x201')]-_0x45ac60['originated']-_0x45ac60[_0x8321('0x139')]-_0x45ac60[_0x8321('0x13a')];if(_0x379468>_0x3cd21c){_0x379468=_0x3cd21c;}}if(_0x379468>0x0&&_0x45ac60[_0x8321('0x1f8')]==0x0){if(_0x45ac60[_0x8321('0xb0')]===_0x8321('0x6')){_0x379468=0x1;}if(_0x379468>this[_0x8321('0x20')]){_0x379468=this['maxNumberOriginate'];}for(var _0x34145e in this[_0x8321('0x1e')]){if(typeof this['agents'][_0x34145e]!=='undefined'){if(this['agents'][_0x34145e][_0x8321('0xd4')]===_0x8321('0x202')&&this[_0x8321('0x1e')][_0x34145e]['status']===_0x8321('0x87')){_0x411253[_0x8321('0x97')](this[_0x8321('0x1e')][_0x34145e]['id']);}}}_0x45ac60[_0x8321('0x1f8')]=0x1;hopperUtils['getContactDialer'](_0x45ac60,_0x411253,_0x379468)[_0x8321('0x3a')](function(_0x810ba4){_0x45ac60[_0x8321('0x1f8')]=0x0;if(_0x810ba4){if(!utils[_0x8321('0x1f9')](_0x810ba4)){hopperUtils[_0x8321('0x203')](_0x45ac60)[_0x8321('0x3a')](sendMessageReschedule(_0x45ac60))[_0x8321('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x45ac60[_0x8321('0x7b')]+=_0x810ba4[_0x8321('0x96')];_0x45ac60[_0x8321('0x64')]=_0x45ac60[_0x8321('0xb0')]==='booked'?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x8321('0x68')]['RUNNING'];for(var _0x26b98d=0x0;_0x26b98d<_0x810ba4[_0x8321('0x96')];_0x26b98d+=0x1){if(_['isNil'](_0x810ba4[_0x26b98d])||_[_0x8321('0xf3')](_0x810ba4[_0x26b98d][_0x8321('0x172')])||_[_0x8321('0xf3')](_0x810ba4[_0x26b98d][_0x8321('0x15a')])){_0x8e679b['emptyContact'](_0x8321('0x1fd'),_0x45ac60,_0x810ba4[_0x26b98d]);}else{hopperUtils['checkIsBlackList'](_[_0x8321('0x70')](_0x810ba4[_0x26b98d],['VoiceQueueId',_0x8321('0x15a')]))[_0x8321('0x3a')](_0x8e679b['checkContactBlack'](_0x45ac60,_0x810ba4[_0x26b98d]))[_0x8321('0x9d')](_0x8e679b['loggerHandler']('[actionOriginate]\x20',_0x45ac60));}}}}})[_0x8321('0x9d')](loggerGetContactDialer('[getContactDialer2]',_0x45ac60,_0x379468));}};Dialer[_0x8321('0x17')][_0x8321('0x5f')]=function(_0x385094){if(_0x385094[_0x8321('0x201')]>0x0){var _0x430d19=_0x385094['dialLimitQueue']-_0x385094[_0x8321('0x7b')]-_0x385094['talking'];if(_0x430d19>0x0&&_0x385094['temp']==0x0){this[_0x8321('0x204')](_0x385094);}else{loggerPredictiveCalls[_0x8321('0x47')](_0x8321('0x205'));}}else{this['tryOriginatePredictive'](_0x385094);}};Dialer['prototype'][_0x8321('0x204')]=function(_0x380b62){var _0x3050db=this;var _0xfa4a70=[];_0x380b62['originated']+=0x1;for(var _0x58174a in this[_0x8321('0x1e')]){if(typeof this[_0x8321('0x1e')][_0x58174a]!==_0x8321('0xa8')){if(this[_0x8321('0x1e')][_0x58174a]['state']===_0x8321('0x202')&&this[_0x8321('0x1e')][_0x58174a]['status']===_0x8321('0x87')){_0xfa4a70[_0x8321('0x97')](this[_0x8321('0x1e')][_0x58174a]['id']);}}}_0x380b62['temp']=0x1;return this[_0x8321('0x206')](_0x380b62['id'],_0xfa4a70,0x1,_0x380b62[_0x8321('0x207')],_0x380b62)[_0x8321('0x3a')](function(_0x253a6c){_0x380b62['temp']=0x1;if(_0x253a6c){if(!utils[_0x8321('0x1f9')](_0x253a6c)){utils['checkContactLowerLimitOriginate'](_0x380b62,0x1,0x0);return hopperUtils[_0x8321('0x203')](_0x380b62)[_0x8321('0x3a')](sendMessageReschedule(_0x380b62))[_0x8321('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x380b62['message']=utils[_0x8321('0x68')]['RUNNING'];if(_['isNil'](_0x253a6c[0x0])||_[_0x8321('0xf3')](_0x253a6c[0x0][_0x8321('0x172')])||_[_0x8321('0xf3')](_0x253a6c[0x0][_0x8321('0x15a')])){_0x3050db[_0x8321('0x153')](_0x8321('0x1fd'),_0x380b62,_0x253a6c[0x0]);}else{return hopperUtils[_0x8321('0x208')](_[_0x8321('0x70')](_0x253a6c[0x0],[_0x8321('0xdc'),_0x8321('0x15a')]))[_0x8321('0x3a')](_0x3050db[_0x8321('0x1df')](_0x380b62,_0x253a6c[0x0]))[_0x8321('0x9d')](_0x3050db[_0x8321('0x152')](_0x8321('0x209'),_0x380b62));}}}})['catch'](loggerGetContactDialer(_0x8321('0x20a'),_0x380b62,0x1));};Dialer[_0x8321('0x17')][_0x8321('0x1d3')]=function(_0x44b42a,_0x3e8c11,_0xb4198a,_0x3b8f8d,_0x43d639,_0xaeb328){loggerPredictive['info'](_0x8321('0x20b'));loggerPredictive[_0x8321('0x47')](_0x8321('0x20c'),_0x44b42a);loggerPredictive['info'](_0x8321('0x20d'),_0x3e8c11);loggerPredictive[_0x8321('0x47')](_0x8321('0x20e'),_0xb4198a);loggerPredictive[_0x8321('0x47')](_0x8321('0x20f'),_0x3b8f8d);loggerPredictive[_0x8321('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43d639);loggerPredictive['info'](_0x8321('0x4d'));return new Promise(function(_0x46c982,_0x30bfe7){if(_0x44b42a<=0x0||isNaN(_0x44b42a)){return _0x30bfe7(msgResponse(_0x8321('0x210'),_0x8321('0x81'),'m\x20=\x20'+_0x44b42a));}if(_0xb4198a<=0x0||isNaN(_0xb4198a)){return _0x30bfe7(msgResponse(_0x8321('0x210'),'Error',_0x8321('0x211')+_0xb4198a));}if(_0x3b8f8d<=0x0||isNaN(_0x3b8f8d)){return _0x30bfe7(msgResponse(_0x8321('0x210'),_0x8321('0x81'),'p\x20=\x20'+_0x3b8f8d));}if(_0x3e8c11<=0x0||isNaN(_0x3e8c11)){return _0x30bfe7(msgResponse(_0x8321('0x210'),_0x8321('0x81'),_0x8321('0x212')+_0x3e8c11));}if(_0x43d639<=0x0||isNaN(_0x43d639)){return _0x30bfe7(msgResponse('[abandonmentRate]',_0x8321('0x81'),_0x8321('0x213')+_0x43d639));}_0xaeb328=_0xaeb328||0x0;var _0x3507de=0x1/_0xb4198a;var _0x124de1=0x0;var _0x511989=0x0;var _0x40a7e3=0x0;var _0x585910=0x0;for(var _0x22006b=0x0;_0x40a7e3<_0x43d639;_0x22006b+=0x1){_0x511989=_0x22006b/_0x3e8c11;_0x124de1=(_0x3b8f8d*_0x511989+_0xaeb328)/_0x3507de;_0x40a7e3=utils[_0x8321('0x214')](_0x124de1,_0x44b42a);_0x585910=_0x124de1/_0x44b42a*(0x1-utils['erlangb'](_0x124de1,_0x44b42a));}return _0x46c982({'erlangCalls':_0x22006b,'erlangCallToSecond':_0x3e8c11/_0x22006b,'erlangAbandonmentRate':_0x40a7e3,'erlangBusyFactor':_0x585910});});};Dialer['prototype'][_0x8321('0x215')]=function(_0xc71b22,_0x2d232e,_0x2f4c3a,_0x2e4c5e,_0x44b728,_0x470795){loggerPredictive['info'](_0x8321('0x216'));loggerPredictive[_0x8321('0x47')](_0x8321('0x20c'),_0xc71b22);loggerPredictive['info'](_0x8321('0x20d'),_0x2d232e);loggerPredictive['info'](_0x8321('0x20e'),_0x2f4c3a);loggerPredictive['info'](_0x8321('0x20f'),_0x2e4c5e);loggerPredictive[_0x8321('0x47')](_0x8321('0x217'),_0x44b728);loggerPredictive[_0x8321('0x47')](_0x8321('0x4d'));return new Promise(function(_0x48a3c9,_0x516862){if(_0xc71b22<=0x0||isNaN(_0xc71b22)){return _0x516862(msgResponse(_0x8321('0x218'),_0x8321('0x81'),_0x8321('0x219')+_0xc71b22));}if(_0x2f4c3a<=0x0||isNaN(_0x2f4c3a)){return _0x516862(msgResponse('[busyFactor]','Error',_0x8321('0x211')+_0x2f4c3a));}if(_0x2e4c5e<=0x0||isNaN(_0x2e4c5e)){return _0x516862(msgResponse('[busyFactor]',_0x8321('0x81'),'p\x20=\x20'+_0x2e4c5e));}if(_0x2d232e<=0x0||isNaN(_0x2d232e)){return _0x516862(msgResponse(_0x8321('0x218'),'Error',_0x8321('0x212')+_0x2d232e));}if(_0x44b728<=0x0||isNaN(_0x44b728)){return _0x516862(msgResponse('[busyFactor]',_0x8321('0x81'),_0x8321('0x21a')+_0x44b728));}_0x470795=_0x470795||0x0;var _0x30b485=0x1/_0x2f4c3a;var _0x258321=0x0;var _0x3067f7=0x0;var _0x275d83=0x0;var _0x25ab37=0x0;for(var _0x4905c7=0x0;_0x25ab37<_0x44b728;_0x4905c7+=0x1){_0x3067f7=_0x4905c7/_0x2d232e;_0x258321=(_0x2e4c5e*_0x3067f7+_0x470795)/_0x30b485;_0x275d83=utils[_0x8321('0x214')](_0x258321,_0xc71b22);_0x25ab37=_0x258321/_0xc71b22*(0x1-utils[_0x8321('0x214')](_0x258321,_0xc71b22));}return _0x48a3c9({'erlangCalls':_0x4905c7,'erlangCallToSecond':_0x2d232e/_0x4905c7,'erlangAbandonmentRate':_0x275d83,'erlangBusyFactor':_0x25ab37});});};module['exports']=Dialer; \ No newline at end of file +var _0xb4cb=['bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','debug','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','true','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','syncAgentConnect','queue','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','swapAdditionalPhones','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','rrmemory','isNil','paused','stateinterface','locked','strategy','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','online','resolve','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','handlePreviewRecallNotifications','Agent','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','localhost','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect'];(function(_0x4166fe,_0x444674){var _0xfa3e52=function(_0x14607d){while(--_0x14607d){_0x4166fe['push'](_0x4166fe['shift']());}};_0xfa3e52(++_0x444674);}(_0xb4cb,0x1f1));var _0xbb4c=function(_0x58bf47,_0x197131){_0x58bf47=_0x58bf47-0x0;var _0x463d30=_0xb4cb[_0x58bf47];return _0x463d30;};'use strict';var util=require(_0xbb4c('0x0'));var _=require('lodash');var uuid=require(_0xbb4c('0x1'));var moment=require(_0xbb4c('0x2'));var rr=require('rr');var Redis=require(_0xbb4c('0x3'));var utils=require('./utils');var hopperUtils=require(_0xbb4c('0x4'));var ut=require(_0xbb4c('0x5'));var config=require(_0xbb4c('0x6'));var logger=require('../../../config/logger')(_0xbb4c('0x7'));var loggerBooked=require(_0xbb4c('0x8'))(_0xbb4c('0x9'));var loggerPredictive=require(_0xbb4c('0x8'))(_0xbb4c('0xa'));var loggerPredictiveCalls=require(_0xbb4c('0x8'))(_0xbb4c('0xb'));var loggerSyncQueueSummary=require(_0xbb4c('0x8'))(_0xbb4c('0xc'));var ami=require('../ami');config['redis']=_['defaults'](config['redis'],{'host':_0xbb4c('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb4c('0xe')]));var cmHopper=require(_0xbb4c('0xf'));var voiceQueueRt=require(_0xbb4c('0x10'));var RpcSetting=require(_0xbb4c('0x11'));var Interval=require(_0xbb4c('0x12'));var Action=require(_0xbb4c('0x13'));var History=require(_0xbb4c('0x14'));var Final=require(_0xbb4c('0x15'));var AgentComplete=require(_0xbb4c('0x16'));var QueueCallerAbandon=require(_0xbb4c('0x17'));var Hangup=require(_0xbb4c('0x18'));var ipAgi=process[_0xbb4c('0x19')]['XCALLY_IP_AGI']||_0xbb4c('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbb4c('0x1b')][_0xbb4c('0x1c')]=function(_0x25bb95){this[_0xbb4c('0x1d')]=this[_0xbb4c('0x1d')]?this['tail'][_0xbb4c('0x1e')](_0x25bb95):_0x25bb95();};function Dialer(_0x30862f,_0x12ff0d){this['sequence']=new Sequence();this[_0xbb4c('0x1f')]=_0x12ff0d;this[_0xbb4c('0x20')]=_0x30862f[_0xbb4c('0x20')];this['campaigns']=_0x30862f[_0xbb4c('0x21')];this[_0xbb4c('0x22')]=_0x30862f['agents'];this[_0xbb4c('0x23')]=_0x30862f['trunks'];this[_0xbb4c('0x24')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xbb4c('0x25')]={};this[_0xbb4c('0x26')]={};this[_0xbb4c('0x27')]={};this[_0xbb4c('0x28')]={};this[_0xbb4c('0x29')]={};this['startProgressive']={};this[_0xbb4c('0x2a')]={};this[_0xbb4c('0x2b')]={};this[_0xbb4c('0x2c')]={};this[_0xbb4c('0x2d')]={};ami['on'](_0xbb4c('0x2e'),this['syncAgentConnect'][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x30'),this[_0xbb4c('0x31')][_0xbb4c('0x2f')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on']('agentcomplete',this[_0xbb4c('0x32')][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x33'),this[_0xbb4c('0xc')][_0xbb4c('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0xbb4c('0x34')][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x35'),this[_0xbb4c('0x36')][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x37'),this['syncNewExten'][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x38'),this[_0xbb4c('0x39')][_0xbb4c('0x2f')](this));ami['on']('queuemember',this[_0xbb4c('0x3a')][_0xbb4c('0x2f')](this));ami['on'](_0xbb4c('0x3b'),this['syncQueueStatusComplete'][_0xbb4c('0x2f')](this));this[_0xbb4c('0x3c')]();this[_0xbb4c('0x3d')]();RpcSetting[_0xbb4c('0x3e')]()[_0xbb4c('0x3f')](function(_0x5f0f6c){previewRecallmeReminderInterval=_0x5f0f6c[_0xbb4c('0x40')];});}function isNotNull(_0x556db3){return _0x556db3!==null&&!_[_0xbb4c('0x41')](_0x556db3);}function msgResponse(_0x163662,_0x45a7ae,_0x3e258e){return{'action':_0x163662,'response':_0x45a7ae,'message':_0x3e258e,'stack':_0x3e258e};}function emit(_0x5b0a6f,_0x5a2536,_0x4736a6){io['to'](_0x5b0a6f)['emit'](_0x5a2536,_0x4736a6);}function emitOutboundVoiceQueueSummary(_0x2dc324){if(_0x2dc324['type']===_0xbb4c('0x42')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xbb4c('0x43')](_0x2dc324,{'showHidden':![],'depth':null}));emit(util['format'](_0xbb4c('0x44'),_0x2dc324[_0xbb4c('0x45')]),_0xbb4c('0x46'),_0x2dc324);}}function checkGetDataPredictive(_0x49f9aa){if(isNotNull(_0x49f9aa)&&!_[_0xbb4c('0x47')](_0x49f9aa)){loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x49'));loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x4a'),_0x49f9aa[_0xbb4c('0x4b')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x4c'),_0x49f9aa[_0xbb4c('0x4d')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x4e'),_0x49f9aa[_0xbb4c('0x4f')]);loggerPredictive[_0xbb4c('0x48')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49f9aa[_0xbb4c('0x50')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x51'),_0x49f9aa[_0xbb4c('0x52')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x53'),_0x49f9aa[_0xbb4c('0x54')]);loggerPredictive['info'](_0xbb4c('0x55'));if(_0x49f9aa[_0xbb4c('0x4b')]>0x0){if(!_['isUndefined'](_0x49f9aa[_0xbb4c('0x54')])&&_0x49f9aa['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xbb4c('0x56'));if(!_[_0xbb4c('0x41')](_0x49f9aa[_0xbb4c('0x52')])&&_0x49f9aa[_0xbb4c('0x52')]>0x0){return!![];}loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x57'));}else{loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x58'));}}else{loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x59'));}return![];}function mergeDataErlangB(_0x505cb0){return function(_0xa82316){loggerPredictive[_0xbb4c('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xbb4c('0x48')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa82316[_0xbb4c('0x5a')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x5b'),_0xa82316[_0xbb4c('0x5c')]);loggerPredictive[_0xbb4c('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa82316[_0xbb4c('0x5d')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x5e'),_0xa82316[_0xbb4c('0x5f')]);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x60'),_0xa82316['erlangAbandonmentRate']);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x55'));_[_0xbb4c('0x61')](_0x505cb0,_0xa82316);};}function ifInterval(_0x2cda77,_0x1aed28){if(_['isUndefined'](_0x1aed28)){return![];}return utils[_0xbb4c('0x62')](undefined,_0x1aed28)<_0x2cda77*0x3c;}function clearPredictiveAttributes(_0x29e646){if(_0x29e646[_0xbb4c('0x63')]){_0x29e646[_0xbb4c('0x63')]=undefined;loggerPredictive[_0xbb4c('0x64')](_0x29e646[_0xbb4c('0x45')],_0xbb4c('0x65'));}if(_0x29e646[_0xbb4c('0x29')]){_0x29e646['startPredictive']=undefined;loggerPredictive[_0xbb4c('0x64')](_0x29e646['name'],_0xbb4c('0x66'));}if(_0x29e646['handlePredictive']){clearInterval(_0x29e646[_0xbb4c('0x67')]);_0x29e646[_0xbb4c('0x67')]=undefined;loggerPredictive['debug'](_0x29e646['name'],_0xbb4c('0x68'));}}function loggerCatchPredictive(_0x19a7cd,_0x3e0c56){return function(_0x3cc597){loggerPredictive[_0xbb4c('0x69')](_0x3e0c56['name'],_0x19a7cd);loggerPredictive[_0xbb4c('0x69')](_0x3cc597[_0xbb4c('0x6a')]);clearPredictiveAttributes(_0x3e0c56);};}function loggerCatch(_0x5007fd){return function(_0x1d714b){logger[_0xbb4c('0x69')](_0x5007fd,util[_0xbb4c('0x43')](_0x1d714b,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x182eb9,_0x246c38,_0x231f31){return function(_0x3bbc55){utils['checkContactLowerLimitOriginate'](_0x246c38,_0x231f31,0x0);_0x246c38[_0xbb4c('0x6b')]=0x0;logger[_0xbb4c('0x69')](_0x182eb9,util['inspect'](_0x3bbc55,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x85fe){return function(_0x60f6ad){if(isNotNull(_0x60f6ad)&&isNotNull(_0x60f6ad[0x0])){if(_0x60f6ad[0x0]['contactsRescheduled']>0x0){_0x85fe[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x6e')];logger[_0xbb4c('0x48')](_0xbb4c('0x6f')+_0x85fe[_0xbb4c('0x45')],_0x60f6ad[0x0]['contactsRescheduled'],'contacts');}else{_0x85fe['message']=utils[_0xbb4c('0x6d')][_0xbb4c('0x70')];logger[_0xbb4c('0x48')](_0xbb4c('0x71')+_0x85fe['name']);}}};}function createObjHistory(_0x21bfbf,_0x419e69,_0xa6f3ce,_0x454dee,_0x2dfcfa){_0x21bfbf[_0xbb4c('0x6c')]=_0xa6f3ce;var _0x331de1=new Action(_0x21bfbf,_0x419e69);var _0x383f99=new History(_0x331de1);_0x383f99['state']=_0x454dee;_0x383f99[_0xbb4c('0x72')]=_0x2dfcfa;_0x383f99[_0xbb4c('0x73')]=_0x331de1[_0xbb4c('0x74')];return _0x383f99;}function unlockQueueStatus(_0x4ff9cb,_0x44d264){setTimeout(function(){if(_[_0xbb4c('0x41')](_0x4ff9cb['queueStatusComplete'])){loggerBooked[_0xbb4c('0x69')]('[unlockQueueStatus][undefined]',_0x44d264);}_0x4ff9cb[_0xbb4c('0x75')]=!![];loggerBooked[_0xbb4c('0x48')](_0xbb4c('0x76'),_0x44d264,JSON[_0xbb4c('0x77')](_[_0xbb4c('0x78')](_0x4ff9cb,['name',_0xbb4c('0x75')])));},0x1f3);}function checkInterval(_0xfb03ea){return function(){if(!isNotNull(_0xfb03ea['Interval'])){_0xfb03ea['message']=utils['CAMPAIGN_STATUS'][_0xbb4c('0x79')];throw _0xfb03ea['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xfb03ea[_0xbb4c('0x7a')][_0xbb4c('0x7b')])){_0xfb03ea[_0xbb4c('0x6c')]=utils['CAMPAIGN_STATUS'][_0xbb4c('0x79')];throw _0xfb03ea[_0xbb4c('0x45')]+_0xbb4c('0x7c');}if(!isNotNull(_[_0xbb4c('0x47')](_0xfb03ea[_0xbb4c('0x7a')]['Intervals']))){_0xfb03ea[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')]['NULL_INTERVAL'];throw _0xfb03ea[_0xbb4c('0x45')]+_0xbb4c('0x7c');}};}function checkIsIVRCampaignActive(_0x1fc857){return function(){if(!utils[_0xbb4c('0x7d')](_0x1fc857)){_0x1fc857[_0xbb4c('0x6c')]=utils['CAMPAIGN_STATUS'][_0xbb4c('0x7e')];throw _0x1fc857[_0xbb4c('0x45')]+_0xbb4c('0x7f');}};}function emitCampaignSummary(_0x110f60){if(utils[_0xbb4c('0x80')](_0x110f60)){emit(util[_0xbb4c('0x81')](_0xbb4c('0x82'),_0x110f60['name']),'campaign:save',_0x110f60);}}function loggerCatchQueueSummary(_0x17ce1e,_0x403212){return function(_0x2320f5){clearPredictiveAttributes(_0x403212);emitCampaignSummary(_0x403212);loggerSyncQueueSummary[_0xbb4c('0x64')](_0x17ce1e,util[_0xbb4c('0x43')](_0x2320f5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x292e71){if(_0x292e71['sendMessageOneNotActive']){if(_0x292e71['originated']===0x0){_0x292e71[_0xbb4c('0x83')]=![];_0x292e71[_0xbb4c('0x6c')]=utils['CAMPAIGN_STATUS'][_0xbb4c('0x7e')];loggerSyncQueueSummary[_0xbb4c('0x64')](_0xbb4c('0x84'),_0x292e71[_0xbb4c('0x45')],_0xbb4c('0x85'));}else{_0x292e71[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x86')];loggerSyncQueueSummary[_0xbb4c('0x64')](_0xbb4c('0x84'),_0x292e71['name'],_0xbb4c('0x87'));}emitCampaignSummary(_0x292e71);}}function myreject(_0x228511){return function(_0x3b0f6d){return _0x228511(msgResponse(_0xbb4c('0x88'),_0xbb4c('0x89'),JSON[_0xbb4c('0x77')](_0x3b0f6d)));};}Dialer[_0xbb4c('0x1b')][_0xbb4c('0x8a')]=function(_0x12d763){return!_[_0xbb4c('0x41')](_0x12d763)&&_0x12d763&&!_['isUndefined'](_0x12d763[_0xbb4c('0x45')])&&!_[_0xbb4c('0x41')](_0x12d763['active'])&&_0x12d763[_0xbb4c('0x8b')]&&(this[_0xbb4c('0x23')][util[_0xbb4c('0x81')](_0xbb4c('0x8c'),_0x12d763[_0xbb4c('0x45')])][_0xbb4c('0x8d')]===_0xbb4c('0x8e')||this['trunks'][util[_0xbb4c('0x81')](_0xbb4c('0x8c'),_0x12d763['name'])][_0xbb4c('0x8d')]===_0xbb4c('0x8f'));};Dialer['prototype'][_0xbb4c('0x90')]=function(_0x28613c){var _0xa3e3ec=this;return function(){if(!_0xa3e3ec[_0xbb4c('0x8a')](_0x28613c[_0xbb4c('0x91')])){if(!_0xa3e3ec[_0xbb4c('0x8a')](_0x28613c[_0xbb4c('0x92')])){_0x28613c[_0xbb4c('0x6c')]=utils['CAMPAIGN_STATUS'][_0xbb4c('0x93')];throw _0x28613c[_0xbb4c('0x45')]+_0xbb4c('0x94');}}};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x95')]=function(_0x357110,_0x5301aa,_0xe8d349,_0x3ac2f3){var _0xc0116f=this;return function(){var _0x1c9e22=!![];return _0xc0116f['ifTimeIvr'](_0x357110,_0x5301aa,_0xe8d349,_0x3ac2f3,_0x1c9e22);};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x96')]=function(_0x549069,_0x230f65,_0x7a2287,_0x12e7b8){var _0x4979c8=this;return function(){var _0x1e908a=![];return _0x4979c8[_0xbb4c('0x97')](_0x549069[_0xbb4c('0x7b')],_0x230f65,_0x7a2287,_0x12e7b8,_0x1e908a);};};Dialer['prototype'][_0xbb4c('0x97')]=function(_0xd8022b,_0x41a968,_0x5ebcef,_0x3f08f2,_0x3ed5a1){var _0x56b24a=[];return new Promise(function(_0x3be8c4,_0x3f3634){if(!isNotNull(_0xd8022b)){_0x3f08f2[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x79')];return _0x3f3634(msgResponse(_0xbb4c('0x98'),'Failure',_0x5ebcef+_0xbb4c('0x99')));}if(_['isEmpty'](_0xd8022b)){_0x3f08f2[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x9a')];return _0x3f3634(msgResponse(_0xbb4c('0x98'),_0xbb4c('0x9b'),_0x5ebcef+'\x20Intervals\x20is\x20empty\x20'));}if(_0x41a968&&_[_0xbb4c('0x41')](config[_0xbb4c('0x9c')][_0x41a968])){_0x3f08f2['message']=utils[_0xbb4c('0x6d')]['UNKNOWN_TIMEZONE'];return _0x3f3634(msgResponse(_0xbb4c('0x98'),_0xbb4c('0x9b'),_0x5ebcef+_0xbb4c('0x9d')+_0x41a968));}if(_[_0xbb4c('0x9e')](_0xd8022b)){for(var _0x28fb3e=0x0;_0x28fb3e<_0xd8022b[_0xbb4c('0x9f')];_0x28fb3e+=0x1){_0x56b24a[_0xbb4c('0xa0')](ami[_0xbb4c('0xa1')]({'action':_0xbb4c('0xa2'),'command':util[_0xbb4c('0x81')](_0xbb4c('0xa3'),_0xd8022b[_0x28fb3e][_0xbb4c('0xa4')],!_[_0xbb4c('0x41')](config[_0xbb4c('0x9c')][_0x41a968])?_0x41a968:'')})[_0xbb4c('0x3f')](function(_0x300478){return _0x300478[_0xbb4c('0xa5')][_0xbb4c('0xa6')]('true')>=0x0;})[_0xbb4c('0xa7')](myreject(_0x3f3634)));}}else{_0x56b24a[_0xbb4c('0xa0')](ami['Action']({'action':_0xbb4c('0xa2'),'command':util[_0xbb4c('0x81')](_0xbb4c('0xa3'),_0xd8022b,!_['isUndefined'](config[_0xbb4c('0x9c')][_0x41a968])?_0x41a968:'')})[_0xbb4c('0x3f')](function(_0x428e1f){return _0x428e1f[_0xbb4c('0xa5')][_0xbb4c('0xa6')](_0xbb4c('0xa8'))>=0x0;})['catch'](myreject(_0x3f3634)));}Promise[_0xbb4c('0xa9')](_0x56b24a)['then'](function(_0x144ae0){var _0xd5baf=_[_0xbb4c('0xaa')](_0x144ae0);if(_0xd5baf){return _0x3be8c4(_0xd5baf);}else{_0x3f08f2[_0xbb4c('0x6c')]=_0x3ed5a1?utils[_0xbb4c('0x6d')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xbb4c('0x6d')][_0xbb4c('0xab')];return _0x3f3634(msgResponse(_0xbb4c('0xac'),_0xbb4c('0x9b'),_0xbb4c('0xad')+_0x3ed5a1+'\x20'+_0x5ebcef+_0xbb4c('0xae')+util[_0xbb4c('0x43')](_0xd8022b,{'showHidden':![],'depth':null})+_0xbb4c('0xaf')+_0x41a968));}})[_0xbb4c('0xa7')](function(_0x5e7d53){return _0x3f3634(msgResponse(_0xbb4c('0x98'),_0xbb4c('0x9b'),JSON['stringify'](_0x5e7d53)));});});};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x3c')]=function(){var _0x4e06b=this;return cmHopper[_0xbb4c('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0xbb4c('0x3f')](function(){setInterval(function(){_0x4e06b[_0xbb4c('0xb1')]();},0x3e8);});};Dialer[_0xbb4c('0x1b')][_0xbb4c('0xb1')]=function(){var _0x3c9f65=this;var _0x1902e1;for(var _0x3f476a in this[_0xbb4c('0x21')]){if(typeof this[_0xbb4c('0x21')][_0x3f476a]!=='undefined'){_0x1902e1=this[_0xbb4c('0x21')][_0x3f476a];if(utils[_0xbb4c('0x80')](_0x1902e1)&&utils['isIVRCampaignActive'](_0x1902e1)){_0x1902e1['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xbb4c('0x3f')](checkIsIVRCampaignActive(_0x1902e1))[_0xbb4c('0x3f')](checkInterval(_0x1902e1))[_0xbb4c('0x3f')](_0x3c9f65[_0xbb4c('0x90')](_0x1902e1))['then'](_0x3c9f65[_0xbb4c('0x95')](_0x1902e1['dialGlobalInterval'],_0x1902e1['dialTimezone'],_0x1902e1[_0xbb4c('0x45')],_0x1902e1))['then'](_0x3c9f65['checkIfTimeIntervals'](_0x1902e1[_0xbb4c('0x7a')],_0x1902e1[_0xbb4c('0xb2')],_0x1902e1['name'],_0x1902e1))[_0xbb4c('0x3f')](_0x3c9f65[_0xbb4c('0xb3')](_0x1902e1))[_0xbb4c('0xa7')](loggerCatchQueueSummary(_0xbb4c('0xb4'),_0x1902e1));}else{notSendMessagesCampaign(_0x1902e1);}}}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0xb5')]=function(_0x37e85f){if(_0x37e85f['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x37e85f);}switch(_0x37e85f[_0xbb4c('0xb6')]){case _0xbb4c('0xb7'):this['handlePower'](_0x37e85f,0x1);break;case _0xbb4c('0xb8'):this[_0xbb4c('0xb9')](_0x37e85f,_0x37e85f[_0xbb4c('0xba')]);break;case _0xbb4c('0xa'):this[_0xbb4c('0xa')](_0x37e85f);break;case _0xbb4c('0x9'):this['handlePower'](_0x37e85f,0x1);break;default:logger[_0xbb4c('0x69')](_0xbb4c('0xbb'),_0x37e85f[_0xbb4c('0x45')],_0xbb4c('0xbc'));}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x98')]=function(_0x22dbaa,_0x10dedb){var _0x120d26=_0x22dbaa[_0xbb4c('0xb2')];var _0x1a244d=_0x10dedb?_0x22dbaa[_0xbb4c('0xbd')]:_0x22dbaa[_0xbb4c('0x7a')][_0xbb4c('0x7b')];logger['silly'](_0xbb4c('0xbe'),_0x1a244d,_0x120d26,_0x22dbaa['name'],util[_0xbb4c('0x81')](_0xbb4c('0xbf'),_0x22dbaa['name'],_0x22dbaa['id']));var _0x45f3d7=null;return Interval[_0xbb4c('0xc0')](_0x1a244d,_0x120d26)['then'](function(_0x56765a){if(_0x56765a===!![]){return _0x56765a;}else{_0x22dbaa[_0xbb4c('0x6c')]=_0x10dedb?utils['CAMPAIGN_STATUS'][_0xbb4c('0xc1')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x45f3d7=msgResponse(_0xbb4c('0xac'),_0xbb4c('0x9b'),_0xbb4c('0xad')+_0x10dedb+'\x20'+_0x22dbaa[_0xbb4c('0x45')]+_0xbb4c('0xae')+util[_0xbb4c('0x43')](_0x1a244d,{'showHidden':![],'depth':null})+_0xbb4c('0xaf')+_0x120d26);}if(_0x45f3d7!==null){logger[_0xbb4c('0xc2')](_0xbb4c('0xc3'),_0x45f3d7);_0x45f3d7['isGlobal']=_0x10dedb;throw _0x45f3d7;}})['catch'](function(_0xd8a050){logger['error']('AMI\x20IfTime',_0xd8a050);throw msgResponse(_0xbb4c('0x88'),_0xbb4c('0x89'),util[_0xbb4c('0x43')](_0xd8a050,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xbb4c('0xc4')]=function(_0x220398){if(this[_0xbb4c('0x20')][_0x220398[_0xbb4c('0xc5')]]){if(this[_0xbb4c('0x27')][_0x220398[_0xbb4c('0xc6')]]&&this[_0xbb4c('0x27')][_0x220398[_0xbb4c('0xc6')]][_0xbb4c('0xc7')]!==_0xbb4c('0xc8')){this[_0xbb4c('0xc9')](this[_0xbb4c('0x20')][_0x220398['queue']]);this[_0xbb4c('0x27')][_0x220398[_0xbb4c('0xc6')]][_0xbb4c('0xca')]=moment()['format'](_0xbb4c('0xcb'));}}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x32')]=function(_0x5b3a88){var _0x29e25b=this[_0xbb4c('0x27')][_0x5b3a88[_0xbb4c('0xc6')]];if(this[_0xbb4c('0x20')][_0x5b3a88[_0xbb4c('0xc5')]]){if(_0x29e25b&&_0x29e25b[_0xbb4c('0xc7')]!==_0xbb4c('0xc8')){delete this[_0xbb4c('0x27')][_0x5b3a88[_0xbb4c('0xc6')]];this[_0xbb4c('0x20')][_0x5b3a88[_0xbb4c('0xc5')]][_0xbb4c('0xcc')]+=0x1;var _0x40686a=new AgentComplete(_0x29e25b,_0x5b3a88);if(_0x5b3a88['reason']===_0xbb4c('0xcd')){_0x40686a[_0xbb4c('0xce')]=this[_0xbb4c('0x20')][_0x5b3a88['queue']][_0xbb4c('0xcf')]&&this[_0xbb4c('0x20')][_0x5b3a88[_0xbb4c('0xc5')]][_0xbb4c('0xd0')]?moment()[_0xbb4c('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x40686a)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xd1')));hopperUtils[_0xbb4c('0xd2')](_0x40686a)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xd3')));}}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x31')]=function(_0x2a5987){var _0x579c7c=this[_0xbb4c('0x27')][_0x2a5987['uniqueid']];var _0x45f613=this;var _0x2573ce=![];var _0x3a5c88;var _0x4ad9a9;if(this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]]){if(_0x579c7c&&_0x579c7c[_0xbb4c('0xc7')]!==_0xbb4c('0xc8')){delete this[_0xbb4c('0x27')][_0x2a5987['uniqueid']];this[_0xbb4c('0xc9')](this['voiceQueues'][_0x2a5987['queue']]);_0x579c7c[_0xbb4c('0xd4')]=moment()[_0xbb4c('0x81')](_0xbb4c('0xcb'));var _0x1623c8=new QueueCallerAbandon(_0x579c7c,_0x2a5987);if(utils[_0xbb4c('0x62')](_0x579c7c['droptime'],_0x579c7c['responsetime'])>=_0x579c7c[_0xbb4c('0xd5')]){this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0x4f')]+=0x1;this[_0xbb4c('0x20')][_0x2a5987['queue']][_0xbb4c('0xd6')]+=0x1;this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1623c8[_0xbb4c('0xd7')]=0xa;_0x1623c8['statedesc']=_0xbb4c('0xd8');_0x1623c8[_0xbb4c('0xd9')]=_0xbb4c('0xda');_0x1623c8[_0xbb4c('0xce')]=this['voiceQueues'][_0x2a5987['queue']][_0xbb4c('0xcf')]?moment()[_0xbb4c('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1623c8['countdropretry']+=0x1;_0x1623c8[_0xbb4c('0xdb')]+=0x1;_0x3a5c88=this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xdc')];_0x4ad9a9=this[_0xbb4c('0x20')][_0x2a5987['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xbb4c('0xdd')](_0x1623c8,_0x1623c8[_0xbb4c('0xd7')],_0x579c7c[_0xbb4c('0xde')])[_0xbb4c('0x3f')](function(_0x411fc2){_0x2573ce=_0x411fc2[_0xbb4c('0xdf')]==0x1;if(_0x1623c8[_0xbb4c('0xe0')]>=_0x45f613[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xe1')]){_0x45f613[_0xbb4c('0xe2')](_0x1623c8,_0x411fc2[_0xbb4c('0xdf')]);}else{hopperUtils[_0xbb4c('0xe3')]({'active':![],'countdropretry':_0x1623c8[_0xbb4c('0xe0')],'scheduledat':moment()[_0xbb4c('0xe4')](_0x45f613[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xdc')],'minutes')[_0xbb4c('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x579c7c[_0xbb4c('0xe5')],'ListId':_0x579c7c[_0xbb4c('0xe6')],'VoiceQueueId':_0x579c7c['VoiceQueueId']||undefined,'CampaignId':_0x579c7c[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xe8')));var _0x7ee680=new History(_0x1623c8);_0x7ee680[_0xbb4c('0xd7')]=0xa;_0x7ee680[_0xbb4c('0x72')]=_0xbb4c('0xd8');_0x7ee680['starttime']=moment()[_0xbb4c('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x7ee680[_0xbb4c('0x73')]=_0x7ee680[_0xbb4c('0x74')];_0x7ee680[_0xbb4c('0xe9')]=_0x1623c8['calleridname'];_0x7ee680[_0xbb4c('0xea')]=_0x1623c8[_0xbb4c('0xea')];hopperUtils[_0xbb4c('0xeb')](_0x7ee680)[_0xbb4c('0xa7')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xbb4c('0x3f')](function(){if(_0x2573ce)hopperUtils[_0xbb4c('0xec')](_0x1623c8,_0x3a5c88,_0x4ad9a9)[_0xbb4c('0x3f')](function(){return 0x1;});});}else{this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1623c8['state']=0xb;_0x1623c8[_0xbb4c('0x72')]=_0xbb4c('0xed');_0x1623c8[_0xbb4c('0xd9')]='CALLEREXIT';_0x1623c8[_0xbb4c('0xee')]+=0x1;_0x1623c8[_0xbb4c('0xdb')]+=0x1;_0x3a5c88=this['voiceQueues'][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xef')];_0x4ad9a9=this['voiceQueues'][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xf0')];hopperUtils[_0xbb4c('0xdd')](_0x1623c8,_0x1623c8[_0xbb4c('0xd7')],_0x579c7c[_0xbb4c('0xde')])[_0xbb4c('0x3f')](function(_0x1b4387){if(_0x1623c8[_0xbb4c('0xee')]>=_0x45f613[_0xbb4c('0x20')][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xf1')]){_0x45f613[_0xbb4c('0xe2')](_0x1623c8,_0x1b4387[_0xbb4c('0xdf')]);}else{hopperUtils[_0xbb4c('0xe3')]({'active':![],'countabandonedretry':_0x1623c8[_0xbb4c('0xee')],'scheduledat':moment()[_0xbb4c('0xe4')](_0x45f613['voiceQueues'][_0x2a5987[_0xbb4c('0xc5')]][_0xbb4c('0xef')],_0xbb4c('0xf2'))[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x579c7c[_0xbb4c('0xe5')],'ListId':_0x579c7c[_0xbb4c('0xe6')],'VoiceQueueId':_0x579c7c[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x579c7c[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xf4')));var _0x43c889=new History(_0x1623c8);_0x43c889[_0xbb4c('0xd7')]=0xb;_0x43c889['statedesc']=_0xbb4c('0xed');_0x43c889['starttime']=moment()[_0xbb4c('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x43c889[_0xbb4c('0x73')]=_0x43c889[_0xbb4c('0x74')];_0x43c889[_0xbb4c('0xe9')]=_0x1623c8[_0xbb4c('0xe9')];_0x43c889[_0xbb4c('0xea')]=_0x1623c8[_0xbb4c('0xea')];hopperUtils['createHistory'](_0x43c889)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xf5')));}})[_0xbb4c('0x3f')](function(){if(_0x2573ce)hopperUtils[_0xbb4c('0xec')](_0x1623c8,_0x3a5c88,_0x4ad9a9)['then'](function(){return 0x1;});});}}}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0xf6')]=function(_0x5e3cc5){if(this['actions'][_0x5e3cc5[_0xbb4c('0xc6')]]){this[_0xbb4c('0x25')][_0x5e3cc5[_0xbb4c('0xc6')]][_0xbb4c('0xf7')]=_0x5e3cc5[_0xbb4c('0xf7')];}if(this['uniqueId'][_0x5e3cc5[_0xbb4c('0xc6')]]){this[_0xbb4c('0x27')][_0x5e3cc5[_0xbb4c('0xc6')]][_0xbb4c('0xf7')]=_0x5e3cc5[_0xbb4c('0xf7')];}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x3a')]=function(_0x36f4fd){if(!this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]){return;}var _0x3026e1=this[_0xbb4c('0x20')][this['actions'][_0x36f4fd[_0xbb4c('0xf8')]][_0xbb4c('0xc5')]]['strategy']||_0xbb4c('0xf9');if(_0x3026e1==='roundrobin'){if(this['actions'][_0x36f4fd[_0xbb4c('0xf8')]]&&_[_0xbb4c('0xfa')](this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]['locked'])&&_0x36f4fd[_0xbb4c('0x8d')]==='1'&&_0x36f4fd[_0xbb4c('0xfb')]==='0'){if(this[_0xbb4c('0x22')][_0x36f4fd['stateinterface']]){if(!this[_0xbb4c('0x22')][_0x36f4fd[_0xbb4c('0xfc')]][_0xbb4c('0xfd')]){this[_0xbb4c('0x22')][_0x36f4fd[_0xbb4c('0xfc')]][_0xbb4c('0xfd')]=!![];this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]['locked']=!![];this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]['stateinterface']=_0x36f4fd[_0xbb4c('0xfc')];}}}}else if(_0x3026e1===_0xbb4c('0xf9')){if(this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]){if(this[_0xbb4c('0x22')][_0x36f4fd[_0xbb4c('0xfc')]]){this['actions'][_0x36f4fd[_0xbb4c('0xf8')]][_0xbb4c('0xfc')]=_0x36f4fd[_0xbb4c('0xfc')];if(_[_0xbb4c('0xfa')](this[_0xbb4c('0x2b')][this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]]['queue']])){this[_0xbb4c('0x2b')][this['actions'][_0x36f4fd[_0xbb4c('0xf8')]]['queue']]=[];}this[_0xbb4c('0x2b')][this['actions'][_0x36f4fd[_0xbb4c('0xf8')]][_0xbb4c('0xc5')]][_0xbb4c('0xa0')](_[_0xbb4c('0x61')](_[_0xbb4c('0x78')](this[_0xbb4c('0x25')][_0x36f4fd[_0xbb4c('0xf8')]],['idHopper',_0xbb4c('0xfc')]),{'status':_0x36f4fd[_0xbb4c('0x8d')],'paused':_0x36f4fd[_0xbb4c('0xfb')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x384725){if(!this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]){return;}var _0x330046=this;var _0x4e51cd=this[_0xbb4c('0x20')][this[_0xbb4c('0x25')][_0x384725['actionid']][_0xbb4c('0xc5')]];var _0x540498=_0x4e51cd[_0xbb4c('0xfe')]||'rrmemory';if(_0x540498===_0xbb4c('0xff')){if(this[_0xbb4c('0x25')][_0x384725['actionid']]&&this[_0xbb4c('0x25')][_0x384725['actionid']][_0xbb4c('0xfc')]){this['preview'][_0xbb4c('0x100')](this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0x101')],this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['stateinterface'])[_0xbb4c('0xa7')](function(_0x12f436){logger['error'](_0xbb4c('0x102'),util[_0xbb4c('0x43')](_0x12f436,{'showHidden':![],'depth':null}));})[_0xbb4c('0x1e')](function(){_0x330046[_0xbb4c('0xc9')](_0x330046['voiceQueues'][_0x330046['actions'][_0x384725['actionid']][_0xbb4c('0xc5')]]);_0x330046['agents'][_0x330046[_0xbb4c('0x25')][_0x384725['actionid']][_0xbb4c('0xfc')]]['locked']=![];delete _0x330046['actions'][_0x384725['actionid']];unlockQueueStatus(_0x4e51cd);});}else{this[_0xbb4c('0xc9')](this[_0xbb4c('0x20')][this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x384725[_0xbb4c('0xf8')]]['ContactId'],'ListId':this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xe6')],'VoiceQueueId':this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xf3')]||undefined,'CampaignId':this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x103')));delete this['actions'][_0x384725[_0xbb4c('0xf8')]];unlockQueueStatus(_0x4e51cd);}}else if(_0x540498==='rrmemory'){var _0x5eb255;if(this[_0xbb4c('0x25')][_0x384725['actionid']]&&!_[_0xbb4c('0x47')](this[_0xbb4c('0x2b')][this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['queue']])){if(this[_0xbb4c('0x2c')][_0x330046[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['queue']]){this[_0xbb4c('0x2c')][_0x330046[_0xbb4c('0x25')][_0x384725['actionid']][_0xbb4c('0xc5')]]=this['queueBookedRR'][this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xc5')]]?this[_0xbb4c('0x2c')][this['actions'][_0x384725['actionid']]['queue']]:this[_0xbb4c('0x2b')][this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['queue']]?this[_0xbb4c('0x2b')][this[_0xbb4c('0x25')][_0x384725[_0xbb4c('0xf8')]]['queue']][_0xbb4c('0x104')]||0x0:0x0;}this[_0xbb4c('0x2b')][this['actions'][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xc5')]][_0xbb4c('0x104')]=this[_0xbb4c('0x2c')][this['actions'][_0x384725[_0xbb4c('0xf8')]][_0xbb4c('0xc5')]];for(var _0x2d72e5=0x0;_0x2d72e5=_0xbcf513[_0xbb4c('0x128')]){_0x3be900[_0xbb4c('0x129')](_0x2cfa4e,_0x5e6fab,_0x2ed870,'reason19\x20machine....');}else{if(_0x2cfa4e[_0xbb4c('0x12a')]>=_0xbcf513[_0xbb4c('0x12b')]){_0x3be900[_0xbb4c('0x12c')](_0x2cfa4e,_0x5e6fab,_0x2ed870,_0xbb4c('0x12d'));}else{hopperUtils[_0xbb4c('0xe3')]({'active':![],'countmachineretry':_0x2cfa4e[_0xbb4c('0x12a')],'scheduledat':moment()[_0xbb4c('0xe4')](_0xbcf513[_0xbb4c('0x12e')],'minutes')['format'](_0xbb4c('0xcb')),'ContactId':_0x2cfa4e[_0xbb4c('0xe5')],'ListId':_0x2cfa4e[_0xbb4c('0xe6')],'VoiceQueueId':_0x2cfa4e[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x2cfa4e['CampaignId']||undefined})[_0xbb4c('0xa7')](loggerCatch('[rescheduleContact][Machine]'));_0x5e6fab({'reschedule':0x1});}}});}if(_0x5554b9[_0xbb4c('0xc7')]==='ivr'&&this[_0xbb4c('0x21')][_0x5554b9[_0xbb4c('0xc5')]][_0xbb4c('0x115')]&&_0x2579d4[_0xbb4c('0x11e')]===_0xbb4c('0x116')){delete this[_0xbb4c('0x27')][_0x2579d4['uniqueid']];this[_0xbb4c('0xc9')](this[_0xbb4c('0x21')][_0x5554b9[_0xbb4c('0xc5')]]);_0x1a3d2b=new Hangup(_0x5554b9,_0x2579d4);_0x1a3d2b[_0xbb4c('0xd7')]=0x12;_0x1a3d2b[_0xbb4c('0x72')]='HangupInAMD';_0x1a3d2b[_0xbb4c('0x121')]=_0xbb4c('0x118');ami[_0xbb4c('0x119')]('custom:amd',ut[_0xbb4c('0x122')](_0x1a3d2b,'amd'));this[_0xbb4c('0x12f')](_0x1a3d2b,_0xbb4c('0x130'),_0xbb4c('0x131'));}if(_0x5554b9[_0xbb4c('0xc7')]===_0xbb4c('0xc8')&&this['campaigns'][_0x5554b9[_0xbb4c('0xc5')]][_0xbb4c('0x115')]&&_0x2579d4[_0xbb4c('0x11e')]===_0xbb4c('0x11f')){return new Promise(function(_0x531997,_0x30ba9b){delete _0x3be900[_0xbb4c('0x27')][_0x2579d4[_0xbb4c('0xc6')]];_0x3be900[_0xbb4c('0xc9')](_0x3be900[_0xbb4c('0x21')][_0x5554b9[_0xbb4c('0xc5')]]);_0x3be900[_0xbb4c('0x21')][_0x5554b9['queue']][_0xbb4c('0xcc')]+=0x1;_0x3be900[_0xbb4c('0x21')][_0x5554b9['queue']][_0xbb4c('0x117')]+=0x1;var _0x379773=_0x3be900[_0xbb4c('0x21')][_0x5554b9[_0xbb4c('0xc5')]];var _0x260869=new Hangup(_0x5554b9,_0x2579d4);_0x260869[_0xbb4c('0xd7')]=0x13;_0x260869[_0xbb4c('0x72')]=_0xbb4c('0x120');_0x260869[_0xbb4c('0x121')]=_0xbb4c('0x118');_0x260869['countmachineretry']+=0x1;_0x260869['countglobal']+=0x1;_0x260869[_0xbb4c('0x11b')]=!![];ami[_0xbb4c('0x119')](_0xbb4c('0x11a'),ut['buildObj'](_0x260869,_0xbb4c('0x11b')));hopperUtils[_0xbb4c('0xeb')](_0x260869)[_0xbb4c('0xa7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x260869['countbusyretry']+_0x260869['countcongestionretry']+_0x260869[_0xbb4c('0x132')]+_0x260869['countnosuchnumberretry']+_0x260869['countdropretry']+_0x260869['countabandonedretry']+_0x260869[_0xbb4c('0x12a')]+_0x260869[_0xbb4c('0x127')]>=_0x379773[_0xbb4c('0x128')]){_0x3be900[_0xbb4c('0x129')](_0x260869,_0x531997,_0x30ba9b,'reason19\x20machine....');}else{if(_0x260869[_0xbb4c('0x12a')]>=_0x379773[_0xbb4c('0x12b')]){_0x3be900[_0xbb4c('0x12c')](_0x260869,_0x531997,_0x30ba9b,_0xbb4c('0x12d'));}else{hopperUtils[_0xbb4c('0xe3')]({'active':![],'countmachineretry':_0x260869[_0xbb4c('0x12a')],'scheduledat':moment()[_0xbb4c('0xe4')](_0x379773[_0xbb4c('0x12e')],'minutes')[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x260869['ContactId'],'ListId':_0x260869[_0xbb4c('0xe6')],'VoiceQueueId':_0x260869[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x260869[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch('[rescheduleContact][Machine]'));_0x531997({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x243d53){var _0x521f8e=this['uniqueId'][_0x243d53['uniqueid']];var _0x575bcc;if(_0x521f8e&&_0x521f8e[_0xbb4c('0xc7')]===_0xbb4c('0xc8')){delete this[_0xbb4c('0x27')][_0x243d53[_0xbb4c('0xc6')]];this[_0xbb4c('0xc9')](this[_0xbb4c('0x21')][_0x521f8e[_0xbb4c('0xc5')]]);this[_0xbb4c('0x21')][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0x133')]+=0x1;_0x575bcc=new Hangup(_0x521f8e,_0x243d53);hopperUtils[_0xbb4c('0xeb')](_0x575bcc)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x134')));hopperUtils[_0xbb4c('0xd2')](_0x575bcc)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x135')));}if(_0x521f8e&&_0x521f8e[_0xbb4c('0xc7')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0x136')])){delete this[_0xbb4c('0x27')][_0x243d53['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x521f8e[_0xbb4c('0xc5')]]);this[_0xbb4c('0x20')][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0xcc')]+=0x1;this['voiceQueues'][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0x117')]+=0x1;_0x575bcc=new Hangup(_0x521f8e,_0x243d53);_0x575bcc[_0xbb4c('0xd7')]=0x10;_0x575bcc[_0xbb4c('0x72')]='AnswerAGI';_0x575bcc[_0xbb4c('0x121')]=_0xbb4c('0x137');hopperUtils[_0xbb4c('0xeb')](_0x575bcc)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x134')));hopperUtils[_0xbb4c('0xd2')](_0x575bcc)['catch'](loggerCatch(_0xbb4c('0x135')));}if(_0x521f8e&&_0x521f8e[_0xbb4c('0xc7')]!==_0xbb4c('0xc8')&&!isNotNull(this[_0xbb4c('0x20')][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0x136')])){delete this['uniqueId'][_0x243d53['uniqueid']];this[_0xbb4c('0xc9')](this['voiceQueues'][_0x521f8e['queue']]);this['voiceQueues'][_0x521f8e[_0xbb4c('0xc5')]][_0xbb4c('0x138')]+=0x1;_0x575bcc=new Hangup(_0x521f8e,_0x243d53);_0x575bcc[_0xbb4c('0xd7')]=0xc;_0x575bcc[_0xbb4c('0x72')]=_0x243d53['cause-txt'];_0x575bcc[_0xbb4c('0x121')]=_0xbb4c('0x139');hopperUtils['createHistory'](_0x575bcc)[_0xbb4c('0xa7')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xbb4c('0xd2')](_0x575bcc)['catch'](loggerCatch(_0xbb4c('0x135')));}};Dialer['prototype'][_0xbb4c('0xc')]=function(_0x2c3301){var _0x247e7e=this;if(!_0x247e7e['queuesSummary'][_0x2c3301[_0xbb4c('0x45')]]){_0x247e7e[_0xbb4c('0x2d')][_0x2c3301[_0xbb4c('0x45')]]={'running':![]};}else if(_0x247e7e['queuesSummary'][_0x2c3301[_0xbb4c('0x45')]][_0xbb4c('0x13a')]===!![]){return;}else if(_0x247e7e[_0xbb4c('0x2d')][_0x2c3301[_0xbb4c('0x45')]][_0xbb4c('0x13a')]===![]){_0x247e7e[_0xbb4c('0x2d')][_0x2c3301[_0xbb4c('0x45')]][_0xbb4c('0x13a')]=!![];}var _0x3978ca=_0x247e7e[_0xbb4c('0x20')][_0x2c3301['name']];var _0x75e168=_0x3978ca['message']!==utils[_0xbb4c('0x6d')]['INACTIVE'];var _0x5f332e=utils[_0xbb4c('0x13b')](_0x3978ca);_0x3978ca[_0xbb4c('0x13c')]=utils[_0xbb4c('0x13d')](_0x3978ca,_0x247e7e[_0xbb4c('0x23')]);Promise['resolve']()['then'](function(){if(_0x3978ca['statusMessage']===utils[_0xbb4c('0x6d')][_0xbb4c('0x7e')]){if(_0x75e168){clearPredictiveAttributes(_0x3978ca);_0x2c3301[_0xbb4c('0x29')]=undefined;_0x2c3301[_0xbb4c('0x63')]=undefined;}if(_0x3978ca[_0xbb4c('0x13c')]===utils[_0xbb4c('0x6d')][_0xbb4c('0x7e')]){_0x2c3301[_0xbb4c('0x13e')]=0x0;_0x2c3301['paused']=0x0;_0x2c3301[_0xbb4c('0x13f')]=0x0;_0x2c3301[_0xbb4c('0x140')]=0x0;_0x2c3301[_0xbb4c('0x141')]=0x0;}}else if(_0x3978ca[_0xbb4c('0x13c')]===utils[_0xbb4c('0x6d')][_0xbb4c('0x142')]&&!_0x5f332e){return _0x247e7e[_0xbb4c('0x98')](_0x3978ca,!![])[_0xbb4c('0x3f')](function(){return _0x247e7e[_0xbb4c('0x98')](_0x3978ca,![]);})[_0xbb4c('0x3f')](function(){return _0x247e7e[_0xbb4c('0xb5')](_0x3978ca);})['catch'](function(_0x276e67){loggerSyncQueueSummary[_0xbb4c('0x64')](_0xbb4c('0x143'),util[_0xbb4c('0x43')](_0x276e67,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3978ca);});}else{clearPredictiveAttributes(_0x3978ca);}})['then'](function(){var _0xf2a2e9=_0x2c3301['compareToOutboundQueue'](_0x3978ca);if(_0xf2a2e9||_0x3978ca[_0xbb4c('0x144')]){_0x3978ca[_0xbb4c('0x144')]=![];_0x2c3301['updateReportFromOutboundQueue'](_0x3978ca);Object[_0xbb4c('0x145')](_0x3978ca,_0x2c3301);emitOutboundVoiceQueueSummary(_0x2c3301);}_0x247e7e[_0xbb4c('0x2d')][_0x3978ca['name']][_0xbb4c('0x13a')]=![];})[_0xbb4c('0xa7')](function(_0xbd75ad){logger['error'](_0xbb4c('0x143'),util[_0xbb4c('0x43')](_0xbd75ad,{'showHidden':![],'depth':null}));_0x247e7e[_0xbb4c('0x2d')][_0x3978ca[_0xbb4c('0x45')]][_0xbb4c('0x13a')]=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x52830e=_[_0xbb4c('0x146')](this[_0xbb4c('0x20')],function(_0x4a8c8f){return _0x4a8c8f[_0xbb4c('0x147')];});var _0x427548=_[_0xbb4c('0x146')](this[_0xbb4c('0x22')],function(_0x403dd8){return _0x403dd8[_0xbb4c('0x148')]&&_0x403dd8[_0xbb4c('0x8d')]===_0xbb4c('0x8e');});if(_0x52830e[_0xbb4c('0x9f')]>0x0&&_0x427548[_0xbb4c('0x9f')]>0x0){return Promise[_0xbb4c('0x149')]()[_0xbb4c('0x3f')](cmHopper['handlePreviewRecallNotifications'](_[_0xbb4c('0x14a')](_0x52830e,'id'),previewRecallmeReminderInterval,_[_0xbb4c('0x14a')](_0x427548,'id')))[_0xbb4c('0x3f')](function(_0x1a2976){for(var _0xee219c=0x0;_0xee219c<_0x1a2976[_0xbb4c('0x9f')];_0xee219c++){var _0x41e010=_0x1a2976[_0xee219c]['Agent'][_0xbb4c('0x45')];if(_0x41e010)io['to'](util['format'](_0xbb4c('0x14b'),_0x41e010))[_0xbb4c('0x119')](_0xbb4c('0x14c'),{'hopper':_0x1a2976[_0xee219c]});}})[_0xbb4c('0xa7')](function(_0xcdf759){logger[_0xbb4c('0x69')](_0xbb4c('0x14d'),_0xcdf759);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xbb4c('0x3d')]=function(){var _0x19a85a=this;setInterval(function(){_0x19a85a[_0xbb4c('0x14e')](_0x19a85a[_0xbb4c('0x27')],_0xbb4c('0x14f'));_0x19a85a['clearZombieChannels'](_0x19a85a[_0xbb4c('0x25')],_0xbb4c('0x150'));},0x32c8);};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x14e')]=function(_0x115f75,_0x1a4067){var _0x2ed3d3=this;for(var _0x275a7e in _0x115f75){if(typeof _0x115f75[_0x275a7e]!=='undefined'){this['sequence'][_0xbb4c('0x1c')](function(){if(!_[_0xbb4c('0xfa')](_0x115f75[_0x275a7e])){return ami[_0xbb4c('0xa1')]({'action':_0xbb4c('0x8d'),'channel':_0x115f75[_0x275a7e][_0xbb4c('0xf7')]})[_0xbb4c('0xa7')](function(_0x346da9){if(_0x346da9[_0xbb4c('0x6c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x115f75[_0x275a7e]&&_0x115f75[_0x275a7e][_0xbb4c('0xc7')]!=='ivr'){_0x2ed3d3[_0xbb4c('0xc9')](_0x2ed3d3[_0xbb4c('0x20')][_0x115f75[_0x275a7e][_0xbb4c('0xc5')]]);logger[_0xbb4c('0x69')](_0xbb4c('0x151'),_0x1a4067,_0x275a7e,_0x115f75[_0x275a7e]['queue']);delete _0x115f75[_0x275a7e];}if(_0x115f75[_0x275a7e]&&_0x115f75[_0x275a7e][_0xbb4c('0xc7')]===_0xbb4c('0xc8')){_0x2ed3d3[_0xbb4c('0xc9')](_0x2ed3d3[_0xbb4c('0x21')][_0x115f75[_0x275a7e][_0xbb4c('0xc5')]]);logger[_0xbb4c('0x69')]('[Dialer][checkChannel][ivr]',_0x1a4067,_0x275a7e,_0x115f75[_0x275a7e]['queue']);delete _0x115f75[_0x275a7e];}},0x2328);}});}});}}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x152')]=function(_0x3bcd77){return Promise[_0xbb4c('0x149')]()[_0xbb4c('0x3f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3bcd77))[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x153')));};Dialer[_0xbb4c('0x1b')]['updateOriginated']=function(_0x126b21){if(!_[_0xbb4c('0x41')](_0x126b21)&&_0x126b21!==null){if(typeof _0x126b21[_0xbb4c('0x154')]!==_0xbb4c('0x155')){if(_0x126b21[_0xbb4c('0x154')]>0x0){_0x126b21['originated']-=0x1;}else{logger['error'](_0xbb4c('0x156'));}}}else{logger[_0xbb4c('0x69')](_0xbb4c('0x157'));}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x158')]=function(_0x250248,_0x428b16){var _0x1f1deb=this;return function(_0x1d27db){_0x1f1deb[_0xbb4c('0xc9')](_0x428b16);logger['error'](_0x250248,util[_0xbb4c('0x43')](_0x1d27db,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xbb4c('0x159')]=function(_0x4c8b8c,_0x53b647,_0x333231){var _0x3ffeec={'state':0x19,'statedesc':_0xbb4c('0x15a')};this['updateOriginated'](_0x53b647);this['saveInDb'](_[_0xbb4c('0x61')](_0x3ffeec,_[_0xbb4c('0x78')](_0x333231,[_0xbb4c('0xe5'),_0xbb4c('0xe6'),_0xbb4c('0x15b'),_0xbb4c('0xf3'),'CampaignId'])),_0xbb4c('0x15c'),_0xbb4c('0x15d'));logger[_0xbb4c('0x69')](_0x4c8b8c);};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x12f')]=function(_0x364245,_0x387989,_0x17fb21){hopperUtils[_0xbb4c('0xeb')](_0x364245)[_0xbb4c('0xa7')](loggerCatch(_0x387989));hopperUtils[_0xbb4c('0xd2')](_0x364245)[_0xbb4c('0xa7')](loggerCatch(_0x17fb21));};Dialer[_0xbb4c('0x1b')][_0xbb4c('0xe2')]=function(_0x231e2f,_0x26b450){hopperUtils['createHistory'](_0x231e2f)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xd1')));if(_0x26b450==0x0){hopperUtils['moveContactManagedDialer'](_0x231e2f)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x14d')]=function(_0x27863e){return Promise[_0xbb4c('0x149')]()[_0xbb4c('0x3f')](cmHopper[_0xbb4c('0x15e')](_0x27863e['id'],previewRecallmeReminderInterval))['then'](function(_0x5db972){for(var _0x2d5204=0x0;_0x2d5204<_0x5db972[_0xbb4c('0x9f')];_0x2d5204++){var _0x59e13f=_0x5db972[_0x2d5204][_0xbb4c('0x15f')][_0xbb4c('0x45')];if(_0x59e13f)io['to'](util[_0xbb4c('0x81')](_0xbb4c('0x14b'),_0x59e13f))[_0xbb4c('0x119')](_0xbb4c('0x14c'),{'hopper':_0x5db972[_0x2d5204]});}})[_0xbb4c('0xa7')](function(){});};Dialer[_0xbb4c('0x1b')]['launchHandleIvr']=function(_0x105062){var _0x175963=this;return function(){_0x175963[_0xbb4c('0x160')](_0x105062);};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x161')]=function(_0x5e29de,_0x50eb6f){var _0x3767db=this;var _0x46b20b=uuid['v4']();this[_0xbb4c('0x25')][_0x46b20b]=new Action(_0x5e29de,_0x50eb6f,_0x46b20b);return new Promise(function(_0x1c7d7f,_0x5491a9){if(_[_0xbb4c('0x41')](_0x5e29de)&&typeof _0x5e29de!=='object'){return _0x5491a9(msgResponse(_0xbb4c('0x162'),_0xbb4c('0x9b'),_0xbb4c('0x163')));}if(_[_0xbb4c('0x41')](_0x50eb6f['phone'])||_0x50eb6f[_0xbb4c('0x164')]===null){return _0x5491a9(msgResponse('originate',_0xbb4c('0x9b'),_0xbb4c('0x165')));}var _0x45de95={'XMD-CALLERID':_0x3767db[_0xbb4c('0x25')][_0x46b20b][_0xbb4c('0x166')](),'XMD-AGI':_0x5e29de[_0xbb4c('0x136')]?util[_0xbb4c('0x81')](_0xbb4c('0x167'),ipAgi,_0x5e29de[_0xbb4c('0x136')]):_0xbb4c('0x168'),'XMD-AGIAFTER':_0x5e29de[_0xbb4c('0xcf')]?util[_0xbb4c('0x81')](_0xbb4c('0x167'),ipAgi,_0x5e29de[_0xbb4c('0xcf')]):_0xbb4c('0x168'),'XMD-QUEUE':utils[_0xbb4c('0x169')](_0x5e29de)?util[_0xbb4c('0x81')](_0xbb4c('0x16a'),_0x5e29de['name'],_0x5e29de[_0xbb4c('0x16b')]||'',_0x5e29de[_0xbb4c('0xd0')]?'c':'',_0x5e29de[_0xbb4c('0xd5')]||0x3):_0xbb4c('0x168'),'XMD-CONTACTID':_0x50eb6f['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3767db[_0xbb4c('0x25')][_0x46b20b][_0xbb4c('0x166')](),'XMD-AMD':_0x5e29de[_0xbb4c('0x115')]?_0xbb4c('0x142'):_0xbb4c('0x168'),'XMD-DESTINATION':_0xbb4c('0x114')};if(_0x5e29de[_0xbb4c('0x115')]){_0x45de95[_0xbb4c('0x16c')]=_0x5e29de[_0xbb4c('0x16d')]||0x9c4;_0x45de95[_0xbb4c('0x16e')]=_0x5e29de['dialAMDGreeting']||0x5dc;_0x45de95[_0xbb4c('0x16f')]=_0x5e29de[_0xbb4c('0x170')]||0x320;_0x45de95[_0xbb4c('0x171')]=_0x5e29de['dialAMDTotalAnalysisTime']||0x1388;_0x45de95[_0xbb4c('0x172')]=_0x5e29de[_0xbb4c('0x173')]||0x64;_0x45de95[_0xbb4c('0x174')]=_0x5e29de[_0xbb4c('0x175')]||0x32;_0x45de95[_0xbb4c('0x176')]=_0x5e29de[_0xbb4c('0x177')]||0x3;_0x45de95['XMD-AMDSILENCETHRESHOLD']=_0x5e29de[_0xbb4c('0x178')]||0x100;_0x45de95['XMD-AMDMAXIMUMWORDLENGTH']=_0x5e29de[_0xbb4c('0x179')]||0x1388;}if(utils['isOutboundQueue'](_0x5e29de)){_0x45de95[_0xbb4c('0x17a')]=_0x50eb6f[_0xbb4c('0xf3')];}else{_0x45de95['XMD-CAMPAIGNID']=_0x50eb6f[_0xbb4c('0xe7')];}var _0x3a2107=utils[_0xbb4c('0x17b')](_0x50eb6f['Contact']);Object[_0xbb4c('0x145')](_0x45de95,_0x3a2107);var _0x1af04d=_0x3767db['isTrunkReachable'](_0x5e29de[_0xbb4c('0x91')])?utils[_0xbb4c('0x17c')](_0x5e29de[_0xbb4c('0x91')][_0xbb4c('0x17d')],_0x5e29de[_0xbb4c('0x17e')],_0x5e29de[_0xbb4c('0x17f')]>0x0?utils[_0xbb4c('0x180')](_0x5e29de[_0xbb4c('0x181')],_0x5e29de[_0xbb4c('0x17f')]):_0x5e29de['dialOriginateCallerIdNumber']):utils[_0xbb4c('0x17c')](_[_0xbb4c('0xfa')](_0x5e29de[_0xbb4c('0x92')])?_0x5e29de[_0xbb4c('0x91')][_0xbb4c('0x17d')]:_0x5e29de[_0xbb4c('0x92')][_0xbb4c('0x17d')],_0x5e29de[_0xbb4c('0x17e')],_0x5e29de[_0xbb4c('0x17f')]>0x0?utils['getCallerIdRandom'](_0x5e29de[_0xbb4c('0x181')],_0x5e29de[_0xbb4c('0x17f')]):_0x5e29de[_0xbb4c('0x181')]);if(_0x1af04d){_0x45de95[_0xbb4c('0x182')]=_0x3767db['actions'][_0x46b20b]['originatecalleridname']=utils['extractCalleridName'](_0x1af04d);_0x45de95['XMD-ORIGINATECALLERIDNUM']=_0x50eb6f[_0xbb4c('0x164')];}_0x5e29de['variables']=_0x45de95;return ami['Action']({'actionid':_0x46b20b,'action':_0xbb4c('0x162'),'channel':_0x3767db[_0xbb4c('0x8a')](_0x5e29de[_0xbb4c('0x91')])?util[_0xbb4c('0x81')](_0xbb4c('0x183'),_0x5e29de['Trunk'][_0xbb4c('0x45')],isNotNull(_0x5e29de[_0xbb4c('0x184')])?_0x5e29de[_0xbb4c('0x184')][_0xbb4c('0x185')]()||'':'',_0x5e29de[_0xbb4c('0x186')]>0x0?_0x50eb6f[_0xbb4c('0x164')]['substring'](_0x5e29de[_0xbb4c('0x186')]):_0x50eb6f['phone']):util[_0xbb4c('0x81')](_0xbb4c('0x183'),_[_0xbb4c('0xfa')](_0x5e29de[_0xbb4c('0x92')])?_0x5e29de[_0xbb4c('0x91')]['name']:_0x5e29de[_0xbb4c('0x92')][_0xbb4c('0x45')],isNotNull(_0x5e29de[_0xbb4c('0x184')])?_0x5e29de[_0xbb4c('0x184')][_0xbb4c('0x185')]()||'':'',_0x5e29de[_0xbb4c('0x186')]>0x0?_0x50eb6f[_0xbb4c('0x164')][_0xbb4c('0x187')](_0x5e29de[_0xbb4c('0x186')]):_0x50eb6f[_0xbb4c('0x164')]),'callerid':_0x1af04d,'Exten':_0xbb4c('0x114'),'Context':_0xbb4c('0x188'),'Priority':'1','variable':_0x45de95,'timeout':(_0x5e29de[_0xbb4c('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x46b20b})['then'](function(_0x4901dc){return _0x1c7d7f(_0x4901dc);})[_0xbb4c('0xa7')](function(_0x24f646){_0x5e29de[_0xbb4c('0x18a')]+=0x1;var _0x11d3d5=new History(_0x3767db[_0xbb4c('0x25')][_0x46b20b]);logger[_0xbb4c('0x69')](util[_0xbb4c('0x81')]('[originateError]:\x20%s',JSON['stringify'](_0x24f646)));_0x11d3d5[_0xbb4c('0xd7')]=0xe;_0x11d3d5[_0xbb4c('0x72')]=_0xbb4c('0x18b');_0x11d3d5[_0xbb4c('0x74')]=moment()[_0xbb4c('0x81')](_0xbb4c('0xcb'));_0x11d3d5[_0xbb4c('0x73')]=_0x11d3d5[_0xbb4c('0x74')];hopperUtils['createHistory'](_0x11d3d5)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x18c')));_0x3767db[_0xbb4c('0xd2')](_0x11d3d5)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x18c')))['finally'](function(){delete _0x3767db[_0xbb4c('0x25')][_0x46b20b];return _0x5491a9(msgResponse(_0xbb4c('0x162'),_0xbb4c('0x89'),_0xbb4c('0x18d')));});});});};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x18e')]=function(_0x5cfa15,_0x53f5be,_0x1e300e){var _0x5d241b=new History(_0x53f5be);if(_0x5d241b[_0xbb4c('0x124')]+_0x5d241b[_0xbb4c('0x125')]+_0x5d241b[_0xbb4c('0x132')]+_0x5d241b[_0xbb4c('0x126')]+_0x5d241b[_0xbb4c('0xe0')]+_0x5d241b[_0xbb4c('0xee')]+_0x5d241b['countmachineretry']+_0x5d241b[_0xbb4c('0x127')]>=_0x1e300e[_0xbb4c('0x128')]-0x1){return!![];}switch(_0x5cfa15){case 0x3:if(_0x5d241b['countnoanswerretry']>=_0x1e300e['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x5d241b[_0xbb4c('0x132')]+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e[_0xbb4c('0x18f')],_0xbb4c('0xf2'))[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x5d241b['ContactId'],'ListId':_0x5d241b['ListId'],'VoiceQueueId':_0x5d241b['VoiceQueueId']||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})['catch'](loggerCatch(_0xbb4c('0x190')));break;case 0x5:if(_0x5d241b['countbusyretry']>=_0x1e300e[_0xbb4c('0x191')]-0x1){return!![];}hopperUtils[_0xbb4c('0xe3')]({'active':![],'countbusyretry':_0x5d241b[_0xbb4c('0x124')]+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e[_0xbb4c('0x192')],_0xbb4c('0xf2'))[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x193')));break;case 0x8:if(_0x5d241b['countcongestionretry']>=_0x1e300e['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xbb4c('0xe3')]({'active':![],'countcongestionretry':_0x5d241b['countcongestionretry']+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e[_0xbb4c('0x194')],_0xbb4c('0xf2'))['format'](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5d241b['countnosuchnumberretry']>=_0x1e300e[_0xbb4c('0x195')]-0x1){return!![];}else{hopperUtils[_0xbb4c('0xe3')]({'active':![],'countnosuchnumberretry':_0x5d241b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e['dialNoSuchNumberRetryFrequency'],_0xbb4c('0xf2'))['format'](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x5d241b['CampaignId']||undefined})['catch'](loggerCatch(_0xbb4c('0x196')));}break;case 0xa:if(_0x5d241b['countdropretry']>=_0x1e300e[_0xbb4c('0xe1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5d241b['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x1e300e[_0xbb4c('0xdc')],_0xbb4c('0xf2'))['format'](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b['VoiceQueueId']||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5d241b['countabandonedretry']>=_0x1e300e[_0xbb4c('0xf1')]-0x1){return!![];}hopperUtils[_0xbb4c('0xe3')]({'active':![],'countabandonedretry':_0x5d241b[_0xbb4c('0xee')]+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e[_0xbb4c('0xef')],'minutes')['format'](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b['VoiceQueueId']||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xf4')));break;case 0x13:if(_0x5d241b['countmachineretry']>=_0x1e300e[_0xbb4c('0x12b')]-0x1){return!![];}hopperUtils[_0xbb4c('0xe3')]({'active':![],'countmachineretry':_0x5d241b['countmachineretry']+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e['dialMachineRetryFrequency'],'minutes')[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b[_0xbb4c('0xe6')],'VoiceQueueId':_0x5d241b[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x5d241b['CampaignId']||undefined})[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x197')));break;case 0x14:if(_0x5d241b['countagentrejectretry']>=_0x1e300e[_0xbb4c('0x198')]-0x1){return!![];}hopperUtils[_0xbb4c('0xe3')]({'active':![],'countagentrejectretry':_0x5d241b['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xbb4c('0xe4')](_0x1e300e[_0xbb4c('0x199')],'minutes')[_0xbb4c('0x81')](_0xbb4c('0xcb')),'ContactId':_0x5d241b[_0xbb4c('0xe5')],'ListId':_0x5d241b['ListId'],'VoiceQueueId':_0x5d241b['VoiceQueueId']||undefined,'CampaignId':_0x5d241b[_0xbb4c('0xe7')]||undefined})['catch'](loggerCatch(_0xbb4c('0x19a')));break;default:return!![];}};Dialer[_0xbb4c('0x1b')]['callProgressDetecting']=function(_0x564fbe,_0x3e08c9,_0xbd9d3a){var _0x4a6c32=this;var _0x4a8910=new History(_0x564fbe);var _0x514a02=![];var _0x444d6c;var _0x55ca3b;return new Promise(function(_0x3044f9,_0x57e8c9){if(_[_0xbb4c('0x41')](_0x3e08c9)&&typeof _0x3e08c9!==_0xbb4c('0x19b')){return _0x57e8c9(msgResponse(_0xbb4c('0x19c'),_0xbb4c('0x9b'),_0xbb4c('0x19d')));}if(_[_0xbb4c('0x41')](_0xbd9d3a)&&typeof _0xbd9d3a!=='object'){return _0x57e8c9(msgResponse(_0xbb4c('0x19c'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0xbb4c('0xdd')](_0x4a8910,_0xbd9d3a[_0xbb4c('0x19e')],_0x3e08c9)[_0xbb4c('0x3f')](function(_0x4f707d){if(_0x4f707d['additional']==0x1)_0x514a02=!![];switch(_0xbd9d3a[_0xbb4c('0x19e')]){case'0':_0x3e08c9['outboundNoSuchCallsDay']+=0x1;_0x4a8910['state']=0x0;_0x4a8910[_0xbb4c('0x72')]=_0xbb4c('0x19f');_0x4a8910[_0xbb4c('0x126')]+=0x1;_0x4a8910[_0xbb4c('0xdb')]+=0x1;ami[_0xbb4c('0x119')](_0xbb4c('0x1a0'),ut[_0xbb4c('0x122')](_0x564fbe,'nosuchnumber'));_0x444d6c=_0x3e08c9['dialNoSuchNumberRetryFrequency'];_0x55ca3b=_0x3e08c9[_0xbb4c('0xf0')];hopperUtils[_0xbb4c('0xeb')](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x123')));if(_0x4a6c32[_0xbb4c('0x18e')](0x0,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910[_0xbb4c('0x126')]>=_0x3e08c9['dialNoSuchNumberMaxRetry']){_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1a1'));}else{_0x4a6c32['stateGlobal'](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1a1'));}}break;case'3':_0x3e08c9['outboundNoAnswerCallsDay']+=0x1;_0x4a8910['state']=0x3;_0x4a8910[_0xbb4c('0x72')]=_0xbb4c('0x1a2');_0x4a8910['countnoanswerretry']+=0x1;_0x4a8910[_0xbb4c('0xdb')]+=0x1;var _0x3fa4d9=ut['buildNoAnswerEventPayload'](_0x564fbe,_0x3e08c9);ami[_0xbb4c('0x119')]('custom:agentnoanswer',_0x3fa4d9);_0x444d6c=_0x3e08c9['dialNoAnswerRetryFrequency'];_0x55ca3b=_0x3e08c9[_0xbb4c('0xf0')];hopperUtils['createHistory'](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4a6c32['checkRetriveMax'](0x3,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910[_0xbb4c('0x132')]>=_0x3e08c9[_0xbb4c('0x1a3')]){_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4a6c32[_0xbb4c('0x129')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1a4'));}}break;case'5':_0x3e08c9[_0xbb4c('0x1a5')]+=0x1;_0x4a8910[_0xbb4c('0xd7')]=0x5;_0x4a8910[_0xbb4c('0x72')]=_0xbb4c('0x1a6');_0x4a8910['countbusyretry']+=0x1;_0x4a8910[_0xbb4c('0xdb')]+=0x1;ami[_0xbb4c('0x119')](_0xbb4c('0x1a7'),ut[_0xbb4c('0x122')](_0x564fbe,'busy'));_0x444d6c=_0x3e08c9[_0xbb4c('0x192')];_0x55ca3b=_0x3e08c9[_0xbb4c('0xf0')];hopperUtils[_0xbb4c('0xeb')](_0x4a8910)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4a6c32['checkRetriveMax'](0x5,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910['countbusyretry']>=_0x3e08c9['dialBusyMaxRetry']){_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1a8'));}else{_0x4a6c32[_0xbb4c('0x129')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1a8'));}}break;case'8':_0x3e08c9[_0xbb4c('0x1a9')]+=0x1;_0x4a8910[_0xbb4c('0xd7')]=0x8;_0x4a8910['statedesc']=_0xbb4c('0x1aa');_0x4a8910['countcongestionretry']+=0x1;_0x4a8910[_0xbb4c('0xdb')]+=0x1;_0x444d6c=_0x3e08c9[_0xbb4c('0x194')];_0x55ca3b=_0x3e08c9[_0xbb4c('0xf0')];ami[_0xbb4c('0x119')](_0xbb4c('0x1ab'),ut['buildObj'](_0x564fbe,'congestion'));hopperUtils[_0xbb4c('0xeb')](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x1ac')));if(_0x4a6c32[_0xbb4c('0x18e')](0x8,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910['countcongestionretry']>=_0x3e08c9['dialCongestionMaxRetry']){_0x4a6c32['createStateFinal'](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1ad'));}else{_0x4a6c32[_0xbb4c('0x129')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1ad'));}}break;case'11':_0x3e08c9[_0xbb4c('0x1ae')]+=0x1;_0x4a8910[_0xbb4c('0xd7')]=0xb;_0x4a8910[_0xbb4c('0x72')]=_0xbb4c('0xed');_0x4a8910[_0xbb4c('0xee')]+=0x1;_0x4a8910['countglobal']+=0x1;_0x444d6c=_0x3e08c9[_0xbb4c('0xef')];_0x55ca3b=_0x3e08c9['callAdditionalPhoneAfterMin'];hopperUtils[_0xbb4c('0xeb')](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0xf5')));if(_0x4a6c32[_0xbb4c('0x18e')](0xb,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910[_0xbb4c('0xee')]>=_0x3e08c9[_0xbb4c('0xf1')]){_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1af'));}else{_0x4a6c32[_0xbb4c('0x129')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1af'));}}break;case'20':_0x3e08c9['outboundRejectCallsDay']+=0x1;_0x4a8910[_0xbb4c('0xd7')]=0x14;_0x4a8910[_0xbb4c('0x72')]=_0xbb4c('0x1b0');_0x4a8910[_0xbb4c('0x127')]+=0x1;_0x4a8910[_0xbb4c('0xdb')]+=0x1;_0x444d6c=_0x3e08c9[_0xbb4c('0x199')];_0x55ca3b=_0x3e08c9[_0xbb4c('0xf0')];ami[_0xbb4c('0x119')](_0xbb4c('0x1b1'),ut[_0xbb4c('0x122')](_0x564fbe,_0xbb4c('0x1b2')));hopperUtils[_0xbb4c('0xeb')](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4a6c32[_0xbb4c('0x18e')](0x14,_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910[_0xbb4c('0x127')]>=_0x3e08c9[_0xbb4c('0x198')]){_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,'reason\x2020\x20agentreject');}else{_0x4a6c32['stateGlobal'](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbb4c('0x1b3'));}}break;default:_0x3e08c9[_0xbb4c('0x138')]+=0x1;_0x4a8910[_0xbb4c('0xd7')]=0xc;_0x4a8910[_0xbb4c('0x72')]=_0xbd9d3a['reason'];_0x444d6c=_0x3e08c9[_0xbb4c('0x199')];_0x55ca3b=_0x3e08c9['callAdditionalPhoneAfterMin'];hopperUtils[_0xbb4c('0xeb')](_0x4a8910)[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x1b4')));if(_0x4a6c32[_0xbb4c('0x18e')](_0xbd9d3a[_0xbb4c('0x19e')],_0x564fbe,_0x3e08c9)&&!_0x514a02){if(_0x4a8910[_0xbb4c('0x124')]+_0x4a8910[_0xbb4c('0x125')]+_0x4a8910[_0xbb4c('0x132')]+_0x4a8910['countnosuchnumberretry']+_0x4a8910['countdropretry']+_0x4a8910[_0xbb4c('0xee')]+_0x4a8910[_0xbb4c('0x12a')]+_0x4a8910[_0xbb4c('0x127')]>=_0x3e08c9[_0xbb4c('0x128')]){_0x4a6c32[_0xbb4c('0x129')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbd9d3a[_0xbb4c('0x19e')]);}else{_0x4a6c32[_0xbb4c('0x12c')](_0x4a8910,_0x3044f9,_0x57e8c9,_0xbd9d3a[_0xbb4c('0x19e')]);}}}})[_0xbb4c('0x3f')](function(){if(_0x514a02){hopperUtils[_0xbb4c('0xec')](_0x4a8910,_0x444d6c,_0x55ca3b)[_0xbb4c('0x3f')](function(){return _0x3044f9(0x1);});}});});};Dialer['prototype'][_0xbb4c('0x129')]=function(_0x30296f,_0x3f27de,_0x51947e,_0x167c64){var _0x223947=new Final(_0x30296f);_0x223947[_0xbb4c('0xd7')]=0xf;_0x223947[_0xbb4c('0x72')]=_0xbb4c('0x1b5');this[_0xbb4c('0x12c')](_0x223947,_0x3f27de,_0x51947e,_0x167c64);};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x12c')]=function(_0x774d51,_0x384adb,_0x5e5100,_0x3c4d94){hopperUtils[_0xbb4c('0xd2')](_0x774d51)['then'](function(){return _0x384adb(msgResponse('[callProgressDetecting]',_0xbb4c('0x10f'),_0x3c4d94));})[_0xbb4c('0xa7')](function(){return _0x5e5100(msgResponse(_0xbb4c('0x1b6'),_0xbb4c('0x9b'),_0xbb4c('0x1b7')));});};Dialer[_0xbb4c('0x1b')][_0xbb4c('0xa')]=function(_0x109f65){var _0x4b30ac=_0x109f65['dialPredictiveOptimizationPercentage']/0x64;var _0x38e6e8=_0x109f65[_0xbb4c('0xd6')]/(_0x109f65[_0xbb4c('0xd6')]+_0x109f65[_0xbb4c('0xcc')]);var _0x53317c=Math[_0xbb4c('0x1b8')](_0x109f65[_0xbb4c('0x1b9')]*(_0x109f65[_0xbb4c('0x1ba')]/0x64));var _0x4b8196=Math[_0xbb4c('0x1b8')](_0x109f65[_0xbb4c('0x1b9')]*(_0x109f65[_0xbb4c('0x1bb')]/0x64));var _0x23c721=_0x109f65[_0xbb4c('0x13e')]+_0x109f65[_0xbb4c('0x140')];var _0xd24ed=Math[_0xbb4c('0x1bc')](_0x109f65[_0xbb4c('0x5a')]*_0x109f65[_0xbb4c('0x5d')]*_0x109f65[_0xbb4c('0x1bd')]*_0x109f65['predictiveIntervalMultiplicativeFactor']);if(_[_0xbb4c('0x41')](_0x109f65['startProgressive'])){if(!_[_0xbb4c('0x41')](_0x109f65[_0xbb4c('0x29')])){_0x109f65['startPredictive']=undefined;loggerPredictive[_0xbb4c('0x69')](_0xbb4c('0x1be'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xbb4c('0x41')](_0x109f65[_0xbb4c('0x67')])){loggerPredictive['error'](_0xbb4c('0x1be'),_0xbb4c('0x1bf'));clearInterval(_0x109f65[_0xbb4c('0x67')]);_0x109f65['handlePredictive']=undefined;}_0x109f65[_0xbb4c('0x63')]=moment()[_0xbb4c('0x81')](_0xbb4c('0xcb'));loggerPredictive['info'](_0x109f65[_0xbb4c('0x45')],_0xbb4c('0x1c0'),_0x109f65[_0xbb4c('0x63')]);this[_0xbb4c('0xb9')](_0x109f65,0x1);}else if(ifInterval(_0x109f65[_0xbb4c('0x1c1')],_0x109f65[_0xbb4c('0x63')])){this[_0xbb4c('0xb9')](_0x109f65,0x1);loggerPredictiveCalls[_0xbb4c('0x48')]('[startMethodPredictive][StartProgressive][Loop]',_0x109f65['startProgressive'],_0x109f65['name']);_0x109f65[_0xbb4c('0x5a')]=0x0;_0x109f65[_0xbb4c('0x1c2')]=0x0;}else if(_0x4b30ac<_0x38e6e8&&_0x109f65[_0xbb4c('0x1c3')]===_0xbb4c('0x1c4')){clearPredictiveAttributes(_0x109f65);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x1c5'),'Dropped\x20calls\x20day',_0x38e6e8,_0xbb4c('0x63'),_0x109f65[_0xbb4c('0x45')]);}else if(_0xd24ed<_0x109f65[_0xbb4c('0x1c2')]&&_0x109f65[_0xbb4c('0x1c3')]===_0xbb4c('0x1c4')){clearPredictiveAttributes(_0x109f65);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xbb4c('0x1c6'),_0xd24ed,_0xbb4c('0x1c7'),_0x109f65[_0xbb4c('0x1c2')],_0xbb4c('0x63'),_0x109f65[_0xbb4c('0x45')]);}else if(!ifInterval(_0x109f65['dialPredictiveInterval'],_0x109f65[_0xbb4c('0x63')])&&_[_0xbb4c('0x41')](_0x109f65[_0xbb4c('0x29')])&&!_[_0xbb4c('0x41')](_0x109f65[_0xbb4c('0x63')])){_0x109f65[_0xbb4c('0x29')]=moment()['format'](_0xbb4c('0xcb'));loggerPredictive[_0xbb4c('0x48')](_0x109f65['name'],_0xbb4c('0x1c8'),_0x109f65[_0xbb4c('0x29')]);hopperUtils['avgHandleTime'](_0x109f65[_0xbb4c('0x1c1')])[_0xbb4c('0x3f')](this[_0xbb4c('0x1c9')](_0x109f65))[_0xbb4c('0x3f')](mergeDataErlangB(_0x109f65))[_0xbb4c('0x3f')](this[_0xbb4c('0x1ca')](_0x109f65))['catch'](loggerCatchPredictive(_0xbb4c('0x1cb'),_0x109f65));}else if(!ifInterval(_0x109f65[_0xbb4c('0x1c1')],_0x109f65[_0xbb4c('0x29')])){_0x109f65[_0xbb4c('0x1c2')]=0x0;_0x109f65[_0xbb4c('0x29')]=moment()[_0xbb4c('0x81')](_0xbb4c('0xcb'));loggerPredictive[_0xbb4c('0x48')](_0x109f65[_0xbb4c('0x45')],'recalculate\x20predictive\x20at',_0x109f65[_0xbb4c('0x29')]);clearInterval(_0x109f65[_0xbb4c('0x67')]);_0x109f65['handlePredictive']=undefined;hopperUtils[_0xbb4c('0x1cc')](_0x109f65[_0xbb4c('0x1c1')])[_0xbb4c('0x3f')](this['getDataPredictive'](_0x109f65))['then'](mergeDataErlangB(_0x109f65))[_0xbb4c('0x3f')](this['startMethodPredictive'](_0x109f65))[_0xbb4c('0xa7')](loggerCatchPredictive(_0xbb4c('0x1cd'),_0x109f65));}else if(_0x109f65[_0xbb4c('0x1b9')]&&_0x23c721<_0x109f65[_0xbb4c('0x1b9')]-_0x4b8196){clearPredictiveAttributes(_0x109f65);loggerPredictive[_0xbb4c('0x48')](_0x109f65[_0xbb4c('0x45')],_0xbb4c('0x1ce'),_0x23c721,')\x20are\x20less\x20than\x20threshold\x20(',_0x109f65['predictiveIntervalAvailable'],'-',_0x4b8196,'=',_0x109f65[_0xbb4c('0x1b9')]-_0x4b8196,')');}else if(_0x109f65['predictiveIntervalAvailable']&&_0x23c721>_0x109f65['predictiveIntervalAvailable']+_0x53317c){clearPredictiveAttributes(_0x109f65);loggerPredictive[_0xbb4c('0x48')](_0x109f65[_0xbb4c('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x23c721,_0xbb4c('0x1cf'),_0x109f65[_0xbb4c('0x1b9')],'+',_0x53317c,'=',_0x109f65[_0xbb4c('0x1b9')]+_0x53317c,')');}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x1c9')]=function(_0x13b8ac){var _0x4f751e=this;return function(_0x4bc57d){return new Promise(function(_0x45b9fa,_0xc363a0){_['merge'](_0x13b8ac,_0x4bc57d[0x0]);if(checkGetDataPredictive(_0x4bc57d[0x0])){var _0xff6bae=_0x13b8ac[_0xbb4c('0x1b9')]=_0x13b8ac[_0xbb4c('0x140')]+_0x13b8ac['available'];var _0x205dbb=_0x13b8ac[_0xbb4c('0x1c1')]*0x3c;var _0x523580=_0x4bc57d[0x0][_0xbb4c('0x54')]+_0x4bc57d[0x0]['predictiveIntervalAvgHoldtime'];var _0x9bb3ac=(_0x4bc57d[0x0]['predictiveIntervalAnsweredCalls']+_0x4bc57d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4bc57d[0x0][_0xbb4c('0x50')])/_0x4bc57d[0x0]['predictiveIntervalTotalCalls'];_0x13b8ac['predictiveIntervalHitRate']=_0x9bb3ac>0x0?_0x9bb3ac:0x1;switch(_0x13b8ac['dialPredictiveOptimization']){case _0xbb4c('0x1c4'):var _0x1f676c=_0x13b8ac[_0xbb4c('0x1d0')]/0x64;return _0x4f751e[_0xbb4c('0x1d1')](_0xff6bae,_0x205dbb,_0x523580,_0x9bb3ac,_0x1f676c)[_0xbb4c('0x3f')](function(_0x5359bc){return _0x45b9fa(_0x5359bc);});case'agentBusyFactor':var _0x4b06ac=_0x13b8ac[_0xbb4c('0x1d0')]/0x64;return _0x4f751e[_0xbb4c('0x1d2')](_0xff6bae,_0x205dbb,_0x523580,_0x9bb3ac,_0x4b06ac)['then'](function(_0x209741){return _0x45b9fa(_0x209741);});default:return _0xc363a0(msgResponse(_0xbb4c('0x1d3'),_0xbb4c('0x9b'),_0xbb4c('0x1d4')));}}else{return _0xc363a0(msgResponse(_0xbb4c('0x1d3'),'Failure',_0xbb4c('0x1d5')));}});};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x1d6')]=function(_0x2d788e){var _0x4ea0a5=this;return function(_0x2a3cb7){return new Promise(function(_0x5b4fdd,_0x172d12){_[_0xbb4c('0x61')](_0x2d788e,_0x2a3cb7[0x0]);if(checkGetDataPredictive(_0x2a3cb7[0x0])){loggerPredictive[_0xbb4c('0x48')](JSON[_0xbb4c('0x77')](_0x2a3cb7[0x0]));if(_0x2d788e['dialPredictiveOptimization']===_0xbb4c('0x1c4')){return _0x4ea0a5[_0xbb4c('0x152')](_0x2d788e['id'])['then'](function(_0x2166a0){var _0x31d8a4=_0x2d788e[_0xbb4c('0x1d7')]-_0x2166a0[0x0][_0xbb4c('0x1d8')];var _0x3415e7=_0x2d788e[_0xbb4c('0x1c1')]*0x3c;var _0x15c730=_0x2a3cb7[0x0][_0xbb4c('0x54')]+_0x2a3cb7[0x0]['predictiveIntervalAvgHoldtime'];var _0x223adf=(_0x2a3cb7[0x0]['predictiveIntervalAnsweredCalls']+_0x2a3cb7[0x0][_0xbb4c('0x4f')]+_0x2a3cb7[0x0][_0xbb4c('0x50')])/_0x2a3cb7[0x0][_0xbb4c('0x4b')];var _0x30c6b0=_0x2d788e[_0xbb4c('0x1d0')]/0x64;_0x2d788e[_0xbb4c('0x1d9')]=_0x2166a0[0x0][_0xbb4c('0x1d8')]||0x0;_0x2d788e[_0xbb4c('0x1bd')]=_0x223adf>0x0?_0x223adf:0x1;return _0x4ea0a5[_0xbb4c('0x1d1')](_0x31d8a4,_0x3415e7,_0x15c730,_0x223adf,_0x30c6b0);})[_0xbb4c('0x3f')](function(_0x5b1847){return _0x5b4fdd(_0x5b1847);})['catch'](function(_0x2a6964){return _0x172d12(msgResponse('[CatchErlangB]',_0xbb4c('0x9b'),JSON[_0xbb4c('0x77')](_0x2a6964)));});}if(_0x2d788e[_0xbb4c('0x1c3')]===_0xbb4c('0x1da')){return _0x4ea0a5['getVoiceQueueRtPauses'](_0x2d788e['id'])[_0xbb4c('0x3f')](function(_0x1a45b6){var _0x2fb4e0=_0x2d788e[_0xbb4c('0x1d7')]-_0x1a45b6[0x0][_0xbb4c('0x1d8')];var _0x1b9bb5=_0x2d788e[_0xbb4c('0x1c1')]*0x3c;var _0x2eed4a=_0x2a3cb7[0x0][_0xbb4c('0x54')]+_0x2a3cb7[0x0][_0xbb4c('0x52')];var _0xa4e857=(_0x2a3cb7[0x0][_0xbb4c('0x4d')]+_0x2a3cb7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2a3cb7[0x0][_0xbb4c('0x50')])/_0x2a3cb7[0x0][_0xbb4c('0x4b')];var _0xd008a5=_0x2d788e[_0xbb4c('0x1d0')]/0x64;_0x2d788e[_0xbb4c('0x1d9')]=_0x1a45b6[0x0][_0xbb4c('0x1d8')]||0x0;_0x2d788e[_0xbb4c('0x1bd')]=_0xa4e857>0x0?_0xa4e857:0x1;return _0x4ea0a5[_0xbb4c('0x1d2')](_0x2fb4e0,_0x1b9bb5,_0x2eed4a,_0xa4e857,_0xd008a5);})['then'](function(_0x5da5af){return _0x5b4fdd(_0x5da5af);})['catch'](function(_0x1b42d9){return _0x172d12(msgResponse(_0xbb4c('0x1db'),_0xbb4c('0x9b'),JSON[_0xbb4c('0x77')](_0x1b42d9)));});}}else{return _0x172d12(msgResponse(_0xbb4c('0x1d3'),_0xbb4c('0x9b'),_0xbb4c('0x1d5')));}});};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x1ca')]=function(_0x3548f4){var _0x4cf1bf=this;return function(){var _0x36c4fd=0x0;var _0x49a96d=Math['floor'](_0x3548f4[_0xbb4c('0x5c')]*0x3e8);if(_0x49a96d>0x0){_0x49a96d=_0x49a96d<0x64?0x64:_0x49a96d;loggerPredictive['info'](_0x3548f4['name'],_0xbb4c('0x1dc'),_0x49a96d,_0xbb4c('0x1dd'));_0x3548f4[_0xbb4c('0x67')]=setInterval(function(){_0x4cf1bf['handlePredictive'](_0x3548f4);loggerPredictiveCalls[_0xbb4c('0x48')](_0xbb4c('0x1de'),_0x36c4fd+=0x1);},_0x49a96d);}else{loggerPredictive[_0xbb4c('0x48')](_0x3548f4['name'],_0xbb4c('0x1df'));}};};Dialer['prototype'][_0xbb4c('0x1e0')]=function(_0x5f2247,_0x56eece){var _0x1c2a9a=this;return function(_0x58dd6a){if(_['isEmpty'](_0x58dd6a)){if(_['isNil'](_0x56eece[_0xbb4c('0x15b')])||!_0x56eece['recallme']){if(_0x5f2247[_0xbb4c('0xb6')]===_0xbb4c('0x9')){_0x5f2247['queueStatusComplete']=_[_0xbb4c('0x41')](_0x5f2247[_0xbb4c('0x75')])?!![]:_0x5f2247[_0xbb4c('0x75')];var _0xc8a52b=uuid['v4']();_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b]=new Action(_0x5f2247,_0x56eece,_0xc8a52b);loggerBooked[_0xbb4c('0x48')](_0xbb4c('0x1e1'),_0xc8a52b,_0xbb4c('0x1e2'),JSON['stringify'](_0x5f2247[_0xbb4c('0x75')]),_0xbb4c('0x1e3'),_0x5f2247[_0xbb4c('0x45')]);if(_0x5f2247[_0xbb4c('0x75')]){_0x5f2247[_0xbb4c('0x75')]=![];_0x1c2a9a[_0xbb4c('0x2b')][_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b]['queue']]=[];ami[_0xbb4c('0xa1')]({'actionid':_0xc8a52b,'action':_0xbb4c('0x1e4'),'queue':_0x5f2247[_0xbb4c('0x45')]})[_0xbb4c('0xa7')](function(){_0x1c2a9a[_0xbb4c('0xc9')](_0x5f2247);hopperUtils[_0xbb4c('0xe3')]({'active':![],'ContactId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b][_0xbb4c('0xe5')],'ListId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b][_0xbb4c('0xe6')],'VoiceQueueId':_0x1c2a9a['actions'][_0xc8a52b][_0xbb4c('0xf3')]||undefined,'CampaignId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b]['CampaignId']||undefined})['catch'](loggerCatch(_0xbb4c('0x1e5')));delete _0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b];});}else{loggerBooked[_0xbb4c('0x48')]('[booked][checkContactBlack][else]',JSON[_0xbb4c('0x77')](_0x5f2247[_0xbb4c('0x75')]),_0xbb4c('0x1e3'),_0x5f2247[_0xbb4c('0x45')]);_0x1c2a9a[_0xbb4c('0xc9')](_0x5f2247);hopperUtils[_0xbb4c('0xe3')]({'active':![],'ContactId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b][_0xbb4c('0xe5')],'ListId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b][_0xbb4c('0xe6')],'VoiceQueueId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b]['VoiceQueueId']||undefined,'CampaignId':_0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b][_0xbb4c('0xe7')]||undefined})['catch'](loggerCatch(_0xbb4c('0x1e5')));delete _0x1c2a9a[_0xbb4c('0x25')][_0xc8a52b];}}else{return _0x1c2a9a[_0xbb4c('0x161')](_0x5f2247,_0x56eece);}}else{if(utils[_0xbb4c('0x62')](undefined,_0x56eece[_0xbb4c('0x1e6')])<_0x5f2247[_0xbb4c('0x1e7')]*0x3c){if(_0x56eece[_0xbb4c('0x15f')]&&!_0x56eece[_0xbb4c('0x15f')]['voicePause']){_0x1c2a9a[_0xbb4c('0x1f')]['run'](_0x56eece['id'])[_0xbb4c('0x1e')](function(){_0x1c2a9a['updateOriginated'](_0x5f2247);});}else{hopperUtils[_0xbb4c('0x1e8')]({'active':![]},_0x56eece['id'],0x1)[_0xbb4c('0x1e')](function(){_0x1c2a9a[_0xbb4c('0xc9')](_0x5f2247);});}}else{_0x5f2247[_0xbb4c('0x1e9')]+=0x1;_0x1c2a9a[_0xbb4c('0xc9')](_0x5f2247);if(_0x5f2247[_0xbb4c('0x1ea')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x56eece['ContactId'],'ListId':_0x56eece['ListId'],'VoiceQueueId':_0x56eece[_0xbb4c('0xf3')]||undefined,'CampaignId':_0x56eece[_0xbb4c('0xe7')]||undefined})[_0xbb4c('0xa7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xbb4c('0xeb')](createObjHistory(_0x5f2247,_0x56eece,utils[_0xbb4c('0x6d')][_0xbb4c('0x1eb')],0x17,_0xbb4c('0x1ec')))[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x1ed')));}else{_0x1c2a9a[_0xbb4c('0x12f')](createObjHistory(_0x5f2247,_0x56eece,utils[_0xbb4c('0x6d')][_0xbb4c('0x1ee')],0x16,_0xbb4c('0x1ef')),_0xbb4c('0x1f0'),_0xbb4c('0x1f1'));}}}}else{_0x5f2247[_0xbb4c('0x1f2')]+=0x1;_0x1c2a9a['saveInDb'](createObjHistory(_0x5f2247,_0x56eece,utils[_0xbb4c('0x6d')][_0xbb4c('0x1f3')],0xd,_0xbb4c('0x1f4')),'[Originate][historyBlacklist]',_0xbb4c('0x1f5'));throw _0xbb4c('0x1f6');}};};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x160')]=function(_0x996893){var _0x29a169=this;var _0xb0c51d=_0x996893[_0xbb4c('0x1f7')]-_0x996893[_0xbb4c('0x154')];emitCampaignSummary(_0x996893);if(_0xb0c51d>0x0&&_0x996893[_0xbb4c('0x6b')]==0x0){if(_0xb0c51d>this['maxNumberOriginate']){_0xb0c51d=this[_0xbb4c('0x24')];}_0x996893[_0xbb4c('0x6b')]=0x1;hopperUtils[_0xbb4c('0x1f8')](_0x996893,_0xb0c51d)[_0xbb4c('0x3f')](function(_0x36a080){_0x996893[_0xbb4c('0x6b')]=0x0;if(_0x36a080){if(!utils[_0xbb4c('0x1f9')](_0x36a080)){_0x996893[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x70')];logger[_0xbb4c('0x48')](_0xbb4c('0x1fa')+_0x996893[_0xbb4c('0x45')]);}else{_0x996893[_0xbb4c('0x154')]+=_0x36a080[_0xbb4c('0x9f')];_0x996893[_0xbb4c('0x6c')]=utils['CAMPAIGN_STATUS'][_0xbb4c('0x1fb')];for(var _0x20d86c=0x0;_0x20d86c<_0x36a080['length'];_0x20d86c+=0x1){_0x996893[_0xbb4c('0x1fc')]+=0x1;if(_['isNil'](_0x36a080[_0x20d86c])||_['isNil'](_0x36a080[_0x20d86c][_0xbb4c('0x1fd')])||_[_0xbb4c('0xfa')](_0x36a080[_0x20d86c][_0xbb4c('0x164')])){_0x29a169['emptyContact'](_0xbb4c('0x1fe'),_0x996893,_0x36a080[_0x20d86c]);}else{hopperUtils[_0xbb4c('0x1ff')](_['pick'](_0x36a080[_0x20d86c],['CampaignId','phone']))[_0xbb4c('0x3f')](_0x29a169['checkContactBlack'](_0x996893,_0x36a080[_0x20d86c]))[_0xbb4c('0xa7')](_0x29a169[_0xbb4c('0x158')](_0xbb4c('0x200'),_0x996893));}}}}})[_0xbb4c('0xa7')](loggerGetContactDialer(_0xbb4c('0x201'),_0x996893,_0xb0c51d));}};Dialer['prototype'][_0xbb4c('0xb9')]=function(_0x20bc4e,_0x35817f){var _0x10b16a=this;var _0x43b635=[];if(_0x35817f<0x1||_0x20bc4e[_0xbb4c('0xb6')]===_0xbb4c('0x9')){_0x35817f=0x1;}var _0x21bdc0=Math[_0xbb4c('0x1bc')](_0x20bc4e[_0xbb4c('0x13e')]*_0x35817f)-_0x20bc4e['originated'];if(_0x20bc4e['dialLimitQueue']>0x0){var _0x2d63cb=_0x20bc4e[_0xbb4c('0x202')]-_0x20bc4e['originated']-_0x20bc4e[_0xbb4c('0x140')]-_0x20bc4e[_0xbb4c('0x141')];if(_0x21bdc0>_0x2d63cb){_0x21bdc0=_0x2d63cb;}}if(_0x21bdc0>0x0&&_0x20bc4e[_0xbb4c('0x6b')]==0x0){if(_0x20bc4e[_0xbb4c('0xb6')]===_0xbb4c('0x9')){_0x21bdc0=0x1;}if(_0x21bdc0>this[_0xbb4c('0x24')]){_0x21bdc0=this[_0xbb4c('0x24')];}for(var _0x3d5510 in this[_0xbb4c('0x22')]){if(typeof this['agents'][_0x3d5510]!==_0xbb4c('0x155')){if(this[_0xbb4c('0x22')][_0x3d5510][_0xbb4c('0xd7')]===_0xbb4c('0x203')&&this[_0xbb4c('0x22')][_0x3d5510][_0xbb4c('0x8d')]===_0xbb4c('0x8e')){_0x43b635[_0xbb4c('0xa0')](this['agents'][_0x3d5510]['id']);}}}_0x20bc4e[_0xbb4c('0x6b')]=0x1;hopperUtils[_0xbb4c('0x204')](_0x20bc4e,_0x43b635,_0x21bdc0)[_0xbb4c('0x3f')](function(_0x2b2f29){_0x20bc4e['temp']=0x0;if(_0x2b2f29){if(!utils[_0xbb4c('0x1f9')](_0x2b2f29)){hopperUtils[_0xbb4c('0x205')](_0x20bc4e)[_0xbb4c('0x3f')](sendMessageReschedule(_0x20bc4e))[_0xbb4c('0xa7')](loggerCatch(_0xbb4c('0x206')));}else{_0x20bc4e[_0xbb4c('0x154')]+=_0x2b2f29[_0xbb4c('0x9f')];_0x20bc4e['message']=_0x20bc4e[_0xbb4c('0xb6')]===_0xbb4c('0x9')?utils[_0xbb4c('0x6d')][_0xbb4c('0x142')]:utils[_0xbb4c('0x6d')][_0xbb4c('0x1fb')];for(var _0x18dcb4=0x0;_0x18dcb4<_0x2b2f29[_0xbb4c('0x9f')];_0x18dcb4+=0x1){if(_[_0xbb4c('0xfa')](_0x2b2f29[_0x18dcb4])||_['isNil'](_0x2b2f29[_0x18dcb4][_0xbb4c('0x1fd')])||_[_0xbb4c('0xfa')](_0x2b2f29[_0x18dcb4][_0xbb4c('0x164')])){_0x10b16a[_0xbb4c('0x159')](_0xbb4c('0x1fe'),_0x20bc4e,_0x2b2f29[_0x18dcb4]);}else{hopperUtils['checkIsBlackList'](_[_0xbb4c('0x78')](_0x2b2f29[_0x18dcb4],[_0xbb4c('0xf3'),_0xbb4c('0x164')]))['then'](_0x10b16a[_0xbb4c('0x1e0')](_0x20bc4e,_0x2b2f29[_0x18dcb4]))[_0xbb4c('0xa7')](_0x10b16a[_0xbb4c('0x158')](_0xbb4c('0x1fe'),_0x20bc4e));}}}}})[_0xbb4c('0xa7')](loggerGetContactDialer(_0xbb4c('0x207'),_0x20bc4e,_0x21bdc0));}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x67')]=function(_0x3b58d6){if(_0x3b58d6['dialLimitQueue']>0x0){var _0x34a620=_0x3b58d6[_0xbb4c('0x202')]-_0x3b58d6[_0xbb4c('0x154')]-_0x3b58d6[_0xbb4c('0x140')];if(_0x34a620>0x0&&_0x3b58d6[_0xbb4c('0x6b')]==0x0){this['tryOriginatePredictive'](_0x3b58d6);}else{loggerPredictiveCalls[_0xbb4c('0x48')](_0xbb4c('0x208'));}}else{this[_0xbb4c('0x209')](_0x3b58d6);}};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x209')]=function(_0x5bf84a){var _0x57babf=this;var _0x2b738d=[];_0x5bf84a['originated']+=0x1;for(var _0x56c8ba in this[_0xbb4c('0x22')]){if(typeof this[_0xbb4c('0x22')][_0x56c8ba]!=='undefined'){if(this[_0xbb4c('0x22')][_0x56c8ba][_0xbb4c('0xd7')]===_0xbb4c('0x203')&&this[_0xbb4c('0x22')][_0x56c8ba]['status']==='reachable'){_0x2b738d[_0xbb4c('0xa0')](this[_0xbb4c('0x22')][_0x56c8ba]['id']);}}}_0x5bf84a[_0xbb4c('0x6b')]=0x1;return this[_0xbb4c('0x204')](_0x5bf84a['id'],_0x2b738d,0x1,_0x5bf84a[_0xbb4c('0x20a')],_0x5bf84a)[_0xbb4c('0x3f')](function(_0x156d21){_0x5bf84a[_0xbb4c('0x6b')]=0x1;if(_0x156d21){if(!utils[_0xbb4c('0x1f9')](_0x156d21)){utils[_0xbb4c('0x20b')](_0x5bf84a,0x1,0x0);return hopperUtils['countReScheduled'](_0x5bf84a)[_0xbb4c('0x3f')](sendMessageReschedule(_0x5bf84a))['catch'](loggerCatch(_0xbb4c('0x206')));}else{_0x5bf84a[_0xbb4c('0x6c')]=utils[_0xbb4c('0x6d')][_0xbb4c('0x1fb')];if(_[_0xbb4c('0xfa')](_0x156d21[0x0])||_[_0xbb4c('0xfa')](_0x156d21[0x0][_0xbb4c('0x1fd')])||_['isNil'](_0x156d21[0x0][_0xbb4c('0x164')])){_0x57babf['emptyContact'](_0xbb4c('0x1fe'),_0x5bf84a,_0x156d21[0x0]);}else{return hopperUtils[_0xbb4c('0x20c')](_[_0xbb4c('0x78')](_0x156d21[0x0],['VoiceQueueId',_0xbb4c('0x164')]))[_0xbb4c('0x3f')](_0x57babf[_0xbb4c('0x1e0')](_0x5bf84a,_0x156d21[0x0]))[_0xbb4c('0xa7')](_0x57babf[_0xbb4c('0x158')](_0xbb4c('0x20d'),_0x5bf84a));}}}})['catch'](loggerGetContactDialer(_0xbb4c('0x20e'),_0x5bf84a,0x1));};Dialer[_0xbb4c('0x1b')]['abandonmentRate']=function(_0x5d0263,_0x5655c2,_0xba540d,_0x2c23f5,_0x251d9d,_0x34dd7e){loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x20f'));loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x210'),_0x5d0263);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x211'),_0x5655c2);loggerPredictive['info'](_0xbb4c('0x212'),_0xba540d);loggerPredictive[_0xbb4c('0x48')]('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',_0x2c23f5);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x213'),_0x251d9d);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x55'));return new Promise(function(_0x3e9ce1,_0x336cb9){if(_0x5d0263<=0x0||isNaN(_0x5d0263)){return _0x336cb9(msgResponse('[abandonmentRate]',_0xbb4c('0x89'),_0xbb4c('0x214')+_0x5d0263));}if(_0xba540d<=0x0||isNaN(_0xba540d)){return _0x336cb9(msgResponse(_0xbb4c('0x215'),_0xbb4c('0x89'),'Ts\x20=\x20'+_0xba540d));}if(_0x2c23f5<=0x0||isNaN(_0x2c23f5)){return _0x336cb9(msgResponse(_0xbb4c('0x215'),_0xbb4c('0x89'),'p\x20=\x20'+_0x2c23f5));}if(_0x5655c2<=0x0||isNaN(_0x5655c2)){return _0x336cb9(msgResponse(_0xbb4c('0x215'),_0xbb4c('0x89'),_0xbb4c('0x216')+_0x5655c2));}if(_0x251d9d<=0x0||isNaN(_0x251d9d)){return _0x336cb9(msgResponse(_0xbb4c('0x215'),_0xbb4c('0x89'),_0xbb4c('0x217')+_0x251d9d));}_0x34dd7e=_0x34dd7e||0x0;var _0x2e8597=0x1/_0xba540d;var _0x2471b1=0x0;var _0x1209f8=0x0;var _0x1921df=0x0;var _0x256eeb=0x0;for(var _0x45427e=0x0;_0x1921df<_0x251d9d;_0x45427e+=0x1){_0x1209f8=_0x45427e/_0x5655c2;_0x2471b1=(_0x2c23f5*_0x1209f8+_0x34dd7e)/_0x2e8597;_0x1921df=utils[_0xbb4c('0x218')](_0x2471b1,_0x5d0263);_0x256eeb=_0x2471b1/_0x5d0263*(0x1-utils[_0xbb4c('0x218')](_0x2471b1,_0x5d0263));}return _0x3e9ce1({'erlangCalls':_0x45427e,'erlangCallToSecond':_0x5655c2/_0x45427e,'erlangAbandonmentRate':_0x1921df,'erlangBusyFactor':_0x256eeb});});};Dialer[_0xbb4c('0x1b')][_0xbb4c('0x1d2')]=function(_0x580696,_0x459dbc,_0x15cdf8,_0x2f72d0,_0x1ffcd7,_0x4dd9aa){loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x219'));loggerPredictive['info'](_0xbb4c('0x210'),_0x580696);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x211'),_0x459dbc);loggerPredictive[_0xbb4c('0x48')]('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',_0x15cdf8);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x21a'),_0x2f72d0);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x21b'),_0x1ffcd7);loggerPredictive[_0xbb4c('0x48')](_0xbb4c('0x55'));return new Promise(function(_0x252366,_0x1c207b){if(_0x580696<=0x0||isNaN(_0x580696)){return _0x1c207b(msgResponse(_0xbb4c('0x21c'),'Error','m\x20=\x20'+_0x580696));}if(_0x15cdf8<=0x0||isNaN(_0x15cdf8)){return _0x1c207b(msgResponse(_0xbb4c('0x21c'),'Error','Ts\x20=\x20'+_0x15cdf8));}if(_0x2f72d0<=0x0||isNaN(_0x2f72d0)){return _0x1c207b(msgResponse(_0xbb4c('0x21c'),'Error',_0xbb4c('0x21d')+_0x2f72d0));}if(_0x459dbc<=0x0||isNaN(_0x459dbc)){return _0x1c207b(msgResponse(_0xbb4c('0x21c'),_0xbb4c('0x89'),_0xbb4c('0x216')+_0x459dbc));}if(_0x1ffcd7<=0x0||isNaN(_0x1ffcd7)){return _0x1c207b(msgResponse('[busyFactor]',_0xbb4c('0x89'),_0xbb4c('0x21e')+_0x1ffcd7));}_0x4dd9aa=_0x4dd9aa||0x0;var _0x48d272=0x1/_0x15cdf8;var _0x29f9b2=0x0;var _0x2b450b=0x0;var _0x25c639=0x0;var _0x21fc5c=0x0;for(var _0x4fc64b=0x0;_0x21fc5c<_0x1ffcd7;_0x4fc64b+=0x1){_0x2b450b=_0x4fc64b/_0x459dbc;_0x29f9b2=(_0x2f72d0*_0x2b450b+_0x4dd9aa)/_0x48d272;_0x25c639=utils['erlangb'](_0x29f9b2,_0x580696);_0x21fc5c=_0x29f9b2/_0x580696*(0x1-utils[_0xbb4c('0x218')](_0x29f9b2,_0x580696));}return _0x252366({'erlangCalls':_0x4fc64b,'erlangCallToSecond':_0x459dbc/_0x4fc64b,'erlangAbandonmentRate':_0x25c639,'erlangBusyFactor':_0x21fc5c});});};module[_0xbb4c('0x21f')]=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 4f1f4e9..d6b895b 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 _0x0187=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','isNil','string','uniqueid','name','Contact','phone','number'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0187,0x189));var _0x7018=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x0187[_0x548627];return _0x844a84;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4f065,_0x33a2a2,_0x5303fc){var _0x355029='';if(!_[_0x7018('0x0')](_0x33a2a2)&&_0x7018('0x1')===typeof _0x33a2a2){_0x355029+=_0x33a2a2;}if(!_['isNil'](_0x5303fc)&&_0x7018('0x1')===typeof _0x5303fc){_0x355029+='\x20'+_0x5303fc;}if(_0x355029!==''){return _0x355029;}return _0x4f065;}function Action(_0x5e4d04,_0x2e0a8e,_0x225e96){this['voiceQueue']=_0x5e4d04;this[_0x7018('0x2')]=_0x225e96||undefined;this[_0x7018('0x3')]=checkNameSurname(_0x2e0a8e[_0x7018('0x4')][_0x7018('0x5')],_0x2e0a8e[_0x7018('0x4')]['firstName'],_0x2e0a8e[_0x7018('0x4')]['lastName']);this[_0x7018('0x6')]=_0x2e0a8e[_0x7018('0x5')];this['queue']=_0x5e4d04['name'];this[_0x7018('0x7')]=_0x2e0a8e[_0x7018('0x7')]||![];this[_0x7018('0x8')]=_0x5e4d04[_0x7018('0x8')];this[_0x7018('0x9')]=_0x5e4d04['dialQueueTimeout']||0x3;this[_0x7018('0xa')]=_0x2e0a8e[_0x7018('0xa')];this[_0x7018('0xb')]=_0x2e0a8e[_0x7018('0xb')];this[_0x7018('0xc')]=_0x2e0a8e[_0x7018('0xc')];this[_0x7018('0xd')]=_0x2e0a8e[_0x7018('0xd')];this['countnosuchnumberretry']=_0x2e0a8e[_0x7018('0xe')];this[_0x7018('0xf')]=_0x2e0a8e['countdropretry'];this['countabandonedretry']=_0x2e0a8e['countabandonedretry'];this[_0x7018('0x10')]=_0x2e0a8e[_0x7018('0x10')];this[_0x7018('0x11')]=_0x2e0a8e[_0x7018('0x11')];this[_0x7018('0x12')]=_0x2e0a8e['ContactId'];this[_0x7018('0x13')]=_0x2e0a8e[_0x7018('0x13')];this[_0x7018('0x14')]=_0x2e0a8e['UserId'];this['VoiceQueueId']=_0x2e0a8e[_0x7018('0x15')];this['CampaignId']=_0x2e0a8e[_0x7018('0x16')];this[_0x7018('0x17')]=_0x2e0a8e['id'];this[_0x7018('0x18')]=_0x2e0a8e[_0x7018('0x4')][_0x7018('0x19')]||'';this[_0x7018('0x1a')]=moment()[_0x7018('0x1b')](_0x7018('0x1c'));this[_0x7018('0x1d')]=_0x2e0a8e[_0x7018('0x1d')];this[_0x7018('0x1e')]=_0x2e0a8e[_0x7018('0x1e')];this[_0x7018('0x1f')]=_0x2e0a8e[_0x7018('0x1f')];this[_0x7018('0x20')]=_0x2e0a8e['recallme'];this['originatecalleridnum']='';this[_0x7018('0x21')]='';}Action[_0x7018('0x22')][_0x7018('0x23')]=function(){return util[_0x7018('0x1b')]('\x22%s\x22\x20<%s>',this[_0x7018('0x3')],this['voiceQueue'][_0x7018('0x24')]>0x0?this['number'][_0x7018('0x25')](this['voiceQueue'][_0x7018('0x24')]):this[_0x7018('0x6')]);};Action[_0x7018('0x22')][_0x7018('0x26')]=function(){return this['queue'];};module[_0x7018('0x27')]=Action; \ No newline at end of file +var _0x459b=['voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x459b,0x191));var _0xb459=function(_0x2dcb2a,_0x2e436b){_0x2dcb2a=_0x2dcb2a-0x0;var _0x34feb0=_0x459b[_0x2dcb2a];return _0x34feb0;};'use strict';var util=require(_0xb459('0x0'));var _=require('lodash');var moment=require(_0xb459('0x1'));function checkNameSurname(_0x3e45ab,_0x397239,_0x3b294f){var _0x517faf='';if(!_[_0xb459('0x2')](_0x397239)&&_0xb459('0x3')===typeof _0x397239){_0x517faf+=_0x397239;}if(!_[_0xb459('0x2')](_0x3b294f)&&_0xb459('0x3')===typeof _0x3b294f){_0x517faf+='\x20'+_0x3b294f;}if(_0x517faf!==''){return _0x517faf;}return _0x3e45ab;}function Action(_0x34a68c,_0x456dcf,_0x5f5919){this[_0xb459('0x4')]=_0x34a68c;this[_0xb459('0x5')]=_0x5f5919||undefined;this[_0xb459('0x6')]=checkNameSurname(_0x456dcf[_0xb459('0x7')][_0xb459('0x8')],_0x456dcf['Contact'][_0xb459('0x9')],_0x456dcf[_0xb459('0x7')][_0xb459('0xa')]);this[_0xb459('0xb')]=_0x456dcf[_0xb459('0x8')];this['queue']=_0x34a68c[_0xb459('0x6')];this['active']=_0x456dcf['active']||![];this[_0xb459('0xc')]=_0x34a68c[_0xb459('0xc')];this[_0xb459('0xd')]=_0x34a68c[_0xb459('0xd')]||0x3;this[_0xb459('0xe')]=_0x456dcf[_0xb459('0xe')];this[_0xb459('0xf')]=_0x456dcf[_0xb459('0xf')];this[_0xb459('0x10')]=_0x456dcf['countcongestionretry'];this[_0xb459('0x11')]=_0x456dcf['countnoanswerretry'];this[_0xb459('0x12')]=_0x456dcf[_0xb459('0x12')];this[_0xb459('0x13')]=_0x456dcf[_0xb459('0x13')];this[_0xb459('0x14')]=_0x456dcf['countabandonedretry'];this[_0xb459('0x15')]=_0x456dcf['countmachineretry'];this['countagentrejectretry']=_0x456dcf[_0xb459('0x16')];this[_0xb459('0x17')]=_0x456dcf['ContactId'];this[_0xb459('0x18')]=_0x456dcf[_0xb459('0x18')];this[_0xb459('0x19')]=_0x456dcf['UserId'];this[_0xb459('0x1a')]=_0x456dcf[_0xb459('0x1a')];this['CampaignId']=_0x456dcf[_0xb459('0x1b')];this[_0xb459('0x1c')]=_0x456dcf['id'];this[_0xb459('0x1d')]=_0x456dcf[_0xb459('0x7')][_0xb459('0x9')]||'';this[_0xb459('0x1e')]=moment()[_0xb459('0x1f')](_0xb459('0x20'));this[_0xb459('0x21')]=_0x456dcf[_0xb459('0x21')];this['callbackuniqueid']=_0x456dcf[_0xb459('0x22')];this[_0xb459('0x23')]=_0x456dcf[_0xb459('0x23')];this[_0xb459('0x24')]=_0x456dcf['recallme'];this[_0xb459('0x25')]='';this[_0xb459('0x26')]='';}Action[_0xb459('0x27')]['getCaller']=function(){return util[_0xb459('0x1f')]('\x22%s\x22\x20<%s>',this[_0xb459('0x6')],this['voiceQueue'][_0xb459('0x28')]>0x0?this['number'][_0xb459('0x29')](this[_0xb459('0x4')][_0xb459('0x28')]):this['number']);};Action['prototype'][_0xb459('0x2a')]=function(){return this[_0xb459('0x2b')];};module[_0xb459('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 498fe0e..728a5dd 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 _0x99cc=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0x65aa2a,_0x22967c){var _0x257190=function(_0x50aab4){while(--_0x50aab4){_0x65aa2a['push'](_0x65aa2a['shift']());}};_0x257190(++_0x22967c);}(_0x99cc,0x1f1));var _0xc99c=function(_0x2c43a1,_0x41b272){_0x2c43a1=_0x2c43a1-0x0;var _0x20ea80=_0x99cc[_0x2c43a1];return _0x20ea80;};'use strict';var moment=require(_0xc99c('0x0'));var utils=require('../utils');function AgentComplete(_0x2e567e,_0x5e1f58){this[_0xc99c('0x1')]=0x4;this[_0xc99c('0x2')]=_0xc99c('0x3');this['scheduledat']=_0x2e567e[_0xc99c('0x4')];this['type']=_0x2e567e['type'];this[_0xc99c('0x5')]=_0x2e567e[_0xc99c('0x6')]===_0xc99c('0x7')?_0xc99c('0x8'):_0x2e567e[_0xc99c('0x6')];this[_0xc99c('0x9')]=_0x2e567e[_0xc99c('0x9')];this[_0xc99c('0xa')]=_0x2e567e[_0xc99c('0xa')];this[_0xc99c('0xb')]=_0x2e567e[_0xc99c('0xb')];this[_0xc99c('0xc')]=_0x2e567e['countbusyretry']+_0x2e567e[_0xc99c('0xa')]+_0x2e567e[_0xc99c('0xb')]+_0x2e567e['countnosuchnumberretry']+_0x2e567e[_0xc99c('0xd')]+_0x2e567e[_0xc99c('0xe')]+_0x2e567e[_0xc99c('0xf')]+_0x2e567e['countagentrejectretry'];this[_0xc99c('0x10')]=_0x2e567e[_0xc99c('0x10')];this[_0xc99c('0xd')]=_0x2e567e[_0xc99c('0xd')];this[_0xc99c('0xe')]=_0x2e567e[_0xc99c('0xe')];this[_0xc99c('0xf')]=_0x2e567e[_0xc99c('0xf')];this[_0xc99c('0x11')]=_0x2e567e['countagentrejectretry'];this[_0xc99c('0x12')]=_0x5e1f58[_0xc99c('0x12')];this[_0xc99c('0x13')]=_0x2e567e[_0xc99c('0x14')];this[_0xc99c('0x15')]=_0x2e567e[_0xc99c('0x16')];this['starttime']=_0x2e567e[_0xc99c('0x17')];this[_0xc99c('0x18')]=_0x2e567e['responsetime'];this[_0xc99c('0x19')]=_0x2e567e[_0xc99c('0x19')];this[_0xc99c('0x1a')]=moment()[_0xc99c('0x1b')](_0xc99c('0x1c'));this[_0xc99c('0x1d')]=utils[_0xc99c('0x1e')](_0x2e567e[_0xc99c('0x18')],_0x2e567e[_0xc99c('0x17')]);this[_0xc99c('0x1f')]=utils['getSeconds'](_0x2e567e[_0xc99c('0x19')],_0x2e567e[_0xc99c('0x18')]);this[_0xc99c('0x20')]=utils[_0xc99c('0x1e')](this[_0xc99c('0x1a')],_0x2e567e[_0xc99c('0x19')]);this['queue']=_0x5e1f58['queue'];this[_0xc99c('0x21')]=_0x5e1f58['membername'];this[_0xc99c('0x22')]=_0x5e1f58[_0xc99c('0x22')];this[_0xc99c('0x23')]=_0x2e567e[_0xc99c('0x23')];this[_0xc99c('0x24')]=_0x2e567e[_0xc99c('0x24')];this[_0xc99c('0x25')]=_0x2e567e['callbackat'];this[_0xc99c('0x26')]=_0x2e567e[_0xc99c('0x26')];this['ContactId']=_0x2e567e[_0xc99c('0x27')];this[_0xc99c('0x28')]=_0x2e567e[_0xc99c('0x28')];this[_0xc99c('0x29')]=_0x2e567e[_0xc99c('0x29')];this[_0xc99c('0x2a')]=_0x2e567e[_0xc99c('0x2a')];this[_0xc99c('0x2b')]=_0x2e567e[_0xc99c('0x2b')];this[_0xc99c('0x2c')]=_0x2e567e['originatecalleridnum']||'';this[_0xc99c('0x2d')]=_0x2e567e[_0xc99c('0x2d')]||'';this[_0xc99c('0x2e')]=_0x2e567e[_0xc99c('0x2e')];}module[_0xc99c('0x2f')]=AgentComplete; \ No newline at end of file +var _0x92c7=['exports','moment','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x38a045,_0x402d6b){var _0x45c34c=function(_0x2bde36){while(--_0x2bde36){_0x38a045['push'](_0x38a045['shift']());}};_0x45c34c(++_0x402d6b);}(_0x92c7,0xb9));var _0x792c=function(_0x132817,_0x3dae29){_0x132817=_0x132817-0x0;var _0x3ed068=_0x92c7[_0x132817];return _0x3ed068;};'use strict';var moment=require(_0x792c('0x0'));var utils=require('../utils');function AgentComplete(_0x3a988e,_0x24427c){this[_0x792c('0x1')]=0x4;this['statedesc']=_0x792c('0x2');this[_0x792c('0x3')]=_0x3a988e[_0x792c('0x3')];this[_0x792c('0x4')]=_0x3a988e['type'];this[_0x792c('0x5')]=_0x3a988e[_0x792c('0x4')]===_0x792c('0x6')?_0x792c('0x7'):_0x3a988e[_0x792c('0x4')];this[_0x792c('0x8')]=_0x3a988e['countbusyretry'];this[_0x792c('0x9')]=_0x3a988e[_0x792c('0x9')];this[_0x792c('0xa')]=_0x3a988e['countnoanswerretry'];this[_0x792c('0xb')]=_0x3a988e[_0x792c('0x8')]+_0x3a988e['countcongestionretry']+_0x3a988e['countnoanswerretry']+_0x3a988e['countnosuchnumberretry']+_0x3a988e[_0x792c('0xc')]+_0x3a988e[_0x792c('0xd')]+_0x3a988e[_0x792c('0xe')]+_0x3a988e[_0x792c('0xf')];this[_0x792c('0x10')]=_0x3a988e[_0x792c('0x10')];this[_0x792c('0xc')]=_0x3a988e['countdropretry'];this[_0x792c('0xd')]=_0x3a988e[_0x792c('0xd')];this['countmachineretry']=_0x3a988e[_0x792c('0xe')];this['countagentrejectretry']=_0x3a988e[_0x792c('0xf')];this[_0x792c('0x11')]=_0x24427c[_0x792c('0x11')];this[_0x792c('0x12')]=_0x3a988e[_0x792c('0x13')];this[_0x792c('0x14')]=_0x3a988e['number'];this[_0x792c('0x15')]=_0x3a988e[_0x792c('0x15')];this[_0x792c('0x16')]=_0x3a988e[_0x792c('0x16')];this[_0x792c('0x17')]=_0x3a988e[_0x792c('0x17')];this[_0x792c('0x18')]=moment()[_0x792c('0x19')](_0x792c('0x1a'));this[_0x792c('0x1b')]=utils[_0x792c('0x1c')](_0x3a988e['responsetime'],_0x3a988e[_0x792c('0x15')]);this[_0x792c('0x1d')]=utils[_0x792c('0x1c')](_0x3a988e[_0x792c('0x17')],_0x3a988e[_0x792c('0x16')]);this[_0x792c('0x1e')]=utils[_0x792c('0x1c')](this[_0x792c('0x18')],_0x3a988e[_0x792c('0x17')]);this[_0x792c('0x7')]=_0x24427c[_0x792c('0x7')];this[_0x792c('0x1f')]=_0x24427c['membername'];this['reason']=_0x24427c[_0x792c('0x20')];this['callback']=_0x3a988e[_0x792c('0x21')];this[_0x792c('0x22')]=_0x3a988e[_0x792c('0x22')];this[_0x792c('0x23')]=_0x3a988e[_0x792c('0x23')];this['recallme']=_0x3a988e[_0x792c('0x24')];this[_0x792c('0x25')]=_0x3a988e[_0x792c('0x25')];this[_0x792c('0x26')]=_0x3a988e[_0x792c('0x26')];this[_0x792c('0x27')]=_0x3a988e[_0x792c('0x27')];this['VoiceQueueId']=_0x3a988e[_0x792c('0x28')];this[_0x792c('0x29')]=_0x3a988e[_0x792c('0x29')];this[_0x792c('0x2a')]=_0x3a988e[_0x792c('0x2a')]||'';this[_0x792c('0x2b')]=_0x3a988e[_0x792c('0x2b')]||'';this[_0x792c('0x2c')]=_0x3a988e[_0x792c('0x2c')];}module[_0x792c('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 e1459f7..334fa6d 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 _0xf40b=['countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xf40b,0x18f));var _0xbf40=function(_0x4cd226,_0x489a22){_0x4cd226=_0x4cd226-0x0;var _0x19c008=_0xf40b[_0x4cd226];return _0x19c008;};'use strict';function Final(_0x4fd8a0){this[_0xbf40('0x0')]=_0x4fd8a0['uniqueid'];this[_0xbf40('0x1')]=_0x4fd8a0[_0xbf40('0x1')];this[_0xbf40('0x2')]=_0x4fd8a0[_0xbf40('0x2')];this['campaigntype']=_0x4fd8a0[_0xbf40('0x2')]===_0xbf40('0x3')?'queue':_0x4fd8a0['type'];this[_0xbf40('0x4')]=_0x4fd8a0[_0xbf40('0x4')];this[_0xbf40('0x5')]=_0x4fd8a0['countcongestionretry'];this[_0xbf40('0x6')]=_0x4fd8a0[_0xbf40('0x6')];this['countglobal']=_0x4fd8a0[_0xbf40('0x4')]+_0x4fd8a0[_0xbf40('0x5')]+_0x4fd8a0[_0xbf40('0x6')]+_0x4fd8a0[_0xbf40('0x7')]+_0x4fd8a0[_0xbf40('0x8')]+_0x4fd8a0['countabandonedretry']+_0x4fd8a0['countmachineretry']+_0x4fd8a0['countagentrejectretry'];this[_0xbf40('0x7')]=_0x4fd8a0[_0xbf40('0x7')];this[_0xbf40('0x8')]=_0x4fd8a0[_0xbf40('0x8')];this[_0xbf40('0x9')]=_0x4fd8a0[_0xbf40('0x9')];this[_0xbf40('0xa')]=_0x4fd8a0[_0xbf40('0xa')];this[_0xbf40('0xb')]=_0x4fd8a0[_0xbf40('0xb')];this[_0xbf40('0xc')]=_0x4fd8a0['queue'];this['calleridname']=_0x4fd8a0[_0xbf40('0xd')];this['calleridnum']=_0x4fd8a0[_0xbf40('0xe')];this[_0xbf40('0xf')]=_0x4fd8a0['starttime'];this[_0xbf40('0x10')]=_0x4fd8a0['responsetime'];this[_0xbf40('0x11')]=_0x4fd8a0[_0xbf40('0x10')];this['ringtime']=_0x4fd8a0[_0xbf40('0x12')]||0x0;this[_0xbf40('0x13')]=_0x4fd8a0[_0xbf40('0x13')]||0x0;this[_0xbf40('0x14')]=_0x4fd8a0[_0xbf40('0x14')]||0x0;this[_0xbf40('0x15')]=_0x4fd8a0[_0xbf40('0x15')];this[_0xbf40('0x16')]=_0x4fd8a0[_0xbf40('0x16')];this['callbackat']=_0x4fd8a0['callbackat'];this[_0xbf40('0x17')]=_0x4fd8a0[_0xbf40('0x17')];this[_0xbf40('0x18')]=_0x4fd8a0[_0xbf40('0x18')];this[_0xbf40('0x19')]=_0x4fd8a0[_0xbf40('0x19')];this[_0xbf40('0x1a')]=_0x4fd8a0['UserId'];this[_0xbf40('0x1b')]=_0x4fd8a0[_0xbf40('0x1b')];this['CampaignId']=_0x4fd8a0[_0xbf40('0x1c')];this['originatecalleridnum']=_0x4fd8a0[_0xbf40('0x1d')]||'';this[_0xbf40('0x1e')]=_0x4fd8a0['originatecalleridname']||'';this['state']=_0x4fd8a0[_0xbf40('0x1f')];this[_0xbf40('0x20')]=_0x4fd8a0[_0xbf40('0x20')];}module[_0xbf40('0x21')]=Final; \ No newline at end of file +var _0x90b7=['statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x90b7,0x174));var _0x790b=function(_0x107bbf,_0x36f459){_0x107bbf=_0x107bbf-0x0;var _0x1daf97=_0x90b7[_0x107bbf];return _0x1daf97;};'use strict';function Final(_0xd698ad){this[_0x790b('0x0')]=_0xd698ad[_0x790b('0x0')];this[_0x790b('0x1')]=_0xd698ad[_0x790b('0x1')];this[_0x790b('0x2')]=_0xd698ad[_0x790b('0x2')];this[_0x790b('0x3')]=_0xd698ad[_0x790b('0x2')]===_0x790b('0x4')?_0x790b('0x5'):_0xd698ad[_0x790b('0x2')];this[_0x790b('0x6')]=_0xd698ad[_0x790b('0x6')];this[_0x790b('0x7')]=_0xd698ad[_0x790b('0x7')];this[_0x790b('0x8')]=_0xd698ad[_0x790b('0x8')];this[_0x790b('0x9')]=_0xd698ad[_0x790b('0x6')]+_0xd698ad[_0x790b('0x7')]+_0xd698ad['countnoanswerretry']+_0xd698ad['countnosuchnumberretry']+_0xd698ad[_0x790b('0xa')]+_0xd698ad['countabandonedretry']+_0xd698ad[_0x790b('0xb')]+_0xd698ad[_0x790b('0xc')];this[_0x790b('0xd')]=_0xd698ad[_0x790b('0xd')];this[_0x790b('0xa')]=_0xd698ad[_0x790b('0xa')];this[_0x790b('0xe')]=_0xd698ad[_0x790b('0xe')];this[_0x790b('0xb')]=_0xd698ad[_0x790b('0xb')];this[_0x790b('0xc')]=_0xd698ad[_0x790b('0xc')];this[_0x790b('0x5')]=_0xd698ad[_0x790b('0x5')];this[_0x790b('0xf')]=_0xd698ad[_0x790b('0xf')];this[_0x790b('0x10')]=_0xd698ad[_0x790b('0x10')];this[_0x790b('0x11')]=_0xd698ad[_0x790b('0x11')];this[_0x790b('0x12')]=_0xd698ad[_0x790b('0x12')];this[_0x790b('0x13')]=_0xd698ad[_0x790b('0x12')];this[_0x790b('0x14')]=_0xd698ad[_0x790b('0x14')]||0x0;this[_0x790b('0x15')]=_0xd698ad['holdtime']||0x0;this[_0x790b('0x16')]=_0xd698ad[_0x790b('0x16')]||0x0;this[_0x790b('0x17')]=_0xd698ad[_0x790b('0x17')];this[_0x790b('0x18')]=_0xd698ad[_0x790b('0x18')];this[_0x790b('0x19')]=_0xd698ad[_0x790b('0x19')];this[_0x790b('0x1a')]=_0xd698ad['recallme'];this[_0x790b('0x1b')]=_0xd698ad[_0x790b('0x1b')];this[_0x790b('0x1c')]=_0xd698ad[_0x790b('0x1c')];this[_0x790b('0x1d')]=_0xd698ad[_0x790b('0x1d')];this[_0x790b('0x1e')]=_0xd698ad['VoiceQueueId'];this[_0x790b('0x1f')]=_0xd698ad[_0x790b('0x1f')];this[_0x790b('0x20')]=_0xd698ad[_0x790b('0x20')]||'';this[_0x790b('0x21')]=_0xd698ad[_0x790b('0x21')]||'';this['state']=_0xd698ad[_0x790b('0x22')];this[_0x790b('0x23')]=_0xd698ad[_0x790b('0x23')];}module[_0x790b('0x24')]=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 c7a8fab..3e8112e 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 _0x4863=['queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x4863,0x17d));var _0x3486=function(_0x118e79,_0x1e2497){_0x118e79=_0x118e79-0x0;var _0x14362e=_0x4863[_0x118e79];return _0x14362e;};'use strict';var moment=require(_0x3486('0x0'));var utils=require(_0x3486('0x1'));function Hangup(_0xc5c585,_0x2e2ec7){this[_0x3486('0x2')]=0x4;this[_0x3486('0x3')]=_0x3486('0x4');this[_0x3486('0x5')]=_0xc5c585[_0x3486('0x5')];this['type']=_0xc5c585[_0x3486('0x6')];this[_0x3486('0x7')]=_0xc5c585['type']===_0x3486('0x8')?_0x3486('0x9'):_0xc5c585[_0x3486('0x6')];this[_0x3486('0xa')]=_0xc5c585[_0x3486('0xa')]||![];this['countbusyretry']=_0xc5c585[_0x3486('0xb')];this[_0x3486('0xc')]=_0xc5c585[_0x3486('0xc')];this[_0x3486('0xd')]=_0xc5c585[_0x3486('0xd')];this[_0x3486('0xe')]=_0xc5c585[_0x3486('0xb')]+_0xc5c585[_0x3486('0xc')]+_0xc5c585[_0x3486('0xd')]+_0xc5c585[_0x3486('0xf')]+_0xc5c585[_0x3486('0x10')]+_0xc5c585['countabandonedretry']+_0xc5c585['countmachineretry']+_0xc5c585[_0x3486('0x11')];this[_0x3486('0xf')]=_0xc5c585['countnosuchnumberretry'];this[_0x3486('0x10')]=_0xc5c585[_0x3486('0x10')];this[_0x3486('0x12')]=_0xc5c585[_0x3486('0x12')];this[_0x3486('0x13')]=_0xc5c585[_0x3486('0x13')];this[_0x3486('0x11')]=_0xc5c585['countagentrejectretry'];this['uniqueid']=_0x2e2ec7['uniqueid'];this[_0x3486('0x14')]=_0xc5c585[_0x3486('0x15')];this[_0x3486('0x16')]=_0xc5c585['number'];this[_0x3486('0x17')]=_0xc5c585['starttime'];this['responsetime']=_0xc5c585[_0x3486('0x18')];this[_0x3486('0x19')]=moment()[_0x3486('0x1a')](_0x3486('0x1b'));this['ringtime']=utils[_0x3486('0x1c')](_0xc5c585[_0x3486('0x18')],_0xc5c585[_0x3486('0x17')]);this['holdtime']=0x0;this[_0x3486('0x1d')]=utils[_0x3486('0x1c')](this['endtime'],_0xc5c585['responsetime']);this['queue']=_0xc5c585[_0x3486('0x9')];this['membername']='IVR';this['reason']=_0x2e2ec7['cause-txt'];this[_0x3486('0x1e')]=_0xc5c585['callback'];this[_0x3486('0x1f')]=_0xc5c585[_0x3486('0x1f')];this[_0x3486('0x20')]=_0xc5c585[_0x3486('0x20')];this['recallme']=_0xc5c585['recallme'];this[_0x3486('0x21')]=_0xc5c585[_0x3486('0x21')];this['ListId']=_0xc5c585[_0x3486('0x22')];this[_0x3486('0x23')]=_0xc5c585[_0x3486('0x23')];this[_0x3486('0x24')]=_0xc5c585[_0x3486('0x24')];this[_0x3486('0x25')]=_0xc5c585[_0x3486('0x25')];}module[_0x3486('0x26')]=Hangup; \ No newline at end of file +var _0x1993=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','getSeconds','endtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x4f261c,_0x2c3cb4){var _0x29b17f=function(_0x59e634){while(--_0x59e634){_0x4f261c['push'](_0x4f261c['shift']());}};_0x29b17f(++_0x2c3cb4);}(_0x1993,0xae));var _0x3199=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1993[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0x3199('0x0'));var utils=require('../utils');function Hangup(_0x520fe8,_0x272e1e){this[_0x3199('0x1')]=0x4;this[_0x3199('0x2')]=_0x3199('0x3');this[_0x3199('0x4')]=_0x520fe8[_0x3199('0x4')];this[_0x3199('0x5')]=_0x520fe8[_0x3199('0x5')];this['campaigntype']=_0x520fe8['type']===_0x3199('0x6')?_0x3199('0x7'):_0x520fe8['type'];this[_0x3199('0x8')]=_0x520fe8['amd']||![];this['countbusyretry']=_0x520fe8[_0x3199('0x9')];this[_0x3199('0xa')]=_0x520fe8['countcongestionretry'];this[_0x3199('0xb')]=_0x520fe8[_0x3199('0xb')];this[_0x3199('0xc')]=_0x520fe8[_0x3199('0x9')]+_0x520fe8[_0x3199('0xa')]+_0x520fe8['countnoanswerretry']+_0x520fe8[_0x3199('0xd')]+_0x520fe8['countdropretry']+_0x520fe8['countabandonedretry']+_0x520fe8[_0x3199('0xe')]+_0x520fe8[_0x3199('0xf')];this[_0x3199('0xd')]=_0x520fe8[_0x3199('0xd')];this[_0x3199('0x10')]=_0x520fe8[_0x3199('0x10')];this[_0x3199('0x11')]=_0x520fe8['countabandonedretry'];this['countmachineretry']=_0x520fe8[_0x3199('0xe')];this[_0x3199('0xf')]=_0x520fe8[_0x3199('0xf')];this[_0x3199('0x12')]=_0x272e1e[_0x3199('0x12')];this[_0x3199('0x13')]=_0x520fe8[_0x3199('0x14')];this[_0x3199('0x15')]=_0x520fe8[_0x3199('0x16')];this[_0x3199('0x17')]=_0x520fe8[_0x3199('0x17')];this[_0x3199('0x18')]=_0x520fe8[_0x3199('0x18')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3199('0x19')]=utils['getSeconds'](_0x520fe8[_0x3199('0x18')],_0x520fe8[_0x3199('0x17')]);this[_0x3199('0x1a')]=0x0;this[_0x3199('0x1b')]=utils[_0x3199('0x1c')](this[_0x3199('0x1d')],_0x520fe8[_0x3199('0x18')]);this[_0x3199('0x7')]=_0x520fe8['queue'];this[_0x3199('0x1e')]='IVR';this[_0x3199('0x1f')]=_0x272e1e[_0x3199('0x20')];this[_0x3199('0x21')]=_0x520fe8['callback'];this['callbackuniqueid']=_0x520fe8[_0x3199('0x22')];this[_0x3199('0x23')]=_0x520fe8[_0x3199('0x23')];this[_0x3199('0x24')]=_0x520fe8[_0x3199('0x24')];this['ContactId']=_0x520fe8[_0x3199('0x25')];this[_0x3199('0x26')]=_0x520fe8[_0x3199('0x26')];this[_0x3199('0x27')]=_0x520fe8[_0x3199('0x27')];this[_0x3199('0x28')]=_0x520fe8[_0x3199('0x28')];this[_0x3199('0x29')]=_0x520fe8['CampaignId'];}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 2235d86..e995e55 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 _0x88e4=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x5d59f3,_0x4668ad){var _0x6b14d3=function(_0x4763ad){while(--_0x4763ad){_0x5d59f3['push'](_0x5d59f3['shift']());}};_0x6b14d3(++_0x4668ad);}(_0x88e4,0x127));var _0x488e=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x88e4[_0x3826ad];return _0x17b900;};'use strict';var utils=require(_0x488e('0x0'));function History(_0x1dbd34){this['uniqueid']=_0x1dbd34[_0x488e('0x1')];this['scheduledat']=_0x1dbd34[_0x488e('0x2')]||undefined;this[_0x488e('0x3')]=_0x1dbd34[_0x488e('0x3')];this[_0x488e('0x4')]=_0x1dbd34['type']===_0x488e('0x5')?_0x488e('0x6'):_0x1dbd34[_0x488e('0x3')];this['countbusyretry']=_0x1dbd34[_0x488e('0x7')];this['countcongestionretry']=_0x1dbd34[_0x488e('0x8')];this[_0x488e('0x9')]=_0x1dbd34['countnoanswerretry'];this['countglobal']=_0x1dbd34[_0x488e('0x7')]+_0x1dbd34['countcongestionretry']+_0x1dbd34['countnoanswerretry']+_0x1dbd34['countnosuchnumberretry']+_0x1dbd34[_0x488e('0xa')]+_0x1dbd34[_0x488e('0xb')]+_0x1dbd34[_0x488e('0xc')]+_0x1dbd34[_0x488e('0xd')];this[_0x488e('0xe')]=_0x1dbd34[_0x488e('0xe')];this[_0x488e('0xa')]=_0x1dbd34[_0x488e('0xa')];this[_0x488e('0xb')]=_0x1dbd34[_0x488e('0xb')];this[_0x488e('0xc')]=_0x1dbd34[_0x488e('0xc')];this[_0x488e('0xd')]=_0x1dbd34[_0x488e('0xd')];this[_0x488e('0x6')]=_0x1dbd34['queue'];this['calleridname']=_0x1dbd34[_0x488e('0xf')];this[_0x488e('0x10')]=_0x1dbd34[_0x488e('0x11')];this[_0x488e('0x12')]=_0x1dbd34['starttime'];this[_0x488e('0x13')]=_0x1dbd34[_0x488e('0x13')];this[_0x488e('0x14')]=_0x1dbd34[_0x488e('0x13')];this[_0x488e('0x15')]=utils['getSeconds'](_0x1dbd34[_0x488e('0x13')],_0x1dbd34['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x1dbd34['callback'];this[_0x488e('0x16')]=_0x1dbd34[_0x488e('0x16')];this[_0x488e('0x17')]=_0x1dbd34[_0x488e('0x17')];this[_0x488e('0x18')]=_0x1dbd34[_0x488e('0x18')];this['ContactId']=_0x1dbd34['ContactId'];this[_0x488e('0x19')]=_0x1dbd34[_0x488e('0x19')];this[_0x488e('0x1a')]=_0x1dbd34[_0x488e('0x1a')];this[_0x488e('0x1b')]=_0x1dbd34['VoiceQueueId'];this[_0x488e('0x1c')]=_0x1dbd34[_0x488e('0x1c')];this[_0x488e('0x1d')]=_0x1dbd34[_0x488e('0x1d')]||'';this[_0x488e('0x1e')]=_0x1dbd34[_0x488e('0x1e')]||'';this['state']=_0x1dbd34[_0x488e('0x1f')];this[_0x488e('0x20')]=_0x1dbd34[_0x488e('0x20')];}module[_0x488e('0x21')]=History; \ No newline at end of file +var _0xad4f=['state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x39164f,_0x3e6cb2){var _0x4a9a40=function(_0x510586){while(--_0x510586){_0x39164f['push'](_0x39164f['shift']());}};_0x4a9a40(++_0x3e6cb2);}(_0xad4f,0x16b));var _0xfad4=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xad4f[_0x5783f4];return _0x28e380;};'use strict';var utils=require(_0xfad4('0x0'));function History(_0xec6d61){this[_0xfad4('0x1')]=_0xec6d61[_0xfad4('0x1')];this['scheduledat']=_0xec6d61[_0xfad4('0x2')]||undefined;this['type']=_0xec6d61[_0xfad4('0x3')];this[_0xfad4('0x4')]=_0xec6d61[_0xfad4('0x3')]===_0xfad4('0x5')?_0xfad4('0x6'):_0xec6d61[_0xfad4('0x3')];this[_0xfad4('0x7')]=_0xec6d61[_0xfad4('0x7')];this[_0xfad4('0x8')]=_0xec6d61[_0xfad4('0x8')];this[_0xfad4('0x9')]=_0xec6d61['countnoanswerretry'];this[_0xfad4('0xa')]=_0xec6d61[_0xfad4('0x7')]+_0xec6d61[_0xfad4('0x8')]+_0xec6d61[_0xfad4('0x9')]+_0xec6d61[_0xfad4('0xb')]+_0xec6d61[_0xfad4('0xc')]+_0xec6d61[_0xfad4('0xd')]+_0xec6d61[_0xfad4('0xe')]+_0xec6d61[_0xfad4('0xf')];this[_0xfad4('0xb')]=_0xec6d61[_0xfad4('0xb')];this[_0xfad4('0xc')]=_0xec6d61[_0xfad4('0xc')];this[_0xfad4('0xd')]=_0xec6d61[_0xfad4('0xd')];this['countmachineretry']=_0xec6d61['countmachineretry'];this['countagentrejectretry']=_0xec6d61[_0xfad4('0xf')];this[_0xfad4('0x6')]=_0xec6d61[_0xfad4('0x6')];this[_0xfad4('0x10')]=_0xec6d61[_0xfad4('0x11')];this[_0xfad4('0x12')]=_0xec6d61[_0xfad4('0x13')];this[_0xfad4('0x14')]=_0xec6d61[_0xfad4('0x14')];this['responsetime']=_0xec6d61['responsetime'];this[_0xfad4('0x15')]=_0xec6d61[_0xfad4('0x16')];this[_0xfad4('0x17')]=utils[_0xfad4('0x18')](_0xec6d61[_0xfad4('0x16')],_0xec6d61['starttime']);this['holdtime']=0x0;this[_0xfad4('0x19')]=0x0;this[_0xfad4('0x1a')]=_0xec6d61[_0xfad4('0x1a')];this['callbackuniqueid']=_0xec6d61[_0xfad4('0x1b')];this['callbackat']=_0xec6d61[_0xfad4('0x1c')];this[_0xfad4('0x1d')]=_0xec6d61['recallme'];this[_0xfad4('0x1e')]=_0xec6d61[_0xfad4('0x1e')];this['ListId']=_0xec6d61[_0xfad4('0x1f')];this[_0xfad4('0x20')]=_0xec6d61[_0xfad4('0x20')];this[_0xfad4('0x21')]=_0xec6d61[_0xfad4('0x21')];this[_0xfad4('0x22')]=_0xec6d61['CampaignId'];this[_0xfad4('0x23')]=_0xec6d61['originatecalleridnum']||'';this[_0xfad4('0x24')]=_0xec6d61[_0xfad4('0x24')]||'';this[_0xfad4('0x25')]=_0xec6d61[_0xfad4('0x25')];this[_0xfad4('0x26')]=_0xec6d61['statedesc'];}module[_0xfad4('0x27')]=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 2a81adc..c0ec87d 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 _0x7160=['membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','starttime','droptime','dropreason','endtime','ringtime','getSeconds','responsetime','holdtime','talktime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7160,0x8f));var _0x0716=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7160[_0x56482c];return _0x5aae7a;};'use strict';var utils=require(_0x0716('0x0'));function QueueCallerAbandon(_0x48cf,_0x4a2042){this['scheduledat']=_0x48cf['scheduledat'];this[_0x0716('0x1')]=_0x48cf[_0x0716('0x1')];this[_0x0716('0x2')]=_0x48cf['type']==='outbound'?_0x0716('0x3'):_0x48cf[_0x0716('0x1')];this[_0x0716('0x4')]=_0x48cf[_0x0716('0x4')];this[_0x0716('0x5')]=_0x48cf[_0x0716('0x5')];this[_0x0716('0x6')]=_0x48cf[_0x0716('0x6')];this[_0x0716('0x7')]=_0x48cf[_0x0716('0x4')]+_0x48cf[_0x0716('0x5')]+_0x48cf['countnoanswerretry']+_0x48cf['countnosuchnumberretry']+_0x48cf[_0x0716('0x8')]+_0x48cf[_0x0716('0x9')]+_0x48cf[_0x0716('0xa')]+_0x48cf[_0x0716('0xb')];this[_0x0716('0xc')]=_0x48cf['countnosuchnumberretry'];this[_0x0716('0x8')]=_0x48cf['countdropretry'];this[_0x0716('0x9')]=_0x48cf[_0x0716('0x9')];this[_0x0716('0xa')]=_0x48cf[_0x0716('0xa')];this[_0x0716('0xb')]=_0x48cf[_0x0716('0xb')];this[_0x0716('0xd')]=_0x4a2042[_0x0716('0xd')];this['calleridname']=_0x48cf[_0x0716('0xe')];this[_0x0716('0xf')]=_0x48cf['number'];this[_0x0716('0x10')]=_0x48cf[_0x0716('0x10')];this['responsetime']=_0x48cf['responsetime'];this[_0x0716('0x11')]=_0x48cf[_0x0716('0x11')];this[_0x0716('0x12')]=_0x48cf['dropreason'];this[_0x0716('0x13')]=this[_0x0716('0x11')];this[_0x0716('0x14')]=utils[_0x0716('0x15')](_0x48cf[_0x0716('0x16')],_0x48cf[_0x0716('0x10')]);this[_0x0716('0x17')]=utils[_0x0716('0x15')](this[_0x0716('0x11')],_0x48cf[_0x0716('0x16')]);this[_0x0716('0x18')]=0x0;this[_0x0716('0x3')]=_0x4a2042[_0x0716('0x3')];this[_0x0716('0x19')]=_0x4a2042[_0x0716('0x1a')];this['reason']=_0x4a2042[_0x0716('0x1b')];this['callback']=_0x48cf[_0x0716('0x1c')];this[_0x0716('0x1d')]=_0x48cf[_0x0716('0x1d')];this['callbackat']=_0x48cf[_0x0716('0x1e')];this[_0x0716('0x1f')]=_0x48cf['recallme'];this['ContactId']=_0x48cf[_0x0716('0x20')];this[_0x0716('0x21')]=_0x48cf[_0x0716('0x21')];this['UserId']=_0x48cf['UserId'];this[_0x0716('0x22')]=_0x48cf[_0x0716('0x22')];this[_0x0716('0x23')]=_0x48cf[_0x0716('0x23')];this['originatecalleridnum']=_0x48cf[_0x0716('0x24')]||'';this[_0x0716('0x25')]=_0x48cf[_0x0716('0x25')]||'';this[_0x0716('0x26')]=_0x48cf[_0x0716('0x26')];this[_0x0716('0x27')]=_0x48cf[_0x0716('0x27')];this[_0x0716('0x28')]=_0x48cf['statedesc'];}module[_0x0716('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x5d7f=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','scheduledat'];(function(_0x22b2df,_0x59214b){var _0x3ddde7=function(_0x2baafa){while(--_0x2baafa){_0x22b2df['push'](_0x22b2df['shift']());}};_0x3ddde7(++_0x59214b);}(_0x5d7f,0x1a1));var _0xf5d7=function(_0x3f523e,_0x1502fe){_0x3f523e=_0x3f523e-0x0;var _0x593ce5=_0x5d7f[_0x3f523e];return _0x593ce5;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x4c482c,_0x4cb2d0){this[_0xf5d7('0x0')]=_0x4c482c[_0xf5d7('0x0')];this['type']=_0x4c482c[_0xf5d7('0x1')];this[_0xf5d7('0x2')]=_0x4c482c['type']===_0xf5d7('0x3')?_0xf5d7('0x4'):_0x4c482c[_0xf5d7('0x1')];this[_0xf5d7('0x5')]=_0x4c482c[_0xf5d7('0x5')];this[_0xf5d7('0x6')]=_0x4c482c[_0xf5d7('0x6')];this[_0xf5d7('0x7')]=_0x4c482c[_0xf5d7('0x7')];this['countglobal']=_0x4c482c['countbusyretry']+_0x4c482c[_0xf5d7('0x6')]+_0x4c482c[_0xf5d7('0x7')]+_0x4c482c[_0xf5d7('0x8')]+_0x4c482c['countdropretry']+_0x4c482c['countabandonedretry']+_0x4c482c['countmachineretry']+_0x4c482c[_0xf5d7('0x9')];this[_0xf5d7('0x8')]=_0x4c482c[_0xf5d7('0x8')];this[_0xf5d7('0xa')]=_0x4c482c[_0xf5d7('0xa')];this['countabandonedretry']=_0x4c482c['countabandonedretry'];this[_0xf5d7('0xb')]=_0x4c482c[_0xf5d7('0xb')];this[_0xf5d7('0x9')]=_0x4c482c[_0xf5d7('0x9')];this[_0xf5d7('0xc')]=_0x4cb2d0['uniqueid'];this[_0xf5d7('0xd')]=_0x4c482c[_0xf5d7('0xe')];this['calleridnum']=_0x4c482c[_0xf5d7('0xf')];this[_0xf5d7('0x10')]=_0x4c482c[_0xf5d7('0x10')];this[_0xf5d7('0x11')]=_0x4c482c[_0xf5d7('0x11')];this[_0xf5d7('0x12')]=_0x4c482c[_0xf5d7('0x12')];this[_0xf5d7('0x13')]=_0x4c482c[_0xf5d7('0x13')];this[_0xf5d7('0x14')]=this[_0xf5d7('0x12')];this[_0xf5d7('0x15')]=utils[_0xf5d7('0x16')](_0x4c482c[_0xf5d7('0x11')],_0x4c482c[_0xf5d7('0x10')]);this['holdtime']=utils[_0xf5d7('0x16')](this['droptime'],_0x4c482c['responsetime']);this['talktime']=0x0;this[_0xf5d7('0x4')]=_0x4cb2d0[_0xf5d7('0x4')];this['membername']=_0x4cb2d0[_0xf5d7('0x17')];this[_0xf5d7('0x18')]=_0x4cb2d0[_0xf5d7('0x18')];this[_0xf5d7('0x19')]=_0x4c482c[_0xf5d7('0x19')];this[_0xf5d7('0x1a')]=_0x4c482c[_0xf5d7('0x1a')];this[_0xf5d7('0x1b')]=_0x4c482c[_0xf5d7('0x1b')];this[_0xf5d7('0x1c')]=_0x4c482c['recallme'];this[_0xf5d7('0x1d')]=_0x4c482c['ContactId'];this[_0xf5d7('0x1e')]=_0x4c482c[_0xf5d7('0x1e')];this['UserId']=_0x4c482c[_0xf5d7('0x1f')];this[_0xf5d7('0x20')]=_0x4c482c[_0xf5d7('0x20')];this[_0xf5d7('0x21')]=_0x4c482c['CampaignId'];this[_0xf5d7('0x22')]=_0x4c482c['originatecalleridnum']||'';this[_0xf5d7('0x23')]=_0x4c482c[_0xf5d7('0x23')]||'';this['agiafterat']=_0x4c482c['agiafterat'];this[_0xf5d7('0x24')]=_0x4c482c[_0xf5d7('0x24')];this[_0xf5d7('0x25')]=_0x4c482c[_0xf5d7('0x25')];}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 ab9d0f5..846cab5 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 _0xf072=['dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x289187,_0x5b6795){var _0x5c4db4=function(_0x1e4618){while(--_0x1e4618){_0x289187['push'](_0x289187['shift']());}};_0x5c4db4(++_0x5b6795);}(_0xf072,0x1cf));var _0x2f07=function(_0x4e8880,_0x2505ef){_0x4e8880=_0x4e8880-0x0;var _0x3688ae=_0xf072[_0x4e8880];return _0x3688ae;};'use strict';var util=require(_0x2f07('0x0'));var logger=require(_0x2f07('0x1'))(_0x2f07('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x2f07('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x2f07('0x4'));function inspectError(_0x432696){return util[_0x2f07('0x5')](_0x432696,{'showHidden':![],'depth':null});}function getContactDialer(_0x48d7b6,_0x1d5a33,_0x14d6e6){return cmHopper[_0x2f07('0x6')](_0x48d7b6['id'],_0x1d5a33,_0x14d6e6,_0x48d7b6[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0xf73d1a){_0x48d7b6[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xb'),inspectError(_0xf73d1a));});}exports[_0x2f07('0x6')]=getContactDialer;function getContactDialerIvr(_0x30c638,_0x2e372c){return cmHopper[_0x2f07('0xc')](_0x30c638['id'],_0x2e372c,_0x30c638[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0x564260){_0x30c638[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xd'),inspectError(_0x564260));});}exports[_0x2f07('0xc')]=getContactDialerIvr;function countReScheduled(_0x496d87){return cmHopper['countReScheduled'](_0x496d87)[_0x2f07('0x8')](function(_0x1e291d){logger['error'](_0x2f07('0xe'),inspectError(_0x1e291d));});}exports[_0x2f07('0xf')]=countReScheduled;function rescheduleContact(_0x26edfa){return cmHopper['rescheduleContact'](_0x26edfa)[_0x2f07('0x8')](function(_0x443fdc){logger[_0x2f07('0xa')](_0x2f07('0x10'),inspectError(_0x443fdc));});}exports[_0x2f07('0x11')]=rescheduleContact;function unlockContact(_0x309908,_0x5d32d6,_0x8475cf){return cmHopper['unlockContact'](_0x309908,_0x5d32d6,_0x8475cf)[_0x2f07('0x8')](function(_0xe8cf4d){logger[_0x2f07('0xa')](_0x2f07('0x12'),inspectError(_0xe8cf4d));});}exports[_0x2f07('0x13')]=unlockContact;function moveContactManagedDialer(_0x46c9b4){return cmHopper[_0x2f07('0x14')](_0x46c9b4)[_0x2f07('0x8')](function(_0x55bd60){logger[_0x2f07('0xa')]('[moveContactManagedDialer]',inspectError(_0x55bd60));});}exports[_0x2f07('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2df6ed){return cmHopperBlack[_0x2f07('0x15')](_0x2df6ed)[_0x2f07('0x8')](function(_0x2ef47d){logger['error'](_0x2f07('0x16'),inspectError(_0x2ef47d));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5db56b){return cmHopperBlack['checkIsBlackListIvr'](_0x5db56b)[_0x2f07('0x8')](function(_0x51c285){logger[_0x2f07('0xa')]('[checkIsBlackListIvr]',inspectError(_0x51c285));});}exports[_0x2f07('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2c495f,_0x12a2a5,_0x307888){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2c495f,_0x12a2a5,_0x307888)[_0x2f07('0x8')](function(_0x428d8c){logger[_0x2f07('0xa')]('[verifyAdditionalPhone]',inspectError(_0x428d8c));});}exports[_0x2f07('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x113916,_0x522006,_0x1dcedc){return cmHopperAdditionalPhone[_0x2f07('0x19')](_0x113916,_0x522006,_0x1dcedc)['catch'](function(_0x427e13){logger['error'](_0x2f07('0x1a'),inspectError(_0x427e13));});}exports[_0x2f07('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x27bd72){return cmHopperHistory[_0x2f07('0x1b')](_0x27bd72)[_0x2f07('0x8')](function(_0x139ea8){logger[_0x2f07('0xa')](_0x2f07('0x1c'),inspectError(_0x139ea8));});}exports[_0x2f07('0x1b')]=avgHandleTime;function createHistory(_0x468cd8){return cmHopperHistory[_0x2f07('0x1d')](_0x468cd8)[_0x2f07('0x8')](function(_0x4c607a){logger[_0x2f07('0xa')](_0x2f07('0x1e'),inspectError(_0x4c607a));});}exports[_0x2f07('0x1d')]=createHistory; \ No newline at end of file +var _0x1623=['swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','catch','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]'];(function(_0xe7feeb,_0x29aec0){var _0xbd2bda=function(_0x2dfb50){while(--_0x2dfb50){_0xe7feeb['push'](_0xe7feeb['shift']());}};_0xbd2bda(++_0x29aec0);}(_0x1623,0xab));var _0x3162=function(_0x32fadd,_0x5a882e){_0x32fadd=_0x32fadd-0x0;var _0x2eb8d4=_0x1623[_0x32fadd];return _0x2eb8d4;};'use strict';var util=require(_0x3162('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0x3162('0x1'));var cmHopperAdditionalPhone=require(_0x3162('0x2'));var cmHopperBlack=require(_0x3162('0x3'));var cmHopperHistory=require(_0x3162('0x4'));function inspectError(_0x428dd7){return util['inspect'](_0x428dd7,{'showHidden':![],'depth':null});}function getContactDialer(_0x5d49d0,_0x7a4559,_0x4b77c4){return cmHopper[_0x3162('0x5')](_0x5d49d0['id'],_0x7a4559,_0x4b77c4,_0x5d49d0[_0x3162('0x6')])['catch'](function(_0xffe9b6){_0x5d49d0[_0x3162('0x7')]=0x0;logger[_0x3162('0x8')](_0x3162('0x9'),inspectError(_0xffe9b6));});}exports[_0x3162('0x5')]=getContactDialer;function getContactDialerIvr(_0x382676,_0xe43099){return cmHopper[_0x3162('0xa')](_0x382676['id'],_0xe43099,_0x382676['dialOrderByScheduledAt'])['catch'](function(_0x270de3){_0x382676[_0x3162('0x7')]=0x0;logger[_0x3162('0x8')](_0x3162('0xb'),inspectError(_0x270de3));});}exports[_0x3162('0xa')]=getContactDialerIvr;function countReScheduled(_0x208f4e){return cmHopper[_0x3162('0xc')](_0x208f4e)[_0x3162('0xd')](function(_0x157ab8){logger['error'](_0x3162('0xe'),inspectError(_0x157ab8));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x3b9faf){return cmHopper[_0x3162('0xf')](_0x3b9faf)['catch'](function(_0x4a393a){logger[_0x3162('0x8')](_0x3162('0x10'),inspectError(_0x4a393a));});}exports[_0x3162('0xf')]=rescheduleContact;function unlockContact(_0x4b8a3b,_0x15e348,_0x3d0bea){return cmHopper[_0x3162('0x11')](_0x4b8a3b,_0x15e348,_0x3d0bea)['catch'](function(_0x78a56c){logger[_0x3162('0x8')](_0x3162('0x12'),inspectError(_0x78a56c));});}exports[_0x3162('0x11')]=unlockContact;function moveContactManagedDialer(_0x930415){return cmHopper[_0x3162('0x13')](_0x930415)[_0x3162('0xd')](function(_0x4b2bf3){logger[_0x3162('0x8')](_0x3162('0x14'),inspectError(_0x4b2bf3));});}exports[_0x3162('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x36ca97){return cmHopperBlack['checkIsBlackList'](_0x36ca97)[_0x3162('0xd')](function(_0x5a5141){logger['error'](_0x3162('0x15'),inspectError(_0x5a5141));});}exports[_0x3162('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x31946d){return cmHopperBlack['checkIsBlackListIvr'](_0x31946d)['catch'](function(_0x27133e){logger[_0x3162('0x8')](_0x3162('0x17'),inspectError(_0x27133e));});}exports[_0x3162('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x31b27b,_0x14cbba,_0x52ae25){return cmHopperAdditionalPhone[_0x3162('0x19')](_0x31b27b,_0x14cbba,_0x52ae25)['catch'](function(_0xd283d6){logger[_0x3162('0x8')](_0x3162('0x1a'),inspectError(_0xd283d6));});}exports[_0x3162('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c9992,_0x3c543e,_0x30552f){return cmHopperAdditionalPhone[_0x3162('0x1b')](_0x1c9992,_0x3c543e,_0x30552f)[_0x3162('0xd')](function(_0x356c5d){logger[_0x3162('0x8')](_0x3162('0x1c'),inspectError(_0x356c5d));});}exports[_0x3162('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x48de45){return cmHopperHistory[_0x3162('0x1d')](_0x48de45)['catch'](function(_0x37acdd){logger[_0x3162('0x8')](_0x3162('0x1e'),inspectError(_0x37acdd));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x4903e7){return cmHopperHistory[_0x3162('0x1f')](_0x4903e7)[_0x3162('0xd')](function(_0x14df16){logger[_0x3162('0x8')](_0x3162('0x20'),inspectError(_0x14df16));});}exports['createHistory']=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 4341b15..581c380 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 _0xe7d9=['pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','updatedAt','undefined','%s%s','XMD-','toUpperCase','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xe7d9,0xe0));var _0x9e7d=function(_0xdc7463,_0x48e676){_0xdc7463=_0xdc7463-0x0;var _0x7c4a2d=_0xe7d9[_0xdc7463];return _0x7c4a2d;};'use strict';var _=require(_0x9e7d('0x0'));var moment=require(_0x9e7d('0x1'));var util=require(_0x9e7d('0x2'));var logger=require(_0x9e7d('0x3'))(_0x9e7d('0x4'));var timezones=require(_0x9e7d('0x5'))[_0x9e7d('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x9e7d('0x7'),'CONTACTS_RESCHEDULED':_0x9e7d('0x8'),'DEACTIVATED':_0x9e7d('0x9'),'DISACTIVED':_0x9e7d('0xa'),'EMPTY_INTERVAL':_0x9e7d('0xb'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x9e7d('0xc'),'NO_AVAILABLE_CONTACTS':_0x9e7d('0xd'),'NULL_INTERVAL':_0x9e7d('0xe'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x9e7d('0xf'),'RECALL_TIMEOUT':_0x9e7d('0x10'),'RUNNING':_0x9e7d('0x11'),'UNKNOWN_TIMEZONE':_0x9e7d('0x12'),'UNREACHABLE_TRUNK':_0x9e7d('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2d578f){return _0x2d578f[_0x9e7d('0x14')]===_0x9e7d('0x15');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x369ed6){return _0x369ed6['type']===_0x9e7d('0x16');}exports[_0x9e7d('0x17')]=isIVRCampaign;function isOutboundQueue(_0x378783){return _0x378783['type']===_0x9e7d('0x18');}exports[_0x9e7d('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x122dde){return _0x122dde[_0x9e7d('0x1a')];}exports[_0x9e7d('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x39b995){return _0x39b995[_0x9e7d('0x1c')];}exports[_0x9e7d('0x1d')]=isIVRCampaignActive;function getSeconds(_0x5a77ae,_0x34812c){var _0xc829f9=moment(_0x5a77ae)['milliseconds'](0x0);var _0x43e991=moment(_0x34812c)[_0x9e7d('0x1e')](0x0);return _0xc829f9[_0x9e7d('0x1f')](_0x43e991,_0x9e7d('0x20'));}exports[_0x9e7d('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x3e6a81,_0x2a8887){var _0x581b0e=![];var _0x4e6eca=_0x3e6a81[_0x9e7d('0x14')]!==_0x2a8887['dialMethod']||_0x3e6a81[_0x9e7d('0x1a')]!==_0x2a8887['dialActive']||_0x3e6a81['message']!==_0x2a8887[_0x9e7d('0x22')];var _0x3e1e64=_0x3e6a81[_0x9e7d('0x23')]!==_0x2a8887[_0x9e7d('0x23')]||_0x3e6a81['loggedIn']!==_0x2a8887[_0x9e7d('0x24')]||_0x3e6a81[_0x9e7d('0x25')]!==_0x2a8887[_0x9e7d('0x25')]||_0x3e6a81['paused']!==_0x2a8887[_0x9e7d('0x26')]||_0x3e6a81[_0x9e7d('0x27')]!==_0x2a8887['talking']||_0x3e6a81[_0x9e7d('0x28')]!==_0x2a8887[_0x9e7d('0x28')]||_0x3e6a81['waiting']!==_0x2a8887[_0x9e7d('0x29')]||_0x3e6a81['inUse']!==_0x2a8887[_0x9e7d('0x2a')]||_0x3e6a81['originated']!==_0x2a8887[_0x9e7d('0x2b')];if(_0x3e6a81[_0x9e7d('0x2c')]&&_0x2a8887['Trunk']){_0x581b0e=_0x3e6a81[_0x9e7d('0x2c')][_0x9e7d('0x2d')]!==_0x2a8887[_0x9e7d('0x2c')][_0x9e7d('0x2d')]||_0x3e6a81[_0x9e7d('0x2c')]['active']!==_0x2a8887['Trunk']['active'];}return _0x4e6eca||_0x3e1e64||_0x581b0e;}exports[_0x9e7d('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x18d67e){var _0x624136=null;var _0x36229b=_0x18d67e[_0x9e7d('0x2f')];if(_[_0x9e7d('0x30')](_0x18d67e[_0x9e7d('0x31')])||_['isNil'](_0x18d67e[_0x9e7d('0x32')])||_[_0x9e7d('0x30')](_0x18d67e[_0x9e7d('0x32')][_0x9e7d('0x33')])){_0x624136=CAMPAIGN_STATUS[_0x9e7d('0x34')];}else if(_[_0x9e7d('0x35')](_0x18d67e[_0x9e7d('0x31')])||_[_0x9e7d('0x35')](_0x18d67e[_0x9e7d('0x32')][_0x9e7d('0x33')])){_0x624136=CAMPAIGN_STATUS[_0x9e7d('0x36')];}else if(_0x36229b&&!timezones[_0x36229b]){_0x624136=CAMPAIGN_STATUS[_0x9e7d('0x37')];}return _0x624136;}function checkAnyValidTrunk(_0x245580,_0x5184de){var _0x13202f=null;var _0x490921=_0x9e7d('0x38');var _0x56d0e6=[_0x9e7d('0x39'),'unmonitored'];var _0x2c1416=!![];if(_0x245580[_0x9e7d('0x2c')]&&_0x245580[_0x9e7d('0x2c')][_0x9e7d('0x1c')]){_0x490921+=_0x245580[_0x9e7d('0x2c')][_0x9e7d('0x2d')];_0x13202f=_0x5184de[_0x490921];_0x2c1416=_0x56d0e6['includes'](_0x13202f[_0x9e7d('0x3a')]);}else if(_0x245580[_0x9e7d('0x3b')]&&_0x245580['TrunkBackup']['active']){_0x490921+=_0x245580[_0x9e7d('0x3b')][_0x9e7d('0x2d')];_0x13202f=_0x5184de[_0x490921];_0x2c1416=_0x56d0e6[_0x9e7d('0x3c')](_0x13202f[_0x9e7d('0x3a')]);}return _0x2c1416;}function getQueueCampaignStatusMessage(_0x450b02,_0xc3a6a8){var _0x4457c5=CAMPAIGN_STATUS['ACTIVE'];var _0x4e26da=isPreviewCampaign(_0x450b02);if(!isQueueCampaignActive(_0x450b02)){if(_0x4e26da){_0x4457c5=CAMPAIGN_STATUS[_0x9e7d('0x3d')];}else{if(_0x450b02['originated']===0x0&&_0x450b02[_0x9e7d('0x27')]===0x0&&_0x450b02[_0x9e7d('0x29')]===0x0&&(_0x450b02['pTalking']||0x0)===0x0){_0x4457c5=CAMPAIGN_STATUS[_0x9e7d('0x3d')];}else{_0x4457c5=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x450b02[_0x9e7d('0x24')]===0x0){_0x4457c5=CAMPAIGN_STATUS[_0x9e7d('0x3e')];}else if(!checkAnyValidTrunk(_0x450b02,_0xc3a6a8)){_0x4457c5=CAMPAIGN_STATUS[_0x9e7d('0x3f')];}else if(!isPreviewCampaign(_0x450b02)){var _0xef511b=checkAnyValidQueueCampaignInterval(_0x450b02);if(_0xef511b){_0x4457c5=_0xef511b;}}return _0x4457c5;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x156a24){var _0x2ec48e=CAMPAIGN_STATUS['DISACTIVED'];if(_0x156a24[_0x9e7d('0x2b')]===0x0&&_0x156a24[_0x9e7d('0x27')]===0x0&&_0x156a24[_0x9e7d('0x29')]===0x0&&(_0x156a24[_0x9e7d('0x28')]||0x0)===0x0){_0x2ec48e=CAMPAIGN_STATUS[_0x9e7d('0x3d')];}return _0x2ec48e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x42eddf){var _0x1c12f6=_0x42eddf[_0x9e7d('0x40')](/"(.*?)"/);return _0x1c12f6?_0x1c12f6[0x1]:_0x42eddf;}exports[_0x9e7d('0x41')]=extractCalleridName;function getCallerId(_0x16a3df,_0x5709b3,_0x388e95){if(!_[_0x9e7d('0x42')](_0x388e95)&&typeof _0x388e95===_0x9e7d('0x43')&&!_[_0x9e7d('0x35')](_0x388e95)){if(!_['isUndefined'](_0x5709b3)&&typeof _0x5709b3===_0x9e7d('0x43')&&!_[_0x9e7d('0x35')](_0x5709b3)){return util[_0x9e7d('0x44')]('\x22%s\x22\x20<%s>',_0x5709b3,_0x388e95);}return util[_0x9e7d('0x44')](_0x9e7d('0x45'),_0x388e95,_0x388e95);}if(!_[_0x9e7d('0x42')](_0x16a3df)&&typeof _0x16a3df===_0x9e7d('0x43')&&!_[_0x9e7d('0x35')](_0x16a3df)){return _0x16a3df;}return'\x22\x22\x20<>';}exports[_0x9e7d('0x46')]=getCallerId;function getCallerIdRandom(_0x1e565f,_0x498807){var _0x4c4667;var _0x6493e7;var _0xf85035;if(_0x498807<=0x0){_0x498807=0x1;}_0x4c4667=new RegExp(_0x9e7d('0x47')+_0x498807+'}$');_0x6493e7=Math[_0x9e7d('0x48')](0xa,_0x498807-0x1);_0xf85035=Math[_0x9e7d('0x48')](0xa,_0x498807)-0x1;return util[_0x9e7d('0x44')]('%s',_[_0x9e7d('0x49')](_0x1e565f,_0x4c4667,_[_0x9e7d('0x4a')](_0x6493e7,_0xf85035)[_0x9e7d('0x4b')]()));}exports[_0x9e7d('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x3f67d6){if(_0x3f67d6[_0x9e7d('0x2b')]&&_0x3f67d6[_0x9e7d('0x2b')]>0x0){_0x3f67d6['originated']-=0x1;}else{logger['error'](_0x9e7d('0x4d'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x3bda64){return _0x3bda64&&_0x3bda64['length']>0x0;}exports[_0x9e7d('0x4e')]=checkContactEmpty;function erlangb(_0x992644,_0x5e7fc5){if(_0x5e7fc5===0x0){return 0x0;}var _0x272d7e=0x1;for(var _0x332d8f=0x1;_0x332d8f<=_0x5e7fc5;_0x332d8f+=0x1){_0x272d7e=0x1+_0x272d7e*_0x332d8f/_0x992644;}return 0x1/_0x272d7e;}exports[_0x9e7d('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x30fb49,_0x1e01b3,_0x4da3e3){if(_0x1e01b3>_0x4da3e3){for(var _0x149e83=0x0;_0x149e83<_0x1e01b3-_0x4da3e3;_0x149e83+=0x1){decrementOriginate(_0x30fb49);}}}exports[_0x9e7d('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xb8ef51){var _0x27ed98={};var _0x527690=['id',_0x9e7d('0x51'),_0x9e7d('0x52'),'tags',_0x9e7d('0x53')];if(_0xb8ef51){for(var _0x2adcc4 in _0xb8ef51){if(typeof _0xb8ef51[_0x2adcc4]!==_0x9e7d('0x54')){if(!_[_0x9e7d('0x30')](_0xb8ef51[_0x2adcc4])&&!_0x527690[_0x9e7d('0x3c')](_0x2adcc4)){_0x27ed98[util[_0x9e7d('0x44')](_0x9e7d('0x55'),_0x9e7d('0x56'),_0x2adcc4[_0x9e7d('0x57')]())]=_0xb8ef51[_0x2adcc4];}}}}return _0x27ed98;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xaa1b=['Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','checkContactLowerLimitOriginate','createdAt','description','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil'];(function(_0x2464c3,_0xd07b91){var _0x45e346=function(_0x11b2d8){while(--_0x11b2d8){_0x2464c3['push'](_0x2464c3['shift']());}};_0x45e346(++_0xd07b91);}(_0xaa1b,0x80));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))(_0xbaa1('0x3'));var timezones=require(_0xbaa1('0x4'))[_0xbaa1('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xbaa1('0x6'),'BLACKLIST':_0xbaa1('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xbaa1('0x8'),'DISACTIVED':_0xbaa1('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xbaa1('0xa'),'NULL_INTERVAL':_0xbaa1('0xb'),'OVERTIME_INTERVAL':_0xbaa1('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xbaa1('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xbaa1('0xe'),'UNKNOWN_TIMEZONE':_0xbaa1('0xf'),'UNREACHABLE_TRUNK':_0xbaa1('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4e6346){return _0x4e6346[_0xbaa1('0x11')]==='preview';}exports[_0xbaa1('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x57ea4b){return _0x57ea4b[_0xbaa1('0x13')]===_0xbaa1('0x14');}exports[_0xbaa1('0x15')]=isIVRCampaign;function isOutboundQueue(_0x222b28){return _0x222b28[_0xbaa1('0x13')]===_0xbaa1('0x16');}exports[_0xbaa1('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x35b7ae){return _0x35b7ae[_0xbaa1('0x18')];}exports[_0xbaa1('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x516b40){return _0x516b40['active'];}exports[_0xbaa1('0x1a')]=isIVRCampaignActive;function getSeconds(_0x3cfbd2,_0x15ae31){var _0x3700a2=moment(_0x3cfbd2)['milliseconds'](0x0);var _0x52710d=moment(_0x15ae31)[_0xbaa1('0x1b')](0x0);return _0x3700a2['diff'](_0x52710d,_0xbaa1('0x1c'));}exports[_0xbaa1('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x4850ee,_0x103f8e){var _0x13dadc=![];var _0x389ce0=_0x4850ee[_0xbaa1('0x11')]!==_0x103f8e[_0xbaa1('0x11')]||_0x4850ee[_0xbaa1('0x18')]!==_0x103f8e['dialActive']||_0x4850ee[_0xbaa1('0x1e')]!==_0x103f8e[_0xbaa1('0x1e')];var _0x261373=_0x4850ee[_0xbaa1('0x1f')]!==_0x103f8e['available']||_0x4850ee[_0xbaa1('0x20')]!==_0x103f8e['loggedIn']||_0x4850ee[_0xbaa1('0x21')]!==_0x103f8e['loggedInDb']||_0x4850ee[_0xbaa1('0x22')]!==_0x103f8e['paused']||_0x4850ee[_0xbaa1('0x23')]!==_0x103f8e[_0xbaa1('0x23')]||_0x4850ee[_0xbaa1('0x24')]!==_0x103f8e['pTalking']||_0x4850ee[_0xbaa1('0x25')]!==_0x103f8e[_0xbaa1('0x25')]||_0x4850ee['inUse']!==_0x103f8e[_0xbaa1('0x26')]||_0x4850ee[_0xbaa1('0x27')]!==_0x103f8e[_0xbaa1('0x27')];if(_0x4850ee['Trunk']&&_0x103f8e['Trunk']){_0x13dadc=_0x4850ee[_0xbaa1('0x28')]['name']!==_0x103f8e['Trunk'][_0xbaa1('0x29')]||_0x4850ee[_0xbaa1('0x28')][_0xbaa1('0x2a')]!==_0x103f8e['Trunk']['active'];}return _0x389ce0||_0x261373||_0x13dadc;}exports[_0xbaa1('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x48bbb0){var _0x1024a0=null;var _0x479f6e=_0x48bbb0[_0xbaa1('0x2c')];if(_[_0xbaa1('0x2d')](_0x48bbb0['dialGlobalInterval'])||_[_0xbaa1('0x2d')](_0x48bbb0['Interval'])||_['isNil'](_0x48bbb0[_0xbaa1('0x2e')][_0xbaa1('0x2f')])){_0x1024a0=CAMPAIGN_STATUS[_0xbaa1('0x30')];}else if(_[_0xbaa1('0x31')](_0x48bbb0['dialGlobalInterval'])||_['isEmpty'](_0x48bbb0[_0xbaa1('0x2e')][_0xbaa1('0x2f')])){_0x1024a0=CAMPAIGN_STATUS[_0xbaa1('0x32')];}else if(_0x479f6e&&!timezones[_0x479f6e]){_0x1024a0=CAMPAIGN_STATUS[_0xbaa1('0x33')];}return _0x1024a0;}function checkAnyValidTrunk(_0x8f6f11,_0x538860){var _0x32ae31=null;var _0x4cd52a=_0xbaa1('0x34');var _0x4266d8=[_0xbaa1('0x35'),_0xbaa1('0x36')];var _0x51e833=!![];if(_0x8f6f11[_0xbaa1('0x28')]&&_0x8f6f11['Trunk'][_0xbaa1('0x2a')]){_0x4cd52a+=_0x8f6f11[_0xbaa1('0x28')][_0xbaa1('0x29')];_0x32ae31=_0x538860[_0x4cd52a];_0x51e833=_0x4266d8[_0xbaa1('0x37')](_0x32ae31[_0xbaa1('0x38')]);}else if(_0x8f6f11[_0xbaa1('0x39')]&&_0x8f6f11['TrunkBackup'][_0xbaa1('0x2a')]){_0x4cd52a+=_0x8f6f11[_0xbaa1('0x39')]['name'];_0x32ae31=_0x538860[_0x4cd52a];_0x51e833=_0x4266d8[_0xbaa1('0x37')](_0x32ae31[_0xbaa1('0x38')]);}return _0x51e833;}function getQueueCampaignStatusMessage(_0x59ca33,_0x310539){var _0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x6')];var _0x58a558=isPreviewCampaign(_0x59ca33);if(!isQueueCampaignActive(_0x59ca33)){if(_0x58a558){_0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x3a')];}else{if(_0x59ca33[_0xbaa1('0x27')]===0x0&&_0x59ca33[_0xbaa1('0x23')]===0x0&&_0x59ca33[_0xbaa1('0x25')]===0x0&&(_0x59ca33[_0xbaa1('0x24')]||0x0)===0x0){_0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x3a')];}else{_0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x3b')];}}}else if(_0x59ca33['loggedIn']===0x0){_0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x3c')];}else if(!checkAnyValidTrunk(_0x59ca33,_0x310539)){_0x1cef9b=CAMPAIGN_STATUS[_0xbaa1('0x3d')];}else if(!isPreviewCampaign(_0x59ca33)){var _0x2d4d3f=checkAnyValidQueueCampaignInterval(_0x59ca33);if(_0x2d4d3f){_0x1cef9b=_0x2d4d3f;}}return _0x1cef9b;}exports[_0xbaa1('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x54d596){var _0x1841e4=CAMPAIGN_STATUS[_0xbaa1('0x3b')];if(_0x54d596['originated']===0x0&&_0x54d596[_0xbaa1('0x23')]===0x0&&_0x54d596[_0xbaa1('0x25')]===0x0&&(_0x54d596[_0xbaa1('0x24')]||0x0)===0x0){_0x1841e4=CAMPAIGN_STATUS[_0xbaa1('0x3a')];}return _0x1841e4;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x262cfe){var _0x38071a=_0x262cfe['match'](/"(.*?)"/);return _0x38071a?_0x38071a[0x1]:_0x262cfe;}exports[_0xbaa1('0x3f')]=extractCalleridName;function getCallerId(_0x160775,_0x4d8ab1,_0x1e734e){if(!_[_0xbaa1('0x40')](_0x1e734e)&&typeof _0x1e734e==='string'&&!_['isEmpty'](_0x1e734e)){if(!_[_0xbaa1('0x40')](_0x4d8ab1)&&typeof _0x4d8ab1===_0xbaa1('0x41')&&!_[_0xbaa1('0x31')](_0x4d8ab1)){return util[_0xbaa1('0x42')](_0xbaa1('0x43'),_0x4d8ab1,_0x1e734e);}return util[_0xbaa1('0x42')]('\x22%s\x22\x20<%s>',_0x1e734e,_0x1e734e);}if(!_[_0xbaa1('0x40')](_0x160775)&&typeof _0x160775===_0xbaa1('0x41')&&!_[_0xbaa1('0x31')](_0x160775)){return _0x160775;}return _0xbaa1('0x44');}exports[_0xbaa1('0x45')]=getCallerId;function getCallerIdRandom(_0x33872a,_0x1181b1){var _0xfe9f06;var _0x191b16;var _0x15357a;if(_0x1181b1<=0x0){_0x1181b1=0x1;}_0xfe9f06=new RegExp(_0xbaa1('0x46')+_0x1181b1+'}$');_0x191b16=Math[_0xbaa1('0x47')](0xa,_0x1181b1-0x1);_0x15357a=Math[_0xbaa1('0x47')](0xa,_0x1181b1)-0x1;return util['format']('%s',_[_0xbaa1('0x48')](_0x33872a,_0xfe9f06,_['random'](_0x191b16,_0x15357a)[_0xbaa1('0x49')]()));}exports[_0xbaa1('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x59e0c2){if(_0x59e0c2[_0xbaa1('0x27')]&&_0x59e0c2['originated']>0x0){_0x59e0c2[_0xbaa1('0x27')]-=0x1;}else{logger[_0xbaa1('0x4b')](_0xbaa1('0x4c'));}}exports[_0xbaa1('0x4d')]=decrementOriginate;function checkContactEmpty(_0x7c16b0){return _0x7c16b0&&_0x7c16b0['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0xa8c028,_0x38e15d){if(_0x38e15d===0x0){return 0x0;}var _0x1ccede=0x1;for(var _0x5cd9fb=0x1;_0x5cd9fb<=_0x38e15d;_0x5cd9fb+=0x1){_0x1ccede=0x1+_0x1ccede*_0x5cd9fb/_0xa8c028;}return 0x1/_0x1ccede;}exports[_0xbaa1('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x4f50ee,_0x3a21ba,_0x20ad5b){if(_0x3a21ba>_0x20ad5b){for(var _0x21e457=0x0;_0x21e457<_0x3a21ba-_0x20ad5b;_0x21e457+=0x1){decrementOriginate(_0x4f50ee);}}}exports[_0xbaa1('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x47676e){var _0x122405={};var _0x3a54cf=['id',_0xbaa1('0x50'),_0xbaa1('0x51'),'tags','updatedAt'];if(_0x47676e){for(var _0x5e9eba in _0x47676e){if(typeof _0x47676e[_0x5e9eba]!==_0xbaa1('0x52')){if(!_[_0xbaa1('0x2d')](_0x47676e[_0x5e9eba])&&!_0x3a54cf[_0xbaa1('0x37')](_0x5e9eba)){_0x122405[util['format'](_0xbaa1('0x53'),_0xbaa1('0x54'),_0x5e9eba[_0xbaa1('0x55')]())]=_0x47676e[_0x5e9eba];}}}}return _0x122405;}exports[_0xbaa1('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 22f2da9..d68f985 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(_0x4a8f59,_0x116da5){var _0x3b6afc=function(_0x14bf18){while(--_0x14bf18){_0x4a8f59['push'](_0x4a8f59['shift']());}};_0x3b6afc(++_0x116da5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x503a35,_0x23ecdd){var _0x270d52=function(_0x4e0407){while(--_0x4e0407){_0x503a35['push'](_0x503a35['shift']());}};_0x270d52(++_0x23ecdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 db09c5c..6e28e30 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 _0xb5da=['originateresponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup'];(function(_0x3cc961,_0x18ebf6){var _0x3bd6de=function(_0x425ad9){while(--_0x425ad9){_0x3cc961['push'](_0x3cc961['shift']());}};_0x3bd6de(++_0x18ebf6);}(_0xb5da,0x14c));var _0xab5d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb5da[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0xab5d('0x0'));var BPromise=require(_0xab5d('0x1'));var uuid=require(_0xab5d('0x2'));var moment=require(_0xab5d('0x3'));var path=require(_0xab5d('0x4'));var tiff2pdf=require(_0xab5d('0x5'));var gs=require(_0xab5d('0x6'));var logger=require(_0xab5d('0x7'))(_0xab5d('0x8'));var ami=require(_0xab5d('0x9'));var rpcDb=require(_0xab5d('0xa'));var Channel=require(_0xab5d('0xb'));var ut=require(_0xab5d('0xc'));var Action=require(_0xab5d('0xd'));var faxAccount=require(_0xab5d('0xe'));var attachment=require(_0xab5d('0xf'));var faxMessage=require(_0xab5d('0x10'));function Fax(_0x4d7400){this[_0xab5d('0x11')]={};this['faxAccounts']=_0x4d7400[_0xab5d('0x12')];this['trunks']=_0x4d7400[_0xab5d('0x13')];this[_0xab5d('0x14')]={};ami['on'](_0xab5d('0x15'),this[_0xab5d('0x16')][_0xab5d('0x17')](this));ami['on']('varset',this[_0xab5d('0x18')]['bind'](this));ami['on'](_0xab5d('0x19'),this[_0xab5d('0x1a')]['bind'](this));ami['on'](_0xab5d('0x1b'),this[_0xab5d('0x1c')][_0xab5d('0x17')](this));ami['on'](_0xab5d('0x1d'),this[_0xab5d('0x1e')][_0xab5d('0x17')](this));ami['on'](_0xab5d('0x1f'),this[_0xab5d('0x20')][_0xab5d('0x17')](this));ami['on']('hangup',this[_0xab5d('0x21')][_0xab5d('0x17')](this));ami['on'](_0xab5d('0x22'),this['syncOriginateResponse'][_0xab5d('0x17')](this));}Fax['prototype']['syncNewchannel']=function(_0x18155e){if(_0x18155e[_0xab5d('0x23')]===_0xab5d('0x24')){for(var _0x5d60de in this[_0xab5d('0x12')]){if(this[_0xab5d('0x12')][_0xab5d('0x25')](_0x5d60de)){if(_0x18155e[_0xab5d('0x26')]===this['faxAccounts'][_0x5d60de][_0xab5d('0x27')]){this[_0xab5d('0x11')][_0x18155e[_0xab5d('0x28')]]={};this[_0xab5d('0x11')][_0x18155e['uniqueid']][_0xab5d('0x29')]=_0x18155e[_0xab5d('0x29')];this[_0xab5d('0x11')][_0x18155e[_0xab5d('0x28')]]['id']=this[_0xab5d('0x12')][_0x5d60de]['id'];this[_0xab5d('0x11')][_0x18155e[_0xab5d('0x28')]][_0xab5d('0x2a')]=this[_0xab5d('0x12')][_0x5d60de][_0xab5d('0x2a')];logger[_0xab5d('0x2b')](_0x18155e[_0xab5d('0x28')],_0xab5d('0x2c'));}}}}if(this[_0xab5d('0x14')][_0x18155e[_0xab5d('0x28')]]){this[_0xab5d('0x11')][_0x18155e[_0xab5d('0x28')]]={};this[_0xab5d('0x11')][_0x18155e[_0xab5d('0x28')]][_0xab5d('0x29')]=_0x18155e[_0xab5d('0x29')];logger[_0xab5d('0x2b')](_0x18155e[_0xab5d('0x28')],_0xab5d('0x2c'));}};Fax[_0xab5d('0x2d')][_0xab5d('0x18')]=function(_0x41f21d){if(this[_0xab5d('0x11')][_0x41f21d['uniqueid']]){for(var _0x214a9b in _0x41f21d['variable']){if(_0x41f21d[_0xab5d('0x2e')]['hasOwnProperty'](_0x214a9b)){this['channels'][_0x41f21d[_0xab5d('0x28')]][_0x214a9b]=_0x41f21d[_0xab5d('0x2f')];}}}};Fax[_0xab5d('0x2d')][_0xab5d('0x1a')]=function(_0x2bb3a8){if(this[_0xab5d('0x11')][_0x2bb3a8[_0xab5d('0x28')]]){this[_0xab5d('0x11')][_0x2bb3a8[_0xab5d('0x28')]][_0xab5d('0x30')]=_0x2bb3a8[_0xab5d('0x30')];this[_0xab5d('0x11')][_0x2bb3a8['uniqueid']][_0xab5d('0x31')]=_0x2bb3a8[_0xab5d('0x31')];}};Fax[_0xab5d('0x2d')][_0xab5d('0x1c')]=function(_0x32fe0a){if(this[_0xab5d('0x11')][_0x32fe0a['uniqueid']]){for(var _0x5df76d in _0x32fe0a[_0xab5d('0x2e')]){if(_0x32fe0a[_0xab5d('0x2e')]['hasOwnProperty'](_0x5df76d)){this[_0xab5d('0x11')][_0x32fe0a[_0xab5d('0x28')]][_0x5df76d]=_0x32fe0a[_0xab5d('0x2f')];}}}};Fax[_0xab5d('0x2d')][_0xab5d('0x1e')]=function(_0x5e1b80){if(this[_0xab5d('0x11')][_0x5e1b80['uniqueid']]){this['channels'][_0x5e1b80[_0xab5d('0x28')]][_0xab5d('0x32')]=_0x5e1b80[_0xab5d('0x32')];this[_0xab5d('0x11')][_0x5e1b80[_0xab5d('0x28')]]['status']=_0x5e1b80[_0xab5d('0x33')];this['channels'][_0x5e1b80[_0xab5d('0x28')]]['localstationid']=_0x5e1b80[_0xab5d('0x27')];this[_0xab5d('0x11')][_0x5e1b80[_0xab5d('0x28')]][_0xab5d('0x34')]=_0x5e1b80[_0xab5d('0x34')];logger[_0xab5d('0x2b')](_0x5e1b80[_0xab5d('0x28')],_0xab5d('0x35'));}};Fax['prototype'][_0xab5d('0x20')]=function(_0x1d066b){var _0x828d21=this;if(this[_0xab5d('0x11')][_0x1d066b['uniqueid']]){var _0x2adaae=this[_0xab5d('0x11')][_0x1d066b[_0xab5d('0x28')]]['id'];this[_0xab5d('0x11')][_0x1d066b[_0xab5d('0x28')]][_0xab5d('0x36')]=_0x1d066b['remotestationid'];this[_0xab5d('0x11')][_0x1d066b['uniqueid']][_0xab5d('0x37')]=_0x1d066b['pagestransferred'];this['channels'][_0x1d066b[_0xab5d('0x28')]][_0xab5d('0x27')]=_0x1d066b['localstationid'];this[_0xab5d('0x11')][_0x1d066b[_0xab5d('0x28')]]['resolution']=_0x1d066b[_0xab5d('0x38')];this['channels'][_0x1d066b[_0xab5d('0x28')]]['transferrate']=_0x1d066b[_0xab5d('0x39')];this['channels'][_0x1d066b[_0xab5d('0x28')]][_0xab5d('0x34')]=_0x1d066b[_0xab5d('0x34')];this[_0xab5d('0x11')][_0x1d066b['uniqueid']][_0xab5d('0x3a')]=_0x1d066b['calleridnum'];if(this[_0xab5d('0x11')][_0x1d066b[_0xab5d('0x28')]][_0xab5d('0x37')]>0x0){tiff2pdf(_0x1d066b[_0xab5d('0x34')],'/var/opt/motion2/server/files/attachments/',function(_0x4672c4){logger['info'](_0x1d066b[_0xab5d('0x28')],_0xab5d('0x3b'),_0x4672c4[_0xab5d('0x3c')]);attachment[_0xab5d('0x3d')]({'name':path['parse'](_0x1d066b[_0xab5d('0x34')])[_0xab5d('0x2a')],'basename':path[_0xab5d('0x3e')](_0x1d066b[_0xab5d('0x34')])[_0xab5d('0x2a')]+_0xab5d('0x3f'),'type':_0xab5d('0x40')})[_0xab5d('0x41')](function(_0x528329){faxAccount[_0xab5d('0x42')](_0x2adaae,{'from':_0x1d066b['calleridnum'],'mapKey':_0xab5d('0x8'),'body':path[_0xab5d('0x3e')](_0x1d066b[_0xab5d('0x34')])[_0xab5d('0x2a')]+_0xab5d('0x3f'),'AttachmentId':_0x528329['id']})[_0xab5d('0x43')](function(_0x17c126){logger[_0xab5d('0x44')](_0x1d066b[_0xab5d('0x28')],_0xab5d('0x45'),JSON[_0xab5d('0x46')](_0x17c126));});})['catch'](function(_0x5648fc){logger[_0xab5d('0x44')](_0x1d066b[_0xab5d('0x28')],_0xab5d('0x47'),JSON[_0xab5d('0x46')](_0x5648fc));});});}logger[_0xab5d('0x2b')](_0x1d066b['uniqueid'],_0xab5d('0x47'));}};Fax[_0xab5d('0x2d')][_0xab5d('0x48')]=function(_0x2c21ca){if(this[_0xab5d('0x14')][_0x2c21ca[_0xab5d('0x28')]]){_['merge'](this[_0xab5d('0x11')][_0x2c21ca[_0xab5d('0x28')]],_['pick'](_0x2c21ca,[_0xab5d('0x49'),_0xab5d('0x4a')]));}};function updateStatus(_0x1b7a45){if(_0x1b7a45['AttachmentId']){faxMessage[_0xab5d('0x4b')](_0x1b7a45[_0xab5d('0x4c')],{'failMessage':_0xab5d('0x4d')})[_0xab5d('0x41')](function(_0x265850){ut[_0xab5d('0x4e')](_0xab5d('0x4f'),_0x265850);})[_0xab5d('0x43')](function(_0x4af34f){ut[_0xab5d('0x4e')](_0xab5d('0x50'),_0x4af34f);});}else{ut[_0xab5d('0x4e')](_0xab5d('0x51'));}}Fax['prototype']['updateStatus']=function(_0x346a0c,_0x15df3f,_0x3e345c){var _0x28553b=this;var _0x18ccc2={};if(_0x15df3f){_0x18ccc2={'read':_0x15df3f};}else{_0x18ccc2={'failMessage':_0x3e345c};}if(this[_0xab5d('0x14')][_0x346a0c][_0xab5d('0x4c')]){faxMessage[_0xab5d('0x4b')](this[_0xab5d('0x14')][_0x346a0c][_0xab5d('0x4c')],_0x18ccc2)[_0xab5d('0x41')](function(_0x3b1e58){ut[_0xab5d('0x4e')](_0xab5d('0x52'),_0x3b1e58);})[_0xab5d('0x43')](function(_0xa0c240){ut[_0xab5d('0x4e')](_0xab5d('0x53'),_0xa0c240);})['finally'](function(){delete _0x28553b[_0xab5d('0x11')][_0x346a0c];delete _0x28553b[_0xab5d('0x14')][_0x346a0c];});}else{ut['logger'](_0xab5d('0x54'));delete this[_0xab5d('0x11')][_0x346a0c];delete this['actions'][_0x346a0c];}};Fax['prototype']['syncHangup']=function(_0x432ce4){var _0x394d7c=this;if(this['channels'][_0x432ce4[_0xab5d('0x28')]]){if(this['actions'][_0x432ce4[_0xab5d('0x28')]]){this[_0xab5d('0x11')][_0x432ce4[_0xab5d('0x28')]]['id']=this['actions'][_0x432ce4[_0xab5d('0x28')]]['id'];this[_0xab5d('0x11')][_0x432ce4[_0xab5d('0x28')]][_0xab5d('0x2a')]=this[_0xab5d('0x14')][_0x432ce4[_0xab5d('0x28')]][_0xab5d('0x2a')];}logger['info'](_0x432ce4[_0xab5d('0x28')],this['actions'][_0x432ce4[_0xab5d('0x28')]]?'\x20hangup\x20sendFile\x20':_0xab5d('0x55'),JSON[_0xab5d('0x46')](this[_0xab5d('0x11')][_0x432ce4[_0xab5d('0x28')]]));if(this[_0xab5d('0x14')][_0x432ce4[_0xab5d('0x28')]]){if(this[_0xab5d('0x11')][_0x432ce4[_0xab5d('0x28')]][_0xab5d('0x56')]>0x0&&this[_0xab5d('0x11')][_0x432ce4['uniqueid']][_0xab5d('0x1d')]===_0xab5d('0x57')){this[_0xab5d('0x58')](_0x432ce4[_0xab5d('0x28')],!![]);}else{this['updateStatus'](_0x432ce4[_0xab5d('0x28')],![],this[_0xab5d('0x11')][_0x432ce4['uniqueid']][_0xab5d('0x59')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x432ce4[_0xab5d('0x28')]][_0xab5d('0x59')]:_0xab5d('0x5a'));}}}};Fax['prototype'][_0xab5d('0x5b')]=function(_0x45a75e){var _0x2608bf=this;return new BPromise(function(_0x2e2236,_0x5d4226){_0x2608bf[_0xab5d('0x5c')](_0x45a75e,_0x2608bf['faxAccounts'][_0x45a75e[_0xab5d('0x5d')]])[_0xab5d('0x41')](function(_0x395c2f){ut[_0xab5d('0x4e')](_0xab5d('0x5e'),_0x395c2f);_0x2e2236(ut[_0xab5d('0x3c')](_0xab5d('0x5f')));})[_0xab5d('0x43')](function(_0x8f139f){ut[_0xab5d('0x4e')]('[Fax][execOriginate][failure]',_0x8f139f);updateStatus(_0x45a75e);_0x5d4226(ut[_0xab5d('0x3c')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0xb73bb4){var _0x642d6b=this;return new BPromise(function(_0x2a0c5d,_0x9ac782){var _0x1c1165=_0x642d6b['checkTrunk'](_0x642d6b['faxAccounts'][_0xb73bb4[_0xab5d('0x5d')]][_0xab5d('0x60')],_0xb73bb4);if(_0x1c1165[_0xab5d('0x61')]){_0x2a0c5d(ut[_0xab5d('0x3c')](_0xab5d('0x62')));}else{_0x9ac782(ut[_0xab5d('0x3c')](_0x1c1165[_0xab5d('0x3c')]));}});};function originate(_0x293ace,_0x3ce86c,_0x425d0d){return new BPromise(function(_0x4ee55a,_0x4feee5){if(_0x425d0d){var _0x10eb09=util[_0xab5d('0x63')](_0xab5d('0x64'),path[_0xab5d('0x3e')](_0x293ace[_0xab5d('0x4')])[_0xab5d('0x2a')],_0x293ace[_0xab5d('0x4')]);gs[_0xab5d('0x65')](_0x10eb09)['then'](function(){_0x293ace['path']=util[_0xab5d('0x63')](_0xab5d('0x66'),path[_0xab5d('0x3e')](_0x293ace[_0xab5d('0x4')])[_0xab5d('0x67')],path[_0xab5d('0x3e')](_0x293ace['path'])[_0xab5d('0x2a')]);_0x3ce86c[_0xab5d('0x68')]=_0x293ace[_0xab5d('0x4')];ut['logger'](_0xab5d('0x69'),'');ami['Action'](ut[_0xab5d('0x6a')](_0x293ace,_0x3ce86c))[_0xab5d('0x41')](function(_0x4e4549){_0x4ee55a(_0x4e4549);})['catch'](function(_0x243dbc){_0x4feee5(_0x243dbc);});})[_0xab5d('0x43')](function(_0x199c34){_0x4feee5(_0x199c34);});}else{ami['Action'](ut[_0xab5d('0x6a')](_0x293ace,_0x3ce86c))['then'](function(_0x4ddf2d){_0x4ee55a(_0x4ddf2d);})['catch'](function(_0xf4c75d){_0x4feee5(_0xf4c75d);});}});}Fax[_0xab5d('0x2d')][_0xab5d('0x5c')]=function(_0x51e7a0,_0x5decc9){var _0x435797=this;return new BPromise(function(_0x5c2415,_0x58017c){var _0x164f0a=uuid['v4']();var _0x3aa7d9=ut[_0xab5d('0x6b')](_0x51e7a0,_0x5decc9);_0x435797[_0xab5d('0x14')][_0x164f0a]=new Action(_0x164f0a,_0x5decc9,_0x51e7a0);var _0x3b8d72=_0x435797[_0xab5d('0x14')][_0x164f0a];if(path[_0xab5d('0x3e')](_0x51e7a0[_0xab5d('0x4')])['ext']==='.pdf'){originate(_0x3b8d72,_0x3aa7d9,!![])[_0xab5d('0x41')](function(_0x1b351e){_0x5c2415(_0x1b351e);})[_0xab5d('0x43')](function(_0x10528a){_0x58017c(_0x10528a);});}else{originate(_0x3b8d72,_0x3aa7d9,![])[_0xab5d('0x41')](function(_0x486cc2){_0x5c2415(_0x486cc2);})['catch'](function(_0x31609b){_0x58017c(_0x31609b);});}});};Fax['prototype'][_0xab5d('0x6c')]=function(_0x429f8d){return!_[_0xab5d('0x6d')](_0x429f8d)&&!_[_0xab5d('0x6d')](_0x429f8d[_0xab5d('0x2a')])&&!_[_0xab5d('0x6d')](_0x429f8d[_0xab5d('0x6e')])&&_0x429f8d[_0xab5d('0x6e')]&&!_[_0xab5d('0x6d')](this['trunks'][util[_0xab5d('0x63')](_0xab5d('0x6f'),_0x429f8d[_0xab5d('0x2a')])])&&!_[_0xab5d('0x6d')](this[_0xab5d('0x13')][util[_0xab5d('0x63')]('SIP/%s',_0x429f8d[_0xab5d('0x2a')])][_0xab5d('0x33')])&&(this['trunks'][util[_0xab5d('0x63')](_0xab5d('0x6f'),_0x429f8d[_0xab5d('0x2a')])][_0xab5d('0x33')]==='reachable'||this[_0xab5d('0x13')][util[_0xab5d('0x63')](_0xab5d('0x6f'),_0x429f8d[_0xab5d('0x2a')])][_0xab5d('0x33')]===_0xab5d('0x70'));};Fax['prototype'][_0xab5d('0x71')]=function(_0x3a9213,_0x262fc6){if(!this[_0xab5d('0x6c')](_0x3a9213)){ut[_0xab5d('0x4e')](_0xab5d('0x72'),_[_0xab5d('0x6d')](_0x3a9213)?'':_0x3a9213[_0xab5d('0x2a')]+_0xab5d('0x73'));return{'isValid':![],'message':_0xab5d('0x74')};}if(_[_0xab5d('0x6d')](_0x262fc6[_0xab5d('0x8')])){ut[_0xab5d('0x4e')](_0xab5d('0x75'),JSON[_0xab5d('0x46')](_0x262fc6));return{'isValid':![],'message':_0xab5d('0x76')};}if(_[_0xab5d('0x6d')](_0x262fc6[_0xab5d('0x4')])){ut[_0xab5d('0x4e')](_0xab5d('0x77'),JSON[_0xab5d('0x46')](_0x262fc6));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xab5d('0x78')};};module[_0xab5d('0x79')]=Fax; \ No newline at end of file +var _0xea72=['checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','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','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20failed'];(function(_0x40018d,_0x3195c1){var _0x50c5d8=function(_0x35a6d4){while(--_0x35a6d4){_0x40018d['push'](_0x40018d['shift']());}};_0x50c5d8(++_0x3195c1);}(_0xea72,0x10b));var _0x2ea7=function(_0x3f5496,_0x281f70){_0x3f5496=_0x3f5496-0x0;var _0x2a766c=_0xea72[_0x3f5496];return _0x2a766c;};'use strict';var util=require(_0x2ea7('0x0'));var _=require(_0x2ea7('0x1'));var BPromise=require(_0x2ea7('0x2'));var uuid=require(_0x2ea7('0x3'));var moment=require(_0x2ea7('0x4'));var path=require(_0x2ea7('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x2ea7('0x6'));var logger=require('../../../config/logger')(_0x2ea7('0x7'));var ami=require(_0x2ea7('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x2ea7('0x9'));var ut=require(_0x2ea7('0xa'));var Action=require(_0x2ea7('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x2ea7('0xc'));var faxMessage=require(_0x2ea7('0xd'));function Fax(_0x4696e8){this[_0x2ea7('0xe')]={};this[_0x2ea7('0xf')]=_0x4696e8[_0x2ea7('0xf')];this[_0x2ea7('0x10')]=_0x4696e8[_0x2ea7('0x10')];this[_0x2ea7('0x11')]={};ami['on'](_0x2ea7('0x12'),this[_0x2ea7('0x13')]['bind'](this));ami['on'](_0x2ea7('0x14'),this['syncVarSet'][_0x2ea7('0x15')](this));ami['on'](_0x2ea7('0x16'),this[_0x2ea7('0x17')][_0x2ea7('0x15')](this));ami['on'](_0x2ea7('0x18'),this[_0x2ea7('0x19')][_0x2ea7('0x15')](this));ami['on'](_0x2ea7('0x1a'),this[_0x2ea7('0x1b')][_0x2ea7('0x15')](this));ami['on'](_0x2ea7('0x1c'),this[_0x2ea7('0x1d')][_0x2ea7('0x15')](this));ami['on'](_0x2ea7('0x1e'),this[_0x2ea7('0x1f')][_0x2ea7('0x15')](this));ami['on']('originateresponse',this[_0x2ea7('0x20')][_0x2ea7('0x15')](this));}Fax[_0x2ea7('0x21')][_0x2ea7('0x13')]=function(_0x2037b4){if(_0x2037b4[_0x2ea7('0x22')]===_0x2ea7('0x23')){for(var _0x497302 in this[_0x2ea7('0xf')]){if(this[_0x2ea7('0xf')][_0x2ea7('0x24')](_0x497302)){if(_0x2037b4[_0x2ea7('0x25')]===this[_0x2ea7('0xf')][_0x497302]['localstationid']){this[_0x2ea7('0xe')][_0x2037b4[_0x2ea7('0x26')]]={};this['channels'][_0x2037b4['uniqueid']]['channel']=_0x2037b4['channel'];this['channels'][_0x2037b4[_0x2ea7('0x26')]]['id']=this[_0x2ea7('0xf')][_0x497302]['id'];this[_0x2ea7('0xe')][_0x2037b4[_0x2ea7('0x26')]][_0x2ea7('0x27')]=this[_0x2ea7('0xf')][_0x497302]['name'];logger[_0x2ea7('0x28')](_0x2037b4[_0x2ea7('0x26')],_0x2ea7('0x29'));}}}}if(this[_0x2ea7('0x11')][_0x2037b4[_0x2ea7('0x26')]]){this['channels'][_0x2037b4[_0x2ea7('0x26')]]={};this[_0x2ea7('0xe')][_0x2037b4['uniqueid']]['channel']=_0x2037b4[_0x2ea7('0x2a')];logger[_0x2ea7('0x28')](_0x2037b4[_0x2ea7('0x26')],_0x2ea7('0x29'));}};Fax['prototype']['syncVarSet']=function(_0x504560){if(this[_0x2ea7('0xe')][_0x504560[_0x2ea7('0x26')]]){for(var _0x4adc3c in _0x504560[_0x2ea7('0x2b')]){if(_0x504560[_0x2ea7('0x2b')]['hasOwnProperty'](_0x4adc3c)){this[_0x2ea7('0xe')][_0x504560['uniqueid']][_0x4adc3c]=_0x504560[_0x2ea7('0x2c')];}}}};Fax[_0x2ea7('0x21')][_0x2ea7('0x17')]=function(_0x4f64f6){if(this[_0x2ea7('0xe')][_0x4f64f6[_0x2ea7('0x26')]]){this['channels'][_0x4f64f6[_0x2ea7('0x26')]][_0x2ea7('0x2d')]=_0x4f64f6[_0x2ea7('0x2d')];this[_0x2ea7('0xe')][_0x4f64f6[_0x2ea7('0x26')]][_0x2ea7('0x2e')]=_0x4f64f6[_0x2ea7('0x2e')];}};Fax[_0x2ea7('0x21')][_0x2ea7('0x19')]=function(_0x540f66){if(this[_0x2ea7('0xe')][_0x540f66[_0x2ea7('0x26')]]){for(var _0x26d40a in _0x540f66[_0x2ea7('0x2b')]){if(_0x540f66['variable'][_0x2ea7('0x24')](_0x26d40a)){this[_0x2ea7('0xe')][_0x540f66['uniqueid']][_0x26d40a]=_0x540f66[_0x2ea7('0x2c')];}}}};Fax[_0x2ea7('0x21')][_0x2ea7('0x1b')]=function(_0x2c955b){if(this[_0x2ea7('0xe')][_0x2c955b['uniqueid']]){this[_0x2ea7('0xe')][_0x2c955b['uniqueid']][_0x2ea7('0x2f')]=_0x2c955b[_0x2ea7('0x2f')];this['channels'][_0x2c955b[_0x2ea7('0x26')]][_0x2ea7('0x30')]=_0x2c955b['status'];this[_0x2ea7('0xe')][_0x2c955b['uniqueid']][_0x2ea7('0x31')]=_0x2c955b[_0x2ea7('0x31')];this[_0x2ea7('0xe')][_0x2c955b[_0x2ea7('0x26')]]['filename']=_0x2c955b[_0x2ea7('0x32')];logger[_0x2ea7('0x28')](_0x2c955b[_0x2ea7('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x2ea7('0x1d')]=function(_0x39a757){var _0x237da8=this;if(this[_0x2ea7('0xe')][_0x39a757['uniqueid']]){var _0x413f47=this[_0x2ea7('0xe')][_0x39a757['uniqueid']]['id'];this[_0x2ea7('0xe')][_0x39a757[_0x2ea7('0x26')]]['remotestationid']=_0x39a757[_0x2ea7('0x33')];this['channels'][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x34')]=_0x39a757[_0x2ea7('0x34')];this[_0x2ea7('0xe')][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x31')]=_0x39a757[_0x2ea7('0x31')];this[_0x2ea7('0xe')][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x35')]=_0x39a757['resolution'];this['channels'][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x36')]=_0x39a757[_0x2ea7('0x36')];this[_0x2ea7('0xe')][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x32')]=_0x39a757[_0x2ea7('0x32')];this[_0x2ea7('0xe')][_0x39a757['uniqueid']][_0x2ea7('0x37')]=_0x39a757[_0x2ea7('0x37')];if(this['channels'][_0x39a757[_0x2ea7('0x26')]][_0x2ea7('0x34')]>0x0){tiff2pdf(_0x39a757[_0x2ea7('0x32')],_0x2ea7('0x38'),function(_0x2efdc7){logger[_0x2ea7('0x28')](_0x39a757[_0x2ea7('0x26')],_0x2ea7('0x39'),_0x2efdc7[_0x2ea7('0x3a')]);attachment['create']({'name':path[_0x2ea7('0x3b')](_0x39a757[_0x2ea7('0x32')])[_0x2ea7('0x27')],'basename':path['parse'](_0x39a757[_0x2ea7('0x32')])[_0x2ea7('0x27')]+'.pdf','type':_0x2ea7('0x3c')})['then'](function(_0x2e8a3d){faxAccount[_0x2ea7('0x3d')](_0x413f47,{'from':_0x39a757[_0x2ea7('0x37')],'mapKey':_0x2ea7('0x7'),'body':path[_0x2ea7('0x3b')](_0x39a757[_0x2ea7('0x32')])['name']+_0x2ea7('0x3e'),'AttachmentId':_0x2e8a3d['id']})[_0x2ea7('0x3f')](function(_0x5a8686){logger[_0x2ea7('0x40')](_0x39a757['uniqueid'],_0x2ea7('0x41'),JSON[_0x2ea7('0x42')](_0x5a8686));});})['catch'](function(_0x2c7d69){logger[_0x2ea7('0x40')](_0x39a757[_0x2ea7('0x26')],'\x20receiveFax\x20',JSON[_0x2ea7('0x42')](_0x2c7d69));});});}logger['info'](_0x39a757[_0x2ea7('0x26')],_0x2ea7('0x43'));}};Fax[_0x2ea7('0x21')][_0x2ea7('0x20')]=function(_0x3f179e){if(this[_0x2ea7('0x11')][_0x3f179e[_0x2ea7('0x26')]]){_[_0x2ea7('0x44')](this[_0x2ea7('0xe')][_0x3f179e[_0x2ea7('0x26')]],_[_0x2ea7('0x45')](_0x3f179e,[_0x2ea7('0x46'),_0x2ea7('0x47')]));}};function updateStatus(_0x57ffe8){if(_0x57ffe8['AttachmentId']){faxMessage[_0x2ea7('0x48')](_0x57ffe8[_0x2ea7('0x49')],{'failMessage':_0x2ea7('0x4a')})['then'](function(_0x1584a4){ut['logger']('[Fax][Message][Error][Updated]',_0x1584a4);})[_0x2ea7('0x3f')](function(_0x5e637d){ut[_0x2ea7('0x4b')](_0x2ea7('0x4c'),_0x5e637d);});}else{ut['logger'](_0x2ea7('0x4d'));}}Fax[_0x2ea7('0x21')][_0x2ea7('0x4e')]=function(_0x54169b,_0x4a7e44,_0x41ae81){var _0x1b5b7c=this;var _0x56ad16={};if(_0x4a7e44){_0x56ad16={'read':_0x4a7e44};}else{_0x56ad16={'failMessage':_0x41ae81};}if(this['actions'][_0x54169b][_0x2ea7('0x49')]){faxMessage['update'](this['actions'][_0x54169b]['AttachmentId'],_0x56ad16)[_0x2ea7('0x4f')](function(_0x15de84){ut['logger'](_0x2ea7('0x50'),_0x15de84);})[_0x2ea7('0x3f')](function(_0x2a0ce9){ut[_0x2ea7('0x4b')]('[Fax][Message][NoUpdate1]',_0x2a0ce9);})[_0x2ea7('0x51')](function(){delete _0x1b5b7c[_0x2ea7('0xe')][_0x54169b];delete _0x1b5b7c[_0x2ea7('0x11')][_0x54169b];});}else{ut[_0x2ea7('0x4b')](_0x2ea7('0x52'));delete this[_0x2ea7('0xe')][_0x54169b];delete this[_0x2ea7('0x11')][_0x54169b];}};Fax[_0x2ea7('0x21')][_0x2ea7('0x1f')]=function(_0xcbb1d9){var _0x19423c=this;if(this['channels'][_0xcbb1d9[_0x2ea7('0x26')]]){if(this[_0x2ea7('0x11')][_0xcbb1d9[_0x2ea7('0x26')]]){this['channels'][_0xcbb1d9[_0x2ea7('0x26')]]['id']=this[_0x2ea7('0x11')][_0xcbb1d9[_0x2ea7('0x26')]]['id'];this['channels'][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x27')]=this[_0x2ea7('0x11')][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x27')];}logger[_0x2ea7('0x28')](_0xcbb1d9[_0x2ea7('0x26')],this[_0x2ea7('0x11')][_0xcbb1d9['uniqueid']]?_0x2ea7('0x53'):_0x2ea7('0x54'),JSON[_0x2ea7('0x42')](this[_0x2ea7('0xe')][_0xcbb1d9[_0x2ea7('0x26')]]));if(this[_0x2ea7('0x11')][_0xcbb1d9[_0x2ea7('0x26')]]){if(this[_0x2ea7('0xe')][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x55')]>0x0&&this['channels'][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x1a')]===_0x2ea7('0x56')){this[_0x2ea7('0x4e')](_0xcbb1d9[_0x2ea7('0x26')],!![]);}else{this[_0x2ea7('0x4e')](_0xcbb1d9[_0x2ea7('0x26')],![],this['channels'][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x57')]?_0x2ea7('0x58')+this[_0x2ea7('0xe')][_0xcbb1d9[_0x2ea7('0x26')]][_0x2ea7('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0x2ea7('0x21')][_0x2ea7('0x59')]=function(_0x287a5b){var _0x151a63=this;return new BPromise(function(_0x2d8323,_0x2bf824){_0x151a63[_0x2ea7('0x5a')](_0x287a5b,_0x151a63[_0x2ea7('0xf')][_0x287a5b[_0x2ea7('0x5b')]])[_0x2ea7('0x4f')](function(_0x26ee75){ut[_0x2ea7('0x4b')]('[Fax][execOriginate][success]',_0x26ee75);_0x2d8323(ut[_0x2ea7('0x3a')]('Fax\x20received'));})['catch'](function(_0x5699a7){ut['logger']('[Fax][execOriginate][failure]',_0x5699a7);updateStatus(_0x287a5b);_0x2bf824(ut['message'](_0x2ea7('0x5c')));});});};Fax[_0x2ea7('0x21')][_0x2ea7('0x5d')]=function(_0xb389ee){var _0x53c751=this;return new BPromise(function(_0x2983a7,_0x58cc5f){var _0x4348ae=_0x53c751[_0x2ea7('0x5e')](_0x53c751[_0x2ea7('0xf')][_0xb389ee['FaxAccountId']][_0x2ea7('0x5f')],_0xb389ee);if(_0x4348ae[_0x2ea7('0x60')]){_0x2983a7(ut[_0x2ea7('0x3a')](_0x2ea7('0x61')));}else{_0x58cc5f(ut[_0x2ea7('0x3a')](_0x4348ae[_0x2ea7('0x3a')]));}});};function originate(_0x455ce3,_0x14affb,_0x379832){return new BPromise(function(_0x273932,_0x4c562d){if(_0x379832){var _0x429d9f=util['format'](_0x2ea7('0x62'),path[_0x2ea7('0x3b')](_0x455ce3[_0x2ea7('0x5')])[_0x2ea7('0x27')],_0x455ce3[_0x2ea7('0x5')]);gs['execute'](_0x429d9f)[_0x2ea7('0x4f')](function(){_0x455ce3[_0x2ea7('0x5')]=util[_0x2ea7('0x63')](_0x2ea7('0x64'),path[_0x2ea7('0x3b')](_0x455ce3[_0x2ea7('0x5')])[_0x2ea7('0x65')],path['parse'](_0x455ce3['path'])[_0x2ea7('0x27')]);_0x14affb[_0x2ea7('0x66')]=_0x455ce3[_0x2ea7('0x5')];ut['logger'](_0x2ea7('0x67'),'');ami[_0x2ea7('0x68')](ut[_0x2ea7('0x69')](_0x455ce3,_0x14affb))[_0x2ea7('0x4f')](function(_0xcc82bb){_0x273932(_0xcc82bb);})[_0x2ea7('0x3f')](function(_0x253374){_0x4c562d(_0x253374);});})['catch'](function(_0x5072c5){_0x4c562d(_0x5072c5);});}else{ami[_0x2ea7('0x68')](ut[_0x2ea7('0x69')](_0x455ce3,_0x14affb))[_0x2ea7('0x4f')](function(_0x3a5614){_0x273932(_0x3a5614);})[_0x2ea7('0x3f')](function(_0x492a25){_0x4c562d(_0x492a25);});}});}Fax[_0x2ea7('0x21')][_0x2ea7('0x5a')]=function(_0x2ce7dd,_0x423236){var _0x4873e0=this;return new BPromise(function(_0x418e9d,_0x59cf95){var _0x1015da=uuid['v4']();var _0x3fd6f4=ut[_0x2ea7('0x6a')](_0x2ce7dd,_0x423236);_0x4873e0[_0x2ea7('0x11')][_0x1015da]=new Action(_0x1015da,_0x423236,_0x2ce7dd);var _0x3c90ff=_0x4873e0[_0x2ea7('0x11')][_0x1015da];if(path['parse'](_0x2ce7dd[_0x2ea7('0x5')])[_0x2ea7('0x6b')]===_0x2ea7('0x3e')){originate(_0x3c90ff,_0x3fd6f4,!![])[_0x2ea7('0x4f')](function(_0x2ce213){_0x418e9d(_0x2ce213);})[_0x2ea7('0x3f')](function(_0x4806c2){_0x59cf95(_0x4806c2);});}else{originate(_0x3c90ff,_0x3fd6f4,![])['then'](function(_0xea6546){_0x418e9d(_0xea6546);})[_0x2ea7('0x3f')](function(_0x32cced){_0x59cf95(_0x32cced);});}});};Fax[_0x2ea7('0x21')][_0x2ea7('0x6c')]=function(_0x14de32){return!_[_0x2ea7('0x6d')](_0x14de32)&&!_[_0x2ea7('0x6d')](_0x14de32[_0x2ea7('0x27')])&&!_['isNil'](_0x14de32[_0x2ea7('0x6e')])&&_0x14de32[_0x2ea7('0x6e')]&&!_[_0x2ea7('0x6d')](this['trunks'][util['format'](_0x2ea7('0x6f'),_0x14de32[_0x2ea7('0x27')])])&&!_[_0x2ea7('0x6d')](this['trunks'][util[_0x2ea7('0x63')]('SIP/%s',_0x14de32[_0x2ea7('0x27')])][_0x2ea7('0x30')])&&(this['trunks'][util[_0x2ea7('0x63')](_0x2ea7('0x6f'),_0x14de32['name'])][_0x2ea7('0x30')]==='reachable'||this[_0x2ea7('0x10')][util[_0x2ea7('0x63')]('SIP/%s',_0x14de32[_0x2ea7('0x27')])][_0x2ea7('0x30')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x431ebe,_0x254f4c){if(!this[_0x2ea7('0x6c')](_0x431ebe)){ut[_0x2ea7('0x4b')](_0x2ea7('0x70'),_['isNil'](_0x431ebe)?'':_0x431ebe['name']+_0x2ea7('0x71'));return{'isValid':![],'message':_0x2ea7('0x72')};}if(_['isNil'](_0x254f4c[_0x2ea7('0x7')])){ut['logger'](_0x2ea7('0x73'),JSON[_0x2ea7('0x42')](_0x254f4c));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x254f4c[_0x2ea7('0x5')])){ut[_0x2ea7('0x4b')](_0x2ea7('0x74'),JSON[_0x2ea7('0x42')](_0x254f4c));return{'isValid':![],'message':_0x2ea7('0x75')};}return{'isValid':!![],'message':_0x2ea7('0x76')};};module[_0x2ea7('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7ca3823..b0b98ce 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 _0x3726=['lodash','../rpc/faxAccount','error','inspect','notify','then','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x266081,_0x234cde){var _0x5ddece=function(_0x485d78){while(--_0x485d78){_0x266081['push'](_0x266081['shift']());}};_0x5ddece(++_0x234cde);}(_0x3726,0x6a));var _0x6372=function(_0x3ac6a7,_0x39aca2){_0x3ac6a7=_0x3ac6a7-0x0;var _0x274542=_0x3726[_0x3ac6a7];return _0x274542;};'use strict';var util=require(_0x6372('0x0'));var BPromise=require(_0x6372('0x1'));var logger=require(_0x6372('0x2'))(_0x6372('0x3'));var _=require(_0x6372('0x4'));var faxAccount=require(_0x6372('0x5'));function loggerCatch(_0x362d8a){return function(_0x2e7b19){logger[_0x6372('0x6')](_0x362d8a,util[_0x6372('0x7')](_0x2e7b19,{'showHidden':![],'depth':null}));};}exports[_0x6372('0x8')]=function(_0x4ce9c9,_0x2f92c2){return BPromise['resolve']()[_0x6372('0x9')](faxAccount[_0x6372('0x8')](_0x4ce9c9,_0x2f92c2))['catch'](loggerCatch(_0x6372('0xa')));}; \ No newline at end of file +var _0x8425=['../rpc/faxAccount','inspect','notify','then','catch','[Notify]\x20','util','bluebird','preview'];(function(_0x523b5b,_0x121a39){var _0x2a6087=function(_0xcd8023){while(--_0xcd8023){_0x523b5b['push'](_0x523b5b['shift']());}};_0x2a6087(++_0x121a39);}(_0x8425,0xf0));var _0x5842=function(_0x446cf7,_0x5272d5){_0x446cf7=_0x446cf7-0x0;var _0x17884b=_0x8425[_0x446cf7];return _0x17884b;};'use strict';var util=require(_0x5842('0x0'));var BPromise=require(_0x5842('0x1'));var logger=require('../../../config/logger')(_0x5842('0x2'));var _=require('lodash');var faxAccount=require(_0x5842('0x3'));function loggerCatch(_0x1adb1e){return function(_0x2f5733){logger['error'](_0x1adb1e,util[_0x5842('0x4')](_0x2f5733,{'showHidden':![],'depth':null}));};}exports[_0x5842('0x5')]=function(_0x4669e2,_0x3c39ea){return BPromise['resolve']()[_0x5842('0x6')](faxAccount[_0x5842('0x5')](_0x4669e2,_0x3c39ea))[_0x5842('0x7')](loggerCatch(_0x5842('0x8')));}; \ 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 a8979af..3579e04 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 _0xa0d0=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','inspect'];(function(_0x553502,_0x4d2c0c){var _0x246c37=function(_0x36698a){while(--_0x36698a){_0x553502['push'](_0x553502['shift']());}};_0x246c37(++_0x4d2c0c);}(_0xa0d0,0x7e));var _0x0a0d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa0d0[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0x0a0d('0x0'));var logger=require(_0x0a0d('0x1'))(_0x0a0d('0x2'));var BPromise=require(_0x0a0d('0x3'));var exec=require(_0x0a0d('0x4'))[_0x0a0d('0x5')];exports[_0x0a0d('0x6')]=function(_0x5207be){return new BPromise(function(_0x15fa44,_0x4df9c6){exec(_0x5207be,function(_0xa64b98,_0xbf00a5,_0xe2dfa6){logger['info'](_0x0a0d('0x7'),_0xbf00a5);if(_0xa64b98){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0x0a0d('0x8')](_0xa64b98,{'showHidden':![],'depth':null}),_0xbf00a5,_0xe2dfa6);_0x4df9c6(_0xa64b98);}_0x15fa44(_0xbf00a5);});});}; \ No newline at end of file +var _0x33ef=['util','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x1aed2b,_0x10b7ef){var _0x564128=function(_0x3878bb){while(--_0x3878bb){_0x1aed2b['push'](_0x1aed2b['shift']());}};_0x564128(++_0x10b7ef);}(_0x33ef,0xcf));var _0xf33e=function(_0x5a513c,_0x1ac679){_0x5a513c=_0x5a513c-0x0;var _0x323bc3=_0x33ef[_0x5a513c];return _0x323bc3;};'use strict';var util=require(_0xf33e('0x0'));var logger=require('../../../../config/logger')(_0xf33e('0x1'));var BPromise=require(_0xf33e('0x2'));var exec=require(_0xf33e('0x3'))[_0xf33e('0x4')];exports[_0xf33e('0x5')]=function(_0x446792){return new BPromise(function(_0x247179,_0x4602d3){exec(_0x446792,function(_0xd413b3,_0x5cd9cb,_0x495d65){logger[_0xf33e('0x6')](_0xf33e('0x7'),_0x5cd9cb);if(_0xd413b3){logger[_0xf33e('0x6')](_0xf33e('0x7'),'\x20Error\x20:',util[_0xf33e('0x8')](_0xd413b3,{'showHidden':![],'depth':null}),_0x5cd9cb,_0x495d65);_0x4602d3(_0xd413b3);}_0x247179(_0x5cd9cb);});});}; \ 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 37b0f42..903a6fb 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 _0x2d6a=['info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','faxdetect','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x2d6a,0x16a));var _0xa2d6=function(_0x2b3e14,_0x139329){_0x2b3e14=_0x2b3e14-0x0;var _0x2d0eda=_0x2d6a[_0x2b3e14];return _0x2d0eda;};'use strict';var util=require(_0xa2d6('0x0'));var _=require(_0xa2d6('0x1'));var moment=require(_0xa2d6('0x2'));var logger=require(_0xa2d6('0x3'))(_0xa2d6('0x4'));exports['message']=function(_0x21e703){return{'message':_0x21e703};};exports[_0xa2d6('0x5')]=function(_0x13d93d,_0xc802a1){logger[_0xa2d6('0x6')](_0x13d93d,util[_0xa2d6('0x7')](_0xc802a1,{'showHidden':![],'depth':null}));};exports[_0xa2d6('0x8')]=function(_0x1b1814,_0xa7725d){var _0x1d0a21={'XMF-ECM':_0xa7725d[_0xa2d6('0x9')],'XMF-HEADERINFO':_0xa7725d[_0xa2d6('0xa')],'XMF-MINRATE':_0xa7725d['minrate'],'XMF-MAXRATE':_0xa7725d[_0xa2d6('0xb')],'XMF-MODEM':util[_0xa2d6('0xc')](_0xa2d6('0xd'),_0xa7725d['modem']),'XMF-GATEWAY':_0xa7725d['gateway'],'XMF-FAXDETECT':_0xa7725d[_0xa2d6('0xe')],'XMF-T38TIMEOUT':_0xa7725d['t38timeout'],'XMF-LOCALSTATIONID':_0xa7725d[_0xa2d6('0xf')],'XMF-PATH':_0x1b1814[_0xa2d6('0x10')]};return _0x1d0a21;};exports['variablesAction']=function(_0xea4d8,_0xaf688b){return{'actionid':_0xea4d8[_0xa2d6('0x11')],'action':_0xa2d6('0x12'),'channel':_0xea4d8[_0xa2d6('0x13')],'Exten':_0xa2d6('0x14'),'Context':_0xa2d6('0x15'),'Priority':'1','callerid':util[_0xa2d6('0xc')](_0xa2d6('0x16'),_0xea4d8['headerinfo']?_0xea4d8[_0xa2d6('0xa')]:'',_0xea4d8[_0xa2d6('0xf')]),'variable':_0xaf688b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xea4d8[_0xa2d6('0x11')]};}; \ No newline at end of file +var _0x7a94=['util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x1efeeb,_0x258a7f){var _0x2fb8f1=function(_0x25ff25){while(--_0x25ff25){_0x1efeeb['push'](_0x1efeeb['shift']());}};_0x2fb8f1(++_0x258a7f);}(_0x7a94,0x1d4));var _0x47a9=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x7a94[_0x40015a];return _0x42f8a4;};'use strict';var util=require(_0x47a9('0x0'));var _=require(_0x47a9('0x1'));var moment=require(_0x47a9('0x2'));var logger=require(_0x47a9('0x3'))(_0x47a9('0x4'));exports[_0x47a9('0x5')]=function(_0x317a5d){return{'message':_0x317a5d};};exports[_0x47a9('0x6')]=function(_0xfd46c9,_0x13da57){logger[_0x47a9('0x7')](_0xfd46c9,util[_0x47a9('0x8')](_0x13da57,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2db83a,_0x595e29){var _0x245dfe={'XMF-ECM':_0x595e29['ecm'],'XMF-HEADERINFO':_0x595e29[_0x47a9('0x9')],'XMF-MINRATE':_0x595e29['minrate'],'XMF-MAXRATE':_0x595e29[_0x47a9('0xa')],'XMF-MODEM':util[_0x47a9('0xb')](_0x47a9('0xc'),_0x595e29[_0x47a9('0xd')]),'XMF-GATEWAY':_0x595e29[_0x47a9('0xe')],'XMF-FAXDETECT':_0x595e29[_0x47a9('0xf')],'XMF-T38TIMEOUT':_0x595e29[_0x47a9('0x10')],'XMF-LOCALSTATIONID':_0x595e29[_0x47a9('0x11')],'XMF-PATH':_0x2db83a[_0x47a9('0x12')]};return _0x245dfe;};exports[_0x47a9('0x13')]=function(_0x217140,_0x3d378e){return{'actionid':_0x217140[_0x47a9('0x14')],'action':_0x47a9('0x15'),'channel':_0x217140[_0x47a9('0x16')],'Exten':_0x47a9('0x17'),'Context':_0x47a9('0x18'),'Priority':'1','callerid':util[_0x47a9('0xb')](_0x47a9('0x19'),_0x217140['headerinfo']?_0x217140['headerinfo']:'',_0x217140[_0x47a9('0x11')]),'variable':_0x3d378e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x217140[_0x47a9('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f921e08..e3310e3 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 _0x05f1=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','util','moment','./server','./realtime','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','getAgents','then','initAgents','initTelephones','getTrunks'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x05f1,0xb4));var _0x105f=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x05f1[_0x4a53d];return _0x27410e;};'use strict';var util=require(_0x105f('0x0'));var moment=require(_0x105f('0x1'));var server=require(_0x105f('0x2'));var Realtime=require(_0x105f('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x105f('0x4'));var Dialer=require(_0x105f('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x105f('0x6'));var voiceQueue=require(_0x105f('0x7'));var voiceQueueReport=require(_0x105f('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x105f('0x9'));var trigger=require(_0x105f('0xa'));var template=require(_0x105f('0xb'));var cmHopperHistory=require(_0x105f('0xc'));var campaign=require(_0x105f('0xd'));var voiceExtension=require(_0x105f('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x105f('0xf'));var salesforce=require(_0x105f('0x10'));var sugarcrm=require(_0x105f('0x11'));var freshdesk=require(_0x105f('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x105f('0x13'));var vtiger=require(_0x105f('0x14'));var freshsales=require(_0x105f('0x15'));var servicenow=require(_0x105f('0x16'));var dynamics365=require(_0x105f('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x105f('0x18'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x105f('0x19')](_0x105f('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x105f('0x19')](_0x105f('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x105f('0x1b')]()['then'](user[_0x105f('0x1c')]())[_0x105f('0x1d')](realtime[_0x105f('0x1e')]())['then'](user['getTelephones']())[_0x105f('0x1d')](realtime[_0x105f('0x1f')]())[_0x105f('0x1d')](trunk[_0x105f('0x20')]())['then'](realtime[_0x105f('0x21')]())[_0x105f('0x1d')](voiceQueue[_0x105f('0x22')]())[_0x105f('0x1d')](realtime[_0x105f('0x23')]())[_0x105f('0x1d')](trigger[_0x105f('0x24')]())[_0x105f('0x1d')](realtime['initTriggers']())[_0x105f('0x1d')](template['getTemplates']())[_0x105f('0x1d')](realtime['initTemplates']())[_0x105f('0x1d')](zendesk['getZendeskAccounts']())[_0x105f('0x1d')](realtime[_0x105f('0x25')]())[_0x105f('0x1d')](salesforce[_0x105f('0x26')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x105f('0x27')]())[_0x105f('0x1d')](realtime['initSugarcrmAccounts']())[_0x105f('0x1d')](freshdesk[_0x105f('0x28')]())[_0x105f('0x1d')](realtime[_0x105f('0x29')]())[_0x105f('0x1d')](desk[_0x105f('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x105f('0x1d')](zoho[_0x105f('0x2b')]())['then'](realtime[_0x105f('0x2c')]())[_0x105f('0x1d')](vtiger[_0x105f('0x2d')]())[_0x105f('0x1d')](realtime[_0x105f('0x2e')]())[_0x105f('0x1d')](freshsales[_0x105f('0x2f')]())[_0x105f('0x1d')](realtime['initFreshsalesAccounts']())[_0x105f('0x1d')](servicenow[_0x105f('0x30')]())['then'](realtime[_0x105f('0x31')]())[_0x105f('0x1d')](dynamics365[_0x105f('0x32')]())[_0x105f('0x1d')](realtime[_0x105f('0x33')]())[_0x105f('0x1d')](campaign[_0x105f('0x34')]())['then'](realtime[_0x105f('0x35')]())['then'](voiceExtension[_0x105f('0x36')]())[_0x105f('0x1d')](realtime[_0x105f('0x37')]())[_0x105f('0x1d')](faxAccount[_0x105f('0x38')]())[_0x105f('0x1d')](realtime[_0x105f('0x39')]())[_0x105f('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x105f('0x1b')]()[_0x105f('0x1d')](voiceQueueReport[_0x105f('0x3a')]())[_0x105f('0x1d')](realtime[_0x105f('0x3b')]())[_0x105f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x105f('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x105f('0x1d')](cmHopperHistory[_0x105f('0x3c')]())[_0x105f('0x1d')](realtime[_0x105f('0x3d')]())['then'](voiceCallReport[_0x105f('0x3e')]())[_0x105f('0x1d')](realtime[_0x105f('0x3f')]())[_0x105f('0x40')](function(_0x55f6f8){logger['error'](_0x105f('0x41'),util[_0x105f('0x42')](_0x55f6f8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x105f('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x105f('0x1d')](function(){return initParams();})['then'](function(){report[_0x105f('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x143311){logger[_0x105f('0x45')](_0x105f('0x46'),util[_0x105f('0x42')](_0x143311,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x00f0=['getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns'];(function(_0x3c469a,_0x620643){var _0x4ac801=function(_0x487949){while(--_0x487949){_0x3c469a['push'](_0x3c469a['shift']());}};_0x4ac801(++_0x620643);}(_0x00f0,0x121));var _0x000f=function(_0x591ffc,_0x58de5e){_0x591ffc=_0x591ffc-0x0;var _0x1fd91=_0x00f0[_0x591ffc];return _0x1fd91;};'use strict';var util=require(_0x000f('0x0'));var moment=require(_0x000f('0x1'));var server=require(_0x000f('0x2'));var Realtime=require(_0x000f('0x3'));var Report=require(_0x000f('0x4'));var Acw=require(_0x000f('0x5'));var Trigger=require(_0x000f('0x6'));var Dialer=require('./dialer');var Preview=require(_0x000f('0x7'));var Fax=require(_0x000f('0x8'));var user=require(_0x000f('0x9'));var voiceQueue=require(_0x000f('0xa'));var voiceQueueReport=require(_0x000f('0xb'));var voiceCallReport=require(_0x000f('0xc'));var trunk=require(_0x000f('0xd'));var trigger=require(_0x000f('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x000f('0xf'));var campaign=require(_0x000f('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x000f('0x11'));var salesforce=require(_0x000f('0x12'));var sugarcrm=require(_0x000f('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x000f('0x14'));var zoho=require(_0x000f('0x15'));var vtiger=require(_0x000f('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x000f('0x17'));var dynamics365=require(_0x000f('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('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x000f('0x19')](_0x000f('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x000f('0x19')](_0x000f('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x000f('0x1b')]()[_0x000f('0x1c')](user[_0x000f('0x1d')]())['then'](realtime[_0x000f('0x1e')]())[_0x000f('0x1c')](user['getTelephones']())['then'](realtime[_0x000f('0x1f')]())[_0x000f('0x1c')](trunk['getTrunks']())[_0x000f('0x1c')](realtime[_0x000f('0x20')]())[_0x000f('0x1c')](voiceQueue[_0x000f('0x21')]())[_0x000f('0x1c')](realtime['initVoiceQueues']())['then'](trigger[_0x000f('0x22')]())[_0x000f('0x1c')](realtime['initTriggers']())[_0x000f('0x1c')](template[_0x000f('0x23')]())[_0x000f('0x1c')](realtime[_0x000f('0x24')]())[_0x000f('0x1c')](zendesk[_0x000f('0x25')]())[_0x000f('0x1c')](realtime['initZendeskAccounts']())[_0x000f('0x1c')](salesforce[_0x000f('0x26')]())['then'](realtime[_0x000f('0x27')]())['then'](sugarcrm[_0x000f('0x28')]())[_0x000f('0x1c')](realtime[_0x000f('0x29')]())[_0x000f('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x000f('0x1c')](realtime[_0x000f('0x2a')]())[_0x000f('0x1c')](desk['getDeskAccounts']())[_0x000f('0x1c')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x000f('0x1c')](vtiger[_0x000f('0x2b')]())[_0x000f('0x1c')](realtime[_0x000f('0x2c')]())[_0x000f('0x1c')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x000f('0x2d')]())['then'](servicenow['getServicenowAccounts']())[_0x000f('0x1c')](realtime[_0x000f('0x2e')]())[_0x000f('0x1c')](dynamics365[_0x000f('0x2f')]())[_0x000f('0x1c')](realtime[_0x000f('0x30')]())[_0x000f('0x1c')](campaign[_0x000f('0x31')]())[_0x000f('0x1c')](realtime[_0x000f('0x32')]())[_0x000f('0x1c')](voiceExtension[_0x000f('0x33')]())[_0x000f('0x1c')](realtime[_0x000f('0x34')]())[_0x000f('0x1c')](faxAccount['getFaxAccounts']())[_0x000f('0x1c')](realtime[_0x000f('0x35')]())[_0x000f('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x000f('0x1b')]()['then'](voiceQueueReport[_0x000f('0x36')]())[_0x000f('0x1c')](realtime[_0x000f('0x37')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x000f('0x1c')](realtime[_0x000f('0x38')]())[_0x000f('0x1c')](cmHopperHistory[_0x000f('0x39')]())[_0x000f('0x1c')](realtime[_0x000f('0x3a')]())[_0x000f('0x1c')](voiceCallReport[_0x000f('0x3b')]())[_0x000f('0x1c')](realtime[_0x000f('0x3c')]())[_0x000f('0x3d')](function(_0x3264c4){logger[_0x000f('0x3e')](_0x000f('0x3f'),util[_0x000f('0x40')](_0x3264c4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x000f('0x41')](realtime,preview,fax)[_0x000f('0x1c')](function(){return initRealtime();})[_0x000f('0x1c')](function(){return initParams();})[_0x000f('0x1c')](function(){report[_0x000f('0x42')]();setInterval(initRealtime,0x1388);})[_0x000f('0x3d')](function(_0x24cb89){logger[_0x000f('0x3e')](_0x000f('0x43'),util[_0x000f('0x40')](_0x24cb89,{'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 f1ae0c7..6c7516c 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 _0x6aa7=['redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','emit','user:ami:update','user:presence','exports','lodash','moment','ioredis','../../../config/environment'];(function(_0x2a8b2c,_0x4a7d7c){var _0x1a108b=function(_0x2ce91d){while(--_0x2ce91d){_0x2a8b2c['push'](_0x2a8b2c['shift']());}};_0x1a108b(++_0x4a7d7c);}(_0x6aa7,0x178));var _0x76aa=function(_0x50acac,_0x23aa9a){_0x50acac=_0x50acac-0x0;var _0x5725ce=_0x6aa7[_0x50acac];return _0x5725ce;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var Redis=require(_0x76aa('0x2'));var config=require(_0x76aa('0x3'));config[_0x76aa('0x4')]=_['defaults'](config[_0x76aa('0x4')],{'host':_0x76aa('0x5'),'port':0x18eb});var io=require(_0x76aa('0x6'))(new Redis(config['redis']));function Agent(_0x588e62){this['id']=_0x588e62['id']||0x0;this[_0x76aa('0x7')]=_0x588e62['name']||'';this[_0x76aa('0x8')]=_0x588e62[_0x76aa('0x8')]||'';this[_0x76aa('0x9')]=_0x588e62['accountcode']||'';this[_0x76aa('0xa')]=_0x588e62[_0x76aa('0xa')]||'';this[_0x76aa('0xb')]='unknown';this[_0x76aa('0xc')]=0x0;this[_0x76aa('0xd')]=_0x76aa('0xe');this[_0x76aa('0xf')]='';this[_0x76aa('0x10')]='';this[_0x76aa('0x11')]='';this[_0x76aa('0x12')]='';this[_0x76aa('0x13')]=_0x588e62[_0x76aa('0x13')]||![];this[_0x76aa('0x14')]='unknown';this[_0x76aa('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x76aa('0x16')]='';this[_0x76aa('0x17')]=![];this[_0x76aa('0x18')]=![];}Agent[_0x76aa('0x19')][_0x76aa('0x1a')]=function(_0x4e309f){if(!_0x4e309f['state']){return;}var _0x2b3b4f=null;var _0x4cfc34=_0x4e309f[_0x76aa('0xb')][_0x76aa('0x1b')]();switch(_0x4cfc34){case'not_inuse':_0x4cfc34=_0x76aa('0x1c');break;case'inuse':_0x4cfc34=_0x76aa('0x1d');break;}if(this['voiceStatus']!==_0x4cfc34||_0x4e309f[_0x76aa('0x1e')]){_0x2b3b4f=_[_0x76aa('0x1f')](moment()[_0x76aa('0x20')]('x'));}var _0x21c16d={'id':this['id'],'name':this[_0x76aa('0x7')],'email':this[_0x76aa('0x8')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x76aa('0xb')],'stateTime':this[_0x76aa('0xc')],'status':this[_0x76aa('0xd')],'address':this[_0x76aa('0xf')],'voiceStatus':_0x4cfc34||this[_0x76aa('0x14')],'voiceStatusTime':_0x2b3b4f||this[_0x76aa('0x15')],'voiceStatusCallerIdNumber':this[_0x76aa('0x21')],'voiceStatusQueue':this[_0x76aa('0x16')],'interface':this[_0x76aa('0x12')],'onhold':this['onhold']};if(this[_0x76aa('0x14')]!==_0x4cfc34){this[_0x76aa('0x14')]=_0x4cfc34;io['to'](util[_0x76aa('0x20')]('user:%s',_0x21c16d[_0x76aa('0x7')]))[_0x76aa('0x22')](_0x76aa('0x23'),_0x21c16d);io[_0x76aa('0x22')](_0x76aa('0x24'),_0x21c16d);}};module[_0x76aa('0x25')]=Agent; \ No newline at end of file +var _0x8a9c=['not_inuse','statePause','toNumber','stateTime','status','voiceStatus','voiceStatusTime','interface','format','emit','user:ami:update','user:presence','exports','lodash','util','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','address','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','toLowerCase'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var moment=require(_0xc8a9('0x2'));var Redis=require(_0xc8a9('0x3'));var config=require(_0xc8a9('0x4'));config['redis']=_[_0xc8a9('0x5')](config[_0xc8a9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc8a9('0x7'))(new Redis(config[_0xc8a9('0x6')]));function Agent(_0x443883){this['id']=_0x443883['id']||0x0;this['name']=_0x443883[_0xc8a9('0x8')]||'';this[_0xc8a9('0x9')]=_0x443883[_0xc8a9('0x9')]||'';this[_0xc8a9('0xa')]=_0x443883[_0xc8a9('0xa')]||'';this[_0xc8a9('0xb')]=_0x443883[_0xc8a9('0xb')]||'';this[_0xc8a9('0xc')]=_0xc8a9('0xd');this['stateTime']=0x0;this['status']=_0xc8a9('0xd');this[_0xc8a9('0xe')]='';this['phone']='';this[_0xc8a9('0xf')]='';this['interface']='';this[_0xc8a9('0x10')]=_0x443883[_0xc8a9('0x10')]||![];this['voiceStatus']=_0xc8a9('0xd');this['voiceStatusTime']=0x0;this[_0xc8a9('0x11')]='';this[_0xc8a9('0x12')]='';this[_0xc8a9('0x13')]=![];this[_0xc8a9('0x14')]=![];}Agent[_0xc8a9('0x15')]['updateStatusRealtime']=function(_0x4decb0){if(!_0x4decb0[_0xc8a9('0xc')]){return;}var _0x5dee4d=null;var _0x108678=_0x4decb0[_0xc8a9('0xc')][_0xc8a9('0x16')]();switch(_0x108678){case _0xc8a9('0x17'):_0x108678='idle';break;case'inuse':_0x108678='talking';break;}if(this['voiceStatus']!==_0x108678||_0x4decb0[_0xc8a9('0x18')]){_0x5dee4d=_[_0xc8a9('0x19')](moment()['format']('x'));}var _0x43f403={'id':this['id'],'name':this[_0xc8a9('0x8')],'email':this[_0xc8a9('0x9')],'accountcode':this[_0xc8a9('0xa')],'fullname':this[_0xc8a9('0xb')],'state':this[_0xc8a9('0xc')],'stateTime':this[_0xc8a9('0x1a')],'status':this[_0xc8a9('0x1b')],'address':this['address'],'voiceStatus':_0x108678||this[_0xc8a9('0x1c')],'voiceStatusTime':_0x5dee4d||this[_0xc8a9('0x1d')],'voiceStatusCallerIdNumber':this[_0xc8a9('0x11')],'voiceStatusQueue':this[_0xc8a9('0x12')],'interface':this[_0xc8a9('0x1e')],'onhold':this[_0xc8a9('0x13')]};if(this[_0xc8a9('0x1c')]!==_0x108678){this[_0xc8a9('0x1c')]=_0x108678;io['to'](util[_0xc8a9('0x1f')]('user:%s',_0x43f403[_0xc8a9('0x8')]))[_0xc8a9('0x20')](_0xc8a9('0x21'),_0x43f403);io['emit'](_0xc8a9('0x22'),_0x43f403);}};module[_0xc8a9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 80c597a..d501c0c 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 _0x3d01=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0xc7b78b,_0x1f852e){var _0x4b5e17=function(_0x2383a2){while(--_0x2383a2){_0xc7b78b['push'](_0xc7b78b['shift']());}};_0x4b5e17(++_0x1f852e);}(_0x3d01,0x1a1));var _0x13d0=function(_0x20a137,_0x4d9549){_0x20a137=_0x20a137-0x0;var _0x3dc414=_0x3d01[_0x20a137];return _0x3dc414;};'use strict';function Campaign(_0x349419){this['id']=_0x349419['id']||0x0;this[_0x13d0('0x0')]=_0x349419['name']||'';this[_0x13d0('0x1')]=_0x349419[_0x13d0('0x1')]||_0x13d0('0x2');this['originated']=0x0;this[_0x13d0('0x3')]=0x0;this[_0x13d0('0x4')]=0x0;this[_0x13d0('0x5')]=0x0;this[_0x13d0('0x6')]='';this[_0x13d0('0x7')]=!![];this['active']=_0x349419[_0x13d0('0x8')];this[_0x13d0('0x9')]=_0x349419[_0x13d0('0x9')];this[_0x13d0('0xa')]=_0x349419[_0x13d0('0xa')]||null;this[_0x13d0('0xb')]=_0x349419[_0x13d0('0xb')]?_0x349419[_0x13d0('0xb')]:null;this[_0x13d0('0xc')]=_0x349419[_0x13d0('0xc')];this['dialOriginateCallerIdNumber']=_0x349419['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x349419[_0x13d0('0xd')]||0x1e;this[_0x13d0('0xe')]=_0x349419[_0x13d0('0xe')];this[_0x13d0('0xf')]=_0x349419[_0x13d0('0xf')];this[_0x13d0('0x10')]=_0x349419[_0x13d0('0x10')];this[_0x13d0('0x11')]=_0x349419[_0x13d0('0x11')];this[_0x13d0('0x12')]=_0x349419[_0x13d0('0x12')];this[_0x13d0('0x13')]=_0x349419[_0x13d0('0x13')];this[_0x13d0('0x14')]=_0x349419['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x349419[_0x13d0('0x15')]||0x3;this[_0x13d0('0x16')]=_0x349419['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x349419[_0x13d0('0x17')]||0x3;this[_0x13d0('0x18')]=_0x349419[_0x13d0('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x349419['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x349419[_0x13d0('0x19')]||0x96;this[_0x13d0('0x1a')]=_0x349419[_0x13d0('0x1a')]||0x3;this[_0x13d0('0x1b')]=_0x349419[_0x13d0('0x1b')]||0x96;this[_0x13d0('0x1c')]=_0x349419[_0x13d0('0x1c')]||0x3;this[_0x13d0('0x1d')]=_0x349419[_0x13d0('0x1d')]||0x96;this[_0x13d0('0x1e')]=_0x349419[_0x13d0('0x1e')]||'DESC';this[_0x13d0('0x1f')]=_0x349419[_0x13d0('0x1f')]||undefined;this[_0x13d0('0x20')]=_0x349419[_0x13d0('0x20')]||undefined;this[_0x13d0('0x21')]=_0x349419[_0x13d0('0x21')]||undefined;this[_0x13d0('0x22')]=_0x349419[_0x13d0('0x22')]?_0x349419[_0x13d0('0x22')]:undefined;this[_0x13d0('0x23')]=_0x349419[_0x13d0('0x23')]?_0x349419[_0x13d0('0x23')]:undefined;this['Interval']=_0x349419['Interval']?_0x349419[_0x13d0('0x24')]:undefined;this[_0x13d0('0x25')]=_0x349419[_0x13d0('0x25')]?_0x349419[_0x13d0('0x25')]:undefined;this[_0x13d0('0x26')]=_0x349419[_0x13d0('0x25')]?_0x349419[_0x13d0('0x25')][_0x13d0('0x0')]:undefined;this['dialAMDActive']=_0x349419['dialAMDActive']||![];this[_0x13d0('0x27')]=_0x349419['dialAMDInitialSilence'];this[_0x13d0('0x28')]=_0x349419[_0x13d0('0x28')];this['dialAMDAfterGreetingSilence']=_0x349419[_0x13d0('0x29')];this['dialAMDTotalAnalysisTime']=_0x349419[_0x13d0('0x2a')];this[_0x13d0('0x2b')]=_0x349419[_0x13d0('0x2b')];this['dialAMDBetweenWordsSilence']=_0x349419[_0x13d0('0x2c')];this[_0x13d0('0x2d')]=_0x349419[_0x13d0('0x2d')];this[_0x13d0('0x2e')]=_0x349419[_0x13d0('0x2e')];this[_0x13d0('0x2f')]=_0x349419[_0x13d0('0x2f')];}module['exports']=Campaign; \ No newline at end of file +var _0xda9c=['type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','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'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xda9c,0x197));var _0xcda9=function(_0x38755b,_0x43471b){_0x38755b=_0x38755b-0x0;var _0x5c8a1c=_0xda9c[_0x38755b];return _0x5c8a1c;};'use strict';function Campaign(_0x23cc48){this['id']=_0x23cc48['id']||0x0;this[_0xcda9('0x0')]=_0x23cc48[_0xcda9('0x0')]||'';this[_0xcda9('0x1')]=_0x23cc48[_0xcda9('0x1')]||_0xcda9('0x2');this[_0xcda9('0x3')]=0x0;this[_0xcda9('0x4')]=0x0;this[_0xcda9('0x5')]=0x0;this[_0xcda9('0x6')]=0x0;this['message']='';this[_0xcda9('0x7')]=!![];this[_0xcda9('0x8')]=_0x23cc48[_0xcda9('0x8')];this['limitCalls']=_0x23cc48[_0xcda9('0x9')];this[_0xcda9('0xa')]=_0x23cc48['dialTimezone']||null;this[_0xcda9('0xb')]=_0x23cc48[_0xcda9('0xb')]?_0x23cc48[_0xcda9('0xb')]:null;this[_0xcda9('0xc')]=_0x23cc48['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x23cc48['dialOriginateCallerIdNumber'];this[_0xcda9('0xd')]=_0x23cc48[_0xcda9('0xd')]||0x1e;this[_0xcda9('0xe')]=_0x23cc48[_0xcda9('0xe')];this[_0xcda9('0xf')]=_0x23cc48[_0xcda9('0xf')];this[_0xcda9('0x10')]=_0x23cc48[_0xcda9('0x10')];this[_0xcda9('0x11')]=_0x23cc48[_0xcda9('0x11')];this[_0xcda9('0x12')]=_0x23cc48[_0xcda9('0x12')];this['dialNoAnswerRetryFrequency']=_0x23cc48['dialNoAnswerRetryFrequency'];this[_0xcda9('0x13')]=_0x23cc48[_0xcda9('0x13')];this['dialNoSuchNumberMaxRetry']=_0x23cc48[_0xcda9('0x14')]||0x3;this[_0xcda9('0x15')]=_0x23cc48[_0xcda9('0x15')]||0x96;this['dialDropMaxRetry']=_0x23cc48[_0xcda9('0x16')]||0x3;this[_0xcda9('0x17')]=_0x23cc48[_0xcda9('0x17')]||0x96;this[_0xcda9('0x18')]=_0x23cc48[_0xcda9('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x23cc48[_0xcda9('0x19')]||0x96;this['dialMachineMaxRetry']=_0x23cc48[_0xcda9('0x1a')]||0x3;this[_0xcda9('0x1b')]=_0x23cc48[_0xcda9('0x1b')]||0x96;this[_0xcda9('0x1c')]=_0x23cc48['dialAgentRejectMaxRetry']||0x3;this[_0xcda9('0x1d')]=_0x23cc48[_0xcda9('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x23cc48[_0xcda9('0x1e')]||_0xcda9('0x1f');this[_0xcda9('0x20')]=_0x23cc48[_0xcda9('0x20')]||undefined;this[_0xcda9('0x21')]=_0x23cc48[_0xcda9('0x21')]||undefined;this['dialCutDigit']=_0x23cc48[_0xcda9('0x22')]||undefined;this[_0xcda9('0x23')]=_0x23cc48[_0xcda9('0x23')]?_0x23cc48['TrunkBackup']:undefined;this[_0xcda9('0x24')]=_0x23cc48['Trunk']?_0x23cc48[_0xcda9('0x24')]:undefined;this[_0xcda9('0x25')]=_0x23cc48[_0xcda9('0x25')]?_0x23cc48['Interval']:undefined;this[_0xcda9('0x26')]=_0x23cc48['SquareProject']?_0x23cc48[_0xcda9('0x26')]:undefined;this[_0xcda9('0x27')]=_0x23cc48[_0xcda9('0x26')]?_0x23cc48[_0xcda9('0x26')][_0xcda9('0x0')]:undefined;this[_0xcda9('0x28')]=_0x23cc48[_0xcda9('0x28')]||![];this[_0xcda9('0x29')]=_0x23cc48[_0xcda9('0x29')];this[_0xcda9('0x2a')]=_0x23cc48[_0xcda9('0x2a')];this[_0xcda9('0x2b')]=_0x23cc48[_0xcda9('0x2b')];this[_0xcda9('0x2c')]=_0x23cc48[_0xcda9('0x2c')];this[_0xcda9('0x2d')]=_0x23cc48[_0xcda9('0x2d')];this[_0xcda9('0x2e')]=_0x23cc48[_0xcda9('0x2e')];this[_0xcda9('0x2f')]=_0x23cc48['dialAMDMaximumNumberOfWords'];this[_0xcda9('0x30')]=_0x23cc48[_0xcda9('0x30')];this[_0xcda9('0x31')]=_0x23cc48['dialAMDMaximumWordLength'];}module[_0xcda9('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9ec2151..9b29eaa 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 _0x9123=['lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','calleridname','connectedlinename','accountcode','context','uniqueid','exten','answered','unmanaged','abandoned'];(function(_0x4ae77e,_0x2da9ed){var _0x33616b=function(_0x536b7a){while(--_0x536b7a){_0x4ae77e['push'](_0x4ae77e['shift']());}};_0x33616b(++_0x2da9ed);}(_0x9123,0x140));var _0x3912=function(_0xf8d789,_0x54e791){_0xf8d789=_0xf8d789-0x0;var _0xcf0c80=_0x9123[_0xf8d789];return _0xcf0c80;};'use strict';function Channel(){this[_0x3912('0x0')]=null;this['channel']='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x3912('0x1')]='';this['connectedlinenum']=undefined;this[_0x3912('0x2')]=undefined;this[_0x3912('0x3')]=0x0;this[_0x3912('0x4')]='';this[_0x3912('0x5')]=0x0;this['linkedid']=0x0;this[_0x3912('0x6')]=0x0;this[_0x3912('0x7')]=![];this['answertime']=null;this['endtime']=null;this[_0x3912('0x8')]=![];this[_0x3912('0x9')]=![];this[_0x3912('0xa')]='';this['lastdata']='';this[_0x3912('0xb')]=0x0;this[_0x3912('0xc')]=0x0;this[_0x3912('0xd')]=0x0;this[_0x3912('0xe')]=null;this['tag']=null;this[_0x3912('0xf')]=null;this[_0x3912('0x10')]=![];this['monitorFilename']=null;this[_0x3912('0x11')]=null;this[_0x3912('0x12')]=[];this[_0x3912('0x13')]=undefined;this[_0x3912('0x14')]=undefined;this[_0x3912('0x15')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xd290=['monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','type','tag'];(function(_0x461f4c,_0x4c293d){var _0x299260=function(_0x4c4252){while(--_0x4c4252){_0x461f4c['push'](_0x461f4c['shift']());}};_0x299260(++_0x4c293d);}(_0xd290,0x165));var _0x0d29=function(_0x10e0f3,_0x573a10){_0x10e0f3=_0x10e0f3-0x0;var _0x2ecc6f=_0xd290[_0x10e0f3];return _0x2ecc6f;};'use strict';function Channel(){this[_0x0d29('0x0')]=null;this[_0x0d29('0x1')]='';this['destinationchannel']='';this[_0x0d29('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x0d29('0x3')]=undefined;this[_0x0d29('0x4')]=0x0;this[_0x0d29('0x5')]='';this[_0x0d29('0x6')]=0x0;this[_0x0d29('0x7')]=0x0;this['exten']=0x0;this[_0x0d29('0x8')]=![];this[_0x0d29('0x9')]=null;this[_0x0d29('0xa')]=null;this[_0x0d29('0xb')]=![];this[_0x0d29('0xc')]=![];this['lastapplication']='';this[_0x0d29('0xd')]='';this[_0x0d29('0xe')]=0x0;this[_0x0d29('0xf')]=0x0;this['holdtime']=0x0;this[_0x0d29('0x10')]=null;this[_0x0d29('0x11')]=null;this['disposition']=null;this[_0x0d29('0x12')]=![];this[_0x0d29('0x13')]=null;this['queue']=null;this[_0x0d29('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x0d29('0x15')]=undefined;this[_0x0d29('0x16')]=undefined;this[_0x0d29('0x17')]=0x0;}module[_0x0d29('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 23108bb..f580a3b 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 _0xa833=['serverUrl','Configurations','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0xa1eb2e,_0x2f4b19){var _0x55f5ff=function(_0x312ff9){while(--_0x312ff9){_0xa1eb2e['push'](_0xa1eb2e['shift']());}};_0x55f5ff(++_0x2f4b19);}(_0xa833,0x156));var _0x3a83=function(_0x11db31,_0x526792){_0x11db31=_0x11db31-0x0;var _0x132511=_0xa833[_0x11db31];return _0x132511;};'use strict';function DeskAccount(_0xf48f88){this['id']=_0xf48f88['id']||0x0;this['name']=_0xf48f88['name']||'';this[_0x3a83('0x0')]=_0xf48f88[_0x3a83('0x0')]||'';this[_0x3a83('0x1')]=_0xf48f88[_0x3a83('0x1')]||'';this['authType']=_0xf48f88['authType']||'';this[_0x3a83('0x2')]=_0xf48f88[_0x3a83('0x2')]||'';this[_0x3a83('0x3')]=_0xf48f88[_0x3a83('0x3')]||'';this[_0x3a83('0x4')]=_0xf48f88[_0x3a83('0x4')]||'';this[_0x3a83('0x5')]=_0xf48f88[_0x3a83('0x5')]||'';this[_0x3a83('0x6')]=_0xf48f88[_0x3a83('0x6')]||'';this[_0x3a83('0x7')]=_0xf48f88[_0x3a83('0x7')]||'';this['serverUrl']=_0xf48f88[_0x3a83('0x8')]||'';this['Configurations']=_0xf48f88[_0x3a83('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x994c=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x3e5e9f,_0x5fef20){var _0x25bf34=function(_0x6997e4){while(--_0x6997e4){_0x3e5e9f['push'](_0x3e5e9f['shift']());}};_0x25bf34(++_0x5fef20);}(_0x994c,0x19e));var _0xc994=function(_0xdf882d,_0x380525){_0xdf882d=_0xdf882d-0x0;var _0x30d213=_0x994c[_0xdf882d];return _0x30d213;};'use strict';function DeskAccount(_0x620301){this['id']=_0x620301['id']||0x0;this[_0xc994('0x0')]=_0x620301['name']||'';this['username']=_0x620301['username']||'';this['remoteUri']=_0x620301[_0xc994('0x1')]||'';this['authType']=_0x620301[_0xc994('0x2')]||'';this['password']=_0x620301[_0xc994('0x3')]||'';this[_0xc994('0x4')]=_0x620301[_0xc994('0x4')]||'';this[_0xc994('0x5')]=_0x620301[_0xc994('0x5')]||'';this['token']=_0x620301[_0xc994('0x6')]||'';this[_0xc994('0x7')]=_0x620301[_0xc994('0x7')]||'';this[_0xc994('0x8')]=_0x620301['type']||'';this[_0xc994('0x9')]=_0x620301[_0xc994('0x9')]||'';this[_0xc994('0xa')]=_0x620301['Configurations']||{};}module[_0xc994('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2498b73..14ccc10 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 _0xa2f1=['username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x122bf1,_0x3da7c1){var _0x367fe4=function(_0x5d2ee4){while(--_0x5d2ee4){_0x122bf1['push'](_0x122bf1['shift']());}};_0x367fe4(++_0x3da7c1);}(_0xa2f1,0x1ac));var _0x1a2f=function(_0x13e8cb,_0x585332){_0x13e8cb=_0x13e8cb-0x0;var _0x4016a1=_0xa2f1[_0x13e8cb];return _0x4016a1;};'use strict';function Dynamics365Account(_0x5ddc82){this['id']=_0x5ddc82['id']||0x0;this['name']=_0x5ddc82[_0x1a2f('0x0')]||'';this[_0x1a2f('0x1')]=_0x5ddc82[_0x1a2f('0x1')]||'';this['password']=_0x5ddc82[_0x1a2f('0x2')]||'';this[_0x1a2f('0x3')]=_0x5ddc82['remoteUri']||'';this[_0x1a2f('0x4')]=_0x5ddc82['tenantId']||'';this['clientId']=_0x5ddc82['clientId']||'';this[_0x1a2f('0x5')]=_0x5ddc82[_0x1a2f('0x5')]||{};this['serverUrl']=_0x5ddc82[_0x1a2f('0x6')]||'';this[_0x1a2f('0x7')]=_0x5ddc82[_0x1a2f('0x7')]||![];this[_0x1a2f('0x8')]=_0x5ddc82[_0x1a2f('0x8')]||{};this[_0x1a2f('0x9')]=_0x5ddc82[_0x1a2f('0x9')]||{};}module[_0x1a2f('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xe767=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','CloudProvider','exports','name'];(function(_0x970913,_0x4c1b7d){var _0x25ccc3=function(_0x6aaa6f){while(--_0x6aaa6f){_0x970913['push'](_0x970913['shift']());}};_0x25ccc3(++_0x4c1b7d);}(_0xe767,0x107));var _0x7e76=function(_0xc9009a,_0x4d75b4){_0xc9009a=_0xc9009a-0x0;var _0x3932e0=_0xe767[_0xc9009a];return _0x3932e0;};'use strict';function Dynamics365Account(_0x1407ab){this['id']=_0x1407ab['id']||0x0;this['name']=_0x1407ab[_0x7e76('0x0')]||'';this[_0x7e76('0x1')]=_0x1407ab[_0x7e76('0x1')]||'';this[_0x7e76('0x2')]=_0x1407ab['password']||'';this[_0x7e76('0x3')]=_0x1407ab[_0x7e76('0x3')]||'';this[_0x7e76('0x4')]=_0x1407ab[_0x7e76('0x4')]||'';this[_0x7e76('0x5')]=_0x1407ab[_0x7e76('0x5')]||'';this[_0x7e76('0x6')]=_0x1407ab[_0x7e76('0x6')]||{};this[_0x7e76('0x7')]=_0x1407ab['serverUrl']||'';this['modernAuthentication']=_0x1407ab['modernAuthentication']||![];this[_0x7e76('0x8')]=_0x1407ab[_0x7e76('0x8')]||{};this[_0x7e76('0x9')]=_0x1407ab[_0x7e76('0x9')]||{};}module[_0x7e76('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 a77fbe0..3eb442b 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 _0x9cd1=['maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9cd1,0xaa));var _0x19cd=function(_0x3b7bc9,_0x30faed){_0x3b7bc9=_0x3b7bc9-0x0;var _0x457988=_0x9cd1[_0x3b7bc9];return _0x457988;};'use strict';function FaxAccount(_0x32bbcc){this['id']=_0x32bbcc['id']||0x0;this['name']=_0x32bbcc[_0x19cd('0x0')]||'';this['description']=_0x32bbcc[_0x19cd('0x1')];this[_0x19cd('0x2')]=_0x32bbcc[_0x19cd('0x2')];this[_0x19cd('0x3')]=_0x32bbcc[_0x19cd('0x3')];this[_0x19cd('0x4')]=_0x32bbcc['localstationid'];this[_0x19cd('0x5')]=_0x32bbcc['minrate']||0x960;this['maxrate']=_0x32bbcc[_0x19cd('0x6')]||0x3840;this[_0x19cd('0x7')]=_0x32bbcc[_0x19cd('0x7')]||'v17,v27,v29';this[_0x19cd('0x8')]=_0x32bbcc[_0x19cd('0x8')]||'no';this[_0x19cd('0x9')]=_0x32bbcc[_0x19cd('0x9')]||'no';this[_0x19cd('0xa')]=_0x32bbcc['t38timeout']||0x1388;this[_0x19cd('0xb')]=_0x32bbcc[_0x19cd('0xb')]||'SIP';this[_0x19cd('0xc')]=_0x32bbcc[_0x19cd('0xc')]?_0x32bbcc[_0x19cd('0xc')]:undefined;this[_0x19cd('0xd')]=_0x32bbcc[_0x19cd('0xd')];this[_0x19cd('0xe')]=_0x32bbcc[_0x19cd('0xe')];}module[_0x19cd('0xf')]=FaxAccount; \ No newline at end of file +var _0xb99e=['Trunk','ListId','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb99e,0x1b2));var _0xeb99=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb99e[_0x3947c9];return _0x2e7871;};'use strict';function FaxAccount(_0x1fadf9){this['id']=_0x1fadf9['id']||0x0;this[_0xeb99('0x0')]=_0x1fadf9['name']||'';this[_0xeb99('0x1')]=_0x1fadf9[_0xeb99('0x1')];this['ecm']=_0x1fadf9[_0xeb99('0x2')];this[_0xeb99('0x3')]=_0x1fadf9[_0xeb99('0x3')];this[_0xeb99('0x4')]=_0x1fadf9[_0xeb99('0x4')];this['minrate']=_0x1fadf9[_0xeb99('0x5')]||0x960;this[_0xeb99('0x6')]=_0x1fadf9[_0xeb99('0x6')]||0x3840;this[_0xeb99('0x7')]=_0x1fadf9[_0xeb99('0x7')]||_0xeb99('0x8');this[_0xeb99('0x9')]=_0x1fadf9[_0xeb99('0x9')]||'no';this[_0xeb99('0xa')]=_0x1fadf9['faxdetect']||'no';this[_0xeb99('0xb')]=_0x1fadf9[_0xeb99('0xb')]||0x1388;this['tech']=_0x1fadf9[_0xeb99('0xc')]||_0xeb99('0xd');this['Trunk']=_0x1fadf9[_0xeb99('0xe')]?_0x1fadf9['Trunk']:undefined;this[_0xeb99('0xf')]=_0x1fadf9[_0xeb99('0xf')];this['key']=_0x1fadf9['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c92c6c0..f3a9025 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 _0x952a=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x239494,_0x33dd6c){var _0x442774=function(_0x2311cd){while(--_0x2311cd){_0x239494['push'](_0x239494['shift']());}};_0x442774(++_0x33dd6c);}(_0x952a,0x13e));var _0xa952=function(_0xcd6714,_0x1770a3){_0xcd6714=_0xcd6714-0x0;var _0x109bd7=_0x952a[_0xcd6714];return _0x109bd7;};'use strict';function FreshdeskAccount(_0x3f6c1a){this['id']=_0x3f6c1a['id']||0x0;this['name']=_0x3f6c1a['name']||'';this[_0xa952('0x0')]=_0x3f6c1a[_0xa952('0x0')]||'';this[_0xa952('0x1')]=_0x3f6c1a[_0xa952('0x2')]||'';this[_0xa952('0x3')]=_0x3f6c1a[_0xa952('0x3')]||'';this['serverUrl']=_0x3f6c1a[_0xa952('0x4')]||'';this[_0xa952('0x5')]=_0x3f6c1a[_0xa952('0x5')]||{};}module[_0xa952('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xdc1e=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xdc1e,0xda));var _0xedc1=function(_0x25d8e0,_0x151f55){_0x25d8e0=_0x25d8e0-0x0;var _0x2629e0=_0xdc1e[_0x25d8e0];return _0x2629e0;};'use strict';function FreshdeskAccount(_0x42ab9f){this['id']=_0x42ab9f['id']||0x0;this[_0xedc1('0x0')]=_0x42ab9f[_0xedc1('0x0')]||'';this[_0xedc1('0x1')]=_0x42ab9f['username']||'';this['apiKey']=_0x42ab9f['token']||'';this[_0xedc1('0x2')]=_0x42ab9f[_0xedc1('0x2')]||'';this['serverUrl']=_0x42ab9f[_0xedc1('0x3')]||'';this[_0xedc1('0x4')]=_0x42ab9f[_0xedc1('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b49342c..68767cb 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 _0x3baf=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x15760a,_0x2dcd9a){var _0xf7d0f7=function(_0x3b4bb5){while(--_0x3b4bb5){_0x15760a['push'](_0x15760a['shift']());}};_0xf7d0f7(++_0x2dcd9a);}(_0x3baf,0xf7));var _0xf3ba=function(_0x46c584,_0x3b0b77){_0x46c584=_0x46c584-0x0;var _0xf55ebc=_0x3baf[_0x46c584];return _0xf55ebc;};'use strict';function FreshsalesAccount(_0x339d9f){this['id']=_0x339d9f['id']||0x0;this[_0xf3ba('0x0')]=_0x339d9f[_0xf3ba('0x0')]||'';this[_0xf3ba('0x1')]=_0x339d9f[_0xf3ba('0x1')]||'';this[_0xf3ba('0x2')]=_0x339d9f[_0xf3ba('0x3')]||'';this[_0xf3ba('0x4')]=_0x339d9f[_0xf3ba('0x4')]||'';this[_0xf3ba('0x5')]=_0x339d9f[_0xf3ba('0x5')]||'';this[_0xf3ba('0x6')]=_0x339d9f[_0xf3ba('0x6')]||{};}module[_0xf3ba('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x535f=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x344163,_0x4e34f0){var _0x45f0f4=function(_0x436f70){while(--_0x436f70){_0x344163['push'](_0x344163['shift']());}};_0x45f0f4(++_0x4e34f0);}(_0x535f,0x111));var _0xf535=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x535f[_0x308213];return _0x2e1619;};'use strict';function FreshsalesAccount(_0x3384ca){this['id']=_0x3384ca['id']||0x0;this[_0xf535('0x0')]=_0x3384ca[_0xf535('0x0')]||'';this['username']=_0x3384ca[_0xf535('0x1')]||'';this[_0xf535('0x2')]=_0x3384ca[_0xf535('0x3')]||'';this[_0xf535('0x4')]=_0x3384ca['remoteUri']||'';this[_0xf535('0x5')]=_0x3384ca[_0xf535('0x5')]||'';this[_0xf535('0x6')]=_0x3384ca[_0xf535('0x6')]||{};}module[_0xf535('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 508dc43..2bf3b44 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 _0x45e8=['lastAssignedTo','motionChannel','voice','variables','exports','type','inbound','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','holdtime','assigned'];(function(_0x26f7b4,_0x569864){var _0x401c41=function(_0x126375){while(--_0x126375){_0x26f7b4['push'](_0x26f7b4['shift']());}};_0x401c41(++_0x569864);}(_0x45e8,0x191));var _0x845e=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x45e8[_0x3d2e4b];return _0x509e78;};'use strict';function QueueReport(){this[_0x845e('0x0')]=_0x845e('0x1');this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this[_0x845e('0x2')]='';this['queuecallerjoinAt']=null;this[_0x845e('0x3')]=null;this[_0x845e('0x4')]=0x1;this[_0x845e('0x5')]=0x1;this[_0x845e('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x845e('0x7')]=![];this[_0x845e('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x845e('0x9')]=0x1;this[_0x845e('0xa')]='';this[_0x845e('0xb')]='';this[_0x845e('0xc')]='';this[_0x845e('0xd')]='';this['context']='';this[_0x845e('0xe')]='';this['priority']='';this[_0x845e('0xf')]=0x0;this[_0x845e('0x10')]=![];this[_0x845e('0x11')]='';this[_0x845e('0x12')]=_0x845e('0x13');this['routealias']=null;this['mohtime']=0x0;this[_0x845e('0x14')]={};}module[_0x845e('0x15')]=QueueReport; \ No newline at end of file +var _0x96fa=['calleridnum','calleridname','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinename','accountcode','context','holdtime','motionChannel','mohtime','variables','exports','inbound','uniqueid'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x96fa,0x7c));var _0xa96f=function(_0xb4077d,_0x524d33){_0xb4077d=_0xb4077d-0x0;var _0x159c78=_0x96fa[_0xb4077d];return _0x159c78;};'use strict';function QueueReport(){this['type']=_0xa96f('0x0');this[_0xa96f('0x1')]='';this[_0xa96f('0x2')]='';this[_0xa96f('0x3')]='';this[_0xa96f('0x4')]='';this['queuecallerjoinAt']=null;this[_0xa96f('0x5')]=null;this['position']=0x1;this[_0xa96f('0x6')]=0x1;this[_0xa96f('0x7')]=![];this[_0xa96f('0x8')]=null;this[_0xa96f('0x9')]=![];this[_0xa96f('0xa')]=null;this[_0xa96f('0xb')]=![];this[_0xa96f('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0xa96f('0xd')]='';this[_0xa96f('0xe')]='';this[_0xa96f('0xf')]='';this['exten']='';this['priority']='';this[_0xa96f('0x10')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xa96f('0x11')]='voice';this['routealias']=null;this[_0xa96f('0x12')]=0x0;this[_0xa96f('0x13')]={};}module[_0xa96f('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b3948b7..9f823dc 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 _0x6c0c=['integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x27b16a,_0x1518f6){var _0x1072d7=function(_0x5b7a86){while(--_0x5b7a86){_0x27b16a['push'](_0x27b16a['shift']());}};_0x1072d7(++_0x1518f6);}(_0x6c0c,0x18f));var _0xc6c0=function(_0x8580d,_0x44e4ca){_0x8580d=_0x8580d-0x0;var _0x1cccb2=_0x6c0c[_0x8580d];return _0x1cccb2;};'use strict';function SalesforceAccount(_0x5cd58b){this['id']=_0x5cd58b['id']||0x0;this[_0xc6c0('0x0')]=_0x5cd58b['name']||'';this['username']=_0x5cd58b[_0xc6c0('0x1')]||'';this['remoteUri']=_0x5cd58b[_0xc6c0('0x2')]||'';this[_0xc6c0('0x3')]=_0x5cd58b[_0xc6c0('0x3')]||'';this[_0xc6c0('0x4')]=_0x5cd58b['clientId']||'';this['clientSecret']=_0x5cd58b[_0xc6c0('0x5')]||'';this[_0xc6c0('0x6')]=_0x5cd58b[_0xc6c0('0x6')]||'';this[_0xc6c0('0x7')]=_0x5cd58b[_0xc6c0('0x7')]||_0xc6c0('0x8');this[_0xc6c0('0x9')]=_0x5cd58b[_0xc6c0('0x9')]||'';this[_0xc6c0('0xa')]=_0x5cd58b['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x057f=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x1cb449,_0xf9b4a){var _0x13e504=function(_0xc01604){while(--_0xc01604){_0x1cb449['push'](_0x1cb449['shift']());}};_0x13e504(++_0xf9b4a);}(_0x057f,0xf1));var _0xf057=function(_0x240846,_0x471055){_0x240846=_0x240846-0x0;var _0x4be01e=_0x057f[_0x240846];return _0x4be01e;};'use strict';function SalesforceAccount(_0x5b4c85){this['id']=_0x5b4c85['id']||0x0;this[_0xf057('0x0')]=_0x5b4c85[_0xf057('0x0')]||'';this['username']=_0x5b4c85['username']||'';this['remoteUri']=_0x5b4c85[_0xf057('0x1')]||'';this[_0xf057('0x2')]=_0x5b4c85[_0xf057('0x2')]||'';this[_0xf057('0x3')]=_0x5b4c85[_0xf057('0x3')]||'';this[_0xf057('0x4')]=_0x5b4c85[_0xf057('0x4')]||'';this['securityToken']=_0x5b4c85[_0xf057('0x5')]||'';this[_0xf057('0x6')]=_0x5b4c85[_0xf057('0x6')]||_0xf057('0x7');this[_0xf057('0x8')]=_0x5b4c85['serverUrl']||'';this[_0xf057('0x9')]=_0x5b4c85[_0xf057('0x9')]||{};}module[_0xf057('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 73c9bb2..19fdff5 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 _0x8630=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x335eca,_0x23bee1){var _0x4a9e78=function(_0x5ef1ec){while(--_0x5ef1ec){_0x335eca['push'](_0x335eca['shift']());}};_0x4a9e78(++_0x23bee1);}(_0x8630,0x122));var _0x0863=function(_0x34c07f,_0x23a690){_0x34c07f=_0x34c07f-0x0;var _0x4d4036=_0x8630[_0x34c07f];return _0x4d4036;};'use strict';function ServicenowAccount(_0x224179){this['id']=_0x224179['id']||0x0;this[_0x0863('0x0')]=_0x224179[_0x0863('0x0')]||'';this[_0x0863('0x1')]=_0x224179[_0x0863('0x1')]||'';this[_0x0863('0x2')]=_0x224179[_0x0863('0x2')]||'';this[_0x0863('0x3')]=_0x224179[_0x0863('0x3')]||'';this['serverUrl']=_0x224179[_0x0863('0x4')]||'';this[_0x0863('0x5')]=_0x224179[_0x0863('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7ddc=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x631aa1,_0x2f7d83){var _0x319a1b=function(_0x3f34eb){while(--_0x3f34eb){_0x631aa1['push'](_0x631aa1['shift']());}};_0x319a1b(++_0x2f7d83);}(_0x7ddc,0x9b));var _0xc7dd=function(_0x4f01cd,_0x219bcd){_0x4f01cd=_0x4f01cd-0x0;var _0x153239=_0x7ddc[_0x4f01cd];return _0x153239;};'use strict';function ServicenowAccount(_0xa61a9a){this['id']=_0xa61a9a['id']||0x0;this[_0xc7dd('0x0')]=_0xa61a9a[_0xc7dd('0x0')]||'';this[_0xc7dd('0x1')]=_0xa61a9a['username']||'';this[_0xc7dd('0x2')]=_0xa61a9a[_0xc7dd('0x2')]||'';this['remoteUri']=_0xa61a9a[_0xc7dd('0x3')]||'';this['serverUrl']=_0xa61a9a[_0xc7dd('0x4')]||'';this[_0xc7dd('0x5')]=_0xa61a9a[_0xc7dd('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 6d24ccd..ca5df90 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 _0x8626=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x484c37,_0x1abc7f){var _0x39b822=function(_0x342591){while(--_0x342591){_0x484c37['push'](_0x484c37['shift']());}};_0x39b822(++_0x1abc7f);}(_0x8626,0xd9));var _0x6862=function(_0x2a8ad3,_0x1fd126){_0x2a8ad3=_0x2a8ad3-0x0;var _0x388956=_0x8626[_0x2a8ad3];return _0x388956;};'use strict';function SugarcrmAccount(_0x2958d5){this['id']=_0x2958d5['id']||0x0;this[_0x6862('0x0')]=_0x2958d5[_0x6862('0x0')]||'';this[_0x6862('0x1')]=_0x2958d5[_0x6862('0x1')]||'';this[_0x6862('0x2')]=_0x2958d5[_0x6862('0x2')]||'';this[_0x6862('0x3')]=_0x2958d5[_0x6862('0x3')]||'';this[_0x6862('0x4')]=_0x2958d5['serverUrl']||'';this[_0x6862('0x5')]=_0x2958d5[_0x6862('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x127f=['Configurations','exports','name','username','password','remoteUri'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x127f,0xbc));var _0xf127=function(_0x38184b,_0x50ac96){_0x38184b=_0x38184b-0x0;var _0x1784db=_0x127f[_0x38184b];return _0x1784db;};'use strict';function SugarcrmAccount(_0xec21df){this['id']=_0xec21df['id']||0x0;this[_0xf127('0x0')]=_0xec21df[_0xf127('0x0')]||'';this['username']=_0xec21df[_0xf127('0x1')]||'';this[_0xf127('0x2')]=_0xec21df[_0xf127('0x2')]||'';this[_0xf127('0x3')]=_0xec21df[_0xf127('0x3')]||'';this['serverUrl']=_0xec21df['serverUrl']||'';this[_0xf127('0x4')]=_0xec21df['Configurations']||{};}module[_0xf127('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c5870c7..0568512 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 _0xbfcc=['exports','accountcode','state','unknown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xbfcc[_0x5f1617];return _0x3af5da;};'use strict';function Telephone(_0x271987){this['id']=_0x271987['id']||0x0;this['name']=_0x271987['name']||'';this[_0xcbfc('0x0')]=_0x271987[_0xcbfc('0x0')]||'';this[_0xcbfc('0x1')]=_0xcbfc('0x2');this['stateTime']=0x0;this['status']='unknown';this['address']='';}module[_0xcbfc('0x3')]=Telephone; \ No newline at end of file +var _0x7e7b=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x20ca96,_0x309ae0){var _0x19bfd8=function(_0x3ab5b1){while(--_0x3ab5b1){_0x20ca96['push'](_0x20ca96['shift']());}};_0x19bfd8(++_0x309ae0);}(_0x7e7b,0x133));var _0xb7e7=function(_0x34826d,_0x224c02){_0x34826d=_0x34826d-0x0;var _0x339fe5=_0x7e7b[_0x34826d];return _0x339fe5;};'use strict';function Telephone(_0x3741bf){this['id']=_0x3741bf['id']||0x0;this[_0xb7e7('0x0')]=_0x3741bf['name']||'';this[_0xb7e7('0x1')]=_0x3741bf[_0xb7e7('0x1')]||'';this[_0xb7e7('0x2')]=_0xb7e7('0x3');this[_0xb7e7('0x4')]=0x0;this[_0xb7e7('0x5')]=_0xb7e7('0x3');this[_0xb7e7('0x6')]='';}module[_0xb7e7('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b8c44a2..43f8424 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(_0x5c6fc8,_0x34e1f6){var _0x2d4a18=function(_0x458145){while(--_0x458145){_0x5c6fc8['push'](_0x5c6fc8['shift']());}};_0x2d4a18(++_0x34e1f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0xb10b[_0x7d261d];return _0x1a992a;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x482882,_0x38890b){var _0x2c79c9=function(_0xeaf38c){while(--_0xeaf38c){_0x482882['push'](_0x482882['shift']());}};_0x2c79c9(++_0x38890b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c013d,_0x15a3df){_0x1c013d=_0x1c013d-0x0;var _0xda7764=_0xb10b[_0x1c013d];return _0xda7764;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6557583..6063862 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x4583f5,_0x48986e){var _0x16513b=function(_0x324230){while(--_0x324230){_0x4583f5['push'](_0x4583f5['shift']());}};_0x16513b(++_0x48986e);}(_0x4fc2,0x111));var _0x24fc=function(_0x3213b4,_0x3cddd0){_0x3213b4=_0x3213b4-0x0;var _0xa97785=_0x4fc2[_0x3213b4];return _0xa97785;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x428fb7,_0x33038e){var _0x2b6e1b=function(_0x18634f){while(--_0x18634f){_0x428fb7['push'](_0x428fb7['shift']());}};_0x2b6e1b(++_0x33038e);}(_0x757a,0xde));var _0xa757=function(_0x360991,_0x1761ae){_0x360991=_0x360991-0x0;var _0x17ddf2=_0x757a[_0x360991];return _0x17ddf2;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index cd31cda..a7952e9 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 _0xb135=['port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','status','unknown','registry','indexOf','split','host'];(function(_0x32e851,_0xc61922){var _0x1982b0=function(_0x362590){while(--_0x362590){_0x32e851['push'](_0x32e851['shift']());}};_0x1982b0(++_0xc61922);}(_0xb135,0x87));var _0x5b13=function(_0x46ec30,_0x4e0ecb){_0x46ec30=_0x46ec30-0x0;var _0x2f662c=_0xb135[_0x46ec30];return _0x2f662c;};'use strict';function Trunk(_0x1c8093){this['id']=_0x1c8093['id']||0x0;this[_0x5b13('0x0')]=_0x1c8093[_0x5b13('0x0')]||![];this[_0x5b13('0x1')]=_0x1c8093['name']||'';this[_0x5b13('0x2')]='unknown';this['stateTime']=0x0;this[_0x5b13('0x3')]=_0x5b13('0x4');this[_0x5b13('0x5')]=_0x1c8093[_0x5b13('0x5')]&&_0x1c8093[_0x5b13('0x5')][_0x5b13('0x6')](':')?_0x1c8093['registry'][_0x5b13('0x7')](':')[0x0]:'';this[_0x5b13('0x8')]='';this[_0x5b13('0x9')]='';this[_0x5b13('0xa')]='';this[_0x5b13('0xb')]='';this[_0x5b13('0xc')]='';this[_0x5b13('0xd')]=_0x5b13('0x4');this[_0x5b13('0xe')]='';this[_0x5b13('0xf')]='';this[_0x5b13('0x10')]=_0x1c8093[_0x5b13('0x10')]||'';}module[_0x5b13('0x11')]=Trunk; \ No newline at end of file +var _0x519b=['state','stateTime','status','unknown','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x519b,0x6e));var _0xb519=function(_0xe5a818,_0x4c97b2){_0xe5a818=_0xe5a818-0x0;var _0x136863=_0x519b[_0xe5a818];return _0x136863;};'use strict';function Trunk(_0xd0f996){this['id']=_0xd0f996['id']||0x0;this[_0xb519('0x0')]=_0xd0f996[_0xb519('0x0')]||![];this[_0xb519('0x1')]=_0xd0f996[_0xb519('0x1')]||'';this[_0xb519('0x2')]='unknown';this[_0xb519('0x3')]=0x0;this[_0xb519('0x4')]=_0xb519('0x5');this['registry']=_0xd0f996[_0xb519('0x6')]&&_0xd0f996[_0xb519('0x6')][_0xb519('0x7')](':')?_0xd0f996[_0xb519('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0xb519('0x8')]='';this[_0xb519('0x9')]='';this[_0xb519('0xa')]='';this[_0xb519('0xb')]='';this[_0xb519('0xc')]='unknown';this[_0xb519('0xd')]='';this[_0xb519('0xe')]='';this['defaultuser']=_0xd0f996['defaultuser']||'';}module[_0xb519('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fd0499c..f37fb04 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 _0x32c7=['mandatoryDisposition','exten','recordingFormat'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x32c7,0x151));var _0x732c=function(_0x4402b7,_0x5cce0a){_0x4402b7=_0x4402b7-0x0;var _0xa0c415=_0x32c7[_0x4402b7];return _0xa0c415;};'use strict';function voiceExtension(_0x52ed94){this['id']=_0x52ed94['id']||0x0;this[_0x732c('0x0')]=_0x52ed94[_0x732c('0x0')]||'';this[_0x732c('0x1')]=_0x52ed94['recordingFormat']||'none';this[_0x732c('0x2')]=_0x52ed94[_0x732c('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x7380=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x29859f,_0x2f7896){var _0x3a4118=function(_0x724cc7){while(--_0x724cc7){_0x29859f['push'](_0x29859f['shift']());}};_0x3a4118(++_0x2f7896);}(_0x7380,0x1f1));var _0x0738=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7380[_0x13ea00];return _0x1f7347;};'use strict';function voiceExtension(_0x438489){this['id']=_0x438489['id']||0x0;this[_0x0738('0x0')]=_0x438489['exten']||'';this['recordingFormat']=_0x438489[_0x0738('0x1')]||_0x0738('0x2');this[_0x0738('0x3')]=_0x438489[_0x0738('0x3')]||![];}module[_0x0738('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 1263de4..78a42d6 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 _0xa680=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','leastrecent','linear','random','ringall','rrmemory','name','monitor_format','type','inbound','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x386b33,_0x484510){var _0x2095a0=function(_0x208ed9){while(--_0x208ed9){_0x386b33['push'](_0x386b33['shift']());}};_0x2095a0(++_0x484510);}(_0xa680,0xb0));var _0x0a68=function(_0x2c7cb4,_0x53bda2){_0x2c7cb4=_0x2c7cb4-0x0;var _0x54bf50=_0xa680[_0x2c7cb4];return _0x54bf50;};'use strict';var monitorFormat={'wav':_0x0a68('0x0'),'wav49':_0x0a68('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x0a68('0x2'),'linear':_0x0a68('0x3'),'random':_0x0a68('0x4'),'ringall':_0x0a68('0x5'),'rr':'roundrobin','rrmemory':_0x0a68('0x6'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x588889){this['id']=_0x588889['id']||0x0;this[_0x0a68('0x7')]=_0x588889[_0x0a68('0x7')]||'';this[_0x0a68('0x8')]=_0x588889[_0x0a68('0x8')]||'';this[_0x0a68('0x9')]=_0x588889[_0x0a68('0x9')]||_0x0a68('0xa');this['waiting']=0x0;this['total']=0x0;this[_0x0a68('0xb')]=0x0;this[_0x0a68('0xc')]=0x0;this[_0x0a68('0xd')]=0x0;this[_0x0a68('0xe')]=0x0;this[_0x0a68('0xf')]=0x0;this[_0x0a68('0x10')]=0x0;this[_0x0a68('0x11')]=0x0;this[_0x0a68('0x12')]=0x0;this[_0x0a68('0x13')]=0x0;this['invalid']=0x0;this[_0x0a68('0x14')]=0x0;this[_0x0a68('0x15')]=0x0;this[_0x0a68('0x16')]=0x0;this[_0x0a68('0x17')]=0x0;this[_0x0a68('0x18')]=0x0;this[_0x0a68('0x19')]=0x0;this[_0x0a68('0x1a')]=0x0;this[_0x0a68('0x1b')]=0x0;this['unknown']=0x0;this['acw']=_0x588889[_0x0a68('0x1c')]||![];this[_0x0a68('0x1d')]=_0x588889[_0x0a68('0x1d')]||0xa;this['autopause']=_0x588889[_0x0a68('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x0a68('0x1f')]='';this[_0x0a68('0x20')]='';this['originated']=0x0;this[_0x0a68('0x21')]=0x0;this[_0x0a68('0x22')]=_0x588889[_0x0a68('0x22')]||null;this[_0x0a68('0x23')]=_0x588889[_0x0a68('0x23')]?_0x588889[_0x0a68('0x23')]:null;this['dialActive']=_0x588889['dialActive'];this['dialMethod']=_0x588889[_0x0a68('0x24')]||_0x0a68('0x25');this[_0x0a68('0x26')]=_0x588889['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x588889[_0x0a68('0x27')]||0x0;this[_0x0a68('0x28')]=_0x588889[_0x0a68('0x28')]||0x1;this[_0x0a68('0x29')]=_0x588889['dialPredictiveOptimization']||_0x0a68('0x2a');this[_0x0a68('0x2b')]=_0x588889[_0x0a68('0x2b')]||0.03;this['dialPredictiveInterval']=_0x588889[_0x0a68('0x2c')]||0x258;this[_0x0a68('0x2d')]=_0x588889['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x588889[_0x0a68('0x2e')]||_0x0a68('0x2f');this['dialOriginateTimeout']=_0x588889['dialOriginateTimeout']||0x1e;this[_0x0a68('0x30')]=_0x588889['dialQueueOptions']||_0x0a68('0x31');this['dialQueueTimeout']=_0x588889[_0x0a68('0x32')]||0x3;this[_0x0a68('0x33')]=_0x588889[_0x0a68('0x33')]||undefined;this[_0x0a68('0x34')]=_0x588889[_0x0a68('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x588889[_0x0a68('0x35')]||0x96;this[_0x0a68('0x36')]=_0x588889[_0x0a68('0x36')]||0x3;this['dialBusyRetryFrequency']=_0x588889[_0x0a68('0x37')]||0x96;this[_0x0a68('0x38')]=_0x588889['dialNoAnswerMaxRetry']||0x3;this[_0x0a68('0x39')]=_0x588889[_0x0a68('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x588889[_0x0a68('0x3a')]||0x3;this[_0x0a68('0x3b')]=_0x588889[_0x0a68('0x3b')]||0x96;this[_0x0a68('0x3c')]=_0x588889['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x588889[_0x0a68('0x3d')]||0x96;this['dialAbandonedMaxRetry']=_0x588889['dialAbandonedMaxRetry']||0x3;this[_0x0a68('0x3e')]=_0x588889[_0x0a68('0x3e')]||0x96;this[_0x0a68('0x3f')]=_0x588889[_0x0a68('0x3f')]||0x3;this['dialMachineRetryFrequency']=_0x588889['dialMachineRetryFrequency']||0x96;this[_0x0a68('0x40')]=_0x588889[_0x0a68('0x40')]||0x3;this[_0x0a68('0x41')]=_0x588889[_0x0a68('0x41')]||0x96;this[_0x0a68('0x42')]=_0x588889['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x588889['dialGlobalMaxRetry']||0x4;this[_0x0a68('0x43')]=_0x588889[_0x0a68('0x43')]?_0x588889[_0x0a68('0x43')]:undefined;this[_0x0a68('0x44')]=_0x588889[_0x0a68('0x44')]?_0x588889['TrunkBackup']:undefined;this['dialPrefix']=_0x588889[_0x0a68('0x45')]||undefined;this[_0x0a68('0x46')]=_0x588889[_0x0a68('0x46')]?_0x588889[_0x0a68('0x46')]:undefined;this['dialOrderByScheduledAt']=_0x588889[_0x0a68('0x47')]||_0x0a68('0x48');this[_0x0a68('0x49')]=_0x588889[_0x0a68('0x49')]||undefined;this[_0x0a68('0x4a')]=_0x588889[_0x0a68('0x4a')]||undefined;this[_0x0a68('0x4b')]=strategy[_0x588889['strategy']];this[_0x0a68('0x4c')]=!![];this[_0x0a68('0x4d')]=_0x588889[_0x0a68('0x4d')]||![];this[_0x0a68('0x4e')]=_0x588889[_0x0a68('0x4e')];this[_0x0a68('0x4f')]=_0x588889[_0x0a68('0x4f')];this[_0x0a68('0x50')]=_0x588889['dialAMDAfterGreetingSilence'];this[_0x0a68('0x51')]=_0x588889[_0x0a68('0x51')];this[_0x0a68('0x52')]=_0x588889[_0x0a68('0x52')];this[_0x0a68('0x53')]=_0x588889[_0x0a68('0x53')];this['dialAMDMaximumNumberOfWords']=_0x588889[_0x0a68('0x54')];this[_0x0a68('0x55')]=_0x588889[_0x0a68('0x55')];this[_0x0a68('0x56')]=_0x588889[_0x0a68('0x56')];this[_0x0a68('0x57')]=0x0;this[_0x0a68('0x58')]=0x0;this[_0x0a68('0x59')]=_0x588889[_0x0a68('0x59')];this[_0x0a68('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x0a68('0x5b')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0a68('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x0a68('0x5d')]=0x0;this[_0x0a68('0x5e')]=0x0;this[_0x0a68('0x5f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x0a68('0x60')]=0x0;this[_0x0a68('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x0a68('0x62')]=undefined;this[_0x0a68('0x63')]=undefined;this['handlePredictive']=undefined;this[_0x0a68('0x64')]=1.05;this[_0x0a68('0x65')]=0x0;this[_0x0a68('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0a68('0x67')]=0x0;this[_0x0a68('0x68')]=0x0;this[_0x0a68('0x69')]=0x0;this[_0x0a68('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x588889[_0x0a68('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x588889['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x0a68('0x6c')]=0x0;this[_0x0a68('0x6d')]=0x0;this[_0x0a68('0x6e')]=0x1;this[_0x0a68('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x0a68('0x70')]=0x0;this[_0x0a68('0x71')]=0x0;this[_0x0a68('0x72')]=_0x588889[_0x0a68('0x72')]||0x1e;this['dialRecallInQueue']=_0x588889['dialRecallInQueue']||![];this[_0x0a68('0x73')]=!!_0x588889[_0x0a68('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x588889[_0x0a68('0x74')]||![];this[_0x0a68('0x75')]=_0x588889[_0x0a68('0x75')]||undefined;this[_0x0a68('0x76')]=_0x588889[_0x0a68('0x76')]||![];this[_0x0a68('0x77')]=_0x588889[_0x0a68('0x77')]||![];this[_0x0a68('0x8')]=monitorFormat[_0x588889[_0x0a68('0x8')]]?monitorFormat[_0x588889[_0x0a68('0x8')]]:undefined;this[_0x0a68('0x78')]=_0x588889[_0x0a68('0x78')]||![];this[_0x0a68('0x79')]=_0x588889[_0x0a68('0x79')]?_0x588889[_0x0a68('0x79')]:undefined;this[_0x0a68('0x7a')]=![];}module[_0x0a68('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x0619=['dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold'];(function(_0x22ab23,_0x4dce15){var _0x441512=function(_0x2d5d3d){while(--_0x2d5d3d){_0x22ab23['push'](_0x22ab23['shift']());}};_0x441512(++_0x4dce15);}(_0x0619,0x90));var _0x9061=function(_0x130063,_0x53d941){_0x130063=_0x130063-0x0;var _0x37cd2f=_0x0619[_0x130063];return _0x37cd2f;};'use strict';var monitorFormat={'wav':_0x9061('0x0'),'wav49':_0x9061('0x1'),'gsm':_0x9061('0x2')};var strategy={'fewestcalls':_0x9061('0x3'),'leastrecent':'leastrecent','linear':_0x9061('0x4'),'random':_0x9061('0x5'),'ringall':_0x9061('0x6'),'rr':_0x9061('0x7'),'rrmemory':_0x9061('0x8'),'rrordered':_0x9061('0x9'),'wrandom':_0x9061('0xa')};function VoiceQueue(_0x3a79a8){this['id']=_0x3a79a8['id']||0x0;this[_0x9061('0xb')]=_0x3a79a8[_0x9061('0xb')]||'';this[_0x9061('0xc')]=_0x3a79a8['monitor_format']||'';this[_0x9061('0xd')]=_0x3a79a8['type']||'inbound';this[_0x9061('0xe')]=0x0;this[_0x9061('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x9061('0x10')]=0x0;this[_0x9061('0x11')]=0x0;this[_0x9061('0x12')]=0x0;this[_0x9061('0x13')]=0x0;this[_0x9061('0x14')]=0x0;this[_0x9061('0x15')]=0x0;this[_0x9061('0x16')]=0x0;this[_0x9061('0x17')]=0x0;this[_0x9061('0x18')]=0x0;this[_0x9061('0x19')]=0x0;this[_0x9061('0x1a')]=0x0;this[_0x9061('0x1b')]=0x0;this[_0x9061('0x1c')]=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0x9061('0x1d')]=0x0;this[_0x9061('0x1e')]=0x0;this[_0x9061('0x1f')]=_0x3a79a8[_0x9061('0x1f')]||![];this[_0x9061('0x20')]=_0x3a79a8['acwTimeout']||0xa;this['autopause']=_0x3a79a8[_0x9061('0x21')]||'no';this[_0x9061('0x22')]=!![];this['message']='';this[_0x9061('0x23')]='';this['originated']=0x0;this[_0x9061('0x24')]=0x0;this['dialTimezone']=_0x3a79a8[_0x9061('0x25')]||null;this['dialGlobalInterval']=_0x3a79a8[_0x9061('0x26')]?_0x3a79a8[_0x9061('0x26')]:null;this[_0x9061('0x27')]=_0x3a79a8[_0x9061('0x27')];this[_0x9061('0x28')]=_0x3a79a8[_0x9061('0x28')]||_0x9061('0x29');this[_0x9061('0x2a')]=_0x3a79a8['dialLimitChannel']||0x0;this[_0x9061('0x2b')]=_0x3a79a8[_0x9061('0x2b')]||0x0;this[_0x9061('0x2c')]=_0x3a79a8[_0x9061('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x3a79a8[_0x9061('0x2d')]||_0x9061('0x2e');this['dialPredictiveOptimizationPercentage']=_0x3a79a8['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x3a79a8[_0x9061('0x2f')]||0x258;this[_0x9061('0x30')]=_0x3a79a8['dialOriginateCallerIdName']||'anonymous';this[_0x9061('0x31')]=_0x3a79a8['dialOriginateCallerIdNumber']||'anonymous';this[_0x9061('0x32')]=_0x3a79a8[_0x9061('0x32')]||0x1e;this[_0x9061('0x33')]=_0x3a79a8[_0x9061('0x33')]||_0x9061('0x34');this[_0x9061('0x35')]=_0x3a79a8[_0x9061('0x35')]||0x3;this[_0x9061('0x36')]=_0x3a79a8[_0x9061('0x36')]||undefined;this[_0x9061('0x37')]=_0x3a79a8[_0x9061('0x37')]||0x3;this[_0x9061('0x38')]=_0x3a79a8['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x3a79a8[_0x9061('0x39')]||0x3;this[_0x9061('0x3a')]=_0x3a79a8[_0x9061('0x3a')]||0x96;this[_0x9061('0x3b')]=_0x3a79a8[_0x9061('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3a79a8[_0x9061('0x3c')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3a79a8['dialNoSuchNumberMaxRetry']||0x3;this[_0x9061('0x3d')]=_0x3a79a8[_0x9061('0x3d')]||0x96;this[_0x9061('0x3e')]=_0x3a79a8[_0x9061('0x3e')]||0x3;this[_0x9061('0x3f')]=_0x3a79a8[_0x9061('0x3f')]||0x96;this[_0x9061('0x40')]=_0x3a79a8[_0x9061('0x40')]||0x3;this[_0x9061('0x41')]=_0x3a79a8[_0x9061('0x41')]||0x96;this[_0x9061('0x42')]=_0x3a79a8['dialMachineMaxRetry']||0x3;this[_0x9061('0x43')]=_0x3a79a8[_0x9061('0x43')]||0x96;this['dialAgentRejectMaxRetry']=_0x3a79a8[_0x9061('0x44')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3a79a8[_0x9061('0x45')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3a79a8['callAdditionalPhoneAfterMin']||0x3;this[_0x9061('0x46')]=_0x3a79a8[_0x9061('0x46')]||0x4;this['Trunk']=_0x3a79a8[_0x9061('0x47')]?_0x3a79a8['Trunk']:undefined;this[_0x9061('0x48')]=_0x3a79a8[_0x9061('0x48')]?_0x3a79a8['TrunkBackup']:undefined;this[_0x9061('0x49')]=_0x3a79a8[_0x9061('0x49')]||undefined;this[_0x9061('0x4a')]=_0x3a79a8[_0x9061('0x4a')]?_0x3a79a8[_0x9061('0x4a')]:undefined;this[_0x9061('0x4b')]=_0x3a79a8[_0x9061('0x4b')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x3a79a8[_0x9061('0x4c')]||undefined;this[_0x9061('0x4d')]=_0x3a79a8['dialCutDigit']||undefined;this[_0x9061('0x4e')]=strategy[_0x3a79a8[_0x9061('0x4e')]];this['queueStatusComplete']=!![];this[_0x9061('0x4f')]=_0x3a79a8[_0x9061('0x4f')]||![];this[_0x9061('0x50')]=_0x3a79a8[_0x9061('0x50')];this[_0x9061('0x51')]=_0x3a79a8[_0x9061('0x51')];this[_0x9061('0x52')]=_0x3a79a8[_0x9061('0x52')];this[_0x9061('0x53')]=_0x3a79a8['dialAMDTotalAnalysisTime'];this[_0x9061('0x54')]=_0x3a79a8['dialAMDMinWordLength'];this[_0x9061('0x55')]=_0x3a79a8['dialAMDBetweenWordsSilence'];this[_0x9061('0x56')]=_0x3a79a8[_0x9061('0x56')];this[_0x9061('0x57')]=_0x3a79a8[_0x9061('0x57')];this['dialAMDMaximumWordLength']=_0x3a79a8['dialAMDMaximumWordLength'];this[_0x9061('0x58')]=0x0;this['pTalking']=0x0;this[_0x9061('0x59')]=_0x3a79a8['timeout'];this[_0x9061('0x5a')]=0x0;this[_0x9061('0x5b')]=0x0;this[_0x9061('0x5c')]=0x0;this[_0x9061('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9061('0x5e')]=0x0;this[_0x9061('0x5f')]=0x0;this[_0x9061('0x60')]=0x0;this[_0x9061('0x61')]=0x0;this[_0x9061('0x62')]=0x0;this[_0x9061('0x63')]=0x0;this[_0x9061('0x64')]=0x0;this[_0x9061('0x65')]=0x0;this[_0x9061('0x66')]=0x0;this[_0x9061('0x67')]=undefined;this[_0x9061('0x68')]=undefined;this[_0x9061('0x69')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x9061('0x6a')]=0x0;this[_0x9061('0x6b')]=0x0;this[_0x9061('0x6c')]=0x0;this[_0x9061('0x6d')]=0x0;this[_0x9061('0x6e')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x9061('0x6f')]=0x0;this[_0x9061('0x70')]=0x0;this[_0x9061('0x71')]=_0x3a79a8['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x3a79a8[_0x9061('0x72')]||0xa;this[_0x9061('0x73')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x9061('0x74')]=0x0;this[_0x9061('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x9061('0x76')]=0x0;this[_0x9061('0x77')]=_0x3a79a8[_0x9061('0x77')]||0x1e;this[_0x9061('0x78')]=_0x3a79a8['dialRecallInQueue']||![];this[_0x9061('0x79')]=!!_0x3a79a8[_0x9061('0x79')]||![];this['dialPreviewRecallmeReminder']=!!_0x3a79a8[_0x9061('0x7a')]||![];this[_0x9061('0x7b')]=_0x3a79a8['dialQueueProject2']||undefined;this[_0x9061('0x7c')]=_0x3a79a8[_0x9061('0x7c')]||![];this[_0x9061('0x7d')]=_0x3a79a8[_0x9061('0x7d')]||![];this[_0x9061('0xc')]=monitorFormat[_0x3a79a8['monitor_format']]?monitorFormat[_0x3a79a8[_0x9061('0xc')]]:undefined;this[_0x9061('0x7e')]=_0x3a79a8[_0x9061('0x7e')]||![];this[_0x9061('0x7f')]=_0x3a79a8[_0x9061('0x7f')]?_0x3a79a8[_0x9061('0x7f')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x9061('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index dc9a421..0d988e0 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 _0x72a2=['exports','loggedIn','loggedInDb','paused','ringing','talking','available','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumBillable','waiting','name','strategy','abandoned','answered','busy','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','invalid','loggedin','callers','length','online','status','booked','queue','dialer','exten','xcally-motion-preview','some','updateReportFromOutboundQueue','outboundCongestionCallsDay','preview'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x72a2,0x161));var _0x272a=function(_0x38a166,_0x2fb80){_0x38a166=_0x38a166-0x0;var _0x59f6c2=_0x72a2[_0x38a166];return _0x59f6c2;};'use strict';var INBOUND_COUNTERS=['available',_0x272a('0x0'),_0x272a('0x1'),_0x272a('0x2'),_0x272a('0x3'),_0x272a('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0x272a('0x5'),'answered',_0x272a('0x6'),'loggedIn','loggedInDb','originated',_0x272a('0x7'),_0x272a('0x8'),_0x272a('0x9'),_0x272a('0xa'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x272a('0xb'),'outboundReCallsDay',_0x272a('0xc'),'outboundUnknownCallsDay',_0x272a('0x2'),_0x272a('0xd'),_0x272a('0x4'),_0x272a('0xe'),'sumDuration','total',_0x272a('0xf')];function VoiceQueueSummary(_0x145320){this['id']=_0x145320['id'];this['name']=_0x145320[_0x272a('0x10')];this[_0x272a('0x11')]=_0x145320[_0x272a('0x11')];this[_0x272a('0x12')]=_0x145320[_0x272a('0x12')]||0x0;this['answered']=_0x145320[_0x272a('0x13')]||0x0;this[_0x272a('0x5')]=_0x145320[_0x272a('0x5')]||0x0;this[_0x272a('0x14')]=_0x145320['busy']||0x0;this[_0x272a('0x6')]=_0x145320[_0x272a('0x6')]||0x0;this['invalid']=_0x145320['invalid']||0x0;this['loggedIn']=_0x145320['loggedIn']||0x0;this['loggedInDb']=_0x145320['loggedInDb']||0x0;this[_0x272a('0x15')]=_0x145320['onHold']||0x0;this[_0x272a('0x16')]=_0x145320[_0x272a('0x16')]||0x0;this[_0x272a('0x2')]=_0x145320[_0x272a('0x2')]||0x0;this['ringing']=_0x145320[_0x272a('0x3')]||0x0;this[_0x272a('0x17')]=_0x145320[_0x272a('0x17')];this[_0x272a('0xe')]=_0x145320[_0x272a('0xe')];this[_0x272a('0x18')]=_0x145320[_0x272a('0x18')];this['sumHoldTime']=_0x145320[_0x272a('0x19')]||0x0;this[_0x272a('0x4')]=_0x145320[_0x272a('0x4')]||0x0;this[_0x272a('0x1a')]=_0x145320[_0x272a('0x1a')]||0x0;this[_0x272a('0x1b')]=_0x145320['type'];this[_0x272a('0x1c')]=_0x145320['unavailable']||0x0;this[_0x272a('0x1d')]=_0x145320['unknown']||0x0;this[_0x272a('0x1e')]=_0x145320['unmanaged']||0x0;this[_0x272a('0xf')]=_0x145320[_0x272a('0xf')]||0x0;if(_0x145320[_0x272a('0x1b')]===_0x272a('0x1f')){this[_0x272a('0xd')]=_0x145320[_0x272a('0xd')]||0x0;this[_0x272a('0x20')]=_0x145320[_0x272a('0x20')];this[_0x272a('0x21')]=_0x145320['dialMethod'];this[_0x272a('0x22')]=_0x145320[_0x272a('0x22')];this[_0x272a('0x23')]=_0x145320[_0x272a('0x23')];this[_0x272a('0x24')]=_0x145320['dialOriginateTimeout'];this['dialPrefix']=_0x145320[_0x272a('0x25')];this[_0x272a('0x26')]=_0x145320[_0x272a('0x26')];this[_0x272a('0x27')]=_0x145320[_0x272a('0x27')];this[_0x272a('0x8')]=_0x145320[_0x272a('0x8')];this[_0x272a('0x9')]=_0x145320[_0x272a('0x9')];this[_0x272a('0xa')]=_0x145320[_0x272a('0xa')];this['outboundCongestionCallsDay']=_0x145320['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x145320[_0x272a('0x28')];this['outboundDropCallsDayCallersExit']=_0x145320[_0x272a('0x29')];this[_0x272a('0x2a')]=_0x145320['outboundDropCallsDayTimeout'];this[_0x272a('0x2b')]=_0x145320[_0x272a('0x2b')];this[_0x272a('0xb')]=_0x145320[_0x272a('0xb')];this[_0x272a('0x2c')]=_0x145320[_0x272a('0x2c')];this[_0x272a('0x2d')]=_0x145320[_0x272a('0x2d')];this['outboundRejectCallsDay']=_0x145320[_0x272a('0xc')];this[_0x272a('0x2e')]=_0x145320[_0x272a('0x2e')];this['predictiveIntervalAnsweredCalls']=_0x145320[_0x272a('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x145320['predictiveIntervalAvgHoldtime'];this[_0x272a('0x30')]=_0x145320['predictiveIntervalAvgTalktime'];this[_0x272a('0x31')]=_0x145320[_0x272a('0x31')];this[_0x272a('0x32')]=_0x145320[_0x272a('0x32')];this[_0x272a('0x33')]=_0x145320[_0x272a('0x33')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x145320[_0x272a('0x34')];this[_0x272a('0x35')]=_0x145320[_0x272a('0x35')];this[_0x272a('0x36')]=_0x145320[_0x272a('0x36')];this[_0x272a('0x37')]=_0x145320[_0x272a('0x37')];this['predictiveIntervalAvailable']=_0x145320[_0x272a('0x38')];this[_0x272a('0x39')]=_0x145320[_0x272a('0x39')];this[_0x272a('0x3a')]=_0x145320[_0x272a('0x3a')];this[_0x272a('0x3b')]=_0x145320['erlangCalls'];this['erlangCallToSecond']=_0x145320[_0x272a('0x3c')];this[_0x272a('0x3d')]=_0x145320[_0x272a('0x3d')];this[_0x272a('0x3e')]=_0x145320[_0x272a('0x3e')];this[_0x272a('0x3f')]=_0x145320[_0x272a('0x3f')];this[_0x272a('0x40')]=_0x145320[_0x272a('0x40')];this[_0x272a('0x41')]=_0x145320[_0x272a('0x41')];this[_0x272a('0x42')]=_0x145320[_0x272a('0x42')];}if(_0x145320[_0x272a('0x43')]){this[_0x272a('0x43')]={'id':_0x145320['Trunk']['id'],'name':_0x145320[_0x272a('0x43')][_0x272a('0x10')],'active':_0x145320['Trunk'][_0x272a('0x44')],'callerid':_0x145320[_0x272a('0x43')][_0x272a('0x45')]};}}VoiceQueueSummary[_0x272a('0x46')][_0x272a('0x47')]=function(_0x357712,_0x336f37,_0x52e45e,_0x24ad25){this[_0x272a('0x1')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0x272a('0x1d')]=0x0;this['notInUse']=0x0;this[_0x272a('0x6')]=0x0;this[_0x272a('0x14')]=0x0;this[_0x272a('0x48')]=0x0;this[_0x272a('0x1c')]=0x0;this[_0x272a('0x3')]=0x0;this[_0x272a('0x17')]=0x0;this['onHold']=0x0;if(_0x52e45e){if(_0x52e45e[_0x272a('0x5')]){this[_0x272a('0x5')]=Number(_0x52e45e['available']);}if(_0x52e45e[_0x272a('0x49')]){this[_0x272a('0x0')]=Number(_0x52e45e['loggedin']);}if(_0x52e45e[_0x272a('0x4a')]){this[_0x272a('0xf')]=Number(_0x52e45e[_0x272a('0x4a')]);}}for(var _0x1ccd57=0x0;_0x1ccd57<_0x357712[_0x272a('0x4b')];_0x1ccd57++){var _0x1287ff=_0x336f37['SIP/'+_0x357712[_0x1ccd57][_0x272a('0x10')]];if(_0x1287ff&&_0x1287ff[_0x272a('0x4c')]){this[_0x272a('0x1')]+=0x1;}if(_0x357712[_0x1ccd57]['incall']==='1'){this[_0x272a('0x4')]+=0x1;}if(_0x357712[_0x1ccd57][_0x272a('0x2')]==='1'&&!['2','7','8']['includes'](_0x357712[_0x1ccd57][_0x272a('0x4d')])){this[_0x272a('0x2')]+=0x1;}switch(_0x357712[_0x1ccd57][_0x272a('0x4d')]){case'0':this[_0x272a('0x1d')]+=0x1;break;case'1':this[_0x272a('0x16')]+=0x1;break;case'2':this[_0x272a('0x6')]+=0x1;break;case'3':this[_0x272a('0x14')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x272a('0x15')]+=0x1;break;}}if(this[_0x272a('0x21')]===_0x272a('0x4e')){var _0x6704b0=Object['keys'](_0x24ad25);for(var _0x96d803=0x0;_0x96d803<_0x6704b0[_0x272a('0x4b')];_0x96d803++){var _0x55fab9=_0x6704b0[_0x96d803];var _0x8eb385=_0x24ad25[_0x55fab9];if(_0x8eb385[_0x272a('0x4f')]===this[_0x272a('0x10')]&&_0x8eb385[_0x272a('0x1b')]===_0x272a('0x50')&&_0x8eb385[_0x272a('0x51')]===_0x272a('0x52')){this[_0x272a('0x4')]+=0x1;}}if(this[_0x272a('0x4')]>this[_0x272a('0x6')]){this[_0x272a('0x4')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x272a('0x46')]['compareToInboundQueue']=function(_0x230100){var _0x3e183a=![];if(_0x230100){_0x3e183a=INBOUND_COUNTERS[_0x272a('0x53')](function(_0xc9e362){return this[_0xc9e362]!==_0x230100[_0xc9e362];},this);}return _0x3e183a;};VoiceQueueSummary[_0x272a('0x46')]['compareToOutboundQueue']=function(_0x490427){var _0x429a5a=![];var _0x5822cb=![];var _0x36e154=![];if(_0x490427){_0x429a5a=this[_0x272a('0x21')]!==_0x490427[_0x272a('0x21')]||this[_0x272a('0x20')]!==_0x490427[_0x272a('0x20')]||this[_0x272a('0x41')]!==_0x490427['message']||this[_0x272a('0x42')]!==_0x490427['statusMessage'];_0x5822cb=OUTBOUND_COUNTERS['some'](function(_0x2177fe){return this[_0x2177fe]!==_0x490427[_0x2177fe];},this);if(this['Trunk']&&_0x490427['Trunk']){_0x36e154=this[_0x272a('0x43')][_0x272a('0x10')]!==_0x490427[_0x272a('0x43')]['name']||this[_0x272a('0x43')][_0x272a('0x44')]!==_0x490427[_0x272a('0x43')]['active'];}}return _0x429a5a||_0x5822cb||_0x36e154;};VoiceQueueSummary[_0x272a('0x46')][_0x272a('0x54')]=function(_0x1d41af){this[_0x272a('0x13')]=_0x1d41af['answered'];this[_0x272a('0x41')]=_0x1d41af[_0x272a('0x41')];this[_0x272a('0x42')]=_0x1d41af[_0x272a('0x42')];this['originated']=_0x1d41af[_0x272a('0x3a')];this[_0x272a('0x7')]=_0x1d41af[_0x272a('0x7')];this[_0x272a('0x8')]=_0x1d41af[_0x272a('0x8')];this[_0x272a('0x9')]=_0x1d41af[_0x272a('0x9')];this[_0x272a('0xa')]=_0x1d41af[_0x272a('0xa')];this[_0x272a('0x55')]=_0x1d41af[_0x272a('0x55')];this['outboundNoAnswerCallsDay']=_0x1d41af[_0x272a('0x2b')];this[_0x272a('0xb')]=_0x1d41af[_0x272a('0xb')];this[_0x272a('0x2d')]=_0x1d41af[_0x272a('0x2d')];this['outboundRejectCallsDay']=_0x1d41af[_0x272a('0xc')];this[_0x272a('0x2e')]=_0x1d41af[_0x272a('0x2e')];this[_0x272a('0xe')]=_0x1d41af[_0x272a('0xe')];this[_0x272a('0x18')]=_0x1d41af[_0x272a('0x18')];this[_0x272a('0x1a')]=_0x1d41af[_0x272a('0x1a')];if(this[_0x272a('0x21')]===_0x272a('0x56')){this['pTalking']=_0x1d41af['pTalking'];}};module[_0x272a('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0xaeab=['type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','ringInUse','loggedin','callers','length','includes','status','booked','queue','dialer','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','preview','exports','available','loggedInDb','ringing','talking','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','paused','sumHoldTime'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaeab,0x91));var _0xbaea=function(_0x230a2e,_0x3e73d9){_0x230a2e=_0x230a2e-0x0;var _0x1cf302=_0xaeab[_0x230a2e];return _0x1cf302;};'use strict';var INBOUND_COUNTERS=[_0xbaea('0x0'),'loggedIn',_0xbaea('0x1'),'paused',_0xbaea('0x2'),_0xbaea('0x3'),_0xbaea('0x4')];var OUTBOUND_COUNTERS=[_0xbaea('0x0'),_0xbaea('0x5'),_0xbaea('0x6'),_0xbaea('0x7'),_0xbaea('0x1'),_0xbaea('0x8'),_0xbaea('0x9'),'outboundAnswerCallsDay',_0xbaea('0xa'),_0xbaea('0xb'),_0xbaea('0xc'),_0xbaea('0xd'),_0xbaea('0xe'),_0xbaea('0xf'),_0xbaea('0x10'),_0xbaea('0x11'),'paused',_0xbaea('0x12'),_0xbaea('0x3'),_0xbaea('0x13'),_0xbaea('0x14'),_0xbaea('0x15'),'waiting'];function VoiceQueueSummary(_0x75a1e5){this['id']=_0x75a1e5['id'];this[_0xbaea('0x16')]=_0x75a1e5['name'];this[_0xbaea('0x17')]=_0x75a1e5[_0xbaea('0x17')];this[_0xbaea('0x18')]=_0x75a1e5[_0xbaea('0x18')]||0x0;this[_0xbaea('0x5')]=_0x75a1e5[_0xbaea('0x5')]||0x0;this['available']=_0x75a1e5['available']||0x0;this[_0xbaea('0x19')]=_0x75a1e5[_0xbaea('0x19')]||0x0;this[_0xbaea('0x6')]=_0x75a1e5[_0xbaea('0x6')]||0x0;this[_0xbaea('0x1a')]=_0x75a1e5['invalid']||0x0;this['loggedIn']=_0x75a1e5[_0xbaea('0x7')]||0x0;this[_0xbaea('0x1')]=_0x75a1e5['loggedInDb']||0x0;this[_0xbaea('0x1b')]=_0x75a1e5[_0xbaea('0x1b')]||0x0;this[_0xbaea('0x1c')]=_0x75a1e5[_0xbaea('0x1c')]||0x0;this[_0xbaea('0x1d')]=_0x75a1e5[_0xbaea('0x1d')]||0x0;this['ringing']=_0x75a1e5['ringing']||0x0;this['ringInUse']=_0x75a1e5['ringInUse'];this[_0xbaea('0x13')]=_0x75a1e5[_0xbaea('0x13')];this[_0xbaea('0x14')]=_0x75a1e5[_0xbaea('0x14')];this[_0xbaea('0x1e')]=_0x75a1e5['sumHoldTime']||0x0;this[_0xbaea('0x3')]=_0x75a1e5[_0xbaea('0x3')]||0x0;this[_0xbaea('0x15')]=_0x75a1e5[_0xbaea('0x15')]||0x0;this[_0xbaea('0x1f')]=_0x75a1e5[_0xbaea('0x1f')];this[_0xbaea('0x20')]=_0x75a1e5[_0xbaea('0x20')]||0x0;this['unknown']=_0x75a1e5[_0xbaea('0x21')]||0x0;this['unmanaged']=_0x75a1e5[_0xbaea('0x22')]||0x0;this[_0xbaea('0x4')]=_0x75a1e5['waiting']||0x0;if(_0x75a1e5['type']==='outbound'){this[_0xbaea('0x12')]=_0x75a1e5[_0xbaea('0x12')]||0x0;this[_0xbaea('0x23')]=_0x75a1e5[_0xbaea('0x23')];this[_0xbaea('0x24')]=_0x75a1e5[_0xbaea('0x24')];this['dialOriginateCallerIdName']=_0x75a1e5[_0xbaea('0x25')];this[_0xbaea('0x26')]=_0x75a1e5['dialOriginateCallerIdNumber'];this[_0xbaea('0x27')]=_0x75a1e5[_0xbaea('0x27')];this[_0xbaea('0x28')]=_0x75a1e5[_0xbaea('0x28')];this[_0xbaea('0x29')]=_0x75a1e5[_0xbaea('0x29')];this[_0xbaea('0x2a')]=_0x75a1e5[_0xbaea('0x2a')];this[_0xbaea('0x2b')]=_0x75a1e5[_0xbaea('0x2b')];this[_0xbaea('0xa')]=_0x75a1e5[_0xbaea('0xa')];this['outboundBusyCallsDay']=_0x75a1e5[_0xbaea('0xb')];this[_0xbaea('0xc')]=_0x75a1e5[_0xbaea('0xc')];this[_0xbaea('0x2c')]=_0x75a1e5[_0xbaea('0x2c')];this[_0xbaea('0x2d')]=_0x75a1e5['outboundDropCallsDayCallersExit'];this[_0xbaea('0x2e')]=_0x75a1e5['outboundDropCallsDayTimeout'];this[_0xbaea('0xd')]=_0x75a1e5[_0xbaea('0xd')];this[_0xbaea('0xe')]=_0x75a1e5[_0xbaea('0xe')];this[_0xbaea('0x2f')]=_0x75a1e5[_0xbaea('0x2f')];this[_0xbaea('0xf')]=_0x75a1e5[_0xbaea('0xf')];this[_0xbaea('0x10')]=_0x75a1e5[_0xbaea('0x10')];this[_0xbaea('0x11')]=_0x75a1e5[_0xbaea('0x11')];this[_0xbaea('0x30')]=_0x75a1e5['predictiveIntervalAnsweredCalls'];this[_0xbaea('0x31')]=_0x75a1e5['predictiveIntervalAvgHoldtime'];this[_0xbaea('0x32')]=_0x75a1e5[_0xbaea('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x75a1e5[_0xbaea('0x33')];this[_0xbaea('0x34')]=_0x75a1e5['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x75a1e5[_0xbaea('0x35')];this[_0xbaea('0x36')]=_0x75a1e5[_0xbaea('0x36')];this[_0xbaea('0x37')]=_0x75a1e5[_0xbaea('0x37')];this[_0xbaea('0x38')]=_0x75a1e5['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x75a1e5[_0xbaea('0x39')];this[_0xbaea('0x3a')]=_0x75a1e5[_0xbaea('0x3a')];this[_0xbaea('0x3b')]=_0x75a1e5[_0xbaea('0x3b')];this['originated']=_0x75a1e5[_0xbaea('0x8')];this[_0xbaea('0x3c')]=_0x75a1e5[_0xbaea('0x3c')];this['erlangCallToSecond']=_0x75a1e5[_0xbaea('0x3d')];this[_0xbaea('0x3e')]=_0x75a1e5[_0xbaea('0x3e')];this[_0xbaea('0x3f')]=_0x75a1e5['erlangBusyFactor'];this[_0xbaea('0x40')]=_0x75a1e5[_0xbaea('0x40')];this[_0xbaea('0x41')]=_0x75a1e5[_0xbaea('0x41')];this['message']=_0x75a1e5[_0xbaea('0x42')];this[_0xbaea('0x43')]=_0x75a1e5[_0xbaea('0x43')];}if(_0x75a1e5['Trunk']){this[_0xbaea('0x44')]={'id':_0x75a1e5[_0xbaea('0x44')]['id'],'name':_0x75a1e5[_0xbaea('0x44')][_0xbaea('0x16')],'active':_0x75a1e5[_0xbaea('0x44')][_0xbaea('0x45')],'callerid':_0x75a1e5['Trunk'][_0xbaea('0x46')]};}}VoiceQueueSummary['prototype'][_0xbaea('0x47')]=function(_0x1c513e,_0x4222a1,_0x3a60de,_0x126e4f){this[_0xbaea('0x1')]=0x0;this[_0xbaea('0x3')]=0x0;this['paused']=0x0;this[_0xbaea('0x21')]=0x0;this[_0xbaea('0x1c')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xbaea('0x1a')]=0x0;this[_0xbaea('0x20')]=0x0;this[_0xbaea('0x2')]=0x0;this[_0xbaea('0x48')]=0x0;this[_0xbaea('0x1b')]=0x0;if(_0x3a60de){if(_0x3a60de[_0xbaea('0x0')]){this[_0xbaea('0x0')]=Number(_0x3a60de[_0xbaea('0x0')]);}if(_0x3a60de[_0xbaea('0x49')]){this[_0xbaea('0x7')]=Number(_0x3a60de[_0xbaea('0x49')]);}if(_0x3a60de[_0xbaea('0x4a')]){this[_0xbaea('0x4')]=Number(_0x3a60de[_0xbaea('0x4a')]);}}for(var _0x5af059=0x0;_0x5af059<_0x1c513e[_0xbaea('0x4b')];_0x5af059++){var _0x53cacf=_0x4222a1['SIP/'+_0x1c513e[_0x5af059][_0xbaea('0x16')]];if(_0x53cacf&&_0x53cacf['online']){this['loggedInDb']+=0x1;}if(_0x1c513e[_0x5af059]['incall']==='1'){this[_0xbaea('0x3')]+=0x1;}if(_0x1c513e[_0x5af059][_0xbaea('0x1d')]==='1'&&!['2','7','8'][_0xbaea('0x4c')](_0x1c513e[_0x5af059][_0xbaea('0x4d')])){this[_0xbaea('0x1d')]+=0x1;}switch(_0x1c513e[_0x5af059][_0xbaea('0x4d')]){case'0':this[_0xbaea('0x21')]+=0x1;break;case'1':this[_0xbaea('0x1c')]+=0x1;break;case'2':this[_0xbaea('0x6')]+=0x1;break;case'3':this[_0xbaea('0x19')]+=0x1;break;case'4':this[_0xbaea('0x1a')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xbaea('0x2')]+=0x1;break;case'7':this[_0xbaea('0x48')]+=0x1;break;case'8':this[_0xbaea('0x1b')]+=0x1;break;}}if(this[_0xbaea('0x24')]===_0xbaea('0x4e')){var _0x16382a=Object['keys'](_0x126e4f);for(var _0x5f2e8d=0x0;_0x5f2e8d<_0x16382a[_0xbaea('0x4b')];_0x5f2e8d++){var _0x452a09=_0x16382a[_0x5f2e8d];var _0x41df26=_0x126e4f[_0x452a09];if(_0x41df26[_0xbaea('0x4f')]===this[_0xbaea('0x16')]&&_0x41df26[_0xbaea('0x1f')]===_0xbaea('0x50')&&_0x41df26[_0xbaea('0x51')]==='xcally-motion-preview'){this[_0xbaea('0x3')]+=0x1;}}if(this[_0xbaea('0x3')]>this[_0xbaea('0x6')]){this['talking']=this[_0xbaea('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xbaea('0x52')][_0xbaea('0x53')]=function(_0x3d9a0b){var _0xf06aa=![];if(_0x3d9a0b){_0xf06aa=INBOUND_COUNTERS[_0xbaea('0x54')](function(_0x5c6377){return this[_0x5c6377]!==_0x3d9a0b[_0x5c6377];},this);}return _0xf06aa;};VoiceQueueSummary[_0xbaea('0x52')][_0xbaea('0x55')]=function(_0x477177){var _0x4a1bf6=![];var _0x22d609=![];var _0x2e89b4=![];if(_0x477177){_0x4a1bf6=this['dialMethod']!==_0x477177['dialMethod']||this[_0xbaea('0x23')]!==_0x477177[_0xbaea('0x23')]||this[_0xbaea('0x42')]!==_0x477177[_0xbaea('0x42')]||this[_0xbaea('0x43')]!==_0x477177[_0xbaea('0x43')];_0x22d609=OUTBOUND_COUNTERS['some'](function(_0x1db552){return this[_0x1db552]!==_0x477177[_0x1db552];},this);if(this[_0xbaea('0x44')]&&_0x477177[_0xbaea('0x44')]){_0x2e89b4=this[_0xbaea('0x44')][_0xbaea('0x16')]!==_0x477177[_0xbaea('0x44')]['name']||this[_0xbaea('0x44')][_0xbaea('0x45')]!==_0x477177[_0xbaea('0x44')][_0xbaea('0x45')];}}return _0x4a1bf6||_0x22d609||_0x2e89b4;};VoiceQueueSummary[_0xbaea('0x52')]['updateReportFromOutboundQueue']=function(_0x29dc2a){this[_0xbaea('0x5')]=_0x29dc2a['answered'];this[_0xbaea('0x42')]=_0x29dc2a[_0xbaea('0x42')];this['statusMessage']=_0x29dc2a[_0xbaea('0x43')];this[_0xbaea('0x8')]=_0x29dc2a[_0xbaea('0x8')];this[_0xbaea('0x9')]=_0x29dc2a['outboundAbandonedCallsDay'];this[_0xbaea('0x2b')]=_0x29dc2a[_0xbaea('0x2b')];this[_0xbaea('0xa')]=_0x29dc2a[_0xbaea('0xa')];this[_0xbaea('0xb')]=_0x29dc2a['outboundBusyCallsDay'];this[_0xbaea('0xc')]=_0x29dc2a[_0xbaea('0xc')];this[_0xbaea('0xd')]=_0x29dc2a[_0xbaea('0xd')];this[_0xbaea('0xe')]=_0x29dc2a[_0xbaea('0xe')];this[_0xbaea('0xf')]=_0x29dc2a[_0xbaea('0xf')];this[_0xbaea('0x10')]=_0x29dc2a['outboundRejectCallsDay'];this[_0xbaea('0x11')]=_0x29dc2a[_0xbaea('0x11')];this['sumBillable']=_0x29dc2a['sumBillable'];this[_0xbaea('0x14')]=_0x29dc2a[_0xbaea('0x14')];this['total']=_0x29dc2a[_0xbaea('0x15')];if(this[_0xbaea('0x24')]===_0xbaea('0x56')){this['pTalking']=_0x29dc2a[_0xbaea('0x12')];}};module[_0xbaea('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 35ce134..96f2c7c 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 _0x18ee=['accessKey','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x24b00f,_0x5cb40c){var _0x2d816d=function(_0x59f49c){while(--_0x59f49c){_0x24b00f['push'](_0x24b00f['shift']());}};_0x2d816d(++_0x5cb40c);}(_0x18ee,0xa1));var _0xe18e=function(_0x3135b2,_0x57f4c3){_0x3135b2=_0x3135b2-0x0;var _0xe7e77c=_0x18ee[_0x3135b2];return _0xe7e77c;};'use strict';function VtigerAccount(_0x340258){this['id']=_0x340258['id']||0x0;this['name']=_0x340258['name']||'';this[_0xe18e('0x0')]=_0x340258[_0xe18e('0x0')]||'';this[_0xe18e('0x1')]=_0x340258[_0xe18e('0x1')]||'';this[_0xe18e('0x2')]=_0x340258[_0xe18e('0x2')]||'';this[_0xe18e('0x3')]=_0x340258[_0xe18e('0x3')]||'';this[_0xe18e('0x4')]=_0x340258['Configurations']||{};}module[_0xe18e('0x5')]=VtigerAccount; \ No newline at end of file +var _0x10ea=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x10ea,0xb0));var _0xa10e=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x10ea[_0x50e593];return _0x3821d0;};'use strict';function VtigerAccount(_0x5d47a8){this['id']=_0x5d47a8['id']||0x0;this[_0xa10e('0x0')]=_0x5d47a8[_0xa10e('0x0')]||'';this[_0xa10e('0x1')]=_0x5d47a8[_0xa10e('0x1')]||'';this[_0xa10e('0x2')]=_0x5d47a8[_0xa10e('0x2')]||'';this['remoteUri']=_0x5d47a8[_0xa10e('0x3')]||'';this[_0xa10e('0x4')]=_0x5d47a8[_0xa10e('0x4')]||'';this[_0xa10e('0x5')]=_0x5d47a8[_0xa10e('0x5')]||{};}module[_0xa10e('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index bcc88e5..6ff42ec 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 _0x4416=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4416,0x1b9));var _0x6441=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4416[_0x32f7d7];return _0x133d09;};'use strict';function ZendeskAccount(_0x2091aa){this['id']=_0x2091aa['id']||0x0;this[_0x6441('0x0')]=_0x2091aa[_0x6441('0x0')]||'';this[_0x6441('0x1')]=_0x2091aa[_0x6441('0x1')]||'';this['password']=_0x2091aa[_0x6441('0x2')]||'';this[_0x6441('0x3')]=_0x2091aa[_0x6441('0x3')]||'';this[_0x6441('0x4')]=_0x2091aa[_0x6441('0x4')]||'';this['authType']=_0x2091aa[_0x6441('0x5')]||'';this[_0x6441('0x6')]=_0x2091aa[_0x6441('0x6')]||_0x6441('0x7');this[_0x6441('0x8')]=_0x2091aa[_0x6441('0x8')]||'';this[_0x6441('0x9')]=_0x2091aa[_0x6441('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x7720=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x47e831,_0x24d471){var _0x2bee30=function(_0x82f750){while(--_0x82f750){_0x47e831['push'](_0x47e831['shift']());}};_0x2bee30(++_0x24d471);}(_0x7720,0x145));var _0x0772=function(_0x476a3e,_0x2fb3d4){_0x476a3e=_0x476a3e-0x0;var _0x1b3bca=_0x7720[_0x476a3e];return _0x1b3bca;};'use strict';function ZendeskAccount(_0xea1b22){this['id']=_0xea1b22['id']||0x0;this[_0x0772('0x0')]=_0xea1b22[_0x0772('0x0')]||'';this[_0x0772('0x1')]=_0xea1b22[_0x0772('0x1')]||'';this[_0x0772('0x2')]=_0xea1b22['password']||'';this[_0x0772('0x3')]=_0xea1b22[_0x0772('0x3')]||'';this['remoteUri']=_0xea1b22[_0x0772('0x4')]||'';this[_0x0772('0x5')]=_0xea1b22[_0x0772('0x5')]||'';this[_0x0772('0x6')]=_0xea1b22['type']||_0x0772('0x7');this[_0x0772('0x8')]=_0xea1b22[_0x0772('0x8')]||'';this[_0x0772('0x9')]=_0xea1b22[_0x0772('0x9')]||{};}module[_0x0772('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 74ab333..6b19432 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 _0x6e43=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6e43,0xe2));var _0x36e4=function(_0x25d5e5,_0x19352e){_0x25d5e5=_0x25d5e5-0x0;var _0xc10280=_0x6e43[_0x25d5e5];return _0xc10280;};'use strict';function ZohoAccount(_0x504634){this['id']=_0x504634['id']||0x0;this[_0x36e4('0x0')]=_0x504634['name']||'';this[_0x36e4('0x1')]=_0x504634[_0x36e4('0x1')]||'';this[_0x36e4('0x2')]=_0x504634['host']||'';this[_0x36e4('0x3')]=_0x504634[_0x36e4('0x3')]||'';this['clientId']=_0x504634['clientId']||'';this[_0x36e4('0x4')]=_0x504634[_0x36e4('0x4')]||'';this[_0x36e4('0x5')]=_0x504634[_0x36e4('0x5')]||'';this[_0x36e4('0x6')]=_0x504634[_0x36e4('0x6')]||'';this[_0x36e4('0x7')]=_0x504634[_0x36e4('0x7')]||'';this[_0x36e4('0x8')]=_0x504634['Configurations']||{};}module[_0x36e4('0x9')]=ZohoAccount; \ No newline at end of file +var _0xcf3a=['exports','name','host','zone','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xcf3a,0xd0));var _0xacf3=function(_0x4d7873,_0x940a41){_0x4d7873=_0x4d7873-0x0;var _0x422c96=_0xcf3a[_0x4d7873];return _0x422c96;};'use strict';function ZohoAccount(_0x577b29){this['id']=_0x577b29['id']||0x0;this[_0xacf3('0x0')]=_0x577b29[_0xacf3('0x0')]||'';this['description']=_0x577b29['description']||'';this[_0xacf3('0x1')]=_0x577b29[_0xacf3('0x1')]||'';this[_0xacf3('0x2')]=_0x577b29[_0xacf3('0x2')]||'';this['clientId']=_0x577b29['clientId']||'';this[_0xacf3('0x3')]=_0x577b29[_0xacf3('0x3')]||'';this[_0xacf3('0x4')]=_0x577b29['serverUrl']||'';this[_0xacf3('0x5')]=_0x577b29[_0xacf3('0x5')]||'';this[_0xacf3('0x6')]=_0x577b29[_0xacf3('0x6')]||'';this[_0xacf3('0x7')]=_0x577b29[_0xacf3('0x7')]||{};}module[_0xacf3('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 09616cf..7224171 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 _0x5430=['ContactId','ListId','UserId','isNil','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','callback','callbackuniqueid','recallme'];(function(_0x15a5c1,_0x177ad3){var _0x19cb2e=function(_0xacdb01){while(--_0xacdb01){_0x15a5c1['push'](_0x15a5c1['shift']());}};_0x19cb2e(++_0x177ad3);}(_0x5430,0x10c));var _0x0543=function(_0x4971ae,_0x38df33){_0x4971ae=_0x4971ae-0x0;var _0x4683dc=_0x5430[_0x4971ae];return _0x4683dc;};'use strict';var util=require(_0x0543('0x0'));var _=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));function checkNameSurname(_0x4078bf,_0x114bf2,_0x3b93d7){var _0x5518f8='';if(!_['isNil'](_0x114bf2)&&_0x0543('0x3')===typeof _0x114bf2){_0x5518f8+=_0x114bf2;}if(!_['isNil'](_0x3b93d7)&&'string'===typeof _0x3b93d7){_0x5518f8+='\x20'+_0x3b93d7;}if(_0x5518f8!==''){return _0x5518f8;}return _0x4078bf;}function Action(_0xce0b65,_0x45b909,_0x9754ba,_0x319568,_0x46bca7){this['uniqueid']=_0x9754ba||undefined;this[_0x0543('0x4')]=_0xce0b65['id'];this[_0x0543('0x5')]=_0x45b909[_0x0543('0x6')];this[_0x0543('0x7')]=_0x45b909[_0x0543('0x7')];this[_0x0543('0x8')]='queue';this[_0x0543('0x9')]=![];this[_0x0543('0xa')]=_['isNil'](_0xce0b65[_0x0543('0xb')])?undefined:_0xce0b65[_0x0543('0xb')][_0x0543('0x6')];this[_0x0543('0xc')]=this[_0x0543('0xa')]?util[_0x0543('0xd')](_0x0543('0xe'),this[_0x0543('0xa')]):_0x319568||undefined;this[_0x0543('0xf')]=checkNameSurname(_0xce0b65[_0x0543('0x10')][_0x0543('0x11')],_0xce0b65[_0x0543('0x10')]['firstName'],_0xce0b65[_0x0543('0x10')][_0x0543('0x12')]);this['active']=_0xce0b65['active']||![];this[_0x0543('0x13')]=_0xce0b65[_0x0543('0x11')];this[_0x0543('0x14')]=_0xce0b65[_0x0543('0x14')];this[_0x0543('0x15')]=_0xce0b65['countbusyretry']||0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this[_0x0543('0x17')]=_0xce0b65[_0x0543('0x17')]||0x0;this[_0x0543('0x18')]=(_0xce0b65[_0x0543('0x15')]||0x0)+(_0xce0b65[_0x0543('0x16')]||0x0)+(_0xce0b65['countnoanswerretry']||0x0)+(_0xce0b65[_0x0543('0x19')]||0x0)+(_0xce0b65['countdropretry']||0x0)+(_0xce0b65['countabandonedretry']||0x0)+(_0xce0b65[_0x0543('0x1a')]||0x0)+(_0xce0b65[_0x0543('0x1b')]||0x0);this[_0x0543('0x19')]=_0xce0b65['countnosuchnumberretry']||0x0;this[_0x0543('0x1c')]=_0xce0b65['countdropretry']||0x0;this[_0x0543('0x1d')]=_0xce0b65[_0x0543('0x1d')]||0x0;this['countmachineretry']=_0xce0b65[_0x0543('0x1a')]||0x0;this[_0x0543('0x1b')]=_0xce0b65[_0x0543('0x1b')]||0x0;this[_0x0543('0x1e')]=_0xce0b65[_0x0543('0x1e')];this[_0x0543('0x1f')]=_0xce0b65['callbackuniqueid'];this['callbackat']=_0xce0b65['callbackat'];this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')];this[_0x0543('0x21')]=_0xce0b65[_0x0543('0x21')];this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')];this[_0x0543('0x23')]=_[_0x0543('0x24')](_0xce0b65[_0x0543('0xb')])?_0xce0b65[_0x0543('0x23')]:_0xce0b65[_0x0543('0xb')]['id'];this[_0x0543('0x25')]=_0xce0b65['VoiceQueueId'];this[_0x0543('0x26')]='';this[_0x0543('0x27')]='';}Action[_0x0543('0x28')]['getCaller']=function(){return util[_0x0543('0xd')](_0x0543('0x29'),this[_0x0543('0xf')],this[_0x0543('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x0120=['countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','firstName','lastName','active','calleridnum','phone','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x0120,0x6f));var _0x0012=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0120[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0012('0x0'));var _=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));function checkNameSurname(_0xb8d57c,_0x46fb2b,_0x23b9ae){var _0x214372='';if(!_[_0x0012('0x3')](_0x46fb2b)&&_0x0012('0x4')===typeof _0x46fb2b){_0x214372+=_0x46fb2b;}if(!_[_0x0012('0x3')](_0x23b9ae)&&_0x0012('0x4')===typeof _0x23b9ae){_0x214372+='\x20'+_0x23b9ae;}if(_0x214372!==''){return _0x214372;}return _0xb8d57c;}function Action(_0x3fcfbc,_0x4eaa5b,_0x4b396c,_0x59980a,_0x95d441){this[_0x0012('0x5')]=_0x4b396c||undefined;this[_0x0012('0x6')]=_0x3fcfbc['id'];this[_0x0012('0x7')]=_0x4eaa5b[_0x0012('0x8')];this['type']=_0x4eaa5b[_0x0012('0x9')];this[_0x0012('0xa')]=_0x0012('0x7');this[_0x0012('0xb')]=![];this['membername']=_[_0x0012('0x3')](_0x3fcfbc['Agent'])?undefined:_0x3fcfbc[_0x0012('0xc')][_0x0012('0x8')];this[_0x0012('0xd')]=this[_0x0012('0xe')]?util[_0x0012('0xf')]('SIP/%s',this[_0x0012('0xe')]):_0x59980a||undefined;this['calleridname']=checkNameSurname(_0x3fcfbc['Contact']['phone'],_0x3fcfbc['Contact'][_0x0012('0x10')],_0x3fcfbc['Contact'][_0x0012('0x11')]);this[_0x0012('0x12')]=_0x3fcfbc['active']||![];this[_0x0012('0x13')]=_0x3fcfbc[_0x0012('0x14')];this[_0x0012('0x15')]=_0x3fcfbc[_0x0012('0x15')];this['countbusyretry']=_0x3fcfbc['countbusyretry']||0x0;this[_0x0012('0x16')]=_0x3fcfbc[_0x0012('0x16')]||0x0;this[_0x0012('0x17')]=_0x3fcfbc[_0x0012('0x17')]||0x0;this[_0x0012('0x18')]=(_0x3fcfbc[_0x0012('0x19')]||0x0)+(_0x3fcfbc[_0x0012('0x16')]||0x0)+(_0x3fcfbc[_0x0012('0x17')]||0x0)+(_0x3fcfbc['countnosuchnumberretry']||0x0)+(_0x3fcfbc[_0x0012('0x1a')]||0x0)+(_0x3fcfbc[_0x0012('0x1b')]||0x0)+(_0x3fcfbc['countmachineretry']||0x0)+(_0x3fcfbc[_0x0012('0x1c')]||0x0);this[_0x0012('0x1d')]=_0x3fcfbc[_0x0012('0x1d')]||0x0;this[_0x0012('0x1a')]=_0x3fcfbc['countdropretry']||0x0;this['countabandonedretry']=_0x3fcfbc[_0x0012('0x1b')]||0x0;this[_0x0012('0x1e')]=_0x3fcfbc[_0x0012('0x1e')]||0x0;this[_0x0012('0x1c')]=_0x3fcfbc[_0x0012('0x1c')]||0x0;this[_0x0012('0x1f')]=_0x3fcfbc[_0x0012('0x1f')];this[_0x0012('0x20')]=_0x3fcfbc['callbackuniqueid'];this[_0x0012('0x21')]=_0x3fcfbc[_0x0012('0x21')];this['recallme']=_0x3fcfbc[_0x0012('0x22')];this[_0x0012('0x23')]=_0x3fcfbc[_0x0012('0x23')];this[_0x0012('0x24')]=_0x3fcfbc[_0x0012('0x24')];this['UserId']=_[_0x0012('0x3')](_0x3fcfbc[_0x0012('0xc')])?_0x3fcfbc[_0x0012('0x25')]:_0x3fcfbc[_0x0012('0xc')]['id'];this[_0x0012('0x26')]=_0x3fcfbc[_0x0012('0x26')];this[_0x0012('0x27')]='';this[_0x0012('0x28')]='';}Action[_0x0012('0x29')][_0x0012('0x2a')]=function(){return util[_0x0012('0xf')](_0x0012('0x2b'),this[_0x0012('0x2c')],this[_0x0012('0x2d')]);};module[_0x0012('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5bac344..41d21d1 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 _0x07e5=['localhost','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','newexten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','available','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','logger','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','preview','type','clearZombieChannels','outbound','dialActive','setMessage','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','stringify','contactId','UserId','ListId','Action','status','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','catch','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','nosuchnumber','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','[16]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','cloneAction','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','activeContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','additional','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','pick','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','Trunk','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','logLookAgent','clone','isFailure','rejected','starttime','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis'];(function(_0x2330cf,_0x5add9f){var _0x5e230f=function(_0x1f44f7){while(--_0x1f44f7){_0x2330cf['push'](_0x2330cf['shift']());}};_0x5e230f(++_0x5add9f);}(_0x07e5,0x133));var _0x507e=function(_0x10a26a,_0xe95601){_0x10a26a=_0x10a26a-0x0;var _0x2308d9=_0x07e5[_0x10a26a];return _0x2308d9;};'use strict';var util=require(_0x507e('0x0'));var _=require(_0x507e('0x1'));var uuid=require(_0x507e('0x2'));var moment=require(_0x507e('0x3'));var Redis=require('ioredis');var config=require(_0x507e('0x4'));var logger=require(_0x507e('0x5'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x507e('0x6'));var rpcDb=require(_0x507e('0x7'));var cmHopperAdditionalPhone=require(_0x507e('0x8'));var Action=require(_0x507e('0x9'));var ut=require(_0x507e('0xa'));var utils=require(_0x507e('0xb'));config['redis']=_['defaults'](config[_0x507e('0xc')],{'host':_0x507e('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x507e('0xc')]));var Sequence=function(){};Sequence[_0x507e('0xe')][_0x507e('0xf')]=function(_0x4d2984){this[_0x507e('0x10')]=this['tail']?this[_0x507e('0x10')]['finally'](_0x4d2984):_0x4d2984();};function Preview(_0x5be672){this['sequence']=new Sequence();this[_0x507e('0x11')]=_0x5be672[_0x507e('0x12')];this[_0x507e('0x13')]=_0x5be672[_0x507e('0x13')];this[_0x507e('0x14')]={};this['agents']=_0x5be672[_0x507e('0x15')];this[_0x507e('0x16')]=0x0;ami['on'](_0x507e('0x17'),this[_0x507e('0x18')]['bind'](this));ami['on'](_0x507e('0x19'),this[_0x507e('0x1a')][_0x507e('0x1b')](this));ami['on']('hanguprequest',this[_0x507e('0x1c')][_0x507e('0x1b')](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on'](_0x507e('0x1d'),this['syncNewExten'][_0x507e('0x1b')](this));ami['on'](_0x507e('0x1e'),this[_0x507e('0x1f')][_0x507e('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x507e('0x20'),this[_0x507e('0x21')][_0x507e('0x1b')](this));this[_0x507e('0x22')](this[_0x507e('0x11')]);}function emit(_0x33cf28,_0x196c00,_0x49b257){io['to'](_0x33cf28)['emit'](_0x196c00,_0x49b257);}function emitVoiceQueueChannelRemove(_0x1cd7ee){logger[_0x507e('0x23')](_0x507e('0x24'),JSON['stringify'](_0x1cd7ee));emit(util[_0x507e('0x25')](_0x507e('0x26'),_0x1cd7ee[_0x507e('0x27')]),_0x507e('0x28'),_0x1cd7ee);io[_0x507e('0x29')](_0x507e('0x2a'),_0x1cd7ee);}function notSendMessagesQueue(_0x1c52d9){if(_0x1c52d9['sendMessageOneNotActive']){if(_0x1c52d9[_0x507e('0x2b')]===0x0&&_0x1c52d9[_0x507e('0x2c')]===0x0){_0x1c52d9[_0x507e('0x2d')]=![];_0x1c52d9[_0x507e('0x2e')]=0x0;_0x1c52d9[_0x507e('0x2f')]=0x0;_0x1c52d9[_0x507e('0x30')]=utils['CAMPAIGN_STATUS'][_0x507e('0x31')];ut['logger'](_0x507e('0x32'),_0x1c52d9[_0x507e('0x27')]+_0x507e('0x33'));}else{_0x1c52d9[_0x507e('0x30')]=utils[_0x507e('0x34')]['DEACTIVATED'];ut[_0x507e('0x35')](_0x507e('0x32'),_0x1c52d9['name']+_0x507e('0x36'));}}}Preview[_0x507e('0xe')][_0x507e('0x22')]=function(){var _0x4befde=this;setInterval(function(){_0x4befde[_0x507e('0x37')]();},0x7cf);};Preview['prototype'][_0x507e('0x37')]=function(){var _0x30f3e6=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0xd65ab1 in _0x30f3e6){if(_0x30f3e6[_0x507e('0x38')](_0xd65ab1)&&(_0x30f3e6[_0xd65ab1][_0x507e('0x39')]===_0x507e('0x3a')||_0x30f3e6[_0xd65ab1]['dialMethod']==='booked')&&_0x30f3e6[_0xd65ab1][_0x507e('0x3b')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x507e('0x16')]=0x0;this[_0x507e('0x3c')]();}}if(_0x30f3e6['hasOwnProperty'](_0xd65ab1)&&_0x30f3e6[_0xd65ab1][_0x507e('0x39')]===_0x507e('0x3a')&&_0x30f3e6[_0xd65ab1][_0x507e('0x3b')]===_0x507e('0x3d')){if(_0x30f3e6[_0xd65ab1][_0x507e('0x3e')]){this[_0x507e('0x3f')](_0x30f3e6[_0xd65ab1]);if(_0x30f3e6[_0xd65ab1]['dialPreviewAutoRecallMe'])this['recallMe'](_0x30f3e6[_0xd65ab1]);}else{notSendMessagesQueue(_0x30f3e6[_0xd65ab1]);}}}};Preview['prototype'][_0x507e('0x40')]=function(_0x3bcb08){var _0x1490e4=this;this[_0x507e('0x41')][_0x507e('0xf')](function(){if(!_[_0x507e('0x42')](_0x1490e4[_0x507e('0x14')][_0x3bcb08])){loggerAction['info']('[clearZombieChannels][talking]',_0x3bcb08,_0x507e('0x43'),_0x1490e4[_0x507e('0x14')][_0x3bcb08][_0x507e('0x44')],_0x507e('0x45'),JSON['stringify'](_0x1490e4[_0x507e('0x11')][_0x1490e4[_0x507e('0x14')][_0x3bcb08][_0x507e('0x44')]][_0x507e('0x2b')]),_0x507e('0x46'),JSON['stringify'](_0x1490e4['campaignsPreview'][_0x1490e4[_0x507e('0x14')][_0x3bcb08]['queue']]['pTalking']),JSON['stringify'](_0x1490e4['actions'][_0x3bcb08][_0x507e('0x47')]),JSON[_0x507e('0x48')](_['pick'](_0x1490e4[_0x507e('0x14')][_0x3bcb08],[_0x507e('0x49'),_0x507e('0x4a'),'VoiceQueueId',_0x507e('0x4b')])));return ami[_0x507e('0x4c')]({'action':_0x507e('0x4d'),'channel':_0x1490e4['actions'][_0x3bcb08]['channel']})['catch'](function(_0x7e6f3b){if(_0x7e6f3b[_0x507e('0x30')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1490e4[_0x507e('0x14')][_0x3bcb08]){ut[_0x507e('0x4e')](_0x1490e4[_0x507e('0x11')][_0x1490e4['actions'][_0x3bcb08][_0x507e('0x44')]],'[clearZombieChannel]');if(_0x1490e4['actions'][_0x3bcb08][_0x507e('0x47')]===!![]){ut[_0x507e('0x4f')](_0x1490e4[_0x507e('0x11')][_0x1490e4[_0x507e('0x14')][_0x3bcb08][_0x507e('0x44')]],'[clearZombieChannel]');ut[_0x507e('0x50')](_0x507e('0x51')+_0x3bcb08,_0x1490e4['actions'][_0x3bcb08][_0x507e('0x44')]);}ut[_0x507e('0x50')](_0x507e('0x52')+_0x3bcb08,_0x1490e4[_0x507e('0x14')][_0x3bcb08]['queue']);delete _0x1490e4[_0x507e('0x14')][_0x3bcb08];}},0x2328);}});}});};Preview[_0x507e('0xe')][_0x507e('0x3c')]=function(){var _0x1c42fe=this;loggerAction[_0x507e('0x23')]('[action]',_[_0x507e('0x53')](this[_0x507e('0x14')]));for(var _0x5a9ad7 in this[_0x507e('0x14')]){if(_0x1c42fe[_0x507e('0x14')][_0x507e('0x38')](_0x5a9ad7)){_0x1c42fe[_0x507e('0x40')](_0x5a9ad7);}}};Preview[_0x507e('0xe')][_0x507e('0x54')]=function(_0x113a56){var _0x4c640c=this;rpcDb[_0x507e('0x55')](_0x113a56['id'],ut[_0x507e('0x56')](this[_0x507e('0x15')]))['then'](function(_0x1f048e){if(!_[_0x507e('0x42')](_0x1f048e)){for(var _0x420844=0x0;_0x420844<_0x1f048e[_0x507e('0x57')];_0x420844+=0x1){if(ut[_0x507e('0x58')](_0x1f048e[_0x420844][_0x507e('0x59')])<_0x113a56[_0x507e('0x5a')]*0x3c){if(_0x1f048e[_0x420844][_0x507e('0x5b')]&&!_0x1f048e[_0x420844][_0x507e('0x5b')][_0x507e('0x5c')]){_0x4c640c[_0x507e('0x5d')](_0x1f048e[_0x420844]['id'])[_0x507e('0x5e')](ut[_0x507e('0x5f')](_0x507e('0x60')))[_0x507e('0x61')](ut[_0x507e('0x5f')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x1f048e[_0x420844]['id']);}}else{var _0x214e5a=new Action(_0x1f048e[_0x420844],_0x113a56);_0x214e5a['starttime']=moment()[_0x507e('0x25')](_0x507e('0x62'));_0x113a56[_0x507e('0x63')]+=0x1;ut[_0x507e('0x64')](_0x214e5a,0x17,_0x507e('0x65'));if(_0x113a56[_0x507e('0x66')]){rpcDb['rescheduleContactInQueue'](ut[_0x507e('0x67')](_0x1f048e[_0x420844]));rpcDb[_0x507e('0x68')](_0x214e5a,_0x507e('0x69'));}else{ut[_0x507e('0x64')](_0x214e5a,0x16,'RecallFailedTimeout');rpcDb[_0x507e('0x68')](_0x214e5a,_0x507e('0x6a'));rpcDb[_0x507e('0x6b')](_0x214e5a,_0x507e('0x6a'));}}}}})[_0x507e('0x61')](ut['logger2'](_0x507e('0x6c')));};Preview[_0x507e('0xe')][_0x507e('0x3f')]=function(_0x19e120){_0x19e120[_0x507e('0x2d')]=!![];if(ut[_0x507e('0x6d')](_0x19e120['loggedIn'])){_0x19e120[_0x507e('0x30')]=utils[_0x507e('0x34')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x507e('0x6e')](_0x19e120[_0x507e('0x3e')])){_0x19e120[_0x507e('0x30')]=utils[_0x507e('0x34')][_0x507e('0x31')];}else if(!this[_0x507e('0x6f')](_0x19e120['Trunk'])){if(!this[_0x507e('0x6f')](_0x19e120[_0x507e('0x70')])){_0x19e120['message']=utils['CAMPAIGN_STATUS'][_0x507e('0x71')];}else{_0x19e120[_0x507e('0x30')]=utils[_0x507e('0x34')][_0x507e('0x72')];}}else{_0x19e120['message']=utils[_0x507e('0x34')][_0x507e('0x72')];}};Preview[_0x507e('0xe')]['callProgressDetectingCustomer']=function(_0x5c80a5,_0x37eed0,_0x1ff992){var _0x52c075=this;var _0x4e72d6=this[_0x507e('0x14')][_0x37eed0];var _0x412bc3=this[_0x507e('0x11')][_0x4e72d6[_0x507e('0x44')]];var _0x35d886;var _0x4162d1=![];var _0x1c4420=0x2;var _0x271415=0x3;if(_0x412bc3){switch(_0x1ff992){case'1':_0x412bc3[_0x507e('0x73')]+=0x1;_0x4e72d6[_0x507e('0x74')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut['totalGlobal'](_0x4e72d6);ut['logCustomer'](_0x4e72d6,0x0,'NoSuchNumber');ami[_0x507e('0x29')](_0x507e('0x76'),ut['buildObj'](_0x4e72d6,_0x507e('0x77')));rpcDb['createCustomerHistory'](_0x4e72d6,'[callProgressDetectingCustomer][logNoSuch]');_0x52c075[_0x507e('0x78')](_0x4e72d6,'0',_0x412bc3)[_0x507e('0x5e')](function(_0x1575bd){_0x4162d1=_0x1575bd['additional']==0x1;_0x1c4420=_0x412bc3[_0x507e('0x79')];_0x271415=_0x412bc3[_0x507e('0x7a')];if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3[_0x507e('0x7c')]){_0x35d886=ut['cloneAction'](_0x4e72d6,0xf,_0x507e('0x7d'));rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4e72d6[_0x507e('0x74')]>=_0x412bc3['dialNoSuchNumberMaxRetry']){rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0x7e'));}else{rpcDb['rescheduleContact'](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0x74'),_0x412bc3[_0x507e('0x79')]),_0x4e72d6[_0x507e('0x80')],_0x4e72d6['activeContact']);}}delete this['actions'][_0x5c80a5[_0x507e('0x81')]];}else{_0x4e72d6[_0x507e('0x74')]++;logger[_0x507e('0x23')](_0x507e('0x82'),_0x4e72d6['countnosuchnumberretry']);logger[_0x507e('0x23')]('id',_0x4e72d6[_0x507e('0x83')]);_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnosuchnumberretry':_0x4e72d6[_0x507e('0x74')]}})['then'](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)['then'](function(){});});}});break;case _0x507e('0x86'):var _0x2b44ba=moment()[_0x507e('0x25')](_0x507e('0x62'));_0x4e72d6[_0x507e('0x87')]=_0x2b44ba;_0x4e72d6[_0x507e('0x88')]=_0x2b44ba;_0x4e72d6[_0x507e('0x47')]=!![];_0x412bc3[_0x507e('0x2c')]+=0x1;logger[_0x507e('0x23')]('[syncHangup][talking][increment]',_0x4e72d6[_0x507e('0x89')],_0x507e('0x8a'),_0x412bc3[_0x507e('0x27')],_0x507e('0x46'),_0x412bc3[_0x507e('0x2c')]);ami['emit'](_0x507e('0x8b'),ut[_0x507e('0x8c')](_0x4e72d6,_0x507e('0x8d'),this[_0x507e('0x11')][_0x4e72d6[_0x507e('0x44')]]));if(_0x412bc3[_0x507e('0x8e')]){ami[_0x507e('0x29')](_0x507e('0x8f'),ut[_0x507e('0x90')](_0x4e72d6));}break;case'16':ami[_0x507e('0x29')]('custom:agentcomplete',ut[_0x507e('0x8c')](_0x4e72d6,_0x507e('0x91'),this[_0x507e('0x11')][_0x4e72d6['queue']]));emitVoiceQueueChannelRemove(ut[_0x507e('0x8c')](_0x4e72d6,'complete'));_0x412bc3[_0x507e('0x92')]+=0x1;_0x412bc3['total']+=0x1;_0x412bc3['answered']+=0x1;ut[_0x507e('0x4f')](_0x412bc3,_0x507e('0x93'));_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x4,'Answer');rpcDb[_0x507e('0x68')](_0x4e72d6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x507e('0x6b')](_0x4e72d6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4e72d6);_0x412bc3['sumDuration']+=_0x4e72d6['talktime'];_0x412bc3[_0x507e('0x94')]+=_0x4e72d6[_0x507e('0x95')];logger[_0x507e('0x23')](_0x507e('0x96'),_0x4e72d6['uniqueid'],_0x507e('0x8a'),_0x412bc3['name'],_0x507e('0x46'),_0x412bc3[_0x507e('0x2c')]);delete this[_0x507e('0x14')][_0x5c80a5[_0x507e('0x81')]];break;case _0x507e('0x97'):_0x412bc3['outboundBusyCallsDay']+=0x1;_0x4e72d6[_0x507e('0x98')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x5,_0x507e('0x99'));_0x1c4420=_0x412bc3[_0x507e('0x9a')];_0x271415=_0x412bc3[_0x507e('0x7a')];ami[_0x507e('0x29')](_0x507e('0x9b'),ut[_0x507e('0x8c')](_0x4e72d6,_0x507e('0x9c')));rpcDb[_0x507e('0x68')](_0x4e72d6,'[callProgressDetectingCustomer][logBusy]');_0x52c075['verifyAdditionalPhones'](_0x4e72d6,'5',_0x412bc3)['then'](function(_0x385690){_0x4162d1=_0x385690['additional']==0x1;if(!_0x4162d1){if(ut['totalGlobal'](_0x4e72d6)>=_0x412bc3['dialGlobalMaxRetry']){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,_0x507e('0x7d'));rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4e72d6[_0x507e('0x98')]>=_0x412bc3[_0x507e('0x9e')]){rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0x9f'));}else{rpcDb[_0x507e('0xa0')](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0x98'),_0x412bc3[_0x507e('0x9a')]),_0x4e72d6[_0x507e('0x80')],_0x4e72d6[_0x507e('0xa1')]);}}}else{_0x4e72d6[_0x507e('0x98')]++;_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countbusyretry':_0x4e72d6[_0x507e('0x98')]}})[_0x507e('0x5e')](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});break;case _0x507e('0xa2'):_0x412bc3[_0x507e('0xa3')]+=0x1;_0x4e72d6['countnoanswerretry']+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x3,_0x507e('0xa4'));_0x1c4420=_0x412bc3[_0x507e('0xa5')];_0x271415=_0x412bc3[_0x507e('0x7a')];var _0x338a1e=ut[_0x507e('0xa6')](_0x4e72d6,_0x412bc3);ami[_0x507e('0x29')](_0x507e('0xa7'),_0x338a1e);rpcDb[_0x507e('0x68')](_0x4e72d6,'[callProgressDetectingCustomer][logNoAnswer]');_0x52c075[_0x507e('0x78')](_0x4e72d6,'3',_0x412bc3)[_0x507e('0x5e')](function(_0x3386ce){_0x4162d1=_0x3386ce['additional']==0x1;if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3['dialGlobalMaxRetry']){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,_0x507e('0x7d'));rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4e72d6['countnoanswerretry']>=_0x412bc3[_0x507e('0xa8')]){rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0xa9'));}else{rpcDb[_0x507e('0xa0')](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0xaa'),_0x412bc3[_0x507e('0xa5')]),_0x4e72d6[_0x507e('0x80')],_0x4e72d6['activeContact']);}}}else{_0x4e72d6[_0x507e('0xaa')]++;_0x52c075['incrementPreviewCounters']({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnoanswerretry':_0x4e72d6[_0x507e('0xaa')]}})[_0x507e('0x5e')](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});break;case _0x507e('0xab'):_0x412bc3[_0x507e('0xac')]+=0x1;_0x4e72d6[_0x507e('0xad')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x8,_0x507e('0xae'));_0x1c4420=_0x412bc3['dialCongestionRetryFrequency'];_0x271415=_0x412bc3[_0x507e('0x7a')];ami['emit'](_0x507e('0xaf'),ut['buildObj'](_0x4e72d6,_0x507e('0xb0')));rpcDb[_0x507e('0x68')](_0x4e72d6,_0x507e('0xb1'));_0x52c075[_0x507e('0x78')](_0x4e72d6,'8',_0x412bc3)[_0x507e('0x5e')](function(_0x234922){_0x4162d1=_0x234922[_0x507e('0xb2')]==0x1;if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3['dialGlobalMaxRetry']){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,'Global');rpcDb[_0x507e('0x6b')](_0x35d886,_0x507e('0xb3'));}else{if(_0x4e72d6[_0x507e('0xad')]>=_0x412bc3[_0x507e('0xb4')]){rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0xb1'));}else{rpcDb[_0x507e('0xa0')](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0xad'),_0x412bc3[_0x507e('0x9a')]),_0x4e72d6[_0x507e('0x80')],_0x4e72d6[_0x507e('0xa1')]);}}}else{_0x4e72d6['countcongestionretry']++;_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countcongestionretry':_0x4e72d6[_0x507e('0xad')]}})[_0x507e('0x5e')](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});break;case _0x507e('0xb5'):_0x412bc3[_0x507e('0xb6')]+=0x1;_0x4e72d6[_0x507e('0xb7')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x14,_0x507e('0xb8'));_0x1c4420=_0x412bc3[_0x507e('0xb9')];_0x271415=_0x412bc3['callAdditionalPhoneAfterMin'];ami[_0x507e('0x29')](_0x507e('0xba'),ut['buildObj'](_0x4e72d6,_0x507e('0xbb')));rpcDb[_0x507e('0x68')](_0x4e72d6,_0x507e('0xbc'));_0x52c075[_0x507e('0x78')](_0x4e72d6,'20',_0x412bc3)[_0x507e('0x5e')](function(_0x21be8e){_0x4162d1=_0x21be8e[_0x507e('0xb2')]==0x1;if(!_0x4162d1){if(ut['totalGlobal'](_0x4e72d6)>=_0x412bc3['dialGlobalMaxRetry']){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0x14,_0x507e('0xb8'));rpcDb[_0x507e('0x6b')](_0x35d886,_0x507e('0xbd'));}else{if(_0x4e72d6[_0x507e('0xb7')]>=_0x412bc3[_0x507e('0xbe')]){rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0xbd'));}else{rpcDb['rescheduleContact'](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0xb7'),_0x412bc3['dialAgentRejectRetryFrequency']),_0x4e72d6[_0x507e('0x80')],_0x4e72d6['activeContact']);}}}else{_0x4e72d6[_0x507e('0xaa')]++;_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnoanswerretry':_0x4e72d6[_0x507e('0xaa')]}})['then'](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});break;case _0x507e('0xbf'):_0x412bc3[_0x507e('0xc0')]+=0x1;_0x4e72d6[_0x507e('0xc1')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut['logCustomer'](_0x4e72d6,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x4e72d6,'[callProgressDetectingCustomer][logAbandoned]');_0x52c075[_0x507e('0x78')](_0x4e72d6,'11',_0x412bc3)[_0x507e('0x5e')](function(_0x5dbf7f){_0x4162d1=_0x5dbf7f[_0x507e('0xb2')]==0x1;if(!_0x4162d1){if(ut['totalGlobal'](_0x4e72d6)>=_0x412bc3[_0x507e('0x7c')]){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,_0x507e('0x7d'));rpcDb[_0x507e('0x6b')](_0x35d886,_0x507e('0xc2'));}else{if(_0x4e72d6[_0x507e('0xc3')]>=_0x412bc3[_0x507e('0xc4')]){rpcDb['createCustomerFinal'](_0x4e72d6,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x507e('0x7f')](_0x4e72d6,_0x507e('0xc1'),_0x412bc3[_0x507e('0xc5')]),_0x4e72d6['unlockAgent'],_0x4e72d6['activeContact']);}}}else{_0x4e72d6[_0x507e('0xaa')]++;_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnoanswerretry':_0x4e72d6[_0x507e('0xaa')]}})[_0x507e('0x5e')](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});break;case'18':_0x412bc3[_0x507e('0xc6')]+=0x1;_0x4e72d6[_0x507e('0xc7')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x12,_0x5c80a5[_0x507e('0xc8')]||_0x5c80a5[_0x507e('0xc9')]);ami[_0x507e('0x29')](_0x507e('0xca'),ut[_0x507e('0x8c')](_0x4e72d6,_0x507e('0xcb')));rpcDb['createCustomerHistory'](_0x4e72d6,_0x507e('0xcc'));_0x52c075[_0x507e('0x78')](_0x4e72d6,'18',_0x412bc3)[_0x507e('0x5e')](function(_0x455c1b){_0x4162d1=_0x455c1b[_0x507e('0xb2')]==0x1;if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3[_0x507e('0x7c')]){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0x12,'Global');rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x4e72d6,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x4e72d6['countnoanswerretry']++;_0x52c075['incrementPreviewCounters']({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnoanswerretry':_0x4e72d6[_0x507e('0xaa')]}})[_0x507e('0x5e')](function(){_0x52c075['swapAdditionalPhones'](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});delete this[_0x507e('0x14')][_0x5c80a5[_0x507e('0x81')]];break;case'19':_0x412bc3['outboundUnknownCallsDay']+=0x1;_0x4e72d6['countglobal']=ut[_0x507e('0x7b')](_0x4e72d6);ut[_0x507e('0x64')](_0x4e72d6,0x13,_0x5c80a5[_0x507e('0xc8')]||_0x5c80a5[_0x507e('0xc9')]);ami[_0x507e('0x29')]('custom:amd',ut['buildObj'](_0x4e72d6,_0x507e('0xcb')));rpcDb[_0x507e('0x68')](_0x4e72d6,_0x507e('0xcd'));_0x52c075[_0x507e('0x78')](_0x4e72d6,'18',_0x412bc3)[_0x507e('0x5e')](function(_0x3516e6){_0x4162d1=_0x3516e6['additional']==0x1;if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3[_0x507e('0x7c')]){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,_0x507e('0x7d'));rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x4e72d6,_0x507e('0xcd'));}}else{_0x4e72d6['countnoanswerretry']++;_0x52c075[_0x507e('0x84')]({'id':_0x4e72d6[_0x507e('0x83')],'field':{'countnoanswerretry':_0x4e72d6[_0x507e('0xaa')]}})['then'](function(){_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});});}});delete this['actions'][_0x5c80a5[_0x507e('0x81')]];break;default:if(_0x4e72d6[_0x507e('0x47')]){ut['decrementTalkink'](_0x412bc3,_0x507e('0xce'));ut['loggerError'](_0x507e('0xcf')+_0x412bc3[_0x507e('0x27')],_0x5c80a5);}_0x412bc3[_0x507e('0xc6')]+=0x1;_0x4e72d6[_0x507e('0x75')]=ut[_0x507e('0x7b')](_0x4e72d6);ut['logCustomer'](_0x4e72d6,0xc,_0x5c80a5[_0x507e('0xc8')]||_0x5c80a5[_0x507e('0xc9')]);_0x1c4420=_0x412bc3[_0x507e('0xb9')];_0x271415=_0x412bc3['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x4e72d6,'[callProgressDetectingCustomer][logUnknown]');_0x52c075['verifyAdditionalPhones'](_0x4e72d6,'20',_0x412bc3)[_0x507e('0x5e')](function(_0x494e0e){_0x4162d1=_0x494e0e[_0x507e('0xb2')]==0x1;if(!_0x4162d1){if(ut[_0x507e('0x7b')](_0x4e72d6)>=_0x412bc3[_0x507e('0x7c')]){_0x35d886=ut[_0x507e('0x9d')](_0x4e72d6,0xf,'Global');rpcDb[_0x507e('0x6b')](_0x35d886,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x507e('0x6b')](_0x4e72d6,_0x507e('0xd0'));}delete this['actions'][_0x5c80a5[_0x507e('0x81')]];}else{_0x52c075[_0x507e('0x85')](_0x4e72d6,_0x1c4420,_0x271415)[_0x507e('0x5e')](function(){});}});}if(!(_0x4e72d6[_0x507e('0x47')]&&_0x1ff992==='16')){ut[_0x507e('0x4e')](_0x412bc3,_0x507e('0xd1'));logger[_0x507e('0x23')](_0x507e('0xd2'),_0x4e72d6['uniqueid'],_0x507e('0x8a'),_0x412bc3[_0x507e('0x27')],_0x507e('0x45'),_0x412bc3[_0x507e('0x2b')]);}if(_0x1ff992!==_0x507e('0x86')){delete this[_0x507e('0x14')][_0x5c80a5[_0x507e('0x81')]];delete this[_0x507e('0x14')][_0x5c80a5[_0x507e('0xd3')]];}_0x412bc3['queueSummaryCountersUpdated']=!![];}};Preview[_0x507e('0xe')][_0x507e('0xd4')]=function(_0x1f973f,_0x5ce668,_0x394151){if(_[_0x507e('0xd5')](_0x5ce668)&&_0x507e('0xd6')!==typeof _0x5ce668){return;}if(_[_0x507e('0xd5')](_0x394151)&&_0x507e('0xd6')!==typeof _0x394151){return;}switch(_0x394151[_0x507e('0xd7')]){case'0':ut['logAgent'](_0x1f973f,0x0,'NoSuchNumber');rpcDb[_0x507e('0xd8')](_0x1f973f,_0x507e('0xd9'));break;case'3':ut['logAgent'](_0x1f973f,0x3,_0x507e('0xa4'));rpcDb['createAgentHistory'](_0x1f973f,_0x507e('0xda'));break;case'5':ut[_0x507e('0xdb')](_0x1f973f,0x5,_0x507e('0x99'));rpcDb['createAgentHistory'](_0x1f973f,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x1f973f,0x8,_0x507e('0xae'));rpcDb['createAgentHistory'](_0x1f973f,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x507e('0xdb')](_0x1f973f,0x16,_0x507e('0xdc'));rpcDb[_0x507e('0xd8')](_0x1f973f,_0x507e('0xdd'));break;default:ut['logAgent'](_0x1f973f,0xc,_0x394151[_0x507e('0xd7')]);rpcDb[_0x507e('0xd8')](_0x1f973f,_0x507e('0xde'));}ut[_0x507e('0x4e')](_0x5ce668,_0x507e('0xdf'));logger[_0x507e('0x23')](_0x507e('0xe0'),_0x1f973f[_0x507e('0x89')],_0x507e('0x8a'),_0x5ce668[_0x507e('0x27')],'originated:\x20',_0x5ce668['originated']);delete this[_0x507e('0x14')][_0x1f973f[_0x507e('0x89')]];};Preview[_0x507e('0xe')]['verifyAdditionalPhones']=function(_0x2f6e6e,_0x3984ee,_0x5b4c7a){return cmHopperAdditionalPhone[_0x507e('0x78')](_0x2f6e6e,_0x3984ee,_0x5b4c7a)[_0x507e('0x61')](logger[_0x507e('0x23')]('[verifyAdditionalPhone]\x20'));};Preview[_0x507e('0xe')][_0x507e('0x85')]=function(_0x3d13e5,_0x3fb927,_0x10e537){return cmHopperAdditionalPhone[_0x507e('0x85')](_0x3d13e5,_0x3fb927,_0x10e537)[_0x507e('0x61')](logger[_0x507e('0x23')]('[swapAdditionalPhone]\x20'));};Preview[_0x507e('0xe')][_0x507e('0x84')]=function(_0x268d25){return Promise[_0x507e('0xe1')]()[_0x507e('0x5e')](cmHopperAdditionalPhone[_0x507e('0x84')](_0x268d25))[_0x507e('0x61')](logger[_0x507e('0x23')](_0x507e('0xe2')));};Preview[_0x507e('0xe')][_0x507e('0xe3')]=function(_0x24702e,_0x55b419,_0x30dcd5,_0x504f22,_0x26c435){var _0x34fdd3=this;return new Promise(function(_0xe2f459,_0xf1362d){if(_[_0x507e('0x42')](_0x55b419)||_['isNil'](_0x55b419[_0x507e('0xe4')])||_[_0x507e('0x42')](_0x55b419['phone'])||_[_0x507e('0x42')](_0x55b419['VoiceQueueId'])){_0xf1362d(ut['message'](_0x507e('0xe5'),_0x504f22,_0x26c435));return;}var _0x3c6497=uuid['v4']();var _0x14c70c=_0x34fdd3[_0x507e('0x11')][_0x55b419[_0x507e('0x43')][_0x507e('0x27')]];var _0x4ba39b=_0x30dcd5?_0x34fdd3[_0x507e('0x15')][_0x30dcd5]['id']:undefined;_0x34fdd3[_0x507e('0x14')][_0x3c6497]=new Action(_0x55b419,_0x14c70c,_0x3c6497,_0x30dcd5,_0x4ba39b);var _0x191520=_0x34fdd3[_0x507e('0x14')][_0x3c6497];_0x191520[_0x507e('0x80')]=_0x504f22;_0x191520[_0x507e('0xa1')]=_0x26c435;_0x191520[_0x507e('0xe6')]=_0x30dcd5;if(_['isEmpty'](_0x24702e)){_0x34fdd3[_0x507e('0xe7')](_0x191520,_0x14c70c,_0x55b419,_0x30dcd5)[_0x507e('0x5e')](function(_0x4bdb28){logger[_0x507e('0x23')](_0x507e('0xe8'),_0x507e('0xe9')+_0x191520[_0x507e('0x44')]+_0x507e('0xea')+_0x191520[_0x507e('0x83')],JSON[_0x507e('0x48')](_0x4bdb28));ami[_0x507e('0x29')]('custom:agentcalled',ut[_0x507e('0x8c')](_0x191520,_0x507e('0xeb'),_0x34fdd3[_0x507e('0x11')][_0x191520[_0x507e('0x44')]]));_0xe2f459(ut['message']('Calling'));})[_0x507e('0x61')](function(_0x2a5263){ut[_0x507e('0x35')]('[Preview][execCall][failure]',_0x2a5263);_0xf1362d(ut['message'](_0x507e('0xec'),_0x504f22,_0x26c435));});}else{_0x14c70c[_0x507e('0xed')]+=0x1;ut[_0x507e('0xee')](_0x191520);rpcDb[_0x507e('0xef')](_0x191520,_0x507e('0xf0'));delete _0x34fdd3[_0x507e('0x14')][_0x3c6497];_0xf1362d(ut['message']('Contact\x20in\x20black\x20List',_0x504f22,_0x26c435));}});};Preview[_0x507e('0xe')][_0x507e('0x6f')]=function(_0x2fa33a){return!_[_0x507e('0x42')](_0x2fa33a)&&!_[_0x507e('0x42')](_0x2fa33a[_0x507e('0x27')])&&!_['isNil'](_0x2fa33a[_0x507e('0xf1')])&&_0x2fa33a[_0x507e('0xf1')]&&!_[_0x507e('0x42')](this[_0x507e('0x13')][util[_0x507e('0x25')](_0x507e('0xf2'),_0x2fa33a['name'])])&&!_[_0x507e('0x42')](this[_0x507e('0x13')][util[_0x507e('0x25')](_0x507e('0xf2'),_0x2fa33a['name'])]['status'])&&(this[_0x507e('0x13')][util[_0x507e('0x25')](_0x507e('0xf2'),_0x2fa33a[_0x507e('0x27')])]['status']==='reachable'||this['trunks'][util[_0x507e('0x25')](_0x507e('0xf2'),_0x2fa33a[_0x507e('0x27')])][_0x507e('0x4d')]==='unmonitored');};Preview[_0x507e('0xe')][_0x507e('0x5d')]=function(_0x343dd1,_0x3f10c8){return this['execRun'](_0x343dd1,_0x3f10c8)[_0x507e('0x5e')](function(_0x37013f){return _[_0x507e('0xf3')](_0x37013f,[_0x507e('0x30')]);})[_0x507e('0x61')](function(_0x5ecf90){if(_0x5ecf90[_0x507e('0xf4')]){rpcDb[_0x507e('0xf5')](_0x343dd1);}if(_0x5ecf90[_0x507e('0xf1')]){rpcDb[_0x507e('0xf6')](_0x343dd1);}throw _[_0x507e('0xf3')](_0x5ecf90,[_0x507e('0x30')]);});};Preview['prototype'][_0x507e('0xf7')]=function(_0x4ee52b,_0x18f007){var _0x1ceeaf=this;var _0x13ab2b,_0x338c7f;return rpcDb[_0x507e('0xf8')](_0x4ee52b)['then'](function(_0x2ad6ec){if(!_[_0x507e('0x42')](_0x2ad6ec[0x0])){_0x338c7f=_0x2ad6ec[0x0][_0x507e('0xf9')]?![]:!![];_0x13ab2b=_0x2ad6ec[0x0][_0x507e('0xf9')]?!![]:![];_0x13ab2b=_0x18f007?!![]:_0x13ab2b;}var _0x19a57a=_0x1ceeaf[_0x507e('0xfa')](_0x2ad6ec);if(_0x19a57a[_0x507e('0xfb')]){rpcDb[_0x507e('0xfc')](_['pick'](_0x2ad6ec[0x0],[_0x507e('0xfd'),_0x507e('0xfe')]))[_0x507e('0x5e')](function(_0x52e990){_0x1ceeaf[_0x507e('0xe3')](_0x52e990,_0x2ad6ec[0x0],_0x18f007,_0x338c7f,_0x13ab2b)[_0x507e('0x5e')](function(_0x220033){return _0x220033;})[_0x507e('0x61')](function(_0x1ff1f8){throw _0x1ff1f8;});})[_0x507e('0x61')](function(_0x164768){ut[_0x507e('0x35')](_0x507e('0xff'),_0x164768);throw ut[_0x507e('0x30')](_0x507e('0x100'),_0x338c7f,_0x13ab2b);});}else{throw ut[_0x507e('0x30')](_0x19a57a[_0x507e('0x30')],_0x338c7f,_0x13ab2b);}})[_0x507e('0x61')](function(_0x1ef855){ut[_0x507e('0x35')](_0x507e('0x101'),_0x1ef855);throw ut[_0x507e('0x30')](_0x507e('0x100'),![],!![]);});};Preview[_0x507e('0xe')]['validateContact']=function(_0x194652){if(_[_0x507e('0x42')](_0x194652)||_[_0x507e('0x102')](_0x194652)||!_[_0x507e('0x42')](_0x194652[0x0][_0x507e('0x5b')])&&_['isNil'](_0x194652[0x0][_0x507e('0x5b')][_0x507e('0x27')])){ut[_0x507e('0x35')](_0x507e('0x103'),_0x194652);return{'isValid':![],'message':_0x507e('0x104')};}var _0xfda35c=this[_0x507e('0x11')][_0x194652[0x0]['Queue'][_0x507e('0x27')]];_0xfda35c['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x507e('0x42')](_0xfda35c)){ut[_0x507e('0x35')]('[Preview][validateContact][Empty\x20Campaign]',_0xfda35c);return{'isValid':![],'message':_0x507e('0x105')};}if(!this[_0x507e('0x6f')](_0xfda35c[_0x507e('0x106')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0xfda35c['name']+_0x507e('0x107'));if(!this[_0x507e('0x6f')](_0xfda35c[_0x507e('0x70')])){ut[_0x507e('0x35')](_0x507e('0x108'),_0xfda35c['name']+_0x507e('0x109'));return{'isValid':![],'message':_0x507e('0x10a')};}}if(!ut[_0x507e('0x6e')](_0xfda35c[_0x507e('0x3e')])){ut[_0x507e('0x35')](_0x507e('0x10b'),_0xfda35c[_0x507e('0x27')]+_0x507e('0x10c'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xfda35c[_0x507e('0x27')]+_0x507e('0x10c')};}return{'isValid':!![],'message':_0x507e('0x10d')};};Preview[_0x507e('0xe')][_0x507e('0xe7')]=function(_0x17a3ba,_0x3cb4f6,_0x475047,_0x29960f){var _0x262b5a=this;return new Promise(function(_0x36390a,_0x2ba000){var _0x31dc3e=_0x17a3ba[_0x507e('0x89')];var _0x40efb5=_0x262b5a[_0x507e('0x6f')](_0x3cb4f6[_0x507e('0x106')])?util['format'](_0x507e('0x10e'),_0x3cb4f6[_0x507e('0x106')][_0x507e('0x27')],_[_0x507e('0x42')](_0x3cb4f6[_0x507e('0x10f')])?'':_0x3cb4f6[_0x507e('0x10f')][_0x507e('0x110')]()||'',_0x3cb4f6[_0x507e('0x111')]>0x0?_0x475047[_0x507e('0xfe')][_0x507e('0x112')](_0x3cb4f6[_0x507e('0x111')]):_0x475047['phone']):util['format'](_0x507e('0x10e'),_[_0x507e('0x42')](_0x3cb4f6[_0x507e('0x70')])?_0x3cb4f6[_0x507e('0x106')]['name']:_0x3cb4f6[_0x507e('0x70')][_0x507e('0x27')],_[_0x507e('0x42')](_0x3cb4f6[_0x507e('0x10f')])?'':_0x3cb4f6[_0x507e('0x10f')][_0x507e('0x110')]()||'',_0x3cb4f6['dialCutDigit']>0x0?_0x475047[_0x507e('0xfe')][_0x507e('0x112')](_0x3cb4f6['dialCutDigit']):_0x475047[_0x507e('0xfe')]);var _0x45ec9b=_0x262b5a['isTrunkReachable'](_0x3cb4f6[_0x507e('0x106')])?ut[_0x507e('0x113')](_0x3cb4f6[_0x507e('0x106')][_0x507e('0x114')],_0x3cb4f6[_0x507e('0x115')],_0x3cb4f6[_0x507e('0x116')]>0x0?ut[_0x507e('0x117')](_0x3cb4f6[_0x507e('0x118')],_0x3cb4f6[_0x507e('0x116')]):_0x3cb4f6[_0x507e('0x118')]):ut[_0x507e('0x113')](_[_0x507e('0x42')](_0x3cb4f6[_0x507e('0x70')])?_0x3cb4f6[_0x507e('0x106')]['callerid']:_0x3cb4f6[_0x507e('0x70')][_0x507e('0x114')],_0x3cb4f6['dialOriginateCallerIdName'],_0x3cb4f6[_0x507e('0x116')]>0x0?ut[_0x507e('0x117')](_0x3cb4f6[_0x507e('0x118')],_0x3cb4f6[_0x507e('0x116')]):_0x3cb4f6[_0x507e('0x118')]);if(_0x45ec9b){_0x17a3ba[_0x507e('0x119')]=ut[_0x507e('0x11a')](_0x45ec9b);_0x17a3ba['originatecalleridnum']=ut[_0x507e('0x11b')](_0x45ec9b);}var _0x326d99=ut[_0x507e('0x11c')](_0x3cb4f6,_0x475047,_0x40efb5,_0x45ec9b,_0x31dc3e,_0x17a3ba);var _0x284bc0=utils[_0x507e('0x11d')](_0x475047[_0x507e('0xe4')]);Object[_0x507e('0x11e')](_0x326d99,_0x284bc0);_['merge'](_0x17a3ba,ut[_0x507e('0x11f')](_0x326d99));_0x17a3ba['starttime']=moment()[_0x507e('0x25')](_0x507e('0x62'));_0x3cb4f6[_0x507e('0x120')]=_0x326d99;var _0x1b1d51=ut['variablesAction'](_0x17a3ba,_0x3cb4f6,_0x326d99,_0x17a3ba[_0x507e('0xa1')],_0x29960f);return ami[_0x507e('0x4c')](_0x1b1d51)[_0x507e('0x5e')](function(_0x5b0bd0){_0x3cb4f6[_0x507e('0x2b')]+=0x1;logger[_0x507e('0x23')](_0x507e('0x121'),_0x31dc3e,_0x507e('0x8a'),_0x3cb4f6['name'],'originated:\x20',_0x3cb4f6[_0x507e('0x2b')]);_0x36390a(_0x5b0bd0);})[_0x507e('0x61')](function(_0x13a21d){ut[_0x507e('0xdb')](_0x17a3ba,0xe,'OriginateError');rpcDb[_0x507e('0xd8')](_0x17a3ba,_0x507e('0x122'));_0x2ba000(_0x13a21d);});});};Preview[_0x507e('0xe')][_0x507e('0x123')]=function(_0x3b9ede){if(this[_0x507e('0x14')][_0x3b9ede[_0x507e('0x81')]]){this[_0x507e('0x14')][_0x3b9ede[_0x507e('0x81')]][_0x507e('0x124')]=_0x3b9ede[_0x507e('0x124')];}};Preview[_0x507e('0xe')][_0x507e('0x18')]=function(_0x422bf7){var _0x1e526c=this;var _0x2b32ac=this['actions'][_0x422bf7['actionid']];if(_0x2b32ac){if(_0x2b32ac[_0x507e('0xe6')]&&this[_0x507e('0x15')][_0x2b32ac['lookAgent']]){ut[_0x507e('0x125')](_0x2b32ac,this[_0x507e('0x15')][_0x2b32ac[_0x507e('0xe6')]][_0x507e('0x27')],this[_0x507e('0x15')][_0x2b32ac[_0x507e('0xe6')]]['id']);}var _0x150fe9=_[_0x507e('0x126')](_0x2b32ac);_0x150fe9[_0x507e('0x87')]=moment()[_0x507e('0x25')](_0x507e('0x62'));var _0x343a0b=_0x1e526c['campaignsPreview'][_0x2b32ac['queue']];if(ut[_0x507e('0x127')](_0x422bf7['response'])){if(_0x2b32ac['unlockAgent']){rpcDb[_0x507e('0xf5')](_0x2b32ac['idContact']);}if(_0x2b32ac[_0x507e('0xa1')]){rpcDb['disableContact'](_0x2b32ac[_0x507e('0x83')]);}ami[_0x507e('0x29')]('custom:agentringnoanswer',ut['buildObj'](_0x2b32ac,_0x507e('0x128'),this['campaignsPreview'][_0x2b32ac[_0x507e('0x44')]]));this[_0x507e('0xd4')](_0x150fe9,_0x343a0b,_0x422bf7);}else{_0x2b32ac[_0x507e('0x129')]=moment()[_0x507e('0x25')](_0x507e('0x62'));ut['logAgent'](_0x150fe9,0x4,_0x507e('0x12a'));rpcDb[_0x507e('0xd8')](_0x150fe9,_0x507e('0x12b'));}}};Preview[_0x507e('0xe')][_0x507e('0x1a')]=function(_0x16a18e){var _0x3924df=this[_0x507e('0x14')][_0x16a18e[_0x507e('0x81')]];var _0x1c10fc;if(_0x3924df){_0x1c10fc=this[_0x507e('0x11')][_0x3924df['queue']];logger[_0x507e('0x23')](_0x507e('0x12c'),_0x16a18e[_0x507e('0x81')],_0x507e('0x8a'),_0x1c10fc['name'],_0x507e('0x46'),_0x1c10fc[_0x507e('0x2c')]);}if(this[_0x507e('0x14')][_0x16a18e['linkedid']]&&_0x16a18e[_0x507e('0x81')]!==_0x16a18e[_0x507e('0x89')]){if(_0x16a18e['cause']==='16'&&this[_0x507e('0x14')][_0x16a18e[_0x507e('0x81')]]['dialAnswer']){this[_0x507e('0x12d')](_0x16a18e,_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')]);}else if(this[_0x507e('0x14')][_0x16a18e['linkedid']]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')],_0x507e('0x8a'),_0x1c10fc['name'],_0x507e('0x46'),_0x1c10fc[_0x507e('0x2c')]);this[_0x507e('0x12d')](_0x16a18e,_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')]);}}else if(_0x3924df&&_[_0x507e('0x42')](_0x3924df['statedesc'])&&_0x1c10fc[_0x507e('0x12f')]&&_0x16a18e[_0x507e('0x81')]===_0x16a18e[_0x507e('0x89')]&&_[_0x507e('0x42')](_0x16a18e[_0x507e('0xd7')])&&_0x16a18e['cause']==='16'&&_0x16a18e[_0x507e('0x130')]==='6'&&_[_0x507e('0xd5')](_0x3924df[_0x507e('0x131')])){if(_0x3924df[_0x507e('0x80')]){rpcDb['unlockContact'](_0x3924df['idContact']);}if(_0x3924df[_0x507e('0xa1')]){rpcDb[_0x507e('0xf6')](_0x3924df[_0x507e('0x83')]);}_0x16a18e[_0x507e('0xd7')]='22';this['callProgressDetectingAgent'](_0x3924df,_0x1c10fc,_0x16a18e);}else if(_0x3924df&&_0x3924df[_0x507e('0x131')]){if(_0x16a18e[_0x507e('0x12e')]==='16'&&this[_0x507e('0x14')][_0x16a18e['linkedid']]['dialAnswer']){logger[_0x507e('0x23')](_0x507e('0x132'),_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')],'\x20Queue',_0x1c10fc[_0x507e('0x27')],'pTalking:\x20',_0x1c10fc[_0x507e('0x2c')]);this[_0x507e('0x12d')](_0x16a18e,_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')]);}else if(this[_0x507e('0x14')][_0x16a18e[_0x507e('0x81')]][_0x507e('0x47')]){logger[_0x507e('0x23')](_0x507e('0x133'),_0x16a18e[_0x507e('0x81')],_0x16a18e[_0x507e('0x12e')],_0x507e('0x8a'),_0x1c10fc[_0x507e('0x27')],'pTalking:\x20',_0x1c10fc[_0x507e('0x2c')]);this[_0x507e('0x12d')](_0x16a18e,_0x16a18e[_0x507e('0x81')],_0x16a18e['cause']);}}};Preview['prototype'][_0x507e('0x134')]=function(_0x3faaab){if(this[_0x507e('0x14')][_0x3faaab[_0x507e('0xd3')]]&&_0x3faaab[_0x507e('0xd3')]!==_0x3faaab[_0x507e('0x135')]){this[_0x507e('0x12d')](_0x3faaab,_0x3faaab[_0x507e('0xd3')],_0x3faaab['dialstatus']);}};Preview[_0x507e('0xe')][_0x507e('0x1c')]=function(_0x30008b){if(this[_0x507e('0x14')][_0x30008b[_0x507e('0x81')]]&&_0x30008b[_0x507e('0x81')]!==_0x30008b[_0x507e('0x89')]&&!this[_0x507e('0x14')][_0x30008b[_0x507e('0x81')]][_0x507e('0x47')]){if(_0x30008b[_0x507e('0x12e')]==='1'){this[_0x507e('0x12d')](_0x30008b,_0x30008b[_0x507e('0x81')],_0x30008b[_0x507e('0x12e')]);}}};Preview[_0x507e('0xe')][_0x507e('0x136')]=function(_0x53975f,_0x430563,_0xa0943f){if(this[_0x507e('0x14')][_0x53975f]){if(_[_0x507e('0x42')](this[_0x507e('0x14')][_0x53975f]['variables'])){this[_0x507e('0x14')][_0x53975f]['variables']={};}this[_0x507e('0x14')][_0x53975f][_0x507e('0x120')][_0x430563]=_0xa0943f;}};Preview[_0x507e('0xe')][_0x507e('0x1f')]=function(_0x4e490d){try{if(!_['isNil'](_0x4e490d)){if(ut[_0x507e('0x137')](_[_0x507e('0x138')](_0x4e490d[_0x507e('0x139')])[0x0])){this['addVariable'](_0x4e490d[_0x507e('0x89')],_[_0x507e('0x138')](_0x4e490d[_0x507e('0x139')])[0x0],_0x4e490d[_0x507e('0x13a')]);}}}catch(_0x387d38){logger[_0x507e('0x13b')](_0x507e('0x13c'),util['inspect'](_0x387d38,{'showHidden':![],'depth':null}));}};Preview[_0x507e('0xe')]['syncAttendedTransfer']=function(_0x49608d){if(_0x49608d){if(this[_0x507e('0x14')][_0x49608d['transfertargetlinkedid']]){this[_0x507e('0x14')][_0x49608d[_0x507e('0x13d')]][_0x507e('0x131')]=!![];}}};Preview[_0x507e('0xe')][_0x507e('0x21')]=function(_0x306e14){if(_0x306e14){if(this[_0x507e('0x14')][_0x306e14[_0x507e('0x13e')]]){this['actions'][_0x306e14['transfererlinkedid']]['transfer']=!![];}}};module[_0x507e('0x13f')]=Preview; \ No newline at end of file +var _0xbd06=['Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','NOANSWER','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','unlockAgent','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','Busy','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','[Preview][checkIsBlackList]','isEmpty','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','setXMDContactVariables','toLowerVariables','starttime','[originated][increment]','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','defaults','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','INACTIVE','logger','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','prototype','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','recallMe','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','logger2','NO_AGENTS_LOGGED','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','Global','dialNoSuchNumberMaxRetry','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','dialAnswer','uniqueid','\x20Queue','name','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','decrementTalkink'];(function(_0x4070fe,_0x4f253b){var _0x430c8b=function(_0x408c31){while(--_0x408c31){_0x4070fe['push'](_0x4070fe['shift']());}};_0x430c8b(++_0x4f253b);}(_0xbd06,0x97));var _0x6bd0=function(_0x198010,_0x26eae0){_0x198010=_0x198010-0x0;var _0x56bdef=_0xbd06[_0x198010];return _0x56bdef;};'use strict';var util=require(_0x6bd0('0x0'));var _=require(_0x6bd0('0x1'));var uuid=require(_0x6bd0('0x2'));var moment=require(_0x6bd0('0x3'));var Redis=require(_0x6bd0('0x4'));var config=require(_0x6bd0('0x5'));var logger=require(_0x6bd0('0x6'))(_0x6bd0('0x7'));var loggerAction=require('../../../config/logger')(_0x6bd0('0x8'));var ami=require(_0x6bd0('0x9'));var rpcDb=require(_0x6bd0('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x6bd0('0xb'));var ut=require(_0x6bd0('0xc'));var utils=require(_0x6bd0('0xd'));config[_0x6bd0('0xe')]=_[_0x6bd0('0xf')](config[_0x6bd0('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x6bd0('0x10')]=function(_0x230dd3){this['tail']=this[_0x6bd0('0x11')]?this['tail'][_0x6bd0('0x12')](_0x230dd3):_0x230dd3();};function Preview(_0x2232d1){this['sequence']=new Sequence();this['campaignsPreview']=_0x2232d1[_0x6bd0('0x13')];this[_0x6bd0('0x14')]=_0x2232d1[_0x6bd0('0x14')];this[_0x6bd0('0x15')]={};this[_0x6bd0('0x16')]=_0x2232d1[_0x6bd0('0x16')];this[_0x6bd0('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x19'),this[_0x6bd0('0x1a')][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x1b'),this[_0x6bd0('0x1c')]['bind'](this));ami['on'](_0x6bd0('0x1d'),this[_0x6bd0('0x1e')][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x1f'),this[_0x6bd0('0x20')][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x21'),this[_0x6bd0('0x22')][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x23'),this[_0x6bd0('0x24')][_0x6bd0('0x18')](this));ami['on'](_0x6bd0('0x25'),this[_0x6bd0('0x26')]['bind'](this));this[_0x6bd0('0x27')](this['campaignsPreview']);}function emit(_0x1d0e5e,_0x1ce666,_0x5af9f0){io['to'](_0x1d0e5e)[_0x6bd0('0x28')](_0x1ce666,_0x5af9f0);}function emitVoiceQueueChannelRemove(_0x2fa3f5){logger[_0x6bd0('0x29')](_0x6bd0('0x2a'),JSON[_0x6bd0('0x2b')](_0x2fa3f5));emit(util['format']('voice:queue:%s',_0x2fa3f5['name']),_0x6bd0('0x2c'),_0x2fa3f5);io[_0x6bd0('0x28')](_0x6bd0('0x2d'),_0x2fa3f5);}function notSendMessagesQueue(_0x16fe51){if(_0x16fe51[_0x6bd0('0x2e')]){if(_0x16fe51[_0x6bd0('0x2f')]===0x0&&_0x16fe51[_0x6bd0('0x30')]===0x0){_0x16fe51[_0x6bd0('0x2e')]=![];_0x16fe51[_0x6bd0('0x31')]=0x0;_0x16fe51[_0x6bd0('0x32')]=0x0;_0x16fe51[_0x6bd0('0x33')]=utils['CAMPAIGN_STATUS'][_0x6bd0('0x34')];ut[_0x6bd0('0x35')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x16fe51['name']+_0x6bd0('0x36'));}else{_0x16fe51[_0x6bd0('0x33')]=utils[_0x6bd0('0x37')][_0x6bd0('0x38')];ut[_0x6bd0('0x35')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x16fe51['name']+'\x20is\x20deactivated');}}}Preview[_0x6bd0('0x39')][_0x6bd0('0x27')]=function(){var _0x4d8654=this;setInterval(function(){_0x4d8654[_0x6bd0('0x3a')]();},0x7cf);};Preview[_0x6bd0('0x39')][_0x6bd0('0x3a')]=function(){var _0x2b90f1=this[_0x6bd0('0x3b')];this[_0x6bd0('0x17')]+=0x1;for(var _0x2a286d in _0x2b90f1){if(_0x2b90f1[_0x6bd0('0x3c')](_0x2a286d)&&(_0x2b90f1[_0x2a286d][_0x6bd0('0x3d')]==='preview'||_0x2b90f1[_0x2a286d][_0x6bd0('0x3d')]==='booked')&&_0x2b90f1[_0x2a286d][_0x6bd0('0x3e')]===_0x6bd0('0x3f')){if(this[_0x6bd0('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6bd0('0x40')]();}}if(_0x2b90f1[_0x6bd0('0x3c')](_0x2a286d)&&_0x2b90f1[_0x2a286d]['dialMethod']===_0x6bd0('0x7')&&_0x2b90f1[_0x2a286d]['type']===_0x6bd0('0x3f')){if(_0x2b90f1[_0x2a286d][_0x6bd0('0x41')]){this[_0x6bd0('0x42')](_0x2b90f1[_0x2a286d]);if(_0x2b90f1[_0x2a286d][_0x6bd0('0x43')])this['recallMe'](_0x2b90f1[_0x2a286d]);}else{notSendMessagesQueue(_0x2b90f1[_0x2a286d]);}}}};Preview[_0x6bd0('0x39')][_0x6bd0('0x44')]=function(_0x33a888){var _0x18d039=this;this[_0x6bd0('0x45')]['enqueue'](function(){if(!_[_0x6bd0('0x46')](_0x18d039[_0x6bd0('0x15')][_0x33a888])){loggerAction[_0x6bd0('0x29')](_0x6bd0('0x47'),_0x33a888,_0x6bd0('0x48'),_0x18d039['actions'][_0x33a888][_0x6bd0('0x49')],_0x6bd0('0x4a'),JSON['stringify'](_0x18d039['campaignsPreview'][_0x18d039['actions'][_0x33a888][_0x6bd0('0x49')]][_0x6bd0('0x2f')]),'pTalking:\x20',JSON[_0x6bd0('0x2b')](_0x18d039[_0x6bd0('0x3b')][_0x18d039[_0x6bd0('0x15')][_0x33a888][_0x6bd0('0x49')]]['pTalking']),JSON[_0x6bd0('0x2b')](_0x18d039[_0x6bd0('0x15')][_0x33a888]['dialAnswer']),JSON[_0x6bd0('0x2b')](_[_0x6bd0('0x4b')](_0x18d039[_0x6bd0('0x15')][_0x33a888],['contactId',_0x6bd0('0x4c'),_0x6bd0('0x4d'),_0x6bd0('0x4e')])));return ami[_0x6bd0('0x4f')]({'action':_0x6bd0('0x50'),'channel':_0x18d039[_0x6bd0('0x15')][_0x33a888]['channel']})[_0x6bd0('0x51')](function(_0x51532d){if(_0x51532d[_0x6bd0('0x33')]===_0x6bd0('0x52')){setTimeout(function(){if(_0x18d039[_0x6bd0('0x15')][_0x33a888]){ut[_0x6bd0('0x53')](_0x18d039[_0x6bd0('0x3b')][_0x18d039[_0x6bd0('0x15')][_0x33a888][_0x6bd0('0x49')]],_0x6bd0('0x54'));if(_0x18d039['actions'][_0x33a888]['dialAnswer']===!![]){ut['decrementTalkink'](_0x18d039[_0x6bd0('0x3b')][_0x18d039[_0x6bd0('0x15')][_0x33a888][_0x6bd0('0x49')]],_0x6bd0('0x54'));ut[_0x6bd0('0x55')](_0x6bd0('0x56')+_0x33a888,_0x18d039[_0x6bd0('0x15')][_0x33a888][_0x6bd0('0x49')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x33a888,_0x18d039[_0x6bd0('0x15')][_0x33a888][_0x6bd0('0x49')]);delete _0x18d039[_0x6bd0('0x15')][_0x33a888];}},0x2328);}});}});};Preview[_0x6bd0('0x39')][_0x6bd0('0x40')]=function(){var _0x1ae256=this;loggerAction[_0x6bd0('0x29')]('[action]',_[_0x6bd0('0x57')](this[_0x6bd0('0x15')]));for(var _0x4178a6 in this[_0x6bd0('0x15')]){if(_0x1ae256[_0x6bd0('0x15')][_0x6bd0('0x3c')](_0x4178a6)){_0x1ae256['clearZombieChannel'](_0x4178a6);}}};Preview[_0x6bd0('0x39')][_0x6bd0('0x58')]=function(_0x14be93){var _0x4f9846=this;rpcDb['getContactRecallMe'](_0x14be93['id'],ut['agentReadyId'](this[_0x6bd0('0x16')]))[_0x6bd0('0x59')](function(_0x9722d4){if(!_[_0x6bd0('0x46')](_0x9722d4)){for(var _0x1b1b32=0x0;_0x1b1b32<_0x9722d4['length'];_0x1b1b32+=0x1){if(ut[_0x6bd0('0x5a')](_0x9722d4[_0x1b1b32][_0x6bd0('0x5b')])<_0x14be93[_0x6bd0('0x5c')]*0x3c){if(_0x9722d4[_0x1b1b32]['Agent']&&!_0x9722d4[_0x1b1b32][_0x6bd0('0x5d')]['voicePause']){_0x4f9846[_0x6bd0('0x5e')](_0x9722d4[_0x1b1b32]['id'])[_0x6bd0('0x59')](ut['logger2'](_0x6bd0('0x5f')))['catch'](ut['logger2'](_0x6bd0('0x5f')));}else{rpcDb[_0x6bd0('0x60')](_0x9722d4[_0x1b1b32]['id']);}}else{var _0x1108be=new Action(_0x9722d4[_0x1b1b32],_0x14be93);_0x1108be['starttime']=moment()[_0x6bd0('0x61')](_0x6bd0('0x62'));_0x14be93[_0x6bd0('0x63')]+=0x1;ut[_0x6bd0('0x64')](_0x1108be,0x17,_0x6bd0('0x65'));if(_0x14be93[_0x6bd0('0x66')]){rpcDb[_0x6bd0('0x67')](ut[_0x6bd0('0x68')](_0x9722d4[_0x1b1b32]));rpcDb[_0x6bd0('0x69')](_0x1108be,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6bd0('0x64')](_0x1108be,0x16,_0x6bd0('0x6a'));rpcDb[_0x6bd0('0x69')](_0x1108be,'[HistoryRecallClose]');rpcDb[_0x6bd0('0x6b')](_0x1108be,_0x6bd0('0x6c'));}}}}})[_0x6bd0('0x51')](ut[_0x6bd0('0x6d')]('[getContactRecallMe]'));};Preview[_0x6bd0('0x39')]['setMessage']=function(_0x5bccfd){_0x5bccfd['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x5bccfd['loggedIn'])){_0x5bccfd[_0x6bd0('0x33')]=utils[_0x6bd0('0x37')][_0x6bd0('0x6e')];}else if(!ut['isActive'](_0x5bccfd[_0x6bd0('0x41')])){_0x5bccfd['message']=utils[_0x6bd0('0x37')][_0x6bd0('0x34')];}else if(!this[_0x6bd0('0x6f')](_0x5bccfd[_0x6bd0('0x70')])){if(!this[_0x6bd0('0x6f')](_0x5bccfd[_0x6bd0('0x71')])){_0x5bccfd[_0x6bd0('0x33')]=utils[_0x6bd0('0x37')][_0x6bd0('0x72')];}else{_0x5bccfd['message']=utils[_0x6bd0('0x37')][_0x6bd0('0x73')];}}else{_0x5bccfd[_0x6bd0('0x33')]=utils[_0x6bd0('0x37')][_0x6bd0('0x73')];}};Preview[_0x6bd0('0x39')][_0x6bd0('0x74')]=function(_0x53e31d,_0x30cf48,_0x7f4bf9){var _0x50f4ad=this;var _0x80aa51=this['actions'][_0x30cf48];var _0x39c62c=this[_0x6bd0('0x3b')][_0x80aa51['queue']];var _0x58dda4;var _0x445106=![];var _0x337080=0x2;var _0x2bc6d9=0x3;if(_0x39c62c){switch(_0x7f4bf9){case'1':_0x39c62c['outboundNoSuchCallsDay']+=0x1;_0x80aa51[_0x6bd0('0x75')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut['totalGlobal'](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x0,_0x6bd0('0x77'));ami['emit'](_0x6bd0('0x78'),ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0x7a')));rpcDb[_0x6bd0('0x69')](_0x80aa51,'[callProgressDetectingCustomer][logNoSuch]');_0x50f4ad['verifyAdditionalPhones'](_0x80aa51,'0',_0x39c62c)[_0x6bd0('0x59')](function(_0x53eb97){_0x445106=_0x53eb97[_0x6bd0('0x7b')]==0x1;_0x337080=_0x39c62c[_0x6bd0('0x7c')];_0x2bc6d9=_0x39c62c[_0x6bd0('0x7d')];if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c['dialGlobalMaxRetry']){_0x58dda4=ut[_0x6bd0('0x7f')](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb[_0x6bd0('0x6b')](_0x58dda4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x80aa51[_0x6bd0('0x75')]>=_0x39c62c[_0x6bd0('0x81')]){rpcDb[_0x6bd0('0x6b')](_0x80aa51,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x80aa51,_0x6bd0('0x75'),_0x39c62c[_0x6bd0('0x7c')]),_0x80aa51['unlockAgent'],_0x80aa51[_0x6bd0('0x82')]);}}delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];}else{_0x80aa51['countnosuchnumberretry']++;logger[_0x6bd0('0x29')](_0x6bd0('0x84'),_0x80aa51[_0x6bd0('0x75')]);logger['info']('id',_0x80aa51['idContact']);_0x50f4ad[_0x6bd0('0x85')]({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countnosuchnumberretry':_0x80aa51[_0x6bd0('0x75')]}})['then'](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case _0x6bd0('0x88'):var _0x306f0e=moment()[_0x6bd0('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x80aa51[_0x6bd0('0x89')]=_0x306f0e;_0x80aa51['answertime']=_0x306f0e;_0x80aa51[_0x6bd0('0x8a')]=!![];_0x39c62c[_0x6bd0('0x30')]+=0x1;logger[_0x6bd0('0x29')]('[syncHangup][talking][increment]',_0x80aa51[_0x6bd0('0x8b')],_0x6bd0('0x8c'),_0x39c62c[_0x6bd0('0x8d')],_0x6bd0('0x8e'),_0x39c62c[_0x6bd0('0x30')]);ami['emit'](_0x6bd0('0x8f'),ut['buildObj'](_0x80aa51,'connect',this[_0x6bd0('0x3b')][_0x80aa51['queue']]));if(_0x39c62c[_0x6bd0('0x90')]){ami[_0x6bd0('0x28')](_0x6bd0('0x91'),ut['buildAcw'](_0x80aa51));}break;case'16':ami[_0x6bd0('0x28')](_0x6bd0('0x92'),ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0x93'),this[_0x6bd0('0x3b')][_0x80aa51[_0x6bd0('0x49')]]));emitVoiceQueueChannelRemove(ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0x93')));_0x39c62c['outboundAnswerCallsDay']+=0x1;_0x39c62c[_0x6bd0('0x94')]+=0x1;_0x39c62c[_0x6bd0('0x95')]+=0x1;ut[_0x6bd0('0x96')](_0x39c62c,'[16]');_0x80aa51[_0x6bd0('0x76')]=ut['totalGlobal'](_0x80aa51);ut['logCustomer'](_0x80aa51,0x4,_0x6bd0('0x97'));rpcDb['createCustomerHistory'](_0x80aa51,_0x6bd0('0x98'));rpcDb[_0x6bd0('0x6b')](_0x80aa51,_0x6bd0('0x99'));rpcDb['crateCustomerReportQueue'](_0x80aa51);_0x39c62c['sumDuration']+=_0x80aa51[_0x6bd0('0x9a')];_0x39c62c[_0x6bd0('0x9b')]+=_0x80aa51['talktime'];logger['info']('[syncHangup][talking][decrement]',_0x80aa51[_0x6bd0('0x8b')],_0x6bd0('0x8c'),_0x39c62c[_0x6bd0('0x8d')],_0x6bd0('0x8e'),_0x39c62c[_0x6bd0('0x30')]);delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];break;case _0x6bd0('0x9c'):_0x39c62c['outboundBusyCallsDay']+=0x1;_0x80aa51[_0x6bd0('0x9d')]+=0x1;_0x80aa51['countglobal']=ut[_0x6bd0('0x7e')](_0x80aa51);ut['logCustomer'](_0x80aa51,0x5,'Busy');_0x337080=_0x39c62c[_0x6bd0('0x9e')];_0x2bc6d9=_0x39c62c[_0x6bd0('0x7d')];ami[_0x6bd0('0x28')](_0x6bd0('0x9f'),ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0xa0')));rpcDb[_0x6bd0('0x69')](_0x80aa51,'[callProgressDetectingCustomer][logBusy]');_0x50f4ad['verifyAdditionalPhones'](_0x80aa51,'5',_0x39c62c)[_0x6bd0('0x59')](function(_0x5976df){_0x445106=_0x5976df[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut[_0x6bd0('0x7f')](_0x80aa51,0xf,'Global');rpcDb[_0x6bd0('0x6b')](_0x58dda4,_0x6bd0('0xa2'));}else{if(_0x80aa51['countbusyretry']>=_0x39c62c['dialBusyMaxRetry']){rpcDb[_0x6bd0('0x6b')](_0x80aa51,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6bd0('0xa3')](ut['scheduledAt'](_0x80aa51,_0x6bd0('0x9d'),_0x39c62c[_0x6bd0('0x9e')]),_0x80aa51['unlockAgent'],_0x80aa51[_0x6bd0('0x82')]);}}}else{_0x80aa51[_0x6bd0('0x9d')]++;_0x50f4ad['incrementPreviewCounters']({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countbusyretry':_0x80aa51['countbusyretry']}})[_0x6bd0('0x59')](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case _0x6bd0('0xa4'):_0x39c62c[_0x6bd0('0xa5')]+=0x1;_0x80aa51['countnoanswerretry']+=0x1;_0x80aa51['countglobal']=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x3,'NoAnswer');_0x337080=_0x39c62c['dialNoAnswerRetryFrequency'];_0x2bc6d9=_0x39c62c['callAdditionalPhoneAfterMin'];var _0x1c3cb4=ut[_0x6bd0('0xa6')](_0x80aa51,_0x39c62c);ami[_0x6bd0('0x28')]('custom:agentnoanswer',_0x1c3cb4);rpcDb[_0x6bd0('0x69')](_0x80aa51,_0x6bd0('0xa7'));_0x50f4ad[_0x6bd0('0xa8')](_0x80aa51,'3',_0x39c62c)[_0x6bd0('0x59')](function(_0x180d0c){_0x445106=_0x180d0c[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c['dialGlobalMaxRetry']){_0x58dda4=ut['cloneAction'](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb['createCustomerFinal'](_0x58dda4,_0x6bd0('0xa9'));}else{if(_0x80aa51[_0x6bd0('0xaa')]>=_0x39c62c[_0x6bd0('0xab')]){rpcDb[_0x6bd0('0x6b')](_0x80aa51,_0x6bd0('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0x6bd0('0xac')](_0x80aa51,'countnoanswerretry',_0x39c62c['dialNoAnswerRetryFrequency']),_0x80aa51[_0x6bd0('0xad')],_0x80aa51[_0x6bd0('0x82')]);}}}else{_0x80aa51[_0x6bd0('0xaa')]++;_0x50f4ad[_0x6bd0('0x85')]({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countnoanswerretry':_0x80aa51['countnoanswerretry']}})[_0x6bd0('0x59')](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case _0x6bd0('0xae'):_0x39c62c[_0x6bd0('0xaf')]+=0x1;_0x80aa51[_0x6bd0('0xb0')]+=0x1;_0x80aa51['countglobal']=ut['totalGlobal'](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x8,_0x6bd0('0xb1'));_0x337080=_0x39c62c['dialCongestionRetryFrequency'];_0x2bc6d9=_0x39c62c[_0x6bd0('0x7d')];ami['emit'](_0x6bd0('0xb2'),ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0xb3')));rpcDb[_0x6bd0('0x69')](_0x80aa51,_0x6bd0('0xb4'));_0x50f4ad[_0x6bd0('0xa8')](_0x80aa51,'8',_0x39c62c)[_0x6bd0('0x59')](function(_0x212b95){_0x445106=_0x212b95[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut[_0x6bd0('0x7f')](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb[_0x6bd0('0x6b')](_0x58dda4,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x80aa51[_0x6bd0('0xb0')]>=_0x39c62c[_0x6bd0('0xb5')]){rpcDb[_0x6bd0('0x6b')](_0x80aa51,_0x6bd0('0xb4'));}else{rpcDb[_0x6bd0('0xa3')](ut[_0x6bd0('0xac')](_0x80aa51,_0x6bd0('0xb0'),_0x39c62c[_0x6bd0('0x9e')]),_0x80aa51[_0x6bd0('0xad')],_0x80aa51[_0x6bd0('0x82')]);}}}else{_0x80aa51['countcongestionretry']++;_0x50f4ad[_0x6bd0('0x85')]({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countcongestionretry':_0x80aa51['countcongestionretry']}})[_0x6bd0('0x59')](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case'CANCEL':_0x39c62c[_0x6bd0('0xb6')]+=0x1;_0x80aa51[_0x6bd0('0xb7')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x14,_0x6bd0('0xb8'));_0x337080=_0x39c62c[_0x6bd0('0xb9')];_0x2bc6d9=_0x39c62c[_0x6bd0('0x7d')];ami[_0x6bd0('0x28')]('custom:agentreject',ut[_0x6bd0('0x79')](_0x80aa51,'agentreject'));rpcDb[_0x6bd0('0x69')](_0x80aa51,_0x6bd0('0xba'));_0x50f4ad['verifyAdditionalPhones'](_0x80aa51,'20',_0x39c62c)[_0x6bd0('0x59')](function(_0x4d155a){_0x445106=_0x4d155a[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut['cloneAction'](_0x80aa51,0x14,_0x6bd0('0xb8'));rpcDb[_0x6bd0('0x6b')](_0x58dda4,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x80aa51[_0x6bd0('0xb7')]>=_0x39c62c[_0x6bd0('0xbb')]){rpcDb['createCustomerFinal'](_0x80aa51,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x6bd0('0xa3')](ut[_0x6bd0('0xac')](_0x80aa51,'countagentrejectretry',_0x39c62c[_0x6bd0('0xb9')]),_0x80aa51[_0x6bd0('0xad')],_0x80aa51['activeContact']);}}}else{_0x80aa51[_0x6bd0('0xaa')]++;_0x50f4ad['incrementPreviewCounters']({'id':_0x80aa51['idContact'],'field':{'countnoanswerretry':_0x80aa51['countnoanswerretry']}})[_0x6bd0('0x59')](function(){_0x50f4ad['swapAdditionalPhones'](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case _0x6bd0('0xbc'):_0x39c62c[_0x6bd0('0xbd')]+=0x1;_0x80aa51[_0x6bd0('0xbe')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0xb,_0x6bd0('0xbf'));rpcDb[_0x6bd0('0x69')](_0x80aa51,_0x6bd0('0xc0'));_0x50f4ad[_0x6bd0('0xa8')](_0x80aa51,'11',_0x39c62c)[_0x6bd0('0x59')](function(_0xd72d3c){_0x445106=_0xd72d3c['additional']==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut['cloneAction'](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb['createCustomerFinal'](_0x58dda4,_0x6bd0('0xc0'));}else{if(_0x80aa51[_0x6bd0('0xc1')]>=_0x39c62c['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x80aa51,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x6bd0('0xa3')](ut['scheduledAt'](_0x80aa51,'countabandonedretry',_0x39c62c['dialAbandonedRetryFrequency']),_0x80aa51['unlockAgent'],_0x80aa51[_0x6bd0('0x82')]);}}}else{_0x80aa51[_0x6bd0('0xaa')]++;_0x50f4ad[_0x6bd0('0x85')]({'id':_0x80aa51['idContact'],'field':{'countnoanswerretry':_0x80aa51[_0x6bd0('0xaa')]}})['then'](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});break;case'18':_0x39c62c[_0x6bd0('0xc2')]+=0x1;_0x80aa51[_0x6bd0('0xc3')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x12,_0x53e31d[_0x6bd0('0xc4')]||_0x53e31d[_0x6bd0('0xc5')]);ami[_0x6bd0('0x28')](_0x6bd0('0xc6'),ut[_0x6bd0('0x79')](_0x80aa51,_0x6bd0('0xc7')));rpcDb[_0x6bd0('0x69')](_0x80aa51,_0x6bd0('0xc8'));_0x50f4ad[_0x6bd0('0xa8')](_0x80aa51,'18',_0x39c62c)[_0x6bd0('0x59')](function(_0x46c2a5){_0x445106=_0x46c2a5['additional']==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut[_0x6bd0('0x7f')](_0x80aa51,0x12,_0x6bd0('0x80'));rpcDb['createCustomerFinal'](_0x58dda4,_0x6bd0('0xc8'));}else{rpcDb[_0x6bd0('0x6b')](_0x80aa51,_0x6bd0('0xc8'));}}else{_0x80aa51[_0x6bd0('0xaa')]++;_0x50f4ad['incrementPreviewCounters']({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countnoanswerretry':_0x80aa51[_0x6bd0('0xaa')]}})[_0x6bd0('0x59')](function(){_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)['then'](function(){});});}});delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];break;case'19':_0x39c62c[_0x6bd0('0xc2')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0x13,_0x53e31d['cause-txt']||_0x53e31d[_0x6bd0('0xc5')]);ami[_0x6bd0('0x28')]('custom:amd',ut['buildObj'](_0x80aa51,_0x6bd0('0xc7')));rpcDb['createCustomerHistory'](_0x80aa51,_0x6bd0('0xc9'));_0x50f4ad[_0x6bd0('0xa8')](_0x80aa51,'18',_0x39c62c)[_0x6bd0('0x59')](function(_0x13bb5f){_0x445106=_0x13bb5f[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c['dialGlobalMaxRetry']){_0x58dda4=ut['cloneAction'](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb[_0x6bd0('0x6b')](_0x58dda4,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x80aa51,_0x6bd0('0xc9'));}}else{_0x80aa51[_0x6bd0('0xaa')]++;_0x50f4ad[_0x6bd0('0x85')]({'id':_0x80aa51[_0x6bd0('0x86')],'field':{'countnoanswerretry':_0x80aa51[_0x6bd0('0xaa')]}})[_0x6bd0('0x59')](function(){_0x50f4ad['swapAdditionalPhones'](_0x80aa51,_0x337080,_0x2bc6d9)[_0x6bd0('0x59')](function(){});});}});delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];break;default:if(_0x80aa51[_0x6bd0('0x8a')]){ut[_0x6bd0('0x96')](_0x39c62c,_0x6bd0('0xca'));ut[_0x6bd0('0x55')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x39c62c[_0x6bd0('0x8d')],_0x53e31d);}_0x39c62c[_0x6bd0('0xc2')]+=0x1;_0x80aa51[_0x6bd0('0x76')]=ut[_0x6bd0('0x7e')](_0x80aa51);ut[_0x6bd0('0x64')](_0x80aa51,0xc,_0x53e31d[_0x6bd0('0xc4')]||_0x53e31d[_0x6bd0('0xc5')]);_0x337080=_0x39c62c[_0x6bd0('0xb9')];_0x2bc6d9=_0x39c62c[_0x6bd0('0x7d')];rpcDb[_0x6bd0('0x69')](_0x80aa51,'[callProgressDetectingCustomer][logUnknown]');_0x50f4ad['verifyAdditionalPhones'](_0x80aa51,'20',_0x39c62c)[_0x6bd0('0x59')](function(_0x4da2cd){_0x445106=_0x4da2cd[_0x6bd0('0x7b')]==0x1;if(!_0x445106){if(ut[_0x6bd0('0x7e')](_0x80aa51)>=_0x39c62c[_0x6bd0('0xa1')]){_0x58dda4=ut['cloneAction'](_0x80aa51,0xf,_0x6bd0('0x80'));rpcDb['createCustomerFinal'](_0x58dda4,_0x6bd0('0xcb'));}else{rpcDb[_0x6bd0('0x6b')](_0x80aa51,_0x6bd0('0xcb'));}delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];}else{_0x50f4ad[_0x6bd0('0x87')](_0x80aa51,_0x337080,_0x2bc6d9)['then'](function(){});}});}if(!(_0x80aa51[_0x6bd0('0x8a')]&&_0x7f4bf9==='16')){ut[_0x6bd0('0x53')](_0x39c62c,_0x6bd0('0xcc'));logger[_0x6bd0('0x29')](_0x6bd0('0xcd'),_0x80aa51[_0x6bd0('0x8b')],_0x6bd0('0x8c'),_0x39c62c[_0x6bd0('0x8d')],'originated:\x20',_0x39c62c[_0x6bd0('0x2f')]);}if(_0x7f4bf9!==_0x6bd0('0x88')){delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0x83')]];delete this[_0x6bd0('0x15')][_0x53e31d[_0x6bd0('0xce')]];}_0x39c62c[_0x6bd0('0xcf')]=!![];}};Preview[_0x6bd0('0x39')][_0x6bd0('0xd0')]=function(_0x370b0c,_0x5c9712,_0x5e0d07){if(_[_0x6bd0('0xd1')](_0x5c9712)&&_0x6bd0('0xd2')!==typeof _0x5c9712){return;}if(_[_0x6bd0('0xd1')](_0x5e0d07)&&_0x6bd0('0xd2')!==typeof _0x5e0d07){return;}switch(_0x5e0d07['reason']){case'0':ut[_0x6bd0('0xd3')](_0x370b0c,0x0,_0x6bd0('0x77'));rpcDb[_0x6bd0('0xd4')](_0x370b0c,_0x6bd0('0xd5'));break;case'3':ut[_0x6bd0('0xd3')](_0x370b0c,0x3,_0x6bd0('0xd6'));rpcDb[_0x6bd0('0xd4')](_0x370b0c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x6bd0('0xd3')](_0x370b0c,0x5,_0x6bd0('0xd7'));rpcDb[_0x6bd0('0xd4')](_0x370b0c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x6bd0('0xd3')](_0x370b0c,0x8,_0x6bd0('0xb1'));rpcDb[_0x6bd0('0xd4')](_0x370b0c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x370b0c,0x16,'AnswerAGI');rpcDb[_0x6bd0('0xd4')](_0x370b0c,_0x6bd0('0xd8'));break;default:ut[_0x6bd0('0xd3')](_0x370b0c,0xc,_0x5e0d07[_0x6bd0('0xd9')]);rpcDb[_0x6bd0('0xd4')](_0x370b0c,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x5c9712,_0x6bd0('0xda'));logger['info'](_0x6bd0('0xdb'),_0x370b0c['uniqueid'],_0x6bd0('0x8c'),_0x5c9712['name'],_0x6bd0('0x4a'),_0x5c9712[_0x6bd0('0x2f')]);delete this['actions'][_0x370b0c['uniqueid']];};Preview[_0x6bd0('0x39')][_0x6bd0('0xa8')]=function(_0x4923e0,_0x5ba34f,_0x5cda92){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4923e0,_0x5ba34f,_0x5cda92)[_0x6bd0('0x51')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x6bd0('0x39')][_0x6bd0('0x87')]=function(_0x1ecaca,_0x249a8f,_0x11e2a7){return cmHopperAdditionalPhone[_0x6bd0('0x87')](_0x1ecaca,_0x249a8f,_0x11e2a7)[_0x6bd0('0x51')](logger[_0x6bd0('0x29')](_0x6bd0('0xdc')));};Preview[_0x6bd0('0x39')][_0x6bd0('0x85')]=function(_0x15d285){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x6bd0('0x85')](_0x15d285))['catch'](logger[_0x6bd0('0x29')](_0x6bd0('0xdd')));};Preview['prototype'][_0x6bd0('0xde')]=function(_0x3d2e46,_0x709a38,_0x426bb3,_0x619b7b,_0xf809d9){var _0x440608=this;return new Promise(function(_0x7b002a,_0x37d72f){if(_[_0x6bd0('0x46')](_0x709a38)||_[_0x6bd0('0x46')](_0x709a38[_0x6bd0('0xdf')])||_['isNil'](_0x709a38['phone'])||_['isNil'](_0x709a38[_0x6bd0('0x4d')])){_0x37d72f(ut[_0x6bd0('0x33')](_0x6bd0('0xe0'),_0x619b7b,_0xf809d9));return;}var _0x50ddd8=uuid['v4']();var _0x54a27f=_0x440608[_0x6bd0('0x3b')][_0x709a38[_0x6bd0('0x48')]['name']];var _0x12c8d8=_0x426bb3?_0x440608[_0x6bd0('0x16')][_0x426bb3]['id']:undefined;_0x440608[_0x6bd0('0x15')][_0x50ddd8]=new Action(_0x709a38,_0x54a27f,_0x50ddd8,_0x426bb3,_0x12c8d8);var _0x12514d=_0x440608['actions'][_0x50ddd8];_0x12514d[_0x6bd0('0xad')]=_0x619b7b;_0x12514d['activeContact']=_0xf809d9;_0x12514d[_0x6bd0('0xe1')]=_0x426bb3;if(_['isEmpty'](_0x3d2e46)){_0x440608[_0x6bd0('0xe2')](_0x12514d,_0x54a27f,_0x709a38,_0x426bb3)['then'](function(_0x4ebfe2){logger['info'](_0x6bd0('0xe3'),_0x6bd0('0xe4')+_0x12514d['queue']+_0x6bd0('0xe5')+_0x12514d[_0x6bd0('0x86')],JSON['stringify'](_0x4ebfe2));ami['emit'](_0x6bd0('0xe6'),ut['buildObj'](_0x12514d,'called',_0x440608[_0x6bd0('0x3b')][_0x12514d['queue']]));_0x7b002a(ut[_0x6bd0('0x33')]('Calling'));})[_0x6bd0('0x51')](function(_0x2c1164){ut[_0x6bd0('0x35')](_0x6bd0('0xe7'),_0x2c1164);_0x37d72f(ut[_0x6bd0('0x33')]('Call\x20failed',_0x619b7b,_0xf809d9));});}else{_0x54a27f['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x12514d);rpcDb['createHistory'](_0x12514d,_0x6bd0('0xe8'));delete _0x440608[_0x6bd0('0x15')][_0x50ddd8];_0x37d72f(ut[_0x6bd0('0x33')](_0x6bd0('0xe9'),_0x619b7b,_0xf809d9));}});};Preview[_0x6bd0('0x39')][_0x6bd0('0x6f')]=function(_0x5dd5f8){return!_['isNil'](_0x5dd5f8)&&!_[_0x6bd0('0x46')](_0x5dd5f8[_0x6bd0('0x8d')])&&!_[_0x6bd0('0x46')](_0x5dd5f8[_0x6bd0('0xea')])&&_0x5dd5f8[_0x6bd0('0xea')]&&!_[_0x6bd0('0x46')](this[_0x6bd0('0x14')][util[_0x6bd0('0x61')](_0x6bd0('0xeb'),_0x5dd5f8[_0x6bd0('0x8d')])])&&!_[_0x6bd0('0x46')](this[_0x6bd0('0x14')][util['format']('SIP/%s',_0x5dd5f8[_0x6bd0('0x8d')])]['status'])&&(this[_0x6bd0('0x14')][util[_0x6bd0('0x61')](_0x6bd0('0xeb'),_0x5dd5f8[_0x6bd0('0x8d')])][_0x6bd0('0x50')]===_0x6bd0('0xec')||this[_0x6bd0('0x14')][util[_0x6bd0('0x61')](_0x6bd0('0xeb'),_0x5dd5f8[_0x6bd0('0x8d')])][_0x6bd0('0x50')]===_0x6bd0('0xed'));};Preview[_0x6bd0('0x39')][_0x6bd0('0x5e')]=function(_0x3c9706,_0x4bdc55){return this[_0x6bd0('0xee')](_0x3c9706,_0x4bdc55)['then'](function(_0x201abe){return _['pick'](_0x201abe,['message']);})[_0x6bd0('0x51')](function(_0x5b275b){if(_0x5b275b[_0x6bd0('0xef')]){rpcDb[_0x6bd0('0xf0')](_0x3c9706);}if(_0x5b275b['active']){rpcDb['disableContact'](_0x3c9706);}throw _[_0x6bd0('0x4b')](_0x5b275b,[_0x6bd0('0x33')]);});};Preview['prototype'][_0x6bd0('0xee')]=function(_0x2cdb5c,_0x579826){var _0x442e23=this;var _0x16504d,_0x16d3b4;return rpcDb['getContactPreview'](_0x2cdb5c)[_0x6bd0('0x59')](function(_0x1f18d4){if(!_[_0x6bd0('0x46')](_0x1f18d4[0x0])){_0x16d3b4=_0x1f18d4[0x0][_0x6bd0('0xf1')]?![]:!![];_0x16504d=_0x1f18d4[0x0][_0x6bd0('0xf1')]?!![]:![];_0x16504d=_0x579826?!![]:_0x16504d;}var _0x50db2a=_0x442e23[_0x6bd0('0xf2')](_0x1f18d4);if(_0x50db2a['isValid']){rpcDb[_0x6bd0('0xf3')](_[_0x6bd0('0x4b')](_0x1f18d4[0x0],[_0x6bd0('0x4d'),_0x6bd0('0xf4')]))[_0x6bd0('0x59')](function(_0x5317b5){_0x442e23['checkInBlack'](_0x5317b5,_0x1f18d4[0x0],_0x579826,_0x16d3b4,_0x16504d)[_0x6bd0('0x59')](function(_0x53cbf0){return _0x53cbf0;})[_0x6bd0('0x51')](function(_0x4ce680){throw _0x4ce680;});})[_0x6bd0('0x51')](function(_0x1916ab){ut['logger'](_0x6bd0('0xf5'),_0x1916ab);throw ut[_0x6bd0('0x33')]('Call\x20unsuccessful',_0x16d3b4,_0x16504d);});}else{throw ut[_0x6bd0('0x33')](_0x50db2a['message'],_0x16d3b4,_0x16504d);}})[_0x6bd0('0x51')](function(_0x511878){ut[_0x6bd0('0x35')]('[Preview][getContactPreview]',_0x511878);throw ut[_0x6bd0('0x33')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x6bd0('0x39')][_0x6bd0('0xf2')]=function(_0x12585a){if(_[_0x6bd0('0x46')](_0x12585a)||_[_0x6bd0('0xf6')](_0x12585a)||!_[_0x6bd0('0x46')](_0x12585a[0x0][_0x6bd0('0x5d')])&&_[_0x6bd0('0x46')](_0x12585a[0x0][_0x6bd0('0x5d')][_0x6bd0('0x8d')])){ut[_0x6bd0('0x35')]('[Preview][validateContact][Empty\x20Contact]',_0x12585a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1c887a=this[_0x6bd0('0x3b')][_0x12585a[0x0][_0x6bd0('0x48')]['name']];_0x1c887a[_0x6bd0('0x33')]=utils[_0x6bd0('0x37')][_0x6bd0('0x73')];if(_[_0x6bd0('0x46')](_0x1c887a)){ut['logger'](_0x6bd0('0xf7'),_0x1c887a);return{'isValid':![],'message':_0x6bd0('0xf8')};}if(!this[_0x6bd0('0x6f')](_0x1c887a[_0x6bd0('0x70')])){ut[_0x6bd0('0x35')](_0x6bd0('0xf9'),_0x6bd0('0xfa')+_0x1c887a[_0x6bd0('0x8d')]+_0x6bd0('0xfb'));if(!this[_0x6bd0('0x6f')](_0x1c887a['TrunkBackup'])){ut[_0x6bd0('0x35')](_0x6bd0('0xf9'),_0x1c887a[_0x6bd0('0x8d')]+_0x6bd0('0xfc'));return{'isValid':![],'message':_0x6bd0('0xfd')};}}if(!ut['isActive'](_0x1c887a[_0x6bd0('0x41')])){ut[_0x6bd0('0x35')](_0x6bd0('0xfe'),_0x1c887a[_0x6bd0('0x8d')]+_0x6bd0('0xff'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1c887a[_0x6bd0('0x8d')]+_0x6bd0('0xff')};}return{'isValid':!![],'message':_0x6bd0('0x100')};};Preview[_0x6bd0('0x39')][_0x6bd0('0xe2')]=function(_0x41f9b3,_0x4a8f2c,_0xbdbc13,_0x17ab69){var _0x354686=this;return new Promise(function(_0x20295c,_0x3251b3){var _0x4333ef=_0x41f9b3['uniqueid'];var _0x300873=_0x354686[_0x6bd0('0x6f')](_0x4a8f2c[_0x6bd0('0x70')])?util[_0x6bd0('0x61')](_0x6bd0('0x101'),_0x4a8f2c['Trunk']['name'],_[_0x6bd0('0x46')](_0x4a8f2c[_0x6bd0('0x102')])?'':_0x4a8f2c[_0x6bd0('0x102')][_0x6bd0('0x103')]()||'',_0x4a8f2c[_0x6bd0('0x104')]>0x0?_0xbdbc13['phone'][_0x6bd0('0x105')](_0x4a8f2c[_0x6bd0('0x104')]):_0xbdbc13[_0x6bd0('0xf4')]):util[_0x6bd0('0x61')](_0x6bd0('0x101'),_[_0x6bd0('0x46')](_0x4a8f2c[_0x6bd0('0x71')])?_0x4a8f2c[_0x6bd0('0x70')][_0x6bd0('0x8d')]:_0x4a8f2c['TrunkBackup']['name'],_[_0x6bd0('0x46')](_0x4a8f2c[_0x6bd0('0x102')])?'':_0x4a8f2c[_0x6bd0('0x102')][_0x6bd0('0x103')]()||'',_0x4a8f2c['dialCutDigit']>0x0?_0xbdbc13[_0x6bd0('0xf4')][_0x6bd0('0x105')](_0x4a8f2c[_0x6bd0('0x104')]):_0xbdbc13['phone']);var _0x25e1fd=_0x354686['isTrunkReachable'](_0x4a8f2c[_0x6bd0('0x70')])?ut[_0x6bd0('0x106')](_0x4a8f2c[_0x6bd0('0x70')][_0x6bd0('0x107')],_0x4a8f2c[_0x6bd0('0x108')],_0x4a8f2c[_0x6bd0('0x109')]>0x0?ut['getCallerIdRandom'](_0x4a8f2c[_0x6bd0('0x10a')],_0x4a8f2c[_0x6bd0('0x109')]):_0x4a8f2c[_0x6bd0('0x10a')]):ut['getCallerId'](_[_0x6bd0('0x46')](_0x4a8f2c['TrunkBackup'])?_0x4a8f2c[_0x6bd0('0x70')][_0x6bd0('0x107')]:_0x4a8f2c[_0x6bd0('0x71')]['callerid'],_0x4a8f2c[_0x6bd0('0x108')],_0x4a8f2c[_0x6bd0('0x109')]>0x0?ut['getCallerIdRandom'](_0x4a8f2c['dialOriginateCallerIdNumber'],_0x4a8f2c[_0x6bd0('0x109')]):_0x4a8f2c[_0x6bd0('0x10a')]);if(_0x25e1fd){_0x41f9b3[_0x6bd0('0x10b')]=ut[_0x6bd0('0x10c')](_0x25e1fd);_0x41f9b3[_0x6bd0('0x10d')]=ut['extractCalleridNumber'](_0x25e1fd);}var _0x4083f2=ut[_0x6bd0('0x10e')](_0x4a8f2c,_0xbdbc13,_0x300873,_0x25e1fd,_0x4333ef,_0x41f9b3);var _0x2a9ab9=utils[_0x6bd0('0x10f')](_0xbdbc13[_0x6bd0('0xdf')]);Object['assign'](_0x4083f2,_0x2a9ab9);_['merge'](_0x41f9b3,ut[_0x6bd0('0x110')](_0x4083f2));_0x41f9b3[_0x6bd0('0x111')]=moment()[_0x6bd0('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a8f2c['variables']=_0x4083f2;var _0x351f9f=ut['variablesAction'](_0x41f9b3,_0x4a8f2c,_0x4083f2,_0x41f9b3['activeContact'],_0x17ab69);return ami['Action'](_0x351f9f)[_0x6bd0('0x59')](function(_0x2d5e6f){_0x4a8f2c['originated']+=0x1;logger[_0x6bd0('0x29')](_0x6bd0('0x112'),_0x4333ef,'\x20Queue',_0x4a8f2c['name'],_0x6bd0('0x4a'),_0x4a8f2c[_0x6bd0('0x2f')]);_0x20295c(_0x2d5e6f);})[_0x6bd0('0x51')](function(_0x4e653e){ut[_0x6bd0('0xd3')](_0x41f9b3,0xe,'OriginateError');rpcDb[_0x6bd0('0xd4')](_0x41f9b3,_0x6bd0('0x113'));_0x3251b3(_0x4e653e);});});};Preview[_0x6bd0('0x39')][_0x6bd0('0x20')]=function(_0x124efd){if(this[_0x6bd0('0x15')][_0x124efd[_0x6bd0('0x83')]]){this['actions'][_0x124efd['linkedid']][_0x6bd0('0x114')]=_0x124efd[_0x6bd0('0x114')];}};Preview[_0x6bd0('0x39')][_0x6bd0('0x115')]=function(_0x5b5967){var _0x50ef48=this;var _0x40f7a2=this[_0x6bd0('0x15')][_0x5b5967['actionid']];if(_0x40f7a2){if(_0x40f7a2[_0x6bd0('0xe1')]&&this[_0x6bd0('0x16')][_0x40f7a2[_0x6bd0('0xe1')]]){ut[_0x6bd0('0x116')](_0x40f7a2,this['agents'][_0x40f7a2[_0x6bd0('0xe1')]][_0x6bd0('0x8d')],this[_0x6bd0('0x16')][_0x40f7a2[_0x6bd0('0xe1')]]['id']);}var _0x4bdcf7=_[_0x6bd0('0x117')](_0x40f7a2);_0x4bdcf7[_0x6bd0('0x89')]=moment()[_0x6bd0('0x61')](_0x6bd0('0x62'));var _0x1b4eba=_0x50ef48[_0x6bd0('0x3b')][_0x40f7a2[_0x6bd0('0x49')]];if(ut[_0x6bd0('0x118')](_0x5b5967[_0x6bd0('0x119')])){if(_0x40f7a2[_0x6bd0('0xad')]){rpcDb['unlockContact'](_0x40f7a2['idContact']);}if(_0x40f7a2[_0x6bd0('0x82')]){rpcDb[_0x6bd0('0x60')](_0x40f7a2['idContact']);}ami['emit'](_0x6bd0('0x11a'),ut[_0x6bd0('0x79')](_0x40f7a2,_0x6bd0('0x11b'),this[_0x6bd0('0x3b')][_0x40f7a2[_0x6bd0('0x49')]]));this[_0x6bd0('0xd0')](_0x4bdcf7,_0x1b4eba,_0x5b5967);}else{_0x40f7a2['starttime']=moment()[_0x6bd0('0x61')](_0x6bd0('0x62'));ut[_0x6bd0('0xd3')](_0x4bdcf7,0x4,_0x6bd0('0x97'));rpcDb['createAgentHistory'](_0x4bdcf7,_0x6bd0('0x11c'));}}};Preview[_0x6bd0('0x39')][_0x6bd0('0x1a')]=function(_0x19e9ef){var _0x46d2b8=this[_0x6bd0('0x15')][_0x19e9ef[_0x6bd0('0x83')]];var _0x165f7f;if(_0x46d2b8){_0x165f7f=this[_0x6bd0('0x3b')][_0x46d2b8[_0x6bd0('0x49')]];logger['info'](_0x6bd0('0x11d'),_0x19e9ef[_0x6bd0('0x83')],_0x6bd0('0x8c'),_0x165f7f['name'],_0x6bd0('0x8e'),_0x165f7f[_0x6bd0('0x30')]);}if(this[_0x6bd0('0x15')][_0x19e9ef[_0x6bd0('0x83')]]&&_0x19e9ef[_0x6bd0('0x83')]!==_0x19e9ef[_0x6bd0('0x8b')]){if(_0x19e9ef[_0x6bd0('0x11e')]==='16'&&this['actions'][_0x19e9ef[_0x6bd0('0x83')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x19e9ef,_0x19e9ef['linkedid'],_0x19e9ef[_0x6bd0('0x11e')]);}else if(this['actions'][_0x19e9ef[_0x6bd0('0x83')]][_0x6bd0('0x8a')]){logger[_0x6bd0('0x29')](_0x6bd0('0x11f'),_0x19e9ef[_0x6bd0('0x83')],_0x19e9ef[_0x6bd0('0x11e')],_0x6bd0('0x8c'),_0x165f7f[_0x6bd0('0x8d')],'pTalking:\x20',_0x165f7f[_0x6bd0('0x30')]);this[_0x6bd0('0x74')](_0x19e9ef,_0x19e9ef[_0x6bd0('0x83')],_0x19e9ef[_0x6bd0('0x11e')]);}}else if(_0x46d2b8&&_[_0x6bd0('0x46')](_0x46d2b8['statedesc'])&&_0x165f7f['dialQueueProject']&&_0x19e9ef[_0x6bd0('0x83')]===_0x19e9ef[_0x6bd0('0x8b')]&&_[_0x6bd0('0x46')](_0x19e9ef[_0x6bd0('0xd9')])&&_0x19e9ef[_0x6bd0('0x11e')]==='16'&&_0x19e9ef['channelstate']==='6'&&_[_0x6bd0('0xd1')](_0x46d2b8[_0x6bd0('0x120')])){if(_0x46d2b8[_0x6bd0('0xad')]){rpcDb[_0x6bd0('0xf0')](_0x46d2b8[_0x6bd0('0x86')]);}if(_0x46d2b8['activeContact']){rpcDb[_0x6bd0('0x60')](_0x46d2b8['idContact']);}_0x19e9ef[_0x6bd0('0xd9')]='22';this['callProgressDetectingAgent'](_0x46d2b8,_0x165f7f,_0x19e9ef);}else if(_0x46d2b8&&_0x46d2b8[_0x6bd0('0x120')]){if(_0x19e9ef[_0x6bd0('0x11e')]==='16'&&this[_0x6bd0('0x15')][_0x19e9ef[_0x6bd0('0x83')]][_0x6bd0('0x8a')]){logger['info'](_0x6bd0('0x121'),_0x19e9ef['linkedid'],_0x19e9ef[_0x6bd0('0x11e')],_0x6bd0('0x8c'),_0x165f7f[_0x6bd0('0x8d')],_0x6bd0('0x8e'),_0x165f7f[_0x6bd0('0x30')]);this['callProgressDetectingCustomer'](_0x19e9ef,_0x19e9ef[_0x6bd0('0x83')],_0x19e9ef[_0x6bd0('0x11e')]);}else if(this[_0x6bd0('0x15')][_0x19e9ef[_0x6bd0('0x83')]][_0x6bd0('0x8a')]){logger[_0x6bd0('0x29')]('[syncHangup][talking][cause]',_0x19e9ef[_0x6bd0('0x83')],_0x19e9ef[_0x6bd0('0x11e')],_0x6bd0('0x8c'),_0x165f7f[_0x6bd0('0x8d')],_0x6bd0('0x8e'),_0x165f7f[_0x6bd0('0x30')]);this[_0x6bd0('0x74')](_0x19e9ef,_0x19e9ef[_0x6bd0('0x83')],_0x19e9ef[_0x6bd0('0x11e')]);}}};Preview[_0x6bd0('0x39')][_0x6bd0('0x1e')]=function(_0x5e2533){if(this[_0x6bd0('0x15')][_0x5e2533['destlinkedid']]&&_0x5e2533[_0x6bd0('0xce')]!==_0x5e2533[_0x6bd0('0x122')]){this[_0x6bd0('0x74')](_0x5e2533,_0x5e2533[_0x6bd0('0xce')],_0x5e2533[_0x6bd0('0xc5')]);}};Preview[_0x6bd0('0x39')][_0x6bd0('0x1c')]=function(_0x28ca04){if(this[_0x6bd0('0x15')][_0x28ca04[_0x6bd0('0x83')]]&&_0x28ca04[_0x6bd0('0x83')]!==_0x28ca04[_0x6bd0('0x8b')]&&!this[_0x6bd0('0x15')][_0x28ca04[_0x6bd0('0x83')]][_0x6bd0('0x8a')]){if(_0x28ca04[_0x6bd0('0x11e')]==='1'){this[_0x6bd0('0x74')](_0x28ca04,_0x28ca04[_0x6bd0('0x83')],_0x28ca04[_0x6bd0('0x11e')]);}}};Preview['prototype'][_0x6bd0('0x123')]=function(_0x3d41eb,_0x4dd9ca,_0x5b3f81){if(this['actions'][_0x3d41eb]){if(_[_0x6bd0('0x46')](this[_0x6bd0('0x15')][_0x3d41eb][_0x6bd0('0x124')])){this[_0x6bd0('0x15')][_0x3d41eb]['variables']={};}this['actions'][_0x3d41eb]['variables'][_0x4dd9ca]=_0x5b3f81;}};Preview[_0x6bd0('0x39')][_0x6bd0('0x22')]=function(_0x1c03cc){try{if(!_['isNil'](_0x1c03cc)){if(ut[_0x6bd0('0x125')](_[_0x6bd0('0x126')](_0x1c03cc[_0x6bd0('0x127')])[0x0])){this[_0x6bd0('0x123')](_0x1c03cc[_0x6bd0('0x8b')],_[_0x6bd0('0x126')](_0x1c03cc[_0x6bd0('0x127')])[0x0],_0x1c03cc['value']);}}}catch(_0x14bebc){logger[_0x6bd0('0x128')](_0x6bd0('0x129'),util[_0x6bd0('0x12a')](_0x14bebc,{'showHidden':![],'depth':null}));}};Preview[_0x6bd0('0x39')][_0x6bd0('0x24')]=function(_0x49305a){if(_0x49305a){if(this['actions'][_0x49305a[_0x6bd0('0x12b')]]){this[_0x6bd0('0x15')][_0x49305a[_0x6bd0('0x12b')]][_0x6bd0('0x120')]=!![];}}};Preview[_0x6bd0('0x39')][_0x6bd0('0x26')]=function(_0x3abaca){if(_0x3abaca){if(this[_0x6bd0('0x15')][_0x3abaca[_0x6bd0('0x12c')]]){this[_0x6bd0('0x15')][_0x3abaca[_0x6bd0('0x12c')]][_0x6bd0('0x120')]=!![];}}};module[_0x6bd0('0x12d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 76e3acf..4d01268 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 _0x5340=['context','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername'];(function(_0x3bd99a,_0x200ade){var _0x135998=function(_0x446964){while(--_0x446964){_0x3bd99a['push'](_0x3bd99a['shift']());}};_0x135998(++_0x200ade);}(_0x5340,0x69));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0534('0x0'));var BPromise=require(_0x0534('0x1'));var logger=require(_0x0534('0x2'))('preview');var cmHopper=require(_0x0534('0x3'));var cmHopperHistory=require(_0x0534('0x4'));var cmHopperBlack=require(_0x0534('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0534('0x6'));function loggerCatch(_0x13b0e5){return function(_0x56ac91){logger[_0x0534('0x7')](_0x13b0e5,util[_0x0534('0x8')](_0x56ac91,{'showHidden':![],'depth':null}));};}function create(_0x32f2a2){return cmHopperHistory[_0x0534('0x9')](_0x32f2a2)['catch'](loggerCatch(_0x0534('0xa')));}function createAgent(_0x554597){return BPromise[_0x0534('0xb')]()[_0x0534('0xc')](agentReportPreview[_0x0534('0x9')](_0x554597))['catch'](loggerCatch(_0x0534('0xa')));}function moveContact(_0x4223ee){return cmHopper[_0x0534('0xd')](_0x4223ee,!![])[_0x0534('0xe')](loggerCatch(_0x0534('0xf')));}exports[_0x0534('0x10')]=function(_0x2ef23c){return cmHopperBlack['checkIsBlackList'](_0x2ef23c)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x0534('0x11')]=function(_0x26a82b){return BPromise['resolve']()[_0x0534('0xc')](cmHopper['getContactPreview'](_0x26a82b))[_0x0534('0xe')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x700ad2,_0x4076dd){create(_0x700ad2)[_0x0534('0xe')](loggerCatch(_0x4076dd));moveContact(_0x700ad2)[_0x0534('0xe')](loggerCatch(_0x4076dd));};exports[_0x0534('0x12')]=function(_0x28c6a4,_0x56721a){createAgent(_0x28c6a4)[_0x0534('0xe')](loggerCatch(_0x56721a));};exports['createCustomerHistory']=function(_0x4130c3,_0x265bd1){create(_0x4130c3)[_0x0534('0xe')](loggerCatch(_0x265bd1));};exports['createCustomerFinal']=function(_0x514cc7,_0x254d25){moveContact(_0x514cc7)[_0x0534('0xe')](loggerCatch(_0x254d25));};exports[_0x0534('0x13')]=function(_0x58bedc,_0x2a657d,_0x19522f){if(_0x2a657d){_0x58bedc[_0x0534('0x14')]=null;}if(_0x19522f){_0x58bedc['active']=![];}return cmHopper[_0x0534('0x13')](_0x58bedc)[_0x0534('0xe')](loggerCatch(_0x0534('0x15')));};exports[_0x0534('0x16')]=function(_0x4c9da6){return cmHopper[_0x0534('0x16')](_0x4c9da6)[_0x0534('0xe')](loggerCatch(_0x0534('0x17')));};exports[_0x0534('0x18')]=function(_0x2de81a){return cmHopper[_0x0534('0x18')]({'UserId':null},_0x2de81a,0x1)[_0x0534('0xe')](loggerCatch(_0x0534('0x19')));};exports['disableContact']=function(_0x24fbd2){return cmHopper['unlockContact']({'active':![]},_0x24fbd2,0x1)['catch'](loggerCatch(_0x0534('0x1a')));};exports[_0x0534('0x1b')]=function(_0xfb718c){var _0x4de9ef={};_0x4de9ef[_0x0534('0x1c')]=_0xfb718c[_0x0534('0x1c')];_0x4de9ef['uniqueid']=_0xfb718c['uniqueid'];_0x4de9ef[_0x0534('0x1d')]=_0xfb718c['calleridnum'];_0x4de9ef[_0x0534('0x1e')]=_0xfb718c[_0x0534('0x1e')];_0x4de9ef[_0x0534('0x1f')]=_0xfb718c[_0x0534('0x1f')];_0x4de9ef['queuecallerjoinAt']=_0xfb718c[_0x0534('0x20')];_0x4de9ef[_0x0534('0x21')]=_0xfb718c[_0x0534('0x20')];_0x4de9ef[_0x0534('0x22')]=0x1;_0x4de9ef[_0x0534('0x23')]=_0xfb718c[_0x0534('0x24')];_0x4de9ef[_0x0534('0x25')]=_0xfb718c[_0x0534('0x26')];_0x4de9ef[_0x0534('0x27')]='from-sip';_0x4de9ef['exten']='xcally-motion-preview';_0x4de9ef['holdtime']=0x0;_0x4de9ef[_0x0534('0x28')]=0x1;_0x4de9ef[_0x0534('0x29')]=_0xfb718c[_0x0534('0x26')];_0x4de9ef[_0x0534('0x2a')]='COMPLETED';return BPromise[_0x0534('0xb')]()[_0x0534('0xc')](voiceQueueReport['create'](_0x4de9ef))[_0x0534('0xe')](loggerCatch(_0x0534('0x2b')));};exports[_0x0534('0x2c')]=function(_0x48c841,_0x43f89a){return BPromise['resolve']()[_0x0534('0xc')](cmHopper[_0x0534('0x2c')](_0x48c841,_0x43f89a))['catch'](loggerCatch(_0x0534('0x2d')));};exports[_0x0534('0x2e')]=function(_0x59aeaa){return cmHopper[_0x0534('0x13')](_0x59aeaa,!![],!![])['catch'](loggerCatch(_0x0534('0x2f')));}; \ No newline at end of file +var _0x6ee5=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','createAgentHistory','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20'];(function(_0x15079e,_0x1d8bee){var _0x554416=function(_0x440f76){while(--_0x440f76){_0x15079e['push'](_0x15079e['shift']());}};_0x554416(++_0x1d8bee);}(_0x6ee5,0x14c));var _0x56ee=function(_0x57bf95,_0x131d28){_0x57bf95=_0x57bf95-0x0;var _0x4580a2=_0x6ee5[_0x57bf95];return _0x4580a2;};'use strict';var util=require(_0x56ee('0x0'));var BPromise=require('bluebird');var logger=require(_0x56ee('0x1'))('preview');var cmHopper=require(_0x56ee('0x2'));var cmHopperHistory=require(_0x56ee('0x3'));var cmHopperBlack=require(_0x56ee('0x4'));var agentReportPreview=require(_0x56ee('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2c6f7a){return function(_0x170ef7){logger['error'](_0x2c6f7a,util['inspect'](_0x170ef7,{'showHidden':![],'depth':null}));};}function create(_0x403790){return cmHopperHistory[_0x56ee('0x6')](_0x403790)[_0x56ee('0x7')](loggerCatch(_0x56ee('0x8')));}function createAgent(_0x1a2897){return BPromise[_0x56ee('0x9')]()['then'](agentReportPreview[_0x56ee('0x6')](_0x1a2897))[_0x56ee('0x7')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4c44de){return cmHopper[_0x56ee('0xa')](_0x4c44de,!![])[_0x56ee('0x7')](loggerCatch(_0x56ee('0xb')));}exports[_0x56ee('0xc')]=function(_0x2b676b){return cmHopperBlack['checkIsBlackList'](_0x2b676b)[_0x56ee('0x7')](loggerCatch(_0x56ee('0xd')));};exports[_0x56ee('0xe')]=function(_0xa25378){return BPromise[_0x56ee('0x9')]()[_0x56ee('0xf')](cmHopper[_0x56ee('0xe')](_0xa25378))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x56ee('0x6')]=function(_0xc6adef,_0x144559){create(_0xc6adef)['catch'](loggerCatch(_0x144559));moveContact(_0xc6adef)['catch'](loggerCatch(_0x144559));};exports[_0x56ee('0x10')]=function(_0x14f083,_0x21bce6){createAgent(_0x14f083)[_0x56ee('0x7')](loggerCatch(_0x21bce6));};exports[_0x56ee('0x11')]=function(_0xe65494,_0xfef58f){create(_0xe65494)[_0x56ee('0x7')](loggerCatch(_0xfef58f));};exports['createCustomerFinal']=function(_0x5bba6d,_0x528762){moveContact(_0x5bba6d)[_0x56ee('0x7')](loggerCatch(_0x528762));};exports[_0x56ee('0x12')]=function(_0x10fcc8,_0x34a93a,_0x3e84e2){if(_0x34a93a){_0x10fcc8['UserId']=null;}if(_0x3e84e2){_0x10fcc8['active']=![];}return cmHopper[_0x56ee('0x12')](_0x10fcc8)[_0x56ee('0x7')](loggerCatch(_0x56ee('0x13')));};exports['countReScheduled']=function(_0x35fa23){return cmHopper[_0x56ee('0x14')](_0x35fa23)[_0x56ee('0x7')](loggerCatch(_0x56ee('0x15')));};exports[_0x56ee('0x16')]=function(_0x3077e8){return cmHopper[_0x56ee('0x16')]({'UserId':null},_0x3077e8,0x1)[_0x56ee('0x7')](loggerCatch(_0x56ee('0x17')));};exports['disableContact']=function(_0x2b644e){return cmHopper[_0x56ee('0x16')]({'active':![]},_0x2b644e,0x1)[_0x56ee('0x7')](loggerCatch(_0x56ee('0x18')));};exports['crateCustomerReportQueue']=function(_0x4c6bd6){var _0x648c82={};_0x648c82[_0x56ee('0x19')]=_0x4c6bd6[_0x56ee('0x19')];_0x648c82[_0x56ee('0x1a')]=_0x4c6bd6[_0x56ee('0x1a')];_0x648c82['calleridnum']=_0x4c6bd6[_0x56ee('0x1b')];_0x648c82[_0x56ee('0x1c')]=_0x4c6bd6['calleridname'];_0x648c82[_0x56ee('0x1d')]=_0x4c6bd6[_0x56ee('0x1d')];_0x648c82[_0x56ee('0x1e')]=_0x4c6bd6[_0x56ee('0x1f')];_0x648c82['queuecallerleaveAt']=_0x4c6bd6[_0x56ee('0x1f')];_0x648c82[_0x56ee('0x20')]=0x1;_0x648c82[_0x56ee('0x21')]=_0x4c6bd6[_0x56ee('0x22')];_0x648c82[_0x56ee('0x23')]=_0x4c6bd6[_0x56ee('0x24')];_0x648c82['context']=_0x56ee('0x25');_0x648c82[_0x56ee('0x26')]=_0x56ee('0x27');_0x648c82['holdtime']=0x0;_0x648c82['assigned']=0x1;_0x648c82[_0x56ee('0x28')]=_0x4c6bd6['membername'];_0x648c82[_0x56ee('0x29')]=_0x56ee('0x2a');return BPromise[_0x56ee('0x9')]()[_0x56ee('0xf')](voiceQueueReport['create'](_0x648c82))['catch'](loggerCatch(_0x56ee('0x2b')));};exports[_0x56ee('0x2c')]=function(_0x26feff,_0xa1bf9){return BPromise[_0x56ee('0x9')]()[_0x56ee('0xf')](cmHopper['getContactRecallMe'](_0x26feff,_0xa1bf9))['catch'](loggerCatch(_0x56ee('0x2d')));};exports[_0x56ee('0x2e')]=function(_0x2533be){return cmHopper[_0x56ee('0x12')](_0x2533be,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 0b00364..84eb066 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 _0x08e2=['dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','updateOriginated','originated','logBlacklist','state','statedesc','Blacklist','endtime','logAgent','responsetime','ringtime','getSeconds','logLookAgent','membername','YYYY-MM-DD\x20HH:mm:ss','starttime','talktime','answertime','isFailure','RECALL','BOOKED','xcally-motion-preview','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','channelAgent','voice','mandatoryDisposition','buildAcw','not_inuse','status','push','milliseconds','diff','createBody','CampaignId','idContact','type','dialAnswer','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','pow','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','loggerError','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE'];(function(_0x3447eb,_0x28cb0f){var _0x7a9099=function(_0x242528){while(--_0x242528){_0x3447eb['push'](_0x3447eb['shift']());}};_0x7a9099(++_0x28cb0f);}(_0x08e2,0xe6));var _0x208e=function(_0x3143a4,_0x3de938){_0x3143a4=_0x3143a4-0x0;var _0x574a04=_0x08e2[_0x3143a4];return _0x574a04;};'use strict';var util=require(_0x208e('0x0'));var _=require(_0x208e('0x1'));var moment=require(_0x208e('0x2'));var logger=require(_0x208e('0x3'))('preview');var ipAgi=process[_0x208e('0x4')][_0x208e('0x5')]||_0x208e('0x6');var utils=require(_0x208e('0x7'));exports[_0x208e('0x8')]=function(_0x2d4a0d){return function(_0x5e7a8d){logger[_0x208e('0x9')](_0x2d4a0d,util[_0x208e('0xa')](_0x5e7a8d,{'showHidden':![],'depth':null}));};};exports[_0x208e('0xb')]=function(_0x48e76f,_0x108db8){logger['info'](_0x48e76f,util[_0x208e('0xa')](_0x108db8,{'showHidden':![],'depth':null}));};exports[_0x208e('0xc')]=function(_0x56274f,_0x324e11){logger[_0x208e('0x9')](_0x56274f,util['inspect'](_0x324e11,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4862b2){return function(_0x36f80c){logger[_0x208e('0xd')](_0x4862b2,util['inspect'](_0x36f80c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x42b395,_0x3b44a2,_0x4fcd13){return{'message':_0x42b395,'unlock':_0x3b44a2,'active':_0x4fcd13};};exports[_0x208e('0xe')]=function(_0x50c012,_0x4edc4e,_0x4c2614){if(!_[_0x208e('0xf')](_0x4c2614)&&_0x208e('0x10')===typeof _0x4c2614&&!_[_0x208e('0x11')](_0x4c2614)){if(!_[_0x208e('0xf')](_0x4edc4e)&&'string'===typeof _0x4edc4e&&!_['isEmpty'](_0x4edc4e)){return util[_0x208e('0x12')](_0x208e('0x13'),_0x4edc4e,_0x4c2614);}return util[_0x208e('0x12')]('\x22%s\x22\x20<%s>',_0x4c2614,_0x4c2614);}if(!_[_0x208e('0xf')](_0x50c012)&&'string'===typeof _0x50c012&&!_[_0x208e('0x11')](_0x50c012)){return _0x50c012;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x59f4d3){if(_[_0x208e('0x14')](_0x59f4d3)){return![];}return _0x59f4d3;};exports[_0x208e('0x15')]=function(_0x1d9452,_0x4a75d3,_0x2dc934,_0x18afd3,_0x3f598a,_0x55f14e){var _0x21b1c4={'XMD-QUEUE':_0x4a75d3[_0x208e('0x16')]?_0x4a75d3[_0x208e('0x16')]['name']:'','XMD-CALLERID':_0x18afd3,'XMD-CALLERID-PREVIEW':_0x55f14e?util[_0x208e('0x12')](_0x208e('0x13'),_0x55f14e[_0x208e('0x17')],_0x55f14e[_0x208e('0x18')]):_0x18afd3,'XMD-DIALID':_0x3f598a,'XMD-CONTACTID':_0x4a75d3[_0x208e('0x19')],'XMD-CDRTYPE':_0x208e('0x1a'),'CALLERID(all)':_0x18afd3,'XMD-VOICEQUEUEID':_0x4a75d3[_0x208e('0x1b')],'XMD-DIALCHANNEL':_0x2dc934,'XMD-DIALTIMEOUT':_0x1d9452[_0x208e('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x208e('0x12')](_0x208e('0x1d'),_0x1d9452['dialQueueProject2']?'g':'',_[_0x208e('0x11')](_0x1d9452[_0x208e('0x1e')])?'':_0x208e('0x1f')),'XMD-DIALURL':_0x1d9452[_0x208e('0x20')]||'','XMD-AGI':_0x1d9452[_0x208e('0x21')]?util[_0x208e('0x12')](_0x208e('0x22'),ipAgi,_0x1d9452[_0x208e('0x21')]):_0x208e('0x23'),'XMD-AGIAFTER':_0x1d9452['dialQueueProject2']?util['format'](_0x208e('0x22'),ipAgi,_0x1d9452[_0x208e('0x24')]):_0x208e('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x55f14e?_0x55f14e[_0x208e('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x55f14e?_0x55f14e[_0x208e('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x1d9452[_0x208e('0x1e')])){_0x21b1c4[util['format']('%s',_0x208e('0x27'))]=_0x1d9452[_0x208e('0x1e')];_0x21b1c4[util['format']('%s',_0x208e('0x28'))]=_0x3f598a;}return _0x21b1c4;};exports['toLowerVariables']=function(_0x30e179){var _0x424e5e={};for(var _0x32ba01 in _0x30e179){if(_0x30e179[_0x208e('0x29')](_0x32ba01)){_0x424e5e[util[_0x208e('0x12')]('%s',_['toLower'](_0x32ba01))]=_0x30e179[_0x32ba01];}}return{'variables':_0x424e5e};};exports[_0x208e('0x2a')]=function(_0x1c0461,_0x1a7ff1){if(!_[_0x208e('0x14')](_0x1c0461)){if(_0x1c0461[_0x208e('0x29')](_0x208e('0x2b'))){if(_0x1c0461['originated']>0x0){_0x1c0461[_0x208e('0x2b')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1a7ff1);}}}else{logger[_0x208e('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1a7ff1);}};exports[_0x208e('0x2c')]=function(_0x43982f){var _0x426f2f=moment()[_0x208e('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x43982f[_0x208e('0x2d')]=0xd;_0x43982f[_0x208e('0x2e')]=_0x208e('0x2f');_0x43982f['starttime']=_0x426f2f;_0x43982f['responsetime']=_0x426f2f;_0x43982f[_0x208e('0x30')]=_0x426f2f;};exports[_0x208e('0x31')]=function(_0x129788,_0x4c97e5,_0x389075){var _0x47b1bf=moment()[_0x208e('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x129788['state']=_0x4c97e5;_0x129788[_0x208e('0x2e')]=_0x389075;_0x129788[_0x208e('0x32')]=_0x47b1bf;_0x129788[_0x208e('0x33')]=utils[_0x208e('0x34')](_0x129788[_0x208e('0x32')],_0x129788['starttime']);};exports[_0x208e('0x35')]=function(_0x13cf94,_0x47ed7d,_0x466e37){_0x13cf94[_0x208e('0x36')]=_0x47ed7d;_0x13cf94['UserId']=_0x466e37;};exports['logCustomer']=function(_0xd29731,_0x44dac4,_0x1a14e5){var _0x1cce2d=moment()[_0x208e('0x12')](_0x208e('0x37'));_0xd29731[_0x208e('0x2d')]=_0x44dac4;_0xd29731[_0x208e('0x2e')]=_0x1a14e5;_0xd29731[_0x208e('0x32')]=_0xd29731['responsetime']?_0xd29731[_0x208e('0x32')]:_0x1cce2d;_0xd29731[_0x208e('0x30')]=_0xd29731[_0x208e('0x30')]?_0xd29731[_0x208e('0x30')]:_0x1cce2d;_0xd29731['ringtime']=utils[_0x208e('0x34')](_0xd29731[_0x208e('0x32')]||0x0,_0xd29731[_0x208e('0x38')]||0x0);_0xd29731[_0x208e('0x39')]=_0xd29731['answertime']?utils[_0x208e('0x34')](_0xd29731[_0x208e('0x30')],_0xd29731[_0x208e('0x3a')]):0x0;};exports[_0x208e('0x3b')]=function(_0x4c443f){return _0x4c443f==='Failure';};exports['variablesAction']=function(_0x40509e,_0x206bfb,_0x2e04fc,_0xd53afa,_0x4eb473){var _0x4251fd=_0xd53afa?_0x208e('0x3c'):_0x40509e[_0x208e('0x17')];_0x4251fd=_0x4eb473?_0x208e('0x3d'):_0x4251fd;return{'actionid':_0x40509e['uniqueid'],'action':'originate','channel':_0x40509e['channelAgent'],'callerid':util['format'](_0x208e('0x13'),_0x4251fd,_0x40509e[_0x208e('0x18')]),'Exten':_0x208e('0x3e'),'Context':_0x208e('0x3f'),'Priority':'1','variable':_0x2e04fc,'timeout':(_0x206bfb[_0x208e('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40509e[_0x208e('0x41')]};};exports[_0x208e('0x42')]=function(_0x52af92){return _0x52af92['countbusyretry']+_0x52af92[_0x208e('0x43')]+_0x52af92[_0x208e('0x44')]+_0x52af92['countagentrejectretry']+_0x52af92[_0x208e('0x45')];};exports['cloneAction']=function(_0x2d818b){var _0x492105=_[_0x208e('0x46')](_0x2d818b);_0x492105[_0x208e('0x2d')]=0xf;_0x492105['statedesc']=_0x208e('0x47');return _0x492105;};exports[_0x208e('0x48')]=function(_0x2c2974,_0x327bba,_0x357e75){var _0x493f0c={};_0x493f0c[_0x327bba]=_0x2c2974[_0x327bba];_0x493f0c[_0x208e('0x49')]=![];_0x493f0c['scheduledat']=moment()[_0x208e('0x4a')](_0x357e75,_0x208e('0x4b'))[_0x208e('0x12')](_0x208e('0x37'));_0x493f0c[_0x208e('0x19')]=_0x2c2974[_0x208e('0x19')];_0x493f0c[_0x208e('0x4c')]=_0x2c2974[_0x208e('0x4c')];_0x493f0c[_0x208e('0x1b')]=_0x2c2974[_0x208e('0x1b')]||undefined;return _0x493f0c;};exports['decrementTalkink']=function(_0x43c178,_0x1ad053){if(!_[_0x208e('0x14')](_0x43c178)){if(_0x43c178[_0x208e('0x4d')]>0x0){_0x43c178['pTalking']-=0x1;}else{logger[_0x208e('0x9')](_0x1ad053,_0x208e('0x4e'));}}else{logger[_0x208e('0x9')](_0x1ad053,_0x208e('0x4f'));}};exports[_0x208e('0x50')]=function(_0x2e036c){if(_0x2e036c<=0x0){return!![];}return![];};function buildObj(_0x424918,_0x33eb46,_0x5f13f2){_0x424918[_0x208e('0x51')]=_0x33eb46;_0x424918[_0x208e('0x52')]=_0x424918[_0x208e('0x53')];_0x424918['interface']=_0x424918[_0x208e('0x54')];_0x424918['motionChannel']=_0x208e('0x55');if(_0x5f13f2){_0x424918[_0x208e('0x56')]=_0x5f13f2['mandatoryDisposition'];}return _0x424918;}exports['buildObj']=buildObj;exports[_0x208e('0x57')]=function(_0x594fe0){var _0x302cec={};_0x302cec[_0x208e('0x53')]=_0x594fe0[_0x208e('0x53')];_0x302cec['interface']=_0x594fe0[_0x208e('0x54')];_0x302cec['uniqueid']=_0x594fe0['uniqueid'];return _0x302cec;};exports['agentReadyId']=function(_0x3a448c){var _0x40c665=[];for(var _0x332cff in _0x3a448c){if(_0x3a448c[_0x208e('0x29')](_0x332cff)){if(!_[_0x208e('0x14')](_0x3a448c[_0x332cff])&&_0x3a448c[_0x332cff][_0x208e('0x2d')]===_0x208e('0x58')&&_0x3a448c[_0x332cff][_0x208e('0x59')]==='reachable'){_0x40c665[_0x208e('0x5a')](_0x3a448c[_0x332cff]['id']);}}}return _0x40c665;};exports['getDiff']=function(_0x3bb2c9){var _0x3699e8=moment()['milliseconds'](0x0);var _0x342c08=moment(_0x3bb2c9)[_0x208e('0x5b')](0x0);return _0x3699e8[_0x208e('0x5c')](_0x342c08,'seconds');};exports[_0x208e('0x5d')]=function(_0x4b68d3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b68d3[_0x208e('0x19')],'ListId':_0x4b68d3['ListId'],'VoiceQueueId':_0x4b68d3[_0x208e('0x1b')]||undefined,'CampaignId':_0x4b68d3[_0x208e('0x5e')]||undefined};};exports['filterKey']=function(_0x23d774){if(_0x23d774==='uniqueid'||_0x23d774===_0x208e('0x5f')||_0x23d774==='queue'||_0x23d774===_0x208e('0x60')||_0x23d774==='campaigntype'||_0x23d774===_0x208e('0x61')||_0x23d774==='membername'||_0x23d774==='channelAgent'||_0x23d774===_0x208e('0x17')||_0x23d774===_0x208e('0x49')||_0x23d774===_0x208e('0x18')||_0x23d774==='scheduledat'||_0x23d774===_0x208e('0x62')||_0x23d774===_0x208e('0x43')||_0x23d774===_0x208e('0x44')||_0x23d774===_0x208e('0x63')||_0x23d774===_0x208e('0x64')||_0x23d774===_0x208e('0x65')||_0x23d774===_0x208e('0x66')||_0x23d774===_0x208e('0x67')||_0x23d774===_0x208e('0x19')||_0x23d774===_0x208e('0x4c')||_0x23d774==='UserId'||_0x23d774===_0x208e('0x1b')||_0x23d774===_0x208e('0x68')||_0x23d774===_0x208e('0x69')||_0x23d774===_0x208e('0x6a')||_0x23d774==='xmd-phone'||_0x23d774==='xmd-listid'||_0x23d774==='xmd-dialurl'||_0x23d774===_0x208e('0x6b')||_0x23d774===_0x208e('0x6c')||_0x23d774===_0x208e('0x6d')||_0x23d774===_0x208e('0x6e')||_0x23d774===_0x208e('0x6f')||_0x23d774===_0x208e('0x70')||_0x23d774===_0x208e('0x71')||_0x23d774===_0x208e('0x72')||_0x23d774==='xmd-agi'||_0x23d774===_0x208e('0x73')||_0x23d774===_0x208e('0x74')||_0x23d774==='rtpaudioqosjitter'||_0x23d774==='rtpaudioqosjitterbridged'||_0x23d774==='rtpaudioqosloss'||_0x23d774===_0x208e('0x75')||_0x23d774===_0x208e('0x76')||_0x23d774===_0x208e('0x77')||_0x23d774==='rtpaudioqos'||_0x23d774===_0x208e('0x74')||_0x23d774==='rtpaudioqosjitter'||_0x23d774===_0x208e('0x78')||_0x23d774===_0x208e('0x79')||_0x23d774===_0x208e('0x75')||_0x23d774===_0x208e('0x76')||_0x23d774==='rtpaudioqosrttbridged'||_0x23d774===_0x208e('0x7a')||_0x23d774===_0x208e('0x7b')||_0x23d774===_0x208e('0x2d')||_0x23d774===_0x208e('0x2e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x573f97,_0x168238){var _0x18b6eb,_0x1b985b,_0x59a0d3;if(_0x168238<=0x0){_0x168238=0x1;}_0x18b6eb=new RegExp('\x5cw{0,'+_0x168238+'}$');_0x1b985b=Math[_0x208e('0x7c')](0xa,_0x168238-0x1);_0x59a0d3=Math[_0x208e('0x7c')](0xa,_0x168238)-0x1;return util[_0x208e('0x12')]('%s',_['replace'](_0x573f97,_0x18b6eb,_[_0x208e('0x7d')](_0x1b985b,_0x59a0d3)));};exports[_0x208e('0x7e')]=function(_0x4c1c73){var _0x3cb8a0=_0x4c1c73['match'](/"(.*?)"/);return _0x3cb8a0?_0x3cb8a0[0x1]:_0x4c1c73;};exports[_0x208e('0x7f')]=function(_0x1cc886){var _0x21bc55=_0x1cc886[_0x208e('0x80')](/<(.*?)>/);return _0x21bc55?_0x21bc55[0x1]:_0x1cc886;};function buildNoAnswerEventPayload(_0x41528f,_0x4d97cc){var _0x3dd4b8=buildObj(_0x41528f,_0x208e('0x81'));if(!_[_0x208e('0x11')](_0x4d97cc[_0x208e('0x82')])){Object[_0x208e('0x83')](_0x4d97cc['variables'])['forEach'](function(_0x29e461){_0x3dd4b8[_0x29e461['toLowerCase']()]=_0x4d97cc[_0x208e('0x82')][_0x29e461];});}return _0x3dd4b8;}exports[_0x208e('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x27a9=['127.0.0.1','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','responsetime','talktime','answertime','isFailure','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','motionChannel','voice','buildObj','buildAcw','queue','interface','isNil','status','reachable','push','milliseconds','diff','createBody','CampaignId','filterKey','type','dialAnswer','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','util','lodash','../../../../config/logger','preview','env'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x27a9,0x88));var _0x927a=function(_0x3a98d1,_0xb8ce30){_0x3a98d1=_0x3a98d1-0x0;var _0x32b33b=_0x27a9[_0x3a98d1];return _0x32b33b;};'use strict';var util=require(_0x927a('0x0'));var _=require(_0x927a('0x1'));var moment=require('moment');var logger=require(_0x927a('0x2'))(_0x927a('0x3'));var ipAgi=process[_0x927a('0x4')]['XCALLY_IP_AGI']||_0x927a('0x5');var utils=require('../../dialer/utils');exports[_0x927a('0x6')]=function(_0x5966e1){return function(_0x3e4e40){logger[_0x927a('0x7')](_0x5966e1,util[_0x927a('0x8')](_0x3e4e40,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x467150,_0x1039a4){logger[_0x927a('0x9')](_0x467150,util[_0x927a('0x8')](_0x1039a4,{'showHidden':![],'depth':null}));};exports[_0x927a('0xa')]=function(_0x16ccfc,_0x5d21b6){logger[_0x927a('0x7')](_0x16ccfc,util[_0x927a('0x8')](_0x5d21b6,{'showHidden':![],'depth':null}));};exports[_0x927a('0xb')]=function(_0xc8f874){return function(_0x533e09){logger[_0x927a('0x9')](_0xc8f874,util['inspect'](_0x533e09,{'showHidden':![],'depth':null}));};};exports[_0x927a('0xc')]=function(_0x486a7e,_0x373acd,_0x4dc6e0){return{'message':_0x486a7e,'unlock':_0x373acd,'active':_0x4dc6e0};};exports[_0x927a('0xd')]=function(_0x24a9ba,_0x1a1f47,_0x26041d){if(!_[_0x927a('0xe')](_0x26041d)&&_0x927a('0xf')===typeof _0x26041d&&!_['isEmpty'](_0x26041d)){if(!_[_0x927a('0xe')](_0x1a1f47)&&'string'===typeof _0x1a1f47&&!_['isEmpty'](_0x1a1f47)){return util[_0x927a('0x10')](_0x927a('0x11'),_0x1a1f47,_0x26041d);}return util[_0x927a('0x10')]('\x22%s\x22\x20<%s>',_0x26041d,_0x26041d);}if(!_['isUndefined'](_0x24a9ba)&&'string'===typeof _0x24a9ba&&!_[_0x927a('0x12')](_0x24a9ba)){return _0x24a9ba;}return _0x927a('0x13');};exports[_0x927a('0x14')]=function(_0x5f422d){if(_['isNil'](_0x5f422d)){return![];}return _0x5f422d;};exports[_0x927a('0x15')]=function(_0x454134,_0x320b2a,_0x5d01d3,_0x4131b1,_0x10ce78,_0x164638){var _0x15b259={'XMD-QUEUE':_0x320b2a[_0x927a('0x16')]?_0x320b2a[_0x927a('0x16')][_0x927a('0x17')]:'','XMD-CALLERID':_0x4131b1,'XMD-CALLERID-PREVIEW':_0x164638?util['format']('\x22%s\x22\x20<%s>',_0x164638[_0x927a('0x18')],_0x164638['calleridnum']):_0x4131b1,'XMD-DIALID':_0x10ce78,'XMD-CONTACTID':_0x320b2a[_0x927a('0x19')],'XMD-CDRTYPE':_0x927a('0x1a'),'CALLERID(all)':_0x4131b1,'XMD-VOICEQUEUEID':_0x320b2a[_0x927a('0x1b')],'XMD-DIALCHANNEL':_0x5d01d3,'XMD-DIALTIMEOUT':_0x454134[_0x927a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x927a('0x10')](_0x927a('0x1d'),_0x454134[_0x927a('0x1e')]?'g':'',_['isEmpty'](_0x454134[_0x927a('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x454134[_0x927a('0x20')]||'','XMD-AGI':_0x454134[_0x927a('0x21')]?util[_0x927a('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x454134[_0x927a('0x21')]):_0x927a('0x22'),'XMD-AGIAFTER':_0x454134['dialQueueProject2']?util[_0x927a('0x10')](_0x927a('0x23'),ipAgi,_0x454134[_0x927a('0x1e')]):_0x927a('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x164638?_0x164638[_0x927a('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x164638?_0x164638[_0x927a('0x25')]:'','XMD-DESTINATION':_0x927a('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x927a('0x12')](_0x454134[_0x927a('0x1f')])){_0x15b259[util[_0x927a('0x10')]('%s',_0x927a('0x27'))]=_0x454134['monitor_format'];_0x15b259[util[_0x927a('0x10')]('%s',_0x927a('0x28'))]=_0x10ce78;}return _0x15b259;};exports[_0x927a('0x29')]=function(_0x1a6e93){var _0x15f232={};for(var _0xfdcc0d in _0x1a6e93){if(_0x1a6e93[_0x927a('0x2a')](_0xfdcc0d)){_0x15f232[util[_0x927a('0x10')]('%s',_[_0x927a('0x2b')](_0xfdcc0d))]=_0x1a6e93[_0xfdcc0d];}}return{'variables':_0x15f232};};exports['updateOriginated']=function(_0x572ba7,_0x539f85){if(!_['isNil'](_0x572ba7)){if(_0x572ba7[_0x927a('0x2a')](_0x927a('0x2c'))){if(_0x572ba7['originated']>0x0){_0x572ba7[_0x927a('0x2c')]-=0x1;}else{logger[_0x927a('0x7')](_0x927a('0x2d'),_0x539f85);}}}else{logger['error'](_0x927a('0x2e'),_0x539f85);}};exports[_0x927a('0x2f')]=function(_0x5d29ef){var _0x4536a2=moment()[_0x927a('0x10')](_0x927a('0x30'));_0x5d29ef[_0x927a('0x31')]=0xd;_0x5d29ef[_0x927a('0x32')]=_0x927a('0x33');_0x5d29ef[_0x927a('0x34')]=_0x4536a2;_0x5d29ef['responsetime']=_0x4536a2;_0x5d29ef[_0x927a('0x35')]=_0x4536a2;};exports[_0x927a('0x36')]=function(_0x5d35d3,_0x9e6980,_0x59155a){var _0x182cf6=moment()[_0x927a('0x10')](_0x927a('0x30'));_0x5d35d3[_0x927a('0x31')]=_0x9e6980;_0x5d35d3[_0x927a('0x32')]=_0x59155a;_0x5d35d3['responsetime']=_0x182cf6;_0x5d35d3[_0x927a('0x37')]=utils[_0x927a('0x38')](_0x5d35d3['responsetime'],_0x5d35d3[_0x927a('0x34')]);};exports[_0x927a('0x39')]=function(_0x12243e,_0x3a3e33,_0x282cca){_0x12243e[_0x927a('0x3a')]=_0x3a3e33;_0x12243e[_0x927a('0x3b')]=_0x282cca;};exports['logCustomer']=function(_0x2903af,_0x3414ec,_0x2522f8){var _0x34ecb1=moment()['format'](_0x927a('0x30'));_0x2903af['state']=_0x3414ec;_0x2903af['statedesc']=_0x2522f8;_0x2903af[_0x927a('0x3c')]=_0x2903af['responsetime']?_0x2903af[_0x927a('0x3c')]:_0x34ecb1;_0x2903af['endtime']=_0x2903af[_0x927a('0x35')]?_0x2903af[_0x927a('0x35')]:_0x34ecb1;_0x2903af[_0x927a('0x37')]=utils['getSeconds'](_0x2903af[_0x927a('0x3c')]||0x0,_0x2903af[_0x927a('0x34')]||0x0);_0x2903af[_0x927a('0x3d')]=_0x2903af['answertime']?utils[_0x927a('0x38')](_0x2903af[_0x927a('0x35')],_0x2903af[_0x927a('0x3e')]):0x0;};exports[_0x927a('0x3f')]=function(_0x22d721){return _0x22d721==='Failure';};exports['variablesAction']=function(_0x474831,_0x385630,_0x1fcacd,_0x3d947f,_0x4a83cb){var _0x2f71be=_0x3d947f?'RECALL':_0x474831[_0x927a('0x18')];_0x2f71be=_0x4a83cb?_0x927a('0x40'):_0x2f71be;return{'actionid':_0x474831[_0x927a('0x41')],'action':_0x927a('0x42'),'channel':_0x474831[_0x927a('0x43')],'callerid':util[_0x927a('0x10')](_0x927a('0x11'),_0x2f71be,_0x474831[_0x927a('0x44')]),'Exten':'xcally-motion-preview','Context':_0x927a('0x45'),'Priority':'1','variable':_0x1fcacd,'timeout':(_0x385630[_0x927a('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x474831[_0x927a('0x41')]};};exports[_0x927a('0x47')]=function(_0x514a80){return _0x514a80[_0x927a('0x48')]+_0x514a80[_0x927a('0x49')]+_0x514a80[_0x927a('0x4a')]+_0x514a80[_0x927a('0x4b')]+_0x514a80['countnosuchnumberretry'];};exports[_0x927a('0x4c')]=function(_0x134714){var _0x45c088=_[_0x927a('0x4d')](_0x134714);_0x45c088['state']=0xf;_0x45c088[_0x927a('0x32')]=_0x927a('0x4e');return _0x45c088;};exports['scheduledAt']=function(_0x183527,_0xd81b79,_0x5133c6){var _0x3ea7a0={};_0x3ea7a0[_0xd81b79]=_0x183527[_0xd81b79];_0x3ea7a0[_0x927a('0x4f')]=![];_0x3ea7a0[_0x927a('0x50')]=moment()[_0x927a('0x51')](_0x5133c6,_0x927a('0x52'))[_0x927a('0x10')](_0x927a('0x30'));_0x3ea7a0[_0x927a('0x19')]=_0x183527[_0x927a('0x19')];_0x3ea7a0[_0x927a('0x53')]=_0x183527['ListId'];_0x3ea7a0[_0x927a('0x1b')]=_0x183527[_0x927a('0x1b')]||undefined;return _0x3ea7a0;};exports[_0x927a('0x54')]=function(_0x127d8d,_0x2b5b94){if(!_['isNil'](_0x127d8d)){if(_0x127d8d['pTalking']>0x0){_0x127d8d[_0x927a('0x55')]-=0x1;}else{logger[_0x927a('0x7')](_0x2b5b94,_0x927a('0x56'));}}else{logger[_0x927a('0x7')](_0x2b5b94,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x927a('0x57')]=function(_0x10b364){if(_0x10b364<=0x0){return!![];}return![];};function buildObj(_0x1f01be,_0x22c20a,_0x23565d){_0x1f01be[_0x927a('0x58')]=_0x22c20a;_0x1f01be[_0x927a('0x17')]=_0x1f01be['queue'];_0x1f01be['interface']=_0x1f01be[_0x927a('0x43')];_0x1f01be[_0x927a('0x59')]=_0x927a('0x5a');if(_0x23565d){_0x1f01be['mandatoryDisposition']=_0x23565d['mandatoryDisposition'];}return _0x1f01be;}exports[_0x927a('0x5b')]=buildObj;exports[_0x927a('0x5c')]=function(_0x306a72){var _0x5c3ab8={};_0x5c3ab8[_0x927a('0x5d')]=_0x306a72['queue'];_0x5c3ab8[_0x927a('0x5e')]=_0x306a72[_0x927a('0x43')];_0x5c3ab8[_0x927a('0x41')]=_0x306a72['uniqueid'];return _0x5c3ab8;};exports['agentReadyId']=function(_0x33ae14){var _0x481317=[];for(var _0x7e9330 in _0x33ae14){if(_0x33ae14[_0x927a('0x2a')](_0x7e9330)){if(!_[_0x927a('0x5f')](_0x33ae14[_0x7e9330])&&_0x33ae14[_0x7e9330][_0x927a('0x31')]==='not_inuse'&&_0x33ae14[_0x7e9330][_0x927a('0x60')]===_0x927a('0x61')){_0x481317[_0x927a('0x62')](_0x33ae14[_0x7e9330]['id']);}}}return _0x481317;};exports['getDiff']=function(_0x2c852e){var _0x59babe=moment()[_0x927a('0x63')](0x0);var _0x5d1d65=moment(_0x2c852e)[_0x927a('0x63')](0x0);return _0x59babe[_0x927a('0x64')](_0x5d1d65,'seconds');};exports[_0x927a('0x65')]=function(_0x4bd148){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bd148[_0x927a('0x19')],'ListId':_0x4bd148['ListId'],'VoiceQueueId':_0x4bd148['VoiceQueueId']||undefined,'CampaignId':_0x4bd148[_0x927a('0x66')]||undefined};};exports[_0x927a('0x67')]=function(_0x1fa74a){if(_0x1fa74a===_0x927a('0x41')||_0x1fa74a==='idContact'||_0x1fa74a===_0x927a('0x5d')||_0x1fa74a===_0x927a('0x68')||_0x1fa74a==='campaigntype'||_0x1fa74a===_0x927a('0x69')||_0x1fa74a===_0x927a('0x3a')||_0x1fa74a===_0x927a('0x43')||_0x1fa74a===_0x927a('0x18')||_0x1fa74a===_0x927a('0x4f')||_0x1fa74a===_0x927a('0x44')||_0x1fa74a===_0x927a('0x50')||_0x1fa74a===_0x927a('0x48')||_0x1fa74a===_0x927a('0x49')||_0x1fa74a===_0x927a('0x4a')||_0x1fa74a==='countglobal'||_0x1fa74a===_0x927a('0x6a')||_0x1fa74a==='callbackuniqueid'||_0x1fa74a===_0x927a('0x6b')||_0x1fa74a==='recallme'||_0x1fa74a===_0x927a('0x19')||_0x1fa74a===_0x927a('0x53')||_0x1fa74a==='UserId'||_0x1fa74a==='VoiceQueueId'||_0x1fa74a===_0x927a('0x6c')||_0x1fa74a===_0x927a('0x6d')||_0x1fa74a===_0x927a('0x6e')||_0x1fa74a===_0x927a('0x6f')||_0x1fa74a===_0x927a('0x70')||_0x1fa74a==='xmd-dialurl'||_0x1fa74a===_0x927a('0x71')||_0x1fa74a==='xmd-dialoptions'||_0x1fa74a==='xmd-dialid'||_0x1fa74a===_0x927a('0x72')||_0x1fa74a===_0x927a('0x73')||_0x1fa74a===_0x927a('0x74')||_0x1fa74a===_0x927a('0x75')||_0x1fa74a===_0x927a('0x76')||_0x1fa74a===_0x927a('0x77')||_0x1fa74a===_0x927a('0x78')||_0x1fa74a==='rtpaudioqosbridged'||_0x1fa74a===_0x927a('0x79')||_0x1fa74a==='rtpaudioqosjitterbridged'||_0x1fa74a===_0x927a('0x7a')||_0x1fa74a===_0x927a('0x7b')||_0x1fa74a===_0x927a('0x7c')||_0x1fa74a===_0x927a('0x7d')||_0x1fa74a===_0x927a('0x78')||_0x1fa74a===_0x927a('0x7e')||_0x1fa74a===_0x927a('0x79')||_0x1fa74a===_0x927a('0x7f')||_0x1fa74a===_0x927a('0x7a')||_0x1fa74a===_0x927a('0x7b')||_0x1fa74a===_0x927a('0x7c')||_0x1fa74a==='rtpaudioqosrttbridged'||_0x1fa74a===_0x927a('0x80')||_0x1fa74a===_0x927a('0x81')||_0x1fa74a===_0x927a('0x31')||_0x1fa74a===_0x927a('0x32')){return![];}return!![];};exports[_0x927a('0x82')]=function(_0x4a765e,_0x5e90e6){var _0x4aedc1,_0x2a3cc6,_0x553739;if(_0x5e90e6<=0x0){_0x5e90e6=0x1;}_0x4aedc1=new RegExp(_0x927a('0x83')+_0x5e90e6+'}$');_0x2a3cc6=Math[_0x927a('0x84')](0xa,_0x5e90e6-0x1);_0x553739=Math[_0x927a('0x84')](0xa,_0x5e90e6)-0x1;return util[_0x927a('0x10')]('%s',_['replace'](_0x4a765e,_0x4aedc1,_[_0x927a('0x85')](_0x2a3cc6,_0x553739)));};exports[_0x927a('0x86')]=function(_0x16ad19){var _0x25f7f0=_0x16ad19[_0x927a('0x87')](/"(.*?)"/);return _0x25f7f0?_0x25f7f0[0x1]:_0x16ad19;};exports[_0x927a('0x88')]=function(_0x1722b2){var _0x4aff03=_0x1722b2[_0x927a('0x87')](/<(.*?)>/);return _0x4aff03?_0x4aff03[0x1]:_0x1722b2;};function buildNoAnswerEventPayload(_0x7f65d9,_0x569638){var _0x1024f2=buildObj(_0x7f65d9,'noanswer');if(!_[_0x927a('0x12')](_0x569638[_0x927a('0x89')])){Object[_0x927a('0x8a')](_0x569638[_0x927a('0x89')])[_0x927a('0x8b')](function(_0x1cfa5e){_0x1024f2[_0x1cfa5e[_0x927a('0x8c')]()]=_0x569638[_0x927a('0x89')][_0x1cfa5e];});}return _0x1024f2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fd7e994..f40130d 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 _0x95d0=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x29667a,_0x33d274){var _0x2d065a=function(_0x365f68){while(--_0x365f68){_0x29667a['push'](_0x29667a['shift']());}};_0x2d065a(++_0x33d274);}(_0x95d0,0x115));var _0x095d=function(_0x2544f0,_0x87c1e7){_0x2544f0=_0x2544f0-0x0;var _0xa0f173=_0x95d0[_0x2544f0];return _0xa0f173;};'use strict';exports[_0x095d('0x0')]={'queue':{'type':_0x095d('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x095d('0x1'),'required':!![]},'penalty':{'type':_0x095d('0x2'),'required':![]},'paused':{'type':_0x095d('0x3'),'required':![]}};exports[_0x095d('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x095d('0x1'),'required':!![]}};exports[_0x095d('0x5')]={'interface':{'type':_0x095d('0x1'),'required':!![]},'paused':{'type':_0x095d('0x3')},'reason':{'type':_0x095d('0x1'),'required':![]}};exports[_0x095d('0x6')]={'module':{'type':_0x095d('0x1'),'required':![]}};exports[_0x095d('0x7')]={'uniqueid':{'type':_0x095d('0x1'),'required':!![]}};exports[_0x095d('0x8')]={'uniqueid':{'type':_0x095d('0x1'),'required':!![]},'filename':{'type':_0x095d('0x1')},'format':{'type':_0x095d('0x1')},'mixmonitorid':{'type':_0x095d('0x1')}};exports[_0x095d('0x9')]={'uniqueid':{'type':_0x095d('0x1'),'required':!![]}};exports[_0x095d('0xa')]={'uniqueid':{'type':_0x095d('0x1'),'required':!![]},'exten':{'type':_0x095d('0x1'),'required':!![]},'context':{'type':_0x095d('0x1')}}; \ No newline at end of file +var _0x413d=['voicequeuechannelhangup','string','number','queueremove','boolean','voicequeuechannel','voicechannel'];(function(_0x3b30c7,_0x2288ae){var _0x47b7e6=function(_0x490b65){while(--_0x490b65){_0x3b30c7['push'](_0x3b30c7['shift']());}};_0x47b7e6(++_0x2288ae);}(_0x413d,0x6a));var _0xd413=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x413d[_0x24259d];return _0x5a701;};'use strict';exports['queueadd']={'queue':{'type':_0xd413('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xd413('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xd413('0x2')]={'queue':{'type':_0xd413('0x0'),'required':!![]},'interface':{'type':_0xd413('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xd413('0x0'),'required':!![]},'paused':{'type':_0xd413('0x3')},'reason':{'type':_0xd413('0x0'),'required':![]}};exports['reload']={'module':{'type':_0xd413('0x0'),'required':![]}};exports[_0xd413('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd413('0x5')]={'uniqueid':{'type':_0xd413('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xd413('0x0')},'mixmonitorid':{'type':_0xd413('0x0')}};exports[_0xd413('0x6')]={'uniqueid':{'type':_0xd413('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xd413('0x0'),'required':!![]},'context':{'type':_0xd413('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 92c486c..130c0bd 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x536bf1,_0xcef6ea){var _0x2ef863=function(_0x406540){while(--_0x406540){_0x536bf1['push'](_0x536bf1['shift']());}};_0x2ef863(++_0xcef6ea);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0x5f2f[_0x5c0368];return _0x5b31b9;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0x0b0e[_0x17371c];return _0x422265;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index b02928e..f08e9f0 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 _0xdd1e=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x1932a4,_0x2d7b33){var _0x192d8d=function(_0x233dbe){while(--_0x233dbe){_0x1932a4['push'](_0x1932a4['shift']());}};_0x192d8d(++_0x2d7b33);}(_0xdd1e,0x103));var _0xedd1=function(_0x38d93e,_0x3e5db6){_0x38d93e=_0x38d93e-0x0;var _0x4fa2ad=_0xdd1e[_0x38d93e];return _0x4fa2ad;};'use strict';function mergeDBDataToRealtime(_0x1ef1e3,_0x4e0caa){var _0x1163cc=Object[_0xedd1('0x0')]({},_0x1ef1e3);for(var _0x30347f in _0x4e0caa){if(_0x1163cc[_0xedd1('0x1')](_0x30347f)){_0x1163cc[_0x30347f]=_0x4e0caa[_0x30347f];}}return _0x1163cc;}exports[_0xedd1('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xe2d2=['hasOwnProperty','assign'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0xe2d2,0x185));var _0x2e2d=function(_0x2167d1,_0x2eaf7a){_0x2167d1=_0x2167d1-0x0;var _0x3a6450=_0xe2d2[_0x2167d1];return _0x3a6450;};'use strict';function mergeDBDataToRealtime(_0x407669,_0x515358){var _0xf013ae=Object[_0x2e2d('0x0')]({},_0x407669);for(var _0x3028ed in _0x515358){if(_0xf013ae[_0x2e2d('0x1')](_0x3028ed)){_0xf013ae[_0x3028ed]=_0x515358[_0x3028ed];}}return _0xf013ae;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ac89bee..e2ff75e 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 _0xba89=['createdAt','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','keys','channel','split','calleridnum','outbound','internal','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','getCallType','UserId','getAgentByInternal','membername','monitors','monitorFilename','filename'];(function(_0x44d54c,_0x21c7ff){var _0x287de2=function(_0x531f21){while(--_0x531f21){_0x44d54c['push'](_0x44d54c['shift']());}};_0x287de2(++_0x21c7ff);}(_0xba89,0x1dd));var _0x9ba8=function(_0x45b900,_0x2d7019){_0x45b900=_0x45b900-0x0;var _0x40233d=_0xba89[_0x45b900];return _0x40233d;};'use strict';var _=require(_0x9ba8('0x0'));var moment=require(_0x9ba8('0x1'));var util=require(_0x9ba8('0x2'));var config=require(_0x9ba8('0x3'));var ami=require(_0x9ba8('0x4'));var RpcVoiceAgentReport=require(_0x9ba8('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x9ba8('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9ba8('0x7'));var RpcVoiceRecording=require(_0x9ba8('0x8'));var RpcVoiceTransferReport=require(_0x9ba8('0x9'));var VoiceQueueReport=require(_0x9ba8('0xa'));var VoiceCallReport=require(_0x9ba8('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9ba8('0xc'));var UserReport=require(_0x9ba8('0xd'));function Report(_0x435f96){this[_0x9ba8('0xe')]=_0x435f96;this['agents']=_0x435f96[_0x9ba8('0xf')];this[_0x9ba8('0x10')]=_0x435f96[_0x9ba8('0x10')];}Report[_0x9ba8('0x11')][_0x9ba8('0x12')]=function(_0x484c67){var _0xe61a26=new VoiceQueueReport(this['realtime']);var _0x5b1eaf=new VoiceAgentReport(this['realtime']);var _0x2214a9=new VoiceDialReport(this[_0x9ba8('0xe')]);var _0x317453=new VoiceCallReport(this[_0x9ba8('0xe')]);var _0x266f37=new UserReport(this[_0x9ba8('0xe')]);if(config[_0x9ba8('0x13')]&&config[_0x9ba8('0x13')][_0x9ba8('0x14')]){ami['on'](_0x9ba8('0x15'),this[_0x9ba8('0x16')][_0x9ba8('0x17')](this));ami['on'](_0x9ba8('0x18'),this[_0x9ba8('0x19')][_0x9ba8('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x9ba8('0x1a')]['bind'](this));ami['on'](_0x9ba8('0x1b'),this[_0x9ba8('0x1c')][_0x9ba8('0x17')](this));ami['on'](_0x9ba8('0x1d'),this[_0x9ba8('0x1e')][_0x9ba8('0x17')](this));ami['on'](_0x9ba8('0x1f'),this[_0x9ba8('0x20')][_0x9ba8('0x17')](this));}};Report['prototype'][_0x9ba8('0x21')]=function(_0x44ee3b){var _0x1ed65d;_0x1ed65d=_[_0x9ba8('0x22')](this[_0x9ba8('0xf')],function(_0x5c8659){return _0x5c8659[_0x9ba8('0x23')]==_0x44ee3b||_0x5c8659[_0x9ba8('0x24')]==_0x44ee3b;});if(_[_0x9ba8('0x25')](_0x1ed65d)){var _0x5f4fcf=_['find'](this[_0x9ba8('0x10')],function(_0x4b457f){return _0x4b457f['accountcode']==_0x44ee3b||_0x4b457f[_0x9ba8('0x24')]==_0x44ee3b;});if(_0x5f4fcf){_0x1ed65d=_[_0x9ba8('0x22')](this['agents'],function(_0x5df792){return _0x5df792[_0x9ba8('0x26')]==util[_0x9ba8('0x27')](_0x9ba8('0x28'),_0x5f4fcf[_0x9ba8('0x24')]);});}}return _0x1ed65d;};Report[_0x9ba8('0x11')][_0x9ba8('0x16')]=function(_0x2e97bb){for(var _0x2c10b9=0x0;_0x2c10b9<_0x2e97bb[_0x9ba8('0x29')];_0x2c10b9+=0x1){var _0x47d504=this[_0x9ba8('0x21')](_0x2e97bb[_0x2c10b9][_0x9ba8('0x2a')]);if(_0x47d504){_0x2e97bb[_0x2c10b9][_0x9ba8('0x23')]=_0x47d504[_0x9ba8('0x23')];_0x2e97bb[_0x2c10b9][_0x9ba8('0x2b')]=!![];_0x2e97bb[_0x2c10b9][_0x9ba8('0x2c')]=_0x47d504[_0x9ba8('0x24')];_0x2e97bb[_0x2c10b9]['interface']=_[_0x9ba8('0x25')](_0x47d504['interface'])?util[_0x9ba8('0x27')](_0x9ba8('0x28'),_0x47d504[_0x9ba8('0x24')]):_0x47d504[_0x9ba8('0x26')];if(_0x2e97bb[_0x2c10b9]['queuecallercomplete']){_0x2e97bb[_0x2c10b9][_0x9ba8('0x2d')]=moment()[_0x9ba8('0x27')](_0x9ba8('0x2e'));}if(_0x2e97bb[_0x2c10b9][_0x9ba8('0x2f')]){_0x2e97bb[_0x2c10b9]['queuecallerexitAt']=moment()[_0x9ba8('0x27')](_0x9ba8('0x2e'));}RpcMemberReport[_0x9ba8('0x16')](_0x2e97bb[_0x2c10b9]);}RpcVoiceQueueReport[_0x9ba8('0x30')](_0x2e97bb[_0x2c10b9]);}};function extractCalleridNumber(_0x34d11c){var _0x1e29d7=_0x34d11c['match'](/<(.*?)>/);return _0x1e29d7?_0x1e29d7[0x1]:_0x34d11c;}Report['prototype']['getAgentByInternal']=function(_0x37c755){for(var _0x2c7feb=0x0;_0x2c7feb','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','originatecalleridnum','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','isNil','find','interface','format','SIP/%s','name','length','connectedlinenum','accountcode','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf18c,0x89));var _0xcf18=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xf18c[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var moment=require(_0xcf18('0x0'));var util=require('util');var config=require(_0xcf18('0x1'));var ami=require(_0xcf18('0x2'));var RpcVoiceAgentReport=require(_0xcf18('0x3'));var RpcVoiceCallReport=require(_0xcf18('0x4'));var RpcVoiceDialReport=require(_0xcf18('0x5'));var RpcMemberReport=require(_0xcf18('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xcf18('0x7'));var RpcVoiceTransferReport=require(_0xcf18('0x8'));var VoiceQueueReport=require(_0xcf18('0x9'));var VoiceCallReport=require(_0xcf18('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcf18('0xb'));var UserReport=require(_0xcf18('0xc'));function Report(_0x425c0d){this[_0xcf18('0xd')]=_0x425c0d;this[_0xcf18('0xe')]=_0x425c0d[_0xcf18('0xe')];this[_0xcf18('0xf')]=_0x425c0d[_0xcf18('0xf')];}Report[_0xcf18('0x10')][_0xcf18('0x11')]=function(_0x23317d){var _0x1593a5=new VoiceQueueReport(this['realtime']);var _0x3680aa=new VoiceAgentReport(this[_0xcf18('0xd')]);var _0xc82cf3=new VoiceDialReport(this[_0xcf18('0xd')]);var _0x27e134=new VoiceCallReport(this[_0xcf18('0xd')]);var _0x5e6920=new UserReport(this[_0xcf18('0xd')]);if(config[_0xcf18('0x12')]&&config[_0xcf18('0x12')]['disabled']){ami['on'](_0xcf18('0x13'),this[_0xcf18('0x14')][_0xcf18('0x15')](this));ami['on'](_0xcf18('0x16'),this[_0xcf18('0x17')][_0xcf18('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xcf18('0x18')]['bind'](this));ami['on'](_0xcf18('0x19'),this[_0xcf18('0x1a')][_0xcf18('0x15')](this));ami['on'](_0xcf18('0x1b'),this[_0xcf18('0x1c')][_0xcf18('0x15')](this));ami['on'](_0xcf18('0x1d'),this[_0xcf18('0x1e')][_0xcf18('0x15')](this));}};Report[_0xcf18('0x10')][_0xcf18('0x1f')]=function(_0x4714dd){var _0x1fceac;_0x1fceac=_['find'](this[_0xcf18('0xe')],function(_0x1ecaf6){return _0x1ecaf6['accountcode']==_0x4714dd||_0x1ecaf6['name']==_0x4714dd;});if(_[_0xcf18('0x20')](_0x1fceac)){var _0x30bab7=_[_0xcf18('0x21')](this[_0xcf18('0xf')],function(_0x2e02a4){return _0x2e02a4['accountcode']==_0x4714dd||_0x2e02a4['name']==_0x4714dd;});if(_0x30bab7){_0x1fceac=_[_0xcf18('0x21')](this['agents'],function(_0x1e9c3d){return _0x1e9c3d[_0xcf18('0x22')]==util[_0xcf18('0x23')](_0xcf18('0x24'),_0x30bab7[_0xcf18('0x25')]);});}}return _0x1fceac;};Report[_0xcf18('0x10')][_0xcf18('0x14')]=function(_0x2f33e4){for(var _0x3c885b=0x0;_0x3c885b<_0x2f33e4[_0xcf18('0x26')];_0x3c885b+=0x1){var _0x11f92c=this[_0xcf18('0x1f')](_0x2f33e4[_0x3c885b][_0xcf18('0x27')]);if(_0x11f92c){_0x2f33e4[_0x3c885b][_0xcf18('0x28')]=_0x11f92c['accountcode'];_0x2f33e4[_0x3c885b][_0xcf18('0x29')]=!![];_0x2f33e4[_0x3c885b][_0xcf18('0x2a')]=_0x11f92c[_0xcf18('0x25')];_0x2f33e4[_0x3c885b]['interface']=_['isNil'](_0x11f92c[_0xcf18('0x22')])?util[_0xcf18('0x23')](_0xcf18('0x24'),_0x11f92c[_0xcf18('0x25')]):_0x11f92c[_0xcf18('0x22')];if(_0x2f33e4[_0x3c885b][_0xcf18('0x2b')]){_0x2f33e4[_0x3c885b]['queuecallercompleteAt']=moment()['format'](_0xcf18('0x2c'));}if(_0x2f33e4[_0x3c885b][_0xcf18('0x2d')]){_0x2f33e4[_0x3c885b][_0xcf18('0x2e')]=moment()[_0xcf18('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x2f33e4[_0x3c885b]);}RpcVoiceQueueReport[_0xcf18('0x2f')](_0x2f33e4[_0x3c885b]);}};function extractCalleridNumber(_0x5d6743){var _0x19e92b=_0x5d6743[_0xcf18('0x30')](/<(.*?)>/);return _0x19e92b?_0x19e92b[0x1]:_0x5d6743;}Report['prototype'][_0xcf18('0x31')]=function(_0x17a2cf){for(var _0x5a4060=0x0;_0x5a40600x0?!![]:![];if(!_0x15261d){return this[_0xbd01('0x19')](this[_0xbd01('0x46')]['completeEvent']);}};VoiceQueueReport[_0xbd01('0x3a')]['syncQueueMember']=function(_0x693d99){var _0x1e0dbf=this[_0xbd01('0x46')]['id'];if(this[_0xbd01('0x46')][_0xbd01('0x63')][_0x1e0dbf]&&this[_0xbd01('0x46')]['queuestatus'][_0x1e0dbf][_0x693d99[_0xbd01('0x62')]]){this[_0xbd01('0x46')][_0xbd01('0x63')][_0x1e0dbf][_0x693d99[_0xbd01('0x62')]]['agents'][_0xbd01('0x6c')](_0x693d99);}};VoiceQueueReport[_0xbd01('0x3a')]['syncQueueSummary']=function(_0x57d1be){var _0x4d7549=this;try{if(this[_0xbd01('0x5e')](_0x57d1be)&&this[_0xbd01('0x5e')](_0x57d1be[_0xbd01('0x4f')])){logger[_0xbd01('0x52')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xbd01('0x43')](_0x57d1be,{'showHidden':![],'depth':null}));var _0x2e3dff=this[_0xbd01('0x13')][_0x57d1be['queue']];if(_0x2e3dff){logger[_0xbd01('0x52')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x2e3dff[_0xbd01('0x5c')]);this[_0xbd01('0x46')][_0xbd01('0x5f')][_0x2e3dff[_0xbd01('0x5c')]]={'summaryEvent':_0x57d1be};this[_0xbd01('0x46')]['statusRequests']+=0x1;return ami['Action']({'action':_0xbd01('0x63'),'queue':_0x2e3dff[_0xbd01('0x5c')]})[_0xbd01('0x6d')](function(_0x107249){if(!_0x4d7549[_0xbd01('0x46')][_0xbd01('0x63')][_0x57d1be[_0xbd01('0x62')]]){_0x4d7549[_0xbd01('0x46')][_0xbd01('0x63')][_0x57d1be[_0xbd01('0x62')]]={};}_0x4d7549[_0xbd01('0x46')][_0xbd01('0x63')][_0x57d1be[_0xbd01('0x62')]][_0x107249[_0xbd01('0x62')]]={'queue':_0x2e3dff[_0xbd01('0x5c')],'agents':[]};})[_0xbd01('0x60')](function(_0x9719ff){throw _0x9719ff;});}}}catch(_0x541b46){logger[_0xbd01('0x41')](_0xbd01('0x6e'),util[_0xbd01('0x43')](_0x541b46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd01('0x3a')][_0xbd01('0x19')]=function(_0x3c6db2){if(this['summary'][_0xbd01('0x6b')]>0x0){this[_0xbd01('0x46')][_0xbd01('0x6f')]=_0x3c6db2;return;}logger['debug'](_0xbd01('0x70'),util[_0xbd01('0x43')](_0x3c6db2,{'showHidden':![],'depth':null}));this[_0xbd01('0x46')]=initializeSummary();ami[_0xbd01('0x4a')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xbd01('0x3a')][_0xbd01('0x1e')]=function(_0x52f9f9){try{if(this[_0xbd01('0x5e')](_0x52f9f9)){logger[_0xbd01('0x52')](_0xbd01('0x71'),_0x52f9f9['uniqueid'],util[_0xbd01('0x43')](_0x52f9f9,{'showHidden':![],'depth':null}));if(_[_0xbd01('0x72')](this[_0xbd01('0x44')][_0x52f9f9[_0xbd01('0x4c')]])){this[_0xbd01('0x44')][_0x52f9f9[_0xbd01('0x4c')]]=[];}if(_['isUndefined'](this['channels'][_0x52f9f9[_0xbd01('0x4c')]])){this[_0xbd01('0x3c')][_0x52f9f9[_0xbd01('0x4c')]]={};}var _0x2660a2=new QueueReport();_0x2660a2[_0xbd01('0x4f')]=_0x52f9f9['queue'];_0x2660a2['type']=this[_0xbd01('0x13')][_0x2660a2[_0xbd01('0x4f')]]&&this['voiceQueues'][_0x2660a2[_0xbd01('0x4f')]][_0xbd01('0x59')]?this[_0xbd01('0x13')][_0x2660a2[_0xbd01('0x4f')]][_0xbd01('0x59')]||_0xbd01('0x5a'):_0xbd01('0x5a');_0x2660a2[_0xbd01('0x73')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));_0x2660a2[_0xbd01('0x75')]=_0x52f9f9[_0xbd01('0x75')];_0x2660a2[_0xbd01('0x76')]=_0x52f9f9[_0xbd01('0x76')];_0x2660a2[_0xbd01('0x4c')]=_0x52f9f9[_0xbd01('0x4c')];_0x2660a2[_0xbd01('0x77')]=this[_0xbd01('0x3c')][_0x52f9f9[_0xbd01('0x4c')]][_0xbd01('0x77')];logger[_0xbd01('0x78')](_0xbd01('0x79'),_0x2660a2[_0xbd01('0x4f')],_0x2660a2[_0xbd01('0x59')]);Object['assign'](_0x2660a2,_[_0xbd01('0x7a')](_0x52f9f9,_['keys'](_0x2660a2)));this[_0xbd01('0x44')][_0x52f9f9[_0xbd01('0x4c')]]['push'](_0x2660a2);this[_0xbd01('0x3c')][_0x52f9f9[_0xbd01('0x4c')]]=_0x2660a2;this['emitVoiceQueueChannelSave'](_0x2660a2,_0xbd01('0x7b'));}}catch(_0x1eb9d1){logger['error'](_0xbd01('0x71'),_0x52f9f9[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x1eb9d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd01('0x3a')]['syncQueueCallerAbandon']=function(_0x12f065){try{if(this[_0xbd01('0x5e')](_0x12f065)){logger[_0xbd01('0x52')](_0xbd01('0x7c'),_0x12f065[_0xbd01('0x4c')],util['inspect'](_0x12f065,{'showHidden':![],'depth':null}));if(this[_0xbd01('0x44')][_0x12f065[_0xbd01('0x4c')]]){var _0x2931f9=_['last'](this[_0xbd01('0x44')][_0x12f065['uniqueid']]);_0x2931f9[_0xbd01('0x39')]=![];_0x2931f9[_0xbd01('0x7d')]=null;_0x2931f9[_0xbd01('0x7e')]=_0x12f065['holdtime'];_0x2931f9[_0xbd01('0x7f')]=_0x12f065[_0xbd01('0x7f')];_0x2931f9['queuecallerabandon']=!![];_0x2931f9[_0xbd01('0x80')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));_0x2931f9[_0xbd01('0x81')]=_0xbd01('0x82');_0x2931f9[_0xbd01('0x83')]=null;logger[_0xbd01('0x78')](_0xbd01('0x84'),_0x2931f9[_0xbd01('0x4f')],_0x2931f9['type']);this[_0xbd01('0x3c')][_0x12f065[_0xbd01('0x4c')]]=_0x2931f9;this['emitVoiceQueueChannelRemove'](_0x2931f9,'queuecallerabandon');}}}catch(_0x2ffbc1){logger[_0xbd01('0x41')](_0xbd01('0x7c'),_0x12f065[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x2ffbc1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbd01('0x21')]=function(_0x50e449){try{if(this[_0xbd01('0x5e')](_0x50e449)){logger[_0xbd01('0x52')](_0xbd01('0x85'),_0x50e449[_0xbd01('0x4c')],util['inspect'](_0x50e449,{'showHidden':![],'depth':null}));if(this[_0xbd01('0x44')][_0x50e449['uniqueid']]){var _0x4636b4=_['last'](this[_0xbd01('0x44')][_0x50e449[_0xbd01('0x4c')]]);_0x4636b4[_0xbd01('0x86')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));_0x4636b4[_0xbd01('0x87')]=_0x50e449['connectedlinenum'];_0x4636b4[_0xbd01('0x88')]=_0x50e449[_0xbd01('0x88')];logger[_0xbd01('0x78')](_0xbd01('0x89'),_0x4636b4[_0xbd01('0x4f')],_0x4636b4[_0xbd01('0x59')],_0x50e449[_0xbd01('0x87')],_0x50e449[_0xbd01('0x88')]);this[_0xbd01('0x3c')][_0x50e449[_0xbd01('0x4c')]]=_0x4636b4;this['emitVoiceQueueChannelSave'](_0x4636b4,'queuecallerleave');}}}catch(_0x4eb1a3){logger[_0xbd01('0x41')](_0xbd01('0x85'),_0x50e449[_0xbd01('0x4c')],util['inspect'](_0x4eb1a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd01('0x3a')][_0xbd01('0x23')]=function(_0x2ee119){try{if(this[_0xbd01('0x5e')](_0x2ee119)){logger[_0xbd01('0x52')](_0xbd01('0x8a'),_0x2ee119[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x2ee119,{'showHidden':![],'depth':null}));if(this[_0xbd01('0x44')][_0x2ee119['uniqueid']]){var _0x5289ac=_[_0xbd01('0x8b')](this[_0xbd01('0x44')][_0x2ee119['uniqueid']]);_0x5289ac[_0xbd01('0x39')]=!![];_0x5289ac[_0xbd01('0x81')]='COMPLETEDBYAGENT';logger[_0xbd01('0x78')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5289ac[_0xbd01('0x4f')],_0x5289ac['type']);}}}catch(_0x11b02e){logger[_0xbd01('0x41')](_0xbd01('0x8a'),_0x2ee119[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x11b02e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd01('0x3a')]['syncAgentComplete']=function(_0x5d544a){try{if(this[_0xbd01('0x5e')](_0x5d544a)){logger['debug'](_0xbd01('0x8c'),_0x5d544a[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x5d544a,{'showHidden':![],'depth':null}));if(this[_0xbd01('0x44')][_0x5d544a[_0xbd01('0x4c')]]){var _0x3e352f=_[_0xbd01('0x8b')](this[_0xbd01('0x44')][_0x5d544a[_0xbd01('0x4c')]]);_0x3e352f['queuecallerabandon']=![];_0x3e352f['queuecallerabandonAt']=null;_0x3e352f[_0xbd01('0x8d')]=!![];_0x3e352f[_0xbd01('0x83')]=_0x5d544a[_0xbd01('0x8e')];_0x3e352f[_0xbd01('0x7e')]=_0x5d544a[_0xbd01('0x7e')];_0x3e352f[_0xbd01('0x39')]=!![];_0x3e352f['queuecallerexit']=![];_0x3e352f[_0xbd01('0x8f')]=null;if(!_0x3e352f[_0xbd01('0x90')]){if(_0x5d544a['reason']==_0xbd01('0x90')){_0x3e352f['queuecallerexitreason']=_0xbd01('0x91');logger[_0xbd01('0x78')](_0xbd01('0x92'),_0x3e352f[_0xbd01('0x4f')],_0x3e352f[_0xbd01('0x59')]);}else{if(_[_0xbd01('0x93')](_0x5d544a[_0xbd01('0x3f')][_0xbd01('0x94')](),_0xbd01('0x95'))){if(this[_0xbd01('0x44')][_0x5d544a[_0xbd01('0x96')]]){var _0x1d732a=_['last'](this[_0xbd01('0x44')][_0x5d544a[_0xbd01('0x96')]]);_0x1d732a[_0xbd01('0x39')]=![];_0x1d732a[_0xbd01('0x97')]=!![];_0x1d732a['queuecallerexitAt']=moment(_0x3e352f['queuecallerjoinAt'])[_0xbd01('0x98')](_0x5d544a[_0xbd01('0x7e')],_0xbd01('0x99'))[_0xbd01('0x4d')](_0xbd01('0x74'));_0x1d732a['queuecallerexitreason']=_0xbd01('0x9a');_0x1d732a[_0xbd01('0x90')]=!![];_0x1d732a[_0xbd01('0x9b')]=_0xbd01('0x9c');_0x1d732a[_0xbd01('0x9d')]=_0x5d544a[_0xbd01('0x9e')];_0x1d732a['transferuniqueid']=_0x5d544a[_0xbd01('0x4c')];logger['info'](_0xbd01('0x9f'),_0x1d732a['queue'],_0x1d732a[_0xbd01('0x59')]);var _0x4ca86e=this[_0xbd01('0x44')][_0x5d544a[_0xbd01('0x96')]];this['queueReports'][_0x5d544a[_0xbd01('0x96')]]=this['queueReports'][_0x5d544a[_0xbd01('0x4c')]];this['queueReports'][_0x5d544a[_0xbd01('0x4c')]]=_0x4ca86e;}}else{_0x3e352f[_0xbd01('0x81')]=_0xbd01('0xa0')+_0x5d544a[_0xbd01('0xa1')][_0xbd01('0xa2')]();logger[_0xbd01('0x78')](_0xbd01('0xa3'),_0x3e352f[_0xbd01('0x4f')],_0x3e352f[_0xbd01('0x59')],_0x3e352f[_0xbd01('0x81')]);}}}this[_0xbd01('0x3c')][_0x5d544a[_0xbd01('0x4c')]]=_0x3e352f;}}}catch(_0x48d265){logger['error'](_0xbd01('0x8c'),_0x5d544a[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x48d265,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x319a0b){try{if(this[_0xbd01('0x5e')](_0x319a0b)){logger['debug']('[%s][voiceQueueReport][varset]',_0x319a0b[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x319a0b,{'showHidden':![],'depth':null}));this[_0xbd01('0xa4')](_0x319a0b[_0xbd01('0x4c')],_[_0xbd01('0xa5')](_0x319a0b['variable'])[0x0],_0x319a0b[_0xbd01('0xa6')]);if(this[_0xbd01('0x44')][_0x319a0b[_0xbd01('0x4c')]]){var _0x18b3be=_[_0xbd01('0x8b')](this['queueReports'][_0x319a0b[_0xbd01('0x4c')]]);if(_0x18b3be){if(this['isNotNull'](_0x319a0b[_0xbd01('0xa7')])&&this[_0xbd01('0x5e')](_0x319a0b[_0xbd01('0xa7')][_0xbd01('0x63')])){switch(_0x319a0b[_0xbd01('0xa6')]){case _0xbd01('0xa8'):_0x18b3be[_0xbd01('0x97')]=![];_0x18b3be['queuecallerexitAt']=null;break;case _0xbd01('0xa9'):_0x18b3be[_0xbd01('0xaa')]='timeout';_0x18b3be['queuecallerexit']=!![];_0x18b3be[_0xbd01('0x8f')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));_0x18b3be[_0xbd01('0x86')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));logger[_0xbd01('0x52')](_0xbd01('0xab'),_0x319a0b[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x18b3be,{'showHidden':![],'depth':null}));ami[_0xbd01('0x4a')](_0xbd01('0xac'),_0x18b3be);break;default:_0x18b3be['queuecallerexit']=!![];_0x18b3be[_0xbd01('0x8f')]=moment()[_0xbd01('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x18b3be[_0xbd01('0x86')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));}_0x18b3be[_0xbd01('0x1f')]=![];_0x18b3be[_0xbd01('0x80')]=null;_0x18b3be[_0xbd01('0x81')]=_0x319a0b[_0xbd01('0xa6')];this[_0xbd01('0x3c')][_0x319a0b[_0xbd01('0x4c')]]=_0x18b3be;this[_0xbd01('0x48')](_0x18b3be,_0xbd01('0x24'));}else if(this['isNotNull'](_0x319a0b[_0xbd01('0xa7')])&&this[_0xbd01('0x5e')](_0x319a0b[_0xbd01('0xa7')][_0xbd01('0xad')])){if(!_0x18b3be[_0xbd01('0x1f')]){_0x18b3be[_0xbd01('0x97')]=!![];_0x18b3be[_0xbd01('0x8f')]=moment()[_0xbd01('0x4d')](_0xbd01('0x74'));_0x18b3be['queuecallerexitreason']='EXITWITHKEY';_0x18b3be[_0xbd01('0x86')]=moment()['format'](_0xbd01('0x74'));this[_0xbd01('0x3c')][_0x319a0b[_0xbd01('0x4c')]]=_0x18b3be;}}logger[_0xbd01('0x78')](_0xbd01('0xae'),_0x319a0b[_0xbd01('0x4c')],_0x18b3be[_0xbd01('0x4f')],_0x18b3be[_0xbd01('0x59')],_[_0xbd01('0xa5')](_0x319a0b[_0xbd01('0xa7')])[0x0],_0x319a0b[_0xbd01('0xa6')]);_0x18b3be[_0xbd01('0x14')]=this['variables'][_0x319a0b[_0xbd01('0x4c')]];}}}}catch(_0x20caac){logger['error'](_0xbd01('0xaf'),_0x319a0b[_0xbd01('0x4c')],util[_0xbd01('0x43')](_0x20caac,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbd01('0xa4')]=function(_0xffd192,_0x4dc492,_0x5dd509){var _0x109dba=[_0xbd01('0xb0'),'rtpaudioqosbridged',_0xbd01('0xb1'),_0xbd01('0xb2'),_0xbd01('0xb3'),'rtpaudioqoslossbridged',_0xbd01('0xb4'),_0xbd01('0xb5'),_0xbd01('0xb6'),_0xbd01('0xb7'),'bridgepeer',_0xbd01('0xb8'),_0xbd01('0xb9'),'memberdynamic',_0xbd01('0xba'),_0xbd01('0xbb'),_0xbd01('0x8e'),'memberpenalty',_0xbd01('0xbc')];if(!_[_0xbd01('0xbd')](_0x4dc492)&&!_[_0xbd01('0xbe')](_0x109dba,_0x4dc492)){if(_[_0xbd01('0x72')](this['variables'][_0xffd192])){this[_0xbd01('0x14')][_0xffd192]={};}this[_0xbd01('0x14')][_0xffd192][_0x4dc492]=_0x5dd509;}};VoiceQueueReport[_0xbd01('0x3a')][_0xbd01('0xbf')]=function(_0x204366,_0x5e3758,_0x3a624c){try{var _0x1320ef={};if(this[_0xbd01('0x44')][_0x204366]){for(var _0x5e90ba=0x0;_0x5e90ba0x0?!![]:![];if(!_0x14e578){return this['syncQueueSummaryComplete'](this[_0x7881('0xf')]['completeEvent']);}};VoiceQueueReport['prototype'][_0x7881('0x16')]=function(_0x59fc09){var _0x93eb46=this[_0x7881('0xf')]['id'];if(this[_0x7881('0xf')][_0x7881('0x56')][_0x93eb46]&&this['summary'][_0x7881('0x56')][_0x93eb46][_0x59fc09[_0x7881('0x57')]]){this[_0x7881('0xf')][_0x7881('0x56')][_0x93eb46][_0x59fc09[_0x7881('0x57')]][_0x7881('0xc')][_0x7881('0x61')](_0x59fc09);}};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x12')]=function(_0x109db2){var _0x1993f1=this;try{if(this[_0x7881('0x62')](_0x109db2)&&this[_0x7881('0x62')](_0x109db2[_0x7881('0x47')])){logger[_0x7881('0x41')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x109db2,{'showHidden':![],'depth':null}));var _0x466512=this[_0x7881('0xe')][_0x109db2[_0x7881('0x47')]];if(_0x466512){logger[_0x7881('0x41')](_0x7881('0x63'),_0x466512[_0x7881('0x5e')]);this[_0x7881('0xf')][_0x7881('0x53')][_0x466512['name']]={'summaryEvent':_0x109db2};this[_0x7881('0xf')][_0x7881('0x60')]+=0x1;return ami[_0x7881('0x33')]({'action':'queuestatus','queue':_0x466512[_0x7881('0x5e')]})[_0x7881('0x54')](function(_0x33a4e9){if(!_0x1993f1[_0x7881('0xf')][_0x7881('0x56')][_0x109db2[_0x7881('0x57')]]){_0x1993f1[_0x7881('0xf')][_0x7881('0x56')][_0x109db2['actionid']]={};}_0x1993f1[_0x7881('0xf')][_0x7881('0x56')][_0x109db2[_0x7881('0x57')]][_0x33a4e9[_0x7881('0x57')]]={'queue':_0x466512[_0x7881('0x5e')],'agents':[]};})[_0x7881('0x35')](function(_0xc1690e){throw _0xc1690e;});}}}catch(_0x5f156c){logger[_0x7881('0x39')]('[voiceQueueReport][queuesummary]',util[_0x7881('0x38')](_0x5f156c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x15')]=function(_0x24e5f0){if(this[_0x7881('0xf')][_0x7881('0x60')]>0x0){this[_0x7881('0xf')][_0x7881('0x64')]=_0x24e5f0;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x24e5f0,{'showHidden':![],'depth':null}));this[_0x7881('0xf')]=initializeSummary();ami[_0x7881('0x3f')](_0x7881('0x65'),{});};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x1a')]=function(_0x32e7b3){try{if(this[_0x7881('0x62')](_0x32e7b3)){logger[_0x7881('0x41')](_0x7881('0x66'),_0x32e7b3[_0x7881('0x44')],util[_0x7881('0x38')](_0x32e7b3,{'showHidden':![],'depth':null}));if(_[_0x7881('0x52')](this[_0x7881('0xb')][_0x32e7b3[_0x7881('0x44')]])){this[_0x7881('0xb')][_0x32e7b3[_0x7881('0x44')]]=[];}if(_['isUndefined'](this[_0x7881('0x30')][_0x32e7b3[_0x7881('0x44')]])){this[_0x7881('0x30')][_0x32e7b3[_0x7881('0x44')]]={};}var _0x38381d=new QueueReport();_0x38381d['queue']=_0x32e7b3[_0x7881('0x47')];_0x38381d[_0x7881('0x4f')]=this[_0x7881('0xe')][_0x38381d[_0x7881('0x47')]]&&this[_0x7881('0xe')][_0x38381d[_0x7881('0x47')]][_0x7881('0x4f')]?this['voiceQueues'][_0x38381d['queue']][_0x7881('0x4f')]||_0x7881('0x50'):_0x7881('0x50');_0x38381d[_0x7881('0x67')]=moment()[_0x7881('0x45')](_0x7881('0x68'));_0x38381d[_0x7881('0x69')]=_0x32e7b3[_0x7881('0x69')];_0x38381d[_0x7881('0x6a')]=_0x32e7b3[_0x7881('0x6a')];_0x38381d[_0x7881('0x44')]=_0x32e7b3[_0x7881('0x44')];_0x38381d[_0x7881('0x6b')]=this[_0x7881('0x30')][_0x32e7b3['uniqueid']][_0x7881('0x6b')];logger[_0x7881('0x6c')](_0x7881('0x6d'),_0x38381d[_0x7881('0x47')],_0x38381d[_0x7881('0x4f')]);Object[_0x7881('0x5d')](_0x38381d,_[_0x7881('0x6e')](_0x32e7b3,_['keys'](_0x38381d)));this['queueReports'][_0x32e7b3[_0x7881('0x44')]][_0x7881('0x61')](_0x38381d);this[_0x7881('0x30')][_0x32e7b3[_0x7881('0x44')]]=_0x38381d;this[_0x7881('0x40')](_0x38381d,_0x7881('0x19'));}}catch(_0x460f7d){logger['error'](_0x7881('0x66'),_0x32e7b3[_0x7881('0x44')],util[_0x7881('0x38')](_0x460f7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x4524ef){try{if(this[_0x7881('0x62')](_0x4524ef)){logger[_0x7881('0x41')](_0x7881('0x6f'),_0x4524ef['uniqueid'],util[_0x7881('0x38')](_0x4524ef,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4524ef['uniqueid']]){var _0x4ce524=_['last'](this[_0x7881('0xb')][_0x4524ef[_0x7881('0x44')]]);_0x4ce524['queuecallercomplete']=![];_0x4ce524['queuecallercompleteAt']=null;_0x4ce524[_0x7881('0x70')]=_0x4524ef['holdtime'];_0x4ce524[_0x7881('0x71')]=_0x4524ef['originalposition'];_0x4ce524['queuecallerabandon']=!![];_0x4ce524[_0x7881('0x72')]=moment()['format'](_0x7881('0x68'));_0x4ce524[_0x7881('0x4a')]=_0x7881('0x73');_0x4ce524[_0x7881('0x74')]=null;logger[_0x7881('0x6c')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4ce524[_0x7881('0x47')],_0x4ce524[_0x7881('0x4f')]);this[_0x7881('0x30')][_0x4524ef[_0x7881('0x44')]]=_0x4ce524;this[_0x7881('0x75')](_0x4ce524,_0x7881('0x1b'));}}}catch(_0x3e6052){logger[_0x7881('0x39')](_0x7881('0x6f'),_0x4524ef[_0x7881('0x44')],util[_0x7881('0x38')](_0x3e6052,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x76')]=function(_0x2391c1){try{if(this['isNotNull'](_0x2391c1)){logger[_0x7881('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x2391c1['uniqueid'],util[_0x7881('0x38')](_0x2391c1,{'showHidden':![],'depth':null}));if(this[_0x7881('0xb')][_0x2391c1[_0x7881('0x44')]]){var _0x335efb=_[_0x7881('0x77')](this['queueReports'][_0x2391c1[_0x7881('0x44')]]);_0x335efb[_0x7881('0x78')]=moment()[_0x7881('0x45')](_0x7881('0x68'));_0x335efb[_0x7881('0x79')]=_0x2391c1[_0x7881('0x79')];_0x335efb['connectedlinename']=_0x2391c1[_0x7881('0x7a')];logger[_0x7881('0x6c')](_0x7881('0x7b'),_0x335efb['queue'],_0x335efb['type'],_0x2391c1[_0x7881('0x79')],_0x2391c1[_0x7881('0x7a')]);this['channels'][_0x2391c1[_0x7881('0x44')]]=_0x335efb;this[_0x7881('0x40')](_0x335efb,_0x7881('0x1c'));}}}catch(_0x5d6151){logger[_0x7881('0x39')](_0x7881('0x7c'),_0x2391c1['uniqueid'],util['inspect'](_0x5d6151,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x1f')]=function(_0x53ca78){try{if(this[_0x7881('0x62')](_0x53ca78)){logger[_0x7881('0x41')](_0x7881('0x7d'),_0x53ca78[_0x7881('0x44')],util[_0x7881('0x38')](_0x53ca78,{'showHidden':![],'depth':null}));if(this[_0x7881('0xb')][_0x53ca78[_0x7881('0x44')]]){var _0x3e79b8=_['last'](this[_0x7881('0xb')][_0x53ca78[_0x7881('0x44')]]);_0x3e79b8[_0x7881('0x2e')]=!![];_0x3e79b8['queuecallerexitreason']=_0x7881('0x7e');logger[_0x7881('0x6c')](_0x7881('0x7f'),_0x3e79b8[_0x7881('0x47')],_0x3e79b8[_0x7881('0x4f')]);}}}catch(_0x2b101c){logger[_0x7881('0x39')](_0x7881('0x7d'),_0x53ca78[_0x7881('0x44')],util[_0x7881('0x38')](_0x2b101c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7881('0x7')]['syncAgentComplete']=function(_0x1b29cd){try{if(this['isNotNull'](_0x1b29cd)){logger[_0x7881('0x41')](_0x7881('0x80'),_0x1b29cd[_0x7881('0x44')],util[_0x7881('0x38')](_0x1b29cd,{'showHidden':![],'depth':null}));if(this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x44')]]){var _0x11fc8f=_[_0x7881('0x77')](this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x44')]]);_0x11fc8f['queuecallerabandon']=![];_0x11fc8f[_0x7881('0x72')]=null;_0x11fc8f[_0x7881('0x81')]=!![];_0x11fc8f[_0x7881('0x74')]=_0x1b29cd[_0x7881('0x82')];_0x11fc8f[_0x7881('0x70')]=_0x1b29cd[_0x7881('0x70')];_0x11fc8f['queuecallercomplete']=!![];_0x11fc8f['queuecallerexit']=![];_0x11fc8f['queuecallerexitAt']=null;if(!_0x11fc8f[_0x7881('0x83')]){if(_0x1b29cd[_0x7881('0x84')]==_0x7881('0x83')){_0x11fc8f[_0x7881('0x4a')]='COMPLETED';logger[_0x7881('0x6c')](_0x7881('0x85'),_0x11fc8f[_0x7881('0x47')],_0x11fc8f[_0x7881('0x4f')]);}else{if(_[_0x7881('0x86')](_0x1b29cd[_0x7881('0x87')][_0x7881('0x88')](),_0x7881('0x89'))){if(this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x8a')]]){var _0x4c2800=_[_0x7881('0x77')](this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x8a')]]);_0x4c2800[_0x7881('0x2e')]=![];_0x4c2800[_0x7881('0x2d')]=!![];_0x4c2800['queuecallerexitAt']=moment(_0x11fc8f[_0x7881('0x67')])['add'](_0x1b29cd['holdtime'],_0x7881('0x8b'))[_0x7881('0x45')](_0x7881('0x68'));_0x4c2800[_0x7881('0x4a')]=_0x7881('0x8c');_0x4c2800[_0x7881('0x83')]=!![];_0x4c2800['transfertype']='FORWARD';_0x4c2800[_0x7881('0x8d')]=_0x1b29cd['destexten'];_0x4c2800[_0x7881('0x8e')]=_0x1b29cd[_0x7881('0x44')];logger[_0x7881('0x6c')](_0x7881('0x8f'),_0x4c2800[_0x7881('0x47')],_0x4c2800['type']);var _0x497c31=this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x8a')]];this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x8a')]]=this['queueReports'][_0x1b29cd[_0x7881('0x44')]];this[_0x7881('0xb')][_0x1b29cd[_0x7881('0x44')]]=_0x497c31;}}else{_0x11fc8f[_0x7881('0x4a')]=_0x7881('0x90')+_0x1b29cd[_0x7881('0x84')]['toUpperCase']();logger[_0x7881('0x6c')](_0x7881('0x91'),_0x11fc8f[_0x7881('0x47')],_0x11fc8f[_0x7881('0x4f')],_0x11fc8f[_0x7881('0x4a')]);}}}this[_0x7881('0x30')][_0x1b29cd[_0x7881('0x44')]]=_0x11fc8f;}}}catch(_0x1cb45c){logger[_0x7881('0x39')]('[%s][voiceQueueReport][agentcomplete]',_0x1b29cd[_0x7881('0x44')],util[_0x7881('0x38')](_0x1cb45c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7881('0x92')]=function(_0x3a9535){try{if(this['isNotNull'](_0x3a9535)){logger[_0x7881('0x41')](_0x7881('0x93'),_0x3a9535[_0x7881('0x44')],util['inspect'](_0x3a9535,{'showHidden':![],'depth':null}));this['addVariable'](_0x3a9535['uniqueid'],_['keys'](_0x3a9535[_0x7881('0x94')])[0x0],_0x3a9535[_0x7881('0x95')]);if(this[_0x7881('0xb')][_0x3a9535['uniqueid']]){var _0x5233c0=_['last'](this[_0x7881('0xb')][_0x3a9535['uniqueid']]);if(_0x5233c0){if(this[_0x7881('0x62')](_0x3a9535[_0x7881('0x94')])&&this[_0x7881('0x62')](_0x3a9535[_0x7881('0x94')][_0x7881('0x56')])){switch(_0x3a9535['value']){case _0x7881('0x96'):_0x5233c0[_0x7881('0x2d')]=![];_0x5233c0[_0x7881('0x97')]=null;break;case'TIMEOUT':_0x5233c0[_0x7881('0x98')]='timeout';_0x5233c0[_0x7881('0x2d')]=!![];_0x5233c0[_0x7881('0x97')]=moment()['format'](_0x7881('0x68'));_0x5233c0['queuecallerleaveAt']=moment()[_0x7881('0x45')](_0x7881('0x68'));logger[_0x7881('0x41')](_0x7881('0x99'),_0x3a9535[_0x7881('0x44')],util[_0x7881('0x38')](_0x5233c0,{'showHidden':![],'depth':null}));ami[_0x7881('0x3f')]('custom:timeout',_0x5233c0);break;default:_0x5233c0[_0x7881('0x2d')]=!![];_0x5233c0[_0x7881('0x97')]=moment()[_0x7881('0x45')](_0x7881('0x68'));_0x5233c0[_0x7881('0x78')]=moment()[_0x7881('0x45')](_0x7881('0x68'));}_0x5233c0[_0x7881('0x1b')]=![];_0x5233c0['queuecallerabandonAt']=null;_0x5233c0['queuecallerexitreason']=_0x3a9535['value'];this['channels'][_0x3a9535['uniqueid']]=_0x5233c0;this[_0x7881('0x75')](_0x5233c0,_0x7881('0x20'));}else if(this[_0x7881('0x62')](_0x3a9535[_0x7881('0x94')])&&this[_0x7881('0x62')](_0x3a9535[_0x7881('0x94')][_0x7881('0x9a')])){if(!_0x5233c0['queuecallerabandon']){_0x5233c0[_0x7881('0x2d')]=!![];_0x5233c0[_0x7881('0x97')]=moment()[_0x7881('0x45')](_0x7881('0x68'));_0x5233c0[_0x7881('0x4a')]='EXITWITHKEY';_0x5233c0['queuecallerleaveAt']=moment()['format'](_0x7881('0x68'));this['channels'][_0x3a9535[_0x7881('0x44')]]=_0x5233c0;}}logger[_0x7881('0x6c')](_0x7881('0x9b'),_0x3a9535[_0x7881('0x44')],_0x5233c0[_0x7881('0x47')],_0x5233c0[_0x7881('0x4f')],_[_0x7881('0x9c')](_0x3a9535[_0x7881('0x94')])[0x0],_0x3a9535[_0x7881('0x95')]);_0x5233c0[_0x7881('0x10')]=this[_0x7881('0x10')][_0x3a9535['uniqueid']];}}}}catch(_0x5963ae){logger[_0x7881('0x39')](_0x7881('0x93'),_0x3a9535[_0x7881('0x44')],util[_0x7881('0x38')](_0x5963ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7881('0x7')][_0x7881('0x9d')]=function(_0x26bcdb,_0x396246,_0x25066f){var _0x27103b=[_0x7881('0x9e'),_0x7881('0x9f'),_0x7881('0xa0'),_0x7881('0xa1'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7881('0xa2'),'sipcallid',_0x7881('0xa3'),_0x7881('0xa4'),_0x7881('0xa5'),'membercalls',_0x7881('0xa6'),_0x7881('0xa7'),_0x7881('0xa8'),_0x7881('0x82'),_0x7881('0xa9'),_0x7881('0xaa')];if(!_['isNil'](_0x396246)&&!_[_0x7881('0xab')](_0x27103b,_0x396246)){if(_[_0x7881('0x52')](this[_0x7881('0x10')][_0x26bcdb])){this[_0x7881('0x10')][_0x26bcdb]={};}this[_0x7881('0x10')][_0x26bcdb][_0x396246]=_0x25066f;}};VoiceQueueReport[_0x7881('0x7')]['handleHangup']=function(_0x33db4e,_0x3cd8c7,_0x3cbeea){try{var _0x1d1e6b={};if(this[_0x7881('0xb')][_0x33db4e]){for(var _0x1ac6e6=0x0;_0x1ac6e6=0x0?moment(_0x56fcd4['endtime'])['diff'](_0x56fcd4[_0x9755('0x18')],_0x9755('0x1a')):null,'data1':_0x9755('0x1b'),'data2':_0x56fcd4['accountcode'],'data3':_0x56fcd4['exten'],'data4':_0x56fcd4['dialstring']||null,'role':'agent','internal':_0x56fcd4['accountcode']?_[_0x9755('0x14')](_0x56fcd4[_0x9755('0x13')]):undefined,'uniqueid':_0x56fcd4[_0x9755('0x15')]},'log':_0x9755('0x8')});}; \ No newline at end of file +var _0x2306=['endtime','diff','outbound','moment','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','interface','format','TALKING','queuecallerleaveAt','seconds','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','starttime'];(function(_0x40a370,_0x7a93cb){var _0x20507c=function(_0x2757ae){while(--_0x2757ae){_0x40a370['push'](_0x40a370['shift']());}};_0x20507c(++_0x7a93cb);}(_0x2306,0x99));var _0x6230=function(_0x57957d,_0x2cb141){_0x57957d=_0x57957d-0x0;var _0x2b56e3=_0x2306[_0x57957d];return _0x2b56e3;};'use strict';var moment=require(_0x6230('0x0'));var _=require('lodash');var util=require('util');var client=require(_0x6230('0x1'));exports[_0x6230('0x2')]=function(_0x4bf7c1){var _0x5616b5=_0x4bf7c1[_0x6230('0x3')]||_0x4bf7c1[_0x6230('0x4')];return client[_0x6230('0x5')](_0x6230('0x6'),{'body':{'channel':'voice','membername':_0x4bf7c1[_0x6230('0x7')],'interface':_['isNil'](_0x4bf7c1[_0x6230('0x8')])?util[_0x6230('0x9')]('SIP/%s',_0x4bf7c1[_0x6230('0x7')]):_0x4bf7c1[_0x6230('0x8')],'type':_0x6230('0xa'),'enterAt':_0x4bf7c1[_0x6230('0xb')],'exitAt':_0x5616b5,'duration':moment(_0x5616b5)['diff'](_0x4bf7c1['queuecallerleaveAt'],_0x6230('0xc')),'data1':'inbound','data2':_0x4bf7c1['calleridnum'],'data3':_0x4bf7c1[_0x6230('0xd')],'data4':null,'data5':_0x4bf7c1[_0x6230('0xe')],'role':_0x6230('0xf'),'internal':_0x4bf7c1[_0x6230('0x10')]?_[_0x6230('0x11')](_0x4bf7c1[_0x6230('0x10')]):undefined,'uniqueid':_0x4bf7c1[_0x6230('0x12')]},'log':'CreateMemberReport'});};exports[_0x6230('0x13')]=function(_0x3611b0){return client[_0x6230('0x5')]('CreateMemberReport',{'body':{'channel':_0x6230('0x14'),'membername':_0x3611b0['membername'],'interface':_0x3611b0[_0x6230('0x8')],'type':'TALKING','enterAt':_0x3611b0[_0x6230('0x15')],'exitAt':_0x3611b0[_0x6230('0x16')],'duration':moment(_0x3611b0['endtime'])[_0x6230('0x17')](_0x3611b0['starttime'],_0x6230('0xc'))>=0x0?moment(_0x3611b0['endtime'])[_0x6230('0x17')](_0x3611b0[_0x6230('0x15')],_0x6230('0xc')):null,'data1':_0x6230('0x18'),'data2':_0x3611b0[_0x6230('0x10')],'data3':_0x3611b0[_0x6230('0xd')],'data4':_0x3611b0['dialstring']||null,'role':_0x6230('0xf'),'internal':_0x3611b0[_0x6230('0x10')]?_[_0x6230('0x11')](_0x3611b0[_0x6230('0x10')]):undefined,'uniqueid':_0x3611b0[_0x6230('0x12')]},'log':_0x6230('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index afda326..92d43ae 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 _0xc933=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x14a44e,_0xa4af45){var _0x4e7b79=function(_0x2998ca){while(--_0x2998ca){_0x14a44e['push'](_0x14a44e['shift']());}};_0x4e7b79(++_0xa4af45);}(_0xc933,0xf9));var _0x3c93=function(_0x5e1821,_0x5f2d13){_0x5e1821=_0x5e1821-0x0;var _0x3c6c2f=_0xc933[_0x5e1821];return _0x3c6c2f;};'use strict';var client=require(_0x3c93('0x0'));exports[_0x3c93('0x1')]=function(){return client[_0x3c93('0x2')](_0x3c93('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3c93('0x4'),'previewRecallmeReminderInterval']},'log':_0x3c93('0x5')});}; \ No newline at end of file +var _0xf8f2=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x29c728,_0x5aed0d){_0x29c728=_0x29c728-0x0;var _0x17be77=_0xf8f2[_0x29c728];return _0x17be77;};'use strict';var client=require(_0x2f8f('0x0'));exports[_0x2f8f('0x1')]=function(){return client[_0x2f8f('0x2')](_0x2f8f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2f8f('0x4')]},'log':_0x2f8f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 85a2178..e1f849e 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 _0x05bf=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x05bf,0xe5));var _0xf05b=function(_0x37c3ce,_0xe10a8a){_0x37c3ce=_0x37c3ce-0x0;var _0x30d6a4=_0x05bf[_0x37c3ce];return _0x30d6a4;};'use strict';var client=require(_0xf05b('0x0'));exports[_0xf05b('0x1')]=function(_0x1a73d4){return function(_0x11ad27){return client[_0xf05b('0x2')](_0xf05b('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf05b('0x4'),_0xf05b('0x5')]},'log':_0xf05b('0x3')});};}; \ No newline at end of file +var _0x7b1b=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b1b,0x17d));var _0xb7b1=function(_0x18c54a,_0x755c61){_0x18c54a=_0x18c54a-0x0;var _0x4cfb6e=_0x7b1b[_0x18c54a];return _0x4cfb6e;};'use strict';var client=require(_0xb7b1('0x0'));exports[_0xb7b1('0x1')]=function(_0x67ae37){return function(_0x17c8b6){return client[_0xb7b1('0x2')](_0xb7b1('0x3'),{'options':{'raw':!![],'attributes':['id',_0xb7b1('0x4'),_0xb7b1('0x5')]},'log':_0xb7b1('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b150e02..a518f62 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 _0xfe76=['name','status','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action','data2','data4','Request','GetTrigger'];(function(_0x31ad86,_0x2fce0e){var _0x5e3989=function(_0x5bc82c){while(--_0x5bc82c){_0x31ad86['push'](_0x31ad86['shift']());}};_0x5e3989(++_0x2fce0e);}(_0xfe76,0x14e));var _0x6fe7=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xfe76[_0x37e845];return _0x59e55b;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2027a9){return function(_0x477f04){return client[_0x6fe7('0x0')](_0x6fe7('0x1'),{'options':{'raw':![],'attributes':['id',_0x6fe7('0x2'),'channel',_0x6fe7('0x3')],'include':[{'model':_0x6fe7('0x4'),'as':_0x6fe7('0x5'),'attributes':['id',_0x6fe7('0x6'),_0x6fe7('0x7'),_0x6fe7('0x8')]},{'model':_0x6fe7('0x4'),'as':_0x6fe7('0x9'),'attributes':['id','field','operator',_0x6fe7('0x8')]},{'model':'Action','as':_0x6fe7('0xa'),'attributes':['id',_0x6fe7('0xb'),'data1',_0x6fe7('0xc'),'data3',_0x6fe7('0xd'),'data5','data6','data7']}]},'log':_0x6fe7('0x1')});};}; \ No newline at end of file +var _0xc523=['../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','AnyConditions','value','Actions','action','data1','data2','data3','data4','data5','data6','data7'];(function(_0x54c2d6,_0x127661){var _0xa1af5d=function(_0x13e968){while(--_0x13e968){_0x54c2d6['push'](_0x54c2d6['shift']());}};_0xa1af5d(++_0x127661);}(_0xc523,0x165));var _0x3c52=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xc523[_0x3da832];return _0xe602f2;};'use strict';var client=require(_0x3c52('0x0'));exports[_0x3c52('0x1')]=function(_0x45a22a){return function(_0xb2822d){return client[_0x3c52('0x2')](_0x3c52('0x3'),{'options':{'raw':![],'attributes':['id',_0x3c52('0x4'),_0x3c52('0x5'),_0x3c52('0x6')],'include':[{'model':_0x3c52('0x7'),'as':_0x3c52('0x8'),'attributes':['id',_0x3c52('0x9'),'operator','value']},{'model':_0x3c52('0x7'),'as':_0x3c52('0xa'),'attributes':['id',_0x3c52('0x9'),'operator',_0x3c52('0xb')]},{'model':'Action','as':_0x3c52('0xc'),'attributes':['id',_0x3c52('0xd'),_0x3c52('0xe'),_0x3c52('0xf'),_0x3c52('0x10'),_0x3c52('0x11'),_0x3c52('0x12'),_0x3c52('0x13'),_0x3c52('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c19ffd5..bfd210d 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 _0x34c6=['defaultuser','../client','Request','GetTrunk'];(function(_0x2eb95e,_0x1b26c2){var _0x1ab9d4=function(_0x1666d3){while(--_0x1666d3){_0x2eb95e['push'](_0x2eb95e['shift']());}};_0x1ab9d4(++_0x1b26c2);}(_0x34c6,0x1cd));var _0x634c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x34c6[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x634c('0x0'));exports['getTrunks']=function(_0xa8d011){return function(_0x3a4eed){return client[_0x634c('0x1')](_0x634c('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x634c('0x3')]},'log':_0x634c('0x2')});};}; \ No newline at end of file +var _0xc6aa=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xc6aa,0x127));var _0xac6a=function(_0x21cf42,_0x26cb23){_0x21cf42=_0x21cf42-0x0;var _0x12d7e0=_0xc6aa[_0x21cf42];return _0x12d7e0;};'use strict';var client=require(_0xac6a('0x0'));exports['getTrunks']=function(_0x3a93cb){return function(_0x1270d7){return client[_0xac6a('0x1')](_0xac6a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xac6a('0x3'),_0xac6a('0x4'),_0xac6a('0x5')]},'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 a527a56..1d8b961 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x68dbcf,_0x53a9b7){var _0x2ec635=function(_0xe7eba3){while(--_0xe7eba3){_0x68dbcf['push'](_0x68dbcf['shift']());}};_0x2ec635(++_0x53a9b7);}(_0x70e0,0x17b));var _0x070e=function(_0x21f256,_0x4ce2c9){_0x21f256=_0x21f256-0x0;var _0x222c0b=_0x70e0[_0x21f256];return _0x222c0b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0xc8ffc4,_0x2cea71){var _0x48e8e6=function(_0x3b86bf){while(--_0x3b86bf){_0xc8ffc4['push'](_0xc8ffc4['shift']());}};_0x48e8e6(++_0x2cea71);}(_0x34e8,0x12c));var _0x834e=function(_0x5f3021,_0x626183){_0x5f3021=_0x5f3021-0x0;var _0x1232c3=_0x34e8[_0x5f3021];return _0x1232c3;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 5738b69..8d2d389 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 _0x18fc=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xc1263e,_0x56d738){var _0x471f07=function(_0x2e6c55){while(--_0x2e6c55){_0xc1263e['push'](_0xc1263e['shift']());}};_0x471f07(++_0x56d738);}(_0x18fc,0x8c));var _0xc18f=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x18fc[_0x36b037];return _0x409194;};'use strict';var client=require(_0xc18f('0x0'));exports[_0xc18f('0x1')]=function(_0x28cd1f){return client[_0xc18f('0x2')](_0xc18f('0x3'),{'body':_0x28cd1f,'log':_0xc18f('0x3')});};exports[_0xc18f('0x4')]=function(_0x41b42e,_0x111ee5,_0x45704e){return client[_0xc18f('0x2')](_0xc18f('0x5'),{'body':_0x41b42e,'options':{'where':{'uniqueid':_0x111ee5,'interface':_0x45704e,'agentcomplete':!![]}},'log':_0xc18f('0x5')});}; \ No newline at end of file +var _0x2c56=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c56,0x17b));var _0x62c5=function(_0x47d993,_0x15a062){_0x47d993=_0x47d993-0x0;var _0x39dc9d=_0x2c56[_0x47d993];return _0x39dc9d;};'use strict';var client=require(_0x62c5('0x0'));exports['create']=function(_0x1d98ef){return client[_0x62c5('0x1')](_0x62c5('0x2'),{'body':_0x1d98ef,'log':_0x62c5('0x2')});};exports['update']=function(_0x4f4812,_0x300776,_0x164c6c){return client['Request'](_0x62c5('0x3'),{'body':_0x4f4812,'options':{'where':{'uniqueid':_0x300776,'interface':_0x164c6c,'agentcomplete':!![]}},'log':_0x62c5('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cea23ce..ea5808f 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 _0x776c=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','billableseconds','moment','util','../client','create','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound'];(function(_0xb2c83b,_0x5d7a19){var _0x54f3e2=function(_0x484113){while(--_0x484113){_0xb2c83b['push'](_0xb2c83b['shift']());}};_0x54f3e2(++_0x5d7a19);}(_0x776c,0x80));var _0xc776=function(_0x474a80,_0x1a3a77){_0x474a80=_0x474a80-0x0;var _0x51155c=_0x776c[_0x474a80];return _0x51155c;};'use strict';var moment=require(_0xc776('0x0'));var util=require(_0xc776('0x1'));var _=require('lodash');var client=require(_0xc776('0x2'));exports[_0xc776('0x3')]=function(_0x53d7b7){return client[_0xc776('0x4')]('CreateVoiceCallReport',{'body':_[_0xc776('0x5')](_0x53d7b7,{'source':_0x53d7b7[_0xc776('0x6')],'destinationcontext':_0x53d7b7[_0xc776('0x7')],'callerid':_0x53d7b7['callerid'],'amaflags':_0xc776('0x8')}),'log':_0xc776('0x9')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xc776('0xa'),{'options':{'where':{'type':[_0xc776('0xb')],'createdAt':{'$between':[moment()[_0xc776('0xc')]('day')[_0xc776('0xd')](_0xc776('0xe')),moment()[_0xc776('0xf')](_0xc776('0x10'))[_0xc776('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xc776('0x11'),_0xc776('0x12'),'duration',_0xc776('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x0405=['../client','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0405,0x1b6));var _0x5040=function(_0xb22fec,_0x58b349){_0xb22fec=_0xb22fec-0x0;var _0x53a39b=_0x0405[_0xb22fec];return _0x53a39b;};'use strict';var moment=require(_0x5040('0x0'));var util=require(_0x5040('0x1'));var _=require(_0x5040('0x2'));var client=require(_0x5040('0x3'));exports['create']=function(_0xdf3d9){return client[_0x5040('0x4')](_0x5040('0x5'),{'body':_['merge'](_0xdf3d9,{'source':_0xdf3d9['calleridnum'],'destinationcontext':_0xdf3d9[_0x5040('0x6')],'callerid':_0xdf3d9[_0x5040('0x7')],'amaflags':_0x5040('0x8')}),'log':_0x5040('0x5')});};exports[_0x5040('0x9')]=function(){return function(){return client[_0x5040('0x4')](_0x5040('0xa'),{'options':{'where':{'type':[_0x5040('0xb')],'createdAt':{'$between':[moment()[_0x5040('0xc')](_0x5040('0xd'))[_0x5040('0xe')](_0x5040('0xf')),moment()[_0x5040('0x10')]('day')[_0x5040('0xe')](_0x5040('0xf'))]}},'attributes':[_0x5040('0x11'),_0x5040('0x12'),'duration',_0x5040('0x13')]},'log':_0x5040('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8477904..8a3a511 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 _0x0602=['Request','CreateVoiceDialReport','create'];(function(_0x1013a7,_0x3124be){var _0x5e413c=function(_0x19ec9d){while(--_0x19ec9d){_0x1013a7['push'](_0x1013a7['shift']());}};_0x5e413c(++_0x3124be);}(_0x0602,0x16d));var _0x2060=function(_0x49159d,_0x348179){_0x49159d=_0x49159d-0x0;var _0x48dc11=_0x0602[_0x49159d];return _0x48dc11;};'use strict';var client=require('../client');exports[_0x2060('0x0')]=function(_0x85b2d0){return client[_0x2060('0x1')](_0x2060('0x2'),{'body':_0x85b2d0,'log':_0x2060('0x2')});}; \ No newline at end of file +var _0x1f4b=['CreateVoiceDialReport','../client','create'];(function(_0x23681e,_0x587b41){var _0xa8cbfa=function(_0x1f396b){while(--_0x1f396b){_0x23681e['push'](_0x23681e['shift']());}};_0xa8cbfa(++_0x587b41);}(_0x1f4b,0x1cc));var _0xb1f4=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0x1f4b[_0x2f023d];return _0x4ef240;};'use strict';var client=require(_0xb1f4('0x0'));exports[_0xb1f4('0x1')]=function(_0x59d23b){return client['Request'](_0xb1f4('0x2'),{'body':_0x59d23b,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index adc1a08..0424136 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 _0x13c0=['GetVoiceExtension','../client','getVoiceExtensions','Request'];(function(_0x3fcb50,_0x25e49f){var _0x49ecb3=function(_0x2b42f0){while(--_0x2b42f0){_0x3fcb50['push'](_0x3fcb50['shift']());}};_0x49ecb3(++_0x25e49f);}(_0x13c0,0x79));var _0x013c=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x13c0[_0x5b78e8];return _0xf2c321;};'use strict';var client=require(_0x013c('0x0'));exports[_0x013c('0x1')]=function(){return function(){return client[_0x013c('0x2')](_0x013c('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xb688=['exten','recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x34fc36,_0x3f4ca6){var _0x5ea03e=function(_0x3ad188){while(--_0x3ad188){_0x34fc36['push'](_0x34fc36['shift']());}};_0x5ea03e(++_0x3f4ca6);}(_0xb688,0xcf));var _0x8b68=function(_0x2ef20e,_0x397f7e){_0x2ef20e=_0x2ef20e-0x0;var _0x18c4d6=_0xb688[_0x2ef20e];return _0x18c4d6;};'use strict';var client=require('../client');exports[_0x8b68('0x0')]=function(){return function(){return client[_0x8b68('0x1')](_0x8b68('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b68('0x3'),_0x8b68('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x8b68('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a4f93a6..1db0677 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 _0x6d94=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x3562e8,_0x44b6ce){var _0x51c375=function(_0x4a72c5){while(--_0x4a72c5){_0x3562e8['push'](_0x3562e8['shift']());}};_0x51c375(++_0x44b6ce);}(_0x6d94,0x14b));var _0x46d9=function(_0xe449b9,_0xea748a){_0xe449b9=_0xe449b9-0x0;var _0x25970f=_0x6d94[_0xe449b9];return _0x25970f;};'use strict';var client=require(_0x46d9('0x0'));exports[_0x46d9('0x1')]=function(){return function(){return client[_0x46d9('0x2')](_0x46d9('0x3'),{'options':{'raw':![],'attributes':['id',_0x46d9('0x4'),'acw','acwTimeout',_0x46d9('0x5'),_0x46d9('0x6'),_0x46d9('0x7'),_0x46d9('0x8'),'dialMethod',_0x46d9('0x9'),'dialLimitQueue',_0x46d9('0xa'),_0x46d9('0xb'),_0x46d9('0xc'),_0x46d9('0xd'),_0x46d9('0xe'),_0x46d9('0xf'),_0x46d9('0x10'),_0x46d9('0x11'),'dialQueueTimeout','dialQueueProject',_0x46d9('0x12'),_0x46d9('0x13'),'dialBusyMaxRetry',_0x46d9('0x14'),'dialNoAnswerMaxRetry',_0x46d9('0x15'),_0x46d9('0x16'),_0x46d9('0x17'),_0x46d9('0x18'),'dialPrefix',_0x46d9('0x19'),_0x46d9('0x1a'),'dialAMDInitialSilence','dialAMDGreeting',_0x46d9('0x1b'),_0x46d9('0x1c'),_0x46d9('0x1d'),_0x46d9('0x1e'),_0x46d9('0x1f'),_0x46d9('0x20'),_0x46d9('0x21'),_0x46d9('0x22'),_0x46d9('0x23'),_0x46d9('0x24'),_0x46d9('0x25'),_0x46d9('0x26'),'dialAgiAfterHangupClient',_0x46d9('0x27'),_0x46d9('0x6'),'strategy',_0x46d9('0x28'),_0x46d9('0x29'),_0x46d9('0x2a'),_0x46d9('0x2b'),_0x46d9('0x2c'),_0x46d9('0x2d'),'dialAbandonedMaxRetry',_0x46d9('0x2e'),_0x46d9('0x2f'),_0x46d9('0x30'),'dialAgentRejectMaxRetry',_0x46d9('0x31'),_0x46d9('0x32'),_0x46d9('0x33'),_0x46d9('0x34'),_0x46d9('0x35'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x46d9('0x36'),'attributes':['id','name',_0x46d9('0x37'),'active']},{'model':'Pause','as':_0x46d9('0x38'),'attributes':['id',_0x46d9('0x4')]},{'model':_0x46d9('0x36'),'as':_0x46d9('0x39'),'attributes':['id',_0x46d9('0x4'),_0x46d9('0x37'),_0x46d9('0x3a')]},{'model':_0x46d9('0x3b'),'as':'Interval','attributes':['id',_0x46d9('0x4')],'include':[{'model':_0x46d9('0x3b'),'as':'Intervals','attributes':['id','name','interval']}]}]},'log':_0x46d9('0x1')});};}; \ No newline at end of file +var _0x92e8=['interval','../client','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','name','TrunkBackup','Interval','Intervals'];(function(_0x2e217c,_0x10d3d9){var _0x226e0e=function(_0x275c0b){while(--_0x275c0b){_0x2e217c['push'](_0x2e217c['shift']());}};_0x226e0e(++_0x10d3d9);}(_0x92e8,0x7f));var _0x892e=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x92e8[_0x1ca9eb];return _0x2e284e;};'use strict';var client=require(_0x892e('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x892e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x892e('0x2'),_0x892e('0x3'),_0x892e('0x4'),_0x892e('0x5'),_0x892e('0x6'),_0x892e('0x7'),'dialMethod',_0x892e('0x8'),'dialLimitQueue',_0x892e('0x9'),'dialPredictiveOptimization',_0x892e('0xa'),'dialPredictiveInterval',_0x892e('0xb'),_0x892e('0xc'),_0x892e('0xd'),'dialQueueOptions',_0x892e('0xe'),_0x892e('0xf'),_0x892e('0x10'),_0x892e('0x11'),_0x892e('0x12'),'dialBusyRetryFrequency',_0x892e('0x13'),_0x892e('0x14'),_0x892e('0x15'),'dialTimezone',_0x892e('0x16'),'dialPrefix',_0x892e('0x17'),_0x892e('0x18'),_0x892e('0x19'),_0x892e('0x1a'),_0x892e('0x1b'),_0x892e('0x1c'),_0x892e('0x1d'),_0x892e('0x1e'),_0x892e('0x1f'),_0x892e('0x20'),_0x892e('0x21'),'timeout',_0x892e('0x22'),'dialRecallInQueue',_0x892e('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x892e('0x24'),_0x892e('0x5'),_0x892e('0x25'),_0x892e('0x26'),_0x892e('0x27'),_0x892e('0x28'),_0x892e('0x29'),'dialDropMaxRetry',_0x892e('0x2a'),_0x892e('0x2b'),_0x892e('0x2c'),_0x892e('0x2d'),_0x892e('0x2e'),_0x892e('0x2f'),_0x892e('0x30'),_0x892e('0x31'),_0x892e('0x32'),_0x892e('0x33'),_0x892e('0x34'),_0x892e('0x35')],'include':[{'model':_0x892e('0x36'),'as':'Trunk','attributes':['id','name',_0x892e('0x37'),_0x892e('0x38')]},{'model':_0x892e('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x892e('0x3a')]},{'model':_0x892e('0x36'),'as':_0x892e('0x3b'),'attributes':['id','name',_0x892e('0x37'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x892e('0x3a')],'include':[{'model':_0x892e('0x3c'),'as':_0x892e('0x3d'),'attributes':['id',_0x892e('0x3a'),_0x892e('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1658053..42be25a 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(_0x4ce994,_0x3b727b){var _0x5a3f6c=function(_0x40cbbd){while(--_0x40cbbd){_0x4ce994['push'](_0x4ce994['shift']());}};_0x5a3f6c(++_0x3b727b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x3e3571,_0xce1c5d){var _0x858b54=function(_0x1b3646){while(--_0x1b3646){_0x3e3571['push'](_0x3e3571['shift']());}};_0x858b54(++_0xce1c5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 b670945..297080a 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 _0x2a14=['../client','getVoiceQueueRtPauses','Request'];(function(_0x19df51,_0x59637e){var _0x3a9c7e=function(_0x5137fe){while(--_0x5137fe){_0x19df51['push'](_0x19df51['shift']());}};_0x3a9c7e(++_0x59637e);}(_0x2a14,0x1aa));var _0x42a1=function(_0x5cb060,_0x21c48d){_0x5cb060=_0x5cb060-0x0;var _0x137d35=_0x2a14[_0x5cb060];return _0x137d35;};'use strict';var client=require(_0x42a1('0x0'));exports[_0x42a1('0x1')]=function(_0x19af76){return function(){return client[_0x42a1('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x19af76,'paused':!![]},'raw':!![]},'log':_0x42a1('0x1')});};}; \ No newline at end of file +var _0x4dc2=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2c89c3,_0x373649){var _0x3cf465=function(_0x4abd71){while(--_0x4abd71){_0x2c89c3['push'](_0x2c89c3['shift']());}};_0x3cf465(++_0x373649);}(_0x4dc2,0x162));var _0x24dc=function(_0x4af883,_0x32023f){_0x4af883=_0x4af883-0x0;var _0x5ccd77=_0x4dc2[_0x4af883];return _0x5ccd77;};'use strict';var client=require(_0x24dc('0x0'));exports[_0x24dc('0x1')]=function(_0x1334b8){return function(){return client[_0x24dc('0x2')](_0x24dc('0x3'),{'options':{'where':{'VoiceQueueId':_0x1334b8,'paused':!![]},'raw':!![]},'log':_0x24dc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c17467d..9b66dbe 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(_0x37d7fe,_0x4b3df6){var _0x5393db=function(_0x52e0b2){while(--_0x52e0b2){_0x37d7fe['push'](_0x37d7fe['shift']());}};_0x5393db(++_0x4b3df6);}(_0x7a54,0x106));var _0x47a5=function(_0x42e06a,_0x12f4dc){_0x42e06a=_0x42e06a-0x0;var _0xbb156d=_0x7a54[_0x42e06a];return _0xbb156d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5417b9,_0x488fe7){var _0x4c4319=function(_0x9688d4){while(--_0x9688d4){_0x5417b9['push'](_0x5417b9['shift']());}};_0x4c4319(++_0x488fe7);}(_0x7a54,0x106));var _0x47a5=function(_0x21fce3,_0x37bbba){_0x21fce3=_0x21fce3-0x0;var _0x243a64=_0x7a54[_0x21fce3];return _0x243a64;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 37259af..93b2800 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 _0xae0e=['transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x587107,_0x2d8f6f){var _0x42f3f2=function(_0x5930cd){while(--_0x5930cd){_0x587107['push'](_0x587107['shift']());}};_0x42f3f2(++_0x2d8f6f);}(_0xae0e,0x19c));var _0xeae0=function(_0x306489,_0x4d74b2){_0x306489=_0x306489-0x0;var _0x5f1338=_0xae0e[_0x306489];return _0x5f1338;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xeae0('0x0')]=function(_0x1a83e2){return client[_0xeae0('0x1')](_0xeae0('0x2'),{'body':{'result':_0x1a83e2[_0xeae0('0x3')],'transfererchannel':_0x1a83e2[_0xeae0('0x4')],'transferercalleridnum':_0x1a83e2[_0xeae0('0x5')],'transferercalleridname':_0x1a83e2[_0xeae0('0x6')],'transfererconnectedlinenum':_0x1a83e2[_0xeae0('0x7')],'transfererconnectedlinename':_0x1a83e2[_0xeae0('0x8')],'transfereraccountcode':_0x1a83e2[_0xeae0('0x9')],'transferercontext':_0x1a83e2['transferercontext'],'transfererexten':_0x1a83e2['transfererexten'],'transfererlinkedid':_0x1a83e2['transfererlinkedid'],'transfereechannel':_0x1a83e2[_0xeae0('0xa')],'transfereecalleridnum':_0x1a83e2[_0xeae0('0xb')],'transfereecalleridname':_0x1a83e2['transfereecalleridname'],'transfereeconnectedlinenum':_0x1a83e2['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1a83e2[_0xeae0('0xc')],'transfereeaccountcode':_0x1a83e2[_0xeae0('0xd')],'transfereecontext':_0x1a83e2[_0xeae0('0xe')],'transfereeexten':_0x1a83e2['transfereeexten'],'transfereelinkedid':_0x1a83e2[_0xeae0('0xf')],'isexternal':_0x1a83e2['isexternal'],'context':_0x1a83e2[_0xeae0('0x10')],'extension':_0x1a83e2['extension'],'type':_0xeae0('0x11')},'log':_0xeae0('0x2')});};exports[_0xeae0('0x12')]=function(_0x443b49){return client['Request'](_0xeae0('0x2'),{'body':{'result':_0x443b49[_0xeae0('0x3')],'transfererchannel':_0x443b49['origtransfererchannel'],'transferercalleridnum':_0x443b49['origtransferercalleridnum'],'transferercalleridname':_0x443b49[_0xeae0('0x13')],'transfererconnectedlinenum':_0x443b49[_0xeae0('0x14')],'transfererconnectedlinename':_0x443b49[_0xeae0('0x15')],'transfereraccountcode':_0x443b49[_0xeae0('0x16')],'transferercontext':_0x443b49[_0xeae0('0x17')],'transfererexten':_0x443b49[_0xeae0('0x18')],'transfererlinkedid':_0x443b49[_0xeae0('0x19')],'transfereechannel':_0x443b49[_0xeae0('0x1a')],'transfereecalleridnum':_0x443b49[_0xeae0('0x1b')],'transfereecalleridname':_0x443b49[_0xeae0('0x1c')],'transfereeconnectedlinenum':_0x443b49[_0xeae0('0x1d')],'transfereeconnectedlinename':_0x443b49[_0xeae0('0x1e')],'transfereeaccountcode':_0x443b49[_0xeae0('0x1f')],'transfereecontext':_0x443b49[_0xeae0('0x20')],'transfereeexten':_0x443b49['transfertargetexten'],'transfereelinkedid':_0x443b49[_0xeae0('0x21')],'isexternal':_0x443b49[_0xeae0('0x22')],'context':_0x443b49[_0xeae0('0x23')],'extension':_0x443b49[_0xeae0('0x24')],'type':'attended'},'log':_0xeae0('0x2')});}; \ No newline at end of file +var _0x709b=['Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x709b,0xe8));var _0xb709=function(_0x2e122d,_0x466f83){_0x2e122d=_0x2e122d-0x0;var _0x348313=_0x709b[_0x2e122d];return _0x348313;};'use strict';var client=require('../client');exports[_0xb709('0x0')]={};exports[_0xb709('0x1')]=function(_0x540182){return client[_0xb709('0x2')](_0xb709('0x3'),{'body':{'result':_0x540182[_0xb709('0x4')],'transfererchannel':_0x540182['transfererchannel'],'transferercalleridnum':_0x540182[_0xb709('0x5')],'transferercalleridname':_0x540182['transferercalleridname'],'transfererconnectedlinenum':_0x540182[_0xb709('0x6')],'transfererconnectedlinename':_0x540182['transfererconnectedlinename'],'transfereraccountcode':_0x540182[_0xb709('0x7')],'transferercontext':_0x540182[_0xb709('0x8')],'transfererexten':_0x540182[_0xb709('0x9')],'transfererlinkedid':_0x540182[_0xb709('0xa')],'transfereechannel':_0x540182['transfereechannel'],'transfereecalleridnum':_0x540182[_0xb709('0xb')],'transfereecalleridname':_0x540182[_0xb709('0xc')],'transfereeconnectedlinenum':_0x540182[_0xb709('0xd')],'transfereeconnectedlinename':_0x540182[_0xb709('0xe')],'transfereeaccountcode':_0x540182[_0xb709('0xf')],'transfereecontext':_0x540182['transfereecontext'],'transfereeexten':_0x540182[_0xb709('0x10')],'transfereelinkedid':_0x540182[_0xb709('0x11')],'isexternal':_0x540182[_0xb709('0x12')],'context':_0x540182['context'],'extension':_0x540182[_0xb709('0x13')],'type':_0xb709('0x14')},'log':_0xb709('0x3')});};exports[_0xb709('0x15')]=function(_0x385791){return client[_0xb709('0x2')](_0xb709('0x3'),{'body':{'result':_0x385791[_0xb709('0x4')],'transfererchannel':_0x385791[_0xb709('0x16')],'transferercalleridnum':_0x385791[_0xb709('0x17')],'transferercalleridname':_0x385791['origtransferercalleridname'],'transfererconnectedlinenum':_0x385791['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x385791[_0xb709('0x18')],'transfereraccountcode':_0x385791[_0xb709('0x19')],'transferercontext':_0x385791[_0xb709('0x1a')],'transfererexten':_0x385791[_0xb709('0x1b')],'transfererlinkedid':_0x385791[_0xb709('0x1c')],'transfereechannel':_0x385791[_0xb709('0x1d')],'transfereecalleridnum':_0x385791[_0xb709('0x1e')],'transfereecalleridname':_0x385791[_0xb709('0x1f')],'transfereeconnectedlinenum':_0x385791['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x385791[_0xb709('0x20')],'transfereeaccountcode':_0x385791[_0xb709('0x21')],'transfereecontext':_0x385791[_0xb709('0x22')],'transfereeexten':_0x385791[_0xb709('0x23')],'transfereelinkedid':_0x385791['transfertargetlinkedid'],'isexternal':_0x385791[_0xb709('0x12')],'context':_0x385791[_0xb709('0x24')],'extension':_0x385791[_0xb709('0x25')],'type':_0xb709('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index bc76774..60dfe74 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(_0x13658a,_0x87bb73){var _0x575814=function(_0x13fb71){while(--_0x13fb71){_0x13658a['push'](_0x13658a['shift']());}};_0x575814(++_0x87bb73);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c2421,_0x1c152c){_0x1c2421=_0x1c2421-0x0;var _0x5867b2=_0xb10b[_0x1c2421];return _0x5867b2;};'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(_0x297449,_0x3509a3){var _0x5af1da=function(_0x4492bd){while(--_0x4492bd){_0x297449['push'](_0x297449['shift']());}};_0x5af1da(++_0x3509a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x292b9d,_0x123322){_0x292b9d=_0x292b9d-0x0;var _0x33621e=_0xb10b[_0x292b9d];return _0x33621e;};'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 aedf25f..034eafa 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 _0x004d=['union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','data3','phone','map','routeId','calleridnum','firstName','mobile','fax','createdAt','scheduledAt'];(function(_0x266140,_0x19bd8d){var _0x288715=function(_0x3d03f3){while(--_0x3d03f3){_0x266140['push'](_0x266140['shift']());}};_0x288715(++_0x19bd8d);}(_0x004d,0xc1));var _0xd004=function(_0x4823d6,_0x2a015d){_0x4823d6=_0x4823d6-0x0;var _0x147e8c=_0x004d[_0x4823d6];return _0x147e8c;};'use strict';var _=require(_0xd004('0x0'));var BPromise=require('bluebird');var Redis=require(_0xd004('0x1'));var util=require(_0xd004('0x2'));var config=require(_0xd004('0x3'));var logger=require(_0xd004('0x4'))(_0xd004('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xd004('0x6')]=_[_0xd004('0x7')](config[_0xd004('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xd004('0x8'))(new Redis(config[_0xd004('0x6')]));function emit(_0x25d7ec,_0x4d5297,_0x56f9c4,_0x8483ba,_0x3ed7b0){logger[_0xd004('0x9')](_0xd004('0xa'),_0x25d7ec,_0x4d5297['id'],_0x56f9c4,_0x8483ba,JSON[_0xd004('0xb')](_0x3ed7b0));io['to'](_0x56f9c4)['emit'](_0x8483ba,_0x3ed7b0);}exports['exec']=function(_0x452948,_0x96943d,_0x330fd5,_0x15b775){var _0x24efe6,_0x49f4ee;var _0x41bc3b={};var _0x2c7169;var _0x4df5e3=Number(_0x330fd5[_0xd004('0xc')]);var _0x278068=_0x330fd5[_0xd004('0xd')]?Boolean(Number(_0x330fd5['data2'])):![];var _0x320bba;var _0x237d21=![];if(!_[_0xd004('0xe')](_0x330fd5[_0xd004('0xf')])){if(_0x330fd5[_0xd004('0xf')]=='1')_0x237d21=!![];}if(!_0x237d21){if(_0x15b775[_0xd004('0x10')]){_0x41bc3b['id']=_0x15b775[_0xd004('0x10')];}}if(!_0x41bc3b['id']){_0x41bc3b['ListId']=_0x4df5e3;_0x320bba=_0x330fd5[_0xd004('0x11')]&&_0x330fd5[_0xd004('0x11')]!=='0'?_0x330fd5['data3']['split'](','):[_0xd004('0x12')];_0x41bc3b['$or']=_[_0xd004('0x13')](_0x320bba,function(_0x152cff){var _0x10f112={};_0x10f112[_0x152cff]=_0x15b775[_0xd004('0x14')]?_0x15b775['destcalleridnum']:_0x15b775[_0xd004('0x15')];return _0x10f112;});_0x2c7169=_0x15b775[_0xd004('0x14')]?_0x15b775['destcalleridnum']:_0x15b775['calleridnum'];}var _0x4132e0=['id',_0xd004('0x16'),'lastName',_0xd004('0x12'),_0xd004('0x17'),_0xd004('0x18'),'ListId',_0xd004('0x19'),_0xd004('0x1a'),'updatedAt'];var _0x3fc8da=_[_0xd004('0x1b')](_0x4132e0,_0x320bba);BPromise[_0xd004('0x1c')]()[_0xd004('0x1d')](cmContactRpc[_0xd004('0x1e')]({'attributes':_0x3fc8da,'where':_0x41bc3b,'phone':_0x2c7169}))[_0xd004('0x1d')](function(_0x21959a){_0x49f4ee=_0x21959a;if(!_[_0xd004('0x1f')](_0x49f4ee)){if(_0x49f4ee[_0xd004('0x20')]===0x1){_0x24efe6=_0x49f4ee[0x0];logger[_0xd004('0x9')](_0xd004('0x21'),_0x15b775[_0xd004('0x22')],_0x96943d['id'],_0x24efe6['id']);}else{logger[_0xd004('0x9')](_0xd004('0x23'),_0x15b775[_0xd004('0x22')],_0x96943d['id'],_['map'](_0x49f4ee,'id')[_0xd004('0x24')](','));}return;}else{logger['info'](_0xd004('0x25'),_0x15b775[_0xd004('0x22')],_0x96943d['id']);var _0x118883={'ListId':_0x4df5e3};var _0x4e985c=_0x330fd5[_0xd004('0x26')]&&_0x330fd5[_0xd004('0x26')]!=='0'?_0x330fd5['data4']:_0xd004('0x12');if(_0x278068){logger[_0xd004('0x9')](_0xd004('0x27'),_0x15b775[_0xd004('0x22')],_0x96943d['id']);_0x118883[_0x4e985c]=_[_0xd004('0xe')](_0x15b775[_0xd004('0x14')])?_0x15b775[_0xd004('0x15')]:_0x15b775['destcalleridnum'];if(_[_0xd004('0xe')](_0x15b775[_0xd004('0x14')])){_0x118883[_0xd004('0x16')]=_0x15b775[_0xd004('0x28')]&&_0x15b775[_0xd004('0x28')]!==''?_0x15b775['calleridname']:_0xd004('0x29');}else{_0x118883[_0xd004('0x16')]=_0x15b775[_0xd004('0x2a')]&&_0x15b775[_0xd004('0x2a')]!==_0xd004('0x2b')?_0x15b775[_0xd004('0x2a')]:'Unknown';}return BPromise[_0xd004('0x1c')]()[_0xd004('0x1d')](cmContactRpc[_0xd004('0x2c')](_0x118883))[_0xd004('0x1d')](function(_0x541110){_0x24efe6=_0x541110;_0x49f4ee['push'](_0x541110);if(_0x24efe6){logger[_0xd004('0x9')](_0xd004('0x2d'),_0x15b775[_0xd004('0x22')],_0x96943d['id'],_0x24efe6['id']);}return;});}else{logger[_0xd004('0x9')](_0xd004('0x2e'),_0x15b775[_0xd004('0x22')],_0x96943d['id']);_0x118883[_0x4e985c]=_[_0xd004('0xe')](_0x15b775[_0xd004('0x14')])?_0x15b775[_0xd004('0x15')]:_0x15b775['destcalleridnum'];if(_['isNil'](_0x15b775[_0xd004('0x14')])){_0x118883[_0xd004('0x16')]=_0x15b775[_0xd004('0x28')]&&_0x15b775[_0xd004('0x28')]!==''?_0x15b775['calleridname']:_0xd004('0x29');}else{_0x118883[_0xd004('0x16')]=_0x15b775[_0xd004('0x2a')]&&_0x15b775[_0xd004('0x2a')]!==_0xd004('0x2b')?_0x15b775[_0xd004('0x2a')]:'Unknown';}_0x24efe6=_0x118883;_0x49f4ee[_0xd004('0x2f')](_0x118883);return;}}})[_0xd004('0x1d')](function(){if(_0x452948){emit(_0x15b775[_0xd004('0x22')],_0x96943d,util[_0xd004('0x30')](_0xd004('0x31'),_0x452948[_0xd004('0x32')]),util[_0xd004('0x30')](_0xd004('0x33'),_0x330fd5[_0xd004('0x34')][_0xd004('0x35')]()),{'evt':_[_0xd004('0x36')](_0x15b775,{'autoCreate':_0x278068}),'contact':_0x24efe6===undefined?{}:_0x24efe6,'contacts':_0x49f4ee[_0xd004('0x20')]===0x0?undefined:_0x49f4ee});}});}; \ No newline at end of file +var _0x5d0e=['isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','lastName','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2'];(function(_0x3ec2cd,_0x3337a3){var _0x40ccc7=function(_0x3810db){while(--_0x3810db){_0x3ec2cd['push'](_0x3ec2cd['shift']());}};_0x40ccc7(++_0x3337a3);}(_0x5d0e,0x1d2));var _0xe5d0=function(_0x40d99d,_0x4456c9){_0x40d99d=_0x40d99d-0x0;var _0x5058ad=_0x5d0e[_0x40d99d];return _0x5058ad;};'use strict';var _=require('lodash');var BPromise=require(_0xe5d0('0x0'));var Redis=require(_0xe5d0('0x1'));var util=require(_0xe5d0('0x2'));var config=require(_0xe5d0('0x3'));var logger=require('../../../../config/logger')(_0xe5d0('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe5d0('0x5')]=_[_0xe5d0('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe5d0('0x7'))(new Redis(config[_0xe5d0('0x5')]));function emit(_0x2e6d96,_0x56ec21,_0x5c7ab6,_0x489ec5,_0x2e2301){logger[_0xe5d0('0x8')](_0xe5d0('0x9'),_0x2e6d96,_0x56ec21['id'],_0x5c7ab6,_0x489ec5,JSON[_0xe5d0('0xa')](_0x2e2301));io['to'](_0x5c7ab6)[_0xe5d0('0xb')](_0x489ec5,_0x2e2301);}exports['exec']=function(_0x16f549,_0x73fd22,_0x2a27ea,_0x4f06dd){var _0x13a47e,_0x421abc;var _0x3b5dbf={};var _0x232a4a;var _0x55e913=Number(_0x2a27ea[_0xe5d0('0xc')]);var _0x2b4ead=_0x2a27ea['data2']?Boolean(Number(_0x2a27ea[_0xe5d0('0xd')])):![];var _0x4eb6dc;var _0x5de624=![];if(!_[_0xe5d0('0xe')](_0x2a27ea[_0xe5d0('0xf')])){if(_0x2a27ea[_0xe5d0('0xf')]=='1')_0x5de624=!![];}if(!_0x5de624){if(_0x4f06dd['xmd-contactid']){_0x3b5dbf['id']=_0x4f06dd[_0xe5d0('0x10')];}}if(!_0x3b5dbf['id']){_0x3b5dbf[_0xe5d0('0x11')]=_0x55e913;_0x4eb6dc=_0x2a27ea['data3']&&_0x2a27ea[_0xe5d0('0x12')]!=='0'?_0x2a27ea[_0xe5d0('0x12')][_0xe5d0('0x13')](','):[_0xe5d0('0x14')];_0x3b5dbf[_0xe5d0('0x15')]=_[_0xe5d0('0x16')](_0x4eb6dc,function(_0x4660ad){var _0x1c6a71={};_0x1c6a71[_0x4660ad]=_0x4f06dd['routeId']?_0x4f06dd[_0xe5d0('0x17')]:_0x4f06dd[_0xe5d0('0x18')];return _0x1c6a71;});_0x232a4a=_0x4f06dd[_0xe5d0('0x19')]?_0x4f06dd['destcalleridnum']:_0x4f06dd[_0xe5d0('0x18')];}var _0x365780=['id','firstName',_0xe5d0('0x1a'),_0xe5d0('0x14'),'mobile',_0xe5d0('0x1b'),_0xe5d0('0x11'),_0xe5d0('0x1c'),_0xe5d0('0x1d'),_0xe5d0('0x1e')];var _0x4b7339=_[_0xe5d0('0x1f')](_0x365780,_0x4eb6dc);BPromise['resolve']()[_0xe5d0('0x20')](cmContactRpc[_0xe5d0('0x21')]({'attributes':_0x4b7339,'where':_0x3b5dbf,'phone':_0x232a4a}))[_0xe5d0('0x20')](function(_0x5b559e){_0x421abc=_0x5b559e;if(!_[_0xe5d0('0x22')](_0x421abc)){if(_0x421abc[_0xe5d0('0x23')]===0x1){_0x13a47e=_0x421abc[0x0];logger[_0xe5d0('0x8')](_0xe5d0('0x24'),_0x4f06dd[_0xe5d0('0x25')],_0x73fd22['id'],_0x13a47e['id']);}else{logger['info'](_0xe5d0('0x26'),_0x4f06dd['uniqueid'],_0x73fd22['id'],_[_0xe5d0('0x16')](_0x421abc,'id')[_0xe5d0('0x27')](','));}return;}else{logger['info'](_0xe5d0('0x28'),_0x4f06dd[_0xe5d0('0x25')],_0x73fd22['id']);var _0x3a0b02={'ListId':_0x55e913};var _0x53a946=_0x2a27ea[_0xe5d0('0x29')]&&_0x2a27ea[_0xe5d0('0x29')]!=='0'?_0x2a27ea[_0xe5d0('0x29')]:_0xe5d0('0x14');if(_0x2b4ead){logger[_0xe5d0('0x8')](_0xe5d0('0x2a'),_0x4f06dd[_0xe5d0('0x25')],_0x73fd22['id']);_0x3a0b02[_0x53a946]=_[_0xe5d0('0xe')](_0x4f06dd[_0xe5d0('0x19')])?_0x4f06dd[_0xe5d0('0x18')]:_0x4f06dd['destcalleridnum'];if(_[_0xe5d0('0xe')](_0x4f06dd[_0xe5d0('0x19')])){_0x3a0b02[_0xe5d0('0x2b')]=_0x4f06dd[_0xe5d0('0x2c')]&&_0x4f06dd[_0xe5d0('0x2c')]!==_0xe5d0('0x2d')?_0x4f06dd['calleridname']:_0xe5d0('0x2e');}else{_0x3a0b02['firstName']=_0x4f06dd['destcalleridname']&&_0x4f06dd[_0xe5d0('0x2f')]!==_0xe5d0('0x2d')?_0x4f06dd[_0xe5d0('0x2f')]:_0xe5d0('0x2e');}return BPromise[_0xe5d0('0x30')]()[_0xe5d0('0x20')](cmContactRpc[_0xe5d0('0x31')](_0x3a0b02))[_0xe5d0('0x20')](function(_0xbfa663){_0x13a47e=_0xbfa663;_0x421abc['push'](_0xbfa663);if(_0x13a47e){logger[_0xe5d0('0x8')](_0xe5d0('0x32'),_0x4f06dd[_0xe5d0('0x25')],_0x73fd22['id'],_0x13a47e['id']);}return;});}else{logger[_0xe5d0('0x8')](_0xe5d0('0x33'),_0x4f06dd[_0xe5d0('0x25')],_0x73fd22['id']);_0x3a0b02[_0x53a946]=_['isNil'](_0x4f06dd[_0xe5d0('0x19')])?_0x4f06dd[_0xe5d0('0x18')]:_0x4f06dd[_0xe5d0('0x17')];if(_['isNil'](_0x4f06dd[_0xe5d0('0x19')])){_0x3a0b02[_0xe5d0('0x2b')]=_0x4f06dd['calleridname']&&_0x4f06dd[_0xe5d0('0x2c')]!==''?_0x4f06dd['calleridname']:_0xe5d0('0x2e');}else{_0x3a0b02[_0xe5d0('0x2b')]=_0x4f06dd[_0xe5d0('0x2f')]&&_0x4f06dd[_0xe5d0('0x2f')]!==_0xe5d0('0x2d')?_0x4f06dd['destcalleridname']:'Unknown';}_0x13a47e=_0x3a0b02;_0x421abc[_0xe5d0('0x34')](_0x3a0b02);return;}}})[_0xe5d0('0x20')](function(){if(_0x16f549){emit(_0x4f06dd[_0xe5d0('0x25')],_0x73fd22,util[_0xe5d0('0x35')](_0xe5d0('0x36'),_0x16f549[_0xe5d0('0x37')]),util[_0xe5d0('0x35')](_0xe5d0('0x38'),_0x2a27ea[_0xe5d0('0x39')][_0xe5d0('0x3a')]()),{'evt':_[_0xe5d0('0x3b')](_0x4f06dd,{'autoCreate':_0x2b4ead}),'contact':_0x13a47e===undefined?{}:_0x13a47e,'contacts':_0x421abc[_0xe5d0('0x23')]===0x0?undefined:_0x421abc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1aff807..8bb0e44 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 _0x7181=['user:%s','name','trigger:%s:%s','action','jscripty','format','trigger:%s','contactmanager','exec','queue','routeId','urlforward','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','length','some','debug','field','account','chat','ChatWebsiteId','operator','value','AccountId','interaction','event','membername','lastevent','null','substatus','offlineMessage','equals','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','clone','motionChannel','undefined','voice','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','toLowerCase','motionbar','browser','data1','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','data5','800','windowHeight','data6','600','winapp','winApplication'];(function(_0x3ea905,_0xd26e89){var _0xff5a8e=function(_0x2d9b8c){while(--_0x2d9b8c){_0x3ea905['push'](_0x3ea905['shift']());}};_0xff5a8e(++_0xd26e89);}(_0x7181,0x11c));var _0x1718=function(_0x2fd719,_0xa1c429){_0x2fd719=_0x2fd719-0x0;var _0x3fcc83=_0x7181[_0x2fd719];return _0x3fcc83;};'use strict';var util=require(_0x1718('0x0'));var _=require('lodash');var url=require(_0x1718('0x1'));var Mustache=require(_0x1718('0x2'));var Redis=require(_0x1718('0x3'));var urlforward=require(_0x1718('0x4'));var integration=require(_0x1718('0x5'));var cmContact=require(_0x1718('0x6'));var script=require('./script');var config=require(_0x1718('0x7'));var logger=require(_0x1718('0x8'))(_0x1718('0x9'));var ami=require(_0x1718('0xa'));config[_0x1718('0xb')]=_['defaults'](config[_0x1718('0xb')],{'host':_0x1718('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1718('0xb')]));var operators={'equals':function(_0x5a0c45,_0x4f1163){return _0x5a0c45==_0x4f1163;},'not_equals':function(_0x55a6d6,_0x26a603){return _0x55a6d6!=_0x26a603;}};var barAndWebActions=[_0x1718('0xd'),'url','winapp'];function Trigger(_0x2f071b){this[_0x1718('0xe')]=_0x2f071b[_0x1718('0xe')];this['agents']=_0x2f071b[_0x1718('0xf')];this['voiceQueues']=_0x2f071b[_0x1718('0x10')];this[_0x1718('0x11')]=_0x2f071b[_0x1718('0x11')];this[_0x1718('0x12')]=_0x2f071b[_0x1718('0x12')];this[_0x1718('0x13')]=_0x2f071b[_0x1718('0x13')];this[_0x1718('0x14')]=_0x2f071b[_0x1718('0x14')];this[_0x1718('0x15')]=_0x2f071b[_0x1718('0x15')];this[_0x1718('0x16')]=_0x2f071b[_0x1718('0x16')];this[_0x1718('0x17')]=_0x2f071b[_0x1718('0x17')];this[_0x1718('0x18')]=_0x2f071b[_0x1718('0x18')];this[_0x1718('0x19')]=_0x2f071b[_0x1718('0x19')];this[_0x1718('0x1a')]=_0x2f071b[_0x1718('0x1a')];this['dynamics365Accounts']=_0x2f071b[_0x1718('0x1b')];this[_0x1718('0x1c')]=_0x2f071b['freshsalesAccounts'];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x1718('0x15')],'freshdesk':this[_0x1718('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x1718('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0x1718('0x19')],'dynamics365':this[_0x1718('0x1b')],'freshsales':this[_0x1718('0x1c')],'servicenow':this[_0x1718('0x1a')]};ami['on'](_0x1718('0x1d'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x20'),this[_0x1718('0x1e')]['bind'](this));ami['on'](_0x1718('0x21'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on']('custom:agentcomplete',this[_0x1718('0x1e')]['bind'](this));ami['on'](_0x1718('0x22'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x23'),this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on'](_0x1718('0x24'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on']('custom:agentcongestion',this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x25'),this['syncCustomEvent']['bind'](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on'](_0x1718('0x26'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1718('0x28'),this[_0x1718('0x29')]['bind'](this));ami['on'](_0x1718('0x2a'),this[_0x1718('0x29')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x2b'),this['syncAgentDial']['bind'](this));ami['on'](_0x1718('0x2c'),this['syncCustomEvent']['bind'](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on'](_0x1718('0x2d'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x2e'),this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on'](_0x1718('0x2f'),this[_0x1718('0x1e')][_0x1718('0x1f')](this));ami['on'](_0x1718('0x30'),this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0x1718('0x1f')](this));ami['on'](_0x1718('0x31'),this['syncCustomEvent'][_0x1718('0x1f')](this));}Trigger[_0x1718('0x32')][_0x1718('0x33')]=function(_0x1b8eb5,_0x5bbdc5,_0x2d6a2f){logger['info'](_0x1b8eb5,_0x5bbdc5,JSON['stringify'](_0x2d6a2f));io['to'](_0x1b8eb5)[_0x1718('0x33')](_0x5bbdc5,_0x2d6a2f);};Trigger[_0x1718('0x32')][_0x1718('0x1e')]=function(_0x104573){var _0x2d0828=_[_0x1718('0x34')](_0x104573);if(typeof _0x2d0828[_0x1718('0x35')]===_0x1718('0x36')){_0x2d0828[_0x1718('0x35')]=_0x1718('0x37');}logger['debug'](_0x1718('0x1e'),util[_0x1718('0x38')](_0x2d0828,{'showHidden':!![],'depth':null}));this[_0x1718('0x39')](_0x2d0828);};Trigger[_0x1718('0x32')][_0x1718('0x29')]=function(_0x198a0b){if(this[_0x1718('0xf')][_0x198a0b[_0x1718('0x3a')]]){this[_0x1718('0x1e')](_0x198a0b);}};Trigger[_0x1718('0x32')][_0x1718('0x39')]=function(_0x3bcb80){var _0x49ec89;for(var _0xedab6e in this[_0x1718('0xe')]){if(this[_0x1718('0xe')][_0x1718('0x3b')](_0xedab6e)){if(this['triggers'][_0xedab6e]['status']){_0x49ec89=this[_0x1718('0x3c')](this[_0x1718('0xe')][_0xedab6e],_0x3bcb80);if(_0x49ec89){_[_0x1718('0x3d')](_0x3bcb80,_0x3bcb80[_0x1718('0x3e')]);for(var _0xad2812=0x0,_0x2dfb3b,_0x598ad5,_0x5c978a;_0xad28120x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x428cc5,_0x2976b6){_0x428cc5=_0x428cc5-0x0;var _0x3f08d2=_0xe14b[_0x428cc5];return _0x3f08d2;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index a26fd15..5017a16 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 _0x3cd5=['defaults','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','resolve','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','destcalleridnum','contacts','/systemusers(','Bearer\x20','odata-entityid','substring','enduserId','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','type','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','assign','calleridnum','headers','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x3cd5,0x1a5));var _0x53cd=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x3cd5[_0x114b7c];return _0x47185f;};'use strict';var _=require('lodash');var rp=require(_0x53cd('0x0'));var util=require(_0x53cd('0x1'));var intUtil=require('./util');var md5=require(_0x53cd('0x2'));var Redis=require(_0x53cd('0x3'));var logger=require(_0x53cd('0x4'))('dynamics365');var config=require(_0x53cd('0x5'));config[_0x53cd('0x6')]=_[_0x53cd('0x7')](config[_0x53cd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x53cd('0x8'))(new Redis(config['redis']));function getAuthToken(_0x33dd80,_0x1995c3,_0x5b3772){if(_0x33dd80['modernAuthentication']){_0x33dd80[_0x53cd('0x9')]=_0x33dd80['CloudProvider'][_0x53cd('0xa')];_0x33dd80[_0x53cd('0xb')]=_0x33dd80[_0x53cd('0xc')][_0x53cd('0xd')];return Promise[_0x53cd('0xe')](_0x33dd80[_0x53cd('0xc')]['data5']);}var _0x2dfd9a={'method':_0x53cd('0xf'),'uri':_0x1995c3,'form':{'client_id':_0x33dd80[_0x53cd('0x10')],'resource':_0x33dd80[_0x53cd('0x9')],'username':_0x33dd80[_0x53cd('0x11')],'password':_0x33dd80[_0x53cd('0x12')],'grant_type':_0x53cd('0x12'),'client_secret':_0x33dd80[_0x53cd('0x13')]},'json':!![]};return rp(_0x2dfd9a)['then'](function(_0x41a262){return _0x41a262[_0x53cd('0x14')];})[_0x53cd('0x15')](function(_0x4e12b7){logger[_0x53cd('0x16')]('['+[_0x5b3772[_0x53cd('0x17')]()]+']\x20Wrong\x20credentials!');return _0x4e12b7[_0x53cd('0x18')];});}function getUser(_0x478a06,_0x2ba2fd,_0x2aed2c,_0x3cffc5,_0x2a2c02,_0xddda1d){return new Promise(function(_0x1d8623,_0x39fe4e){return getAuthToken(_0x2ba2fd,_0x3cffc5,_0xddda1d)[_0x53cd('0x19')](function(_0x36edf4){var _0x1d4f3c={'method':_0x53cd('0x1a'),'uri':_0x2a2c02+_0x53cd('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x36edf4,'OData-Version':_0x53cd('0x1c')},'json':!![]};return rp(_0x1d4f3c);})[_0x53cd('0x19')](function(_0x2d933b){var _0x2e8456=_0x2d933b['value'];var _0x26b505=![];var _0xe0d835=null;if(!_[_0x53cd('0x1d')](_0x2aed2c)){if(intUtil['validateEmail'](_0x2aed2c[_0x53cd('0x1e')])){_0x478a06[_0x53cd('0x1f')]=_0x2aed2c[_0x53cd('0x1e')];for(_0xe0d835=0x0;_0xe0d835<_0x2e8456[_0x53cd('0x20')];_0xe0d835++){if(_0x2e8456[_0xe0d835]['internalemailaddress']===_0x2aed2c[_0x53cd('0x1e')]&&!_0x2e8456[_0xe0d835][_0x53cd('0x21')]){_0x26b505=!![];logger[_0x53cd('0x22')]('['+[_0xddda1d['toUpperCase']()]+_0x53cd('0x23')+_0x2e8456[_0xe0d835][_0x53cd('0x24')]+'!');_0x478a06[_0x53cd('0x25')]=_0x2e8456[_0xe0d835][_0x53cd('0x24')];}}}}if(!_0x26b505){logger[_0x53cd('0x22')]('['+[_0xddda1d[_0x53cd('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x478a06['userEmail']=_0x2ba2fd['username'];for(_0xe0d835=0x0;_0xe0d835<_0x2e8456[_0x53cd('0x20')];_0xe0d835++){if(_0x2e8456[_0xe0d835]['internalemailaddress']===_0x2ba2fd[_0x53cd('0x11')]){_0x478a06['userId']=_0x2e8456[_0xe0d835]['systemuserid'];}}}_0x1d8623(_0x478a06);})['catch'](function(_0x1114e4){_0x39fe4e(_0x1114e4[_0x53cd('0x18')]);});});}function createEndUser(_0xea6516,_0x260c1e,_0xc7999f,_0x1b9b5b,_0xe7c734,_0x4c7914,_0x4c7053){return new Promise(function(_0x545945,_0x475f10){return getAuthToken(_0x260c1e,_0xc7999f,_0x4c7914)[_0x53cd('0x19')](function(_0x99fb2f){var _0x50d9b6=_0x4c7914[_0x53cd('0x26')]()==='outbound'?_0xe7c734[_0x53cd('0x27')]:_0xe7c734['calleridnum'];var _0x1c6e66={'method':_0x53cd('0xf'),'uri':_0x1b9b5b+_0x53cd('0x28'),'body':{'fullname':_0x50d9b6,'firstname':_0x50d9b6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x53cd('0x29')+_0xea6516[_0x53cd('0x25')]+')'},'headers':{'Authorization':_0x53cd('0x2a')+_0x99fb2f,'OData-Version':_0x53cd('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x1c6e66['body'][_0x4c7053]=_0x50d9b6;return rp(_0x1c6e66);})[_0x53cd('0x19')](function(_0x4674c4){var _0x364d4e=_0x4674c4['headers'][_0x53cd('0x2b')];var _0x30de31=_0x364d4e[_0x53cd('0x2c')](_0x364d4e['lastIndexOf']('(')+0x1,_0x364d4e['lastIndexOf'](')'));_0xea6516[_0x53cd('0x2d')]=_0x30de31;_0x545945(_0xea6516);})['catch'](function(_0x1d70d3){_0x475f10(_0x1d70d3[_0x53cd('0x18')]);});});}function getEndUser(_0x8f46d9,_0x209a15,_0x4be2c0,_0x69ab25,_0x2f2996,_0x320d14,_0x21f9e1,_0x4684d5){var _0x464739=_0x320d14['toLowerCase']()===_0x53cd('0x2e')?_0x2f2996['destcalleridnum']:_0x2f2996['calleridnum'];return getAuthToken(_0x209a15,_0x4be2c0,_0x320d14)[_0x53cd('0x19')](function(_0x33dbc0){_0x4684d5=_0x4684d5?_0x4684d5:_0x53cd('0x2f');var _0x3d21a7={'method':_0x53cd('0x1a'),'uri':_0x69ab25+_0x53cd('0x30')+_0x4684d5+_0x53cd('0x31')+_0x4684d5+_0x53cd('0x32')+_0x464739[_0x53cd('0x33')]('+',_0x53cd('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x33dbc0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d21a7);})[_0x53cd('0x19')](function(_0x564d41){var _0x1297de=![];if(!_0x564d41)return _0x1297de;var _0x1c2f55=_0x564d41[_0x53cd('0x35')];for(var _0x3a6327=0x0;_0x3a6327<_0x1c2f55[_0x53cd('0x20')];_0x3a6327++){if(_0x1c2f55[_0x3a6327][_0x4684d5]===_0x464739){_0x1297de=!![];_0x8f46d9[_0x53cd('0x2d')]=_0x1c2f55[_0x3a6327][_0x53cd('0x36')];}}return _0x1297de;})[_0x53cd('0x19')](function(_0x290127){if(_0x290127)return _0x8f46d9;if(_0x21f9e1===_0x53cd('0x37')){logger[_0x53cd('0x22')]('['+[_0x320d14[_0x53cd('0x17')]()]+_0x53cd('0x38'));return _0x8f46d9;}return createEndUser(_0x8f46d9,_0x209a15,_0x4be2c0,_0x69ab25,_0x2f2996,_0x320d14,_0x4684d5)[_0x53cd('0x19')](function(_0x3c8e2c){logger[_0x53cd('0x22')]('['+[_0x320d14[_0x53cd('0x17')]()]+']\x20Enduser\x20created!',_0x3c8e2c[_0x53cd('0x2d')]);return _0x3c8e2c;});});}function getCustomFields(_0x50326f,_0x5c6eb3,_0x10ad10){var _0x26c9ef={};if(_0x50326f[_0x53cd('0x20')]>0x0){_[_0x53cd('0x39')](_0x50326f,function(_0x159860){if(_['includes']([_0x53cd('0x3a'),'picklist'],_0x159860[_0x53cd('0x3b')])&&_0x159860['nameField']&&!_0x159860['customField']){var _0x1a36d6=_0x159860[_0x53cd('0x3c')][_0x53cd('0x26')]();var _0x26e517=_0x1a36d6[_0x53cd('0x2c')](0x0,_0x1a36d6[_0x53cd('0x3d')]('_'));var _0x125640=_0x1a36d6['substring'](_0x1a36d6['indexOf']('_')+0x1);if(_0x26e517===_0x10ad10){_0x26c9ef[_0x125640]=_0x159860[_0x53cd('0x3e')];}}});}return _0x26c9ef;}function getTicket(_0xa746d8,_0x112219,_0x588991,_0x5200e6,_0x2aff56,_0x1486a2,_0x1ebc24){return new Promise(function(_0x52c06d,_0x4f8a64){var _0x152fc2;return getAuthToken(_0x112219,_0x588991,_0x1ebc24)[_0x53cd('0x19')](function(_0x9e739f){if(_0x1486a2[_0x53cd('0x3f')]===_0x53cd('0x40')){_0x152fc2={'method':_0x53cd('0xf'),'uri':_0x5200e6+'incidents','body':Object['assign']({},{'title':intUtil[_0x53cd('0x41')](_0x1486a2[_0x53cd('0x42')],_0x2aff56,'\x20'),'description':intUtil['getString'](_0x1486a2[_0x53cd('0x43')],_0x2aff56,'\x0a'),'customerid_contact@odata.bind':_0xa746d8[_0x53cd('0x2d')]?_0x53cd('0x44')+_0xa746d8['enduserId']+')':undefined,'ownerid@odata.bind':_0x53cd('0x29')+_0xa746d8[_0x53cd('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1486a2[_0x53cd('0x45')],_0x2aff56,_0x1486a2['ticketType'])),'headers':{'Authorization':_0x53cd('0x2a')+_0x9e739f,'OData-Version':_0x53cd('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1486a2[_0x53cd('0x3f')]===_0x53cd('0x46')){var _0x17810d=_0xa746d8[_0x53cd('0x2d')]?[{'partyid_systemuser@odata.bind':_0x53cd('0x29')+_0xa746d8['userId']+')','participationtypemask':_0xa746d8['callDirection']===_0x53cd('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xa746d8[_0x53cd('0x2d')]+')','participationtypemask':_0xa746d8[_0x53cd('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x53cd('0x29')+_0xa746d8[_0x53cd('0x25')]+')','participationtypemask':_0xa746d8['callDirection']==='queue'?0x2:0x1}];_0x152fc2={'method':_0x53cd('0xf'),'uri':_0x5200e6+_0x53cd('0x49'),'body':Object[_0x53cd('0x4a')]({},{'subject':intUtil[_0x53cd('0x41')](_0x1486a2[_0x53cd('0x42')],_0x2aff56,'\x20'),'phonenumber':String(_0x2aff56[_0x53cd('0x4b')]),'description':intUtil[_0x53cd('0x41')](_0x1486a2['Descriptions'],_0x2aff56,'\x0a'),'regardingobjectid_contact@odata.bind':_0xa746d8[_0x53cd('0x2d')]?_0x53cd('0x44')+_0xa746d8[_0x53cd('0x2d')]+')':undefined,'ownerid@odata.bind':_0x53cd('0x29')+_0xa746d8[_0x53cd('0x25')]+')','directioncode':_0xa746d8[_0x53cd('0x48')]==='queue'?![]:!![],'phonecall_activity_parties':_0x17810d},getCustomFields(_0x1486a2[_0x53cd('0x45')],_0x2aff56,_0x1486a2[_0x53cd('0x3f')])),'headers':{'Authorization':_0x53cd('0x2a')+_0x9e739f,'OData-Version':_0x53cd('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x152fc2);})[_0x53cd('0x19')](function(_0x563afe){var _0x65b181=_0x563afe[_0x53cd('0x4c')][_0x53cd('0x2b')];var _0x191f9d=_0x65b181[_0x53cd('0x2c')](_0x65b181[_0x53cd('0x4d')]('(')+0x1,_0x65b181['lastIndexOf'](')'));_0xa746d8['ticketId']=_0x191f9d;_0x52c06d(_0xa746d8);})['catch'](function(_0x47ac0a){_0x4f8a64(_0x47ac0a[_0x53cd('0x18')]);});});}function emit(_0x275eb3,_0x55a1bf,_0x167682,_0x5a3bf2){var _0x487b26={'uri':util[_0x53cd('0x4e')](_0x53cd('0x4f'),_0x275eb3,_0x167682,_0x5a3bf2)};io['to'](util[_0x53cd('0x4e')](_0x53cd('0x50'),_0x55a1bf))[_0x53cd('0x51')]('trigger:browser:url',_0x487b26);}exports['cs']=function(_0xf0a464,_0x1750fa,_0x51ccec,_0x2e7852,_0x348baa,_0x375534,_0x4012fe,_0x318f78){var _0x999f38={};_0x375534['remoteUri']=_0x375534[_0x53cd('0x52')]?intUtil['stripTrailingSlash'](_0x375534[_0x53cd('0xc')]['data7']):intUtil[_0x53cd('0x53')](_0x375534[_0x53cd('0x9')]);_0x375534['serverUrl']=intUtil[_0x53cd('0x53')](_0x375534[_0x53cd('0x54')]);_0x999f38[_0x53cd('0x48')]=_0x318f78===_0x53cd('0x47')||_0x318f78==='unmanaged'?'queue':_0x53cd('0x2e');var _0x312b29=_0x375534[_0x53cd('0x52')]?util['format'](_0x53cd('0x55'),_0x375534['CloudProvider']['data7']):util['format']('%s/api/data/v9.0/',_0x375534[_0x53cd('0x9')]);var _0x240031=util['format'](_0x53cd('0x56'),_0x375534[_0x53cd('0xb')]);var _0x41c492=util['format'](_0x53cd('0x57'),_0x375534[_0x53cd('0x54')],_0x1750fa[_0x53cd('0x58')],md5(_0x1750fa[_0x53cd('0x58')]));if(_0x348baa&&_0x348baa['monitor_format']){logger[_0x53cd('0x22')](_0x53cd('0x59'),_0x53cd('0x5a'));_0x1750fa['recordingURL']=_0x41c492;}else if(_0x4012fe&&_0x4012fe['recordingFormat']&&_0x4012fe[_0x53cd('0x5b')]!==_0x53cd('0x5c')){logger[_0x53cd('0x22')](_0x53cd('0x5d'),_0x53cd('0x5a'));_0x1750fa[_0x53cd('0x5e')]=_0x41c492;}else{_0x1750fa[_0x53cd('0x5e')]='';}return getUser(_0x999f38,_0x375534,_0x2e7852,_0x240031,_0x312b29,_0x318f78)['then'](function(_0x319e96){logger[_0x53cd('0x22')]('['+_0x318f78[_0x53cd('0x17')]()+_0x53cd('0x5f'),_0x319e96[_0x53cd('0x25')]);logger[_0x53cd('0x22')]('['+_0x318f78[_0x53cd('0x17')]()+_0x53cd('0x60'),_0x319e96[_0x53cd('0x1f')]);return getEndUser(_0x319e96,_0x375534,_0x240031,_0x312b29,_0x1750fa,_0x318f78,_0x51ccec[_0x53cd('0x61')],_0x51ccec[_0x53cd('0x62')]);})['then'](function(_0x120191){logger[_0x53cd('0x22')]('['+_0x318f78['toUpperCase']()+_0x53cd('0x63'),_0x120191['enduserId']);logger[_0x53cd('0x22')]('['+_0x318f78['toUpperCase']()+_0x53cd('0x64'),_0x1750fa[_0x53cd('0x4b')]);return getTicket(_0x120191,_0x375534,_0x240031,_0x312b29,_0x1750fa,_0x51ccec,_0x318f78);})[_0x53cd('0x19')](function(_0x2ac75b){logger[_0x53cd('0x22')](util[_0x53cd('0x4e')]('['+_0x318f78['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x51ccec[_0x53cd('0x3f')],_0x2ac75b['ticketId']));logger[_0x53cd('0x22')](util[_0x53cd('0x4e')]('['+_0x318f78[_0x53cd('0x17')]()+']\x20Call\x20direction:\x20%s',_0x318f78));if(_0x318f78!=='unmanaged'&&_0x51ccec[_0x53cd('0x65')]){logger[_0x53cd('0x22')]('['+_0x318f78[_0x53cd('0x17')]()+']',_0x53cd('0x66'));emit(_0x375534[_0x53cd('0x9')],_0x2e7852[_0x53cd('0x67')],_0x51ccec[_0x53cd('0x3f')],_0x2ac75b[_0x53cd('0x68')]);}})[_0x53cd('0x15')](function(_0x112ad4){logger[_0x53cd('0x16')]('['+_0x318f78[_0x53cd('0x17')]()+_0x53cd('0x69'),_0x112ad4[_0x53cd('0x18')]);console[_0x53cd('0x16')](_0x53cd('0x6a'),_0x112ad4);});}; \ No newline at end of file +var _0xfbc8=['none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','odata-entityid','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','Subjects','getString','Descriptions','ticketType','phonecall','/systemusers(','/contacts(','callDirection','queue','Fields','headers','substring','ticketId','user:%s','stripTrailingSlash','data7','serverUrl','unmanaged','format','%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!','recordingURL'];(function(_0x5840e9,_0x3465b2){var _0x11e704=function(_0x5e15e5){while(--_0x5e15e5){_0x5840e9['push'](_0x5840e9['shift']());}};_0x11e704(++_0x3465b2);}(_0xfbc8,0x1c7));var _0x8fbc=function(_0x3f4f3b,_0x2d7be2){_0x3f4f3b=_0x3f4f3b-0x0;var _0xfc6f02=_0xfbc8[_0x3f4f3b];return _0xfc6f02;};'use strict';var _=require(_0x8fbc('0x0'));var rp=require(_0x8fbc('0x1'));var util=require(_0x8fbc('0x2'));var intUtil=require(_0x8fbc('0x3'));var md5=require(_0x8fbc('0x4'));var Redis=require(_0x8fbc('0x5'));var logger=require(_0x8fbc('0x6'))(_0x8fbc('0x7'));var config=require(_0x8fbc('0x8'));config[_0x8fbc('0x9')]=_[_0x8fbc('0xa')](config[_0x8fbc('0x9')],{'host':_0x8fbc('0xb'),'port':0x18eb});var io=require(_0x8fbc('0xc'))(new Redis(config[_0x8fbc('0x9')]));function getAuthToken(_0x417cd6,_0x95f59,_0xa69e94){if(_0x417cd6[_0x8fbc('0xd')]){_0x417cd6[_0x8fbc('0xe')]=_0x417cd6[_0x8fbc('0xf')]['data7'];_0x417cd6[_0x8fbc('0x10')]=_0x417cd6[_0x8fbc('0xf')][_0x8fbc('0x11')];return Promise[_0x8fbc('0x12')](_0x417cd6[_0x8fbc('0xf')][_0x8fbc('0x13')]);}var _0x4dd815={'method':_0x8fbc('0x14'),'uri':_0x95f59,'form':{'client_id':_0x417cd6[_0x8fbc('0x15')],'resource':_0x417cd6[_0x8fbc('0xe')],'username':_0x417cd6[_0x8fbc('0x16')],'password':_0x417cd6[_0x8fbc('0x17')],'grant_type':_0x8fbc('0x17'),'client_secret':_0x417cd6[_0x8fbc('0x18')]},'json':!![]};return rp(_0x4dd815)[_0x8fbc('0x19')](function(_0x574c1){return _0x574c1['access_token'];})[_0x8fbc('0x1a')](function(_0x41e225){logger['error']('['+[_0xa69e94[_0x8fbc('0x1b')]()]+_0x8fbc('0x1c'));return _0x41e225[_0x8fbc('0x1d')];});}function getUser(_0x43ed6f,_0x5cea3d,_0x516fca,_0x39b68e,_0x377806,_0x321d09){return new Promise(function(_0x3605b0,_0x31f3b5){return getAuthToken(_0x5cea3d,_0x39b68e,_0x321d09)[_0x8fbc('0x19')](function(_0x31197a){var _0x4c7d8={'method':'GET','uri':_0x377806+_0x8fbc('0x1e'),'headers':{'Authorization':_0x8fbc('0x1f')+_0x31197a,'OData-Version':_0x8fbc('0x20')},'json':!![]};return rp(_0x4c7d8);})['then'](function(_0x499384){var _0x5ee6fd=_0x499384[_0x8fbc('0x21')];var _0x405f75=![];var _0x46573b=null;if(!_[_0x8fbc('0x22')](_0x516fca)){if(intUtil[_0x8fbc('0x23')](_0x516fca[_0x8fbc('0x24')])){_0x43ed6f[_0x8fbc('0x25')]=_0x516fca[_0x8fbc('0x24')];for(_0x46573b=0x0;_0x46573b<_0x5ee6fd[_0x8fbc('0x26')];_0x46573b++){if(_0x5ee6fd[_0x46573b][_0x8fbc('0x27')]===_0x516fca['email']&&!_0x5ee6fd[_0x46573b][_0x8fbc('0x28')]){_0x405f75=!![];logger['info']('['+[_0x321d09[_0x8fbc('0x1b')]()]+_0x8fbc('0x29')+_0x5ee6fd[_0x46573b][_0x8fbc('0x2a')]+'!');_0x43ed6f[_0x8fbc('0x2b')]=_0x5ee6fd[_0x46573b][_0x8fbc('0x2a')];}}}}if(!_0x405f75){logger[_0x8fbc('0x2c')]('['+[_0x321d09[_0x8fbc('0x1b')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x43ed6f[_0x8fbc('0x25')]=_0x5cea3d[_0x8fbc('0x16')];for(_0x46573b=0x0;_0x46573b<_0x5ee6fd['length'];_0x46573b++){if(_0x5ee6fd[_0x46573b][_0x8fbc('0x27')]===_0x5cea3d[_0x8fbc('0x16')]){_0x43ed6f['userId']=_0x5ee6fd[_0x46573b]['systemuserid'];}}}_0x3605b0(_0x43ed6f);})[_0x8fbc('0x1a')](function(_0x454fcc){_0x31f3b5(_0x454fcc[_0x8fbc('0x1d')]);});});}function createEndUser(_0x168160,_0xf9a77b,_0x6ad32d,_0x389bc8,_0x5b257d,_0x2e940c,_0x17e3a7){return new Promise(function(_0x5c8941,_0x2f0837){return getAuthToken(_0xf9a77b,_0x6ad32d,_0x2e940c)['then'](function(_0x57c08d){var _0x40786=_0x2e940c[_0x8fbc('0x2d')]()===_0x8fbc('0x2e')?_0x5b257d[_0x8fbc('0x2f')]:_0x5b257d[_0x8fbc('0x30')];var _0x1149fd={'method':_0x8fbc('0x14'),'uri':_0x389bc8+_0x8fbc('0x31'),'body':{'fullname':_0x40786,'firstname':_0x40786,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x168160[_0x8fbc('0x2b')]+')'},'headers':{'Authorization':_0x8fbc('0x1f')+_0x57c08d,'OData-Version':_0x8fbc('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x1149fd[_0x8fbc('0x32')][_0x17e3a7]=_0x40786;return rp(_0x1149fd);})['then'](function(_0x442f7d){var _0x571cb4=_0x442f7d['headers'][_0x8fbc('0x33')];var _0x183283=_0x571cb4['substring'](_0x571cb4[_0x8fbc('0x34')]('(')+0x1,_0x571cb4[_0x8fbc('0x34')](')'));_0x168160[_0x8fbc('0x35')]=_0x183283;_0x5c8941(_0x168160);})[_0x8fbc('0x1a')](function(_0x36fa9b){_0x2f0837(_0x36fa9b[_0x8fbc('0x1d')]);});});}function getEndUser(_0x51539a,_0x35be70,_0x37bd6e,_0xd5da7e,_0x1f109c,_0x280543,_0x85b944,_0xc0441b){var _0x45bcc1=_0x280543[_0x8fbc('0x2d')]()===_0x8fbc('0x2e')?_0x1f109c[_0x8fbc('0x2f')]:_0x1f109c[_0x8fbc('0x30')];return getAuthToken(_0x35be70,_0x37bd6e,_0x280543)[_0x8fbc('0x19')](function(_0x4b7a90){_0xc0441b=_0xc0441b?_0xc0441b:_0x8fbc('0x36');var _0x330637={'method':_0x8fbc('0x37'),'uri':_0xd5da7e+_0x8fbc('0x38')+_0xc0441b+'&$filter='+_0xc0441b+'\x20eq\x20\x27'+_0x45bcc1['replace']('+',_0x8fbc('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4b7a90,'If-None-Match':null,'OData-Version':_0x8fbc('0x20')},'json':!![]};return rp(_0x330637);})[_0x8fbc('0x19')](function(_0x50f87c){var _0x273cd5=![];if(!_0x50f87c)return _0x273cd5;var _0x39ce19=_0x50f87c[_0x8fbc('0x21')];for(var _0x56931f=0x0;_0x56931f<_0x39ce19[_0x8fbc('0x26')];_0x56931f++){if(_0x39ce19[_0x56931f][_0xc0441b]===_0x45bcc1){_0x273cd5=!![];_0x51539a[_0x8fbc('0x35')]=_0x39ce19[_0x56931f][_0x8fbc('0x3a')];}}return _0x273cd5;})['then'](function(_0x10e207){if(_0x10e207)return _0x51539a;if(_0x85b944===_0x8fbc('0x3b')){logger[_0x8fbc('0x2c')]('['+[_0x280543[_0x8fbc('0x1b')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x51539a;}return createEndUser(_0x51539a,_0x35be70,_0x37bd6e,_0xd5da7e,_0x1f109c,_0x280543,_0xc0441b)['then'](function(_0x1f0dd){logger[_0x8fbc('0x2c')]('['+[_0x280543['toUpperCase']()]+_0x8fbc('0x3c'),_0x1f0dd[_0x8fbc('0x35')]);return _0x1f0dd;});});}function getCustomFields(_0x141141,_0x1bd63a,_0x356340){var _0x345739={};if(_0x141141[_0x8fbc('0x26')]>0x0){_[_0x8fbc('0x3d')](_0x141141,function(_0x1baf58){if(_[_0x8fbc('0x3e')]([_0x8fbc('0x3f'),'picklist'],_0x1baf58[_0x8fbc('0x40')])&&_0x1baf58[_0x8fbc('0x41')]&&!_0x1baf58[_0x8fbc('0x42')]){var _0x88c7b4=_0x1baf58[_0x8fbc('0x43')][_0x8fbc('0x2d')]();var _0x3ce367=_0x88c7b4['substring'](0x0,_0x88c7b4[_0x8fbc('0x44')]('_'));var _0x2a5ac8=_0x88c7b4['substring'](_0x88c7b4['indexOf']('_')+0x1);if(_0x3ce367===_0x356340){_0x345739[_0x2a5ac8]=_0x1baf58[_0x8fbc('0x45')];}}});}return _0x345739;}function getTicket(_0x266df7,_0x42a990,_0x478f2a,_0x56106e,_0x2cbe42,_0x525f55,_0x10d6d4){return new Promise(function(_0x33d99f,_0x5f2aa4){var _0xb6e938;return getAuthToken(_0x42a990,_0x478f2a,_0x10d6d4)['then'](function(_0x329342){if(_0x525f55['ticketType']===_0x8fbc('0x46')){_0xb6e938={'method':'POST','uri':_0x56106e+_0x8fbc('0x47'),'body':Object[_0x8fbc('0x48')]({},{'title':intUtil['getString'](_0x525f55[_0x8fbc('0x49')],_0x2cbe42,'\x20'),'description':intUtil[_0x8fbc('0x4a')](_0x525f55[_0x8fbc('0x4b')],_0x2cbe42,'\x0a'),'customerid_contact@odata.bind':_0x266df7[_0x8fbc('0x35')]?'/contacts('+_0x266df7['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x266df7[_0x8fbc('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x525f55['Fields'],_0x2cbe42,_0x525f55[_0x8fbc('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x329342,'OData-Version':_0x8fbc('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x525f55[_0x8fbc('0x4c')]===_0x8fbc('0x4d')){var _0x1ca816=_0x266df7['enduserId']?[{'partyid_systemuser@odata.bind':_0x8fbc('0x4e')+_0x266df7[_0x8fbc('0x2b')]+')','participationtypemask':_0x266df7['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x8fbc('0x4f')+_0x266df7[_0x8fbc('0x35')]+')','participationtypemask':_0x266df7[_0x8fbc('0x50')]===_0x8fbc('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8fbc('0x4e')+_0x266df7[_0x8fbc('0x2b')]+')','participationtypemask':_0x266df7[_0x8fbc('0x50')]===_0x8fbc('0x51')?0x2:0x1}];_0xb6e938={'method':_0x8fbc('0x14'),'uri':_0x56106e+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x8fbc('0x4a')](_0x525f55[_0x8fbc('0x49')],_0x2cbe42,'\x20'),'phonenumber':String(_0x2cbe42['calleridnum']),'description':intUtil[_0x8fbc('0x4a')](_0x525f55[_0x8fbc('0x4b')],_0x2cbe42,'\x0a'),'regardingobjectid_contact@odata.bind':_0x266df7[_0x8fbc('0x35')]?'/contacts('+_0x266df7[_0x8fbc('0x35')]+')':undefined,'ownerid@odata.bind':_0x8fbc('0x4e')+_0x266df7['userId']+')','directioncode':_0x266df7['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x1ca816},getCustomFields(_0x525f55[_0x8fbc('0x52')],_0x2cbe42,_0x525f55['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x329342,'OData-Version':_0x8fbc('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xb6e938);})[_0x8fbc('0x19')](function(_0x4f18f8){var _0x18222a=_0x4f18f8[_0x8fbc('0x53')][_0x8fbc('0x33')];var _0x2f018f=_0x18222a[_0x8fbc('0x54')](_0x18222a['lastIndexOf']('(')+0x1,_0x18222a[_0x8fbc('0x34')](')'));_0x266df7[_0x8fbc('0x55')]=_0x2f018f;_0x33d99f(_0x266df7);})['catch'](function(_0x3567c4){_0x5f2aa4(_0x3567c4['message']);});});}function emit(_0x1964fd,_0xe0eef6,_0x3d356f,_0x5a60d6){var _0x4598a2={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1964fd,_0x3d356f,_0x5a60d6)};io['to'](util['format'](_0x8fbc('0x56'),_0xe0eef6))['emit']('trigger:browser:url',_0x4598a2);}exports['cs']=function(_0x2a3a92,_0x244f56,_0xe92d05,_0x284ddb,_0x4078ac,_0x6c262b,_0xeea657,_0x320578){var _0xef08ee={};_0x6c262b['remoteUri']=_0x6c262b['modernAuthentication']?intUtil[_0x8fbc('0x57')](_0x6c262b[_0x8fbc('0xf')][_0x8fbc('0x58')]):intUtil[_0x8fbc('0x57')](_0x6c262b['remoteUri']);_0x6c262b['serverUrl']=intUtil[_0x8fbc('0x57')](_0x6c262b[_0x8fbc('0x59')]);_0xef08ee[_0x8fbc('0x50')]=_0x320578==='queue'||_0x320578===_0x8fbc('0x5a')?_0x8fbc('0x51'):_0x8fbc('0x2e');var _0x209f7d=_0x6c262b[_0x8fbc('0xd')]?util[_0x8fbc('0x5b')](_0x8fbc('0x5c'),_0x6c262b[_0x8fbc('0xf')]['data7']):util[_0x8fbc('0x5b')](_0x8fbc('0x5c'),_0x6c262b[_0x8fbc('0xe')]);var _0x2fc45a=util[_0x8fbc('0x5b')](_0x8fbc('0x5d'),_0x6c262b[_0x8fbc('0x10')]);var _0x30f63a=util[_0x8fbc('0x5b')](_0x8fbc('0x5e'),_0x6c262b[_0x8fbc('0x59')],_0x244f56[_0x8fbc('0x5f')],md5(_0x244f56[_0x8fbc('0x5f')]));if(_0x4078ac&&_0x4078ac[_0x8fbc('0x60')]){logger['info'](_0x8fbc('0x61'),_0x8fbc('0x62'));_0x244f56[_0x8fbc('0x63')]=_0x30f63a;}else if(_0xeea657&&_0xeea657['recordingFormat']&&_0xeea657['recordingFormat']!==_0x8fbc('0x64')){logger['info'](_0x8fbc('0x65'),'Recording\x20is\x20enabled!');_0x244f56[_0x8fbc('0x63')]=_0x30f63a;}else{_0x244f56[_0x8fbc('0x63')]='';}return getUser(_0xef08ee,_0x6c262b,_0x284ddb,_0x2fc45a,_0x209f7d,_0x320578)[_0x8fbc('0x19')](function(_0xf59cf4){logger[_0x8fbc('0x2c')]('['+_0x320578[_0x8fbc('0x1b')]()+_0x8fbc('0x66'),_0xf59cf4[_0x8fbc('0x2b')]);logger[_0x8fbc('0x2c')]('['+_0x320578[_0x8fbc('0x1b')]()+']\x20The\x20User\x20email\x20is:',_0xf59cf4[_0x8fbc('0x25')]);return getEndUser(_0xf59cf4,_0x6c262b,_0x2fc45a,_0x209f7d,_0x244f56,_0x320578,_0xe92d05['moduleCreate'],_0xe92d05['additionalSearchContact']);})[_0x8fbc('0x19')](function(_0x5e9f48){logger['info']('['+_0x320578['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x5e9f48[_0x8fbc('0x35')]);logger[_0x8fbc('0x2c')]('['+_0x320578[_0x8fbc('0x1b')]()+_0x8fbc('0x67'),_0x244f56[_0x8fbc('0x30')]);return getTicket(_0x5e9f48,_0x6c262b,_0x2fc45a,_0x209f7d,_0x244f56,_0xe92d05,_0x320578);})['then'](function(_0x31475d){logger[_0x8fbc('0x2c')](util[_0x8fbc('0x5b')]('['+_0x320578[_0x8fbc('0x1b')]()+_0x8fbc('0x68'),_0xe92d05[_0x8fbc('0x4c')],_0x31475d[_0x8fbc('0x55')]));logger[_0x8fbc('0x2c')](util[_0x8fbc('0x5b')]('['+_0x320578[_0x8fbc('0x1b')]()+_0x8fbc('0x69'),_0x320578));if(_0x320578!==_0x8fbc('0x5a')&&_0xe92d05['openNewTab']){logger['info']('['+_0x320578[_0x8fbc('0x1b')]()+']',_0x8fbc('0x6a'));emit(_0x6c262b[_0x8fbc('0xe')],_0x284ddb[_0x8fbc('0x6b')],_0xe92d05['ticketType'],_0x31475d[_0x8fbc('0x55')]);}})[_0x8fbc('0x1a')](function(_0x1a16fc){logger[_0x8fbc('0x6c')]('['+_0x320578[_0x8fbc('0x1b')]()+_0x8fbc('0x6d'),_0x1a16fc[_0x8fbc('0x1d')]);console[_0x8fbc('0x6c')](_0x8fbc('0x6e'),_0x1a16fc);});}; \ 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 eda4662..4492359 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 _0xbddb=['trigger:browser:url','%s/helpdesk/tickets/%d','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','catch','error','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','GET','map','includes','string','nameField','content','type','idField','customField','push','variable','variableName','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x36d7c9,_0x105774){var _0x1e6d72=function(_0x58d657){while(--_0x58d657){_0x36d7c9['push'](_0x36d7c9['shift']());}};_0x1e6d72(++_0x105774);}(_0xbddb,0x174));var _0xbbdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbddb[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xbbdd('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xbbdd('0x1'));var Redis=require(_0xbbdd('0x2'));var intUtil=require(_0xbbdd('0x3'));var config=require(_0xbbdd('0x4'));var logger=require(_0xbbdd('0x5'))(_0xbbdd('0x6'));config[_0xbbdd('0x7')]=_[_0xbbdd('0x8')](config[_0xbbdd('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xbbdd('0x9'))(new Redis(config[_0xbbdd('0x7')]));var headers={'Content-Type':_0xbbdd('0xa'),'Accept':'application/json'};function emit(_0x277784,_0x314f07,_0x1fc412){io['to'](_0x277784)[_0xbbdd('0xb')](_0x314f07,_0x1fc412);}function getTicket(_0x349e83,_0x5eb363,_0x5b124a,_0xacc578,_0x4a6295){logger[_0xbbdd('0xc')](_0xbbdd('0xd'));var _0x42fbf9=_[_0xbbdd('0xe')]({'responder_id':_0x5eb363['id'],'requester_id':_0x5b124a['id'],'name':util[_0xbbdd('0xf')]('Caller\x20-\x20%s',_0x4a6295[_0xbbdd('0x10')]),'phone':_0x4a6295[_0xbbdd('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbbdd('0x12')](_0xacc578[_0xbbdd('0x13')],_0x4a6295,'\x20'),'description':intUtil[_0xbbdd('0x12')](_0xacc578[_0xbbdd('0x14')],_0x4a6295,'
'),'tags':getTags(_0xacc578[_0xbbdd('0x15')],'name')},getCustomFields(_0xacc578['Fields'],_0x4a6295));_0x42fbf9['custom_fields']=_[_0xbbdd('0x16')](_[_0xbbdd('0x17')](_0x42fbf9[_0xbbdd('0x18')],'id'),_0xbbdd('0x19'));return request({'uri':util[_0xbbdd('0xf')](_0xbbdd('0x1a'),_0x349e83[_0xbbdd('0x1b')]),'method':_0xbbdd('0x1c'),'body':_0x42fbf9})[_0xbbdd('0x1d')](function(_0xd79572){logger[_0xbbdd('0xc')](_0xbbdd('0x1e'));return _0xd79572;});}function getUser(_0x3b2dae,_0x3b61f4){if(intUtil[_0xbbdd('0x1f')](_0x3b61f4)){return request({'uri':util[_0xbbdd('0xf')](_0xbbdd('0x20'),_0x3b2dae[_0xbbdd('0x1b')]),'qs':{'email':_0x3b61f4}})[_0xbbdd('0x1d')](function(_0xb9d197){if(_0xb9d197[_0xbbdd('0x21')]){logger[_0xbbdd('0xc')](_0xbbdd('0x22'));return _[_0xbbdd('0x23')](_0xb9d197,function(_0x59996f){return _0x59996f[_0xbbdd('0x24')][_0xbbdd('0x25')]===_0x3b61f4;});}else{logger['info'](_0xbbdd('0x26'));return request({'uri':util[_0xbbdd('0xf')](_0xbbdd('0x27'),_0x3b2dae[_0xbbdd('0x1b')])})[_0xbbdd('0x1d')](function(_0x45e125){logger[_0xbbdd('0xc')]('Admin\x20account\x20selected.');return _0x45e125;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xbbdd('0xf')](_0xbbdd('0x27'),_0x3b2dae[_0xbbdd('0x1b')])})[_0xbbdd('0x1d')](function(_0x291483){logger[_0xbbdd('0xc')](_0xbbdd('0x28'));return _0x291483;});}}function getEndUser(_0x5f08a6,_0x22261f,_0x15696a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x15696a);return request({'uri':util['format'](_0xbbdd('0x29'),_0x5f08a6[_0xbbdd('0x1b')]),'qs':{'phone':_0x15696a}})[_0xbbdd('0x1d')](function(_0x157a39){if(_0x157a39['length']){logger[_0xbbdd('0xc')]('Enduser\x20found!');return _[_0xbbdd('0x23')](_0x157a39,{'phone':_0x15696a});}else{logger[_0xbbdd('0xc')](_0xbbdd('0x2a'));return request({'uri':util[_0xbbdd('0xf')](_0xbbdd('0x29'),_0x5f08a6[_0xbbdd('0x1b')]),'method':_0xbbdd('0x1c'),'body':{'name':_0x22261f,'phone':_0x15696a}})[_0xbbdd('0x1d')](function(_0x26bc94){logger[_0xbbdd('0xc')](_0xbbdd('0x2b'));return _0x26bc94;});}});}function getAuth(_0x764258){return util[_0xbbdd('0xf')]('Basic\x20%s',new Buffer(_0x764258[_0xbbdd('0x2c')]+':X')[_0xbbdd('0x2d')](_0xbbdd('0x2e')));}function request(_0x1856e3){logger[_0xbbdd('0x2f')]('[HTTP]',JSON[_0xbbdd('0x30')](_0x1856e3));return rp(_[_0xbbdd('0x8')](_0x1856e3,{'method':_0xbbdd('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x2324a5,_0x496883){var _0x5f5132=[];if(_0x2324a5&&_0x2324a5['length']>0x0){_0x5f5132=_[_0xbbdd('0x32')](_0x2324a5,_0x496883);}return _0x5f5132;}function getCustomFields(_0x5a2e98,_0x2f3931){var _0x345180=[];var _0x442974={'custom_fields':[]};if(_0x5a2e98['length']>0x0){_['forEach'](_0x5a2e98,function(_0x1594af){if(_[_0xbbdd('0x33')]([_0xbbdd('0x34'),'picklist'],_0x1594af['type'])&&_0x1594af[_0xbbdd('0x35')]&&!_0x1594af['customField']){_0x442974[_0x1594af[_0xbbdd('0x35')]['toLowerCase']()]=_0x1594af[_0xbbdd('0x36')]['toString']();}else if(_[_0xbbdd('0x33')]([_0xbbdd('0x34'),'picklist'],_0x1594af[_0xbbdd('0x37')])&&_0x1594af[_0xbbdd('0x38')]&&_0x1594af[_0xbbdd('0x39')]){_0x442974['custom_fields'][_0xbbdd('0x3a')]({'id':_0x1594af[_0xbbdd('0x38')],'value':_0x1594af[_0xbbdd('0x36')]['toString']()});}else if(_0x1594af[_0xbbdd('0x37')]===_0xbbdd('0x3b')&&_0x1594af[_0xbbdd('0x3c')]&&_0x1594af[_0xbbdd('0x38')]&&_0x1594af[_0xbbdd('0x39')]){_0x2f3931[_0x1594af['variableName']]&&_0x442974[_0xbbdd('0x18')][_0xbbdd('0x3a')]({'id':_0x1594af[_0xbbdd('0x38')],'value':_0x2f3931[_0x1594af['variableName']][_0xbbdd('0x2d')]()});}else if(_0x1594af['type']==='customVariable'&&_0x1594af[_0xbbdd('0x3d')]&&_0x1594af['Variable'][_0xbbdd('0x3e')]&&_0x1594af['idField']&&_0x1594af[_0xbbdd('0x39')]){_0x2f3931[_0x1594af['Variable'][_0xbbdd('0x3e')][_0xbbdd('0x3f')]()]&&_0x442974['custom_fields'][_0xbbdd('0x3a')]({'id':_0x1594af[_0xbbdd('0x38')],'value':_0x2f3931[_0x1594af[_0xbbdd('0x3d')][_0xbbdd('0x3e')][_0xbbdd('0x3f')]()][_0xbbdd('0x2d')]()});}});}return _0x442974;}exports['queue']=function(_0x5c81a5,_0x340d52,_0x128b0b,_0x3621b9,_0x3d6b27,_0x104ce0){var _0x3e1707,_0x517703;_0x104ce0['remoteUri']=intUtil[_0xbbdd('0x40')](_0x104ce0['remoteUri']);_0x104ce0['serverUrl']=intUtil['stripTrailingSlash'](_0x104ce0[_0xbbdd('0x41')]);if(_0x3d6b27&&_0x3d6b27[_0xbbdd('0x42')]){logger['info'](_0xbbdd('0x43'),_0xbbdd('0x44'));_0x340d52[_0xbbdd('0x45')]=util[_0xbbdd('0xf')](_0xbbdd('0x46'),_0x104ce0[_0xbbdd('0x41')],_0x340d52[_0xbbdd('0x47')],md5(_0x340d52[_0xbbdd('0x47')]));}else{_0x340d52['recordingURL']='';}headers[_0xbbdd('0x48')]=getAuth(_0x104ce0);return getUser(_0x104ce0,_0x3621b9[_0xbbdd('0x25')])[_0xbbdd('0x1d')](function(_0x337d32){_0x3e1707=_0x337d32;logger['info'](_0xbbdd('0x49'),_0x3e1707['id']);return getEndUser(_0x104ce0,_0x340d52[_0xbbdd('0x10')],_0x340d52[_0xbbdd('0x11')]);})[_0xbbdd('0x1d')](function(_0x1f38ba){_0x517703=_0x1f38ba;logger[_0xbbdd('0xc')](_0xbbdd('0x4a'),_0x517703['id']);return getTicket(_0x104ce0,_0x3e1707,_0x517703,_0x128b0b,_0x340d52);})[_0xbbdd('0x1d')](function(_0x290d64){if(_0x290d64&&_0x290d64['id']){logger[_0xbbdd('0xc')](_0xbbdd('0x1e'));logger[_0xbbdd('0xc')](_0xbbdd('0x4b'),_0x290d64['id']);logger[_0xbbdd('0xc')]('[QUEUE]',_0xbbdd('0x4c'));emit(util[_0xbbdd('0xf')](_0xbbdd('0x4d'),_0x3621b9[_0xbbdd('0x3e')]),_0xbbdd('0x4e'),{'uri':util[_0xbbdd('0xf')](_0xbbdd('0x4f'),_0x104ce0[_0xbbdd('0x1b')],_0x290d64['id'])});}})['catch'](function(_0x34caf5){logger['error']('[QUEUE]',JSON['stringify'](_0x34caf5));});};exports['outbound']=function(_0x34b97b,_0x1b5b36,_0x180b04,_0x437b1e,_0x4b79f6,_0x35a40c,_0x3cf67d){var _0x4f4bcf,_0x49ed69;_0x35a40c[_0xbbdd('0x1b')]=intUtil['stripTrailingSlash'](_0x35a40c['remoteUri']);_0x35a40c[_0xbbdd('0x41')]=intUtil[_0xbbdd('0x40')](_0x35a40c[_0xbbdd('0x41')]);if(_0x3cf67d&&_0x3cf67d[_0xbbdd('0x50')]&&_0x3cf67d['recordingFormat']!==_0xbbdd('0x51')){logger[_0xbbdd('0xc')]('[OUTBOUND]',_0xbbdd('0x44'));_0x1b5b36[_0xbbdd('0x45')]=util[_0xbbdd('0xf')](_0xbbdd('0x46'),_0x35a40c['serverUrl'],_0x1b5b36['uniqueid'],md5(_0x1b5b36[_0xbbdd('0x47')]));}headers[_0xbbdd('0x48')]=getAuth(_0x35a40c);return getUser(_0x35a40c,_0x437b1e[_0xbbdd('0x25')])['then'](function(_0x5a8996){_0x4f4bcf=_0x5a8996;logger[_0xbbdd('0xc')](_0xbbdd('0x49'),_0x4f4bcf['id']);return getEndUser(_0x35a40c,_0x1b5b36[_0xbbdd('0x52')],_0x1b5b36[_0xbbdd('0x53')]);})[_0xbbdd('0x1d')](function(_0x29f6ad){_0x49ed69=_0x29f6ad;logger[_0xbbdd('0xc')](_0xbbdd('0x4a'),_0x49ed69['id']);return getTicket(_0x35a40c,_0x4f4bcf,_0x49ed69,_0x180b04,_0x1b5b36);})[_0xbbdd('0x1d')](function(_0x5d1788){if(_0x5d1788&&_0x5d1788['id']){logger[_0xbbdd('0xc')](_0xbbdd('0x1e'));logger[_0xbbdd('0xc')](_0xbbdd('0x4b'),_0x5d1788['id']);logger[_0xbbdd('0xc')](_0xbbdd('0x54'),_0xbbdd('0x4c'));emit(util[_0xbbdd('0xf')](_0xbbdd('0x4d'),_0x437b1e[_0xbbdd('0x3e')]),_0xbbdd('0x4e'),{'uri':util['format'](_0xbbdd('0x4f'),_0x35a40c['remoteUri'],_0x5d1788['id'])});}})[_0xbbdd('0x55')](function(_0x57df67){logger[_0xbbdd('0x56')](_0xbbdd('0x54'),JSON[_0xbbdd('0x30')](_0x57df67));});};exports[_0xbbdd('0x57')]=function(_0x154a19,_0x4d9011,_0x51d8a0,_0x380c99,_0x248daf,_0x35dfeb){var _0x3f8bba,_0x40f0d5;_0x35dfeb[_0xbbdd('0x1b')]=intUtil[_0xbbdd('0x40')](_0x35dfeb[_0xbbdd('0x1b')]);_0x35dfeb[_0xbbdd('0x41')]=intUtil['stripTrailingSlash'](_0x35dfeb[_0xbbdd('0x41')]);if(_0x248daf&&_0x248daf[_0xbbdd('0x42')]){logger[_0xbbdd('0xc')]('['+_0x4d9011[_0xbbdd('0x58')][_0xbbdd('0x59')]()+']',_0xbbdd('0x44'));_0x4d9011[_0xbbdd('0x45')]=util[_0xbbdd('0xf')](_0xbbdd('0x46'),_0x35dfeb[_0xbbdd('0x41')],_0x4d9011[_0xbbdd('0x47')],md5(_0x4d9011[_0xbbdd('0x47')]));}else{_0x4d9011[_0xbbdd('0x45')]='';}headers[_0xbbdd('0x48')]=getAuth(_0x35dfeb);return getUser(_0x35dfeb,'')[_0xbbdd('0x1d')](function(_0x33c3aa){_0x3f8bba=_0x33c3aa;logger[_0xbbdd('0xc')]('The\x20User\x20ID\x20is:',_0x3f8bba['id']);return getEndUser(_0x35dfeb,_0x4d9011[_0xbbdd('0x10')],_0x4d9011[_0xbbdd('0x11')]);})[_0xbbdd('0x1d')](function(_0x17e849){_0x40f0d5=_0x17e849;logger[_0xbbdd('0xc')]('The\x20Enduser\x20ID\x20is:',_0x40f0d5['id']);return getTicket(_0x35dfeb,_0x3f8bba,_0x40f0d5,_0x51d8a0,_0x4d9011);})['then'](function(_0x35c238){if(_0x35c238){logger[_0xbbdd('0xc')]('Ticket\x20created!');logger[_0xbbdd('0xc')](_0xbbdd('0x4b'),_0x35c238['id']);}})['catch'](function(_0x5e4ead){logger[_0xbbdd('0x56')]('['+_0x4d9011[_0xbbdd('0x58')][_0xbbdd('0x59')]()+']',JSON[_0xbbdd('0x30')](_0x5e4ead));});}; \ No newline at end of file +var _0x4a78=['The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','monitor_format','lastevent','toUpperCase','stringify','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','toString','base64','debug','[HTTP]','GET','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x471a85,_0x239e8d){var _0x5f2039=function(_0x378952){while(--_0x378952){_0x471a85['push'](_0x471a85['shift']());}};_0x5f2039(++_0x239e8d);}(_0x4a78,0x18c));var _0x84a7=function(_0x7df88d,_0x249100){_0x7df88d=_0x7df88d-0x0;var _0x32bac1=_0x4a78[_0x7df88d];return _0x32bac1;};'use strict';var _=require(_0x84a7('0x0'));var rp=require(_0x84a7('0x1'));var md5=require(_0x84a7('0x2'));var util=require(_0x84a7('0x3'));var Redis=require(_0x84a7('0x4'));var intUtil=require(_0x84a7('0x5'));var config=require('../../../../config/environment');var logger=require(_0x84a7('0x6'))(_0x84a7('0x7'));config[_0x84a7('0x8')]=_[_0x84a7('0x9')](config[_0x84a7('0x8')],{'host':_0x84a7('0xa'),'port':0x18eb});var io=require(_0x84a7('0xb'))(new Redis(config[_0x84a7('0x8')]));var headers={'Content-Type':_0x84a7('0xc'),'Accept':_0x84a7('0xc')};function emit(_0x405125,_0x599ed3,_0x73026c){io['to'](_0x405125)[_0x84a7('0xd')](_0x599ed3,_0x73026c);}function getTicket(_0x26f810,_0x4d46f2,_0x1331ea,_0x450946,_0x299522){logger['info'](_0x84a7('0xe'));var _0x186e40=_[_0x84a7('0xf')]({'responder_id':_0x4d46f2['id'],'requester_id':_0x1331ea['id'],'name':util[_0x84a7('0x10')]('Caller\x20-\x20%s',_0x299522['calleridname']),'phone':_0x299522[_0x84a7('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x450946[_0x84a7('0x12')],_0x299522,'\x20'),'description':intUtil[_0x84a7('0x13')](_0x450946[_0x84a7('0x14')],_0x299522,_0x84a7('0x15')),'tags':getTags(_0x450946[_0x84a7('0x16')],_0x84a7('0x17'))},getCustomFields(_0x450946[_0x84a7('0x18')],_0x299522));_0x186e40[_0x84a7('0x19')]=_[_0x84a7('0x1a')](_[_0x84a7('0x1b')](_0x186e40[_0x84a7('0x19')],'id'),_0x84a7('0x1c'));return request({'uri':util[_0x84a7('0x10')]('%s/api/v2/tickets',_0x26f810[_0x84a7('0x1d')]),'method':_0x84a7('0x1e'),'body':_0x186e40})[_0x84a7('0x1f')](function(_0x11002b){logger[_0x84a7('0x20')](_0x84a7('0x21'));return _0x11002b;});}function getUser(_0x5973e8,_0x3d6dec){if(intUtil[_0x84a7('0x22')](_0x3d6dec)){return request({'uri':util[_0x84a7('0x10')](_0x84a7('0x23'),_0x5973e8[_0x84a7('0x1d')]),'qs':{'email':_0x3d6dec}})[_0x84a7('0x1f')](function(_0x4f097e){if(_0x4f097e[_0x84a7('0x24')]){logger[_0x84a7('0x20')](_0x84a7('0x25'));return _[_0x84a7('0x26')](_0x4f097e,function(_0x316141){return _0x316141[_0x84a7('0x27')][_0x84a7('0x28')]===_0x3d6dec;});}else{logger['info'](_0x84a7('0x29'));return request({'uri':util[_0x84a7('0x10')](_0x84a7('0x2a'),_0x5973e8[_0x84a7('0x1d')])})[_0x84a7('0x1f')](function(_0x2c5073){logger[_0x84a7('0x20')]('Admin\x20account\x20selected.');return _0x2c5073;});}});}else{logger[_0x84a7('0x20')](_0x84a7('0x2b'));return request({'uri':util[_0x84a7('0x10')](_0x84a7('0x2a'),_0x5973e8[_0x84a7('0x1d')])})['then'](function(_0x53950a){logger[_0x84a7('0x20')]('Admin\x20account\x20selected.');return _0x53950a;});}}function getEndUser(_0x1af917,_0x168e84,_0x42a18b){logger[_0x84a7('0x20')]('Searching\x20enduser\x20with\x20phone',_0x42a18b);return request({'uri':util[_0x84a7('0x10')](_0x84a7('0x2c'),_0x1af917[_0x84a7('0x1d')]),'qs':{'phone':_0x42a18b}})['then'](function(_0xc01eb7){if(_0xc01eb7['length']){logger[_0x84a7('0x20')]('Enduser\x20found!');return _[_0x84a7('0x26')](_0xc01eb7,{'phone':_0x42a18b});}else{logger[_0x84a7('0x20')](_0x84a7('0x2d'));return request({'uri':util['format']('%s/api/v2/contacts',_0x1af917['remoteUri']),'method':'POST','body':{'name':_0x168e84,'phone':_0x42a18b}})[_0x84a7('0x1f')](function(_0x29cf6e){logger['info'](_0x84a7('0x2e'));return _0x29cf6e;});}});}function getAuth(_0x22b907){return util[_0x84a7('0x10')]('Basic\x20%s',new Buffer(_0x22b907['apiKey']+':X')[_0x84a7('0x2f')](_0x84a7('0x30')));}function request(_0x3d651c){logger[_0x84a7('0x31')](_0x84a7('0x32'),JSON['stringify'](_0x3d651c));return rp(_[_0x84a7('0x9')](_0x3d651c,{'method':_0x84a7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x3c453f,_0x253b66){var _0x27cf71=[];if(_0x3c453f&&_0x3c453f[_0x84a7('0x24')]>0x0){_0x27cf71=_['map'](_0x3c453f,_0x253b66);}return _0x27cf71;}function getCustomFields(_0xbd7397,_0x5d12ae){var _0x82562f=[];var _0xa3f069={'custom_fields':[]};if(_0xbd7397[_0x84a7('0x24')]>0x0){_[_0x84a7('0x34')](_0xbd7397,function(_0x28d55f){if(_[_0x84a7('0x35')](['string',_0x84a7('0x36')],_0x28d55f[_0x84a7('0x37')])&&_0x28d55f[_0x84a7('0x38')]&&!_0x28d55f[_0x84a7('0x39')]){_0xa3f069[_0x28d55f['nameField'][_0x84a7('0x3a')]()]=_0x28d55f[_0x84a7('0x3b')]['toString']();}else if(_['includes']([_0x84a7('0x3c'),_0x84a7('0x36')],_0x28d55f[_0x84a7('0x37')])&&_0x28d55f[_0x84a7('0x3d')]&&_0x28d55f['customField']){_0xa3f069['custom_fields'][_0x84a7('0x3e')]({'id':_0x28d55f[_0x84a7('0x3d')],'value':_0x28d55f['content'][_0x84a7('0x2f')]()});}else if(_0x28d55f[_0x84a7('0x37')]===_0x84a7('0x3f')&&_0x28d55f[_0x84a7('0x40')]&&_0x28d55f[_0x84a7('0x3d')]&&_0x28d55f['customField']){_0x5d12ae[_0x28d55f[_0x84a7('0x40')]]&&_0xa3f069[_0x84a7('0x19')][_0x84a7('0x3e')]({'id':_0x28d55f[_0x84a7('0x3d')],'value':_0x5d12ae[_0x28d55f[_0x84a7('0x40')]]['toString']()});}else if(_0x28d55f['type']===_0x84a7('0x41')&&_0x28d55f[_0x84a7('0x42')]&&_0x28d55f[_0x84a7('0x42')][_0x84a7('0x17')]&&_0x28d55f[_0x84a7('0x3d')]&&_0x28d55f['customField']){_0x5d12ae[_0x28d55f['Variable'][_0x84a7('0x17')]['toLowerCase']()]&&_0xa3f069[_0x84a7('0x19')]['push']({'id':_0x28d55f['idField'],'value':_0x5d12ae[_0x28d55f[_0x84a7('0x42')][_0x84a7('0x17')]['toLowerCase']()][_0x84a7('0x2f')]()});}});}return _0xa3f069;}exports[_0x84a7('0x43')]=function(_0x3779ef,_0x2bcef5,_0x37709b,_0xa2d5e1,_0x4f6a4c,_0x17b2c3){var _0xe19c0b,_0x3c3ea2;_0x17b2c3[_0x84a7('0x1d')]=intUtil[_0x84a7('0x44')](_0x17b2c3[_0x84a7('0x1d')]);_0x17b2c3[_0x84a7('0x45')]=intUtil['stripTrailingSlash'](_0x17b2c3[_0x84a7('0x45')]);if(_0x4f6a4c&&_0x4f6a4c['monitor_format']){logger[_0x84a7('0x20')](_0x84a7('0x46'),_0x84a7('0x47'));_0x2bcef5[_0x84a7('0x48')]=util['format'](_0x84a7('0x49'),_0x17b2c3['serverUrl'],_0x2bcef5[_0x84a7('0x4a')],md5(_0x2bcef5[_0x84a7('0x4a')]));}else{_0x2bcef5[_0x84a7('0x48')]='';}headers[_0x84a7('0x4b')]=getAuth(_0x17b2c3);return getUser(_0x17b2c3,_0xa2d5e1[_0x84a7('0x28')])[_0x84a7('0x1f')](function(_0x158458){_0xe19c0b=_0x158458;logger[_0x84a7('0x20')](_0x84a7('0x4c'),_0xe19c0b['id']);return getEndUser(_0x17b2c3,_0x2bcef5[_0x84a7('0x4d')],_0x2bcef5[_0x84a7('0x11')]);})[_0x84a7('0x1f')](function(_0x5132e2){_0x3c3ea2=_0x5132e2;logger[_0x84a7('0x20')](_0x84a7('0x4e'),_0x3c3ea2['id']);return getTicket(_0x17b2c3,_0xe19c0b,_0x3c3ea2,_0x37709b,_0x2bcef5);})[_0x84a7('0x1f')](function(_0x6b17ea){if(_0x6b17ea&&_0x6b17ea['id']){logger[_0x84a7('0x20')](_0x84a7('0x21'));logger[_0x84a7('0x20')](_0x84a7('0x4f'),_0x6b17ea['id']);logger['info'](_0x84a7('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x84a7('0x10')](_0x84a7('0x50'),_0xa2d5e1['name']),_0x84a7('0x51'),{'uri':util[_0x84a7('0x10')](_0x84a7('0x52'),_0x17b2c3[_0x84a7('0x1d')],_0x6b17ea['id'])});}})['catch'](function(_0x485e43){logger[_0x84a7('0x53')](_0x84a7('0x46'),JSON['stringify'](_0x485e43));});};exports['outbound']=function(_0x3308f7,_0x1e7d4a,_0x130cc0,_0x1a6352,_0x3c81ba,_0xa95c2,_0x2f6a28){var _0x5e8da6,_0x3d39de;_0xa95c2[_0x84a7('0x1d')]=intUtil[_0x84a7('0x44')](_0xa95c2[_0x84a7('0x1d')]);_0xa95c2[_0x84a7('0x45')]=intUtil[_0x84a7('0x44')](_0xa95c2['serverUrl']);if(_0x2f6a28&&_0x2f6a28[_0x84a7('0x54')]&&_0x2f6a28[_0x84a7('0x54')]!==_0x84a7('0x55')){logger[_0x84a7('0x20')](_0x84a7('0x56'),_0x84a7('0x47'));_0x1e7d4a[_0x84a7('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa95c2[_0x84a7('0x45')],_0x1e7d4a[_0x84a7('0x4a')],md5(_0x1e7d4a[_0x84a7('0x4a')]));}headers[_0x84a7('0x4b')]=getAuth(_0xa95c2);return getUser(_0xa95c2,_0x1a6352[_0x84a7('0x28')])[_0x84a7('0x1f')](function(_0x1b5441){_0x5e8da6=_0x1b5441;logger[_0x84a7('0x20')](_0x84a7('0x4c'),_0x5e8da6['id']);return getEndUser(_0xa95c2,_0x1e7d4a['destcalleridname'],_0x1e7d4a[_0x84a7('0x57')]);})[_0x84a7('0x1f')](function(_0x11599d){_0x3d39de=_0x11599d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3d39de['id']);return getTicket(_0xa95c2,_0x5e8da6,_0x3d39de,_0x130cc0,_0x1e7d4a);})['then'](function(_0x27f2e5){if(_0x27f2e5&&_0x27f2e5['id']){logger[_0x84a7('0x20')](_0x84a7('0x21'));logger[_0x84a7('0x20')](_0x84a7('0x4f'),_0x27f2e5['id']);logger[_0x84a7('0x20')](_0x84a7('0x56'),_0x84a7('0x58'));emit(util[_0x84a7('0x10')](_0x84a7('0x50'),_0x1a6352['name']),_0x84a7('0x51'),{'uri':util[_0x84a7('0x10')](_0x84a7('0x52'),_0xa95c2[_0x84a7('0x1d')],_0x27f2e5['id'])});}})[_0x84a7('0x59')](function(_0x1cb791){logger[_0x84a7('0x53')](_0x84a7('0x56'),JSON['stringify'](_0x1cb791));});};exports[_0x84a7('0x5a')]=function(_0x2e17ca,_0x21160e,_0x3817e4,_0x1043bb,_0x42de22,_0x336cb6){var _0x37edcb,_0x694d8f;_0x336cb6['remoteUri']=intUtil[_0x84a7('0x44')](_0x336cb6[_0x84a7('0x1d')]);_0x336cb6[_0x84a7('0x45')]=intUtil[_0x84a7('0x44')](_0x336cb6[_0x84a7('0x45')]);if(_0x42de22&&_0x42de22[_0x84a7('0x5b')]){logger[_0x84a7('0x20')]('['+_0x21160e[_0x84a7('0x5c')][_0x84a7('0x5d')]()+']','Recording\x20is\x20enabled!');_0x21160e[_0x84a7('0x48')]=util[_0x84a7('0x10')](_0x84a7('0x49'),_0x336cb6['serverUrl'],_0x21160e[_0x84a7('0x4a')],md5(_0x21160e[_0x84a7('0x4a')]));}else{_0x21160e[_0x84a7('0x48')]='';}headers[_0x84a7('0x4b')]=getAuth(_0x336cb6);return getUser(_0x336cb6,'')[_0x84a7('0x1f')](function(_0x249846){_0x37edcb=_0x249846;logger[_0x84a7('0x20')](_0x84a7('0x4c'),_0x37edcb['id']);return getEndUser(_0x336cb6,_0x21160e[_0x84a7('0x4d')],_0x21160e['calleridnum']);})[_0x84a7('0x1f')](function(_0x3c29a9){_0x694d8f=_0x3c29a9;logger[_0x84a7('0x20')](_0x84a7('0x4e'),_0x694d8f['id']);return getTicket(_0x336cb6,_0x37edcb,_0x694d8f,_0x3817e4,_0x21160e);})[_0x84a7('0x1f')](function(_0x4be4a4){if(_0x4be4a4){logger[_0x84a7('0x20')](_0x84a7('0x21'));logger['info'](_0x84a7('0x4f'),_0x4be4a4['id']);}})[_0x84a7('0x59')](function(_0xd9e546){logger[_0x84a7('0x53')]('['+_0x21160e[_0x84a7('0x5c')]['toUpperCase']()+']',JSON[_0x84a7('0x5e')](_0xd9e546));});}; \ 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 10afc5c..9e6a105 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 _0xbaac=['Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','then','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url'];(function(_0x464203,_0x15ece3){var _0x2e220a=function(_0x2d61d9){while(--_0x2d61d9){_0x464203['push'](_0x464203['shift']());}};_0x2e220a(++_0x15ece3);}(_0xbaac,0x168));var _0xcbaa=function(_0x1e5de7,_0x43cf47){_0x1e5de7=_0x1e5de7-0x0;var _0x1fcccc=_0xbaac[_0x1e5de7];return _0x1fcccc;};'use strict';var _=require(_0xcbaa('0x0'));var rp=require(_0xcbaa('0x1'));var md5=require(_0xcbaa('0x2'));var util=require(_0xcbaa('0x3'));var moment=require('moment');var Promise=require(_0xcbaa('0x4'));var Redis=require(_0xcbaa('0x5'));var intUtil=require(_0xcbaa('0x6'));var config=require(_0xcbaa('0x7'));var logger=require(_0xcbaa('0x8'))(_0xcbaa('0x9'));config[_0xcbaa('0xa')]=_[_0xcbaa('0xb')](config[_0xcbaa('0xa')],{'host':_0xcbaa('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcbaa('0xa')]));function getAdminId(_0x31c8a9,_0x4ade27,_0x3f3aa9,_0x405062){return new Promise(function(_0x45e957,_0x4f05e9){var _0x1172b9=![];var _0x29ef50={'method':_0xcbaa('0xd'),'uri':_0x405062+_0xcbaa('0xe'),'json':!![]};_0x29ef50['headers']=_0x3f3aa9;logger['info']('Getting\x20admin\x20information');return rp(_0x29ef50)['then'](function(_0x373c00){if(_0x373c00){var _0x52c155=_0x373c00['users'];var _0x12ff0c=null;for(_0x12ff0c=0x0;_0x12ff0c<_0x52c155[_0xcbaa('0xf')];_0x12ff0c++){if(_0x52c155[_0x12ff0c][_0xcbaa('0x10')]===_0x31c8a9['adminEmail']){_0x31c8a9[_0xcbaa('0x11')]=_0x52c155[_0x12ff0c]['id'];_0x1172b9=!![];}}if(_0x1172b9){logger[_0xcbaa('0x12')](_0xcbaa('0x13'),_0x31c8a9[_0xcbaa('0x11')]);_0x45e957(_0x31c8a9);}else{_0x4f05e9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4f05e9({'statusCode':0x194,'message':_0xcbaa('0x14')});}})[_0xcbaa('0x15')](function(_0x4092dd){logger[_0xcbaa('0x16')]('['+[_0x4ade27['toUpperCase']()]+']',_0x4092dd[_0xcbaa('0x17')]);_0x4f05e9(_0x4092dd);});});}function getUser(_0x14eb10,_0x241b78,_0x19ef58){return function(_0x744b20){return new Promise(function(_0x3d464c,_0x198974){var _0x4182ec={'method':'GET','uri':_0x19ef58+_0xcbaa('0xe'),'json':!![]};_0x4182ec[_0xcbaa('0x18')]=_0x241b78;logger[_0xcbaa('0x12')](_0xcbaa('0x19'));return rp(_0x4182ec)['then'](function(_0x29f8b5){if(_0x29f8b5){var _0x32111b=_0x29f8b5[_0xcbaa('0x1a')];var _0x484015=![];var _0x1e7907=null;if(_0x744b20['agentEmail']!==null){logger[_0xcbaa('0x12')](_0xcbaa('0x1b'),_0x744b20[_0xcbaa('0x1c')]);_0x744b20[_0xcbaa('0x1d')]=_0x744b20[_0xcbaa('0x1c')];for(_0x1e7907=0x0;_0x1e7907<_0x32111b['length'];_0x1e7907++){if(_0x32111b[_0x1e7907][_0xcbaa('0x10')]===_0x744b20[_0xcbaa('0x1c')]){_0x484015=!![];_0x744b20[_0xcbaa('0x1e')]=_0x32111b[_0x1e7907]['id'];logger[_0xcbaa('0x12')](_0xcbaa('0x1f'),_0x744b20[_0xcbaa('0x1e')]);}}}if(!_0x484015){logger[_0xcbaa('0x12')](_0xcbaa('0x20'));_0x744b20[_0xcbaa('0x1d')]=_0x744b20[_0xcbaa('0x21')];_0x744b20['userId']=_0x744b20['adminId'];_0x484015=!![];}if(_0x484015){_0x3d464c(_0x744b20);}else{_0x198974({'statusCode':0x194,'message':_0xcbaa('0x14')});}}else{_0x198974({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xcbaa('0x15')](function(_0x420214){logger[_0xcbaa('0x16')]('['+[_0x14eb10[_0xcbaa('0x22')]()]+']',_0x420214[_0xcbaa('0x17')]);_0x198974(_0x420214);});});};}function searchContact(_0x3d4d3e,_0x392566,_0x1de6c1,_0x413c33){return new Promise(function(_0x5b59b5,_0x374272){var _0x58869b={'method':'GET','headers':_0x392566,'uri':_0x3d4d3e+_0xcbaa('0x23')+_0x413c33+_0xcbaa('0x24')+_0x1de6c1+_0xcbaa('0x25'),'json':!![]};rp(_0x58869b)['then'](function(_0x5bd6d5){var _0x51721a=_[_0xcbaa('0x26')](_0x5bd6d5[_0xcbaa('0x27')][_0xcbaa('0x27')],[_0x1de6c1,_0x413c33]);_0x5b59b5(_0x51721a);})[_0xcbaa('0x15')](function(_0x3228eb){_0x374272(_0x3228eb);});});}function getEndUser(_0x4bd1c9,_0x7d4986,_0x2264b7){return function(_0x2bff6e){return new Promise(function(_0x3d3217,_0x44b3e6){logger[_0xcbaa('0x12')](util[_0xcbaa('0x28')](_0xcbaa('0x29'),_0x2bff6e[_0xcbaa('0x2a')]));searchContact(_0x2264b7,_0x7d4986,_0xcbaa('0x2b'),_0x2bff6e[_0xcbaa('0x2a')])[_0xcbaa('0x2c')](function(_0x230ea3){if(_0x230ea3){_0x2bff6e[_0xcbaa('0x2d')]=_0x230ea3['id'];logger[_0xcbaa('0x12')]('Contact\x20found\x20mobile_number:',_0x2bff6e['endUserId']);return _0x3d3217(_0x2bff6e);}searchContact(_0x2264b7,_0x7d4986,_0xcbaa('0x2e'),_0x2bff6e['contactNumber'])[_0xcbaa('0x2c')](function(_0x545604){if(_0x545604){_0x2bff6e[_0xcbaa('0x2d')]=_0x545604['id'];logger['info'](_0xcbaa('0x2f'),_0x2bff6e[_0xcbaa('0x2d')]);return _0x3d3217(_0x2bff6e);}createEndUser(_0x2bff6e,_0x4bd1c9,_0x7d4986,_0x2264b7)[_0xcbaa('0x2c')](function(_0x1beac6){logger['info']('Contact\x20created:',_0x1beac6[_0xcbaa('0x2d')]);return _0x3d3217(_0x1beac6);});});})[_0xcbaa('0x15')](function(_0x277597){_0x44b3e6(_0x277597);});});};}function createEndUser(_0x57c7a8,_0x2c614a,_0x423b98,_0xff00b7){return new Promise(function(_0x838aa2,_0x1252f1){var _0x1e1821=moment();var _0x402716={'method':_0xcbaa('0x30'),'uri':_0xff00b7+_0xcbaa('0x31'),'body':{'contact':{'last_name':_0x57c7a8['contactNumber'],'work_number':_0x57c7a8['contactNumber'],'mobile_number':_0x57c7a8[_0xcbaa('0x2a')],'owner_id':_0x57c7a8[_0xcbaa('0x1e')],'created_at':_0x1e1821['format'](_0xcbaa('0x32'))}},'json':!![]};_0x402716[_0xcbaa('0x18')]=_0x423b98;logger[_0xcbaa('0x12')](_0xcbaa('0x33'));return rp(_0x402716)[_0xcbaa('0x2c')](function(_0xe4457a){_0x57c7a8['endUserId']=_0xe4457a[_0xcbaa('0x34')]['id'];_0x838aa2(_0x57c7a8);})['catch'](function(_0x229cf5){logger['error']('['+[_0x2c614a[_0xcbaa('0x22')]()]+']',_0x229cf5[_0xcbaa('0x17')]);_0x1252f1(_0x229cf5[_0xcbaa('0x17')]);});});}function getTicket(_0x584e8a,_0x512eb4,_0x24a31a,_0x3c0406,_0x558c2d){return function(_0xd89f46){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x38d434,_0x2b2fb4){var _0x21ead1=moment();var _0x507d6e={'method':_0xcbaa('0x30'),'uri':_0x24a31a+_0xcbaa('0x35'),'body':{'title':intUtil[_0xcbaa('0x36')](_0x3c0406[_0xcbaa('0x37')],_0x558c2d,'\x20'),'description':intUtil[_0xcbaa('0x36')](_0x3c0406[_0xcbaa('0x38')],_0x558c2d,'\x0a'),'owner_id':_0xd89f46[_0xcbaa('0x1e')],'creater_id':_0xd89f46[_0xcbaa('0x11')],'targetable_id':_0xd89f46[_0xcbaa('0x2d')],'targetable_type':_0xcbaa('0x39'),'created_at':_0x21ead1[_0xcbaa('0x28')](_0xcbaa('0x32')),'due_date':_0x21ead1[_0xcbaa('0x3a')](0x1e,'m')[_0xcbaa('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x507d6e[_0xcbaa('0x18')]=_0x512eb4;return rp(_0x507d6e)[_0xcbaa('0x2c')](function(_0x1e0cf4){_0xd89f46[_0xcbaa('0x3b')]=_0x1e0cf4[_0xcbaa('0x3c')]['id'];logger[_0xcbaa('0x12')]('Task\x20created:',_0xd89f46['ticketId']);_0x38d434(_0xd89f46);})[_0xcbaa('0x15')](function(_0x535565){logger[_0xcbaa('0x16')]('['+[_0x584e8a[_0xcbaa('0x22')]()]+']',_0x535565[_0xcbaa('0x17')]);_0x2b2fb4(_0x535565['message']);});});};}function emit(_0x1f67db,_0x116126,_0x4c943e){var _0x507709={'uri':_0x1f67db+_0xcbaa('0x3d')+_0x4c943e};io['to'](util[_0xcbaa('0x28')](_0xcbaa('0x3e'),_0x116126))[_0xcbaa('0x3f')](_0xcbaa('0x40'),_0x507709);}exports['cs']=function(_0x3afb6f,_0x15404f,_0x10263a,_0x5db0f2,_0xcb0ea8,_0x41f14d,_0x5a0b5b,_0x4ee924){var _0x1bd44e={};var _0x10f971={'Authorization':_0xcbaa('0x41')+_0x41f14d[_0xcbaa('0x42')]};_0x41f14d[_0xcbaa('0x43')]=intUtil[_0xcbaa('0x44')](_0x41f14d[_0xcbaa('0x43')]);_0x41f14d['serverUrl']=intUtil[_0xcbaa('0x44')](_0x41f14d[_0xcbaa('0x45')]);var _0x4d85c6=_0x41f14d[_0xcbaa('0x43')];_0x1bd44e['adminEmail']=_0x41f14d['username'];_0x1bd44e[_0xcbaa('0x2a')]=_0x4ee924[_0xcbaa('0x46')]()===_0xcbaa('0x47')?_0x15404f[_0xcbaa('0x48')]:_0x15404f['calleridnum'];_0x1bd44e[_0xcbaa('0x49')]=_0x4ee924===_0xcbaa('0x4a')||_0x4ee924===_0xcbaa('0x4b')?_0xcbaa('0x4a'):_0xcbaa('0x47');if(_0x5db0f2){_0x1bd44e[_0xcbaa('0x1c')]=_0x5db0f2['email'];}var _0x68532a=util[_0xcbaa('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41f14d[_0xcbaa('0x45')],_0x15404f['uniqueid'],md5(_0x15404f[_0xcbaa('0x4c')]));if(_0xcb0ea8&&_0xcb0ea8['monitor_format']){logger['info'](_0xcbaa('0x4d'),_0xcbaa('0x4e'));_0x15404f[_0xcbaa('0x4f')]=_0x68532a;}else if(_0x5a0b5b&&_0x5a0b5b[_0xcbaa('0x50')]&&_0x5a0b5b[_0xcbaa('0x50')]!==_0xcbaa('0x51')){logger[_0xcbaa('0x12')](_0xcbaa('0x52'),_0xcbaa('0x4e'));_0x15404f[_0xcbaa('0x4f')]=_0x68532a;}else{_0x15404f['recordingURL']='';}return getAdminId(_0x1bd44e,_0x4ee924,_0x10f971,_0x4d85c6)[_0xcbaa('0x2c')](getUser(_0x4ee924,_0x10f971,_0x4d85c6))[_0xcbaa('0x2c')](getEndUser(_0x4ee924,_0x10f971,_0x4d85c6))[_0xcbaa('0x2c')](getTicket(_0x4ee924,_0x10f971,_0x4d85c6,_0x10263a,_0x15404f))[_0xcbaa('0x2c')](function(_0x42c6cc){logger[_0xcbaa('0x12')](util[_0xcbaa('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x42c6cc[_0xcbaa('0x3b')]));if(_0x4ee924!==_0xcbaa('0x4b')){logger['info']('['+[_0x4ee924[_0xcbaa('0x22')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4d85c6,_0x5db0f2['name'],_0x42c6cc['endUserId']);}})[_0xcbaa('0x15')](function(_0xb9f171){logger['error']('['+[_0x4ee924[_0xcbaa('0x22')]()]+_0xcbaa('0x53'),util[_0xcbaa('0x54')](_0xb9f171,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x85ae=['outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','bluebird','ioredis','./util','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','message','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase'];(function(_0x5c76df,_0x3365d0){var _0x25843a=function(_0x1a63b0){while(--_0x1a63b0){_0x5c76df['push'](_0x5c76df['shift']());}};_0x25843a(++_0x3365d0);}(_0x85ae,0xb7));var _0xe85a=function(_0x46dda4,_0x4d51a5){_0x46dda4=_0x46dda4-0x0;var _0x5dff6b=_0x85ae[_0x46dda4];return _0x5dff6b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xe85a('0x0'));var moment=require('moment');var Promise=require(_0xe85a('0x1'));var Redis=require(_0xe85a('0x2'));var intUtil=require(_0xe85a('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe85a('0x4'));config[_0xe85a('0x5')]=_['defaults'](config['redis'],{'host':_0xe85a('0x6'),'port':0x18eb});var io=require(_0xe85a('0x7'))(new Redis(config[_0xe85a('0x5')]));function getAdminId(_0x133bfd,_0x8cc168,_0x379b0c,_0x4ebfe9){return new Promise(function(_0x2bb52a,_0x519769){var _0x2a331c=![];var _0x5bb87f={'method':_0xe85a('0x8'),'uri':_0x4ebfe9+_0xe85a('0x9'),'json':!![]};_0x5bb87f[_0xe85a('0xa')]=_0x379b0c;logger[_0xe85a('0xb')]('Getting\x20admin\x20information');return rp(_0x5bb87f)[_0xe85a('0xc')](function(_0x22352e){if(_0x22352e){var _0x3fb22c=_0x22352e[_0xe85a('0xd')];var _0x40a062=null;for(_0x40a062=0x0;_0x40a062<_0x3fb22c[_0xe85a('0xe')];_0x40a062++){if(_0x3fb22c[_0x40a062][_0xe85a('0xf')]===_0x133bfd[_0xe85a('0x10')]){_0x133bfd['adminId']=_0x3fb22c[_0x40a062]['id'];_0x2a331c=!![];}}if(_0x2a331c){logger['info']('Admin\x20found:',_0x133bfd[_0xe85a('0x11')]);_0x2bb52a(_0x133bfd);}else{_0x519769({'statusCode':0x194,'message':_0xe85a('0x12')});}}else{_0x519769({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe85a('0x13')](function(_0x281db5){logger[_0xe85a('0x14')]('['+[_0x8cc168[_0xe85a('0x15')]()]+']',_0x281db5['message']);_0x519769(_0x281db5);});});}function getUser(_0x32ec63,_0x559aa8,_0x35db7b){return function(_0x1f5188){return new Promise(function(_0x1c4aef,_0x210f9a){var _0x2f15cd={'method':_0xe85a('0x8'),'uri':_0x35db7b+_0xe85a('0x9'),'json':!![]};_0x2f15cd[_0xe85a('0xa')]=_0x559aa8;logger[_0xe85a('0xb')](_0xe85a('0x16'));return rp(_0x2f15cd)[_0xe85a('0xc')](function(_0x32dfc5){if(_0x32dfc5){var _0x535c02=_0x32dfc5[_0xe85a('0xd')];var _0x25c3c6=![];var _0xb99657=null;if(_0x1f5188[_0xe85a('0x17')]!==null){logger[_0xe85a('0xb')](_0xe85a('0x18'),_0x1f5188[_0xe85a('0x17')]);_0x1f5188[_0xe85a('0x19')]=_0x1f5188[_0xe85a('0x17')];for(_0xb99657=0x0;_0xb99657<_0x535c02[_0xe85a('0xe')];_0xb99657++){if(_0x535c02[_0xb99657][_0xe85a('0xf')]===_0x1f5188[_0xe85a('0x17')]){_0x25c3c6=!![];_0x1f5188[_0xe85a('0x1a')]=_0x535c02[_0xb99657]['id'];logger[_0xe85a('0xb')]('User\x20found:',_0x1f5188['userId']);}}}if(!_0x25c3c6){logger['info'](_0xe85a('0x1b'));_0x1f5188[_0xe85a('0x19')]=_0x1f5188[_0xe85a('0x10')];_0x1f5188[_0xe85a('0x1a')]=_0x1f5188[_0xe85a('0x11')];_0x25c3c6=!![];}if(_0x25c3c6){_0x1c4aef(_0x1f5188);}else{_0x210f9a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x210f9a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe85a('0x13')](function(_0x235458){logger[_0xe85a('0x14')]('['+[_0x32ec63[_0xe85a('0x15')]()]+']',_0x235458['message']);_0x210f9a(_0x235458);});});};}function searchContact(_0x5e62f4,_0x560129,_0x46de71,_0x2ff395){return new Promise(function(_0x588492,_0x4ac8a3){var _0x47a5c4={'method':_0xe85a('0x8'),'headers':_0x560129,'uri':_0x5e62f4+_0xe85a('0x1c')+_0x2ff395+_0xe85a('0x1d')+_0x46de71+'&entities=contact','json':!![]};rp(_0x47a5c4)['then'](function(_0x440361){var _0x3e27e1=_[_0xe85a('0x1e')](_0x440361['contacts'][_0xe85a('0x1f')],[_0x46de71,_0x2ff395]);_0x588492(_0x3e27e1);})[_0xe85a('0x13')](function(_0x156bdf){_0x4ac8a3(_0x156bdf);});});}function getEndUser(_0x3ff255,_0x5cab06,_0x516cf9){return function(_0x412893){return new Promise(function(_0x211d96,_0x1008dc){logger[_0xe85a('0xb')](util[_0xe85a('0x20')]('Searching\x20contact\x20with\x20phone\x20%s',_0x412893[_0xe85a('0x21')]));searchContact(_0x516cf9,_0x5cab06,_0xe85a('0x22'),_0x412893[_0xe85a('0x21')])[_0xe85a('0xc')](function(_0x555447){if(_0x555447){_0x412893['endUserId']=_0x555447['id'];logger[_0xe85a('0xb')](_0xe85a('0x23'),_0x412893[_0xe85a('0x24')]);return _0x211d96(_0x412893);}searchContact(_0x516cf9,_0x5cab06,'work_number',_0x412893[_0xe85a('0x21')])['then'](function(_0x5ba0f2){if(_0x5ba0f2){_0x412893[_0xe85a('0x24')]=_0x5ba0f2['id'];logger[_0xe85a('0xb')](_0xe85a('0x25'),_0x412893[_0xe85a('0x24')]);return _0x211d96(_0x412893);}createEndUser(_0x412893,_0x3ff255,_0x5cab06,_0x516cf9)[_0xe85a('0xc')](function(_0x459aa5){logger[_0xe85a('0xb')](_0xe85a('0x26'),_0x459aa5[_0xe85a('0x24')]);return _0x211d96(_0x459aa5);});});})[_0xe85a('0x13')](function(_0x594d26){_0x1008dc(_0x594d26);});});};}function createEndUser(_0x4a5508,_0xb42eac,_0x17b2e1,_0x400a0a){return new Promise(function(_0x5b80a5,_0x23801e){var _0x1e4e62=moment();var _0x488409={'method':_0xe85a('0x27'),'uri':_0x400a0a+_0xe85a('0x28'),'body':{'contact':{'last_name':_0x4a5508[_0xe85a('0x21')],'work_number':_0x4a5508[_0xe85a('0x21')],'mobile_number':_0x4a5508['contactNumber'],'owner_id':_0x4a5508[_0xe85a('0x1a')],'created_at':_0x1e4e62[_0xe85a('0x20')](_0xe85a('0x29'))}},'json':!![]};_0x488409[_0xe85a('0xa')]=_0x17b2e1;logger[_0xe85a('0xb')](_0xe85a('0x2a'));return rp(_0x488409)[_0xe85a('0xc')](function(_0x5f0865){_0x4a5508[_0xe85a('0x24')]=_0x5f0865['contact']['id'];_0x5b80a5(_0x4a5508);})['catch'](function(_0x2a6de2){logger['error']('['+[_0xb42eac[_0xe85a('0x15')]()]+']',_0x2a6de2[_0xe85a('0x2b')]);_0x23801e(_0x2a6de2['message']);});});}function getTicket(_0x845a4f,_0x3f64a6,_0x30b359,_0x2e9981,_0x1422c9){return function(_0x5c99ab){logger[_0xe85a('0xb')](_0xe85a('0x2c'));return new Promise(function(_0x46b54f,_0x362ad9){var _0x2a377c=moment();var _0x3ee1f9={'method':_0xe85a('0x27'),'uri':_0x30b359+_0xe85a('0x2d'),'body':{'title':intUtil['getString'](_0x2e9981[_0xe85a('0x2e')],_0x1422c9,'\x20'),'description':intUtil[_0xe85a('0x2f')](_0x2e9981['Descriptions'],_0x1422c9,'\x0a'),'owner_id':_0x5c99ab[_0xe85a('0x1a')],'creater_id':_0x5c99ab[_0xe85a('0x11')],'targetable_id':_0x5c99ab[_0xe85a('0x24')],'targetable_type':_0xe85a('0x30'),'created_at':_0x2a377c[_0xe85a('0x20')](_0xe85a('0x29')),'due_date':_0x2a377c[_0xe85a('0x31')](0x1e,'m')['format'](_0xe85a('0x29'))},'json':!![]};_0x3ee1f9[_0xe85a('0xa')]=_0x3f64a6;return rp(_0x3ee1f9)['then'](function(_0x564aa6){_0x5c99ab[_0xe85a('0x32')]=_0x564aa6[_0xe85a('0x33')]['id'];logger[_0xe85a('0xb')](_0xe85a('0x34'),_0x5c99ab['ticketId']);_0x46b54f(_0x5c99ab);})[_0xe85a('0x13')](function(_0x5e71a3){logger[_0xe85a('0x14')]('['+[_0x845a4f[_0xe85a('0x15')]()]+']',_0x5e71a3[_0xe85a('0x2b')]);_0x362ad9(_0x5e71a3[_0xe85a('0x2b')]);});});};}function emit(_0xb23df1,_0x20bbb3,_0x40749a){var _0x428aa8={'uri':_0xb23df1+_0xe85a('0x35')+_0x40749a};io['to'](util['format'](_0xe85a('0x36'),_0x20bbb3))[_0xe85a('0x37')]('trigger:browser:url',_0x428aa8);}exports['cs']=function(_0xeebfa,_0xff44a4,_0x1b3380,_0x39231c,_0x536b8d,_0x3e902e,_0xa1c497,_0x209be5){var _0x4721f1={};var _0x16a510={'Authorization':_0xe85a('0x38')+_0x3e902e[_0xe85a('0x39')]};_0x3e902e['remoteUri']=intUtil[_0xe85a('0x3a')](_0x3e902e['remoteUri']);_0x3e902e[_0xe85a('0x3b')]=intUtil[_0xe85a('0x3a')](_0x3e902e[_0xe85a('0x3b')]);var _0x5d6642=_0x3e902e[_0xe85a('0x3c')];_0x4721f1[_0xe85a('0x10')]=_0x3e902e[_0xe85a('0x3d')];_0x4721f1['contactNumber']=_0x209be5[_0xe85a('0x3e')]()===_0xe85a('0x3f')?_0xff44a4[_0xe85a('0x40')]:_0xff44a4[_0xe85a('0x41')];_0x4721f1[_0xe85a('0x42')]=_0x209be5===_0xe85a('0x43')||_0x209be5===_0xe85a('0x44')?_0xe85a('0x43'):_0xe85a('0x3f');if(_0x39231c){_0x4721f1[_0xe85a('0x17')]=_0x39231c[_0xe85a('0xf')];}var _0x42ad3d=util[_0xe85a('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e902e[_0xe85a('0x3b')],_0xff44a4[_0xe85a('0x45')],md5(_0xff44a4[_0xe85a('0x45')]));if(_0x536b8d&&_0x536b8d[_0xe85a('0x46')]){logger[_0xe85a('0xb')](_0xe85a('0x47'),_0xe85a('0x48'));_0xff44a4[_0xe85a('0x49')]=_0x42ad3d;}else if(_0xa1c497&&_0xa1c497[_0xe85a('0x4a')]&&_0xa1c497['recordingFormat']!==_0xe85a('0x4b')){logger[_0xe85a('0xb')](_0xe85a('0x4c'),_0xe85a('0x48'));_0xff44a4[_0xe85a('0x49')]=_0x42ad3d;}else{_0xff44a4['recordingURL']='';}return getAdminId(_0x4721f1,_0x209be5,_0x16a510,_0x5d6642)['then'](getUser(_0x209be5,_0x16a510,_0x5d6642))[_0xe85a('0xc')](getEndUser(_0x209be5,_0x16a510,_0x5d6642))[_0xe85a('0xc')](getTicket(_0x209be5,_0x16a510,_0x5d6642,_0x1b3380,_0xff44a4))['then'](function(_0x56aca8){logger[_0xe85a('0xb')](util[_0xe85a('0x20')](_0xe85a('0x4d'),_0x56aca8['ticketId']));if(_0x209be5!=='unmanaged'){logger[_0xe85a('0xb')]('['+[_0x209be5[_0xe85a('0x15')]()]+']',_0xe85a('0x4e'));emit(_0x5d6642,_0x39231c[_0xe85a('0x4f')],_0x56aca8[_0xe85a('0x24')]);}})[_0xe85a('0x13')](function(_0x382b3d){logger['error']('['+[_0x209be5['toUpperCase']()]+_0xe85a('0x50'),util[_0xe85a('0x51')](_0x382b3d,{'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 7aa2e9c..0e1856e 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 _0x5582=['log','unmanaged','zendesk','sugarcrm','servicenow','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','toLowerCase','data1','find','Configurations','queue','routeId','outbound'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5582,0x118));var _0x2558=function(_0x55445b,_0x164097){_0x55445b=_0x55445b-0x0;var _0x18ef20=_0x5582[_0x55445b];return _0x18ef20;};'use strict';var _=require(_0x2558('0x0'));var util=require(_0x2558('0x1'));var zendesk=require(_0x2558('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x2558('0x3'));var desk=require('./desk');var vtiger=require(_0x2558('0x4'));var servicenow=require(_0x2558('0x5'));var dynamics365=require(_0x2558('0x6'));var freshsales=require(_0x2558('0x7'));var integrations=['zendesk',_0x2558('0x8'),'sugarcrm',_0x2558('0x9'),_0x2558('0xa'),_0x2558('0xb'),_0x2558('0xc'),_0x2558('0xd'),_0x2558('0xe'),'servicenow'];exports[_0x2558('0xf')]=function(_0x2ed98e,_0x54e78d,_0x57c5a9,_0x27c1bc,_0x5846bc,_0x23ee25){if(_0x57c5a9){if(_[_0x2558('0x10')](integrations,_0x2ed98e['data1'][_0x2558('0x11')]())){try{var _0x3287b6=null;var _0xadd277='';var _0x1bba42=_0x57c5a9[_0x2ed98e[_0x2558('0x12')]['toLowerCase']()];if(_0x1bba42){var _0x5643d8=_0x1bba42[_0x2ed98e['data2']];if(_0x5643d8){var _0x3a4912=_[_0x2558('0x13')](_0x5643d8[_0x2558('0x14')],{'id':parseInt(_0x2ed98e['data3'],0xa)});if(_0x3a4912){if(_0x27c1bc){if(_0x5846bc&&_0x54e78d['queue']){_0xadd277=_0x2558('0x15');}else if(_0x54e78d[_0x2558('0x16')]){_0xadd277=_0x2558('0x17');}else{console[_0x2558('0x18')]('EVENT\x20UNKNOWN',_0x54e78d);}}else{_0xadd277=_0x2558('0x19');}switch(_0x2ed98e['data1'][_0x2558('0x11')]()){case _0x2558('0x1a'):zendesk[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case'salesforce':salesforce[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case _0x2558('0x1b'):sugarcrm[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case _0x2558('0x9'):freshdesk[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case _0x2558('0xa'):zoho[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case'desk':desk[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case _0x2558('0xc'):vtiger[_0xadd277](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25);break;case _0x2558('0xe'):freshsales['cs'](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25,_0xadd277);break;case _0x2558('0x1c'):servicenow['cs'](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25,_0xadd277);break;case _0x2558('0xd'):dynamics365['cs'](_0x2ed98e,_0x54e78d,_0x3a4912,_0x27c1bc,_0x5846bc,_0x5643d8,_0x23ee25,_0xadd277);break;default:console[_0x2558('0x18')](_0x2558('0x1d'));}}else{_0x3287b6=require('../../../../config/logger')(_0x2ed98e['data1']['toLowerCase']());_0x3287b6[_0x2558('0x1e')](_0x2558('0x1f'),util[_0x2558('0x20')](_0x2558('0x21'),_0x2ed98e[_0x2558('0x12')][_0x2558('0x11')](),_0x2ed98e[_0x2558('0x22')]));}}else{_0x3287b6=require(_0x2558('0x23'))(_0x2ed98e['data1'][_0x2558('0x11')]());_0x3287b6[_0x2558('0x1e')](_0x2558('0x1f'),util[_0x2558('0x20')](_0x2558('0x24'),_0x2ed98e[_0x2558('0x12')]['toLowerCase'](),_0x2ed98e[_0x2558('0x25')]));}}else{}}catch(_0xad89f7){console['error'](_0xad89f7);}}}}; \ No newline at end of file +var _0xdac9=['./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','data1','toLowerCase','find','Configurations','queue','routeId','outbound','log','unmanaged','vtiger','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xdac9,0x160));var _0x9dac=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xdac9[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x9dac('0x0'));var util=require(_0x9dac('0x1'));var zendesk=require(_0x9dac('0x2'));var salesforce=require(_0x9dac('0x3'));var sugarcrm=require(_0x9dac('0x4'));var freshdesk=require(_0x9dac('0x5'));var zoho=require(_0x9dac('0x6'));var desk=require(_0x9dac('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x9dac('0x8'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x9dac('0x9'),_0x9dac('0xa'),_0x9dac('0xb'),_0x9dac('0xc'),_0x9dac('0xd'),_0x9dac('0xe'),'vtiger',_0x9dac('0xf'),_0x9dac('0x10'),'servicenow'];exports[_0x9dac('0x11')]=function(_0x3548f9,_0x4c2245,_0xe06c96,_0x5597be,_0x38ebf7,_0x2b688c){if(_0xe06c96){if(_['includes'](integrations,_0x3548f9[_0x9dac('0x12')][_0x9dac('0x13')]())){try{var _0x30a3e6=null;var _0x3bc1b1='';var _0x54a5cb=_0xe06c96[_0x3548f9[_0x9dac('0x12')][_0x9dac('0x13')]()];if(_0x54a5cb){var _0xf748cb=_0x54a5cb[_0x3548f9['data2']];if(_0xf748cb){var _0x19e5d7=_[_0x9dac('0x14')](_0xf748cb[_0x9dac('0x15')],{'id':parseInt(_0x3548f9['data3'],0xa)});if(_0x19e5d7){if(_0x5597be){if(_0x38ebf7&&_0x4c2245['queue']){_0x3bc1b1=_0x9dac('0x16');}else if(_0x4c2245[_0x9dac('0x17')]){_0x3bc1b1=_0x9dac('0x18');}else{console[_0x9dac('0x19')]('EVENT\x20UNKNOWN',_0x4c2245);}}else{_0x3bc1b1=_0x9dac('0x1a');}switch(_0x3548f9[_0x9dac('0x12')]['toLowerCase']()){case _0x9dac('0x9'):zendesk[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case'salesforce':salesforce[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0xb'):sugarcrm[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0xc'):freshdesk[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0xd'):zoho[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0xe'):desk[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0x1b'):vtiger[_0x3bc1b1](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c);break;case _0x9dac('0x10'):freshsales['cs'](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c,_0x3bc1b1);break;case _0x9dac('0x1c'):servicenow['cs'](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c,_0x3bc1b1);break;case'dynamics365':dynamics365['cs'](_0x3548f9,_0x4c2245,_0x19e5d7,_0x5597be,_0x38ebf7,_0xf748cb,_0x2b688c,_0x3bc1b1);break;default:console[_0x9dac('0x19')](_0x9dac('0x1d'));}}else{_0x30a3e6=require(_0x9dac('0x1e'))(_0x3548f9['data1'][_0x9dac('0x13')]());_0x30a3e6[_0x9dac('0x1f')](_0x9dac('0x20'),util[_0x9dac('0x21')](_0x9dac('0x22'),_0x3548f9[_0x9dac('0x12')][_0x9dac('0x13')](),_0x3548f9['data3']));}}else{_0x30a3e6=require(_0x9dac('0x1e'))(_0x3548f9[_0x9dac('0x12')][_0x9dac('0x13')]());_0x30a3e6[_0x9dac('0x1f')](_0x9dac('0x20'),util[_0x9dac('0x21')](_0x9dac('0x23'),_0x3548f9['data1'][_0x9dac('0x13')](),_0x3548f9['data2']));}}else{}}catch(_0x26d826){console['error'](_0x26d826);}}}}; \ 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 050062d..91875f8 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 _0x9bec=['variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','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','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','isNil','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','jsforce','ioredis','./util','../../../../config/environment','salesforce','localhost','socket.io-emitter','redis','emit','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','endUserType','lead','WhatId','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable'];(function(_0xd6d6f9,_0x38d743){var _0x38fcbb=function(_0x2e117a){while(--_0x2e117a){_0xd6d6f9['push'](_0xd6d6f9['shift']());}};_0x38fcbb(++_0x38d743);}(_0x9bec,0xb2));var _0xc9be=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9bec[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var rp=require(_0xc9be('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xc9be('0x1'));var util=require('util');var Redis=require(_0xc9be('0x2'));var intUtil=require(_0xc9be('0x3'));var config=require(_0xc9be('0x4'));var logger=require('../../../../config/logger')(_0xc9be('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xc9be('0x6'),'port':0x18eb});var io=require(_0xc9be('0x7'))(new Redis(config[_0xc9be('0x8')]));function emit(_0x168058,_0x2abd7c,_0x55aa7d){io['to'](_0x168058)[_0xc9be('0x9')](_0x2abd7c,_0x55aa7d);}function getTicket(_0x509a09,_0x421170,_0x105662,_0x9d31a9,_0x259209,_0x215239,_0x5d32c1,_0x49baee){var _0x462873=Object[_0xc9be('0xa')]({},{'OwnerId':_0x421170['id'],'Subject':intUtil['getString'](_0x9d31a9[_0xc9be('0xb')],_0x259209,'\x20'),'Description':intUtil[_0xc9be('0xc')](_0x9d31a9[_0xc9be('0xd')],_0x259209,'\x0a')},getCustomFields(_0x215239,_0x259209));if(_0x105662){if(_0x9d31a9[_0xc9be('0xe')]===_0xc9be('0xf')){_0x462873[_0xc9be('0x10')]=moment['utc']();_0x462873[_0xc9be('0x11')]=![];_0x462873['IsRecurrence']=![];if(_0x105662[_0xc9be('0x12')]==='contact'||_0x105662['endUserType']===_0xc9be('0x13')){_0x462873['WhoId']=_0x105662['id'];}else if(_0x105662[_0xc9be('0x12')]==='account'){_0x462873[_0xc9be('0x14')]=_0x105662['id'];}}else if(_0x9d31a9[_0xc9be('0xe')]===_0xc9be('0x15')){if(_0x105662[_0xc9be('0x12')]===_0xc9be('0x16')){_0x462873[_0xc9be('0x17')]=_0x105662['id'];}else if(_0x105662[_0xc9be('0x12')]===_0xc9be('0x18')){_0x462873[_0xc9be('0x19')]=_0x105662['id'];}else if(_0x105662[_0xc9be('0x12')]==='lead'&&_0x9d31a9[_0xc9be('0x1a')]){_0x462873[_0x9d31a9[_0xc9be('0x1a')]]=_0x105662['id'];}else{logger[_0xc9be('0x1b')](_0xc9be('0x1c'));}}}return _0x5d32c1[_0xc9be('0x1d')](_0x9d31a9[_0xc9be('0xe')])[_0xc9be('0x1e')](_0x462873);}function getUser(_0x311c39,_0x2328b8,_0x3a3a37){if(!_['isNil'](_0x2328b8)&&intUtil[_0xc9be('0x1f')](_0x2328b8)){var _0x23840a={'Email':_0x2328b8};var _0xc6ccf1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3a3a37[_0xc9be('0x1d')](_0xc9be('0x20'))[_0xc9be('0x21')](_0x23840a,_0xc6ccf1)[_0xc9be('0x22')]()['then'](function(_0x368b83){if(_0x368b83[_0xc9be('0x23')]){var _0x5d8ebf=_[_0xc9be('0x21')](_0x368b83,function(_0x4db6df){return _0x4db6df['Email']===_0x2328b8;});if(_0x5d8ebf){logger[_0xc9be('0x1b')](_0xc9be('0x24'),_0x2328b8);return BPromise['resolve']({'id':_0x5d8ebf['Id'],'name':_0x5d8ebf[_0xc9be('0x25')]});}}else{logger[_0xc9be('0x1b')](_0xc9be('0x26'),_0x2328b8);return _0x3a3a37[_0xc9be('0x27')]()[_0xc9be('0x28')](function(_0x56c837){return BPromise[_0xc9be('0x29')]({'id':_0x56c837[_0xc9be('0x2a')],'name':_0x56c837['display_name']});});}});}else{logger['info'](_0xc9be('0x26'),_0x2328b8);return _0x3a3a37['identity']()[_0xc9be('0x28')](function(_0x518346){return BPromise[_0xc9be('0x29')]({'id':_0x518346[_0xc9be('0x2a')],'name':_0x518346[_0xc9be('0x2b')]});});}}function getEndUser(_0x9dcdbd,_0x39273c,_0x3f468f,_0x2b477a,_0x2114bf){var _0x2ef487={'$or':{'Phone':_0x2b477a}};var _0x372491={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc9be('0x28')](function(){logger['info'](_0xc9be('0x2c'),_0x2b477a,_0x39273c[_0xc9be('0x2d')]);switch(_0x39273c[_0xc9be('0x2d')]){case'contact_lead':var _0x10dee3=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x2f')]){var _0x1da2ce={};_0x1da2ce[_0x39273c[_0xc9be('0x2f')]]=_0x2b477a;_[_0xc9be('0x30')](_0x10dee3[_0xc9be('0x31')],_0x1da2ce);}return _0x2114bf[_0xc9be('0x1d')](_0xc9be('0x32'))[_0xc9be('0x21')](_0x10dee3,_0x372491)[_0xc9be('0x22')]()[_0xc9be('0x28')](function(_0x364ddc){if(_0x364ddc&&_0x364ddc['length']){return _0x364ddc;}else{var _0x27046c=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x33')]){var _0x596b56={};_0x596b56[_0x39273c[_0xc9be('0x33')]]=_0x2b477a;_[_0xc9be('0x30')](_0x27046c[_0xc9be('0x31')],_0x596b56);}return _0x2114bf[_0xc9be('0x1d')](_0xc9be('0x34'))[_0xc9be('0x21')](_0x27046c,_0x372491);}});case _0xc9be('0x35'):var _0x47f077=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x36')]){var _0x1da2ce={};_0x1da2ce[_0x39273c[_0xc9be('0x36')]]=_0x2b477a;_[_0xc9be('0x30')](_0x47f077[_0xc9be('0x31')],_0x1da2ce);}return _0x2114bf[_0xc9be('0x1d')]('Account')[_0xc9be('0x21')](_0x47f077,_0x372491)[_0xc9be('0x22')]()[_0xc9be('0x28')](function(_0x2f7b48){if(_0x2f7b48&&_0x2f7b48[_0xc9be('0x23')]){return _0x2f7b48;}else{var _0x255c98=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x2f')]){var _0x4b095e={};_0x4b095e[_0x39273c[_0xc9be('0x2f')]]=_0x2b477a;_[_0xc9be('0x30')](_0x255c98[_0xc9be('0x31')],_0x4b095e);}return _0x2114bf['sobject'](_0xc9be('0x32'))[_0xc9be('0x21')](_0x255c98,_0x372491)[_0xc9be('0x28')](function(_0x1abc76){if(_0x1abc76&&_0x1abc76['length']){return _0x1abc76;}else{var _0x37f4fe=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x33')]){var _0x145e71={};_0x145e71[_0x39273c['additionalSearchLead']]=_0x2b477a;_[_0xc9be('0x30')](_0x37f4fe[_0xc9be('0x31')],_0x145e71);}return _0x2114bf['sobject'](_0xc9be('0x34'))['find'](_0x37f4fe,_0x372491);}});}});case _0xc9be('0x16'):var _0x10dee3=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x2f')]){var _0x1da2ce={};_0x1da2ce[_0x39273c[_0xc9be('0x2f')]]=_0x2b477a;_[_0xc9be('0x30')](_0x10dee3[_0xc9be('0x31')],_0x1da2ce);}return _0x2114bf[_0xc9be('0x1d')](_0xc9be('0x32'))[_0xc9be('0x21')](_0x10dee3,_0x372491)['execute']();case _0xc9be('0x13'):var _0x2e7d9c=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x33')]){var _0x1da2ce={};_0x1da2ce[_0x39273c[_0xc9be('0x33')]]=_0x2b477a;_['merge'](_0x2e7d9c[_0xc9be('0x31')],_0x1da2ce);}return _0x2114bf[_0xc9be('0x1d')](_0xc9be('0x34'))[_0xc9be('0x21')](_0x2e7d9c,_0x372491);case'account':var _0x47f077=_[_0xc9be('0x2e')](_0x2ef487);if(_0x39273c[_0xc9be('0x36')]){var _0x1da2ce={};_0x1da2ce[_0x39273c[_0xc9be('0x36')]]=_0x2b477a;_[_0xc9be('0x30')](_0x47f077[_0xc9be('0x31')],_0x1da2ce);}return _0x2114bf[_0xc9be('0x1d')](_0xc9be('0x37'))[_0xc9be('0x21')](_0x47f077,_0x372491);default:return null;}})['then'](function(_0x408dc5){if(_0x408dc5&&_0x408dc5[_0xc9be('0x23')]){var _0x52065c=_[_0xc9be('0x38')](_0x408dc5);if(_0x52065c){return BPromise[_0xc9be('0x29')]({'id':_0x52065c['Id'],'name':_0x52065c[_0xc9be('0x25')],'phone':_0x52065c[_0xc9be('0x39')],'endUserType':_0x52065c['attributes'][_0xc9be('0x3a')][_0xc9be('0x3b')]()});}}})['then'](function(_0x2e1054){if(_0x2e1054){logger[_0xc9be('0x1b')](_0xc9be('0x3c'),_0x2e1054[_0xc9be('0x12')],_0x2b477a);return BPromise['resolve'](_0x2e1054);}else{logger[_0xc9be('0x1b')](_0xc9be('0x3d'),_0x2b477a);var _0x454876={'Phone':_0x2b477a};if(_0x39273c[_0xc9be('0x3e')]){if(_0x39273c[_0xc9be('0x3e')]===_0xc9be('0x16')){logger[_0xc9be('0x1b')](_0xc9be('0x3f'),_0x2b477a,_0x39273c[_0xc9be('0x3e')]);_0x454876['LastName']=_0x3f468f!==_0xc9be('0x40')?_0x3f468f:util[_0xc9be('0x41')](_0xc9be('0x42'),_0x2b477a);}else if(_0x39273c['moduleCreate']===_0xc9be('0x13')){logger[_0xc9be('0x1b')](_0xc9be('0x3f'),_0x2b477a,_0x39273c[_0xc9be('0x3e')]);_0x454876[_0xc9be('0x43')]=_0x3f468f!==_0xc9be('0x40')?_0x3f468f:util[_0xc9be('0x41')](_0xc9be('0x42'),_0x2b477a);_0x454876[_0xc9be('0x44')]=_0xc9be('0x45');}else if(_0x39273c[_0xc9be('0x3e')]==='account'){logger[_0xc9be('0x1b')](_0xc9be('0x3f'),_0x2b477a,_0x39273c[_0xc9be('0x3e')]);_0x454876[_0xc9be('0x25')]=_0x3f468f!==_0xc9be('0x40')?_0x3f468f:util[_0xc9be('0x41')](_0xc9be('0x42'),_0x2b477a);}else{return null;}}return _0x2114bf[_0xc9be('0x1d')](_[_0xc9be('0x46')](_0x39273c['moduleCreate']))['create'](_0x454876)[_0xc9be('0x28')](function(_0x526568){return BPromise['resolve']({'id':_0x526568['id'],'endUserType':_0x39273c[_0xc9be('0x3e')]});});}});}function getCustomFields(_0x1fcffb,_0x34df46){var _0x7f4437={};if(_0x1fcffb[_0xc9be('0x23')]>0x0){_['forEach'](_0x1fcffb,function(_0x532ab1){if(_[_0xc9be('0x47')]([_0xc9be('0x48'),_0xc9be('0x49')],_0x532ab1[_0xc9be('0x3a')])&&_0x532ab1[_0xc9be('0x4a')]){_0x7f4437[_0x532ab1[_0xc9be('0x4a')]]=_0x532ab1[_0xc9be('0x4b')][_0xc9be('0x4c')]();}else if(_0x532ab1[_0xc9be('0x3a')]===_0xc9be('0x4d')&&_0x532ab1[_0xc9be('0x4e')]&&_0x532ab1[_0xc9be('0x4a')]){_0x34df46[_0x532ab1[_0xc9be('0x4e')]]&&(_0x7f4437[_0x532ab1['idField']]=_0x34df46[_0x532ab1[_0xc9be('0x4e')]][_0xc9be('0x4c')]());}else if(_0x532ab1[_0xc9be('0x3a')]===_0xc9be('0x4f')&&_0x532ab1[_0xc9be('0x50')]&&_0x532ab1['Variable'][_0xc9be('0x51')]&&_0x532ab1['idField']){_0x34df46[_0x532ab1['Variable'][_0xc9be('0x51')]['toLowerCase']()]&&(_0x7f4437[_0x532ab1[_0xc9be('0x4a')]]=_0x34df46[_0x532ab1['Variable'][_0xc9be('0x51')][_0xc9be('0x3b')]()][_0xc9be('0x4c')]());}});}return _0x7f4437;}function getConnection(_0x3f19eb){var _0x392c25=_0x3f19eb['password'][_0xc9be('0x52')](_0x3f19eb[_0xc9be('0x53')]);var _0x1bd0f2=new jsforce[(_0xc9be('0x54'))]({'oauth2':{'loginUrl':_0x3f19eb[_0xc9be('0x55')]||_0xc9be('0x56'),'clientId':_0x3f19eb['clientId'],'clientSecret':_0x3f19eb[_0xc9be('0x57')]}});return _0x1bd0f2['login'](_0x3f19eb[_0xc9be('0x58')],_0x392c25)['then'](function(){logger['info'](_0xc9be('0x59'));return _0x1bd0f2;});}exports[_0xc9be('0x5a')]=function(_0x5248bd,_0x4129d6,_0x385879,_0x201bf1,_0x2217d3,_0x1697f5){var _0x560e90,_0x3902d7,_0x187e75,_0x1bb8ba;_0x1697f5[_0xc9be('0x5b')]=intUtil[_0xc9be('0x5c')](_0x1697f5['serverUrl']);_0x1697f5[_0xc9be('0x55')]=intUtil[_0xc9be('0x5c')](_0x1697f5['remoteUri']);if(_0x2217d3&&_0x2217d3[_0xc9be('0x5d')]){logger['info']('[QUEUE]',_0xc9be('0x5e'));_0x4129d6[_0xc9be('0x5f')]=util[_0xc9be('0x41')](_0xc9be('0x60'),_0x1697f5[_0xc9be('0x5b')],_0x4129d6['uniqueid'],md5(_0x4129d6['uniqueid']));}else{_0x4129d6[_0xc9be('0x5f')]='';}return getConnection(_0x1697f5)[_0xc9be('0x28')](function(_0x3bfada){_0x1bb8ba=_0x3bfada;return getUser(_0x1697f5,_0x201bf1[_0xc9be('0x61')],_0x1bb8ba);})['then'](function(_0x6ec31c){_0x560e90=_0x6ec31c;return getEndUser(_0x1697f5,_0x385879,_0x4129d6[_0xc9be('0x62')],_0x4129d6['calleridnum'],_0x1bb8ba);})[_0xc9be('0x28')](function(_0x4755ad){_0x3902d7=_0x4755ad;return getTicket(_0x1697f5,_0x560e90,_0x3902d7,_0x385879,_0x4129d6,_0x385879[_0xc9be('0x63')],_0x1bb8ba,'queue');})['then'](function(_0x373ad9){_0x187e75=_0x373ad9;logger[_0xc9be('0x1b')](_0xc9be('0x64'),_0x187e75['id']);logger[_0xc9be('0x1b')](_0xc9be('0x65'),_0x187e75['id'],_0x201bf1[_0xc9be('0x51')],_0x1697f5['type']);switch(_0x1697f5[_0xc9be('0x3a')]){case _0xc9be('0x66'):emit(util[_0xc9be('0x41')](_0xc9be('0x67'),_0x201bf1['name']),_0xc9be('0x68'),{'recordId':_0x187e75['id']});break;case _0xc9be('0x69'):emit(util[_0xc9be('0x41')](_0xc9be('0x67'),_0x201bf1['name']),_0xc9be('0x6a'),{'uri':util[_0xc9be('0x41')](_0xc9be('0x6b'),_0x1bb8ba[_0xc9be('0x6c')],_0x187e75['id'])});break;default:logger[_0xc9be('0x6d')](_0xc9be('0x6e'));}})[_0xc9be('0x6f')](function(_0x47cf79){logger[_0xc9be('0x6d')](_0xc9be('0x70'),_0x47cf79);});};exports[_0xc9be('0x71')]=function(_0x39ce14,_0x3315cc,_0x2674a8,_0x560711,_0x5d9a27,_0x3620a8,_0x10e9ad){var _0x50edfc,_0x81beb9,_0x1fcb71,_0x496e4d;_0x3620a8[_0xc9be('0x5b')]=intUtil['stripTrailingSlash'](_0x3620a8['serverUrl']);_0x3620a8['remoteUri']=intUtil[_0xc9be('0x5c')](_0x3620a8[_0xc9be('0x55')]);if(_0x10e9ad&&_0x10e9ad['recordingFormat']&&_0x10e9ad[_0xc9be('0x72')]!==_0xc9be('0x73')){logger[_0xc9be('0x1b')](_0xc9be('0x74'),_0xc9be('0x5e'));_0x3315cc[_0xc9be('0x5f')]=util[_0xc9be('0x41')](_0xc9be('0x60'),_0x3620a8[_0xc9be('0x5b')],_0x3315cc['uniqueid'],md5(_0x3315cc[_0xc9be('0x75')]));}return getConnection(_0x3620a8)[_0xc9be('0x28')](function(_0x2c7183){_0x496e4d=_0x2c7183;return getUser(_0x3620a8,_0x560711[_0xc9be('0x61')],_0x496e4d);})[_0xc9be('0x28')](function(_0x743beb){_0x50edfc=_0x743beb;return getEndUser(_0x3620a8,_0x2674a8,_0x3315cc[_0xc9be('0x76')],_0x3315cc['destcalleridnum'],_0x496e4d);})[_0xc9be('0x28')](function(_0x4b5040){_0x81beb9=_0x4b5040;return getTicket(_0x3620a8,_0x50edfc,_0x81beb9,_0x2674a8,_0x3315cc,_0x2674a8[_0xc9be('0x63')],_0x496e4d,'outbound');})[_0xc9be('0x28')](function(_0x24c250){_0x1fcb71=_0x24c250;logger['info'](_0xc9be('0x77'),_0x1fcb71['id']);logger[_0xc9be('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1fcb71['id'],_0x560711[_0xc9be('0x51')],_0x3620a8[_0xc9be('0x3a')]);switch(_0x3620a8[_0xc9be('0x3a')]){case _0xc9be('0x66'):emit(util[_0xc9be('0x41')](_0xc9be('0x67'),_0x560711[_0xc9be('0x51')]),_0xc9be('0x68'),{'recordId':_0x1fcb71['id']});break;case'newTab':emit(util[_0xc9be('0x41')](_0xc9be('0x67'),_0x560711[_0xc9be('0x51')]),_0xc9be('0x6a'),{'uri':util[_0xc9be('0x41')](_0xc9be('0x6b'),_0x496e4d[_0xc9be('0x6c')],_0x1fcb71['id'])});break;default:logger[_0xc9be('0x6d')](_0xc9be('0x74'),_0xc9be('0x78'));}})[_0xc9be('0x6f')](function(_0x298fbd){logger[_0xc9be('0x6d')](_0xc9be('0x74'),_0x298fbd);});};exports[_0xc9be('0x79')]=function(_0x3d68ef,_0x48be7c,_0x64650d,_0x31b7f2,_0x5ee6ea,_0x2908b2){var _0x45c10,_0x3c3dd3,_0xa72d21,_0x276a4b;_0x2908b2[_0xc9be('0x5b')]=intUtil['stripTrailingSlash'](_0x2908b2[_0xc9be('0x5b')]);_0x2908b2[_0xc9be('0x55')]=intUtil[_0xc9be('0x5c')](_0x2908b2[_0xc9be('0x55')]);if(_0x5ee6ea&&_0x5ee6ea[_0xc9be('0x5d')]){logger[_0xc9be('0x1b')]('['+_0x48be7c[_0xc9be('0x7a')]['toUpperCase']()+']',_0xc9be('0x5e'));_0x48be7c[_0xc9be('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2908b2[_0xc9be('0x5b')],_0x48be7c[_0xc9be('0x75')],md5(_0x48be7c['uniqueid']));}else{_0x48be7c[_0xc9be('0x5f')]='';}return getConnection(_0x2908b2)[_0xc9be('0x28')](function(_0x1f948e){_0x276a4b=_0x1f948e;if(!_[_0xc9be('0x7b')](_0x31b7f2)){return getUser(_0x2908b2,_0x31b7f2[_0xc9be('0x51')],_0x276a4b);}else{return getUser(_0x2908b2,null,_0x276a4b);}})[_0xc9be('0x28')](function(_0x5664a1){_0x45c10=_0x5664a1;return getEndUser(_0x2908b2,_0x64650d,_0x48be7c[_0xc9be('0x62')],_0x48be7c[_0xc9be('0x7c')],_0x276a4b);})[_0xc9be('0x28')](function(_0x18ef43){_0x3c3dd3=_0x18ef43;return getTicket(_0x2908b2,_0x45c10,_0x3c3dd3,_0x64650d,_0x48be7c,_0x64650d[_0xc9be('0x63')],_0x276a4b);})['then'](function(_0x155a75){_0xa72d21=_0x155a75;logger[_0xc9be('0x1b')]('['+_0x48be7c[_0xc9be('0x7a')][_0xc9be('0x7d')]()+_0xc9be('0x7e'),_0xa72d21['id']);logger[_0xc9be('0x1b')]('['+_0x48be7c[_0xc9be('0x7a')][_0xc9be('0x7d')]()+_0xc9be('0x7f'),_0x2908b2['type']);})[_0xc9be('0x6f')](function(_0x2e05c9){logger[_0xc9be('0x6d')]('['+_0x48be7c[_0xc9be('0x7a')][_0xc9be('0x7d')]()+']',_0x2e05c9);});}; \ No newline at end of file +var _0x8238=['includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','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','error','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','unmanaged','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','AccountId','leadId','info','sobject','create','isNil','validateEmail','execute','then','length','Agent\x20%s\x20found.','resolve','Name','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','contact_lead','cloneDeep','additionalSearchContact','merge','$or','find','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Contact','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','forEach'];(function(_0xa45e8b,_0x1454b2){var _0x9cc27f=function(_0x4f43d9){while(--_0x4f43d9){_0xa45e8b['push'](_0xa45e8b['shift']());}};_0x9cc27f(++_0x1454b2);}(_0x8238,0x1c3));var _0x8823=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x8238[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x8823('0x0'));var rp=require(_0x8823('0x1'));var moment=require(_0x8823('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x8823('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8823('0x4'));var config=require(_0x8823('0x5'));var logger=require(_0x8823('0x6'))(_0x8823('0x7'));config[_0x8823('0x8')]=_[_0x8823('0x9')](config['redis'],{'host':_0x8823('0xa'),'port':0x18eb});var io=require(_0x8823('0xb'))(new Redis(config['redis']));function emit(_0x3ef6ff,_0x227827,_0x1aa512){io['to'](_0x3ef6ff)[_0x8823('0xc')](_0x227827,_0x1aa512);}function getTicket(_0xb050e5,_0xc8c84e,_0x40c37e,_0x46cd8c,_0x1d92c7,_0x5c5e84,_0x173058,_0x752595){var _0x3abb17=Object[_0x8823('0xd')]({},{'OwnerId':_0xc8c84e['id'],'Subject':intUtil['getString'](_0x46cd8c['Subjects'],_0x1d92c7,'\x20'),'Description':intUtil[_0x8823('0xe')](_0x46cd8c['Descriptions'],_0x1d92c7,'\x0a')},getCustomFields(_0x5c5e84,_0x1d92c7));if(_0x40c37e){if(_0x46cd8c[_0x8823('0xf')]===_0x8823('0x10')){_0x3abb17['ActivityDate']=moment[_0x8823('0x11')]();_0x3abb17[_0x8823('0x12')]=![];_0x3abb17[_0x8823('0x13')]=![];if(_0x40c37e[_0x8823('0x14')]===_0x8823('0x15')||_0x40c37e[_0x8823('0x14')]===_0x8823('0x16')){_0x3abb17[_0x8823('0x17')]=_0x40c37e['id'];}else if(_0x40c37e['endUserType']===_0x8823('0x18')){_0x3abb17[_0x8823('0x19')]=_0x40c37e['id'];}}else if(_0x46cd8c[_0x8823('0xf')]===_0x8823('0x1a')){if(_0x40c37e['endUserType']===_0x8823('0x15')){_0x3abb17['ContactId']=_0x40c37e['id'];}else if(_0x40c37e[_0x8823('0x14')]===_0x8823('0x18')){_0x3abb17[_0x8823('0x1b')]=_0x40c37e['id'];}else if(_0x40c37e[_0x8823('0x14')]===_0x8823('0x16')&&_0x46cd8c[_0x8823('0x1c')]){_0x3abb17[_0x46cd8c[_0x8823('0x1c')]]=_0x40c37e['id'];}else{logger[_0x8823('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x173058[_0x8823('0x1e')](_0x46cd8c[_0x8823('0xf')])[_0x8823('0x1f')](_0x3abb17);}function getUser(_0x5980fb,_0x3212d2,_0x4fd475){if(!_[_0x8823('0x20')](_0x3212d2)&&intUtil[_0x8823('0x21')](_0x3212d2)){var _0x5553b6={'Email':_0x3212d2};var _0x151d4b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4fd475[_0x8823('0x1e')]('User')['find'](_0x5553b6,_0x151d4b)[_0x8823('0x22')]()[_0x8823('0x23')](function(_0x2151ce){if(_0x2151ce[_0x8823('0x24')]){var _0x2436e1=_['find'](_0x2151ce,function(_0xdc3bc5){return _0xdc3bc5['Email']===_0x3212d2;});if(_0x2436e1){logger[_0x8823('0x1d')](_0x8823('0x25'),_0x3212d2);return BPromise[_0x8823('0x26')]({'id':_0x2436e1['Id'],'name':_0x2436e1[_0x8823('0x27')]});}}else{logger[_0x8823('0x1d')](_0x8823('0x28'),_0x3212d2);return _0x4fd475[_0x8823('0x29')]()[_0x8823('0x23')](function(_0x58ee73){return BPromise[_0x8823('0x26')]({'id':_0x58ee73[_0x8823('0x2a')],'name':_0x58ee73[_0x8823('0x2b')]});});}});}else{logger[_0x8823('0x1d')](_0x8823('0x28'),_0x3212d2);return _0x4fd475[_0x8823('0x29')]()[_0x8823('0x23')](function(_0x124e96){return BPromise['resolve']({'id':_0x124e96[_0x8823('0x2a')],'name':_0x124e96[_0x8823('0x2b')]});});}}function getEndUser(_0x3b2d08,_0x563590,_0x5ebe44,_0x1a7cf9,_0x4ad72a){var _0x274789={'$or':{'Phone':_0x1a7cf9}};var _0x59b31a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8823('0x26')]()[_0x8823('0x23')](function(){logger['info'](_0x8823('0x2c'),_0x1a7cf9,_0x563590[_0x8823('0x2d')]);switch(_0x563590[_0x8823('0x2d')]){case _0x8823('0x2e'):var _0x47e56e=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x30')]){var _0x170516={};_0x170516[_0x563590[_0x8823('0x30')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x47e56e[_0x8823('0x32')],_0x170516);}return _0x4ad72a[_0x8823('0x1e')]('Contact')[_0x8823('0x33')](_0x47e56e,_0x59b31a)['execute']()[_0x8823('0x23')](function(_0x64f04d){if(_0x64f04d&&_0x64f04d[_0x8823('0x24')]){return _0x64f04d;}else{var _0x2d078f=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x34')]){var _0x373a5e={};_0x373a5e[_0x563590['additionalSearchLead']]=_0x1a7cf9;_[_0x8823('0x31')](_0x2d078f[_0x8823('0x32')],_0x373a5e);}return _0x4ad72a['sobject']('Lead')[_0x8823('0x33')](_0x2d078f,_0x59b31a);}});case _0x8823('0x35'):var _0x15b124=_['cloneDeep'](_0x274789);if(_0x563590['additionalSearchAccount']){var _0x170516={};_0x170516[_0x563590[_0x8823('0x36')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x15b124[_0x8823('0x32')],_0x170516);}return _0x4ad72a[_0x8823('0x1e')]('Account')[_0x8823('0x33')](_0x15b124,_0x59b31a)[_0x8823('0x22')]()[_0x8823('0x23')](function(_0xcc742){if(_0xcc742&&_0xcc742['length']){return _0xcc742;}else{var _0x1ab2a5=_[_0x8823('0x2f')](_0x274789);if(_0x563590['additionalSearchContact']){var _0x436501={};_0x436501[_0x563590[_0x8823('0x30')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x1ab2a5[_0x8823('0x32')],_0x436501);}return _0x4ad72a[_0x8823('0x1e')]('Contact')[_0x8823('0x33')](_0x1ab2a5,_0x59b31a)[_0x8823('0x23')](function(_0x5d0e43){if(_0x5d0e43&&_0x5d0e43[_0x8823('0x24')]){return _0x5d0e43;}else{var _0x2d817f=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x34')]){var _0x202f82={};_0x202f82[_0x563590[_0x8823('0x34')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x2d817f[_0x8823('0x32')],_0x202f82);}return _0x4ad72a[_0x8823('0x1e')](_0x8823('0x37'))[_0x8823('0x33')](_0x2d817f,_0x59b31a);}});}});case _0x8823('0x15'):var _0x47e56e=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x30')]){var _0x170516={};_0x170516[_0x563590['additionalSearchContact']]=_0x1a7cf9;_['merge'](_0x47e56e['$or'],_0x170516);}return _0x4ad72a['sobject'](_0x8823('0x38'))[_0x8823('0x33')](_0x47e56e,_0x59b31a)[_0x8823('0x22')]();case _0x8823('0x16'):var _0x1dad43=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x34')]){var _0x170516={};_0x170516[_0x563590[_0x8823('0x34')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x1dad43[_0x8823('0x32')],_0x170516);}return _0x4ad72a[_0x8823('0x1e')]('Lead')[_0x8823('0x33')](_0x1dad43,_0x59b31a);case'account':var _0x15b124=_[_0x8823('0x2f')](_0x274789);if(_0x563590[_0x8823('0x36')]){var _0x170516={};_0x170516[_0x563590[_0x8823('0x36')]]=_0x1a7cf9;_[_0x8823('0x31')](_0x15b124[_0x8823('0x32')],_0x170516);}return _0x4ad72a['sobject'](_0x8823('0x39'))[_0x8823('0x33')](_0x15b124,_0x59b31a);default:return null;}})['then'](function(_0x1dfdc7){if(_0x1dfdc7&&_0x1dfdc7[_0x8823('0x24')]){var _0xdd0c44=_[_0x8823('0x3a')](_0x1dfdc7);if(_0xdd0c44){return BPromise[_0x8823('0x26')]({'id':_0xdd0c44['Id'],'name':_0xdd0c44[_0x8823('0x27')],'phone':_0xdd0c44[_0x8823('0x3b')],'endUserType':_0xdd0c44[_0x8823('0x3c')][_0x8823('0x3d')][_0x8823('0x3e')]()});}}})['then'](function(_0x5c66be){if(_0x5c66be){logger[_0x8823('0x1d')](_0x8823('0x3f'),_0x5c66be[_0x8823('0x14')],_0x1a7cf9);return BPromise['resolve'](_0x5c66be);}else{logger[_0x8823('0x1d')](_0x8823('0x40'),_0x1a7cf9);var _0x15184d={'Phone':_0x1a7cf9};if(_0x563590[_0x8823('0x41')]){if(_0x563590[_0x8823('0x41')]===_0x8823('0x15')){logger[_0x8823('0x1d')](_0x8823('0x42'),_0x1a7cf9,_0x563590[_0x8823('0x41')]);_0x15184d[_0x8823('0x43')]=_0x5ebe44!==_0x8823('0x44')?_0x5ebe44:util[_0x8823('0x45')](_0x8823('0x46'),_0x1a7cf9);}else if(_0x563590[_0x8823('0x41')]===_0x8823('0x16')){logger[_0x8823('0x1d')](_0x8823('0x42'),_0x1a7cf9,_0x563590[_0x8823('0x41')]);_0x15184d[_0x8823('0x43')]=_0x5ebe44!==_0x8823('0x44')?_0x5ebe44:util[_0x8823('0x45')](_0x8823('0x46'),_0x1a7cf9);_0x15184d['Company']='No\x20Company';}else if(_0x563590[_0x8823('0x41')]===_0x8823('0x18')){logger[_0x8823('0x1d')](_0x8823('0x42'),_0x1a7cf9,_0x563590[_0x8823('0x41')]);_0x15184d[_0x8823('0x27')]=_0x5ebe44!==_0x8823('0x44')?_0x5ebe44:util[_0x8823('0x45')](_0x8823('0x46'),_0x1a7cf9);}else{return null;}}return _0x4ad72a[_0x8823('0x1e')](_[_0x8823('0x47')](_0x563590[_0x8823('0x41')]))[_0x8823('0x1f')](_0x15184d)['then'](function(_0x163aec){return BPromise[_0x8823('0x26')]({'id':_0x163aec['id'],'endUserType':_0x563590['moduleCreate']});});}});}function getCustomFields(_0x633ea,_0x99185a){var _0xd4cde2={};if(_0x633ea[_0x8823('0x24')]>0x0){_[_0x8823('0x48')](_0x633ea,function(_0x29742b){if(_[_0x8823('0x49')]([_0x8823('0x4a'),_0x8823('0x4b')],_0x29742b[_0x8823('0x3d')])&&_0x29742b[_0x8823('0x4c')]){_0xd4cde2[_0x29742b[_0x8823('0x4c')]]=_0x29742b[_0x8823('0x4d')]['toString']();}else if(_0x29742b[_0x8823('0x3d')]===_0x8823('0x4e')&&_0x29742b[_0x8823('0x4f')]&&_0x29742b[_0x8823('0x4c')]){_0x99185a[_0x29742b[_0x8823('0x4f')]]&&(_0xd4cde2[_0x29742b['idField']]=_0x99185a[_0x29742b['variableName']][_0x8823('0x50')]());}else if(_0x29742b[_0x8823('0x3d')]===_0x8823('0x51')&&_0x29742b[_0x8823('0x52')]&&_0x29742b[_0x8823('0x52')][_0x8823('0x53')]&&_0x29742b[_0x8823('0x4c')]){_0x99185a[_0x29742b['Variable'][_0x8823('0x53')][_0x8823('0x3e')]()]&&(_0xd4cde2[_0x29742b[_0x8823('0x4c')]]=_0x99185a[_0x29742b[_0x8823('0x52')][_0x8823('0x53')][_0x8823('0x3e')]()][_0x8823('0x50')]());}});}return _0xd4cde2;}function getConnection(_0x277820){var _0x5ecee1=_0x277820[_0x8823('0x54')][_0x8823('0x55')](_0x277820[_0x8823('0x56')]);var _0x1a3672=new jsforce[(_0x8823('0x57'))]({'oauth2':{'loginUrl':_0x277820[_0x8823('0x58')]||_0x8823('0x59'),'clientId':_0x277820[_0x8823('0x5a')],'clientSecret':_0x277820[_0x8823('0x5b')]}});return _0x1a3672[_0x8823('0x5c')](_0x277820[_0x8823('0x5d')],_0x5ecee1)[_0x8823('0x23')](function(){logger['info'](_0x8823('0x5e'));return _0x1a3672;});}exports[_0x8823('0x5f')]=function(_0x4dcb1e,_0x4a2843,_0x54ac32,_0x2106c1,_0x30aaa9,_0x4b7392){var _0x4e27c2,_0x1867e9,_0x11be56,_0x1d22c0;_0x4b7392['serverUrl']=intUtil[_0x8823('0x60')](_0x4b7392[_0x8823('0x61')]);_0x4b7392['remoteUri']=intUtil['stripTrailingSlash'](_0x4b7392['remoteUri']);if(_0x30aaa9&&_0x30aaa9[_0x8823('0x62')]){logger[_0x8823('0x1d')](_0x8823('0x63'),_0x8823('0x64'));_0x4a2843[_0x8823('0x65')]=util[_0x8823('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b7392[_0x8823('0x61')],_0x4a2843['uniqueid'],md5(_0x4a2843[_0x8823('0x66')]));}else{_0x4a2843[_0x8823('0x65')]='';}return getConnection(_0x4b7392)[_0x8823('0x23')](function(_0x1877f5){_0x1d22c0=_0x1877f5;return getUser(_0x4b7392,_0x2106c1[_0x8823('0x67')],_0x1d22c0);})[_0x8823('0x23')](function(_0x3bf568){_0x4e27c2=_0x3bf568;return getEndUser(_0x4b7392,_0x54ac32,_0x4a2843['calleridname'],_0x4a2843[_0x8823('0x68')],_0x1d22c0);})[_0x8823('0x23')](function(_0x244cc0){_0x1867e9=_0x244cc0;return getTicket(_0x4b7392,_0x4e27c2,_0x1867e9,_0x54ac32,_0x4a2843,_0x54ac32[_0x8823('0x69')],_0x1d22c0,_0x8823('0x5f'));})[_0x8823('0x23')](function(_0x12adaf){_0x11be56=_0x12adaf;logger['info'](_0x8823('0x6a'),_0x11be56['id']);logger['info'](_0x8823('0x6b'),_0x11be56['id'],_0x2106c1['name'],_0x4b7392['type']);switch(_0x4b7392[_0x8823('0x3d')]){case _0x8823('0x6c'):emit(util[_0x8823('0x45')](_0x8823('0x6d'),_0x2106c1['name']),_0x8823('0x6e'),{'recordId':_0x11be56['id']});break;case _0x8823('0x6f'):emit(util[_0x8823('0x45')]('user:%s',_0x2106c1[_0x8823('0x53')]),_0x8823('0x70'),{'uri':util[_0x8823('0x45')]('%s/%s/e',_0x1d22c0[_0x8823('0x71')],_0x11be56['id'])});break;default:logger[_0x8823('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8823('0x73')](function(_0x4630ce){logger['error'](_0x8823('0x63'),_0x4630ce);});};exports[_0x8823('0x74')]=function(_0x4b726c,_0xeea7fd,_0x5b575a,_0x26bd18,_0x29a837,_0x3c7a4f,_0x243150){var _0x235172,_0x537f70,_0x1ae328,_0x237fb2;_0x3c7a4f[_0x8823('0x61')]=intUtil['stripTrailingSlash'](_0x3c7a4f[_0x8823('0x61')]);_0x3c7a4f[_0x8823('0x58')]=intUtil[_0x8823('0x60')](_0x3c7a4f[_0x8823('0x58')]);if(_0x243150&&_0x243150[_0x8823('0x75')]&&_0x243150['recordingFormat']!==_0x8823('0x76')){logger[_0x8823('0x1d')](_0x8823('0x77'),_0x8823('0x64'));_0xeea7fd[_0x8823('0x65')]=util[_0x8823('0x45')](_0x8823('0x78'),_0x3c7a4f[_0x8823('0x61')],_0xeea7fd['uniqueid'],md5(_0xeea7fd['uniqueid']));}return getConnection(_0x3c7a4f)[_0x8823('0x23')](function(_0x56c239){_0x237fb2=_0x56c239;return getUser(_0x3c7a4f,_0x26bd18[_0x8823('0x67')],_0x237fb2);})['then'](function(_0x482b68){_0x235172=_0x482b68;return getEndUser(_0x3c7a4f,_0x5b575a,_0xeea7fd[_0x8823('0x79')],_0xeea7fd[_0x8823('0x7a')],_0x237fb2);})[_0x8823('0x23')](function(_0x581c1c){_0x537f70=_0x581c1c;return getTicket(_0x3c7a4f,_0x235172,_0x537f70,_0x5b575a,_0xeea7fd,_0x5b575a[_0x8823('0x69')],_0x237fb2,_0x8823('0x74'));})[_0x8823('0x23')](function(_0x4efc44){_0x1ae328=_0x4efc44;logger[_0x8823('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1ae328['id']);logger[_0x8823('0x1d')](_0x8823('0x7b'),_0x1ae328['id'],_0x26bd18['name'],_0x3c7a4f[_0x8823('0x3d')]);switch(_0x3c7a4f[_0x8823('0x3d')]){case'integrationTab':emit(util['format'](_0x8823('0x6d'),_0x26bd18[_0x8823('0x53')]),_0x8823('0x6e'),{'recordId':_0x1ae328['id']});break;case _0x8823('0x6f'):emit(util[_0x8823('0x45')](_0x8823('0x6d'),_0x26bd18[_0x8823('0x53')]),_0x8823('0x70'),{'uri':util['format'](_0x8823('0x7c'),_0x237fb2['instanceUrl'],_0x1ae328['id'])});break;default:logger[_0x8823('0x72')](_0x8823('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8823('0x73')](function(_0x58cb1c){logger[_0x8823('0x72')](_0x8823('0x77'),_0x58cb1c);});};exports[_0x8823('0x7d')]=function(_0x4e0180,_0x5dbc78,_0x53a697,_0xb1993a,_0x54a56f,_0x42435a){var _0x1b33cc,_0x40d89d,_0x51ecf8,_0x5ef4dc;_0x42435a['serverUrl']=intUtil['stripTrailingSlash'](_0x42435a[_0x8823('0x61')]);_0x42435a['remoteUri']=intUtil[_0x8823('0x60')](_0x42435a[_0x8823('0x58')]);if(_0x54a56f&&_0x54a56f[_0x8823('0x62')]){logger[_0x8823('0x1d')]('['+_0x5dbc78['lastevent'][_0x8823('0x7e')]()+']','Recording\x20is\x20enabled!');_0x5dbc78['recordingURL']=util[_0x8823('0x45')](_0x8823('0x78'),_0x42435a[_0x8823('0x61')],_0x5dbc78[_0x8823('0x66')],md5(_0x5dbc78[_0x8823('0x66')]));}else{_0x5dbc78[_0x8823('0x65')]='';}return getConnection(_0x42435a)[_0x8823('0x23')](function(_0x3c50fd){_0x5ef4dc=_0x3c50fd;if(!_['isNil'](_0xb1993a)){return getUser(_0x42435a,_0xb1993a['name'],_0x5ef4dc);}else{return getUser(_0x42435a,null,_0x5ef4dc);}})['then'](function(_0x1724f1){_0x1b33cc=_0x1724f1;return getEndUser(_0x42435a,_0x53a697,_0x5dbc78[_0x8823('0x7f')],_0x5dbc78[_0x8823('0x68')],_0x5ef4dc);})[_0x8823('0x23')](function(_0x31a4e2){_0x40d89d=_0x31a4e2;return getTicket(_0x42435a,_0x1b33cc,_0x40d89d,_0x53a697,_0x5dbc78,_0x53a697[_0x8823('0x69')],_0x5ef4dc);})[_0x8823('0x23')](function(_0x26b805){_0x51ecf8=_0x26b805;logger[_0x8823('0x1d')]('['+_0x5dbc78[_0x8823('0x80')][_0x8823('0x7e')]()+_0x8823('0x81'),_0x51ecf8['id']);logger[_0x8823('0x1d')]('['+_0x5dbc78[_0x8823('0x80')][_0x8823('0x7e')]()+_0x8823('0x82'),_0x42435a[_0x8823('0x3d')]);})['catch'](function(_0x333c9f){logger[_0x8823('0x72')]('['+_0x5dbc78['lastevent']['toUpperCase']()+']',_0x333c9f);});}; \ 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 ddbcfcf..deb29bf 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 _0x24cb=['customField','content','toString','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Descriptions','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','adminId','info','toUpperCase','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField'];(function(_0x48eb39,_0x128582){var _0x26d101=function(_0x4b2ed5){while(--_0x4b2ed5){_0x48eb39['push'](_0x48eb39['shift']());}};_0x26d101(++_0x128582);}(_0x24cb,0x11b));var _0xb24c=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x24cb[_0x874cf1];return _0x233579;};'use strict';var _=require(_0xb24c('0x0'));var Promise=require(_0xb24c('0x1'));var rp=require(_0xb24c('0x2'));var util=require(_0xb24c('0x3'));var md5=require(_0xb24c('0x4'));var Redis=require(_0xb24c('0x5'));var intUtil=require(_0xb24c('0x6'));var config=require('../../../../config/environment');var logger=require(_0xb24c('0x7'))(_0xb24c('0x8'));config[_0xb24c('0x9')]=_['defaults'](config[_0xb24c('0x9')],{'host':_0xb24c('0xa'),'port':0x18eb});var io=require(_0xb24c('0xb'))(new Redis(config['redis']));function getAdminUser(_0x401967,_0x5baf8d,_0x4bc014,_0x53c14a,_0x5d6ba6,_0x1db57f){return new Promise(function(_0x4f0c06,_0x5aa011){var _0x266601={'method':_0xb24c('0xc'),'uri':_0x53c14a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d6ba6+'&'+_0x1db57f,'auth':_0x5baf8d,'json':!![]};return rp(_0x266601)[_0xb24c('0xd')](function(_0x4eda2b){if(_0x4eda2b[_0xb24c('0xe')]['length']>0x0){_0x4bc014[_0xb24c('0xf')]=_0x4eda2b[_0xb24c('0xe')][0x0]['sys_id'];}logger[_0xb24c('0x10')]('['+[_0x401967[_0xb24c('0x11')]()]+'],\x20getAdminUser\x20crm',_0x4bc014);_0x4f0c06(_0x4bc014);})['catch'](function(_0x302218){logger[_0xb24c('0x12')]('['+[_0x401967[_0xb24c('0x11')]()]+']',_0x302218[_0xb24c('0x13')]);_0x5aa011(_0x302218[_0xb24c('0x13')]);});});}function getUser(_0x3d018f,_0x10fcbe,_0x3ce3b2,_0x5d9908,_0xbed07d){return function(_0x7d8f51){logger[_0xb24c('0x10')]('['+[_0x3d018f[_0xb24c('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x7d8f51);return new Promise(function(_0x462289,_0x1114e0){if(intUtil[_0xb24c('0x14')](_0x7d8f51[_0xb24c('0x15')])){var _0x97e25b={'method':_0xb24c('0xc'),'uri':_0x3ce3b2+'sys_user?sysparm_query=email%3D'+_0x7d8f51[_0xb24c('0x15')]+'&'+_0x5d9908+'&'+_0xbed07d,'auth':_0x10fcbe,'json':!![]};logger[_0xb24c('0x10')]('['+[_0x3d018f[_0xb24c('0x11')]()]+_0xb24c('0x16'),_0x97e25b);return rp(_0x97e25b)['then'](function(_0x51e34f){logger['info']('['+[_0x3d018f[_0xb24c('0x11')]()]+_0xb24c('0x17'),_0x51e34f);if(_0x51e34f[_0xb24c('0xe')]['length']>0x0&&String(_0x51e34f[_0xb24c('0xe')][0x0][_0xb24c('0x18')])===_0xb24c('0x19')){_0x7d8f51[_0xb24c('0x1a')]=_0x51e34f['result'][0x0][_0xb24c('0x1b')];}else{_0x7d8f51[_0xb24c('0x1a')]=_0x7d8f51[_0xb24c('0xf')];_0x7d8f51['userEmail']=_0x7d8f51[_0xb24c('0x1c')];}logger['info']('['+[_0x3d018f[_0xb24c('0x11')]()]+_0xb24c('0x1d'),_0x7d8f51);_0x462289(_0x7d8f51);})[_0xb24c('0x1e')](function(_0x542cfe){logger[_0xb24c('0x12')]('['+[_0x3d018f['toUpperCase']()]+']',_0x542cfe['message']);_0x1114e0(_0x542cfe[_0xb24c('0x13')]);});}else{logger[_0xb24c('0x10')]('['+[_0x3d018f[_0xb24c('0x11')]()]+']\x20using\x20admin\x20profile');_0x7d8f51[_0xb24c('0x1a')]=_0x7d8f51[_0xb24c('0xf')];_0x7d8f51[_0xb24c('0x15')]=_0x7d8f51[_0xb24c('0x1c')];_0x462289(_0x7d8f51);}});};}function createEndUser(_0x201f3d,_0x996ef0,_0x316e2b,_0x86dea3,_0x155772){logger[_0xb24c('0x10')]('['+[_0x201f3d[_0xb24c('0x11')]()]+_0xb24c('0x1f'),_0x316e2b);return new Promise(function(_0x5dd46b,_0x2ea1ee){var _0x244955={'method':_0xb24c('0x20'),'uri':_0x86dea3+_0xb24c('0x21')+_0x155772,'body':{'user_name':_0x316e2b['endUserNumber'],'roles':_0xb24c('0x22'),'first_name':_0x316e2b[_0xb24c('0x23')],'active':_0xb24c('0x19'),'date_format':'System','phone':_0x316e2b[_0xb24c('0x23')]},'auth':_0x996ef0,'json':!![]};return rp(_0x244955)[_0xb24c('0xd')](function(_0x56a381){logger['info']('['+[_0x201f3d['toUpperCase']()]+'],\x20EndUser\x20schema',_0x56a381[_0xb24c('0xe')]);_0x316e2b['endUserId']=_0x56a381[_0xb24c('0xe')][_0xb24c('0x1b')];_0x5dd46b(_0x316e2b);})[_0xb24c('0x1e')](function(_0x2f3523){logger[_0xb24c('0x12')]('['+[_0x201f3d['toUpperCase']()]+']',_0x2f3523['message']);_0x2ea1ee(_0x2f3523[_0xb24c('0x13')]);});});}function getEndUser(_0x1797ad,_0x5ade47,_0x223d6e,_0x26f168,_0x4f5b97){return function(_0x30b212){logger[_0xb24c('0x10')]('['+[_0x1797ad[_0xb24c('0x11')]()]+_0xb24c('0x24'),_0x30b212);return new Promise(function(_0x16a40b,_0x28577c){var _0xc5088c={'method':_0xb24c('0xc'),'uri':_0x223d6e+_0xb24c('0x25')+_0x30b212[_0xb24c('0x23')]+'&'+_0x26f168+'&'+_0x4f5b97,'auth':_0x5ade47,'json':!![]};return rp(_0xc5088c)[_0xb24c('0xd')](function(_0x39f0b2){if(_0x39f0b2[_0xb24c('0xe')][_0xb24c('0x26')]>0x0){_0x30b212['endUserId']=_0x39f0b2[_0xb24c('0xe')][0x0]['sys_id'];logger[_0xb24c('0x10')]('['+[_0x1797ad[_0xb24c('0x11')]()]+_0xb24c('0x27'),_0x30b212);_0x16a40b(_0x30b212);}else{return createEndUser(_0x1797ad,_0x5ade47,_0x30b212,_0x223d6e,_0x26f168)[_0xb24c('0xd')](function(_0x352f33){logger[_0xb24c('0x10')]('['+[_0x1797ad[_0xb24c('0x11')]()]+_0xb24c('0x28'),_0x352f33);_0x16a40b(_0x352f33);});}})[_0xb24c('0x1e')](function(_0x3dd9d9){logger[_0xb24c('0x12')]('['+[_0x1797ad[_0xb24c('0x11')]()]+']',_0x3dd9d9[_0xb24c('0x13')]);_0x28577c(_0x3dd9d9[_0xb24c('0x13')]);});});};}function getCustomFields(_0x48fb5a,_0x3744c5){var _0x3d3ca1={};if(_0x48fb5a['length']>0x0){_[_0xb24c('0x29')](_0x48fb5a,function(_0x41dbbf){if(_[_0xb24c('0x2a')]([_0xb24c('0x2b'),_0xb24c('0x2c')],_0x41dbbf[_0xb24c('0x2d')])&&_0x41dbbf[_0xb24c('0x2e')]&&!_0x41dbbf[_0xb24c('0x2f')]){_0x3d3ca1[_0x41dbbf[_0xb24c('0x2e')]['toLowerCase']()]=_0x41dbbf[_0xb24c('0x30')][_0xb24c('0x31')]();}else if(_[_0xb24c('0x2a')]([_0xb24c('0x2b'),'picklist'],_0x41dbbf[_0xb24c('0x2d')])&&_0x41dbbf['idField']&&_0x41dbbf['customField']){_0x3d3ca1[_0x41dbbf[_0xb24c('0x32')][_0xb24c('0x33')]()]=_0x41dbbf[_0xb24c('0x30')][_0xb24c('0x31')]();}else if(_0x41dbbf[_0xb24c('0x2d')]===_0xb24c('0x34')&&_0x41dbbf[_0xb24c('0x35')]&&_0x41dbbf[_0xb24c('0x32')]&&_0x41dbbf[_0xb24c('0x2f')]){_0x3d3ca1[_0x41dbbf[_0xb24c('0x32')]['toLowerCase']()]=_0x3744c5[_0x41dbbf[_0xb24c('0x35')]][_0xb24c('0x31')]();}else if(_0x41dbbf[_0xb24c('0x2d')]===_0xb24c('0x36')&&_0x41dbbf[_0xb24c('0x37')]&&_0x41dbbf[_0xb24c('0x37')][_0xb24c('0x38')]&&_0x41dbbf[_0xb24c('0x32')]&&_0x41dbbf[_0xb24c('0x2f')]){_0x3d3ca1[_0x41dbbf[_0xb24c('0x32')][_0xb24c('0x33')]()]=_0x3744c5[_0x41dbbf['Variable'][_0xb24c('0x38')][_0xb24c('0x33')]()][_0xb24c('0x31')]();}});}return _0x3d3ca1;}function getTicket(_0x53db1e,_0x3b8d3e,_0x30967e,_0x51273f,_0x47aa3f,_0x46f5ec){return function(_0x8ce7f4){logger[_0xb24c('0x10')]('['+[_0x53db1e[_0xb24c('0x11')]()]+_0xb24c('0x39'),_0x8ce7f4);return new Promise(function(_0x22b12a,_0x2bc046){var _0x218a8e=_0x53db1e[_0xb24c('0x33')]()===_0xb24c('0x3a')?_0x8ce7f4[_0xb24c('0x1a')]:_0x8ce7f4[_0xb24c('0x3b')];var _0x437c00={'method':_0xb24c('0x20'),'uri':_0x30967e+_0xb24c('0x3c')+'?'+_0x46f5ec,'body':Object[_0xb24c('0x3d')]({},{'active':'true','caller_id':_0x218a8e,'assigned_to':_0x8ce7f4['userId'],'short_description':intUtil[_0xb24c('0x3e')](_0x51273f['Subjects'],_0x47aa3f,'\x20'),'description':intUtil[_0xb24c('0x3e')](_0x51273f[_0xb24c('0x3f')],_0x47aa3f,'\x0a')},getCustomFields(_0x51273f['Fields'],_0x47aa3f)),'auth':_0x3b8d3e,'json':!![]};return rp(_0x437c00)[_0xb24c('0xd')](function(_0x487268){logger[_0xb24c('0x10')]('['+[_0x53db1e[_0xb24c('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x487268[_0xb24c('0xe')]);_0x8ce7f4[_0xb24c('0x40')]=_0x487268[_0xb24c('0xe')]['sys_id'];_0x8ce7f4[_0xb24c('0x41')]=_0x487268[_0xb24c('0xe')][_0xb24c('0x42')];logger[_0xb24c('0x10')]('['+[_0x53db1e[_0xb24c('0x11')]()]+']\x20getTicket\x20crm',_0x8ce7f4);_0x22b12a(_0x8ce7f4);})[_0xb24c('0x1e')](function(_0x226d25){logger[_0xb24c('0x12')]('['+[_0x53db1e[_0xb24c('0x11')]()]+']',_0x226d25[_0xb24c('0x13')]);_0x2bc046(_0x226d25[_0xb24c('0x13')]);});});};}function createRemoteTag(_0x51f823,_0x1454be,_0x28199c,_0x4566b4){return new Promise(function(_0xf29648,_0xd96e0d){var _0x1e6abb={'method':'POST','uri':_0x28199c+'label'+'?'+_0x4566b4,'body':{'short_description':_0x51f823,'global':!![],'active':!![],'name':_0x51f823},'auth':_0x1454be,'json':!![]};return rp(_0x1e6abb)[_0xb24c('0xd')](function(_0x2594c3){var _0x443aa6=_0x2594c3['result'][_0xb24c('0x1b')];_0xf29648(_0x443aa6);});});}function getRemoteTag(_0x3ea062,_0x4b68d3,_0x479970,_0x485ff9,_0x596e14){return new Promise(function(_0x5b9a6b,_0x29c6db){var _0x510348={'method':_0xb24c('0xc'),'uri':_0x479970+_0xb24c('0x43')+_0xb24c('0x44')+_0x3ea062+'&'+_0x485ff9,'auth':_0x4b68d3,'json':!![]};return rp(_0x510348)['then'](function(_0xc3eb17){if(_0xc3eb17[_0xb24c('0xe')][_0xb24c('0x26')]>0x0){var _0x3bb83f=_0xc3eb17[_0xb24c('0xe')][0x0]['sys_id'];_0x5b9a6b(_0x3bb83f);}else{return createRemoteTag(_0x3ea062,_0x4b68d3,_0x479970,_0x485ff9)[_0xb24c('0xd')](function(_0xe47e64){_0x5b9a6b(_0xe47e64);});}});});}function assignTagToIncident(_0x1b5e79,_0x4dd226,_0x1cbe25,_0x120d86,_0x55210c){return new Promise(function(_0x30eecd,_0x4ccf57){var _0x3fa9fe={'method':_0xb24c('0x20'),'uri':_0x1cbe25+_0xb24c('0x45')+'?'+_0x55210c,'body':{'label':_0x1b5e79,'table':'incident','id_type':_0xb24c('0x46'),'table_key':_0x120d86[_0xb24c('0x40')],'title':_0xb24c('0x47')+_0x120d86['ticketNumber'],'id_display':_0x120d86['ticketNumber']},'auth':_0x4dd226,'json':!![]};return rp(_0x3fa9fe)[_0xb24c('0xd')](function(_0x1f1274){_0x30eecd();})['catch'](function(){_0x30eecd();});});}function manageTags(_0x33f65c,_0x4cb3f9,_0x1791f4,_0x450ec5,_0x1549e2,_0x5416bb,_0x5c503a){return new Promise(function(_0x38fe45,_0x4b410e){var _0x54b73c=[];_0x4cb3f9[_0xb24c('0x29')](function(_0x1bbd9f){_0x54b73c[_0xb24c('0x48')](getRemoteTag(_0x1bbd9f,_0x1791f4,_0x450ec5,_0x5416bb,_0x5c503a));});return Promise[_0xb24c('0x49')](_0x54b73c)[_0xb24c('0xd')](function(_0x5ced5c){if(_0x5ced5c[_0xb24c('0x26')]){logger[_0xb24c('0x10')]('['+[_0x33f65c[_0xb24c('0x11')]()]+_0xb24c('0x4a'),_0x5ced5c);var _0x598c45=[];_0x5ced5c[_0xb24c('0x29')](function(_0x4b08ff){_0x598c45[_0xb24c('0x48')](assignTagToIncident(_0x4b08ff,_0x1791f4,_0x450ec5,_0x1549e2,_0x5416bb));});return Promise[_0xb24c('0x49')](_0x598c45)['then'](function(){_0x38fe45();})[_0xb24c('0x1e')](function(){_0x38fe45();});}else{_0x38fe45();}});});}function getTags(_0x253340,_0x2a4fdb,_0x1c317b,_0x2e844e,_0xe64ca3,_0x155138){return function(_0x1c416d){return new Promise(function(_0x10d3ad,_0x457683){var _0x456e47=[];var _0x1c53ac=_0x2e844e[_0xb24c('0x4b')];if(_0x1c53ac&&_0x1c53ac[_0xb24c('0x26')]>0x0){_0x456e47=_['map'](_0x1c53ac,'name');}if(_0x456e47[_0xb24c('0x26')]>0x0){return manageTags(_0x253340,_0x456e47,_0x2a4fdb,_0x1c317b,_0x1c416d,_0xe64ca3,_0x155138)['then'](function(){_0x10d3ad(_0x1c416d);});}else{_0x10d3ad(_0x1c416d);}});};}function emit(_0x335b36,_0xcfae2e,_0x5b7b9a){var _0xe3d252=_0xb24c('0x4c')+_0xb24c('0x4d')+_0xb24c('0x4e')+_0xb24c('0x4f');var _0xf2ddd={'uri':_0x335b36+_0xb24c('0x50')+_0x5b7b9a+_0xe3d252};io['to'](util[_0xb24c('0x51')]('user:%s',_0xcfae2e))[_0xb24c('0x52')](_0xb24c('0x53'),_0xf2ddd);}exports['cs']=function(_0x32bc81,_0x2f45a4,_0x4fd736,_0x4f0cbb,_0x3987ba,_0x1bcb31,_0x2ee255,_0x91c73){var _0x7fd4da={};var _0x5276d5={'user':_0x1bcb31[_0xb24c('0x54')],'pass':_0x1bcb31[_0xb24c('0x55')]};var _0x4a2424=_0xb24c('0x56');var _0x1f5d59=_0xb24c('0x57');_0x1bcb31['remoteUri']=intUtil[_0xb24c('0x58')](_0x1bcb31[_0xb24c('0x59')]);_0x1bcb31[_0xb24c('0x5a')]=intUtil['stripTrailingSlash'](_0x1bcb31[_0xb24c('0x5a')]);var _0x52de11=util[_0xb24c('0x51')]('%s/api/now/table/',_0x1bcb31[_0xb24c('0x59')]);_0x7fd4da[_0xb24c('0x15')]=!_[_0xb24c('0x5b')](_0x4f0cbb)?_0x4f0cbb['email']:null;_0x7fd4da[_0xb24c('0x1c')]=_0x1bcb31[_0xb24c('0x5c')];_0x7fd4da['endUserNumber']=_0x91c73[_0xb24c('0x33')]()===_0xb24c('0x3a')?_0x2f45a4[_0xb24c('0x5d')]:_0x2f45a4[_0xb24c('0x5e')];_0x7fd4da['callDirection']=_0x91c73===_0xb24c('0x5f')||_0x91c73===_0xb24c('0x60')?_0xb24c('0x5f'):_0xb24c('0x3a');var _0xf626df=util[_0xb24c('0x51')](_0xb24c('0x61'),_0x1bcb31[_0xb24c('0x5a')],_0x2f45a4[_0xb24c('0x62')],md5(_0x2f45a4['uniqueid']));if(_0x3987ba&&_0x3987ba[_0xb24c('0x63')]){logger['info']('[QUEUE]',_0xb24c('0x64'));_0x2f45a4[_0xb24c('0x65')]=_0xf626df;}else if(_0x2ee255&&_0x2ee255['recordingFormat']&&_0x2ee255[_0xb24c('0x66')]!==_0xb24c('0x67')){logger[_0xb24c('0x10')](_0xb24c('0x68'),_0xb24c('0x64'));_0x2f45a4[_0xb24c('0x65')]=_0xf626df;}else{_0x2f45a4['recordingURL']='';}return getAdminUser(_0x91c73,_0x5276d5,_0x7fd4da,_0x52de11,_0x1f5d59,_0x4a2424)[_0xb24c('0xd')](getUser(_0x91c73,_0x5276d5,_0x52de11,_0x1f5d59,_0x4a2424))['then'](getEndUser(_0x91c73,_0x5276d5,_0x52de11,_0x1f5d59,_0x4a2424))[_0xb24c('0xd')](getTicket(_0x91c73,_0x5276d5,_0x52de11,_0x4fd736,_0x2f45a4,_0x1f5d59))[_0xb24c('0xd')](function(_0x3bd4e6){logger['info'](util[_0xb24c('0x51')](_0xb24c('0x69'),_0x3bd4e6[_0xb24c('0x40')]));logger[_0xb24c('0x10')](util[_0xb24c('0x51')](_0xb24c('0x6a'),_0x91c73));if(_0x91c73!=='unmanaged'){logger['info']('['+[_0x91c73['toUpperCase']()]+']',_0xb24c('0x6b'));emit(_0x1bcb31[_0xb24c('0x59')],_0x4f0cbb[_0xb24c('0x38')],_0x3bd4e6[_0xb24c('0x40')]);}})['catch'](function(_0x3dc20d){logger[_0xb24c('0x12')]('['+[_0x91c73[_0xb24c('0x11')]()]+_0xb24c('0x6c'),util[_0xb24c('0x6d')](_0x3dc20d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc298=['sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','./util','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','catch','forEach','includes','string','nameField','customField','toLowerCase','toString','picklist','type','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password'];(function(_0x405985,_0x3d3611){var _0x3fa911=function(_0x2cb917){while(--_0x2cb917){_0x405985['push'](_0x405985['shift']());}};_0x3fa911(++_0x3d3611);}(_0xc298,0x1c8));var _0x8c29=function(_0x27d397,_0x238f0b){_0x27d397=_0x27d397-0x0;var _0x558dd2=_0xc298[_0x27d397];return _0x558dd2;};'use strict';var _=require(_0x8c29('0x0'));var Promise=require(_0x8c29('0x1'));var rp=require(_0x8c29('0x2'));var util=require('util');var md5=require(_0x8c29('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8c29('0x4'));var config=require('../../../../config/environment');var logger=require(_0x8c29('0x5'))('servicenow');config[_0x8c29('0x6')]=_['defaults'](config[_0x8c29('0x6')],{'host':_0x8c29('0x7'),'port':0x18eb});var io=require(_0x8c29('0x8'))(new Redis(config['redis']));function getAdminUser(_0xe3523c,_0x4f855d,_0x3b05ab,_0xaf8ede,_0x4e51e6,_0x902a19){return new Promise(function(_0x2ace59,_0x58657f){var _0x11c096={'method':_0x8c29('0x9'),'uri':_0xaf8ede+_0x8c29('0xa')+'&'+_0x4e51e6+'&'+_0x902a19,'auth':_0x4f855d,'json':!![]};return rp(_0x11c096)[_0x8c29('0xb')](function(_0x4bbfa8){if(_0x4bbfa8[_0x8c29('0xc')][_0x8c29('0xd')]>0x0){_0x3b05ab[_0x8c29('0xe')]=_0x4bbfa8[_0x8c29('0xc')][0x0]['sys_id'];}logger[_0x8c29('0xf')]('['+[_0xe3523c[_0x8c29('0x10')]()]+_0x8c29('0x11'),_0x3b05ab);_0x2ace59(_0x3b05ab);})['catch'](function(_0x549360){logger[_0x8c29('0x12')]('['+[_0xe3523c[_0x8c29('0x10')]()]+']',_0x549360[_0x8c29('0x13')]);_0x58657f(_0x549360[_0x8c29('0x13')]);});});}function getUser(_0x26d3fc,_0x344c44,_0x52b1f0,_0x39e291,_0x4d2116){return function(_0x391340){logger[_0x8c29('0xf')]('['+[_0x26d3fc['toUpperCase']()]+_0x8c29('0x14'),_0x391340);return new Promise(function(_0x40509e,_0x5cfa21){if(intUtil[_0x8c29('0x15')](_0x391340[_0x8c29('0x16')])){var _0x1150d1={'method':_0x8c29('0x9'),'uri':_0x52b1f0+'sys_user?sysparm_query=email%3D'+_0x391340['userEmail']+'&'+_0x39e291+'&'+_0x4d2116,'auth':_0x344c44,'json':!![]};logger[_0x8c29('0xf')]('['+[_0x26d3fc[_0x8c29('0x10')]()]+_0x8c29('0x17'),_0x1150d1);return rp(_0x1150d1)['then'](function(_0x3e3c2f){logger[_0x8c29('0xf')]('['+[_0x26d3fc['toUpperCase']()]+_0x8c29('0x18'),_0x3e3c2f);if(_0x3e3c2f['result'][_0x8c29('0xd')]>0x0&&String(_0x3e3c2f[_0x8c29('0xc')][0x0][_0x8c29('0x19')])===_0x8c29('0x1a')){_0x391340[_0x8c29('0x1b')]=_0x3e3c2f[_0x8c29('0xc')][0x0]['sys_id'];}else{_0x391340[_0x8c29('0x1b')]=_0x391340[_0x8c29('0xe')];_0x391340[_0x8c29('0x16')]=_0x391340[_0x8c29('0x1c')];}logger['info']('['+[_0x26d3fc[_0x8c29('0x10')]()]+_0x8c29('0x1d'),_0x391340);_0x40509e(_0x391340);})['catch'](function(_0x50e668){logger[_0x8c29('0x12')]('['+[_0x26d3fc[_0x8c29('0x10')]()]+']',_0x50e668[_0x8c29('0x13')]);_0x5cfa21(_0x50e668[_0x8c29('0x13')]);});}else{logger[_0x8c29('0xf')]('['+[_0x26d3fc['toUpperCase']()]+_0x8c29('0x1e'));_0x391340[_0x8c29('0x1b')]=_0x391340[_0x8c29('0xe')];_0x391340[_0x8c29('0x16')]=_0x391340[_0x8c29('0x1c')];_0x40509e(_0x391340);}});};}function createEndUser(_0x4a71db,_0x153a65,_0x39e047,_0x11dc42,_0xfd90df){logger['info']('['+[_0x4a71db['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x39e047);return new Promise(function(_0x4332ee,_0x2f86e5){var _0x94954f={'method':'POST','uri':_0x11dc42+_0x8c29('0x1f')+_0xfd90df,'body':{'user_name':_0x39e047[_0x8c29('0x20')],'roles':_0x8c29('0x21'),'first_name':_0x39e047[_0x8c29('0x20')],'active':_0x8c29('0x1a'),'date_format':_0x8c29('0x22'),'phone':_0x39e047[_0x8c29('0x20')]},'auth':_0x153a65,'json':!![]};return rp(_0x94954f)[_0x8c29('0xb')](function(_0x226f9d){logger[_0x8c29('0xf')]('['+[_0x4a71db[_0x8c29('0x10')]()]+_0x8c29('0x23'),_0x226f9d['result']);_0x39e047[_0x8c29('0x24')]=_0x226f9d[_0x8c29('0xc')][_0x8c29('0x25')];_0x4332ee(_0x39e047);})['catch'](function(_0x24cc39){logger['error']('['+[_0x4a71db['toUpperCase']()]+']',_0x24cc39[_0x8c29('0x13')]);_0x2f86e5(_0x24cc39[_0x8c29('0x13')]);});});}function getEndUser(_0x546423,_0x396054,_0x263067,_0x561e56,_0x517d9c){return function(_0x2cc168){logger[_0x8c29('0xf')]('['+[_0x546423[_0x8c29('0x10')]()]+_0x8c29('0x26'),_0x2cc168);return new Promise(function(_0x3812f1,_0x13073b){var _0x50336a={'method':_0x8c29('0x9'),'uri':_0x263067+_0x8c29('0x27')+_0x2cc168[_0x8c29('0x20')]+'&'+_0x561e56+'&'+_0x517d9c,'auth':_0x396054,'json':!![]};return rp(_0x50336a)[_0x8c29('0xb')](function(_0x4c557f){if(_0x4c557f[_0x8c29('0xc')]['length']>0x0){_0x2cc168[_0x8c29('0x24')]=_0x4c557f[_0x8c29('0xc')][0x0][_0x8c29('0x25')];logger['info']('['+[_0x546423[_0x8c29('0x10')]()]+_0x8c29('0x28'),_0x2cc168);_0x3812f1(_0x2cc168);}else{return createEndUser(_0x546423,_0x396054,_0x2cc168,_0x263067,_0x561e56)['then'](function(_0x1c5a26){logger[_0x8c29('0xf')]('['+[_0x546423[_0x8c29('0x10')]()]+_0x8c29('0x29'),_0x1c5a26);_0x3812f1(_0x1c5a26);});}})[_0x8c29('0x2a')](function(_0xfef6ac){logger[_0x8c29('0x12')]('['+[_0x546423[_0x8c29('0x10')]()]+']',_0xfef6ac[_0x8c29('0x13')]);_0x13073b(_0xfef6ac[_0x8c29('0x13')]);});});};}function getCustomFields(_0x4c6c90,_0x49f628){var _0x49f328={};if(_0x4c6c90[_0x8c29('0xd')]>0x0){_[_0x8c29('0x2b')](_0x4c6c90,function(_0x2ae332){if(_[_0x8c29('0x2c')]([_0x8c29('0x2d'),'picklist'],_0x2ae332['type'])&&_0x2ae332[_0x8c29('0x2e')]&&!_0x2ae332[_0x8c29('0x2f')]){_0x49f328[_0x2ae332[_0x8c29('0x2e')][_0x8c29('0x30')]()]=_0x2ae332['content'][_0x8c29('0x31')]();}else if(_[_0x8c29('0x2c')]([_0x8c29('0x2d'),_0x8c29('0x32')],_0x2ae332[_0x8c29('0x33')])&&_0x2ae332[_0x8c29('0x34')]&&_0x2ae332['customField']){_0x49f328[_0x2ae332[_0x8c29('0x34')][_0x8c29('0x30')]()]=_0x2ae332['content'][_0x8c29('0x31')]();}else if(_0x2ae332[_0x8c29('0x33')]===_0x8c29('0x35')&&_0x2ae332[_0x8c29('0x36')]&&_0x2ae332[_0x8c29('0x34')]&&_0x2ae332[_0x8c29('0x2f')]){_0x49f328[_0x2ae332[_0x8c29('0x34')][_0x8c29('0x30')]()]=_0x49f628[_0x2ae332[_0x8c29('0x36')]]['toString']();}else if(_0x2ae332[_0x8c29('0x33')]===_0x8c29('0x37')&&_0x2ae332['Variable']&&_0x2ae332[_0x8c29('0x38')][_0x8c29('0x39')]&&_0x2ae332['idField']&&_0x2ae332[_0x8c29('0x2f')]){_0x49f328[_0x2ae332['idField'][_0x8c29('0x30')]()]=_0x49f628[_0x2ae332['Variable'][_0x8c29('0x39')][_0x8c29('0x30')]()]['toString']();}});}return _0x49f328;}function getTicket(_0x754c0f,_0x53edfa,_0x3af3c7,_0x409337,_0x6e2ab7,_0x4ef738){return function(_0x511b80){logger['info']('['+[_0x754c0f[_0x8c29('0x10')]()]+_0x8c29('0x3a'),_0x511b80);return new Promise(function(_0xb4f731,_0x1dd28d){var _0x8e43d=_0x754c0f[_0x8c29('0x30')]()==='outbound'?_0x511b80[_0x8c29('0x1b')]:_0x511b80[_0x8c29('0x24')];var _0x21bddb={'method':_0x8c29('0x3b'),'uri':_0x3af3c7+_0x8c29('0x3c')+'?'+_0x4ef738,'body':Object[_0x8c29('0x3d')]({},{'active':'true','caller_id':_0x8e43d,'assigned_to':_0x511b80['userId'],'short_description':intUtil[_0x8c29('0x3e')](_0x409337[_0x8c29('0x3f')],_0x6e2ab7,'\x20'),'description':intUtil['getString'](_0x409337['Descriptions'],_0x6e2ab7,'\x0a')},getCustomFields(_0x409337[_0x8c29('0x40')],_0x6e2ab7)),'auth':_0x53edfa,'json':!![]};return rp(_0x21bddb)[_0x8c29('0xb')](function(_0x2c096a){logger[_0x8c29('0xf')]('['+[_0x754c0f[_0x8c29('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2c096a[_0x8c29('0xc')]);_0x511b80[_0x8c29('0x41')]=_0x2c096a[_0x8c29('0xc')][_0x8c29('0x25')];_0x511b80[_0x8c29('0x42')]=_0x2c096a[_0x8c29('0xc')][_0x8c29('0x43')];logger[_0x8c29('0xf')]('['+[_0x754c0f[_0x8c29('0x10')]()]+_0x8c29('0x44'),_0x511b80);_0xb4f731(_0x511b80);})[_0x8c29('0x2a')](function(_0x2cb289){logger[_0x8c29('0x12')]('['+[_0x754c0f[_0x8c29('0x10')]()]+']',_0x2cb289[_0x8c29('0x13')]);_0x1dd28d(_0x2cb289[_0x8c29('0x13')]);});});};}function createRemoteTag(_0x8f6fb9,_0x545476,_0x45cf66,_0x515c3c){return new Promise(function(_0x2052a5,_0x326a6f){var _0x375628={'method':_0x8c29('0x3b'),'uri':_0x45cf66+_0x8c29('0x45')+'?'+_0x515c3c,'body':{'short_description':_0x8f6fb9,'global':!![],'active':!![],'name':_0x8f6fb9},'auth':_0x545476,'json':!![]};return rp(_0x375628)[_0x8c29('0xb')](function(_0xd634da){var _0x168575=_0xd634da[_0x8c29('0xc')][_0x8c29('0x25')];_0x2052a5(_0x168575);});});}function getRemoteTag(_0x2c0830,_0x360b64,_0x52827e,_0x4d5103,_0x279512){return new Promise(function(_0x4c0188,_0x56064d){var _0x146f06={'method':_0x8c29('0x9'),'uri':_0x52827e+_0x8c29('0x45')+'?sysparm_query=name%3D'+_0x2c0830+'&'+_0x4d5103,'auth':_0x360b64,'json':!![]};return rp(_0x146f06)[_0x8c29('0xb')](function(_0x2dbeea){if(_0x2dbeea[_0x8c29('0xc')][_0x8c29('0xd')]>0x0){var _0x121f4a=_0x2dbeea[_0x8c29('0xc')][0x0][_0x8c29('0x25')];_0x4c0188(_0x121f4a);}else{return createRemoteTag(_0x2c0830,_0x360b64,_0x52827e,_0x4d5103)['then'](function(_0x2599ca){_0x4c0188(_0x2599ca);});}});});}function assignTagToIncident(_0x5b1dfb,_0x3cade1,_0x146222,_0x46bbfe,_0x49be17){return new Promise(function(_0x1eaf45,_0x89288e){var _0x2dbc64={'method':_0x8c29('0x3b'),'uri':_0x146222+'label_entry'+'?'+_0x49be17,'body':{'label':_0x5b1dfb,'table':_0x8c29('0x3c'),'id_type':'Incident','table_key':_0x46bbfe['ticketId'],'title':'Incident\x20-\x20'+_0x46bbfe[_0x8c29('0x42')],'id_display':_0x46bbfe[_0x8c29('0x42')]},'auth':_0x3cade1,'json':!![]};return rp(_0x2dbc64)['then'](function(_0x13c467){_0x1eaf45();})[_0x8c29('0x2a')](function(){_0x1eaf45();});});}function manageTags(_0x4a3713,_0x19df6c,_0x3caf75,_0x465845,_0x17405e,_0x8ed403,_0x4608e4){return new Promise(function(_0xcdab8a,_0x3ab305){var _0x47f45d=[];_0x19df6c[_0x8c29('0x2b')](function(_0x40e36d){_0x47f45d[_0x8c29('0x46')](getRemoteTag(_0x40e36d,_0x3caf75,_0x465845,_0x8ed403,_0x4608e4));});return Promise[_0x8c29('0x47')](_0x47f45d)['then'](function(_0x10a7fd){if(_0x10a7fd['length']){logger[_0x8c29('0xf')]('['+[_0x4a3713['toUpperCase']()]+_0x8c29('0x48'),_0x10a7fd);var _0x42228b=[];_0x10a7fd[_0x8c29('0x2b')](function(_0x12f6b1){_0x42228b['push'](assignTagToIncident(_0x12f6b1,_0x3caf75,_0x465845,_0x17405e,_0x8ed403));});return Promise[_0x8c29('0x47')](_0x42228b)['then'](function(){_0xcdab8a();})[_0x8c29('0x2a')](function(){_0xcdab8a();});}else{_0xcdab8a();}});});}function getTags(_0x27b731,_0x1a81be,_0x507701,_0x341db9,_0x549434,_0x231427){return function(_0x47815c){return new Promise(function(_0x352163,_0x5ca16a){var _0x4613ed=[];var _0x5b343c=_0x341db9[_0x8c29('0x49')];if(_0x5b343c&&_0x5b343c[_0x8c29('0xd')]>0x0){_0x4613ed=_[_0x8c29('0x4a')](_0x5b343c,'name');}if(_0x4613ed[_0x8c29('0xd')]>0x0){return manageTags(_0x27b731,_0x4613ed,_0x1a81be,_0x507701,_0x47815c,_0x549434,_0x231427)[_0x8c29('0xb')](function(){_0x352163(_0x47815c);});}else{_0x352163(_0x47815c);}});};}function emit(_0x459c77,_0x420b5b,_0x3f1172){var _0x2d23b6=_0x8c29('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x8c29('0x4c')+_0x8c29('0x4d');var _0x41e688={'uri':_0x459c77+_0x8c29('0x4e')+_0x3f1172+_0x2d23b6};io['to'](util[_0x8c29('0x4f')](_0x8c29('0x50'),_0x420b5b))[_0x8c29('0x51')]('trigger:browser:url',_0x41e688);}exports['cs']=function(_0x15cbfa,_0x352422,_0x25b591,_0x1bb159,_0x44cd47,_0x4eeac0,_0x460294,_0x16faab){var _0x1c2394={};var _0x1b8847={'user':_0x4eeac0[_0x8c29('0x52')],'pass':_0x4eeac0[_0x8c29('0x53')]};var _0x47c72d=_0x8c29('0x54');var _0x35e975=_0x8c29('0x55');_0x4eeac0[_0x8c29('0x56')]=intUtil[_0x8c29('0x57')](_0x4eeac0[_0x8c29('0x56')]);_0x4eeac0['serverUrl']=intUtil[_0x8c29('0x57')](_0x4eeac0[_0x8c29('0x58')]);var _0x40e1c2=util[_0x8c29('0x4f')](_0x8c29('0x59'),_0x4eeac0[_0x8c29('0x56')]);_0x1c2394[_0x8c29('0x16')]=!_['isNil'](_0x1bb159)?_0x1bb159[_0x8c29('0x5a')]:null;_0x1c2394[_0x8c29('0x1c')]=_0x4eeac0[_0x8c29('0x5a')];_0x1c2394[_0x8c29('0x20')]=_0x16faab[_0x8c29('0x30')]()==='outbound'?_0x352422[_0x8c29('0x5b')]:_0x352422[_0x8c29('0x5c')];_0x1c2394[_0x8c29('0x5d')]=_0x16faab===_0x8c29('0x5e')||_0x16faab===_0x8c29('0x5f')?_0x8c29('0x5e'):_0x8c29('0x60');var _0x1962e4=util[_0x8c29('0x4f')](_0x8c29('0x61'),_0x4eeac0['serverUrl'],_0x352422[_0x8c29('0x62')],md5(_0x352422[_0x8c29('0x62')]));if(_0x44cd47&&_0x44cd47['monitor_format']){logger[_0x8c29('0xf')](_0x8c29('0x63'),'Recording\x20is\x20enabled!');_0x352422[_0x8c29('0x64')]=_0x1962e4;}else if(_0x460294&&_0x460294[_0x8c29('0x65')]&&_0x460294['recordingFormat']!=='none'){logger[_0x8c29('0xf')](_0x8c29('0x66'),_0x8c29('0x67'));_0x352422[_0x8c29('0x64')]=_0x1962e4;}else{_0x352422[_0x8c29('0x64')]='';}return getAdminUser(_0x16faab,_0x1b8847,_0x1c2394,_0x40e1c2,_0x35e975,_0x47c72d)[_0x8c29('0xb')](getUser(_0x16faab,_0x1b8847,_0x40e1c2,_0x35e975,_0x47c72d))['then'](getEndUser(_0x16faab,_0x1b8847,_0x40e1c2,_0x35e975,_0x47c72d))['then'](getTicket(_0x16faab,_0x1b8847,_0x40e1c2,_0x25b591,_0x352422,_0x35e975))[_0x8c29('0xb')](function(_0x388698){logger[_0x8c29('0xf')](util[_0x8c29('0x4f')](_0x8c29('0x68'),_0x388698['ticketId']));logger[_0x8c29('0xf')](util[_0x8c29('0x4f')]('call\x20direction:\x20%s',_0x16faab));if(_0x16faab!=='unmanaged'){logger[_0x8c29('0xf')]('['+[_0x16faab[_0x8c29('0x10')]()]+']',_0x8c29('0x69'));emit(_0x4eeac0[_0x8c29('0x56')],_0x1bb159[_0x8c29('0x39')],_0x388698['ticketId']);}})[_0x8c29('0x2a')](function(_0x26ab8f){logger[_0x8c29('0x12')]('['+[_0x16faab['toUpperCase']()]+_0x8c29('0x6a'),util[_0x8c29('0x6b')](_0x26ab8f,{'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 4d45f5e..2788c30 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 _0x6a1d=['first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','nameField','toLowerCase','content','string','customField','custom_fields','Variable','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','unmanaged','toUpperCase','Recording\x20is\x20enabled!','Inbound','Ticket\x20created!','lastevent','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Subjects','assigned_user_id','description','getString','Descriptions','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x45b5db,_0x4cc3){var _0x32fa2f=function(_0x534e48){while(--_0x534e48){_0x45b5db['push'](_0x45b5db['shift']());}};_0x32fa2f(++_0x4cc3);}(_0x6a1d,0x124));var _0xd6a1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x6a1d[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var rp=require(_0xd6a1('0x0'));var BPromise=require(_0xd6a1('0x1'));var md5=require(_0xd6a1('0x2'));var util=require(_0xd6a1('0x3'));var Redis=require('ioredis');var intUtil=require(_0xd6a1('0x4'));var config=require(_0xd6a1('0x5'));var logger=require(_0xd6a1('0x6'))('sugarcrm');config[_0xd6a1('0x7')]=_['defaults'](config['redis'],{'host':_0xd6a1('0x8'),'port':0x18eb});var io=require(_0xd6a1('0x9'))(new Redis(config[_0xd6a1('0x7')]));var def={'method':_0xd6a1('0xa'),'json':!![]};function emit(_0x1715a4,_0x39c441,_0x2b5bfc){io['to'](_0x1715a4)['emit'](_0x39c441,_0x2b5bfc);}function getTicket(_0x3dc519,_0x35c2bc,_0x5e54e2,_0x5c7efe,_0x42a67d,_0x28a284,_0x539b3c,_0x575846){logger[_0xd6a1('0xb')]('Creating\x20new\x20ticket...');var _0x3c2d58=new Date();var _0x3cf24f=[{'name':'name','value':intUtil['getString'](_0x5c7efe[_0xd6a1('0xc')],_0x42a67d,'\x20')},{'name':_0xd6a1('0xd'),'value':_0x35c2bc['id']},{'name':'created_by','value':_0x35c2bc['id']},{'name':_0xd6a1('0xe'),'value':intUtil[_0xd6a1('0xf')](_0x5c7efe[_0xd6a1('0x10')],_0x42a67d,'\x0a')},{'name':_0xd6a1('0x11'),'value':_0x3c2d58[_0xd6a1('0x12')]()['slice'](0x0,0x13)[_0xd6a1('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd6a1('0x14'),'value':'15'},{'name':_0xd6a1('0x15'),'value':_0x5e54e2['id']},{'name':_0xd6a1('0x16'),'value':'Contacts'},{'name':_0xd6a1('0x17'),'value':_0x5e54e2[_0xd6a1('0x18')]},{'name':_0xd6a1('0x19'),'value':_0x575846}];if(_0x28a284[_0xd6a1('0x1a')]){_[_0xd6a1('0x1b')](_0x28a284,function(_0x322837){if(_0x42a67d[_0x322837[_0xd6a1('0x1c')]]){_0x3cf24f[_0xd6a1('0x1d')]({'name':_0x322837[_0xd6a1('0x1e')],'value':_0x42a67d[_0x322837[_0xd6a1('0x1c')]]});}});}return request({'form':{'method':_0xd6a1('0x1f'),'input_type':_0xd6a1('0x20'),'response_type':'JSON','rest_data':JSON[_0xd6a1('0x21')]({'session':_0x539b3c['id'],'module_name':_0xd6a1('0x22'),'name_value_list':_0x3cf24f})}});}function getAuth(_0xd42f3d){return util[_0xd6a1('0x23')](_0xd6a1('0x24'),new Buffer(_0xd42f3d[_0xd6a1('0x25')]+':X')[_0xd6a1('0x26')]('base64'));}function getServerInfo(_0x70845b){return request({'form':{'method':_0xd6a1('0x27'),'input_type':_0xd6a1('0x20'),'response_type':'JSON','rest_data':JSON[_0xd6a1('0x21')]({'session':_0x70845b['id']})}});}function getUser(_0x74e101,_0x20f113,_0x41d638){if(!_[_0xd6a1('0x28')](_0x20f113)){logger['info'](_0xd6a1('0x29'),_0x20f113);return request({'form':{'method':_0xd6a1('0x2a'),'input_type':'JSON','response_type':_0xd6a1('0x20'),'rest_data':JSON['stringify']({'session':_0x41d638['id'],'module_name':_0xd6a1('0x2b'),'query':util[_0xd6a1('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x20f113),'order_by':'','offset':'0','select_fields':['id',_0xd6a1('0x18'),_0xd6a1('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd6a1('0x2d')](function(_0x45ec5d){if(_0x45ec5d[_0xd6a1('0x2e')][_0xd6a1('0x1a')]){var _0x35d140=_[_0xd6a1('0x2f')](_0x45ec5d[_0xd6a1('0x2e')],function(_0x373374){return _0x373374[_0xd6a1('0x30')][_0xd6a1('0x2c')][_0xd6a1('0x31')]===_0x20f113;});if(_0x35d140){logger['info'](_0xd6a1('0x32'));return BPromise['resolve']({'id':_0x35d140[_0xd6a1('0x30')]['id'][_0xd6a1('0x31')],'name':_0x35d140[_0xd6a1('0x30')]['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd6a1('0x33')]({'id':_0x41d638[_0xd6a1('0x30')][_0xd6a1('0x34')][_0xd6a1('0x31')],'name':_0x41d638[_0xd6a1('0x30')][_0xd6a1('0x2c')][_0xd6a1('0x31')]});});}else{logger[_0xd6a1('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd6a1('0x33')]({'id':_0x41d638[_0xd6a1('0x30')][_0xd6a1('0x34')][_0xd6a1('0x31')],'name':_0x41d638[_0xd6a1('0x30')][_0xd6a1('0x2c')][_0xd6a1('0x31')]});}}function getEndUser(_0x157dd0,_0x14c55a,_0x1123b0,_0x57a9f7){logger[_0xd6a1('0xb')](_0xd6a1('0x35'),_0x1123b0);return request({'form':{'method':_0xd6a1('0x2a'),'input_type':_0xd6a1('0x20'),'response_type':_0xd6a1('0x20'),'rest_data':JSON[_0xd6a1('0x21')]({'session':_0x57a9f7['id'],'module_name':_0xd6a1('0x36'),'query':util['format'](_0xd6a1('0x37'),_0x1123b0),'order_by':'','offset':'0','select_fields':['id',_0xd6a1('0x18'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd6a1('0x2d')](function(_0x103913){if(_0x103913[_0xd6a1('0x2e')]['length']){var _0x1743bb=_[_0xd6a1('0x2f')](_0x103913[_0xd6a1('0x2e')],function(_0x49556b){return _0x49556b['name_value_list'][_0xd6a1('0x38')]['value']===_0x1123b0;});if(_0x1743bb){logger[_0xd6a1('0xb')](_0xd6a1('0x39'));return BPromise['resolve']({'id':_0x1743bb[_0xd6a1('0x30')]['id'][_0xd6a1('0x31')],'name':_0x1743bb['name_value_list'][_0xd6a1('0x18')][_0xd6a1('0x31')],'phone':_0x1743bb[_0xd6a1('0x30')][_0xd6a1('0x38')][_0xd6a1('0x31')]});}}else{logger[_0xd6a1('0xb')](_0xd6a1('0x3a'));return request({'form':{'method':_0xd6a1('0x1f'),'input_type':'JSON','response_type':_0xd6a1('0x20'),'rest_data':JSON[_0xd6a1('0x21')]({'session':_0x57a9f7['id'],'module_name':_0xd6a1('0x36'),'name_value_list':[{'name':_0xd6a1('0x3b'),'value':_0x14c55a!==_0xd6a1('0x3c')?_0x14c55a:util[_0xd6a1('0x23')](_0xd6a1('0x3d'),_0x1123b0)},{'name':_0xd6a1('0x38'),'value':_0x1123b0}]})}})[_0xd6a1('0x2d')](function(_0x3c4d45){logger['info'](_0xd6a1('0x3e'));return BPromise['resolve']({'id':_0x3c4d45['id'],'name':_0x3c4d45[_0xd6a1('0x2e')][_0xd6a1('0x3b')][_0xd6a1('0x31')],'phone':_0x3c4d45[_0xd6a1('0x2e')]['phone_home']['value']});});}});}function request(_0x42417f){logger[_0xd6a1('0x3f')](_0xd6a1('0x40'),JSON[_0xd6a1('0x21')](_0x42417f));return rp(_['merge'](def,_0x42417f));}function getTags(_0x552c28,_0x454e02){var _0x5d463f=[];if(_0x552c28&&_0x552c28[_0xd6a1('0x1a')]>0x0){_0x5d463f=_[_0xd6a1('0x41')](_0x552c28,_0x454e02);}return _0x5d463f;}function getCustomFields(_0x4f30ec,_0x59e801){var _0x403177=[];var _0x293de4={'custom_fields':[]};if(_0x4f30ec[_0xd6a1('0x1a')]>0x0){_[_0xd6a1('0x1b')](_0x4f30ec,function(_0x173b7b){if(_0x173b7b[_0xd6a1('0x42')]==='string'&&_0x173b7b[_0xd6a1('0x43')]&&!_0x173b7b['customField']){_0x293de4[_0x173b7b[_0xd6a1('0x43')][_0xd6a1('0x44')]()]=_0x173b7b[_0xd6a1('0x45')][_0xd6a1('0x26')]();}else if(_0x173b7b['type']===_0xd6a1('0x46')&&_0x173b7b[_0xd6a1('0x1e')]&&_0x173b7b[_0xd6a1('0x47')]){_0x293de4[_0xd6a1('0x48')][_0xd6a1('0x1d')]({'id':_0x173b7b['idField'],'value':_0x173b7b[_0xd6a1('0x45')][_0xd6a1('0x26')]()});}else if(_0x173b7b['type']==='variable'&&_0x173b7b[_0xd6a1('0x1c')]&&_0x173b7b[_0xd6a1('0x1e')]&&_0x173b7b[_0xd6a1('0x47')]){_0x59e801[_0x173b7b[_0xd6a1('0x1c')]]&&_0x293de4[_0xd6a1('0x48')]['push']({'id':_0x173b7b[_0xd6a1('0x1e')],'value':_0x59e801[_0x173b7b[_0xd6a1('0x1c')]][_0xd6a1('0x26')]()});}else if(_0x173b7b['type']==='customVariable'&&_0x173b7b[_0xd6a1('0x49')]&&_0x173b7b[_0xd6a1('0x49')][_0xd6a1('0x18')]&&_0x173b7b[_0xd6a1('0x1e')]&&_0x173b7b[_0xd6a1('0x47')]){_0x59e801[_0x173b7b[_0xd6a1('0x49')][_0xd6a1('0x18')][_0xd6a1('0x44')]()]&&_0x293de4[_0xd6a1('0x48')][_0xd6a1('0x1d')]({'id':_0x173b7b[_0xd6a1('0x1e')],'value':_0x59e801[_0x173b7b['Variable'][_0xd6a1('0x18')][_0xd6a1('0x44')]()][_0xd6a1('0x26')]()});}});}return _0x293de4;}function getConnection(_0x17b59b){return request({'method':_0xd6a1('0xa'),'form':{'method':_0xd6a1('0x4a'),'input_type':_0xd6a1('0x20'),'response_type':_0xd6a1('0x20'),'rest_data':JSON[_0xd6a1('0x21')]({'user_auth':{'user_name':_0x17b59b[_0xd6a1('0x4b')],'password':_0x17b59b[_0xd6a1('0x4c')],'encryption':'PLAIN'},'application':_0xd6a1('0x4d')})}})[_0xd6a1('0x2d')](function(_0x5a669f){var _0x59c559=_0x5a669f;if(_0x59c559['id']){def['sessionID']=_0x59c559['id'];return BPromise[_0xd6a1('0x33')](_0x59c559);}else{throw new Error(util[_0xd6a1('0x23')](_0xd6a1('0x4e'),_0x17b59b['id']));}});}function setRelationship(_0x4d154a,_0x5dd2ef,_0x58f627,_0x548cd){return request({'form':{'method':_0xd6a1('0x4f'),'input_type':_0xd6a1('0x20'),'response_type':_0xd6a1('0x20'),'rest_data':JSON['stringify']({'session':_0x4d154a['id'],'module_name':_0xd6a1('0x22'),'module_id':_0x58f627['id'],'link_field_name':_0x548cd,'related_ids':[_0x5dd2ef['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x318d9c,_0x131a55,_0x305b2f,_0x8be134,_0x31af67,_0x17ff11){var _0x3b2007,_0x4f2bb2,_0xcf2ad3,_0x2ee441;_0x17ff11[_0xd6a1('0x50')]=intUtil['stripTrailingSlash'](_0x17ff11[_0xd6a1('0x50')]);_0x17ff11['serverUrl']=intUtil[_0xd6a1('0x51')](_0x17ff11[_0xd6a1('0x52')]);def[_0xd6a1('0x53')]=util[_0xd6a1('0x23')]('%s/service/v4_1/rest.php',_0x17ff11[_0xd6a1('0x50')]);if(_0x31af67&&_0x31af67[_0xd6a1('0x54')]){logger[_0xd6a1('0xb')](_0xd6a1('0x55'),'Recording\x20is\x20enabled!');_0x131a55[_0xd6a1('0x56')]=util[_0xd6a1('0x23')](_0xd6a1('0x57'),_0x17ff11[_0xd6a1('0x52')],_0x131a55[_0xd6a1('0x58')],md5(_0x131a55[_0xd6a1('0x58')]));}else{_0x131a55[_0xd6a1('0x56')]='';}return getConnection(_0x17ff11)['then'](function(_0xf06eb2){_0x2ee441=_0xf06eb2;return getUser(_0x17ff11,_0x8be134['name'],_0x2ee441);})['then'](function(_0x46f141){_0x3b2007=_0x46f141;logger[_0xd6a1('0xb')]('The\x20User\x20ID\x20is:',_0x3b2007['id']);return getEndUser(_0x17ff11,_0x131a55[_0xd6a1('0x59')],_0x131a55['calleridnum'],_0x2ee441);})[_0xd6a1('0x2d')](function(_0x35e2f0){_0x4f2bb2=_0x35e2f0;logger['info'](_0xd6a1('0x5a'),_0x4f2bb2['id']);return getTicket(_0x17ff11,_0x3b2007,_0x4f2bb2,_0x305b2f,_0x131a55,_0x305b2f[_0xd6a1('0x5b')],_0x2ee441,'Inbound');})[_0xd6a1('0x2d')](function(_0x167626){_0xcf2ad3=_0x167626;logger[_0xd6a1('0xb')]('Ticket\x20created!');logger[_0xd6a1('0xb')]('The\x20Ticket\x20ID\x20is:',_0xcf2ad3['id']);return setRelationship(_0x2ee441,_0x3b2007,_0xcf2ad3,_0xd6a1('0x5c'));})['then'](function(){return setRelationship(_0x2ee441,_0x4f2bb2,_0xcf2ad3,'contacts');})['then'](function(){return getServerInfo(_0x2ee441);})[_0xd6a1('0x2d')](function(_0x243ae4){var _0x43300e=parseInt(_0x243ae4['version'][_0xd6a1('0x5d')](0x0));var _0x11232b=util[_0xd6a1('0x23')](_0xd6a1('0x5e'),_0x17ff11[_0xd6a1('0x50')],_0xcf2ad3['id']);if(_0x43300e>0x6){_0x11232b=util[_0xd6a1('0x23')](_0xd6a1('0x5f'),_0x17ff11[_0xd6a1('0x50')],_0xcf2ad3['id']);}logger[_0xd6a1('0xb')](_0xd6a1('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x8be134[_0xd6a1('0x18')]),'trigger:browser:url',{'uri':_0x11232b});})[_0xd6a1('0x60')](function(_0x58b3a7){logger[_0xd6a1('0x61')](_0xd6a1('0x55'),JSON['stringify'](_0x58b3a7));});};exports[_0xd6a1('0x62')]=function(_0x41dfe9,_0x2fec9a,_0x1aa9cb,_0x28ccba,_0x4e7f67,_0x234ecc,_0xe2a55e){var _0x522d3a,_0x2d4d98,_0x2672ba,_0x2dd8e8;_0x234ecc[_0xd6a1('0x50')]=intUtil[_0xd6a1('0x51')](_0x234ecc[_0xd6a1('0x50')]);_0x234ecc[_0xd6a1('0x52')]=intUtil['stripTrailingSlash'](_0x234ecc['serverUrl']);def[_0xd6a1('0x53')]=util[_0xd6a1('0x23')](_0xd6a1('0x63'),_0x234ecc[_0xd6a1('0x50')]);if(_0xe2a55e&&_0xe2a55e[_0xd6a1('0x64')]&&_0xe2a55e[_0xd6a1('0x64')]!==_0xd6a1('0x65')){logger['info'](_0xd6a1('0x66'),'Recording\x20is\x20enabled!');_0x2fec9a['recordingURL']=util[_0xd6a1('0x23')](_0xd6a1('0x57'),_0x234ecc['serverUrl'],_0x2fec9a[_0xd6a1('0x58')],md5(_0x2fec9a['uniqueid']));}return getConnection(_0x234ecc)[_0xd6a1('0x2d')](function(_0x2ac350){_0x2dd8e8=_0x2ac350;return getUser(_0x234ecc,_0x28ccba[_0xd6a1('0x18')],_0x2dd8e8);})['then'](function(_0x3ae55e){_0x522d3a=_0x3ae55e;logger[_0xd6a1('0xb')](_0xd6a1('0x67'),_0x522d3a['id']);return getEndUser(_0x234ecc,_0x2fec9a[_0xd6a1('0x68')],_0x2fec9a['destcalleridnum'],_0x2dd8e8);})[_0xd6a1('0x2d')](function(_0x23946e){_0x2d4d98=_0x23946e;logger['info'](_0xd6a1('0x5a'),_0x2d4d98['id']);return getTicket(_0x234ecc,_0x522d3a,_0x2d4d98,_0x1aa9cb,_0x2fec9a,_0x1aa9cb[_0xd6a1('0x5b')],_0x2dd8e8,_0xd6a1('0x69'));})[_0xd6a1('0x2d')](function(_0x15f3d3){_0x2672ba=_0x15f3d3;logger[_0xd6a1('0xb')]('Ticket\x20created!');logger[_0xd6a1('0xb')](_0xd6a1('0x6a'),_0x2672ba['id']);return setRelationship(_0x2dd8e8,_0x522d3a,_0x2672ba,_0xd6a1('0x5c'));})[_0xd6a1('0x2d')](function(){return setRelationship(_0x2dd8e8,_0x2d4d98,_0x2672ba,_0xd6a1('0x6b'));})[_0xd6a1('0x2d')](function(){return getServerInfo(_0x2dd8e8);})[_0xd6a1('0x2d')](function(_0x238f8b){var _0x2930ee=parseInt(_0x238f8b['version'][_0xd6a1('0x5d')](0x0));var _0x5c9f28=util[_0xd6a1('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x234ecc[_0xd6a1('0x50')],_0x2672ba['id']);if(_0x2930ee>0x6){_0x5c9f28=util[_0xd6a1('0x23')](_0xd6a1('0x5f'),_0x234ecc['remoteUri'],_0x2672ba['id']);}logger[_0xd6a1('0xb')](_0xd6a1('0x66'),_0xd6a1('0x6c'));emit(util[_0xd6a1('0x23')](_0xd6a1('0x6d'),_0x28ccba[_0xd6a1('0x18')]),_0xd6a1('0x6e'),{'uri':_0x5c9f28});})[_0xd6a1('0x60')](function(_0x17225e){logger['error'](_0xd6a1('0x66'),JSON[_0xd6a1('0x21')](_0x17225e));});};exports[_0xd6a1('0x6f')]=function(_0x3206ff,_0x51bd22,_0x47b7d5,_0x37088a,_0x1ee4e4,_0xf7f680){var _0x57fb7e,_0x285a9e,_0x54efa5,_0x45147c;_0xf7f680[_0xd6a1('0x50')]=intUtil[_0xd6a1('0x51')](_0xf7f680['remoteUri']);_0xf7f680['serverUrl']=intUtil[_0xd6a1('0x51')](_0xf7f680[_0xd6a1('0x52')]);def[_0xd6a1('0x53')]=util[_0xd6a1('0x23')](_0xd6a1('0x63'),_0xf7f680[_0xd6a1('0x50')]);if(_0x1ee4e4&&_0x1ee4e4[_0xd6a1('0x54')]){logger[_0xd6a1('0xb')]('['+_0x51bd22['lastevent'][_0xd6a1('0x70')]()+']',_0xd6a1('0x71'));_0x51bd22[_0xd6a1('0x56')]=util[_0xd6a1('0x23')](_0xd6a1('0x57'),_0xf7f680[_0xd6a1('0x52')],_0x51bd22[_0xd6a1('0x58')],md5(_0x51bd22['uniqueid']));}else{_0x51bd22[_0xd6a1('0x56')]='';}return getConnection(_0xf7f680)[_0xd6a1('0x2d')](function(_0x591a19){_0x45147c=_0x591a19;if(!_[_0xd6a1('0x28')](_0x37088a)){return getUser(_0xf7f680,_0x37088a[_0xd6a1('0x18')],_0x45147c);}else{return getUser(_0xf7f680,null,_0x45147c);}})['then'](function(_0x5f2e16){_0x57fb7e=_0x5f2e16;logger[_0xd6a1('0xb')](_0xd6a1('0x67'),_0x57fb7e['id']);return getEndUser(_0xf7f680,_0x51bd22[_0xd6a1('0x59')],_0x51bd22['calleridnum'],_0x45147c);})['then'](function(_0x5b13be){_0x285a9e=_0x5b13be;logger['info'](_0xd6a1('0x5a'),_0x285a9e['id']);return getTicket(_0xf7f680,_0x57fb7e,_0x285a9e,_0x47b7d5,_0x51bd22,_0x47b7d5[_0xd6a1('0x5b')],_0x45147c,_0xd6a1('0x72'));})[_0xd6a1('0x2d')](function(_0xf710a5){_0x54efa5=_0xf710a5;logger[_0xd6a1('0xb')](_0xd6a1('0x73'));logger[_0xd6a1('0xb')](_0xd6a1('0x6a'),_0x54efa5['id']);return setRelationship(_0x45147c,_0x57fb7e,_0x54efa5,_0xd6a1('0x5c'));})[_0xd6a1('0x2d')](function(){return setRelationship(_0x45147c,_0x285a9e,_0x54efa5,_0xd6a1('0x6b'));})[_0xd6a1('0x2d')](function(){return getServerInfo(_0x45147c);})[_0xd6a1('0x60')](function(_0x425db7){logger[_0xd6a1('0x61')]('['+_0x51bd22[_0xd6a1('0x74')]['toUpperCase']()+']',JSON[_0xd6a1('0x21')](_0x425db7));});}; \ No newline at end of file +var _0x7a7c=['../../../../config/logger','sugarcrm','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','push','idField','variableName','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','toString','string','custom_fields','variable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','error','unmanaged','uri','toUpperCase','users','catch','lodash','request-promise','bluebird','./util','../../../../config/environment'];(function(_0x2ac382,_0x3c81bb){var _0x3af03c=function(_0x129cd4){while(--_0x129cd4){_0x2ac382['push'](_0x2ac382['shift']());}};_0x3af03c(++_0x3c81bb);}(_0x7a7c,0x1df));var _0xc7a7=function(_0x3d60ea,_0xdb58f2){_0x3d60ea=_0x3d60ea-0x0;var _0x17fc44=_0x7a7c[_0x3d60ea];return _0x17fc44;};'use strict';var _=require(_0xc7a7('0x0'));var rp=require(_0xc7a7('0x1'));var BPromise=require(_0xc7a7('0x2'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xc7a7('0x3'));var config=require(_0xc7a7('0x4'));var logger=require(_0xc7a7('0x5'))(_0xc7a7('0x6'));config['redis']=_[_0xc7a7('0x7')](config[_0xc7a7('0x8')],{'host':_0xc7a7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xc7a7('0xa'),'json':!![]};function emit(_0x4e82ab,_0x31c4d9,_0x12891a){io['to'](_0x4e82ab)[_0xc7a7('0xb')](_0x31c4d9,_0x12891a);}function getTicket(_0x2a5e12,_0x54307b,_0x38779a,_0x16bf43,_0x38418a,_0x293c7a,_0x22fe81,_0x253531){logger[_0xc7a7('0xc')](_0xc7a7('0xd'));var _0x37def3=new Date();var _0xac3c1d=[{'name':_0xc7a7('0xe'),'value':intUtil[_0xc7a7('0xf')](_0x16bf43[_0xc7a7('0x10')],_0x38418a,'\x20')},{'name':'assigned_user_id','value':_0x54307b['id']},{'name':'created_by','value':_0x54307b['id']},{'name':_0xc7a7('0x11'),'value':intUtil[_0xc7a7('0xf')](_0x16bf43[_0xc7a7('0x12')],_0x38418a,'\x0a')},{'name':_0xc7a7('0x13'),'value':_0x37def3['toISOString']()[_0xc7a7('0x14')](0x0,0x13)[_0xc7a7('0x15')]('T','\x20')},{'name':_0xc7a7('0x16'),'value':'0'},{'name':_0xc7a7('0x17'),'value':'15'},{'name':_0xc7a7('0x18'),'value':_0x38779a['id']},{'name':_0xc7a7('0x19'),'value':_0xc7a7('0x1a')},{'name':_0xc7a7('0x1b'),'value':_0x38779a[_0xc7a7('0xe')]},{'name':_0xc7a7('0x1c'),'value':_0x253531}];if(_0x293c7a['length']){_[_0xc7a7('0x1d')](_0x293c7a,function(_0x3ed338){if(_0x38418a[_0x3ed338['variableName']]){_0xac3c1d[_0xc7a7('0x1e')]({'name':_0x3ed338[_0xc7a7('0x1f')],'value':_0x38418a[_0x3ed338[_0xc7a7('0x20')]]});}});}return request({'form':{'method':_0xc7a7('0x21'),'input_type':_0xc7a7('0x22'),'response_type':'JSON','rest_data':JSON[_0xc7a7('0x23')]({'session':_0x22fe81['id'],'module_name':'Calls','name_value_list':_0xac3c1d})}});}function getAuth(_0x3f5c64){return util[_0xc7a7('0x24')](_0xc7a7('0x25'),new Buffer(_0x3f5c64[_0xc7a7('0x26')]+':X')['toString'](_0xc7a7('0x27')));}function getServerInfo(_0x51db39){return request({'form':{'method':_0xc7a7('0x28'),'input_type':'JSON','response_type':_0xc7a7('0x22'),'rest_data':JSON[_0xc7a7('0x23')]({'session':_0x51db39['id']})}});}function getUser(_0x1c9c45,_0x3929f6,_0x2d9311){if(!_[_0xc7a7('0x29')](_0x3929f6)){logger[_0xc7a7('0xc')]('Getting\x20agent\x20with\x20name',_0x3929f6);return request({'form':{'method':'get_entry_list','input_type':_0xc7a7('0x22'),'response_type':'JSON','rest_data':JSON[_0xc7a7('0x23')]({'session':_0x2d9311['id'],'module_name':_0xc7a7('0x2a'),'query':util['format'](_0xc7a7('0x2b'),_0x3929f6),'order_by':'','offset':'0','select_fields':['id',_0xc7a7('0xe'),_0xc7a7('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc7a7('0x2d')](function(_0x40fc1c){if(_0x40fc1c[_0xc7a7('0x2e')][_0xc7a7('0x2f')]){var _0x3f8372=_[_0xc7a7('0x30')](_0x40fc1c['entry_list'],function(_0x2ec5d6){return _0x2ec5d6[_0xc7a7('0x31')][_0xc7a7('0x2c')]['value']===_0x3929f6;});if(_0x3f8372){logger['info']('Agent\x20found!');return BPromise[_0xc7a7('0x32')]({'id':_0x3f8372[_0xc7a7('0x31')]['id'][_0xc7a7('0x33')],'name':_0x3f8372[_0xc7a7('0x31')][_0xc7a7('0xe')][_0xc7a7('0x33')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc7a7('0x32')]({'id':_0x2d9311[_0xc7a7('0x31')][_0xc7a7('0x34')][_0xc7a7('0x33')],'name':_0x2d9311['name_value_list'][_0xc7a7('0x2c')][_0xc7a7('0x33')]});});}else{logger[_0xc7a7('0xc')](_0xc7a7('0x35'));return BPromise[_0xc7a7('0x32')]({'id':_0x2d9311[_0xc7a7('0x31')][_0xc7a7('0x34')][_0xc7a7('0x33')],'name':_0x2d9311['name_value_list'][_0xc7a7('0x2c')][_0xc7a7('0x33')]});}}function getEndUser(_0xb2a144,_0x2d69a4,_0x551229,_0x58ae46){logger[_0xc7a7('0xc')](_0xc7a7('0x36'),_0x551229);return request({'form':{'method':_0xc7a7('0x37'),'input_type':_0xc7a7('0x22'),'response_type':'JSON','rest_data':JSON[_0xc7a7('0x23')]({'session':_0x58ae46['id'],'module_name':'Contacts','query':util[_0xc7a7('0x24')](_0xc7a7('0x38'),_0x551229),'order_by':'','offset':'0','select_fields':['id',_0xc7a7('0xe'),_0xc7a7('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc7a7('0x2d')](function(_0x240526){if(_0x240526[_0xc7a7('0x2e')][_0xc7a7('0x2f')]){var _0xb6d833=_[_0xc7a7('0x30')](_0x240526[_0xc7a7('0x2e')],function(_0x2a88e0){return _0x2a88e0[_0xc7a7('0x31')][_0xc7a7('0x39')][_0xc7a7('0x33')]===_0x551229;});if(_0xb6d833){logger['info'](_0xc7a7('0x3a'));return BPromise[_0xc7a7('0x32')]({'id':_0xb6d833[_0xc7a7('0x31')]['id']['value'],'name':_0xb6d833[_0xc7a7('0x31')][_0xc7a7('0xe')][_0xc7a7('0x33')],'phone':_0xb6d833[_0xc7a7('0x31')]['phone_home'][_0xc7a7('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xc7a7('0x21'),'input_type':_0xc7a7('0x22'),'response_type':_0xc7a7('0x22'),'rest_data':JSON[_0xc7a7('0x23')]({'session':_0x58ae46['id'],'module_name':_0xc7a7('0x1a'),'name_value_list':[{'name':_0xc7a7('0x3b'),'value':_0x2d69a4!==''?_0x2d69a4:util['format'](_0xc7a7('0x3c'),_0x551229)},{'name':_0xc7a7('0x39'),'value':_0x551229}]})}})[_0xc7a7('0x2d')](function(_0x3b3b73){logger[_0xc7a7('0xc')](_0xc7a7('0x3d'));return BPromise['resolve']({'id':_0x3b3b73['id'],'name':_0x3b3b73[_0xc7a7('0x2e')][_0xc7a7('0x3b')][_0xc7a7('0x33')],'phone':_0x3b3b73[_0xc7a7('0x2e')][_0xc7a7('0x39')][_0xc7a7('0x33')]});});}});}function request(_0x518f07){logger['debug'](_0xc7a7('0x3e'),JSON[_0xc7a7('0x23')](_0x518f07));return rp(_[_0xc7a7('0x3f')](def,_0x518f07));}function getTags(_0x3baad4,_0x37b591){var _0x597901=[];if(_0x3baad4&&_0x3baad4[_0xc7a7('0x2f')]>0x0){_0x597901=_[_0xc7a7('0x40')](_0x3baad4,_0x37b591);}return _0x597901;}function getCustomFields(_0x495bab,_0x594637){var _0x157255=[];var _0x305a8d={'custom_fields':[]};if(_0x495bab[_0xc7a7('0x2f')]>0x0){_[_0xc7a7('0x1d')](_0x495bab,function(_0x435b75){if(_0x435b75[_0xc7a7('0x41')]==='string'&&_0x435b75[_0xc7a7('0x42')]&&!_0x435b75[_0xc7a7('0x43')]){_0x305a8d[_0x435b75[_0xc7a7('0x42')][_0xc7a7('0x44')]()]=_0x435b75[_0xc7a7('0x45')][_0xc7a7('0x46')]();}else if(_0x435b75[_0xc7a7('0x41')]===_0xc7a7('0x47')&&_0x435b75[_0xc7a7('0x1f')]&&_0x435b75['customField']){_0x305a8d[_0xc7a7('0x48')][_0xc7a7('0x1e')]({'id':_0x435b75['idField'],'value':_0x435b75['content'][_0xc7a7('0x46')]()});}else if(_0x435b75[_0xc7a7('0x41')]===_0xc7a7('0x49')&&_0x435b75['variableName']&&_0x435b75['idField']&&_0x435b75[_0xc7a7('0x43')]){_0x594637[_0x435b75[_0xc7a7('0x20')]]&&_0x305a8d['custom_fields']['push']({'id':_0x435b75[_0xc7a7('0x1f')],'value':_0x594637[_0x435b75[_0xc7a7('0x20')]][_0xc7a7('0x46')]()});}else if(_0x435b75[_0xc7a7('0x41')]==='customVariable'&&_0x435b75['Variable']&&_0x435b75[_0xc7a7('0x4a')][_0xc7a7('0xe')]&&_0x435b75[_0xc7a7('0x1f')]&&_0x435b75[_0xc7a7('0x43')]){_0x594637[_0x435b75[_0xc7a7('0x4a')][_0xc7a7('0xe')]['toLowerCase']()]&&_0x305a8d[_0xc7a7('0x48')][_0xc7a7('0x1e')]({'id':_0x435b75[_0xc7a7('0x1f')],'value':_0x594637[_0x435b75[_0xc7a7('0x4a')][_0xc7a7('0xe')][_0xc7a7('0x44')]()][_0xc7a7('0x46')]()});}});}return _0x305a8d;}function getConnection(_0x219dd6){return request({'method':'POST','form':{'method':_0xc7a7('0x4b'),'input_type':_0xc7a7('0x22'),'response_type':_0xc7a7('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x219dd6[_0xc7a7('0x4c')],'password':_0x219dd6[_0xc7a7('0x4d')],'encryption':_0xc7a7('0x4e')},'application':_0xc7a7('0x4f')})}})['then'](function(_0x581457){var _0x2c12e2=_0x581457;if(_0x2c12e2['id']){def[_0xc7a7('0x50')]=_0x2c12e2['id'];return BPromise[_0xc7a7('0x32')](_0x2c12e2);}else{throw new Error(util['format'](_0xc7a7('0x51'),_0x219dd6['id']));}});}function setRelationship(_0x56b6cd,_0x9e7c4c,_0x5e6095,_0x4aafc5){return request({'form':{'method':_0xc7a7('0x52'),'input_type':_0xc7a7('0x22'),'response_type':_0xc7a7('0x22'),'rest_data':JSON[_0xc7a7('0x23')]({'session':_0x56b6cd['id'],'module_name':_0xc7a7('0x53'),'module_id':_0x5e6095['id'],'link_field_name':_0x4aafc5,'related_ids':[_0x9e7c4c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc7a7('0x54')]=function(_0x1ca48c,_0x3759d0,_0x2d1552,_0x105b06,_0x1b4c8f,_0x6fa2a0){var _0x3320b7,_0x5ea808,_0x21676a,_0x452a5b;_0x6fa2a0[_0xc7a7('0x55')]=intUtil['stripTrailingSlash'](_0x6fa2a0['remoteUri']);_0x6fa2a0[_0xc7a7('0x56')]=intUtil[_0xc7a7('0x57')](_0x6fa2a0[_0xc7a7('0x56')]);def['uri']=util['format'](_0xc7a7('0x58'),_0x6fa2a0[_0xc7a7('0x55')]);if(_0x1b4c8f&&_0x1b4c8f[_0xc7a7('0x59')]){logger['info'](_0xc7a7('0x5a'),_0xc7a7('0x5b'));_0x3759d0[_0xc7a7('0x5c')]=util[_0xc7a7('0x24')](_0xc7a7('0x5d'),_0x6fa2a0[_0xc7a7('0x56')],_0x3759d0[_0xc7a7('0x5e')],md5(_0x3759d0['uniqueid']));}else{_0x3759d0[_0xc7a7('0x5c')]='';}return getConnection(_0x6fa2a0)['then'](function(_0x563602){_0x452a5b=_0x563602;return getUser(_0x6fa2a0,_0x105b06[_0xc7a7('0xe')],_0x452a5b);})[_0xc7a7('0x2d')](function(_0x103813){_0x3320b7=_0x103813;logger[_0xc7a7('0xc')]('The\x20User\x20ID\x20is:',_0x3320b7['id']);return getEndUser(_0x6fa2a0,_0x3759d0[_0xc7a7('0x5f')],_0x3759d0[_0xc7a7('0x60')],_0x452a5b);})[_0xc7a7('0x2d')](function(_0x1734ed){_0x5ea808=_0x1734ed;logger[_0xc7a7('0xc')](_0xc7a7('0x61'),_0x5ea808['id']);return getTicket(_0x6fa2a0,_0x3320b7,_0x5ea808,_0x2d1552,_0x3759d0,_0x2d1552[_0xc7a7('0x62')],_0x452a5b,_0xc7a7('0x63'));})[_0xc7a7('0x2d')](function(_0x3c3f37){_0x21676a=_0x3c3f37;logger[_0xc7a7('0xc')](_0xc7a7('0x64'));logger[_0xc7a7('0xc')](_0xc7a7('0x65'),_0x21676a['id']);return setRelationship(_0x452a5b,_0x3320b7,_0x21676a,'users');})['then'](function(){return setRelationship(_0x452a5b,_0x5ea808,_0x21676a,_0xc7a7('0x66'));})['then'](function(){return getServerInfo(_0x452a5b);})[_0xc7a7('0x2d')](function(_0x3298c9){var _0x599ab3=parseInt(_0x3298c9['version'][_0xc7a7('0x67')](0x0));var _0x462fd6=util[_0xc7a7('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6fa2a0[_0xc7a7('0x55')],_0x21676a['id']);if(_0x599ab3>0x6){_0x462fd6=util[_0xc7a7('0x24')](_0xc7a7('0x68'),_0x6fa2a0['remoteUri'],_0x21676a['id']);}logger['info'](_0xc7a7('0x5a'),_0xc7a7('0x69'));emit(util['format']('user:%s',_0x105b06[_0xc7a7('0xe')]),_0xc7a7('0x6a'),{'uri':_0x462fd6});})['catch'](function(_0xff377c){logger['error'](_0xc7a7('0x5a'),JSON[_0xc7a7('0x23')](_0xff377c));});};exports[_0xc7a7('0x6b')]=function(_0x49b75d,_0x5cc557,_0x1a2974,_0xc5ae54,_0x148c19,_0x29d034,_0x4ba9d0){var _0x5dd92d,_0x2f466d,_0x753d6e,_0x104ac0;_0x29d034[_0xc7a7('0x55')]=intUtil[_0xc7a7('0x57')](_0x29d034[_0xc7a7('0x55')]);_0x29d034[_0xc7a7('0x56')]=intUtil[_0xc7a7('0x57')](_0x29d034[_0xc7a7('0x56')]);def['uri']=util[_0xc7a7('0x24')](_0xc7a7('0x58'),_0x29d034[_0xc7a7('0x55')]);if(_0x4ba9d0&&_0x4ba9d0['recordingFormat']&&_0x4ba9d0['recordingFormat']!=='none'){logger[_0xc7a7('0xc')](_0xc7a7('0x6c'),_0xc7a7('0x5b'));_0x5cc557[_0xc7a7('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29d034[_0xc7a7('0x56')],_0x5cc557[_0xc7a7('0x5e')],md5(_0x5cc557[_0xc7a7('0x5e')]));}return getConnection(_0x29d034)['then'](function(_0x52b3f9){_0x104ac0=_0x52b3f9;return getUser(_0x29d034,_0xc5ae54[_0xc7a7('0xe')],_0x104ac0);})[_0xc7a7('0x2d')](function(_0x448699){_0x5dd92d=_0x448699;logger[_0xc7a7('0xc')](_0xc7a7('0x6d'),_0x5dd92d['id']);return getEndUser(_0x29d034,_0x5cc557[_0xc7a7('0x6e')],_0x5cc557['destcalleridnum'],_0x104ac0);})[_0xc7a7('0x2d')](function(_0x180707){_0x2f466d=_0x180707;logger[_0xc7a7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2f466d['id']);return getTicket(_0x29d034,_0x5dd92d,_0x2f466d,_0x1a2974,_0x5cc557,_0x1a2974[_0xc7a7('0x62')],_0x104ac0,_0xc7a7('0x6f'));})[_0xc7a7('0x2d')](function(_0x3c81f2){_0x753d6e=_0x3c81f2;logger[_0xc7a7('0xc')]('Ticket\x20created!');logger[_0xc7a7('0xc')](_0xc7a7('0x65'),_0x753d6e['id']);return setRelationship(_0x104ac0,_0x5dd92d,_0x753d6e,'users');})['then'](function(){return setRelationship(_0x104ac0,_0x2f466d,_0x753d6e,_0xc7a7('0x66'));})[_0xc7a7('0x2d')](function(){return getServerInfo(_0x104ac0);})[_0xc7a7('0x2d')](function(_0x1504a6){var _0x413617=parseInt(_0x1504a6[_0xc7a7('0x70')][_0xc7a7('0x67')](0x0));var _0x1a5aec=util['format'](_0xc7a7('0x71'),_0x29d034[_0xc7a7('0x55')],_0x753d6e['id']);if(_0x413617>0x6){_0x1a5aec=util[_0xc7a7('0x24')](_0xc7a7('0x68'),_0x29d034[_0xc7a7('0x55')],_0x753d6e['id']);}logger['info'](_0xc7a7('0x6c'),_0xc7a7('0x69'));emit(util[_0xc7a7('0x24')](_0xc7a7('0x72'),_0xc5ae54[_0xc7a7('0xe')]),_0xc7a7('0x6a'),{'uri':_0x1a5aec});})['catch'](function(_0x56b1){logger[_0xc7a7('0x73')](_0xc7a7('0x6c'),JSON[_0xc7a7('0x23')](_0x56b1));});};exports[_0xc7a7('0x74')]=function(_0x59d4b5,_0x51ff32,_0x565df9,_0xf5a502,_0x486d23,_0x11e2e7){var _0x43e55b,_0x27bc54,_0xf8f6e7,_0x574d47;_0x11e2e7['remoteUri']=intUtil[_0xc7a7('0x57')](_0x11e2e7[_0xc7a7('0x55')]);_0x11e2e7[_0xc7a7('0x56')]=intUtil[_0xc7a7('0x57')](_0x11e2e7[_0xc7a7('0x56')]);def[_0xc7a7('0x75')]=util['format'](_0xc7a7('0x58'),_0x11e2e7[_0xc7a7('0x55')]);if(_0x486d23&&_0x486d23['monitor_format']){logger['info']('['+_0x51ff32['lastevent'][_0xc7a7('0x76')]()+']',_0xc7a7('0x5b'));_0x51ff32[_0xc7a7('0x5c')]=util[_0xc7a7('0x24')](_0xc7a7('0x5d'),_0x11e2e7[_0xc7a7('0x56')],_0x51ff32[_0xc7a7('0x5e')],md5(_0x51ff32[_0xc7a7('0x5e')]));}else{_0x51ff32[_0xc7a7('0x5c')]='';}return getConnection(_0x11e2e7)[_0xc7a7('0x2d')](function(_0x19bc8a){_0x574d47=_0x19bc8a;if(!_[_0xc7a7('0x29')](_0xf5a502)){return getUser(_0x11e2e7,_0xf5a502['name'],_0x574d47);}else{return getUser(_0x11e2e7,null,_0x574d47);}})['then'](function(_0x22f641){_0x43e55b=_0x22f641;logger[_0xc7a7('0xc')](_0xc7a7('0x6d'),_0x43e55b['id']);return getEndUser(_0x11e2e7,_0x51ff32[_0xc7a7('0x5f')],_0x51ff32['calleridnum'],_0x574d47);})[_0xc7a7('0x2d')](function(_0x22a035){_0x27bc54=_0x22a035;logger[_0xc7a7('0xc')](_0xc7a7('0x61'),_0x27bc54['id']);return getTicket(_0x11e2e7,_0x43e55b,_0x27bc54,_0x565df9,_0x51ff32,_0x565df9['Fields'],_0x574d47,'Inbound');})[_0xc7a7('0x2d')](function(_0x39b123){_0xf8f6e7=_0x39b123;logger[_0xc7a7('0xc')](_0xc7a7('0x64'));logger['info'](_0xc7a7('0x65'),_0xf8f6e7['id']);return setRelationship(_0x574d47,_0x43e55b,_0xf8f6e7,_0xc7a7('0x77'));})[_0xc7a7('0x2d')](function(){return setRelationship(_0x574d47,_0x27bc54,_0xf8f6e7,_0xc7a7('0x66'));})[_0xc7a7('0x2d')](function(){return getServerInfo(_0x574d47);})[_0xc7a7('0x78')](function(_0x5865ae){logger[_0xc7a7('0x73')]('['+_0x51ff32['lastevent'][_0xc7a7('0x76')]()+']',JSON[_0xc7a7('0x23')](_0x5865ae));});}; \ 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 8399735..0e0b79e 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 _0xcddd=['lodash','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil'];(function(_0x1ca907,_0x318ca2){var _0x4eb2c1=function(_0x1c0de3){while(--_0x1c0de3){_0x1ca907['push'](_0x1ca907['shift']());}};_0x4eb2c1(++_0x318ca2);}(_0xcddd,0x1cb));var _0xdcdd=function(_0x50b65e,_0x482f28){_0x50b65e=_0x50b65e-0x0;var _0x5bb365=_0xcddd[_0x50b65e];return _0x5bb365;};'use strict';var _=require(_0xdcdd('0x0'));var util=require('util');exports[_0xdcdd('0x1')]=function(_0x301579,_0x44cfa7,_0x353faa){var _0x3723b7=[];if(_0x301579[_0xdcdd('0x2')]>0x0){var _0x23d9f6=_[_0xdcdd('0x3')](_0x301579,['id']);for(var _0x19c1ea=0x0;_0x19c1ea<_0x23d9f6[_0xdcdd('0x2')];_0x19c1ea++){var _0x549aa4=_0x23d9f6[_0x19c1ea];if(_0x549aa4[_0xdcdd('0x4')]===_0xdcdd('0x5')){_0x3723b7[_0xdcdd('0x6')](_0x549aa4[_0xdcdd('0x7')]);}else if(_0x549aa4[_0xdcdd('0x4')]===_0xdcdd('0x8')&&_0x549aa4[_0xdcdd('0x9')]){_0x44cfa7[_0x549aa4[_0xdcdd('0x9')]]&&_0x3723b7[_0xdcdd('0x6')](_0x44cfa7[_0x549aa4[_0xdcdd('0x9')]]['toString']());}else if(_0x549aa4['type']===_0xdcdd('0xa')&&_0x549aa4[_0xdcdd('0xb')]&&_0x549aa4['Variable']['name']){_0x44cfa7[_0x549aa4[_0xdcdd('0xb')][_0xdcdd('0xc')][_0xdcdd('0xd')]()]&&_0x3723b7[_0xdcdd('0x6')](_0x44cfa7[_0x549aa4[_0xdcdd('0xb')][_0xdcdd('0xc')][_0xdcdd('0xd')]()][_0xdcdd('0xe')]());}else if(_0x549aa4[_0xdcdd('0x4')]==='keyValue'){if(_0x549aa4['keyType']==='string'&&_0x549aa4[_0xdcdd('0xf')]){_0x3723b7[_0xdcdd('0x6')](util[_0xdcdd('0x10')](_0xdcdd('0x11'),_0x549aa4[_0xdcdd('0xf')],_0x549aa4[_0xdcdd('0x12')]));}else if(_0x549aa4[_0xdcdd('0x13')]===_0xdcdd('0x8')&&_0x549aa4[_0xdcdd('0x9')]&&_0x549aa4[_0xdcdd('0xf')]){_0x44cfa7[_0x549aa4['variableName']]&&_0x3723b7[_0xdcdd('0x6')](util['format']('%s:\x20%s',_0x549aa4[_0xdcdd('0xf')],_0x44cfa7[_0x549aa4[_0xdcdd('0x9')]]));}else if(_0x549aa4[_0xdcdd('0x13')]===_0xdcdd('0xa')&&_0x549aa4[_0xdcdd('0xb')]&&_0x549aa4[_0xdcdd('0xb')][_0xdcdd('0xc')]&&_0x549aa4['key']){_0x44cfa7[_0x549aa4[_0xdcdd('0xb')]['name'][_0xdcdd('0xd')]()]&&_0x3723b7['push'](util['format'](_0xdcdd('0x11'),_0x549aa4[_0xdcdd('0xf')],_0x44cfa7[_0x549aa4[_0xdcdd('0xb')][_0xdcdd('0xc')][_0xdcdd('0xd')]()]));}}}}return _0x3723b7[_0xdcdd('0x14')](_0x353faa);};exports[_0xdcdd('0x15')]=function(_0x15068d){var _0x381e16=_0x15068d[_0xdcdd('0x16')](-0x1);if(_0x381e16==='/'){_0x15068d=_0x15068d[_0xdcdd('0x17')](0x0,_0x15068d[_0xdcdd('0x18')](_0x381e16));}return _0x15068d;};exports[_0xdcdd('0x19')]=function(_0x22984f){if(!_[_0xdcdd('0x1a')](_0x22984f)&&_0x22984f!==''){var _0x3e3ae3=/^(([^<>()\[\]\\.,;:\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 _0x3e3ae3['test'](String(_0x22984f)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xc3a3=['toLowerCase','toString','keyValue','keyType','key','%s:\x20%s','keyContent','customVariable','join','substring','lastIndexOf','validateEmail','isNil','util','getString','length','sortBy','type','push','variable','variableName','Variable','name'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xc3a3,0x10a));var _0x3c3a=function(_0x23ed11,_0x48bd56){_0x23ed11=_0x23ed11-0x0;var _0x52dae3=_0xc3a3[_0x23ed11];return _0x52dae3;};'use strict';var _=require('lodash');var util=require(_0x3c3a('0x0'));exports[_0x3c3a('0x1')]=function(_0x4f0fb0,_0xa1a194,_0x320896){var _0x1410d9=[];if(_0x4f0fb0[_0x3c3a('0x2')]>0x0){var _0x341440=_[_0x3c3a('0x3')](_0x4f0fb0,['id']);for(var _0x477f75=0x0;_0x477f75<_0x341440[_0x3c3a('0x2')];_0x477f75++){var _0x43d07d=_0x341440[_0x477f75];if(_0x43d07d[_0x3c3a('0x4')]==='string'){_0x1410d9[_0x3c3a('0x5')](_0x43d07d['content']);}else if(_0x43d07d[_0x3c3a('0x4')]===_0x3c3a('0x6')&&_0x43d07d[_0x3c3a('0x7')]){_0xa1a194[_0x43d07d['variableName']]&&_0x1410d9['push'](_0xa1a194[_0x43d07d['variableName']]['toString']());}else if(_0x43d07d[_0x3c3a('0x4')]==='customVariable'&&_0x43d07d[_0x3c3a('0x8')]&&_0x43d07d[_0x3c3a('0x8')][_0x3c3a('0x9')]){_0xa1a194[_0x43d07d[_0x3c3a('0x8')]['name'][_0x3c3a('0xa')]()]&&_0x1410d9[_0x3c3a('0x5')](_0xa1a194[_0x43d07d[_0x3c3a('0x8')][_0x3c3a('0x9')][_0x3c3a('0xa')]()][_0x3c3a('0xb')]());}else if(_0x43d07d['type']===_0x3c3a('0xc')){if(_0x43d07d[_0x3c3a('0xd')]==='string'&&_0x43d07d[_0x3c3a('0xe')]){_0x1410d9[_0x3c3a('0x5')](util['format'](_0x3c3a('0xf'),_0x43d07d['key'],_0x43d07d[_0x3c3a('0x10')]));}else if(_0x43d07d['keyType']==='variable'&&_0x43d07d[_0x3c3a('0x7')]&&_0x43d07d[_0x3c3a('0xe')]){_0xa1a194[_0x43d07d[_0x3c3a('0x7')]]&&_0x1410d9[_0x3c3a('0x5')](util['format'](_0x3c3a('0xf'),_0x43d07d['key'],_0xa1a194[_0x43d07d[_0x3c3a('0x7')]]));}else if(_0x43d07d[_0x3c3a('0xd')]===_0x3c3a('0x11')&&_0x43d07d[_0x3c3a('0x8')]&&_0x43d07d['Variable'][_0x3c3a('0x9')]&&_0x43d07d['key']){_0xa1a194[_0x43d07d[_0x3c3a('0x8')][_0x3c3a('0x9')][_0x3c3a('0xa')]()]&&_0x1410d9[_0x3c3a('0x5')](util['format'](_0x3c3a('0xf'),_0x43d07d[_0x3c3a('0xe')],_0xa1a194[_0x43d07d[_0x3c3a('0x8')]['name']['toLowerCase']()]));}}}}return _0x1410d9[_0x3c3a('0x12')](_0x320896);};exports['stripTrailingSlash']=function(_0x517d38){var _0x33c344=_0x517d38['slice'](-0x1);if(_0x33c344==='/'){_0x517d38=_0x517d38[_0x3c3a('0x13')](0x0,_0x517d38[_0x3c3a('0x14')](_0x33c344));}return _0x517d38;};exports[_0x3c3a('0x15')]=function(_0x215168){if(!_[_0x3c3a('0x16')](_0x215168)&&_0x215168!==''){var _0x54df1c=/^(([^<>()\[\]\\.,;:\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 _0x54df1c['test'](String(_0x215168)[_0x3c3a('0xa')]());}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 1b1496a..ce93522 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x18882f,_0x5b8f0d){var _0x265994=function(_0x26ce4e){while(--_0x26ce4e){_0x18882f['push'](_0x18882f['shift']());}};_0x265994(++_0x5b8f0d);}(_0xe706,0xa3));var _0x6e70=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xe706[_0x3a60b8];return _0x4eb583;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x50e625,_0x477a79){var _0x2f7b5b=function(_0x215673){while(--_0x215673){_0x50e625['push'](_0x50e625['shift']());}};_0x2f7b5b(++_0x477a79);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 62a22d0..fdd7556 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 _0xc0f6=['push','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','serverUrl','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','content','toString','includes','custom_fields','variable','idField','variableName','customVariable','Variable','toLowerCase'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0xc0f6,0x1e7));var _0x6c0f=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0xc0f6[_0x452968];return _0xb6f9ae;};'use strict';var _=require(_0x6c0f('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x6c0f('0x1'));var Redis=require(_0x6c0f('0x2'));var intUtil=require(_0x6c0f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6c0f('0x4'))('zendesk');config[_0x6c0f('0x5')]=_[_0x6c0f('0x6')](config[_0x6c0f('0x5')],{'host':_0x6c0f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5b2bb7,_0xf6a526,_0x93121c){io['to'](_0x5b2bb7)[_0x6c0f('0x8')](_0xf6a526,_0x93121c);}var headers={'Content-Type':_0x6c0f('0x9'),'Accept':_0x6c0f('0x9')};function getTicket(_0x1c51f4,_0x314050,_0x122da7,_0x7ab6da,_0xff76b4){logger[_0x6c0f('0xa')](_0x6c0f('0xb'));return request({'uri':util[_0x6c0f('0xc')](_0x6c0f('0xd'),_0x1c51f4[_0x6c0f('0xe')]),'method':_0x6c0f('0xf'),'body':{'ticket':_[_0x6c0f('0x10')]({'requester_id':_0x122da7['id'],'submitter_id':_0x314050?_0x314050['id']:undefined,'assignee_id':_0x314050?_0x314050['id']:undefined,'tags':getTags(_0x7ab6da[_0x6c0f('0x11')],_0x6c0f('0x12')),'subject':intUtil[_0x6c0f('0x13')](_0x7ab6da[_0x6c0f('0x14')],_0xff76b4,'\x20'),'description':intUtil[_0x6c0f('0x13')](_0x7ab6da[_0x6c0f('0x15')],_0xff76b4,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6c0f('0x13')](_0x7ab6da['Descriptions'],_0xff76b4,'\x0a')}},getCustomFields(_0x7ab6da[_0x6c0f('0x16')],_0xff76b4))}})['then'](function(_0xc63676){logger['info'](_0x6c0f('0x17'));return _0xc63676[_0x6c0f('0x18')];});}function getUser(_0x117091,_0x4e6fde){if(intUtil['validateEmail'](_0x4e6fde)){logger[_0x6c0f('0xa')](_0x6c0f('0x19'),_0x4e6fde);return request({'uri':util[_0x6c0f('0xc')](_0x6c0f('0x1a'),_0x117091[_0x6c0f('0xe')]),'qs':{'query':util[_0x6c0f('0xc')](_0x6c0f('0x1b'),_0x4e6fde)}})['then'](function(_0x4de1aa){if(_0x4de1aa[_0x6c0f('0x1c')]){logger[_0x6c0f('0xa')](_0x6c0f('0x1d'));return _[_0x6c0f('0x1e')](_0x4de1aa[_0x6c0f('0x1f')],{'email':_0x4e6fde,'role':_0x6c0f('0x20')});}else{logger[_0x6c0f('0xa')](_0x6c0f('0x21'));return request({'uri':util['format'](_0x6c0f('0x22'),_0x117091['remoteUri'])})[_0x6c0f('0x23')](function(_0x23fb7e){logger[_0x6c0f('0xa')](_0x6c0f('0x24'));return _0x23fb7e[_0x6c0f('0x25')];});}});}else{logger[_0x6c0f('0xa')](_0x6c0f('0x21'));return request({'uri':util[_0x6c0f('0xc')](_0x6c0f('0x22'),_0x117091[_0x6c0f('0xe')])})[_0x6c0f('0x23')](function(_0x2c2332){logger[_0x6c0f('0xa')](_0x6c0f('0x24'));return _0x2c2332['user'];});}}function getEndUser(_0x174eac,_0x146fdb,_0x5856e8){logger[_0x6c0f('0xa')](_0x6c0f('0x26'),_0x5856e8);return request({'uri':util[_0x6c0f('0xc')]('%s/search.json',_0x174eac[_0x6c0f('0xe')]),'qs':{'query':util[_0x6c0f('0xc')](_0x6c0f('0x27'),_0x5856e8)}})[_0x6c0f('0x23')](function(_0x273568){var _0x388a45;if(_0x273568['results'][_0x6c0f('0x28')]){_0x273568[_0x6c0f('0x1f')]=_['filter'](_0x273568[_0x6c0f('0x1f')],{'suspended':![],'role':_0x6c0f('0x29')});if(_0x273568[_0x6c0f('0x1f')][_0x6c0f('0x28')]){_0x388a45=_[_0x6c0f('0x2a')](_0x273568['results']);}}if(_0x388a45){logger[_0x6c0f('0xa')]('Enduser\x20found!');return _0x388a45;}else{logger[_0x6c0f('0xa')](_0x6c0f('0x2b'));return request({'uri':util[_0x6c0f('0xc')](_0x6c0f('0x2c'),_0x174eac[_0x6c0f('0xe')]),'method':'POST','body':{'user':{'role':_0x6c0f('0x29'),'name':util[_0x6c0f('0xc')]('Caller\x20-\x20%s',_0x146fdb||_0x5856e8),'phone':_0x5856e8}}})[_0x6c0f('0x23')](function(_0x1d8c73){logger[_0x6c0f('0xa')]('Enduser\x20created.');return _0x1d8c73[_0x6c0f('0x25')];});}});}function getAuth(_0x5a31cd){var _0x171c28;if(_0x5a31cd[_0x6c0f('0x2d')]===_0x6c0f('0x2e')){_0x171c28=util[_0x6c0f('0xc')](_0x6c0f('0x2f'),_0x5a31cd[_0x6c0f('0x30')],_0x5a31cd['password']);}else if(_0x5a31cd['authType']==='token'){_0x171c28=util[_0x6c0f('0xc')]('%s/token:%s',_0x5a31cd[_0x6c0f('0x30')],_0x5a31cd[_0x6c0f('0x31')]);}return util['format'](_0x6c0f('0x32'),new Buffer(_0x171c28)['toString'](_0x6c0f('0x33')));}function request(_0x1e345e){logger[_0x6c0f('0x34')](_0x6c0f('0x35'),JSON[_0x6c0f('0x36')](_0x1e345e));return rp(_[_0x6c0f('0x6')](_0x1e345e,{'method':_0x6c0f('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1aa513,_0x3af8da){var _0xe32758=[];if(_0x1aa513&&_0x1aa513[_0x6c0f('0x28')]>0x0){_0xe32758=_[_0x6c0f('0x38')](_0x1aa513,_0x3af8da);}return _0xe32758;}function getCustomFields(_0x52bed7,_0x5d9975){var _0x5e75df=[];var _0x17d43d={'custom_fields':[]};if(_0x52bed7[_0x6c0f('0x28')]>0x0){_[_0x6c0f('0x39')](_0x52bed7,function(_0x57d6ff){if(_['includes']([_0x6c0f('0x3a'),_0x6c0f('0x3b')],_0x57d6ff[_0x6c0f('0x3c')])&&_0x57d6ff[_0x6c0f('0x3d')]&&!_0x57d6ff[_0x6c0f('0x3e')]){_0x17d43d[_0x57d6ff[_0x6c0f('0x3d')]['toLowerCase']()]=_0x57d6ff[_0x6c0f('0x3f')][_0x6c0f('0x40')]();}else if(_[_0x6c0f('0x41')](['string',_0x6c0f('0x3b')],_0x57d6ff[_0x6c0f('0x3c')])&&_0x57d6ff['idField']&&_0x57d6ff[_0x6c0f('0x3e')]){_0x17d43d[_0x6c0f('0x42')]['push']({'id':_0x57d6ff['idField'],'value':_0x57d6ff['content'][_0x6c0f('0x40')]()});}else if(_0x57d6ff['type']===_0x6c0f('0x43')&&_0x57d6ff['variableName']&&_0x57d6ff[_0x6c0f('0x44')]&&_0x57d6ff[_0x6c0f('0x3e')]){_0x5d9975[_0x57d6ff['variableName']]&&_0x17d43d[_0x6c0f('0x42')]['push']({'id':_0x57d6ff[_0x6c0f('0x44')],'value':_0x5d9975[_0x57d6ff[_0x6c0f('0x45')]][_0x6c0f('0x40')]()});}else if(_0x57d6ff['type']===_0x6c0f('0x46')&&_0x57d6ff['Variable']&&_0x57d6ff['Variable'][_0x6c0f('0x12')]&&_0x57d6ff[_0x6c0f('0x44')]&&_0x57d6ff[_0x6c0f('0x3e')]){_0x5d9975[_0x57d6ff[_0x6c0f('0x47')][_0x6c0f('0x12')][_0x6c0f('0x48')]()]&&_0x17d43d['custom_fields'][_0x6c0f('0x49')]({'id':_0x57d6ff[_0x6c0f('0x44')],'value':_0x5d9975[_0x57d6ff['Variable'][_0x6c0f('0x12')][_0x6c0f('0x48')]()][_0x6c0f('0x40')]()});}});}return _0x17d43d;}exports[_0x6c0f('0x4a')]=function(_0x24469e,_0x29f6bc,_0x4615c2,_0x44b9fa,_0x4e02f1,_0x128d32){var _0x5aa653,_0x50678e;_0x128d32[_0x6c0f('0xe')]=intUtil[_0x6c0f('0x4b')](_0x128d32[_0x6c0f('0xe')]);_0x128d32['serverUrl']=intUtil[_0x6c0f('0x4b')](_0x128d32['serverUrl']);if(_0x4e02f1&&_0x4e02f1[_0x6c0f('0x4c')]){logger['info'](_0x6c0f('0x4d'),'Recording\x20is\x20enabled!');_0x29f6bc[_0x6c0f('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x128d32['serverUrl'],_0x29f6bc[_0x6c0f('0x4f')],md5(_0x29f6bc[_0x6c0f('0x4f')]));}else{_0x29f6bc[_0x6c0f('0x4e')]='';}headers['Authorization']=getAuth(_0x128d32);return getUser(_0x128d32,_0x44b9fa[_0x6c0f('0x50')])[_0x6c0f('0x23')](function(_0x29a0c5){_0x5aa653=_0x29a0c5;logger[_0x6c0f('0xa')](_0x6c0f('0x51'),_0x5aa653['id']);return getEndUser(_0x128d32,_0x29f6bc[_0x6c0f('0x52')],_0x29f6bc[_0x6c0f('0x53')]);})[_0x6c0f('0x23')](function(_0x1f1509){_0x50678e=_0x1f1509;logger[_0x6c0f('0xa')](_0x6c0f('0x54'),_0x50678e['id']);return getTicket(_0x128d32,_0x5aa653,_0x50678e,_0x4615c2,_0x29f6bc);})[_0x6c0f('0x23')](function(_0x3d2d37){if(_0x3d2d37){logger[_0x6c0f('0xa')](_0x6c0f('0x55'),_0x3d2d37['id']);switch(_0x128d32[_0x6c0f('0x3c')]){case _0x6c0f('0x56'):logger[_0x6c0f('0xa')](_0x6c0f('0x4d'),_0x6c0f('0x57'));return request({'uri':util[_0x6c0f('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x128d32['remoteUri'],_0x5aa653['id'],_0x3d2d37['id']),'method':'POST'});case'newTab':logger[_0x6c0f('0xa')](_0x6c0f('0x4d'),_0x6c0f('0x58'));emit(util[_0x6c0f('0xc')](_0x6c0f('0x59'),_0x44b9fa['name']),_0x6c0f('0x5a'),{'uri':util[_0x6c0f('0xc')]('%s/agent/tickets/%s',_0x128d32[_0x6c0f('0xe')][_0x6c0f('0x5b')](_0x6c0f('0x5c'),''),_0x3d2d37['id'])});break;default:logger['error']('[QUEUE]',_0x6c0f('0x5d'));}}})[_0x6c0f('0x5e')](function(_0x1cfe52){logger['error'](_0x6c0f('0x5f'),util[_0x6c0f('0x60')](_0x1cfe52,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x23f30b,_0x2306ba,_0x47d32a,_0x3783d1,_0xcd9afc,_0x2aef17,_0x53276b){var _0x5a00f8,_0x4b196e;_0x2aef17[_0x6c0f('0xe')]=intUtil[_0x6c0f('0x4b')](_0x2aef17[_0x6c0f('0xe')]);_0x2aef17[_0x6c0f('0x61')]=intUtil[_0x6c0f('0x4b')](_0x2aef17[_0x6c0f('0x61')]);if(_0x53276b&&_0x53276b[_0x6c0f('0x62')]&&_0x53276b['recordingFormat']!=='none'){logger[_0x6c0f('0xa')](_0x6c0f('0x63'),_0x6c0f('0x64'));_0x2306ba[_0x6c0f('0x4e')]=util[_0x6c0f('0xc')](_0x6c0f('0x65'),_0x2aef17[_0x6c0f('0x61')],_0x2306ba[_0x6c0f('0x4f')],md5(_0x2306ba[_0x6c0f('0x4f')]));}headers[_0x6c0f('0x66')]=getAuth(_0x2aef17);return getUser(_0x2aef17,_0x3783d1[_0x6c0f('0x50')])[_0x6c0f('0x23')](function(_0x543e9b){_0x5a00f8=_0x543e9b;logger[_0x6c0f('0xa')](_0x6c0f('0x51'),_0x5a00f8['id']);return getEndUser(_0x2aef17,_0x2306ba[_0x6c0f('0x67')],_0x2306ba[_0x6c0f('0x68')]);})[_0x6c0f('0x23')](function(_0xd986c){_0x4b196e=_0xd986c;logger[_0x6c0f('0xa')]('The\x20Enduser\x20ID\x20is:',_0x4b196e['id']);return getTicket(_0x2aef17,_0x5a00f8,_0x4b196e,_0x47d32a,_0x2306ba);})[_0x6c0f('0x23')](function(_0x142fc5){if(_0x142fc5){logger['info'](_0x6c0f('0x55'),_0x142fc5['id']);switch(_0x2aef17['type']){case _0x6c0f('0x56'):logger[_0x6c0f('0xa')](_0x6c0f('0x63'),_0x6c0f('0x57'));return request({'uri':util[_0x6c0f('0xc')](_0x6c0f('0x69'),_0x2aef17[_0x6c0f('0xe')],_0x5a00f8['id'],_0x142fc5['id']),'method':_0x6c0f('0xf')});case _0x6c0f('0x6a'):logger['info'](_0x6c0f('0x63'),_0x6c0f('0x58'));emit(util[_0x6c0f('0xc')]('user:%s',_0x3783d1[_0x6c0f('0x12')]),'trigger:browser:url',{'uri':util[_0x6c0f('0xc')]('%s/agent/tickets/%s',_0x2aef17[_0x6c0f('0xe')][_0x6c0f('0x5b')](_0x6c0f('0x5c'),''),_0x142fc5['id'])});break;default:logger[_0x6c0f('0x6b')](_0x6c0f('0x63'),_0x6c0f('0x5d'));}}})['catch'](function(_0x453340){logger[_0x6c0f('0x6b')](_0x6c0f('0x6c'),util[_0x6c0f('0x60')](_0x453340,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x228b61,_0x2d49ef,_0x33e089,_0x3905fb,_0x272ba0,_0x4e7d1f){var _0x307c80,_0xbc5fb8;_0x4e7d1f['remoteUri']=intUtil[_0x6c0f('0x4b')](_0x4e7d1f[_0x6c0f('0xe')]);_0x4e7d1f[_0x6c0f('0x61')]=intUtil[_0x6c0f('0x4b')](_0x4e7d1f[_0x6c0f('0x61')]);if(_0x272ba0&&_0x272ba0[_0x6c0f('0x4c')]){logger[_0x6c0f('0xa')]('['+_0x2d49ef[_0x6c0f('0x6d')][_0x6c0f('0x6e')]()+']',_0x6c0f('0x64'));_0x2d49ef[_0x6c0f('0x4e')]=util[_0x6c0f('0xc')](_0x6c0f('0x65'),_0x4e7d1f[_0x6c0f('0x61')],_0x2d49ef[_0x6c0f('0x4f')],md5(_0x2d49ef[_0x6c0f('0x4f')]));}else{_0x2d49ef[_0x6c0f('0x4e')]='';}headers[_0x6c0f('0x66')]=getAuth(_0x4e7d1f);return getUser(_0x4e7d1f)[_0x6c0f('0x23')](function(_0x24c00f){_0x307c80=_0x24c00f;logger[_0x6c0f('0xa')](_0x6c0f('0x51'),_0x307c80['id']);return getEndUser(_0x4e7d1f,_0x2d49ef['calleridname'],_0x2d49ef[_0x6c0f('0x53')]);})['then'](function(_0x591518){_0xbc5fb8=_0x591518;logger[_0x6c0f('0xa')](_0x6c0f('0x54'),_0xbc5fb8['id']);return getTicket(_0x4e7d1f,_0x307c80,_0xbc5fb8,_0x33e089,_0x2d49ef);})['then'](function(_0x25687f){if(_0x25687f){logger[_0x6c0f('0xa')]('The\x20Ticket\x20ID\x20is:',_0x25687f['id']);}})[_0x6c0f('0x5e')](function(_0x155e9c){logger[_0x6c0f('0x6b')]('['+_0x2d49ef[_0x6c0f('0x6d')]['toUpperCase']()+']'+_0x6c0f('0x6f'),util[_0x6c0f('0x60')](_0x155e9c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3b2d=['md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','getString','Subjects','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','toLowerCase','content','string','customField','push','idField','toString','variable','variableName','customVariable','Variable','name','custom_fields','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','newTab','user:%s','trigger:browser:url','inspect','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b2d,0x152));var _0xd3b2=function(_0x17292e,_0x29a37b){_0x17292e=_0x17292e-0x0;var _0x24ad52=_0x3b2d[_0x17292e];return _0x24ad52;};'use strict';var _=require(_0xd3b2('0x0'));var rp=require('request-promise');var md5=require(_0xd3b2('0x1'));var util=require(_0xd3b2('0x2'));var Redis=require(_0xd3b2('0x3'));var intUtil=require(_0xd3b2('0x4'));var config=require(_0xd3b2('0x5'));var logger=require(_0xd3b2('0x6'))('zendesk');config['redis']=_[_0xd3b2('0x7')](config[_0xd3b2('0x8')],{'host':_0xd3b2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3b2('0x8')]));function emit(_0x49dff8,_0x1fc906,_0xd12af6){io['to'](_0x49dff8)[_0xd3b2('0xa')](_0x1fc906,_0xd12af6);}var headers={'Content-Type':_0xd3b2('0xb'),'Accept':_0xd3b2('0xb')};function getTicket(_0x3ded52,_0x597763,_0x21cea6,_0x1d6bfb,_0x5f2e6c){logger[_0xd3b2('0xc')](_0xd3b2('0xd'));return request({'uri':util[_0xd3b2('0xe')]('%s/tickets.json',_0x3ded52[_0xd3b2('0xf')]),'method':_0xd3b2('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x21cea6['id'],'submitter_id':_0x597763?_0x597763['id']:undefined,'assignee_id':_0x597763?_0x597763['id']:undefined,'tags':getTags(_0x1d6bfb[_0xd3b2('0x11')],'name'),'subject':intUtil[_0xd3b2('0x12')](_0x1d6bfb[_0xd3b2('0x13')],_0x5f2e6c,'\x20'),'description':intUtil[_0xd3b2('0x12')](_0x1d6bfb['Descriptions'],_0x5f2e6c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd3b2('0x12')](_0x1d6bfb['Descriptions'],_0x5f2e6c,'\x0a')}},getCustomFields(_0x1d6bfb[_0xd3b2('0x14')],_0x5f2e6c))}})['then'](function(_0x3843d7){logger['info'](_0xd3b2('0x15'));return _0x3843d7[_0xd3b2('0x16')];});}function getUser(_0x491027,_0x31d01a){if(intUtil[_0xd3b2('0x17')](_0x31d01a)){logger[_0xd3b2('0xc')](_0xd3b2('0x18'),_0x31d01a);return request({'uri':util['format'](_0xd3b2('0x19'),_0x491027['remoteUri']),'qs':{'query':util[_0xd3b2('0xe')](_0xd3b2('0x1a'),_0x31d01a)}})[_0xd3b2('0x1b')](function(_0x952727){if(_0x952727[_0xd3b2('0x1c')]){logger[_0xd3b2('0xc')](_0xd3b2('0x1d'));return _[_0xd3b2('0x1e')](_0x952727['results'],{'email':_0x31d01a,'role':_0xd3b2('0x1f')});}else{logger[_0xd3b2('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd3b2('0xe')](_0xd3b2('0x20'),_0x491027[_0xd3b2('0xf')])})[_0xd3b2('0x1b')](function(_0x59f91a){logger[_0xd3b2('0xc')]('Admin\x20account\x20selected.');return _0x59f91a[_0xd3b2('0x21')];});}});}else{logger[_0xd3b2('0xc')](_0xd3b2('0x22'));return request({'uri':util[_0xd3b2('0xe')]('%s/users/me.json',_0x491027[_0xd3b2('0xf')])})[_0xd3b2('0x1b')](function(_0x28852b){logger[_0xd3b2('0xc')](_0xd3b2('0x23'));return _0x28852b[_0xd3b2('0x21')];});}}function getEndUser(_0xb0df11,_0xa126b8,_0x193647){logger['info'](_0xd3b2('0x24'),_0x193647);return request({'uri':util['format'](_0xd3b2('0x19'),_0xb0df11[_0xd3b2('0xf')]),'qs':{'query':util[_0xd3b2('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x193647)}})[_0xd3b2('0x1b')](function(_0x187fd3){var _0x29ad36;if(_0x187fd3[_0xd3b2('0x25')][_0xd3b2('0x26')]){_0x187fd3['results']=_[_0xd3b2('0x27')](_0x187fd3[_0xd3b2('0x25')],{'suspended':![],'role':_0xd3b2('0x28')});if(_0x187fd3['results'][_0xd3b2('0x26')]){_0x29ad36=_[_0xd3b2('0x29')](_0x187fd3[_0xd3b2('0x25')]);}}if(_0x29ad36){logger[_0xd3b2('0xc')](_0xd3b2('0x2a'));return _0x29ad36;}else{logger['info'](_0xd3b2('0x2b'));return request({'uri':util[_0xd3b2('0xe')](_0xd3b2('0x2c'),_0xb0df11[_0xd3b2('0xf')]),'method':_0xd3b2('0x10'),'body':{'user':{'role':_0xd3b2('0x28'),'name':util[_0xd3b2('0xe')](_0xd3b2('0x2d'),_0xa126b8||_0x193647),'phone':_0x193647}}})[_0xd3b2('0x1b')](function(_0x57faf8){logger[_0xd3b2('0xc')](_0xd3b2('0x2e'));return _0x57faf8[_0xd3b2('0x21')];});}});}function getAuth(_0x1b1620){var _0x28eed6;if(_0x1b1620[_0xd3b2('0x2f')]===_0xd3b2('0x30')){_0x28eed6=util['format'](_0xd3b2('0x31'),_0x1b1620[_0xd3b2('0x32')],_0x1b1620[_0xd3b2('0x30')]);}else if(_0x1b1620[_0xd3b2('0x2f')]===_0xd3b2('0x33')){_0x28eed6=util[_0xd3b2('0xe')](_0xd3b2('0x34'),_0x1b1620[_0xd3b2('0x32')],_0x1b1620[_0xd3b2('0x33')]);}return util[_0xd3b2('0xe')](_0xd3b2('0x35'),new Buffer(_0x28eed6)['toString'](_0xd3b2('0x36')));}function request(_0x31d48b){logger[_0xd3b2('0x37')](_0xd3b2('0x38'),JSON[_0xd3b2('0x39')](_0x31d48b));return rp(_[_0xd3b2('0x7')](_0x31d48b,{'method':_0xd3b2('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x292c89,_0xa219a2){var _0x3744f2=[];if(_0x292c89&&_0x292c89[_0xd3b2('0x26')]>0x0){_0x3744f2=_[_0xd3b2('0x3b')](_0x292c89,_0xa219a2);}return _0x3744f2;}function getCustomFields(_0x44c186,_0x4b33d9){var _0x1eaa7a=[];var _0x5d11aa={'custom_fields':[]};if(_0x44c186[_0xd3b2('0x26')]>0x0){_[_0xd3b2('0x3c')](_0x44c186,function(_0xe2aec2){if(_[_0xd3b2('0x3d')](['string',_0xd3b2('0x3e')],_0xe2aec2[_0xd3b2('0x3f')])&&_0xe2aec2[_0xd3b2('0x40')]&&!_0xe2aec2['customField']){_0x5d11aa[_0xe2aec2[_0xd3b2('0x40')][_0xd3b2('0x41')]()]=_0xe2aec2[_0xd3b2('0x42')]['toString']();}else if(_['includes']([_0xd3b2('0x43'),_0xd3b2('0x3e')],_0xe2aec2['type'])&&_0xe2aec2['idField']&&_0xe2aec2[_0xd3b2('0x44')]){_0x5d11aa['custom_fields'][_0xd3b2('0x45')]({'id':_0xe2aec2[_0xd3b2('0x46')],'value':_0xe2aec2['content'][_0xd3b2('0x47')]()});}else if(_0xe2aec2[_0xd3b2('0x3f')]===_0xd3b2('0x48')&&_0xe2aec2[_0xd3b2('0x49')]&&_0xe2aec2[_0xd3b2('0x46')]&&_0xe2aec2[_0xd3b2('0x44')]){_0x4b33d9[_0xe2aec2[_0xd3b2('0x49')]]&&_0x5d11aa['custom_fields'][_0xd3b2('0x45')]({'id':_0xe2aec2['idField'],'value':_0x4b33d9[_0xe2aec2[_0xd3b2('0x49')]][_0xd3b2('0x47')]()});}else if(_0xe2aec2[_0xd3b2('0x3f')]===_0xd3b2('0x4a')&&_0xe2aec2[_0xd3b2('0x4b')]&&_0xe2aec2['Variable'][_0xd3b2('0x4c')]&&_0xe2aec2[_0xd3b2('0x46')]&&_0xe2aec2[_0xd3b2('0x44')]){_0x4b33d9[_0xe2aec2['Variable'][_0xd3b2('0x4c')]['toLowerCase']()]&&_0x5d11aa[_0xd3b2('0x4d')][_0xd3b2('0x45')]({'id':_0xe2aec2[_0xd3b2('0x46')],'value':_0x4b33d9[_0xe2aec2['Variable'][_0xd3b2('0x4c')][_0xd3b2('0x41')]()][_0xd3b2('0x47')]()});}});}return _0x5d11aa;}exports[_0xd3b2('0x4e')]=function(_0x186235,_0x27b330,_0x1fac67,_0x151cab,_0x1e9538,_0x50979c){var _0x517908,_0x85cb14;_0x50979c[_0xd3b2('0xf')]=intUtil[_0xd3b2('0x4f')](_0x50979c[_0xd3b2('0xf')]);_0x50979c[_0xd3b2('0x50')]=intUtil[_0xd3b2('0x4f')](_0x50979c[_0xd3b2('0x50')]);if(_0x1e9538&&_0x1e9538['monitor_format']){logger[_0xd3b2('0xc')](_0xd3b2('0x51'),'Recording\x20is\x20enabled!');_0x27b330[_0xd3b2('0x52')]=util['format'](_0xd3b2('0x53'),_0x50979c[_0xd3b2('0x50')],_0x27b330[_0xd3b2('0x54')],md5(_0x27b330[_0xd3b2('0x54')]));}else{_0x27b330['recordingURL']='';}headers[_0xd3b2('0x55')]=getAuth(_0x50979c);return getUser(_0x50979c,_0x151cab[_0xd3b2('0x56')])[_0xd3b2('0x1b')](function(_0x430aa4){_0x517908=_0x430aa4;logger['info'](_0xd3b2('0x57'),_0x517908['id']);return getEndUser(_0x50979c,_0x27b330[_0xd3b2('0x58')],_0x27b330['calleridnum']);})[_0xd3b2('0x1b')](function(_0x4caf3b){_0x85cb14=_0x4caf3b;logger[_0xd3b2('0xc')](_0xd3b2('0x59'),_0x85cb14['id']);return getTicket(_0x50979c,_0x517908,_0x85cb14,_0x1fac67,_0x27b330);})[_0xd3b2('0x1b')](function(_0x4acc50){if(_0x4acc50){logger['info'](_0xd3b2('0x5a'),_0x4acc50['id']);switch(_0x50979c[_0xd3b2('0x3f')]){case _0xd3b2('0x5b'):logger[_0xd3b2('0xc')](_0xd3b2('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xd3b2('0x5c'),_0x50979c[_0xd3b2('0xf')],_0x517908['id'],_0x4acc50['id']),'method':_0xd3b2('0x10')});case'newTab':logger[_0xd3b2('0xc')](_0xd3b2('0x51'),_0xd3b2('0x5d'));emit(util[_0xd3b2('0xe')]('user:%s',_0x151cab[_0xd3b2('0x4c')]),'trigger:browser:url',{'uri':util[_0xd3b2('0xe')](_0xd3b2('0x5e'),_0x50979c[_0xd3b2('0xf')][_0xd3b2('0x5f')](_0xd3b2('0x60'),''),_0x4acc50['id'])});break;default:logger[_0xd3b2('0x61')](_0xd3b2('0x51'),_0xd3b2('0x62'));}}})[_0xd3b2('0x63')](function(_0x14a50d){logger[_0xd3b2('0x61')](_0xd3b2('0x64'),util['inspect'](_0x14a50d,{'showHidden':!![],'depth':null}));});};exports[_0xd3b2('0x65')]=function(_0x2ef227,_0x36633f,_0x74671b,_0x3e0ecb,_0xe1c853,_0x13e6cd,_0x2c923b){var _0x4614df,_0x39fc08;_0x13e6cd['remoteUri']=intUtil[_0xd3b2('0x4f')](_0x13e6cd[_0xd3b2('0xf')]);_0x13e6cd['serverUrl']=intUtil[_0xd3b2('0x4f')](_0x13e6cd['serverUrl']);if(_0x2c923b&&_0x2c923b['recordingFormat']&&_0x2c923b['recordingFormat']!==_0xd3b2('0x66')){logger['info'](_0xd3b2('0x67'),_0xd3b2('0x68'));_0x36633f[_0xd3b2('0x52')]=util[_0xd3b2('0xe')](_0xd3b2('0x53'),_0x13e6cd['serverUrl'],_0x36633f[_0xd3b2('0x54')],md5(_0x36633f[_0xd3b2('0x54')]));}headers['Authorization']=getAuth(_0x13e6cd);return getUser(_0x13e6cd,_0x3e0ecb[_0xd3b2('0x56')])['then'](function(_0x5282ba){_0x4614df=_0x5282ba;logger[_0xd3b2('0xc')](_0xd3b2('0x57'),_0x4614df['id']);return getEndUser(_0x13e6cd,_0x36633f[_0xd3b2('0x69')],_0x36633f['destcalleridnum']);})['then'](function(_0x4954a9){_0x39fc08=_0x4954a9;logger[_0xd3b2('0xc')](_0xd3b2('0x59'),_0x39fc08['id']);return getTicket(_0x13e6cd,_0x4614df,_0x39fc08,_0x74671b,_0x36633f);})['then'](function(_0x453fe3){if(_0x453fe3){logger[_0xd3b2('0xc')](_0xd3b2('0x5a'),_0x453fe3['id']);switch(_0x13e6cd['type']){case _0xd3b2('0x5b'):logger[_0xd3b2('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd3b2('0xe')](_0xd3b2('0x5c'),_0x13e6cd[_0xd3b2('0xf')],_0x4614df['id'],_0x453fe3['id']),'method':_0xd3b2('0x10')});case _0xd3b2('0x6a'):logger[_0xd3b2('0xc')](_0xd3b2('0x67'),_0xd3b2('0x5d'));emit(util['format'](_0xd3b2('0x6b'),_0x3e0ecb['name']),_0xd3b2('0x6c'),{'uri':util['format'](_0xd3b2('0x5e'),_0x13e6cd['remoteUri'][_0xd3b2('0x5f')]('/api/v2',''),_0x453fe3['id'])});break;default:logger[_0xd3b2('0x61')](_0xd3b2('0x67'),_0xd3b2('0x62'));}}})[_0xd3b2('0x63')](function(_0x270566){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd3b2('0x6d')](_0x270566,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3dfb07,_0x3b7148,_0x51fab8,_0x40a514,_0xf5775f,_0x18e78e){var _0x2a8aea,_0x4da16f;_0x18e78e[_0xd3b2('0xf')]=intUtil[_0xd3b2('0x4f')](_0x18e78e[_0xd3b2('0xf')]);_0x18e78e['serverUrl']=intUtil[_0xd3b2('0x4f')](_0x18e78e[_0xd3b2('0x50')]);if(_0xf5775f&&_0xf5775f[_0xd3b2('0x6e')]){logger[_0xd3b2('0xc')]('['+_0x3b7148[_0xd3b2('0x6f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3b7148[_0xd3b2('0x52')]=util[_0xd3b2('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18e78e[_0xd3b2('0x50')],_0x3b7148[_0xd3b2('0x54')],md5(_0x3b7148[_0xd3b2('0x54')]));}else{_0x3b7148['recordingURL']='';}headers['Authorization']=getAuth(_0x18e78e);return getUser(_0x18e78e)[_0xd3b2('0x1b')](function(_0x3b4add){_0x2a8aea=_0x3b4add;logger['info'](_0xd3b2('0x57'),_0x2a8aea['id']);return getEndUser(_0x18e78e,_0x3b7148[_0xd3b2('0x58')],_0x3b7148['calleridnum']);})[_0xd3b2('0x1b')](function(_0x1e6307){_0x4da16f=_0x1e6307;logger[_0xd3b2('0xc')](_0xd3b2('0x59'),_0x4da16f['id']);return getTicket(_0x18e78e,_0x2a8aea,_0x4da16f,_0x51fab8,_0x3b7148);})[_0xd3b2('0x1b')](function(_0x2013b0){if(_0x2013b0){logger[_0xd3b2('0xc')](_0xd3b2('0x5a'),_0x2013b0['id']);}})[_0xd3b2('0x63')](function(_0x1dcef0){logger['error']('['+_0x3b7148[_0xd3b2('0x6f')]['toUpperCase']()+']'+_0xd3b2('0x70'),util[_0xd3b2('0x6d')](_0x1dcef0,{'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 9f3bd8a..a565166 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 _0x9364=['Call_Result','Called','complete','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','merge','/crm/v2/Calls','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','Outbound','[OUTBOUND]','toUpperCase','/api/voice/recordings/','com','lodash','./util','moment','ioredis','bluebird','zoho','redis','defaults','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','lead','Creating\x20new\x20call...','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','mm:ss','answertime','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','format','lastevent','called'];(function(_0x47341f,_0x4c9dbe){var _0xbf949a=function(_0x3b308b){while(--_0x3b308b){_0x47341f['push'](_0x47341f['shift']());}};_0xbf949a(++_0x4c9dbe);}(_0x9364,0x1e5));var _0x4936=function(_0x1bef6a,_0x100258){_0x1bef6a=_0x1bef6a-0x0;var _0x41fa0e=_0x9364[_0x1bef6a];return _0x41fa0e;};'use strict';var _=require(_0x4936('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0x4936('0x1'));var moment=require(_0x4936('0x2'));var Redis=require(_0x4936('0x3'));var BPromise=require(_0x4936('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4936('0x5'));config[_0x4936('0x6')]=_[_0x4936('0x7')](config[_0x4936('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4936('0x6')]));function emit(_0x4c3c38,_0x5973df,_0x1125a2){io['to'](_0x4c3c38)[_0x4936('0x8')](_0x5973df,_0x1125a2);}function request(_0xf0129f){logger[_0x4936('0x9')](_0x4936('0xa'),JSON[_0x4936('0xb')](_0xf0129f));return rp(_0xf0129f);}function getCustomFields(_0x2d3d29,_0x1421af){var _0x4f032d={};if(_0x2d3d29[_0x4936('0xc')]>0x0){_[_0x4936('0xd')](_0x2d3d29,function(_0x804e89){if(_[_0x4936('0xe')]([_0x4936('0xf'),_0x4936('0x10')],_0x804e89['type'])&&_0x804e89['idField']){_0x4f032d[_0x804e89[_0x4936('0x11')]]=_0x804e89[_0x4936('0x12')][_0x4936('0x13')]();}else if(_0x804e89[_0x4936('0x14')]===_0x4936('0x15')&&_0x804e89[_0x4936('0x16')]&&_0x804e89['idField']&&_0x1421af[_0x804e89[_0x4936('0x16')]]){_0x4f032d[_0x804e89[_0x4936('0x11')]]=_0x1421af[_0x804e89[_0x4936('0x16')]][_0x4936('0x13')]();}else if(_0x804e89['type']==='customVariable'&&_0x804e89['Variable']&&_0x804e89[_0x4936('0x17')][_0x4936('0x18')]&&_0x804e89[_0x4936('0x11')]&&_0x1421af[_0x804e89[_0x4936('0x17')]['name'][_0x4936('0x19')]()]){_0x4f032d[_0x804e89['idField']]=_0x1421af[_0x804e89[_0x4936('0x17')]['name'][_0x4936('0x19')]()]['toString']();}});}return _0x4f032d;}function getName(_0x39ee1e){if(_0x39ee1e['indexOf']('\x20')>0x0){var _0x2d1d23=_0x39ee1e[_0x4936('0x1a')](/ (.+)/);if(_0x2d1d23[0x1]){return _0x2d1d23;}}return[_0x39ee1e,_0x39ee1e];}var accountsTokens={};function getAccessToken(_0xcf4a0){return new Promise(function(_0xb0095e,_0x23c967){if(!_['isNil'](accountsTokens[_0xcf4a0['id']])&&!_[_0x4936('0x1b')](accountsTokens[_0xcf4a0['id']][_0x4936('0x1c')])){if(moment()[_0x4936('0x1d')](accountsTokens[_0xcf4a0['id']][_0x4936('0x1e')])){_0xb0095e(accountsTokens[_0xcf4a0['id']]['access_token']);}}var _0x2ef563;switch(_0xcf4a0['zone']){case'US':_0x2ef563=_0x4936('0x1f');break;case'AU':_0x2ef563='https://accounts.zoho.com.au';break;case'EU':_0x2ef563=_0x4936('0x20');break;case'IN':_0x2ef563=_0x4936('0x21');break;case'CN':_0x2ef563='https://accounts.zoho.com.cn';break;default:_0x2ef563=_0x4936('0x20');break;}var _0x3f29a7={'method':_0x4936('0x22'),'uri':_0x2ef563+'/oauth/v2/token','qs':{'refresh_token':_0xcf4a0[_0x4936('0x23')],'client_id':_0xcf4a0[_0x4936('0x24')],'client_secret':_0xcf4a0[_0x4936('0x25')],'grant_type':_0x4936('0x26')},'json':!![]};return rp(_0x3f29a7)[_0x4936('0x27')](function(_0x5ad2be){accountsTokens[_0xcf4a0['id']]={'access_token':_0x5ad2be[_0x4936('0x1c')],'expires_in':moment()[_0x4936('0x28')](_0x5ad2be[_0x4936('0x1e')],_0x4936('0x29'))};_0xb0095e(_0x5ad2be[_0x4936('0x1c')]);})[_0x4936('0x2a')](function(_0x43a7a0){logger[_0x4936('0x2b')](_0x4936('0x2c'),_0x43a7a0['stack']);_0x23c967(_0x43a7a0);});});}function getUser(_0x4702c7,_0x4c31ea,_0xc4db36,_0x20ac91){logger[_0x4936('0x2d')](_0x4936('0x2e'));return request({'method':_0x4936('0x2f'),'uri':util['format'](_0x4936('0x30'),_0x4c31ea),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x4936('0x31')+_0x4702c7},'json':!![]})[_0x4936('0x27')](function(_0x538a1b){if(_0x538a1b['users']){var _0x3c9f78=-0x1;if(_[_0x4936('0x32')](_0x538a1b[_0x4936('0x33')])){if(!_[_0x4936('0x1b')](_0x20ac91)){_0x3c9f78=_[_0x4936('0x34')](_0x538a1b[_0x4936('0x33')],function(_0x2009e4){return _0x2009e4['email']===_0x20ac91;});}if(_0x3c9f78>=0x0){logger[_0x4936('0x2d')](_0x4936('0x35'));}else{logger[_0x4936('0x2d')](_0x4936('0x36'));_0x3c9f78=_[_0x4936('0x34')](_0x538a1b['users'],function(_0x10274b){return _0x10274b['profile'][_0x4936('0x18')]===_0x4936('0x37');});}return _0x538a1b['users'][_0x3c9f78];}else{if(_0x538a1b[_0x4936('0x38')][_0x4936('0x39')][_0x4936('0x18')]===_0x4936('0x37')){logger[_0x4936('0x2d')](_0x4936('0x36'));user=_0x538a1b[_0x4936('0x38')];return user;}else{logger[_0x4936('0x2b')](_0x4936('0x3a'),JSON[_0x4936('0xb')](_0x538a1b));throw new Error(_0x4936('0x3b')+JSON[_0x4936('0xb')](_0x538a1b));}}}else{logger[_0x4936('0x2b')](_0x4936('0x3a'),JSON[_0x4936('0xb')](_0x538a1b));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4936('0xb')](_0x538a1b));}})[_0x4936('0x2a')](function(_0x48f2bf){console[_0x4936('0x2b')](_0x48f2bf);});}function getZohoUser(_0x5976f1,_0x55deb4){return new BPromise(function(_0x7087b7,_0x3f804a){request(_0x5976f1)[_0x4936('0x27')](function(_0x35c0dc){var _0x1c8542=null;if(_0x35c0dc){_0x1c8542=_0x35c0dc[_0x4936('0x3c')][0x0];_0x1c8542[_0x4936('0x3d')]=_0x55deb4;}_0x7087b7(_0x1c8542);})['catch'](function(_0x40f198){_0x3f804a(_0x40f198);});});}function createEndUser(_0x1da0c0,_0x1c6b42,_0x5c1dfa,_0xd94788,_0x49d06a,_0x166adc){var _0x5c1dfa=getName(_0x5c1dfa);return request({'method':_0x4936('0x22'),'uri':_0x4936('0x3e')+_0x1c6b42+'/crm/v2/'+_[_0x4936('0x3f')](_0x166adc['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5c1dfa[0x1],'First_Name':_0x5c1dfa[0x0],'Phone':_0xd94788,'Owner':{'name':!_[_0x4936('0x1b')](_0x49d06a[_0x4936('0x40')]['name'])?_0x49d06a[_0x4936('0x40')]['name']:!_[_0x4936('0x1b')](_0x49d06a[_0x4936('0x41')])?_0x49d06a[_0x4936('0x41')]+'\x20'+_0x49d06a[_0x4936('0x42')]:_0x49d06a[_0x4936('0x42')],'id':_0x49d06a['id']}}]},'headers':{'Authorization':_0x4936('0x31')+_0x1da0c0},'json':!![]})['then'](function(_0x480500){if(_0x480500&&_0x480500[_0x4936('0x3c')][0x0][_0x4936('0x43')]===_0x4936('0x44')){var _0x260c39=_0x480500['data'][0x0]['details'];_0x260c39['enduserType']=_[_0x4936('0x3f')](_0x166adc['moduleCreate'])+'s';return _0x260c39;}logger[_0x4936('0x2b')](_0x4936('0x3a'),JSON[_0x4936('0xb')](data));throw new Error(_0x4936('0x45')+JSON[_0x4936('0xb')](data));})[_0x4936('0x2a')](function(_0x2f632d){console[_0x4936('0x46')](_0x4936('0x47'),_0x2f632d);});}function getEndUser(_0x4b03d2,_0x454299,_0x397c0c,_0x4fbeb5,_0xdc73b7,_0x2350fa,_0x5a2c70){var _0x4a38b2={'method':_0x4936('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4b03d2},'json':!![]};switch(_0x5a2c70[_0x4936('0x48')]){case'contact_lead':_0x4a38b2[_0x4936('0x49')]=_0x4936('0x3e')+_0x454299+_0x4936('0x4a')+_0xdc73b7+'))';return getZohoUser(_0x4a38b2,_0x4936('0x4b'))[_0x4936('0x27')](function(_0x4330c6){if(_0x4330c6)return _0x4330c6;_0x4a38b2[_0x4936('0x49')]=_0x4936('0x3e')+_0x454299+_0x4936('0x4c')+_0xdc73b7+'))';return getZohoUser(_0x4a38b2,_0x4936('0x4d'))['then'](function(_0x3c8a78){if(_0x3c8a78)return _0x3c8a78;if(_0x5a2c70[_0x4936('0x4e')]!=_0x4936('0x4f')){return createEndUser(_0x4b03d2,_0x454299,_0x4fbeb5,_0xdc73b7,_0x2350fa,_0x5a2c70);}else{return{};}});});break;case'contact':_0x4a38b2[_0x4936('0x49')]=_0x4936('0x3e')+_0x454299+_0x4936('0x4a')+_0xdc73b7+'))';return getZohoUser(_0x4a38b2,_0x4936('0x4b'))[_0x4936('0x27')](function(_0x5b4549){if(_0x5b4549)return _0x5b4549;if(_0x5a2c70[_0x4936('0x4e')]!=_0x4936('0x4f')){return createEndUser(_0x4b03d2,_0x454299,_0x4fbeb5,_0xdc73b7,_0x2350fa,_0x5a2c70);}else{return{};}});break;case _0x4936('0x50'):_0x4a38b2['uri']=_0x4936('0x3e')+_0x454299+_0x4936('0x4c')+_0xdc73b7+'))';return getZohoUser(_0x4a38b2,'Leads')[_0x4936('0x27')](function(_0xa80bdb){if(_0xa80bdb)return _0xa80bdb;if(_0x5a2c70[_0x4936('0x4e')]!='nothing'){return createEndUser(_0x4b03d2,_0x454299,_0x4fbeb5,_0xdc73b7,_0x2350fa,_0x5a2c70);}else{return{};}});break;}}function getCall(_0x422c99,_0x4ba545,_0x5ab917,_0x25d2d3,_0x3c878c,_0x573968,_0x22de37,_0x8504fe){logger[_0x4936('0x2d')](_0x4936('0x51'));var _0x233233={};_0x233233['Owner']={'name':!_[_0x4936('0x1b')](_0x25d2d3['role'][_0x4936('0x18')])&&!_['isNil'](_0x25d2d3['profile'][_0x4936('0x18')])&&_0x25d2d3[_0x4936('0x39')][_0x4936('0x18')]===_0x4936('0x52')?_0x25d2d3[_0x4936('0x40')][_0x4936('0x18')]:!_[_0x4936('0x1b')](_0x25d2d3['first_name'])?_0x25d2d3[_0x4936('0x41')]+'\x20'+_0x25d2d3[_0x4936('0x42')]:_0x25d2d3[_0x4936('0x42')],'id':_0x25d2d3['id']};_0x233233['Subject']=intUtil[_0x4936('0x53')](_0x573968[_0x4936('0x54')],_0x22de37,'\x20');_0x233233[_0x4936('0x55')]=intUtil[_0x4936('0x53')](_0x573968['Descriptions'],_0x22de37,'\x0a');if(_0x3c878c['enduserType']===_0x4936('0x4b')){_0x233233[_0x4936('0x56')]={'name':!_[_0x4936('0x1b')](_0x3c878c[_0x4936('0x57')])?_0x3c878c[_0x4936('0x57')]:!_[_0x4936('0x1b')](_0x3c878c['First_Name'])?_0x3c878c[_0x4936('0x58')]+'\x20'+_0x3c878c['Last_Name']:_0x3c878c[_0x4936('0x59')],'id':_0x3c878c['id']};}if(_0x3c878c[_0x4936('0x3d')]===_0x4936('0x4d')){_0x233233[_0x4936('0x5a')]={'name':!_[_0x4936('0x1b')](_0x3c878c[_0x4936('0x57')])?_0x3c878c[_0x4936('0x57')]:!_['isNil'](_0x3c878c['First_Name'])?_0x3c878c[_0x4936('0x58')]+'\x20'+_0x3c878c[_0x4936('0x59')]:_0x3c878c[_0x4936('0x59')],'id':_0x3c878c['id']};_0x233233[_0x4936('0x5b')]=_[_0x4936('0x3f')](_0x3c878c[_0x4936('0x3d')]);}if(_0x22de37['talktime']){_0x233233[_0x4936('0x5c')]=moment['utc'](parseInt(_0x22de37['talktime'])*0x3e8)['format'](_0x4936('0x5d'));}else if(_0x22de37[_0x4936('0x5e')]&&_0x22de37['endtime']){_0x233233[_0x4936('0x5c')]=moment[_0x4936('0x5f')](moment(_0x22de37[_0x4936('0x60')],'YYYY-MM-DDTHH:mm:ss')[_0x4936('0x61')](moment(_0x22de37[_0x4936('0x62')],_0x4936('0x63'))))[_0x4936('0x64')]('mm:ss');}switch(_0x22de37[_0x4936('0x65')]){case _0x4936('0x66'):_0x233233[_0x4936('0x67')]=_0x4936('0x68');break;case _0x4936('0x69'):case'connect':_0x233233[_0x4936('0x67')]='Answered';break;case _0x4936('0x6a'):_0x233233[_0x4936('0x67')]=_0x4936('0x6b');break;case _0x4936('0x6c'):_0x233233[_0x4936('0x67')]=_0x4936('0x6d');break;case'timeout':_0x233233[_0x4936('0x67')]=_0x4936('0x6e');default:}_0x233233[_0x4936('0x6f')]=(_0x8504fe===_0x4936('0x70')?moment(_0x22de37[_0x4936('0x62')])['format'](_0x4936('0x63')):moment(_0x22de37[_0x4936('0x71')])[_0x4936('0x64')](_0x4936('0x63')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x233233['Call_Type']=_0x8504fe||'Inbound';_0x233233=_[_0x4936('0x72')](_0x233233,getCustomFields(_0x573968['Fields'],_0x22de37));return request({'method':'POST','uri':_0x4936('0x3e')+_0x4ba545+_0x4936('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x422c99},'body':{'data':[_0x233233]},'json':!![]})[_0x4936('0x27')](function(_0x1c9d8e){if(_0x1c9d8e&&_0x1c9d8e[_0x4936('0x3c')][0x0][_0x4936('0x43')]===_0x4936('0x44')){logger[_0x4936('0x2d')]('Call\x20created!');return{'id':_0x1c9d8e[_0x4936('0x3c')][0x0][_0x4936('0x74')]['id']};}})[_0x4936('0x2a')](function(_0x2e6c0a){logger['info'](_0x4936('0x75'),_0x2e6c0a[_0x4936('0x76')]);console[_0x4936('0x46')]('err',_0x2e6c0a);});}exports[_0x4936('0x77')]=function(_0x1a47ec,_0x29e002,_0x3f7ab8,_0xc16b33,_0x538e9,_0x15c64f){var _0x1e2491,_0x4bdea3,_0x2cfeb7;_0x15c64f[_0x4936('0x78')]=intUtil[_0x4936('0x79')](_0x15c64f[_0x4936('0x78')]);_0x15c64f[_0x4936('0x7a')]=intUtil[_0x4936('0x79')](_0x15c64f[_0x4936('0x7a')]);if(_0x538e9&&_0x538e9[_0x4936('0x7b')]){logger[_0x4936('0x2d')](_0x4936('0x7c'),_0x4936('0x7d'));_0x29e002[_0x4936('0x7e')]=_0x15c64f['serverUrl']+'/api/voice/recordings/'+_0x29e002[_0x4936('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x29e002[_0x4936('0x7f')]);}else{_0x29e002[_0x4936('0x7e')]='';}var _0x583326=_0x15c64f[_0x4936('0x78')]===_0x4936('0x80')?'eu':'com';return getAccessToken(_0x15c64f)[_0x4936('0x27')](function(_0x6c7e16){_0x2cfeb7=_0x6c7e16;return getUser(_0x2cfeb7,_0x583326,_0x15c64f,_0xc16b33[_0x4936('0x81')]);})['then'](function(_0x1264a9){_0x1e2491=_0x1264a9;logger[_0x4936('0x2d')](_0x4936('0x82'),_0x1e2491['id']);return getEndUser(_0x2cfeb7,_0x583326,_0x15c64f,_0x29e002[_0x4936('0x83')],_0x29e002['calleridnum'],_0x1e2491,_0x3f7ab8);})[_0x4936('0x27')](function(_0x159f35){_0x4bdea3=_0x159f35;return getCall(_0x2cfeb7,_0x583326,_0x15c64f,_0x1e2491,_0x4bdea3,_0x3f7ab8,_0x29e002,_0x4936('0x84'));})[_0x4936('0x27')](function(_0xb90634){if(_0xb90634){logger[_0x4936('0x2d')](_0x4936('0x85'),_0xb90634['id']);logger[_0x4936('0x2d')]('[QUEUE]',_0x4936('0x86'));emit(util['format'](_0x4936('0x87'),_0xc16b33[_0x4936('0x18')]),_0x4936('0x88'),{'uri':_0x4936('0x89')+_0x15c64f['host']+'/crm/EntityInfo.do?module=Calls&id='+_0xb90634['id']});}})[_0x4936('0x2a')](function(_0x2cb68f){logger['error'](_0x4936('0x7c'),JSON[_0x4936('0xb')](_0x2cb68f));});};exports[_0x4936('0x70')]=function(_0x1a26a4,_0x513b72,_0x408b0d,_0xc698af,_0x213cfb,_0x396f59,_0x6151b5){var _0x5686a2,_0x42a77d,_0xd93f7f;_0x396f59[_0x4936('0x78')]=intUtil[_0x4936('0x79')](_0x396f59[_0x4936('0x78')]);_0x396f59['serverUrl']=intUtil[_0x4936('0x79')](_0x396f59[_0x4936('0x7a')]);if(_0x6151b5&&_0x6151b5[_0x4936('0x8a')]&&_0x6151b5[_0x4936('0x8a')]!==_0x4936('0x8b')){logger[_0x4936('0x2d')]('[OUTBOUND]',_0x4936('0x7d'));_0x513b72[_0x4936('0x7e')]=_0x396f59[_0x4936('0x7a')]+'/api/voice/recordings/'+_0x513b72['uniqueid']+_0x4936('0x8c')+md5(_0x513b72[_0x4936('0x7f')]);}var _0x101cc1=_0x396f59[_0x4936('0x78')]===_0x4936('0x80')?'eu':'com';return getAccessToken(_0x396f59)[_0x4936('0x27')](function(_0x5cc8ed){_0xd93f7f=_0x5cc8ed;return getUser(_0xd93f7f,_0x101cc1,_0x396f59,_0xc698af[_0x4936('0x81')]);})['then'](function(_0x5654eb){_0x5686a2=_0x5654eb;logger[_0x4936('0x2d')](_0x4936('0x82'),_0x5686a2['id']);return getEndUser(_0xd93f7f,_0x101cc1,_0x396f59,_0x513b72[_0x4936('0x8d')],_0x513b72['destcalleridnum'],_0x5686a2,_0x408b0d);})[_0x4936('0x27')](function(_0x221292){_0x42a77d=_0x221292;return getCall(_0xd93f7f,_0x101cc1,_0x396f59,_0x5686a2,_0x42a77d,_0x408b0d,_0x513b72,_0x4936('0x8e'));})[_0x4936('0x27')](function(_0x68dc72){if(_0x68dc72){logger[_0x4936('0x2d')](_0x4936('0x85'),_0x68dc72['id']);logger[_0x4936('0x2d')](_0x4936('0x8f'),_0x4936('0x86'));emit(util[_0x4936('0x64')](_0x4936('0x87'),_0xc698af[_0x4936('0x18')]),_0x4936('0x88'),{'uri':_0x4936('0x89')+_0x396f59['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x68dc72['id']});}})[_0x4936('0x2a')](function(_0x17f669){logger[_0x4936('0x2b')](_0x4936('0x8f'),JSON[_0x4936('0xb')](_0x17f669));});};exports['unmanaged']=function(_0x2b9a9f,_0x5b0457,_0x1ccce4,_0x3d7247,_0x9f1a26,_0x1b7114){var _0x56e951,_0x5f3483,_0x3bd445;_0x1b7114[_0x4936('0x78')]=intUtil[_0x4936('0x79')](_0x1b7114[_0x4936('0x78')]);_0x1b7114[_0x4936('0x7a')]=intUtil['stripTrailingSlash'](_0x1b7114[_0x4936('0x7a')]);if(_0x9f1a26&&_0x9f1a26[_0x4936('0x7b')]){logger[_0x4936('0x2d')]('['+_0x5b0457[_0x4936('0x65')][_0x4936('0x90')]()+']',_0x4936('0x7d'));_0x5b0457[_0x4936('0x7e')]=_0x1b7114[_0x4936('0x7a')]+_0x4936('0x91')+_0x5b0457['uniqueid']+_0x4936('0x8c')+md5(_0x5b0457[_0x4936('0x7f')]);}else{_0x5b0457[_0x4936('0x7e')]='';}var _0x423a53=_0x1b7114[_0x4936('0x78')]===_0x4936('0x80')?'eu':_0x4936('0x92');return getAccessToken(_0x1b7114)[_0x4936('0x27')](function(_0x17e541){_0x3bd445=_0x17e541;return getUser(_0x3bd445,_0x423a53,_0x1b7114);})[_0x4936('0x27')](function(_0x39818c){_0x56e951=_0x39818c;logger['info'](_0x4936('0x82'),_0x56e951['id']);return getEndUser(_0x3bd445,_0x423a53,_0x1b7114,_0x5b0457[_0x4936('0x83')],_0x5b0457['calleridnum'],_0x56e951,_0x1ccce4);})[_0x4936('0x27')](function(_0x12308f){_0x5f3483=_0x12308f;return getCall(_0x3bd445,_0x423a53,_0x1b7114,_0x56e951,_0x5f3483,_0x1ccce4,_0x5b0457,'Inbound');})[_0x4936('0x27')](function(_0x7cafc0){if(_0x7cafc0){logger[_0x4936('0x2d')]('The\x20Call\x20ID\x20is:',_0x7cafc0['id']);}})[_0x4936('0x2a')](function(_0x4ad28c){logger[_0x4936('0x2b')]('['+_0x5b0457[_0x4936('0x65')][_0x4936('0x90')]()+']',JSON[_0x4936('0xb')](_0x4ad28c));});}; \ No newline at end of file +var _0xdf49=['error','info','format','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','monitor_format','toUpperCase','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','length','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0xdf49,0x19f));var _0x9df4=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0xdf49[_0x3d2012];return _0x53d542;};'use strict';var _=require(_0x9df4('0x0'));var rp=require(_0x9df4('0x1'));var md5=require(_0x9df4('0x2'));var util=require('util');var intUtil=require(_0x9df4('0x3'));var moment=require('moment');var Redis=require(_0x9df4('0x4'));var BPromise=require(_0x9df4('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9df4('0x6'))(_0x9df4('0x7'));config[_0x9df4('0x8')]=_[_0x9df4('0x9')](config[_0x9df4('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9df4('0xa'))(new Redis(config[_0x9df4('0x8')]));function emit(_0x11ab46,_0x36e056,_0x1cba2){io['to'](_0x11ab46)['emit'](_0x36e056,_0x1cba2);}function request(_0x56f82d){logger['debug']('[HTTP]',JSON['stringify'](_0x56f82d));return rp(_0x56f82d);}function getCustomFields(_0x3d8206,_0x4c0d82){var _0x1c8070={};if(_0x3d8206[_0x9df4('0xb')]>0x0){_[_0x9df4('0xc')](_0x3d8206,function(_0x4940f1){if(_[_0x9df4('0xd')]([_0x9df4('0xe'),_0x9df4('0xf')],_0x4940f1['type'])&&_0x4940f1['idField']){_0x1c8070[_0x4940f1[_0x9df4('0x10')]]=_0x4940f1[_0x9df4('0x11')][_0x9df4('0x12')]();}else if(_0x4940f1[_0x9df4('0x13')]===_0x9df4('0x14')&&_0x4940f1[_0x9df4('0x15')]&&_0x4940f1['idField']&&_0x4c0d82[_0x4940f1[_0x9df4('0x15')]]){_0x1c8070[_0x4940f1[_0x9df4('0x10')]]=_0x4c0d82[_0x4940f1[_0x9df4('0x15')]][_0x9df4('0x12')]();}else if(_0x4940f1[_0x9df4('0x13')]===_0x9df4('0x16')&&_0x4940f1[_0x9df4('0x17')]&&_0x4940f1[_0x9df4('0x17')][_0x9df4('0x18')]&&_0x4940f1[_0x9df4('0x10')]&&_0x4c0d82[_0x4940f1[_0x9df4('0x17')][_0x9df4('0x18')][_0x9df4('0x19')]()]){_0x1c8070[_0x4940f1[_0x9df4('0x10')]]=_0x4c0d82[_0x4940f1[_0x9df4('0x17')][_0x9df4('0x18')][_0x9df4('0x19')]()][_0x9df4('0x12')]();}});}return _0x1c8070;}function getName(_0x3b3268){if(_0x3b3268['indexOf']('\x20')>0x0){var _0x1942cc=_0x3b3268[_0x9df4('0x1a')](/ (.+)/);if(_0x1942cc[0x1]){return _0x1942cc;}}return[_0x3b3268,_0x3b3268];}var accountsTokens={};function getAccessToken(_0x49b5a2){return new Promise(function(_0x5d28c9,_0x4ab4cf){if(!_[_0x9df4('0x1b')](accountsTokens[_0x49b5a2['id']])&&!_[_0x9df4('0x1b')](accountsTokens[_0x49b5a2['id']]['access_token'])){if(moment()[_0x9df4('0x1c')](accountsTokens[_0x49b5a2['id']][_0x9df4('0x1d')])){_0x5d28c9(accountsTokens[_0x49b5a2['id']][_0x9df4('0x1e')]);}}var _0x45ef70;switch(_0x49b5a2[_0x9df4('0x1f')]){case'US':_0x45ef70='https://accounts.zoho.com';break;case'AU':_0x45ef70=_0x9df4('0x20');break;case'EU':_0x45ef70=_0x9df4('0x21');break;case'IN':_0x45ef70='https://accounts.zoho.in';break;case'CN':_0x45ef70=_0x9df4('0x22');break;default:_0x45ef70=_0x9df4('0x21');break;}var _0x3e71a2={'method':_0x9df4('0x23'),'uri':_0x45ef70+_0x9df4('0x24'),'qs':{'refresh_token':_0x49b5a2[_0x9df4('0x25')],'client_id':_0x49b5a2[_0x9df4('0x26')],'client_secret':_0x49b5a2[_0x9df4('0x27')],'grant_type':_0x9df4('0x28')},'json':!![]};return rp(_0x3e71a2)[_0x9df4('0x29')](function(_0x211f42){accountsTokens[_0x49b5a2['id']]={'access_token':_0x211f42[_0x9df4('0x1e')],'expires_in':moment()[_0x9df4('0x2a')](_0x211f42['expires_in'],'seconds')};_0x5d28c9(_0x211f42['access_token']);})[_0x9df4('0x2b')](function(_0x2e466c){logger[_0x9df4('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x2e466c['stack']);_0x4ab4cf(_0x2e466c);});});}function getUser(_0x4a867c,_0x5c3fcd,_0x55eec3,_0x22ae44){logger[_0x9df4('0x2d')]('Search\x20user');return request({'method':'GET','uri':util[_0x9df4('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x5c3fcd),'qs':{'type':_0x9df4('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4a867c},'json':!![]})[_0x9df4('0x29')](function(_0xe8d115){if(_0xe8d115[_0x9df4('0x30')]){var _0x95e3ea=-0x1;if(_[_0x9df4('0x31')](_0xe8d115[_0x9df4('0x30')])){if(!_[_0x9df4('0x1b')](_0x22ae44)){_0x95e3ea=_[_0x9df4('0x32')](_0xe8d115['users'],function(_0x11baec){return _0x11baec[_0x9df4('0x33')]===_0x22ae44;});}if(_0x95e3ea>=0x0){logger[_0x9df4('0x2d')](_0x9df4('0x34'));}else{logger[_0x9df4('0x2d')](_0x9df4('0x35'));_0x95e3ea=_[_0x9df4('0x32')](_0xe8d115[_0x9df4('0x30')],function(_0x2e5a41){return _0x2e5a41[_0x9df4('0x36')][_0x9df4('0x18')]===_0x9df4('0x37');});}return _0xe8d115['users'][_0x95e3ea];}else{if(_0xe8d115[_0x9df4('0x38')][_0x9df4('0x36')][_0x9df4('0x18')]===_0x9df4('0x37')){logger[_0x9df4('0x2d')](_0x9df4('0x35'));user=_0xe8d115[_0x9df4('0x38')];return user;}else{logger['error'](_0x9df4('0x39'),JSON[_0x9df4('0x3a')](_0xe8d115));throw new Error(_0x9df4('0x3b')+JSON[_0x9df4('0x3a')](_0xe8d115));}}}else{logger[_0x9df4('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x9df4('0x3a')](_0xe8d115));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x9df4('0x3a')](_0xe8d115));}})[_0x9df4('0x2b')](function(_0x1cb644){console[_0x9df4('0x2c')](_0x1cb644);});}function getZohoUser(_0xa81831,_0x5562ca){return new BPromise(function(_0x173e19,_0x481a6c){request(_0xa81831)['then'](function(_0x86e26c){var _0x1c544c=null;if(_0x86e26c){_0x1c544c=_0x86e26c[_0x9df4('0x3c')][0x0];_0x1c544c[_0x9df4('0x3d')]=_0x5562ca;}_0x173e19(_0x1c544c);})[_0x9df4('0x2b')](function(_0x5dee94){_0x481a6c(_0x5dee94);});});}function createEndUser(_0x459e81,_0x4dc7e3,_0x28b642,_0x3075eb,_0x67e3a2,_0x5759a0){var _0x28b642=getName(_0x28b642);return request({'method':_0x9df4('0x23'),'uri':_0x9df4('0x3e')+_0x4dc7e3+_0x9df4('0x3f')+_[_0x9df4('0x40')](_0x5759a0[_0x9df4('0x41')])+'s','body':{'data':[{'Last_Name':_0x28b642[0x1],'First_Name':_0x28b642[0x0],'Phone':_0x3075eb,'Owner':{'name':!_[_0x9df4('0x1b')](_0x67e3a2['role'][_0x9df4('0x18')])?_0x67e3a2[_0x9df4('0x42')][_0x9df4('0x18')]:!_[_0x9df4('0x1b')](_0x67e3a2['first_name'])?_0x67e3a2['first_name']+'\x20'+_0x67e3a2[_0x9df4('0x43')]:_0x67e3a2[_0x9df4('0x43')],'id':_0x67e3a2['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x459e81},'json':!![]})[_0x9df4('0x29')](function(_0x5dee4a){if(_0x5dee4a&&_0x5dee4a[_0x9df4('0x3c')][0x0][_0x9df4('0x44')]===_0x9df4('0x45')){var _0x5f0679=_0x5dee4a[_0x9df4('0x3c')][0x0][_0x9df4('0x46')];_0x5f0679[_0x9df4('0x3d')]=_[_0x9df4('0x40')](_0x5759a0[_0x9df4('0x41')])+'s';return _0x5f0679;}logger[_0x9df4('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x9df4('0x47')+JSON[_0x9df4('0x3a')](data));})[_0x9df4('0x2b')](function(_0xbc6ce7){console[_0x9df4('0x48')](_0x9df4('0x49'),_0xbc6ce7);});}function getEndUser(_0x4ac6e9,_0x57ef9e,_0x26c676,_0x2b8057,_0x4cc993,_0x302955,_0xd2b581){var _0x39e3dc={'method':_0x9df4('0x4a'),'uri':'','headers':{'Authorization':_0x9df4('0x4b')+_0x4ac6e9},'json':!![]};switch(_0xd2b581[_0x9df4('0x4c')]){case'contact_lead':_0x39e3dc['uri']=_0x9df4('0x3e')+_0x57ef9e+_0x9df4('0x4d')+_0x4cc993+'))';return getZohoUser(_0x39e3dc,_0x9df4('0x4e'))[_0x9df4('0x29')](function(_0x579780){if(_0x579780)return _0x579780;_0x39e3dc[_0x9df4('0x4f')]='https://www.zohoapis.'+_0x57ef9e+_0x9df4('0x50')+_0x4cc993+'))';return getZohoUser(_0x39e3dc,_0x9df4('0x51'))[_0x9df4('0x29')](function(_0x322222){if(_0x322222)return _0x322222;if(_0xd2b581[_0x9df4('0x41')]!=_0x9df4('0x52')){return createEndUser(_0x4ac6e9,_0x57ef9e,_0x2b8057,_0x4cc993,_0x302955,_0xd2b581);}else{return{};}});});break;case'contact':_0x39e3dc[_0x9df4('0x4f')]=_0x9df4('0x3e')+_0x57ef9e+_0x9df4('0x4d')+_0x4cc993+'))';return getZohoUser(_0x39e3dc,_0x9df4('0x4e'))[_0x9df4('0x29')](function(_0x121805){if(_0x121805)return _0x121805;if(_0xd2b581['moduleCreate']!='nothing'){return createEndUser(_0x4ac6e9,_0x57ef9e,_0x2b8057,_0x4cc993,_0x302955,_0xd2b581);}else{return{};}});break;case _0x9df4('0x53'):_0x39e3dc[_0x9df4('0x4f')]=_0x9df4('0x3e')+_0x57ef9e+_0x9df4('0x50')+_0x4cc993+'))';return getZohoUser(_0x39e3dc,_0x9df4('0x51'))[_0x9df4('0x29')](function(_0x23df7f){if(_0x23df7f)return _0x23df7f;if(_0xd2b581[_0x9df4('0x41')]!=_0x9df4('0x52')){return createEndUser(_0x4ac6e9,_0x57ef9e,_0x2b8057,_0x4cc993,_0x302955,_0xd2b581);}else{return{};}});break;}}function getCall(_0x4fabe6,_0x3e4aad,_0x8c5fac,_0x1ad200,_0x50778b,_0x40a80a,_0xad92c7,_0x547fcc){logger[_0x9df4('0x2d')](_0x9df4('0x54'));var _0x115c50={};_0x115c50['Owner']={'name':!_[_0x9df4('0x1b')](_0x1ad200[_0x9df4('0x42')]['name'])&&!_[_0x9df4('0x1b')](_0x1ad200[_0x9df4('0x36')][_0x9df4('0x18')])&&_0x1ad200[_0x9df4('0x36')][_0x9df4('0x18')]===_0x9df4('0x55')?_0x1ad200[_0x9df4('0x42')]['name']:!_['isNil'](_0x1ad200[_0x9df4('0x56')])?_0x1ad200[_0x9df4('0x56')]+'\x20'+_0x1ad200[_0x9df4('0x43')]:_0x1ad200[_0x9df4('0x43')],'id':_0x1ad200['id']};_0x115c50[_0x9df4('0x57')]=intUtil[_0x9df4('0x58')](_0x40a80a[_0x9df4('0x59')],_0xad92c7,'\x20');_0x115c50[_0x9df4('0x5a')]=intUtil['getString'](_0x40a80a[_0x9df4('0x5b')],_0xad92c7,'\x0a');if(_0x50778b[_0x9df4('0x3d')]===_0x9df4('0x4e')){_0x115c50['Who_Id']={'name':!_[_0x9df4('0x1b')](_0x50778b[_0x9df4('0x5c')])?_0x50778b[_0x9df4('0x5c')]:!_[_0x9df4('0x1b')](_0x50778b[_0x9df4('0x5d')])?_0x50778b[_0x9df4('0x5d')]+'\x20'+_0x50778b[_0x9df4('0x5e')]:_0x50778b['Last_Name'],'id':_0x50778b['id']};}if(_0x50778b['enduserType']==='Leads'){_0x115c50[_0x9df4('0x5f')]={'name':!_['isNil'](_0x50778b[_0x9df4('0x5c')])?_0x50778b['Full_Name']:!_[_0x9df4('0x1b')](_0x50778b[_0x9df4('0x5d')])?_0x50778b[_0x9df4('0x5d')]+'\x20'+_0x50778b['Last_Name']:_0x50778b[_0x9df4('0x5e')],'id':_0x50778b['id']};_0x115c50[_0x9df4('0x60')]=_[_0x9df4('0x40')](_0x50778b['enduserType']);}if(_0xad92c7[_0x9df4('0x61')]){_0x115c50[_0x9df4('0x62')]=moment[_0x9df4('0x63')](parseInt(_0xad92c7[_0x9df4('0x61')])*0x3e8)[_0x9df4('0x2e')](_0x9df4('0x64'));}else if(_0xad92c7[_0x9df4('0x65')]&&_0xad92c7[_0x9df4('0x66')]){_0x115c50[_0x9df4('0x62')]=moment[_0x9df4('0x63')](moment(_0xad92c7[_0x9df4('0x66')],_0x9df4('0x67'))[_0x9df4('0x68')](moment(_0xad92c7['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x9df4('0x2e')]('mm:ss');}switch(_0xad92c7[_0x9df4('0x69')]){case'called':_0x115c50[_0x9df4('0x6a')]=_0x9df4('0x6b');break;case _0x9df4('0x6c'):case _0x9df4('0x6d'):_0x115c50[_0x9df4('0x6a')]=_0x9df4('0x6e');break;case'rejected':_0x115c50[_0x9df4('0x6a')]=_0x9df4('0x6f');break;case _0x9df4('0x70'):_0x115c50[_0x9df4('0x6a')]=_0x9df4('0x71');break;case _0x9df4('0x72'):_0x115c50[_0x9df4('0x6a')]=_0x9df4('0x73');default:}_0x115c50[_0x9df4('0x74')]=(_0x547fcc===_0x9df4('0x75')?moment(_0xad92c7[_0x9df4('0x76')])[_0x9df4('0x2e')](_0x9df4('0x67')):moment(_0xad92c7['agentcalledAt'])[_0x9df4('0x2e')](_0x9df4('0x67')))||moment()[_0x9df4('0x2e')](_0x9df4('0x67'));_0x115c50[_0x9df4('0x77')]=_0x547fcc||_0x9df4('0x78');_0x115c50=_[_0x9df4('0x79')](_0x115c50,getCustomFields(_0x40a80a['Fields'],_0xad92c7));return request({'method':_0x9df4('0x23'),'uri':_0x9df4('0x3e')+_0x3e4aad+_0x9df4('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4fabe6},'body':{'data':[_0x115c50]},'json':!![]})[_0x9df4('0x29')](function(_0x3cf90b){if(_0x3cf90b&&_0x3cf90b['data'][0x0]['code']==='SUCCESS'){logger[_0x9df4('0x2d')](_0x9df4('0x7b'));return{'id':_0x3cf90b['data'][0x0][_0x9df4('0x46')]['id']};}})[_0x9df4('0x2b')](function(_0x2231de){logger['info'](_0x9df4('0x7c'),_0x2231de[_0x9df4('0x7d')]);console[_0x9df4('0x48')](_0x9df4('0x7c'),_0x2231de);});}exports[_0x9df4('0x7e')]=function(_0x1868fc,_0x3648ba,_0x3da7b4,_0xc9ea45,_0x3cb491,_0x18e8bb){var _0x17dbb2,_0x5214df,_0x435d7b;_0x18e8bb[_0x9df4('0x7f')]=intUtil[_0x9df4('0x80')](_0x18e8bb[_0x9df4('0x7f')]);_0x18e8bb[_0x9df4('0x81')]=intUtil['stripTrailingSlash'](_0x18e8bb['serverUrl']);if(_0x3cb491&&_0x3cb491['monitor_format']){logger[_0x9df4('0x2d')](_0x9df4('0x82'),_0x9df4('0x83'));_0x3648ba[_0x9df4('0x84')]=_0x18e8bb[_0x9df4('0x81')]+_0x9df4('0x85')+_0x3648ba[_0x9df4('0x86')]+_0x9df4('0x87')+md5(_0x3648ba['uniqueid']);}else{_0x3648ba['recordingURL']='';}var _0x1c8f6a=_0x18e8bb[_0x9df4('0x7f')]===_0x9df4('0x88')?'eu':_0x9df4('0x89');return getAccessToken(_0x18e8bb)['then'](function(_0x2b9fc1){_0x435d7b=_0x2b9fc1;return getUser(_0x435d7b,_0x1c8f6a,_0x18e8bb,_0xc9ea45['email']);})[_0x9df4('0x29')](function(_0x1a8966){_0x17dbb2=_0x1a8966;logger['info'](_0x9df4('0x8a'),_0x17dbb2['id']);return getEndUser(_0x435d7b,_0x1c8f6a,_0x18e8bb,_0x3648ba[_0x9df4('0x8b')],_0x3648ba[_0x9df4('0x8c')],_0x17dbb2,_0x3da7b4);})[_0x9df4('0x29')](function(_0x434f90){_0x5214df=_0x434f90;return getCall(_0x435d7b,_0x1c8f6a,_0x18e8bb,_0x17dbb2,_0x5214df,_0x3da7b4,_0x3648ba,_0x9df4('0x78'));})[_0x9df4('0x29')](function(_0x1d92af){if(_0x1d92af){logger[_0x9df4('0x2d')](_0x9df4('0x8d'),_0x1d92af['id']);logger[_0x9df4('0x2d')](_0x9df4('0x82'),_0x9df4('0x8e'));emit(util[_0x9df4('0x2e')]('user:%s',_0xc9ea45[_0x9df4('0x18')]),'trigger:browser:url',{'uri':'https://crm.'+_0x18e8bb[_0x9df4('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1d92af['id']});}})[_0x9df4('0x2b')](function(_0x16af36){logger[_0x9df4('0x2c')](_0x9df4('0x82'),JSON['stringify'](_0x16af36));});};exports[_0x9df4('0x75')]=function(_0x28ba7e,_0x2d305d,_0x286db6,_0x30d85b,_0x576c56,_0x59b4a6,_0x132fe3){var _0x2c8022,_0x1a1542,_0x3960cc;_0x59b4a6[_0x9df4('0x7f')]=intUtil[_0x9df4('0x80')](_0x59b4a6[_0x9df4('0x7f')]);_0x59b4a6[_0x9df4('0x81')]=intUtil[_0x9df4('0x80')](_0x59b4a6['serverUrl']);if(_0x132fe3&&_0x132fe3[_0x9df4('0x8f')]&&_0x132fe3[_0x9df4('0x8f')]!==_0x9df4('0x90')){logger['info'](_0x9df4('0x91'),_0x9df4('0x83'));_0x2d305d[_0x9df4('0x84')]=_0x59b4a6[_0x9df4('0x81')]+_0x9df4('0x85')+_0x2d305d[_0x9df4('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x2d305d['uniqueid']);}var _0x503176=_0x59b4a6['host']===_0x9df4('0x88')?'eu':_0x9df4('0x89');return getAccessToken(_0x59b4a6)['then'](function(_0x534133){_0x3960cc=_0x534133;return getUser(_0x3960cc,_0x503176,_0x59b4a6,_0x30d85b[_0x9df4('0x33')]);})[_0x9df4('0x29')](function(_0xe740a8){_0x2c8022=_0xe740a8;logger[_0x9df4('0x2d')](_0x9df4('0x8a'),_0x2c8022['id']);return getEndUser(_0x3960cc,_0x503176,_0x59b4a6,_0x2d305d[_0x9df4('0x92')],_0x2d305d[_0x9df4('0x93')],_0x2c8022,_0x286db6);})[_0x9df4('0x29')](function(_0x269693){_0x1a1542=_0x269693;return getCall(_0x3960cc,_0x503176,_0x59b4a6,_0x2c8022,_0x1a1542,_0x286db6,_0x2d305d,'Outbound');})[_0x9df4('0x29')](function(_0x6be2ae){if(_0x6be2ae){logger[_0x9df4('0x2d')](_0x9df4('0x8d'),_0x6be2ae['id']);logger['info'](_0x9df4('0x91'),_0x9df4('0x8e'));emit(util[_0x9df4('0x2e')](_0x9df4('0x94'),_0x30d85b[_0x9df4('0x18')]),_0x9df4('0x95'),{'uri':'https://crm.'+_0x59b4a6[_0x9df4('0x7f')]+_0x9df4('0x96')+_0x6be2ae['id']});}})[_0x9df4('0x2b')](function(_0x12fa99){logger[_0x9df4('0x2c')]('[OUTBOUND]',JSON[_0x9df4('0x3a')](_0x12fa99));});};exports['unmanaged']=function(_0x244369,_0x3e8378,_0x38eeda,_0x395142,_0xd407ac,_0x49625c){var _0x282c21,_0x6e9779,_0x1827df;_0x49625c[_0x9df4('0x7f')]=intUtil[_0x9df4('0x80')](_0x49625c['host']);_0x49625c[_0x9df4('0x81')]=intUtil[_0x9df4('0x80')](_0x49625c[_0x9df4('0x81')]);if(_0xd407ac&&_0xd407ac[_0x9df4('0x97')]){logger[_0x9df4('0x2d')]('['+_0x3e8378['lastevent'][_0x9df4('0x98')]()+']',_0x9df4('0x83'));_0x3e8378[_0x9df4('0x84')]=_0x49625c[_0x9df4('0x81')]+_0x9df4('0x85')+_0x3e8378['uniqueid']+_0x9df4('0x87')+md5(_0x3e8378[_0x9df4('0x86')]);}else{_0x3e8378[_0x9df4('0x84')]='';}var _0x4997c2=_0x49625c[_0x9df4('0x7f')]===_0x9df4('0x88')?'eu':_0x9df4('0x89');return getAccessToken(_0x49625c)[_0x9df4('0x29')](function(_0x1c3100){_0x1827df=_0x1c3100;return getUser(_0x1827df,_0x4997c2,_0x49625c);})[_0x9df4('0x29')](function(_0x458c7a){_0x282c21=_0x458c7a;logger[_0x9df4('0x2d')]('The\x20User\x20ID\x20is:',_0x282c21['id']);return getEndUser(_0x1827df,_0x4997c2,_0x49625c,_0x3e8378[_0x9df4('0x8b')],_0x3e8378[_0x9df4('0x8c')],_0x282c21,_0x38eeda);})[_0x9df4('0x29')](function(_0x3c4fcf){_0x6e9779=_0x3c4fcf;return getCall(_0x1827df,_0x4997c2,_0x49625c,_0x282c21,_0x6e9779,_0x38eeda,_0x3e8378,_0x9df4('0x78'));})[_0x9df4('0x29')](function(_0x7e9d1d){if(_0x7e9d1d){logger[_0x9df4('0x2d')](_0x9df4('0x8d'),_0x7e9d1d['id']);}})[_0x9df4('0x2b')](function(_0x4fe120){logger[_0x9df4('0x2c')]('['+_0x3e8378[_0x9df4('0x69')][_0x9df4('0x98')]()+']',JSON[_0x9df4('0x3a')](_0x4fe120));});}; \ 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 ff6ab50..c24b784 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 _0x9a2e=['Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','exec','data2'];(function(_0x19bef3,_0x4a8a26){var _0x4adf19=function(_0x9f47d5){while(--_0x9f47d5){_0x19bef3['push'](_0x19bef3['shift']());}};_0x4adf19(++_0x4a8a26);}(_0x9a2e,0x97));var _0xe9a2=function(_0x3fd1f1,_0xdf3efe){_0x3fd1f1=_0x3fd1f1-0x0;var _0x367f36=_0x9a2e[_0x3fd1f1];return _0x367f36;};'use strict';var util=require(_0xe9a2('0x0'));var sh=require(_0xe9a2('0x1'));var Mustache=require('mustache');var logger=require(_0xe9a2('0x2'))('trigger');exports[_0xe9a2('0x3')]=function(_0x1506a1,_0x4396e2){var _0x4dc41c=_0x1506a1['data2']?_0x1506a1[_0xe9a2('0x4')]:_0xe9a2('0x5');var _0x44018b=_0x1506a1[_0xe9a2('0x6')]?Mustache['render'](_0x1506a1[_0xe9a2('0x6')],_0x4396e2):_0x4396e2;sh[_0xe9a2('0x3')](_0x44018b,function(_0x1732f3,_0xb7488b,_0x22fa7d){if(_0x1732f3!==0x0){logger[_0xe9a2('0x7')](util['format'](_0xe9a2('0x8'),_0x4dc41c,_0x44018b,_0x1732f3,_0x22fa7d));}else{logger[_0xe9a2('0x9')](util[_0xe9a2('0xa')](_0xe9a2('0xb'),_0x4dc41c,_0x44018b,_0xb7488b));}});}; \ No newline at end of file +var _0x19d9=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','../../../../config/logger','exec','data2','Script'];(function(_0x1a5eb0,_0x1f8fbb){var _0x30f9ba=function(_0x8f1caa){while(--_0x8f1caa){_0x1a5eb0['push'](_0x1a5eb0['shift']());}};_0x30f9ba(++_0x1f8fbb);}(_0x19d9,0x1b3));var _0x919d=function(_0x256a52,_0x4d83cf){_0x256a52=_0x256a52-0x0;var _0x53219a=_0x19d9[_0x256a52];return _0x53219a;};'use strict';var util=require(_0x919d('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x919d('0x1'))('trigger');exports[_0x919d('0x2')]=function(_0x45c8e8,_0x466b29){var _0x21b7c9=_0x45c8e8[_0x919d('0x3')]?_0x45c8e8[_0x919d('0x3')]:_0x919d('0x4');var _0x2dce37=_0x45c8e8['data3']?Mustache[_0x919d('0x5')](_0x45c8e8['data3'],_0x466b29):_0x466b29;sh[_0x919d('0x2')](_0x2dce37,function(_0x581a7e,_0x26e7a2,_0x1a6044){if(_0x581a7e!==0x0){logger[_0x919d('0x6')](util[_0x919d('0x7')](_0x919d('0x8'),_0x21b7c9,_0x2dce37,_0x581a7e,_0x1a6044));}else{logger[_0x919d('0x9')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x21b7c9,_0x2dce37,_0x26e7a2));}});}; \ 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 dc9c1a0..583a9d1 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 _0x980b=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','util','lodash','../../../../config/logger','trigger','render','data2','data5','number','data6','stack','data1','toUpperCase','DELETE','POST','data7','parse','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','then','isNil',',\x20request\x20body:\x20','object','info'];(function(_0x328225,_0x4c139e){var _0x5e42f8=function(_0x3e2f7f){while(--_0x3e2f7f){_0x328225['push'](_0x328225['shift']());}};_0x5e42f8(++_0x4c139e);}(_0x980b,0x17d));var _0xb980=function(_0x3e69df,_0xab9eee){_0x3e69df=_0x3e69df-0x0;var _0x3df919=_0x980b[_0x3e69df];return _0x3df919;};'use strict';var rp=require('request-promise');var util=require(_0xb980('0x0'));var _=require(_0xb980('0x1'));var Mustache=require('mustache');var logger=require(_0xb980('0x2'))(_0xb980('0x3'));exports['exec']=function(_0x47f0e1,_0x364f9b){var _0x4a0538,_0x27944f;var _0x1b20aa={'method':_0x47f0e1['data1']['toUpperCase'](),'uri':Mustache[_0xb980('0x4')](_0x47f0e1[_0xb980('0x5')],_0x364f9b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x47f0e1[_0xb980('0x6')])===_0xb980('0x7')&&parseInt(_0x47f0e1['data5'])>=0x1&&parseInt(_0x47f0e1['data5'])<=0xa?parseInt(_0x47f0e1[_0xb980('0x6')])*0x3e8:0x5*0x3e8};try{_0x1b20aa['headers']=_0x47f0e1['data6']?JSON['parse'](Mustache[_0xb980('0x4')](_0x47f0e1[_0xb980('0x8')],_0x364f9b)):{};}catch(_0x2f1568){logger['error'](_0x2f1568[_0xb980('0x9')]);}switch(_0x47f0e1[_0xb980('0xa')][_0xb980('0xb')]()){case'GET':case _0xb980('0xc'):_0x4a0538=null;_0x1b20aa['qs']=_0x364f9b;break;case _0xb980('0xd'):case'PUT':if(_0x47f0e1[_0xb980('0xe')]){try{_0x4a0538=JSON[_0xb980('0xf')](Mustache[_0xb980('0x4')](_0x47f0e1[_0xb980('0xe')],_0x364f9b));_0x1b20aa[_0xb980('0x10')]=_0x4a0538;}catch(_0x1ddb5e){logger[_0xb980('0x11')](_0x1ddb5e[_0xb980('0x9')]);logger['error'](_0xb980('0x12'));}}else{_0x4a0538=_0x364f9b;_0x1b20aa[_0xb980('0x10')]=_0x4a0538;}break;}logger['info'](util[_0xb980('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x47f0e1[_0xb980('0xa')],_0x47f0e1[_0xb980('0x5')],JSON['stringify'](_0x1b20aa)));rp(_0x1b20aa)[_0xb980('0x14')](function(_0x195bd6){_0x4a0538=!_[_0xb980('0x15')](_0x4a0538)?_0xb980('0x16')+_0x4a0538:'';_0x27944f=typeof _0x195bd6[_0xb980('0x10')]===_0xb980('0x17')?JSON['stringify'](_0x195bd6[_0xb980('0x10')]):_0x195bd6[_0xb980('0x10')];logger[_0xb980('0x18')](util[_0xb980('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x47f0e1[_0xb980('0xa')],_0x47f0e1[_0xb980('0x5')],_0x195bd6['statusCode'],_0x27944f));})[_0xb980('0x19')](function(_0x3ba96b){logger[_0xb980('0x11')](util[_0xb980('0x13')](_0xb980('0x1a'),_0x47f0e1[_0xb980('0xa')],_0x47f0e1['data2'],_0x3ba96b[_0xb980('0x1b')],_0x3ba96b[_0xb980('0x1c')],_0x3ba96b['message']));});}; \ No newline at end of file +var _0xecf0=['trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','render','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash'];(function(_0xdc1ac0,_0x4491a2){var _0xaaa87e=function(_0x35d973){while(--_0x35d973){_0xdc1ac0['push'](_0xdc1ac0['shift']());}};_0xaaa87e(++_0x4491a2);}(_0xecf0,0x85));var _0x0ecf=function(_0x1fe498,_0x745768){_0x1fe498=_0x1fe498-0x0;var _0x3b1342=_0xecf0[_0x1fe498];return _0x3b1342;};'use strict';var rp=require(_0x0ecf('0x0'));var util=require(_0x0ecf('0x1'));var _=require(_0x0ecf('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x0ecf('0x3'));exports[_0x0ecf('0x4')]=function(_0x4b3ac0,_0x3a99a1){var _0x2168e4,_0x2075c7;var _0x36aef5={'method':_0x4b3ac0[_0x0ecf('0x5')][_0x0ecf('0x6')](),'uri':Mustache['render'](_0x4b3ac0[_0x0ecf('0x7')],_0x3a99a1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4b3ac0[_0x0ecf('0x8')])===_0x0ecf('0x9')&&parseInt(_0x4b3ac0[_0x0ecf('0x8')])>=0x1&&parseInt(_0x4b3ac0[_0x0ecf('0x8')])<=0xa?parseInt(_0x4b3ac0[_0x0ecf('0x8')])*0x3e8:0x5*0x3e8};try{_0x36aef5[_0x0ecf('0xa')]=_0x4b3ac0[_0x0ecf('0xb')]?JSON[_0x0ecf('0xc')](Mustache['render'](_0x4b3ac0['data6'],_0x3a99a1)):{};}catch(_0x3ea4d3){logger[_0x0ecf('0xd')](_0x3ea4d3[_0x0ecf('0xe')]);}switch(_0x4b3ac0[_0x0ecf('0x5')][_0x0ecf('0x6')]()){case _0x0ecf('0xf'):case _0x0ecf('0x10'):_0x2168e4=null;_0x36aef5['qs']=_0x3a99a1;break;case _0x0ecf('0x11'):case _0x0ecf('0x12'):if(_0x4b3ac0['data7']){try{_0x2168e4=JSON[_0x0ecf('0xc')](Mustache[_0x0ecf('0x13')](_0x4b3ac0[_0x0ecf('0x14')],_0x3a99a1));_0x36aef5[_0x0ecf('0x15')]=_0x2168e4;}catch(_0xfbcbc){logger[_0x0ecf('0xd')](_0xfbcbc[_0x0ecf('0xe')]);logger[_0x0ecf('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2168e4=_0x3a99a1;_0x36aef5[_0x0ecf('0x15')]=_0x2168e4;}break;}logger[_0x0ecf('0x16')](util['format'](_0x0ecf('0x17'),_0x4b3ac0['data1'],_0x4b3ac0['data2'],JSON[_0x0ecf('0x18')](_0x36aef5)));rp(_0x36aef5)[_0x0ecf('0x19')](function(_0x4dec36){_0x2168e4=!_[_0x0ecf('0x1a')](_0x2168e4)?',\x20request\x20body:\x20'+_0x2168e4:'';_0x2075c7=typeof _0x4dec36[_0x0ecf('0x15')]==='object'?JSON[_0x0ecf('0x18')](_0x4dec36[_0x0ecf('0x15')]):_0x4dec36[_0x0ecf('0x15')];logger[_0x0ecf('0x16')](util[_0x0ecf('0x1b')](_0x0ecf('0x1c'),_0x4b3ac0[_0x0ecf('0x5')],_0x4b3ac0[_0x0ecf('0x7')],_0x4dec36[_0x0ecf('0x1d')],_0x2075c7));})[_0x0ecf('0x1e')](function(_0x2c0254){logger[_0x0ecf('0xd')](util[_0x0ecf('0x1b')](_0x0ecf('0x1f'),_0x4b3ac0[_0x0ecf('0x5')],_0x4b3ac0['data2'],_0x2c0254[_0x0ecf('0x1d')],_0x2c0254[_0x0ecf('0x20')],_0x2c0254[_0x0ecf('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5b19074..693a18c 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 _0xac45=['result','catch','exports','jayson/promise','../../config/logger','routing','client','Request','then','debug','rpc','error','message'];(function(_0x15951f,_0x4019b3){var _0x40a1fa=function(_0x3810e8){while(--_0x3810e8){_0x15951f['push'](_0x15951f['shift']());}};_0x40a1fa(++_0x4019b3);}(_0xac45,0x196));var _0x5ac4=function(_0x2945f1,_0x4a0ffe){_0x2945f1=_0x2945f1-0x0;var _0x4db525=_0xac45[_0x2945f1];return _0x4db525;};'use strict';var jayson=require(_0x5ac4('0x0'));var BPromise=require('bluebird');var logger=require(_0x5ac4('0x1'))(_0x5ac4('0x2'));var client=jayson[_0x5ac4('0x3')]['http']({'port':0x2329});client[_0x5ac4('0x4')]=function(_0x502ded,_0x7bfa68){return new BPromise(function(_0x38fa83,_0x548fae){return client['request'](_0x502ded,_0x7bfa68)[_0x5ac4('0x5')](function(_0x3bb28b){logger[_0x5ac4('0x6')](_0x5ac4('0x7'),'routing',_0x502ded,_0x7bfa68,_0x3bb28b);if(_0x3bb28b[_0x5ac4('0x8')]){logger[_0x5ac4('0x8')](_0x5ac4('0x7'),_0x5ac4('0x2'),_0x502ded,_0x3bb28b[_0x5ac4('0x8')][_0x5ac4('0x9')],_0x7bfa68);return _0x548fae(_0x3bb28b[_0x5ac4('0x8')][_0x5ac4('0x9')]);}else{return _0x38fa83(_0x3bb28b[_0x5ac4('0xa')]);}})[_0x5ac4('0xb')](function(_0x1bbf33){logger[_0x5ac4('0x8')](_0x5ac4('0x7'),_0x5ac4('0x2'),_0x502ded,_0x1bbf33,_0x7bfa68);return _0x548fae(_0x1bbf33);});});};module[_0x5ac4('0xc')]=client; \ No newline at end of file +var _0x8a57=['routing','Request','request','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x8a57,0x1ec));var _0x78a5=function(_0x57f2d5,_0x246d00){_0x57f2d5=_0x57f2d5-0x0;var _0x191130=_0x8a57[_0x57f2d5];return _0x191130;};'use strict';var jayson=require(_0x78a5('0x0'));var BPromise=require(_0x78a5('0x1'));var logger=require(_0x78a5('0x2'))(_0x78a5('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x78a5('0x4')]=function(_0x415a50,_0xa98c72){return new BPromise(function(_0x40e639,_0xb14998){return client[_0x78a5('0x5')](_0x415a50,_0xa98c72)['then'](function(_0x54ec8c){logger['debug'](_0x78a5('0x6'),'routing',_0x415a50,_0xa98c72,_0x54ec8c);if(_0x54ec8c[_0x78a5('0x7')]){logger[_0x78a5('0x7')](_0x78a5('0x6'),_0x78a5('0x3'),_0x415a50,_0x54ec8c[_0x78a5('0x7')]['message'],_0xa98c72);return _0xb14998(_0x54ec8c[_0x78a5('0x7')][_0x78a5('0x8')]);}else{return _0x40e639(_0x54ec8c['result']);}})[_0x78a5('0x9')](function(_0x39bc9e){logger[_0x78a5('0x7')](_0x78a5('0x6'),'routing',_0x415a50,_0x39bc9e,_0xa98c72);return _0xb14998(_0x39bc9e);});});};module[_0x78a5('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index de7da16..5831eae 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 _0x36f5=['getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x36f5,0xf4));var _0x536f=function(_0x1a98b7,_0x1955eb){_0x1a98b7=_0x1a98b7-0x0;var _0x479db7=_0x36f5[_0x1a98b7];return _0x479db7;};'use strict';var server=require(_0x536f('0x0'));var Realtime=require(_0x536f('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x536f('0x2'));var logger=require(_0x536f('0x3'))(_0x536f('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x536f('0x5')]()['then'](mailAccount[_0x536f('0x6')]())['then'](realtime[_0x536f('0x7')]())[_0x536f('0x8')](function(){email[_0x536f('0x9')](realtime[_0x536f('0xa')]);return realtime;});}function main(){return server[_0x536f('0xb')](realtime,email)[_0x536f('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0x536f('0xc')]();})[_0x536f('0x8')](function(_0x437cb7){return setInterval(initRealtime,_0x437cb7[_0x536f('0xd')]*0x3e8);})[_0x536f('0xe')](function(_0x485fcd){logger['error'](_0x536f('0xf'),_0x485fcd);});}main(); \ No newline at end of file +var _0x304d=['./server','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','Email\x20service\x20initialization'];(function(_0x40ecce,_0x4c2ba9){var _0x4a5209=function(_0xe49b34){while(--_0xe49b34){_0x40ecce['push'](_0x40ecce['shift']());}};_0x4a5209(++_0x4c2ba9);}(_0x304d,0x1c7));var _0xd304=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x304d[_0x14add3];return _0x4a174f;};'use strict';var server=require(_0xd304('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xd304('0x1'));var logger=require(_0xd304('0x2'))(_0xd304('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd304('0x4')]()[_0xd304('0x5')](mailAccount[_0xd304('0x6')]())[_0xd304('0x5')](realtime[_0xd304('0x7')]())['then'](function(){email[_0xd304('0x8')](realtime[_0xd304('0x9')]);return realtime;});}function main(){return server[_0xd304('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0xd304('0x5')](function(){return setting[_0xd304('0xb')]();})[_0xd304('0x5')](function(_0x19fe28){return setInterval(initRealtime,_0x19fe28['loginMailFrequency']*0x3e8);})['catch'](function(_0x3bfdb7){logger['error'](_0xd304('0xc'),_0x3bfdb7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d8f4655..10baa7f 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 _0xa26d=['bluebird','md5','../../../config/environment','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','messageStatus','Imap','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','connected','messages','total','from','then','Mail\x20accepted\x20from\x20routing','catch','sendMail','send','verifySmtp','isNil','Smtp','lastSync','verify','verified','exports'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa26d,0x1a8));var _0xda26=function(_0x330d21,_0xcf0226){_0x330d21=_0x330d21-0x0;var _0x4ad989=_0xa26d[_0x330d21];return _0x4ad989;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xda26('0x0'));var md5=require(_0xda26('0x1'));var Redis=require('ioredis');var config=require(_0xda26('0x2'));var logger=require('../../../config/logger')(_0xda26('0x3'));config[_0xda26('0x4')]=_[_0xda26('0x5')](config[_0xda26('0x4')],{'host':_0xda26('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda26('0x4')]));var EmailImap=require(_0xda26('0x7'));var EmailSmtp=require(_0xda26('0x8'));var mailAccount=require(_0xda26('0x9'));var md5Accounts={};function EmailChannel(_0xca2633){logger[_0xda26('0xa')]('start\x20email\x20channel');this[_0xda26('0xb')]=_0xca2633[_0xda26('0xb')];this[_0xda26('0xc')]={};this[_0xda26('0xd')]=new EmailSmtp();}EmailChannel[_0xda26('0xe')][_0xda26('0xf')]=function(_0x15d2d7){var _0x283ff0=this['mailAccounts'][_0x15d2d7];var _0x21bb03={'id':_0x283ff0['id'],'name':_0x283ff0[_0xda26('0x10')],'key':_0x283ff0[_0xda26('0x11')],'active':_0x283ff0[_0xda26('0x12')],'Imap':{'status':_0x283ff0['Imap'][_0xda26('0x13')],'messageStatus':_0x283ff0['Imap'][_0xda26('0x14')],'total':_0x283ff0[_0xda26('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x15d2d7])){md5Accounts[_0x15d2d7]={};}var _0x3663fa=md5(JSON[_0xda26('0x16')](_0x21bb03));if(md5Accounts[_0x15d2d7][_0xda26('0x1')]!==_0x3663fa){md5Accounts[_0x15d2d7][_0xda26('0x1')]=_0x3663fa;io[_0xda26('0xf')](_0xda26('0x17'),_0x21bb03);}};EmailChannel[_0xda26('0xe')][_0xda26('0x18')]=function(_0x386cf1){for(var _0x57ca41 in _0x386cf1){if(_0x386cf1[_0xda26('0x19')](_0x57ca41)){if(_0x386cf1[_0x57ca41][_0xda26('0x15')]&&_0x386cf1[_0x57ca41]['active']){var _0x136049=_0x386cf1[_0x57ca41][_0xda26('0x15')];if(!_0x136049[_0xda26('0x1a')]&&_0x386cf1[_0x57ca41][_0xda26('0x1b')]!==_0xda26('0x1c'))_0x136049[_0xda26('0x1a')]=_0x386cf1[_0x57ca41]['provider'];if(!this[_0xda26('0xc')][_0xda26('0x19')](_0x136049['id'])){this[_0xda26('0xc')][_0x136049['id']]=new EmailImap(_0x136049,_0x386cf1[_0x57ca41][_0xda26('0x3')]);this[_0xda26('0xc')][_0x136049['id']]['on'](_0xda26('0x1d'),this[_0xda26('0x1e')][_0xda26('0x1f')](this,_0x57ca41));this[_0xda26('0xc')][_0x136049['id']]['on'](_0xda26('0x3'),this[_0xda26('0x20')][_0xda26('0x1f')](this,_0x57ca41));this[_0xda26('0xc')][_0x136049['id']]['on']('end',this[_0xda26('0x21')][_0xda26('0x1f')](this,_0x57ca41));this[_0xda26('0xc')][_0x136049['id']]['on'](_0xda26('0x22'),this[_0xda26('0x23')][_0xda26('0x1f')](this,_0x57ca41));}}else{if(_['isNil'](this[_0xda26('0xb')][_0x57ca41][_0xda26('0x15')])){this[_0xda26('0xb')][_0x57ca41]['Imap']={};}this[_0xda26('0xb')][_0x57ca41][_0xda26('0x15')][_0xda26('0x13')]=_0xda26('0x24');this[_0xda26('0xb')][_0x57ca41][_0xda26('0x15')][_0xda26('0x14')]='';this['emit'](_0x57ca41);}}}};EmailChannel[_0xda26('0xe')][_0xda26('0x1e')]=function(_0x1ed360,_0x184e53){if(this[_0xda26('0xb')][_0x1ed360]){this[_0xda26('0xb')][_0x1ed360][_0xda26('0x15')]['status']=_0xda26('0x25');this[_0xda26('0xb')][_0x1ed360][_0xda26('0x15')][_0xda26('0x14')]=_0x184e53[_0xda26('0x10')];if(_0x184e53[_0xda26('0x26')]){this[_0xda26('0xb')][_0x1ed360][_0xda26('0x15')][_0xda26('0x27')]=_0x184e53['messages'][_0xda26('0x27')];}return this['emit'](_0x1ed360);}};EmailChannel[_0xda26('0xe')]['handleImapEmail']=function(_0x356bcd,_0x5475fe){logger[_0xda26('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5475fe['firstName'],_0x5475fe['lastName'],_0x5475fe[_0xda26('0x28')],_0x356bcd);if(this[_0xda26('0xb')][_0x356bcd]){return mailAccount['notify'](_0x356bcd,_0x5475fe)[_0xda26('0x29')](function(_0x3ef7cf){if(_0x3ef7cf){logger[_0xda26('0xa')](_0xda26('0x2a'));}})[_0xda26('0x2b')](function(_0xe8eab5){logger[_0xda26('0x22')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xda26('0x16')](_0xe8eab5));});}};EmailChannel[_0xda26('0xe')][_0xda26('0x21')]=function(_0x5d57ea){if(this[_0xda26('0xb')][_0x5d57ea]&&this[_0xda26('0xb')][_0x5d57ea]['Imap']){if(this['imapAccounts'][this['mailAccounts'][_0x5d57ea]['Imap']['id']]){delete this[_0xda26('0xc')][this[_0xda26('0xb')][_0x5d57ea][_0xda26('0x15')]['id']];}this[_0xda26('0xb')][_0x5d57ea][_0xda26('0x15')]['lastSync']=moment();this[_0xda26('0xf')](_0x5d57ea);}};EmailChannel[_0xda26('0xe')][_0xda26('0x23')]=function(_0x5aae68,_0x1b065f){if(this[_0xda26('0xb')][_0x5aae68]){this[_0xda26('0xb')][_0x5aae68]['Imap'][_0xda26('0x13')]=_0xda26('0x22');this[_0xda26('0xb')][_0x5aae68]['Imap']['messageStatus']=_0x1b065f;return this['emit'](_0x5aae68);}};EmailChannel[_0xda26('0xe')][_0xda26('0x2c')]=function(_0x27c84,_0x2382d8){return this['smtp'][_0xda26('0x2d')](_0x27c84,_0x2382d8);};EmailChannel[_0xda26('0xe')][_0xda26('0x2e')]=function(_0x29ab97){var _0x6d6a0e=this;if(this['mailAccounts'][_0x29ab97['id']]){if(_[_0xda26('0x2f')](this[_0xda26('0xb')][_0x29ab97['id']][_0xda26('0x30')])){this[_0xda26('0xb')][_0x29ab97['id']][_0xda26('0x30')]={};}this['mailAccounts'][_0x29ab97['id']][_0xda26('0x30')][_0xda26('0x31')]=moment();return new BPromise(function(_0x2e3157,_0x563bcf){return _0x6d6a0e[_0xda26('0xd')][_0xda26('0x32')](_0x29ab97)[_0xda26('0x29')](function(_0x4d796c){_0x6d6a0e['mailAccounts'][_0x29ab97['id']][_0xda26('0x30')][_0xda26('0x13')]=_0xda26('0x33');_0x6d6a0e[_0xda26('0xb')][_0x29ab97['id']][_0xda26('0x30')][_0xda26('0x14')]='';_0x6d6a0e[_0xda26('0xf')](_0x29ab97['id']);_0x2e3157(_0x4d796c);})[_0xda26('0x2b')](function(_0x1b9f5b){_0x6d6a0e['mailAccounts'][_0x29ab97['id']]['Smtp']['status']=_0xda26('0x22');_0x6d6a0e[_0xda26('0xb')][_0x29ab97['id']][_0xda26('0x30')]['messageStatus']=_0x1b9f5b;_0x6d6a0e[_0xda26('0xf')](_0x29ab97['id']);_0x563bcf(_0x1b9f5b);});});}return this[_0xda26('0xd')][_0xda26('0x32')](_0x29ab97);};module[_0xda26('0x34')]=EmailChannel; \ No newline at end of file +var _0x4239=['box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','verifySmtp','Smtp','then','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x4239,0x1d0));var _0x9423=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x4239[_0x272638];return _0x19d027;};'use strict';var _=require(_0x9423('0x0'));var moment=require(_0x9423('0x1'));var BPromise=require(_0x9423('0x2'));var md5=require(_0x9423('0x3'));var Redis=require(_0x9423('0x4'));var config=require(_0x9423('0x5'));var logger=require('../../../config/logger')(_0x9423('0x6'));config['redis']=_['defaults'](config[_0x9423('0x7')],{'host':_0x9423('0x8'),'port':0x18eb});var io=require(_0x9423('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x9423('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x21ec96){logger[_0x9423('0xb')]('start\x20email\x20channel');this[_0x9423('0xc')]=_0x21ec96[_0x9423('0xc')];this[_0x9423('0xd')]={};this[_0x9423('0xe')]=new EmailSmtp();}EmailChannel[_0x9423('0xf')][_0x9423('0x10')]=function(_0x1955fb){var _0x308c7b=this[_0x9423('0xc')][_0x1955fb];var _0x360fd0={'id':_0x308c7b['id'],'name':_0x308c7b[_0x9423('0x11')],'key':_0x308c7b['key'],'active':_0x308c7b[_0x9423('0x12')],'Imap':{'status':_0x308c7b[_0x9423('0x13')][_0x9423('0x14')],'messageStatus':_0x308c7b[_0x9423('0x13')][_0x9423('0x15')],'total':_0x308c7b[_0x9423('0x13')][_0x9423('0x16')]}};if(_[_0x9423('0x17')](md5Accounts[_0x1955fb])){md5Accounts[_0x1955fb]={};}var _0x452bc7=md5(JSON[_0x9423('0x18')](_0x360fd0));if(md5Accounts[_0x1955fb][_0x9423('0x3')]!==_0x452bc7){md5Accounts[_0x1955fb][_0x9423('0x3')]=_0x452bc7;io[_0x9423('0x10')](_0x9423('0x19'),_0x360fd0);}};EmailChannel['prototype'][_0x9423('0x1a')]=function(_0x5ca653){for(var _0x112e28 in _0x5ca653){if(_0x5ca653[_0x9423('0x1b')](_0x112e28)){if(_0x5ca653[_0x112e28][_0x9423('0x13')]&&_0x5ca653[_0x112e28]['active']){var _0x529ce4=_0x5ca653[_0x112e28][_0x9423('0x13')];if(!_0x529ce4[_0x9423('0x1c')]&&_0x5ca653[_0x112e28][_0x9423('0x1d')]!==_0x9423('0x1e'))_0x529ce4[_0x9423('0x1c')]=_0x5ca653[_0x112e28][_0x9423('0x1d')];if(!this[_0x9423('0xd')][_0x9423('0x1b')](_0x529ce4['id'])){this[_0x9423('0xd')][_0x529ce4['id']]=new EmailImap(_0x529ce4,_0x5ca653[_0x112e28][_0x9423('0x6')]);this['imapAccounts'][_0x529ce4['id']]['on'](_0x9423('0x1f'),this[_0x9423('0x20')][_0x9423('0x21')](this,_0x112e28));this['imapAccounts'][_0x529ce4['id']]['on'](_0x9423('0x6'),this[_0x9423('0x22')][_0x9423('0x21')](this,_0x112e28));this[_0x9423('0xd')][_0x529ce4['id']]['on'](_0x9423('0x23'),this[_0x9423('0x24')][_0x9423('0x21')](this,_0x112e28));this[_0x9423('0xd')][_0x529ce4['id']]['on'](_0x9423('0x25'),this['handleImapError'][_0x9423('0x21')](this,_0x112e28));}}else{if(_[_0x9423('0x17')](this[_0x9423('0xc')][_0x112e28][_0x9423('0x13')])){this[_0x9423('0xc')][_0x112e28][_0x9423('0x13')]={};}this['mailAccounts'][_0x112e28]['Imap'][_0x9423('0x14')]='disabled';this[_0x9423('0xc')][_0x112e28][_0x9423('0x13')][_0x9423('0x15')]='';this[_0x9423('0x10')](_0x112e28);}}}};EmailChannel[_0x9423('0xf')][_0x9423('0x20')]=function(_0x203d98,_0x1e89b6){if(this[_0x9423('0xc')][_0x203d98]){this[_0x9423('0xc')][_0x203d98]['Imap'][_0x9423('0x14')]=_0x9423('0x26');this[_0x9423('0xc')][_0x203d98]['Imap'][_0x9423('0x15')]=_0x1e89b6['name'];if(_0x1e89b6['messages']){this[_0x9423('0xc')][_0x203d98]['Imap'][_0x9423('0x16')]=_0x1e89b6[_0x9423('0x27')][_0x9423('0x16')];}return this[_0x9423('0x10')](_0x203d98);}};EmailChannel['prototype']['handleImapEmail']=function(_0x1c327b,_0xd7d129){logger[_0x9423('0xb')](_0x9423('0x28'),_0xd7d129[_0x9423('0x29')],_0xd7d129[_0x9423('0x2a')],_0xd7d129['from'],_0x1c327b);if(this['mailAccounts'][_0x1c327b]){return mailAccount[_0x9423('0x2b')](_0x1c327b,_0xd7d129)['then'](function(_0x55005f){if(_0x55005f){logger['info'](_0x9423('0x2c'));}})[_0x9423('0x2d')](function(_0x441e11){logger[_0x9423('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9423('0x18')](_0x441e11));});}};EmailChannel['prototype'][_0x9423('0x24')]=function(_0x35127b){if(this['mailAccounts'][_0x35127b]&&this['mailAccounts'][_0x35127b][_0x9423('0x13')]){if(this[_0x9423('0xd')][this[_0x9423('0xc')][_0x35127b][_0x9423('0x13')]['id']]){delete this[_0x9423('0xd')][this[_0x9423('0xc')][_0x35127b][_0x9423('0x13')]['id']];}this[_0x9423('0xc')][_0x35127b][_0x9423('0x13')][_0x9423('0x2e')]=moment();this[_0x9423('0x10')](_0x35127b);}};EmailChannel[_0x9423('0xf')][_0x9423('0x2f')]=function(_0x2b9c5a,_0x32dfcf){if(this[_0x9423('0xc')][_0x2b9c5a]){this['mailAccounts'][_0x2b9c5a][_0x9423('0x13')][_0x9423('0x14')]=_0x9423('0x25');this['mailAccounts'][_0x2b9c5a]['Imap'][_0x9423('0x15')]=_0x32dfcf;return this[_0x9423('0x10')](_0x2b9c5a);}};EmailChannel[_0x9423('0xf')][_0x9423('0x30')]=function(_0xb2cd64,_0x57daf7){return this[_0x9423('0xe')]['send'](_0xb2cd64,_0x57daf7);};EmailChannel['prototype'][_0x9423('0x31')]=function(_0x424979){var _0x3fbd63=this;if(this[_0x9423('0xc')][_0x424979['id']]){if(_[_0x9423('0x17')](this[_0x9423('0xc')][_0x424979['id']][_0x9423('0x32')])){this[_0x9423('0xc')][_0x424979['id']][_0x9423('0x32')]={};}this['mailAccounts'][_0x424979['id']][_0x9423('0x32')][_0x9423('0x2e')]=moment();return new BPromise(function(_0x58c727,_0x44f324){return _0x3fbd63['smtp']['verify'](_0x424979)[_0x9423('0x33')](function(_0x4564c0){_0x3fbd63['mailAccounts'][_0x424979['id']][_0x9423('0x32')][_0x9423('0x14')]=_0x9423('0x34');_0x3fbd63[_0x9423('0xc')][_0x424979['id']]['Smtp'][_0x9423('0x15')]='';_0x3fbd63[_0x9423('0x10')](_0x424979['id']);_0x58c727(_0x4564c0);})[_0x9423('0x2d')](function(_0x4e118c){_0x3fbd63[_0x9423('0xc')][_0x424979['id']][_0x9423('0x32')][_0x9423('0x14')]=_0x9423('0x25');_0x3fbd63['mailAccounts'][_0x424979['id']][_0x9423('0x32')]['messageStatus']=_0x4e118c;_0x3fbd63['emit'](_0x424979['id']);_0x44f324(_0x4e118c);});});}return this[_0x9423('0xe')][_0x9423('0x35')](_0x424979);};module[_0x9423('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4f14bc3..4642e56 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 _0xcbc7=['handleSimpleParser','parser','handleFetchError','stringify','textCode','lodash','util','imap','iconv','Iconv','EventEmitter','./utils','../../../config/logger','mailbox','account','once','bind','handleEnd','error','handleError','connect','prototype','getAccount','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','handleReady','openBox','handleOpenBox','emit','box','handleCloseBox','end','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd'];(function(_0x391699,_0x34c62e){var _0x2cc4b7=function(_0xb14297){while(--_0xb14297){_0x391699['push'](_0x391699['shift']());}};_0x2cc4b7(++_0x34c62e);}(_0xcbc7,0xf1));var _0x7cbc=function(_0x2ac756,_0x33408b){_0x2ac756=_0x2ac756-0x0;var _0xa621fb=_0xcbc7[_0x2ac756];return _0xa621fb;};'use strict';var _=require(_0x7cbc('0x0'));var util=require(_0x7cbc('0x1'));var Imap=require(_0x7cbc('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x7cbc('0x3'))[_0x7cbc('0x4')];var EventEmitter=require('events')[_0x7cbc('0x5')];var utils=require(_0x7cbc('0x6'));var logger=require(_0x7cbc('0x7'))('email');function EmailImap(_0x1a05fa,_0x5a4f86){this['mailbox']=_0x1a05fa[_0x7cbc('0x8')];this[_0x7cbc('0x9')]=this['getAccount'](_0x1a05fa,_0x5a4f86);this[_0x7cbc('0x2')]=new Imap(this[_0x7cbc('0x9')]);this[_0x7cbc('0x2')][_0x7cbc('0xa')]('ready',this['handleReady'][_0x7cbc('0xb')](this));this[_0x7cbc('0x2')][_0x7cbc('0xa')]('end',this[_0x7cbc('0xc')]['bind'](this));this[_0x7cbc('0x2')]['on'](_0x7cbc('0xd'),this[_0x7cbc('0xe')][_0x7cbc('0xb')](this));this[_0x7cbc('0x2')][_0x7cbc('0xf')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x7cbc('0x10')][_0x7cbc('0x11')]=function(_0xf84b31,_0x181138){var _0x48156c={'connTimeout':_0xf84b31['connTimeout']?_0xf84b31['connTimeout']*0x3e8:0x2710,'authTimeout':_0xf84b31[_0x7cbc('0x12')]?_0xf84b31[_0x7cbc('0x12')]*0x3e8:0x1388};if(_0xf84b31[_0x7cbc('0x13')]){_0x48156c[_0x7cbc('0x14')]=_0xf84b31[_0x7cbc('0x14')];if(_0xf84b31[_0x7cbc('0x15')]){_0x48156c[_0x7cbc('0x16')]=utils[_0x7cbc('0x17')](_0xf84b31[_0x7cbc('0x18')][_0x7cbc('0x19')],_0xf84b31[_0x7cbc('0x14')]);}else{_0x48156c['password']=_0xf84b31[_0x7cbc('0x1a')];}}else{if(_0xf84b31[_0x7cbc('0x1b')]){_0x48156c[_0x7cbc('0x14')]=_0xf84b31[_0x7cbc('0x14')];_0x48156c[_0x7cbc('0x1a')]=_0xf84b31[_0x7cbc('0x1a')];}}_0x48156c[_0x7cbc('0x1c')]=_0x181138||_0xf84b31[_0x7cbc('0x14')]||_0x7cbc('0x1d');_0x48156c['host']=_0xf84b31[_0x7cbc('0x1e')];_0x48156c[_0x7cbc('0x1f')]=_0xf84b31[_0x7cbc('0x1f')]||0x3e1;if(_0xf84b31[_0x7cbc('0x20')]){_0x48156c[_0x7cbc('0x20')]=!![];}else{_0x48156c[_0x7cbc('0x20')]=![];_0x48156c[_0x7cbc('0x21')]='required';}return _0x48156c;};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x22')]=function(){this['imap'][_0x7cbc('0x23')](this['mailbox'],![],this[_0x7cbc('0x24')]['bind'](this));};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x24')]=function(_0x24a957,_0x42797c){if(_0x24a957){this[_0x7cbc('0xe')](_0x24a957,!![]);}else{this[_0x7cbc('0x25')](_0x7cbc('0x26'),_0x42797c);this['readUnseen']();}};EmailImap['prototype'][_0x7cbc('0x27')]=function(_0x2d2ea8){if(_0x2d2ea8){this[_0x7cbc('0xe')](_0x2d2ea8,!![]);}else{this[_0x7cbc('0x2')][_0x7cbc('0x28')]();}};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x29')]=function(){this[_0x7cbc('0x2')][_0x7cbc('0x2a')](['UNSEEN'],this[_0x7cbc('0x2b')][_0x7cbc('0xb')](this));};EmailImap[_0x7cbc('0x10')]['handleReadUnseen']=function(_0x3722f2,_0x2f2d32){if(_0x3722f2){this[_0x7cbc('0xe')](_0x3722f2,!![]);}else{if(_0x2f2d32['length']){try{var _0x98e518=this[_0x7cbc('0x2')][_0x7cbc('0x2c')](_0x2f2d32,{'bodies':'','markSeen':!![]});_0x98e518['on'](_0x7cbc('0x2d'),this[_0x7cbc('0x2e')]['bind'](this));_0x98e518[_0x7cbc('0xa')](_0x7cbc('0xd'),this['handleFetchError'][_0x7cbc('0xb')](this));_0x98e518[_0x7cbc('0xa')]('end',this[_0x7cbc('0x2f')][_0x7cbc('0xb')](this));}catch(_0x224d04){logger['error'](_0x224d04);}}else{this[_0x7cbc('0x2')][_0x7cbc('0x30')](!![],this[_0x7cbc('0x27')][_0x7cbc('0xb')](this));}}};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x2e')]=function(_0x202416){_0x202416['on'](_0x7cbc('0x31'),this[_0x7cbc('0x32')][_0x7cbc('0xb')](this));_0x202416['once'](_0x7cbc('0x33'),this[_0x7cbc('0x34')][_0x7cbc('0xb')](this));_0x202416[_0x7cbc('0xa')](_0x7cbc('0x28'),this[_0x7cbc('0x35')][_0x7cbc('0xb')](this));};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x32')]=function(_0x3a3e5d){simpleParser(_0x3a3e5d,{'Iconv':Iconv},this[_0x7cbc('0x36')][_0x7cbc('0xb')](this));};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x34')]=function(){};EmailImap['prototype'][_0x7cbc('0x35')]=function(){};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x36')]=function(_0x3dc80e,_0x3ed344){if(_0x3dc80e){logger[_0x7cbc('0xd')](_0x3dc80e);}else{var _0x300721=this;utils[_0x7cbc('0x37')](this['account'],_0x3ed344,function(_0xdb0149){_0x300721[_0x7cbc('0x25')](_0x7cbc('0x1c'),_0xdb0149);});}};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x2f')]=function(){this[_0x7cbc('0x2')][_0x7cbc('0x30')](!![],this[_0x7cbc('0x27')][_0x7cbc('0xb')](this));};EmailImap[_0x7cbc('0x10')][_0x7cbc('0x38')]=function(_0xf8ccfd){this[_0x7cbc('0xe')](_0xf8ccfd);this[_0x7cbc('0x2')][_0x7cbc('0x30')](!![],this[_0x7cbc('0x27')][_0x7cbc('0xb')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0x7cbc('0x28'));};EmailImap[_0x7cbc('0x10')][_0x7cbc('0xe')]=function(_0x4b4279,_0x2374ad){logger[_0x7cbc('0xd')]('handleError',this['account'][_0x7cbc('0x1c')],JSON[_0x7cbc('0x39')](_0x4b4279));var _0x141894='';if(_0x4b4279){if(_0x4b4279[_0x7cbc('0x3a')]){_0x141894=_0x4b4279['textCode'];}else{for(var _0x4daf5 in _0x4b4279){if(_0x4b4279['hasOwnProperty'](_0x4daf5)){_0x141894+=_['upperFirst'](_0x4daf5)+':\x20'+_0x4b4279[_0x4daf5]+'\x0a';}}}}if(_0x2374ad){this['imap'][_0x7cbc('0x28')]();}else{this[_0x7cbc('0x25')](_0x7cbc('0xd'),_0x141894);this[_0x7cbc('0x25')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x928d=['inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','util','imap','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','ready','handleReady','once','handleEnd','bind','error','connect'];(function(_0x397cb7,_0x1ef9bf){var _0x2a9927=function(_0x56abc8){while(--_0x56abc8){_0x397cb7['push'](_0x397cb7['shift']());}};_0x2a9927(++_0x1ef9bf);}(_0x928d,0x1de));var _0xd928=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x928d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xd928('0x0'));var Imap=require(_0xd928('0x1'));var simpleParser=require(_0xd928('0x2'))['simpleParser'];var Iconv=require(_0xd928('0x3'))[_0xd928('0x4')];var EventEmitter=require(_0xd928('0x5'))[_0xd928('0x6')];var utils=require('./utils');var logger=require(_0xd928('0x7'))(_0xd928('0x8'));function EmailImap(_0x31dd3b,_0x113db1){this[_0xd928('0x9')]=_0x31dd3b[_0xd928('0x9')];this[_0xd928('0xa')]=this['getAccount'](_0x31dd3b,_0x113db1);this[_0xd928('0x1')]=new Imap(this[_0xd928('0xa')]);this[_0xd928('0x1')]['once'](_0xd928('0xb'),this[_0xd928('0xc')]['bind'](this));this[_0xd928('0x1')][_0xd928('0xd')]('end',this[_0xd928('0xe')][_0xd928('0xf')](this));this[_0xd928('0x1')]['on'](_0xd928('0x10'),this['handleError'][_0xd928('0xf')](this));this[_0xd928('0x1')][_0xd928('0x11')]();}util[_0xd928('0x12')](EmailImap,EventEmitter);EmailImap[_0xd928('0x13')][_0xd928('0x14')]=function(_0x32a4f5,_0xacc3a8){var _0x7b4ed5={'connTimeout':_0x32a4f5['connTimeout']?_0x32a4f5[_0xd928('0x15')]*0x3e8:0x2710,'authTimeout':_0x32a4f5[_0xd928('0x16')]?_0x32a4f5[_0xd928('0x16')]*0x3e8:0x1388};if(_0x32a4f5['service']){_0x7b4ed5[_0xd928('0x17')]=_0x32a4f5[_0xd928('0x17')];if(_0x32a4f5[_0xd928('0x18')]){_0x7b4ed5['xoauth2']=utils[_0xd928('0x19')](_0x32a4f5[_0xd928('0x1a')][_0xd928('0x1b')],_0x32a4f5[_0xd928('0x17')]);}else{_0x7b4ed5[_0xd928('0x1c')]=_0x32a4f5[_0xd928('0x1c')];}}else{if(_0x32a4f5['authentication']){_0x7b4ed5[_0xd928('0x17')]=_0x32a4f5[_0xd928('0x17')];_0x7b4ed5[_0xd928('0x1c')]=_0x32a4f5[_0xd928('0x1c')];}}_0x7b4ed5[_0xd928('0x8')]=_0xacc3a8||_0x32a4f5[_0xd928('0x17')]||_0xd928('0x1d');_0x7b4ed5[_0xd928('0x1e')]=_0x32a4f5[_0xd928('0x1e')];_0x7b4ed5[_0xd928('0x1f')]=_0x32a4f5['port']||0x3e1;if(_0x32a4f5['tls']){_0x7b4ed5['tls']=!![];}else{_0x7b4ed5[_0xd928('0x20')]=![];_0x7b4ed5[_0xd928('0x21')]=_0xd928('0x22');}return _0x7b4ed5;};EmailImap[_0xd928('0x13')][_0xd928('0xc')]=function(){this[_0xd928('0x1')][_0xd928('0x23')](this[_0xd928('0x9')],![],this[_0xd928('0x24')]['bind'](this));};EmailImap[_0xd928('0x13')][_0xd928('0x24')]=function(_0x37732c,_0x180454){if(_0x37732c){this[_0xd928('0x25')](_0x37732c,!![]);}else{this[_0xd928('0x26')](_0xd928('0x27'),_0x180454);this[_0xd928('0x28')]();}};EmailImap['prototype'][_0xd928('0x29')]=function(_0xba963f){if(_0xba963f){this['handleError'](_0xba963f,!![]);}else{this[_0xd928('0x1')][_0xd928('0x2a')]();}};EmailImap[_0xd928('0x13')][_0xd928('0x28')]=function(){this[_0xd928('0x1')][_0xd928('0x2b')](['UNSEEN'],this['handleReadUnseen'][_0xd928('0xf')](this));};EmailImap[_0xd928('0x13')][_0xd928('0x2c')]=function(_0x2f57d1,_0x76276c){if(_0x2f57d1){this[_0xd928('0x25')](_0x2f57d1,!![]);}else{if(_0x76276c[_0xd928('0x2d')]){try{var _0x4cee95=this[_0xd928('0x1')][_0xd928('0x2e')](_0x76276c,{'bodies':'','markSeen':!![]});_0x4cee95['on']('message',this[_0xd928('0x2f')][_0xd928('0xf')](this));_0x4cee95[_0xd928('0xd')](_0xd928('0x10'),this[_0xd928('0x30')][_0xd928('0xf')](this));_0x4cee95['once'](_0xd928('0x2a'),this['handleFetchEnd'][_0xd928('0xf')](this));}catch(_0x4e0969){logger[_0xd928('0x10')](_0x4e0969);}}else{this[_0xd928('0x1')][_0xd928('0x31')](!![],this[_0xd928('0x29')]['bind'](this));}}};EmailImap[_0xd928('0x13')][_0xd928('0x2f')]=function(_0x28511a){_0x28511a['on'](_0xd928('0x32'),this[_0xd928('0x33')][_0xd928('0xf')](this));_0x28511a[_0xd928('0xd')](_0xd928('0x34'),this[_0xd928('0x35')]['bind'](this));_0x28511a[_0xd928('0xd')](_0xd928('0x2a'),this[_0xd928('0x36')]['bind'](this));};EmailImap[_0xd928('0x13')][_0xd928('0x33')]=function(_0x36cfeb){simpleParser(_0x36cfeb,{'Iconv':Iconv},this[_0xd928('0x37')][_0xd928('0xf')](this));};EmailImap[_0xd928('0x13')][_0xd928('0x35')]=function(){};EmailImap[_0xd928('0x13')][_0xd928('0x36')]=function(){};EmailImap[_0xd928('0x13')][_0xd928('0x37')]=function(_0x3cd3f1,_0x49514e){if(_0x3cd3f1){logger['error'](_0x3cd3f1);}else{var _0x9a61ba=this;utils[_0xd928('0x38')](this[_0xd928('0xa')],_0x49514e,function(_0x606ceb){_0x9a61ba[_0xd928('0x26')]('email',_0x606ceb);});}};EmailImap[_0xd928('0x13')][_0xd928('0x39')]=function(){this[_0xd928('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xd928('0xf')](this));};EmailImap['prototype'][_0xd928('0x30')]=function(_0x436944){this['handleError'](_0x436944);this[_0xd928('0x1')]['closeBox'](!![],this[_0xd928('0x29')]['bind'](this));};EmailImap[_0xd928('0x13')][_0xd928('0xe')]=function(){this['emit']('end');};EmailImap[_0xd928('0x13')][_0xd928('0x25')]=function(_0x1b8b7d,_0x14e9d6){logger[_0xd928('0x10')](_0xd928('0x25'),this[_0xd928('0xa')][_0xd928('0x8')],JSON[_0xd928('0x3a')](_0x1b8b7d));var _0x45430c='';if(_0x1b8b7d){if(_0x1b8b7d[_0xd928('0x3b')]){_0x45430c=_0x1b8b7d[_0xd928('0x3b')];}else{for(var _0x5de10a in _0x1b8b7d){if(_0x1b8b7d[_0xd928('0x3c')](_0x5de10a)){_0x45430c+=_[_0xd928('0x3d')](_0x5de10a)+':\x20'+_0x1b8b7d[_0x5de10a]+'\x0a';}}}}if(_0x14e9d6){this[_0xd928('0x1')]['end']();}else{this['emit'](_0xd928('0x10'),_0x45430c);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 216a200..4f1e1a6 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe75e=['nodemailer','send','use','sendMail','prototype','verify','createTransport','toString','Not\x20verifired','exports'];(function(_0x392d20,_0x3808ea){var _0xde6ade=function(_0x1dad45){while(--_0x1dad45){_0x392d20['push'](_0x392d20['shift']());}};_0xde6ade(++_0x3808ea);}(_0xe75e,0x1a4));var _0xee75=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0xe75e[_0x3db122];return _0x325b67;};'use strict';var nodemailer=require(_0xee75('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xee75('0x1')]=function(_0x31842f,_0x322b5c){return new Promise(function(_0xbc5ac1,_0x218504){var _0x2b6db9=nodemailer['createTransport'](_0x31842f);_0x2b6db9[_0xee75('0x2')]('compile',inlineBase64());_0x2b6db9[_0xee75('0x3')](_0x322b5c,function(_0x1d35e5,_0x1e5422){if(_0x1d35e5){_0x218504(_0x1d35e5['toString']());}else{_0xbc5ac1(_0x1e5422);}});});};EmailSmtp[_0xee75('0x4')][_0xee75('0x5')]=function(_0x7763a4){return new Promise(function(_0x4766fa,_0x51d8a1){var _0x514258=nodemailer[_0xee75('0x6')](_0x7763a4);_0x514258[_0xee75('0x5')](function(_0x184fab,_0x537cdc){if(_0x184fab){_0x51d8a1(_0x184fab[_0xee75('0x7')]());}else{if(_0x537cdc){_0x4766fa(_0x537cdc);}else{_0x51d8a1(_0xee75('0x8'));}}});});};module[_0xee75('0x9')]=EmailSmtp; \ No newline at end of file +var _0x6a57=['send','createTransport','compile','sendMail','toString','verify','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x434176,_0xf36fa1){var _0x34d45d=function(_0x35d76f){while(--_0x35d76f){_0x434176['push'](_0x434176['shift']());}};_0x34d45d(++_0xf36fa1);}(_0x6a57,0x126));var _0x76a5=function(_0x1c9f8c,_0x39c5e3){_0x1c9f8c=_0x1c9f8c-0x0;var _0x5bcb6e=_0x6a57[_0x1c9f8c];return _0x5bcb6e;};'use strict';var nodemailer=require(_0x76a5('0x0'));var inlineBase64=require(_0x76a5('0x1'));function EmailSmtp(){}EmailSmtp[_0x76a5('0x2')][_0x76a5('0x3')]=function(_0x55b12e,_0x4a4ba8){return new Promise(function(_0xc22a51,_0x2ca4f8){var _0x5dcfec=nodemailer[_0x76a5('0x4')](_0x55b12e);_0x5dcfec['use'](_0x76a5('0x5'),inlineBase64());_0x5dcfec[_0x76a5('0x6')](_0x4a4ba8,function(_0x478749,_0x57ec0f){if(_0x478749){_0x2ca4f8(_0x478749[_0x76a5('0x7')]());}else{_0xc22a51(_0x57ec0f);}});});};EmailSmtp[_0x76a5('0x2')][_0x76a5('0x8')]=function(_0x1bdeb5){return new Promise(function(_0x37c8cf,_0x5b45f4){var _0x26a4cc=nodemailer[_0x76a5('0x4')](_0x1bdeb5);_0x26a4cc[_0x76a5('0x8')](function(_0x5e9f8b,_0x10f726){if(_0x5e9f8b){_0x5b45f4(_0x5e9f8b['toString']());}else{if(_0x10f726){_0x37c8cf(_0x10f726);}else{_0x5b45f4('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d077c80..114860a 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8222=['line','isAutoreply','parser','from','messageId','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','utf-8','toString','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','join','length','pop','isEmpty','generate','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x27041c['slice'](0x0,-0x1)[_0x2822('0x11')]('\x20'):_0x42e989['name'];}return'Anonymous';}function getLastName(_0x3bd9bf){var _0x178755=_[_0x2822('0x8')](_0x3bd9bf[_0x2822('0x9')]);if(_0x178755&&_0x178755[_0x2822('0xd')]){var _0x873b66=_0x178755[_0x2822('0xd')][_0x2822('0x10')](/\s+/);return _0x873b66[_0x2822('0x12')]>0x1?_0x873b66[_0x2822('0x13')]():'';}return'';}function getMails(_0x401360,_0x5ca071){var _0x2ea73d='';for(var _0x1228e3=0x0;_0x1228e3<_0x5ca071[_0x2822('0x9')]['length'];_0x1228e3+=0x1){if(_0x5ca071[_0x2822('0x9')][_0x1228e3]['address']!==_0x401360){if(!_[_0x2822('0x14')](_0x2ea73d)){_0x2ea73d+=',';}_0x2ea73d+=_0x5ca071[_0x2822('0x9')][_0x1228e3][_0x2822('0xd')]||_0x5ca071[_0x2822('0x9')][_0x1228e3][_0x2822('0xa')]||'';_0x2ea73d+='\x20<';_0x2ea73d+=_0x5ca071['value'][_0x1228e3][_0x2822('0xa')]?_0x5ca071[_0x2822('0x9')][_0x1228e3][_0x2822('0xa')]:_0x2822('0xb')+random[_0x2822('0x15')](0x6)+_0x2822('0xc');_0x2ea73d+='>';}}return _0x2ea73d;}function parseEmail(_0x19fa14,_0x36249f,_0x586554){if(_0x36249f['html']){var _0x3bba3b=/)<[^<]*)*<\/script>/gi;while(_0x3bba3b['test'](_0x36249f[_0x2822('0x16')])){_0x36249f[_0x2822('0x16')]=_0x36249f[_0x2822('0x16')][_0x2822('0x17')](_0x3bba3b,'');}if(_0x36249f[_0x2822('0x16')][_0x2822('0x18')]('{_0x341502[_0x2822('0x1b')](_0x240841[_0x2822('0x1c')]);});var _0x49600d=/]+>/g;var _0xe1036c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x927aba=_0x36249f[_0x2822('0x16')][_0x2822('0x17')](_0xe1036c,_0x2822('0x1d'));var _0x52ca4a=_0x927aba[_0x2822('0x17')](_0x49600d,'_IMG');for(let _0x25b256=0x0;_0x25b256<_0x341502[_0x2822('0x12')];_0x25b256++){var _0x5d1d7d=_0x52ca4a['replace'](_0x2822('0x1e'),_0x2822('0x1f')+_0x341502[_0x25b256]+_0x2822('0x20'));_0x52ca4a=_0x5d1d7d;}_0x36249f[_0x2822('0x16')]=_0x52ca4a;}_0x586554[_0x2822('0x21')]=_0x36249f[_0x2822('0x16')];}else{_0x586554[_0x2822('0x21')]=_0x36249f[_0x2822('0x22')];}if(_0x586554[_0x2822('0x21')]){_0x586554['body']=_0x586554[_0x2822('0x21')][_0x2822('0x17')](/0x0){var _0x43be1d=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x2822('0x33')];for(var _0x33cd11=0x0;_0x33cd11<_0x36249f[_0x2822('0x32')][_0x2822('0x12')];_0x33cd11++){var _0x4205b9=_[_0x2822('0xf')](_0x43be1d,_0x36249f[_0x2822('0x32')][_0x33cd11][_0x2822('0x34')]);if(_0x4205b9>=0x0){_0x586554[_0x2822('0x35')]=!![];}}}return _0x586554;}exports[_0x2822('0x36')]=function(_0x4b09f,_0x4343ad,_0x4468b2){var _0x2aade6={'from':getAddress(_0x4343ad['from']),'firstName':getFirstName(_0x4343ad[_0x2822('0x37')]),'lastName':getLastName(_0x4343ad[_0x2822('0x37')]),'mapKey':_0x2822('0x6'),'message':{'from':getMails(_0x4b09f[_0x2822('0x6')],_0x4343ad[_0x2822('0x37')]),'to':_0x4b09f[_0x2822('0x6')],'cc':'','subject':_0x4343ad['subject']||'','messageId':_0x4343ad[_0x2822('0x38')],'inReplyTo':_0x4343ad[_0x2822('0x39')],'sentAt':moment(_0x4343ad['date'])[_0x2822('0x3a')](_0x2822('0x3b')),'attach':![],'attachments':[]}};if(!_0x4343ad['html']&&!_0x4343ad['textAsHtml']){var _0x1242b3=_[_0x2822('0x3c')](_0x4343ad[_0x2822('0x19')],{'contentType':_0x2822('0x3d')});if(_0x1242b3[_0x2822('0x12')]){logger['info'](util['format'](_0x2822('0x3e'),_0x4343ad[_0x2822('0x38')]));tnef['parseBuffer'](_[_0x2822('0x3f')](_0x1242b3)[_0x2822('0x30')],function(_0x126e48,_0x4700f4){if(_0x4700f4){_0x4343ad[_0x2822('0x16')]=_0x4700f4[_0x2822('0x40')]||'

Empty\x20message

';if(_0x4700f4[_0x2822('0x41')]){for(var _0x757982=0x0;_0x757982<_0x4700f4['Attachments'][_0x2822('0x12')];_0x757982++){var _0x4fc8d6=_0x4700f4['Attachments'][_0x757982];_0x2aade6[_0x2822('0x25')][_0x2822('0x19')][_0x2822('0x1b')]({'filename':_0x4fc8d6[_0x2822('0x42')],'content':Buffer[_0x2822('0x37')](_0x4fc8d6[_0x2822('0x43')])});}}}_0x4468b2(parseEmail(_0x4b09f,_0x4343ad,_0x2aade6));});}else{_0x4343ad[_0x2822('0x16')]=_0x2822('0x44');_0x4468b2(parseEmail(_0x4b09f,_0x4343ad,_0x2aade6));}}else{_0x4468b2(parseEmail(_0x4b09f,_0x4343ad,_0x2aade6));}};exports[_0x2822('0x45')]=function(_0xdb08f2,_0x1c1b1c){var _0x17f676=['user='+(_0x1c1b1c||''),'auth=Bearer\x20'+_0xdb08f2,'',''];return Buffer[_0x2822('0x37')](_0x17f676[_0x2822('0x11')](''),_0x2822('0x46'))[_0x2822('0x47')]('base64');}; \ No newline at end of file +var _0x69c4=['0x1?_0x211330['slice'](0x0,-0x1)['join']('\x20'):_0xa6193a[_0x469c('0xe')];}return'Anonymous';}function getLastName(_0x3ed71a){var _0x1acd59=_[_0x469c('0x8')](_0x3ed71a[_0x469c('0x9')]);if(_0x1acd59&&_0x1acd59[_0x469c('0xe')]){var _0x5ec4fa=_0x1acd59[_0x469c('0xe')]['split'](/\s+/);return _0x5ec4fa[_0x469c('0x10')]>0x1?_0x5ec4fa[_0x469c('0x11')]():'';}return'';}function getMails(_0x58e936,_0x3f66de){var _0x3133d9='';for(var _0xbbd1ea=0x0;_0xbbd1ea<_0x3f66de[_0x469c('0x9')]['length'];_0xbbd1ea+=0x1){if(_0x3f66de[_0x469c('0x9')][_0xbbd1ea][_0x469c('0xa')]!==_0x58e936){if(!_[_0x469c('0x12')](_0x3133d9)){_0x3133d9+=',';}_0x3133d9+=_0x3f66de[_0x469c('0x9')][_0xbbd1ea][_0x469c('0xe')]||_0x3f66de[_0x469c('0x9')][_0xbbd1ea]['address']||'';_0x3133d9+='\x20<';_0x3133d9+=_0x3f66de['value'][_0xbbd1ea]['address']?_0x3f66de[_0x469c('0x9')][_0xbbd1ea][_0x469c('0xa')]:_0x469c('0xb')+random[_0x469c('0xc')](0x6)+_0x469c('0xd');_0x3133d9+='>';}}return _0x3133d9;}function parseEmail(_0x20e8d6,_0x973e4f,_0x5503dc){if(_0x973e4f[_0x469c('0x13')]){var _0x27d8df=/)<[^<]*)*<\/script>/gi;while(_0x27d8df[_0x469c('0x14')](_0x973e4f[_0x469c('0x13')])){_0x973e4f[_0x469c('0x13')]=_0x973e4f[_0x469c('0x13')]['replace'](_0x27d8df,'');}if(_0x973e4f[_0x469c('0x13')][_0x469c('0x15')](_0x469c('0x16'))){var _0x3a1ab6=[];_0x973e4f[_0x469c('0x17')][_0x469c('0x18')](_0x355e3d=>{_0x3a1ab6[_0x469c('0x19')](_0x355e3d[_0x469c('0x1a')]);});var _0x272695=/]+>/g;var _0x5c0e82=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x165571=_0x973e4f['html'][_0x469c('0x1b')](_0x5c0e82,_0x469c('0x1c'));var _0x3fec8a=_0x165571[_0x469c('0x1b')](_0x272695,_0x469c('0x1d'));for(let _0x5e7f6f=0x0;_0x5e7f6f<_0x3a1ab6[_0x469c('0x10')];_0x5e7f6f++){var _0x2f3ce6=_0x3fec8a['replace'](_0x469c('0x1d'),'\x20[Attachment:\x20'+_0x3a1ab6[_0x5e7f6f]+'\x20]');_0x3fec8a=_0x2f3ce6;}_0x973e4f[_0x469c('0x13')]=_0x3fec8a;}_0x5503dc[_0x469c('0x1e')]=_0x973e4f['html'];}else{_0x5503dc[_0x469c('0x1e')]=_0x973e4f['textAsHtml'];}if(_0x5503dc[_0x469c('0x1e')]){_0x5503dc[_0x469c('0x1e')]=_0x5503dc[_0x469c('0x1e')][_0x469c('0x1b')](/0x0){var _0x32e021=[_0x469c('0x2d'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x74195=0x0;_0x74195<_0x973e4f['headerLines']['length'];_0x74195++){var _0xd30e3f=_['indexOf'](_0x32e021,_0x973e4f[_0x469c('0x2c')][_0x74195][_0x469c('0x2e')]);if(_0xd30e3f>=0x0){_0x5503dc[_0x469c('0x2f')]=!![];}}}return _0x5503dc;}exports[_0x469c('0x30')]=function(_0x2b7572,_0x8fbb55,_0x4842a5){var _0x22152a={'from':getAddress(_0x8fbb55[_0x469c('0x31')]),'firstName':getFirstName(_0x8fbb55[_0x469c('0x31')]),'lastName':getLastName(_0x8fbb55['from']),'mapKey':_0x469c('0x6'),'message':{'from':getMails(_0x2b7572[_0x469c('0x6')],_0x8fbb55[_0x469c('0x31')]),'to':_0x2b7572[_0x469c('0x6')],'cc':'','subject':_0x8fbb55[_0x469c('0x32')]||'','messageId':_0x8fbb55[_0x469c('0x33')],'inReplyTo':_0x8fbb55[_0x469c('0x34')],'sentAt':moment(_0x8fbb55['date'])[_0x469c('0x25')](_0x469c('0x35')),'attach':![],'attachments':[]}};if(!_0x8fbb55[_0x469c('0x13')]&&!_0x8fbb55[_0x469c('0x36')]){var _0x8e46a=_[_0x469c('0x37')](_0x8fbb55['attachments'],{'contentType':'application/ms-tnef'});if(_0x8e46a[_0x469c('0x10')]){logger[_0x469c('0x38')](util['format'](_0x469c('0x39'),_0x8fbb55[_0x469c('0x33')]));tnef['parseBuffer'](_[_0x469c('0x3a')](_0x8e46a)[_0x469c('0x2a')],function(_0x5c987b,_0x79319d){if(_0x79319d){_0x8fbb55[_0x469c('0x13')]=_0x79319d[_0x469c('0x3b')]||'

Empty\x20message

';if(_0x79319d[_0x469c('0x3c')]){for(var _0x575861=0x0;_0x575861<_0x79319d[_0x469c('0x3c')][_0x469c('0x10')];_0x575861++){var _0x529f8a=_0x79319d['Attachments'][_0x575861];_0x22152a[_0x469c('0x1f')]['attachments']['push']({'filename':_0x529f8a[_0x469c('0x3d')],'content':Buffer['from'](_0x529f8a[_0x469c('0x3e')])});}}}_0x4842a5(parseEmail(_0x2b7572,_0x8fbb55,_0x22152a));});}else{_0x8fbb55[_0x469c('0x13')]='

Empty\x20message

';_0x4842a5(parseEmail(_0x2b7572,_0x8fbb55,_0x22152a));}}else{_0x4842a5(parseEmail(_0x2b7572,_0x8fbb55,_0x22152a));}};exports[_0x469c('0x3f')]=function(_0x4774eb,_0x55ce5c){var _0x433ea6=[_0x469c('0x40')+(_0x55ce5c||''),'auth=Bearer\x20'+_0x4774eb,'',''];return Buffer[_0x469c('0x31')](_0x433ea6[_0x469c('0x28')](''),_0x469c('0x41'))[_0x469c('0x42')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 20f3bc9..ab12037 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 _0x6ce7=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ce7,0x153));var _0x76ce=function(_0x233268,_0xf00d3b){_0x233268=_0x233268-0x0;var _0x241674=_0x6ce7[_0x233268];return _0x241674;};'use strict';var _=require(_0x76ce('0x0'));function MailAccount(_0xb2cbe2){this['id']=_0xb2cbe2['id']||0x0;this[_0x76ce('0x1')]=_0xb2cbe2['name']||_0x76ce('0x2');this[_0x76ce('0x3')]=_0xb2cbe2[_0x76ce('0x3')]||_0x76ce('0x4');this[_0x76ce('0x5')]=_0xb2cbe2[_0x76ce('0x5')]||![];this[_0x76ce('0x6')]=_0xb2cbe2[_0x76ce('0x6')]||[];this[_0x76ce('0x7')]=_0xb2cbe2[_0x76ce('0x7')]||[];}module[_0x76ce('0x8')]=MailAccount; \ No newline at end of file +var _0xf5c5=['key','SERV','active','Imap','Smtp','name','Service'];(function(_0x1da811,_0x2e30db){var _0x53858b=function(_0x4e70ce){while(--_0x4e70ce){_0x1da811['push'](_0x1da811['shift']());}};_0x53858b(++_0x2e30db);}(_0xf5c5,0x178));var _0x5f5c=function(_0x965200,_0x356706){_0x965200=_0x965200-0x0;var _0x3898e3=_0xf5c5[_0x965200];return _0x3898e3;};'use strict';var _=require('lodash');function MailAccount(_0x4b8a4e){this['id']=_0x4b8a4e['id']||0x0;this[_0x5f5c('0x0')]=_0x4b8a4e[_0x5f5c('0x0')]||_0x5f5c('0x1');this[_0x5f5c('0x2')]=_0x4b8a4e[_0x5f5c('0x2')]||_0x5f5c('0x3');this[_0x5f5c('0x4')]=_0x4b8a4e[_0x5f5c('0x4')]||![];this[_0x5f5c('0x5')]=_0x4b8a4e['Imap']||[];this[_0x5f5c('0x6')]=_0x4b8a4e['Smtp']||[];}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 66d07b5..d1f7c35 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 _0xa8c0=['mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','isUndefined','merge','lodash','../model/mailAccount'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa8c0,0x142));var _0x0a8c=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xa8c0[_0x453e2b];return _0x50f306;};'use strict';var _=require(_0x0a8c('0x0'));var MailAccount=require(_0x0a8c('0x1'));var Realtime=function(){this[_0x0a8c('0x2')]={};};function freeIsNotKey(_0x26f417,_0x45c6c4,_0x5e30ca){var _0x951627=_['mapKeys'](_0x26f417,function(_0x22930c,_0x5eb7b0){return _0x22930c[_0x5e30ca];});for(var _0x546b0a in _0x45c6c4){if(_0x45c6c4[_0x0a8c('0x3')](_0x546b0a)){if(!_0x951627[_0x546b0a]){delete _0x45c6c4[_0x546b0a];}}}}Realtime['prototype'][_0x0a8c('0x4')]=function(_0x1b5158,_0x4ae3a0){for(var _0x4069c1 in _0x4ae3a0){if(_0x1b5158['hasOwnProperty'](_0x4069c1)){_0x1b5158[_0x4069c1]=_0x4ae3a0[_0x4069c1];}}};Realtime[_0x0a8c('0x5')][_0x0a8c('0x6')]=function(){var _0x3272a6=this;return function(_0x41bd06){if(_0x41bd06){freeIsNotKey(_0x41bd06,_0x3272a6['mailAccounts'],'id');for(var _0x461b58=0x0,_0x5ecb5c={},_0x59529d={};_0x461b58<_0x41bd06['length'];_0x461b58+=0x1){_0x5ecb5c=_0x41bd06[_0x461b58];if(_[_0x0a8c('0x7')](_0x3272a6[_0x0a8c('0x2')][_0x5ecb5c['id']])){_0x3272a6[_0x0a8c('0x2')][_0x5ecb5c['id']]=new MailAccount(_0x5ecb5c);}else{_[_0x0a8c('0x8')](_0x3272a6[_0x0a8c('0x2')][_0x5ecb5c['id']],_0x5ecb5c);}}}return _0x3272a6[_0x0a8c('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xbda7=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','../model/mailAccount'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xbda7,0x1a6));var _0x7bda=function(_0x27d003,_0x31e838){_0x27d003=_0x27d003-0x0;var _0xed681a=_0xbda7[_0x27d003];return _0xed681a;};'use strict';var _=require('lodash');var MailAccount=require(_0x7bda('0x0'));var Realtime=function(){this[_0x7bda('0x1')]={};};function freeIsNotKey(_0x5c7f93,_0x375f34,_0x2165a0){var _0x3d64a7=_[_0x7bda('0x2')](_0x5c7f93,function(_0x43f2e7,_0x256ee1){return _0x43f2e7[_0x2165a0];});for(var _0x1d09eb in _0x375f34){if(_0x375f34[_0x7bda('0x3')](_0x1d09eb)){if(!_0x3d64a7[_0x1d09eb]){delete _0x375f34[_0x1d09eb];}}}}Realtime[_0x7bda('0x4')][_0x7bda('0x5')]=function(_0x12cb91,_0x12690e){for(var _0x2e9586 in _0x12690e){if(_0x12cb91[_0x7bda('0x3')](_0x2e9586)){_0x12cb91[_0x2e9586]=_0x12690e[_0x2e9586];}}};Realtime[_0x7bda('0x4')]['initMailAccounts']=function(){var _0xb37833=this;return function(_0x3c5945){if(_0x3c5945){freeIsNotKey(_0x3c5945,_0xb37833[_0x7bda('0x1')],'id');for(var _0x5d8a78=0x0,_0x4b7059={},_0x4f0699={};_0x5d8a78<_0x3c5945[_0x7bda('0x6')];_0x5d8a78+=0x1){_0x4b7059=_0x3c5945[_0x5d8a78];if(_[_0x7bda('0x7')](_0xb37833[_0x7bda('0x1')][_0x4b7059['id']])){_0xb37833[_0x7bda('0x1')][_0x4b7059['id']]=new MailAccount(_0x4b7059);}else{_[_0x7bda('0x8')](_0xb37833[_0x7bda('0x1')][_0x4b7059['id']],_0x4b7059);}}}return _0xb37833[_0x7bda('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 36a51bc..795e1ef 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 _0xbd0a=['Request','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','name','notify','NotifyMailAccount','../client'];(function(_0xa3b265,_0x49b893){var _0x4390aa=function(_0x2642a2){while(--_0x2642a2){_0xa3b265['push'](_0xa3b265['shift']());}};_0x4390aa(++_0x49b893);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x9364a3,_0x533868){_0x9364a3=_0x9364a3-0x0;var _0x1efdd4=_0xbd0a[_0x9364a3];return _0x1efdd4;};'use strict';var client=require(_0xabd0('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xabd0('0x1')]('GetMailAccount',{'options':{'attributes':['id','name','provider',_0xabd0('0x2'),_0xabd0('0x3'),_0xabd0('0x4'),_0xabd0('0x5'),_0xabd0('0x6'),_0xabd0('0x7')],'raw':![],'include':[{'model':_0xabd0('0x8'),'as':_0xabd0('0x9'),'include':[{'model':_0xabd0('0xa'),'attributes':['id','name',_0xabd0('0x2'),_0xabd0('0xb'),_0xabd0('0xc')],'as':'CloudProvider'}]},{'model':_0xabd0('0xd'),'as':'Smtp','include':[{'model':_0xabd0('0xa'),'attributes':['id',_0xabd0('0xe'),_0xabd0('0x2'),_0xabd0('0xb'),'data5'],'as':_0xabd0('0xa')}]}]},'log':'getMailAccount'});};};exports[_0xabd0('0xf')]=function(_0x3779fa,_0x1ad151){return client[_0xabd0('0x1')](_0xabd0('0x10'),{'account':{'id':_0x3779fa},'body':_0x1ad151,'log':_0xabd0('0x10')});}; \ No newline at end of file +var _0x2d95=['ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','name','provider','service','active','key'];(function(_0x38e65b,_0x765a2b){var _0x12e29c=function(_0x288cbf){while(--_0x288cbf){_0x38e65b['push'](_0x38e65b['shift']());}};_0x12e29c(++_0x765a2b);}(_0x2d95,0xca));var _0x52d9=function(_0x390702,_0x5bacfc){_0x390702=_0x390702-0x0;var _0x2b0075=_0x2d95[_0x390702];return _0x2b0075;};'use strict';var client=require(_0x52d9('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x52d9('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x52d9('0x2'),_0x52d9('0x3'),_0x52d9('0x4'),'email',_0x52d9('0x5'),_0x52d9('0x6'),_0x52d9('0x7'),_0x52d9('0x8')],'raw':![],'include':[{'model':_0x52d9('0x9'),'as':_0x52d9('0xa'),'include':[{'model':_0x52d9('0xb'),'attributes':['id',_0x52d9('0x2'),_0x52d9('0x4'),_0x52d9('0xc'),_0x52d9('0xd')],'as':_0x52d9('0xb')}]},{'model':_0x52d9('0xe'),'as':_0x52d9('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x52d9('0xc'),_0x52d9('0xd')],'as':_0x52d9('0xb')}]}]},'log':_0x52d9('0x10')});};};exports[_0x52d9('0x11')]=function(_0x5523b4,_0x1fa931){return client[_0x52d9('0x1')](_0x52d9('0x12'),{'account':{'id':_0x5523b4},'body':_0x1fa931,'log':_0x52d9('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 248029a..82adab2 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 _0xdb59=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0xdb59,0xd2));var _0x9db5=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0xdb59[_0x18776a];return _0x484e4a;};'use strict';var client=require(_0x9db5('0x0'));exports[_0x9db5('0x1')]=function(){return client[_0x9db5('0x2')](_0x9db5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9db5('0x4')]},'log':_0x9db5('0x5')});}; \ No newline at end of file +var _0x7610=['Request','ShowSetting','GetSettings','getSettings'];(function(_0x4b4889,_0x41cc03){var _0x38aac9=function(_0x514501){while(--_0x514501){_0x4b4889['push'](_0x4b4889['shift']());}};_0x38aac9(++_0x41cc03);}(_0x7610,0x10f));var _0x0761=function(_0x62b2ef,_0xae5f07){_0x62b2ef=_0x62b2ef-0x0;var _0x4a4f0c=_0x7610[_0x62b2ef];return _0x4a4f0c;};'use strict';var client=require('../client');exports[_0x0761('0x0')]=function(){return client[_0x0761('0x1')](_0x0761('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x0761('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c17d166..9d7a16d 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 629bb4e..fbbd27f 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 _0xc632=['../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','../../config/environment','createServer','timeout','listen','port','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default'];(function(_0xd939a2,_0x3322ee){var _0x2135d5=function(_0x2afe3d){while(--_0x2afe3d){_0xd939a2['push'](_0xd939a2['shift']());}};_0x2135d5(++_0x3322ee);}(_0xc632,0x11c));var _0x2c63=function(_0x477024,_0x5bfbc1){_0x477024=_0x477024-0x0;var _0x1e2d0a=_0xc632[_0x477024];return _0x1e2d0a;};'use strict';var _=require(_0x2c63('0x0'));var http=require('http');var express=require(_0x2c63('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x2c63('0x2'));var app=express();var server=http[_0x2c63('0x3')](app);server[_0x2c63('0x4')]=0xdbba0;if(sticky[_0x2c63('0x5')](server,config[_0x2c63('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x2c63('0x7')]});config[_0x2c63('0x8')]=_[_0x2c63('0x9')](config[_0x2c63('0x8')],{'host':_0x2c63('0xa'),'port':0x18eb});socketio[_0x2c63('0xb')](require(_0x2c63('0xc'))({'pubClient':new Redis(config[_0x2c63('0x8')]),'subClient':new Redis(config[_0x2c63('0x8')])}));require(_0x2c63('0xd'))[_0x2c63('0xe')]();require(_0x2c63('0xf'))[_0x2c63('0xe')](socketio);require(_0x2c63('0x10'))['default'](app);require(_0x2c63('0x11'))[_0x2c63('0xe')](app);}else{server[_0x2c63('0x12')](_0x2c63('0x13'),function(){console[_0x2c63('0x14')](_0x2c63('0x15'),config[_0x2c63('0x6')]);});}exports=module[_0x2c63('0x16')]=app; \ No newline at end of file +var _0x1bc3=['localhost','adapter','../../config/socketio','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','redis','defaults'];(function(_0x3c635e,_0x45a005){var _0x1722f4=function(_0x5db1fb){while(--_0x5db1fb){_0x3c635e['push'](_0x3c635e['shift']());}};_0x1722f4(++_0x45a005);}(_0x1bc3,0x7a));var _0x31bc=function(_0x34d7ba,_0xe4468d){_0x34d7ba=_0x34d7ba-0x0;var _0x1b66e4=_0x1bc3[_0x34d7ba];return _0x1b66e4;};'use strict';var _=require(_0x31bc('0x0'));var http=require(_0x31bc('0x1'));var express=require(_0x31bc('0x2'));var sticky=require(_0x31bc('0x3'));var Redis=require('ioredis');var config=require(_0x31bc('0x4'));var app=express();var server=http[_0x31bc('0x5')](app);server[_0x31bc('0x6')]=0xdbba0;if(sticky[_0x31bc('0x7')](server,config[_0x31bc('0x8')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0x31bc('0x9')]=_[_0x31bc('0xa')](config[_0x31bc('0x9')],{'host':_0x31bc('0xb'),'port':0x18eb});socketio[_0x31bc('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x31bc('0x9')]),'subClient':new Redis(config[_0x31bc('0x9')])}));require('../../config/triggers')['default']();require(_0x31bc('0xd'))[_0x31bc('0xe')](socketio);require('../../config/express')['default'](app);require(_0x31bc('0xf'))[_0x31bc('0xe')](app);}else{server['once'](_0x31bc('0x10'),function(){console[_0x31bc('0x11')](_0x31bc('0x12'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 456471f..95789e6 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 _0x3e1a=['../../config/logger','routing','Request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird'];(function(_0x1075a2,_0xb2f371){var _0x43f5f9=function(_0x2f7760){while(--_0x2f7760){_0x1075a2['push'](_0x1075a2['shift']());}};_0x43f5f9(++_0xb2f371);}(_0x3e1a,0x184));var _0xa3e1=function(_0x3c8ba8,_0x48882c){_0x3c8ba8=_0x3c8ba8-0x0;var _0x5c22cb=_0x3e1a[_0x3c8ba8];return _0x5c22cb;};'use strict';var jayson=require(_0xa3e1('0x0'));var BPromise=require(_0xa3e1('0x1'));var logger=require(_0xa3e1('0x2'))(_0xa3e1('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xa3e1('0x4')]=function(_0x3d8989,_0x2c9032){return new BPromise(function(_0x376f76,_0x94ad8d){return client['request'](_0x3d8989,_0x2c9032)[_0xa3e1('0x5')](function(_0x3da8b2){logger[_0xa3e1('0x6')]('rpc','routing',_0x3d8989,_0x2c9032,_0x3da8b2);if(_0x3da8b2[_0xa3e1('0x7')]){logger[_0xa3e1('0x7')]('rpc',_0xa3e1('0x3'),_0x3d8989,_0x3da8b2[_0xa3e1('0x7')][_0xa3e1('0x8')],_0x2c9032);return _0x94ad8d(_0x3da8b2[_0xa3e1('0x7')][_0xa3e1('0x8')]);}else{return _0x376f76(_0x3da8b2[_0xa3e1('0x9')]);}})[_0xa3e1('0xa')](function(_0x39bf5a){logger[_0xa3e1('0x7')](_0xa3e1('0xb'),_0xa3e1('0x3'),_0x3d8989,_0x39bf5a,_0x2c9032);return _0x94ad8d(_0x39bf5a);});});};module[_0xa3e1('0xc')]=client; \ No newline at end of file +var _0x4586=['error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','request','then','rpc'];(function(_0x241e93,_0x595ec4){var _0x61940d=function(_0x29d379){while(--_0x29d379){_0x241e93['push'](_0x241e93['shift']());}};_0x61940d(++_0x595ec4);}(_0x4586,0x198));var _0x6458=function(_0x2103dd,_0x2cb8f6){_0x2103dd=_0x2103dd-0x0;var _0x457cf6=_0x4586[_0x2103dd];return _0x457cf6;};'use strict';var jayson=require(_0x6458('0x0'));var BPromise=require(_0x6458('0x1'));var logger=require('../../config/logger')(_0x6458('0x2'));var client=jayson[_0x6458('0x3')][_0x6458('0x4')]({'port':0x2329});client['Request']=function(_0x6ff40f,_0xc2aa){return new BPromise(function(_0x535697,_0xbc9bfe){return client[_0x6458('0x5')](_0x6ff40f,_0xc2aa)[_0x6458('0x6')](function(_0x11fd53){logger['debug'](_0x6458('0x7'),_0x6458('0x2'),_0x6ff40f,_0xc2aa,_0x11fd53);if(_0x11fd53['error']){logger[_0x6458('0x8')](_0x6458('0x7'),_0x6458('0x2'),_0x6ff40f,_0x11fd53[_0x6458('0x8')][_0x6458('0x9')],_0xc2aa);return _0xbc9bfe(_0x11fd53[_0x6458('0x8')]['message']);}else{return _0x535697(_0x11fd53[_0x6458('0xa')]);}})[_0x6458('0xb')](function(_0x471122){logger[_0x6458('0x8')](_0x6458('0x7'),_0x6458('0x2'),_0x6ff40f,_0x471122,_0xc2aa);return _0xbc9bfe(_0x471122);});});};module[_0x6458('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 724443a..012474c 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 _0xd8dd=['initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','initAgents','getIntervals','then','getOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues'];(function(_0x43b690,_0x2fff39){var _0x4238d9=function(_0x2be612){while(--_0x2be612){_0x43b690['push'](_0x43b690['shift']());}};_0x4238d9(++_0x2fff39);}(_0xd8dd,0x1e4));var _0xdd8d=function(_0x5b6575,_0x3e73de){_0x5b6575=_0x5b6575-0x0;var _0x320d16=_0xd8dd[_0x5b6575];return _0x320d16;};'use strict';var BPromise=require(_0xdd8d('0x0'));var server=require(_0xdd8d('0x1'));var Realtime=require('./realtime');var user=require(_0xdd8d('0x2'));var interval=require(_0xdd8d('0x3'));var openchannelQueue=require(_0xdd8d('0x4'));var chatQueue=require(_0xdd8d('0x5'));var smsQueue=require(_0xdd8d('0x6'));var mailQueue=require(_0xdd8d('0x7'));var faxQueue=require(_0xdd8d('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xdd8d('0x9')]()['then'](user[_0xdd8d('0xa')]())['then'](realtime[_0xdd8d('0xb')]())['then'](interval[_0xdd8d('0xc')]())[_0xdd8d('0xd')](realtime['initIntervals']())[_0xdd8d('0xd')](openchannelQueue[_0xdd8d('0xe')]())[_0xdd8d('0xd')](realtime['initOpenchannelQueues']())[_0xdd8d('0xd')](chatQueue['getChatQueues']())[_0xdd8d('0xd')](realtime['initChatQueues']())[_0xdd8d('0xd')](smsQueue[_0xdd8d('0xf')]())[_0xdd8d('0xd')](realtime[_0xdd8d('0x10')]())[_0xdd8d('0xd')](mailQueue[_0xdd8d('0x11')]())['then'](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0xdd8d('0xd')](realtime[_0xdd8d('0x12')]())[_0xdd8d('0xd')](whatsappQueue[_0xdd8d('0x13')]())[_0xdd8d('0xd')](realtime[_0xdd8d('0x14')]())[_0xdd8d('0xd')](function(){return realtime;});}function main(){return server[_0xdd8d('0x15')](realtime)[_0xdd8d('0xd')](function(_0x59db10){return initRealtime();})['then'](function(_0x56df1d){return setInterval(initRealtime,0x1388);})[_0xdd8d('0x16')](function(_0x4156de){console[_0xdd8d('0x17')](_0x4156de);});}main(); \ No newline at end of file +var _0xb06e=['getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','initAgents','getIntervals','initIntervals'];(function(_0x2d0097,_0x9d9cad){var _0x4abf2e=function(_0x5a10d0){while(--_0x5a10d0){_0x2d0097['push'](_0x2d0097['shift']());}};_0x4abf2e(++_0x9d9cad);}(_0xb06e,0x1ed));var _0xeb06=function(_0x466b4e,_0x10ee3d){_0x466b4e=_0x466b4e-0x0;var _0x2ea133=_0xb06e[_0x466b4e];return _0x2ea133;};'use strict';var BPromise=require(_0xeb06('0x0'));var server=require(_0xeb06('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xeb06('0x2'));var openchannelQueue=require(_0xeb06('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xeb06('0x4'));var mailQueue=require(_0xeb06('0x5'));var faxQueue=require(_0xeb06('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xeb06('0x7')](user['getAgents']())[_0xeb06('0x7')](realtime[_0xeb06('0x8')]())[_0xeb06('0x7')](interval[_0xeb06('0x9')]())[_0xeb06('0x7')](realtime[_0xeb06('0xa')]())['then'](openchannelQueue[_0xeb06('0xb')]())[_0xeb06('0x7')](realtime['initOpenchannelQueues']())[_0xeb06('0x7')](chatQueue[_0xeb06('0xc')]())[_0xeb06('0x7')](realtime[_0xeb06('0xd')]())[_0xeb06('0x7')](smsQueue[_0xeb06('0xe')]())[_0xeb06('0x7')](realtime['initSmsQueues']())[_0xeb06('0x7')](mailQueue[_0xeb06('0xf')]())[_0xeb06('0x7')](realtime[_0xeb06('0x10')]())['then'](faxQueue[_0xeb06('0x11')]())[_0xeb06('0x7')](realtime[_0xeb06('0x12')]())[_0xeb06('0x7')](whatsappQueue[_0xeb06('0x13')]())[_0xeb06('0x7')](realtime[_0xeb06('0x14')]())[_0xeb06('0x7')](function(){return realtime;});}function main(){return server[_0xeb06('0x15')](realtime)[_0xeb06('0x7')](function(_0x44c401){return initRealtime();})[_0xeb06('0x7')](function(_0x2d6050){return setInterval(initRealtime,0x1388);})[_0xeb06('0x16')](function(_0x29d420){console[_0xeb06('0x17')](_0x29d420);});}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 d433018..e16c95a 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x1261[_0x349148];return _0x2f2b0f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x1ccd3b,_0x38b358){var _0x3ec619=function(_0x43051b){while(--_0x43051b){_0x1ccd3b['push'](_0x1ccd3b['shift']());}};_0x3ec619(++_0x38b358);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b21e37d..d1c77e3 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 _0x7e83=['sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e83,0xbc));var _0x37e8=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x7e83[_0x1dd532];return _0x3732aa;};'use strict';var BPromise=require(_0x37e8('0x0'));var jayson=require(_0x37e8('0x1'));var client=jayson[_0x37e8('0x2')][_0x37e8('0x3')]({'port':0x232b});function request(_0x3d5513,_0x336422){return new BPromise(function(_0x2dc996,_0x4dc289){return client[_0x37e8('0x4')](_0x3d5513,_0x336422)[_0x37e8('0x5')](function(_0x5eea91){if(_0x5eea91[_0x37e8('0x6')]){return _0x4dc289(_0x5eea91[_0x37e8('0x6')][_0x37e8('0x7')]);}else{return _0x2dc996(_0x5eea91[_0x37e8('0x8')]);}})[_0x37e8('0x9')](function(_0x2d4168){return _0x4dc289(_0x2d4168);});});}exports[_0x37e8('0xa')]=function(_0x362b2e,_0x3a1b30){return request('SendMail',{'account':_0x362b2e,'message':_0x3a1b30});}; \ No newline at end of file +var _0x2087=['sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x2087,0x10f));var _0x7208=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0x2087[_0x465b0c];return _0x502ff0;};'use strict';var BPromise=require(_0x7208('0x0'));var jayson=require(_0x7208('0x1'));var client=jayson[_0x7208('0x2')][_0x7208('0x3')]({'port':0x232b});function request(_0x333384,_0x1ae5ac){return new BPromise(function(_0x4390f6,_0x303ff4){return client[_0x7208('0x4')](_0x333384,_0x1ae5ac)[_0x7208('0x5')](function(_0x5e8ee6){if(_0x5e8ee6[_0x7208('0x6')]){return _0x303ff4(_0x5e8ee6[_0x7208('0x6')][_0x7208('0x7')]);}else{return _0x4390f6(_0x5e8ee6[_0x7208('0x8')]);}})['catch'](function(_0x47d7cc){return _0x303ff4(_0x47d7cc);});});}exports[_0x7208('0x9')]=function(_0x2a4471,_0x13237b){return request('SendMail',{'account':_0x2a4471,'message':_0x13237b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 51092be..a40596c 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 _0xffd6=['idle','mail','openchannel','fax','length','StatusTime','format','Status','chatStatusTime','chatCurrentCapacity','faxStatus','faxStatusTime','smsStatus','whatsappCurrentCapacity','openchannelStatus','busy','busyQueue','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity'];(function(_0x26a75b,_0xb67cfa){var _0x5f554d=function(_0x20744d){while(--_0x20744d){_0x26a75b['push'](_0x26a75b['shift']());}};_0x5f554d(++_0xb67cfa);}(_0xffd6,0x97));var _0x6ffd=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xffd6[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0x6ffd('0x0'));var md5=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6ffd('0x3')]=_[_0x6ffd('0x4')](config[_0x6ffd('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6ffd('0x5'))(new Redis(config[_0x6ffd('0x3')]));function Agent(_0x3b8a46){this['id']=_0x3b8a46['id']||0x0;this[_0x6ffd('0x6')]=_0x3b8a46['name']||'';this[_0x6ffd('0x7')]=_0x3b8a46[_0x6ffd('0x7')]||!![];this[_0x6ffd('0x8')]=_0x3b8a46[_0x6ffd('0x8')]||![];this[_0x6ffd('0x9')]=_0x3b8a46['chatPause']||![];this[_0x6ffd('0xa')]=_0x3b8a46[_0x6ffd('0xa')]||![];this['faxPause']=_0x3b8a46[_0x6ffd('0xb')]||![];this[_0x6ffd('0xc')]=_0x3b8a46[_0x6ffd('0xc')]||![];this[_0x6ffd('0xd')]=_0x3b8a46[_0x6ffd('0xd')]||![];this[_0x6ffd('0xe')]=_0x6ffd('0xf');this['chatStatusTime']=0x0;this[_0x6ffd('0x10')]=_0x3b8a46[_0x6ffd('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x6ffd('0x11')]=_0x6ffd('0xf');this[_0x6ffd('0x12')]=0x0;this[_0x6ffd('0x13')]=_0x3b8a46['mailCapacity']||0x0;this[_0x6ffd('0x14')]=0x0;this['faxStatus']=_0x6ffd('0xf');this['faxStatusTime']=0x0;this[_0x6ffd('0x15')]=_0x3b8a46[_0x6ffd('0x15')]||0x0;this[_0x6ffd('0x16')]=0x0;this['smsStatus']=_0x6ffd('0xf');this[_0x6ffd('0x17')]=0x0;this[_0x6ffd('0x18')]=_0x3b8a46[_0x6ffd('0x18')]||0x0;this[_0x6ffd('0x19')]=0x0;this[_0x6ffd('0x1a')]=_0x6ffd('0xf');this[_0x6ffd('0x1b')]=0x0;this['whatsappCapacity']=_0x3b8a46[_0x6ffd('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x6ffd('0xf');this[_0x6ffd('0x1d')]=0x0;this['openchannelCapacity']=_0x3b8a46[_0x6ffd('0x1e')]||0x0;this[_0x6ffd('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x6ffd('0x1')]='';this[_0x6ffd('0x20')]={};this['faxWaitingInteractions']={};this[_0x6ffd('0x21')]={};this[_0x6ffd('0x22')]={};this[_0x6ffd('0x23')]={};this['whatsappWaitingInteractions']={};this[_0x6ffd('0x24')]();}Agent[_0x6ffd('0x25')]['getChannelStatus']=function(_0x356c9c){if(this[_0x356c9c+_0x6ffd('0x26')]>0x0){if(this[_0x356c9c+'Capacity']>0x0&&this[_0x356c9c+_0x6ffd('0x26')]>=this[_0x356c9c+_0x6ffd('0x27')]){return _0x6ffd('0x28');}else{return'working';}}else{return _0x6ffd('0x29');}};Agent[_0x6ffd('0x25')][_0x6ffd('0x24')]=function(){var _0x4ae7ac=[_0x6ffd('0x2a'),'chat',_0x6ffd('0x2b'),_0x6ffd('0x2c'),'sms','whatsapp'];for(var _0x252201=0x0;_0x252201<_0x4ae7ac[_0x6ffd('0x2d')];_0x252201+=0x1){var _0x1934d4=this['getChannelStatus'](_0x4ae7ac[_0x252201]);if(this[_0x4ae7ac[_0x252201]+'Status']!==_0x1934d4){this[_0x4ae7ac[_0x252201]+_0x6ffd('0x2e')]=_['toNumber'](moment()[_0x6ffd('0x2f')]('x'));}this[_0x4ae7ac[_0x252201]+_0x6ffd('0x30')]=_0x1934d4;}var _0x51fdb6={'id':this['id'],'name':this[_0x6ffd('0x6')],'online':this[_0x6ffd('0x7')],'voicePause':this[_0x6ffd('0x8')],'chatPause':this[_0x6ffd('0x9')],'mailPause':this[_0x6ffd('0xa')],'smsPause':this[_0x6ffd('0xc')],'faxPause':this[_0x6ffd('0xb')],'openchannelPause':this[_0x6ffd('0xd')],'chatStatus':this[_0x6ffd('0xe')],'chatStatusTime':this[_0x6ffd('0x31')],'chatCapacity':this[_0x6ffd('0x10')],'chatCurrentCapacity':this[_0x6ffd('0x32')],'mailStatus':this[_0x6ffd('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6ffd('0x33')],'faxStatusTime':this[_0x6ffd('0x34')],'faxCapacity':this[_0x6ffd('0x15')],'faxCurrentCapacity':this[_0x6ffd('0x16')],'smsStatus':this[_0x6ffd('0x35')],'smsStatusTime':this[_0x6ffd('0x17')],'smsCapacity':this[_0x6ffd('0x18')],'smsCurrentCapacity':this[_0x6ffd('0x19')],'whatsappStatus':this[_0x6ffd('0x1a')],'whatsappStatusTime':this[_0x6ffd('0x1b')],'whatsappCapacity':this[_0x6ffd('0x1c')],'whatsappCurrentCapacity':this[_0x6ffd('0x36')],'openchannelStatus':this[_0x6ffd('0x37')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x6ffd('0x1e')],'openchannelCurrentCapacity':this[_0x6ffd('0x1f')],'busy':this[_0x6ffd('0x38')],'busyQueue':this[_0x6ffd('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6ffd('0x3a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6ffd('0x23')],'whatsappWaitingInteractions':this[_0x6ffd('0x3b')]};var _0x25bc7c=md5(JSON[_0x6ffd('0x3c')](_0x51fdb6));if(this['md5']!==_0x25bc7c){this[_0x6ffd('0x1')]=_0x25bc7c;io['emit'](_0x6ffd('0x3d'),_[_0x6ffd('0x3e')](_0x51fdb6,[_0x6ffd('0x7')]));}};module[_0x6ffd('0x3f')]=Agent; \ No newline at end of file +var _0x5430=['mailWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','mailCurrentCapacity','faxStatusTime','busy'];(function(_0x1529f4,_0x149155){var _0x2e5865=function(_0x1fe0c1){while(--_0x1fe0c1){_0x1529f4['push'](_0x1529f4['shift']());}};_0x2e5865(++_0x149155);}(_0x5430,0x10c));var _0x0543=function(_0x2b2ccf,_0x93fb09){_0x2b2ccf=_0x2b2ccf-0x0;var _0x37ba5e=_0x5430[_0x2b2ccf];return _0x37ba5e;};'use strict';var _=require(_0x0543('0x0'));var md5=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var Redis=require(_0x0543('0x3'));var config=require(_0x0543('0x4'));config[_0x0543('0x5')]=_['defaults'](config['redis'],{'host':_0x0543('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0xce0b65){this['id']=_0xce0b65['id']||0x0;this[_0x0543('0x7')]=_0xce0b65[_0x0543('0x7')]||'';this[_0x0543('0x8')]=_0xce0b65[_0x0543('0x8')]||!![];this['voicePause']=_0xce0b65[_0x0543('0x9')]||![];this[_0x0543('0xa')]=_0xce0b65[_0x0543('0xa')]||![];this[_0x0543('0xb')]=_0xce0b65[_0x0543('0xb')]||![];this[_0x0543('0xc')]=_0xce0b65['faxPause']||![];this[_0x0543('0xd')]=_0xce0b65[_0x0543('0xd')]||![];this['openchannelPause']=_0xce0b65[_0x0543('0xe')]||![];this[_0x0543('0xf')]=_0x0543('0x10');this[_0x0543('0x11')]=0x0;this[_0x0543('0x12')]=_0xce0b65[_0x0543('0x12')]||0x0;this[_0x0543('0x13')]=0x0;this[_0x0543('0x14')]=_0x0543('0x10');this[_0x0543('0x15')]=0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x0543('0x17')]=_0x0543('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0xce0b65[_0x0543('0x18')]||0x0;this[_0x0543('0x19')]=0x0;this[_0x0543('0x1a')]=_0x0543('0x10');this[_0x0543('0x1b')]=0x0;this['smsCapacity']=_0xce0b65[_0x0543('0x1c')]||0x0;this[_0x0543('0x1d')]=0x0;this[_0x0543('0x1e')]=_0x0543('0x10');this[_0x0543('0x1f')]=0x0;this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x0543('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')]||0x0;this[_0x0543('0x23')]=0x0;this['busy']=![];this[_0x0543('0x24')]=undefined;this['md5']='';this[_0x0543('0x25')]={};this[_0x0543('0x26')]={};this['mailWaitingInteractions']={};this[_0x0543('0x27')]={};this[_0x0543('0x28')]={};this[_0x0543('0x29')]={};this[_0x0543('0x2a')]();}Agent[_0x0543('0x2b')][_0x0543('0x2c')]=function(_0x4adba7){if(this[_0x4adba7+'CurrentCapacity']>0x0){if(this[_0x4adba7+'Capacity']>0x0&&this[_0x4adba7+_0x0543('0x2d')]>=this[_0x4adba7+_0x0543('0x2e')]){return _0x0543('0x2f');}else{return _0x0543('0x30');}}else{return _0x0543('0x31');}};Agent[_0x0543('0x2b')][_0x0543('0x2a')]=function(){var _0x17a3de=[_0x0543('0x32'),_0x0543('0x33'),_0x0543('0x34'),_0x0543('0x35'),'sms',_0x0543('0x36')];for(var _0x153bda=0x0;_0x153bda<_0x17a3de[_0x0543('0x37')];_0x153bda+=0x1){var _0x4f2592=this[_0x0543('0x2c')](_0x17a3de[_0x153bda]);if(this[_0x17a3de[_0x153bda]+_0x0543('0x38')]!==_0x4f2592){this[_0x17a3de[_0x153bda]+_0x0543('0x39')]=_[_0x0543('0x3a')](moment()['format']('x'));}this[_0x17a3de[_0x153bda]+_0x0543('0x38')]=_0x4f2592;}var _0x10b9f3={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x0543('0x9')],'chatPause':this[_0x0543('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x0543('0xd')],'faxPause':this[_0x0543('0xc')],'openchannelPause':this[_0x0543('0xe')],'chatStatus':this[_0x0543('0xf')],'chatStatusTime':this[_0x0543('0x11')],'chatCapacity':this[_0x0543('0x12')],'chatCurrentCapacity':this[_0x0543('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0543('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0543('0x3b')],'faxStatus':this[_0x0543('0x17')],'faxStatusTime':this[_0x0543('0x3c')],'faxCapacity':this[_0x0543('0x18')],'faxCurrentCapacity':this[_0x0543('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0543('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0543('0x1d')],'whatsappStatus':this[_0x0543('0x1e')],'whatsappStatusTime':this[_0x0543('0x1f')],'whatsappCapacity':this[_0x0543('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0543('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0543('0x22')],'openchannelCurrentCapacity':this[_0x0543('0x23')],'busy':this[_0x0543('0x3d')],'busyQueue':this[_0x0543('0x24')],'chatWaitingInteractions':this[_0x0543('0x25')],'faxWaitingInteractions':this[_0x0543('0x26')],'mailWaitingInteractions':this[_0x0543('0x3e')],'openchannelWaitingInteractions':this[_0x0543('0x27')],'smsWaitingInteractions':this[_0x0543('0x28')],'whatsappWaitingInteractions':this[_0x0543('0x29')]};var _0x55eeba=md5(JSON[_0x0543('0x3f')](_0x10b9f3));if(this[_0x0543('0x1')]!==_0x55eeba){this['md5']=_0x55eeba;io[_0x0543('0x40')]('user:routing:update',_[_0x0543('0x41')](_0x10b9f3,[_0x0543('0x8')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fa72dc2..25985dd 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 _0xff10=['length','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','loggedIn','paused'];(function(_0x55127d,_0x361989){var _0x5ee754=function(_0xb600ae){while(--_0xb600ae){_0x55127d['push'](_0x55127d['shift']());}};_0x5ee754(++_0x361989);}(_0xff10,0x149));var _0x0ff1=function(_0x2742b3,_0x192217){_0x2742b3=_0x2742b3-0x0;var _0x3c8c2b=_0xff10[_0x2742b3];return _0x3c8c2b;};'use strict';var _=require(_0x0ff1('0x0'));var md5=require(_0x0ff1('0x1'));var util=require('util');var Redis=require(_0x0ff1('0x2'));var config=require(_0x0ff1('0x3'));config[_0x0ff1('0x4')]=_[_0x0ff1('0x5')](config[_0x0ff1('0x4')],{'host':_0x0ff1('0x6'),'port':0x18eb});var io=require(_0x0ff1('0x7'))(new Redis(config['redis']));function ChatQueue(_0x5e833f){this['id']=_0x5e833f['id']||0x0;this['name']=_0x5e833f[_0x0ff1('0x8')]||'';this[_0x0ff1('0x9')]=_0x5e833f[_0x0ff1('0x9')]||0xa;this[_0x0ff1('0xa')]=_0x5e833f[_0x0ff1('0xa')]||'beepall';this[_0x0ff1('0xb')]=_0x5e833f[_0x0ff1('0xb')];this[_0x0ff1('0xc')]={};this['waiting']=0x0;this[_0x0ff1('0x1')]='';this[_0x0ff1('0xd')]();this[_0x0ff1('0xe')]();}ChatQueue['prototype'][_0x0ff1('0xd')]=function(){var _0x2b2c50=this[_0x0ff1('0xc')]['_rr'];this['mapAgentsId']=_[_0x0ff1('0xf')](this[_0x0ff1('0xb')],'id');this['mapAgentsId'][_0x0ff1('0x10')]=_0x2b2c50;};ChatQueue['prototype'][_0x0ff1('0xe')]=function(){this[_0x0ff1('0x11')]=0x0;this[_0x0ff1('0x12')]=0x0;for(var _0x26a986=0x0;_0x26a986=0x0?this[_0x0ff1('0x15')]:0x0;var _0x3027f6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0ff1('0x11')],'name':this[_0x0ff1('0x8')],'paused':this['paused'],'waiting':this[_0x0ff1('0x16')]};var _0x499375=md5(JSON[_0x0ff1('0x17')](_0x3027f6));if(this[_0x0ff1('0x1')]!==_0x499375){this[_0x0ff1('0x1')]=_0x499375;io['to'](util[_0x0ff1('0x18')](_0x0ff1('0x19'),_0x3027f6[_0x0ff1('0x8')]))[_0x0ff1('0x1a')](_0x0ff1('0x1b'),_0x3027f6);}};module[_0x0ff1('0x1c')]=ChatQueue; \ No newline at end of file +var _0x3f1b=['name','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','localhost','redis','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','chatPause','available'];(function(_0x31f1a6,_0xf3f520){var _0x39fc68=function(_0x4025a6){while(--_0x4025a6){_0x31f1a6['push'](_0x31f1a6['shift']());}};_0x39fc68(++_0xf3f520);}(_0x3f1b,0xfa));var _0xb3f1=function(_0x3e62ba,_0x2c23ad){_0x3e62ba=_0x3e62ba-0x0;var _0x347ab2=_0x3f1b[_0x3e62ba];return _0x347ab2;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xb3f1('0x0'));var Redis=require(_0xb3f1('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xb3f1('0x2'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb3f1('0x3')]));function ChatQueue(_0x559f9b){this['id']=_0x559f9b['id']||0x0;this['name']=_0x559f9b['name']||'';this[_0xb3f1('0x4')]=_0x559f9b['timeout']||0xa;this[_0xb3f1('0x5')]=_0x559f9b[_0xb3f1('0x5')]||_0xb3f1('0x6');this[_0xb3f1('0x7')]=_0x559f9b['Agents'];this[_0xb3f1('0x8')]={};this['waiting']=0x0;this[_0xb3f1('0x9')]='';this['updateRouting']();this[_0xb3f1('0xa')]();}ChatQueue[_0xb3f1('0xb')][_0xb3f1('0xc')]=function(){var _0x578f10=this['mapAgentsId'][_0xb3f1('0xd')];this[_0xb3f1('0x8')]=_['map'](this[_0xb3f1('0x7')],'id');this[_0xb3f1('0x8')][_0xb3f1('0xd')]=_0x578f10;};ChatQueue[_0xb3f1('0xb')][_0xb3f1('0xa')]=function(){this[_0xb3f1('0xe')]=0x0;this[_0xb3f1('0xf')]=0x0;for(var _0x322bd4=0x0;_0x322bd4=0x0?this[_0xb3f1('0x13')]:0x0;var _0x2eb14e={'id':this['id'],'available':this[_0xb3f1('0x13')],'loggedIn':this[_0xb3f1('0xe')],'name':this[_0xb3f1('0x14')],'paused':this['paused'],'waiting':this[_0xb3f1('0x15')]};var _0x27a93c=md5(JSON['stringify'](_0x2eb14e));if(this[_0xb3f1('0x9')]!==_0x27a93c){this[_0xb3f1('0x9')]=_0x27a93c;io['to'](util[_0xb3f1('0x16')](_0xb3f1('0x17'),_0x2eb14e[_0xb3f1('0x14')]))[_0xb3f1('0x18')](_0xb3f1('0x19'),_0x2eb14e);}};module[_0xb3f1('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d7b9719..94fadaa 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 _0xc653=['stringify','fax:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','paused','online','available','loggedIn','waiting'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xc653,0x161));var _0x3c65=function(_0x2c54dc,_0x1db485){_0x2c54dc=_0x2c54dc-0x0;var _0x32ccd4=_0xc653[_0x2c54dc];return _0x32ccd4;};'use strict';var _=require(_0x3c65('0x0'));var md5=require(_0x3c65('0x1'));var util=require(_0x3c65('0x2'));var Redis=require(_0x3c65('0x3'));var config=require(_0x3c65('0x4'));config['redis']=_['defaults'](config[_0x3c65('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3c65('0x6'))(new Redis(config[_0x3c65('0x5')]));function FaxQueue(_0x508fd9){this['id']=_0x508fd9['id']||0x0;this[_0x3c65('0x7')]=_0x508fd9[_0x3c65('0x7')]||'';this[_0x3c65('0x8')]=_0x508fd9[_0x3c65('0x8')]||0xa;this['strategy']=_0x508fd9[_0x3c65('0x9')]||_0x3c65('0xa');this[_0x3c65('0xb')]=_0x508fd9['Agents'];this[_0x3c65('0xc')]={};this['waiting']=0x0;this[_0x3c65('0x1')]='';this['updateRouting']();this[_0x3c65('0xd')]();}FaxQueue[_0x3c65('0xe')]['updateRouting']=function(){var _0x436e2e=this[_0x3c65('0xc')][_0x3c65('0xf')];this['mapAgentsId']=_[_0x3c65('0x10')](this[_0x3c65('0xb')],'id');this[_0x3c65('0xc')][_0x3c65('0xf')]=_0x436e2e;};FaxQueue['prototype'][_0x3c65('0xd')]=function(){this['loggedIn']=0x0;this[_0x3c65('0x11')]=0x0;for(var _0x12ef06=0x0;_0x12ef06=0x0?this[_0x3c65('0x13')]:0x0;var _0x3c4f16={'id':this['id'],'available':this[_0x3c65('0x13')],'loggedIn':this[_0x3c65('0x14')],'name':this[_0x3c65('0x7')],'paused':this['paused'],'waiting':this[_0x3c65('0x15')]};var _0x10e883=md5(JSON[_0x3c65('0x16')](_0x3c4f16));if(this[_0x3c65('0x1')]!==_0x10e883){this[_0x3c65('0x1')]=_0x10e883;io['to'](util['format'](_0x3c65('0x17'),_0x3c4f16[_0x3c65('0x7')]))[_0x3c65('0x18')]('fax_queue:save',_0x3c4f16);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x7ee8=['map','prototype','paused','length','online','available','loggedIn','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7ee8,0x1cd));var _0x87ee=function(_0x4c5076,_0x52c9fc){_0x4c5076=_0x4c5076-0x0;var _0x58ac33=_0x7ee8[_0x4c5076];return _0x58ac33;};'use strict';var _=require('lodash');var md5=require(_0x87ee('0x0'));var util=require(_0x87ee('0x1'));var Redis=require(_0x87ee('0x2'));var config=require(_0x87ee('0x3'));config[_0x87ee('0x4')]=_[_0x87ee('0x5')](config[_0x87ee('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x87ee('0x4')]));function FaxQueue(_0x36eaff){this['id']=_0x36eaff['id']||0x0;this[_0x87ee('0x6')]=_0x36eaff['name']||'';this['timeout']=_0x36eaff[_0x87ee('0x7')]||0xa;this[_0x87ee('0x8')]=_0x36eaff['strategy']||'beepall';this[_0x87ee('0x9')]=_0x36eaff[_0x87ee('0x9')];this[_0x87ee('0xa')]={};this[_0x87ee('0xb')]=0x0;this['md5']='';this[_0x87ee('0xc')]();this[_0x87ee('0xd')]();}FaxQueue['prototype'][_0x87ee('0xc')]=function(){var _0x287ce0=this['mapAgentsId']['_rr'];this[_0x87ee('0xa')]=_[_0x87ee('0xe')](this[_0x87ee('0x9')],'id');this[_0x87ee('0xa')]['_rr']=_0x287ce0;};FaxQueue[_0x87ee('0xf')][_0x87ee('0xd')]=function(){this['loggedIn']=0x0;this[_0x87ee('0x10')]=0x0;for(var _0x333eec=0x0;_0x333eec=0x0?this[_0x87ee('0x13')]:0x0;var _0x5de4e0={'id':this['id'],'available':this[_0x87ee('0x13')],'loggedIn':this[_0x87ee('0x14')],'name':this[_0x87ee('0x6')],'paused':this[_0x87ee('0x10')],'waiting':this[_0x87ee('0xb')]};var _0x29ac90=md5(JSON['stringify'](_0x5de4e0));if(this[_0x87ee('0x0')]!==_0x29ac90){this['md5']=_0x29ac90;io['to'](util['format'](_0x87ee('0x15'),_0x5de4e0['name']))[_0x87ee('0x16')](_0x87ee('0x17'),_0x5de4e0);}};module[_0x87ee('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1357e6d..5783513 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 _0xce8e=['Intervals','exports','name'];(function(_0x303962,_0x4febc7){var _0x393675=function(_0x8f4417){while(--_0x8f4417){_0x303962['push'](_0x303962['shift']());}};_0x393675(++_0x4febc7);}(_0xce8e,0x89));var _0xece8=function(_0xcbad10,_0x33f30e){_0xcbad10=_0xcbad10-0x0;var _0x3a2a35=_0xce8e[_0xcbad10];return _0x3a2a35;};'use strict';function Interval(_0x506b4d){this['id']=_0x506b4d['id']||0x0;this[_0xece8('0x0')]=_0x506b4d[_0xece8('0x0')]||'';this[_0xece8('0x1')]=_0x506b4d[_0xece8('0x1')]||{};}module[_0xece8('0x2')]=Interval; \ No newline at end of file +var _0x6335=['name'];(function(_0x47a193,_0x2b8102){var _0x292356=function(_0x3e1036){while(--_0x3e1036){_0x47a193['push'](_0x47a193['shift']());}};_0x292356(++_0x2b8102);}(_0x6335,0xb5));var _0x5633=function(_0x50df81,_0x47805b){_0x50df81=_0x50df81-0x0;var _0x5855b5=_0x6335[_0x50df81];return _0x5855b5;};'use strict';function Interval(_0x258423){this['id']=_0x258423['id']||0x0;this[_0x5633('0x0')]=_0x258423[_0x5633('0x0')]||'';this['Intervals']=_0x258423['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e83f3ed..37a0f51 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 _0xa9c0=['stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','available'];(function(_0x4f8d68,_0x483ac2){var _0x65263c=function(_0x2e23b7){while(--_0x2e23b7){_0x4f8d68['push'](_0x4f8d68['shift']());}};_0x65263c(++_0x483ac2);}(_0xa9c0,0xf5));var _0x0a9c=function(_0x4cbc7e,_0x24fd68){_0x4cbc7e=_0x4cbc7e-0x0;var _0x361bcc=_0xa9c0[_0x4cbc7e];return _0x361bcc;};'use strict';var _=require('lodash');var md5=require(_0x0a9c('0x0'));var util=require(_0x0a9c('0x1'));var Redis=require(_0x0a9c('0x2'));var config=require('../../../config/environment');config[_0x0a9c('0x3')]=_[_0x0a9c('0x4')](config[_0x0a9c('0x3')],{'host':_0x0a9c('0x5'),'port':0x18eb});var io=require(_0x0a9c('0x6'))(new Redis(config[_0x0a9c('0x3')]));function MailQueue(_0x1e87d4){this['id']=_0x1e87d4['id']||0x0;this[_0x0a9c('0x7')]=_0x1e87d4[_0x0a9c('0x7')]||'';this['timeout']=_0x1e87d4['timeout']||0xa;this['strategy']=_0x1e87d4[_0x0a9c('0x8')]||'beepall';this['Agents']=_0x1e87d4[_0x0a9c('0x9')];this[_0x0a9c('0xa')]={};this['waiting']=0x0;this[_0x0a9c('0x0')]='';this[_0x0a9c('0xb')]();this[_0x0a9c('0xc')]();}MailQueue['prototype'][_0x0a9c('0xb')]=function(){var _0x2ef43b=this[_0x0a9c('0xa')][_0x0a9c('0xd')];this[_0x0a9c('0xa')]=_[_0x0a9c('0xe')](this[_0x0a9c('0x9')],'id');this['mapAgentsId']['_rr']=_0x2ef43b;};MailQueue['prototype'][_0x0a9c('0xc')]=function(){this[_0x0a9c('0xf')]=0x0;this[_0x0a9c('0x10')]=0x0;for(var _0x397a77=0x0;_0x397a77=0x0?this['available']:0x0;var _0x4ff0cd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0a9c('0xf')],'name':this[_0x0a9c('0x7')],'paused':this[_0x0a9c('0x10')],'waiting':this['waiting']};var _0x1f86a5=md5(JSON[_0x0a9c('0x13')](_0x4ff0cd));if(this[_0x0a9c('0x0')]!==_0x1f86a5){this[_0x0a9c('0x0')]=_0x1f86a5;io['to'](util['format'](_0x0a9c('0x14'),_0x4ff0cd[_0x0a9c('0x7')]))[_0x0a9c('0x15')](_0x0a9c('0x16'),_0x4ff0cd);}};module[_0x0a9c('0x17')]=MailQueue; \ No newline at end of file +var _0x26a3=['strategy','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','length','online','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x25d3c1,_0x37ff57){var _0x56fbf7=function(_0x223b6d){while(--_0x223b6d){_0x25d3c1['push'](_0x25d3c1['shift']());}};_0x56fbf7(++_0x37ff57);}(_0x26a3,0x8d));var _0x326a=function(_0x5b23cd,_0x59f293){_0x5b23cd=_0x5b23cd-0x0;var _0x2b57d3=_0x26a3[_0x5b23cd];return _0x2b57d3;};'use strict';var _=require(_0x326a('0x0'));var md5=require('md5');var util=require(_0x326a('0x1'));var Redis=require(_0x326a('0x2'));var config=require('../../../config/environment');config[_0x326a('0x3')]=_[_0x326a('0x4')](config[_0x326a('0x3')],{'host':_0x326a('0x5'),'port':0x18eb});var io=require(_0x326a('0x6'))(new Redis(config['redis']));function MailQueue(_0x147b37){this['id']=_0x147b37['id']||0x0;this['name']=_0x147b37[_0x326a('0x7')]||'';this[_0x326a('0x8')]=_0x147b37[_0x326a('0x8')]||0xa;this[_0x326a('0x9')]=_0x147b37[_0x326a('0x9')]||'beepall';this[_0x326a('0xa')]=_0x147b37['Agents'];this[_0x326a('0xb')]={};this[_0x326a('0xc')]=0x0;this[_0x326a('0xd')]='';this[_0x326a('0xe')]();this['updateRealtime']();}MailQueue[_0x326a('0xf')][_0x326a('0xe')]=function(){var _0x409601=this[_0x326a('0xb')]['_rr'];this[_0x326a('0xb')]=_[_0x326a('0x10')](this[_0x326a('0xa')],'id');this[_0x326a('0xb')][_0x326a('0x11')]=_0x409601;};MailQueue['prototype'][_0x326a('0x12')]=function(){this[_0x326a('0x13')]=0x0;this['paused']=0x0;for(var _0x2f4e3a=0x0;_0x2f4e3a=0x0?this[_0x326a('0x17')]:0x0;var _0x52f34c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x326a('0x7')],'paused':this[_0x326a('0x16')],'waiting':this[_0x326a('0xc')]};var _0x26aa15=md5(JSON[_0x326a('0x18')](_0x52f34c));if(this['md5']!==_0x26aa15){this[_0x326a('0xd')]=_0x26aa15;io['to'](util[_0x326a('0x19')](_0x326a('0x1a'),_0x52f34c['name']))[_0x326a('0x1b')](_0x326a('0x1c'),_0x52f34c);}};module[_0x326a('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d99f451..5167474 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0xadb5,0xad));var _0x5adb=function(_0x398577,_0x4d4e77){_0x398577=_0x398577-0x0;var _0x5a45ef=_0xadb5[_0x398577];return _0x5a45ef;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x1261,0x144));var _0x1126=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0x1261[_0x21c068];return _0x5cf199;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b74770d..69b6938 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 _0x19ea=['loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','mapAgentsId','map','_rr'];(function(_0x4de24f,_0x53bacc){var _0x1daf89=function(_0x43bed5){while(--_0x43bed5){_0x4de24f['push'](_0x4de24f['shift']());}};_0x1daf89(++_0x53bacc);}(_0x19ea,0xfe));var _0xa19e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x19ea[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0xa19e('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa19e('0x1'));var config=require('../../../config/environment');config[_0xa19e('0x2')]=_[_0xa19e('0x3')](config[_0xa19e('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa19e('0x2')]));function SmsQueue(_0x2a8e2c){this['id']=_0x2a8e2c['id']||0x0;this[_0xa19e('0x4')]=_0x2a8e2c[_0xa19e('0x4')]||'';this[_0xa19e('0x5')]=_0x2a8e2c[_0xa19e('0x5')]||0xa;this[_0xa19e('0x6')]=_0x2a8e2c[_0xa19e('0x6')]||_0xa19e('0x7');this[_0xa19e('0x8')]=_0x2a8e2c[_0xa19e('0x8')];this['mapAgentsId']={};this[_0xa19e('0x9')]=0x0;this[_0xa19e('0xa')]='';this[_0xa19e('0xb')]();this[_0xa19e('0xc')]();}SmsQueue['prototype'][_0xa19e('0xb')]=function(){var _0x239829=this[_0xa19e('0xd')]['_rr'];this[_0xa19e('0xd')]=_[_0xa19e('0xe')](this[_0xa19e('0x8')],'id');this[_0xa19e('0xd')][_0xa19e('0xf')]=_0x239829;};SmsQueue['prototype'][_0xa19e('0xc')]=function(){this[_0xa19e('0x10')]=0x0;this[_0xa19e('0x11')]=0x0;for(var _0x28dedd=0x0;_0x28dedd=0x0?this[_0xa19e('0x15')]:0x0;var _0x1f37c4={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa19e('0x10')],'name':this['name'],'paused':this[_0xa19e('0x11')],'waiting':this['waiting']};var _0x5ce913=md5(JSON[_0xa19e('0x16')](_0x1f37c4));if(this[_0xa19e('0xa')]!==_0x5ce913){this['md5']=_0x5ce913;io['to'](util[_0xa19e('0x17')](_0xa19e('0x18'),_0x1f37c4[_0xa19e('0x4')]))[_0xa19e('0x19')]('sms_queue:save',_0x1f37c4);}};module[_0xa19e('0x1a')]=SmsQueue; \ No newline at end of file +var _0x593e=['online','smsPause','paused','available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x593e,0xcb));var _0xe593=function(_0x5b6888,_0x499180){_0x5b6888=_0x5b6888-0x0;var _0x294bb3=_0x593e[_0x5b6888];return _0x294bb3;};'use strict';var _=require(_0xe593('0x0'));var md5=require(_0xe593('0x1'));var util=require(_0xe593('0x2'));var Redis=require(_0xe593('0x3'));var config=require(_0xe593('0x4'));config[_0xe593('0x5')]=_[_0xe593('0x6')](config[_0xe593('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe593('0x7'))(new Redis(config[_0xe593('0x5')]));function SmsQueue(_0x404e3a){this['id']=_0x404e3a['id']||0x0;this[_0xe593('0x8')]=_0x404e3a[_0xe593('0x8')]||'';this[_0xe593('0x9')]=_0x404e3a[_0xe593('0x9')]||0xa;this[_0xe593('0xa')]=_0x404e3a[_0xe593('0xa')]||_0xe593('0xb');this['Agents']=_0x404e3a[_0xe593('0xc')];this[_0xe593('0xd')]={};this[_0xe593('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0xe593('0xf')]();}SmsQueue[_0xe593('0x10')][_0xe593('0x11')]=function(){var _0x55fb84=this[_0xe593('0xd')][_0xe593('0x12')];this[_0xe593('0xd')]=_[_0xe593('0x13')](this[_0xe593('0xc')],'id');this[_0xe593('0xd')][_0xe593('0x12')]=_0x55fb84;};SmsQueue[_0xe593('0x10')][_0xe593('0xf')]=function(){this[_0xe593('0x14')]=0x0;this['paused']=0x0;for(var _0x2907e4=0x0;_0x2907e4=0x0?this[_0xe593('0x18')]:0x0;var _0x5f57ce={'id':this['id'],'available':this[_0xe593('0x18')],'loggedIn':this[_0xe593('0x14')],'name':this['name'],'paused':this[_0xe593('0x17')],'waiting':this[_0xe593('0xe')]};var _0x862672=md5(JSON[_0xe593('0x19')](_0x5f57ce));if(this[_0xe593('0x1')]!==_0x862672){this[_0xe593('0x1')]=_0x862672;io['to'](util[_0xe593('0x1a')]('sms:queue:%s',_0x5f57ce['name']))[_0xe593('0x1b')]('sms_queue:save',_0x5f57ce);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index dd9d474..2ffa3ba 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 _0x1056=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','length','whatsappPause','paused','available','whatsapp:queue:%s'];(function(_0xcbc377,_0x5a21f7){var _0x160511=function(_0x296aaf){while(--_0x296aaf){_0xcbc377['push'](_0xcbc377['shift']());}};_0x160511(++_0x5a21f7);}(_0x1056,0x146));var _0x6105=function(_0x2e5790,_0x2aaa53){_0x2e5790=_0x2e5790-0x0;var _0x13c781=_0x1056[_0x2e5790];return _0x13c781;};'use strict';var _=require(_0x6105('0x0'));var md5=require(_0x6105('0x1'));var util=require(_0x6105('0x2'));var Redis=require(_0x6105('0x3'));var config=require(_0x6105('0x4'));config[_0x6105('0x5')]=_[_0x6105('0x6')](config[_0x6105('0x5')],{'host':_0x6105('0x7'),'port':0x18eb});var io=require(_0x6105('0x8'))(new Redis(config[_0x6105('0x5')]));function WhatsappQueue(_0x48cf59){this['id']=_0x48cf59['id']||0x0;this[_0x6105('0x9')]=_0x48cf59[_0x6105('0x9')]||'';this[_0x6105('0xa')]=_0x48cf59['timeout']||0xa;this[_0x6105('0xb')]=_0x48cf59[_0x6105('0xb')]||'beepall';this[_0x6105('0xc')]=_0x48cf59[_0x6105('0xc')];this['mapAgentsId']={};this[_0x6105('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x6105('0xe')]();}WhatsappQueue[_0x6105('0xf')][_0x6105('0x10')]=function(){var _0x48c52a=this[_0x6105('0x11')][_0x6105('0x12')];this[_0x6105('0x11')]=_['map'](this['Agents'],'id');this[_0x6105('0x11')]['_rr']=_0x48c52a;};WhatsappQueue['prototype'][_0x6105('0xe')]=function(){this[_0x6105('0x13')]=0x0;this['paused']=0x0;for(var _0x1e97ab=0x0;_0x1e97ab=0x0?this[_0x6105('0x17')]:0x0;var _0x8dc32e={'id':this['id'],'available':this[_0x6105('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x6105('0xd')]};var _0x34199e=md5(JSON['stringify'](_0x8dc32e));if(this[_0x6105('0x1')]!==_0x34199e){this[_0x6105('0x1')]=_0x34199e;io['to'](util['format'](_0x6105('0x18'),_0x8dc32e['name']))[_0x6105('0x19')]('whatsapp_queue:save',_0x8dc32e);}};module[_0x6105('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xbd98=['available','waiting','format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','online','loggedIn','whatsappPause','paused'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xbd98,0x12f));var _0x8bd9=function(_0x34d1cc,_0xeb7a5){_0x34d1cc=_0x34d1cc-0x0;var _0x374d8a=_0xbd98[_0x34d1cc];return _0x374d8a;};'use strict';var _=require(_0x8bd9('0x0'));var md5=require(_0x8bd9('0x1'));var util=require(_0x8bd9('0x2'));var Redis=require(_0x8bd9('0x3'));var config=require('../../../config/environment');config[_0x8bd9('0x4')]=_[_0x8bd9('0x5')](config['redis'],{'host':_0x8bd9('0x6'),'port':0x18eb});var io=require(_0x8bd9('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x1a0111){this['id']=_0x1a0111['id']||0x0;this[_0x8bd9('0x8')]=_0x1a0111[_0x8bd9('0x8')]||'';this[_0x8bd9('0x9')]=_0x1a0111[_0x8bd9('0x9')]||0xa;this['strategy']=_0x1a0111[_0x8bd9('0xa')]||_0x8bd9('0xb');this['Agents']=_0x1a0111[_0x8bd9('0xc')];this[_0x8bd9('0xd')]={};this['waiting']=0x0;this[_0x8bd9('0x1')]='';this[_0x8bd9('0xe')]();this[_0x8bd9('0xf')]();}WhatsappQueue['prototype'][_0x8bd9('0xe')]=function(){var _0x15b67c=this[_0x8bd9('0xd')]['_rr'];this[_0x8bd9('0xd')]=_[_0x8bd9('0x10')](this[_0x8bd9('0xc')],'id');this[_0x8bd9('0xd')]['_rr']=_0x15b67c;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x472436=0x0;_0x472436=0x0?this[_0x8bd9('0x15')]:0x0;var _0x5a71b4={'id':this['id'],'available':this[_0x8bd9('0x15')],'loggedIn':this[_0x8bd9('0x12')],'name':this[_0x8bd9('0x8')],'paused':this[_0x8bd9('0x14')],'waiting':this[_0x8bd9('0x16')]};var _0x2f7080=md5(JSON['stringify'](_0x5a71b4));if(this[_0x8bd9('0x1')]!==_0x2f7080){this[_0x8bd9('0x1')]=_0x2f7080;io['to'](util[_0x8bd9('0x17')]('whatsapp:queue:%s',_0x5a71b4[_0x8bd9('0x8')]))[_0x8bd9('0x18')](_0x8bd9('0x19'),_0x5a71b4);}};module[_0x8bd9('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9b61319..955130c 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2bd8b5,_0x43cf9d){var _0xabeb51=function(_0x1e93b7){while(--_0x1e93b7){_0x2bd8b5['push'](_0x2bd8b5['shift']());}};_0xabeb51(++_0x43cf9d);}(_0xb10b,0x12a));var _0xbb10=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0xb10b[_0x537c37];return _0x241f84;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x19f4e7,_0x1f0516){var _0x30f45a=function(_0x372bd9){while(--_0x372bd9){_0x19f4e7['push'](_0x19f4e7['shift']());}};_0x30f45a(++_0x1f0516);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a3e69,_0x346f71){_0x5a3e69=_0x5a3e69-0x0;var _0x27073b=_0xb10b[_0x5a3e69];return _0x27073b;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 31b2920..c7b7fc6 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 _0xfb90=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0xdf7d3b,_0x474cea){var _0x675076=function(_0x605a85){while(--_0x605a85){_0xdf7d3b['push'](_0xdf7d3b['shift']());}};_0x675076(++_0x474cea);}(_0xfb90,0x8d));var _0x0fb9=function(_0x2eaa6b,_0x5f3658){_0x2eaa6b=_0x2eaa6b-0x0;var _0x4770c9=_0xfb90[_0x2eaa6b];return _0x4770c9;};'use strict';var client=require(_0x0fb9('0x0'));exports[_0x0fb9('0x1')]=function(_0x50b8d3,_0x2287ed){return client[_0x0fb9('0x2')](_0x0fb9('0x3'),{'body':_0x2287ed,'options':{'where':{'id':_0x50b8d3}},'log':_0x0fb9('0x4')});};exports[_0x0fb9('0x5')]=function(_0xf615d9,_0x42c51b){return client['Request']('AddTagsToChatInteraction',{'body':_0x42c51b,'options':{'where':{'id':_0xf615d9}},'log':_0x0fb9('0x6')});}; \ No newline at end of file +var _0x8f00=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x25c17f,_0x4b3797){var _0x12f306=function(_0x126abb){while(--_0x126abb){_0x25c17f['push'](_0x25c17f['shift']());}};_0x12f306(++_0x4b3797);}(_0x8f00,0x8d));var _0x08f0=function(_0x53126d,_0x279a19){_0x53126d=_0x53126d-0x0;var _0x1bace0=_0x8f00[_0x53126d];return _0x1bace0;};'use strict';var client=require(_0x08f0('0x0'));exports[_0x08f0('0x1')]=function(_0x2a2913,_0x577869){return client[_0x08f0('0x2')](_0x08f0('0x3'),{'body':_0x577869,'options':{'where':{'id':_0x2a2913}},'log':_0x08f0('0x4')});};exports['addTags']=function(_0x132f53,_0x554dce){return client['Request'](_0x08f0('0x5'),{'body':_0x554dce,'options':{'where':{'id':_0x132f53}},'log':_0x08f0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index eee2a2b..972c55c 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 _0x2ee6=['../client','create','Request','createChatMessage'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x2ee6,0x120));var _0x62ee=function(_0x2f7c3c,_0x52b503){_0x2f7c3c=_0x2f7c3c-0x0;var _0x56ea57=_0x2ee6[_0x2f7c3c];return _0x56ea57;};'use strict';var client=require(_0x62ee('0x0'));exports[_0x62ee('0x1')]=function(_0x31ecef){return client[_0x62ee('0x2')]('CreateChatMessage',{'body':_0x31ecef,'log':_0x62ee('0x3')});}; \ No newline at end of file +var _0xd4c3=['../client','create','Request','CreateChatMessage'];(function(_0x338391,_0x4d5e84){var _0x363e1c=function(_0x15f7f6){while(--_0x15f7f6){_0x338391['push'](_0x338391['shift']());}};_0x363e1c(++_0x4d5e84);}(_0xd4c3,0x19c));var _0x3d4c=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0xd4c3[_0xb6e43];return _0x47c40f;};'use strict';var client=require(_0x3d4c('0x0'));exports[_0x3d4c('0x1')]=function(_0xed09a){return client[_0x3d4c('0x2')](_0x3d4c('0x3'),{'body':_0xed09a,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 9221206..38cfcf7 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 _0xe914=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0xbce5f9,_0x56bde0){var _0xe42100=function(_0x5819ce){while(--_0x5819ce){_0xbce5f9['push'](_0xbce5f9['shift']());}};_0xe42100(++_0x56bde0);}(_0xe914,0x7f));var _0x4e91=function(_0x1a6046,_0x2354b3){_0x1a6046=_0x1a6046-0x0;var _0x1dd6a4=_0xe914[_0x1a6046];return _0x1dd6a4;};'use strict';var client=require(_0x4e91('0x0'));exports[_0x4e91('0x1')]=function(){return function(){return client['Request'](_0x4e91('0x2'),{'options':{'raw':![],'attributes':['id',_0x4e91('0x3'),_0x4e91('0x4'),_0x4e91('0x5')],'include':[{'model':_0x4e91('0x6'),'as':_0x4e91('0x7'),'attributes':['id','name',_0x4e91('0x8'),_0x4e91('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x27c9=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x27c9,0x1af));var _0x927c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x27c9[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x927c('0x0'));exports[_0x927c('0x1')]=function(){return function(){return client[_0x927c('0x2')](_0x927c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x927c('0x4'),_0x927c('0x5')],'include':[{'model':'User','as':_0x927c('0x6'),'attributes':['id',_0x927c('0x7'),_0x927c('0x8'),_0x927c('0x9')]}]},'log':_0x927c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0431196..24af597 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 _0x7333=['Request','UpdateChatQueueReport','../client','CreateChatQueueReport','update'];(function(_0x180c9b,_0x13d173){var _0x3ff116=function(_0x241982){while(--_0x241982){_0x180c9b['push'](_0x180c9b['shift']());}};_0x3ff116(++_0x13d173);}(_0x7333,0xfc));var _0x3733=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7333[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x3733('0x0'));exports['create']=function(_0x42c214){return client['Request'](_0x3733('0x1'),{'body':_0x42c214,'log':_0x3733('0x1')});};exports[_0x3733('0x2')]=function(_0x4ad96b,_0x1bf202){return client[_0x3733('0x3')](_0x3733('0x4'),{'body':_0x1bf202,'options':{'where':{'uniqueid':_0x4ad96b},'order':[['id','DESC']],'limit':0x1},'log':_0x3733('0x4')});}; \ No newline at end of file +var _0xadb8=['CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0x23943f,_0x3bedc4){var _0x546900=function(_0x22d6d4){while(--_0x22d6d4){_0x23943f['push'](_0x23943f['shift']());}};_0x546900(++_0x3bedc4);}(_0xadb8,0x1d0));var _0x8adb=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xadb8[_0x257a28];return _0x13bccc;};'use strict';var client=require('../client');exports['create']=function(_0x412fb1){return client['Request'](_0x8adb('0x0'),{'body':_0x412fb1,'log':_0x8adb('0x0')});};exports[_0x8adb('0x1')]=function(_0x1bf88c,_0x44fdf7){return client[_0x8adb('0x2')](_0x8adb('0x3'),{'body':_0x44fdf7,'options':{'where':{'uniqueid':_0x1bf88c},'order':[['id','DESC']],'limit':0x1},'log':_0x8adb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7ebc750..681f272 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x12546e,_0x49a072){var _0x5173d9=function(_0x4b860a){while(--_0x4b860a){_0x12546e['push'](_0x12546e['shift']());}};_0x5173d9(++_0x49a072);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x7a54,0x106));var _0x47a5=function(_0x335a30,_0x140fb2){_0x335a30=_0x335a30-0x0;var _0x4878ae=_0x7a54[_0x335a30];return _0x4878ae;};'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 65914e1..ba71513 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 _0x6f2d=['../client','Request'];(function(_0x261c44,_0x46ca7f){var _0x3180ce=function(_0x3144d0){while(--_0x3144d0){_0x261c44['push'](_0x261c44['shift']());}};_0x3180ce(++_0x46ca7f);}(_0x6f2d,0x90));var _0xd6f2=function(_0x5631e7,_0x8cafb6){_0x5631e7=_0x5631e7-0x0;var _0x40c8cf=_0x6f2d[_0x5631e7];return _0x40c8cf;};'use strict';var client=require(_0xd6f2('0x0'));exports['create']=function(_0x3369d5){return client[_0xd6f2('0x1')]('CreateFaxMessage',{'body':_0x3369d5,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x7328=['CreateFaxMessage'];(function(_0x531249,_0x5dd36b){var _0x46c332=function(_0x1384f3){while(--_0x1384f3){_0x531249['push'](_0x531249['shift']());}};_0x46c332(++_0x5dd36b);}(_0x7328,0xca));var _0x8732=function(_0x185c5e,_0x1b05f5){_0x185c5e=_0x185c5e-0x0;var _0x14053a=_0x7328[_0x185c5e];return _0x14053a;};'use strict';var client=require('../client');exports['create']=function(_0x2822da){return client['Request'](_0x8732('0x0'),{'body':_0x2822da,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a3923b9..8b8372e 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 _0x2824=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x9a1d1,_0x3e51a4){var _0xbb05ad=function(_0x360058){while(--_0x360058){_0x9a1d1['push'](_0x9a1d1['shift']());}};_0xbb05ad(++_0x3e51a4);}(_0x2824,0x12e));var _0x4282=function(_0x4c7011,_0x458ad9){_0x4c7011=_0x4c7011-0x0;var _0x19daaf=_0x2824[_0x4c7011];return _0x19daaf;};'use strict';var client=require(_0x4282('0x0'));exports[_0x4282('0x1')]=function(){return function(){return client[_0x4282('0x2')](_0x4282('0x3'),{'options':{'raw':![],'attributes':['id',_0x4282('0x4'),_0x4282('0x5'),_0x4282('0x6')],'include':[{'model':_0x4282('0x7'),'as':_0x4282('0x8'),'attributes':['id',_0x4282('0x4'),_0x4282('0x9'),_0x4282('0xa')]}]},'log':_0x4282('0x1')});};}; \ No newline at end of file +var _0x15cd=['timeout','strategy','User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0xc394d6,_0x4cb5bf){var _0x356755=function(_0x48962c){while(--_0x48962c){_0xc394d6['push'](_0xc394d6['shift']());}};_0x356755(++_0x4cb5bf);}(_0x15cd,0x13b));var _0xd15c=function(_0x45f6e2,_0xe72d77){_0x45f6e2=_0x45f6e2-0x0;var _0x573b09=_0x15cd[_0x45f6e2];return _0x573b09;};'use strict';var client=require(_0xd15c('0x0'));exports[_0xd15c('0x1')]=function(){return function(){return client[_0xd15c('0x2')](_0xd15c('0x3'),{'options':{'raw':![],'attributes':['id',_0xd15c('0x4'),_0xd15c('0x5'),_0xd15c('0x6')],'include':[{'model':_0xd15c('0x7'),'as':_0xd15c('0x8'),'attributes':['id',_0xd15c('0x4'),'online',_0xd15c('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4e39d15..9e1b719 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 _0xed1f=['../client','create','CreateFaxQueueReport','update','Request','DESC','UpdateFaxQueueReport'];(function(_0x241717,_0x27d008){var _0x5df801=function(_0x3c749d){while(--_0x3c749d){_0x241717['push'](_0x241717['shift']());}};_0x5df801(++_0x27d008);}(_0xed1f,0x103));var _0xfed1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xed1f[_0x344a3f];return _0x264712;};'use strict';var client=require(_0xfed1('0x0'));exports[_0xfed1('0x1')]=function(_0x32d250){return client['Request'](_0xfed1('0x2'),{'body':_0x32d250,'log':'CreateFaxQueueReport'});};exports[_0xfed1('0x3')]=function(_0x2087b1,_0x11648b){return client[_0xfed1('0x4')]('UpdateFaxQueueReport',{'body':_0x11648b,'options':{'where':{'uniqueid':_0x2087b1},'order':[['id',_0xfed1('0x5')]],'limit':0x1},'log':_0xfed1('0x6')});}; \ No newline at end of file +var _0x9e27=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','../client','create'];(function(_0x33b607,_0x41b281){var _0x48e02e=function(_0x4fdf54){while(--_0x4fdf54){_0x33b607['push'](_0x33b607['shift']());}};_0x48e02e(++_0x41b281);}(_0x9e27,0x16c));var _0x79e2=function(_0x20c5bb,_0x3a2d8a){_0x20c5bb=_0x20c5bb-0x0;var _0x1e7263=_0x9e27[_0x20c5bb];return _0x1e7263;};'use strict';var client=require(_0x79e2('0x0'));exports[_0x79e2('0x1')]=function(_0x320867){return client['Request'](_0x79e2('0x2'),{'body':_0x320867,'log':_0x79e2('0x2')});};exports[_0x79e2('0x3')]=function(_0x37cb05,_0x5aa628){return client[_0x79e2('0x4')]('UpdateFaxQueueReport',{'body':_0x5aa628,'options':{'where':{'uniqueid':_0x37cb05},'order':[['id','DESC']],'limit':0x1},'log':_0x79e2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 84b6ade..f1197d4 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 _0xd903=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0xbdfc1d,_0x34f769){var _0x2d0ba8=function(_0xd437a2){while(--_0xd437a2){_0xbdfc1d['push'](_0xbdfc1d['shift']());}};_0x2d0ba8(++_0x34f769);}(_0xd903,0xfe));var _0x3d90=function(_0x3a289e,_0x129fb6){_0x3a289e=_0x3a289e-0x0;var _0x2ae6ad=_0xd903[_0x3a289e];return _0x2ae6ad;};'use strict';var client=require(_0x3d90('0x0'));exports[_0x3d90('0x1')]=function(){return function(){return client[_0x3d90('0x2')](_0x3d90('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3d90('0x4')],'include':[{'model':_0x3d90('0x5'),'as':_0x3d90('0x6'),'attributes':['id','name',_0x3d90('0x7')]}]},'log':_0x3d90('0x1')});};}; \ No newline at end of file +var _0xe36e=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x5a5ffb,_0x3aaf44){var _0x12d821=function(_0x56d1ac){while(--_0x56d1ac){_0x5a5ffb['push'](_0x5a5ffb['shift']());}};_0x12d821(++_0x3aaf44);}(_0xe36e,0x178));var _0xee36=function(_0x3d4b6d,_0x564401){_0x3d4b6d=_0x3d4b6d-0x0;var _0x5a65fb=_0xe36e[_0x3d4b6d];return _0x5a65fb;};'use strict';var client=require(_0xee36('0x0'));exports[_0xee36('0x1')]=function(){return function(){return client['Request'](_0xee36('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xee36('0x3')],'include':[{'model':_0xee36('0x4'),'as':_0xee36('0x5'),'attributes':['id','name',_0xee36('0x6')]}]},'log':_0xee36('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0990fa3..961cc46 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 _0xb78e=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xb6b134,_0x5a7dae){var _0x3e73b2=function(_0xb29992){while(--_0xb29992){_0xb6b134['push'](_0xb6b134['shift']());}};_0x3e73b2(++_0x5a7dae);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5e657c,_0x2fd53d){_0x5e657c=_0x5e657c-0x0;var _0x310582=_0xb78e[_0x5e657c];return _0x310582;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(_0x4b8534,_0x1570f5){return client[_0xeb78('0x2')](_0xeb78('0x3'),{'body':_0x1570f5,'options':{'where':{'id':_0x4b8534}},'log':_0xeb78('0x4')});};exports[_0xeb78('0x5')]=function(_0x308d12,_0x13ef9d){return client[_0xeb78('0x2')]('AddTagsToMailInteraction',{'body':_0x13ef9d,'options':{'where':{'id':_0x308d12}},'log':_0xeb78('0x6')});}; \ No newline at end of file +var _0xd824=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0xd824,0xc2));var _0x4d82=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd824[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x4d82('0x0'));exports[_0x4d82('0x1')]=function(_0x572eea,_0x53fe9a){return client[_0x4d82('0x2')](_0x4d82('0x3'),{'body':_0x53fe9a,'options':{'where':{'id':_0x572eea}},'log':_0x4d82('0x4')});};exports[_0x4d82('0x5')]=function(_0x287fbf,_0x1c8ad9){return client['Request']('AddTagsToMailInteraction',{'body':_0x1c8ad9,'options':{'where':{'id':_0x287fbf}},'log':_0x4d82('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b9f5e0b..0ce46b0 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 _0xdb36=['Request','CreateMailMessage','../client','create'];(function(_0x434aa8,_0x3df4eb){var _0xfe64e6=function(_0x43ee29){while(--_0x43ee29){_0x434aa8['push'](_0x434aa8['shift']());}};_0xfe64e6(++_0x3df4eb);}(_0xdb36,0xce));var _0x6db3=function(_0x2169b2,_0x4742b4){_0x2169b2=_0x2169b2-0x0;var _0x475059=_0xdb36[_0x2169b2];return _0x475059;};'use strict';var client=require(_0x6db3('0x0'));exports[_0x6db3('0x1')]=function(_0x2cd7d7){return client[_0x6db3('0x2')](_0x6db3('0x3'),{'body':_0x2cd7d7,'log':'createMailMessage'});}; \ No newline at end of file +var _0x9c61=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xa1c2e6,_0x2a3b1b){var _0x26c9a8=function(_0x5662a1){while(--_0x5662a1){_0xa1c2e6['push'](_0xa1c2e6['shift']());}};_0x26c9a8(++_0x2a3b1b);}(_0x9c61,0x7d));var _0x19c6=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0x9c61[_0x4ede09];return _0x253193;};'use strict';var client=require(_0x19c6('0x0'));exports[_0x19c6('0x1')]=function(_0x2d40c4){return client[_0x19c6('0x2')](_0x19c6('0x3'),{'body':_0x2d40c4,'log':_0x19c6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 61a3030..339a8b5 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 _0xf05f=['User','Agents','name','online','mailPause','../client','getMailQueues','timeout','strategy'];(function(_0x6d6f94,_0x654d80){var _0x4bed6a=function(_0x17f69c){while(--_0x17f69c){_0x6d6f94['push'](_0x6d6f94['shift']());}};_0x4bed6a(++_0x654d80);}(_0xf05f,0xcb));var _0xff05=function(_0xdf8600,_0x3ee488){_0xdf8600=_0xdf8600-0x0;var _0x2e67af=_0xf05f[_0xdf8600];return _0x2e67af;};'use strict';var client=require(_0xff05('0x0'));exports[_0xff05('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xff05('0x2'),_0xff05('0x3')],'include':[{'model':_0xff05('0x4'),'as':_0xff05('0x5'),'attributes':['id',_0xff05('0x6'),_0xff05('0x7'),_0xff05('0x8')]}]},'log':_0xff05('0x1')});};}; \ No newline at end of file +var _0x11dd=['Request','strategy','User','name','online','mailPause','getMailQueues'];(function(_0x45da38,_0x4ce087){var _0x520d3c=function(_0x5e2d97){while(--_0x5e2d97){_0x45da38['push'](_0x45da38['shift']());}};_0x520d3c(++_0x4ce087);}(_0x11dd,0x8c));var _0xd11d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x11dd[_0x3e5086];return _0xfeb102;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xd11d('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xd11d('0x1')],'include':[{'model':_0xd11d('0x2'),'as':'Agents','attributes':['id',_0xd11d('0x3'),_0xd11d('0x4'),_0xd11d('0x5')]}]},'log':_0xd11d('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0a5a108..acc0b07 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 _0xcb52=['Request','CreateMailQueueReport','update','DESC','../client','create'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xcb52,0x1e4));var _0x2cb5=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0xcb52[_0x5d07ff];return _0x5226ad;};'use strict';var client=require(_0x2cb5('0x0'));exports[_0x2cb5('0x1')]=function(_0x1499ad){return client[_0x2cb5('0x2')](_0x2cb5('0x3'),{'body':_0x1499ad,'log':_0x2cb5('0x3')});};exports[_0x2cb5('0x4')]=function(_0x440d66,_0x182202){return client[_0x2cb5('0x2')]('UpdateMailQueueReport',{'body':_0x182202,'options':{'where':{'uniqueid':_0x440d66},'order':[['id',_0x2cb5('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x89ad=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x3e4270,_0xe446cd){var _0x5670ee=function(_0x493a1a){while(--_0x493a1a){_0x3e4270['push'](_0x3e4270['shift']());}};_0x5670ee(++_0xe446cd);}(_0x89ad,0x11b));var _0xd89a=function(_0x279229,_0x1d69d9){_0x279229=_0x279229-0x0;var _0x195ca7=_0x89ad[_0x279229];return _0x195ca7;};'use strict';var client=require(_0xd89a('0x0'));exports[_0xd89a('0x1')]=function(_0x17755c){return client[_0xd89a('0x2')](_0xd89a('0x3'),{'body':_0x17755c,'log':_0xd89a('0x3')});};exports[_0xd89a('0x4')]=function(_0x31a2d1,_0x406402){return client[_0xd89a('0x2')](_0xd89a('0x5'),{'body':_0x406402,'options':{'where':{'uniqueid':_0x31a2d1},'order':[['id',_0xd89a('0x6')]],'limit':0x1},'log':_0xd89a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index dc2d124..d838e11 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 _0xc411=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x4dae00,_0x15b194){var _0x16bf42=function(_0x5f2a9a){while(--_0x5f2a9a){_0x4dae00['push'](_0x4dae00['shift']());}};_0x16bf42(++_0x15b194);}(_0xc411,0x132));var _0x1c41=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xc411[_0x2132a3];return _0x21890c;};'use strict';var client=require('../client');exports[_0x1c41('0x0')]=function(_0x14688a,_0x4e6fa5){return client['Request'](_0x1c41('0x1'),{'body':_0x4e6fa5,'options':{'where':{'id':_0x14688a}},'log':_0x1c41('0x2')});};exports[_0x1c41('0x3')]=function(_0x4f5207,_0x46903e){return client[_0x1c41('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x46903e,'options':{'where':{'id':_0x4f5207}},'log':_0x1c41('0x5')});}; \ No newline at end of file +var _0x502f=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x502f,0x1ec));var _0xf502=function(_0x68b7a5,_0xefe370){_0x68b7a5=_0x68b7a5-0x0;var _0x3e9ed2=_0x502f[_0x68b7a5];return _0x3e9ed2;};'use strict';var client=require(_0xf502('0x0'));exports[_0xf502('0x1')]=function(_0x144260,_0x2bf829){return client[_0xf502('0x2')](_0xf502('0x3'),{'body':_0x2bf829,'options':{'where':{'id':_0x144260}},'log':_0xf502('0x4')});};exports[_0xf502('0x5')]=function(_0x50e5e9,_0x4202c8){return client[_0xf502('0x2')](_0xf502('0x6'),{'body':_0x4202c8,'options':{'where':{'id':_0x50e5e9}},'log':_0xf502('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d5e1e15..389cdef 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 _0xc47d=['create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0xc47d,0x17a));var _0xdc47=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xc47d[_0x20c9b2];return _0x2c6030;};'use strict';var client=require('../client');exports[_0xdc47('0x0')]=function(_0x254e56){return client['Request'](_0xdc47('0x1'),{'body':_0x254e56,'log':_0xdc47('0x2')});}; \ No newline at end of file +var _0x3460=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x3460,0x12e));var _0x0346=function(_0x15680d,_0x5790f1){_0x15680d=_0x15680d-0x0;var _0x4b1b2f=_0x3460[_0x15680d];return _0x4b1b2f;};'use strict';var client=require(_0x0346('0x0'));exports[_0x0346('0x1')]=function(_0x387e02){return client[_0x0346('0x2')](_0x0346('0x3'),{'body':_0x387e02,'log':_0x0346('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 47555f0..0913809 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 _0x6b87=['getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','name','online','openchannelPause'];(function(_0x285159,_0x434500){var _0x3ade27=function(_0x47e9ba){while(--_0x47e9ba){_0x285159['push'](_0x285159['shift']());}};_0x3ade27(++_0x434500);}(_0x6b87,0x15f));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x76b8('0x0')]=function(){return function(){return client[_0x76b8('0x1')](_0x76b8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x76b8('0x3'),_0x76b8('0x4')],'include':[{'model':_0x76b8('0x5'),'as':'Agents','attributes':['id',_0x76b8('0x6'),_0x76b8('0x7'),_0x76b8('0x8')]}]},'log':_0x76b8('0x0')});};}; \ No newline at end of file +var _0x6093=['name','strategy','User','online','openchannelPause','getOpenchannelQueues'];(function(_0x3a4d28,_0x3c5eda){var _0x32c5bd=function(_0x17cbe){while(--_0x17cbe){_0x3a4d28['push'](_0x3a4d28['shift']());}};_0x32c5bd(++_0x3c5eda);}(_0x6093,0x144));var _0x3609=function(_0x40ad6f,_0x7f4e4){_0x40ad6f=_0x40ad6f-0x0;var _0x341e74=_0x6093[_0x40ad6f];return _0x341e74;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3609('0x0'),'timeout',_0x3609('0x1')],'include':[{'model':_0x3609('0x2'),'as':'Agents','attributes':['id',_0x3609('0x0'),_0x3609('0x3'),_0x3609('0x4')]}]},'log':_0x3609('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 46e1615..6d27e51 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 _0x7208=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x21ab32,_0x622b40){var _0x55146d=function(_0x76aee2){while(--_0x76aee2){_0x21ab32['push'](_0x21ab32['shift']());}};_0x55146d(++_0x622b40);}(_0x7208,0x199));var _0x8720=function(_0x59d032,_0x321bd4){_0x59d032=_0x59d032-0x0;var _0x20b579=_0x7208[_0x59d032];return _0x20b579;};'use strict';var client=require(_0x8720('0x0'));exports[_0x8720('0x1')]=function(_0x3d1845){return client[_0x8720('0x2')](_0x8720('0x3'),{'body':_0x3d1845,'log':'CreateOpenchannelQueueReport'});};exports[_0x8720('0x4')]=function(_0x153d47,_0x4fdf07){return client[_0x8720('0x2')](_0x8720('0x5'),{'body':_0x4fdf07,'options':{'where':{'uniqueid':_0x153d47},'order':[['id',_0x8720('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3246=['../client','create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x451d28,_0x2a5f3d){var _0x2a1b41=function(_0x33a82b){while(--_0x33a82b){_0x451d28['push'](_0x451d28['shift']());}};_0x2a1b41(++_0x2a5f3d);}(_0x3246,0x1ce));var _0x6324=function(_0x1d9fd7,_0x5f3aa6){_0x1d9fd7=_0x1d9fd7-0x0;var _0x32aa90=_0x3246[_0x1d9fd7];return _0x32aa90;};'use strict';var client=require(_0x6324('0x0'));exports[_0x6324('0x1')]=function(_0x1d7dae){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x1d7dae,'log':_0x6324('0x2')});};exports['update']=function(_0x580233,_0x459f68){return client[_0x6324('0x3')](_0x6324('0x4'),{'body':_0x459f68,'options':{'where':{'uniqueid':_0x580233},'order':[['id',_0x6324('0x5')]],'limit':0x1},'log':_0x6324('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e066115..9ef06ba 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 _0xb26e=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xb26e,0x11d));var _0xeb26=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0xb26e[_0x2e9b5b];return _0x734c46;};'use strict';var client=require(_0xeb26('0x0'));exports['update']=function(_0x59dc2a,_0x522afd){return client[_0xeb26('0x1')](_0xeb26('0x2'),{'body':_0x522afd,'options':{'where':{'id':_0x59dc2a}},'log':'updateSmsInteraction'});};exports[_0xeb26('0x3')]=function(_0x3b8a6f,_0x2817de){return client[_0xeb26('0x1')](_0xeb26('0x4'),{'body':_0x2817de,'options':{'where':{'id':_0x3b8a6f}},'log':_0xeb26('0x5')});}; \ No newline at end of file +var _0x0dec=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','Request'];(function(_0x475eed,_0x1e1ffb){var _0x1e3e69=function(_0x46b201){while(--_0x46b201){_0x475eed['push'](_0x475eed['shift']());}};_0x1e3e69(++_0x1e1ffb);}(_0x0dec,0x11c));var _0xc0de=function(_0x11922e,_0x1d3460){_0x11922e=_0x11922e-0x0;var _0x547eb5=_0x0dec[_0x11922e];return _0x547eb5;};'use strict';var client=require(_0xc0de('0x0'));exports[_0xc0de('0x1')]=function(_0x44960d,_0x3b5525){return client['Request'](_0xc0de('0x2'),{'body':_0x3b5525,'options':{'where':{'id':_0x44960d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x24091c,_0x1a263e){return client[_0xc0de('0x3')](_0xc0de('0x4'),{'body':_0x1a263e,'options':{'where':{'id':_0x24091c}},'log':_0xc0de('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9290da9..0b5cbad 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 _0xa93d=['CreateSmsMessage','../client','Request'];(function(_0x511b17,_0xe6b453){var _0x4fa333=function(_0x5f13e3){while(--_0x5f13e3){_0x511b17['push'](_0x511b17['shift']());}};_0x4fa333(++_0xe6b453);}(_0xa93d,0xa6));var _0xda93=function(_0x29c122,_0x3abac9){_0x29c122=_0x29c122-0x0;var _0x349f8e=_0xa93d[_0x29c122];return _0x349f8e;};'use strict';var client=require(_0xda93('0x0'));exports['create']=function(_0x45b01c){return client[_0xda93('0x1')](_0xda93('0x2'),{'body':_0x45b01c,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xd3ca=['CreateSmsMessage','../client','Request'];(function(_0x43cc4c,_0x5caae5){var _0x23ffb2=function(_0x2d86d2){while(--_0x2d86d2){_0x43cc4c['push'](_0x43cc4c['shift']());}};_0x23ffb2(++_0x5caae5);}(_0xd3ca,0x103));var _0xad3c=function(_0xb23c05,_0xbb6c8a){_0xb23c05=_0xb23c05-0x0;var _0xde8542=_0xd3ca[_0xb23c05];return _0xde8542;};'use strict';var client=require(_0xad3c('0x0'));exports['create']=function(_0x24bfc0){return client[_0xad3c('0x1')](_0xad3c('0x2'),{'body':_0x24bfc0,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c2a5980..39b4d83 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x445644,_0x21d545){var _0x536427=function(_0x44cf09){while(--_0x44cf09){_0x445644['push'](_0x445644['shift']());}};_0x536427(++_0x21d545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index fb66d88..b61b8e9 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x1e5e49,_0x530fab){var _0x1592de=function(_0x36d04c){while(--_0x36d04c){_0x1e5e49['push'](_0x1e5e49['shift']());}};_0x1592de(++_0x530fab);}(_0x55ca,0x126));var _0xa55c=function(_0x378a07,_0x26dbbe){_0x378a07=_0x378a07-0x0;var _0x1013e7=_0x55ca[_0x378a07];return _0x1013e7;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xebd4db,_0x4fae47){var _0x396dc3=function(_0x2d71fb){while(--_0x2d71fb){_0xebd4db['push'](_0xebd4db['shift']());}};_0x396dc3(++_0x4fae47);}(_0x55ca,0x126));var _0xa55c=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x55ca[_0x3cba93];return _0x4a2991;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 842285a..e459f1a 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(_0x247271,_0x42af02){var _0x52a8d3=function(_0x7d8781){while(--_0x7d8781){_0x247271['push'](_0x247271['shift']());}};_0x52a8d3(++_0x42af02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x433711,_0x5b2510){var _0x5447fb=function(_0x520d3c){while(--_0x520d3c){_0x433711['push'](_0x433711['shift']());}};_0x5447fb(++_0x5b2510);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 5515ddb..3de2444 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 _0xbb67=['Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xbb67,0x161));var _0x7bb6=function(_0x26b6d8,_0x24514d){_0x26b6d8=_0x26b6d8-0x0;var _0x39be02=_0xbb67[_0x26b6d8];return _0x39be02;};'use strict';var client=require('../client');exports[_0x7bb6('0x0')]=function(_0x307b4e,_0xd27f19){return client[_0x7bb6('0x1')](_0x7bb6('0x2'),{'body':_0xd27f19,'options':{'where':{'id':_0x307b4e}},'log':'updateWhatsappInteraction'});};exports[_0x7bb6('0x3')]=function(_0x2c1ddb,_0x1f527c){return client[_0x7bb6('0x1')](_0x7bb6('0x4'),{'body':_0x1f527c,'options':{'where':{'id':_0x2c1ddb}},'log':_0x7bb6('0x5')});}; \ No newline at end of file +var _0x11e5=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x512e05,_0x29ea59){var _0x3d3b61=function(_0x2cfc37){while(--_0x2cfc37){_0x512e05['push'](_0x512e05['shift']());}};_0x3d3b61(++_0x29ea59);}(_0x11e5,0x8b));var _0x511e=function(_0x467aba,_0x4ec941){_0x467aba=_0x467aba-0x0;var _0x379b93=_0x11e5[_0x467aba];return _0x379b93;};'use strict';var client=require(_0x511e('0x0'));exports['update']=function(_0xfd6709,_0x269c68){return client['Request'](_0x511e('0x1'),{'body':_0x269c68,'options':{'where':{'id':_0xfd6709}},'log':_0x511e('0x2')});};exports[_0x511e('0x3')]=function(_0x5cab33,_0x249e4d){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x249e4d,'options':{'where':{'id':_0x5cab33}},'log':_0x511e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3b591af..924784a 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 _0x4825=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0x4825,0xb4));var _0x5482=function(_0x5092f8,_0x2a57bd){_0x5092f8=_0x5092f8-0x0;var _0x415fe6=_0x4825[_0x5092f8];return _0x415fe6;};'use strict';var client=require('../client');exports[_0x5482('0x0')]=function(_0x423b84){return client[_0x5482('0x1')](_0x5482('0x2'),{'body':_0x423b84,'log':_0x5482('0x3')});}; \ No newline at end of file +var _0xbc98=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x507d08,_0x332386){var _0x10cd49=function(_0x58ee91){while(--_0x58ee91){_0x507d08['push'](_0x507d08['shift']());}};_0x10cd49(++_0x332386);}(_0xbc98,0x136));var _0x8bc9=function(_0x583fac,_0xf4790e){_0x583fac=_0x583fac-0x0;var _0x44c888=_0xbc98[_0x583fac];return _0x44c888;};'use strict';var client=require(_0x8bc9('0x0'));exports[_0x8bc9('0x1')]=function(_0x3ac4af){return client[_0x8bc9('0x2')](_0x8bc9('0x3'),{'body':_0x3ac4af,'log':_0x8bc9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bd75650..b6f65fb 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 _0xd179=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x143511,_0x2c2021){var _0x1030de=function(_0x2a574f){while(--_0x2a574f){_0x143511['push'](_0x143511['shift']());}};_0x1030de(++_0x2c2021);}(_0xd179,0x13e));var _0x9d17=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xd179[_0x4914e2];return _0x2dcd07;};'use strict';var client=require(_0x9d17('0x0'));exports[_0x9d17('0x1')]=function(){return function(){return client[_0x9d17('0x2')](_0x9d17('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9d17('0x4'),_0x9d17('0x5')],'include':[{'model':_0x9d17('0x6'),'as':_0x9d17('0x7'),'attributes':['id',_0x9d17('0x8'),_0x9d17('0x9'),_0x9d17('0xa')]}]},'log':_0x9d17('0x1')});};}; \ No newline at end of file +var _0xc881=['getWhatsappQueues','GetWhatsappQueue','name','timeout','Agents','online','../client'];(function(_0x37512d,_0x2da3d9){var _0x2c356f=function(_0x5914ae){while(--_0x5914ae){_0x37512d['push'](_0x37512d['shift']());}};_0x2c356f(++_0x2da3d9);}(_0xc881,0xae));var _0x1c88=function(_0x2187b0,_0x10504c){_0x2187b0=_0x2187b0-0x0;var _0x341dc1=_0xc881[_0x2187b0];return _0x341dc1;};'use strict';var client=require(_0x1c88('0x0'));exports[_0x1c88('0x1')]=function(){return function(){return client['Request'](_0x1c88('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c88('0x3'),_0x1c88('0x4'),'strategy'],'include':[{'model':'User','as':_0x1c88('0x5'),'attributes':['id',_0x1c88('0x3'),_0x1c88('0x6'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 559d6cd..49cbf3b 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 _0xe228=['../client','create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0xc5fb3b,_0x4ff195){var _0x1fcc9a=function(_0x45df49){while(--_0x45df49){_0xc5fb3b['push'](_0xc5fb3b['shift']());}};_0x1fcc9a(++_0x4ff195);}(_0xe228,0x1ea));var _0x8e22=function(_0x3d3803,_0x3f40c9){_0x3d3803=_0x3d3803-0x0;var _0x58652e=_0xe228[_0x3d3803];return _0x58652e;};'use strict';var client=require(_0x8e22('0x0'));exports[_0x8e22('0x1')]=function(_0x1b96d2){return client[_0x8e22('0x2')](_0x8e22('0x3'),{'body':_0x1b96d2,'log':_0x8e22('0x3')});};exports[_0x8e22('0x4')]=function(_0x5c3c4f,_0x34a26e){return client[_0x8e22('0x2')]('UpdateWhatsappQueueReport',{'body':_0x34a26e,'options':{'where':{'uniqueid':_0x5c3c4f},'order':[['id',_0x8e22('0x5')]],'limit':0x1},'log':_0x8e22('0x6')});}; \ No newline at end of file +var _0xae1c=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xae1c,0x194));var _0xcae1=function(_0x6c82cf,_0x121c8f){_0x6c82cf=_0x6c82cf-0x0;var _0x3ef004=_0xae1c[_0x6c82cf];return _0x3ef004;};'use strict';var client=require(_0xcae1('0x0'));exports[_0xcae1('0x1')]=function(_0x2b92d4){return client[_0xcae1('0x2')](_0xcae1('0x3'),{'body':_0x2b92d4,'log':_0xcae1('0x3')});};exports[_0xcae1('0x4')]=function(_0x10e95a,_0x3cf650){return client['Request'](_0xcae1('0x5'),{'body':_0x3cf650,'options':{'where':{'uniqueid':_0x10e95a},'order':[['id',_0xcae1('0x6')]],'limit':0x1},'log':_0xcae1('0x5')});}; \ 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 32def4c..73eddf4 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 _0xab88=['consequence','length','error','map','join','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x524df2,_0x831687){var _0x1d0310=function(_0x50f18a){while(--_0x50f18a){_0x524df2['push'](_0x524df2['shift']());}};_0x1d0310(++_0x831687);}(_0xab88,0x1dd));var _0x8ab8=function(_0x52991d,_0x429d72){_0x52991d=_0x52991d-0x0;var _0x5b9004=_0xab88[_0x52991d];return _0x5b9004;};'use strict';var schema=require(_0x8ab8('0x0'));var _=require(_0x8ab8('0x1'));var util=require(_0x8ab8('0x2'));var seqqueue=require(_0x8ab8('0x3'));var logger=require(_0x8ab8('0x4'))(_0x8ab8('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x8ab8('0x6')},'timeout':{'type':_0x8ab8('0x7'),'message':_0x8ab8('0x8')}});function writeLog(_0x1d4f7d,_0x2a8286,_0x2fab0c){return logger['info'](util[_0x8ab8('0x9')](_0x8ab8('0xa'),_0x1d4f7d,_0x2a8286[_0x8ab8('0xb')],_0x2fab0c));}function handleFindAgent(_0x190f9b){return function(_0x33769d){return _0x33769d[_0x8ab8('0xb')][_0x8ab8('0xc')]()===_0x190f9b[_0x8ab8('0xc')]();};}exports[_0x8ab8('0xd')]=function(_0x528e4a,_0x2faf53,_0x9cdfeb,_0x41399e){return function(_0x96831c){try{var _0x4f9c8f={'name':_0x2faf53[0x0],'timeout':_0x2faf53[0x1]};var _0x4e1ad6=queue['validate'](_0x4f9c8f,{'typecast':!![]});if(_0x4e1ad6[_0x8ab8('0xe')]){logger[_0x8ab8('0xf')]('[%s][AGENT]\x20%s',_0x528e4a,_[_0x8ab8('0x10')](_0x4e1ad6,'message')[_0x8ab8('0x11')](',\x20'));_0x96831c[_0x8ab8('0x12')]();}else{var _0x385508=_[_0x8ab8('0x13')](_0x9cdfeb[_0x8ab8('0x14')],handleFindAgent(_0x4f9c8f[_0x8ab8('0xb')]));if(_0x385508){var _0x442270=(_0x4f9c8f[_0x8ab8('0x15')]||0xa)*0x3e8;var _0x213d23,_0x3dff23;var _0x4e97a7=seqqueue['createQueue'](_0x442270);_0x4e97a7['id']=_0x528e4a;_0x4e97a7[_0x8ab8('0x16')]=_0x442270;_0x4e97a7['channel']=_0x41399e[_0x8ab8('0x17')];writeLog(_0x528e4a,_0x385508,util[_0x8ab8('0x9')](_0x8ab8('0x18'),_0x442270));_0x9cdfeb[_0x8ab8('0x19')][_0x528e4a]['on'](_0x8ab8('0x1a'),function(){logger[_0x8ab8('0x1b')](_0x8ab8('0x1c'),_0x528e4a);clearTimeout(_0x3dff23);_0x3dff23=undefined;_0x4e97a7[_0x8ab8('0x1d')]();if(_0x9cdfeb[_0x8ab8('0x19')][_0x528e4a]){delete _0x9cdfeb['rules'][_0x528e4a];}_0x96831c[_0x8ab8('0x12')]();});_0x9cdfeb[_0x8ab8('0x19')][_0x528e4a]['on']('complete',function(){if(_0x9cdfeb[_0x8ab8('0x19')][_0x528e4a]){delete _0x9cdfeb[_0x8ab8('0x19')][_0x528e4a];}});_0x3dff23=setTimeout(function(){logger[_0x8ab8('0x1b')]('[%s][AGENT]\x20ROUTING\x20END',_0x528e4a);clearTimeout(_0x3dff23);_0x4e97a7[_0x8ab8('0x1d')]();_0x96831c[_0x8ab8('0x1e')]();},_0x442270);strategy['agent'](_0x4e97a7,_0x385508,_0x9cdfeb,_0x41399e);}else{logger[_0x8ab8('0xf')](_0x8ab8('0x1f'),_0x528e4a,_0x4f9c8f[_0x8ab8('0xb')]);_0x96831c['stop']();}}}catch(_0x277918){console[_0x8ab8('0x20')](_0x277918);logger[_0x8ab8('0xf')](_0x8ab8('0x21'),_0x528e4a,_0x277918[_0x8ab8('0x22')]);_0x96831c['stop']();}};}; \ No newline at end of file +var _0xa9b6=['agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0xa9b6,0x1c2));var _0x6a9b=function(_0x58cf48,_0x1d4634){_0x58cf48=_0x58cf48-0x0;var _0x1e8163=_0xa9b6[_0x58cf48];return _0x1e8163;};'use strict';var schema=require(_0x6a9b('0x0'));var _=require(_0x6a9b('0x1'));var util=require(_0x6a9b('0x2'));var seqqueue=require(_0x6a9b('0x3'));var logger=require(_0x6a9b('0x4'))(_0x6a9b('0x5'));var strategy=require(_0x6a9b('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6a9b('0x7')},'timeout':{'type':_0x6a9b('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4ac098,_0x54c5e4,_0x56ff2c){return logger[_0x6a9b('0x9')](util[_0x6a9b('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4ac098,_0x54c5e4[_0x6a9b('0xb')],_0x56ff2c));}function handleFindAgent(_0x1a6930){return function(_0x5cc35f){return _0x5cc35f[_0x6a9b('0xb')][_0x6a9b('0xc')]()===_0x1a6930[_0x6a9b('0xc')]();};}exports[_0x6a9b('0xd')]=function(_0x542e19,_0x558094,_0x4685dd,_0x6684dc){return function(_0x443330){try{var _0x7e523f={'name':_0x558094[0x0],'timeout':_0x558094[0x1]};var _0x432044=queue[_0x6a9b('0x0')](_0x7e523f,{'typecast':!![]});if(_0x432044['length']){logger['error'](_0x6a9b('0xe'),_0x542e19,_[_0x6a9b('0xf')](_0x432044,_0x6a9b('0x10'))[_0x6a9b('0x11')](',\x20'));_0x443330[_0x6a9b('0x12')]();}else{var _0x3a11d9=_[_0x6a9b('0x13')](_0x4685dd[_0x6a9b('0x14')],handleFindAgent(_0x7e523f[_0x6a9b('0xb')]));if(_0x3a11d9){var _0x59f112=(_0x7e523f[_0x6a9b('0x15')]||0xa)*0x3e8;var _0x323257,_0x3fa316;var _0x4d7359=seqqueue[_0x6a9b('0x16')](_0x59f112);_0x4d7359['id']=_0x542e19;_0x4d7359[_0x6a9b('0x17')]=_0x59f112;_0x4d7359['channel']=_0x6684dc[_0x6a9b('0x18')];writeLog(_0x542e19,_0x3a11d9,util[_0x6a9b('0xa')](_0x6a9b('0x19'),_0x59f112));_0x4685dd['rules'][_0x542e19]['on'](_0x6a9b('0x1a'),function(){logger[_0x6a9b('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x542e19);clearTimeout(_0x3fa316);_0x3fa316=undefined;_0x4d7359[_0x6a9b('0x1b')]();if(_0x4685dd['rules'][_0x542e19]){delete _0x4685dd[_0x6a9b('0x1c')][_0x542e19];}_0x443330[_0x6a9b('0x12')]();});_0x4685dd[_0x6a9b('0x1c')][_0x542e19]['on'](_0x6a9b('0x1d'),function(){if(_0x4685dd[_0x6a9b('0x1c')][_0x542e19]){delete _0x4685dd[_0x6a9b('0x1c')][_0x542e19];}});_0x3fa316=setTimeout(function(){logger[_0x6a9b('0x9')](_0x6a9b('0x1e'),_0x542e19);clearTimeout(_0x3fa316);_0x4d7359['close']();_0x443330['next']();},_0x59f112);strategy[_0x6a9b('0x1f')](_0x4d7359,_0x3a11d9,_0x4685dd,_0x6684dc);}else{logger[_0x6a9b('0x20')](_0x6a9b('0x21'),_0x542e19,_0x7e523f[_0x6a9b('0xb')]);_0x443330[_0x6a9b('0x12')]();}}}catch(_0x33a926){console[_0x6a9b('0x22')](_0x33a926);logger['error'](_0x6a9b('0x23'),_0x542e19,_0x33a926[_0x6a9b('0x24')]);_0x443330[_0x6a9b('0x12')]();}};}; \ 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 59e5a26..6d922e2 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 _0x101e=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','isEmpty','getMustacheRender','create','then','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','next','amazonlex','providerName','providerResponse','Message','Failed','catch','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x101e,0x159));var _0xe101=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x101e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe101('0x0'));var moment=require(_0xe101('0x1'));var AWS=require(_0xe101('0x2'));var utils=require(_0xe101('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xe101('0x4')),'openchannelMessage':require(_0xe101('0x5')),'mailMessage':require(_0xe101('0x6')),'smsMessage':require(_0xe101('0x7')),'faxMessage':require(_0xe101('0x8')),'whatsappMessage':require(_0xe101('0x9'))};exports['consequence']=function(_0x2485a8,_0x542977){return function(_0x334428){try{if(!_[_0xe101('0xa')](this['interaction']['UserId'])){logger[_0xe101('0xb')](_0xe101('0xc'),_0x2485a8,_0xe101('0xd'));return _0x334428['next']();}var _0x585150={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe101('0xe')](_0xe101('0xf')),'direction':_0xe101('0x10')};if(this[_0xe101('0x11')]===_0xe101('0x12')||this['channel']===_0xe101('0x13')){_0x585150['phone']=this['interaction'][_0xe101('0x14')];}var _0x33c5a8=this[_0xe101('0x11')];if(_0x33c5a8===_0xe101('0x15')){_0x585150[_0xe101('0x16')]=this['account']['id'];}else{_0x585150[_[_0xe101('0x17')](_0x33c5a8)+_0xe101('0x18')]=this[_0xe101('0x19')]['id'];}_0x585150[_[_0xe101('0x17')](_0x33c5a8)+_0xe101('0x1a')]=this[_0xe101('0x1b')]['id'];if(this[_0xe101('0x1b')]['created']){var _0x3d1755=_0x542977[0x4];if(!_[_0xe101('0x1c')](_0x3d1755)){_0x585150['body']=utils[_0xe101('0x1d')](_0x3d1755,this);return rpc[_0x33c5a8+'Message'][_0xe101('0x1e')](_0x585150)[_0xe101('0x1f')](function(_0x33f16f){logger[_0xe101('0xb')](_0xe101('0xc'),_0x2485a8,_0x585150[_0xe101('0x20')]);})['catch'](function(_0x151277){logger[_0xe101('0x21')](_0xe101('0xc'),_0x2485a8,JSON[_0xe101('0x22')](_0x151277));})[_0xe101('0x23')](function(){logger['info'](_0xe101('0x24'),_0x2485a8);_0x334428[_0xe101('0x25')]();});}else{logger['info'](_0xe101('0x26'),_0x2485a8);_0x334428[_0xe101('0x25')]();}}else{var _0x5e96f2=this;var _0x3c676a=new AWS[(_0xe101('0x27'))]({'accessKeyId':_0x542977[0x0],'secretAccessKey':_0x542977[0x1],'region':_0x542977[0x2]});var _0x1c67be={'botAlias':_0xe101('0x28'),'botName':_0x542977[0x3],'inputText':this[_0xe101('0x29')]['body'],'userId':this['channel']+':'+this[_0xe101('0x1b')]['id']['toString']()};_0x3c676a[_0xe101('0x2a')](_0x1c67be,function(_0x4b3b66,_0x3f0a5e){if(_0x4b3b66){logger[_0xe101('0x21')]('[%s][AMAZONLEX]\x20%s',_0x2485a8,_0x4b3b66[_0xe101('0x29')]);_0x334428[_0xe101('0x2b')]();}else if(_0x3f0a5e&&_0x3f0a5e[_0xe101('0x29')]){_0x5e96f2[_0xe101('0x20')][_0xe101('0x2c')]=_0x3f0a5e;_0x585150['body']=_0x3f0a5e[_0xe101('0x29')];_0x585150[_0xe101('0x2d')]=_0xe101('0x2c');_0x585150[_0xe101('0x2e')]=JSON[_0xe101('0x22')](_0x3f0a5e);return rpc[_0x33c5a8+_0xe101('0x2f')]['create'](_0x585150)[_0xe101('0x1f')](function(_0xdcea5d){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2485a8,_0x585150['body']);if(_0x3f0a5e['dialogState']==_0xe101('0x30')){_0x334428['next']();}else{_0x334428[_0xe101('0x25')]();}})[_0xe101('0x31')](function(_0x2bf5c7){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2485a8,JSON[_0xe101('0x22')](_0x2bf5c7));_0x334428[_0xe101('0x2b')]();});}else{_0x334428[_0xe101('0x2b')]();}});}}catch(_0x45220a){logger['error'](_0xe101('0xc'),_0x2485a8,JSON['stringify'](_0x45220a));_0x334428[_0xe101('0x25')]();}};}; \ No newline at end of file +var _0x4525=['isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','then','catch','stringify','finally','[%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','error','next','amazonlex','providerResponse','dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x4525,0x86));var _0x5452=function(_0x197f96,_0x3639e1){_0x197f96=_0x197f96-0x0;var _0x279c4d=_0x4525[_0x197f96];return _0x279c4d;};'use strict';var _=require('lodash');var moment=require(_0x5452('0x0'));var AWS=require('aws-sdk');var utils=require(_0x5452('0x1'));var logger=require(_0x5452('0x2'))(_0x5452('0x3'));var rpc={'chatMessage':require(_0x5452('0x4')),'openchannelMessage':require(_0x5452('0x5')),'mailMessage':require(_0x5452('0x6')),'smsMessage':require(_0x5452('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5452('0x8'))};exports[_0x5452('0x9')]=function(_0x4d3f83,_0x240ec1){return function(_0x5d54d5){try{if(!_[_0x5452('0xa')](this[_0x5452('0xb')][_0x5452('0xc')])){logger[_0x5452('0xd')](_0x5452('0xe'),_0x4d3f83,_0x5452('0xf'));return _0x5d54d5['next']();}var _0x355a6d={'ContactId':this[_0x5452('0x10')]['id'],'sentAt':moment()[_0x5452('0x11')](_0x5452('0x12')),'direction':'out'};if(this[_0x5452('0x13')]===_0x5452('0x14')||this[_0x5452('0x13')]==='whatsapp'){_0x355a6d[_0x5452('0x15')]=this[_0x5452('0xb')][_0x5452('0x15')];}var _0x13f022=this[_0x5452('0x13')];if(_0x13f022===_0x5452('0x16')){_0x355a6d[_0x5452('0x17')]=this[_0x5452('0x18')]['id'];}else{_0x355a6d[_['upperFirst'](_0x13f022)+'AccountId']=this[_0x5452('0x18')]['id'];}_0x355a6d[_[_0x5452('0x19')](_0x13f022)+_0x5452('0x1a')]=this['interaction']['id'];if(this[_0x5452('0xb')][_0x5452('0x1b')]){var _0x33be28=_0x240ec1[0x4];if(!_['isEmpty'](_0x33be28)){_0x355a6d[_0x5452('0x1c')]=utils[_0x5452('0x1d')](_0x33be28,this);return rpc[_0x13f022+_0x5452('0x1e')]['create'](_0x355a6d)[_0x5452('0x1f')](function(_0x373e5a){logger[_0x5452('0xd')](_0x5452('0xe'),_0x4d3f83,_0x355a6d['body']);})[_0x5452('0x20')](function(_0x38c78a){logger['error'](_0x5452('0xe'),_0x4d3f83,JSON[_0x5452('0x21')](_0x38c78a));})[_0x5452('0x22')](function(){logger[_0x5452('0xd')](_0x5452('0x23'),_0x4d3f83);_0x5d54d5[_0x5452('0x24')]();});}else{logger[_0x5452('0xd')](_0x5452('0x25'),_0x4d3f83);_0x5d54d5['stop']();}}else{var _0x5b292f=this;var _0xd7b111=new AWS[(_0x5452('0x26'))]({'accessKeyId':_0x240ec1[0x0],'secretAccessKey':_0x240ec1[0x1],'region':_0x240ec1[0x2]});var _0x36e545={'botAlias':_0x5452('0x27'),'botName':_0x240ec1[0x3],'inputText':this[_0x5452('0x28')][_0x5452('0x1c')],'userId':this[_0x5452('0x13')]+':'+this[_0x5452('0xb')]['id'][_0x5452('0x29')]()};_0xd7b111['postText'](_0x36e545,function(_0x453a78,_0xd28bb7){if(_0x453a78){logger[_0x5452('0x2a')](_0x5452('0xe'),_0x4d3f83,_0x453a78[_0x5452('0x28')]);_0x5d54d5[_0x5452('0x2b')]();}else if(_0xd28bb7&&_0xd28bb7[_0x5452('0x28')]){_0x5b292f['body'][_0x5452('0x2c')]=_0xd28bb7;_0x355a6d[_0x5452('0x1c')]=_0xd28bb7[_0x5452('0x28')];_0x355a6d['providerName']='amazonlex';_0x355a6d[_0x5452('0x2d')]=JSON[_0x5452('0x21')](_0xd28bb7);return rpc[_0x13f022+_0x5452('0x1e')]['create'](_0x355a6d)['then'](function(_0x35163b){logger['info'](_0x5452('0xe'),_0x4d3f83,_0x355a6d[_0x5452('0x1c')]);if(_0xd28bb7[_0x5452('0x2e')]==_0x5452('0x2f')){_0x5d54d5[_0x5452('0x2b')]();}else{_0x5d54d5[_0x5452('0x24')]();}})[_0x5452('0x20')](function(_0x1fe3fd){logger['error'](_0x5452('0xe'),_0x4d3f83,JSON[_0x5452('0x21')](_0x1fe3fd));_0x5d54d5[_0x5452('0x2b')]();});}else{_0x5d54d5[_0x5452('0x2b')]();}});}}catch(_0x542c0a){logger[_0x5452('0x2a')](_0x5452('0xe'),_0x4d3f83,JSON[_0x5452('0x21')](_0x542c0a));_0x5d54d5['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 2be664e..2297f14 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 _0x6d99=['stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','subject','Re:','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','messageId','html','replace',''+_[_0x96d9('0x2f')](_0x246b6c[_0x96d9('0x12')],_0x96d9('0x30'),_0x96d9('0x31'))+'';_0x246b6c[_0x96d9('0x32')]={'Auto-Submitted':_0x96d9('0x33'),'X-Auto-Response-Suppress':_0x96d9('0x34'),'Precedence':_0x96d9('0x35')};return mailRpc['sendMailMessage'](this[_0x96d9('0x29')][_0x96d9('0x36')],_0x246b6c)[_0x96d9('0x37')](function(_0x117aab){logger[_0x96d9('0x14')](_0x96d9('0x38'),_0x2a8061);_0x246b6c[_0x96d9('0x2d')]=_0x117aab[_0x96d9('0x21')]['messageId'];return rpc[_0x560ddb+_0x96d9('0x2b')][_0x96d9('0x39')](_0x246b6c);})[_0x96d9('0x37')](function(_0x52cee7){logger[_0x96d9('0x14')]('[%s][AUTOREPLY]\x20%s',_0x2a8061,JSON['stringify'](_0x52cee7));})[_0x96d9('0x3a')](function(_0x20de10){logger[_0x96d9('0x3b')](_0x96d9('0x3c'),_0x2a8061,JSON['stringify'](_0x20de10));})[_0x96d9('0x3d')](function(){Promise['resolve']()[_0x96d9('0x37')](function(){if(_0x582df1[0x0]!=='2'||_0x596f9e[_0x96d9('0x1b')])return;return rpc[_0x560ddb+_0x96d9('0x3e')][_0x96d9('0x3f')](_0x596f9e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x311b1c){logger[_0x96d9('0x14')](_0x96d9('0x40'),_0x2a8061,JSON['stringify'](_0x311b1c));})[_0x96d9('0x3a')](function(_0x12d582){logger[_0x96d9('0x3b')](_0x96d9('0x41'),_0x2a8061,JSON[_0x96d9('0x42')](_0x12d582));});})['then'](function(){_0x1d1c71[_0x96d9('0x17')]();});});}else{return rpc[this['channel']+_0x96d9('0x2b')][_0x96d9('0x39')](_0x246b6c)['then'](function(){logger[_0x96d9('0x14')](_0x96d9('0x15'),_0x2a8061,_0x246b6c[_0x96d9('0x12')]);})['catch'](function(_0x140c40){logger[_0x96d9('0x3b')](_0x96d9('0x15'),_0x2a8061,JSON[_0x96d9('0x42')](_0x140c40));})[_0x96d9('0x3d')](function(){Promise[_0x96d9('0x43')]()[_0x96d9('0x37')](function(){if(_0x582df1[0x0]!=='2'||_0x596f9e[_0x96d9('0x1b')])return;return rpc[_0x560ddb+_0x96d9('0x3e')]['update'](_0x596f9e['id'],{'autoreplyExecuted':!![]})[_0x96d9('0x37')](function(_0x5b26a0){logger[_0x96d9('0x14')](_0x96d9('0x40'),_0x2a8061,JSON[_0x96d9('0x42')](_0x5b26a0));})[_0x96d9('0x3a')](function(_0x2e98e7){logger['error'](_0x96d9('0x41'),_0x2a8061,JSON[_0x96d9('0x42')](_0x2e98e7));});})[_0x96d9('0x37')](function(){_0x1d1c71['next']();});});}}}catch(_0x3deeaf){logger[_0x96d9('0x3b')](_0x96d9('0x15'),_0x2a8061,JSON[_0x96d9('0x42')](_0x3deeaf));_0x1d1c71[_0x96d9('0x44')]();}};}; \ No newline at end of file +var _0x30b5=['Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','AccountId','account','InteractionId','Message','inReplyTo','messageId','html','','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created'];(function(_0x392688,_0xe3209e){var _0x327aed=function(_0x2b106a){while(--_0x2b106a){_0x392688['push'](_0x392688['shift']());}};_0x327aed(++_0xe3209e);}(_0x30b5,0x68));var _0x530b=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x30b5[_0x5de214];return _0x4df627;};'use strict';var _=require('lodash');var moment=require(_0x530b('0x0'));var utils=require('./utils');var logger=require(_0x530b('0x1'))(_0x530b('0x2'));var rpc={'chatMessage':require(_0x530b('0x3')),'openchannelMessage':require(_0x530b('0x4')),'mailMessage':require(_0x530b('0x5')),'smsMessage':require(_0x530b('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x530b('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x530b('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x530b('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x530b('0xa'));exports[_0x530b('0xb')]=function(_0x15b584,_0x1bd172,_0x12f69f,_0x2a9d8f){return function(_0xcf5f2){try{var _0x8b64af=this['channel'];if(_0x8b64af===_0x530b('0xc')&&_0x2a9d8f[_0x530b('0xd')][_0x530b('0xe')]){logger[_0x530b('0xf')](_0x530b('0x10'),_0x15b584,_0x530b('0x11'));return _0xcf5f2[_0x530b('0x12')]();}if(_0x1bd172[0x0]==='1'&&(_[_0x530b('0x13')](this[_0x530b('0x14')][_0x530b('0x15')])||!this['interaction'][_0x530b('0x15')])){logger[_0x530b('0xf')]('[%s][AUTOREPLY]\x20%s',_0x15b584,_0x530b('0x16'));return _0xcf5f2[_0x530b('0x12')]();}if(_0x1bd172[0x0]==='2'&&this[_0x530b('0x14')][_0x530b('0x17')]){logger['info'](_0x530b('0x18'),_0x15b584,'One\x20Time\x20already\x20sent');return _0xcf5f2[_0x530b('0x12')]();}var _0x4b2380={'ContactId':this[_0x530b('0x19')]['id'],'sentAt':moment()['format'](_0x530b('0x1a')),'direction':_0x530b('0x1b')};if(this[_0x530b('0x1c')]===_0x530b('0xc')){_0x4b2380[_0x530b('0xd')]=utils[_0x530b('0x1d')](_0x1bd172[0x2],this);}else{_0x4b2380[_0x530b('0xd')]=utils['getMustacheRender'](_0x1bd172[0x1],this);}if(this['message']){_0x4b2380['to']=this[_0x530b('0x1e')][_0x530b('0x1f')]||'';if(this[_0x530b('0x1c')]===_0x530b('0xc')&&_0x1bd172[0x1]==='1'){_0x4b2380['cc']=this[_0x530b('0x1e')]['cc']||'';}_0x4b2380[_0x530b('0x1f')]=this[_0x530b('0x1e')]['to']||'';_0x4b2380[_0x530b('0x20')]=this['message']['phone']||'';_0x4b2380[_0x530b('0x21')]=!![];if(this[_0x530b('0x1e')][_0x530b('0x22')]){_0x4b2380[_0x530b('0x22')]='';_0x4b2380['subject']+=_['startsWith'](this[_0x530b('0x1e')]['subject'],_0x530b('0x23'))?'':_0x530b('0x24');_0x4b2380[_0x530b('0x22')]+=this[_0x530b('0x1e')][_0x530b('0x22')];}}if(this[_0x530b('0x1c')]===_0x530b('0x25')){_0x4b2380['ChatWebsiteId']=this['account']['id'];}else{_0x4b2380[_['upperFirst'](this[_0x530b('0x1c')])+_0x530b('0x26')]=this[_0x530b('0x27')]['id'];}_0x4b2380[_['upperFirst'](this[_0x530b('0x1c')])+_0x530b('0x28')]=this[_0x530b('0x14')]['id'];var _0xe19c97=this[_0x530b('0x14')];if(rpc[this['channel']+_0x530b('0x29')]){if(this[_0x530b('0x1c')]==='mail'){_0x4b2380[_0x530b('0x2a')]=this[_0x530b('0x1e')][_0x530b('0x2b')];_0x4b2380[_0x530b('0x2c')]=''+_['replace'](_0x4b2380[_0x530b('0xd')],_0x530b('0x2d'),_0x530b('0x2e'))+_0x530b('0x2f');_0x4b2380['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x530b('0x30'),'Precedence':_0x530b('0x31')};return mailRpc['sendMailMessage'](this[_0x530b('0x27')][_0x530b('0x32')],_0x4b2380)[_0x530b('0x33')](function(_0x123c46){logger['info'](_0x530b('0x34'),_0x15b584);_0x4b2380[_0x530b('0x2b')]=_0x123c46['message'][_0x530b('0x2b')];return rpc[_0x8b64af+_0x530b('0x29')][_0x530b('0x35')](_0x4b2380);})[_0x530b('0x33')](function(_0x4d1a3d){logger[_0x530b('0xf')](_0x530b('0x10'),_0x15b584,JSON[_0x530b('0x36')](_0x4d1a3d));})[_0x530b('0x37')](function(_0x4b5ac0){logger[_0x530b('0x38')](_0x530b('0x39'),_0x15b584,JSON[_0x530b('0x36')](_0x4b5ac0));})[_0x530b('0x3a')](function(){Promise[_0x530b('0x3b')]()[_0x530b('0x33')](function(){if(_0x1bd172[0x0]!=='2'||_0xe19c97[_0x530b('0x17')])return;return rpc[_0x8b64af+'Interaction']['update'](_0xe19c97['id'],{'autoreplyExecuted':!![]})[_0x530b('0x33')](function(_0x16144f){logger[_0x530b('0xf')](_0x530b('0x18'),_0x15b584,JSON[_0x530b('0x36')](_0x16144f));})[_0x530b('0x37')](function(_0x1b78ad){logger[_0x530b('0x38')](_0x530b('0x3c'),_0x15b584,JSON['stringify'](_0x1b78ad));});})[_0x530b('0x33')](function(){_0xcf5f2[_0x530b('0x12')]();});});}else{return rpc[this[_0x530b('0x1c')]+_0x530b('0x29')][_0x530b('0x35')](_0x4b2380)['then'](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x15b584,_0x4b2380['body']);})[_0x530b('0x37')](function(_0x155ff0){logger[_0x530b('0x38')](_0x530b('0x10'),_0x15b584,JSON[_0x530b('0x36')](_0x155ff0));})['finally'](function(){Promise[_0x530b('0x3b')]()['then'](function(){if(_0x1bd172[0x0]!=='2'||_0xe19c97['autoreplyExecuted'])return;return rpc[_0x8b64af+_0x530b('0x3d')]['update'](_0xe19c97['id'],{'autoreplyExecuted':!![]})['then'](function(_0x41f79d){logger[_0x530b('0xf')](_0x530b('0x18'),_0x15b584,JSON['stringify'](_0x41f79d));})[_0x530b('0x37')](function(_0x3918ca){logger[_0x530b('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x15b584,JSON[_0x530b('0x36')](_0x3918ca));});})['then'](function(){_0xcf5f2[_0x530b('0x12')]();});});}}}catch(_0x37b4bf){logger[_0x530b('0x38')](_0x530b('0x10'),_0x15b584,JSON[_0x530b('0x36')](_0x37b4bf));_0xcf5f2[_0x530b('0x3e')]();}};}; \ 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 0d9b93c..50f2c5b 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 _0xfc4c=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then'];(function(_0x236c96,_0x360519){var _0x41311c=function(_0x343048){while(--_0x343048){_0x236c96['push'](_0x236c96['shift']());}};_0x41311c(++_0x360519);}(_0xfc4c,0x1d2));var _0xcfc4=function(_0x5b90e3,_0x3ad1b0){_0x5b90e3=_0x5b90e3-0x0;var _0x1864ad=_0xfc4c[_0x5b90e3];return _0x1864ad;};'use strict';var moment=require(_0xcfc4('0x0'));var logger=require(_0xcfc4('0x1'))(_0xcfc4('0x2'));var rpc={'chatInteraction':require(_0xcfc4('0x3')),'openchannelInteraction':require(_0xcfc4('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xcfc4('0x5')),'faxInteraction':require(_0xcfc4('0x6')),'whatsappInteraction':require(_0xcfc4('0x7'))};exports['consequence']=function(_0xc7f269,_0x51532d,_0x4f9d85,_0x3c0adc){return function(_0x1e3523){try{logger[_0xcfc4('0x8')](_0xcfc4('0x9'),_0xc7f269,_0x51532d[0x0]);var _0x264c8f={'closed':0x1,'closedAt':moment()['format'](_0xcfc4('0xa')),'closeReason':_0xcfc4('0xb'),'disposition':_0x51532d[0x0]};if(rpc[_0x3c0adc[_0xcfc4('0xc')]+_0xcfc4('0xd')]){rpc[_0x3c0adc[_0xcfc4('0xc')]+'Interaction'][_0xcfc4('0xe')](_0x3c0adc[_0xcfc4('0xf')]['id'],_0x264c8f)[_0xcfc4('0x10')](function(_0x39865c){logger[_0xcfc4('0x8')](_0xcfc4('0x11'),_0xc7f269,_0x3c0adc[_0xcfc4('0xf')]['id']);})['catch'](function(_0x3fdeff){logger[_0xcfc4('0x12')](_0xcfc4('0x13'),_0xc7f269,JSON[_0xcfc4('0x14')](_0x3fdeff));})[_0xcfc4('0x15')](function(){_0x1e3523['stop']();});}}catch(_0x2852c3){logger[_0xcfc4('0x12')]('[%s][CLOSE]\x20%s',_0xc7f269,JSON[_0xcfc4('0x14')](_0x2852c3));_0x1e3523[_0xcfc4('0x16')]();}};}; \ No newline at end of file +var _0x8f03=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction'];(function(_0x1dadb4,_0x5923a5){var _0x4a0736=function(_0xe9f261){while(--_0xe9f261){_0x1dadb4['push'](_0x1dadb4['shift']());}};_0x4a0736(++_0x5923a5);}(_0x8f03,0x132));var _0x38f0=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x8f03[_0x4200e3];return _0x26ac37;};'use strict';var moment=require(_0x38f0('0x0'));var logger=require(_0x38f0('0x1'))(_0x38f0('0x2'));var rpc={'chatInteraction':require(_0x38f0('0x3')),'openchannelInteraction':require(_0x38f0('0x4')),'smsInteraction':require(_0x38f0('0x5')),'mailInteraction':require(_0x38f0('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x38f0('0x7'))};exports[_0x38f0('0x8')]=function(_0xff929e,_0x1b6de7,_0x24bd04,_0x3bcb96){return function(_0x500079){try{logger[_0x38f0('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0xff929e,_0x1b6de7[0x0]);var _0x486d0b={'closed':0x1,'closedAt':moment()[_0x38f0('0xa')](_0x38f0('0xb')),'closeReason':_0x38f0('0xc'),'disposition':_0x1b6de7[0x0]};if(rpc[_0x3bcb96[_0x38f0('0xd')]+_0x38f0('0xe')]){rpc[_0x3bcb96[_0x38f0('0xd')]+_0x38f0('0xe')]['update'](_0x3bcb96[_0x38f0('0xf')]['id'],_0x486d0b)[_0x38f0('0x10')](function(_0xe5f467){logger[_0x38f0('0x9')](_0x38f0('0x11'),_0xff929e,_0x3bcb96[_0x38f0('0xf')]['id']);})[_0x38f0('0x12')](function(_0x4adaad){logger[_0x38f0('0x13')]('[%s][CLOSE]\x20%s',_0xff929e,JSON['stringify'](_0x4adaad));})[_0x38f0('0x14')](function(){_0x500079[_0x38f0('0x15')]();});}}catch(_0xa14bd1){logger[_0x38f0('0x13')](_0x38f0('0x16'),_0xff929e,JSON['stringify'](_0xa14bd1));_0x500079[_0x38f0('0x15')]();}};}; \ 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 a8d1e6b..3a729b0 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 _0xe700=['Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','speech','stringify','result','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x105232,_0x2c88fe){var _0x5e1642=function(_0x4ac0f1){while(--_0x4ac0f1){_0x105232['push'](_0x105232['shift']());}};_0x5e1642(++_0x2c88fe);}(_0xe700,0x75));var _0x0e70=function(_0xc3f7c8,_0x3e0a6a){_0xc3f7c8=_0xc3f7c8-0x0;var _0x290f4d=_0xe700[_0xc3f7c8];return _0x290f4d;};'use strict';var _=require(_0x0e70('0x0'));var moment=require(_0x0e70('0x1'));var apiai=require(_0x0e70('0x2'));var md5=require(_0x0e70('0x3'));var utils=require(_0x0e70('0x4'));var logger=require(_0x0e70('0x5'))(_0x0e70('0x6'));var rpc={'chatMessage':require(_0x0e70('0x7')),'openchannelMessage':require(_0x0e70('0x8')),'mailMessage':require(_0x0e70('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0e70('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0e70('0xb')]=function(_0x30303a,_0x1ea6ad){return function(_0x28fcf2){try{if(!_[_0x0e70('0xc')](this[_0x0e70('0xd')][_0x0e70('0xe')])){logger[_0x0e70('0xf')](_0x0e70('0x10'),_0x30303a,_0x0e70('0x11'));return _0x28fcf2[_0x0e70('0x12')]();}var _0x32a108={'ContactId':this[_0x0e70('0x13')]['id'],'sentAt':moment()[_0x0e70('0x14')](_0x0e70('0x15')),'direction':'out'};if(this[_0x0e70('0x16')]===_0x0e70('0x17')||this[_0x0e70('0x16')]==='whatsapp'){_0x32a108[_0x0e70('0x18')]=this[_0x0e70('0xd')][_0x0e70('0x18')];}var _0x18ee22=this['channel'];if(_0x18ee22===_0x0e70('0x19')){_0x32a108[_0x0e70('0x1a')]=this[_0x0e70('0x1b')]['id'];}else{_0x32a108[_['upperFirst'](_0x18ee22)+'AccountId']=this[_0x0e70('0x1b')]['id'];}_0x32a108[_['upperFirst'](_0x18ee22)+_0x0e70('0x1c')]=this[_0x0e70('0xd')]['id'];if(this[_0x0e70('0xd')][_0x0e70('0x1d')]){var _0x4bc3a4=_0x1ea6ad[0x2];if(!_[_0x0e70('0x1e')](_0x4bc3a4)){_0x32a108[_0x0e70('0x1f')]=utils[_0x0e70('0x20')](_0x4bc3a4,this);return rpc[_0x18ee22+_0x0e70('0x21')][_0x0e70('0x22')](_0x32a108)[_0x0e70('0x23')](function(_0x5a6206){logger[_0x0e70('0xf')](_0x0e70('0x10'),_0x30303a,_0x32a108['body']);})[_0x0e70('0x24')](function(_0x1131a6){logger[_0x0e70('0x25')](_0x0e70('0x10'),_0x30303a,JSON['stringify'](_0x1131a6));})[_0x0e70('0x26')](function(){logger[_0x0e70('0xf')](_0x0e70('0x27'),_0x30303a);_0x28fcf2['stop']();});}else{logger[_0x0e70('0xf')](_0x0e70('0x28'),_0x30303a);_0x28fcf2['stop']();}}else{var _0x3b2d2a=this;var _0x22ee57=apiai(_0x1ea6ad[0x0],{'language':_0x1ea6ad[0x1]||'en'});return _0x22ee57[_0x0e70('0x29')](this[_0x0e70('0x2a')][_0x0e70('0x1f')],{'sessionId':md5(this[_0x0e70('0xd')]['id'])})[_0x0e70('0x23')](function(_0x350afc){_0x3b2d2a[_0x0e70('0x1f')][_0x0e70('0x2b')]=_0x350afc;_0x32a108[_0x0e70('0x1f')]=_0x350afc['result']['fulfillment'][_0x0e70('0x2c')];_0x32a108['providerName']=_0x0e70('0x2b');_0x32a108['providerResponse']=JSON[_0x0e70('0x2d')](_0x350afc);return rpc[_0x18ee22+_0x0e70('0x21')][_0x0e70('0x22')](_0x32a108)[_0x0e70('0x23')](function(_0x3efbb5){logger[_0x0e70('0xf')](_0x0e70('0x10'),_0x30303a,_0x32a108[_0x0e70('0x1f')]);if(_0x350afc[_0x0e70('0x2e')][_0x0e70('0x2f')][_0x0e70('0x30')]){_0x28fcf2[_0x0e70('0x12')]();}else{_0x28fcf2[_0x0e70('0x31')]();}})[_0x0e70('0x24')](function(_0x5e7409){logger['error'](_0x0e70('0x10'),_0x30303a,JSON[_0x0e70('0x2d')](_0x5e7409));_0x28fcf2['next']();});})['catch'](function(_0x16e6ae){logger[_0x0e70('0x25')](_0x0e70('0x10'),_0x30303a,_0x16e6ae[_0x0e70('0x2a')]);_0x28fcf2[_0x0e70('0x12')]();});}}catch(_0x1498b1){logger[_0x0e70('0x25')](_0x0e70('0x10'),_0x30303a,JSON[_0x0e70('0x2d')](_0x1498b1));_0x28fcf2[_0x0e70('0x31')]();}};}; \ No newline at end of file +var _0x8819=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','fulfillment','speech','providerName','dialogflow','providerResponse','create','metadata','endConversation','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','[%s][DIALOGFLOW]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','upperFirst','AccountId','InteractionId','created','Message','then','body','catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8819,0x94));var _0x9881=function(_0x5bfcad,_0x456646){_0x5bfcad=_0x5bfcad-0x0;var _0x3a2290=_0x8819[_0x5bfcad];return _0x3a2290;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x9881('0x0'));var md5=require(_0x9881('0x1'));var utils=require(_0x9881('0x2'));var logger=require(_0x9881('0x3'))(_0x9881('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9881('0x5')),'mailMessage':require(_0x9881('0x6')),'smsMessage':require(_0x9881('0x7')),'faxMessage':require(_0x9881('0x8')),'whatsappMessage':require(_0x9881('0x9'))};exports[_0x9881('0xa')]=function(_0x5f1d45,_0x353966){return function(_0x4a6471){try{if(!_['isNil'](this[_0x9881('0xb')]['UserId'])){logger['info'](_0x9881('0xc'),_0x5f1d45,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4a6471[_0x9881('0xd')]();}var _0x39122e={'ContactId':this[_0x9881('0xe')]['id'],'sentAt':moment()['format'](_0x9881('0xf')),'direction':_0x9881('0x10')};if(this[_0x9881('0x11')]===_0x9881('0x12')||this['channel']===_0x9881('0x13')){_0x39122e[_0x9881('0x14')]=this['interaction'][_0x9881('0x14')];}var _0x587f05=this['channel'];if(_0x587f05==='chat'){_0x39122e['ChatWebsiteId']=this[_0x9881('0x15')]['id'];}else{_0x39122e[_[_0x9881('0x16')](_0x587f05)+_0x9881('0x17')]=this[_0x9881('0x15')]['id'];}_0x39122e[_[_0x9881('0x16')](_0x587f05)+_0x9881('0x18')]=this['interaction']['id'];if(this[_0x9881('0xb')][_0x9881('0x19')]){var _0xcc4b6d=_0x353966[0x2];if(!_['isEmpty'](_0xcc4b6d)){_0x39122e['body']=utils['getMustacheRender'](_0xcc4b6d,this);return rpc[_0x587f05+_0x9881('0x1a')]['create'](_0x39122e)[_0x9881('0x1b')](function(_0x5a9848){logger['info'](_0x9881('0xc'),_0x5f1d45,_0x39122e[_0x9881('0x1c')]);})[_0x9881('0x1d')](function(_0x2941bc){logger[_0x9881('0x1e')](_0x9881('0xc'),_0x5f1d45,JSON[_0x9881('0x1f')](_0x2941bc));})[_0x9881('0x20')](function(){logger[_0x9881('0x21')](_0x9881('0x22'),_0x5f1d45);_0x4a6471[_0x9881('0x23')]();});}else{logger[_0x9881('0x21')](_0x9881('0x24'),_0x5f1d45);_0x4a6471[_0x9881('0x23')]();}}else{var _0x174b39=this;var _0x58485d=apiai(_0x353966[0x0],{'language':_0x353966[0x1]||'en'});return _0x58485d['textRequest'](this[_0x9881('0x25')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x9881('0x1b')](function(_0x30ed15){_0x174b39['body']['dialogflow']=_0x30ed15;_0x39122e[_0x9881('0x1c')]=_0x30ed15['result'][_0x9881('0x26')][_0x9881('0x27')];_0x39122e[_0x9881('0x28')]=_0x9881('0x29');_0x39122e[_0x9881('0x2a')]=JSON[_0x9881('0x1f')](_0x30ed15);return rpc[_0x587f05+_0x9881('0x1a')][_0x9881('0x2b')](_0x39122e)[_0x9881('0x1b')](function(_0x23727b){logger[_0x9881('0x21')](_0x9881('0xc'),_0x5f1d45,_0x39122e[_0x9881('0x1c')]);if(_0x30ed15['result'][_0x9881('0x2c')][_0x9881('0x2d')]){_0x4a6471['next']();}else{_0x4a6471[_0x9881('0x23')]();}})[_0x9881('0x1d')](function(_0x4970be){logger[_0x9881('0x1e')](_0x9881('0xc'),_0x5f1d45,JSON[_0x9881('0x1f')](_0x4970be));_0x4a6471[_0x9881('0xd')]();});})[_0x9881('0x1d')](function(_0x383ff0){logger[_0x9881('0x1e')](_0x9881('0xc'),_0x5f1d45,_0x383ff0['message']);_0x4a6471[_0x9881('0xd')]();});}}catch(_0xab2a2c){logger[_0x9881('0x1e')](_0x9881('0xc'),_0x5f1d45,JSON[_0x9881('0x1f')](_0xab2a2c));_0x4a6471[_0x9881('0x23')]();}};}; \ 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 96d65f7..8f0e72d 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 _0x2b74=['displayName','DIALOGFLOWV2_ISFALLBACKINTENT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','next','stack','lodash','dialogflow','moment','bluebird','./utils','../../rpc/mailMessage','../../rpc/smsMessage','clone','Message','create','body','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','info','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME'];(function(_0x3036b6,_0x27294c){var _0x34c081=function(_0x574df2){while(--_0x574df2){_0x3036b6['push'](_0x3036b6['shift']());}};_0x34c081(++_0x27294c);}(_0x2b74,0x164));var _0x42b7=function(_0x23e81d,_0x1e6cf0){_0x23e81d=_0x23e81d-0x0;var _0x2d255d=_0x2b74[_0x23e81d];return _0x2d255d;};'use strict';var _=require(_0x42b7('0x0'));var dialogflow=require(_0x42b7('0x1'));var md5=require('md5');var moment=require(_0x42b7('0x2'));var Promise=require(_0x42b7('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x42b7('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x42b7('0x5')),'smsMessage':require(_0x42b7('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1ee119,_0x42afba,_0x318017,_0x224955){return new Promise(function(_0x3bfbdf,_0x24041d){var _0x2cbf4d=_[_0x42b7('0x7')](_0x318017);_0x2cbf4d['body']=_0x224955;return rpc[_0x42afba+_0x42b7('0x8')][_0x42b7('0x9')](_0x2cbf4d)['then'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1ee119,_0x2cbf4d[_0x42b7('0xa')]);_0x3bfbdf();})[_0x42b7('0xb')](function(_0x3e66c7){logger[_0x42b7('0xc')](_0x42b7('0xd'),_0x1ee119,JSON[_0x42b7('0xe')](_0x3e66c7));_0x24041d(_0x3e66c7);});});}exports[_0x42b7('0xf')]=function(_0x5c280f,_0x2439fd){return function(_0x1f07ca){try{if(!_[_0x42b7('0x10')](this[_0x42b7('0x11')][_0x42b7('0x12')])){logger[_0x42b7('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x5c280f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1f07ca['next']();}var _0x586ce0={'ContactId':this[_0x42b7('0x14')]['id'],'sentAt':moment()[_0x42b7('0x15')](_0x42b7('0x16')),'direction':_0x42b7('0x17')};if(this[_0x42b7('0x18')]===_0x42b7('0x19')||this[_0x42b7('0x18')]==='whatsapp'){_0x586ce0[_0x42b7('0x1a')]=this[_0x42b7('0x11')][_0x42b7('0x1a')];}var _0x51070d=this[_0x42b7('0x18')];if(_0x51070d===_0x42b7('0x1b')){_0x586ce0[_0x42b7('0x1c')]=this['account']['id'];}else{_0x586ce0[_[_0x42b7('0x1d')](_0x51070d)+_0x42b7('0x1e')]=this['account']['id'];}_0x586ce0[_['upperFirst'](_0x51070d)+_0x42b7('0x1f')]=this['interaction']['id'];if(this['interaction']['created']){var _0x48218c=_0x2439fd[0x4];if(!_['isEmpty'](_0x48218c)){_0x586ce0[_0x42b7('0xa')]=utils[_0x42b7('0x20')](_0x48218c,this);return rpc[_0x51070d+_0x42b7('0x8')][_0x42b7('0x9')](_0x586ce0)[_0x42b7('0x21')](function(_0x19c205){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x5c280f,_0x586ce0[_0x42b7('0xa')]);})['catch'](function(_0x1a3a2a){logger[_0x42b7('0xc')](_0x42b7('0xd'),_0x5c280f,JSON['stringify'](_0x1a3a2a));})[_0x42b7('0x22')](function(){logger[_0x42b7('0x13')](_0x42b7('0x23'),_0x5c280f);_0x1f07ca[_0x42b7('0x24')]();});}else{logger['info'](_0x42b7('0x25'),_0x5c280f);_0x1f07ca[_0x42b7('0x24')]();}}else{var _0xf7f1fa=this;var _0x2fae83=_0x2439fd[0x2][_0x42b7('0x26')](/\\n/g,'\x0a');var _0x2d9e50={'credentials':{'private_key':_0x2fae83,'client_email':_0x2439fd[0x1]}};var _0x30cf58=new dialogflow['SessionsClient'](_0x2d9e50);var _0x102ce9=_0x30cf58[_0x42b7('0x27')](_0x2439fd[0x0],md5(_0xf7f1fa[_0x42b7('0x11')]['id']));var _0x3c5487={'session':_0x102ce9,'queryInput':{'text':{'text':_0xf7f1fa[_0x42b7('0x28')][_0x42b7('0xa')],'languageCode':_0x2439fd[0x3]||'en'}}};return _0x30cf58[_0x42b7('0x29')](_0x3c5487)[_0x42b7('0x21')](function(_0xdf4312){if(_0xdf4312&&_0xdf4312[_0x42b7('0x2a')]){_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x2b')]=_0xdf4312;var _0x24f707=_0xdf4312[0x0];var _0x2de761=_0x24f707['queryResult']['diagnosticInfo']&&_0x24f707[_0x42b7('0x2c')][_0x42b7('0x2d')][_0x42b7('0x2e')]?_0x24f707[_0x42b7('0x2c')][_0x42b7('0x2d')][_0x42b7('0x2e')][_0x42b7('0x2f')][_0x42b7('0x30')]:![];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x31')]=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x32')];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x33')]=_0x24f707['queryResult'][_0x42b7('0x34')];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x35')]=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x2d')]&&_0x24f707['queryResult'][_0x42b7('0x2d')][_0x42b7('0x2e')]?_0x24f707[_0x42b7('0x2c')][_0x42b7('0x2d')][_0x42b7('0x2e')][_0x42b7('0x2f')][_0x42b7('0x30')]:![];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x36')]=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x37')][_0x42b7('0x38')];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x39')]=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x37')][_0x42b7('0x3a')];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x3b')]=_0x24f707['queryResult'][_0x42b7('0x37')]['isFallback'];_0xf7f1fa[_0x42b7('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x24f707[_0x42b7('0x2c')]['languageCode'];_0xf7f1fa['body']['DIALOGFLOWV2_QUERYTEXT']=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x3c')];_0xf7f1fa[_0x42b7('0xa')][_0x42b7('0x3d')]=_0x24f707[_0x42b7('0x2c')][_0x42b7('0x3e')];_0x586ce0['providerName']=_0x42b7('0x2b');_0x586ce0[_0x42b7('0x3f')]=JSON[_0x42b7('0xe')](_0xdf4312);var _0x2b6866=[];for(var _0x539082=0x0;_0x539082<_0xdf4312[_0x42b7('0x2a')];_0x539082++){var _0x30c1c9=_0xdf4312[_0x539082];if(_0x30c1c9&&_0x30c1c9[_0x42b7('0x2c')]&&_0x30c1c9[_0x42b7('0x2c')][_0x42b7('0x40')]){_0x2b6866[_0x42b7('0x41')](createMessage(_0x5c280f,_0x51070d,_0x586ce0,_0x30c1c9[_0x42b7('0x2c')][_0x42b7('0x40')]));}}return Promise[_0x42b7('0x42')](_0x2b6866)[_0x42b7('0x21')](function(){if(_0x2de761){_0x1f07ca['next']();}else{_0x1f07ca[_0x42b7('0x24')]();}})[_0x42b7('0xb')](function(_0x40e8cb){logger[_0x42b7('0xc')](_0x42b7('0xd'),_0x5c280f,JSON[_0x42b7('0xe')](_0x40e8cb));_0x1f07ca[_0x42b7('0x43')]();});}})['catch'](function(_0x2fa618){logger[_0x42b7('0xc')](_0x42b7('0xd'),_0x5c280f,_0x2fa618['message'],_0x2fa618[_0x42b7('0x44')]);_0x1f07ca[_0x42b7('0x43')]();});}}catch(_0x205d2f){logger[_0x42b7('0xc')](_0x42b7('0xd'),_0x5c280f,JSON[_0x42b7('0xe')](_0x205d2f));_0x1f07ca['stop']();}};}; \ No newline at end of file +var _0xd7c6=['info','[%s][DIALOGFLOWV2]\x20%s','error','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','catch','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','fulfillmentText','push','all','stop','lodash','dialogflow','md5','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','clone','Message','create','then'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xd7c6,0x108));var _0x6d7c=function(_0x33a13d,_0x1073ec){_0x33a13d=_0x33a13d-0x0;var _0xbf0b74=_0xd7c6[_0x33a13d];return _0xbf0b74;};'use strict';var _=require(_0x6d7c('0x0'));var dialogflow=require(_0x6d7c('0x1'));var md5=require(_0x6d7c('0x2'));var moment=require('moment');var Promise=require(_0x6d7c('0x3'));var logger=require('../../../../config/logger')(_0x6d7c('0x4'));var utils=require(_0x6d7c('0x5'));var rpc={'chatMessage':require(_0x6d7c('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6d7c('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x25245d,_0x4dfd96,_0x1b80c7,_0x4ac971){return new Promise(function(_0x4ddf69,_0x14ebe2){var _0x39c3cf=_[_0x6d7c('0x8')](_0x1b80c7);_0x39c3cf['body']=_0x4ac971;return rpc[_0x4dfd96+_0x6d7c('0x9')][_0x6d7c('0xa')](_0x39c3cf)[_0x6d7c('0xb')](function(){logger[_0x6d7c('0xc')](_0x6d7c('0xd'),_0x25245d,_0x39c3cf['body']);_0x4ddf69();})['catch'](function(_0x4ff004){logger[_0x6d7c('0xe')](_0x6d7c('0xd'),_0x25245d,JSON['stringify'](_0x4ff004));_0x14ebe2(_0x4ff004);});});}exports['consequence']=function(_0x32b0dd,_0x16452b){return function(_0x376971){try{if(!_['isNil'](this['interaction'][_0x6d7c('0xf')])){logger[_0x6d7c('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x32b0dd,_0x6d7c('0x10'));return _0x376971[_0x6d7c('0x11')]();}var _0x348b3b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6d7c('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x6d7c('0x13')||this[_0x6d7c('0x14')]===_0x6d7c('0x15')){_0x348b3b[_0x6d7c('0x16')]=this[_0x6d7c('0x17')][_0x6d7c('0x16')];}var _0xa5350c=this[_0x6d7c('0x14')];if(_0xa5350c===_0x6d7c('0x18')){_0x348b3b[_0x6d7c('0x19')]=this[_0x6d7c('0x1a')]['id'];}else{_0x348b3b[_[_0x6d7c('0x1b')](_0xa5350c)+_0x6d7c('0x1c')]=this[_0x6d7c('0x1a')]['id'];}_0x348b3b[_['upperFirst'](_0xa5350c)+'InteractionId']=this['interaction']['id'];if(this[_0x6d7c('0x17')][_0x6d7c('0x1d')]){var _0x28112e=_0x16452b[0x4];if(!_[_0x6d7c('0x1e')](_0x28112e)){_0x348b3b[_0x6d7c('0x1f')]=utils[_0x6d7c('0x20')](_0x28112e,this);return rpc[_0xa5350c+_0x6d7c('0x9')]['create'](_0x348b3b)[_0x6d7c('0xb')](function(_0x46c56c){logger[_0x6d7c('0xc')](_0x6d7c('0xd'),_0x32b0dd,_0x348b3b[_0x6d7c('0x1f')]);})[_0x6d7c('0x21')](function(_0x18255d){logger[_0x6d7c('0xe')](_0x6d7c('0xd'),_0x32b0dd,JSON[_0x6d7c('0x22')](_0x18255d));})[_0x6d7c('0x23')](function(){logger[_0x6d7c('0xc')](_0x6d7c('0x24'),_0x32b0dd);_0x376971['stop']();});}else{logger[_0x6d7c('0xc')](_0x6d7c('0x25'),_0x32b0dd);_0x376971['stop']();}}else{var _0x36775b=this;var _0x570f27=_0x16452b[0x2]['replace'](/\\n/g,'\x0a');var _0x5dec7a={'credentials':{'private_key':_0x570f27,'client_email':_0x16452b[0x1]}};var _0x5efbce=new dialogflow[(_0x6d7c('0x26'))](_0x5dec7a);var _0x3a18ab=_0x5efbce[_0x6d7c('0x27')](_0x16452b[0x0],md5(_0x36775b[_0x6d7c('0x17')]['id']));var _0x437812={'session':_0x3a18ab,'queryInput':{'text':{'text':_0x36775b[_0x6d7c('0x28')][_0x6d7c('0x1f')],'languageCode':_0x16452b[0x3]||'en'}}};return _0x5efbce[_0x6d7c('0x29')](_0x437812)['then'](function(_0x46c480){if(_0x46c480&&_0x46c480[_0x6d7c('0x2a')]){_0x36775b['body'][_0x6d7c('0x2b')]=_0x46c480;var _0x4ee6b1=_0x46c480[0x0];var _0x923966=_0x4ee6b1[_0x6d7c('0x2c')]['diagnosticInfo']&&_0x4ee6b1[_0x6d7c('0x2c')]['diagnosticInfo']['fields']?_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x2d')][_0x6d7c('0x2e')][_0x6d7c('0x2f')][_0x6d7c('0x30')]:![];_0x36775b[_0x6d7c('0x1f')]['DIALOGFLOWV2_ACTION']=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x31')];_0x36775b[_0x6d7c('0x1f')][_0x6d7c('0x32')]=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x33')];_0x36775b[_0x6d7c('0x1f')][_0x6d7c('0x34')]=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x2d')]&&_0x4ee6b1['queryResult']['diagnosticInfo']['fields']?_0x4ee6b1['queryResult'][_0x6d7c('0x2d')][_0x6d7c('0x2e')]['end_conversation'][_0x6d7c('0x30')]:![];_0x36775b['body'][_0x6d7c('0x35')]=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x36')][_0x6d7c('0x37')];_0x36775b[_0x6d7c('0x1f')][_0x6d7c('0x38')]=_0x4ee6b1[_0x6d7c('0x2c')]['intent'][_0x6d7c('0x39')];_0x36775b[_0x6d7c('0x1f')][_0x6d7c('0x3a')]=_0x4ee6b1['queryResult']['intent'][_0x6d7c('0x3b')];_0x36775b[_0x6d7c('0x1f')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x3c')];_0x36775b['body'][_0x6d7c('0x3d')]=_0x4ee6b1[_0x6d7c('0x2c')][_0x6d7c('0x3e')];_0x36775b[_0x6d7c('0x1f')][_0x6d7c('0x3f')]=_0x4ee6b1['queryResult']['intentDetectionConfidence'];_0x348b3b[_0x6d7c('0x40')]='dialogflowV2';_0x348b3b['providerResponse']=JSON[_0x6d7c('0x22')](_0x46c480);var _0x11e1e4=[];for(var _0x2890cc=0x0;_0x2890cc<_0x46c480[_0x6d7c('0x2a')];_0x2890cc++){var _0x332f69=_0x46c480[_0x2890cc];if(_0x332f69&&_0x332f69[_0x6d7c('0x2c')]&&_0x332f69[_0x6d7c('0x2c')][_0x6d7c('0x41')]){_0x11e1e4[_0x6d7c('0x42')](createMessage(_0x32b0dd,_0xa5350c,_0x348b3b,_0x332f69['queryResult'][_0x6d7c('0x41')]));}}return Promise[_0x6d7c('0x43')](_0x11e1e4)[_0x6d7c('0xb')](function(){if(_0x923966){_0x376971[_0x6d7c('0x11')]();}else{_0x376971[_0x6d7c('0x44')]();}})[_0x6d7c('0x21')](function(_0x1760d8){logger[_0x6d7c('0xe')](_0x6d7c('0xd'),_0x32b0dd,JSON[_0x6d7c('0x22')](_0x1760d8));_0x376971[_0x6d7c('0x11')]();});}})[_0x6d7c('0x21')](function(_0x42d47f){logger['error'](_0x6d7c('0xd'),_0x32b0dd,_0x42d47f[_0x6d7c('0x28')],_0x42d47f['stack']);_0x376971[_0x6d7c('0x11')]();});}}catch(_0x2b029f){logger[_0x6d7c('0xe')](_0x6d7c('0xd'),_0x32b0dd,JSON[_0x6d7c('0x22')](_0x2b029f));_0x376971['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index b60cdb5..9be24df 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 _0x42c3=['number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','length','error','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0xf9862f,_0x34bf2b){var _0x4b6cb6=function(_0x4aa79f){while(--_0x4aa79f){_0xf9862f['push'](_0xf9862f['shift']());}};_0x4b6cb6(++_0x34bf2b);}(_0x42c3,0x1ac));var _0x342c=function(_0x1791af,_0x511825){_0x1791af=_0x1791af-0x0;var _0x4db407=_0x42c3[_0x1791af];return _0x4db407;};'use strict';var schema=require(_0x342c('0x0'));var _=require(_0x342c('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x342c('0x2'));var logger=require(_0x342c('0x3'))(_0x342c('0x4'));var gotoif=schema({'condition':{'type':_0x342c('0x5'),'required':!![],'message':_0x342c('0x6')},'priorityTrue':{'type':_0x342c('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x342c('0x7'),'message':_0x342c('0x8')}});exports[_0x342c('0x9')]=function(_0x35316a,_0xef6ca7){return function(_0x28e33f){try{var _0x2e8a64={'condition':htmlToText['fromString'](utils[_0x342c('0xa')](_0xef6ca7[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xef6ca7[0x1],'priorityFalse':_0xef6ca7[0x2]};var _0xce4643=gotoif[_0x342c('0x0')](_0x2e8a64,{'typecast':!![]});if(_0xce4643[_0x342c('0xb')]){logger[_0x342c('0xc')]('[%s][GOTOIF]\x20%s',_0x35316a,_['map'](_0xce4643,'message')[_0x342c('0xd')](',\x20'));_0x28e33f[_0x342c('0xe')]();}else{try{var _0x3b378b=eval('('+_0x2e8a64[_0x342c('0xf')]+')');var _0x30e82d=_0x3b378b?_0x2e8a64[_0x342c('0x10')]:_0x2e8a64[_0x342c('0x11')];logger[_0x342c('0x12')](_0x342c('0x13'),_0x35316a,_0x2e8a64[_0x342c('0xf')],_0x3b378b,_0x30e82d||_0x342c('0x14'));if(_0x30e82d){var _0x396756=_[_0x342c('0x15')](_0x28e33f[_0x342c('0x16')](),{'p':_0x30e82d});if(_0x396756>=0x0){logger[_0x342c('0x12')](_0x342c('0x17'),_0x35316a,_0x30e82d||_0x342c('0x14'),_0x396756);_0x28e33f[_0x342c('0x14')](_0x396756);}else{logger[_0x342c('0x12')](_0x342c('0x18'),_0x35316a,_0x30e82d||_0x342c('0x14'));_0x28e33f['stop']();}}else{_0x28e33f[_0x342c('0x14')]();}}catch(_0x3f755a){logger[_0x342c('0xc')](_0x342c('0x19'),_0x35316a,_0x3f755a[_0x342c('0x1a')]);_0x28e33f[_0x342c('0xe')]();}}}catch(_0x257399){logger[_0x342c('0xc')](_0x342c('0x1b'),_0x35316a,JSON[_0x342c('0x1c')](_0x257399));_0x28e33f['stop']();}};}; \ No newline at end of file +var _0x2ad8=['priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x2ad8,0x1d8));var _0x82ad=function(_0x32aa00,_0x53e494){_0x32aa00=_0x32aa00-0x0;var _0x3ae564=_0x2ad8[_0x32aa00];return _0x3ae564;};'use strict';var schema=require(_0x82ad('0x0'));var _=require(_0x82ad('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x82ad('0x2'));var logger=require(_0x82ad('0x3'))(_0x82ad('0x4'));var gotoif=schema({'condition':{'type':_0x82ad('0x5'),'required':!![],'message':_0x82ad('0x6')},'priorityTrue':{'type':_0x82ad('0x7'),'message':_0x82ad('0x8')},'priorityFalse':{'type':_0x82ad('0x7'),'message':_0x82ad('0x9')}});exports[_0x82ad('0xa')]=function(_0x7af328,_0x30d73b){return function(_0x31983e){try{var _0x16163c={'condition':htmlToText[_0x82ad('0xb')](utils[_0x82ad('0xc')](_0x30d73b[0x0],this),{'wordwrap':![]})[_0x82ad('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x30d73b[0x1],'priorityFalse':_0x30d73b[0x2]};var _0x4c0565=gotoif[_0x82ad('0x0')](_0x16163c,{'typecast':!![]});if(_0x4c0565[_0x82ad('0xe')]){logger['error'](_0x82ad('0xf'),_0x7af328,_['map'](_0x4c0565,_0x82ad('0x10'))[_0x82ad('0x11')](',\x20'));_0x31983e[_0x82ad('0x12')]();}else{try{var _0x531e07=eval('('+_0x16163c[_0x82ad('0x13')]+')');var _0x3b1396=_0x531e07?_0x16163c[_0x82ad('0x14')]:_0x16163c[_0x82ad('0x15')];logger[_0x82ad('0x16')](_0x82ad('0x17'),_0x7af328,_0x16163c[_0x82ad('0x13')],_0x531e07,_0x3b1396||_0x82ad('0x18'));if(_0x3b1396){var _0x2c8135=_[_0x82ad('0x19')](_0x31983e[_0x82ad('0x1a')](),{'p':_0x3b1396});if(_0x2c8135>=0x0){logger[_0x82ad('0x16')](_0x82ad('0x1b'),_0x7af328,_0x3b1396||_0x82ad('0x18'),_0x2c8135);_0x31983e[_0x82ad('0x18')](_0x2c8135);}else{logger[_0x82ad('0x16')](_0x82ad('0x1c'),_0x7af328,_0x3b1396||_0x82ad('0x18'));_0x31983e[_0x82ad('0x12')]();}}else{_0x31983e['next']();}}catch(_0x2556df){logger[_0x82ad('0x1d')](_0x82ad('0x1e'),_0x7af328,_0x2556df[_0x82ad('0x10')]);_0x31983e[_0x82ad('0x12')]();}}}catch(_0x39a645){logger['error'](_0x82ad('0xf'),_0x7af328,JSON[_0x82ad('0x1f')](_0x39a645));_0x31983e[_0x82ad('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 413e70d..27da332 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 _0x3967=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','routing'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3967,0x1c9));var _0x7396=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x3967[_0x36d703];return _0x12c909;};'use strict';var schema=require(_0x7396('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x7396('0x1'));var gotop=schema({'priority':{'type':_0x7396('0x2'),'required':!![],'message':_0x7396('0x3')}});exports[_0x7396('0x4')]=function(_0x49126f,_0x1ee58a){return function(_0x23c8a2){try{var _0x5de2e7={'priority':_0x1ee58a[0x0]};var _0x147678=gotop[_0x7396('0x0')](_0x5de2e7,{'typecast':!![]});if(_0x147678[_0x7396('0x5')]){logger[_0x7396('0x6')](_0x7396('0x7'),_0x49126f,_[_0x7396('0x8')](_0x147678,'message')[_0x7396('0x9')](',\x20'));_0x23c8a2[_0x7396('0xa')]();}else{logger[_0x7396('0xb')](_0x7396('0xc'),_0x49126f,_0x5de2e7['priority']);if(_0x5de2e7[_0x7396('0xd')]){var _0x3faf61=_['findIndex'](_0x23c8a2['rules'](),{'p':_0x5de2e7[_0x7396('0xd')]});if(_0x3faf61>=0x0){logger[_0x7396('0xb')](_0x7396('0xe'),_0x49126f,_0x5de2e7[_0x7396('0xd')]||'next',_0x3faf61);_0x23c8a2[_0x7396('0xf')](_0x3faf61);}else{logger['info'](_0x7396('0x10'),_0x49126f,_0x5de2e7[_0x7396('0xd')]||_0x7396('0xf'));_0x23c8a2[_0x7396('0xa')]();}}else{_0x23c8a2['next']();}}}catch(_0x3dcd29){logger['error']('[%s][GOTOP]\x20%s',_0x49126f,JSON['stringify'](_0x3dcd29));_0x23c8a2['stop']();}};}; \ No newline at end of file +var _0xaf1e=['map','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s'];(function(_0x1dcb79,_0x3c9ce5){var _0x33834c=function(_0x10fd18){while(--_0x10fd18){_0x1dcb79['push'](_0x1dcb79['shift']());}};_0x33834c(++_0x3c9ce5);}(_0xaf1e,0x76));var _0xeaf1=function(_0x17009f,_0x5dd6d9){_0x17009f=_0x17009f-0x0;var _0x2e2947=_0xaf1e[_0x17009f];return _0x2e2947;};'use strict';var schema=require(_0xeaf1('0x0'));var _=require(_0xeaf1('0x1'));var logger=require(_0xeaf1('0x2'))('routing');var gotop=schema({'priority':{'type':_0xeaf1('0x3'),'required':!![],'message':_0xeaf1('0x4')}});exports[_0xeaf1('0x5')]=function(_0x2c5199,_0x4bdabf){return function(_0x291658){try{var _0x15324d={'priority':_0x4bdabf[0x0]};var _0x448612=gotop[_0xeaf1('0x0')](_0x15324d,{'typecast':!![]});if(_0x448612[_0xeaf1('0x6')]){logger['error'](_0xeaf1('0x7'),_0x2c5199,_[_0xeaf1('0x8')](_0x448612,'message')['join'](',\x20'));_0x291658[_0xeaf1('0x9')]();}else{logger[_0xeaf1('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x2c5199,_0x15324d['priority']);if(_0x15324d[_0xeaf1('0xb')]){var _0x23be0b=_['findIndex'](_0x291658[_0xeaf1('0xc')](),{'p':_0x15324d[_0xeaf1('0xb')]});if(_0x23be0b>=0x0){logger['info'](_0xeaf1('0xd'),_0x2c5199,_0x15324d[_0xeaf1('0xb')]||_0xeaf1('0xe'),_0x23be0b);_0x291658[_0xeaf1('0xe')](_0x23be0b);}else{logger[_0xeaf1('0xa')](_0xeaf1('0xf'),_0x2c5199,_0x15324d['priority']||_0xeaf1('0xe'));_0x291658[_0xeaf1('0x9')]();}}else{_0x291658[_0xeaf1('0xe')]();}}}catch(_0x4bfedc){logger[_0xeaf1('0x10')]('[%s][GOTOP]\x20%s',_0x2c5199,JSON[_0xeaf1('0x11')](_0x4bfedc));_0x291658['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index b3d7d5a..fdf36ef 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 _0x082e=['body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','account','upperFirst','AccountId','interaction','Message','then'];(function(_0x587338,_0x20a60e){var _0x3cc80b=function(_0x35aa04){while(--_0x35aa04){_0x587338['push'](_0x587338['shift']());}};_0x3cc80b(++_0x20a60e);}(_0x082e,0x17d));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe082('0x0'));var utils=require(_0xe082('0x1'));var logger=require(_0xe082('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe082('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe082('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe082('0x5'))};exports[_0xe082('0x6')]=function(_0x5ca6cf,_0x4afd1c){return function(_0x34f95f){try{var _0x44f13a={'body':utils['getMustacheRender'](_0x4afd1c[0x0],this),'ContactId':this[_0xe082('0x7')]['id']};if(this[_0xe082('0x8')]==='chat'){_0x44f13a['ChatWebsiteId']=this[_0xe082('0x9')]['id'];}else{_0x44f13a[_[_0xe082('0xa')](this['channel'])+_0xe082('0xb')]=this['account']['id'];}_0x44f13a[_[_0xe082('0xa')](this[_0xe082('0x8')])+'InteractionId']=this[_0xe082('0xc')]['id'];if(rpc[this[_0xe082('0x8')]+_0xe082('0xd')]){return rpc[this[_0xe082('0x8')]+_0xe082('0xd')]['create'](_0x44f13a)[_0xe082('0xe')](function(_0x1127d1){logger['info']('[%s][MESSAGE]\x20%s',_0x5ca6cf,_0x44f13a[_0xe082('0xf')]);_0x34f95f[_0xe082('0x10')]();})[_0xe082('0x11')](function(_0x3b93cd){logger[_0xe082('0x12')](_0xe082('0x13'),_0x5ca6cf,JSON[_0xe082('0x14')](_0x3b93cd));_0x34f95f[_0xe082('0x15')]();});}}catch(_0x5b21b9){logger[_0xe082('0x12')](_0xe082('0x13'),_0x5ca6cf,JSON[_0xe082('0x14')](_0x5b21b9));_0x34f95f[_0xe082('0x15')]();}};}; \ No newline at end of file +var _0xe860=['consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x3582c8,_0x47b639){var _0x5e55fa=function(_0x35911f){while(--_0x35911f){_0x3582c8['push'](_0x3582c8['shift']());}};_0x5e55fa(++_0x47b639);}(_0xe860,0x188));var _0x0e86=function(_0x206b26,_0x5af0e7){_0x206b26=_0x206b26-0x0;var _0x512772=_0xe860[_0x206b26];return _0x512772;};'use strict';var _=require(_0x0e86('0x0'));var utils=require(_0x0e86('0x1'));var logger=require(_0x0e86('0x2'))(_0x0e86('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0e86('0x4')),'mailMessage':require(_0x0e86('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0e86('0x6')),'whatsappMessage':require(_0x0e86('0x7'))};exports[_0x0e86('0x8')]=function(_0x231733,_0xbc6b0f){return function(_0x1dd265){try{var _0x2efc2d={'body':utils[_0x0e86('0x9')](_0xbc6b0f[0x0],this),'ContactId':this[_0x0e86('0xa')]['id']};if(this[_0x0e86('0xb')]==='chat'){_0x2efc2d[_0x0e86('0xc')]=this['account']['id'];}else{_0x2efc2d[_[_0x0e86('0xd')](this['channel'])+'AccountId']=this['account']['id'];}_0x2efc2d[_['upperFirst'](this[_0x0e86('0xb')])+'InteractionId']=this[_0x0e86('0xe')]['id'];if(rpc[this[_0x0e86('0xb')]+'Message']){return rpc[this[_0x0e86('0xb')]+_0x0e86('0xf')][_0x0e86('0x10')](_0x2efc2d)[_0x0e86('0x11')](function(_0x2ef563){logger[_0x0e86('0x12')](_0x0e86('0x13'),_0x231733,_0x2efc2d['body']);_0x1dd265[_0x0e86('0x14')]();})[_0x0e86('0x15')](function(_0xbd69f4){logger[_0x0e86('0x16')](_0x0e86('0x13'),_0x231733,JSON[_0x0e86('0x17')](_0xbd69f4));_0x1dd265[_0x0e86('0x18')]();});}}catch(_0x3e4189){logger[_0x0e86('0x16')](_0x0e86('0x13'),_0x231733,JSON[_0x0e86('0x17')](_0x3e4189));_0x1dd265[_0x0e86('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b1f8363..8aa8ef2 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 _0x6b30=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','../../../../config/logger','routing','consequence'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x6b30,0x185));var _0x06b3=function(_0x1c0e1a,_0x361353){_0x1c0e1a=_0x1c0e1a-0x0;var _0x46840d=_0x6b30[_0x1c0e1a];return _0x46840d;};'use strict';var utils=require('./utils');var logger=require(_0x06b3('0x0'))(_0x06b3('0x1'));exports[_0x06b3('0x2')]=function(_0x32f36f,_0xd2abfd){return function(_0x2bf08d){try{logger[_0x06b3('0x3')](_0x06b3('0x4'),_0x32f36f,utils[_0x06b3('0x5')](_0xd2abfd[0x0],this));_0x2bf08d[_0x06b3('0x6')]();}catch(_0x2708de){logger[_0x06b3('0x7')](_0x06b3('0x4'),_0x32f36f,JSON['stringify'](_0x2708de));_0x2bf08d['stop']();}};}; \ No newline at end of file +var _0x79d9=['info','[%s][NOOP]\x20%s','getMustacheRender','error','stop','./utils','../../../../config/logger','routing'];(function(_0x1b33ad,_0x5612d6){var _0x3d0705=function(_0x3abf83){while(--_0x3abf83){_0x1b33ad['push'](_0x1b33ad['shift']());}};_0x3d0705(++_0x5612d6);}(_0x79d9,0x1ed));var _0x979d=function(_0x2aa477,_0x331cda){_0x2aa477=_0x2aa477-0x0;var _0x487b15=_0x79d9[_0x2aa477];return _0x487b15;};'use strict';var utils=require(_0x979d('0x0'));var logger=require(_0x979d('0x1'))(_0x979d('0x2'));exports['consequence']=function(_0x1add95,_0x1da795){return function(_0xd2d576){try{logger[_0x979d('0x3')](_0x979d('0x4'),_0x1add95,utils[_0x979d('0x5')](_0x1da795[0x0],this));_0xd2d576['next']();}catch(_0x5488f8){logger[_0x979d('0x6')](_0x979d('0x4'),_0x1add95,JSON['stringify'](_0x5488f8));_0xd2d576[_0x979d('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 39a5a06..e84e85c 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 _0xd138=['number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','../../../../config/environment','./strategy','redis','queue_id','account','from','clone','queue','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x167d9d,_0x19fb16){var _0x95a2bc=function(_0x49e91a){while(--_0x49e91a){_0x167d9d['push'](_0x167d9d['shift']());}};_0x95a2bc(++_0x19fb16);}(_0xd138,0x1dc));var _0x8d13=function(_0x213f49,_0x7eacb7){_0x213f49=_0x213f49-0x0;var _0x124559=_0xd138[_0x213f49];return _0x124559;};'use strict';var schema=require(_0x8d13('0x0'));var _=require(_0x8d13('0x1'));var util=require(_0x8d13('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require(_0x8d13('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x8d13('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d13('0x5')]));var attributes=['id',_0x8d13('0x6'),_0x8d13('0x7'),'queue',_0x8d13('0x8'),'joinAt'];function emit(_0x29a579,_0x98805f,_0x56150b){io['to'](_0x29a579)['emit'](_0x98805f,_0x56150b);}function emitChannelQueueInteraction(_0x14e1ce,_0x3b0009,_0x30045b,_0x4ed9ba,_0x39408c,_0x2f769b,_0x21bf55,_0x5aa05e){var _0x418b69=_[_0x8d13('0x9')](_0x30045b);_0x418b69[_0x8d13('0x6')]=_0x5aa05e;_0x418b69[_0x8d13('0xa')]=_0x3b0009;_0x418b69[_0x8d13('0x7')]=_0x4ed9ba;_0x418b69['id']=_0x39408c;if(_0x2f769b){attributes[_0x8d13('0xb')](_[_0x8d13('0xc')](_0x14e1ce)+_0x8d13('0xd'));_0x21bf55[util[_0x8d13('0xe')]('%sQueuesWaitingInteractions',_0x14e1ce)][_0x39408c]=_[_0x8d13('0xf')](_0x418b69,attributes);}else{delete _0x21bf55[util['format'](_0x8d13('0x10'),_0x14e1ce)][_0x39408c];}emit(util[_0x8d13('0xe')]('%s:queue:%s',_0x14e1ce,_0x3b0009),util[_0x8d13('0xe')](_0x8d13('0x11'),_0x14e1ce,_0x2f769b?_0x8d13('0x12'):_0x8d13('0x13')),_[_0x8d13('0xf')](_0x418b69,attributes));}var rpc={'openchannelQueueReport':require(_0x8d13('0x14')),'mailQueueReport':require(_0x8d13('0x15')),'chatQueueReport':require(_0x8d13('0x16')),'smsQueueReport':require(_0x8d13('0x17')),'faxQueueReport':require(_0x8d13('0x18')),'whatsappQueueReport':require(_0x8d13('0x19')),'chatInteraction':require(_0x8d13('0x1a')),'faxInteraction':require(_0x8d13('0x1b')),'mailInteraction':require(_0x8d13('0x1c')),'openchannelInteraction':require(_0x8d13('0x1d')),'smsInteraction':require(_0x8d13('0x1e')),'whatsappInteraction':require(_0x8d13('0x1f'))};var queue=schema({'name':{'type':_0x8d13('0x20'),'required':!![],'message':_0x8d13('0x21')},'timeout':{'type':_0x8d13('0x22'),'message':_0x8d13('0x23')}});function startRouting(_0x346c60,_0x2b6e28,_0x535283,_0x33ce65){if(_0x346c60&&_0x2b6e28&&_0x535283){_0x2b6e28[_0x8d13('0x24')]+=0x1;var _0x3c7524={'uniqueid':_0x346c60,'from':_0x535283['body']?_0x535283[_0x8d13('0x25')][_0x8d13('0x8')]:'','joinAt':moment()[_0x8d13('0xe')](_0x8d13('0x26')),'ContactId':_0x535283[_0x8d13('0x27')]?_0x535283[_0x8d13('0x27')]['id']:null,'ListId':_0x535283[_0x8d13('0x28')]?_0x535283[_0x8d13('0x28')]['id']:null};_0x3c7524[_['upperFirst'](_0x535283[_0x8d13('0x29')])+_0x8d13('0x2a')]=_0x2b6e28['id']||null;_0x3c7524[_[_0x8d13('0x2b')](_0x535283[_0x8d13('0x29')])+_0x8d13('0xd')]=_0x535283[_0x8d13('0x2c')]?_0x535283[_0x8d13('0x2c')]['id']:null;_0x3c7524[_[_0x8d13('0x2b')](_0x535283[_0x8d13('0x29')])+_0x8d13('0x2d')]=_0x535283[_0x8d13('0x2e')]?_0x535283[_0x8d13('0x2e')]['id']:null;_0x3c7524[_['upperFirst'](_0x535283['channel'])+(_0x535283['channel']!=='chat'?_0x8d13('0x2f'):_0x8d13('0x30'))]=_0x535283[_0x8d13('0x7')]?_0x535283['account']['id']:null;logger[_0x8d13('0x31')](util[_0x8d13('0xe')](_0x8d13('0x32'),_0x346c60,_0x2b6e28[_0x8d13('0x33')]));emitChannelQueueInteraction(_0x535283[_0x8d13('0x29')],_0x2b6e28[_0x8d13('0x33')],_0x3c7524,_0x535283[_0x8d13('0x7')][_0x8d13('0x33')],_0x535283[_0x8d13('0x2e')]['id'],!![],_0x33ce65,_0x2b6e28['id']);if(rpc[_0x535283['channel']+_0x8d13('0x34')]){return rpc[_0x535283[_0x8d13('0x29')]+_0x8d13('0x34')][_0x8d13('0x35')](_0x3c7524)[_0x8d13('0x36')](function(_0x550ad0){logger[_0x8d13('0x37')](_0x8d13('0x38'),_0x550ad0);});}}}function stopRouting(_0x1cd10c,_0x3268ee,_0xfc9374,_0x43b7c8){if(_0x1cd10c&&_0x3268ee){_0x3268ee[_0x8d13('0x24')]-=0x1;var _0x42538b={'leaveAt':moment()['format'](_0x8d13('0x26')),'acceptAt':moment()[_0x8d13('0xe')](_0x8d13('0x26')),'reason':_0x8d13('0x39')};logger[_0x8d13('0x31')](util[_0x8d13('0xe')](_0x8d13('0x3a'),_0x1cd10c,_0x3268ee['name']));emitChannelQueueInteraction(_0xfc9374['channel'],_0x3268ee['name'],_0xfc9374[_0x8d13('0x25')],_0xfc9374[_0x8d13('0x7')][_0x8d13('0x33')],_0xfc9374[_0x8d13('0x2e')]['id'],![],_0x43b7c8,_0x3268ee['id']);return rpc[_0xfc9374[_0x8d13('0x29')]+_0x8d13('0x3b')][_0x8d13('0x3c')](_0xfc9374[_0x8d13('0x2c')]['id'],{'queueId':_0x3268ee['id']})['then'](function(){if(rpc[_0xfc9374['channel']+_0x8d13('0x34')]){return rpc[_0xfc9374[_0x8d13('0x29')]+'QueueReport']['update'](_0x1cd10c,_0x42538b)[_0x8d13('0x36')](function(_0x11b56c){logger[_0x8d13('0x37')](_0x8d13('0x3d'),_0x11b56c);});}});}}function endRouting(_0x14a1de,_0x2c3bf9,_0x3b3f0d,_0x57d0ed){if(_0x14a1de&&_0x2c3bf9){_0x2c3bf9[_0x8d13('0x24')]-=0x1;var _0x40f9e8={'leaveAt':moment()[_0x8d13('0xe')](_0x8d13('0x26')),'exitAt':moment()[_0x8d13('0xe')](_0x8d13('0x26')),'reason':'timeout'};logger[_0x8d13('0x31')](util['format'](_0x8d13('0x3e'),_0x14a1de,_0x2c3bf9[_0x8d13('0x33')]));emitChannelQueueInteraction(_0x3b3f0d[_0x8d13('0x29')],_0x2c3bf9[_0x8d13('0x33')],_0x3b3f0d[_0x8d13('0x25')],_0x3b3f0d['account']['name'],_0x3b3f0d[_0x8d13('0x2e')]['id'],![],_0x57d0ed);if(rpc[_0x3b3f0d[_0x8d13('0x29')]+'QueueReport']){return rpc[_0x3b3f0d[_0x8d13('0x29')]+_0x8d13('0x34')][_0x8d13('0x3c')](_0x14a1de,_0x40f9e8)[_0x8d13('0x36')](function(_0x5b3f7a){logger[_0x8d13('0x37')](_0x8d13('0x3d'),_0x5b3f7a);});}}}function handleFindQueue(_0x216af6){return function(_0x4ea28e){return _0x4ea28e['name'][_0x8d13('0x3f')]()===_0x216af6['toLowerCase']();};}exports[_0x8d13('0x40')]=function(_0x32fdb3,_0x350217,_0xd2ad2d,_0x4b375d){return function(_0x25ecf8){try{var _0x4f3937={'name':_0x350217[0x0],'timeout':_0x350217[0x1]};var _0x428a91=queue[_0x8d13('0x0')](_0x4f3937,{'typecast':!![]});if(_0x428a91[_0x8d13('0x41')]){logger[_0x8d13('0x37')]('[%s][QUEUE]\x20%s',_0x32fdb3,_[_0x8d13('0x42')](_0x428a91,_0x8d13('0x2e'))[_0x8d13('0x43')](',\x20'));_0x25ecf8['stop']();}else{var _0x3ef12c=_[_0x8d13('0x44')](_0xd2ad2d[_0x4b375d['channel']+_0x8d13('0x45')],handleFindQueue(_0x4f3937['name']));if(_0x3ef12c){startRouting(_0x32fdb3,_0x3ef12c,_0x4b375d,_0xd2ad2d);var _0x5bcada=(_0x3ef12c[_0x8d13('0x46')]||0xa)*0x3e8;var _0x1f9422=(_0x4f3937[_0x8d13('0x46')]||0x14)*0x3e8;var _0x2cd91b;if(_0x5bcada>_0x1f9422){_0x1f9422=_0x5bcada;}var _0x277cf7=seqqueue[_0x8d13('0x47')](_0x5bcada);_0x277cf7['id']=_0x32fdb3;_0x277cf7[_0x8d13('0x48')]=_0x5bcada;_0x277cf7[_0x8d13('0x49')]=_0x1f9422;_0x277cf7['channel']=_0x4b375d['channel'];_0xd2ad2d[_0x8d13('0x4a')][_0x32fdb3]['on']('end',function(){logger[_0x8d13('0x31')](_0x8d13('0x4b'),_0x32fdb3);stopRouting(_0x32fdb3,_0x3ef12c,_0x4b375d,_0xd2ad2d);clearTimeout(_0x2cd91b);_0x2cd91b=undefined;_0x277cf7[_0x8d13('0x4c')](!![]);if(_0xd2ad2d[_0x8d13('0x4a')][_0x32fdb3]){delete _0xd2ad2d[_0x8d13('0x4a')][_0x32fdb3];}_0x25ecf8[_0x8d13('0x4d')]();});_0xd2ad2d[_0x8d13('0x4a')][_0x32fdb3]['on'](_0x8d13('0x4e'),function(){if(_0xd2ad2d['rules'][_0x32fdb3]){delete _0xd2ad2d[_0x8d13('0x4a')][_0x32fdb3];}});_0x2cd91b=setTimeout(function(){logger[_0x8d13('0x31')](_0x8d13('0x4f'),_0x32fdb3);endRouting(_0x32fdb3,_0x3ef12c,_0x4b375d,_0xd2ad2d);clearTimeout(_0x2cd91b);_0x277cf7[_0x8d13('0x4c')](!![]);_0x25ecf8['next']();},_0x1f9422);switch(_0x3ef12c[_0x8d13('0x50')]){case _0x8d13('0x51'):strategy['rrmemory'](_0x277cf7,_0x3ef12c,_0xd2ad2d,_0x4b375d);break;default:strategy[_0x8d13('0x52')](_0x277cf7,_0x3ef12c,_0xd2ad2d,_0x4b375d);}}else{logger['error'](_0x8d13('0x53'),_0x32fdb3,_0x4f3937[_0x8d13('0x33')]);_0x25ecf8[_0x8d13('0x4d')]();}}}catch(_0x1e8d85){logger[_0x8d13('0x37')]('[%s][QUEUE]\x20%s',_0x32fdb3,_0x1e8d85[_0x8d13('0x54')]);_0x25ecf8[_0x8d13('0x4d')]();}};}; \ No newline at end of file +var _0x67a8=['../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','account','push','capitalize','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','error','update\x20queue\x20report','timeout','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','strategy','rrmemory','beepall','lodash','util','seq-queue','moment','ioredis'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x67a8,0xa5));var _0x867a=function(_0x1f5a6c,_0x356896){_0x1f5a6c=_0x1f5a6c-0x0;var _0x5bc258=_0x67a8[_0x1f5a6c];return _0x5bc258;};'use strict';var schema=require('validate');var _=require(_0x867a('0x0'));var util=require(_0x867a('0x1'));var seqqueue=require(_0x867a('0x2'));var moment=require(_0x867a('0x3'));var Redis=require(_0x867a('0x4'));var config=require(_0x867a('0x5'));var logger=require('../../../../config/logger')(_0x867a('0x6'));var strategy=require(_0x867a('0x7'));config[_0x867a('0x8')]=_[_0x867a('0x9')](config['redis'],{'host':_0x867a('0xa'),'port':0x18eb});var io=require(_0x867a('0xb'))(new Redis(config[_0x867a('0x8')]));var attributes=['id',_0x867a('0xc'),'account',_0x867a('0xd'),'from','joinAt'];function emit(_0x39b724,_0x2757ad,_0x2e8439){io['to'](_0x39b724)['emit'](_0x2757ad,_0x2e8439);}function emitChannelQueueInteraction(_0x523c6d,_0x3a7b89,_0x2e057d,_0x54b74f,_0x1e521b,_0xe67b4e,_0xedc2ad,_0x195672){var _0x3f26cd=_[_0x867a('0xe')](_0x2e057d);_0x3f26cd[_0x867a('0xc')]=_0x195672;_0x3f26cd[_0x867a('0xd')]=_0x3a7b89;_0x3f26cd[_0x867a('0xf')]=_0x54b74f;_0x3f26cd['id']=_0x1e521b;if(_0xe67b4e){attributes[_0x867a('0x10')](_[_0x867a('0x11')](_0x523c6d)+'InteractionId');_0xedc2ad[util[_0x867a('0x12')]('%sQueuesWaitingInteractions',_0x523c6d)][_0x1e521b]=_[_0x867a('0x13')](_0x3f26cd,attributes);}else{delete _0xedc2ad[util[_0x867a('0x12')](_0x867a('0x14'),_0x523c6d)][_0x1e521b];}emit(util['format'](_0x867a('0x15'),_0x523c6d,_0x3a7b89),util[_0x867a('0x12')](_0x867a('0x16'),_0x523c6d,_0xe67b4e?_0x867a('0x17'):_0x867a('0x18')),_['pick'](_0x3f26cd,attributes));}var rpc={'openchannelQueueReport':require(_0x867a('0x19')),'mailQueueReport':require(_0x867a('0x1a')),'chatQueueReport':require(_0x867a('0x1b')),'smsQueueReport':require(_0x867a('0x1c')),'faxQueueReport':require(_0x867a('0x1d')),'whatsappQueueReport':require(_0x867a('0x1e')),'chatInteraction':require(_0x867a('0x1f')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x867a('0x20')),'openchannelInteraction':require(_0x867a('0x21')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x867a('0x22'))};var queue=schema({'name':{'type':_0x867a('0x23'),'required':!![],'message':_0x867a('0x24')},'timeout':{'type':_0x867a('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1f65ae,_0x28981,_0x3a08ac,_0x1e80cf){if(_0x1f65ae&&_0x28981&&_0x3a08ac){_0x28981['waiting']+=0x1;var _0x34f333={'uniqueid':_0x1f65ae,'from':_0x3a08ac['body']?_0x3a08ac[_0x867a('0x26')][_0x867a('0x27')]:'','joinAt':moment()[_0x867a('0x12')](_0x867a('0x28')),'ContactId':_0x3a08ac[_0x867a('0x29')]?_0x3a08ac['contact']['id']:null,'ListId':_0x3a08ac[_0x867a('0x2a')]?_0x3a08ac[_0x867a('0x2a')]['id']:null};_0x34f333[_[_0x867a('0x2b')](_0x3a08ac[_0x867a('0x2c')])+_0x867a('0x2d')]=_0x28981['id']||null;_0x34f333[_[_0x867a('0x2b')](_0x3a08ac[_0x867a('0x2c')])+_0x867a('0x2e')]=_0x3a08ac['interaction']?_0x3a08ac[_0x867a('0x2f')]['id']:null;_0x34f333[_[_0x867a('0x2b')](_0x3a08ac[_0x867a('0x2c')])+_0x867a('0x30')]=_0x3a08ac[_0x867a('0x31')]?_0x3a08ac[_0x867a('0x31')]['id']:null;_0x34f333[_['upperFirst'](_0x3a08ac[_0x867a('0x2c')])+(_0x3a08ac['channel']!==_0x867a('0x32')?_0x867a('0x33'):_0x867a('0x34'))]=_0x3a08ac[_0x867a('0xf')]?_0x3a08ac[_0x867a('0xf')]['id']:null;logger[_0x867a('0x35')](util[_0x867a('0x12')](_0x867a('0x36'),_0x1f65ae,_0x28981[_0x867a('0x37')]));emitChannelQueueInteraction(_0x3a08ac[_0x867a('0x2c')],_0x28981['name'],_0x34f333,_0x3a08ac['account'][_0x867a('0x37')],_0x3a08ac[_0x867a('0x31')]['id'],!![],_0x1e80cf,_0x28981['id']);if(rpc[_0x3a08ac[_0x867a('0x2c')]+'QueueReport']){return rpc[_0x3a08ac[_0x867a('0x2c')]+_0x867a('0x38')]['create'](_0x34f333)[_0x867a('0x39')](function(_0x190065){logger['error'](_0x867a('0x3a'),_0x190065);});}}}function stopRouting(_0x47f66a,_0x2fc0e9,_0x1b6bb3,_0x3cd288){if(_0x47f66a&&_0x2fc0e9){_0x2fc0e9[_0x867a('0x3b')]-=0x1;var _0x428a2e={'leaveAt':moment()[_0x867a('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x867a('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x867a('0x3c')};logger['info'](util[_0x867a('0x12')](_0x867a('0x3d'),_0x47f66a,_0x2fc0e9['name']));emitChannelQueueInteraction(_0x1b6bb3['channel'],_0x2fc0e9['name'],_0x1b6bb3[_0x867a('0x26')],_0x1b6bb3[_0x867a('0xf')][_0x867a('0x37')],_0x1b6bb3['message']['id'],![],_0x3cd288,_0x2fc0e9['id']);return rpc[_0x1b6bb3[_0x867a('0x2c')]+'Interaction'][_0x867a('0x3e')](_0x1b6bb3['interaction']['id'],{'queueId':_0x2fc0e9['id']})[_0x867a('0x3f')](function(){if(rpc[_0x1b6bb3[_0x867a('0x2c')]+'QueueReport']){return rpc[_0x1b6bb3[_0x867a('0x2c')]+_0x867a('0x38')][_0x867a('0x3e')](_0x47f66a,_0x428a2e)[_0x867a('0x39')](function(_0x17f22b){logger[_0x867a('0x40')](_0x867a('0x41'),_0x17f22b);});}});}}function endRouting(_0x3c796b,_0x3d68ac,_0x429b1b,_0x1889c1){if(_0x3c796b&&_0x3d68ac){_0x3d68ac[_0x867a('0x3b')]-=0x1;var _0x12e5a8={'leaveAt':moment()[_0x867a('0x12')](_0x867a('0x28')),'exitAt':moment()[_0x867a('0x12')](_0x867a('0x28')),'reason':_0x867a('0x42')};logger[_0x867a('0x35')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3c796b,_0x3d68ac[_0x867a('0x37')]));emitChannelQueueInteraction(_0x429b1b[_0x867a('0x2c')],_0x3d68ac[_0x867a('0x37')],_0x429b1b['body'],_0x429b1b['account'][_0x867a('0x37')],_0x429b1b[_0x867a('0x31')]['id'],![],_0x1889c1);if(rpc[_0x429b1b[_0x867a('0x2c')]+'QueueReport']){return rpc[_0x429b1b[_0x867a('0x2c')]+'QueueReport']['update'](_0x3c796b,_0x12e5a8)[_0x867a('0x39')](function(_0x49fade){logger[_0x867a('0x40')](_0x867a('0x41'),_0x49fade);});}}}function handleFindQueue(_0x915f45){return function(_0x11e78f){return _0x11e78f[_0x867a('0x37')][_0x867a('0x43')]()===_0x915f45[_0x867a('0x43')]();};}exports[_0x867a('0x44')]=function(_0x2222fe,_0x12fcc2,_0x4086ff,_0x2532a6){return function(_0x4a2def){try{var _0x3d2e06={'name':_0x12fcc2[0x0],'timeout':_0x12fcc2[0x1]};var _0x47c88a=queue[_0x867a('0x45')](_0x3d2e06,{'typecast':!![]});if(_0x47c88a[_0x867a('0x46')]){logger['error'](_0x867a('0x47'),_0x2222fe,_['map'](_0x47c88a,'message')[_0x867a('0x48')](',\x20'));_0x4a2def[_0x867a('0x49')]();}else{var _0x566802=_[_0x867a('0x4a')](_0x4086ff[_0x2532a6[_0x867a('0x2c')]+_0x867a('0x4b')],handleFindQueue(_0x3d2e06[_0x867a('0x37')]));if(_0x566802){startRouting(_0x2222fe,_0x566802,_0x2532a6,_0x4086ff);var _0x52ad84=(_0x566802[_0x867a('0x42')]||0xa)*0x3e8;var _0x496304=(_0x3d2e06[_0x867a('0x42')]||0x14)*0x3e8;var _0x1828a0;if(_0x52ad84>_0x496304){_0x496304=_0x52ad84;}var _0x59446a=seqqueue[_0x867a('0x4c')](_0x52ad84);_0x59446a['id']=_0x2222fe;_0x59446a[_0x867a('0x4d')]=_0x52ad84;_0x59446a['qtimeout']=_0x496304;_0x59446a['channel']=_0x2532a6[_0x867a('0x2c')];_0x4086ff[_0x867a('0x4e')][_0x2222fe]['on'](_0x867a('0x4f'),function(){logger[_0x867a('0x35')](_0x867a('0x50'),_0x2222fe);stopRouting(_0x2222fe,_0x566802,_0x2532a6,_0x4086ff);clearTimeout(_0x1828a0);_0x1828a0=undefined;_0x59446a['close'](!![]);if(_0x4086ff['rules'][_0x2222fe]){delete _0x4086ff['rules'][_0x2222fe];}_0x4a2def[_0x867a('0x49')]();});_0x4086ff['rules'][_0x2222fe]['on'](_0x867a('0x51'),function(){if(_0x4086ff[_0x867a('0x4e')][_0x2222fe]){delete _0x4086ff[_0x867a('0x4e')][_0x2222fe];}});_0x1828a0=setTimeout(function(){logger[_0x867a('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2222fe);endRouting(_0x2222fe,_0x566802,_0x2532a6,_0x4086ff);clearTimeout(_0x1828a0);_0x59446a['close'](!![]);_0x4a2def['next']();},_0x496304);switch(_0x566802[_0x867a('0x52')]){case'rrmemory':strategy[_0x867a('0x53')](_0x59446a,_0x566802,_0x4086ff,_0x2532a6);break;default:strategy[_0x867a('0x54')](_0x59446a,_0x566802,_0x4086ff,_0x2532a6);}}else{logger[_0x867a('0x40')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2222fe,_0x3d2e06[_0x867a('0x37')]);_0x4a2def['stop']();}}}catch(_0x33ae8a){logger[_0x867a('0x40')](_0x867a('0x47'),_0x2222fe,_0x33ae8a['stack']);_0x4a2def[_0x867a('0x49')]();}};}; \ 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 91fb99c..eaeaa81 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 _0x9f62=['../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','saveWaitingNotification','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','uuid'];(function(_0xfbbc1e,_0x438a4){var _0x2f30f0=function(_0x4b3607){while(--_0x4b3607){_0xfbbc1e['push'](_0xfbbc1e['shift']());}};_0x2f30f0(++_0x438a4);}(_0x9f62,0x154));var _0x29f6=function(_0x1190c0,_0x3df173){_0x1190c0=_0x1190c0-0x0;var _0x2946d9=_0x9f62[_0x1190c0];return _0x2946d9;};'use strict';var _=require('lodash');var uuid=require(_0x29f6('0x0'));var util=require('./util');var logger=require(_0x29f6('0x1'))(_0x29f6('0x2'));var Agent=function(_0x548050,_0x5618b7,_0x54d164,_0x258ddd){this[_0x29f6('0x3')]=uuid['v4']();this[_0x29f6('0x4')]=_0x548050;this[_0x29f6('0x5')]=_0x5618b7;this['realtime']=_0x54d164;this[_0x29f6('0x2')]=_0x258ddd;this[_0x29f6('0x4')][_0x29f6('0x6')](this[_0x29f6('0x7')][_0x29f6('0x8')](this),this['handleTimeout']['bind'](this));this['squeue']['on']('timeout',this[_0x29f6('0x9')][_0x29f6('0x8')](this));this['squeue']['on']('drained',this[_0x29f6('0xa')][_0x29f6('0x8')](this));};Agent['prototype'][_0x29f6('0x6')]=function(){this[_0x29f6('0x4')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x29f6('0x8')](this));};Agent[_0x29f6('0xb')][_0x29f6('0xa')]=function(){this[_0x29f6('0x9')](!![]);};Agent[_0x29f6('0xb')][_0x29f6('0x7')]=function(){logger[_0x29f6('0xc')](_0x29f6('0xd'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x29f6('0x8')](this),0x3e8);}else{if(this[_0x29f6('0x2')][_0x29f6('0x12')]||util['isAgentAvailable'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],this[_0x29f6('0x4')][_0x29f6('0x13')],![])){this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']]['busy']=!![];this[_0x29f6('0xf')]['agents'][this['agent']['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x15')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this['agent'],this[_0x29f6('0x4')]['channel']);util[_0x29f6('0x16')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],null,this[_0x29f6('0x2')]);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']],_0x29f6('0x17')+(this[_0x29f6('0x2')][_0x29f6('0x12')]?':FORCED':''));}else{logger[_0x29f6('0xc')](_0x29f6('0x18'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}}};Agent[_0x29f6('0xb')][_0x29f6('0x9')]=function(_0x3d88db){if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){return logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x29f6('0x4')]['id'],this['agent']['id']);util[_0x29f6('0x19')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this['agent']['id']],null,this[_0x29f6('0x2')]);this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x1a')]=![];this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x1b')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this[_0x29f6('0x5')],this[_0x29f6('0x4')]['channel']);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this['agent']['id']],_0x3d88db?_0x29f6('0x1c'):_0x29f6('0x1d'));}if(!_0x3d88db){setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}};function agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f){return new Agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f);}module[_0x29f6('0x1e')]=agent; \ No newline at end of file +var _0xedd9=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','bind','handleTimeout','drained','prototype','handleRun','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','notificationId','agents','writeLog','RINGING'];(function(_0x53e945,_0x58ac00){var _0x429d5b=function(_0x41fb4b){while(--_0x41fb4b){_0x53e945['push'](_0x53e945['shift']());}};_0x429d5b(++_0x58ac00);}(_0xedd9,0xfc));var _0x9edd=function(_0x3350bc,_0x1a78d5){_0x3350bc=_0x3350bc-0x0;var _0x4f2776=_0xedd9[_0x3350bc];return _0x4f2776;};'use strict';var _=require('lodash');var uuid=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));var Agent=function(_0x3b51bc,_0x127cbe,_0x3e6d3a,_0x36b53f){this['notificationId']=uuid['v4']();this[_0x9edd('0x4')]=_0x3b51bc;this[_0x9edd('0x5')]=_0x127cbe;this[_0x9edd('0x6')]=_0x3e6d3a;this[_0x9edd('0x3')]=_0x36b53f;this['squeue'][_0x9edd('0x7')](this['handleRun'][_0x9edd('0x8')](this),this[_0x9edd('0x9')][_0x9edd('0x8')](this));this[_0x9edd('0x4')]['on']('timeout',this[_0x9edd('0x9')]['bind'](this));this[_0x9edd('0x4')]['on'](_0x9edd('0xa'),this['handleDrained'][_0x9edd('0x8')](this));};Agent[_0x9edd('0xb')]['push']=function(){this[_0x9edd('0x4')][_0x9edd('0x7')](this[_0x9edd('0xc')][_0x9edd('0x8')](this),this[_0x9edd('0x9')][_0x9edd('0x8')](this));};Agent[_0x9edd('0xb')][_0x9edd('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x9edd('0xb')][_0x9edd('0xc')]=function(){logger[_0x9edd('0xe')](_0x9edd('0xf'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);if(_[_0x9edd('0x10')](this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']])){logger[_0x9edd('0xe')](_0x9edd('0x11'),this['squeue']['id'],this[_0x9edd('0x5')]['id']);setTimeout(this[_0x9edd('0x7')][_0x9edd('0x8')](this),0x3e8);}else{if(this['routing'][_0x9edd('0x12')]||util['isAgentAvailable'](this[_0x9edd('0x4')]['id'],this[_0x9edd('0x6')]['agents'][this['agent']['id']],this[_0x9edd('0x4')]['channel'],![])){this[_0x9edd('0x6')]['agents'][this['agent']['id']][_0x9edd('0x13')]=!![];this[_0x9edd('0x6')]['agents'][this['agent']['id']][_0x9edd('0x14')]=undefined;util[_0x9edd('0x15')](this[_0x9edd('0x6')],this['routing'],this[_0x9edd('0x5')],this[_0x9edd('0x4')][_0x9edd('0x16')]);util[_0x9edd('0x17')](this[_0x9edd('0x18')],this['squeue']['id'],this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']],null,this[_0x9edd('0x3')]);util[_0x9edd('0x1a')](this['squeue']['id'],this['realtime'][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']],_0x9edd('0x1b')+(this[_0x9edd('0x3')][_0x9edd('0x12')]?':FORCED':''));}else{logger['debug'](_0x9edd('0x1c'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);setTimeout(this['push'][_0x9edd('0x8')](this),0x3e8);}}};Agent[_0x9edd('0xb')][_0x9edd('0x9')]=function(_0x41af53){if(_['isNil'](this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']])){return logger[_0x9edd('0xe')](_0x9edd('0x11'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);}else{logger[_0x9edd('0xe')](_0x9edd('0x1d'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);util[_0x9edd('0x1e')](this[_0x9edd('0x18')],this[_0x9edd('0x4')]['id'],this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']],null,this[_0x9edd('0x3')]);this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']][_0x9edd('0x13')]=![];this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']][_0x9edd('0x14')]=undefined;util[_0x9edd('0x1f')](this[_0x9edd('0x6')],this[_0x9edd('0x3')],this[_0x9edd('0x5')],this[_0x9edd('0x4')][_0x9edd('0x16')]);util[_0x9edd('0x1a')](this[_0x9edd('0x4')]['id'],this['realtime'][_0x9edd('0x19')][this['agent']['id']],_0x41af53?_0x9edd('0x20'):_0x9edd('0x21'));}if(!_0x41af53){setTimeout(this[_0x9edd('0x7')][_0x9edd('0x8')](this),0x3e8);}};function agent(_0x16770e,_0x4fa5ab,_0x6de835,_0x44dbfc){return new Agent(_0x16770e,_0x4fa5ab,_0x6de835,_0x44dbfc);}module[_0x9edd('0x22')]=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 335e273..3dad8d5 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 _0xeb38=['notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','push','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x469ce0,_0x357941){var _0xe80d51=function(_0x13454d){while(--_0x13454d){_0x469ce0['push'](_0x469ce0['shift']());}};_0xe80d51(++_0x357941);}(_0xeb38,0x15b));var _0x8eb3=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xeb38[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x8eb3('0x0'));var uuid=require(_0x8eb3('0x1'));var util=require(_0x8eb3('0x2'));var logger=require(_0x8eb3('0x3'))(_0x8eb3('0x4'));var Beepall=function(_0x30ff85,_0x29c2ea,_0x139b43,_0x354ef3){this[_0x8eb3('0x5')]=uuid['v4']();this[_0x8eb3('0x6')]=_0x30ff85;this[_0x8eb3('0x7')]=_0x29c2ea;this[_0x8eb3('0x8')]=_0x139b43;this[_0x8eb3('0x4')]=_0x354ef3;this[_0x8eb3('0x6')]['push'](this[_0x8eb3('0x9')][_0x8eb3('0xa')](this),this[_0x8eb3('0xb')][_0x8eb3('0xa')](this));this[_0x8eb3('0x6')]['on'](_0x8eb3('0xc'),this[_0x8eb3('0xb')][_0x8eb3('0xa')](this));this[_0x8eb3('0x6')]['on']('drained',this[_0x8eb3('0xd')]['bind'](this));};Beepall[_0x8eb3('0xe')][_0x8eb3('0xf')]=function(){this[_0x8eb3('0x6')][_0x8eb3('0xf')](this[_0x8eb3('0x9')][_0x8eb3('0xa')](this),this[_0x8eb3('0xb')][_0x8eb3('0xa')](this));};Beepall[_0x8eb3('0xe')][_0x8eb3('0xd')]=function(){this['handleTimeout'](!![]);};Beepall[_0x8eb3('0xe')][_0x8eb3('0x9')]=function(){var _0x5bf5f7=!![];if(!_[_0x8eb3('0x10')](this[_0x8eb3('0x7')])&&!_['isNil'](this[_0x8eb3('0x7')][_0x8eb3('0x11')])&&this[_0x8eb3('0x7')][_0x8eb3('0x11')][_0x8eb3('0x12')]>0x0){for(var _0x5cda45=0x0,_0x5ed330;_0x5cda450x0){for(var _0x39e0c3=0x0,_0x1e410b;_0x39e0c30x0&&_0x1c8723[_0x2fcf0b+_0xca7d('0x23')]>=_0x1c8723[_0x2fcf0b+_0xca7d('0x22')]){writeLog(_0x38a488,_0x1c8723,_0x2fcf0b[_0xca7d('0x24')]()+_0xca7d('0x25'));return![];}}return!![];};exports[_0xca7d('0x26')]=function(_0xc2048d,_0x38ee14,_0x162bf8,_0xb08cfd,_0x254235){return sendNotification(!![],_0xc2048d,_0x38ee14,_0x162bf8,_0xb08cfd,_0x254235);};exports['hideNotification']=function(_0x445fad,_0x36e725,_0x5975d0,_0x3a1082,_0x5df354){return sendNotification(![],_0x445fad,_0x36e725,_0x5975d0,_0x3a1082,_0x5df354);};exports['checkWaitingNotifications']=function(_0x13c1df,_0x5dfe5f,_0x37c8a6){var _0x1c4e7d=_0x5dfe5f[_0xca7d('0x27')][_0xca7d('0x28')];if(!_0x1c4e7d&&_0x37c8a6){_0x1c4e7d=_0x37c8a6['id'];}var _0x337f3f=_[_0xca7d('0x29')](_0x13c1df[_0x5dfe5f['channel']+_0xca7d('0x2a')],function(_0x2a3b98){var _0x28eeff=_['capitalize'](_0x5dfe5f[_0xca7d('0x2b')])+_0xca7d('0x2c');return _0x2a3b98[_0x28eeff]===_0x5dfe5f[_0xca7d('0x27')]['id'];});if(!_0x337f3f&&_0x1c4e7d&&_0x13c1df[_0xca7d('0x2d')][_0x1c4e7d]){_0x337f3f=_[_0xca7d('0x29')](_0x13c1df[_0xca7d('0x2d')][_0x1c4e7d][_0x5dfe5f[_0xca7d('0x2b')]+_0xca7d('0x2e')],function(_0x5bba0f){return _0x5bba0f['id']===_0x5dfe5f['interaction']['id'];});}return _0x337f3f;};exports[_0xca7d('0x2f')]=function(_0x443285,_0x1f8c01,_0x1ac910,_0x488fcb){if(_0x1ac910&&_0x1ac910['id']&&_0x443285['agents']&&_0x443285[_0xca7d('0x2d')][_0x1ac910['id']]){_0x443285['agents'][_0x1ac910['id']][_0x488fcb+'WaitingInteractions'][_0x1f8c01['message']['id']]={'id':_0x1f8c01[_0xca7d('0x27')]['id']};}};exports['removeWaitingNotification']=function(_0x2bb0ce,_0x1eb686,_0x2835e9,_0x545767){if(_0x2835e9&&_0x2835e9['id']&&_0x2bb0ce[_0xca7d('0x2d')]&&_0x2bb0ce[_0xca7d('0x2d')][_0x2835e9['id']]){delete _0x2bb0ce[_0xca7d('0x2d')][_0x2835e9['id']][_0x545767+'WaitingInteractions'][_0x1eb686[_0xca7d('0x30')]['id']];}};exports[_0xca7d('0x31')]=writeLog; \ No newline at end of file +var _0x9589=['notificationTemplate','error','[%s][QUEUE]\x20%s','message','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','channel','InteractionId','agents','some','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender'];(function(_0x284e1e,_0x443723){var _0x1d433f=function(_0x137e1d){while(--_0x137e1d){_0x284e1e['push'](_0x284e1e['shift']());}};_0x1d433f(++_0x443723);}(_0x9589,0xbc));var _0x9958=function(_0x3b38cc,_0x38b835){_0x3b38cc=_0x3b38cc-0x0;var _0x29092e=_0x9589[_0x3b38cc];return _0x29092e;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var utils=require(_0x9958('0x2'));var Redis=require(_0x9958('0x3'));var config=require(_0x9958('0x4'));var logger=require('../../../../../config/logger')(_0x9958('0x5'));config[_0x9958('0x6')]=_[_0x9958('0x7')](config['redis'],{'host':_0x9958('0x8'),'port':0x18eb});var io=require(_0x9958('0x9'))(new Redis(config[_0x9958('0x6')]));function sendNotification(_0x52386d,_0x4225da,_0x2c3eaf,_0x5750c5,_0x2ac795,_0x19f3b3){io['to'](util[_0x9958('0xa')](_0x9958('0xb'),_0x5750c5[_0x9958('0xc')]))[_0x9958('0xd')](_0x9958('0xe'),_0x5750c5);var _0x1e5c25=_0x19f3b3||{};var _0x3369b3=_0x2c3eaf[_0x9958('0xf')]('.');var _0x44ea35={'uniqueid':_0x4225da,'channel':_0x3369b3[0x0],'id':_0x3369b3[0x1],'title':_0x3369b3[0x0]+_0x9958('0x10'),'interactionId':_0x3369b3[0x2],'queue':_0x2ac795?_0x2ac795[_0x9958('0xc')]:null,'sound':_0x1e5c25[_0x9958('0x11')][_0x9958('0x12')],'shake':_0x1e5c25[_0x9958('0x11')][_0x9958('0x13')]};try{if(!_0x1e5c25[_0x9958('0x14')]){_0x1e5c25['body']={};}if(_0x2ac795){_0x1e5c25[_0x9958('0x14')]['queue']=_0x2ac795;}else if(_0x1e5c25[_0x9958('0x14')]['queue']){delete _0x1e5c25[_0x9958('0x14')][_0x9958('0x15')];}_0x44ea35[_0x9958('0x16')]=utils[_0x9958('0x17')](_0x1e5c25['account'][_0x9958('0x18')],_0x1e5c25);}catch(_0x234b39){_0x44ea35['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x9958('0x19')](util['format'](_0x9958('0x1a'),_0x4225da,_0x234b39[_0x9958('0x1b')]));}io['to'](util[_0x9958('0xa')](_0x9958('0xb'),_0x5750c5[_0x9958('0xc')]))[_0x9958('0xd')](util['format']('notification:%s',_0x52386d?_0x9958('0x1c'):'remove'),_0x44ea35);}function writeLog(_0x58fa87,_0x2bcce1,_0x5b8879){return logger['debug'](util[_0x9958('0xa')](_0x9958('0x1d'),_0x58fa87,_0x2bcce1[_0x9958('0xc')],_0x5b8879));}exports['isAgentAvailable']=function(_0x196ee1,_0x43cde6,_0xb6be59,_0x31130c){if(_0x43cde6[_0x9958('0x1e')]){writeLog(_0x196ee1,_0x43cde6,_0x9958('0x1f'));return![];}if(!_0x43cde6[_0x9958('0x20')]){writeLog(_0x196ee1,_0x43cde6,_0x9958('0x21'));return![];}if(_0x43cde6[_0xb6be59+_0x9958('0x22')]){writeLog(_0x196ee1,_0x43cde6,_0x9958('0x23'));return![];}if(_0x31130c&&_0x43cde6[_0x9958('0x24')](_0xb6be59+_0x9958('0x25'))&&_0x43cde6[_0x9958('0x24')](_0xb6be59+'CurrentCapacity')){if(_0x43cde6[_0xb6be59+_0x9958('0x25')]>0x0&&_0x43cde6[_0xb6be59+_0x9958('0x26')]>=_0x43cde6[_0xb6be59+_0x9958('0x25')]){writeLog(_0x196ee1,_0x43cde6,_0xb6be59['toUpperCase']()+_0x9958('0x27'));return![];}}return!![];};exports[_0x9958('0x28')]=function(_0x1194ce,_0x22bdfc,_0x640cc7,_0x575a82,_0x3cf2ca){return sendNotification(!![],_0x1194ce,_0x22bdfc,_0x640cc7,_0x575a82,_0x3cf2ca);};exports[_0x9958('0x29')]=function(_0x11477b,_0x5ae3a7,_0x2ce365,_0x6c701a,_0x398097){return sendNotification(![],_0x11477b,_0x5ae3a7,_0x2ce365,_0x6c701a,_0x398097);};exports[_0x9958('0x2a')]=function(_0x8f4016,_0x5dcdc9,_0x1171bb){var _0xf02a22=_0x5dcdc9[_0x9958('0x2b')][_0x9958('0x2c')];if(!_0xf02a22&&_0x1171bb){_0xf02a22=_0x1171bb['id'];}var _0x60f289=_['some'](_0x8f4016[_0x5dcdc9[_0x9958('0x2d')]+'QueuesWaitingInteractions'],function(_0x234a67){var _0x133d84=_['capitalize'](_0x5dcdc9[_0x9958('0x2d')])+_0x9958('0x2e');return _0x234a67[_0x133d84]===_0x5dcdc9[_0x9958('0x2b')]['id'];});if(!_0x60f289&&_0xf02a22&&_0x8f4016[_0x9958('0x2f')][_0xf02a22]){_0x60f289=_[_0x9958('0x30')](_0x8f4016[_0x9958('0x2f')][_0xf02a22][_0x5dcdc9[_0x9958('0x2d')]+_0x9958('0x31')],function(_0x2e1ee3){return _0x2e1ee3['id']===_0x5dcdc9['interaction']['id'];});}return _0x60f289;};exports[_0x9958('0x32')]=function(_0x52a306,_0x443bab,_0x159b5c,_0x185d07){if(_0x159b5c&&_0x159b5c['id']&&_0x52a306['agents']&&_0x52a306[_0x9958('0x2f')][_0x159b5c['id']]){_0x52a306[_0x9958('0x2f')][_0x159b5c['id']][_0x185d07+'WaitingInteractions'][_0x443bab['message']['id']]={'id':_0x443bab[_0x9958('0x2b')]['id']};}};exports[_0x9958('0x33')]=function(_0x505466,_0x3e3d7a,_0x3d1260,_0x325759){if(_0x3d1260&&_0x3d1260['id']&&_0x505466[_0x9958('0x2f')]&&_0x505466[_0x9958('0x2f')][_0x3d1260['id']]){delete _0x505466[_0x9958('0x2f')][_0x3d1260['id']][_0x325759+'WaitingInteractions'][_0x3e3d7a[_0x9958('0x1b')]['id']];}};exports[_0x9958('0x34')]=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 0246983..0806aa7 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 _0x3148=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','./utils','../../../../config/logger','routing','string'];(function(_0x436a81,_0x21c13a){var _0x2222f8=function(_0x1e37d7){while(--_0x1e37d7){_0x436a81['push'](_0x436a81['shift']());}};_0x2222f8(++_0x21c13a);}(_0x3148,0x172));var _0x8314=function(_0x7058e5,_0x4304b8){_0x7058e5=_0x7058e5-0x0;var _0xcadefd=_0x3148[_0x7058e5];return _0xcadefd;};'use strict';var schema=require('validate');var sh=require(_0x8314('0x0'));var _=require('lodash');var utils=require(_0x8314('0x1'));var logger=require(_0x8314('0x2'))(_0x8314('0x3'));var system=schema({'command':{'type':_0x8314('0x4'),'required':!![],'message':_0x8314('0x5')}});exports[_0x8314('0x6')]=function(_0x4bcda2,_0x1510e4){return function(_0x18aa16){try{var _0x353ee9={'command':_0x1510e4[0x0]};var _0x1891f5=system[_0x8314('0x7')](_0x353ee9,{'typecast':!![]});if(_0x1891f5['length']){logger[_0x8314('0x8')](_0x8314('0x9'),_0x4bcda2,_[_0x8314('0xa')](_0x1891f5,'message')[_0x8314('0xb')](',\x20'));logger[_0x8314('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4bcda2);_0x18aa16[_0x8314('0xd')]();}else{var _0x3304d8=this;var _0x872f67=utils[_0x8314('0xe')](_0x1510e4[0x0],this);logger[_0x8314('0xc')](_0x8314('0xf'),_0x4bcda2,_0x872f67);sh[_0x8314('0x10')](_['trim'](_0x872f67),function(_0x3f0f28,_0x5a7b60){logger[_0x8314('0xc')](_0x8314('0x11'),_0x4bcda2,_0x3f0f28);if(_0x3f0f28==0x0){var _0x405f21=_0x5a7b60[_0x8314('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x8314('0x13')](_0x1510e4[0x1])||_[_0x8314('0x14')](_0x1510e4[0x1])){logger[_0x8314('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x4bcda2);_0x3304d8['body'][_0x1510e4[0x1]]=_0x405f21;}else{logger[_0x8314('0xc')](_0x8314('0x15'),_0x4bcda2,_0x1510e4[0x1],_0x405f21);_0x3304d8[_0x8314('0x16')][_0x1510e4[0x1]]=_0x405f21;}}_0x18aa16[_0x8314('0xd')]();});}}catch(_0x525128){logger[_0x8314('0x8')]('[%s][SYSTEM]\x20%s',_0x4bcda2,_[_0x8314('0x17')](_0x525128)?JSON['stringify'](_0x525128):_0x525128);logger[_0x8314('0xc')](_0x8314('0x18'),_0x4bcda2);_0x18aa16['next']();}};}; \ No newline at end of file +var _0x4536=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','consequence','length','error','map'];(function(_0x3a3365,_0x51b58e){var _0x3cbc0a=function(_0x49dc9c){while(--_0x49dc9c){_0x3a3365['push'](_0x3a3365['shift']());}};_0x3cbc0a(++_0x51b58e);}(_0x4536,0xe9));var _0x6453=function(_0x48476e,_0x610021){_0x48476e=_0x48476e-0x0;var _0x4a1219=_0x4536[_0x48476e];return _0x4a1219;};'use strict';var schema=require(_0x6453('0x0'));var sh=require(_0x6453('0x1'));var _=require(_0x6453('0x2'));var utils=require(_0x6453('0x3'));var logger=require('../../../../config/logger')(_0x6453('0x4'));var system=schema({'command':{'type':_0x6453('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6453('0x6')]=function(_0x36d2f1,_0x3356ef){return function(_0x5230b8){try{var _0x25d8f7={'command':_0x3356ef[0x0]};var _0x1b2359=system['validate'](_0x25d8f7,{'typecast':!![]});if(_0x1b2359[_0x6453('0x7')]){logger[_0x6453('0x8')]('[%s][SYSTEM]\x20%s',_0x36d2f1,_[_0x6453('0x9')](_0x1b2359,_0x6453('0xa'))[_0x6453('0xb')](',\x20'));logger[_0x6453('0xc')](_0x6453('0xd'),_0x36d2f1);_0x5230b8[_0x6453('0xe')]();}else{var _0x5eb169=this;var _0x46b362=utils[_0x6453('0xf')](_0x3356ef[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x36d2f1,_0x46b362);sh[_0x6453('0x10')](_[_0x6453('0x11')](_0x46b362),function(_0x2197db,_0x399d5a){logger[_0x6453('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x36d2f1,_0x2197db);if(_0x2197db==0x0){var _0x435d0a=_0x399d5a[_0x6453('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x6453('0x13')](_0x3356ef[0x1])||_[_0x6453('0x14')](_0x3356ef[0x1])){logger[_0x6453('0xc')](_0x6453('0x15'),_0x36d2f1);_0x5eb169['body'][_0x3356ef[0x1]]=_0x435d0a;}else{logger['info'](_0x6453('0x16'),_0x36d2f1,_0x3356ef[0x1],_0x435d0a);_0x5eb169[_0x6453('0x17')][_0x3356ef[0x1]]=_0x435d0a;}}_0x5230b8[_0x6453('0xe')]();});}}catch(_0x3c1354){logger[_0x6453('0x8')](_0x6453('0x18'),_0x36d2f1,_[_0x6453('0x19')](_0x3c1354)?JSON[_0x6453('0x1a')](_0x3c1354):_0x3c1354);logger[_0x6453('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x36d2f1);_0x5230b8[_0x6453('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 6e55eaa..1140df6 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 _0xf06d=['routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','join','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','info','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0xf06d,0x7b));var _0xdf06=function(_0x36d9ea,_0x43941c){_0x36d9ea=_0x36d9ea-0x0;var _0x5093ed=_0xf06d[_0x36d9ea];return _0x5093ed;};'use strict';var schema=require(_0xdf06('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xdf06('0x1')),'openchannelInteraction':require(_0xdf06('0x2')),'smsInteraction':require(_0xdf06('0x3')),'mailInteraction':require(_0xdf06('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdf06('0x5'))};var logger=require(_0xdf06('0x6'))(_0xdf06('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xdf06('0x8')}});exports[_0xdf06('0x9')]=function(_0x5799ee,_0x2ad84f,_0x2a556e,_0x369abb){return function(_0x186d42){try{var _0x5d2bea={'tag':_0x2ad84f[0x0]};var _0x1fe962=tag[_0xdf06('0x0')](_0x5d2bea,{'typecast':!![]});if(_0x1fe962[_0xdf06('0xa')]){logger[_0xdf06('0xb')]('[%s][TAG]\x20%s',_0x5799ee,_['map'](_0x1fe962,'message')[_0xdf06('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5799ee);_0x186d42['next']();}else{var _0x28de10={'ids':[_0x2ad84f[0x0]]};if(rpc[_0x369abb[_0xdf06('0xd')]+_0xdf06('0xe')]){rpc[_0x369abb[_0xdf06('0xd')]+'Interaction'][_0xdf06('0xf')](_0x369abb['interaction']['id'],_0x28de10)[_0xdf06('0x10')](function(_0x42190b){logger['info'](_0xdf06('0x11'),_0x5799ee,_0x2ad84f[0x1],_0x369abb[_0xdf06('0xd')],_0x369abb[_0xdf06('0x12')]['id']);})[_0xdf06('0x13')](function(_0x1f58b1){logger[_0xdf06('0xb')](_0xdf06('0x14'),_0x5799ee,JSON[_0xdf06('0x15')](_0x1f58b1));logger[_0xdf06('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5799ee);})[_0xdf06('0x17')](function(){_0x186d42[_0xdf06('0x18')]();});}}}catch(_0x262bbc){logger['error'](_0xdf06('0x14'),_0x5799ee,_[_0xdf06('0x19')](_0x262bbc)?JSON['stringify'](_0x262bbc):_0x262bbc);logger[_0xdf06('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5799ee);_0x186d42[_0xdf06('0x18')]();}};}; \ No newline at end of file +var _0xa41d=['[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','next','isObject','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','consequence','validate','length','error'];(function(_0x550691,_0x19fe04){var _0x25f1e2=function(_0xe2eebd){while(--_0xe2eebd){_0x550691['push'](_0x550691['shift']());}};_0x25f1e2(++_0x19fe04);}(_0xa41d,0x17b));var _0xda41=function(_0x58cfc4,_0x35aae5){_0x58cfc4=_0x58cfc4-0x0;var _0x2c7bb1=_0xa41d[_0x58cfc4];return _0x2c7bb1;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xda41('0x0')),'smsInteraction':require(_0xda41('0x1')),'mailInteraction':require(_0xda41('0x2')),'faxInteraction':require(_0xda41('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xda41('0x4'))(_0xda41('0x5'));var tag=schema({'tag':{'type':_0xda41('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xda41('0x7')]=function(_0x4e14d5,_0x1f5c74,_0x191b26,_0x4169e3){return function(_0x342b80){try{var _0x1c1c04={'tag':_0x1f5c74[0x0]};var _0x407671=tag[_0xda41('0x8')](_0x1c1c04,{'typecast':!![]});if(_0x407671[_0xda41('0x9')]){logger[_0xda41('0xa')](_0xda41('0xb'),_0x4e14d5,_[_0xda41('0xc')](_0x407671,'message')[_0xda41('0xd')](',\x20'));logger[_0xda41('0xe')](_0xda41('0xf'),_0x4e14d5);_0x342b80['next']();}else{var _0x563bf8={'ids':[_0x1f5c74[0x0]]};if(rpc[_0x4169e3[_0xda41('0x10')]+_0xda41('0x11')]){rpc[_0x4169e3[_0xda41('0x10')]+_0xda41('0x11')][_0xda41('0x12')](_0x4169e3[_0xda41('0x13')]['id'],_0x563bf8)[_0xda41('0x14')](function(_0xc3b37d){logger[_0xda41('0xe')](_0xda41('0x15'),_0x4e14d5,_0x1f5c74[0x1],_0x4169e3[_0xda41('0x10')],_0x4169e3[_0xda41('0x13')]['id']);})[_0xda41('0x16')](function(_0x1d5f3a){logger[_0xda41('0xa')](_0xda41('0xb'),_0x4e14d5,JSON[_0xda41('0x17')](_0x1d5f3a));logger[_0xda41('0xe')](_0xda41('0xf'),_0x4e14d5);})['finally'](function(){_0x342b80[_0xda41('0x18')]();});}}}catch(_0x4229b2){logger[_0xda41('0xa')](_0xda41('0xb'),_0x4e14d5,_[_0xda41('0x19')](_0x4229b2)?JSON[_0xda41('0x17')](_0x4229b2):_0x4229b2);logger[_0xda41('0xe')](_0xda41('0xf'),_0x4e14d5);_0x342b80[_0xda41('0x18')]();}};}; \ 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 06160f4..8c14131 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 _0x7295=['parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','jsonrpc','login','push','params','stringify','utf8','POST','application/json-rpc','then'];(function(_0x37ffcc,_0x4b23ec){var _0x9dddc5=function(_0x50ee80){while(--_0x50ee80){_0x37ffcc['push'](_0x37ffcc['shift']());}};_0x9dddc5(++_0x4b23ec);}(_0x7295,0x1f2));var _0x5729=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x7295[_0x5bfa44];return _0x43815f;};'use strict';var rp=require(_0x5729('0x0'));var logger=require(_0x5729('0x1'))(_0x5729('0x2'));var _=require(_0x5729('0x3'));var arr=[];exports[_0x5729('0x4')]=function(_0x1aac4e,_0x44db31){return function(_0x4e2f95){var _0x513e34=_0x44db31[0xa];var _0x4a25e7=_0x44db31[0xb];var _0xe0b6ff=_0x44db31[0xc];var _0x2e4cc3=_0x44db31[0xd];var _0x18bf98=_0x44db31[0xe];var _0x58f5dd=_0x44db31[0xf][_0x5729('0x5')](/\n/g,_0x5729('0x6'));var _0xab0ebf=_0x44db31[0x10][_0x5729('0x5')](/\n/g,'\x20');if(!arr[_0x5729('0x7')](_0x4a25e7)){arr['push'](_0x4a25e7);var _0x29681c=_0x44db31[0x3];var _0x2e2608=_0x44db31[0x4];var _0x9d4fdf=_0x44db31[0x1];var _0xa062f3=_0x44db31[0x0];var _0x58cc02={};_0x58cc02[_0x5729('0x8')]=_0x44db31[0x8]+_0x5729('0x9')+_0xe0b6ff+'|'+_0x513e34+'|'+_0x2e4cc3+'|'+_0x4a25e7+'|'+_0x18bf98;_0x58cc02['urlOnRing']=_0x44db31[0x7]+_0x5729('0x9')+_0xe0b6ff+'|'+_0x513e34+'|'+_0x2e4cc3+'|'+_0x4a25e7+'|'+_0x18bf98+'|'+_0x58f5dd+'|'+_0xab0ebf;_0x58cc02[_0x5729('0xa')]=_0x44db31[0x9];var _0xd044c3={};_0xd044c3[_0x5729('0xb')]='2.0';_0xd044c3['method']=_0x5729('0xc');var _0x53a1b8=[];_0x53a1b8[_0x5729('0xd')](_0x44db31[0x2]);_0x53a1b8[_0x5729('0xd')](_0x44db31[0x5]);_0x53a1b8[_0x5729('0xd')](_0x44db31[0x6]);_0xd044c3[_0x5729('0xe')]=_0x53a1b8;_0xd044c3['id']=0x1;var _0x13d178=JSON[_0x5729('0xf')](_0xd044c3);var _0x1ebeab={'encoding':_0x5729('0x10'),'method':_0x5729('0x11'),'timeout':0x2710,'url':_0x29681c,'headers':{'Content-Type':_0x5729('0x12')},'body':_0x13d178};return rp(_0x1ebeab)[_0x5729('0x13')](function(_0x333cd6){const _0xd3c375=JSON[_0x5729('0x14')](_0x333cd6);if(!_0xd3c375[_0x5729('0x15')][_0x5729('0x16')]){throw new Error(_0x5729('0x17'));}var _0x57cad1=_0x4a25e7;var _0x53ce12=_0x5729('0x18')+_0x9d4fdf+_0x5729('0x19')+_0xa062f3+_0x5729('0x1a')+_0x57cad1+_0x5729('0x1b')+JSON[_0x5729('0xf')](_0x58cc02);var _0x367fe9=_0x2e2608+'?'+_0x53ce12;return rp(_0x367fe9);})[_0x5729('0x13')](function(_0x5229ab){logger[_0x5729('0x1c')](_0x5729('0x1d'),_0x1aac4e,_0x5229ab);_0x4e2f95[_0x5729('0x1e')]();})[_0x5729('0x1f')](function(_0x365057){logger[_0x5729('0x20')](_0x5729('0x21'),_0x1aac4e,_[_0x5729('0x22')](_0x365057)?JSON[_0x5729('0xf')](_0x365057):_0x365057);_0x4e2f95['stop']();});}else{logger[_0x5729('0x1c')](_0x5729('0x23'),_0x1aac4e);_0x4e2f95[_0x5729('0x24')]();}};}; \ No newline at end of file +var _0xef92=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','push','urlOnAnswer','?params=','jsonrpc','2.0','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x85db9b,_0x254a0c){var _0xb8005=function(_0xd78af1){while(--_0xd78af1){_0x85db9b['push'](_0x85db9b['shift']());}};_0xb8005(++_0x254a0c);}(_0xef92,0x92));var _0x2ef9=function(_0x4e39d5,_0x305e6f){_0x4e39d5=_0x4e39d5-0x0;var _0x321a74=_0xef92[_0x4e39d5];return _0x321a74;};'use strict';var rp=require(_0x2ef9('0x0'));var logger=require(_0x2ef9('0x1'))(_0x2ef9('0x2'));var _=require(_0x2ef9('0x3'));var arr=[];exports['consequence']=function(_0x156a92,_0x1c0b71){return function(_0x41db5b){var _0x1516c4=_0x1c0b71[0xa];var _0x1cb68d=_0x1c0b71[0xb];var _0x18e4f5=_0x1c0b71[0xc];var _0x46f0d9=_0x1c0b71[0xd];var _0x2d57bb=_0x1c0b71[0xe];var _0x1441bc=_0x1c0b71[0xf][_0x2ef9('0x4')](/\n/g,'\x20-\x20');var _0xccda2d=_0x1c0b71[0x10][_0x2ef9('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x1cb68d)){arr[_0x2ef9('0x5')](_0x1cb68d);var _0x4cf3c0=_0x1c0b71[0x3];var _0x15ee21=_0x1c0b71[0x4];var _0x314482=_0x1c0b71[0x1];var _0x40ec68=_0x1c0b71[0x0];var _0x37a82b={};_0x37a82b[_0x2ef9('0x6')]=_0x1c0b71[0x8]+_0x2ef9('0x7')+_0x18e4f5+'|'+_0x1516c4+'|'+_0x46f0d9+'|'+_0x1cb68d+'|'+_0x2d57bb;_0x37a82b['urlOnRing']=_0x1c0b71[0x7]+_0x2ef9('0x7')+_0x18e4f5+'|'+_0x1516c4+'|'+_0x46f0d9+'|'+_0x1cb68d+'|'+_0x2d57bb+'|'+_0x1441bc+'|'+_0xccda2d;_0x37a82b['title']=_0x1c0b71[0x9];var _0x6e624d={};_0x6e624d[_0x2ef9('0x8')]=_0x2ef9('0x9');_0x6e624d['method']=_0x2ef9('0xa');var _0x47df2e=[];_0x47df2e[_0x2ef9('0x5')](_0x1c0b71[0x2]);_0x47df2e['push'](_0x1c0b71[0x5]);_0x47df2e[_0x2ef9('0x5')](_0x1c0b71[0x6]);_0x6e624d[_0x2ef9('0xb')]=_0x47df2e;_0x6e624d['id']=0x1;var _0x3fd162=JSON[_0x2ef9('0xc')](_0x6e624d);var _0x5c2dfb={'encoding':_0x2ef9('0xd'),'method':_0x2ef9('0xe'),'timeout':0x2710,'url':_0x4cf3c0,'headers':{'Content-Type':_0x2ef9('0xf')},'body':_0x3fd162};return rp(_0x5c2dfb)[_0x2ef9('0x10')](function(_0x25a4e3){const _0x1e657a=JSON[_0x2ef9('0x11')](_0x25a4e3);if(!_0x1e657a[_0x2ef9('0x12')]['logged']){throw new Error(_0x2ef9('0x13'));}var _0x172a93=_0x1cb68d;var _0x1e9432=_0x2ef9('0x14')+_0x314482+_0x2ef9('0x15')+_0x40ec68+_0x2ef9('0x16')+_0x172a93+_0x2ef9('0x17')+JSON[_0x2ef9('0xc')](_0x37a82b);var _0x2171bc=_0x15ee21+'?'+_0x1e9432;return rp(_0x2171bc);})[_0x2ef9('0x10')](function(_0x236263){logger[_0x2ef9('0x18')](_0x2ef9('0x19'),_0x156a92,_0x236263);_0x41db5b[_0x2ef9('0x1a')]();})[_0x2ef9('0x1b')](function(_0x4d8aa6){logger[_0x2ef9('0x1c')](_0x2ef9('0x1d'),_0x156a92,_[_0x2ef9('0x1e')](_0x4d8aa6)?JSON['stringify'](_0x4d8aa6):_0x4d8aa6);_0x41db5b['stop']();});}else{logger['info'](_0x2ef9('0x1f'),_0x156a92);_0x41db5b[_0x2ef9('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 d188e6d..1ee7f04 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(_0x55fc5d,_0x5e81c3){var _0x229b5a=function(_0x2937ca){while(--_0x2937ca){_0x55fc5d['push'](_0x55fc5d['shift']());}};_0x229b5a(++_0x5e81c3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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(_0x448fe3,_0x51dd3e){var _0x372edf=function(_0x19e822){while(--_0x19e822){_0x448fe3['push'](_0x448fe3['shift']());}};_0x372edf(++_0x51dd3e);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 50bd1c2..28f65a6 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 _0xe558=['log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','isArray','applications','length','join','app','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1'];(function(_0x101bf3,_0x30d6ee){var _0x4b86ba=function(_0xd36622){while(--_0xd36622){_0x101bf3['push'](_0x101bf3['shift']());}};_0x4b86ba(++_0x30d6ee);}(_0xe558,0x70));var _0x8e55=function(_0x34ac6e,_0x4668e1){_0x34ac6e=_0x34ac6e-0x0;var _0x4f243e=_0xe558[_0x34ac6e];return _0x4f243e;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var path=require(_0x8e55('0x2'));var fs=require('fs');var jayson=require(_0x8e55('0x3'));var BPromise=require(_0x8e55('0x4'));var utils=require(_0x8e55('0x5'));var sUtils=require(_0x8e55('0x6'));var logger=require(_0x8e55('0x7'))(_0x8e55('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8e55('0x9')),'chatQueueReport':require(_0x8e55('0xa')),'smsQueueReport':require(_0x8e55('0xb')),'faxQueueReport':require(_0x8e55('0xc')),'whatsappQueueReport':require(_0x8e55('0xd'))};var RuleEngine=require(_0x8e55('0xe'));function getId(_0x493307,_0xe27f09,_0x429679){return util['format'](_0x8e55('0xf'),_0x493307,_0xe27f09||0x0,_0x429679||0x0);}function getIntervals(_0x578110,_0x570b31){var _0x50966f=[];if(!_['isNil'](_0x570b31['IntervalId'])&&!_['isNil'](_0x578110[_0x570b31[_0x8e55('0x10')]])&&!_[_0x8e55('0x11')](_0x578110[_0x570b31[_0x8e55('0x10')]][_0x8e55('0x12')])){_0x50966f=_['map'](_0x578110[_0x570b31[_0x8e55('0x10')]]['Intervals'],'interval');}else if(!_['isNil'](_0x570b31[_0x8e55('0x13')])){_0x50966f=[_0x570b31['interval']];}return _0x50966f;}exports[_0x8e55('0x14')]=function(_0x2a5545){_0x2a5545[_0x8e55('0x15')]={};return new BPromise(function(_0x2b5a04,_0x8cbfc7){var _0x125388={'Start':function(_0x1abd80){var _0x23c198=this;return new Promise(function(_0x83b32e,_0xb2e25e){if(_0x1abd80){try{var _0x45029c=[];var _0x1d6b69=getId(_0x1abd80[_0x8e55('0x16')],_0x1abd80[_0x8e55('0x17')]?_0x1abd80[_0x8e55('0x17')]['id']:0x0,_0x1abd80['interaction']?_0x1abd80[_0x8e55('0x18')]['id']:0x0);var _0x1e5d1f=sUtils[_0x8e55('0x19')](_0x2a5545,_0x1abd80);if(_0x1abd80[_0x8e55('0x1a')]||!_0x1e5d1f&&_0x1abd80['applications']&&_[_0x8e55('0x1b')](_0x1abd80[_0x8e55('0x1c')])&&_0x1abd80[_0x8e55('0x1c')][_0x8e55('0x1d')]){for(var _0x13b52a=0x0;_0x13b52a<_0x1abd80[_0x8e55('0x1c')][_0x8e55('0x1d')];_0x13b52a+=0x1){var _0x25e8b0=_0x1abd80['applications'][_0x13b52a];if(fs['existsSync'](path[_0x8e55('0x1e')](__dirname,_0x8e55('0x1c'),_0x25e8b0[_0x8e55('0x1f')]+'.js'))){var _0x42adae=[];switch(_0x25e8b0[_0x8e55('0x1f')][_0x8e55('0x20')]()){case _0x8e55('0x21'):var _0x12816e=_0x25e8b0[_0x8e55('0x22')]['split'](',');if(_0x1abd80[_0x8e55('0x16')]===_0x8e55('0x23')){_0x42adae['push'](_0x12816e[0x0]);_0x42adae[_0x8e55('0x24')](_0x12816e[0x1]);_0x42adae[_0x8e55('0x24')](_0x12816e[_0x8e55('0x25')](0x2,_0x12816e[_0x8e55('0x1d')])[_0x8e55('0x1e')](','));}else{_0x42adae[_0x8e55('0x24')](_0x12816e[0x0]);_0x42adae[_0x8e55('0x24')](_0x12816e[_0x8e55('0x25')](0x1,_0x12816e[_0x8e55('0x1d')])[_0x8e55('0x1e')](','));}break;case _0x8e55('0x26'):var _0x5393e6=_0x25e8b0[_0x8e55('0x22')][_0x8e55('0x27')](',');_0x42adae[_0x8e55('0x24')](_0x5393e6[0x0]);_0x42adae[_0x8e55('0x24')](_0x5393e6[0x1]);_0x42adae['push'](_0x5393e6[_0x8e55('0x25')](0x2,_0x5393e6['length'])[_0x8e55('0x1e')](','));break;case _0x8e55('0x28'):var _0x528989=_0x25e8b0[_0x8e55('0x22')][_0x8e55('0x27')](',');_0x42adae[_0x8e55('0x24')](_0x528989[0x0]);_0x42adae['push'](_0x528989[0x1]);_0x42adae[_0x8e55('0x24')](_0x528989[0x2]);_0x42adae[_0x8e55('0x24')](_0x528989[0x3]);_0x42adae[_0x8e55('0x24')](_0x528989[_0x8e55('0x25')](0x4,_0x528989[_0x8e55('0x1d')])[_0x8e55('0x1e')](','));break;case _0x8e55('0x29'):var _0x11d5a9=_0x25e8b0['appdata']['split'](',');_0x42adae['push'](_0x11d5a9[0x0]);_0x42adae[_0x8e55('0x24')](_0x11d5a9[0x1]);_0x42adae[_0x8e55('0x24')](_0x11d5a9[0x2]);_0x42adae[_0x8e55('0x24')](_0x11d5a9[0x3]);_0x42adae['push'](_0x11d5a9[_0x8e55('0x25')](0x4,_0x11d5a9['length'])['join'](','));break;case _0x8e55('0x17'):_0x42adae[_0x8e55('0x24')](_0x25e8b0['appdata']);break;case _0x8e55('0x2a'):_0x42adae[_0x8e55('0x24')](_0x25e8b0[_0x8e55('0x2b')]);_0x42adae[_0x8e55('0x24')](_0x25e8b0[_0x8e55('0x22')]);break;case'tvox':var _0x3169ce=utils[_0x8e55('0x2c')](_0x1abd80[_0x8e55('0x2d')][_0x8e55('0x2e')],_0x1abd80);var _0x5aa21d=_0x25e8b0[_0x8e55('0x22')][_0x8e55('0x27')](',');_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x0]);_0x42adae['push'](_0x5aa21d[0x1]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x2]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x3]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x4]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x5]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x6]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x7]);_0x42adae['push'](_0x5aa21d[0x8]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0x9]);_0x42adae[_0x8e55('0x24')](_0x5aa21d[0xa]);_0x42adae[_0x8e55('0x24')](_0x1abd80[_0x8e55('0x18')]['id']);_0x42adae[_0x8e55('0x24')](_0x1abd80[_0x8e55('0x17')]['id']);_0x42adae['push'](_0x25e8b0[_0x8e55('0x2f')]);_0x42adae[_0x8e55('0x24')](_0x1abd80[_0x8e55('0x18')][_0x8e55('0x30')]);_0x42adae[_0x8e55('0x24')](_0x1abd80[_0x8e55('0x31')][_0x8e55('0x31')]);_0x42adae['push'](_0x3169ce);break;default:_0x42adae=_['isNil'](_0x25e8b0[_0x8e55('0x22')])?[]:_0x25e8b0[_0x8e55('0x22')][_0x8e55('0x27')](',');}var _0x21a8f8={'id':util[_0x8e55('0x32')](_0x8e55('0x33'),_0x1d6b69,_0x25e8b0['id'],_0x25e8b0['app']),'condition':require(_0x8e55('0x34'))[_0x8e55('0x35')](_0x1d6b69,getIntervals(_0x2a5545[_0x8e55('0x36')],_0x25e8b0),_0x2a5545),'consequence':require(_0x8e55('0x37')+_0x25e8b0[_0x8e55('0x1f')])['consequence'](_0x1d6b69,_0x42adae,_0x2a5545,_0x1abd80),'p':_0x25e8b0[_0x8e55('0x38')]||0x0};logger['info'](_0x8e55('0x39'),_0x21a8f8['id'],_0x8e55('0x3a'),getIntervals(_0x2a5545['intervals'],_0x25e8b0)[_0x8e55('0x1e')](_0x8e55('0x3b')));_0x45029c['push'](_0x21a8f8);}else{logger['error'](_0x8e55('0x3c'),path[_0x8e55('0x1e')](__dirname,_0x8e55('0x1c'),_0x25e8b0[_0x8e55('0x1f')]+_0x8e55('0x3d')));}}_0x2a5545[_0x8e55('0x15')][_0x1d6b69]=new RuleEngine(_0x45029c);_0x2a5545[_0x8e55('0x15')][_0x1d6b69][_0x8e55('0x3e')](_0x1abd80,function(_0x1d54b8){logger[_0x8e55('0x3f')]('Applications\x20executed',JSON[_0x8e55('0x40')](_0x1d54b8[_0x8e55('0x41')]));if(_0x2a5545['rules'][_0x1d6b69]){_0x2a5545[_0x8e55('0x15')][_0x1d6b69][_0x8e55('0x42')](_0x8e55('0x43'));}});return _0x83b32e({'code':0xc8,'message':_0x1abd80});}else{if(_0x1e5d1f){logger[_0x8e55('0x3f')](util[_0x8e55('0x32')]('Skipped\x20routing\x20for\x20%s',_0x1d6b69));}else{logger['info'](_0x8e55('0x44'));}return _0x83b32e({'code':0xc8,'message':_0x1abd80});}}catch(_0x1816e9){logger[_0x8e55('0x45')](_0x1816e9['stack']);return _0xb2e25e(_0x23c198[_0x8e55('0x45')](0x1f4,_0x1816e9));}}return _0xb2e25e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x585c65){var _0x81548b=this;return new Promise(function(_0x206cdd,_0x2ec8a1){if(_0x585c65[_0x8e55('0x46')]&&_0x585c65[_0x8e55('0x46')]['id']){if(_0x2a5545[_0x8e55('0x47')][_0x585c65[_0x8e55('0x46')]['id']]){_0x2a5545[_0x8e55('0x47')][_0x585c65['agent']['id']][_0x8e55('0x48')]=![];_0x2a5545['agents'][_0x585c65['agent']['id']][_0x8e55('0x49')]=undefined;}}if(_0x585c65[_0x8e55('0x17')]&&_0x585c65[_0x8e55('0x17')]['id']){try{var _0x150085=getId(_0x585c65[_0x8e55('0x16')],_0x585c65[_0x8e55('0x17')]?_0x585c65[_0x8e55('0x17')]['id']:0x0,_0x585c65[_0x8e55('0x18')]?_0x585c65[_0x8e55('0x18')]['id']:0x0);if(_0x2a5545[_0x8e55('0x15')][_0x150085]){_0x2a5545[_0x8e55('0x15')][_0x150085][_0x8e55('0x42')](_0x8e55('0x4a'));if(rpc[_0x585c65['channel']+'QueueReport']){rpc[_0x585c65[_0x8e55('0x16')]+_0x8e55('0x4b')][_0x8e55('0x4c')](_0x150085,{'UserId':_0x585c65['message'][_0x8e55('0x4d')]})[_0x8e55('0x4e')](function(){logger[_0x8e55('0x45')](_0x8e55('0x4f'));});}}return _0x206cdd({'code':0xc8,'message':_0x585c65});}catch(_0x36e180){logger[_0x8e55('0x45')](_0x36e180[_0x8e55('0x50')]);return _0x2ec8a1(_0x81548b[_0x8e55('0x45')](0x1f4,_0x36e180));}}logger[_0x8e55('0x45')]('message\x20is\x20empty');return _0x2ec8a1(_0x81548b[_0x8e55('0x45')](0x1f4,_0x8e55('0x51')));});},'RejectMessage':function(_0x329e76){var _0x289ee4=this;return new Promise(function(_0x541a47,_0x3efb1f){if(_0x329e76[_0x8e55('0x46')]&&_0x329e76[_0x8e55('0x46')]['id']){try{if(_0x2a5545[_0x8e55('0x47')][_0x329e76[_0x8e55('0x46')]['id']]){_0x2a5545[_0x8e55('0x47')][_0x329e76[_0x8e55('0x46')]['id']][_0x8e55('0x48')]=![];_0x2a5545['agents'][_0x329e76[_0x8e55('0x46')]['id']][_0x8e55('0x49')]=undefined;}return _0x541a47({'code':0xc8,'message':_0x329e76});}catch(_0x49b3d1){logger['error'](_0x49b3d1[_0x8e55('0x50')]);return _0x3efb1f(_0x289ee4['error'](0x1f4,_0x49b3d1));}}logger[_0x8e55('0x45')](_0x8e55('0x51'));return _0x3efb1f(_0x289ee4[_0x8e55('0x45')](0x1f4,_0x8e55('0x51')));});},'AbandonInteraction':function(_0x193e5a){var _0x591f4c=this;return new Promise(function(_0x64f2f6,_0x324551){if(_0x193e5a[_0x8e55('0x16')]&&_0x193e5a[_0x8e55('0x18')]&&_0x193e5a[_0x8e55('0x18')]['id']){try{var _0x44cf6d=getId(_0x193e5a['channel'],_0x193e5a[_0x8e55('0x17')]?_0x193e5a[_0x8e55('0x17')]['id']:0x0,_0x193e5a['interaction']?_0x193e5a[_0x8e55('0x18')]['id']:0x0);if(_0x2a5545['rules'][_0x44cf6d]){_0x2a5545[_0x8e55('0x15')][_0x44cf6d][_0x8e55('0x42')](_0x8e55('0x4a'));}return _0x64f2f6({'code':0xc8,'message':_0x193e5a});}catch(_0xac7042){logger[_0x8e55('0x45')](_0xac7042[_0x8e55('0x50')]);return _0x324551(_0x591f4c[_0x8e55('0x45')](0x1f4,_0xac7042));}}logger[_0x8e55('0x45')](_0x8e55('0x51'));return _0x324551(_0x591f4c[_0x8e55('0x45')](0x1f4,_0x8e55('0x51')));});},'AgentCapacity':function(_0x528b50){var _0x3d76bd=this;return new Promise(function(_0x538b2c,_0x231aca){if(_0x2a5545[_0x8e55('0x47')][_0x8e55('0x52')](_0x528b50['id'])){for(var _0x4c8d77 in _0x528b50['capacity']){if(_0x528b50[_0x8e55('0x53')][_0x8e55('0x52')](_0x4c8d77)){if(_0x2a5545[_0x8e55('0x47')][_0x528b50['id']][_0x8e55('0x52')](_0x4c8d77+_0x8e55('0x54'))){_0x2a5545['agents'][_0x528b50['id']][_0x4c8d77+_0x8e55('0x54')]=parseInt(_0x528b50[_0x8e55('0x53')][_0x4c8d77],0xa);}}}_0x2a5545[_0x8e55('0x47')][_0x528b50['id']]['updateRealtime']();return _0x538b2c({'code':0xc8,'message':_0x2a5545[_0x8e55('0x47')][_0x528b50['id']]});}else{return _0x231aca(_0x3d76bd[_0x8e55('0x45')](0x1f4,_0x8e55('0x55')));}});},'Agents':function(_0xba83d){return new Promise(function(_0x2aefc1){var _0x274a03=_[_0x8e55('0x56')](_0x2a5545['agents']);if(_0xba83d&&_0xba83d['id']){var _0xb9f1ec=_[_0x8e55('0x57')](_0x274a03,function(_0xcf1ddf){return _0xcf1ddf['id']===_0xba83d['id'];});_0x2aefc1(_0xb9f1ec);}else{_0x2aefc1({'count':_0x274a03[_0x8e55('0x1d')],'rows':_0x274a03});}});},'ChatQueues':function(){return new Promise(function(_0x5f25fd){var _0x18cff3=[];for(var _0x30f015 in _0x2a5545['chatQueues']){if(_0x2a5545[_0x8e55('0x58')][_0x8e55('0x52')](_0x30f015)){var _0x3248e9=_0x2a5545[_0x8e55('0x58')][_0x30f015];var _0x5da956={'id':_0x3248e9['id'],'available':_0x3248e9[_0x8e55('0x59')],'loggedIn':_0x3248e9['loggedIn'],'name':_0x3248e9[_0x8e55('0x5a')],'paused':_0x3248e9[_0x8e55('0x5b')],'waiting':_0x3248e9[_0x8e55('0x5c')]};_0x18cff3[_0x8e55('0x24')](_0x5da956);}}_0x5f25fd({'count':_0x18cff3[_0x8e55('0x1d')],'rows':_0x18cff3});});},'MailQueues':function(){return new Promise(function(_0x4c39f5){var _0x40f069=[];for(var _0x216c15 in _0x2a5545['mailQueues']){if(_0x2a5545['mailQueues'][_0x8e55('0x52')](_0x216c15)){var _0x40bc32=_0x2a5545[_0x8e55('0x5d')][_0x216c15];var _0x28efd2={'id':_0x40bc32['id'],'available':_0x40bc32['available'],'loggedIn':_0x40bc32['loggedIn'],'name':_0x40bc32[_0x8e55('0x5a')],'paused':_0x40bc32[_0x8e55('0x5b')],'waiting':_0x40bc32['waiting']};_0x40f069[_0x8e55('0x24')](_0x28efd2);}}_0x4c39f5({'count':_0x40f069[_0x8e55('0x1d')],'rows':_0x40f069});});},'OpenchannelQueues':function(){return new Promise(function(_0x5ebe20){var _0x1d630d=[];for(var _0x2ba40a in _0x2a5545[_0x8e55('0x5e')]){if(_0x2a5545[_0x8e55('0x5e')][_0x8e55('0x52')](_0x2ba40a)){var _0x2393c0=_0x2a5545[_0x8e55('0x5e')][_0x2ba40a];var _0x40212b={'id':_0x2393c0['id'],'available':_0x2393c0[_0x8e55('0x59')],'loggedIn':_0x2393c0[_0x8e55('0x5f')],'name':_0x2393c0[_0x8e55('0x5a')],'paused':_0x2393c0[_0x8e55('0x5b')],'waiting':_0x2393c0[_0x8e55('0x5c')]};_0x1d630d[_0x8e55('0x24')](_0x40212b);}}_0x5ebe20({'count':_0x1d630d[_0x8e55('0x1d')],'rows':_0x1d630d});});},'SmsQueues':function(){return new Promise(function(_0x616c46){var _0x23e1c6=[];for(var _0x5d7470 in _0x2a5545[_0x8e55('0x60')]){if(_0x2a5545['smsQueues']['hasOwnProperty'](_0x5d7470)){var _0xa1693e=_0x2a5545[_0x8e55('0x60')][_0x5d7470];var _0x3b19b8={'id':_0xa1693e['id'],'available':_0xa1693e[_0x8e55('0x59')],'loggedIn':_0xa1693e[_0x8e55('0x5f')],'name':_0xa1693e['name'],'paused':_0xa1693e[_0x8e55('0x5b')],'waiting':_0xa1693e['waiting']};_0x23e1c6[_0x8e55('0x24')](_0x3b19b8);}}_0x616c46({'count':_0x23e1c6[_0x8e55('0x1d')],'rows':_0x23e1c6});});},'FaxQueues':function(){return new Promise(function(_0x32b3a3){var _0x2361bc=[];for(var _0x2a06aa in _0x2a5545[_0x8e55('0x61')]){if(_0x2a5545['faxQueues'][_0x8e55('0x52')](_0x2a06aa)){var _0x5da963=_0x2a5545[_0x8e55('0x61')][_0x2a06aa];var _0x1c48f7={'id':_0x5da963['id'],'available':_0x5da963[_0x8e55('0x59')],'loggedIn':_0x5da963['loggedIn'],'name':_0x5da963[_0x8e55('0x5a')],'paused':_0x5da963[_0x8e55('0x5b')],'waiting':_0x5da963['waiting']};_0x2361bc['push'](_0x1c48f7);}}_0x32b3a3({'count':_0x2361bc[_0x8e55('0x1d')],'rows':_0x2361bc});});},'WhatsappQueues':function(){return new Promise(function(_0x3c6fab){var _0x1c183c=[];for(var _0x41f7c2 in _0x2a5545[_0x8e55('0x62')]){if(_0x2a5545[_0x8e55('0x62')][_0x8e55('0x52')](_0x41f7c2)){var _0x42d2b6=_0x2a5545[_0x8e55('0x62')][_0x41f7c2];var _0x1ed3ba={'id':_0x42d2b6['id'],'available':_0x42d2b6[_0x8e55('0x59')],'loggedIn':_0x42d2b6[_0x8e55('0x5f')],'name':_0x42d2b6[_0x8e55('0x5a')],'paused':_0x42d2b6[_0x8e55('0x5b')],'waiting':_0x42d2b6['waiting']};_0x1c183c[_0x8e55('0x24')](_0x1ed3ba);}}_0x3c6fab({'count':_0x1c183c['length'],'rows':_0x1c183c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x310233){var _0x424549=_[_0x8e55('0x56')](_0x2a5545[_0x8e55('0x63')]);_0x310233({'count':_0x424549['length'],'rows':_0x424549});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x44f214){var _0xca6ddb=_[_0x8e55('0x56')](_0x2a5545[_0x8e55('0x64')]);_0x44f214({'count':_0xca6ddb['length'],'rows':_0xca6ddb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2d5a90){var _0x40466=_[_0x8e55('0x56')](_0x2a5545[_0x8e55('0x65')]);_0x2d5a90({'count':_0x40466['length'],'rows':_0x40466});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xf9e173){var _0x2ae7ac=_['values'](_0x2a5545[_0x8e55('0x66')]);_0xf9e173({'count':_0x2ae7ac['length'],'rows':_0x2ae7ac});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x27428d){var _0x28b0d2=_[_0x8e55('0x56')](_0x2a5545[_0x8e55('0x67')]);_0x27428d({'count':_0x28b0d2[_0x8e55('0x1d')],'rows':_0x28b0d2});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x549705){var _0x566c11=_[_0x8e55('0x56')](_0x2a5545[_0x8e55('0x68')]);_0x549705({'count':_0x566c11[_0x8e55('0x1d')],'rows':_0x566c11});});}};var _0x384e3a=jayson[_0x8e55('0x69')](_0x125388)[_0x8e55('0x6a')]();_0x384e3a['on'](_0x8e55('0x45'),function(_0x3bd7f4){logger[_0x8e55('0x45')](JSON[_0x8e55('0x40')](_0x3bd7f4));return _0x8cbfc7(_0x3bd7f4);});_0x384e3a[_0x8e55('0x14')](0x232c,_0x8e55('0x6b'),function(){console[_0x8e55('0x6c')](_0x8e55('0x6d'),0x232c);return _0x2b5a04('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x9e69=['CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','hasOwnProperty','available','paused','mailQueues','loggedIn','waiting','openchannelQueues','name','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','isArray','applications','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflowv2','tag','TagId','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','capacity'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e69,0x150));var _0x99e6=function(_0x55af4c,_0x5d6a14){_0x55af4c=_0x55af4c-0x0;var _0x42dedb=_0x9e69[_0x55af4c];return _0x42dedb;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var path=require(_0x99e6('0x1'));var fs=require('fs');var jayson=require(_0x99e6('0x2'));var BPromise=require(_0x99e6('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x99e6('0x4'));var logger=require(_0x99e6('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x99e6('0x6')),'mailQueueReport':require(_0x99e6('0x7')),'chatQueueReport':require(_0x99e6('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x99e6('0x9')),'whatsappQueueReport':require(_0x99e6('0xa'))};var RuleEngine=require(_0x99e6('0xb'));function getId(_0x58eb2d,_0x3424c5,_0x305140){return util['format'](_0x99e6('0xc'),_0x58eb2d,_0x3424c5||0x0,_0x305140||0x0);}function getIntervals(_0x133169,_0x5d2a2b){var _0x26bcdd=[];if(!_[_0x99e6('0xd')](_0x5d2a2b['IntervalId'])&&!_['isNil'](_0x133169[_0x5d2a2b[_0x99e6('0xe')]])&&!_[_0x99e6('0xd')](_0x133169[_0x5d2a2b[_0x99e6('0xe')]][_0x99e6('0xf')])){_0x26bcdd=_[_0x99e6('0x10')](_0x133169[_0x5d2a2b[_0x99e6('0xe')]]['Intervals'],_0x99e6('0x11'));}else if(!_[_0x99e6('0xd')](_0x5d2a2b[_0x99e6('0x11')])){_0x26bcdd=[_0x5d2a2b['interval']];}return _0x26bcdd;}exports[_0x99e6('0x12')]=function(_0x4061b2){_0x4061b2[_0x99e6('0x13')]={};return new BPromise(function(_0x57111c,_0x586701){var _0x5d5dd9={'Start':function(_0x40fdb8){var _0x4741c9=this;return new Promise(function(_0x1d910a,_0x5d5cd5){if(_0x40fdb8){try{var _0x18fa86=[];var _0x38fcdd=getId(_0x40fdb8[_0x99e6('0x14')],_0x40fdb8[_0x99e6('0x15')]?_0x40fdb8[_0x99e6('0x15')]['id']:0x0,_0x40fdb8['interaction']?_0x40fdb8[_0x99e6('0x16')]['id']:0x0);var _0x4e84f4=sUtils[_0x99e6('0x17')](_0x4061b2,_0x40fdb8);if(_0x40fdb8[_0x99e6('0x18')]||!_0x4e84f4&&_0x40fdb8['applications']&&_[_0x99e6('0x19')](_0x40fdb8[_0x99e6('0x1a')])&&_0x40fdb8[_0x99e6('0x1a')][_0x99e6('0x1b')]){for(var _0x4779cf=0x0;_0x4779cf<_0x40fdb8[_0x99e6('0x1a')][_0x99e6('0x1b')];_0x4779cf+=0x1){var _0x95a8e5=_0x40fdb8[_0x99e6('0x1a')][_0x4779cf];if(fs[_0x99e6('0x1c')](path['join'](__dirname,_0x99e6('0x1a'),_0x95a8e5[_0x99e6('0x1d')]+_0x99e6('0x1e')))){var _0x249872=[];switch(_0x95a8e5[_0x99e6('0x1d')][_0x99e6('0x1f')]()){case _0x99e6('0x20'):var _0xa0b949=_0x95a8e5[_0x99e6('0x21')][_0x99e6('0x22')](',');if(_0x40fdb8[_0x99e6('0x14')]===_0x99e6('0x23')){_0x249872[_0x99e6('0x24')](_0xa0b949[0x0]);_0x249872[_0x99e6('0x24')](_0xa0b949[0x1]);_0x249872[_0x99e6('0x24')](_0xa0b949[_0x99e6('0x25')](0x2,_0xa0b949[_0x99e6('0x1b')])['join'](','));}else{_0x249872[_0x99e6('0x24')](_0xa0b949[0x0]);_0x249872['push'](_0xa0b949[_0x99e6('0x25')](0x1,_0xa0b949[_0x99e6('0x1b')])[_0x99e6('0x26')](','));}break;case'dialogflow':var _0x3a1325=_0x95a8e5['appdata'][_0x99e6('0x22')](',');_0x249872['push'](_0x3a1325[0x0]);_0x249872[_0x99e6('0x24')](_0x3a1325[0x1]);_0x249872[_0x99e6('0x24')](_0x3a1325['slice'](0x2,_0x3a1325['length'])[_0x99e6('0x26')](','));break;case _0x99e6('0x27'):var _0x29740d=_0x95a8e5[_0x99e6('0x21')][_0x99e6('0x22')](',');_0x249872['push'](_0x29740d[0x0]);_0x249872[_0x99e6('0x24')](_0x29740d[0x1]);_0x249872[_0x99e6('0x24')](_0x29740d[0x2]);_0x249872[_0x99e6('0x24')](_0x29740d[0x3]);_0x249872['push'](_0x29740d['slice'](0x4,_0x29740d[_0x99e6('0x1b')])['join'](','));break;case'amazonlex':var _0x213a6f=_0x95a8e5['appdata'][_0x99e6('0x22')](',');_0x249872[_0x99e6('0x24')](_0x213a6f[0x0]);_0x249872[_0x99e6('0x24')](_0x213a6f[0x1]);_0x249872['push'](_0x213a6f[0x2]);_0x249872[_0x99e6('0x24')](_0x213a6f[0x3]);_0x249872[_0x99e6('0x24')](_0x213a6f[_0x99e6('0x25')](0x4,_0x213a6f[_0x99e6('0x1b')])['join'](','));break;case _0x99e6('0x15'):_0x249872[_0x99e6('0x24')](_0x95a8e5[_0x99e6('0x21')]);break;case _0x99e6('0x28'):_0x249872[_0x99e6('0x24')](_0x95a8e5[_0x99e6('0x29')]);_0x249872['push'](_0x95a8e5[_0x99e6('0x21')]);break;case'tvox':var _0x47bdb3=utils['getMustacheRender'](_0x40fdb8[_0x99e6('0x2a')][_0x99e6('0x2b')],_0x40fdb8);var _0x4cf592=_0x95a8e5[_0x99e6('0x21')][_0x99e6('0x22')](',');_0x249872[_0x99e6('0x24')](_0x4cf592[0x0]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x1]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x2]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x3]);_0x249872['push'](_0x4cf592[0x4]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x5]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x6]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x7]);_0x249872[_0x99e6('0x24')](_0x4cf592[0x8]);_0x249872['push'](_0x4cf592[0x9]);_0x249872[_0x99e6('0x24')](_0x4cf592[0xa]);_0x249872[_0x99e6('0x24')](_0x40fdb8[_0x99e6('0x16')]['id']);_0x249872[_0x99e6('0x24')](_0x40fdb8[_0x99e6('0x15')]['id']);_0x249872[_0x99e6('0x24')](_0x95a8e5[_0x99e6('0x2c')]);_0x249872['push'](_0x40fdb8['interaction']['ContactId']);_0x249872[_0x99e6('0x24')](_0x40fdb8[_0x99e6('0x2d')]['body']);_0x249872[_0x99e6('0x24')](_0x47bdb3);break;default:_0x249872=_[_0x99e6('0xd')](_0x95a8e5[_0x99e6('0x21')])?[]:_0x95a8e5[_0x99e6('0x21')][_0x99e6('0x22')](',');}var _0x1a28a6={'id':util[_0x99e6('0x2e')](_0x99e6('0x2f'),_0x38fcdd,_0x95a8e5['id'],_0x95a8e5[_0x99e6('0x1d')]),'condition':require(_0x99e6('0x30'))[_0x99e6('0x31')](_0x38fcdd,getIntervals(_0x4061b2['intervals'],_0x95a8e5),_0x4061b2),'consequence':require(_0x99e6('0x32')+_0x95a8e5[_0x99e6('0x1d')])[_0x99e6('0x33')](_0x38fcdd,_0x249872,_0x4061b2,_0x40fdb8),'p':_0x95a8e5[_0x99e6('0x34')]||0x0};logger[_0x99e6('0x35')](_0x99e6('0x36'),_0x1a28a6['id'],_0x99e6('0x37'),getIntervals(_0x4061b2[_0x99e6('0x38')],_0x95a8e5)[_0x99e6('0x26')]('\x20|\x20'));_0x18fa86['push'](_0x1a28a6);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x99e6('0x1a'),_0x95a8e5[_0x99e6('0x1d')]+'.js'));}}_0x4061b2[_0x99e6('0x13')][_0x38fcdd]=new RuleEngine(_0x18fa86);_0x4061b2[_0x99e6('0x13')][_0x38fcdd][_0x99e6('0x39')](_0x40fdb8,function(_0x16df22){logger[_0x99e6('0x35')](_0x99e6('0x3a'),JSON['stringify'](_0x16df22[_0x99e6('0x3b')]));if(_0x4061b2[_0x99e6('0x13')][_0x38fcdd]){_0x4061b2[_0x99e6('0x13')][_0x38fcdd][_0x99e6('0x3c')](_0x99e6('0x3d'));}});return _0x1d910a({'code':0xc8,'message':_0x40fdb8});}else{if(_0x4e84f4){logger[_0x99e6('0x35')](util[_0x99e6('0x2e')](_0x99e6('0x3e'),_0x38fcdd));}else{logger[_0x99e6('0x35')](_0x99e6('0x3f'));}return _0x1d910a({'code':0xc8,'message':_0x40fdb8});}}catch(_0xb97a84){logger[_0x99e6('0x40')](_0xb97a84[_0x99e6('0x41')]);return _0x5d5cd5(_0x4741c9[_0x99e6('0x40')](0x1f4,_0xb97a84));}}return _0x5d5cd5('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4a83cb){var _0x58a10b=this;return new Promise(function(_0x481180,_0x3a8ddc){if(_0x4a83cb[_0x99e6('0x42')]&&_0x4a83cb[_0x99e6('0x42')]['id']){if(_0x4061b2[_0x99e6('0x43')][_0x4a83cb[_0x99e6('0x42')]['id']]){_0x4061b2['agents'][_0x4a83cb['agent']['id']][_0x99e6('0x44')]=![];_0x4061b2[_0x99e6('0x43')][_0x4a83cb['agent']['id']]['busyQueue']=undefined;}}if(_0x4a83cb[_0x99e6('0x15')]&&_0x4a83cb[_0x99e6('0x15')]['id']){try{var _0x591ef7=getId(_0x4a83cb[_0x99e6('0x14')],_0x4a83cb['message']?_0x4a83cb[_0x99e6('0x15')]['id']:0x0,_0x4a83cb[_0x99e6('0x16')]?_0x4a83cb[_0x99e6('0x16')]['id']:0x0);if(_0x4061b2['rules'][_0x591ef7]){_0x4061b2[_0x99e6('0x13')][_0x591ef7][_0x99e6('0x3c')]('end');if(rpc[_0x4a83cb[_0x99e6('0x14')]+_0x99e6('0x45')]){rpc[_0x4a83cb[_0x99e6('0x14')]+'QueueReport']['update'](_0x591ef7,{'UserId':_0x4a83cb[_0x99e6('0x15')][_0x99e6('0x46')]})['catch'](function(){logger[_0x99e6('0x40')](_0x99e6('0x47'));});}}return _0x481180({'code':0xc8,'message':_0x4a83cb});}catch(_0x20d286){logger[_0x99e6('0x40')](_0x20d286[_0x99e6('0x41')]);return _0x3a8ddc(_0x58a10b[_0x99e6('0x40')](0x1f4,_0x20d286));}}logger[_0x99e6('0x40')]('message\x20is\x20empty');return _0x3a8ddc(_0x58a10b[_0x99e6('0x40')](0x1f4,_0x99e6('0x48')));});},'RejectMessage':function(_0x561b1f){var _0x28cae9=this;return new Promise(function(_0x241515,_0x5d1442){if(_0x561b1f[_0x99e6('0x42')]&&_0x561b1f[_0x99e6('0x42')]['id']){try{if(_0x4061b2['agents'][_0x561b1f[_0x99e6('0x42')]['id']]){_0x4061b2['agents'][_0x561b1f[_0x99e6('0x42')]['id']][_0x99e6('0x44')]=![];_0x4061b2[_0x99e6('0x43')][_0x561b1f[_0x99e6('0x42')]['id']][_0x99e6('0x49')]=undefined;}return _0x241515({'code':0xc8,'message':_0x561b1f});}catch(_0x225e13){logger[_0x99e6('0x40')](_0x225e13[_0x99e6('0x41')]);return _0x5d1442(_0x28cae9[_0x99e6('0x40')](0x1f4,_0x225e13));}}logger[_0x99e6('0x40')](_0x99e6('0x48'));return _0x5d1442(_0x28cae9[_0x99e6('0x40')](0x1f4,_0x99e6('0x48')));});},'AbandonInteraction':function(_0x532bc4){var _0x3dc96d=this;return new Promise(function(_0x3e13a9,_0x303ca3){if(_0x532bc4[_0x99e6('0x14')]&&_0x532bc4[_0x99e6('0x16')]&&_0x532bc4[_0x99e6('0x16')]['id']){try{var _0x41528a=getId(_0x532bc4[_0x99e6('0x14')],_0x532bc4[_0x99e6('0x15')]?_0x532bc4[_0x99e6('0x15')]['id']:0x0,_0x532bc4[_0x99e6('0x16')]?_0x532bc4[_0x99e6('0x16')]['id']:0x0);if(_0x4061b2[_0x99e6('0x13')][_0x41528a]){_0x4061b2[_0x99e6('0x13')][_0x41528a][_0x99e6('0x3c')](_0x99e6('0x4a'));}return _0x3e13a9({'code':0xc8,'message':_0x532bc4});}catch(_0x2fbc1b){logger[_0x99e6('0x40')](_0x2fbc1b[_0x99e6('0x41')]);return _0x303ca3(_0x3dc96d[_0x99e6('0x40')](0x1f4,_0x2fbc1b));}}logger['error'](_0x99e6('0x48'));return _0x303ca3(_0x3dc96d[_0x99e6('0x40')](0x1f4,_0x99e6('0x48')));});},'AgentCapacity':function(_0x31d730){var _0x5ec39b=this;return new Promise(function(_0x3a90ee,_0x25ef3f){if(_0x4061b2[_0x99e6('0x43')]['hasOwnProperty'](_0x31d730['id'])){for(var _0x18ab2e in _0x31d730[_0x99e6('0x4b')]){if(_0x31d730[_0x99e6('0x4b')]['hasOwnProperty'](_0x18ab2e)){if(_0x4061b2[_0x99e6('0x43')][_0x31d730['id']]['hasOwnProperty'](_0x18ab2e+_0x99e6('0x4c'))){_0x4061b2[_0x99e6('0x43')][_0x31d730['id']][_0x18ab2e+_0x99e6('0x4c')]=parseInt(_0x31d730['capacity'][_0x18ab2e],0xa);}}}_0x4061b2['agents'][_0x31d730['id']][_0x99e6('0x4d')]();return _0x3a90ee({'code':0xc8,'message':_0x4061b2[_0x99e6('0x43')][_0x31d730['id']]});}else{return _0x25ef3f(_0x5ec39b[_0x99e6('0x40')](0x1f4,_0x99e6('0x4e')));}});},'Agents':function(_0x531b0c){return new Promise(function(_0xed9c53){var _0x2eb924=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x43')]);if(_0x531b0c&&_0x531b0c['id']){var _0x52e7f7=_[_0x99e6('0x50')](_0x2eb924,function(_0x38df20){return _0x38df20['id']===_0x531b0c['id'];});_0xed9c53(_0x52e7f7);}else{_0xed9c53({'count':_0x2eb924[_0x99e6('0x1b')],'rows':_0x2eb924});}});},'ChatQueues':function(){return new Promise(function(_0x3b0a5c){var _0x338524=[];for(var _0x5a1b60 in _0x4061b2[_0x99e6('0x51')]){if(_0x4061b2[_0x99e6('0x51')][_0x99e6('0x52')](_0x5a1b60)){var _0x51d37d=_0x4061b2[_0x99e6('0x51')][_0x5a1b60];var _0x428256={'id':_0x51d37d['id'],'available':_0x51d37d[_0x99e6('0x53')],'loggedIn':_0x51d37d['loggedIn'],'name':_0x51d37d['name'],'paused':_0x51d37d[_0x99e6('0x54')],'waiting':_0x51d37d['waiting']};_0x338524[_0x99e6('0x24')](_0x428256);}}_0x3b0a5c({'count':_0x338524[_0x99e6('0x1b')],'rows':_0x338524});});},'MailQueues':function(){return new Promise(function(_0x5064d7){var _0x5311b1=[];for(var _0x23ad5a in _0x4061b2[_0x99e6('0x55')]){if(_0x4061b2[_0x99e6('0x55')][_0x99e6('0x52')](_0x23ad5a)){var _0x1b0d7f=_0x4061b2[_0x99e6('0x55')][_0x23ad5a];var _0x403dad={'id':_0x1b0d7f['id'],'available':_0x1b0d7f['available'],'loggedIn':_0x1b0d7f[_0x99e6('0x56')],'name':_0x1b0d7f['name'],'paused':_0x1b0d7f['paused'],'waiting':_0x1b0d7f[_0x99e6('0x57')]};_0x5311b1['push'](_0x403dad);}}_0x5064d7({'count':_0x5311b1[_0x99e6('0x1b')],'rows':_0x5311b1});});},'OpenchannelQueues':function(){return new Promise(function(_0x6feac4){var _0x2fa4fc=[];for(var _0x321a5a in _0x4061b2[_0x99e6('0x58')]){if(_0x4061b2['openchannelQueues'][_0x99e6('0x52')](_0x321a5a)){var _0x1822cc=_0x4061b2['openchannelQueues'][_0x321a5a];var _0x17eba0={'id':_0x1822cc['id'],'available':_0x1822cc[_0x99e6('0x53')],'loggedIn':_0x1822cc['loggedIn'],'name':_0x1822cc[_0x99e6('0x59')],'paused':_0x1822cc[_0x99e6('0x54')],'waiting':_0x1822cc[_0x99e6('0x57')]};_0x2fa4fc[_0x99e6('0x24')](_0x17eba0);}}_0x6feac4({'count':_0x2fa4fc[_0x99e6('0x1b')],'rows':_0x2fa4fc});});},'SmsQueues':function(){return new Promise(function(_0x1c1b2b){var _0x3403ca=[];for(var _0xb8b87c in _0x4061b2[_0x99e6('0x5a')]){if(_0x4061b2[_0x99e6('0x5a')][_0x99e6('0x52')](_0xb8b87c)){var _0xde0ee9=_0x4061b2[_0x99e6('0x5a')][_0xb8b87c];var _0x4b10d1={'id':_0xde0ee9['id'],'available':_0xde0ee9['available'],'loggedIn':_0xde0ee9[_0x99e6('0x56')],'name':_0xde0ee9[_0x99e6('0x59')],'paused':_0xde0ee9[_0x99e6('0x54')],'waiting':_0xde0ee9[_0x99e6('0x57')]};_0x3403ca['push'](_0x4b10d1);}}_0x1c1b2b({'count':_0x3403ca[_0x99e6('0x1b')],'rows':_0x3403ca});});},'FaxQueues':function(){return new Promise(function(_0x3f57c0){var _0x51711b=[];for(var _0x444d4a in _0x4061b2['faxQueues']){if(_0x4061b2['faxQueues'][_0x99e6('0x52')](_0x444d4a)){var _0x2a5c23=_0x4061b2['faxQueues'][_0x444d4a];var _0x22b916={'id':_0x2a5c23['id'],'available':_0x2a5c23[_0x99e6('0x53')],'loggedIn':_0x2a5c23[_0x99e6('0x56')],'name':_0x2a5c23[_0x99e6('0x59')],'paused':_0x2a5c23[_0x99e6('0x54')],'waiting':_0x2a5c23[_0x99e6('0x57')]};_0x51711b[_0x99e6('0x24')](_0x22b916);}}_0x3f57c0({'count':_0x51711b[_0x99e6('0x1b')],'rows':_0x51711b});});},'WhatsappQueues':function(){return new Promise(function(_0x2d7f6f){var _0x165918=[];for(var _0x13530c in _0x4061b2[_0x99e6('0x5b')]){if(_0x4061b2['whatsappQueues'][_0x99e6('0x52')](_0x13530c)){var _0x238c75=_0x4061b2[_0x99e6('0x5b')][_0x13530c];var _0x28939b={'id':_0x238c75['id'],'available':_0x238c75[_0x99e6('0x53')],'loggedIn':_0x238c75['loggedIn'],'name':_0x238c75[_0x99e6('0x59')],'paused':_0x238c75[_0x99e6('0x54')],'waiting':_0x238c75[_0x99e6('0x57')]};_0x165918[_0x99e6('0x24')](_0x28939b);}}_0x2d7f6f({'count':_0x165918[_0x99e6('0x1b')],'rows':_0x165918});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xffc3c0){var _0x4d9fc6=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x5c')]);_0xffc3c0({'count':_0x4d9fc6[_0x99e6('0x1b')],'rows':_0x4d9fc6});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b9126){var _0x20172d=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x5d')]);_0x3b9126({'count':_0x20172d[_0x99e6('0x1b')],'rows':_0x20172d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x595539){var _0x183ea7=_['values'](_0x4061b2[_0x99e6('0x5e')]);_0x595539({'count':_0x183ea7['length'],'rows':_0x183ea7});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x15b9a1){var _0x213f0f=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x5f')]);_0x15b9a1({'count':_0x213f0f['length'],'rows':_0x213f0f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5235c6){var _0x24b5c7=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x60')]);_0x5235c6({'count':_0x24b5c7[_0x99e6('0x1b')],'rows':_0x24b5c7});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1cdf12){var _0x42ac54=_[_0x99e6('0x4f')](_0x4061b2[_0x99e6('0x61')]);_0x1cdf12({'count':_0x42ac54[_0x99e6('0x1b')],'rows':_0x42ac54});});}};var _0x16f182=jayson[_0x99e6('0x62')](_0x5d5dd9)[_0x99e6('0x63')]();_0x16f182['on'](_0x99e6('0x40'),function(_0x4f2915){logger['error'](JSON['stringify'](_0x4f2915));return _0x586701(_0x4f2915);});_0x16f182[_0x99e6('0x12')](0x232c,_0x99e6('0x64'),function(){console[_0x99e6('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x57111c(_0x99e6('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 402f82f..3225439 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 _0x6e14=['stop','lodash','../../../utils/iftime','../../../config/logger','condition','rules','info','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0x3538b6,_0x388d64){var _0x3aa3ed=function(_0x459385){while(--_0x459385){_0x3538b6['push'](_0x3538b6['shift']());}};_0x3aa3ed(++_0x388d64);}(_0x6e14,0x15f));var _0x46e1=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x6e14[_0x26d018];return _0x296c00;};'use strict';var _=require(_0x46e1('0x0'));var iftime=require(_0x46e1('0x1'))['iftime'];var logger=require(_0x46e1('0x2'))('routing');exports[_0x46e1('0x3')]=function(_0x1719ef,_0x523663,_0x54d8a7){return function(_0x3c70d0){if(_0x54d8a7[_0x46e1('0x4')]&&!_0x54d8a7['rules'][_0x1719ef]){logger[_0x46e1('0x5')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1719ef);return _0x3c70d0['stop']();}var _0xc2c20=_0x523663[_0x46e1('0x6')](function(_0x3182af){return iftime(_0x3182af);});var _0x1f2aba=_[_0x46e1('0x7')](_0xc2c20);if(_0x1f2aba){logger['info'](_0x46e1('0x8'),_0x1719ef,_0x523663[_0x46e1('0x9')](_0x46e1('0xa')),_0x1f2aba);_0x3c70d0[_0x46e1('0xb')](_0x1f2aba);}else{logger[_0x46e1('0x5')](_0x46e1('0xc'),_0x1719ef,_0x523663[_0x46e1('0x9')](_0x46e1('0xa')));_0x3c70d0[_0x46e1('0xd')]();}};}; \ No newline at end of file +var _0x6dcd=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','some','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','lodash','../../../utils/iftime','iftime','../../../config/logger','routing'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x6dcd,0x91));var _0xd6dc=function(_0x27755f,_0x176bad){_0x27755f=_0x27755f-0x0;var _0x4a233e=_0x6dcd[_0x27755f];return _0x4a233e;};'use strict';var _=require(_0xd6dc('0x0'));var iftime=require(_0xd6dc('0x1'))[_0xd6dc('0x2')];var logger=require(_0xd6dc('0x3'))(_0xd6dc('0x4'));exports[_0xd6dc('0x5')]=function(_0x1465ed,_0xf17e8c,_0x4533e8){return function(_0x183bbd){if(_0x4533e8[_0xd6dc('0x6')]&&!_0x4533e8[_0xd6dc('0x6')][_0x1465ed]){logger[_0xd6dc('0x7')](_0xd6dc('0x8'),_0x1465ed);return _0x183bbd[_0xd6dc('0x9')]();}var _0x62d7a2=_0xf17e8c['map'](function(_0x401ef5){return iftime(_0x401ef5);});var _0xb25a1f=_[_0xd6dc('0xa')](_0x62d7a2);if(_0xb25a1f){logger['info']('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x1465ed,_0xf17e8c['join'](_0xd6dc('0xb')),_0xb25a1f);_0x183bbd[_0xd6dc('0xc')](_0xb25a1f);}else{logger[_0xd6dc('0x7')](_0xd6dc('0xd'),_0x1465ed,_0xf17e8c[_0xd6dc('0xe')](_0xd6dc('0xb')));_0x183bbd[_0xd6dc('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b26b29a..d583110 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 _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x49d569,_0x4d537a){_0x49d569=_0x49d569-0x0;var _0x3de734=_0x0972[_0x49d569];return _0x3de734;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file +var _0xeffd=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','origtransfereruniqueid','transfereeuniqueid','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','now','called','error','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','push','[%s][agents][agentringnoanswer]','forIn','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid'];(function(_0xfe55dc,_0x458717){var _0x2d50ec=function(_0x46e9fc){while(--_0x46e9fc){_0xfe55dc['push'](_0xfe55dc['shift']());}};_0x2d50ec(++_0x458717);}(_0xeffd,0x6b));var _0xdeff=function(_0x3e908f,_0x28a35f){_0x3e908f=_0x3e908f-0x0;var _0x3d3a98=_0xeffd[_0x3e908f];return _0x3d3a98;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var utils=require(_0xdeff('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xd8f1d6,_0x281a05){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x4'),_0xd8f1d6[_0xdeff('0x5')],_0xd8f1d6[_0xdeff('0x6')],_0xd8f1d6[_0xdeff('0x7')],_0xd8f1d6[_0xdeff('0x8')],_0xd8f1d6[_0xdeff('0x9')],_0xd8f1d6[_0xdeff('0xa')],_0xd8f1d6[_0xdeff('0xb')],_0xd8f1d6[_0xdeff('0xc')]));if(_0xd8f1d6[_0xdeff('0x7')]){utils[_0xdeff('0xd')](_0xd8f1d6[_0xdeff('0x7')])['then'](function(_0x3ae201){if(_0x3ae201){_0xd8f1d6[_0xdeff('0xe')]=_0x3ae201[_0xdeff('0xe')];_0xd8f1d6['agentacw']=_0xd8f1d6[_0xdeff('0xf')]?_0x3ae201[_0xdeff('0x10')]:![];_0xd8f1d6[_0xdeff('0x11')]=_0xd8f1d6[_0xdeff('0x12')]?_0x3ae201[_0xdeff('0x13')]:0x0;}utils[_0xdeff('0x14')](_0xdeff('0x15'),_0xd8f1d6);});}else{utils[_0xdeff('0x14')]('CreateVoiceAgentReport',_0xd8f1d6);}if(_0x281a05){delete transfers[_0xd8f1d6[_0xdeff('0x5')]];}else{delete agents[_0xd8f1d6[_0xdeff('0x16')]];}}exports['agentcalled']=function(_0x2e614c){try{utils['debug'](util['format'](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x2e614c);agents[_0x2e614c[_0xdeff('0x16')]]=_0x2e614c;agents[_0x2e614c[_0xdeff('0x16')]]['agentcalledAt']=utils[_0xdeff('0x18')]();agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x19');agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xb')]=null;agents[_0x2e614c['destuniqueid']]['connectedlinename']=null;utils[_0xdeff('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2e614c[_0xdeff('0x5')],agents[_0x2e614c[_0xdeff('0x16')]]['membername'],_0x2e614c[_0xdeff('0x16')]));}catch(_0x42e98e){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x42e98e);}};exports[_0xdeff('0x1b')]=function(_0x919c93){try{if(!_['isNil'](agents[_0x919c93['destuniqueid']])){utils['debug'](util[_0xdeff('0x3')]('[%s][agents][agentringnoanswer]',_0x919c93[_0xdeff('0x5')]),_0x919c93);utils[_0xdeff('0x2')](util['format'](_0xdeff('0x1c'),_0x919c93[_0xdeff('0x5')],agents[_0x919c93['destuniqueid']]['membername'],_0x919c93[_0xdeff('0x16')]));agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1b')]=!![];agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1d')]=utils['now']();agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1f')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]]['holdtime']=_0x919c93[_0xdeff('0x20')]?parseInt(_0x919c93[_0xdeff('0x20')])/0x3e8:0x0;agents[_0x919c93['destuniqueid']]['talktime']=0x0;unanswered[_0xdeff('0x21')](_0x919c93[_0xdeff('0x16')]);}}catch(_0x16b2d0){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x22'),_0x919c93[_0xdeff('0x5')]),_0x16b2d0);}};exports['queuecallerabandon']=function(_0x331ddc){try{_[_0xdeff('0x23')](agents,function(_0x34e258,_0x5045b8){if(_0x34e258['uniqueid']==_0x331ddc[_0xdeff('0x5')]&&!_['includes'](unanswered,_0x34e258[_0xdeff('0x16')])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][queuecallerabandon]',_0x331ddc[_0xdeff('0x5')]),_0x331ddc);utils['info'](util['format'](_0xdeff('0x25'),_0x331ddc[_0xdeff('0x5')],_0x34e258[_0xdeff('0x8')],_0x34e258[_0xdeff('0x16')]));_0x34e258['agentringnoanswer']=!![];_0x34e258[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x34e258[_0xdeff('0xc')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x1f')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x27')]=_0x331ddc['holdtime'];_0x34e258[_0xdeff('0x28')]=0x0;writeDB(_0x34e258);}});}catch(_0x5cef77){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x29'),_0x331ddc[_0xdeff('0x5')]),_0x5cef77);}};exports[_0xdeff('0x2a')]=function(_0x965c5b){try{if(agents[_0x965c5b['destuniqueid']]){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentconnect]',_0x965c5b[_0xdeff('0x5')]),_0x965c5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x2b'),_0x965c5b[_0xdeff('0x5')],agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x965c5b[_0xdeff('0x16')]));agents[_0x965c5b['destuniqueid']][_0xdeff('0x2c')]=utils['now']();agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0xb')]=_0x965c5b[_0xdeff('0xb')];agents[_0x965c5b['destuniqueid']][_0xdeff('0x2d')]=_0x965c5b[_0xdeff('0x2d')];agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x27')]=_0x965c5b[_0xdeff('0x20')];agents[_0x965c5b['destuniqueid']][_0xdeff('0xc')]='connect';_[_0xdeff('0x23')](agents,function(_0x14f1d0,_0x518280){if(_0x14f1d0[_0xdeff('0x16')]!=_0x965c5b[_0xdeff('0x16')]&&_0x14f1d0[_0xdeff('0x5')]==_0x965c5b[_0xdeff('0x5')]){_0x14f1d0[_0xdeff('0x28')]=0x0;_0x14f1d0['holdtime']=_0x965c5b[_0xdeff('0x20')];_0x14f1d0[_0xdeff('0x1b')]=!![];_0x14f1d0[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x14f1d0[_0xdeff('0xc')]='answered_elsewhere';_0x14f1d0['reason']=_0xdeff('0x2e');_0x14f1d0[_0xdeff('0x2f')]=_0x965c5b[_0xdeff('0x16')];_0x14f1d0[_0xdeff('0x30')]=_0x965c5b[_0xdeff('0x8')];writeDB(_0x14f1d0);}});}}catch(_0x289f70){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x31'),_0x965c5b[_0xdeff('0x5')]),_0x289f70);}};exports[_0xdeff('0xf')]=function(_0x54fa5b){try{if(!_[_0xdeff('0x32')](agents[_0x54fa5b[_0xdeff('0x16')]])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0x54fa5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x33'),_0x54fa5b[_0xdeff('0x5')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x54fa5b[_0xdeff('0x16')]));agents[_0x54fa5b['destuniqueid']][_0xdeff('0xf')]=!![];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')]=utils[_0xdeff('0x18')]();agents[_0x54fa5b[_0xdeff('0x16')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x2c')]);agents[_0x54fa5b['destuniqueid']][_0xdeff('0x1f')]=_0x54fa5b['reason'];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x36');writeDB(agents[_0x54fa5b[_0xdeff('0x16')]]);}}catch(_0xf58aa6){utils[_0xdeff('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0xf58aa6);}};exports[_0xdeff('0x37')]=function(_0x3dc206){try{if(!_['isNil'](agents[_0x3dc206['transfereruniqueid']])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]',_0x3dc206[_0xdeff('0x5')]),_0x3dc206);utils[_0xdeff('0x2')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3dc206[_0xdeff('0x5')],agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x8')],agents[_0x3dc206['transfereruniqueid']][_0xdeff('0x5')]));agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x39')]=!![];agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x3a')]=_0xdeff('0x3b');agents[_0x3dc206[_0xdeff('0x38')]]['transferexten']=_0x3dc206[_0xdeff('0x3c')];agents[_0x3dc206[_0xdeff('0x38')]]['transferuniqueid']=agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x5')];}}catch(_0x2967b4){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3d'),_0x3dc206[_0xdeff('0x5')]),_0x2967b4);}};exports[_0xdeff('0x3e')]=function(_0x5ca032){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032['origtransfereruniqueid']),_0x5ca032);if(_0x5ca032['origtransfereruniqueid']==_0x5ca032[_0xdeff('0x40')]){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x41')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032['origtransfereruniqueid'],agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x41')]]['transfer']=!![];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x3a')]=_0xdeff('0x43');agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x44')]=_0x5ca032[_0xdeff('0x45')];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032[_0xdeff('0x47')];}if(_0x5ca032['transfereeuniqueid']&&agents[_0x5ca032[_0xdeff('0x48')]]){agents[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x48')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x48')]]);transfers[_0x5ca032['transfereeuniqueid']]['calleridnum']=agents[_0x5ca032[_0xdeff('0x41')]]['calleridnum'];transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x4a')]=agents[_0x5ca032[_0xdeff('0x41')]][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x48')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x2c')]=utils[_0xdeff('0x18')]();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x2;}}else if(_0x5ca032[_0xdeff('0x41')]==_0x5ca032['secondtransfererlinkedid']){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x47')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032[_0xdeff('0x47')],agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x47')]]['transfer']=!![];agents[_0x5ca032[_0xdeff('0x47')]]['transfertype']=_0xdeff('0x43');agents[_0x5ca032[_0xdeff('0x47')]]['transferexten']=_0x5ca032[_0xdeff('0x4b')];agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032['secondtransfereruniqueid'];}if(_0x5ca032['transfertargetuniqueid']&&agents[_0x5ca032[_0xdeff('0x4c')]]){agents[_0x5ca032[_0xdeff('0x4c')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x4c')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x4c')]]);transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0xa')]=agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0xa')];transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4a')]=agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x4c')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x2c')]=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4d')]=0x2;}}}catch(_0x194eed){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032[_0xdeff('0x47')]),_0x194eed);}};exports[_0xdeff('0x4e')]=function(_0x5ab2c5){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0x5ab2c5);if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5['uniqueid']]['reason']==='timeout'){if(_0x5ab2c5[_0xdeff('0x50')]==='21'){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=_0xdeff('0x51');agents[_0x5ab2c5['uniqueid']]['lastevent']=_0xdeff('0x51');}utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x8')],agents[_0x5ab2c5[_0xdeff('0x5')]]['reason'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);var _0x452fd4=unanswered[_0xdeff('0x53')](_0x5ab2c5[_0xdeff('0x5')]);if(_0x452fd4>-0x1){unanswered[_0xdeff('0x54')](_0x452fd4,0x1);}}if(transfers[_0x5ab2c5[_0xdeff('0x5')]]){transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')]=utils['now']();transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x28')]=utils[_0xdeff('0x35')](transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x34')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x2c')]);transfers[_0x5ab2c5[_0xdeff('0x5')]]['reason']=_0xdeff('0x55');transfers[_0x5ab2c5[_0xdeff('0x5')]]['lastevent']=_0xdeff('0x36');utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x8')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(transfers[_0x5ab2c5['uniqueid']],!![]);}if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];agents[_0x5ab2c5[_0xdeff('0x5')]]['agentcompleteAt']=utils[_0xdeff('0x18')]();agents[_0x5ab2c5[_0xdeff('0x5')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')],agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']);agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x39')]?_0xdeff('0x39'):_0xdeff('0x55');agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]=_0xdeff('0x36');utils['info'](util[_0xdeff('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5['uniqueid']]['membername'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],agents[_0x5ab2c5['uniqueid']][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);}}catch(_0xd49939){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0xd49939);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 10c4502..03c85ab 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 _0xf4e1=['destination','\x22\x20<','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','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','FAILED','NO\x20ANSWER','info','format','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','debug','isNil','answertime','ANSWERED','[%s][calls][hangup]','callerid','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone'];(function(_0x31594d,_0x13780c){var _0x10f86c=function(_0x3ed14a){while(--_0x3ed14a){_0x31594d['push'](_0x31594d['shift']());}};_0x10f86c(++_0x13780c);}(_0xf4e1,0x141));var _0x1f4e=function(_0x1ad06a,_0x5a6a97){_0x1ad06a=_0x1ad06a-0x0;var _0x171422=_0xf4e1[_0x1ad06a];return _0x171422;};'use strict';var _=require('lodash');var util=require(_0x1f4e('0x0'));var utils=require(_0x1f4e('0x1'));var dispositions=['NO\x20ANSWER',_0x1f4e('0x2'),'FAILED',_0x1f4e('0x3'),_0x1f4e('0x3'),_0x1f4e('0x3'),'ANSWERED','BUSY',_0x1f4e('0x2'),_0x1f4e('0x2'),_0x1f4e('0x2')];var channels={};function writeDB(_0x285245){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x285245['uniqueid'],_0x285245[_0x1f4e('0x6')],_0x285245[_0x1f4e('0x7')],_0x285245[_0x1f4e('0x8')],_0x285245[_0x1f4e('0x9')],_0x285245['calleridnum'],_0x285245[_0x1f4e('0xa')],_0x285245[_0x1f4e('0xb')]));if(_0x285245[_0x1f4e('0xc')]){utils['getUserByInternal'](_0x285245['accountcode'])[_0x1f4e('0xd')](function(_0xaaf59f){if(_0xaaf59f){_0x285245[_0x1f4e('0xe')]=_0xaaf59f['id'];}utils[_0x1f4e('0xf')](_0x1f4e('0x10'),_0x285245);});}else{utils[_0x1f4e('0xf')](_0x1f4e('0x10'),_0x285245);}if(channels[_0x285245[_0x1f4e('0x11')]]){delete channels[_0x285245[_0x1f4e('0x11')]];}}exports[_0x1f4e('0x12')]=function(_0x36f710){try{utils['debug'](util[_0x1f4e('0x5')](_0x1f4e('0x13'),_0x36f710['uniqueid']),_0x36f710);if(_0x36f710[_0x1f4e('0x11')]==_0x36f710[_0x1f4e('0x14')]&&_0x36f710['channel']!='OutgoingSpoolFailed'){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x15'),_0x36f710[_0x1f4e('0x11')],_0x36f710[_0x1f4e('0x16')],_0x36f710[_0x1f4e('0x17')]));channels[_0x36f710[_0x1f4e('0x11')]]={'uniqueid':_0x36f710[_0x1f4e('0x11')],'accountcode':_0x36f710[_0x1f4e('0xc')],'source':_0x36f710[_0x1f4e('0x18')],'destination':_0x36f710[_0x1f4e('0x17')],'destinationcontext':_0x36f710['context'],'channel':_0x36f710[_0x1f4e('0x6')],'starttime':utils[_0x1f4e('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1f4e('0x3'),'amaflags':_0x1f4e('0x1a')};}}catch(_0x3abe5a){utils[_0x1f4e('0x1b')](util[_0x1f4e('0x5')](_0x1f4e('0x13'),_0x36f710[_0x1f4e('0x11')]),_0x3abe5a);}};exports['newstate']=function(_0x202ed9){try{utils[_0x1f4e('0x1c')](util[_0x1f4e('0x5')]('[%s][calls][newstate]',_0x202ed9['uniqueid']),_0x202ed9);if(!_['isNil'](channels[_0x202ed9[_0x1f4e('0x11')]])&&_0x202ed9['channelstate']==0x6){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x202ed9[_0x1f4e('0x11')],_0x202ed9[_0x1f4e('0x16')],_0x202ed9[_0x1f4e('0x6')]));if(_[_0x1f4e('0x1d')](channels[_0x202ed9[_0x1f4e('0x11')]]['systemanswertime'])){channels[_0x202ed9[_0x1f4e('0x11')]]['systemanswertime']=utils['now']();}}else if(!_[_0x1f4e('0x1d')](channels[_0x202ed9[_0x1f4e('0x14')]])&&_0x202ed9['channelstate']==0x6&&_0x202ed9[_0x1f4e('0x16')]!='transfer'){utils['info'](util[_0x1f4e('0x5')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x202ed9[_0x1f4e('0x11')],_0x202ed9[_0x1f4e('0x14')],_0x202ed9[_0x1f4e('0x16')],_0x202ed9[_0x1f4e('0x6')]));channels[_0x202ed9[_0x1f4e('0x14')]][_0x1f4e('0xc')]=_0x202ed9['accountcode'];channels[_0x202ed9['linkedid']]['destinationchannel']=_0x202ed9[_0x1f4e('0x6')];if(_[_0x1f4e('0x1d')](channels[_0x202ed9[_0x1f4e('0x14')]]['answertime'])){channels[_0x202ed9['linkedid']][_0x1f4e('0x1e')]=utils[_0x1f4e('0x19')]();}channels[_0x202ed9['linkedid']]['disposition']=dispositions[_['toNumber'](_0x202ed9['channelstate'])]||_0x1f4e('0x1f');}}catch(_0x133124){utils[_0x1f4e('0x1b')](util[_0x1f4e('0x5')]('[%s][calls][newstate]',_0x202ed9[_0x1f4e('0x11')]),_0x133124);}};exports['hangup']=function(_0x11da18){try{if(!_[_0x1f4e('0x1d')](channels[_0x11da18[_0x1f4e('0x11')]])){utils[_0x1f4e('0x1c')](util[_0x1f4e('0x5')](_0x1f4e('0x20'),_0x11da18[_0x1f4e('0x11')]),_0x11da18);if(_[_0x1f4e('0x1d')](channels[_0x11da18['uniqueid']][_0x1f4e('0x21')])){channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x21')]=_0x11da18['calleridname']+'\x20<'+_0x11da18['calleridnum']+'>';}utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x11da18[_0x1f4e('0x11')],channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x21')],_0x11da18['cause-txt']));channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x22')]=utils[_0x1f4e('0x19')]();channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x23')]=utils[_0x1f4e('0x24')](channels[_0x11da18['uniqueid']]['endtime'],channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x25')]);channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x26')]=channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x1e')]?utils['diffTime'](channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x22')],channels[_0x11da18[_0x1f4e('0x11')]][_0x1f4e('0x1e')]):0x0;writeDB(channels[_0x11da18[_0x1f4e('0x11')]]);}}catch(_0x5316b5){utils[_0x1f4e('0x1b')](util['format'](_0x1f4e('0x20'),_0x11da18['uniqueid']),_0x5316b5);}};exports['attendedtransfer']=function(_0x5d9030){try{if(!_[_0x1f4e('0x1d')](channels[_0x5d9030['localtwolinkedid']])){utils[_0x1f4e('0x1c')](util['format'](_0x1f4e('0x27'),_0x5d9030[_0x1f4e('0x28')]),_0x5d9030);if(channels[_0x5d9030[_0x1f4e('0x29')]][_0x1f4e('0x6')]==_0x5d9030['transfereechannel']){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x2a'),_0x5d9030['origtransfereruniqueid'],_0x5d9030[_0x1f4e('0x29')],_0x5d9030[_0x1f4e('0x2b')]));channels[_0x5d9030['localtwolinkedid']][_0x1f4e('0x2c')]=_0x5d9030['secondtransfererchannel'];channels[_0x5d9030['localtwolinkedid']][_0x1f4e('0x2d')]=_0x1f4e('0x2e');}else if(channels[_0x5d9030['localtwolinkedid']][_0x1f4e('0x6')]=_0x5d9030[_0x1f4e('0x2f')]){utils['info'](util[_0x1f4e('0x5')](_0x1f4e('0x2a'),_0x5d9030[_0x1f4e('0x28')],_0x5d9030['localtwolinkedid'],_0x5d9030[_0x1f4e('0x30')]));channels[_0x5d9030[_0x1f4e('0x29')]][_0x1f4e('0x2c')]=_0x5d9030[_0x1f4e('0x30')];channels[_0x5d9030['localtwolinkedid']][_0x1f4e('0x2d')]=_0x1f4e('0x2e');}}}catch(_0x4cfafb){utils[_0x1f4e('0x1b')](util[_0x1f4e('0x5')](_0x1f4e('0x27'),_0x5d9030[_0x1f4e('0x28')]),_0x4cfafb);}};exports[_0x1f4e('0x31')]=function(_0x244f0f){try{if(!_[_0x1f4e('0x1d')](channels[_0x244f0f['uniqueid']])){utils['debug'](util[_0x1f4e('0x5')](_0x1f4e('0x32'),_0x244f0f[_0x1f4e('0x11')]),_0x244f0f);channels[_0x244f0f[_0x1f4e('0x11')]][_0x1f4e('0x33')]=utils[_0x1f4e('0x19')]();utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x34'),_0x244f0f['uniqueid'],channels[_0x244f0f['uniqueid']]['musiconholdstartAt']));}}catch(_0x5bcae0){utils['error'](util[_0x1f4e('0x5')](_0x1f4e('0x32'),_0x244f0f[_0x1f4e('0x11')]),_0x5bcae0);}};exports['musiconholdstop']=function(_0x53ca53){try{if(!_[_0x1f4e('0x1d')](channels[_0x53ca53[_0x1f4e('0x11')]])){utils[_0x1f4e('0x1c')](util['format'](_0x1f4e('0x35'),_0x53ca53[_0x1f4e('0x11')]),_0x53ca53);if(!_[_0x1f4e('0x1d')](channels[_0x53ca53['uniqueid']][_0x1f4e('0x33')])){channels[_0x53ca53[_0x1f4e('0x11')]][_0x1f4e('0x36')]+=utils[_0x1f4e('0x24')](utils['now'](),channels[_0x53ca53[_0x1f4e('0x11')]]['musiconholdstartAt']);utils['info'](util[_0x1f4e('0x5')](_0x1f4e('0x37'),_0x53ca53[_0x1f4e('0x11')],channels[_0x53ca53[_0x1f4e('0x11')]][_0x1f4e('0x36')]));delete channels[_0x53ca53[_0x1f4e('0x11')]]['musiconholdstartAt'];}}}catch(_0x3bfe6d){utils[_0x1f4e('0x1b')](util['format'](_0x1f4e('0x35'),_0x53ca53[_0x1f4e('0x11')]),_0x3bfe6d);}};exports[_0x1f4e('0x38')]=function(_0x1ae638){try{if(!_['isNil'](channels[_0x1ae638[_0x1f4e('0x11')]])){utils['debug'](util[_0x1f4e('0x5')](_0x1f4e('0x39'),_0x1ae638[_0x1f4e('0x11')]),_0x1ae638);if(!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')]['xmd-originatecalleridnum'])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x3b'),_0x1ae638['uniqueid'],_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x3d')]=_0x1ae638[_0x1f4e('0x3c')];}if(!_[_0x1f4e('0x1d')](_0x1ae638['variable'][_0x1f4e('0x3e')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1ae638[_0x1f4e('0x11')],_0x1ae638['value']));channels[_0x1ae638['uniqueid']][_0x1f4e('0x3f')]=_0x1ae638['value'];channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x21')]='\x22'+_0x1ae638[_0x1f4e('0x3c')]+_0x1f4e('0x40')+_0x1ae638['value']+'>';}if(!_[_0x1f4e('0x1d')](_0x1ae638['variable']['xmd-callerid-preview'])||!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x41')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x42'),_0x1ae638['uniqueid'],!_['isNil'](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x43')])?_0x1f4e('0x43'):'xmd-callerid',_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638['uniqueid']][_0x1f4e('0x21')]=_0x1ae638['value'];}if(!_[_0x1f4e('0x1d')](_0x1ae638['variable']['xmd-queue'])||!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')]['xmcs-queue'])){utils['info'](util['format'](_0x1f4e('0x42'),_0x1ae638[_0x1f4e('0x11')],!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x44')])?_0x1f4e('0x44'):_0x1f4e('0x45'),_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x46')]=_0x1f4e('0x47');channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x48')]=_0x1ae638['value'];channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x7')]=!![];}if(!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x49')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x4a'),_0x1ae638[_0x1f4e('0x11')],_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638['uniqueid']]['ContactId']=_0x1ae638[_0x1f4e('0x3c')];}if(!_[_0x1f4e('0x1d')](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x4b')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x4c'),_0x1ae638['uniqueid'],_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638['uniqueid']]['type']=_0x1ae638['value'];}if(!_['isNil'](_0x1ae638[_0x1f4e('0x3a')][_0x1f4e('0x4d')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x4e'),_0x1ae638[_0x1f4e('0x11')],_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638['uniqueid']][_0x1f4e('0x4f')]=_0x1ae638[_0x1f4e('0x3c')];}if(!_['isNil'](_0x1ae638['variable'][_0x1f4e('0x50')])){utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x51'),_0x1ae638[_0x1f4e('0x11')],_0x1ae638[_0x1f4e('0x3c')]));channels[_0x1ae638[_0x1f4e('0x11')]][_0x1f4e('0x50')]=_0x1ae638['value'];}}}catch(_0x418d97){utils[_0x1f4e('0x1b')](util[_0x1f4e('0x5')](_0x1f4e('0x39'),_0x1ae638['uniqueid']),_0x418d97);}};exports['newexten']=function(_0xc8c7c){try{if(!_[_0x1f4e('0x1d')](channels[_0xc8c7c[_0x1f4e('0x11')]])){utils[_0x1f4e('0x1c')](util[_0x1f4e('0x5')](_0x1f4e('0x52'),_0xc8c7c[_0x1f4e('0x11')]),_0xc8c7c);utils[_0x1f4e('0x4')](util[_0x1f4e('0x5')](_0x1f4e('0x53'),_0xc8c7c[_0x1f4e('0x11')],_0xc8c7c[_0x1f4e('0x54')],_0xc8c7c[_0x1f4e('0x55')]));if(_0xc8c7c[_0x1f4e('0x54')][_0x1f4e('0x56')]()==_0x1f4e('0x57')&&_['startsWith'](_0xc8c7c[_0x1f4e('0x55')][_0x1f4e('0x56')](),_0x1f4e('0x58'))){var _0xf1ef88=_0xc8c7c[_0x1f4e('0x55')][_0x1f4e('0x59')]('=');var _0x38bdb0=_0xf1ef88[0x0][_0x1f4e('0x5a')](_0xf1ef88[0x0][_0x1f4e('0x5b')]('(')+0x1,_0xf1ef88[0x0]['lastIndexOf'](')'));var _0x409435=_0xf1ef88[0x1];channels[_0xc8c7c[_0x1f4e('0x11')]][_0x38bdb0]=_0x409435;}if(!_[_0x1f4e('0x5c')](['hangup',_0x1f4e('0x5d'),_0x1f4e('0x5e'),_0x1f4e('0x57'),_0x1f4e('0x5f')],_0xc8c7c[_0x1f4e('0x54')]['toLowerCase']())){channels[_0xc8c7c[_0x1f4e('0x11')]][_0x1f4e('0x46')]=_0xc8c7c[_0x1f4e('0x54')];channels[_0xc8c7c[_0x1f4e('0x11')]][_0x1f4e('0x48')]=_0xc8c7c[_0x1f4e('0x55')];}}}catch(_0xaeb00){utils[_0x1f4e('0x1b')](util[_0x1f4e('0x5')](_0x1f4e('0x52'),_0xc8c7c[_0x1f4e('0x11')]),_0xaeb00);}}; \ No newline at end of file +var _0xc561=['includes','execif','util','FAILED','NO\x20ANSWER','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','uniqueid','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf'];(function(_0x5b5f4d,_0x34538e){var _0x5c1525=function(_0x339ba5){while(--_0x339ba5){_0x5b5f4d['push'](_0x5b5f4d['shift']());}};_0x5c1525(++_0x34538e);}(_0xc561,0x131));var _0x1c56=function(_0x330740,_0x58c0c0){_0x330740=_0x330740-0x0;var _0x1cb5f2=_0xc561[_0x330740];return _0x1cb5f2;};'use strict';var _=require('lodash');var util=require(_0x1c56('0x0'));var utils=require('./utils');var dispositions=['NO\x20ANSWER','FAILED',_0x1c56('0x1'),_0x1c56('0x2'),_0x1c56('0x2'),'NO\x20ANSWER',_0x1c56('0x3'),'BUSY',_0x1c56('0x1'),_0x1c56('0x1'),_0x1c56('0x1')];var channels={};function writeDB(_0x293f28){utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x6'),_0x293f28['uniqueid'],_0x293f28[_0x1c56('0x7')],_0x293f28[_0x1c56('0x8')],_0x293f28['membername'],_0x293f28[_0x1c56('0x9')],_0x293f28['calleridnum'],_0x293f28['connectedlinenum'],_0x293f28[_0x1c56('0xa')]));if(_0x293f28[_0x1c56('0xb')]){utils['getUserByInternal'](_0x293f28['accountcode'])[_0x1c56('0xc')](function(_0x445056){if(_0x445056){_0x293f28[_0x1c56('0xd')]=_0x445056['id'];}utils[_0x1c56('0xe')](_0x1c56('0xf'),_0x293f28);});}else{utils[_0x1c56('0xe')]('CreateVoiceCallReport',_0x293f28);}if(channels[_0x293f28['uniqueid']]){delete channels[_0x293f28['uniqueid']];}}exports[_0x1c56('0x10')]=function(_0x261616){try{utils[_0x1c56('0x11')](util[_0x1c56('0x5')]('[%s][calls][newchannel]',_0x261616['uniqueid']),_0x261616);if(_0x261616[_0x1c56('0x12')]==_0x261616[_0x1c56('0x13')]&&_0x261616[_0x1c56('0x7')]!=_0x1c56('0x14')){utils['info'](util[_0x1c56('0x5')](_0x1c56('0x15'),_0x261616[_0x1c56('0x12')],_0x261616[_0x1c56('0x16')],_0x261616[_0x1c56('0x17')]));channels[_0x261616['uniqueid']]={'uniqueid':_0x261616[_0x1c56('0x12')],'accountcode':_0x261616[_0x1c56('0xb')],'source':_0x261616['calleridnum'],'destination':_0x261616[_0x1c56('0x17')],'destinationcontext':_0x261616[_0x1c56('0x16')],'channel':_0x261616['channel'],'starttime':utils[_0x1c56('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1c56('0x2'),'amaflags':_0x1c56('0x19')};}}catch(_0x18985f){utils[_0x1c56('0x1a')](util[_0x1c56('0x5')]('[%s][calls][newchannel]',_0x261616['uniqueid']),_0x18985f);}};exports[_0x1c56('0x1b')]=function(_0xd6cdd3){try{utils[_0x1c56('0x11')](util[_0x1c56('0x5')](_0x1c56('0x1c'),_0xd6cdd3[_0x1c56('0x12')]),_0xd6cdd3);if(!_['isNil'](channels[_0xd6cdd3[_0x1c56('0x12')]])&&_0xd6cdd3[_0x1c56('0x1d')]==0x6){utils[_0x1c56('0x4')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xd6cdd3['uniqueid'],_0xd6cdd3[_0x1c56('0x16')],_0xd6cdd3[_0x1c56('0x7')]));if(_[_0x1c56('0x1e')](channels[_0xd6cdd3['uniqueid']][_0x1c56('0x1f')])){channels[_0xd6cdd3[_0x1c56('0x12')]]['systemanswertime']=utils[_0x1c56('0x18')]();}}else if(!_[_0x1c56('0x1e')](channels[_0xd6cdd3['linkedid']])&&_0xd6cdd3['channelstate']==0x6&&_0xd6cdd3[_0x1c56('0x16')]!=_0x1c56('0x20')){utils['info'](util[_0x1c56('0x5')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xd6cdd3[_0x1c56('0x12')],_0xd6cdd3[_0x1c56('0x13')],_0xd6cdd3[_0x1c56('0x16')],_0xd6cdd3['channel']));channels[_0xd6cdd3[_0x1c56('0x13')]][_0x1c56('0xb')]=_0xd6cdd3[_0x1c56('0xb')];channels[_0xd6cdd3['linkedid']]['destinationchannel']=_0xd6cdd3['channel'];if(_[_0x1c56('0x1e')](channels[_0xd6cdd3[_0x1c56('0x13')]]['answertime'])){channels[_0xd6cdd3['linkedid']][_0x1c56('0x21')]=utils['now']();}channels[_0xd6cdd3['linkedid']]['disposition']=dispositions[_[_0x1c56('0x22')](_0xd6cdd3[_0x1c56('0x1d')])]||'ANSWERED';}}catch(_0x20626f){utils[_0x1c56('0x1a')](util['format'](_0x1c56('0x1c'),_0xd6cdd3[_0x1c56('0x12')]),_0x20626f);}};exports[_0x1c56('0x23')]=function(_0x431ee8){try{if(!_['isNil'](channels[_0x431ee8[_0x1c56('0x12')]])){utils['debug'](util['format'](_0x1c56('0x24'),_0x431ee8[_0x1c56('0x12')]),_0x431ee8);if(_[_0x1c56('0x1e')](channels[_0x431ee8[_0x1c56('0x12')]][_0x1c56('0x25')])){channels[_0x431ee8[_0x1c56('0x12')]][_0x1c56('0x25')]=_0x431ee8[_0x1c56('0x26')]+'\x20<'+_0x431ee8[_0x1c56('0x27')]+'>';}utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x28'),_0x431ee8[_0x1c56('0x12')],channels[_0x431ee8[_0x1c56('0x12')]]['callerid'],_0x431ee8[_0x1c56('0x29')]));channels[_0x431ee8['uniqueid']]['endtime']=utils['now']();channels[_0x431ee8[_0x1c56('0x12')]]['duration']=utils['diffTime'](channels[_0x431ee8[_0x1c56('0x12')]][_0x1c56('0x2a')],channels[_0x431ee8[_0x1c56('0x12')]]['starttime']);channels[_0x431ee8[_0x1c56('0x12')]][_0x1c56('0x2b')]=channels[_0x431ee8[_0x1c56('0x12')]]['answertime']?utils[_0x1c56('0x2c')](channels[_0x431ee8['uniqueid']]['endtime'],channels[_0x431ee8['uniqueid']]['answertime']):0x0;writeDB(channels[_0x431ee8[_0x1c56('0x12')]]);}}catch(_0x17ed4b){utils[_0x1c56('0x1a')](util[_0x1c56('0x5')]('[%s][calls][hangup]',_0x431ee8[_0x1c56('0x12')]),_0x17ed4b);}};exports[_0x1c56('0x2d')]=function(_0x321f29){try{if(!_[_0x1c56('0x1e')](channels[_0x321f29[_0x1c56('0x2e')]])){utils[_0x1c56('0x11')](util[_0x1c56('0x5')]('[%s][calls][attendedtransfer]',_0x321f29[_0x1c56('0x2f')]),_0x321f29);if(channels[_0x321f29['localtwolinkedid']][_0x1c56('0x7')]==_0x321f29[_0x1c56('0x30')]){utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x31'),_0x321f29[_0x1c56('0x2f')],_0x321f29[_0x1c56('0x2e')],_0x321f29['secondtransfererchannel']));channels[_0x321f29['localtwolinkedid']][_0x1c56('0x32')]=_0x321f29[_0x1c56('0x33')];channels[_0x321f29[_0x1c56('0x2e')]][_0x1c56('0x34')]=_0x1c56('0x35');}else if(channels[_0x321f29[_0x1c56('0x2e')]]['channel']=_0x321f29[_0x1c56('0x36')]){utils[_0x1c56('0x4')](util['format'](_0x1c56('0x31'),_0x321f29[_0x1c56('0x2f')],_0x321f29[_0x1c56('0x2e')],_0x321f29[_0x1c56('0x37')]));channels[_0x321f29['localtwolinkedid']][_0x1c56('0x32')]=_0x321f29[_0x1c56('0x37')];channels[_0x321f29['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x5387fd){utils[_0x1c56('0x1a')](util[_0x1c56('0x5')]('[%s][calls][attendedtransfer]',_0x321f29[_0x1c56('0x2f')]),_0x5387fd);}};exports[_0x1c56('0x38')]=function(_0x1ef557){try{if(!_[_0x1c56('0x1e')](channels[_0x1ef557[_0x1c56('0x12')]])){utils[_0x1c56('0x11')](util[_0x1c56('0x5')](_0x1c56('0x39'),_0x1ef557[_0x1c56('0x12')]),_0x1ef557);channels[_0x1ef557[_0x1c56('0x12')]][_0x1c56('0x3a')]=utils[_0x1c56('0x18')]();utils[_0x1c56('0x4')](util[_0x1c56('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1ef557[_0x1c56('0x12')],channels[_0x1ef557[_0x1c56('0x12')]][_0x1c56('0x3a')]));}}catch(_0x4a6457){utils[_0x1c56('0x1a')](util[_0x1c56('0x5')](_0x1c56('0x39'),_0x1ef557[_0x1c56('0x12')]),_0x4a6457);}};exports[_0x1c56('0x3b')]=function(_0x592b85){try{if(!_['isNil'](channels[_0x592b85[_0x1c56('0x12')]])){utils[_0x1c56('0x11')](util[_0x1c56('0x5')](_0x1c56('0x3c'),_0x592b85[_0x1c56('0x12')]),_0x592b85);if(!_[_0x1c56('0x1e')](channels[_0x592b85[_0x1c56('0x12')]][_0x1c56('0x3a')])){channels[_0x592b85['uniqueid']][_0x1c56('0x3d')]+=utils[_0x1c56('0x2c')](utils[_0x1c56('0x18')](),channels[_0x592b85[_0x1c56('0x12')]][_0x1c56('0x3a')]);utils[_0x1c56('0x4')](util[_0x1c56('0x5')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x592b85[_0x1c56('0x12')],channels[_0x592b85['uniqueid']]['mohtime']));delete channels[_0x592b85['uniqueid']][_0x1c56('0x3a')];}}}catch(_0xcf8d46){utils[_0x1c56('0x1a')](util['format'](_0x1c56('0x3c'),_0x592b85[_0x1c56('0x12')]),_0xcf8d46);}};exports[_0x1c56('0x3e')]=function(_0x2278e5){try{if(!_[_0x1c56('0x1e')](channels[_0x2278e5[_0x1c56('0x12')]])){utils[_0x1c56('0x11')](util['format'](_0x1c56('0x3f'),_0x2278e5[_0x1c56('0x12')]),_0x2278e5);if(!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')][_0x1c56('0x41')])){utils['info'](util[_0x1c56('0x5')](_0x1c56('0x42'),_0x2278e5['uniqueid'],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5['uniqueid']]['source']=_0x2278e5[_0x1c56('0x43')];}if(!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')][_0x1c56('0x44')])){utils[_0x1c56('0x4')](util['format'](_0x1c56('0x45'),_0x2278e5[_0x1c56('0x12')],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x46')]=_0x2278e5[_0x1c56('0x43')];channels[_0x2278e5['uniqueid']]['callerid']='\x22'+_0x2278e5['value']+_0x1c56('0x47')+_0x2278e5[_0x1c56('0x43')]+'>';}if(!_[_0x1c56('0x1e')](_0x2278e5['variable'][_0x1c56('0x48')])||!_[_0x1c56('0x1e')](_0x2278e5['variable']['xmd-callerid'])){utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x49'),_0x2278e5[_0x1c56('0x12')],!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')][_0x1c56('0x48')])?_0x1c56('0x48'):_0x1c56('0x4a'),_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x25')]=_0x2278e5['value'];}if(!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')]['xmd-queue'])||!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')][_0x1c56('0x4b')])){utils[_0x1c56('0x4')](util['format'](_0x1c56('0x49'),_0x2278e5[_0x1c56('0x12')],!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')][_0x1c56('0x4c')])?_0x1c56('0x4c'):_0x1c56('0x4b'),_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x4d')]=_0x1c56('0x4e');channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x4f')]=_0x2278e5[_0x1c56('0x43')];channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x8')]=!![];}if(!_[_0x1c56('0x1e')](_0x2278e5['variable'][_0x1c56('0x50')])){utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x51'),_0x2278e5[_0x1c56('0x12')],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x52')]=_0x2278e5[_0x1c56('0x43')];}if(!_[_0x1c56('0x1e')](_0x2278e5['variable'][_0x1c56('0x53')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2278e5['uniqueid'],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x54')]=_0x2278e5[_0x1c56('0x43')];}if(!_[_0x1c56('0x1e')](_0x2278e5[_0x1c56('0x40')]['outboundrouteid'])){utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x55'),_0x2278e5[_0x1c56('0x12')],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x56')]=_0x2278e5['value'];}if(!_['isNil'](_0x2278e5[_0x1c56('0x40')]['sipcallid'])){utils[_0x1c56('0x4')](util['format'](_0x1c56('0x57'),_0x2278e5['uniqueid'],_0x2278e5[_0x1c56('0x43')]));channels[_0x2278e5[_0x1c56('0x12')]][_0x1c56('0x58')]=_0x2278e5[_0x1c56('0x43')];}}}catch(_0x54abfc){utils[_0x1c56('0x1a')](util[_0x1c56('0x5')](_0x1c56('0x3f'),_0x2278e5['uniqueid']),_0x54abfc);}};exports['newexten']=function(_0x15128f){try{if(!_[_0x1c56('0x1e')](channels[_0x15128f[_0x1c56('0x12')]])){utils[_0x1c56('0x11')](util[_0x1c56('0x5')](_0x1c56('0x59'),_0x15128f[_0x1c56('0x12')]),_0x15128f);utils[_0x1c56('0x4')](util[_0x1c56('0x5')](_0x1c56('0x5a'),_0x15128f[_0x1c56('0x12')],_0x15128f['application'],_0x15128f[_0x1c56('0x5b')]));if(_0x15128f[_0x1c56('0x5c')][_0x1c56('0x5d')]()==_0x1c56('0x5e')&&_[_0x1c56('0x5f')](_0x15128f['appdata'][_0x1c56('0x5d')](),_0x1c56('0x60'))){var _0x433ff7=_0x15128f[_0x1c56('0x5b')]['split']('=');var _0x17cb49=_0x433ff7[0x0][_0x1c56('0x61')](_0x433ff7[0x0]['lastIndexOf']('(')+0x1,_0x433ff7[0x0][_0x1c56('0x62')](')'));var _0x519beb=_0x433ff7[0x1];channels[_0x15128f[_0x1c56('0x12')]][_0x17cb49]=_0x519beb;}if(!_[_0x1c56('0x63')]([_0x1c56('0x23'),'noop',_0x1c56('0x64'),'set','gotoif'],_0x15128f[_0x1c56('0x5c')]['toLowerCase']())){channels[_0x15128f[_0x1c56('0x12')]][_0x1c56('0x4d')]=_0x15128f['application'];channels[_0x15128f[_0x1c56('0x12')]]['lastdata']=_0x15128f['appdata'];}}}catch(_0x52c41f){utils['error'](util['format'](_0x1c56('0x59'),_0x15128f[_0x1c56('0x12')]),_0x52c41f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 69e410a..cfe20a8 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 _0x920f=['close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error'];(function(_0x541208,_0x46be27){var _0x1b062a=function(_0x50b25e){while(--_0x50b25e){_0x541208['push'](_0x541208['shift']());}};_0x1b062a(++_0x46be27);}(_0x920f,0xd4));var _0xf920=function(_0x27d634,_0x3f6bf7){_0x27d634=_0x27d634-0x0;var _0xbcf62=_0x920f[_0x27d634];return _0xbcf62;};'use strict';var utils=require(_0xf920('0x0'));exports['connect']=function(){utils[_0xf920('0x1')](_0xf920('0x2'));};exports[_0xf920('0x3')]=function(){utils[_0xf920('0x1')](_0xf920('0x4'));};exports[_0xf920('0x5')]=function(){utils[_0xf920('0x1')](_0xf920('0x6'));};exports['error']=function(_0x2ba7c7){utils['error'](_0xf920('0x7'),_0x2ba7c7);};exports[_0xf920('0x8')]=function(){utils[_0xf920('0x1')]('[core]\x20close');};exports[_0xf920('0x9')]=function(_0x313540){}; \ No newline at end of file +var _0x3750=['close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x17bfa3,_0x587541){var _0xe7c00f=function(_0x1eacd6){while(--_0x1eacd6){_0x17bfa3['push'](_0x17bfa3['shift']());}};_0xe7c00f(++_0x587541);}(_0x3750,0x152));var _0x0375=function(_0x4fabbe,_0xc514f3){_0x4fabbe=_0x4fabbe-0x0;var _0x5510dd=_0x3750[_0x4fabbe];return _0x5510dd;};'use strict';var utils=require(_0x0375('0x0'));exports[_0x0375('0x1')]=function(){utils[_0x0375('0x2')](_0x0375('0x3'));};exports[_0x0375('0x4')]=function(){utils[_0x0375('0x2')](_0x0375('0x5'));};exports[_0x0375('0x6')]=function(){utils[_0x0375('0x2')](_0x0375('0x7'));};exports[_0x0375('0x8')]=function(_0xea37d0){utils[_0x0375('0x8')](_0x0375('0x9'),_0xea37d0);};exports[_0x0375('0xa')]=function(){utils['info'](_0x0375('0xb'));};exports['managerevent']=function(_0x4f733c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 174d26d..0b01e8b 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 _0x72ce=['diffTime','endtime','holdtime','billableseconds','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','cdr(routeid)','split','varset','debug','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','now','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','isNil','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0x72ce,0xdc));var _0xe72c=function(_0x51e7,_0x48ce59){_0x51e7=_0x51e7-0x0;var _0x3f430a=_0x72ce[_0x51e7];return _0x3f430a;};'use strict';var _=require(_0xe72c('0x0'));var util=require(_0xe72c('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x12e117){utils[_0xe72c('0x2')](util['format'](_0xe72c('0x3'),_0x12e117[_0xe72c('0x4')],_0x12e117[_0xe72c('0x5')],_0x12e117[_0xe72c('0x6')],_0x12e117[_0xe72c('0x7')],_0x12e117[_0xe72c('0x8')],_0x12e117[_0xe72c('0x9')]));utils[_0xe72c('0xa')](_0xe72c('0xb'),_0x12e117);delete dials[_0x12e117['uniqueid']];}exports['newexten']=function(_0x5c6251){try{utils['debug'](util[_0xe72c('0xc')](_0xe72c('0xd'),_0x5c6251[_0xe72c('0x4')]),_0x5c6251);utils[_0xe72c('0x2')](util[_0xe72c('0xc')](_0xe72c('0xe'),_0x5c6251[_0xe72c('0x4')],_0x5c6251[_0xe72c('0xf')],_0x5c6251[_0xe72c('0x10')]));if(_0x5c6251[_0xe72c('0xf')]['toLowerCase']()==_0xe72c('0x11')&&_['startsWith'](_0x5c6251[_0xe72c('0x10')]['toLowerCase'](),_0xe72c('0x12'))){var _0x56505a=_0x5c6251[_0xe72c('0x10')][_0xe72c('0x13')]('=');dials[_0x5c6251[_0xe72c('0x4')]]={'routeId':_0x56505a[0x1]};}}catch(_0x490074){utils['error'](util['format'](_0xe72c('0xd'),_0x5c6251['uniqueid']),_0x490074);}};exports[_0xe72c('0x14')]=function(_0xdc84a2){try{utils[_0xe72c('0x15')](util[_0xe72c('0xc')]('[%s][dials][varset]',_0xdc84a2[_0xe72c('0x4')]),_0xdc84a2);if(!_['isNil'](_0xdc84a2[_0xe72c('0x16')][_0xe72c('0x17')])){utils[_0xe72c('0x2')](util['format'](_0xe72c('0x18'),_0xdc84a2[_0xe72c('0x4')],_0xdc84a2['value']));dials[_0xdc84a2[_0xe72c('0x4')]]={'routeId':_0xdc84a2[_0xe72c('0x19')]};}}catch(_0xc1b38d){utils[_0xe72c('0x1a')](util['format'](_0xe72c('0x1b'),_0xdc84a2[_0xe72c('0x4')]),_0xc1b38d);}};exports[_0xe72c('0x1c')]=function(_0x4a3516){try{if(!_['isNil'](dials[_0x4a3516[_0xe72c('0x4')]])){utils['debug'](util[_0xe72c('0xc')]('[%s][dials][dialbegin]',_0x4a3516[_0xe72c('0x4')]),_0x4a3516);dials[_0x4a3516[_0xe72c('0x4')]]=_['assign'](dials[_0x4a3516[_0xe72c('0x4')]],_0x4a3516);dials[_0x4a3516[_0xe72c('0x4')]]['starttime']=utils['now']();dials[_0x4a3516[_0xe72c('0x4')]][_0xe72c('0x1d')]=_0xe72c('0x1e');utils[_0xe72c('0x2')](util[_0xe72c('0xc')](_0xe72c('0x1f'),_0x4a3516['uniqueid'],dials[_0x4a3516['uniqueid']][_0xe72c('0x20')]));}}catch(_0x31b7d5){utils[_0xe72c('0x1a')](util['format'](_0xe72c('0x21'),_0x4a3516[_0xe72c('0x4')]),_0x31b7d5);}};exports[_0xe72c('0x22')]=function(_0x5c01f4){try{if(!_['isNil'](dials[_0x5c01f4[_0xe72c('0x4')]])){utils[_0xe72c('0x15')](util[_0xe72c('0xc')](_0xe72c('0x23'),_0x5c01f4[_0xe72c('0x4')]),_0x5c01f4);dials[_0x5c01f4[_0xe72c('0x4')]][_0xe72c('0x9')]=_0x5c01f4[_0xe72c('0x9')];if(_0x5c01f4[_0xe72c('0x9')]==_0xe72c('0x24')){dials[_0x5c01f4['uniqueid']]=_[_0xe72c('0x25')](dials[_0x5c01f4[_0xe72c('0x4')]],_0x5c01f4);dials[_0x5c01f4[_0xe72c('0x4')]][_0xe72c('0x26')]=utils[_0xe72c('0x27')]();dials[_0x5c01f4['uniqueid']][_0xe72c('0x1d')]='connect';utils[_0xe72c('0x2')](util['format'](_0xe72c('0x28'),_0x5c01f4[_0xe72c('0x4')],_0x5c01f4[_0xe72c('0x9')],dials[_0x5c01f4[_0xe72c('0x4')]][_0xe72c('0x26')]));}else{utils[_0xe72c('0x2')](util['format'](_0xe72c('0x29'),_0x5c01f4[_0xe72c('0x4')],_0x5c01f4[_0xe72c('0x9')]));}}}catch(_0x554154){utils[_0xe72c('0x1a')](util[_0xe72c('0xc')]('[%s][dials][dialend]',_0x5c01f4[_0xe72c('0x4')]),_0x554154);}};exports[_0xe72c('0x2a')]=function(_0x2d1458){try{if(!_[_0xe72c('0x2b')](dials[_0x2d1458[_0xe72c('0x4')]])){utils['debug'](util[_0xe72c('0xc')](_0xe72c('0x2c'),_0x2d1458[_0xe72c('0x4')]),_0x2d1458);utils[_0xe72c('0x2')](util[_0xe72c('0xc')](_0xe72c('0x2d'),_0x2d1458[_0xe72c('0x4')],_0x2d1458['calleridnum'],_0x2d1458[_0xe72c('0x2e')],_0x2d1458[_0xe72c('0x2f')]));dials[_0x2d1458[_0xe72c('0x4')]]=_[_0xe72c('0x25')](dials[_0x2d1458[_0xe72c('0x4')]],{'endtime':utils[_0xe72c('0x27')](),'lastevent':_0xe72c('0x30')});dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x31')]=utils[_0xe72c('0x32')](dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x33')],dials[_0x2d1458[_0xe72c('0x4')]]['starttime']);dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x34')]=utils['diffTime'](dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x26')]||dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x33')],dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x20')]);dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x35')]=dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x26')]?utils[_0xe72c('0x32')](dials[_0x2d1458[_0xe72c('0x4')]][_0xe72c('0x33')],dials[_0x2d1458['uniqueid']][_0xe72c('0x26')]):0x0;writeDB(dials[_0x2d1458['uniqueid']]);}}catch(_0x2d4b16){utils[_0xe72c('0x1a')](util[_0xe72c('0xc')](_0xe72c('0x2c'),_0x2d1458[_0xe72c('0x4')]),_0x2d4b16);}}; \ No newline at end of file +var _0x7054=['uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','[%s][dials][varset]','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','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','answertime','[%s][dials][hangup]','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport'];(function(_0x168478,_0x323a27){var _0x29c2f8=function(_0x4f7a8a){while(--_0x4f7a8a){_0x168478['push'](_0x168478['shift']());}};_0x29c2f8(++_0x323a27);}(_0x7054,0x161));var _0x4705=function(_0x820bf2,_0x5c6e3a){_0x820bf2=_0x820bf2-0x0;var _0x2962c1=_0x7054[_0x820bf2];return _0x2962c1;};'use strict';var _=require(_0x4705('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x36d14b){utils[_0x4705('0x1')](util[_0x4705('0x2')](_0x4705('0x3'),_0x36d14b['uniqueid'],_0x36d14b[_0x4705('0x4')],_0x36d14b[_0x4705('0x5')],_0x36d14b[_0x4705('0x6')],_0x36d14b[_0x4705('0x7')],_0x36d14b[_0x4705('0x8')]));utils[_0x4705('0x9')](_0x4705('0xa'),_0x36d14b);delete dials[_0x36d14b[_0x4705('0xb')]];}exports[_0x4705('0xc')]=function(_0x3c3a40){try{utils[_0x4705('0xd')](util['format'](_0x4705('0xe'),_0x3c3a40['uniqueid']),_0x3c3a40);utils['info'](util[_0x4705('0x2')](_0x4705('0xf'),_0x3c3a40[_0x4705('0xb')],_0x3c3a40[_0x4705('0x10')],_0x3c3a40[_0x4705('0x11')]));if(_0x3c3a40[_0x4705('0x10')][_0x4705('0x12')]()=='set'&&_[_0x4705('0x13')](_0x3c3a40[_0x4705('0x11')]['toLowerCase'](),'cdr(routeid)')){var _0x3d6ef0=_0x3c3a40[_0x4705('0x11')][_0x4705('0x14')]('=');dials[_0x3c3a40['uniqueid']]={'routeId':_0x3d6ef0[0x1]};}}catch(_0x4ddc42){utils[_0x4705('0x15')](util[_0x4705('0x2')](_0x4705('0xe'),_0x3c3a40[_0x4705('0xb')]),_0x4ddc42);}};exports[_0x4705('0x16')]=function(_0x428b66){try{utils[_0x4705('0xd')](util[_0x4705('0x2')](_0x4705('0x17'),_0x428b66[_0x4705('0xb')]),_0x428b66);if(!_[_0x4705('0x18')](_0x428b66[_0x4705('0x19')][_0x4705('0x1a')])){utils[_0x4705('0x1')](util[_0x4705('0x2')](_0x4705('0x1b'),_0x428b66[_0x4705('0xb')],_0x428b66[_0x4705('0x1c')]));dials[_0x428b66[_0x4705('0xb')]]={'routeId':_0x428b66['value']};}}catch(_0x2658e9){utils[_0x4705('0x15')](util[_0x4705('0x2')](_0x4705('0x17'),_0x428b66['uniqueid']),_0x2658e9);}};exports[_0x4705('0x1d')]=function(_0xbbb7d1){try{if(!_[_0x4705('0x18')](dials[_0xbbb7d1[_0x4705('0xb')]])){utils[_0x4705('0xd')](util['format'](_0x4705('0x1e'),_0xbbb7d1['uniqueid']),_0xbbb7d1);dials[_0xbbb7d1['uniqueid']]=_[_0x4705('0x1f')](dials[_0xbbb7d1['uniqueid']],_0xbbb7d1);dials[_0xbbb7d1['uniqueid']][_0x4705('0x20')]=utils[_0x4705('0x21')]();dials[_0xbbb7d1[_0x4705('0xb')]][_0x4705('0x22')]=_0x4705('0x23');utils[_0x4705('0x1')](util['format'](_0x4705('0x24'),_0xbbb7d1['uniqueid'],dials[_0xbbb7d1[_0x4705('0xb')]][_0x4705('0x20')]));}}catch(_0x8f6bf7){utils[_0x4705('0x15')](util[_0x4705('0x2')](_0x4705('0x1e'),_0xbbb7d1[_0x4705('0xb')]),_0x8f6bf7);}};exports['dialend']=function(_0x3ce8f7){try{if(!_['isNil'](dials[_0x3ce8f7[_0x4705('0xb')]])){utils['debug'](util[_0x4705('0x2')](_0x4705('0x25'),_0x3ce8f7[_0x4705('0xb')]),_0x3ce8f7);dials[_0x3ce8f7[_0x4705('0xb')]]['dialstatus']=_0x3ce8f7[_0x4705('0x8')];if(_0x3ce8f7[_0x4705('0x8')]=='ANSWER'){dials[_0x3ce8f7[_0x4705('0xb')]]=_[_0x4705('0x1f')](dials[_0x3ce8f7[_0x4705('0xb')]],_0x3ce8f7);dials[_0x3ce8f7[_0x4705('0xb')]]['answertime']=utils[_0x4705('0x21')]();dials[_0x3ce8f7[_0x4705('0xb')]][_0x4705('0x22')]=_0x4705('0x26');utils['info'](util[_0x4705('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3ce8f7[_0x4705('0xb')],_0x3ce8f7['dialstatus'],dials[_0x3ce8f7[_0x4705('0xb')]]['answertime']));}else{utils[_0x4705('0x1')](util[_0x4705('0x2')](_0x4705('0x27'),_0x3ce8f7[_0x4705('0xb')],_0x3ce8f7[_0x4705('0x8')]));}}}catch(_0x59b8d0){utils[_0x4705('0x15')](util['format'](_0x4705('0x25'),_0x3ce8f7[_0x4705('0xb')]),_0x59b8d0);}};exports[_0x4705('0x28')]=function(_0x39d208){try{if(!_['isNil'](dials[_0x39d208[_0x4705('0xb')]])){utils[_0x4705('0xd')](util['format']('[%s][dials][hangup]',_0x39d208[_0x4705('0xb')]),_0x39d208);utils[_0x4705('0x1')](util[_0x4705('0x2')](_0x4705('0x29'),_0x39d208['uniqueid'],_0x39d208[_0x4705('0x6')],_0x39d208[_0x4705('0x2a')],_0x39d208[_0x4705('0x2b')]));dials[_0x39d208['uniqueid']]=_[_0x4705('0x1f')](dials[_0x39d208[_0x4705('0xb')]],{'endtime':utils[_0x4705('0x21')](),'lastevent':_0x4705('0x2c')});dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x2d')]=utils['diffTime'](dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x2e')],dials[_0x39d208['uniqueid']][_0x4705('0x20')]);dials[_0x39d208['uniqueid']][_0x4705('0x2f')]=utils[_0x4705('0x30')](dials[_0x39d208[_0x4705('0xb')]]['answertime']||dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x2e')],dials[_0x39d208['uniqueid']][_0x4705('0x20')]);dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x31')]=dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x32')]?utils[_0x4705('0x30')](dials[_0x39d208[_0x4705('0xb')]]['endtime'],dials[_0x39d208[_0x4705('0xb')]][_0x4705('0x32')]):0x0;writeDB(dials[_0x39d208[_0x4705('0xb')]]);}}catch(_0x118800){utils[_0x4705('0x15')](util[_0x4705('0x2')](_0x4705('0x33'),_0x39d208['uniqueid']),_0x118800);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 67ba3b9..e116328 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 _0xf4b8=['[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','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]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin'];(function(_0x5c6324,_0xc024b){var _0x10498f=function(_0x4ce3c4){while(--_0x4ce3c4){_0x5c6324['push'](_0x5c6324['shift']());}};_0x10498f(++_0xc024b);}(_0xf4b8,0x18a));var _0x8f4b=function(_0x359e4a,_0x4e9fcf){_0x359e4a=_0x359e4a-0x0;var _0x53a7d5=_0xf4b8[_0x359e4a];return _0x53a7d5;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8f4b('0x0'));var utils=require(_0x8f4b('0x1'));var util=require(_0x8f4b('0x2'));var isXDREnabled=config[_0x8f4b('0x3')]&&config[_0x8f4b('0x3')]['disabled']?!config[_0x8f4b('0x3')][_0x8f4b('0x4')]:!![];var isProduction=config[_0x8f4b('0x5')]===_0x8f4b('0x6')||![];var isLocalAsterisk=config[_0x8f4b('0x3')]&&config[_0x8f4b('0x3')][_0x8f4b('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x8f4b('0x8')][_0x8f4b('0x9')],config[_0x8f4b('0x8')]['ip'],config[_0x8f4b('0x8')][_0x8f4b('0xa')],config[_0x8f4b('0x8')]['password'],!![]);ami[_0x8f4b('0xb')]();if(!isXDREnabled){utils[_0x8f4b('0xc')](_0x8f4b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8f4b('0xc')](_0x8f4b('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x8f4b('0xf'));var queues=require(_0x8f4b('0x10'));var recordings=require(_0x8f4b('0x11'));var members=require(_0x8f4b('0x12'));var dials=require(_0x8f4b('0x13'));var transfers=require(_0x8f4b('0x14'));var core=require(_0x8f4b('0x15'));ami['on'](_0x8f4b('0x16'),core[_0x8f4b('0x16')]);ami['on']('shutdown',core[_0x8f4b('0x17')]);ami['on'](_0x8f4b('0x18'),core[_0x8f4b('0x18')]);ami['on'](_0x8f4b('0x19'),core['error']);ami['on'](_0x8f4b('0x1a'),core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0x8f4b('0x1b'),function(_0x59c9de){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x1e'),_0x59c9de[_0x8f4b('0x1f')]),_0x59c9de);members[_0x8f4b('0x1b')](_0x59c9de);}catch(_0x50684a){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x1e'),_0x59c9de[_0x8f4b('0x1f')]),_0x50684a);}});ami['on'](_0x8f4b('0x20'),function(_0x490bbb){try{utils['debug'](util['format']('[%s][index][agentcalled]',_0x490bbb[_0x8f4b('0x21')]),_0x490bbb);agents[_0x8f4b('0x20')](_0x490bbb);}catch(_0x5bed2a){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x22'),_0x490bbb[_0x8f4b('0x21')]),_0x5bed2a);}});ami['on']('agentringnoanswer',function(_0xd25325){try{utils['debug'](util[_0x8f4b('0x1d')]('[%s][index][agentringnoanswer]',_0xd25325[_0x8f4b('0x21')]),_0xd25325);agents[_0x8f4b('0x23')](_0xd25325);}catch(_0xb7dbfc){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x24'),_0xd25325[_0x8f4b('0x21')]),_0xb7dbfc);}});ami['on'](_0x8f4b('0x25'),function(_0x56f08c){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x26'),_0x56f08c[_0x8f4b('0x21')]),_0x56f08c);agents[_0x8f4b('0x25')](_0x56f08c);queues[_0x8f4b('0x25')](_0x56f08c);}catch(_0x34c598){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x26'),_0x56f08c['uniqueid']),_0x34c598);}});ami['on']('agentcomplete',function(_0x46901a){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')]('[%s][index][agentcomplete]',_0x46901a[_0x8f4b('0x21')]),_0x46901a);agents['agentcomplete'](_0x46901a);queues['agentcomplete'](_0x46901a);members[_0x8f4b('0x27')](_0x46901a);}catch(_0x435577){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x28'),_0x46901a[_0x8f4b('0x21')]),_0x435577);}});ami['on'](_0x8f4b('0x29'),function(_0x50077b){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x2a'),_0x50077b[_0x8f4b('0x21')]),_0x50077b);agents['queuecallerabandon'](_0x50077b);queues[_0x8f4b('0x29')](_0x50077b);}catch(_0x904828){utils['error'](util[_0x8f4b('0x1d')]('[%s][index][queuecallerabandon]',_0x50077b['uniqueid']),_0x904828);}});ami['on'](_0x8f4b('0x2b'),function(_0x38c108){try{utils[_0x8f4b('0x1c')](util['format'](_0x8f4b('0x2c'),_0x38c108[_0x8f4b('0x21')]),_0x38c108);queues[_0x8f4b('0x2b')](_0x38c108);recordings[_0x8f4b('0x2b')](_0x38c108);}catch(_0xb2d457){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x2c'),_0x38c108[_0x8f4b('0x21')]),_0xb2d457);}});ami['on']('queuecallerleave',function(_0x4f1303){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x2d'),_0x4f1303['uniqueid']),_0x4f1303);queues[_0x8f4b('0x2e')](_0x4f1303);}catch(_0x4286fe){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x2d'),_0x4f1303[_0x8f4b('0x21')]),_0x4286fe);}});ami['on'](_0x8f4b('0x2f'),function(_0x744c7){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')]('[%s][index][musiconholdstart]',_0x744c7['uniqueid']),_0x744c7);queues[_0x8f4b('0x2f')](_0x744c7);calls[_0x8f4b('0x2f')](_0x744c7);}catch(_0x2524ef){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x30'),_0x744c7[_0x8f4b('0x21')]),_0x2524ef);}});ami['on'](_0x8f4b('0x31'),function(_0x6d52bb){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x32'),_0x6d52bb['uniqueid']),_0x6d52bb);queues[_0x8f4b('0x31')](_0x6d52bb);calls[_0x8f4b('0x31')](_0x6d52bb);}catch(_0x1c4676){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x32'),_0x6d52bb[_0x8f4b('0x21')]),_0x1c4676);}});ami['on'](_0x8f4b('0x33'),function(_0x1f4e1d){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x34'),_0x1f4e1d[_0x8f4b('0x21')]),_0x1f4e1d);calls[_0x8f4b('0x33')](_0x1f4e1d);recordings[_0x8f4b('0x33')](_0x1f4e1d);}catch(_0x477065){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')]('[%s][index][newstate]',_0x1f4e1d['uniqueid']),_0x477065);}});ami['on'](_0x8f4b('0x35'),function(_0x204b49){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x36'),_0x204b49['uniqueid']),_0x204b49);calls['hangup'](_0x204b49);recordings['hangup'](_0x204b49);dials[_0x8f4b('0x35')](_0x204b49);agents['hangup'](_0x204b49);queues['hangup'](_0x204b49);}catch(_0x13fb11){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x36'),_0x204b49[_0x8f4b('0x21')]),_0x13fb11);}});ami['on'](_0x8f4b('0x37'),function(_0x3b0cdb){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x38'),_0x3b0cdb[_0x8f4b('0x21')]),_0x3b0cdb);members[_0x8f4b('0x37')](_0x3b0cdb);}catch(_0x151c9c){utils['error'](util[_0x8f4b('0x1d')](_0x8f4b('0x38'),_0x3b0cdb[_0x8f4b('0x21')]),_0x151c9c);}});ami['on'](_0x8f4b('0x39'),function(_0x41712c){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')]('[%s][index][blindtransfer]',_0x41712c[_0x8f4b('0x21')]),_0x41712c);queues['blindtransfer'](_0x41712c);agents[_0x8f4b('0x39')](_0x41712c);transfers['blindtransfer'](_0x41712c);}catch(_0x5e0348){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x3a'),_0x41712c[_0x8f4b('0x21')]),_0x5e0348);}});ami['on'](_0x8f4b('0x3b'),function(_0x2e9b49){try{utils['debug'](util['format'](_0x8f4b('0x3c'),_0x2e9b49[_0x8f4b('0x3d')]),_0x2e9b49);queues[_0x8f4b('0x3b')](_0x2e9b49);transfers[_0x8f4b('0x3b')](_0x2e9b49);agents[_0x8f4b('0x3b')](_0x2e9b49);calls[_0x8f4b('0x3b')](_0x2e9b49);}catch(_0x2e2567){utils['error'](util['format'](_0x8f4b('0x3c'),_0x2e9b49['origtransfereruniqueid']),_0x2e2567);}});ami['on'](_0x8f4b('0x3e'),function(_0x4b74d6){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x3f'),_0x4b74d6['uniqueid']),_0x4b74d6);queues[_0x8f4b('0x3e')](_0x4b74d6);recordings[_0x8f4b('0x3e')](_0x4b74d6);calls[_0x8f4b('0x3e')](_0x4b74d6);dials[_0x8f4b('0x3e')](_0x4b74d6);}catch(_0x269c0c){utils['error'](util[_0x8f4b('0x1d')](_0x8f4b('0x3f'),_0x4b74d6[_0x8f4b('0x21')]),_0x269c0c);}});ami['on'](_0x8f4b('0x40'),function(_0x457ae3){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')]('[%s][index][newexten]',_0x457ae3[_0x8f4b('0x21')]),_0x457ae3);calls[_0x8f4b('0x40')](_0x457ae3);recordings[_0x8f4b('0x40')](_0x457ae3);dials[_0x8f4b('0x40')](_0x457ae3);}catch(_0x590c03){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x41'),_0x457ae3[_0x8f4b('0x21')]),_0x590c03);}});ami['on'](_0x8f4b('0x42'),function(_0x334ed){try{utils[_0x8f4b('0x1c')](util['format'](_0x8f4b('0x43'),_0x334ed[_0x8f4b('0x21')]),_0x334ed);calls[_0x8f4b('0x42')](_0x334ed);recordings['newchannel'](_0x334ed);}catch(_0x190baa){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x43'),_0x334ed[_0x8f4b('0x21')]),_0x190baa);}});ami['on'](_0x8f4b('0x44'),function(_0x1e2521){try{utils[_0x8f4b('0x1c')](util[_0x8f4b('0x1d')](_0x8f4b('0x45'),_0x1e2521[_0x8f4b('0x21')]),_0x1e2521);dials['dialbegin'](_0x1e2521);}catch(_0x13b51a){utils[_0x8f4b('0x19')](util['format'](_0x8f4b('0x46'),_0x1e2521[_0x8f4b('0x21')]),_0x13b51a);}});ami['on'](_0x8f4b('0x47'),function(_0x461b35){try{utils['debug'](util['format'](_0x8f4b('0x48'),_0x461b35[_0x8f4b('0x21')]),_0x461b35);dials['dialend'](_0x461b35);}catch(_0x450332){utils[_0x8f4b('0x19')](util[_0x8f4b('0x1d')](_0x8f4b('0x48'),_0x461b35[_0x8f4b('0x21')]),_0x450332);}});} \ No newline at end of file +var _0xb3ca=['shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','debug','format','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][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','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xb3ca,0x152));var _0xab3c=function(_0x4089c7,_0x120195){_0x4089c7=_0x4089c7-0x0;var _0x33dd04=_0xb3ca[_0x4089c7];return _0x33dd04;};var AsteriskManager=require(_0xab3c('0x0'));var config=require(_0xab3c('0x1'));var utils=require(_0xab3c('0x2'));var util=require(_0xab3c('0x3'));var isXDREnabled=config['xdr']&&config[_0xab3c('0x4')][_0xab3c('0x5')]?!config[_0xab3c('0x4')][_0xab3c('0x5')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0xab3c('0x4')]&&config[_0xab3c('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xab3c('0x6')],config[_0xab3c('0x7')]['ip'],config[_0xab3c('0x7')][_0xab3c('0x8')],config['asterisk'][_0xab3c('0x9')],!![]);ami[_0xab3c('0xa')]();if(!isXDREnabled){utils[_0xab3c('0xb')](_0xab3c('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xab3c('0xd'));}else{var agents=require(_0xab3c('0xe'));var calls=require(_0xab3c('0xf'));var queues=require(_0xab3c('0x10'));var recordings=require(_0xab3c('0x11'));var members=require('./members.controller');var dials=require(_0xab3c('0x12'));var transfers=require(_0xab3c('0x13'));var core=require(_0xab3c('0x14'));ami['on']('connect',core[_0xab3c('0x15')]);ami['on'](_0xab3c('0x16'),core['shutdown']);ami['on'](_0xab3c('0x17'),core[_0xab3c('0x17')]);ami['on'](_0xab3c('0x18'),core['error']);ami['on'](_0xab3c('0x19'),core[_0xab3c('0x19')]);ami['on'](_0xab3c('0x1a'),core[_0xab3c('0x1a')]);ami['on'](_0xab3c('0x1b'),function(_0x17883f){try{utils['debug'](util['format'](_0xab3c('0x1c'),_0x17883f['device']),_0x17883f);members[_0xab3c('0x1b')](_0x17883f);}catch(_0x30956c){utils['error'](util['format'](_0xab3c('0x1c'),_0x17883f[_0xab3c('0x1d')]),_0x30956c);}});ami['on']('agentcalled',function(_0x552c7a){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x20'),_0x552c7a[_0xab3c('0x21')]),_0x552c7a);agents[_0xab3c('0x22')](_0x552c7a);}catch(_0x32718a){utils[_0xab3c('0x18')](util['format']('[%s][index][agentcalled]',_0x552c7a[_0xab3c('0x21')]),_0x32718a);}});ami['on'](_0xab3c('0x23'),function(_0x1424fb){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x24'),_0x1424fb[_0xab3c('0x21')]),_0x1424fb);agents[_0xab3c('0x23')](_0x1424fb);}catch(_0x5cdd0f){utils[_0xab3c('0x18')](util['format'](_0xab3c('0x24'),_0x1424fb[_0xab3c('0x21')]),_0x5cdd0f);}});ami['on'](_0xab3c('0x25'),function(_0x17c07b){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x26'),_0x17c07b[_0xab3c('0x21')]),_0x17c07b);agents[_0xab3c('0x25')](_0x17c07b);queues[_0xab3c('0x25')](_0x17c07b);}catch(_0x591261){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x26'),_0x17c07b[_0xab3c('0x21')]),_0x591261);}});ami['on'](_0xab3c('0x27'),function(_0x21ff01){try{utils['debug'](util['format'](_0xab3c('0x28'),_0x21ff01[_0xab3c('0x21')]),_0x21ff01);agents[_0xab3c('0x27')](_0x21ff01);queues[_0xab3c('0x27')](_0x21ff01);members['agentcomplete'](_0x21ff01);}catch(_0xa02f27){utils['error'](util[_0xab3c('0x1f')]('[%s][index][agentcomplete]',_0x21ff01['uniqueid']),_0xa02f27);}});ami['on'](_0xab3c('0x29'),function(_0x2bbbb2){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x2a'),_0x2bbbb2['uniqueid']),_0x2bbbb2);agents[_0xab3c('0x29')](_0x2bbbb2);queues['queuecallerabandon'](_0x2bbbb2);}catch(_0x20caa8){utils['error'](util[_0xab3c('0x1f')](_0xab3c('0x2a'),_0x2bbbb2[_0xab3c('0x21')]),_0x20caa8);}});ami['on'](_0xab3c('0x2b'),function(_0x12f7b0){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x2c'),_0x12f7b0[_0xab3c('0x21')]),_0x12f7b0);queues[_0xab3c('0x2b')](_0x12f7b0);recordings[_0xab3c('0x2b')](_0x12f7b0);}catch(_0x5db38f){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')]('[%s][index][queuecallerjoin]',_0x12f7b0[_0xab3c('0x21')]),_0x5db38f);}});ami['on'](_0xab3c('0x2d'),function(_0x214bcf){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')]('[%s][index][queuecallerleave]',_0x214bcf[_0xab3c('0x21')]),_0x214bcf);queues[_0xab3c('0x2d')](_0x214bcf);}catch(_0x53589a){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x2e'),_0x214bcf[_0xab3c('0x21')]),_0x53589a);}});ami['on'](_0xab3c('0x2f'),function(_0x2ce71b){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')]('[%s][index][musiconholdstart]',_0x2ce71b[_0xab3c('0x21')]),_0x2ce71b);queues['musiconholdstart'](_0x2ce71b);calls[_0xab3c('0x2f')](_0x2ce71b);}catch(_0x2f03da){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x30'),_0x2ce71b[_0xab3c('0x21')]),_0x2f03da);}});ami['on'](_0xab3c('0x31'),function(_0x375ade){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x32'),_0x375ade[_0xab3c('0x21')]),_0x375ade);queues[_0xab3c('0x31')](_0x375ade);calls['musiconholdstop'](_0x375ade);}catch(_0x8c18fd){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')]('[%s][index][musiconholdstop]',_0x375ade[_0xab3c('0x21')]),_0x8c18fd);}});ami['on'](_0xab3c('0x33'),function(_0x57c162){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x34'),_0x57c162[_0xab3c('0x21')]),_0x57c162);calls['newstate'](_0x57c162);recordings[_0xab3c('0x33')](_0x57c162);}catch(_0x1ec92d){utils[_0xab3c('0x18')](util['format'](_0xab3c('0x34'),_0x57c162[_0xab3c('0x21')]),_0x1ec92d);}});ami['on'](_0xab3c('0x35'),function(_0x47d788){try{utils[_0xab3c('0x1e')](util['format']('[%s][index][hangup]',_0x47d788[_0xab3c('0x21')]),_0x47d788);calls[_0xab3c('0x35')](_0x47d788);recordings[_0xab3c('0x35')](_0x47d788);dials['hangup'](_0x47d788);agents['hangup'](_0x47d788);queues['hangup'](_0x47d788);}catch(_0x9bb46b){utils[_0xab3c('0x18')](util['format'](_0xab3c('0x36'),_0x47d788[_0xab3c('0x21')]),_0x9bb46b);}});ami['on']('cdr',function(_0x25efb7){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x37'),_0x25efb7[_0xab3c('0x21')]),_0x25efb7);members['cdr'](_0x25efb7);}catch(_0x3c339e){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x37'),_0x25efb7['uniqueid']),_0x3c339e);}});ami['on'](_0xab3c('0x38'),function(_0x1f50cc){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x39'),_0x1f50cc[_0xab3c('0x21')]),_0x1f50cc);queues[_0xab3c('0x38')](_0x1f50cc);agents[_0xab3c('0x38')](_0x1f50cc);transfers[_0xab3c('0x38')](_0x1f50cc);}catch(_0x19a2ae){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')]('[%s][index][blindtransfer]',_0x1f50cc[_0xab3c('0x21')]),_0x19a2ae);}});ami['on'](_0xab3c('0x3a'),function(_0x44cf90){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x3b'),_0x44cf90[_0xab3c('0x3c')]),_0x44cf90);queues[_0xab3c('0x3a')](_0x44cf90);transfers[_0xab3c('0x3a')](_0x44cf90);agents[_0xab3c('0x3a')](_0x44cf90);calls[_0xab3c('0x3a')](_0x44cf90);}catch(_0x50ea51){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x3b'),_0x44cf90[_0xab3c('0x3c')]),_0x50ea51);}});ami['on'](_0xab3c('0x3d'),function(_0x207213){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x3e'),_0x207213[_0xab3c('0x21')]),_0x207213);queues[_0xab3c('0x3d')](_0x207213);recordings[_0xab3c('0x3d')](_0x207213);calls[_0xab3c('0x3d')](_0x207213);dials[_0xab3c('0x3d')](_0x207213);}catch(_0x56696){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x3e'),_0x207213[_0xab3c('0x21')]),_0x56696);}});ami['on'](_0xab3c('0x3f'),function(_0xa0d48d){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x40'),_0xa0d48d[_0xab3c('0x21')]),_0xa0d48d);calls[_0xab3c('0x3f')](_0xa0d48d);recordings[_0xab3c('0x3f')](_0xa0d48d);dials[_0xab3c('0x3f')](_0xa0d48d);}catch(_0x4eec0e){utils['error'](util['format'](_0xab3c('0x40'),_0xa0d48d[_0xab3c('0x21')]),_0x4eec0e);}});ami['on'](_0xab3c('0x41'),function(_0x114dda){try{utils['debug'](util['format'](_0xab3c('0x42'),_0x114dda[_0xab3c('0x21')]),_0x114dda);calls[_0xab3c('0x41')](_0x114dda);recordings[_0xab3c('0x41')](_0x114dda);}catch(_0x24bb71){utils[_0xab3c('0x18')](util[_0xab3c('0x1f')](_0xab3c('0x42'),_0x114dda[_0xab3c('0x21')]),_0x24bb71);}});ami['on']('dialbegin',function(_0x14283f){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x43'),_0x14283f[_0xab3c('0x21')]),_0x14283f);dials[_0xab3c('0x44')](_0x14283f);}catch(_0xc8555e){utils['error'](util[_0xab3c('0x1f')](_0xab3c('0x45'),_0x14283f[_0xab3c('0x21')]),_0xc8555e);}});ami['on'](_0xab3c('0x46'),function(_0x2b5ccb){try{utils[_0xab3c('0x1e')](util[_0xab3c('0x1f')](_0xab3c('0x47'),_0x2b5ccb[_0xab3c('0x21')]),_0x2b5ccb);dials[_0xab3c('0x46')](_0x2b5ccb);}catch(_0x634671){utils[_0xab3c('0x18')](util['format'](_0xab3c('0x47'),_0x2b5ccb[_0xab3c('0x21')]),_0x634671);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 90b5898..43915e7 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 _0x351d=['name','internal','CreateMemberReport','getUserByName','split','request','catch','error','format','[%s][members][writeDB]','uniqueid','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','data1','data3','destination','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','type','getUserByInterface','then','membername'];(function(_0x15eddc,_0x30129b){var _0x301b89=function(_0x370bfc){while(--_0x370bfc){_0x15eddc['push'](_0x15eddc['shift']());}};_0x301b89(++_0x30129b);}(_0x351d,0x137));var _0xd351=function(_0x269f18,_0x3603e6){_0x269f18=_0x269f18-0x0;var _0x5d47bb=_0x351d[_0x269f18];return _0x5d47bb;};'use strict';var _=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var utils=require(_0xd351('0x2'));var members={};var exclude=[_0xd351('0x3'),_0xd351('0x4')];function writeDB(_0x1e169a){utils[_0xd351('0x5')](util['format'](_0xd351('0x6'),_0x1e169a['uniqueid'],_0x1e169a[_0xd351('0x7')],_0x1e169a['channel'],_0x1e169a[_0xd351('0x8')],_0x1e169a['membername'],_0x1e169a[_0xd351('0x9')]));if(_0x1e169a[_0xd351('0x7')]){utils[_0xd351('0xa')](_0x1e169a[_0xd351('0x7')])[_0xd351('0xb')](function(_0x32b842){if(_0x32b842){_0x1e169a[_0xd351('0xc')]=_0x32b842[_0xd351('0xd')];_0x1e169a[_0xd351('0xe')]=_0x32b842[_0xd351('0xe')];utils['request'](_0xd351('0xf'),_0x1e169a);}else{utils[_0xd351('0x10')](_0x1e169a[_0xd351('0x7')][_0xd351('0x11')]('/')[0x1])[_0xd351('0xb')](function(_0x4f753d){if(_0x4f753d){_0x1e169a[_0xd351('0xc')]=_0x4f753d[_0xd351('0xd')];_0x1e169a[_0xd351('0xe')]=_0x4f753d[_0xd351('0xe')];utils[_0xd351('0x12')](_0xd351('0xf'),_0x1e169a);}});}})[_0xd351('0x13')](function(_0x4b2169){utils[_0xd351('0x14')](util[_0xd351('0x15')](_0xd351('0x16'),_0x1e169a[_0xd351('0x17')]),_0x4b2169);});}delete members[_0x1e169a['interface']];}function startsWith(_0xe45642,_0x443ca8){return _['some'](_0xe45642,function(_0x1e78a0){return _['startsWith'](_0x443ca8,_0x1e78a0);});}exports[_0xd351('0x18')]=function(_0x5891d8){try{utils[_0xd351('0x19')](util[_0xd351('0x15')](_0xd351('0x1a'),members[_0x5891d8[_0xd351('0x1b')]]?members[_0x5891d8[_0xd351('0x1b')]][_0xd351('0x17')]:_0x5891d8['device']),_0x5891d8);utils['info'](util['format'](_0xd351('0x1c'),members[_0x5891d8[_0xd351('0x1b')]]?members[_0x5891d8['device']][_0xd351('0x17')]:_0x5891d8[_0xd351('0x1b')],_0x5891d8[_0xd351('0x1d')],_0x5891d8[_0xd351('0x1b')]));switch(_0x5891d8[_0xd351('0x1d')]){case _0xd351('0x1e'):case _0xd351('0x1f'):if(!startsWith(exclude,_0x5891d8['device'])){members[_0x5891d8[_0xd351('0x1b')]]={'channel':_0xd351('0x20'),'interface':_0x5891d8['device'],'type':_0xd351('0x21'),'enterAt':utils[_0xd351('0x22')](),'role':_0xd351('0x23')};}break;case _0xd351('0x24'):if(!_[_0xd351('0x25')](members[_0x5891d8[_0xd351('0x1b')]])){members[_0x5891d8[_0xd351('0x1b')]]['exitAt']=utils['now']();members[_0x5891d8[_0xd351('0x1b')]][_0xd351('0x26')]=utils[_0xd351('0x27')](members[_0x5891d8[_0xd351('0x1b')]][_0xd351('0x28')],members[_0x5891d8['device']][_0xd351('0x29')]);if(members[_0x5891d8[_0xd351('0x1b')]][_0xd351('0x17')]){writeDB(members[_0x5891d8['device']]);}}break;default:break;}}catch(_0x287410){utils['error'](util[_0xd351('0x15')](_0xd351('0x1a'),members[_0x5891d8[_0xd351('0x1b')]]?members[_0x5891d8['device']][_0xd351('0x17')]:_0x5891d8[_0xd351('0x1b')]),_0x287410);}};exports['agentcomplete']=function(_0x5541e0){try{if(!_[_0xd351('0x25')](members[_0x5541e0[_0xd351('0x7')]])){utils[_0xd351('0x19')](util[_0xd351('0x15')](_0xd351('0x2a'),_0x5541e0['uniqueid']),_0x5541e0);utils[_0xd351('0x5')](util[_0xd351('0x15')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5541e0[_0xd351('0x17')],_0x5541e0[_0xd351('0x7')],_0x5541e0[_0xd351('0x2b')]));members[_0x5541e0[_0xd351('0x7')]]=_[_0xd351('0x2c')](members[_0x5541e0[_0xd351('0x7')]],{'data4':_0x5541e0[_0xd351('0x2b')],'uniqueid':_0x5541e0[_0xd351('0x17')]});}}catch(_0x31bf92){utils[_0xd351('0x14')](util['format'](_0xd351('0x2a'),_0x5541e0[_0xd351('0x17')]),_0x31bf92);}};exports[_0xd351('0x2d')]=function(_0x5436b3){try{utils[_0xd351('0x19')](util['format'](_0xd351('0x2e'),_0x5436b3[_0xd351('0x17')]),_0x5436b3);if(_0x5436b3[_0xd351('0x2f')]){var _0x34ed58=_0x5436b3[_0xd351('0x2f')][_0xd351('0x11')]('-')[0x0];if(!_[_0xd351('0x25')](members[_0x34ed58])){members[_0x34ed58]=_[_0xd351('0x2c')](members[_0x34ed58],{'data1':members[_0x34ed58][_0xd351('0x30')]||_0x5436b3['type'],'data2':members[_0x34ed58][_0xd351('0x8')]||_0x5436b3['source'],'data3':members[_0x34ed58][_0xd351('0x31')]||_0x5436b3[_0xd351('0x32')],'uniqueid':members[_0x34ed58]['uniqueid']||_0x5436b3[_0xd351('0x17')]});utils[_0xd351('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5436b3['uniqueid'],members[_0x34ed58]['data1'],members[_0x34ed58][_0xd351('0x8')],members[_0x34ed58][_0xd351('0x31')]));if(members[_0x34ed58]['exitAt']){writeDB(members[_0x34ed58]);}}}if(_0x5436b3[_0xd351('0x33')]){var _0x55cdbe=_0x5436b3['destinationchannel'][_0xd351('0x11')]('-')[0x0];if(!_[_0xd351('0x25')](members[_0x55cdbe])){members[_0x55cdbe]=_[_0xd351('0x2c')](members[_0x55cdbe],{'data1':members[_0x55cdbe][_0xd351('0x30')]||_0x5436b3[_0xd351('0x9')],'data2':members[_0x55cdbe]['data2']||_0x5436b3[_0xd351('0x34')],'data3':members[_0x55cdbe]['data3']||_0x5436b3[_0xd351('0x32')],'uniqueid':members[_0x55cdbe]['uniqueid']||_0x5436b3[_0xd351('0x17')]});utils[_0xd351('0x5')](util['format'](_0xd351('0x35'),_0x5436b3[_0xd351('0x17')],members[_0x55cdbe][_0xd351('0x30')],members[_0x55cdbe]['data2'],members[_0x55cdbe][_0xd351('0x31')]));if(members[_0x55cdbe]['exitAt']){writeDB(members[_0x55cdbe]);}}}}catch(_0x343dc4){utils[_0xd351('0x14')](util['format'](_0xd351('0x2e'),_0x5436b3['uniqueid']),_0x343dc4);}}; \ No newline at end of file +var _0xfdc5=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','catch','error','format','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]'];(function(_0x3f020f,_0x4d53bc){var _0x1062b2=function(_0xb4b540){while(--_0xb4b540){_0x3f020f['push'](_0x3f020f['shift']());}};_0x1062b2(++_0x4d53bc);}(_0xfdc5,0xa8));var _0x5fdc=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xfdc5[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x5fdc('0x0'));var util=require(_0x5fdc('0x1'));var utils=require(_0x5fdc('0x2'));var members={};var exclude=[_0x5fdc('0x3'),_0x5fdc('0x4')];function writeDB(_0x130011){utils[_0x5fdc('0x5')](util['format'](_0x5fdc('0x6'),_0x130011['uniqueid'],_0x130011[_0x5fdc('0x7')],_0x130011[_0x5fdc('0x8')],_0x130011[_0x5fdc('0x9')],_0x130011[_0x5fdc('0xa')],_0x130011[_0x5fdc('0xb')]));if(_0x130011[_0x5fdc('0x7')]){utils[_0x5fdc('0xc')](_0x130011['interface'])[_0x5fdc('0xd')](function(_0xd51f8a){if(_0xd51f8a){_0x130011[_0x5fdc('0xa')]=_0xd51f8a[_0x5fdc('0xe')];_0x130011[_0x5fdc('0xf')]=_0xd51f8a[_0x5fdc('0xf')];utils[_0x5fdc('0x10')](_0x5fdc('0x11'),_0x130011);}else{utils['getUserByName'](_0x130011[_0x5fdc('0x7')]['split']('/')[0x1])['then'](function(_0x2ed320){if(_0x2ed320){_0x130011['membername']=_0x2ed320[_0x5fdc('0xe')];_0x130011['internal']=_0x2ed320[_0x5fdc('0xf')];utils['request']('CreateMemberReport',_0x130011);}});}})[_0x5fdc('0x12')](function(_0x338412){utils[_0x5fdc('0x13')](util[_0x5fdc('0x14')]('[%s][members][writeDB]',_0x130011[_0x5fdc('0x15')]),_0x338412);});}delete members[_0x130011[_0x5fdc('0x7')]];}function startsWith(_0x309350,_0x1f98df){return _[_0x5fdc('0x16')](_0x309350,function(_0x1a4477){return _[_0x5fdc('0x17')](_0x1f98df,_0x1a4477);});}exports[_0x5fdc('0x18')]=function(_0x3e3148){try{utils['debug'](util[_0x5fdc('0x14')](_0x5fdc('0x19'),members[_0x3e3148[_0x5fdc('0x1a')]]?members[_0x3e3148[_0x5fdc('0x1a')]][_0x5fdc('0x15')]:_0x3e3148[_0x5fdc('0x1a')]),_0x3e3148);utils[_0x5fdc('0x5')](util[_0x5fdc('0x14')](_0x5fdc('0x1b'),members[_0x3e3148[_0x5fdc('0x1a')]]?members[_0x3e3148[_0x5fdc('0x1a')]][_0x5fdc('0x15')]:_0x3e3148[_0x5fdc('0x1a')],_0x3e3148[_0x5fdc('0x1c')],_0x3e3148[_0x5fdc('0x1a')]));switch(_0x3e3148[_0x5fdc('0x1c')]){case _0x5fdc('0x1d'):case _0x5fdc('0x1e'):if(!startsWith(exclude,_0x3e3148[_0x5fdc('0x1a')])){members[_0x3e3148[_0x5fdc('0x1a')]]={'channel':'voice','interface':_0x3e3148[_0x5fdc('0x1a')],'type':_0x5fdc('0x1f'),'enterAt':utils[_0x5fdc('0x20')](),'role':'agent'};}break;case _0x5fdc('0x21'):if(!_[_0x5fdc('0x22')](members[_0x3e3148[_0x5fdc('0x1a')]])){members[_0x3e3148[_0x5fdc('0x1a')]][_0x5fdc('0x23')]=utils['now']();members[_0x3e3148[_0x5fdc('0x1a')]][_0x5fdc('0x24')]=utils['diffTime'](members[_0x3e3148['device']][_0x5fdc('0x23')],members[_0x3e3148[_0x5fdc('0x1a')]][_0x5fdc('0x25')]);if(members[_0x3e3148[_0x5fdc('0x1a')]]['uniqueid']){writeDB(members[_0x3e3148['device']]);}}break;default:break;}}catch(_0x57bb09){utils[_0x5fdc('0x13')](util['format'](_0x5fdc('0x19'),members[_0x3e3148['device']]?members[_0x3e3148['device']]['uniqueid']:_0x3e3148[_0x5fdc('0x1a')]),_0x57bb09);}};exports[_0x5fdc('0x26')]=function(_0x52fc23){try{if(!_[_0x5fdc('0x22')](members[_0x52fc23[_0x5fdc('0x7')]])){utils['debug'](util['format'](_0x5fdc('0x27'),_0x52fc23[_0x5fdc('0x15')]),_0x52fc23);utils[_0x5fdc('0x5')](util[_0x5fdc('0x14')](_0x5fdc('0x28'),_0x52fc23[_0x5fdc('0x15')],_0x52fc23[_0x5fdc('0x7')],_0x52fc23[_0x5fdc('0x29')]));members[_0x52fc23['interface']]=_[_0x5fdc('0x2a')](members[_0x52fc23[_0x5fdc('0x7')]],{'data4':_0x52fc23['queue'],'uniqueid':_0x52fc23['uniqueid']});}}catch(_0x4dd641){utils[_0x5fdc('0x13')](util[_0x5fdc('0x14')](_0x5fdc('0x27'),_0x52fc23[_0x5fdc('0x15')]),_0x4dd641);}};exports[_0x5fdc('0x2b')]=function(_0x6f484a){try{utils['debug'](util[_0x5fdc('0x14')](_0x5fdc('0x2c'),_0x6f484a['uniqueid']),_0x6f484a);if(_0x6f484a[_0x5fdc('0x8')]){var _0xdb2e43=_0x6f484a[_0x5fdc('0x8')][_0x5fdc('0x2d')]('-')[0x0];if(!_[_0x5fdc('0x22')](members[_0xdb2e43])){members[_0xdb2e43]=_[_0x5fdc('0x2a')](members[_0xdb2e43],{'data1':members[_0xdb2e43][_0x5fdc('0x2e')]||_0x6f484a['type'],'data2':members[_0xdb2e43]['data2']||_0x6f484a['source'],'data3':members[_0xdb2e43][_0x5fdc('0x2f')]||_0x6f484a[_0x5fdc('0x30')],'uniqueid':members[_0xdb2e43][_0x5fdc('0x15')]||_0x6f484a[_0x5fdc('0x15')]});utils[_0x5fdc('0x5')](util[_0x5fdc('0x14')](_0x5fdc('0x31'),_0x6f484a[_0x5fdc('0x15')],members[_0xdb2e43][_0x5fdc('0x2e')],members[_0xdb2e43][_0x5fdc('0x9')],members[_0xdb2e43][_0x5fdc('0x2f')]));if(members[_0xdb2e43][_0x5fdc('0x23')]){writeDB(members[_0xdb2e43]);}}}if(_0x6f484a[_0x5fdc('0x32')]){var _0x356660=_0x6f484a['destinationchannel'][_0x5fdc('0x2d')]('-')[0x0];if(!_['isNil'](members[_0x356660])){members[_0x356660]=_['assign'](members[_0x356660],{'data1':members[_0x356660]['data1']||_0x6f484a[_0x5fdc('0xb')],'data2':members[_0x356660][_0x5fdc('0x9')]||_0x6f484a[_0x5fdc('0x33')],'data3':members[_0x356660][_0x5fdc('0x2f')]||_0x6f484a[_0x5fdc('0x30')],'uniqueid':members[_0x356660][_0x5fdc('0x15')]||_0x6f484a[_0x5fdc('0x15')]});utils[_0x5fdc('0x5')](util[_0x5fdc('0x14')](_0x5fdc('0x31'),_0x6f484a[_0x5fdc('0x15')],members[_0x356660][_0x5fdc('0x2e')],members[_0x356660][_0x5fdc('0x9')],members[_0x356660][_0x5fdc('0x2f')]));if(members[_0x356660][_0x5fdc('0x23')]){writeDB(members[_0x356660]);}}}}catch(_0x1a8754){utils[_0x5fdc('0x13')](util[_0x5fdc('0x14')](_0x5fdc('0x2c'),_0x6f484a['uniqueid']),_0x1a8754);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8f39c19..852900e 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 _0x8692=['connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]'];(function(_0x237c6b,_0x4705de){var _0x7a5299=function(_0xc23533){while(--_0xc23533){_0x237c6b['push'](_0x237c6b['shift']());}};_0x7a5299(++_0x4705de);}(_0x8692,0x177));var _0x2869=function(_0x190092,_0x3a65de){_0x190092=_0x190092-0x0;var _0x14e48c=_0x8692[_0x190092];return _0x14e48c;};'use strict';var _=require('lodash');var util=require(_0x2869('0x0'));var utils=require(_0x2869('0x1'));var queues={};function writeDB(_0x234002){utils['info'](util[_0x2869('0x2')](_0x2869('0x3'),_0x234002['uniqueid'],_0x234002[_0x2869('0x4')],_0x234002[_0x2869('0x5')],_0x234002[_0x2869('0x6')],_0x234002[_0x2869('0x7')],_0x234002[_0x2869('0x8')],_0x234002[_0x2869('0x9')]));if(_0x234002['queue']){utils[_0x2869('0xa')](_0x234002[_0x2869('0x5')])[_0x2869('0xb')](function(_0x12ee45){if(_0x12ee45){_0x234002['type']=_0x12ee45['type'];}utils[_0x2869('0xc')](_0x2869('0xd'),_0x234002);});}else{utils['request'](_0x2869('0xd'),_0x234002);}if(_0x234002[_0x2869('0xe')]){delete queues[_0x234002[_0x2869('0xe')]];}else{delete queues[_0x234002[_0x2869('0xf')]];}}exports[_0x2869('0x10')]=function(_0x3323f8){try{utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x12'),_0x3323f8[_0x2869('0xf')]),_0x3323f8);utils[_0x2869('0x13')](util[_0x2869('0x2')](_0x2869('0x14'),_0x3323f8[_0x2869('0xf')],_0x3323f8[_0x2869('0x5')],_0x3323f8[_0x2869('0x15')]));queues[_0x3323f8[_0x2869('0xf')]]=_[_0x2869('0x16')](_0x3323f8,{'originalposition':_0x3323f8[_0x2869('0x15')],'queuecallerjoinAt':utils[_0x2869('0x17')](),'mohtime':0x0});}catch(_0x3569b2){utils[_0x2869('0x18')](util['format'](_0x2869('0x12'),_0x3323f8[_0x2869('0xf')]),_0x3569b2);}};exports[_0x2869('0x19')]=function(_0x9c31a9){try{if(!_[_0x2869('0x1a')](queues[_0x9c31a9[_0x2869('0xf')]])){utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x1b'),_0x9c31a9[_0x2869('0xf')]),_0x9c31a9);if(queues[_0x9c31a9['uniqueid']][_0x2869('0x1c')]){if(!queues[_0x9c31a9['uniqueid']][_0x2869('0x1d')]&&!queues[_0x9c31a9[_0x2869('0xf')]]['queuecallerexit']){queues[_0x9c31a9[_0x2869('0xf')]]['queuecallercomplete']=!![];queues[_0x9c31a9['uniqueid']][_0x2869('0x1e')]=utils[_0x2869('0x17')]();queues[_0x9c31a9[_0x2869('0xf')]][_0x2869('0x9')]=_0x2869('0x1f');}utils[_0x2869('0x13')](util['format'](_0x2869('0x20'),_0x9c31a9['uniqueid'],queues[_0x9c31a9['uniqueid']]['name'],queues[_0x9c31a9['uniqueid']][_0x2869('0x9')]));writeDB(queues[_0x9c31a9[_0x2869('0xf')]]);}else if(queues[_0x9c31a9[_0x2869('0xf')]]['transfereduniqueid']){utils[_0x2869('0x13')](util[_0x2869('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x9c31a9[_0x2869('0xf')],queues[_0x9c31a9[_0x2869('0xf')]][_0x2869('0x21')],queues[_0x9c31a9['uniqueid']]['transfereduniqueid']));queues[queues[_0x9c31a9[_0x2869('0xf')]][_0x2869('0xe')]]=queues[_0x9c31a9[_0x2869('0xf')]];queues[queues[_0x9c31a9[_0x2869('0xf')]][_0x2869('0xe')]][_0x2869('0x22')]=0x2;delete queues[_0x9c31a9[_0x2869('0xf')]];}}}catch(_0x3132a9){utils[_0x2869('0x18')](util['format'](_0x2869('0x1b'),_0x9c31a9[_0x2869('0xf')]),_0x3132a9);}};exports[_0x2869('0x23')]=function(_0x52c4af){try{utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x24'),_0x52c4af[_0x2869('0xf')]),_0x52c4af);if(!_['isNil'](_0x52c4af[_0x2869('0x25')][_0x2869('0x26')])&&_0x52c4af[_0x2869('0x27')][_0x2869('0x28')]()!==_0x2869('0x29')){if(!_[_0x2869('0x1a')](queues[_0x52c4af[_0x2869('0xf')]])){queues[_0x52c4af['uniqueid']][_0x2869('0x1d')]=![];queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x2a')]=null;queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x2b')]=!![];queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x2c')]=utils['now']();queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x9')]=_0x52c4af[_0x2869('0x27')][_0x2869('0x28')]();utils['info'](util['format'](_0x2869('0x2d'),_0x52c4af[_0x2869('0xf')],queues[_0x52c4af[_0x2869('0xf')]]['name'],_0x52c4af[_0x2869('0x27')],queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x9')]));writeDB(queues[_0x52c4af['uniqueid']]);}}else if(!_[_0x2869('0x1a')](_0x52c4af[_0x2869('0x25')][_0x2869('0x2e')])){if(!_[_0x2869('0x1a')](queues[_0x52c4af[_0x2869('0xf')]])&&!queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x1d')]){queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x1d')]=![];queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x2a')]=null;queues[_0x52c4af[_0x2869('0xf')]]['queuecallerexit']=!![];queues[_0x52c4af[_0x2869('0xf')]]['queuecallerexitAt']=utils[_0x2869('0x17')]();queues[_0x52c4af[_0x2869('0xf')]][_0x2869('0x9')]=_0x2869('0x2f');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x52c4af[_0x2869('0xf')],queues[_0x52c4af[_0x2869('0xf')]]['name'],_0x52c4af[_0x2869('0x27')],queues[_0x52c4af[_0x2869('0xf')]]['queuecallerexitreason']));}}}catch(_0x10d764){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x24'),_0x52c4af[_0x2869('0xf')]),_0x10d764);}};exports[_0x2869('0x1d')]=function(_0x55e2ef){try{if(!_['isNil'](queues[_0x55e2ef[_0x2869('0xf')]])){utils[_0x2869('0x11')](util['format'](_0x2869('0x30'),_0x55e2ef[_0x2869('0xf')]),_0x55e2ef);queues[_0x55e2ef[_0x2869('0xf')]][_0x2869('0x2b')]=![];queues[_0x55e2ef[_0x2869('0xf')]][_0x2869('0x2c')]=null;queues[_0x55e2ef[_0x2869('0xf')]][_0x2869('0x1d')]=!![];queues[_0x55e2ef[_0x2869('0xf')]]['queuecallerabandonAt']=utils[_0x2869('0x17')]();queues[_0x55e2ef['uniqueid']][_0x2869('0x9')]=_0x2869('0x31');utils['info'](util[_0x2869('0x2')](_0x2869('0x32'),_0x55e2ef[_0x2869('0xf')],queues[_0x55e2ef[_0x2869('0xf')]]['name'],queues[_0x55e2ef[_0x2869('0xf')]][_0x2869('0x9')]));}}catch(_0x36f7e6){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x30'),_0x55e2ef['uniqueid']),_0x36f7e6);}};exports[_0x2869('0x33')]=function(_0x468761){try{if(!_[_0x2869('0x1a')](queues[_0x468761['uniqueid']])){utils['debug'](util[_0x2869('0x2')](_0x2869('0x34'),_0x468761[_0x2869('0xf')]),_0x468761);utils['info'](util[_0x2869('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x468761[_0x2869('0xf')],queues[_0x468761[_0x2869('0xf')]][_0x2869('0x21')],_0x468761[_0x2869('0x35')],_0x468761[_0x2869('0x36')]));queues[_0x468761[_0x2869('0xf')]][_0x2869('0x33')]=!![];queues[_0x468761[_0x2869('0xf')]][_0x2869('0x1c')]=utils[_0x2869('0x17')]();queues[_0x468761[_0x2869('0xf')]][_0x2869('0x37')]=utils[_0x2869('0x38')](queues[_0x468761[_0x2869('0xf')]][_0x2869('0x1c')],queues[_0x468761[_0x2869('0xf')]][_0x2869('0x39')]);queues[_0x468761[_0x2869('0xf')]][_0x2869('0x15')]=_0x468761[_0x2869('0x15')];queues[_0x468761[_0x2869('0xf')]]['count']=_0x468761[_0x2869('0x3a')];queues[_0x468761[_0x2869('0xf')]][_0x2869('0x35')]=_0x468761[_0x2869('0x35')];queues[_0x468761[_0x2869('0xf')]][_0x2869('0x36')]=_0x468761[_0x2869('0x36')];}}catch(_0x2798f3){utils[_0x2869('0x18')](util['format'](_0x2869('0x34'),_0x468761[_0x2869('0xf')]),_0x2798f3);}};exports[_0x2869('0x3b')]=function(_0x25b4e2){try{if(!_[_0x2869('0x1a')](queues[_0x25b4e2['uniqueid']])){utils[_0x2869('0x11')](util[_0x2869('0x2')]('[%s][queues][agentconnect]',_0x25b4e2[_0x2869('0xf')]),_0x25b4e2);utils['info'](util[_0x2869('0x2')](_0x2869('0x3c'),_0x25b4e2['uniqueid'],queues[_0x25b4e2[_0x2869('0xf')]][_0x2869('0x21')],_0x25b4e2['membername'],_0x25b4e2[_0x2869('0x3d')]));queues[_0x25b4e2[_0x2869('0xf')]][_0x2869('0x1d')]=![];queues[_0x25b4e2[_0x2869('0xf')]]['queuecallerabandon']=![];queues[_0x25b4e2[_0x2869('0xf')]][_0x2869('0x2a')]=null;queues[_0x25b4e2['uniqueid']][_0x2869('0x2b')]=![];queues[_0x25b4e2[_0x2869('0xf')]][_0x2869('0x9')]=null;queues[_0x25b4e2[_0x2869('0xf')]][_0x2869('0x2c')]=null;queues[_0x25b4e2['uniqueid']][_0x2869('0x3e')]=!![];queues[_0x25b4e2['uniqueid']][_0x2869('0x8')]=_0x25b4e2['destaccountcode'];queues[_0x25b4e2[_0x2869('0xf')]]['lastAssignedTo']=_0x25b4e2[_0x2869('0x3f')];}}catch(_0x54e90c){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x40'),_0x25b4e2[_0x2869('0xf')]),_0x54e90c);}};exports[_0x2869('0x41')]=function(_0x4042ad){try{if(!_['isNil'](queues[_0x4042ad[_0x2869('0xf')]])){if(queues[_0x4042ad['uniqueid']][_0x2869('0x1c')]){utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x42'),_0x4042ad['uniqueid']),_0x4042ad);queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x1d')]=![];queues[_0x4042ad['uniqueid']][_0x2869('0x1d')]=![];queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x2a')]=null;queues[_0x4042ad['uniqueid']]['queuecallerexit']=![];queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x2c')]=null;queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x3e')]=!![];queues[_0x4042ad['uniqueid']]['lastAssignedTo']=_0x4042ad[_0x2869('0x3f')];queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x43')]=!![];queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x1e')]=utils[_0x2869('0x17')]();if(_0x4042ad['reason']==_0x2869('0x44')){if(!queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x44')]){queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x9')]=_0x2869('0x45');}}else{queues[_0x4042ad[_0x2869('0xf')]]['queuecallerexitreason']=_0x2869('0x46')+_0x4042ad[_0x2869('0x47')]['toUpperCase']();}utils[_0x2869('0x13')](util['format'](_0x2869('0x48'),_0x4042ad['uniqueid'],queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x21')],_0x4042ad['membername'],queues[_0x4042ad[_0x2869('0xf')]][_0x2869('0x9')]));writeDB(queues[_0x4042ad[_0x2869('0xf')]]);}}}catch(_0x2c3437){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x42'),_0x4042ad['uniqueid']),_0x2c3437);}};exports[_0x2869('0x49')]=function(_0xc8075){try{if(!_['isNil'](queues[_0xc8075['transfereeuniqueid']])){utils[_0x2869('0x11')](util['format']('[%s][queues][blindtransfer]',_0xc8075['uniqueid']),_0xc8075);queues[_0xc8075[_0x2869('0x4a')]][_0x2869('0x44')]=!![];queues[_0xc8075[_0x2869('0x4a')]]['transfertype']=_0x2869('0x4b');queues[_0xc8075[_0x2869('0x4a')]][_0x2869('0x4c')]=_0xc8075[_0x2869('0x4d')];queues[_0xc8075[_0x2869('0x4a')]]['transferuniqueid']=_0xc8075[_0x2869('0x4a')];queues[_0xc8075[_0x2869('0x4a')]][_0x2869('0x9')]=_0x2869('0x4e');utils[_0x2869('0x13')](util[_0x2869('0x2')](_0x2869('0x4f'),_0xc8075[_0x2869('0xf')],queues[_0xc8075[_0x2869('0x4a')]][_0x2869('0x21')],_0xc8075[_0x2869('0x4a')],_0xc8075['extension']));}}catch(_0x5c033e){utils[_0x2869('0x18')](util[_0x2869('0x2')]('[%s][queues][blindtransfer]',_0xc8075['uniqueid']),_0x5c033e);}};exports['attendedtransfer']=function(_0x2461d9){try{utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x50'),_0x2461d9[_0x2869('0x51')]),_0x2461d9);if(_0x2461d9['origtransfereruniqueid']==_0x2461d9[_0x2869('0x52')]){if(!_['isNil'](queues[_0x2461d9['secondtransfererlinkedid']])){utils['info'](util[_0x2869('0x2')](_0x2869('0x53'),_0x2461d9[_0x2869('0x51')],queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0x21')],_0x2461d9[_0x2869('0x54')]));queues[_0x2461d9[_0x2869('0x55')]][_0x2869('0x44')]=!![];queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0x56')]=_0x2869('0x57');queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0x4c')]=_0x2461d9['origtransfererexten'];queues[_0x2461d9[_0x2869('0x55')]][_0x2869('0x58')]=_0x2461d9[_0x2869('0x51')];queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0x9')]=_0x2869('0x59');}if(!_[_0x2869('0x1a')](queues[_0x2461d9[_0x2869('0x52')]])){if(_0x2461d9[_0x2869('0x5a')]&&queues[_0x2461d9['transfereelinkedid']]){queues[_0x2461d9[_0x2869('0x5a')]][_0x2869('0x22')]=0x1;queues[_0x2461d9['transfereeuniqueid']]=_[_0x2869('0x5b')](queues[_0x2461d9[_0x2869('0x5a')]]);queues[_0x2461d9['transfereeuniqueid']][_0x2869('0xe')]=_0x2461d9[_0x2869('0x5c')];queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x22')]=0x2;queues[_0x2461d9['transfereeuniqueid']]['calleridnum']=queues[_0x2461d9[_0x2869('0x55')]]['calleridnum'];queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x5d')]=queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0x5d')];queues[_0x2461d9[_0x2869('0x4a')]]['queuecallerjoinAt']=utils[_0x2869('0x17')]();queues[_0x2461d9['transfereeuniqueid']][_0x2869('0x1c')]=utils['now']();queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x37')]=0x0;queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x5e')]=0x0;utils[_0x2869('0x13')](util['format'](_0x2869('0x5f'),_0x2461d9[_0x2869('0x51')],queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x21')],queues[_0x2461d9[_0x2869('0x4a')]][_0x2869('0x7')],queues[_0x2461d9['transfereeuniqueid']][_0x2869('0x5d')]));}else{utils[_0x2869('0x13')](util[_0x2869('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2461d9[_0x2869('0x51')],queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x21')],_0x2461d9[_0x2869('0x55')]));queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0xe')]=_0x2461d9[_0x2869('0x55')];}}}else if(_0x2461d9[_0x2869('0x60')]==_0x2461d9['secondtransfererlinkedid']){if(!_[_0x2869('0x1a')](queues[_0x2461d9['origtransfererlinkedid']])){utils[_0x2869('0x13')](util[_0x2869('0x2')](_0x2869('0x61'),_0x2461d9[_0x2869('0x51')],queues[_0x2461d9['origtransfererlinkedid']][_0x2869('0x21')],_0x2461d9[_0x2869('0x60')],_0x2461d9['secondtransfererexten']));queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x44')]=!![];queues[_0x2461d9['origtransfererlinkedid']][_0x2869('0x56')]=_0x2869('0x57');queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x4c')]=_0x2461d9[_0x2869('0x62')];queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x58')]=_0x2461d9[_0x2869('0x60')];queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x2869('0x1a')](queues[_0x2461d9['secondtransfererlinkedid']])){if(_0x2461d9['transfertargetlinkedid']&&queues[_0x2461d9[_0x2869('0x63')]]){queues[_0x2461d9['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x2461d9['transfertargetuniqueid']]=_['clone'](queues[_0x2461d9[_0x2869('0x63')]]);queues[_0x2461d9['transfertargetuniqueid']][_0x2869('0xe')]=_0x2461d9[_0x2869('0x5c')];queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x22')]=0x2;queues[_0x2461d9['transfertargetuniqueid']]['calleridnum']=queues[_0x2461d9[_0x2869('0x52')]][_0x2869('0x7')];queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x5d')]=queues[_0x2461d9['origtransfererlinkedid']][_0x2869('0x5d')];queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x39')]=utils[_0x2869('0x17')]();queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x1c')]=utils[_0x2869('0x17')]();queues[_0x2461d9[_0x2869('0x5c')]]['holdtime']=0x0;queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x5e')]=0x0;utils[_0x2869('0x13')](util[_0x2869('0x2')](_0x2869('0x64'),_0x2461d9[_0x2869('0x51')],queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x21')],queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0xe')],queues[_0x2461d9['transfertargetuniqueid']]['calleridnum'],queues[_0x2461d9[_0x2869('0x5c')]][_0x2869('0x5d')]));}else{utils['info'](util[_0x2869('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2461d9['origtransfereruniqueid'],queues[_0x2461d9[_0x2869('0x55')]][_0x2869('0x21')],_0x2461d9[_0x2869('0x52')]));queues[_0x2461d9['secondtransfererlinkedid']][_0x2869('0xe')]=_0x2461d9[_0x2869('0x52')];}}}}catch(_0x1d66ec){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x50'),_0x2461d9[_0x2869('0x51')]),_0x1d66ec);}};exports['musiconholdstart']=function(_0x2cc7e7){try{if(!_[_0x2869('0x1a')](queues[_0x2cc7e7[_0x2869('0xf')]])){utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x65'),_0x2cc7e7[_0x2869('0xf')]),_0x2cc7e7);queues[_0x2cc7e7['uniqueid']][_0x2869('0x66')]=utils['now']();utils[_0x2869('0x13')](util[_0x2869('0x2')](_0x2869('0x67'),_0x2cc7e7['uniqueid'],queues[_0x2cc7e7[_0x2869('0xf')]][_0x2869('0x21')],queues[_0x2cc7e7[_0x2869('0xf')]][_0x2869('0x66')]));}}catch(_0x4641d0){utils[_0x2869('0x18')](util[_0x2869('0x2')](_0x2869('0x65'),_0x2cc7e7[_0x2869('0xf')]),_0x4641d0);}};exports[_0x2869('0x68')]=function(_0x508bbc){try{if(!_[_0x2869('0x1a')](queues[_0x508bbc[_0x2869('0xf')]])){if(!_[_0x2869('0x1a')](queues[_0x508bbc['uniqueid']][_0x2869('0x66')])){utils[_0x2869('0x11')](util[_0x2869('0x2')](_0x2869('0x69'),_0x508bbc['uniqueid']),_0x508bbc);queues[_0x508bbc[_0x2869('0xf')]][_0x2869('0x5e')]+=utils[_0x2869('0x38')](utils[_0x2869('0x17')](),queues[_0x508bbc['uniqueid']][_0x2869('0x66')]);utils[_0x2869('0x13')](util['format'](_0x2869('0x6a'),_0x508bbc['uniqueid'],queues[_0x508bbc[_0x2869('0xf')]][_0x2869('0x21')],queues[_0x508bbc[_0x2869('0xf')]]['mohtime']));delete queues[_0x508bbc[_0x2869('0xf')]][_0x2869('0x66')];}}}catch(_0x51dc1e){utils['error'](util[_0x2869('0x2')](_0x2869('0x69'),_0x508bbc[_0x2869('0xf')]),_0x51dc1e);}}; \ No newline at end of file +var _0xd231=['queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','isNil','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','lastAssignedTo','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%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','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','position','assign','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt'];(function(_0x243e4c,_0x5614b7){var _0xf2e845=function(_0x1f7dc4){while(--_0x1f7dc4){_0x243e4c['push'](_0x243e4c['shift']());}};_0xf2e845(++_0x5614b7);}(_0xd231,0x1ed));var _0x1d23=function(_0x5599a0,_0x33c7ef){_0x5599a0=_0x5599a0-0x0;var _0xcb1ae9=_0xd231[_0x5599a0];return _0xcb1ae9;};'use strict';var _=require('lodash');var util=require(_0x1d23('0x0'));var utils=require(_0x1d23('0x1'));var queues={};function writeDB(_0x584e0d){utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x4'),_0x584e0d[_0x1d23('0x5')],_0x584e0d[_0x1d23('0x6')],_0x584e0d[_0x1d23('0x7')],_0x584e0d['lastAssignedTo'],_0x584e0d[_0x1d23('0x8')],_0x584e0d[_0x1d23('0x9')],_0x584e0d[_0x1d23('0xa')]));if(_0x584e0d['queue']){utils[_0x1d23('0xb')](_0x584e0d[_0x1d23('0x7')])['then'](function(_0x39cc7b){if(_0x39cc7b){_0x584e0d[_0x1d23('0xc')]=_0x39cc7b[_0x1d23('0xc')];}utils[_0x1d23('0xd')](_0x1d23('0xe'),_0x584e0d);});}else{utils[_0x1d23('0xd')](_0x1d23('0xe'),_0x584e0d);}if(_0x584e0d[_0x1d23('0xf')]){delete queues[_0x584e0d[_0x1d23('0xf')]];}else{delete queues[_0x584e0d[_0x1d23('0x5')]];}}exports['queuecallerjoin']=function(_0x148184){try{utils[_0x1d23('0x10')](util['format']('[%s][queues][queuecallerjoin]',_0x148184['uniqueid']),_0x148184);utils['info'](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x148184[_0x1d23('0x5')],_0x148184['queue'],_0x148184[_0x1d23('0x11')]));queues[_0x148184[_0x1d23('0x5')]]=_[_0x1d23('0x12')](_0x148184,{'originalposition':_0x148184[_0x1d23('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x12d79f){utils['error'](util[_0x1d23('0x3')](_0x1d23('0x13'),_0x148184[_0x1d23('0x5')]),_0x12d79f);}};exports['hangup']=function(_0x330d35){try{if(!_['isNil'](queues[_0x330d35[_0x1d23('0x5')]])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x14'),_0x330d35['uniqueid']),_0x330d35);if(queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0x15')]){if(!queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0x16')]&&!queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0x17')]){queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0x18')]=!![];queues[_0x330d35['uniqueid']][_0x1d23('0x19')]=utils[_0x1d23('0x1a')]();queues[_0x330d35[_0x1d23('0x5')]]['queuecallerexitreason']=_0x1d23('0x1b');}utils[_0x1d23('0x2')](util[_0x1d23('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x330d35[_0x1d23('0x5')],queues[_0x330d35[_0x1d23('0x5')]]['name'],queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0xa')]));writeDB(queues[_0x330d35[_0x1d23('0x5')]]);}else if(queues[_0x330d35['uniqueid']][_0x1d23('0xf')]){utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x1c'),_0x330d35['uniqueid'],queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0x1d')],queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0xf')]));queues[queues[_0x330d35[_0x1d23('0x5')]]['transfereduniqueid']]=queues[_0x330d35[_0x1d23('0x5')]];queues[queues[_0x330d35[_0x1d23('0x5')]][_0x1d23('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x330d35[_0x1d23('0x5')]];}}}catch(_0x1b82da){utils['error'](util[_0x1d23('0x3')](_0x1d23('0x14'),_0x330d35[_0x1d23('0x5')]),_0x1b82da);}};exports[_0x1d23('0x1e')]=function(_0x5cf341){try{utils['debug'](util[_0x1d23('0x3')](_0x1d23('0x1f'),_0x5cf341[_0x1d23('0x5')]),_0x5cf341);if(!_['isNil'](_0x5cf341[_0x1d23('0x20')][_0x1d23('0x21')])&&_0x5cf341['value'][_0x1d23('0x22')]()!=='CONTINUE'){if(!_[_0x1d23('0x23')](queues[_0x5cf341['uniqueid']])){queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x16')]=![];queues[_0x5cf341['uniqueid']][_0x1d23('0x24')]=null;queues[_0x5cf341[_0x1d23('0x5')]]['queuecallerexit']=!![];queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x25')]=utils[_0x1d23('0x1a')]();queues[_0x5cf341[_0x1d23('0x5')]]['queuecallerexitreason']=_0x5cf341['value'][_0x1d23('0x22')]();utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x26'),_0x5cf341[_0x1d23('0x5')],queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x1d')],_0x5cf341[_0x1d23('0x27')],queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0xa')]));writeDB(queues[_0x5cf341[_0x1d23('0x5')]]);}}else if(!_[_0x1d23('0x23')](_0x5cf341[_0x1d23('0x20')][_0x1d23('0x28')])){if(!_['isNil'](queues[_0x5cf341[_0x1d23('0x5')]])&&!queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x16')]){queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x16')]=![];queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x24')]=null;queues[_0x5cf341['uniqueid']]['queuecallerexit']=!![];queues[_0x5cf341[_0x1d23('0x5')]]['queuecallerexitAt']=utils[_0x1d23('0x1a')]();queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0xa')]='EXITWITHKEY';utils['info'](util[_0x1d23('0x3')](_0x1d23('0x29'),_0x5cf341[_0x1d23('0x5')],queues[_0x5cf341[_0x1d23('0x5')]][_0x1d23('0x1d')],_0x5cf341[_0x1d23('0x27')],queues[_0x5cf341['uniqueid']][_0x1d23('0xa')]));}}}catch(_0x819585){utils[_0x1d23('0x2a')](util[_0x1d23('0x3')](_0x1d23('0x1f'),_0x5cf341[_0x1d23('0x5')]),_0x819585);}};exports[_0x1d23('0x16')]=function(_0x51b510){try{if(!_[_0x1d23('0x23')](queues[_0x51b510[_0x1d23('0x5')]])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x2b'),_0x51b510[_0x1d23('0x5')]),_0x51b510);queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0x17')]=![];queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0x25')]=null;queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0x16')]=!![];queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0x24')]=utils[_0x1d23('0x1a')]();queues[_0x51b510[_0x1d23('0x5')]]['queuecallerexitreason']=_0x1d23('0x2c');utils['info'](util[_0x1d23('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x51b510[_0x1d23('0x5')],queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0x1d')],queues[_0x51b510[_0x1d23('0x5')]][_0x1d23('0xa')]));}}catch(_0x334bb0){utils[_0x1d23('0x2a')](util['format'](_0x1d23('0x2b'),_0x51b510[_0x1d23('0x5')]),_0x334bb0);}};exports[_0x1d23('0x2d')]=function(_0x999142){try{if(!_[_0x1d23('0x23')](queues[_0x999142[_0x1d23('0x5')]])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x2e'),_0x999142[_0x1d23('0x5')]),_0x999142);utils['info'](util['format'](_0x1d23('0x2f'),_0x999142[_0x1d23('0x5')],queues[_0x999142[_0x1d23('0x5')]]['name'],_0x999142[_0x1d23('0x30')],_0x999142[_0x1d23('0x31')]));queues[_0x999142['uniqueid']][_0x1d23('0x2d')]=!![];queues[_0x999142[_0x1d23('0x5')]][_0x1d23('0x15')]=utils[_0x1d23('0x1a')]();queues[_0x999142[_0x1d23('0x5')]]['holdtime']=utils['diffTime'](queues[_0x999142['uniqueid']][_0x1d23('0x15')],queues[_0x999142[_0x1d23('0x5')]][_0x1d23('0x32')]);queues[_0x999142['uniqueid']]['position']=_0x999142[_0x1d23('0x11')];queues[_0x999142[_0x1d23('0x5')]][_0x1d23('0x33')]=_0x999142[_0x1d23('0x33')];queues[_0x999142['uniqueid']][_0x1d23('0x30')]=_0x999142[_0x1d23('0x30')];queues[_0x999142[_0x1d23('0x5')]][_0x1d23('0x31')]=_0x999142[_0x1d23('0x31')];}}catch(_0x539ee2){utils[_0x1d23('0x2a')](util['format']('[%s][queues][queuecallerleave]',_0x999142[_0x1d23('0x5')]),_0x539ee2);}};exports[_0x1d23('0x34')]=function(_0x538831){try{if(!_['isNil'](queues[_0x538831['uniqueid']])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x35'),_0x538831['uniqueid']),_0x538831);utils[_0x1d23('0x2')](util[_0x1d23('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x538831[_0x1d23('0x5')],queues[_0x538831['uniqueid']][_0x1d23('0x1d')],_0x538831[_0x1d23('0x36')],_0x538831[_0x1d23('0x37')]));queues[_0x538831['uniqueid']][_0x1d23('0x16')]=![];queues[_0x538831[_0x1d23('0x5')]][_0x1d23('0x16')]=![];queues[_0x538831[_0x1d23('0x5')]]['queuecallerabandonAt']=null;queues[_0x538831['uniqueid']]['queuecallerexit']=![];queues[_0x538831[_0x1d23('0x5')]][_0x1d23('0xa')]=null;queues[_0x538831[_0x1d23('0x5')]][_0x1d23('0x25')]=null;queues[_0x538831['uniqueid']][_0x1d23('0x38')]=!![];queues[_0x538831[_0x1d23('0x5')]]['accountcode']=_0x538831[_0x1d23('0x37')];queues[_0x538831[_0x1d23('0x5')]]['lastAssignedTo']=_0x538831['membername'];}}catch(_0xd1b5f7){utils[_0x1d23('0x2a')](util[_0x1d23('0x3')](_0x1d23('0x35'),_0x538831[_0x1d23('0x5')]),_0xd1b5f7);}};exports[_0x1d23('0x39')]=function(_0x2e1257){try{if(!_[_0x1d23('0x23')](queues[_0x2e1257['uniqueid']])){if(queues[_0x2e1257['uniqueid']][_0x1d23('0x15')]){utils['debug'](util[_0x1d23('0x3')]('[%s][queues][agentcomplete]',_0x2e1257[_0x1d23('0x5')]),_0x2e1257);queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x16')]=![];queues[_0x2e1257[_0x1d23('0x5')]]['queuecallerabandon']=![];queues[_0x2e1257['uniqueid']][_0x1d23('0x24')]=null;queues[_0x2e1257[_0x1d23('0x5')]]['queuecallerexit']=![];queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x25')]=null;queues[_0x2e1257[_0x1d23('0x5')]]['assigned']=!![];queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x3a')]=_0x2e1257[_0x1d23('0x36')];queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x18')]=!![];queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x19')]=utils['now']();if(_0x2e1257[_0x1d23('0x3b')]==_0x1d23('0x3c')){if(!queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x3c')]){queues[_0x2e1257['uniqueid']][_0x1d23('0xa')]=_0x1d23('0x3d');}}else{queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0xa')]=_0x1d23('0x3e')+_0x2e1257[_0x1d23('0x3b')]['toUpperCase']();}utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x3f'),_0x2e1257[_0x1d23('0x5')],queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0x1d')],_0x2e1257['membername'],queues[_0x2e1257[_0x1d23('0x5')]][_0x1d23('0xa')]));writeDB(queues[_0x2e1257['uniqueid']]);}}}catch(_0x5b30dd){utils[_0x1d23('0x2a')](util[_0x1d23('0x3')](_0x1d23('0x40'),_0x2e1257[_0x1d23('0x5')]),_0x5b30dd);}};exports[_0x1d23('0x41')]=function(_0x58d46d){try{if(!_[_0x1d23('0x23')](queues[_0x58d46d[_0x1d23('0x42')]])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x43'),_0x58d46d[_0x1d23('0x5')]),_0x58d46d);queues[_0x58d46d[_0x1d23('0x42')]][_0x1d23('0x3c')]=!![];queues[_0x58d46d['transfereeuniqueid']][_0x1d23('0x44')]='BLIND';queues[_0x58d46d[_0x1d23('0x42')]]['transferexten']=_0x58d46d[_0x1d23('0x45')];queues[_0x58d46d[_0x1d23('0x42')]][_0x1d23('0x46')]=_0x58d46d[_0x1d23('0x42')];queues[_0x58d46d[_0x1d23('0x42')]][_0x1d23('0xa')]=_0x1d23('0x47');utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x48'),_0x58d46d[_0x1d23('0x5')],queues[_0x58d46d[_0x1d23('0x42')]]['name'],_0x58d46d[_0x1d23('0x42')],_0x58d46d[_0x1d23('0x45')]));}}catch(_0x50c2a2){utils[_0x1d23('0x2a')](util[_0x1d23('0x3')](_0x1d23('0x43'),_0x58d46d[_0x1d23('0x5')]),_0x50c2a2);}};exports[_0x1d23('0x49')]=function(_0x11c291){try{utils[_0x1d23('0x10')](util['format']('[%s][queues][attendedtransfer]',_0x11c291[_0x1d23('0x4a')]),_0x11c291);if(_0x11c291[_0x1d23('0x4a')]==_0x11c291[_0x1d23('0x4b')]){if(!_['isNil'](queues[_0x11c291[_0x1d23('0x4c')]])){utils['info'](util[_0x1d23('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x11c291[_0x1d23('0x4a')],queues[_0x11c291['secondtransfererlinkedid']][_0x1d23('0x1d')],_0x11c291[_0x1d23('0x4d')]));queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x3c')]=!![];queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x44')]=_0x1d23('0x4e');queues[_0x11c291['secondtransfererlinkedid']][_0x1d23('0x4f')]=_0x11c291[_0x1d23('0x4d')];queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x46')]=_0x11c291[_0x1d23('0x4a')];queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0xa')]=_0x1d23('0x50');}if(!_[_0x1d23('0x23')](queues[_0x11c291[_0x1d23('0x4b')]])){if(_0x11c291['transfereelinkedid']&&queues[_0x11c291[_0x1d23('0x51')]]){queues[_0x11c291[_0x1d23('0x51')]][_0x1d23('0x52')]=0x1;queues[_0x11c291[_0x1d23('0x42')]]=_[_0x1d23('0x53')](queues[_0x11c291[_0x1d23('0x51')]]);queues[_0x11c291['transfereeuniqueid']][_0x1d23('0xf')]=_0x11c291[_0x1d23('0x54')];queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x52')]=0x2;queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x8')]=queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x8')];queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x55')]=queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x55')];queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x32')]=utils['now']();queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x15')]=utils[_0x1d23('0x1a')]();queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x56')]=0x0;queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x57')]=0x0;utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x58'),_0x11c291[_0x1d23('0x4a')],queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x1d')],queues[_0x11c291[_0x1d23('0x42')]][_0x1d23('0x8')],queues[_0x11c291['transfereeuniqueid']]['calleridname']));}else{utils['info'](util[_0x1d23('0x3')](_0x1d23('0x59'),_0x11c291[_0x1d23('0x4a')],queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x1d')],_0x11c291[_0x1d23('0x4c')]));queues[_0x11c291[_0x1d23('0x4b')]]['transfereduniqueid']=_0x11c291[_0x1d23('0x4c')];}}}else if(_0x11c291[_0x1d23('0x5a')]==_0x11c291[_0x1d23('0x4c')]){if(!_[_0x1d23('0x23')](queues[_0x11c291[_0x1d23('0x4b')]])){utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x5b'),_0x11c291['origtransfereruniqueid'],queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x1d')],_0x11c291['secondtransfereruniqueid'],_0x11c291[_0x1d23('0x5c')]));queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x3c')]=!![];queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x44')]=_0x1d23('0x4e');queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x4f')]=_0x11c291[_0x1d23('0x5c')];queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x46')]=_0x11c291[_0x1d23('0x5a')];queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0xa')]=_0x1d23('0x50');}if(!_[_0x1d23('0x23')](queues[_0x11c291['secondtransfererlinkedid']])){if(_0x11c291[_0x1d23('0x5d')]&&queues[_0x11c291['transfertargetlinkedid']]){queues[_0x11c291[_0x1d23('0x5d')]][_0x1d23('0x52')]=0x1;queues[_0x11c291[_0x1d23('0x54')]]=_['clone'](queues[_0x11c291[_0x1d23('0x5d')]]);queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0xf')]=_0x11c291[_0x1d23('0x54')];queues[_0x11c291['transfertargetuniqueid']][_0x1d23('0x52')]=0x2;queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0x8')]=queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x8')];queues[_0x11c291['transfertargetuniqueid']][_0x1d23('0x55')]=queues[_0x11c291[_0x1d23('0x4b')]][_0x1d23('0x55')];queues[_0x11c291[_0x1d23('0x54')]]['queuecallerjoinAt']=utils[_0x1d23('0x1a')]();queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0x15')]=utils[_0x1d23('0x1a')]();queues[_0x11c291[_0x1d23('0x54')]]['holdtime']=0x0;queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0x57')]=0x0;utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x5e'),_0x11c291[_0x1d23('0x4a')],queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0x1d')],queues[_0x11c291['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x11c291[_0x1d23('0x54')]][_0x1d23('0x8')],queues[_0x11c291[_0x1d23('0x54')]]['calleridname']));}else{utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x59'),_0x11c291[_0x1d23('0x4a')],queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0x1d')],_0x11c291['origtransfererlinkedid']));queues[_0x11c291[_0x1d23('0x4c')]][_0x1d23('0xf')]=_0x11c291[_0x1d23('0x4b')];}}}}catch(_0x3eb607){utils[_0x1d23('0x2a')](util[_0x1d23('0x3')](_0x1d23('0x5f'),_0x11c291['origtransfereruniqueid']),_0x3eb607);}};exports[_0x1d23('0x60')]=function(_0x4a4ee8){try{if(!_[_0x1d23('0x23')](queues[_0x4a4ee8[_0x1d23('0x5')]])){utils[_0x1d23('0x10')](util[_0x1d23('0x3')](_0x1d23('0x61'),_0x4a4ee8[_0x1d23('0x5')]),_0x4a4ee8);queues[_0x4a4ee8[_0x1d23('0x5')]]['musiconholdstartAt']=utils[_0x1d23('0x1a')]();utils[_0x1d23('0x2')](util[_0x1d23('0x3')](_0x1d23('0x62'),_0x4a4ee8[_0x1d23('0x5')],queues[_0x4a4ee8[_0x1d23('0x5')]][_0x1d23('0x1d')],queues[_0x4a4ee8[_0x1d23('0x5')]][_0x1d23('0x63')]));}}catch(_0xff97b){utils['error'](util[_0x1d23('0x3')]('[%s][queues][musiconholdstart]',_0x4a4ee8[_0x1d23('0x5')]),_0xff97b);}};exports['musiconholdstop']=function(_0x2ab4f5){try{if(!_[_0x1d23('0x23')](queues[_0x2ab4f5[_0x1d23('0x5')]])){if(!_[_0x1d23('0x23')](queues[_0x2ab4f5[_0x1d23('0x5')]][_0x1d23('0x63')])){utils['debug'](util['format'](_0x1d23('0x64'),_0x2ab4f5['uniqueid']),_0x2ab4f5);queues[_0x2ab4f5[_0x1d23('0x5')]][_0x1d23('0x57')]+=utils[_0x1d23('0x65')](utils['now'](),queues[_0x2ab4f5[_0x1d23('0x5')]][_0x1d23('0x63')]);utils[_0x1d23('0x2')](util['format'](_0x1d23('0x66'),_0x2ab4f5[_0x1d23('0x5')],queues[_0x2ab4f5[_0x1d23('0x5')]][_0x1d23('0x1d')],queues[_0x2ab4f5[_0x1d23('0x5')]][_0x1d23('0x57')]));delete queues[_0x2ab4f5[_0x1d23('0x5')]]['musiconholdstartAt'];}}}catch(_0xdcdcc4){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x2ab4f5[_0x1d23('0x5')]),_0xdcdcc4);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 560591e..0439f24 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 _0x9550=['monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','error','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','.wav49','value','replace','.WAV','find'];(function(_0x44c7a2,_0x449be7){var _0x3efc90=function(_0x114726){while(--_0x114726){_0x44c7a2['push'](_0x44c7a2['shift']());}};_0x3efc90(++_0x449be7);}(_0x9550,0x1cc));var _0x0955=function(_0x58afe8,_0x4cdb7d){_0x58afe8=_0x58afe8-0x0;var _0x2b397a=_0x9550[_0x58afe8];return _0x2b397a;};'use strict';var _=require('lodash');var util=require(_0x0955('0x0'));var utils=require(_0x0955('0x1'));var recordings={};function writeDB(_0x5739dc){utils[_0x0955('0x2')](util[_0x0955('0x3')](_0x0955('0x4'),_0x5739dc[_0x0955('0x5')]));if(_0x5739dc[_0x0955('0x6')]){utils[_0x0955('0x7')](_0x5739dc[_0x0955('0x6')])[_0x0955('0x8')](function(_0x1c7a1e){if(_0x1c7a1e){_0x5739dc[_0x0955('0x9')]=_0x1c7a1e['name'];_0x5739dc[_0x0955('0xa')]=_0x1c7a1e['id'];}utils['request']('CreateVoiceRecording',_0x5739dc);});}else{utils[_0x0955('0xb')](_0x0955('0xc'),_0x5739dc);}}exports[_0x0955('0xd')]=function(_0x1c6b1c){try{utils[_0x0955('0xe')](util[_0x0955('0x3')](_0x0955('0xf'),_0x1c6b1c[_0x0955('0x5')]),_0x1c6b1c);if(_0x1c6b1c[_0x0955('0x5')]==_0x1c6b1c[_0x0955('0x10')]){utils['info'](util[_0x0955('0x3')](_0x0955('0x11'),_0x1c6b1c['uniqueid'],_0x1c6b1c['context'],_0x1c6b1c[_0x0955('0x12')]));recordings[_0x1c6b1c[_0x0955('0x5')]]={'uniqueid':_0x1c6b1c['uniqueid'],'accountcode':_0x1c6b1c[_0x0955('0x6')],'exten':_0x1c6b1c[_0x0955('0x12')],'context':_0x1c6b1c[_0x0955('0x13')],'channel':_0x1c6b1c[_0x0955('0x14')],'monitors':[]};}}catch(_0x44369a){utils['error'](util[_0x0955('0x3')](_0x0955('0xf'),_0x1c6b1c[_0x0955('0x5')]),_0x44369a);}};exports[_0x0955('0x15')]=function(_0x4691f8){try{utils[_0x0955('0xe')](util[_0x0955('0x3')](_0x0955('0x16'),_0x4691f8[_0x0955('0x5')]),_0x4691f8);if(!_[_0x0955('0x17')](recordings[_0x4691f8[_0x0955('0x5')]])&&_0x4691f8[_0x0955('0x18')]==0x6){utils['info'](util[_0x0955('0x3')](_0x0955('0x19'),_0x4691f8[_0x0955('0x5')],_0x4691f8[_0x0955('0x13')],_0x4691f8[_0x0955('0x14')]));}else if(!_[_0x0955('0x17')](recordings[_0x4691f8[_0x0955('0x10')]])&&_0x4691f8[_0x0955('0x18')]==0x6&&_0x4691f8['context']!='transfer'){utils[_0x0955('0x2')](util[_0x0955('0x3')](_0x0955('0x1a'),_0x4691f8['uniqueid'],_0x4691f8[_0x0955('0x10')],_0x4691f8['context'],_0x4691f8['channel']));recordings[_0x4691f8['linkedid']][_0x0955('0x6')]=_0x4691f8['accountcode'];}}catch(_0x8942e0){utils['error'](util[_0x0955('0x3')](_0x0955('0x16'),_0x4691f8[_0x0955('0x5')]),_0x8942e0);}};exports['varset']=function(_0x1b6a50){try{if(!_[_0x0955('0x17')](_0x1b6a50[_0x0955('0x1b')])&&!_[_0x0955('0x17')](_0x1b6a50['variable'][_0x0955('0x1c')])){utils[_0x0955('0xe')](util['format'](_0x0955('0x1d'),_0x1b6a50[_0x0955('0x5')]),_0x1b6a50);utils[_0x0955('0x2')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1b6a50[_0x0955('0x5')],_0x1b6a50['variable'],_0x1b6a50['value']));if(_[_0x0955('0x1e')](_0x1b6a50['value'],_0x0955('0x1f'))){_0x1b6a50['value']=_0x1b6a50[_0x0955('0x20')][_0x0955('0x21')](_0x0955('0x1f'),_0x0955('0x22'));}if(recordings[_0x1b6a50[_0x0955('0x10')]]){var _0x544aa7=_[_0x0955('0x23')](recordings[_0x1b6a50[_0x0955('0x10')]][_0x0955('0x24')],{'value':_0x1b6a50[_0x0955('0x20')]});if(_[_0x0955('0x17')](_0x544aa7)){recordings[_0x1b6a50['linkedid']][_0x0955('0x24')][_0x0955('0x25')]({'value':_0x1b6a50[_0x0955('0x20')]});}}}}catch(_0x2f6714){utils['error'](util[_0x0955('0x3')](_0x0955('0x1d'),_0x1b6a50[_0x0955('0x5')]),_0x2f6714);}};exports[_0x0955('0x26')]=function(_0x26aee0){try{if(!_['isNil'](recordings[_0x26aee0[_0x0955('0x5')]])){utils['debug'](util[_0x0955('0x3')]('[%s][recordings][hangup]',_0x26aee0['uniqueid']),_0x26aee0);utils[_0x0955('0x2')](util[_0x0955('0x3')](_0x0955('0x27'),_0x26aee0[_0x0955('0x5')],_0x26aee0[_0x0955('0x28')],_0x26aee0['calleridname'],_0x26aee0[_0x0955('0x29')]));recordings[_0x26aee0[_0x0955('0x5')]]['calleridnum']=_0x26aee0[_0x0955('0x28')];recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x2a')]=_0x26aee0[_0x0955('0x2a')];recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x2b')]=_0x26aee0[_0x0955('0x2b')];recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x2c')]=_0x26aee0[_0x0955('0x2c')];if(recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x2d')]=='outbound'&&recordings[_0x26aee0['uniqueid']][_0x0955('0x6')]){recordings[_0x26aee0['uniqueid']][_0x0955('0x2b')]=recordings[_0x26aee0['uniqueid']][_0x0955('0x6')];recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x2c')]='';}recordings[_0x26aee0[_0x0955('0x5')]][_0x0955('0x24')]['forEach'](function(_0x476dbd){var _0x722a12=_['clone'](recordings[_0x26aee0[_0x0955('0x5')]]);_0x722a12[_0x0955('0x20')]=_0x476dbd[_0x0955('0x20')];writeDB(_0x722a12);});delete recordings[_0x26aee0[_0x0955('0x5')]];}}catch(_0x4b000e){utils[_0x0955('0x2e')](util[_0x0955('0x3')](_0x0955('0x2f'),_0x26aee0[_0x0955('0x5')]),_0x4b000e);}};exports[_0x0955('0x30')]=function(_0x542adc){try{if(!_[_0x0955('0x17')](recordings[_0x542adc['uniqueid']])){utils[_0x0955('0xe')](util[_0x0955('0x3')](_0x0955('0x31'),_0x542adc[_0x0955('0x5')]),_0x542adc);utils[_0x0955('0x2')](util[_0x0955('0x3')](_0x0955('0x32'),_0x542adc['uniqueid'],_0x542adc['application'],_0x542adc[_0x0955('0x33')]));if(_0x542adc[_0x0955('0x34')]['toLowerCase']()==_0x0955('0x35')&&_[_0x0955('0x36')](_0x542adc[_0x0955('0x33')][_0x0955('0x37')](),'cdr')){var _0x149e9c=_0x542adc[_0x0955('0x33')][_0x0955('0x38')]('=');var _0x578f3a=_0x149e9c[0x0][_0x0955('0x39')](_0x149e9c[0x0][_0x0955('0x3a')]('(')+0x1,_0x149e9c[0x0][_0x0955('0x3a')](')'));var _0x1a3bf1=_0x149e9c[0x1];recordings[_0x542adc[_0x0955('0x5')]][_0x578f3a]=_0x1a3bf1;}}}catch(_0x1224a3){utils['error'](util[_0x0955('0x3')](_0x0955('0x31'),_0x542adc[_0x0955('0x5')]),_0x1224a3);}};exports['queuecallerjoin']=function(_0x1ebf32){try{if(!_[_0x0955('0x17')](recordings[_0x1ebf32['uniqueid']])){utils[_0x0955('0xe')](util['format'](_0x0955('0x3b'),_0x1ebf32[_0x0955('0x5')]),_0x1ebf32);utils[_0x0955('0x2')](util[_0x0955('0x3')](_0x0955('0x3c'),_0x1ebf32[_0x0955('0x5')],_0x1ebf32[_0x0955('0x3d')]));recordings[_0x1ebf32['uniqueid']][_0x0955('0x3d')]=_0x1ebf32['queue'];}}catch(_0x1a0c42){utils[_0x0955('0x2e')](util[_0x0955('0x3')](_0x0955('0x3b'),_0x1ebf32[_0x0955('0x5')]),_0x1a0c42);}}; \ No newline at end of file +var _0xc4b0=['split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','newchannel','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith'];(function(_0x50109c,_0x46cd21){var _0x439a57=function(_0x418b73){while(--_0x418b73){_0x50109c['push'](_0x50109c['shift']());}};_0x439a57(++_0x46cd21);}(_0xc4b0,0x12c));var _0x0c4b=function(_0x46dc29,_0x18c45a){_0x46dc29=_0x46dc29-0x0;var _0x4bbb8d=_0xc4b0[_0x46dc29];return _0x4bbb8d;};'use strict';var _=require(_0x0c4b('0x0'));var util=require(_0x0c4b('0x1'));var utils=require(_0x0c4b('0x2'));var recordings={};function writeDB(_0x3854ee){utils[_0x0c4b('0x3')](util['format']('[%s][recordings][writeDB]',_0x3854ee[_0x0c4b('0x4')]));if(_0x3854ee[_0x0c4b('0x5')]){utils[_0x0c4b('0x6')](_0x3854ee['accountcode'])[_0x0c4b('0x7')](function(_0x4b49d6){if(_0x4b49d6){_0x3854ee[_0x0c4b('0x8')]=_0x4b49d6[_0x0c4b('0x9')];_0x3854ee[_0x0c4b('0xa')]=_0x4b49d6['id'];}utils['request']('CreateVoiceRecording',_0x3854ee);});}else{utils[_0x0c4b('0xb')]('CreateVoiceRecording',_0x3854ee);}}exports[_0x0c4b('0xc')]=function(_0x54ab85){try{utils['debug'](util[_0x0c4b('0xd')]('[%s][recordings][newchannel]',_0x54ab85['uniqueid']),_0x54ab85);if(_0x54ab85[_0x0c4b('0x4')]==_0x54ab85[_0x0c4b('0xe')]){utils[_0x0c4b('0x3')](util['format'](_0x0c4b('0xf'),_0x54ab85[_0x0c4b('0x4')],_0x54ab85[_0x0c4b('0x10')],_0x54ab85[_0x0c4b('0x11')]));recordings[_0x54ab85['uniqueid']]={'uniqueid':_0x54ab85[_0x0c4b('0x4')],'accountcode':_0x54ab85['accountcode'],'exten':_0x54ab85[_0x0c4b('0x11')],'context':_0x54ab85[_0x0c4b('0x10')],'channel':_0x54ab85[_0x0c4b('0x12')],'monitors':[]};}}catch(_0x4a9117){utils['error'](util[_0x0c4b('0xd')](_0x0c4b('0x13'),_0x54ab85[_0x0c4b('0x4')]),_0x4a9117);}};exports['newstate']=function(_0x27f267){try{utils['debug'](util[_0x0c4b('0xd')](_0x0c4b('0x14'),_0x27f267[_0x0c4b('0x4')]),_0x27f267);if(!_['isNil'](recordings[_0x27f267[_0x0c4b('0x4')]])&&_0x27f267[_0x0c4b('0x15')]==0x6){utils[_0x0c4b('0x3')](util[_0x0c4b('0xd')](_0x0c4b('0x16'),_0x27f267[_0x0c4b('0x4')],_0x27f267['context'],_0x27f267[_0x0c4b('0x12')]));}else if(!_[_0x0c4b('0x17')](recordings[_0x27f267[_0x0c4b('0xe')]])&&_0x27f267[_0x0c4b('0x15')]==0x6&&_0x27f267[_0x0c4b('0x10')]!=_0x0c4b('0x18')){utils[_0x0c4b('0x3')](util['format'](_0x0c4b('0x19'),_0x27f267[_0x0c4b('0x4')],_0x27f267[_0x0c4b('0xe')],_0x27f267[_0x0c4b('0x10')],_0x27f267[_0x0c4b('0x12')]));recordings[_0x27f267[_0x0c4b('0xe')]][_0x0c4b('0x5')]=_0x27f267[_0x0c4b('0x5')];}}catch(_0x1a0c1c){utils[_0x0c4b('0x1a')](util[_0x0c4b('0xd')](_0x0c4b('0x14'),_0x27f267[_0x0c4b('0x4')]),_0x1a0c1c);}};exports[_0x0c4b('0x1b')]=function(_0x585cfd){try{if(!_[_0x0c4b('0x17')](_0x585cfd[_0x0c4b('0x1c')])&&!_[_0x0c4b('0x17')](_0x585cfd[_0x0c4b('0x1c')][_0x0c4b('0x1d')])){utils[_0x0c4b('0x1e')](util[_0x0c4b('0xd')]('[%s][recordings][varset]',_0x585cfd[_0x0c4b('0x4')]),_0x585cfd);utils[_0x0c4b('0x3')](util[_0x0c4b('0xd')](_0x0c4b('0x1f'),_0x585cfd['uniqueid'],_0x585cfd[_0x0c4b('0x1c')],_0x585cfd[_0x0c4b('0x20')]));if(_[_0x0c4b('0x21')](_0x585cfd[_0x0c4b('0x20')],_0x0c4b('0x22'))){_0x585cfd[_0x0c4b('0x20')]=_0x585cfd[_0x0c4b('0x20')][_0x0c4b('0x23')](_0x0c4b('0x22'),'.WAV');}if(recordings[_0x585cfd[_0x0c4b('0xe')]]){var _0x38b165=_[_0x0c4b('0x24')](recordings[_0x585cfd['linkedid']][_0x0c4b('0x25')],{'value':_0x585cfd[_0x0c4b('0x20')]});if(_[_0x0c4b('0x17')](_0x38b165)){recordings[_0x585cfd[_0x0c4b('0xe')]]['monitors'][_0x0c4b('0x26')]({'value':_0x585cfd[_0x0c4b('0x20')]});}}}}catch(_0x3ab5bd){utils[_0x0c4b('0x1a')](util['format'](_0x0c4b('0x27'),_0x585cfd[_0x0c4b('0x4')]),_0x3ab5bd);}};exports['hangup']=function(_0x4e93a5){try{if(!_[_0x0c4b('0x17')](recordings[_0x4e93a5[_0x0c4b('0x4')]])){utils['debug'](util[_0x0c4b('0xd')](_0x0c4b('0x28'),_0x4e93a5[_0x0c4b('0x4')]),_0x4e93a5);utils[_0x0c4b('0x3')](util[_0x0c4b('0xd')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4e93a5[_0x0c4b('0x4')],_0x4e93a5[_0x0c4b('0x29')],_0x4e93a5['calleridname'],_0x4e93a5[_0x0c4b('0x2a')]));recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x29')]=_0x4e93a5[_0x0c4b('0x29')];recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x2b')]=_0x4e93a5[_0x0c4b('0x2b')];recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x2c')]=_0x4e93a5[_0x0c4b('0x2c')];recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x2d')]=_0x4e93a5[_0x0c4b('0x2d')];if(recordings[_0x4e93a5[_0x0c4b('0x4')]]['type']=='outbound'&&recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x5')]){recordings[_0x4e93a5['uniqueid']][_0x0c4b('0x2c')]=recordings[_0x4e93a5[_0x0c4b('0x4')]]['accountcode'];recordings[_0x4e93a5[_0x0c4b('0x4')]]['connectedlinename']='';}recordings[_0x4e93a5[_0x0c4b('0x4')]][_0x0c4b('0x25')]['forEach'](function(_0x1667bd){var _0x55924e=_[_0x0c4b('0x2e')](recordings[_0x4e93a5[_0x0c4b('0x4')]]);_0x55924e[_0x0c4b('0x20')]=_0x1667bd[_0x0c4b('0x20')];writeDB(_0x55924e);});delete recordings[_0x4e93a5['uniqueid']];}}catch(_0x446720){utils[_0x0c4b('0x1a')](util[_0x0c4b('0xd')](_0x0c4b('0x28'),_0x4e93a5[_0x0c4b('0x4')]),_0x446720);}};exports[_0x0c4b('0x2f')]=function(_0x5d6392){try{if(!_[_0x0c4b('0x17')](recordings[_0x5d6392[_0x0c4b('0x4')]])){utils[_0x0c4b('0x1e')](util[_0x0c4b('0xd')](_0x0c4b('0x30'),_0x5d6392[_0x0c4b('0x4')]),_0x5d6392);utils[_0x0c4b('0x3')](util[_0x0c4b('0xd')](_0x0c4b('0x31'),_0x5d6392[_0x0c4b('0x4')],_0x5d6392[_0x0c4b('0x32')],_0x5d6392[_0x0c4b('0x33')]));if(_0x5d6392[_0x0c4b('0x32')][_0x0c4b('0x34')]()=='set'&&_[_0x0c4b('0x35')](_0x5d6392[_0x0c4b('0x33')][_0x0c4b('0x34')](),'cdr')){var _0x516579=_0x5d6392[_0x0c4b('0x33')][_0x0c4b('0x36')]('=');var _0x380100=_0x516579[0x0][_0x0c4b('0x37')](_0x516579[0x0]['lastIndexOf']('(')+0x1,_0x516579[0x0]['lastIndexOf'](')'));var _0x2175ad=_0x516579[0x1];recordings[_0x5d6392[_0x0c4b('0x4')]][_0x380100]=_0x2175ad;}}}catch(_0x482d49){utils[_0x0c4b('0x1a')](util[_0x0c4b('0xd')]('[%s][recordings][newexten]',_0x5d6392[_0x0c4b('0x4')]),_0x482d49);}};exports['queuecallerjoin']=function(_0x37a7d3){try{if(!_['isNil'](recordings[_0x37a7d3['uniqueid']])){utils['debug'](util[_0x0c4b('0xd')](_0x0c4b('0x38'),_0x37a7d3['uniqueid']),_0x37a7d3);utils[_0x0c4b('0x3')](util[_0x0c4b('0xd')](_0x0c4b('0x39'),_0x37a7d3[_0x0c4b('0x4')],_0x37a7d3[_0x0c4b('0x3a')]));recordings[_0x37a7d3['uniqueid']][_0x0c4b('0x3a')]=_0x37a7d3[_0x0c4b('0x3a')];}}catch(_0x409f5){utils['error'](util[_0x0c4b('0xd')]('[%s][recordings][queuecallerjoin]',_0x37a7d3[_0x0c4b('0x4')]),_0x409f5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a8fd05d..5551317 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 _0xbb62=['transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0xbb62,0x1ec));var _0x2bb6=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xbb62[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x2bb6('0x0'));var util=require(_0x2bb6('0x1'));var utils=require(_0x2bb6('0x2'));function writeDB(_0x44069d){utils[_0x2bb6('0x3')](util[_0x2bb6('0x4')](_0x2bb6('0x5'),_0x44069d[_0x2bb6('0x6')]===_0x2bb6('0x7')?_0x44069d[_0x2bb6('0x8')]:_0x44069d[_0x2bb6('0x9')],_0x44069d[_0x2bb6('0x6')]));utils[_0x2bb6('0xa')](_0x2bb6('0xb'),_0x44069d);}exports[_0x2bb6('0xc')]=function(_0x33390a){try{utils[_0x2bb6('0xd')](util[_0x2bb6('0x4')](_0x2bb6('0xe'),_0x33390a['uniqueid']),_0x33390a);utils[_0x2bb6('0x3')](util[_0x2bb6('0x4')](_0x2bb6('0xf'),_0x33390a[_0x2bb6('0x9')],_0x33390a['transferercalleridnum'],_0x33390a[_0x2bb6('0x10')],_0x33390a[_0x2bb6('0x11')],_0x33390a[_0x2bb6('0x12')]));_0x33390a[_0x2bb6('0x6')]=_0x2bb6('0x13');writeDB(_0x33390a);}catch(_0x58bbcf){utils[_0x2bb6('0x14')](util[_0x2bb6('0x4')](_0x2bb6('0xe'),_0x33390a['uniqueid']),_0x58bbcf);}};exports[_0x2bb6('0x15')]=function(_0x42549b){try{utils['debug'](util[_0x2bb6('0x4')](_0x2bb6('0x16'),_0x42549b[_0x2bb6('0x8')]),_0x42549b);utils[_0x2bb6('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x42549b[_0x2bb6('0x8')],_0x42549b[_0x2bb6('0x17')],_0x42549b['origtransferercalleridname'],_0x42549b[_0x2bb6('0x18')],_0x42549b['transfertargetcalleridname']));_0x42549b=_[_0x2bb6('0x19')](_0x42549b,{'transfererchannel':_0x42549b[_0x2bb6('0x1a')],'transferercalleridnum':_0x42549b[_0x2bb6('0x17')],'transferercalleridname':_0x42549b[_0x2bb6('0x1b')],'transfererconnectedlinenum':_0x42549b[_0x2bb6('0x1c')],'transfererconnectedlinename':_0x42549b[_0x2bb6('0x1d')],'transfereraccountcode':_0x42549b[_0x2bb6('0x1e')],'transferercontext':_0x42549b[_0x2bb6('0x1f')],'transfererexten':_0x42549b[_0x2bb6('0x20')],'transfererlinkedid':_0x42549b[_0x2bb6('0x21')],'context':_0x42549b[_0x2bb6('0x22')],'extension':_0x42549b[_0x2bb6('0x23')],'type':'attended'});if(_['isNil'](_0x42549b['transfereechannel'])){_0x42549b=_['assign'](_0x42549b,{'transfereechannel':_0x42549b[_0x2bb6('0x24')],'transfereecalleridnum':_0x42549b['transfertargetcalleridnum'],'transfereecalleridname':_0x42549b[_0x2bb6('0x25')],'transfereeconnectedlinenum':_0x42549b[_0x2bb6('0x26')],'transfereeconnectedlinename':_0x42549b[_0x2bb6('0x27')],'transfereeaccountcode':_0x42549b[_0x2bb6('0x28')],'transfereecontext':_0x42549b['transfertargetcontext'],'transfereeexten':_0x42549b[_0x2bb6('0x29')],'transfereelinkedid':_0x42549b[_0x2bb6('0x2a')]});}writeDB(_0x42549b);}catch(_0x59e9a1){utils[_0x2bb6('0x14')](util[_0x2bb6('0x4')](_0x2bb6('0x16'),_0x42549b['origtransfereruniqueid']),_0x59e9a1);}}; \ No newline at end of file +var _0x9afc=['format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridname','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9afc,0xe4));var _0xc9af=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9afc[_0x411017];return _0x2adeea;};'use strict';var _=require(_0xc9af('0x0'));var util=require(_0xc9af('0x1'));var utils=require(_0xc9af('0x2'));function writeDB(_0x362cb4){utils[_0xc9af('0x3')](util['format'](_0xc9af('0x4'),_0x362cb4['type']===_0xc9af('0x5')?_0x362cb4[_0xc9af('0x6')]:_0x362cb4['uniqueid'],_0x362cb4[_0xc9af('0x7')]));utils[_0xc9af('0x8')](_0xc9af('0x9'),_0x362cb4);}exports[_0xc9af('0xa')]=function(_0xc87205){try{utils[_0xc9af('0xb')](util[_0xc9af('0xc')](_0xc9af('0xd'),_0xc87205['uniqueid']),_0xc87205);utils['info'](util[_0xc9af('0xc')](_0xc9af('0xe'),_0xc87205[_0xc9af('0xf')],_0xc87205[_0xc9af('0x10')],_0xc87205[_0xc9af('0x11')],_0xc87205['transfereecalleridnum'],_0xc87205[_0xc9af('0x12')]));_0xc87205['type']='blind';writeDB(_0xc87205);}catch(_0x4867d9){utils[_0xc9af('0x13')](util[_0xc9af('0xc')]('[%s][transfers][blindtransfer]',_0xc87205[_0xc9af('0xf')]),_0x4867d9);}};exports['attendedtransfer']=function(_0x1087bb){try{utils[_0xc9af('0xb')](util['format'](_0xc9af('0x14'),_0x1087bb['origtransfereruniqueid']),_0x1087bb);utils[_0xc9af('0x3')](util[_0xc9af('0xc')](_0xc9af('0x15'),_0x1087bb[_0xc9af('0x6')],_0x1087bb[_0xc9af('0x16')],_0x1087bb[_0xc9af('0x17')],_0x1087bb['transfertargetcalleridnum'],_0x1087bb[_0xc9af('0x18')]));_0x1087bb=_[_0xc9af('0x19')](_0x1087bb,{'transfererchannel':_0x1087bb[_0xc9af('0x1a')],'transferercalleridnum':_0x1087bb[_0xc9af('0x16')],'transferercalleridname':_0x1087bb[_0xc9af('0x17')],'transfererconnectedlinenum':_0x1087bb[_0xc9af('0x1b')],'transfererconnectedlinename':_0x1087bb['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1087bb[_0xc9af('0x1c')],'transferercontext':_0x1087bb[_0xc9af('0x1d')],'transfererexten':_0x1087bb['secondtransfererexten'],'transfererlinkedid':_0x1087bb[_0xc9af('0x1e')],'context':_0x1087bb[_0xc9af('0x1f')],'extension':_0x1087bb[_0xc9af('0x20')],'type':_0xc9af('0x5')});if(_[_0xc9af('0x21')](_0x1087bb['transfereechannel'])){_0x1087bb=_[_0xc9af('0x19')](_0x1087bb,{'transfereechannel':_0x1087bb[_0xc9af('0x22')],'transfereecalleridnum':_0x1087bb['transfertargetcalleridnum'],'transfereecalleridname':_0x1087bb['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1087bb[_0xc9af('0x23')],'transfereeconnectedlinename':_0x1087bb[_0xc9af('0x24')],'transfereeaccountcode':_0x1087bb['transfertargetaccountcode'],'transfereecontext':_0x1087bb[_0xc9af('0x25')],'transfereeexten':_0x1087bb[_0xc9af('0x26')],'transfereelinkedid':_0x1087bb[_0xc9af('0x27')]});}writeDB(_0x1087bb);}catch(_0x52e782){utils[_0xc9af('0x13')](util[_0xc9af('0xc')]('[%s][transfers][attendedtransfer]',_0x1087bb[_0xc9af('0x6')]),_0x52e782);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1c0f9e9..d555867 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 _0x5afc=['name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','then','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x2313e8,_0x332e97){var _0x482a35=function(_0xe736a0){while(--_0xe736a0){_0x2313e8['push'](_0x2313e8['shift']());}};_0x482a35(++_0x332e97);}(_0x5afc,0x1db));var _0xc5af=function(_0x1ec76b,_0x28039a){_0x1ec76b=_0x1ec76b-0x0;var _0x755800=_0x5afc[_0x1ec76b];return _0x755800;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc5af('0x0'));var moment=require(_0xc5af('0x1'));var util=require(_0xc5af('0x2'));var client=jayson[_0xc5af('0x3')][_0xc5af('0x4')]({'port':0x2329});var logger=require(_0xc5af('0x5'))(_0xc5af('0x6'));exports['info']=function(_0x1f1a85,_0x4139bf){logger[_0xc5af('0x7')](_0x1f1a85,_0x4139bf?util[_0xc5af('0x8')](_0x4139bf,{'showHidden':![],'depth':null}):'');};exports[_0xc5af('0x9')]=function(_0x16e002,_0x481e99){logger[_0xc5af('0x9')](_0x16e002,_0x481e99?util[_0xc5af('0x8')](_0x481e99,{'showHidden':![],'depth':null}):'');};exports[_0xc5af('0xa')]=function(_0x1cf8f5,_0x54f371){logger[_0xc5af('0xa')](_0x1cf8f5,_0x54f371?util[_0xc5af('0x8')](_0x54f371,{'showHidden':![],'depth':null}):'');};exports[_0xc5af('0xb')]=function(_0x460c60,_0x3517a8){return client['request'](_0x460c60,{'body':_0x3517a8})['then'](function(_0x54997f){logger[_0xc5af('0x9')]('[utils][request]\x20name:%s',_0x460c60,_0x54997f?util['inspect'](_0x54997f,{'showHidden':![],'depth':null}):'');})[_0xc5af('0xc')](function(_0x5d8ab8){logger[_0xc5af('0xa')](_0xc5af('0xd'),_0x460c60,_0x5d8ab8?util['inspect'](_0x5d8ab8,{'showHidden':![],'depth':null}):'');});};function getUser(_0xbbe106){return client['request'](_0xc5af('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc5af('0xf'),'name',_0xc5af('0x10')],'where':_0xbbe106,'limit':0x1}})['then'](function(_0x32f9ff){logger[_0xc5af('0x9')](_0xc5af('0x11'),JSON['stringify'](_0xbbe106),_0x32f9ff?util[_0xc5af('0x8')](_0x32f9ff,{'showHidden':![],'depth':null}):'');return _0x32f9ff[_0xc5af('0x12')]['length']?_0x32f9ff[_0xc5af('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x36d033){return new BPromise(function(_0x73ee8a,_0x314d24){if(_0x36d033){return getUser({'internal':_0x36d033})['then'](function(_0x285fc5){logger[_0xc5af('0x7')](_0xc5af('0x13'),_0x36d033,_0x285fc5?_0xc5af('0x14'):'notfound');return _0x73ee8a(_0x285fc5);})['catch'](function(_0x7cc9af){logger[_0xc5af('0xa')](_0xc5af('0x15'),_0x7cc9af?util[_0xc5af('0x8')](_0x7cc9af,{'showHidden':![],'depth':null}):'');return _0x73ee8a(null);});}return _0x73ee8a(null);});};exports['getUserByInterface']=function(_0x239302){return new BPromise(function(_0x48a891,_0x1183b6){if(_0x239302){return getUser({'interface':_0x239302})[_0xc5af('0x16')](function(_0x4b3178){logger[_0xc5af('0x7')](_0xc5af('0x17'),_0x239302,_0x4b3178?_0xc5af('0x14'):_0xc5af('0x18'));return _0x48a891(_0x4b3178);})[_0xc5af('0xc')](function(_0x99c65){logger['error'](_0xc5af('0x19'),_0x99c65?util[_0xc5af('0x8')](_0x99c65,{'showHidden':![],'depth':null}):'');return _0x48a891(null);});}return _0x48a891(null);});};exports[_0xc5af('0x1a')]=function(_0x119dc7){return new BPromise(function(_0x3a883d,_0x19e488){if(_0x119dc7){return getUser({'name':_0x119dc7})[_0xc5af('0x16')](function(_0x4df2d6){logger[_0xc5af('0x7')](_0xc5af('0x1b'),_0x119dc7,_0x4df2d6?_0xc5af('0x14'):_0xc5af('0x18'));return _0x3a883d(_0x4df2d6);})[_0xc5af('0xc')](function(_0x2d55f3){logger['error'](_0xc5af('0x1c'),_0x2d55f3?util['inspect'](_0x2d55f3,{'showHidden':![],'depth':null}):'');return _0x3a883d(null);});}return _0x3a883d(null);});};exports[_0xc5af('0x1d')]=function(_0x4c6407){return new BPromise(function(_0x2f7da2,_0x5994c4){if(_0x4c6407){return client[_0xc5af('0xb')](_0xc5af('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xc5af('0x1f'),'type',_0xc5af('0x20'),_0xc5af('0x21')],'where':{'name':_0x4c6407},'limit':0x1}})[_0xc5af('0x16')](function(_0x5fb030){logger[_0xc5af('0x9')](_0xc5af('0x22'),_0x4c6407,_0x5fb030?util[_0xc5af('0x8')](_0x5fb030,{'showHidden':![],'depth':null}):'');logger[_0xc5af('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4c6407,_0x5fb030?_0xc5af('0x14'):'notfound');return _0x2f7da2(_0x5fb030[_0xc5af('0x12')][_0xc5af('0x23')]?_0x5fb030[_0xc5af('0x12')][0x0]:null);})[_0xc5af('0xc')](function(_0x586117){logger[_0xc5af('0xa')]('[utils][getVoiceQueueByName]',_0x586117?util['inspect'](_0x586117,{'showHidden':![],'depth':null}):'');return _0x2f7da2(null);});}return _0x2f7da2(null);});};exports['addTime']=function(_0x423589,_0x1a0caf){return moment(_0x423589)[_0xc5af('0x24')](_0x1a0caf,'seconds')[_0xc5af('0x25')](_0xc5af('0x26'));};exports[_0xc5af('0x27')]=function(_0x3dff70,_0x3678bd){return moment(_0x3dff70)['subtract'](_0x3678bd,_0xc5af('0x28'))[_0xc5af('0x25')](_0xc5af('0x26'));};exports[_0xc5af('0x29')]=function(_0x94f908,_0xbcf1a1){return moment(_0x94f908)['diff'](moment(_0xbcf1a1),'seconds');};exports[_0xc5af('0x2a')]=function(_0x3eee3d,_0x3b20be){return parseInt(_0x3eee3d,0xa)+parseInt(_0x3b20be,0xa);};exports[_0xc5af('0x2b')]=function(){return moment()[_0xc5af('0x25')](_0xc5af('0x26'));};exports['isAfter']=function(_0x336f05,_0x5720cc){if(_0x5720cc){return moment(_0x336f05)[_0xc5af('0x2c')](_0x5720cc);}return!![];};exports['isBefore']=function(_0x1d8995,_0x212ef1){if(_0x212ef1){return moment(_0x1d8995)[_0xc5af('0x2d')](_0x212ef1);}else if(_0x1d8995){return!![];}return![];}; \ No newline at end of file +var _0x5709=['getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x36830c,_0x47f045){var _0x4aaf6c=function(_0x7aeb29){while(--_0x7aeb29){_0x36830c['push'](_0x36830c['shift']());}};_0x4aaf6c(++_0x47f045);}(_0x5709,0x158));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x9570('0x0'));var jayson=require(_0x9570('0x1'));var moment=require(_0x9570('0x2'));var util=require('util');var client=jayson[_0x9570('0x3')][_0x9570('0x4')]({'port':0x2329});var logger=require(_0x9570('0x5'))('xdr');exports[_0x9570('0x6')]=function(_0x59262b,_0x47e2e3){logger[_0x9570('0x6')](_0x59262b,_0x47e2e3?util[_0x9570('0x7')](_0x47e2e3,{'showHidden':![],'depth':null}):'');};exports[_0x9570('0x8')]=function(_0x648ae5,_0x3e1a10){logger[_0x9570('0x8')](_0x648ae5,_0x3e1a10?util[_0x9570('0x7')](_0x3e1a10,{'showHidden':![],'depth':null}):'');};exports[_0x9570('0x9')]=function(_0x546539,_0x4d9a63){logger[_0x9570('0x9')](_0x546539,_0x4d9a63?util[_0x9570('0x7')](_0x4d9a63,{'showHidden':![],'depth':null}):'');};exports[_0x9570('0xa')]=function(_0x3db514,_0x36432b){return client['request'](_0x3db514,{'body':_0x36432b})[_0x9570('0xb')](function(_0x3df2c5){logger[_0x9570('0x8')](_0x9570('0xc'),_0x3db514,_0x3df2c5?util['inspect'](_0x3df2c5,{'showHidden':![],'depth':null}):'');})[_0x9570('0xd')](function(_0x4e1e96){logger[_0x9570('0x9')]('[utils][request]\x20name:%s',_0x3db514,_0x4e1e96?util[_0x9570('0x7')](_0x4e1e96,{'showHidden':![],'depth':null}):'');});};function getUser(_0x62052b){return client['request'](_0x9570('0xe'),{'options':{'raw':!![],'attributes':['id',_0x9570('0xf'),_0x9570('0x10'),_0x9570('0x11')],'where':_0x62052b,'limit':0x1}})['then'](function(_0x29dff8){logger[_0x9570('0x8')](_0x9570('0x12'),JSON[_0x9570('0x13')](_0x62052b),_0x29dff8?util['inspect'](_0x29dff8,{'showHidden':![],'depth':null}):'');return _0x29dff8[_0x9570('0x14')]['length']?_0x29dff8['result'][0x0]:null;});}exports[_0x9570('0x15')]=function(_0x1a0a11){return new BPromise(function(_0x1ca5ec,_0x422ebc){if(_0x1a0a11){return getUser({'internal':_0x1a0a11})[_0x9570('0xb')](function(_0x231a78){logger[_0x9570('0x6')](_0x9570('0x16'),_0x1a0a11,_0x231a78?_0x9570('0x17'):_0x9570('0x18'));return _0x1ca5ec(_0x231a78);})['catch'](function(_0x4e1f69){logger[_0x9570('0x9')](_0x9570('0x19'),_0x4e1f69?util[_0x9570('0x7')](_0x4e1f69,{'showHidden':![],'depth':null}):'');return _0x1ca5ec(null);});}return _0x1ca5ec(null);});};exports[_0x9570('0x1a')]=function(_0x4b0f0a){return new BPromise(function(_0x3cf846,_0x153a70){if(_0x4b0f0a){return getUser({'interface':_0x4b0f0a})[_0x9570('0xb')](function(_0x4c7493){logger[_0x9570('0x6')](_0x9570('0x1b'),_0x4b0f0a,_0x4c7493?_0x9570('0x17'):_0x9570('0x18'));return _0x3cf846(_0x4c7493);})[_0x9570('0xd')](function(_0x5066bc){logger[_0x9570('0x9')](_0x9570('0x1c'),_0x5066bc?util[_0x9570('0x7')](_0x5066bc,{'showHidden':![],'depth':null}):'');return _0x3cf846(null);});}return _0x3cf846(null);});};exports[_0x9570('0x1d')]=function(_0x38d8d3){return new BPromise(function(_0x2c0664,_0x3717b1){if(_0x38d8d3){return getUser({'name':_0x38d8d3})['then'](function(_0x319827){logger[_0x9570('0x6')](_0x9570('0x1e'),_0x38d8d3,_0x319827?_0x9570('0x17'):_0x9570('0x18'));return _0x2c0664(_0x319827);})[_0x9570('0xd')](function(_0x49fbd3){logger[_0x9570('0x9')](_0x9570('0x1f'),_0x49fbd3?util['inspect'](_0x49fbd3,{'showHidden':![],'depth':null}):'');return _0x2c0664(null);});}return _0x2c0664(null);});};exports[_0x9570('0x20')]=function(_0x3ccb08){return new BPromise(function(_0x170a51,_0x34db74){if(_0x3ccb08){return client[_0x9570('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x9570('0x21'),'acw',_0x9570('0x22')],'where':{'name':_0x3ccb08},'limit':0x1}})[_0x9570('0xb')](function(_0x5a9c86){logger[_0x9570('0x8')](_0x9570('0x23'),_0x3ccb08,_0x5a9c86?util['inspect'](_0x5a9c86,{'showHidden':![],'depth':null}):'');logger[_0x9570('0x6')](_0x9570('0x24'),_0x3ccb08,_0x5a9c86?_0x9570('0x17'):_0x9570('0x18'));return _0x170a51(_0x5a9c86[_0x9570('0x14')][_0x9570('0x25')]?_0x5a9c86[_0x9570('0x14')][0x0]:null);})[_0x9570('0xd')](function(_0x5869ec){logger[_0x9570('0x9')]('[utils][getVoiceQueueByName]',_0x5869ec?util['inspect'](_0x5869ec,{'showHidden':![],'depth':null}):'');return _0x170a51(null);});}return _0x170a51(null);});};exports['addTime']=function(_0x56d797,_0x1e6aa4){return moment(_0x56d797)['add'](_0x1e6aa4,_0x9570('0x26'))[_0x9570('0x27')](_0x9570('0x28'));};exports[_0x9570('0x29')]=function(_0x218727,_0x3b0ff1){return moment(_0x218727)[_0x9570('0x2a')](_0x3b0ff1,_0x9570('0x26'))[_0x9570('0x27')](_0x9570('0x28'));};exports['diffTime']=function(_0x75d2f1,_0x49a808){return moment(_0x75d2f1)[_0x9570('0x2b')](moment(_0x49a808),_0x9570('0x26'));};exports[_0x9570('0x2c')]=function(_0x45ee25,_0x147571){return parseInt(_0x45ee25,0xa)+parseInt(_0x147571,0xa);};exports['now']=function(){return moment()[_0x9570('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x1a6bac,_0x25841c){if(_0x25841c){return moment(_0x1a6bac)[_0x9570('0x2d')](_0x25841c);}return!![];};exports[_0x9570('0x2e')]=function(_0x3d9a66,_0x874a4d){if(_0x874a4d){return moment(_0x3d9a66)['isBefore'](_0x874a4d);}else if(_0x3d9a66){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 902a3ee..3a986d2 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 _0x6520=['./mask-sensitive-data','maskSensitiveData','join','/var','log','client','name','then','catch','user','no-user','error','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','logger','device','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','url','role','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate'];(function(_0x5d3a07,_0x4e0341){var _0x273b5f=function(_0x555187){while(--_0x555187){_0x5d3a07['push'](_0x5d3a07['shift']());}};_0x273b5f(++_0x4e0341);}(_0x6520,0x100));var _0x0652=function(_0x184d38,_0x22d05a){_0x184d38=_0x184d38-0x0;var _0x2923dd=_0x6520[_0x184d38];return _0x2923dd;};var fs=require(_0x0652('0x0'));var _=require(_0x0652('0x1'));var ewinston=require(_0x0652('0x2'));var path=require(_0x0652('0x3'));var util=require(_0x0652('0x4'));var fileLogger=require(_0x0652('0x5'))[_0x0652('0x6')];var safeTemplate=require('./safe-template')[_0x0652('0x7')];var maskSensitiveData=require(_0x0652('0x8'))[_0x0652('0x9')];function ClientSideLogger(){function _0xd2d461(_0x4e69a5){var _0x511f47=path[_0x0652('0xa')](_0x0652('0xb'),_0x0652('0xc'),'xcally');var _0x4c96a9=path['join'](_0x0652('0xd'),_0x4e69a5['role']+'-'+_0x4e69a5[_0x0652('0xe')]);return fs['ensureDir'](path[_0x0652('0xa')](_0x511f47,_0x4c96a9))[_0x0652('0xf')](function(){var _0x52e811=fileLogger(_0x0652('0xd'),path[_0x0652('0xa')](_0x511f47,_0x4c96a9));return _0x52e811;})[_0x0652('0x10')](function(_0x4dce21){throw _0x4dce21;});}this[_0x0652('0xc')]=function(_0x179340,_0x57e7dc,_0x1642b2,_0x2ce7f5){return _0xd2d461(_0x179340[_0x0652('0x11')])[_0x0652('0xf')](function(_0x5c3c6f){var _0x1fa8d2=_0x5c3c6f[_0x57e7dc];return _0x1fa8d2;})['then'](function(_0x1e3b6d){var _0x100f70=_0x179340['user']?_0x179340['user']['id']:_0x0652('0x12');var _0x42c7e3=_0x2ce7f5['data'];var _0x1a0137=_0x2ce7f5['timestamp'];var _0xdd807=new Date(Number(_0x1a0137));return _0x1e3b6d(_0x100f70,_0xdd807,_0x1642b2,_0x42c7e3);})[_0x0652('0x10')](function(_0x2b269f){fileLogger(_0x0652('0xd'))[_0x0652('0x13')](_0x2b269f);});};}function setupLoggers(_0x15278b){return new Promise(function(_0x28533e){var _0x36cc5d=new ClientSideLogger();var _0x5733b9=fileLogger(_0x0652('0x14'));var _0x24e271=fileLogger(_0x0652('0x15'));_0x15278b['set'](_0x0652('0x16'),_0x36cc5d);_0x15278b[_0x0652('0x17')](ewinston['logger']({'winstonInstance':_0x5733b9,'meta':![],'statusLevels':!![],'msg':function(_0x18e6bb,_0x178ebe){var _0x49b949=_0x0652('0x18');if(!_[_0x0652('0x19')](_0x18e6bb['body'])){_0x49b949+=_0x0652('0x1a');var _0x11b382=_0x18e6bb['body'];maskSensitiveData(_0x11b382);}return safeTemplate(util[_0x0652('0x1b')](_0x49b949,_0x18e6bb['method'],_0x18e6bb['headers'][_0x0652('0x1c')]?_0x18e6bb['headers'][_0x0652('0x1c')]:_0x18e6bb[_0x0652('0x1d')][_0x0652('0x1e')]||_0x18e6bb['ip'],_0x18e6bb['url'],_0x178ebe[_0x0652('0x1f')],_0x178ebe[_0x0652('0x20')],_0x18e6bb[_0x0652('0x11')]?_0x18e6bb[_0x0652('0x11')]['id']:null,_0x18e6bb[_0x0652('0x11')]?_0x18e6bb['user'][_0x0652('0xe')]:null,_0x18e6bb[_0x0652('0x11')]?_0x18e6bb[_0x0652('0x11')]['role']:null,_0x11b382?util['inspect'](_0x11b382,![],null):''));}}));_0x15278b[_0x0652('0x17')](ewinston[_0x0652('0x21')]({'winstonInstance':_0x24e271,'meta':![],'statusLevels':!![],'msg':function(_0x4c8ee6,_0x3c80f5){var _0x4c6468='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4c8ee6['body']&&_0x4c8ee6['body'][_0x0652('0x22')]&&_0x4c8ee6[_0x0652('0x23')][_0x0652('0x24')]){_0x4c6468=_0x0652('0x25');}return util['format'](_0x4c6468,_0x4c8ee6['method'],_0x4c8ee6[_0x0652('0x26')]['x-forwarded-for']?_0x4c8ee6[_0x0652('0x26')][_0x0652('0x1c')]:_0x4c8ee6[_0x0652('0x1d')]['remoteAddress']||_0x4c8ee6['ip'],_0x4c8ee6[_0x0652('0x27')],_0x3c80f5[_0x0652('0x1f')],_0x3c80f5[_0x0652('0x20')],_0x4c8ee6['user']?_0x4c8ee6[_0x0652('0x11')]['id']:null,_0x4c8ee6[_0x0652('0x11')]?_0x4c8ee6[_0x0652('0x11')][_0x0652('0xe')]:null,_0x4c8ee6[_0x0652('0x11')]?_0x4c8ee6[_0x0652('0x11')][_0x0652('0x28')]:null,_0x4c8ee6['body']&&_0x4c8ee6[_0x0652('0x23')][_0x0652('0x22')]?_0x4c8ee6['body']['device']:_0x0652('0x29'),_0x4c8ee6[_0x0652('0x23')]&&_0x4c8ee6[_0x0652('0x23')][_0x0652('0x24')]?_0x4c8ee6[_0x0652('0x23')][_0x0652('0x24')]:'',_0x4c8ee6[_0x0652('0x23')]&&_0x4c8ee6[_0x0652('0x23')]['agent_name']?_0x4c8ee6[_0x0652('0x23')][_0x0652('0x2a')]:'');},'ignoreRoute':function(_0x2ca5ab){var _0x30abd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x30abd['test'](_0x2ca5ab[_0x0652('0x27')]);}}));return _0x28533e();});}exports[_0x0652('0x2b')]=setupLoggers; \ No newline at end of file +var _0xeff2=['join','/var','role','ensureDir','then','client','catch','log','user','no-user','data','timestamp','api','auth','client-side-logger','logger','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','name','device','other','agent_name','test','lodash','express-winston','path','util','./safe-template','./mask-sensitive-data','maskSensitiveData'];(function(_0x4e79ea,_0x2852cd){var _0x13ef80=function(_0x268bcf){while(--_0x268bcf){_0x4e79ea['push'](_0x4e79ea['shift']());}};_0x13ef80(++_0x2852cd);}(_0xeff2,0x1a7));var _0x2eff=function(_0x4c0666,_0x5680d2){_0x4c0666=_0x4c0666-0x0;var _0x237e4d=_0xeff2[_0x4c0666];return _0x237e4d;};var fs=require('fs-extra');var _=require(_0x2eff('0x0'));var ewinston=require(_0x2eff('0x1'));var path=require(_0x2eff('0x2'));var util=require(_0x2eff('0x3'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x2eff('0x4'))['safeTemplate'];var maskSensitiveData=require(_0x2eff('0x5'))[_0x2eff('0x6')];function ClientSideLogger(){function _0x26c21d(_0x4d9f11){var _0x2dcc26=path[_0x2eff('0x7')](_0x2eff('0x8'),'log','xcally');var _0x18eb4f=path[_0x2eff('0x7')]('client',_0x4d9f11[_0x2eff('0x9')]+'-'+_0x4d9f11['name']);return fs[_0x2eff('0xa')](path['join'](_0x2dcc26,_0x18eb4f))[_0x2eff('0xb')](function(){var _0x2fd9c9=fileLogger(_0x2eff('0xc'),path['join'](_0x2dcc26,_0x18eb4f));return _0x2fd9c9;})[_0x2eff('0xd')](function(_0x4e981e){throw _0x4e981e;});}this[_0x2eff('0xe')]=function(_0x195526,_0x4337b3,_0x30ef93,_0x1ba43f){return _0x26c21d(_0x195526[_0x2eff('0xf')])[_0x2eff('0xb')](function(_0x572035){var _0x269e64=_0x572035[_0x4337b3];return _0x269e64;})['then'](function(_0x3873d9){var _0x3f1b43=_0x195526[_0x2eff('0xf')]?_0x195526[_0x2eff('0xf')]['id']:_0x2eff('0x10');var _0x3735f5=_0x1ba43f[_0x2eff('0x11')];var _0x3ae82f=_0x1ba43f[_0x2eff('0x12')];var _0x5a3d79=new Date(Number(_0x3ae82f));return _0x3873d9(_0x3f1b43,_0x5a3d79,_0x30ef93,_0x3735f5);})[_0x2eff('0xd')](function(_0x5a3c54){fileLogger('client')['error'](_0x5a3c54);});};}function setupLoggers(_0x585dfa){return new Promise(function(_0x1766e0){var _0x506ae8=new ClientSideLogger();var _0x19853f=fileLogger(_0x2eff('0x13'));var _0x129e03=fileLogger(_0x2eff('0x14'));_0x585dfa['set'](_0x2eff('0x15'),_0x506ae8);_0x585dfa['use'](ewinston[_0x2eff('0x16')]({'winstonInstance':_0x19853f,'meta':![],'statusLevels':!![],'msg':function(_0x4ed0b4,_0x5d83b6){var _0x1fbb7f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x4ed0b4[_0x2eff('0x17')])){_0x1fbb7f+=_0x2eff('0x18');var _0xe005b7=_0x4ed0b4[_0x2eff('0x17')];maskSensitiveData(_0xe005b7);}return safeTemplate(util[_0x2eff('0x19')](_0x1fbb7f,_0x4ed0b4[_0x2eff('0x1a')],_0x4ed0b4['headers'][_0x2eff('0x1b')]?_0x4ed0b4[_0x2eff('0x1c')][_0x2eff('0x1b')]:_0x4ed0b4[_0x2eff('0x1d')][_0x2eff('0x1e')]||_0x4ed0b4['ip'],_0x4ed0b4[_0x2eff('0x1f')],_0x5d83b6[_0x2eff('0x20')],_0x5d83b6['responseTime'],_0x4ed0b4[_0x2eff('0xf')]?_0x4ed0b4[_0x2eff('0xf')]['id']:null,_0x4ed0b4[_0x2eff('0xf')]?_0x4ed0b4[_0x2eff('0xf')]['name']:null,_0x4ed0b4[_0x2eff('0xf')]?_0x4ed0b4['user']['role']:null,_0xe005b7?util[_0x2eff('0x21')](_0xe005b7,![],null):''));}}));_0x585dfa['use'](ewinston[_0x2eff('0x16')]({'winstonInstance':_0x129e03,'meta':![],'statusLevels':!![],'msg':function(_0x5d7654,_0x390c88){var _0x256dfb=_0x2eff('0x22');if(_0x5d7654['body']&&_0x5d7654['body']['device']&&_0x5d7654[_0x2eff('0x17')][_0x2eff('0x23')]){_0x256dfb=_0x2eff('0x24');}return util[_0x2eff('0x19')](_0x256dfb,_0x5d7654[_0x2eff('0x1a')],_0x5d7654[_0x2eff('0x1c')][_0x2eff('0x1b')]?_0x5d7654['headers']['x-forwarded-for']:_0x5d7654[_0x2eff('0x1d')]['remoteAddress']||_0x5d7654['ip'],_0x5d7654[_0x2eff('0x1f')],_0x390c88['statusCode'],_0x390c88[_0x2eff('0x25')],_0x5d7654[_0x2eff('0xf')]?_0x5d7654['user']['id']:null,_0x5d7654[_0x2eff('0xf')]?_0x5d7654['user'][_0x2eff('0x26')]:null,_0x5d7654['user']?_0x5d7654[_0x2eff('0xf')][_0x2eff('0x9')]:null,_0x5d7654[_0x2eff('0x17')]&&_0x5d7654['body'][_0x2eff('0x27')]?_0x5d7654[_0x2eff('0x17')][_0x2eff('0x27')]:_0x2eff('0x28'),_0x5d7654[_0x2eff('0x17')]&&_0x5d7654[_0x2eff('0x17')]['agent_id']?_0x5d7654[_0x2eff('0x17')][_0x2eff('0x23')]:'',_0x5d7654[_0x2eff('0x17')]&&_0x5d7654[_0x2eff('0x17')][_0x2eff('0x29')]?_0x5d7654[_0x2eff('0x17')][_0x2eff('0x29')]:'');},'ignoreRoute':function(_0x1d60ec){var _0x2e14fc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e14fc[_0x2eff('0x2a')](_0x1d60ec['url']);}}));return _0x1766e0();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index d07b133..abaa75d 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84e9=['locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','isBefore','startOf','day','endOf','isBetween','exports','timeCompare','format','includes','date','daysInMonth','max','min','domCompare','MMM','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split'];(function(_0x417c71,_0x34f8d8){var _0x4a3211=function(_0x56944d){while(--_0x56944d){_0x417c71['push'](_0x417c71['shift']());}};_0x4a3211(++_0x34f8d8);}(_0x84e9,0xe7));var _0x984e=function(_0x215640,_0x37d775){_0x215640=_0x215640-0x0;var _0x4ab9bf=_0x84e9[_0x215640];return _0x4ab9bf;};var _=require(_0x984e('0x0'));var moment=require(_0x984e('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][_0x984e('0x2')](function(_0x2c0267){return _0x2c0267[_0x984e('0x3')];})[_0x984e('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x984e('0x5');var EINVALID_DATE=_0x984e('0x6');function throwIfDateNotValid(_0x39e67c){if(!_0x39e67c[_0x984e('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5780c7){var _0x49eead=_0x5780c7[_0x984e('0x8')](':')[_0x984e('0x2')](function(_0x2b4616){return parseInt(_0x2b4616,0xa);});var _0x2bc3c0=_0x49eead[0x0];var _0x24cbbb=_0x49eead[0x1];if(_0x2bc3c0<0x0||_0x2bc3c0>0x17||_0x24cbbb<0x0||_0x24cbbb>0x3b){throw new Error(EINVALID_DATE);}return[_0x2bc3c0,_0x24cbbb];}function circularDoWInterval(_0x445aa3,_0x199e26){if(_0x445aa3===_0x199e26){return[_0x445aa3];}else{var _0x3b5fff=moment[_0x984e('0x9')]();moment[_0x984e('0x9')]('en');var _0x5a050b=moment[_0x984e('0xa')]()['map'](function(_0x5d8994){return _0x5d8994['toLowerCase']();});moment[_0x984e('0x9')](_0x3b5fff);var _0x11778a=_0x5a050b[_0x984e('0xb')](_0x445aa3);var _0x5332c1=_0x5a050b[_0x984e('0xb')](_0x199e26);if(_0x5332c1>_0x11778a){return _0x5a050b[_0x984e('0xc')](_0x11778a,_0x5332c1+0x1);}else{var _0x542bb2=_0x5a050b[_0x984e('0xc')](0x0,_0x5332c1+0x1);var _0x17946e=_0x5a050b[_0x984e('0xc')](_0x11778a);return _0x17946e[_0x984e('0xd')](_0x542bb2);}}}module['exports'][_0x984e('0xe')]=circularDoWInterval;function circularMonthInterval(_0x4d80c4,_0x5998ea){if(_0x4d80c4===_0x5998ea){return[_0x4d80c4];}else{var _0x40a475=moment[_0x984e('0x9')]();moment[_0x984e('0x9')]('en');var _0x769309=moment[_0x984e('0xf')]()[_0x984e('0x2')](function(_0x334539){return _0x334539[_0x984e('0x10')]();});moment[_0x984e('0x9')](_0x40a475);var _0x414a52=_0x769309['indexOf'](_0x4d80c4);var _0xc7a435=_0x769309['indexOf'](_0x5998ea);if(_0xc7a435>_0x414a52){return _0x769309[_0x984e('0xc')](_0x414a52,_0xc7a435+0x1);}else{var _0x2de8d9=_0x769309[_0x984e('0xc')](0x0,_0xc7a435+0x1);var _0x17e7a5=_0x769309['slice'](_0x414a52);return _0x17e7a5[_0x984e('0xd')](_0x2de8d9);}}}module['exports'][_0x984e('0x11')]=circularMonthInterval;function parseDom(_0x48af3a){var _0x512b08=parseInt(_0x48af3a,0xa);if(_0x512b08<0x1||_0x512b08>0x1f){throw new Error(EINVALID_DATE);}return _0x512b08;}function timeCompare(_0x70c274,_0x2895a7,_0x423852){var _0x2cad34=_0x70c274[_0x984e('0x12')]();var _0x3d219f=extractTime(_0x2895a7);var _0x5e34e8=_0x3d219f[0x0];var _0x53fc4e=_0x3d219f[0x1];var _0x21fbc1=_0x70c274['clone']()['hours'](_0x5e34e8)['minutes'](_0x53fc4e);throwIfDateNotValid(_0x21fbc1);var _0x1ba968=extractTime(_0x423852);var _0x15a07e=_0x1ba968[0x0];var _0x42b55c=_0x1ba968[0x1];var _0x32973c=_0x70c274[_0x984e('0x12')]()[_0x984e('0x13')](_0x15a07e)['minutes'](_0x42b55c);throwIfDateNotValid(_0x32973c);if(_0x32973c[_0x984e('0x14')](_0x21fbc1)){var _0x324e41=_0x2cad34[_0x984e('0x12')]()[_0x984e('0x15')](_0x984e('0x16'));var _0x724ecb=_0x2cad34[_0x984e('0x12')]()[_0x984e('0x17')](_0x984e('0x16'));return _0x2cad34[_0x984e('0x18')](_0x21fbc1,_0x724ecb,undefined,'[]')||_0x2cad34[_0x984e('0x18')](_0x324e41,_0x32973c,undefined,'[]');}else{return _0x2cad34['isBetween'](_0x21fbc1,_0x32973c,undefined,'[]');}}module[_0x984e('0x19')][_0x984e('0x1a')]=timeCompare;function dowCompare(_0x4d895c,_0x40f06c,_0x3aac00){var _0x53e7c8=_0x4d895c[_0x984e('0x9')]('en')[_0x984e('0x1b')]('ddd')['toLowerCase']();return circularDoWInterval(_0x40f06c,_0x3aac00)[_0x984e('0x1c')](_0x53e7c8);}module[_0x984e('0x19')]['dowCompare']=dowCompare;function domCompare(_0x547c85,_0x329780,_0x50bd6e){var _0x27cf62=_0x547c85[_0x984e('0x1d')]();if(_0x329780===_0x50bd6e){return _0x27cf62===_0x329780;}else{var _0x180316=_0x547c85[_0x984e('0x1e')]();var _0x4edb61=_0x329780<_0x50bd6e;let _0x4ff2a9=![];var _0x17e97e=0x0;var _0x31a428=0x0;if(_0x4edb61){_0x17e97e=Math[_0x984e('0x1f')](0x1,_0x329780);_0x31a428=Math[_0x984e('0x20')](_0x50bd6e,_0x180316);_0x4ff2a9=_0x27cf62>=_0x17e97e&&_0x27cf62<=_0x31a428;}else{_0x17e97e=Math[_0x984e('0x20')](_0x329780,_0x180316);_0x31a428=Math['max'](0x1,_0x50bd6e);_0x4ff2a9=_0x27cf62>=_0x17e97e||_0x27cf62<=_0x31a428;}return _0x4ff2a9;}}module[_0x984e('0x19')][_0x984e('0x21')]=domCompare;function monthCompare(_0x48f297,_0x5c9794,_0x39bdf9){var _0x55361a=_0x48f297['locale']('en')[_0x984e('0x1b')](_0x984e('0x22'))[_0x984e('0x10')]();return circularMonthInterval(_0x5c9794,_0x39bdf9)[_0x984e('0x1c')](_0x55361a);}module[_0x984e('0x19')]['monthCompare']=monthCompare;function iftime(_0x2ef76e,_0x4ab3c4=moment['tz']['guess'](),_0x345c6f=moment()){if(!validateRx[_0x984e('0x23')](_0x2ef76e)){throw new Error(EINVALID_STRING);}else{var _0x337a9c=(moment[_0x984e('0x24')](_0x345c6f)?_0x345c6f[_0x984e('0x12')]():moment(_0x345c6f))['tz'](_0x4ab3c4)[_0x984e('0x9')]('en');throwIfDateNotValid(_0x337a9c);var _0x492dac=_0x2ef76e[_0x984e('0x8')](',');var _0x4fe379=_0x492dac[0x0];var _0x11761f=_0x492dac[0x1];var _0x4c012c=_0x492dac[0x2];var _0x10b715=_0x492dac[0x3];let _0x48f9d7=!![];if(_0x4fe379!=='*'){var _0xd9b115=_0x4fe379[_0x984e('0x8')]('-');var _0xe9b88f=_[_0x984e('0x25')](_0xd9b115[0x0],0x5,'0');var _0x3e8547=_0xd9b115['length']===0x2?_[_0x984e('0x25')](_0xd9b115[0x1],0x5,'0'):_0xe9b88f;_0x48f9d7=timeCompare(_0x337a9c,_0xe9b88f,_0x3e8547);}let _0x5cc466=!![];if(_0x11761f!=='*'){var _0x19177d=_0x11761f[_0x984e('0x8')]('-');var _0x8cec06=_0x19177d[0x0];var _0x2bc38f=_0x19177d[_0x984e('0x26')]===0x2?_0x19177d[0x1]:_0x8cec06;_0x5cc466=dowCompare(_0x337a9c,_0x8cec06,_0x2bc38f);}let _0x24658e=!![];if(_0x4c012c!=='*'){var _0xb8e173=_0x4c012c['split']('-');var _0x1f798c=parseDom(_0xb8e173[0x0]);var _0x33481d=_0xb8e173[_0x984e('0x26')]===0x2?parseDom(_0xb8e173[0x1]):_0x1f798c;_0x24658e=domCompare(_0x337a9c,_0x1f798c,_0x33481d);}let _0x14e4db=!![];if(_0x10b715!=='*'){var _0x581589=_0x10b715['split']('-');var _0x309996=_0x581589[0x0];var _0x17b3d6=_0x581589[_0x984e('0x26')]===0x2?_0x581589[0x1]:_0x581589[0x0];_0x14e4db=monthCompare(_0x337a9c,_0x309996,_0x17b3d6);}return _0x48f9d7&&_0x5cc466&&_0x24658e&&_0x14e4db;}}module[_0x984e('0x19')][_0x984e('0x27')]=iftime; \ No newline at end of file +var _0xa5d9=['indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','isBefore','startOf','endOf','day','isBetween','timeCompare','ddd','date','min','max','domCompare','format','MMM','includes','monthCompare','guess','test','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase'];(function(_0x494121,_0x477b36){var _0x1a03db=function(_0x30bf97){while(--_0x30bf97){_0x494121['push'](_0x494121['shift']());}};_0x1a03db(++_0x477b36);}(_0xa5d9,0x6a));var _0x9a5d=function(_0x9fbce9,_0xfb57a8){_0x9fbce9=_0x9fbce9-0x0;var _0x1f13c9=_0xa5d9[_0x9fbce9];return _0x1f13c9;};var _=require(_0x9a5d('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9a5d('0x1')](function(_0x9621){return _0x9621[_0x9a5d('0x2')];})[_0x9a5d('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9a5d('0x4');var EINVALID_DATE=_0x9a5d('0x5');function throwIfDateNotValid(_0x3e0905){if(!_0x3e0905[_0x9a5d('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x13620f){var _0x228869=_0x13620f[_0x9a5d('0x7')](':')[_0x9a5d('0x1')](function(_0x5d2e95){return parseInt(_0x5d2e95,0xa);});var _0x1eacab=_0x228869[0x0];var _0x1bd433=_0x228869[0x1];if(_0x1eacab<0x0||_0x1eacab>0x17||_0x1bd433<0x0||_0x1bd433>0x3b){throw new Error(EINVALID_DATE);}return[_0x1eacab,_0x1bd433];}function circularDoWInterval(_0x1f1661,_0x252474){if(_0x1f1661===_0x252474){return[_0x1f1661];}else{var _0x39896d=moment['locale']();moment[_0x9a5d('0x8')]('en');var _0x3f4daa=moment[_0x9a5d('0x9')]()[_0x9a5d('0x1')](function(_0x5acf0f){return _0x5acf0f[_0x9a5d('0xa')]();});moment[_0x9a5d('0x8')](_0x39896d);var _0xe47538=_0x3f4daa[_0x9a5d('0xb')](_0x1f1661);var _0x4f148b=_0x3f4daa['indexOf'](_0x252474);if(_0x4f148b>_0xe47538){return _0x3f4daa[_0x9a5d('0xc')](_0xe47538,_0x4f148b+0x1);}else{var _0x5eb9e7=_0x3f4daa[_0x9a5d('0xc')](0x0,_0x4f148b+0x1);var _0x5dc8db=_0x3f4daa[_0x9a5d('0xc')](_0xe47538);return _0x5dc8db[_0x9a5d('0xd')](_0x5eb9e7);}}}module['exports'][_0x9a5d('0xe')]=circularDoWInterval;function circularMonthInterval(_0x18e497,_0x3c5c57){if(_0x18e497===_0x3c5c57){return[_0x18e497];}else{var _0x168e48=moment['locale']();moment[_0x9a5d('0x8')]('en');var _0x19b65c=moment[_0x9a5d('0xf')]()['map'](function(_0x596d02){return _0x596d02[_0x9a5d('0xa')]();});moment[_0x9a5d('0x8')](_0x168e48);var _0x1d0f21=_0x19b65c[_0x9a5d('0xb')](_0x18e497);var _0x5a73c2=_0x19b65c[_0x9a5d('0xb')](_0x3c5c57);if(_0x5a73c2>_0x1d0f21){return _0x19b65c[_0x9a5d('0xc')](_0x1d0f21,_0x5a73c2+0x1);}else{var _0x14248b=_0x19b65c['slice'](0x0,_0x5a73c2+0x1);var _0xe533a1=_0x19b65c[_0x9a5d('0xc')](_0x1d0f21);return _0xe533a1[_0x9a5d('0xd')](_0x14248b);}}}module[_0x9a5d('0x10')][_0x9a5d('0x11')]=circularMonthInterval;function parseDom(_0x1c7641){var _0x3c14dd=parseInt(_0x1c7641,0xa);if(_0x3c14dd<0x1||_0x3c14dd>0x1f){throw new Error(EINVALID_DATE);}return _0x3c14dd;}function timeCompare(_0x332fa1,_0x2d1816,_0x4db9ab){var _0x3d1f3a=_0x332fa1[_0x9a5d('0x12')]();var _0x1f5b07=extractTime(_0x2d1816);var _0x2f654e=_0x1f5b07[0x0];var _0x131f82=_0x1f5b07[0x1];var _0x414d6f=_0x332fa1['clone']()['hours'](_0x2f654e)['minutes'](_0x131f82);throwIfDateNotValid(_0x414d6f);var _0x5f5949=extractTime(_0x4db9ab);var _0x425880=_0x5f5949[0x0];var _0x4c8e16=_0x5f5949[0x1];var _0xa0ef97=_0x332fa1['clone']()[_0x9a5d('0x13')](_0x425880)['minutes'](_0x4c8e16);throwIfDateNotValid(_0xa0ef97);if(_0xa0ef97[_0x9a5d('0x14')](_0x414d6f)){var _0x2fcaa7=_0x3d1f3a[_0x9a5d('0x12')]()[_0x9a5d('0x15')]('day');var _0x59c6cd=_0x3d1f3a[_0x9a5d('0x12')]()[_0x9a5d('0x16')](_0x9a5d('0x17'));return _0x3d1f3a[_0x9a5d('0x18')](_0x414d6f,_0x59c6cd,undefined,'[]')||_0x3d1f3a[_0x9a5d('0x18')](_0x2fcaa7,_0xa0ef97,undefined,'[]');}else{return _0x3d1f3a[_0x9a5d('0x18')](_0x414d6f,_0xa0ef97,undefined,'[]');}}module['exports'][_0x9a5d('0x19')]=timeCompare;function dowCompare(_0x48fc84,_0x5521bc,_0xbb2653){var _0x2ab0a1=_0x48fc84[_0x9a5d('0x8')]('en')['format'](_0x9a5d('0x1a'))[_0x9a5d('0xa')]();return circularDoWInterval(_0x5521bc,_0xbb2653)['includes'](_0x2ab0a1);}module[_0x9a5d('0x10')]['dowCompare']=dowCompare;function domCompare(_0x389c8f,_0x12dbe4,_0x1da73c){var _0x1724a5=_0x389c8f[_0x9a5d('0x1b')]();if(_0x12dbe4===_0x1da73c){return _0x1724a5===_0x12dbe4;}else{var _0x4b8386=_0x389c8f['daysInMonth']();var _0xfe26a1=_0x12dbe4<_0x1da73c;let _0x18656c=![];var _0x1ca299=0x0;var _0x2a93df=0x0;if(_0xfe26a1){_0x1ca299=Math['max'](0x1,_0x12dbe4);_0x2a93df=Math[_0x9a5d('0x1c')](_0x1da73c,_0x4b8386);_0x18656c=_0x1724a5>=_0x1ca299&&_0x1724a5<=_0x2a93df;}else{_0x1ca299=Math[_0x9a5d('0x1c')](_0x12dbe4,_0x4b8386);_0x2a93df=Math[_0x9a5d('0x1d')](0x1,_0x1da73c);_0x18656c=_0x1724a5>=_0x1ca299||_0x1724a5<=_0x2a93df;}return _0x18656c;}}module[_0x9a5d('0x10')][_0x9a5d('0x1e')]=domCompare;function monthCompare(_0x2b9e00,_0xcf90e0,_0x9b9c30){var _0x4206c1=_0x2b9e00['locale']('en')[_0x9a5d('0x1f')](_0x9a5d('0x20'))['toLowerCase']();return circularMonthInterval(_0xcf90e0,_0x9b9c30)[_0x9a5d('0x21')](_0x4206c1);}module[_0x9a5d('0x10')][_0x9a5d('0x22')]=monthCompare;function iftime(_0x54bf17,_0x5cf35d=moment['tz'][_0x9a5d('0x23')](),_0x24caa7=moment()){if(!validateRx[_0x9a5d('0x24')](_0x54bf17)){throw new Error(EINVALID_STRING);}else{var _0x16c2cf=(moment['isMoment'](_0x24caa7)?_0x24caa7[_0x9a5d('0x12')]():moment(_0x24caa7))['tz'](_0x5cf35d)['locale']('en');throwIfDateNotValid(_0x16c2cf);var _0x343482=_0x54bf17['split'](',');var _0x533ad9=_0x343482[0x0];var _0x5d04d8=_0x343482[0x1];var _0x4b9ac8=_0x343482[0x2];var _0x5c2604=_0x343482[0x3];let _0xc51e12=!![];if(_0x533ad9!=='*'){var _0x34047e=_0x533ad9[_0x9a5d('0x7')]('-');var _0x5dc294=_[_0x9a5d('0x25')](_0x34047e[0x0],0x5,'0');var _0x2d1e0a=_0x34047e[_0x9a5d('0x26')]===0x2?_['padStart'](_0x34047e[0x1],0x5,'0'):_0x5dc294;_0xc51e12=timeCompare(_0x16c2cf,_0x5dc294,_0x2d1e0a);}let _0xe20256=!![];if(_0x5d04d8!=='*'){var _0x1fa17b=_0x5d04d8[_0x9a5d('0x7')]('-');var _0x1ae167=_0x1fa17b[0x0];var _0x151e8f=_0x1fa17b[_0x9a5d('0x26')]===0x2?_0x1fa17b[0x1]:_0x1ae167;_0xe20256=dowCompare(_0x16c2cf,_0x1ae167,_0x151e8f);}let _0x586332=!![];if(_0x4b9ac8!=='*'){var _0x2c414f=_0x4b9ac8[_0x9a5d('0x7')]('-');var _0x28b334=parseDom(_0x2c414f[0x0]);var _0xda00eb=_0x2c414f[_0x9a5d('0x26')]===0x2?parseDom(_0x2c414f[0x1]):_0x28b334;_0x586332=domCompare(_0x16c2cf,_0x28b334,_0xda00eb);}let _0x28eaeb=!![];if(_0x5c2604!=='*'){var _0x53e183=_0x5c2604[_0x9a5d('0x7')]('-');var _0x8fa3a9=_0x53e183[0x0];var _0x36247f=_0x53e183[_0x9a5d('0x26')]===0x2?_0x53e183[0x1]:_0x53e183[0x0];_0x28eaeb=monthCompare(_0x16c2cf,_0x8fa3a9,_0x36247f);}return _0xc51e12&&_0xe20256&&_0x586332&&_0x28eaeb;}}module[_0x9a5d('0x10')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 87d0e21..266455e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bf1=['meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','transports','File','%s-%s','error','Console','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x3bf1,0x163));var _0x13bf=function(_0x3aa13c,_0x4d4893){_0x3aa13c=_0x3aa13c-0x0;var _0x25e056=_0x3bf1[_0x3aa13c];return _0x25e056;};'use strict';var path=require(_0x13bf('0x0'));var util=require(_0x13bf('0x1'));var moment=require(_0x13bf('0x2'));var winston=require(_0x13bf('0x3'));var config=require(_0x13bf('0x4'));var debugLevel=config[_0x13bf('0x5')]?config[_0x13bf('0x5')][_0x13bf('0x6')]():_0x13bf('0x7');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':_0x13bf('0x8'),'error':_0x13bf('0x9'),'warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':'bold\x20green','http':_0x13bf('0xa'),'verbose':_0x13bf('0xb'),'debug':'bold\x20blue','silly':_0x13bf('0xc')};winston[_0x13bf('0xd')](XC_LOG_COLORS);function getLogFileName(_0x187d8f,_0x2724ad,_0x4bf8bc){var _0x596c0e=_0x187d8f||_0x13bf('0xe');return path[_0x13bf('0xf')](_0x596c0e,util[_0x13bf('0x10')](_0x13bf('0x11'),_0x2724ad,_0x4bf8bc));}function formatter(_0x5d9bdb,_0x31b715){_0x31b715['message']=_0x31b715[_0x13bf('0x12')]['replace'](/@@{/g,_0x13bf('0x13'))[_0x13bf('0x14')](/}@@/g,_0x13bf('0x15'))[_0x13bf('0x14')](/@{/g,'{{')[_0x13bf('0x14')](/}@/g,'}}');return util[_0x13bf('0x10')](_0x13bf('0x16'),moment()[_0x13bf('0x10')](_0x13bf('0x17')),_0x31b715['level'][_0x13bf('0x18')](),_0x5d9bdb,_0x31b715[_0x13bf('0x12')]);}function fileFormat(_0x2d2f55,_0x429f22){_0x429f22['message']=_0x429f22['message'][_0x13bf('0x14')](/@@{/g,_0x13bf('0x13'))['replace'](/}@@/g,_0x13bf('0x15'))[_0x13bf('0x14')](/@{/g,'{{')[_0x13bf('0x14')](/}@/g,'}}');var _0xce7c32=_0x429f22[_0x13bf('0x19')]&&Object['keys'](_0x429f22['meta'])[_0x13bf('0x1a')]?'\x0a\x09'+JSON[_0x13bf('0x1b')](_0x429f22[_0x13bf('0x19')]):'';return util[_0x13bf('0x10')](_0x13bf('0x1c'),moment()[_0x13bf('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x429f22[_0x13bf('0x1d')][_0x13bf('0x18')](),_0x2d2f55,_0x429f22['message'],_0xce7c32);}function consoleLogger(){var _0x1f5e8e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x152359){return formatter('',_0x152359);}})]});return _0x1f5e8e;}function fileLogger(_0x3cd0c5,_0x4faa0f){var _0xf920d9=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x13bf('0x1e'))][(_0x13bf('0x1f'))]({'name':util['format'](_0x13bf('0x20'),_0x3cd0c5,_0x13bf('0x21')),'filename':getLogFileName(_0x4faa0f,_0x3cd0c5,_0x13bf('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42d8d7){return fileFormat(_0x3cd0c5,_0x42d8d7);}}),new winston['transports'][(_0x13bf('0x1f'))]({'name':util[_0x13bf('0x10')](_0x13bf('0x20'),_0x3cd0c5,debugLevel),'filename':getLogFileName(_0x4faa0f,_0x3cd0c5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53c10b){return fileFormat(_0x3cd0c5,_0x53c10b);}}),new winston['transports'][(_0x13bf('0x22'))]({'level':_0x13bf('0x23'),'json':![],'formatter':function(_0x19d095){return fileFormat(_0x3cd0c5,_0x19d095);}})]});return _0xf920d9;}exports[_0x13bf('0x24')]=consoleLogger;exports[_0x13bf('0x25')]=fileLogger; \ No newline at end of file +var _0x3051=['transports','error','File','%s-%s','fileLogger','path','util','moment','../config/environment','toLowerCase','bold\x20yellow','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn'];(function(_0x3592ab,_0x4f669a){var _0x13298a=function(_0x25f018){while(--_0x25f018){_0x3592ab['push'](_0x3592ab['shift']());}};_0x13298a(++_0x4f669a);}(_0x3051,0x1f4));var _0x1305=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3051[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var moment=require(_0x1305('0x2'));var winston=require('winston');var config=require(_0x1305('0x3'));var debugLevel=config['debugLevel']?config['debugLevel'][_0x1305('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0x1305('0x5'),'info':'white','print':'bold\x20white','success':_0x1305('0x6'),'http':_0x1305('0x7'),'verbose':_0x1305('0x8'),'debug':_0x1305('0x9'),'silly':_0x1305('0xa')};winston[_0x1305('0xb')](XC_LOG_COLORS);function getLogFileName(_0xfe962,_0x5e2bf6,_0x5e8b5e){var _0x4d4ef7=_0xfe962||_0x1305('0xc');return path[_0x1305('0xd')](_0x4d4ef7,util['format']('%s-%s.log',_0x5e2bf6,_0x5e8b5e));}function formatter(_0x183008,_0x39e83a){_0x39e83a['message']=_0x39e83a[_0x1305('0xe')][_0x1305('0xf')](/@@{/g,'{{{')[_0x1305('0xf')](/}@@/g,_0x1305('0x10'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x1305('0x11'),moment()[_0x1305('0x12')](_0x1305('0x13')),_0x39e83a[_0x1305('0x14')][_0x1305('0x15')](),_0x183008,_0x39e83a[_0x1305('0xe')]);}function fileFormat(_0x596da1,_0x3bbeb0){_0x3bbeb0['message']=_0x3bbeb0['message']['replace'](/@@{/g,_0x1305('0x16'))[_0x1305('0xf')](/}@@/g,_0x1305('0x10'))[_0x1305('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x249155=_0x3bbeb0['meta']&&Object['keys'](_0x3bbeb0['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x3bbeb0[_0x1305('0x17')]):'';return util[_0x1305('0x12')](_0x1305('0x18'),moment()[_0x1305('0x12')](_0x1305('0x13')),_0x3bbeb0[_0x1305('0x14')]['toUpperCase'](),_0x596da1,_0x3bbeb0[_0x1305('0xe')],_0x249155);}function consoleLogger(){var _0xa79318=new winston[(_0x1305('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1305('0x1a'))]({'level':_0x1305('0x1b'),'json':![],'formatter':function(_0x3df29d){return formatter('',_0x3df29d);}})]});return _0xa79318;}function fileLogger(_0x1a5066,_0x2ba2b8){var _0xbfad8a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1305('0x1c'))]['File']({'name':util['format']('%s-%s',_0x1a5066,_0x1305('0x1d')),'filename':getLogFileName(_0x2ba2b8,_0x1a5066,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c5c96){return fileFormat(_0x1a5066,_0x3c5c96);}}),new winston[(_0x1305('0x1c'))][(_0x1305('0x1e'))]({'name':util[_0x1305('0x12')](_0x1305('0x1f'),_0x1a5066,debugLevel),'filename':getLogFileName(_0x2ba2b8,_0x1a5066,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x557bec){return fileFormat(_0x1a5066,_0x557bec);}}),new winston[(_0x1305('0x1c'))]['Console']({'level':_0x1305('0x1b'),'json':![],'formatter':function(_0x3bfc37){return fileFormat(_0x1a5066,_0x3bfc37);}})]});return _0xbfad8a;}exports['consoleLogger']=consoleLogger;exports[_0x1305('0x20')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 96e1ff1..6654ad1 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 _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(_0x3a0119,_0xbaf203){var _0x131029=function(_0x54740f){while(--_0x54740f){_0x3a0119['push'](_0x3a0119['shift']());}};_0x131029(++_0xbaf203);}(_0x0b0e,0x187));var _0xe0b0=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x0b0e[_0x356127];return _0x5d4c75;};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 +var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x3ff291,_0x50316b){var _0x19845b=function(_0x1e5004){while(--_0x1e5004){_0x3ff291['push'](_0x3ff291['shift']());}};_0x19845b(++_0x50316b);}(_0x1261,0x144));var _0x1126=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x1261[_0x1db481];return _0x3db95b;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 9760548..37751bf 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 _0x8e3f=['reduce','exports','safeTemplate','lodash','{\x20{\x20','string','isArray','map','isPlainObject','keys'];(function(_0x1250f3,_0x356562){var _0x406119=function(_0x5a5246){while(--_0x5a5246){_0x1250f3['push'](_0x1250f3['shift']());}};_0x406119(++_0x356562);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};var _=require(_0xf8e3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42db69){return _0x42db69==='{{'?_0xf8e3('0x1'):'\x20}\x20}';}function safeTemplate(_0x3f3440){var _0x292de5=_0x3f3440;if(typeof _0x3f3440===_0xf8e3('0x2')){_0x292de5=_0x3f3440['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf8e3('0x3')](_0x3f3440)){_0x292de5=_0x3f3440[_0xf8e3('0x4')](function(_0x4dab56){return safeTemplate(_0x4dab56);});}else if(_[_0xf8e3('0x5')](_0x3f3440)){_0x292de5=Object[_0xf8e3('0x6')](_0x3f3440)[_0xf8e3('0x7')](function(_0x1ee9f3,_0x4e9e57){_0x1ee9f3[_0x4e9e57]=safeTemplate(_0x3f3440[_0x4e9e57]);return _0x1ee9f3;},{});}return _0x292de5;}module[_0xf8e3('0x8')][_0xf8e3('0x9')]=safeTemplate; \ No newline at end of file +var _0xdd4f=['isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','replace'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x41f525,_0x545072){_0x41f525=_0x41f525-0x0;var _0x2902ea=_0xdd4f[_0x41f525];return _0x2902ea;};var _=require(_0xfdd4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x51d240){return _0x51d240==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x291ae7){var _0x19cda7=_0x291ae7;if(typeof _0x291ae7==='string'){_0x19cda7=_0x291ae7[_0xfdd4('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfdd4('0x2')](_0x291ae7)){_0x19cda7=_0x291ae7[_0xfdd4('0x3')](function(_0x554e44){return safeTemplate(_0x554e44);});}else if(_[_0xfdd4('0x4')](_0x291ae7)){_0x19cda7=Object[_0xfdd4('0x5')](_0x291ae7)[_0xfdd4('0x6')](function(_0x307ac6,_0x3c72d4){_0x307ac6[_0x3c72d4]=safeTemplate(_0x291ae7[_0x3c72d4]);return _0x307ac6;},{});}return _0x19cda7;}module['exports'][_0xfdd4('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index e0c9140..8fed1e7 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 _0xabf5=['resolve','legacy-libs','isArray','apps','findIndex','NODE_PATH','string','env','pathExists','then','updated','info','writeJSON','fs-extra','path'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xabf5,0x1de));var _0x5abf=function(_0xd5d4a0,_0x5ecb16){_0xd5d4a0=_0xd5d4a0-0x0;var _0x9da71c=_0xabf5[_0xd5d4a0];return _0x9da71c;};var fs=require(_0x5abf('0x0'));var path=require(_0x5abf('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x5abf('0x2')](root,'server/app.json');var NODEPATH=path[_0x5abf('0x2')](root,_0x5abf('0x3'));function setLegacyLibsNodeEnvPath(_0x115c66){let _0x50df1d=![];if(Array[_0x5abf('0x4')](_0x115c66['apps'])){var _0x45cea6=_0x115c66[_0x5abf('0x5')][_0x5abf('0x6')](function(_0x1eff78){return _0x1eff78['name']==='motion2';});if(_0x45cea6>-0x1){var _0x22c77c=_0x115c66['apps'][_0x45cea6];if(typeof _0x22c77c['env'][_0x5abf('0x7')]!==_0x5abf('0x8')){_0x22c77c[_0x5abf('0x9')]['NODE_PATH']=NODEPATH;_0x50df1d=!![];}}return{'appConfig':_0x115c66,'updated':_0x50df1d};}}function updateAppConfig(_0x17a9b0){return fs[_0x5abf('0xa')](APP_JSON_PATH)[_0x5abf('0xb')](function(_0x20fd39){if(_0x20fd39){return fs['readJSON'](APP_JSON_PATH)[_0x5abf('0xb')](function(_0x254047){var _0x54bc83=setLegacyLibsNodeEnvPath(_0x254047);if(_0x54bc83[_0x5abf('0xc')]){_0x17a9b0[_0x5abf('0xd')]('Updating\x20app.json');return fs[_0x5abf('0xe')](APP_JSON_PATH,_0x254047,{'spaces':0x2});}else{return Promise[_0x5abf('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xb840=['legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','fs-extra','path','../config/environment','root','resolve','server/app.json'];(function(_0x54fd09,_0x314531){var _0x521304=function(_0x343262){while(--_0x343262){_0x54fd09['push'](_0x54fd09['shift']());}};_0x521304(++_0x314531);}(_0xb840,0x1b3));var _0x0b84=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0xb840[_0x243cca];return _0xf94771;};var fs=require(_0x0b84('0x0'));var path=require(_0x0b84('0x1'));var config=require(_0x0b84('0x2'));var root=config[_0x0b84('0x3')];var APP_JSON_PATH=path[_0x0b84('0x4')](root,_0x0b84('0x5'));var NODEPATH=path[_0x0b84('0x4')](root,_0x0b84('0x6'));function setLegacyLibsNodeEnvPath(_0x157c60){let _0x3403e2=![];if(Array[_0x0b84('0x7')](_0x157c60[_0x0b84('0x8')])){var _0x1064f9=_0x157c60['apps'][_0x0b84('0x9')](function(_0x2746a8){return _0x2746a8[_0x0b84('0xa')]===_0x0b84('0xb');});if(_0x1064f9>-0x1){var _0xf48eb2=_0x157c60[_0x0b84('0x8')][_0x1064f9];if(typeof _0xf48eb2[_0x0b84('0xc')][_0x0b84('0xd')]!==_0x0b84('0xe')){_0xf48eb2[_0x0b84('0xc')][_0x0b84('0xd')]=NODEPATH;_0x3403e2=!![];}}return{'appConfig':_0x157c60,'updated':_0x3403e2};}}function updateAppConfig(_0x1fd782){return fs[_0x0b84('0xf')](APP_JSON_PATH)[_0x0b84('0x10')](function(_0x4608b8){if(_0x4608b8){return fs[_0x0b84('0x11')](APP_JSON_PATH)[_0x0b84('0x10')](function(_0x1bf385){var _0x2f55e0=setLegacyLibsNodeEnvPath(_0x1bf385);if(_0x2f55e0[_0x0b84('0x12')]){_0x1fd782[_0x0b84('0x13')](_0x0b84('0x14'));return fs['writeJSON'](APP_JSON_PATH,_0x1bf385,{'spaces':0x2});}else{return Promise[_0x0b84('0x4')]();}});}else{return Promise[_0x0b84('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file